[med-svn] [sra-sdk] 02/06: Imported Upstream version 2.4.2-1

Andreas Tille tille at debian.org
Fri Oct 24 12:53:49 UTC 2014


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository sra-sdk.

commit 6d0c86f4d4f4492ed5a40ffd80ef3856c3ea1e0b
Author: Andreas Tille <tille at debian.org>
Date:   Fri Oct 24 14:29:04 2014 +0200

    Imported Upstream version 2.4.2-1
---
 .gitignore                                         |     4 +
 CHANGES                                            |    30 +
 GNU-license.txt                                    |   674 +
 Makefile                                           |    49 +-
 README                                             |    21 +
 README-blastn                                      |   133 +
 README-build                                       |   237 +
 README-build.txt                                   |   239 -
 README-config.txt                                  |    51 +-
 README-vdb-config.txt                              |   119 +
 README-wget.txt                                    |    35 +
 README.md                                          |    33 +
 USAGE                                              |   162 +
 build/.gitignore                                   |     5 +
 build/BUILD.linux                                  |     1 -
 build/BUILD.mac                                    |     1 -
 build/BUILD.win                                    |     1 -
 build/COMP.linux                                   |     1 -
 build/COMP.mac                                     |     1 -
 build/COMP.win                                     |     1 -
 build/LNKG.linux                                   |     1 -
 build/LNKG.mac                                     |     1 -
 build/LNKG.win                                     |     1 -
 build/MSVC/2010/.gitignore                         |     5 +
 build/MSVC/2010/abi-dump.vcxproj                   |    38 +
 build/MSVC/2010/align-info.vcxproj                 |    40 +
 build/MSVC/2010/cache-mgr.vcxproj                  |    40 +
 build/MSVC/2010/dll-project.props                  |    90 +
 build/MSVC/2010/exe-project.props                  |   104 +
 build/MSVC/2010/fastq-dump-ngs.vcxproj             |    44 +
 build/MSVC/2010/fastq-dump.vcxproj                 |    42 +
 build/MSVC/2010/fastq-loader.vcxproj               |    46 +
 build/MSVC/2010/illumina-diump.vcxproj             |    43 +
 build/MSVC/2010/kar.vcxproj                        |    40 +
 build/MSVC/2010/kdbmeta.vcxproj                    |    40 +
 build/MSVC/2010/lib-project.props                  |    96 +
 build/MSVC/2010/md5cp.vcxproj                      |    39 +
 build/MSVC/2010/prefetch.vcxproj                   |    40 +
 build/MSVC/2010/qual-recalib-stat.vcxproj          |    50 +
 build/MSVC/2010/rcexplain.vcxproj                  |    40 +
 build/MSVC/2010/read-filter-redact.vcxproj         |    40 +
 build/MSVC/2010/sam-dump.vcxproj                   |    52 +
 build/MSVC/2010/schema-replace.vcxproj             |    40 +
 build/MSVC/2010/sff-dump.vcxproj                   |    43 +
 build/MSVC/2010/sra-kar.vcxproj                    |    40 +
 build/MSVC/2010/sra-pileup.vcxproj                 |    56 +
 build/MSVC/2010/sra-stat.vcxproj                   |    40 +
 build/MSVC/2010/sra-tools.sln                      |   336 +
 build/MSVC/2010/srapath.vcxproj                    |    40 +
 build/MSVC/2010/test-project.props                 |    15 +
 build/MSVC/2010/test-sra.vcxproj                   |    41 +
 build/MSVC/2010/vcf-loader.vcxproj                 |    35 +
 build/MSVC/2010/vdb-common.props                   |    21 +
 build/MSVC/2010/vdb-config.vcxproj                 |    46 +
 build/MSVC/2010/vdb-copy.vcxproj                   |    51 +
 build/MSVC/2010/vdb-decrypt.vcxproj                |    41 +
 build/MSVC/2010/vdb-dump.vcxproj                   |    53 +
 build/MSVC/2010/vdb-encrypt.vcxproj                |    41 +
 build/MSVC/2010/vdb-lock.vcxproj                   |    40 +
 build/MSVC/2010/vdb-passwd.vcxproj                 |    41 +
 build/MSVC/2010/vdb-unlock.vcxproj                 |    39 +
 build/MSVC/2010/vdb-validate.vcxproj               |    40 +
 build/Makefile.cc                                  |    67 +
 build/Makefile.clang                               |    11 +-
 build/Makefile.env                                 |   174 +-
 build/Makefile.gcc                                 |     4 +-
 build/Makefile.install                             |   125 +
 build/Makefile.linux                               |    17 +-
 build/Makefile.mac                                 |     6 +-
 build/Makefile.rules                               |     5 +
 build/Makefile.scm                                 |    94 +
 build/Makefile.shell                               |    48 +-
 build/Makefile.sun                                 |    96 +
 build/Makefile.sun.cc                              |   155 +
 build/Makefile.sun.gcc                             |   138 +
 build/Makefile.targets                             |    22 +-
 build/Makefile.vc++                                |    13 +-
 build/Makefile.win                                 |    21 +-
 .../asm-trace/asm-trace.xcodeproj/project.pbxproj  |  4444 +++
 build/Xcode/old-toolkit/.gitignore                 |     1 +
 .../old-toolkit.xcodeproj/project.pbxproj          |  2153 ++
 build/cp.sh                                        |    32 +
 build/gprof2dot.py                                 |  2763 ++
 build/ld.linux.cmn.sh                              |     0
 build/ld.linux.dlib.sh                             |     9 +-
 build/ld.linux.exe.sh                              |     9 +-
 build/ld.mac.clang.sh                              |    53 +
 build/ld.mac.cmn.sh                                |     0
 build/ld.mac.dlib.sh                               |     4 +-
 build/ld.mac.exe.sh                                |    11 +-
 build/ld.rwin.dlib.sh                              |   363 +
 build/ld.rwin.exe.sh                               |   366 +
 build/ld.rwin.slib.sh                              |   123 +
 build/ld.rwin.stub.sh                              |    59 +
 build/ld.rwin.vc++.sh                              |    65 +
 build/ld.sh                                        |    35 +
 build/ld.sun.cc.sh                                 |    56 +
 build/ld.sun.cmn.sh                                |   160 +
 build/ld.sun.dlib.sh                               |   282 +
 build/ld.sun.exe.sh                                |   299 +
 build/ld.sun.ln.sh                                 |    87 +
 build/ld.sun.slib.sh                               |   135 +
 build/ld.unix.cmn.sh                               |     0
 build/ld.unix.slib.sh                              |     0
 build/libexists.sh                                 |   180 +
 build/make-defs-xf.pl                              |   108 +
 build/make-defs.pl                                 |   247 +
 build/run_remotely.sh                              |   124 +
 build/scm-collect.sh                               |    42 +
 build/scm.sh                                       |   136 +
 build/scm.txt                                      |   117 +
 build/sun-c++.sh                                   |   100 +
 build/sun-cc.sh                                    |    93 +
 build/tag-module.sh                                |   213 +
 build/wait_for_file.sh                             |    65 +
 build/win-cc.sh                                    |     1 +
 configuration-assistant.perl                       |  1228 -
 configure                                          |    45 +
 doc/help/html/abi-dump-help.html                   |    45 -
 doc/help/html/abi-load-help.html                   |    41 -
 doc/help/html/bam-load-help.html                   |    29 -
 doc/help/html/copycat-help.html                    |    64 -
 doc/help/html/crc32sum-help.html                   |    18 -
 doc/help/html/fastq-dump-help.html                 |    88 -
 doc/help/html/fastq-load-help.html                 |    41 -
 doc/help/html/illumina-dump-help.html              |    48 -
 doc/help/html/illumina-load-help.html              |    41 -
 doc/help/html/kar-help.html                        |    66 -
 doc/help/html/kdbmeta-help.html                    |    50 -
 doc/help/html/kqsh-help.html                       |    19 -
 doc/help/html/md5cp-help.html                      |    21 -
 doc/help/html/rcexplain-help.html                  |    27 -
 doc/help/html/sff-dump-help.html                   |    38 -
 doc/help/html/sra-dump-help.html                   |    38 -
 doc/help/html/sra-stat-help.html                   |    34 -
 doc/help/html/srapath-help.html                    |    47 -
 doc/help/html/srf-load-help.html                   |    41 -
 doc/help/html/txt2kdb-help.html                    |    48 -
 doc/help/html/vdb-dump-help.html                   |    45 -
 doc/help/txt/abi-dump-help.txt                     |    19 -
 doc/help/txt/abi-load-help.txt                     |    41 -
 doc/help/txt/bam-loader-help.txt                   |    18 -
 doc/help/txt/copycat-help.txt                      |    53 -
 doc/help/txt/crc32sum-help.txt                     |     6 -
 doc/help/txt/fastq-dump-help.txt                   |    57 -
 doc/help/txt/fastq-load-help.txt                   |    41 -
 doc/help/txt/illumina-dump-help.txt                |    29 -
 doc/help/txt/illumina-load-help.txt                |    41 -
 doc/help/txt/kar-help.txt                          |    48 -
 doc/help/txt/kdbmeta-help.txt                      |    30 -
 doc/help/txt/kqsh-help.txt                         |     7 -
 doc/help/txt/md5cp-help.txt                        |     8 -
 doc/help/txt/rcexplain-help.txt                    |     5 -
 doc/help/txt/sff-dump-help.txt                     |    19 -
 doc/help/txt/sra-dump-help.txt                     |    18 -
 doc/help/txt/sra-stat-help.txt                     |    19 -
 doc/help/txt/srapath-help.txt                      |    35 -
 doc/help/txt/srf-load-help.txt                     |    41 -
 doc/help/txt/txt2kdb-help.txt                      |    36 -
 doc/help/txt/vdb-dump-help.txt                     |    34 -
 interfaces/align/align-access.h                    |   342 -
 interfaces/align/align.vschema                     |  1487 -
 interfaces/align/alignsrc.h                        |    71 -
 interfaces/align/bam.h                             |   831 -
 interfaces/align/dna-reverse-cmpl.h                |    43 -
 interfaces/align/extern.h                          |    41 -
 interfaces/align/iterator.h                        |   610 -
 interfaces/align/manager.h                         |    69 -
 interfaces/align/qstat.vschema                     |    87 -
 interfaces/align/quality-quantizer.h               |    49 -
 interfaces/align/reader-refseq.h                   |    72 -
 interfaces/align/reference.h                       |   150 -
 interfaces/align/refseq-mgr.h                      |    86 -
 interfaces/align/refseq.vschema                    |   100 -
 interfaces/align/seq.vschema                       |   300 -
 interfaces/align/writer-alignment.h                |   177 -
 interfaces/align/writer-cmn.h                      |    46 -
 interfaces/align/writer-reference.h                |   151 -
 interfaces/align/writer-refseq.h                   |    89 -
 interfaces/align/writer-sequence.h                 |   149 -
 interfaces/cc/gcc/compiler.h                       |    39 -
 interfaces/cc/gcc/i386/arch-impl.h                 |   400 -
 interfaces/cc/gcc/i386/atomic.h                    |   162 -
 interfaces/cc/gcc/i386/atomic32.h                  |   369 -
 interfaces/cc/gcc/i386/bitstr.h                    |    39 -
 interfaces/cc/gcc/i386/byteswap.h                  |    89 -
 interfaces/cc/gcc/i386/strtol.h                    |    67 -
 interfaces/cc/gcc/noarch/bitstr.h                  |   413 -
 interfaces/cc/gcc/v128.h                           |  1088 -
 interfaces/cc/gcc/va_copy.h                        |    49 -
 interfaces/cc/gcc/x86_64/arch-impl.h               |   361 -
 interfaces/cc/gcc/x86_64/atomic.h                  |   176 -
 interfaces/cc/gcc/x86_64/atomic32.h                |   358 -
 interfaces/cc/gcc/x86_64/atomic64.h                |   358 -
 interfaces/cc/gcc/x86_64/bitstr.h                  |    39 -
 interfaces/cc/gcc/x86_64/byteswap.h                |    89 -
 interfaces/cc/gcc/x86_64/strtol.h                  |    69 -
 interfaces/cc/icc/compiler.h                       |    39 -
 interfaces/cc/vc++/compiler.h                      |    72 -
 interfaces/cc/vc++/i386/arch-impl.h                |    42 -
 interfaces/cc/vc++/i386/bitstr.h                   |    39 -
 interfaces/cc/vc++/noarch/arch-impl.h              |   286 -
 interfaces/cc/vc++/noarch/bitstr.h                 |   412 -
 interfaces/cc/vc++/stdbool.h                       |    46 -
 interfaces/cc/vc++/stdint.h                        |    50 -
 interfaces/cc/vc++/va_copy.h                       |    43 -
 interfaces/cc/vc++/x86_64/arch-impl.h              |    42 -
 interfaces/cc/vc++/x86_64/bitstr.h                 |    39 -
 interfaces/ext/bzlib.h                             |   282 -
 interfaces/ext/libxml/DOCBparser.h                 |    96 -
 interfaces/ext/libxml/HTMLparser.h                 |   303 -
 interfaces/ext/libxml/HTMLtree.h                   |   147 -
 interfaces/ext/libxml/SAX.h                        |   173 -
 interfaces/ext/libxml/SAX2.h                       |   176 -
 interfaces/ext/libxml/c14n.h                       |   115 -
 interfaces/ext/libxml/catalog.h                    |   182 -
 interfaces/ext/libxml/chvalid.h                    |   230 -
 interfaces/ext/libxml/debugXML.h                   |   217 -
 interfaces/ext/libxml/dict.h                       |    69 -
 interfaces/ext/libxml/encoding.h                   |   226 -
 interfaces/ext/libxml/entities.h                   |   150 -
 interfaces/ext/libxml/globals.h                    |   491 -
 interfaces/ext/libxml/hash.h                       |   233 -
 interfaces/ext/libxml/list.h                       |   137 -
 interfaces/ext/libxml/nanoftp.h                    |   143 -
 interfaces/ext/libxml/nanohttp.h                   |    81 -
 interfaces/ext/libxml/parser.h                     |  1226 -
 interfaces/ext/libxml/parserInternals.h            |   611 -
 interfaces/ext/libxml/pattern.h                    |   100 -
 interfaces/ext/libxml/relaxng.h                    |   213 -
 interfaces/ext/libxml/schemasInternals.h           |   958 -
 interfaces/ext/libxml/schematron.h                 |   142 -
 interfaces/ext/libxml/threads.h                    |    84 -
 interfaces/ext/libxml/tree.h                       |  1252 -
 interfaces/ext/libxml/uri.h                        |    94 -
 interfaces/ext/libxml/valid.h                      |   458 -
 interfaces/ext/libxml/xinclude.h                   |   125 -
 interfaces/ext/libxml/xlink.h                      |   189 -
 interfaces/ext/libxml/xmlIO.h                      |   360 -
 interfaces/ext/libxml/xmlautomata.h                |   146 -
 interfaces/ext/libxml/xmlerror.h                   |   944 -
 interfaces/ext/libxml/xmlexports.h                 |   157 -
 interfaces/ext/libxml/xmlmemory.h                  |   224 -
 interfaces/ext/libxml/xmlmodule.h                  |    57 -
 interfaces/ext/libxml/xmlreader.h                  |   424 -
 interfaces/ext/libxml/xmlregexp.h                  |   222 -
 interfaces/ext/libxml/xmlsave.h                    |    87 -
 interfaces/ext/libxml/xmlschemas.h                 |   218 -
 interfaces/ext/libxml/xmlschemastypes.h            |   151 -
 interfaces/ext/libxml/xmlstring.h                  |   140 -
 interfaces/ext/libxml/xmlunicode.h                 |   202 -
 interfaces/ext/libxml/xmlversion.h                 |   458 -
 interfaces/ext/libxml/xmlwriter.h                  |   485 -
 interfaces/ext/libxml/xpath.h                      |   546 -
 interfaces/ext/libxml/xpathInternals.h             |   630 -
 interfaces/ext/libxml/xpointer.h                   |   114 -
 interfaces/ext/magic.h                             |    89 -
 interfaces/ext/regex.h                             |   557 -
 interfaces/ext/zconf.h                             |   304 -
 interfaces/ext/zlib.h                              |  1613 -
 interfaces/insdc/insdc.h                           |   277 -
 interfaces/insdc/insdc.vschema                     |   210 -
 interfaces/insdc/seq.vschema                       |   210 -
 interfaces/insdc/sra.h                             |   110 -
 interfaces/insdc/sra.vschema                       |   484 -
 interfaces/kapp/args.h                             |   339 -
 interfaces/kapp/extern.h                           |    47 -
 interfaces/kapp/loader-file.h                      |   122 -
 interfaces/kapp/loader-meta.h                      |    51 -
 interfaces/kapp/log-xml.h                          |    76 -
 interfaces/kapp/main.h                             |   167 -
 interfaces/kapp/progressbar.h                      |    82 -
 interfaces/kapp/queue-file.h                       |   149 -
 interfaces/kdb/btree.h                             |   371 -
 interfaces/kdb/column.h                            |   302 -
 interfaces/kdb/consistency-check.h                 |   142 -
 interfaces/kdb/database.h                          |   270 -
 interfaces/kdb/extern.h                            |    41 -
 interfaces/kdb/index.h                             |   309 -
 interfaces/kdb/kdb-priv.h                          |   156 -
 interfaces/kdb/manager.h                           |   182 -
 interfaces/kdb/meta.h                              |   411 -
 interfaces/kdb/meta.hpp                            |   487 -
 interfaces/kdb/namelist.h                          |    81 -
 interfaces/kdb/table.h                             |   274 -
 interfaces/kfc/callconv.h                          |    53 -
 interfaces/kfc/ctx.h                               |   214 -
 interfaces/kfc/defs.h                              |   159 -
 interfaces/kfc/except.h                            |   149 -
 interfaces/kfc/extern.h                            |    68 -
 interfaces/kfc/rc.h                                |   352 -
 interfaces/kfc/rsrc.h                              |    80 -
 interfaces/kfc/xc.h                                |    94 -
 interfaces/kfc/xcdefs.h                            |    81 -
 interfaces/kfc/xcext.h                             |    64 -
 interfaces/kfc/xcgen.h                             |    68 -
 interfaces/kfg/config.h                            |   407 -
 interfaces/kfg/extern.h                            |    41 -
 interfaces/kfg/kart.h                              |    90 -
 interfaces/kfg/keystore-priv.h                     |    92 -
 interfaces/kfg/keystore.h                          |   153 -
 interfaces/kfg/kfg-priv.h                          |    90 -
 interfaces/kfg/repository.h                        |   290 -
 interfaces/kfs/arc.h                               |   142 -
 interfaces/kfs/arrayfile.h                         |   180 -
 interfaces/kfs/buffile.h                           |    94 -
 interfaces/kfs/bzip.h                              |    77 -
 interfaces/kfs/cacheteefile.h                      |   147 -
 interfaces/kfs/countfile.h                         |    73 -
 interfaces/kfs/crc.h                               |   292 -
 interfaces/kfs/defs.h                              |   115 -
 interfaces/kfs/directory.h                         |   522 -
 interfaces/kfs/directory.hpp                       |   582 -
 interfaces/kfs/dyload.h                            |   223 -
 interfaces/kfs/extern.h                            |    41 -
 interfaces/kfs/ffext.h                             |    48 -
 interfaces/kfs/ffmagic.h                           |    49 -
 interfaces/kfs/file.h                              |   287 -
 interfaces/kfs/file.hpp                            |   147 -
 interfaces/kfs/fileformat.h                        |   140 -
 interfaces/kfs/gzip.h                              |    77 -
 interfaces/kfs/impl.h                              |   337 -
 interfaces/kfs/kfs-priv.h                          |    95 -
 interfaces/kfs/lockfile.h                          |   116 -
 interfaces/kfs/md5.h                               |   289 -
 interfaces/kfs/mmap.h                              |   134 -
 interfaces/kfs/nullfile.h                          |    62 -
 interfaces/kfs/pagefile.h                          |   191 -
 interfaces/kfs/pmem.h                              |   157 -
 interfaces/kfs/quickmount.h                        |    61 -
 interfaces/kfs/ramfile.h                           |    75 -
 interfaces/kfs/readheadfile.h                      |    86 -
 interfaces/kfs/sra.h                               |   191 -
 interfaces/kfs/subfile.h                           |    64 -
 interfaces/kfs/tar.h                               |    94 -
 interfaces/kfs/teefile.h                           |    66 -
 interfaces/kfs/toc.h                               |   148 -
 interfaces/klib/callconv.h                         |    34 -
 interfaces/klib/checksum.h                         |   152 -
 interfaces/klib/container.h                        |   455 -
 interfaces/klib/data-buffer.h                      |   206 -
 interfaces/klib/debug.h                            |   541 -
 interfaces/klib/defs.h                             |   118 -
 interfaces/klib/extern.h                           |    51 -
 interfaces/klib/impl.h                             |    96 -
 interfaces/klib/klib-priv.h                        |   106 -
 interfaces/klib/ksort-macro.h                      |   257 -
 interfaces/klib/log.h                              |   380 -
 interfaces/klib/logfmt.h                           |    62 -
 interfaces/klib/misc.h                             |    48 -
 interfaces/klib/namelist.h                         |   181 -
 interfaces/klib/namelist.hpp                       |   130 -
 interfaces/klib/out.h                              |    86 -
 interfaces/klib/pack.h                             |   138 -
 interfaces/klib/pbstree.h                          |   287 -
 interfaces/klib/printf.h                           |   406 -
 interfaces/klib/ptrie.h                            |   296 -
 interfaces/klib/rc.h                               |   185 -
 interfaces/klib/refcount.h                         |   264 -
 interfaces/klib/report.h                           |   103 -
 interfaces/klib/sort.h                             |   123 -
 interfaces/klib/sra-release-version.h              |    99 -
 interfaces/klib/status.h                           |   133 -
 interfaces/klib/symbol.h                           |   146 -
 interfaces/klib/symtab.h                           |   225 -
 interfaces/klib/text.h                             |   498 -
 interfaces/klib/time.h                             |    96 -
 interfaces/klib/token.h                            |   254 -
 interfaces/klib/trie.h                             |   293 -
 interfaces/klib/vector.h                           |   428 -
 interfaces/klib/vlen-encode.h                      |   161 -
 interfaces/klib/writer.h                           |   170 -
 interfaces/kns/adapt.h                             |    89 -
 interfaces/kns/ascp.h                              |    99 -
 interfaces/kns/endpoint.h                          |   121 -
 interfaces/kns/extern.h                            |    41 -
 interfaces/kns/http.h                              |   301 -
 interfaces/kns/impl.h                              |   111 -
 interfaces/kns/manager-ext.h                       |    59 -
 interfaces/kns/manager.h                           |    96 -
 interfaces/kns/socket.h                            |   122 -
 interfaces/kns/stream.h                            |   210 -
 interfaces/kproc/barrier.h                         |    75 -
 interfaces/kproc/barrier.hpp                       |    79 -
 interfaces/kproc/cond.h                            |   103 -
 interfaces/kproc/cond.hpp                          |   107 -
 interfaces/kproc/extern.h                          |    41 -
 interfaces/kproc/impl.h                            |   104 -
 interfaces/kproc/lock.h                            |   144 -
 interfaces/kproc/lock.hpp                          |   163 -
 interfaces/kproc/procmgr.h                         |   115 -
 interfaces/kproc/q-extern.h                        |    41 -
 interfaces/kproc/queue.h                           |   116 -
 interfaces/kproc/sem.h                             |   138 -
 interfaces/kproc/sem.hpp                           |   134 -
 interfaces/kproc/task.h                            |    83 -
 interfaces/kproc/thread.h                          |    91 -
 interfaces/kproc/thread.hpp                        |    98 -
 interfaces/kproc/timeout.h                         |    64 -
 interfaces/krypto/cipher-impl.h                    |     1 -
 interfaces/krypto/cipher-priv.h                    |     1 -
 interfaces/krypto/cipher-test.h                    |    49 -
 interfaces/krypto/cipher.h                         |   208 -
 interfaces/krypto/ciphermgr-priv.h                 |    38 -
 interfaces/krypto/ciphermgr.h                      |    98 -
 interfaces/krypto/encfile-priv.h                   |   250 -
 interfaces/krypto/encfile.h                        |   134 -
 interfaces/krypto/extern.h                         |    48 -
 interfaces/krypto/key.h                            |   103 -
 interfaces/krypto/manager-priv.h                   |    26 -
 interfaces/krypto/manager.h                        |    33 -
 interfaces/krypto/reencfile.h                      |    91 -
 interfaces/krypto/rng-impl.h                       |    86 -
 interfaces/krypto/rng.h                            |    68 -
 interfaces/krypto/testciphermgr.h                  |    58 -
 interfaces/krypto/wgaencrypt.h                     |   128 -
 interfaces/ktst/test_tools.hpp                     |    22 -
 interfaces/ktst/unit_test.hpp                      |   255 -
 interfaces/ktst/unit_test_suite.hpp                |   491 -
 interfaces/kxml/xml.h                              |   382 -
 interfaces/loader/alignment-writer.h               |   109 -
 interfaces/loader/common-reader-priv.h             |   300 -
 interfaces/loader/common-reader.h                  |   486 -
 interfaces/loader/common-writer.h                  |   192 -
 interfaces/loader/mmarray.h                        |    50 -
 interfaces/loader/reference-writer.h               |    78 -
 interfaces/loader/sequence-writer.h                |    91 -
 interfaces/ncbi/clip.vschema                       |   143 -
 interfaces/ncbi/extern.h                           |    41 -
 interfaces/ncbi/ncbi.vschema                       |   195 -
 interfaces/ncbi/seq.vschema                        |   889 -
 interfaces/ncbi/spotname.vschema                   |   377 -
 interfaces/ncbi/sra.vschema                        |   743 -
 interfaces/ncbi/stats.vschema                      |   119 -
 interfaces/ncbi/vdb-blast-priv.h                   |    51 -
 interfaces/ncbi/vdb-blast.h                        |   489 -
 interfaces/ncbi/wgs-contig.h                       |   183 -
 interfaces/ncbi/wgs-contig.vschema                 |   695 -
 interfaces/os/linux/os-native.h                    |    43 -
 interfaces/os/mac/byteswap.h                       |    39 -
 interfaces/os/mac/endian.h                         |    39 -
 interfaces/os/mac/os-native.h                      |   114 -
 interfaces/os/unix/sysalloc.h                      |    40 -
 interfaces/os/unix/unix-native.h                   |    58 -
 interfaces/os/win/atomic.h                         |   143 -
 interfaces/os/win/atomic32.h                       |   193 -
 interfaces/os/win/atomic64.h                       |   193 -
 interfaces/os/win/byteswap.h                       |    44 -
 interfaces/os/win/endian.h                         |    42 -
 interfaces/os/win/os-native.h                      |   207 -
 interfaces/os/win/strtol.h                         |   149 -
 interfaces/os/win/sysalloc.h                       |    69 -
 interfaces/search/extern.h                         |    41 -
 interfaces/search/grep.h                           |   263 -
 interfaces/search/nucstrstr.h                      |   153 -
 interfaces/sra/454.vschema                         |   289 -
 interfaces/sra/abi.h                               |   167 -
 interfaces/sra/abi.vschema                         |   241 -
 interfaces/sra/extern.h                            |    41 -
 interfaces/sra/fastq.h                             |   191 -
 interfaces/sra/helicos.vschema                     |    85 -
 interfaces/sra/illumina.h                          |   170 -
 interfaces/sra/illumina.vschema                    |   403 -
 interfaces/sra/impl.h                              |   121 -
 interfaces/sra/ion-torrent.vschema                 |   117 -
 interfaces/sra/pacbio.h                            |    66 -
 interfaces/sra/path-extern.h                       |    41 -
 interfaces/sra/pevents.vschema                     |    91 -
 interfaces/sra/rd-extern.h                         |    41 -
 interfaces/sra/sch-extern.h                        |    41 -
 interfaces/sra/sff-file.h                          |   110 -
 interfaces/sra/sff.h                               |   147 -
 interfaces/sra/sradb-priv.h                        |   407 -
 interfaces/sra/sradb.h                             |   545 -
 interfaces/sra/sradb.hpp                           |   441 -
 interfaces/sra/srapath.h                           |   181 -
 interfaces/sra/srapath.hpp                         |   176 -
 interfaces/sra/sraschema.h                         |    72 -
 interfaces/sra/types.h                             |   350 -
 interfaces/sra/wsradb.h                            |   242 -
 interfaces/sra/wsradb.hpp                          |   591 -
 interfaces/vdb/blob.h                              |   147 -
 interfaces/vdb/built-in.vschema                    |   397 -
 interfaces/vdb/cursor.h                            |   441 -
 interfaces/vdb/cursor.hpp                          |   388 -
 interfaces/vdb/database.h                          |   334 -
 interfaces/vdb/dependencies.h                      |   231 -
 interfaces/vdb/extern.h                            |    47 -
 interfaces/vdb/manager.h                           |   200 -
 interfaces/vdb/manager.hpp                         |   371 -
 interfaces/vdb/report.h                            |    92 -
 interfaces/vdb/schema.h                            |   460 -
 interfaces/vdb/table.h                             |   401 -
 interfaces/vdb/table.hpp                           |   328 -
 interfaces/vdb/types.h                             |    39 -
 interfaces/vdb/types.hpp                           |   230 -
 interfaces/vdb/vdb-priv.h                          |   319 -
 interfaces/vdb/vdb.vschema                         |   820 -
 interfaces/vdb/xform.h                             |   824 -
 interfaces/vfs/extern.h                            |    47 -
 interfaces/vfs/manager-priv.h                      |   126 -
 interfaces/vfs/manager.h                           |   319 -
 interfaces/vfs/path-priv.h                         |   266 -
 interfaces/vfs/path.h                              |   253 -
 interfaces/vfs/resolver.h                          |   263 -
 konfigure.perl                                     |  1204 +
 libs/Makefile                                      |    75 -
 libs/align/Makefile                                |   151 -
 libs/align/al_iterator.c                           |   562 -
 libs/align/align-access.c                          |   792 -
 libs/align/align_mgr.c                             |   108 -
 libs/align/bam-priv.h                              |    48 -
 libs/align/bam.c                                   |  4906 ---
 libs/align/debug.h                                 |    77 -
 libs/align/dna-reverse-cmpl.c                      |    80 -
 libs/align/pl_iterator.c                           |   686 -
 libs/align/quality-quantizer.c                     |   105 -
 libs/align/reader-cmn.c                            |   317 -
 libs/align/reader-cmn.h                            |    81 -
 libs/align/reader-refseq.c                         |   255 -
 libs/align/ref_iterator.c                          |   866 -
 libs/align/reference-cmn.c                         |    43 -
 libs/align/reference-cmn.h                         |    38 -
 libs/align/reference.c                             |  1947 --
 libs/align/refseq-mgr-priv.h                       |    35 -
 libs/align/refseq-mgr.c                            |   813 -
 libs/align/writer-alignment.c                      |   430 -
 libs/align/writer-cmn.c                            |   568 -
 libs/align/writer-priv.h                           |   151 -
 libs/align/writer-ref.c                            |   481 -
 libs/align/writer-ref.h                            |   106 -
 libs/align/writer-reference.c                      |  2584 --
 libs/align/writer-refseq.c                         |   179 -
 libs/align/writer-sequence.c                       |   636 -
 libs/ascp/Makefile                                 |    80 -
 libs/ascp/ascp-priv.h                              |    74 -
 libs/ascp/ascp.c                                   |   745 -
 libs/ascp/linux/ascp-path.c                        |    89 -
 libs/ascp/mac/ascp-path.c                          |    65 -
 libs/ascp/unix/connect.c                           |   555 -
 libs/ascp/win/ascp-path.c                          |    26 -
 libs/ascp/win/connect.c                            |   510 -
 libs/axf/Makefile                                  |   133 -
 libs/axf/align-local_ref_id.c                      |   130 -
 libs/axf/align-local_ref_start.c                   |   131 -
 libs/axf/align-ref-name.c                          |   158 -
 libs/axf/align-ref-pos.c                           |   246 -
 libs/axf/align-ref-seq-id.c                        |   157 -
 libs/axf/align-restore-read.c                      |   139 -
 libs/axf/cigar.c                                   |  1914 --
 libs/axf/generate-mismatch-qual.c                  |   148 -
 libs/axf/get-sam-flags.c                           |   206 -
 libs/axf/get_mate_align_ids.c                      |   271 -
 libs/axf/make-cmp-read_desc.c                      |   156 -
 libs/axf/mismatch-restore-qual.c                   |   129 -
 libs/axf/not-my-row.c                              |    72 -
 libs/axf/project_read_from_sequence.c              |   228 -
 libs/axf/raw-restore-qual.c                        |    91 -
 libs/axf/raw-restore-read.c                        |   114 -
 libs/axf/ref-preserve_qual.c                       |   363 -
 libs/axf/ref-restore-read.c                        |   162 -
 libs/axf/ref-tbl-sub-select.c                      |   429 -
 libs/axf/ref-tbl.c                                 |    85 -
 libs/axf/ref-tbl.h                                 |    32 -
 libs/axf/refseq-stats.c                            |   148 -
 libs/axf/seq-construct-read.c                      |   125 -
 libs/axf/seq-restore-read.c                        |   216 -
 libs/axf/template-len.c                            |   127 -
 libs/blast/Makefile                                |    85 -
 libs/blast/blast.c                                 |  5243 ---
 libs/kapp/Makefile                                 |   115 -
 libs/kapp/args.c                                   |  2004 --
 libs/kapp/args_debug.h                             |    47 -
 libs/kapp/loader-file.c                            |   643 -
 libs/kapp/loader-meta.c                            |    98 -
 libs/kapp/log-xml.c                                |   416 -
 libs/kapp/main-priv.h                              |    71 -
 libs/kapp/main.c                                   |   431 -
 libs/kapp/progressbar.c                            |   199 -
 libs/kapp/queue-file.c                             |   925 -
 libs/kapp/tokenizer.c                              |   525 -
 libs/kapp/unix/sysmain.c                           |   238 -
 libs/kapp/win/sysmain.c                            |   272 -
 libs/kdb/Makefile                                  |   153 -
 libs/kdb/btree.c                                   |  3055 --
 libs/kdb/cc-priv.h                                 |    51 -
 libs/kdb/coldata-priv.h                            |   126 -
 libs/kdb/coldata.c                                 |   188 -
 libs/kdb/colfmt-priv.h                             |   339 -
 libs/kdb/colidx-priv.h                             |   117 -
 libs/kdb/colidx.c                                  |   184 -
 libs/kdb/colidx0-priv.h                            |    88 -
 libs/kdb/colidx0.c                                 |   368 -
 libs/kdb/colidx1-priv.h                            |   110 -
 libs/kdb/colidx1.c                                 |   423 -
 libs/kdb/colidx2-priv.h                            |    99 -
 libs/kdb/colidx2.c                                 |   279 -
 libs/kdb/column-cc.c                               |   224 -
 libs/kdb/column-priv.h                             |    94 -
 libs/kdb/column.c                                  |   876 -
 libs/kdb/database-cc.c                             |   338 -
 libs/kdb/database-cmn.c                            |   495 -
 libs/kdb/database-priv.h                           |   112 -
 libs/kdb/database.c                                |   706 -
 libs/kdb/dbcc-cmn.c                                |   141 -
 libs/kdb/dbmgr-cmn.c                               |   485 -
 libs/kdb/dbmgr-priv.h                              |   128 -
 libs/kdb/dbmgr.c                                   |   420 -
 libs/kdb/idstats-priv.h                            |    74 -
 libs/kdb/idstats.c                                 |   269 -
 libs/kdb/idxblk-priv.h                             |   136 -
 libs/kdb/idxblk.c                                  |   695 -
 libs/kdb/index-cmn.h                               |   286 -
 libs/kdb/index-priv.h                              |   134 -
 libs/kdb/index.c                                   |  1006 -
 libs/kdb/kdb-priv.h                                |   122 -
 libs/kdb/kdb.c                                     |   938 -
 libs/kdb/kdbfmt-priv.h                             |    76 -
 libs/kdb/libkdb.vers.h                             |    27 -
 libs/kdb/libwkdb.vers.h                            |    27 -
 libs/kdb/meta.c                                    |  2141 --
 libs/kdb/ptrieval-v1.c                             |   265 -
 libs/kdb/ptrieval-v2.c                             |   396 -
 libs/kdb/table-cc.c                                |   378 -
 libs/kdb/table-priv.h                              |    81 -
 libs/kdb/table.c                                   |   706 -
 libs/kdb/trieidx-priv.h                            |    74 -
 libs/kdb/trieidx-v1.c                              |   222 -
 libs/kdb/trieidx-v2.c                              |  1047 -
 libs/kdb/trieval-v1.c                              |    49 -
 libs/kdb/trieval-v2.c                              |    49 -
 libs/kdb/u64idx-v3.c                               |   162 -
 libs/kdb/wcoldata-priv.h                           |   172 -
 libs/kdb/wcoldata.c                                |   342 -
 libs/kdb/wcolidx-priv.h                            |   161 -
 libs/kdb/wcolidx.c                                 |   634 -
 libs/kdb/wcolidx0-priv.h                           |   148 -
 libs/kdb/wcolidx0.c                                |   747 -
 libs/kdb/wcolidx1-priv.h                           |   147 -
 libs/kdb/wcolidx1.c                                |   857 -
 libs/kdb/wcolidx2-priv.h                           |   114 -
 libs/kdb/wcolidx2.c                                |   241 -
 libs/kdb/wcolumn-priv.h                            |   120 -
 libs/kdb/wcolumn.c                                 |  2437 --
 libs/kdb/wdatabase-priv.h                          |    95 -
 libs/kdb/wdatabase.c                               |  1503 -
 libs/kdb/wdbmgr.c                                  |   349 -
 libs/kdb/werror-priv.h                             |    59 -
 libs/kdb/widxblk-priv.h                            |   195 -
 libs/kdb/widxblk.c                                 |   546 -
 libs/kdb/windex-priv.h                             |   230 -
 libs/kdb/windex.c                                  |  1889 --
 libs/kdb/wkdb-priv.h                               |   160 -
 libs/kdb/wkdb.c                                    |  1417 -
 libs/kdb/wmeta.c                                   |  3526 ---
 libs/kdb/wtable-priv.h                             |   106 -
 libs/kdb/wtable.c                                  |  1590 -
 libs/kdb/wtrieidx-v1.c                             |  1100 -
 libs/kdb/wtrieidx-v2.c                             |  2560 --
 libs/kdb/wu64idx-v3.c                              |   416 -
 libs/kfg/Makefile                                  |    99 -
 libs/kfg/config-grammar.c                          |  1724 -
 libs/kfg/config-lex.c                              |  2511 --
 libs/kfg/config-tokens.h                           |    75 -
 libs/kfg/config.c                                  |  3592 ---
 libs/kfg/default.kfg                               |    56 -
 libs/kfg/kart.c                                    |   715 -
 libs/kfg/keystore.c                                |   836 -
 libs/kfg/kfg-parse.h                               |    81 -
 libs/kfg/report-kfg.c                              |   506 -
 libs/kfg/repository.c                              |  1190 -
 libs/kfs/Makefile                                  |   179 -
 libs/kfs/arc.c                                     |  4019 ---
 libs/kfs/arrayfile.c                               |   423 -
 libs/kfs/buffile-read.c                            |   265 -
 libs/kfs/buffile-write.c                           |   368 -
 libs/kfs/buffile.c                                 |   573 -
 libs/kfs/bzip.c                                    |   838 -
 libs/kfs/cacheteefile.c                            |  1689 -
 libs/kfs/countfile.c                               |   652 -
 libs/kfs/crc32.c                                   |  1771 --
 libs/kfs/dir_test.c                                |    54 -
 libs/kfs/directory.c                               |  1538 -
 libs/kfs/ffext.c                                   |   805 -
 libs/kfs/ffkey.c                                   |   833 -
 libs/kfs/ffmagic.c                                 |   942 -
 libs/kfs/file.c                                    |   865 -
 libs/kfs/fileformat-priv.h                         |   124 -
 libs/kfs/fileformat.c                              |   290 -
 libs/kfs/from_to_namelist.c                        |   307 -
 libs/kfs/gzip.c                                    |   646 -
 libs/kfs/impl.h                                    |   120 -
 libs/kfs/karc-priv.h                               |    43 -
 libs/kfs/kfs-priv.h                                |    47 -
 libs/kfs/lockfile.c                                |   350 -
 libs/kfs/md5.c                                     |  1901 --
 libs/kfs/mmap-priv.h                               |   107 -
 libs/kfs/mmap.c                                    |   754 -
 libs/kfs/nullfile.c                                |   273 -
 libs/kfs/pagefile.c                                |  1283 -
 libs/kfs/pmem.c                                    |  1047 -
 libs/kfs/quickmount.c                              |   967 -
 libs/kfs/ramfile.c                                 |   424 -
 libs/kfs/readheadfile.c                            |   294 -
 libs/kfs/report.c                                  |   169 -
 libs/kfs/sra.c                                     |   486 -
 libs/kfs/subfile.c                                 |   337 -
 libs/kfs/tar.c                                     |  2639 --
 libs/kfs/teefile.c                                 |   532 -
 libs/kfs/toc-priv.h                                |   841 -
 libs/kfs/toc.c                                     |  1738 -
 libs/kfs/tocdir.c                                  |   411 -
 libs/kfs/tocentry.c                                |  1748 -
 libs/kfs/tocfile.c                                 |   636 -
 libs/kfs/unix/sysdir-priv.h                        |    68 -
 libs/kfs/unix/sysdir.c                             |  2408 --
 libs/kfs/unix/sysdll.c                             |  1422 -
 libs/kfs/unix/sysfile-priv.h                       |    75 -
 libs/kfs/unix/sysfile.c                            |  1057 -
 libs/kfs/unix/syslockfile.c                        |   215 -
 libs/kfs/unix/sysmmap-priv.h                       |    68 -
 libs/kfs/unix/sysmmap.c                            |   143 -
 libs/kfs/win/lnk_tools.c                           |   518 -
 libs/kfs/win/sysdir-priv.h                         |    92 -
 libs/kfs/win/sysdir.c                              |  2955 --
 libs/kfs/win/sysdll.c                              |  1410 -
 libs/kfs/win/sysfile-priv.h                        |    68 -
 libs/kfs/win/sysfile.c                             |  1023 -
 libs/kfs/win/syslockfile.c                         |    67 -
 libs/kfs/win/sysmmap-priv.h                        |    71 -
 libs/kfs/win/sysmmap.c                             |   138 -
 libs/klib/Judy.h                                   |   629 -
 libs/klib/Makefile                                 |   142 -
 libs/klib/SHA-32bit.c                              |   307 -
 libs/klib/SHA-64bit.c                              |   270 -
 libs/klib/bsearch.c                                |    77 -
 libs/klib/bstpersist.c                             |   252 -
 libs/klib/container.c                              |  1646 -
 libs/klib/cp1252.c                                 |    65 -
 libs/klib/crc32.c                                  |    89 -
 libs/klib/data-buffer.c                            |   501 -
 libs/klib/debug.c                                  |   311 -
 libs/klib/iso8859-1.c                              |    42 -
 libs/klib/iso8859.c                                |   205 -
 libs/klib/judy-vector.c                            |   892 -
 libs/klib/judy/Judy1.h                             |   549 -
 libs/klib/judy/JudyByCount.c                       |   952 -
 libs/klib/judy/JudyByCountWithDefs.c               |     4 -
 libs/klib/judy/JudyCascade.c                       |  1940 --
 libs/klib/judy/JudyCount.c                         |  1193 -
 libs/klib/judy/JudyCreateBranch.c                  |   312 -
 libs/klib/judy/JudyDecascade.c                     |  1204 -
 libs/klib/judy/JudyDel.c                           |  2144 --
 libs/klib/judy/JudyFirst.c                         |   211 -
 libs/klib/judy/JudyFreeArray.c                     |   361 -
 libs/klib/judy/JudyGet.c                           |  1092 -
 libs/klib/judy/JudyHS.c                            |   770 -
 libs/klib/judy/JudyHS.h                            |    35 -
 libs/klib/judy/JudyIns.c                           |  1871 --
 libs/klib/judy/JudyInsArray.c                      |  1176 -
 libs/klib/judy/JudyInsertBranch.c                  |   133 -
 libs/klib/judy/JudyL.h                             |   503 -
 libs/klib/judy/JudyMalloc.c                        |    86 -
 libs/klib/judy/JudyMallocIF.c                      |   780 -
 libs/klib/judy/JudyMemActive.c                     |   257 -
 libs/klib/judy/JudyMemUsed.c                       |    59 -
 libs/klib/judy/JudyNext.c                          |     2 -
 libs/klib/judy/JudyNextEmpty.c                     |     2 -
 libs/klib/judy/JudyPrev.c                          |     2 -
 libs/klib/judy/JudyPrevEmpty.c                     |     2 -
 libs/klib/judy/JudyPrevNext.c                      |  1888 --
 libs/klib/judy/JudyPrevNextEmpty.c                 |  1388 -
 libs/klib/judy/JudyPrintJP.c                       |   399 -
 libs/klib/judy/JudyPrivate.h                       |  1610 -
 libs/klib/judy/JudyPrivate1L.h                     |   483 -
 libs/klib/judy/JudyPrivateBranch.h                 |   777 -
 libs/klib/judy/JudySL.c                            |  1125 -
 libs/klib/judy/JudyTablesGen.c                     |   294 -
 libs/klib/judy/Makefile                            |   190 -
 libs/klib/judy/j__udyGet.c                         |     2 -
 libs/klib/ksort.c                                  |    97 -
 libs/klib/log-priv.h                               |    96 -
 libs/klib/log.c                                    |   984 -
 libs/klib/maybeswap.h                              |    57 -
 libs/klib/md5.c                                    |   421 -
 libs/klib/namelist.c                               |   149 -
 libs/klib/out.c                                    |   126 -
 libs/klib/pack.c                                   |   517 -
 libs/klib/pbstree-impl.c                           |   847 -
 libs/klib/pbstree-native.c                         |    30 -
 libs/klib/pbstree-priv.h                           |   664 -
 libs/klib/pbstree-swapped.c                        |    30 -
 libs/klib/pbstree.c                                |   395 -
 libs/klib/printf.c                                 |  3541 ---
 libs/klib/ptpersist.c                              |  1099 -
 libs/klib/ptrie.c                                  |  1956 --
 libs/klib/qsort.c                                  |   311 -
 libs/klib/rc-idx-tbl.c                             |    39 -
 libs/klib/rc-tbl.c                                 |    36 -
 libs/klib/refcount.c                               |   499 -
 libs/klib/release-vers.h                           |    41 -
 libs/klib/report.c                                 |   854 -
 libs/klib/sra-release-version.c                    |   328 -
 libs/klib/status-rc-strings.c                      |    39 -
 libs/klib/status-rc.c                              |   156 -
 libs/klib/status.c                                 |   436 -
 libs/klib/symtab.c                                 |   736 -
 libs/klib/text.c                                   |   841 -
 libs/klib/token.c                                  |  1290 -
 libs/klib/trie-priv.h                              |   237 -
 libs/klib/trie.c                                   |  1486 -
 libs/klib/trieval.c                                |   168 -
 libs/klib/unix/misc.c                              |    33 -
 libs/klib/unix/syserrcode.c                        |    46 -
 libs/klib/unix/syslog.c                            |   209 -
 libs/klib/unix/systime.c                           |   139 -
 libs/klib/unix/syswriter.c                         |   159 -
 libs/klib/unpack.c                                 |   833 -
 libs/klib/utf8.c                                   |   836 -
 libs/klib/vector.c                                 |   626 -
 libs/klib/vector_namelist.c                        |   357 -
 libs/klib/vlen-encode.c                            |   773 -
 libs/klib/win/misc.c                               |    33 -
 libs/klib/win/sysalloc.c                           |    68 -
 libs/klib/win/syserrcode.c                         |    85 -
 libs/klib/win/syslog.c                             |   120 -
 libs/klib/win/systime.c                            |   278 -
 libs/klib/win/syswriter.c                          |   179 -
 libs/klib/writer-priv.h                            |   169 -
 libs/klib/writer.c                                 |   634 -
 libs/kns/Makefile                                  |   132 -
 libs/kns/endpoint.c                                |   109 -
 libs/kns/http-priv.h                               |   116 -
 libs/kns/http-test.c                               |   368 -
 libs/kns/http.c                                    |  3158 --
 libs/kns/kns_manager-ext.c                         |   157 -
 libs/kns/kns_manager.c                             |   345 -
 libs/kns/linux/sysendpoint.c                       |   158 -
 libs/kns/linux/syspoll.c                           |   107 -
 libs/kns/mac/sysendpoint.c                         |   140 -
 libs/kns/mac/syspoll.c                             |    96 -
 libs/kns/manager.c                                 |   307 -
 libs/kns/mgr-priv.h                                |    57 -
 libs/kns/poll-priv.h                               |    51 -
 libs/kns/stream-from-files.c                       |   168 -
 libs/kns/stream-from-streams.c                     |   150 -
 libs/kns/stream-priv.h                             |    40 -
 libs/kns/stream.c                                  |   780 -
 libs/kns/sysmgr.h                                  |    41 -
 libs/kns/undyinghttp.c                             |   362 -
 libs/kns/unix/sysmgr.c                             |    37 -
 libs/kns/unix/syssock.c                            |   875 -
 libs/kns/unix/sysstream.c                          |   251 -
 libs/kns/url-fetcher-curl.c                        |   255 -
 libs/kns/url-fetcher-impl.h                        |   109 -
 libs/kns/url-fetcher.c                             |   129 -
 libs/kns/win/sysendpoint.c                         |   148 -
 libs/kns/win/sysmgr.c                              |    65 -
 libs/kns/win/syssock.c                             |  1296 -
 libs/kns/win/sysstream.c                           |   232 -
 libs/kproc/Makefile                                |   153 -
 libs/kproc/bsd/syslock-priv.h                      |    72 -
 libs/kproc/bsd/syslock.c                           |   932 -
 libs/kproc/linux/sysbarrier.c                      |   170 -
 libs/kproc/linux/syslock-priv.h                    |    68 -
 libs/kproc/linux/syslock.c                         |   617 -
 libs/kproc/procmgr.c                               |   412 -
 libs/kproc/queue.c                                 |   398 -
 libs/kproc/sem.c                                   |   435 -
 libs/kproc/stbarrier.c                             |   128 -
 libs/kproc/stcond.c                                |   152 -
 libs/kproc/stlock.c                                |   311 -
 libs/kproc/stsem.c                                 |   233 -
 libs/kproc/stthread.c                              |   149 -
 libs/kproc/sttimeout.c                             |    65 -
 libs/kproc/task.c                                  |   156 -
 libs/kproc/unix/syscond-priv.h                     |    78 -
 libs/kproc/unix/syscond.c                          |   320 -
 libs/kproc/unix/systhread.c                        |   272 -
 libs/kproc/unix/systimeout.c                       |    86 -
 libs/kproc/win/syscond-priv.h                      |    79 -
 libs/kproc/win/syscond.c                           |   500 -
 libs/kproc/win/syslock-priv.h                      |    67 -
 libs/kproc/win/syslock.c                           |   725 -
 libs/krypto/Makefile                               |   292 -
 libs/krypto/aes-byte.c                             |   236 -
 libs/krypto/aes-ncbi-priv.h                        |   227 -
 libs/krypto/aes-ncbi.c                             |  2644 --
 libs/krypto/aes-priv.h                             |    94 -
 libs/krypto/aes.c                                  |     1 -
 libs/krypto/aes_core.c                             |  1181 -
 libs/krypto/blockcipher-impl.h                     |   187 -
 libs/krypto/blockcipher-priv.h                     |    90 -
 libs/krypto/blockcipher.c                          |     3 -
 libs/krypto/cipher-byte.c                          |   522 -
 libs/krypto/cipher-impl.h                          |   174 -
 libs/krypto/cipher-no-vec.c                        |    41 -
 libs/krypto/cipher-priv.h                          |    79 -
 libs/krypto/cipher-vec.c                           |   808 -
 libs/krypto/cipher.c                               |   538 -
 libs/krypto/ciphermgr.c                            |   295 -
 libs/krypto/compile-test.c                         |    50 -
 libs/krypto/csprng.c                               |   163 -
 libs/krypto/encfile-priv.h                         |   163 -
 libs/krypto/encfile.c                              |  2122 --
 libs/krypto/encfilev2.c                            |  2589 --
 libs/krypto/key.c                                  |   126 -
 libs/krypto/manager.c                              |    11 -
 libs/krypto/ncbi-priv.h                            |   122 -
 libs/krypto/no-null-ncbi.c                         |    59 -
 libs/krypto/null-ncbi-priv.h                       |    56 -
 libs/krypto/null-ncbi.c                            |   251 -
 libs/krypto/reencfile.c                            |  1255 -
 libs/krypto/rng-impl.h                             |    91 -
 libs/krypto/rng-priv.h                             |     0
 libs/krypto/rng.c                                  |   120 -
 libs/krypto/testcipher.c                           |    76 -
 libs/krypto/wgaencrypt.c                           |  1254 -
 libs/ktst/Makefile                                 |    81 -
 libs/ktst/testcase.cpp                             |    95 -
 libs/ktst/testenv.cpp                              |   514 -
 libs/ktst/testrunner.cpp                           |    77 -
 libs/ktst/unix/runprocesstestcase.cpp              |   131 -
 libs/ktst/win/runprocesstestcase.cpp               |   161 -
 libs/kxml/Makefile                                 |   124 -
 libs/kxml/xml.c                                    |  1705 -
 libs/kxml/xtoc-parsexml.c                          |   576 -
 libs/kxml/xtoc-priv.h                              |   124 -
 libs/kxml/xtoc.c                                   |  3464 --
 libs/loader/Makefile                               |    87 -
 libs/loader/alignment-writer.c                     |   262 -
 libs/loader/common-reader.c                        |   614 -
 libs/loader/common-writer.c                        |  2074 --
 libs/loader/mmarray.c                              |   131 -
 libs/loader/reference-writer.c                     |   462 -
 libs/loader/sequence-writer.c                      |   361 -
 libs/ncbi-vdb/Makefile                             |   152 -
 libs/ncbi-vdb/libncbi-vdb.vers                     |     1 -
 libs/ncbi-vdb/libncbi-wvdb.vers                    |     1 -
 libs/search/Makefile                               |    97 -
 libs/search/agrep-dp.c                             |   881 -
 libs/search/agrep-myers.c                          |   586 -
 libs/search/agrep-myersunltd.c                     |  1039 -
 libs/search/agrep-wumanber.c                       |   415 -
 libs/search/debug.h                                |    43 -
 libs/search/fgrep-aho.c                            |   348 -
 libs/search/fgrep-boyermoore.c                     |   458 -
 libs/search/fgrep-dumb.c                           |   326 -
 libs/search/nucstrstr-icc-i386-dbg.pic.s           | 31488 -------------------
 libs/search/nucstrstr-icc-i386-prof.pic.s          |  7600 -----
 libs/search/nucstrstr-icc-i386-rel.pic.s           |  6711 ----
 libs/search/nucstrstr-icc-x86_64-dbg.pic.s         | 25447 ---------------
 libs/search/nucstrstr-icc-x86_64-prof.pic.s        | 13651 --------
 libs/search/nucstrstr-icc-x86_64-rel.pic.s         |  9908 ------
 libs/search/nucstrstr.c                            |  5313 ----
 libs/search/search-priv.h                          |   137 -
 libs/search/search.c                               |   285 -
 libs/sra/Makefile                                  |   234 -
 libs/sra/built-in.vschema                          |   580 -
 libs/sra/libsradb.vers.h                           |    27 -
 libs/sra/reader-abi.c                              |   473 -
 libs/sra/reader-cmn.c                              |   379 -
 libs/sra/reader-cmn.h                              |   161 -
 libs/sra/reader-fastq.c                            |   622 -
 libs/sra/reader-illumina.c                         |   565 -
 libs/sra/reader-sff.c                              |   380 -
 libs/sra/sra-debug.h                               |    42 -
 libs/sra/sra-dflt-schema.c                         |   550 -
 libs/sra/sra-priv.h                                |   183 -
 libs/sra/sra-schema.c                              |  4095 ---
 libs/sra/sracache.c                                |   559 -
 libs/sra/sracol.c                                  |   235 -
 libs/sra/sramgr-cmn.c                              |   572 -
 libs/sra/sramgr.c                                  |   186 -
 libs/sra/sraschema-priv.h                          |    36 -
 libs/sra/sraschema-stub.c                          |    51 -
 libs/sra/sraschema.c                               |    74 -
 libs/sra/sratbl-cmn.c                              |  1397 -
 libs/sra/sratbl.c                                  |   118 -
 libs/sra/types.c                                   |   298 -
 libs/sra/wsramgr.c                                 |   165 -
 libs/sra/wsraschema-stub.c                         |    51 -
 libs/sra/wsratbl.c                                 |   649 -
 libs/sraxf/Makefile                                |   143 -
 libs/sraxf/bio-start.c                             |    95 -
 libs/sraxf/color-from-dna.c                        |   151 -
 libs/sraxf/denormalize.c                           |   231 -
 libs/sraxf/dna-from-color.c                        |   150 -
 libs/sraxf/dynamic-454-read-descriptor.c           |   303 -
 libs/sraxf/extract-coordinates.c                   |   353 -
 libs/sraxf/extract-name_coord.c                    |   242 -
 libs/sraxf/extract-name_fmt.c                      |   240 -
 libs/sraxf/extract-spot_name.c                     |   105 -
 libs/sraxf/fix_read_seg_impl.h                     |   169 -
 libs/sraxf/format-spot-name.c                      |   332 -
 libs/sraxf/fpcodec.c                               |   267 -
 libs/sraxf/index_lookup.c                          |   269 -
 libs/sraxf/make-position.c                         |   133 -
 libs/sraxf/name-tokenizer.h                        |   121 -
 libs/sraxf/normalize.c                             |   240 -
 libs/sraxf/prefix-tree-to-name.c                   |   162 -
 libs/sraxf/process-position.c                      |   198 -
 libs/sraxf/qual4_codec.h                           |    43 -
 libs/sraxf/qual4_decode.c                          |   257 -
 libs/sraxf/qual4_encode.c                          |   232 -
 libs/sraxf/read-desc.c                             |   143 -
 libs/sraxf/read-seg-from-readn.c                   |   361 -
 libs/sraxf/rewrite-spot-name.c                     |   222 -
 libs/sraxf/rotate.c                                |   271 -
 libs/sraxf/spot-desc.c                             |   102 -
 libs/sraxf/stats.c                                 |   501 -
 libs/sraxf/stats_quality.c                         |   132 -
 libs/sraxf/swap.c                                  |   228 -
 libs/sraxf/tokenize-spot_name-454.c                |   122 -
 libs/sraxf/tokenize-spot_name-abi.c                |   145 -
 libs/sraxf/tokenize-spot_name-helicos.c            |   111 -
 libs/sraxf/tokenize-spot_name-illumina.c           |   150 -
 libs/sraxf/tokenize-spot_name-ion-torrent.c        |   135 -
 libs/sraxf/untyped-priv.h                          |    83 -
 libs/sraxf/untyped.c                               |   378 -
 libs/sraxf/v0-decompress-init.c                    |  2841 --
 libs/sraxf/v0-decompress-local.h                   |   368 -
 libs/sraxf/v0-decompress.c                         |  1096 -
 libs/sraxf/v0-decompress.h                         |   170 -
 libs/sraxf/v0-funcs.c                              |   337 -
 libs/sraxf/varloc.c                                |   105 -
 libs/vdb/Makefile                                  |   180 -
 libs/vdb/blob-headers.c                            |   726 -
 libs/vdb/blob-headers.h                            |   114 -
 libs/vdb/blob-priv.h                               |   200 -
 libs/vdb/blob.c                                    |  1569 -
 libs/vdb/blob.h                                    |    84 -
 libs/vdb/cast.c                                    |   583 -
 libs/vdb/column-cmn.c                              |   307 -
 libs/vdb/column-priv.h                             |   294 -
 libs/vdb/column.c                                  |    80 -
 libs/vdb/compare.c                                 |   242 -
 libs/vdb/cursor-cmn.c                              |  2481 --
 libs/vdb/cursor-priv.h                             |   311 -
 libs/vdb/cursor.c                                  |   200 -
 libs/vdb/database-cmn.c                            |   724 -
 libs/vdb/database-depend.c                         |  1807 --
 libs/vdb/database-load.c                           |   119 -
 libs/vdb/database-priv.h                           |   151 -
 libs/vdb/database.c                                |    29 -
 libs/vdb/dbmgr-cmn.c                               |   825 -
 libs/vdb/dbmgr-priv.h                              |   115 -
 libs/vdb/dbmgr.c                                   |   148 -
 libs/vdb/delta_average.c                           |   297 -
 libs/vdb/environment-read.c                        |   108 -
 libs/vdb/fixed-row-len.c                           |    67 -
 libs/vdb/index_insert.c                            |   132 -
 libs/vdb/index_lookup.c                            |   176 -
 libs/vdb/index_project.c                           |   175 -
 libs/vdb/libvdb.vers.h                             |    27 -
 libs/vdb/libwvdb.vers.h                            |    27 -
 libs/vdb/linker-cmn.c                              |   651 -
 libs/vdb/linker-int.c                              |   665 -
 libs/vdb/linker-priv.h                             |   271 -
 libs/vdb/linker.c                                  |    45 -
 libs/vdb/merge.c                                   |   215 -
 libs/vdb/meta-append.c                             |   145 -
 libs/vdb/meta-attr-read.c                          |   448 -
 libs/vdb/meta-attr-write.c                         |   529 -
 libs/vdb/meta-read.c                               |   140 -
 libs/vdb/meta-value.c                              |   381 -
 libs/vdb/meta-write.c                              |   155 -
 libs/vdb/page-map.c                                |  1721 -
 libs/vdb/page-map.h                                |   383 -
 libs/vdb/parameter-read.c                          |   103 -
 libs/vdb/phys-cmn.c                                |   679 -
 libs/vdb/phys-load.c                               |   330 -
 libs/vdb/phys-priv.h                               |   188 -
 libs/vdb/phys.c                                    |    67 -
 libs/vdb/prod-cmn.c                                |  2321 --
 libs/vdb/prod-expr.c                               |   887 -
 libs/vdb/prod-expr.h                               |   202 -
 libs/vdb/prod-func.c                               |   955 -
 libs/vdb/prod-priv.h                               |   459 -
 libs/vdb/prod.c                                    |   136 -
 libs/vdb/range-validate.c                          |   195 -
 libs/vdb/redimension.c                             |   108 -
 libs/vdb/report-vdb.c                              |   856 -
 libs/vdb/row-id.c                                  |    64 -
 libs/vdb/row-len.c                                 |    65 -
 libs/vdb/schema-db.c                               |   746 -
 libs/vdb/schema-dump.c                             |   683 -
 libs/vdb/schema-dump.h                             |   208 -
 libs/vdb/schema-eval.c                             |  1400 -
 libs/vdb/schema-expr.c                             |  2169 --
 libs/vdb/schema-expr.h                             |   396 -
 libs/vdb/schema-func.c                             |  1657 -
 libs/vdb/schema-int.c                              |   376 -
 libs/vdb/schema-parse.c                            |   855 -
 libs/vdb/schema-parse.h                            |   607 -
 libs/vdb/schema-priv.h                             |  1308 -
 libs/vdb/schema-prod.c                             |  1004 -
 libs/vdb/schema-tbl.c                              |  2928 --
 libs/vdb/schema-tok.c                              |    74 -
 libs/vdb/schema-tok.h                              |    61 -
 libs/vdb/schema-type.c                             |  2573 --
 libs/vdb/schema.c                                  |  1768 --
 libs/vdb/split.c                                   |   398 -
 libs/vdb/table-cmn.c                               |  1247 -
 libs/vdb/table-load.c                              |   323 -
 libs/vdb/table-priv.h                              |   232 -
 libs/vdb/table.c                                   |   109 -
 libs/vdb/transpose.c                               |   720 -
 libs/vdb/wcolumn.c                                 |  1069 -
 libs/vdb/wcursor.c                                 |  1205 -
 libs/vdb/wdatabase.c                               |   661 -
 libs/vdb/wdbmgr.c                                  |   251 -
 libs/vdb/wlinker.c                                 |    96 -
 libs/vdb/wphys.c                                   |   909 -
 libs/vdb/wprod.c                                   |   439 -
 libs/vdb/wtable.c                                  |   987 -
 libs/vdb/xform-priv.h                              |    83 -
 libs/vfs/Makefile                                  |   123 -
 libs/vfs/keyring.c                                 |   292 -
 libs/vfs/keyring.h                                 |   111 -
 libs/vfs/manager.c                                 |  3027 --
 libs/vfs/path-priv.h                               |   147 -
 libs/vfs/path.c                                    |  3374 --
 libs/vfs/resolver-priv.h                           |   144 -
 libs/vfs/resolver.c                                |  4386 ---
 libs/vfs/srapath-stub.c                            |   372 -
 libs/vfs/srapath.c                                 |  1424 -
 libs/vfs/unix/syskeyring.c                         |   161 -
 libs/vfs/unix/syspath.c                            |   149 -
 libs/vfs/win/syskeyring.c                          |    58 -
 libs/vfs/win/syspath.c                             |   343 -
 libs/vxf/Makefile                                  |   162 -
 libs/vxf/add-row-id.c                              |    80 -
 libs/vxf/bit_or.c                                  |   135 -
 libs/vxf/bunzip.c                                  |   130 -
 libs/vxf/bzip.c                                    |   182 -
 libs/vxf/ceil.c                                    |    48 -
 libs/vxf/checksum.c                                |   566 -
 libs/vxf/clip.c                                    |   200 -
 libs/vxf/cut.c                                     |   227 -
 libs/vxf/delta.c                                   |   108 -
 libs/vxf/deriv.c                                   |   111 -
 libs/vxf/diff.c                                    |   356 -
 libs/vxf/echo.c                                    |   187 -
 libs/vxf/exists.c                                  |   212 -
 libs/vxf/extract_token.c                           |   105 -
 libs/vxf/floor.c                                   |    49 -
 libs/vxf/fsplit-join.impl.h                        |   136 -
 libs/vxf/funzip.c                                  |   172 -
 libs/vxf/fzip.c                                    |   168 -
 libs/vxf/integral.c                                |   115 -
 libs/vxf/integral_0.c                              |   115 -
 libs/vxf/irzip.c                                   |   564 -
 libs/vxf/irzip.impl.h                              |   482 -
 libs/vxf/iunzip.c                                  |   748 -
 libs/vxf/izip-common.h                             |   195 -
 libs/vxf/izip-decode.impl.h                        |   162 -
 libs/vxf/izip-encode.impl.h                        |   523 -
 libs/vxf/izip.c                                    |   865 -
 libs/vxf/lower-case-tech-reads.c                   |   111 -
 libs/vxf/map.c                                     |  1019 -
 libs/vxf/math-funcs-impl.h                         |   361 -
 libs/vxf/max.c                                     |   175 -
 libs/vxf/min.c                                     |   175 -
 libs/vxf/outlier-decoder.c                         |   114 -
 libs/vxf/outlier-encoder.c                         |   142 -
 libs/vxf/pack.c                                    |    92 -
 libs/vxf/paste.c                                   |   357 -
 libs/vxf/rand_4na_2na.c                            |   200 -
 libs/vxf/rldecode.c                                |   155 -
 libs/vxf/rlencode.c                                |   262 -
 libs/vxf/round.c                                   |    49 -
 libs/vxf/simple-sub-select.c                       |   278 -
 libs/vxf/sprintf.c                                 |  1279 -
 libs/vxf/strtonum.c                                |   354 -
 libs/vxf/subtract-row-id.c                         |    83 -
 libs/vxf/sum.c                                     |   356 -
 libs/vxf/trim.c                                    |   229 -
 libs/vxf/trunc.c                                   |    49 -
 libs/vxf/undelta.c                                 |   108 -
 libs/vxf/unpack.c                                  |   115 -
 libs/vxf/unzip.c                                   |   234 -
 libs/vxf/vec-sum.c                                 |   239 -
 libs/vxf/wgs-tokenize-accession.c                  |   212 -
 libs/vxf/zip.c                                     |   214 -
 libs/wgsxf/Makefile                                |   124 -
 libs/wgsxf/build_read_type.c                       |   113 -
 libs/wgsxf/build_scaffold.c                        |   435 -
 os-arch.perl                                       |    35 +
 os-arch.pm                                         |   100 +
 package.pm                                         |    52 +
 test/Makefile                                      |    30 +
 tools/.gitignore                                   |     3 +
 tools/Makefile                                     |    31 +-
 tools/align-info/Makefile                          |     5 +-
 tools/align-info/align-info.c                      |     8 +-
 tools/align-info/align-info.vers                   |     2 +-
 tools/align-info/align-info.vers.h                 |     1 +
 tools/bam-loader/Globals.h                         |     1 +
 tools/bam-loader/Makefile                          |    30 +-
 tools/bam-loader/alignment-writer.c                |    85 +
 tools/bam-loader/alignment-writer.h                |     6 +-
 tools/bam-loader/bam-load.vers                     |     2 +-
 tools/bam-loader/bam-loader.c                      |    82 +-
 tools/bam-loader/bam-loader3.c                     |  1028 +
 tools/bam-loader/bam-reader.c                      |  1104 +
 tools/bam-loader/bam-reader.h                      |    98 +
 tools/bam-loader/loader-imp.c                      |   162 +-
 tools/bam-loader/loader-imp3.c                     |   369 +
 tools/bam-loader/loader-imp3.h                     |    38 +
 tools/bam-loader/reference-writer.c                |    85 +-
 tools/bam-loader/reference-writer.h                |     3 +-
 tools/cache-mgr/Makefile                           |     4 +-
 tools/cache-mgr/cache-mgr.c                        |   307 +-
 tools/cache-mgr/cache-mgr.vers                     |     2 +-
 tools/cache-mgr/cache-mgr.vers.h                   |     1 +
 tools/ccextract/Makefile                           |   102 +
 tools/ccextract/ccextract.c                        |  1283 +
 tools/ccextract/ccextract.vers                     |     1 +
 tools/cg-dump/Makefile                             |   117 +
 tools/cg-dump/cg-dump.c                            |  1563 +
 tools/cg-dump/cg-dump.vers                         |     1 +
 tools/cg-dump/last_rowid.c                         |   353 +
 tools/cg-dump/last_rowid.h                         |    44 +
 tools/cg-dump/line_token_iter.c                    |   148 +
 tools/cg-dump/line_token_iter.h                    |    66 +
 tools/cg-dump/num-gen.c                            |   848 +
 tools/cg-dump/num-gen.h                            |   225 +
 tools/cg-dump/progressbar.c                        |   140 +
 tools/cg-dump/progressbar.h                        |    70 +
 tools/cg-dump/sg_lookup.c                          |   277 +
 tools/cg-dump/sg_lookup.h                          |    65 +
 tools/cg-load/.gitignore                           |     2 +
 tools/cg-load/Makefile                             |     6 +-
 tools/cg-load/cg-load.c                            |    14 +-
 tools/cg-load/cg-load.vers                         |     2 +-
 tools/cg-load/factory-tag-lfr.c                    |   261 +
 tools/cg-load/factory-tag-lfr.h                    |    37 +
 tools/cg-load/writer-algn.c                        |     8 +-
 tools/cg-load/writer-evidence-dnbs.c               |     5 +-
 tools/cg-load/writer-evidence-intervals.c          |    15 +-
 tools/check-blob-size/Makefile                     |   103 +
 tools/check-blob-size/check-blob-size.c            |   332 +
 tools/check-blob-size/check-blob-size.vers         |     1 +
 tools/copycat/Makefile                             |   109 +
 tools/copycat/ccbuffer.c                           |   153 +
 tools/copycat/ccbuffermgr.c                        |   234 +
 tools/copycat/ccbufferq.c                          |   175 +
 tools/copycat/cccat.c                              |  1797 ++
 tools/copycat/cccopier.c                           |   217 +
 tools/copycat/cccopy.c                             |   347 +
 tools/copycat/ccfile.c                             |   271 +
 tools/copycat/ccfileformat.c                       |   383 +
 tools/copycat/ccproc.c                             |   319 +
 tools/copycat/ccprocone.c                          |   217 +
 tools/copycat/ccread.c                             |   302 +
 tools/copycat/ccsra.c                              |  1239 +
 tools/copycat/ccsubchunk.c                         |   390 +
 tools/copycat/cctar.c                              |  2199 ++
 tools/copycat/cctree-dump.c                        |  1030 +
 tools/copycat/cctree-priv.h                        |   351 +
 tools/copycat/cctree.c                             |   754 +
 tools/copycat/copycat-priv.h                       |   229 +
 tools/copycat/copycat.c                            |  1263 +
 tools/copycat/copycat.vers                         |     1 +
 tools/copycat/debug.h                              |    75 +
 tools/deseq/Makefile                               |   102 +
 tools/deseq/csra-trim.vers                         |     1 +
 tools/deseq/deseq.c                                |   521 +
 tools/fastq-dump/Makefile                          |   106 +
 tools/fastq-dump/args.cpp                          |   622 +
 tools/fastq-dump/args.hpp                          |   330 +
 tools/fastq-dump/fastq-dump.cpp                    |   633 +
 tools/fastq-dump/fastq-dump.vers                   |     1 +
 tools/fastq-dump/filters.cpp                       |   300 +
 tools/fastq-dump/filters.hpp                       |   114 +
 tools/fastq-dump/koutstream                        |   281 +
 tools/fastq-loader/.gitignore                      |     1 +
 tools/fastq-loader/Makefile                        |    13 +-
 tools/fastq-loader/fastq-grammar.c                 |   454 +-
 tools/fastq-loader/fastq-grammar.y                 |   421 +-
 tools/fastq-loader/fastq-lex.c                     |   374 +-
 tools/fastq-loader/fastq-lex.l                     |   215 +-
 tools/fastq-loader/fastq-tokens.h                  |    21 +-
 tools/fastq-loader/latf-load.vers                  |     2 +-
 tools/fastq-loader/latf-load.vers.h                |     1 +
 tools/fastq-loader/loader-imp.c                    |    11 +-
 tools/fix-run-stat/Makefile                        |    93 +
 tools/fix-run-stat/fix-run-stat.c                  |   355 +
 tools/fix-run-stat/fix-run-stat.vers               |     1 +
 tools/fuse/Makefile                                |   179 +
 tools/fuse/accessor.c                              |   134 +
 tools/fuse/accessor.h                              |    46 +
 tools/fuse/debug.h                                 |    53 +
 tools/fuse/directory.c                             |   566 +
 tools/fuse/directory.h                             |    34 +
 tools/fuse/dump-idx.c                              |   107 +
 tools/fuse/dump-idx.vers                           |     1 +
 tools/fuse/dump-idx.vers.h                         |     1 +
 tools/fuse/file.c                                  |   275 +
 tools/fuse/file.h                                  |    33 +
 tools/fuse/formats.c                               |   443 +
 tools/fuse/formats.h                               |   157 +
 tools/fuse/kfile-accessor.c                        |    73 +
 tools/fuse/kfile-accessor.h                        |    33 +
 tools/fuse/log.c                                   |   196 +
 tools/fuse/log.h                                   |    53 +
 tools/fuse/node.c                                  |   273 +
 tools/fuse/node.h                                  |   108 +
 tools/fuse/remote-cache.c                          |  1538 +
 tools/fuse/remote-cache.h                          |   169 +
 tools/fuse/remote-directory.c                      |   411 +
 tools/fuse/remote-directory.h                      |    33 +
 tools/fuse/remote-file.c                           |   300 +
 tools/fuse/remote-file.h                           |    33 +
 tools/fuse/remote-fuser.c                          |   212 +
 tools/fuse/remote-fuser.h                          |    52 +
 tools/fuse/remote-fuser.vers                       |     1 +
 tools/fuse/remote-link.c                           |   208 +
 tools/fuse/remote-link.h                           |    33 +
 tools/fuse/remote-xml.c                            |   603 +
 tools/fuse/remote-xml.h                            |    59 +
 tools/fuse/sra-directory.c                         |   107 +
 tools/fuse/sra-directory.h                         |    33 +
 tools/fuse/sra-fastq.c                             |   245 +
 tools/fuse/sra-fastq.h                             |    34 +
 tools/fuse/sra-fuser-test.c                        |   100 +
 tools/fuse/sra-fuser-test.vers                     |     1 +
 tools/fuse/sra-fuser-test.vers.h                   |     1 +
 tools/fuse/sra-fuser.c                             |   201 +
 tools/fuse/sra-fuser.h                             |    48 +
 tools/fuse/sra-fuser.vers                          |     1 +
 tools/fuse/sra-fuser.xsd                           |   207 +
 tools/fuse/sra-list.c                              |  1225 +
 tools/fuse/sra-list.h                              |    86 +
 tools/fuse/sra-makeidx.c                           |   960 +
 tools/fuse/sra-makeidx.vers                        |     1 +
 tools/fuse/sra-node.c                              |   165 +
 tools/fuse/sra-node.h                              |    34 +
 tools/fuse/sra-sff.c                               |   249 +
 tools/fuse/sra-sff.h                               |    34 +
 tools/fuse/tar-file.c                              |   127 +
 tools/fuse/tar-file.h                              |    33 +
 tools/fuse/tar-list.c                              |   598 +
 tools/fuse/tar-list.h                              |    49 +
 tools/fuse/tar-node.c                              |   320 +
 tools/fuse/tar-node.h                              |    35 +
 tools/fuse/text-file.c                             |   134 +
 tools/fuse/text-file.h                             |    36 +
 tools/fuse/unix/remote-fuser-sys.c                 |   696 +
 tools/fuse/unix/sra-fuser-sys.c                    |   634 +
 tools/fuse/xml.c                                   |   516 +
 tools/fuse/xml.h                                   |    60 +
 tools/fuse/zlib-simple.c                           |    65 +
 tools/fuse/zlib-simple.h                           |    33 +
 tools/kar/Makefile                                 |     6 +-
 tools/kar/kar.c                                    |     8 +-
 tools/kar/kar.vers                                 |     2 +-
 tools/kar/kar.vers.h                               |     1 +
 tools/kar/sra-kar.c                                |    10 +-
 tools/kar/sra-kar.vers                             |     2 +-
 tools/kar/sra-kar.vers.h                           |     1 +
 tools/keyring-srv/Makefile                         |   106 +
 tools/keyring-srv/keyring-data.c                   |   346 +
 tools/keyring-srv/keyring-data.h                   |   130 +
 tools/keyring-srv/keyring-database.c               |   441 +
 tools/keyring-srv/keyring-database.h               |    45 +
 tools/keyring-srv/keyring-srv-main.c               |   340 +
 tools/keyring-srv/keyring-srv.c                    |   522 +
 tools/keyring-srv/keyring-srv.h                    |   101 +
 tools/keyring-srv/keyring-srv.vers                 |     1 +
 tools/kqsh/.gitignore                              |     7 +
 tools/kqsh/Makefile                                |   221 +
 tools/kqsh/kqsh-alter.c                            |   347 +
 tools/kqsh/kqsh-close.c                            |   186 +
 tools/kqsh/kqsh-create.c                           |   680 +
 tools/kqsh/kqsh-help.c                             |  1292 +
 tools/kqsh/kqsh-load.c                             |   410 +
 tools/kqsh/kqsh-open.c                             |   199 +
 tools/kqsh/kqsh-parse.c                            |   198 +
 tools/kqsh/kqsh-print.c                            |   170 +
 tools/kqsh/kqsh-priv.h                             |   151 +
 tools/kqsh/kqsh-show.c                             |   290 +
 tools/kqsh/kqsh-thunk.pl                           |   662 +
 tools/kqsh/kqsh-tok.c                              |    99 +
 tools/kqsh/kqsh-tok.h                              |   155 +
 tools/kqsh/kqsh-write.c                            |   321 +
 tools/kqsh/kqsh.c                                  |   530 +
 tools/kqsh/kqsh.vers                               |     1 +
 tools/meta-sync/Makefile                           |   114 +
 tools/meta-sync/meta-sync.c                        |  1517 +
 tools/meta-sync/meta-sync.pl                       |    41 +
 tools/meta-sync/meta-sync.vers                     |     1 +
 tools/nenctool/Makefile                            |    12 +-
 tools/nenctool/nenctest.c                          |     4 +-
 tools/nenctool/nenctest.vers                       |     2 +-
 tools/nenctool/nenctool.c                          |     4 +-
 tools/nenctool/nenctool.vers                       |     2 +-
 tools/nencvalid/Makefile                           |     2 +-
 tools/nencvalid/nencvalid.c                        |     2 +-
 tools/nencvalid/nencvalid.vers                     |     2 +-
 tools/pacbio-load/.gitignore                       |     7 +
 tools/pacbio-load/Makefile                         |   140 +
 tools/pacbio-load/pacbio-load.c                    |   638 +
 tools/pacbio-load/pacbio-load.vers                 |     1 +
 tools/pacbio-load/pl-basecalls_cmn.c               |    97 +
 tools/pacbio-load/pl-basecalls_cmn.h               |    60 +
 tools/pacbio-load/pl-consensus.c                   |   413 +
 tools/pacbio-load/pl-consensus.h                   |    83 +
 tools/pacbio-load/pl-context.c                     |   211 +
 tools/pacbio-load/pl-context.h                     |    87 +
 tools/pacbio-load/pl-metrics.c                     |   779 +
 tools/pacbio-load/pl-metrics.h                     |    83 +
 tools/pacbio-load/pl-passes.c                      |   437 +
 tools/pacbio-load/pl-passes.h                      |    70 +
 tools/pacbio-load/pl-progress.c                    |   195 +
 tools/pacbio-load/pl-progress.h                    |    70 +
 tools/pacbio-load/pl-regions.c                     |  1048 +
 tools/pacbio-load/pl-regions.h                     |   140 +
 tools/pacbio-load/pl-sequence.c                    |   928 +
 tools/pacbio-load/pl-sequence.h                    |   110 +
 tools/pacbio-load/pl-tools.c                       |   616 +
 tools/pacbio-load/pl-tools.h                       |   291 +
 tools/pacbio-load/pl-zmw.c                         |   221 +
 tools/pacbio-load/pl-zmw.h                         |   105 +
 tools/pacbio-load/verify/ins_nl.pl                 |    15 +
 tools/pacbio-load/verify/ins_nl_1.pl               |    30 +
 tools/pacbio-load/verify/ins_nl_2.pl               |    24 +
 tools/pacbio-load/verify/ins_nl_4.pl               |    24 +
 tools/pacbio-load/verify/ins_nl_f.pl               |    27 +
 tools/prefetch/Makefile                            |    22 +-
 tools/prefetch/prefetch.c                          |    99 +-
 tools/prefetch/prefetch.vers                       |     2 +-
 tools/prefetch/prefetch.vers.h                     |     1 +
 tools/qual-recal/Makefile                          |   101 +
 tools/qual-recal/make_histo_data.sh                |    12 +
 tools/qual-recal/qual-recal.c                      |   654 +
 tools/qual-recalib-stat/.gitignore                 |     3 +
 tools/qual-recalib-stat/Makefile                   |   100 +
 tools/qual-recalib-stat/columns.c                  |    94 +
 tools/qual-recalib-stat/columns.h                  |    67 +
 tools/qual-recalib-stat/context.c                  |   330 +
 tools/qual-recalib-stat/context.h                  |   120 +
 tools/qual-recalib-stat/fasta_dump.pl              |    81 +
 tools/qual-recalib-stat/namelist_tools.c           |   187 +
 tools/qual-recalib-stat/namelist_tools.h           |    53 +
 tools/qual-recalib-stat/num-gen.c                  |   848 +
 tools/qual-recalib-stat/num-gen.h                  |   225 +
 tools/qual-recalib-stat/progressbar.c              |   182 +
 tools/qual-recalib-stat/progressbar.h              |    75 +
 tools/qual-recalib-stat/qual-recalib-stat.c        |   421 +
 tools/qual-recalib-stat/qual-recalib-stat.vers     |     1 +
 tools/qual-recalib-stat/qual-recalib-stat.vers.h   |     1 +
 tools/qual-recalib-stat/reader.c                   |   241 +
 tools/qual-recalib-stat/reader.h                   |    88 +
 tools/qual-recalib-stat/ref_exclude.c              |   561 +
 tools/qual-recalib-stat/ref_exclude.h              |    71 +
 tools/qual-recalib-stat/ref_grab.pl                |    82 +
 tools/qual-recalib-stat/spot_position.c            |   121 +
 tools/qual-recalib-stat/spot_position.h            |    68 +
 tools/qual-recalib-stat/stat_mod.c                 |   883 +
 tools/qual-recalib-stat/stat_mod.h                 |   148 +
 tools/qual-recalib-stat/stat_mod_1.c               |   962 +
 tools/qual-recalib-stat/stat_mod_1.h               |   160 +
 tools/qual-recalib-stat/stat_mod_2.c               |  1041 +
 tools/qual-recalib-stat/stat_mod_2.h               |   141 +
 tools/qual-recalib-stat/writer.c                   |   436 +
 tools/qual-recalib-stat/writer.h                   |    80 +
 tools/rd-filter-redact/Makefile                    |   122 +
 tools/rd-filter-redact/rd-filter-redact.c          |  1355 +
 tools/rd-filter-redact/rd-filter-redact.vers       |     1 +
 tools/rd-filter-redact/read-filter-redact.c        |   865 +
 tools/rd-filter-redact/read-filter-redact.vers     |     1 +
 tools/rd-filter-redact/read-filter-redact.vers.h   |     1 +
 tools/rd-filter-redact/test-read-write-cursor.c    |   222 +
 tools/rd-filter-redact/test-read-write-cursor.vers |     1 +
 tools/run-stat/.gitignore                          |     6 +
 tools/run-stat/Makefile                            |   120 +
 tools/run-stat/chart.c                             |   465 +
 tools/run-stat/chart.h                             |   109 +
 tools/run-stat/context.c                           |   439 +
 tools/run-stat/context.h                           |    98 +
 tools/run-stat/definitions.h                       |    78 +
 tools/run-stat/helper.c                            |   715 +
 tools/run-stat/helper.h                            |   126 +
 tools/run-stat/key_value.c                         |   549 +
 tools/run-stat/key_value.h                         |    64 +
 tools/run-stat/mod_cmn.c                           |   329 +
 tools/run-stat/mod_cmn.h                           |   149 +
 tools/run-stat/mod_reads.c                         |   747 +
 tools/run-stat/mod_reads.h                         |    42 +
 tools/run-stat/mod_reads_defs.h                    |   128 +
 tools/run-stat/mod_reads_helper.c                  |   575 +
 tools/run-stat/mod_reads_helper.h                  |    61 +
 tools/run-stat/num-gen.c                           |   497 +
 tools/run-stat/num-gen.h                           |    81 +
 tools/run-stat/progressbar.c                       |   191 +
 tools/run-stat/progressbar.h                       |    76 +
 tools/run-stat/rd_filter.c                         |   243 +
 tools/run-stat/rd_filter.h                         |    98 +
 tools/run-stat/run-stat.c                          |   703 +
 tools/run-stat/run-stat.vers                       |     1 +
 tools/run-stat/svg.c                               |   753 +
 tools/run-stat/svg.h                               |   117 +
 tools/sam-dump/Makefile                            |     3 +-
 tools/sam-dump/sam-dump.c                          |    28 +-
 tools/sam-dump/sam-dump.vers                       |     2 +-
 tools/sra-dbcc/Makefile                            |     4 +-
 tools/sra-dbcc/sra-dbcc.c                          |    36 +-
 tools/sra-dbcc/sra-dbcc.vers                       |     2 +-
 tools/sra-dump/.gitignore                          |     1 +
 tools/sra-dump/Makefile                            |     5 +-
 tools/sra-dump/abi-dump.vers                       |     2 +-
 tools/sra-dump/abi-dump.vers.h                     |     1 +
 tools/sra-dump/abi.c                               |     2 +-
 tools/sra-dump/core.c                              |    23 +-
 tools/sra-dump/factory.c                           |     8 +-
 tools/sra-dump/factory.h                           |     2 +-
 tools/sra-dump/fastq-dump.vers                     |     2 +-
 tools/sra-dump/fastq-dump.vers.h                   |     1 +
 tools/sra-dump/fastq.c                             |     2 +-
 tools/sra-dump/illumina-dump.vers                  |     2 +-
 tools/sra-dump/illumina-dump.vers.h                |     1 +
 tools/sra-dump/illumina.c                          |    60 +-
 tools/sra-dump/sff-dump.vers                       |     2 +-
 tools/sra-dump/sff-dump.vers.h                     |     1 +
 tools/sra-dump/sra-dump.c                          |     2 +-
 tools/sra-dump/sra-dump.vers                       |     2 +-
 tools/sra-load/Makefile                            |    22 +-
 tools/sra-load/abi-load.vers                       |     2 +-
 tools/sra-load/common-xml.c                        |     8 +-
 tools/sra-load/experiment-xml.c                    |     2 +-
 tools/sra-load/fastq-load.vers                     |     2 +-
 tools/sra-load/helicos-load.vers                   |     2 +-
 tools/sra-load/illumina-load.vers                  |     2 +-
 tools/sra-load/loader.c                            |     8 +-
 tools/sra-load/pacbio-fmt.c                        |   146 +
 tools/sra-load/pacbio-loadxml.vers                 |     2 +-
 tools/sra-load/run-xml.c                           |    24 +-
 tools/sra-load/sff-fmt.c                           |     2 +-
 tools/sra-load/sff-load.vers                       |     2 +-
 tools/sra-load/sra-writer.c                        |     8 +-
 tools/sra-load/srf-fmt.c                           |     4 +-
 tools/sra-load/srf-illumina.c                      |     2 +-
 tools/sra-load/srf-load.vers                       |     2 +-
 tools/sra-load/writer-illumina.c                   |    17 +-
 tools/sra-pileup/.gitignore                        |     2 +
 tools/sra-pileup/4na_ascii.c                       |    95 +
 tools/sra-pileup/4na_ascii.h                       |    44 +
 tools/sra-pileup/Makefile                          |    51 +-
 tools/sra-pileup/cg_tools.c                        |   807 +-
 tools/sra-pileup/cg_tools.h                        |    21 +-
 tools/sra-pileup/cmdline_cmn.c                     |    29 +-
 tools/sra-pileup/cmdline_cmn.h                     |    21 +-
 tools/sra-pileup/dyn_string.c                      |   186 +
 tools/sra-pileup/dyn_string.h                      |    54 +
 tools/sra-pileup/inputfiles.c                      |     2 +-
 tools/sra-pileup/make_opt.pl                       |    13 +
 tools/sra-pileup/perf_log.c                        |   273 +
 tools/sra-pileup/perf_log.h                        |    52 +
 tools/sra-pileup/pileup_counters.c                 |   447 +
 tools/sra-pileup/pileup_counters.h                 |    41 +
 tools/sra-pileup/pileup_index.c                    |   122 +
 tools/sra-pileup/pileup_index.h                    |    40 +
 tools/sra-pileup/pileup_options.h                  |    61 +
 tools/sra-pileup/pileup_stat.c                     |   391 +
 tools/sra-pileup/pileup_stat.h                     |    40 +
 tools/sra-pileup/pileup_v2.c                       |   382 +
 tools/sra-pileup/pileup_v2.h                       |    40 +
 tools/sra-pileup/pileup_varcount.c                 |   139 +
 tools/sra-pileup/pileup_varcount.h                 |    40 +
 tools/sra-pileup/read_fkt.c                        |  1436 +-
 tools/sra-pileup/ref_regions.c                     |   374 +-
 tools/sra-pileup/ref_regions.h                     |    29 +-
 tools/sra-pileup/ref_walker.c                      |   283 +-
 tools/sra-pileup/ref_walker.h                      |    37 +-
 tools/sra-pileup/ref_walker_0.c                    |   223 +
 tools/sra-pileup/ref_walker_0.h                    |   107 +
 tools/sra-pileup/report_deletes.c                  |   259 +
 tools/sra-pileup/report_deletes.h                  |    41 +
 tools/sra-pileup/reref.c                           |    11 +-
 tools/sra-pileup/rna_splice_log.c                  |   374 +
 tools/sra-pileup/rna_splice_log.h                  |    87 +
 tools/sra-pileup/sam-aligned.c                     |  4430 +--
 tools/sra-pileup/sam-aligned.h                     |     5 +-
 tools/sra-pileup/sam-dump-opts.c                   |   107 +-
 tools/sra-pileup/sam-dump-opts.h                   |    26 +-
 tools/sra-pileup/sam-dump.c                        |    52 +-
 tools/sra-pileup/sam-dump.vers                     |     2 +-
 tools/sra-pileup/sam-dump.vers.h                   |     1 +
 tools/sra-pileup/sam-dump2.vers                    |     1 +
 tools/sra-pileup/sam-dump3.c                       |    28 +-
 tools/sra-pileup/sam-dump3.vers                    |     1 +
 tools/sra-pileup/sam-hdr.c                         |    15 +-
 tools/sra-pileup/sam-unaligned.c                   |   221 +-
 tools/sra-pileup/sam-unaligned.h                   |     5 +-
 tools/sra-pileup/splitfastq.pl                     |    46 +
 tools/sra-pileup/sra-pileup.c                      |  1872 +-
 tools/sra-pileup/sra-pileup.vers                   |     2 +-
 tools/sra-pileup/sra-pileup.vers.h                 |     1 +
 tools/sra-pileup/walk_debug.c                      |    88 +
 tools/sra-pileup/walk_debug.h                      |    42 +
 tools/sra-pileup/writer.c                          |   137 +
 tools/sra-pileup/writer.h                          |    32 +
 tools/sra-shell/Makefile                           |    58 +
 tools/sra-shell/guilib/Makefile                    |    71 +
 tools/sra-shell/job-exec/Makefile                  |    71 +
 tools/sra-shell/parser/Makefile                    |    71 +
 tools/sra-shell/parser/sra-shell-lex.l             |   103 +
 tools/sra-shell/parser/sra-shell.y                 |    54 +
 tools/sra-shell/sra-gui/Makefile                   |    94 +
 tools/sra-shell/sra-gui/sra-gui.c                  |    56 +
 tools/sra-shell/sra-gui/sra-gui.vers               |     1 +
 tools/sra-shell/sra-shell/Makefile                 |   101 +
 tools/sra-shell/sra-shell/sra-shell.c              |    56 +
 tools/sra-shell/sra-shell/sra-shell.vers           |     1 +
 tools/sra-shell/turboVision/Makefile               |    71 +
 tools/sra-sort/Makefile                            |    21 +-
 tools/sra-sort/col-pair.c                          |     4 +-
 tools/sra-sort/csra-tbl.c                          |     6 +-
 tools/sra-sort/db-pair.c                           |    12 +-
 tools/sra-sort/dir-pair.c                          |    14 +-
 tools/sra-sort/dump-blob-boundaries.c              |     6 +-
 tools/sra-sort/meta-pair.c                         |     4 +-
 tools/sra-sort/run.c                               |    14 +-
 tools/sra-sort/sort-defs.h                         |    12 +
 tools/sra-sort/sra-sort.c                          |     4 +-
 tools/sra-sort/sra-sort.vers                       |     2 +-
 tools/sra-sort/tbl-pair.c                          |     2 +-
 tools/sra-stat/Makefile                            |     6 +-
 tools/sra-stat/sra-stat.c                          |   132 +-
 tools/sra-stat/sra-stat.vers                       |     2 +-
 tools/sra-stat/sra-stat.vers.h                     |     1 +
 tools/sra/Makefile                                 |   109 +
 tools/sra/sra-dbcc.c                               |   442 +
 tools/sra/table-vers.c                             |   236 +
 tools/sra/table-vers.vers                          |     1 +
 tools/srapath/Makefile                             |     5 +-
 tools/srapath/srapath.c                            |     4 +-
 tools/srapath/srapath.vers                         |     2 +-
 tools/srapath/srapath.vers.h                       |     1 +
 tools/update-schema/Makefile                       |   102 +
 tools/update-schema/update-schema.c                |   452 +
 tools/update-schema/vdb-update-schema.vers         |     1 +
 tools/util/Makefile                                |   170 +-
 tools/util/crc32sum.c                              |   279 +
 tools/util/kdbmeta.c                               |    43 +-
 tools/util/kdbmeta.vers                            |     2 +-
 tools/util/kdbmeta.vers.h                          |     1 +
 tools/util/md5cp.c                                 |   714 +
 tools/util/md5cp.vers                              |     2 +-
 tools/util/md5cp.vers.h                            |     1 +
 tools/util/pacbio-correct.c                        |   221 +
 tools/util/pacbio-correct.vers                     |     1 +
 tools/util/rcexplain.c                             |     6 +-
 tools/util/rcexplain.vers                          |     2 +-
 tools/util/rcexplain.vers.h                        |     1 +
 tools/util/rowwritetest.c                          |     4 +-
 tools/util/rowwritetest.vers                       |     2 +-
 tools/util/schema-replace.c                        |   394 +
 tools/util/schema-replace.sh                       |    22 +
 tools/util/schema-replace.vers                     |     2 +-
 tools/util/schema-replace.vers.h                   |     1 +
 tools/util/sortreadtest.c                          |   355 +
 tools/util/test-sra.c                              |    26 +-
 tools/util/test-sra.vers                           |     2 +-
 tools/util/test-sra.vers.h                         |     1 +
 tools/util/testld.vers                             |     2 +-
 tools/util/txt2kdb.c                               |     6 +-
 tools/util/txt2kdb.vers                            |     2 +-
 tools/util/vdb-lock.c                              |     2 +-
 tools/util/vdb-lock.vers                           |     2 +-
 tools/util/vdb-lock.vers.h                         |     1 +
 tools/util/vdb-passwd.vers                         |     2 +-
 tools/util/vdb-passwd.vers.h                       |     1 +
 tools/util/vdb-unlock.c                            |     2 +-
 tools/util/vdb-unlock.vers                         |     2 +-
 tools/util/vdb-unlock.vers.h                       |     1 +
 tools/util/win/PrintOS.c                           |     2 +-
 tools/util/win/syspass.c                           |     2 +-
 tools/vcf-loader/Makefile                          |   118 +
 tools/vcf-loader/vcf-database.c                    |   165 +
 tools/vcf-loader/vcf-database.h                    |    40 +
 tools/vcf-loader/vcf-grammar.c                     |  1686 +
 tools/vcf-loader/vcf-grammar.h                     |    61 +
 tools/vcf-loader/vcf-grammar.y                     |   123 +
 tools/vcf-loader/vcf-lex.c                         |  2516 ++
 tools/vcf-loader/vcf-lex.l                         |   134 +
 tools/vcf-loader/vcf-load.vers                     |     1 +
 tools/vcf-loader/vcf-loader.c                      |   131 +
 tools/vcf-loader/vcf-parse.h                       |    88 +
 tools/vcf-loader/vcf-reader.c                      |   438 +
 tools/vcf-loader/vcf-reader.h                      |   110 +
 tools/vdb-config/Makefile                          |    20 +-
 tools/vdb-config/configure.cpp                     |   781 +
 tools/vdb-config/configure.h                       |    49 +
 tools/vdb-config/interactive.cpp                   |  1048 +
 tools/vdb-config/interactive.h                     |    50 +
 tools/vdb-config/util.cpp                          |  1096 +
 tools/vdb-config/util.hpp                          |   699 +
 tools/vdb-config/vdb-config-model.cpp              |   428 +
 tools/vdb-config/vdb-config-model.hpp              |   433 +
 tools/vdb-config/vdb-config.c                      |   364 +-
 tools/vdb-config/vdb-config.vers                   |     2 +-
 tools/vdb-config/vdb-config.vers.h                 |     1 +
 tools/vdb-config/vdb-config2.cpp                   |    30 +
 tools/vdb-config/vdb-config2.h                     |    29 +
 tools/vdb-copy/.gitignore                          |    17 +
 tools/vdb-copy/Makefile                            |     5 +-
 tools/vdb-copy/coldefs.c                           |     8 +-
 tools/vdb-copy/column_match.c                      |    31 +
 tools/vdb-copy/column_match.h                      |    42 +
 tools/vdb-copy/copy_context.c                      |    47 +
 tools/vdb-copy/copy_context.h                      |    58 +
 tools/vdb-copy/copy_meta.c                         |     6 +-
 tools/vdb-copy/get_platform.c                      |   336 +-
 tools/vdb-copy/get_platform.h                      |    92 +-
 tools/vdb-copy/helper.c                            |     8 +-
 tools/vdb-copy/type_matcher.c                      |    14 +-
 tools/vdb-copy/vdb-copy.c                          |    18 +-
 tools/vdb-copy/vdb-copy.kfg                        |     8 +-
 tools/vdb-copy/vdb-copy.vers                       |     2 +-
 tools/vdb-copy/vdb-copy.vers.h                     |     1 +
 tools/vdb-decrypt/Makefile                         |     6 +-
 tools/vdb-decrypt/shared.c                         |    32 +-
 tools/vdb-decrypt/vdb-decrypt.vers                 |     2 +-
 tools/vdb-decrypt/vdb-decrypt.vers.h               |     1 +
 tools/vdb-decrypt/vdb-encrypt.c                    |     4 +-
 tools/vdb-decrypt/vdb-encrypt.vers                 |     2 +-
 tools/vdb-decrypt/vdb-encrypt.vers.h               |     1 +
 tools/vdb-dump/.gitignore                          |     2 +
 tools/vdb-dump/Makefile                            |    10 +-
 tools/vdb-dump/help.txt                            |   272 +
 tools/vdb-dump/vdb-boot.c                          |   448 +
 tools/vdb-dump/vdb-boot.vers                       |     1 +
 tools/vdb-dump/vdb-boot.vschema                    |    52 +
 tools/vdb-dump/vdb-dump-bin.c                      |  1277 +
 tools/vdb-dump/vdb-dump-bin.h                      |    44 +
 tools/vdb-dump/vdb-dump-coldefs.c                  |    42 +-
 tools/vdb-dump/vdb-dump-coldefs.h                  |     3 +
 tools/vdb-dump/vdb-dump-context.c                  |    69 +-
 tools/vdb-dump/vdb-dump-context.h                  |    11 +-
 tools/vdb-dump/vdb-dump-fastq.c                    |     8 +-
 tools/vdb-dump/vdb-dump-helper.c                   |    82 +-
 tools/vdb-dump/vdb-dump-helper.h                   |     8 +-
 tools/vdb-dump/vdb-dump-num-gen.c                  |    29 +
 tools/vdb-dump/vdb-dump-num-gen.h                  |     2 +
 tools/vdb-dump/vdb-dump-print.c                    |   550 +
 tools/vdb-dump/vdb-dump-print.h                    |    73 +
 tools/vdb-dump/vdb-dump.c                          |   222 +-
 tools/vdb-dump/vdb-dump.vers                       |     2 +-
 tools/vdb-dump/vdb-dump.vers.h                     |     1 +
 tools/vdb-dump/vdb_info.c                          |  1205 +
 tools/vdb-dump/vdb_info.h                          |    47 +
 tools/vdb-validate/Makefile                        |     5 +-
 tools/vdb-validate/vdb-validate.c                  |   729 +-
 tools/vdb-validate/vdb-validate.vers               |     2 +-
 tools/vdb-validate/vdb-validate.vers.h             |     1 +
 tools/vdbview/b_first.png                          |   Bin 0 -> 528 bytes
 tools/vdbview/b_goto.png                           |   Bin 0 -> 475 bytes
 tools/vdbview/b_last.png                           |   Bin 0 -> 519 bytes
 tools/vdbview/b_next.png                           |   Bin 0 -> 428 bytes
 tools/vdbview/b_nextpage.png                       |   Bin 0 -> 639 bytes
 tools/vdbview/b_prev.png                           |   Bin 0 -> 426 bytes
 tools/vdbview/b_prevpage.png                       |   Bin 0 -> 636 bytes
 tools/vdbview/b_search.png                         |   Bin 0 -> 614 bytes
 tools/vdbview/background.pas                       |   277 +
 tools/vdbview/buttons.svg                          |   268 +
 tools/vdbview/columnsel.lfm                        |    90 +
 tools/vdbview/columnsel.pas                        |   115 +
 tools/vdbview/dataproxy.pas                        |   602 +
 tools/vdbview/gotoform.lfm                         |    56 +
 tools/vdbview/gotoform.pas                         |    47 +
 tools/vdbview/jobdef.pas                           |    27 +
 tools/vdbview/linkedlist.pas                       |   186 +
 tools/vdbview/logo_128.png                         |   Bin 0 -> 1752 bytes
 tools/vdbview/logo_16.png                          |   Bin 0 -> 368 bytes
 tools/vdbview/logo_256.png                         |   Bin 0 -> 3524 bytes
 tools/vdbview/logo_32.png                          |   Bin 0 -> 541 bytes
 tools/vdbview/logo_64.png                          |   Bin 0 -> 910 bytes
 tools/vdbview/mainwindow.lfm                       |   973 +
 tools/vdbview/mainwindow.pas                       |   793 +
 tools/vdbview/searchform.lfm                       |    69 +
 tools/vdbview/searchform.pas                       |    79 +
 tools/vdbview/selector_types.pas                   |    20 +
 tools/vdbview/support_unit.pas                     |   217 +
 tools/vdbview/svdb.pas                             |   676 +
 tools/vdbview/svdb_obj.pas                         |   339 +
 tools/vdbview/vdbview.ico                          |   Bin 0 -> 25890 bytes
 tools/vdbview/vdbview.lpi                          |   343 +
 tools/vdbview/vdbview.lpr                          |    24 +
 tools/vdbview/vdbview.res                          |   Bin 0 -> 27156 bytes
 tools/vdbview/vdbview1.ico                         |   Bin 0 -> 25890 bytes
 tools/vdbview/version.lfm                          |    40 +
 tools/vdbview/version.pas                          |    33 +
 tools/vtblcp/Makefile                              |    97 +
 tools/vtblcp/vtblcp-priv.h                         |    40 +
 tools/vtblcp/vtblcp.c                              |   979 +
 tools/vtblcp/vtblcp.vers                           |     1 +
 tools/workspace/.gitignore                         |     3 +
 tools/workspace/Makefile                           |   125 +
 tools/workspace/path-to-kar-file.cpp               |   117 +
 tools/workspace/prefs-lex.l                        |   181 +
 tools/workspace/prefs-yacc.y                       |   189 +
 tools/workspace/sra.cpp                            |  1514 +
 tools/workspace/sra.vers                           |     1 +
 tools/workspace/sratoolkit-exception.cpp           |   126 +
 tools/workspace/sratoolkit-exception.hpp           |   111 +
 tools/workspace/token.c                            |   228 +
 tools/workspace/token.h                            |    99 +
 tools/workspace/workspace.cpp                      |  1116 +
 win-configure.bat                                  |     1 +
 1812 files changed, 133166 insertions(+), 527258 deletions(-)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..a76dbe0
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+/win
+/centos
+/mac
+/Makefile.config.*
diff --git a/CHANGES b/CHANGES
new file mode 100644
index 0000000..63d53dc
--- /dev/null
+++ b/CHANGES
@@ -0,0 +1,30 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+The NCBI SRA Software Development Kit
+Contact: sra-tools at ncbi.nlm.nih.gov
+
+Release documentation is now being delivered at
+http://trace.ncbi.nlm.nih.gov/Traces/sra/sra.cgi?view=software
diff --git a/GNU-license.txt b/GNU-license.txt
new file mode 100644
index 0000000..818433e
--- /dev/null
+++ b/GNU-license.txt
@@ -0,0 +1,674 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    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 3 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, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+    <program>  Copyright (C) <year>  <name of author>
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+  The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.  But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/Makefile b/Makefile
index 0b467d0..124aa79 100644
--- a/Makefile
+++ b/Makefile
@@ -34,8 +34,7 @@ include $(TOP)/build/Makefile.shell
 # default
 #
 SUBDIRS = \
-	libs \
-	tools
+	tools \
 
 # common targets for non-leaf Makefiles; must follow a definition of SUBDIRS
 include $(TOP)/build/Makefile.targets
@@ -60,25 +59,60 @@ $(SUBDIRS_ALL):
 $(SUBDIRS_STD):
 
 #-------------------------------------------------------------------------------
+# install
+#
+install: std
+	$(MAKE) -s TOP=$(CURDIR) -f build/Makefile.install install
+
+.PHONY: install
+
+#-------------------------------------------------------------------------------
 # clean
 #
 clean: clean_test
 
 clean_test:
+	@ $(MAKE) -s -C test clean
+
+#-------------------------------------------------------------------------------
+# runtests
+#
+runtests: runtests_test
+
+runtests_test:
+	@ $(MAKE) -s -C test runtests
+
+#	@ $(MAKE) -s -C ngs runtests
+
+#-------------------------------------------------------------------------------
+# slowtests
+#
+slowtests: slowtests_test
+
+slowtests_test:
+	@ $(MAKE) -s -C test slowtests
 
 #-------------------------------------------------------------------------------
 # pass-through targets
 #
-COMPILERS = GCC VC++ CLANG
+COMPILERS = GCC ICC VC++ CLANG
 ARCHITECTURES = i386 x86_64 sparc32 sparc64
-CONFIG = debug profile release static dynamic
+CONFIG = debug profile release
 PUBLISH = scm pubtools
 REPORTS = bindir targdir osdir config compilers architecture architectures
 PASSTHRUS = \
 	out \
 	CC $(COMPILERS) \
 	$(ARCHITECTURES) \
-	$(CONFIG) $(PUBLISH)
+	$(CONFIG) $(PUBLISH) \
+	purify purecov \
+	local static dynamic
+
+$(RHOSTS):
+	@ $(MAKE) -s TOP=$(CURDIR) -f build/Makefile.env local
+	@ $(MAKE) -s TOP=$(CURDIR) -f build/Makefile.env require-proxy-exec
+	@ $(MAKE) -s TOP=$(CURDIR) -f build/Makefile.env $@
+	@ $(MAKE) -s TOP=$(CURDIR) -f build/Makefile.env rebuild-dirlinks config
 
 $(PASSTHRUS):
 	@ $(MAKE) -s TOP=$(CURDIR) -f build/Makefile.env $@
@@ -87,7 +121,7 @@ $(PASSTHRUS):
 $(REPORTS):
 	@ $(MAKE) -s TOP=$(CURDIR) -f build/Makefile.env $@
 
-.PHONY: $(PASSTHRUS) $(REPORTS)
+.PHONY: $(PASSTHRUS) $(RHOSTS) $(REPORTS)
 
 
 #-------------------------------------------------------------------------------
@@ -106,5 +140,8 @@ help configure:
 	@ echo "To set a build configuration, run 'make <config>' where"
 	@ echo "config = { "$(CONFIG)" }."
 	@ echo
+	@ echo "To select a remote build configuration, run 'make <rhost>' where"
+	@ echo "rhost = { "$(RHOSTS)" }."
+	@ echo
 
 .PHONY: help configure
diff --git a/README b/README
index 7dc5b1c..6abcab1 100644
--- a/README
+++ b/README
@@ -32,6 +32,27 @@ http://trace.ncbi.nlm.nih.gov/Traces/sra/std
 The SRA Toolkit and SDK from NCBI is a collection of tools and
 libraries for using data in the INSDC Sequence Read Archives.
 
+With this release, NCBI has implemented Compression by Reference, a
+sequence alignment compression process for storing sequence data.
+Currently BAM, Complete Genomics and Illumina export.txt formats
+contain alignment information. Compression by Reference only stores
+the difference in base pairs between sequence data and the segments it
+aligns to.  The decompression process to restore original data such as
+fastq-dump would require fast access to the actual sequences of the
+references. NCBI recommends that SRA users dedicate local disk space
+to store local references downloaded from the NCBI SRA site. Linked
+references should be in a location accessible by the SRA Reader
+software.
+
+Older files in the NCBI system may not have been compressed using
+Compression by Reference.  For more information on how to use
+Reference-based compressed files, download local references, and use
+related tools please refer to Compression by Reference file on the
+NCBI SRA website:
+
+    "http://trace.ncbi.nlm.nih.gov/Traces/sra/sra.cgi?view=softwareReadme"
+
+
 For additional information on using and building the toolkit,
 please visit our web site at:
 
diff --git a/README-blastn b/README-blastn
new file mode 100644
index 0000000..2008a8c
--- /dev/null
+++ b/README-blastn
@@ -0,0 +1,133 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+The NCBI SRA ( Sequence Read Archive )
+
+
+Contact: sra-tools at ncbi.nlm.nih.gov
+http://trace.ncbi.nlm.nih.gov/Traces/sra/std
+
+
+Stand-alone BLAST searches against SRA runs in their native format.
+-------------------------------------------------------------------
+
+A stand-alone blastn application to perform BLAST searches directly against 
+native SRA files is included in this distribution. This application has been
+tested in-house at the NCBI, but has not been heavily used, so this should be
+considered a preliminary (alpha) release to a few experienced users. A 64-bit
+LINUX application has been built for this testing. 
+
+The application is called "blastn_vdb".
+
+The application can be invoked in much the same manner as the standard 
+blastn application:
+
+1) blastn_vdb -help or blastn_vdb -h will produce usage messages.
+
+2) The BLAST+ command-line manual at http://www.ncbi.nlm.nih.gov/books/NBK1763/ 
+provides more details on the options, though not all blastn options are
+available with blastn_vdb. Some options simply do not apply to sequences in SRA
+(e.g., -gilist is missing as these sequences have not been assigned GI's). Some
+options have not yet been implemented (e.g., -num_threads is currently disabled).
+
+
+To search cached or on-demand SRA objects.
+------------------------------------------
+An example blastn_vdb command-line would be:
+
+./blastn_vdb -db "ERR039542 ERR047215 ERR039539 ERR039540" -query nt.test -out test.out
+
+The file nt.test contains the query in FASTA format, and it will be searched against 
+the reads in runs with accessions ERR039542 ERR047215 ERR039539 ERR039540.
+
+If you have not already downloaded these objects using the vdb "prefetch" tool,
+they will be retrieved on-demand from NCBI under standard configuration. For
+alternative configuration information, please see the "README-vdb-config" file
+in this distribution.
+
+Searching with manually downloaded files.
+-----------------------------------------
+If you have manually downloaded files, e.g. via aspera or wget, etc., they may
+be referred to as "local" files. You can pass one or more file paths to be used
+collectively as the database. In this case the blastn_vdb command-line would be:
+
+./blastn_vdb -db <SRR_file> -query <input_file> -out <output_file>
+	
+Where
+<SRR_file> is the path (relative or absolute) and name of the SRRxxxxx file
+<input_file> is a fasta file containing the sequence(s) to be BLASTed
+<output_file> is the name specified for the output report of the blast search.
+
+Example:
+
+./blastn_vdb -db ./subdir/ERR039542.sra -query nt.test -out test.out
+
+Querying multiple SRR files simultaneously:
+
+./blastn_vdb -db "<SRR_file1> <SRR_file2> <SRR_file3>" -query <input.fa> -out <output_file>
+
+Enclose the group of files to be included in the search set in "quotes", e.g.
+"./SRR_file1.sra ./SRR_file2.sra ./SRR_file3.sra"
+
+Example:
+
+./blastn_vdb -db "./ERR039542.sra ./ERR047215.sra ./ERR039539.sra ./ERR039540.sra" -query nt.test -out test.out
+
+Caveats
+-------
+There are some limitations on the currently available application:
+
+1) Individual SRA data files containing more than 2 billion reads are not yet supported. For a 
+paired-end experiment this is actually a limitation of about 1 billion "spots".
+
+2) Compressed SRA ("cSRA") is not yet fully supported. Currently, only the
+unaligned fraction of reads are searched. Compressed SRA are runs containing
+alignments (e.g., ERR230455). Runs can be checked with "vdb-dump" to report if
+they contain alignment information:
+
+    $ vdb-dump -E ERR230455
+    enumerating the tables of database 'ERR230455'
+    tbl #1: PRIMARY_ALIGNMENT
+    tbl #2: REFERENCE
+    tbl #3: SEQUENCE
+
+3) You may need to prefix "./" to the run name for files in your current
+directory.
+
+4) The blast_formatter is not currently able to read native SRA files, so 
+reformatting of results saved as a blast archive is not yet supported.
+
+Common errors and fixes.
+------------------------
+
+1) Failure to provide relative path to manually downloaded SRR file:
+
+./blastn_vdb -db SRR770754.sra -query srr770754_test.fa -out test.out
+Error: NCBI C++ Exception:
+    "vdb2blast_util.cpp", line 253: Error: ncbi::CVDBBlastUtil::x_MakeSRASeqSrc() 
+    - VDB BlastSeqSrc construction failed: Failed to add any run to VDB runset: unsupported while allocating
+    
+Fix:
+Include relative (e.g., "../" or "./") or absolute (e.g., "/home/user/SRA_BLAST_data/") file path with SRR file
diff --git a/README-build b/README-build
new file mode 100644
index 0000000..fe1d722
--- /dev/null
+++ b/README-build
@@ -0,0 +1,237 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+The NCBI SRA ( Sequence Read Archive ) SDK ( Software Development Kit )
+
+
+Contact: sra-tools at ncbi.nlm.nih.gov
+http://trace.ncbi.nlm.nih.gov/Traces/sra/std
+
+
+This version of the NCBI SRA SDK generates loading and dumping tools with
+their respective libraries for building new and accessing existing runs.
+It may be built with GCC, ICC or Microsoft VC++.
+
+
+REQUIREMENTS:
+
+This software release was designed to run under Linux, MacOSX and Windows
+operating systems on Intel x86-compatible 32 and 64 bit architectures.
+
+  ar                # tested with version 2.15.90
+  bash              # certain scripts require bash
+  make              # GNU make version 3.80 or later
+  gcc, g++          # tested with 4.1.2, but should work with others
+  libz              # version 1
+  libbz2            # version 1
+  libxml2           # tested with version 2.6.7 [Linux and Mac only]
+
+If your system does NOT have libz or libbz2, or if the build fails due to
+missing one of the expected libraries, try running "make all" which will
+attempt to download the sources to libz and libbz2 and build them.
+
+OPTIONS:
+
+Specific versions of ICC are supported as an alternate compiler.
+
+  icc, icpc         # tested with 11.0 (64-bit) and 10.1 (32-bit)
+                    # 32-bit 11.0 does not work
+
+WINDOWS BUILD:
+
+The Windows build uses the same makefiles as Linux and Mac, and has been tested
+under Cygwin. You need to execute Cygwin AFTER sourcing the Microsoft batch file
+from Visual Studio.
+
+
+CONTENTS:
+
+  CHANGES           # describes changes at pertinent levels
+  Makefile          # drives configuration and sub-target builds
+  README
+  README-WINDOWS.txt
+  USAGE
+  build             # holds special makefiles and configuration
+  interfaces        # contains module interfaces, schema, plus
+                      compiler and platform specific includes
+  libs              # sdk library code
+  tools             # toolkit code
+  test              # testing code
+
+
+CONFIGURATION:
+
+There are three configurable parameters:
+  1) BUILD  = 'debug', 'release' etc.
+  2) COMP   = 'GCC' etc.
+  3) OUTDIR = <path-to-binaries-libs-objfiles>
+
+The target architecture is chosen to match your build host. At this
+time, only the Macintosh build will support cross-compilation. In the
+instructions below, x86_64 is the assumed architecture. If your host
+is i386 (32-bit), then you would substitute 32 for paths that contain
+64.
+
+
+BUILD INSTRUCTIONS:
+
+## create output directories and symlinks for first time
+
+  $ OUTDIR=<path-to-output>
+  $ make OUTDIR="$OUTDIR" out
+
+The path in OUTDIR MUST be a full path - relative paths may fail.
+
+## decide upon STATIC or DYNAMIC builds
+#  VDB.2 was designed to make use of dynamic libraries, but
+#  in many environments static builds are more convenient or may even be
+#  required, due to installation restrictions.
+#
+#  THE BUILD DOES NOT CURRENTLY SUPPORT PARALLEL DYNAMIC AND STATIC MODES
+#  if you switch between them, you should perform a "make clean" first.
+
+  $ make static
+-OR_
+  $ make dynamic
+
+## if you are using a dynamic build, update LD_LIBRARY_PATH - probably want to put
+# in shell startup ( ensure that libz, libbz2 and libxml2 can be found in your path )
+
+  $ export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$OUTDIR/lib64"
+
+## the build uses "TOP" as an internal variable
+#  if you have it defined in your shell environment, unset it before making
+
+## build the libraries and binaries
+
+  $ make GCC debug     # optionally set compiler and/or build
+  $ make               # builds libraries and binary executables
+
+The standard make will cause default libraries and tools to be built. Binary
+executables and both shared and static libraries can be found in their
+respective output directories.
+
+If the build fails due to not finding libz or libbz2, try:
+
+  $ make all           # see note above on libraries
+
+
+STATIC BUILD RESULTS:
+
+<OUTDIR>/bin64/         # (bin32 for 32-bit builds)
+  abi-dump              # dump to ABI-native format
+  abi-load              # load from ABI-native format
+  align-info            # retrieve information from cSRA object
+  fastq-dump            # dump to FASTQ format
+  fastq-load            # load from FASTQ format
+  helicos-load          # load from Helicos native format
+  illumina-dump         # dump to Illumina-native format
+  illumina-load         # load from Illumina-native format
+  kar                   # single file archive utility
+  kdbmeta               # access db, table or column metadata
+  rcexplain             # return code display utility
+  sam-dump              # dump to SAM format from cSRA
+  sff-dump              # dumps 454 runs in SFF format
+  sff-load              # load from SFF format
+  sra-dbcc              # consistency checker
+  sra-kar               # sra-specific kar tool
+  sra-stat              # gather run statistics and print to stdout
+  srf-load              # load from SRF format
+  vdb-copy              # tool to copy tables
+  vdb-dump              # dump rows in a textual format
+  vdb-lock              # locks an object against modification
+  vdb-unlock            # unlocks an object
+
+<OUTDIR>/bin64/ncbi     # (bin32 for 32-bit builds)
+  config.kfg            # simple text file for configuring file system
+
+<OUTDIR>/lib64/         # (lib32 for 32-bit builds)
+  libkdb                # static physical layer reading library
+  libkfg                # static configuration library
+  libkfs                # static file system library
+  libklib               # static support library
+  libkproc              # static process synchronization library
+  libkq                 # static cross-thread queue library
+  libksproc             # static single-threaded emulation library
+  libksrch              # static search algorithm library
+  libkxfs               # static XML to filesystem library
+  libkxml               # static XML container support library
+  libload               # static loader tool utility library
+  libsradb              # static API for accessing sra
+  libsrareader          # static reader library
+  libsraschema          # static version of SRA schema
+  libvdb                # static virtual layer reading library
+  libwkdb               # static physical layer update library
+  libwsradb             # static update API for SRA
+  libwvdb               # static virtual layer update library
+
+<OUTDIR>/mod64/         # (mod32 for 32-bit builds)
+  -- empty --
+
+<OUTDIR>/wmod64/        # (wmod32 for 32-bit builds)
+  -- empty --
+
+
+
+DYNAMIC BUILD RESULTS:
+
+<OUTDIR>/bin64/         # (bin32 for 32-bit builds)
+  -- same as static --
+
+<OUTDIR>/bin64/ncbi     # (bin32 for 32-bit builds)
+  -- empty --
+
+<OUTDIR>/lib64/         # (lib32 for 32-bit builds)
+  libkdb                # physical layer reading library
+  libkfg                # configuration library
+  libkfs                # file system library
+  libklib               # support library
+  libkproc              # process synchronization library
+  libkq                 # cross-thread queue library
+  libksproc             # single-threaded emulation library
+  libksrch              # search algorithm library
+  libkxfs               # XML to filesystem library
+  libkxml               # XML container support library
+  libload               # loader tool utility library
+  libsra-schema         # weak-linked sra schema
+  libsradb              # API for accessing sra
+  libsrapath            # weak-link stubs for srapath
+  libsrareader          # reader library
+  libvdb                # virtual layer reading library
+  libwkdb               # physical layer update library
+  libwsradb             # update API for SRA
+  libwvdb               # virtual layer update library
+
+<OUTDIR>/lib64/ncbi     # (lib32 for 32-bit builds)
+  config.kfg            # simple text file for configuring file system
+
+<OUTDIR>/mod64/         # (mod32 for 32-bit builds)
+  libaxf                # cSRA-specific VDB external functions
+  libsraxf              # sra-specific VDB external functions
+  libvxf                # generic VDB external functions
+
+<OUTDIR>/wmod64/        # (wmod32 for 32-bit builds)
+  libwsraxf             # sra-specific VDB external functions for update
+  libwvxf               # update VDB external functions
diff --git a/README-build.txt b/README-build.txt
deleted file mode 100644
index 3a508c6..0000000
--- a/README-build.txt
+++ /dev/null
@@ -1,239 +0,0 @@
-# ===========================================================================
-#
-#                            PUBLIC DOMAIN NOTICE
-#               National Center for Biotechnology Information
-#
-#  This software/database is a "United States Government Work" under the
-#  terms of the United States Copyright Act.  It was written as part of
-#  the author's official duties as a United States Government employee and
-#  thus cannot be copyrighted.  This software/database is freely available
-#  to the public for use. The National Library of Medicine and the U.S.
-#  Government have not placed any restriction on its use or reproduction.
-#
-#  Although all reasonable efforts have been taken to ensure the accuracy
-#  and reliability of the software and data, the NLM and the U.S.
-#  Government do not and cannot warrant the performance or results that
-#  may be obtained by using this software or data. The NLM and the U.S.
-#  Government disclaim all warranties, express or implied, including
-#  warranties of performance, merchantability or fitness for any particular
-#  purpose.
-#
-#  Please cite the author in any work or product based on this material.
-#
-# ===========================================================================
-
-
-The NCBI SRA ( Sequence Read Archive ) SDK ( Software Development Kit )
-
-
-Contact: sra-tools at ncbi.nlm.nih.gov
-http://trace.ncbi.nlm.nih.gov/Traces/sra/std
-
-
-This version of the NCBI SRA SDK generates tools with their respective libraries
-for building new and accessing existing runs. It may be built with GCC.
-
-
-REQUIREMENTS:
-
-This software release was designed to run under Linux, MacOSX and Windows
-operating systems on Intel x86-compatible 32 and 64 bit architectures.
-
-  ar                # tested with version 2.22
-  bash              # certain scripts require bash
-  make              # GNU make version 3.81 or later
-  gcc, g++          # tested with 4.4.2, but should work with others
-  libxml2           # tested with version 2.7.6
-
-WINDOWS BUILD:
-
-The Windows build uses the same make files as Linux and Mac, and has been tested
-under Cygwin. You need to execute Cygwin AFTER sourcing the Microsoft batch file
-from Visual Studio.
-
-
-CONTENTS:
-
-  Makefile          # drives configuration and sub-target builds
-  README
-  README-WINDOWS.txt
-  build             # holds special makefiles and configuration
-  interfaces        # contains module interfaces, schema, plus
-                      compiler and platform specific includes
-  libs              # sdk library code
-  tools             # toolkit code
-
-
-CONFIGURATION:
-
-There are three configurable parameters:
-  1) BUILD  = 'debug', 'release' etc.
-  2) COMP   = 'GCC' etc.
-  3) OUTDIR = <path-to-binaries-libs-objfiles>
-
-The target architecture is chosen to match your build host. At this
-time, only the Macintosh build will support cross-compilation. In the
-instructions below, x86_64 is the assumed architecture. If your host
-is i386 (32-bit), then you would substitute 32 for paths that contain
-64.
-
-Running "make help" will list more details of how your build may
-be configured:
-
-  Before initial build, run 'make OUTDIR=<dir> out' from
-  the project root to set the output directory of your builds.
-
-  To select a compiler, run 'make <comp>' where
-  comp = { GCC VC++ CLANG }.
-
-  For hosts that support cross-compilation ( only Macintosh today ),
-  you can run 'make <arch>' where arch = { i386 x86_64 sparc32 sparc64 }.
-
-  To set a build configuration, run 'make <config>' where
-  config = { debug profile release static dynamic }.
-
-Running "make config" will show the current configuration, e.g.:
-
-  current build is linux static rel x86_64 build using gcc tools
-  output target directory is '$PATH_TO_OUTPUT/linux/gcc/stat/x86_64/rel'
-
-where "$PATH_TO_OUTPUT" is local to your system, of course.
-
-
-BUILD INSTRUCTIONS:
-
-## create output directories and symlinks for first time
-
-  $ OUTDIR=<path-to-output>
-  $ make OUTDIR="$OUTDIR" out
-
-The path in OUTDIR MUST be a full path - relative paths may fail.
-
-## decide upon STATIC or DYNAMIC builds
-#  VDB.2 was designed to make use of dynamic libraries, but
-#  in many environments static builds are more convenient or may even be
-#  required, due to installation restrictions.
-#
-#  THE BUILD DOES NOT CURRENTLY SUPPORT PARALLEL DYNAMIC AND STATIC MODES
-#  if you switch between them, you should perform a "make clean" first.
-
-  $ make static
--OR_
-  $ make dynamic
-
-## if you are using a dynamic build, update LD_LIBRARY_PATH - probably want to put
-# in shell startup ( ensure that libz, libbz2 and libxml2 can be found in your path )
-
-  $ export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$OUTDIR/lib64"
-
-## the build uses "TOP" as an internal variable
-#  if you have it defined in your shell environment, unset it before making
-
-## build the libraries and binaries
-
-  $ make GCC debug     # optionally set compiler and/or build
-  $ make               # builds libraries and binary executables
-
-The standard make will cause default libraries and tools to be built. Binary
-executables and both shared and static libraries can be found in their
-respective output directories.
-
-
-STATIC BUILD RESULTS:
-
-<OUTDIR>/bin64/         # (bin32 for 32-bit builds)
-  abi-dump              # dump to ABI-native format
-  abi-load              # load from ABI-native format
-  align-info            # retrieve information from SRA alignment object (cSRA)
-  bam-load              # load from BAM format into SRA (cSRA)
-  cg-load               # load from Complete Genomics native format
-  fastq-dump            # dump to FASTQ format
-  fastq-load            # load from FASTQ format
-  helicos-load          # load from Helicos native format
-  illumina-dump         # dump to Illumina-native format
-  illumina-load         # load from Illumina-native format
-  kar                   # single file archive utility
-  kdbmeta               # access db, table or column metadata
-  latf-load             # generic FASTQ loader
-  prefetch              # tool to download runs from NCBI by accession
-  rcexplain             # return code display utility
-  sam-dump              # dump to SAM format from cSRA
-  sff-dump              # dumps 454 runs in SFF format
-  sff-load              # load from SFF format
-  sra-kar               # sra-specific kar tool
-  sra-pileup            # produces SAM-style pileup information from SRA (cSRA)
-  sra-sort              # canonically orders SRA (cSRA) data for improved access
-  sra-stat              # gather run statistics and print to stdout
-  srapath               # returns the full location of an object by accession
-  srf-load              # load from SRF format
-  test-sra              # test user's environment for configuration and libraries
-  vdb-config            # display and/or modify user configuration
-  vdb-copy              # tool to copy tables
-  vdb-decrypt           # tool to decrypt files from dbGap
-  vdb-dump              # dump rows in a textual format
-  vdb-encrypt           # to to (re)encrypt files using dbGap encryption key
-  vdb-lock              # locks an object against modification
-  vdb-unlock            # unlocks an object
-
-<OUTDIR>/lib64/         # (lib32 for 32-bit builds)
-  libalign-access       # BAM format reading API
-  libalign-reader       # SRA (cSRA) alignment reading API
-  libbz2                # bzip2 library
-  libkdb                # physical layer reading library
-  libkfg                # configuration library
-  libkfs                # physical file system library
-  libklib               # support library
-  libkproc              # process synchronization library
-  libkq                 # cross-thread queue library
-  libkrypto             # cryptographic library
-  libsproc              # single-threaded stub library
-  libksrch              # search algorithm library
-  libkurl               # interface to libcurl
-  libkxfs               # XML to filesystem library
-  libkxml               # XML container support library
-  libload               # loader tool utility library
-  libsradb              # API for accessing sra
-  libsrareader          # reader library
-  libsraschema          # version of SRA schema for reading
-  libvdb                # virtual layer reading library
-  libvfs                # virtual file system library
-  libwkdb               # physical layer update library
-  libwsradb             # update API for SRA
-  libwsraschema         # version of SRA schema for update
-  libwvdb               # virtual layer update library
-  libz                  # gzip library
-
-
-
-DYNAMIC BUILD RESULTS:
-
-<OUTDIR>/bin64/         # (bin32 for 32-bit builds)
-  -- same as static --
-
-<OUTDIR>/lib64/         # (lib32 for 32-bit builds)
-  libalign-access       # BAM format reading API
-  libalign-reader       # SRA (cSRA) alignment reading API
-  libbz2                # static bzip2 library
-  libkdb                # physical layer reading library
-  libkfg                # configuration library
-  libkfs                # physical file system library
-  libklib               # support library
-  libkproc              # process synchronization library
-  libkq                 # cross-thread queue library
-  libkrypto             # cryptographic library
-  libsproc              # single-threaded stub library
-  libksrch              # search algorithm library
-  libkurl               # interface to libcurl
-  libkxfs               # XML to filesystem library
-  libkxml               # XML container support library
-  libload               # loader tool utility library
-  libsradb              # API for accessing sra
-  libsrareader          # reader library
-  libsraschema          # static version of SRA schema for reading
-  libvdb                # virtual layer reading library
-  libvfs                # virtual file system library
-  libwkdb               # physical layer update library
-  libwsradb             # update API for SRA
-  libwsraschema         # static version of SRA schema for update
-  libwvdb               # virtual layer update library
-  libz                  # static gzip library
diff --git a/README-config.txt b/README-config.txt
index f64ffdb..648f1f7 100644
--- a/README-config.txt
+++ b/README-config.txt
@@ -1,51 +1,12 @@
-# ===========================================================================
-#
-#                            PUBLIC DOMAIN NOTICE
-#               National Center for Biotechnology Information
-#
-#  This software/database is a "United States Government Work" under the
-#  terms of the United States Copyright Act.  It was written as part of
-#  the author's official duties as a United States Government employee and
-#  thus cannot be copyrighted.  This software/database is freely available
-#  to the public for use. The National Library of Medicine and the U.S.
-#  Government have not placed any restriction on its use or reproduction.
-#
-#  Although all reasonable efforts have been taken to ensure the accuracy
-#  and reliability of the software and data, the NLM and the U.S.
-#  Government do not and cannot warrant the performance or results that
-#  may be obtained by using this software or data. The NLM and the U.S.
-#  Government disclaim all warranties, express or implied, including
-#  warranties of performance, merchantability or fitness for any particular
-#  purpose.
-#
-#  Please cite the author in any work or product based on this material.
-#
-# ===========================================================================
-
-
-The NCBI SRA ( Sequence Read Archive )
-
-
-Contact: sra-tools at ncbi.nlm.nih.gov
-http://trace.ncbi.nlm.nih.gov/Traces/sra/std
-
 About configuration-assistant:
+configuration-assistant.perl will help you to configure the SRA tools to be able to access
+the local reference repository and to download the correct references for a given cSRA file.
 
-  configuration-assistant.perl will help you to configure the SRA tools to be able
-  to access the local reference repository and to download the correct references
-  for a given cSRA file.
-
-To run configuration-assistant on Linux or Mac:
-  - open a shell
-  - change directory to the folder where you extracted the toolkit (cd .../sratoolkit...),
-  - type 'perl configuration-assistant.perl' (without the quotation marks).
-
-
-To run configuration-assistant on Windows:
 
-  - open Command Prompt (Start->Run->cmd.exe),
-  - change directory to the folder where you extracted the toolkit (cd ...\sratoolkit.x.x.x-win64),
-  - type 'perl configuration-assistant.perl' (without the quotation marks).
+To run configuration-assistant:
+- open Command Prompt (Start->Run->cmd.exe),
+- change directory to the folder where you extracted the toolkit (cd ...\sratoolkit.2.1.7-win32),
+- type 'perl configuration-assistant.perl' (without the quotation marks).
 
 
 If the following message shows up:
diff --git a/README-vdb-config.txt b/README-vdb-config.txt
new file mode 100644
index 0000000..b08ed96
--- /dev/null
+++ b/README-vdb-config.txt
@@ -0,0 +1,119 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+The tool 'vdb-config' can be used to inspect or change the configuration
+of the sra-toolkit.
+
+DISCLAIMER: This is pre-release (alpha) software. Some features are not
+yet fully functional in version 2.4.0 - this will be fixed in the next
+release.
+
+When called without any parameters the tool reports the current configuration
+in xml-format. No changes are made.
+
+-----------------------------------------------------------------------------
+
+vdb-config --restore-defaults
+
+If called with this parameter the tool will bring the configuration into
+default state.
+
+-----------------------------------------------------------------------------
+
+vdb-config -i
+
+This will present the user with a colored configuration dialog.
+
+The tab-key and the cursor-keys navigate the dialog. The item with the little
+red square has the focus. A button or a checkbox can be 'pressed' with the
+space or enter-key. To get out of the dialog without saving any changes
+press the '6'-key or the 'q'-key or navigate to the 'exit'-button at the
+bottom of the dialog and press the space or enter-key.
+
+
+The "data source" part:
+
+The "NCBI SRA" labeled checkbox enables/disables remote access to the SRA-
+accession stored at NCBI. As long as the computer has internet-access and this
+checkbox is enabled the user can access SRA-accessions directly without
+downloading them.
+
+A command like 'sra-pileup SRR341578' at the command-line will produce pileup
+output of the given accession even if this accession has not been downloaded
+before.
+The tool will download the data on the fly from our servers.
+
+
+There might be a checkbox labeled "site" below the "NCBI-SRA" one. If this
+checkbox is not available you do not have a 'site'-installation of SRA-data.
+If it is visible you do have such a site-installation and you can disable
+access to this data.
+
+
+The "local workspaces" part:
+
+At the top are 2 buttons "import dbGaP-project" and "set default import path".
+
+If you are not using dbGaP-projects (The database of Genotypes and Phenotypes)
+you can ignore these 2 buttons.
+
+The "import dbGaP-project" button presents you with another dialog to select
+a ngc-file. You can navigate the directories of your computer to find and
+select one of these files. By default the focus is in the files-list. It may
+be empty.
+Use the cursor-key: 'up' to focus the 'directories'-list. If you press enter
+on any of the listed directory-names you change into this directory.
+The '[ .. ]' entry brings you back into the parent directory. If you see
+ngc-files in the lower 'files'-list press the tab-key to switch to the
+'files'-list. Press enter on one of them to select this file for import. You
+will see a success-message if the import was performed without errors.
+On Windows you cannot switch from one drive-letter
+to another when selecting.
+
+The "set default import path" gives you the opportunity to specify a different
+default location for dbGaP-projects - for instance if your home directory is
+not big enough. You can always change the location for your dbGaP-project
+after the import.
+
+
+Below the 2 buttons is a list of local repositories. If there are no
+dbGaP-projects this list has only one entry "Open Access Data". This is the
+location where accessions get downloaded and cached. You can change these
+locations if for instance your home directory where they are created by
+default does not have enough space.
+The change button brings up a directory-select dialog.
+
+If you made any changes like enabling/disabling or changed a location, the
+change is only written to the configuration if you exit the dialog via the
+'save and exit' button.
+
+-----------------------------------------------------------------------------
+
+
+vdb-config -i --interactive-mode textual
+
+This will present the user with a purely textual and sequential dialog. It is
+intended to be used if the colored mode does not work, maybe because of
+console issues.
diff --git a/README-wget.txt b/README-wget.txt
new file mode 100644
index 0000000..ddc8fa9
--- /dev/null
+++ b/README-wget.txt
@@ -0,0 +1,35 @@
+MAINTAINER: Micah Cowan <micah at cowan.name>
+
+Wget was originally written and mainained by Hrvoje Niksic.  Please see
+the file AUTHORS for a list of major contributors, and the ChangeLogs
+for a detailed listing of all contributions.
+
+
+Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+2005, 2006, 2007, 2008 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 3 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+USA.
+
+Additional permission under GNU GPL version 3 section 7
+
+If you modify this program, or any covered work, by linking or
+combining it with the OpenSSL project's OpenSSL library (or a
+modified version of that library), containing parts covered by the
+terms of the OpenSSL or SSLeay licenses, the Free Software Foundation
+grants you additional permission to convey the resulting work.
+Corresponding Source for a non-source form of such a combination
+shall include the source code for the parts of OpenSSL used as well
+as that of the covered work.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..9ce9409
--- /dev/null
+++ b/README.md
@@ -0,0 +1,33 @@
+# The NCBI SRA (Sequence Read Archive)
+
+### Contact:
+email: sra-tools at ncbi.nlm.nih.gov
+or visit the [SRA Tools web site](http://www.ncbi.nlm.nih.gov/Traces/sra/?view=toolkit_doc)
+
+### Download
+Visit our [download page](https://github.com/ncbi/sra-tools/wiki/Downloads) for pre-built binaries.
+
+## The SRA Toolkit
+The SRA Toolkit and SDK from NCBI is a collection of tools and libraries for
+using data in the INSDC Sequence Read Archives.
+
+Much of the data submitted these days contain alignment information, for example
+in BAM, Illumina export.txt, and Complete Genomics formats. With aligned data,
+NCBI uses Compression by Reference, which only stores the differences in base
+pairs between sequence data and the segment it aligns to.  The process to
+restore original data, for example as FastQ, requires fast access to the
+reference sequences that the original data was aligned to.  NCBI recommends that
+SRA users dedicate local disk space to store references downloaded from the NCBI
+SRA site.  As of Fall 2014, the complete collection of these reference sequences
+is 66 GB.  While it isn't usually necessary to download the entirety of the
+reference sequences, this should give you an idea of the scale of the storage
+requirement.  By default, the Toolkit will download missing reference sequences
+on demand and cache them in the user's home directory.  The location of this
+cache is configurable, as is whether the download is automatic or manual.
+
+For additional information on using, configuring, and building the toolkit,
+please visit our [wiki](https://github.com/ncbi/sra-tools/wiki)
+or our web site at [NCBI](http://www.ncbi.nlm.nih.gov/Traces/sra/?view=toolkit_doc&f=std)
+
+
+SRA Toolkit Development Team
diff --git a/USAGE b/USAGE
new file mode 100644
index 0000000..148122e
--- /dev/null
+++ b/USAGE
@@ -0,0 +1,162 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+The NCBI SRA ( Sequence Read Archive ) Toolkit
+
+
+Contact: sra-tools at ncbi.nlm.nih.gov
+http://trace.ncbi.nlm.nih.gov/Traces/sra/sra.cgi?view=software
+
+
+For preliminary documentation on tool usage, consult the files within
+the "help" directory.
+
+
+CHANGES:
+
+SRA Toolkit includes new features in sam-dump tool and vdb-dump tools.  
+
+Sam-dump now supports slicing across multiple sequences, and dumping cSRA files to fasta and fastq formats. In addition, sam-dump has three new parameters
+-=|--hide-identical              Output '=' if base is identical to reference
+--gzip                           Compress output using gzip
+--bzip2                          Compress output using bzip2
+
+vdb-dump has two new parameters
+-o|--column_enum_short           enumerates columns in short form
+-b|--boolean                     defines how boolean's are printed (1,T)
+
+We have combined the functionality of two scripts, config-assistant.perl and reference-assistant.perl into a single script, configuration-assistant.perl that helps users download the correct references for a given cSRA file and configure the user environment for the SRA Toolkit.
+
+DESCRIPTION:
+
+ This release includes tools for reading the SRA archive, generally
+ by converting individual runs into some commonly used format such as
+ fastq. Support for NCBI's Compression by Reference is also included.
+
+ "Linux" binaries have been created on CentOS and SuSE Linux
+ distributions. They are not guaranteed to work on other
+ distributions. In particular, the version of libc.so should be
+ compatible. They are specific to the x86-family architectures.
+
+ "Windows" binaries have been created using MSVC's (not Cygwin)
+ tools. This release includes Win32 binaries. The "*-load" tools
+ are not released for "Windows".
+
+ "Mac OS X" binaries are available for the x86-family
+ architectures. They will NOT run on PPC Macs. The 64-bit binaries
+ will run only on OS 10.6. The 32-bit binaries should run on either
+ 10.5 or later.
+
+
+CONTENTS:
+
+ "abi-dump"            - dump ABI color-space runs into their native format
+ "abi-load"            - load ABI color-space runs
+ "fastq-dump"          - dump any run of any platform in FASTQ format
+ "fastq-load"          - load FASTQ runs
+ "helicos-load"        - load HELICOS runs
+ "illumina-dump"       - dump Illumina runs into their native format
+ "illumina-load"       - load Illumina native runs
+ "kar"                 - an archive extraction tool for .sra files
+ "kdbmeta"             - display the contents of one or more metadata stores
+ "rcexplain"           - print out error string for return codes (RC)
+ "refseq-load"         - ( NEW for Linux and Mac ) download a reference
+                         sequence object
+ "sff-dump"            - dump 454 runs into SFF format
+ "sff-load"            - load 454 SFF runs
+ "sra-dbcc"            - check SRA runs
+ "sra-dump"            - dump any run in a textual format [see note below]
+ "sra-kar"             - creates a single file archive from an SRA run
+ "sra-stat"            - display run column statistics
+ "srf-load"            - load SRF runs
+ "sam-dump"            - dump a cSRA into the SAM-format
+ "vdb-copy"            - copy SRA objects
+ "vdb-dump"            - display SRA objects in a textual format [see note below]
+ "vdb-lock"            - lock an object against modification
+ "vdb-unlock"          - unlock an object
+ "align-info"          - displays which references a csra-archive uses
+ "vdb-config"          - displays the configuration
+
+
+NOTES:
+
+ The "sam-dump" tool only works on cSRA's. ( See README-csra )
+ The textual dumpers "sra-dump" and "vdb-dump" are provided in this
+ release as an aid in visual inspection. It is likely that their
+ actual output formatting will be changed in the near future to a
+ stricter, more formalized representation[s].
+
+ The "help" information will be improved in near future releases, and
+ the tool options will become standardized across the set. We will
+ also be providing documentation on our web site.
+
+ Tool options may change in the next release. Version 1 tool options
+ will remain supported wherever possible in order to preserve
+ operation of any existing scripts.
+
+
+CAVEATS:
+
+ SRA tools are designed to handle very large amounts of data, and are
+ not currently oriented toward desktop use. They work well within any
+ Unix-like environment, such as Linux or MacOS's BSD shell.
+
+ Windows operation presents a few challenges. We have tested our
+ binaries under the MS "cmd.exe" shell and Cygwin's bash. Our tools
+ know how to accept paths in Windows, Cygwin, POSIX and MinGW
+ formats. Internally, all paths are treated as MinGW-style POSIX
+ paths, so any information appearing in output will reflect this
+ conversion:
+
+   # simple file names
+   SRR012345.sra                   => [NO CHANGE]
+
+   # relative paths
+   win\SRR012345.sra               => win/SRR012345.sra
+
+   # full or drive-relative paths
+   C:\sra\win\SRR012345.sra        => /C/sra/win/SRR012345.sra
+
+   # network paths
+   \\server\sra\SRR012345.sra      => //server/sra/SRR012345.sra
+
+   # POSIX paths
+   /sra/posix/SRR012345.sra        => [NO CHANGE]
+
+   # Cygwin full paths
+   /cygdrive/C/sra/SRR012345.sra   => /C/sra/SRR012345.sra
+
+ There are some situations where the software may behave unexpectedly
+ due to path conversions. In particular, since Windows does not
+ conform to POSIX path conventions, there may be difficulties
+ combining network paths with non-network paths, explicitly or
+ implicitly. IF YOU HAVE PROBLEMS, we recommend mounting file servers
+ as network drives.
+
+ If you run the software under Cygwin, you should take care to use
+ either relative paths (those that do not begin with '/') or full
+ paths that start with "/cygdrive/". The reason is that Cygwin
+ provides its own path manipulation, but our tools are not aware of
+ which shell they are running under.
diff --git a/build/.gitignore b/build/.gitignore
new file mode 100644
index 0000000..797da11
--- /dev/null
+++ b/build/.gitignore
@@ -0,0 +1,5 @@
+.cvsignore
+RHOST* ARCH* BUILD* COMP* OUTDIR*
+STATIC
+LNKG.*
+Makefile.config*
\ No newline at end of file
diff --git a/build/BUILD.linux b/build/BUILD.linux
deleted file mode 100644
index 17640be..0000000
--- a/build/BUILD.linux
+++ /dev/null
@@ -1 +0,0 @@
-rel
diff --git a/build/BUILD.mac b/build/BUILD.mac
deleted file mode 100644
index 17640be..0000000
--- a/build/BUILD.mac
+++ /dev/null
@@ -1 +0,0 @@
-rel
diff --git a/build/BUILD.win b/build/BUILD.win
deleted file mode 100644
index 17640be..0000000
--- a/build/BUILD.win
+++ /dev/null
@@ -1 +0,0 @@
-rel
diff --git a/build/COMP.linux b/build/COMP.linux
deleted file mode 100644
index 90584dd..0000000
--- a/build/COMP.linux
+++ /dev/null
@@ -1 +0,0 @@
-gcc
diff --git a/build/COMP.mac b/build/COMP.mac
deleted file mode 100644
index 90584dd..0000000
--- a/build/COMP.mac
+++ /dev/null
@@ -1 +0,0 @@
-gcc
diff --git a/build/COMP.win b/build/COMP.win
deleted file mode 100644
index 86cc381..0000000
--- a/build/COMP.win
+++ /dev/null
@@ -1 +0,0 @@
-vc++
diff --git a/build/LNKG.linux b/build/LNKG.linux
deleted file mode 100644
index fa47d9e..0000000
--- a/build/LNKG.linux
+++ /dev/null
@@ -1 +0,0 @@
-stat
diff --git a/build/LNKG.mac b/build/LNKG.mac
deleted file mode 100644
index fa47d9e..0000000
--- a/build/LNKG.mac
+++ /dev/null
@@ -1 +0,0 @@
-stat
diff --git a/build/LNKG.win b/build/LNKG.win
deleted file mode 100644
index fa47d9e..0000000
--- a/build/LNKG.win
+++ /dev/null
@@ -1 +0,0 @@
-stat
diff --git a/build/MSVC/2010/.gitignore b/build/MSVC/2010/.gitignore
new file mode 100644
index 0000000..946f868
--- /dev/null
+++ b/build/MSVC/2010/.gitignore
@@ -0,0 +1,5 @@
+*.user
+*.suo
+*.sdf
+*.opensdf
+*.ipch
diff --git a/build/MSVC/2010/abi-dump.vcxproj b/build/MSVC/2010/abi-dump.vcxproj
new file mode 100644
index 0000000..772a068
--- /dev/null
+++ b/build/MSVC/2010/abi-dump.vcxproj
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <Import Project=".\exe-project.props" />
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-vdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="..\..\..\tools\sra-dump\abi.c" />
+    <ClCompile Include="..\..\..\tools\sra-dump\core.c" />
+    <ClCompile Include="..\..\..\tools\sra-dump\factory.c" />
+    <ClCompile Include="..\..\..\tools\sra-dump\fasta_dump.c" />
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{9DF843FA-AA45-4EB1-BB76-84342AED550C}</ProjectGuid>
+  </PropertyGroup>
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/align-info.vcxproj b/build/MSVC/2010/align-info.vcxproj
new file mode 100644
index 0000000..e8465f5
--- /dev/null
+++ b/build/MSVC/2010/align-info.vcxproj
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  
+  <Import Project=".\exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-vdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  
+  <ItemGroup>
+    <ClCompile Include="..\..\..\tools\align-info\align-info.c" />
+  </ItemGroup>
+  
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{A54C75F9-A609-4BEC-91AB-23F5119B62AE}</ProjectGuid>
+  </PropertyGroup>
+
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/cache-mgr.vcxproj b/build/MSVC/2010/cache-mgr.vcxproj
new file mode 100644
index 0000000..672f2c2
--- /dev/null
+++ b/build/MSVC/2010/cache-mgr.vcxproj
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  
+  <Import Project=".\exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-vdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+
+  <ItemGroup>
+    <ClCompile Include="..\..\..\tools\cache-mgr\cache-mgr.c" />
+  </ItemGroup>
+
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{9BFEB5F1-0101-48A6-82CD-CF5744E1EDF3}</ProjectGuid>
+  </PropertyGroup>
+
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/dll-project.props b/build/MSVC/2010/dll-project.props
new file mode 100644
index 0000000..8150a3b
--- /dev/null
+++ b/build/MSVC/2010/dll-project.props
@@ -0,0 +1,90 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">  
+
+  <Import Project="vdb-common.props" />
+  
+  <PropertyGroup Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <CharacterSet>Unicode</CharacterSet>
+    <TargetExt>.dll</TargetExt>
+    <OutDir>$(VDB_TARGET)\bin\</OutDir>
+    <IntDir>$(VDB_TARGET)\obj\$(ProjectName)\</IntDir>
+    <TargetName>$(ProjectName)</TargetName>
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  
+  <PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <UseDebugLibraries>false</UseDebugLibraries>
+  </PropertyGroup>
+  
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  
+  
+  <ItemDefinitionGroup>
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <CompileAsManaged>false</CompileAsManaged>
+      <MinimalRebuild>true</MinimalRebuild>
+      <DisableLanguageExtensions>false</DisableLanguageExtensions>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <DisableSpecificWarnings>4996;4101</DisableSpecificWarnings>
+      <AdditionalIncludeDirectories>$(NGS_ROOT);$(VDB_ROOT)libs/$(ProjectName)/win;$(VDB_ROOT)libs/$(ProjectName);$(VDB_ROOT)interfaces;$(VDB_ROOT)interfaces/os/win;$(VDB_ROOT)interfaces/cc/vc++;$(VDB_ROOT)interfaces/ext;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>NO_KRSRC;WINDOWS;_WIN32_WINNT=0x0502;_WINDOWS;_LIBRARY;__mod_name__=libs/$(ProjectName);__file_name__=%(Filename);__file_ext__=c;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+  </ItemDefinitionGroup>
+  
+  <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PreprocessorDefinitions>_DEBUGGING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>false</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+  </ItemDefinitionGroup>
+  
+  <ItemDefinitionGroup Condition="'$(Platform)'=='Win32'">
+    <ClCompile>
+      <AdditionalIncludeDirectories>$(VDB_ROOT)interfaces/cc/vc++/i386;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_ARCH_BITS=32;PKGNAME=win32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Platform)'=='x64'">
+    <ClCompile>
+      <AdditionalIncludeDirectories>$(VDB_ROOT)interfaces/cc/vc++/x86_64;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_ARCH_BITS=64;PKGNAME=win64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+  </ItemDefinitionGroup>
+  
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+  
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/exe-project.props b/build/MSVC/2010/exe-project.props
new file mode 100644
index 0000000..6a6c6cb
--- /dev/null
+++ b/build/MSVC/2010/exe-project.props
@@ -0,0 +1,104 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">  
+
+  <Import Project="vdb-common.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\kapp.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  
+  <PropertyGroup Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <UseDebugLibraries>false</UseDebugLibraries>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <UseDebugLibraries>false</UseDebugLibraries>
+  </PropertyGroup>
+  
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  
+  <PropertyGroup>
+    <TargetExt>.exe</TargetExt>
+    <OutDir>$(VDB_TARGET)\bin\</OutDir>
+    <IntDir>$(VDB_TARGET)\obj\$(ProjectName)\</IntDir>
+    <TargetName>$(ProjectName)</TargetName>
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  
+  <ItemDefinitionGroup>
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <CompileAsManaged>false</CompileAsManaged>
+      <MinimalRebuild>true</MinimalRebuild>
+      <DisableLanguageExtensions>false</DisableLanguageExtensions>
+      <AdditionalIncludeDirectories>$(NGS_ROOT);$(VDB_ROOT)libs/$(ProjectName)/win;$(VDB_ROOT)libs/$(ProjectName);$(VDB_ROOT)interfaces;$(VDB_ROOT)interfaces/os/win;$(VDB_ROOT)interfaces/cc/vc++;$(VDB_ROOT)interfaces/ext;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WINDOWS;__mod_name__=test/$(ProjectName);__file_name__=%(Filename);__file_ext__=c;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <DisableSpecificWarnings>4996;4101</DisableSpecificWarnings>
+    </ClCompile>
+    <Link>
+      <EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
+      <AdditionalDependencies>Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+    <PostBuildEvent>
+      <Command>del $(TargetDir)$(TargetName).lib
+del $(TargetDir)$(TargetName).exp</Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  
+  <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PreprocessorDefinitions>_DEBUGGING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>false</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+  </ItemDefinitionGroup>
+  
+  <ItemDefinitionGroup Condition="'$(Platform)'=='Win32'">
+    <ClCompile>
+      <AdditionalIncludeDirectories>$(VDB_ROOT)interfaces/cc/vc++/i386;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_ARCH_BITS=32;PKGNAME=win32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Platform)'=='x64'">
+    <ClCompile>
+      <AdditionalIncludeDirectories>$(VDB_ROOT)interfaces/cc/vc++/x86_64;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_ARCH_BITS=64;PKGNAME=win64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+  </ItemDefinitionGroup>
+  
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  
+  <ImportGroup Label="ExtensionTargets"/>
+
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/fastq-dump-ngs.vcxproj b/build/MSVC/2010/fastq-dump-ngs.vcxproj
new file mode 100644
index 0000000..35ed060
--- /dev/null
+++ b/build/MSVC/2010/fastq-dump-ngs.vcxproj
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  
+  <Import Project=".\exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-vdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ngs-c++.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(NGS_TARGET)bin\libngs-sdk.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>  
+  
+  <ItemGroup>
+    <ClCompile Include="..\..\..\tools\fastq-dump\args.cpp" />
+    <ClCompile Include="..\..\..\tools\fastq-dump\fastq-dump.cpp" />
+    <ClCompile Include="..\..\..\tools\fastq-dump\filters.cpp" />
+  </ItemGroup>
+
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{8DA91267-49B1-4696-AF9D-2A98B697167E}</ProjectGuid>
+  </PropertyGroup>
+  
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/fastq-dump.vcxproj b/build/MSVC/2010/fastq-dump.vcxproj
new file mode 100644
index 0000000..0326e61
--- /dev/null
+++ b/build/MSVC/2010/fastq-dump.vcxproj
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  
+  <Import Project=".\exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-vdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="..\..\..\tools\sra-dump\core.c" />
+    <ClCompile Include="..\..\..\tools\sra-dump\factory.c" />
+    <ClCompile Include="..\..\..\tools\sra-dump\fasta_dump.c" />
+    <ClCompile Include="..\..\..\tools\sra-dump\fastq.c" />
+  </ItemGroup>
+
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{2182DDEE-BE67-48FB-89BA-9EF23717C128}</ProjectGuid>
+  </PropertyGroup>
+
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/fastq-loader.vcxproj b/build/MSVC/2010/fastq-loader.vcxproj
new file mode 100644
index 0000000..c9fb8e9
--- /dev/null
+++ b/build/MSVC/2010/fastq-loader.vcxproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+
+  <Import Project=".\exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-wvdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\loader.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\load.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  
+  <ItemGroup>
+    <ClCompile Include="..\..\..\tools\fastq-loader\fastq-grammar.c" />
+    <ClCompile Include="..\..\..\tools\fastq-loader\fastq-lex.c" />
+    <ClCompile Include="..\..\..\tools\fastq-loader\fastq-loader.c" />
+    <ClCompile Include="..\..\..\tools\fastq-loader\fastq-reader.c" />
+    <ClCompile Include="..\..\..\tools\fastq-loader\loader-imp.c" />
+  </ItemGroup>
+  
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{D5EDA47B-AD5A-4C2A-BDBB-EA29C61749E4}</ProjectGuid>
+  </PropertyGroup>
+
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/illumina-diump.vcxproj b/build/MSVC/2010/illumina-diump.vcxproj
new file mode 100644
index 0000000..2c9a79a
--- /dev/null
+++ b/build/MSVC/2010/illumina-diump.vcxproj
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+
+  <Import Project=".\exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-vdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+
+  <ItemGroup>
+    <ClCompile Include="..\..\..\tools\sra-dump\core.c" />
+    <ClCompile Include="..\..\..\tools\sra-dump\factory.c" />
+    <ClCompile Include="..\..\..\tools\sra-dump\fasta_dump.c" />
+    <ClCompile Include="..\..\..\tools\sra-dump\illumina.c" />
+  </ItemGroup>
+  
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{0D7E1861-6A3C-4CF3-B603-39BF841C3C82}</ProjectGuid>
+  </PropertyGroup>
+
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/kar.vcxproj b/build/MSVC/2010/kar.vcxproj
new file mode 100644
index 0000000..a102266
--- /dev/null
+++ b/build/MSVC/2010/kar.vcxproj
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  
+  <Import Project=".\exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-vdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  
+   <ItemGroup>
+    <ClCompile Include="..\..\..\tools\kar\kar.c" />
+  </ItemGroup>
+  
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{E832EEE9-7EC4-4CC0-A0B4-FE65404D012D}</ProjectGuid>
+  </PropertyGroup>
+
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/kdbmeta.vcxproj b/build/MSVC/2010/kdbmeta.vcxproj
new file mode 100644
index 0000000..b31f4b0
--- /dev/null
+++ b/build/MSVC/2010/kdbmeta.vcxproj
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+
+  <Import Project=".\exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-wvdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  
+   <ItemGroup>
+    <ClCompile Include="..\..\..\tools\util\kdbmeta.c" />
+  </ItemGroup>
+  
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{D2B898E3-DDBB-4704-A932-AED218DABE18}</ProjectGuid>
+  </PropertyGroup>
+
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/lib-project.props b/build/MSVC/2010/lib-project.props
new file mode 100644
index 0000000..3b2d729
--- /dev/null
+++ b/build/MSVC/2010/lib-project.props
@@ -0,0 +1,96 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">  
+
+  <Import Project="vdb-common.props" />
+  
+  <PropertyGroup Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <CharacterSet>Unicode</CharacterSet>
+    <TargetExt>.lib</TargetExt>
+  </PropertyGroup>
+  
+  <PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
+    <WholeProgramOptimization>false</WholeProgramOptimization>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <UseDebugLibraries>false</UseDebugLibraries>
+  </PropertyGroup>
+  
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  
+  <ImportGroup Label="ExtensionSettings" />
+  
+  <ImportGroup Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  
+  <PropertyGroup Label="UserMacros" />
+  
+  <PropertyGroup>
+    <TargetExt>.lib</TargetExt>
+    <OutDir>$(VDB_TARGET)\lib\</OutDir>
+    <IntDir>$(VDB_TARGET)\obj\$(ProjectName)\</IntDir>
+    <TargetName>$(ProjectName)</TargetName>
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  
+  <ItemDefinitionGroup>
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <CompileAsManaged>false</CompileAsManaged>
+      <MinimalRebuild>true</MinimalRebuild>
+      <DisableLanguageExtensions>false</DisableLanguageExtensions>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <DisableSpecificWarnings>4996;4101</DisableSpecificWarnings>
+      <AdditionalIncludeDirectories>$(NGS_ROOT);$(VDB_ROOT)libs/$(ProjectName)/win;$(VDB_ROOT)libs/$(ProjectName);$(VDB_ROOT)interfaces;$(VDB_ROOT)interfaces/os/win;$(VDB_ROOT)interfaces/cc/vc++;$(VDB_ROOT)interfaces/ext;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>NO_KRSRC;_WIN32_WINNT=0x0502;WINDOWS;_WINDOWS;_LIBRARY;__mod_name__=libs/$(ProjectName);__file_name__=%(Filename);__file_ext__=c;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
+    </Link>
+  </ItemDefinitionGroup>
+  
+  <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PreprocessorDefinitions>_DEBUGGING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>false</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+  </ItemDefinitionGroup>
+  
+  <ItemDefinitionGroup Condition="'$(Platform)'=='Win32'">
+    <ClCompile>
+      <AdditionalIncludeDirectories>$(VDB_ROOT)interfaces/cc/vc++/i386;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_ARCH_BITS=32;PKGNAME=win32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Platform)'=='x64'">
+    <ClCompile>
+      <AdditionalIncludeDirectories>$(VDB_ROOT)interfaces/cc/vc++/x86_64;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_ARCH_BITS=64;PKGNAME=win64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+  </ItemDefinitionGroup>
+  
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  
+  <ImportGroup Label="ExtensionTargets" />
+  
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/md5cp.vcxproj b/build/MSVC/2010/md5cp.vcxproj
new file mode 100644
index 0000000..34c2cc9
--- /dev/null
+++ b/build/MSVC/2010/md5cp.vcxproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <Import Project=".\exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-vdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  
+   <ItemGroup>
+    <ClCompile Include="..\..\..\tools\util\md5cp.c" />
+  </ItemGroup>
+  
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{F14519B5-5698-4363-A734-229F2A01153D}</ProjectGuid>
+  </PropertyGroup>
+
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/prefetch.vcxproj b/build/MSVC/2010/prefetch.vcxproj
new file mode 100644
index 0000000..6f5696f
--- /dev/null
+++ b/build/MSVC/2010/prefetch.vcxproj
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  
+  <Import Project=".\exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-vdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  
+   <ItemGroup>
+    <ClCompile Include="..\..\..\tools\prefetch\prefetch.c" />
+  </ItemGroup>
+  
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{2CF4BF04-4C4D-442E-A7AD-0AE5EF87C733}</ProjectGuid>
+  </PropertyGroup>
+
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/qual-recalib-stat.vcxproj b/build/MSVC/2010/qual-recalib-stat.vcxproj
new file mode 100644
index 0000000..64ef153
--- /dev/null
+++ b/build/MSVC/2010/qual-recalib-stat.vcxproj
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  
+  <Import Project=".\exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-wvdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  
+   <ItemGroup>
+    <ClCompile Include="..\..\..\tools\qual-recalib-stat\columns.c" />
+    <ClCompile Include="..\..\..\tools\qual-recalib-stat\context.c" />
+    <ClCompile Include="..\..\..\tools\qual-recalib-stat\namelist_tools.c" />
+    <ClCompile Include="..\..\..\tools\qual-recalib-stat\num-gen.c" />
+    <ClCompile Include="..\..\..\tools\qual-recalib-stat\progressbar.c" />
+    <ClCompile Include="..\..\..\tools\qual-recalib-stat\qual-recalib-stat.c" />
+    <ClCompile Include="..\..\..\tools\qual-recalib-stat\reader.c" />
+    <ClCompile Include="..\..\..\tools\qual-recalib-stat\ref_exclude.c" />
+    <ClCompile Include="..\..\..\tools\qual-recalib-stat\spot_position.c" />
+    <ClCompile Include="..\..\..\tools\qual-recalib-stat\stat_mod_2.c" />
+    <ClCompile Include="..\..\..\tools\qual-recalib-stat\writer.c" />
+  </ItemGroup>
+  
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{4AF84403-70C6-4479-A701-D735E7003505}</ProjectGuid>
+  </PropertyGroup>
+
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/rcexplain.vcxproj b/build/MSVC/2010/rcexplain.vcxproj
new file mode 100644
index 0000000..0d1c3c3
--- /dev/null
+++ b/build/MSVC/2010/rcexplain.vcxproj
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  
+  <Import Project=".\exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-vdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  
+   <ItemGroup>
+    <ClCompile Include="..\..\..\tools\util\rcexplain.c" />
+  </ItemGroup>
+  
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{799ECD99-5336-4322-B845-279B7D4B8D71}</ProjectGuid>
+  </PropertyGroup>
+  
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/read-filter-redact.vcxproj b/build/MSVC/2010/read-filter-redact.vcxproj
new file mode 100644
index 0000000..e1d65d8
--- /dev/null
+++ b/build/MSVC/2010/read-filter-redact.vcxproj
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  
+  <Import Project=".\exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-wvdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  
+   <ItemGroup>
+    <ClCompile Include="..\..\..\tools\rd-filter-redact\read-filter-redact.c" />
+  </ItemGroup>
+  
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{B7C166D7-2B45-4E77-A608-DDBD0B588082}</ProjectGuid>
+  </PropertyGroup>
+
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/sam-dump.vcxproj b/build/MSVC/2010/sam-dump.vcxproj
new file mode 100644
index 0000000..7063499
--- /dev/null
+++ b/build/MSVC/2010/sam-dump.vcxproj
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  
+  <Import Project=".\exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-vdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+ 
+  <ItemGroup>
+    <ClCompile Include="..\..\..\tools\sra-pileup\cg_tools.c" />
+    <ClCompile Include="..\..\..\tools\sra-pileup\inputfiles.c" />
+    <ClCompile Include="..\..\..\tools\sra-pileup\matecache.c" />
+    <ClCompile Include="..\..\..\tools\sra-pileup\out_redir.c" />
+    <ClCompile Include="..\..\..\tools\sra-pileup\perf_log.c" />
+    <ClCompile Include="..\..\..\tools\sra-pileup\read_fkt.c" />
+    <ClCompile Include="..\..\..\tools\sra-pileup\rna_splice_log.c" />
+    <ClCompile Include="..\..\..\tools\sra-pileup\sam-aligned.c" />
+    <ClCompile Include="..\..\..\tools\sra-pileup\sam-dump-opts.c" />
+    <ClCompile Include="..\..\..\tools\sra-pileup\sam-dump.c" />
+    <ClCompile Include="..\..\..\tools\sra-pileup\sam-dump3.c" />
+    <ClCompile Include="..\..\..\tools\sra-pileup\sam-hdr.c" />
+    <ClCompile Include="..\..\..\tools\sra-pileup\sam-unaligned.c" />
+  </ItemGroup>
+  
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{E7FAF31B-CA59-4E70-979F-E869EB45ABA0}</ProjectGuid>
+  </PropertyGroup>
+
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/schema-replace.vcxproj b/build/MSVC/2010/schema-replace.vcxproj
new file mode 100644
index 0000000..f665894
--- /dev/null
+++ b/build/MSVC/2010/schema-replace.vcxproj
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+ 
+ <Import Project=".\exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-wvdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  
+   <ItemGroup>
+    <ClCompile Include="..\..\..\tools\util\schema-replace.c" />
+  </ItemGroup>
+  
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{75A32DEA-9C0C-40CE-AE8C-CA58BAD4ADFD}</ProjectGuid>
+  </PropertyGroup>
+
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/sff-dump.vcxproj b/build/MSVC/2010/sff-dump.vcxproj
new file mode 100644
index 0000000..a6a1618
--- /dev/null
+++ b/build/MSVC/2010/sff-dump.vcxproj
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  
+  <Import Project=".\exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-vdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  
+   <ItemGroup>
+    <ClCompile Include="..\..\..\tools\sra-dump\core.c" />
+    <ClCompile Include="..\..\..\tools\sra-dump\factory.c" />
+    <ClCompile Include="..\..\..\tools\sra-dump\fasta_dump.c" />
+    <ClCompile Include="..\..\..\tools\sra-dump\sff.c" />
+  </ItemGroup>
+  
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{11616A3B-9C1F-4760-AE77-755E06D5DFB1}</ProjectGuid>
+  </PropertyGroup>
+
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/sra-kar.vcxproj b/build/MSVC/2010/sra-kar.vcxproj
new file mode 100644
index 0000000..b4c44d5
--- /dev/null
+++ b/build/MSVC/2010/sra-kar.vcxproj
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  
+  <Import Project=".\exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-vdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  
+   <ItemGroup>
+    <ClCompile Include="..\..\..\tools\kar\sra-kar.c" />
+  </ItemGroup>
+  
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{99FEB5EB-C150-4634-85AC-780082753D42}</ProjectGuid>
+  </PropertyGroup>
+  
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/sra-pileup.vcxproj b/build/MSVC/2010/sra-pileup.vcxproj
new file mode 100644
index 0000000..4623dfd
--- /dev/null
+++ b/build/MSVC/2010/sra-pileup.vcxproj
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  
+  <Import Project=".\exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-vdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  
+   <ItemGroup>
+    <ClCompile Include="..\..\..\tools\sra-pileup\4na_ascii.c" />
+    <ClCompile Include="..\..\..\tools\sra-pileup\cg_tools.c" />
+    <ClCompile Include="..\..\..\tools\sra-pileup\cmdline_cmn.c" />
+    <ClCompile Include="..\..\..\tools\sra-pileup\dyn_string.c" />
+    <ClCompile Include="..\..\..\tools\sra-pileup\perf_log.c" />
+    <ClCompile Include="..\..\..\tools\sra-pileup\pileup_counters.c" />
+    <ClCompile Include="..\..\..\tools\sra-pileup\pileup_index.c" />
+    <ClCompile Include="..\..\..\tools\sra-pileup\pileup_stat.c" />
+    <ClCompile Include="..\..\..\tools\sra-pileup\pileup_v2.c" />
+    <ClCompile Include="..\..\..\tools\sra-pileup\pileup_varcount.c" />
+    <ClCompile Include="..\..\..\tools\sra-pileup\ref_regions.c" />
+    <ClCompile Include="..\..\..\tools\sra-pileup\ref_walker.c" />
+    <ClCompile Include="..\..\..\tools\sra-pileup\ref_walker_0.c" />
+    <ClCompile Include="..\..\..\tools\sra-pileup\report_deletes.c" />
+    <ClCompile Include="..\..\..\tools\sra-pileup\reref.c" />
+    <ClCompile Include="..\..\..\tools\sra-pileup\sra-pileup.c" />
+    <ClCompile Include="..\..\..\tools\sra-pileup\walk_debug.c" />
+  </ItemGroup>
+  
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{9112BE22-FE04-407B-8B3B-9D7C3731E39A}</ProjectGuid>
+  </PropertyGroup>
+
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/sra-stat.vcxproj b/build/MSVC/2010/sra-stat.vcxproj
new file mode 100644
index 0000000..6a3fa84
--- /dev/null
+++ b/build/MSVC/2010/sra-stat.vcxproj
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  
+  <Import Project=".\exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-vdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  
+  <ItemGroup>
+    <ClCompile Include="..\..\..\tools\sra-stat\sra-stat.c" />
+  </ItemGroup>
+  
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{88A9A91A-4BC3-47EA-8147-944FD4909C6D}</ProjectGuid>
+  </PropertyGroup>
+  
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/sra-tools.sln b/build/MSVC/2010/sra-tools.sln
new file mode 100644
index 0000000..9320790
--- /dev/null
+++ b/build/MSVC/2010/sra-tools.sln
@@ -0,0 +1,336 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rcexplain", "rcexplain.vcxproj", "{799ECD99-5336-4322-B845-279B7D4B8D71}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "md5cp", "md5cp.vcxproj", "{F14519B5-5698-4363-A734-229F2A01153D}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test-sra", "test-sra.vcxproj", "{11C2E25B-2CD2-4826-A574-637AD10BAAC3}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vdb-passwd", "vdb-passwd.vcxproj", "{ABA40306-1ACE-4E66-B7A9-74F14C47BDC7}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kar", "kar.vcxproj", "{E832EEE9-7EC4-4CC0-A0B4-FE65404D012D}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sra-kar", "sra-kar.vcxproj", "{99FEB5EB-C150-4634-85AC-780082753D42}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vdb-dump", "vdb-dump.vcxproj", "{5E85344A-92C9-4407-8A76-1EF0C8AB0D60}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fastq-dump", "fastq-dump.vcxproj", "{2182DDEE-BE67-48FB-89BA-9EF23717C128}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sff-dump", "sff-dump.vcxproj", "{11616A3B-9C1F-4760-AE77-755E06D5DFB1}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "illumina-diump", "illumina-diump.vcxproj", "{0D7E1861-6A3C-4CF3-B603-39BF841C3C82}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "abi-dump", "abi-dump.vcxproj", "{9DF843FA-AA45-4EB1-BB76-84342AED550C}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fastq-dump-ngs", "fastq-dump-ngs.vcxproj", "{8DA91267-49B1-4696-AF9D-2A98B697167E}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kdbmeta", "kdbmeta.vcxproj", "{D2B898E3-DDBB-4704-A932-AED218DABE18}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vdb-lock", "vdb-lock.vcxproj", "{4779D671-B464-4C6E-8875-CDA2081957F0}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vdb-unlock", "vdb-unlock.vcxproj", "{452802EF-A059-4A4C-8106-ADF652ED1E1C}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "schema-replace", "schema-replace.vcxproj", "{75A32DEA-9C0C-40CE-AE8C-CA58BAD4ADFD}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sra-pileup", "sra-pileup.vcxproj", "{9112BE22-FE04-407B-8B3B-9D7C3731E39A}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sam-dump", "sam-dump.vcxproj", "{E7FAF31B-CA59-4E70-979F-E869EB45ABA0}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fastq-loader", "fastq-loader.vcxproj", "{D5EDA47B-AD5A-4C2A-BDBB-EA29C61749E4}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "srapath", "srapath.vcxproj", "{779C36A1-2592-469C-93A1-60C0B79BA529}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sra-stat", "sra-stat.vcxproj", "{88A9A91A-4BC3-47EA-8147-944FD4909C6D}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vdb-copy", "vdb-copy.vcxproj", "{639D1E21-0C0C-4846-A71D-68DB7752833A}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "read-filter-redact", "read-filter-redact.vcxproj", "{B7C166D7-2B45-4E77-A608-DDBD0B588082}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vdb-config", "vdb-config.vcxproj", "{7CAB9840-19BB-4B32-94BD-C29701FDBE88}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "align-info", "align-info.vcxproj", "{A54C75F9-A609-4BEC-91AB-23F5119B62AE}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qual-recalib-stat", "qual-recalib-stat.vcxproj", "{4AF84403-70C6-4479-A701-D735E7003505}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "prefetch", "prefetch.vcxproj", "{2CF4BF04-4C4D-442E-A7AD-0AE5EF87C733}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vdb-decrypt", "vdb-decrypt.vcxproj", "{E4824F7B-4698-4F9B-85B1-AEFD6A81F957}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vdb-encrypt", "vdb-encrypt.vcxproj", "{03E85236-7CD9-4D6B-95FA-767935F8081D}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vdb-validate", "vdb-validate.vcxproj", "{446C2DD3-36B3-4B27-8415-951F98346E99}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cache-mgr", "cache-mgr.vcxproj", "{9BFEB5F1-0101-48A6-82CD-CF5744E1EDF3}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vcf-loader", "vcf-loader.vcxproj", "{DA226775-67B1-4354-A5CA-7F5406E0B1E7}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Debug|x64 = Debug|x64
+		Release|Win32 = Release|Win32
+		Release|x64 = Release|x64
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{799ECD99-5336-4322-B845-279B7D4B8D71}.Debug|Win32.ActiveCfg = Debug|Win32
+		{799ECD99-5336-4322-B845-279B7D4B8D71}.Debug|Win32.Build.0 = Debug|Win32
+		{799ECD99-5336-4322-B845-279B7D4B8D71}.Debug|x64.ActiveCfg = Debug|x64
+		{799ECD99-5336-4322-B845-279B7D4B8D71}.Debug|x64.Build.0 = Debug|x64
+		{799ECD99-5336-4322-B845-279B7D4B8D71}.Release|Win32.ActiveCfg = Release|Win32
+		{799ECD99-5336-4322-B845-279B7D4B8D71}.Release|Win32.Build.0 = Release|Win32
+		{799ECD99-5336-4322-B845-279B7D4B8D71}.Release|x64.ActiveCfg = Release|x64
+		{799ECD99-5336-4322-B845-279B7D4B8D71}.Release|x64.Build.0 = Release|x64
+		{F14519B5-5698-4363-A734-229F2A01153D}.Debug|Win32.ActiveCfg = Debug|Win32
+		{F14519B5-5698-4363-A734-229F2A01153D}.Debug|Win32.Build.0 = Debug|Win32
+		{F14519B5-5698-4363-A734-229F2A01153D}.Debug|x64.ActiveCfg = Debug|x64
+		{F14519B5-5698-4363-A734-229F2A01153D}.Debug|x64.Build.0 = Debug|x64
+		{F14519B5-5698-4363-A734-229F2A01153D}.Release|Win32.ActiveCfg = Release|Win32
+		{F14519B5-5698-4363-A734-229F2A01153D}.Release|Win32.Build.0 = Release|Win32
+		{F14519B5-5698-4363-A734-229F2A01153D}.Release|x64.ActiveCfg = Release|x64
+		{F14519B5-5698-4363-A734-229F2A01153D}.Release|x64.Build.0 = Release|x64
+		{11C2E25B-2CD2-4826-A574-637AD10BAAC3}.Debug|Win32.ActiveCfg = Debug|Win32
+		{11C2E25B-2CD2-4826-A574-637AD10BAAC3}.Debug|Win32.Build.0 = Debug|Win32
+		{11C2E25B-2CD2-4826-A574-637AD10BAAC3}.Debug|x64.ActiveCfg = Debug|x64
+		{11C2E25B-2CD2-4826-A574-637AD10BAAC3}.Debug|x64.Build.0 = Debug|x64
+		{11C2E25B-2CD2-4826-A574-637AD10BAAC3}.Release|Win32.ActiveCfg = Release|Win32
+		{11C2E25B-2CD2-4826-A574-637AD10BAAC3}.Release|Win32.Build.0 = Release|Win32
+		{11C2E25B-2CD2-4826-A574-637AD10BAAC3}.Release|x64.ActiveCfg = Release|x64
+		{11C2E25B-2CD2-4826-A574-637AD10BAAC3}.Release|x64.Build.0 = Release|x64
+		{ABA40306-1ACE-4E66-B7A9-74F14C47BDC7}.Debug|Win32.ActiveCfg = Debug|Win32
+		{ABA40306-1ACE-4E66-B7A9-74F14C47BDC7}.Debug|Win32.Build.0 = Debug|Win32
+		{ABA40306-1ACE-4E66-B7A9-74F14C47BDC7}.Debug|x64.ActiveCfg = Debug|x64
+		{ABA40306-1ACE-4E66-B7A9-74F14C47BDC7}.Debug|x64.Build.0 = Debug|x64
+		{ABA40306-1ACE-4E66-B7A9-74F14C47BDC7}.Release|Win32.ActiveCfg = Release|Win32
+		{ABA40306-1ACE-4E66-B7A9-74F14C47BDC7}.Release|Win32.Build.0 = Release|Win32
+		{ABA40306-1ACE-4E66-B7A9-74F14C47BDC7}.Release|x64.ActiveCfg = Release|x64
+		{ABA40306-1ACE-4E66-B7A9-74F14C47BDC7}.Release|x64.Build.0 = Release|x64
+		{E832EEE9-7EC4-4CC0-A0B4-FE65404D012D}.Debug|Win32.ActiveCfg = Debug|Win32
+		{E832EEE9-7EC4-4CC0-A0B4-FE65404D012D}.Debug|Win32.Build.0 = Debug|Win32
+		{E832EEE9-7EC4-4CC0-A0B4-FE65404D012D}.Debug|x64.ActiveCfg = Debug|x64
+		{E832EEE9-7EC4-4CC0-A0B4-FE65404D012D}.Debug|x64.Build.0 = Debug|x64
+		{E832EEE9-7EC4-4CC0-A0B4-FE65404D012D}.Release|Win32.ActiveCfg = Release|Win32
+		{E832EEE9-7EC4-4CC0-A0B4-FE65404D012D}.Release|Win32.Build.0 = Release|Win32
+		{E832EEE9-7EC4-4CC0-A0B4-FE65404D012D}.Release|x64.ActiveCfg = Release|x64
+		{E832EEE9-7EC4-4CC0-A0B4-FE65404D012D}.Release|x64.Build.0 = Release|x64
+		{99FEB5EB-C150-4634-85AC-780082753D42}.Debug|Win32.ActiveCfg = Debug|Win32
+		{99FEB5EB-C150-4634-85AC-780082753D42}.Debug|Win32.Build.0 = Debug|Win32
+		{99FEB5EB-C150-4634-85AC-780082753D42}.Debug|x64.ActiveCfg = Debug|x64
+		{99FEB5EB-C150-4634-85AC-780082753D42}.Debug|x64.Build.0 = Debug|x64
+		{99FEB5EB-C150-4634-85AC-780082753D42}.Release|Win32.ActiveCfg = Release|Win32
+		{99FEB5EB-C150-4634-85AC-780082753D42}.Release|Win32.Build.0 = Release|Win32
+		{99FEB5EB-C150-4634-85AC-780082753D42}.Release|x64.ActiveCfg = Release|x64
+		{99FEB5EB-C150-4634-85AC-780082753D42}.Release|x64.Build.0 = Release|x64
+		{5E85344A-92C9-4407-8A76-1EF0C8AB0D60}.Debug|Win32.ActiveCfg = Debug|Win32
+		{5E85344A-92C9-4407-8A76-1EF0C8AB0D60}.Debug|Win32.Build.0 = Debug|Win32
+		{5E85344A-92C9-4407-8A76-1EF0C8AB0D60}.Debug|x64.ActiveCfg = Debug|x64
+		{5E85344A-92C9-4407-8A76-1EF0C8AB0D60}.Debug|x64.Build.0 = Debug|x64
+		{5E85344A-92C9-4407-8A76-1EF0C8AB0D60}.Release|Win32.ActiveCfg = Release|Win32
+		{5E85344A-92C9-4407-8A76-1EF0C8AB0D60}.Release|Win32.Build.0 = Release|Win32
+		{5E85344A-92C9-4407-8A76-1EF0C8AB0D60}.Release|x64.ActiveCfg = Release|x64
+		{5E85344A-92C9-4407-8A76-1EF0C8AB0D60}.Release|x64.Build.0 = Release|x64
+		{2182DDEE-BE67-48FB-89BA-9EF23717C128}.Debug|Win32.ActiveCfg = Debug|Win32
+		{2182DDEE-BE67-48FB-89BA-9EF23717C128}.Debug|Win32.Build.0 = Debug|Win32
+		{2182DDEE-BE67-48FB-89BA-9EF23717C128}.Debug|x64.ActiveCfg = Debug|x64
+		{2182DDEE-BE67-48FB-89BA-9EF23717C128}.Debug|x64.Build.0 = Debug|x64
+		{2182DDEE-BE67-48FB-89BA-9EF23717C128}.Release|Win32.ActiveCfg = Release|Win32
+		{2182DDEE-BE67-48FB-89BA-9EF23717C128}.Release|Win32.Build.0 = Release|Win32
+		{2182DDEE-BE67-48FB-89BA-9EF23717C128}.Release|x64.ActiveCfg = Release|x64
+		{2182DDEE-BE67-48FB-89BA-9EF23717C128}.Release|x64.Build.0 = Release|x64
+		{11616A3B-9C1F-4760-AE77-755E06D5DFB1}.Debug|Win32.ActiveCfg = Debug|Win32
+		{11616A3B-9C1F-4760-AE77-755E06D5DFB1}.Debug|Win32.Build.0 = Debug|Win32
+		{11616A3B-9C1F-4760-AE77-755E06D5DFB1}.Debug|x64.ActiveCfg = Debug|x64
+		{11616A3B-9C1F-4760-AE77-755E06D5DFB1}.Debug|x64.Build.0 = Debug|x64
+		{11616A3B-9C1F-4760-AE77-755E06D5DFB1}.Release|Win32.ActiveCfg = Release|Win32
+		{11616A3B-9C1F-4760-AE77-755E06D5DFB1}.Release|Win32.Build.0 = Release|Win32
+		{11616A3B-9C1F-4760-AE77-755E06D5DFB1}.Release|x64.ActiveCfg = Release|x64
+		{11616A3B-9C1F-4760-AE77-755E06D5DFB1}.Release|x64.Build.0 = Release|x64
+		{0D7E1861-6A3C-4CF3-B603-39BF841C3C82}.Debug|Win32.ActiveCfg = Debug|Win32
+		{0D7E1861-6A3C-4CF3-B603-39BF841C3C82}.Debug|Win32.Build.0 = Debug|Win32
+		{0D7E1861-6A3C-4CF3-B603-39BF841C3C82}.Debug|x64.ActiveCfg = Debug|x64
+		{0D7E1861-6A3C-4CF3-B603-39BF841C3C82}.Debug|x64.Build.0 = Debug|x64
+		{0D7E1861-6A3C-4CF3-B603-39BF841C3C82}.Release|Win32.ActiveCfg = Release|Win32
+		{0D7E1861-6A3C-4CF3-B603-39BF841C3C82}.Release|Win32.Build.0 = Release|Win32
+		{0D7E1861-6A3C-4CF3-B603-39BF841C3C82}.Release|x64.ActiveCfg = Release|x64
+		{0D7E1861-6A3C-4CF3-B603-39BF841C3C82}.Release|x64.Build.0 = Release|x64
+		{9DF843FA-AA45-4EB1-BB76-84342AED550C}.Debug|Win32.ActiveCfg = Debug|Win32
+		{9DF843FA-AA45-4EB1-BB76-84342AED550C}.Debug|Win32.Build.0 = Debug|Win32
+		{9DF843FA-AA45-4EB1-BB76-84342AED550C}.Debug|x64.ActiveCfg = Debug|x64
+		{9DF843FA-AA45-4EB1-BB76-84342AED550C}.Debug|x64.Build.0 = Debug|x64
+		{9DF843FA-AA45-4EB1-BB76-84342AED550C}.Release|Win32.ActiveCfg = Release|Win32
+		{9DF843FA-AA45-4EB1-BB76-84342AED550C}.Release|Win32.Build.0 = Release|Win32
+		{9DF843FA-AA45-4EB1-BB76-84342AED550C}.Release|x64.ActiveCfg = Release|x64
+		{9DF843FA-AA45-4EB1-BB76-84342AED550C}.Release|x64.Build.0 = Release|x64
+		{8DA91267-49B1-4696-AF9D-2A98B697167E}.Debug|Win32.ActiveCfg = Debug|Win32
+		{8DA91267-49B1-4696-AF9D-2A98B697167E}.Debug|Win32.Build.0 = Debug|Win32
+		{8DA91267-49B1-4696-AF9D-2A98B697167E}.Debug|x64.ActiveCfg = Debug|x64
+		{8DA91267-49B1-4696-AF9D-2A98B697167E}.Debug|x64.Build.0 = Debug|x64
+		{8DA91267-49B1-4696-AF9D-2A98B697167E}.Release|Win32.ActiveCfg = Release|Win32
+		{8DA91267-49B1-4696-AF9D-2A98B697167E}.Release|Win32.Build.0 = Release|Win32
+		{8DA91267-49B1-4696-AF9D-2A98B697167E}.Release|x64.ActiveCfg = Release|x64
+		{8DA91267-49B1-4696-AF9D-2A98B697167E}.Release|x64.Build.0 = Release|x64
+		{D2B898E3-DDBB-4704-A932-AED218DABE18}.Debug|Win32.ActiveCfg = Debug|Win32
+		{D2B898E3-DDBB-4704-A932-AED218DABE18}.Debug|Win32.Build.0 = Debug|Win32
+		{D2B898E3-DDBB-4704-A932-AED218DABE18}.Debug|x64.ActiveCfg = Debug|x64
+		{D2B898E3-DDBB-4704-A932-AED218DABE18}.Debug|x64.Build.0 = Debug|x64
+		{D2B898E3-DDBB-4704-A932-AED218DABE18}.Release|Win32.ActiveCfg = Release|Win32
+		{D2B898E3-DDBB-4704-A932-AED218DABE18}.Release|Win32.Build.0 = Release|Win32
+		{D2B898E3-DDBB-4704-A932-AED218DABE18}.Release|x64.ActiveCfg = Release|x64
+		{D2B898E3-DDBB-4704-A932-AED218DABE18}.Release|x64.Build.0 = Release|x64
+		{4779D671-B464-4C6E-8875-CDA2081957F0}.Debug|Win32.ActiveCfg = Debug|Win32
+		{4779D671-B464-4C6E-8875-CDA2081957F0}.Debug|Win32.Build.0 = Debug|Win32
+		{4779D671-B464-4C6E-8875-CDA2081957F0}.Debug|x64.ActiveCfg = Debug|x64
+		{4779D671-B464-4C6E-8875-CDA2081957F0}.Debug|x64.Build.0 = Debug|x64
+		{4779D671-B464-4C6E-8875-CDA2081957F0}.Release|Win32.ActiveCfg = Release|Win32
+		{4779D671-B464-4C6E-8875-CDA2081957F0}.Release|Win32.Build.0 = Release|Win32
+		{4779D671-B464-4C6E-8875-CDA2081957F0}.Release|x64.ActiveCfg = Release|x64
+		{4779D671-B464-4C6E-8875-CDA2081957F0}.Release|x64.Build.0 = Release|x64
+		{452802EF-A059-4A4C-8106-ADF652ED1E1C}.Debug|Win32.ActiveCfg = Debug|Win32
+		{452802EF-A059-4A4C-8106-ADF652ED1E1C}.Debug|Win32.Build.0 = Debug|Win32
+		{452802EF-A059-4A4C-8106-ADF652ED1E1C}.Debug|x64.ActiveCfg = Debug|x64
+		{452802EF-A059-4A4C-8106-ADF652ED1E1C}.Debug|x64.Build.0 = Debug|x64
+		{452802EF-A059-4A4C-8106-ADF652ED1E1C}.Release|Win32.ActiveCfg = Release|Win32
+		{452802EF-A059-4A4C-8106-ADF652ED1E1C}.Release|Win32.Build.0 = Release|Win32
+		{452802EF-A059-4A4C-8106-ADF652ED1E1C}.Release|x64.ActiveCfg = Release|x64
+		{452802EF-A059-4A4C-8106-ADF652ED1E1C}.Release|x64.Build.0 = Release|x64
+		{75A32DEA-9C0C-40CE-AE8C-CA58BAD4ADFD}.Debug|Win32.ActiveCfg = Debug|Win32
+		{75A32DEA-9C0C-40CE-AE8C-CA58BAD4ADFD}.Debug|Win32.Build.0 = Debug|Win32
+		{75A32DEA-9C0C-40CE-AE8C-CA58BAD4ADFD}.Debug|x64.ActiveCfg = Debug|x64
+		{75A32DEA-9C0C-40CE-AE8C-CA58BAD4ADFD}.Debug|x64.Build.0 = Debug|x64
+		{75A32DEA-9C0C-40CE-AE8C-CA58BAD4ADFD}.Release|Win32.ActiveCfg = Release|Win32
+		{75A32DEA-9C0C-40CE-AE8C-CA58BAD4ADFD}.Release|Win32.Build.0 = Release|Win32
+		{75A32DEA-9C0C-40CE-AE8C-CA58BAD4ADFD}.Release|x64.ActiveCfg = Release|x64
+		{75A32DEA-9C0C-40CE-AE8C-CA58BAD4ADFD}.Release|x64.Build.0 = Release|x64
+		{9112BE22-FE04-407B-8B3B-9D7C3731E39A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{9112BE22-FE04-407B-8B3B-9D7C3731E39A}.Debug|Win32.Build.0 = Debug|Win32
+		{9112BE22-FE04-407B-8B3B-9D7C3731E39A}.Debug|x64.ActiveCfg = Debug|x64
+		{9112BE22-FE04-407B-8B3B-9D7C3731E39A}.Debug|x64.Build.0 = Debug|x64
+		{9112BE22-FE04-407B-8B3B-9D7C3731E39A}.Release|Win32.ActiveCfg = Release|Win32
+		{9112BE22-FE04-407B-8B3B-9D7C3731E39A}.Release|Win32.Build.0 = Release|Win32
+		{9112BE22-FE04-407B-8B3B-9D7C3731E39A}.Release|x64.ActiveCfg = Release|x64
+		{9112BE22-FE04-407B-8B3B-9D7C3731E39A}.Release|x64.Build.0 = Release|x64
+		{E7FAF31B-CA59-4E70-979F-E869EB45ABA0}.Debug|Win32.ActiveCfg = Debug|Win32
+		{E7FAF31B-CA59-4E70-979F-E869EB45ABA0}.Debug|Win32.Build.0 = Debug|Win32
+		{E7FAF31B-CA59-4E70-979F-E869EB45ABA0}.Debug|x64.ActiveCfg = Debug|x64
+		{E7FAF31B-CA59-4E70-979F-E869EB45ABA0}.Debug|x64.Build.0 = Debug|x64
+		{E7FAF31B-CA59-4E70-979F-E869EB45ABA0}.Release|Win32.ActiveCfg = Release|Win32
+		{E7FAF31B-CA59-4E70-979F-E869EB45ABA0}.Release|Win32.Build.0 = Release|Win32
+		{E7FAF31B-CA59-4E70-979F-E869EB45ABA0}.Release|x64.ActiveCfg = Release|x64
+		{E7FAF31B-CA59-4E70-979F-E869EB45ABA0}.Release|x64.Build.0 = Release|x64
+		{D5EDA47B-AD5A-4C2A-BDBB-EA29C61749E4}.Debug|Win32.ActiveCfg = Debug|Win32
+		{D5EDA47B-AD5A-4C2A-BDBB-EA29C61749E4}.Debug|Win32.Build.0 = Debug|Win32
+		{D5EDA47B-AD5A-4C2A-BDBB-EA29C61749E4}.Debug|x64.ActiveCfg = Debug|x64
+		{D5EDA47B-AD5A-4C2A-BDBB-EA29C61749E4}.Debug|x64.Build.0 = Debug|x64
+		{D5EDA47B-AD5A-4C2A-BDBB-EA29C61749E4}.Release|Win32.ActiveCfg = Release|Win32
+		{D5EDA47B-AD5A-4C2A-BDBB-EA29C61749E4}.Release|Win32.Build.0 = Release|Win32
+		{D5EDA47B-AD5A-4C2A-BDBB-EA29C61749E4}.Release|x64.ActiveCfg = Release|x64
+		{D5EDA47B-AD5A-4C2A-BDBB-EA29C61749E4}.Release|x64.Build.0 = Release|x64
+		{779C36A1-2592-469C-93A1-60C0B79BA529}.Debug|Win32.ActiveCfg = Debug|Win32
+		{779C36A1-2592-469C-93A1-60C0B79BA529}.Debug|Win32.Build.0 = Debug|Win32
+		{779C36A1-2592-469C-93A1-60C0B79BA529}.Debug|x64.ActiveCfg = Debug|x64
+		{779C36A1-2592-469C-93A1-60C0B79BA529}.Debug|x64.Build.0 = Debug|x64
+		{779C36A1-2592-469C-93A1-60C0B79BA529}.Release|Win32.ActiveCfg = Release|Win32
+		{779C36A1-2592-469C-93A1-60C0B79BA529}.Release|Win32.Build.0 = Release|Win32
+		{779C36A1-2592-469C-93A1-60C0B79BA529}.Release|x64.ActiveCfg = Release|x64
+		{779C36A1-2592-469C-93A1-60C0B79BA529}.Release|x64.Build.0 = Release|x64
+		{88A9A91A-4BC3-47EA-8147-944FD4909C6D}.Debug|Win32.ActiveCfg = Debug|Win32
+		{88A9A91A-4BC3-47EA-8147-944FD4909C6D}.Debug|Win32.Build.0 = Debug|Win32
+		{88A9A91A-4BC3-47EA-8147-944FD4909C6D}.Debug|x64.ActiveCfg = Debug|x64
+		{88A9A91A-4BC3-47EA-8147-944FD4909C6D}.Debug|x64.Build.0 = Debug|x64
+		{88A9A91A-4BC3-47EA-8147-944FD4909C6D}.Release|Win32.ActiveCfg = Release|Win32
+		{88A9A91A-4BC3-47EA-8147-944FD4909C6D}.Release|Win32.Build.0 = Release|Win32
+		{88A9A91A-4BC3-47EA-8147-944FD4909C6D}.Release|x64.ActiveCfg = Release|x64
+		{88A9A91A-4BC3-47EA-8147-944FD4909C6D}.Release|x64.Build.0 = Release|x64
+		{639D1E21-0C0C-4846-A71D-68DB7752833A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{639D1E21-0C0C-4846-A71D-68DB7752833A}.Debug|Win32.Build.0 = Debug|Win32
+		{639D1E21-0C0C-4846-A71D-68DB7752833A}.Debug|x64.ActiveCfg = Debug|x64
+		{639D1E21-0C0C-4846-A71D-68DB7752833A}.Debug|x64.Build.0 = Debug|x64
+		{639D1E21-0C0C-4846-A71D-68DB7752833A}.Release|Win32.ActiveCfg = Release|Win32
+		{639D1E21-0C0C-4846-A71D-68DB7752833A}.Release|Win32.Build.0 = Release|Win32
+		{639D1E21-0C0C-4846-A71D-68DB7752833A}.Release|x64.ActiveCfg = Release|x64
+		{639D1E21-0C0C-4846-A71D-68DB7752833A}.Release|x64.Build.0 = Release|x64
+		{B7C166D7-2B45-4E77-A608-DDBD0B588082}.Debug|Win32.ActiveCfg = Debug|Win32
+		{B7C166D7-2B45-4E77-A608-DDBD0B588082}.Debug|Win32.Build.0 = Debug|Win32
+		{B7C166D7-2B45-4E77-A608-DDBD0B588082}.Debug|x64.ActiveCfg = Debug|x64
+		{B7C166D7-2B45-4E77-A608-DDBD0B588082}.Debug|x64.Build.0 = Debug|x64
+		{B7C166D7-2B45-4E77-A608-DDBD0B588082}.Release|Win32.ActiveCfg = Release|Win32
+		{B7C166D7-2B45-4E77-A608-DDBD0B588082}.Release|Win32.Build.0 = Release|Win32
+		{B7C166D7-2B45-4E77-A608-DDBD0B588082}.Release|x64.ActiveCfg = Release|x64
+		{B7C166D7-2B45-4E77-A608-DDBD0B588082}.Release|x64.Build.0 = Release|x64
+		{7CAB9840-19BB-4B32-94BD-C29701FDBE88}.Debug|Win32.ActiveCfg = Debug|Win32
+		{7CAB9840-19BB-4B32-94BD-C29701FDBE88}.Debug|Win32.Build.0 = Debug|Win32
+		{7CAB9840-19BB-4B32-94BD-C29701FDBE88}.Debug|x64.ActiveCfg = Debug|x64
+		{7CAB9840-19BB-4B32-94BD-C29701FDBE88}.Debug|x64.Build.0 = Debug|x64
+		{7CAB9840-19BB-4B32-94BD-C29701FDBE88}.Release|Win32.ActiveCfg = Release|Win32
+		{7CAB9840-19BB-4B32-94BD-C29701FDBE88}.Release|Win32.Build.0 = Release|Win32
+		{7CAB9840-19BB-4B32-94BD-C29701FDBE88}.Release|x64.ActiveCfg = Release|x64
+		{7CAB9840-19BB-4B32-94BD-C29701FDBE88}.Release|x64.Build.0 = Release|x64
+		{A54C75F9-A609-4BEC-91AB-23F5119B62AE}.Debug|Win32.ActiveCfg = Debug|Win32
+		{A54C75F9-A609-4BEC-91AB-23F5119B62AE}.Debug|Win32.Build.0 = Debug|Win32
+		{A54C75F9-A609-4BEC-91AB-23F5119B62AE}.Debug|x64.ActiveCfg = Debug|x64
+		{A54C75F9-A609-4BEC-91AB-23F5119B62AE}.Debug|x64.Build.0 = Debug|x64
+		{A54C75F9-A609-4BEC-91AB-23F5119B62AE}.Release|Win32.ActiveCfg = Release|Win32
+		{A54C75F9-A609-4BEC-91AB-23F5119B62AE}.Release|Win32.Build.0 = Release|Win32
+		{A54C75F9-A609-4BEC-91AB-23F5119B62AE}.Release|x64.ActiveCfg = Release|x64
+		{A54C75F9-A609-4BEC-91AB-23F5119B62AE}.Release|x64.Build.0 = Release|x64
+		{4AF84403-70C6-4479-A701-D735E7003505}.Debug|Win32.ActiveCfg = Debug|Win32
+		{4AF84403-70C6-4479-A701-D735E7003505}.Debug|Win32.Build.0 = Debug|Win32
+		{4AF84403-70C6-4479-A701-D735E7003505}.Debug|x64.ActiveCfg = Debug|x64
+		{4AF84403-70C6-4479-A701-D735E7003505}.Debug|x64.Build.0 = Debug|x64
+		{4AF84403-70C6-4479-A701-D735E7003505}.Release|Win32.ActiveCfg = Release|Win32
+		{4AF84403-70C6-4479-A701-D735E7003505}.Release|Win32.Build.0 = Release|Win32
+		{4AF84403-70C6-4479-A701-D735E7003505}.Release|x64.ActiveCfg = Release|x64
+		{4AF84403-70C6-4479-A701-D735E7003505}.Release|x64.Build.0 = Release|x64
+		{2CF4BF04-4C4D-442E-A7AD-0AE5EF87C733}.Debug|Win32.ActiveCfg = Debug|Win32
+		{2CF4BF04-4C4D-442E-A7AD-0AE5EF87C733}.Debug|Win32.Build.0 = Debug|Win32
+		{2CF4BF04-4C4D-442E-A7AD-0AE5EF87C733}.Debug|x64.ActiveCfg = Debug|x64
+		{2CF4BF04-4C4D-442E-A7AD-0AE5EF87C733}.Debug|x64.Build.0 = Debug|x64
+		{2CF4BF04-4C4D-442E-A7AD-0AE5EF87C733}.Release|Win32.ActiveCfg = Release|Win32
+		{2CF4BF04-4C4D-442E-A7AD-0AE5EF87C733}.Release|Win32.Build.0 = Release|Win32
+		{2CF4BF04-4C4D-442E-A7AD-0AE5EF87C733}.Release|x64.ActiveCfg = Release|x64
+		{2CF4BF04-4C4D-442E-A7AD-0AE5EF87C733}.Release|x64.Build.0 = Release|x64
+		{E4824F7B-4698-4F9B-85B1-AEFD6A81F957}.Debug|Win32.ActiveCfg = Debug|Win32
+		{E4824F7B-4698-4F9B-85B1-AEFD6A81F957}.Debug|Win32.Build.0 = Debug|Win32
+		{E4824F7B-4698-4F9B-85B1-AEFD6A81F957}.Debug|x64.ActiveCfg = Debug|x64
+		{E4824F7B-4698-4F9B-85B1-AEFD6A81F957}.Debug|x64.Build.0 = Debug|x64
+		{E4824F7B-4698-4F9B-85B1-AEFD6A81F957}.Release|Win32.ActiveCfg = Release|Win32
+		{E4824F7B-4698-4F9B-85B1-AEFD6A81F957}.Release|Win32.Build.0 = Release|Win32
+		{E4824F7B-4698-4F9B-85B1-AEFD6A81F957}.Release|x64.ActiveCfg = Release|x64
+		{E4824F7B-4698-4F9B-85B1-AEFD6A81F957}.Release|x64.Build.0 = Release|x64
+		{03E85236-7CD9-4D6B-95FA-767935F8081D}.Debug|Win32.ActiveCfg = Debug|Win32
+		{03E85236-7CD9-4D6B-95FA-767935F8081D}.Debug|Win32.Build.0 = Debug|Win32
+		{03E85236-7CD9-4D6B-95FA-767935F8081D}.Debug|x64.ActiveCfg = Debug|x64
+		{03E85236-7CD9-4D6B-95FA-767935F8081D}.Debug|x64.Build.0 = Debug|x64
+		{03E85236-7CD9-4D6B-95FA-767935F8081D}.Release|Win32.ActiveCfg = Release|Win32
+		{03E85236-7CD9-4D6B-95FA-767935F8081D}.Release|Win32.Build.0 = Release|Win32
+		{03E85236-7CD9-4D6B-95FA-767935F8081D}.Release|x64.ActiveCfg = Release|x64
+		{03E85236-7CD9-4D6B-95FA-767935F8081D}.Release|x64.Build.0 = Release|x64
+		{446C2DD3-36B3-4B27-8415-951F98346E99}.Debug|Win32.ActiveCfg = Debug|Win32
+		{446C2DD3-36B3-4B27-8415-951F98346E99}.Debug|Win32.Build.0 = Debug|Win32
+		{446C2DD3-36B3-4B27-8415-951F98346E99}.Debug|x64.ActiveCfg = Debug|x64
+		{446C2DD3-36B3-4B27-8415-951F98346E99}.Debug|x64.Build.0 = Debug|x64
+		{446C2DD3-36B3-4B27-8415-951F98346E99}.Release|Win32.ActiveCfg = Release|Win32
+		{446C2DD3-36B3-4B27-8415-951F98346E99}.Release|Win32.Build.0 = Release|Win32
+		{446C2DD3-36B3-4B27-8415-951F98346E99}.Release|x64.ActiveCfg = Release|x64
+		{446C2DD3-36B3-4B27-8415-951F98346E99}.Release|x64.Build.0 = Release|x64
+		{9BFEB5F1-0101-48A6-82CD-CF5744E1EDF3}.Debug|Win32.ActiveCfg = Debug|Win32
+		{9BFEB5F1-0101-48A6-82CD-CF5744E1EDF3}.Debug|Win32.Build.0 = Debug|Win32
+		{9BFEB5F1-0101-48A6-82CD-CF5744E1EDF3}.Debug|x64.ActiveCfg = Debug|x64
+		{9BFEB5F1-0101-48A6-82CD-CF5744E1EDF3}.Debug|x64.Build.0 = Debug|x64
+		{9BFEB5F1-0101-48A6-82CD-CF5744E1EDF3}.Release|Win32.ActiveCfg = Release|Win32
+		{9BFEB5F1-0101-48A6-82CD-CF5744E1EDF3}.Release|Win32.Build.0 = Release|Win32
+		{9BFEB5F1-0101-48A6-82CD-CF5744E1EDF3}.Release|x64.ActiveCfg = Release|x64
+		{9BFEB5F1-0101-48A6-82CD-CF5744E1EDF3}.Release|x64.Build.0 = Release|x64
+		{DA226775-67B1-4354-A5CA-7F5406E0B1E7}.Debug|Win32.ActiveCfg = Debug|Win32
+		{DA226775-67B1-4354-A5CA-7F5406E0B1E7}.Debug|Win32.Build.0 = Debug|Win32
+		{DA226775-67B1-4354-A5CA-7F5406E0B1E7}.Debug|x64.ActiveCfg = Debug|x64
+		{DA226775-67B1-4354-A5CA-7F5406E0B1E7}.Debug|x64.Build.0 = Debug|x64
+		{DA226775-67B1-4354-A5CA-7F5406E0B1E7}.Release|Win32.ActiveCfg = Release|Win32
+		{DA226775-67B1-4354-A5CA-7F5406E0B1E7}.Release|Win32.Build.0 = Release|Win32
+		{DA226775-67B1-4354-A5CA-7F5406E0B1E7}.Release|x64.ActiveCfg = Release|x64
+		{DA226775-67B1-4354-A5CA-7F5406E0B1E7}.Release|x64.Build.0 = Release|x64
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
diff --git a/build/MSVC/2010/srapath.vcxproj b/build/MSVC/2010/srapath.vcxproj
new file mode 100644
index 0000000..cfa374c
--- /dev/null
+++ b/build/MSVC/2010/srapath.vcxproj
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  
+  <Import Project=".\exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-vdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  
+  <ItemGroup>
+    <ClCompile Include="..\..\..\tools\srapath\srapath.c" />
+  </ItemGroup>
+  
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{779C36A1-2592-469C-93A1-60C0B79BA529}</ProjectGuid>
+  </PropertyGroup>
+
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/test-project.props b/build/MSVC/2010/test-project.props
new file mode 100644
index 0000000..87b21e0
--- /dev/null
+++ b/build/MSVC/2010/test-project.props
@@ -0,0 +1,15 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">  
+
+  <Import Project="exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ktst.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  
+  <Target Name="Runtests" DependsOnTargets="Build" >
+    <Exec Command="$(OutDir)$(TargetName)$(TargetExt)" />
+  </Target>
+  
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/test-sra.vcxproj b/build/MSVC/2010/test-sra.vcxproj
new file mode 100644
index 0000000..f3b859e
--- /dev/null
+++ b/build/MSVC/2010/test-sra.vcxproj
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  
+  <Import Project=".\exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-vdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>  
+  
+  <ItemGroup>
+    <ClCompile Include="..\..\..\tools\util\test-sra.c" />
+    <ClCompile Include="..\..\..\tools\util\win\PrintOS.c" />
+  </ItemGroup>
+  
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{11C2E25B-2CD2-4826-A574-637AD10BAAC3}</ProjectGuid>
+  </PropertyGroup>
+
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/vcf-loader.vcxproj b/build/MSVC/2010/vcf-loader.vcxproj
new file mode 100644
index 0000000..1fa7e4e
--- /dev/null
+++ b/build/MSVC/2010/vcf-loader.vcxproj
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  
+  <Import Project=".\lib-project.props" />
+  
+  <ItemGroup>
+    <ClCompile Include="..\..\..\tools\vcf-loader\vcf-database.c" />
+    <ClCompile Include="..\..\..\tools\vcf-loader\vcf-grammar.c" />
+    <ClCompile Include="..\..\..\tools\vcf-loader\vcf-lex.c" />
+    <ClCompile Include="..\..\..\tools\vcf-loader\vcf-reader.c" />
+  </ItemGroup>
+  
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{DA226775-67B1-4354-A5CA-7F5406E0B1E7}</ProjectGuid>
+  </PropertyGroup>
+
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/vdb-common.props b/build/MSVC/2010/vdb-common.props
new file mode 100644
index 0000000..247abb6
--- /dev/null
+++ b/build/MSVC/2010/vdb-common.props
@@ -0,0 +1,21 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+    
+    <Import Condition="Exists('$(ProjectDir)..\..\Makefile.config.win')" Project="$(ProjectDir)..\..\Makefile.config.win" />
+
+    <PropertyGroup Label="Globals">
+    <Platform Condition="'$(Platform)' == ''">x64</Platform>
+    <Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
+    
+    <NGS_ROOT Condition="'$(NGS_ROOT)' == ''">$(ProjectDir)..\..\..\..\ngs\ngs-sdk\</NGS_ROOT>
+    <NGS_OUTDIR Condition="'$(NGS_OUTDIR)' == ''">$(USERPROFILE)\</NGS_OUTDIR>
+    <NGS_TARGET Condition="'$(NGS_TARGET)' == ''">$(NGS_OUTDIR)win\cl\$(Platform)\$(Configuration)\</NGS_TARGET>
+
+    <VDB_OUTDIR Condition="'$(VDB_OUTDIR)' == ''">$(USERPROFILE)\</VDB_OUTDIR>
+    <VDB_ROOT Condition="'$(VDB_ROOT)' == ''">$(ProjectDir)..\..\..\..\ncbi-vdb\</VDB_ROOT>
+    <VDB_TARGET Condition="'$(VDB_TARGET)' == ''">$(VDB_OUTDIR)win\cl\$(Platform)\$(Configuration)\</VDB_TARGET>
+
+  </PropertyGroup>
+  
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  
+</Project>
diff --git a/build/MSVC/2010/vdb-config.vcxproj b/build/MSVC/2010/vdb-config.vcxproj
new file mode 100644
index 0000000..24eb16c
--- /dev/null
+++ b/build/MSVC/2010/vdb-config.vcxproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  
+  <Import Project=".\exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-vdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+	  <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+	  <AdditionalDependencies>$(VDB_TARGET)lib\tui.lib;%(AdditionalDependencies)</AdditionalDependencies>
+	  <AdditionalDependencies>$(VDB_TARGET)lib\tui_cpp.lib;%(AdditionalDependencies)</AdditionalDependencies>	  	  
+    </Link>
+  </ItemDefinitionGroup>  
+  
+  <ItemGroup>
+    <ClCompile Include="..\..\..\tools\vdb-config\configure.cpp" />  
+    <ClCompile Include="..\..\..\tools\vdb-config\util.cpp" />  
+    <ClCompile Include="..\..\..\tools\vdb-config\vdb-config.c" />  
+    <ClCompile Include="..\..\..\tools\vdb-config\interactive.cpp" />  
+    <ClCompile Include="..\..\..\tools\vdb-config\vdb-config-model.cpp" />  
+  </ItemGroup>
+  
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{7CAB9840-19BB-4B32-94BD-C29701FDBE88}</ProjectGuid>
+  </PropertyGroup>
+  
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/vdb-copy.vcxproj b/build/MSVC/2010/vdb-copy.vcxproj
new file mode 100644
index 0000000..9019284
--- /dev/null
+++ b/build/MSVC/2010/vdb-copy.vcxproj
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  
+  <Import Project=".\exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-wvdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>  
+  
+  <ItemGroup>
+    <ClCompile Include="..\..\..\tools\vdb-copy\coldefs.c" />
+    <ClCompile Include="..\..\..\tools\vdb-copy\config_values.c" />
+    <ClCompile Include="..\..\..\tools\vdb-copy\context.c" />
+    <ClCompile Include="..\..\..\tools\vdb-copy\copy_meta.c" />
+    <ClCompile Include="..\..\..\tools\vdb-copy\get_platform.c" />
+    <ClCompile Include="..\..\..\tools\vdb-copy\helper.c" />
+    <ClCompile Include="..\..\..\tools\vdb-copy\namelist_tools.c" />
+    <ClCompile Include="..\..\..\tools\vdb-copy\num-gen.c" />
+    <ClCompile Include="..\..\..\tools\vdb-copy\progressbar.c" />
+    <ClCompile Include="..\..\..\tools\vdb-copy\redactval.c" />
+    <ClCompile Include="..\..\..\tools\vdb-copy\type_matcher.c" />
+    <ClCompile Include="..\..\..\tools\vdb-copy\vdb-copy.c" />
+  </ItemGroup>
+  
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{639D1E21-0C0C-4846-A71D-68DB7752833A}</ProjectGuid>
+  </PropertyGroup>
+  
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/vdb-decrypt.vcxproj b/build/MSVC/2010/vdb-decrypt.vcxproj
new file mode 100644
index 0000000..a671293
--- /dev/null
+++ b/build/MSVC/2010/vdb-decrypt.vcxproj
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  
+  <Import Project=".\exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-wvdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>    
+  
+  <ItemGroup>
+    <ClCompile Include="..\..\..\tools\vdb-decrypt\shared.c" />
+    <ClCompile Include="..\..\..\tools\vdb-decrypt\vdb-decrypt.c" />
+  </ItemGroup>
+
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{E4824F7B-4698-4F9B-85B1-AEFD6A81F957}</ProjectGuid>
+  </PropertyGroup>
+
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/vdb-dump.vcxproj b/build/MSVC/2010/vdb-dump.vcxproj
new file mode 100644
index 0000000..2d16ae3
--- /dev/null
+++ b/build/MSVC/2010/vdb-dump.vcxproj
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  
+  <Import Project=".\exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-vdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+	  <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>  
+  
+  <ItemGroup>
+    <ClCompile Include="..\..\..\tools\vdb-dump\vdb-dump-bin.c" />
+    <ClCompile Include="..\..\..\tools\vdb-dump\vdb-dump-coldefs.c" />
+    <ClCompile Include="..\..\..\tools\vdb-dump\vdb-dump-context.c" />
+    <ClCompile Include="..\..\..\tools\vdb-dump\vdb-dump-fastq.c" />
+    <ClCompile Include="..\..\..\tools\vdb-dump\vdb-dump-filter.c" />
+    <ClCompile Include="..\..\..\tools\vdb-dump\vdb-dump-formats.c" />
+    <ClCompile Include="..\..\..\tools\vdb-dump\vdb-dump-helper.c" />
+    <ClCompile Include="..\..\..\tools\vdb-dump\vdb-dump-num-gen.c" />
+    <ClCompile Include="..\..\..\tools\vdb-dump\vdb-dump-print.c" />
+    <ClCompile Include="..\..\..\tools\vdb-dump\vdb-dump-redir.c" />
+    <ClCompile Include="..\..\..\tools\vdb-dump\vdb-dump-str.c" />
+    <ClCompile Include="..\..\..\tools\vdb-dump\vdb-dump-tools.c" />
+    <ClCompile Include="..\..\..\tools\vdb-dump\vdb-dump.c" />
+    <ClCompile Include="..\..\..\tools\vdb-dump\vdb_info.c" />
+  </ItemGroup>
+
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{5E85344A-92C9-4407-8A76-1EF0C8AB0D60}</ProjectGuid>
+  </PropertyGroup>
+
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/vdb-encrypt.vcxproj b/build/MSVC/2010/vdb-encrypt.vcxproj
new file mode 100644
index 0000000..5322680
--- /dev/null
+++ b/build/MSVC/2010/vdb-encrypt.vcxproj
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  
+  <Import Project=".\exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-wvdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>    
+  
+  <ItemGroup>
+    <ClCompile Include="..\..\..\tools\vdb-decrypt\shared.c" />
+    <ClCompile Include="..\..\..\tools\vdb-decrypt\vdb-encrypt.c" />
+  </ItemGroup>
+
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{03E85236-7CD9-4D6B-95FA-767935F8081D}</ProjectGuid>
+  </PropertyGroup>
+
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/vdb-lock.vcxproj b/build/MSVC/2010/vdb-lock.vcxproj
new file mode 100644
index 0000000..4a4b5b0
--- /dev/null
+++ b/build/MSVC/2010/vdb-lock.vcxproj
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  
+  <Import Project=".\exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-wvdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>    
+  
+  <ItemGroup>
+    <ClCompile Include="..\..\..\tools\util\vdb-lock.c" />
+  </ItemGroup>
+
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{4779D671-B464-4C6E-8875-CDA2081957F0}</ProjectGuid>
+  </PropertyGroup>
+
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/vdb-passwd.vcxproj b/build/MSVC/2010/vdb-passwd.vcxproj
new file mode 100644
index 0000000..0a8a35e
--- /dev/null
+++ b/build/MSVC/2010/vdb-passwd.vcxproj
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  
+  <Import Project=".\exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-vdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>  
+  
+  <ItemGroup>
+    <ClCompile Include="..\..\..\tools\util\vdb-passwd.c" />
+    <ClCompile Include="..\..\..\tools\util\win\syspass.c" />
+  </ItemGroup>
+  
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{ABA40306-1ACE-4E66-B7A9-74F14C47BDC7}</ProjectGuid>
+  </PropertyGroup>
+    
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/vdb-unlock.vcxproj b/build/MSVC/2010/vdb-unlock.vcxproj
new file mode 100644
index 0000000..a6d6b92
--- /dev/null
+++ b/build/MSVC/2010/vdb-unlock.vcxproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <Import Project=".\exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-wvdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>  
+  
+  <ItemGroup>
+    <ClCompile Include="..\..\..\tools\util\vdb-unlock.c" />
+  </ItemGroup>
+  
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{452802EF-A059-4A4C-8106-ADF652ED1E1C}</ProjectGuid>
+  </PropertyGroup>
+  
+</Project>
\ No newline at end of file
diff --git a/build/MSVC/2010/vdb-validate.vcxproj b/build/MSVC/2010/vdb-validate.vcxproj
new file mode 100644
index 0000000..34d270f
--- /dev/null
+++ b/build/MSVC/2010/vdb-validate.vcxproj
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  
+  <Import Project=".\exe-project.props" />
+  
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>$(VDB_TARGET)lib\ncbi-vdb.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(VDB_TARGET)lib\bz2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>  
+  
+  <ItemGroup>
+    <ClCompile Include="..\..\..\tools\vdb-validate\vdb-validate.c" />
+  </ItemGroup>
+  
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{446C2DD3-36B3-4B27-8415-951F98346E99}</ProjectGuid>
+  </PropertyGroup>
+
+</Project>
\ No newline at end of file
diff --git a/build/Makefile.cc b/build/Makefile.cc
new file mode 100644
index 0000000..590b55e
--- /dev/null
+++ b/build/Makefile.cc
@@ -0,0 +1,67 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+# compilers
+CC = @ $(TOP)/build/$(OS)-cc.sh $(OS) 'cc -c' \
+	 $(CHECKSUM) --objx $(OBJX) --cflags "$(CFLAGS)" -MD
+CP = @ $(TOP)/build/$(OS)-c++.sh $(OS) 'c++ -c' \
+	 $(CHECKSUM) --objx $(OBJX) --cflags "$(CPFLAGS)" -MD
+
+# C preprocessor
+PP = cc -E $(CFLAGS)
+
+# linkers
+LD = @ $(TOP)/build/ld.sh $(OS) $(ARCH) cc \
+	--build $(BUILD) --ldflags "$(LDFLAGS)" $(STATIC) \
+	$(STATICSYSLIBS) $(CHECKSUM) --objx $(OBJX) --shlx $(SHLX) --libx $(LIBX) \
+	-MD --srcdir $(SRCDIR) --bindir $(BINDIR) -L$(LIBDIR):$(ILIBDIR)
+
+LP = @ $(TOP)/build/ld.sh $(OS) $(ARCH) c++ \
+	--build $(BUILD) --ldflags "$(LDFLAGS)" $(STATIC) \
+	$(STATICSYSLIBS) $(CHECKSUM) --objx $(OBJX) --shlx $(SHLX) --libx $(LIBX) \
+	-MD --srcdir $(SRCDIR) --bindir $(BINDIR) -L$(LIBDIR):$(ILIBDIR)
+
+# tool options
+WARN =
+
+ifeq (64,$(BITS))
+	CARCH = -m64
+else
+	CARCH = -m32
+endif
+
+ifeq (prof, $(BUILD))
+	PROF = -xpg
+endif
+
+ifeq (dbg, $(BUILD))
+	DBG = -g
+	OPT = $(WARN)
+	NOPT = $(WARN)
+	PED = -xc99=all -Xc -v
+else
+	OPT = -xO3
+	PED = -xc99=all # -Xc -v
+endif
diff --git a/build/Makefile.clang b/build/Makefile.clang
index 51d6c8a..7194afe 100644
--- a/build/Makefile.clang
+++ b/build/Makefile.clang
@@ -26,19 +26,19 @@
 # compilers
 CC = @ $(TOP)/build/cc.sh $(OS) 'clang -c' \
 	 $(CHECKSUM) --objx $(OBJX) --cflags "$(CFLAGS)" -MD
-CP = @ $(TOP)/build/cc.sh $(OS) 'clang -xc++ -c' \
+CP = @ $(TOP)/build/cc.sh $(OS) 'clang++ -c' \
 	 $(CHECKSUM) --objx $(OBJX) --cflags "$(CPFLAGS)" -MD
 
 # C preprocessor
 PP = gcc -E $(CFLAGS)
 
 # linkers
-LD = @ $(TOP)/build/ld.sh $(OS) $(ARCH) gcc \
+LD = @ $(TOP)/build/ld.sh $(OS) $(ARCH) clang \
 	--build $(BUILD) --ldflags "$(LDFLAGS)" $(STATIC) \
 	$(STATICSYSLIBS) $(CHECKSUM) --objx $(OBJX) --shlx $(SHLX) --libx $(LIBX) \
 	-MD --srcdir $(SRCDIR) --bindir $(BINDIR) -L$(LIBDIR):$(ILIBDIR)
 
-LP = @ $(TOP)/build/ld.sh $(OS) $(ARCH) g++ \
+LP = @ $(TOP)/build/ld.sh $(OS) $(ARCH) clang++ \
 	--build $(BUILD) --ldflags "$(LDFLAGS)" $(STATIC) \
 	$(STATICSYSLIBS) $(CHECKSUM) --objx $(OBJX) --shlx $(SHLX) --libx $(LIBX) \
 	-MD --srcdir $(SRCDIR) --bindir $(BINDIR) -L$(LIBDIR):$(ILIBDIR)
@@ -63,10 +63,7 @@ ifeq (dbg, $(BUILD))
 	DBG = -g
 	OPT = $(WARN)
 	NOPT = $(WARN)
-	# GCC seems unable to use c99 without ansi, which
-	# basically clobbers features back to c89. the options
-	# must be specified in the order shown.
-	PED = -std=c99 -ansi -pedantic # -fdiagnostics-show-option
+	PED = -std=c99 -pedantic # -fdiagnostics-show-option
 else
 
 ifeq (x86_64, $(ARCH))
diff --git a/build/Makefile.env b/build/Makefile.env
index fcc653c..d56d2e2 100644
--- a/build/Makefile.env
+++ b/build/Makefile.env
@@ -22,7 +22,6 @@
 #
 # ===========================================================================
 
-
 # pick up dependencies from object directory
 ifdef SRCDIR
 	include $(wildcard *.d)
@@ -31,16 +30,15 @@ endif
 # determine shell environment
 include $(TOP)/build/Makefile.shell
 
+# load build configuration
+include $(CONFIG_FILE)
+
 # normally build shared and static external libs
 LIBEXT = $(LIBX) $(SHLX)
 
 # normally build static intermediate libs
 ILIBEXT = $(LIBX)
 
-# would normally only build dynamic library modules,
-# but some tools are expecting to be able to static link
-MODEXT = $(LIBX) $(SHLX)
-
 # determine BUILD
 ifeq (,$(BUILD))
 	BUILD = dbg
@@ -52,32 +50,31 @@ BUILDTYPE = $(BUILD)
 # adjust settings for build
 ifeq (dbg,$(BUILD))
 	DEBUG := -D_DEBUGGING
-#	ILIBEXT = $(LIBX) $(SHLX)
-	MODEXT = $(LIBX) $(SHLX)
-endif
-ifeq (rel,$(BUILD))
-	DEBUG := -DNDEBUG
 endif
 ifeq (prof,$(BUILD))
-	DEBUG := -DNDEBUG -D_PROFILING
+	DEBUG := -D_PROFILING
+endif
+ifeq (pur,$(BUILD))
+	DEBUG := -D_DEBUGGING
+	LD_PRE := purify
+	LNKG = stat
+endif
+ifeq (pcov,$(BUILD))
+	DEBUG := -D_DEBUGGING
+	LD_PRE := purecov
+	LNKG = stat
+endif
+ifeq (scm,$(BUILD))
+	BUILDTYPE = rel
+	CHECKSUM := --checksum
 endif
 
-# allow for an all-static build
-ifeq (stat,$(LNKG))
-	STATIC = --static
-	LINKAGE := -D_STATIC
-	LIBEXT = $(LIBX)
-	ILIBEXT = $(LIBX)
-	MODEXT = $(LIBX)
-	STAT_OR_DYN = static
-	STATICSYSLIBS := --static-system-libs
-
+ifeq (yes,$(HAS_RHOST))
+	LOCAL_OR_REMOTE = remote
 else
-	STAT_OR_DYN = dynamic
+	LOCAL_OR_REMOTE = local
 endif
 
-LOCAL_OR_REMOTE = local
-
 
 # drop all suffix rules
 .SUFFIXES:
@@ -94,9 +91,8 @@ READONLY_SCHEMA_LIBS = $(addprefix -l,$(EXT_SCHEMA_MODULES))
 ALWAYS_STATIC_SCHEMA_LIBS = $(addprefix -s,$(EXT_SCHEMA_MODULES))
 
 # full directory paths
-OLD_TARGDIR = $(OUTDIR)/$(OSFLAV)/$(BUILD)/$(TOOLSET)/$(ARCH)
-TARGDIR = $(OUTDIR)/$(OSFLAV)/$(TOOLSET)/$(LNKG)/$(ARCH)/$(BUILD)
-BINDIR = $(TARGDIR)/bin
+TARGDIR ?= $(OUTDIR)/$(OS)/$(TOOLSET)/$(ARCH)/$(BUILD)
+BINDIR ?= $(TARGDIR)/bin
 ifeq (win,$(OS))
     # on Windows, place test executables next to .dlls
     TEST_BINDIR = $(BINDIR)
@@ -105,31 +101,31 @@ else
 endif
 ILIBDIR = $(TARGDIR)/ilib
 LIBDIR = $(TARGDIR)/lib
-MODDIR = $(TARGDIR)/mod
-WMODDIR = $(TARGDIR)/wmod
 OBJDIR = $(TARGDIR)/obj/$(MODULE)
 
+CLSPATH         ?= $(TARGDIR)/java
+CLASSPATH       ?= $(CLSPATH)
+CLASSDIR        ?= $(TARGDIR)/$(MODULE)
+TEST_CLSPATH    ?= $(TARGDIR)/test/java
+JAVASOURCEPATH  ?= $(TOP)/java
+
 # path to the ncbi sub-directory
 # this is where modules and installed schema files are kept
 ifeq (win,$(OS))
     # under Windows, we are always relative to binary path
 	NCBIDIR = $(BINDIR)/ncbi
 else
-ifeq (--static,$(STATIC))
-    # in static builds, we are relative to binary path
-    # because the configuration library will be part of tool
-	NCBIDIR = $(BINDIR)/ncbi
-else
-    # in dynamic builds, we are relative to library path
-    # because the configuration library will live there
-	NCBIDIR = $(LIBDIR)/ncbi
-endif
+	# under Linux and Mac, it can be binary or library
+	NCBIDIR = $(LIBDIR)/ncbi $(BINDIR)/ncbi
 endif
 
 # make reissue command
 MAKE_CMD = $(MAKE) BUILD=$(BUILD) TOOLSET=$(TOOLSET) COMP=$(COMP) LNKG=$(LNKG) \
     TOP=$(TOP) SRCDIR=$(SRCDIR) OUTDIR=$(OUTDIR) -C $(OBJDIR) -f $(SRCDIR)/Makefile
 
+JMAKE_CMD = $(MAKE) BUILD=$(BUILD) TOOLSET=$(TOOLSET) COMP=$(COMP) LNKG=$(LNKG) \
+    TOP=$(TOP) SRCDIR=$(SRCDIR) OUTDIR=$(OUTDIR) -C $(CLASSDIR) -f $(SRCDIR)/Makefile
+
 # directory and link creation
 SUBDIRS = bin test-bin ilib lib
 OUTDIRS = schema
@@ -137,13 +133,16 @@ OUTDIRS = schema
 # clean rules
 stdclean:
 	@ -rm -rf $(OBJDIR)
-	@ rm -rf $(addsuffix .*,$(addprefix $(ILIBDIR)/,$(ALL_LIBS))) \
+	@ -rm -rf $(addprefix $(OUTDIR)/$(OS)/$(TOOLSET)/,dyn stat)
+	@ -rm -rf $(addsuffix .*,$(addprefix $(ILIBDIR)/,$(ALL_LIBS))) \
 			$(addsuffix .*,$(addprefix $(LIBDIR)/,$(ALL_LIBS))) \
-			$(addsuffix .*,$(addprefix $(MODDIR)/,$(ALL_LIBS))) \
-			$(addsuffix .*,$(addprefix $(WMODDIR)/,$(ALL_LIBS))) \
+			$(addsuffix -static.*,$(addprefix $(LIBDIR)/,$(ALL_LIBS))) \
 			$(addsuffix *,$(addprefix $(BINDIR)/,$(ALL_TOOLS) $(ALL_LIBS))) \
 			$(addsuffix *,$(addprefix $(TEST_BINDIR)/,$(ALL_TOOLS) $(TEST_TOOLS)))
 
+stdjclean:
+	@ -rm -rf $(CLSPATH)
+
 # removing symbolic links that point to specific builds
 removelinks:
 	@ test ! -h $(OUTDIR)/schema && rm -rf $(OUTDIR)/schema || true
@@ -154,6 +153,9 @@ removelinks:
 makedirs:
 	@ mkdir -p $(addprefix $(TARGDIR)/,$(SUBDIRS) obj/$(MODULE)) $(NCBIDIR)
 
+makejdirs:
+	@ mkdir -p $(CLASSDIR)
+
 # build version include files
 vers-includes: makedirs
 	@ $(MAKE_CMD) -s $(TARGDIR)/$@
@@ -175,18 +177,29 @@ rebuild-dirlinks:
 	@ true
 else
 rebuild-dirlinks: removelinks makedirs $(LNDIRS)
-	@ ln -s $(TOP)/interfaces $(OUTDIR)/schema
+	@ ln -s $(VDB_INCDIR) $(OUTDIR)/schema
 endif
 
 endif
 
 .PHONY: stdclean removelinks makedirs vers-includes rebuild-dirlinks
+.PHONY: stdjclean makejdirs
 
 # configuration targets 
 out:
 	@ echo $(OUTDIR) > $(TOP)/build/OUTDIR.$(BUILD_OS)
 	@ $(MAKE) TOP=$(TOP) -f $(TOP)/build/Makefile.env rebuild-dirlinks
 
+$(RHOSTS):
+	@ cat $(TOP)/rhosts/$@ >> $(TOP)/build/RHOST.$(HOST_OS)
+
+require-proxy-exec:
+	@ $(MAKE) -C $(TOP)/test/proxy_exec proxy-exec
+	@ echo "PROXY_TOOL := $(BINDIR)/proxy-exec" > $(TOP)/build/RHOST.$(HOST_OS)
+
+local:
+	@ rm -f $(TOP)/build/RHOST.$(HOST_OS)
+
 CC:
 	@ echo cc > $(TOP)/build/COMP.$(OS)
 
@@ -202,22 +215,22 @@ VC++:
 CLANG:
 	@ echo clang > $(TOP)/build/COMP.$(OS)
 
-static:
-	@ echo stat > $(TOP)/build/LNKG.$(OS)
-
-dynamic:
-	@ echo dyn > $(TOP)/build/LNKG.$(OS)
+static dynamic:
+	@ echo "there is no longer any difference between static and dynamic builds"
 
 debug:
 	@ echo dbg > $(TOP)/build/BUILD.$(OS)
 
-profile: static
+profile:
 	@ echo prof > $(TOP)/build/BUILD.$(OS)
 
 release:
 	@ echo rel > $(TOP)/build/BUILD.$(OS)
 
-pubtools: release static
+scm:
+	@ echo scm > $(TOP)/build/BUILD.$(OS)
+
+pubtools: release
 
 bindir:
 	@ echo "$(BINDIR)"
@@ -226,7 +239,7 @@ targdir:
 	@ echo "$(TARGDIR)"
 
 osdir:
-	@ echo "$(OUTDIR)/$(OSFLAV)"
+	@ echo "$(OUTDIR)/$(OS)"
 
 compilers:
 	@ echo "$(COMPILERS)"
@@ -238,17 +251,24 @@ architecture:
 	@ echo "$(ARCH)"
 
 config:
-	@ echo "  current build is $(BUILD_OS) $(STAT_OR_DYN) $(BUILD) $(ARCH) build using $(TOOLSET) tools"
+	@ echo "  current build is $(LOCAL_OR_REMOTE) $(BUILD_OS) $(BUILD) $(ARCH) build using $(TOOLSET) tools"
 	@ echo "  output target directory is '$(TARGDIR)'"
 	@ echo
 
-.PHONY: out CC GCC ICC debug profile release bindir report_config
+purify:
+	@ echo pur > $(TOP)/build/BUILD.$(OS)
+
+purecov:
+	@ echo pcov > $(TOP)/build/BUILD.$(OS)
+
+.PHONY: out CC GCC ICC debug profile release scm purify purecov local local require-proxy-exec $(RHOSTS) bindir report_config
 
 # includes based upon build
-ITF = $(TOP)/interfaces
-OSINC = $(TOP)/interfaces/os
-CCINC = $(TOP)/interfaces/cc
-XTINC = $(TOP)/interfaces/ext
+ITF   = $(VDB_INCDIR)/
+OSINC = $(VDB_INCDIR)/os
+CCINC = $(VDB_INCDIR)/cc
+XTINC = $(VDB_INCDIR)/ext
+NGSINC = $(NGS_INCDIR)
 OVERRIDEINC = $(TOP)/interfaces/override
 
 # OS specific source and include dirs
@@ -294,7 +314,8 @@ INCDIRS = \
 	$(addprefix -I,$(SRCDIRS_OS)) \
 	$(addprefix -I,$(SRCDIR) $(ITF)) \
 	$(addprefix -I,$(INCDIRS_COMP)) \
-	$(addprefix -I,$(INCDIRS_OS) $(XTINC)) \
+	$(addprefix -I,$(INCDIRS_OS)) \
+	$(addprefix -I,$(XTINC) $(NGSINC)) \
 	-I.
 
 
@@ -303,6 +324,41 @@ DLLX ?= $(SHLX)
 ARCHDEFS = -D_ARCH_BITS=$(BITS) -DLIBPREFIX=$(LPFX) -DSHLIBEXT=$(DLLX)
 
 # default tool parameters
-CFLAGS	= $(DEBUG) $(DBG) $(CARCH) $(PROF) $(PED) $(LINKAGE) $(DEFINES) $(ARCHDEFS) $(MIN_DEPLOY_OS_OPT) $(INCDIRS)
-CPFLAGS = $(DEBUG) $(DBG) $(CARCH) $(PROF) $(LINKAGE) $(DEFINES) $(ARCHDEFS) $(MIN_DEPLOY_OS_OPT) $(INCDIRS)
+CFLAGS	= $(DEBUG) $(DBG) $(CARCH) $(PROF) $(PED) $(DEFINES) $(ARCHDEFS) $(MIN_DEPLOY_OS_OPT) $(INCDIRS)
+CPFLAGS = $(DEBUG) $(DBG) $(CARCH) $(PROF) $(DEFINES) $(ARCHDEFS) $(MIN_DEPLOY_OS_OPT) $(INCDIRS)
 LDFLAGS = $(DBG) $(PROF) $(CARCH) $(MIN_DEPLOY_OS_OPT)
+
+#-------------------------------------------------------------------------------
+# runtests
+# 
+# MallocScribble=1 is for catching allocation problems on Mac
+#
+ifeq ($(RUNTESTS_OVERRIDE),)
+runtests: std $(TEST_TOOLS)
+	@ export LD_LIBRARY_PATH=$(LIBDIR):$$LD_LIBRARY_PATH;export MallocScribble=1;\
+	for i in $(TEST_TOOLS);\
+	do\
+		echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++;\
+		echo Run $(TEST_BINDIR)/$$i;eval $(RUN_REMOTELY) $(TEST_BINDIR)/$$i;r=$$?; \
+		if [ "$$r" != "0" ] ; then exit $$r; fi; \
+	done
+
+.PHONY: runtests
+endif
+
+#-------------------------------------------------------------------------------
+# slowtests
+# 
+# $(SLOWTESTSDATADIR) should be used to create temporary test files
+SLOWTESTSDATADIR ?= /panfs/pan1.be-md.ncbi.nlm.nih.gov/sra-test/slowtests/$(shell whoami)
+
+slowtests: std $(SLOW_TEST_TOOLS)
+	@ export LD_LIBRARY_PATH=$(LIBDIR):$$LD_LIBRARY_PATH;\
+	for i in $(SLOW_TEST_TOOLS);\
+	do\
+		echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++;\
+		echo Run $(TEST_BINDIR)/$$i;eval $(RUN_REMOTELY) $(TEST_BINDIR)/$$i;r=$$?; \
+		if [ "$$r" != "0" ] ; then exit $$r; fi; \
+	done
+
+.PHONY: slowtests
diff --git a/build/Makefile.gcc b/build/Makefile.gcc
index d391d1b..49bb874 100644
--- a/build/Makefile.gcc
+++ b/build/Makefile.gcc
@@ -36,14 +36,14 @@ PP = gcc -E $(CFLAGS)
 LD = @ $(TOP)/build/ld.sh $(OS) $(ARCH) gcc \
 	--build $(BUILD) --ldflags "$(LDFLAGS)" $(STATIC) \
 	$(STATICSYSLIBS) $(CHECKSUM) --objx $(OBJX) --shlx $(SHLX) --libx $(LIBX) \
-	-MD --srcdir $(SRCDIR) --bindir $(BINDIR) -L$(LIBDIR):$(ILIBDIR)
+	-MD --srcdir $(SRCDIR) --bindir $(BINDIR) -L$(LIBDIR):$(ILIBDIR):$(NGS_LIBDIR):$(VDB_LIBDIR):$(VDB_ILIBDIR)
 
 LPFLAGS = $(LDFLAGS)
 
 LP = @ $(TOP)/build/ld.sh $(OS) $(ARCH) g++ \
 	--build $(BUILD) --ldflags "$(LPFLAGS)" $(STATIC) \
 	$(STATICSYSLIBS) $(CHECKSUM) --objx $(OBJX) --shlx $(SHLX) --libx $(LIBX) \
-	-MD --srcdir $(SRCDIR) --bindir $(BINDIR) -L$(LIBDIR):$(ILIBDIR)
+	-MD --srcdir $(SRCDIR) --bindir $(BINDIR) -L$(LIBDIR):$(ILIBDIR):$(NGS_LIBDIR):$(VDB_LIBDIR):$(VDB_ILIBDIR)
 
 # tool options
 WARN = -Wall -Wno-long-long 
diff --git a/build/Makefile.install b/build/Makefile.install
new file mode 100644
index 0000000..5e7e4a7
--- /dev/null
+++ b/build/Makefile.install
@@ -0,0 +1,125 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+# determine shell environment
+include $(TOP)/build/Makefile.shell
+
+# load build configuration
+include $(CONFIG_FILE)
+
+#-------------------------------------------------------------------------------
+# install
+# 
+ifeq (linux, $(OS))
+
+TOOLS_TO_INSTALL = \
+    abi-dump        \
+    abi-load        \
+    align-info      \
+    bam-load        \
+    cache-mgr       \
+    cg-load         \
+    fastq-dump      \
+    fastq-load      \
+    helicos-load    \
+    illumina-dump   \
+    illumina-load   \
+    kar             \
+    kdbmeta         \
+    latf-load       \
+    prefetch        \
+    rcexplain       \
+    sam-dump        \
+    sff-dump        \
+    sff-load        \
+    sra-pileup      \
+    sra-sort        \
+    sra-stat        \
+    srapath         \
+    srf-load        \
+    test-sra        \
+    vdb-config      \
+    vdb-copy        \
+    vdb-decrypt     \
+    vdb-dump        \
+    vdb-encrypt     \
+    vdb-lock        \
+    vdb-passwd      \
+    vdb-unlock      \
+    vdb-validate    \
+
+#    remote-fuser    \
+#    blastn_vdb      \
+#    tblastn_vdb     \
+
+TOOLS_WITH_PREFIX   = $(addprefix  $(BINDIR)/, $(TOOLS_TO_INSTALL))
+TOOLS_WITH_EXEX     = $(addsuffix $(EXEX),          $(TOOLS_WITH_PREFIX))
+TOOLS_WITH_VERSION  = $(addsuffix $(VERSION_EXEX),  $(TOOLS_WITH_PREFIX))
+TOOLS_WITH_MAJVERS  = $(addsuffix $(MAJVERS_EXEX),  $(TOOLS_WITH_PREFIX))
+    
+#fake root for debugging
+#uncomment this line and change the test for root ( see under install: ) to succeed:
+#ROOT = ~/root
+    
+EXE_TARGET = $(INST_BINDIR)
+PROFILE_FILE = $(ROOT)/etc/profile.d/sra-tools
+
+installexes:
+	@echo "Installing executables to $(INST_BINDIR)"
+	@mkdir -p $(INST_BINDIR) 
+	@cp -P $(TOOLS_WITH_EXEX) $(TOOLS_WITH_VERSION) $(TOOLS_WITH_MAJVERS) $(INST_BINDIR)
+
+install: installexes
+ifeq (0, $(shell id -u))
+	@ # install configuration file(s)
+	@ echo "Installing configuration files to $(ROOT)/etc/ncbi/"
+	@ mkdir -p $(ROOT)/etc/ncbi/
+	@ cp $(TOP)/tools/vdb-copy/vdb-copy.kfg $(ROOT)/etc/ncbi/
+	@ #
+	@ echo "Updating $(PROFILE_FILE).[c]sh"
+	@ echo -e \
+"#version $(VERSION)\n"\
+"if ! echo \$$PATH | /bin/grep -q $(EXE_TARGET)\n"\
+"then export PATH=$(EXE_TARGET):\$$PATH\n"\
+"fi" \
+        >$(PROFILE_FILE).sh && chmod 644 $(PROFILE_FILE).sh || true;
+	@ echo -e \
+"#version $(VERSION)\n"\
+"echo \$$PATH | /bin/grep -q $(EXE_TARGET)\n"\
+"if ( \$$status ) setenv PATH $(EXE_TARGET):\$$PATH\n"\
+        >$(PROFILE_FILE).csh && chmod 644 $(PROFILE_FILE).csh || true;
+	@ #TODO: check version of the files above
+else    
+	@ # install configuration file(s)
+	@ echo "Installing configuration files to $(INST_BINDIR)/ncbi/"
+	@ mkdir -p $(INST_BINDIR)/ncbi/
+	@ cp $(TOP)/tools/vdb-copy/vdb-copy.kfg $(INST_BINDIR)/ncbi/
+endif
+
+else
+install:
+
+endif
+
+.PHONY: install
\ No newline at end of file
diff --git a/build/Makefile.linux b/build/Makefile.linux
index a5fcd45..582f257 100644
--- a/build/Makefile.linux
+++ b/build/Makefile.linux
@@ -58,25 +58,14 @@ LIBX = a
 SHLX = so
 
 # compilation defines
-DEFINES	:= -DLINUX -DUNIX -D_GNU_SOURCE -D_REENTRANT -D_FILE_OFFSET_BITS=64
+DEFINES	:= -DLINUX -DUNIX -D_GNU_SOURCE -D_REENTRANT -D_FILE_OFFSET_BITS=64 -DPKGNAME=linux$(BITS)
 
 # linux is a Unix variant
 OS_DAD = unix
 
-# support for libxml
-## TBD - move to libs/kxml, but this will break static builds...
-ifdef NCBI
-  ifeq (dbg,$(BUILD))
-	LIBXML_LPATH = $(NCBI)/libxml/DebugMT/lib
-  else
-	LIBXML_LPATH = $(NCBI)/libxml/lib
-  endif
-	DFLT_LIBXML_INCLUDES = $(NCBI)/libxml/include/libxml2
-endif
-
-# flex+bison
-LEX  = @ true
+# flex+bison: on Mac, use source-controlled generated .c/.h files
 YACC = @ true
+LEX = @ true
 
 # build matrix
 COMPILERS = GCC # ICC
diff --git a/build/Makefile.mac b/build/Makefile.mac
index 4568550..a246b0a 100644
--- a/build/Makefile.mac
+++ b/build/Makefile.mac
@@ -25,7 +25,7 @@
 
 # default compiler
 ifeq (,$(COMP))
-	COMP = gcc
+	COMP = clang
 endif
 
 # architecture
@@ -61,7 +61,7 @@ LIBX = a
 SHLX = dylib
 
 # compilation defines
-DEFINES	:= -DMAC -DBSD -DUNIX -D_REENTRANT -D_FILE_OFFSET_BITS=64
+DEFINES	:= -DMAC -DBSD -DUNIX -D_REENTRANT -D_FILE_OFFSET_BITS=64 -DPKGNAME=mac$(BITS)
 
 # Darwin is a Unix variant
 OS_DAD = bsd
@@ -78,4 +78,4 @@ YACC = @ true
 LEX = @ true
 
 # build matrix
-COMPILERS = GCC CLANG
+COMPILERS = CLANG GCC
diff --git a/build/Makefile.rules b/build/Makefile.rules
index 0313504..8a59863 100644
--- a/build/Makefile.rules
+++ b/build/Makefile.rules
@@ -99,6 +99,11 @@ LOC_INFO = -D__mod_name__=$(MODULE) -D__file_name__=$*
 %.nopt.pic.s: %.cxx
 	$(CP) -S -o $@ -fPIC $(NOPT) $<
 
+# yacc and lex
+#%.c: %.y
+#	$(YACC) -o $@ $^
+#%.c: %.l
+#	$(LEX) -DYY_BUF_SIZE=16777216 -t $< | grep -v '^#line' > $@
 
 # version include generation
 %.vers.h: %.vers
diff --git a/build/Makefile.scm b/build/Makefile.scm
new file mode 100644
index 0000000..b972029
--- /dev/null
+++ b/build/Makefile.scm
@@ -0,0 +1,94 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+default: install
+
+# determine a few things
+TOP ?= $(abspath ..)
+include $(TOP)/build/Makefile.env
+
+# current distribution point
+ifeq (linux,$(OS))
+TRACE_SOFTWARE = /panfs/traces01/trace_software/vdb
+endif
+ifeq (mac,$(OS))
+TRACE_SOFTWARE = /net/traces01/trace_software/vdb
+endif
+ifeq (win,$(OS))
+TRACE_SOFTWARE = //panfs/traces01/trace_software/vdb
+endif
+
+
+#-------------------------------------------------------------------------------
+# targets
+#
+INSTALL_TARGETS = \
+	interfaces \
+	schema \
+	os \
+	arch
+
+install: $(INSTALL_TARGETS)
+
+.PHONY: install $(INSTALL_TARGETS)
+
+
+#-------------------------------------------------------------------------------
+# interfaces
+#  populates the interfaces directory
+#
+interfaces:
+	@ bash cp.sh $(TOP)/interfaces $(TRACE_SOFTWARE)/interfaces "-name *.h -o -name *.hpp"
+
+
+#-------------------------------------------------------------------------------
+# schema
+#  populates the schema directory
+#
+schema:
+	@ bash cp.sh $(TOP)/interfaces $(TRACE_SOFTWARE)/schema "-name *.vschema"
+
+
+#-------------------------------------------------------------------------------
+# operating system
+#  populates any os-specific things, such as configuration
+#
+os:
+	@ true
+
+
+#-------------------------------------------------------------------------------
+# architecture
+#  populates build results
+#
+arch: arch-$(BUILD)
+
+arch-dbg:
+	@ bash cp.sh $(BINDIR) $(TRACE_SOFTWARE)/$(OS)/debug/$(ARCH)/bin "-type d -a -name ncbi -prune -o ! -type d -print"
+	@ bash cp.sh $(LIBDIR) $(TRACE_SOFTWARE)/$(OS)/debug/$(ARCH)/lib "-type d -a -name ncbi -prune -o ! -type d -print"
+	@ bash cp.sh $(ILIBDIR) $(TRACE_SOFTWARE)/$(OS)/debug/$(ARCH)/ilib "! -type d -print"
+
+arch-rel:
+	@ bash cp.sh $(BINDIR) $(TRACE_SOFTWARE)/$(OS)/release/$(ARCH)/bin "-type d -a -name ncbi -prune -o ! -type d -print"
+	@ bash cp.sh $(LIBDIR) $(TRACE_SOFTWARE)/$(OS)/release/$(ARCH)/lib "-type d -a -name ncbi -prune -o ! -type d -print"
diff --git a/build/Makefile.shell b/build/Makefile.shell
index 0990c50..d90b53e 100644
--- a/build/Makefile.shell
+++ b/build/Makefile.shell
@@ -22,6 +22,10 @@
 #
 # ===========================================================================
 
+CONFIG_FILE = $(TOP)/build/Makefile.config
+ifeq (no, $(shell test -f $(CONFIG_FILE) && echo yes || echo no))
+    $(error "*** File '$(CONFIG_FILE)' is missing. Please run $(TOP)/build/configure")
+endif
 
 # determine OS
 UNAME = $(shell uname -s)
@@ -95,13 +99,13 @@ REMOTE_ARCH = $(ARCH)
 # pick up dependencies from object directory
 ifdef SRCDIR
 	include $(wildcard *.d)
-else
+endif
 
 # determine SRCDIR
 ifdef MODULE
-	SRCDIR=$(TOP)/$(MODULE)
+    SRCDIR=$(TOP)/$(MODULE)
 else
-	SRCDIR=$(TOP)
+    SRCDIR=$(TOP)
 endif
 
 # set COMP, LNKG and BUILD
@@ -111,14 +115,29 @@ BUILD = $(shell test -f $(TOP)/build/BUILD && mv $(TOP)/build/BUILD $(TOP)/build
 TOOLSET := $(COMP)
 
 ifdef USE_GCC_IF_ICC
-ifeq (icc,$(COMP))
-COMP = gcc
-endif
-ifeq (clang,$(COMP))
-COMP = gcc
-endif
+    ifeq (icc,$(COMP))
+        COMP = gcc
+    endif
+    ifeq (clang,$(COMP))
+        COMP = gcc
+    endif
 endif
 
+RHOSTS = $(shell (test -d $(TOP)/rhosts && test -n "$$(ls $(TOP)/rhosts/)") && \
+                  ls $(TOP)/rhosts/ | xargs -n1 basename | grep -v CVS | grep -v example | grep -v "~")
+
+# detect RHOST
+HAS_RHOST = $(shell test -f $(TOP)/build/RHOST.$(HOST_OS) && echo yes || echo no)
+ifeq (yes,$(HAS_RHOST))
+    include $(TOP)/build/RHOST.$(HOST_OS)
+	ifeq (,$(RPORT))
+		RPORT = 20000
+	endif
+	BUILD_OS = r$(OS)
+	REMOTE_ARCH = $(ARCH)
+	ifeq (,$(LHOME))
+	    LHOME=$(HOME)
+	endif
 endif
 
 # set OUTDIR
@@ -132,8 +151,14 @@ ifeq (,$(ROUTDIR))
 	ROUTDIR = $(RHOME)
 endif
 
-# OS flavor is normally OS
-OSFLAV = $(OS)
+ifeq (yes,$(HAS_RHOST))
+	# set remote flags for calling win-cc.sh and ld.sh)
+	RFLAGS=--rhome "$(RHOME)" --lhome "$(LHOME)" --rhost "$(RHOST)" --rport $(RPORT) --proxy_tool "$(PROXY_TOOL)" \
+ --loutdir "$(OUTDIR)" --routdir "$(ROUTDIR)"
+	# RWORKDIR can be redefined by individual makefiles as needed
+	RWORKDIR = . 
+	RUN_REMOTELY = $(TOP)/build/run_remotely.sh $(PROXY_TOOL) $(RHOST) $(RPORT) $(RHOME) $(LHOME) $(RWORKDIR) $(ROUTDIR) $(OUTDIR)
+endif
 
 # determine BITS
 ifeq (x86_64, $(ARCH))
@@ -148,3 +173,4 @@ endif
 ifeq (sparc32, $(ARCH))
 	BITS = 32
 endif
+
diff --git a/build/Makefile.sun b/build/Makefile.sun
new file mode 100644
index 0000000..264328e
--- /dev/null
+++ b/build/Makefile.sun
@@ -0,0 +1,96 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+# default compiler
+ifeq (,$(COMP))
+	COMP = gcc
+endif
+
+# architecture
+xARCH = $(shell test -f $(TOP)/build/ARCH.sun && cat $(TOP)/build/ARCH.sun)
+ifneq (,$(xARCH))
+
+  # the user has selected an architecture
+  ifeq (i386,$(xARCH))
+    ARCH = i386
+    BITS = 32
+  endif
+  ifeq (x86_64,$(xARCH))
+    ARCH = x86_64
+    BITS = 64
+  endif
+  ifeq (sparc32,$(xARCH))
+    ARCH = sparc32
+    BITS = 32
+  endif
+  ifeq (sparc64,$(xARCH))
+    ARCH = sparc64
+    BITS = 64
+  endif
+
+endif
+
+# handle attempts to set cross-compilation architecture
+ifeq (sparc,$(findstring sparc,$(ARCH)))
+
+sparc32 sparc64:
+	@ echo $@ > $(TOP)/build/ARCH.sun
+
+i386 x86_64:
+	@ echo "Sun builds do not support cross-compilation to this architecture"
+
+else
+
+sparc32 sparc64:
+	@ echo "Sun builds do not support cross-compilation to this architecture"
+
+i386 x86_64:
+	@ echo $@ > $(TOP)/build/ARCH.sun
+
+endif
+
+.PHONY: sparc32 sparc64 i386 x86_64
+
+# library prefix
+LPFX = lib
+
+# file extensions
+OBJX = o
+LOBX = pic.o
+LIBX = a
+SHLX = so
+
+# compilation defines
+DEFINES	:= -DSUN -DUNIX -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D__EXTENSIONS__
+
+# SunOS is a Unix variant
+OS_DAD = unix
+
+# flex+bison: on sun, use source-controlled generated .c/.h files
+YACC = @ true
+LEX = @ true
+
+# build matrix
+COMPILERS = CC
diff --git a/build/Makefile.sun.cc b/build/Makefile.sun.cc
new file mode 100644
index 0000000..6dd99a5
--- /dev/null
+++ b/build/Makefile.sun.cc
@@ -0,0 +1,155 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+# compilers
+CC = cc -c
+CP = c++ -c
+
+# linkers
+LD = $(TOP)/build/ld.sun.cc.sh cc
+LP = $(TOP)/build/ld.sun.cc.sh c++
+
+# tool options
+ifeq (prof, $(BUILD))
+	PROF := -xpg
+endif
+
+ifeq (dbg, $(BUILD))
+	OPT := -g
+	NOPT := -g
+	PED := -xc99=all -Xc -v
+else
+	OPT := -xO3
+endif
+
+BSTATIC = -Bstatic
+BDYNAMIC = -Bdynamic
+BEGIN_WHOLE_ARCHIVE = 
+END_WHOLE_ARCHIVE = 
+
+## build rules
+
+# assembly
+%.o: %.s
+	$(CC) -o $@ $<
+
+# executable image
+%.o: %.c
+	$(CC) -o $@ $(OPT) -D_LOGGING $(CFLAGS) -xMD $<
+%.o: %.cpp
+	$(CP) -o $@ $(OPT) -D_LOGGING $(CPFLAGS) -xMD $<
+%.o: %.cxx
+	$(CP) -o $@ $(OPT) -D_LOGGING $(CPFLAGS) -xMD $<
+
+# non-optimized executable image
+%.nopt.o: %.c
+	$(CC) -o $@ $(NOPT) -D_LOGGING $(CFLAGS) -xMD $<
+%.nopt.o: %.cpp
+	$(CP) -o $@ $(NOPT) -D_LOGGING $(CPFLAGS) -xMD $<
+%.nopt.o: %.cxx
+	$(CP) -o $@ $(NOPT) -D_LOGGING $(CPFLAGS) -xMD $<
+
+# relocatable image
+%.pic.o: %.c
+	$(CC) -o $@ -kPIC $(OPT) $(CFLAGS) -xMD $<
+%.pic.o: %.cpp
+	$(CP) -o $@ -kPIC $(OPT) $(CPFLAGS) -xMD $<
+%.pic.o: %.cxx
+	$(CP) -o $@ -kPIC $(OPT) $(CPFLAGS) -xMD $<
+
+# non-optimized relocatable image
+%.nopt.pic.o: %.c
+	$(CC) -o $@ -kPIC $(NOPT) $(CFLAGS) -xMD $<
+%.nopt.pic.o: %.cpp
+	$(CP) -o $@ -kPIC $(NOPT) $(CPFLAGS) -xMD $<
+%.nopt.pic.o: %.cxx
+	$(CP) -o $@ -kPIC $(NOPT) $(CPFLAGS) -xMD $<
+
+
+# non-optimized relocatable image, byte swapping
+%.swap.nopt.pic.o: %.c
+	$(CC) -o $@ -DSWAP_PERSISTED -kPIC $(NOPT) $(CFLAGS) -xMD $<
+%.swap.nopt.pic.o: %.cpp
+	$(CP) -o $@ -DSWAP_PERSISTED -kPIC $(NOPT) $(CPFLAGS) -xMD $<
+%.swap.nopt.pic.o: %.cxx
+	$(CP) -o $@ -DSWAP_PERSISTED -kPIC $(NOPT) $(CPFLAGS) -xMD $<
+
+# relocatable image with kapp logging
+%.log.pic.o: %.c
+	$(CC) -o $@ -kPIC $(OPT) -D_LOGGING $(CFLAGS) -xMD $<
+%.log.pic.o: %.cpp
+	$(CP) -o $@ -kPIC $(OPT) -D_LOGGING $(CPFLAGS) -xMD $<
+%.log.pic.o: %.cxx
+	$(CP) -o $@ -kPIC $(OPT) -D_LOGGING $(CPFLAGS) -xMD $<
+
+# non-optimized relocatable image with kapp logging
+%.nopt.log.pic.o: %.c
+	$(CC) -o $@ -kPIC $(NOPT) -D_LOGGING $(CFLAGS) -xMD $<
+%.log.nopt.pic.o: %.c
+	$(CC) -o $@ -kPIC $(NOPT) -D_LOGGING $(CFLAGS) -xMD $<
+%.log.nopt.pic.o: %.cpp
+	$(CP) -o $@ -kPIC $(NOPT) -D_LOGGING $(CPFLAGS) -xMD $<
+%.log.nopt.pic.o: %.cxx
+	$(CP) -o $@ -kPIC $(NOPT) -D_LOGGING $(CPFLAGS) -xMD $<
+
+
+# non-optimized relocatable image with kapp logging, byte swapping
+%.swap.nopt.log.pic.o: %.c
+	$(CC) -o $@ -DSWAP_PERSISTED -kPIC $(NOPT) -D_LOGGING $(CFLAGS) -xMD $<
+%.swap.log.nopt.pic.o: %.c
+	$(CC) -o $@ -DSWAP_PERSISTED -kPIC $(NOPT) -D_LOGGING $(CFLAGS) -xMD $<
+%.swap.log.nopt.pic.o: %.cpp
+	$(CP) -o $@ -DSWAP_PERSISTED -kPIC $(NOPT) -D_LOGGING $(CPFLAGS) -xMD $<
+%.swap.log.nopt.pic.o: %.cxx
+	$(CP) -o $@ -DSWAP_PERSISTED -kPIC $(NOPT) -D_LOGGING $(CPFLAGS) -xMD $<
+
+# assembly language output
+%.s: %.c
+	$(CC) -S -o $@ $(OPT) $(CFLAGS) -xMD $<
+%.s: %.cpp
+	$(CP) -S -o $@ $(OPT) $(CPFLAGS) -xMD $<
+%.s: %.cxx
+	$(CP) -S -o $@ $(OPT) $(CPFLAGS) -xMD $<
+
+%.nopt.s: %.c
+	$(CC) -S -o $@ $(NOPT) $(CFLAGS) -xMD $<
+%.nopt.s: %.cpp
+	$(CP) -S -o $@ $(NOPT) $(CPFLAGS) -xMD $<
+%.nopt.s: %.cxx
+	$(CP) -S -o $@ $(NOPT) $(CPFLAGS) -xMD $<
+
+%.pic.s: %.c
+	$(CC) -S -o $@ -kPIC $(OPT) $(CFLAGS) -xMD $<
+%.pic.s: %.cpp
+	$(CP) -S -o $@ -kPIC $(OPT) $(CPFLAGS) -xMD $<
+%.pic.s: %.cxx
+	$(CP) -S -o $@ -kPIC $(OPT) $(CPFLAGS) -xMD $<
+
+%.nopt.pic.s: %.c
+	$(CC) -S -o $@ -kPIC $(NOPT) $(CFLAGS) -xMD $<
+%.nopt.pic.s: %.cpp
+	$(CP) -S -o $@ -kPIC $(NOPT) $(CPFLAGS) -xMD $<
+%.nopt.pic.s: %.cxx
+	$(CP) -S -o $@ -kPIC $(NOPT) $(CPFLAGS) -xMD $<
diff --git a/build/Makefile.sun.gcc b/build/Makefile.sun.gcc
new file mode 100644
index 0000000..0838f79
--- /dev/null
+++ b/build/Makefile.sun.gcc
@@ -0,0 +1,138 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+# compilers
+CC = gcc -c
+CP = g++ -c
+
+# linkers
+LD = $(TOP)/build/ld.linux.gcc.sh gcc
+LP = $(TOP)/build/ld.linux.gcc.sh g++
+
+# tool options
+ifeq (prof, $(BUILD))
+	PROF := -pg
+endif
+
+ifeq (dbg, $(BUILD))
+	OPT := -g -Wall
+	NOPT := -g -Wall
+	PED := -std=c99 -ansi -pedantic
+else
+
+ifeq (x86_64, $(ARCH))
+	OPT := -O3 -Wall
+else
+	OPT := -O3 -march=pentium4
+endif
+endif
+
+BSTATIC = -Wl,-Bstatic
+BDYNAMIC = -Wl,-Bdynamic
+BEGIN_WHOLE_ARCHIVE = -Wl,-whole-archive
+END_WHOLE_ARCHIVE = -Wl,-no-whole-archive
+
+## build rules
+
+# assembly
+%.o: %.s
+	$(CC) -o $@ $<
+
+# executable image
+%.o: %.c
+	$(CC) -o $@ $(OPT) -D_LOGGING $(CFLAGS) -MD $<
+%.o: %.cpp
+	$(CP) -o $@ $(OPT) -D_LOGGING $(CPFLAGS) -MD $<
+%.o: %.cxx
+	$(CP) -o $@ $(OPT) -D_LOGGING $(CPFLAGS) -MD $<
+
+# non-optimized executable image
+%.nopt.o: %.c
+	$(CC) -o $@ $(NOPT) -D_LOGGING $(CFLAGS) -MD $<
+%.nopt.o: %.cpp
+	$(CP) -o $@ $(NOPT) -D_LOGGING $(CPFLAGS) -MD $<
+%.nopt.o: %.cxx
+	$(CP) -o $@ $(NOPT) -D_LOGGING $(CPFLAGS) -MD $<
+
+# relocatable image
+%.pic.o: %.c
+	$(CC) -o $@ -fPIC $(OPT) $(CFLAGS) -MD $<
+%.pic.o: %.cpp
+	$(CP) -o $@ -fPIC $(OPT) $(CPFLAGS) -MD $<
+%.pic.o: %.cxx
+	$(CP) -o $@ -fPIC $(OPT) $(CPFLAGS) -MD $<
+
+# non-optimized relocatable image
+%.nopt.pic.o: %.c
+	$(CC) -o $@ -fPIC $(NOPT) $(CFLAGS) -MD $<
+%.nopt.pic.o: %.cpp
+	$(CP) -o $@ -fPIC $(NOPT) $(CPFLAGS) -MD $<
+%.nopt.pic.o: %.cxx
+	$(CP) -o $@ -fPIC $(NOPT) $(CPFLAGS) -MD $<
+
+# relocatable image with kapp logging
+%.log.pic.o: %.c
+	$(CC) -o $@ -fPIC $(OPT) -D_LOGGING $(CFLAGS) -MD $<
+%.log.pic.o: %.cpp
+	$(CP) -o $@ -fPIC $(OPT) -D_LOGGING $(CPFLAGS) -MD $<
+%.log.pic.o: %.cxx
+	$(CP) -o $@ -fPIC $(OPT) -D_LOGGING $(CPFLAGS) -MD $<
+
+# non-optimized relocatable image with kapp logging
+%.log.nopt.pic.o: %.c
+	$(CC) -o $@ -fPIC $(NOPT) -D_LOGGING $(CFLAGS) -MD $<
+%.log.nopt.pic.o: %.cpp
+	$(CP) -o $@ -fPIC $(NOPT) -D_LOGGING $(CPFLAGS) -MD $<
+%.log.nopt.pic.o: %.cxx
+	$(CP) -o $@ -fPIC $(NOPT) -D_LOGGING $(CPFLAGS) -MD $<
+
+# assembly language output
+%.s: %.c
+	$(CC) -S -o $@ $(OPT) $(CFLAGS) -MD $<
+%.s: %.cpp
+	$(CP) -S -o $@ $(OPT) $(CPFLAGS) -MD $<
+%.s: %.cxx
+	$(CP) -S -o $@ $(OPT) $(CPFLAGS) -MD $<
+
+%.nopt.s: %.c
+	$(CC) -S -o $@ $(NOPT) $(CFLAGS) -MD $<
+%.nopt.s: %.cpp
+	$(CP) -S -o $@ $(NOPT) $(CPFLAGS) -MD $<
+%.nopt.s: %.cxx
+	$(CP) -S -o $@ $(NOPT) $(CPFLAGS) -MD $<
+
+%.pic.s: %.c
+	$(CC) -S -o $@ -fPIC $(OPT) $(CFLAGS) -MD $<
+%.pic.s: %.cpp
+	$(CP) -S -o $@ -fPIC $(OPT) $(CPFLAGS) -MD $<
+%.pic.s: %.cxx
+	$(CP) -S -o $@ -fPIC $(OPT) $(CPFLAGS) -MD $<
+
+%.nopt.pic.s: %.c
+	$(CC) -S -o $@ -fPIC $(NOPT) $(CFLAGS) -MD $<
+%.nopt.pic.s: %.cpp
+	$(CP) -S -o $@ -fPIC $(NOPT) $(CPFLAGS) -MD $<
+%.nopt.pic.s: %.cxx
+	$(CP) -S -o $@ -fPIC $(NOPT) $(CPFLAGS) -MD $<
diff --git a/build/Makefile.targets b/build/Makefile.targets
index fc83a63..cd36e1a 100644
--- a/build/Makefile.targets
+++ b/build/Makefile.targets
@@ -27,7 +27,6 @@
 #   all
 #   std
 #   clean
-#   buildtests
 #   runtests
 #   slowtests
 #
@@ -38,14 +37,17 @@
 #   SUBDIRS_CLEAN = $(addsuffix _clean, du4r1 dir2 dir3)
 #
 
-default: $(SUBDIRS) 
+default: $(SUBDIRS) $(DFLT_EXTRA)
+
+ALL_EXTRA ?= $(DFLT_EXTRA)
+STD_EXTRA ?= $(DFLT_EXTRA)
 
 #-------------------------------------------------------------------------------
 # all
 #
 SUBDIRS_ALL ?= $(addsuffix _all,$(SUBDIRS))
 
-all: $(SUBDIRS_ALL)
+all: $(SUBDIRS_ALL) $(ALL_EXTRA)
 
 $(SUBDIRS_ALL):
 	@ $(MAKE) -C $(subst _all,,$@) all
@@ -57,7 +59,7 @@ $(SUBDIRS_ALL):
 #
 SUBDIRS_STD = $(addsuffix _std,$(SUBDIRS))
 
-std: $(SUBDIRS_STD)
+std: $(SUBDIRS_STD) $(STD_EXTRA)
 
 $(SUBDIRS_STD): 
 	@ $(MAKE) -C $(subst _std,,$@) std
@@ -89,18 +91,6 @@ $(SUBDIRS_RUNTESTS):
 .PHONY: runtests $(SUBDIRS_RUNTESTS)
 
 #-------------------------------------------------------------------------------
-# buildtests
-#
-SUBDIRS_BUILDTESTS ?= $(addsuffix _buildtests, $(SUBDIRS))
-
-buildtests: std $(SUBDIRS_BUILDTESTS)
-
-$(SUBDIRS_BUILDTESTS):
-	@ $(MAKE) -C $(subst _buildtests,,$@) buildtests
-
-.PHONY: buildtests $(SUBDIRS_BUILDTESTS)
-
-#-------------------------------------------------------------------------------
 # slowtests
 #
 SUBDIRS_SLOWTESTS ?= $(addsuffix _slowtests, $(SUBDIRS))
diff --git a/build/Makefile.vc++ b/build/Makefile.vc++
index e480497..4e0163d 100644
--- a/build/Makefile.vc++
+++ b/build/Makefile.vc++
@@ -24,12 +24,12 @@
 
 # RFLAGS have to go before any other flags since they can affect their handling
 # compilers
-CC = @ $(TOP)/build/win-cc.sh $(BUILD_OS) "cl /c /D_WIN32_WINNT=0x0502" \
+CC = @ $(TOP)/build/win-cc.sh $(BUILD_OS) "cl /c /MD /D_WIN32_WINNT=0x0502" \
 	 $(CHECKSUM) --objx $(OBJX) $(RFLAGS) $(CFLAGS) -MD -D_CRT_SECURE_NO_WARNINGS
-	 
-CP = @ $(TOP)/build/win-cc.sh $(BUILD_OS) "cl /c" \
+
+CP = @ $(TOP)/build/win-cc.sh $(BUILD_OS) "cl /c /MD" \
 	 $(CHECKSUM) --objx $(OBJX) $(RFLAGS) $(CPFLAGS) -MD -EHsc
-	 
+
 
 # C preprocessor
 PP = gcc -E $(CFLAGS)
@@ -55,9 +55,10 @@ NOPT := -Od $(OPT)
 
 ifeq (64,$(BITS))
 	CARCH = #-m64
+	WARN := -wd4101
 else
 	CARCH = #-m32
-	WARN := #-Wall
+	WARN := -wd4101
 endif
 
 ifeq (prof, $(BUILD))
@@ -75,6 +76,6 @@ else
 # Removing either the 2 or the t makes it seem to work
 # But there is a warning about not knowing what /Ob is
 # if the 2 is removed.  But not if the 2 is there.
-# Woo hoo Microsoft...
+# Woo hoo...
 	OPT += -Ob2iy  -w
 endif
diff --git a/build/Makefile.win b/build/Makefile.win
index 5644350..bc13684 100644
--- a/build/Makefile.win
+++ b/build/Makefile.win
@@ -56,11 +56,24 @@ SHLX = lib
 DLLX = dll
 
 # compilation defines
-DEFINES	:= -DWINDOWS
+DEFINES	:= -DWINDOWS -DPKGNAME=win$(BITS)
 
-# flex+bison: on Windows, use source-controlled generated .c/.h files
-YACC = @ true
-LEX = @ true
+# flex+bison: make sure only correct versions are used
+# otherwise, use source-controlled generated .c/.h files
+ifeq (bison (GNU Bison) 2.5, $(shell bison -V | grep "2\.5"))
+    YACC = bison -l
+else
+    YACC = @ $(warning bison version 2.5 is not found: $(shell bison -V)) true
+endif
+ifeq (flex 2.5.35, $(shell flex -V))
+    LEX  = flex -L
+else
+    LEX = @ $(warning flex version 2.5.35 is not found: $(shell flex -V)) true
+endif
 
 # build matrix
 COMPILERS = VC++
+
+ifeq (dbg, $(BUILD))
+	PED = -pedantic
+endif
diff --git a/build/Xcode/asm-trace/asm-trace.xcodeproj/project.pbxproj b/build/Xcode/asm-trace/asm-trace.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..43a4878
--- /dev/null
+++ b/build/Xcode/asm-trace/asm-trace.xcodeproj/project.pbxproj
@@ -0,0 +1,4444 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 45;
+	objects = {
+
+/* Begin PBXAggregateTarget section */
+		9D7357F311779B2A009EA3E4 /* make-env */ = {
+			isa = PBXAggregateTarget;
+			buildConfigurationList = 9D7357F611779B49009EA3E4 /* Build configuration list for PBXAggregateTarget "make-env" */;
+			buildPhases = (
+				9D7357F211779B2A009EA3E4 /* ShellScript */,
+			);
+			dependencies = (
+			);
+			name = "make-env";
+			productName = "make-env";
+		};
+/* End PBXAggregateTarget section */
+
+/* Begin PBXBuildFile section */
+		9D1235BC14F571AC00ECC72C /* config-grammar.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D1235B414F571AC00ECC72C /* config-grammar.c */; };
+		9D1235BE14F571AC00ECC72C /* config-lex.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D1235B614F571AC00ECC72C /* config-lex.c */; };
+		9D1EC483122D914C00C11287 /* printf.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D1EC47F122D914C00C11287 /* printf.c */; };
+		9D1EC484122D914C00C11287 /* status-rc-strings.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D1EC480122D914C00C11287 /* status-rc-strings.c */; };
+		9D1EC485122D914C00C11287 /* status-rc.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D1EC481122D914C00C11287 /* status-rc.c */; };
+		9D1EC486122D914C00C11287 /* status.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D1EC482122D914C00C11287 /* status.c */; };
+		9D31EC9D1176680A003CDA5E /* bstpersist.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EAFE11766366003CDA5E /* bstpersist.c */; };
+		9D31EC9E1176680A003CDA5E /* container.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EAFF11766366003CDA5E /* container.c */; };
+		9D31EC9F1176680B003CDA5E /* cp1252.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB0011766366003CDA5E /* cp1252.c */; };
+		9D31ECA01176680B003CDA5E /* crc32.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB0111766366003CDA5E /* crc32.c */; };
+		9D31ECA11176680C003CDA5E /* data-buffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB0211766366003CDA5E /* data-buffer.c */; };
+		9D31ECA21176680C003CDA5E /* iso8859-1.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB0311766366003CDA5E /* iso8859-1.c */; };
+		9D31ECA31176680D003CDA5E /* iso8859.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB0411766366003CDA5E /* iso8859.c */; };
+		9D31ECA41176680D003CDA5E /* log.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB0511766366003CDA5E /* log.c */; };
+		9D31ECA51176680E003CDA5E /* md5.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB0611766366003CDA5E /* md5.c */; };
+		9D31ECA61176680E003CDA5E /* namelist.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB0711766366003CDA5E /* namelist.c */; };
+		9D31ECA71176680F003CDA5E /* pack.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB0811766366003CDA5E /* pack.c */; };
+		9D31ECA81176680F003CDA5E /* pbstree.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB0911766366003CDA5E /* pbstree.c */; };
+		9D31ECA911766810003CDA5E /* ptpersist.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB0A11766366003CDA5E /* ptpersist.c */; };
+		9D31ECAA11766810003CDA5E /* ptrie.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB0B11766366003CDA5E /* ptrie.c */; };
+		9D31ECAB11766811003CDA5E /* rc-idx-tbl.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB0C11766366003CDA5E /* rc-idx-tbl.c */; };
+		9D31ECAC11766811003CDA5E /* rc-tbl.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB0D11766366003CDA5E /* rc-tbl.c */; };
+		9D31ECAD11766812003CDA5E /* symtab.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB0E11766366003CDA5E /* symtab.c */; };
+		9D31ECAE11766813003CDA5E /* syslog.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB191176637A003CDA5E /* syslog.c */; settings = {COMPILER_FLAGS = "-I ../../../libs/klib"; }; };
+		9D31ECB011766814003CDA5E /* text.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB1011766366003CDA5E /* text.c */; };
+		9D31ECB111766815003CDA5E /* token.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB1111766366003CDA5E /* token.c */; };
+		9D31ECB211766815003CDA5E /* trie.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB1211766366003CDA5E /* trie.c */; };
+		9D31ECB411766816003CDA5E /* unpack.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB1411766366003CDA5E /* unpack.c */; };
+		9D31ECB511766817003CDA5E /* utf8.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB1511766366003CDA5E /* utf8.c */; };
+		9D31ECB611766818003CDA5E /* vector.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB1611766366003CDA5E /* vector.c */; };
+		9D31ECB711766818003CDA5E /* vlen-encode.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB1711766366003CDA5E /* vlen-encode.c */; };
+		9D320AB0142D02B000ACA5AA /* extract_token.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D320AAE142D02B000ACA5AA /* extract_token.c */; };
+		9D320AB1142D02B000ACA5AA /* strtonum.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D320AAF142D02B000ACA5AA /* strtonum.c */; };
+		9D320AB2142D02B000ACA5AA /* extract_token.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D320AAE142D02B000ACA5AA /* extract_token.c */; };
+		9D320AB3142D02B000ACA5AA /* strtonum.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D320AAF142D02B000ACA5AA /* strtonum.c */; };
+		9D320AB6142D02E600ACA5AA /* sprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D320AB5142D02E600ACA5AA /* sprintf.c */; };
+		9D320AB7142D02E600ACA5AA /* sprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D320AB5142D02E600ACA5AA /* sprintf.c */; };
+		9D4DCEAC1423FD9600881098 /* ref-preserve_qual.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D4DCEAB1423FD9600881098 /* ref-preserve_qual.c */; };
+		9D4DCEAD1423FD9600881098 /* ref-preserve_qual.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D4DCEAB1423FD9600881098 /* ref-preserve_qual.c */; };
+		9D62F42A124D01AE003D38E9 /* bsearch.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D62F428124D01AE003D38E9 /* bsearch.c */; };
+		9D62F42B124D01AE003D38E9 /* qsort.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D62F429124D01AE003D38E9 /* qsort.c */; };
+		9D7A40DB13FADBA3003087FF /* SHA-32bit.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A40D913FADBA3003087FF /* SHA-32bit.c */; };
+		9D7A40DC13FADBA3003087FF /* SHA-64bit.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A40DA13FADBA3003087FF /* SHA-64bit.c */; };
+		9D7A40E113FADBEE003087FF /* syserrcode.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A40DF13FADBEE003087FF /* syserrcode.c */; };
+		9D7A40E213FADBEE003087FF /* systime.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A40E013FADBEE003087FF /* systime.c */; };
+		9D7A40FF13FADCFE003087FF /* buffile-write.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A40EE13FADCFE003087FF /* buffile-write.c */; };
+		9D7A410613FADCFE003087FF /* mmap.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A40F513FADCFE003087FF /* mmap.c */; };
+		9D7A410713FADCFE003087FF /* path-priv.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D7A40F613FADCFE003087FF /* path-priv.h */; };
+		9D7A410913FADCFE003087FF /* pmem.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A40F813FADCFE003087FF /* pmem.c */; };
+		9D7A411613FADD33003087FF /* sysdir-priv.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D7A411213FADD33003087FF /* sysdir-priv.h */; };
+		9D7A411713FADD33003087FF /* sysfile-priv.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D7A411313FADD33003087FF /* sysfile-priv.h */; };
+		9D7A413B13FADF74003087FF /* stbarrier.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB1D117663AB003CDA5E /* stbarrier.c */; };
+		9D7A413C13FADF75003087FF /* stcond.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB1E117663AB003CDA5E /* stcond.c */; };
+		9D7A413D13FADF75003087FF /* stlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB1F117663AB003CDA5E /* stlock.c */; };
+		9D7A413E13FADF76003087FF /* stsem.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB20117663AB003CDA5E /* stsem.c */; };
+		9D7A413F13FADF76003087FF /* stthread.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB21117663AB003CDA5E /* stthread.c */; };
+		9D7A414013FADF77003087FF /* sttimeout.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB22117663AB003CDA5E /* sttimeout.c */; };
+		9D7A414213FADF79003087FF /* syslock.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB2E117663D4003CDA5E /* syslock.c */; };
+		9D7A415113FADFC6003087FF /* queue.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A414D13FADFC6003087FF /* queue.c */; };
+		9D7A415213FADFC6003087FF /* sem.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A414E13FADFC6003087FF /* sem.c */; };
+		9D7A415F13FAE01B003087FF /* queue.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A414D13FADFC6003087FF /* queue.c */; };
+		9D7A416013FAE01C003087FF /* sem.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A414E13FADFC6003087FF /* sem.c */; };
+		9D7A416113FAE023003087FF /* syscond.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB2B117663C6003CDA5E /* syscond.c */; };
+		9D7A416213FAE024003087FF /* syslock.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A414C13FADFC6003087FF /* syslock.c */; };
+		9D7A416313FAE026003087FF /* systhread.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB2C117663C6003CDA5E /* systhread.c */; };
+		9D7A416413FAE027003087FF /* systimeout.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB2D117663C6003CDA5E /* systimeout.c */; };
+		9D7A422313FAE325003087FF /* btree.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A417D13FAE1DA003087FF /* btree.c */; };
+		9D7A422413FAE333003087FF /* dbmgr-cmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A419213FAE1DA003087FF /* dbmgr-cmn.c */; };
+		9D7A423913FAE40C003087FF /* libkdb-cmn.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D7A417813FAE192003087FF /* libkdb-cmn.a */; };
+		9D7A423B13FAE433003087FF /* coldata.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A418013FAE1DA003087FF /* coldata.c */; };
+		9D7A423C13FAE435003087FF /* colidx.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A418313FAE1DA003087FF /* colidx.c */; };
+		9D7A423E13FAE43F003087FF /* colidx0.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A418513FAE1DA003087FF /* colidx0.c */; };
+		9D7A423F13FAE444003087FF /* colidx1.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A418713FAE1DA003087FF /* colidx1.c */; };
+		9D7A424013FAE446003087FF /* colidx2.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A418913FAE1DA003087FF /* colidx2.c */; };
+		9D7A424113FAE470003087FF /* column-cc.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A418A13FAE1DA003087FF /* column-cc.c */; };
+		9D7A424213FAE477003087FF /* column.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A418C13FAE1DA003087FF /* column.c */; };
+		9D7A424313FAE47A003087FF /* database-cc.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A418D13FAE1DA003087FF /* database-cc.c */; };
+		9D7A424513FAE482003087FF /* database.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A419013FAE1DA003087FF /* database.c */; };
+		9D7A424613FAE484003087FF /* dbcc-cmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A419113FAE1DA003087FF /* dbcc-cmn.c */; };
+		9D7A424713FAE48A003087FF /* dbmgr.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A419413FAE1DA003087FF /* dbmgr.c */; };
+		9D7A424813FAE499003087FF /* index.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A419B13FAE1DA003087FF /* index.c */; };
+		9D7A424913FAE4B0003087FF /* kdb.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A419D13FAE1DA003087FF /* kdb.c */; };
+		9D7A424A13FAE4B4003087FF /* meta.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A41A113FAE1DA003087FF /* meta.c */; };
+		9D7A424B13FAE4B8003087FF /* table-cc.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A41A413FAE1DA003087FF /* table-cc.c */; };
+		9D7A424C13FAE4BA003087FF /* table.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A41A613FAE1DA003087FF /* table.c */; };
+		9D7A424D13FAE4C1003087FF /* trieidx-v1.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A41A813FAE1DA003087FF /* trieidx-v1.c */; };
+		9D7A424E13FAE4C2003087FF /* trieidx-v2.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A41A913FAE1DA003087FF /* trieidx-v2.c */; };
+		9D7A424F13FAE4C9003087FF /* u64idx-v3.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A41AC13FAE1DA003087FF /* u64idx-v3.c */; };
+		9D7A425813FAE616003087FF /* idstats.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A419613FAE1DA003087FF /* idstats.c */; };
+		9D7A425913FAE629003087FF /* trieval-v1.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A41AA13FAE1DA003087FF /* trieval-v1.c */; };
+		9D7A425A13FAE62E003087FF /* ptrieval-v1.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A41A213FAE1DA003087FF /* ptrieval-v1.c */; };
+		9D7A425B13FAE63F003087FF /* trieval-v2.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A41AB13FAE1DA003087FF /* trieval-v2.c */; };
+		9D7A425C13FAE644003087FF /* ptrieval-v2.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A41A313FAE1DA003087FF /* ptrieval-v2.c */; };
+		9D7A426113FAE67B003087FF /* libklib.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D31EC99117667FA003CDA5E /* libklib.dylib */; };
+		9D7A426B13FAE6A5003087FF /* libkdb-cmn.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D7A417813FAE192003087FF /* libkdb-cmn.a */; };
+		9D7A426C13FAE6A7003087FF /* libklib.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D31EC99117667FA003CDA5E /* libklib.dylib */; };
+		9D7A426D13FAE6C0003087FF /* wkdb.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A41C213FAE1DA003087FF /* wkdb.c */; };
+		9D7A426E13FAE6C5003087FF /* wdbmgr.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A41BB13FAE1DA003087FF /* wdbmgr.c */; };
+		9D7A426F13FAE6CC003087FF /* wdatabase.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A41BA13FAE1DA003087FF /* wdatabase.c */; };
+		9D7A427013FAE6D5003087FF /* wtable.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A41C513FAE1DA003087FF /* wtable.c */; };
+		9D7A427113FAE6E1003087FF /* wcolumn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A41B813FAE1DA003087FF /* wcolumn.c */; };
+		9D7A427213FAE6EB003087FF /* wcoldata.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A41AE13FAE1DA003087FF /* wcoldata.c */; };
+		9D7A427413FAE89E003087FF /* wcolidx.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A41B013FAE1DA003087FF /* wcolidx.c */; };
+		9D7A427513FAE8A4003087FF /* wcolidx0.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A41B213FAE1DA003087FF /* wcolidx0.c */; };
+		9D7A427613FAE8A7003087FF /* wcolidx1.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A41B413FAE1DA003087FF /* wcolidx1.c */; };
+		9D7A427713FAE8A8003087FF /* wcolidx2.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A41B613FAE1DA003087FF /* wcolidx2.c */; };
+		9D7A427813FAE8D6003087FF /* widxblk.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A41BE13FAE1DA003087FF /* widxblk.c */; };
+		9D7A427913FAE8DB003087FF /* wmeta.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A41C313FAE1DA003087FF /* wmeta.c */; };
+		9D7A427A13FAE8E7003087FF /* windex.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A41C013FAE1DA003087FF /* windex.c */; };
+		9D7A427B13FAE8ED003087FF /* wtrieidx-v1.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A41C613FAE1DA003087FF /* wtrieidx-v1.c */; };
+		9D7A427C13FAE8EE003087FF /* wtrieidx-v2.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A41C713FAE1DA003087FF /* wtrieidx-v2.c */; };
+		9D7A427D13FAE8F4003087FF /* wu64idx-v3.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A41C813FAE1DA003087FF /* wu64idx-v3.c */; };
+		9D7A427E13FAE90F003087FF /* idxblk.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A419813FAE1DA003087FF /* idxblk.c */; };
+		9D7A42E413FAEA2A003087FF /* dbmgr-cmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A429F13FAEA20003087FF /* dbmgr-cmn.c */; };
+		9D7A42E513FAEA36003087FF /* schema-tok.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42D213FAEA21003087FF /* schema-tok.c */; };
+		9D7A42E613FAEA3C003087FF /* schema-parse.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42CD13FAEA21003087FF /* schema-parse.c */; };
+		9D7A42E713FAEA45003087FF /* schema-type.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42D413FAEA21003087FF /* schema-type.c */; };
+		9D7A42E813FAEA4C003087FF /* schema-func.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42CB13FAEA21003087FF /* schema-func.c */; };
+		9D7A42E913FAEA54003087FF /* schema-prod.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42D013FAEA21003087FF /* schema-prod.c */; };
+		9D7A42EA13FAEA5A003087FF /* schema-expr.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42C913FAEA21003087FF /* schema-expr.c */; };
+		9D7A42EB13FAEA60003087FF /* schema-eval.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42C813FAEA21003087FF /* schema-eval.c */; };
+		9D7A42EC13FAEA65003087FF /* schema-tbl.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42D113FAEA21003087FF /* schema-tbl.c */; };
+		9D7A42ED13FAEA68003087FF /* schema-db.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42C513FAEA21003087FF /* schema-db.c */; };
+		9D7A42EE13FAEA6E003087FF /* schema-dump.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42C613FAEA21003087FF /* schema-dump.c */; };
+		9D7A42EF13FAEA72003087FF /* schema-int.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42CC13FAEA21003087FF /* schema-int.c */; };
+		9D7A42F013FAEA7C003087FF /* schema.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42D513FAEA21003087FF /* schema.c */; };
+		9D7A42F113FAEA85003087FF /* linker-int.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42AA13FAEA20003087FF /* linker-int.c */; };
+		9D7A42F213FAEA8D003087FF /* linker-cmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42A913FAEA20003087FF /* linker-cmn.c */; };
+		9D7A42F313FAEA95003087FF /* database-cmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A429B13FAEA20003087FF /* database-cmn.c */; };
+		9D7A42F413FAEA98003087FF /* database-load.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A429C13FAEA20003087FF /* database-load.c */; };
+		9D7A42F513FAEAA0003087FF /* table-cmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42D713FAEA21003087FF /* table-cmn.c */; };
+		9D7A42F613FAEAA1003087FF /* table-load.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42D813FAEA21003087FF /* table-load.c */; };
+		9D7A42F713FAEAAA003087FF /* cursor-cmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A429813FAEA20003087FF /* cursor-cmn.c */; };
+		9D7A42F813FAEAB2003087FF /* column-cmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A429413FAEA20003087FF /* column-cmn.c */; };
+		9D7A42F913FAEABD003087FF /* prod-cmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42BB13FAEA21003087FF /* prod-cmn.c */; };
+		9D7A42FA13FAEAC0003087FF /* prod-expr.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42BC13FAEA21003087FF /* prod-expr.c */; };
+		9D7A42FB13FAEAC4003087FF /* prod-func.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42BE13FAEA21003087FF /* prod-func.c */; };
+		9D7A42FC13FAEACB003087FF /* phys-cmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42B713FAEA21003087FF /* phys-cmn.c */; };
+		9D7A42FD13FAEAD1003087FF /* phys-load.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42B813FAEA21003087FF /* phys-load.c */; };
+		9D7A42FE13FAEADD003087FF /* blob.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A429113FAEA20003087FF /* blob.c */; };
+		9D7A42FF13FAEAE0003087FF /* blob-headers.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A428E13FAEA20003087FF /* blob-headers.c */; };
+		9D7A430013FAEAE7003087FF /* page-map.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42B413FAEA21003087FF /* page-map.c */; };
+		9D7A430313FAEB42003087FF /* row-id.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42C313FAEA21003087FF /* row-id.c */; };
+		9D7A430413FAEB43003087FF /* row-len.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42C413FAEA21003087FF /* row-len.c */; };
+		9D7A430513FAEB49003087FF /* fixed-row-len.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42A313FAEA20003087FF /* fixed-row-len.c */; };
+		9D7A430613FAEB93003087FF /* merge.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42AD13FAEA21003087FF /* merge.c */; };
+		9D7A430713FAEB99003087FF /* split.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42D613FAEA21003087FF /* split.c */; };
+		9D7A430813FAEBA0003087FF /* compare.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A429713FAEA20003087FF /* compare.c */; };
+		9D7A430913FAEBAE003087FF /* meta-attr-read.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42AF13FAEA21003087FF /* meta-attr-read.c */; };
+		9D7A430B13FAEBB1003087FF /* meta-read.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42B113FAEA21003087FF /* meta-read.c */; };
+		9D7A430C13FAEBB2003087FF /* meta-value.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42B213FAEA21003087FF /* meta-value.c */; };
+		9D7A430D13FAEBBF003087FF /* environment-read.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42A213FAEA20003087FF /* environment-read.c */; };
+		9D7A431013FAEC78003087FF /* cast.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A429313FAEA20003087FF /* cast.c */; };
+		9D7A431113FAEC7A003087FF /* index_lookup.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42A513FAEA20003087FF /* index_lookup.c */; };
+		9D7A431213FAEC7B003087FF /* index_project.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42A613FAEA20003087FF /* index_project.c */; };
+		9D7A431313FAEC7C003087FF /* parameter-read.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42B613FAEA21003087FF /* parameter-read.c */; };
+		9D7A431413FAEC7D003087FF /* range-validate.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42C113FAEA21003087FF /* range-validate.c */; };
+		9D7A431513FAEC7D003087FF /* redimension.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42C213FAEA21003087FF /* redimension.c */; };
+		9D7A431F13FAED40003087FF /* dbmgr.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42A113FAEA20003087FF /* dbmgr.c */; };
+		9D7A432013FAED47003087FF /* linker.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42AC13FAEA21003087FF /* linker.c */; };
+		9D7A432113FAED4E003087FF /* database.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A429E13FAEA20003087FF /* database.c */; };
+		9D7A432213FAED5A003087FF /* table.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42DA13FAEA21003087FF /* table.c */; };
+		9D7A432313FAED61003087FF /* cursor.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A429A13FAEA20003087FF /* cursor.c */; };
+		9D7A432413FAED69003087FF /* column.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A429613FAEA20003087FF /* column.c */; };
+		9D7A432513FAED70003087FF /* prod.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42C013FAEA21003087FF /* prod.c */; };
+		9D7A432613FAED79003087FF /* phys.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42BA13FAEA21003087FF /* phys.c */; };
+		9D7A432913FAEDCC003087FF /* libvdb-cmn.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D7A428913FAE9B5003087FF /* libvdb-cmn.a */; };
+		9D7A432A13FAEDD9003087FF /* libkdb.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D7A423413FAE3F5003087FF /* libkdb.dylib */; };
+		9D7A432D13FAEDE5003087FF /* libklib.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D31EC99117667FA003CDA5E /* libklib.dylib */; };
+		9D7A433013FAEDF6003087FF /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D31EC90117667C6003CDA5E /* libz.dylib */; };
+		9D7A434213FAEE66003087FF /* wcolumn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42DB13FAEA21003087FF /* wcolumn.c */; };
+		9D7A434313FAEE67003087FF /* wcursor.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42DC13FAEA21003087FF /* wcursor.c */; };
+		9D7A434413FAEE68003087FF /* wdatabase.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42DD13FAEA21003087FF /* wdatabase.c */; };
+		9D7A434513FAEE68003087FF /* wdbmgr.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42DE13FAEA21003087FF /* wdbmgr.c */; };
+		9D7A434613FAEE69003087FF /* wlinker.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42DF13FAEA21003087FF /* wlinker.c */; };
+		9D7A434713FAEE6A003087FF /* wphys.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42E013FAEA21003087FF /* wphys.c */; };
+		9D7A434813FAEE6B003087FF /* wprod.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42E113FAEA21003087FF /* wprod.c */; };
+		9D7A434913FAEE6C003087FF /* wtable.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42E213FAEA21003087FF /* wtable.c */; };
+		9D7A434B13FAEECB003087FF /* index_insert.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42A413FAEA20003087FF /* index_insert.c */; };
+		9D7A434C13FAEED1003087FF /* meta-append.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42AE13FAEA21003087FF /* meta-append.c */; };
+		9D7A434D13FAEEDB003087FF /* meta-write.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42B313FAEA21003087FF /* meta-write.c */; };
+		9D7A434E13FAEEE2003087FF /* meta-attr-write.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A42B013FAEA21003087FF /* meta-attr-write.c */; };
+		9D7A435113FAEF00003087FF /* libwkdb.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D7A426813FAE69A003087FF /* libwkdb.dylib */; };
+		9D7A435213FAEF06003087FF /* libvdb-cmn.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D7A428913FAE9B5003087FF /* libvdb-cmn.a */; };
+		9D7A435313FAEF0E003087FF /* libklib.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D31EC99117667FA003CDA5E /* libklib.dylib */; };
+		9D7A435613FAEF1F003087FF /* libkmproc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D7A415C13FAE00E003087FF /* libkmproc.a */; };
+		9D7A435913FAEF26003087FF /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D31EC90117667C6003CDA5E /* libz.dylib */; };
+		9D7A439913FAF20E003087FF /* add-row-id.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A436713FAF20D003087FF /* add-row-id.c */; };
+		9D7A439A13FAF20E003087FF /* bit_or.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A436813FAF20D003087FF /* bit_or.c */; };
+		9D7A439B13FAF20E003087FF /* bunzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A436913FAF20D003087FF /* bunzip.c */; };
+		9D7A439D13FAF20E003087FF /* ceil.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A436B13FAF20D003087FF /* ceil.c */; };
+		9D7A439F13FAF20E003087FF /* clip.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A436D13FAF20D003087FF /* clip.c */; };
+		9D7A43A013FAF20E003087FF /* cut.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A436E13FAF20D003087FF /* cut.c */; };
+		9D7A43A113FAF20E003087FF /* delta.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A436F13FAF20D003087FF /* delta.c */; };
+		9D7A43A213FAF20E003087FF /* deriv.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A437013FAF20D003087FF /* deriv.c */; };
+		9D7A43A313FAF20E003087FF /* diff.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A437113FAF20D003087FF /* diff.c */; };
+		9D7A43A413FAF20E003087FF /* echo.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A437213FAF20D003087FF /* echo.c */; };
+		9D7A43A613FAF20E003087FF /* exists.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A437413FAF20E003087FF /* exists.c */; };
+		9D7A43A713FAF20E003087FF /* floor.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A437513FAF20E003087FF /* floor.c */; };
+		9D7A43A913FAF20E003087FF /* funzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A437713FAF20E003087FF /* funzip.c */; };
+		9D7A43AB13FAF20E003087FF /* integral.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A437913FAF20E003087FF /* integral.c */; };
+		9D7A43AC13FAF20E003087FF /* irzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A437A13FAF20E003087FF /* irzip.c */; };
+		9D7A43B513FAF20E003087FF /* map.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A438313FAF20E003087FF /* map.c */; };
+		9D7A43B713FAF20E003087FF /* max.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A438513FAF20E003087FF /* max.c */; };
+		9D7A43B813FAF20E003087FF /* min.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A438613FAF20E003087FF /* min.c */; };
+		9D7A43B913FAF20E003087FF /* outlier-decoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A438713FAF20E003087FF /* outlier-decoder.c */; };
+		9D7A43BB13FAF20E003087FF /* pack.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A438913FAF20E003087FF /* pack.c */; };
+		9D7A43BC13FAF20E003087FF /* paste.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A438A13FAF20E003087FF /* paste.c */; };
+		9D7A43BD13FAF20E003087FF /* rand_4na_2na.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A438B13FAF20E003087FF /* rand_4na_2na.c */; };
+		9D7A43BE13FAF20E003087FF /* rldecode.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A438C13FAF20E003087FF /* rldecode.c */; };
+		9D7A43C013FAF20E003087FF /* round.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A438E13FAF20E003087FF /* round.c */; };
+		9D7A43C113FAF20E003087FF /* simple-sub-select.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A438F13FAF20E003087FF /* simple-sub-select.c */; };
+		9D7A43C213FAF20E003087FF /* subtract-row-id.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A439013FAF20E003087FF /* subtract-row-id.c */; };
+		9D7A43C313FAF20E003087FF /* sum.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A439113FAF20E003087FF /* sum.c */; };
+		9D7A43C413FAF20E003087FF /* trim.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A439213FAF20E003087FF /* trim.c */; };
+		9D7A43C513FAF20E003087FF /* trunc.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A439313FAF20E003087FF /* trunc.c */; };
+		9D7A43C613FAF20E003087FF /* undelta.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A439413FAF20E003087FF /* undelta.c */; };
+		9D7A43C713FAF20E003087FF /* unpack.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A439513FAF20E003087FF /* unpack.c */; };
+		9D7A43C813FAF20E003087FF /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A439613FAF20E003087FF /* unzip.c */; };
+		9D7A43C913FAF20E003087FF /* vec-sum.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A439713FAF20E003087FF /* vec-sum.c */; };
+		9D7A43CD13FAF23A003087FF /* libvdb.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D7A431C13FAED2E003087FF /* libvdb.dylib */; };
+		9D7A43D013FAF245003087FF /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D31EC90117667C6003CDA5E /* libz.dylib */; };
+		9D7A43D613FAF257003087FF /* libklib.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D31EC99117667FA003CDA5E /* libklib.dylib */; };
+		9D7A43DB13FAF274003087FF /* libbz2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D31EC8C117667C6003CDA5E /* libbz2.dylib */; };
+		9D7A441413FAF3B5003087FF /* qual4_decode.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43F213FAF2EF003087FF /* qual4_decode.c */; };
+		9D7A441513FAF3B5003087FF /* format-spot-name.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43E713FAF2EF003087FF /* format-spot-name.c */; };
+		9D7A441713FAF3B5003087FF /* fpcodec.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43E813FAF2EF003087FF /* fpcodec.c */; };
+		9D7A441813FAF3B5003087FF /* v0-decompress-init.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A440313FAF2EF003087FF /* v0-decompress-init.c */; };
+		9D7A441913FAF3B5003087FF /* extract-coordinates.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43E313FAF2EF003087FF /* extract-coordinates.c */; };
+		9D7A441A13FAF3B5003087FF /* qual4_codec.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D7A43F113FAF2EF003087FF /* qual4_codec.h */; };
+		9D7A441B13FAF3B5003087FF /* libwsraxf.vers.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D7A43EB13FAF2EF003087FF /* libwsraxf.vers.h */; };
+		9D7A441C13FAF3B5003087FF /* untyped.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A440213FAF2EF003087FF /* untyped.c */; };
+		9D7A441D13FAF3B5003087FF /* color-from-dna.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43DF13FAF2EF003087FF /* color-from-dna.c */; };
+		9D7A441E13FAF3B5003087FF /* tokenize-spot_name-454.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43FC13FAF2EF003087FF /* tokenize-spot_name-454.c */; };
+		9D7A441F13FAF3B5003087FF /* process-position.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43F013FAF2EF003087FF /* process-position.c */; };
+		9D7A442113FAF3B5003087FF /* bio-start.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43DE13FAF2EF003087FF /* bio-start.c */; };
+		9D7A442213FAF3B5003087FF /* normalize.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43EE13FAF2EF003087FF /* normalize.c */; };
+		9D7A442313FAF3B5003087FF /* rewrite-spot-name.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43F613FAF2EF003087FF /* rewrite-spot-name.c */; };
+		9D7A442413FAF3B5003087FF /* v0-decompress-local.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D7A440413FAF2EF003087FF /* v0-decompress-local.h */; };
+		9D7A442513FAF3B5003087FF /* tokenize-spot_name-abi.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43FD13FAF2EF003087FF /* tokenize-spot_name-abi.c */; };
+		9D7A442613FAF3B5003087FF /* tokenize-spot_name-ion-torrent.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A440013FAF2EF003087FF /* tokenize-spot_name-ion-torrent.c */; };
+		9D7A442713FAF3B5003087FF /* v0-decompress.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A440513FAF2EF003087FF /* v0-decompress.c */; };
+		9D7A442913FAF3B5003087FF /* swap.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43FB13FAF2EF003087FF /* swap.c */; };
+		9D7A442A13FAF3B5003087FF /* spot-desc.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43F813FAF2EF003087FF /* spot-desc.c */; };
+		9D7A442B13FAF3B5003087FF /* tokenize-spot_name-helicos.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43FE13FAF2EF003087FF /* tokenize-spot_name-helicos.c */; };
+		9D7A442C13FAF3B5003087FF /* denormalize.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43E013FAF2EF003087FF /* denormalize.c */; };
+		9D7A442D13FAF3B5003087FF /* make-position.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43EC13FAF2EF003087FF /* make-position.c */; };
+		9D7A442F13FAF3B5003087FF /* tokenize-spot_name-illumina.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43FF13FAF2EF003087FF /* tokenize-spot_name-illumina.c */; };
+		9D7A443013FAF3B5003087FF /* dna-from-color.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43E113FAF2EF003087FF /* dna-from-color.c */; };
+		9D7A443113FAF3B5003087FF /* index_lookup.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43E913FAF2EF003087FF /* index_lookup.c */; };
+		9D7A443213FAF3B5003087FF /* libsraxf.vers.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D7A43EA13FAF2EF003087FF /* libsraxf.vers.h */; };
+		9D7A443313FAF3B5003087FF /* extract-name_coord.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43E413FAF2EF003087FF /* extract-name_coord.c */; };
+		9D7A443513FAF3B5003087FF /* v0-funcs.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A440713FAF2EF003087FF /* v0-funcs.c */; };
+		9D7A443613FAF3B5003087FF /* rotate.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43F713FAF2EF003087FF /* rotate.c */; };
+		9D7A443813FAF3B5003087FF /* read-seg-from-readn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43F513FAF2EF003087FF /* read-seg-from-readn.c */; };
+		9D7A443913FAF3B5003087FF /* v0-decompress.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D7A440613FAF2EF003087FF /* v0-decompress.h */; };
+		9D7A443A13FAF3B5003087FF /* dynamic-454-read-descriptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43E213FAF2EF003087FF /* dynamic-454-read-descriptor.c */; };
+		9D7A443B13FAF3B5003087FF /* name-tokenizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D7A43ED13FAF2EF003087FF /* name-tokenizer.h */; };
+		9D7A443C13FAF3B5003087FF /* untyped-priv.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D7A440113FAF2EF003087FF /* untyped-priv.h */; };
+		9D7A443D13FAF3B5003087FF /* read-desc.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43F413FAF2EF003087FF /* read-desc.c */; };
+		9D7A444313FAF3F6003087FF /* libklib.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D31EC99117667FA003CDA5E /* libklib.dylib */; };
+		9D7A444613FAF402003087FF /* libvdb.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D7A431C13FAED2E003087FF /* libvdb.dylib */; };
+		9D7A444913FAF411003087FF /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D31EC90117667C6003CDA5E /* libz.dylib */; };
+		9D7A444C13FAF41C003087FF /* libkdb.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D7A423413FAE3F5003087FF /* libkdb.dylib */; };
+		9D7A445B13FAF49A003087FF /* agrep-myersunltd.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A445213FAF48E003087FF /* agrep-myersunltd.c */; };
+		9D7A445C13FAF49A003087FF /* agrep-wumanber.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A445313FAF48E003087FF /* agrep-wumanber.c */; };
+		9D7A445D13FAF49A003087FF /* libksrch.vers.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D7A445713FAF48E003087FF /* libksrch.vers.h */; };
+		9D7A445E13FAF49A003087FF /* agrep-myers.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A445113FAF48E003087FF /* agrep-myers.c */; };
+		9D7A445F13FAF49A003087FF /* fgrep-boyermoore.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A445513FAF48E003087FF /* fgrep-boyermoore.c */; };
+		9D7A446013FAF49A003087FF /* search-priv.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D7A445913FAF48E003087FF /* search-priv.h */; };
+		9D7A446113FAF49A003087FF /* fgrep-dumb.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A445613FAF48E003087FF /* fgrep-dumb.c */; };
+		9D7A446213FAF49A003087FF /* search.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A445A13FAF48E003087FF /* search.c */; };
+		9D7A446313FAF49A003087FF /* agrep-dp.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A445013FAF48E003087FF /* agrep-dp.c */; };
+		9D7A446413FAF49A003087FF /* fgrep-aho.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A445413FAF48E003087FF /* fgrep-aho.c */; };
+		9D7A446513FAF49A003087FF /* nucstrstr.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A445813FAF48E003087FF /* nucstrstr.c */; };
+		9D7A448F13FAF56D003087FF /* seq-restore-read.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A448613FAF539003087FF /* seq-restore-read.c */; };
+		9D7A449013FAF56D003087FF /* raw-restore-read.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A448213FAF539003087FF /* raw-restore-read.c */; };
+		9D7A449113FAF56D003087FF /* align-restore-read.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A447B13FAF539003087FF /* align-restore-read.c */; };
+		9D7A449213FAF56D003087FF /* ref-tbl-sub-select.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A448413FAF539003087FF /* ref-tbl-sub-select.c */; };
+		9D7A449313FAF56D003087FF /* align-local_ref_id.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A447613FAF539003087FF /* align-local_ref_id.c */; };
+		9D7A449413FAF56D003087FF /* align-ref-pos.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A447913FAF539003087FF /* align-ref-pos.c */; };
+		9D7A449613FAF56D003087FF /* align-ref-seq-id.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A447A13FAF539003087FF /* align-ref-seq-id.c */; };
+		9D7A449713FAF56D003087FF /* cigar.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A447C13FAF539003087FF /* cigar.c */; };
+		9D7A449813FAF56D003087FF /* align-ref-name.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A447813FAF539003087FF /* align-ref-name.c */; };
+		9D7A449913FAF56D003087FF /* template-len.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A448713FAF539003087FF /* template-len.c */; };
+		9D7A449A13FAF56D003087FF /* get-sam-flags.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A447D13FAF539003087FF /* get-sam-flags.c */; };
+		9D7A449B13FAF56D003087FF /* ref-restore-read.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A448313FAF539003087FF /* ref-restore-read.c */; };
+		9D7A449C13FAF56D003087FF /* align-local_ref_start.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A447713FAF539003087FF /* align-local_ref_start.c */; };
+		9D7A449D13FAF56D003087FF /* project_read_from_sequence.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A448113FAF539003087FF /* project_read_from_sequence.c */; };
+		9D7A449E13FAF56D003087FF /* not-my-row.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A448013FAF539003087FF /* not-my-row.c */; };
+		9D7A44A313FAF59D003087FF /* libklib.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D31EC99117667FA003CDA5E /* libklib.dylib */; };
+		9D7A44A613FAF5A9003087FF /* libvdb.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D7A431C13FAED2E003087FF /* libvdb.dylib */; };
+		9D7A44C913FB04C2003087FF /* reader-cmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A44AE13FB0494003087FF /* reader-cmn.c */; };
+		9D7A44CA13FB04C2003087FF /* refseq-mgr.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A44B213FB0494003087FF /* refseq-mgr.c */; };
+		9D7A44CB13FB04C2003087FF /* reader-refseq.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A44B013FB0494003087FF /* reader-refseq.c */; };
+		9D7A44D013FB04D8003087FF /* libklib.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D31EC99117667FA003CDA5E /* libklib.dylib */; };
+		9D7A44D113FB04DC003087FF /* libvdb.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D7A431C13FAED2E003087FF /* libvdb.dylib */; };
+		9D7A44D413FB04EF003087FF /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D31EC90117667C6003CDA5E /* libz.dylib */; };
+		9D7A44D913FB051B003087FF /* libkdb.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D7A423413FAE3F5003087FF /* libkdb.dylib */; };
+		9D7A44DC13FB0537003087FF /* libalign.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D7A44C013FB04A9003087FF /* libalign.dylib */; };
+		9D7A453413FB0A5A003087FF /* bzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A436A13FAF20D003087FF /* bzip.c */; };
+		9D7A453513FB0A5D003087FF /* checksum.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A436C13FAF20D003087FF /* checksum.c */; };
+		9D7A453613FB0A65003087FF /* fzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A437813FAF20E003087FF /* fzip.c */; };
+		9D7A453813FB0A7A003087FF /* outlier-encoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A438813FAF20E003087FF /* outlier-encoder.c */; };
+		9D7A453913FB0A82003087FF /* rlencode.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A438D13FAF20E003087FF /* rlencode.c */; };
+		9D7A453A13FB0A8E003087FF /* zip.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A439813FAF20E003087FF /* zip.c */; };
+		9D7A453D13FB0AB1003087FF /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D31EC90117667C6003CDA5E /* libz.dylib */; };
+		9D7A453E13FB0AB2003087FF /* libbz2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D31EC8C117667C6003CDA5E /* libbz2.dylib */; };
+		9D7A454113FB0AC9003087FF /* libwvdb.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D7A433713FAEE0C003087FF /* libwvdb.dylib */; };
+		9D7A454213FB0ACF003087FF /* libwkdb.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D7A426813FAE69A003087FF /* libwkdb.dylib */; };
+		9D7A454313FB0AD5003087FF /* libklib.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D31EC99117667FA003CDA5E /* libklib.dylib */; };
+		9D7A454E13FB0B5F003087FF /* extract-name_fmt.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43E513FAF2EF003087FF /* extract-name_fmt.c */; };
+		9D7A454F13FB0B60003087FF /* extract-spot_name.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43E613FAF2EF003087FF /* extract-spot_name.c */; };
+		9D7A455013FB0B6C003087FF /* stats.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43FA13FAF2EF003087FF /* stats.c */; };
+		9D7A455113FB0B6C003087FF /* stats_quality.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43F913FAF2EF003087FF /* stats_quality.c */; };
+		9D7A455213FB0B76003087FF /* qual4_encode.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43F313FAF2EF003087FF /* qual4_encode.c */; };
+		9D7A455513FB0B86003087FF /* libwvdb.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D7A433713FAEE0C003087FF /* libwvdb.dylib */; };
+		9D7A455613FB0B8B003087FF /* libwkdb.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D7A426813FAE69A003087FF /* libwkdb.dylib */; };
+		9D7A455713FB0B91003087FF /* libklib.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D31EC99117667FA003CDA5E /* libklib.dylib */; };
+		9D7A455B13FB0BCE003087FF /* qual4_decode.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43F213FAF2EF003087FF /* qual4_decode.c */; };
+		9D7A455C13FB0BCE003087FF /* format-spot-name.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43E713FAF2EF003087FF /* format-spot-name.c */; };
+		9D7A455D13FB0BCE003087FF /* fpcodec.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43E813FAF2EF003087FF /* fpcodec.c */; };
+		9D7A455E13FB0BCE003087FF /* v0-decompress-init.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A440313FAF2EF003087FF /* v0-decompress-init.c */; };
+		9D7A455F13FB0BCE003087FF /* extract-coordinates.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43E313FAF2EF003087FF /* extract-coordinates.c */; };
+		9D7A456013FB0BCE003087FF /* untyped.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A440213FAF2EF003087FF /* untyped.c */; };
+		9D7A456113FB0BCE003087FF /* color-from-dna.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43DF13FAF2EF003087FF /* color-from-dna.c */; };
+		9D7A456213FB0BCE003087FF /* tokenize-spot_name-454.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43FC13FAF2EF003087FF /* tokenize-spot_name-454.c */; };
+		9D7A456313FB0BCE003087FF /* process-position.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43F013FAF2EF003087FF /* process-position.c */; };
+		9D7A456513FB0BCE003087FF /* bio-start.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43DE13FAF2EF003087FF /* bio-start.c */; };
+		9D7A456613FB0BCE003087FF /* normalize.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43EE13FAF2EF003087FF /* normalize.c */; };
+		9D7A456713FB0BCE003087FF /* rewrite-spot-name.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43F613FAF2EF003087FF /* rewrite-spot-name.c */; };
+		9D7A456813FB0BCE003087FF /* v0-decompress.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A440513FAF2EF003087FF /* v0-decompress.c */; };
+		9D7A456913FB0BCE003087FF /* tokenize-spot_name-abi.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43FD13FAF2EF003087FF /* tokenize-spot_name-abi.c */; };
+		9D7A456A13FB0BCE003087FF /* tokenize-spot_name-ion-torrent.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A440013FAF2EF003087FF /* tokenize-spot_name-ion-torrent.c */; };
+		9D7A456B13FB0BCE003087FF /* swap.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43FB13FAF2EF003087FF /* swap.c */; };
+		9D7A456C13FB0BCE003087FF /* spot-desc.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43F813FAF2EF003087FF /* spot-desc.c */; };
+		9D7A456D13FB0BCE003087FF /* tokenize-spot_name-helicos.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43FE13FAF2EF003087FF /* tokenize-spot_name-helicos.c */; };
+		9D7A456E13FB0BCE003087FF /* denormalize.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43E013FAF2EF003087FF /* denormalize.c */; };
+		9D7A456F13FB0BCE003087FF /* make-position.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43EC13FAF2EF003087FF /* make-position.c */; };
+		9D7A457013FB0BCE003087FF /* tokenize-spot_name-illumina.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43FF13FAF2EF003087FF /* tokenize-spot_name-illumina.c */; };
+		9D7A457113FB0BCE003087FF /* dna-from-color.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43E113FAF2EF003087FF /* dna-from-color.c */; };
+		9D7A457213FB0BCE003087FF /* index_lookup.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43E913FAF2EF003087FF /* index_lookup.c */; };
+		9D7A457313FB0BCE003087FF /* extract-name_coord.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43E413FAF2EF003087FF /* extract-name_coord.c */; };
+		9D7A457413FB0BCE003087FF /* v0-funcs.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A440713FAF2EF003087FF /* v0-funcs.c */; };
+		9D7A457513FB0BCE003087FF /* rotate.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43F713FAF2EF003087FF /* rotate.c */; };
+		9D7A457613FB0BCE003087FF /* read-seg-from-readn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43F513FAF2EF003087FF /* read-seg-from-readn.c */; };
+		9D7A457713FB0BCE003087FF /* dynamic-454-read-descriptor.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43E213FAF2EF003087FF /* dynamic-454-read-descriptor.c */; };
+		9D7A457813FB0BCE003087FF /* read-desc.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A43F413FAF2EF003087FF /* read-desc.c */; };
+		9D7A457D13FB0C28003087FF /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D31EC90117667C6003CDA5E /* libz.dylib */; };
+		9D7A458113FB0C53003087FF /* exists.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A437413FAF20E003087FF /* exists.c */; };
+		9D7A458213FB0C53003087FF /* bunzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A436913FAF20D003087FF /* bunzip.c */; };
+		9D7A458313FB0C53003087FF /* trim.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A439213FAF20E003087FF /* trim.c */; };
+		9D7A458413FB0C53003087FF /* rldecode.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A438C13FAF20E003087FF /* rldecode.c */; };
+		9D7A458513FB0C53003087FF /* ceil.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A436B13FAF20D003087FF /* ceil.c */; };
+		9D7A458713FB0C53003087FF /* paste.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A438A13FAF20E003087FF /* paste.c */; };
+		9D7A458813FB0C53003087FF /* max.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A438513FAF20E003087FF /* max.c */; };
+		9D7A458913FB0C53003087FF /* vec-sum.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A439713FAF20E003087FF /* vec-sum.c */; };
+		9D7A458A13FB0C53003087FF /* echo.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A437213FAF20D003087FF /* echo.c */; };
+		9D7A458B13FB0C53003087FF /* add-row-id.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A436713FAF20D003087FF /* add-row-id.c */; };
+		9D7A458C13FB0C53003087FF /* delta.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A436F13FAF20D003087FF /* delta.c */; };
+		9D7A458D13FB0C53003087FF /* floor.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A437513FAF20E003087FF /* floor.c */; };
+		9D7A458E13FB0C53003087FF /* subtract-row-id.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A439013FAF20E003087FF /* subtract-row-id.c */; };
+		9D7A458F13FB0C53003087FF /* outlier-decoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A438713FAF20E003087FF /* outlier-decoder.c */; };
+		9D7A459013FB0C53003087FF /* deriv.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A437013FAF20D003087FF /* deriv.c */; };
+		9D7A459113FB0C53003087FF /* bit_or.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A436813FAF20D003087FF /* bit_or.c */; };
+		9D7A459313FB0C53003087FF /* irzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A437A13FAF20E003087FF /* irzip.c */; };
+		9D7A459413FB0C53003087FF /* map.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A438313FAF20E003087FF /* map.c */; };
+		9D7A459513FB0C53003087FF /* pack.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A438913FAF20E003087FF /* pack.c */; };
+		9D7A459613FB0C53003087FF /* sum.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A439113FAF20E003087FF /* sum.c */; };
+		9D7A459713FB0C53003087FF /* unpack.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A439513FAF20E003087FF /* unpack.c */; };
+		9D7A459813FB0C53003087FF /* simple-sub-select.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A438F13FAF20E003087FF /* simple-sub-select.c */; };
+		9D7A459913FB0C53003087FF /* rand_4na_2na.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A438B13FAF20E003087FF /* rand_4na_2na.c */; };
+		9D7A459A13FB0C53003087FF /* min.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A438613FAF20E003087FF /* min.c */; };
+		9D7A459B13FB0C53003087FF /* trunc.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A439313FAF20E003087FF /* trunc.c */; };
+		9D7A459C13FB0C53003087FF /* round.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A438E13FAF20E003087FF /* round.c */; };
+		9D7A459D13FB0C53003087FF /* integral.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A437913FAF20E003087FF /* integral.c */; };
+		9D7A459E13FB0C53003087FF /* cut.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A436E13FAF20D003087FF /* cut.c */; };
+		9D7A459F13FB0C53003087FF /* funzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A437713FAF20E003087FF /* funzip.c */; };
+		9D7A45A013FB0C53003087FF /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A439613FAF20E003087FF /* unzip.c */; };
+		9D7A45A113FB0C53003087FF /* undelta.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A439413FAF20E003087FF /* undelta.c */; };
+		9D7A45A213FB0C53003087FF /* clip.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A436D13FAF20D003087FF /* clip.c */; };
+		9D7A45A313FB0C53003087FF /* diff.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A437113FAF20D003087FF /* diff.c */; };
+		9D7A45B113FB0CB8003087FF /* seq-restore-read.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A448613FAF539003087FF /* seq-restore-read.c */; };
+		9D7A45B213FB0CB8003087FF /* raw-restore-read.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A448213FAF539003087FF /* raw-restore-read.c */; };
+		9D7A45B313FB0CB8003087FF /* align-restore-read.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A447B13FAF539003087FF /* align-restore-read.c */; };
+		9D7A45B413FB0CB8003087FF /* ref-tbl-sub-select.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A448413FAF539003087FF /* ref-tbl-sub-select.c */; };
+		9D7A45B513FB0CB8003087FF /* align-local_ref_id.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A447613FAF539003087FF /* align-local_ref_id.c */; };
+		9D7A45B613FB0CB8003087FF /* align-ref-pos.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A447913FAF539003087FF /* align-ref-pos.c */; };
+		9D7A45B713FB0CB8003087FF /* align-ref-seq-id.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A447A13FAF539003087FF /* align-ref-seq-id.c */; };
+		9D7A45B813FB0CB8003087FF /* cigar.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A447C13FAF539003087FF /* cigar.c */; };
+		9D7A45B913FB0CB8003087FF /* align-ref-name.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A447813FAF539003087FF /* align-ref-name.c */; };
+		9D7A45BA13FB0CB8003087FF /* template-len.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A448713FAF539003087FF /* template-len.c */; };
+		9D7A45BB13FB0CB8003087FF /* get-sam-flags.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A447D13FAF539003087FF /* get-sam-flags.c */; };
+		9D7A45BC13FB0CB8003087FF /* ref-restore-read.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A448313FAF539003087FF /* ref-restore-read.c */; };
+		9D7A45BD13FB0CB8003087FF /* align-local_ref_start.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A447713FAF539003087FF /* align-local_ref_start.c */; };
+		9D7A45BE13FB0CB8003087FF /* project_read_from_sequence.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A448113FAF539003087FF /* project_read_from_sequence.c */; };
+		9D7A45BF13FB0CB8003087FF /* not-my-row.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A448013FAF539003087FF /* not-my-row.c */; };
+		9D7A45C113FB0CB8003087FF /* libklib.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D31EC99117667FA003CDA5E /* libklib.dylib */; };
+		9D7A45C313FB0CB8003087FF /* libalign.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D7A44C013FB04A9003087FF /* libalign.dylib */; };
+		9D7A45C813FB0CE4003087FF /* refseq-stats.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A448513FAF539003087FF /* refseq-stats.c */; };
+		9D7A45CB13FB0D18003087FF /* libwvdb.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D7A433713FAEE0C003087FF /* libwvdb.dylib */; };
+		9D7A45CE13FB0D24003087FF /* libwkdb.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D7A426813FAE69A003087FF /* libwkdb.dylib */; };
+		9D7A45DC13FB0D50003087FF /* reader-cmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A44AE13FB0494003087FF /* reader-cmn.c */; };
+		9D7A45DD13FB0D50003087FF /* refseq-mgr.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A44B213FB0494003087FF /* refseq-mgr.c */; };
+		9D7A45DE13FB0D50003087FF /* reader-refseq.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A44B013FB0494003087FF /* reader-refseq.c */; };
+		9D7A45E013FB0D50003087FF /* libklib.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D31EC99117667FA003CDA5E /* libklib.dylib */; };
+		9D7A45E213FB0D50003087FF /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D31EC90117667C6003CDA5E /* libz.dylib */; };
+		9D7A45E813FB0D72003087FF /* libwvdb.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D7A433713FAEE0C003087FF /* libwvdb.dylib */; };
+		9D7A45E913FB0D76003087FF /* libwkdb.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D7A426813FAE69A003087FF /* libwkdb.dylib */; };
+		9D7A45EA13FB0D95003087FF /* writer-alignment.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A44B413FB0494003087FF /* writer-alignment.c */; };
+		9D7A45EB13FB0D95003087FF /* writer-reference.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A44B913FB0494003087FF /* writer-reference.c */; };
+		9D7A45EC13FB0D95003087FF /* writer-ref.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A44B713FB0494003087FF /* writer-ref.c */; };
+		9D7A45ED13FB0D95003087FF /* writer-refseq.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A44BA13FB0494003087FF /* writer-refseq.c */; };
+		9D7A45EE13FB0D95003087FF /* writer-cmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A44B513FB0494003087FF /* writer-cmn.c */; };
+		9D7A45EF13FB0D95003087FF /* writer-sequence.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A44BB13FB0494003087FF /* writer-sequence.c */; };
+		9D7A460A13FB0F52003087FF /* progressbar.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A460213FB0F0F003087FF /* progressbar.c */; };
+		9D7A460B13FB0F52003087FF /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EAB311766257003CDA5E /* main.c */; };
+		9D7A460C13FB0F52003087FF /* args.c in Sources */ = {isa = PBXBuildFile; fileRef = 9DB6A77911E61CB700168DE0 /* args.c */; };
+		9D7A460D13FB0F52003087FF /* sysmain.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EAB71176626A003CDA5E /* sysmain.c */; };
+		9D7A461813FB1140003087FF /* deseq.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A461013FB1128003087FF /* deseq.c */; };
+		9D7A461913FB114C003087FF /* libkapp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D7A460713FB0F36003087FF /* libkapp.a */; };
+		9D7A463B13FB135F003087FF /* libklib.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D31EC99117667FA003CDA5E /* libklib.dylib */; };
+		9D8198A911D3D39700DA4D3C /* vector_namelist.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D8198A811D3D39700DA4D3C /* vector_namelist.c */; };
+		9D8204F8130F1100009A8B64 /* pagefile.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D8204F7130F1100009A8B64 /* pagefile.c */; };
+		9D8EC41B11C2E49E000F1048 /* pbstree-native.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D8EC41911C2E49E000F1048 /* pbstree-native.c */; };
+		9D8EC41C11C2E49E000F1048 /* pbstree-swapped.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D8EC41A11C2E49E000F1048 /* pbstree-swapped.c */; };
+		9D90F4DB140D8229004A99D6 /* libwvdb.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D7A433713FAEE0C003087FF /* libwvdb.dylib */; };
+		9D985E8D12886C6100849729 /* config.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D985E8C12886C6100849729 /* config.c */; };
+		9DA3A84E125FA3A8005AD5BB /* refcount.c in Sources */ = {isa = PBXBuildFile; fileRef = 9DA3A84D125FA3A8005AD5BB /* refcount.c */; };
+		9DA3A88512663646005AD5BB /* syswriter.c in Sources */ = {isa = PBXBuildFile; fileRef = 9DA3A88412663646005AD5BB /* syswriter.c */; settings = {COMPILER_FLAGS = "-I ../../../libs/klib"; }; };
+		9DA3A8961266375B005AD5BB /* writer.c in Sources */ = {isa = PBXBuildFile; fileRef = 9DA3A8951266375B005AD5BB /* writer.c */; };
+		9DA3A89A12663798005AD5BB /* out.c in Sources */ = {isa = PBXBuildFile; fileRef = 9DA3A89912663798005AD5BB /* out.c */; };
+		9DE559C6140E831000EA61C6 /* libwaxf.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D7A45C713FB0CB8003087FF /* libwaxf.dylib */; };
+		9DE559C7140E831800EA61C6 /* libwvxf.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D7A452F13FB0A3C003087FF /* libwvxf.dylib */; };
+		9DE559C8140E831C00EA61C6 /* libwsraxf.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D7A454B13FB0B4D003087FF /* libwsraxf.dylib */; };
+		9DE55A23140E94B700EA61C6 /* iunzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A437C13FAF20E003087FF /* iunzip.c */; };
+		9DE55A28140E94CB00EA61C6 /* iunzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D7A437C13FAF20E003087FF /* iunzip.c */; };
+		9DE55A79140EA19500EA61C6 /* raw-restore-qual.c in Sources */ = {isa = PBXBuildFile; fileRef = 9DE55A78140EA19500EA61C6 /* raw-restore-qual.c */; };
+		9DE55A7A140EA1CA00EA61C6 /* raw-restore-qual.c in Sources */ = {isa = PBXBuildFile; fileRef = 9DE55A78140EA19500EA61C6 /* raw-restore-qual.c */; };
+		9DE55A85140EA93600EA61C6 /* generate-mismatch-qual.c in Sources */ = {isa = PBXBuildFile; fileRef = 9DE55A84140EA93600EA61C6 /* generate-mismatch-qual.c */; };
+		9DE55A86140EA93600EA61C6 /* generate-mismatch-qual.c in Sources */ = {isa = PBXBuildFile; fileRef = 9DE55A84140EA93600EA61C6 /* generate-mismatch-qual.c */; };
+		9DE55AAF140EC79C00EA61C6 /* mismatch-restore-qual.c in Sources */ = {isa = PBXBuildFile; fileRef = 9DE55AAE140EC79C00EA61C6 /* mismatch-restore-qual.c */; };
+		9DE55AB0140EC79C00EA61C6 /* mismatch-restore-qual.c in Sources */ = {isa = PBXBuildFile; fileRef = 9DE55AAE140EC79C00EA61C6 /* mismatch-restore-qual.c */; };
+		9DE55AFC140EF0B100EA61C6 /* libwkdb.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D7A426813FAE69A003087FF /* libwkdb.dylib */; };
+		9DF1902C128DAEBA00FED4AA /* debug.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D1EC47B122D912500C11287 /* debug.c */; };
+		9DFECDC511766952004EFD0D /* xml.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EB3011766409003CDA5E /* xml.c */; };
+		9DFECDC711766982004EFD0D /* arc.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EAE011766306003CDA5E /* arc.c */; };
+		9DFECDC811766982004EFD0D /* buffile.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EAE111766306003CDA5E /* buffile.c */; };
+		9DFECDC911766982004EFD0D /* bzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EAE211766306003CDA5E /* bzip.c */; };
+		9DFECDCA11766982004EFD0D /* countfile.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EAE311766306003CDA5E /* countfile.c */; };
+		9DFECDCB11766982004EFD0D /* crc32.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EAE411766306003CDA5E /* crc32.c */; };
+		9DFECDCC11766982004EFD0D /* dir_test.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EAE511766306003CDA5E /* dir_test.c */; };
+		9DFECDCD11766982004EFD0D /* directory.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EAE611766306003CDA5E /* directory.c */; };
+		9DFECDCE11766982004EFD0D /* file.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EAEA11766306003CDA5E /* file.c */; };
+		9DFECDD011766982004EFD0D /* gzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EAEC11766306003CDA5E /* gzip.c */; };
+		9DFECDD111766982004EFD0D /* md5.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EAED11766306003CDA5E /* md5.c */; };
+		9DFECDD211766982004EFD0D /* nullfile.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EAEE11766306003CDA5E /* nullfile.c */; };
+		9DFECDD311766982004EFD0D /* sra.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EAEF11766306003CDA5E /* sra.c */; };
+		9DFECDD411766982004EFD0D /* subfile.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EAF011766306003CDA5E /* subfile.c */; };
+		9DFECDD511766982004EFD0D /* sysdir.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EAF71176631D003CDA5E /* sysdir.c */; };
+		9DFECDD611766982004EFD0D /* sysdll.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EAF81176631D003CDA5E /* sysdll.c */; };
+		9DFECDD711766982004EFD0D /* sysfile.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EAF91176631D003CDA5E /* sysfile.c */; };
+		9DFECDD811766982004EFD0D /* sysmmap.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EAFA1176631D003CDA5E /* sysmmap.c */; };
+		9DFECDD911766982004EFD0D /* tar.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EAF111766306003CDA5E /* tar.c */; };
+		9DFECDDA11766982004EFD0D /* teefile.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EAF211766306003CDA5E /* teefile.c */; };
+		9DFECDDB11766982004EFD0D /* toc.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EAF311766306003CDA5E /* toc.c */; };
+		9DFECDDC11766982004EFD0D /* tocdir.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EAF411766306003CDA5E /* tocdir.c */; };
+		9DFECDDD11766982004EFD0D /* tocentry.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EAF511766306003CDA5E /* tocentry.c */; };
+		9DFECDDE11766982004EFD0D /* tocfile.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D31EAF611766306003CDA5E /* tocfile.c */; };
+		9DFECDE6117669DD004EFD0D /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D31EC90117667C6003CDA5E /* libz.dylib */; };
+		9DFECDE7117669E0004EFD0D /* libbz2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D31EC8C117667C6003CDA5E /* libbz2.dylib */; };
+		9DFECDE8117669E0004EFD0D /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D31EC8E117667C6003CDA5E /* libxml2.dylib */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+		9D4DCEDB1423FF6E00881098 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D7A433613FAEE0C003087FF;
+			remoteInfo = wvdb;
+		};
+		9D4DCEE11424001400881098 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D7A426713FAE69A003087FF;
+			remoteInfo = wkdb;
+		};
+		9D4DCEE31424001C00881098 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D31EC98117667FA003CDA5E;
+			remoteInfo = klib;
+		};
+		9D4DCEE61424007400881098 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D7A433613FAEE0C003087FF;
+			remoteInfo = wvdb;
+		};
+		9D4DCEE81424007F00881098 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D7A426713FAE69A003087FF;
+			remoteInfo = wkdb;
+		};
+		9D4DCEEA1424008500881098 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D31EC98117667FA003CDA5E;
+			remoteInfo = klib;
+		};
+		9D4DCEEC142400B400881098 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D7A433613FAEE0C003087FF;
+			remoteInfo = wvdb;
+		};
+		9D4DCEEE142400B900881098 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D7A426713FAE69A003087FF;
+			remoteInfo = wkdb;
+		};
+		9D7A423713FAE3FD003087FF /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D7A417713FAE192003087FF;
+			remoteInfo = "kdb-cmn";
+		};
+		9D7A428313FAE9A0003087FF /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D7A417713FAE192003087FF;
+			remoteInfo = "kdb-cmn";
+		};
+		9D7A446813FAF4A9003087FF /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D7A431B13FAED2E003087FF;
+			remoteInfo = vdb;
+		};
+		9D7A446C13FAF4B3003087FF /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D7A423313FAE3F5003087FF;
+			remoteInfo = kdb;
+		};
+		9D7A446E13FAF4B6003087FF /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D31EC98117667FA003CDA5E;
+			remoteInfo = klib;
+		};
+		9D7A44DF13FB0546003087FF /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D7A44BF13FB04A9003087FF;
+			remoteInfo = align;
+		};
+		9D7A44E113FB0551003087FF /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D7A431B13FAED2E003087FF;
+			remoteInfo = vdb;
+		};
+		9D7A44E513FB0561003087FF /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D31EC98117667FA003CDA5E;
+			remoteInfo = klib;
+		};
+		9D7A44E713FB057E003087FF /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D31EC98117667FA003CDA5E;
+			remoteInfo = klib;
+		};
+		9D7A44E913FB0582003087FF /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D7A431B13FAED2E003087FF;
+			remoteInfo = vdb;
+		};
+		9D7A44EB13FB0597003087FF /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D7A431B13FAED2E003087FF;
+			remoteInfo = vdb;
+		};
+		9D7A44ED13FB0597003087FF /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D7A423313FAE3F5003087FF;
+			remoteInfo = kdb;
+		};
+		9D7A44EF13FB0597003087FF /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D31EC98117667FA003CDA5E;
+			remoteInfo = klib;
+		};
+		9D7A44F113FB05A9003087FF /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D7A423313FAE3F5003087FF;
+			remoteInfo = kdb;
+		};
+		9D7A44F313FB05A9003087FF /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D31EC98117667FA003CDA5E;
+			remoteInfo = klib;
+		};
+		9D7A44F513FB05C9003087FF /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D7A426713FAE69A003087FF;
+			remoteInfo = wkdb;
+		};
+		9D7A44F713FB05C9003087FF /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D31EC98117667FA003CDA5E;
+			remoteInfo = klib;
+		};
+		9D7A44F913FB05C9003087FF /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D7A415B13FAE00E003087FF;
+			remoteInfo = kmproc;
+		};
+		9D7A44FB13FB05EB003087FF /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D31EC98117667FA003CDA5E;
+			remoteInfo = klib;
+		};
+		9D7A44FD13FB05F2003087FF /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D31EC98117667FA003CDA5E;
+			remoteInfo = klib;
+		};
+		9D7A450513FB06AB003087FF /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D7A428813FAE9B5003087FF;
+			remoteInfo = "vdb-cmn";
+		};
+		9D7A450713FB06BD003087FF /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D7A428813FAE9B5003087FF;
+			remoteInfo = "vdb-cmn";
+		};
+		9D7A45AA13FB0CB8003087FF /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D31EC98117667FA003CDA5E;
+			remoteInfo = klib;
+		};
+		9D7A45AE13FB0CB8003087FF /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D7A44BF13FB04A9003087FF;
+			remoteInfo = align;
+		};
+		9D7A45D313FB0D50003087FF /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D31EC98117667FA003CDA5E;
+			remoteInfo = klib;
+		};
+		9D7A45D513FB0D50003087FF /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D7A423313FAE3F5003087FF;
+			remoteInfo = kdb;
+		};
+		9D7A45D713FB0D50003087FF /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D7A431B13FAED2E003087FF;
+			remoteInfo = vdb;
+		};
+		9DE55930140D82BC00EA61C6 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D7A460613FB0F36003087FF;
+			remoteInfo = kapp;
+		};
+		9DE55932140D82BC00EA61C6 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D7A433613FAEE0C003087FF;
+			remoteInfo = wvdb;
+		};
+		9DE55934140D82CD00EA61C6 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D31EC98117667FA003CDA5E;
+			remoteInfo = klib;
+		};
+		9DE55A95140EAC9E00EA61C6 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D7A45A813FB0CB8003087FF;
+			remoteInfo = waxf;
+		};
+		9DE55A97140EAC9E00EA61C6 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D7A454A13FB0B4D003087FF;
+			remoteInfo = wsraxf;
+		};
+		9DE55A99140EAC9E00EA61C6 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D7A452E13FB0A3C003087FF;
+			remoteInfo = wvxf;
+		};
+		9DE55AFD140EF0C800EA61C6 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D7A426713FAE69A003087FF;
+			remoteInfo = wkdb;
+		};
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+		9D1235B414F571AC00ECC72C /* config-grammar.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "config-grammar.c"; path = "../../../libs/kfg/config-grammar.c"; sourceTree = SOURCE_ROOT; };
+		9D1235B514F571AC00ECC72C /* config-grammar.y */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.yacc; name = "config-grammar.y"; path = "../../../libs/kfg/config-grammar.y"; sourceTree = SOURCE_ROOT; };
+		9D1235B614F571AC00ECC72C /* config-lex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "config-lex.c"; path = "../../../libs/kfg/config-lex.c"; sourceTree = SOURCE_ROOT; };
+		9D1235B714F571AC00ECC72C /* config-lex.l */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lex; name = "config-lex.l"; path = "../../../libs/kfg/config-lex.l"; sourceTree = SOURCE_ROOT; };
+		9D1235B814F571AC00ECC72C /* config-tokens.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "config-tokens.h"; path = "../../../libs/kfg/config-tokens.h"; sourceTree = SOURCE_ROOT; };
+		9D1235B914F571AC00ECC72C /* config.linux.kfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = config.linux.kfg; path = ../../../libs/kfg/config.linux.kfg; sourceTree = SOURCE_ROOT; };
+		9D1235BA14F571AC00ECC72C /* config.win.kfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = config.win.kfg; path = ../../../libs/kfg/config.win.kfg; sourceTree = SOURCE_ROOT; };
+		9D1235BB14F571AC00ECC72C /* kfg-parse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "kfg-parse.h"; path = "../../../libs/kfg/kfg-parse.h"; sourceTree = SOURCE_ROOT; };
+		9D1EC47B122D912500C11287 /* debug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = debug.c; path = ../../../libs/klib/debug.c; sourceTree = SOURCE_ROOT; };
+		9D1EC47F122D914C00C11287 /* printf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = printf.c; path = ../../../libs/klib/printf.c; sourceTree = SOURCE_ROOT; };
+		9D1EC480122D914C00C11287 /* status-rc-strings.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "status-rc-strings.c"; path = "../../../libs/klib/status-rc-strings.c"; sourceTree = SOURCE_ROOT; };
+		9D1EC481122D914C00C11287 /* status-rc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "status-rc.c"; path = "../../../libs/klib/status-rc.c"; sourceTree = SOURCE_ROOT; };
+		9D1EC482122D914C00C11287 /* status.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = status.c; path = ../../../libs/klib/status.c; sourceTree = SOURCE_ROOT; };
+		9D31EAB311766257003CDA5E /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = main.c; path = ../../../libs/kapp/main.c; sourceTree = SOURCE_ROOT; };
+		9D31EAB71176626A003CDA5E /* sysmain.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sysmain.c; path = ../../../libs/kapp/unix/sysmain.c; sourceTree = SOURCE_ROOT; };
+		9D31EAE011766306003CDA5E /* arc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = arc.c; path = ../../../libs/kfs/arc.c; sourceTree = SOURCE_ROOT; };
+		9D31EAE111766306003CDA5E /* buffile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = buffile.c; path = ../../../libs/kfs/buffile.c; sourceTree = SOURCE_ROOT; };
+		9D31EAE211766306003CDA5E /* bzip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = bzip.c; path = ../../../libs/kfs/bzip.c; sourceTree = SOURCE_ROOT; };
+		9D31EAE311766306003CDA5E /* countfile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = countfile.c; path = ../../../libs/kfs/countfile.c; sourceTree = SOURCE_ROOT; };
+		9D31EAE411766306003CDA5E /* crc32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = crc32.c; path = ../../../libs/kfs/crc32.c; sourceTree = SOURCE_ROOT; };
+		9D31EAE511766306003CDA5E /* dir_test.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = dir_test.c; path = ../../../libs/kfs/dir_test.c; sourceTree = SOURCE_ROOT; };
+		9D31EAE611766306003CDA5E /* directory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = directory.c; path = ../../../libs/kfs/directory.c; sourceTree = SOURCE_ROOT; };
+		9D31EAE711766306003CDA5E /* ffext.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ffext.c; path = ../../../libs/kfs/ffext.c; sourceTree = SOURCE_ROOT; };
+		9D31EAE811766306003CDA5E /* ffkey.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ffkey.c; path = ../../../libs/kfs/ffkey.c; sourceTree = SOURCE_ROOT; };
+		9D31EAE911766306003CDA5E /* ffmagic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ffmagic.c; path = ../../../libs/kfs/ffmagic.c; sourceTree = SOURCE_ROOT; };
+		9D31EAEA11766306003CDA5E /* file.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = file.c; path = ../../../libs/kfs/file.c; sourceTree = SOURCE_ROOT; };
+		9D31EAEB11766306003CDA5E /* fileformat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = fileformat.c; path = ../../../libs/kfs/fileformat.c; sourceTree = SOURCE_ROOT; };
+		9D31EAEC11766306003CDA5E /* gzip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = gzip.c; path = ../../../libs/kfs/gzip.c; sourceTree = SOURCE_ROOT; };
+		9D31EAED11766306003CDA5E /* md5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = md5.c; path = ../../../libs/kfs/md5.c; sourceTree = SOURCE_ROOT; };
+		9D31EAEE11766306003CDA5E /* nullfile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = nullfile.c; path = ../../../libs/kfs/nullfile.c; sourceTree = SOURCE_ROOT; };
+		9D31EAEF11766306003CDA5E /* sra.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sra.c; path = ../../../libs/kfs/sra.c; sourceTree = SOURCE_ROOT; };
+		9D31EAF011766306003CDA5E /* subfile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = subfile.c; path = ../../../libs/kfs/subfile.c; sourceTree = SOURCE_ROOT; };
+		9D31EAF111766306003CDA5E /* tar.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tar.c; path = ../../../libs/kfs/tar.c; sourceTree = SOURCE_ROOT; };
+		9D31EAF211766306003CDA5E /* teefile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = teefile.c; path = ../../../libs/kfs/teefile.c; sourceTree = SOURCE_ROOT; };
+		9D31EAF311766306003CDA5E /* toc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = toc.c; path = ../../../libs/kfs/toc.c; sourceTree = SOURCE_ROOT; };
+		9D31EAF411766306003CDA5E /* tocdir.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tocdir.c; path = ../../../libs/kfs/tocdir.c; sourceTree = SOURCE_ROOT; };
+		9D31EAF511766306003CDA5E /* tocentry.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tocentry.c; path = ../../../libs/kfs/tocentry.c; sourceTree = SOURCE_ROOT; };
+		9D31EAF611766306003CDA5E /* tocfile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tocfile.c; path = ../../../libs/kfs/tocfile.c; sourceTree = SOURCE_ROOT; };
+		9D31EAF71176631D003CDA5E /* sysdir.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sysdir.c; path = ../../../libs/kfs/unix/sysdir.c; sourceTree = SOURCE_ROOT; };
+		9D31EAF81176631D003CDA5E /* sysdll.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sysdll.c; path = ../../../libs/kfs/unix/sysdll.c; sourceTree = SOURCE_ROOT; };
+		9D31EAF91176631D003CDA5E /* sysfile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sysfile.c; path = ../../../libs/kfs/unix/sysfile.c; sourceTree = SOURCE_ROOT; };
+		9D31EAFA1176631D003CDA5E /* sysmmap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sysmmap.c; path = ../../../libs/kfs/unix/sysmmap.c; sourceTree = SOURCE_ROOT; };
+		9D31EAFE11766366003CDA5E /* bstpersist.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = bstpersist.c; path = ../../../libs/klib/bstpersist.c; sourceTree = SOURCE_ROOT; };
+		9D31EAFF11766366003CDA5E /* container.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = container.c; path = ../../../libs/klib/container.c; sourceTree = SOURCE_ROOT; };
+		9D31EB0011766366003CDA5E /* cp1252.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cp1252.c; path = ../../../libs/klib/cp1252.c; sourceTree = SOURCE_ROOT; };
+		9D31EB0111766366003CDA5E /* crc32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = crc32.c; path = ../../../libs/klib/crc32.c; sourceTree = SOURCE_ROOT; };
+		9D31EB0211766366003CDA5E /* data-buffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "data-buffer.c"; path = "../../../libs/klib/data-buffer.c"; sourceTree = SOURCE_ROOT; };
+		9D31EB0311766366003CDA5E /* iso8859-1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "iso8859-1.c"; path = "../../../libs/klib/iso8859-1.c"; sourceTree = SOURCE_ROOT; };
+		9D31EB0411766366003CDA5E /* iso8859.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = iso8859.c; path = ../../../libs/klib/iso8859.c; sourceTree = SOURCE_ROOT; };
+		9D31EB0511766366003CDA5E /* log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = log.c; path = ../../../libs/klib/log.c; sourceTree = SOURCE_ROOT; };
+		9D31EB0611766366003CDA5E /* md5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = md5.c; path = ../../../libs/klib/md5.c; sourceTree = SOURCE_ROOT; };
+		9D31EB0711766366003CDA5E /* namelist.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = namelist.c; path = ../../../libs/klib/namelist.c; sourceTree = SOURCE_ROOT; };
+		9D31EB0811766366003CDA5E /* pack.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pack.c; path = ../../../libs/klib/pack.c; sourceTree = SOURCE_ROOT; };
+		9D31EB0911766366003CDA5E /* pbstree.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pbstree.c; path = ../../../libs/klib/pbstree.c; sourceTree = SOURCE_ROOT; };
+		9D31EB0A11766366003CDA5E /* ptpersist.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ptpersist.c; path = ../../../libs/klib/ptpersist.c; sourceTree = SOURCE_ROOT; };
+		9D31EB0B11766366003CDA5E /* ptrie.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ptrie.c; path = ../../../libs/klib/ptrie.c; sourceTree = SOURCE_ROOT; };
+		9D31EB0C11766366003CDA5E /* rc-idx-tbl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "rc-idx-tbl.c"; path = "../../../libs/klib/rc-idx-tbl.c"; sourceTree = SOURCE_ROOT; };
+		9D31EB0D11766366003CDA5E /* rc-tbl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "rc-tbl.c"; path = "../../../libs/klib/rc-tbl.c"; sourceTree = SOURCE_ROOT; };
+		9D31EB0E11766366003CDA5E /* symtab.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = symtab.c; path = ../../../libs/klib/symtab.c; sourceTree = SOURCE_ROOT; };
+		9D31EB1011766366003CDA5E /* text.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = text.c; path = ../../../libs/klib/text.c; sourceTree = SOURCE_ROOT; };
+		9D31EB1111766366003CDA5E /* token.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = token.c; path = ../../../libs/klib/token.c; sourceTree = SOURCE_ROOT; };
+		9D31EB1211766366003CDA5E /* trie.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = trie.c; path = ../../../libs/klib/trie.c; sourceTree = SOURCE_ROOT; };
+		9D31EB1311766366003CDA5E /* trieval.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = trieval.c; path = ../../../libs/klib/trieval.c; sourceTree = SOURCE_ROOT; };
+		9D31EB1411766366003CDA5E /* unpack.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = unpack.c; path = ../../../libs/klib/unpack.c; sourceTree = SOURCE_ROOT; };
+		9D31EB1511766366003CDA5E /* utf8.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = utf8.c; path = ../../../libs/klib/utf8.c; sourceTree = SOURCE_ROOT; };
+		9D31EB1611766366003CDA5E /* vector.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = vector.c; path = ../../../libs/klib/vector.c; sourceTree = SOURCE_ROOT; };
+		9D31EB1711766366003CDA5E /* vlen-encode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "vlen-encode.c"; path = "../../../libs/klib/vlen-encode.c"; sourceTree = SOURCE_ROOT; };
+		9D31EB191176637A003CDA5E /* syslog.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = syslog.c; path = ../../../libs/klib/unix/syslog.c; sourceTree = SOURCE_ROOT; };
+		9D31EB1D117663AB003CDA5E /* stbarrier.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = stbarrier.c; path = ../../../libs/kproc/stbarrier.c; sourceTree = SOURCE_ROOT; };
+		9D31EB1E117663AB003CDA5E /* stcond.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = stcond.c; path = ../../../libs/kproc/stcond.c; sourceTree = SOURCE_ROOT; };
+		9D31EB1F117663AB003CDA5E /* stlock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = stlock.c; path = ../../../libs/kproc/stlock.c; sourceTree = SOURCE_ROOT; };
+		9D31EB20117663AB003CDA5E /* stsem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = stsem.c; path = ../../../libs/kproc/stsem.c; sourceTree = SOURCE_ROOT; };
+		9D31EB21117663AB003CDA5E /* stthread.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = stthread.c; path = ../../../libs/kproc/stthread.c; sourceTree = SOURCE_ROOT; };
+		9D31EB22117663AB003CDA5E /* sttimeout.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sttimeout.c; path = ../../../libs/kproc/sttimeout.c; sourceTree = SOURCE_ROOT; };
+		9D31EB2B117663C6003CDA5E /* syscond.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = syscond.c; path = ../../../libs/kproc/unix/syscond.c; sourceTree = SOURCE_ROOT; };
+		9D31EB2C117663C6003CDA5E /* systhread.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = systhread.c; path = ../../../libs/kproc/unix/systhread.c; sourceTree = SOURCE_ROOT; };
+		9D31EB2D117663C6003CDA5E /* systimeout.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = systimeout.c; path = ../../../libs/kproc/unix/systimeout.c; sourceTree = SOURCE_ROOT; };
+		9D31EB2E117663D4003CDA5E /* syslock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = syslock.c; path = ../../../libs/kproc/bsd/syslock.c; sourceTree = SOURCE_ROOT; };
+		9D31EB3011766409003CDA5E /* xml.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = xml.c; path = ../../../libs/kxml/xml.c; sourceTree = SOURCE_ROOT; };
+		9D31EC8C117667C6003CDA5E /* libbz2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libbz2.dylib; path = usr/lib/libbz2.dylib; sourceTree = SDKROOT; };
+		9D31EC8E117667C6003CDA5E /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = usr/lib/libxml2.dylib; sourceTree = SDKROOT; };
+		9D31EC90117667C6003CDA5E /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
+		9D31EC99117667FA003CDA5E /* libklib.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libklib.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+		9D320A0A142B813300ACA5AA /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; name = Makefile; path = ../../../tools/deseq/Makefile; sourceTree = SOURCE_ROOT; };
+		9D320AAE142D02B000ACA5AA /* extract_token.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = extract_token.c; path = ../../../libs/vxf/extract_token.c; sourceTree = SOURCE_ROOT; };
+		9D320AAF142D02B000ACA5AA /* strtonum.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = strtonum.c; path = ../../../libs/vxf/strtonum.c; sourceTree = SOURCE_ROOT; };
+		9D320AB5142D02E600ACA5AA /* sprintf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sprintf.c; path = ../../../libs/vxf/sprintf.c; sourceTree = SOURCE_ROOT; };
+		9D320AD5142D0E3F00ACA5AA /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; name = Makefile; path = ../../../libs/vxf/Makefile; sourceTree = SOURCE_ROOT; };
+		9D4DCEAB1423FD9600881098 /* ref-preserve_qual.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "ref-preserve_qual.c"; path = "../../../libs/axf/ref-preserve_qual.c"; sourceTree = SOURCE_ROOT; };
+		9D62F428124D01AE003D38E9 /* bsearch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = bsearch.c; path = ../../../libs/klib/bsearch.c; sourceTree = SOURCE_ROOT; };
+		9D62F429124D01AE003D38E9 /* qsort.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = qsort.c; path = ../../../libs/klib/qsort.c; sourceTree = SOURCE_ROOT; };
+		9D6FFB31145094DB00952EB7 /* align-access.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "align-access.h"; path = "align/align-access.h"; sourceTree = "<group>"; };
+		9D6FFB32145094DB00952EB7 /* alignarc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = alignarc.h; path = align/alignarc.h; sourceTree = "<group>"; };
+		9D6FFB33145094DB00952EB7 /* alignsrc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = alignsrc.h; path = align/alignsrc.h; sourceTree = "<group>"; };
+		9D6FFB34145094DB00952EB7 /* extern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = extern.h; path = align/extern.h; sourceTree = "<group>"; };
+		9D6FFB35145094DB00952EB7 /* reader-refseq.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "reader-refseq.h"; path = "align/reader-refseq.h"; sourceTree = "<group>"; };
+		9D6FFB36145094DB00952EB7 /* refseq-mgr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "refseq-mgr.h"; path = "align/refseq-mgr.h"; sourceTree = "<group>"; };
+		9D6FFB37145094DB00952EB7 /* writer-alignment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "writer-alignment.h"; path = "align/writer-alignment.h"; sourceTree = "<group>"; };
+		9D6FFB38145094DB00952EB7 /* writer-cmn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "writer-cmn.h"; path = "align/writer-cmn.h"; sourceTree = "<group>"; };
+		9D6FFB39145094DB00952EB7 /* writer-reference.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "writer-reference.h"; path = "align/writer-reference.h"; sourceTree = "<group>"; };
+		9D6FFB3A145094DB00952EB7 /* writer-refseq.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "writer-refseq.h"; path = "align/writer-refseq.h"; sourceTree = "<group>"; };
+		9D6FFB3B145094DB00952EB7 /* writer-sequence.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "writer-sequence.h"; path = "align/writer-sequence.h"; sourceTree = "<group>"; };
+		9D7356C41177554A009EA3E4 /* built-in.vschema */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; includeInIndex = 0; name = "built-in.vschema"; path = "../../../interfaces/vdb/built-in.vschema"; sourceTree = SOURCE_ROOT; };
+		9D7356C51177554A009EA3E4 /* vdb.vschema */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; includeInIndex = 0; name = vdb.vschema; path = ../../../interfaces/vdb/vdb.vschema; sourceTree = SOURCE_ROOT; };
+		9D7356C71177556A009EA3E4 /* ncbi.vschema */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; includeInIndex = 0; name = ncbi.vschema; path = ../../../interfaces/ncbi/ncbi.vschema; sourceTree = SOURCE_ROOT; };
+		9D7356C81177556A009EA3E4 /* spotname.vschema */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; includeInIndex = 0; name = spotname.vschema; path = ../../../interfaces/ncbi/spotname.vschema; sourceTree = SOURCE_ROOT; };
+		9D7356CA117755B4009EA3E4 /* insdc.vschema */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; includeInIndex = 0; name = insdc.vschema; path = ../../../interfaces/insdc/insdc.vschema; sourceTree = SOURCE_ROOT; };
+		9D7356CB117755B4009EA3E4 /* seq.vschema */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; includeInIndex = 0; name = seq.vschema; path = ../../../interfaces/insdc/seq.vschema; sourceTree = SOURCE_ROOT; };
+		9D7356CC117755B4009EA3E4 /* sra.vschema */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; includeInIndex = 0; name = sra.vschema; path = ../../../interfaces/insdc/sra.vschema; sourceTree = SOURCE_ROOT; };
+		9D7356CE117755F4009EA3E4 /* 454.vschema */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; includeInIndex = 0; name = 454.vschema; path = ../../../interfaces/sra/454.vschema; sourceTree = SOURCE_ROOT; };
+		9D7356CF117755F4009EA3E4 /* pevents.vschema */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; includeInIndex = 0; name = pevents.vschema; path = ../../../interfaces/sra/pevents.vschema; sourceTree = SOURCE_ROOT; };
+		9D7A40D913FADBA3003087FF /* SHA-32bit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "SHA-32bit.c"; path = "../../../libs/klib/SHA-32bit.c"; sourceTree = SOURCE_ROOT; };
+		9D7A40DA13FADBA3003087FF /* SHA-64bit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "SHA-64bit.c"; path = "../../../libs/klib/SHA-64bit.c"; sourceTree = SOURCE_ROOT; };
+		9D7A40DF13FADBEE003087FF /* syserrcode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = syserrcode.c; path = ../../../libs/klib/unix/syserrcode.c; sourceTree = SOURCE_ROOT; };
+		9D7A40E013FADBEE003087FF /* systime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = systime.c; path = ../../../libs/klib/unix/systime.c; sourceTree = SOURCE_ROOT; };
+		9D7A40E813FADC66003087FF /* writer-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "writer-priv.h"; path = "../../../libs/klib/writer-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A40ED13FADCFE003087FF /* arrayfile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = arrayfile.c; path = ../../../libs/kfs/arrayfile.c; sourceTree = SOURCE_ROOT; };
+		9D7A40EE13FADCFE003087FF /* buffile-write.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "buffile-write.c"; path = "../../../libs/kfs/buffile-write.c"; sourceTree = SOURCE_ROOT; };
+		9D7A40EF13FADCFE003087FF /* fileformat-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "fileformat-priv.h"; path = "../../../libs/kfs/fileformat-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A40F013FADCFE003087FF /* impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = impl.h; path = ../../../libs/kfs/impl.h; sourceTree = SOURCE_ROOT; };
+		9D7A40F113FADCFE003087FF /* karc-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "karc-priv.h"; path = "../../../libs/kfs/karc-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A40F213FADCFE003087FF /* kfs-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "kfs-priv.h"; path = "../../../libs/kfs/kfs-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A40F313FADCFE003087FF /* manager.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = manager.c; path = ../../../libs/kfs/manager.c; sourceTree = SOURCE_ROOT; };
+		9D7A40F413FADCFE003087FF /* mmap-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "mmap-priv.h"; path = "../../../libs/kfs/mmap-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A40F513FADCFE003087FF /* mmap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mmap.c; path = ../../../libs/kfs/mmap.c; sourceTree = SOURCE_ROOT; };
+		9D7A40F613FADCFE003087FF /* path-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "path-priv.h"; path = "../../../libs/kfs/path-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A40F713FADCFE003087FF /* path.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = path.c; path = ../../../libs/kfs/path.c; sourceTree = SOURCE_ROOT; };
+		9D7A40F813FADCFE003087FF /* pmem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pmem.c; path = ../../../libs/kfs/pmem.c; sourceTree = SOURCE_ROOT; };
+		9D7A40F913FADCFE003087FF /* szip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = szip.c; path = ../../../libs/kfs/szip.c; sourceTree = SOURCE_ROOT; };
+		9D7A40FA13FADCFE003087FF /* toc-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "toc-priv.h"; path = "../../../libs/kfs/toc-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A411213FADD33003087FF /* sysdir-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "sysdir-priv.h"; path = "../../../libs/kfs/unix/sysdir-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A411313FADD33003087FF /* sysfile-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "sysfile-priv.h"; path = "../../../libs/kfs/unix/sysfile-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A411413FADD33003087FF /* sysmmap-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "sysmmap-priv.h"; path = "../../../libs/kfs/unix/sysmmap-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A412E13FADF3A003087FF /* libksproc.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libksproc.a; sourceTree = BUILT_PRODUCTS_DIR; };
+		9D7A414813FADFA1003087FF /* syscond-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "syscond-priv.h"; path = "../../../libs/kproc/unix/syscond-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A414B13FADFC6003087FF /* syslock-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "syslock-priv.h"; sourceTree = "<group>"; };
+		9D7A414C13FADFC6003087FF /* syslock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = syslock.c; sourceTree = "<group>"; };
+		9D7A414D13FADFC6003087FF /* queue.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = queue.c; path = ../../../libs/kproc/queue.c; sourceTree = SOURCE_ROOT; };
+		9D7A414E13FADFC6003087FF /* sem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sem.c; path = ../../../libs/kproc/sem.c; sourceTree = SOURCE_ROOT; };
+		9D7A415C13FAE00E003087FF /* libkmproc.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libkmproc.a; sourceTree = BUILT_PRODUCTS_DIR; };
+		9D7A417813FAE192003087FF /* libkdb-cmn.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libkdb-cmn.a"; sourceTree = BUILT_PRODUCTS_DIR; };
+		9D7A417D13FAE1DA003087FF /* btree.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = btree.c; path = ../../../libs/kdb/btree.c; sourceTree = SOURCE_ROOT; };
+		9D7A417E13FAE1DA003087FF /* cc-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "cc-priv.h"; path = "../../../libs/kdb/cc-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A417F13FAE1DA003087FF /* coldata-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "coldata-priv.h"; path = "../../../libs/kdb/coldata-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A418013FAE1DA003087FF /* coldata.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = coldata.c; path = ../../../libs/kdb/coldata.c; sourceTree = SOURCE_ROOT; };
+		9D7A418113FAE1DA003087FF /* colfmt-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "colfmt-priv.h"; path = "../../../libs/kdb/colfmt-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A418213FAE1DA003087FF /* colidx-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "colidx-priv.h"; path = "../../../libs/kdb/colidx-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A418313FAE1DA003087FF /* colidx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = colidx.c; path = ../../../libs/kdb/colidx.c; sourceTree = SOURCE_ROOT; };
+		9D7A418413FAE1DA003087FF /* colidx0-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "colidx0-priv.h"; path = "../../../libs/kdb/colidx0-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A418513FAE1DA003087FF /* colidx0.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = colidx0.c; path = ../../../libs/kdb/colidx0.c; sourceTree = SOURCE_ROOT; };
+		9D7A418613FAE1DA003087FF /* colidx1-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "colidx1-priv.h"; path = "../../../libs/kdb/colidx1-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A418713FAE1DA003087FF /* colidx1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = colidx1.c; path = ../../../libs/kdb/colidx1.c; sourceTree = SOURCE_ROOT; };
+		9D7A418813FAE1DA003087FF /* colidx2-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "colidx2-priv.h"; path = "../../../libs/kdb/colidx2-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A418913FAE1DA003087FF /* colidx2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = colidx2.c; path = ../../../libs/kdb/colidx2.c; sourceTree = SOURCE_ROOT; };
+		9D7A418A13FAE1DA003087FF /* column-cc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "column-cc.c"; path = "../../../libs/kdb/column-cc.c"; sourceTree = SOURCE_ROOT; };
+		9D7A418B13FAE1DA003087FF /* column-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "column-priv.h"; path = "../../../libs/kdb/column-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A418C13FAE1DA003087FF /* column.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = column.c; path = ../../../libs/kdb/column.c; sourceTree = SOURCE_ROOT; };
+		9D7A418D13FAE1DA003087FF /* database-cc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "database-cc.c"; path = "../../../libs/kdb/database-cc.c"; sourceTree = SOURCE_ROOT; };
+		9D7A418E13FAE1DA003087FF /* database-cmn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "database-cmn.c"; path = "../../../libs/kdb/database-cmn.c"; sourceTree = SOURCE_ROOT; };
+		9D7A418F13FAE1DA003087FF /* database-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "database-priv.h"; path = "../../../libs/kdb/database-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A419013FAE1DA003087FF /* database.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = database.c; path = ../../../libs/kdb/database.c; sourceTree = SOURCE_ROOT; };
+		9D7A419113FAE1DA003087FF /* dbcc-cmn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "dbcc-cmn.c"; path = "../../../libs/kdb/dbcc-cmn.c"; sourceTree = SOURCE_ROOT; };
+		9D7A419213FAE1DA003087FF /* dbmgr-cmn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "dbmgr-cmn.c"; path = "../../../libs/kdb/dbmgr-cmn.c"; sourceTree = SOURCE_ROOT; };
+		9D7A419313FAE1DA003087FF /* dbmgr-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "dbmgr-priv.h"; path = "../../../libs/kdb/dbmgr-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A419413FAE1DA003087FF /* dbmgr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = dbmgr.c; path = ../../../libs/kdb/dbmgr.c; sourceTree = SOURCE_ROOT; };
+		9D7A419513FAE1DA003087FF /* idstats-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "idstats-priv.h"; path = "../../../libs/kdb/idstats-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A419613FAE1DA003087FF /* idstats.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = idstats.c; path = ../../../libs/kdb/idstats.c; sourceTree = SOURCE_ROOT; };
+		9D7A419713FAE1DA003087FF /* idxblk-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "idxblk-priv.h"; path = "../../../libs/kdb/idxblk-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A419813FAE1DA003087FF /* idxblk.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = idxblk.c; path = ../../../libs/kdb/idxblk.c; sourceTree = SOURCE_ROOT; };
+		9D7A419913FAE1DA003087FF /* index-cmn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "index-cmn.h"; path = "../../../libs/kdb/index-cmn.h"; sourceTree = SOURCE_ROOT; };
+		9D7A419A13FAE1DA003087FF /* index-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "index-priv.h"; path = "../../../libs/kdb/index-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A419B13FAE1DA003087FF /* index.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = index.c; path = ../../../libs/kdb/index.c; sourceTree = SOURCE_ROOT; };
+		9D7A419C13FAE1DA003087FF /* kdb-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "kdb-priv.h"; path = "../../../libs/kdb/kdb-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A419D13FAE1DA003087FF /* kdb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = kdb.c; path = ../../../libs/kdb/kdb.c; sourceTree = SOURCE_ROOT; };
+		9D7A419E13FAE1DA003087FF /* kdbfmt-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "kdbfmt-priv.h"; path = "../../../libs/kdb/kdbfmt-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A419F13FAE1DA003087FF /* libkdb.vers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = libkdb.vers.h; path = ../../../libs/kdb/libkdb.vers.h; sourceTree = SOURCE_ROOT; };
+		9D7A41A013FAE1DA003087FF /* libwkdb.vers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = libwkdb.vers.h; path = ../../../libs/kdb/libwkdb.vers.h; sourceTree = SOURCE_ROOT; };
+		9D7A41A113FAE1DA003087FF /* meta.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = meta.c; path = ../../../libs/kdb/meta.c; sourceTree = SOURCE_ROOT; };
+		9D7A41A213FAE1DA003087FF /* ptrieval-v1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "ptrieval-v1.c"; path = "../../../libs/kdb/ptrieval-v1.c"; sourceTree = SOURCE_ROOT; };
+		9D7A41A313FAE1DA003087FF /* ptrieval-v2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "ptrieval-v2.c"; path = "../../../libs/kdb/ptrieval-v2.c"; sourceTree = SOURCE_ROOT; };
+		9D7A41A413FAE1DA003087FF /* table-cc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "table-cc.c"; path = "../../../libs/kdb/table-cc.c"; sourceTree = SOURCE_ROOT; };
+		9D7A41A513FAE1DA003087FF /* table-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "table-priv.h"; path = "../../../libs/kdb/table-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A41A613FAE1DA003087FF /* table.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = table.c; path = ../../../libs/kdb/table.c; sourceTree = SOURCE_ROOT; };
+		9D7A41A713FAE1DA003087FF /* trieidx-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "trieidx-priv.h"; path = "../../../libs/kdb/trieidx-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A41A813FAE1DA003087FF /* trieidx-v1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "trieidx-v1.c"; path = "../../../libs/kdb/trieidx-v1.c"; sourceTree = SOURCE_ROOT; };
+		9D7A41A913FAE1DA003087FF /* trieidx-v2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "trieidx-v2.c"; path = "../../../libs/kdb/trieidx-v2.c"; sourceTree = SOURCE_ROOT; };
+		9D7A41AA13FAE1DA003087FF /* trieval-v1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "trieval-v1.c"; path = "../../../libs/kdb/trieval-v1.c"; sourceTree = SOURCE_ROOT; };
+		9D7A41AB13FAE1DA003087FF /* trieval-v2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "trieval-v2.c"; path = "../../../libs/kdb/trieval-v2.c"; sourceTree = SOURCE_ROOT; };
+		9D7A41AC13FAE1DA003087FF /* u64idx-v3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "u64idx-v3.c"; path = "../../../libs/kdb/u64idx-v3.c"; sourceTree = SOURCE_ROOT; };
+		9D7A41AD13FAE1DA003087FF /* wcoldata-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "wcoldata-priv.h"; path = "../../../libs/kdb/wcoldata-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A41AE13FAE1DA003087FF /* wcoldata.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wcoldata.c; path = ../../../libs/kdb/wcoldata.c; sourceTree = SOURCE_ROOT; };
+		9D7A41AF13FAE1DA003087FF /* wcolidx-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "wcolidx-priv.h"; path = "../../../libs/kdb/wcolidx-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A41B013FAE1DA003087FF /* wcolidx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wcolidx.c; path = ../../../libs/kdb/wcolidx.c; sourceTree = SOURCE_ROOT; };
+		9D7A41B113FAE1DA003087FF /* wcolidx0-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "wcolidx0-priv.h"; path = "../../../libs/kdb/wcolidx0-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A41B213FAE1DA003087FF /* wcolidx0.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wcolidx0.c; path = ../../../libs/kdb/wcolidx0.c; sourceTree = SOURCE_ROOT; };
+		9D7A41B313FAE1DA003087FF /* wcolidx1-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "wcolidx1-priv.h"; path = "../../../libs/kdb/wcolidx1-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A41B413FAE1DA003087FF /* wcolidx1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wcolidx1.c; path = ../../../libs/kdb/wcolidx1.c; sourceTree = SOURCE_ROOT; };
+		9D7A41B513FAE1DA003087FF /* wcolidx2-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "wcolidx2-priv.h"; path = "../../../libs/kdb/wcolidx2-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A41B613FAE1DA003087FF /* wcolidx2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wcolidx2.c; path = ../../../libs/kdb/wcolidx2.c; sourceTree = SOURCE_ROOT; };
+		9D7A41B713FAE1DA003087FF /* wcolumn-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "wcolumn-priv.h"; path = "../../../libs/kdb/wcolumn-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A41B813FAE1DA003087FF /* wcolumn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wcolumn.c; path = ../../../libs/kdb/wcolumn.c; sourceTree = SOURCE_ROOT; };
+		9D7A41B913FAE1DA003087FF /* wdatabase-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "wdatabase-priv.h"; path = "../../../libs/kdb/wdatabase-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A41BA13FAE1DA003087FF /* wdatabase.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wdatabase.c; path = ../../../libs/kdb/wdatabase.c; sourceTree = SOURCE_ROOT; };
+		9D7A41BB13FAE1DA003087FF /* wdbmgr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wdbmgr.c; path = ../../../libs/kdb/wdbmgr.c; sourceTree = SOURCE_ROOT; };
+		9D7A41BC13FAE1DA003087FF /* werror-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "werror-priv.h"; path = "../../../libs/kdb/werror-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A41BD13FAE1DA003087FF /* widxblk-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "widxblk-priv.h"; path = "../../../libs/kdb/widxblk-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A41BE13FAE1DA003087FF /* widxblk.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = widxblk.c; path = ../../../libs/kdb/widxblk.c; sourceTree = SOURCE_ROOT; };
+		9D7A41BF13FAE1DA003087FF /* windex-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "windex-priv.h"; path = "../../../libs/kdb/windex-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A41C013FAE1DA003087FF /* windex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = windex.c; path = ../../../libs/kdb/windex.c; sourceTree = SOURCE_ROOT; };
+		9D7A41C113FAE1DA003087FF /* wkdb-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "wkdb-priv.h"; path = "../../../libs/kdb/wkdb-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A41C213FAE1DA003087FF /* wkdb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wkdb.c; path = ../../../libs/kdb/wkdb.c; sourceTree = SOURCE_ROOT; };
+		9D7A41C313FAE1DA003087FF /* wmeta.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wmeta.c; path = ../../../libs/kdb/wmeta.c; sourceTree = SOURCE_ROOT; };
+		9D7A41C413FAE1DA003087FF /* wtable-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "wtable-priv.h"; path = "../../../libs/kdb/wtable-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A41C513FAE1DA003087FF /* wtable.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wtable.c; path = ../../../libs/kdb/wtable.c; sourceTree = SOURCE_ROOT; };
+		9D7A41C613FAE1DA003087FF /* wtrieidx-v1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "wtrieidx-v1.c"; path = "../../../libs/kdb/wtrieidx-v1.c"; sourceTree = SOURCE_ROOT; };
+		9D7A41C713FAE1DA003087FF /* wtrieidx-v2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "wtrieidx-v2.c"; path = "../../../libs/kdb/wtrieidx-v2.c"; sourceTree = SOURCE_ROOT; };
+		9D7A41C813FAE1DA003087FF /* wu64idx-v3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "wu64idx-v3.c"; path = "../../../libs/kdb/wu64idx-v3.c"; sourceTree = SOURCE_ROOT; };
+		9D7A423413FAE3F5003087FF /* libkdb.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libkdb.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+		9D7A426813FAE69A003087FF /* libwkdb.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libwkdb.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+		9D7A428913FAE9B5003087FF /* libvdb-cmn.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libvdb-cmn.a"; sourceTree = BUILT_PRODUCTS_DIR; };
+		9D7A428E13FAEA20003087FF /* blob-headers.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "blob-headers.c"; path = "../../../libs/vdb/blob-headers.c"; sourceTree = SOURCE_ROOT; };
+		9D7A428F13FAEA20003087FF /* blob-headers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "blob-headers.h"; path = "../../../libs/vdb/blob-headers.h"; sourceTree = SOURCE_ROOT; };
+		9D7A429013FAEA20003087FF /* blob-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "blob-priv.h"; path = "../../../libs/vdb/blob-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A429113FAEA20003087FF /* blob.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = blob.c; path = ../../../libs/vdb/blob.c; sourceTree = SOURCE_ROOT; };
+		9D7A429213FAEA20003087FF /* blob.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = blob.h; path = ../../../libs/vdb/blob.h; sourceTree = SOURCE_ROOT; };
+		9D7A429313FAEA20003087FF /* cast.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cast.c; path = ../../../libs/vdb/cast.c; sourceTree = SOURCE_ROOT; };
+		9D7A429413FAEA20003087FF /* column-cmn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "column-cmn.c"; path = "../../../libs/vdb/column-cmn.c"; sourceTree = SOURCE_ROOT; };
+		9D7A429513FAEA20003087FF /* column-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "column-priv.h"; path = "../../../libs/vdb/column-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A429613FAEA20003087FF /* column.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = column.c; path = ../../../libs/vdb/column.c; sourceTree = SOURCE_ROOT; };
+		9D7A429713FAEA20003087FF /* compare.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = compare.c; path = ../../../libs/vdb/compare.c; sourceTree = SOURCE_ROOT; };
+		9D7A429813FAEA20003087FF /* cursor-cmn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "cursor-cmn.c"; path = "../../../libs/vdb/cursor-cmn.c"; sourceTree = SOURCE_ROOT; };
+		9D7A429913FAEA20003087FF /* cursor-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "cursor-priv.h"; path = "../../../libs/vdb/cursor-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A429A13FAEA20003087FF /* cursor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cursor.c; path = ../../../libs/vdb/cursor.c; sourceTree = SOURCE_ROOT; };
+		9D7A429B13FAEA20003087FF /* database-cmn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "database-cmn.c"; path = "../../../libs/vdb/database-cmn.c"; sourceTree = SOURCE_ROOT; };
+		9D7A429C13FAEA20003087FF /* database-load.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "database-load.c"; path = "../../../libs/vdb/database-load.c"; sourceTree = SOURCE_ROOT; };
+		9D7A429D13FAEA20003087FF /* database-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "database-priv.h"; path = "../../../libs/vdb/database-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A429E13FAEA20003087FF /* database.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = database.c; path = ../../../libs/vdb/database.c; sourceTree = SOURCE_ROOT; };
+		9D7A429F13FAEA20003087FF /* dbmgr-cmn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "dbmgr-cmn.c"; path = "../../../libs/vdb/dbmgr-cmn.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42A013FAEA20003087FF /* dbmgr-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "dbmgr-priv.h"; path = "../../../libs/vdb/dbmgr-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A42A113FAEA20003087FF /* dbmgr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = dbmgr.c; path = ../../../libs/vdb/dbmgr.c; sourceTree = SOURCE_ROOT; };
+		9D7A42A213FAEA20003087FF /* environment-read.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "environment-read.c"; path = "../../../libs/vdb/environment-read.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42A313FAEA20003087FF /* fixed-row-len.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "fixed-row-len.c"; path = "../../../libs/vdb/fixed-row-len.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42A413FAEA20003087FF /* index_insert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = index_insert.c; path = ../../../libs/vdb/index_insert.c; sourceTree = SOURCE_ROOT; };
+		9D7A42A513FAEA20003087FF /* index_lookup.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = index_lookup.c; path = ../../../libs/vdb/index_lookup.c; sourceTree = SOURCE_ROOT; };
+		9D7A42A613FAEA20003087FF /* index_project.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = index_project.c; path = ../../../libs/vdb/index_project.c; sourceTree = SOURCE_ROOT; };
+		9D7A42A713FAEA20003087FF /* libvdb.vers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = libvdb.vers.h; path = ../../../libs/vdb/libvdb.vers.h; sourceTree = SOURCE_ROOT; };
+		9D7A42A813FAEA20003087FF /* libwvdb.vers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = libwvdb.vers.h; path = ../../../libs/vdb/libwvdb.vers.h; sourceTree = SOURCE_ROOT; };
+		9D7A42A913FAEA20003087FF /* linker-cmn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "linker-cmn.c"; path = "../../../libs/vdb/linker-cmn.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42AA13FAEA20003087FF /* linker-int.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "linker-int.c"; path = "../../../libs/vdb/linker-int.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42AB13FAEA21003087FF /* linker-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "linker-priv.h"; path = "../../../libs/vdb/linker-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A42AC13FAEA21003087FF /* linker.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = linker.c; path = ../../../libs/vdb/linker.c; sourceTree = SOURCE_ROOT; };
+		9D7A42AD13FAEA21003087FF /* merge.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = merge.c; path = ../../../libs/vdb/merge.c; sourceTree = SOURCE_ROOT; };
+		9D7A42AE13FAEA21003087FF /* meta-append.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "meta-append.c"; path = "../../../libs/vdb/meta-append.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42AF13FAEA21003087FF /* meta-attr-read.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "meta-attr-read.c"; path = "../../../libs/vdb/meta-attr-read.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42B013FAEA21003087FF /* meta-attr-write.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "meta-attr-write.c"; path = "../../../libs/vdb/meta-attr-write.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42B113FAEA21003087FF /* meta-read.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "meta-read.c"; path = "../../../libs/vdb/meta-read.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42B213FAEA21003087FF /* meta-value.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "meta-value.c"; path = "../../../libs/vdb/meta-value.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42B313FAEA21003087FF /* meta-write.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "meta-write.c"; path = "../../../libs/vdb/meta-write.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42B413FAEA21003087FF /* page-map.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "page-map.c"; path = "../../../libs/vdb/page-map.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42B513FAEA21003087FF /* page-map.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "page-map.h"; path = "../../../libs/vdb/page-map.h"; sourceTree = SOURCE_ROOT; };
+		9D7A42B613FAEA21003087FF /* parameter-read.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "parameter-read.c"; path = "../../../libs/vdb/parameter-read.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42B713FAEA21003087FF /* phys-cmn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "phys-cmn.c"; path = "../../../libs/vdb/phys-cmn.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42B813FAEA21003087FF /* phys-load.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "phys-load.c"; path = "../../../libs/vdb/phys-load.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42B913FAEA21003087FF /* phys-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "phys-priv.h"; path = "../../../libs/vdb/phys-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A42BA13FAEA21003087FF /* phys.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = phys.c; path = ../../../libs/vdb/phys.c; sourceTree = SOURCE_ROOT; };
+		9D7A42BB13FAEA21003087FF /* prod-cmn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "prod-cmn.c"; path = "../../../libs/vdb/prod-cmn.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42BC13FAEA21003087FF /* prod-expr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "prod-expr.c"; path = "../../../libs/vdb/prod-expr.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42BD13FAEA21003087FF /* prod-expr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "prod-expr.h"; path = "../../../libs/vdb/prod-expr.h"; sourceTree = SOURCE_ROOT; };
+		9D7A42BE13FAEA21003087FF /* prod-func.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "prod-func.c"; path = "../../../libs/vdb/prod-func.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42BF13FAEA21003087FF /* prod-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "prod-priv.h"; path = "../../../libs/vdb/prod-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A42C013FAEA21003087FF /* prod.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = prod.c; path = ../../../libs/vdb/prod.c; sourceTree = SOURCE_ROOT; };
+		9D7A42C113FAEA21003087FF /* range-validate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "range-validate.c"; path = "../../../libs/vdb/range-validate.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42C213FAEA21003087FF /* redimension.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = redimension.c; path = ../../../libs/vdb/redimension.c; sourceTree = SOURCE_ROOT; };
+		9D7A42C313FAEA21003087FF /* row-id.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "row-id.c"; path = "../../../libs/vdb/row-id.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42C413FAEA21003087FF /* row-len.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "row-len.c"; path = "../../../libs/vdb/row-len.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42C513FAEA21003087FF /* schema-db.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "schema-db.c"; path = "../../../libs/vdb/schema-db.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42C613FAEA21003087FF /* schema-dump.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "schema-dump.c"; path = "../../../libs/vdb/schema-dump.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42C713FAEA21003087FF /* schema-dump.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "schema-dump.h"; path = "../../../libs/vdb/schema-dump.h"; sourceTree = SOURCE_ROOT; };
+		9D7A42C813FAEA21003087FF /* schema-eval.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "schema-eval.c"; path = "../../../libs/vdb/schema-eval.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42C913FAEA21003087FF /* schema-expr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "schema-expr.c"; path = "../../../libs/vdb/schema-expr.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42CA13FAEA21003087FF /* schema-expr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "schema-expr.h"; path = "../../../libs/vdb/schema-expr.h"; sourceTree = SOURCE_ROOT; };
+		9D7A42CB13FAEA21003087FF /* schema-func.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "schema-func.c"; path = "../../../libs/vdb/schema-func.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42CC13FAEA21003087FF /* schema-int.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "schema-int.c"; path = "../../../libs/vdb/schema-int.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42CD13FAEA21003087FF /* schema-parse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "schema-parse.c"; path = "../../../libs/vdb/schema-parse.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42CE13FAEA21003087FF /* schema-parse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "schema-parse.h"; path = "../../../libs/vdb/schema-parse.h"; sourceTree = SOURCE_ROOT; };
+		9D7A42CF13FAEA21003087FF /* schema-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "schema-priv.h"; path = "../../../libs/vdb/schema-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A42D013FAEA21003087FF /* schema-prod.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "schema-prod.c"; path = "../../../libs/vdb/schema-prod.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42D113FAEA21003087FF /* schema-tbl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "schema-tbl.c"; path = "../../../libs/vdb/schema-tbl.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42D213FAEA21003087FF /* schema-tok.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "schema-tok.c"; path = "../../../libs/vdb/schema-tok.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42D313FAEA21003087FF /* schema-tok.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "schema-tok.h"; path = "../../../libs/vdb/schema-tok.h"; sourceTree = SOURCE_ROOT; };
+		9D7A42D413FAEA21003087FF /* schema-type.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "schema-type.c"; path = "../../../libs/vdb/schema-type.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42D513FAEA21003087FF /* schema.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = schema.c; path = ../../../libs/vdb/schema.c; sourceTree = SOURCE_ROOT; };
+		9D7A42D613FAEA21003087FF /* split.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = split.c; path = ../../../libs/vdb/split.c; sourceTree = SOURCE_ROOT; };
+		9D7A42D713FAEA21003087FF /* table-cmn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "table-cmn.c"; path = "../../../libs/vdb/table-cmn.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42D813FAEA21003087FF /* table-load.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "table-load.c"; path = "../../../libs/vdb/table-load.c"; sourceTree = SOURCE_ROOT; };
+		9D7A42D913FAEA21003087FF /* table-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "table-priv.h"; path = "../../../libs/vdb/table-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A42DA13FAEA21003087FF /* table.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = table.c; path = ../../../libs/vdb/table.c; sourceTree = SOURCE_ROOT; };
+		9D7A42DB13FAEA21003087FF /* wcolumn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wcolumn.c; path = ../../../libs/vdb/wcolumn.c; sourceTree = SOURCE_ROOT; };
+		9D7A42DC13FAEA21003087FF /* wcursor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wcursor.c; path = ../../../libs/vdb/wcursor.c; sourceTree = SOURCE_ROOT; };
+		9D7A42DD13FAEA21003087FF /* wdatabase.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wdatabase.c; path = ../../../libs/vdb/wdatabase.c; sourceTree = SOURCE_ROOT; };
+		9D7A42DE13FAEA21003087FF /* wdbmgr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wdbmgr.c; path = ../../../libs/vdb/wdbmgr.c; sourceTree = SOURCE_ROOT; };
+		9D7A42DF13FAEA21003087FF /* wlinker.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wlinker.c; path = ../../../libs/vdb/wlinker.c; sourceTree = SOURCE_ROOT; };
+		9D7A42E013FAEA21003087FF /* wphys.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wphys.c; path = ../../../libs/vdb/wphys.c; sourceTree = SOURCE_ROOT; };
+		9D7A42E113FAEA21003087FF /* wprod.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wprod.c; path = ../../../libs/vdb/wprod.c; sourceTree = SOURCE_ROOT; };
+		9D7A42E213FAEA21003087FF /* wtable.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wtable.c; path = ../../../libs/vdb/wtable.c; sourceTree = SOURCE_ROOT; };
+		9D7A42E313FAEA21003087FF /* xform-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "xform-priv.h"; path = "../../../libs/vdb/xform-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A431C13FAED2E003087FF /* libvdb.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libvdb.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+		9D7A433713FAEE0C003087FF /* libwvdb.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libwvdb.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+		9D7A436013FAF1AE003087FF /* libvxf.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libvxf.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+		9D7A436713FAF20D003087FF /* add-row-id.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "add-row-id.c"; path = "../../../libs/vxf/add-row-id.c"; sourceTree = SOURCE_ROOT; };
+		9D7A436813FAF20D003087FF /* bit_or.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = bit_or.c; path = ../../../libs/vxf/bit_or.c; sourceTree = SOURCE_ROOT; };
+		9D7A436913FAF20D003087FF /* bunzip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = bunzip.c; path = ../../../libs/vxf/bunzip.c; sourceTree = SOURCE_ROOT; };
+		9D7A436A13FAF20D003087FF /* bzip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = bzip.c; path = ../../../libs/vxf/bzip.c; sourceTree = SOURCE_ROOT; };
+		9D7A436B13FAF20D003087FF /* ceil.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ceil.c; path = ../../../libs/vxf/ceil.c; sourceTree = SOURCE_ROOT; };
+		9D7A436C13FAF20D003087FF /* checksum.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = checksum.c; path = ../../../libs/vxf/checksum.c; sourceTree = SOURCE_ROOT; };
+		9D7A436D13FAF20D003087FF /* clip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = clip.c; path = ../../../libs/vxf/clip.c; sourceTree = SOURCE_ROOT; };
+		9D7A436E13FAF20D003087FF /* cut.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cut.c; path = ../../../libs/vxf/cut.c; sourceTree = SOURCE_ROOT; };
+		9D7A436F13FAF20D003087FF /* delta.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = delta.c; path = ../../../libs/vxf/delta.c; sourceTree = SOURCE_ROOT; };
+		9D7A437013FAF20D003087FF /* deriv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = deriv.c; path = ../../../libs/vxf/deriv.c; sourceTree = SOURCE_ROOT; };
+		9D7A437113FAF20D003087FF /* diff.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = diff.c; path = ../../../libs/vxf/diff.c; sourceTree = SOURCE_ROOT; };
+		9D7A437213FAF20D003087FF /* echo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = echo.c; path = ../../../libs/vxf/echo.c; sourceTree = SOURCE_ROOT; };
+		9D7A437313FAF20E003087FF /* entrez.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = entrez.c; path = ../../../libs/vxf/entrez.c; sourceTree = SOURCE_ROOT; };
+		9D7A437413FAF20E003087FF /* exists.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = exists.c; path = ../../../libs/vxf/exists.c; sourceTree = SOURCE_ROOT; };
+		9D7A437513FAF20E003087FF /* floor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = floor.c; path = ../../../libs/vxf/floor.c; sourceTree = SOURCE_ROOT; };
+		9D7A437613FAF20E003087FF /* fsplit-join.impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "fsplit-join.impl.h"; path = "../../../libs/vxf/fsplit-join.impl.h"; sourceTree = SOURCE_ROOT; };
+		9D7A437713FAF20E003087FF /* funzip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = funzip.c; path = ../../../libs/vxf/funzip.c; sourceTree = SOURCE_ROOT; };
+		9D7A437813FAF20E003087FF /* fzip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = fzip.c; path = ../../../libs/vxf/fzip.c; sourceTree = SOURCE_ROOT; };
+		9D7A437913FAF20E003087FF /* integral.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = integral.c; path = ../../../libs/vxf/integral.c; sourceTree = SOURCE_ROOT; };
+		9D7A437A13FAF20E003087FF /* irzip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = irzip.c; path = ../../../libs/vxf/irzip.c; sourceTree = SOURCE_ROOT; };
+		9D7A437B13FAF20E003087FF /* irzip.impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = irzip.impl.h; path = ../../../libs/vxf/irzip.impl.h; sourceTree = SOURCE_ROOT; };
+		9D7A437C13FAF20E003087FF /* iunzip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = iunzip.c; path = ../../../libs/vxf/iunzip.c; sourceTree = SOURCE_ROOT; };
+		9D7A437D13FAF20E003087FF /* izip-common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "izip-common.h"; path = "../../../libs/vxf/izip-common.h"; sourceTree = SOURCE_ROOT; };
+		9D7A437E13FAF20E003087FF /* izip-decode.impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "izip-decode.impl.h"; path = "../../../libs/vxf/izip-decode.impl.h"; sourceTree = SOURCE_ROOT; };
+		9D7A437F13FAF20E003087FF /* izip-encode.impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "izip-encode.impl.h"; path = "../../../libs/vxf/izip-encode.impl.h"; sourceTree = SOURCE_ROOT; };
+		9D7A438013FAF20E003087FF /* izip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = izip.c; path = ../../../libs/vxf/izip.c; sourceTree = SOURCE_ROOT; };
+		9D7A438113FAF20E003087FF /* libvxf.vers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = libvxf.vers.h; path = ../../../libs/vxf/libvxf.vers.h; sourceTree = SOURCE_ROOT; };
+		9D7A438213FAF20E003087FF /* libvxfentrez.vers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = libvxfentrez.vers.h; path = ../../../libs/vxf/libvxfentrez.vers.h; sourceTree = SOURCE_ROOT; };
+		9D7A438313FAF20E003087FF /* map.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = map.c; path = ../../../libs/vxf/map.c; sourceTree = SOURCE_ROOT; };
+		9D7A438413FAF20E003087FF /* math-funcs-impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "math-funcs-impl.h"; path = "../../../libs/vxf/math-funcs-impl.h"; sourceTree = SOURCE_ROOT; };
+		9D7A438513FAF20E003087FF /* max.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = max.c; path = ../../../libs/vxf/max.c; sourceTree = SOURCE_ROOT; };
+		9D7A438613FAF20E003087FF /* min.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = min.c; path = ../../../libs/vxf/min.c; sourceTree = SOURCE_ROOT; };
+		9D7A438713FAF20E003087FF /* outlier-decoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "outlier-decoder.c"; path = "../../../libs/vxf/outlier-decoder.c"; sourceTree = SOURCE_ROOT; };
+		9D7A438813FAF20E003087FF /* outlier-encoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "outlier-encoder.c"; path = "../../../libs/vxf/outlier-encoder.c"; sourceTree = SOURCE_ROOT; };
+		9D7A438913FAF20E003087FF /* pack.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pack.c; path = ../../../libs/vxf/pack.c; sourceTree = SOURCE_ROOT; };
+		9D7A438A13FAF20E003087FF /* paste.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = paste.c; path = ../../../libs/vxf/paste.c; sourceTree = SOURCE_ROOT; };
+		9D7A438B13FAF20E003087FF /* rand_4na_2na.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = rand_4na_2na.c; path = ../../../libs/vxf/rand_4na_2na.c; sourceTree = SOURCE_ROOT; };
+		9D7A438C13FAF20E003087FF /* rldecode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = rldecode.c; path = ../../../libs/vxf/rldecode.c; sourceTree = SOURCE_ROOT; };
+		9D7A438D13FAF20E003087FF /* rlencode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = rlencode.c; path = ../../../libs/vxf/rlencode.c; sourceTree = SOURCE_ROOT; };
+		9D7A438E13FAF20E003087FF /* round.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = round.c; path = ../../../libs/vxf/round.c; sourceTree = SOURCE_ROOT; };
+		9D7A438F13FAF20E003087FF /* simple-sub-select.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "simple-sub-select.c"; path = "../../../libs/vxf/simple-sub-select.c"; sourceTree = SOURCE_ROOT; };
+		9D7A439013FAF20E003087FF /* subtract-row-id.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "subtract-row-id.c"; path = "../../../libs/vxf/subtract-row-id.c"; sourceTree = SOURCE_ROOT; };
+		9D7A439113FAF20E003087FF /* sum.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sum.c; path = ../../../libs/vxf/sum.c; sourceTree = SOURCE_ROOT; };
+		9D7A439213FAF20E003087FF /* trim.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = trim.c; path = ../../../libs/vxf/trim.c; sourceTree = SOURCE_ROOT; };
+		9D7A439313FAF20E003087FF /* trunc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = trunc.c; path = ../../../libs/vxf/trunc.c; sourceTree = SOURCE_ROOT; };
+		9D7A439413FAF20E003087FF /* undelta.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = undelta.c; path = ../../../libs/vxf/undelta.c; sourceTree = SOURCE_ROOT; };
+		9D7A439513FAF20E003087FF /* unpack.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = unpack.c; path = ../../../libs/vxf/unpack.c; sourceTree = SOURCE_ROOT; };
+		9D7A439613FAF20E003087FF /* unzip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = unzip.c; path = ../../../libs/vxf/unzip.c; sourceTree = SOURCE_ROOT; };
+		9D7A439713FAF20E003087FF /* vec-sum.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "vec-sum.c"; path = "../../../libs/vxf/vec-sum.c"; sourceTree = SOURCE_ROOT; };
+		9D7A439813FAF20E003087FF /* zip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip.c; path = ../../../libs/vxf/zip.c; sourceTree = SOURCE_ROOT; };
+		9D7A43DE13FAF2EF003087FF /* bio-start.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "bio-start.c"; path = "../../../libs/sraxf/bio-start.c"; sourceTree = SOURCE_ROOT; };
+		9D7A43DF13FAF2EF003087FF /* color-from-dna.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "color-from-dna.c"; path = "../../../libs/sraxf/color-from-dna.c"; sourceTree = SOURCE_ROOT; };
+		9D7A43E013FAF2EF003087FF /* denormalize.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = denormalize.c; path = ../../../libs/sraxf/denormalize.c; sourceTree = SOURCE_ROOT; };
+		9D7A43E113FAF2EF003087FF /* dna-from-color.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "dna-from-color.c"; path = "../../../libs/sraxf/dna-from-color.c"; sourceTree = SOURCE_ROOT; };
+		9D7A43E213FAF2EF003087FF /* dynamic-454-read-descriptor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "dynamic-454-read-descriptor.c"; path = "../../../libs/sraxf/dynamic-454-read-descriptor.c"; sourceTree = SOURCE_ROOT; };
+		9D7A43E313FAF2EF003087FF /* extract-coordinates.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "extract-coordinates.c"; path = "../../../libs/sraxf/extract-coordinates.c"; sourceTree = SOURCE_ROOT; };
+		9D7A43E413FAF2EF003087FF /* extract-name_coord.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "extract-name_coord.c"; path = "../../../libs/sraxf/extract-name_coord.c"; sourceTree = SOURCE_ROOT; };
+		9D7A43E513FAF2EF003087FF /* extract-name_fmt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "extract-name_fmt.c"; path = "../../../libs/sraxf/extract-name_fmt.c"; sourceTree = SOURCE_ROOT; };
+		9D7A43E613FAF2EF003087FF /* extract-spot_name.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "extract-spot_name.c"; path = "../../../libs/sraxf/extract-spot_name.c"; sourceTree = SOURCE_ROOT; };
+		9D7A43E713FAF2EF003087FF /* format-spot-name.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "format-spot-name.c"; path = "../../../libs/sraxf/format-spot-name.c"; sourceTree = SOURCE_ROOT; };
+		9D7A43E813FAF2EF003087FF /* fpcodec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = fpcodec.c; path = ../../../libs/sraxf/fpcodec.c; sourceTree = SOURCE_ROOT; };
+		9D7A43E913FAF2EF003087FF /* index_lookup.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = index_lookup.c; path = ../../../libs/sraxf/index_lookup.c; sourceTree = SOURCE_ROOT; };
+		9D7A43EA13FAF2EF003087FF /* libsraxf.vers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = libsraxf.vers.h; path = ../../../libs/sraxf/libsraxf.vers.h; sourceTree = SOURCE_ROOT; };
+		9D7A43EB13FAF2EF003087FF /* libwsraxf.vers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = libwsraxf.vers.h; path = ../../../libs/sraxf/libwsraxf.vers.h; sourceTree = SOURCE_ROOT; };
+		9D7A43EC13FAF2EF003087FF /* make-position.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "make-position.c"; path = "../../../libs/sraxf/make-position.c"; sourceTree = SOURCE_ROOT; };
+		9D7A43ED13FAF2EF003087FF /* name-tokenizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "name-tokenizer.h"; path = "../../../libs/sraxf/name-tokenizer.h"; sourceTree = SOURCE_ROOT; };
+		9D7A43EE13FAF2EF003087FF /* normalize.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = normalize.c; path = ../../../libs/sraxf/normalize.c; sourceTree = SOURCE_ROOT; };
+		9D7A43EF13FAF2EF003087FF /* prefix-tree-to-name.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "prefix-tree-to-name.c"; path = "../../../libs/sraxf/prefix-tree-to-name.c"; sourceTree = SOURCE_ROOT; };
+		9D7A43F013FAF2EF003087FF /* process-position.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "process-position.c"; path = "../../../libs/sraxf/process-position.c"; sourceTree = SOURCE_ROOT; };
+		9D7A43F113FAF2EF003087FF /* qual4_codec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = qual4_codec.h; path = ../../../libs/sraxf/qual4_codec.h; sourceTree = SOURCE_ROOT; };
+		9D7A43F213FAF2EF003087FF /* qual4_decode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = qual4_decode.c; path = ../../../libs/sraxf/qual4_decode.c; sourceTree = SOURCE_ROOT; };
+		9D7A43F313FAF2EF003087FF /* qual4_encode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = qual4_encode.c; path = ../../../libs/sraxf/qual4_encode.c; sourceTree = SOURCE_ROOT; };
+		9D7A43F413FAF2EF003087FF /* read-desc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "read-desc.c"; path = "../../../libs/sraxf/read-desc.c"; sourceTree = SOURCE_ROOT; };
+		9D7A43F513FAF2EF003087FF /* read-seg-from-readn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "read-seg-from-readn.c"; path = "../../../libs/sraxf/read-seg-from-readn.c"; sourceTree = SOURCE_ROOT; };
+		9D7A43F613FAF2EF003087FF /* rewrite-spot-name.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "rewrite-spot-name.c"; path = "../../../libs/sraxf/rewrite-spot-name.c"; sourceTree = SOURCE_ROOT; };
+		9D7A43F713FAF2EF003087FF /* rotate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = rotate.c; path = ../../../libs/sraxf/rotate.c; sourceTree = SOURCE_ROOT; };
+		9D7A43F813FAF2EF003087FF /* spot-desc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "spot-desc.c"; path = "../../../libs/sraxf/spot-desc.c"; sourceTree = SOURCE_ROOT; };
+		9D7A43F913FAF2EF003087FF /* stats_quality.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = stats_quality.c; path = ../../../libs/sraxf/stats_quality.c; sourceTree = SOURCE_ROOT; };
+		9D7A43FA13FAF2EF003087FF /* stats.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = stats.c; path = ../../../libs/sraxf/stats.c; sourceTree = SOURCE_ROOT; };
+		9D7A43FB13FAF2EF003087FF /* swap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = swap.c; path = ../../../libs/sraxf/swap.c; sourceTree = SOURCE_ROOT; };
+		9D7A43FC13FAF2EF003087FF /* tokenize-spot_name-454.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "tokenize-spot_name-454.c"; path = "../../../libs/sraxf/tokenize-spot_name-454.c"; sourceTree = SOURCE_ROOT; };
+		9D7A43FD13FAF2EF003087FF /* tokenize-spot_name-abi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "tokenize-spot_name-abi.c"; path = "../../../libs/sraxf/tokenize-spot_name-abi.c"; sourceTree = SOURCE_ROOT; };
+		9D7A43FE13FAF2EF003087FF /* tokenize-spot_name-helicos.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "tokenize-spot_name-helicos.c"; path = "../../../libs/sraxf/tokenize-spot_name-helicos.c"; sourceTree = SOURCE_ROOT; };
+		9D7A43FF13FAF2EF003087FF /* tokenize-spot_name-illumina.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "tokenize-spot_name-illumina.c"; path = "../../../libs/sraxf/tokenize-spot_name-illumina.c"; sourceTree = SOURCE_ROOT; };
+		9D7A440013FAF2EF003087FF /* tokenize-spot_name-ion-torrent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "tokenize-spot_name-ion-torrent.c"; path = "../../../libs/sraxf/tokenize-spot_name-ion-torrent.c"; sourceTree = SOURCE_ROOT; };
+		9D7A440113FAF2EF003087FF /* untyped-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "untyped-priv.h"; path = "../../../libs/sraxf/untyped-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A440213FAF2EF003087FF /* untyped.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = untyped.c; path = ../../../libs/sraxf/untyped.c; sourceTree = SOURCE_ROOT; };
+		9D7A440313FAF2EF003087FF /* v0-decompress-init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "v0-decompress-init.c"; path = "../../../libs/sraxf/v0-decompress-init.c"; sourceTree = SOURCE_ROOT; };
+		9D7A440413FAF2EF003087FF /* v0-decompress-local.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "v0-decompress-local.h"; path = "../../../libs/sraxf/v0-decompress-local.h"; sourceTree = SOURCE_ROOT; };
+		9D7A440513FAF2EF003087FF /* v0-decompress.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "v0-decompress.c"; path = "../../../libs/sraxf/v0-decompress.c"; sourceTree = SOURCE_ROOT; };
+		9D7A440613FAF2EF003087FF /* v0-decompress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "v0-decompress.h"; path = "../../../libs/sraxf/v0-decompress.h"; sourceTree = SOURCE_ROOT; };
+		9D7A440713FAF2EF003087FF /* v0-funcs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "v0-funcs.c"; path = "../../../libs/sraxf/v0-funcs.c"; sourceTree = SOURCE_ROOT; };
+		9D7A440C13FAF315003087FF /* libsraxf.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libsraxf.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+		9D7A445013FAF48E003087FF /* agrep-dp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "agrep-dp.c"; path = "../../../libs/search/agrep-dp.c"; sourceTree = SOURCE_ROOT; };
+		9D7A445113FAF48E003087FF /* agrep-myers.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "agrep-myers.c"; path = "../../../libs/search/agrep-myers.c"; sourceTree = SOURCE_ROOT; };
+		9D7A445213FAF48E003087FF /* agrep-myersunltd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "agrep-myersunltd.c"; path = "../../../libs/search/agrep-myersunltd.c"; sourceTree = SOURCE_ROOT; };
+		9D7A445313FAF48E003087FF /* agrep-wumanber.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "agrep-wumanber.c"; path = "../../../libs/search/agrep-wumanber.c"; sourceTree = SOURCE_ROOT; };
+		9D7A445413FAF48E003087FF /* fgrep-aho.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "fgrep-aho.c"; path = "../../../libs/search/fgrep-aho.c"; sourceTree = SOURCE_ROOT; };
+		9D7A445513FAF48E003087FF /* fgrep-boyermoore.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "fgrep-boyermoore.c"; path = "../../../libs/search/fgrep-boyermoore.c"; sourceTree = SOURCE_ROOT; };
+		9D7A445613FAF48E003087FF /* fgrep-dumb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "fgrep-dumb.c"; path = "../../../libs/search/fgrep-dumb.c"; sourceTree = SOURCE_ROOT; };
+		9D7A445713FAF48E003087FF /* libksrch.vers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = libksrch.vers.h; path = ../../../libs/search/libksrch.vers.h; sourceTree = SOURCE_ROOT; };
+		9D7A445813FAF48E003087FF /* nucstrstr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = nucstrstr.c; path = ../../../libs/search/nucstrstr.c; sourceTree = SOURCE_ROOT; };
+		9D7A445913FAF48E003087FF /* search-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "search-priv.h"; path = "../../../libs/search/search-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A445A13FAF48E003087FF /* search.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = search.c; path = ../../../libs/search/search.c; sourceTree = SOURCE_ROOT; };
+		9D7A447613FAF539003087FF /* align-local_ref_id.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "align-local_ref_id.c"; path = "../../../libs/axf/align-local_ref_id.c"; sourceTree = SOURCE_ROOT; };
+		9D7A447713FAF539003087FF /* align-local_ref_start.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "align-local_ref_start.c"; path = "../../../libs/axf/align-local_ref_start.c"; sourceTree = SOURCE_ROOT; };
+		9D7A447813FAF539003087FF /* align-ref-name.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "align-ref-name.c"; path = "../../../libs/axf/align-ref-name.c"; sourceTree = SOURCE_ROOT; };
+		9D7A447913FAF539003087FF /* align-ref-pos.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "align-ref-pos.c"; path = "../../../libs/axf/align-ref-pos.c"; sourceTree = SOURCE_ROOT; };
+		9D7A447A13FAF539003087FF /* align-ref-seq-id.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "align-ref-seq-id.c"; path = "../../../libs/axf/align-ref-seq-id.c"; sourceTree = SOURCE_ROOT; };
+		9D7A447B13FAF539003087FF /* align-restore-read.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "align-restore-read.c"; path = "../../../libs/axf/align-restore-read.c"; sourceTree = SOURCE_ROOT; };
+		9D7A447C13FAF539003087FF /* cigar.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cigar.c; path = ../../../libs/axf/cigar.c; sourceTree = SOURCE_ROOT; };
+		9D7A447D13FAF539003087FF /* get-sam-flags.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "get-sam-flags.c"; path = "../../../libs/axf/get-sam-flags.c"; sourceTree = SOURCE_ROOT; };
+		9D7A447E13FAF539003087FF /* libaxf.vers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = libaxf.vers.h; path = ../../../libs/axf/libaxf.vers.h; sourceTree = SOURCE_ROOT; };
+		9D7A447F13FAF539003087FF /* libwaxf.vers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = libwaxf.vers.h; path = ../../../libs/axf/libwaxf.vers.h; sourceTree = SOURCE_ROOT; };
+		9D7A448013FAF539003087FF /* not-my-row.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "not-my-row.c"; path = "../../../libs/axf/not-my-row.c"; sourceTree = SOURCE_ROOT; };
+		9D7A448113FAF539003087FF /* project_read_from_sequence.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = project_read_from_sequence.c; path = ../../../libs/axf/project_read_from_sequence.c; sourceTree = SOURCE_ROOT; };
+		9D7A448213FAF539003087FF /* raw-restore-read.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "raw-restore-read.c"; path = "../../../libs/axf/raw-restore-read.c"; sourceTree = SOURCE_ROOT; };
+		9D7A448313FAF539003087FF /* ref-restore-read.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "ref-restore-read.c"; path = "../../../libs/axf/ref-restore-read.c"; sourceTree = SOURCE_ROOT; };
+		9D7A448413FAF539003087FF /* ref-tbl-sub-select.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "ref-tbl-sub-select.c"; path = "../../../libs/axf/ref-tbl-sub-select.c"; sourceTree = SOURCE_ROOT; };
+		9D7A448513FAF539003087FF /* refseq-stats.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "refseq-stats.c"; path = "../../../libs/axf/refseq-stats.c"; sourceTree = SOURCE_ROOT; };
+		9D7A448613FAF539003087FF /* seq-restore-read.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "seq-restore-read.c"; path = "../../../libs/axf/seq-restore-read.c"; sourceTree = SOURCE_ROOT; };
+		9D7A448713FAF539003087FF /* template-len.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "template-len.c"; path = "../../../libs/axf/template-len.c"; sourceTree = SOURCE_ROOT; };
+		9D7A448C13FAF555003087FF /* libaxf.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libaxf.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+		9D7A44AB13FB0494003087FF /* align-access.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "align-access.c"; path = "../../../libs/align/align-access.c"; sourceTree = SOURCE_ROOT; };
+		9D7A44AC13FB0494003087FF /* bam-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "bam-priv.h"; path = "../../../libs/align/bam-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A44AD13FB0494003087FF /* bam.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = bam.c; path = ../../../libs/align/bam.c; sourceTree = SOURCE_ROOT; };
+		9D7A44AE13FB0494003087FF /* reader-cmn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "reader-cmn.c"; path = "../../../libs/align/reader-cmn.c"; sourceTree = SOURCE_ROOT; };
+		9D7A44AF13FB0494003087FF /* reader-cmn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "reader-cmn.h"; path = "../../../libs/align/reader-cmn.h"; sourceTree = SOURCE_ROOT; };
+		9D7A44B013FB0494003087FF /* reader-refseq.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "reader-refseq.c"; path = "../../../libs/align/reader-refseq.c"; sourceTree = SOURCE_ROOT; };
+		9D7A44B113FB0494003087FF /* refseq-mgr-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "refseq-mgr-priv.h"; path = "../../../libs/align/refseq-mgr-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A44B213FB0494003087FF /* refseq-mgr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "refseq-mgr.c"; path = "../../../libs/align/refseq-mgr.c"; sourceTree = SOURCE_ROOT; };
+		9D7A44B413FB0494003087FF /* writer-alignment.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "writer-alignment.c"; path = "../../../libs/align/writer-alignment.c"; sourceTree = SOURCE_ROOT; };
+		9D7A44B513FB0494003087FF /* writer-cmn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "writer-cmn.c"; path = "../../../libs/align/writer-cmn.c"; sourceTree = SOURCE_ROOT; };
+		9D7A44B613FB0494003087FF /* writer-priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "writer-priv.h"; path = "../../../libs/align/writer-priv.h"; sourceTree = SOURCE_ROOT; };
+		9D7A44B713FB0494003087FF /* writer-ref.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "writer-ref.c"; path = "../../../libs/align/writer-ref.c"; sourceTree = SOURCE_ROOT; };
+		9D7A44B813FB0494003087FF /* writer-ref.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "writer-ref.h"; path = "../../../libs/align/writer-ref.h"; sourceTree = SOURCE_ROOT; };
+		9D7A44B913FB0494003087FF /* writer-reference.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "writer-reference.c"; path = "../../../libs/align/writer-reference.c"; sourceTree = SOURCE_ROOT; };
+		9D7A44BA13FB0494003087FF /* writer-refseq.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "writer-refseq.c"; path = "../../../libs/align/writer-refseq.c"; sourceTree = SOURCE_ROOT; };
+		9D7A44BB13FB0494003087FF /* writer-sequence.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "writer-sequence.c"; path = "../../../libs/align/writer-sequence.c"; sourceTree = SOURCE_ROOT; };
+		9D7A44C013FB04A9003087FF /* libalign.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libalign.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+		9D7A452F13FB0A3C003087FF /* libwvxf.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libwvxf.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+		9D7A454B13FB0B4D003087FF /* libwsraxf.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libwsraxf.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+		9D7A45C713FB0CB8003087FF /* libwaxf.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libwaxf.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+		9D7A45E713FB0D50003087FF /* libwalign.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libwalign.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+		9D7A460213FB0F0F003087FF /* progressbar.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = progressbar.c; path = ../../../libs/kapp/progressbar.c; sourceTree = SOURCE_ROOT; };
+		9D7A460713FB0F36003087FF /* libkapp.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libkapp.a; sourceTree = BUILT_PRODUCTS_DIR; };
+		9D7A461013FB1128003087FF /* deseq.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = deseq.c; path = ../../../tools/deseq/deseq.c; sourceTree = SOURCE_ROOT; };
+		9D7A461413FB1133003087FF /* deseq */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = deseq; sourceTree = BUILT_PRODUCTS_DIR; };
+		9D7A469113FB1FC5003087FF /* align.vschema */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = align.vschema; path = ../../../interfaces/align/align.vschema; sourceTree = SOURCE_ROOT; };
+		9D7A469213FB1FC5003087FF /* refseq.vschema */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = refseq.vschema; path = ../../../interfaces/align/refseq.vschema; sourceTree = SOURCE_ROOT; };
+		9D7A469313FB1FC5003087FF /* seq.vschema */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = seq.vschema; path = ../../../interfaces/align/seq.vschema; sourceTree = SOURCE_ROOT; };
+		9D8198A811D3D39700DA4D3C /* vector_namelist.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = vector_namelist.c; path = ../../../libs/klib/vector_namelist.c; sourceTree = SOURCE_ROOT; };
+		9D8204F7130F1100009A8B64 /* pagefile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pagefile.c; path = ../../../libs/kfs/pagefile.c; sourceTree = SOURCE_ROOT; };
+		9D8EC40E11C2E20A000F1048 /* pbstree-impl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "pbstree-impl.c"; path = "../../../libs/klib/pbstree-impl.c"; sourceTree = SOURCE_ROOT; };
+		9D8EC41911C2E49E000F1048 /* pbstree-native.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "pbstree-native.c"; path = "../../../libs/klib/pbstree-native.c"; sourceTree = SOURCE_ROOT; };
+		9D8EC41A11C2E49E000F1048 /* pbstree-swapped.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "pbstree-swapped.c"; path = "../../../libs/klib/pbstree-swapped.c"; sourceTree = SOURCE_ROOT; };
+		9D985E8C12886C6100849729 /* config.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = config.c; path = ../../../libs/kfg/config.c; sourceTree = SOURCE_ROOT; };
+		9D985FCB1288BA8700849729 /* config.mac.kfg */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; name = config.mac.kfg; path = ../../../libs/kfg/config.mac.kfg; sourceTree = SOURCE_ROOT; };
+		9DA3A84D125FA3A8005AD5BB /* refcount.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = refcount.c; path = ../../../libs/klib/refcount.c; sourceTree = SOURCE_ROOT; };
+		9DA3A865125FBB21005AD5BB /* abi.vschema */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = abi.vschema; path = ../../../interfaces/sra/abi.vschema; sourceTree = SOURCE_ROOT; };
+		9DA3A866125FBB34005AD5BB /* illumina.vschema */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = illumina.vschema; path = ../../../interfaces/sra/illumina.vschema; sourceTree = SOURCE_ROOT; };
+		9DA3A867125FBBBA005AD5BB /* seq.vschema */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = seq.vschema; path = ../../../interfaces/ncbi/seq.vschema; sourceTree = SOURCE_ROOT; };
+		9DA3A868125FBBF0005AD5BB /* sra.vschema */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = sra.vschema; path = ../../../interfaces/ncbi/sra.vschema; sourceTree = SOURCE_ROOT; };
+		9DA3A88412663646005AD5BB /* syswriter.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = syswriter.c; path = ../../../libs/klib/unix/syswriter.c; sourceTree = SOURCE_ROOT; };
+		9DA3A8951266375B005AD5BB /* writer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = writer.c; path = ../../../libs/klib/writer.c; sourceTree = SOURCE_ROOT; };
+		9DA3A89912663798005AD5BB /* out.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = out.c; path = ../../../libs/klib/out.c; sourceTree = SOURCE_ROOT; };
+		9DB6A77911E61CB700168DE0 /* args.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = args.c; path = ../../../libs/kapp/args.c; sourceTree = SOURCE_ROOT; };
+		9DE55A78140EA19500EA61C6 /* raw-restore-qual.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "raw-restore-qual.c"; path = "../../../libs/axf/raw-restore-qual.c"; sourceTree = SOURCE_ROOT; };
+		9DE55A84140EA93600EA61C6 /* generate-mismatch-qual.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "generate-mismatch-qual.c"; path = "../../../libs/axf/generate-mismatch-qual.c"; sourceTree = SOURCE_ROOT; };
+		9DE55AAE140EC79C00EA61C6 /* mismatch-restore-qual.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "mismatch-restore-qual.c"; path = "../../../libs/axf/mismatch-restore-qual.c"; sourceTree = SOURCE_ROOT; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		9D31EC97117667FA003CDA5E /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9DFECDE6117669DD004EFD0D /* libz.dylib in Frameworks */,
+				9DFECDE7117669E0004EFD0D /* libbz2.dylib in Frameworks */,
+				9DFECDE8117669E0004EFD0D /* libxml2.dylib in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A412C13FADF3A003087FF /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A415A13FAE00E003087FF /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A417613FAE192003087FF /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A423213FAE3F5003087FF /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A423913FAE40C003087FF /* libkdb-cmn.a in Frameworks */,
+				9D7A426113FAE67B003087FF /* libklib.dylib in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A426613FAE69A003087FF /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A426B13FAE6A5003087FF /* libkdb-cmn.a in Frameworks */,
+				9D7A426C13FAE6A7003087FF /* libklib.dylib in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A428713FAE9B5003087FF /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A431A13FAED2E003087FF /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A432913FAEDCC003087FF /* libvdb-cmn.a in Frameworks */,
+				9D7A432A13FAEDD9003087FF /* libkdb.dylib in Frameworks */,
+				9D7A432D13FAEDE5003087FF /* libklib.dylib in Frameworks */,
+				9D7A433013FAEDF6003087FF /* libz.dylib in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A433513FAEE0C003087FF /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A435113FAEF00003087FF /* libwkdb.dylib in Frameworks */,
+				9D7A435213FAEF06003087FF /* libvdb-cmn.a in Frameworks */,
+				9D7A435313FAEF0E003087FF /* libklib.dylib in Frameworks */,
+				9D7A435613FAEF1F003087FF /* libkmproc.a in Frameworks */,
+				9D7A435913FAEF26003087FF /* libz.dylib in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A435E13FAF1AE003087FF /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A43CD13FAF23A003087FF /* libvdb.dylib in Frameworks */,
+				9D7A43D013FAF245003087FF /* libz.dylib in Frameworks */,
+				9D7A43D613FAF257003087FF /* libklib.dylib in Frameworks */,
+				9D7A43DB13FAF274003087FF /* libbz2.dylib in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A440A13FAF315003087FF /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A444313FAF3F6003087FF /* libklib.dylib in Frameworks */,
+				9D7A444613FAF402003087FF /* libvdb.dylib in Frameworks */,
+				9D7A444913FAF411003087FF /* libz.dylib in Frameworks */,
+				9D7A444C13FAF41C003087FF /* libkdb.dylib in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A448A13FAF555003087FF /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A44A313FAF59D003087FF /* libklib.dylib in Frameworks */,
+				9D7A44A613FAF5A9003087FF /* libvdb.dylib in Frameworks */,
+				9D7A44DC13FB0537003087FF /* libalign.dylib in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A44BE13FB04A9003087FF /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A44D013FB04D8003087FF /* libklib.dylib in Frameworks */,
+				9D7A44D113FB04DC003087FF /* libvdb.dylib in Frameworks */,
+				9D7A44D413FB04EF003087FF /* libz.dylib in Frameworks */,
+				9D7A44D913FB051B003087FF /* libkdb.dylib in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A452D13FB0A3C003087FF /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A453D13FB0AB1003087FF /* libz.dylib in Frameworks */,
+				9D7A453E13FB0AB2003087FF /* libbz2.dylib in Frameworks */,
+				9D7A454113FB0AC9003087FF /* libwvdb.dylib in Frameworks */,
+				9D7A454213FB0ACF003087FF /* libwkdb.dylib in Frameworks */,
+				9D7A454313FB0AD5003087FF /* libklib.dylib in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A454913FB0B4D003087FF /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A455513FB0B86003087FF /* libwvdb.dylib in Frameworks */,
+				9D7A455613FB0B8B003087FF /* libwkdb.dylib in Frameworks */,
+				9D7A455713FB0B91003087FF /* libklib.dylib in Frameworks */,
+				9D7A457D13FB0C28003087FF /* libz.dylib in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A45C013FB0CB8003087FF /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A45C113FB0CB8003087FF /* libklib.dylib in Frameworks */,
+				9D7A45C313FB0CB8003087FF /* libalign.dylib in Frameworks */,
+				9D7A45CB13FB0D18003087FF /* libwvdb.dylib in Frameworks */,
+				9D7A45CE13FB0D24003087FF /* libwkdb.dylib in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A45DF13FB0D50003087FF /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A45E013FB0D50003087FF /* libklib.dylib in Frameworks */,
+				9D7A45E213FB0D50003087FF /* libz.dylib in Frameworks */,
+				9D7A45E813FB0D72003087FF /* libwvdb.dylib in Frameworks */,
+				9D7A45E913FB0D76003087FF /* libwkdb.dylib in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A460513FB0F36003087FF /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A461213FB1133003087FF /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A461913FB114C003087FF /* libkapp.a in Frameworks */,
+				9D7A463B13FB135F003087FF /* libklib.dylib in Frameworks */,
+				9D90F4DB140D8229004A99D6 /* libwvdb.dylib in Frameworks */,
+				9DE559C6140E831000EA61C6 /* libwaxf.dylib in Frameworks */,
+				9DE559C7140E831800EA61C6 /* libwvxf.dylib in Frameworks */,
+				9DE559C8140E831C00EA61C6 /* libwsraxf.dylib in Frameworks */,
+				9DE55AFC140EF0B100EA61C6 /* libwkdb.dylib in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		08FB7794FE84155DC02AAC07 /* asm-trace */ = {
+			isa = PBXGroup;
+			children = (
+				9DB6A8D411EB9F2100168DE0 /* interfaces */,
+				9D819B3411DB9D5200DA4D3C /* Tools */,
+				9D8EC47011C2F081000F1048 /* Tests */,
+				9D7356C111775493009EA3E4 /* schema */,
+				9D31EC8B11766778003CDA5E /* External Libraries */,
+				9D31EAAD1176621D003CDA5E /* Libs */,
+				9D7356E611775CB7009EA3E4 /* Products */,
+			);
+			name = "asm-trace";
+			sourceTree = "<group>";
+		};
+		9D31EAAD1176621D003CDA5E /* Libs */ = {
+			isa = PBXGroup;
+			children = (
+				9D7A44AA13FB0466003087FF /* align */,
+				9D7A444F13FAF455003087FF /* search */,
+				9D7A436613FAF1C2003087FF /* axf */,
+				9D7A436513FAF1BC003087FF /* sraxf */,
+				9D7A436313FAF1B4003087FF /* vxf */,
+				9D7A428C13FAE9C4003087FF /* vdb */,
+				9D7A417B13FAE1A2003087FF /* kdb */,
+				9D31EAB01176623F003CDA5E /* kapp */,
+				9D985E8B12886C3A00849729 /* kfg */,
+				9D31EADD117662CE003CDA5E /* kfs */,
+				9D31EAFB1176632C003CDA5E /* klib */,
+				9D31EB1A11766387003CDA5E /* kproc */,
+				9D31EB2F117663FA003CDA5E /* kxml */,
+			);
+			name = Libs;
+			sourceTree = "<group>";
+		};
+		9D31EAB01176623F003CDA5E /* kapp */ = {
+			isa = PBXGroup;
+			children = (
+				9D7A460213FB0F0F003087FF /* progressbar.c */,
+				9DB6A77911E61CB700168DE0 /* args.c */,
+				9D31EAB71176626A003CDA5E /* sysmain.c */,
+				9D31EAB311766257003CDA5E /* main.c */,
+			);
+			name = kapp;
+			sourceTree = "<group>";
+		};
+		9D31EADD117662CE003CDA5E /* kfs */ = {
+			isa = PBXGroup;
+			children = (
+				9D7A411213FADD33003087FF /* sysdir-priv.h */,
+				9D7A411313FADD33003087FF /* sysfile-priv.h */,
+				9D7A411413FADD33003087FF /* sysmmap-priv.h */,
+				9D7A40ED13FADCFE003087FF /* arrayfile.c */,
+				9D7A40EE13FADCFE003087FF /* buffile-write.c */,
+				9D7A40EF13FADCFE003087FF /* fileformat-priv.h */,
+				9D7A40F013FADCFE003087FF /* impl.h */,
+				9D7A40F113FADCFE003087FF /* karc-priv.h */,
+				9D7A40F213FADCFE003087FF /* kfs-priv.h */,
+				9D7A40F313FADCFE003087FF /* manager.c */,
+				9D7A40F413FADCFE003087FF /* mmap-priv.h */,
+				9D7A40F513FADCFE003087FF /* mmap.c */,
+				9D7A40F613FADCFE003087FF /* path-priv.h */,
+				9D7A40F713FADCFE003087FF /* path.c */,
+				9D7A40F813FADCFE003087FF /* pmem.c */,
+				9D7A40F913FADCFE003087FF /* szip.c */,
+				9D7A40FA13FADCFE003087FF /* toc-priv.h */,
+				9D8204F7130F1100009A8B64 /* pagefile.c */,
+				9D31EAF71176631D003CDA5E /* sysdir.c */,
+				9D31EAF81176631D003CDA5E /* sysdll.c */,
+				9D31EAF91176631D003CDA5E /* sysfile.c */,
+				9D31EAFA1176631D003CDA5E /* sysmmap.c */,
+				9D31EAE011766306003CDA5E /* arc.c */,
+				9D31EAE111766306003CDA5E /* buffile.c */,
+				9D31EAE211766306003CDA5E /* bzip.c */,
+				9D31EAE311766306003CDA5E /* countfile.c */,
+				9D31EAE411766306003CDA5E /* crc32.c */,
+				9D31EAE511766306003CDA5E /* dir_test.c */,
+				9D31EAE611766306003CDA5E /* directory.c */,
+				9D31EAE711766306003CDA5E /* ffext.c */,
+				9D31EAE811766306003CDA5E /* ffkey.c */,
+				9D31EAE911766306003CDA5E /* ffmagic.c */,
+				9D31EAEA11766306003CDA5E /* file.c */,
+				9D31EAEB11766306003CDA5E /* fileformat.c */,
+				9D31EAEC11766306003CDA5E /* gzip.c */,
+				9D31EAED11766306003CDA5E /* md5.c */,
+				9D31EAEE11766306003CDA5E /* nullfile.c */,
+				9D31EAEF11766306003CDA5E /* sra.c */,
+				9D31EAF011766306003CDA5E /* subfile.c */,
+				9D31EAF111766306003CDA5E /* tar.c */,
+				9D31EAF211766306003CDA5E /* teefile.c */,
+				9D31EAF311766306003CDA5E /* toc.c */,
+				9D31EAF411766306003CDA5E /* tocdir.c */,
+				9D31EAF511766306003CDA5E /* tocentry.c */,
+				9D31EAF611766306003CDA5E /* tocfile.c */,
+			);
+			name = kfs;
+			sourceTree = "<group>";
+		};
+		9D31EAFB1176632C003CDA5E /* klib */ = {
+			isa = PBXGroup;
+			children = (
+				9D7A40E813FADC66003087FF /* writer-priv.h */,
+				9D7A40DF13FADBEE003087FF /* syserrcode.c */,
+				9D7A40E013FADBEE003087FF /* systime.c */,
+				9D7A40D913FADBA3003087FF /* SHA-32bit.c */,
+				9D7A40DA13FADBA3003087FF /* SHA-64bit.c */,
+				9DA3A89912663798005AD5BB /* out.c */,
+				9DA3A8951266375B005AD5BB /* writer.c */,
+				9DA3A88412663646005AD5BB /* syswriter.c */,
+				9DA3A84D125FA3A8005AD5BB /* refcount.c */,
+				9D62F428124D01AE003D38E9 /* bsearch.c */,
+				9D62F429124D01AE003D38E9 /* qsort.c */,
+				9D1EC47F122D914C00C11287 /* printf.c */,
+				9D1EC480122D914C00C11287 /* status-rc-strings.c */,
+				9D1EC481122D914C00C11287 /* status-rc.c */,
+				9D1EC482122D914C00C11287 /* status.c */,
+				9D1EC47B122D912500C11287 /* debug.c */,
+				9D8198A811D3D39700DA4D3C /* vector_namelist.c */,
+				9D8EC41911C2E49E000F1048 /* pbstree-native.c */,
+				9D8EC41A11C2E49E000F1048 /* pbstree-swapped.c */,
+				9D8EC40E11C2E20A000F1048 /* pbstree-impl.c */,
+				9D31EB191176637A003CDA5E /* syslog.c */,
+				9D31EAFE11766366003CDA5E /* bstpersist.c */,
+				9D31EAFF11766366003CDA5E /* container.c */,
+				9D31EB0011766366003CDA5E /* cp1252.c */,
+				9D31EB0111766366003CDA5E /* crc32.c */,
+				9D31EB0211766366003CDA5E /* data-buffer.c */,
+				9D31EB0311766366003CDA5E /* iso8859-1.c */,
+				9D31EB0411766366003CDA5E /* iso8859.c */,
+				9D31EB0511766366003CDA5E /* log.c */,
+				9D31EB0611766366003CDA5E /* md5.c */,
+				9D31EB0711766366003CDA5E /* namelist.c */,
+				9D31EB0811766366003CDA5E /* pack.c */,
+				9D31EB0911766366003CDA5E /* pbstree.c */,
+				9D31EB0A11766366003CDA5E /* ptpersist.c */,
+				9D31EB0B11766366003CDA5E /* ptrie.c */,
+				9D31EB0C11766366003CDA5E /* rc-idx-tbl.c */,
+				9D31EB0D11766366003CDA5E /* rc-tbl.c */,
+				9D31EB0E11766366003CDA5E /* symtab.c */,
+				9D31EB1011766366003CDA5E /* text.c */,
+				9D31EB1111766366003CDA5E /* token.c */,
+				9D31EB1211766366003CDA5E /* trie.c */,
+				9D31EB1311766366003CDA5E /* trieval.c */,
+				9D31EB1411766366003CDA5E /* unpack.c */,
+				9D31EB1511766366003CDA5E /* utf8.c */,
+				9D31EB1611766366003CDA5E /* vector.c */,
+				9D31EB1711766366003CDA5E /* vlen-encode.c */,
+			);
+			name = klib;
+			sourceTree = "<group>";
+		};
+		9D31EB1A11766387003CDA5E /* kproc */ = {
+			isa = PBXGroup;
+			children = (
+				9D7A414A13FADFC6003087FF /* bsd */,
+				9D7A414D13FADFC6003087FF /* queue.c */,
+				9D7A414E13FADFC6003087FF /* sem.c */,
+				9D7A414813FADFA1003087FF /* syscond-priv.h */,
+				9D31EB2E117663D4003CDA5E /* syslock.c */,
+				9D31EB2B117663C6003CDA5E /* syscond.c */,
+				9D31EB2C117663C6003CDA5E /* systhread.c */,
+				9D31EB2D117663C6003CDA5E /* systimeout.c */,
+				9D31EB1D117663AB003CDA5E /* stbarrier.c */,
+				9D31EB1E117663AB003CDA5E /* stcond.c */,
+				9D31EB1F117663AB003CDA5E /* stlock.c */,
+				9D31EB20117663AB003CDA5E /* stsem.c */,
+				9D31EB21117663AB003CDA5E /* stthread.c */,
+				9D31EB22117663AB003CDA5E /* sttimeout.c */,
+			);
+			name = kproc;
+			sourceTree = "<group>";
+		};
+		9D31EB2F117663FA003CDA5E /* kxml */ = {
+			isa = PBXGroup;
+			children = (
+				9D31EB3011766409003CDA5E /* xml.c */,
+			);
+			name = kxml;
+			sourceTree = "<group>";
+		};
+		9D31EC8B11766778003CDA5E /* External Libraries */ = {
+			isa = PBXGroup;
+			children = (
+				9D31EC8C117667C6003CDA5E /* libbz2.dylib */,
+				9D31EC8E117667C6003CDA5E /* libxml2.dylib */,
+				9D31EC90117667C6003CDA5E /* libz.dylib */,
+			);
+			name = "External Libraries";
+			sourceTree = "<group>";
+		};
+		9D6FFB2F145094B000952EB7 /* align */ = {
+			isa = PBXGroup;
+			children = (
+				9D6FFB31145094DB00952EB7 /* align-access.h */,
+				9D6FFB32145094DB00952EB7 /* alignarc.h */,
+				9D6FFB33145094DB00952EB7 /* alignsrc.h */,
+				9D6FFB34145094DB00952EB7 /* extern.h */,
+				9D6FFB35145094DB00952EB7 /* reader-refseq.h */,
+				9D6FFB36145094DB00952EB7 /* refseq-mgr.h */,
+				9D6FFB37145094DB00952EB7 /* writer-alignment.h */,
+				9D6FFB38145094DB00952EB7 /* writer-cmn.h */,
+				9D6FFB39145094DB00952EB7 /* writer-reference.h */,
+				9D6FFB3A145094DB00952EB7 /* writer-refseq.h */,
+				9D6FFB3B145094DB00952EB7 /* writer-sequence.h */,
+			);
+			name = align;
+			sourceTree = "<group>";
+		};
+		9D7356C111775493009EA3E4 /* schema */ = {
+			isa = PBXGroup;
+			children = (
+				9D7A469013FB1FAC003087FF /* align */,
+				9D7356C91177559D009EA3E4 /* insdc */,
+				9D7356C611775557009EA3E4 /* ncbi */,
+				9D7356CD117755D8009EA3E4 /* sra */,
+				9D7356C311775515009EA3E4 /* vdb */,
+			);
+			name = schema;
+			sourceTree = "<group>";
+		};
+		9D7356C311775515009EA3E4 /* vdb */ = {
+			isa = PBXGroup;
+			children = (
+				9D7356C41177554A009EA3E4 /* built-in.vschema */,
+				9D7356C51177554A009EA3E4 /* vdb.vschema */,
+			);
+			name = vdb;
+			sourceTree = "<group>";
+		};
+		9D7356C611775557009EA3E4 /* ncbi */ = {
+			isa = PBXGroup;
+			children = (
+				9DA3A868125FBBF0005AD5BB /* sra.vschema */,
+				9DA3A867125FBBBA005AD5BB /* seq.vschema */,
+				9D7356C71177556A009EA3E4 /* ncbi.vschema */,
+				9D7356C81177556A009EA3E4 /* spotname.vschema */,
+			);
+			name = ncbi;
+			sourceTree = "<group>";
+		};
+		9D7356C91177559D009EA3E4 /* insdc */ = {
+			isa = PBXGroup;
+			children = (
+				9D7356CA117755B4009EA3E4 /* insdc.vschema */,
+				9D7356CB117755B4009EA3E4 /* seq.vschema */,
+				9D7356CC117755B4009EA3E4 /* sra.vschema */,
+			);
+			name = insdc;
+			sourceTree = "<group>";
+		};
+		9D7356CD117755D8009EA3E4 /* sra */ = {
+			isa = PBXGroup;
+			children = (
+				9DA3A866125FBB34005AD5BB /* illumina.vschema */,
+				9DA3A865125FBB21005AD5BB /* abi.vschema */,
+				9D7356CE117755F4009EA3E4 /* 454.vschema */,
+				9D7356CF117755F4009EA3E4 /* pevents.vschema */,
+			);
+			name = sra;
+			sourceTree = "<group>";
+		};
+		9D7356E611775CB7009EA3E4 /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				9D31EC99117667FA003CDA5E /* libklib.dylib */,
+				9D7A412E13FADF3A003087FF /* libksproc.a */,
+				9D7A415C13FAE00E003087FF /* libkmproc.a */,
+				9D7A417813FAE192003087FF /* libkdb-cmn.a */,
+				9D7A423413FAE3F5003087FF /* libkdb.dylib */,
+				9D7A426813FAE69A003087FF /* libwkdb.dylib */,
+				9D7A428913FAE9B5003087FF /* libvdb-cmn.a */,
+				9D7A431C13FAED2E003087FF /* libvdb.dylib */,
+				9D7A433713FAEE0C003087FF /* libwvdb.dylib */,
+				9D7A436013FAF1AE003087FF /* libvxf.dylib */,
+				9D7A440C13FAF315003087FF /* libsraxf.dylib */,
+				9D7A448C13FAF555003087FF /* libaxf.dylib */,
+				9D7A44C013FB04A9003087FF /* libalign.dylib */,
+				9D7A452F13FB0A3C003087FF /* libwvxf.dylib */,
+				9D7A454B13FB0B4D003087FF /* libwsraxf.dylib */,
+				9D7A45C713FB0CB8003087FF /* libwaxf.dylib */,
+				9D7A45E713FB0D50003087FF /* libwalign.dylib */,
+				9D7A460713FB0F36003087FF /* libkapp.a */,
+				9D7A461413FB1133003087FF /* deseq */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		9D7A414A13FADFC6003087FF /* bsd */ = {
+			isa = PBXGroup;
+			children = (
+				9D7A414B13FADFC6003087FF /* syslock-priv.h */,
+				9D7A414C13FADFC6003087FF /* syslock.c */,
+			);
+			name = bsd;
+			path = ../../../libs/kproc/bsd;
+			sourceTree = SOURCE_ROOT;
+		};
+		9D7A417B13FAE1A2003087FF /* kdb */ = {
+			isa = PBXGroup;
+			children = (
+				9D7A417D13FAE1DA003087FF /* btree.c */,
+				9D7A417E13FAE1DA003087FF /* cc-priv.h */,
+				9D7A417F13FAE1DA003087FF /* coldata-priv.h */,
+				9D7A418013FAE1DA003087FF /* coldata.c */,
+				9D7A418113FAE1DA003087FF /* colfmt-priv.h */,
+				9D7A418213FAE1DA003087FF /* colidx-priv.h */,
+				9D7A418313FAE1DA003087FF /* colidx.c */,
+				9D7A418413FAE1DA003087FF /* colidx0-priv.h */,
+				9D7A418513FAE1DA003087FF /* colidx0.c */,
+				9D7A418613FAE1DA003087FF /* colidx1-priv.h */,
+				9D7A418713FAE1DA003087FF /* colidx1.c */,
+				9D7A418813FAE1DA003087FF /* colidx2-priv.h */,
+				9D7A418913FAE1DA003087FF /* colidx2.c */,
+				9D7A418A13FAE1DA003087FF /* column-cc.c */,
+				9D7A418B13FAE1DA003087FF /* column-priv.h */,
+				9D7A418C13FAE1DA003087FF /* column.c */,
+				9D7A418D13FAE1DA003087FF /* database-cc.c */,
+				9D7A418E13FAE1DA003087FF /* database-cmn.c */,
+				9D7A418F13FAE1DA003087FF /* database-priv.h */,
+				9D7A419013FAE1DA003087FF /* database.c */,
+				9D7A419113FAE1DA003087FF /* dbcc-cmn.c */,
+				9D7A419213FAE1DA003087FF /* dbmgr-cmn.c */,
+				9D7A419313FAE1DA003087FF /* dbmgr-priv.h */,
+				9D7A419413FAE1DA003087FF /* dbmgr.c */,
+				9D7A419513FAE1DA003087FF /* idstats-priv.h */,
+				9D7A419613FAE1DA003087FF /* idstats.c */,
+				9D7A419713FAE1DA003087FF /* idxblk-priv.h */,
+				9D7A419813FAE1DA003087FF /* idxblk.c */,
+				9D7A419913FAE1DA003087FF /* index-cmn.h */,
+				9D7A419A13FAE1DA003087FF /* index-priv.h */,
+				9D7A419B13FAE1DA003087FF /* index.c */,
+				9D7A419C13FAE1DA003087FF /* kdb-priv.h */,
+				9D7A419D13FAE1DA003087FF /* kdb.c */,
+				9D7A419E13FAE1DA003087FF /* kdbfmt-priv.h */,
+				9D7A419F13FAE1DA003087FF /* libkdb.vers.h */,
+				9D7A41A013FAE1DA003087FF /* libwkdb.vers.h */,
+				9D7A41A113FAE1DA003087FF /* meta.c */,
+				9D7A41A213FAE1DA003087FF /* ptrieval-v1.c */,
+				9D7A41A313FAE1DA003087FF /* ptrieval-v2.c */,
+				9D7A41A413FAE1DA003087FF /* table-cc.c */,
+				9D7A41A513FAE1DA003087FF /* table-priv.h */,
+				9D7A41A613FAE1DA003087FF /* table.c */,
+				9D7A41A713FAE1DA003087FF /* trieidx-priv.h */,
+				9D7A41A813FAE1DA003087FF /* trieidx-v1.c */,
+				9D7A41A913FAE1DA003087FF /* trieidx-v2.c */,
+				9D7A41AA13FAE1DA003087FF /* trieval-v1.c */,
+				9D7A41AB13FAE1DA003087FF /* trieval-v2.c */,
+				9D7A41AC13FAE1DA003087FF /* u64idx-v3.c */,
+				9D7A41AD13FAE1DA003087FF /* wcoldata-priv.h */,
+				9D7A41AE13FAE1DA003087FF /* wcoldata.c */,
+				9D7A41AF13FAE1DA003087FF /* wcolidx-priv.h */,
+				9D7A41B013FAE1DA003087FF /* wcolidx.c */,
+				9D7A41B113FAE1DA003087FF /* wcolidx0-priv.h */,
+				9D7A41B213FAE1DA003087FF /* wcolidx0.c */,
+				9D7A41B313FAE1DA003087FF /* wcolidx1-priv.h */,
+				9D7A41B413FAE1DA003087FF /* wcolidx1.c */,
+				9D7A41B513FAE1DA003087FF /* wcolidx2-priv.h */,
+				9D7A41B613FAE1DA003087FF /* wcolidx2.c */,
+				9D7A41B713FAE1DA003087FF /* wcolumn-priv.h */,
+				9D7A41B813FAE1DA003087FF /* wcolumn.c */,
+				9D7A41B913FAE1DA003087FF /* wdatabase-priv.h */,
+				9D7A41BA13FAE1DA003087FF /* wdatabase.c */,
+				9D7A41BB13FAE1DA003087FF /* wdbmgr.c */,
+				9D7A41BC13FAE1DA003087FF /* werror-priv.h */,
+				9D7A41BD13FAE1DA003087FF /* widxblk-priv.h */,
+				9D7A41BE13FAE1DA003087FF /* widxblk.c */,
+				9D7A41BF13FAE1DA003087FF /* windex-priv.h */,
+				9D7A41C013FAE1DA003087FF /* windex.c */,
+				9D7A41C113FAE1DA003087FF /* wkdb-priv.h */,
+				9D7A41C213FAE1DA003087FF /* wkdb.c */,
+				9D7A41C313FAE1DA003087FF /* wmeta.c */,
+				9D7A41C413FAE1DA003087FF /* wtable-priv.h */,
+				9D7A41C513FAE1DA003087FF /* wtable.c */,
+				9D7A41C613FAE1DA003087FF /* wtrieidx-v1.c */,
+				9D7A41C713FAE1DA003087FF /* wtrieidx-v2.c */,
+				9D7A41C813FAE1DA003087FF /* wu64idx-v3.c */,
+			);
+			name = kdb;
+			sourceTree = "<group>";
+		};
+		9D7A428C13FAE9C4003087FF /* vdb */ = {
+			isa = PBXGroup;
+			children = (
+				9D7A430F13FAEC61003087FF /* built-in */,
+				9D7A432813FAED99003087FF /* read-only */,
+				9D7A441313FAF394003087FF /* common */,
+				9D7A441213FAF37A003087FF /* write */,
+			);
+			name = vdb;
+			sourceTree = "<group>";
+		};
+		9D7A430F13FAEC61003087FF /* built-in */ = {
+			isa = PBXGroup;
+			children = (
+				9D7A42A413FAEA20003087FF /* index_insert.c */,
+				9D7A42AE13FAEA21003087FF /* meta-append.c */,
+				9D7A42B013FAEA21003087FF /* meta-attr-write.c */,
+				9D7A42B313FAEA21003087FF /* meta-write.c */,
+				9D7A429313FAEA20003087FF /* cast.c */,
+				9D7A429713FAEA20003087FF /* compare.c */,
+				9D7A42A213FAEA20003087FF /* environment-read.c */,
+				9D7A42A313FAEA20003087FF /* fixed-row-len.c */,
+				9D7A42A513FAEA20003087FF /* index_lookup.c */,
+				9D7A42A613FAEA20003087FF /* index_project.c */,
+				9D7A42AD13FAEA21003087FF /* merge.c */,
+				9D7A42AF13FAEA21003087FF /* meta-attr-read.c */,
+				9D7A42B113FAEA21003087FF /* meta-read.c */,
+				9D7A42B213FAEA21003087FF /* meta-value.c */,
+				9D7A42B613FAEA21003087FF /* parameter-read.c */,
+				9D7A42C113FAEA21003087FF /* range-validate.c */,
+				9D7A42C213FAEA21003087FF /* redimension.c */,
+				9D7A42C313FAEA21003087FF /* row-id.c */,
+				9D7A42C413FAEA21003087FF /* row-len.c */,
+				9D7A42D613FAEA21003087FF /* split.c */,
+			);
+			name = "built-in";
+			sourceTree = "<group>";
+		};
+		9D7A432813FAED99003087FF /* read-only */ = {
+			isa = PBXGroup;
+			children = (
+				9D7A429613FAEA20003087FF /* column.c */,
+				9D7A429A13FAEA20003087FF /* cursor.c */,
+				9D7A429E13FAEA20003087FF /* database.c */,
+				9D7A42A113FAEA20003087FF /* dbmgr.c */,
+				9D7A42AC13FAEA21003087FF /* linker.c */,
+				9D7A42BA13FAEA21003087FF /* phys.c */,
+				9D7A42C013FAEA21003087FF /* prod.c */,
+				9D7A42DA13FAEA21003087FF /* table.c */,
+			);
+			name = "read-only";
+			sourceTree = "<group>";
+		};
+		9D7A436313FAF1B4003087FF /* vxf */ = {
+			isa = PBXGroup;
+			children = (
+				9D320AD5142D0E3F00ACA5AA /* Makefile */,
+				9D320AAE142D02B000ACA5AA /* extract_token.c */,
+				9D320AAF142D02B000ACA5AA /* strtonum.c */,
+				9D7A436713FAF20D003087FF /* add-row-id.c */,
+				9D7A436813FAF20D003087FF /* bit_or.c */,
+				9D7A436913FAF20D003087FF /* bunzip.c */,
+				9D7A436A13FAF20D003087FF /* bzip.c */,
+				9D7A436B13FAF20D003087FF /* ceil.c */,
+				9D7A436C13FAF20D003087FF /* checksum.c */,
+				9D7A436D13FAF20D003087FF /* clip.c */,
+				9D7A436E13FAF20D003087FF /* cut.c */,
+				9D7A436F13FAF20D003087FF /* delta.c */,
+				9D7A437013FAF20D003087FF /* deriv.c */,
+				9D7A437113FAF20D003087FF /* diff.c */,
+				9D7A437213FAF20D003087FF /* echo.c */,
+				9D7A437313FAF20E003087FF /* entrez.c */,
+				9D7A437413FAF20E003087FF /* exists.c */,
+				9D7A437513FAF20E003087FF /* floor.c */,
+				9D7A437613FAF20E003087FF /* fsplit-join.impl.h */,
+				9D7A437713FAF20E003087FF /* funzip.c */,
+				9D7A437813FAF20E003087FF /* fzip.c */,
+				9D7A437913FAF20E003087FF /* integral.c */,
+				9D7A437A13FAF20E003087FF /* irzip.c */,
+				9D7A437B13FAF20E003087FF /* irzip.impl.h */,
+				9D7A437C13FAF20E003087FF /* iunzip.c */,
+				9D7A437D13FAF20E003087FF /* izip-common.h */,
+				9D7A437E13FAF20E003087FF /* izip-decode.impl.h */,
+				9D7A437F13FAF20E003087FF /* izip-encode.impl.h */,
+				9D7A438013FAF20E003087FF /* izip.c */,
+				9D7A438113FAF20E003087FF /* libvxf.vers.h */,
+				9D7A438213FAF20E003087FF /* libvxfentrez.vers.h */,
+				9D7A438313FAF20E003087FF /* map.c */,
+				9D7A438413FAF20E003087FF /* math-funcs-impl.h */,
+				9D7A438513FAF20E003087FF /* max.c */,
+				9D7A438613FAF20E003087FF /* min.c */,
+				9D7A438713FAF20E003087FF /* outlier-decoder.c */,
+				9D7A438813FAF20E003087FF /* outlier-encoder.c */,
+				9D7A438913FAF20E003087FF /* pack.c */,
+				9D7A438A13FAF20E003087FF /* paste.c */,
+				9D7A438B13FAF20E003087FF /* rand_4na_2na.c */,
+				9D7A438C13FAF20E003087FF /* rldecode.c */,
+				9D7A438D13FAF20E003087FF /* rlencode.c */,
+				9D7A438E13FAF20E003087FF /* round.c */,
+				9D7A438F13FAF20E003087FF /* simple-sub-select.c */,
+				9D7A439013FAF20E003087FF /* subtract-row-id.c */,
+				9D7A439113FAF20E003087FF /* sum.c */,
+				9D7A439213FAF20E003087FF /* trim.c */,
+				9D7A439313FAF20E003087FF /* trunc.c */,
+				9D7A439413FAF20E003087FF /* undelta.c */,
+				9D7A439513FAF20E003087FF /* unpack.c */,
+				9D7A439613FAF20E003087FF /* unzip.c */,
+				9D7A439713FAF20E003087FF /* vec-sum.c */,
+				9D7A439813FAF20E003087FF /* zip.c */,
+				9D320AB5142D02E600ACA5AA /* sprintf.c */,
+			);
+			name = vxf;
+			sourceTree = "<group>";
+		};
+		9D7A436513FAF1BC003087FF /* sraxf */ = {
+			isa = PBXGroup;
+			children = (
+				9D7A43DE13FAF2EF003087FF /* bio-start.c */,
+				9D7A43DF13FAF2EF003087FF /* color-from-dna.c */,
+				9D7A43E013FAF2EF003087FF /* denormalize.c */,
+				9D7A43E113FAF2EF003087FF /* dna-from-color.c */,
+				9D7A43E213FAF2EF003087FF /* dynamic-454-read-descriptor.c */,
+				9D7A43E313FAF2EF003087FF /* extract-coordinates.c */,
+				9D7A43E413FAF2EF003087FF /* extract-name_coord.c */,
+				9D7A43E513FAF2EF003087FF /* extract-name_fmt.c */,
+				9D7A43E613FAF2EF003087FF /* extract-spot_name.c */,
+				9D7A43E713FAF2EF003087FF /* format-spot-name.c */,
+				9D7A43E813FAF2EF003087FF /* fpcodec.c */,
+				9D7A43E913FAF2EF003087FF /* index_lookup.c */,
+				9D7A43EA13FAF2EF003087FF /* libsraxf.vers.h */,
+				9D7A43EB13FAF2EF003087FF /* libwsraxf.vers.h */,
+				9D7A43EC13FAF2EF003087FF /* make-position.c */,
+				9D7A43ED13FAF2EF003087FF /* name-tokenizer.h */,
+				9D7A43EE13FAF2EF003087FF /* normalize.c */,
+				9D7A43EF13FAF2EF003087FF /* prefix-tree-to-name.c */,
+				9D7A43F013FAF2EF003087FF /* process-position.c */,
+				9D7A43F113FAF2EF003087FF /* qual4_codec.h */,
+				9D7A43F213FAF2EF003087FF /* qual4_decode.c */,
+				9D7A43F313FAF2EF003087FF /* qual4_encode.c */,
+				9D7A43F413FAF2EF003087FF /* read-desc.c */,
+				9D7A43F513FAF2EF003087FF /* read-seg-from-readn.c */,
+				9D7A43F613FAF2EF003087FF /* rewrite-spot-name.c */,
+				9D7A43F713FAF2EF003087FF /* rotate.c */,
+				9D7A43F813FAF2EF003087FF /* spot-desc.c */,
+				9D7A43F913FAF2EF003087FF /* stats_quality.c */,
+				9D7A43FA13FAF2EF003087FF /* stats.c */,
+				9D7A43FB13FAF2EF003087FF /* swap.c */,
+				9D7A43FC13FAF2EF003087FF /* tokenize-spot_name-454.c */,
+				9D7A43FD13FAF2EF003087FF /* tokenize-spot_name-abi.c */,
+				9D7A43FE13FAF2EF003087FF /* tokenize-spot_name-helicos.c */,
+				9D7A43FF13FAF2EF003087FF /* tokenize-spot_name-illumina.c */,
+				9D7A440013FAF2EF003087FF /* tokenize-spot_name-ion-torrent.c */,
+				9D7A440113FAF2EF003087FF /* untyped-priv.h */,
+				9D7A440213FAF2EF003087FF /* untyped.c */,
+				9D7A440313FAF2EF003087FF /* v0-decompress-init.c */,
+				9D7A440413FAF2EF003087FF /* v0-decompress-local.h */,
+				9D7A440513FAF2EF003087FF /* v0-decompress.c */,
+				9D7A440613FAF2EF003087FF /* v0-decompress.h */,
+				9D7A440713FAF2EF003087FF /* v0-funcs.c */,
+			);
+			name = sraxf;
+			sourceTree = "<group>";
+		};
+		9D7A436613FAF1C2003087FF /* axf */ = {
+			isa = PBXGroup;
+			children = (
+				9D4DCEAB1423FD9600881098 /* ref-preserve_qual.c */,
+				9DE55A78140EA19500EA61C6 /* raw-restore-qual.c */,
+				9D7A447613FAF539003087FF /* align-local_ref_id.c */,
+				9D7A447713FAF539003087FF /* align-local_ref_start.c */,
+				9D7A447813FAF539003087FF /* align-ref-name.c */,
+				9D7A447913FAF539003087FF /* align-ref-pos.c */,
+				9D7A447A13FAF539003087FF /* align-ref-seq-id.c */,
+				9D7A447B13FAF539003087FF /* align-restore-read.c */,
+				9D7A447C13FAF539003087FF /* cigar.c */,
+				9D7A447D13FAF539003087FF /* get-sam-flags.c */,
+				9D7A447E13FAF539003087FF /* libaxf.vers.h */,
+				9D7A447F13FAF539003087FF /* libwaxf.vers.h */,
+				9D7A448013FAF539003087FF /* not-my-row.c */,
+				9D7A448113FAF539003087FF /* project_read_from_sequence.c */,
+				9D7A448213FAF539003087FF /* raw-restore-read.c */,
+				9D7A448313FAF539003087FF /* ref-restore-read.c */,
+				9D7A448413FAF539003087FF /* ref-tbl-sub-select.c */,
+				9D7A448513FAF539003087FF /* refseq-stats.c */,
+				9D7A448613FAF539003087FF /* seq-restore-read.c */,
+				9D7A448713FAF539003087FF /* template-len.c */,
+				9DE55A84140EA93600EA61C6 /* generate-mismatch-qual.c */,
+				9DE55AAE140EC79C00EA61C6 /* mismatch-restore-qual.c */,
+			);
+			name = axf;
+			sourceTree = "<group>";
+		};
+		9D7A441213FAF37A003087FF /* write */ = {
+			isa = PBXGroup;
+			children = (
+				9D7A42DB13FAEA21003087FF /* wcolumn.c */,
+				9D7A42DC13FAEA21003087FF /* wcursor.c */,
+				9D7A42DD13FAEA21003087FF /* wdatabase.c */,
+				9D7A42DE13FAEA21003087FF /* wdbmgr.c */,
+				9D7A42DF13FAEA21003087FF /* wlinker.c */,
+				9D7A42E013FAEA21003087FF /* wphys.c */,
+				9D7A42E113FAEA21003087FF /* wprod.c */,
+				9D7A42E213FAEA21003087FF /* wtable.c */,
+			);
+			name = write;
+			sourceTree = "<group>";
+		};
+		9D7A441313FAF394003087FF /* common */ = {
+			isa = PBXGroup;
+			children = (
+				9D7A428E13FAEA20003087FF /* blob-headers.c */,
+				9D7A428F13FAEA20003087FF /* blob-headers.h */,
+				9D7A429013FAEA20003087FF /* blob-priv.h */,
+				9D7A429113FAEA20003087FF /* blob.c */,
+				9D7A429213FAEA20003087FF /* blob.h */,
+				9D7A429413FAEA20003087FF /* column-cmn.c */,
+				9D7A429513FAEA20003087FF /* column-priv.h */,
+				9D7A42E313FAEA21003087FF /* xform-priv.h */,
+				9D7A429813FAEA20003087FF /* cursor-cmn.c */,
+				9D7A429913FAEA20003087FF /* cursor-priv.h */,
+				9D7A429B13FAEA20003087FF /* database-cmn.c */,
+				9D7A429C13FAEA20003087FF /* database-load.c */,
+				9D7A429D13FAEA20003087FF /* database-priv.h */,
+				9D7A429F13FAEA20003087FF /* dbmgr-cmn.c */,
+				9D7A42A013FAEA20003087FF /* dbmgr-priv.h */,
+				9D7A42A713FAEA20003087FF /* libvdb.vers.h */,
+				9D7A42A813FAEA20003087FF /* libwvdb.vers.h */,
+				9D7A42A913FAEA20003087FF /* linker-cmn.c */,
+				9D7A42AA13FAEA20003087FF /* linker-int.c */,
+				9D7A42AB13FAEA21003087FF /* linker-priv.h */,
+				9D7A42B413FAEA21003087FF /* page-map.c */,
+				9D7A42B513FAEA21003087FF /* page-map.h */,
+				9D7A42B713FAEA21003087FF /* phys-cmn.c */,
+				9D7A42B813FAEA21003087FF /* phys-load.c */,
+				9D7A42B913FAEA21003087FF /* phys-priv.h */,
+				9D7A42BB13FAEA21003087FF /* prod-cmn.c */,
+				9D7A42BC13FAEA21003087FF /* prod-expr.c */,
+				9D7A42BD13FAEA21003087FF /* prod-expr.h */,
+				9D7A42BE13FAEA21003087FF /* prod-func.c */,
+				9D7A42BF13FAEA21003087FF /* prod-priv.h */,
+				9D7A42C513FAEA21003087FF /* schema-db.c */,
+				9D7A42C613FAEA21003087FF /* schema-dump.c */,
+				9D7A42C713FAEA21003087FF /* schema-dump.h */,
+				9D7A42C813FAEA21003087FF /* schema-eval.c */,
+				9D7A42C913FAEA21003087FF /* schema-expr.c */,
+				9D7A42CA13FAEA21003087FF /* schema-expr.h */,
+				9D7A42CB13FAEA21003087FF /* schema-func.c */,
+				9D7A42CC13FAEA21003087FF /* schema-int.c */,
+				9D7A42CD13FAEA21003087FF /* schema-parse.c */,
+				9D7A42CE13FAEA21003087FF /* schema-parse.h */,
+				9D7A42CF13FAEA21003087FF /* schema-priv.h */,
+				9D7A42D013FAEA21003087FF /* schema-prod.c */,
+				9D7A42D113FAEA21003087FF /* schema-tbl.c */,
+				9D7A42D213FAEA21003087FF /* schema-tok.c */,
+				9D7A42D313FAEA21003087FF /* schema-tok.h */,
+				9D7A42D413FAEA21003087FF /* schema-type.c */,
+				9D7A42D513FAEA21003087FF /* schema.c */,
+				9D7A42D713FAEA21003087FF /* table-cmn.c */,
+				9D7A42D813FAEA21003087FF /* table-load.c */,
+				9D7A42D913FAEA21003087FF /* table-priv.h */,
+			);
+			name = common;
+			sourceTree = "<group>";
+		};
+		9D7A444F13FAF455003087FF /* search */ = {
+			isa = PBXGroup;
+			children = (
+				9D7A445013FAF48E003087FF /* agrep-dp.c */,
+				9D7A445113FAF48E003087FF /* agrep-myers.c */,
+				9D7A445213FAF48E003087FF /* agrep-myersunltd.c */,
+				9D7A445313FAF48E003087FF /* agrep-wumanber.c */,
+				9D7A445413FAF48E003087FF /* fgrep-aho.c */,
+				9D7A445513FAF48E003087FF /* fgrep-boyermoore.c */,
+				9D7A445613FAF48E003087FF /* fgrep-dumb.c */,
+				9D7A445713FAF48E003087FF /* libksrch.vers.h */,
+				9D7A445813FAF48E003087FF /* nucstrstr.c */,
+				9D7A445913FAF48E003087FF /* search-priv.h */,
+				9D7A445A13FAF48E003087FF /* search.c */,
+			);
+			name = search;
+			sourceTree = "<group>";
+		};
+		9D7A44AA13FB0466003087FF /* align */ = {
+			isa = PBXGroup;
+			children = (
+				9D7A44AB13FB0494003087FF /* align-access.c */,
+				9D7A44AC13FB0494003087FF /* bam-priv.h */,
+				9D7A44AD13FB0494003087FF /* bam.c */,
+				9D7A44AE13FB0494003087FF /* reader-cmn.c */,
+				9D7A44AF13FB0494003087FF /* reader-cmn.h */,
+				9D7A44B013FB0494003087FF /* reader-refseq.c */,
+				9D7A44B113FB0494003087FF /* refseq-mgr-priv.h */,
+				9D7A44B213FB0494003087FF /* refseq-mgr.c */,
+				9D7A44B413FB0494003087FF /* writer-alignment.c */,
+				9D7A44B513FB0494003087FF /* writer-cmn.c */,
+				9D7A44B613FB0494003087FF /* writer-priv.h */,
+				9D7A44B713FB0494003087FF /* writer-ref.c */,
+				9D7A44B813FB0494003087FF /* writer-ref.h */,
+				9D7A44B913FB0494003087FF /* writer-reference.c */,
+				9D7A44BA13FB0494003087FF /* writer-refseq.c */,
+				9D7A44BB13FB0494003087FF /* writer-sequence.c */,
+			);
+			name = align;
+			sourceTree = "<group>";
+		};
+		9D7A460E13FB0F69003087FF /* deseq */ = {
+			isa = PBXGroup;
+			children = (
+				9D320A0A142B813300ACA5AA /* Makefile */,
+				9D7A461013FB1128003087FF /* deseq.c */,
+			);
+			name = deseq;
+			sourceTree = "<group>";
+		};
+		9D7A469013FB1FAC003087FF /* align */ = {
+			isa = PBXGroup;
+			children = (
+				9D7A469113FB1FC5003087FF /* align.vschema */,
+				9D7A469213FB1FC5003087FF /* refseq.vschema */,
+				9D7A469313FB1FC5003087FF /* seq.vschema */,
+			);
+			name = align;
+			sourceTree = "<group>";
+		};
+		9D819B3411DB9D5200DA4D3C /* Tools */ = {
+			isa = PBXGroup;
+			children = (
+				9D7A460E13FB0F69003087FF /* deseq */,
+			);
+			name = Tools;
+			sourceTree = "<group>";
+		};
+		9D8EC47011C2F081000F1048 /* Tests */ = {
+			isa = PBXGroup;
+			children = (
+			);
+			name = Tests;
+			sourceTree = "<group>";
+		};
+		9D985E8B12886C3A00849729 /* kfg */ = {
+			isa = PBXGroup;
+			children = (
+				9D1235B414F571AC00ECC72C /* config-grammar.c */,
+				9D1235B514F571AC00ECC72C /* config-grammar.y */,
+				9D1235B614F571AC00ECC72C /* config-lex.c */,
+				9D1235B714F571AC00ECC72C /* config-lex.l */,
+				9D1235B814F571AC00ECC72C /* config-tokens.h */,
+				9D1235B914F571AC00ECC72C /* config.linux.kfg */,
+				9D1235BA14F571AC00ECC72C /* config.win.kfg */,
+				9D1235BB14F571AC00ECC72C /* kfg-parse.h */,
+				9D985FCB1288BA8700849729 /* config.mac.kfg */,
+				9D985E8C12886C6100849729 /* config.c */,
+			);
+			name = kfg;
+			sourceTree = "<group>";
+		};
+		9DB6A8D411EB9F2100168DE0 /* interfaces */ = {
+			isa = PBXGroup;
+			children = (
+				9D6FFB2F145094B000952EB7 /* align */,
+			);
+			name = interfaces;
+			path = ../../../interfaces;
+			sourceTree = SOURCE_ROOT;
+		};
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+		9D31EC95117667FA003CDA5E /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A410713FADCFE003087FF /* path-priv.h in Headers */,
+				9D7A411613FADD33003087FF /* sysdir-priv.h in Headers */,
+				9D7A411713FADD33003087FF /* sysfile-priv.h in Headers */,
+				9D7A445D13FAF49A003087FF /* libksrch.vers.h in Headers */,
+				9D7A446013FAF49A003087FF /* search-priv.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A412A13FADF3A003087FF /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A415813FAE00E003087FF /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A417413FAE192003087FF /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A423013FAE3F5003087FF /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A426413FAE69A003087FF /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A428513FAE9B5003087FF /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A431813FAED2E003087FF /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A433313FAEE0C003087FF /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A435C13FAF1AE003087FF /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A440813FAF315003087FF /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A441A13FAF3B5003087FF /* qual4_codec.h in Headers */,
+				9D7A441B13FAF3B5003087FF /* libwsraxf.vers.h in Headers */,
+				9D7A442413FAF3B5003087FF /* v0-decompress-local.h in Headers */,
+				9D7A443213FAF3B5003087FF /* libsraxf.vers.h in Headers */,
+				9D7A443913FAF3B5003087FF /* v0-decompress.h in Headers */,
+				9D7A443B13FAF3B5003087FF /* name-tokenizer.h in Headers */,
+				9D7A443C13FAF3B5003087FF /* untyped-priv.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A448813FAF555003087FF /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A44BC13FB04A9003087FF /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A452B13FB0A3C003087FF /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A454713FB0B4D003087FF /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A45AF13FB0CB8003087FF /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A45D813FB0D50003087FF /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A460313FB0F36003087FF /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+		9D31EC98117667FA003CDA5E /* klib */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 9D31ECBB11766836003CDA5E /* Build configuration list for PBXNativeTarget "klib" */;
+			buildPhases = (
+				9D31EC95117667FA003CDA5E /* Headers */,
+				9D31EC96117667FA003CDA5E /* Sources */,
+				9D31EC97117667FA003CDA5E /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = klib;
+			productName = klib;
+			productReference = 9D31EC99117667FA003CDA5E /* libklib.dylib */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		9D7A412D13FADF3A003087FF /* ksproc */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 9D7A414713FADF98003087FF /* Build configuration list for PBXNativeTarget "ksproc" */;
+			buildPhases = (
+				9D7A412A13FADF3A003087FF /* Headers */,
+				9D7A412B13FADF3A003087FF /* Sources */,
+				9D7A412C13FADF3A003087FF /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = ksproc;
+			productName = ksproc;
+			productReference = 9D7A412E13FADF3A003087FF /* libksproc.a */;
+			productType = "com.apple.product-type.library.static";
+		};
+		9D7A415B13FAE00E003087FF /* kmproc */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 9D7A417013FAE0A5003087FF /* Build configuration list for PBXNativeTarget "kmproc" */;
+			buildPhases = (
+				9D7A415813FAE00E003087FF /* Headers */,
+				9D7A415913FAE00E003087FF /* Sources */,
+				9D7A415A13FAE00E003087FF /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = kmproc;
+			productName = kmproc;
+			productReference = 9D7A415C13FAE00E003087FF /* libkmproc.a */;
+			productType = "com.apple.product-type.library.static";
+		};
+		9D7A417713FAE192003087FF /* kdb-cmn */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 9D7A417C13FAE1A2003087FF /* Build configuration list for PBXNativeTarget "kdb-cmn" */;
+			buildPhases = (
+				9D7A417413FAE192003087FF /* Headers */,
+				9D7A417513FAE192003087FF /* Sources */,
+				9D7A417613FAE192003087FF /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "kdb-cmn";
+			productName = "kdb-cmn";
+			productReference = 9D7A417813FAE192003087FF /* libkdb-cmn.a */;
+			productType = "com.apple.product-type.library.static";
+		};
+		9D7A423313FAE3F5003087FF /* kdb */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 9D7A423A13FAE42A003087FF /* Build configuration list for PBXNativeTarget "kdb" */;
+			buildPhases = (
+				9D7A423013FAE3F5003087FF /* Headers */,
+				9D7A423113FAE3F5003087FF /* Sources */,
+				9D7A423213FAE3F5003087FF /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				9D7A44FE13FB05F2003087FF /* PBXTargetDependency */,
+				9D7A423813FAE3FD003087FF /* PBXTargetDependency */,
+			);
+			name = kdb;
+			productName = kdb;
+			productReference = 9D7A423413FAE3F5003087FF /* libkdb.dylib */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		9D7A426713FAE69A003087FF /* wkdb */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 9D7A427313FAE709003087FF /* Build configuration list for PBXNativeTarget "wkdb" */;
+			buildPhases = (
+				9D7A426413FAE69A003087FF /* Headers */,
+				9D7A426513FAE69A003087FF /* Sources */,
+				9D7A426613FAE69A003087FF /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				9D7A44FC13FB05EB003087FF /* PBXTargetDependency */,
+				9D7A428413FAE9A0003087FF /* PBXTargetDependency */,
+			);
+			name = wkdb;
+			productName = wkdb;
+			productReference = 9D7A426813FAE69A003087FF /* libwkdb.dylib */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		9D7A428813FAE9B5003087FF /* vdb-cmn */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 9D7A428D13FAE9C5003087FF /* Build configuration list for PBXNativeTarget "vdb-cmn" */;
+			buildPhases = (
+				9D7A428513FAE9B5003087FF /* Headers */,
+				9D7A428613FAE9B5003087FF /* Sources */,
+				9D7A428713FAE9B5003087FF /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "vdb-cmn";
+			productName = "vdb-cmn";
+			productReference = 9D7A428913FAE9B5003087FF /* libvdb-cmn.a */;
+			productType = "com.apple.product-type.library.static";
+		};
+		9D7A431B13FAED2E003087FF /* vdb */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 9D7A432713FAED97003087FF /* Build configuration list for PBXNativeTarget "vdb" */;
+			buildPhases = (
+				9D7A431813FAED2E003087FF /* Headers */,
+				9D7A431913FAED2E003087FF /* Sources */,
+				9D7A431A13FAED2E003087FF /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				9D7A44F413FB05A9003087FF /* PBXTargetDependency */,
+				9D7A44F213FB05A9003087FF /* PBXTargetDependency */,
+				9D7A450613FB06AB003087FF /* PBXTargetDependency */,
+			);
+			name = vdb;
+			productName = vdb;
+			productReference = 9D7A431C13FAED2E003087FF /* libvdb.dylib */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		9D7A433613FAEE0C003087FF /* wvdb */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 9D7A434A13FAEE8A003087FF /* Build configuration list for PBXNativeTarget "wvdb" */;
+			buildPhases = (
+				9D7A433313FAEE0C003087FF /* Headers */,
+				9D7A433413FAEE0C003087FF /* Sources */,
+				9D7A433513FAEE0C003087FF /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				9D7A44FA13FB05C9003087FF /* PBXTargetDependency */,
+				9D7A44F813FB05C9003087FF /* PBXTargetDependency */,
+				9D7A44F613FB05C9003087FF /* PBXTargetDependency */,
+				9D7A450813FB06BD003087FF /* PBXTargetDependency */,
+			);
+			name = wvdb;
+			productName = wvdb;
+			productReference = 9D7A433713FAEE0C003087FF /* libwvdb.dylib */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		9D7A435F13FAF1AE003087FF /* vxf */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 9D7A436413FAF1B4003087FF /* Build configuration list for PBXNativeTarget "vxf" */;
+			buildPhases = (
+				9D7A435C13FAF1AE003087FF /* Headers */,
+				9D7A435D13FAF1AE003087FF /* Sources */,
+				9D7A435E13FAF1AE003087FF /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				9D7A44E813FB057E003087FF /* PBXTargetDependency */,
+				9D7A44EA13FB0582003087FF /* PBXTargetDependency */,
+			);
+			name = vxf;
+			productName = vxf;
+			productReference = 9D7A436013FAF1AE003087FF /* libvxf.dylib */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		9D7A440B13FAF315003087FF /* sraxf */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 9D7A441013FAF333003087FF /* Build configuration list for PBXNativeTarget "sraxf" */;
+			buildPhases = (
+				9D7A440813FAF315003087FF /* Headers */,
+				9D7A440913FAF315003087FF /* Sources */,
+				9D7A440A13FAF315003087FF /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				9D7A446F13FAF4B6003087FF /* PBXTargetDependency */,
+				9D7A446D13FAF4B3003087FF /* PBXTargetDependency */,
+				9D7A446913FAF4A9003087FF /* PBXTargetDependency */,
+			);
+			name = sraxf;
+			productName = sraxf;
+			productReference = 9D7A440C13FAF315003087FF /* libsraxf.dylib */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		9D7A448B13FAF555003087FF /* axf */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 9D7A44A913FAF5C7003087FF /* Build configuration list for PBXNativeTarget "axf" */;
+			buildPhases = (
+				9D7A448813FAF555003087FF /* Headers */,
+				9D7A448913FAF555003087FF /* Sources */,
+				9D7A448A13FAF555003087FF /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				9D7A44E613FB0561003087FF /* PBXTargetDependency */,
+				9D7A44E213FB0551003087FF /* PBXTargetDependency */,
+				9D7A44E013FB0546003087FF /* PBXTargetDependency */,
+			);
+			name = axf;
+			productName = axf;
+			productReference = 9D7A448C13FAF555003087FF /* libaxf.dylib */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		9D7A44BF13FB04A9003087FF /* align */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 9D7A44FF13FB0621003087FF /* Build configuration list for PBXNativeTarget "align" */;
+			buildPhases = (
+				9D7A44BC13FB04A9003087FF /* Headers */,
+				9D7A44BD13FB04A9003087FF /* Sources */,
+				9D7A44BE13FB04A9003087FF /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				9D7A44F013FB0597003087FF /* PBXTargetDependency */,
+				9D7A44EE13FB0597003087FF /* PBXTargetDependency */,
+				9D7A44EC13FB0597003087FF /* PBXTargetDependency */,
+			);
+			name = align;
+			productName = align;
+			productReference = 9D7A44C013FB04A9003087FF /* libalign.dylib */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		9D7A452E13FB0A3C003087FF /* wvxf */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 9D7A454613FB0AF3003087FF /* Build configuration list for PBXNativeTarget "wvxf" */;
+			buildPhases = (
+				9D7A452B13FB0A3C003087FF /* Headers */,
+				9D7A452C13FB0A3C003087FF /* Sources */,
+				9D7A452D13FB0A3C003087FF /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				9D4DCEE41424001C00881098 /* PBXTargetDependency */,
+				9D4DCEE21424001400881098 /* PBXTargetDependency */,
+				9D4DCEDC1423FF6E00881098 /* PBXTargetDependency */,
+			);
+			name = wvxf;
+			productName = wvxf;
+			productReference = 9D7A452F13FB0A3C003087FF /* libwvxf.dylib */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		9D7A454A13FB0B4D003087FF /* wsraxf */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 9D7A455A13FB0BAF003087FF /* Build configuration list for PBXNativeTarget "wsraxf" */;
+			buildPhases = (
+				9D7A454713FB0B4D003087FF /* Headers */,
+				9D7A454813FB0B4D003087FF /* Sources */,
+				9D7A454913FB0B4D003087FF /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				9D4DCEEB1424008500881098 /* PBXTargetDependency */,
+				9D4DCEE91424007F00881098 /* PBXTargetDependency */,
+				9D4DCEE71424007400881098 /* PBXTargetDependency */,
+			);
+			name = wsraxf;
+			productName = wsraxf;
+			productReference = 9D7A454B13FB0B4D003087FF /* libwsraxf.dylib */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		9D7A45A813FB0CB8003087FF /* waxf */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 9D7A45C413FB0CB8003087FF /* Build configuration list for PBXNativeTarget "waxf" */;
+			buildPhases = (
+				9D7A45AF13FB0CB8003087FF /* Headers */,
+				9D7A45B013FB0CB8003087FF /* Sources */,
+				9D7A45C013FB0CB8003087FF /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				9D4DCEEF142400B900881098 /* PBXTargetDependency */,
+				9D4DCEED142400B400881098 /* PBXTargetDependency */,
+				9D7A45A913FB0CB8003087FF /* PBXTargetDependency */,
+				9D7A45AD13FB0CB8003087FF /* PBXTargetDependency */,
+			);
+			name = waxf;
+			productName = axf;
+			productReference = 9D7A45C713FB0CB8003087FF /* libwaxf.dylib */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		9D7A45D113FB0D50003087FF /* walign */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 9D7A45E413FB0D50003087FF /* Build configuration list for PBXNativeTarget "walign" */;
+			buildPhases = (
+				9D7A45D813FB0D50003087FF /* Headers */,
+				9D7A45D913FB0D50003087FF /* Sources */,
+				9D7A45DF13FB0D50003087FF /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				9D7A45D213FB0D50003087FF /* PBXTargetDependency */,
+				9D7A45D413FB0D50003087FF /* PBXTargetDependency */,
+				9D7A45D613FB0D50003087FF /* PBXTargetDependency */,
+			);
+			name = walign;
+			productName = align;
+			productReference = 9D7A45E713FB0D50003087FF /* libwalign.dylib */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		9D7A460613FB0F36003087FF /* kapp */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 9D7A460F13FB0F69003087FF /* Build configuration list for PBXNativeTarget "kapp" */;
+			buildPhases = (
+				9D7A460313FB0F36003087FF /* Headers */,
+				9D7A460413FB0F36003087FF /* Sources */,
+				9D7A460513FB0F36003087FF /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = kapp;
+			productName = kapp;
+			productReference = 9D7A460713FB0F36003087FF /* libkapp.a */;
+			productType = "com.apple.product-type.library.static";
+		};
+		9D7A461313FB1133003087FF /* deseq */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 9D7A461C13FB116A003087FF /* Build configuration list for PBXNativeTarget "deseq" */;
+			buildPhases = (
+				9D7A461113FB1133003087FF /* Sources */,
+				9D7A461213FB1133003087FF /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				9DE55AFE140EF0C800EA61C6 /* PBXTargetDependency */,
+				9DE55A9A140EAC9E00EA61C6 /* PBXTargetDependency */,
+				9DE55A98140EAC9E00EA61C6 /* PBXTargetDependency */,
+				9DE55A96140EAC9E00EA61C6 /* PBXTargetDependency */,
+				9DE55935140D82CD00EA61C6 /* PBXTargetDependency */,
+				9DE55933140D82BC00EA61C6 /* PBXTargetDependency */,
+				9DE55931140D82BC00EA61C6 /* PBXTargetDependency */,
+			);
+			name = deseq;
+			productName = deseq;
+			productReference = 9D7A461413FB1133003087FF /* deseq */;
+			productType = "com.apple.product-type.tool";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		08FB7793FE84155DC02AAC07 /* Project object */ = {
+			isa = PBXProject;
+			attributes = {
+				ORGANIZATIONNAME = NCBI/NLM/NIH;
+			};
+			buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "asm-trace" */;
+			compatibilityVersion = "Xcode 3.1";
+			developmentRegion = English;
+			hasScannedForEncodings = 1;
+			knownRegions = (
+				English,
+				Japanese,
+				French,
+				German,
+			);
+			mainGroup = 08FB7794FE84155DC02AAC07 /* asm-trace */;
+			productRefGroup = 9D7356E611775CB7009EA3E4 /* Products */;
+			projectDirPath = "";
+			projectRoot = ../../..;
+			targets = (
+				9D7357F311779B2A009EA3E4 /* make-env */,
+				9D7A412D13FADF3A003087FF /* ksproc */,
+				9D7A415B13FAE00E003087FF /* kmproc */,
+				9D31EC98117667FA003CDA5E /* klib */,
+				9D7A417713FAE192003087FF /* kdb-cmn */,
+				9D7A423313FAE3F5003087FF /* kdb */,
+				9D7A426713FAE69A003087FF /* wkdb */,
+				9D7A428813FAE9B5003087FF /* vdb-cmn */,
+				9D7A431B13FAED2E003087FF /* vdb */,
+				9D7A433613FAEE0C003087FF /* wvdb */,
+				9D7A44BF13FB04A9003087FF /* align */,
+				9D7A435F13FAF1AE003087FF /* vxf */,
+				9D7A440B13FAF315003087FF /* sraxf */,
+				9D7A448B13FAF555003087FF /* axf */,
+				9D7A452E13FB0A3C003087FF /* wvxf */,
+				9D7A454A13FB0B4D003087FF /* wsraxf */,
+				9D7A45A813FB0CB8003087FF /* waxf */,
+				9D7A45D113FB0D50003087FF /* walign */,
+				9D7A460613FB0F36003087FF /* kapp */,
+				9D7A461313FB1133003087FF /* deseq */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXShellScriptBuildPhase section */
+		9D7357F211779B2A009EA3E4 /* ShellScript */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			inputPaths = (
+			);
+			outputPaths = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "echo \"Setting up run-time environment\"\nmkdir -p $BUILT_PRODUCTS_DIR\n\ncd ../../..\nTOP=`pwd`\nmake -s vers-includes\n\nschema=\"$TOP/interfaces\"\n\ncd $BUILT_PRODUCTS_DIR\n\n[ -e schema ] || ln -s $schema schema\n\ncase $ARCHS in\n\t($ARCHS_STANDARD_32_BIT)\n\t\tmod=\"mod32\"\n\t\twmod=\"wmod32\";\n\t\t;;\n\t($ARCHS_STANDARD_64_BIT)\n\t\tmod=\"mod64\"\n\t\twmod=\"wmod64\";\n\t\t;;\nesac\n\nmkdir -p ${mod}\ncd $mod\nrm -rf *\nln -s ../libvxf.dylib .\nln -s ../libsra [...]
+			showEnvVarsInLog = 0;
+		};
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+		9D31EC96117667FA003CDA5E /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9DFECDC711766982004EFD0D /* arc.c in Sources */,
+				9DFECDC811766982004EFD0D /* buffile.c in Sources */,
+				9DFECDC911766982004EFD0D /* bzip.c in Sources */,
+				9DFECDCA11766982004EFD0D /* countfile.c in Sources */,
+				9DFECDCB11766982004EFD0D /* crc32.c in Sources */,
+				9DFECDCC11766982004EFD0D /* dir_test.c in Sources */,
+				9DFECDCD11766982004EFD0D /* directory.c in Sources */,
+				9DFECDCE11766982004EFD0D /* file.c in Sources */,
+				9DFECDD011766982004EFD0D /* gzip.c in Sources */,
+				9DFECDD111766982004EFD0D /* md5.c in Sources */,
+				9DFECDD211766982004EFD0D /* nullfile.c in Sources */,
+				9DFECDD311766982004EFD0D /* sra.c in Sources */,
+				9DFECDD411766982004EFD0D /* subfile.c in Sources */,
+				9DFECDD511766982004EFD0D /* sysdir.c in Sources */,
+				9DFECDD611766982004EFD0D /* sysdll.c in Sources */,
+				9DFECDD711766982004EFD0D /* sysfile.c in Sources */,
+				9DFECDD811766982004EFD0D /* sysmmap.c in Sources */,
+				9DFECDD911766982004EFD0D /* tar.c in Sources */,
+				9DFECDDA11766982004EFD0D /* teefile.c in Sources */,
+				9DFECDDB11766982004EFD0D /* toc.c in Sources */,
+				9DFECDDC11766982004EFD0D /* tocdir.c in Sources */,
+				9DFECDDD11766982004EFD0D /* tocentry.c in Sources */,
+				9DFECDDE11766982004EFD0D /* tocfile.c in Sources */,
+				9DFECDC511766952004EFD0D /* xml.c in Sources */,
+				9D31EC9D1176680A003CDA5E /* bstpersist.c in Sources */,
+				9D31EC9E1176680A003CDA5E /* container.c in Sources */,
+				9D31EC9F1176680B003CDA5E /* cp1252.c in Sources */,
+				9D31ECA01176680B003CDA5E /* crc32.c in Sources */,
+				9D31ECA11176680C003CDA5E /* data-buffer.c in Sources */,
+				9D31ECA21176680C003CDA5E /* iso8859-1.c in Sources */,
+				9D31ECA31176680D003CDA5E /* iso8859.c in Sources */,
+				9D31ECA41176680D003CDA5E /* log.c in Sources */,
+				9D31ECA51176680E003CDA5E /* md5.c in Sources */,
+				9D31ECA61176680E003CDA5E /* namelist.c in Sources */,
+				9D31ECA71176680F003CDA5E /* pack.c in Sources */,
+				9D31ECA81176680F003CDA5E /* pbstree.c in Sources */,
+				9D31ECA911766810003CDA5E /* ptpersist.c in Sources */,
+				9D31ECAA11766810003CDA5E /* ptrie.c in Sources */,
+				9D31ECAB11766811003CDA5E /* rc-idx-tbl.c in Sources */,
+				9D31ECAC11766811003CDA5E /* rc-tbl.c in Sources */,
+				9D31ECAD11766812003CDA5E /* symtab.c in Sources */,
+				9D31ECAE11766813003CDA5E /* syslog.c in Sources */,
+				9D31ECB011766814003CDA5E /* text.c in Sources */,
+				9D31ECB111766815003CDA5E /* token.c in Sources */,
+				9D31ECB211766815003CDA5E /* trie.c in Sources */,
+				9D31ECB411766816003CDA5E /* unpack.c in Sources */,
+				9D31ECB511766817003CDA5E /* utf8.c in Sources */,
+				9D31ECB611766818003CDA5E /* vector.c in Sources */,
+				9D31ECB711766818003CDA5E /* vlen-encode.c in Sources */,
+				9D8EC41B11C2E49E000F1048 /* pbstree-native.c in Sources */,
+				9D8EC41C11C2E49E000F1048 /* pbstree-swapped.c in Sources */,
+				9D8198A911D3D39700DA4D3C /* vector_namelist.c in Sources */,
+				9D1EC483122D914C00C11287 /* printf.c in Sources */,
+				9D1EC484122D914C00C11287 /* status-rc-strings.c in Sources */,
+				9D1EC485122D914C00C11287 /* status-rc.c in Sources */,
+				9D1EC486122D914C00C11287 /* status.c in Sources */,
+				9D62F42A124D01AE003D38E9 /* bsearch.c in Sources */,
+				9D62F42B124D01AE003D38E9 /* qsort.c in Sources */,
+				9DA3A84E125FA3A8005AD5BB /* refcount.c in Sources */,
+				9DA3A88512663646005AD5BB /* syswriter.c in Sources */,
+				9DA3A8961266375B005AD5BB /* writer.c in Sources */,
+				9DA3A89A12663798005AD5BB /* out.c in Sources */,
+				9D985E8D12886C6100849729 /* config.c in Sources */,
+				9DF1902C128DAEBA00FED4AA /* debug.c in Sources */,
+				9D8204F8130F1100009A8B64 /* pagefile.c in Sources */,
+				9D7A40DB13FADBA3003087FF /* SHA-32bit.c in Sources */,
+				9D7A40DC13FADBA3003087FF /* SHA-64bit.c in Sources */,
+				9D7A40E113FADBEE003087FF /* syserrcode.c in Sources */,
+				9D7A40E213FADBEE003087FF /* systime.c in Sources */,
+				9D7A40FF13FADCFE003087FF /* buffile-write.c in Sources */,
+				9D7A410613FADCFE003087FF /* mmap.c in Sources */,
+				9D7A410913FADCFE003087FF /* pmem.c in Sources */,
+				9D7A445B13FAF49A003087FF /* agrep-myersunltd.c in Sources */,
+				9D7A445C13FAF49A003087FF /* agrep-wumanber.c in Sources */,
+				9D7A445E13FAF49A003087FF /* agrep-myers.c in Sources */,
+				9D7A445F13FAF49A003087FF /* fgrep-boyermoore.c in Sources */,
+				9D7A446113FAF49A003087FF /* fgrep-dumb.c in Sources */,
+				9D7A446213FAF49A003087FF /* search.c in Sources */,
+				9D7A446313FAF49A003087FF /* agrep-dp.c in Sources */,
+				9D7A446413FAF49A003087FF /* fgrep-aho.c in Sources */,
+				9D7A446513FAF49A003087FF /* nucstrstr.c in Sources */,
+				9D1235BC14F571AC00ECC72C /* config-grammar.c in Sources */,
+				9D1235BE14F571AC00ECC72C /* config-lex.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A412B13FADF3A003087FF /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A413B13FADF74003087FF /* stbarrier.c in Sources */,
+				9D7A413C13FADF75003087FF /* stcond.c in Sources */,
+				9D7A413D13FADF75003087FF /* stlock.c in Sources */,
+				9D7A413E13FADF76003087FF /* stsem.c in Sources */,
+				9D7A413F13FADF76003087FF /* stthread.c in Sources */,
+				9D7A414013FADF77003087FF /* sttimeout.c in Sources */,
+				9D7A414213FADF79003087FF /* syslock.c in Sources */,
+				9D7A415113FADFC6003087FF /* queue.c in Sources */,
+				9D7A415213FADFC6003087FF /* sem.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A415913FAE00E003087FF /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A415F13FAE01B003087FF /* queue.c in Sources */,
+				9D7A416013FAE01C003087FF /* sem.c in Sources */,
+				9D7A416113FAE023003087FF /* syscond.c in Sources */,
+				9D7A416213FAE024003087FF /* syslock.c in Sources */,
+				9D7A416313FAE026003087FF /* systhread.c in Sources */,
+				9D7A416413FAE027003087FF /* systimeout.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A417513FAE192003087FF /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A422313FAE325003087FF /* btree.c in Sources */,
+				9D7A422413FAE333003087FF /* dbmgr-cmn.c in Sources */,
+				9D7A427E13FAE90F003087FF /* idxblk.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A423113FAE3F5003087FF /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A423B13FAE433003087FF /* coldata.c in Sources */,
+				9D7A423C13FAE435003087FF /* colidx.c in Sources */,
+				9D7A423E13FAE43F003087FF /* colidx0.c in Sources */,
+				9D7A423F13FAE444003087FF /* colidx1.c in Sources */,
+				9D7A424013FAE446003087FF /* colidx2.c in Sources */,
+				9D7A424113FAE470003087FF /* column-cc.c in Sources */,
+				9D7A424213FAE477003087FF /* column.c in Sources */,
+				9D7A424313FAE47A003087FF /* database-cc.c in Sources */,
+				9D7A424513FAE482003087FF /* database.c in Sources */,
+				9D7A424613FAE484003087FF /* dbcc-cmn.c in Sources */,
+				9D7A424713FAE48A003087FF /* dbmgr.c in Sources */,
+				9D7A424813FAE499003087FF /* index.c in Sources */,
+				9D7A424913FAE4B0003087FF /* kdb.c in Sources */,
+				9D7A424A13FAE4B4003087FF /* meta.c in Sources */,
+				9D7A424B13FAE4B8003087FF /* table-cc.c in Sources */,
+				9D7A424C13FAE4BA003087FF /* table.c in Sources */,
+				9D7A424D13FAE4C1003087FF /* trieidx-v1.c in Sources */,
+				9D7A424E13FAE4C2003087FF /* trieidx-v2.c in Sources */,
+				9D7A424F13FAE4C9003087FF /* u64idx-v3.c in Sources */,
+				9D7A425813FAE616003087FF /* idstats.c in Sources */,
+				9D7A425913FAE629003087FF /* trieval-v1.c in Sources */,
+				9D7A425A13FAE62E003087FF /* ptrieval-v1.c in Sources */,
+				9D7A425B13FAE63F003087FF /* trieval-v2.c in Sources */,
+				9D7A425C13FAE644003087FF /* ptrieval-v2.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A426513FAE69A003087FF /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A426D13FAE6C0003087FF /* wkdb.c in Sources */,
+				9D7A426E13FAE6C5003087FF /* wdbmgr.c in Sources */,
+				9D7A426F13FAE6CC003087FF /* wdatabase.c in Sources */,
+				9D7A427013FAE6D5003087FF /* wtable.c in Sources */,
+				9D7A427113FAE6E1003087FF /* wcolumn.c in Sources */,
+				9D7A427213FAE6EB003087FF /* wcoldata.c in Sources */,
+				9D7A427413FAE89E003087FF /* wcolidx.c in Sources */,
+				9D7A427513FAE8A4003087FF /* wcolidx0.c in Sources */,
+				9D7A427613FAE8A7003087FF /* wcolidx1.c in Sources */,
+				9D7A427713FAE8A8003087FF /* wcolidx2.c in Sources */,
+				9D7A427813FAE8D6003087FF /* widxblk.c in Sources */,
+				9D7A427913FAE8DB003087FF /* wmeta.c in Sources */,
+				9D7A427A13FAE8E7003087FF /* windex.c in Sources */,
+				9D7A427B13FAE8ED003087FF /* wtrieidx-v1.c in Sources */,
+				9D7A427C13FAE8EE003087FF /* wtrieidx-v2.c in Sources */,
+				9D7A427D13FAE8F4003087FF /* wu64idx-v3.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A428613FAE9B5003087FF /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A42E413FAEA2A003087FF /* dbmgr-cmn.c in Sources */,
+				9D7A42E513FAEA36003087FF /* schema-tok.c in Sources */,
+				9D7A42E613FAEA3C003087FF /* schema-parse.c in Sources */,
+				9D7A42E713FAEA45003087FF /* schema-type.c in Sources */,
+				9D7A42E813FAEA4C003087FF /* schema-func.c in Sources */,
+				9D7A42E913FAEA54003087FF /* schema-prod.c in Sources */,
+				9D7A42EA13FAEA5A003087FF /* schema-expr.c in Sources */,
+				9D7A42EB13FAEA60003087FF /* schema-eval.c in Sources */,
+				9D7A42EC13FAEA65003087FF /* schema-tbl.c in Sources */,
+				9D7A42ED13FAEA68003087FF /* schema-db.c in Sources */,
+				9D7A42EE13FAEA6E003087FF /* schema-dump.c in Sources */,
+				9D7A42EF13FAEA72003087FF /* schema-int.c in Sources */,
+				9D7A42F013FAEA7C003087FF /* schema.c in Sources */,
+				9D7A42F113FAEA85003087FF /* linker-int.c in Sources */,
+				9D7A42F213FAEA8D003087FF /* linker-cmn.c in Sources */,
+				9D7A42F313FAEA95003087FF /* database-cmn.c in Sources */,
+				9D7A42F413FAEA98003087FF /* database-load.c in Sources */,
+				9D7A42F513FAEAA0003087FF /* table-cmn.c in Sources */,
+				9D7A42F613FAEAA1003087FF /* table-load.c in Sources */,
+				9D7A42F713FAEAAA003087FF /* cursor-cmn.c in Sources */,
+				9D7A42F813FAEAB2003087FF /* column-cmn.c in Sources */,
+				9D7A42F913FAEABD003087FF /* prod-cmn.c in Sources */,
+				9D7A42FA13FAEAC0003087FF /* prod-expr.c in Sources */,
+				9D7A42FB13FAEAC4003087FF /* prod-func.c in Sources */,
+				9D7A42FC13FAEACB003087FF /* phys-cmn.c in Sources */,
+				9D7A42FD13FAEAD1003087FF /* phys-load.c in Sources */,
+				9D7A42FE13FAEADD003087FF /* blob.c in Sources */,
+				9D7A42FF13FAEAE0003087FF /* blob-headers.c in Sources */,
+				9D7A430013FAEAE7003087FF /* page-map.c in Sources */,
+				9D7A430313FAEB42003087FF /* row-id.c in Sources */,
+				9D7A430413FAEB43003087FF /* row-len.c in Sources */,
+				9D7A430513FAEB49003087FF /* fixed-row-len.c in Sources */,
+				9D7A430613FAEB93003087FF /* merge.c in Sources */,
+				9D7A430713FAEB99003087FF /* split.c in Sources */,
+				9D7A430813FAEBA0003087FF /* compare.c in Sources */,
+				9D7A430913FAEBAE003087FF /* meta-attr-read.c in Sources */,
+				9D7A430B13FAEBB1003087FF /* meta-read.c in Sources */,
+				9D7A430C13FAEBB2003087FF /* meta-value.c in Sources */,
+				9D7A430D13FAEBBF003087FF /* environment-read.c in Sources */,
+				9D7A431013FAEC78003087FF /* cast.c in Sources */,
+				9D7A431113FAEC7A003087FF /* index_lookup.c in Sources */,
+				9D7A431213FAEC7B003087FF /* index_project.c in Sources */,
+				9D7A431313FAEC7C003087FF /* parameter-read.c in Sources */,
+				9D7A431413FAEC7D003087FF /* range-validate.c in Sources */,
+				9D7A431513FAEC7D003087FF /* redimension.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A431913FAED2E003087FF /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A431F13FAED40003087FF /* dbmgr.c in Sources */,
+				9D7A432013FAED47003087FF /* linker.c in Sources */,
+				9D7A432113FAED4E003087FF /* database.c in Sources */,
+				9D7A432213FAED5A003087FF /* table.c in Sources */,
+				9D7A432313FAED61003087FF /* cursor.c in Sources */,
+				9D7A432413FAED69003087FF /* column.c in Sources */,
+				9D7A432513FAED70003087FF /* prod.c in Sources */,
+				9D7A432613FAED79003087FF /* phys.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A433413FAEE0C003087FF /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A434213FAEE66003087FF /* wcolumn.c in Sources */,
+				9D7A434313FAEE67003087FF /* wcursor.c in Sources */,
+				9D7A434413FAEE68003087FF /* wdatabase.c in Sources */,
+				9D7A434513FAEE68003087FF /* wdbmgr.c in Sources */,
+				9D7A434613FAEE69003087FF /* wlinker.c in Sources */,
+				9D7A434713FAEE6A003087FF /* wphys.c in Sources */,
+				9D7A434813FAEE6B003087FF /* wprod.c in Sources */,
+				9D7A434913FAEE6C003087FF /* wtable.c in Sources */,
+				9D7A434B13FAEECB003087FF /* index_insert.c in Sources */,
+				9D7A434C13FAEED1003087FF /* meta-append.c in Sources */,
+				9D7A434D13FAEEDB003087FF /* meta-write.c in Sources */,
+				9D7A434E13FAEEE2003087FF /* meta-attr-write.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A435D13FAF1AE003087FF /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A439913FAF20E003087FF /* add-row-id.c in Sources */,
+				9D7A439A13FAF20E003087FF /* bit_or.c in Sources */,
+				9D7A439B13FAF20E003087FF /* bunzip.c in Sources */,
+				9D7A439D13FAF20E003087FF /* ceil.c in Sources */,
+				9D7A439F13FAF20E003087FF /* clip.c in Sources */,
+				9D7A43A013FAF20E003087FF /* cut.c in Sources */,
+				9D7A43A113FAF20E003087FF /* delta.c in Sources */,
+				9D7A43A213FAF20E003087FF /* deriv.c in Sources */,
+				9D7A43A313FAF20E003087FF /* diff.c in Sources */,
+				9D7A43A413FAF20E003087FF /* echo.c in Sources */,
+				9D7A43A613FAF20E003087FF /* exists.c in Sources */,
+				9D7A43A713FAF20E003087FF /* floor.c in Sources */,
+				9D7A43A913FAF20E003087FF /* funzip.c in Sources */,
+				9D7A43AB13FAF20E003087FF /* integral.c in Sources */,
+				9D7A43AC13FAF20E003087FF /* irzip.c in Sources */,
+				9D7A43B513FAF20E003087FF /* map.c in Sources */,
+				9D7A43B713FAF20E003087FF /* max.c in Sources */,
+				9D7A43B813FAF20E003087FF /* min.c in Sources */,
+				9D7A43B913FAF20E003087FF /* outlier-decoder.c in Sources */,
+				9D7A43BB13FAF20E003087FF /* pack.c in Sources */,
+				9D7A43BC13FAF20E003087FF /* paste.c in Sources */,
+				9D7A43BD13FAF20E003087FF /* rand_4na_2na.c in Sources */,
+				9D7A43BE13FAF20E003087FF /* rldecode.c in Sources */,
+				9D7A43C013FAF20E003087FF /* round.c in Sources */,
+				9D7A43C113FAF20E003087FF /* simple-sub-select.c in Sources */,
+				9D7A43C213FAF20E003087FF /* subtract-row-id.c in Sources */,
+				9D7A43C313FAF20E003087FF /* sum.c in Sources */,
+				9D7A43C413FAF20E003087FF /* trim.c in Sources */,
+				9D7A43C513FAF20E003087FF /* trunc.c in Sources */,
+				9D7A43C613FAF20E003087FF /* undelta.c in Sources */,
+				9D7A43C713FAF20E003087FF /* unpack.c in Sources */,
+				9D7A43C813FAF20E003087FF /* unzip.c in Sources */,
+				9D7A43C913FAF20E003087FF /* vec-sum.c in Sources */,
+				9DE55A28140E94CB00EA61C6 /* iunzip.c in Sources */,
+				9D320AB0142D02B000ACA5AA /* extract_token.c in Sources */,
+				9D320AB1142D02B000ACA5AA /* strtonum.c in Sources */,
+				9D320AB6142D02E600ACA5AA /* sprintf.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A440913FAF315003087FF /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A441413FAF3B5003087FF /* qual4_decode.c in Sources */,
+				9D7A441513FAF3B5003087FF /* format-spot-name.c in Sources */,
+				9D7A441713FAF3B5003087FF /* fpcodec.c in Sources */,
+				9D7A441813FAF3B5003087FF /* v0-decompress-init.c in Sources */,
+				9D7A441913FAF3B5003087FF /* extract-coordinates.c in Sources */,
+				9D7A441C13FAF3B5003087FF /* untyped.c in Sources */,
+				9D7A441D13FAF3B5003087FF /* color-from-dna.c in Sources */,
+				9D7A441E13FAF3B5003087FF /* tokenize-spot_name-454.c in Sources */,
+				9D7A441F13FAF3B5003087FF /* process-position.c in Sources */,
+				9D7A442113FAF3B5003087FF /* bio-start.c in Sources */,
+				9D7A442213FAF3B5003087FF /* normalize.c in Sources */,
+				9D7A442313FAF3B5003087FF /* rewrite-spot-name.c in Sources */,
+				9D7A442513FAF3B5003087FF /* tokenize-spot_name-abi.c in Sources */,
+				9D7A442613FAF3B5003087FF /* tokenize-spot_name-ion-torrent.c in Sources */,
+				9D7A442713FAF3B5003087FF /* v0-decompress.c in Sources */,
+				9D7A442913FAF3B5003087FF /* swap.c in Sources */,
+				9D7A442A13FAF3B5003087FF /* spot-desc.c in Sources */,
+				9D7A442B13FAF3B5003087FF /* tokenize-spot_name-helicos.c in Sources */,
+				9D7A442C13FAF3B5003087FF /* denormalize.c in Sources */,
+				9D7A442D13FAF3B5003087FF /* make-position.c in Sources */,
+				9D7A442F13FAF3B5003087FF /* tokenize-spot_name-illumina.c in Sources */,
+				9D7A443013FAF3B5003087FF /* dna-from-color.c in Sources */,
+				9D7A443113FAF3B5003087FF /* index_lookup.c in Sources */,
+				9D7A443313FAF3B5003087FF /* extract-name_coord.c in Sources */,
+				9D7A443513FAF3B5003087FF /* v0-funcs.c in Sources */,
+				9D7A443613FAF3B5003087FF /* rotate.c in Sources */,
+				9D7A443813FAF3B5003087FF /* read-seg-from-readn.c in Sources */,
+				9D7A443A13FAF3B5003087FF /* dynamic-454-read-descriptor.c in Sources */,
+				9D7A443D13FAF3B5003087FF /* read-desc.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A448913FAF555003087FF /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A448F13FAF56D003087FF /* seq-restore-read.c in Sources */,
+				9D7A449013FAF56D003087FF /* raw-restore-read.c in Sources */,
+				9D7A449113FAF56D003087FF /* align-restore-read.c in Sources */,
+				9D7A449213FAF56D003087FF /* ref-tbl-sub-select.c in Sources */,
+				9D7A449313FAF56D003087FF /* align-local_ref_id.c in Sources */,
+				9D7A449413FAF56D003087FF /* align-ref-pos.c in Sources */,
+				9D7A449613FAF56D003087FF /* align-ref-seq-id.c in Sources */,
+				9D7A449713FAF56D003087FF /* cigar.c in Sources */,
+				9D7A449813FAF56D003087FF /* align-ref-name.c in Sources */,
+				9D7A449913FAF56D003087FF /* template-len.c in Sources */,
+				9D7A449A13FAF56D003087FF /* get-sam-flags.c in Sources */,
+				9D7A449B13FAF56D003087FF /* ref-restore-read.c in Sources */,
+				9D7A449C13FAF56D003087FF /* align-local_ref_start.c in Sources */,
+				9D7A449D13FAF56D003087FF /* project_read_from_sequence.c in Sources */,
+				9D7A449E13FAF56D003087FF /* not-my-row.c in Sources */,
+				9DE55A79140EA19500EA61C6 /* raw-restore-qual.c in Sources */,
+				9DE55A85140EA93600EA61C6 /* generate-mismatch-qual.c in Sources */,
+				9DE55AAF140EC79C00EA61C6 /* mismatch-restore-qual.c in Sources */,
+				9D4DCEAC1423FD9600881098 /* ref-preserve_qual.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A44BD13FB04A9003087FF /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A44C913FB04C2003087FF /* reader-cmn.c in Sources */,
+				9D7A44CA13FB04C2003087FF /* refseq-mgr.c in Sources */,
+				9D7A44CB13FB04C2003087FF /* reader-refseq.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A452C13FB0A3C003087FF /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A453413FB0A5A003087FF /* bzip.c in Sources */,
+				9D7A453513FB0A5D003087FF /* checksum.c in Sources */,
+				9D7A453613FB0A65003087FF /* fzip.c in Sources */,
+				9D7A453813FB0A7A003087FF /* outlier-encoder.c in Sources */,
+				9D7A453913FB0A82003087FF /* rlencode.c in Sources */,
+				9D7A453A13FB0A8E003087FF /* zip.c in Sources */,
+				9D7A458113FB0C53003087FF /* exists.c in Sources */,
+				9D7A458213FB0C53003087FF /* bunzip.c in Sources */,
+				9D7A458313FB0C53003087FF /* trim.c in Sources */,
+				9D7A458413FB0C53003087FF /* rldecode.c in Sources */,
+				9D7A458513FB0C53003087FF /* ceil.c in Sources */,
+				9D7A458713FB0C53003087FF /* paste.c in Sources */,
+				9D7A458813FB0C53003087FF /* max.c in Sources */,
+				9D7A458913FB0C53003087FF /* vec-sum.c in Sources */,
+				9D7A458A13FB0C53003087FF /* echo.c in Sources */,
+				9D7A458B13FB0C53003087FF /* add-row-id.c in Sources */,
+				9D7A458C13FB0C53003087FF /* delta.c in Sources */,
+				9D7A458D13FB0C53003087FF /* floor.c in Sources */,
+				9D7A458E13FB0C53003087FF /* subtract-row-id.c in Sources */,
+				9D7A458F13FB0C53003087FF /* outlier-decoder.c in Sources */,
+				9D7A459013FB0C53003087FF /* deriv.c in Sources */,
+				9D7A459113FB0C53003087FF /* bit_or.c in Sources */,
+				9D7A459313FB0C53003087FF /* irzip.c in Sources */,
+				9D7A459413FB0C53003087FF /* map.c in Sources */,
+				9D7A459513FB0C53003087FF /* pack.c in Sources */,
+				9D7A459613FB0C53003087FF /* sum.c in Sources */,
+				9D7A459713FB0C53003087FF /* unpack.c in Sources */,
+				9D7A459813FB0C53003087FF /* simple-sub-select.c in Sources */,
+				9D7A459913FB0C53003087FF /* rand_4na_2na.c in Sources */,
+				9D7A459A13FB0C53003087FF /* min.c in Sources */,
+				9D7A459B13FB0C53003087FF /* trunc.c in Sources */,
+				9D7A459C13FB0C53003087FF /* round.c in Sources */,
+				9D7A459D13FB0C53003087FF /* integral.c in Sources */,
+				9D7A459E13FB0C53003087FF /* cut.c in Sources */,
+				9D7A459F13FB0C53003087FF /* funzip.c in Sources */,
+				9D7A45A013FB0C53003087FF /* unzip.c in Sources */,
+				9D7A45A113FB0C53003087FF /* undelta.c in Sources */,
+				9D7A45A213FB0C53003087FF /* clip.c in Sources */,
+				9D7A45A313FB0C53003087FF /* diff.c in Sources */,
+				9DE55A23140E94B700EA61C6 /* iunzip.c in Sources */,
+				9D320AB2142D02B000ACA5AA /* extract_token.c in Sources */,
+				9D320AB3142D02B000ACA5AA /* strtonum.c in Sources */,
+				9D320AB7142D02E600ACA5AA /* sprintf.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A454813FB0B4D003087FF /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A454E13FB0B5F003087FF /* extract-name_fmt.c in Sources */,
+				9D7A454F13FB0B60003087FF /* extract-spot_name.c in Sources */,
+				9D7A455013FB0B6C003087FF /* stats.c in Sources */,
+				9D7A455113FB0B6C003087FF /* stats_quality.c in Sources */,
+				9D7A455213FB0B76003087FF /* qual4_encode.c in Sources */,
+				9D7A455B13FB0BCE003087FF /* qual4_decode.c in Sources */,
+				9D7A455C13FB0BCE003087FF /* format-spot-name.c in Sources */,
+				9D7A455D13FB0BCE003087FF /* fpcodec.c in Sources */,
+				9D7A455E13FB0BCE003087FF /* v0-decompress-init.c in Sources */,
+				9D7A455F13FB0BCE003087FF /* extract-coordinates.c in Sources */,
+				9D7A456013FB0BCE003087FF /* untyped.c in Sources */,
+				9D7A456113FB0BCE003087FF /* color-from-dna.c in Sources */,
+				9D7A456213FB0BCE003087FF /* tokenize-spot_name-454.c in Sources */,
+				9D7A456313FB0BCE003087FF /* process-position.c in Sources */,
+				9D7A456513FB0BCE003087FF /* bio-start.c in Sources */,
+				9D7A456613FB0BCE003087FF /* normalize.c in Sources */,
+				9D7A456713FB0BCE003087FF /* rewrite-spot-name.c in Sources */,
+				9D7A456813FB0BCE003087FF /* v0-decompress.c in Sources */,
+				9D7A456913FB0BCE003087FF /* tokenize-spot_name-abi.c in Sources */,
+				9D7A456A13FB0BCE003087FF /* tokenize-spot_name-ion-torrent.c in Sources */,
+				9D7A456B13FB0BCE003087FF /* swap.c in Sources */,
+				9D7A456C13FB0BCE003087FF /* spot-desc.c in Sources */,
+				9D7A456D13FB0BCE003087FF /* tokenize-spot_name-helicos.c in Sources */,
+				9D7A456E13FB0BCE003087FF /* denormalize.c in Sources */,
+				9D7A456F13FB0BCE003087FF /* make-position.c in Sources */,
+				9D7A457013FB0BCE003087FF /* tokenize-spot_name-illumina.c in Sources */,
+				9D7A457113FB0BCE003087FF /* dna-from-color.c in Sources */,
+				9D7A457213FB0BCE003087FF /* index_lookup.c in Sources */,
+				9D7A457313FB0BCE003087FF /* extract-name_coord.c in Sources */,
+				9D7A457413FB0BCE003087FF /* v0-funcs.c in Sources */,
+				9D7A457513FB0BCE003087FF /* rotate.c in Sources */,
+				9D7A457613FB0BCE003087FF /* read-seg-from-readn.c in Sources */,
+				9D7A457713FB0BCE003087FF /* dynamic-454-read-descriptor.c in Sources */,
+				9D7A457813FB0BCE003087FF /* read-desc.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A45B013FB0CB8003087FF /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A45B113FB0CB8003087FF /* seq-restore-read.c in Sources */,
+				9D7A45B213FB0CB8003087FF /* raw-restore-read.c in Sources */,
+				9D7A45B313FB0CB8003087FF /* align-restore-read.c in Sources */,
+				9D7A45B413FB0CB8003087FF /* ref-tbl-sub-select.c in Sources */,
+				9D7A45B513FB0CB8003087FF /* align-local_ref_id.c in Sources */,
+				9D7A45B613FB0CB8003087FF /* align-ref-pos.c in Sources */,
+				9D7A45B713FB0CB8003087FF /* align-ref-seq-id.c in Sources */,
+				9D7A45B813FB0CB8003087FF /* cigar.c in Sources */,
+				9D7A45B913FB0CB8003087FF /* align-ref-name.c in Sources */,
+				9D7A45BA13FB0CB8003087FF /* template-len.c in Sources */,
+				9D7A45BB13FB0CB8003087FF /* get-sam-flags.c in Sources */,
+				9D7A45BC13FB0CB8003087FF /* ref-restore-read.c in Sources */,
+				9D7A45BD13FB0CB8003087FF /* align-local_ref_start.c in Sources */,
+				9D7A45BE13FB0CB8003087FF /* project_read_from_sequence.c in Sources */,
+				9D7A45BF13FB0CB8003087FF /* not-my-row.c in Sources */,
+				9D7A45C813FB0CE4003087FF /* refseq-stats.c in Sources */,
+				9DE55A7A140EA1CA00EA61C6 /* raw-restore-qual.c in Sources */,
+				9DE55A86140EA93600EA61C6 /* generate-mismatch-qual.c in Sources */,
+				9DE55AB0140EC79C00EA61C6 /* mismatch-restore-qual.c in Sources */,
+				9D4DCEAD1423FD9600881098 /* ref-preserve_qual.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A45D913FB0D50003087FF /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A45DC13FB0D50003087FF /* reader-cmn.c in Sources */,
+				9D7A45DD13FB0D50003087FF /* refseq-mgr.c in Sources */,
+				9D7A45DE13FB0D50003087FF /* reader-refseq.c in Sources */,
+				9D7A45EA13FB0D95003087FF /* writer-alignment.c in Sources */,
+				9D7A45EB13FB0D95003087FF /* writer-reference.c in Sources */,
+				9D7A45EC13FB0D95003087FF /* writer-ref.c in Sources */,
+				9D7A45ED13FB0D95003087FF /* writer-refseq.c in Sources */,
+				9D7A45EE13FB0D95003087FF /* writer-cmn.c in Sources */,
+				9D7A45EF13FB0D95003087FF /* writer-sequence.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A460413FB0F36003087FF /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A460A13FB0F52003087FF /* progressbar.c in Sources */,
+				9D7A460B13FB0F52003087FF /* main.c in Sources */,
+				9D7A460C13FB0F52003087FF /* args.c in Sources */,
+				9D7A460D13FB0F52003087FF /* sysmain.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D7A461113FB1133003087FF /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D7A461813FB1140003087FF /* deseq.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+		9D4DCEDC1423FF6E00881098 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D7A433613FAEE0C003087FF /* wvdb */;
+			targetProxy = 9D4DCEDB1423FF6E00881098 /* PBXContainerItemProxy */;
+		};
+		9D4DCEE21424001400881098 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D7A426713FAE69A003087FF /* wkdb */;
+			targetProxy = 9D4DCEE11424001400881098 /* PBXContainerItemProxy */;
+		};
+		9D4DCEE41424001C00881098 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D31EC98117667FA003CDA5E /* klib */;
+			targetProxy = 9D4DCEE31424001C00881098 /* PBXContainerItemProxy */;
+		};
+		9D4DCEE71424007400881098 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D7A433613FAEE0C003087FF /* wvdb */;
+			targetProxy = 9D4DCEE61424007400881098 /* PBXContainerItemProxy */;
+		};
+		9D4DCEE91424007F00881098 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D7A426713FAE69A003087FF /* wkdb */;
+			targetProxy = 9D4DCEE81424007F00881098 /* PBXContainerItemProxy */;
+		};
+		9D4DCEEB1424008500881098 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D31EC98117667FA003CDA5E /* klib */;
+			targetProxy = 9D4DCEEA1424008500881098 /* PBXContainerItemProxy */;
+		};
+		9D4DCEED142400B400881098 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D7A433613FAEE0C003087FF /* wvdb */;
+			targetProxy = 9D4DCEEC142400B400881098 /* PBXContainerItemProxy */;
+		};
+		9D4DCEEF142400B900881098 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D7A426713FAE69A003087FF /* wkdb */;
+			targetProxy = 9D4DCEEE142400B900881098 /* PBXContainerItemProxy */;
+		};
+		9D7A423813FAE3FD003087FF /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D7A417713FAE192003087FF /* kdb-cmn */;
+			targetProxy = 9D7A423713FAE3FD003087FF /* PBXContainerItemProxy */;
+		};
+		9D7A428413FAE9A0003087FF /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D7A417713FAE192003087FF /* kdb-cmn */;
+			targetProxy = 9D7A428313FAE9A0003087FF /* PBXContainerItemProxy */;
+		};
+		9D7A446913FAF4A9003087FF /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D7A431B13FAED2E003087FF /* vdb */;
+			targetProxy = 9D7A446813FAF4A9003087FF /* PBXContainerItemProxy */;
+		};
+		9D7A446D13FAF4B3003087FF /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D7A423313FAE3F5003087FF /* kdb */;
+			targetProxy = 9D7A446C13FAF4B3003087FF /* PBXContainerItemProxy */;
+		};
+		9D7A446F13FAF4B6003087FF /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D31EC98117667FA003CDA5E /* klib */;
+			targetProxy = 9D7A446E13FAF4B6003087FF /* PBXContainerItemProxy */;
+		};
+		9D7A44E013FB0546003087FF /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D7A44BF13FB04A9003087FF /* align */;
+			targetProxy = 9D7A44DF13FB0546003087FF /* PBXContainerItemProxy */;
+		};
+		9D7A44E213FB0551003087FF /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D7A431B13FAED2E003087FF /* vdb */;
+			targetProxy = 9D7A44E113FB0551003087FF /* PBXContainerItemProxy */;
+		};
+		9D7A44E613FB0561003087FF /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D31EC98117667FA003CDA5E /* klib */;
+			targetProxy = 9D7A44E513FB0561003087FF /* PBXContainerItemProxy */;
+		};
+		9D7A44E813FB057E003087FF /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D31EC98117667FA003CDA5E /* klib */;
+			targetProxy = 9D7A44E713FB057E003087FF /* PBXContainerItemProxy */;
+		};
+		9D7A44EA13FB0582003087FF /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D7A431B13FAED2E003087FF /* vdb */;
+			targetProxy = 9D7A44E913FB0582003087FF /* PBXContainerItemProxy */;
+		};
+		9D7A44EC13FB0597003087FF /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D7A431B13FAED2E003087FF /* vdb */;
+			targetProxy = 9D7A44EB13FB0597003087FF /* PBXContainerItemProxy */;
+		};
+		9D7A44EE13FB0597003087FF /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D7A423313FAE3F5003087FF /* kdb */;
+			targetProxy = 9D7A44ED13FB0597003087FF /* PBXContainerItemProxy */;
+		};
+		9D7A44F013FB0597003087FF /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D31EC98117667FA003CDA5E /* klib */;
+			targetProxy = 9D7A44EF13FB0597003087FF /* PBXContainerItemProxy */;
+		};
+		9D7A44F213FB05A9003087FF /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D7A423313FAE3F5003087FF /* kdb */;
+			targetProxy = 9D7A44F113FB05A9003087FF /* PBXContainerItemProxy */;
+		};
+		9D7A44F413FB05A9003087FF /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D31EC98117667FA003CDA5E /* klib */;
+			targetProxy = 9D7A44F313FB05A9003087FF /* PBXContainerItemProxy */;
+		};
+		9D7A44F613FB05C9003087FF /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D7A426713FAE69A003087FF /* wkdb */;
+			targetProxy = 9D7A44F513FB05C9003087FF /* PBXContainerItemProxy */;
+		};
+		9D7A44F813FB05C9003087FF /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D31EC98117667FA003CDA5E /* klib */;
+			targetProxy = 9D7A44F713FB05C9003087FF /* PBXContainerItemProxy */;
+		};
+		9D7A44FA13FB05C9003087FF /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D7A415B13FAE00E003087FF /* kmproc */;
+			targetProxy = 9D7A44F913FB05C9003087FF /* PBXContainerItemProxy */;
+		};
+		9D7A44FC13FB05EB003087FF /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D31EC98117667FA003CDA5E /* klib */;
+			targetProxy = 9D7A44FB13FB05EB003087FF /* PBXContainerItemProxy */;
+		};
+		9D7A44FE13FB05F2003087FF /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D31EC98117667FA003CDA5E /* klib */;
+			targetProxy = 9D7A44FD13FB05F2003087FF /* PBXContainerItemProxy */;
+		};
+		9D7A450613FB06AB003087FF /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D7A428813FAE9B5003087FF /* vdb-cmn */;
+			targetProxy = 9D7A450513FB06AB003087FF /* PBXContainerItemProxy */;
+		};
+		9D7A450813FB06BD003087FF /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D7A428813FAE9B5003087FF /* vdb-cmn */;
+			targetProxy = 9D7A450713FB06BD003087FF /* PBXContainerItemProxy */;
+		};
+		9D7A45A913FB0CB8003087FF /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D31EC98117667FA003CDA5E /* klib */;
+			targetProxy = 9D7A45AA13FB0CB8003087FF /* PBXContainerItemProxy */;
+		};
+		9D7A45AD13FB0CB8003087FF /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D7A44BF13FB04A9003087FF /* align */;
+			targetProxy = 9D7A45AE13FB0CB8003087FF /* PBXContainerItemProxy */;
+		};
+		9D7A45D213FB0D50003087FF /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D31EC98117667FA003CDA5E /* klib */;
+			targetProxy = 9D7A45D313FB0D50003087FF /* PBXContainerItemProxy */;
+		};
+		9D7A45D413FB0D50003087FF /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D7A423313FAE3F5003087FF /* kdb */;
+			targetProxy = 9D7A45D513FB0D50003087FF /* PBXContainerItemProxy */;
+		};
+		9D7A45D613FB0D50003087FF /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D7A431B13FAED2E003087FF /* vdb */;
+			targetProxy = 9D7A45D713FB0D50003087FF /* PBXContainerItemProxy */;
+		};
+		9DE55931140D82BC00EA61C6 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D7A460613FB0F36003087FF /* kapp */;
+			targetProxy = 9DE55930140D82BC00EA61C6 /* PBXContainerItemProxy */;
+		};
+		9DE55933140D82BC00EA61C6 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D7A433613FAEE0C003087FF /* wvdb */;
+			targetProxy = 9DE55932140D82BC00EA61C6 /* PBXContainerItemProxy */;
+		};
+		9DE55935140D82CD00EA61C6 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D31EC98117667FA003CDA5E /* klib */;
+			targetProxy = 9DE55934140D82CD00EA61C6 /* PBXContainerItemProxy */;
+		};
+		9DE55A96140EAC9E00EA61C6 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D7A45A813FB0CB8003087FF /* waxf */;
+			targetProxy = 9DE55A95140EAC9E00EA61C6 /* PBXContainerItemProxy */;
+		};
+		9DE55A98140EAC9E00EA61C6 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D7A454A13FB0B4D003087FF /* wsraxf */;
+			targetProxy = 9DE55A97140EAC9E00EA61C6 /* PBXContainerItemProxy */;
+		};
+		9DE55A9A140EAC9E00EA61C6 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D7A452E13FB0A3C003087FF /* wvxf */;
+			targetProxy = 9DE55A99140EAC9E00EA61C6 /* PBXContainerItemProxy */;
+		};
+		9DE55AFE140EF0C800EA61C6 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D7A426713FAE69A003087FF /* wkdb */;
+			targetProxy = 9DE55AFD140EF0C800EA61C6 /* PBXContainerItemProxy */;
+		};
+/* End PBXTargetDependency section */
+
+/* Begin XCBuildConfiguration section */
+		1DEB928A08733DD80010E9CD /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+				GCC_C_LANGUAGE_STANDARD = gnu99;
+				GCC_ENABLE_CPP_EXCEPTIONS = NO;
+				GCC_ENABLE_CPP_RTTI = NO;
+				GCC_ENABLE_OBJC_EXCEPTIONS = NO;
+				GCC_ENABLE_PASCAL_STRINGS = YES;
+				GCC_LINK_WITH_DYNAMIC_LIBRARIES = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"_LOGGING=1",
+					MAC,
+					_DEBUGGING,
+				);
+				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = NO;
+				GCC_WARN_PEDANTIC = YES;
+				GCC_WARN_SIGN_COMPARE = NO;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				HEADER_SEARCH_PATHS = (
+					../../../interfaces/os/mac,
+					../../../interfaces/os/bsd,
+					../../../interfaces/os/unix,
+					../../../interfaces/cc/gcc/$arch,
+					../../../interfaces/cc/gcc,
+					../../../interfaces,
+					/usr/include/libxml2,
+				);
+				ONLY_ACTIVE_ARCH = YES;
+				PREBINDING = NO;
+				SDKROOT = macosx10.6;
+			};
+			name = Debug;
+		};
+		1DEB928B08733DD80010E9CD /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+				GCC_AUTO_VECTORIZATION = YES;
+				GCC_C_LANGUAGE_STANDARD = gnu99;
+				GCC_ENABLE_CPP_EXCEPTIONS = NO;
+				GCC_ENABLE_CPP_RTTI = NO;
+				GCC_ENABLE_OBJC_EXCEPTIONS = NO;
+				GCC_ENABLE_SSE3_EXTENSIONS = YES;
+				GCC_FAST_OBJC_DISPATCH = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = "";
+				GCC_OBJC_CALL_CXX_CDTORS = NO;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"_LOGGING=1",
+					MAC,
+				);
+				GCC_THUMB_SUPPORT = NO;
+				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+				GCC_WARN_ABOUT_POINTER_SIGNEDNESS = NO;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = NO;
+				GCC_WARN_PROTOTYPE_CONVERSION = NO;
+				GCC_WARN_SIGN_COMPARE = NO;
+				GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = NO;
+				GCC_WARN_UNUSED_VARIABLE = NO;
+				HEADER_SEARCH_PATHS = (
+					../../../interfaces/os/mac,
+					../../../interfaces/os/bsd,
+					../../../interfaces/os/unix,
+					../../../interfaces/cc/gcc/$arch,
+					../../../interfaces/cc/gcc,
+					../../../interfaces,
+					/usr/include/libxml2,
+				);
+				LLVM_LTO = NO;
+				PREBINDING = NO;
+				SDKROOT = macosx10.6;
+				VALID_ARCHS = "i386 x86_64";
+			};
+			name = Release;
+		};
+		9D31EC9A117667FB003CDA5E /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = NO;
+				EXECUTABLE_PREFIX = lib;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = "";
+				LD_DYLIB_INSTALL_NAME = "";
+				LD_OPENMP_FLAGS = "";
+				PREBINDING = NO;
+				PRIVATE_HEADERS_FOLDER_PATH = "";
+				PRODUCT_NAME = klib;
+				PUBLIC_HEADERS_FOLDER_PATH = "";
+			};
+			name = Debug;
+		};
+		9D31EC9B117667FB003CDA5E /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				EXECUTABLE_PREFIX = lib;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = "";
+				INSTALL_PATH = "";
+				LD_DYLIB_INSTALL_NAME = "";
+				LD_OPENMP_FLAGS = "";
+				LLVM_LTO = NO;
+				PREBINDING = NO;
+				PRIVATE_HEADERS_FOLDER_PATH = "";
+				PRODUCT_NAME = klib;
+				PUBLIC_HEADERS_FOLDER_PATH = "";
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		9D7357F411779B2B009EA3E4 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				PRODUCT_NAME = "make-env";
+			};
+			name = Debug;
+		};
+		9D7357F511779B2B009EA3E4 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				PRODUCT_NAME = "make-env";
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		9D7A412F13FADF3B003087FF /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = ksproc;
+			};
+			name = Debug;
+		};
+		9D7A413013FADF3B003087FF /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = ksproc;
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		9D7A415D13FAE00E003087FF /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = kmproc;
+			};
+			name = Debug;
+		};
+		9D7A415E13FAE00E003087FF /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = kmproc;
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		9D7A417913FAE192003087FF /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = "kdb-cmn";
+			};
+			name = Debug;
+		};
+		9D7A417A13FAE192003087FF /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = "kdb-cmn";
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		9D7A423513FAE3F5003087FF /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = NO;
+				EXECUTABLE_PREFIX = lib;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = kdb;
+			};
+			name = Debug;
+		};
+		9D7A423613FAE3F5003087FF /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				EXECUTABLE_PREFIX = lib;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = kdb;
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		9D7A426913FAE69A003087FF /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = NO;
+				EXECUTABLE_PREFIX = lib;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = wkdb;
+			};
+			name = Debug;
+		};
+		9D7A426A13FAE69A003087FF /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				EXECUTABLE_PREFIX = lib;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = wkdb;
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		9D7A428A13FAE9B5003087FF /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = "vdb-cmn";
+			};
+			name = Debug;
+		};
+		9D7A428B13FAE9B5003087FF /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = "vdb-cmn";
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		9D7A431D13FAED2F003087FF /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = NO;
+				EXECUTABLE_PREFIX = lib;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = vdb;
+			};
+			name = Debug;
+		};
+		9D7A431E13FAED2F003087FF /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				EXECUTABLE_PREFIX = lib;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = vdb;
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		9D7A433813FAEE0C003087FF /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = NO;
+				EXECUTABLE_PREFIX = lib;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = wvdb;
+			};
+			name = Debug;
+		};
+		9D7A433913FAEE0C003087FF /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				EXECUTABLE_PREFIX = lib;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = wvdb;
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		9D7A436113FAF1AE003087FF /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = NO;
+				EXECUTABLE_PREFIX = lib;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = vxf;
+			};
+			name = Debug;
+		};
+		9D7A436213FAF1AE003087FF /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				EXECUTABLE_PREFIX = lib;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = vxf;
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		9D7A440D13FAF315003087FF /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = NO;
+				EXECUTABLE_PREFIX = lib;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = sraxf;
+			};
+			name = Debug;
+		};
+		9D7A440E13FAF315003087FF /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				EXECUTABLE_PREFIX = lib;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = sraxf;
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		9D7A448D13FAF555003087FF /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = NO;
+				EXECUTABLE_PREFIX = lib;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = axf;
+			};
+			name = Debug;
+		};
+		9D7A448E13FAF555003087FF /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				EXECUTABLE_PREFIX = lib;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = axf;
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		9D7A44C113FB04A9003087FF /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = NO;
+				EXECUTABLE_PREFIX = lib;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = align;
+			};
+			name = Debug;
+		};
+		9D7A44C213FB04A9003087FF /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				EXECUTABLE_PREFIX = lib;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = align;
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		9D7A453013FB0A3D003087FF /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = NO;
+				EXECUTABLE_PREFIX = lib;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = wvxf;
+			};
+			name = Debug;
+		};
+		9D7A453113FB0A3D003087FF /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				EXECUTABLE_PREFIX = lib;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = wvxf;
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		9D7A454C13FB0B4E003087FF /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = NO;
+				EXECUTABLE_PREFIX = lib;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = wsraxf;
+			};
+			name = Debug;
+		};
+		9D7A454D13FB0B4E003087FF /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				EXECUTABLE_PREFIX = lib;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = wsraxf;
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		9D7A45C513FB0CB8003087FF /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = NO;
+				EXECUTABLE_PREFIX = lib;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = waxf;
+			};
+			name = Debug;
+		};
+		9D7A45C613FB0CB8003087FF /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				EXECUTABLE_PREFIX = lib;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = waxf;
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		9D7A45E513FB0D50003087FF /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = NO;
+				EXECUTABLE_PREFIX = lib;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = walign;
+			};
+			name = Debug;
+		};
+		9D7A45E613FB0D50003087FF /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				EXECUTABLE_PREFIX = lib;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = walign;
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		9D7A460813FB0F36003087FF /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = kapp;
+			};
+			name = Debug;
+		};
+		9D7A460913FB0F36003087FF /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = kapp;
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		9D7A461613FB1133003087FF /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = /usr/local/bin;
+				PREBINDING = NO;
+				PRODUCT_NAME = deseq;
+			};
+			name = Debug;
+		};
+		9D7A461713FB1133003087FF /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = /usr/local/bin;
+				PREBINDING = NO;
+				PRODUCT_NAME = deseq;
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "asm-trace" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				1DEB928A08733DD80010E9CD /* Debug */,
+				1DEB928B08733DD80010E9CD /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		9D31ECBB11766836003CDA5E /* Build configuration list for PBXNativeTarget "klib" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				9D31EC9A117667FB003CDA5E /* Debug */,
+				9D31EC9B117667FB003CDA5E /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		9D7357F611779B49009EA3E4 /* Build configuration list for PBXAggregateTarget "make-env" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				9D7357F411779B2B009EA3E4 /* Debug */,
+				9D7357F511779B2B009EA3E4 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		9D7A414713FADF98003087FF /* Build configuration list for PBXNativeTarget "ksproc" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				9D7A412F13FADF3B003087FF /* Debug */,
+				9D7A413013FADF3B003087FF /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		9D7A417013FAE0A5003087FF /* Build configuration list for PBXNativeTarget "kmproc" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				9D7A415D13FAE00E003087FF /* Debug */,
+				9D7A415E13FAE00E003087FF /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		9D7A417C13FAE1A2003087FF /* Build configuration list for PBXNativeTarget "kdb-cmn" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				9D7A417913FAE192003087FF /* Debug */,
+				9D7A417A13FAE192003087FF /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		9D7A423A13FAE42A003087FF /* Build configuration list for PBXNativeTarget "kdb" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				9D7A423513FAE3F5003087FF /* Debug */,
+				9D7A423613FAE3F5003087FF /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		9D7A427313FAE709003087FF /* Build configuration list for PBXNativeTarget "wkdb" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				9D7A426913FAE69A003087FF /* Debug */,
+				9D7A426A13FAE69A003087FF /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		9D7A428D13FAE9C5003087FF /* Build configuration list for PBXNativeTarget "vdb-cmn" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				9D7A428A13FAE9B5003087FF /* Debug */,
+				9D7A428B13FAE9B5003087FF /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		9D7A432713FAED97003087FF /* Build configuration list for PBXNativeTarget "vdb" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				9D7A431D13FAED2F003087FF /* Debug */,
+				9D7A431E13FAED2F003087FF /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		9D7A434A13FAEE8A003087FF /* Build configuration list for PBXNativeTarget "wvdb" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				9D7A433813FAEE0C003087FF /* Debug */,
+				9D7A433913FAEE0C003087FF /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		9D7A436413FAF1B4003087FF /* Build configuration list for PBXNativeTarget "vxf" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				9D7A436113FAF1AE003087FF /* Debug */,
+				9D7A436213FAF1AE003087FF /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		9D7A441013FAF333003087FF /* Build configuration list for PBXNativeTarget "sraxf" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				9D7A440D13FAF315003087FF /* Debug */,
+				9D7A440E13FAF315003087FF /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		9D7A44A913FAF5C7003087FF /* Build configuration list for PBXNativeTarget "axf" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				9D7A448D13FAF555003087FF /* Debug */,
+				9D7A448E13FAF555003087FF /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		9D7A44FF13FB0621003087FF /* Build configuration list for PBXNativeTarget "align" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				9D7A44C113FB04A9003087FF /* Debug */,
+				9D7A44C213FB04A9003087FF /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		9D7A454613FB0AF3003087FF /* Build configuration list for PBXNativeTarget "wvxf" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				9D7A453013FB0A3D003087FF /* Debug */,
+				9D7A453113FB0A3D003087FF /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		9D7A455A13FB0BAF003087FF /* Build configuration list for PBXNativeTarget "wsraxf" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				9D7A454C13FB0B4E003087FF /* Debug */,
+				9D7A454D13FB0B4E003087FF /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		9D7A45C413FB0CB8003087FF /* Build configuration list for PBXNativeTarget "waxf" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				9D7A45C513FB0CB8003087FF /* Debug */,
+				9D7A45C613FB0CB8003087FF /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		9D7A45E413FB0D50003087FF /* Build configuration list for PBXNativeTarget "walign" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				9D7A45E513FB0D50003087FF /* Debug */,
+				9D7A45E613FB0D50003087FF /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		9D7A460F13FB0F69003087FF /* Build configuration list for PBXNativeTarget "kapp" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				9D7A460813FB0F36003087FF /* Debug */,
+				9D7A460913FB0F36003087FF /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		9D7A461C13FB116A003087FF /* Build configuration list for PBXNativeTarget "deseq" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				9D7A461613FB1133003087FF /* Debug */,
+				9D7A461713FB1133003087FF /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
+}
diff --git a/build/Xcode/old-toolkit/.gitignore b/build/Xcode/old-toolkit/.gitignore
new file mode 100644
index 0000000..378eac2
--- /dev/null
+++ b/build/Xcode/old-toolkit/.gitignore
@@ -0,0 +1 @@
+build
diff --git a/build/Xcode/old-toolkit/old-toolkit.xcodeproj/project.pbxproj b/build/Xcode/old-toolkit/old-toolkit.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..0f58a7e
--- /dev/null
+++ b/build/Xcode/old-toolkit/old-toolkit.xcodeproj/project.pbxproj
@@ -0,0 +1,2153 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 44;
+	objects = {
+
+/* Begin PBXBuildFile section */
+		9D1A14B5119D934300EF212F /* bamtest.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D1A14AB119D931800EF212F /* bamtest.c */; };
+		9D1A14B6119D934A00EF212F /* BAMFile.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D1A14A8119D922100EF212F /* BAMFile.c */; };
+		9D1A14BF119D93BC00EF212F /* libklib.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D65E89E11762C8900F3579B /* libklib.dylib */; };
+		9D1A14C2119D93D100EF212F /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D65E5B41174E2D100F3579B /* libz.dylib */; };
+		9D65E5AA1174E29F00F3579B /* sra2kdb.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5A91174E29F00F3579B /* sra2kdb.c */; };
+		9D65E5B71174E2D100F3579B /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D65E5B41174E2D100F3579B /* libz.dylib */; };
+		9D65E5B81174E2D100F3579B /* libbz2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D65E5B51174E2D100F3579B /* libbz2.dylib */; };
+		9D65E5B91174E2D100F3579B /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D65E5B61174E2D100F3579B /* libxml2.dylib */; };
+		9D65E8A111762C9B00F3579B /* arc.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5CF1174E2DB00F3579B /* arc.c */; };
+		9D65E8A311762C9C00F3579B /* bstpersist.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5BD1174E2DB00F3579B /* bstpersist.c */; };
+		9D65E8A411762C9C00F3579B /* buffile.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5D01174E2DB00F3579B /* buffile.c */; };
+		9D65E8A511762C9D00F3579B /* bzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5D11174E2DB00F3579B /* bzip.c */; };
+		9D65E8A611762C9D00F3579B /* container.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5BE1174E2DB00F3579B /* container.c */; };
+		9D65E8A711762C9E00F3579B /* countfile.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5D21174E2DB00F3579B /* countfile.c */; };
+		9D65E8A811762C9F00F3579B /* cp1252.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5EC1174E2DB00F3579B /* cp1252.c */; };
+		9D65E8A911762CA000F3579B /* crc32.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5D31174E2DB00F3579B /* crc32.c */; };
+		9D65E8AA11762CA000F3579B /* crc32.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5C81174E2DB00F3579B /* crc32.c */; };
+		9D65E8AB11762CA100F3579B /* dir_test.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5D41174E2DB00F3579B /* dir_test.c */; };
+		9D65E8AC11762CA200F3579B /* directory.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5D51174E2DB00F3579B /* directory.c */; };
+		9D65E8AD11762CA200F3579B /* file.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5D61174E2DB00F3579B /* file.c */; };
+		9D65E8AF11762CA300F3579B /* gzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5D71174E2DB00F3579B /* gzip.c */; };
+		9D65E8B011762CA400F3579B /* iso8859-1.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5ED1174E2DB00F3579B /* iso8859-1.c */; };
+		9D65E8B111762CA500F3579B /* iso8859.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5EE1174E2DB00F3579B /* iso8859.c */; };
+		9D65E8B211762CA500F3579B /* md5.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5D81174E2DB00F3579B /* md5.c */; };
+		9D65E8B311762CA600F3579B /* md5.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5C91174E2DB00F3579B /* md5.c */; };
+		9D65E8B411762CA600F3579B /* namelist.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5BF1174E2DB00F3579B /* namelist.c */; };
+		9D65E8B511762CA700F3579B /* nullfile.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5D91174E2DB00F3579B /* nullfile.c */; };
+		9D65E8B611762CA800F3579B /* pbstree.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5C01174E2DB00F3579B /* pbstree.c */; };
+		9D65E8B711762CA800F3579B /* ptpersist.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5C11174E2DB00F3579B /* ptpersist.c */; };
+		9D65E8B811762CA900F3579B /* ptrie.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5C21174E2DB00F3579B /* ptrie.c */; };
+		9D65E8B911762CAA00F3579B /* queue.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5C31174E2DB00F3579B /* queue.c */; };
+		9D65E8BB11762CBC00F3579B /* sra.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5DA1174E2DB00F3579B /* sra.c */; };
+		9D65E8BC11762CBC00F3579B /* stbarrier.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5E41174E2DB00F3579B /* stbarrier.c */; };
+		9D65E8BD11762CBD00F3579B /* stcond.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5E51174E2DB00F3579B /* stcond.c */; };
+		9D65E8BE11762CBE00F3579B /* stlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5E61174E2DB00F3579B /* stlock.c */; };
+		9D65E8BF11762CBE00F3579B /* stsem.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5E71174E2DB00F3579B /* stsem.c */; };
+		9D65E8C011762CBF00F3579B /* stthread.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5E81174E2DB00F3579B /* stthread.c */; };
+		9D65E8C111762CBF00F3579B /* sttimeout.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5E91174E2DB00F3579B /* sttimeout.c */; };
+		9D65E8C211762CC000F3579B /* subfile.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5DB1174E2DB00F3579B /* subfile.c */; };
+		9D65E8C311762CC000F3579B /* symtab.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5EF1174E2DB00F3579B /* symtab.c */; };
+		9D65E8C411762CC100F3579B /* sysdir.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5CB1174E2DB00F3579B /* sysdir.c */; };
+		9D65E8C511762CC200F3579B /* sysdll.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5CC1174E2DB00F3579B /* sysdll.c */; };
+		9D65E8C611762CC300F3579B /* sysfile.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5CD1174E2DB00F3579B /* sysfile.c */; };
+		9D65E8C711762CC300F3579B /* sysmmap.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5CE1174E2DB00F3579B /* sysmmap.c */; };
+		9D65E8C811762CC400F3579B /* tar.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5DC1174E2DB00F3579B /* tar.c */; };
+		9D65E8C911762CC500F3579B /* teefile.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5DD1174E2DB00F3579B /* teefile.c */; };
+		9D65E8CA11762CC500F3579B /* text.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5F01174E2DB00F3579B /* text.c */; };
+		9D65E8CB11762CC600F3579B /* toc.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5DE1174E2DB00F3579B /* toc.c */; };
+		9D65E8CC11762CC600F3579B /* tocdir.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5DF1174E2DB00F3579B /* tocdir.c */; };
+		9D65E8CD11762CC700F3579B /* tocentry.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5E01174E2DB00F3579B /* tocentry.c */; };
+		9D65E8CE11762CC700F3579B /* tocfile.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5E11174E2DB00F3579B /* tocfile.c */; };
+		9D65E8CF11762CC800F3579B /* token.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5F11174E2DB00F3579B /* token.c */; };
+		9D65E8D011762CCA00F3579B /* trie.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5C41174E2DB00F3579B /* trie.c */; };
+		9D65E8D111762CCA00F3579B /* utf8.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5F21174E2DB00F3579B /* utf8.c */; };
+		9D65E8D211762CCB00F3579B /* vector.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5C61174E2DB00F3579B /* vector.c */; };
+		9D65E8D311762CCB00F3579B /* xml.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5F51174E2DB00F3579B /* xml.c */; };
+		9D65E8D711762D1600F3579B /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D65E5B41174E2D100F3579B /* libz.dylib */; };
+		9D65E8D811762D1E00F3579B /* libbz2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D65E5B51174E2D100F3579B /* libbz2.dylib */; };
+		9D65E8D911762D2200F3579B /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D65E5B61174E2D100F3579B /* libxml2.dylib */; };
+		9D65E90011762F2900F3579B /* log.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E77A1174E6F000F3579B /* log.c */; };
+		9D65E90111762F2A00F3579B /* syslog.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7841174E6FA00F3579B /* syslog.c */; };
+		9D65E90211762F2A00F3579B /* text-log.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E77E1174E6F000F3579B /* text-log.c */; };
+		9D65E90811762F6800F3579B /* rc-tbl.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E77D1174E6F000F3579B /* rc-tbl.c */; };
+		9D65E90B11762F8200F3579B /* rc-idx-tbl.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E77C1174E6F000F3579B /* rc-idx-tbl.c */; };
+		9D65E9131176300200F3579B /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E77B1174E6F000F3579B /* main.c */; };
+		9D65E9141176300300F3579B /* sysmain.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7851174E6FA00F3579B /* sysmain.c */; };
+		9D65E9401176309200F3579B /* coldata.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6211174E2DB00F3579B /* coldata.c */; };
+		9D65E9411176309200F3579B /* colidx.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6221174E2DB00F3579B /* colidx.c */; };
+		9D65E9421176309200F3579B /* colidx0.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6231174E2DB00F3579B /* colidx0.c */; };
+		9D65E9431176309300F3579B /* colidx1.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6241174E2DB00F3579B /* colidx1.c */; };
+		9D65E9441176309400F3579B /* colidx2.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6251174E2DB00F3579B /* colidx2.c */; };
+		9D65E9451176309400F3579B /* column.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6261174E2DB00F3579B /* column.c */; };
+		9D65E9461176309500F3579B /* database.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6271174E2DB00F3579B /* database.c */; };
+		9D65E9471176309500F3579B /* dbmgr.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6281174E2DB00F3579B /* dbmgr.c */; };
+		9D65E9481176309600F3579B /* idxblk.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6291174E2DB00F3579B /* idxblk.c */; };
+		9D65E9491176309600F3579B /* index.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E62A1174E2DB00F3579B /* index.c */; };
+		9D65E94A1176309700F3579B /* kdb.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E62B1174E2DB00F3579B /* kdb.c */; };
+		9D65E94B1176309800F3579B /* meta.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E62C1174E2DB00F3579B /* meta.c */; };
+		9D65E94C1176309900F3579B /* table.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E62D1174E2DB00F3579B /* table.c */; };
+		9D65E94D1176309900F3579B /* trieidx-v1.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E62E1174E2DB00F3579B /* trieidx-v1.c */; };
+		9D65E94E1176309A00F3579B /* trieidx-v2.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E62F1174E2DB00F3579B /* trieidx-v2.c */; };
+		9D65E94F1176309B00F3579B /* u64idx-v3.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6301174E2DB00F3579B /* u64idx-v3.c */; };
+		9D65E96C117630B300F3579B /* idxblk.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6291174E2DB00F3579B /* idxblk.c */; };
+		9D65E974117630B300F3579B /* wcoldata.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6311174E2DB00F3579B /* wcoldata.c */; };
+		9D65E975117630B300F3579B /* wcolidx.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6321174E2DB00F3579B /* wcolidx.c */; };
+		9D65E976117630B300F3579B /* wcolidx0.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6331174E2DB00F3579B /* wcolidx0.c */; };
+		9D65E977117630B300F3579B /* wcolidx1.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6341174E2DB00F3579B /* wcolidx1.c */; };
+		9D65E978117630B300F3579B /* wcolidx2.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6351174E2DB00F3579B /* wcolidx2.c */; };
+		9D65E979117630B300F3579B /* wcolumn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6361174E2DB00F3579B /* wcolumn.c */; };
+		9D65E97A117630B300F3579B /* wdatabase.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6371174E2DB00F3579B /* wdatabase.c */; };
+		9D65E97B117630B300F3579B /* wdbmgr.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6381174E2DB00F3579B /* wdbmgr.c */; };
+		9D65E97C117630B300F3579B /* widxblk.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6391174E2DB00F3579B /* widxblk.c */; };
+		9D65E97D117630B300F3579B /* windex.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E63A1174E2DB00F3579B /* windex.c */; };
+		9D65E97E117630B300F3579B /* wkdb.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E63B1174E2DB00F3579B /* wkdb.c */; };
+		9D65E97F117630B300F3579B /* wmeta.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E63C1174E2DB00F3579B /* wmeta.c */; };
+		9D65E980117630B300F3579B /* wtable.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E63D1174E2DB00F3579B /* wtable.c */; };
+		9D65E981117630B300F3579B /* wtrieidx-v1.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E63E1174E2DB00F3579B /* wtrieidx-v1.c */; };
+		9D65E982117630B300F3579B /* wtrieidx-v2.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E63F1174E2DB00F3579B /* wtrieidx-v2.c */; };
+		9D65E983117630B300F3579B /* wu64idx-v3.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6401174E2DB00F3579B /* wu64idx-v3.c */; };
+		9D65E9AC1176312E00F3579B /* libklib.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D65E89E11762C8900F3579B /* libklib.dylib */; };
+		9D65E9B1117631C700F3579B /* pack.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6011174E2DB00F3579B /* pack.c */; };
+		9D65E9B2117631CC00F3579B /* unpack.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6071174E2DB00F3579B /* unpack.c */; };
+		9D65E9DB1176327200F3579B /* libklib.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D65E89E11762C8900F3579B /* libklib.dylib */; };
+		9D65E9EA117632F500F3579B /* blob.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E60A1174E2DB00F3579B /* blob.c */; };
+		9D65E9EB117632F600F3579B /* column-cmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E60B1174E2DB00F3579B /* column-cmn.c */; };
+		9D65E9EC117632F600F3579B /* column.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E60C1174E2DB00F3579B /* column.c */; };
+		9D65E9ED117632F700F3579B /* cursor-cmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E60D1174E2DB00F3579B /* cursor-cmn.c */; settings = {COMPILER_FLAGS = "-DVCursorWhack=VCursorDestroy"; }; };
+		9D65E9EE117632F700F3579B /* database.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E60E1174E2DB00F3579B /* database.c */; };
+		9D65E9EF117632F800F3579B /* dbmgr-cmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E60F1174E2DB00F3579B /* dbmgr-cmn.c */; };
+		9D65E9F0117632F800F3579B /* dbmgr.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6101174E2DB00F3579B /* dbmgr.c */; };
+		9D65E9F1117632F900F3579B /* dtype.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6111174E2DB00F3579B /* dtype.c */; };
+		9D65E9F2117632F900F3579B /* loader.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6121174E2DB00F3579B /* loader.c */; };
+		9D65E9F3117632FA00F3579B /* parse.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6131174E2DB00F3579B /* parse.c */; };
+		9D65E9F4117632FB00F3579B /* schema-dump.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6141174E2DB00F3579B /* schema-dump.c */; };
+		9D65E9F5117632FB00F3579B /* schema.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6151174E2DB00F3579B /* schema.c */; };
+		9D65E9F7117632FD00F3579B /* table-cmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6171174E2DB00F3579B /* table-cmn.c */; };
+		9D65E9F8117632FD00F3579B /* table.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6181174E2DB00F3579B /* table.c */; };
+		9D65E9FE1176330000F3579B /* xform.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E61E1174E2DB00F3579B /* xform.c */; };
+		9D65E9FF1176330100F3579B /* xfuncs.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E61F1174E2DB00F3579B /* xfuncs.c */; };
+		9D65EA041176330D00F3579B /* blob.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E60A1174E2DB00F3579B /* blob.c */; };
+		9D65EA051176330D00F3579B /* column-cmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E60B1174E2DB00F3579B /* column-cmn.c */; };
+		9D65EA071176330D00F3579B /* cursor-cmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E60D1174E2DB00F3579B /* cursor-cmn.c */; };
+		9D65EA081176330D00F3579B /* database.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E60E1174E2DB00F3579B /* database.c */; };
+		9D65EA091176330D00F3579B /* dbmgr-cmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E60F1174E2DB00F3579B /* dbmgr-cmn.c */; };
+		9D65EA0B1176330D00F3579B /* dtype.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6111174E2DB00F3579B /* dtype.c */; };
+		9D65EA0C1176330D00F3579B /* loader.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6121174E2DB00F3579B /* loader.c */; };
+		9D65EA0D1176330D00F3579B /* parse.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6131174E2DB00F3579B /* parse.c */; };
+		9D65EA0E1176330D00F3579B /* schema-dump.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6141174E2DB00F3579B /* schema-dump.c */; };
+		9D65EA0F1176330D00F3579B /* schema.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6151174E2DB00F3579B /* schema.c */; };
+		9D65EA101176330D00F3579B /* static-column-temp.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6161174E2DB00F3579B /* static-column-temp.c */; };
+		9D65EA111176330D00F3579B /* table-cmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6171174E2DB00F3579B /* table-cmn.c */; };
+		9D65EA131176330D00F3579B /* wcolumn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6191174E2DB00F3579B /* wcolumn.c */; };
+		9D65EA141176330D00F3579B /* wcursor.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E61A1174E2DB00F3579B /* wcursor.c */; };
+		9D65EA151176330D00F3579B /* wdatabase.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E61B1174E2DB00F3579B /* wdatabase.c */; };
+		9D65EA161176330D00F3579B /* wdbmgr.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E61C1174E2DB00F3579B /* wdbmgr.c */; };
+		9D65EA171176330D00F3579B /* wtable.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E61D1174E2DB00F3579B /* wtable.c */; };
+		9D65EA181176330D00F3579B /* xform.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E61E1174E2DB00F3579B /* xform.c */; };
+		9D65EA191176330D00F3579B /* xfuncs.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E61F1174E2DB00F3579B /* xfuncs.c */; };
+		9D65EA271176335200F3579B /* libklib.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D65E89E11762C8900F3579B /* libklib.dylib */; };
+		9D65EA2A1176335C00F3579B /* libwkdb.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D65E988117630B300F3579B /* libwkdb.dylib */; };
+		9D65EA3F1176337C00F3579B /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D65E5B41174E2D100F3579B /* libz.dylib */; };
+		9D65EA5C117633C600F3579B /* libklib.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D65E89E11762C8900F3579B /* libklib.dylib */; };
+		9D65EA5D117633C900F3579B /* libkdb.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D65E91D1176303D00F3579B /* libkdb.dylib */; };
+		9D65EA641176340100F3579B /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D65E5B41174E2D100F3579B /* libz.dylib */; };
+		9D65EA941176366D00F3579B /* libwvdb.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D65EA1E1176330D00F3579B /* libwvdb.dylib */; };
+		9D65EA951176367400F3579B /* libklib.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D65E89E11762C8900F3579B /* libklib.dylib */; };
+		9D65EA961176367600F3579B /* libkdb.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D65E91D1176303D00F3579B /* libkdb.dylib */; };
+		9D65EA971176367900F3579B /* libvdb.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D65E9E7117632C800F3579B /* libvdb.dylib */; };
+		9D65EA981176368800F3579B /* legvcol.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6FF1174E54800F3579B /* legvcol.c */; };
+		9D65EA9B1176368A00F3579B /* sra_decompress.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7011174E54800F3579B /* sra_decompress.c */; };
+		9D65EA9C1176368A00F3579B /* sra_decompress_init.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7001174E54800F3579B /* sra_decompress_init.c */; };
+		9D65EA9D1176368B00F3579B /* sracol-cmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7071174E56300F3579B /* sracol-cmn.c */; };
+		9D65EA9E1176368B00F3579B /* sracol.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7081174E56300F3579B /* sracol.c */; };
+		9D65EA9F1176368C00F3579B /* sraerr.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7091174E56300F3579B /* sraerr.c */; };
+		9D65EAA21176368D00F3579B /* sranam.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E70C1174E56300F3579B /* sranam.c */; };
+		9D65EAA31176368E00F3579B /* sraschema.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E70D1174E56300F3579B /* sraschema.c */; };
+		9D65EAA41176368E00F3579B /* sratbl-cmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E70E1174E56300F3579B /* sratbl-cmn.c */; };
+		9D65EAA51176368F00F3579B /* sratbl.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E70F1174E56300F3579B /* sratbl.c */; };
+		9D65EAAA1176369600F3579B /* clip_quality_right.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7391174E60300F3579B /* clip_quality_right.c */; };
+		9D65EAAB1176369600F3579B /* color-space.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E73A1174E60300F3579B /* color-space.c */; };
+		9D65EAAC1176369600F3579B /* delta-log-delta.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E73B1174E60300F3579B /* delta-log-delta.c */; };
+		9D65EAAD1176369700F3579B /* intensity-norm.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E73C1174E60300F3579B /* intensity-norm.c */; };
+		9D65EAAE1176369700F3579B /* nencode.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E73D1174E60300F3579B /* nencode.c */; };
+		9D65EAAF1176369800F3579B /* phred-from-qval.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E73E1174E60300F3579B /* phred-from-qval.c */; };
+		9D65EAB01176369800F3579B /* platform_name.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E73F1174E60300F3579B /* platform_name.c */; };
+		9D65EAB11176369900F3579B /* position.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7401174E60300F3579B /* position.c */; };
+		9D65EAB21176369900F3579B /* prob.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7411174E60300F3579B /* prob.c */; };
+		9D65EAB31176369A00F3579B /* ptranspose.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7421174E60300F3579B /* ptranspose.c */; };
+		9D65EAB41176369A00F3579B /* qual4_codec.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7431174E60300F3579B /* qual4_codec.c */; };
+		9D65EAB51176369B00F3579B /* quality.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7441174E60300F3579B /* quality.c */; };
+		9D65EAB61176369B00F3579B /* read-desc.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7461174E60300F3579B /* read-desc.c */; };
+		9D65EAB71176369C00F3579B /* read2na.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7471174E60300F3579B /* read2na.c */; };
+		9D65EAB81176369C00F3579B /* read4na.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7481174E60300F3579B /* read4na.c */; };
+		9D65EAB91176369D00F3579B /* read_struct.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7451174E60300F3579B /* read_struct.c */; };
+		9D65EABA1176369D00F3579B /* readFasta.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7491174E60300F3579B /* readFasta.c */; };
+		9D65EABB1176369E00F3579B /* reorder.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E74A1174E60300F3579B /* reorder.c */; };
+		9D65EABC1176369F00F3579B /* rotate.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E74B1174E60300F3579B /* rotate.c */; };
+		9D65EABD1176369F00F3579B /* sort-order.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E74C1174E60300F3579B /* sort-order.c */; };
+		9D65EABE117636A000F3579B /* swap.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E74D1174E60300F3579B /* swap.c */; };
+		9D65EABF117636A000F3579B /* validate.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E74E1174E60300F3579B /* validate.c */; };
+		9D65EAC2117636AC00F3579B /* nucstrstr.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7681174E61D00F3579B /* nucstrstr.c */; };
+		9D65EAC3117636AF00F3579B /* srapath.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7751174E6BA00F3579B /* srapath.c */; };
+		9D65EAC9117636BD00F3579B /* legvcol.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6FF1174E54800F3579B /* legvcol.c */; };
+		9D65EACB117636BD00F3579B /* ncbi-wsramgr.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7061174E56300F3579B /* ncbi-wsramgr.c */; };
+		9D65EACC117636BD00F3579B /* sra_decompress.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7011174E54800F3579B /* sra_decompress.c */; };
+		9D65EACD117636BD00F3579B /* sra_decompress_init.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7001174E54800F3579B /* sra_decompress_init.c */; };
+		9D65EACE117636BD00F3579B /* sracol-cmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7071174E56300F3579B /* sracol-cmn.c */; };
+		9D65EAD0117636BD00F3579B /* sraerr.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7091174E56300F3579B /* sraerr.c */; };
+		9D65EAD1117636BD00F3579B /* sramgr-cmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E70A1174E56300F3579B /* sramgr-cmn.c */; };
+		9D65EAD3117636BD00F3579B /* sranam.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E70C1174E56300F3579B /* sranam.c */; };
+		9D65EAD5117636BD00F3579B /* sratbl-cmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E70E1174E56300F3579B /* sratbl-cmn.c */; };
+		9D65EAD7117636BD00F3579B /* wsracol.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7101174E56300F3579B /* wsracol.c */; };
+		9D65EAD9117636BD00F3579B /* wsraschema.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7121174E56300F3579B /* wsraschema.c */; };
+		9D65EADA117636BD00F3579B /* wsratbl.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7131174E56300F3579B /* wsratbl.c */; };
+		9D65EADB117636BD00F3579B /* clip_quality_right.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7391174E60300F3579B /* clip_quality_right.c */; };
+		9D65EADC117636BD00F3579B /* color-space.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E73A1174E60300F3579B /* color-space.c */; };
+		9D65EADD117636BD00F3579B /* delta-log-delta.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E73B1174E60300F3579B /* delta-log-delta.c */; };
+		9D65EADE117636BD00F3579B /* intensity-norm.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E73C1174E60300F3579B /* intensity-norm.c */; };
+		9D65EADF117636BD00F3579B /* nencode.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E73D1174E60300F3579B /* nencode.c */; };
+		9D65EAE0117636BD00F3579B /* phred-from-qval.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E73E1174E60300F3579B /* phred-from-qval.c */; };
+		9D65EAE1117636BD00F3579B /* platform_name.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E73F1174E60300F3579B /* platform_name.c */; };
+		9D65EAE2117636BD00F3579B /* position.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7401174E60300F3579B /* position.c */; };
+		9D65EAE3117636BD00F3579B /* prob.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7411174E60300F3579B /* prob.c */; };
+		9D65EAE4117636BD00F3579B /* ptranspose.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7421174E60300F3579B /* ptranspose.c */; };
+		9D65EAE5117636BD00F3579B /* qual4_codec.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7431174E60300F3579B /* qual4_codec.c */; };
+		9D65EAE6117636BD00F3579B /* quality.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7441174E60300F3579B /* quality.c */; };
+		9D65EAE7117636BD00F3579B /* read-desc.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7461174E60300F3579B /* read-desc.c */; };
+		9D65EAE8117636BD00F3579B /* read2na.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7471174E60300F3579B /* read2na.c */; };
+		9D65EAE9117636BD00F3579B /* read4na.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7481174E60300F3579B /* read4na.c */; };
+		9D65EAEA117636BD00F3579B /* read_struct.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7451174E60300F3579B /* read_struct.c */; };
+		9D65EAEB117636BD00F3579B /* readFasta.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7491174E60300F3579B /* readFasta.c */; };
+		9D65EAEC117636BD00F3579B /* reorder.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E74A1174E60300F3579B /* reorder.c */; };
+		9D65EAED117636BD00F3579B /* rotate.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E74B1174E60300F3579B /* rotate.c */; };
+		9D65EAEE117636BD00F3579B /* sort-order.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E74C1174E60300F3579B /* sort-order.c */; };
+		9D65EAEF117636BD00F3579B /* swap.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E74D1174E60300F3579B /* swap.c */; };
+		9D65EAF0117636BD00F3579B /* validate.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E74E1174E60300F3579B /* validate.c */; };
+		9D65EAF1117636BD00F3579B /* nucstrstr.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7681174E61D00F3579B /* nucstrstr.c */; };
+		9D65EAF2117636BD00F3579B /* srapath.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E7751174E6BA00F3579B /* srapath.c */; };
+		9D65EAF4117636BD00F3579B /* libklib.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D65E89E11762C8900F3579B /* libklib.dylib */; };
+		9D65EB031176372D00F3579B /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D65E5B41174E2D100F3579B /* libz.dylib */; };
+		9D65EB061176376D00F3579B /* sraschema.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E70D1174E56300F3579B /* sraschema.c */; };
+		9D65EB0B117637AF00F3579B /* libwvdb.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D65EA1E1176330D00F3579B /* libwvdb.dylib */; };
+		9D65EB0E117637B700F3579B /* libwkdb.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D65E988117630B300F3579B /* libwkdb.dylib */; };
+		9D65EB11117637C200F3579B /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D65E5B41174E2D100F3579B /* libz.dylib */; };
+		9D65EB2A1176397E00F3579B /* sramgr-cmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E70A1174E56300F3579B /* sramgr-cmn.c */; };
+		9D65EB2B1176397E00F3579B /* sramgr.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E70B1174E56300F3579B /* sramgr.c */; };
+		9D65EB401176437700F3579B /* libwsra.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D65EAFA117636BD00F3579B /* libwsra.dylib */; };
+		9D65EBC611764AA500F3579B /* libwkdb.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D65E988117630B300F3579B /* libwkdb.dylib */; };
+		9D65EBC911764AAE00F3579B /* libklib.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D65E89E11762C8900F3579B /* libklib.dylib */; };
+		9D65EBD211764BB900F3579B /* echo.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5F71174E2DB00F3579B /* echo.c */; };
+		9D65EBD311764BB900F3579B /* factories.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5F81174E2DB00F3579B /* factories.c */; };
+		9D65EBD411764BBA00F3579B /* floor.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5F91174E2DB00F3579B /* floor.c */; };
+		9D65EBD511764BBA00F3579B /* fpcodec.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5FA1174E2DB00F3579B /* fpcodec.c */; };
+		9D65EBD611764BBB00F3579B /* hufDecode.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5FB1174E2DB00F3579B /* hufDecode.c */; };
+		9D65EBD711764BBB00F3579B /* hufEncode.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5FC1174E2DB00F3579B /* hufEncode.c */; };
+		9D65EBD811764BBC00F3579B /* hufTable.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5FD1174E2DB00F3579B /* hufTable.c */; };
+		9D65EBD911764BBC00F3579B /* hufZlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5FE1174E2DB00F3579B /* hufZlib.c */; };
+		9D65EBDA11764BBD00F3579B /* muxing.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E5FF1174E2DB00F3579B /* muxing.c */; };
+		9D65EBDB11764BBD00F3579B /* null-row.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6001174E2DB00F3579B /* null-row.c */; };
+		9D65EBDC11764BBE00F3579B /* parse_args.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6021174E2DB00F3579B /* parse_args.c */; };
+		9D65EBDD11764BBF00F3579B /* rleDecode.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6031174E2DB00F3579B /* rleDecode.c */; };
+		9D65EBDE11764BBF00F3579B /* rleEncode.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6041174E2DB00F3579B /* rleEncode.c */; };
+		9D65EBDF11764BC000F3579B /* row-len.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6051174E2DB00F3579B /* row-len.c */; };
+		9D65EBE011764BC000F3579B /* transpose.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6061174E2DB00F3579B /* transpose.c */; };
+		9D65EBE111764BC100F3579B /* validate.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D65E6081174E2DB00F3579B /* validate.c */; };
+		9D65EBE211764BD200F3579B /* xform.o in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D65EBCF11764B8200F3579B /* xform.o */; };
+		9D65EBE311764BD600F3579B /* xform.o in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D65EBCF11764B8200F3579B /* xform.o */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+		9D1A14C5119D93DF00EF212F /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D65E89D11762C8900F3579B;
+			remoteInfo = klib;
+		};
+		9D65EBA2117649C100F3579B /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D65EA011176330D00F3579B;
+			remoteInfo = wvdb;
+		};
+		9D65EBA4117649C100F3579B /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D65EAC6117636BD00F3579B;
+			remoteInfo = wsra;
+		};
+		9D65EBAC11764A0A00F3579B /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D65E89D11762C8900F3579B;
+			remoteInfo = klib;
+		};
+		9D65EBAE11764A1A00F3579B /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D65E89D11762C8900F3579B;
+			remoteInfo = klib;
+		};
+		9D65EBB011764A2700F3579B /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D65E9E6117632C800F3579B;
+			remoteInfo = vdb;
+		};
+		9D65EBB211764A2800F3579B /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D65EA011176330D00F3579B;
+			remoteInfo = wvdb;
+		};
+		9D65EBB411764A3100F3579B /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D65E91C1176303D00F3579B;
+			remoteInfo = kdb;
+		};
+		9D65EBB611764A3600F3579B /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D65E961117630B300F3579B;
+			remoteInfo = wkdb;
+		};
+		9D65EBE611764BEA00F3579B /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D65EBCE11764B8200F3579B;
+			remoteInfo = xform;
+		};
+		9D65EBE811764BEC00F3579B /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 9D65EBCE11764B8200F3579B;
+			remoteInfo = xform;
+		};
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+		8DD76FAF0486AB0100D96B5E /* CopyFiles */ = {
+			isa = PBXCopyFilesBuildPhase;
+			buildActionMask = 8;
+			dstPath = /usr/share/man/man1/;
+			dstSubfolderSpec = 0;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 1;
+		};
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+		8DD76FB20486AB0100D96B5E /* sra2kdb */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = sra2kdb; sourceTree = BUILT_PRODUCTS_DIR; };
+		9D1A14A7119D921100EF212F /* align-access.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "align-access.c"; path = "../../../assembly/api/align-access.c"; sourceTree = SOURCE_ROOT; };
+		9D1A14A8119D922100EF212F /* BAMFile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = BAMFile.c; path = ../../../assembly/fmt/BAMFile.c; sourceTree = SOURCE_ROOT; };
+		9D1A14AB119D931800EF212F /* bamtest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = bamtest.c; path = ../../../assembly/test/bamtest.c; sourceTree = SOURCE_ROOT; };
+		9D1A14B1119D932A00EF212F /* bam-test */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "bam-test"; sourceTree = BUILT_PRODUCTS_DIR; };
+		9D65E5A91174E29F00F3579B /* sra2kdb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sra2kdb.c; path = ../../../sra/tools/sra2kdb.c; sourceTree = SOURCE_ROOT; };
+		9D65E5B41174E2D100F3579B /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
+		9D65E5B51174E2D100F3579B /* libbz2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libbz2.dylib; path = usr/lib/libbz2.dylib; sourceTree = SDKROOT; };
+		9D65E5B61174E2D100F3579B /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = usr/lib/libxml2.dylib; sourceTree = SDKROOT; };
+		9D65E5BD1174E2DB00F3579B /* bstpersist.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = bstpersist.c; path = ../../../klib/cont/bstpersist.c; sourceTree = SOURCE_ROOT; };
+		9D65E5BE1174E2DB00F3579B /* container.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = container.c; path = ../../../klib/cont/container.c; sourceTree = SOURCE_ROOT; };
+		9D65E5BF1174E2DB00F3579B /* namelist.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = namelist.c; path = ../../../klib/cont/namelist.c; sourceTree = SOURCE_ROOT; };
+		9D65E5C01174E2DB00F3579B /* pbstree.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pbstree.c; path = ../../../klib/cont/pbstree.c; sourceTree = SOURCE_ROOT; };
+		9D65E5C11174E2DB00F3579B /* ptpersist.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ptpersist.c; path = ../../../klib/cont/ptpersist.c; sourceTree = SOURCE_ROOT; };
+		9D65E5C21174E2DB00F3579B /* ptrie.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ptrie.c; path = ../../../klib/cont/ptrie.c; sourceTree = SOURCE_ROOT; };
+		9D65E5C31174E2DB00F3579B /* queue.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = queue.c; path = ../../../klib/cont/queue.c; sourceTree = SOURCE_ROOT; };
+		9D65E5C41174E2DB00F3579B /* trie.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = trie.c; path = ../../../klib/cont/trie.c; sourceTree = SOURCE_ROOT; };
+		9D65E5C61174E2DB00F3579B /* vector.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = vector.c; path = ../../../klib/cont/vector.c; sourceTree = SOURCE_ROOT; };
+		9D65E5C81174E2DB00F3579B /* crc32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = crc32.c; path = ../../../klib/cs/crc32.c; sourceTree = SOURCE_ROOT; };
+		9D65E5C91174E2DB00F3579B /* md5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = md5.c; path = ../../../klib/cs/md5.c; sourceTree = SOURCE_ROOT; };
+		9D65E5CB1174E2DB00F3579B /* sysdir.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sysdir.c; path = ../../../klib/fs/unix/sysdir.c; sourceTree = SOURCE_ROOT; };
+		9D65E5CC1174E2DB00F3579B /* sysdll.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sysdll.c; path = ../../../klib/fs/unix/sysdll.c; sourceTree = SOURCE_ROOT; };
+		9D65E5CD1174E2DB00F3579B /* sysfile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sysfile.c; path = ../../../klib/fs/unix/sysfile.c; sourceTree = SOURCE_ROOT; };
+		9D65E5CE1174E2DB00F3579B /* sysmmap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sysmmap.c; path = ../../../klib/fs/unix/sysmmap.c; sourceTree = SOURCE_ROOT; };
+		9D65E5CF1174E2DB00F3579B /* arc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = arc.c; path = ../../../klib/fs/arc.c; sourceTree = SOURCE_ROOT; };
+		9D65E5D01174E2DB00F3579B /* buffile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = buffile.c; path = ../../../klib/fs/buffile.c; sourceTree = SOURCE_ROOT; };
+		9D65E5D11174E2DB00F3579B /* bzip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = bzip.c; path = ../../../klib/fs/bzip.c; sourceTree = SOURCE_ROOT; };
+		9D65E5D21174E2DB00F3579B /* countfile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = countfile.c; path = ../../../klib/fs/countfile.c; sourceTree = SOURCE_ROOT; };
+		9D65E5D31174E2DB00F3579B /* crc32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = crc32.c; path = ../../../klib/fs/crc32.c; sourceTree = SOURCE_ROOT; };
+		9D65E5D41174E2DB00F3579B /* dir_test.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = dir_test.c; path = ../../../klib/fs/dir_test.c; sourceTree = SOURCE_ROOT; };
+		9D65E5D51174E2DB00F3579B /* directory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = directory.c; path = ../../../klib/fs/directory.c; sourceTree = SOURCE_ROOT; };
+		9D65E5D61174E2DB00F3579B /* file.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = file.c; path = ../../../klib/fs/file.c; sourceTree = SOURCE_ROOT; };
+		9D65E5D71174E2DB00F3579B /* gzip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = gzip.c; path = ../../../klib/fs/gzip.c; sourceTree = SOURCE_ROOT; };
+		9D65E5D81174E2DB00F3579B /* md5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = md5.c; path = ../../../klib/fs/md5.c; sourceTree = SOURCE_ROOT; };
+		9D65E5D91174E2DB00F3579B /* nullfile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = nullfile.c; path = ../../../klib/fs/nullfile.c; sourceTree = SOURCE_ROOT; };
+		9D65E5DA1174E2DB00F3579B /* sra.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sra.c; path = ../../../klib/fs/sra.c; sourceTree = SOURCE_ROOT; };
+		9D65E5DB1174E2DB00F3579B /* subfile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = subfile.c; path = ../../../klib/fs/subfile.c; sourceTree = SOURCE_ROOT; };
+		9D65E5DC1174E2DB00F3579B /* tar.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tar.c; path = ../../../klib/fs/tar.c; sourceTree = SOURCE_ROOT; };
+		9D65E5DD1174E2DB00F3579B /* teefile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = teefile.c; path = ../../../klib/fs/teefile.c; sourceTree = SOURCE_ROOT; };
+		9D65E5DE1174E2DB00F3579B /* toc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = toc.c; path = ../../../klib/fs/toc.c; sourceTree = SOURCE_ROOT; };
+		9D65E5DF1174E2DB00F3579B /* tocdir.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tocdir.c; path = ../../../klib/fs/tocdir.c; sourceTree = SOURCE_ROOT; };
+		9D65E5E01174E2DB00F3579B /* tocentry.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tocentry.c; path = ../../../klib/fs/tocentry.c; sourceTree = SOURCE_ROOT; };
+		9D65E5E11174E2DB00F3579B /* tocfile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tocfile.c; path = ../../../klib/fs/tocfile.c; sourceTree = SOURCE_ROOT; };
+		9D65E5E31174E2DB00F3579B /* sem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sem.c; path = ../../../klib/proc/sem.c; sourceTree = SOURCE_ROOT; };
+		9D65E5E41174E2DB00F3579B /* stbarrier.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = stbarrier.c; path = ../../../klib/proc/stbarrier.c; sourceTree = SOURCE_ROOT; };
+		9D65E5E51174E2DB00F3579B /* stcond.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = stcond.c; path = ../../../klib/proc/stcond.c; sourceTree = SOURCE_ROOT; };
+		9D65E5E61174E2DB00F3579B /* stlock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = stlock.c; path = ../../../klib/proc/stlock.c; sourceTree = SOURCE_ROOT; };
+		9D65E5E71174E2DB00F3579B /* stsem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = stsem.c; path = ../../../klib/proc/stsem.c; sourceTree = SOURCE_ROOT; };
+		9D65E5E81174E2DB00F3579B /* stthread.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = stthread.c; path = ../../../klib/proc/stthread.c; sourceTree = SOURCE_ROOT; };
+		9D65E5E91174E2DB00F3579B /* sttimeout.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sttimeout.c; path = ../../../klib/proc/sttimeout.c; sourceTree = SOURCE_ROOT; };
+		9D65E5EB1174E2DB00F3579B /* ascii.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ascii.c; path = ../../../klib/txt/unix/ascii.c; sourceTree = SOURCE_ROOT; };
+		9D65E5EC1174E2DB00F3579B /* cp1252.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cp1252.c; path = ../../../klib/txt/cp1252.c; sourceTree = SOURCE_ROOT; };
+		9D65E5ED1174E2DB00F3579B /* iso8859-1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "iso8859-1.c"; path = "../../../klib/txt/iso8859-1.c"; sourceTree = SOURCE_ROOT; };
+		9D65E5EE1174E2DB00F3579B /* iso8859.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = iso8859.c; path = ../../../klib/txt/iso8859.c; sourceTree = SOURCE_ROOT; };
+		9D65E5EF1174E2DB00F3579B /* symtab.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = symtab.c; path = ../../../klib/txt/symtab.c; sourceTree = SOURCE_ROOT; };
+		9D65E5F01174E2DB00F3579B /* text.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = text.c; path = ../../../klib/txt/text.c; sourceTree = SOURCE_ROOT; };
+		9D65E5F11174E2DB00F3579B /* token.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = token.c; path = ../../../klib/txt/token.c; sourceTree = SOURCE_ROOT; };
+		9D65E5F21174E2DB00F3579B /* utf8.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = utf8.c; path = ../../../klib/txt/utf8.c; sourceTree = SOURCE_ROOT; };
+		9D65E5F51174E2DB00F3579B /* xml.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = xml.c; path = ../../../klib/xml/xml.c; sourceTree = SOURCE_ROOT; };
+		9D65E5F71174E2DB00F3579B /* echo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = echo.c; path = ../../../klib/xform/echo.c; sourceTree = SOURCE_ROOT; };
+		9D65E5F81174E2DB00F3579B /* factories.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = factories.c; path = ../../../klib/xform/factories.c; sourceTree = SOURCE_ROOT; };
+		9D65E5F91174E2DB00F3579B /* floor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = floor.c; path = ../../../klib/xform/floor.c; sourceTree = SOURCE_ROOT; };
+		9D65E5FA1174E2DB00F3579B /* fpcodec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = fpcodec.c; path = ../../../klib/xform/fpcodec.c; sourceTree = SOURCE_ROOT; };
+		9D65E5FB1174E2DB00F3579B /* hufDecode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = hufDecode.c; path = ../../../klib/xform/hufDecode.c; sourceTree = SOURCE_ROOT; };
+		9D65E5FC1174E2DB00F3579B /* hufEncode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = hufEncode.c; path = ../../../klib/xform/hufEncode.c; sourceTree = SOURCE_ROOT; };
+		9D65E5FD1174E2DB00F3579B /* hufTable.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = hufTable.c; path = ../../../klib/xform/hufTable.c; sourceTree = SOURCE_ROOT; };
+		9D65E5FE1174E2DB00F3579B /* hufZlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = hufZlib.c; path = ../../../klib/xform/hufZlib.c; sourceTree = SOURCE_ROOT; };
+		9D65E5FF1174E2DB00F3579B /* muxing.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = muxing.c; path = ../../../klib/xform/muxing.c; sourceTree = SOURCE_ROOT; };
+		9D65E6001174E2DB00F3579B /* null-row.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "null-row.c"; path = "../../../klib/xform/null-row.c"; sourceTree = SOURCE_ROOT; };
+		9D65E6011174E2DB00F3579B /* pack.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pack.c; path = ../../../klib/xform/pack.c; sourceTree = SOURCE_ROOT; };
+		9D65E6021174E2DB00F3579B /* parse_args.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = parse_args.c; path = ../../../klib/xform/parse_args.c; sourceTree = SOURCE_ROOT; };
+		9D65E6031174E2DB00F3579B /* rleDecode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = rleDecode.c; path = ../../../klib/xform/rleDecode.c; sourceTree = SOURCE_ROOT; };
+		9D65E6041174E2DB00F3579B /* rleEncode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = rleEncode.c; path = ../../../klib/xform/rleEncode.c; sourceTree = SOURCE_ROOT; };
+		9D65E6051174E2DB00F3579B /* row-len.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "row-len.c"; path = "../../../klib/xform/row-len.c"; sourceTree = SOURCE_ROOT; };
+		9D65E6061174E2DB00F3579B /* transpose.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = transpose.c; path = ../../../klib/xform/transpose.c; sourceTree = SOURCE_ROOT; };
+		9D65E6071174E2DB00F3579B /* unpack.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = unpack.c; path = ../../../klib/xform/unpack.c; sourceTree = SOURCE_ROOT; };
+		9D65E6081174E2DB00F3579B /* validate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = validate.c; path = ../../../klib/xform/validate.c; sourceTree = SOURCE_ROOT; };
+		9D65E60A1174E2DB00F3579B /* blob.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = blob.c; path = ../../../klib/vdb/blob.c; sourceTree = SOURCE_ROOT; };
+		9D65E60B1174E2DB00F3579B /* column-cmn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "column-cmn.c"; path = "../../../klib/vdb/column-cmn.c"; sourceTree = SOURCE_ROOT; };
+		9D65E60C1174E2DB00F3579B /* column.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = column.c; path = ../../../klib/vdb/column.c; sourceTree = SOURCE_ROOT; };
+		9D65E60D1174E2DB00F3579B /* cursor-cmn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "cursor-cmn.c"; path = "../../../klib/vdb/cursor-cmn.c"; sourceTree = SOURCE_ROOT; };
+		9D65E60E1174E2DB00F3579B /* database.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = database.c; path = ../../../klib/vdb/database.c; sourceTree = SOURCE_ROOT; };
+		9D65E60F1174E2DB00F3579B /* dbmgr-cmn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "dbmgr-cmn.c"; path = "../../../klib/vdb/dbmgr-cmn.c"; sourceTree = SOURCE_ROOT; };
+		9D65E6101174E2DB00F3579B /* dbmgr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = dbmgr.c; path = ../../../klib/vdb/dbmgr.c; sourceTree = SOURCE_ROOT; };
+		9D65E6111174E2DB00F3579B /* dtype.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = dtype.c; path = ../../../klib/vdb/dtype.c; sourceTree = SOURCE_ROOT; };
+		9D65E6121174E2DB00F3579B /* loader.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = loader.c; path = ../../../klib/vdb/loader.c; sourceTree = SOURCE_ROOT; };
+		9D65E6131174E2DB00F3579B /* parse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = parse.c; path = ../../../klib/vdb/parse.c; sourceTree = SOURCE_ROOT; };
+		9D65E6141174E2DB00F3579B /* schema-dump.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "schema-dump.c"; path = "../../../klib/vdb/schema-dump.c"; sourceTree = SOURCE_ROOT; };
+		9D65E6151174E2DB00F3579B /* schema.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = schema.c; path = ../../../klib/vdb/schema.c; sourceTree = SOURCE_ROOT; };
+		9D65E6161174E2DB00F3579B /* static-column-temp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "static-column-temp.c"; path = "../../../klib/vdb/static-column-temp.c"; sourceTree = SOURCE_ROOT; };
+		9D65E6171174E2DB00F3579B /* table-cmn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "table-cmn.c"; path = "../../../klib/vdb/table-cmn.c"; sourceTree = SOURCE_ROOT; };
+		9D65E6181174E2DB00F3579B /* table.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = table.c; path = ../../../klib/vdb/table.c; sourceTree = SOURCE_ROOT; };
+		9D65E6191174E2DB00F3579B /* wcolumn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wcolumn.c; path = ../../../klib/vdb/wcolumn.c; sourceTree = SOURCE_ROOT; };
+		9D65E61A1174E2DB00F3579B /* wcursor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wcursor.c; path = ../../../klib/vdb/wcursor.c; sourceTree = SOURCE_ROOT; };
+		9D65E61B1174E2DB00F3579B /* wdatabase.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wdatabase.c; path = ../../../klib/vdb/wdatabase.c; sourceTree = SOURCE_ROOT; };
+		9D65E61C1174E2DB00F3579B /* wdbmgr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wdbmgr.c; path = ../../../klib/vdb/wdbmgr.c; sourceTree = SOURCE_ROOT; };
+		9D65E61D1174E2DB00F3579B /* wtable.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wtable.c; path = ../../../klib/vdb/wtable.c; sourceTree = SOURCE_ROOT; };
+		9D65E61E1174E2DB00F3579B /* xform.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = xform.c; path = ../../../klib/vdb/xform.c; sourceTree = SOURCE_ROOT; };
+		9D65E61F1174E2DB00F3579B /* xfuncs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = xfuncs.c; path = ../../../klib/vdb/xfuncs.c; sourceTree = SOURCE_ROOT; };
+		9D65E6211174E2DB00F3579B /* coldata.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = coldata.c; path = ../../../klib/db/coldata.c; sourceTree = SOURCE_ROOT; };
+		9D65E6221174E2DB00F3579B /* colidx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = colidx.c; path = ../../../klib/db/colidx.c; sourceTree = SOURCE_ROOT; };
+		9D65E6231174E2DB00F3579B /* colidx0.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = colidx0.c; path = ../../../klib/db/colidx0.c; sourceTree = SOURCE_ROOT; };
+		9D65E6241174E2DB00F3579B /* colidx1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = colidx1.c; path = ../../../klib/db/colidx1.c; sourceTree = SOURCE_ROOT; };
+		9D65E6251174E2DB00F3579B /* colidx2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = colidx2.c; path = ../../../klib/db/colidx2.c; sourceTree = SOURCE_ROOT; };
+		9D65E6261174E2DB00F3579B /* column.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = column.c; path = ../../../klib/db/column.c; sourceTree = SOURCE_ROOT; };
+		9D65E6271174E2DB00F3579B /* database.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = database.c; path = ../../../klib/db/database.c; sourceTree = SOURCE_ROOT; };
+		9D65E6281174E2DB00F3579B /* dbmgr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = dbmgr.c; path = ../../../klib/db/dbmgr.c; sourceTree = SOURCE_ROOT; };
+		9D65E6291174E2DB00F3579B /* idxblk.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = idxblk.c; path = ../../../klib/db/idxblk.c; sourceTree = SOURCE_ROOT; };
+		9D65E62A1174E2DB00F3579B /* index.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = index.c; path = ../../../klib/db/index.c; sourceTree = SOURCE_ROOT; };
+		9D65E62B1174E2DB00F3579B /* kdb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = kdb.c; path = ../../../klib/db/kdb.c; sourceTree = SOURCE_ROOT; };
+		9D65E62C1174E2DB00F3579B /* meta.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = meta.c; path = ../../../klib/db/meta.c; sourceTree = SOURCE_ROOT; };
+		9D65E62D1174E2DB00F3579B /* table.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = table.c; path = ../../../klib/db/table.c; sourceTree = SOURCE_ROOT; };
+		9D65E62E1174E2DB00F3579B /* trieidx-v1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "trieidx-v1.c"; path = "../../../klib/db/trieidx-v1.c"; sourceTree = SOURCE_ROOT; };
+		9D65E62F1174E2DB00F3579B /* trieidx-v2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "trieidx-v2.c"; path = "../../../klib/db/trieidx-v2.c"; sourceTree = SOURCE_ROOT; };
+		9D65E6301174E2DB00F3579B /* u64idx-v3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "u64idx-v3.c"; path = "../../../klib/db/u64idx-v3.c"; sourceTree = SOURCE_ROOT; };
+		9D65E6311174E2DB00F3579B /* wcoldata.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wcoldata.c; path = ../../../klib/db/wcoldata.c; sourceTree = SOURCE_ROOT; };
+		9D65E6321174E2DB00F3579B /* wcolidx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wcolidx.c; path = ../../../klib/db/wcolidx.c; sourceTree = SOURCE_ROOT; };
+		9D65E6331174E2DB00F3579B /* wcolidx0.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wcolidx0.c; path = ../../../klib/db/wcolidx0.c; sourceTree = SOURCE_ROOT; };
+		9D65E6341174E2DB00F3579B /* wcolidx1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wcolidx1.c; path = ../../../klib/db/wcolidx1.c; sourceTree = SOURCE_ROOT; };
+		9D65E6351174E2DB00F3579B /* wcolidx2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wcolidx2.c; path = ../../../klib/db/wcolidx2.c; sourceTree = SOURCE_ROOT; };
+		9D65E6361174E2DB00F3579B /* wcolumn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wcolumn.c; path = ../../../klib/db/wcolumn.c; sourceTree = SOURCE_ROOT; };
+		9D65E6371174E2DB00F3579B /* wdatabase.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wdatabase.c; path = ../../../klib/db/wdatabase.c; sourceTree = SOURCE_ROOT; };
+		9D65E6381174E2DB00F3579B /* wdbmgr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wdbmgr.c; path = ../../../klib/db/wdbmgr.c; sourceTree = SOURCE_ROOT; };
+		9D65E6391174E2DB00F3579B /* widxblk.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = widxblk.c; path = ../../../klib/db/widxblk.c; sourceTree = SOURCE_ROOT; };
+		9D65E63A1174E2DB00F3579B /* windex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = windex.c; path = ../../../klib/db/windex.c; sourceTree = SOURCE_ROOT; };
+		9D65E63B1174E2DB00F3579B /* wkdb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wkdb.c; path = ../../../klib/db/wkdb.c; sourceTree = SOURCE_ROOT; };
+		9D65E63C1174E2DB00F3579B /* wmeta.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wmeta.c; path = ../../../klib/db/wmeta.c; sourceTree = SOURCE_ROOT; };
+		9D65E63D1174E2DB00F3579B /* wtable.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wtable.c; path = ../../../klib/db/wtable.c; sourceTree = SOURCE_ROOT; };
+		9D65E63E1174E2DB00F3579B /* wtrieidx-v1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "wtrieidx-v1.c"; path = "../../../klib/db/wtrieidx-v1.c"; sourceTree = SOURCE_ROOT; };
+		9D65E63F1174E2DB00F3579B /* wtrieidx-v2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "wtrieidx-v2.c"; path = "../../../klib/db/wtrieidx-v2.c"; sourceTree = SOURCE_ROOT; };
+		9D65E6401174E2DB00F3579B /* wu64idx-v3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "wu64idx-v3.c"; path = "../../../klib/db/wu64idx-v3.c"; sourceTree = SOURCE_ROOT; };
+		9D65E6FF1174E54800F3579B /* legvcol.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = legvcol.c; path = ../../../sra/api/legacy/legvcol.c; sourceTree = SOURCE_ROOT; };
+		9D65E7001174E54800F3579B /* sra_decompress_init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sra_decompress_init.c; path = ../../../sra/api/legacy/sra_decompress_init.c; sourceTree = SOURCE_ROOT; };
+		9D65E7011174E54800F3579B /* sra_decompress.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sra_decompress.c; path = ../../../sra/api/legacy/sra_decompress.c; sourceTree = SOURCE_ROOT; };
+		9D65E7051174E56300F3579B /* ncbi-sramgr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "ncbi-sramgr.c"; path = "../../../sra/api/ncbi-sramgr.c"; sourceTree = SOURCE_ROOT; };
+		9D65E7061174E56300F3579B /* ncbi-wsramgr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "ncbi-wsramgr.c"; path = "../../../sra/api/ncbi-wsramgr.c"; sourceTree = SOURCE_ROOT; };
+		9D65E7071174E56300F3579B /* sracol-cmn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "sracol-cmn.c"; path = "../../../sra/api/sracol-cmn.c"; sourceTree = SOURCE_ROOT; };
+		9D65E7081174E56300F3579B /* sracol.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sracol.c; path = ../../../sra/api/sracol.c; sourceTree = SOURCE_ROOT; };
+		9D65E7091174E56300F3579B /* sraerr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sraerr.c; path = ../../../sra/api/sraerr.c; sourceTree = SOURCE_ROOT; };
+		9D65E70A1174E56300F3579B /* sramgr-cmn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "sramgr-cmn.c"; path = "../../../sra/api/sramgr-cmn.c"; sourceTree = SOURCE_ROOT; };
+		9D65E70B1174E56300F3579B /* sramgr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sramgr.c; path = ../../../sra/api/sramgr.c; sourceTree = SOURCE_ROOT; };
+		9D65E70C1174E56300F3579B /* sranam.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sranam.c; path = ../../../sra/api/sranam.c; sourceTree = SOURCE_ROOT; };
+		9D65E70D1174E56300F3579B /* sraschema.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sraschema.c; path = ../../../sra/api/sraschema.c; sourceTree = SOURCE_ROOT; };
+		9D65E70E1174E56300F3579B /* sratbl-cmn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "sratbl-cmn.c"; path = "../../../sra/api/sratbl-cmn.c"; sourceTree = SOURCE_ROOT; };
+		9D65E70F1174E56300F3579B /* sratbl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sratbl.c; path = ../../../sra/api/sratbl.c; sourceTree = SOURCE_ROOT; };
+		9D65E7101174E56300F3579B /* wsracol.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wsracol.c; path = ../../../sra/api/wsracol.c; sourceTree = SOURCE_ROOT; };
+		9D65E7111174E56300F3579B /* wsramgr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wsramgr.c; path = ../../../sra/api/wsramgr.c; sourceTree = SOURCE_ROOT; };
+		9D65E7121174E56300F3579B /* wsraschema.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wsraschema.c; path = ../../../sra/api/wsraschema.c; sourceTree = SOURCE_ROOT; };
+		9D65E7131174E56300F3579B /* wsratbl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wsratbl.c; path = ../../../sra/api/wsratbl.c; sourceTree = SOURCE_ROOT; };
+		9D65E7391174E60300F3579B /* clip_quality_right.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = clip_quality_right.c; path = ../../../sra/xform/clip_quality_right.c; sourceTree = SOURCE_ROOT; };
+		9D65E73A1174E60300F3579B /* color-space.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "color-space.c"; path = "../../../sra/xform/color-space.c"; sourceTree = SOURCE_ROOT; };
+		9D65E73B1174E60300F3579B /* delta-log-delta.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "delta-log-delta.c"; path = "../../../sra/xform/delta-log-delta.c"; sourceTree = SOURCE_ROOT; };
+		9D65E73C1174E60300F3579B /* intensity-norm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "intensity-norm.c"; path = "../../../sra/xform/intensity-norm.c"; sourceTree = SOURCE_ROOT; };
+		9D65E73D1174E60300F3579B /* nencode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = nencode.c; path = ../../../sra/xform/nencode.c; sourceTree = SOURCE_ROOT; };
+		9D65E73E1174E60300F3579B /* phred-from-qval.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "phred-from-qval.c"; path = "../../../sra/xform/phred-from-qval.c"; sourceTree = SOURCE_ROOT; };
+		9D65E73F1174E60300F3579B /* platform_name.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = platform_name.c; path = ../../../sra/xform/platform_name.c; sourceTree = SOURCE_ROOT; };
+		9D65E7401174E60300F3579B /* position.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = position.c; path = ../../../sra/xform/position.c; sourceTree = SOURCE_ROOT; };
+		9D65E7411174E60300F3579B /* prob.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = prob.c; path = ../../../sra/xform/prob.c; sourceTree = SOURCE_ROOT; };
+		9D65E7421174E60300F3579B /* ptranspose.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ptranspose.c; path = ../../../sra/xform/ptranspose.c; sourceTree = SOURCE_ROOT; };
+		9D65E7431174E60300F3579B /* qual4_codec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = qual4_codec.c; path = ../../../sra/xform/qual4_codec.c; sourceTree = SOURCE_ROOT; };
+		9D65E7441174E60300F3579B /* quality.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = quality.c; path = ../../../sra/xform/quality.c; sourceTree = SOURCE_ROOT; };
+		9D65E7451174E60300F3579B /* read_struct.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = read_struct.c; path = ../../../sra/xform/read_struct.c; sourceTree = SOURCE_ROOT; };
+		9D65E7461174E60300F3579B /* read-desc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "read-desc.c"; path = "../../../sra/xform/read-desc.c"; sourceTree = SOURCE_ROOT; };
+		9D65E7471174E60300F3579B /* read2na.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = read2na.c; path = ../../../sra/xform/read2na.c; sourceTree = SOURCE_ROOT; };
+		9D65E7481174E60300F3579B /* read4na.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = read4na.c; path = ../../../sra/xform/read4na.c; sourceTree = SOURCE_ROOT; };
+		9D65E7491174E60300F3579B /* readFasta.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = readFasta.c; path = ../../../sra/xform/readFasta.c; sourceTree = SOURCE_ROOT; };
+		9D65E74A1174E60300F3579B /* reorder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = reorder.c; path = ../../../sra/xform/reorder.c; sourceTree = SOURCE_ROOT; };
+		9D65E74B1174E60300F3579B /* rotate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = rotate.c; path = ../../../sra/xform/rotate.c; sourceTree = SOURCE_ROOT; };
+		9D65E74C1174E60300F3579B /* sort-order.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "sort-order.c"; path = "../../../sra/xform/sort-order.c"; sourceTree = SOURCE_ROOT; };
+		9D65E74D1174E60300F3579B /* swap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = swap.c; path = ../../../sra/xform/swap.c; sourceTree = SOURCE_ROOT; };
+		9D65E74E1174E60300F3579B /* validate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = validate.c; path = ../../../sra/xform/validate.c; sourceTree = SOURCE_ROOT; };
+		9D65E7681174E61D00F3579B /* nucstrstr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = nucstrstr.c; path = ../../../sra/search/nucstrstr.c; sourceTree = SOURCE_ROOT; };
+		9D65E7751174E6BA00F3579B /* srapath.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = srapath.c; path = ../../../sra/ncbi/srapath.c; sourceTree = SOURCE_ROOT; };
+		9D65E77A1174E6F000F3579B /* log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = log.c; path = ../../../klib/app/log.c; sourceTree = SOURCE_ROOT; };
+		9D65E77B1174E6F000F3579B /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = main.c; path = ../../../klib/app/main.c; sourceTree = SOURCE_ROOT; };
+		9D65E77C1174E6F000F3579B /* rc-idx-tbl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "rc-idx-tbl.c"; path = "../../../klib/app/rc-idx-tbl.c"; sourceTree = SOURCE_ROOT; };
+		9D65E77D1174E6F000F3579B /* rc-tbl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "rc-tbl.c"; path = "../../../klib/app/rc-tbl.c"; sourceTree = SOURCE_ROOT; };
+		9D65E77E1174E6F000F3579B /* text-log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "text-log.c"; path = "../../../klib/app/text-log.c"; sourceTree = SOURCE_ROOT; };
+		9D65E7841174E6FA00F3579B /* syslog.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = syslog.c; path = ../../../klib/app/unix/syslog.c; sourceTree = SOURCE_ROOT; };
+		9D65E7851174E6FA00F3579B /* sysmain.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sysmain.c; path = ../../../klib/app/unix/sysmain.c; sourceTree = SOURCE_ROOT; };
+		9D65E89E11762C8900F3579B /* libklib.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libklib.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+		9D65E91D1176303D00F3579B /* libkdb.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libkdb.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+		9D65E988117630B300F3579B /* libwkdb.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libwkdb.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+		9D65E9E7117632C800F3579B /* libvdb.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libvdb.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+		9D65EA1E1176330D00F3579B /* libwvdb.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libwvdb.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+		9D65EA901176365700F3579B /* libsra.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libsra.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+		9D65EAFA117636BD00F3579B /* libwsra.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libwsra.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+		9D65EBCF11764B8200F3579B /* xform.o */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.objfile"; includeInIndex = 0; path = xform.o; sourceTree = BUILT_PRODUCTS_DIR; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		8DD76FAD0486AB0100D96B5E /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D65E5B71174E2D100F3579B /* libz.dylib in Frameworks */,
+				9D65E5B81174E2D100F3579B /* libbz2.dylib in Frameworks */,
+				9D65E5B91174E2D100F3579B /* libxml2.dylib in Frameworks */,
+				9D65EA941176366D00F3579B /* libwvdb.dylib in Frameworks */,
+				9D65EB401176437700F3579B /* libwsra.dylib in Frameworks */,
+				9D65EBC611764AA500F3579B /* libwkdb.dylib in Frameworks */,
+				9D65EBC911764AAE00F3579B /* libklib.dylib in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D1A14AF119D932A00EF212F /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D1A14BF119D93BC00EF212F /* libklib.dylib in Frameworks */,
+				9D1A14C2119D93D100EF212F /* libz.dylib in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D65E89C11762C8900F3579B /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D65E8D711762D1600F3579B /* libz.dylib in Frameworks */,
+				9D65E8D811762D1E00F3579B /* libbz2.dylib in Frameworks */,
+				9D65E8D911762D2200F3579B /* libxml2.dylib in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D65E91B1176303D00F3579B /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D65E9AC1176312E00F3579B /* libklib.dylib in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D65E984117630B300F3579B /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D65E9DB1176327200F3579B /* libklib.dylib in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D65E9E5117632C800F3579B /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D65EA5C117633C600F3579B /* libklib.dylib in Frameworks */,
+				9D65EA5D117633C900F3579B /* libkdb.dylib in Frameworks */,
+				9D65EA641176340100F3579B /* libz.dylib in Frameworks */,
+				9D65EBE211764BD200F3579B /* xform.o in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D65EA1A1176330D00F3579B /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D65EA271176335200F3579B /* libklib.dylib in Frameworks */,
+				9D65EA2A1176335C00F3579B /* libwkdb.dylib in Frameworks */,
+				9D65EA3F1176337C00F3579B /* libz.dylib in Frameworks */,
+				9D65EBE311764BD600F3579B /* xform.o in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D65EA8E1176365700F3579B /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D65EA951176367400F3579B /* libklib.dylib in Frameworks */,
+				9D65EA961176367600F3579B /* libkdb.dylib in Frameworks */,
+				9D65EA971176367900F3579B /* libvdb.dylib in Frameworks */,
+				9D65EB031176372D00F3579B /* libz.dylib in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D65EAF3117636BD00F3579B /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D65EAF4117636BD00F3579B /* libklib.dylib in Frameworks */,
+				9D65EB0B117637AF00F3579B /* libwvdb.dylib in Frameworks */,
+				9D65EB0E117637B700F3579B /* libwkdb.dylib in Frameworks */,
+				9D65EB11117637C200F3579B /* libz.dylib in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D65EBCD11764B8200F3579B /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		08FB7794FE84155DC02AAC07 /* sra2kdb */ = {
+			isa = PBXGroup;
+			children = (
+				9D65E5B31174E2BF00F3579B /* Libs */,
+				08FB7795FE84155DC02AAC07 /* Source */,
+				1AB674ADFE9D54B511CA2CBB /* Products */,
+			);
+			name = sra2kdb;
+			sourceTree = "<group>";
+		};
+		08FB7795FE84155DC02AAC07 /* Source */ = {
+			isa = PBXGroup;
+			children = (
+				9D65E5A91174E29F00F3579B /* sra2kdb.c */,
+			);
+			name = Source;
+			sourceTree = "<group>";
+		};
+		1AB674ADFE9D54B511CA2CBB /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				8DD76FB20486AB0100D96B5E /* sra2kdb */,
+				9D65E89E11762C8900F3579B /* libklib.dylib */,
+				9D65E91D1176303D00F3579B /* libkdb.dylib */,
+				9D65E988117630B300F3579B /* libwkdb.dylib */,
+				9D65E9E7117632C800F3579B /* libvdb.dylib */,
+				9D65EA1E1176330D00F3579B /* libwvdb.dylib */,
+				9D65EA901176365700F3579B /* libsra.dylib */,
+				9D65EAFA117636BD00F3579B /* libwsra.dylib */,
+				9D65EBCF11764B8200F3579B /* xform.o */,
+				9D1A14B1119D932A00EF212F /* bam-test */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		9D1A14A3119D91C600EF212F /* align */ = {
+			isa = PBXGroup;
+			children = (
+				9D1A14AA119D930B00EF212F /* test */,
+				9D1A14A8119D922100EF212F /* BAMFile.c */,
+				9D1A14A7119D921100EF212F /* align-access.c */,
+			);
+			name = align;
+			sourceTree = "<group>";
+		};
+		9D1A14AA119D930B00EF212F /* test */ = {
+			isa = PBXGroup;
+			children = (
+				9D1A14AB119D931800EF212F /* bamtest.c */,
+			);
+			name = test;
+			sourceTree = "<group>";
+		};
+		9D65E5B31174E2BF00F3579B /* Libs */ = {
+			isa = PBXGroup;
+			children = (
+				9D1A14A3119D91C600EF212F /* align */,
+				9D65E7791174E6D700F3579B /* App */,
+				9D65E6EC1174E4C200F3579B /* sra */,
+				9D65E6201174E2DB00F3579B /* kdb */,
+				9D65E6091174E2DB00F3579B /* vdb */,
+				9D65E5F61174E2DB00F3579B /* xform */,
+				9D65E5BB1174E2DB00F3579B /* klib */,
+				9D65E5B41174E2D100F3579B /* libz.dylib */,
+				9D65E5B51174E2D100F3579B /* libbz2.dylib */,
+				9D65E5B61174E2D100F3579B /* libxml2.dylib */,
+			);
+			name = Libs;
+			sourceTree = "<group>";
+		};
+		9D65E5BB1174E2DB00F3579B /* klib */ = {
+			isa = PBXGroup;
+			children = (
+				9D65E9B5117631D800F3579B /* kxf */,
+				9D65E8FF11762EF600F3579B /* log */,
+				9D65E5F31174E2DB00F3579B /* xml */,
+				9D65E5EA1174E2DB00F3579B /* txt */,
+				9D65E5E21174E2DB00F3579B /* proc */,
+				9D65E5CA1174E2DB00F3579B /* fs */,
+				9D65E5C71174E2DB00F3579B /* cs */,
+				9D65E5BC1174E2DB00F3579B /* cont */,
+			);
+			name = klib;
+			sourceTree = "<group>";
+		};
+		9D65E5BC1174E2DB00F3579B /* cont */ = {
+			isa = PBXGroup;
+			children = (
+				9D65E5BD1174E2DB00F3579B /* bstpersist.c */,
+				9D65E5BE1174E2DB00F3579B /* container.c */,
+				9D65E5BF1174E2DB00F3579B /* namelist.c */,
+				9D65E5C01174E2DB00F3579B /* pbstree.c */,
+				9D65E5C11174E2DB00F3579B /* ptpersist.c */,
+				9D65E5C21174E2DB00F3579B /* ptrie.c */,
+				9D65E5C31174E2DB00F3579B /* queue.c */,
+				9D65E5C41174E2DB00F3579B /* trie.c */,
+				9D65E5C61174E2DB00F3579B /* vector.c */,
+			);
+			name = cont;
+			sourceTree = "<group>";
+		};
+		9D65E5C71174E2DB00F3579B /* cs */ = {
+			isa = PBXGroup;
+			children = (
+				9D65E5C81174E2DB00F3579B /* crc32.c */,
+				9D65E5C91174E2DB00F3579B /* md5.c */,
+			);
+			name = cs;
+			sourceTree = "<group>";
+		};
+		9D65E5CA1174E2DB00F3579B /* fs */ = {
+			isa = PBXGroup;
+			children = (
+				9D65E5CB1174E2DB00F3579B /* sysdir.c */,
+				9D65E5CC1174E2DB00F3579B /* sysdll.c */,
+				9D65E5CD1174E2DB00F3579B /* sysfile.c */,
+				9D65E5CE1174E2DB00F3579B /* sysmmap.c */,
+				9D65E5CF1174E2DB00F3579B /* arc.c */,
+				9D65E5D01174E2DB00F3579B /* buffile.c */,
+				9D65E5D11174E2DB00F3579B /* bzip.c */,
+				9D65E5D21174E2DB00F3579B /* countfile.c */,
+				9D65E5D31174E2DB00F3579B /* crc32.c */,
+				9D65E5D41174E2DB00F3579B /* dir_test.c */,
+				9D65E5D51174E2DB00F3579B /* directory.c */,
+				9D65E5D61174E2DB00F3579B /* file.c */,
+				9D65E5D71174E2DB00F3579B /* gzip.c */,
+				9D65E5D81174E2DB00F3579B /* md5.c */,
+				9D65E5D91174E2DB00F3579B /* nullfile.c */,
+				9D65E5DA1174E2DB00F3579B /* sra.c */,
+				9D65E5DB1174E2DB00F3579B /* subfile.c */,
+				9D65E5DC1174E2DB00F3579B /* tar.c */,
+				9D65E5DD1174E2DB00F3579B /* teefile.c */,
+				9D65E5DE1174E2DB00F3579B /* toc.c */,
+				9D65E5DF1174E2DB00F3579B /* tocdir.c */,
+				9D65E5E01174E2DB00F3579B /* tocentry.c */,
+				9D65E5E11174E2DB00F3579B /* tocfile.c */,
+			);
+			name = fs;
+			sourceTree = "<group>";
+		};
+		9D65E5E21174E2DB00F3579B /* proc */ = {
+			isa = PBXGroup;
+			children = (
+				9D65E5E31174E2DB00F3579B /* sem.c */,
+				9D65E5E41174E2DB00F3579B /* stbarrier.c */,
+				9D65E5E51174E2DB00F3579B /* stcond.c */,
+				9D65E5E61174E2DB00F3579B /* stlock.c */,
+				9D65E5E71174E2DB00F3579B /* stsem.c */,
+				9D65E5E81174E2DB00F3579B /* stthread.c */,
+				9D65E5E91174E2DB00F3579B /* sttimeout.c */,
+			);
+			name = proc;
+			sourceTree = "<group>";
+		};
+		9D65E5EA1174E2DB00F3579B /* txt */ = {
+			isa = PBXGroup;
+			children = (
+				9D65E5EB1174E2DB00F3579B /* ascii.c */,
+				9D65E5EC1174E2DB00F3579B /* cp1252.c */,
+				9D65E5ED1174E2DB00F3579B /* iso8859-1.c */,
+				9D65E5EE1174E2DB00F3579B /* iso8859.c */,
+				9D65E5EF1174E2DB00F3579B /* symtab.c */,
+				9D65E5F01174E2DB00F3579B /* text.c */,
+				9D65E5F11174E2DB00F3579B /* token.c */,
+				9D65E5F21174E2DB00F3579B /* utf8.c */,
+			);
+			name = txt;
+			sourceTree = "<group>";
+		};
+		9D65E5F31174E2DB00F3579B /* xml */ = {
+			isa = PBXGroup;
+			children = (
+				9D65E5F51174E2DB00F3579B /* xml.c */,
+			);
+			name = xml;
+			sourceTree = "<group>";
+		};
+		9D65E5F61174E2DB00F3579B /* xform */ = {
+			isa = PBXGroup;
+			children = (
+				9D65E5F71174E2DB00F3579B /* echo.c */,
+				9D65E5F81174E2DB00F3579B /* factories.c */,
+				9D65E5F91174E2DB00F3579B /* floor.c */,
+				9D65E5FA1174E2DB00F3579B /* fpcodec.c */,
+				9D65E5FB1174E2DB00F3579B /* hufDecode.c */,
+				9D65E5FC1174E2DB00F3579B /* hufEncode.c */,
+				9D65E5FD1174E2DB00F3579B /* hufTable.c */,
+				9D65E5FE1174E2DB00F3579B /* hufZlib.c */,
+				9D65E5FF1174E2DB00F3579B /* muxing.c */,
+				9D65E6001174E2DB00F3579B /* null-row.c */,
+				9D65E6021174E2DB00F3579B /* parse_args.c */,
+				9D65E6031174E2DB00F3579B /* rleDecode.c */,
+				9D65E6041174E2DB00F3579B /* rleEncode.c */,
+				9D65E6051174E2DB00F3579B /* row-len.c */,
+				9D65E6061174E2DB00F3579B /* transpose.c */,
+				9D65E6081174E2DB00F3579B /* validate.c */,
+			);
+			name = xform;
+			sourceTree = "<group>";
+		};
+		9D65E6091174E2DB00F3579B /* vdb */ = {
+			isa = PBXGroup;
+			children = (
+				9D65E60A1174E2DB00F3579B /* blob.c */,
+				9D65E60B1174E2DB00F3579B /* column-cmn.c */,
+				9D65E60C1174E2DB00F3579B /* column.c */,
+				9D65E60D1174E2DB00F3579B /* cursor-cmn.c */,
+				9D65E60E1174E2DB00F3579B /* database.c */,
+				9D65E60F1174E2DB00F3579B /* dbmgr-cmn.c */,
+				9D65E6101174E2DB00F3579B /* dbmgr.c */,
+				9D65E6111174E2DB00F3579B /* dtype.c */,
+				9D65E6121174E2DB00F3579B /* loader.c */,
+				9D65E6131174E2DB00F3579B /* parse.c */,
+				9D65E6141174E2DB00F3579B /* schema-dump.c */,
+				9D65E6151174E2DB00F3579B /* schema.c */,
+				9D65E6161174E2DB00F3579B /* static-column-temp.c */,
+				9D65E6171174E2DB00F3579B /* table-cmn.c */,
+				9D65E6181174E2DB00F3579B /* table.c */,
+				9D65E6191174E2DB00F3579B /* wcolumn.c */,
+				9D65E61A1174E2DB00F3579B /* wcursor.c */,
+				9D65E61B1174E2DB00F3579B /* wdatabase.c */,
+				9D65E61C1174E2DB00F3579B /* wdbmgr.c */,
+				9D65E61D1174E2DB00F3579B /* wtable.c */,
+				9D65E61E1174E2DB00F3579B /* xform.c */,
+				9D65E61F1174E2DB00F3579B /* xfuncs.c */,
+			);
+			name = vdb;
+			sourceTree = "<group>";
+		};
+		9D65E6201174E2DB00F3579B /* kdb */ = {
+			isa = PBXGroup;
+			children = (
+				9D65E6211174E2DB00F3579B /* coldata.c */,
+				9D65E6221174E2DB00F3579B /* colidx.c */,
+				9D65E6231174E2DB00F3579B /* colidx0.c */,
+				9D65E6241174E2DB00F3579B /* colidx1.c */,
+				9D65E6251174E2DB00F3579B /* colidx2.c */,
+				9D65E6261174E2DB00F3579B /* column.c */,
+				9D65E6271174E2DB00F3579B /* database.c */,
+				9D65E6281174E2DB00F3579B /* dbmgr.c */,
+				9D65E6291174E2DB00F3579B /* idxblk.c */,
+				9D65E62A1174E2DB00F3579B /* index.c */,
+				9D65E62B1174E2DB00F3579B /* kdb.c */,
+				9D65E62C1174E2DB00F3579B /* meta.c */,
+				9D65E62D1174E2DB00F3579B /* table.c */,
+				9D65E62E1174E2DB00F3579B /* trieidx-v1.c */,
+				9D65E62F1174E2DB00F3579B /* trieidx-v2.c */,
+				9D65E6301174E2DB00F3579B /* u64idx-v3.c */,
+				9D65E6311174E2DB00F3579B /* wcoldata.c */,
+				9D65E6321174E2DB00F3579B /* wcolidx.c */,
+				9D65E6331174E2DB00F3579B /* wcolidx0.c */,
+				9D65E6341174E2DB00F3579B /* wcolidx1.c */,
+				9D65E6351174E2DB00F3579B /* wcolidx2.c */,
+				9D65E6361174E2DB00F3579B /* wcolumn.c */,
+				9D65E6371174E2DB00F3579B /* wdatabase.c */,
+				9D65E6381174E2DB00F3579B /* wdbmgr.c */,
+				9D65E6391174E2DB00F3579B /* widxblk.c */,
+				9D65E63A1174E2DB00F3579B /* windex.c */,
+				9D65E63B1174E2DB00F3579B /* wkdb.c */,
+				9D65E63C1174E2DB00F3579B /* wmeta.c */,
+				9D65E63D1174E2DB00F3579B /* wtable.c */,
+				9D65E63E1174E2DB00F3579B /* wtrieidx-v1.c */,
+				9D65E63F1174E2DB00F3579B /* wtrieidx-v2.c */,
+				9D65E6401174E2DB00F3579B /* wu64idx-v3.c */,
+			);
+			name = kdb;
+			sourceTree = "<group>";
+		};
+		9D65E6EC1174E4C200F3579B /* sra */ = {
+			isa = PBXGroup;
+			children = (
+				9D65E7741174E6A500F3579B /* ncbi */,
+				9D65E7671174E61100F3579B /* search */,
+				9D65E6FE1174E53900F3579B /* xform */,
+				9D65E6FC1174E52700F3579B /* api */,
+			);
+			name = sra;
+			sourceTree = "<group>";
+		};
+		9D65E6FC1174E52700F3579B /* api */ = {
+			isa = PBXGroup;
+			children = (
+				9D65E7051174E56300F3579B /* ncbi-sramgr.c */,
+				9D65E7061174E56300F3579B /* ncbi-wsramgr.c */,
+				9D65E7071174E56300F3579B /* sracol-cmn.c */,
+				9D65E7081174E56300F3579B /* sracol.c */,
+				9D65E7091174E56300F3579B /* sraerr.c */,
+				9D65E70A1174E56300F3579B /* sramgr-cmn.c */,
+				9D65E70B1174E56300F3579B /* sramgr.c */,
+				9D65E70C1174E56300F3579B /* sranam.c */,
+				9D65E70D1174E56300F3579B /* sraschema.c */,
+				9D65E70E1174E56300F3579B /* sratbl-cmn.c */,
+				9D65E70F1174E56300F3579B /* sratbl.c */,
+				9D65E7101174E56300F3579B /* wsracol.c */,
+				9D65E7111174E56300F3579B /* wsramgr.c */,
+				9D65E7121174E56300F3579B /* wsraschema.c */,
+				9D65E7131174E56300F3579B /* wsratbl.c */,
+				9D65E6FD1174E53100F3579B /* legacy */,
+			);
+			name = api;
+			sourceTree = "<group>";
+		};
+		9D65E6FD1174E53100F3579B /* legacy */ = {
+			isa = PBXGroup;
+			children = (
+				9D65E6FF1174E54800F3579B /* legvcol.c */,
+				9D65E7001174E54800F3579B /* sra_decompress_init.c */,
+				9D65E7011174E54800F3579B /* sra_decompress.c */,
+			);
+			name = legacy;
+			sourceTree = "<group>";
+		};
+		9D65E6FE1174E53900F3579B /* xform */ = {
+			isa = PBXGroup;
+			children = (
+				9D65E7391174E60300F3579B /* clip_quality_right.c */,
+				9D65E73A1174E60300F3579B /* color-space.c */,
+				9D65E73B1174E60300F3579B /* delta-log-delta.c */,
+				9D65E73C1174E60300F3579B /* intensity-norm.c */,
+				9D65E73D1174E60300F3579B /* nencode.c */,
+				9D65E73E1174E60300F3579B /* phred-from-qval.c */,
+				9D65E73F1174E60300F3579B /* platform_name.c */,
+				9D65E7401174E60300F3579B /* position.c */,
+				9D65E7411174E60300F3579B /* prob.c */,
+				9D65E7421174E60300F3579B /* ptranspose.c */,
+				9D65E7431174E60300F3579B /* qual4_codec.c */,
+				9D65E7441174E60300F3579B /* quality.c */,
+				9D65E7451174E60300F3579B /* read_struct.c */,
+				9D65E7461174E60300F3579B /* read-desc.c */,
+				9D65E7471174E60300F3579B /* read2na.c */,
+				9D65E7481174E60300F3579B /* read4na.c */,
+				9D65E7491174E60300F3579B /* readFasta.c */,
+				9D65E74A1174E60300F3579B /* reorder.c */,
+				9D65E74B1174E60300F3579B /* rotate.c */,
+				9D65E74C1174E60300F3579B /* sort-order.c */,
+				9D65E74D1174E60300F3579B /* swap.c */,
+				9D65E74E1174E60300F3579B /* validate.c */,
+			);
+			name = xform;
+			sourceTree = "<group>";
+		};
+		9D65E7671174E61100F3579B /* search */ = {
+			isa = PBXGroup;
+			children = (
+				9D65E7681174E61D00F3579B /* nucstrstr.c */,
+			);
+			name = search;
+			sourceTree = "<group>";
+		};
+		9D65E7741174E6A500F3579B /* ncbi */ = {
+			isa = PBXGroup;
+			children = (
+				9D65E7751174E6BA00F3579B /* srapath.c */,
+			);
+			name = ncbi;
+			sourceTree = "<group>";
+		};
+		9D65E7791174E6D700F3579B /* App */ = {
+			isa = PBXGroup;
+			children = (
+				9D65E7851174E6FA00F3579B /* sysmain.c */,
+				9D65E77B1174E6F000F3579B /* main.c */,
+			);
+			name = App;
+			sourceTree = "<group>";
+		};
+		9D65E8FF11762EF600F3579B /* log */ = {
+			isa = PBXGroup;
+			children = (
+				9D65E77C1174E6F000F3579B /* rc-idx-tbl.c */,
+				9D65E77D1174E6F000F3579B /* rc-tbl.c */,
+				9D65E77A1174E6F000F3579B /* log.c */,
+				9D65E7841174E6FA00F3579B /* syslog.c */,
+				9D65E77E1174E6F000F3579B /* text-log.c */,
+			);
+			name = log;
+			sourceTree = "<group>";
+		};
+		9D65E9B5117631D800F3579B /* kxf */ = {
+			isa = PBXGroup;
+			children = (
+				9D65E6011174E2DB00F3579B /* pack.c */,
+				9D65E6071174E2DB00F3579B /* unpack.c */,
+			);
+			name = kxf;
+			sourceTree = "<group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+		9D65E89A11762C8900F3579B /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D65E9191176303D00F3579B /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D65E962117630B300F3579B /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D65E9E3117632C800F3579B /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D65EA021176330D00F3579B /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D65EA8C1176365700F3579B /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D65EAC7117636BD00F3579B /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+		8DD76FA90486AB0100D96B5E /* sra2kdb */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 1DEB928508733DD80010E9CD /* Build configuration list for PBXNativeTarget "sra2kdb" */;
+			buildPhases = (
+				8DD76FAB0486AB0100D96B5E /* Sources */,
+				8DD76FAD0486AB0100D96B5E /* Frameworks */,
+				8DD76FAF0486AB0100D96B5E /* CopyFiles */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				9D65EBA3117649C100F3579B /* PBXTargetDependency */,
+				9D65EBA5117649C100F3579B /* PBXTargetDependency */,
+			);
+			name = sra2kdb;
+			productInstallPath = "$(HOME)/bin";
+			productName = sra2kdb;
+			productReference = 8DD76FB20486AB0100D96B5E /* sra2kdb */;
+			productType = "com.apple.product-type.tool";
+		};
+		9D1A14B0119D932A00EF212F /* bam-test */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 9D1A14BA119D936800EF212F /* Build configuration list for PBXNativeTarget "bam-test" */;
+			buildPhases = (
+				9D1A14AE119D932A00EF212F /* Sources */,
+				9D1A14AF119D932A00EF212F /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				9D1A14C6119D93DF00EF212F /* PBXTargetDependency */,
+			);
+			name = "bam-test";
+			productName = "bam-test";
+			productReference = 9D1A14B1119D932A00EF212F /* bam-test */;
+			productType = "com.apple.product-type.tool";
+		};
+		9D65E89D11762C8900F3579B /* klib */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 9D65E8D411762CF600F3579B /* Build configuration list for PBXNativeTarget "klib" */;
+			buildPhases = (
+				9D65E89A11762C8900F3579B /* Headers */,
+				9D65E89B11762C8900F3579B /* Sources */,
+				9D65E89C11762C8900F3579B /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = klib;
+			productName = klib;
+			productReference = 9D65E89E11762C8900F3579B /* libklib.dylib */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		9D65E91C1176303D00F3579B /* kdb */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 9D65E960117630B300F3579B /* Build configuration list for PBXNativeTarget "kdb" */;
+			buildPhases = (
+				9D65E9191176303D00F3579B /* Headers */,
+				9D65E91A1176303D00F3579B /* Sources */,
+				9D65E91B1176303D00F3579B /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				9D65EBAD11764A0A00F3579B /* PBXTargetDependency */,
+			);
+			name = kdb;
+			productName = kdb;
+			productReference = 9D65E91D1176303D00F3579B /* libkdb.dylib */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		9D65E961117630B300F3579B /* wkdb */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 9D65E985117630B300F3579B /* Build configuration list for PBXNativeTarget "wkdb" */;
+			buildPhases = (
+				9D65E962117630B300F3579B /* Headers */,
+				9D65E963117630B300F3579B /* Sources */,
+				9D65E984117630B300F3579B /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				9D65EBAF11764A1A00F3579B /* PBXTargetDependency */,
+			);
+			name = wkdb;
+			productName = kdb;
+			productReference = 9D65E988117630B300F3579B /* libwkdb.dylib */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		9D65E9E6117632C800F3579B /* vdb */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 9D65EA001176330D00F3579B /* Build configuration list for PBXNativeTarget "vdb" */;
+			buildPhases = (
+				9D65E9E3117632C800F3579B /* Headers */,
+				9D65E9E4117632C800F3579B /* Sources */,
+				9D65E9E5117632C800F3579B /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				9D65EBE711764BEA00F3579B /* PBXTargetDependency */,
+				9D65EBB511764A3100F3579B /* PBXTargetDependency */,
+			);
+			name = vdb;
+			productName = vdb;
+			productReference = 9D65E9E7117632C800F3579B /* libvdb.dylib */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		9D65EA011176330D00F3579B /* wvdb */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 9D65EA1B1176330D00F3579B /* Build configuration list for PBXNativeTarget "wvdb" */;
+			buildPhases = (
+				9D65EA021176330D00F3579B /* Headers */,
+				9D65EA031176330D00F3579B /* Sources */,
+				9D65EA1A1176330D00F3579B /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				9D65EBE911764BEC00F3579B /* PBXTargetDependency */,
+				9D65EBB711764A3600F3579B /* PBXTargetDependency */,
+			);
+			name = wvdb;
+			productName = vdb;
+			productReference = 9D65EA1E1176330D00F3579B /* libwvdb.dylib */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		9D65EA8F1176365700F3579B /* sra */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 9D65EAC1117636AB00F3579B /* Build configuration list for PBXNativeTarget "sra" */;
+			buildPhases = (
+				9D65EA8C1176365700F3579B /* Headers */,
+				9D65EA8D1176365700F3579B /* Sources */,
+				9D65EA8E1176365700F3579B /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				9D65EBB111764A2700F3579B /* PBXTargetDependency */,
+			);
+			name = sra;
+			productName = sra;
+			productReference = 9D65EA901176365700F3579B /* libsra.dylib */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		9D65EAC6117636BD00F3579B /* wsra */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 9D65EAF7117636BD00F3579B /* Build configuration list for PBXNativeTarget "wsra" */;
+			buildPhases = (
+				9D65EAC7117636BD00F3579B /* Headers */,
+				9D65EAC8117636BD00F3579B /* Sources */,
+				9D65EAF3117636BD00F3579B /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				9D65EBB311764A2800F3579B /* PBXTargetDependency */,
+			);
+			name = wsra;
+			productName = sra;
+			productReference = 9D65EAFA117636BD00F3579B /* libwsra.dylib */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		9D65EBCE11764B8200F3579B /* xform */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 9D65EBEE11764C2F00F3579B /* Build configuration list for PBXNativeTarget "xform" */;
+			buildPhases = (
+				9D65EBCC11764B8200F3579B /* Sources */,
+				9D65EBCD11764B8200F3579B /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = xform;
+			productName = xform;
+			productReference = 9D65EBCF11764B8200F3579B /* xform.o */;
+			productType = "com.apple.product-type.objfile";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		08FB7793FE84155DC02AAC07 /* Project object */ = {
+			isa = PBXProject;
+			buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "old-toolkit" */;
+			compatibilityVersion = "Xcode 3.0";
+			hasScannedForEncodings = 1;
+			mainGroup = 08FB7794FE84155DC02AAC07 /* sra2kdb */;
+			projectDirPath = "";
+			projectRoot = "";
+			targets = (
+				8DD76FA90486AB0100D96B5E /* sra2kdb */,
+				9D65E89D11762C8900F3579B /* klib */,
+				9D65E91C1176303D00F3579B /* kdb */,
+				9D65E961117630B300F3579B /* wkdb */,
+				9D65E9E6117632C800F3579B /* vdb */,
+				9D65EA011176330D00F3579B /* wvdb */,
+				9D65EA8F1176365700F3579B /* sra */,
+				9D65EAC6117636BD00F3579B /* wsra */,
+				9D65EBCE11764B8200F3579B /* xform */,
+				9D1A14B0119D932A00EF212F /* bam-test */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXSourcesBuildPhase section */
+		8DD76FAB0486AB0100D96B5E /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D65E5AA1174E29F00F3579B /* sra2kdb.c in Sources */,
+				9D65E9131176300200F3579B /* main.c in Sources */,
+				9D65E9141176300300F3579B /* sysmain.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D1A14AE119D932A00EF212F /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D1A14B5119D934300EF212F /* bamtest.c in Sources */,
+				9D1A14B6119D934A00EF212F /* BAMFile.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D65E89B11762C8900F3579B /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D65E8A111762C9B00F3579B /* arc.c in Sources */,
+				9D65E8A311762C9C00F3579B /* bstpersist.c in Sources */,
+				9D65E8A411762C9C00F3579B /* buffile.c in Sources */,
+				9D65E8A511762C9D00F3579B /* bzip.c in Sources */,
+				9D65E8A611762C9D00F3579B /* container.c in Sources */,
+				9D65E8A711762C9E00F3579B /* countfile.c in Sources */,
+				9D65E8A811762C9F00F3579B /* cp1252.c in Sources */,
+				9D65E8A911762CA000F3579B /* crc32.c in Sources */,
+				9D65E8AA11762CA000F3579B /* crc32.c in Sources */,
+				9D65E8AB11762CA100F3579B /* dir_test.c in Sources */,
+				9D65E8AC11762CA200F3579B /* directory.c in Sources */,
+				9D65E8AD11762CA200F3579B /* file.c in Sources */,
+				9D65E8AF11762CA300F3579B /* gzip.c in Sources */,
+				9D65E8B011762CA400F3579B /* iso8859-1.c in Sources */,
+				9D65E8B111762CA500F3579B /* iso8859.c in Sources */,
+				9D65E8B211762CA500F3579B /* md5.c in Sources */,
+				9D65E8B311762CA600F3579B /* md5.c in Sources */,
+				9D65E8B411762CA600F3579B /* namelist.c in Sources */,
+				9D65E8B511762CA700F3579B /* nullfile.c in Sources */,
+				9D65E8B611762CA800F3579B /* pbstree.c in Sources */,
+				9D65E8B711762CA800F3579B /* ptpersist.c in Sources */,
+				9D65E8B811762CA900F3579B /* ptrie.c in Sources */,
+				9D65E8B911762CAA00F3579B /* queue.c in Sources */,
+				9D65E8BB11762CBC00F3579B /* sra.c in Sources */,
+				9D65E8BC11762CBC00F3579B /* stbarrier.c in Sources */,
+				9D65E8BD11762CBD00F3579B /* stcond.c in Sources */,
+				9D65E8BE11762CBE00F3579B /* stlock.c in Sources */,
+				9D65E8BF11762CBE00F3579B /* stsem.c in Sources */,
+				9D65E8C011762CBF00F3579B /* stthread.c in Sources */,
+				9D65E8C111762CBF00F3579B /* sttimeout.c in Sources */,
+				9D65E8C211762CC000F3579B /* subfile.c in Sources */,
+				9D65E8C311762CC000F3579B /* symtab.c in Sources */,
+				9D65E8C411762CC100F3579B /* sysdir.c in Sources */,
+				9D65E8C511762CC200F3579B /* sysdll.c in Sources */,
+				9D65E8C611762CC300F3579B /* sysfile.c in Sources */,
+				9D65E8C711762CC300F3579B /* sysmmap.c in Sources */,
+				9D65E8C811762CC400F3579B /* tar.c in Sources */,
+				9D65E8C911762CC500F3579B /* teefile.c in Sources */,
+				9D65E8CA11762CC500F3579B /* text.c in Sources */,
+				9D65E8CB11762CC600F3579B /* toc.c in Sources */,
+				9D65E8CC11762CC600F3579B /* tocdir.c in Sources */,
+				9D65E8CD11762CC700F3579B /* tocentry.c in Sources */,
+				9D65E8CE11762CC700F3579B /* tocfile.c in Sources */,
+				9D65E8CF11762CC800F3579B /* token.c in Sources */,
+				9D65E8D011762CCA00F3579B /* trie.c in Sources */,
+				9D65E8D111762CCA00F3579B /* utf8.c in Sources */,
+				9D65E8D211762CCB00F3579B /* vector.c in Sources */,
+				9D65E8D311762CCB00F3579B /* xml.c in Sources */,
+				9D65E90011762F2900F3579B /* log.c in Sources */,
+				9D65E90111762F2A00F3579B /* syslog.c in Sources */,
+				9D65E90211762F2A00F3579B /* text-log.c in Sources */,
+				9D65E90811762F6800F3579B /* rc-tbl.c in Sources */,
+				9D65E90B11762F8200F3579B /* rc-idx-tbl.c in Sources */,
+				9D65E9B1117631C700F3579B /* pack.c in Sources */,
+				9D65E9B2117631CC00F3579B /* unpack.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D65E91A1176303D00F3579B /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D65E9401176309200F3579B /* coldata.c in Sources */,
+				9D65E9411176309200F3579B /* colidx.c in Sources */,
+				9D65E9421176309200F3579B /* colidx0.c in Sources */,
+				9D65E9431176309300F3579B /* colidx1.c in Sources */,
+				9D65E9441176309400F3579B /* colidx2.c in Sources */,
+				9D65E9451176309400F3579B /* column.c in Sources */,
+				9D65E9461176309500F3579B /* database.c in Sources */,
+				9D65E9471176309500F3579B /* dbmgr.c in Sources */,
+				9D65E9481176309600F3579B /* idxblk.c in Sources */,
+				9D65E9491176309600F3579B /* index.c in Sources */,
+				9D65E94A1176309700F3579B /* kdb.c in Sources */,
+				9D65E94B1176309800F3579B /* meta.c in Sources */,
+				9D65E94C1176309900F3579B /* table.c in Sources */,
+				9D65E94D1176309900F3579B /* trieidx-v1.c in Sources */,
+				9D65E94E1176309A00F3579B /* trieidx-v2.c in Sources */,
+				9D65E94F1176309B00F3579B /* u64idx-v3.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D65E963117630B300F3579B /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D65E96C117630B300F3579B /* idxblk.c in Sources */,
+				9D65E974117630B300F3579B /* wcoldata.c in Sources */,
+				9D65E975117630B300F3579B /* wcolidx.c in Sources */,
+				9D65E976117630B300F3579B /* wcolidx0.c in Sources */,
+				9D65E977117630B300F3579B /* wcolidx1.c in Sources */,
+				9D65E978117630B300F3579B /* wcolidx2.c in Sources */,
+				9D65E979117630B300F3579B /* wcolumn.c in Sources */,
+				9D65E97A117630B300F3579B /* wdatabase.c in Sources */,
+				9D65E97B117630B300F3579B /* wdbmgr.c in Sources */,
+				9D65E97C117630B300F3579B /* widxblk.c in Sources */,
+				9D65E97D117630B300F3579B /* windex.c in Sources */,
+				9D65E97E117630B300F3579B /* wkdb.c in Sources */,
+				9D65E97F117630B300F3579B /* wmeta.c in Sources */,
+				9D65E980117630B300F3579B /* wtable.c in Sources */,
+				9D65E981117630B300F3579B /* wtrieidx-v1.c in Sources */,
+				9D65E982117630B300F3579B /* wtrieidx-v2.c in Sources */,
+				9D65E983117630B300F3579B /* wu64idx-v3.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D65E9E4117632C800F3579B /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D65E9EA117632F500F3579B /* blob.c in Sources */,
+				9D65E9EB117632F600F3579B /* column-cmn.c in Sources */,
+				9D65E9EC117632F600F3579B /* column.c in Sources */,
+				9D65E9ED117632F700F3579B /* cursor-cmn.c in Sources */,
+				9D65E9EE117632F700F3579B /* database.c in Sources */,
+				9D65E9EF117632F800F3579B /* dbmgr-cmn.c in Sources */,
+				9D65E9F0117632F800F3579B /* dbmgr.c in Sources */,
+				9D65E9F1117632F900F3579B /* dtype.c in Sources */,
+				9D65E9F2117632F900F3579B /* loader.c in Sources */,
+				9D65E9F3117632FA00F3579B /* parse.c in Sources */,
+				9D65E9F4117632FB00F3579B /* schema-dump.c in Sources */,
+				9D65E9F5117632FB00F3579B /* schema.c in Sources */,
+				9D65E9F7117632FD00F3579B /* table-cmn.c in Sources */,
+				9D65E9F8117632FD00F3579B /* table.c in Sources */,
+				9D65E9FE1176330000F3579B /* xform.c in Sources */,
+				9D65E9FF1176330100F3579B /* xfuncs.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D65EA031176330D00F3579B /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D65EA041176330D00F3579B /* blob.c in Sources */,
+				9D65EA051176330D00F3579B /* column-cmn.c in Sources */,
+				9D65EA071176330D00F3579B /* cursor-cmn.c in Sources */,
+				9D65EA081176330D00F3579B /* database.c in Sources */,
+				9D65EA091176330D00F3579B /* dbmgr-cmn.c in Sources */,
+				9D65EA0B1176330D00F3579B /* dtype.c in Sources */,
+				9D65EA0C1176330D00F3579B /* loader.c in Sources */,
+				9D65EA0D1176330D00F3579B /* parse.c in Sources */,
+				9D65EA0E1176330D00F3579B /* schema-dump.c in Sources */,
+				9D65EA0F1176330D00F3579B /* schema.c in Sources */,
+				9D65EA101176330D00F3579B /* static-column-temp.c in Sources */,
+				9D65EA111176330D00F3579B /* table-cmn.c in Sources */,
+				9D65EA131176330D00F3579B /* wcolumn.c in Sources */,
+				9D65EA141176330D00F3579B /* wcursor.c in Sources */,
+				9D65EA151176330D00F3579B /* wdatabase.c in Sources */,
+				9D65EA161176330D00F3579B /* wdbmgr.c in Sources */,
+				9D65EA171176330D00F3579B /* wtable.c in Sources */,
+				9D65EA181176330D00F3579B /* xform.c in Sources */,
+				9D65EA191176330D00F3579B /* xfuncs.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D65EA8D1176365700F3579B /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D65EA981176368800F3579B /* legvcol.c in Sources */,
+				9D65EA9B1176368A00F3579B /* sra_decompress.c in Sources */,
+				9D65EA9C1176368A00F3579B /* sra_decompress_init.c in Sources */,
+				9D65EA9D1176368B00F3579B /* sracol-cmn.c in Sources */,
+				9D65EA9E1176368B00F3579B /* sracol.c in Sources */,
+				9D65EA9F1176368C00F3579B /* sraerr.c in Sources */,
+				9D65EAA21176368D00F3579B /* sranam.c in Sources */,
+				9D65EAA31176368E00F3579B /* sraschema.c in Sources */,
+				9D65EAA41176368E00F3579B /* sratbl-cmn.c in Sources */,
+				9D65EAA51176368F00F3579B /* sratbl.c in Sources */,
+				9D65EAAA1176369600F3579B /* clip_quality_right.c in Sources */,
+				9D65EAAB1176369600F3579B /* color-space.c in Sources */,
+				9D65EAAC1176369600F3579B /* delta-log-delta.c in Sources */,
+				9D65EAAD1176369700F3579B /* intensity-norm.c in Sources */,
+				9D65EAAE1176369700F3579B /* nencode.c in Sources */,
+				9D65EAAF1176369800F3579B /* phred-from-qval.c in Sources */,
+				9D65EAB01176369800F3579B /* platform_name.c in Sources */,
+				9D65EAB11176369900F3579B /* position.c in Sources */,
+				9D65EAB21176369900F3579B /* prob.c in Sources */,
+				9D65EAB31176369A00F3579B /* ptranspose.c in Sources */,
+				9D65EAB41176369A00F3579B /* qual4_codec.c in Sources */,
+				9D65EAB51176369B00F3579B /* quality.c in Sources */,
+				9D65EAB61176369B00F3579B /* read-desc.c in Sources */,
+				9D65EAB71176369C00F3579B /* read2na.c in Sources */,
+				9D65EAB81176369C00F3579B /* read4na.c in Sources */,
+				9D65EAB91176369D00F3579B /* read_struct.c in Sources */,
+				9D65EABA1176369D00F3579B /* readFasta.c in Sources */,
+				9D65EABB1176369E00F3579B /* reorder.c in Sources */,
+				9D65EABC1176369F00F3579B /* rotate.c in Sources */,
+				9D65EABD1176369F00F3579B /* sort-order.c in Sources */,
+				9D65EABE117636A000F3579B /* swap.c in Sources */,
+				9D65EABF117636A000F3579B /* validate.c in Sources */,
+				9D65EAC2117636AC00F3579B /* nucstrstr.c in Sources */,
+				9D65EAC3117636AF00F3579B /* srapath.c in Sources */,
+				9D65EB2A1176397E00F3579B /* sramgr-cmn.c in Sources */,
+				9D65EB2B1176397E00F3579B /* sramgr.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D65EAC8117636BD00F3579B /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D65EAC9117636BD00F3579B /* legvcol.c in Sources */,
+				9D65EACB117636BD00F3579B /* ncbi-wsramgr.c in Sources */,
+				9D65EACC117636BD00F3579B /* sra_decompress.c in Sources */,
+				9D65EACD117636BD00F3579B /* sra_decompress_init.c in Sources */,
+				9D65EACE117636BD00F3579B /* sracol-cmn.c in Sources */,
+				9D65EAD0117636BD00F3579B /* sraerr.c in Sources */,
+				9D65EAD1117636BD00F3579B /* sramgr-cmn.c in Sources */,
+				9D65EAD3117636BD00F3579B /* sranam.c in Sources */,
+				9D65EAD5117636BD00F3579B /* sratbl-cmn.c in Sources */,
+				9D65EAD7117636BD00F3579B /* wsracol.c in Sources */,
+				9D65EAD9117636BD00F3579B /* wsraschema.c in Sources */,
+				9D65EADA117636BD00F3579B /* wsratbl.c in Sources */,
+				9D65EADB117636BD00F3579B /* clip_quality_right.c in Sources */,
+				9D65EADC117636BD00F3579B /* color-space.c in Sources */,
+				9D65EADD117636BD00F3579B /* delta-log-delta.c in Sources */,
+				9D65EADE117636BD00F3579B /* intensity-norm.c in Sources */,
+				9D65EADF117636BD00F3579B /* nencode.c in Sources */,
+				9D65EAE0117636BD00F3579B /* phred-from-qval.c in Sources */,
+				9D65EAE1117636BD00F3579B /* platform_name.c in Sources */,
+				9D65EAE2117636BD00F3579B /* position.c in Sources */,
+				9D65EAE3117636BD00F3579B /* prob.c in Sources */,
+				9D65EAE4117636BD00F3579B /* ptranspose.c in Sources */,
+				9D65EAE5117636BD00F3579B /* qual4_codec.c in Sources */,
+				9D65EAE6117636BD00F3579B /* quality.c in Sources */,
+				9D65EAE7117636BD00F3579B /* read-desc.c in Sources */,
+				9D65EAE8117636BD00F3579B /* read2na.c in Sources */,
+				9D65EAE9117636BD00F3579B /* read4na.c in Sources */,
+				9D65EAEA117636BD00F3579B /* read_struct.c in Sources */,
+				9D65EAEB117636BD00F3579B /* readFasta.c in Sources */,
+				9D65EAEC117636BD00F3579B /* reorder.c in Sources */,
+				9D65EAED117636BD00F3579B /* rotate.c in Sources */,
+				9D65EAEE117636BD00F3579B /* sort-order.c in Sources */,
+				9D65EAEF117636BD00F3579B /* swap.c in Sources */,
+				9D65EAF0117636BD00F3579B /* validate.c in Sources */,
+				9D65EAF1117636BD00F3579B /* nucstrstr.c in Sources */,
+				9D65EAF2117636BD00F3579B /* srapath.c in Sources */,
+				9D65EB061176376D00F3579B /* sraschema.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		9D65EBCC11764B8200F3579B /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				9D65EBD211764BB900F3579B /* echo.c in Sources */,
+				9D65EBD311764BB900F3579B /* factories.c in Sources */,
+				9D65EBD411764BBA00F3579B /* floor.c in Sources */,
+				9D65EBD511764BBA00F3579B /* fpcodec.c in Sources */,
+				9D65EBD611764BBB00F3579B /* hufDecode.c in Sources */,
+				9D65EBD711764BBB00F3579B /* hufEncode.c in Sources */,
+				9D65EBD811764BBC00F3579B /* hufTable.c in Sources */,
+				9D65EBD911764BBC00F3579B /* hufZlib.c in Sources */,
+				9D65EBDA11764BBD00F3579B /* muxing.c in Sources */,
+				9D65EBDB11764BBD00F3579B /* null-row.c in Sources */,
+				9D65EBDC11764BBE00F3579B /* parse_args.c in Sources */,
+				9D65EBDD11764BBF00F3579B /* rleDecode.c in Sources */,
+				9D65EBDE11764BBF00F3579B /* rleEncode.c in Sources */,
+				9D65EBDF11764BC000F3579B /* row-len.c in Sources */,
+				9D65EBE011764BC000F3579B /* transpose.c in Sources */,
+				9D65EBE111764BC100F3579B /* validate.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+		9D1A14C6119D93DF00EF212F /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D65E89D11762C8900F3579B /* klib */;
+			targetProxy = 9D1A14C5119D93DF00EF212F /* PBXContainerItemProxy */;
+		};
+		9D65EBA3117649C100F3579B /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D65EA011176330D00F3579B /* wvdb */;
+			targetProxy = 9D65EBA2117649C100F3579B /* PBXContainerItemProxy */;
+		};
+		9D65EBA5117649C100F3579B /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D65EAC6117636BD00F3579B /* wsra */;
+			targetProxy = 9D65EBA4117649C100F3579B /* PBXContainerItemProxy */;
+		};
+		9D65EBAD11764A0A00F3579B /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D65E89D11762C8900F3579B /* klib */;
+			targetProxy = 9D65EBAC11764A0A00F3579B /* PBXContainerItemProxy */;
+		};
+		9D65EBAF11764A1A00F3579B /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D65E89D11762C8900F3579B /* klib */;
+			targetProxy = 9D65EBAE11764A1A00F3579B /* PBXContainerItemProxy */;
+		};
+		9D65EBB111764A2700F3579B /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D65E9E6117632C800F3579B /* vdb */;
+			targetProxy = 9D65EBB011764A2700F3579B /* PBXContainerItemProxy */;
+		};
+		9D65EBB311764A2800F3579B /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D65EA011176330D00F3579B /* wvdb */;
+			targetProxy = 9D65EBB211764A2800F3579B /* PBXContainerItemProxy */;
+		};
+		9D65EBB511764A3100F3579B /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D65E91C1176303D00F3579B /* kdb */;
+			targetProxy = 9D65EBB411764A3100F3579B /* PBXContainerItemProxy */;
+		};
+		9D65EBB711764A3600F3579B /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D65E961117630B300F3579B /* wkdb */;
+			targetProxy = 9D65EBB611764A3600F3579B /* PBXContainerItemProxy */;
+		};
+		9D65EBE711764BEA00F3579B /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D65EBCE11764B8200F3579B /* xform */;
+			targetProxy = 9D65EBE611764BEA00F3579B /* PBXContainerItemProxy */;
+		};
+		9D65EBE911764BEC00F3579B /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 9D65EBCE11764B8200F3579B /* xform */;
+			targetProxy = 9D65EBE811764BEC00F3579B /* PBXContainerItemProxy */;
+		};
+/* End PBXTargetDependency section */
+
+/* Begin XCBuildConfiguration section */
+		1DEB928608733DD80010E9CD /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = /usr/local/bin;
+				LIBRARY_SEARCH_PATHS = (
+					"$(inherited)",
+					"\"$(SRCROOT)/build/Debug\"",
+				);
+				PRODUCT_NAME = sra2kdb;
+			};
+			name = Debug;
+		};
+		1DEB928708733DD80010E9CD /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = /usr/local/bin;
+				LIBRARY_SEARCH_PATHS = (
+					"$(inherited)",
+					"\"$(SRCROOT)/build/Debug\"",
+				);
+				PRODUCT_NAME = sra2kdb;
+			};
+			name = Release;
+		};
+		1DEB928A08733DD80010E9CD /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ONLY_ACTIVE_ARCH_PRE_XCODE_3_1)";
+				GCC_C_LANGUAGE_STANDARD = gnu99;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = "_LOGGING=1";
+				GCC_VERSION = "";
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				HEADER_SEARCH_PATHS = (
+					"$(HOME)/asm-trace/inc/gcc/$arch",
+					"$(HOME)/asm-trace/inc/gcc",
+					"$(HOME)/asm-trace/inc/mac",
+					"$(HOME)/asm-trace/inc/bsd",
+					"$(HOME)/asm-trace/inc/unix",
+					"$(HOME)/asm-trace/itf",
+					/usr/include/libxml2,
+				);
+				ONLY_ACTIVE_ARCH_PRE_XCODE_3_1 = "$(NATIVE_ARCH_ACTUAL)";
+				PREBINDING = NO;
+				SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.6.sdk";
+			};
+			name = Debug;
+		};
+		1DEB928B08733DD80010E9CD /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				GCC_C_LANGUAGE_STANDARD = gnu99;
+				GCC_PREPROCESSOR_DEFINITIONS = "_LOGGING=1";
+				GCC_VERSION = "";
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				HEADER_SEARCH_PATHS = (
+					"$(HOME)/asm-trace/inc/gcc/$arch",
+					"$(HOME)/asm-trace/inc/gcc",
+					"$(HOME)/asm-trace/inc/mac",
+					"$(HOME)/asm-trace/inc/bsd",
+					"$(HOME)/asm-trace/inc/unix",
+					"$(HOME)/asm-trace/itf",
+					/usr/include/libxml2,
+				);
+				PREBINDING = NO;
+				SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.6.sdk";
+			};
+			name = Release;
+		};
+		9D1A14B3119D932B00EF212F /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = /usr/local/bin;
+				PREBINDING = NO;
+				PRODUCT_NAME = "bam-test";
+			};
+			name = Debug;
+		};
+		9D1A14B4119D932B00EF212F /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = /usr/local/bin;
+				PREBINDING = NO;
+				PRODUCT_NAME = "bam-test";
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		9D65E89F11762C8A00F3579B /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = NO;
+				EXECUTABLE_PREFIX = lib;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = (
+					"$(HOME)/asm-trace/inc/gcc/$arch",
+					"$(HOME)/asm-trace/inc/gcc",
+					"$(HOME)/asm-trace/inc/mac",
+					"$(HOME)/asm-trace/inc/bsd",
+					"$(HOME)/asm-trace/inc/unix",
+					"$(HOME)/asm-trace/itf",
+					/usr/include/libxml2,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = klib;
+			};
+			name = Debug;
+		};
+		9D65E8A011762C8A00F3579B /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				EXECUTABLE_PREFIX = lib;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = G5;
+				HEADER_SEARCH_PATHS = (
+					"$(HOME)/asm-trace/inc/gcc/$arch",
+					"$(HOME)/asm-trace/inc/gcc",
+					"$(HOME)/asm-trace/inc/mac",
+					"$(HOME)/asm-trace/inc/bsd",
+					"$(HOME)/asm-trace/inc/unix",
+					"$(HOME)/asm-trace/itf",
+					/usr/include/libxml2,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = klib;
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		9D65E91E1176303E00F3579B /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = NO;
+				EXECUTABLE_PREFIX = lib;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = kdb;
+			};
+			name = Debug;
+		};
+		9D65E91F1176303E00F3579B /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				EXECUTABLE_PREFIX = lib;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = kdb;
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		9D65E986117630B300F3579B /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = NO;
+				EXECUTABLE_PREFIX = lib;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_SEARCH_PATHS = (
+					"$(inherited)",
+					"\"$(SRCROOT)/build/Debug\"",
+				);
+				PREBINDING = NO;
+				PRODUCT_NAME = wkdb;
+			};
+			name = Debug;
+		};
+		9D65E987117630B300F3579B /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				EXECUTABLE_PREFIX = lib;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_SEARCH_PATHS = (
+					"$(inherited)",
+					"\"$(SRCROOT)/build/Debug\"",
+				);
+				PREBINDING = NO;
+				PRODUCT_NAME = wkdb;
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		9D65E9E8117632C900F3579B /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = NO;
+				EXECUTABLE_PREFIX = lib;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = vdb;
+			};
+			name = Debug;
+		};
+		9D65E9E9117632C900F3579B /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				EXECUTABLE_PREFIX = lib;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = vdb;
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		9D65EA1C1176330D00F3579B /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = NO;
+				EXECUTABLE_PREFIX = lib;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = wvdb;
+			};
+			name = Debug;
+		};
+		9D65EA1D1176330D00F3579B /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				EXECUTABLE_PREFIX = lib;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = vdb;
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		9D65EA911176365800F3579B /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = NO;
+				EXECUTABLE_PREFIX = lib;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_SEARCH_PATHS = (
+					"$(inherited)",
+					"\"$(SRCROOT)/build/Debug\"",
+				);
+				PREBINDING = NO;
+				PRODUCT_NAME = sra;
+			};
+			name = Debug;
+		};
+		9D65EA921176365800F3579B /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				EXECUTABLE_PREFIX = lib;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_SEARCH_PATHS = (
+					"$(inherited)",
+					"\"$(SRCROOT)/build/Debug\"",
+				);
+				PREBINDING = NO;
+				PRODUCT_NAME = sra;
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		9D65EAF8117636BD00F3579B /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = NO;
+				EXECUTABLE_PREFIX = lib;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_SEARCH_PATHS = (
+					"$(inherited)",
+					"\\\"$(SRCROOT)/build/Debug\\\"",
+				);
+				PREBINDING = NO;
+				PRODUCT_NAME = wsra;
+			};
+			name = Debug;
+		};
+		9D65EAF9117636BD00F3579B /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				EXECUTABLE_PREFIX = lib;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_SEARCH_PATHS = (
+					"$(inherited)",
+					"\\\"$(SRCROOT)/build/Debug\\\"",
+				);
+				PREBINDING = NO;
+				PRODUCT_NAME = sra;
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		9D65EBD011764B8200F3579B /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = xform;
+			};
+			name = Debug;
+		};
+		9D65EBD111764B8200F3579B /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = xform;
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		1DEB928508733DD80010E9CD /* Build configuration list for PBXNativeTarget "sra2kdb" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				1DEB928608733DD80010E9CD /* Debug */,
+				1DEB928708733DD80010E9CD /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "old-toolkit" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				1DEB928A08733DD80010E9CD /* Debug */,
+				1DEB928B08733DD80010E9CD /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		9D1A14BA119D936800EF212F /* Build configuration list for PBXNativeTarget "bam-test" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				9D1A14B3119D932B00EF212F /* Debug */,
+				9D1A14B4119D932B00EF212F /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		9D65E8D411762CF600F3579B /* Build configuration list for PBXNativeTarget "klib" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				9D65E89F11762C8A00F3579B /* Debug */,
+				9D65E8A011762C8A00F3579B /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		9D65E960117630B300F3579B /* Build configuration list for PBXNativeTarget "kdb" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				9D65E91E1176303E00F3579B /* Debug */,
+				9D65E91F1176303E00F3579B /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		9D65E985117630B300F3579B /* Build configuration list for PBXNativeTarget "wkdb" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				9D65E986117630B300F3579B /* Debug */,
+				9D65E987117630B300F3579B /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		9D65EA001176330D00F3579B /* Build configuration list for PBXNativeTarget "vdb" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				9D65E9E8117632C900F3579B /* Debug */,
+				9D65E9E9117632C900F3579B /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		9D65EA1B1176330D00F3579B /* Build configuration list for PBXNativeTarget "wvdb" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				9D65EA1C1176330D00F3579B /* Debug */,
+				9D65EA1D1176330D00F3579B /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		9D65EAC1117636AB00F3579B /* Build configuration list for PBXNativeTarget "sra" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				9D65EA911176365800F3579B /* Debug */,
+				9D65EA921176365800F3579B /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		9D65EAF7117636BD00F3579B /* Build configuration list for PBXNativeTarget "wsra" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				9D65EAF8117636BD00F3579B /* Debug */,
+				9D65EAF9117636BD00F3579B /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		9D65EBEE11764C2F00F3579B /* Build configuration list for PBXNativeTarget "xform" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				9D65EBD011764B8200F3579B /* Debug */,
+				9D65EBD111764B8200F3579B /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
+}
diff --git a/build/cp.sh b/build/cp.sh
new file mode 100755
index 0000000..a966bc2
--- /dev/null
+++ b/build/cp.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+SRC="$1"
+DST="$2"
+QUERY="$3"
+
+# go to where this directory may be found
+cd "$SRC" || exit $?
+
+# find all of the files in question
+for f in $(find . $QUERY)
+do
+
+    # test for being newer
+    if [ $f -nt "$DST/$f" ]
+    then
+
+        # test if destination exists
+        if [ ! -f "$DST/$f" ]
+        then
+
+            # make sure the directory exists
+            d=$(dirname "$DST/$f")
+            mkdir -p "$d"
+        fi
+
+        # copy
+        echo "cp $SRC/$f $DST/$f"
+        cp -pPR $f $DST/$f
+    fi
+
+done
diff --git a/build/gprof2dot.py b/build/gprof2dot.py
new file mode 100755
index 0000000..3bd302e
--- /dev/null
+++ b/build/gprof2dot.py
@@ -0,0 +1,2763 @@
+#!/opt/python-2.5/bin/python
+#
+# Copyright 2008-2009 Jose Fonseca
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published
+# by the Free Software Foundation, either version 3 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 Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+"""Generate a dot graph from the output of several profilers."""
+
+__author__ = "Jose Fonseca"
+
+__version__ = "1.0"
+
+
+import sys
+import math
+import os.path
+import re
+import textwrap
+import optparse
+import xml.parsers.expat
+
+
+try:
+    # Debugging helper module
+    import debug
+except ImportError:
+    pass
+
+
+def times(x):
+    return u"%u\xd7" % (x,)
+
+def percentage(p):
+    return "%.02f%%" % (p*100.0,)
+
+def add(a, b):
+    return a + b
+
+def equal(a, b):
+    if a == b:
+        return a
+    else:
+        return None
+
+def fail(a, b):
+    assert False
+
+
+tol = 2 ** -23
+
+def ratio(numerator, denominator):
+    try:
+        ratio = float(numerator)/float(denominator)
+    except ZeroDivisionError:
+        # 0/0 is undefined, but 1.0 yields more useful results
+        return 1.0
+    if ratio < 0.0:
+        if ratio < -tol:
+            sys.stderr.write('warning: negative ratio (%s/%s)\n' % (numerator, denominator))
+        return 0.0
+    if ratio > 1.0:
+        if ratio > 1.0 + tol:
+            sys.stderr.write('warning: ratio greater than one (%s/%s)\n' % (numerator, denominator))
+        return 1.0
+    return ratio
+
+
+class UndefinedEvent(Exception):
+    """Raised when attempting to get an event which is undefined."""
+    
+    def __init__(self, event):
+        Exception.__init__(self)
+        self.event = event
+
+    def __str__(self):
+        return 'unspecified event %s' % self.event.name
+
+
+class Event(object):
+    """Describe a kind of event, and its basic operations."""
+
+    def __init__(self, name, null, aggregator, formatter = str):
+        self.name = name
+        self._null = null
+        self._aggregator = aggregator
+        self._formatter = formatter
+
+    def __eq__(self, other):
+        return self is other
+
+    def __hash__(self):
+        return id(self)
+
+    def null(self):
+        return self._null
+
+    def aggregate(self, val1, val2):
+        """Aggregate two event values."""
+        assert val1 is not None
+        assert val2 is not None
+        return self._aggregator(val1, val2)
+    
+    def format(self, val):
+        """Format an event value."""
+        assert val is not None
+        return self._formatter(val)
+
+
+CALLS = Event("Calls", 0, add, times)
+SAMPLES = Event("Samples", 0, add)
+SAMPLES2 = Event("Samples", 0, add)
+
+TIME = Event("Time", 0.0, add, lambda x: '(' + str(x) + ')')
+TIME_RATIO = Event("Time ratio", 0.0, add, lambda x: '(' + percentage(x) + ')')
+TOTAL_TIME = Event("Total time", 0.0, fail)
+TOTAL_TIME_RATIO = Event("Total time ratio", 0.0, fail, percentage)
+
+
+class Object(object):
+    """Base class for all objects in profile which can store events."""
+
+    def __init__(self, events=None):
+        if events is None:
+            self.events = {}
+        else:
+            self.events = events
+
+    def __hash__(self):
+        return id(self)
+
+    def __eq__(self, other):
+        return self is other
+
+    def __contains__(self, event):
+        return event in self.events
+    
+    def __getitem__(self, event):
+        try:
+            return self.events[event]
+        except KeyError:
+            raise UndefinedEvent(event)
+    
+    def __setitem__(self, event, value):
+        if value is None:
+            if event in self.events:
+                del self.events[event]
+        else:
+            self.events[event] = value
+
+
+class Call(Object):
+    """A call between functions.
+    
+    There should be at most one call object for every pair of functions.
+    """
+
+    def __init__(self, callee_id):
+        Object.__init__(self)
+        self.callee_id = callee_id
+        self.ratio = None
+        self.weight = None
+
+
+class Function(Object):
+    """A function."""
+
+    def __init__(self, id, name):
+        Object.__init__(self)
+        self.id = id
+        self.name = name
+        self.module = None
+        self.process = None
+        self.calls = {}
+        self.called = None
+        self.weight = None
+        self.cycle = None
+    
+    def add_call(self, call):
+        if call.callee_id in self.calls:
+            sys.stderr.write('warning: overwriting call from function %s to %s\n' % (str(self.id), str(call.callee_id)))
+        self.calls[call.callee_id] = call
+
+    def get_call(self, callee_id):
+        if not callee_id in self.calls:
+            call = Call(callee_id)
+            call[SAMPLES] = 0
+            call[SAMPLES2] = 0
+            call[CALLS] = 0
+            self.calls[callee_id] = call
+        return self.calls[callee_id]
+
+    # TODO: write utility functions
+
+    def __repr__(self):
+        return self.name
+
+
+class Cycle(Object):
+    """A cycle made from recursive function calls."""
+
+    def __init__(self):
+        Object.__init__(self)
+        # XXX: Do cycles need an id?
+        self.functions = set()
+
+    def add_function(self, function):
+        assert function not in self.functions
+        self.functions.add(function)
+        # XXX: Aggregate events?
+        if function.cycle is not None:
+            for other in function.cycle.functions:
+                if function not in self.functions:
+                    self.add_function(other)
+        function.cycle = self
+
+
+class Profile(Object):
+    """The whole profile."""
+
+    def __init__(self):
+        Object.__init__(self)
+        self.functions = {}
+        self.cycles = []
+
+    def add_function(self, function):
+        if function.id in self.functions:
+            sys.stderr.write('warning: overwriting function %s (id %s)\n' % (function.name, str(function.id)))
+        self.functions[function.id] = function
+
+    def add_cycle(self, cycle):
+        self.cycles.append(cycle)
+
+    def validate(self):
+        """Validate the edges."""
+
+        for function in self.functions.itervalues():
+            for callee_id in function.calls.keys():
+                assert function.calls[callee_id].callee_id == callee_id
+                if callee_id not in self.functions:
+                    sys.stderr.write('warning: call to undefined function %s from function %s\n' % (str(callee_id), function.name))
+                    del function.calls[callee_id]
+
+    def find_cycles(self):
+        """Find cycles using Tarjan's strongly connected components algorithm."""
+
+        # Apply the Tarjan's algorithm successively until all functions are visited
+        visited = set()
+        for function in self.functions.itervalues():
+            if function not in visited:
+                self._tarjan(function, 0, [], {}, {}, visited)
+        cycles = []
+        for function in self.functions.itervalues():
+            if function.cycle is not None and function.cycle not in cycles:
+                cycles.append(function.cycle)
+        self.cycles = cycles
+        if 0:
+            for cycle in cycles:
+                sys.stderr.write("Cycle:\n")
+                for member in cycle.functions:
+                    sys.stderr.write("\tFunction %s\n" % member.name)
+    
+    def _tarjan(self, function, order, stack, orders, lowlinks, visited):
+        """Tarjan's strongly connected components algorithm.
+
+        See also:
+        - http://en.wikipedia.org/wiki/Tarjan's_strongly_connected_components_algorithm
+        """
+
+        visited.add(function)
+        orders[function] = order
+        lowlinks[function] = order
+        order += 1
+        pos = len(stack)
+        stack.append(function)
+        for call in function.calls.itervalues():
+            callee = self.functions[call.callee_id]
+            # TODO: use a set to optimize lookup
+            if callee not in orders:
+                order = self._tarjan(callee, order, stack, orders, lowlinks, visited)
+                lowlinks[function] = min(lowlinks[function], lowlinks[callee])
+            elif callee in stack:
+                lowlinks[function] = min(lowlinks[function], orders[callee])
+        if lowlinks[function] == orders[function]:
+            # Strongly connected component found
+            members = stack[pos:]
+            del stack[pos:]
+            if len(members) > 1:
+                cycle = Cycle()
+                for member in members:
+                    cycle.add_function(member)
+        return order
+
+    def call_ratios(self, event):
+        # Aggregate for incoming calls
+        cycle_totals = {}
+        for cycle in self.cycles:
+            cycle_totals[cycle] = 0.0
+        function_totals = {}
+        for function in self.functions.itervalues():
+            function_totals[function] = 0.0
+        for function in self.functions.itervalues():
+            for call in function.calls.itervalues():
+                if call.callee_id != function.id:
+                    callee = self.functions[call.callee_id]
+                    function_totals[callee] += call[event]
+                    if callee.cycle is not None and callee.cycle is not function.cycle:
+                        cycle_totals[callee.cycle] += call[event]
+
+        # Compute the ratios
+        for function in self.functions.itervalues():
+            for call in function.calls.itervalues():
+                assert call.ratio is None
+                if call.callee_id != function.id:
+                    callee = self.functions[call.callee_id]
+                    if callee.cycle is not None and callee.cycle is not function.cycle:
+                        total = cycle_totals[callee.cycle]
+                    else:
+                        total = function_totals[callee]
+                    call.ratio = ratio(call[event], total)
+
+    def integrate(self, outevent, inevent):
+        """Propagate function time ratio allong the function calls.
+
+        Must be called after finding the cycles.
+
+        See also:
+        - http://citeseer.ist.psu.edu/graham82gprof.html
+        """
+
+        # Sanity checking
+        assert outevent not in self
+        for function in self.functions.itervalues():
+            assert outevent not in function
+            assert inevent in function
+            for call in function.calls.itervalues():
+                assert outevent not in call
+                if call.callee_id != function.id:
+                    assert call.ratio is not None
+
+        # Aggregate the input for each cycle 
+        for cycle in self.cycles:
+            total = inevent.null()
+            for function in self.functions.itervalues():
+                total = inevent.aggregate(total, function[inevent])
+            self[inevent] = total
+
+        # Integrate along the edges
+        total = inevent.null()
+        for function in self.functions.itervalues():
+            total = inevent.aggregate(total, function[inevent])
+            self._integrate_function(function, outevent, inevent)
+        self[outevent] = total
+
+    def _integrate_function(self, function, outevent, inevent):
+        if function.cycle is not None:
+            return self._integrate_cycle(function.cycle, outevent, inevent)
+        else:
+            if outevent not in function:
+                total = function[inevent]
+                for call in function.calls.itervalues():
+                    if call.callee_id != function.id:
+                        total += self._integrate_call(call, outevent, inevent)
+                function[outevent] = total
+            return function[outevent]
+    
+    def _integrate_call(self, call, outevent, inevent):
+        assert outevent not in call
+        assert call.ratio is not None
+        callee = self.functions[call.callee_id]
+        subtotal = call.ratio *self._integrate_function(callee, outevent, inevent)
+        call[outevent] = subtotal
+        return subtotal
+
+    def _integrate_cycle(self, cycle, outevent, inevent):
+        if outevent not in cycle:
+
+            # Compute the outevent for the whole cycle
+            total = inevent.null()
+            for member in cycle.functions:
+                subtotal = member[inevent]
+                for call in member.calls.itervalues():
+                    callee = self.functions[call.callee_id]
+                    if callee.cycle is not cycle:
+                        subtotal += self._integrate_call(call, outevent, inevent)
+                total += subtotal
+            cycle[outevent] = total
+            
+            # Compute the time propagated to callers of this cycle
+            callees = {}
+            for function in self.functions.itervalues():
+                if function.cycle is not cycle:
+                    for call in function.calls.itervalues():
+                        callee = self.functions[call.callee_id]
+                        if callee.cycle is cycle:
+                            try:
+                                callees[callee] += call.ratio
+                            except KeyError:
+                                callees[callee] = call.ratio
+            
+            for member in cycle.functions:
+                member[outevent] = outevent.null()
+
+            for callee, call_ratio in callees.iteritems():
+                ranks = {}
+                call_ratios = {}
+                partials = {}
+                self._rank_cycle_function(cycle, callee, 0, ranks)
+                self._call_ratios_cycle(cycle, callee, ranks, call_ratios, set())
+                partial = self._integrate_cycle_function(cycle, callee, call_ratio, partials, ranks, call_ratios, outevent, inevent)
+                assert partial == max(partials.values())
+                assert not total or abs(1.0 - partial/(call_ratio*total)) <= 0.001
+
+        return cycle[outevent]
+
+    def _rank_cycle_function(self, cycle, function, rank, ranks):
+        if function not in ranks or ranks[function] > rank:
+            ranks[function] = rank
+            for call in function.calls.itervalues():
+                if call.callee_id != function.id:
+                    callee = self.functions[call.callee_id]
+                    if callee.cycle is cycle:
+                        self._rank_cycle_function(cycle, callee, rank + 1, ranks)
+
+    def _call_ratios_cycle(self, cycle, function, ranks, call_ratios, visited):
+        if function not in visited:
+            visited.add(function)
+            for call in function.calls.itervalues():
+                if call.callee_id != function.id:
+                    callee = self.functions[call.callee_id]
+                    if callee.cycle is cycle:
+                        if ranks[callee] > ranks[function]:
+                            call_ratios[callee] = call_ratios.get(callee, 0.0) + call.ratio
+                            self._call_ratios_cycle(cycle, callee, ranks, call_ratios, visited)
+
+    def _integrate_cycle_function(self, cycle, function, partial_ratio, partials, ranks, call_ratios, outevent, inevent):
+        if function not in partials:
+            partial = partial_ratio*function[inevent]
+            for call in function.calls.itervalues():
+                if call.callee_id != function.id:
+                    callee = self.functions[call.callee_id]
+                    if callee.cycle is not cycle:
+                        assert outevent in call
+                        partial += partial_ratio*call[outevent]
+                    else:
+                        if ranks[callee] > ranks[function]:
+                            callee_partial = self._integrate_cycle_function(cycle, callee, partial_ratio, partials, ranks, call_ratios, outevent, inevent)
+                            call_ratio = ratio(call.ratio, call_ratios[callee])
+                            call_partial = call_ratio*callee_partial
+                            try:
+                                call[outevent] += call_partial
+                            except UndefinedEvent:
+                                call[outevent] = call_partial
+                            partial += call_partial
+            partials[function] = partial
+            try:
+                function[outevent] += partial
+            except UndefinedEvent:
+                function[outevent] = partial
+        return partials[function]
+
+    def aggregate(self, event):
+        """Aggregate an event for the whole profile."""
+
+        total = event.null()
+        for function in self.functions.itervalues():
+            try:
+                total = event.aggregate(total, function[event])
+            except UndefinedEvent:
+                return
+        self[event] = total
+
+    def ratio(self, outevent, inevent):
+        assert outevent not in self
+        assert inevent in self
+        for function in self.functions.itervalues():
+            assert outevent not in function
+            assert inevent in function
+            function[outevent] = ratio(function[inevent], self[inevent])
+            for call in function.calls.itervalues():
+                assert outevent not in call
+                if inevent in call:
+                    call[outevent] = ratio(call[inevent], self[inevent])
+        self[outevent] = 1.0
+
+    def prune(self, node_thres, edge_thres):
+        """Prune the profile"""
+
+        # compute the prune ratios
+        for function in self.functions.itervalues():
+            try:
+                function.weight = function[TOTAL_TIME_RATIO]
+            except UndefinedEvent:
+                pass
+
+            for call in function.calls.itervalues():
+                callee = self.functions[call.callee_id]
+
+                if TOTAL_TIME_RATIO in call:
+                    # handle exact cases first
+                    call.weight = call[TOTAL_TIME_RATIO] 
+                else:
+                    try:
+                        # make a safe estimate
+                        call.weight = min(function[TOTAL_TIME_RATIO], callee[TOTAL_TIME_RATIO]) 
+                    except UndefinedEvent:
+                        pass
+
+        # prune the nodes
+        for function_id in self.functions.keys():
+            function = self.functions[function_id]
+            if function.weight is not None:
+                if function.weight < node_thres:
+                    del self.functions[function_id]
+
+        # prune the egdes
+        for function in self.functions.itervalues():
+            for callee_id in function.calls.keys():
+                call = function.calls[callee_id]
+                if callee_id not in self.functions or call.weight is not None and call.weight < edge_thres:
+                    del function.calls[callee_id]
+    
+    def dump(self):
+        for function in self.functions.itervalues():
+            sys.stderr.write('Function %s:\n' % (function.name,))
+            self._dump_events(function.events)
+            for call in function.calls.itervalues():
+                callee = self.functions[call.callee_id]
+                sys.stderr.write('  Call %s:\n' % (callee.name,))
+                self._dump_events(call.events)
+        for cycle in self.cycles:
+            sys.stderr.write('Cycle:\n')
+            self._dump_events(cycle.events)
+            for function in cycle.functions:
+                sys.stderr.write('  Function %s\n' % (function.name,))
+
+    def _dump_events(self, events):
+        for event, value in events.iteritems():
+            sys.stderr.write('    %s: %s\n' % (event.name, event.format(value)))
+
+
+class Struct:
+    """Masquerade a dictionary with a structure-like behavior."""
+
+    def __init__(self, attrs = None):
+        if attrs is None:
+            attrs = {}
+        self.__dict__['_attrs'] = attrs
+    
+    def __getattr__(self, name):
+        try:
+            return self._attrs[name]
+        except KeyError:
+            raise AttributeError(name)
+
+    def __setattr__(self, name, value):
+        self._attrs[name] = value
+
+    def __str__(self):
+        return str(self._attrs)
+
+    def __repr__(self):
+        return repr(self._attrs)
+    
+
+class ParseError(Exception):
+    """Raised when parsing to signal mismatches."""
+
+    def __init__(self, msg, line):
+        self.msg = msg
+        # TODO: store more source line information
+        self.line = line
+
+    def __str__(self):
+        return '%s: %r' % (self.msg, self.line)
+
+
+class Parser:
+    """Parser interface."""
+
+    def __init__(self):
+        pass
+
+    def parse(self):
+        raise NotImplementedError
+
+    
+class LineParser(Parser):
+    """Base class for parsers that read line-based formats."""
+
+    def __init__(self, file):
+        Parser.__init__(self)
+        self._file = file
+        self.__line = None
+        self.__eof = False
+        self.line_no = 0
+
+    def readline(self):
+        line = self._file.readline()
+        if not line:
+            self.__line = ''
+            self.__eof = True
+        else:
+            self.line_no += 1
+        self.__line = line.rstrip('\r\n')
+
+    def lookahead(self):
+        assert self.__line is not None
+        return self.__line
+
+    def consume(self):
+        assert self.__line is not None
+        line = self.__line
+        self.readline()
+        return line
+
+    def eof(self):
+        assert self.__line is not None
+        return self.__eof
+
+
+XML_ELEMENT_START, XML_ELEMENT_END, XML_CHARACTER_DATA, XML_EOF = range(4)
+
+
+class XmlToken:
+
+    def __init__(self, type, name_or_data, attrs = None, line = None, column = None):
+        assert type in (XML_ELEMENT_START, XML_ELEMENT_END, XML_CHARACTER_DATA, XML_EOF)
+        self.type = type
+        self.name_or_data = name_or_data
+        self.attrs = attrs
+        self.line = line
+        self.column = column
+
+    def __str__(self):
+        if self.type == XML_ELEMENT_START:
+            return '<' + self.name_or_data + ' ...>'
+        if self.type == XML_ELEMENT_END:
+            return '</' + self.name_or_data + '>'
+        if self.type == XML_CHARACTER_DATA:
+            return self.name_or_data
+        if self.type == XML_EOF:
+            return 'end of file'
+        assert 0
+
+
+class XmlTokenizer:
+    """Expat based XML tokenizer."""
+
+    def __init__(self, fp, skip_ws = True):
+        self.fp = fp
+        self.tokens = []
+        self.index = 0
+        self.final = False
+        self.skip_ws = skip_ws
+        
+        self.character_pos = 0, 0
+        self.character_data = ''
+        
+        self.parser = xml.parsers.expat.ParserCreate()
+        self.parser.StartElementHandler  = self.handle_element_start
+        self.parser.EndElementHandler    = self.handle_element_end
+        self.parser.CharacterDataHandler = self.handle_character_data
+    
+    def handle_element_start(self, name, attributes):
+        self.finish_character_data()
+        line, column = self.pos()
+        token = XmlToken(XML_ELEMENT_START, name, attributes, line, column)
+        self.tokens.append(token)
+    
+    def handle_element_end(self, name):
+        self.finish_character_data()
+        line, column = self.pos()
+        token = XmlToken(XML_ELEMENT_END, name, None, line, column)
+        self.tokens.append(token)
+
+    def handle_character_data(self, data):
+        if not self.character_data:
+            self.character_pos = self.pos()
+        self.character_data += data
+    
+    def finish_character_data(self):
+        if self.character_data:
+            if not self.skip_ws or not self.character_data.isspace(): 
+                line, column = self.character_pos
+                token = XmlToken(XML_CHARACTER_DATA, self.character_data, None, line, column)
+                self.tokens.append(token)
+            self.character_data = ''
+    
+    def next(self):
+        size = 16*1024
+        while self.index >= len(self.tokens) and not self.final:
+            self.tokens = []
+            self.index = 0
+            data = self.fp.read(size)
+            self.final = len(data) < size
+            try:
+                self.parser.Parse(data, self.final)
+            except xml.parsers.expat.ExpatError, e:
+                #if e.code == xml.parsers.expat.errors.XML_ERROR_NO_ELEMENTS:
+                if e.code == 3:
+                    pass
+                else:
+                    raise e
+        if self.index >= len(self.tokens):
+            line, column = self.pos()
+            token = XmlToken(XML_EOF, None, None, line, column)
+        else:
+            token = self.tokens[self.index]
+            self.index += 1
+        return token
+
+    def pos(self):
+        return self.parser.CurrentLineNumber, self.parser.CurrentColumnNumber
+
+
+class XmlTokenMismatch(Exception):
+
+    def __init__(self, expected, found):
+        self.expected = expected
+        self.found = found
+
+    def __str__(self):
+        return '%u:%u: %s expected, %s found' % (self.found.line, self.found.column, str(self.expected), str(self.found))
+
+
+class XmlParser(Parser):
+    """Base XML document parser."""
+
+    def __init__(self, fp):
+        Parser.__init__(self)
+        self.tokenizer = XmlTokenizer(fp)
+        self.consume()
+    
+    def consume(self):
+        self.token = self.tokenizer.next()
+
+    def match_element_start(self, name):
+        return self.token.type == XML_ELEMENT_START and self.token.name_or_data == name
+    
+    def match_element_end(self, name):
+        return self.token.type == XML_ELEMENT_END and self.token.name_or_data == name
+
+    def element_start(self, name):
+        while self.token.type == XML_CHARACTER_DATA:
+            self.consume()
+        if self.token.type != XML_ELEMENT_START:
+            raise XmlTokenMismatch(XmlToken(XML_ELEMENT_START, name), self.token)
+        if self.token.name_or_data != name:
+            raise XmlTokenMismatch(XmlToken(XML_ELEMENT_START, name), self.token)
+        attrs = self.token.attrs
+        self.consume()
+        return attrs
+    
+    def element_end(self, name):
+        while self.token.type == XML_CHARACTER_DATA:
+            self.consume()
+        if self.token.type != XML_ELEMENT_END:
+            raise XmlTokenMismatch(XmlToken(XML_ELEMENT_END, name), self.token)
+        if self.token.name_or_data != name:
+            raise XmlTokenMismatch(XmlToken(XML_ELEMENT_END, name), self.token)
+        self.consume()
+
+    def character_data(self, strip = True):
+        data = ''
+        while self.token.type == XML_CHARACTER_DATA:
+            data += self.token.name_or_data
+            self.consume()
+        if strip:
+            data = data.strip()
+        return data
+
+
+class GprofParser(Parser):
+    """Parser for GNU gprof output.
+
+    See also:
+    - Chapter "Interpreting gprof's Output" from the GNU gprof manual
+      http://sourceware.org/binutils/docs-2.18/gprof/Call-Graph.html#Call-Graph
+    - File "cg_print.c" from the GNU gprof source code
+      http://sourceware.org/cgi-bin/cvsweb.cgi/~checkout~/src/gprof/cg_print.c?rev=1.12&cvsroot=src
+    """
+
+    def __init__(self, fp):
+        Parser.__init__(self)
+        self.fp = fp
+        self.functions = {}
+        self.cycles = {}
+
+    def readline(self):
+        line = self.fp.readline()
+        if not line:
+            sys.stderr.write('error: unexpected end of file\n')
+            sys.exit(1)
+        line = line.rstrip('\r\n')
+        return line
+
+    _int_re = re.compile(r'^\d+$')
+    _float_re = re.compile(r'^\d+\.\d+$')
+
+    def translate(self, mo):
+        """Extract a structure from a match object, while translating the types in the process."""
+        attrs = {}
+        groupdict = mo.groupdict()
+        for name, value in groupdict.iteritems():
+            if value is None:
+                value = None
+            elif self._int_re.match(value):
+                value = int(value)
+            elif self._float_re.match(value):
+                value = float(value)
+            attrs[name] = (value)
+        return Struct(attrs)
+
+    _cg_header_re = re.compile(
+        # original gprof header
+        r'^\s+called/total\s+parents\s*$|' +
+        r'^index\s+%time\s+self\s+descendents\s+called\+self\s+name\s+index\s*$|' +
+        r'^\s+called/total\s+children\s*$|' +
+        # GNU gprof header
+        r'^index\s+%\s+time\s+self\s+children\s+called\s+name\s*$'
+    )
+
+    _cg_ignore_re = re.compile(
+        # spontaneous
+        r'^\s+<spontaneous>\s*$|'
+        # internal calls (such as "mcount")
+        r'^.*\((\d+)\)$'
+    )
+
+    _cg_primary_re = re.compile(
+        r'^\[(?P<index>\d+)\]?' + 
+        r'\s+(?P<percentage_time>\d+\.\d+)' + 
+        r'\s+(?P<self>\d+\.\d+)' + 
+        r'\s+(?P<descendants>\d+\.\d+)' + 
+        r'\s+(?:(?P<called>\d+)(?:\+(?P<called_self>\d+))?)?' + 
+        r'\s+(?P<name>\S.*?)' +
+        r'(?:\s+<cycle\s(?P<cycle>\d+)>)?' +
+        r'\s\[(\d+)\]$'
+    )
+
+    _cg_parent_re = re.compile(
+        r'^\s+(?P<self>\d+\.\d+)?' + 
+        r'\s+(?P<descendants>\d+\.\d+)?' + 
+        r'\s+(?P<called>\d+)(?:/(?P<called_total>\d+))?' + 
+        r'\s+(?P<name>\S.*?)' +
+        r'(?:\s+<cycle\s(?P<cycle>\d+)>)?' +
+        r'\s\[(?P<index>\d+)\]$'
+    )
+
+    _cg_child_re = _cg_parent_re
+
+    _cg_cycle_header_re = re.compile(
+        r'^\[(?P<index>\d+)\]?' + 
+        r'\s+(?P<percentage_time>\d+\.\d+)' + 
+        r'\s+(?P<self>\d+\.\d+)' + 
+        r'\s+(?P<descendants>\d+\.\d+)' + 
+        r'\s+(?:(?P<called>\d+)(?:\+(?P<called_self>\d+))?)?' + 
+        r'\s+<cycle\s(?P<cycle>\d+)\sas\sa\swhole>' +
+        r'\s\[(\d+)\]$'
+    )
+
+    _cg_cycle_member_re = re.compile(
+        r'^\s+(?P<self>\d+\.\d+)?' + 
+        r'\s+(?P<descendants>\d+\.\d+)?' + 
+        r'\s+(?P<called>\d+)(?:\+(?P<called_self>\d+))?' + 
+        r'\s+(?P<name>\S.*?)' +
+        r'(?:\s+<cycle\s(?P<cycle>\d+)>)?' +
+        r'\s\[(?P<index>\d+)\]$'
+    )
+
+    _cg_sep_re = re.compile(r'^--+$')
+
+    def parse_function_entry(self, lines):
+        parents = []
+        children = []
+
+        while True:
+            if not lines:
+                sys.stderr.write('warning: unexpected end of entry\n')
+            line = lines.pop(0)
+            if line.startswith('['):
+                break
+        
+            # read function parent line
+            mo = self._cg_parent_re.match(line)
+            if not mo:
+                if self._cg_ignore_re.match(line):
+                    continue
+                sys.stderr.write('warning: unrecognized call graph entry: %r\n' % line)
+            else:
+                parent = self.translate(mo)
+                parents.append(parent)
+
+        # read primary line
+        mo = self._cg_primary_re.match(line)
+        if not mo:
+            sys.stderr.write('warning: unrecognized call graph entry: %r\n' % line)
+            return
+        else:
+            function = self.translate(mo)
+
+        while lines:
+            line = lines.pop(0)
+            
+            # read function subroutine line
+            mo = self._cg_child_re.match(line)
+            if not mo:
+                if self._cg_ignore_re.match(line):
+                    continue
+                sys.stderr.write('warning: unrecognized call graph entry: %r\n' % line)
+            else:
+                child = self.translate(mo)
+                children.append(child)
+        
+        function.parents = parents
+        function.children = children
+
+        self.functions[function.index] = function
+
+    def parse_cycle_entry(self, lines):
+
+        # read cycle header line
+        line = lines[0]
+        mo = self._cg_cycle_header_re.match(line)
+        if not mo:
+            sys.stderr.write('warning: unrecognized call graph entry: %r\n' % line)
+            return
+        cycle = self.translate(mo)
+
+        # read cycle member lines
+        cycle.functions = []
+        for line in lines[1:]:
+            mo = self._cg_cycle_member_re.match(line)
+            if not mo:
+                sys.stderr.write('warning: unrecognized call graph entry: %r\n' % line)
+                continue
+            call = self.translate(mo)
+            cycle.functions.append(call)
+        
+        self.cycles[cycle.cycle] = cycle
+
+    def parse_cg_entry(self, lines):
+        if lines[0].startswith("["):
+            self.parse_cycle_entry(lines)
+        else:
+            self.parse_function_entry(lines)
+
+    def parse_cg(self):
+        """Parse the call graph."""
+
+        # skip call graph header
+        while not self._cg_header_re.match(self.readline()):
+            pass
+        line = self.readline()
+        while self._cg_header_re.match(line):
+            line = self.readline()
+
+        # process call graph entries
+        entry_lines = []
+        while line != '\014': # form feed
+            if line and not line.isspace():
+                if self._cg_sep_re.match(line):
+                    self.parse_cg_entry(entry_lines)
+                    entry_lines = []
+                else:
+                    entry_lines.append(line)            
+            line = self.readline()
+    
+    def parse(self):
+        self.parse_cg()
+        self.fp.close()
+
+        profile = Profile()
+        profile[TIME] = 0.0
+        
+        cycles = {}
+        for index in self.cycles.iterkeys():
+            cycles[index] = Cycle()
+
+        for entry in self.functions.itervalues():
+            # populate the function
+            function = Function(entry.index, entry.name)
+            function[TIME] = entry.self
+            if entry.called is not None:
+                function.called = entry.called
+            if entry.called_self is not None:
+                call = Call(entry.index)
+                call[CALLS] = entry.called_self
+                function.called += entry.called_self
+            
+            # populate the function calls
+            for child in entry.children:
+                call = Call(child.index)
+                
+                assert child.called is not None
+                call[CALLS] = child.called
+
+                if child.index not in self.functions:
+                    # NOTE: functions that were never called but were discovered by gprof's 
+                    # static call graph analysis dont have a call graph entry so we need
+                    # to add them here
+                    missing = Function(child.index, child.name)
+                    function[TIME] = 0.0
+                    function.called = 0
+                    profile.add_function(missing)
+
+                function.add_call(call)
+
+            profile.add_function(function)
+
+            if entry.cycle is not None:
+                try:
+                    cycle = cycles[entry.cycle]
+                except KeyError:
+                    sys.stderr.write('warning: <cycle %u as a whole> entry missing\n' % entry.cycle) 
+                    cycle = Cycle()
+                    cycles[entry.cycle] = cycle
+                cycle.add_function(function)
+
+            profile[TIME] = profile[TIME] + function[TIME]
+
+        for cycle in cycles.itervalues():
+            profile.add_cycle(cycle)
+
+        # Compute derived events
+        profile.validate()
+        profile.ratio(TIME_RATIO, TIME)
+        profile.call_ratios(CALLS)
+        profile.integrate(TOTAL_TIME, TIME)
+        profile.ratio(TOTAL_TIME_RATIO, TOTAL_TIME)
+
+        return profile
+
+
+class CallgrindParser(LineParser):
+    """Parser for valgrind's callgrind tool.
+    
+    See also:
+    - http://valgrind.org/docs/manual/cl-format.html
+    """
+
+    _call_re = re.compile('^calls=\s*(\d+)\s+((\d+|\+\d+|-\d+|\*)\s+)+$')
+
+    def __init__(self, infile):
+        LineParser.__init__(self, infile)
+
+        # Textual positions
+        self.position_ids = {}
+        self.positions = {}
+
+        # Numeric positions
+        self.num_positions = 1
+        self.cost_positions = ['line']
+        self.last_positions = [0]
+
+        # Events
+        self.num_events = 0
+        self.cost_events = []
+
+        self.profile = Profile()
+        self.profile[SAMPLES] = 0
+
+    def parse(self):
+        # read lookahead
+        self.readline()
+
+        self.parse_key('version')
+        self.parse_key('creator')
+        self.parse_part()
+
+        # compute derived data
+        self.profile.validate()
+        self.profile.find_cycles()
+        self.profile.ratio(TIME_RATIO, SAMPLES)
+        self.profile.call_ratios(CALLS)
+        self.profile.integrate(TOTAL_TIME_RATIO, TIME_RATIO)
+
+        return self.profile
+
+    def parse_part(self):
+        while self.parse_header_line():
+            pass
+        while self.parse_body_line():
+            pass
+        if not self.eof() and False:
+            sys.stderr.write('warning: line %u: unexpected line\n' % self.line_no)
+            sys.stderr.write('%s\n' % self.lookahead())
+        return True
+
+    def parse_header_line(self):
+        return \
+            self.parse_empty() or \
+            self.parse_comment() or \
+            self.parse_part_detail() or \
+            self.parse_description() or \
+            self.parse_event_specification() or \
+            self.parse_cost_line_def() or \
+            self.parse_cost_summary()
+
+    _detail_keys = set(('cmd', 'pid', 'thread', 'part'))
+
+    def parse_part_detail(self):
+        return self.parse_keys(self._detail_keys)
+
+    def parse_description(self):
+        return self.parse_key('desc') is not None
+
+    def parse_event_specification(self):
+        event = self.parse_key('event')
+        if event is None:
+            return False
+        return True
+
+    def parse_cost_line_def(self):
+        pair = self.parse_keys(('events', 'positions'))
+        if pair is None:
+            return False
+        key, value = pair
+        items = value.split()
+        if key == 'events':
+            self.num_events = len(items)
+            self.cost_events = items
+        if key == 'positions':
+            self.num_positions = len(items)
+            self.cost_positions = items
+            self.last_positions = [0]*self.num_positions
+        return True
+
+    def parse_cost_summary(self):
+        pair = self.parse_keys(('summary', 'totals'))
+        if pair is None:
+            return False
+        return True
+
+    def parse_body_line(self):
+        return \
+            self.parse_empty() or \
+            self.parse_comment() or \
+            self.parse_cost_line() or \
+            self.parse_position_spec() or \
+            self.parse_association_spec()
+
+    __subpos_re = r'(0x[0-9a-fA-F]+|\d+|\+\d+|-\d+|\*)'
+    _cost_re = re.compile(r'^' + 
+        __subpos_re + r'( +' + __subpos_re + r')*' +
+        r'( +\d+)*' +
+    '$')
+
+    def parse_cost_line(self, calls=None):
+        line = self.lookahead().rstrip()
+        mo = self._cost_re.match(line)
+        if not mo:
+            return False
+
+        function = self.get_function()
+
+        values = line.split(' ')
+        assert len(values) <= self.num_positions + self.num_events
+
+        positions = values[0 : self.num_positions]
+        events = values[self.num_positions : ]
+        events += ['0']*(self.num_events - len(events))
+
+        for i in range(self.num_positions):
+            position = positions[i]
+            if position == '*':
+                position = self.last_positions[i]
+            elif position[0] in '-+':
+                position = self.last_positions[i] + int(position)
+            elif position.startswith('0x'):
+                position = int(position, 16)
+            else:
+                position = int(position)
+            self.last_positions[i] = position
+
+        events = map(float, events)
+
+        if calls is None:
+            function[SAMPLES] += events[0] 
+            self.profile[SAMPLES] += events[0]
+        else:
+            callee = self.get_callee()
+            callee.called += calls
+    
+            try:
+                call = function.calls[callee.id]
+            except KeyError:
+                call = Call(callee.id)
+                call[CALLS] = calls
+                call[SAMPLES] = events[0]
+                function.add_call(call)
+            else:
+                call[CALLS] += calls
+                call[SAMPLES] += events[0]
+
+        self.consume()
+        return True
+
+    def parse_association_spec(self):
+        line = self.lookahead()
+        if not line.startswith('calls='):
+            return False
+
+        _, values = line.split('=', 1)
+        values = values.strip().split()
+        calls = int(values[0])
+        call_position = values[1:]
+        self.consume()
+
+        self.parse_cost_line(calls)
+
+        return True
+
+    _position_re = re.compile('^(?P<position>[cj]?(?:ob|fl|fi|fe|fn))=\s*(?:\((?P<id>\d+)\))?(?:\s*(?P<name>.+))?')
+
+    _position_table_map = {
+        'ob': 'ob',
+        'fl': 'fl',
+        'fi': 'fl',
+        'fe': 'fl',
+        'fn': 'fn',
+        'cob': 'ob',
+        'cfl': 'fl',
+        'cfi': 'fl',
+        'cfe': 'fl',
+        'cfn': 'fn',
+        'jfi': 'fl',
+    }
+
+    _position_map = {
+        'ob': 'ob',
+        'fl': 'fl',
+        'fi': 'fl',
+        'fe': 'fl',
+        'fn': 'fn',
+        'cob': 'cob',
+        'cfl': 'cfl',
+        'cfi': 'cfl',
+        'cfe': 'cfl',
+        'cfn': 'cfn',
+        'jfi': 'jfi',
+    }
+
+    def parse_position_spec(self):
+        line = self.lookahead()
+        
+        if line.startswith('jump=') or line.startswith('jcnd='):
+            self.consume()
+            return True
+
+        mo = self._position_re.match(line)
+        if not mo:
+            return False
+
+        position, id, name = mo.groups()
+        if id:
+            table = self._position_table_map[position]
+            if name:
+                self.position_ids[(table, id)] = name
+            else:
+                name = self.position_ids.get((table, id), '')
+        self.positions[self._position_map[position]] = name
+
+        self.consume()
+        return True
+
+    def parse_empty(self):
+        if self.eof():
+            return False
+        line = self.lookahead()
+        if line.strip():
+            return False
+        self.consume()
+        return True
+
+    def parse_comment(self):
+        line = self.lookahead()
+        if not line.startswith('#'):
+            return False
+        self.consume()
+        return True
+
+    _key_re = re.compile(r'^(\w+):')
+
+    def parse_key(self, key):
+        pair = self.parse_keys((key,))
+        if not pair:
+            return None
+        key, value = pair
+        return value
+        line = self.lookahead()
+        mo = self._key_re.match(line)
+        if not mo:
+            return None
+        key, value = line.split(':', 1)
+        if key not in keys:
+            return None
+        value = value.strip()
+        self.consume()
+        return key, value
+
+    def parse_keys(self, keys):
+        line = self.lookahead()
+        mo = self._key_re.match(line)
+        if not mo:
+            return None
+        key, value = line.split(':', 1)
+        if key not in keys:
+            return None
+        value = value.strip()
+        self.consume()
+        return key, value
+
+    def make_function(self, module, filename, name):
+        # FIXME: module and filename are not being tracked reliably
+        #id = '|'.join((module, filename, name))
+        id = name
+        try:
+            function = self.profile.functions[id]
+        except KeyError:
+            function = Function(id, name)
+            function[SAMPLES] = 0
+            function.called = 0
+            self.profile.add_function(function)
+        return function
+
+    def get_function(self):
+        module = self.positions.get('ob', '')
+        filename = self.positions.get('fl', '') 
+        function = self.positions.get('fn', '') 
+        return self.make_function(module, filename, function)
+
+    def get_callee(self):
+        module = self.positions.get('cob', '')
+        filename = self.positions.get('cfi', '') 
+        function = self.positions.get('cfn', '') 
+        return self.make_function(module, filename, function)
+
+
+class OprofileParser(LineParser):
+    """Parser for oprofile callgraph output.
+    
+    See also:
+    - http://oprofile.sourceforge.net/doc/opreport.html#opreport-callgraph
+    """
+
+    _fields_re = {
+        'samples': r'(\d+)',
+        '%': r'(\S+)',
+        'linenr info': r'(?P<source>\(no location information\)|\S+:\d+)',
+        'image name': r'(?P<image>\S+(?:\s\(tgid:[^)]*\))?)',
+        'app name': r'(?P<application>\S+)',
+        'symbol name': r'(?P<symbol>\(no symbols\)|.+?)',
+    }
+
+    def __init__(self, infile):
+        LineParser.__init__(self, infile)
+        self.entries = {}
+        self.entry_re = None
+
+    def add_entry(self, callers, function, callees):
+        try:
+            entry = self.entries[function.id]
+        except KeyError:
+            self.entries[function.id] = (callers, function, callees)
+        else:
+            callers_total, function_total, callees_total = entry
+            self.update_subentries_dict(callers_total, callers)
+            function_total.samples += function.samples
+            self.update_subentries_dict(callees_total, callees)
+    
+    def update_subentries_dict(self, totals, partials):
+        for partial in partials.itervalues():
+            try:
+                total = totals[partial.id]
+            except KeyError:
+                totals[partial.id] = partial
+            else:
+                total.samples += partial.samples
+        
+    def parse(self):
+        # read lookahead
+        self.readline()
+
+        self.parse_header()
+        while self.lookahead():
+            self.parse_entry()
+
+        profile = Profile()
+
+        reverse_call_samples = {}
+        
+        # populate the profile
+        profile[SAMPLES] = 0
+        for _callers, _function, _callees in self.entries.itervalues():
+            function = Function(_function.id, _function.name)
+            function[SAMPLES] = _function.samples
+            profile.add_function(function)
+            profile[SAMPLES] += _function.samples
+
+            if _function.application:
+                function.process = os.path.basename(_function.application)
+            if _function.image:
+                function.module = os.path.basename(_function.image)
+
+            total_callee_samples = 0
+            for _callee in _callees.itervalues():
+                total_callee_samples += _callee.samples
+
+            for _callee in _callees.itervalues():
+                if not _callee.self:
+                    call = Call(_callee.id)
+                    call[SAMPLES2] = _callee.samples
+                    function.add_call(call)
+                
+        # compute derived data
+        profile.validate()
+        profile.find_cycles()
+        profile.ratio(TIME_RATIO, SAMPLES)
+        profile.call_ratios(SAMPLES2)
+        profile.integrate(TOTAL_TIME_RATIO, TIME_RATIO)
+
+        return profile
+
+    def parse_header(self):
+        while not self.match_header():
+            self.consume()
+        line = self.lookahead()
+        fields = re.split(r'\s\s+', line)
+        entry_re = r'^\s*' + r'\s+'.join([self._fields_re[field] for field in fields]) + r'(?P<self>\s+\[self\])?$'
+        self.entry_re = re.compile(entry_re)
+        self.skip_separator()
+
+    def parse_entry(self):
+        callers = self.parse_subentries()
+        if self.match_primary():
+            function = self.parse_subentry()
+            if function is not None:
+                callees = self.parse_subentries()
+                self.add_entry(callers, function, callees)
+        self.skip_separator()
+
+    def parse_subentries(self):
+        subentries = {}
+        while self.match_secondary():
+            subentry = self.parse_subentry()
+            subentries[subentry.id] = subentry
+        return subentries
+
+    def parse_subentry(self):
+        entry = Struct()
+        line = self.consume()
+        mo = self.entry_re.match(line)
+        if not mo:
+            raise ParseError('failed to parse', line)
+        fields = mo.groupdict()
+        entry.samples = int(mo.group(1))
+        if 'source' in fields and fields['source'] != '(no location information)':
+            source = fields['source']
+            filename, lineno = source.split(':')
+            entry.filename = filename
+            entry.lineno = int(lineno)
+        else:
+            source = ''
+            entry.filename = None
+            entry.lineno = None
+        entry.image = fields.get('image', '')
+        entry.application = fields.get('application', '')
+        if 'symbol' in fields and fields['symbol'] != '(no symbols)':
+            entry.symbol = fields['symbol']
+        else:
+            entry.symbol = ''
+        if entry.symbol.startswith('"') and entry.symbol.endswith('"'):
+            entry.symbol = entry.symbol[1:-1]
+        entry.id = ':'.join((entry.application, entry.image, source, entry.symbol))
+        entry.self = fields.get('self', None) != None
+        if entry.self:
+            entry.id += ':self'
+        if entry.symbol:
+            entry.name = entry.symbol
+        else:
+            entry.name = entry.image
+        return entry
+
+    def skip_separator(self):
+        while not self.match_separator():
+            self.consume()
+        self.consume()
+
+    def match_header(self):
+        line = self.lookahead()
+        return line.startswith('samples')
+
+    def match_separator(self):
+        line = self.lookahead()
+        return line == '-'*len(line)
+
+    def match_primary(self):
+        line = self.lookahead()
+        return not line[:1].isspace()
+    
+    def match_secondary(self):
+        line = self.lookahead()
+        return line[:1].isspace()
+
+
+class HProfParser(LineParser):
+    """Parser for java hprof output
+    
+    See also:
+    - http://java.sun.com/developer/technicalArticles/Programming/HPROF.html
+    """
+
+    trace_re = re.compile(r'\t(.*)\((.*):(.*)\)')
+    trace_id_re = re.compile(r'^TRACE (\d+):$')
+
+    def __init__(self, infile):
+        LineParser.__init__(self, infile)
+        self.traces = {}
+        self.samples = {}
+
+    def parse(self):
+        # read lookahead
+        self.readline()
+
+        while not self.lookahead().startswith('------'): self.consume()
+        while not self.lookahead().startswith('TRACE '): self.consume()
+
+        self.parse_traces()
+
+        while not self.lookahead().startswith('CPU'):
+            self.consume()
+
+        self.parse_samples()
+
+        # populate the profile
+        profile = Profile()
+        profile[SAMPLES] = 0
+
+        functions = {}
+
+        # build up callgraph
+        for id, trace in self.traces.iteritems():
+            if not id in self.samples: continue
+            mtime = self.samples[id][0]
+            last = None
+
+            for func, file, line in trace:
+                if not func in functions:
+                    function = Function(func, func)
+                    function[SAMPLES] = 0
+                    profile.add_function(function)
+                    functions[func] = function
+
+                function = functions[func]
+                # allocate time to the deepest method in the trace
+                if not last:
+                    function[SAMPLES] += mtime
+                    profile[SAMPLES] += mtime
+                else:
+                    c = function.get_call(last)
+                    c[SAMPLES2] += mtime
+
+                last = func
+
+        # compute derived data
+        profile.validate()
+        profile.find_cycles()
+        profile.ratio(TIME_RATIO, SAMPLES)
+        profile.call_ratios(SAMPLES2)
+        profile.integrate(TOTAL_TIME_RATIO, TIME_RATIO)
+
+        return profile
+
+    def parse_traces(self):
+        while self.lookahead().startswith('TRACE '):
+            self.parse_trace()
+
+    def parse_trace(self):
+        l = self.consume()
+        mo = self.trace_id_re.match(l)
+        tid = mo.group(1)
+        last = None
+        trace = []
+
+        while self.lookahead().startswith('\t'):
+            l = self.consume()
+            match = self.trace_re.search(l)
+            if not match:
+                #sys.stderr.write('Invalid line: %s\n' % l)
+                break
+            else:
+                function_name, file, line = match.groups()
+                trace += [(function_name, file, line)]
+
+        self.traces[int(tid)] = trace
+
+    def parse_samples(self):
+        self.consume()
+        self.consume()
+
+        while not self.lookahead().startswith('CPU'):
+            rank, percent_self, percent_accum, count, traceid, method = self.lookahead().split()
+            self.samples[int(traceid)] = (int(count), method)
+            self.consume()
+
+
+class SysprofParser(XmlParser):
+
+    def __init__(self, stream):
+        XmlParser.__init__(self, stream)
+
+    def parse(self):
+        objects = {}
+        nodes = {}
+
+        self.element_start('profile')
+        while self.token.type == XML_ELEMENT_START:
+            if self.token.name_or_data == 'objects':
+                assert not objects
+                objects = self.parse_items('objects')
+            elif self.token.name_or_data == 'nodes':
+                assert not nodes
+                nodes = self.parse_items('nodes')
+            else:
+                self.parse_value(self.token.name_or_data)
+        self.element_end('profile')
+
+        return self.build_profile(objects, nodes)
+
+    def parse_items(self, name):
+        assert name[-1] == 's'
+        items = {}
+        self.element_start(name)
+        while self.token.type == XML_ELEMENT_START:
+            id, values = self.parse_item(name[:-1])
+            assert id not in items
+            items[id] = values
+        self.element_end(name)
+        return items
+
+    def parse_item(self, name):
+        attrs = self.element_start(name)
+        id = int(attrs['id'])
+        values = self.parse_values()
+        self.element_end(name)
+        return id, values
+
+    def parse_values(self):
+        values = {}
+        while self.token.type == XML_ELEMENT_START:
+            name = self.token.name_or_data
+            value = self.parse_value(name)
+            assert name not in values
+            values[name] = value
+        return values
+
+    def parse_value(self, tag):
+        self.element_start(tag)
+        value = self.character_data()
+        self.element_end(tag)
+        if value.isdigit():
+            return int(value)
+        if value.startswith('"') and value.endswith('"'):
+            return value[1:-1]
+        return value
+
+    def build_profile(self, objects, nodes):
+        profile = Profile()
+        
+        profile[SAMPLES] = 0
+        for id, object in objects.iteritems():
+            # Ignore fake objects (process names, modules, "Everything", "kernel", etc.)
+            if object['self'] == 0:
+                continue
+
+            function = Function(id, object['name'])
+            function[SAMPLES] = object['self']
+            profile.add_function(function)
+            profile[SAMPLES] += function[SAMPLES]
+
+        for id, node in nodes.iteritems():
+            # Ignore fake calls
+            if node['self'] == 0:
+                continue
+
+            # Find a non-ignored parent
+            parent_id = node['parent']
+            while parent_id != 0:
+                parent = nodes[parent_id]
+                caller_id = parent['object']
+                if objects[caller_id]['self'] != 0:
+                    break
+                parent_id = parent['parent']
+            if parent_id == 0:
+                continue
+
+            callee_id = node['object']
+
+            assert objects[caller_id]['self']
+            assert objects[callee_id]['self']
+
+            function = profile.functions[caller_id]
+
+            samples = node['self']
+            try:
+                call = function.calls[callee_id]
+            except KeyError:
+                call = Call(callee_id)
+                call[SAMPLES2] = samples
+                function.add_call(call)
+            else:
+                call[SAMPLES2] += samples
+
+        # Compute derived events
+        profile.validate()
+        profile.find_cycles()
+        profile.ratio(TIME_RATIO, SAMPLES)
+        profile.call_ratios(SAMPLES2)
+        profile.integrate(TOTAL_TIME_RATIO, TIME_RATIO)
+
+        return profile
+
+
+class SharkParser(LineParser):
+    """Parser for MacOSX Shark output.
+
+    Author: tom at dbservice.com
+    """
+
+    def __init__(self, infile):
+        LineParser.__init__(self, infile)
+        self.stack = []
+        self.entries = {}
+
+    def add_entry(self, function):
+        try:
+            entry = self.entries[function.id]
+        except KeyError:
+            self.entries[function.id] = (function, { })
+        else:
+            function_total, callees_total = entry
+            function_total.samples += function.samples
+    
+    def add_callee(self, function, callee):
+        func, callees = self.entries[function.id]
+        try:
+            entry = callees[callee.id]
+        except KeyError:
+            callees[callee.id] = callee
+        else:
+            entry.samples += callee.samples
+        
+    def parse(self):
+        self.readline()
+        self.readline()
+        self.readline()
+        self.readline()
+
+        match = re.compile(r'(?P<prefix>[|+ ]*)(?P<samples>\d+), (?P<symbol>[^,]+), (?P<image>.*)')
+
+        while self.lookahead():
+            line = self.consume()
+            mo = match.match(line)
+            if not mo:
+                raise ParseError('failed to parse', line)
+
+            fields = mo.groupdict()
+            prefix = len(fields.get('prefix', 0)) / 2 - 1
+
+            symbol = str(fields.get('symbol', 0))
+            image = str(fields.get('image', 0))
+
+            entry = Struct()
+            entry.id = ':'.join([symbol, image])
+            entry.samples = int(fields.get('samples', 0))
+
+            entry.name = symbol
+            entry.image = image
+
+            # adjust the callstack
+            if prefix < len(self.stack):
+                del self.stack[prefix:]
+
+            if prefix == len(self.stack):
+                self.stack.append(entry)
+
+            # if the callstack has had an entry, it's this functions caller
+            if prefix > 0:
+                self.add_callee(self.stack[prefix - 1], entry)
+                
+            self.add_entry(entry)
+                
+        profile = Profile()
+        profile[SAMPLES] = 0
+        for _function, _callees in self.entries.itervalues():
+            function = Function(_function.id, _function.name)
+            function[SAMPLES] = _function.samples
+            profile.add_function(function)
+            profile[SAMPLES] += _function.samples
+
+            if _function.image:
+                function.module = os.path.basename(_function.image)
+
+            for _callee in _callees.itervalues():
+                call = Call(_callee.id)
+                call[SAMPLES] = _callee.samples
+                function.add_call(call)
+                
+        # compute derived data
+        profile.validate()
+        profile.find_cycles()
+        profile.ratio(TIME_RATIO, SAMPLES)
+        profile.call_ratios(SAMPLES)
+        profile.integrate(TOTAL_TIME_RATIO, TIME_RATIO)
+
+        return profile
+
+
+class XPerfParser(Parser):
+    """Parser for CSVs generted by XPerf, from Microsoft Windows Performance Tools.
+    """
+
+    def __init__(self, stream):
+        Parser.__init__(self)
+        self.stream = stream
+        self.profile = Profile()
+        self.profile[SAMPLES] = 0
+        self.column = {}
+
+    def parse(self):
+        import csv
+        reader = csv.reader(
+            self.stream, 
+            delimiter = ',',
+            quotechar = None,
+            escapechar = None,
+            doublequote = False,
+            skipinitialspace = True,
+            lineterminator = '\r\n',
+            quoting = csv.QUOTE_NONE)
+        it = iter(reader)
+        row = reader.next()
+        self.parse_header(row)
+        for row in it:
+            self.parse_row(row)
+                
+        # compute derived data
+        self.profile.validate()
+        self.profile.find_cycles()
+        self.profile.ratio(TIME_RATIO, SAMPLES)
+        self.profile.call_ratios(SAMPLES2)
+        self.profile.integrate(TOTAL_TIME_RATIO, TIME_RATIO)
+
+        return self.profile
+
+    def parse_header(self, row):
+        for column in range(len(row)):
+            name = row[column]
+            assert name not in self.column
+            self.column[name] = column
+
+    def parse_row(self, row):
+        fields = {}
+        for name, column in self.column.iteritems():
+            value = row[column]
+            for factory in int, float:
+                try:
+                    value = factory(value)
+                except ValueError:
+                    pass
+                else:
+                    break
+            fields[name] = value
+        
+        process = fields['Process Name']
+        symbol = fields['Module'] + '!' + fields['Function']
+        weight = fields['Weight']
+        count = fields['Count']
+
+        function = self.get_function(process, symbol)
+        function[SAMPLES] += weight * count
+        self.profile[SAMPLES] += weight * count
+
+        stack = fields['Stack']
+        if stack != '?':
+            stack = stack.split('/')
+            assert stack[0] == '[Root]'
+            if stack[-1] != symbol:
+                # XXX: some cases the sampled function does not appear in the stack
+                stack.append(symbol)
+            caller = None
+            for symbol in stack[1:]:
+                callee = self.get_function(process, symbol)
+                if caller is not None:
+                    try:
+                        call = caller.calls[callee.id]
+                    except KeyError:
+                        call = Call(callee.id)
+                        call[SAMPLES2] = count
+                        caller.add_call(call)
+                    else:
+                        call[SAMPLES2] += count
+                caller = callee
+
+    def get_function(self, process, symbol):
+        function_id = process + '!' + symbol
+
+        try:
+            function = self.profile.functions[function_id]
+        except KeyError:
+            module, name = symbol.split('!', 1)
+            function = Function(function_id, name)
+            function.process = process
+            function.module = module
+            function[SAMPLES] = 0
+            self.profile.add_function(function)
+
+        return function
+
+
+class SleepyParser(Parser):
+    """Parser for GNU gprof output.
+
+    See also:
+    - http://www.codersnotes.com/sleepy/
+    - http://sleepygraph.sourceforge.net/
+    """
+
+    def __init__(self, filename):
+        Parser.__init__(self)
+
+        from zipfile import ZipFile
+
+        self.database = ZipFile(filename)
+
+        self.symbols = {}
+        self.calls = {}
+
+        self.profile = Profile()
+    
+    _symbol_re = re.compile(
+        r'^(?P<id>\w+)' + 
+        r'\s+"(?P<module>[^"]*)"' + 
+        r'\s+"(?P<procname>[^"]*)"' + 
+        r'\s+"(?P<sourcefile>[^"]*)"' + 
+        r'\s+(?P<sourceline>\d+)$'
+    )
+
+    def parse_symbols(self):
+        lines = self.database.read('symbols.txt').splitlines()
+        for line in lines:
+            mo = self._symbol_re.match(line)
+            if mo:
+                symbol_id, module, procname, sourcefile, sourceline = mo.groups()
+    
+                function_id = ':'.join([module, procname])
+
+                try:
+                    function = self.profile.functions[function_id]
+                except KeyError:
+                    function = Function(function_id, procname)
+                    function.module = module
+                    function[SAMPLES] = 0
+                    self.profile.add_function(function)
+
+                self.symbols[symbol_id] = function
+
+    def parse_callstacks(self):
+        lines = self.database.read("callstacks.txt").splitlines()
+        for line in lines:
+            fields = line.split()
+            samples = int(fields[0])
+            callstack = fields[1:]
+
+            callstack = [self.symbols[symbol_id] for symbol_id in callstack]
+
+            callee = callstack[0]
+
+            callee[SAMPLES] += samples
+            self.profile[SAMPLES] += samples
+            
+            for caller in callstack[1:]:
+                try:
+                    call = caller.calls[callee.id]
+                except KeyError:
+                    call = Call(callee.id)
+                    call[SAMPLES2] = samples
+                    caller.add_call(call)
+                else:
+                    call[SAMPLES2] += samples
+
+                callee = caller
+
+    def parse(self):
+        profile = self.profile
+        profile[SAMPLES] = 0
+
+        self.parse_symbols()
+        self.parse_callstacks()
+
+        # Compute derived events
+        profile.validate()
+        profile.find_cycles()
+        profile.ratio(TIME_RATIO, SAMPLES)
+        profile.call_ratios(SAMPLES2)
+        profile.integrate(TOTAL_TIME_RATIO, TIME_RATIO)
+
+        return profile
+
+
+class AQtimeTable:
+
+    def __init__(self, name, fields):
+        self.name = name
+
+        self.fields = fields
+        self.field_column = {}
+        for column in range(len(fields)):
+            self.field_column[fields[column]] = column
+        self.rows = []
+
+    def __len__(self):
+        return len(self.rows)
+
+    def __iter__(self):
+        for values, children in self.rows:
+            fields = {}
+            for name, value in zip(self.fields, values):
+                fields[name] = value
+            children = dict([(child.name, child) for child in children])
+            yield fields, children
+        raise StopIteration
+
+    def add_row(self, values, children=()):
+        self.rows.append((values, children))
+
+
+class AQtimeParser(XmlParser):
+
+    def __init__(self, stream):
+        XmlParser.__init__(self, stream)
+        self.tables = {}
+
+    def parse(self):
+        self.element_start('AQtime_Results')
+        self.parse_headers()
+        results = self.parse_results()
+        self.element_end('AQtime_Results')
+        return self.build_profile(results) 
+
+    def parse_headers(self):
+        self.element_start('HEADERS')
+        while self.token.type == XML_ELEMENT_START:
+            self.parse_table_header()
+        self.element_end('HEADERS')
+
+    def parse_table_header(self):
+        attrs = self.element_start('TABLE_HEADER')
+        name = attrs['NAME']
+        id = int(attrs['ID'])
+        field_types = []
+        field_names = []
+        while self.token.type == XML_ELEMENT_START:
+            field_type, field_name = self.parse_table_field()
+            field_types.append(field_type)
+            field_names.append(field_name)
+        self.element_end('TABLE_HEADER')
+        self.tables[id] = name, field_types, field_names
+
+    def parse_table_field(self):
+        attrs = self.element_start('TABLE_FIELD')
+        type = attrs['TYPE']
+        name = self.character_data()
+        self.element_end('TABLE_FIELD')
+        return type, name
+
+    def parse_results(self):
+        self.element_start('RESULTS')
+        table = self.parse_data()
+        self.element_end('RESULTS')
+        return table
+
+    def parse_data(self):
+        rows = []
+        attrs = self.element_start('DATA')
+        table_id = int(attrs['TABLE_ID'])
+        table_name, field_types, field_names = self.tables[table_id]
+        table = AQtimeTable(table_name, field_names)
+        while self.token.type == XML_ELEMENT_START:
+            row, children = self.parse_row(field_types)
+            table.add_row(row, children)
+        self.element_end('DATA')
+        return table
+
+    def parse_row(self, field_types):
+        row = [None]*len(field_types)
+        children = []
+        self.element_start('ROW')
+        while self.token.type == XML_ELEMENT_START:
+            if self.token.name_or_data == 'FIELD':
+                field_id, field_value = self.parse_field(field_types)
+                row[field_id] = field_value
+            elif self.token.name_or_data == 'CHILDREN':
+                children = self.parse_children()
+            else:
+                raise XmlTokenMismatch("<FIELD ...> or <CHILDREN ...>", self.token)
+        self.element_end('ROW')
+        return row, children
+
+    def parse_field(self, field_types):
+        attrs = self.element_start('FIELD')
+        id = int(attrs['ID'])
+        type = field_types[id]
+        value = self.character_data()
+        if type == 'Integer':
+            value = int(value)
+        elif type == 'Float':
+            value = float(value)
+        elif type == 'Address':
+            value = int(value)
+        elif type == 'String':
+            pass
+        else:
+            assert False
+        self.element_end('FIELD')
+        return id, value
+
+    def parse_children(self):
+        children = []
+        self.element_start('CHILDREN')
+        while self.token.type == XML_ELEMENT_START:
+            table = self.parse_data()
+            assert table.name not in children
+            children.append(table)
+        self.element_end('CHILDREN')
+        return children
+
+    def build_profile(self, results):
+        assert results.name == 'Routines'
+        profile = Profile()
+        profile[TIME] = 0.0
+        for fields, tables in results:
+            function = self.build_function(fields)
+            children = tables['Children']
+            for fields, _ in children:
+                call = self.build_call(fields)
+                function.add_call(call)
+            profile.add_function(function)
+            profile[TIME] = profile[TIME] + function[TIME]
+        profile[TOTAL_TIME] = profile[TIME]
+        profile.ratio(TOTAL_TIME_RATIO, TOTAL_TIME)
+        return profile
+    
+    def build_function(self, fields):
+        function = Function(self.build_id(fields), self.build_name(fields))
+        function[TIME] = fields['Time']
+        function[TOTAL_TIME] = fields['Time with Children']
+        #function[TIME_RATIO] = fields['% Time']/100.0
+        #function[TOTAL_TIME_RATIO] = fields['% with Children']/100.0
+        return function
+
+    def build_call(self, fields):
+        call = Call(self.build_id(fields))
+        call[TIME] = fields['Time']
+        call[TOTAL_TIME] = fields['Time with Children']
+        #call[TIME_RATIO] = fields['% Time']/100.0
+        #call[TOTAL_TIME_RATIO] = fields['% with Children']/100.0
+        return call
+
+    def build_id(self, fields):
+        return ':'.join([fields['Module Name'], fields['Unit Name'], fields['Routine Name']])
+
+    def build_name(self, fields):
+        # TODO: use more fields
+        return fields['Routine Name']
+
+
+class PstatsParser:
+    """Parser python profiling statistics saved with te pstats module."""
+
+    def __init__(self, *filename):
+        import pstats
+        try:
+            self.stats = pstats.Stats(*filename)
+        except ValueError:
+            import hotshot.stats
+            self.stats = hotshot.stats.load(filename[0])
+        self.profile = Profile()
+        self.function_ids = {}
+
+    def get_function_name(self, (filename, line, name)):
+        module = os.path.splitext(filename)[0]
+        module = os.path.basename(module)
+        return "%s:%d:%s" % (module, line, name)
+
+    def get_function(self, key):
+        try:
+            id = self.function_ids[key]
+        except KeyError:
+            id = len(self.function_ids)
+            name = self.get_function_name(key)
+            function = Function(id, name)
+            self.profile.functions[id] = function
+            self.function_ids[key] = id
+        else:
+            function = self.profile.functions[id]
+        return function
+
+    def parse(self):
+        self.profile[TIME] = 0.0
+        self.profile[TOTAL_TIME] = self.stats.total_tt
+        for fn, (cc, nc, tt, ct, callers) in self.stats.stats.iteritems():
+            callee = self.get_function(fn)
+            callee.called = nc
+            callee[TOTAL_TIME] = ct
+            callee[TIME] = tt
+            self.profile[TIME] += tt
+            self.profile[TOTAL_TIME] = max(self.profile[TOTAL_TIME], ct)
+            for fn, value in callers.iteritems():
+                caller = self.get_function(fn)
+                call = Call(callee.id)
+                if isinstance(value, tuple):
+                    for i in xrange(0, len(value), 4):
+                        nc, cc, tt, ct = value[i:i+4]
+                        if CALLS in call:
+                            call[CALLS] += cc
+                        else:
+                            call[CALLS] = cc
+
+                        if TOTAL_TIME in call:
+                            call[TOTAL_TIME] += ct
+                        else:
+                            call[TOTAL_TIME] = ct
+
+                else:
+                    call[CALLS] = value
+                    call[TOTAL_TIME] = ratio(value, nc)*ct
+
+                caller.add_call(call)
+        #self.stats.print_stats()
+        #self.stats.print_callees()
+
+        # Compute derived events
+        self.profile.validate()
+        self.profile.ratio(TIME_RATIO, TIME)
+        self.profile.ratio(TOTAL_TIME_RATIO, TOTAL_TIME)
+
+        return self.profile
+
+
+class Theme:
+
+    def __init__(self, 
+            bgcolor = (0.0, 0.0, 1.0),
+            mincolor = (0.0, 0.0, 0.0),
+            maxcolor = (0.0, 0.0, 1.0),
+            fontname = "Arial",
+            minfontsize = 10.0,
+            maxfontsize = 10.0,
+            minpenwidth = 0.5,
+            maxpenwidth = 4.0,
+            gamma = 2.2,
+            skew = 1.0):
+        self.bgcolor = bgcolor
+        self.mincolor = mincolor
+        self.maxcolor = maxcolor
+        self.fontname = fontname
+        self.minfontsize = minfontsize
+        self.maxfontsize = maxfontsize
+        self.minpenwidth = minpenwidth
+        self.maxpenwidth = maxpenwidth
+        self.gamma = gamma
+        self.skew = skew
+
+    def graph_bgcolor(self):
+        return self.hsl_to_rgb(*self.bgcolor)
+
+    def graph_fontname(self):
+        return self.fontname
+
+    def graph_fontsize(self):
+        return self.minfontsize
+
+    def node_bgcolor(self, weight):
+        return self.color(weight)
+
+    def node_fgcolor(self, weight):
+        return self.graph_bgcolor()
+
+    def node_fontsize(self, weight):
+        return self.fontsize(weight)
+
+    def edge_color(self, weight):
+        return self.color(weight)
+
+    def edge_fontsize(self, weight):
+        return self.fontsize(weight)
+
+    def edge_penwidth(self, weight):
+        return max(weight*self.maxpenwidth, self.minpenwidth)
+
+    def edge_arrowsize(self, weight):
+        return 0.5 * math.sqrt(self.edge_penwidth(weight))
+
+    def fontsize(self, weight):
+        return max(weight**2 * self.maxfontsize, self.minfontsize)
+
+    def color(self, weight):
+        weight = min(max(weight, 0.0), 1.0)
+    
+        hmin, smin, lmin = self.mincolor
+        hmax, smax, lmax = self.maxcolor
+        
+        if self.skew < 0:
+            raise ValueError("Skew must be greater than 0")
+        elif self.skew == 1.0:
+            h = hmin + weight*(hmax - hmin)
+            s = smin + weight*(smax - smin)
+            l = lmin + weight*(lmax - lmin)
+        else:
+            base = self.skew
+            h = hmin + ((hmax-hmin)*(-1.0 + (base ** weight)) / (base - 1.0))
+            s = smin + ((smax-smin)*(-1.0 + (base ** weight)) / (base - 1.0))
+            l = lmin + ((lmax-lmin)*(-1.0 + (base ** weight)) / (base - 1.0))
+
+        return self.hsl_to_rgb(h, s, l)
+
+    def hsl_to_rgb(self, h, s, l):
+        """Convert a color from HSL color-model to RGB.
+
+        See also:
+        - http://www.w3.org/TR/css3-color/#hsl-color
+        """
+
+        h = h % 1.0
+        s = min(max(s, 0.0), 1.0)
+        l = min(max(l, 0.0), 1.0)
+
+        if l <= 0.5:
+            m2 = l*(s + 1.0)
+        else:
+            m2 = l + s - l*s
+        m1 = l*2.0 - m2
+        r = self._hue_to_rgb(m1, m2, h + 1.0/3.0)
+        g = self._hue_to_rgb(m1, m2, h)
+        b = self._hue_to_rgb(m1, m2, h - 1.0/3.0)
+
+        # Apply gamma correction
+        r **= self.gamma
+        g **= self.gamma
+        b **= self.gamma
+
+        return (r, g, b)
+
+    def _hue_to_rgb(self, m1, m2, h):
+        if h < 0.0:
+            h += 1.0
+        elif h > 1.0:
+            h -= 1.0
+        if h*6 < 1.0:
+            return m1 + (m2 - m1)*h*6.0
+        elif h*2 < 1.0:
+            return m2
+        elif h*3 < 2.0:
+            return m1 + (m2 - m1)*(2.0/3.0 - h)*6.0
+        else:
+            return m1
+
+
+TEMPERATURE_COLORMAP = Theme(
+    mincolor = (2.0/3.0, 0.80, 0.25), # dark blue
+    maxcolor = (0.0, 1.0, 0.5), # satured red
+    gamma = 1.0
+)
+
+PINK_COLORMAP = Theme(
+    mincolor = (0.0, 1.0, 0.90), # pink
+    maxcolor = (0.0, 1.0, 0.5), # satured red
+)
+
+GRAY_COLORMAP = Theme(
+    mincolor = (0.0, 0.0, 0.85), # light gray
+    maxcolor = (0.0, 0.0, 0.0), # black
+)
+
+BW_COLORMAP = Theme(
+    minfontsize = 8.0,
+    maxfontsize = 24.0,
+    mincolor = (0.0, 0.0, 0.0), # black
+    maxcolor = (0.0, 0.0, 0.0), # black
+    minpenwidth = 0.1,
+    maxpenwidth = 8.0,
+)
+
+
+class DotWriter:
+    """Writer for the DOT language.
+
+    See also:
+    - "The DOT Language" specification
+      http://www.graphviz.org/doc/info/lang.html
+    """
+
+    def __init__(self, fp):
+        self.fp = fp
+
+    def graph(self, profile, theme):
+        self.begin_graph()
+
+        fontname = theme.graph_fontname()
+
+        self.attr('graph', fontname=fontname, ranksep=0.25, nodesep=0.125)
+        self.attr('node', fontname=fontname, shape="box", style="filled", fontcolor="white", width=0, height=0)
+        self.attr('edge', fontname=fontname)
+
+        for function in profile.functions.itervalues():
+            labels = []
+            if function.process is not None:
+                labels.append(function.process)
+            if function.module is not None:
+                labels.append(function.module)
+            labels.append(function.name)
+            for event in TOTAL_TIME_RATIO, TIME_RATIO:
+                if event in function.events:
+                    label = event.format(function[event])
+                    labels.append(label)
+            if function.called is not None:
+                labels.append(u"%u\xd7" % (function.called,))
+
+            if function.weight is not None:
+                weight = function.weight
+            else:
+                weight = 0.0
+
+            label = '\n'.join(labels)
+            self.node(function.id, 
+                label = label, 
+                color = self.color(theme.node_bgcolor(weight)), 
+                fontcolor = self.color(theme.node_fgcolor(weight)), 
+                fontsize = "%.2f" % theme.node_fontsize(weight),
+            )
+
+            for call in function.calls.itervalues():
+                callee = profile.functions[call.callee_id]
+
+                labels = []
+                for event in TOTAL_TIME_RATIO, CALLS:
+                    if event in call.events:
+                        label = event.format(call[event])
+                        labels.append(label)
+
+                if call.weight is not None:
+                    weight = call.weight
+                elif callee.weight is not None:
+                    weight = callee.weight
+                else:
+                    weight = 0.0
+
+                label = '\n'.join(labels)
+
+                self.edge(function.id, call.callee_id, 
+                    label = label, 
+                    color = self.color(theme.edge_color(weight)), 
+                    fontcolor = self.color(theme.edge_color(weight)),
+                    fontsize = "%.2f" % theme.edge_fontsize(weight), 
+                    penwidth = "%.2f" % theme.edge_penwidth(weight), 
+                    labeldistance = "%.2f" % theme.edge_penwidth(weight), 
+                    arrowsize = "%.2f" % theme.edge_arrowsize(weight),
+                )
+
+        self.end_graph()
+
+    def begin_graph(self):
+        self.write('digraph {\n')
+
+    def end_graph(self):
+        self.write('}\n')
+
+    def attr(self, what, **attrs):
+        self.write("\t")
+        self.write(what)
+        self.attr_list(attrs)
+        self.write(";\n")
+
+    def node(self, node, **attrs):
+        self.write("\t")
+        self.id(node)
+        self.attr_list(attrs)
+        self.write(";\n")
+
+    def edge(self, src, dst, **attrs):
+        self.write("\t")
+        self.id(src)
+        self.write(" -> ")
+        self.id(dst)
+        self.attr_list(attrs)
+        self.write(";\n")
+
+    def attr_list(self, attrs):
+        if not attrs:
+            return
+        self.write(' [')
+        first = True
+        for name, value in attrs.iteritems():
+            if first:
+                first = False
+            else:
+                self.write(", ")
+            self.id(name)
+            self.write('=')
+            self.id(value)
+        self.write(']')
+
+    def id(self, id):
+        if isinstance(id, (int, float)):
+            s = str(id)
+        elif isinstance(id, basestring):
+            if id.isalnum() and not id.startswith('0x'):
+                s = id
+            else:
+                s = self.escape(id)
+        else:
+            raise TypeError
+        self.write(s)
+
+    def color(self, (r, g, b)):
+
+        def float2int(f):
+            if f <= 0.0:
+                return 0
+            if f >= 1.0:
+                return 255
+            return int(255.0*f + 0.5)
+
+        return "#" + "".join(["%02x" % float2int(c) for c in (r, g, b)])
+
+    def escape(self, s):
+        s = s.encode('utf-8')
+        s = s.replace('\\', r'\\')
+        s = s.replace('\n', r'\n')
+        s = s.replace('\t', r'\t')
+        s = s.replace('"', r'\"')
+        return '"' + s + '"'
+
+    def write(self, s):
+        self.fp.write(s)
+
+
+class Main:
+    """Main program."""
+
+    themes = {
+            "color": TEMPERATURE_COLORMAP,
+            "pink": PINK_COLORMAP,
+            "gray": GRAY_COLORMAP,
+            "bw": BW_COLORMAP,
+    }
+
+    def main(self):
+        """Main program."""
+
+        parser = optparse.OptionParser(
+            usage="\n\t%prog [options] [file] ...",
+            version="%%prog %s" % __version__)
+        parser.add_option(
+            '-o', '--output', metavar='FILE',
+            type="string", dest="output",
+            help="output filename [stdout]")
+        parser.add_option(
+            '-n', '--node-thres', metavar='PERCENTAGE',
+            type="float", dest="node_thres", default=0.5,
+            help="eliminate nodes below this threshold [default: %default]")
+        parser.add_option(
+            '-e', '--edge-thres', metavar='PERCENTAGE',
+            type="float", dest="edge_thres", default=0.1,
+            help="eliminate edges below this threshold [default: %default]")
+        parser.add_option(
+            '-f', '--format',
+            type="choice", choices=('prof', 'callgrind', 'oprofile', 'hprof', 'sysprof', 'pstats', 'shark', 'sleepy', 'aqtime', 'xperf'),
+            dest="format", default="prof",
+            help="profile format: prof, callgrind, oprofile, hprof, sysprof, shark, sleepy, aqtime, pstats, or xperf [default: %default]")
+        parser.add_option(
+            '-c', '--colormap',
+            type="choice", choices=('color', 'pink', 'gray', 'bw'),
+            dest="theme", default="color",
+            help="color map: color, pink, gray, or bw [default: %default]")
+        parser.add_option(
+            '-s', '--strip',
+            action="store_true",
+            dest="strip", default=False,
+            help="strip function parameters, template parameters, and const modifiers from demangled C++ function names")
+        parser.add_option(
+            '-w', '--wrap',
+            action="store_true",
+            dest="wrap", default=False,
+            help="wrap function names")
+        # add a new option to control skew of the colorization curve
+        parser.add_option(
+            '--skew',
+            type="float", dest="theme_skew", default=1.0,
+            help="skew the colorization curve.  Values < 1.0 give more variety to lower percentages.  Value > 1.0 give less variety to lower percentages")
+        (self.options, self.args) = parser.parse_args(sys.argv[1:])
+
+        if len(self.args) > 1 and self.options.format != 'pstats':
+            parser.error('incorrect number of arguments')
+
+        try:
+            self.theme = self.themes[self.options.theme]
+        except KeyError:
+            parser.error('invalid colormap \'%s\'' % self.options.theme)
+        
+        # set skew on the theme now that it has been picked.
+        if self.options.theme_skew:
+            self.theme.skew = self.options.theme_skew
+
+        if self.options.format == 'prof':
+            if not self.args:
+                fp = sys.stdin
+            else:
+                fp = open(self.args[0], 'rt')
+            parser = GprofParser(fp)
+        elif self.options.format == 'callgrind':
+            if not self.args:
+                fp = sys.stdin
+            else:
+                fp = open(self.args[0], 'rt')
+            parser = CallgrindParser(fp)
+        elif self.options.format == 'oprofile':
+            if not self.args:
+                fp = sys.stdin
+            else:
+                fp = open(self.args[0], 'rt')
+            parser = OprofileParser(fp)
+        elif self.options.format == 'sysprof':
+            if not self.args:
+                fp = sys.stdin
+            else:
+                fp = open(self.args[0], 'rt')
+            parser = SysprofParser(fp)
+        elif self.options.format == 'hprof':
+            if not self.args:
+                fp = sys.stdin
+            else:
+                fp = open(self.args[0], 'rt')
+            parser = HProfParser(fp)        
+        elif self.options.format == 'pstats':
+            if not self.args:
+                parser.error('at least a file must be specified for pstats input')
+            parser = PstatsParser(*self.args)
+        elif self.options.format == 'xperf':
+            if not self.args:
+                fp = sys.stdin
+            else:
+                fp = open(self.args[0], 'rt')
+            parser = XPerfParser(fp)
+        elif self.options.format == 'shark':
+            if not self.args:
+                fp = sys.stdin
+            else:
+                fp = open(self.args[0], 'rt')
+            parser = SharkParser(fp)
+        elif self.options.format == 'sleepy':
+            if len(self.args) != 1:
+                parser.error('exactly one file must be specified for sleepy input')
+            parser = SleepyParser(self.args[0])
+        elif self.options.format == 'aqtime':
+            if not self.args:
+                fp = sys.stdin
+            else:
+                fp = open(self.args[0], 'rt')
+            parser = AQtimeParser(fp)
+        else:
+            parser.error('invalid format \'%s\'' % self.options.format)
+
+        self.profile = parser.parse()
+        
+        if self.options.output is None:
+            self.output = sys.stdout
+        else:
+            self.output = open(self.options.output, 'wt')
+
+        self.write_graph()
+
+    _parenthesis_re = re.compile(r'\([^()]*\)')
+    _angles_re = re.compile(r'<[^<>]*>')
+    _const_re = re.compile(r'\s+const$')
+
+    def strip_function_name(self, name):
+        """Remove extraneous information from C++ demangled function names."""
+
+        # Strip function parameters from name by recursively removing paired parenthesis
+        while True:
+            name, n = self._parenthesis_re.subn('', name)
+            if not n:
+                break
+
+        # Strip const qualifier
+        name = self._const_re.sub('', name)
+
+        # Strip template parameters from name by recursively removing paired angles
+        while True:
+            name, n = self._angles_re.subn('', name)
+            if not n:
+                break
+
+        return name
+
+    def wrap_function_name(self, name):
+        """Split the function name on multiple lines."""
+
+        if len(name) > 32:
+            ratio = 2.0/3.0
+            height = max(int(len(name)/(1.0 - ratio) + 0.5), 1)
+            width = max(len(name)/height, 32)
+            # TODO: break lines in symbols
+            name = textwrap.fill(name, width, break_long_words=False)
+
+        # Take away spaces
+        name = name.replace(", ", ",")
+        name = name.replace("> >", ">>")
+        name = name.replace("> >", ">>") # catch consecutive
+
+        return name
+
+    def compress_function_name(self, name):
+        """Compress function name according to the user preferences."""
+
+        if self.options.strip:
+            name = self.strip_function_name(name)
+
+        if self.options.wrap:
+            name = self.wrap_function_name(name)
+
+        # TODO: merge functions with same resulting name
+
+        return name
+
+    def write_graph(self):
+        dot = DotWriter(self.output)
+        profile = self.profile
+        profile.prune(self.options.node_thres/100.0, self.options.edge_thres/100.0)
+
+        for function in profile.functions.itervalues():
+            function.name = self.compress_function_name(function.name)
+
+        dot.graph(profile, self.theme)
+
+
+if __name__ == '__main__':
+    Main().main()
diff --git a/build/ld.linux.cmn.sh b/build/ld.linux.cmn.sh
old mode 100755
new mode 100644
diff --git a/build/ld.linux.dlib.sh b/build/ld.linux.dlib.sh
index 4621a98..6ed1c48 100755
--- a/build/ld.linux.dlib.sh
+++ b/build/ld.linux.dlib.sh
@@ -275,9 +275,12 @@ then
 fi
 
 # add in xml
-if [ $HAVE_XML -ne 0 ]
-then
-    CMD="$CMD -lxml2"
+grep HAVE_XML2 ${BUILD_DIR}/Makefile.config.linux.$ARCH
+if [ $? -eq 0 ]
+    if [ $HAVE_XML -ne 0 ]
+    then
+        CMD="$CMD -lxml2"
+    fi
 fi
 
 # add in math library
diff --git a/build/ld.linux.exe.sh b/build/ld.linux.exe.sh
index ff5b83f..34f370f 100755
--- a/build/ld.linux.exe.sh
+++ b/build/ld.linux.exe.sh
@@ -289,12 +289,11 @@ then
 fi
 
 # add in xml
-if [ $HAVE_XML -ne 0 ]
-then
-    if [ "$NCBI" != "" ] && [ -f "$NCBI/libxml/lib/libxml2-static.a" ]
+grep HAVE_XML2 ${BUILD_DIR}/Makefile.config.linux.$ARCH
+if [ $? -eq 0 ]
+    then
+    if [ $HAVE_XML -ne 0 ]
     then
-        CMD="$CMD -L$NCBI/libxml/lib -lxml2-static"
-    else
         CMD="$CMD -lxml2"
     fi
 fi
diff --git a/build/ld.mac.clang.sh b/build/ld.mac.clang.sh
new file mode 100755
index 0000000..c145942
--- /dev/null
+++ b/build/ld.mac.clang.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+# define linker params
+LD_EXPORT_GLOBAL="-Wl,-all_load"
+LD_MULTIPLE_DEFS=""
+LD_STATIC=""
+LD_DYNAMIC=""
+LD_ALL_SYMBOLS=""
+LD_REF_SYMBOLS=""
+
+# the Mac is set up for cross-compilation
+LD="$LD -Wl,-arch,$ARCH"
+
+# build command
+DLIB_CMD="$LD -dynamiclib"
+EXE_CMD="$LD"
+
+# Mach install-name sans extension
+INSTNAME="@executable_path/../lib/$NAME$DBGAP"
+
+# versioned output
+if [ "$VERS" = "" ]
+then
+    DLIB_CMD="$DLIB_CMD -o $TARG -install_name $INSTNAME.dylib"
+    EXE_CMD="$EXE_CMD -o $TARG"
+else
+    set-vers $(echo $VERS | tr '.' ' ')
+    DLIB_CMD="$DLIB_CMD -o $OUTDIR/$NAME$DBGAP.$VERS.dylib -install_name $INSTNAME.$VERS.dylib -compatibility_version $MAJ -current_version $VERS -flat_namespace -undefined suppress"
+    EXE_CMD="$EXE_CMD -o $OUTDIR/$NAME$DBGAP.$VERS"
+fi
diff --git a/build/ld.mac.cmn.sh b/build/ld.mac.cmn.sh
old mode 100755
new mode 100644
diff --git a/build/ld.mac.dlib.sh b/build/ld.mac.dlib.sh
index d194ff8..a990020 100755
--- a/build/ld.mac.dlib.sh
+++ b/build/ld.mac.dlib.sh
@@ -49,8 +49,8 @@ case "$LD" in
 g*)
     source "${0%dlib.sh}gcc.sh"
     ;;
-i*)
-    source "${0%dlib.sh}icc.sh"
+c*)
+    source "${0%dlib.sh}clang.sh"
     ;;
  *)
     echo "$SELF_NAME: unrecognized ld tool - '$LD'"
diff --git a/build/ld.mac.exe.sh b/build/ld.mac.exe.sh
index b693034..a1d182a 100755
--- a/build/ld.mac.exe.sh
+++ b/build/ld.mac.exe.sh
@@ -50,8 +50,8 @@ case "$LD" in
 g*)
     source "${0%exe.sh}gcc.sh"
     ;;
-i*)
-    source "${0%exe.sh}icc.sh"
+c*)
+    source "${0%exe.sh}clang.sh"
     ;;
 *)
     echo "$SELF_NAME: unrecognized ld tool - '$LD'"
@@ -319,12 +319,7 @@ fi
 # add in xml
 if [ $HAVE_XML -ne 0 ]
 then
-#    if [ "$NCBI" != "" ] && [ -f "$NCBI/libxml/lib/libxml2-static.a" ]
-#    then
-#        CMD="$CMD -L$NCBI/libxml/lib -lxml2-static"
-#    else
-        CMD="$CMD -lxml2"
-#    fi
+    CMD="$CMD -lxml2"
 fi
 
 # add in math library
diff --git a/build/ld.rwin.dlib.sh b/build/ld.rwin.dlib.sh
new file mode 100755
index 0000000..9dbaa4f
--- /dev/null
+++ b/build/ld.rwin.dlib.sh
@@ -0,0 +1,363 @@
+#!/bin/bash
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+#echo "$0 $*"
+
+# ===========================================================================
+# input library types, and their handling
+#
+#  normal linkage
+#   -l : find shared or static
+#   -s : require static
+#   -d : require shared
+#
+#  static linkage
+#   -l : require static
+#   -s : require static
+#   -d : ignore
+# ===========================================================================
+
+# script name
+SELF_NAME="$(basename $0)"
+
+# parameters and common functions
+source "${0%rwin.dlib.sh}win.cmn.sh"
+
+# discover tool chain
+case "$LD" in
+link)
+    source "${0%dlib.sh}vc++.sh"
+    ;;
+ *)
+    echo "$SELF_NAME: unrecognized ld tool - '$LD'"
+    exit 5
+esac
+
+# DLIB_CMD was started in tool-specific source
+CMD="$DLIB_CMD $LDFLAGS OLE32.lib Ws2_32.lib Shell32.lib /FORCE"
+STATIC_CMD="$SLIB_CMD"
+
+# function to convert static libraries to individual COFF files
+convert-static ()
+{
+    # list members
+    local path="$1"
+    local mbrs="$(ar -t $path)"
+
+    # create sub directory
+    rm -rf "$2" && mkdir "$2"
+    if ! cd "$2"
+    then
+        echo "$SELF_NAME: failed to cd to $2"
+        exit 5
+    fi
+    ar -x "$path"
+
+    # add source files to link
+    local m=
+    for m in $mbrs
+    do
+        CMD="$CMD $2/$m"
+        STATIC_CMD="$STATIC_CMD $2/$m"
+    done
+
+    # return to prior location
+    cd - > /dev/null
+}
+
+# tack on object files
+CMD="$CMD $OBJS"
+STATIC_CMD="$STATIC_CMD $OBJS"
+
+# initial dependency upon Makefile and vers file
+DEPS="$SRCDIR/Makefile $DEF_FILE"
+if [ "$LIBS" != "" ]
+then
+    # tack on paths
+    DIRS="$LDIRS:$XDIRS"
+    while [ "$DIRS" != "" ]
+    do
+        DIR="${DIRS%%:*}"
+        CURDIR="$RHOME/${DIR#$LHOME}"
+        CURDIR="$(echo $CURDIR | tr '/' '\\')"        
+        [ "$CURDIR" != "" ] && CMD="$CMD /LIBPATH:$CURDIR"
+        DIRS="${DIRS#$DIR}"
+        DIRS="${DIRS#:}"
+    done
+
+    HAVE_KERNEL32=0
+    HAVE_CLIB=0
+    
+    # tack on libraries, finding as we go
+    for xLIB in $LIBS
+    do
+        # strip off switch
+        xLIBNAME="${xLIB#-[lsd]}"
+
+        # map xLIBNAME
+        case "$xLIBNAME" in
+        
+        # redirect libdl to link against Kernel32.lib in case of windows
+        dl)
+            if [ $HAVE_KERNEL32 -ne 1 ]
+            then
+                load-ref-symbols
+                load-dynamic
+                CMD="$CMD Kernel32.lib"
+                HAVE_KERNEL32=1
+            fi
+            continue
+            ;;
+
+        # redirect libm to link against libc.lib in case of windows
+        # omitting the lib defaults to linking against libc.lib
+        m)
+            if [ $HAVE_CLIB -ne 1 ]
+            then
+                load-ref-symbols
+                load-dynamic
+                HAVE_CLIB=1
+            fi
+            continue
+            ;;
+
+##### TEMPORARY #####
+# use ksproc for kproc
+#    kproc)
+#        xLIBNAME=ksproc
+#        ;;
+#####################
+
+        esac
+
+        # look at linkage
+        case "$xLIB" in
+        -l*)
+
+            # normal or dynamic linkage
+            FOUND=0
+            if [ $STATIC -eq 0 ]
+            then
+                find-lib $xLIBNAME.lib $LDIRS
+                if [ "$xLIBPATH" != "" ]
+                then
+
+                    # found it
+                    FOUND=1
+
+                    # load normally
+                    load-ref-symbols
+                    load-dynamic
+                    CMD="$CMD lib$xLIBNAME.lib"
+
+                fi
+            fi
+
+            # try static only
+            if [ $FOUND -eq 0 ]
+            then
+                find-lib $xLIBNAME.a $LDIRS
+                if [ "$xLIBPATH" != "" ]
+                then
+
+                    # found it
+                    FOUND=1
+
+                    # add it to dependencies
+                    DEPS="$DEPS $xLIBPATH"
+
+                    # load static
+                    load-static
+                    load-all-symbols
+                    convert-static "$xLIBPATH" "lib$xLIBNAME"
+
+                fi
+            fi
+
+            # not found within our directories
+            if [ $FOUND -eq 0 ]
+            then
+                # set load to normal
+                load-ref-symbols
+                load-dynamic
+                CMD="$CMD lib$xLIBNAME.lib"
+            fi
+            ;;
+
+        -s*)
+
+            # force static load
+            FOUND=0
+            find-lib $xLIBNAME.a $LDIRS
+            if [ "$xLIBPATH" != "" ]
+            then
+                # found it
+                FOUND=1
+
+                # add it to dependencies
+                DEPS="$DEPS $xLIBPATH"
+
+                # load static
+                load-static
+                load-all-symbols
+                convert-static "$xLIBPATH" "lib$xLIBNAME"
+
+            fi
+
+            # not found within our directories
+            if [ $FOUND -eq 0 ]
+            then
+                # set load to static
+                load-static
+                load-all-symbols
+                CMD="$CMD lib$xLIBNAME.lib"
+            fi
+            ;;
+
+        -d*)
+
+            # only dynamic linkage
+            FOUND=0
+            if [ $STATIC -eq 0 ]
+            then
+                find-lib $xLIBNAME.lib $LDIRS
+                if [ "$xLIBPATH" != "" ]
+                then
+
+                    # found it
+                    FOUND=1
+
+                    # load normally
+                    load-ref-symbols
+                    load-dynamic
+                    CMD="$CMD lib$xLIBNAME.lib"
+
+                fi
+            fi
+
+            # try static if performing static build
+            # because we HAVE to link against something,
+            # and the dependency code is being statically
+            # linked into an executable...
+            if [ $FOUND -eq 0 ] && [ $STATIC -eq 1 ]
+            then
+                find-lib $xLIBNAME.a $LDIRS
+                if [ "$xLIBPATH" != "" ]
+                then
+
+                    # found it
+                    FOUND=1
+
+                    # add it to dependencies
+                    DEPS="$DEPS $xLIBPATH"
+
+                    # load static
+                    load-static
+                    load-all-symbols
+                    convert-static "$xLIBPATH" "lib$xLIBNAME"
+
+                fi
+            fi
+
+            # not found within our directories
+            if [ $FOUND -eq 0 ]
+            then
+                # set load to normal
+                load-ref-symbols
+                load-dynamic
+                CMD="$CMD lib$xLIBNAME.lib"
+            fi
+            ;;
+
+        esac
+
+    done
+fi
+
+# put state back to normal
+load-ref-symbols
+load-dynamic
+
+# produce shared library, stub library and exp file
+# map to remote view
+CURDIR="$(pwd)"
+echo $CMD
+rm -f $TARG ${TARG%lib}def ${TARG%lib}pdb "$BINDIR/${TARG%lib}dll"
+
+# Windows linker crashes randomly on bigger files with rc=1000, so we will loop until it completes differently
+while [ 1 ]
+do
+    ${TOP}/build/run_remotely.sh $PROXY_TOOL $RHOST $RPORT $RHOME $LHOME $CURDIR $ROUTDIR $LOUTDIR $CMD >${TARG}.out
+    STATUS=$?
+    cat ${TARG}.out
+    if [ "$STATUS" != "0" ]
+    then 
+        grep "fatal error LNK1000" ${TARG}.out >/dev/null
+        if [ "$?" != "0" ] 
+        then 
+            rm -f "$TARG" "${TARG%lib}dll"
+            exit $STATUS
+        fi
+    else
+        rm -rf ${TARG}.out
+        break
+    fi
+    sleep 30s
+done    
+
+# wait for the result file to appear (there may be a network delay)
+${TOP}/build/wait_for_file.sh "${TARG%lib}dll"
+STATUS=$?
+if [ "$STATUS" = "1" ]
+then
+    echo "timed out, TARG='${TARG%lib}dll'"
+    exit $STATUS
+fi
+        
+# copy dll to binary directory, so they can be found by the executables
+# sometimes cp reports an input/output error; try until it succeeds
+while [ 1 ]
+do
+    cp "${TARG%lib}dll" "$BINDIR"
+    STATUS=$?
+    if [ "$STATUS" == "0" ]
+    then
+        break
+    fi
+    echo "waiting for ${TARG%lib}dll to become accessible"
+    ls -l "${TARG%lib}dll"
+    sleep 30s
+done
+
+# produce dependencies
+if [ "$DEPFILE" != "" ]
+then
+    echo "$TARG: $DEPS" > "$DEPFILE"
+fi
+
+# produce static library using lib
+STATIC_CMD="${TOP}/build/run_remotely.sh $PROXY_TOOL $RHOST $RPORT $RHOME $LHOME $CURDIR $ROUTDIR $LOUTDIR $STATIC_CMD"
+echo "$STATIC_CMD"
+$STATIC_CMD || exit $?
+
diff --git a/build/ld.rwin.exe.sh b/build/ld.rwin.exe.sh
new file mode 100755
index 0000000..ce75f94
--- /dev/null
+++ b/build/ld.rwin.exe.sh
@@ -0,0 +1,366 @@
+#!/bin/bash
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+if [ "$VERBOSE" != "" ] ; then echo "$0 $*"; fi
+
+# ===========================================================================
+# input library types, and their handling
+#
+#  normal linkage
+#   -l : find shared or static
+#   -s : require static
+#   -d : ignore - will be dynamically loaded
+#
+#  static linkage
+#   -l : require static
+#   -s : require static
+#   -d : require static
+# ===========================================================================
+
+# script name
+SELF_NAME="$(basename $0)"
+
+# parameters and common functions
+source "${0%rwin.exe.sh}win.cmn.sh"
+
+# discover tool chain
+case "$LD" in
+link)
+    source "${0%exe.sh}vc++.sh"
+    ;;
+*)
+    echo "$SELF_NAME: unrecognized ld tool - '$LD'"
+    exit 5
+esac
+
+#echo "EXE_CMD=${EXE_CMD}"
+
+# EXE_CMD was started in tool-specific source
+CMD="$EXE_CMD $LDFLAGS OLE32.lib Ws2_32.lib Shell32.lib"
+
+# if building a static executable against dynamic libraries
+# the main application will substitute for name lookup
+if [ $STATIC -eq 1 ] && [ $DYLD -eq 1 ]
+then
+    CMD="$CMD $LD_EXPORT_GLOBAL $LD_MULTIPLE_DEFS"
+fi
+
+# function to convert static libraries to individual COFF files
+convert-static ()
+{
+    # list members
+    local path="$1"
+    local mbrs="$(ar -t $path)"
+
+    # create sub directory
+    rm -rf "$2" && mkdir "$2"
+    if ! cd "$2"
+    then
+        echo "$SELF_NAME: failed to cd to $2"
+        exit 5
+    fi
+    ar -x "$path"
+
+    # add source files to link
+    local m=
+    for m in $mbrs
+    do
+        CMD="$CMD $2/$m"
+    done
+
+    # return to prior location
+    cd - > /dev/null
+}
+
+# tack on object files
+CMD="$CMD $OBJS"
+
+# initial dependency upon Makefile - no vers file on Windows
+DEPS="$SRCDIR/Makefile"
+if [ "$LIBS" != "" ]
+then
+    # tack on paths
+    DIRS="$LDIRS:$XDIRS"
+
+    while [ "$DIRS" != "" ]
+    do
+        DIR="${DIRS%%:*}"
+        CURDIR="$RHOME/${DIR#$LHOME}"
+        CURDIR="$(echo $CURDIR | tr '/' '\\')"        
+        [ "$CURDIR" != "" ] && CMD="$CMD /LIBPATH:$CURDIR"        
+        DIRS="${DIRS#$DIR}"
+        DIRS="${DIRS#:}"
+    done
+    
+    HAVE_KERNEL32=0
+    HAVE_WS2=1
+    HAVE_CLIB=0
+
+    # tack on libraries, finding as we go
+    for xLIB in $LIBS
+    do
+
+        # strip off switch
+        xLIBNAME="${xLIB#-[lsd]}"
+
+        # map xLIBNAME
+        case "$xLIBNAME" in
+        dl)
+            if [ $HAVE_KERNEL32 -ne 1 ]
+            then
+                load-ref-symbols
+                load-dynamic
+                CMD="$CMD Kernel32.lib"
+                HAVE_KERNEL32=1
+            fi
+            continue
+            ;;
+
+        ws2)
+            if [ $HAVE_WS2 -ne 1 ]
+            then
+                load-ref-symbols
+                load-dynamic
+                CMD="$CMD ws2_32.lib"
+                HAVE_WS2=1
+            fi
+            continue
+            ;;
+
+        # redirect libm to link against libc.lib in case of windows
+        # omitting the lib defaults to linking against libc.lib
+        m)
+            if [ $HAVE_CLIB -ne 1 ]
+            then
+                load-ref-symbols
+                load-dynamic
+                HAVE_CLIB=1
+            fi
+            continue
+            ;;
+
+##### TEMPORARY #####
+# use ksproc for kproc
+#    kproc)
+#        xLIBNAME=ksproc
+#        ;;
+#####################
+        esac
+
+        # look at linkage
+        case "$xLIB" in
+        -l*)
+
+            # normal or dynamic linkage
+            FOUND=0
+            if [ $STATIC -eq 0 ]
+            then
+                find-lib $xLIBNAME.lib $LDIRS
+                if [ "$xLIBPATH" != "" ]
+                then
+
+                    # found it
+                    FOUND=1
+
+                    # load dynamic
+                    load-dynamic
+                    CMD="$CMD lib$xLIBNAME.lib"
+
+                fi
+            fi
+
+            # try static only
+            if [ $FOUND -eq 0 ]
+            then
+                find-lib $xLIBNAME.a $LDIRS
+                if [ "$xLIBPATH" != "" ]
+                then
+
+                    # found it
+                    FOUND=1
+
+                    # add it to dependencies
+                    DEPS="$DEPS $xLIBPATH"
+
+                    # load static
+                    load-static
+                    [ $STATIC -eq 1 ] && load-all-symbols
+                    convert-static "$xLIBPATH" "lib$xLIBNAME"
+
+                fi
+            fi
+
+            # not found within our directories
+            if [ $FOUND -eq 0 ]
+            then
+                [ $STATIC -eq 1 ] && load-ref-symbols
+                load-dynamic
+                CMD="$CMD lib$xLIBNAME.lib"
+            fi
+            ;;
+
+        -s*)
+
+            # force static load
+            FOUND=0
+            find-lib $xLIBNAME.a $LDIRS
+            if [ "$xLIBPATH" != "" ]
+            then
+
+                # found it
+                FOUND=1
+
+                # add it to dependencies
+                DEPS="$DEPS $xLIBPATH"
+
+                # load static
+                load-static
+                [ $STATIC -eq 1 ] && load-all-symbols
+                convert-static "$xLIBPATH" "lib$xLIBNAME"
+
+            fi
+
+            # not found within our directories
+            if [ $FOUND -eq 0 ]
+            then
+                # set load to static
+                load-static
+                [ $STATIC -eq 1 ] && load-all-symbols
+                CMD="$CMD lib$xLIBNAME.lib"
+            fi
+            ;;
+
+        -d*)
+
+            FOUND=0
+            if [ $STATIC -eq 1 ]
+            then
+                find-lib $xLIBNAME.a $LDIRS
+                if [ "$xLIBPATH" != "" ]
+                then
+
+                    # found it
+                    FOUND=1
+
+                    # add it to dependencies
+                    DEPS="$DEPS $xLIBPATH"
+
+                    # load static
+                    load-static
+                    load-all-symbols
+                    convert-static "$xLIBPATH" "lib$xLIBNAME"
+
+                fi
+
+                # not found within our directories
+                if [ $FOUND -eq 0 ]
+                then
+                    load-static
+                    load-all-symbols
+
+                    CMD="$CMD lib$xLIBNAME"
+                fi
+            fi
+            ;;
+
+
+        esac
+
+    done
+fi
+
+# return to normal
+load-ref-symbols
+load-dynamic
+
+# determine current directory
+CURDIR="$(pwd)"
+
+# produce executable
+rm -f ${TARG%exe}*
+
+echo $CMD
+
+# Windows linker crashes randomly on bigger files with rc=1000, so we will loop until it completes differently
+while [ 1 ]
+do
+    ${TOP}/build/run_remotely.sh $PROXY_TOOL $RHOST $RPORT $RHOME $LHOME $CURDIR $ROUTDIR $LOUTDIR $CMD >${TARG}.out
+    STATUS=$?
+    cat ${TARG}.out
+    if [ "$STATUS" != "0" ]
+    then 
+        grep "fatal error LNK1000" ${TARG}.out >/dev/null
+        if [ "$?" != "0" ] 
+        then 
+            exit $STATUS
+        fi
+    else
+        rm ${TARG}.out
+        break
+    fi
+    sleep 30s
+done    
+
+# wait for the result file to appear (there may be a network delay)
+${TOP}/build/wait_for_file.sh ${TARG}.exe
+STATUS=$?
+if [ "$STATUS" = "1" ]
+then
+    echo "timed out, TARG='$TARG'"
+    exit $STATUS
+fi
+
+# create a link without .exe which represents make's target
+test -e ${TARG} || ln -s ${TARG}.exe ${TARG}
+
+# produce dependencies
+if [ "$DEPFILE" != "" ]
+then
+    echo "$TARG: $DEPS" > "$DEPFILE"
+fi
+
+# cleanup temporary files
+rm -f $TARG.lib $TARG.exp
+
+
+# wait for the result file to appear (there may be a network delay)
+${TOP}/build/wait_for_file.sh ${TARG}.exe
+STATUS=$?
+if [ "$STATUS" = "1" ]
+then
+    echo "timed out, TARG='$TARG'"
+    exit $STATUS
+fi
+
+# create a link without .exe which represents make's target
+test -e ${TARG} || ln -s ${TARG}.exe ${TARG}
+
+# produce dependencies
+if [ "$DEPFILE" != "" ]
+then
+    echo "$TARG: $DEPS" > "$DEPFILE"
+fi
+
+# cleanup temporary files
+rm -f $TARG.lib $TARG.exp
diff --git a/build/ld.rwin.slib.sh b/build/ld.rwin.slib.sh
new file mode 100755
index 0000000..00b0949
--- /dev/null
+++ b/build/ld.rwin.slib.sh
@@ -0,0 +1,123 @@
+#!/bin/bash
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+VERBOSE=
+if [ "$VERBOSE" != "" ] ; then echo "$0 $*"; fi
+
+# ===========================================================================
+# input library types, and their handling
+#
+#  normal or static linkage
+#   -l : require static
+#   -s : require static
+#   -d : ignore
+# ===========================================================================
+
+# script name
+SELF_NAME="$(basename $0)"
+
+# parameters and common functions
+source "${0%rwin.slib.sh}win.cmn.sh"
+
+# initialize command
+CMD="ar -rc"
+
+# function to convert an archive into individual object files
+convert-static ()
+{
+    # list members
+    local path="$1"
+    local mbrs="$(ar -t $path)"
+
+    # unpack archive into temporary directory
+    mkdir -p ld-tmp
+    if ! cd ld-tmp
+    then
+        echo "$SELF_NAME: failed to cd to ld-tmp"
+        exit 5
+    fi
+    ar -x "$path"
+
+    # rename and add to source files list
+    local m=
+    for m in $mbrs
+    do
+        mv $m $xLIBNAME-$m
+        CMD="$CMD ld-tmp/$xLIBNAME-$m"
+    done
+
+    # return to prior location
+    cd - > /dev/null
+}
+
+CMD="$CMD $TARG $OBJS"
+
+# initial dependency upon Makefile and vers file
+DEPS="$SRCDIR/Makefile"
+if [ "$LIBS" != "" ]
+then
+    # tack on libraries, finding as we go
+    for xLIB in $LIBS
+    do
+        # strip off switch
+        xLIBNAME="${xLIB#-[lsd]}"
+
+        # look at linkage
+        case "$xLIB" in
+        -s*)
+
+            # force static load
+            find-lib $xLIBNAME.a $LDIRS # .a for static, .lib for dynamic?
+            if [ "$xLIBPATH" != "" ]
+            then
+
+                # add it to dependencies
+                DEPS="$DEPS $xLIBPATH"
+
+                # convert to individual object files
+                convert-static "$xLIBPATH" || exit $?
+
+            fi
+            ;;
+
+        esac
+    done
+fi
+
+# produce static library
+rm -f $TARG
+echo $CMD
+
+$CMD || exit $?
+
+# remove temporaries
+rm -rf ld-tmp
+
+# produce dependencies
+if [ "$DEPFILE" != "" ] && [ "$DEPS" != "" ]
+then
+    echo "$TARG: $DEPS" > "$DEPFILE"
+fi
+
+exit $STATUS
diff --git a/build/ld.rwin.stub.sh b/build/ld.rwin.stub.sh
new file mode 100755
index 0000000..4c4c394
--- /dev/null
+++ b/build/ld.rwin.stub.sh
@@ -0,0 +1,59 @@
+#!/bin/bash
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+#echo "$0 $*"
+
+# ===========================================================================
+# input library types, and their handling
+#
+#  normal linkage
+#   -l : find shared or static
+#   -s : require static
+#   -d : require shared
+#
+#  static linkage
+#   -l : require static
+#   -s : require static
+#   -d : ignore
+# ===========================================================================
+
+# script name
+SELF_NAME="$(basename $0)"
+
+# parameters and common functions
+source "${0%rwin.stub.sh}win.cmn.sh"
+
+# discover tool chain
+case "$LD" in
+link)
+    source "${0%stub.sh}vc++.sh"
+    ;;
+ *)
+    echo "$SELF_NAME: unrecognized ld tool - '$LD'"
+    exit 5
+esac
+
+# produce stub library and exp file
+echo $STUB_CMD
+$STUB_CMD
diff --git a/build/ld.rwin.vc++.sh b/build/ld.rwin.vc++.sh
new file mode 100755
index 0000000..9322d4d
--- /dev/null
+++ b/build/ld.rwin.vc++.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+# define linker params
+LD_EXPORT_GLOBAL=""
+LD_MULTIPLE_DEFS="/FORCE:MULTIPLE"
+LD_STATIC=""
+LD_DYNAMIC=""
+LD_ALL_SYMBOLS="/OPT:NOREF"
+LD_REF_SYMBOLS="/OPT:REF"
+
+# the def file
+unset DEF_SWITCH
+
+DEF_FILE="$SRCDIR/$NAME-$BUILD.def"
+[ ! -f "$DEF_FILE" ] && DEF_FILE="$SRCDIR/$NAME.def"
+if [ -f "$DEF_FILE" ]
+then
+    DEF_FILE_LOCAL="$RHOME/${DEF_FILE#$LHOME}"
+    DEF_FILE_LOCAL="$(echo $DEF_FILE_LOCAL | tr '/' '\\')"
+    DEF_SWITCH="/DEF:$DEF_FILE_LOCAL"
+else
+    unset DEF_FILE
+fi
+
+# the full path to target sans extension
+#echo "TARG=$TARG; LOUTDIR=$LOUTDIR; ROUTDIR=$ROUTDIR"
+WINTARG="$ROUTDIR${TARG#$LOUTDIR}"
+WINTARG="$(echo $WINTARG | tr '/' '\\')"
+WINTARG="${WINTARG%.lib}"
+
+# build command
+STUB_CMD="lib /NOLOGO /MACHINE:x86 $DEF_SWITCH /OUT:$WINTARG.lib"
+SLIB_CMD="lib /NOLOGO /OUT:$WINTARG-static.lib"
+DLIB_CMD="$LD /NOLOGO /DLL $DEF_SWITCH /OUT:$WINTARG.dll /STACK:8000000 /HEAP:1000000000  /INCREMENTAL:NO"
+EXE_CMD="$LD /NOLOGO /OUT:$WINTARG.exe /SUBSYSTEM:CONSOLE /ENTRY:wmainCRTStartup /STACK:8000000 /HEAP:100000000 /INCREMENTAL:NO"
+
+# tack on PDB tracking
+if [ "$BUILD" = "dbg" ]
+then
+    DLIB_CMD="$DLIB_CMD /DEBUG /PDB:$WINTARG.pdb"
+    EXE_CMD="$EXE_CMD /DEBUG /PDB:$WINTARG.pdb"
+fi
diff --git a/build/ld.sh b/build/ld.sh
index c391e32..1293a0e 100755
--- a/build/ld.sh
+++ b/build/ld.sh
@@ -68,6 +68,10 @@ HAVE_M=0
 NEED_M=1
 HAVE_XML=0
 NEED_XML=0
+HAVE_KFC=0
+HAVE_KAPP=0
+HAVE_NCBI_VDB=0
+HAVE_NCBI_WVDB=0
 unset BUILD
 unset LDIRS
 unset XDIRS
@@ -291,17 +295,31 @@ do
         ;;
 
     -[lds]ncbi-vdb)
+        HAVE_NCBI_VDB=1
         KPROC=4
         HAVE_GZIP=1
         HAVE_BZIP=1
+        HAVE_KFC=1
+        NEED_M=1
+        NEED_XML=1
+        LIBS="$LIBS $1"
+        ;;
+    -[lds]ncbi-ngs-c++)
+        HAVE_NCBI_VDB=1
+        KPROC=4
+        HAVE_GZIP=1
+        HAVE_BZIP=1
+        HAVE_KFC=1
         NEED_M=1
         NEED_XML=1
         LIBS="$LIBS $1"
         ;;
     -[lds]ncbi-wvdb)
+        HAVE_NCBI_WVDB=1
         KPROC=4
         HAVE_GZIP=1
         HAVE_BZIP=1
+        HAVE_KFC=1
         NEED_M=16
         NEED_XML=1
         LIBS="$LIBS $1"
@@ -354,6 +372,19 @@ do
         #NEED_GZIP=1
         ;;
 
+    -[lds]kapp)
+        HAVE_KAPP=1
+        ;;
+
+    -[lds]kapp-norsrc)
+        HAVE_KAPP=1
+        ;;
+
+    -[lds]kfc)
+        LIBS="$LIBS $1"
+        HAVE_KFC=1
+        ;;
+
     -[ls]*)
         LIBS="$LIBS $1"
         ;;
@@ -464,6 +495,10 @@ then
     VERS="$ARG"
 fi
 
+# fix kapp
+[ $HAVE_KAPP -ne 0 ] && [ $HAVE_KFC -ne 0 ] && LIBS="-lkapp $LIBS"
+[ $HAVE_KAPP -ne 0 ] && [ $HAVE_KFC -eq 0 ] && LIBS="-lkapp-norsrc $LIBS"
+
 # detect need for kproc
 if [ $KPROC -eq 0 ] && [ $NEED_KPROC -ne 0 ] && [ $HAVE_KSPROC -eq 0 ]
 then
diff --git a/build/ld.sun.cc.sh b/build/ld.sun.cc.sh
new file mode 100644
index 0000000..af8a380
--- /dev/null
+++ b/build/ld.sun.cc.sh
@@ -0,0 +1,56 @@
+#!/bin/bash
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+# define linker params
+LD_EXPORT_GLOBAL=
+LD_MULTIPLE_DEFS="-Wl,-zmuldefs"
+LD_STATIC="-Wl,-Bstatic"
+LD_DYNAMIC="-Wl,-Bdynamic"
+LD_ALL_SYMBOLS="-Wl,--whole-archive"
+LD_REF_SYMBOLS="-Wl,--no-whole-archive"
+
+# build command
+case "$ARCH" in
+    sparc32|i386)
+        DLIB_CMD="$LD -Xlinker -32 -shared"
+        EXE_CMD="$LD -Xlinker -32"
+        ;;
+    sparc64|x86_64)
+        DLIB_CMD="$LD -Xlinker -64 -shared"
+        EXE_CMD="$LD -Xlinker -64"
+        ;;
+esac
+
+
+# versioned output
+if [ "$VERS" = "" ]
+then
+    DLIB_CMD="$DLIB_CMD -o $TARG"
+    EXE_CMD="$EXE_CMD -o $TARG"
+else
+    set-vers $(echo $VERS | tr '.' ' ')
+    DLIB_CMD="$DLIB_CMD -o $OUTDIR/$NAME$DBGAP.so.$VERS -Wl,-soname,$NAME.so.$MAJ"
+    EXE_CMD="$EXE_CMD -o $OUTDIR/$NAME$DBGAP.$VERS"
+fi
diff --git a/build/ld.sun.cmn.sh b/build/ld.sun.cmn.sh
new file mode 100755
index 0000000..c6c5da6
--- /dev/null
+++ b/build/ld.sun.cmn.sh
@@ -0,0 +1,160 @@
+#!/bin/bash
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+# script name
+SELF_NAME="$(basename $0)"
+
+# parameters
+LD="$1"
+ARCH="$2"
+BUILD="$3"
+shift 3
+
+SRCDIR="$1"
+BINDIR="$2"
+OUTDIR="$3"
+TARG="$4"
+NAME="$5"
+DBGAP="$6"
+shift 6
+
+VERS="$1"
+VERSFILE="$2"
+DEPFILE="$3"
+shift 3
+
+MODE="$1"
+SCMFLAGS="$2"
+LDFLAGS="$3"
+shift 3
+
+LDIRS="$1"
+XDIRS="$2"
+shift 2
+
+OBJS="$1"
+LIBS="$2"
+
+# decode MODE
+STATIC=$(expr $MODE % 2)
+MODE=$(expr $MODE / 2)
+DYLD=$(expr $MODE % 2)
+MODE=$(expr $MODE / 2)
+KPROC=$(expr $MODE % 2)
+MODE=$(expr $MODE / 2)
+THREADS=$(expr $MODE % 2)
+MODE=$(expr $MODE / 2)
+HAVE_M=$(expr $MODE % 2)
+MODE=$(expr $MODE / 2)
+HAVE_XML=$(expr $MODE % 2)
+
+# decode SCMFLAGS
+CHECKSUM=$(expr $SCMFLAGS % 2)
+STATICSYSLIBS=$(expr $SCMFLAGS / 2)
+
+# return parameter for find-lib
+LIBPATH=''
+
+# initial command state
+CMD=''
+LD_STATIC_STATE=0
+LD_ALL_STATE=0
+
+# for breaking out version
+set-vers ()
+{
+    MAJ=$1
+    MIN=$2
+    REL=$3
+}
+
+# for locating libraries
+find-lib ()
+{
+    _lib="lib$1"
+    _dirs="$2"
+
+    LIBPATH=''
+
+    while [ "$_dirs" != "" ]
+    do
+        _dir="${_dirs%%:*}"
+
+        if [ "$_dir" != "" ]
+        then
+            if [ -e "$_dir/$_lib" ]
+            then
+                while [ -L "$_dir/$_lib" ]
+                do
+                    # no readlink on Sun
+                    #_lib=$(readlink -n "$_dir/$_lib") 
+                    cd $_dir && _dir="$(pwd -P)"; test -L _lib || _lib=$(ls -l $_lib | sed 's/.*->\ //g'); cd $OLDPWD
+                done
+                LIBPATH="$_dir/$_lib"
+                break;
+            fi
+        fi
+
+        _dirs="${_dirs#$_dir}"
+        _dirs="${_dirs#:}"
+    done
+}
+
+# setting state
+load-static ()
+{
+    if [ $LD_STATIC_STATE -eq 0 ]
+    then
+        CMD="$CMD $LD_STATIC"
+        LD_STATIC_STATE=1
+    fi
+}
+
+load-dynamic ()
+{
+    if [ $LD_STATIC_STATE -eq 1 ]
+    then
+        CMD="$CMD $LD_DYNAMIC"
+        LD_STATIC_STATE=0
+    fi
+}
+
+load-all-symbols ()
+{
+    if [ $LD_ALL_STATE -eq 0 ]
+    then
+        CMD="$CMD $LD_ALL_SYMBOLS"
+        LD_ALL_STATE=1
+    fi
+}
+
+load-ref-symbols ()
+{
+    if [ $LD_ALL_STATE -eq 1 ]
+    then
+        CMD="$CMD $LD_REF_SYMBOLS"
+        LD_ALL_STATE=0
+    fi
+}
diff --git a/build/ld.sun.dlib.sh b/build/ld.sun.dlib.sh
new file mode 100755
index 0000000..f42f363
--- /dev/null
+++ b/build/ld.sun.dlib.sh
@@ -0,0 +1,282 @@
+#!/bin/bash
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+# ===========================================================================
+# input library types, and their handling
+#
+#  normal linkage
+#   -l : find shared or static
+#   -s : require static
+#   -d : require shared
+#
+#  static linkage
+#   -l : require static
+#   -s : require static
+#   -d : ignore
+# ===========================================================================
+
+
+# script name
+SELF_NAME="$(basename $0)"
+BUILD_DIR="$(dirname $0)"
+
+# parameters and common functions
+source "${0%dlib.sh}cmn.sh"
+
+# discover tool chain
+case "$LD" in
+cc)
+    source "${0%dlib.sh}cc.sh"
+    ;;
+ *)
+    echo "$SELF_NAME: unrecognized ld tool - '$LD'"
+    exit 5
+esac
+
+# DLIB_CMD was started in tool-specific source
+CMD="$DLIB_CMD $LDFLAGS"
+
+# tack on object files
+CMD="$CMD $OBJS"
+
+# list of static libraries used to create dynamic lib
+SLIBS=''
+
+# initial dependency upon Makefile and vers file
+DEPS="$SRCDIR/Makefile"
+if [ "$LIBS" != "" ]
+then
+    # tack on paths
+    DIRS="$LDIRS:$XDIRS"
+    while [ "$DIRS" != "" ]
+    do
+        DIR="${DIRS%%:*}"
+        [ "$DIR" != "" ] && CMD="$CMD -L$DIR"
+        DIRS="${DIRS#$DIR}"
+        DIRS="${DIRS#:}"
+    done
+
+    # update LD_LIBRARY_PATH
+    unset LD_LIBRARY_PATH
+    export LD_LIBRARY_PATH="$LDIRS:$XDIRS"
+
+    # tack on libraries, finding as we go
+    for LIB in $LIBS
+    do
+
+        # strip off switch
+        LIBNAME="${LIB#-[lsd]}"
+
+        # look at linkage
+        case "$LIB" in
+        -ldl|-ddl)
+
+            # always load libdl as shared library
+            load-ref-symbols
+            load-dynamic
+            CMD="$CMD -ldl"
+            ;;
+
+        -l*)
+
+            # normal or dynamic linkage
+            FOUND=0
+            if [ $STATIC -eq 0 ]
+            then
+                find-lib $LIBNAME.so $LDIRS
+                if [ "$LIBPATH" != "" ]
+                then
+
+                    # found it
+                    FOUND=1
+
+                    # load normally
+                    load-ref-symbols
+                    load-dynamic
+                    CMD="$CMD -l$LIBNAME"
+
+                fi
+            fi
+
+            # try static only
+            if [ $FOUND -eq 0 ]
+            then
+                find-lib $LIBNAME.a $LDIRS
+                if [ "$LIBPATH" != "" ]
+                then
+
+                    # found it
+                    FOUND=1
+
+                    # add it to dependencies
+                    DEPS="$DEPS $LIBPATH"
+                    SLIBS="$SLIBS $(dirname $LIBPATH)/lib$LIBNAME.a"
+
+                    # load static
+                    load-static
+                    load-all-symbols
+                    CMD="$CMD -l$LIBNAME"
+
+                fi
+            fi
+
+            # not found within our directories
+            if [ $FOUND -eq 0 ]
+            then
+
+                if [ $STATICSYSLIBS -eq 1 ]
+                then
+                    case "$LIBNAME" in
+                    z|bz2)
+                        # set load to static
+                        load-static
+                        load-all-symbols
+                        ;;
+
+                    *)
+                        # set load to dynamic
+                        load-ref-symbols
+                        load-dynamic
+                        ;;
+
+                    esac
+                else
+                    # set load to normal
+                    load-ref-symbols
+                    load-dynamic
+                fi
+
+                CMD="$CMD -l$LIBNAME"
+            fi
+            ;;
+
+        -s*)
+
+            # force static load
+            FOUND=0
+            find-lib $LIBNAME.a $LDIRS
+            if [ "$LIBPATH" != "" ]
+            then
+
+                # found it
+                FOUND=1
+
+                # add it to dependencies
+                DEPS="$DEPS $LIBPATH"
+                SLIBS="$SLIBS $(dirname $LIBPATH)/lib$LIBNAME.a"
+
+                # load static
+                load-static
+                load-all-symbols
+                CMD="$CMD -l$LIBNAME"
+
+            fi
+
+            # not found within our directories
+            if [ $FOUND -eq 0 ]
+            then
+
+                if [ $STATIC -eq 1 ] || [ $STATICSYSLIBS -eq 1 ]
+                then
+                    # set load to static
+                    load-static
+                    load-all-symbols
+                else
+
+                    case "$LIBNAME" in
+                    z|bz2)
+                        # set load to dynamic
+                        load-ref-symbols
+                        load-dynamic
+                        ;;
+
+                    *)
+                        # set load to static
+                        load-static
+                        load-all-symbols
+                        ;;
+                    esac
+                fi
+
+                CMD="$CMD -l$LIBNAME"
+            fi
+            ;;
+
+        -d*)
+
+            # only dynamic linkage
+            FOUND=0
+            if [ $STATIC -eq 0 ]
+            then
+                find-lib $LIBNAME.so $LDIRS
+                if [ "$LIBPATH" != "" ]
+                then
+
+                    # found it
+                    FOUND=1
+
+                    # load normally
+                    load-ref-symbols
+                    load-dynamic
+                    CMD="$CMD -l$LIBNAME"
+
+                fi
+            fi
+
+            # not found within our directories
+            if [ $FOUND -eq 0 ]
+            then
+                # set load to normal
+                load-ref-symbols
+                load-dynamic
+                CMD="$CMD -l$LIBNAME"
+            fi
+            ;;
+
+        esac
+
+    done
+fi
+
+# put state back to normal
+load-ref-symbols
+load-dynamic
+
+# add in pthreads
+if [ $THREADS -ne 0 ]
+then
+    CMD="$CMD -lpthread"
+fi
+
+# produce shared library
+echo "$CMD"
+$CMD || exit $?
+
+# produce dependencies
+if [ "$DEPFILE" != "" ]
+then
+    echo "$TARG: $DEPS" > "$DEPFILE"
+fi
diff --git a/build/ld.sun.exe.sh b/build/ld.sun.exe.sh
new file mode 100755
index 0000000..56e062c
--- /dev/null
+++ b/build/ld.sun.exe.sh
@@ -0,0 +1,299 @@
+#!/bin/bash
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+# ===========================================================================
+# input library types, and their handling
+#
+#  normal linkage
+#   -l : find shared or static
+#   -s : require static
+#   -d : ignore - will be dynamically loaded
+#
+#  static linkage
+#   -l : require static
+#   -s : require static
+#   -d : require static
+# ===========================================================================
+
+
+# script name
+SELF_NAME="$(basename $0)"
+BUILD_DIR="$(dirname $0)"
+
+# parameters and common functions
+source "${0%exe.sh}cmn.sh"
+
+# discover tool chain
+case "$LD" in
+cc)
+    source "${0%exe.sh}cc.sh"
+    ;;
+gcc)
+    source "${0%sun.exe.sh}linux.gcc.sh"
+    ;;
+*)
+    echo "$SELF_NAME: unrecognized ld tool - '$LD'"
+    exit 5
+esac
+
+# EXE_CMD was started in tool-specific source
+CMD="$EXE_CMD $LDFLAGS"
+
+# if building a static executable against dynamic libraries
+# the main application will substitute for name lookup
+if [ $STATIC -eq 1 ] && [ $DYLD -eq 1 ]
+then
+#    CMD="$CMD $LD_EXPORT_GLOBAL $LD_MULTIPLE_DEFS"
+    CMD="$CMD $LD_EXPORT_GLOBAL"
+fi
+
+# tack on object files
+CMD="$CMD $OBJS"
+
+# list of static libraries used to create executable
+SLIBS=''
+
+# initial dependency upon Makefile and vers file
+DEPS="$SRCDIR/Makefile $VERSFILE"
+if [ "$LIBS" != "" ]
+then
+    # tack on paths
+    DIRS="$LDIRS:$XDIRS"
+    while [ "$DIRS" != "" ]
+    do
+        DIR="${DIRS%%:*}"
+        [ "$DIR" != "" ] && CMD="$CMD -L$DIR"
+        DIRS="${DIRS#$DIR}"
+        DIRS="${DIRS#:}"
+    done
+
+    # update LD_LIBRARY_PATH
+    unset LD_LIBRARY_PATH
+    export LD_LIBRARY_PATH="$LDIRS:$XDIRS"
+
+    # tack on libraries, finding as we go
+    for LIB in $LIBS
+    do
+
+        # strip off switch
+        LIBNAME="${LIB#-[lsd]}"
+
+        # look at linkage
+        case "$LIB" in
+        -ldl|-ddl)
+
+            # always load libdl as shared library
+            load-ref-symbols
+            load-dynamic
+            CMD="$CMD -ldl"
+            ;;
+
+        -l*)
+
+            # normal or dynamic linkage
+            FOUND=0
+            if [ $STATIC -eq 0 ]
+            then
+                find-lib $LIBNAME.so $LDIRS
+                if [ "$LIBPATH" != "" ]
+                then
+
+                    # found it
+                    FOUND=1
+
+                    # load dynamic
+                    load-dynamic
+                    CMD="$CMD -l$LIBNAME"
+
+                fi
+            fi
+
+            # try static only
+            if [ $FOUND -eq 0 ]
+            then
+                find-lib $LIBNAME.a $LDIRS
+                if [ "$LIBPATH" != "" ]
+                then
+
+                    # found it
+                    FOUND=1
+
+                    # add it to dependencies
+                    DEPS="$DEPS $LIBPATH"
+                    SLIBS="$SLIBS $(dirname $LIBPATH)/lib$LIBNAME.a"
+
+                    # load static
+                    load-static
+                    [ $STATIC -eq 1 ] && load-all-symbols
+                    CMD="$CMD -l$LIBNAME"
+
+                fi
+            fi
+
+            # not found within our directories
+            if [ $FOUND -eq 0 ]
+            then
+
+                # do not need to load all symbols for external libs
+                [ $STATIC -eq 1 ] && load-ref-symbols
+
+                if [ $STATICSYSLIBS -eq 1 ]
+                then
+                    case "$LIBNAME" in
+                    z|bz2)
+                        # set load to static
+                        load-static
+                        ;;
+
+                    *)
+                        # set load to dynamic
+                        load-dynamic
+                        ;;
+
+                    esac
+                else
+                    # set load to normal
+                    load-dynamic
+                fi
+
+                CMD="$CMD -l$LIBNAME"
+            fi
+            ;;
+
+        -s*)
+
+            # force static load
+            FOUND=0
+            find-lib $LIBNAME.a $LDIRS
+            if [ "$LIBPATH" != "" ]
+            then
+
+                # found it
+                FOUND=1
+
+                # add it to dependencies
+                DEPS="$DEPS $LIBPATH"
+                SLIBS="$SLIBS $(dirname $LIBPATH)/lib$LIBNAME.a"
+
+                # load static
+                load-static
+                [ $STATIC -eq 1 ] && load-all-symbols
+                CMD="$CMD -l$LIBNAME"
+
+            fi
+
+            # not found within our directories
+            if [ $FOUND -eq 0 ]
+            then
+
+                # do not need to load all symbols for external libs
+                [ $STATIC -eq 1 ] && load-ref-symbols
+
+                if [ $STATIC -eq 1 ] || [ $STATICSYSLIBS -eq 1 ]
+                then
+
+                    # set load to static
+                    load-static
+
+                else
+
+                    # special case for libs we have in "ext"
+                    # that are sometimes requested as static
+                    case "$LIBNAME" in
+                    z|bz2)
+                        # set load to dynamic
+                        load-dynamic
+                        ;;
+                    *)
+                        load-static
+                        ;;
+                    esac
+                fi
+
+                CMD="$CMD -l$LIBNAME"
+            fi
+            ;;
+
+        -d*)
+
+            FOUND=0
+            if [ $STATIC -eq 1 ]
+            then
+                find-lib $LIBNAME.a $LDIRS
+                if [ "$LIBPATH" != "" ]
+                then
+
+                    # found it
+                    FOUND=1
+
+                    # add it to dependencies
+                    DEPS="$DEPS $LIBPATH"
+                    SLIBS="$SLIBS $(dirname $LIBPATH)/lib$LIBNAME.a"
+
+                    # load static
+                    load-static
+                    load-all-symbols
+
+                    CMD="$CMD -l$LIBNAME"
+
+                fi
+
+                # not found within our directories
+                if [ $FOUND -eq 0 ]
+                then
+                    load-static
+                    load-all-symbols
+
+                    CMD="$CMD -l$LIBNAME"
+                fi
+            fi
+            ;;
+
+
+        esac
+
+    done
+fi
+
+# return to normal
+load-ref-symbols
+load-dynamic
+
+# add in pthreads
+if [ $THREADS -ne 0 ]
+then
+    CMD="$CMD -lpthread"
+fi
+
+# produce shared library
+echo $CMD
+$CMD || exit $?
+
+# produce dependencies
+if [ "$DEPFILE" != "" ]
+then
+    echo "$TARG: $DEPS" > "$DEPFILE"
+fi
diff --git a/build/ld.sun.ln.sh b/build/ld.sun.ln.sh
new file mode 100644
index 0000000..c248afa
--- /dev/null
+++ b/build/ld.sun.ln.sh
@@ -0,0 +1,87 @@
+#!/bin/bash
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+# script name
+SELF_NAME="$(basename $0)"
+
+# parameters
+TYPE="$1"
+OUTDIR="$2"
+TARG="$3"
+NAME="$4"
+DBGAP="$5"
+EXT="$6"
+VERS="$7"
+
+# find target
+TARG=$(basename "$TARG")
+
+# put extension back onto name
+NAME="$NAME$DBGAP"
+[ "$EXT" != "" ] && NAME="$NAME.$EXT"
+
+# break out version
+set-vers ()
+{
+    MAJ=$1
+    MIN=$2
+    REL=$3
+}
+
+set-vers $(echo $VERS | tr '.' ' ')
+
+cd "$OUTDIR" || exit 5
+
+# create link
+create-link ()
+{
+    rm -f "$2"
+    local CMD="ln -s $1 $2"
+    echo $CMD
+    $CMD
+}
+
+# test for version in target name
+if [ "$TARG" != "$NAME.$MAJ.$MIN.$REL" ]
+then
+
+    # for simple name, create 2 links
+    if [ "$TARG" = "$NAME" ]
+    then
+        create-link "$NAME.$MAJ.$MIN.$REL" "$NAME.$MAJ"
+        create-link "$NAME.$MAJ" "$NAME"
+
+    # for name with major version in it
+    elif [ "$TARG" = "$NAME.$MAJ" ]
+    then
+        create-link "$NAME.$MAJ.$MIN.$REL" "$NAME.$MAJ"
+
+
+    # for name with major & minor version in it
+    elif [ "$TARG" = "$NAME.$MAJ.$MIN" ]
+    then
+        create-link "$NAME.$MAJ.$MIN.$REL" "$NAME.$MAJ.$MIN"
+    fi
+fi
diff --git a/build/ld.sun.slib.sh b/build/ld.sun.slib.sh
new file mode 100755
index 0000000..1e08638
--- /dev/null
+++ b/build/ld.sun.slib.sh
@@ -0,0 +1,135 @@
+#!/bin/bash
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+# ===========================================================================
+# input library types, and their handling
+#
+#  normal or static linkage
+#   -l : require static
+#   -s : require static
+#   -d : ignore
+# ===========================================================================
+
+# script name
+SELF_NAME="$(basename $0)"
+BUILD_DIR="$(dirname $0)"
+
+# parameters and common functions
+source "${0%slib.sh}cmn.sh"
+
+# initialize command
+CMD="ar -rc"
+
+# function to convert an archive into individual object files
+convert-static ()
+{
+    # list members
+    local path="$1"
+    local mbrs="$(ar -t $path)"
+
+    # unpack archive into temporary directory
+    mkdir -p ld-tmp
+    if ! cd ld-tmp
+    then
+        echo "$SELF_NAME: failed to cd to ld-tmp"
+        exit 5
+    fi
+    ar -x "$path"
+
+    # rename and add to source files list
+    local m=
+    for m in $mbrs
+    do
+        mv $m $NAME-$m
+        CMD="$CMD ld-tmp/$NAME-$m"
+    done
+
+    # return to prior location
+    cd - > /dev/null
+}
+
+# versioned output
+if [ "$VERS" = "" ]
+then
+    CMD="$CMD $TARG"
+else
+    set-vers $(echo $VERS | tr '.' ' ')
+    CMD="$CMD $OUTDIR/$NAME$DBGAP.a.$VERS"
+fi
+
+# tack on object files
+CMD="$CMD $OBJS"
+
+# list of static libraries used to create this lib
+SLIBS=''
+
+# initial dependency upon Makefile and vers file
+DEPS="$SRCDIR/Makefile"
+if [ "$LIBS" != "" ]
+then
+    # tack on libraries, finding as we go
+    for LIB in $LIBS
+    do
+
+        # strip off switch
+        LIBNAME="${LIB#-[lsd]}"
+
+        # look at linkage
+        case "$LIB" in
+        -s*)
+
+            # force static load
+            find-lib $LIBNAME.a $LDIRS
+            if [ "$LIBPATH" != "" ]
+            then
+
+                # add it to dependencies
+                DEPS="$DEPS $LIBPATH"
+                SLIBS="$SLIBS $(dirname $LIBPATH)/lib$LIBNAME.a"
+
+                # convert to individual object files
+                convert-static "$LIBPATH" || exit $?
+
+            fi
+            ;;
+
+        esac
+
+    done
+fi
+
+# produce static library
+echo $CMD
+$CMD || exit $?
+
+# remove temporaries
+rm -rf ld-tmp
+
+# produce dependencies
+if [ "$DEPFILE" != "" ] && [ "$DEPS" != "" ]
+then
+    echo "$TARG: $DEPS" > "$DEPFILE"
+fi
diff --git a/build/ld.unix.cmn.sh b/build/ld.unix.cmn.sh
old mode 100755
new mode 100644
diff --git a/build/ld.unix.slib.sh b/build/ld.unix.slib.sh
old mode 100755
new mode 100644
diff --git a/build/libexists.sh b/build/libexists.sh
new file mode 100644
index 0000000..b725289
--- /dev/null
+++ b/build/libexists.sh
@@ -0,0 +1,180 @@
+#!/bin/bash
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+# libexists.sh: test whether one of the given libraries defines all of the specified external names
+# Usage:
+#   bash libexists.sh OS ARCH CC LD CC_SH LD_SH [-L dir ] [-X dir] [-o dir] [-l lib] [-s lib] [-d lib] [-v] extName1 [ extName2 ... ]
+# Parameters:
+#   OS : linux/mac/win
+#   ARCH : i386/x86_64
+#   CC : compiler command
+#   LD : link command
+#   CC_SH : compile script
+#   LD_SH : link script
+#   extName1, ... - external names to find in libraries
+# Options:
+#   -L, -X :    library directories
+#   -o :        directory for intermediate files
+#   -l, -d :    libraries to search (shared or static)
+#   -s :        libraries to search (static)
+#   -v :        verbose mode
+# Environment:
+#   requires an ?? OS.ARCH.sh file in the script's directory
+# Return: 0 if found, the library's name is on stdout
+#         1 not found
+#        -1 bad arguments
+#
+
+BUILD_DIR="$(dirname $0)"
+
+# os
+OS="$1";shift
+# architecture
+ARCH="$1";shift
+# compiler
+CC="$1";shift 1
+# linker
+LD="$1";shift
+# compile script
+CC_SH="$1";shift
+# link script
+LD_SH="$1";shift
+
+# message prefix for verbose mode
+dbgPref="**$(basename $0): "
+
+# parse parameters
+cOpts=
+libs=
+verbose="false"
+outDir="."
+while getopts L:X:l:s:d:vo: o
+do	case "$o" in
+	L|X)	cOpts="${cOpts} -L$OPTARG";libPath="${libPath}:${OPTARG}";;
+	l|d)	libs="${libs} l$OPTARG";; 
+	s)	    libs="${libs} s$OPTARG";; 
+	o)      outDir="$OPTARG";;
+	v)	    verbose="true";; 
+	[?])	printf >&2 "Usage: $0 [-L dir ] [-X dir] [-o dir] [-l lib] [-s lib] [-d lib] [-v] extName1 [ extName2 ... ]"
+		exit -1;;
+	esac
+done
+libPath="${outDir}${libPath}"
+
+shift $((OPTIND - 1))
+
+if [ $verbose == "true" ]
+then
+    printf >&2 "${dbgPref}OS   ='%s'\n"  "$OS"
+    printf >&2 "${dbgPref}ARCH   ='%s'\n"  "$ARCH"
+    printf >&2 "${dbgPref}CC   ='%s'\n"  "$CC"
+    printf >&2 "${dbgPref}LD   ='%s'\n"  "$LD"
+    printf >&2 "${dbgPref}CC_SH   ='%s'\n"  "$CC_SH"
+    printf >&2 "${dbgPref}LD_SH   ='%s'\n"  "$LD_SH"
+    printf >&2 "${dbgPref}cOpts   ='%s'\n"  "$cOpts"
+    printf >&2 "${dbgPref}libs    ='%s'\n"  "$libs"
+    printf >&2 "${dbgPref}verbose ='%s'\n"  $verbose
+    printf >&2 "${dbgPref}outDir  ='%s'\n"  $outDir
+fi
+
+## create a C program referencing all the external names
+srcFile="${outDir}/libexists.c"
+objFile="${outDir}/libexists.o"
+exeFile="${outDir}/libexists"
+
+echo "" >${srcFile}
+for fn in $* 
+do  #declare
+    echo "extern void ${fn}(void);" >>${srcFile}
+done
+echo "int main( int argc, char *argv [] ){" >>${srcFile}
+echo "if (argc < 0 ) {    " >>${srcFile}
+for fn in $* 
+do
+    echo "   ${fn}();" >>${srcFile}
+done
+echo "} return 0;} int wmain(int argc, char *argv []) { return main(argc,argv); }" >>${srcFile}
+
+if [ $verbose == "true" ]
+then
+    echo "${dbgPref}created ${srcFile}:" >&2
+    cat ${srcFile} >&2
+fi
+##
+
+## compile
+compile="${BUILD_DIR}/$CC_SH $OS $CC -c -o ${objFile} ${srcFile}"
+if [ $verbose == "true" ]
+then
+    echo "${dbgPref}${compile}" >&2
+fi
+compileRes=$($compile)
+if [ $verbose == "true" ]
+then
+    echo "${dbgPref}${compileRes}" >&2
+fi
+##
+
+#try to link with all specified libraries until successful
+LD_LIBRARY_PATH=${libPath}:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH
+rc=1
+for lib in $libs
+do
+    pref=${lib:0:1}
+    lib=${lib:1}
+    if [ $pref == "s" ]
+    then
+        link="${BUILD_DIR}/$LD_SH $OS $ARCH $LD --static --exe ${cOpts} -l$lib -o${exeFile} --objx o ${objFile}"
+    else
+        link="${BUILD_DIR}/$LD_SH $OS $ARCH $LD          --exe ${cOpts} -l$lib -o${exeFile} --objx o ${objFile}" 
+    fi    
+    if [ $verbose == "true" ]
+    then
+        echo ${dbgPref} "$link" >&2
+    fi
+    linkRes=$($link 2>/dev/null)
+    linkRc=$?
+    if [ $verbose == "true" ]
+    then
+        echo ${dbgPref} "$linkRes" >&2
+    fi
+    
+    if [ $linkRc == 0 ]
+    then 
+        ${exeFile} 2>/dev/null
+        if [ $? == 0 ]
+        then 
+            # Success: RC=0, found library's name to stdout
+            rc=0
+            echo $lib
+            break
+        fi            
+    fi
+done
+
+#clean up
+rm -f ${srcFile} ${objFile} ${exeFile}
+
+exit $rc 
diff --git a/build/make-defs-xf.pl b/build/make-defs-xf.pl
new file mode 100755
index 0000000..a99ac6d
--- /dev/null
+++ b/build/make-defs-xf.pl
@@ -0,0 +1,108 @@
+#!/usr/bin/perl
+#============================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+use IO::Handle;
+use IO::File;
+use IPC::Open2;
+use FileHandle;
+
+my $libname;
+my $libvers;
+my @files;
+
+sub USAGE() {
+  print "Usage: $0 -o <lib name> [-v <lib vers file>] <c source files>\n";
+  exit 1;
+}
+
+sub file_contents($) {
+  local $/;
+  local $_ = shift;
+  my $fh;
+
+  $fh = new IO::File $_, 'r' or die "can't open $_ for read";
+  undef $/;
+  $_ = <$fh>;
+  undef $fh;
+
+  return $_;
+}
+
+sub process_args() {
+  my $i;
+
+  for ($i = 0; $i < scalar(@ARGV); ++$i) {
+    $_ = $ARGV[$i];
+    last unless /^-(.)/;
+    if ($1 eq 'o') {
+      $libname = $ARGV[++$i];
+    }
+    elsif ($1 eq 'v') {
+      $_ = $ARGV[++$i];
+      $_ = file_contents($_);
+      chomp;
+      warn "vers file is empty" if /^$/;
+      if (/(\d+)\.(\d+)\.(\d+)/) {
+        $libvers = "$1.$2";
+      }
+      else {
+        warn "'$_' is not a valid version";
+      }
+    }
+    else {
+      USAGE;
+    }
+  }
+  USAGE unless $libname;
+
+  for (++$i; $i != scalar(@ARGV); ++$i) {
+    push @files, $ARGV[$i];
+  }
+}
+
+sub process_files() {
+    foreach (@files) {
+	my $in = new IO::File $_, 'r' or die "can't open file '$_' for read";
+	{
+	    local $_;
+
+	    while ($_ = <$in>, defined($_)) {
+		print "\t$1\n" if /^VTRANSFACT_IMPL\s*\(\s*(\w+)/;
+	    }
+	}
+        $in->close();
+    }
+}
+
+process_args;
+USAGE unless $libname;
+USAGE unless scalar(@files);
+
+print "LIBRARY $libname\n";
+print "VERSION $libvers\n" if $libvers;
+print "EXPORTS\n";
+process_files();
+
+exit 0;
diff --git a/build/make-defs.pl b/build/make-defs.pl
new file mode 100755
index 0000000..dbff4dd
--- /dev/null
+++ b/build/make-defs.pl
@@ -0,0 +1,247 @@
+#!/usr/bin/perl
+#============================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+use IO::Handle;
+use IO::File;
+use IPC::Open2;
+use FileHandle;
+
+my $libname;
+my $libvers;
+my $GCC = '';
+my @files;
+
+sub USAGE() {
+  print "Usage: $0 -o <lib name> [-v <lib vers file>] <gcc spec> -- <header files>\n";
+  exit 1;
+}
+
+sub file_contents($) {
+  local $/;
+  local $_ = shift;
+  my $fh;
+
+  $fh = new IO::File $_, 'r' or die "can't open $_ for read";
+  undef $/;
+  $_ = <$fh>;
+  undef $fh;
+
+  return $_;
+}
+
+sub process_args() {
+  my $i;
+
+  for ($i = 0; $i < scalar(@ARGV); ++$i) {
+    $_ = $ARGV[$i];
+    last unless /^-(.)/;
+    if ($1 eq 'o') {
+      $libname = $ARGV[++$i];
+    }
+    elsif ($1 eq 'v') {
+      $_ = $ARGV[++$i];
+      $_ = file_contents($_);
+      chomp;
+      warn "vers file is empty" if /^$/;
+      if (/(\d+)\.(\d+)\.(\d+)/) {
+        $libvers = "$1.$2";
+      }
+      else {
+        warn "'$_' is not a valid version";
+      }
+    }
+    else {
+      USAGE;
+    }
+  }
+#  USAGE unless $libname;
+
+  for ( ; $i != scalar(@ARGV); ++$i) {
+    $_ = $ARGV[$i];
+    last if $_ eq '--';
+    $GCC .= "$_ ";
+  }
+
+  for (++$i; $i != scalar(@ARGV); ++$i) {
+    push @files, $ARGV[$i];
+  }
+}
+
+sub next_token($) {
+  local $_;
+  my $src = shift;
+
+  if ($src =~ /^(\s*)/) {
+    $src = substr $src, length($1);
+  }
+  if ($src =~ /^([^ ]+)/) {
+    $_ = $1;
+    if (/^([A-Za-z_][A-Za-z0-9_]+)/) {
+      $_ = $1;
+      $src = substr $src, length($_);
+      return ($src, 'ident', $_);
+    }
+    else {
+      $_ = substr $src, 0, 1;
+      $src = substr $src, 1;
+      return ($src, 'unknown', $_);
+    }
+  }
+  return ($src, undef, undef);
+}
+
+my $id;
+my $pt_st = 0;
+my $visibility = 'extern';
+
+sub process_token($$) {
+  my $type = shift;
+  my $tok = shift;
+
+  if ($tok eq ';' || $tok eq ',') {
+    if (($pt_st == 4 || $pt_st == 5) && $visibility eq 'extern') {
+      if ($id) {
+        print "\t$id\n";
+      }
+    }
+    $id = undef;
+    if ($tok eq ';') {
+      $pt_st = 0;
+      $visibility = 'extern';
+    }
+    return;
+  }
+  if ($pt_st == 0) {
+    unless ($type eq 'ident') {
+      $pt_st = 1;
+      return;
+    }
+    if ($tok eq 'extern' || $tok eq 'static') {
+      $visibility = $tok;
+    }
+    elsif ($tok eq 'typedef') {
+      $pt_st = 1;
+    }
+    else {
+      if ($tok eq 'const' || $tok eq 'volatile') {
+        $pt_st = 2;
+      }
+      else {
+        $pt_st = ($tok eq 'struct' || $tok eq 'class' || $tok eq 'union' || $tok eq 'enum') ? 3 : 4;
+      }
+    }
+    return;
+  }
+  if ($pt_st == 1) {
+    return;
+  }
+  if ($pt_st == 2) {
+    unless ($type eq 'ident') {
+      $pt_st = 1;
+      return;
+    }
+    $pt_st = ($tok eq 'struct' || $tok eq 'class' || $tok eq 'union' || $tok eq 'enum') ? 3 : 4;
+    return;
+  }
+  if ($pt_st == 3) {
+    unless ($type eq 'ident') {
+      $pt_st = 1;
+      return;
+    }
+    $pt_st = 4;
+    return;
+  }
+  if ($pt_st == 4) {
+    if ($tok eq '__attribute__') {
+      $pt_st = 5;
+      return;
+    }
+    $id = $tok if $type eq 'ident';
+    return;
+  }
+  if ($pt_st == 5) {
+    return;
+  }
+  warn 'unpossible';
+}
+
+my $level = 0;
+
+sub parse($$);
+sub parse($$) {
+  my $src = shift;
+  my $end = shift;
+  my $tok;
+  my $type;
+
+  ++$level;
+  while (($src, $type, $tok) = next_token($src), defined($tok)) {
+    last if ($tok eq $end);
+    process_token($type, $tok) if ($level == 1);
+    $src = parse($src, ')') if ($tok eq '(');
+    $src = parse($src, '}') if ($tok eq '{');
+    $src = parse($src, ']') if ($tok eq '[');
+  }
+  --$level;
+  return $src;
+}
+
+sub process_files() {
+  my $gcc_out;
+  my $gcc_in;
+  my $src = '';
+
+  open2($gcc_in, $gcc_out, "$GCC") or die "can't run preprocessor $GCC";
+  foreach (@files) {
+    next unless $_;
+    $_ = file_contents($_);
+    next unless $_;
+    s/^\#include\s.+$//gm unless /weak\.h/;
+    $gcc_out->print($_);
+  }
+
+  undef $gcc_out; # else gcc won't produce output
+
+  while ($_ = <$gcc_in>, defined($_)) {
+    next if /^\s*$/;
+    next if /^#/;
+    chomp;
+    $src .= " $_";
+  }
+  return $src;
+}
+
+process_args;
+USAGE unless $GCC;
+USAGE unless scalar(@files);
+
+if (defined $libname) { 
+    print "LIBRARY $libname\n";
+    print "VERSION $libvers\n" if $libvers;
+    print "EXPORTS\n"; 
+    }
+parse(process_files(), '');
+
+exit 0;
diff --git a/build/run_remotely.sh b/build/run_remotely.sh
new file mode 100755
index 0000000..11169f5
--- /dev/null
+++ b/build/run_remotely.sh
@@ -0,0 +1,124 @@
+#!/bin/bash
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+VERBOSE=
+if [ "$VERBOSE" != "" ] ; then echo "$0 $*"; fi
+
+# ===========================================================================
+# run a command from a list on a (Windows) build server
+# $1 - path to proxy_exec
+# $2 - server name 
+# $3 - server port
+# $4 - server path mapped to a client dir (e.g. Z:)
+# $5 - client path to the dir mapped on the server
+# $6 - server path to the working directory (e.g. Z:internal\asm-trace)
+# $7 - output directory from server's prespective (e.g. Z:\win\lib)
+# $8 - output directory from client's perspective (e.g. internal/asm-trace/win/lib)
+# $9 - command (can be a single name e.g. cl, or a client path which will be translated into a server path) 
+# $... - arguments
+
+#TODO: translate command name to id
+
+PROXY_TOOL=$1
+if [ ! -e $PROXY_TOOL ]
+then
+    echo "$0 $*"
+    echo "$0: proxy tool ($1) is not found."
+    exit 5
+fi
+
+RHOST=$2
+RPORT=$3
+RHOME=$4
+LHOME=$5
+WORKDIR=$6
+ROUTDIR=$7
+LOUTDIR=$8
+CMD=$9
+shift 9
+ARGS=$*
+
+if [ "$VERBOSE" != "" ] 
+then 
+    echo "PROXY_TOOL=$PROXY_TOOL"
+    echo "RHOST     =$RHOST     "
+    echo "RPORT     =$RPORT     "
+    echo "RHOME     =$RHOME     "
+    echo "LHOME     =$LHOME     "
+    echo "WORKDIR   =$WORKDIR   "
+    echo "ROUTDIR   =$ROUTDIR   "
+    echo "LOUTDIR   =$LOUTDIR   "
+    echo "CMD       =$CMD       "
+    echo "ARGS      =$ARGS      "
+fi
+
+if [ $(eval "dirname \"$CMD\"") != "." ] 
+then # executable is located on the client; translate path for the server
+    if [ "$CMD" != "${CMD#$LHOME}" ] 
+    then
+        RCMD="$RHOME${CMD#$LHOME}.exe"
+    elif [ "$CMD" != "${CMD#$LOUTDIR}" ] 
+    then
+        RCMD="$ROUTDIR${CMD#$LOUTDIR}.exe"
+    else
+        RCMD="$CMD.exe"
+    fi
+
+    if [ "${WORKDIR}" == "." ] 
+    then # run in the directory of the executable
+        # use the original CMD
+        WORKDIR="${CMD%$(basename $CMD)}"
+    fi
+else # executable is located on the server
+    # workdir path translation is expected of the caller
+    RCMD=$CMD
+fi
+
+# translate WORKDIR
+if [ "$WORKDIR" != "${WORKDIR#$LHOME}" ] 
+then
+    WORKDIR="$RHOME${WORKDIR#$LHOME}"
+elif [ "$WORKDIR" != "${WORKDIR#$LOUTDIR}" ] 
+then
+    WORKDIR="$ROUTDIR${WORKDIR#$LOUTDIR}"
+fi
+
+if [ "$VERBOSE" != "" ] ; then echo "RCMD=$RCMD"; fi
+
+#translate slashes
+RCMD="$(echo $RCMD | tr '/' '\\')"
+WORKDIR="$(echo $WORKDIR | tr '/' '\\')"
+
+#extra quotes in case command's filename contains spaces
+if [[ "$RCMD" != "${RCMD/ /}" ]] ; then RCMD="\"$RCMD\""; fi
+
+if [ "$VERBOSE" != "" ] ; then echo "$PROXY_TOOL -D $WORKDIR -S $RHOST -P $RPORT"; fi
+if [ "$VERBOSE" != "" ] ; then echo "sending to stdin: $RCMD $ARGS"; fi
+
+echo "$RCMD $ARGS" | $PROXY_TOOL -D $WORKDIR -S $RHOST -P $RPORT
+exit $?
+
+
+
+
diff --git a/build/scm-collect.sh b/build/scm-collect.sh
new file mode 100755
index 0000000..6284c31
--- /dev/null
+++ b/build/scm-collect.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+OBJ_FILES="$1"
+LIB_FILES="$2"
+
+for f in $OBJ_FILES $LIB_FILES
+do
+    if [ ! -f $f.md5 ]
+    then
+        echo "$f.md5 not found" > /dev/stderr
+        exit 5
+    elif [ ! -r $f.md5 ]
+    then
+        echo "$f.md5 not readable" > /dev/stderr
+        exit 5
+    else
+        cat $f.md5
+    fi
+done
diff --git a/build/scm.sh b/build/scm.sh
new file mode 100755
index 0000000..e872ea3
--- /dev/null
+++ b/build/scm.sh
@@ -0,0 +1,136 @@
+#!/bin/bash
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+BUILD_DIR="$(dirname $0)"
+TOP="$(dirname $BUILD_DIR)"
+SCM_DIR="$TOP/scm"
+
+MODULE_NAME="$1"
+CURMD5="$2"
+VERS_FILE="$3"
+
+# if the given versfile does not exist, bail out with no error
+[ -f "$VERS_FILE" ] || exit 0
+
+echo "*** start of scm-handler for $MODULE_NAME ***************************"
+
+#prepare the filenames we will use for the version-increment
+LOGFILE="$SCM_DIR/scm.log"
+PREVMD5="$SCM_DIR/$MODULE_NAME.pub"
+CANDMD5="$SCM_DIR/$MODULE_NAME.cand"
+
+# write a log entry, that a scm-run for this module is executed
+echo -e "\n$(date) ************* scm-run for $MODULE_NAME" >> $LOGFILE
+
+# if the current md5-file does not exist, bail out with error
+if [ ! -f "$CURMD5" ]
+then
+    MSG="current md5-file ($CURMD5) does not exist! SCM RUN TERMINATED!"
+    echo "$MSG"
+    echo "$MSG" >> $LOGFILE
+    exit 6
+fi
+
+
+# check if the current md5-file has the same content as in the
+# candidate md5-file, if yes bail out without error
+if diff -q "$CURMD5" "$CANDMD5" > /dev/null 2>&1
+then
+    MSG="cand. and curr. md5-files are equal, nothing to do!"
+echo "$MSG"
+    echo "$MSG" >> $LOGFILE
+    exit 0
+fi
+
+# check if the candidate md5-file does exist
+if [ ! -f "$CANDMD5" ]
+then
+    MSG="candidate md5-file does not exist."
+    echo "$MSG"
+    echo "$MSG" >> $LOGFILE
+
+    # if candidate-md5-file does not exist
+    # the last published too should not exist
+    if ! cp "$CURMD5" "$CANDMD5"
+    then
+        STATUS=$?
+        MSG="unable to create the candidate-md5-file"
+        echo "$MSG"
+        echo "$MSG" >> $LOGFILE
+        exit $STATUS
+    fi
+
+    # turn this on later
+    cvs add "$CANDMD5"
+    exit 0
+fi
+
+
+# if we reach this line, cand. and curr md5-file do exist
+# and differ in content
+MSG="cand. and curr. md5-files are different."
+echo "$MSG"
+echo "$MSG" >> $LOGFILE
+
+# check if the current md5-file has the same content as in the
+# previously published md5-file, if yes bail out without error
+if diff -q "$CANDMD5" "$PREVMD5" > /dev/null 2>&1
+then
+    CAND_PREV_EQUAL=1
+else
+    CAND_PREV_EQUAL=0
+fi
+
+# if the candidate-md5-file does exist, 
+# copy the current md5-file into the candidate-md5-file
+if ! cp "$CURMD5" "$CANDMD5"
+then
+    STATUS=$?
+    MSG="unable to update the candidate-md5-file"
+    echo "$MSG"
+    echo "$MSG" >> $LOGFILE
+    exit $STATUS
+fi
+
+if [ $CAND_PREV_EQUAL -eq 0 ]
+then
+    MSG="candidate and prev. published md5-files differ, nothing to do!"
+echo "$MSG"
+    echo "$MSG" >> $LOGFILE
+    exit
+fi
+
+# if a candidate file does not exist, the version has to be incremented
+OLDVERS=$(cat "$VERS_FILE")
+NEWVERS=$($BUILD_DIR/increment-release.sh $OLDVERS)
+MSG="version incremented from $OLDVERS to $NEWVERS"
+echo "$MSG"
+echo "$MSG" >> $LOGFILE
+echo $NEWVERS > $VERS_FILE
+
+# trigger a rebuild ( of this module )...
+touch "$BUILD_DIR/version-rebuild"
+
+echo "*** end of scm-handler for $MODULE_NAME *****************************"
diff --git a/build/scm.txt b/build/scm.txt
new file mode 100644
index 0000000..aa4f73e
--- /dev/null
+++ b/build/scm.txt
@@ -0,0 +1,117 @@
+SCM-Build
+---------
+
+(scm = software configuration management ?)
+
+(1) "scm" is a '.phony' target, implemented in Makefile.env
+    ( just like "out", "CC", "GCC", "ICC", "VC++", "debug",
+                "profile", "release", "purify", "purecov" )
+
+
+(2) "make scm" triggers the scm-target in Makefile.env,
+    the actions are:
+
+    @ echo scm > $(TOP)/build/BUILD.$(OS)
+    @ $(MAKE) TOP=$(TOP) -f $(TOP)/build/Makefile.env rebuild-dirlinks
+
+    - no actual compilation/linkage is performed
+    - the string "scm" is written into the build-file: build/BUILD.linux for instance
+        switching the build-system into "scm-mode"
+    - the directory links are rebuild (why?)
+
+
+(3) if the build-system is in "scm-mode", Makefile.env configures
+    makefile-variables like that:
+
+    ifeq (scm,$(BUILD))
+        DEBUG := -DNDEBUG
+        BUILDTYPE = rel
+        CHECKSUM := --checksum
+    endif
+
+    that means:
+        - a build in "scm-mode" is performed like a release-build
+        - the makefile-variable CHECKSUM is set to the value "--checksum"
+
+
+(4) the makefile-variable CHECKSUM is used in these Makefiles:
+        Makefile.cc, Makefile.gcc, Makefile.icc, Makefile.vc++
+    these 4 Makefiles add $CHECKSUM to the parameter-list of
+        CC, CP, LD and LP ( the platform specific compile- and link-scripts )
+
+
+(5) $CC and $CP gets called, because Makefile.rules do use them in their
+        list of rules that build the different kinds of object-files
+
+
+(6) $LD gets called, because it appears in the Makefile of every single
+        module, in the rule to build the final libs/binaries
+    $LP looks like never called by our build-system ( we do not link c++ targets ?)
+
+
+(7) the compiler-scripts cc.sh, win-cc.sh and sun-cc.sh pick up the "--checksum"
+        parameter and set the shell-variable CHECKSUM to 0 or 1
+
+
+(8) the cc.sh - script:
+    - ( in scm-mode ) performs a check that the target is not
+        undefined or malformed
+
+    - calls the compiler to build the object-file
+    
+    ( in scm-mode only )
+    - calls: strip $TARG.$OBJX -o $TARG.stripped.$OBJX
+        to strip away the symbol-names: renaming a variable
+        does not create a different checksum after that
+    - calls: MD5RES=`md5sum -b $TARG.stripped.$OBJX`
+        create a md5-sum of the stripped obj-file
+    - calls: rm -f "$TARG.stripped.$OBJX" || true
+        to remove the stripped obj-file
+    - calls: MD5VALUE=${MD5RES:0:32}
+        to pick the md5-sum only ( not the following filename )
+    - calls: echo "$TARG.$OBJX=$MD5VALUE" > "$TARG.md5"
+        creates a md5-file for every obj-file, that contains
+        the name of the obj-file followed by it's md5-sum
+
+(9) the ld.sh - script:
+    - to perform the link operation the ld.sh-script calls this script:
+        "$SCRIPT_BASE.$OS.$TYPE.sh"
+      ( which becomes: ld.linux.slib.sh / ld.linux.dlib.sh / 
+        ld.linux.exe.sh for instance )
+
+(10) the ld.linux.slib.sh / ld.linux.dlib.sh / ld.linux.exe.sh - scripts:
+    - define a shell-variable "SLIBS"
+    - accumulate the static-libs the target depends on in this shell-variable
+    - after producing the target, call the script: "scm-collect.sh"
+    - parameter to this call is the list of obj-file ($OBJS) and
+      the static dependencies ($SLIBS)
+
+(11) the scm-collect.sh - script:
+    - loops through the given obj-files and static dependencies
+    - for every item in the list it looks for its corresponding md5-file
+    - if the file exists and is readable
+    - prints the content of the file to stdout
+
+(12) back in the ld.linux.slib.sh / ld.linux.dlib.sh / ld.linux.exe.sh - scripts:
+    - pipe the output of the scm-collect.sh - script
+      through "sort -u" and redirect the output to "$TARG.md5"
+      ( sort -u to makes the file canonical and removes double dependencies )
+    - this creates a md5-file for every lib/executable built
+      in the output-directory of the module
+      (for the kfs-module for instance the files "libkfs.a.md5" and
+       "libkfs.so.md5" are created in "output/centos/scm/gcc/x86_64/lib"
+    - these files are the "current-md5-file" for the scm.sh-script
+
+(13) back in the ld.sh - script:
+    - after creating the soft-links for the lib/executable
+    - if in scm-mode and building for linux,
+    - if building a dynamic-lib or an executable,
+    - the "scm.sh" - script is called
+    - the parameters are: module-name, current-md5-file and version-file
+
+(14) the scm.sh - script:
+    - creates a scm-dir underneath the build-dir (if it does not exist)
+    - checks if the current-md5-file exists ( exits with error if not )
+    - compares the current-md5-file with the candidate-md5-file
+      ( exits with exit-code=0 if they are identical = nothing to do )
+    - 
\ No newline at end of file
diff --git a/build/sun-c++.sh b/build/sun-c++.sh
new file mode 100755
index 0000000..0bd8c07
--- /dev/null
+++ b/build/sun-c++.sh
@@ -0,0 +1,100 @@
+#!/bin/bash
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+# prepare script name
+SELF_NAME="$(basename $0)"
+SCRIPT_BASE="${0%.sh}"
+
+# os
+OS="$1"
+shift
+
+# binary compiler
+CC="$1"
+shift
+
+# configuration
+unset TARG
+unset ARGS
+CHECKSUM=0
+OBJX=o
+
+while [ $# -ne 0 ]
+do
+
+    case "$1" in
+    --cflags)
+        ARGS="$ARGS $2"
+        shift
+        ;;
+
+    --checksum)
+        CHECKSUM=1
+        ;;
+
+    --objx)
+        OBJX="$2"
+        shift
+        ;;
+
+    -o*)
+        ARGS="$ARGS $1"
+        ARG="${1#-o}"
+        if [ "$ARG" = "" ]
+        then
+            ARGS="$ARGS $2"
+            ARG="$2"
+            shift
+        fi
+        TARG="$ARG"
+        ;;
+
+    -xpg|-xO3)  # optimized
+        ARGS="$ARGS -${1#-x}"
+        ;;
+
+    -xc99=all)
+        ARGS="$ARGS -std=c99"
+        ;;
+
+    -Xc) # strict ansi
+        ARGS="$ARGS -ansi"
+        ;;
+
+    -v) # strict strict strict
+        ;;
+
+    *)
+        ARGS="$ARGS $1"
+        ;;
+        
+    esac
+
+    shift
+done
+
+CMD="$CC $ARGS"
+echo "$CMD"
+$CMD || exit $?
diff --git a/build/sun-cc.sh b/build/sun-cc.sh
new file mode 100755
index 0000000..ef3dc9f
--- /dev/null
+++ b/build/sun-cc.sh
@@ -0,0 +1,93 @@
+#!/bin/bash
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+# prepare script name
+SELF_NAME="$(basename $0)"
+SCRIPT_BASE="${0%.sh}"
+
+# os
+OS="$1"
+shift
+
+# binary compiler
+CC="$1"
+shift
+
+# configuration
+unset TARG
+unset ARGS
+CHECKSUM=0
+OBJX=o
+
+while [ $# -ne 0 ]
+do
+
+    case "$1" in
+    --cflags)
+        ARGS="$ARGS $2"
+        shift
+        ;;
+
+    --checksum)
+        CHECKSUM=1
+        ;;
+
+    --objx)
+        OBJX="$2"
+        shift
+        ;;
+
+    -o*)
+        ARGS="$ARGS $1"
+        ARG="${1#-o}"
+        if [ "$ARG" = "" ]
+        then
+            ARGS="$ARGS $2"
+            ARG="$2"
+            shift
+        fi
+        TARG="$ARG"
+        ;;
+
+    -fPIC)
+        ARGS="$ARGS -KPIC"
+        ;;
+
+    -MD)
+        ARGS="$ARGS -xMD"
+        ;;
+
+    *)
+        ARGS="$ARGS $1"
+        ;;
+        
+    esac
+
+    shift
+done
+
+CMD="$CC $ARGS"
+echo "$CMD"
+$CMD || exit $?
diff --git a/build/tag-module.sh b/build/tag-module.sh
new file mode 100755
index 0000000..12fb498
--- /dev/null
+++ b/build/tag-module.sh
@@ -0,0 +1,213 @@
+#!/bin/bash
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+# check for '-F' switch
+if [ "$1" = "-F" ]
+then
+    CVSTAG="cvs tag $1"
+    shift 1
+else
+    CVSTAG="cvs tag"
+fi
+
+# check for '-V' switch
+if [ "$1" = "-V" ]
+then
+    VERSFILE="$2"
+    shift 2
+else
+    VERSFILE=""
+fi
+
+# gather parameters
+TOP=$(dirname $0)
+cd $TOP/..
+TOP=$(pwd)
+MODULE=$1
+LIBRARY=$2
+shift 2
+
+# version file
+if [ "$VERSFILE" = "" ]
+then
+    if [ ! -r $MODULE/$LIBRARY.vers ]
+    then
+        echo "cannot access $MODULE/$LIBRARY.vers"
+        exit 1
+    fi
+
+    VERSFILE="$MODULE/$LIBRARY.vers"
+fi
+
+# version
+VERSION=$(cat $VERSFILE)
+
+# build parameters
+BUILD=$(cat ./build/BUILD)
+COMP=$(cat ./build/COMP)
+OUTDIR=$(cat ./build/OUTDIR)
+cd $OUTDIR
+OUTDIR=$(pwd)
+cd -
+
+# architecture
+ARCH=$(uname -m)
+if [ "$ARCH" = "i486" ] || [ "$ARCH" = "i586" ] || [ "$ARCH" = "i686" ]
+then
+    ARCH=i386
+fi
+
+# object directory
+OBJDIR=$OUTDIR/$BUILD/$COMP/$ARCH/obj/$MODULE
+if [ ! -d $OBJDIR ]
+then
+    echo "cannot access $OBJDIR"
+    exit 1
+fi
+
+# tag name
+TAGVERS=$(echo $VERSION | tr '.' '_')
+if [ "$BUILD" = "rel" ]
+then
+    TAG="$LIBRARY-$TAGVERS"
+else
+    TAG="$BUILD-$LIBRARY-$TAGVERS"
+fi
+
+# include make files in sources
+SOURCES="$(find build -name 'Makefile*' -a ! -name '*~')"
+if [ -f $MODULE/Makefile ]
+then
+    SOURCES="$SOURCES $MODULE/Makefile"
+fi
+
+# also include the version file if within the module
+if [ "$VERSFILE" = "$MODULE/$LIBRARY.vers" ]
+then
+    SOURCES="$SOURCES $VERSFILE"
+fi
+
+# allow direct specification of source files
+if [ "$1" = "-S" ]
+then
+    shift
+
+    # take list of sources as given
+    for sfile in $*
+    do
+
+        # source file must be within our tree
+        if [ "$sfile" = "${sfile#$TOP}" ]
+        then
+
+            # get path portion of source file
+            spath=$(dirname $sfile)
+
+            # look for absolute or project relative
+            if [ -f "$sfile" ]
+            then
+                cd "$spath"
+                spath="$(pwd)"
+                cd -
+
+            # look for module relative
+            elif [ -f "$MODULE/$sfile" ]
+            then
+                cd "$MODULE/$spath"
+                spath="$(pwd)"
+                cd -
+            fi
+
+            # retest path
+            if [ "$spath" = "${spath#$TOP}" ]
+            then
+                echo "source file '$sfile' is not within project"
+                exit 1
+            fi
+
+            # create full path
+            sfile="$spath/$(basename $sfile)"
+        fi
+
+        # crop it
+        sfile="${sfile#$TOP/}"
+        SOURCES="$SOURCES $sfile"
+
+    done
+
+else
+
+    # derive source files from dependency files
+    for ofile in $*
+    do
+        # create dependency file name
+        dfile=${ofile%o}d
+
+        # test for it
+        if [ ! -r $OBJDIR/$dfile ]
+        then
+            echo "cannot locate dependency file '$OBJDIR/$dfile'"
+            exit 1
+        fi
+
+        # read it
+        for sfile in $(cat $OBJDIR/$dfile)
+        do
+            # source file must be within our tree
+            # and should not be a generated version include
+            if [ "$sfile" != "${sfile#$TOP}" ] && [ "$sfile" = "${sfile%.vers.h}" ]
+            then
+                # crop it
+                sfile="${sfile#$TOP/}"
+
+                # special case include files in 'inc'
+                # in order to catch all configurations
+                if [ "$sfile" != "${sfile#inc/}" ]
+                then
+                    sfile=$(basename $sfile)
+                    sfile="$(find inc -name $sfile)"
+                fi
+            
+                SOURCES="$SOURCES $sfile"
+            fi
+
+        done
+
+    done
+fi
+
+# must have source files
+if [ "$SOURCES" = "" ]
+then
+    echo "no source files could be found for $LIBRARY"
+    exit 1
+fi
+
+# reduce them to an unique set
+SOURCES="$(echo "$SOURCES" | tr ' ' '\n' | sort -u | tr '\n' ' ')"
+
+# apply tag
+echo -e "\ntagging $TAG within $MODULE"
+$CVSTAG $TAG $SOURCES
diff --git a/build/wait_for_file.sh b/build/wait_for_file.sh
new file mode 100755
index 0000000..dd6059e
--- /dev/null
+++ b/build/wait_for_file.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+# wait for a file to become available (used in remote builds to handle delays introduced by the network file system)
+# $1 - file to wait for
+# $2 - timeout (seconds), optional, default 120s
+# return codes: 
+#   0 ok, 
+#   1 timed out, 
+#   2 no file specified, 
+#   3 timeout not numeric
+
+if [ "$1" != "" ] 
+then
+    FILE=$1
+else
+    echo "$0 $*: no file specified" >&2
+    exit 2
+fi     
+
+if [ "$2" == "" ] 
+then 
+    TIMEOUT=120
+elif [[ $2 =~ ([0-9])+ ]]
+then 
+    TIMEOUT=$2
+else
+    echo "$0 $*: timeout not a number" >&2
+    exit 3
+fi
+
+for (( i=0; i < ${TIMEOUT}; i++ ))
+do
+    # give nfs a nudge
+    ls $(dirname $FILE) >/dev/null  
+    if [ -e ${FILE} ]
+    then
+        exit 0
+    fi 
+    echo "waiting for '$FILE' ..."
+    sleep 1s
+done
+exit 1
diff --git a/build/win-cc.sh b/build/win-cc.sh
index 9aee096..98900eb 100755
--- a/build/win-cc.sh
+++ b/build/win-cc.sh
@@ -201,6 +201,7 @@ then
 else
     # determine current directory
     CURDIR="$(pwd)"
+	if [ "$VERBOSE" != "" ] ; then echo "${TOP}/build/run_remotely.sh $PROXY_TOOL $RHOST $RPORT $RHOME $LHOME $CURDIR $ROUTDIR $LOUTDIR $CMD"; fi
     ${TOP}/build/run_remotely.sh $PROXY_TOOL $RHOST $RPORT $RHOME $LHOME $CURDIR $ROUTDIR $LOUTDIR $CMD > $TARG.out 2> $TARG.err
     STATUS=$?
 fi
diff --git a/configuration-assistant.perl b/configuration-assistant.perl
deleted file mode 100755
index 08e23ba..0000000
--- a/configuration-assistant.perl
+++ /dev/null
@@ -1,1228 +0,0 @@
-#!/usr/bin/perl -w
-
-################################################################################
-# N.B. Run "perl configuration-assistant.perl" if you see a message like:
-# configuration-assistant.perl: /usr/bin/perl: bad interpreter: No such file or directory
-################################################################################
-my $VERSION = '2.3.5-2';
-################################################################################
-
-use strict;
-
-use Cwd "getcwd";
-use Fcntl ':mode';
-use File::Basename qw(basename dirname);
-use File::Path "mkpath";
-use File::Spec;
-use Getopt::Long "GetOptions";
-use IO::Handle;
-use Getopt::Long "GetOptions";
-
-sub println { print @_; print "\n"; }
-
-STDOUT->autoflush(1);
-
-my $R = 1;
-my $W = 2;
-my $X = 4;
-my $CREATED = 8;
-my $FOUND = 16;
-my $RWX = $FOUND + $R + $W + $X;
-
-println "==========================================";
-println "Welcome to the SRA Toolkit Configuration Script.";
-println "SRA toolkit documentation:";
-println "http://www.ncbi.nlm.nih.gov/Traces/sra/std";
-println "==========================================\n";
-
-my %options;
-Help(1) unless (GetOptions(\%options, 'fix', 'help', 'version', 'wordy'));
-Help(0) if ($options{help});
-Version() if ($options{version});
-
-$options{references} = 1 if ($#ARGV >= 0);
-
-printOS();
-println "cwd = '" . getcwd() . "'\n";
-
-my $DECRYPTION_PKG;
-{
-    my ($fastq_dump, $fastq_dir) = FindBin("fastq-dump", "optional");
-    my ($sam_dump, $sam_dir) = FindBin("sam-dump", "optional");
-    if (! $fastq_dump && ! $sam_dump) {
-        println "presuming to be run in decryption package";
-        $DECRYPTION_PKG = 1;
-    }
-}
-
-my ($VDB_CONFIG, $BIN_DIR) = FindBin("vdb-config");
-
-my %kfg;
-Kfg(\%kfg, 'read', 'Reading configuration');
-umask 0002;
-my $fixed = FixKfg(\%kfg);
-if ($fixed) {
-    undef %kfg;
-    Kfg(\%kfg, 'read', 'Checking configuration');
-}
-#DoKryptoCfg(\%kfg);
-
-################################################################################
-# FUNCTIONS #
-################################################################################
-
-sub Ask {
-    my ($prompt) = @_;
-
-    print "$prompt: ";
-
-    my $in = <STDIN>;
-    unless ($in) {
-        println;
-        return "";
-    }
-
-    chomp $in;
-    return $in;
-}
-
-sub AskYn { return AskYN($_[0], 'yes');}
-sub AskyN { return AskYN($_[0], 'no' );}
-
-sub AskYN {
-    my ($q, $yes) = @_;
-
-    $yes = '' if ($yes eq 'no');
-
-    print "$q ";
-
-    if ($yes) {
-        print "[Y/n] ";
-    } else {
-        print "[y/N] ";
-    }
-
-    my $in = <STDIN>;
-    chomp $in;
-    if ($in) {
-        return $in eq 'Y' || $in eq 'y'
-          || $in eq 'YES' || $in eq 'yes' || $in eq 'Yes';
-    } else {
-        return $yes;
-    }
-}
-
-sub AskRefseqChange {
-    my ($refseq) = @_;
-
-    die unless ($refseq);
-
-    my $force;
-
-    while (1) {
-        my $read = -r $refseq && -x $refseq;
-        println "Your repository directory is $refseq.";
-        my $dflt;
-        if ($read) {
-            println "It is read-only. You cannot add new sequences to it.";
-            $dflt = "1";
-        } else {
-            println "You cannot read it.";
-            $dflt = "2";
-        }
-        println "Make your choice:";
-        println "1) Use existing repository";
-        println "2) Use a different repository";
-        println "3) exit the script";
-        print "Your selection? [$dflt] ";
-
-        my $in = <STDIN>;
-        chomp $in;
-        $in = $dflt unless ($in);
-
-        if ($in eq "1") {
-            unless ($read) {
-                Fatal(
-"Ask the owner of $refseq to allow you access $refseq directory\n" .
-"Otherwise the dumpers will not be able to find reference files"
-                );
-            }
-            return ($refseq, 'READ^ONLY');
-        }
-
-        if ($in eq "2") {
-            last;
-        }
-
-        exit 0 if ($in eq "3");
-    }
-
-    my ($path, $perm) = MakeRefseqDir();
-
-    return ($path, '');
-}
-
-sub Home {
-    if ($ENV{HOME}) {
-        return $ENV{HOME};
-    } elsif ($ENV{USERPROFILE}) {
-        return $ENV{USERPROFILE};
-    } else {
-        return '';
-    }
-}
-
-sub MakeRefseqDir {
-    my $deflt;
-    if ($^O eq 'cygwin' and $ENV{USERPROFILE}) {
-        $deflt = $ENV{USERPROFILE};
-        $deflt =~ tr|\\|/|;
-        $deflt =~ s|^([a-zA-Z]):/|/$1/|;
-        if ($1) {
-            $deflt = "/cygdrive$deflt";
-        }
-    } else {
-        $deflt = Home();
-    }
-    unless ($deflt) {
-        $deflt = getcwd();
-    }
-    $deflt = "." unless($deflt);
-    $deflt = File::Spec->catdir($deflt, "ncbi", "refseq");
-
-    while (1) {
-        my $path;
-        print "Specify installation directory for reference objects";
-        if ($deflt) {
-            print " [$deflt]";
-        }
-        print ": ";
-
-        my $in = <STDIN>;
-        unless ($in) {
-            println;
-            $path = "";
-        }
-        chomp $in;
-        if ($in) {
-            $path = $in;
-        } elsif ($deflt) {
-            $path = $deflt;
-        }
-        exit 1 unless ($path);
-        my ($prm_org, $perm) = CheckDir($path, "create_missing");
-        my $prm = $prm_org;
-        my $created = $prm & $CREATED;
-        $prm &= $RWX;
-        if ($prm == $RWX || ($^O eq 'cygwin' and $created == $CREATED)) {
-            return ($path, $prm_org);
-        } elsif ($prm & $FOUND) {
-            println "'$path' does not seem to be writable.";
-            println "You will not be able to add new sequences to it.";
-            if (AskyN("Do you want to use it?")) {
-                return ($path, $prm_org);
-            }
-        }
-    }
-}
-
-sub Posixify {
-    ($_) = @_;
-
-    # convert to POSIX path
-    s|^/cygdrive/|/|;
-    tr|\\|/|;
-    s|^([a-zA-Z]):/|/$1/|;
-
-    return $_;
-}
-
-sub printOS {
-    my $fail;
-    if ($^O eq 'MSWin32') {
-        $fail = system('ver');
-    }
-    else {
-        $fail = system('uname -a');
-        if ($fail) {
-            $fail = system('ver');        
-        }
-    }
-    if ($fail) {
-        println "Operating system: '$^O'";
-    }
-}
-
-sub Version {
-      my $bin = basename($0);
-      print << "END";
-$bin version $VERSION
-END
-
-      exit 0;
-}
-
-sub Help {
-    my ($exit) = @_;
-    $exit = 0 unless ($exit);
-      my $bin = basename($0);
-      print << "END";
-$bin version $VERSION
-
-Utility to help configure the SRA tools to be able
-to access the local reference repository,
-determine which reference sequences a SRA file relies
-upon and to fetch them from NCBI.
-Fetched references are placed in the local reference repository.
-
-Usage: $bin [--fix] [--wordy] [SRA_FILE ...]
-
-Options
--f, --fix         re-download existing reference files;
-                  fix refseq repository permissions
--v, --version     print version and exit
--w, --wordy       increase "fetcher" verbosity
-END
-
-      exit $exit;
-}
-
-sub FixRefseqCfg {
-    my ($refseq_cfg, $question, $bye) = @_;
-
-    unless (AskYn($question)) {
-        print $bye;
-        exit 1;
-    }
-
-    ($refseq_cfg->{refseq_dir}, $refseq_cfg->{refseq_dir_prm})
-        = MakeRefseqDir();
-    UpdateRefseqCfgNode($refseq_cfg->{refseq_dir});
-}
-
-sub UpdateRefseqCfgNode {
-    ($_) = @_;
-    $_ = Posixify($_);
-    UpdateConfigNode('refseq/paths' , $_);
-}
-
-sub UpdateKryptoCfgNode {
-    ($_) = @_;
-    $_ = Posixify($_);
-    UpdateConfigNode('krypto/pwfile', $_);
-}
-    
-sub UpdateConfigNode {
-    my ($name, $val) = @_;
-
-    print "'$name' => '$val': ";
-    my $cmd = "$VDB_CONFIG -s \"$name=$val\"";
-#   println "\n$cmd";
-    `$cmd`;
-    if ($?) {
-        println "error: $!";
-    } else {
-        println "updated";
-    }
-}
-
-sub DoSchemaCfg {
-    my $error;
-
-    print "checking schema configuration... ";
-
-    my $tmp = `$VDB_CONFIG vdb/schema/paths 2>&1`;
-    if ($? == 0) {
-        chomp $tmp;
-
-        if ($tmp =~ m|<paths>(.+)</paths>|) {
-            my $paths = $1;
-            println $paths;
-            my @paths = split(/:/, $paths);
-
-            $error += !CheckSchemaFile('align/align.vschema', @paths);
-            $error += !CheckSchemaFile('ncbi/seq.vschema'   , @paths);
-            $error += !CheckSchemaFile('vdb/vdb.vschema'    , @paths);
-        } else {
-            $error = "unexpected: $tmp";
-            println $error;
-        }
-    } elsif ($tmp =~ /path not found/) {
-        $error = "not found";
-        println $error;
-    } else {
-        $error = "unknown vdb-config schema error";
-        println $error;
-    }
-
-    if ($error) {
-        println "--------------------------------------";
-        println "WARNING: SCHEMA FILES CANNOT BE FOUND.";
-        println "IT COULD CAUSE LOADERS TO FAIL.";
-        println "--------------------------------------";
-    }
-
-    return ! $error;
-}
-
-sub CheckSchemaFile {
-    my ($file, @dir) = @_;
-
-    my $cygdrive = '/cygdrive';
-    my $hasCygdrive = -e '/cygdrive';
-
-    print "checking $file... ";
-
-    foreach my $dir(@dir) {
-        my $path = "$dir/$file";
-        if (-e $path) {
-            println $path;
-            return 1;
-        }
-    }
-
-    println "not found";
-
-    return 0;
-}
-
-sub CleanEmptyFiles {
-    my ($refseq_dir) = @_;
-
-    print "checking $refseq_dir for invalid empty reference files... ";
-
-    my $i = 0;
-    opendir DIR, $refseq_dir or die "cannot opendir $refseq_dir";
-    while ($_ = readdir DIR) {
-        next if (/^\.{1,2}$/);
-
-        my $f = "$refseq_dir/$_";
-
-        my $empty;
-        if (-z $f) {
-            ++$empty;
-        } elsif (-d $f) {
-            # skip a directory
-        } elsif (-s $f < 999) {
-            open F, $f or die "cannot open $f";
-            my $data = '';
-            while (<F>) {
-                while(chomp) {};
-                $data .= $_;
-            }
-            ++$empty if ($data =~ m|<title>404 - Not Found</title>|);
-        }
-        if ($empty) {
-            unlink $f or die "cannot remove $f";
-            ++$i;
-        }
-    }
-    closedir DIR;
-
-    if ($i)
-    {   println "$i found"; }
-    else
-    {   println "none found"; }
-}
-
-sub FixRefseqDirPermissions {
-    my ($dir, $read_only) = @_;
-    print "checking refseq repository...";
-    my $mode = (stat($dir))[2] & 07777;
-
-    if ($read_only) {
-        println " read-only";
-        print "\tchecking directory permissions...";
-        unless (-r $dir && -x $dir) {
-            Fatal("\n$dir cannot be accessed. "
-                . "Either update its permissions\n"
-                . "or choose another directory for refseq repository.");
-        }
-        println " OK";
-        print "\tchecking file permissions...";
-        opendir REP, $dir or die "cannot opendir $dir";
-        my $ok = 1;
-        while (my $f = readdir REP) {
-            next if ($f =~ /^\.{1,2}$/);
-            unless (-r "$dir/$f") {
-                Warn("\n$dir/$f is not readable. "
-                    . "Either update its permissions\n"
-                    . "or choose another directory for refseq repository.");
-                $ok = 0;
-            }
-        }
-        closedir REP;
-        println " OK" if $ok;
-        println "\tchecking parent directories...";
-        my @dirs = File::Spec->splitdir($dir);
-        my $p = File::Spec->rootdir;
-        while (@dirs) {
-            $_ = shift @dirs;
-            $p = File::Spec->catdir($p, $_);
-            print "\t\t$p";
-            $ok = 1;
-            unless (-r $p && -x $p) {
-                Warn("\n$p cannot be accessed. "
-                    . "Either update its permissions\n"
-                    . "or choose another directory for refseq repository.");
-                $ok = 0;
-            }
-            println " OK" if $ok;
-        }
-    } else {
-        println " writable";
-        print "\tchecking directory permissions...";
-        my $ok = 1;
-        if (($mode & 0755) != 0755) {
-            $mode |= 0755;
-            if (chmod($mode, $dir) != 1) {
-                Warn("\n$dir is not acessible by some of the users\n"
-                    . "Dumping of some files could fail if run by anoother user"
-                  );
-                $ok = 0;
-            } else { println " fixed" }
-        } else { println " OK" }
-        $ok = "OK";
-        print "\tchecking file permissions...";
-        opendir REP, $dir or die "cannot opendir $dir";
-        while (my $next = readdir REP) {
-            next if ($next =~ /^\.{1,2}$/);
-            my $f = "$dir/$next";
-            my $mode = (stat($f))[2] & 07777;
-            if (($mode & 0644) != 0644) {
-                if ($ok) {
-                    $mode |= 0644;
-                    if (chmod($mode, $f) != 1) {
-                        Warn("\n$f cannot be acessed by some of the users\n"
-                                . "Dumping of some files could fail "
-                                . "if run by anoother user");
-                        $ok = "";
-                    } else { $ok = "fixed" }
-                }
-            }
-        }
-        closedir REP;
-        println " $ok" if ($ok);
-        $ok = 1;
-        println "\tchecking parent directories...";
-        my @dirs = File::Spec->splitdir($dir);
-        my $p = File::Spec->rootdir;
-        while (@dirs) {
-            $_ = shift @dirs;
-            $p = File::Spec->catdir($p, $_);
-            print "\t\t$p";
-            my $mode = (stat($p))[2] & 07777;
-            if (($mode & 0550) != 0550) {
-                if ($ok) {
-                    $mode |= 0550;
-                    if (chmod($mode, $p) != 1) {
-                        Warn("\n$p cannot be acessed by some of the users\n"
-                                . "Dumping of some files could fail "
-                                . "if run by anoother user");
-                        $ok = 0;
-                    } else { println " fixed" }
-                }
-            } else { println " OK" }
-        }
-    }
-}
-
-################################################################################
-
-sub CheckDir {
-    my ($dir, $create_missing) = @_;
-
-    $dir = File::Spec->canonpath($dir);
-    print "checking $dir... ";
-
-    my $prm = 0;
-    unless (-e $dir) {
-        println "not found";
-        return (0, 0) unless ($create_missing);
-
-        print "checking ${dir}'s parents... ";
-        $dir = File::Spec->canonpath($dir);
-        my @dirs = File::Spec->splitdir($dir);
-        my $test = File::Spec->rootdir();
-        if ($^O eq 'MSWin32') {
-            $test = "";
-        } else {
-            Fatal("bad root directory '$test'") unless (-e $test);
-        }
-        foreach (@dirs) {
-            my $prev = $test;
-            if ($test) {
-                $test = File::Spec->catdir($test, $_);
-            } else {
-                $test = File::Spec->catdir($_, File::Spec->rootdir());
-            }
-            if (! -e $test) {
-                $test = $prev;
-                last;
-            }
-        }
-
-        print "($test)... ";
-        my $cygwin_beauty;
-# cygwin does not detect -r for $ENV{USERPROFILE}
-        if (! -r $test || ! -x $test) {
-            if ($^O eq 'cygwin') {
-                ++$cygwin_beauty;
-            } else {
-                println "not readable";
-                return (0, 0);
-            }
-        }
-        if (! -x $test) {
-            if ($^O eq 'cygwin') {
-                ++$cygwin_beauty;
-            } else {
-                println "not writable";
-                return (0, 0);
-            }
-        }
-        if ($cygwin_beauty) {
-            println("fail to check");
-        } else {
-            println("ok");
-        }
-
-        print "creating $dir... ";
-        unless (mkpath($dir)) {
-            die "cannot mkdir $dir" unless ($cygwin_beauty);
-            println "failed. Is it writable?";
-            return (0, 0);
-        }
-        println("ok");
-        $prm += $CREATED;
-        print "checking $dir... ";
-    }
-
-    my $perm = (stat($dir))[2];
-    $prm += $FOUND;
-
-    {
-        my $cygwin_beauty;
-        my $failures;
-        if (-r $dir) {
-            $prm += $R;
-        }
-        if (-w $dir) {
-            $prm += $W;
-        }
-        if (-x $dir) {
-            $prm += $X;
-        }
-
-        if (! -r $dir || ! -x $dir) {
-            if ($^O eq 'cygwin') {
-                ++$cygwin_beauty;
-            } else {
-                println "not readable";
-                ++$failures;
-            }
-        }
-        if (! $failures and ! -w $dir) {
-            if ($^O eq 'cygwin') {
-                ++$cygwin_beauty;
-            } else {
-                println "not writable";
-                ++$failures;
-            }
-        }
-        if ($cygwin_beauty) {
-            println("fail to check");
-        } elsif (!$failures) {
-            println("ok");
-        }
-    }
-
-    return ($prm, $perm);
-}
-
-sub CheckCfg {
-    print "checking refseq configuration... ";
-
-    my %konfig;
-    RefseqFromConfig(\%konfig);
-
-    if ($konfig{refseqrepository} || $konfig{servers} || $konfig{volumes})
-    {
-        if ($konfig{refseqrepository}) {
-            println "refseq/repository found:";
-        } elsif ($konfig{servers}) {
-            println "refseq/servers found:";
-        } elsif ($konfig{volumes}) {
-            println "refseq/volumes found:";
-        }
-        println "Seems to be running in NCBI environment:";
-        println "      refseq configuration fix/update is disabled;";
-        println "      reference files download is disabled.";
-        ++$options{NCBI};
-        return;
-    }
-
-    if ($konfig{paths}) {
-        println "paths=$konfig{paths}";
-    } else {
-        println "not found";
-        return %konfig;
-    }
-
-    if ($konfig{paths} and index($konfig{paths}, ":") != -1) {
-        die "Unexpected configuration: paths=$konfig{paths}";
-    }
-
-    my $dir = "$konfig{paths}";
-
-    if ($^O eq 'MSWin32') { # Windows: translate POSIX to Windows path
-        $dir =~ tr|/|\\|;
-        $dir =~ s/^\\([a-zA-Z])\\/$1:\\/;
-    } elsif ($^O eq 'cygwin' and $dir =~ m|^/[a-zA-Z]/|) {
-        $dir = "/cygdrive$dir";
-    }
-
-    $konfig{refseq_dir} = $dir;
-    my ($prm, $perm) = CheckDir($dir);
-    $konfig{refseq_dir_prm} = $prm;
-    if ($prm == 0) { # not found
-        return %konfig;
-    } elsif ($prm != $RWX) {
-        if ($^O ne 'cygwin') {
-            ++$konfig{FIX_paths};
-#           Fatal("refseq repository is invalid or read-only");
-        } # else cygwin does not always can tell permissions correctly
-    }
-    return %konfig;
-}
-
-sub FindWget {
-    my $WGET;
-
-    print "checking for wget... ";
-    my $out = `wget -h 2>&1`;
-    if ($? == 0) {
-        println "yes";
-        if ($options{fix}) {
-            $WGET = "wget -O";
-        } else {
-            $WGET = "wget -c -O";
-        }
-        ++$options{all_references};
-    } else {
-        println "no";
-    }
-
-    unless ($WGET) {
-        print "checking for curl... ";
-        my $out = `curl -h 2>&1`;
-        if ($? == 0) {
-            println "yes";
-            $WGET = "curl -o";
-            ++$options{all_references} if ($options{fix});
-        } else {
-            println "no";
-        }
-    }
-
-    unless ($WGET) {
-        print "checking for ./wget... ";
-        my $cmd = dirname($0) ."/wget";
-        my $out = `$cmd -h 2>&1`;
-        if ($? == 0) {
-            println "yes";
-            if ($options{fix}) {
-                $WGET = "$cmd -O";
-            } else {
-                $WGET = "$cmd -c -O";
-            }
-            ++$options{all_references};
-        } else {
-            println "no";
-        }
-    }
-
-    unless ($WGET) {
-        print "checking for ./wget.exe... ";
-        my $cmd = dirname($0) ."/wget.exe";
-        my $out = `$cmd -h 2>&1`;
-        if ($? == 0) {
-            println "yes";
-            if ($options{fix}) {
-                $WGET = "$cmd -O";
-            } else {
-                $WGET = "$cmd -c -O";
-            }
-            ++$options{all_references};
-        } else {
-            println "no";
-        }
-    }
-
-    Fatal("none of wget, curl could be found") unless ($WGET);
-
-    return $WGET;
-}
-
-sub FindBin {
-    my ($name, $optional) = @_;
-
-    my $prompt = "checking for $name";
-    my $basedir = dirname($0);
-
-    # built from sources
-    print "$prompt (local build)... ";
-    if (-e File::Spec->catfile($basedir, "Makefile")) {
-        my $f = File::Spec->catfile($basedir, "build", "Makefile.env");
-        if (-e $f) {
-            my $dir = `make -s bindir -C $basedir 2>&1`;
-            if ($? == 0) {
-                chomp $dir;
-                my $try = File::Spec->catfile($dir, $name);
-                print "($try";
-                if (-e $try) {
-                    print ": found)... ";
-                    my $tmp = `$try -h 2>&1`;
-                    if ($? == 0) {
-                        println "yes";
-                        return ($try, $dir);
-                    } else {
-                        println "\nfailed to run '$try -h'";
-                    }
-                } else {
-                    println ": not found)";
-                }
-            }
-        }
-    } else {
-        println "no";
-    }
-
-    # try the script directory
-    {
-        my $try = File::Spec->catfile($basedir, $name);
-        print "$prompt ($try";
-        if (-e $try) {
-            print ": found)... ";
-            my $tmp = `$try -h 2>&1`;
-            if ($? == 0) {
-                println "yes";
-                return ($try, $basedir);
-            } else {
-                println "\nfailed to run '$try -h'";
-            }
-        } else {
-            println ": not found)";
-        }
-    }
-
-    # the script directory: windows
-    {
-        my $try = File::Spec->catfile($basedir, "$name.exe");
-        print "$prompt ($try";
-        if (-e $try) {
-            print ": found)... ";
-            my $tmp = `$try -h 2>&1`;
-            if ($? == 0) {
-                println "yes";
-                return ($try, $basedir);
-            } else {
-                println "\nfailed to run '$try -h'";
-            }
-        } else {
-            println ": not found)";
-        }
-    }
-
-    # check from PATH
-    {
-        my $try = "$name";
-        print "$prompt ($try)... ";
-        my $tmp = `$try -h 2>&1`;
-        if ($? == 0) {
-            println "yes";
-            return ($try, "");
-        } else {
-            println "no";
-        }
-    }
-
-    Fatal("$name could not be found") unless ($optional);
-    return (undef, undef);
-}
-
-sub DoKryptoCfg {
-    my ($kfg) = @_;
-
-    my $v = $kfg->{'krypto/pwfile'};
-    unless ($v) {
-        println "failed to read krypto configuration";
-        return;
-    }
-
-    my $dflt = $DECRYPTION_PKG ? 'y' : 'n';
-    print "Do you want to " . ((-e $v) ? "update" : "set") . " your dbGap encryption key? [" .
-        ($DECRYPTION_PKG ? "Y/n" : "y/N") . "] ";
-    my $answer = GetYNAnswer($dflt, 'y');
-    UpdateKryptoCfg() if ($answer eq 'y');
-}
-
-sub UpdateKryptoCfg {
-    my $VDB_PASSWD = (FindBin('vdb-passwd'))[0];
-
-    my $res = system("$VDB_PASSWD -q");
-    if ($res) {
-        println "password update failed";
-    } else {
-        println "password updated ok";
-    }
-}
-
-sub RefseqConfig {
-    my ($nm) = @_;
-
-    $_ = `$VDB_CONFIG refseq/$nm 2>&1`;
-
-    if ($?) {
-        if (/path not found while opening node/) {
-            $_ = '';
-        } else {
-            die $!;
-        }
-    } else {
-        m|<$nm>(.*)</$nm>|s;
-        die "Invalid 'refseq/$nm' configuration" unless ($1);
-        # TODO die if (refseq/paths = "") : fix it
-        $_ = $1;
-    }
-
-    return $_;
-}
-
-sub RefseqFromConfig {
-    my ($refseq) = @_;
-
-    $refseq->{paths} = RefseqConfig('paths');
-    $refseq->{refseqrepository} = RefseqConfig('repository');
-    $refseq->{servers} = RefseqConfig('servers');
-    $refseq->{volumes} = RefseqConfig('volumes');
-}
-
-sub GetKfgNode {
-    my ($nm, $specPrnt) = @_;
-
-    print "$nm: ";
-
-    @_ = split(/\//, $nm);
-    die "GetKfgNode($nm)" if ($#_ < 0);
-    my $leaf = $_[$#_];
-
-    $_ = `$VDB_CONFIG $nm 2>&1`;
-
-    if ($?) {
-        if (/path not found while opening node/) {
-            $_ = '';
-        } else {
-            println;
-            die $!;
-        }
-    } else {
-        m|<$leaf>(.*)</$leaf>|s;
-        unless ($1) {
-            println;
-            die "Invalid '$nm' configuration: '$_'" 
-        }
-        $_ = $1;
-    }
-
-    if ($_) {
-        if ($specPrnt) {
-            if ($specPrnt  eq 'file') {
-                print "'$_': ";
-                if (-e $_) {
-                    println "exists";
-                } else {
-                    println "does not exist";
-                }
-            } else {
-                println "found";
-            }
-        } else {
-            println "'$_'";
-        }
-    } else {
-        println "not found";
-    }
-
-    return $_;
-}
-
-sub Kfg {
-    my ($kfg, $kfgMode, $msg) = @_;
-    my $updated;
-    my $read;
-    if ($kfgMode eq 'fix') {
-        println "\n$msg";
-    } else {
-        println "\n$msg";
-        $read = 1;
-    }
-
-    if ($read) {
-        $kfg->{dflt_user_root} = File::Spec->catdir(Home(), 'ncbi', 'public');
-    }
-
-#   my $nm = 'krypto/pwfile';
-#   if ($read) {
-#       $kfg->{$nm} = GetKfgNode($nm, 'file');
-#       if ($kfg->{$nm} eq '1' || $kfg->{$nm} eq '/.ncbi/vdb-passwd') {
-#            # fix bugs introduced by previous script version
-#            $kfg->{$nm} = '';
-#       }
-#       println;
-#   } else {
-#       if (!$kfg->{$nm}) {
-#           my $path = Posixify(
-#               File::Spec->catdir(Home(), '.ncbi', 'vdb-passwd'));
-#           UpdateConfigNode($nm, $path);
-#           $updated = 1;
-#       }
-#   }
-
-    if ($read) {
-        my $nm = 'refseq/servers';
-        $kfg->{$nm} = GetKfgNode($nm, 'file');
-
-        $nm = 'refseq/volumes';
-        $kfg->{$nm} = GetKfgNode($nm);
-        if ($kfg->{'refseq/servers'} && !($kfg->{'refseq/servers'} =~ m|^/net|)
-            && !($kfg->{'refseq/servers'} =~ m|^/panfs/|))
-        {
-            $kfg->{dflt_user_root}
-                = File::Spec->catdir($kfg->{'refseq/servers'});
-        }
-
-        $nm = 'refseq/paths';
-        $kfg->{$nm} = GetKfgNode($nm, 'file');
-        if ($kfg->{$nm} && ($kfg->{$nm} =~ m|^(.+)/refseq$|)) {
-            $kfg->{dflt_user_root} = $1;
-        }
-
-        println;
-    }
-
-
-    if ($read) {
-        my $nm = 'repository';
-        $kfg->{$nm} = GetKfgNode($nm, 'dont print');
-    }
-
-    my $disableRemoteName = 'repository/remote/main/NCBI/disabled';
-    my %remote = (
-        'repository/remote/main/NCBI/root'
-                         => 'http://ftp-trace.ncbi.nlm.nih.gov/sra',
-        'repository/remote/main/NCBI/apps/sra/volumes/fuse1000'
-                         => 'sra-instant/reads/ByRun/sra',
-        'repository/remote/main/NCBI/apps/refseq/volumes/refseq' => 'refseq',
-        'repository/remote/main/NCBI/apps/wgs/volumes/fuseWGS'   => 'wgs',
-        $disableRemoteName                                       => '',
-        'repository/remote/protected/CGI/resolver-cgi'
-                         => 'http://www.ncbi.nlm.nih.gov/Traces/names/names.cgi'
-    );
-
-    my $userRootName = 'repository/user/main/public/root';
-    my $enableCacheName = 'repository/user/main/public/cache-enabled';
-    my %user = (
-        $userRootName => '',
-        'repository/user/main/public/apps/sra/volumes/sraFlat'   => 'sra',
-        'repository/user/main/public/apps/refseq/volumes/refseq' => 'refseq',
-        'repository/user/main/public/apps/wgs/volumes/wgsFlat'   => 'wgs',
-        $enableCacheName                                         => ''
-   );
-
-    if ($read && $kfg->{repository}) {
-        my $nm = 'repository/site';
-        $kfg->{$nm} = GetKfgNode($nm, 'dont print');
-
-        println;
-    }
-
-    if ($read && $kfg->{repository}) {
-        my $nm = 'repository/remote';
-        $kfg->{$nm} = GetKfgNode($nm, 'dont print');
-    }
-
-    foreach my $nm(keys %remote) {
-        if ($read) {
-            if ($kfg->{'repository/remote'}) {
-                $kfg->{$nm} = GetKfgNode($nm);
-                unless ($kfg->{$nm}) {
-                    if ($nm ne $disableRemoteName || ! $DECRYPTION_PKG) {
-                        $kfg->{fix_remote} = 1;
-                    }
-                }
-            }
-        } else {
-            my $v = $remote{$nm};
-            if (!$kfg->{$nm}) {
-                if (!$v) {
-                    unless ($nm eq $disableRemoteName) {
-                        println "$nm: unknown";
-                        next;
-                    }
-                    next if ($DECRYPTION_PKG);
-                    print "\nWould you like to enable Remote Internet"
-                        . " access to NCBI(recommented)? [Y/n] ";
-                    my $answer = GetYNAnswer('y', 'n');
-                    if ($answer eq 'y') {
-                        $v = 'no';
-                    } else {
-                        println "You will be able to work "
-                            . "just with SRR files found locally";
-                        $v = 'yes';
-                    }
-                }
-                UpdateConfigNode($nm, $v);
-                $updated = 1;
-            } elsif ($v && ($kfg->{$nm} ne $v)) {
-                UpdateConfigNode($nm, $v);
-                $updated = 1;
-            }
-        }
-    }
-
-    if ($read && $kfg->{repository}) {
-        my $nm = 'repository/user';
-        $kfg->{$nm} = GetKfgNode($nm, 'dont print');
-    }
-
-    foreach my $nm(keys %user) {
-        if ($read) {
-            if ($kfg->{'repository/user'}) {
-                my $mode;
-                $mode = 'file' if ($nm eq $userRootName);
-                $kfg->{$nm} = GetKfgNode($nm, $mode);
-                $kfg->{fix_user} = 1 unless ($kfg->{$nm});
-            }
-        } elsif (!$kfg->{$nm}) {
-            my $v = $user{$nm};
-            unless ($v) {
-                next if ($DECRYPTION_PKG);
-                if ($nm eq $userRootName) {
-                    my $dflt = '';
-                    if ($kfg->{dflt_user_root}) {
-                        $dflt = $kfg->{dflt_user_root};
-                    }
-                    println;
-                    print
-               "The SRA Toolkit has the ability to download and cache data.\n" .
-               "Please indicate where data should be stored.\n" .
-               "You should choose a volume with enough free space.\n" .
-               "Path to your Repository ";
-                    print "[ $dflt ]: " if ($dflt);
-                    my $in = <STDIN>;
-                    chomp $in;
-                    $in = $dflt unless ($in);
-                    if (-e $in) {
-                        unless (-d $in) {
-                            println "$in: bad path";
-                        }
-                    } else {
-                        println "Directory '$in' does not exist.";
-                        print "Would you like to create it? [Y/n] ";
-                        my $answer = GetYNAnswer('y', 'y');
-                        if ($answer eq 'y') {
-                            print "'$in': creating... ";
-                            if (mkpath($in)) {
-                                println "ok";
-                            } else {
-                                println "error";
-                            }
-                        }
-                    }
-                    $v = Posixify($in);
-                } elsif ($nm eq $enableCacheName) {
-                    print
-            "\nWould you like to enable caching of downloaded data? [Y/n] ";
-                    my $answer = GetYNAnswer('y', 'y');
-                    $v = $answer eq 'n' ? 'false' : 'true';
-                } else {
-                    println "$nm: unknown";
-                    next;
-                }
-            }
-            UpdateConfigNode($nm, $v);
-            $updated = 1;
-        }
-    }
-
-    println;
-
-    if ($read) {
-        if (!$kfg->{repository} || $kfg->{fix_remote} || $kfg->{fix_user}) {
-            println "Configuration is incorrect";
-        } else {
-            println "Configuration is correct";
-        }
-    }
-
-    return $updated;
-}
-
-sub FixKfg {
-    my ($kfg) = @_;
-
-    if (!$kfg->{repository} || $kfg->{fix_remote} || $kfg->{fix_user}) {
-        print "Your configuration is incomplete. " .
-            "Would you like to fix it? [Y/n] ";
-        my $answer = GetYNAnswer('y', 'n');
-        if ($answer eq 'y') {
-            return Kfg($kfg, 'fix', 'Fixing configuration');
-        } else {
-            println
-                "Warning: Some tools could fail without proper configuration.";
-        }
-    }
-
-    return 0;
-}
-
-sub GetYNAnswer {
-    my ($dflt, $no) = @_;
-    my $in = <STDIN>;
-    chomp $in;
-    if ($in) {
-        if ($in eq 'Y' || $in eq 'y' ||
-            $in eq 'YES' || $in eq 'yes' || $in eq 'Yes')
-        {
-            return 'y';
-        } elsif ($in eq 'N' || $in eq 'n'
-            || $in eq 'NO' || $in eq 'no' || $in eq 'No')
-        {
-            return 'n';
-        } else {
-            return $no;
-        }
-    } else {
-        return $dflt;
-    }
-}
-
-sub Fatal {
-    my ($msg) = @_;
-
-    print basename($0);
-    println ": Fatal: $msg";
-
-    exit 1;
-}
-
-sub Warn {
-    my ($msg) = @_;
-
-    print basename($0);
-    println ": WARNING: $msg";
-}
-
-# EOF #
-################################################################################
diff --git a/configure b/configure
new file mode 100755
index 0000000..3313aac
--- /dev/null
+++ b/configure
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+FILENAME="`basename $0`"
+CURDIR="`dirname $0`"
+
+if [ -z "$CURDIR" ]
+    then
+    echo configure: error: configure should be run as ./configure
+    exit 1
+fi
+
+if [ "$FILENAME" != configure -a ! -s konfigure.perl ]
+    then
+    echo configure: error: configure should be run as ./configure
+else
+    perl -v > /dev/null 2>&1 || { echo "checking for perl... no"; \
+        echo >&2 "configure: error: perl not found."; exit 1; }
+
+    cd $CURDIR
+    perl -w ./konfigure.perl $@
+fi
diff --git a/doc/help/html/abi-dump-help.html b/doc/help/html/abi-dump-help.html
deleted file mode 100644
index a3a0df7..0000000
--- a/doc/help/html/abi-dump-help.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-       "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<title>abi-dump help</title>
-</head>
-<body>
-
-<pre>
-Usage:
-  abi-dump [options] [ -A ] <accession>
-  abi-dump [options] <path>
-
-  -A|--accession <accession>       Replaces accession derived from <path> in filename(s) and deflines
-
-Options:
-
-  -O|--outdir <path>               Output directory, default is '.'
-  -N|--minSpotId <rowid>           Minimum spot id
-  -X|--maxSpotId <rowid>           Maximum spot id
-  -G|--spot-group                  Split into files by SPOT_GROUP (member name)
-  --spot-groups <[list]>           Filter by SPOT_GROUP (member): name[,...]
-  -R|--read-filter <[filter]>      Split into files by READ_FILTER value
-                                   optionally filter by a value: pass|reject|criteria|redacted
-  -T|--group-in-dirs               Split into subdirectories instead of files
-  -K|--keep-empty-files            Do not delete empty files
-  --table <table-name>             (New) Table name within SRA format, default is SEQUENCE
-
-  -h|--help                        Output a brief explantion for the program
-  -V|--version                     Display the version of the program then quit
-  -L|--log-level <level>           Logging level as number or enum string
-                                   One of (fatal|sys|int|err|warn|info) or (0-5)
-                                   Current/default is warn
-  -v|--verbose                     Increase the verbosity level of the program
-                                   Use multiple times for more verbosity
-
-Format options:
-
-  -M|--minReadLen <len>            Minimum read length to output, default is 25
-  -W|--noclip                      Do not clip quality left and right for spot
-  -F|--origfmt                     Excludes SRR accession on defline
-  -B|--noDotReads                  Do not output reads consisting mostly of dots
-</pre>
-</body>
-</html>
diff --git a/doc/help/html/abi-load-help.html b/doc/help/html/abi-load-help.html
deleted file mode 100644
index a5bbdba..0000000
--- a/doc/help/html/abi-load-help.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-       "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<title>abi-load help</title>
-</head>
-<body>
-
-<pre>
-Usage:
-  abi-load [options] -r run.xml -e experiment.xml -o output-path
-
-  -r|--run-xml                     path to run.xml describing input files
-  -e|--experiment                  path to experiment.xml
-  -o|--output-path                 target location
-
-Options:
-  -i|--input-path                  input files location, default '.'
-  -u|--input-unpacked              input files are unpacked
-  -f|--force                       force target overwrite
-  -n|--spots-number                process only given number of spots from input
-  -b|--bad-spot-number             acceptable number of spot creation errors, default is 50
-  -p|--bad-spot-percentage         acceptable percentage of spots creation errors, default is 5
-  -x|--expected                    path to expected.xml
-  -z|--xml-log                     produce XML-formatted log file
-  -s|--intensities                 [on | off] load intensity data, default is off:
-                                     Illumina: signal, intensity, noise;
-                                     AB SOLiD: signal(s);
-                                     LS454: signal, position (for SFF files ON by default).
-
-  -h|--help                        Output a brief explantion for the program.
-  -V|--version                     Display the version of the program then quit.
-  -L|--log-level <level>           Logging level as number or enum string.
-                                   One of (fatal|sys|int|err|warn|info) or (0-5)
-                                   Current/default is warn
-  -v|--verbose                     Increase the verbosity level of the program.
-                                   Use multiple times for more verbosity.
-</pre>
-
-</body>
-</html>
diff --git a/doc/help/html/bam-load-help.html b/doc/help/html/bam-load-help.html
deleted file mode 100644
index 69bc6fa..0000000
--- a/doc/help/html/bam-load-help.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-       "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<title>bam-load help</title>
-</head>
-<body>
-
-<pre>
-Usage:
-bam-load [Options] BAMFILE
-    Load a bam file.
-
-Options:
-  -o, --output=TABLEPATH    REQUIRED: path to a table where the table will be put
-  -V, --version             this will cause the program to emit the internal
-                            version number before any other action
-  -v, --verbose             extra information will be output during
-                            processing second occurrence on the command line
-                            means even more
-  -h, -?, --help            print this message
-  -l, --log-level=LEVEL     the next token will affect the logging level of
-                            the program  accepted tokens are the numbers
-                            0-15, fatal, sys, int, err, warn, info
-                          , debug1...debug10
-</pre>
-
-</body>
-</html>
diff --git a/doc/help/html/copycat-help.html b/doc/help/html/copycat-help.html
deleted file mode 100644
index 5bb9ff9..0000000
--- a/doc/help/html/copycat-help.html
+++ /dev/null
@@ -1,64 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-       "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<title>copycat help</title>
-</head>
-<body>
-
-<pre>
-copycat : 1.0.6
-
-Usage: 
-    copycat [ <options> ] src-file dst-file
-    copycat [ <options> ] src-file [src-file...] dst-dir
-    copycat [ <options> ] -o dst-dir src-file [src-file...]
-
-    options:
-      -x cache-dir         location to output cached files
-      -f                   force overwrite of existing files
-      -m magicfile         path to the magic file to use
-      -e extfile           path to the extensions file to use
-      -c classfile         path to the file class/type file
-
-    behavior is intended to mimic 'cp' to a large extent, in that
-    a single source file may be copied to a new name, or multiple
-    source files may be copied to a destination directory.
-
-    when the destination directory is specified using 'cp' semantics,
-    the directory must exist. if specified via '-o' switch, it will be
-    created if necessary.
-
-    the target file may also be a device. in the special case of
-    /dev/null, it may also act as a directory.
-
-    the '-x' option allows small files that are typed as eligible for
-    caching to be copied to the cache directory provided. the directory
-    will be created if necessary.
-    the intent is to capture top-level files, such that files are copied
-    into the flat cache directory without regard to where they were found
-    in the input hierarchy. in the case of name conflict, output files will
-    be renamed.
-
-    the class file, magic file and extension file allow new understandings
-    of files found while cataloging
-    the magic file is of the type used by the unix/linux 'file' command
-    the class file assigns file type to classes
-    the extension file assigns file extensions to file types
-
-    existing classes are 'Archive', 'Cached', 'Compressed', 'Read'
-    Archive and Compresses files are those that have contents that can
-    be examined - new types must be compiled in
-    Cached files are those affected by the -x option
-    Read files are not handled seperately by copy cat except in the catalog
-    new classes would like Read only be added to the catalog with the class
-
-    the format for the class file is lines such as the below
-        'GnuZip<tab>Compressed<lf>' with tabs and linefeeds
-
-    the format for the extension file is lines such as the below
-        'gz<tab>Compressed<lf>' with tabs and linefeeds
-</pre>
-
-</body>
-</html>
diff --git a/doc/help/html/crc32sum-help.html b/doc/help/html/crc32sum-help.html
deleted file mode 100644
index d12b31f..0000000
--- a/doc/help/html/crc32sum-help.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-       "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<title>crc32 help</title>
-</head>
-<body>
-
-<pre>
-: usage: crc32sum [<option>] file [file...]
-
-    options:
-      -c          check CRC32 against given list
-      -b          open file in binary mode
-</pre>
-
-</body>
-</html>
diff --git a/doc/help/html/fastq-dump-help.html b/doc/help/html/fastq-dump-help.html
deleted file mode 100644
index 673da36..0000000
--- a/doc/help/html/fastq-dump-help.html
+++ /dev/null
@@ -1,88 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-       "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<title>fastq-dump help</title>
-</head>
-<body>
-
-<pre>
-Usage:
-  fastq-dump [options] [ -A ] <accession>
-  fastq-dump [options] <path>
-
-INPUT
-  -A|--accession <accession>       Replaces accession derived from <path> in filename(s) and deflines
-  --table <table-name>             (New) Table name within SRA format, default is SEQUENCE
-
-PROCESSING
-
-Read Splitting                     Sequence data may be used as raw or split into individual reads
-  --split-spot                     Split spots into individual reads
-
-Full Spot Filters                  Applied to the full spot independently of --split-spot
-  -N|--minSpotId <rowid>           Minimum spot id
-  -X|--maxSpotId <rowid>           Maximum spot id
-  --spot-groups <[list]>           Filter by SPOT_GROUP (member): name[,...]
-  -W|--clip                        Apply left and right clips
-
-Common Filters                     Applied to spots when --split-spot is not set, otherwise - to individual reads
-  -M|--minReadLen <len>            Filter by sequence length >= <len>
-  -R|--read-filter <[filter]>      Split into files by READ_FILTER value
-                                   optionally filter by a value: pass|reject|criteria|redacted
-  -E|--qual-filter                 Filter used in early 1K Genomes data:
-                                   no sequences starting or ending with >= 10N
-
-Filters for individual reads       Applied only with --split-spot set
-  --skip-technical                 Dump only biological reads
-
-OUTPUT
-  -O|--outdir <path>               Output directory, default is '.'
-
-Multiple File Options              Setting this options will produce more than 1 file, which will be suffixed by splitting criteria.
-  --split-files                    Dump each read into a separate file.Files will received suffix corresponding to read number
-  --split-3                        Legacy 3-file splitting for mate-pairs:
-                                   First 2 biological reads satisfying dumping conditions
-                                   are placed in files *_1.fastq and *_2.fastq
-                                   If only 1 biological read is dumpable - it is placed in *.fastq
-                                   Biological reads 3 and above are ignored.
-  -G|--spot-group                  Split into files by SPOT_GROUP (member name)
-  -R|--read-filter <[filter]>      Split into files by READ_FILTER value
-                                   optionally filter by a value: pass|reject|criteria|redacted
-  -T|--group-in-dirs               Split into subdirectories instead of files
-  -K|--keep-empty-files            Do not delete empty files
-
-FORMATTING
-
-Sequence
-  -C|--dumpcs <[cskey]>            Formats sequence in color space (default for SOLiD),cskey may be specified for translation
-  -B|--dumpbase                    Formats sequence in base sequence (default for other than SOLiD).
-
-Quality
-  -Q|--offset <integer>            Offset to use for quality conversion, default is 33
-  --fasta                          Fasta only, no qualities
-
-Defline
-  -F|--origfmt                     Defline contains only original sequence name
-  -I|--readids                     Append read id after spot id as 'accession.spot.readid' on defline
-  --helicos                        Helicos style defline
-  --defline-seq <fmt>              Defline format specification for sequence.
-  --defline-qual <fmt>             Defline format specification for quailty.
-                                   <fmt> is string of characters and/or variables. Variables could be are one of:
-                                      $ac - accession, $si - spot id, $sn - spot name, $sg - spot group (barcode),
-                                      $sl - spot length in bases, $ri - read number, $rn - read name, $rl - read length in bases.
-                                   '[]' could be used for an optional output: if all vars in [] yield empty values whole group is not printed.
-                                   Empty value is empty string or 0 for numeric variables.
-                                   Ex: @$sn[_$rn]/$ri - '_$rn' is omitted if name is empty
-
-OTHER:
-  -h|--help                        Output a brief explantion for the program
-  -V|--version                     Display the version of the program then quit
-  -L|--log-level <level>           Logging level as number or enum string
-                                   One of (fatal|sys|int|err|warn|info) or (0-5)
-                                   Current/default is warn
-  -v|--verbose                     Increase the verbosity level of the program
-                                   Use multiple times for more verbosity
-</pre>
-</body>
-</html>
diff --git a/doc/help/html/fastq-load-help.html b/doc/help/html/fastq-load-help.html
deleted file mode 100644
index 340022a..0000000
--- a/doc/help/html/fastq-load-help.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-       "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<title>fastq-load help</title>
-</head>
-<body>
-
-<pre>
-Usage:
-  fastq-load [options] -r run.xml -e experiment.xml -o output-path
-
-  -r|--run-xml                     path to run.xml describing input files
-  -e|--experiment                  path to experiment.xml
-  -o|--output-path                 target location
-
-Options:
-  -i|--input-path                  input files location, default '.'
-  -u|--input-unpacked              input files are unpacked
-  -f|--force                       force target overwrite
-  -n|--spots-number                process only given number of spots from input
-  -b|--bad-spot-number             acceptable number of spot creation errors, default is 50
-  -p|--bad-spot-percentage         acceptable percentage of spots creation errors, default is 5
-  -x|--expected                    path to expected.xml
-  -z|--xml-log                     produce XML-formatted log file
-  -s|--intensities                 [on | off] load intensity data, default is off:
-                                     Illumina: signal, intensity, noise;
-                                     AB SOLiD: signal(s);
-                                     LS454: signal, position (for SFF files ON by default).
-
-  -h|--help                        Output a brief explantion for the program.
-  -V|--version                     Display the version of the program then quit.
-  -L|--log-level <level>           Logging level as number or enum string.
-                                   One of (fatal|sys|int|err|warn|info) or (0-5)
-                                   Current/default is warn
-  -v|--verbose                     Increase the verbosity level of the program.
-                                   Use multiple times for more verbosity.
-</pre>
-
-</body>
-</html>
diff --git a/doc/help/html/illumina-dump-help.html b/doc/help/html/illumina-dump-help.html
deleted file mode 100644
index 6257a70..0000000
--- a/doc/help/html/illumina-dump-help.html
+++ /dev/null
@@ -1,48 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-       "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<title>illumina-dump help</title>
-</head>
-<body>
-
-<pre>
-Usage:
-  illumina-dump [options] [ -A ] <accession>
-  illumina-dump [options] <path>
-
-  -A|--accession <accession>       Replaces accession derived from <path> in filename(s) and deflines
-
-Options:
-
-  -O|--outdir <path>               Output directory, default is '.'
-  -N|--minSpotId <rowid>           Minimum spot id
-  -X|--maxSpotId <rowid>           Maximum spot id
-  -G|--spot-group                  Split into files by SPOT_GROUP (member name)
-  --spot-groups <[list]>           Filter by SPOT_GROUP (member): name[,...]
-  -R|--read-filter <[filter]>      Split into files by READ_FILTER value
-                                   optionally filter by a value: pass|reject|criteria|redacted
-  -T|--group-in-dirs               Split into subdirectories instead of files
-  -K|--keep-empty-files            Do not delete empty files
-  --table <table-name>             (New) Table name within SRA format, default is SEQUENCE
-
-  -h|--help                        Output a brief explantion for the program
-  -V|--version                     Display the version of the program then quit
-  -L|--log-level <level>           Logging level as number or enum string
-                                   One of (fatal|sys|int|err|warn|info) or (0-5)
-                                   Current/default is warn
-  -v|--verbose                     Increase the verbosity level of the program
-                                   Use multiple times for more verbosity
-
-Format options:
-
-  -r|--read                        Output READ: "seq", default is on
-  -q|--qual1 <1|2>                 Output QUALITY, whole spot (1) or split by reads (2): "qcal", default is 1
-  -p|--qual4                       Output full QUALITY: "prb", default is off
-  -i|--intensity                   Output INTENSITY, if present: "int", default is off
-  -n|--noise                       Output NOISE, if present: "nse", default is off
-  -s|--signal                      Output SIGNAL, if present: "sig2", default is off
-  -x|--qseq <1|2>                  Output QSEQ format: whole spot (1) or split by reads: "qseq", default is off
-</pre>
-</body>
-</html>
diff --git a/doc/help/html/illumina-load-help.html b/doc/help/html/illumina-load-help.html
deleted file mode 100644
index b20fea4..0000000
--- a/doc/help/html/illumina-load-help.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-       "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<title>illumina-load help</title>
-</head>
-<body>
-
-<pre>
-Usage:
-  illumina-load [options] -r run.xml -e experiment.xml -o output-path
-
-  -r|--run-xml                     path to run.xml describing input files
-  -e|--experiment                  path to experiment.xml
-  -o|--output-path                 target location
-
-Options:
-  -i|--input-path                  input files location, default '.'
-  -u|--input-unpacked              input files are unpacked
-  -f|--force                       force target overwrite
-  -n|--spots-number                process only given number of spots from input
-  -b|--bad-spot-number             acceptable number of spot creation errors, default is 50
-  -p|--bad-spot-percentage         acceptable percentage of spots creation errors, default is 5
-  -x|--expected                    path to expected.xml
-  -z|--xml-log                     produce XML-formatted log file
-  -s|--intensities                 [on | off] load intensity data, default is off:
-                                     Illumina: signal, intensity, noise;
-                                     AB SOLiD: signal(s);
-                                     LS454: signal, position (for SFF files ON by default).
-
-  -h|--help                        Output a brief explantion for the program.
-  -V|--version                     Display the version of the program then quit.
-  -L|--log-level <level>           Logging level as number or enum string.
-                                   One of (fatal|sys|int|err|warn|info) or (0-5)
-                                   Current/default is warn
-  -v|--verbose                     Increase the verbosity level of the program.
-                                   Use multiple times for more verbosity.
-</pre>
-
-</body>
-</html>
diff --git a/doc/help/html/kar-help.html b/doc/help/html/kar-help.html
deleted file mode 100644
index 34bbc13..0000000
--- a/doc/help/html/kar-help.html
+++ /dev/null
@@ -1,66 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-       "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<title>kar help</title>
-</head>
-<body>
-
-<pre>
-Usage:
-  kar [OPTIONS] -c|--create <Archive> -d|--directory <Directory> [Filter ...]
-  kar [OPTIONS] -x|--extract <Archive> -d|--directory <Directory>
-  kar [OPTIONS] -t|--test|--list <Archive>
-
-Summary:
-  Create, extract from, or test an archive.
-
-Archive Command:
-  All of these options require the next token on the command line to be
-  the name of the archive
-  -c|--create <archive>            Create a new archive.
-  -x|--extract <archive>           Extract the contents of an archive into a directory.
-  -t|--test <archive>              Check the structural validity of an archive
-                                   Optionally listing its contents
-
-Archive:
-  Path to a file that will/does hold the archive of other files
-
-Directory:
-    Required for create or extract command, ignored for test command
-
-Filters:
-  When present these act as include filters.
-  Any file name will be included in the extracted files, created archive
-  or test operation listing
-  Any directory will be included as well as its contents
-
-Options:
-  -d|--directory <Directory>       The next token on the command line is the
-                                   name of the directory to extract to or create
-                                   from
-  -f|--force                       (no parameter) this will cause the extract or
-                                   create to over-write existing files unless
-                                   they are write-protected.  without this
-                                   option the program will fail if the archive
-                                   already exists for a create or the target
-                                   directory exists for an extract
-  -a|--align <alignment>           Forces the alignment of files in create
-                                   mode putting the first byte of included
-                                   files at <alignment boundaries
-                                   alignment: 1|2|4|8
-                                   (default=4)
-  -l|--long-list                   more information will be given on each file
-                                   in test/list mode.
-
-  -h|--help                        Output a brief explantion for the program.
-  -V|--version                     Display the version of the program then quit.
-  -L|--log-level <level>           Logging level as number or enum string.
-                                   One of (fatal|sys|int|err|warn|info) or (0-5)
-                                   Current/default is warn
-  -v|--verbose                     Increase the verbosity level of the program.
-                                   Use multiple times for more verbosity.
-</pre>
-
-</body>
-</html>
diff --git a/doc/help/html/kdbmeta-help.html b/doc/help/html/kdbmeta-help.html
deleted file mode 100644
index e50e8cf..0000000
--- a/doc/help/html/kdbmeta-help.html
+++ /dev/null
@@ -1,50 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-       "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<title>kdbmeta help</title>
-</head>
-<body>
-
-<pre>
-Usage:
-  kdbmeta [Options] <target> {<query> ...]
-
-Summary:
-  Display the contents of one or more metadata stores.
-  The target metadata are described by one or more
-  target specifications, giving the path to a database, a table
-  or a column. the command and query are executed on each target.
-
-  queries name one or more objects, and '*' acts as a wildcard.
-  query objects are nodes or attributes. nodes are named with a
-  hierarchical path, like a file-system path. attributes are given
-  as a node path followed by a '@' followed by the attribute name.
-
-target:
-  path-to-database                 access database metadata
-  path-to-table                    access table metadata
-  path-to-column                   access column metadata
-  accession                        sra global access id
-
-query:
-  *                                all nodes and attributes
-  NAME                             a named root node and children
-  PATH/NAME                        an internal node and children
-  <node>@ATTR                      a named attribute
-  <obj>=VALUE                      a simple value assignment where
-                                   value string is text, and binary
-                                   values use hex escape codes
-
-Options:
-  -h|--help                        Output a brief explantion for the program.
-  -V|--version                     Display the version of the program then quit.
-  -L|--log-level <level>           Logging level as number or enum string.
-                                   One of (fatal|sys|int|err|warn|info) or (0-5)
-                                   Current/default is warn
-  -v|--verbose                     Increase the verbosity level of the program.
-                                   Use multiple times for more verbosity.
-</pre>
-
-</body>
-</html>
diff --git a/doc/help/html/kqsh-help.html b/doc/help/html/kqsh-help.html
deleted file mode 100644
index 26ab050..0000000
--- a/doc/help/html/kqsh-help.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-       "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<title>kqsh help</title>
-</head>
-<body>
-
-<pre>
-Usage: kqsh [ options ] [ file... ]
-
-    options:
-      -h               give tool help
-      -u               enable update operations
-      -l <path>        path(s) for loading dynamic libraries
-</pre>
-
-</body>
-</html>
diff --git a/doc/help/html/md5cp-help.html b/doc/help/html/md5cp-help.html
deleted file mode 100644
index 7ac4c8b..0000000
--- a/doc/help/html/md5cp-help.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-       "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<title>md5cp help</title>
-</head>
-<body>
-
-<pre>
-usage: md5cp [-p] [-f] [-r] [file|directory ...] directory
-
-    md5cp [-f] source_filename dest_filename
-    : Copies files and/or directories, creating an md5sum checksum (named file.md5) for all copied files.
-    
--f forces replacement of existing files.
--p forces replacement of existing modes on files and directories.
--r recurses over source directories (directories are ignored otherwise)
-</pre>
-
-</body>
-</html>
diff --git a/doc/help/html/rcexplain-help.html b/doc/help/html/rcexplain-help.html
deleted file mode 100644
index 74afb55..0000000
--- a/doc/help/html/rcexplain-help.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-       "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<title>rcexplain help</title>
-</head>
-<body>
-
-<pre>
-Usage:
-  rcexplain [Options] rc [rc ...]
-
-Summary:
-  Prints out error string to stdout for one or more return codes.
-
-Options:
-  -h|--help                        Output a brief explantion for the program.
-  -V|--version                     Display the version of the program then quit.
-  -L|--log-level <level>           Logging level as number or enum string.
-                                   One of (fatal|sys|int|err|warn|info) or (0-5)
-                                   Current/default is warn
-  -v|--verbose                     Increase the verbosity level of the program.
-                                   Use multiple times for more verbosity.
-</pre>
-
-</body>
-</html>
diff --git a/doc/help/html/sff-dump-help.html b/doc/help/html/sff-dump-help.html
deleted file mode 100644
index f50c48d..0000000
--- a/doc/help/html/sff-dump-help.html
+++ /dev/null
@@ -1,38 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-       "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<title>sff-dump help</title>
-</head>
-<body>
-
-<pre>
-Usage:
-  sff-dump [options] [ -A ] <accession>
-  sff-dump [options] <path>
-
-  -A|--accession <accession>       Replaces accession derived from <path> in filename(s) and deflines
-
-Options:
-
-  -O|--outdir <path>               Output directory, default is '.'
-  -N|--minSpotId <rowid>           Minimum spot id
-  -X|--maxSpotId <rowid>           Maximum spot id
-  -G|--spot-group                  Split into files by SPOT_GROUP (member name)
-  --spot-groups <[list]>           Filter by SPOT_GROUP (member): name[,...]
-  -R|--read-filter <[filter]>      Split into files by READ_FILTER value
-                                   optionally filter by a value: pass|reject|criteria|redacted
-  -T|--group-in-dirs               Split into subdirectories instead of files
-  -K|--keep-empty-files            Do not delete empty files
-  --table <table-name>             (New) Table name within SRA format, default is SEQUENCE
-
-  -h|--help                        Output a brief explantion for the program
-  -V|--version                     Display the version of the program then quit
-  -L|--log-level <level>           Logging level as number or enum string
-                                   One of (fatal|sys|int|err|warn|info) or (0-5)
-                                   Current/default is warn
-  -v|--verbose                     Increase the verbosity level of the program
-                                   Use multiple times for more verbosity
-</pre>
-</body>
-</html>
diff --git a/doc/help/html/sra-dump-help.html b/doc/help/html/sra-dump-help.html
deleted file mode 100644
index 8a71c82..0000000
--- a/doc/help/html/sra-dump-help.html
+++ /dev/null
@@ -1,38 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-       "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<title>sra-dump help</title>
-</head>
-<body>
-
-<pre>
-Usage:
-  sra-dump [ options ] table [ column-spec ... ]
-
-Summary:
-  Dump all data in table for specified or all columns
-
-table:
-  path to table or accession id within NCBI
-
-column-spec:
-  NAME                             simple column name
-  (typedecl)NAME                   specifically typed column name
-
-Options:
-  --start <ID>                     beginning spot id (default 1)
-  --stop <ID>                      ending spot id (default max)
-
-  -h|--help                        Output a brief explantion for the program.
-  -V|--version                     Display the version of the program then quit.
-
-  -L|--log-level <level>           Logging level as number or enum string.
-                                   One of (fatal|sys|int|err|warn|info) or (0-5)
-
-                                   Current/default is warn
-  -v|--verbose                     Increase the verbosity level of the program.
-                                   Use multiple times for more verbosity.
-</pre>
-</body>
-</html>
diff --git a/doc/help/html/sra-stat-help.html b/doc/help/html/sra-stat-help.html
deleted file mode 100644
index a1002c6..0000000
--- a/doc/help/html/sra-stat-help.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-       "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<title>sra-stat help</title>
-</head>
-<body>
-
-<pre>
-Usage:
-  sra-stat [options] table
-
-Summary:
-  Display table statistics
-
-Options:
-  -x|--xml                         output as XML (default is text)
-  -b|--start <row-id>              starting spot id ( default 1 )
-  -e|--stop <row-id>               ending spot id ( default max )
-  -m|--meta                        print load metadata
-  -q|--quick                       quick mode: get statistics from metadata
-                                   not to scan the table
-
-  -h|--help                        Output a brief explantion for the program.
-  -V|--version                     Display the version of the program then quit.
-  -L|--log-level <level>           Logging level as number or enum string.
-                                   One of (fatal|sys|int|err|warn|info) or (0-5)
-                                   Current/default is warn
-  -v|--verbose                     Increase the verbosity level of the program.
-                                   Use multiple times for more verbosity.
-</pre>
-
-</body>
-</html>
diff --git a/doc/help/html/srapath-help.html b/doc/help/html/srapath-help.html
deleted file mode 100644
index d8434e9..0000000
--- a/doc/help/html/srapath-help.html
+++ /dev/null
@@ -1,47 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-       "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<title>srapath help</title>
-</head>
-<body>
-
-<pre>
-Usage:
- srapath 1.2.0
-
-Usage: srapath [ options ] accession ...
-
-    options:
-      --server <repserver-path>       path(s) to replication server(s)
-      --volume <volume-path>          relative path(s) to volume(s)
-
-    Tool to produce a list of full paths to SRA runs from list of
-    accessions.  Output paths are ordered according to accession list.
-    with no path alteration options, the accession search path will be
-    determined according to the local installation.
-    Replication server and volume paths may be compound, adhering to the
-    Unix path convention of ':' separators, e.g.
-
-        '/server1:/server2/subdir'
-
-    The idea behind separate replication servers and volumes is to
-    allow for a matrix of volumes that can hold a run, where the volumes
-    are expected to be replicated across all repservers.  It is possible that
-    this arrangement will be violated and still work, but behavior is less
-    clearly defined.
-
-    The order of search paths is important: rather than alphabetical,
-    specify paths in the preferred order of discovery, usually giving the most
-    recently updated volumes first.  If a run appears more than once in the matrix,
-    it will be found according to the first 'repserver/volume' combination that
-    produces a hit.
-
-    Finally, this tool produces a path that is 'likely' to be a run, in that
-    an entry exists in the file system at the location predicted.  It is possible
-    that this path will fail to produce success upon opening a run if the path does
-    not point to a valid object.
-</pre>
-
-</body>
-</html>
diff --git a/doc/help/html/srf-load-help.html b/doc/help/html/srf-load-help.html
deleted file mode 100644
index e0c988f..0000000
--- a/doc/help/html/srf-load-help.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-       "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<title>srf-load help</title>
-</head>
-<body>
-
-<pre>
-Usage:
-	srf-load [options] -r run.xml -e experiment.xml -o output-path
-
-  -r|--run-xml                     path to run.xml describing input files
-  -e|--experiment                  path to experiment.xml
-  -o|--output-path                 target location
-
-Options:
-  -i|--input-path                  input files location, default '.'
-  -u|--input-unpacked              input files are unpacked
-  -f|--force                       force target overwrite
-  -n|--spots-number                process only given number of spots from input
-  -b|--bad-spot-number             acceptable number of spot creation errors, default is 50
-  -p|--bad-spot-percentage         acceptable percentage of spots creation errors, default is 5
-  -x|--expected                    path to expected.xml
-  -z|--xml-log                     produce XML-formatted log file
-  -s|--intensities                 [on | off] load intensity data, default is off:
-                                     Illumina: signal, intensity, noise;
-                                     AB SOLiD: signal(s);
-                                     LS454: signal, position (for SFF files ON by default).
-
-  -h|--help                        Output a brief explantion for the program.
-  -V|--version                     Display the version of the program then quit.
-  -L|--log-level <level>           Logging level as number or enum string.
-                                   One of (fatal|sys|int|err|warn|info) or (0-5)
-                                   Current/default is warn
-  -v|--verbose                     Increase the verbosity level of the program.
-                                   Use multiple times for more verbosity.
-</pre>
-
-</body>
-</html>
diff --git a/doc/help/html/txt2kdb-help.html b/doc/help/html/txt2kdb-help.html
deleted file mode 100644
index 47ce76b..0000000
--- a/doc/help/html/txt2kdb-help.html
+++ /dev/null
@@ -1,48 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-       "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<title>txt2kdb help</title>
-</head>
-<body>
-
-<pre>
- txt2kdb [Options] FILE KCOLUMN
-    Create a KColumn physical column out of a text file.
-
-    FILE:
-        The text file should be ASCII or UTF-8 using LF, CR or CR-LF
-        line termination.  Each text line will be put into the
-        KColumn as a separate Row.  Each Row will be in its own
-        blob.
-    KCOLUMN:
-        The KColumn is either an existing KColumn or a path to one
-        that can be created.    Both paths should be relative to the current directory or full
-    from root "/"
-
-Options:
-  -b, --begin=START         include only lines starting from this line in the
-                            KColumn.  The first line is line 1 (not 0).
-  -e, --end=STOP            stop including lines after this line in the
-                            KColumn.  The first line is line 1 (not 0).
-  -f, --force               (no parameter) this will cause to over-write
-                            existing files.  Without
-                            this option the program will fail if the KColumn
-                            already exists and append mode is not selected
-  -a, --append              (no parameter) this will cause to append the text
-                            file to an existing KColumn.  If the file does not
-                            already exist it will be created.
-  -V, --version             this will cause the program to emit the internal
-                            version number before any other action
-  -v, --verbose             extra information will be output during
-                            processing second occurrence on the command line
-                            means even more
-  -h, -?, --help            print this message
-  -l, --log-level=LEVEL     the next token will affect the logging level of
-                            the program  accepted tokens are the numbers
-                            0-15, fatal, sys, int, err, warn, info
-                          , debug1...debug10
-</pre>
-
-</body>
-</html>
diff --git a/doc/help/html/vdb-dump-help.html b/doc/help/html/vdb-dump-help.html
deleted file mode 100644
index 8e107fb..0000000
--- a/doc/help/html/vdb-dump-help.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-       "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<title>vdb-dump help</title>
-</head>
-<body>
-
-<pre>
-Usage:
-  vdb-dump <path> [options]
-
-Options:
-  -I|--row_id_on                   print row id
-  -l|--line_feed <line_feed>       line-feed's inbetween rows
-  -N|--colname_off                 do not print column-names
-  -X|--in_hex                      print numbers in hex
-  -T|--table <table>               table-name
-  -R|--rows <rows>                 rows (default = all)
-  -C|--columns <columns>           columns (default = all)
-  -S|--schema <schema>             schema-name
-  -A|--schema_dump                 dumps the schema
-  -E|--table_enum                  enumerates tables
-  -O|--column_enum                 enumerates columns in extended form
-  -o|--column_enum_short           enumerates columns in short form 
-  -D|--dna_bases <dna_bases>       print dna-bases
-  -M|--max_length <max_length>     limits line length
-  -i|--indent_width <indent_width> indents the line
-  -f|--format <format>             dump format (csv,xml,json,piped,tab)
-  -r|--id_range                    prints id-range
-  -n|--without_sra                 without sra-type-translation
-  -a|--without_accession           without accession-test
-  -x|--exclude                     exclude these columns
-  -b|--boolean                     defines how boolean's are printed (1,T) 
-
-  -h|--help                        Output a brief explantion for the program.
-  -V|--version                     Display the version of the program then quit.
-  -L|--log-level <level>           Logging level as number or enum string.
-                                   One of (fatal|sys|int|err|warn|info) or (0-5)
-                                   Current/default is warn
-  -v|--verbose                     Increase the verbosity level of the program.
-                                   Use multiple times for more verbosity.
-</pre>
-</body>
-</html>
diff --git a/doc/help/txt/abi-dump-help.txt b/doc/help/txt/abi-dump-help.txt
deleted file mode 100644
index 4ef281b..0000000
--- a/doc/help/txt/abi-dump-help.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-Usage:
-     abi-dump
-     -path <path-to-run>
-     [-outdir <outdir>] [-minSpotId <minSpotId>] [-maxSpotId <maxSpotId>] 
-     [-minReadLen <minReadLen>] [-noclip] [-origfmt] [-noDotReads]
-     <accession>
-
-Where:
-     -accession     Run accession - top level directory for SRA format either downloaded or locally generated
-     -path          Path to (but not including) accession
-     -outdir        Output directory (defaults to current directory)
-     -minSpotId     Minimum spot id to output
-     -maxSpotId     Maximum spot id to output
-     -minReadLen    Minimum read length to output (defaults is 25)
-     -noclip        Indicates don't apply clip quality right
-     -origfmt       Excludes SRR accession & length on defline
-     -noDotReads    No reads consisting only of dots are output
-     -noSignal      Do not write sginal files
-
diff --git a/doc/help/txt/abi-load-help.txt b/doc/help/txt/abi-load-help.txt
deleted file mode 100644
index 62b0e42..0000000
--- a/doc/help/txt/abi-load-help.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-Usage:
-
-abi-load <help>
-abi-load [ <options> ] <input-spec> <spot-descriptor> <output-spec> [ <verbosity> ] 
-
-input-spec:
-  ( -r | --run-xml ) path           # path to run.xml describing input files
-
-spot-descriptor:
-  ( -e | --experiment ) path            # path to experiment.xml 
-                                        # with spot descriptor
-
-output-spec:
-  <output-mode> <run-name>           # produce output to run
-
-output-mode:
-  -c | --create                      # create only new run (fail if exists)
-  -o | --output                      # create new or replace existing run
-  -a | --append                      # create new or update existing run
-
-run-name:
-  path                                  # full or working-directory relative
-                                        # file-system path to run
-
-options:
-  ( -n | --spotnumber) spots_to_run    # tells the loader to stop processing after that many spots
-                                       # helpful in testing
-
-  ( -b | --bad-spot-number ) bad_spot_number  # number of spot creation errors to be tolerated
-                                              # default = 50
-
-  ( -p | --bad-spot-percentage ) bad_spot_percentage> # PERCENTAGE of the number of bad spots against
-                                                      # the number of good spots, default = 5
-
-help:
-  ( -h | --help )                       # print usage and option details
-
-verbosity:
-  ( -l | --log-level ) <level>  #logging level: fatal|sys|int|err|warn|info default=info
-debug:
-  ( -+ | --debug ) <module>  #module: APP|KFS|XML|VDB|SRA|REF|LEGREF default=APP
diff --git a/doc/help/txt/bam-loader-help.txt b/doc/help/txt/bam-loader-help.txt
deleted file mode 100644
index 69b13de..0000000
--- a/doc/help/txt/bam-loader-help.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-Usage:
- bam-loader 0.0.1
-
-bam-loader [Options] BAMFILE
-    Load a bam file.
-
-Options:
-  -o, --output=TABLEPATH    REQUIRED: path to a table where the table will be put
-  -V, --version             this will cause the program to emit the internal
-                            version number before any other action
-  -v, --verbose             extra information will be output during
-                            processing second occurrence on the command line
-                            means even more
-  -h, -?, --help            print this message
-  -l, --log-level=LEVEL     the next token will affect the logging level of
-                            the program  accepted tokens are the numbers
-                            0-15, fatal, sys, int, err, warn, info
-                          , debug1...debug10
diff --git a/doc/help/txt/copycat-help.txt b/doc/help/txt/copycat-help.txt
deleted file mode 100644
index 964afda..0000000
--- a/doc/help/txt/copycat-help.txt
+++ /dev/null
@@ -1,53 +0,0 @@
-
-copycat : 1.0.6
-
-Usage: 
-    copycat [ <options> ] src-file dst-file
-    copycat [ <options> ] src-file [src-file...] dst-dir
-    copycat [ <options> ] -o dst-dir src-file [src-file...]
-
-    options:
-      -x cache-dir         location to output cached files
-      -f                   force overwrite of existing files
-      -m magicfile         path to the magic file to use
-      -e extfile           path to the extensions file to use
-      -c classfile         path to the file class/type file
-
-    behavior is intended to mimic 'cp' to a large extent, in that
-    a single source file may be copied to a new name, or multiple
-    source files may be copied to a destination directory.
-
-    when the destination directory is specified using 'cp' semantics,
-    the directory must exist. if specified via '-o' switch, it will be
-    created if necessary.
-
-    the target file may also be a device. in the special case of
-    /dev/null, it may also act as a directory.
-
-    the '-x' option allows small files that are typed as eligible for
-    caching to be copied to the cache directory provided. the directory
-    will be created if necessary.
-    the intent is to capture top-level files, such that files are copied
-    into the flat cache directory without regard to where they were found
-    in the input hierarchy. in the case of name conflict, output files will
-    be renamed.
-
-    the class file, magic file and extension file allow new understandings
-    of files found while cataloging
-    the magic file is of the type used by the unix/linux 'file' command
-    the class file assigns file type to classes
-    the extension file assigns file extensions to file types
-
-    existing classes are 'Archive', 'Cached', 'Compressed', 'Read'
-    Archive and Compresses files are those that have contents that can
-    be examined - new types must be compiled in
-    Cached files are those affected by the -x option
-    Read files are not handled seperately by copy cat except in the catalog
-    new classes would like Read only be added to the catalog with the class
-
-    the format for the class file is lines such as the below
-        'GnuZip<tab>Compressed<lf>' with tabs and linefeeds
-
-    the format for the extension file is lines such as the below
-        'gz<tab>Compressed<lf>' with tabs and linefeeds
-
diff --git a/doc/help/txt/crc32sum-help.txt b/doc/help/txt/crc32sum-help.txt
deleted file mode 100644
index 879f9be..0000000
--- a/doc/help/txt/crc32sum-help.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-: usage: crc32sum [<option>] file [file...]
-
-    options:
-      -c          check CRC32 against given list
-      -b          open file in binary mode
-
diff --git a/doc/help/txt/fastq-dump-help.txt b/doc/help/txt/fastq-dump-help.txt
deleted file mode 100644
index 97ec5ec..0000000
--- a/doc/help/txt/fastq-dump-help.txt
+++ /dev/null
@@ -1,57 +0,0 @@
-
-Usage:
-  fastq-dump [options] <path>
-
-Options:
-  -D, --table-path            Path to accession data.
-  -O, --outdir                Output directory. Default: '.'
-  -N, --minSpotId             Minimum spot id to output.
-  -X, --maxSpotId             Maximum spot id to output.
-  -G, --spot-group            Split into files by SPOT_GROUP (member).
-  -T, --group-in-dirs         Split into subdirectories instead of files.
-  -K, --keep-empty-files      Do not delete empty files.
-  -L, --log-level             Logging level: fatal|sys|int|err|warn|info.
-                                [default: info]
-  -+, --debug <level>         one of APP|KFS|XML|VDB|SRA|REF|LEGREF.
-                                [default: APP]
-  -H, --help                  Prints this message.
-
-Format options:
-  -M, --minReadLen            Minimum read length to output.
-                                [default: 25]
-  -W, --noclip                Do not clip quality right for spot.
-  -F, --origfmt               Excludes SRR accession & length on defline.
-  -C, --dumpcs [<cskey>]      Dump color space sequence.
-                                [enabled by default for ABI SOLID]
-                                [single letter color space key is optional]
-  -B, --dumpbase              Dump base sequence.
-                                [enabled by default for other than ABI SOLID]
-  -Q, --offset                Offset to use for quality conversion.
-                                [default: 33]
-  -I, --readids               Append read id after spot id as
-                                '<accession>.<spot>.<readid>' on defline.
-  -E, --no-qual-filter        Disable filtering by leading/trailng low quality.
-  -SF, --complete             Dump ALL reads in a single file.
-  -DB, --defline-seq          Sequence defline format specification;
-                              string of characters and/or variables.
-  -DQ, --defline-qual         quailty defline format specification.
-                                If -DB is provided but -DQ ommitted,
-                                -DB value is used.
-  -alt [n]                    alternative formatting version [1].
-
-Defline substitution variables:
-  '$ac'                       accession
-  '$si'                       spot id
-  '$sn'                       spot name
-  '$sg'                       spot group (member/barcode)
-  '$sl'                       spot length in bases
-  '$ri'                       read id
-  '$rn'                       read name
-  '$rl'                       read length in bases.
-
-  Substitution variables begin with a '$' character followed by a two
-  character symbol, e.g. 'ac'. '[]' could be used for an optional output:
-  if all variables in [] yield empty values whole group is not printed.
-    Empty value is empty string or 0 for numeric variables.
-    Ex: @$sn[_$rn]/$ri - '_$rn' is omitted if name is empty
-
diff --git a/doc/help/txt/fastq-load-help.txt b/doc/help/txt/fastq-load-help.txt
deleted file mode 100644
index 728b889..0000000
--- a/doc/help/txt/fastq-load-help.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-Usage:
-
-fastq-load <help>
-fastq-load [ <options> ] <input-spec> <spot-descriptor> <output-spec> [ <verbosity> ] 
-
-input-spec:
-  ( -r | --run-xml ) path           # path to run.xml describing input files
-
-spot-descriptor:
-  ( -e | --experiment ) path            # path to experiment.xml 
-                                        # with spot descriptor
-
-output-spec:
-  <output-mode> <run-name>           # produce output to run
-
-output-mode:
-  -c | --create                      # create only new run (fail if exists)
-  -o | --output                      # create new or replace existing run
-  -a | --append                      # create new or update existing run
-
-run-name:
-  path                                  # full or working-directory relative
-                                        # file-system path to run
-
-options:
-  ( -n | --spotnumber) spots_to_run    # tells the loader to stop processing after that many spots
-                                       # helpful in testing
-
-  ( -b | --bad-spot-number ) bad_spot_number  # number of spot creation errors to be tolerated
-                                              # default = 50
-
-  ( -p | --bad-spot-percentage ) bad_spot_percentage> # PERCENTAGE of the number of bad spots against
-                                                      # the number of good spots, default = 5
-
-help:
-  ( -h | --help )                       # print usage and option details
-
-verbosity:
-  ( -l | --log-level ) <level>  #logging level: fatal|sys|int|err|warn|info default=info
-debug:
-  ( -+ | --debug ) <module>  #module: APP|KFS|XML|VDB|SRA|REF|LEGREF default=APP
diff --git a/doc/help/txt/illumina-dump-help.txt b/doc/help/txt/illumina-dump-help.txt
deleted file mode 100644
index 4dab085..0000000
--- a/doc/help/txt/illumina-dump-help.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-
-Usage:
-  illumina-dump [options] [ -A ] <accession>
-  illumina-dump [options] <path>
-
-	-A, --accession             Accession.
-
-Options:
-
-	-D, --table-path            Path to accession data.
-	-O, --outdir                Output directory. Default: '.'
-	-N, --minSpotId             Minimum spot id to output.
-	-X, --maxSpotId             Maximum spot id to output.
-	-G, --spot-group            Split into files by SPOT_GROUP (member).
-	-T, --group-in-dirs         Split into subdirectories instead of files.
-	-K, --keep-empty-files      Do not delete empty files.
-	-L, --log-level             Logging level: fatal|sys|int|err|warn|info. Default: info
-	-+, --debug                 debug: APP|KFS|XML|VDB|SRA|REF|LEGREF. Default: APP
-	-H, --help                  Prints this message.
-
-Format options:
-
-	-r, --read                  Output READ: "seq". Default: on
-	-q, --qual1                 Output QUALITY, into single (1) or multiple (2) files: "qcal". Default: 1
-	-p, --qual4                 Output full QUALITY: "prb". Default: off
-	-i, --intensity             Output INTENSITY, if present: "int". Default: off
-	-n, --noise                 Output NOISE, if present: "nse". Default: off
-	-s, --signal                Output SIGNAL, if present: "sig2". Default: off
-	-qseq                       Output QSEQ format: "qseq". Default: off
diff --git a/doc/help/txt/illumina-load-help.txt b/doc/help/txt/illumina-load-help.txt
deleted file mode 100644
index 35e8ac9..0000000
--- a/doc/help/txt/illumina-load-help.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-Usage:
-
-illumina-load <help>
-illumina-load [ <options> ] <input-spec> <spot-descriptor> <output-spec> [ <verbosity> ] 
-
-input-spec:
-  ( -r | --run-xml ) path           # path to run.xml describing input files
-
-spot-descriptor:
-  ( -e | --experiment ) path            # path to experiment.xml 
-                                        # with spot descriptor
-
-output-spec:
-  <output-mode> <run-name>           # produce output to run
-
-output-mode:
-  -c | --create                      # create only new run (fail if exists)
-  -o | --output                      # create new or replace existing run
-  -a | --append                      # create new or update existing run
-
-run-name:
-  path                                  # full or working-directory relative
-                                        # file-system path to run
-
-options:
-  ( -n | --spotnumber) spots_to_run    # tells the loader to stop processing after that many spots
-                                       # helpful in testing
-
-  ( -b | --bad-spot-number ) bad_spot_number  # number of spot creation errors to be tolerated
-                                              # default = 50
-
-  ( -p | --bad-spot-percentage ) bad_spot_percentage> # PERCENTAGE of the number of bad spots against
-                                                      # the number of good spots, default = 5
-
-help:
-  ( -h | --help )                       # print usage and option details
-
-verbosity:
-  ( -l | --log-level ) <level>  #logging level: fatal|sys|int|err|warn|info default=info
-debug:
-  ( -+ | --debug ) <module>  #module: APP|KFS|XML|VDB|SRA|REF|LEGREF default=APP
diff --git a/doc/help/txt/kar-help.txt b/doc/help/txt/kar-help.txt
deleted file mode 100644
index 6b963a7..0000000
--- a/doc/help/txt/kar-help.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-kar : 1.0.1
-
-Usage: kar [options] [Archive Command] [Directory] [optional filters]
-
-    Create an NCBI archive from a directory
-      or
-    Test (list the contents) of an NCBI archive
-      or
-    Extract the contents of an NCBI archive into a directory
-
-Archive Command:
-    All of these options require the next token on the command line to be
-    the name of the archive
-  -c, --create=ARCHIVE      create a new archive
-  -t, --test=ARCHIVE        check the structural validity of an archive
-                            optionally listing its contents
-  -x, --extract=ARCHIVE     extract the contents of an archive into a
-                            directory
-Directory:
-    Required for create or extract command, ignored for test command
-  -d, --directory=DIRECTORY the next token on the command line is the name
-                            of the directory to extract to or create from
-Optional filters:
-    When present these act as include filters.
-    Any file name will be included in the extracted files, created archive
-    or test operation listing
-    Any directory will be included as well as its contents
-Options:
-  -f, --force               (no parameter) this will cause the extract or
-                            create to over-write existing files unless they
-                            are write-protected.  without this option the program
-                            will fail if the archive already exists for a create or
-                            the target directory exists for an extract
-  -a, --alignment=ALIGN     1,2,4,8 Forces the alignment of files in create
-                            mode putting the first byte of included files
-                            at ALIGN boundaries (default=4)
-  -V, --version             this will cause the program to emit the internal
-                            version number before any other action
-  -v, --verbose             extra information will be output during
-                            processinga second occurance on the command line
-                            means even more
-  -L, --long-list           more information will be given on each file in
-                            test/list mode
-  -h, -?, --help            print this message
-  -l, --log-level=LEVEL     the next token will affect the logging level of
-                            the program  accepted tokens are the numbers
-                            0-15, fatal, sys, int, err, warn, info
-                            and debug1...debug10
diff --git a/doc/help/txt/kdbmeta-help.txt b/doc/help/txt/kdbmeta-help.txt
deleted file mode 100644
index 781209c..0000000
--- a/doc/help/txt/kdbmeta-help.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-Usage:kdbmeta <target> <query> [ <query> ... ]
-
-    cmd:
-      select                  display contents
-
-    target: one of
-      path-to-database        access database metadata
-      path-to-table           access table metadata
-      path-to-column          access column metadata
-      accession               sra global access id
-
-    query:
-      *                       all nodes and attributes
-      NAME                    a named root node and children
-      PATH/NAME               an internal node and children
-      <node>@ATTR             a named attribute
-      <obj>=VALUE             a simple value assignment where
-                              value string is text, and binary
-                              values use hex escape codes
-
-    tool to display or modify contents of one or more metadata
-    stores. the target metadata are described by one or more
-    target specifications, giving the path to a database, a table
-    or a column. the command and query are executed on each target.
-
-    queries name one or more objects, and '*' acts as a wildcard.
-    query objects are nodes or attributes. nodes are named with a
-    hierarchical path, like a file-system path. attributes are given
-    as a node path followed by a '@' followed by the attribute name.
-
diff --git a/doc/help/txt/kqsh-help.txt b/doc/help/txt/kqsh-help.txt
deleted file mode 100644
index 5042730..0000000
--- a/doc/help/txt/kqsh-help.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-Usage: kqsh [ options ] [ file... ]
-
-    options:
-      -h               give tool help
-      -u               enable update operations
-      -l <path>        path(s) for loading dynamic libraries
-
diff --git a/doc/help/txt/md5cp-help.txt b/doc/help/txt/md5cp-help.txt
deleted file mode 100644
index 6139a39..0000000
--- a/doc/help/txt/md5cp-help.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-usage: md5cp [-p] [-f] [-r] [file|directory ...] directory
-
-    md5cp [-f] source_filename dest_filename
-    : Copies files and/or directories, creating an md5sum checksum (named file.md5) for all copied files.
-    
--f forces replacement of existing files.
--p forces replacement of existing modes on files and directories.
--r recurses over source directories (directories are ignored otherwise)
diff --git a/doc/help/txt/rcexplain-help.txt b/doc/help/txt/rcexplain-help.txt
deleted file mode 100644
index 39cb73e..0000000
--- a/doc/help/txt/rcexplain-help.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-
-Usage: rcexplain rc [ rc... ]
-
-    prints out error string to stdout for one or more return codes
-
diff --git a/doc/help/txt/sff-dump-help.txt b/doc/help/txt/sff-dump-help.txt
deleted file mode 100644
index 19b4ed9..0000000
--- a/doc/help/txt/sff-dump-help.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-
-Usage:
-  sff-dump [options] [ -A ] <accession>
-  sff-dump [options] <path>
-
-	-A, --accession             Accession.
-
-Options:
-
-	-D, --table-path            Path to accession data.
-	-O, --outdir                Output directory. Default: '.'
-	-N, --minSpotId             Minimum spot id to output.
-	-X, --maxSpotId             Maximum spot id to output.
-	-G, --spot-group            Split into files by SPOT_GROUP (member).
-	-T, --group-in-dirs         Split into subdirectories instead of files.
-	-K, --keep-empty-files      Do not delete empty files.
-	-L, --log-level             Logging level: fatal|sys|int|err|warn|info. Default: info
-	-+, --debug                 debug: APP|KFS|XML|VDB|SRA|REF|LEGREF. Default: APP
-	-H, --help                  Prints this message.
diff --git a/doc/help/txt/sra-dump-help.txt b/doc/help/txt/sra-dump-help.txt
deleted file mode 100644
index 8f7adce..0000000
--- a/doc/help/txt/sra-dump-help.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-
-Usage: sra-dump [ options ] table [ column-spec ... ]
-
-    dump all column data.
-    options:
-      -h                       give tool help
-     --help
-
-      --start ID               starting spot id ( default 1 )
-      --stop ID                ending spot id ( default max )
-
-      -l, --level              Log level: 0-5 or one of 
-
-
-    column-spec:
-      NAME                     simple column name
-      (typedecl)NAME           specifically typed column name
-
diff --git a/doc/help/txt/sra-stat-help.txt b/doc/help/txt/sra-stat-help.txt
deleted file mode 100644
index 13a9108..0000000
--- a/doc/help/txt/sra-stat-help.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-
-Usage: sra-stat [ options ] table [ column-spec ... ]
-
-    display column statistics.
-    options:
-      -h                      give tool help
-     --help
-
-     --xml                    output in XML (default is ASCII)
-     --start ID               starting spot id ( default 1 )
-     --stop ID                ending spot id ( default max )
-
-      -l, --level             Log level: 0-5 or one of 
-                               fatal | sys | int | err | warn | info                               ( default warn )
-
-    column-spec:
-      NAME                     simple column name
-      (typedecl)NAME           specifically typed column name
-
diff --git a/doc/help/txt/srapath-help.txt b/doc/help/txt/srapath-help.txt
deleted file mode 100644
index 6587577..0000000
--- a/doc/help/txt/srapath-help.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-Usage:
- srapath 1.2.0
-
-Usage: srapath [ options ] accession ...
-
-    options:
-      --server <repserver-path>       path(s) to replication server(s)
-      --volume <volume-path>          relative path(s) to volume(s)
-
-    Tool to produce a list of full paths to SRA runs from list of
-    accessions.  Output paths are ordered according to accession list.
-    with no path alteration options, the accession search path will be
-    determined according to the local installation.
-    Replication server and volume paths may be compound, adhering to the
-    Unix path convention of ':' separators, e.g.
-
-        '/server1:/server2/subdir'
-
-    The idea behind separate replication servers and volumes is to
-    allow for a matrix of volumes that can hold a run, where the volumes
-    are expected to be replicated across all repservers.  It is possible that
-    this arrangement will be violated and still work, but behavior is less
-    clearly defined.
-
-    The order of search paths is important: rather than alphabetical,
-    specify paths in the preferred order of discovery, usually giving the most
-    recently updated volumes first.  If a run appears more than once in the matrix,
-    it will be found according to the first 'repserver/volume' combination that
-    produces a hit.
-
-    Finally, this tool produces a path that is 'likely' to be a run, in that
-    an entry exists in the file system at the location predicted.  It is possible
-    that this path will fail to produce success upon opening a run if the path does
-    not point to a valid object.
-
diff --git a/doc/help/txt/srf-load-help.txt b/doc/help/txt/srf-load-help.txt
deleted file mode 100644
index 76503f6..0000000
--- a/doc/help/txt/srf-load-help.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-Usage:
-
-srf-load <help>
-srf-load [ <options> ] <input-spec> <spot-descriptor> <output-spec> [ <verbosity> ] 
-
-input-spec:
-  ( -r | --run-xml ) path           # path to run.xml describing input files
-
-spot-descriptor:
-  ( -e | --experiment ) path            # path to experiment.xml 
-                                        # with spot descriptor
-
-output-spec:
-  <output-mode> <run-name>           # produce output to run
-
-output-mode:
-  -c | --create                      # create only new run (fail if exists)
-  -o | --output                      # create new or replace existing run
-  -a | --append                      # create new or update existing run
-
-run-name:
-  path                                  # full or working-directory relative
-                                        # file-system path to run
-
-options:
-  ( -n | --spotnumber) spots_to_run    # tells the loader to stop processing after that many spots
-                                       # helpful in testing
-
-  ( -b | --bad-spot-number ) bad_spot_number  # number of spot creation errors to be tolerated
-                                              # default = 50
-
-  ( -p | --bad-spot-percentage ) bad_spot_percentage> # PERCENTAGE of the number of bad spots against
-                                                      # the number of good spots, default = 5
-
-help:
-  ( -h | --help )                       # print usage and option details
-
-verbosity:
-  ( -l | --log-level ) <level>  #logging level: fatal|sys|int|err|warn|info default=info
-debug:
-  ( -+ | --debug ) <module>  #module: APP|KFS|XML|VDB|SRA|REF|LEGREF default=APP
diff --git a/doc/help/txt/txt2kdb-help.txt b/doc/help/txt/txt2kdb-help.txt
deleted file mode 100644
index 1db8875..0000000
--- a/doc/help/txt/txt2kdb-help.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-
- txt2kdb [Options] FILE KCOLUMN
-    Create a KColumn physical column out of a text file.
-
-    FILE:
-        The text file should be ASCII or UTF-8 using LF, CR or CR-LF
-        line termination.  Each text line will be put into the
-        KColumn as a separate Row.  Each Row will be in its own
-        blob.
-    KCOLUMN:
-        The KColumn is either an existing KColumn or a path to one
-        that can be created.    Both paths should be relative to the current directory or full
-    from root "/"
-
-Options:
-  -b, --begin=START         include only lines starting from this line in the
-                            KColumn.  The first line is line 1 (not 0).
-  -e, --end=STOP            stop including lines after this line in the
-                            KColumn.  The first line is line 1 (not 0).
-  -f, --force               (no parameter) this will cause to over-write
-                            existing files.  Without
-                            this option the program will fail if the KColumn
-                            already exists and append mode is not selected
-  -a, --append              (no parameter) this will cause to append the text
-                            file to an existing KColumn.  If the file does not
-                            already exist it will be created.
-  -V, --version             this will cause the program to emit the internal
-                            version number before any other action
-  -v, --verbose             extra information will be output during
-                            processing second occurrence on the command line
-                            means even more
-  -h, -?, --help            print this message
-  -l, --log-level=LEVEL     the next token will affect the logging level of
-                            the program  accepted tokens are the numbers
-                            0-15, fatal, sys, int, err, warn, info
-                          , debug1...debug10
diff --git a/doc/help/txt/vdb-dump-help.txt b/doc/help/txt/vdb-dump-help.txt
deleted file mode 100644
index 34195ff..0000000
--- a/doc/help/txt/vdb-dump-help.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-**************************************************************
-vdb-dump:
-**************************************************************
-usage:
-    vdb-dump database-path -Ttable -Rrows -Ccolumns [options]
-    table.......Tab1 or omit for first table in database
-    rows........1-100,200,205,300-305 or omit for all rows
-    columns.....COL1,COL2,COL3 or omit for all available columns
-
-example: vdb-dump mydb -TTab1 -R1-200 -CLINE,ID
-**************************************************************
-options:
---table -T        ... specify the table-name (mandatory)
---rows -R         ... specify the row-range (default all)
---columns -C      ... specify the columns (default all)
---schema -S       ... specify a schema to use (default none)
---help -h -?      ... show help
---row_id_on -I    ... print row id (default off)
---line_feed -l    ... line-feed's inbetween rows (default 1)
---colname_off -N  ... print column-names (default on)
---in_hex -X       ... prints valuex in hex (default decimal)
---schema_dump -A  ... dumps the schema instead of the data
---table_enum -E   ... list the found tables in the database
---version -V      ... show manager-version before dumping
---column_enum -O  ... list the columns of the specified table
---dna_bases -D    ... print DNA-bases (if column-type fits)
---max_length -M   ... limits the lenght of a line (default no limit)
---indent_width -i ... indents the line (default no indentation)
---filter -F       ... prints only lines which fit the filter-expr.
---format -f       ... uses default/csv/xml/json
---id_range -r     ... prints the id-range of the table
---without_sra -n  ... does not translate SRA-types
---no_accession -a ... do not check accession
-**************************************************************
diff --git a/interfaces/align/align-access.h b/interfaces/align/align-access.h
deleted file mode 100644
index 1f96f0e..0000000
--- a/interfaces/align/align-access.h
+++ /dev/null
@@ -1,342 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_align_align_access_
-#define _h_align_align_access_
-
-#ifndef _h_align_extern_
-#include <align/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct VPath;
-
-
-/*--------------------------------------------------------------------------
- * constants
- */
-typedef uint8_t AlignmentStrandDirection;
-enum
-{
-    asd_Unknown, /* e.g. an error occured */
-    asd_Forward = 'F',
-    asd_Reverse = 'R'
-};
-
-
-/*--------------------------------------------------------------------------
- * AlignAccessMgr
- *  opaque handle to library
- */
-typedef struct AlignAccessMgr AlignAccessMgr;
-
-/* Make
- *  make a manager for read-only access
- */
-ALIGN_EXTERN rc_t CC AlignAccessMgrMake ( const AlignAccessMgr **mgr );
-
-/* AddRef
- * Release
- */
-ALIGN_EXTERN rc_t CC AlignAccessMgrAddRef ( const AlignAccessMgr *self );
-ALIGN_EXTERN rc_t CC AlignAccessMgrRelease ( const AlignAccessMgr *self );
-
-
-
-/*--------------------------------------------------------------------------
- * AlignAccessDB
- *  opaque handle to database
- */
-typedef struct AlignAccessDB AlignAccessDB;
-
-/* Make
- *  make a read-only database handle from BAM file
- *  where the BAM file is treated as the entire database
- *
- *  "bam" [ IN ] - NUL terminated POSIX path in UTF-8 character set
- *  designating BAM file
- *
- *  "bam_index" [ IN ] - NUL terminated POSIX path in UTF-8 character
- *  set designating BAM index file
- *
- * NB - on Windows, these paths should be converted POSIX-style
- */
-ALIGN_EXTERN rc_t CC AlignAccessMgrMakeBAMDB ( const AlignAccessMgr *self,
-    const AlignAccessDB **db, struct VPath const *bam );
-ALIGN_EXTERN rc_t CC AlignAccessMgrMakeIndexBAMDB ( const AlignAccessMgr *self,
-    const AlignAccessDB **db, struct VPath const *bam, struct VPath const *bam_index );
-
-/* AddRef
- * Release
- */
-ALIGN_EXTERN rc_t CC AlignAccessDBAddRef ( const AlignAccessDB *self );
-ALIGN_EXTERN rc_t CC AlignAccessDBRelease ( const AlignAccessDB *self );
-
-
-
-/*--------------------------------------------------------------------------
- * AlignAccessRefSeqEnumerator
- *  an enumerator onto available reference sequences
- */
-typedef struct AlignAccessRefSeqEnumerator AlignAccessRefSeqEnumerator;
-
-#define AlignAccessRefSeqEnumeratorEOFCode (RC(rcAlign, rcTable, rcReading, rcRow, rcNotFound))
-#define AlignAccessRefSeqEnumeratorIsEOF(RESULT_CODE) (GetRCObject(RESULT_CODE) == rcRow && GetRCState(RESULT_CODE) == rcNotFound)
-
-/* EnumerateRefSequences
- *  make an enumerator of reference sequences visible in database
- *
- *  "refseq_enum" [ OUT ] - return parameter for enumerator
- *
- *  return codes:
- *   object: rcRow, state: rcNotFound - if the index is empty
- */
-ALIGN_EXTERN rc_t CC AlignAccessDBEnumerateRefSequences ( const AlignAccessDB *self,
-    AlignAccessRefSeqEnumerator **refseq_enum );
-
-
-/* AddRef
- * Release
- */
-ALIGN_EXTERN rc_t CC AlignAccessRefSeqEnumeratorAddRef ( const AlignAccessRefSeqEnumerator *self );
-ALIGN_EXTERN rc_t CC AlignAccessRefSeqEnumeratorRelease ( const AlignAccessRefSeqEnumerator *self );
-
-/* advance the enumerator to the next element
- *
- *  return codes:
- *   object: rcRow, state: rcNotFound - if there is no next element
- */
-ALIGN_EXTERN rc_t CC AlignAccessRefSeqEnumeratorNext(const AlignAccessRefSeqEnumerator *cself);
-
-/* GetID
- *  get text id of reference sequence
- *
- *  "id_buffer" [ IN ] and "buffer_size" [ IN ] - return buffer for
- *  NUL terminated ASCII id
- *
- *  "id_size" [ OUT, NULL OKAY ] - optional return parameter for length
- */
-ALIGN_EXTERN rc_t CC AlignAccessRefSeqEnumeratorGetID ( const AlignAccessRefSeqEnumerator *self,
-    char *id_buffer, size_t buffer_size, size_t *id_size );
-    
-/* GetLength
- *  get text id of reference sequence
- */
-ALIGN_EXTERN rc_t CC AlignAccessRefSeqEnumeratorGetLength
-    ( const AlignAccessRefSeqEnumerator *self, uint64_t *length );
-
-
-/*--------------------------------------------------------------------------
- * AlignAccessAlignmentEnumerator
- *  an enumerator onto alignments
- */
-typedef struct AlignAccessAlignmentEnumerator AlignAccessAlignmentEnumerator;
-
-#define AlignAccessAlignmentEnumeratorEOFCode (RC(rcAlign, rcTable, rcReading, rcRow, rcNotFound))
-#define AlignAccessAlignmentEnumeratorIsEOF(RESULT_CODE) (GetRCObject(RESULT_CODE) == rcRow && GetRCState(RESULT_CODE) == rcNotFound)
-
-/* EnumerateAlignments
- *  make an enumerator of all alignments in database
- *
- *  "align_enum" [ OUT ] - return parameter for enumerator
- *
- *  return codes:
- *   object: rcRow, state: rcNotFound - if there is no first element
- *
- * NB - this is a BAD interface, here only to support dumping a BAM file
- *  it may not be available under all circumstances
- */
-ALIGN_EXTERN rc_t CC AlignAccessDBEnumerateAlignments ( const AlignAccessDB *self,
-    AlignAccessAlignmentEnumerator **align_enum );
-
-
-/* WindowedAlignments
- *  make an enumerator of alignments within a window of a reference sequence
- *
- *  "align_enum" [ OUT ] - return parameter for enumerator
- *
- *  "refseq_id" [ IN ] - NUL terminated ASCII string giving reference sequence id
- *
- *  "pos" [ IN ] and "wsize" [ IN ] - starting position and size of window
- *  on reference sequence
- *
- *  return codes:
- *   object: rcRow, state: rcNotFound - if there is no first element
- */
-ALIGN_EXTERN rc_t CC AlignAccessDBWindowedAlignments ( const AlignAccessDB *self,
-    AlignAccessAlignmentEnumerator **align_enum, const char *refseq_id,
-    uint64_t pos, uint64_t wsize );
-
-
-/* AddRef
- * Release
- */
-ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorAddRef ( const AlignAccessAlignmentEnumerator *self );
-ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorRelease ( const AlignAccessAlignmentEnumerator *self );
-
-
-/* Next
- * advance the enumerator to the next element
- *
- *  return codes:
- *   object: rcRow, state: rcNotFound - if there is no next element
- */
-ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorNext ( const AlignAccessAlignmentEnumerator *self );
-
-
-/* GetRefSeqID
- *  return id of reference sequence
- *
- *  "id_buffer" [ IN ] and "buffer_size" [ IN ] - return buffer for
- *  NUL terminated ASCII id
- *
- *  "id_size" [ OUT, NULL OKAY ] - optional return parameter for length
- */
-ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorGetRefSeqID ( const AlignAccessAlignmentEnumerator *self,
-    char *id_buffer, size_t buffer_size, size_t *id_size );
-
-
-/* GetRefSeqPos
- *  return starting position of alignment on reference sequence
- *
- *  "start_pos" [ OUT ] - return parameter for starting position
- */
-ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorGetRefSeqPos ( const AlignAccessAlignmentEnumerator *self,
-    uint64_t *start_pos );
-
-    
-/* GetShortSeqID
- *  return accession id of aligned short sequence
- *
- *  "id_buffer" [ IN ] and "buffer_size" [ IN ] - return buffer for
- *  NUL terminated ASCII id
- *
- *  "id_size" [ OUT, NULL OKAY ] - optional return parameter for length
- */
-ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorGetShortSeqAccessionID
-    ( const AlignAccessAlignmentEnumerator *self, char *id_buffer, size_t buffer_size, size_t *id_size );
-
-    
-/* GetShortSeqID
- *  return id of aligned short sequence
- *
- *  "id_buffer" [ IN ] and "buffer_size" [ IN ] - return buffer for
- *  NUL terminated ASCII id
- *
- *  "id_size" [ OUT, NULL OKAY ] - optional return parameter for length
- */
-ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorGetShortSeqID
-    ( const AlignAccessAlignmentEnumerator *self, char *id_buffer, size_t buffer_size, size_t *id_size );
-
-
-/* GetMapQuality
- *  return sequence alignment mapping quality score
- *
- *  "score" [ OUT ] - return parameter for mapping quality score (phred-like)
- */
-ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorGetMapQuality ( const AlignAccessAlignmentEnumerator *self,
-                                             uint8_t *score );
-    
-/* GetCIGAR
- *  return sequence alignment information
- *
- *  "start_pos" [ OUT, NULL OKAY ] - return parameter for starting position
- *
- *  "cigar_buffer" [ IN, NULL OKAY ] and "buffer_size" [ IN ] - return buffer for CIGAR NUL-terminated
- *  alignment description; null okay if cigar_size not null
- *  
- *  "cigar_size" [ OUT, NULL OKAY ] - optional return parameter for CIGAR string length; null ok
- *  if cigar_buffer not null
- */
-ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorGetCIGAR ( const AlignAccessAlignmentEnumerator *self,
-    uint64_t *start_pos, char *cigar_buffer, size_t buffer_size, size_t *cigar_size );
-
-
-/* GetShortSequence
- *  return short sequence
- *
- *  "seq_buffer" [ IN ] and "buffer_size" [ IN ] - return buffer for short sequence
- *  
- *  "seq_size" [ OUT ] - return parameter for sequence length
- *
- * NB - BAM states that the sequence will be bases in FASTA.
- *  we will be extending this interface to provide type information
- */
-ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorGetShortSequence ( const AlignAccessAlignmentEnumerator *self,
-    char *seq_buffer, size_t buffer_size, size_t *seq_size );
-
-
-/* GetStrandDirection
- *  returns property
- */
-ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorGetStrandDirection
-    ( const AlignAccessAlignmentEnumerator *self, AlignmentStrandDirection *result );
-
-    
-/* GetIsPaired
- *  returns paired property
- */
-ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorGetIsPaired
-    ( const AlignAccessAlignmentEnumerator *self, bool *result );
-
-/* GetIsFirstInPair
- *  get property
- */
-ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorGetIsFirstInPair
-    ( const AlignAccessAlignmentEnumerator *self, bool *result );
-
-/* GetIsSecondInPair
- *  get property
- */
-ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorGetIsSecondInPair
-    ( const AlignAccessAlignmentEnumerator *self, bool *result );
-
-    
-/* GetRecordID
- *  get property
- *
- * A locally unique identifier for each record.  When enumerators from the same
- * AlignAccessDB object fetch the same record, they will return the same ID.
- */
-ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorGetRecordID
-    ( const AlignAccessAlignmentEnumerator *self, uint64_t *result );
-    
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_align_align_access_ */
diff --git a/interfaces/align/align.vschema b/interfaces/align/align.vschema
deleted file mode 100644
index d7c35c9..0000000
--- a/interfaces/align/align.vschema
+++ /dev/null
@@ -1,1487 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/*==========================================================================
- * VDB Alignment types, functions and tables
- */
-version 1;
-
-include 'vdb/vdb.vschema';
-include 'ncbi/seq.vschema';
-include 'ncbi/sra.vschema';
-include 'ncbi/stats.vschema';
-include 'align/seq.vschema';
-include 'align/qstat.vschema';
-
-
-/*--------------------------------------------------------------------------
- * data types
- */
-
-/* ploidy
- *  the number of sets of chromosomes in a cell
- */
-typedef U32 NCBI:align:ploidy;
-
-
-
-/*--------------------------------------------------------------------------
- * functions
- */
-
-
-/* cigar
- *  construct "cigar" alignment string or length arrays
- *
- * "ctype" [ CONST ] - select variant of format
- *   0 => both matches and mismatches represented as M
- *   1 => matches represented as '=' mismatches as 'X'
- *
- *  "has_mismatch" [ DATA ] - a boolean for each base in aligned sequence
- *   where a value of false means the base aligned to the reference
- *
- *  "has_ref_offset" [ DATA ] - a boolean for each base in the aligned sequence
- *   where a value of true means there is a corresponding offset to position on reference
- *
- *  "ref_offset" [ DATA ] - a packed sequence of signed offsets to aligned position
- *   one entry for every true in "has_ref_offset"
- *
- *  "read_len" [ DATA ] - v2: elem_count defines PLOIDY and values are an actual length of reads in spot
- */
-extern function 
-ascii NCBI:align:cigar #1 < U8 ctype > ( bool has_mismatch, bool has_ref_offset,
-    I32 ref_offset, * INSDC:coord:len ref_len ) = ALIGN:cigar;
-
-extern function < type T >
-T NCBI:align:cigar #2 < U8 ctype > ( bool has_mismatch, bool has_ref_offset,
-      I32 ref_offset, INSDC:coord:len read_len, * INSDC:coord:len ref_len ) = ALIGN:cigar_2;
-
-extern function U32 NCBI:align:edit_distance #1
-    ( bool has_mismatch, bool has_ref_offset, I32 ref_offset );
-    
-extern function U32 NCBI:align:edit_distance #2
-    ( bool has_mismatch, bool has_ref_offset, I32 ref_offset, INSDC:coord:len ref_len, *INSDC:coord:len read_len)
-  = NCBI:align:edit_distance_2;
-
-/* project_from_sequence
- *  projects column from SEQUENCE
- *
- *  "T" [ TYPE ]
- *
- *  "col" [ CONST ]
- *  "use_read_len" [ CONST ] whether subset by read_len or by read_id only
- *
- *  "seq_spot_id" [ DATA ]
- *
- *  "seq_read_id" [ DATA ]
- */
-extern function < type T >
-T NCBI:align:project_from_sequence #1 < ascii col> ( I64 seq_spot_id, INSDC:coord:one seq_read_id )
-    = ALIGN:project_from_sequence;
-
-
-/* align_restore_read
- *  restores read by applying alignment-based difference to ref_read
- *
- *  "ref_read" [ DATA ]
- *
- *  "has_mismatch" [ DATA ] and "mismatch" [ DATA ]
- *
- *  "has_ref_offset" [ DATA ] and "ref_offset" [ DATA ]
- */
-extern function
-INSDC:4na:bin NCBI:align:align_restore_read #1 ( INSDC:4na:bin ref_read, bool has_mismatch,
-        INSDC:4na:bin mismatch, bool has_ref_offset, I32 ref_offset * INSDC:coord:len read_len)
-    = ALIGN:align_restore_read;
-
-
-/* raw_restore_read
- *  restores read by applying alignment-based difference to align_read
- *
- *  "align_read" [ DATA ]
- *
- *  "ref_orientation" [ DATA ]
- */
-extern function
-INSDC:4na:bin NCBI:align:raw_restore_read #1 ( INSDC:4na:bin align_read, bool ref_orientation )
-    = ALIGN:raw_restore_read;
-
-
-/* raw_restore_qual
- *  restores quality by applying alignment-based difference to align_qual
- *
- *  "align_qual" [ DATA ]
- *
- *  "ref_orientation" [ DATA ]
- */
-extern function
-INSDC:quality:phred NCBI:align:raw_restore_qual #1 ( INSDC:quality:phred align_qual, bool ref_orientation );
-
-
-/* ref_sub_select
- *  projects reference from sequence
- *
- *  "id" [ DATA ]
- *
- *  "start" [ DATA ] and "len" [ DATA ]
- *
- *  "ref_ploidy" [ DATA, OPTIONAL ]
- */
-extern function
-INSDC:4na:bin NCBI:align:ref_sub_select #1 ( I64 id, INSDC:coord:zero start,
-        INSDC:coord:len len * U32 ref_ploidy)
-    = ALIGN:ref_sub_select;
-
-
-/* ref_restore_read
- *  restores read from central storage
- *
- *  "cmp_rd" [ DATA ]
- *
- *  "seq_id" [ DATA ]
- *
- *  "seq_start" [ DATA ] and "seq_len" [ DATA ]
- */
-extern function
-INSDC:4na:bin NCBI:align:ref_restore_read #1 ( INSDC:4na:bin cmp_rd, ascii seq_id,
-        INSDC:coord:one seq_start, INSDC:coord:len seq_len)
-    = ALIGN:ref_restore_read;
-
-
-/* seq_restore_read
- *  projects read from align_deflate table to SEQUENCE
- *
- *  "cmp_rd" [ DATA ]
- *
- *  "align_id" [ DATA ]
- *
- *  "read_len" [ DATA ]
- *
- *  "rd_type" [ DATA ]
- */
-extern function
-INSDC:4na:bin NCBI:align:seq_restore_read #1 ( INSDC:4na:bin cmp_rd, I64 align_id,
-        INSDC:coord:len read_len, INSDC:SRA:xread_type rd_type )
-    = ALIGN:seq_restore_read;
-
-
-/* generate_has_mismatch
- *  generates has mismatch by doing actual compare of reference and subject,
- *  *ref_offsets move comparisons reference-wise
- *
- *  "reference" [ DATA ]
- *
- *  "subject" [ DATA ]
- *
- *  "has_ref_offset" [ DATA ]
- *
- *  "ref_offset" [ DATA ]
- */
-extern function
-bool NCBI:align:generate_has_mismatch #1 ( INSDC:4na:bin reference,
-       INSDC:4na:bin subject, bool has_ref_offset, I32 ref_offset)
-    = ALIGN:generate_has_mismatch;
-
-
-/* generate_mismatch
- *
- *  "reference" [ DATA ]
- *
- *  "subject" [ DATA ]
- *
- *  "has_ref_offset" [ DATA ]
- *
- *  "ref_offset" [ DATA ]
- */
-extern function
-INSDC:4na:bin NCBI:align:generate_mismatch #1 ( INSDC:4na:bin reference,
-        INSDC:4na:bin subject, bool has_ref_offset, I32 ref_offset )
-        = ALIGN:generate_mismatch;
-
-
-/* ref_pos
- *  retrieves the alignment's positions on the reference
- *  one per PLOIDY
- *
- *  "ref_id" [ DATA ]
- *
- *  "ref_start" [ DATA ] - one per PLOIDY
- */
-extern function
-INSDC:coord:zero NCBI:align:ref_pos #1 ( I64 ref_id, INSDC:coord:zero ref_start );
-
-
-/* ref_name
- *  retrieve the name from the reference
- *
- *  "ref_id" [ DATA ]
- */
-extern function
-ascii NCBI:align:ref_name #1 ( I64 ref_id );
-
-
-/* ref_seq_id
- *  retrieve the seq_id from the reference
- *
- *  "ref_id" [ DATA ]
- */
-extern function
-ascii NCBI:align:ref_seq_id #1 ( I64 ref_id );
-
-
-/* local_ref_id
- *  convert global ref_start into ref_id
- */
-extern function
-I64 NCBI:align:local_ref_id #1 ( U64 global_ref_start );
-
-
-/* global_ref_id
- *  convert global ref_start into ref_id
- */
-extern function
-INSDC:coord:zero NCBI:align:local_ref_start #1 ( U64 global_ref_start );
-
-/* not_my_row
- *  removes current row_id from the list
- */
-extern function I64 NCBI:align:not_my_row #1 ( I64 list );
-
-/* template_len
- *  compute template length, i.e. the distance from the left-most to the
- *  right-most matching reference position
- */
-extern function I32 NCBI:align:template_len #1 (
-    INSDC:coord:zero pos, INSDC:coord:zero mate_pos,
-    INSDC:coord:len  reflen, INSDC:coord:len mate_reflen,
-    ascii ref_name, ascii mate_ref_name, INSDC:coord:one read_id);
-
-/* get_sam_flags
- *  compute the flags that would be in a SAM file
- *
- * version 1 works with full Alignment databases.
- * version 2 works with Alignment databases that have had SEQUENCE removed.
- */
-extern function U32 NCBI:align:get_sam_flags #1 (
-    INSDC:coord:len read_len, INSDC:coord:one read_id, I32 template_len,
-    bool strand, bool mate_strand, bool is_secondary, * INSDC:SRA:read_filter filter);
-
-extern function U32 NCBI:align:get_sam_flags #2 (
-    I64 mate_id, INSDC:coord:one read_id, I32 template_len,
-    bool strand, bool mate_strand, bool is_secondary, * INSDC:SRA:read_filter filter)
-  = NCBI:align:get_sam_flags_2;
-
-/* get_left_soft_clip
- *  compute the length of the soft clip on the left edge of the alignment
- */
-extern function INSDC:coord:len NCBI:align:get_left_soft_clip #1
-    ( bool has_ref_offset, I32 ref_offset );
-
-extern function INSDC:coord:len NCBI:align:get_left_soft_clip #2
-    ( bool has_ref_offset, I32 ref_offset, INSDC:coord:len read_len )
-   = NCBI:align:get_left_soft_clip_2;
-
-/* get_right_soft_clip
- *  compute the length of the soft clip on the right edge of the alignment
- */
-extern function INSDC:coord:len NCBI:align:get_right_soft_clip #1
-    ( bool has_mismatch, INSDC:coord:len left_clip * bool has_ref_offset );
-    
-extern function INSDC:coord:len NCBI:align:get_right_soft_clip #2
-    ( bool has_mismatch, INSDC:coord:len left_clip, bool has_ref_offset, I32 ref_offset )
-   = NCBI:align:get_right_soft_clip_2;
-
-extern function INSDC:coord:len NCBI:align:get_right_soft_clip #3
-    ( bool has_ref_offset, I32 ref_offset, INSDC:coord:len ref_len )
-   = NCBI:align:get_right_soft_clip_3;
-
-extern function INSDC:coord:len NCBI:align:get_right_soft_clip #4
-    ( bool has_ref_offset, I32 ref_offset, INSDC:coord:len read_len, INSDC:coord:len ref_len )
-   = NCBI:align:get_right_soft_clip_4;
-
-/* get_clipped_cigar
- *  compute the CIGAR string with the soft clipping removed
- */
-extern function ascii NCBI:align:get_clipped_cigar #1 ( ascii cigar );
-
-extern function < type T > 
-T NCBI:align:get_clipped_cigar #2 ( ascii cigar, INSDC:coord:len cigar_len ) = NCBI:align:get_clipped_cigar_2;
-
-/* get_clipped_ref_offset
- *  compute the reference offsets with the soft clipping removed
- */
-extern function I32 NCBI:align:get_clipped_ref_offset #1
-    ( bool has_ref_offset, I32 ref_offset );
-
-/* clip
- *  remove the soft clipped bases (or qualities, or has_mismatch, or cetera)
- *  works with things whose lengths are the same as SEQUENCE.READ
- */    
-extern function < type T > T NCBI:align:clip #1
-    ( T object, INSDC:coord:len left_clip, INSDC:coord:len right_clip);
-
-extern function < type T > T NCBI:align:clip #2
-    ( T object, INSDC:coord:len read_len, INSDC:coord:len left_clip, INSDC:coord:len right_clip)
-   = NCBI:align:clip_2;
-
-/* get_ref_len
- *  compute reference length from alignment information
- */
-extern function INSDC:coord:len NCBI:align:get_ref_len #1
-    ( bool has_ref_offset, I32 ref_offset, * INSDC:coord:len right_clip );
-
-/* get_mismatch_read
- *  generate the READ with matching bases replaced with '='
- */
-extern function ascii NCBI:align:get_mismatch_read #1
-    ( bool has_mismatch, INSDC:dna:text mismatch );
-
-/* get_ref_mismatch
- * shows mismatch positions in reference space
- */
-function bool NCBI:align:get_ref_mismatch #1
-    ( bool has_mismatch, bool has_ref_offset, I32 ref_offset,
-      INSDC:coord:len ref_len );
-
-/* get_ref_insert
- * shows positions of inserts in reference space
- * i.e. an insert occurs between each pair of true's
- */
-function bool NCBI:align:get_ref_insert #1
-    ( bool has_mismatch, bool has_ref_offset, I32 ref_offset,
-      INSDC:coord:len ref_len );
-
-/* get_ref_delete
- * shows positions of deleted bases in reference space
- */
-function bool NCBI:align:get_ref_delete #1
-    ( bool has_mismatch, bool has_ref_offset, I32 ref_offset,
-      INSDC:coord:len ref_len );
-
-extern function INSDC:quality:phred NCBI:align:compress_quality #1
-    ( INSDC:quality:phred quality, bool preserved );
-
-extern function INSDC:quality:phred NCBI:align:decompress_quality #1
-    < INSDC:quality:phred restored_qual_value >
-    ( INSDC:quality:phred cmp_quality, bool preserved );
-
-/* make_cmp_read_start
- *
- */
-extern function INSDC:coord:zero NCBI:align:make_read_start #1
-    (INSDC:coord:len read_len);
-
-/* make_cmp_read_desc
- *  determines whether an element of "operand" is aligned
- *  by looking at the corresponding element of "align_id"
- *
- *  zeros out unaligned elements of operand, unless "invert" is true,
- *  in which case it zeros out aligned elements.
- *
- *  "T" [ TYPE ] - type of operand
- *
- *  "invert" [ CONST ] - if true, invert the logic of which elements
- *  to zero out.
- *
- *  "operand" [ DATA ] - uncompressed data
- *
- *  "align_id" [ DATA ] - indication of alignment
- */
-extern function < type T >
-T NCBI:align:make_cmp_read_desc #1 <bool invert>(T operand, I64 align_id);
-
-/* seq_construct_read
- *  assembles read from aligned and unaligned parts
- */
-extern function < type T >
-T NCBI:align:seq_construct_read #1 (
-    T aligned, INSDC:coord:len aligned_read_len,
-    T unaligned, INSDC:coord:len unaligned_read_len );
-    
-extern function I64 NCBI:align:get_mate_align_id #1 ( I64 spot_id );
-
-/*--------------------------------------------------------------------------
- * tables
- */
-
-
-/* ref_block_cmn
- *  common implementation ancestor for reference block
- */
-table NCBI:align:tbl:ref_block_cmn #1.0.0
-{
-    readonly column ascii REF_TABLE
-        = < ascii > meta:read < "CONFIG/REF_TABLE" > ()
-        | < ascii > echo < 'REFERENCE' > ();
-
-    // REF_ID is rowid in Reference Table REF_TABLE
-    extern column I64 REF_ID
-        = out_ref_id;
-    
-    // this is a redefinition of REF_START
-    // REF_START is the offset within REFERENCE.READ
-    extern column INSDC:coord:zero REF_START
-        = out_ref_start;
-
-    // global REF_START
-    extern column U64 GLOBAL_REF_START
-        = out_global_ref_start;
-
-    // REF_LEN the length of a read projection on reference
-    INSDC:coord:len out_ref_len_internal
-        = NCBI:align:get_ref_len ( out_has_ref_offset, out_ref_offset );
-
-    INSDC:coord:len out_ref_len
-        = .REF_LEN
-        | NCBI:align:get_ref_len ( out_has_ref_offset, out_ref_offset, out_right_clip )
-        | out_ref_len_internal;
-        
-    physical column < INSDC:coord:len > izip_encoding .REF_LEN = REF_LEN;
-    extern column INSDC:coord:len REF_LEN = out_ref_len;
-
-    // REF_ORIENTATION - relative orientation of original raw read to the reference
-    // false -> same orientation, true -> opposite orientation
-    // alignment and reference are always in the same orientation 
-    extern column bool_encoding REF_ORIENTATION;
-
-    // REF_PLOIDY
-    extern column < U32 > izip_encoding REF_PLOIDY;
-
-    /* REF_POS
-     *  per PLOIDY
-     */
-    readonly column INSDC:coord:zero REF_POS
-        = NCBI:align:ref_pos ( out_ref_id, out_ref_start );
-
-    /* REF_NAME
-     *  the name of the reference
-     */
-    readonly column ascii REF_NAME
-        = NCBI:align:ref_name ( out_ref_id );
-
-    /* REF_SEQ_ID
-     */
-    readonly column ascii REF_SEQ_ID
-        = NCBI:align:ref_seq_id ( out_ref_id )
-        | < ascii > echo < '' > ();
-};
-
-
-/* global_ref_block
- *  reference block favoring global ref-start
- */
-table NCBI:align:tbl:global_ref_block #1.0.0
-    = NCBI:align:tbl:ref_block_cmn #1.0.0
-{
-    U64 out_global_ref_start = .GLOBAL_REF_START;
-    physical < U64 > izip_encoding .GLOBAL_REF_START = GLOBAL_REF_START;
-
-    I64 out_ref_id = NCBI:align:local_ref_id ( .GLOBAL_REF_START );
-    INSDC:coord:zero out_ref_start = NCBI:align:local_ref_start ( .GLOBAL_REF_START );
-};
-
-
-/* local_ref_block
- *  reference block favoring local ref-start
- */
-table NCBI:align:tbl:local_ref_block #1.0.0
-    = NCBI:align:tbl:ref_block_cmn #1.0.0
-{
-    I64 out_ref_id = .REF_ID;
-    physical < I64 > izip_encoding .REF_ID = REF_ID;
-
-    INSDC:coord:zero out_ref_start = .REF_START;
-    physical < INSDC:coord:zero > izip_encoding .REF_START = REF_START;
-};
-
-
-/* align_cmn
- *  common interface and implementation for alignment object
- */
-table NCBI:align:tbl:align_cmn #2
-    = NCBI:tbl:base_space_common #1.0.3
-    , NCBI:SRA:tbl:stats #1.2.0
-    , NCBI:align:tbl:ref_block_cmn #1.0.0
-{
-    bool is_secondary = out_is_secondary;
-// temporary key
-    extern column < U32 > izip_encoding TMP_KEY_ID;
-
-
-/* Raw Sequence Block */
-    // Points to sequence table, which may contain more information about the raw sequence.
-    // row id in SEQUENCE table; 0 if not linked
-    extern column < I64 > izip_encoding SEQ_SPOT_ID;
-
-    // read number in SEQUENCE table; { SEQ_SPOT_ID, SEQ_READ_ID } is the unique link to the sequence
-    extern column < INSDC:coord:one > izip_encoding SEQ_READ_ID;
-    
-
-/* Soft-Clipped data block */
-
-    readonly column INSDC:coord:len LEFT_SOFT_CLIP
-        = NCBI:align:get_left_soft_clip ( HAS_REF_OFFSET, REF_OFFSET, out_read_len );
-        
-    INSDC:coord:len out_right_clip
-        = NCBI:align:get_right_soft_clip #4 ( out_has_ref_offset, out_ref_offset, out_read_len, out_ref_len )
-        | NCBI:align:get_right_soft_clip #3 ( out_has_ref_offset, out_ref_offset, out_ref_len )
-        | NCBI:align:get_right_soft_clip #2 ( out_has_mismatch, LEFT_SOFT_CLIP, out_has_ref_offset, out_ref_offset );
-    readonly column INSDC:coord:len RIGHT_SOFT_CLIP = out_right_clip;
-        
-    readonly column ascii CLIPPED_CIGAR_LONG
-        = < ascii > NCBI:align:get_clipped_cigar ( CIGAR_LONG, CIGAR_LONG_LEN );
-
-    readonly column INSDC:coord:len CLIPPED_CIGAR_LONG_LEN
-        = < INSDC:coord:len > NCBI:align:get_clipped_cigar ( CIGAR_LONG, CIGAR_LONG_LEN );
-
-    readonly column ascii CLIPPED_CIGAR_SHORT
-        = < ascii > NCBI:align:get_clipped_cigar ( CIGAR_SHORT, CIGAR_SHORT_LEN );
-        
-    readonly column INSDC:coord:len CLIPPED_CIGAR_SHORT_LEN
-        = < INSDC:coord:len > NCBI:align:get_clipped_cigar ( CIGAR_SHORT, CIGAR_SHORT_LEN );
-
-    bool out_clipped_has_mismatch
-        = < bool > NCBI:align:clip (out_has_mismatch, out_read_len, LEFT_SOFT_CLIP, RIGHT_SOFT_CLIP);
-        
-    readonly column ascii CLIPPED_HAS_MISMATCH
-        = < U8 , ascii > map < [ 0 , 1 ] , '01'  > ( out_clipped_has_mismatch );
-
-    readonly column bool CLIPPED_HAS_MISMATCH = out_clipped_has_mismatch;
-
-    bool out_clipped_has_ref_offset
-        = < bool > NCBI:align:clip (HAS_REF_OFFSET, out_read_len, LEFT_SOFT_CLIP, RIGHT_SOFT_CLIP);
-
-    readonly column ascii CLIPPED_HAS_REF_OFFSET
-        = < U8 , ascii > map < [ 0 , 1 ] , '01'  > ( out_clipped_has_ref_offset );
-
-    readonly column bool CLIPPED_HAS_REF_OFFSET = out_clipped_has_ref_offset;
-
-    // TBD cannot be computed right unless HAS_MISMATCH and! READ_LEN is used
-    readonly column INSDC:dna:text CLIPPED_MISMATCH
-        = < INSDC:dna:text > NCBI:align:clip #1 ( out_mismatch_dna_text, LEFT_SOFT_CLIP, RIGHT_SOFT_CLIP);
-
-    readonly column I32 CLIPPED_REF_OFFSET
-        = NCBI:align:get_clipped_ref_offset ( HAS_REF_OFFSET, REF_OFFSET );
-        
-    readonly column INSDC:quality:phred CLIPPED_QUALITY
-        = < INSDC:quality:phred > NCBI:align:clip (out_qual_phred, out_read_len, LEFT_SOFT_CLIP, RIGHT_SOFT_CLIP);
-        
-    readonly column INSDC:dna:text CLIPPED_READ
-        = < INSDC:dna:text > NCBI:align:clip (READ, out_read_len, LEFT_SOFT_CLIP, RIGHT_SOFT_CLIP);
-
-/* Sequence Block */
-
-    extern column < NCBI:align:ploidy > izip_encoding PLOIDY;
-
-    // Number of reads per spot; corresponds to the number of alternative alignments
-    // all alternative alignments are computed against the same reference region
-    U32 out_nreads
-        = .PLOIDY
-        | < U32 > echo < 1 > ();
-
-    // READ_START and READ_LEN are position and length of the sequence
-    physical < INSDC:coord:zero > izip_encoding .READ_START = READ_START;
-    INSDC:coord:zero out_read_start
-        = .READ_START
-        | < INSDC:coord:zero > echo < 0 > ();
-
-    physical < INSDC:coord:len > izip_encoding .READ_LEN = READ_LEN;
-
-    INSDC:coord:len align_spot_len = ( INSDC:coord:len ) row_len ( out_has_ref_offset );
-    INSDC:coord:len out_read_len
-        = .READ_LEN 
-        | align_spot_len;
-
-    // associated qualities
-    extern column INSDC:quality:phred CMP_QUALITY
-        = .CMP_QUALITY
-        | out_cmp_quality;
-    physical column < INSDC:quality:phred > zip_encoding .CMP_QUALITY = CMP_QUALITY;
-        
-    INSDC:quality:phred out_raw_qual = < INSDC:quality:phred >
-        NCBI:align:project_from_sequence < '( INSDC:quality:phred ) QUALITY'> ( .SEQ_SPOT_ID, .SEQ_READ_ID );
-    INSDC:quality:phred out_qual_phred
-        = NCBI:align:raw_restore_qual ( out_raw_qual, .REF_ORIENTATION )
-        | < INSDC:quality:phred > echo < 30 > ( out_4na_bin );
-    readonly column INSDC:quality:text:phred_33 SAM_QUALITY = QUALITY ;
-
-    // project read group and name
-    ascii out_spot_group = < ascii > simple_sub_select < 'SEQUENCE','SPOT_GROUP'> (.SEQ_SPOT_ID);
-
-
-    INSDC:SRA:spotid_t tmp_seq_spot_id
-        = cast ( .SEQ_SPOT_ID )
-        ;
-    physical <ascii> zip_encoding .SEQ_NAME = SEQ_NAME;
-    extern column ascii SEQ_NAME
-        = .SEQ_NAME
-        | < ascii > simple_sub_select < 'SEQUENCE','NAME'> (.SEQ_SPOT_ID)
-        | sprintf < "%u" > ( tmp_seq_spot_id );
-
-    // compute sam flags
-    /* blows up parser: starts at schema-tbl.c:2138
-    readonly column U32 SAM_FLAGS = NCBI:align:get_sam_flags(MATE_ALIGN_ID,
-        .SEQ_READ_ID, out_template_len, REF_ORIENTATION,
-        out_mate_ref_orientation, is_secondary);
-    */
-    INSDC:coord:len projected_read_len
-        = < INSDC:coord:len > simple_sub_select < 'SEQUENCE', 'READ_LEN' > ( .SEQ_SPOT_ID );
-    
-    readonly column U32 SAM_FLAGS
-        = NCBI:align:get_sam_flags #1 (projected_read_len,
-            .SEQ_READ_ID, out_template_len, REF_ORIENTATION,
-            out_mate_ref_orientation, is_secondary, out_rd_filter)
-        | NCBI:align:get_sam_flags #2 (out_mate_align_id,
-            .SEQ_READ_ID, out_template_len, REF_ORIENTATION,
-            out_mate_ref_orientation, is_secondary, out_rd_filter);
-
-    ascii out_name_fmt = < ascii > echo < '$R' > ();
-
-    INSDC:coord:zero trim_start
-        = < INSDC:coord:zero > echo < 0 > ();
-    INSDC:coord:len trim_len
-        = align_spot_len;
-
-    ascii out_label
-        = .LABEL
-        | < ascii > echo < "ploidy1" > ();
-    INSDC:coord:zero out_label_start
-        = .LABEL_START
-        | < INSDC:coord:zero > echo < 0 > ();
-    INSDC:coord:len out_label_len
-        = .LABEL_LEN
-        | < INSDC:coord:len > echo < 7 > ();
-
-    physical < INSDC:SRA:read_filter > zip_encoding .RD_FILTER = READ_FILTER;
-    INSDC:SRA:read_filter out_rd_filter
-        = .RD_FILTER
-        | < INSDC:SRA:read_filter > NCBI:align:project_from_sequence < 'READ_FILTER' > ( .SEQ_SPOT_ID, .SEQ_READ_ID ) 
-        | < INSDC:SRA:read_filter > echo < SRA_READ_FILTER_PASS > ( out_read_len );
-
-    INSDC:SRA:platform_id out_platform
-        = .PLATFORM
-        | < INSDC:SRA:platform_id > simple_sub_select < 'SEQUENCE','PLATFORM'> (.SEQ_SPOT_ID)
-        | < INSDC:SRA:platform_id > echo < SRA_PLATFORM_UNDEFINED > ();
-
-    U8 out_alignment_count = <U8> NCBI:align:project_from_sequence < 'ALIGNMENT_COUNT' > ( .SEQ_SPOT_ID, .SEQ_READ_ID );
-
-    /* out_read_type
-     *  set to SRA_READ_TYPE_FORWARD + SRA_READ_TYPE_BIOLOGICAL
-     *  which has a constant value of 3
-     */
-    INSDC:SRA:xread_type out_read_type
-        = < INSDC:SRA:xread_type > echo < 3 > ( out_read_len );
-
-    // stats inputs    
-    bool in_stats_bin = HAS_REF_OFFSET;
-    
-    INSDC:coord:len _alt_in_read_len
-        = READ_LEN
-        | ( INSDC:coord:len ) row_len #1 ( HAS_REF_OFFSET );
-
-    INSDC:SRA:xread_type _alt_in_read_type
-        = READ_TYPE
-        | < INSDC:SRA:xread_type > echo < SRA_READ_TYPE_BIOLOGICAL > (_alt_in_read_len);
-        
-    readonly column ascii MISMATCH_READ
-        = NCBI:align:get_mismatch_read ( out_has_mismatch, out_mismatch_dna_text );
-        
-/* Alignment block */
-
-    // MAPQ - single value quality of the mapping; the scale is submitter specific
-    extern column < I32 > izip_encoding MAPQ;
-
-    extern column INSDC:coord:zero MATE_REF_POS = out_mate_ref_pos;
-    extern column INSDC:coord:len MATE_REF_LEN = out_mate_ref_len;
-    extern column I64 MATE_REF_ID = out_mate_ref_id;
-    extern column I32 TEMPLATE_LEN = out_template_len;
-    extern column bool MATE_REF_ORIENTATION = out_mate_ref_orientation;
-    readonly column ascii MATE_REF_NAME = NCBI:align:ref_name ( out_mate_ref_id );
-    readonly column ascii MATE_REF_SEQ_ID = NCBI:align:ref_seq_id( out_mate_ref_id );
-    readonly column U8 ALIGNMENT_COUNT  = out_alignment_count;
-
-
-/********************************
-* Columns representing CIGARs
-********************************/
-
-
-    // one value per base i.e. length is same as sum of READ_LEN
-    // partitioned by READ_START and READ_LEN into alternative alignments
-    // flags the shifts in reference position preceeding the base
-    // if sequence of a partitioned read starts with a ref_offset and one or more mismatches
-    // then it represents a left soft clip
-    // any run of mismatches at the end represents a right soft clip
-
-    readonly column ascii HAS_REF_OFFSET =  < U8 , ascii > map < [ 0 , 1 ] , '01'  > ( out_has_ref_offset );
-    extern column bool_encoding HAS_REF_OFFSET;
-    bool out_has_ref_offset = .HAS_REF_OFFSET;
-    
-    // has number of elements equal to number of true elements in HAS_REF_OFFSET
-    extern column < I32 > izip_encoding REF_OFFSET;
-    I32 out_ref_offset = .REF_OFFSET;
-
-    // DISPLAY Columns
-
-    readonly column I64 ALIGN_ID = row_id ();
-
-    // get projection of the reference
-    readonly column INSDC:dna:text REF_READ
-        = < INSDC:4na:bin, INSDC:dna:text > map < INSDC:4na:map:BINSET, INSDC:4na:map:CHARSET > ( REF_READ );
-
-    readonly column INSDC:4na:bin REF_READ
-        = NCBI:align:ref_sub_select (out_ref_id, out_ref_start, out_ref_len, .REF_PLOIDY)
-        | NCBI:align:ref_sub_select (out_ref_id, out_ref_start, out_ref_len );
-        
-    INSDC:4na:bin ref_read_internal
-        = NCBI:align:ref_sub_select (out_ref_id, out_ref_start, out_ref_len_internal, .REF_PLOIDY)
-        | NCBI:align:ref_sub_select (out_ref_id, out_ref_start, out_ref_len_internal);
-
-    // text forms of reads
-    INSDC:dna:text out_dna_text
-        = < INSDC:4na:bin, INSDC:dna:text > map < INSDC:4na:map:BINSET, INSDC:4na:map:CHARSET > ( out_4na_bin );
-    readonly column INSDC:dna:text RAW_READ
-        = < INSDC:4na:bin, INSDC:dna:text > map < INSDC:4na:map:BINSET, INSDC:4na:map:CHARSET > ( out_raw_read );
-    readonly column INSDC:4na:bin RAW_READ
-        = out_raw_read;
-
-    // CIGARs
-    readonly column ascii CIGAR_LONG
-        = < ascii > NCBI:align:cigar #2 < 1 > (out_has_mismatch, out_has_ref_offset, out_ref_offset, out_read_len, out_ref_len)
-        | < ascii > NCBI:align:cigar #2 < 1 > (out_has_mismatch, out_has_ref_offset, out_ref_offset, out_read_len);
-    readonly column INSDC:coord:len CIGAR_LONG_LEN
-        = < INSDC:coord:len > NCBI:align:cigar #2 < 1 > (out_has_mismatch, out_has_ref_offset, out_ref_offset, out_read_len, out_ref_len)
-        | < INSDC:coord:len > NCBI:align:cigar #2 < 1 > (out_has_mismatch, out_has_ref_offset, out_ref_offset, out_read_len);
-    readonly column ascii CIGAR_SHORT
-        = < ascii > NCBI:align:cigar #2 < 0 > (out_has_mismatch, out_has_ref_offset, out_ref_offset, out_read_len, out_ref_len)
-        | < ascii > NCBI:align:cigar #2 < 0 > (out_has_mismatch, out_has_ref_offset, out_ref_offset, out_read_len);
-    readonly column INSDC:coord:len CIGAR_SHORT_LEN
-        = < INSDC:coord:len > NCBI:align:cigar #2 < 0 > (out_has_mismatch, out_has_ref_offset, out_ref_offset, out_read_len, out_ref_len)
-        | < INSDC:coord:len > NCBI:align:cigar #2 < 0 > (out_has_mismatch, out_has_ref_offset, out_ref_offset, out_read_len);
-
-    readonly column U32 EDIT_DISTANCE
-        = NCBI:align:edit_distance #2 (out_has_mismatch, out_has_ref_offset, out_ref_offset, out_ref_len, out_read_len)
-        | NCBI:align:edit_distance #2 (out_has_mismatch, out_has_ref_offset, out_ref_offset, out_ref_len)
-        | NCBI:align:edit_distance #1 (out_has_mismatch, out_has_ref_offset, out_ref_offset);
-
-    readonly column ascii HAS_MISMATCH = < U8 , ascii > map < [ 0 , 1 ] , '01'  > ( out_has_mismatch );
-    
-    // needed for backward compatibility
-    readonly column ascii SEQ_SPOT_GROUP = out_spot_group;
-
-
-/* These columns are purely informational. */    
-    bool out_ref_mismatch = NCBI:align:get_ref_mismatch ( out_has_mismatch, out_has_ref_offset, out_ref_offset, out_ref_len );
-    readonly column ascii REF_MISMATCH = < U8 , ascii > map < [ 0 , 1 ] , '01'  > ( out_ref_mismatch );
-    readonly column bool REF_MISMATCH = out_ref_mismatch;
-    
-    bool out_ref_insert = NCBI:align:get_ref_insert ( out_has_mismatch, out_has_ref_offset, out_ref_offset, out_ref_len );
-    readonly column ascii REF_INSERT = < U8 , ascii > map < [ 0 , 1 ] , '01'  > ( out_ref_insert );
-    readonly column bool REF_INSERT = out_ref_insert;
-    
-    bool out_ref_delete = NCBI:align:get_ref_delete ( out_has_mismatch, out_has_ref_offset, out_ref_offset, out_ref_len );
-    readonly column ascii REF_DELETE = < U8 , ascii > map < [ 0 , 1 ] , '01'  > ( out_ref_delete );
-    readonly column bool REF_DELETE = out_ref_delete;
-    
-};
-
-
-/* align_full
- *  aligns externally stored sequence against reference
- *  alignment transcript is calculated
- */
-table NCBI:align:tbl:align_full #1.0.0
-    = NCBI:align:tbl:align_cmn #2
-{
-    bool out_is_secondary = <bool> echo < true > ();
-    // restore reads to its raw form (orientation is restored)
-
-    INSDC:4na:bin out_raw_read
-        = < INSDC:4na:bin > simple_sub_select  < 'PRIMARY_ALIGNMENT', '( INSDC:4na:bin ) RAW_READ' > (.PRIMARY_ALIGNMENT_ID)
-        | < INSDC:4na:bin > NCBI:align:project_from_sequence < '( INSDC:4na:bin ) READ'> ( .SEQ_SPOT_ID, .SEQ_READ_ID );
-        
-    INSDC:4na:bin out_4na_bin 
-	    = NCBI:align:align_restore_read ( ref_read_internal, out_has_mismatch, tmp_out_mismatch_4na_bin, out_has_ref_offset, out_ref_offset, .READ_LEN )
-	    | NCBI:align:align_restore_read ( ref_read_internal, out_has_mismatch, tmp_out_mismatch_4na_bin, out_has_ref_offset, out_ref_offset )
-    	    | NCBI:align:raw_restore_read ( out_raw_read, .REF_ORIENTATION );
-	
-
-    // flags mismatches with the reference
-    // produced by actual comparison of REF_READ and READ
-    // TMP_HAS_MISMATCH is a hack to speed up retrieval during coverage recalculation
-    column bool_encoding TMP_HAS_MISMATCH;
-    bool out_has_mismatch
-        = .TMP_HAS_MISMATCH 
-	| NCBI:align:generate_has_mismatch ( REF_READ, READ, out_has_ref_offset, out_ref_offset );
-    readonly column bool HAS_MISMATCH = out_has_mismatch;
-
-    INSDC:4na:bin out_mismatch_4na_bin
-        = NCBI:align:generate_mismatch ( REF_READ, READ, out_has_ref_offset, out_ref_offset );
-
-    INSDC:4na:bin tmp_out_mismatch_4na_bin =  < INSDC:dna:text, INSDC:4na:bin > map < INSDC:4na:map:CHARSET, INSDC:4na:map:BINSET > ( .TMP_MISMATCH );
-
-    // temporary column for reference coverage calculation        
-    column < INSDC:dna:text> zip_encoding TMP_MISMATCH;
-
-    INSDC:dna:text out_mismatch_dna_text
-        = .TMP_MISMATCH
-        | < INSDC:4na:bin, INSDC:dna:text > map < INSDC:4na:map:BINSET, INSDC:4na:map:CHARSET > ( out_mismatch_4na_bin );
-    
-    readonly column INSDC:dna:text MISMATCH = out_mismatch_dna_text;
-    readonly column INSDC:4na:bin MISMATCH = out_mismatch_4na_bin;
-
-    physical column < INSDC:coord:zero > izip_encoding .MATE_REF_POS = MATE_REF_POS;
-    INSDC:coord:zero out_mate_ref_pos = .MATE_REF_POS
-                                      | < INSDC:coord:zero > simple_sub_select < '','REF_POS'> (MATE_ALIGN_ID);
-    
-    physical column < I64 > izip_encoding .MATE_REF_ID = MATE_REF_ID;
-    I64 out_mate_ref_id = .MATE_REF_ID
-                        | < I64 > simple_sub_select < '','REF_ID'> (MATE_ALIGN_ID);
-    
-    INSDC:coord:len out_mate_ref_len = < INSDC:coord:len > simple_sub_select < '','REF_LEN'> (MATE_ALIGN_ID);
-    physical column < I32 > izip_encoding .TEMPLATE_LEN = TEMPLATE_LEN;
-    I32 out_template_len = .TEMPLATE_LEN
-            | NCBI:align:template_len(REF_POS,out_mate_ref_pos,out_ref_len,out_mate_ref_len,REF_NAME,MATE_REF_NAME,SEQ_READ_ID);
-
-    physical column < bool > izip_encoding .MATE_REF_ORIENTATION = MATE_REF_ORIENTATION;
-    bool out_mate_ref_orientation = .MATE_REF_ORIENTATION
-                                  | < bool >  simple_sub_select < '','REF_ORIENTATION'> (MATE_ALIGN_ID);
-
-    I64 out_mate_align_id = .MATE_ALIGN_ID;
-    physical column <I64> izip_encoding .MATE_ALIGN_ID = MATE_ALIGN_ID;
-    extern column I64 MATE_ALIGN_ID = out_mate_align_id;
-
-    physical column < I64 > izip_encoding .PRIMARY_ALIGNMENT_ID = PRIMARY_ALIGNMENT_ID;
-
-    I32 read_idx = <I32> cast (.SEQ_READ_ID);
-    extern column I64 PRIMARY_ALIGNMENT_ID
-        = .PRIMARY_ALIGNMENT_ID
-        | <I64> simple_sub_select < 'SEQUENCE','PRIMARY_ALIGNMENT_ID' > (.SEQ_SPOT_ID,.SEQ_READ_ID);
-
-};
-
-
-/* compressed_by_reference
- *  aligns internally represented sequence against reference
- *  alignment transcript is stored
- *  original sequence is reconstructed
- */
-table NCBI:align:tbl:compressed_by_reference #1.1.0
-    = NCBI:align:tbl:align_cmn #2
-{
-    bool out_is_secondary = <bool> echo < false > ();
-
-    // one value per base i.e. length is same as sum of READ_LEN
-    // partitioned by READ_START and READ_LEN into alternative alignments
-    // flags mismatches with the reference
-    extern default column bool_encoding HAS_MISMATCH;
-    bool out_has_mismatch = .HAS_MISMATCH;
-
-    // has number of elements equal to number of true elements in HAS_MISMATCH
-    extern column INSDC:dna:text MISMATCH
-    {
-        read = out_mismatch_dna_text;
-        validate = < INSDC:dna:text > compare ( in_mismatch_dna_text, out_mismatch_dna_text );
-    }
-
-    INSDC:dna:text in_mismatch_dna_text
-        = < INSDC:dna:text, INSDC:dna:text > map < '.acmgrsvtwyhkdbn','NACMGRSVTWYHKDBN' > ( MISMATCH );
-
-    INSDC:4na:bin in_mismatch_4na_bin
-        = < INSDC:dna:text, INSDC:4na:bin > map < INSDC:4na:map:CHARSET, INSDC:4na:map:BINSET > ( in_mismatch_dna_text );
-
-    extern column < ascii > zip_encoding ALIGN_GROUP;
-
-    physical column < INSDC:4na:bin > zip_encoding .MISMATCH = in_mismatch_4na_bin;
-    
-    INSDC:4na:bin out_mismatch_4na_bin = .MISMATCH;
-    INSDC:dna:text out_mismatch_dna_text
-        = < INSDC:4na:bin, INSDC:dna:text > map < INSDC:4na:map:BINSET, INSDC:4na:map:CHARSET > ( out_mismatch_4na_bin );
-    
-    I64 out_mate_align_id
-        = .MATE_ALIGN_ID
-        | NCBI:align:get_mate_align_id (.SEQ_SPOT_ID);
-        
-    physical column <I64> izip_encoding .MATE_ALIGN_ID = MATE_ALIGN_ID;
-    extern column I64 MATE_ALIGN_ID = out_mate_align_id;
-
-    // restore reads from alignment columns and the reference
-    // optional .READ_LEN size defines PLOIDY
-    INSDC:4na:bin out_4na_bin
-	    = NCBI:align:align_restore_read ( ref_read_internal, out_has_mismatch, .MISMATCH, out_has_ref_offset, out_ref_offset, .READ_LEN )
-	    | NCBI:align:align_restore_read ( ref_read_internal, out_has_mismatch, .MISMATCH, out_has_ref_offset, out_ref_offset );
-
-    // restore reads to its raw form (orientation is restored)
-    INSDC:4na:bin out_raw_read = NCBI:align:raw_restore_read (out_4na_bin,.REF_ORIENTATION);
-
-    I64	primary_align_pair =  < I64 > simple_sub_select < 'SEQUENCE','PRIMARY_ALIGNMENT_ID'> (.SEQ_SPOT_ID);
-    I64 out_mate_ref_id = < I64 > simple_sub_select < '','REF_ID'> (MATE_ALIGN_ID);
-    bool  out_mate_ref_orientation = < bool >  simple_sub_select < '','REF_ORIENTATION'> (MATE_ALIGN_ID);
-    INSDC:coord:zero out_mate_ref_pos = < INSDC:coord:zero > simple_sub_select < '','REF_POS'> (MATE_ALIGN_ID);
-    INSDC:coord:len out_mate_ref_len = < INSDC:coord:len > simple_sub_select < '','REF_LEN'> (MATE_ALIGN_ID);
-    readonly column U32   MATE_EDIT_DISTANCE   = < U32 >   simple_sub_select < '','EDIT_DISTANCE'> (MATE_ALIGN_ID);
-    readonly column ascii MATE_CIGAR_LONG      = < ascii > simple_sub_select < '','CIGAR_LONG'> (MATE_ALIGN_ID);
-    readonly column ascii MATE_CIGAR_SHORT     = < ascii > simple_sub_select < '','CIGAR_SHORT'> (MATE_ALIGN_ID);
-    readonly column INSDC:coord:len MATE_CIGAR_LONG_LEN  = < INSDC:coord:len > simple_sub_select < '','CIGAR_LONG_LEN'> (MATE_ALIGN_ID);
-    readonly column INSDC:coord:len MATE_CIGAR_SHORT_LEN = < INSDC:coord:len > simple_sub_select < '','CIGAR_SHORT_LEN'> (MATE_ALIGN_ID);
-    
-    I32 out_template_len = NCBI:align:template_len (REF_POS,out_mate_ref_pos,out_ref_len,out_mate_ref_len,REF_NAME,MATE_REF_NAME,SEQ_READ_ID);    
-};
-
-
-/* align_sorted
- *  deflated alignment data sorted against reference
- */
-table NCBI:align:tbl:align_sorted #1.1.0
-    = NCBI:align:tbl:compressed_by_reference #1.1.0
-    , NCBI:align:tbl:global_ref_block #1.0.0
-{
-    // 128K
-    column default limit = 131072;
-};
-
-
-/* align_unsorted
- *  deflated alignment unsorted data
- */
-table NCBI:align:tbl:align_unsorted #1.1.0
-    = NCBI:align:tbl:compressed_by_reference #1.1.0
-    , NCBI:align:tbl:local_ref_block #1.0.0
-{
-    // 128K
-    column default limit = 131072;
-};
-
-
-/* align_mate_sorted
- */
-table NCBI:align:tbl:align_mate_sorted #1.0.1
-    = NCBI:align:tbl:align_full #1.0.0
-    , NCBI:align:tbl:global_ref_block #1.0.0
-{
-    // 128K
-    column default limit = 131072;
-};
-
-
-/* align_mate_unsorted
- */
-table NCBI:align:tbl:align_mate_unsorted #1.0.1
-    = NCBI:align:tbl:align_full #1.0.0
-    , NCBI:align:tbl:local_ref_block #1.0.0
-{
-    // 128K
-    column default limit = 131072;
-};
-
-/* align_allele
- *  alleles coverage extension
- */
-table NCBI:align:tbl:align_allele #1.1.0
-    = NCBI:align:tbl:align_unsorted #1.1.0
-{
-    extern column < I64 > izip_encoding EVIDENCE_ALIGNMENT_IDS;
-
-    /*
-    INSDC:quality:phred out_qual_phred
-        = < INSDC:quality:phred > echo < 30 > ( out_4na_bin );
-    */
-};
-
-/*--------------------------------------------------------------------------
- * seq
- *  alignment sequence table
- */
-physical
-I64 NCBI:align:sorted:alignment_id_encoding #1.0 
-{
-    decode
-    {
-        I64 outliers_removed = iunzip ( @ );
-        return < I64 > outlier_decode < 0 > ( outliers_removed );
-    }
-
-    encode
-    {
-        I64 outliers_removed = < I64 > outlier_encode < 0 > ( @ );
-        return izip ( outliers_removed );
-    }
-}
-
-
-table NCBI:align:tbl:seq #1.0.0 =
-    NCBI:tbl:base_space #2.0.3,
-    NCBI:tbl:phred_quality #2.0.4,
-    NCBI:align:tbl:cmp_base_space #1,
-    NCBI:SRA:tbl:spotdesc #1.0.2,
-    NCBI:SRA:tbl:stats #1.2.0
-{
-    // 128K
-    column default limit = 131072;
-
-    // gets primary record in alignment table (size of column is NREADS)
-    // if sorted - should used special encoding
-    extern column <I64> izip_encoding PRIMARY_ALIGNMENT_ID;
-
-    INSDC:coord:zero trim_start = < INSDC:coord:zero > echo < 0 > ();
-    INSDC:coord:len trim_len = _spot_len;
-
-    // size is NREADS
-    extern column < U8 > zip_encoding ALIGNMENT_COUNT;
-
-    // auto-generate name from row-id
-    ascii out_name_fmt = < ascii > echo < '$R' > ();
-
-    // temparary column
-    extern column < U64 > izip_encoding TMP_KEY_ID;
-
-    // restored  READ
-    INSDC:4na:bin out_dcmp_4na_bin
-        = NCBI:align:seq_restore_read (out_cmp_4na_bin, .PRIMARY_ALIGNMENT_ID, .READ_LEN, .READ_TYPE);
-    
-    extern column < U64 > izip_encoding TI;
-};
-
-
-table NCBI:align:tbl:cs_seq #1.1
-{
-    /* writable columns */
-    extern column INSDC:color:text CMP_CSREAD
-        = out_cmp_color_text
-        ;
-
-    extern column < INSDC:dna:text > zip_encoding CS_KEY;
-
-    extern default column < INSDC:quality:phred > zip_encoding QUALITY;
-
-    extern column < I64 > izip_encoding PRIMARY_ALIGNMENT_ID;
-
-    extern column < U8 > zip_encoding ALIGNMENT_COUNT;
-
-    extern column < INSDC:SRA:platform_id > zip_encoding PLATFORM;
-
-    extern column < ascii > zip_encoding LABEL;
-    extern column < INSDC:coord:zero > izip_encoding LABEL_START;
-    extern column < INSDC:coord:len > izip_encoding LABEL_LEN;
-
-    extern column < INSDC:SRA:xread_type > zip_encoding READ_TYPE;
-    extern column < INSDC:coord:zero > izip_encoding READ_START;
-    extern column < INSDC:coord:len > izip_encoding READ_LEN;
-    extern column < INSDC:SRA:read_filter > zip_encoding READ_FILTER;
-
-    extern column < U64 > izip_encoding TMP_KEY_ID;
-
-    extern column < ascii > zip_encoding SPOT_GROUP;
-
-    extern column < U64 > izip_encoding TI;
-
-    /* writing rules */
-    INSDC:x2cs:bin in_cmp_x2cs_bin
-        = < INSDC:color:text, INSDC:x2cs:bin > map < INSDC:x2cs:map:CHARSET, INSDC:x2cs:map:BINSET > ( CMP_CSREAD )
-        ;
-    INSDC:2cs:bin in_cmp_2cs_bin
-        = < INSDC:x2cs:bin, INSDC:2cs:bin > map < INSDC:x2cs:map:BINSET, [ 0, 1, 2, 3, 0 ] > ( in_cmp_x2cs_bin )
-        ;
-    INSDC:x2cs:bin in_cmp_alt_x2cs_bin
-        = < INSDC:x2cs:bin, INSDC:x2cs:bin > map < INSDC:x2cs:map:BINSET, [ 0, 0, 0, 0, 4 ] > ( in_cmp_x2cs_bin )
-        ;
-    physical column INSDC:2cs:packed .CMP_CSREAD
-        = ( INSDC:2cs:packed ) pack ( in_cmp_2cs_bin )
-        ;
-    physical column < INSDC:x2cs:bin > zip_encoding .CMP_ALTCSREAD
-        = < INSDC:x2cs:bin > trim < ALIGN_LEFT, 0 > ( in_cmp_alt_x2cs_bin )
-        ;
-
-    /* reading rules */
-    INSDC:2cs:packed phys_cmp_2cs_packed
-        = .CMP_CSREAD
-        ;
-    INSDC:x2cs:bin phys_cmp_alt_x2cs_bin
-        = .CMP_ALTCSREAD
-        ;
-    INSDC:2cs:packed phys_2cs_packed
-        = .CSREAD
-        ;
-    INSDC:x2cs:bin phys_alt_x2cs_bin
-        = .ALTCSREAD
-        ;
-    INSDC:2cs:bin out_cmp_2cs_bin
-        = ( INSDC:2cs:bin ) unpack ( phys_cmp_2cs_packed )
-        ;
-    INSDC:2cs:bin out_2cs_bin
-        = ( INSDC:2cs:bin ) unpack ( phys_2cs_packed )
-        ;
-    INSDC:x2cs:bin out_cmp_x2cs_bin
-        = ( INSDC:x2cs:bin ) < U8 > bit_or < ALIGN_RIGHT > ( out_cmp_2cs_bin, phys_cmp_alt_x2cs_bin )
-        | ( INSDC:x2cs:bin ) out_cmp_2cs_bin
-        ;
-    INSDC:x2cs:bin out_x2cs_bin
-        = ( INSDC:x2cs:bin ) < U8 > bit_or < ALIGN_RIGHT > ( out_2cs_bin, phys_alt_x2cs_bin )
-        | ( INSDC:x2cs:bin ) out_2cs_bin
-        ;
-     INSDC:color:text out_cmp_color_text
-        = < INSDC:x2cs:bin, INSDC:color:text > map <  INSDC:x2cs:map:BINSET, INSDC:x2cs:map:CHARSET > ( out_cmp_x2cs_bin )
-        ;
-     INSDC:color:text out_color_text
-        = < INSDC:x2cs:bin, INSDC:color:text > map <  INSDC:x2cs:map:BINSET, INSDC:x2cs:map:CHARSET > ( out_x2cs_bin )
-        ;
-
-    /* triggers from stats */
-    INSDC:quality:phred in_qual_phred
-        = QUALITY
-        ;
-    INSDC:coord:len in_read_len
-        = READ_LEN
-        ;
-    INSDC:SRA:xread_type in_read_type
-        = READ_TYPE
-        ;
-    ascii in_spot_group
-        = SPOT_GROUP
-        ;
-    trigger meta_stats
-        = NCBI:SRA:cmp_stats_trigger ( in_cmp_x2cs_bin, in_qual_phred, in_read_len, in_read_type, in_spot_group )
-        | NCBI:SRA:cmp_stats_trigger ( in_cmp_x2cs_bin, in_qual_phred, in_read_len, in_read_type )
-        ;
-    trigger qual_stats
-        = NCBI:SRA:phred_stats_trigger #1 ( in_qual_phred )
-        ;
-};
-
-table NCBI:align:view:cs_seq #1.1 = NCBI:align:tbl:cs_seq #1.1
-{
-    // various READ columns
-    default readonly column INSDC:dna:text READ
-        = < INSDC:4na:bin, INSDC:dna:text > map < INSDC:4na:map:BINSET, INSDC:4na:map:CHARSET > ( out_dcmp_4na_bin )
-        | < INSDC:4na:bin, INSDC:dna:text > map < INSDC:4na:map:BINSET, INSDC:4na:map:CHARSET > ( out_4na_bin )
-        ;
-    readonly column INSDC:4na:bin READ = out_dcmp_4na_bin | out_4na_bin;
-    readonly column INSDC:4na:packed READ = pack ( out_dcmp_4na_bin ) | pack ( out_4na_bin );
-    readonly column INSDC:x2na:bin READ = out_dcmp_x2na_bin | out_x2na_bin;
-    readonly column INSDC:2na:bin READ = out_dcmp_2na_bin | out_2na_bin;
-    INSDC:2na:bin out_dcmp_2na_bin
-        = < INSDC:x2na:bin, INSDC:2na:bin > map < INSDC:x2na:map:BINSET, [ 0, 1, 2, 3, 0 ] > ( out_dcmp_x2na_bin )
-        ;
-    INSDC:2na:bin out_2na_bin
-        = < INSDC:x2na:bin, INSDC:2na:bin > map < INSDC:x2na:map:BINSET, [ 0, 1, 2, 3, 0 ] > ( out_x2na_bin )
-        ;
-    readonly column INSDC:2na:packed READ = pack ( out_dcmp_2na_bin ) | pack ( out_2na_bin );
-
-    // decompression in base space
-    INSDC:coord:len cmp_read_len
-        = < INSDC:coord:len > NCBI:align:make_cmp_read_desc #1 < true > ( .READ_LEN, .PRIMARY_ALIGNMENT_ID )
-        ;
-    INSDC:coord:zero cmp_read_start
-        = NCBI:align:make_read_start #1 ( cmp_read_len )
-        ; 
-    INSDC:x2na:bin out_cmp_x2na_bin
-        = NCBI:dna_from_color #1 ( out_cmp_x2cs_bin, cmp_read_start, cmp_read_len, .CS_KEY, color_matrix )
-        ;
-    INSDC:x2na:bin out_x2na_bin
-        = NCBI:dna_from_color #1 ( out_x2cs_bin, .READ_START, .READ_LEN, .CS_KEY, color_matrix )
-        ;
-    INSDC:4na:bin out_cmp_4na_bin
-        = < INSDC:x2na:bin, INSDC:4na:bin > map < INSDC:x2na:map:BINSET, [ 1, 2, 4, 8, 15 ] > ( out_cmp_x2na_bin )
-        ;
-    INSDC:4na:bin out_4na_bin
-        = < INSDC:x2na:bin, INSDC:4na:bin > map < INSDC:x2na:map:BINSET, [ 1, 2, 4, 8, 15 ] > ( out_x2na_bin )
-        ;
-    INSDC:4na:bin out_dcmp_4na_bin
-        = NCBI:align:seq_restore_read ( out_cmp_4na_bin, .PRIMARY_ALIGNMENT_ID, .READ_LEN, .READ_TYPE )
-        ;
-
-
-    // various CSREAD columns
-    default readonly column INSDC:color:text CSREAD
-        = < INSDC:x2cs:bin, INSDC:color:text > map <  INSDC:x2cs:map:BINSET, INSDC:x2cs:map:CHARSET > ( out_dcmp_x2cs_bin )
-        | out_color_text;
-    readonly column INSDC:x2cs:bin CSREAD = out_dcmp_x2cs_bin | out_x2cs_bin;
-    readonly column INSDC:2cs:bin CSREAD = out_dcmp_2cs_bin | out_2cs_bin;
-    INSDC:2cs:bin out_dcmp_2cs_bin
-        = < INSDC:x2cs:bin, INSDC:2cs:bin > map < INSDC:x2cs:map:BINSET, [ 0, 1, 2, 3, 0 ] > ( out_dcmp_x2cs_bin )
-        ;
-    readonly column INSDC:2cs:packed CSREAD = pack ( out_dcmp_2cs_bin ) | out_2cs_bin;
-
-
-    // decompression in color space
-    INSDC:x2na:bin out_dcmp_x2na_bin
-        = < INSDC:4na:bin, INSDC:x2na:bin > map < INSDC:4na:map:BINSET, [ 4,0,1,4,2,4,4,4,3,4,4,4,4,4,4,4 ] > ( out_dcmp_4na_bin )
-        ;
-    INSDC:x2cs:bin out_dcmp_x2na_x2cs_bin
-        = NCBI:color_from_dna #1 ( out_dcmp_x2na_bin, .READ_START, .READ_LEN, .CS_KEY, color_matrix )
-        ;
-    INSDC:coord:len aligned_read_len
-        = < INSDC:coord:len > NCBI:align:make_cmp_read_desc #1 < false > ( .READ_LEN, .PRIMARY_ALIGNMENT_ID )
-        ; 
-    INSDC:x2cs:bin out_dcmp_x2cs_bin
-        = < INSDC:x2cs:bin > NCBI:align:seq_construct_read #1 ( out_dcmp_x2na_x2cs_bin, .READ_LEN, out_cmp_x2cs_bin, cmp_read_len )
-        ;
-
-    // CS_NATIVE - dynamic
-    U32 cmp_csread_row_len
-        = row_len #1 ( phys_cmp_2cs_packed )
-        ;
-    U32 cmp_csread_not_zero
-        = < U32 > clip < 0, 1 > ( cmp_csread_row_len )
-        ;
-    readonly column bool CS_NATIVE
-        = < U32, bool > map < [ 0, 1 ], [ false, true ] > ( cmp_cs_read_not_zero )
-        ;
-
-    // COLOR_MATRIX
-    readonly column U8 COLOR_MATRIX
-        = color_matrix
-        ;
-    U8 color_matrix
-        = < U8 > echo < INSDC:color:default_matrix > ()
-        ;
-
-    // various QUALITY types
-    readonly column INSDC:quality:text:phred_33 QUALITY
-        = out_qual_text_phred_33
-        | ( INSDC:quality:text:phred_33 ) < B8 > sum < 33 > ( .QUALITY );
-    readonly column INSDC:quality:text:phred_64 QUALITY
-        = out_qual_text_phred_64
-        | ( INSDC:quality:text:phred_64 ) < B8 > sum < 64 > ( .QUALITY );
-
-    // SPOT_LEN
-    INSDC:coord:len spot_len
-        = ( INSDC:coord:len ) row_len ( out_dcmp_4na_bin )
-        ;
-    readonly column INSDC:coord:len SPOT_LEN = spot_len;
-
-    // TRIM_START
-    readonly column INSDC:coord:zero TRIM_START
-        = < INSDC:coord:zero > echo < 0 > ()
-        ;
-    readonly column INSDC:coord:one TRIM_START
-        = < INSDC:coord:one > echo < 1 > ()
-        ;
-    // TRIM_LEN
-    readonly column INSDC:coord:len TRIM_LEN = spot_len;
-
-    // MIN_SPOT_ID
-    readonly column INSDC:SRA:spotid_t MIN_SPOT_ID
-        = < INSDC:SRA:spotid_t > meta:value < "STATS/TABLE/SPOT_MIN" > ()
-        ;
-    // MAX_SPOT_ID
-    readonly column INSDC:SRA:spotid_t MAX_SPOT_ID
-        = < INSDC:SRA:spotid_t > meta:value < "STATS/TABLE/SPOT_MAX" > ()
-        ;
-    // SPOT_COUNT
-    readonly column U64 SPOT_COUNT
-        = < U64 > meta:value < "STATS/TABLE/SPOT_COUNT" > ()
-        ;
-    // BASE_COUNT
-    U64 base_count
-        = < U64 > meta:value < "STATS/TABLE/BASE_COUNT" > ()
-        ;
-    readonly column U64 BASE_COUNT = base_count;
-    // BIO_BASE_COUNT
-    readonly column U64 BIO_BASE_COUNT
-        = < U64 > meta:value < "STATS/TABLE/BIO_BASE_COUNT" > ()
-        ;
-    // CMP_BASE_COUNT
-    readonly column U64 CMP_BASE_COUNT
-        = < U64 > meta:value < "STATS/TABLE/CMP_BASE_COUNT" > ()
-        | base_count
-        ;
-
-    // various PLATFORM
-    // TBD
-
-    // SPOT_ID
-    I64 rowid_64 = row_id ();
-    readonly column INSDC:SRA:spotid_t SPOT_ID
-        = cast ( rowid_64 )
-        ;
-        
-    readonly column ascii NAME
-        = sprintf < "%u" > ( SPOT_ID )
-        ;
-
-};
-
-
-/***********************************
-* Reference table - to store reference sequences
-* Sequences are divided in chunks. Two sequences never share a chunk.
-* SEQ_LEN     - real size of a chunk should never exceed MAX_SEQ_LEN when it is set
-* READ        - inherited from NCBI:tbl:base_space
-* CMP_READ,CMP_ALTREAD - are inherited from NCBI:align:tbl:cmp_base_space
-* SEQ_ID,SEQ_START,SEQ_LEN are inherited from  NCBI:align:tbl:seqloc
-* .skey contains NAME of the chunk - it corresponds to actual name used in BAM (chr1,chr2, etc....)
-* 
-* SEQ_START,SEQ_LEN,MAX_SEQ_LEN,SEQID and rowlen(READ) operate the following way
-* - SEQ_LEN < MAX_SEQ_LEN - should only happen on the last chunk of the sequence
-* - .READ is absent - there should be a retrieval from external services by SEQ_ID,SEQ_START,SEQ_LEN
-* - rowlen(.READ) = 0  && SEQ_START==0 (used as flag) -  the sequence is SEQ_LEN repetition of 'N'
-* - rowlen(.READ) = 0  && SEQ_START >= 1 - the sequence have to be fetched from external sources
-* - 0 < rowlen(.READ)< SEQ_LEN -- the sequence have to be filled with 'N's
-* 
-v***********************************/
-table NCBI:align:tbl:reference #2 =
-    NCBI:align:tbl:cmp_base_space #1,
-    NCBI:tbl:base_space #2.0.3,
-    NCBI:tbl:seqloc #1,
-    NCBI:SRA:tbl:stats #1.2.0
-{
-    INSDC:quality:phred out_qual_phred
-        = < INSDC:quality:phred > echo < 30 > ( out_dcmp_4na_bin );
-
-    //  MAX_SEQ_LEN - should be a constant == static column
-    extern column < U32 > izip_encoding MAX_SEQ_LEN;
-
-    // indicates if sequence has circular structure
-    // copied from refSeq
-    extern column bool_encoding CIRCULAR;
-
-    // make CS_KEY writable
-    INSDC:dna:text in_cs_key
-        = < INSDC:dna:text, INSDC:dna:text > map < 'acgtn', 'ACGTN' > ( CS_KEY );
-    physical column < INSDC:dna:text > zip_encoding .CS_KEY = in_cs_key;
-    
-    U32 in_spot_len = SEQ_LEN;
-    
-    INSDC:coord:len _alt_in_read_len
-        = READ_LEN
-        | SEQ_LEN;
-
-    INSDC:SRA:xread_type _alt_in_read_type
-        = READ_TYPE
-        | < INSDC:SRA:xread_type > echo < SRA_READ_TYPE_BIOLOGICAL > ();
-
-    // extra columns needed for CS conversion
-    INSDC:coord:zero out_read_start = < INSDC:coord:zero > echo < 0 > ();
-    INSDC:coord:len  out_read_len = .SEQ_LEN;
-
-    extern column utf8  NAME = out_spot_name_utf8;
-    physical utf8 .NAME = idx:text:insert  < 'i_name' > ( NAME );
-    
-    utf8 out_spot_name_utf8 = idx:text:project < 'i_name' > (.NAME );
-    
-    ascii out_spot_name = cast ( out_spot_name_utf8 );
-
-    INSDC:coord:zero trim_start = < INSDC:coord:zero > echo < 0 > ();
-    INSDC:coord:len trim_len = base_space_spot_len;
-
-    ascii out_label
-        = < ascii > echo < "reference" > ();
-    INSDC:coord:zero out_label_start
-        = < INSDC:coord:zero > echo < 0 > ();
-    INSDC:coord:len out_label_len
-        = < INSDC:coord:len > echo < 9 > ();
-
-    U32 out_nreads
-        = < U32 > echo < 1 > ();
-    INSDC:SRA:xread_type out_read_type
-        = < INSDC:SRA:xread_type > echo < 3 > ();
-    INSDC:SRA:read_filter out_rd_filter
-        = < INSDC:SRA:read_filter > echo < SRA_READ_FILTER_PASS > ();
-
-
-// Columns of computed coverages by alignment
-
-    // TBD: use percentiles instead of min/max?
-    // maximum value clipped at 255 of the coverage density
-    // for a chunk
-    extern column < U8 > izip_encoding CGRAPH_HIGH;
-
-    // minimum value clipped at 255 of the coverage density
-    // for a chunk
-    extern column < U8 > izip_encoding CGRAPH_LOW;
-
-    // count of the number of mismatches in the chunk
-    extern column < U32 > izip_encoding CGRAPH_MISMATCHES;
-    
-    // count of the number of inserts and deletes in the chunk
-    extern column < U32 > izip_encoding CGRAPH_INDELS;
-
-    // List of row ids from alignment tables
-    extern column < I64 > izip_encoding PRIMARY_ALIGNMENT_IDS;
-    extern column < I64 > izip_encoding SECONDARY_ALIGNMENT_IDS;
-    extern column < I64 > izip_encoding EVIDENCE_INTERVAL_IDS;
-
-    // both OVERLAP_REF_* columns are array of three elements, matching number of *_IDS columns above.
-    // points back to an offset where the alignments to this chunk start
-    extern column < INSDC:coord:zero > izip_encoding OVERLAP_REF_POS;
-    // indicates the length of the longest tail of the alignmnent to this chunk which start in previous chunks
-    // if value of an element in this col is zero corresponding value of OVERLAP_REF_POS is meaningless
-    extern column < INSDC:coord:len > izip_encoding OVERLAP_REF_LEN;
-
-    // Mechanism to seach for NAME 
-    readonly column vdb:row_id_range NAME_RANGE
-        = idx:text:lookup < 'i_name', 'QUERY_SEQ_NAME' > ();
-
-    // Fully instantiates READ
-    INSDC:4na:bin out_dcmp_4na_bin
-        = NCBI:align:ref_restore_read (out_cmp_4na_bin, .SEQ_ID, .SEQ_START, .SEQ_LEN);
-}
-
-// THE DATABASES
-database NCBI:align:db:alignment_sorted #1.2.1
-{
-    table NCBI:align:tbl:reference #2 REFERENCE;
-    table NCBI:align:tbl:align_sorted #1.1 PRIMARY_ALIGNMENT;
-    table NCBI:align:tbl:align_mate_sorted #1.0 SECONDARY_ALIGNMENT;
-    table NCBI:align:tbl:seq #1.0 SEQUENCE;
-    table NCBI:align:view:cs_seq #1.1 CS_SEQUENCE;
-    table NCBI:align:tbl:qstat #1.0 QUAL_STAT;
-};
-
-database NCBI:align:db:alignment_unsorted #1.2.1
-{
-    table NCBI:align:tbl:reference #2 REFERENCE;
-    table NCBI:align:tbl:align_unsorted #1.1 PRIMARY_ALIGNMENT;
-    table NCBI:align:tbl:align_mate_unsorted #1.0 SECONDARY_ALIGNMENT;
-    table NCBI:align:tbl:seq #1.0 SEQUENCE;
-    table NCBI:align:view:cs_seq #1.1 CS_SEQUENCE;
-    table NCBI:align:tbl:qstat #1.0 QUAL_STAT;
-};
-
-database NCBI:align:db:alignment_evidence #1.2.1
-{
-    table NCBI:align:tbl:reference #2 REFERENCE;
-    table NCBI:align:tbl:align_unsorted #1.1 PRIMARY_ALIGNMENT;
-    table NCBI:align:tbl:align_mate_unsorted #1.0 SECONDARY_ALIGNMENT;
-    table NCBI:align:tbl:align_allele #1.1 EVIDENCE_INTERVAL;
-    table NCBI:align:tbl:align_mate_unsorted #1.0 EVIDENCE_ALIGNMENT;
-    table NCBI:align:tbl:seq #1.0 SEQUENCE;
-    table NCBI:align:view:cs_seq #1.1 CS_SEQUENCE;
-    table NCBI:align:tbl:qstat #1.0 QUAL_STAT;
-};
-
-database NCBI:align:db:alignment_evidence_sorted #1.0.1
-{
-    table NCBI:align:tbl:reference #2 REFERENCE;
-    table NCBI:align:tbl:align_sorted #1.1 PRIMARY_ALIGNMENT;
-    table NCBI:align:tbl:align_mate_sorted #1.0 SECONDARY_ALIGNMENT;
-    table NCBI:align:tbl:align_allele #1.1 EVIDENCE_INTERVAL;
-    table NCBI:align:tbl:align_mate_unsorted #1.0 EVIDENCE_ALIGNMENT;
-    table NCBI:align:tbl:seq #1.0 SEQUENCE;
-    table NCBI:align:view:cs_seq #1.1 CS_SEQUENCE;
-    table NCBI:align:tbl:qstat #1.0 QUAL_STAT;
-};
diff --git a/interfaces/align/alignsrc.h b/interfaces/align/alignsrc.h
deleted file mode 100644
index c894419..0000000
--- a/interfaces/align/alignsrc.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_align_alignsrc_
-#define _h_align_alignsrc_
-
-#ifndef _h_align_extern_
- #include <align/extern.h>
-#endif
-
-#include <stdint.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * AlignSrc
- *  an alignment guy
- */
-typedef struct AlignSrc AlignSrc;
-
-
-/* Make
- *  create an alignment source object from BAM file
- *
- *  "as" [ OUT ] - return parameter for AlignSrc object
- *
- *  "bam" [ IN ] - NUL terminated path to BAM file
- *
- *  "bai" [ IN, NULL OKAY ] - optional NUL terminated path to BAM index file
- */
-ALIGN_EXTERN int CC AlignSrcMakeFromBAM ( const AlignSrc **as, const char *bam, const char *bai );
-
-
-/* Dispose
- *  release all resources associated with alignment source
- */
-ALIGN_EXTERN int CC AlignSrcDispose ( const AlignSrc *self );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_align_alignsrc_ */
diff --git a/interfaces/align/bam.h b/interfaces/align/bam.h
deleted file mode 100644
index fafd578..0000000
--- a/interfaces/align/bam.h
+++ /dev/null
@@ -1,831 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#ifndef _h_align_bam_
-#define _h_align_bam_
-
-#ifndef _h_align_extern_
-#include <align/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#include <stdarg.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KDirectory;
-struct KFile;
-struct VPath;
-struct AlignAccessDB;
-struct AlignAccessAlignmentEnumerator;
-
-
-/*--------------------------------------------------------------------------
- * BAMAlignment
- */
-typedef struct BAMAlignment BAMAlignment;
-
-    
-/* GetBAMAlignment
- *  get property
- *
- * Release with BAMAlignmentRelease.
- */
-ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorGetBAMAlignment
-    ( const struct AlignAccessAlignmentEnumerator *self, const BAMAlignment **result );
-
-
-/* AddRef
- * Release
- */
-ALIGN_EXTERN rc_t CC BAMAlignmentAddRef ( const BAMAlignment *self );
-ALIGN_EXTERN rc_t CC BAMAlignmentRelease ( const BAMAlignment *self );
-
-
-/* GetReadLength
- *  get the sequence length
- *  i.e. the number of elements of both sequence and quality
- *
- *  "length" [ OUT ] - length in bases of query sequence and quality
- */
-ALIGN_EXTERN rc_t CC BAMAlignmentGetReadLength ( const BAMAlignment *self, uint32_t *length );
-
-
-/* GetSequence
- *  get the sequence data [0..ReadLength)
- *  caller provides buffer of ReadLength bytes
- *
- *  "sequence" [ OUT ] - pointer to a buffer of at least ReadLength bytes
- */
-ALIGN_EXTERN rc_t CC BAMAlignmentGetSequence ( const BAMAlignment *self, char *sequence );
-
-/* GetSequence2
- *  get the sequence data [0..ReadLength)
- *  caller provides buffer of ReadLength bytes
- *
- *  "sequence" [ OUT ] - pointer to a buffer of at least ReadLength bytes
- *
- *  "start" [ IN ] and "stop" [ IN ] - zero-based coordinates, half-closed interval
- */
-ALIGN_EXTERN rc_t CC BAMAlignmentGetSequence2 ( const BAMAlignment *self, char *sequence, uint32_t start, uint32_t stop);
-
-    
-/* GetQuality
- *  get the raw quality data [0..ReadLength)
- *  values are unsigned with 0xFF == missing
- *
- *  "quality" [ OUT ] - return param for quality sequence
- *   held internally, validity is guaranteed for the life of the BAMAlignment
- */
-ALIGN_EXTERN rc_t CC BAMAlignmentGetQuality ( const BAMAlignment *self, const uint8_t **quality );
-
-/* GetQuality2
- *  get the raw quality data [0..ReadLength) from OQ if possible else from QUAL
- *  values are unsigned with 0xFF == missing
- *
- *  "quality" [ OUT ] - return param for quality sequence
- *   held internally, validity is guaranteed for the life of the BAMAlignment
- */
-ALIGN_EXTERN rc_t CC BAMAlignmentGetQuality2(const BAMAlignment *self, const uint8_t **quality, uint8_t *offset);
-
-/* GetRefSeqId
- *  get id of reference sequence
- *  pass result into BAMFileGetRefSeqById to get the Reference Sequence record
- *
- *  "refSeqId" [ OUT ] - zero-based id of reference sequence
- *   returns -1 if set as invalid within BAM ( rc may be zero )
- */
-ALIGN_EXTERN rc_t CC BAMAlignmentGetRefSeqId ( const BAMAlignment *self, int32_t *refSeqId );
-
-/* GetMateRefSeqId
- *  get id of mate's reference sequence
- *  pass result into BAMFileGetRefSeqById to get the Reference Sequence record
- *
- *  "refSeqId" [ OUT ] - zero-based id of reference sequence
- *   returns -1 if invalid
- */
-ALIGN_EXTERN rc_t CC BAMAlignmentGetMateRefSeqId ( const BAMAlignment *self, int32_t *refSeqId );
-
-
-/* GetPosition
- *  get the aligned position on the ref. seq.
- *
- *  "n" [ IN ] - zero-based position index for cases of multiple alignments
- *
- *  "pos" [ OUT ] - zero-based position on reference sequence
- *  returns -1 if invalid
- */
-ALIGN_EXTERN rc_t CC BAMAlignmentGetPosition ( const BAMAlignment *self, int64_t *pos );
-    
-/* GetPosition2
- *  get the aligned start position on the ref. seq.
- *  get the aligned length on the ref. seq.
- *
- *  "n" [ IN ] - zero-based position index for cases of multiple alignments
- *
- *  "pos" [ OUT ] - zero-based position on reference sequence
- *  returns -1 if invalid
- *
- *  "length" [ OUT ] - length of alignment on reference sequence
- *  returns 0 if invalid
- */
-ALIGN_EXTERN rc_t CC BAMAlignmentGetPosition2 ( const BAMAlignment *self, int64_t *pos, uint32_t *length );
-    
-
-/* GetMatePosition
- *  starting coordinate of mate's alignment on ref. seq.
- *
- *  "pos" [ OUT ] - zero-based position on reference sequence
- *  returns -1 if invalid
- */
-ALIGN_EXTERN rc_t CC BAMAlignmentGetMatePosition ( const BAMAlignment *self, int64_t *pos );
-
-
-/* IsMapped
- *  is the alignment mapped to something
- */
-ALIGN_EXTERN bool CC BAMAlignmentIsMapped ( const BAMAlignment *self );
-
-
-/* GetReadGroupName
- *  get the name of the read group (i.e. accession)
- *  pass result into BAMFileGetReadGroupByName to get the Read Group record
- *
- *  "name" [ OUT ] - return param for NUL-terminated read group name
- *   held internally, validity is guaranteed for the life of the BAMAlignment
- */
-ALIGN_EXTERN rc_t CC BAMAlignmentGetReadGroupName ( const BAMAlignment *self, const char **name );
-
-
-/* GetReadName
- *  get the read name (i.e. spot name)
- * GetReadName2
- *  get the read name and length in bytes
- *
- *  "name" [ OUT ] - return param for NUL-terminated read name
- *   held internally, validity is guaranteed for the life of the BAMAlignment
- *
- *  "length" [ OUT ] - return the number of bytes in "name"
- *   excluding terminating NUL.
- */
-ALIGN_EXTERN rc_t CC BAMAlignmentGetReadName ( const BAMAlignment *self, const char **name );
-ALIGN_EXTERN rc_t CC BAMAlignmentGetReadName2 ( const BAMAlignment *self, const char **name, size_t *length );
-    
-    
-/* GetReadName3
- *  get the read name and length in bytes
- *  applies fixups to name
- *
- *  "name" [ OUT ] - return param for read name
- *   held internally, validity is guaranteed for the life of the BAMAlignment
- *
- *  "length" [ OUT ] - return the number of bytes in "name"
- */
-ALIGN_EXTERN rc_t CC BAMAlignmentGetReadName3 ( const BAMAlignment *self, const char **name, size_t *length );
-
-/* HasColorSpace
- *  Does the alignment have colorspace info
- */
-ALIGN_EXTERN bool CC BAMAlignmentHasColorSpace ( const BAMAlignment *self );
-
-/* GetCSKey
- *  get the colorspace key
- *
- *  "cskey" [ OUT ] - return param 
- */
-ALIGN_EXTERN rc_t CC BAMAlignmentGetCSKey ( const BAMAlignment *self, char cskey[1] );
-
-ALIGN_EXTERN rc_t CC BAMAlignmentGetCSSeqLen ( const BAMAlignment *self, uint32_t *seqLen );
-/* GetCSSequence
- *  get the colorspace sequence data [0..seqLen)
- *  caller provides buffer of seqLen bytes
- *
- *  "csseq" [ OUT ] - pointer to a buffer of at least seqLen bytes
- *  "seqLen" [ IN ] - length of sequence from BAMAlignmentGetCSSeqLen
- */
-ALIGN_EXTERN rc_t CC BAMAlignmentGetCSSequence ( const BAMAlignment *self, char *csseq, uint32_t seqLen );
-
-ALIGN_EXTERN rc_t CC BAMAlignmentGetCSQuality(BAMAlignment const *cself, uint8_t const **quality, uint8_t *offset);
-
-
-/* GetFlags
- *  return the raw "flags" bitmap word
- *
- *  "flags" [ OUT ] - return parameter for bitmap word
- */
-enum BAMFlags
-{
-    BAMFlags_bit_WasPaired = 0,  /* was paired when sequenced */
-    BAMFlags_bit_IsMappedAsPair,
-    BAMFlags_bit_SelfIsUnmapped,
-    BAMFlags_bit_MateIsUnmapped,
-    BAMFlags_bit_SelfIsReverse,
-    BAMFlags_bit_MateIsReverse,
-    BAMFlags_bit_IsFirst,        /* and mate exists */
-    BAMFlags_bit_IsSecond,       /* and mate exists */
-    BAMFlags_bit_IsNotPrimary,   /* a read having split hits may have multiple primary alignments */
-    BAMFlags_bit_IsLowQuality,   /* fails platform/vendor quality checks */
-    BAMFlags_bit_IsDuplicate,    /* PCR or optical dup */
-    
-    BAMFlags_WasPaired      = (1 << BAMFlags_bit_WasPaired),
-    BAMFlags_IsMappedAsPair	= (1 << BAMFlags_bit_IsMappedAsPair),
-    BAMFlags_SelfIsUnmapped	= (1 << BAMFlags_bit_SelfIsUnmapped),
-    BAMFlags_MateIsUnmapped	= (1 << BAMFlags_bit_MateIsUnmapped),
-    BAMFlags_SelfIsReverse	= (1 << BAMFlags_bit_SelfIsReverse),
-    BAMFlags_MateIsReverse	= (1 << BAMFlags_bit_MateIsReverse),
-    BAMFlags_IsFirst        = (1 << BAMFlags_bit_IsFirst),
-    BAMFlags_IsSecond       = (1 << BAMFlags_bit_IsSecond),
-    BAMFlags_IsNotPrimary	= (1 << BAMFlags_bit_IsNotPrimary),
-    BAMFlags_IsLowQuality	= (1 << BAMFlags_bit_IsLowQuality),
-    BAMFlags_IsDuplicate	= (1 << BAMFlags_bit_IsDuplicate)
-};
-
-ALIGN_EXTERN rc_t CC BAMAlignmentGetFlags ( const BAMAlignment *self, uint16_t *flags );
-
-
-/* GetMapQuality
- *  return the quality score of mapping
- *
- *  "qual" [ OUT ] - return param for quality score
- */
-ALIGN_EXTERN rc_t CC BAMAlignmentGetMapQuality ( const BAMAlignment *self, uint8_t *qual );
-
-
-/* GetAlignmentDetail
- *  get the alignment details
- *
- *  "rslt" [ OUT, NULL OKAY ] and "count" [ IN ] - array to hold detail records
- *
- *  "actual" [ OUT, NULL OKAY ] - number of elements written to "rslt"
- *   required if "rslt" is not NULL
- *
- *  "firstMatch" [ OUT, NULL OKAY ] - zero-based index into "rslt" of the first match to the refSeq
- *   or < 0 if invalid
- *
- *  "lastMatch" [ OUT, NULL OKAY ] - zero-based index into "rslt" of the last match to the refSeq
- *   or < 0 if invalid
- */
-typedef uint32_t BAMCigarType;
-enum BAMCigarTypes
-{
-    ct_Match    = 'M', /* 0 */
-    ct_Insert   = 'I', /* 1 */
-    ct_Delete   = 'D', /* 2 */
-    ct_Skip     = 'N', /* 3 */
-    ct_SoftClip = 'S', /* 4 */
-    ct_HardClip = 'H', /* 5 */
-    ct_Padded   = 'P', /* 6 */
-    ct_Equal    = '=', /* 7 */
-    ct_NotEqual = 'X', /* 8 */
-    ct_Overlap  = 'B' /* Complete Genomics extension */
-};
-
-typedef struct BAMAlignmentDetail BAMAlignmentDetail;
-struct BAMAlignmentDetail
-{
-    int64_t refSeq_pos; /* position on refSeq where this alignment region starts or -1 if NA */
-    int32_t read_pos;   /* position on read where this alignment region starts or -1 if NA */
-    uint32_t length;    /* length of alignment region */
-    BAMCigarType type;  /* type of alignment */
-};
-
-ALIGN_EXTERN rc_t CC BAMAlignmentGetAlignmentDetail ( const BAMAlignment *self,
-    BAMAlignmentDetail *rslt, uint32_t count, uint32_t *actual,
-    int32_t *firstMatch, int32_t *lastMatch );
-
-
-/* GetCigarCount
- *  the number of CIGAR elements
- *  a CIGAR element consists of the pair of matching op code and op length
- *
- *  "n" [ OUT ] - return param for cigar count
- */
-ALIGN_EXTERN rc_t CC BAMAlignmentGetCigarCount ( const BAMAlignment *self, uint32_t *n );
-
-
-ALIGN_EXTERN rc_t CC BAMAlignmentGetRawCigar(const BAMAlignment *cself, uint32_t const **rslt, uint32_t *length);
-
-/* GetCigar
- *  get CIGAR element n [0..GetCigarCount)
- */
-ALIGN_EXTERN rc_t CC BAMAlignmentGetCigar ( const BAMAlignment *self,
-    uint32_t n, BAMCigarType *type, uint32_t *length );
-
-
-/* GetInsertSize
- *  distance in bases to start of mate's alignment on ref. seq.
- *
- *  "size" [ OUT ] - >0 for first in pair, <0 for second
- */
-ALIGN_EXTERN rc_t CC BAMAlignmentGetInsertSize ( const BAMAlignment *self, int64_t *size );
-
-ALIGN_EXTERN rc_t CC BAMAlignmentFormatSAM(const BAMAlignment *self,
-                                           size_t *actsize,
-                                           size_t maxsize,
-                                           char *buffer);
-
-/* OptDataForEach
- *  DANGER
- *  these optional fields are the weakest part of BAM.
- *
- *  It is probably best to not use this info.
- *  You can't count on them being there.
- *  Moreover, you might need to interpret the types correctly.
- */
-typedef uint32_t BAMOptDataValueType;
-enum BAMOptDataValueTypes
-{
-    dt_CSTRING = 'Z',
-    dt_INT8 = 'c',
-    dt_UINT8 = 'C',
-    dt_INT16 = 's',     
-    dt_UINT16 = 'S',    
-    dt_INT = 'i',
-    dt_UINT = 'I',
-    dt_FLOAT32 = 'f',
-#if 0
-    dt_FLOAT64 = 'd', /* removed? not in Dec 19 2013 version of SAMv1.pdf */
-#endif
-    dt_ASCII = 'A',
-    dt_HEXSTRING = 'H',
-    dt_NUM_ARRAY = 'B'
-};
-
-#define OPT_TAG_X "X?" /* end user data */
-#define OPT_TAG_Y "Y?" /* end user data */
-#define OPT_TAG_Z "Z?" /* end user data */
-
-#define OPT_TAG_ReadGroup   "RG" /* Read Group; same as BAMAlignmentGetReadGroupName */
-#define OPT_TAG_Library     "LB" /* LIbrary; also BAMReadGroup */
-#define OPT_TAG_Unit        "PU" /* Platform specific Unit; also BAMReadGroup */
-#define OPT_TAG_Program     "PG" /* Alignment software name */
-#define OPT_TAG_AlignScore  "AS" /* Alignment Score (MapQuality?) */
-#define OPT_TAG_SecQual     "SQ" /* second called base:2 and quality:6; length == ReadLength? warning */
-#define OPT_TAG_MateMapQual "MQ" /* map Quality of mate */
-#define OPT_TAG_NumMismatch "NM" /* Number of Mismatches */
-#define OPT_TAG_Hits0       "H0" /* Number of perfect hits */
-#define OPT_TAG_Hits1       "H1" /* Number of off-by-one */
-#define OPT_TAG_Hits2       "H2" /* Number of off-by-two */
-#define OPT_TAG_CondQual    "UQ" /* conditional Quality of read */
-#define OPT_TAG_CondQPair   "PQ" /* conditional Quality of pair */
-#define OPT_TAG_ReadHits    "NH" /* Number of times this read (spot) aligns */
-#define OPT_TAG_ReadHits2   "IH" /* Number of times this read (spot) aligns that are in this file */
-#define OPT_TAG_HitIndex    "HI" /* n-th hit for this read in this file */
-#define OPT_TAG_Match2      "MD" /* another sort of matching string like CIGAR but different? */
-#define OPT_TAG_ColorKey    "CS" /* primer and first color */
-#define OPT_TAG_ColorQual   "CQ" /* quality of above */
-#define OPT_TAG_ColorMisses "CM" /* Number of color-space Mismatches */
-#define OPT_TAG_SeqOverlap  "GS" 
-#define OPT_TAG_QualOverlap "GQ" 
-#define OPT_TAG_OverlapDesc "GC"
-#define OPT_TAG_MateSeq     "R2" /* sequence of the mate */
-#define OPT_TAG_MateQual    "Q2" /* quality scores of the mate */
-#define OPT_TAG_OtherQual   "S2"
-#define OPT_TAG_NextHitRef  "CC" /* Reference name of the next hit */
-#define OPT_TAG_NextHitPos  "CP" /* coordinate of the next hit */
-#define OPT_TAG_SingleMapQ  "SM" /* quality of mapping as if not paired */
-#define OPT_TAG_AM          "AM"
-#define OPT_TAG_MAQFlag     "MQ"
-
-
-struct BAMOptData
-{
-    BAMOptDataValueType type;
-    uint32_t element_count;
-    union {
-        int8_t i8[8];
-        uint8_t u8[8];
-        int16_t i16[4];
-        uint16_t u16[4];
-        int32_t i32[2];
-        uint32_t u32[2];
-        int64_t i64[2];
-        uint64_t u64[2];
-        float f32[2];
-        double f64[1];
-        char asciiz[8];
-    } u;
-};
-
-typedef struct BAMOptData BAMOptData;
-
-typedef rc_t ( CC * BAMOptionalDataFunction )
-    ( void *ctx, const char tag[2], const BAMOptData *value );
-
-ALIGN_EXTERN rc_t CC BAMAlignmentOptDataForEach
-    ( const BAMAlignment *self, void *ctx, BAMOptionalDataFunction callback );
-
-    
-ALIGN_EXTERN bool CC BAMAlignmentHasCGData(BAMAlignment const *self);
-
-    
-ALIGN_EXTERN
-rc_t CC BAMAlignmentGetCGSeqQual(BAMAlignment const *self,
-                                 char sequence[/* 35 */],
-                                 uint8_t quality[/* 35 */]);
-
-ALIGN_EXTERN
-rc_t CC BAMAlignmentGetCGCigar(BAMAlignment const *self,
-                               uint32_t *cigar,
-                               uint32_t cig_max,
-                               uint32_t *cig_act);
-    
-ALIGN_EXTERN rc_t BAMAlignmentGetTI(BAMAlignment const *self, uint64_t *ti);
-
-ALIGN_EXTERN rc_t BAMAlignmentGetCGAlignGroup(BAMAlignment const *self,
-                                              char buffer[],
-                                              size_t max_size,
-                                              size_t *act_size);
-    
-    
-/*--------------------------------------------------------------------------
- * BAMFile
- */
-typedef struct BAMFile BAMFile;
-
-typedef struct BAMRefSeq BAMRefSeq;
-struct BAMRefSeq
-{
-    uint64_t length;
-    const char *name; /* not null unique */
-    const char *assemblyId;
-    const uint8_t *checksum;
-    const char *uri;
-    const char *species;
-    uint32_t id;
-    uint8_t checksum_array[16];
-};
-
-typedef struct BAMReadGroup BAMReadGroup;
-struct BAMReadGroup
-{
-    const char *name; /* not null unique, accession e.g. SRR001138 */
-    const char *sample; /* not null */
-    const char *library;
-    const char *description;
-    const char *unit; /* platform specific identifier, e.g. BI.080214_SL-XAJ_0001_FC2044KAAXX.7 */
-    const char *insertSize;
-    const char *center; /* e.g. BI */
-    const char *runDate;
-    const char *platform; /* e.g. ILLUMINA */
-    uint32_t id;
-};
-
-
-/* 64-bit structure stored as an integer
- * The high-order 48 bits store the position in the file at which a 
- * compressed block starts.  The low-order 16 bits store the position
- * in the decompressed block at which a record starts.  This is the
- * way that positions are represented in BAM indices.
- */
-typedef uint64_t BAMFilePosition;
-
-
-/* Make
- *  open the BAM file specified by path
- *
- *  "path" [ IN ] - NUL terminated string or format
- */
-ALIGN_EXTERN rc_t CC BAMFileMake ( const BAMFile **result, const char *path, ... );
-
-ALIGN_EXTERN rc_t CC BAMFileMakeWithHeader ( const BAMFile **result,
-                                            char const headerText[],
-                                            char const path[], ... );
-
-/* MakeWithDir
- *  open the BAM file specified by path and supplied directory
- *
- *  "dir" [ IN ] - directory object used to open file
- *
- *  "path" [ IN ] - NUL terminated string or format
- */
-ALIGN_EXTERN rc_t CC BAMFileMakeWithDir ( const BAMFile **result,
-    struct KDirectory const *dir, const char *path, ... );
-ALIGN_EXTERN rc_t CC BAMFileVMakeWithDir ( const BAMFile **result,
-    struct KDirectory const *dir, const char *path, va_list args );
-
-/* Make
- *  open the BAM file specified by file
- *
- *  "file" [ IN ] - an open KFile
- */
-ALIGN_EXTERN rc_t CC BAMFileMakeWithKFile(const BAMFile **result,
-    struct KFile const *file);
-
-/* Make
- *  open the BAM file specified by file
- *
- *  "file" [ IN ] - an open KFile
- */
-ALIGN_EXTERN rc_t CC BAMFileMakeWithVPath(const BAMFile **result,
-    struct VPath const *path);
-
-/* ExportBAMFile
- *  export the BAMFile object in use by the AlignAccessDB, if any
- *  must be released via BAMFileRelease
- */
-ALIGN_EXTERN rc_t CC AlignAccessDBExportBAMFile ( struct AlignAccessDB const *self,
-    const BAMFile **result );
-
-
-/* AddRef
- * Release
- */
-ALIGN_EXTERN rc_t CC BAMFileAddRef ( const BAMFile *self );
-ALIGN_EXTERN rc_t CC BAMFileRelease ( const BAMFile *self );
-
-
-/* GetPosition
- *  get the position of the about-to-be read alignment
- *  this position can be stored
- *  this position can be passed into SetPosition to seek to the same alignment
- *
- *  "pos" [ OUT ] - return parameter for position
- */
-ALIGN_EXTERN rc_t CC BAMFileGetPosition ( const BAMFile *self, BAMFilePosition *pos );
-
-
-/* GetProportionalPosition
- *  get the aproximate proportional position in the input file
- *  this is intended to be useful for computing progress
- *
- * NB - does not return rc_t
- */
-ALIGN_EXTERN float CC BAMFileGetProportionalPosition ( const BAMFile *self );
-
-
-/* Read
- *  read an aligment
- *
- *  "result" [ OUT ] - return param for BAMAlignment object
- *   must be released with BAMAlignmentRelease
- *
- *  returns RC(..., ..., ..., rcRow, rcNotFound) at end
- */
-ALIGN_EXTERN rc_t CC BAMFileRead ( const BAMFile *self, const BAMAlignment **result );
-
-    
-/* Read
- *  read an aligment
- *
- *  "result" [ OUT ] - return param for BAMAlignment object
- *   must be released with BAMAlignmentRelease, is invalidated or contents
- *   change on next call to BAMFileRead2. Unlike with BAMFileRead, no attempt is
- *   made to preserve this object.
- *
- *  returns:
- *    RC(..., ..., ..., rcRow, rcNotFound) at end
- *    RC(..., ..., ..., rcRow, rcInvalid) and RC(..., ..., ..., rcRow, rcEmpty)
- *      are not fatal and are resumable
- *
- *  tries to use static buffers and will log messages about parsing errors
- */
-ALIGN_EXTERN rc_t CC BAMFileRead2 ( const BAMFile *self, const BAMAlignment **result );
-
-
-/* Rewind
- *  reset the position back to the first aligment in the file
- */
-ALIGN_EXTERN rc_t CC BAMFileRewind ( const BAMFile *self );
-
-
-/* SetPosition
- *  set the position to a particular alignment
- *  pass in the values from GetPosition
- */
-ALIGN_EXTERN rc_t CC BAMFileSetPosition ( const BAMFile *self, const BAMFilePosition *pos );
-
-
-/* GetRefSeqCount
- *  get the number of Reference Sequences refered to in the header
- *  this is not necessarily the number of Reference Sequences referenced
- *  by the alignments
- */
-ALIGN_EXTERN rc_t CC BAMFileGetRefSeqCount ( const BAMFile *self, uint32_t *count );
-
-
-/* GetRefSeq
- *  get the n'th Ref. Seq. where n is [0..RefSeqCount)
- *  the resulting pointer is static-like; it is freed when the BAMFile is.
- *  IOW, it is good for precisely at long as the BAMFile is.
- */
-ALIGN_EXTERN rc_t CC BAMFileGetRefSeq ( const BAMFile *self, uint32_t n, const BAMRefSeq **result );
-
-
-/* GetRefSeqById
- *  get a Ref. Seq. by its id
- *  the resulting pointer is static-like; it is freed when the BAMFile is.
- *  IOW, it is good for precisely at long as the BAMFile is.
- */
-ALIGN_EXTERN rc_t CC BAMFileGetRefSeqById ( const BAMFile *self, int32_t id, const BAMRefSeq **result );
-
-
-/* GetReadGroupCount
- *  get the number of Read Groups (accessions, etc.) refered to in the header
- *  this is not necessarily the number of Read Groups referenced
- *  by the alignments
- */
-ALIGN_EXTERN rc_t CC BAMFileGetReadGroupCount ( const BAMFile *self, uint32_t *count );
-
-/* GetReadGroup
- *  get the n'th Read Group where n is [0..ReadGroupCount)
- *  the resulting pointer is static-like; it is freed when the BAMFile is.
- *  IOW, it is good for precisely at long as the BAMFile is.
- */
-ALIGN_EXTERN rc_t CC BAMFileGetReadGroup ( const BAMFile *self, unsigned n, const BAMReadGroup **result );
-    
-/* GetHeaderText
- *  get the text of the BAM header file
- *  the resulting pointer is static-like; it is freed when the BAMFile is.
- *  IOW, it is good for precisely at long as the BAMFile is.
- */
-ALIGN_EXTERN rc_t CC BAMFileGetHeaderText(BAMFile const *cself, char const **header, size_t *header_len);
-    
-
-/* GetReadGroupByName
- *  get a Read Group by its name
- *  the resulting pointer is static-like; it is freed when the BAMFile is.
- *  IOW, it is good for precisely at long as the BAMFile is.
- */
-ALIGN_EXTERN rc_t CC BAMFileGetReadGroupByName ( const BAMFile *self,
-    const char *name, const BAMReadGroup **result );
-
-
-/* OpenIndex
- *  takes a simple path...
- */
-ALIGN_EXTERN rc_t CC BAMFileOpenIndex ( const BAMFile *self, const char *path );
-
-ALIGN_EXTERN rc_t CC BAMFileOpenIndexWithVPath ( const BAMFile *self, struct VPath const *path );
-
-/* IsIndexed
- *  returns true if true
- */
-ALIGN_EXTERN bool CC BAMFileIsIndexed ( const BAMFile *self );
-
-
-/* IndexHasRefSeqId
- */
-ALIGN_EXTERN bool CC BAMFileIndexHasRefSeqId ( const BAMFile *self, uint32_t refSeqId );
-
-/* Seek
- *  seeks a half-open zero-based interval on a particular reference
- *  rcSelf, rcIncomplete
- */
-ALIGN_EXTERN rc_t CC BAMFileSeek ( const BAMFile *self, uint32_t refSeqId, uint64_t alignStart, uint64_t alignEnd );
-
-typedef uint32_t BAMValidateOption;
-enum BAMValidateOptions {
-    /* this is the minimum level of BAM file validation; just walks the compressed block headers */
-    bvo_BlockHeaders        = 1,
-    
-    /* decompresses each block */
-    bvo_BlockCompression    = 2,
-    
-    /* within each block, walks the records without examining the contents */
-    bvo_BlockStructure      = 3,
-    
-    /* within each record, validate the structure vis-a-vis the record size */
-    bvo_RecordStructure     = 4,
-    
-    /* verify that the extra fields a parsable */
-    bvo_ExtraFields         = 8,
-    
-    /* confirm that no alignment starts before the alignment preceeding it */
-    bvo_Sorted              = 16,
-    
-    /* verify that flags are consistent with itself and the other fields in the record
-     * NB. can not verify secondary alignment flag 0x100
-     */
-    bvo_FlagsConsistency    = 32,
-    
-    /* verify CIGAR against sequence length */
-    bvo_CIGARConsistency    = 64,
-    
-    /* verify that bin number corresponds to position and alignment length */
-    bvo_BinConsistency      = 128,
-    
-    /* verify that mapQ is consistent with flags and refSeqID */
-    bvo_MapQuality          = 256,
-    
-    /* verify Quality values >= 33 */
-    bvo_QualityValues       = 512,
-    
-    /* verify that sequence length != 0 */
-    bvo_MissingSequence     = 1024,
-    
-    /* verify that Quality values != 255 */
-    bvo_MissingQuality      = 2048,
-    
-    /* compute flagstats */
-    bvo_FlagsStats          = 4096,
-    
-    /* verify that index is parsable
-     * NB. this can be done without a BAM file
-     */
-    bvo_IndexStructure      = 1 << 16,
-    
-    /* verify that the file offsets in the index are valid for the given BAM file
-     * NB. does not cause decompression of the BAM file but will cause referenced
-     * block headers to be validated
-     */
-    bvo_IndexOffsets1       = 2 << 16,
-    
-    /* in addition to verifying that the file offsets in the index are valid for
-     * the given BAM file, verify that the record offsets with the blocks are valid.
-     * NB. will cause referenced blocks to be decompressed and structurally validated.
-     */
-    bvo_IndexOffsets2       = 3 << 16,
-    
-    /* verify that index's reference number and bin number agree with the
-     * referenced record
-     */
-    bvo_IndexBins           = 4 << 16,
-    
-    bvo_IndexOptions        = 7 << 16
-};
-
-typedef struct BAMValidateStats BAMValidateStats;
-typedef struct BAMValidateStatsRow BAMValidateStatsRow;
-
-struct BAMValidateStatsRow {
-    uint64_t good;
-    uint64_t warning;
-    uint64_t error;
-};
-
-struct BAMValidateStats {
-    uint64_t bamFileSize;
-    uint64_t bamFilePosition;
-    uint64_t baiFileSize;
-    uint64_t baiFilePosition;
-    BAMValidateStatsRow blockHeaders;
-    BAMValidateStatsRow blockCompression;
-    BAMValidateStatsRow blockStructure;
-    BAMValidateStatsRow recordStructure;
-    BAMValidateStatsRow extraFields;
-    BAMValidateStatsRow inOrder;
-    BAMValidateStatsRow flags[16];
-    BAMValidateStatsRow CIGAR;
-    BAMValidateStatsRow bin;
-    BAMValidateStatsRow quality;
-    BAMValidateStatsRow hasSequence;
-    BAMValidateStatsRow hasQuality;
-    BAMValidateStatsRow indexFileOffset;
-    BAMValidateStatsRow indexBlockOffset;
-    BAMValidateStatsRow indexBin;
-    bool bamHeaderIsGood;
-    bool bamHeaderIsBad;
-    bool indexStructureIsGood;
-    bool indexStructureIsBad;
-};
-
-typedef rc_t (CC *BAMValidateCallback)(void *ctx, rc_t result, const BAMValidateStats *stats);
-
-/* Validate
- */
-ALIGN_EXTERN rc_t CC BAMValidate ( struct VPath const *bam,
-                                   struct VPath const *bai,
-                                   BAMValidateOption options,
-                                   BAMValidateCallback callback,
-                                   void *callbackContext
-                                  );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_align_bam_ */
diff --git a/interfaces/align/dna-reverse-cmpl.h b/interfaces/align/dna-reverse-cmpl.h
deleted file mode 100644
index 82c4783..0000000
--- a/interfaces/align/dna-reverse-cmpl.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifndef _h_align_dna_reverse_cmpl_
-#define _h_align_dna_reverse_cmpl_
-
-#ifndef _h_align_extern_
-#include <align/extern.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-ALIGN_EXTERN rc_t CC DNAReverseCompliment(const INSDC_dna_text* seq, INSDC_dna_text* cmpl, uint32_t len);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_align_dna_reverse_cmpl_ */
diff --git a/interfaces/align/extern.h b/interfaces/align/extern.h
deleted file mode 100644
index 94c711a..0000000
--- a/interfaces/align/extern.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_align_extern_
-#define _h_align_extern_
-
-#if ! defined EXPORT_LATCH && defined _LIBRARY
-#define ALIGN_EXTERN LIB_EXPORT
-#define EXPORT_LATCH 1
-#else
-#define ALIGN_EXTERN LIB_IMPORT
-#endif
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#endif /* _h_align_extern_ */
diff --git a/interfaces/align/iterator.h b/interfaces/align/iterator.h
deleted file mode 100644
index e8a77e6..0000000
--- a/interfaces/align/iterator.h
+++ /dev/null
@@ -1,610 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_align_iterator_
-#define _h_align_iterator_
-
-#ifndef _h_align_extern_
-#include <align/extern.h>
-#endif
-
-#ifndef _h_klib_container_
-#include <klib/container.h>
-#endif
-
-#ifndef _h_insdc_insdc_
-#include <insdc/insdc.h>
-#endif
-
-#ifndef _h_vdb_database_
-#include <vdb/database.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct VCursor;
-struct AlignMgr;
-struct ReferenceObj;
-
-
-/*--------------------------------------------------------------------------
- * AlignmentIterator
- *  walk across a single alignment in reference space
- */
-typedef struct AlignmentIterator AlignmentIterator;
-
-
-/* Make
- *  create an encapsulation of alignment
- *
- *  iter [ OUT ] - return parameter for new iterator
- *
- *  copy [ IN ] - when "true" the data will be copied.
- *  otherwise, pointers will be expected to refer to data
- *  with a lifetime >= that of the iterator being created.
- *
- *  "ref_pos" [ IN ] and "ref_len" [ IN ] - projection onto reference
- *
- *  "read" [ IN ] and "read_len" [ IN ] - full sequence of alignment
- *
- *  "has_mismatch" [ IN ] - describes comparison result of each base
- *  in "read" against the alignment.
- *
- *  "has_ref_offset" [ IN ] - describes positions of reference offsets
- *
- *  "ref_offset" [ IN ] and "ref_offset_len" [ IN ] - packed array of
- *  offsets of position against reference.
- */
-ALIGN_EXTERN rc_t CC AlignMgrMakeAlignmentIterator ( struct AlignMgr const *self,
-    AlignmentIterator **iter,
-    bool copy,
-    INSDC_coord_zero ref_pos,
-    INSDC_coord_len ref_len,
-    const INSDC_4na_bin *read,
-    INSDC_coord_len read_len,
-    const bool *has_mismatch,
-    const bool *has_ref_offset,
-    const int32_t *ref_offset,
-    uint32_t ref_offset_len,
-    INSDC_coord_zero ref_window_start,
-    INSDC_coord_len ref_window_len );
-
-
-/* AddRef
- * Release
- */
-ALIGN_EXTERN rc_t CC AlignmentIteratorAddRef ( const AlignmentIterator *self );
-ALIGN_EXTERN rc_t CC AlignmentIteratorRelease ( const AlignmentIterator *self );
-
-
-/* Next
- *  advance position by 1 in reference space
- *  must be called initially to advance to first element
- *
- *  returns RCState = rcDone when done
- */
-ALIGN_EXTERN rc_t CC AlignmentIteratorNext ( AlignmentIterator *self );
-
-
-/* State
- *  returns bitmap of state bits and event code at the current position
- *  will return invalid before initial Next message or after final
- *
- *  bits [ 0..7 ] :
- *    { 0..15 }             = 4na mismatch (NACMGRSVTWYHKDBN)
- *    64                    = match
- *    128                   = skip
- *  bit [ 8 ]               = have insert if ! 0
- *  bit [ 9 ]               = have delete if ! 0
- *  bit [ 10 ]              = first base if ! 0
- *  bit [ 11 ]              = last base if ! 0
- *  bit [ 31 ]              = iterator position is invalid if ! 0
- *                            NB - converts state word to negative
- */
-enum
-{
-    align_iter_match      = ( 1 <<  8 ),
-    align_iter_skip       = ( 1 <<  9 ),
-
-    align_iter_insert     = ( 1 << 10 ),
-    align_iter_delete     = ( 1 << 11 ),
-    align_iter_first      = ( 1 << 12 ),
-    align_iter_last       = ( 1 << 13 ),
-
-    align_iter_invalid    = ( 1 << 31 )
-};
-
-ALIGN_EXTERN int32_t CC AlignmentIteratorState ( const AlignmentIterator *self,
-                                                 INSDC_coord_zero *seq_pos );
-
-
-/* Position
- *  return current position of iterator relative to reference
- */
-ALIGN_EXTERN rc_t CC AlignmentIteratorPosition ( const AlignmentIterator *self,
-                                                 INSDC_coord_zero *pos );
-
-
-/* BasesInserted
- *  return the number of inserted bases and a pointer to their values
- *
- *  "bases" [ OUT, NULL OKAY ] - optional output parameter to inserted bases
- *
- *  returns count of bases inserted at current position
- */
-ALIGN_EXTERN uint32_t CC AlignmentIteratorBasesInserted
-    ( const AlignmentIterator *self, const INSDC_4na_bin **bases );
-
-
-/* BasesDeleted
- *  return the number of bases deleted at the current position
- *  also returns the location on the reference where the delete starts
- *
- *  "pos" [ OUT ] - return parameter for location on the reference
- *  where delete starts, and continues for the number of bases given by function return
- *
- *  returns count of bases deleted at current position
- */
-ALIGN_EXTERN uint32_t CC AlignmentIteratorBasesDeleted
-    ( const AlignmentIterator *self, INSDC_coord_zero *pos );
-
-
-/*--------------------------------------------------------------------------
- * PlacementRecord
- *  record describing a placement
- */
-typedef struct PlacementRecord PlacementRecord;
-struct PlacementRecord
-{
-    DLNode n;
-
-    /* row id of alignment record */
-    int64_t id;
-
-    /* object representing reference sequence */
-    struct ReferenceObj const *ref;
-
-    /* placement position and length on reference */
-    INSDC_coord_zero pos;
-    INSDC_coord_len len;
-
-    /* mapping quality of alignment */
-    int32_t mapq;
-
-    /* spotgroup is now in here too */
-    uint32_t spot_group_len;
-    char * spot_group;
-};
-
-
-/* Cast
- *  cast to an extended object
- *
- *  "ext" [ IN ] - selects the extended object level
- *  can be placementRecordExtension0 or placementRecordExtension1
- */
-
-enum { placementRecordExtension0, placementRecordExtension1 };
-
-ALIGN_EXTERN void* CC PlacementRecordCast ( const PlacementRecord *self, uint32_t ext );
-
-
-ALIGN_EXTERN void* CC PlacementRecord_get_ext_data_ptr ( const PlacementRecord *self, uint32_t ext );
-
-
-/* Whack
- *  destroys PlacementRecord and any associated extensions
- */
-ALIGN_EXTERN void CC PlacementRecordWhack ( const PlacementRecord *self );
-
-
-/* structure of function pointers for creating extensions
-   all function pointers are optional ( NULL OKAY ) */
-typedef struct PlacementRecordExtendFuncs PlacementRecordExtendFuncs;
-struct PlacementRecordExtendFuncs
-{
-    /* opaque pointer to data passed to each function */
-    void *data;
-
-    /* destructor */
-    void ( CC * destroy ) ( void *obj, void *data );
-
-    /* constructor */
-    rc_t ( CC * populate ) ( void *obj, const PlacementRecord *placement,
-        struct VCursor const *curs, INSDC_coord_zero ref_window_start,
-        INSDC_coord_len ref_window_len, void *data, void * placement_ctx );
-
-    /* variable allocation size calculation
-       when non-NULL, takes precedence over "fixed_size" */
-    bool ( CC * filter ) ( struct VCursor const *curs, int64_t row_id,
-        const PlacementRecord *placement, INSDC_coord_zero ref_window_start,
-        INSDC_coord_len ref_window_len, void *data, void * placement_ctx );
-
-    /* variable allocation size calculation
-       when non-NULL, takes precedence over "fixed_size" */
-    rc_t ( CC * alloc_size ) ( struct VCursor const *curs, int64_t row_id, size_t * size, void *data, void * placement_ctx );
-    
-    /* fixed allocation size
-       ignored if "alloc_size" is non-NULL,
-       must be non-zero otherwise */
-    size_t fixed_size;
-};
-
-
-/* external functions for extension of a placement record
-   to include ( construct ) an AlignmentIterator */
-ALIGN_EXTERN void CC AlignIteratorRecordDestroy ( void *obj, void *data );
-ALIGN_EXTERN rc_t CC AlignIteratorRecordPopulate ( void *obj,
-    const PlacementRecord *placement, struct VCursor const *curs,
-    INSDC_coord_zero ref_window_start, INSDC_coord_len ref_window_len, void *data );
-ALIGN_EXTERN rc_t CC AlignIteratorRecordSize ( struct VCursor const *curs, int64_t row_id, size_t * size, void *data );
-
-
-/*--------------------------------------------------------------------------
- * PlacementIterator
- *  walk across placements from an alignment db within a reference window
- */
-typedef struct PlacementIterator PlacementIterator;
-
-
-/* Make
- *  create a placement iterator
- *
- *  "iter" [ OUT ] - return parameter for iterator
- *
- *  "ref_obj" [ IN, NULL OKAY ] - optional parameter giving an object
- *  representing the reference sequence for this iterator. it will be
- *  inserted into each PlacementRecord (see above) and made available to
- *  outer code.
- *
- *  "ref_pos" [ IN ] and "ref_len" [ IN ] - window onto reference
- *
- *  "min_mapq" [ IN ] - minimum map quality value
- *
- *  "ref_cur" [ IN ] - read-only cursor on REFERENCE table
- *  will be modified as necessary to contain requisite columns
- *  will be opened by iterator.
- *
- *  "align_cur" [ IN ] - read-only cursor on PRIMARY_ALIGNMENT or SECONDARY_ALIGNMENT
- *  table ( see "secondary" ). will be modified as necessary to contain
- *  requisite columns. will be opened by iterator.
- *
- *  "ids" [ IN ] - an enum describing which column of alignment ids should
- *  be used when reading "ref"
- *
- *  "ext_0" [ IN, NULL OKAY ] and "ext_1" [ IN, NULL OKAY ] - optional pointers
- *  to blocks describing how to extend the basic placement record
- *
- *  rd_group [ IN, NULL OKAY ]
- *      != NULL, non empty string ... produce all alignments with this string as
- *                  spot-group ( no matter what the "real" spot-group of the
- *                  alignment is )
- *
- *      != NULL, empty string ... produce all alignments with the "real" spot-group
- *                  read from the column "SPOT_GROUP"
- *
- *      == NULL, ... produce all alignments with no spot-group assigned ( the user
- *                  does not wish the data to be read, the alignment to be bined )
- */
-
-typedef uint8_t align_id_src;
-enum { primary_align_ids, secondary_align_ids, evidence_align_ids };
-
-ALIGN_EXTERN rc_t CC AlignMgrMakePlacementIterator ( struct AlignMgr const *self,
-    PlacementIterator **iter, struct ReferenceObj const *ref_obj,
-    INSDC_coord_zero ref_pos, INSDC_coord_len ref_len, int32_t min_mapq,
-    struct VCursor const *ref_cur, struct VCursor const *align_cur, align_id_src ids,
-    const PlacementRecordExtendFuncs *ext_0, const PlacementRecordExtendFuncs *ext_1,
-    const char * spot_group );
-
-
-/* AddRef
- * Release
- */
-ALIGN_EXTERN rc_t CC PlacementIteratorAddRef ( const PlacementIterator *self );
-ALIGN_EXTERN rc_t CC PlacementIteratorRelease ( const PlacementIterator *self );
-
-
-/* RefWindow
- *  returns the reference identification string and iteration window
- */
-ALIGN_EXTERN rc_t CC PlacementIteratorRefWindow ( const PlacementIterator *self,
-    const char **idstr, INSDC_coord_zero *pos, INSDC_coord_len *len );
-
-
-/* RefObj
- *  returns the Ref-obj, that was used to create this placement-iterator
- */
-ALIGN_EXTERN rc_t CC PlacementIteratorRefObj( const PlacementIterator * self,
-    struct ReferenceObj const ** refobj );
-
-
-/* NextAvailPos
- *  check the next available position having one or more placements
- *
- *  "pos" [ OUT ] - next position on reference having one or more placements
- *  may return negative position, indicating an alignment that wraps around
- *  a circular reference, and starts in negative space after linearization.
- *
- *  "len" [ OUT, NULL OKAY ] - optional return parameter for length of
- *  placement at that position
- *
- *  returns non-zero rc when no window is done
- *  (rcRange, rcDone)
- */
-ALIGN_EXTERN rc_t CC PlacementIteratorNextAvailPos ( const PlacementIterator *self,
-    INSDC_coord_zero *pos, INSDC_coord_len *len );
-
-
-/* NextRecordAt
- *  retrieve a placement at the requested position
- *
- *  "pos" [ IN ] - required position of the placement
- *  obtained from "NextAvailPos"
- *
- *  "rec" [ OUT ] - returned record
- *  must be freed via PlacementRecordWhack
- *
- *  returns non-zero rc when no more placements are available
- *  (rcOffset, rcDone)
- */
-ALIGN_EXTERN rc_t CC PlacementIteratorNextRecordAt ( PlacementIterator *self,
-    INSDC_coord_zero pos, const PlacementRecord **rec );
-
-
-/* NextIdAt
- *  retrieve a row id at the requested position
- *
- *  "pos" [ IN ] - required position of the placement
- *  obtained from "NextAvailPos"
- *
- *  "id" [ OUT ] - returned row-id, within domain of align cursor
- *
- *  "len" [ OUT, NULL OKAY ] - optional return parameter for length of
- *  placement on reference
- *
- *  returns non-zero rc when no more placements are available
- *  (rcOffset, rcDone)
- */
-ALIGN_EXTERN rc_t CC PlacementIteratorNextIdAt ( PlacementIterator *self,
-    INSDC_coord_zero pos, int64_t *row_id, INSDC_coord_len *len );
-
-
-/*--------------------------------------------------------------------------
- * PlacementSetIterator
- *  walk across placements from an alignment db within a reference window
- */
-typedef struct PlacementSetIterator PlacementSetIterator;
-
-
-/* Make
- *  create a placement set iterator
- *
- *  "iter" [ OUT ] - return parameter for iterator
- *
- *  "ref_pos" [ IN ] and "ref_len" [ IN ] - window onto reference
- */
-ALIGN_EXTERN rc_t CC AlignMgrMakePlacementSetIterator ( struct AlignMgr const *self,
-    PlacementSetIterator **iter );
-
-
-/* AddPlacementIterator
- *  adds a placement iterator
- *  used to provide ordered placements within window
- */
-ALIGN_EXTERN rc_t CC PlacementSetIteratorAddPlacementIterator
-    ( PlacementSetIterator *self, PlacementIterator *pi );
-
-
-/* AddRef
- * Release
- */
-ALIGN_EXTERN rc_t CC PlacementSetIteratorAddRef ( const PlacementSetIterator *self );
-ALIGN_EXTERN rc_t CC PlacementSetIteratorRelease ( const PlacementSetIterator *self );
-
-
-ALIGN_EXTERN rc_t CC PlacementSetIteratorNextReference ( PlacementSetIterator *self,
-    INSDC_coord_zero *first_pos, INSDC_coord_len *len, struct ReferenceObj const ** refobj );
-
-ALIGN_EXTERN rc_t CC PlacementSetIteratorNextWindow ( PlacementSetIterator *self,
-    INSDC_coord_zero *first_pos, INSDC_coord_len *len );
-
-/* NextAvailPos
- *  check the next available position having one or more placements
- *
- *  "pos" [ OUT ] - next position on reference having one or more placements
- *  may return negative position, indicating an alignment that wraps around
- *  a circular reference, and starts in negative space after linearization.
- *
- *  "len" [ OUT, NULL OKAY ] - optional return parameter for length of
- *  placement at that position
- *
- *  returns non-zero rc when no more placements are available
- *  TBD - define a proper value
- */
-ALIGN_EXTERN rc_t CC PlacementSetIteratorNextAvailPos ( const PlacementSetIterator *self,
-    INSDC_coord_zero *pos, INSDC_coord_len *len );
-
-
-/* NextRecordAt
- *  retrieve a placement at the requested position
- *
- *  "pos" [ IN ] - required position of the placement
- *  obtained from "NextAvailPos"
- *
- *  "rec" [ OUT ] - returned record
- *  must be freed via PlacementRecordWhack
- */
-ALIGN_EXTERN rc_t CC PlacementSetIteratorNextRecordAt ( PlacementSetIterator *self,
-    INSDC_coord_zero pos, const PlacementRecord **rec );
-
-
-/* NextIdAt
- *  retrieve a row id at the requested position
- *
- *  "pos" [ IN ] - required position of the placement
- *  obtained from "NextAvailPos"
- *
- *  "id" [ OUT ] - returned row-id, within domain of align cursor
- *
- *  "len" [ OUT, NULL OKAY ] - optional return parameter for length of
- *  placement on reference
- */
-ALIGN_EXTERN rc_t CC PlacementSetIteratorNextIdAt ( PlacementSetIterator *self,
-    INSDC_coord_zero pos, int64_t *row_id, INSDC_coord_len *len );
-
-
-/*--------------------------------------------------------------------------
- * ReferenceIterator
- *  walk across placements from an alignment db within a reference window
- */
-typedef struct ReferenceIterator ReferenceIterator;
-
-
-/* Make
- *  create a reference iterator
- *
- *  "iter" [ OUT ] - return parameter for iterator
- *
- *  "ext_1" [ IN, NULL OKAY ] - optional pointer to a block describing how
- *  to extend the align-iterator record
- *
- *  "min_mapq" [ IN ] - minimum map quality value
- */
-ALIGN_EXTERN rc_t CC AlignMgrMakeReferenceIterator ( struct AlignMgr const *self,
-    ReferenceIterator **iter, const PlacementRecordExtendFuncs *ext_1, int32_t min_mapq );
-
-
-/* AddRef
- * Release
- */
-ALIGN_EXTERN rc_t CC ReferenceIteratorAddRef ( const ReferenceIterator *self );
-ALIGN_EXTERN rc_t CC ReferenceIteratorRelease ( const ReferenceIterator *self );
-
-
-/* AddPlacementIterator
- *  adds a placement iterator
- *  used to provide ordered placements within window
- */
-#if 0
-ALIGN_EXTERN rc_t CC ReferenceIteratorAddPlacementIterator
-    ( ReferenceIterator *self, PlacementIterator *pi );
-#endif
-
-/* AddPlacements
- *  adds a source for placements (file/table)
- *  used to provide ordered placements within window
- */
-ALIGN_EXTERN rc_t CC ReferenceIteratorAddPlacements ( ReferenceIterator *self,
-    struct ReferenceObj const *ref_obj, INSDC_coord_zero ref_pos, INSDC_coord_len ref_len,
-    struct VCursor const *ref, struct VCursor const *align, align_id_src ids,
-    const char * spot_group, void * placement_ctx );
-
-
-/* NextReference
- *  advance to the next reference
- */
-ALIGN_EXTERN rc_t CC ReferenceIteratorNextReference ( ReferenceIterator *self,
-    INSDC_coord_zero *first_pos, INSDC_coord_len *len, struct ReferenceObj const ** refobj );
-
-/* NextWindow
- *  advance to the next window on the reference
- */
-ALIGN_EXTERN rc_t CC ReferenceIteratorNextWindow ( ReferenceIterator *self,
-    INSDC_coord_zero *first_pos, INSDC_coord_len *len );
-
-/* NextSpotGroup
- *  advance to the next spot_group on the reference
- */
-ALIGN_EXTERN rc_t CC ReferenceIteratorNextSpotGroup ( ReferenceIterator *self,
-    const char ** name, size_t * len );
-
-
-/* NextPos
- *  advance to the next position on current reference
- *  resets internal iterator on placements at that position
- */
-ALIGN_EXTERN rc_t CC ReferenceIteratorNextPos ( ReferenceIterator *self, bool skip_empty );
-
-
-/* Position
- *  return current position on the reference
- */
-ALIGN_EXTERN rc_t CC ReferenceIteratorPosition ( const ReferenceIterator *self,
-    INSDC_coord_zero *pos, uint32_t * depth, INSDC_4na_bin * base );
-
-
-/* NextPlacement
- *  advance internal iterator to next placement in list
- *  returns a pointer to the next placement object at current position
- */
-ALIGN_EXTERN rc_t CC ReferenceIteratorNextPlacement ( ReferenceIterator *self,
-    const PlacementRecord **rec );
-
-
-/* State
- *  return state of current placement at current position
- */
-ALIGN_EXTERN int32_t CC ReferenceIteratorState ( const ReferenceIterator *self, INSDC_coord_zero *seq_pos );
-
-
-/* BasesInserted
- *  return the number of inserted bases and a pointer to their values
- *
- *  "bases" [ OUT, NULL OKAY ] - optional output parameter to inserted bases
- *
- *  returns count of bases inserted at current position
- */
-ALIGN_EXTERN uint32_t CC ReferenceIteratorBasesInserted ( const ReferenceIterator *self,
-    const INSDC_4na_bin **bases );
-
-
-/* BasesDeleted
- *  return the number of bases deleted at the current position
- *  also returns the location on the reference where the delete starts
- *
- *  "pos" [ OUT ] - return parameter for location on the reference
- *  where delete starts, and continues for the number of bases given by function return
- *
- *  "bases" [ OUT, NULL OKAY ] - optional output parameter to deleted bases
- *
- *  returns count of bases deleted at current position
- */
-ALIGN_EXTERN uint32_t CC ReferenceIteratorBasesDeleted ( const ReferenceIterator *self,
-    INSDC_coord_zero *pos, const INSDC_4na_bin **bases );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_align_iterator_ */
diff --git a/interfaces/align/manager.h b/interfaces/align/manager.h
deleted file mode 100644
index 4527f8a..0000000
--- a/interfaces/align/manager.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_align_manager_
-#define _h_align_manager_
-
-#ifndef _h_align_extern_
-#include <align/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * AlignMgr
- *  manages the alignment module
- */
-typedef struct AlignMgr AlignMgr;
-
-/* MakeRead
- *  make for read-only operations
- * MakeUpdate
- *  make for read/write operations
- */
-ALIGN_EXTERN rc_t CC AlignMgrMakeRead ( const AlignMgr **mgr );
-ALIGN_EXTERN rc_t CC AlignMgrMakeUpdate ( AlignMgr **mgr );
-
-
-/* AddRef
- * Release
- */
-ALIGN_EXTERN rc_t CC AlignMgrAddRef ( const AlignMgr *self );
-ALIGN_EXTERN rc_t CC AlignMgrRelease ( const AlignMgr *self );
-
-    
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_align_manager_ */
diff --git a/interfaces/align/qstat.vschema b/interfaces/align/qstat.vschema
deleted file mode 100644
index d97c20b..0000000
--- a/interfaces/align/qstat.vschema
+++ /dev/null
@@ -1,87 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/*==========================================================================
- * VDB Quality Statistics Table
- */
-version 1;
-
-include 'vdb/vdb.vschema';
-include 'ncbi/ncbi.vschema';
-
-table NCBI:align:tbl:qstat #1.0
-{
-    /* SPOT_GROUP
-     */
-    extern column < ascii > zip_encoding SPOT_GROUP;
-
-    /* CYCLE
-     *  machine cycle
-     */
-    extern column < U32 > izip_encoding CYCLE;
-
-    /* KMER
-     *  use dimer
-     */
-    extern column INSDC:dna:text KMER;
-
-    /* HPRUN
-     *  homopolymer run
-     *  number of bases of the same type preceding the current base
-     */
-    extern column < INSDC:coord:len > izip_encoding HPRUN;
-
-    /* GC_CONTENT
-     *  number of G's or C's in the 7 bases preceding the current base
-     */
-    extern column < U32 > izip_encoding GC_CONTENT;
-
-    /* ORIG_QUAL
-     *  original quality scores
-     */
-    extern column < INSDC:quality:phred > zip_encoding ORIG_QUAL;
-
-    /* MAX_QUAL
-     *  max. quality score in read
-     */
-    extern column < INSDC:quality:phred > zip_encoding MAX_QUAL;
-
-    /* NREAD
-     *  number of the read
-     */
-    extern column < U8 > zip_encoding NREAD;
-
-    /* TOTAL_COUNT
-     *  total count of observed events
-     */
-    extern column < U32 > izip_encoding TOTAL_COUNT;
-
-    /* MISMATCH_COUNT
-     *  count of observed mismatches
-     */
-    extern column < U32 > izip_encoding MISMATCH_COUNT;
-
-};
diff --git a/interfaces/align/quality-quantizer.h b/interfaces/align/quality-quantizer.h
deleted file mode 100644
index 223ffda..0000000
--- a/interfaces/align/quality-quantizer.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-
-#ifndef _h_align_quality_quantizer_
-#define _h_align_quality_quantizer_
-
-#ifndef _h_align_extern_
-#include <align/extern.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* InitMatrix
- *  
- *
- */
-ALIGN_EXTERN bool CC QualityQuantizerInitMatrix(uint8_t result[256], char const initializer[]);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_align_quality_quantizer_ */
diff --git a/interfaces/align/reader-refseq.h b/interfaces/align/reader-refseq.h
deleted file mode 100644
index 8fbd017..0000000
--- a/interfaces/align/reader-refseq.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was readten as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifndef _h_align_reader_refseq_
-#define _h_align_reader_refseq_
-
-#ifndef _h_align_extern_
-#include <align/extern.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct VDBManager;
-struct VTable;
-
-enum ETableReaderRefSeq_Options {
-    errefseq_4NA = 0x01 /* read in INSDC:4na:bin, INSDC:dna:text is default */
-};
-
-typedef struct TableReaderRefSeq TableReaderRefSeq;
-
-ALIGN_EXTERN rc_t CC TableReaderRefSeq_MakeTable(const TableReaderRefSeq** cself, const struct VDBManager* vmgr,
-                                                 const struct VTable* table, uint32_t options, size_t cache);
-
-ALIGN_EXTERN rc_t CC TableReaderRefSeq_MakePath(const TableReaderRefSeq** cself, const VDBManager* vmgr,
-                                                const char* path, uint32_t options, size_t cache);
-
-ALIGN_EXTERN void CC TableReaderRefSeq_Whack(const TableReaderRefSeq* cself);
-
-ALIGN_EXTERN rc_t CC TableReaderRefSeq_SeqId(const TableReaderRefSeq* cself, const char** id, uint32_t* id_sz);
-
-ALIGN_EXTERN rc_t CC TableReaderRefSeq_SeqLength(const TableReaderRefSeq* cself, INSDC_coord_len* len);
-
-ALIGN_EXTERN rc_t CC TableReaderRefSeq_Circular(const TableReaderRefSeq* cself, bool* circular);
-
-/* *md5 is NULL if not present */
-ALIGN_EXTERN rc_t CC TableReaderRefSeq_MD5(const TableReaderRefSeq* cself, const uint8_t** md5);
-
-/* read a chunk of refseq into buffer from offset up to offset + len
-   if offset is beyond non-circular refseq size error is returned
- */
-ALIGN_EXTERN rc_t CC TableReaderRefSeq_Read(const TableReaderRefSeq* cself, INSDC_coord_zero offset, INSDC_coord_len len,
-                                            uint8_t* buffer, INSDC_coord_len* written);
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_align_reader_refseq_ */
diff --git a/interfaces/align/reference.h b/interfaces/align/reference.h
deleted file mode 100644
index b02faf5..0000000
--- a/interfaces/align/reference.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was readten as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifndef _h_align_reader_reference_
-#define _h_align_reader_reference_
-
-#ifndef _h_align_extern_
-#include <align/extern.h>
-#endif
-
-#ifndef _h_vdb_cursor_
-#include <vdb/cursor.h>
-#endif
-
-#ifndef _h_vdb_table_
-#include <vdb/table.h>
-#endif
-
-#ifndef _h_vdb_database_
-#include <vdb/database.h>
-#endif
-
-#ifndef _h_vdb_manager_
-#include <vdb/manager.h>
-#endif
-
-#ifndef _h_align_iterator_
-#include <align/iterator.h>
-#endif
-
-#ifndef _h_insdc_insdc_
-#include <insdc/insdc.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct VCursor;
-struct PlacementIterator;
-
-enum ReferenceList_Options {
-    ereferencelist_4na = 0x01, /* READ in 4na, otherwise it is DNA */
-    /* next 3 options are used only if iterator is NOT created using existing cursor */
-    ereferencelist_usePrimaryIds = 0x02, /* read PRIMARY_ALIGNMENT_IDS too */
-    ereferencelist_useSecondaryIds = 0x04, /* read SECONDARY_ALIGNMENT_IDS too */
-    ereferencelist_useEvidenceIds = 0x08 /* use EVIDENCE_ALIGNMENT */
-};
-
-typedef struct ReferenceList ReferenceList;
-
-/** name is used to limit only to a single sequence - for quick lookups **/
-/** numbins is used to divide whole reference table in equi-row-bins and show only the bin where the name is falling to **/
-ALIGN_EXTERN rc_t CC ReferenceList_MakeCursor(const ReferenceList** cself, const VCursor* cursor, uint32_t options,
-                                              const char* name, const uint32_t numbins);
-
-ALIGN_EXTERN rc_t CC ReferenceList_MakeTable(const ReferenceList** cself, const VTable* table, uint32_t options,
-                                             size_t cache, const char* name, const uint32_t numbins);
-
-ALIGN_EXTERN rc_t CC ReferenceList_MakeDatabase(const ReferenceList** cself, const VDatabase* db, uint32_t options,
-                                                size_t cache, const char* name, const uint32_t numbins);
-
-ALIGN_EXTERN rc_t CC ReferenceList_MakePath(const ReferenceList** cself, const VDBManager* vmgr, const char* dbpath,
-                                            uint32_t options, size_t cache,const char *name, const uint32_t numbins);
-
-ALIGN_EXTERN rc_t CC ReferenceList_AddRef(const ReferenceList *cself);
-ALIGN_EXTERN void CC ReferenceList_Release(const ReferenceList* cself);
-
-/* number of items in the list */
-ALIGN_EXTERN rc_t CC ReferenceList_Count(const ReferenceList* cself, uint32_t* count);
-
-typedef struct ReferenceObj ReferenceObj;
-
-/* find object by SEQ_ID and if not found by NAME */
-ALIGN_EXTERN rc_t CC ReferenceList_Find(const ReferenceList* cself, const ReferenceObj** obj, const char* key, size_t key_sz);
-
-/* idx is 0-based */
-ALIGN_EXTERN rc_t CC ReferenceList_Get(const ReferenceList* cself, const ReferenceObj** obj, uint32_t idx);
-
-ALIGN_EXTERN rc_t ReferenceObj_AddRef(const ReferenceObj *cself);
-ALIGN_EXTERN void CC ReferenceObj_Release(const ReferenceObj* cself);
-
-/* internal idx for use in ReferenceList_Get above */
-ALIGN_EXTERN rc_t CC ReferenceObj_Idx(const ReferenceObj* cself, uint32_t* idx);
-/* Gets RowId range for the object */
-ALIGN_EXTERN rc_t CC ReferenceObj_IdRange(const ReferenceObj* cself, int64_t* start, int64_t* stop);
-/* Gets Current bin number if ReferenceList was binned*/
-ALIGN_EXTERN rc_t CC ReferenceObj_Bin(const ReferenceObj* cself, uint32_t* bin);
-
-ALIGN_EXTERN rc_t CC ReferenceObj_SeqId(const ReferenceObj* cself, const char** seqid);
-
-ALIGN_EXTERN rc_t CC ReferenceObj_Name(const ReferenceObj* cself, const char** name);
-
-ALIGN_EXTERN rc_t CC ReferenceObj_SeqLength(const ReferenceObj* cself, INSDC_coord_len* len);
-
-ALIGN_EXTERN rc_t CC ReferenceObj_Circular(const ReferenceObj* cself, bool* circular);
-
-/* check if actual refseq data is located in external table (external == true on return)
-   optionally obtain its path, returned path == NULL means actual refseq is missing
-   if path was requested and obtained caller must free(path)! */
-ALIGN_EXTERN rc_t CC ReferenceObj_External(const ReferenceObj* cself, bool* external, char** path);
-
-/* read a chunk of refseq into buffer from offset up to offset + len
-   if offset is beyond non-circular refseq size error is returned
- */
-ALIGN_EXTERN rc_t CC ReferenceObj_Read(const ReferenceObj* cself, INSDC_coord_zero offset, INSDC_coord_len len,
-                                       uint8_t* buffer, INSDC_coord_len* written);
-
-ALIGN_EXTERN rc_t CC ReferenceObj_GetIdCount( const ReferenceObj* cself, int64_t row_id, uint32_t *count );
-
-/* return pointer to iterator for (PRIMARY|SECONDARY)_ALIGNMENT_IDS to a given range on reference,
-   both cursors could be NULL
-   ref_len will be truncated to seq length for non-circular references
-   for other parameters see AlignMgrMakePlacementIterator
- */
-ALIGN_EXTERN rc_t CC ReferenceObj_MakePlacementIterator ( const ReferenceObj* cself,
-    PlacementIterator **iter,
-    INSDC_coord_zero ref_window_start,
-    INSDC_coord_len ref_window_len, int32_t min_mapq,
-    struct VCursor const *ref_cur, struct VCursor const *align_cur, align_id_src ids,
-    const PlacementRecordExtendFuncs *ext_0, const PlacementRecordExtendFuncs *ext_1,
-    const char * rd_group, void * placement_ctx );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_align_reader_reference_ */
diff --git a/interfaces/align/refseq-mgr.h b/interfaces/align/refseq-mgr.h
deleted file mode 100644
index 103789a..0000000
--- a/interfaces/align/refseq-mgr.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was readten as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#ifndef _h_align_refseq_mgr_
-#define _h_align_refseq_mgr_
-
-#ifndef _h_align_extern_
-#include <align/extern.h>
-#endif
-
-#include <vdb/manager.h>
-#include <vdb/table.h>
-#include <align/reader-refseq.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct RefSeqMgr RefSeqMgr;
-
-/* Manages refseq tables
-    reader_options [IN] - passed to TableReaderRefSeq
-    cache [IN] - db cache size per single!!! reference (vdb cursor cache)
-    keep_open_num [IN] - number of refseq kept open, 0 - no limit
- */
-ALIGN_EXTERN rc_t CC RefSeqMgr_Make(const RefSeqMgr** cself, const VDBManager* vmgr,
-                                    uint32_t reader_options, size_t cache, uint32_t keep_open_num);
-
-ALIGN_EXTERN rc_t CC RefSeqMgr_Release(const RefSeqMgr* cself);
-
-ALIGN_EXTERN rc_t CC RefSeqMgr_SetCache(RefSeqMgr const *const cself, size_t cache, uint32_t keep_open_num);
-
-/* return value if 0 means object was found, path is optional */
-ALIGN_EXTERN rc_t RefSeqMgr_Exists(const RefSeqMgr* cself, const char* accession, uint32_t accession_sz, char** path);
-
-/* Read from refseq ided by seq_id chunk of 'len' bases into provided 'buffer' (must be enough big for len);
-   on return written has number of bases written
- */
-ALIGN_EXTERN rc_t CC RefSeqMgr_Read(const RefSeqMgr* cself, const char* seq_id, uint32_t seq_id_sz,
-                                    INSDC_coord_zero offset, INSDC_coord_len len,
-                                    uint8_t* buffer, INSDC_coord_len* written);
-
-typedef struct RefSeq RefSeq;
-
-ALIGN_EXTERN rc_t CC RefSeqMgr_GetSeq(const RefSeqMgr* cmgr, const RefSeq** cself, const char* seq_id, uint32_t seq_id_sz);
-
-/* Same as RefSeqMgr_Read
- */
-ALIGN_EXTERN rc_t CC RefSeq_Read(const RefSeq* cself, INSDC_coord_zero offset, INSDC_coord_len len,
-                                 uint8_t* buffer, INSDC_coord_len* written);
-
-ALIGN_EXTERN rc_t CC RefSeq_Circular(const RefSeq* cself, bool* circular);
-
-ALIGN_EXTERN rc_t CC RefSeq_SeqLength(const RefSeq* cself, INSDC_coord_len* len);
-
-ALIGN_EXTERN rc_t CC RefSeq_MD5(const RefSeq* cself, const uint8_t** md5);
-
-ALIGN_EXTERN rc_t CC RefSeq_Release(const RefSeq* cself);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_align_refseq_mgr_ */
diff --git a/interfaces/align/refseq.vschema b/interfaces/align/refseq.vschema
deleted file mode 100644
index 7ea0dc8..0000000
--- a/interfaces/align/refseq.vschema
+++ /dev/null
@@ -1,100 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/*==========================================================================
- * VDB Reference Sequence types, functions and tables
- */
-version 1;
-
-include 'vdb/vdb.vschema';
-include 'ncbi/seq.vschema';
-include 'ncbi/sra.vschema';
-include 'ncbi/stats.vschema';
-
-
-extern function U8 NCBI:refseq:stats #1 ( INSDC:4na:bin seq )
-    = NCBI:refSeq:stats;
-
-table NCBI:refseq:tbl:reference #1.0.2 =
-    NCBI:tbl:base_space #2.0.2,
-    NCBI:tbl:phred_quality #2.0.3,
-    NCBI:tbl:seqloc #1.0,
-    NCBI:SRA:tbl:stats #1.1.2
-{
-    // 128K
-    column default limit = 131072;
-
-    extern column U32 MAX_SEQ_LEN;                  /* must be static */
-    extern column < ascii > izip_encoding DEF_LINE; /* remainder of defline after SEQ_ID */
-
-    // trigger upconverts to INSDC:dna:text to get MD5
-    trigger table_stats
-        = NCBI:refseq:stats(in_4na_bin);
-
-    readonly column U64 TOTAL_SEQ_LEN
-        = < U64 > meta:value < 'STATS/TOTAL_SEQ_LEN', true >();
-        
-    readonly column U8[16] MD5
-        = < U8[16] > meta:read < 'STATS/MD5', true >();
-        
-    // indicates if sequence has circular structure
-    // should be static
-    extern column bool_encoding CIRCULAR;
-    
-    /* columns:
-     *  READ
-     *  QUALITY (optional)
-     *  SEQ_ID
-     *  SEQ_START
-     *  SEQ_LEN
-     *  MAX_SEQ_LEN
-     *  TOTAL_SEQ_LEN
-     *  DEF_LINE
-     */
-
-    // make CS_KEY writable
-    INSDC:dna:text in_cs_key
-        = < INSDC:dna:text, INSDC:dna:text > map < 'acgtn', 'ACGTN' > ( CS_KEY );
-    physical column < INSDC:dna:text > zip_encoding .CS_KEY = in_cs_key;
-    // extra columns needed for CS conversion
-    INSDC:coord:zero out_read_start = < INSDC:coord:zero> echo < 0 > ();
-    INSDC:coord:len  out_read_len =  .SEQ_LEN;
-    
-    INSDC:coord:len _alt_in_read_len
-        = READ_LEN
-        | SEQ_LEN;
-
-    INSDC:SRA:xread_type _alt_in_read_type
-        = READ_TYPE
-        | < INSDC:SRA:xread_type > echo < SRA_READ_TYPE_BIOLOGICAL > ();
-
-    INSDC:SRA:xread_type out_read_type
-        = .READ_TYPE
-        | < INSDC:SRA:xread_type > echo < SRA_READ_TYPE_BIOLOGICAL > ();
-};
-
-// older spelling
-alias NCBI:refseq:tbl:reference NCBI:refSeq:tbl:reference;
diff --git a/interfaces/align/seq.vschema b/interfaces/align/seq.vschema
deleted file mode 100644
index 9b2f452..0000000
--- a/interfaces/align/seq.vschema
+++ /dev/null
@@ -1,300 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/*==========================================================================
- * Sequence schema
- */
-version 1;
-
-include 'vdb/vdb.vschema';
-include 'ncbi/seq.vschema';
-
-
-/* cmp_base_space
- *  table representing compressed reads in base space,
- *  where the bases are only stored for unaligned reads
- */
-table NCBI:align:tbl:cmp_base_space #1
-    = INSDC:tbl:sequence #1.0.1
-    , NCBI:tbl:dcmp_base_space #1
-{
-    /* CMP_READ
-     *  read compressed against a reference sequence
-     */
-
-    // default is IUPAC character representation
-    extern default column INSDC:dna:text CMP_READ
-    {
-        read = out_cmp_dna_text;
-        validate = < INSDC:dna:text > compare ( in_cmp_dna_text, out_cmp_dna_text );
-    }
-
-    // 4na representation
-    extern column INSDC:4na:bin CMP_READ = out_cmp_4na_bin;
-    extern column INSDC:4na:packed CMP_READ = out_cmp_4na_packed;
-
-    // x2na representation - 2na with ambiguity
-    extern column INSDC:x2na:bin CMP_READ = out_cmp_x2na_bin;
-
-    // 2na representation - 2na with no ambiguity
-    extern column INSDC:2na:bin CMP_READ = out_cmp_2na_bin;
-    extern column INSDC:2na:packed CMP_READ = out_cmp_2na_packed;
-
-
-    /* input processing rules
-     */
-
-    // compressed input text
-    INSDC:dna:text in_cmp_dna_text
-        = < INSDC:dna:text, INSDC:dna:text > map < '.acmgrsvtwyhkdbn','NACMGRSVTWYHKDBN' > ( CMP_READ );
-
-    // compressed input 4na bin
-    INSDC:4na:bin in_cmp_4na_bin
-        = < INSDC:4na:bin > range_validate < 0, 15 > ( CMP_READ )
-        | ( INSDC:4na:bin ) unpack ( in_cmp_4na_packed )
-        | < INSDC:dna:text, INSDC:4na:bin > map < INSDC:4na:map:CHARSET, INSDC:4na:map:BINSET > ( in_cmp_dna_text )
-        | < INSDC:x2na:bin, INSDC:4na:bin > map < INSDC:x2na:map:BINSET, [ 1, 2, 4, 8, 15 ] > ( in_cmp_x2na_bin );
-
-    // compressed input 4na packed
-    INSDC:4na:packed in_cmp_4na_packed = CMP_READ;
-
-    // compressed input x2na bin
-    INSDC:x2na:bin in_cmp_x2na_bin
-        = < INSDC:x2na:bin > range_validate < 0, 4 > ( CMP_READ )
-        | < INSDC:4na:bin, INSDC:x2na:bin > map < INSDC:4na:map:BINSET, [ 4,0,1,4,2,4,4,4,3,4,4,4,4,4,4,4 ] > ( in_cmp_4na_bin );
-
-    // compressed input 2na bin
-    INSDC:2na:bin in_cmp_2na_bin
-        = < INSDC:2na:bin > range_validate < 0, 3 > ( CMP_READ )
-        | ( INSDC:2na:bin ) unpack ( in_cmp_2na_packed )
-        | INSDC:SEQ:rand_4na_2na ( in_cmp_4na_bin );
-
-    // compressed input 2na packed
-    INSDC:2na:packed in_cmp_2na_packed = CMP_READ;
-
-    // input 4na alt-read ( ambiguities )
-    INSDC:4na:bin in_cmp_alt_4na_bin
-        = < INSDC:4na:bin, INSDC:4na:bin > map < INSDC:4na:map:BINSET, [ 15,0,0,3,0,5,6,7,0,9,10,11,12,13,14,15 ] > ( in_cmp_4na_bin );
-
-    // preparing a feed into stats column
-    U8 in_cmp_stats_bin = in_cmp_2na_bin;
-
-
-    /* physical columns
-     */
-
-    physical column INSDC:2na:packed .CMP_READ
-        = in_cmp_2na_packed
-        | ( INSDC:2na:packed ) pack ( in_cmp_2na_bin );
-
-    physical column < INSDC:4na:bin > zip_encoding .CMP_ALTREAD
-        = < INSDC:4na:bin > trim < 0, 0 > ( in_cmp_alt_4na_bin );
-
-
-    /* output processing rules
-     */
-
-    // output 2na packed
-    INSDC:2na:packed out_cmp_2na_packed = .CMP_READ;
-
-    // unambiguous unpacked 2na
-    INSDC:2na:bin out_cmp_2na_bin
-        = ( INSDC:2na:bin ) unpack ( out_cmp_2na_packed );
-
-    // output x2na bin
-    INSDC:x2na:bin out_cmp_x2na_bin
-        = < INSDC:4na:bin, INSDC:x2na:bin > map < INSDC:4na:map:BINSET, [ 4,0,1,4,2,4,4,4,3,4,4,4,4,4,4,4 ] > ( out_cmp_4na_bin );
-
-    // output 2na->4na bin
-    INSDC:4na:bin out_cmp_2na_4na_bin
-        = < INSDC:2na:bin, INSDC:4na:bin > map < INSDC:2na:map:BINSET, [ 1, 2, 4, 8 ] > ( out_cmp_2na_bin );
-
-    // output 4na bin
-    INSDC:4na:bin out_cmp_4na_bin
-        = < INSDC:4na:bin > bit_or < ALIGN_RIGHT > ( out_cmp_2na_4na_bin, .CMP_ALTREAD )
-        | out_cmp_2na_4na_bin;
-
-    // synthesized packed 4na
-    INSDC:4na:packed out_cmp_4na_packed
-        = ( INSDC:4na:packed ) pack ( out_cmp_4na_bin );
-
-    // output text
-    INSDC:dna:text out_cmp_dna_text
-        = < INSDC:4na:bin, INSDC:dna:text > map < INSDC:4na:map:BINSET, INSDC:4na:map:CHARSET > ( out_cmp_4na_bin );
-
-
-    /* decompressed sequences
-     *   source is out_dcmp_4na_bin - a virtual production
-     */
-
-    // synthesize x2na_bin, 2na_bin and 2na_packed
-    INSDC:x2na:bin out_dcmp_x2na_bin
-        = < INSDC:4na:bin, INSDC:x2na:bin > map < INSDC:4na:map:BINSET, [ 4,0,1,4,2,4,4,4,3,4,4,4,4,4,4,4 ] > ( out_dcmp_4na_bin );
-    INSDC:2na:bin out_dcmp_2na_bin
-        = < INSDC:x2na:bin, INSDC:2na:bin > map < [ 0,1,2,3,4 ], [ 0,1,2,3,0 ] > ( out_dcmp_x2na_bin );
-    INSDC:2na:packed out_dcmp_2na_packed
-        = ( INSDC:2na:packed ) pack ( out_dcmp_2na_bin );
-
-
-	/* INSDC:tbl:sequence inherited productions
-	 *  cs_native
-	 *  out_cs_key
-	 *  out_signal
-	 *  out_2cs_bin
-	 *  out_2na_bin
-	 *  out_4na_bin
-	 *  out_dna_text
-	 *  out_x2cs_bin
-	 *  out_x2na_bin
-	 *  out_2cs_packed
-	 *  out_2na_packed
-	 *  out_4na_packed
-	 *  out_color_text
-	 *  out_color_matrix
-	 */
-
-	/* NCBI:tbl:dcmp_base_space inherited productions
-	 *  out_dcmp_4na_bin
-	 */
-}
-
-
-/* cmp_color_space
- *  table representing compressed reads in color space,
- *  where the colors are only stored for unaligned reads
- */
-table NCBI:align:tbl:cmp_color_space #1 =
-    INSDC:tbl:sequence #1.0.1, NCBI:tbl:dcmp_color_space #1
-{
-    /* CMP_CSREAD
-     *  read compressed against a reference sequence
-     */
-
-    // default is IUPAC character representation
-    extern default column INSDC:color:text CMP_CSREAD = out_cmp_color_text;
-
-    // x2cs representation - 2cs with ambiguity
-    extern column INSDC:x2cs:bin CMP_CSREAD = out_cmp_x2cs_bin;
-
-    // 2cs representation - 2cs with no ambiguity
-    extern column INSDC:2cs:bin CMP_CSREAD = out_cmp_2cs_bin;
-    extern column INSDC:2cs:packed CMP_CSREAD = out_cmp_2cs_packed;
-
-
-    /* input processing rules
-     */
-
-    // compressed input text
-    INSDC:color:text in_cmp_color_text = CMP_CSREAD;
-
-    // compressed input x2cs bin
-    INSDC:x2cs:bin in_cmp_x2cs_bin
-        = < INSDC:x2cs:bin > range_validate < 0, 4 > ( CMP_CSREAD )
-        | < INSDC:color:text, INSDC:x2cs:bin > map < INSDC:x2cs:map:CHARSET, INSDC:x2cs:map:BINSET > ( in_cmp_color_text );
-
-    // compressed input 2cs bin
-    INSDC:2cs:bin in_cmp_2cs_bin
-        = < INSDC:2cs:bin > range_validate < 0, 3 > ( CMP_CSREAD )
-        | ( INSDC:2cs:bin ) unpack ( in_cmp_2cs_packed )
-        | < INSDC:x2cs:bin, INSDC:2cs:bin > map < INSDC:x2cs:map:BINSET, [ 0, 1, 2, 3, 0 ] > ( in_cmp_x2cs_bin );
-
-    // compressed input 2cs packed
-    INSDC:2cs:packed in_cmp_2cs_packed = CMP_CSREAD;
-
-    // compressed input x2cs alt-read ( ambiguities )
-    INSDC:x2cs:bin in_cmp_alt_x2cs_bin
-        = < INSDC:x2cs:bin, INSDC:x2cs:bin > map < INSDC:x2cs:map:BINSET, [ 0, 0, 0, 0, 4 ] > ( in_cmp_x2cs_bin );
-
-    // preparing a feed into stats column
-    U8 in_cmp_stats_bin = in_cmp_2cs_bin;
-
-
-    /* physical columns
-     */
-
-    physical column INSDC:2cs:packed .CMP_CSREAD
-        = in_cmp_2cs_packed
-        | ( INSDC:2cs:packed ) pack ( in_cmp_2cs_bin );
-
-    physical column < INSDC:x2cs:bin > zip_encoding .CMP_ALTCSREAD
-        = < INSDC:x2cs:bin > trim < 0, 0 > ( in_cmp_alt_x2cs_bin );
-
-
-    /* output processing rules
-     */
-
-    // compressed output 2cs packed
-    INSDC:2cs:packed out_cmp_2cs_packed = .CMP_CSREAD;
-
-    // unambiguous unpacked 2cs
-    INSDC:2cs:bin out_cmp_2cs_bin
-        = ( INSDC:2cs:bin ) unpack ( out_cmp_2cs_packed );
-
-    // unpacked 2cs with ambiguity
-    INSDC:x2cs:bin out_cmp_x2cs_bin
-        = ( INSDC:x2cs:bin ) < U8 > bit_or < ALIGN_RIGHT > ( out_cmp_2cs_bin, .CMP_ALTCSREAD )
-        | ( INSDC:x2cs:bin ) out_cmp_2cs_bin;
-
-    // output text
-    INSDC:color:text out_cmp_color_text
-        = < INSDC:x2cs:bin, INSDC:color:text > map <  INSDC:x2cs:map:BINSET, INSDC:x2cs:map:CHARSET > ( out_cmp_x2cs_bin );
-
-
-    /* decompressed sequences
-     *   sources are out_dcmp_x2cs_bin - virtual production
-     */
-
-    // synthesize 2cs_bin and 2cs_packed
-    INSDC:2cs:bin out_dcmp_2cs_bin
-        = < INSDC:x2cs:bin, INSDC:2cs:bin > map < [ 0,1,2,3,4 ], [ 0,1,2,3,0 ] > ( out_dcmp_x2cs_bin );
-    INSDC:2cs:packed out_dcmp_2cs_packed
-        = ( INSDC:2cs:packed ) pack ( out_dcmp_2cs_bin );
-
-
-	/* INSDC:tbl:sequence inherited productions
-	 *  cs_native
-	 *  out_cs_key
-	 *  out_signal
-	 *  out_2cs_bin
-	 *  out_2na_bin
-	 *  out_4na_bin
-	 *  out_dna_text
-	 *  out_x2cs_bin
-	 *  out_x2na_bin
-	 *  out_2cs_packed
-	 *  out_2na_packed
-	 *  out_4na_packed
-	 *  out_color_text
-	 *  out_qual_phred
-	 *  out_color_matrix
-	 *  out_qual_text_phred_33
-	 *  out_qual_text_phred_64
-	 */
-
-	/* NCBI:tbl:dcmp_color_space inherited productions
-	 *  out_dcmp_x2cs_bin
-	 */
-}
diff --git a/interfaces/align/writer-alignment.h b/interfaces/align/writer-alignment.h
deleted file mode 100644
index 5ce2ce6..0000000
--- a/interfaces/align/writer-alignment.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifndef _h_align_writer_alignment_
-#define _h_align_writer_alignment_
-
-#ifndef _h_align_extern_
-#include <align/extern.h>
-#endif
-
-#include <align/writer-cmn.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum ETableWriterAlgn_ColNames {
-    ewalgn_cn_TMP_KEY_ID,
-    ewalgn_cn_PLOIDY,
-    ewalgn_cn_SEQ_SPOT_ID,
-    ewalgn_cn_SEQ_READ_ID,
-    ewalgn_cn_READ_START,
-    ewalgn_cn_READ_LEN,
-    ewalgn_cn_REF_ID,
-    ewalgn_cn_REF_START,
-    ewalgn_cn_GLOBAL_REF_START,
-    ewalgn_cn_REF_LEN,
-    ewalgn_cn_REF_ORIENTATION,
-    ewalgn_cn_REF_PLOIDY,
-    ewalgn_cn_MATE_REF_ORIENTATION,
-    ewalgn_cn_MATE_REF_ID,
-    ewalgn_cn_MATE_REF_POS,
-    ewalgn_cn_MATE_ALIGN_ID,
-    ewalgn_cn_TEMPLATE_LEN,
-    ewalgn_cn_MAPQ,
-    ewalgn_cn_HAS_MISMATCH,
-    ewalgn_cn_HAS_REF_OFFSET,
-    ewalgn_cn_MISMATCH,
-    ewalgn_cn_REF_OFFSET,
-    ewalgn_cn_EVIDENCE_ALIGNMENT_IDS,
-    ewalgn_cn_ALIGN_GROUP,
-    ewalgn_cn_MISMATCH_QUALITY,
-    ewalgn_cn_MATE_GLOBAL_REF_START,
-    ewalgn_cn_MATE_REF_START,
-    ewalgn_cn_Last
-};
-
-typedef uint8_t ETableWriterAlgn_TableType;
-enum {
-    ewalgn_tabletype_PrimaryAlignment,
-    ewalgn_tabletype_SecondaryAlignment,
-    ewalgn_tabletype_EvidenceInterval,
-    ewalgn_tabletype_EvidenceAlignment
-};
-
-enum ETableWriterAlgn_ColOptions {
-    ewalgn_co_SEQ_SPOT_ID = 0x01,           /* SEQ_SPOT_ID will be written with the whole record */
-    ewalgn_co_TMP_KEY_ID = 0x02,            /* use TMP_KEY_ID column, by default not opened */
-    ewalgn_co_PLOIDY = 0x04,                /* ploidy is more than 1, columns PLOIDY, READ_START, READ_LEN needs data */
-    ewalgn_co_unsorted = 0x08,              /* use the unsorted table scheme */
-    ewalgn_co_MATE_ALIGN_ID_only = 0x10,    /* disable all other MATE_* columns */
-    ewalgn_co_MISMATCH_QUALITY = 0x20,      /* enable MISMATCH_QUALITY column */
-    ewalgn_co_MATE_POSITION = 0x40          /* enable mate position columns */
-};
-
-typedef struct TableWriterAlgnData_struct {
-
-    TableWriterData seq_spot_id;
-    TableWriterData seq_read_id;
-    TableWriterData tmp_key_id;
-
-    /* BEGIN filled out by ReferenceMgr_Compress */
-    uint32_t ploidy; /* incremented sequentially for each call, must be set to 0 for each new spot */
-    TableWriterData read_start; /* mandatory */
-    TableWriterData read_len; /* mandatory */
-    TableWriterData has_ref_offset; /* mandatory */
-    TableWriterData ref_offset; /* mandatory */
-    TableWriterData ref_id; /* used for unsorted*/
-    TableWriterData ref_start; /* used only for unsorted */
-    TableWriterData global_ref_start; /* used only for sorted */
-    TableWriterData has_mismatch;  /* mandatory only for primary */
-    TableWriterData mismatch; /* mandatory only for primary */
-    TableWriterData mismatch_qual;
-
-    INSDC_coord_len ref_len; /* projection on refseq is same for all alleles! */
-    /* tmp data, never saved to db */
-    /* recalculated offset in reference based on CIGAR and circularity in Compression */
-    INSDC_coord_zero effective_offset; 
-    int64_t ref_1st_row_id;
-    /* END filled out by ReferenceMgr_Compress */
-
-    TableWriterData ref_orientation;
-    TableWriterData ref_ploidy;
-    TableWriterData mapq;
-    TableWriterData align_group; /* set length to 0 if not used */
-
-    /* used only only in secondary */
-    TableWriterData mate_ref_orientation;
-    TableWriterData mate_ref_id;
-    TableWriterData mate_ref_pos;
-    TableWriterData mate_align_id;
-    TableWriterData template_len;
-
-    /* used only in for ewalgn_tabletype_EvidenceInterval table type */
-    TableWriterData alingment_ids;
-} TableWriterAlgnData;
-
-typedef struct TableWriterAlgn TableWriterAlgn;
-    
-typedef union ReferenceStart ReferenceStart;
-union ReferenceStart {
-    uint64_t global_ref_start;
-    struct {
-        int64_t ref_id;
-        INSDC_coord_one ref_start;
-    } local;
-};
-
-ALIGN_EXTERN rc_t CC TableWriterAlgn_Make(const TableWriterAlgn** cself, VDatabase* db,
-                                          ETableWriterAlgn_TableType type, uint32_t options);
-
-/* rows optional here */
-ALIGN_EXTERN rc_t CC TableWriterAlgn_Whack(const TableWriterAlgn* cself, bool commit, uint64_t* rows);
-
-ALIGN_EXTERN rc_t CC TableWriterAlgn_WriteDefault(const TableWriterAlgn* cself,
-                                                  enum ETableWriterAlgn_ColNames col, const TableWriterData* data);
-
-ALIGN_EXTERN rc_t CC TableWriterAlgn_GetNextRowId(const TableWriterAlgn* cself, int64_t* rowid);
-
-/* rowid optional here */
-ALIGN_EXTERN rc_t CC TableWriterAlgn_Write(const TableWriterAlgn* cself, const TableWriterAlgnData* data, int64_t* rowid);
-
-/* closes main cursor and creates lookup object on the successfully committed main cursor */
-ALIGN_EXTERN rc_t CC TableWriterAlgn_TmpKeyStart(const TableWriterAlgn* cself);
-
-/* retrieve TMP_KEY value by rowid */
-ALIGN_EXTERN rc_t CC TableWriterAlgn_TmpKey(const TableWriterAlgn* cself, int64_t rowid, uint64_t* key_id);
-
-/* retrieve reference start value by rowid */
-ALIGN_EXTERN rc_t CC TableWriterAlgn_RefStart(const TableWriterAlgn* cself, int64_t rowid, ReferenceStart *const rslt);
-
-/* assign a SPOT_ID value to row */
-ALIGN_EXTERN rc_t CC TableWriterAlgn_Write_SpotId(const TableWriterAlgn* cself, int64_t rowid, int64_t spot_id);
-
-ALIGN_EXTERN rc_t CC TableWriterAlgn_Write_SpotInfo(const TableWriterAlgn* cself,
-                                                    int64_t rowid,
-                                                    int64_t spot_id,
-                                                    int64_t mate_id,
-                                                    ReferenceStart const *ref_start);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_align_writer_alignment_ */
diff --git a/interfaces/align/writer-cmn.h b/interfaces/align/writer-cmn.h
deleted file mode 100644
index 9e6086a..0000000
--- a/interfaces/align/writer-cmn.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#ifndef _h_align_writer_cmn_
-#define _h_align_writer_cmn_
-
-#ifndef _h_align_extern_
-#include <align/extern.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct TableWriterData_struct {
-    const void* buffer;
-    uint64_t elements;
-} TableWriterData;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_align_writer_cmn_ */
diff --git a/interfaces/align/writer-reference.h b/interfaces/align/writer-reference.h
deleted file mode 100644
index e5fae09..0000000
--- a/interfaces/align/writer-reference.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifndef _h_align_writer_reference_
-#define _h_align_writer_reference_
-
-#ifndef _h_align_extern_
-#include <align/extern.h>
-#endif
-
-#include <insdc/insdc.h>
-#include <align/writer-cmn.h>
-#include <align/writer-alignment.h>
-#include <align/reader-refseq.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct KFile;
-
-enum EReference_Options {
-    ewrefmgr_co_allREADs = 0x01, /* always write READ */
-    ewrefmgr_co_Coverage = 0x02,  /* use coverage data, by default not used */
-    ewrefmgr_co_AcceptHardClip = 0x04 /* accept hard clipping in CIGAR */
-};
-
-typedef struct ReferenceMgr ReferenceMgr;
-
-/* Writes REFERENCE table with in given db
-    
-    vmgr [IN] - needed only if conf is not NULL
-    conf [IN] - optional path to tab separated file to resolve reference names
-                from source files to standard refseq accessions;
-                standard refseq dictionary location is obtained from kfg files.
-    path {IN] - optional path points to a directory with 'local' references
-                (not found in conf file), default is '.'
-    max_seq_len [IN] - 0 - use default
-    cache [IN] - db cache size per single!!! reference (vdb cursor cache)
-    num_open [IN] - number of refseq kept open, 0 - no limit
- */
-ALIGN_EXTERN rc_t CC ReferenceMgr_Make(const ReferenceMgr** cself, VDatabase* db, const VDBManager* vmgr,
-                                       const uint32_t options, const char* conf, const char* path, uint32_t max_seq_len,
-                                       size_t cache, uint32_t num_open);
-
-ALIGN_EXTERN rc_t CC ReferenceMgr_Release(const ReferenceMgr *cself,
-                                          const bool commit,
-                                          uint64_t *const Rows,
-                                          const bool build_coverage,
-                                          rc_t (*const quitting)(void)
-                                          );
-
-ALIGN_EXTERN rc_t CC ReferenceMgr_SetCache(ReferenceMgr const *const self, size_t cache, uint32_t num_open);
-
-typedef struct ReferenceSeq ReferenceSeq;
-
-/* id: chr12 or NC_000001.3 */
-ALIGN_EXTERN rc_t CC ReferenceMgr_GetSeq(const ReferenceMgr* const cself, const ReferenceSeq** const seq, const char* id);
-
-ALIGN_EXTERN rc_t CC ReferenceMgr_Verify(const ReferenceMgr* cself, const char* id, INSDC_coord_len length, const uint8_t md5[16]);
-
-ALIGN_EXTERN rc_t CC ReferenceMgr_FastaPath(const ReferenceMgr* cself, const char* fasta_path);
-
-ALIGN_EXTERN rc_t CC ReferenceMgr_FastaFile(const ReferenceMgr* cself, struct KFile const* file);
-
-enum EReference_CompressionOptions {
-    ewrefmgr_cmp_Binary = 0x01, /* binary cigar on input (BAM format: 28+4 bits) */
-    ewrefmgr_cmp_Exact = 0x02 /* exact matching no cliping */
-};
-
-ALIGN_EXTERN rc_t CC ReferenceMgr_Compress(const ReferenceMgr* cself, uint32_t options,
-                                           const char* id, INSDC_coord_zero offset,
-                                           const char* seq, INSDC_coord_len seq_len,
-                                           const void* cigar, uint32_t cigar_len,
-                                           INSDC_coord_zero allele_offset, const char* allele, INSDC_coord_len allele_len,INSDC_coord_zero offset_in_allele,
-                                           const void* allele_cigar, uint32_t allele_cigar_len,
-                                           TableWriterAlgnData* data);
-
-
-/* Read refseq chunk of 'len' bases into provided 'buffer' (must be enough big for len);
-   ref_len - on return has number of bases written to the buffer
- */
-ALIGN_EXTERN rc_t CC ReferenceSeq_Read(const ReferenceSeq* cself, INSDC_coord_zero offset, INSDC_coord_len len,
-                                       uint8_t* buffer, INSDC_coord_len* ref_len);
-
-ALIGN_EXTERN rc_t CC ReferenceSeq_Get1stRow(const ReferenceSeq* cself, int64_t* row_id);
-
-ALIGN_EXTERN rc_t CC ReferenceSeq_Compress(const ReferenceSeq* cself, uint32_t options,
-                                           INSDC_coord_zero offset,
-                                           const char* seq, INSDC_coord_len seq_len,
-                                           const void* cigar, uint32_t cigar_len,
-                                           INSDC_coord_zero allele_offset, const char* allele, INSDC_coord_len allele_len,INSDC_coord_zero offset_in_allele,
-                                           const void* allele_cigar, uint32_t allele_cigar_len,
-                                           TableWriterAlgnData* data);
-                                           
-ALIGN_EXTERN rc_t CC ReferenceSeq_TranslateOffset_int(ReferenceSeq const *const cself,
-                                                      INSDC_coord_zero const offset,
-                                                      int64_t *const ref_id,
-                                                      INSDC_coord_zero *const ref_start,
-                                                      uint64_t *const global_ref_start);
-                                           
-
-enum ReferenceSeqCoverageTableType {
-    ewrefcov_primary_table = 0,
-    ewrefcov_secondary_table,
-    ewrefcov_evidence_table
-};
-
-typedef struct ReferenceSeqCoverage_struct {
-    /* based only on primary and secondary */
-    uint8_t high;
-    uint8_t low;
-    uint32_t mismatches;
-    uint32_t indels;
-    /* in that order (use enum above): prim, 2nd, evidence */
-    INSDC_coord_zero overlap_ref_pos[3];
-    INSDC_coord_len overlap_ref_len[3];
-    TableWriterData ids[3];
-} ReferenceSeqCoverage;
-
-ALIGN_EXTERN rc_t CC ReferenceSeq_AddCoverage(const ReferenceSeq* cself, INSDC_coord_zero offset, const ReferenceSeqCoverage* data);
-
-ALIGN_EXTERN rc_t CC ReferenceSeq_Release(const ReferenceSeq* cself);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_align_writer_reference_ */
diff --git a/interfaces/align/writer-refseq.h b/interfaces/align/writer-refseq.h
deleted file mode 100644
index 3f3e44a..0000000
--- a/interfaces/align/writer-refseq.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifndef _h_align_writer_refseq_
-#define _h_align_writer_refseq_
-
-#ifndef _h_align_extern_
-#include <align/extern.h>
-#endif
-
-#include <vdb/manager.h>
-#include <align/writer-cmn.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* default sequence chunk length */
-#define TableWriterRefSeq_MAX_SEQ_LEN 5000
-
-/* use in TableWriterRefSeq_Write* methods */
-enum ETableWriterRefSeq_ColNames {
-    ewrefseq_cn_MAX_SEQ_LEN, /* static/default */
-    ewrefseq_cn_DEF_LINE, /* static/default */
-    ewrefseq_cn_CS_KEY, /* handled by writer */
-    ewrefseq_cn_READ,
-    ewrefseq_cn_QUALITY, /* optional */
-    ewrefseq_cn_SEQ_ID, /* static/default */
-    ewrefseq_cn_SEQ_START, /* calculated on fly by writer */
-    ewrefseq_cn_SEQ_LEN, /* calculated on fly by writer */
-    ewrefseq_cn_CIRCULAR, /* static/default */
-    ewrefseq_cn_Last = ewrefseq_cn_CIRCULAR
-};
-
-enum ETableWriterRefSeq_ColOptions {
-    ewrefseq_co_QUALITY = 0x01 /* use QUALITY column, by default not opened */
-};
-
-typedef struct TableWriterRefSeqData_struct {
-    TableWriterData read;
-    TableWriterData quality;
-} TableWriterRefSeqData;
-
-typedef struct TableWriterRefSeq TableWriterRefSeq;
-
-ALIGN_EXTERN rc_t CC TableWriterRefSeq_Make(const TableWriterRefSeq** cself, VDBManager* mgr, const char* schema_path,
-                                            const char* table_path, const uint32_t options);
-
-/* rows optional here, app signature is mandatory */
-ALIGN_EXTERN rc_t CC TableWriterRefSeq_Whack(const TableWriterRefSeq* cself, bool commit, uint64_t* rows,
-                                             const char loader_name[],
-                                             const ver_t loader_version,
-                                             const char loader_date[],
-                                             const char app_name[],
-                                             const ver_t app_version);
-
-ALIGN_EXTERN rc_t CC TableWriterRefSeq_WriteDefault(const TableWriterRefSeq* cself,
-                                                    enum ETableWriterRefSeq_ColNames col, const TableWriterData* data);
-
-/* rowid optional here */
-ALIGN_EXTERN rc_t CC TableWriterRefSeq_Write(const TableWriterRefSeq* cself, const TableWriterRefSeqData* data, int64_t* rowid);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_align_writer_refseq_ */
diff --git a/interfaces/align/writer-sequence.h b/interfaces/align/writer-sequence.h
deleted file mode 100644
index 2283654..0000000
--- a/interfaces/align/writer-sequence.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifndef _h_align_writer_sequence_
-#define _h_align_writer_sequence_
-
-#ifndef _h_align_extern_
-#include <align/extern.h>
-#endif
-
-#include <align/writer-cmn.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum ETableWriterSeq_ColNames {
-    ewseq_cn_READ,
-    ewseq_cn_CSREAD,
-    ewseq_cn_CSKEY,
-    ewseq_cn_QUALITY,
-    ewseq_cn_PRIMARY_ALIGNMENT_ID,
-    ewseq_cn_ALIGNMENT_COUNT,
-    ewseq_cn_PLATFORM,
-    ewseq_cn_LABEL,
-    ewseq_cn_LABEL_START,
-    ewseq_cn_LABEL_LEN,
-    ewseq_cn_READ_TYPE,
-    ewseq_cn_READ_START,
-    ewseq_cn_READ_LEN,
-    ewseq_cn_TMP_KEY_ID,
-    ewseq_cn_SPOT_GROUP,
-    ewseq_cn_READ_FILTER,
-    ewseq_cn_TI,
-    ewseq_cn_Last = ewseq_cn_TI
-};
-
-enum ETableWriterSeq_ColOptions {
-    ewseq_co_SaveRead = 0x01,    /* write read even when there are alignments */
-    ewseq_co_FullQuality = 0x02, /* write full quality values, by default [1,10,20,30] */
-    ewseq_co_AlignData = 0x04,   /* PRIMARY_ALIGNMENT_ID, ALIGNMENT_COUNT will be written with the whole record */
-    ewseq_co_NoLabelData = 0x08, /* LABEL and related columns will not be written */
-    ewseq_co_ColorSpace = 0x10,  /* CMP_CSREAD will be written instead of CMP_READ */
-    ewseq_co_SpotGroup = 0x20,   /* SPOT_GROUP will be written */
-    ewseq_co_TI = 0x40,          /* TI will be written */
-    ewseq_co_SaveQual = 0x80     /* write quality even when there are alignments */
-};
-
-typedef struct TableWriterSeqData_struct {
-    TableWriterData sequence; /* writes sequence ONLY if alignment_count == 0 */
-    TableWriterData quality;
-    TableWriterData primary_alignment_id;
-    TableWriterData alignment_count;
-    TableWriterData label;
-    TableWriterData label_start;
-    TableWriterData label_len;
-    uint8_t nreads;
-    TableWriterData read_type;
-    TableWriterData read_start;
-    TableWriterData read_len;
-    uint64_t tmp_key_id;
-    TableWriterData spot_group;
-    TableWriterData cskey;
-    TableWriterData read_filter;
-    TableWriterData no_quantize_mask;
-    TableWriterData platform;
-    TableWriterData ti;
-} TableWriterSeqData;
-
-typedef struct TableWriterSeq TableWriterSeq;
-
-/*
- * quality_quantization:
- *  is a ',' seperated list of value pairs, with the pairs seperated by ':'.
- *  The first of the pair is the value to substitute.
- *  The second is the limit at which the substitution is no longer valid.
- *  The second value can be '-' to indication the remainder; this also terminates
- *  processing of the string.  If the second value is not '-', then the trailing
- *  ',' is required.
- *
- *  Example: 1:10,10:20,20:30,30:40,
- *  This will substitute 1 for quality values [0, 10), 10 for [10, 20),
- *  20 for [20, 30), 30 for [30, 40), and 0 for the rest
- *
- *  Example: 1:10,10:20,20:30,30:-
- *  This will substitute 1 for quality values [0, 10), 10 for [10, 20),
- *  20 for [20, 30), and 30 for the rest
- *
- *  Example: 1:30,30:-
- *  This will substitute 1 for quality values [0, 30), and 30 for the rest
- *
- *  Example: 10:30,20:-
- *  This will substitute 10 for quality values [0, 30), 20 for the rest
- */
-ALIGN_EXTERN rc_t CC TableWriterSeq_Make(const TableWriterSeq** cself, VDatabase* db,
-                                         const uint32_t options, char const quality_quantization[]);
-
-/* rows optional here */
-ALIGN_EXTERN rc_t CC TableWriterSeq_Whack(const TableWriterSeq* cself, bool commit, uint64_t* rows);
-
-ALIGN_EXTERN rc_t CC TableWriteSeq_WriteDefault(const TableWriterSeq* cself,
-                                                enum ETableWriterSeq_ColNames col, const TableWriterData* data);
-
-ALIGN_EXTERN rc_t CC TableWriterSeq_GetNextRowId(const TableWriterSeq* cself, int64_t* rowid);
-
-/* rowid optional here */
-ALIGN_EXTERN rc_t CC TableWriterSeq_Write(const TableWriterSeq* cself, const TableWriterSeqData* data, int64_t* rowid);
-
-
-/* if option ewseq_co_AlignData is not set (default) below methods are available */
-
-/* closes main cursor and creates lookup object on the successfully committed main cursor */
-ALIGN_EXTERN rc_t CC TableWriterSeq_TmpKeyStart(const TableWriterSeq* cself);
-
-/* retrieve TMP_KEY value by rowid */
-ALIGN_EXTERN rc_t CC TableWriterSeq_TmpKey(const TableWriterSeq* cself, int64_t rowid, uint64_t *key_id);
-
-/* passing rowid == 0 will cause the cursor to be flushed */
-ALIGN_EXTERN rc_t CC TableWriterSeq_WriteAlignmentData(const TableWriterSeq* cself, int64_t rowid,
-                                                       const TableWriterData* primary_alignment_id,
-                                                       const TableWriterData* alignment_count);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_align_writer_sequence_ */
diff --git a/interfaces/cc/gcc/compiler.h b/interfaces/cc/gcc/compiler.h
deleted file mode 100644
index d1bf565..0000000
--- a/interfaces/cc/gcc/compiler.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_compiler_
-#define _h_compiler_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_compiler_ */
-
diff --git a/interfaces/cc/gcc/i386/arch-impl.h b/interfaces/cc/gcc/i386/arch-impl.h
deleted file mode 100644
index 68c9433..0000000
--- a/interfaces/cc/gcc/i386/arch-impl.h
+++ /dev/null
@@ -1,400 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_arch_impl_
-#define _h_arch_impl_
-
-#include <stdint.h>
-
-#ifndef USE_GCC_BUILTIN
-#define USE_GCC_BUILTIN 1
-#endif
-
-#if USE_GCC_BUILTIN
-#include <strings.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-static __inline__
-int16_t uint16_lsbit ( uint16_t self )
-{
-    int16_t rtn;
-#if USE_GCC_BUILTIN
-    rtn = ( int16_t ) __builtin_ffs ( self ) - 1;
-#else
-    __asm__ __volatile__
-    (
-        "bsf %%ax, %%ax;"
-        "jnz .+5;"
-        "xor %%eax, %%eax;"
-        "dec %%eax;"
-        : "=a" ( rtn )
-        : "a" ( self )
-    );
-#endif
-    return rtn;
-}
-
-static __inline__
-int32_t uint32_lsbit ( uint32_t self )
-{
-    int32_t rtn;
-#if USE_GCC_BUILTIN
-    rtn = __builtin_ffs ( self ) - 1;
-#else
-    __asm__ __volatile__
-    (
-        "bsf %%eax, %%eax;"
-        "jnz .+5;"
-        "xor %%eax, %%eax;"
-        "dec %%eax;"
-        : "=a" ( rtn )
-        : "a" ( self )
-    );
-#endif
-    return rtn;
-}
-
-typedef struct int128_t int128_t;
-struct int128_t
-{
-    uint64_t lo;
-    int64_t hi;
-};
-
-static __inline__
-int64_t int128_hi ( const int128_t *self )
-{
-    return self -> hi;
-}
-
-static __inline__
-uint64_t int128_lo ( const int128_t *self )
-{
-    return self -> lo;
-}
-
-static __inline__
-void int128_sethi ( int128_t *self, int64_t i )
-{
-    self -> hi = i;
-}
-
-static __inline__
-void int128_setlo ( int128_t *self, uint64_t i )
-{
-    self -> lo = i;
-}
-
-typedef struct uint128_t uint128_t;
-struct uint128_t
-{
-    uint64_t lo;
-    uint64_t hi;
-};
-
-static __inline__
-uint64_t uint128_hi ( const uint128_t *self )
-{
-    return self -> hi;
-}
-
-static __inline__
-uint64_t uint128_lo ( const uint128_t *self )
-{
-    return self -> lo;
-}
-
-static __inline__
-void uint128_sethi ( uint128_t *self, uint64_t i )
-{
-    self -> hi = i;
-}
-
-static __inline__
-void uint128_setlo ( uint128_t *self, uint64_t i )
-{
-    self -> lo = i;
-}
-
-static __inline__
-void int128_add ( int128_t *self, const int128_t *i )
-{
-    __asm__ __volatile__
-    (
-        "push %%ebx;"
-        "mov (%%edx), %%eax;"
-        "mov 4(%%edx), %%ebx;"
-        "mov 8(%%edx), %%esi;"
-        "mov 12(%%edx), %%edi;"
-        "add %%eax, (%%ecx);"
-        "adc %%ebx, 4(%%ecx);"
-        "adc %%esi, 8(%%ecx);"
-        "adc %%edi, 12(%%ecx);"
-        "pop %%ebx;"
-        :
-        : "c" ( self ), "d" ( i )
-        : "%eax", "%esi", "%edi"
-    );
-}
-
-static __inline__
-void int128_sub ( int128_t *self, const int128_t *i )
-{
-    __asm__ __volatile__
-    (
-        "push %%ebx;"
-        "mov (%%edx), %%eax;"
-        "mov 4(%%edx), %%ebx;"
-        "mov 8(%%edx), %%esi;"
-        "mov 12(%%edx), %%edi;"
-        "sub %%eax, (%%ecx);"
-        "sbb %%ebx, 4(%%ecx);"
-        "sbb %%esi, 8(%%ecx);"
-        "sbb %%edi, 12(%%ecx);"
-        "pop %%ebx;"
-        :
-        : "c" ( self ), "d" ( i )
-        : "%eax", "%esi", "%edi"
-    );
-}
-
-static __inline__
-void int128_sar ( int128_t *self, uint32_t i )
-{
-    __asm__ __volatile__
-    (
-        "mov 4(%%edx), %%eax;"
-        "shrd %%cl, %%eax, (%%edx);"
-        "mov 8(%%edx), %%eax;"
-        "shrd %%cl, %%eax, 4(%%edx);"
-        "mov 12(%%edx), %%eax;"
-        "shrd %%cl, %%eax, 8(%%edx);"
-        "sar %%cl, %%eax;"
-        "mov %%eax, 12(%%edx);"
-        :
-        : "d" ( self ), "c" ( i )
-        :  "%eax"
-    );
-}
-
-static __inline__
-void int128_shl ( int128_t *self, uint32_t i )
-{
-    __asm__ __volatile__
-    (
-        "mov 8(%%edx), %%eax;"
-        "shld %%cl, %%eax, 12(%%edx);"
-        "mov 4(%%edx), %%eax;"
-        "shld %%cl, %%eax, 8(%%edx);"
-        "mov (%%edx), %%eax;"
-        "shld %%cl, %%eax, 4(%%edx);"
-        "shl %%cl, %%eax;"
-        "mov %%eax, (%%edx);"
-        :
-        : "d" ( self ), "c" ( i )
-        :  "%eax"
-    );
-}
-
-static __inline__
-void uint128_and ( uint128_t *self, const uint128_t *i )
-{
-    __asm__ __volatile__
-    (
-        "push %%ebx;"
-        "mov (%%edx), %%eax;"
-        "mov 4(%%edx), %%ebx;"
-        "mov 8(%%edx), %%esi;"
-        "mov 12(%%edx), %%edi;"
-        "and %%eax, (%%ecx);"
-        "and %%ebx, 4(%%ecx);"
-        "and %%esi, 8(%%ecx);"
-        "and %%edi, 12(%%ecx);"
-        "pop %%ebx;"
-        :
-        : "c" ( self ), "d" ( i )
-        : "%eax", "%esi", "%edi"
-    );
-}
-
-static __inline__
-void uint128_or ( uint128_t *self, const uint128_t *i )
-{
-    __asm__ __volatile__
-    (
-        "push %%ebx;"
-        "mov (%%edx), %%eax;"
-        "mov 4(%%edx), %%ebx;"
-        "mov 8(%%edx), %%esi;"
-        "mov 12(%%edx), %%edi;"
-        "or %%eax, (%%ecx);"
-        "or %%ebx, 4(%%ecx);"
-        "or %%esi, 8(%%ecx);"
-        "or %%edi, 12(%%ecx);"
-        "pop %%ebx;"
-        :
-        : "c" ( self ), "d" ( i )
-        : "%eax", "%esi", "%edi"
-    );
-}
-
-static __inline__
-void uint128_orlo ( uint128_t *self, uint64_t i )
-{
-    self -> lo |= i;
-}
-
-static __inline__
-void uint128_xor ( uint128_t *self, const uint128_t *i )
-{
-    __asm__ __volatile__
-    (
-        "push %%ebx;"
-        "mov (%%edx), %%eax;"
-        "mov 4(%%edx), %%ebx;"
-        "mov 8(%%edx), %%esi;"
-        "mov 12(%%edx), %%edi;"
-        "xor %%eax, (%%ecx);"
-        "xor %%ebx, 4(%%ecx);"
-        "xor %%esi, 8(%%ecx);"
-        "xor %%edi, 12(%%ecx);"
-        "pop %%ebx;"
-        :
-        : "c" ( self ), "d" ( i )
-        : "%eax", "%esi", "%edi"
-    );
-}
-
-static __inline__
-void uint128_not ( uint128_t *self )
-{
-    __asm__ __volatile__
-    (
-        "notl (%%ecx);"
-        "notl 4(%%ecx);"
-        "notl 8(%%ecx);"
-        "notl 12(%%ecx);"
-        :
-        : "c" ( self )
-    );
-}
-
-static __inline__
-void uint128_shr ( uint128_t *self, uint32_t i )
-{
-    __asm__ __volatile__
-    (
-        "mov 4(%%edx), %%eax;"
-        "shrd %%cl, %%eax, (%%edx);"
-        "mov 8(%%edx), %%eax;"
-        "shrd %%cl, %%eax, 4(%%edx);"
-        "mov 12(%%edx), %%eax;"
-        "shrd %%cl, %%eax, 8(%%edx);"
-        "shr %%cl, %%eax;"
-        "mov %%eax, 12(%%edx);"
-        :
-        : "d" ( self ), "c" ( i )
-        :  "%eax"
-    );
-}
-
-static __inline__
-void uint128_shl ( uint128_t *self, uint32_t i )
-{
-    __asm__ __volatile__
-    (
-        "mov 8(%%edx), %%eax;"
-        "shld %%cl, %%eax, 12(%%edx);"
-        "mov 4(%%edx), %%eax;"
-        "shld %%cl, %%eax, 8(%%edx);"
-        "mov (%%edx), %%eax;"
-        "shld %%cl, %%eax, 4(%%edx);"
-        "shl %%cl, %%eax;"
-        "mov %%eax, (%%edx);"
-        :
-        : "d" ( self ), "c" ( i )
-        :  "%eax"
-    );
-}
-
-static __inline__
-void uint128_bswap ( uint128_t *self )
-{
-    __asm__ __volatile__
-    (
-        "mov (%%ecx), %%eax;"
-        "mov 12(%%ecx), %%edx;"
-        "bswap %%eax;"
-        "bswap %%edx;"
-        "mov %%eax, 12(%%ecx);"
-        "mov %%edx, (%%ecx);"
-        "mov 4(%%ecx), %%eax;"
-        "mov 8(%%ecx), %%edx;"
-        "bswap %%eax;"
-        "bswap %%edx;"
-        "mov %%eax, 8(%%ecx);"
-        "mov %%edx, 4(%%ecx);"
-        :
-        : "c" ( self )
-        :  "%eax", "%edx"
-    );
-}
-
-static __inline__
-void uint128_bswap_copy ( uint128_t *to, const uint128_t *from )
-{
-    __asm__ __volatile__
-    (
-        "push %%ebx;"
-        "mov (%%edx), %%eax;"
-        "mov 12(%%edx), %%ebx;"
-        "bswap %%eax;"
-        "bswap %%ebx;"
-        "mov %%eax, 12(%%ecx);"
-        "mov %%ebx, (%%ecx);"
-        "mov 4(%%edx), %%eax;"
-        "mov 8(%%edx), %%ebx;"
-        "bswap %%eax;"
-        "bswap %%ebx;"
-        "mov %%eax, 8(%%ecx);"
-        "mov %%ebx, 4(%%ecx);"
-        "pop %%ebx;"
-        :
-        : "c" ( to ), "d" ( from )
-        :  "%eax"
-    );
-}
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_arch_impl_ */
diff --git a/interfaces/cc/gcc/i386/atomic.h b/interfaces/cc/gcc/i386/atomic.h
deleted file mode 100644
index f0abfc2..0000000
--- a/interfaces/cc/gcc/i386/atomic.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_atomic_
-#define _h_atomic_
-
-#ifndef _h_atomic32_
-#include "atomic32.h"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef int atomic_int;
-typedef struct atomic32_t atomic_t;
-
-/* ( * v ) */
-#define atomic_read( v ) \
-    atomic32_read ( v )
-
-/* ( * v ) = i */
-#define atomic_set( v, i ) \
-    atomic32_set ( v, i )
-
-/* prior = ( * v ), ( * v ) += i, prior */
-#define atomic_read_and_add( v, i ) \
-    atomic32_read_and_add ( v, i )
-
-/* ( * v ) += i */
-#define atomic_add( v, i ) \
-    atomic32_add ( v, i )
-
-/* ( * v ) += i */
-#define atomic_add_and_read( v, i ) \
-    atomic32_add_and_read ( v, i )
-
-/* ( void ) ++ ( * v ) */
-#define atomic_inc( v ) \
-    atomic32_inc ( v )
-
-/* ( void ) -- ( * v ) */
-#define atomic_dec( v ) \
-    atomic32_dec ( v )
-
-/* -- ( * v ) == 0 */
-#define atomic_dec_and_test( v ) \
-    atomic32_dec_and_test ( v )
-
-/* ++ ( * v ) == 0
-   when atomic_dec_and_test uses predecrement, you want
-   postincrement to this function. so it isn't very useful */
-#define atomic_inc_and_test( v ) \
-    atomic32_inc_and_test ( v )
-
-/* ( * v ) -- == 0
-   HERE's useful */
-#define atomic_test_and_inc( v ) \
-    atomic32_test_and_inc ( v )
-
-/* prior = ( * v ), ( * v ) = ( prior == t ? s : prior ), prior */
-#define atomic_test_and_set( v, s, t ) \
-    atomic32_test_and_set ( v, s, t )
-
-/* N.B. - THIS FUNCTION IS FOR 32 BIT PTRS ONLY */
-static __inline__ void *atomic_test_and_set_ptr ( void *volatile *v, void *s, void *t )
-{
-    void *rtn;
-    __asm__ __volatile__
-    (
-        "lock;"
-        "cmpxchg %%edx,(%%ecx)"
-        : "=a" ( rtn ), "=c" ( v )
-        : "c" ( v ), "d" ( s ), "a" ( t )
-    );
-    return rtn;
-}
-
-/* val = ( * v ), ( ( * v ) = ( val < t ) ? val + i : val ), val */
-#define atomic_read_and_add_lt( v, i, t ) \
-    atomic32_read_and_add_lt ( v, i, t )
-
-/* val = ( * v ), ( ( * v ) = ( val <= t ) ? val + i : val ), val */
-#define atomic_read_and_add_le( v, i, t ) \
-    atomic32_read_and_add_le ( v, i, t )
-
-/* val = ( * v ), ( ( * v ) = ( val == t ) ? val + i : val ), val */
-#define atomic_read_and_add_eq( v, i, t ) \
-    atomic32_read_and_add_eq ( v, i, t )
-
-/* val = ( * v ), ( ( * v ) = ( val != t ) ? val + i : val ), val */
-#define atomic_read_and_add_ne( v, i, t ) \
-    atomic32_read_and_add_ne ( v, i, t )
-
-/* val = ( * v ), ( ( * v ) = ( val >= t ) ? val + i : val ), val */
-#define atomic_read_and_add_ge( v, i, t ) \
-    atomic32_read_and_add_ge ( v, i, t )
-
-/* val = ( * v ), ( ( * v ) = ( val > t ) ? val + i : val ), val */
-#define atomic_read_and_add_gt( v, i, t ) \
-    atomic32_read_and_add_gt ( v, i, t )
-
-/* val = ( * v ), ( ( * v ) = ( ( val & 1 ) == 1 ) ? val + i : val ), val */
-#define atomic_read_and_add_odd( v, i ) \
-    atomic32_read_and_add_odd ( v, i )
-
-/* val = ( * v ), ( ( * v ) = ( ( val & 1 ) == 0 ) ? val + i : val ), val */
-#define atomic_read_and_add_even( v, i ) \
-    atomic32_read_and_add_even ( v, i )
-
-/* DEPRECATED */
-
-/* val = ( * v ), ( * v ) = ( val < t ? val + i : val ), ( val < t ? 1 : 0 ) */
-#define atomic_add_if_lt( v, i, t ) \
-    atomic32_add_if_lt ( v, i, t )
-
-/* val = ( * v ), ( * v ) = ( val <= t ? val + i : val ), ( val <= t ? 1 : 0 ) */
-#define atomic_add_if_le( v, i, t ) \
-    atomic32_add_if_le ( v, i, t )
-
-/* val = ( * v ), ( * v ) = ( val == t ? val + i : val ), ( val == t ? 1 : 0 ) */
-#define atomic_add_if_eq( v, i, t ) \
-    atomic32_add_if_eq ( v, i, t )
-
-/* val = ( * v ), ( * v ) = ( val >= t ? val + i : val ), ( val >= t ? 1 : 0 ) */
-#define atomic_add_if_ge( v, i, t ) \
-    atomic32_add_if_ge ( v, i, t )
-
-/* val = ( * v ), ( * v ) = ( val > t ? val + i : val ), ( val > t ? 1 : 0 ) */
-#define atomic_add_if_gt( v, i, t ) \
-    atomic32_add_if_gt ( v, i, t )
-
-#undef LOCK
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_atomic_ */
diff --git a/interfaces/cc/gcc/i386/atomic32.h b/interfaces/cc/gcc/i386/atomic32.h
deleted file mode 100644
index 55273b0..0000000
--- a/interfaces/cc/gcc/i386/atomic32.h
+++ /dev/null
@@ -1,369 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_atomic32_
-#define _h_atomic32_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Make sure gcc doesn't try to be clever and move things around
- * on us. We need to use _exactly_ the address the user gave us,
- * not some alias that contains the same information.
- */
-typedef struct atomic32_t atomic32_t;
-struct atomic32_t
-{
-    volatile int counter;
-};
-
-/* int atomic32_read ( const atomic32_t *v ); */
-#define atomic32_read( v ) \
-    ( ( v ) -> counter )
-
-/* void atomic32_set ( atomic32_t *v, int i ); */
-#define atomic32_set( v, i ) \
-    ( ( void ) ( ( ( v ) -> counter ) = ( i ) ) )
-
-/* add to v -> counter and return the prior value */
-static __inline__ int atomic32_read_and_add ( atomic32_t *v, int i )
-{
-    int rtn;
-    __asm__ __volatile__
-    (
-        "push %%ebx;"
-        "mov (%%ecx), %%eax;"
-        "mov %%edx, %%ebx;"
-        "add %%eax, %%ebx;"
-        "lock;"
-        "cmpxchg %%ebx, (%%ecx);"
-        "jne .-8;"
-        "pop %%ebx"
-        : "=a" ( rtn ), "=c" ( v )
-        : "c" ( v ), "d" ( i )
-    );
-    return rtn;
-}
-
-/* if no read is needed, define the least expensive atomic add */
-#define atomic32_add( v, i ) \
-    atomic32_read_and_add ( v, i )
-
-/* add to v -> counter and return the result */
-static __inline__ int atomic32_add_and_read ( atomic32_t *v, int i )
-{
-    int rtn;
-    __asm__ __volatile__
-    (
-        "push %%ebx;"
-        "mov (%%ecx), %%eax;"
-        "mov %%edx, %%ebx;"
-        "add %%eax, %%ebx;"
-        "lock;"
-        "cmpxchg %%ebx, (%%ecx);"
-        "jne .-8;"
-        "mov %%ebx, %%eax;"
-        "pop %%ebx"
-        : "=a" ( rtn ), "=c" ( v )
-        : "c" ( v ), "d" ( i )
-    );
-    return rtn;
-}
-
-/* just don't try to find out what the result was */
-static __inline__ void atomic32_inc ( atomic32_t *v )
-{
-    __asm__ __volatile__
-    (
-        "lock;"
-        "incl %0"
-        :"=m" (v->counter)
-        :"m" (v->counter)
-    );
-}
-
-static __inline__ void atomic32_dec ( atomic32_t *v )
-{
-    __asm__ __volatile__
-    (
-        "lock;"
-        "decl %0"
-        :"=m" (v->counter)
-        :"m" (v->counter)
-    );
-}
-
-/* decrement by one and test result for 0 */
-static __inline__ int atomic32_dec_and_test ( atomic32_t *v )
-{
-    unsigned char c;
-    __asm__ __volatile__
-    (
-        "lock;"
-        "decl %0;"
-        "sete %1"
-        :"=m" (v->counter), "=qm" (c)
-        :"m" (v->counter) : "memory"
-    );
-    return c;
-}
-
-/* when atomic32_dec_and_test uses predecrement, you want
-   postincrement to this function. so it isn't very useful */
-static __inline__ int atomic32_inc_and_test ( atomic32_t *v )
-{
-    unsigned char c;
-    __asm__ __volatile__
-    (
-        "lock;"
-        "incl %0;"
-        "sete %1"
-        :"=m" (v->counter), "=qm" (c)
-        :"m" (v->counter) : "memory"
-    );
-    return c;
-}
-
-/* HERE's useful */
-#define atomic32_test_and_inc( v ) \
-    ( atomic32_read_and_add ( v, 1 ) == 0 )
-
-static __inline__ int atomic32_test_and_set ( atomic32_t *v, int s, int t )
-{
-    int rtn;
-    __asm__ __volatile__
-    (
-        "lock;"
-        "cmpxchg %%edx,(%%ecx)"
-        : "=a" ( rtn ), "=c" ( v )
-        : "c" ( v ), "d" ( s ), "a" ( t )
-    );
-    return rtn;
-}
-
-/* conditional modifications */
-static __inline__
-int atomic32_read_and_add_lt ( atomic32_t *v, int i, int t )
-{
-    int rtn;
-    __asm__ __volatile__
-    (
-        "push %%ebx;"
-        "mov (%%ecx), %%eax;"
-        "cmp %%esi, %%eax;"
-        "mov %%edx, %%ebx;"
-        "jge .+10;"
-        "add %%eax, %%ebx;"
-        "lock;"
-        "cmpxchg %%ebx, (%%ecx);"
-        "jne .-12;"
-        "pop %%ebx"
-        : "=a" ( rtn ), "=c" ( v )
-        : "c" ( v ), "d" ( i ), "S" ( t )
-    );
-    return rtn;
-}
-
-#define atomic32_add_if_lt( v, i, t ) \
-    ( atomic32_read_and_add_lt ( v, i, t ) < ( t ) )
-
-static __inline__
-int atomic32_read_and_add_le ( atomic32_t *v, int i, int t )
-{
-    int rtn;
-    __asm__ __volatile__
-    (
-        "push %%ebx;"
-        "mov (%%ecx), %%eax;"
-        "cmp %%esi, %%eax;"
-        "mov %%edx, %%ebx;"
-        "jg .+10;"
-        "add %%eax, %%ebx;"
-        "lock;"
-        "cmpxchg %%ebx, (%%ecx);"
-        "jne .-12;"
-        "pop %%ebx"
-        : "=a" ( rtn ), "=c" ( v )
-        : "c" ( v ), "d" ( i ), "S" ( t )
-    );
-    return rtn;
-}
-
-#define atomic32_add_if_le( v, i, t ) \
-    ( atomic32_read_and_add_le ( v, i, t ) <= ( t ) )
-
-static __inline__
-int atomic32_read_and_add_eq ( atomic32_t *v, int i, int t )
-{
-    int rtn;
-    __asm__ __volatile__
-    (
-        "push %%ebx;"
-        "mov (%%ecx), %%eax;"
-        "cmp %%esi, %%eax;"
-        "mov %%edx, %%ebx;"
-        "jne .+10;"
-        "add %%eax, %%ebx;"
-        "lock;"
-        "cmpxchg %%ebx, (%%ecx);"
-        "jne .-12;"
-        "pop %%ebx"
-        : "=a" ( rtn ), "=c" ( v )
-        : "c" ( v ), "d" ( i ), "S" ( t )
-    );
-    return rtn;
-}
-
-#define atomic32_add_if_eq( v, i, t ) \
-    ( atomic32_read_and_add_eq ( v, i, t ) == ( t ) )
-
-static __inline__
-int atomic32_read_and_add_ne ( atomic32_t *v, int i, int t )
-{
-    int rtn;
-    __asm__ __volatile__
-    (
-        "push %%ebx;"
-        "mov (%%ecx), %%eax;"
-        "cmp %%esi, %%eax;"
-        "mov %%edx, %%ebx;"
-        "je .+10;"
-        "add %%eax, %%ebx;"
-        "lock;"
-        "cmpxchg %%ebx, (%%ecx);"
-        "jne .-12;"
-        "pop %%ebx"
-        : "=a" ( rtn ), "=c" ( v )
-        : "c" ( v ), "d" ( i ), "S" ( t )
-    );
-    return rtn;
-}
-
-#define atomic32_add_if_ne( v, i, t ) \
-    ( atomic32_read_and_add_ne ( v, i, t ) != ( t ) )
-
-static __inline__
-int atomic32_read_and_add_ge ( atomic32_t *v, int i, int t )
-{
-    int rtn;
-    __asm__ __volatile__
-    (
-        "push %%ebx;"
-        "mov (%%ecx), %%eax;"
-        "cmp %%esi, %%eax;"
-        "mov %%edx, %%ebx;"
-        "jl .+10;"
-        "add %%eax, %%ebx;"
-        "lock;"
-        "cmpxchg %%ebx, (%%ecx);"
-        "jne .-12;"
-        "pop %%ebx"
-        : "=a" ( rtn ), "=c" ( v )
-        : "c" ( v ), "d" ( i ), "S" ( t )
-    );
-    return rtn;
-}
-
-#define atomic32_add_if_ge( v, i, t ) \
-    ( atomic32_read_and_add_ge ( v, i, t ) >= ( t ) )
-
-static __inline__
-int atomic32_read_and_add_gt ( atomic32_t *v, int i, int t )
-{
-    int rtn;
-    __asm__ __volatile__
-    (
-        "push %%ebx;"
-        "mov (%%ecx), %%eax;"
-        "cmp %%esi, %%eax;"
-        "mov %%edx, %%ebx;"
-        "jle .+10;"
-        "add %%eax, %%ebx;"
-        "lock;"
-        "cmpxchg %%ebx, (%%ecx);"
-        "jne .-12;"
-        "pop %%ebx"
-        : "=a" ( rtn ), "=c" ( v )
-        : "c" ( v ), "d" ( i ), "S" ( t )
-    );
-    return rtn;
-}
-
-#define atomic32_add_if_gt( v, i, t ) \
-    ( atomic32_read_and_add_gt ( v, i, t ) > ( t ) )
-
-static __inline__
-int atomic32_read_and_add_odd ( atomic32_t *v, int i )
-{
-    int rtn;
-    __asm__ __volatile__
-    (
-        "push %%ebx;"
-        "mov (%%ecx), %%eax;"
-        "bt $0, %%ax;"
-        "mov %%edx, %%ebx;"
-        "jnc .+10;"
-        "add %%eax, %%ebx;"
-        "lock;"
-        "cmpxchg %%ebx, (%%ecx);"
-        "jne .-15;"
-        "pop %%ebx"
-        : "=a" ( rtn ), "=c" ( v )
-        : "c" ( v ), "d" ( i )
-    );
-    return rtn;
-}
-
-static __inline__
-int atomic32_read_and_add_even ( atomic32_t *v, int i )
-{
-    int rtn;
-    __asm__ __volatile__
-    (
-        "push %%ebx;"
-        "mov (%%ecx), %%eax;"
-        "bt $0, %%ax;"
-        "mov %%edx, %%ebx;"
-        "jc .+10;"
-        "add %%eax, %%ebx;"
-        "lock;"
-        "cmpxchg %%ebx, (%%ecx);"
-        "jne .-15;"
-        "pop %%ebx"
-        : "=a" ( rtn ), "=c" ( v )
-        : "c" ( v ), "d" ( i )
-    );
-    return rtn;
-}
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_atomic32_ */
diff --git a/interfaces/cc/gcc/i386/bitstr.h b/interfaces/cc/gcc/i386/bitstr.h
deleted file mode 100644
index a2e07ef..0000000
--- a/interfaces/cc/gcc/i386/bitstr.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_bitstr_
-#define _h_bitstr_
-
-/* use 32-bit accumulator, 16-bit word size */
-#define WRDSIZE 16
-#define WRDSHIFT 4
-#define WRD uint16_t
-#define ACC uint32_t
-#define BSWAP( x ) bswap_16 ( x )
-
-#include "../noarch/bitstr.h"
-
-#endif /* _h_bitstr_ */
diff --git a/interfaces/cc/gcc/i386/byteswap.h b/interfaces/cc/gcc/i386/byteswap.h
deleted file mode 100644
index 3cc5770..0000000
--- a/interfaces/cc/gcc/i386/byteswap.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_byteswap_
-#define _h_byteswap_
-
-#ifdef _BYTESWAP_H
-#warning "GNU byteswap.h being used"
-#else
-#define _BYTESWAP_H	1234
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* perform single instruction byte swap */
-static __inline__ uint16_t bswap_16 ( uint16_t i )
-{
-    register uint16_t rtn;
-    __asm__
-    (
-        "rorw $8, %w0"
-        : "=r" ( rtn )
-        : "0" ( i )
-        : "cc"
-    );
-    return rtn;
-}
-
-/* perform single instruction byte swap */
-static __inline__ uint32_t bswap_32 ( uint32_t i )
-{
-    register uint32_t rtn;
-    __asm__
-    (
-        "bswap %0"
-        : "=r" ( rtn )
-        : "0" ( i )
-        : "cc"
-    );
-    return rtn;
-}
-
-/* perform multi-instruction byte swap */
-static __inline__ uint64_t bswap_64 ( uint64_t i )
-{
-    union
-    {
-        uint64_t ll;
-        uint32_t l [ 2 ];
-    } in, rtn;
-    in . ll = i;
-    rtn . l [ 0 ] = bswap_32 ( in . l [ 1 ] );
-    rtn . l [ 1 ] = bswap_32 ( in . l [ 0 ] );
-    return rtn . ll;
-}
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _BYTESWAP_H */
-#endif /* _h_byteswap_ */
diff --git a/interfaces/cc/gcc/i386/strtol.h b/interfaces/cc/gcc/i386/strtol.h
deleted file mode 100644
index 79f462f..0000000
--- a/interfaces/cc/gcc/i386/strtol.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_strtol_
-#define _h_strtol_
-
-#ifndef _h_os_native_
-#include <os-native.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * strtoi32
- * strtoi32
- *  based upon actual usage
- */
-#define strtoi32( str, endp, base ) \
-    strtol ( str, endp, base )
-
-#define strtou32( str, endp, base ) \
-    strtoul ( str, endp, base )
-
-
-/*--------------------------------------------------------------------------
- * strtoi64
- * strtoi64
- *  based upon actual usage
- */
-#define strtoi64( str, endp, base ) \
-    strtoll ( str, endp, base )
-
-#define strtou64( str, endp, base ) \
-    strtoull ( str, endp, base )
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_strtol_ */
diff --git a/interfaces/cc/gcc/noarch/bitstr.h b/interfaces/cc/gcc/noarch/bitstr.h
deleted file mode 100644
index 2bb5bd0..0000000
--- a/interfaces/cc/gcc/noarch/bitstr.h
+++ /dev/null
@@ -1,413 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_noarch_bitstr_
-#define _h_noarch_bitstr_
-
-#ifndef _h_bitstr_
-#error "don't include <noarch/bitstr.h> directly - use <bitstr.h>"
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#include <byteswap.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* bitcpy
- *  copy a string of bits from source to dest
- *
- *  both source and dest may have non-byte aligned pointers
- *  the number of bits to copy need not be byte aligned
- *
- *  depending upon architecture and OS conventions, the word
- *  size may be adjusted to 1, 2, or 4 bytes, where the base
- *  pointers are always word aligned.
- *
- *  bits in memory are always treated as big-endian, meaning
- *  that on multi-byte fetches and stores, we perform byte-swapping
- *  if there are shifts or masks
- */
-static __inline__
-void bitcpy ( void *dbase, bitsz_t doff, const void *sbase, bitsz_t soff, bitsz_t sz )
-{
-    /* noop if sz == 0 */
-    if ( sz != 0 )
-    {
-        /* loop counter and destination word count */
-        size_t i, dcountz;
-
-        /* left & right masks and working register */
-        WRD lmask, rmask, reg;
-
-        /* produce word-aligned pointers */
-#if WRDSIZE == 8
-        /* 1-4. all at once */
-        WRD *dst = ( WRD* ) dbase + ( doff >> WRDSHIFT );
-        const WRD *src = ( const WRD* ) sbase + ( soff >> WRDSHIFT );
-#else
-        /* 1. capture word alignment adjustment */
-        size_t dadjust = ( size_t ) dbase & ( WRDSIZE / 8 - 1 );
-        size_t sadjust = ( size_t ) sbase & ( WRDSIZE / 8 - 1 );
-
-        /* 2. create word-aligned pointers */
-        WRD *dst = ( WRD* ) ( ( size_t ) dbase - dadjust );
-        const WRD *src = ( const WRD* ) ( ( size_t ) sbase - sadjust );
-
-        /* 3. incorporate alignment adjustment into offset bits */
-        doff += dadjust << 3;
-        soff += sadjust << 3;
-
-        /* 4. readjust pointers based upon offset */
-        dst += doff >> WRDSHIFT;
-        src += soff >> WRDSHIFT;
-#endif
-        /* 5. restate offsets */
-        doff &= ( WRDSIZE - 1 );
-        soff &= ( WRDSIZE - 1 );
-
-        /* calculate number of words - 1 in dst */
-        dcountz = ( doff + sz + ( WRDSIZE - 1 ) - WRDSIZE ) >> WRDSHIFT;
-
-        /* calculate masks */
-        lmask = rmask = ~ 0;
-        lmask >>= doff;
-        rmask >>= ( doff + sz ) & ( WRDSIZE - 1 );
-        if ( ( WRD ) ( rmask + 1 ) == 0 )
-            rmask = 0;
-
-        /* prime register with masked dst [ 0 ] */
-        reg = BSWAP ( dst [ 0 ] ) & ~ lmask;
-
-        /* if source and destination are aligned */
-        if ( doff == soff )
-        {
-            /* merge src [ 0 ] into reg through mask */
-            reg |= BSWAP ( src [ 0 ] ) & lmask;
-
-#if WRDSIZE > 8
-            /* straight copies don't need byteswap                                                                                                                                                           
-               other than on first and last words                                                                                                                                                            
-               put first word back into little-endian                                                                                                                                                        
-               for remainder of loop */
-            if ( dcountz > 0 )
-            {
-                reg = BSWAP ( reg );
-#endif
-                /* aligned buffers have n:n word ratio */
-                for ( i = 0; i < dcountz; )
-                {
-                    dst [ i ] = reg;
-                    reg = src [ ++ i ];
-                }
-
-#if WRDSIZE > 8
-                /* revert to big-endian */
-                reg = BSWAP ( reg );
-            }
-#endif
-        }
-
-        /* shifting alignment  */
-        else
-        {
-            /* source count may differ from dest count */
-            size_t scountz = ( soff + sz + ( WRDSIZE - 1 ) - WRDSIZE ) >> WRDSHIFT;
-
-            /* use double-word accumulator */
-            ACC acc = BSWAP ( src [ 0 ] );
-
-            /* shift amount */
-            int shift = ( int ) doff - ( int ) soff;
-            if ( shift > 0 )
-            {
-                /* take only valid bits in shifted initial src */
-                reg |= ( WRD ) ( acc >> shift ) & lmask;
-
-                /* because "shift" > 0, we know "dcountz" >= "scountz" */
-                for ( acc <<= WRDSIZE, i = 0; i < scountz; acc <<= WRDSIZE )
-                {
-                    dst [ i ] = BSWAP ( reg );
-                    ++ i;
-                    acc |= BSWAP ( src [ i ] );
-                    reg = ( WRD ) ( acc >> shift );
-                }
-
-                /* if "dcountz" > "scountz" */
-                if ( i < dcountz )
-                {
-                    dst [ i ] = BSWAP ( reg );
-                    reg = ( WRD ) ( acc >> shift );
-                }
-            }
-
-            else
-            {
-                /* need single word read-ahead and right-shift */
-                shift += WRDSIZE;
-
-                /* because "shift" was < 0, we know "dcountz" <= "scountz" */
-                for ( acc <<= WRDSIZE, i = 0; i < dcountz; acc <<= WRDSIZE )
-                {
-                    acc |= BSWAP ( src [ i + 1 ] );
-                    reg |= ( WRD ) ( acc >> shift ) & lmask;
-                    dst [ i ++ ] = BSWAP ( reg );
-                    lmask = ~ 0;
-                    reg = 0;
-                }
-
-                /* if "dcountz" < "scountz" */
-                if ( i < scountz )
-                    acc |= BSWAP ( src [ scountz ] );
-
-                reg |= ( WRD ) ( acc >> shift ) & lmask;
-            }
-        }
-
-        /* mask off unused bytes from src */
-        reg &= ~ rmask;
-
-        /* bring in saved bits from dst */
-        reg |= BSWAP ( dst [ dcountz ] ) & rmask;
-
-        /* write out last word */
-        dst [ dcountz ] = BSWAP ( reg );
-    }
-}
-
-/* bitcmp
- *  performs bitwise a - b, returning result as int
- *  result value has no meaning, only sign
- *  where < 0 means a < b, > 0 means a > b, and 0 means a == b
- *
- *  since the comparison produces a tri-state indicator of
- *  relative magnitude, the order of "a" and "b" is important.
- *  furthermore, the difference operator must be evaluated
- *  left to right, because the result indicates more than
- *  equality.
- *
- *  see bitcpy for general word alignment information
- */
-static __inline__
-int bitcmp ( const void *abase, bitsz_t aoff, const void *bbase, bitsz_t boff, bitsz_t sz )
-{
-    int diff = 0;
-
-    if ( sz != 0 )
-    {
-        /* loop counter and left word count */
-        size_t i, lcountz;
-
-        /* left & right masks and working registers */
-        WRD lmask, rmask, lreg, rreg;
-
-        /* produce word-aligned pointers */
-#if WRDSIZE == 8
-        /* 1-4. all at once */
-        const WRD *left = ( const WRD* ) abase + ( aoff >> WRDSHIFT );
-        const WRD *right = ( const WRD* ) bbase + ( boff >> WRDSHIFT );
-#else
-        /* 1. capture word alignment adjustment */
-        size_t aadjust = ( size_t ) abase & ( WRDSIZE / 8 - 1 );
-        size_t badjust = ( size_t ) bbase & ( WRDSIZE / 8 - 1 );
-
-        /* 2. create word-aligned pointers */
-        const WRD *left = ( const WRD* ) ( ( size_t ) abase - aadjust );
-        const WRD *right = ( const WRD* ) ( ( size_t ) bbase - badjust );
-
-        /* 3. incorporate alignment adjustment into offset bits */
-        aoff += aadjust << 3;
-        boff += badjust << 3;
-
-        /* 4. readjust pointers based upon offset */
-        left += aoff >> WRDSHIFT;
-        right += boff >> WRDSHIFT;
-#endif
-        /* 5. restate offsets */
-        aoff &= ( WRDSIZE - 1 );
-        boff &= ( WRDSIZE - 1 );
-
-        /* calculate number of words - 1 in left
-           since we know a-priori that "sz" > 0, we
-           know that the left and right counts must be
-           at least 1. our loops treat the last word
-           specially, so calculate a loop counter that
-           excludes the last word */
-        lcountz = ( aoff + sz + ( WRDSIZE - 1 ) - WRDSIZE ) >> WRDSHIFT;
-
-        /* calculate masks */
-        lmask = rmask = ~ 0;
-        lmask >>= aoff;
-        rmask >>= ( aoff + sz ) & ( WRDSIZE - 1 );
-        if ( ( WRD ) ( rmask + 1 ) == 0 )
-            rmask = 0;
-
-        /* significant bits from left [ 0 ] */
-        lreg = BSWAP ( left [ 0 ] ) & lmask;
-
-        /* if source and destination are aligned */
-        if ( aoff == boff )
-        {
-            /* test against right bits through mask */
-            rreg = BSWAP ( right [ 0 ] ) & lmask;
-
-            /* produce a difference of all but the last
-               aligned word, where initial word has been
-               left-masked. the last word is tested below. */
-            for ( i = 1; i <= lcountz; ++ i )
-            {
-                diff = ( int ) lreg - ( int ) rreg;
-                if ( diff != 0 )
-                    return diff;
-
-                /* byte-swapping occurs on little-endian architectures */
-                lreg = BSWAP ( left [ i ] );
-                rreg = BSWAP ( right [ i ] );
-            }
-
-            /* fall out to end for masked comparison of last word */
-        }
-
-        /* shifting alignment */
-        else
-        {
-            /* right count may differ from left count
-               since alignments differ, the span of "sz"
-               bits may hit a different number of words in
-               the left array than in the right. */
-            size_t rcountz = ( boff + sz + ( WRDSIZE - 1 ) - WRDSIZE ) >> WRDSHIFT;
-
-            /* use double-word accumulator
-               note that the extra bits get ignored */
-            ACC acc = BSWAP ( right [ 0 ] );
-
-            /* shift amount: positive if "b" needs to be right shifted.
-               NOTE - since the comparison must be successively performed
-               from left to right ( see above ), shifting is ALWAYS toward
-               right, making for special handling when "shift" < 0 ( see below ) */
-            int shift = ( int ) aoff - ( int ) boff;
-            if ( shift > 0 )
-            {
-                /* initial word from right operand, aligned with left */
-                rreg = ( WRD ) ( acc >> shift ) & lmask;
-
-                /* "shift" > 0 means "lcountz" >= "rcountz" */
-                for ( acc <<= WRDSIZE, i = 1; i <= rcountz; acc <<= WRDSIZE, ++ i )
-                {
-                    /* compare words at i-1 */
-                    diff = ( int ) lreg - ( int ) rreg;
-                    if ( diff != 0 )
-                        return diff;
-
-                    /* accumulate next word from right operand */
-                    acc |= BSWAP ( right [ i ] );
-
-                    /* bring in next word from left operand */
-                    lreg = BSWAP ( left [ i ] );
-
-                    /* produce aligned word from right operand */
-                    rreg = ( WRD ) ( acc >> shift );
-                }
-
-                /* if there is one more word in left */
-                if ( lcountz > rcountz )
-                {
-                    /* compare penultimate */
-                    diff = ( int ) lreg - ( int ) rreg;
-                    if ( diff != 0 )
-                        return diff;
-
-                    /* get last word in left */
-                    lreg = BSWAP ( left [ lcountz ] );
-
-                    /* last word from right is already in "acc" */
-                    rreg = ( WRD ) ( acc >> shift );
-                }
-
-                /* fall out to end for masked comparison of last word */
-            }
-
-            else
-            {
-                /* since all shifts must be toward right ( due to left to right
-                   comparison ), this alignment will require a pre-fetch from
-                   right operand into accumulator, and adjusting the negative
-                   shift amount to a positive right-shift. */
-                shift += WRDSIZE;
-
-                /* since "shift" was negative, we know "lcountz" <= "rcountz",
-                   so use "lcountz" as loop limit. pre-shift "acc" as loop init */
-                for ( acc <<= WRDSIZE, i = 1; i <= lcountz; acc <<= WRDSIZE, ++ i )
-                {
-                    /* accumulate next word from right operand */
-                    acc |= BSWAP ( right [ i ] );
-
-                    /* produce aligned word from right operand */
-                    rreg = ( WRD ) ( acc >> shift ) & lmask;
-
-                    /* now test against left */
-                    diff = ( int ) lreg - ( int ) rreg;
-                    if ( diff != 0 )
-                        return diff;
-
-                    /* bring in next word from left operand */
-                    lreg = BSWAP ( left [ i ] );
-
-                    /* no more left mask */
-                    lmask = ~ 0;
-                }
-
-                /* if there is one more word in right */
-                if ( lcountz < rcountz )
-                    acc |= BSWAP ( right [ rcountz ] );
-
-                /* produce "rreg" from "acc" */
-                rreg = ( WRD ) ( acc >> shift ) & lmask;
-
-                /* fall out to end for masked comparison of last word */
-            }
-        }
-
-        /* mask off unused bytes from right */
-        lreg &= ~ rmask;
-        rreg &= ~ rmask;
-
-        /* perform final comparison */
-        diff = ( int ) lreg - ( int ) rreg;
-    }
-
-    return diff;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_noarch_bitstr_ */
diff --git a/interfaces/cc/gcc/v128.h b/interfaces/cc/gcc/v128.h
deleted file mode 100644
index e16e31b..0000000
--- a/interfaces/cc/gcc/v128.h
+++ /dev/null
@@ -1,1088 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_v128_
-#define _h_v128_
-
-#include <stdint.h>
-#include <x86intrin.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef int8_t   v128_i8_t  __attribute__ ((vector_size (16),__may_alias__));
-typedef uint8_t  v128_u8_t  __attribute__ ((vector_size (16),__may_alias__));
-typedef int16_t  v128_i16_t __attribute__ ((vector_size (16),__may_alias__));
-typedef int32_t  v128_i32_t __attribute__ ((vector_size (16),__may_alias__));
-typedef int64_t  v128_i64_t __attribute__ ((vector_size (16),__may_alias__));
-typedef uint16_t v128_u16_t __attribute__ ((vector_size (16),__may_alias__));
-typedef uint32_t v128_u32_t __attribute__ ((vector_size (16),__may_alias__));
-typedef uint64_t v128_u64_t __attribute__ ((vector_size (16),__may_alias__));
-typedef float    v128_f_t   __attribute__ ((vector_size (16),__may_alias__));
-typedef double   v128_d_t   __attribute__ ((vector_size (16),__may_alias__));
-
-/* NOTE:
- * these types are to hide perceived flaws in the Intel/GCC code
- * don't use them outside of this file.  uint8_t, int8_t and int64_t all
- * fail to compile so the above types can't be used within this file in some 
- * places.
- */
-typedef char          v128_c_t   __attribute__ ((vector_size (16),__may_alias__));
-typedef long long int v128_lli_t __attribute__ ((vector_size (16),__may_alias__));
-
-
-#if USE_VEC_REG
-
-/* SSE
-  movss
-  movaps
-  movups
-  movlps
-  movhps
-  movlhps
-  movhlps
-*/
-
-#ifdef __MMX__
-/* MMX
-   v8qi __builtin_ia32_paddb (v8qi, v8qi)
-   v4hi __builtin_ia32_paddw (v4hi, v4hi)
-   v2si __builtin_ia32_paddd (v2si, v2si)
-   v8qi __builtin_ia32_psubb (v8qi, v8qi)
-   v4hi __builtin_ia32_psubw (v4hi, v4hi)
-   v2si __builtin_ia32_psubd (v2si, v2si)
-   v8qi __builtin_ia32_paddsb (v8qi, v8qi)
-   v4hi __builtin_ia32_paddsw (v4hi, v4hi)
-   v8qi __builtin_ia32_psubsb (v8qi, v8qi)
-   v4hi __builtin_ia32_psubsw (v4hi, v4hi)
-   v8qi __builtin_ia32_paddusb (v8qi, v8qi)
-   v4hi __builtin_ia32_paddusw (v4hi, v4hi)
-   v8qi __builtin_ia32_psubusb (v8qi, v8qi)
-   v4hi __builtin_ia32_psubusw (v4hi, v4hi)
-   v4hi __builtin_ia32_pmullw (v4hi, v4hi)
-   v4hi __builtin_ia32_pmulhw (v4hi, v4hi)
-   di __builtin_ia32_pand (di, di)
-   di __builtin_ia32_pandn (di,di)
-   di __builtin_ia32_por (di, di)
-   di __builtin_ia32_pxor (di, di)
-   v8qi __builtin_ia32_pcmpeqb (v8qi, v8qi)
-   v4hi __builtin_ia32_pcmpeqw (v4hi, v4hi)
-   v2si __builtin_ia32_pcmpeqd (v2si, v2si)
-   v8qi __builtin_ia32_pcmpgtb (v8qi, v8qi)
-   v4hi __builtin_ia32_pcmpgtw (v4hi, v4hi)
-   v2si __builtin_ia32_pcmpgtd (v2si, v2si)
-   v8qi __builtin_ia32_punpckhbw (v8qi, v8qi)
-   v4hi __builtin_ia32_punpckhwd (v4hi, v4hi)
-   v2si __builtin_ia32_punpckhdq (v2si, v2si)
-   v8qi __builtin_ia32_punpcklbw (v8qi, v8qi)
-   v4hi __builtin_ia32_punpcklwd (v4hi, v4hi)
-   v2si __builtin_ia32_punpckldq (v2si, v2si)
-   v8qi __builtin_ia32_packsswb (v4hi, v4hi)
-   v4hi __builtin_ia32_packssdw (v2si, v2si)
-   v8qi __builtin_ia32_packuswb (v4hi, v4hi)
-     
-   v4hi __builtin_ia32_psllw (v4hi, v4hi)
-   v2si __builtin_ia32_pslld (v2si, v2si)
-   v1di __builtin_ia32_psllq (v1di, v1di)
-   v4hi __builtin_ia32_psrlw (v4hi, v4hi)
-   v2si __builtin_ia32_psrld (v2si, v2si)
-   v1di __builtin_ia32_psrlq (v1di, v1di)
-   v4hi __builtin_ia32_psraw (v4hi, v4hi)
-   v2si __builtin_ia32_psrad (v2si, v2si)
-   v4hi __builtin_ia32_psllwi (v4hi, int)
-   v2si __builtin_ia32_pslldi (v2si, int)
-   v1di __builtin_ia32_psllqi (v1di, int)
-   v4hi __builtin_ia32_psrlwi (v4hi, int)
-   v2si __builtin_ia32_psrldi (v2si, int)
-   v1di __builtin_ia32_psrlqi (v1di, int)
-   v4hi __builtin_ia32_psrawi (v4hi, int)
-   v2si __builtin_ia32_psradi (v2si, int)
-*/
-#endif
-
-#ifdef __SSE__
-/* SSE
-   v4hi __builtin_ia32_pmulhuw (v4hi, v4hi)
-   v8qi __builtin_ia32_pavgb (v8qi, v8qi)
-   v4hi __builtin_ia32_pavgw (v4hi, v4hi)
-   v1di __builtin_ia32_psadbw (v8qi, v8qi)
-   v8qi __builtin_ia32_pmaxub (v8qi, v8qi)
-   v4hi __builtin_ia32_pmaxsw (v4hi, v4hi)
-   v8qi __builtin_ia32_pminub (v8qi, v8qi)
-   v4hi __builtin_ia32_pminsw (v4hi, v4hi)
-   int __builtin_ia32_pextrw (v4hi, int)
-   v4hi __builtin_ia32_pinsrw (v4hi, int, int)
-   int __builtin_ia32_pmovmskb (v8qi)
-   void __builtin_ia32_maskmovq (v8qi, v8qi, char *)
-   void __builtin_ia32_movntq (di *, di)
-   void __builtin_ia32_sfence (void)
-
-   int __builtin_ia32_comieq (v4sf, v4sf)
-   int __builtin_ia32_comineq (v4sf, v4sf)
-   int __builtin_ia32_comilt (v4sf, v4sf)
-   int __builtin_ia32_comile (v4sf, v4sf)
-   int __builtin_ia32_comigt (v4sf, v4sf)
-   int __builtin_ia32_comige (v4sf, v4sf)
-   int __builtin_ia32_ucomieq (v4sf, v4sf)
-   int __builtin_ia32_ucomineq (v4sf, v4sf)
-   int __builtin_ia32_ucomilt (v4sf, v4sf)
-   int __builtin_ia32_ucomile (v4sf, v4sf)
-   int __builtin_ia32_ucomigt (v4sf, v4sf)
-   int __builtin_ia32_ucomige (v4sf, v4sf)
-   v4sf __builtin_ia32_addps (v4sf, v4sf)
-   v4sf __builtin_ia32_subps (v4sf, v4sf)
-   v4sf __builtin_ia32_mulps (v4sf, v4sf)
-   v4sf __builtin_ia32_divps (v4sf, v4sf)
-   v4sf __builtin_ia32_addss (v4sf, v4sf)
-   v4sf __builtin_ia32_subss (v4sf, v4sf)
-   v4sf __builtin_ia32_mulss (v4sf, v4sf)
-   v4sf __builtin_ia32_divss (v4sf, v4sf)
-   v4si __builtin_ia32_cmpeqps (v4sf, v4sf)
-   v4si __builtin_ia32_cmpltps (v4sf, v4sf)
-   v4si __builtin_ia32_cmpleps (v4sf, v4sf)
-   v4si __builtin_ia32_cmpgtps (v4sf, v4sf)
-   v4si __builtin_ia32_cmpgeps (v4sf, v4sf)
-   v4si __builtin_ia32_cmpunordps (v4sf, v4sf)
-   v4si __builtin_ia32_cmpneqps (v4sf, v4sf)
-   v4si __builtin_ia32_cmpnltps (v4sf, v4sf)
-   v4si __builtin_ia32_cmpnleps (v4sf, v4sf)
-   v4si __builtin_ia32_cmpngtps (v4sf, v4sf)
-   v4si __builtin_ia32_cmpngeps (v4sf, v4sf)
-   v4si __builtin_ia32_cmpordps (v4sf, v4sf)
-   v4si __builtin_ia32_cmpeqss (v4sf, v4sf)
-   v4si __builtin_ia32_cmpltss (v4sf, v4sf)
-   v4si __builtin_ia32_cmpless (v4sf, v4sf)
-   v4si __builtin_ia32_cmpunordss (v4sf, v4sf)
-   v4si __builtin_ia32_cmpneqss (v4sf, v4sf)
-   v4si __builtin_ia32_cmpnlts (v4sf, v4sf)
-   v4si __builtin_ia32_cmpnless (v4sf, v4sf)
-   v4si __builtin_ia32_cmpordss (v4sf, v4sf)
-   v4sf __builtin_ia32_maxps (v4sf, v4sf)
-   v4sf __builtin_ia32_maxss (v4sf, v4sf)
-   v4sf __builtin_ia32_minps (v4sf, v4sf)
-   v4sf __builtin_ia32_minss (v4sf, v4sf)
-   v4sf __builtin_ia32_andps (v4sf, v4sf)
-   v4sf __builtin_ia32_andnps (v4sf, v4sf)
-   v4sf __builtin_ia32_orps (v4sf, v4sf)
-   v4sf __builtin_ia32_xorps (v4sf, v4sf)
-   v4sf __builtin_ia32_movss (v4sf, v4sf)
-   v4sf __builtin_ia32_movhlps (v4sf, v4sf)
-   v4sf __builtin_ia32_movlhps (v4sf, v4sf)
-   v4sf __builtin_ia32_unpckhps (v4sf, v4sf)
-   v4sf __builtin_ia32_unpcklps (v4sf, v4sf)
-   v4sf __builtin_ia32_cvtpi2ps (v4sf, v2si)
-   v4sf __builtin_ia32_cvtsi2ss (v4sf, int)
-   v2si __builtin_ia32_cvtps2pi (v4sf)
-   int __builtin_ia32_cvtss2si (v4sf)
-   v2si __builtin_ia32_cvttps2pi (v4sf)
-   int __builtin_ia32_cvttss2si (v4sf)
-   v4sf __builtin_ia32_rcpps (v4sf)
-   v4sf __builtin_ia32_rsqrtps (v4sf)
-   v4sf __builtin_ia32_sqrtps (v4sf)
-   v4sf __builtin_ia32_rcpss (v4sf)
-   v4sf __builtin_ia32_rsqrtss (v4sf)
-   v4sf __builtin_ia32_sqrtss (v4sf)
-   v4sf __builtin_ia32_shufps (v4sf, v4sf, int)
-*/
-static __inline
-v128_u8_t op_SHUFPS ( v128_u8_t vin1, v128_u8_t vin2, const int mask )
-    __attribute__ ((always_inline));
-
-static __inline
-v128_u8_t op_SHUFPS (v128_u8_t vin1, v128_u8_t vin2, const int mask)
-{
-    return ( v128_u8_t ) __builtin_ia32_shufps ((v128_f_t)vin1, (v128_f_t)vin2, mask);
-}
-
- /*
-   void __builtin_ia32_movntps (float *, v4sf)
-   int __builtin_ia32_movmskps (v4sf)
-
-v4sf __builtin_ia32_loadaps (float *)
-Generates the movaps machine instruction as a load from memory. 
-void __builtin_ia32_storeaps (float *, v4sf)
-Generates the movaps machine instruction as a store to memory. 
-v4sf __builtin_ia32_loadups (float *)
-Generates the movups machine instruction as a load from memory. 
-void __builtin_ia32_storeups (float *, v4sf)
-Generates the movups machine instruction as a store to memory. 
-v4sf __builtin_ia32_loadsss (float *)
-Generates the movss machine instruction as a load from memory. 
-void __builtin_ia32_storess (float *, v4sf)
-Generates the movss machine instruction as a store to memory. 
-v4sf __builtin_ia32_loadhps (v4sf, const v2sf *)
-Generates the movhps machine instruction as a load from memory. 
-v4sf __builtin_ia32_loadlps (v4sf, const v2sf *)
-Generates the movlps machine instruction as a load from memory 
-void __builtin_ia32_storehps (v2sf *, v4sf)
-Generates the movhps machine instruction as a store to memory. 
-void __builtin_ia32_storelps (v2sf *, v4sf)
-Generates the movlps machine instruction as a store to memory.
-*/
-#endif
-
-#ifdef __SSE2__
-/* sse2
-     int __builtin_ia32_comisdeq (v2df, v2df)
-     int __builtin_ia32_comisdlt (v2df, v2df)
-     int __builtin_ia32_comisdle (v2df, v2df)
-     int __builtin_ia32_comisdgt (v2df, v2df)
-     int __builtin_ia32_comisdge (v2df, v2df)
-     int __builtin_ia32_comisdneq (v2df, v2df)
-     int __builtin_ia32_ucomisdeq (v2df, v2df)
-     int __builtin_ia32_ucomisdlt (v2df, v2df)
-     int __builtin_ia32_ucomisdle (v2df, v2df)
-     int __builtin_ia32_ucomisdgt (v2df, v2df)
-     int __builtin_ia32_ucomisdge (v2df, v2df)
-     int __builtin_ia32_ucomisdneq (v2df, v2df)
-     v2df __builtin_ia32_cmpeqpd (v2df, v2df)
-     v2df __builtin_ia32_cmpltpd (v2df, v2df)
-     v2df __builtin_ia32_cmplepd (v2df, v2df)
-     v2df __builtin_ia32_cmpgtpd (v2df, v2df)
-     v2df __builtin_ia32_cmpgepd (v2df, v2df)
-     v2df __builtin_ia32_cmpunordpd (v2df, v2df)
-     v2df __builtin_ia32_cmpneqpd (v2df, v2df)
-     v2df __builtin_ia32_cmpnltpd (v2df, v2df)
-     v2df __builtin_ia32_cmpnlepd (v2df, v2df)
-     v2df __builtin_ia32_cmpngtpd (v2df, v2df)
-     v2df __builtin_ia32_cmpngepd (v2df, v2df)
-     v2df __builtin_ia32_cmpordpd (v2df, v2df)
-     v2df __builtin_ia32_cmpeqsd (v2df, v2df)
-     v2df __builtin_ia32_cmpltsd (v2df, v2df)
-     v2df __builtin_ia32_cmplesd (v2df, v2df)
-     v2df __builtin_ia32_cmpunordsd (v2df, v2df)
-     v2df __builtin_ia32_cmpneqsd (v2df, v2df)
-     v2df __builtin_ia32_cmpnltsd (v2df, v2df)
-     v2df __builtin_ia32_cmpnlesd (v2df, v2df)
-     v2df __builtin_ia32_cmpordsd (v2df, v2df)
-     v2di __builtin_ia32_paddq (v2di, v2di)
-     v2di __builtin_ia32_psubq (v2di, v2di)
-     v2df __builtin_ia32_addpd (v2df, v2df)
-     v2df __builtin_ia32_subpd (v2df, v2df)
-     v2df __builtin_ia32_mulpd (v2df, v2df)
-     v2df __builtin_ia32_divpd (v2df, v2df)
-     v2df __builtin_ia32_addsd (v2df, v2df)
-     v2df __builtin_ia32_subsd (v2df, v2df)
-     v2df __builtin_ia32_mulsd (v2df, v2df)
-     v2df __builtin_ia32_divsd (v2df, v2df)
-     v2df __builtin_ia32_minpd (v2df, v2df)
-     v2df __builtin_ia32_maxpd (v2df, v2df)
-     v2df __builtin_ia32_minsd (v2df, v2df)
-     v2df __builtin_ia32_maxsd (v2df, v2df)
-     v2df __builtin_ia32_andpd (v2df, v2df)
-     v2df __builtin_ia32_andnpd (v2df, v2df)
-     v2df __builtin_ia32_orpd (v2df, v2df)
-     v2df __builtin_ia32_xorpd (v2df, v2df)
-     v2df __builtin_ia32_movsd (v2df, v2df)
-     v2df __builtin_ia32_unpckhpd (v2df, v2df)
-     v2df __builtin_ia32_unpcklpd (v2df, v2df)
-     v16qi __builtin_ia32_paddb128 (v16qi, v16qi)
-     v8hi __builtin_ia32_paddw128 (v8hi, v8hi)
-     v4si __builtin_ia32_paddd128 (v4si, v4si)
-     v2di __builtin_ia32_paddq128 (v2di, v2di)
-     v16qi __builtin_ia32_psubb128 (v16qi, v16qi)
-     v8hi __builtin_ia32_psubw128 (v8hi, v8hi)
-     v4si __builtin_ia32_psubd128 (v4si, v4si)
-     v2di __builtin_ia32_psubq128 (v2di, v2di)
-     v8hi __builtin_ia32_pmullw128 (v8hi, v8hi)
-     v8hi __builtin_ia32_pmulhw128 (v8hi, v8hi)
-     v2di __builtin_ia32_pand128 (v2di, v2di)
-     v2di __builtin_ia32_pandn128 (v2di, v2di)
-     v2di __builtin_ia32_por128 (v2di, v2di)
-     v2di __builtin_ia32_pxor128 (v2di, v2di)
-     v16qi __builtin_ia32_pavgb128 (v16qi, v16qi)
-     v8hi __builtin_ia32_pavgw128 (v8hi, v8hi)
-     v16qi __builtin_ia32_pcmpeqb128 (v16qi, v16qi)
-     v8hi __builtin_ia32_pcmpeqw128 (v8hi, v8hi)
-     v4si __builtin_ia32_pcmpeqd128 (v4si, v4si)
-     v16qi __builtin_ia32_pcmpgtb128 (v16qi, v16qi)
-     v8hi __builtin_ia32_pcmpgtw128 (v8hi, v8hi)
-     v4si __builtin_ia32_pcmpgtd128 (v4si, v4si)
-     v16qi __builtin_ia32_pmaxub128 (v16qi, v16qi)
-     v8hi __builtin_ia32_pmaxsw128 (v8hi, v8hi)
-     v16qi __builtin_ia32_pminub128 (v16qi, v16qi)
-     v8hi __builtin_ia32_pminsw128 (v8hi, v8hi)
-     v16qi __builtin_ia32_punpckhbw128 (v16qi, v16qi)
-     v8hi __builtin_ia32_punpckhwd128 (v8hi, v8hi)
-     v4si __builtin_ia32_punpckhdq128 (v4si, v4si)
-     v2di __builtin_ia32_punpckhqdq128 (v2di, v2di)
-     v16qi __builtin_ia32_punpcklbw128 (v16qi, v16qi)
-     v8hi __builtin_ia32_punpcklwd128 (v8hi, v8hi)
-     v4si __builtin_ia32_punpckldq128 (v4si, v4si)
-     v2di __builtin_ia32_punpcklqdq128 (v2di, v2di)
-     v16qi __builtin_ia32_packsswb128 (v8hi, v8hi)
-     v8hi __builtin_ia32_packssdw128 (v4si, v4si)
-     v16qi __builtin_ia32_packuswb128 (v8hi, v8hi)
-     v8hi __builtin_ia32_pmulhuw128 (v8hi, v8hi)
-     void __builtin_ia32_maskmovdqu (v16qi, v16qi)
-     v2df __builtin_ia32_loadupd (double *)
-     void __builtin_ia32_storeupd (double *, v2df)
-     v2df __builtin_ia32_loadhpd (v2df, double const *)
-     v2df __builtin_ia32_loadlpd (v2df, double const *)
-     int __builtin_ia32_movmskpd (v2df)
-     int __builtin_ia32_pmovmskb128 (v16qi)
-     void __builtin_ia32_movnti (int *, int)
-     void __builtin_ia32_movntpd (double *, v2df)
-     void __builtin_ia32_movntdq (v2df *, v2df)
-     v4si __builtin_ia32_pshufd (v4si, int)
-     v8hi __builtin_ia32_pshuflw (v8hi, int)
-     v8hi __builtin_ia32_pshufhw (v8hi, int)
-     v2di __builtin_ia32_psadbw128 (v16qi, v16qi)
-     v2df __builtin_ia32_sqrtpd (v2df)
-     v2df __builtin_ia32_sqrtsd (v2df)
-     v2df __builtin_ia32_shufpd (v2df, v2df, int)
-*/
-static __inline
-v128_u8_t op_SHUFPD (v128_u8_t vin1, v128_u8_t vin2, const int mask)
-    __attribute__ ((always_inline));
-
-static __inline
-v128_u8_t op_SHUFPD (v128_u8_t vin1, v128_u8_t vin2, const int mask)
-{
-    return ( v128_u8_t ) __builtin_ia32_shufpd ((v128_d_t)vin1, (v128_d_t)vin2, mask);
-}
-
-/*
-     v2df __builtin_ia32_cvtdq2pd (v4si)
-     v4sf __builtin_ia32_cvtdq2ps (v4si)
-     v4si __builtin_ia32_cvtpd2dq (v2df)
-     v2si __builtin_ia32_cvtpd2pi (v2df)
-     v4sf __builtin_ia32_cvtpd2ps (v2df)
-     v4si __builtin_ia32_cvttpd2dq (v2df)
-     v2si __builtin_ia32_cvttpd2pi (v2df)
-     v2df __builtin_ia32_cvtpi2pd (v2si)
-     int __builtin_ia32_cvtsd2si (v2df)
-     int __builtin_ia32_cvttsd2si (v2df)
-     long long __builtin_ia32_cvtsd2si64 (v2df)
-     long long __builtin_ia32_cvttsd2si64 (v2df)
-     v4si __builtin_ia32_cvtps2dq (v4sf)
-     v2df __builtin_ia32_cvtps2pd (v4sf)
-     v4si __builtin_ia32_cvttps2dq (v4sf)
-     v2df __builtin_ia32_cvtsi2sd (v2df, int)
-     v2df __builtin_ia32_cvtsi642sd (v2df, long long)
-     v4sf __builtin_ia32_cvtsd2ss (v4sf, v2df)
-     v2df __builtin_ia32_cvtss2sd (v2df, v4sf)
-     void __builtin_ia32_clflush (const void *)
-     void __builtin_ia32_lfence (void)
-     void __builtin_ia32_mfence (void)
-     v16qi __builtin_ia32_loaddqu (const char *)
-     void __builtin_ia32_storedqu (char *, v16qi)
-     v1di __builtin_ia32_pmuludq (v2si, v2si)
-     v2di __builtin_ia32_pmuludq128 (v4si, v4si)
-     v8hi __builtin_ia32_psllw128 (v8hi, v8hi)
-     v4si __builtin_ia32_pslld128 (v4si, v4si)
-     v2di __builtin_ia32_psllq128 (v2di, v2di)
-     v8hi __builtin_ia32_psrlw128 (v8hi, v8hi)
-     v4si __builtin_ia32_psrld128 (v4si, v4si)
-     v2di __builtin_ia32_psrlq128 (v2di, v2di)
-     v8hi __builtin_ia32_psraw128 (v8hi, v8hi)
-     v4si __builtin_ia32_psrad128 (v4si, v4si)
-     v2di __builtin_ia32_pslldqi128 (v2di, int)
-     v8hi __builtin_ia32_psllwi128 (v8hi, int)
-     v4si __builtin_ia32_pslldi128 (v4si, int)
-*/
-
-static __inline
-v128_u8_t op_PSLLDI128 ( v128_u8_t vin, const int bit_count )
-    __attribute__ ((always_inline));
-
-static __inline
-v128_u8_t op_PSLLDI128 (v128_u8_t vin, const int bit_count)
-{
-    return (v128_u8_t)__builtin_ia32_pslldi128 ((v128_i32_t)vin, bit_count);
-}
-
-/*
-     v2di __builtin_ia32_psllqi128 (v2di, int)
-     v2di __builtin_ia32_psrldqi128 (v2di, int)
-     v8hi __builtin_ia32_psrlwi128 (v8hi, int)
-     v4si __builtin_ia32_psrldi128 (v4si, int)
-*/
-
-static __inline
-v128_u8_t op_PSRLDI128 ( v128_u8_t vin, const int bit_count )
-    __attribute__ ((always_inline));
-
-static __inline
-v128_u8_t op_PSRLDI128 (v128_u8_t vin, const int bit_count)
-{
-    return (v128_u8_t)__builtin_ia32_psrldi128 ((v128_i32_t)vin, bit_count);
-}
-
-/*
-     v2di __builtin_ia32_psrlqi128 (v2di, int)
-     v8hi __builtin_ia32_psrawi128 (v8hi, int)
-     v4si __builtin_ia32_psradi128 (v4si, int)
-     v4si __builtin_ia32_pmaddwd128 (v8hi, v8hi)
-     v2di __builtin_ia32_movq128 (v2di)
-*/
-static __inline__
-v128_u8_t op_PSHUFD128 ( v128_u8_t vin, const int mask )
-    __attribute__ ((always_inline));
-     
-static __inline__
-v128_u8_t op_PSHUFD128 (v128_u8_t vin, const int mask)
-{
-    return (v128_u8_t)__builtin_ia32_pshufd ((v128_i32_t)vin, mask);
-}
-#endif
-
-#ifdef __SSE3__
-/* sse3
-     v2df __builtin_ia32_addsubpd (v2df, v2df)
-     v4sf __builtin_ia32_addsubps (v4sf, v4sf)
-     v2df __builtin_ia32_haddpd (v2df, v2df)
-     v4sf __builtin_ia32_haddps (v4sf, v4sf)
-     v2df __builtin_ia32_hsubpd (v2df, v2df)
-     v4sf __builtin_ia32_hsubps (v4sf, v4sf)
-     v16qi __builtin_ia32_lddqu (char const *)
-     void __builtin_ia32_monitor (void *, unsigned int, unsigned int)
-     v2df __builtin_ia32_movddup (v2df)
-     v4sf __builtin_ia32_movshdup (v4sf)
-     v4sf __builtin_ia32_movsldup (v4sf)
-     void __builtin_ia32_mwait (unsigned int, unsigned int)
-
-v2df __builtin_ia32_loadddup (double const *)
-
-*/
-
-#endif
-
-#ifdef __SSSE3__
-
-/* ssse3
- *
- * The following built-in functions are available when -mssse3 is used. All of
- * them generate the machine instruction that is part of the name with MMX
- * registers.
- *
- * 
-     v2si __builtin_ia32_phaddd (v2si, v2si)
-     v4hi __builtin_ia32_phaddw (v4hi, v4hi)
-     v4hi __builtin_ia32_phaddsw (v4hi, v4hi)
-     v2si __builtin_ia32_phsubd (v2si, v2si)
-     v4hi __builtin_ia32_phsubw (v4hi, v4hi)
-     v4hi __builtin_ia32_phsubsw (v4hi, v4hi)
-     v4hi __builtin_ia32_pmaddubsw (v8qi, v8qi)
-     v4hi __builtin_ia32_pmulhrsw (v4hi, v4hi)
-     v8qi __builtin_ia32_pshufb (v8qi, v8qi)
-     v8qi __builtin_ia32_psignb (v8qi, v8qi)
-     v2si __builtin_ia32_psignd (v2si, v2si)
-     v4hi __builtin_ia32_psignw (v4hi, v4hi)
-     v1di __builtin_ia32_palignr (v1di, v1di, int)
-     v8qi __builtin_ia32_pabsb (v8qi)
-     v2si __builtin_ia32_pabsd (v2si)
-     v4hi __builtin_ia32_pabsw (v4hi)
-The following built-in functions are available when -mssse3 is used.
-All of them generate the machine instruction that is part of the name
-with SSE registers.
-
-     v4si __builtin_ia32_phaddd128 (v4si, v4si)
-     v8hi __builtin_ia32_phaddw128 (v8hi, v8hi)
-     v8hi __builtin_ia32_phaddsw128 (v8hi, v8hi)
-     v4si __builtin_ia32_phsubd128 (v4si, v4si)
-     v8hi __builtin_ia32_phsubw128 (v8hi, v8hi)
-     v8hi __builtin_ia32_phsubsw128 (v8hi, v8hi)
-     v8hi __builtin_ia32_pmaddubsw128 (v16qi, v16qi)
-     v8hi __builtin_ia32_pmulhrsw128 (v8hi, v8hi)
-+    v16qi __builtin_ia32_pshufb128 (v16qi, v16qi)
-     v16qi __builtin_ia32_psignb128 (v16qi, v16qi)
-     v4si __builtin_ia32_psignd128 (v4si, v4si)
-     v8hi __builtin_ia32_psignw128 (v8hi, v8hi)
-     v2di __builtin_ia32_palignr128 (v2di, v2di, int)
-     v16qi __builtin_ia32_pabsb128 (v16qi)
-     v4si __builtin_ia32_pabsd128 (v4si)
-     v8hi __builtin_ia32_pabsw128 (v8hi)
- */
-
-static __inline__
-v128_u8_t op_PSHUFB128 (register v128_u8_t vin, register const v128_u8_t vtab)
-    __attribute__ ((always_inline));
-
-static __inline__
-v128_u8_t op_PSHUFB128 (register v128_u8_t vin, register const v128_u8_t vtab)
-{
-    return (v128_u8_t)__builtin_ia32_pshufb128 ((v128_c_t)vin, (v128_c_t)vtab);
-}
-#endif
-
-#ifdef __SSE4_1__
-/* sse4.1
-The following built-in functions are available when -msse4.1 is used.
-All of them generate the machine instruction that is part of the name.
-
-     v2df __builtin_ia32_blendpd (v2df, v2df, const int)
-     v4sf __builtin_ia32_blendps (v4sf, v4sf, const int)
-     v2df __builtin_ia32_blendvpd (v2df, v2df, v2df)
-     v4sf __builtin_ia32_blendvps (v4sf, v4sf, v4sf)
-     v2df __builtin_ia32_dppd (v2df, v2df, const int)
-     v4sf __builtin_ia32_dpps (v4sf, v4sf, const int)
-     v4sf __builtin_ia32_insertps128 (v4sf, v4sf, const int)
-     v2di __builtin_ia32_movntdqa (v2di *);
-     v16qi __builtin_ia32_mpsadbw128 (v16qi, v16qi, const int)
-     v8hi __builtin_ia32_packusdw128 (v4si, v4si)
-     v16qi __builtin_ia32_pblendvb128 (v16qi, v16qi, v16qi)
-     v8hi __builtin_ia32_pblendw128 (v8hi, v8hi, const int)
-     v2di __builtin_ia32_pcmpeqq (v2di, v2di)
-     v8hi __builtin_ia32_phminposuw128 (v8hi)
-     v16qi __builtin_ia32_pmaxsb128 (v16qi, v16qi)
-     v4si __builtin_ia32_pmaxsd128 (v4si, v4si)
-     v4si __builtin_ia32_pmaxud128 (v4si, v4si)
-     v8hi __builtin_ia32_pmaxuw128 (v8hi, v8hi)
-     v16qi __builtin_ia32_pminsb128 (v16qi, v16qi)
-     v4si __builtin_ia32_pminsd128 (v4si, v4si)
-     v4si __builtin_ia32_pminud128 (v4si, v4si)
-     v8hi __builtin_ia32_pminuw128 (v8hi, v8hi)
-     v4si __builtin_ia32_pmovsxbd128 (v16qi)
-     v2di __builtin_ia32_pmovsxbq128 (v16qi)
-     v8hi __builtin_ia32_pmovsxbw128 (v16qi)
-     v2di __builtin_ia32_pmovsxdq128 (v4si)
-     v4si __builtin_ia32_pmovsxwd128 (v8hi)
-     v2di __builtin_ia32_pmovsxwq128 (v8hi)
-     v4si __builtin_ia32_pmovzxbd128 (v16qi)
-     v2di __builtin_ia32_pmovzxbq128 (v16qi)
-     v8hi __builtin_ia32_pmovzxbw128 (v16qi)
-     v2di __builtin_ia32_pmovzxdq128 (v4si)
-     v4si __builtin_ia32_pmovzxwd128 (v8hi)
-     v2di __builtin_ia32_pmovzxwq128 (v8hi)
-     v2di __builtin_ia32_pmuldq128 (v4si, v4si)
-     v4si __builtin_ia32_pmulld128 (v4si, v4si)
-     int __builtin_ia32_ptestc128 (v2di, v2di)
-     int __builtin_ia32_ptestnzc128 (v2di, v2di)
-     int __builtin_ia32_ptestz128 (v2di, v2di)
-     v2df __builtin_ia32_roundpd (v2df, const int)
-     v4sf __builtin_ia32_roundps (v4sf, const int)
-     v2df __builtin_ia32_roundsd (v2df, v2df, const int)
-     v4sf __builtin_ia32_roundss (v4sf, v4sf, const int)
-The following built-in functions are available when -msse4.1 is used.
-
-v4sf __builtin_ia32_vec_set_v4sf (v4sf, float, const int)
-Generates the insertps machine instruction. 
-int __builtin_ia32_vec_ext_v16qi (v16qi, const int)
-Generates the pextrb machine instruction. 
-v16qi __builtin_ia32_vec_set_v16qi (v16qi, int, const int)
-Generates the pinsrb machine instruction. 
-v4si __builtin_ia32_vec_set_v4si (v4si, int, const int)
-Generates the pinsrd machine instruction. 
-*/
-static __inline__
-v128_u8_t op_PINSRUD (register v128_u8_t vin, uint32_t ii, const int off)
-    __attribute__ ((always_inline));
-static __inline__
-v128_u8_t op_PINSRUD (register v128_u8_t vin, uint32_t ii, const int off)
-{
-    return (v128_u8_t)__builtin_ia32_vec_set_v4si ((v128_i32_t)vin, ii, off);
-}
-/*
-v2di __builtin_ia32_vec_set_v2di (v2di, long long, const int)
-Generates the pinsrq machine instruction in 64bit mode.
-The following built-in functions are changed to generate new SSE4.1 instructions when -msse4.1 is used.
-
-float __builtin_ia32_vec_ext_v4sf (v4sf, const int)
-Generates the extractps machine instruction. 
-int __builtin_ia32_vec_ext_v4si (v4si, const int)
-Generates the pextrd machine instruction. 
-long long __builtin_ia32_vec_ext_v2di (v2di, const int)
-Generates the pextrq machine instruction in 64bit mode.
- */
-
-#endif
-
-#ifdef __SSE4_2__
-
-/* sse4.2
-The following built-in functions are available when -msse4.2 is used.
-All of them generate the machine instruction that is part of the name.
-
-     v16qi __builtin_ia32_pcmpestrm128 (v16qi, int, v16qi, int, const int)
-     int __builtin_ia32_pcmpestri128 (v16qi, int, v16qi, int, const int)
-     int __builtin_ia32_pcmpestria128 (v16qi, int, v16qi, int, const int)
-     int __builtin_ia32_pcmpestric128 (v16qi, int, v16qi, int, const int)
-     int __builtin_ia32_pcmpestrio128 (v16qi, int, v16qi, int, const int)
-     int __builtin_ia32_pcmpestris128 (v16qi, int, v16qi, int, const int)
-     int __builtin_ia32_pcmpestriz128 (v16qi, int, v16qi, int, const int)
-     v16qi __builtin_ia32_pcmpistrm128 (v16qi, v16qi, const int)
-     int __builtin_ia32_pcmpistri128 (v16qi, v16qi, const int)
-     int __builtin_ia32_pcmpistria128 (v16qi, v16qi, const int)
-     int __builtin_ia32_pcmpistric128 (v16qi, v16qi, const int)
-     int __builtin_ia32_pcmpistrio128 (v16qi, v16qi, const int)
-     int __builtin_ia32_pcmpistris128 (v16qi, v16qi, const int)
-     int __builtin_ia32_pcmpistriz128 (v16qi, v16qi, const int)
-     v2di __builtin_ia32_pcmpgtq (v2di, v2di)
-The following built-in functions are available when -msse4.2 is used.
-
-unsigned int __builtin_ia32_crc32qi (unsigned int, unsigned char)
-Generates the crc32b machine instruction. 
-unsigned int __builtin_ia32_crc32hi (unsigned int, unsigned short)
-Generates the crc32w machine instruction. 
-unsigned int __builtin_ia32_crc32si (unsigned int, unsigned int)
-Generates the crc32l machine instruction. 
-unsigned long long __builtin_ia32_crc32di (unsigned long long, unsigned long long)
-Generates the crc32q machine instruction.
-The following built-in functions are changed to generate new SSE4.2 instructions when -msse4.2 is used.
-
-int __builtin_popcount (unsigned int)
-Generates the popcntl machine instruction. 
-int __builtin_popcountl (unsigned long)
-Generates the popcntl or popcntq machine instruction, depending on the size of unsigned long. 
-int __builtin_popcountll (unsigned long long)
-Generates the popcntq machine instruction.
-
-*/
-
-#endif
-
-/* avx
-The following built-in functions are available when -mavx is used.
-All of them generate the machine instruction that is part of the name.
-
-     v4df __builtin_ia32_addpd256 (v4df,v4df)
-     v8sf __builtin_ia32_addps256 (v8sf,v8sf)
-     v4df __builtin_ia32_addsubpd256 (v4df,v4df)
-     v8sf __builtin_ia32_addsubps256 (v8sf,v8sf)
-     v4df __builtin_ia32_andnpd256 (v4df,v4df)
-     v8sf __builtin_ia32_andnps256 (v8sf,v8sf)
-     v4df __builtin_ia32_andpd256 (v4df,v4df)
-     v8sf __builtin_ia32_andps256 (v8sf,v8sf)
-     v4df __builtin_ia32_blendpd256 (v4df,v4df,int)
-     v8sf __builtin_ia32_blendps256 (v8sf,v8sf,int)
-     v4df __builtin_ia32_blendvpd256 (v4df,v4df,v4df)
-     v8sf __builtin_ia32_blendvps256 (v8sf,v8sf,v8sf)
-     v2df __builtin_ia32_cmppd (v2df,v2df,int)
-     v4df __builtin_ia32_cmppd256 (v4df,v4df,int)
-     v4sf __builtin_ia32_cmpps (v4sf,v4sf,int)
-     v8sf __builtin_ia32_cmpps256 (v8sf,v8sf,int)
-     v2df __builtin_ia32_cmpsd (v2df,v2df,int)
-     v4sf __builtin_ia32_cmpss (v4sf,v4sf,int)
-     v4df __builtin_ia32_cvtdq2pd256 (v4si)
-     v8sf __builtin_ia32_cvtdq2ps256 (v8si)
-     v4si __builtin_ia32_cvtpd2dq256 (v4df)
-     v4sf __builtin_ia32_cvtpd2ps256 (v4df)
-     v8si __builtin_ia32_cvtps2dq256 (v8sf)
-     v4df __builtin_ia32_cvtps2pd256 (v4sf)
-     v4si __builtin_ia32_cvttpd2dq256 (v4df)
-     v8si __builtin_ia32_cvttps2dq256 (v8sf)
-     v4df __builtin_ia32_divpd256 (v4df,v4df)
-     v8sf __builtin_ia32_divps256 (v8sf,v8sf)
-     v8sf __builtin_ia32_dpps256 (v8sf,v8sf,int)
-     v4df __builtin_ia32_haddpd256 (v4df,v4df)
-     v8sf __builtin_ia32_haddps256 (v8sf,v8sf)
-     v4df __builtin_ia32_hsubpd256 (v4df,v4df)
-     v8sf __builtin_ia32_hsubps256 (v8sf,v8sf)
-     v32qi __builtin_ia32_lddqu256 (pcchar)
-     v32qi __builtin_ia32_loaddqu256 (pcchar)
-     v4df __builtin_ia32_loadupd256 (pcdouble)
-     v8sf __builtin_ia32_loadups256 (pcfloat)
-     v2df __builtin_ia32_maskloadpd (pcv2df,v2df)
-     v4df __builtin_ia32_maskloadpd256 (pcv4df,v4df)
-     v4sf __builtin_ia32_maskloadps (pcv4sf,v4sf)
-     v8sf __builtin_ia32_maskloadps256 (pcv8sf,v8sf)
-     void __builtin_ia32_maskstorepd (pv2df,v2df,v2df)
-     void __builtin_ia32_maskstorepd256 (pv4df,v4df,v4df)
-     void __builtin_ia32_maskstoreps (pv4sf,v4sf,v4sf)
-     void __builtin_ia32_maskstoreps256 (pv8sf,v8sf,v8sf)
-     v4df __builtin_ia32_maxpd256 (v4df,v4df)
-     v8sf __builtin_ia32_maxps256 (v8sf,v8sf)
-     v4df __builtin_ia32_minpd256 (v4df,v4df)
-     v8sf __builtin_ia32_minps256 (v8sf,v8sf)
-     v4df __builtin_ia32_movddup256 (v4df)
-     int __builtin_ia32_movmskpd256 (v4df)
-     int __builtin_ia32_movmskps256 (v8sf)
-     v8sf __builtin_ia32_movshdup256 (v8sf)
-     v8sf __builtin_ia32_movsldup256 (v8sf)
-     v4df __builtin_ia32_mulpd256 (v4df,v4df)
-     v8sf __builtin_ia32_mulps256 (v8sf,v8sf)
-     v4df __builtin_ia32_orpd256 (v4df,v4df)
-     v8sf __builtin_ia32_orps256 (v8sf,v8sf)
-     v2df __builtin_ia32_pd_pd256 (v4df)
-     v4df __builtin_ia32_pd256_pd (v2df)
-     v4sf __builtin_ia32_ps_ps256 (v8sf)
-     v8sf __builtin_ia32_ps256_ps (v4sf)
-     int __builtin_ia32_ptestc256 (v4di,v4di,ptest)
-     int __builtin_ia32_ptestnzc256 (v4di,v4di,ptest)
-     int __builtin_ia32_ptestz256 (v4di,v4di,ptest)
-     v8sf __builtin_ia32_rcpps256 (v8sf)
-     v4df __builtin_ia32_roundpd256 (v4df,int)
-     v8sf __builtin_ia32_roundps256 (v8sf,int)
-     v8sf __builtin_ia32_rsqrtps_nr256 (v8sf)
-     v8sf __builtin_ia32_rsqrtps256 (v8sf)
-     v4df __builtin_ia32_shufpd256 (v4df,v4df,int)
-     v8sf __builtin_ia32_shufps256 (v8sf,v8sf,int)
-     v4si __builtin_ia32_si_si256 (v8si)
-     v8si __builtin_ia32_si256_si (v4si)
-     v4df __builtin_ia32_sqrtpd256 (v4df)
-     v8sf __builtin_ia32_sqrtps_nr256 (v8sf)
-     v8sf __builtin_ia32_sqrtps256 (v8sf)
-     void __builtin_ia32_storedqu256 (pchar,v32qi)
-     void __builtin_ia32_storeupd256 (pdouble,v4df)
-     void __builtin_ia32_storeups256 (pfloat,v8sf)
-     v4df __builtin_ia32_subpd256 (v4df,v4df)
-     v8sf __builtin_ia32_subps256 (v8sf,v8sf)
-     v4df __builtin_ia32_unpckhpd256 (v4df,v4df)
-     v8sf __builtin_ia32_unpckhps256 (v8sf,v8sf)
-     v4df __builtin_ia32_unpcklpd256 (v4df,v4df)
-     v8sf __builtin_ia32_unpcklps256 (v8sf,v8sf)
-     v4df __builtin_ia32_vbroadcastf128_pd256 (pcv2df)
-     v8sf __builtin_ia32_vbroadcastf128_ps256 (pcv4sf)
-     v4df __builtin_ia32_vbroadcastsd256 (pcdouble)
-     v4sf __builtin_ia32_vbroadcastss (pcfloat)
-     v8sf __builtin_ia32_vbroadcastss256 (pcfloat)
-     v2df __builtin_ia32_vextractf128_pd256 (v4df,int)
-     v4sf __builtin_ia32_vextractf128_ps256 (v8sf,int)
-     v4si __builtin_ia32_vextractf128_si256 (v8si,int)
-     v4df __builtin_ia32_vinsertf128_pd256 (v4df,v2df,int)
-     v8sf __builtin_ia32_vinsertf128_ps256 (v8sf,v4sf,int)
-     v8si __builtin_ia32_vinsertf128_si256 (v8si,v4si,int)
-     v4df __builtin_ia32_vperm2f128_pd256 (v4df,v4df,int)
-     v8sf __builtin_ia32_vperm2f128_ps256 (v8sf,v8sf,int)
-     v8si __builtin_ia32_vperm2f128_si256 (v8si,v8si,int)
-     v2df __builtin_ia32_vpermil2pd (v2df,v2df,v2di,int)
-     v4df __builtin_ia32_vpermil2pd256 (v4df,v4df,v4di,int)
-     v4sf __builtin_ia32_vpermil2ps (v4sf,v4sf,v4si,int)
-     v8sf __builtin_ia32_vpermil2ps256 (v8sf,v8sf,v8si,int)
-     v2df __builtin_ia32_vpermilpd (v2df,int)
-     v4df __builtin_ia32_vpermilpd256 (v4df,int)
-     v4sf __builtin_ia32_vpermilps (v4sf,int)
-     v8sf __builtin_ia32_vpermilps256 (v8sf,int)
-     v2df __builtin_ia32_vpermilvarpd (v2df,v2di)
-     v4df __builtin_ia32_vpermilvarpd256 (v4df,v4di)
-     v4sf __builtin_ia32_vpermilvarps (v4sf,v4si)
-     v8sf __builtin_ia32_vpermilvarps256 (v8sf,v8si)
-     int __builtin_ia32_vtestcpd (v2df,v2df,ptest)
-     int __builtin_ia32_vtestcpd256 (v4df,v4df,ptest)
-     int __builtin_ia32_vtestcps (v4sf,v4sf,ptest)
-     int __builtin_ia32_vtestcps256 (v8sf,v8sf,ptest)
-     int __builtin_ia32_vtestnzcpd (v2df,v2df,ptest)
-     int __builtin_ia32_vtestnzcpd256 (v4df,v4df,ptest)
-     int __builtin_ia32_vtestnzcps (v4sf,v4sf,ptest)
-     int __builtin_ia32_vtestnzcps256 (v8sf,v8sf,ptest)
-     int __builtin_ia32_vtestzpd (v2df,v2df,ptest)
-     int __builtin_ia32_vtestzpd256 (v4df,v4df,ptest)
-     int __builtin_ia32_vtestzps (v4sf,v4sf,ptest)
-     int __builtin_ia32_vtestzps256 (v8sf,v8sf,ptest)
-     void __builtin_ia32_vzeroall (void)
-     void __builtin_ia32_vzeroupper (void)
-     v4df __builtin_ia32_xorpd256 (v4df,v4df)
-     v8sf __builtin_ia32_xorps256 (v8sf,v8sf)
-
-
-
-*/
-
-#ifdef __AES__
-/*
- * AES-NI instruction set
- * includes PCMUL
- */
-
-/* AES-NI aes
- */
-
-   
-/* v2di __builtin_ia32_aesenc128 (v2di, v2di) */
-static __inline__
-v128_u8_t op_AESENC (register v128_u8_t state, register const v128_u8_t round_key)
-{
-    return (v128_u8_t)__builtin_ia32_aesenc128 ((v128_lli_t)state,
-                                               (v128_lli_t)round_key);
-}
-
-
-/* v2di __builtin_ia32_aesenclast128 (v2di, v2di) */
-static __inline__
-v128_u8_t op_AESENCLAST (register v128_u8_t state,
-                        register const v128_u8_t round_key)
-{
-    return (v128_u8_t)__builtin_ia32_aesenclast128 ((v128_lli_t)state,
-                                                   (v128_lli_t)round_key);
-}
-
-
-/* v2di __builtin_ia32_aesdec128 (v2di, v2di) */
-static __inline__
-v128_u8_t op_AESDEC (register v128_u8_t state, register const v128_u8_t round_key)
-{
-    return (v128_u8_t)__builtin_ia32_aesdec128 ((v128_lli_t)state,
-                                               (v128_lli_t)round_key);
-}
-
-
-/* v2di __builtin_ia32_aesdeclast128 (v2di, v2di) */
-static __inline__
-v128_u8_t op_AESDECLAST (register v128_u8_t state,
-                        register const v128_u8_t round_key)
-{
-    return (v128_u8_t)__builtin_ia32_aesdeclast128 ((v128_lli_t)state,
-                                                   (v128_lli_t)round_key);
-}
-
-
-/* v2di __builtin_ia32_aeskeygenassist128 (v2di, const int) */
-static __inline__
-v128_u8_t op_AESKEYGENASSIST (register const v128_u8_t round_key,
-                             const int rcon ) __attribute__ ((always_inline));
-static __inline__
-v128_u8_t op_AESKEYGENASSIST (register const v128_u8_t round_key,
-                             const int rcon )
-{
-    return (v128_u8_t)__builtin_ia32_aeskeygenassist128 ((v128_lli_t)round_key,
-                                                         rcon);
-}
-
-
-/* v2di __builtin_ia32_aesimc128 (v2di) */
-static __inline__
-v128_u8_t op_AESIMC (register const v128_u8_t round_key)
-{
-    return (v128_u8_t)__builtin_ia32_aesimc128 ((v128_lli_t)round_key);
-}
-
-/* pclmul
-v2di __builtin_ia32_pclmulqdq128 (v2di, v2di, const int)
-*/
-#endif
-
-#ifdef __SSE5__
-/* sse5
-     v2df __builtin_ia32_comeqpd (v2df, v2df)
-     v2df __builtin_ia32_comeqps (v2df, v2df)
-     v4sf __builtin_ia32_comeqsd (v4sf, v4sf)
-     v4sf __builtin_ia32_comeqss (v4sf, v4sf)
-     v2df __builtin_ia32_comfalsepd (v2df, v2df)
-     v2df __builtin_ia32_comfalseps (v2df, v2df)
-     v4sf __builtin_ia32_comfalsesd (v4sf, v4sf)
-     v4sf __builtin_ia32_comfalsess (v4sf, v4sf)
-     v2df __builtin_ia32_comgepd (v2df, v2df)
-     v2df __builtin_ia32_comgeps (v2df, v2df)
-     v4sf __builtin_ia32_comgesd (v4sf, v4sf)
-     v4sf __builtin_ia32_comgess (v4sf, v4sf)
-     v2df __builtin_ia32_comgtpd (v2df, v2df)
-     v2df __builtin_ia32_comgtps (v2df, v2df)
-     v4sf __builtin_ia32_comgtsd (v4sf, v4sf)
-     v4sf __builtin_ia32_comgtss (v4sf, v4sf)
-     v2df __builtin_ia32_comlepd (v2df, v2df)
-     v2df __builtin_ia32_comleps (v2df, v2df)
-     v4sf __builtin_ia32_comlesd (v4sf, v4sf)
-     v4sf __builtin_ia32_comless (v4sf, v4sf)
-     v2df __builtin_ia32_comltpd (v2df, v2df)
-     v2df __builtin_ia32_comltps (v2df, v2df)
-     v4sf __builtin_ia32_comltsd (v4sf, v4sf)
-     v4sf __builtin_ia32_comltss (v4sf, v4sf)
-     v2df __builtin_ia32_comnepd (v2df, v2df)
-     v2df __builtin_ia32_comneps (v2df, v2df)
-     v4sf __builtin_ia32_comnesd (v4sf, v4sf)
-     v4sf __builtin_ia32_comness (v4sf, v4sf)
-     v2df __builtin_ia32_comordpd (v2df, v2df)
-     v2df __builtin_ia32_comordps (v2df, v2df)
-     v4sf __builtin_ia32_comordsd (v4sf, v4sf)
-     v4sf __builtin_ia32_comordss (v4sf, v4sf)
-     v2df __builtin_ia32_comtruepd (v2df, v2df)
-     v2df __builtin_ia32_comtrueps (v2df, v2df)
-     v4sf __builtin_ia32_comtruesd (v4sf, v4sf)
-     v4sf __builtin_ia32_comtruess (v4sf, v4sf)
-     v2df __builtin_ia32_comueqpd (v2df, v2df)
-     v2df __builtin_ia32_comueqps (v2df, v2df)
-     v4sf __builtin_ia32_comueqsd (v4sf, v4sf)
-     v4sf __builtin_ia32_comueqss (v4sf, v4sf)
-     v2df __builtin_ia32_comugepd (v2df, v2df)
-     v2df __builtin_ia32_comugeps (v2df, v2df)
-     v4sf __builtin_ia32_comugesd (v4sf, v4sf)
-     v4sf __builtin_ia32_comugess (v4sf, v4sf)
-     v2df __builtin_ia32_comugtpd (v2df, v2df)
-     v2df __builtin_ia32_comugtps (v2df, v2df)
-     v4sf __builtin_ia32_comugtsd (v4sf, v4sf)
-     v4sf __builtin_ia32_comugtss (v4sf, v4sf)
-     v2df __builtin_ia32_comulepd (v2df, v2df)
-     v2df __builtin_ia32_comuleps (v2df, v2df)
-     v4sf __builtin_ia32_comulesd (v4sf, v4sf)
-     v4sf __builtin_ia32_comuless (v4sf, v4sf)
-     v2df __builtin_ia32_comultpd (v2df, v2df)
-     v2df __builtin_ia32_comultps (v2df, v2df)
-     v4sf __builtin_ia32_comultsd (v4sf, v4sf)
-     v4sf __builtin_ia32_comultss (v4sf, v4sf)
-     v2df __builtin_ia32_comunepd (v2df, v2df)
-     v2df __builtin_ia32_comuneps (v2df, v2df)
-     v4sf __builtin_ia32_comunesd (v4sf, v4sf)
-     v4sf __builtin_ia32_comuness (v4sf, v4sf)
-     v2df __builtin_ia32_comunordpd (v2df, v2df)
-     v2df __builtin_ia32_comunordps (v2df, v2df)
-     v4sf __builtin_ia32_comunordsd (v4sf, v4sf)
-     v4sf __builtin_ia32_comunordss (v4sf, v4sf)
-     v2df __builtin_ia32_fmaddpd (v2df, v2df, v2df)
-     v4sf __builtin_ia32_fmaddps (v4sf, v4sf, v4sf)
-     v2df __builtin_ia32_fmaddsd (v2df, v2df, v2df)
-     v4sf __builtin_ia32_fmaddss (v4sf, v4sf, v4sf)
-     v2df __builtin_ia32_fmsubpd (v2df, v2df, v2df)
-     v4sf __builtin_ia32_fmsubps (v4sf, v4sf, v4sf)
-     v2df __builtin_ia32_fmsubsd (v2df, v2df, v2df)
-     v4sf __builtin_ia32_fmsubss (v4sf, v4sf, v4sf)
-     v2df __builtin_ia32_fnmaddpd (v2df, v2df, v2df)
-     v4sf __builtin_ia32_fnmaddps (v4sf, v4sf, v4sf)
-     v2df __builtin_ia32_fnmaddsd (v2df, v2df, v2df)
-     v4sf __builtin_ia32_fnmaddss (v4sf, v4sf, v4sf)
-     v2df __builtin_ia32_fnmsubpd (v2df, v2df, v2df)
-     v4sf __builtin_ia32_fnmsubps (v4sf, v4sf, v4sf)
-     v2df __builtin_ia32_fnmsubsd (v2df, v2df, v2df)
-     v4sf __builtin_ia32_fnmsubss (v4sf, v4sf, v4sf)
-     v2df __builtin_ia32_frczpd (v2df)
-     v4sf __builtin_ia32_frczps (v4sf)
-     v2df __builtin_ia32_frczsd (v2df, v2df)
-     v4sf __builtin_ia32_frczss (v4sf, v4sf)
-     v2di __builtin_ia32_pcmov (v2di, v2di, v2di)
-     v2di __builtin_ia32_pcmov_v2di (v2di, v2di, v2di)
-     v4si __builtin_ia32_pcmov_v4si (v4si, v4si, v4si)
-     v8hi __builtin_ia32_pcmov_v8hi (v8hi, v8hi, v8hi)
-     v16qi __builtin_ia32_pcmov_v16qi (v16qi, v16qi, v16qi)
-     v2df __builtin_ia32_pcmov_v2df (v2df, v2df, v2df)
-     v4sf __builtin_ia32_pcmov_v4sf (v4sf, v4sf, v4sf)
-     v16qi __builtin_ia32_pcomeqb (v16qi, v16qi)
-     v8hi __builtin_ia32_pcomeqw (v8hi, v8hi)
-     v4si __builtin_ia32_pcomeqd (v4si, v4si)
-     v2di __builtin_ia32_pcomeqq (v2di, v2di)
-     v16qi __builtin_ia32_pcomequb (v16qi, v16qi)
-     v4si __builtin_ia32_pcomequd (v4si, v4si)
-     v2di __builtin_ia32_pcomequq (v2di, v2di)
-     v8hi __builtin_ia32_pcomequw (v8hi, v8hi)
-     v8hi __builtin_ia32_pcomeqw (v8hi, v8hi)
-     v16qi __builtin_ia32_pcomfalseb (v16qi, v16qi)
-     v4si __builtin_ia32_pcomfalsed (v4si, v4si)
-     v2di __builtin_ia32_pcomfalseq (v2di, v2di)
-     v16qi __builtin_ia32_pcomfalseub (v16qi, v16qi)
-     v4si __builtin_ia32_pcomfalseud (v4si, v4si)
-     v2di __builtin_ia32_pcomfalseuq (v2di, v2di)
-     v8hi __builtin_ia32_pcomfalseuw (v8hi, v8hi)
-     v8hi __builtin_ia32_pcomfalsew (v8hi, v8hi)
-     v16qi __builtin_ia32_pcomgeb (v16qi, v16qi)
-     v4si __builtin_ia32_pcomged (v4si, v4si)
-     v2di __builtin_ia32_pcomgeq (v2di, v2di)
-     v16qi __builtin_ia32_pcomgeub (v16qi, v16qi)
-     v4si __builtin_ia32_pcomgeud (v4si, v4si)
-     v2di __builtin_ia32_pcomgeuq (v2di, v2di)
-     v8hi __builtin_ia32_pcomgeuw (v8hi, v8hi)
-     v8hi __builtin_ia32_pcomgew (v8hi, v8hi)
-     v16qi __builtin_ia32_pcomgtb (v16qi, v16qi)
-     v4si __builtin_ia32_pcomgtd (v4si, v4si)
-     v2di __builtin_ia32_pcomgtq (v2di, v2di)
-     v16qi __builtin_ia32_pcomgtub (v16qi, v16qi)
-     v4si __builtin_ia32_pcomgtud (v4si, v4si)
-     v2di __builtin_ia32_pcomgtuq (v2di, v2di)
-     v8hi __builtin_ia32_pcomgtuw (v8hi, v8hi)
-     v8hi __builtin_ia32_pcomgtw (v8hi, v8hi)
-     v16qi __builtin_ia32_pcomleb (v16qi, v16qi)
-     v4si __builtin_ia32_pcomled (v4si, v4si)
-     v2di __builtin_ia32_pcomleq (v2di, v2di)
-     v16qi __builtin_ia32_pcomleub (v16qi, v16qi)
-     v4si __builtin_ia32_pcomleud (v4si, v4si)
-     v2di __builtin_ia32_pcomleuq (v2di, v2di)
-     v8hi __builtin_ia32_pcomleuw (v8hi, v8hi)
-     v8hi __builtin_ia32_pcomlew (v8hi, v8hi)
-     v16qi __builtin_ia32_pcomltb (v16qi, v16qi)
-     v4si __builtin_ia32_pcomltd (v4si, v4si)
-     v2di __builtin_ia32_pcomltq (v2di, v2di)
-     v16qi __builtin_ia32_pcomltub (v16qi, v16qi)
-     v4si __builtin_ia32_pcomltud (v4si, v4si)
-     v2di __builtin_ia32_pcomltuq (v2di, v2di)
-     v8hi __builtin_ia32_pcomltuw (v8hi, v8hi)
-     v8hi __builtin_ia32_pcomltw (v8hi, v8hi)
-     v16qi __builtin_ia32_pcomneb (v16qi, v16qi)
-     v4si __builtin_ia32_pcomned (v4si, v4si)
-     v2di __builtin_ia32_pcomneq (v2di, v2di)
-     v16qi __builtin_ia32_pcomneub (v16qi, v16qi)
-     v4si __builtin_ia32_pcomneud (v4si, v4si)
-     v2di __builtin_ia32_pcomneuq (v2di, v2di)
-     v8hi __builtin_ia32_pcomneuw (v8hi, v8hi)
-     v8hi __builtin_ia32_pcomnew (v8hi, v8hi)
-     v16qi __builtin_ia32_pcomtrueb (v16qi, v16qi)
-     v4si __builtin_ia32_pcomtrued (v4si, v4si)
-     v2di __builtin_ia32_pcomtrueq (v2di, v2di)
-     v16qi __builtin_ia32_pcomtrueub (v16qi, v16qi)
-     v4si __builtin_ia32_pcomtrueud (v4si, v4si)
-     v2di __builtin_ia32_pcomtrueuq (v2di, v2di)
-     v8hi __builtin_ia32_pcomtrueuw (v8hi, v8hi)
-     v8hi __builtin_ia32_pcomtruew (v8hi, v8hi)
-     v4df __builtin_ia32_permpd (v2df, v2df, v16qi)
-     v4sf __builtin_ia32_permps (v4sf, v4sf, v16qi)
-     v4si __builtin_ia32_phaddbd (v16qi)
-     v2di __builtin_ia32_phaddbq (v16qi)
-     v8hi __builtin_ia32_phaddbw (v16qi)
-     v2di __builtin_ia32_phadddq (v4si)
-     v4si __builtin_ia32_phaddubd (v16qi)
-     v2di __builtin_ia32_phaddubq (v16qi)
-     v8hi __builtin_ia32_phaddubw (v16qi)
-     v2di __builtin_ia32_phaddudq (v4si)
-     v4si __builtin_ia32_phadduwd (v8hi)
-     v2di __builtin_ia32_phadduwq (v8hi)
-     v4si __builtin_ia32_phaddwd (v8hi)
-     v2di __builtin_ia32_phaddwq (v8hi)
-     v8hi __builtin_ia32_phsubbw (v16qi)
-     v2di __builtin_ia32_phsubdq (v4si)
-     v4si __builtin_ia32_phsubwd (v8hi)
-     v4si __builtin_ia32_pmacsdd (v4si, v4si, v4si)
-     v2di __builtin_ia32_pmacsdqh (v4si, v4si, v2di)
-     v2di __builtin_ia32_pmacsdql (v4si, v4si, v2di)
-     v4si __builtin_ia32_pmacssdd (v4si, v4si, v4si)
-     v2di __builtin_ia32_pmacssdqh (v4si, v4si, v2di)
-     v2di __builtin_ia32_pmacssdql (v4si, v4si, v2di)
-     v4si __builtin_ia32_pmacsswd (v8hi, v8hi, v4si)
-     v8hi __builtin_ia32_pmacssww (v8hi, v8hi, v8hi)
-     v4si __builtin_ia32_pmacswd (v8hi, v8hi, v4si)
-     v8hi __builtin_ia32_pmacsww (v8hi, v8hi, v8hi)
-     v4si __builtin_ia32_pmadcsswd (v8hi, v8hi, v4si)
-     v4si __builtin_ia32_pmadcswd (v8hi, v8hi, v4si)
-     v16qi __builtin_ia32_pperm (v16qi, v16qi, v16qi)
-     v16qi __builtin_ia32_protb (v16qi, v16qi)
-     v4si __builtin_ia32_protd (v4si, v4si)
-     v2di __builtin_ia32_protq (v2di, v2di)
-     v8hi __builtin_ia32_protw (v8hi, v8hi)
-     v16qi __builtin_ia32_pshab (v16qi, v16qi)
-     v4si __builtin_ia32_pshad (v4si, v4si)
-     v2di __builtin_ia32_pshaq (v2di, v2di)
-     v8hi __builtin_ia32_pshaw (v8hi, v8hi)
-     v16qi __builtin_ia32_pshlb (v16qi, v16qi)
-     v4si __builtin_ia32_pshld (v4si, v4si)
-     v2di __builtin_ia32_pshlq (v2di, v2di)
-     v8hi __builtin_ia32_pshlw (v8hi, v8hi)
-The following builtin-in functions are available when -msse5 is used.
-The second argument must be an integer constant and generate the machine
-instruction that is part of the name with the `_imm' suffix removed.
-
-     v16qi __builtin_ia32_protb_imm (v16qi, int)
-     v4si __builtin_ia32_protd_imm (v4si, int)
-     v2di __builtin_ia32_protq_imm (v2di, int)
-     v8hi __builtin_ia32_protw_imm (v8hi, int)
-
-
-*/
-#endif
-
-#endif /* if USE_VECREG */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_v128_ */
diff --git a/interfaces/cc/gcc/va_copy.h b/interfaces/cc/gcc/va_copy.h
deleted file mode 100644
index 34fb64f..0000000
--- a/interfaces/cc/gcc/va_copy.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_va_copy_
-#define _h_va_copy_
-
-/* GCC may internally undef 'va_copy' upon include of stdarg.h
-   force it to be included before defining va_copy */
-#include <stdarg.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* kludge - GCC stdarg has this line:
-   #if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 199900L
-   fix build for c99 */
-#if ! defined va_copy && defined __va_copy
-#define va_copy __va_copy
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_va_copy_ */
diff --git a/interfaces/cc/gcc/x86_64/arch-impl.h b/interfaces/cc/gcc/x86_64/arch-impl.h
deleted file mode 100644
index 1773d72..0000000
--- a/interfaces/cc/gcc/x86_64/arch-impl.h
+++ /dev/null
@@ -1,361 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_arch_impl_
-#define _h_arch_impl_
-
-#include <stdint.h>
-
-/* Intel versions from 11.0 through 13.0 mangle certain shift
- * statements in inline assembly. */
-#if defined(__INTEL_COMPILER)  &&  __INTEL_COMPILER_BUILD_DATE >= 20090131 \
-    &&  __INTEL_COMPILER_BUILD_DATE < 20130607 
-#  define HAVE_ICC_SHIFT_BUG 1 
-#endif
-
-#ifndef USE_GCC_BUILTIN
-#define USE_GCC_BUILTIN 1
-#endif
-
-#if USE_GCC_BUILTIN
-#include <strings.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-static __inline__
-int16_t uint16_lsbit ( uint16_t self )
-{
-    int16_t rtn;
-#if USE_GCC_BUILTIN
-    rtn = ( int16_t ) __builtin_ffs ( self ) - 1;
-#else
-    __asm__ __volatile__
-    (
-        "bsf %%ax, %%ax;"
-        "jnz .+6;"
-        "xor %%eax, %%eax;"
-        "dec %%eax;"
-        : "=a" ( rtn )
-        : "a" ( self )
-    );
-#endif
-    return rtn;
-}
-
-static __inline__
-int32_t uint32_lsbit ( uint32_t self )
-{
-    int32_t rtn;
-#if USE_GCC_BUILTIN
-    rtn = __builtin_ffs ( self ) - 1;
-#else
-    __asm__ __volatile__
-    (
-        "bsf %%eax, %%eax;"
-        "jnz .+6;"
-        "xor %%eax, %%eax;"
-        "dec %%eax;"
-        : "=a" ( rtn )
-        : "a" ( self )
-    );
-#endif
-    return rtn;
-}
-
-typedef struct int128_t int128_t;
-struct int128_t
-{
-    uint64_t lo;
-    int64_t hi;
-};
-
-static __inline__
-int64_t int128_hi ( const int128_t *self )
-{
-    return self -> hi;
-}
-
-static __inline__
-uint64_t int128_lo ( const int128_t *self )
-{
-    return self -> lo;
-}
-
-static __inline__
-void int128_sethi ( int128_t *self, int64_t i )
-{
-    self -> hi = i;
-}
-
-static __inline__
-void int128_setlo ( int128_t *self, uint64_t i )
-{
-    self -> lo = i;
-}
-
-typedef struct uint128_t uint128_t;
-struct uint128_t
-{
-    uint64_t lo;
-    uint64_t hi;
-};
-
-static __inline__
-uint64_t uint128_hi ( const uint128_t *self )
-{
-    return self -> hi;
-}
-
-static __inline__
-uint64_t uint128_lo ( const uint128_t *self )
-{
-    return self -> lo;
-}
-
-static __inline__
-void uint128_sethi ( uint128_t *self, uint64_t i )
-{
-    self -> hi = i;
-}
-
-static __inline__
-void uint128_setlo ( uint128_t *self, uint64_t i )
-{
-    self -> lo = i;
-}
-
-static __inline__
-void int128_add ( int128_t *self, const int128_t *i )
-{
-    __asm__ __volatile__
-    (
-        "mov (%%rsi), %%rax;"
-        "mov 8(%%rsi), %%rcx;"
-        "add %%rax, (%%rdi);"
-        "adc %%rcx, 8(%%rdi);"
-        :
-        : "D" ( self ), "S" ( i )
-        : "%rax", "%rcx"
-    );
-}
-
-static __inline__
-void int128_sub ( int128_t *self, const int128_t *i )
-{
-    __asm__ __volatile__
-    (
-        "mov (%%rsi), %%rax;"
-        "mov 8(%%rsi), %%rcx;"
-        "sub %%rax, (%%rdi);"
-        "sbb %%rcx, 8(%%rdi);"
-        :
-        : "D" ( self ), "S" ( i )
-        : "%rax", "%rcx"
-    );
-}
-
-static __inline__
-void int128_sar ( int128_t *self, uint32_t i )
-{
-    __asm__ __volatile__
-    (
-        "mov %%esi, %%ecx;"
-        "mov 8(%%rdi), %%rax;"
-        "shrd %%cl, %%rax, (%%rdi);"
-        "sar %%cl, %%rax;"
-        "mov %%rax, 8(%%rdi);"
-        :
-        : "D" ( self ), "S" ( i )
-        :  "%rax", "%rcx"
-    );
-}
-
-static __inline__
-void int128_shl ( int128_t *self, uint32_t i )
-{
-    __asm__ __volatile__
-    (
-        "mov %%esi, %%ecx;"
-        "mov (%%rdi), %%rax;"
-        "shld %%cl, %%rax, 8(%%rdi);"
-        "shl %%cl, %%rax;"
-        "mov %%rax, (%%rdi);"
-        :
-        : "D" ( self ), "S" ( i )
-        : "%rax", "%rcx"
-    );
-}
-
-static __inline__
-void uint128_and ( uint128_t *self, const uint128_t *i )
-{
-    __asm__ __volatile__
-    (
-        "mov (%%rsi), %%rax;"
-        "mov 8(%%rsi), %%rcx;"
-        "and %%rax, (%%rdi);"
-        "and %%rcx, 8(%%rdi);"
-        :
-        : "D" ( self ), "S" ( i )
-        :"%rax", "%rcx"
-    );
-}
-
-static __inline__
-void uint128_or ( uint128_t *self, const uint128_t *i )
-{
-    __asm__ __volatile__
-    (
-        "mov (%%rsi), %%rax;"
-        "mov 8(%%rsi), %%rcx;"
-        "or %%rax, (%%rdi);"
-        "or %%rcx, 8(%%rdi);"
-        :
-        : "D" ( self ), "S" ( i )
-        :"%rax", "%rcx"
-    );
-}
-
-static __inline__
-void uint128_orlo ( uint128_t *self, uint64_t i )
-{
-    self -> lo |= i;
-}
-
-static __inline__
-void uint128_xor ( uint128_t *self, const uint128_t *i )
-{
-    __asm__ __volatile__
-    (
-        "mov (%%rsi), %%rax;"
-        "mov 8(%%rsi), %%rcx;"
-        "xor %%rax, (%%rdi);"
-        "xor %%rcx, 8(%%rdi);"
-        :
-        : "D" ( self ), "S" ( i )
-        :"%rax", "%rcx"
-    );
-}
-
-static __inline__
-void uint128_not ( uint128_t *self )
-{
-    __asm__ __volatile__
-    (
-        "mov (%%rdi), %%rax;"
-        "mov 8(%%rdi), %%rcx;"
-        "not %%rax;"
-        "not %%rcx;"
-        "mov %%rax, (%%rdi);"
-        "mov %%rcx, 8(%%rdi);"
-        :
-        : "D" ( self )
-        : "%rax", "%rcx"
-    );
-}
-
-static __inline__
-void uint128_shr ( uint128_t *self, uint32_t i )
-{
-#ifdef HAVE_ICC_SHIFT_BUG
-    if (i > 0) {
-        self->lo >>= i;
-        self->lo  |= self->hi << (64 - i);
-        self->hi >>= i;
-    }
-#else
-    __asm__ __volatile__
-    (
-        "mov %%esi, %%ecx;"
-        "mov 8(%%rdi), %%rax;"
-        "shrd %%cl, %%rax, (%%rdi);"
-        "shr %%cl, %%rax;"
-        "mov %%rax, 8(%%rdi);"
-        :
-        : "D" ( self ), "S" ( i )
-        : "%rax", "%rcx"
-    );
-#endif
-}
-
-static __inline__
-void uint128_shl ( uint128_t *self, uint32_t i )
-{
-    __asm__ __volatile__
-    (
-        "mov %%esi, %%ecx;"
-        "mov (%%rdi), %%rax;"
-        "shld %%cl, %%rax, 8(%%rdi);"
-        "shl %%cl, %%rax;"
-        "mov %%rax, (%%rdi);"
-        :
-        : "D" ( self ), "S" ( i )
-        : "%rax", "%rcx"
-    );
-}
-
-static __inline__
-void uint128_bswap ( uint128_t *self )
-{
-    __asm__ __volatile__
-    (
-        "mov (%%rdi), %%rax;"
-        "mov 8(%%rdi), %%rcx;"
-        "bswap %%rax;"
-        "bswap %%rcx;"
-        "mov %%rax, 8(%%rdi);"
-        "mov %%rcx, (%%rdi);"
-        :
-        : "D" ( self )
-        : "%rax", "%rcx"
-    );
-}
-
-static __inline__
-void uint128_bswap_copy ( uint128_t *to, const uint128_t *from )
-{
-    __asm__ __volatile__
-    (
-        "mov (%%rsi), %%rax;"
-        "mov 8(%%rsi), %%rcx;"
-        "bswap %%rax;"
-        "bswap %%rcx;"
-        "mov %%rax, 8(%%rdi);"
-        "mov %%rcx, (%%rdi);"
-        :
-        : "D" ( to ), "S" ( from )
-        : "%rax", "%rcx"
-    );
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_arch_impl_ */
diff --git a/interfaces/cc/gcc/x86_64/atomic.h b/interfaces/cc/gcc/x86_64/atomic.h
deleted file mode 100644
index 83b81e4..0000000
--- a/interfaces/cc/gcc/x86_64/atomic.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_atomic_
-#define _h_atomic_
-
-#ifndef _h_atomic32_
-#include "atomic32.h"
-#endif
-
-#ifndef _h_atomic64_
-#include "atomic64.h"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if DFLT_ATOMIC_BITS == 32
-#define ATOMIC_NAME( suffix ) \
-    atomic32_ ## suffix
-typedef int atomic_int;
-#else
-#define ATOMIC_NAME( suffix ) \
-    atomic64_ ## suffix
-typedef long int atomic_int;
-#endif
-
-typedef struct ATOMIC_NAME ( t ) atomic_t;
-
-/* ( * v ) */
-#define atomic_read( v ) \
-    ATOMIC_NAME ( read ) ( v )
-
-/* ( * v ) = i */
-#define atomic_set( v, i ) \
-    ATOMIC_NAME ( set ) ( v, i )
-
-/* prior = ( * v ), ( * v ) += i, prior */
-#define atomic_read_and_add( v, i ) \
-    ATOMIC_NAME ( read_and_add ) ( v, i )
-
-/* ( * v ) += i */
-#define atomic_add( v, i ) \
-    ATOMIC_NAME ( add ) ( v, i )
-
-/* ( * v ) += i */
-#define atomic_add_and_read( v, i ) \
-    ATOMIC_NAME ( add_and_read ) ( v, i )
-
-/* ( void ) ++ ( * v ) */
-#define atomic_inc( v ) \
-    ATOMIC_NAME ( inc ) ( v )
-
-/* ( void ) -- ( * v ) */
-#define atomic_dec( v ) \
-    ATOMIC_NAME ( dec ) ( v )
-
-/* -- ( * v ) == 0 */
-#define atomic_dec_and_test( v ) \
-    ATOMIC_NAME ( dec_and_test ) ( v )
-
-/* ++ ( * v ) == 0
-   when atomic_dec_and_test uses predecrement, you want
-   postincrement to this function. so it isn't very useful */
-#define atomic_inc_and_test( v ) \
-    ATOMIC_NAME ( inc_and_test ) ( v )
-
-/* ( * v ) -- == 0
-   HERE's useful */
-#define atomic_test_and_inc( v ) \
-    ATOMIC_NAME ( test_and_inc ) ( v )
-
-/* prior = ( * v ), ( * v ) = ( prior == t ? s : prior ), prior */
-#define atomic_test_and_set( v, s, t ) \
-    ATOMIC_NAME ( test_and_set ) ( v, s, t )
-
-/* N.B. - THIS FUNCTION IS FOR 64 BIT PTRS ONLY */
-static __inline__ void *atomic_test_and_set_ptr ( void *volatile *v, void *s, void *t )
-{
-    void *rtn;
-    __asm__ __volatile__
-    (
-        "lock;"
-        "cmpxchg %%rsi,(%%rdi)"
-        : "=a" ( rtn )
-        : "D" ( v ), "S" ( s ), "a" ( t )
-    );
-    return rtn;
-}
-
-/* val = ( * v ), ( ( * v ) = ( val < t ) ? val + i : val ), val */
-#define atomic_read_and_add_lt( v, i, t ) \
-    ATOMIC_NAME ( read_and_add_lt ) ( v, i, t )
-
-/* val = ( * v ), ( ( * v ) = ( val <= t ) ? val + i : val ), val */
-#define atomic_read_and_add_le( v, i, t ) \
-    ATOMIC_NAME ( read_and_add_le ) ( v, i, t )
-
-/* val = ( * v ), ( ( * v ) = ( val == t ) ? val + i : val ), val */
-#define atomic_read_and_add_eq( v, i, t ) \
-    ATOMIC_NAME ( read_and_add_eq ) ( v, i, t )
-
-/* val = ( * v ), ( ( * v ) = ( val != t ) ? val + i : val ), val */
-#define atomic_read_and_add_ne( v, i, t ) \
-    ATOMIC_NAME ( read_and_add_ne ) ( v, i, t )
-
-/* val = ( * v ), ( ( * v ) = ( val >= t ) ? val + i : val ), val */
-#define atomic_read_and_add_ge( v, i, t ) \
-    ATOMIC_NAME ( read_and_add_ge ) ( v, i, t )
-
-/* val = ( * v ), ( ( * v ) = ( val > t ) ? val + i : val ), val */
-#define atomic_read_and_add_gt( v, i, t ) \
-    ATOMIC_NAME ( read_and_add_gt ) ( v, i, t )
-
-/* val = ( * v ), ( ( * v ) = ( ( val & 1 ) == 1 ) ? val + i : val ), val */
-#define atomic_read_and_add_odd( v, i ) \
-    ATOMIC_NAME ( read_and_add_odd ) ( v, i )
-
-/* val = ( * v ), ( ( * v ) = ( ( val & 1 ) == 0 ) ? val + i : val ), val */
-#define atomic_read_and_add_even( v, i ) \
-    ATOMIC_NAME ( read_and_add_even ) ( v, i )
-
-/* DEPRECATED */
-
-/* val = ( * v ), ( * v ) = ( val < t ? val + i : val ), ( val < t ? 1 : 0 ) */
-#define atomic_add_if_lt( v, i, t ) \
-    ATOMIC_NAME ( add_if_lt ) ( v, i, t )
-
-/* val = ( * v ), ( * v ) = ( val <= t ? val + i : val ), ( val <= t ? 1 : 0 ) */
-#define atomic_add_if_le( v, i, t ) \
-    ATOMIC_NAME ( add_if_le ) ( v, i, t )
-
-/* val = ( * v ), ( * v ) = ( val == t ? val + i : val ), ( val == t ? 1 : 0 ) */
-#define atomic_add_if_eq( v, i, t ) \
-    ATOMIC_NAME ( add_if_eq ) ( v, i, t )
-
-/* val = ( * v ), ( * v ) = ( val >= t ? val + i : val ), ( val >= t ? 1 : 0 ) */
-#define atomic_add_if_ge( v, i, t ) \
-    ATOMIC_NAME ( add_if_ge ) ( v, i, t )
-
-/* val = ( * v ), ( * v ) = ( val > t ? val + i : val ), ( val > t ? 1 : 0 ) */
-#define atomic_add_if_gt( v, i, t ) \
-    ATOMIC_NAME ( add_if_gt ) ( v, i, t )
-
-#undef LOCK
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_atomic_ */
diff --git a/interfaces/cc/gcc/x86_64/atomic32.h b/interfaces/cc/gcc/x86_64/atomic32.h
deleted file mode 100644
index f6b739f..0000000
--- a/interfaces/cc/gcc/x86_64/atomic32.h
+++ /dev/null
@@ -1,358 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_atomic32_
-#define _h_atomic32_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Make sure gcc doesn't try to be clever and move things around
- * on us. We need to use _exactly_ the address the user gave us,
- * not some alias that contains the same information.
- */
-typedef struct atomic32_t atomic32_t;
-struct atomic32_t
-{
-    volatile int counter;
-};
-
-/* int atomic32_read ( const atomic32_t *v ); */
-#define atomic32_read( v ) \
-    ( ( v ) -> counter )
-
-/* void atomic32_set ( atomic32_t *v, int i ); */
-#define atomic32_set( v, i ) \
-    ( ( void ) ( ( ( v ) -> counter ) = ( i ) ) )
-
-/* add to v -> counter and return the prior value */
-static __inline__ int atomic32_read_and_add ( atomic32_t *v, int i )
-{
-    int rtn;
-    __asm__ __volatile__
-    (
-        "mov (%%rdi), %%eax;"
-        "mov %%esi, %%ecx;"
-        "add %%eax, %%ecx;"
-        "lock;"
-        "cmpxchg %%ecx, (%%rdi);"
-        "jne .-8"
-        : "=a" ( rtn )
-        : "D" ( v ), "S" ( i )
-        : "%ecx"
-    );
-    return rtn;
-}
-
-/* if no read is needed, define the least expensive atomic add */
-#define atomic32_add( v, i ) \
-    atomic32_read_and_add ( v, i )
-
-/* add to v -> counter and return the result */
-static __inline__ int atomic32_add_and_read ( atomic32_t *v, int i )
-{
-    int rtn;
-    __asm__ __volatile__
-    (
-        "mov (%%rdi), %%eax;"
-        "mov %%esi, %%ecx;"
-        "add %%eax, %%ecx;"
-        "lock;"
-        "cmpxchg %%ecx,(%%rdi);"
-        "jne .-8;"
-        "mov %%ecx, %%eax"
-        : "=a" ( rtn )
-        : "D" ( v ), "S" ( i )
-        : "%ecx"
-    );
-    return rtn;
-}
-
-/* just don't try to find out what the result was */
-static __inline__ void atomic32_inc ( atomic32_t *v )
-{
-    __asm__ __volatile__
-    (
-        "lock;"
-        "incl %0"
-        : "=m" ( v -> counter )
-        : "m" ( v -> counter )
-    );
-}
-
-static __inline__ void atomic32_dec ( atomic32_t *v )
-{
-    __asm__ __volatile__
-    (
-        "lock;"
-        "decl %0"
-        : "=m" ( v -> counter )
-        : "m" ( v -> counter )
-    );
-}
-
-/* decrement by one and test result for 0 */
-static __inline__ int atomic32_dec_and_test ( atomic32_t *v )
-{
-    unsigned char c;
-    __asm__ __volatile__
-    (
-        "lock;"
-        "decl %2;"
-        "sete %%al"
-        : "=a" ( c ), "=m" ( v -> counter )
-        : "m" ( v -> counter )
-    );
-    return c;
-}
-
-/* when atomic32_dec_and_test uses predecrement, you want
-   postincrement to this function. so it isn't very useful */
-static __inline__ int atomic32_inc_and_test ( atomic32_t *v )
-{
-    unsigned char c;
-    __asm__ __volatile__
-    (
-        "lock;"
-        "incl %2;"
-        "sete %%al"
-        : "=a" ( c ), "=m" ( v -> counter )
-        : "m" ( v -> counter )
-    );
-    return c;
-}
-
-/* HERE's useful */
-#define atomic32_test_and_inc( v ) \
-    ( atomic32_read_and_add ( v, 1 ) == 0 )
-
-static __inline__ int atomic32_test_and_set ( atomic32_t *v, int s, int t )
-{
-    int rtn;
-    __asm__ __volatile__
-    (
-        "lock;"
-        "cmpxchg %%esi,(%%rdi)"
-        : "=a" ( rtn )
-        : "D" ( v ), "S" ( s ), "a" ( t )
-    );
-    return rtn;
-}
-
-/* conditional modifications */
-static __inline__
-int atomic32_read_and_add_lt ( atomic32_t *v, int i, int t )
-{
-    int rtn;
-    __asm__ __volatile__
-    (
-        "mov (%%rdi), %%eax;"
-        "cmp %%edx, %%eax;"
-        "mov %%esi, %%ecx;"
-        "jge .+10;"
-        "add %%eax, %%ecx;"
-        "lock;"
-        "cmpxchg %%ecx, (%%rdi);"
-        "jne .-12"
-        : "=a" ( rtn )
-        : "D" ( v ), "S" ( i ), "d" ( t )
-        : "%ecx"
-    );
-    return rtn;
-}
-
-#define atomic32_add_if_lt( v, i, t ) \
-    ( atomic32_read_and_add_lt ( v, i, t ) < ( t ) )
-
-static __inline__
-int atomic32_read_and_add_le ( atomic32_t *v, int i, int t )
-{
-    int rtn;
-    __asm__ __volatile__
-    (
-        "mov (%%rdi), %%eax;"
-        "cmp %%edx, %%eax;"
-        "mov %%esi, %%ecx;"
-        "jg .+10;"
-        "add %%eax, %%ecx;"
-        "lock;"
-        "cmpxchg %%ecx, (%%rdi);"
-        "jne .-12"
-        : "=a" ( rtn )
-        : "D" ( v ), "S" ( i ), "d" ( t )
-        : "%ecx"
-    );
-    return rtn;
-}
-
-#define atomic32_add_if_le( v, i, t ) \
-    ( atomic32_read_and_add_le ( v, i, t ) <= ( t ) )
-
-static __inline__
-int atomic32_read_and_add_eq ( atomic32_t *v, int i, int t )
-{
-    int rtn;
-    __asm__ __volatile__
-    (
-        "mov (%%rdi), %%eax;"
-        "cmp %%edx, %%eax;"
-        "mov %%esi, %%ecx;"
-        "jne .+10;"
-        "add %%eax, %%ecx;"
-        "lock;"
-        "cmpxchg %%ecx, (%%rdi);"
-        "jne .-12"
-        : "=a" ( rtn )
-        : "D" ( v ), "S" ( i ), "d" ( t )
-        : "%ecx"
-    );
-    return rtn;
-}
-
-#define atomic32_add_if_eq( v, i, t ) \
-    ( atomic32_read_and_add_eq ( v, i, t ) == ( t ) )
-
-static __inline__
-int atomic32_read_and_add_ne ( atomic32_t *v, int i, int t )
-{
-    int rtn;
-    __asm__ __volatile__
-    (
-        "mov (%%rdi), %%eax;"
-        "cmp %%edx, %%eax;"
-        "mov %%esi, %%ecx;"
-        "je .+10;"
-        "add %%eax, %%ecx;"
-        "lock;"
-        "cmpxchg %%ecx, (%%rdi);"
-        "jne .-12"
-        : "=a" ( rtn )
-        : "D" ( v ), "S" ( i ), "d" ( t )
-        : "%ecx"
-    );
-    return rtn;
-}
-
-#define atomic32_add_if_ne( v, i, t ) \
-    ( atomic32_read_and_add_ne ( v, i, t ) != ( t ) )
-
-static __inline__
-int atomic32_read_and_add_ge ( atomic32_t *v, int i, int t )
-{
-    int rtn;
-    __asm__ __volatile__
-    (
-        "mov (%%rdi), %%eax;"
-        "cmp %%edx, %%eax;"
-        "mov %%esi, %%ecx;"
-        "jl .+10;"
-        "add %%eax, %%ecx;"
-        "lock;"
-        "cmpxchg %%ecx, (%%rdi);"
-        "jne .-12"
-        : "=a" ( rtn )
-        : "D" ( v ), "S" ( i ), "d" ( t )
-        : "%ecx"
-    );
-    return rtn;
-}
-
-#define atomic32_add_if_ge( v, i, t ) \
-    ( atomic32_read_and_add_ge ( v, i, t ) >= ( t ) )
-
-static __inline__
-int atomic32_read_and_add_gt ( atomic32_t *v, int i, int t )
-{
-    int rtn;
-    __asm__ __volatile__
-    (
-        "mov (%%rdi), %%eax;"
-        "cmp %%edx, %%eax;"
-        "mov %%esi, %%ecx;"
-        "jle .+10;"
-        "add %%eax, %%ecx;"
-        "lock;"
-        "cmpxchg %%ecx, (%%rdi);"
-        "jne .-12"
-        : "=a" ( rtn )
-        : "D" ( v ), "S" ( i ), "d" ( t )
-        : "%ecx"
-    );
-    return rtn;
-}
-
-#define atomic32_add_if_gt( v, i, t ) \
-    ( atomic32_read_and_add_gt ( v, i, t ) > ( t ) )
-
-static __inline__
-int atomic32_read_and_add_odd ( atomic32_t *v, int i )
-{
-    int rtn;
-    __asm__ __volatile__
-    (
-        "mov (%%rdi), %%eax;"
-        "bt $0, %%ax;"
-        "mov %%esi, %%ecx;"
-        "jnc .+10;"
-        "add %%eax, %%ecx;"
-        "lock;"
-        "cmpxchg %%ecx, (%%rdi);"
-        "jne .-15"
-        : "=a" ( rtn )
-        : "D" ( v ), "S" ( i )
-        : "%ecx"
-    );
-    return rtn;
-}
-
-static __inline__
-int atomic32_read_and_add_even ( atomic32_t *v, int i )
-{
-    int rtn;
-    __asm__ __volatile__
-    (
-        "mov (%%rdi), %%eax;"
-        "bt $0, %%ax;"
-        "mov %%esi, %%ecx;"
-        "jc .+10;"
-        "add %%eax, %%ecx;"
-        "lock;"
-        "cmpxchg %%ecx, (%%rdi);"
-        "jne .-15"
-        : "=a" ( rtn )
-        : "D" ( v ), "S" ( i )
-        : "%ecx"
-    );
-    return rtn;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_atomic32_ */
diff --git a/interfaces/cc/gcc/x86_64/atomic64.h b/interfaces/cc/gcc/x86_64/atomic64.h
deleted file mode 100644
index bd7f7da..0000000
--- a/interfaces/cc/gcc/x86_64/atomic64.h
+++ /dev/null
@@ -1,358 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_atomic64_
-#define _h_atomic64_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Make sure gcc doesn't try to be clever and move things around
- * on us. We need to use _exactly_ the address the user gave us,
- * not some alias that contains the same information.
- */
-typedef struct atomic64_t atomic64_t;
-struct atomic64_t
-{
-    volatile long int counter;
-};
-
-/* int atomic64_read ( const atomic64_t *v ); */
-#define atomic64_read( v ) \
-    ( ( v ) -> counter )
-
-/* void atomic64_set ( atomic64_t *v, long int i ); */
-#define atomic64_set( v, i ) \
-    ( ( void ) ( ( ( v ) -> counter ) = ( i ) ) )
-
-/* add to v -> counter and return the prior value */
-static __inline__ long int atomic64_read_and_add ( atomic64_t *v, long int i )
-{
-    long int rtn;
-    __asm__ __volatile__
-    (
-        "mov (%%rdi), %%rax;"
-        "mov %%rsi, %%rcx;"
-        "add %%rax, %%rcx;"
-        "lock;"
-        "cmpxchg %%rcx, (%%rdi);"
-        "jne .-11"
-        : "=a" ( rtn )
-        : "D" ( v ), "S" ( i )
-        : "%rcx"
-    );
-    return rtn;
-}
-
-/* if no read is needed, define the least expensive atomic add */
-#define atomic64_add( v, i ) \
-    atomic64_read_and_add ( v, i )
-
-/* add to v -> counter and return the result */
-static __inline__ long int atomic64_add_and_read ( atomic64_t *v, long int i )
-{
-    long int rtn;
-    __asm__ __volatile__
-    (
-        "mov (%%rdi), %%rax;"
-        "mov %%rsi, %%rcx;"
-        "add %%rax, %%rcx;"
-        "lock;"
-        "cmpxchg %%rcx, (%%rdi);"
-        "jne .-11;"
-        "mov %%rcx, %%rax"
-        : "=a" ( rtn )
-        : "D" ( v ), "S" ( i )
-        : "%rcx"
-    );
-    return rtn;
-}
-
-/* just don't try to find out what the result was */
-static __inline__ void atomic64_inc ( atomic64_t *v )
-{
-    __asm__ __volatile__
-    (
-        "lock;"
-        "incq %0"
-        : "=m" ( v -> counter )
-        : "m" ( v -> counter )
-    );
-}
-
-static __inline__ void atomic64_dec ( atomic64_t *v )
-{
-    __asm__ __volatile__
-    (
-        "lock;"
-        "decq %0"
-        : "=m" ( v -> counter )
-        : "m" ( v -> counter )
-    );
-}
-
-/* decrement by one and test result for 0 */
-static __inline__ int atomic64_dec_and_test ( atomic64_t *v )
-{
-    unsigned char c;
-    __asm__ __volatile__
-    (
-        "lock;"
-        "decq %2;"
-        "sete %%al"
-        : "=a" ( c ), "=m" ( v -> counter )
-        : "m" ( v -> counter )
-    );
-    return c;
-}
-
-/* when atomic64_dec_and_test uses predecrement, you want
-   postincrement to this function. so it isn't very useful */
-static __inline__ int atomic64_inc_and_test ( atomic64_t *v )
-{
-    unsigned char c;
-    __asm__ __volatile__
-    (
-        "lock;"
-        "incq %2;"
-        "sete %%al"
-        : "=a" ( c ), "=m" ( v -> counter )
-        : "m" ( v -> counter )
-    );
-    return c;
-}
-
-/* HERE's useful */
-#define atomic64_test_and_inc( v ) \
-    ( atomic64_read_and_add ( v, 1L ) == 0 )
-
-static __inline__ long int atomic64_test_and_set ( atomic64_t *v, long int s, long int t )
-{
-    long int rtn;
-    __asm__ __volatile__
-    (
-        "lock;"
-        "cmpxchg %%rsi,(%%rdi)"
-        : "=a" ( rtn )
-        : "D" ( v ), "S" ( s ), "a" ( t )
-    );
-    return rtn;
-}
-
-/* conditional modifications */
-static __inline__
-long int atomic64_read_and_add_lt ( atomic64_t *v, long int i, long int t )
-{
-    long int rtn;
-    __asm__ __volatile__
-    (
-        "mov (%%rdi), %%rax;"
-        "cmp %%rdx, %%rax;"
-        "mov %%rsi, %%rcx;"
-        "jge .+12;"
-        "add %%rax, %%rcx;"
-        "lock;"
-        "cmpxchg %%rcx, (%%rdi);"
-        "jne .-16"
-        : "=a" ( rtn )
-        : "D" ( v ), "S" ( i ), "d" ( t )
-        : "%rcx"
-    );
-    return rtn;
-}
-
-#define atomic64_add_if_lt( v, i, t ) \
-    ( atomic64_read_and_add_lt ( v, i, t ) < ( t ) )
-
-static __inline__
-long int atomic64_read_and_add_le ( atomic64_t *v, long int i, long int t )
-{
-    long int rtn;
-    __asm__ __volatile__
-    (
-        "mov (%%rdi), %%rax;"
-        "cmp %%rdx, %%rax;"
-        "mov %%rsi, %%rcx;"
-        "jg .+12;"
-        "add %%rax, %%rcx;"
-        "lock;"
-        "cmpxchg %%rcx, (%%rdi);"
-        "jne .-16"
-        : "=a" ( rtn )
-        : "D" ( v ), "S" ( i ), "d" ( t )
-        : "%rcx"
-    );
-    return rtn;
-}
-
-#define atomic64_add_if_le( v, i, t ) \
-    ( atomic64_read_and_add_le ( v, i, t ) <= ( t ) )
-
-static __inline__
-long int atomic64_read_and_add_eq ( atomic64_t *v, long int i, long int t )
-{
-    long int rtn;
-    __asm__ __volatile__
-    (
-        "mov (%%rdi), %%rax;"
-        "cmp %%rdx, %%rax;"
-        "mov %%rsi, %%rcx;"
-        "jne .+12;"
-        "add %%rax, %%rcx;"
-        "lock;"
-        "cmpxchg %%rcx, (%%rdi);"
-        "jne .-16"
-        : "=a" ( rtn )
-        : "D" ( v ), "S" ( i ), "d" ( t )
-        : "%rcx"
-    );
-    return rtn;
-}
-
-#define atomic64_add_if_eq( v, i, t ) \
-    ( atomic64_read_and_add_eq ( v, i, t ) == ( t ) )
-
-static __inline__
-long int atomic64_read_and_add_ne ( atomic64_t *v, long int i, long int t )
-{
-    long int rtn;
-    __asm__ __volatile__
-    (
-        "mov (%%rdi), %%rax;"
-        "cmp %%rdx, %%rax;"
-        "mov %%rsi, %%rcx;"
-        "je .+12;"
-        "add %%rax, %%rcx;"
-        "lock;"
-        "cmpxchg %%rcx, (%%rdi);"
-        "jne .-16"
-        : "=a" ( rtn )
-        : "D" ( v ), "S" ( i ), "d" ( t )
-        : "%rcx"
-    );
-    return rtn;
-}
-
-#define atomic64_add_if_ne( v, i, t ) \
-    ( atomic64_read_and_add_ne ( v, i, t ) != ( t ) )
-
-static __inline__
-long int atomic64_read_and_add_ge ( atomic64_t *v, long int i, long int t )
-{
-    long int rtn;
-    __asm__ __volatile__
-    (
-        "mov (%%rdi), %%rax;"
-        "cmp %%rdx, %%rax;"
-        "mov %%rsi, %%rcx;"
-        "jl .+12;"
-        "add %%rax, %%rcx;"
-        "lock;"
-        "cmpxchg %%rcx, (%%rdi);"
-        "jne .-16"
-        : "=a" ( rtn )
-        : "D" ( v ), "S" ( i ), "d" ( t )
-        : "%rcx"
-    );
-    return rtn;
-}
-
-#define atomic64_add_if_ge( v, i, t ) \
-    ( atomic64_read_and_add_ge ( v, i, t ) >= ( t ) )
-
-static __inline__
-long int atomic64_read_and_add_gt ( atomic64_t *v, long int i, long int t )
-{
-    long int rtn;
-    __asm__ __volatile__
-    (
-        "mov (%%rdi), %%rax;"
-        "cmp %%rdx, %%rax;"
-        "mov %%rsi, %%rcx;"
-        "jle .+12;"
-        "add %%rax, %%rcx;"
-        "lock;"
-        "cmpxchg %%rcx, (%%rdi);"
-        "jne .-16"
-        : "=a" ( rtn )
-        : "D" ( v ), "S" ( i ), "d" ( t )
-        : "%rcx"
-    );
-    return rtn;
-}
-
-#define atomic64_add_if_gt( v, i, t ) \
-    ( atomic64_read_and_add_gt ( v, i, t ) > ( t ) )
-
-static __inline__
-long int atomic64_read_and_add_odd ( atomic64_t *v, long int i )
-{
-    long int rtn;
-    __asm__ __volatile__
-    (
-        "mov (%%rdi), %%rax;"
-        "bt $0, %%ax;"
-        "mov %%rsi, %%rcx;"
-        "jnc .+12;"
-        "add %%rax, %%rcx;"
-        "lock;"
-        "cmpxchg %%rcx, (%%rdi);"
-        "jne .-18"
-        : "=a" ( rtn )
-        : "D" ( v ), "S" ( i )
-        : "%rcx"
-    );
-    return rtn;
-}
-
-static __inline__
-long int atomic64_read_and_add_even ( atomic64_t *v, long int i )
-{
-    long int rtn;
-    __asm__ __volatile__
-    (
-        "mov (%%rdi), %%rax;"
-        "bt $0, %%ax;"
-        "mov %%rsi, %%rcx;"
-        "jc .+12;"
-        "add %%rax, %%rcx;"
-        "lock;"
-        "cmpxchg %%rcx, (%%rdi);"
-        "jne .-18"
-        : "=a" ( rtn )
-        : "D" ( v ), "S" ( i )
-        : "%rcx"
-    );
-    return rtn;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_atomic64_ */
diff --git a/interfaces/cc/gcc/x86_64/bitstr.h b/interfaces/cc/gcc/x86_64/bitstr.h
deleted file mode 100644
index b52f525..0000000
--- a/interfaces/cc/gcc/x86_64/bitstr.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_bitstr_
-#define _h_bitstr_
-
-/* use 64-bit accumulator, 32-bit word size */
-#define WRDSIZE 32
-#define WRDSHIFT 5
-#define WRD uint32_t
-#define ACC uint64_t
-#define BSWAP( x ) bswap_32 ( x )
-
-#include "../noarch/bitstr.h"
-
-#endif /* _h_bitstr_ */
diff --git a/interfaces/cc/gcc/x86_64/byteswap.h b/interfaces/cc/gcc/x86_64/byteswap.h
deleted file mode 100644
index 435a233..0000000
--- a/interfaces/cc/gcc/x86_64/byteswap.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_byteswap_
-#define _h_byteswap_
-
-#ifdef _BYTESWAP_H
-#warning "GNU byteswap.h being used"
-#else
-#define _BYTESWAP_H	1234
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* perform single instruction byte swap */
-static __inline__ uint16_t bswap_16 ( uint16_t i )
-{
-    register uint16_t rtn;
-    __asm__
-    (
-        "rorw $8, %w0"
-        : "=r" ( rtn )
-        : "0" ( i )
-        : "cc"
-    );
-    return rtn;
-}
-
-/* perform single instruction byte swap */
-static __inline__ uint32_t bswap_32 ( uint32_t i )
-{
-    register uint32_t rtn;
-    __asm__
-    (
-        "bswap %0"
-        : "=r" ( rtn )
-        : "0" ( i )
-        : "cc"
-    );
-    return rtn;
-}
-
-/* perform multi-instruction byte swap */
-static __inline__ uint64_t bswap_64 ( uint64_t i )
-{
-    register uint64_t rtn;
-    __asm__
-    (
-        "bswap %q0"
-        : "=r" ( rtn )
-        : "0" ( i )
-        : "cc"
-    );
-    return rtn;
-}
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _BYTESWAP_H */
-#endif /* _h_byteswap_ */
diff --git a/interfaces/cc/gcc/x86_64/strtol.h b/interfaces/cc/gcc/x86_64/strtol.h
deleted file mode 100644
index ceda47d..0000000
--- a/interfaces/cc/gcc/x86_64/strtol.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_strtol_
-#define _h_strtol_
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#include <stdlib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * strtoi32
- * strtou32
- *  based upon actual usage
- */
-#define strtoi32( str, endp, base ) \
-    ( int32_t ) strtol ( str, endp, base )
-
-#define strtou32( str, endp, base ) \
-    ( uint32_t ) strtoul ( str, endp, base )
-
-
-/*--------------------------------------------------------------------------
- * strtoi64
- * strtou64
- *  based upon actual usage
- */
-#define strtoi64( str, endp, base ) \
-    strtol ( str, endp, base )
-
-#define strtou64( str, endp, base ) \
-    strtoul ( str, endp, base )
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_strtol_ */
diff --git a/interfaces/cc/icc/compiler.h b/interfaces/cc/icc/compiler.h
deleted file mode 100644
index d1bf565..0000000
--- a/interfaces/cc/icc/compiler.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_compiler_
-#define _h_compiler_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_compiler_ */
-
diff --git a/interfaces/cc/vc++/compiler.h b/interfaces/cc/vc++/compiler.h
deleted file mode 100644
index 75a5d3c..0000000
--- a/interfaces/cc/vc++/compiler.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_compiler_
-#define _h_compiler_
-
-#include <math.h>
-#include <float.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-static __inline
-float roundf( float value_in )
-{
-    return ( value_in < 0 ) ? ceilf ( value_in - 0.5F ) : floorf ( value_in + 0.5F );
-}
-
-#define lroundf( x ) (long int)roundf( x )
-
-static __inline
-double round( double value_in )
-{
-    return ( value_in < 0 ) ? ceil ( value_in - 0.5 ) : floor ( value_in + 0.5 );
-}
-
-typedef double double_t;
-
-#define isnan( x ) _isnan ( x )
-
-static __inline
-float truncf( float value_in )
-{
-	return ( value_in < 0 ) ? ceilf( value_in ) : floorf( value_in );
-}
-
-static __inline
-double trunc( double value_in )
-{
-	return ( value_in < 0 ) ? ceil( value_in ) : floor( value_in );
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_compiler_ */
-
diff --git a/interfaces/cc/vc++/i386/arch-impl.h b/interfaces/cc/vc++/i386/arch-impl.h
deleted file mode 100644
index 2494460..0000000
--- a/interfaces/cc/vc++/i386/arch-impl.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_arch_impl_
-#define _h_arch_impl_
-
-#ifndef _h_noarch_arch_impl_
-#include "../noarch/arch-impl.h"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_arch_impl_ */
diff --git a/interfaces/cc/vc++/i386/bitstr.h b/interfaces/cc/vc++/i386/bitstr.h
deleted file mode 100644
index a2e07ef..0000000
--- a/interfaces/cc/vc++/i386/bitstr.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_bitstr_
-#define _h_bitstr_
-
-/* use 32-bit accumulator, 16-bit word size */
-#define WRDSIZE 16
-#define WRDSHIFT 4
-#define WRD uint16_t
-#define ACC uint32_t
-#define BSWAP( x ) bswap_16 ( x )
-
-#include "../noarch/bitstr.h"
-
-#endif /* _h_bitstr_ */
diff --git a/interfaces/cc/vc++/noarch/arch-impl.h b/interfaces/cc/vc++/noarch/arch-impl.h
deleted file mode 100644
index 94feb4f..0000000
--- a/interfaces/cc/vc++/noarch/arch-impl.h
+++ /dev/null
@@ -1,286 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_noarch_arch_impl_
-#define _h_noarch_arch_impl_
-
-#include <stdint.h>
-
-#ifndef _INC_STDLIB
-#include <stdlib.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* this table is very simple to calculate
-   but simpler yet to use for lookup */
-static const int8_t lsbit_map [] =
-{
-    -1, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
-     4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
-     5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
-     4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
-     6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
-     4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
-     5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
-     4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
-     7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
-     4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
-     5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
-     4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
-     6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
-     4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
-     5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
-     4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0
-};
-
-static __inline
-int16_t uint16_lsbit ( uint16_t self )
-{
-    /* detect no bits are set */
-    if ( self == 0 )
-        return -1;
-
-    /* detect bits set in lower byte */
-    if ( ( uint8_t ) self != 0 )
-        return lsbit_map [ ( uint8_t ) self ];
-
-    /* return bit set in upper byte */
-    return lsbit_map [ self >> 8 ] + 8;
-}
-
-static __inline
-int32_t uint32_lsbit ( uint32_t self )
-{
-    /* detect no bits are set */
-    if ( self == 0 )
-        return -1;
-
-    /* detect bits set in lower word */
-    if ( ( uint16_t ) self != 0 )
-        return uint16_lsbit ( ( uint16_t ) self );
-
-    /* return bit set in upper word */
-    return uint16_lsbit ( self >> 16 ) + 16;
-}
-
-typedef struct int128_t int128_t;
-struct int128_t
-{
-    uint64_t lo;
-    int64_t hi;
-};
-
-static __inline
-int64_t int128_hi ( const int128_t *self )
-{
-    return self -> hi;
-}
-
-static __inline
-uint64_t int128_lo ( const int128_t *self )
-{
-    return self -> lo;
-}
-
-static __inline
-void int128_sethi ( int128_t *self, int64_t i )
-{
-    self -> hi = i;
-}
-
-static __inline
-void int128_setlo ( int128_t *self, uint64_t i )
-{
-    self -> lo = i;
-}
-
-typedef struct uint128_t uint128_t;
-struct uint128_t
-{
-    uint64_t lo;
-    uint64_t hi;
-};
-
-static __inline
-uint64_t uint128_hi ( const uint128_t *self )
-{
-    return self -> hi;
-}
-
-static __inline
-uint64_t uint128_lo ( const uint128_t *self )
-{
-    return self -> lo;
-}
-
-static __inline
-void uint128_sethi ( uint128_t *self, uint64_t i )
-{
-    self -> hi = i;
-}
-
-static __inline
-void uint128_setlo ( uint128_t *self, uint64_t i )
-{
-    self -> lo = i;
-}
-
-static __inline
-void int128_add ( int128_t *self, const int128_t *i )
-{
-    uint64_t carry = ( ( const uint32_t* ) self ) [ 0 ] + ( ( const uint32_t* ) i ) [ 0 ];
-    self -> hi += i -> hi;
-    carry = ( ( const uint32_t* ) self ) [ 1 ] + ( ( const uint32_t* ) i ) [ 1 ] + ( carry >> 32 );
-    self -> lo += i -> lo;
-    self -> hi += carry >> 32;
-}
-
-static __inline
-void int128_sub ( int128_t *self, const int128_t *i )
-{
-    int carry = i -> lo > self -> lo;
-    self -> hi -= i -> hi;
-    self -> lo -= i -> lo;
-    self -> hi -= carry;
-}
-
-static __inline
-void int128_sar ( int128_t *self, uint32_t i )
-{
-    if ( i < 64 )
-    {
-        self -> lo = ( self -> hi << ( 64 - i ) ) |  ( self -> lo >> i );
-        self -> hi >>= i;
-    }
-    else
-    {
-        self -> lo = self -> hi >> ( i - 64 );
-        self -> hi >>= 63;
-    }
-}
-
-static __inline
-void int128_shl ( int128_t *self, uint32_t i )
-{
-    if ( i < 64 )
-    {
-        self -> hi = ( self -> hi << i ) | ( int64_t ) ( self -> lo >> ( 64 - i ) );
-        self -> lo <<= i;
-    }
-    else
-    {
-        self -> hi = ( int64_t ) ( self -> lo << ( i - 64 ) );
-        self -> lo = 0;
-    }
-}
-
-static __inline
-void uint128_and ( uint128_t *self, const uint128_t *i )
-{
-    self -> lo &= i -> lo;
-    self -> hi &= i -> hi;
-}
-
-static __inline
-void uint128_or ( uint128_t *self, const uint128_t *i )
-{
-    self -> lo |= i -> lo;
-    self -> hi |= i -> hi;
-}
-
-static __inline
-void uint128_orlo ( uint128_t *self, uint64_t i )
-{
-    self -> lo |= i;
-}
-
-static __inline
-void uint128_xor ( uint128_t *self, const uint128_t *i )
-{
-    self -> lo ^= i -> lo;
-    self -> hi ^= i -> hi;
-}
-
-static __inline
-void uint128_not ( uint128_t *self )
-{
-    self -> lo = ~ self -> lo;
-    self -> hi = ~ self -> hi;
-}
-
-static __inline
-void uint128_shr ( uint128_t *self, uint32_t i )
-{
-    if ( i < 64 )
-    {
-        self -> lo = ( self -> hi << ( 64 - i ) ) |  ( self -> lo >> i );
-        self -> hi >>= i;
-    }
-    else
-    {
-        self -> lo = self -> hi >> ( i - 64 );
-        self -> hi >>= 63;
-    }
-}
-
-static __inline
-void uint128_shl ( uint128_t *self, uint32_t i )
-{
-    if ( i < 64 )
-    {
-        self -> hi = ( self -> hi << i ) | ( self -> lo >> ( 64 - i ) );
-        self -> lo <<= i;
-    }
-    else
-    {
-        self -> hi = self -> lo << ( i - 64 );
-        self -> lo = 0;
-    }
-}
-
-static __inline
-void uint128_bswap ( uint128_t *self )
-{
-    uint64_t tmp = _byteswap_uint64 ( self -> lo );
-    self -> lo = _byteswap_uint64 ( self -> hi );
-    ( ( uint64_t* ) self ) [ 1 ] = tmp;
-}
-
-static __inline
-void uint128_bswap_copy ( uint128_t *to, const uint128_t *from )
-{
-    to -> lo = _byteswap_uint64 ( from -> hi );
-    to -> hi = _byteswap_uint64 ( from -> lo );
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_noarch_arch_impl_ */
diff --git a/interfaces/cc/vc++/noarch/bitstr.h b/interfaces/cc/vc++/noarch/bitstr.h
deleted file mode 100644
index 88a4c34..0000000
--- a/interfaces/cc/vc++/noarch/bitstr.h
+++ /dev/null
@@ -1,412 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_noarch_bitstr_
-#define _h_noarch_bitstr_
-
-#ifndef _h_bitstr_
-#error "don't include <noarch/bitstr.h> directly - use <bitstr.h>"
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#include <byteswap.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* bitcpy                                                                                                                                                                                                    
- *  copy a string of bits from source to dest                                                                                                                                                                
- *                                                                                                                                                                                                           
- *  both source and dest may have non-byte aligned pointers                                                                                                                                                  
- *  the number of bits to copy need not be byte aligned                                                                                                                                                      
- *                                                                                                                                                                                                           
- *  depending upon architecture and OS conventions, the word                                                                                                                                                 
- *  size may be adjusted to 1, 2, or 4 bytes, where the base                                                                                                                                                 
- *  pointers are always word aligned.                                                                                                                                                                        
- *                                                                                                                                                                                                           
- *  bits in memory are always treated as big-endian, meaning                                                                                                                                                 
- *  that on multi-byte fetches and stores, we perform byte-swapping                                                                                                                                          
- *  if there are shifts or masks                                                                                                                                                                             
- */
-static __inline
-void bitcpy ( void *dbase, bitsz_t doff, const void *sbase, bitsz_t soff, bitsz_t sz )
-{
-    /* noop if sz == 0 */
-    if ( sz != 0 )
-    {
-        /* loop counter and destination word count */
-        size_t i, dcountz;
-
-        /* left & right masks and working register */
-        WRD lmask, rmask, reg;
-
-        /* produce word-aligned pointers */
-#if WRDSIZE == 8
-        /* 1-4. all at once */
-        WRD *dst = ( WRD* ) dbase + ( doff >> WRDSHIFT );
-        const WRD *src = ( const WRD* ) sbase + ( soff >> WRDSHIFT );
-#else
-        /* 1. capture word alignment adjustment */
-        size_t dadjust = ( size_t ) dbase & ( WRDSIZE / 8 - 1 );
-        size_t sadjust = ( size_t ) sbase & ( WRDSIZE / 8 - 1 );
-
-        /* 2. create word-aligned pointers */
-        WRD *dst = ( WRD* ) ( ( size_t ) dbase - dadjust );
-        const WRD *src = ( const WRD* ) ( ( size_t ) sbase - sadjust );
-
-        /* 3. incorporate alignment adjustment into offset bits */
-        doff += dadjust << 3;
-        soff += sadjust << 3;
-
-        /* 4. readjust pointers based upon offset */
-        dst += doff >> WRDSHIFT;
-        src += soff >> WRDSHIFT;
-#endif
-        /* 5. restate offsets */
-        doff &= ( WRDSIZE - 1 );
-        soff &= ( WRDSIZE - 1 );
-
-        /* calculate number of words - 1 in dst */
-        dcountz = ( size_t ) ( ( doff + sz + ( WRDSIZE - 1 ) - WRDSIZE ) >> WRDSHIFT );
-
-        /* calculate masks */
-        lmask = rmask = ~ 0;
-        lmask >>= doff;
-        rmask >>= ( doff + sz ) & ( WRDSIZE - 1 );
-        if ( ( WRD ) ( rmask + 1 ) == 0 )
-            rmask = 0;
-
-        /* prime register with masked dst [ 0 ] */
-        reg = BSWAP ( dst [ 0 ] ) & ~ lmask;
-
-        /* if source and destination are aligned */
-        if ( doff == soff )
-        {
-            /* merge src [ 0 ] into reg through mask */
-            reg |= BSWAP ( src [ 0 ] ) & lmask;
-
-#if WRDSIZE > 8
-            /* straight copies don't need byteswap                                                                                                                                                           
-               other than on first and last words                                                                                                                                                            
-               put first word back into little-endian                                                                                                                                                        
-               for remainder of loop */
-            if ( dcountz > 0 )
-            {
-                reg = BSWAP ( reg );
-#endif
-                /* aligned buffers have n:n word ratio */
-                for ( i = 0; i < dcountz; )
-                {
-                    dst [ i ] = reg;
-                    reg = src [ ++ i ];
-                }
-
-#if WRDSIZE > 8
-                /* revert to big-endian */
-                reg = BSWAP ( reg );
-            }
-#endif
-        }
-
-        /* shifting alignment  */
-        else
-        {
-            /* source count may differ from dest count */
-            size_t scountz = ( size_t ) ( ( soff + sz + ( WRDSIZE - 1 ) - WRDSIZE ) >> WRDSHIFT );
-
-            /* use double-word accumulator */
-            ACC acc = BSWAP ( src [ 0 ] );
-
-            /* shift amount */
-            int shift = ( int ) doff - ( int ) soff;
-            if ( shift > 0 )
-            {
-                /* take only valid bits in shifted initial src */
-                reg |= ( WRD ) ( acc >> shift ) & lmask;
-
-                /* because "shift" > 0, we know "dcountz" >= "scountz" */
-                for ( acc <<= WRDSIZE, i = 0; i < scountz; acc <<= WRDSIZE )
-                {
-                    dst [ i ] = BSWAP ( reg );
-                    acc |= BSWAP ( src [ ++ i ] );
-                    reg = ( WRD ) ( acc >> shift );
-                }
-
-                /* if "dcountz" > "scountz" */
-                if ( i < dcountz )
-                {
-                    dst [ i ] = BSWAP ( reg );
-                    reg = ( WRD ) ( acc >> shift );
-                }
-            }
-
-            else
-            {
-                /* need single word read-ahead and right-shift */
-                shift += WRDSIZE;
-
-                /* because "shift" was < 0, we know "dcountz" <= "scountz" */
-                for ( acc <<= WRDSIZE, i = 0; i < dcountz; acc <<= WRDSIZE )
-                {
-                    acc |= BSWAP ( src [ i + 1 ] );
-                    reg |= ( WRD ) ( acc >> shift ) & lmask;
-                    dst [ i ++ ] = BSWAP ( reg );
-                    lmask = ~ 0;
-                    reg = 0;
-                }
-
-                /* if "dcountz" < "scountz" */
-                if ( i < scountz )
-                    acc |= BSWAP ( src [ scountz ] );
-
-                reg |= ( WRD ) ( acc >> shift ) & lmask;
-            }
-        }
-
-        /* mask off unused bytes from src */
-        reg &= ~ rmask;
-
-        /* bring in saved bits from dst */
-        reg |= BSWAP ( dst [ dcountz ] ) & rmask;
-
-        /* write out last word */
-        dst [ dcountz ] = BSWAP ( reg );
-    }
-}
-
-/* bitcmp
- *  performs bitwise a - b, returning result as int
- *  result value has no meaning, only sign
- *  where < 0 means a < b, > 0 means a > b, and 0 means a == b
- *
- *  since the comparison produces a tri-state indicator of
- *  relative magnitude, the order of "a" and "b" is important.
- *  furthermore, the difference operator must be evaluated
- *  left to right, because the result indicates more than
- *  equality.
- *
- *  see bitcpy for general word alignment information
- */
-static __inline
-int bitcmp ( const void *abase, bitsz_t aoff, const void *bbase, bitsz_t boff, bitsz_t sz )
-{
-    int diff = 0;
-
-    if ( sz != 0 )
-    {
-        /* loop counter and left word count */
-        size_t i, lcountz;
-
-        /* left & right masks and working registers */
-        WRD lmask, rmask, lreg, rreg;
-
-        /* produce word-aligned pointers */
-#if WRDSIZE == 8
-        /* 1-4. all at once */
-        const WRD *left = ( const WRD* ) abase + ( aoff >> WRDSHIFT );
-        const WRD *right = ( const WRD* ) bbase + ( boff >> WRDSHIFT );
-#else
-        /* 1. capture word alignment adjustment */
-        size_t aadjust = ( size_t ) abase & ( WRDSIZE / 8 - 1 );
-        size_t badjust = ( size_t ) bbase & ( WRDSIZE / 8 - 1 );
-
-        /* 2. create word-aligned pointers */
-        const WRD *left = ( const WRD* ) ( ( size_t ) abase - aadjust );
-        const WRD *right = ( const WRD* ) ( ( size_t ) bbase - badjust );
-
-        /* 3. incorporate alignment adjustment into offset bits */
-        aoff += aadjust << 3;
-        boff += badjust << 3;
-
-        /* 4. readjust pointers based upon offset */
-        left += aoff >> WRDSHIFT;
-        right += boff >> WRDSHIFT;
-#endif
-        /* 5. restate offsets */
-        aoff &= ( WRDSIZE - 1 );
-        boff &= ( WRDSIZE - 1 );
-
-        /* calculate number of words - 1 in left
-           since we know a-priori that "sz" > 0, we
-           know that the left and right counts must be
-           at least 1. our loops treat the last word
-           specially, so calculate a loop counter that
-           excludes the last word */
-        lcountz = ( size_t ) ( ( aoff + sz + ( WRDSIZE - 1 ) - WRDSIZE ) >> WRDSHIFT );
-
-        /* calculate masks */
-        lmask = rmask = ~ 0;
-        lmask >>= aoff;
-        rmask >>= ( aoff + sz ) & ( WRDSIZE - 1 );
-        if ( ( WRD ) ( rmask + 1 ) == 0 )
-            rmask = 0;
-
-        /* significant bits from left [ 0 ] */
-        lreg = BSWAP ( left [ 0 ] ) & lmask;
-
-        /* if source and destination are aligned */
-        if ( aoff == boff )
-        {
-            /* test against right bits through mask */
-            rreg = BSWAP ( right [ 0 ] ) & lmask;
-
-            /* produce a difference of all but the last
-               aligned word, where initial word has been
-               left-masked. the last word is tested below. */
-            for ( i = 1; i <= lcountz; ++ i )
-            {
-                diff = ( int ) lreg - ( int ) rreg;
-                if ( diff != 0 )
-                    return diff;
-
-                /* byte-swapping occurs on little-endian architectures */
-                lreg = BSWAP ( left [ i ] );
-                rreg = BSWAP ( right [ i ] );
-            }
-
-            /* fall out to end for masked comparison of last word */
-        }
-
-        /* shifting alignment */
-        else
-        {
-            /* right count may differ from left count
-               since alignments differ, the span of "sz"
-               bits may hit a different number of words in
-               the left array than in the right. */
-            size_t rcountz = ( size_t ) ( ( boff + sz + ( WRDSIZE - 1 ) - WRDSIZE ) >> WRDSHIFT );
-
-            /* use double-word accumulator
-               note that the extra bits get ignored */
-            ACC acc = BSWAP ( right [ 0 ] );
-
-            /* shift amount: positive if "b" needs to be right shifted.
-               NOTE - since the comparison must be successively performed
-               from left to right ( see above ), shifting is ALWAYS toward
-               right, making for special handling when "shift" < 0 ( see below ) */
-            int shift = ( int ) aoff - ( int ) boff;
-            if ( shift > 0 )
-            {
-                /* initial word from right operand, aligned with left */
-                rreg = ( WRD ) ( acc >> shift ) & lmask;
-
-                /* "shift" > 0 means "lcountz" >= "rcountz" */
-                for ( acc <<= WRDSIZE, i = 1; i <= rcountz; acc <<= WRDSIZE, ++ i )
-                {
-                    /* compare words at i-1 */
-                    diff = ( int ) lreg - ( int ) rreg;
-                    if ( diff != 0 )
-                        return diff;
-
-                    /* accumulate next word from right operand */
-                    acc |= BSWAP ( right [ i ] );
-
-                    /* bring in next word from left operand */
-                    lreg = BSWAP ( left [ i ] );
-
-                    /* produce aligned word from right operand */
-                    rreg = ( WRD ) ( acc >> shift );
-                }
-
-                /* if there is one more word in left */
-                if ( lcountz > rcountz )
-                {
-                    /* compare penultimate */
-                    diff = ( int ) lreg - ( int ) rreg;
-                    if ( diff != 0 )
-                        return diff;
-
-                    /* get last word in left */
-                    lreg = BSWAP ( left [ lcountz ] );
-
-                    /* last word from right is already in "acc" */
-                    rreg = ( WRD ) ( acc >> shift );
-                }
-
-                /* fall out to end for masked comparison of last word */
-            }
-
-            else
-            {
-                /* since all shifts must be toward right ( due to left to right
-                   comparison ), this alignment will require a pre-fetch from
-                   right operand into accumulator, and adjusting the negative
-                   shift amount to a positive right-shift. */
-                shift += WRDSIZE;
-
-                /* since "shift" was negative, we know "lcountz" <= "rcountz",
-                   so use "lcountz" as loop limit. pre-shift "acc" as loop init */
-                for ( acc <<= WRDSIZE, i = 1; i <= lcountz; acc <<= WRDSIZE, ++ i )
-                {
-                    /* accumulate next word from right operand */
-                    acc |= BSWAP ( right [ i ] );
-
-                    /* produce aligned word from right operand */
-                    rreg = ( WRD ) ( acc >> shift ) & lmask;
-
-                    /* now test against left */
-                    diff = ( int ) lreg - ( int ) rreg;
-                    if ( diff != 0 )
-                        return diff;
-
-                    /* bring in next word from left operand */
-                    lreg = BSWAP ( left [ i ] );
-
-                    /* no more left mask */
-                    lmask = ~ 0;
-                }
-
-                /* if there is one more word in right */
-                if ( lcountz < rcountz )
-                    acc |= BSWAP ( right [ rcountz ] );
-
-                /* produce "rreg" from "acc" */
-                rreg = ( WRD ) ( acc >> shift ) & lmask;
-
-                /* fall out to end for masked comparison of last word */
-            }
-        }
-
-        /* mask off unused bytes from right */
-        lreg &= ~ rmask;
-        rreg &= ~ rmask;
-
-        /* perform final comparison */
-        diff = ( int ) lreg - ( int ) rreg;
-    }
-
-    return diff;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_noarch_bitstr_ */
diff --git a/interfaces/cc/vc++/stdbool.h b/interfaces/cc/vc++/stdbool.h
deleted file mode 100644
index 4807cb4..0000000
--- a/interfaces/cc/vc++/stdbool.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _STDBOOL_H
-#define _STDBOOL_H
-
-/*--------------------------------------------------------------------------
- * bool
- */
-
-#ifndef __cplusplus
-typedef unsigned char bool;
-
-#undef true
-#define true 1
-
-#undef false
-#define false 0
-
-#endif
-
-
-#endif /* _STDBOOL_H */
diff --git a/interfaces/cc/vc++/stdint.h b/interfaces/cc/vc++/stdint.h
deleted file mode 100644
index 44c124d..0000000
--- a/interfaces/cc/vc++/stdint.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _STDINT_H
-#define _STDINT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* perhaps not the best place for this, but it helps reduce the
-   number of artificial includes for compatibility */
-#ifndef __inline__
-#define __inline__ __inline
-#endif
-
-#ifndef __func__
-#define __func__ __FUNCTION__
-#endif
-
-#include <../include/stdint.h>
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/interfaces/cc/vc++/va_copy.h b/interfaces/cc/vc++/va_copy.h
deleted file mode 100644
index 76fc7c7..0000000
--- a/interfaces/cc/vc++/va_copy.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_va_copy_
-#define _h_va_copy_
-
-#include <STDARG.H>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define va_copy( dst, src ) \
-    ( dst ) = ( src )
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_va_copy_ */
diff --git a/interfaces/cc/vc++/x86_64/arch-impl.h b/interfaces/cc/vc++/x86_64/arch-impl.h
deleted file mode 100644
index 2494460..0000000
--- a/interfaces/cc/vc++/x86_64/arch-impl.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_arch_impl_
-#define _h_arch_impl_
-
-#ifndef _h_noarch_arch_impl_
-#include "../noarch/arch-impl.h"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_arch_impl_ */
diff --git a/interfaces/cc/vc++/x86_64/bitstr.h b/interfaces/cc/vc++/x86_64/bitstr.h
deleted file mode 100644
index b52f525..0000000
--- a/interfaces/cc/vc++/x86_64/bitstr.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_bitstr_
-#define _h_bitstr_
-
-/* use 64-bit accumulator, 32-bit word size */
-#define WRDSIZE 32
-#define WRDSHIFT 5
-#define WRD uint32_t
-#define ACC uint64_t
-#define BSWAP( x ) bswap_32 ( x )
-
-#include "../noarch/bitstr.h"
-
-#endif /* _h_bitstr_ */
diff --git a/interfaces/ext/bzlib.h b/interfaces/ext/bzlib.h
deleted file mode 100644
index 8277123..0000000
--- a/interfaces/ext/bzlib.h
+++ /dev/null
@@ -1,282 +0,0 @@
-
-/*-------------------------------------------------------------*/
-/*--- Public header file for the library.                   ---*/
-/*---                                               bzlib.h ---*/
-/*-------------------------------------------------------------*/
-
-/* ------------------------------------------------------------------
-   This file is part of bzip2/libbzip2, a program and library for
-   lossless, block-sorting data compression.
-
-   bzip2/libbzip2 version 1.0.6 of 6 September 2010
-   Copyright (C) 1996-2010 Julian Seward <jseward at bzip.org>
-
-   Please read the WARNING, DISCLAIMER and PATENTS sections in the 
-   README file.
-
-   This program is released under the terms of the license contained
-   in the file LICENSE.
-   ------------------------------------------------------------------ */
-
-
-#ifndef _BZLIB_H
-#define _BZLIB_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define BZ_RUN               0
-#define BZ_FLUSH             1
-#define BZ_FINISH            2
-
-#define BZ_OK                0
-#define BZ_RUN_OK            1
-#define BZ_FLUSH_OK          2
-#define BZ_FINISH_OK         3
-#define BZ_STREAM_END        4
-#define BZ_SEQUENCE_ERROR    (-1)
-#define BZ_PARAM_ERROR       (-2)
-#define BZ_MEM_ERROR         (-3)
-#define BZ_DATA_ERROR        (-4)
-#define BZ_DATA_ERROR_MAGIC  (-5)
-#define BZ_IO_ERROR          (-6)
-#define BZ_UNEXPECTED_EOF    (-7)
-#define BZ_OUTBUFF_FULL      (-8)
-#define BZ_CONFIG_ERROR      (-9)
-
-typedef 
-   struct {
-      char *next_in;
-      unsigned int avail_in;
-      unsigned int total_in_lo32;
-      unsigned int total_in_hi32;
-
-      char *next_out;
-      unsigned int avail_out;
-      unsigned int total_out_lo32;
-      unsigned int total_out_hi32;
-
-      void *state;
-
-      void *(*bzalloc)(void *,int,int);
-      void (*bzfree)(void *,void *);
-      void *opaque;
-   } 
-   bz_stream;
-
-
-#ifndef BZ_IMPORT
-#define BZ_EXPORT
-#endif
-
-#ifndef BZ_NO_STDIO
-/* Need a definitition for FILE */
-#include <stdio.h>
-#endif
-
-#ifdef _WIN32
-#   include <windows.h>
-#   ifdef small
-      /* windows.h define small to char */
-#      undef small
-#   endif
-#   ifdef BZ_EXPORT
-#   define BZ_API(func) WINAPI func
-#   define BZ_EXTERN extern
-#   else
-   /* import windows dll dynamically */
-#   define BZ_API(func) (WINAPI * func)
-#   define BZ_EXTERN
-#   endif
-#else
-#   define BZ_API(func) func
-#   define BZ_EXTERN extern
-#endif
-
-
-/*-- Core (low-level) library functions --*/
-
-BZ_EXTERN int BZ_API(BZ2_bzCompressInit) ( 
-      bz_stream* strm, 
-      int        blockSize100k, 
-      int        verbosity, 
-      int        workFactor 
-   );
-
-BZ_EXTERN int BZ_API(BZ2_bzCompress) ( 
-      bz_stream* strm, 
-      int action 
-   );
-
-BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) ( 
-      bz_stream* strm 
-   );
-
-BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) ( 
-      bz_stream *strm, 
-      int       verbosity, 
-      int       small
-   );
-
-BZ_EXTERN int BZ_API(BZ2_bzDecompress) ( 
-      bz_stream* strm 
-   );
-
-BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) ( 
-      bz_stream *strm 
-   );
-
-
-
-/*-- High(er) level library functions --*/
-
-#ifndef BZ_NO_STDIO
-#define BZ_MAX_UNUSED 5000
-
-typedef void BZFILE;
-
-BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) ( 
-      int*  bzerror,   
-      FILE* f, 
-      int   verbosity, 
-      int   small,
-      void* unused,    
-      int   nUnused 
-   );
-
-BZ_EXTERN void BZ_API(BZ2_bzReadClose) ( 
-      int*    bzerror, 
-      BZFILE* b 
-   );
-
-BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) ( 
-      int*    bzerror, 
-      BZFILE* b, 
-      void**  unused,  
-      int*    nUnused 
-   );
-
-BZ_EXTERN int BZ_API(BZ2_bzRead) ( 
-      int*    bzerror, 
-      BZFILE* b, 
-      void*   buf, 
-      int     len 
-   );
-
-BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) ( 
-      int*  bzerror,      
-      FILE* f, 
-      int   blockSize100k, 
-      int   verbosity, 
-      int   workFactor 
-   );
-
-BZ_EXTERN void BZ_API(BZ2_bzWrite) ( 
-      int*    bzerror, 
-      BZFILE* b, 
-      void*   buf, 
-      int     len 
-   );
-
-BZ_EXTERN void BZ_API(BZ2_bzWriteClose) ( 
-      int*          bzerror, 
-      BZFILE*       b, 
-      int           abandon, 
-      unsigned int* nbytes_in, 
-      unsigned int* nbytes_out 
-   );
-
-BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) ( 
-      int*          bzerror, 
-      BZFILE*       b, 
-      int           abandon, 
-      unsigned int* nbytes_in_lo32, 
-      unsigned int* nbytes_in_hi32, 
-      unsigned int* nbytes_out_lo32, 
-      unsigned int* nbytes_out_hi32
-   );
-#endif
-
-
-/*-- Utility functions --*/
-
-BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) ( 
-      char*         dest, 
-      unsigned int* destLen,
-      char*         source, 
-      unsigned int  sourceLen,
-      int           blockSize100k, 
-      int           verbosity, 
-      int           workFactor 
-   );
-
-BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) ( 
-      char*         dest, 
-      unsigned int* destLen,
-      char*         source, 
-      unsigned int  sourceLen,
-      int           small, 
-      int           verbosity 
-   );
-
-
-/*--
-   Code contributed by Yoshioka Tsuneo (tsuneo at rr.iij4u.or.jp)
-   to support better zlib compatibility.
-   This code is not _officially_ part of libbzip2 (yet);
-   I haven't tested it, documented it, or considered the
-   threading-safeness of it.
-   If this code breaks, please contact both Yoshioka and me.
---*/
-
-BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) (
-      void
-   );
-
-#ifndef BZ_NO_STDIO
-BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) (
-      const char *path,
-      const char *mode
-   );
-
-BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) (
-      int        fd,
-      const char *mode
-   );
-         
-BZ_EXTERN int BZ_API(BZ2_bzread) (
-      BZFILE* b, 
-      void* buf, 
-      int len 
-   );
-
-BZ_EXTERN int BZ_API(BZ2_bzwrite) (
-      BZFILE* b, 
-      void*   buf, 
-      int     len 
-   );
-
-BZ_EXTERN int BZ_API(BZ2_bzflush) (
-      BZFILE* b
-   );
-
-BZ_EXTERN void BZ_API(BZ2_bzclose) (
-      BZFILE* b
-   );
-
-BZ_EXTERN const char * BZ_API(BZ2_bzerror) (
-      BZFILE *b, 
-      int    *errnum
-   );
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-/*-------------------------------------------------------------*/
-/*--- end                                           bzlib.h ---*/
-/*-------------------------------------------------------------*/
diff --git a/interfaces/ext/libxml/DOCBparser.h b/interfaces/ext/libxml/DOCBparser.h
deleted file mode 100644
index 461d4ee..0000000
--- a/interfaces/ext/libxml/DOCBparser.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Summary: old DocBook SGML parser
- * Description: interface for a DocBook SGML non-verifying parser
- * This code is DEPRECATED, and should not be used anymore.
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#ifndef __DOCB_PARSER_H__
-#define __DOCB_PARSER_H__
-#include <libxml/xmlversion.h>
-
-#ifdef LIBXML_DOCB_ENABLED
-
-#include <libxml/parser.h>
-#include <libxml/parserInternals.h>
-
-#ifndef IN_LIBXML
-#ifdef __GNUC__
-#warning "The DOCBparser module has been deprecated in libxml2-2.6.0"
-#endif
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Most of the back-end structures from XML and SGML are shared.
- */
-typedef xmlParserCtxt docbParserCtxt;
-typedef xmlParserCtxtPtr docbParserCtxtPtr;
-typedef xmlSAXHandler docbSAXHandler;
-typedef xmlSAXHandlerPtr docbSAXHandlerPtr;
-typedef xmlParserInput docbParserInput;
-typedef xmlParserInputPtr docbParserInputPtr;
-typedef xmlDocPtr docbDocPtr;
-
-/*
- * There is only few public functions.
- */
-XMLPUBFUN int XMLCALL
-		     docbEncodeEntities(unsigned char *out,
-                                        int *outlen,
-                                        const unsigned char *in,
-                                        int *inlen, int quoteChar);
-
-XMLPUBFUN docbDocPtr XMLCALL             
-		     docbSAXParseDoc   (xmlChar *cur,
-                                        const char *encoding,
-                                        docbSAXHandlerPtr sax,
-                                        void *userData);
-XMLPUBFUN docbDocPtr XMLCALL             
-		     docbParseDoc      (xmlChar *cur,
-                                        const char *encoding);
-XMLPUBFUN docbDocPtr XMLCALL             
-		     docbSAXParseFile  (const char *filename,
-                                        const char *encoding,
-                                        docbSAXHandlerPtr sax,
-                                        void *userData);
-XMLPUBFUN docbDocPtr XMLCALL             
-		     docbParseFile     (const char *filename,
-                                        const char *encoding);
-
-/**
- * Interfaces for the Push mode.
- */
-XMLPUBFUN void XMLCALL                  
-		     docbFreeParserCtxt      (docbParserCtxtPtr ctxt);
-XMLPUBFUN docbParserCtxtPtr XMLCALL     
-		     docbCreatePushParserCtxt(docbSAXHandlerPtr sax,
-                                              void *user_data,
-                                              const char *chunk,
-                                              int size,
-                                              const char *filename,
-                                              xmlCharEncoding enc);
-XMLPUBFUN int XMLCALL                   
-		     docbParseChunk          (docbParserCtxtPtr ctxt,
-                                              const char *chunk,
-                                              int size,
-                                              int terminate);
-XMLPUBFUN docbParserCtxtPtr XMLCALL       
-		     docbCreateFileParserCtxt(const char *filename,
-                                              const char *encoding);
-XMLPUBFUN int XMLCALL                   
-		     docbParseDocument       (docbParserCtxtPtr ctxt);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LIBXML_DOCB_ENABLED */
-
-#endif /* __DOCB_PARSER_H__ */
diff --git a/interfaces/ext/libxml/HTMLparser.h b/interfaces/ext/libxml/HTMLparser.h
deleted file mode 100644
index 05905e4..0000000
--- a/interfaces/ext/libxml/HTMLparser.h
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- * Summary: interface for an HTML 4.0 non-verifying parser
- * Description: this module implements an HTML 4.0 non-verifying parser
- *              with API compatible with the XML parser ones. It should
- *              be able to parse "real world" HTML, even if severely
- *              broken from a specification point of view.
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#ifndef __HTML_PARSER_H__
-#define __HTML_PARSER_H__
-#include <libxml/xmlversion.h>
-#include <libxml/parser.h>
-
-#ifdef LIBXML_HTML_ENABLED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Most of the back-end structures from XML and HTML are shared.
- */
-typedef xmlParserCtxt htmlParserCtxt;
-typedef xmlParserCtxtPtr htmlParserCtxtPtr;
-typedef xmlParserNodeInfo htmlParserNodeInfo;
-typedef xmlSAXHandler htmlSAXHandler;
-typedef xmlSAXHandlerPtr htmlSAXHandlerPtr;
-typedef xmlParserInput htmlParserInput;
-typedef xmlParserInputPtr htmlParserInputPtr;
-typedef xmlDocPtr htmlDocPtr;
-typedef xmlNodePtr htmlNodePtr;
-
-/*
- * Internal description of an HTML element, representing HTML 4.01
- * and XHTML 1.0 (which share the same structure).
- */
-typedef struct _htmlElemDesc htmlElemDesc;
-typedef htmlElemDesc *htmlElemDescPtr;
-struct _htmlElemDesc {
-    const char *name;	/* The tag name */
-    char startTag;      /* Whether the start tag can be implied */
-    char endTag;        /* Whether the end tag can be implied */
-    char saveEndTag;    /* Whether the end tag should be saved */
-    char empty;         /* Is this an empty element ? */
-    char depr;          /* Is this a deprecated element ? */
-    char dtd;           /* 1: only in Loose DTD, 2: only Frameset one */
-    char isinline;      /* is this a block 0 or inline 1 element */
-    const char *desc;   /* the description */
-
-/* NRK Jan.2003
- * New fields encapsulating HTML structure
- *
- * Bugs:
- *	This is a very limited representation.  It fails to tell us when
- *	an element *requires* subelements (we only have whether they're
- *	allowed or not), and it doesn't tell us where CDATA and PCDATA
- *	are allowed.  Some element relationships are not fully represented:
- *	these are flagged with the word MODIFIER
- */
-    const char** subelts;		/* allowed sub-elements of this element */
-    const char* defaultsubelt;	/* subelement for suggested auto-repair
-					   if necessary or NULL */
-    const char** attrs_opt;		/* Optional Attributes */
-    const char** attrs_depr;		/* Additional deprecated attributes */
-    const char** attrs_req;		/* Required attributes */
-};
-
-/*
- * Internal description of an HTML entity.
- */
-typedef struct _htmlEntityDesc htmlEntityDesc;
-typedef htmlEntityDesc *htmlEntityDescPtr;
-struct _htmlEntityDesc {
-    unsigned int value;	/* the UNICODE value for the character */
-    const char *name;	/* The entity name */
-    const char *desc;   /* the description */
-};
-
-/*
- * There is only few public functions.
- */
-XMLPUBFUN const htmlElemDesc * XMLCALL 	
-			htmlTagLookup	(const xmlChar *tag);
-XMLPUBFUN const htmlEntityDesc * XMLCALL 	
-			htmlEntityLookup(const xmlChar *name);
-XMLPUBFUN const htmlEntityDesc * XMLCALL 	
-			htmlEntityValueLookup(unsigned int value);
-
-XMLPUBFUN int XMLCALL			
-			htmlIsAutoClosed(htmlDocPtr doc,
-					 htmlNodePtr elem);
-XMLPUBFUN int XMLCALL			
-			htmlAutoCloseTag(htmlDocPtr doc,
-					 const xmlChar *name,
-					 htmlNodePtr elem);
-XMLPUBFUN const htmlEntityDesc * XMLCALL	
-			htmlParseEntityRef(htmlParserCtxtPtr ctxt,
-					 const xmlChar **str);
-XMLPUBFUN int XMLCALL			
-			htmlParseCharRef(htmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL			
-			htmlParseElement(htmlParserCtxtPtr ctxt);
-
-XMLPUBFUN htmlParserCtxtPtr XMLCALL	
-			htmlNewParserCtxt(void);
-
-XMLPUBFUN htmlParserCtxtPtr XMLCALL	
-			htmlCreateMemoryParserCtxt(const char *buffer,
-						   int size);
-
-XMLPUBFUN int XMLCALL			
-			htmlParseDocument(htmlParserCtxtPtr ctxt);
-XMLPUBFUN htmlDocPtr XMLCALL		
-			htmlSAXParseDoc	(xmlChar *cur,
-					 const char *encoding,
-					 htmlSAXHandlerPtr sax,
-					 void *userData);
-XMLPUBFUN htmlDocPtr XMLCALL		
-			htmlParseDoc	(xmlChar *cur,
-					 const char *encoding);
-XMLPUBFUN htmlDocPtr XMLCALL		
-			htmlSAXParseFile(const char *filename,
-					 const char *encoding,
-					 htmlSAXHandlerPtr sax,
-					 void *userData);
-XMLPUBFUN htmlDocPtr XMLCALL		
-			htmlParseFile	(const char *filename,
-					 const char *encoding);
-XMLPUBFUN int XMLCALL			
-			UTF8ToHtml	(unsigned char *out,
-					 int *outlen,
-					 const unsigned char *in,
-					 int *inlen);
-XMLPUBFUN int XMLCALL			
-			htmlEncodeEntities(unsigned char *out,
-					 int *outlen,
-					 const unsigned char *in,
-					 int *inlen, int quoteChar);
-XMLPUBFUN int XMLCALL			
-			htmlIsScriptAttribute(const xmlChar *name);
-XMLPUBFUN int XMLCALL			
-			htmlHandleOmittedElem(int val);
-
-#ifdef LIBXML_PUSH_ENABLED
-/**
- * Interfaces for the Push mode.
- */
-XMLPUBFUN htmlParserCtxtPtr XMLCALL	
-			htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax,
-						 void *user_data,
-						 const char *chunk,
-						 int size,
-						 const char *filename,
-						 xmlCharEncoding enc);
-XMLPUBFUN int XMLCALL			
-			htmlParseChunk		(htmlParserCtxtPtr ctxt,
-						 const char *chunk,
-						 int size,
-						 int terminate);
-#endif /* LIBXML_PUSH_ENABLED */
-
-XMLPUBFUN void XMLCALL			
-			htmlFreeParserCtxt	(htmlParserCtxtPtr ctxt);
-
-/*
- * New set of simpler/more flexible APIs
- */
-/**
- * xmlParserOption:
- *
- * This is the set of XML parser options that can be passed down
- * to the xmlReadDoc() and similar calls.
- */
-typedef enum {
-    HTML_PARSE_RECOVER  = 1<<0, /* Relaxed parsing */
-    HTML_PARSE_NOERROR	= 1<<5,	/* suppress error reports */
-    HTML_PARSE_NOWARNING= 1<<6,	/* suppress warning reports */
-    HTML_PARSE_PEDANTIC	= 1<<7,	/* pedantic error reporting */
-    HTML_PARSE_NOBLANKS	= 1<<8,	/* remove blank nodes */
-    HTML_PARSE_NONET	= 1<<11,/* Forbid network access */
-    HTML_PARSE_COMPACT  = 1<<16 /* compact small text nodes */
-} htmlParserOption;
-
-XMLPUBFUN void XMLCALL
-		htmlCtxtReset		(htmlParserCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL
-		htmlCtxtUseOptions	(htmlParserCtxtPtr ctxt,
-					 int options);
-XMLPUBFUN htmlDocPtr XMLCALL
-		htmlReadDoc		(const xmlChar *cur,
-					 const char *URL,
-					 const char *encoding,
-					 int options);
-XMLPUBFUN htmlDocPtr XMLCALL
-		htmlReadFile		(const char *URL,
-					 const char *encoding,
-					 int options);
-XMLPUBFUN htmlDocPtr XMLCALL
-		htmlReadMemory		(const char *buffer,
-					 int size,
-					 const char *URL,
-					 const char *encoding,
-					 int options);
-XMLPUBFUN htmlDocPtr XMLCALL
-		htmlReadFd		(int fd,
-					 const char *URL,
-					 const char *encoding,
-					 int options);
-XMLPUBFUN htmlDocPtr XMLCALL
-		htmlReadIO		(xmlInputReadCallback ioread,
-					 xmlInputCloseCallback ioclose,
-					 void *ioctx,
-					 const char *URL,
-					 const char *encoding,
-					 int options);
-XMLPUBFUN htmlDocPtr XMLCALL
-		htmlCtxtReadDoc		(xmlParserCtxtPtr ctxt,
-					 const xmlChar *cur,
-					 const char *URL,
-					 const char *encoding,
-					 int options);
-XMLPUBFUN htmlDocPtr XMLCALL
-		htmlCtxtReadFile		(xmlParserCtxtPtr ctxt,
-					 const char *filename,
-					 const char *encoding,
-					 int options);
-XMLPUBFUN htmlDocPtr XMLCALL
-		htmlCtxtReadMemory		(xmlParserCtxtPtr ctxt,
-					 const char *buffer,
-					 int size,
-					 const char *URL,
-					 const char *encoding,
-					 int options);
-XMLPUBFUN htmlDocPtr XMLCALL
-		htmlCtxtReadFd		(xmlParserCtxtPtr ctxt,
-					 int fd,
-					 const char *URL,
-					 const char *encoding,
-					 int options);
-XMLPUBFUN htmlDocPtr XMLCALL
-		htmlCtxtReadIO		(xmlParserCtxtPtr ctxt,
-					 xmlInputReadCallback ioread,
-					 xmlInputCloseCallback ioclose,
-					 void *ioctx,
-					 const char *URL,
-					 const char *encoding,
-					 int options);
-
-/* NRK/Jan2003: further knowledge of HTML structure
- */
-typedef enum {
-  HTML_NA = 0 ,		/* something we don't check at all */
-  HTML_INVALID = 0x1 ,
-  HTML_DEPRECATED = 0x2 ,
-  HTML_VALID = 0x4 ,
-  HTML_REQUIRED = 0xc /* VALID bit set so ( & HTML_VALID ) is TRUE */
-} htmlStatus ;
-
-/* Using htmlElemDesc rather than name here, to emphasise the fact
-   that otherwise there's a lookup overhead
-*/
-XMLPUBFUN htmlStatus XMLCALL htmlAttrAllowed(const htmlElemDesc*, const xmlChar*, int) ;
-XMLPUBFUN int XMLCALL htmlElementAllowedHere(const htmlElemDesc*, const xmlChar*) ;
-XMLPUBFUN htmlStatus XMLCALL htmlElementStatusHere(const htmlElemDesc*, const htmlElemDesc*) ;
-XMLPUBFUN htmlStatus XMLCALL htmlNodeStatus(const htmlNodePtr, int) ;
-/**
- * htmlDefaultSubelement:
- * @elt: HTML element
- *
- * Returns the default subelement for this element
- */
-#define htmlDefaultSubelement(elt) elt->defaultsubelt
-/**
- * htmlElementAllowedHereDesc:
- * @parent: HTML parent element
- * @elt: HTML element
- *
- * Checks whether an HTML element description may be a
- * direct child of the specified element.
- *
- * Returns 1 if allowed; 0 otherwise.
- */
-#define htmlElementAllowedHereDesc(parent,elt) \
-	htmlElementAllowedHere((parent), (elt)->name)
-/**
- * htmlRequiredAttrs:
- * @elt: HTML element
- *
- * Returns the attributes required for the specified element.
- */
-#define htmlRequiredAttrs(elt) (elt)->attrs_req
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LIBXML_HTML_ENABLED */
-#endif /* __HTML_PARSER_H__ */
diff --git a/interfaces/ext/libxml/HTMLtree.h b/interfaces/ext/libxml/HTMLtree.h
deleted file mode 100644
index 6ea8207..0000000
--- a/interfaces/ext/libxml/HTMLtree.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Summary: specific APIs to process HTML tree, especially serialization
- * Description: this module implements a few function needed to process
- *              tree in an HTML specific way.
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#ifndef __HTML_TREE_H__
-#define __HTML_TREE_H__
-
-#include <stdio.h>
-#include <libxml/xmlversion.h>
-#include <libxml/tree.h>
-#include <libxml/HTMLparser.h>
-
-#ifdef LIBXML_HTML_ENABLED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/**
- * HTML_TEXT_NODE:
- *
- * Macro. A text node in a HTML document is really implemented
- * the same way as a text node in an XML document.
- */
-#define HTML_TEXT_NODE		XML_TEXT_NODE
-/**
- * HTML_ENTITY_REF_NODE:
- *
- * Macro. An entity reference in a HTML document is really implemented
- * the same way as an entity reference in an XML document.
- */
-#define HTML_ENTITY_REF_NODE	XML_ENTITY_REF_NODE
-/**
- * HTML_COMMENT_NODE:
- *
- * Macro. A comment in a HTML document is really implemented
- * the same way as a comment in an XML document.
- */
-#define HTML_COMMENT_NODE	XML_COMMENT_NODE
-/**
- * HTML_PRESERVE_NODE:
- *
- * Macro. A preserved node in a HTML document is really implemented
- * the same way as a CDATA section in an XML document.
- */
-#define HTML_PRESERVE_NODE	XML_CDATA_SECTION_NODE
-/**
- * HTML_PI_NODE:
- *
- * Macro. A processing instruction in a HTML document is really implemented
- * the same way as a processing instruction in an XML document.
- */
-#define HTML_PI_NODE		XML_PI_NODE
-
-XMLPUBFUN htmlDocPtr XMLCALL
-		htmlNewDoc		(const xmlChar *URI,
-					 const xmlChar *ExternalID);
-XMLPUBFUN htmlDocPtr XMLCALL	
-		htmlNewDocNoDtD		(const xmlChar *URI,
-					 const xmlChar *ExternalID);
-XMLPUBFUN const xmlChar * XMLCALL	
-		htmlGetMetaEncoding	(htmlDocPtr doc);
-XMLPUBFUN int XMLCALL		
-		htmlSetMetaEncoding	(htmlDocPtr doc,
-					 const xmlChar *encoding);
-#ifdef LIBXML_OUTPUT_ENABLED
-XMLPUBFUN void XMLCALL	    
-		htmlDocDumpMemory	(xmlDocPtr cur,
-					 xmlChar **mem,
-					 int *size);
-XMLPUBFUN void XMLCALL	    
-		htmlDocDumpMemoryFormat	(xmlDocPtr cur,
-					 xmlChar **mem,
-					 int *size,
-					 int format);
-XMLPUBFUN int XMLCALL		
-		htmlDocDump		(FILE *f,
-					 xmlDocPtr cur);
-XMLPUBFUN int XMLCALL		
-		htmlSaveFile		(const char *filename,
-					 xmlDocPtr cur);
-XMLPUBFUN int XMLCALL		
-		htmlNodeDump		(xmlBufferPtr buf,
-					 xmlDocPtr doc,
-					 xmlNodePtr cur);
-XMLPUBFUN void XMLCALL		
-		htmlNodeDumpFile	(FILE *out,
-					 xmlDocPtr doc,
-					 xmlNodePtr cur);
-XMLPUBFUN int XMLCALL		
-		htmlNodeDumpFileFormat	(FILE *out,
-					 xmlDocPtr doc,
-					 xmlNodePtr cur,
-					 const char *encoding,
-					 int format);
-XMLPUBFUN int XMLCALL		
-		htmlSaveFileEnc		(const char *filename,
-					 xmlDocPtr cur,
-					 const char *encoding);
-XMLPUBFUN int XMLCALL		
-		htmlSaveFileFormat	(const char *filename,
-					 xmlDocPtr cur,
-					 const char *encoding,
-					 int format);
-
-XMLPUBFUN void XMLCALL		
-		htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf,
-					 xmlDocPtr doc,
-					 xmlNodePtr cur,
-					 const char *encoding,
-					 int format);
-XMLPUBFUN void XMLCALL		
-		htmlDocContentDumpOutput(xmlOutputBufferPtr buf,
-					 xmlDocPtr cur,
-					 const char *encoding);
-XMLPUBFUN void XMLCALL		
-		htmlDocContentDumpFormatOutput(xmlOutputBufferPtr buf,
-					 xmlDocPtr cur,
-					 const char *encoding,
-					 int format);
-XMLPUBFUN void XMLCALL 
-		htmlNodeDumpOutput	(xmlOutputBufferPtr buf, 
-					 xmlDocPtr doc,
-					 xmlNodePtr cur, 
-					 const char *encoding);
-
-#endif /* LIBXML_OUTPUT_ENABLED */
-
-XMLPUBFUN int XMLCALL		
-		htmlIsBooleanAttr	(const xmlChar *name);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LIBXML_HTML_ENABLED */
-
-#endif /* __HTML_TREE_H__ */
-
diff --git a/interfaces/ext/libxml/SAX.h b/interfaces/ext/libxml/SAX.h
deleted file mode 100644
index 0ca161b..0000000
--- a/interfaces/ext/libxml/SAX.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Summary: Old SAX version 1 handler, deprecated
- * Description: DEPRECATED set of SAX version 1 interfaces used to
- *              build the DOM tree.
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-
-#ifndef __XML_SAX_H__
-#define __XML_SAX_H__
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <libxml/xmlversion.h>
-#include <libxml/parser.h>
-#include <libxml/xlink.h>
-
-#ifdef LIBXML_LEGACY_ENABLED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-XMLPUBFUN const xmlChar * XMLCALL
-		getPublicId			(void *ctx);
-XMLPUBFUN const xmlChar * XMLCALL	
-		getSystemId			(void *ctx);
-XMLPUBFUN void XMLCALL		
-		setDocumentLocator		(void *ctx,
-						 xmlSAXLocatorPtr loc);
-    
-XMLPUBFUN int XMLCALL		
-		getLineNumber			(void *ctx);
-XMLPUBFUN int XMLCALL		
-		getColumnNumber			(void *ctx);
-
-XMLPUBFUN int XMLCALL		
-		isStandalone			(void *ctx);
-XMLPUBFUN int XMLCALL		
-		hasInternalSubset		(void *ctx);
-XMLPUBFUN int XMLCALL		
-		hasExternalSubset		(void *ctx);
-
-XMLPUBFUN void XMLCALL		
-		internalSubset			(void *ctx,
-						 const xmlChar *name,
-						 const xmlChar *ExternalID,
-						 const xmlChar *SystemID);
-XMLPUBFUN void XMLCALL		
-		externalSubset			(void *ctx,
-						 const xmlChar *name,
-						 const xmlChar *ExternalID,
-						 const xmlChar *SystemID);
-XMLPUBFUN xmlEntityPtr XMLCALL	
-		getEntity			(void *ctx,
-						 const xmlChar *name);
-XMLPUBFUN xmlEntityPtr XMLCALL	
-		getParameterEntity		(void *ctx,
-						 const xmlChar *name);
-XMLPUBFUN xmlParserInputPtr XMLCALL 
-		resolveEntity			(void *ctx,
-						 const xmlChar *publicId,
-						 const xmlChar *systemId);
-
-XMLPUBFUN void XMLCALL		
-		entityDecl			(void *ctx,
-						 const xmlChar *name,
-						 int type,
-						 const xmlChar *publicId,
-						 const xmlChar *systemId,
-						 xmlChar *content);
-XMLPUBFUN void XMLCALL		
-		attributeDecl			(void *ctx,
-						 const xmlChar *elem,
-						 const xmlChar *fullname,
-						 int type,
-						 int def,
-						 const xmlChar *defaultValue,
-						 xmlEnumerationPtr tree);
-XMLPUBFUN void XMLCALL		
-		elementDecl			(void *ctx,
-						 const xmlChar *name,
-						 int type,
-						 xmlElementContentPtr content);
-XMLPUBFUN void XMLCALL		
-		notationDecl			(void *ctx,
-						 const xmlChar *name,
-						 const xmlChar *publicId,
-						 const xmlChar *systemId);
-XMLPUBFUN void XMLCALL		
-		unparsedEntityDecl		(void *ctx,
-						 const xmlChar *name,
-						 const xmlChar *publicId,
-						 const xmlChar *systemId,
-						 const xmlChar *notationName);
-
-XMLPUBFUN void XMLCALL		
-		startDocument			(void *ctx);
-XMLPUBFUN void XMLCALL		
-		endDocument			(void *ctx);
-XMLPUBFUN void XMLCALL		
-		attribute			(void *ctx,
-						 const xmlChar *fullname,
-						 const xmlChar *value);
-XMLPUBFUN void XMLCALL		
-		startElement			(void *ctx,
-						 const xmlChar *fullname,
-						 const xmlChar **atts);
-XMLPUBFUN void XMLCALL		
-		endElement			(void *ctx,
-						 const xmlChar *name);
-XMLPUBFUN void XMLCALL		
-		reference			(void *ctx,
-						 const xmlChar *name);
-XMLPUBFUN void XMLCALL		
-		characters			(void *ctx,
-						 const xmlChar *ch,
-						 int len);
-XMLPUBFUN void XMLCALL		
-		ignorableWhitespace		(void *ctx,
-						 const xmlChar *ch,
-						 int len);
-XMLPUBFUN void XMLCALL		
-		processingInstruction		(void *ctx,
-						 const xmlChar *target,
-						 const xmlChar *data);
-XMLPUBFUN void XMLCALL		
-		globalNamespace			(void *ctx,
-						 const xmlChar *href,
-						 const xmlChar *prefix);
-XMLPUBFUN void XMLCALL		
-		setNamespace			(void *ctx,
-						 const xmlChar *name);
-XMLPUBFUN xmlNsPtr XMLCALL	
-		getNamespace			(void *ctx);
-XMLPUBFUN int XMLCALL		
-		checkNamespace			(void *ctx,
-						 xmlChar *nameSpace);
-XMLPUBFUN void XMLCALL		
-		namespaceDecl			(void *ctx,
-						 const xmlChar *href,
-						 const xmlChar *prefix);
-XMLPUBFUN void XMLCALL		
-		comment				(void *ctx,
-						 const xmlChar *value);
-XMLPUBFUN void XMLCALL		
-		cdataBlock			(void *ctx,
-						 const xmlChar *value,
-						 int len);
-
-#ifdef LIBXML_SAX1_ENABLED
-XMLPUBFUN void XMLCALL		
-		initxmlDefaultSAXHandler	(xmlSAXHandlerV1 *hdlr,
-						 int warning);
-#ifdef LIBXML_HTML_ENABLED
-XMLPUBFUN void XMLCALL		
-		inithtmlDefaultSAXHandler	(xmlSAXHandlerV1 *hdlr);
-#endif
-#ifdef LIBXML_DOCB_ENABLED
-XMLPUBFUN void XMLCALL		
-		initdocbDefaultSAXHandler	(xmlSAXHandlerV1 *hdlr);
-#endif
-#endif /* LIBXML_SAX1_ENABLED */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LIBXML_LEGACY_ENABLED */
-
-#endif /* __XML_SAX_H__ */
diff --git a/interfaces/ext/libxml/SAX2.h b/interfaces/ext/libxml/SAX2.h
deleted file mode 100644
index 8d2db02..0000000
--- a/interfaces/ext/libxml/SAX2.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Summary: SAX2 parser interface used to build the DOM tree
- * Description: those are the default SAX2 interfaces used by
- *              the library when building DOM tree.
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-
-#ifndef __XML_SAX2_H__
-#define __XML_SAX2_H__
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <libxml/xmlversion.h>
-#include <libxml/parser.h>
-#include <libxml/xlink.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-XMLPUBFUN const xmlChar * XMLCALL
-		xmlSAX2GetPublicId		(void *ctx);
-XMLPUBFUN const xmlChar * XMLCALL	
-		xmlSAX2GetSystemId		(void *ctx);
-XMLPUBFUN void XMLCALL		
-		xmlSAX2SetDocumentLocator	(void *ctx,
-						 xmlSAXLocatorPtr loc);
-    
-XMLPUBFUN int XMLCALL		
-		xmlSAX2GetLineNumber		(void *ctx);
-XMLPUBFUN int XMLCALL		
-		xmlSAX2GetColumnNumber		(void *ctx);
-
-XMLPUBFUN int XMLCALL		
-		xmlSAX2IsStandalone		(void *ctx);
-XMLPUBFUN int XMLCALL		
-		xmlSAX2HasInternalSubset	(void *ctx);
-XMLPUBFUN int XMLCALL		
-		xmlSAX2HasExternalSubset	(void *ctx);
-
-XMLPUBFUN void XMLCALL		
-		xmlSAX2InternalSubset		(void *ctx,
-						 const xmlChar *name,
-						 const xmlChar *ExternalID,
-						 const xmlChar *SystemID);
-XMLPUBFUN void XMLCALL		
-		xmlSAX2ExternalSubset		(void *ctx,
-						 const xmlChar *name,
-						 const xmlChar *ExternalID,
-						 const xmlChar *SystemID);
-XMLPUBFUN xmlEntityPtr XMLCALL	
-		xmlSAX2GetEntity		(void *ctx,
-						 const xmlChar *name);
-XMLPUBFUN xmlEntityPtr XMLCALL	
-		xmlSAX2GetParameterEntity	(void *ctx,
-						 const xmlChar *name);
-XMLPUBFUN xmlParserInputPtr XMLCALL 
-		xmlSAX2ResolveEntity		(void *ctx,
-						 const xmlChar *publicId,
-						 const xmlChar *systemId);
-
-XMLPUBFUN void XMLCALL		
-		xmlSAX2EntityDecl		(void *ctx,
-						 const xmlChar *name,
-						 int type,
-						 const xmlChar *publicId,
-						 const xmlChar *systemId,
-						 xmlChar *content);
-XMLPUBFUN void XMLCALL		
-		xmlSAX2AttributeDecl		(void *ctx,
-						 const xmlChar *elem,
-						 const xmlChar *fullname,
-						 int type,
-						 int def,
-						 const xmlChar *defaultValue,
-						 xmlEnumerationPtr tree);
-XMLPUBFUN void XMLCALL		
-		xmlSAX2ElementDecl		(void *ctx,
-						 const xmlChar *name,
-						 int type,
-						 xmlElementContentPtr content);
-XMLPUBFUN void XMLCALL		
-		xmlSAX2NotationDecl		(void *ctx,
-						 const xmlChar *name,
-						 const xmlChar *publicId,
-						 const xmlChar *systemId);
-XMLPUBFUN void XMLCALL		
-		xmlSAX2UnparsedEntityDecl	(void *ctx,
-						 const xmlChar *name,
-						 const xmlChar *publicId,
-						 const xmlChar *systemId,
-						 const xmlChar *notationName);
-
-XMLPUBFUN void XMLCALL		
-		xmlSAX2StartDocument		(void *ctx);
-XMLPUBFUN void XMLCALL		
-		xmlSAX2EndDocument		(void *ctx);
-#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED)
-XMLPUBFUN void XMLCALL		
-		xmlSAX2StartElement		(void *ctx,
-						 const xmlChar *fullname,
-						 const xmlChar **atts);
-XMLPUBFUN void XMLCALL		
-		xmlSAX2EndElement		(void *ctx,
-						 const xmlChar *name);
-#endif /* LIBXML_SAX1_ENABLED or LIBXML_HTML_ENABLED */
-XMLPUBFUN void XMLCALL
-		xmlSAX2StartElementNs		(void *ctx,
-						 const xmlChar *localname,
-						 const xmlChar *prefix,
-						 const xmlChar *URI,
-						 int nb_namespaces,
-						 const xmlChar **namespaces,
-						 int nb_attributes,
-						 int nb_defaulted,
-						 const xmlChar **attributes);
-XMLPUBFUN void XMLCALL
-		xmlSAX2EndElementNs		(void *ctx,
-						 const xmlChar *localname,
-						 const xmlChar *prefix,
-						 const xmlChar *URI);
-XMLPUBFUN void XMLCALL		
-		xmlSAX2Reference		(void *ctx,
-						 const xmlChar *name);
-XMLPUBFUN void XMLCALL		
-		xmlSAX2Characters		(void *ctx,
-						 const xmlChar *ch,
-						 int len);
-XMLPUBFUN void XMLCALL		
-		xmlSAX2IgnorableWhitespace	(void *ctx,
-						 const xmlChar *ch,
-						 int len);
-XMLPUBFUN void XMLCALL		
-		xmlSAX2ProcessingInstruction	(void *ctx,
-						 const xmlChar *target,
-						 const xmlChar *data);
-XMLPUBFUN void XMLCALL		
-		xmlSAX2Comment			(void *ctx,
-						 const xmlChar *value);
-XMLPUBFUN void XMLCALL		
-		xmlSAX2CDataBlock		(void *ctx,
-						 const xmlChar *value,
-						 int len);
-
-#ifdef LIBXML_SAX1_ENABLED
-XMLPUBFUN int XMLCALL
-		xmlSAXDefaultVersion		(int version);
-#endif /* LIBXML_SAX1_ENABLED */
-
-XMLPUBFUN int XMLCALL
-		xmlSAXVersion			(xmlSAXHandler *hdlr,
-						 int version);
-XMLPUBFUN void XMLCALL		
-		xmlSAX2InitDefaultSAXHandler    (xmlSAXHandler *hdlr,
-						 int warning);
-#ifdef LIBXML_HTML_ENABLED
-XMLPUBFUN void XMLCALL		
-		xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr);
-XMLPUBFUN void XMLCALL		
-		htmlDefaultSAXHandlerInit	(void);
-#endif
-#ifdef LIBXML_DOCB_ENABLED
-XMLPUBFUN void XMLCALL		
-		xmlSAX2InitDocbDefaultSAXHandler(xmlSAXHandler *hdlr);
-XMLPUBFUN void XMLCALL		
-		docbDefaultSAXHandlerInit	(void);
-#endif
-XMLPUBFUN void XMLCALL		
-		xmlDefaultSAXHandlerInit	(void);
-#ifdef __cplusplus
-}
-#endif
-#endif /* __XML_SAX2_H__ */
diff --git a/interfaces/ext/libxml/c14n.h b/interfaces/ext/libxml/c14n.h
deleted file mode 100644
index a8aa737..0000000
--- a/interfaces/ext/libxml/c14n.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Summary: Provide Canonical XML and Exclusive XML Canonicalization
- * Description: the c14n modules provides a
- *
- * "Canonical XML" implementation
- * http://www.w3.org/TR/xml-c14n
- *
- * and an
- *
- * "Exclusive XML Canonicalization" implementation
- * http://www.w3.org/TR/xml-exc-c14n
-
- * Copy: See Copyright for the status of this software.
- *
- * Author: Aleksey Sanin <aleksey at aleksey.com>
- */
-#ifndef __XML_C14N_H__
-#define __XML_C14N_H__
-#ifdef LIBXML_C14N_ENABLED
-#ifdef LIBXML_OUTPUT_ENABLED
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#include <libxml/xmlversion.h>
-#include <libxml/tree.h>
-#include <libxml/xpath.h>
-
-/*
- * XML Canonicazation
- * http://www.w3.org/TR/xml-c14n
- *
- * Exclusive XML Canonicazation
- * http://www.w3.org/TR/xml-exc-c14n
- *
- * Canonical form of an XML document could be created if and only if
- *  a) default attributes (if any) are added to all nodes
- *  b) all character and parsed entity references are resolved
- * In order to achive this in libxml2 the document MUST be loaded with
- * following global setings:
- *
- *    xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
- *    xmlSubstituteEntitiesDefault(1);
- *
- * or corresponding parser context setting:
- *    xmlParserCtxtPtr ctxt;
- *
- *    ...
- *    ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
- *    ctxt->replaceEntities = 1;
- *    ...
- */
-
-
-XMLPUBFUN int XMLCALL
-		xmlC14NDocSaveTo	(xmlDocPtr doc,
-					 xmlNodeSetPtr nodes,
-					 int exclusive,
-					 xmlChar **inclusive_ns_prefixes,
-					 int with_comments,
-					 xmlOutputBufferPtr buf);
-
-XMLPUBFUN int XMLCALL
-		xmlC14NDocDumpMemory	(xmlDocPtr doc,
-					 xmlNodeSetPtr nodes,
-					 int exclusive,
-					 xmlChar **inclusive_ns_prefixes,
-					 int with_comments,
-					 xmlChar **doc_txt_ptr);
-
-XMLPUBFUN int XMLCALL
-		xmlC14NDocSave		(xmlDocPtr doc,
-					 xmlNodeSetPtr nodes,
-					 int exclusive,
-					 xmlChar **inclusive_ns_prefixes,
-					 int with_comments,
-					 const char* filename,
-					 int compression);
-
-
-/**
- * This is the core C14N function
- */
-/**
- * xmlC14NIsVisibleCallback:
- * @user_data: user data
- * @node: the curent node
- * @parent: the parent node
- *
- * Signature for a C14N callback on visible nodes
- *
- * Returns 1 if the node should be included
- */
-typedef int (*xmlC14NIsVisibleCallback)	(void* user_data,
-					 xmlNodePtr node,
-					 xmlNodePtr parent);
-
-XMLPUBFUN int XMLCALL
-		xmlC14NExecute		(xmlDocPtr doc,
-					 xmlC14NIsVisibleCallback is_visible_callback,
-					 void* user_data,
-					 int exclusive,
-					 xmlChar **inclusive_ns_prefixes,
-					 int with_comments,
-					 xmlOutputBufferPtr buf);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* LIBXML_OUTPUT_ENABLED */
-#endif /* LIBXML_C14N_ENABLED */
-#endif /* __XML_C14N_H__ */
-
diff --git a/interfaces/ext/libxml/catalog.h b/interfaces/ext/libxml/catalog.h
deleted file mode 100644
index b444137..0000000
--- a/interfaces/ext/libxml/catalog.h
+++ /dev/null
@@ -1,182 +0,0 @@
-/**
- * Summary: interfaces to the Catalog handling system
- * Description: the catalog module implements the support for
- * XML Catalogs and SGML catalogs
- *
- * SGML Open Technical Resolution TR9401:1997.
- * http://www.jclark.com/sp/catalog.htm
- *
- * XML Catalogs Working Draft 06 August 2001
- * http://www.oasis-open.org/committees/entity/spec-2001-08-06.html
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#ifndef __XML_CATALOG_H__
-#define __XML_CATALOG_H__
-
-#include <stdio.h>
-
-#include <libxml/xmlversion.h>
-#include <libxml/xmlstring.h>
-#include <libxml/tree.h>
-
-#ifdef LIBXML_CATALOG_ENABLED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * XML_CATALOGS_NAMESPACE:
- *
- * The namespace for the XML Catalogs elements.
- */
-#define XML_CATALOGS_NAMESPACE					\
-    (const xmlChar *) "urn:oasis:names:tc:entity:xmlns:xml:catalog"
-/**
- * XML_CATALOG_PI:
- *
- * The specific XML Catalog Processing Instuction name.
- */
-#define XML_CATALOG_PI						\
-    (const xmlChar *) "oasis-xml-catalog"
-
-/*
- * The API is voluntarily limited to general cataloging.
- */
-typedef enum {
-    XML_CATA_PREFER_NONE = 0,
-    XML_CATA_PREFER_PUBLIC = 1,
-    XML_CATA_PREFER_SYSTEM
-} xmlCatalogPrefer;
-
-typedef enum {
-    XML_CATA_ALLOW_NONE = 0,
-    XML_CATA_ALLOW_GLOBAL = 1,
-    XML_CATA_ALLOW_DOCUMENT = 2,
-    XML_CATA_ALLOW_ALL = 3
-} xmlCatalogAllow;
-
-typedef struct _xmlCatalog xmlCatalog;
-typedef xmlCatalog *xmlCatalogPtr;
-
-/*
- * Operations on a given catalog.
- */
-XMLPUBFUN xmlCatalogPtr XMLCALL
-		xmlNewCatalog		(int sgml);
-XMLPUBFUN xmlCatalogPtr XMLCALL	
-		xmlLoadACatalog		(const char *filename);
-XMLPUBFUN xmlCatalogPtr XMLCALL	
-		xmlLoadSGMLSuperCatalog	(const char *filename);
-XMLPUBFUN int XMLCALL		
-		xmlConvertSGMLCatalog	(xmlCatalogPtr catal);
-XMLPUBFUN int XMLCALL		
-		xmlACatalogAdd		(xmlCatalogPtr catal,
-					 const xmlChar *type,
-					 const xmlChar *orig,
-					 const xmlChar *replace);
-XMLPUBFUN int XMLCALL		
-		xmlACatalogRemove	(xmlCatalogPtr catal,
-					 const xmlChar *value);
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlACatalogResolve	(xmlCatalogPtr catal,
-					 const xmlChar *pubID,
-	                                 const xmlChar *sysID);
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlACatalogResolveSystem(xmlCatalogPtr catal,
-					 const xmlChar *sysID);
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlACatalogResolvePublic(xmlCatalogPtr catal,
-					 const xmlChar *pubID);
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlACatalogResolveURI	(xmlCatalogPtr catal,
-					 const xmlChar *URI);
-#ifdef LIBXML_OUTPUT_ENABLED
-XMLPUBFUN void XMLCALL		
-		xmlACatalogDump		(xmlCatalogPtr catal,
-					 FILE *out);
-#endif /* LIBXML_OUTPUT_ENABLED */
-XMLPUBFUN void XMLCALL		
-		xmlFreeCatalog		(xmlCatalogPtr catal);
-XMLPUBFUN int XMLCALL		
-		xmlCatalogIsEmpty	(xmlCatalogPtr catal);
-
-/*
- * Global operations.
- */
-XMLPUBFUN void XMLCALL		
-		xmlInitializeCatalog	(void);
-XMLPUBFUN int XMLCALL		
-		xmlLoadCatalog		(const char *filename);
-XMLPUBFUN void XMLCALL		
-		xmlLoadCatalogs		(const char *paths);
-XMLPUBFUN void XMLCALL		
-		xmlCatalogCleanup	(void);
-#ifdef LIBXML_OUTPUT_ENABLED
-XMLPUBFUN void XMLCALL		
-		xmlCatalogDump		(FILE *out);
-#endif /* LIBXML_OUTPUT_ENABLED */
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlCatalogResolve	(const xmlChar *pubID,
-	                                 const xmlChar *sysID);
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlCatalogResolveSystem	(const xmlChar *sysID);
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlCatalogResolvePublic	(const xmlChar *pubID);
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlCatalogResolveURI	(const xmlChar *URI);
-XMLPUBFUN int XMLCALL		
-		xmlCatalogAdd		(const xmlChar *type,
-					 const xmlChar *orig,
-					 const xmlChar *replace);
-XMLPUBFUN int XMLCALL		
-		xmlCatalogRemove	(const xmlChar *value);
-XMLPUBFUN xmlDocPtr XMLCALL	
-		xmlParseCatalogFile	(const char *filename);
-XMLPUBFUN int XMLCALL		
-		xmlCatalogConvert	(void);
-
-/*
- * Strictly minimal interfaces for per-document catalogs used
- * by the parser.
- */
-XMLPUBFUN void XMLCALL		
-		xmlCatalogFreeLocal	(void *catalogs);
-XMLPUBFUN void * XMLCALL		
-		xmlCatalogAddLocal	(void *catalogs,
-					 const xmlChar *URL);
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlCatalogLocalResolve	(void *catalogs,
-					 const xmlChar *pubID,
-	                                 const xmlChar *sysID);
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlCatalogLocalResolveURI(void *catalogs,
-					 const xmlChar *URI);
-/*
- * Preference settings.
- */
-XMLPUBFUN int XMLCALL		
-		xmlCatalogSetDebug	(int level);
-XMLPUBFUN xmlCatalogPrefer XMLCALL 
-		xmlCatalogSetDefaultPrefer(xmlCatalogPrefer prefer);
-XMLPUBFUN void XMLCALL		
-		xmlCatalogSetDefaults	(xmlCatalogAllow allow);
-XMLPUBFUN xmlCatalogAllow XMLCALL	
-		xmlCatalogGetDefaults	(void);
-
-
-/* DEPRECATED interfaces */
-XMLPUBFUN const xmlChar * XMLCALL	
-		xmlCatalogGetSystem	(const xmlChar *sysID);
-XMLPUBFUN const xmlChar * XMLCALL	
-		xmlCatalogGetPublic	(const xmlChar *pubID);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* LIBXML_CATALOG_ENABLED */
-#endif /* __XML_CATALOG_H__ */
diff --git a/interfaces/ext/libxml/chvalid.h b/interfaces/ext/libxml/chvalid.h
deleted file mode 100644
index fb43016..0000000
--- a/interfaces/ext/libxml/chvalid.h
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Summary: Unicode character range checking
- * Description: this module exports interfaces for the character
- *               range validation APIs
- *
- * This file is automatically generated from the cvs source
- * definition files using the genChRanges.py Python script
- *
- * Generation date: Mon Mar 27 11:09:48 2006
- * Sources: chvalid.def
- * Author: William Brack <wbrack at mmm.com.hk>
- */
-
-#ifndef __XML_CHVALID_H__
-#define __XML_CHVALID_H__
-
-#include <libxml/xmlversion.h>
-#include <libxml/xmlstring.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Define our typedefs and structures
- *
- */
-typedef struct _xmlChSRange xmlChSRange;
-typedef xmlChSRange *xmlChSRangePtr;
-struct _xmlChSRange {
-    unsigned short	low;
-    unsigned short	high;
-};
-
-typedef struct _xmlChLRange xmlChLRange;
-typedef xmlChLRange *xmlChLRangePtr;
-struct _xmlChLRange {
-    unsigned int	low;
-    unsigned int	high;
-};
-
-typedef struct _xmlChRangeGroup xmlChRangeGroup;
-typedef xmlChRangeGroup *xmlChRangeGroupPtr;
-struct _xmlChRangeGroup {
-    int			nbShortRange;
-    int			nbLongRange;
-    const xmlChSRange	*shortRange;	/* points to an array of ranges */
-    const xmlChLRange	*longRange;
-};
-
-/**
- * Range checking routine
- */
-XMLPUBFUN int XMLCALL
-		xmlCharInRange(unsigned int val, const xmlChRangeGroup *group);
-
-
-/**
- * xmlIsBaseChar_ch:
- * @c: char to validate
- *
- * Automatically generated by genChRanges.py
- */
-#define xmlIsBaseChar_ch(c)	(((0x41 <= (c)) && ((c) <= 0x5a)) || \
-				 ((0x61 <= (c)) && ((c) <= 0x7a)) || \
-				 ((0xc0 <= (c)) && ((c) <= 0xd6)) || \
-				 ((0xd8 <= (c)) && ((c) <= 0xf6)) || \
-				  (0xf8 <= (c)))
-
-/**
- * xmlIsBaseCharQ:
- * @c: char to validate
- *
- * Automatically generated by genChRanges.py
- */
-#define xmlIsBaseCharQ(c)	(((c) < 0x100) ? \
-				 xmlIsBaseChar_ch((c)) : \
-				 xmlCharInRange((c), &xmlIsBaseCharGroup))
-
-XMLPUBVAR const xmlChRangeGroup xmlIsBaseCharGroup;
-
-/**
- * xmlIsBlank_ch:
- * @c: char to validate
- *
- * Automatically generated by genChRanges.py
- */
-#define xmlIsBlank_ch(c)	(((c) == 0x20) || \
-				 ((0x9 <= (c)) && ((c) <= 0xa)) || \
-				 ((c) == 0xd))
-
-/**
- * xmlIsBlankQ:
- * @c: char to validate
- *
- * Automatically generated by genChRanges.py
- */
-#define xmlIsBlankQ(c)		(((c) < 0x100) ? \
-				 xmlIsBlank_ch((c)) : 0)
-
-
-/**
- * xmlIsChar_ch:
- * @c: char to validate
- *
- * Automatically generated by genChRanges.py
- */
-#define xmlIsChar_ch(c)		(((0x9 <= (c)) && ((c) <= 0xa)) || \
-				 ((c) == 0xd) || \
-				  (0x20 <= (c)))
-
-/**
- * xmlIsCharQ:
- * @c: char to validate
- *
- * Automatically generated by genChRanges.py
- */
-#define xmlIsCharQ(c)		(((c) < 0x100) ? \
-				 xmlIsChar_ch((c)) :\
-				(((0x100 <= (c)) && ((c) <= 0xd7ff)) || \
-				 ((0xe000 <= (c)) && ((c) <= 0xfffd)) || \
-				 ((0x10000 <= (c)) && ((c) <= 0x10ffff))))
-
-XMLPUBVAR const xmlChRangeGroup xmlIsCharGroup;
-
-/**
- * xmlIsCombiningQ:
- * @c: char to validate
- *
- * Automatically generated by genChRanges.py
- */
-#define xmlIsCombiningQ(c)	(((c) < 0x100) ? \
-				 0 : \
-				 xmlCharInRange((c), &xmlIsCombiningGroup))
-
-XMLPUBVAR const xmlChRangeGroup xmlIsCombiningGroup;
-
-/**
- * xmlIsDigit_ch:
- * @c: char to validate
- *
- * Automatically generated by genChRanges.py
- */
-#define xmlIsDigit_ch(c)	(((0x30 <= (c)) && ((c) <= 0x39)))
-
-/**
- * xmlIsDigitQ:
- * @c: char to validate
- *
- * Automatically generated by genChRanges.py
- */
-#define xmlIsDigitQ(c)		(((c) < 0x100) ? \
-				 xmlIsDigit_ch((c)) : \
-				 xmlCharInRange((c), &xmlIsDigitGroup))
-
-XMLPUBVAR const xmlChRangeGroup xmlIsDigitGroup;
-
-/**
- * xmlIsExtender_ch:
- * @c: char to validate
- *
- * Automatically generated by genChRanges.py
- */
-#define xmlIsExtender_ch(c)	(((c) == 0xb7))
-
-/**
- * xmlIsExtenderQ:
- * @c: char to validate
- *
- * Automatically generated by genChRanges.py
- */
-#define xmlIsExtenderQ(c)	(((c) < 0x100) ? \
-				 xmlIsExtender_ch((c)) : \
-				 xmlCharInRange((c), &xmlIsExtenderGroup))
-
-XMLPUBVAR const xmlChRangeGroup xmlIsExtenderGroup;
-
-/**
- * xmlIsIdeographicQ:
- * @c: char to validate
- *
- * Automatically generated by genChRanges.py
- */
-#define xmlIsIdeographicQ(c)	(((c) < 0x100) ? \
-				 0 :\
-				(((0x4e00 <= (c)) && ((c) <= 0x9fa5)) || \
-				 ((c) == 0x3007) || \
-				 ((0x3021 <= (c)) && ((c) <= 0x3029))))
-
-XMLPUBVAR const xmlChRangeGroup xmlIsIdeographicGroup;
-XMLPUBVAR const unsigned char xmlIsPubidChar_tab[256];
-
-/**
- * xmlIsPubidChar_ch:
- * @c: char to validate
- *
- * Automatically generated by genChRanges.py
- */
-#define xmlIsPubidChar_ch(c)	(xmlIsPubidChar_tab[(c)])
-
-/**
- * xmlIsPubidCharQ:
- * @c: char to validate
- *
- * Automatically generated by genChRanges.py
- */
-#define xmlIsPubidCharQ(c)	(((c) < 0x100) ? \
-				 xmlIsPubidChar_ch((c)) : 0)
-
-XMLPUBFUN int XMLCALL
-		xmlIsBaseChar(unsigned int ch);
-XMLPUBFUN int XMLCALL
-		xmlIsBlank(unsigned int ch);
-XMLPUBFUN int XMLCALL
-		xmlIsChar(unsigned int ch);
-XMLPUBFUN int XMLCALL
-		xmlIsCombining(unsigned int ch);
-XMLPUBFUN int XMLCALL
-		xmlIsDigit(unsigned int ch);
-XMLPUBFUN int XMLCALL
-		xmlIsExtender(unsigned int ch);
-XMLPUBFUN int XMLCALL
-		xmlIsIdeographic(unsigned int ch);
-XMLPUBFUN int XMLCALL
-		xmlIsPubidChar(unsigned int ch);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __XML_CHVALID_H__ */
diff --git a/interfaces/ext/libxml/debugXML.h b/interfaces/ext/libxml/debugXML.h
deleted file mode 100644
index 5a9d20b..0000000
--- a/interfaces/ext/libxml/debugXML.h
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * Summary: Tree debugging APIs
- * Description: Interfaces to a set of routines used for debugging the tree
- *              produced by the XML parser.
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#ifndef __DEBUG_XML__
-#define __DEBUG_XML__
-#include <stdio.h>
-#include <libxml/xmlversion.h>
-#include <libxml/tree.h>
-
-#ifdef LIBXML_DEBUG_ENABLED
-
-#include <libxml/xpath.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * The standard Dump routines.
- */
-XMLPUBFUN void XMLCALL	
-	xmlDebugDumpString	(FILE *output,
-				 const xmlChar *str);
-XMLPUBFUN void XMLCALL	
-	xmlDebugDumpAttr	(FILE *output,
-				 xmlAttrPtr attr,
-				 int depth);
-XMLPUBFUN void XMLCALL	
-	xmlDebugDumpAttrList	(FILE *output,
-				 xmlAttrPtr attr,
-				 int depth);
-XMLPUBFUN void XMLCALL	
-	xmlDebugDumpOneNode	(FILE *output,
-				 xmlNodePtr node,
-				 int depth);
-XMLPUBFUN void XMLCALL
-	xmlDebugDumpNode	(FILE *output,
-				 xmlNodePtr node,
-				 int depth);
-XMLPUBFUN void XMLCALL
-	xmlDebugDumpNodeList	(FILE *output,
-				 xmlNodePtr node,
-				 int depth);
-XMLPUBFUN void XMLCALL
-	xmlDebugDumpDocumentHead(FILE *output,
-				 xmlDocPtr doc);
-XMLPUBFUN void XMLCALL
-	xmlDebugDumpDocument	(FILE *output,
-				 xmlDocPtr doc);
-XMLPUBFUN void XMLCALL	
-	xmlDebugDumpDTD		(FILE *output,
-				 xmlDtdPtr dtd);
-XMLPUBFUN void XMLCALL	
-	xmlDebugDumpEntities	(FILE *output,
-				 xmlDocPtr doc);
-
-/****************************************************************
- *								*
- *	 		Checking routines			*
- *								*
- ****************************************************************/
-
-XMLPUBFUN int XMLCALL
-	xmlDebugCheckDocument	(FILE * output,
-				 xmlDocPtr doc);
-
-/****************************************************************
- *								*
- *	 		XML shell helpers			*
- *								*
- ****************************************************************/
-
-XMLPUBFUN void XMLCALL	
-	xmlLsOneNode		(FILE *output, xmlNodePtr node);
-XMLPUBFUN int XMLCALL	
-	xmlLsCountNode		(xmlNodePtr node);
-
-XMLPUBFUN const char * XMLCALL 
-	xmlBoolToText		(int boolval);
-
-/****************************************************************
- *								*
- *	 The XML shell related structures and functions		*
- *								*
- ****************************************************************/
-
-#ifdef LIBXML_XPATH_ENABLED
-/**
- * xmlShellReadlineFunc:
- * @prompt:  a string prompt
- *
- * This is a generic signature for the XML shell input function.
- *
- * Returns a string which will be freed by the Shell.
- */
-typedef char * (* xmlShellReadlineFunc)(char *prompt);
-
-/**
- * xmlShellCtxt:
- *
- * A debugging shell context.
- * TODO: add the defined function tables.
- */
-typedef struct _xmlShellCtxt xmlShellCtxt;
-typedef xmlShellCtxt *xmlShellCtxtPtr;
-struct _xmlShellCtxt {
-    char *filename;
-    xmlDocPtr doc;
-    xmlNodePtr node;
-    xmlXPathContextPtr pctxt;
-    int loaded;
-    FILE *output;
-    xmlShellReadlineFunc input;
-};
-
-/**
- * xmlShellCmd:
- * @ctxt:  a shell context
- * @arg:  a string argument
- * @node:  a first node
- * @node2:  a second node
- *
- * This is a generic signature for the XML shell functions.
- *
- * Returns an int, negative returns indicating errors.
- */
-typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt,
-                             char *arg,
-			     xmlNodePtr node,
-			     xmlNodePtr node2);
-
-XMLPUBFUN void XMLCALL	
-	xmlShellPrintXPathError	(int errorType,
-				 const char *arg);
-XMLPUBFUN void XMLCALL	
-	xmlShellPrintXPathResult(xmlXPathObjectPtr list);
-XMLPUBFUN int XMLCALL	
-	xmlShellList		(xmlShellCtxtPtr ctxt,
-				 char *arg,
-				 xmlNodePtr node,
-				 xmlNodePtr node2);
-XMLPUBFUN int XMLCALL	
-	xmlShellBase		(xmlShellCtxtPtr ctxt,
-				 char *arg,
-				 xmlNodePtr node,
-				 xmlNodePtr node2);
-XMLPUBFUN int XMLCALL	
-	xmlShellDir		(xmlShellCtxtPtr ctxt,
-				 char *arg,
-				 xmlNodePtr node,
-				 xmlNodePtr node2);
-XMLPUBFUN int XMLCALL	
-	xmlShellLoad		(xmlShellCtxtPtr ctxt,
-				 char *filename,
-				 xmlNodePtr node,
-				 xmlNodePtr node2);
-#ifdef LIBXML_OUTPUT_ENABLED
-XMLPUBFUN void XMLCALL	
-	xmlShellPrintNode	(xmlNodePtr node);
-XMLPUBFUN int XMLCALL	
-	xmlShellCat		(xmlShellCtxtPtr ctxt,
-				 char *arg,
-				 xmlNodePtr node,
-				 xmlNodePtr node2);
-XMLPUBFUN int XMLCALL	
-	xmlShellWrite		(xmlShellCtxtPtr ctxt,
-				 char *filename,
-				 xmlNodePtr node,
-				 xmlNodePtr node2);
-XMLPUBFUN int XMLCALL	
-	xmlShellSave		(xmlShellCtxtPtr ctxt,
-				 char *filename,
-				 xmlNodePtr node,
-				 xmlNodePtr node2);
-#endif /* LIBXML_OUTPUT_ENABLED */
-#ifdef LIBXML_VALID_ENABLED
-XMLPUBFUN int XMLCALL	
-	xmlShellValidate	(xmlShellCtxtPtr ctxt,
-				 char *dtd,
-				 xmlNodePtr node,
-				 xmlNodePtr node2);
-#endif /* LIBXML_VALID_ENABLED */
-XMLPUBFUN int XMLCALL	
-	xmlShellDu		(xmlShellCtxtPtr ctxt,
-				 char *arg,
-				 xmlNodePtr tree,
-				 xmlNodePtr node2);
-XMLPUBFUN int XMLCALL	
-	xmlShellPwd		(xmlShellCtxtPtr ctxt,
-				 char *buffer,
-				 xmlNodePtr node,
-				 xmlNodePtr node2);
-
-/*
- * The Shell interface.
- */
-XMLPUBFUN void XMLCALL	
-	xmlShell		(xmlDocPtr doc,
-				 char *filename,
-				 xmlShellReadlineFunc input,
-				 FILE *output);
-			 
-#endif /* LIBXML_XPATH_ENABLED */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LIBXML_DEBUG_ENABLED */
-#endif /* __DEBUG_XML__ */
diff --git a/interfaces/ext/libxml/dict.h b/interfaces/ext/libxml/dict.h
deleted file mode 100644
index abb8339..0000000
--- a/interfaces/ext/libxml/dict.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Summary: string dictionnary
- * Description: dictionary of reusable strings, just used to avoid allocation
- *         and freeing operations.
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#ifndef __XML_DICT_H__
-#define __XML_DICT_H__
-
-#include <libxml/xmlversion.h>
-#include <libxml/tree.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * The dictionnary.
- */
-typedef struct _xmlDict xmlDict;
-typedef xmlDict *xmlDictPtr;
-
-/*
- * Constructor and destructor.
- */
-XMLPUBFUN xmlDictPtr XMLCALL
-			xmlDictCreate	(void);
-XMLPUBFUN xmlDictPtr XMLCALL
-			xmlDictCreateSub(xmlDictPtr sub);
-XMLPUBFUN int XMLCALL
-			xmlDictReference(xmlDictPtr dict);
-XMLPUBFUN void XMLCALL			
-			xmlDictFree	(xmlDictPtr dict);
-
-/*
- * Lookup of entry in the dictionnary.
- */
-XMLPUBFUN const xmlChar * XMLCALL		
-			xmlDictLookup	(xmlDictPtr dict,
-		                         const xmlChar *name,
-		                         int len);
-XMLPUBFUN const xmlChar * XMLCALL		
-			xmlDictExists	(xmlDictPtr dict,
-		                         const xmlChar *name,
-		                         int len);
-XMLPUBFUN const xmlChar * XMLCALL		
-			xmlDictQLookup	(xmlDictPtr dict,
-		                         const xmlChar *prefix,
-		                         const xmlChar *name);
-XMLPUBFUN int XMLCALL
-			xmlDictOwns	(xmlDictPtr dict,
-					 const xmlChar *str);
-XMLPUBFUN int XMLCALL			
-			xmlDictSize	(xmlDictPtr dict);
-
-/*
- * Cleanup function
- */
-XMLPUBFUN void XMLCALL
-                        xmlDictCleanup  (void);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* ! __XML_DICT_H__ */
diff --git a/interfaces/ext/libxml/encoding.h b/interfaces/ext/libxml/encoding.h
deleted file mode 100644
index c74b25f..0000000
--- a/interfaces/ext/libxml/encoding.h
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Summary: interface for the encoding conversion functions
- * Description: interface for the encoding conversion functions needed for
- *              XML basic encoding and iconv() support.
- *
- * Related specs are
- * rfc2044        (UTF-8 and UTF-16) F. Yergeau Alis Technologies
- * [ISO-10646]    UTF-8 and UTF-16 in Annexes
- * [ISO-8859-1]   ISO Latin-1 characters codes.
- * [UNICODE]      The Unicode Consortium, "The Unicode Standard --
- *                Worldwide Character Encoding -- Version 1.0", Addison-
- *                Wesley, Volume 1, 1991, Volume 2, 1992.  UTF-8 is
- *                described in Unicode Technical Report #4.
- * [US-ASCII]     Coded Character Set--7-bit American Standard Code for
- *                Information Interchange, ANSI X3.4-1986.
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#ifndef __XML_CHAR_ENCODING_H__
-#define __XML_CHAR_ENCODING_H__
-
-#include <libxml/xmlversion.h>
-
-#ifdef LIBXML_ICONV_ENABLED
-#include <iconv.h>
-#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * xmlCharEncoding:
- *
- * Predefined values for some standard encodings.
- * Libxml does not do beforehand translation on UTF8 and ISOLatinX.
- * It also supports ASCII, ISO-8859-1, and UTF16 (LE and BE) by default.
- *
- * Anything else would have to be translated to UTF8 before being
- * given to the parser itself. The BOM for UTF16 and the encoding
- * declaration are looked at and a converter is looked for at that
- * point. If not found the parser stops here as asked by the XML REC. A
- * converter can be registered by the user using xmlRegisterCharEncodingHandler
- * but the current form doesn't allow stateful transcoding (a serious
- * problem agreed !). If iconv has been found it will be used
- * automatically and allow stateful transcoding, the simplest is then
- * to be sure to enable iconv and to provide iconv libs for the encoding
- * support needed.
- *
- * Note that the generic "UTF-16" is not a predefined value.  Instead, only
- * the specific UTF-16LE and UTF-16BE are present.
- */
-typedef enum {
-    XML_CHAR_ENCODING_ERROR=   -1, /* No char encoding detected */
-    XML_CHAR_ENCODING_NONE=	0, /* No char encoding detected */
-    XML_CHAR_ENCODING_UTF8=	1, /* UTF-8 */
-    XML_CHAR_ENCODING_UTF16LE=	2, /* UTF-16 little endian */
-    XML_CHAR_ENCODING_UTF16BE=	3, /* UTF-16 big endian */
-    XML_CHAR_ENCODING_UCS4LE=	4, /* UCS-4 little endian */
-    XML_CHAR_ENCODING_UCS4BE=	5, /* UCS-4 big endian */
-    XML_CHAR_ENCODING_EBCDIC=	6, /* EBCDIC uh! */
-    XML_CHAR_ENCODING_UCS4_2143=7, /* UCS-4 unusual ordering */
-    XML_CHAR_ENCODING_UCS4_3412=8, /* UCS-4 unusual ordering */
-    XML_CHAR_ENCODING_UCS2=	9, /* UCS-2 */
-    XML_CHAR_ENCODING_8859_1=	10,/* ISO-8859-1 ISO Latin 1 */
-    XML_CHAR_ENCODING_8859_2=	11,/* ISO-8859-2 ISO Latin 2 */
-    XML_CHAR_ENCODING_8859_3=	12,/* ISO-8859-3 */
-    XML_CHAR_ENCODING_8859_4=	13,/* ISO-8859-4 */
-    XML_CHAR_ENCODING_8859_5=	14,/* ISO-8859-5 */
-    XML_CHAR_ENCODING_8859_6=	15,/* ISO-8859-6 */
-    XML_CHAR_ENCODING_8859_7=	16,/* ISO-8859-7 */
-    XML_CHAR_ENCODING_8859_8=	17,/* ISO-8859-8 */
-    XML_CHAR_ENCODING_8859_9=	18,/* ISO-8859-9 */
-    XML_CHAR_ENCODING_2022_JP=  19,/* ISO-2022-JP */
-    XML_CHAR_ENCODING_SHIFT_JIS=20,/* Shift_JIS */
-    XML_CHAR_ENCODING_EUC_JP=   21,/* EUC-JP */
-    XML_CHAR_ENCODING_ASCII=    22 /* pure ASCII */
-} xmlCharEncoding;
-
-/**
- * xmlCharEncodingInputFunc:
- * @out:  a pointer to an array of bytes to store the UTF-8 result
- * @outlen:  the length of @out
- * @in:  a pointer to an array of chars in the original encoding
- * @inlen:  the length of @in
- *
- * Take a block of chars in the original encoding and try to convert
- * it to an UTF-8 block of chars out.
- *
- * Returns the number of bytes written, -1 if lack of space, or -2
- *     if the transcoding failed.
- * The value of @inlen after return is the number of octets consumed
- *     if the return value is positive, else unpredictiable.
- * The value of @outlen after return is the number of octets consumed.
- */
-typedef int (* xmlCharEncodingInputFunc)(unsigned char *out, int *outlen,
-                                         const unsigned char *in, int *inlen);
-
-
-/**
- * xmlCharEncodingOutputFunc:
- * @out:  a pointer to an array of bytes to store the result
- * @outlen:  the length of @out
- * @in:  a pointer to an array of UTF-8 chars
- * @inlen:  the length of @in
- *
- * Take a block of UTF-8 chars in and try to convert it to another
- * encoding.
- * Note: a first call designed to produce heading info is called with
- * in = NULL. If stateful this should also initialize the encoder state.
- *
- * Returns the number of bytes written, -1 if lack of space, or -2
- *     if the transcoding failed.
- * The value of @inlen after return is the number of octets consumed
- *     if the return value is positive, else unpredictiable.
- * The value of @outlen after return is the number of octets produced.
- */
-typedef int (* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen,
-                                          const unsigned char *in, int *inlen);
-
-
-/*
- * Block defining the handlers for non UTF-8 encodings.
- * If iconv is supported, there are two extra fields.
- */
-
-typedef struct _xmlCharEncodingHandler xmlCharEncodingHandler;
-typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr;
-struct _xmlCharEncodingHandler {
-    char                       *name;
-    xmlCharEncodingInputFunc   input;
-    xmlCharEncodingOutputFunc  output;
-#ifdef LIBXML_ICONV_ENABLED
-    iconv_t                    iconv_in;
-    iconv_t                    iconv_out;
-#endif /* LIBXML_ICONV_ENABLED */
-};
-
-#ifdef __cplusplus
-}
-#endif
-#include <libxml/tree.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Interfaces for encoding handlers.
- */
-XMLPUBFUN void XMLCALL	
-	xmlInitCharEncodingHandlers	(void);
-XMLPUBFUN void XMLCALL	
-	xmlCleanupCharEncodingHandlers	(void);
-XMLPUBFUN void XMLCALL	
-	xmlRegisterCharEncodingHandler	(xmlCharEncodingHandlerPtr handler);
-XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL
-	xmlGetCharEncodingHandler	(xmlCharEncoding enc);
-XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL
-	xmlFindCharEncodingHandler	(const char *name);
-XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL
-	xmlNewCharEncodingHandler	(const char *name, 
-                          		 xmlCharEncodingInputFunc input,
-                          		 xmlCharEncodingOutputFunc output);
-
-/*
- * Interfaces for encoding names and aliases.
- */
-XMLPUBFUN int XMLCALL	
-	xmlAddEncodingAlias		(const char *name,
-					 const char *alias);
-XMLPUBFUN int XMLCALL	
-	xmlDelEncodingAlias		(const char *alias);
-XMLPUBFUN const char * XMLCALL
-	xmlGetEncodingAlias		(const char *alias);
-XMLPUBFUN void XMLCALL	
-	xmlCleanupEncodingAliases	(void);
-XMLPUBFUN xmlCharEncoding XMLCALL
-	xmlParseCharEncoding		(const char *name);
-XMLPUBFUN const char * XMLCALL
-	xmlGetCharEncodingName		(xmlCharEncoding enc);
-
-/*
- * Interfaces directly used by the parsers.
- */
-XMLPUBFUN xmlCharEncoding XMLCALL
-	xmlDetectCharEncoding		(const unsigned char *in,
-					 int len);
-
-XMLPUBFUN int XMLCALL	
-	xmlCharEncOutFunc		(xmlCharEncodingHandler *handler,
-					 xmlBufferPtr out,
-					 xmlBufferPtr in);
-
-XMLPUBFUN int XMLCALL	
-	xmlCharEncInFunc		(xmlCharEncodingHandler *handler,
-					 xmlBufferPtr out,
-					 xmlBufferPtr in);
-XMLPUBFUN int XMLCALL
-	xmlCharEncFirstLine		(xmlCharEncodingHandler *handler,
-					 xmlBufferPtr out,
-					 xmlBufferPtr in);
-XMLPUBFUN int XMLCALL	
-	xmlCharEncCloseFunc		(xmlCharEncodingHandler *handler);
-
-/*
- * Export a few useful functions
- */
-#ifdef LIBXML_OUTPUT_ENABLED
-XMLPUBFUN int XMLCALL	
-	UTF8Toisolat1			(unsigned char *out,
-					 int *outlen,
-					 const unsigned char *in,
-					 int *inlen);
-#endif /* LIBXML_OUTPUT_ENABLED */
-XMLPUBFUN int XMLCALL	
-	isolat1ToUTF8			(unsigned char *out,
-					 int *outlen,
-					 const unsigned char *in,
-					 int *inlen);
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __XML_CHAR_ENCODING_H__ */
diff --git a/interfaces/ext/libxml/entities.h b/interfaces/ext/libxml/entities.h
deleted file mode 100644
index cefb97f..0000000
--- a/interfaces/ext/libxml/entities.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Summary: interface for the XML entities handling
- * Description: this module provides some of the entity API needed
- *              for the parser and applications.
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#ifndef __XML_ENTITIES_H__
-#define __XML_ENTITIES_H__
-
-#include <libxml/xmlversion.h>
-#include <libxml/tree.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * The different valid entity types.
- */
-typedef enum {
-    XML_INTERNAL_GENERAL_ENTITY = 1,
-    XML_EXTERNAL_GENERAL_PARSED_ENTITY = 2,
-    XML_EXTERNAL_GENERAL_UNPARSED_ENTITY = 3,
-    XML_INTERNAL_PARAMETER_ENTITY = 4,
-    XML_EXTERNAL_PARAMETER_ENTITY = 5,
-    XML_INTERNAL_PREDEFINED_ENTITY = 6
-} xmlEntityType;
-
-/*
- * An unit of storage for an entity, contains the string, the value
- * and the linkind data needed for the linking in the hash table.
- */
-
-struct _xmlEntity {
-    void           *_private;	        /* application data */
-    xmlElementType          type;       /* XML_ENTITY_DECL, must be second ! */
-    const xmlChar          *name;	/* Entity name */
-    struct _xmlNode    *children;	/* First child link */
-    struct _xmlNode        *last;	/* Last child link */
-    struct _xmlDtd       *parent;	/* -> DTD */
-    struct _xmlNode        *next;	/* next sibling link  */
-    struct _xmlNode        *prev;	/* previous sibling link  */
-    struct _xmlDoc          *doc;       /* the containing document */
-
-    xmlChar                *orig;	/* content without ref substitution */
-    xmlChar             *content;	/* content or ndata if unparsed */
-    int                   length;	/* the content length */
-    xmlEntityType          etype;	/* The entity type */
-    const xmlChar    *ExternalID;	/* External identifier for PUBLIC */
-    const xmlChar      *SystemID;	/* URI for a SYSTEM or PUBLIC Entity */
-
-    struct _xmlEntity     *nexte;	/* unused */
-    const xmlChar           *URI;	/* the full URI as computed */
-    int                    owner;	/* does the entity own the childrens */
-    int			 checked;	/* was the entity content checked */
-					/* this is also used to count entites
-					 * references done from that entity */
-};
-
-/*
- * All entities are stored in an hash table.
- * There is 2 separate hash tables for global and parameter entities.
- */
-
-typedef struct _xmlHashTable xmlEntitiesTable;
-typedef xmlEntitiesTable *xmlEntitiesTablePtr;
-
-/*
- * External functions:
- */
-
-#ifdef LIBXML_LEGACY_ENABLED
-XMLPUBFUN void XMLCALL
-		xmlInitializePredefinedEntities	(void);
-#endif /* LIBXML_LEGACY_ENABLED */
-
-XMLPUBFUN xmlEntityPtr XMLCALL
-			xmlNewEntity		(xmlDocPtr doc,
-						 const xmlChar *name,
-						 int type,
-						 const xmlChar *ExternalID,
-						 const xmlChar *SystemID,
-						 const xmlChar *content);
-XMLPUBFUN xmlEntityPtr XMLCALL
-			xmlAddDocEntity		(xmlDocPtr doc,
-						 const xmlChar *name,
-						 int type,
-						 const xmlChar *ExternalID,
-						 const xmlChar *SystemID,
-						 const xmlChar *content);
-XMLPUBFUN xmlEntityPtr XMLCALL
-			xmlAddDtdEntity		(xmlDocPtr doc,
-						 const xmlChar *name,
-						 int type,
-						 const xmlChar *ExternalID,
-						 const xmlChar *SystemID,
-						 const xmlChar *content);
-XMLPUBFUN xmlEntityPtr XMLCALL
-			xmlGetPredefinedEntity	(const xmlChar *name);
-XMLPUBFUN xmlEntityPtr XMLCALL
-			xmlGetDocEntity		(xmlDocPtr doc,
-						 const xmlChar *name);
-XMLPUBFUN xmlEntityPtr XMLCALL
-			xmlGetDtdEntity		(xmlDocPtr doc,
-						 const xmlChar *name);
-XMLPUBFUN xmlEntityPtr XMLCALL
-			xmlGetParameterEntity	(xmlDocPtr doc,
-						 const xmlChar *name);
-#ifdef LIBXML_LEGACY_ENABLED
-XMLPUBFUN const xmlChar * XMLCALL
-			xmlEncodeEntities	(xmlDocPtr doc,
-						 const xmlChar *input);
-#endif /* LIBXML_LEGACY_ENABLED */
-XMLPUBFUN xmlChar * XMLCALL
-			xmlEncodeEntitiesReentrant(xmlDocPtr doc,
-						 const xmlChar *input);
-XMLPUBFUN xmlChar * XMLCALL
-			xmlEncodeSpecialChars	(xmlDocPtr doc,
-						 const xmlChar *input);
-XMLPUBFUN xmlEntitiesTablePtr XMLCALL
-			xmlCreateEntitiesTable	(void);
-#ifdef LIBXML_TREE_ENABLED
-XMLPUBFUN xmlEntitiesTablePtr XMLCALL
-			xmlCopyEntitiesTable	(xmlEntitiesTablePtr table);
-#endif /* LIBXML_TREE_ENABLED */
-XMLPUBFUN void XMLCALL
-			xmlFreeEntitiesTable	(xmlEntitiesTablePtr table);
-#ifdef LIBXML_OUTPUT_ENABLED
-XMLPUBFUN void XMLCALL
-			xmlDumpEntitiesTable	(xmlBufferPtr buf,
-						 xmlEntitiesTablePtr table);
-XMLPUBFUN void XMLCALL
-			xmlDumpEntityDecl	(xmlBufferPtr buf,
-						 xmlEntityPtr ent);
-#endif /* LIBXML_OUTPUT_ENABLED */
-#ifdef LIBXML_LEGACY_ENABLED
-XMLPUBFUN void XMLCALL
-			xmlCleanupPredefinedEntities(void);
-#endif /* LIBXML_LEGACY_ENABLED */
-
-
-#ifdef __cplusplus
-}
-#endif
-
-# endif /* __XML_ENTITIES_H__ */
diff --git a/interfaces/ext/libxml/globals.h b/interfaces/ext/libxml/globals.h
deleted file mode 100644
index 57e25fa..0000000
--- a/interfaces/ext/libxml/globals.h
+++ /dev/null
@@ -1,491 +0,0 @@
-/*
- * Summary: interface for all global variables of the library
- * Description: all the global variables and thread handling for
- *              those variables is handled by this module.
- *
- * The bottom of this file is automatically generated by build_glob.py
- * based on the description file global.data
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Gary Pennington <Gary.Pennington at uk.sun.com>, Daniel Veillard
- */
-
-#ifndef __XML_GLOBALS_H
-#define __XML_GLOBALS_H
-
-#include <libxml/xmlversion.h>
-#include <libxml/parser.h>
-#include <libxml/xmlerror.h>
-#include <libxml/SAX.h>
-#include <libxml/SAX2.h>
-#include <libxml/xmlmemory.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-XMLPUBFUN void XMLCALL xmlInitGlobals(void);
-XMLPUBFUN void XMLCALL xmlCleanupGlobals(void);
-
-/**
- * xmlParserInputBufferCreateFilenameFunc:
- * @URI: the URI to read from
- * @enc: the requested source encoding
- *
- * Signature for the function doing the lookup for a suitable input method
- * corresponding to an URI.
- *
- * Returns the new xmlParserInputBufferPtr in case of success or NULL if no
- *         method was found.
- */
-typedef xmlParserInputBufferPtr (*xmlParserInputBufferCreateFilenameFunc) (const char *URI, xmlCharEncoding enc);
-
-/**
- * xmlOutputBufferCreateFilenameFunc:
- * @URI: the URI to write to
- * @enc: the requested target encoding
- *
- * Signature for the function doing the lookup for a suitable output method
- * corresponding to an URI.
- *
- * Returns the new xmlOutputBufferPtr in case of success or NULL if no
- *         method was found.
- */
-typedef xmlOutputBufferPtr (*xmlOutputBufferCreateFilenameFunc) (const char *URI, xmlCharEncodingHandlerPtr encoder, int compression);
-
-XMLPUBFUN xmlParserInputBufferCreateFilenameFunc
-XMLCALL xmlParserInputBufferCreateFilenameDefault (xmlParserInputBufferCreateFilenameFunc func);
-XMLPUBFUN xmlOutputBufferCreateFilenameFunc
-XMLCALL xmlOutputBufferCreateFilenameDefault (xmlOutputBufferCreateFilenameFunc func);
-
-/*
- * Externally global symbols which need to be protected for backwards
- * compatibility support.
- */
-
-#undef	docbDefaultSAXHandler
-#undef	htmlDefaultSAXHandler
-#undef	oldXMLWDcompatibility
-#undef	xmlBufferAllocScheme
-#undef	xmlDefaultBufferSize
-#undef	xmlDefaultSAXHandler
-#undef	xmlDefaultSAXLocator
-#undef	xmlDoValidityCheckingDefaultValue
-#undef	xmlFree
-#undef	xmlGenericError
-#undef	xmlStructuredError
-#undef	xmlGenericErrorContext
-#undef	xmlGetWarningsDefaultValue
-#undef	xmlIndentTreeOutput
-#undef  xmlTreeIndentString
-#undef	xmlKeepBlanksDefaultValue
-#undef	xmlLineNumbersDefaultValue
-#undef	xmlLoadExtDtdDefaultValue
-#undef	xmlMalloc
-#undef	xmlMallocAtomic
-#undef	xmlMemStrdup
-#undef	xmlParserDebugEntities
-#undef	xmlParserVersion
-#undef	xmlPedanticParserDefaultValue
-#undef	xmlRealloc
-#undef	xmlSaveNoEmptyTags
-#undef	xmlSubstituteEntitiesDefaultValue
-#undef  xmlRegisterNodeDefaultValue
-#undef  xmlDeregisterNodeDefaultValue
-#undef  xmlLastError
-#undef  xmlParserInputBufferCreateFilenameValue
-#undef  xmlOutputBufferCreateFilenameValue
-
-/**
- * xmlRegisterNodeFunc:
- * @node: the current node
- *
- * Signature for the registration callback of a created node
- */
-typedef void (*xmlRegisterNodeFunc) (xmlNodePtr node);
-/**
- * xmlDeregisterNodeFunc:
- * @node: the current node
- *
- * Signature for the deregistration callback of a discarded node
- */
-typedef void (*xmlDeregisterNodeFunc) (xmlNodePtr node);
-
-typedef struct _xmlGlobalState xmlGlobalState;
-typedef xmlGlobalState *xmlGlobalStatePtr;
-struct _xmlGlobalState
-{
-	const char *xmlParserVersion;
-
-	xmlSAXLocator xmlDefaultSAXLocator;
-	xmlSAXHandlerV1 xmlDefaultSAXHandler;
-	xmlSAXHandlerV1 docbDefaultSAXHandler;
-	xmlSAXHandlerV1 htmlDefaultSAXHandler;
-
-	xmlFreeFunc xmlFree;
-	xmlMallocFunc xmlMalloc;
-	xmlStrdupFunc xmlMemStrdup;
-	xmlReallocFunc xmlRealloc;
-
-	xmlGenericErrorFunc xmlGenericError;
-	xmlStructuredErrorFunc xmlStructuredError;
-	void *xmlGenericErrorContext;
-
-	int oldXMLWDcompatibility;
-
-	xmlBufferAllocationScheme xmlBufferAllocScheme;
-	int xmlDefaultBufferSize;
-
-	int xmlSubstituteEntitiesDefaultValue;
-	int xmlDoValidityCheckingDefaultValue;
-	int xmlGetWarningsDefaultValue;
-	int xmlKeepBlanksDefaultValue;
-	int xmlLineNumbersDefaultValue;
-	int xmlLoadExtDtdDefaultValue;
-	int xmlParserDebugEntities;
-	int xmlPedanticParserDefaultValue;
-
-	int xmlSaveNoEmptyTags;
-	int xmlIndentTreeOutput;
-	const char *xmlTreeIndentString;
-
-	xmlRegisterNodeFunc xmlRegisterNodeDefaultValue;
-	xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue;
-
-	xmlMallocFunc xmlMallocAtomic;
-	xmlError xmlLastError;
-
-	xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue;
-	xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue;
-};
-
-#ifdef __cplusplus
-}
-#endif
-#include <libxml/threads.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-XMLPUBFUN void XMLCALL	xmlInitializeGlobalState(xmlGlobalStatePtr gs);
-
-XMLPUBFUN void XMLCALL xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler);
-
-XMLPUBFUN void XMLCALL xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler);
-
-XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlRegisterNodeDefault(xmlRegisterNodeFunc func);
-XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func);
-XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func);
-XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func);
-
-XMLPUBFUN xmlOutputBufferCreateFilenameFunc XMLCALL
-	xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func);
-XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL
-	xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func);
-
-/** DOC_DISABLE */
-/*
- * In general the memory allocation entry points are not kept
- * thread specific but this can be overridden by LIBXML_THREAD_ALLOC_ENABLED
- *    - xmlMalloc
- *    - xmlMallocAtomic
- *    - xmlRealloc
- *    - xmlMemStrdup
- *    - xmlFree
- */
-
-#ifdef LIBXML_THREAD_ALLOC_ENABLED
-#ifdef LIBXML_THREAD_ENABLED
-XMLPUBFUN  xmlMallocFunc * XMLCALL __xmlMalloc(void);
-#define xmlMalloc \
-(*(__xmlMalloc()))
-#else
-XMLPUBVAR xmlMallocFunc xmlMalloc;
-#endif
-
-#ifdef LIBXML_THREAD_ENABLED
-XMLPUBFUN  xmlMallocFunc * XMLCALL __xmlMallocAtomic(void);
-#define xmlMallocAtomic \
-(*(__xmlMallocAtomic()))
-#else
-XMLPUBVAR xmlMallocFunc xmlMallocAtomic;
-#endif
-
-#ifdef LIBXML_THREAD_ENABLED
-XMLPUBFUN  xmlReallocFunc * XMLCALL __xmlRealloc(void);
-#define xmlRealloc \
-(*(__xmlRealloc()))
-#else
-XMLPUBVAR xmlReallocFunc xmlRealloc;
-#endif
-
-#ifdef LIBXML_THREAD_ENABLED
-XMLPUBFUN  xmlFreeFunc * XMLCALL __xmlFree(void);
-#define xmlFree \
-(*(__xmlFree()))
-#else
-XMLPUBVAR xmlFreeFunc xmlFree;
-#endif
-
-#ifdef LIBXML_THREAD_ENABLED
-XMLPUBFUN  xmlStrdupFunc * XMLCALL __xmlMemStrdup(void);
-#define xmlMemStrdup \
-(*(__xmlMemStrdup()))
-#else
-XMLPUBVAR xmlStrdupFunc xmlMemStrdup;
-#endif
-
-#else /* !LIBXML_THREAD_ALLOC_ENABLED */
-XMLPUBVAR xmlMallocFunc xmlMalloc;
-XMLPUBVAR xmlMallocFunc xmlMallocAtomic;
-XMLPUBVAR xmlReallocFunc xmlRealloc;
-XMLPUBVAR xmlFreeFunc xmlFree;
-XMLPUBVAR xmlStrdupFunc xmlMemStrdup;
-#endif /* LIBXML_THREAD_ALLOC_ENABLED */
-
-#ifdef LIBXML_DOCB_ENABLED
-XMLPUBFUN  xmlSAXHandlerV1 * XMLCALL __docbDefaultSAXHandler(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define docbDefaultSAXHandler \
-(*(__docbDefaultSAXHandler()))
-#else
-XMLPUBVAR xmlSAXHandlerV1 docbDefaultSAXHandler;
-#endif
-#endif
-
-#ifdef LIBXML_HTML_ENABLED
-XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __htmlDefaultSAXHandler(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define htmlDefaultSAXHandler \
-(*(__htmlDefaultSAXHandler()))
-#else
-XMLPUBVAR xmlSAXHandlerV1 htmlDefaultSAXHandler;
-#endif
-#endif
-
-XMLPUBFUN xmlError * XMLCALL __xmlLastError(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlLastError \
-(*(__xmlLastError()))
-#else
-XMLPUBVAR xmlError xmlLastError;
-#endif
-
-/*
- * Everything starting from the line below is
- * Automatically generated by build_glob.py.
- * Do not modify the previous line.
- */
-
-
-XMLPUBFUN int * XMLCALL __oldXMLWDcompatibility(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define oldXMLWDcompatibility \
-(*(__oldXMLWDcompatibility()))
-#else
-XMLPUBVAR int oldXMLWDcompatibility;
-#endif
-
-XMLPUBFUN xmlBufferAllocationScheme * XMLCALL __xmlBufferAllocScheme(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlBufferAllocScheme \
-(*(__xmlBufferAllocScheme()))
-#else
-XMLPUBVAR xmlBufferAllocationScheme xmlBufferAllocScheme;
-#endif
-XMLPUBFUN xmlBufferAllocationScheme XMLCALL xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v);
-
-XMLPUBFUN int * XMLCALL __xmlDefaultBufferSize(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlDefaultBufferSize \
-(*(__xmlDefaultBufferSize()))
-#else
-XMLPUBVAR int xmlDefaultBufferSize;
-#endif
-XMLPUBFUN int XMLCALL xmlThrDefDefaultBufferSize(int v);
-
-XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __xmlDefaultSAXHandler(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlDefaultSAXHandler \
-(*(__xmlDefaultSAXHandler()))
-#else
-XMLPUBVAR xmlSAXHandlerV1 xmlDefaultSAXHandler;
-#endif
-
-XMLPUBFUN xmlSAXLocator * XMLCALL __xmlDefaultSAXLocator(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlDefaultSAXLocator \
-(*(__xmlDefaultSAXLocator()))
-#else
-XMLPUBVAR xmlSAXLocator xmlDefaultSAXLocator;
-#endif
-
-XMLPUBFUN int * XMLCALL __xmlDoValidityCheckingDefaultValue(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlDoValidityCheckingDefaultValue \
-(*(__xmlDoValidityCheckingDefaultValue()))
-#else
-XMLPUBVAR int xmlDoValidityCheckingDefaultValue;
-#endif
-XMLPUBFUN int XMLCALL xmlThrDefDoValidityCheckingDefaultValue(int v);
-
-XMLPUBFUN xmlGenericErrorFunc * XMLCALL __xmlGenericError(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlGenericError \
-(*(__xmlGenericError()))
-#else
-XMLPUBVAR xmlGenericErrorFunc xmlGenericError;
-#endif
-
-XMLPUBFUN xmlStructuredErrorFunc * XMLCALL __xmlStructuredError(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlStructuredError \
-(*(__xmlStructuredError()))
-#else
-XMLPUBVAR xmlStructuredErrorFunc xmlStructuredError;
-#endif
-
-XMLPUBFUN void * * XMLCALL __xmlGenericErrorContext(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlGenericErrorContext \
-(*(__xmlGenericErrorContext()))
-#else
-XMLPUBVAR void * xmlGenericErrorContext;
-#endif
-
-XMLPUBFUN int * XMLCALL __xmlGetWarningsDefaultValue(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlGetWarningsDefaultValue \
-(*(__xmlGetWarningsDefaultValue()))
-#else
-XMLPUBVAR int xmlGetWarningsDefaultValue;
-#endif
-XMLPUBFUN int XMLCALL xmlThrDefGetWarningsDefaultValue(int v);
-
-XMLPUBFUN int * XMLCALL __xmlIndentTreeOutput(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlIndentTreeOutput \
-(*(__xmlIndentTreeOutput()))
-#else
-XMLPUBVAR int xmlIndentTreeOutput;
-#endif
-XMLPUBFUN int XMLCALL xmlThrDefIndentTreeOutput(int v);
-
-XMLPUBFUN const char * * XMLCALL __xmlTreeIndentString(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlTreeIndentString \
-(*(__xmlTreeIndentString()))
-#else
-XMLPUBVAR const char * xmlTreeIndentString;
-#endif
-XMLPUBFUN const char * XMLCALL xmlThrDefTreeIndentString(const char * v);
-
-XMLPUBFUN int * XMLCALL __xmlKeepBlanksDefaultValue(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlKeepBlanksDefaultValue \
-(*(__xmlKeepBlanksDefaultValue()))
-#else
-XMLPUBVAR int xmlKeepBlanksDefaultValue;
-#endif
-XMLPUBFUN int XMLCALL xmlThrDefKeepBlanksDefaultValue(int v);
-
-XMLPUBFUN int * XMLCALL __xmlLineNumbersDefaultValue(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlLineNumbersDefaultValue \
-(*(__xmlLineNumbersDefaultValue()))
-#else
-XMLPUBVAR int xmlLineNumbersDefaultValue;
-#endif
-XMLPUBFUN int XMLCALL xmlThrDefLineNumbersDefaultValue(int v);
-
-XMLPUBFUN int * XMLCALL __xmlLoadExtDtdDefaultValue(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlLoadExtDtdDefaultValue \
-(*(__xmlLoadExtDtdDefaultValue()))
-#else
-XMLPUBVAR int xmlLoadExtDtdDefaultValue;
-#endif
-XMLPUBFUN int XMLCALL xmlThrDefLoadExtDtdDefaultValue(int v);
-
-XMLPUBFUN int * XMLCALL __xmlParserDebugEntities(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlParserDebugEntities \
-(*(__xmlParserDebugEntities()))
-#else
-XMLPUBVAR int xmlParserDebugEntities;
-#endif
-XMLPUBFUN int XMLCALL xmlThrDefParserDebugEntities(int v);
-
-XMLPUBFUN const char * * XMLCALL __xmlParserVersion(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlParserVersion \
-(*(__xmlParserVersion()))
-#else
-XMLPUBVAR const char * xmlParserVersion;
-#endif
-
-XMLPUBFUN int * XMLCALL __xmlPedanticParserDefaultValue(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlPedanticParserDefaultValue \
-(*(__xmlPedanticParserDefaultValue()))
-#else
-XMLPUBVAR int xmlPedanticParserDefaultValue;
-#endif
-XMLPUBFUN int XMLCALL xmlThrDefPedanticParserDefaultValue(int v);
-
-XMLPUBFUN int * XMLCALL __xmlSaveNoEmptyTags(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlSaveNoEmptyTags \
-(*(__xmlSaveNoEmptyTags()))
-#else
-XMLPUBVAR int xmlSaveNoEmptyTags;
-#endif
-XMLPUBFUN int XMLCALL xmlThrDefSaveNoEmptyTags(int v);
-
-XMLPUBFUN int * XMLCALL __xmlSubstituteEntitiesDefaultValue(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlSubstituteEntitiesDefaultValue \
-(*(__xmlSubstituteEntitiesDefaultValue()))
-#else
-XMLPUBVAR int xmlSubstituteEntitiesDefaultValue;
-#endif
-XMLPUBFUN int XMLCALL xmlThrDefSubstituteEntitiesDefaultValue(int v);
-
-XMLPUBFUN xmlRegisterNodeFunc * XMLCALL __xmlRegisterNodeDefaultValue(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlRegisterNodeDefaultValue \
-(*(__xmlRegisterNodeDefaultValue()))
-#else
-XMLPUBVAR xmlRegisterNodeFunc xmlRegisterNodeDefaultValue;
-#endif
-
-XMLPUBFUN xmlDeregisterNodeFunc * XMLCALL __xmlDeregisterNodeDefaultValue(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlDeregisterNodeDefaultValue \
-(*(__xmlDeregisterNodeDefaultValue()))
-#else
-XMLPUBVAR xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue;
-#endif
-
-XMLPUBFUN xmlParserInputBufferCreateFilenameFunc * XMLCALL __xmlParserInputBufferCreateFilenameValue(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlParserInputBufferCreateFilenameValue \
-(*(__xmlParserInputBufferCreateFilenameValue()))
-#else
-XMLPUBVAR xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue;
-#endif
-
-XMLPUBFUN xmlOutputBufferCreateFilenameFunc * XMLCALL __xmlOutputBufferCreateFilenameValue(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define xmlOutputBufferCreateFilenameValue \
-(*(__xmlOutputBufferCreateFilenameValue()))
-#else
-XMLPUBVAR xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue;
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __XML_GLOBALS_H */
diff --git a/interfaces/ext/libxml/hash.h b/interfaces/ext/libxml/hash.h
deleted file mode 100644
index 7fe4be7..0000000
--- a/interfaces/ext/libxml/hash.h
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Summary: Chained hash tables
- * Description: This module implements the hash table support used in 
- * 		various places in the library.
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Bjorn Reese <bjorn.reese at systematic.dk>
- */
-
-#ifndef __XML_HASH_H__
-#define __XML_HASH_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * The hash table.
- */
-typedef struct _xmlHashTable xmlHashTable;
-typedef xmlHashTable *xmlHashTablePtr;
-
-#ifdef __cplusplus
-}
-#endif
-
-#include <libxml/xmlversion.h>
-#include <libxml/parser.h>
-#include <libxml/dict.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Recent version of gcc produce a warning when a function pointer is assigned
- * to an object pointer, or vice versa.  The following macro is a dirty hack
- * to allow suppression of the warning.  If your architecture has function
- * pointers which are a different size than a void pointer, there may be some
- * serious trouble within the library.
- */
-/**
- * XML_CAST_FPTR:
- * @fptr:  pointer to a function
- *
- * Macro to do a casting from an object pointer to a
- * function pointer without encountering a warning from
- * gcc
- *
- * #define XML_CAST_FPTR(fptr) (*(void **)(&fptr))
- * This macro violated ISO C aliasing rules (gcc4 on s390 broke)
- * so it is disabled now
- */
-
-#define XML_CAST_FPTR(fptr) fptr
-
-
-/*
- * function types:
- */
-/**
- * xmlHashDeallocator:
- * @payload:  the data in the hash
- * @name:  the name associated
- *
- * Callback to free data from a hash.
- */
-typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name);
-/**
- * xmlHashCopier:
- * @payload:  the data in the hash
- * @name:  the name associated
- *
- * Callback to copy data from a hash.
- *
- * Returns a copy of the data or NULL in case of error.
- */
-typedef void *(*xmlHashCopier)(void *payload, xmlChar *name);
-/**
- * xmlHashScanner:
- * @payload:  the data in the hash
- * @data:  extra scannner data
- * @name:  the name associated
- *
- * Callback when scanning data in a hash with the simple scanner.
- */
-typedef void (*xmlHashScanner)(void *payload, void *data, xmlChar *name);
-/**
- * xmlHashScannerFull:
- * @payload:  the data in the hash
- * @data:  extra scannner data
- * @name:  the name associated
- * @name2:  the second name associated
- * @name3:  the third name associated
- *
- * Callback when scanning data in a hash with the full scanner.
- */
-typedef void (*xmlHashScannerFull)(void *payload, void *data,
-				   const xmlChar *name, const xmlChar *name2,
-				   const xmlChar *name3);
-
-/*
- * Constructor and destructor.
- */
-XMLPUBFUN xmlHashTablePtr XMLCALL
-			xmlHashCreate	(int size);
-XMLPUBFUN xmlHashTablePtr XMLCALL
-			xmlHashCreateDict(int size,
-					 xmlDictPtr dict);
-XMLPUBFUN void XMLCALL			
-			xmlHashFree	(xmlHashTablePtr table,
-					 xmlHashDeallocator f);
-
-/*
- * Add a new entry to the hash table.
- */
-XMLPUBFUN int XMLCALL			
-			xmlHashAddEntry	(xmlHashTablePtr table,
-		                         const xmlChar *name,
-		                         void *userdata);
-XMLPUBFUN int XMLCALL			
-			xmlHashUpdateEntry(xmlHashTablePtr table,
-		                         const xmlChar *name,
-		                         void *userdata,
-					 xmlHashDeallocator f);
-XMLPUBFUN int XMLCALL		    
-			xmlHashAddEntry2(xmlHashTablePtr table,
-		                         const xmlChar *name,
-		                         const xmlChar *name2,
-		                         void *userdata);
-XMLPUBFUN int XMLCALL			
-			xmlHashUpdateEntry2(xmlHashTablePtr table,
-		                         const xmlChar *name,
-		                         const xmlChar *name2,
-		                         void *userdata,
-					 xmlHashDeallocator f);
-XMLPUBFUN int XMLCALL			
-			xmlHashAddEntry3(xmlHashTablePtr table,
-		                         const xmlChar *name,
-		                         const xmlChar *name2,
-		                         const xmlChar *name3,
-		                         void *userdata);
-XMLPUBFUN int XMLCALL			
-			xmlHashUpdateEntry3(xmlHashTablePtr table,
-		                         const xmlChar *name,
-		                         const xmlChar *name2,
-		                         const xmlChar *name3,
-		                         void *userdata,
-					 xmlHashDeallocator f);
-
-/*
- * Remove an entry from the hash table.
- */
-XMLPUBFUN int XMLCALL     
-			xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name,
-                           xmlHashDeallocator f);
-XMLPUBFUN int XMLCALL     
-			xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name,
-                            const xmlChar *name2, xmlHashDeallocator f);
-XMLPUBFUN int  XMLCALL    
-			xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name,
-                            const xmlChar *name2, const xmlChar *name3,
-                            xmlHashDeallocator f);
-
-/*
- * Retrieve the userdata.
- */
-XMLPUBFUN void * XMLCALL			
-			xmlHashLookup	(xmlHashTablePtr table,
-					 const xmlChar *name);
-XMLPUBFUN void * XMLCALL			
-			xmlHashLookup2	(xmlHashTablePtr table,
-					 const xmlChar *name,
-					 const xmlChar *name2);
-XMLPUBFUN void * XMLCALL			
-			xmlHashLookup3	(xmlHashTablePtr table,
-					 const xmlChar *name,
-					 const xmlChar *name2,
-					 const xmlChar *name3);
-XMLPUBFUN void * XMLCALL			
-			xmlHashQLookup	(xmlHashTablePtr table,
-					 const xmlChar *name,
-					 const xmlChar *prefix);
-XMLPUBFUN void * XMLCALL			
-			xmlHashQLookup2	(xmlHashTablePtr table,
-					 const xmlChar *name,
-					 const xmlChar *prefix,
-					 const xmlChar *name2,
-					 const xmlChar *prefix2);
-XMLPUBFUN void * XMLCALL			
-			xmlHashQLookup3	(xmlHashTablePtr table,
-					 const xmlChar *name,
-					 const xmlChar *prefix,
-					 const xmlChar *name2,
-					 const xmlChar *prefix2,
-					 const xmlChar *name3,
-					 const xmlChar *prefix3);
-
-/*
- * Helpers.
- */
-XMLPUBFUN xmlHashTablePtr XMLCALL		
-			xmlHashCopy	(xmlHashTablePtr table,
-					 xmlHashCopier f);
-XMLPUBFUN int XMLCALL			
-			xmlHashSize	(xmlHashTablePtr table);
-XMLPUBFUN void XMLCALL			
-			xmlHashScan	(xmlHashTablePtr table,
-					 xmlHashScanner f,
-					 void *data);
-XMLPUBFUN void XMLCALL			
-			xmlHashScan3	(xmlHashTablePtr table,
-					 const xmlChar *name,
-					 const xmlChar *name2,
-					 const xmlChar *name3,
-					 xmlHashScanner f,
-					 void *data);
-XMLPUBFUN void XMLCALL			
-			xmlHashScanFull	(xmlHashTablePtr table,
-					 xmlHashScannerFull f,
-					 void *data);
-XMLPUBFUN void XMLCALL			
-			xmlHashScanFull3(xmlHashTablePtr table,
-					 const xmlChar *name,
-					 const xmlChar *name2,
-					 const xmlChar *name3,
-					 xmlHashScannerFull f,
-					 void *data);
-#ifdef __cplusplus
-}
-#endif
-#endif /* ! __XML_HASH_H__ */
diff --git a/interfaces/ext/libxml/list.h b/interfaces/ext/libxml/list.h
deleted file mode 100644
index 1d83482..0000000
--- a/interfaces/ext/libxml/list.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Summary: lists interfaces
- * Description: this module implement the list support used in 
- * various place in the library.
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Gary Pennington <Gary.Pennington at uk.sun.com>
- */
-
-#ifndef __XML_LINK_INCLUDE__
-#define __XML_LINK_INCLUDE__
-
-#include <libxml/xmlversion.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct _xmlLink xmlLink;
-typedef xmlLink *xmlLinkPtr;
-
-typedef struct _xmlList xmlList;
-typedef xmlList *xmlListPtr;
-
-/**
- * xmlListDeallocator:
- * @lk:  the data to deallocate
- *
- * Callback function used to free data from a list.
- */
-typedef void (*xmlListDeallocator) (xmlLinkPtr lk);
-/**
- * xmlListDataCompare:
- * @data0: the first data
- * @data1: the second data
- *
- * Callback function used to compare 2 data.
- *
- * Returns 0 is equality, -1 or 1 otherwise depending on the ordering.
- */
-typedef int  (*xmlListDataCompare) (const void *data0, const void *data1);
-/**
- * xmlListWalker:
- * @data: the data found in the list
- * @user: extra user provided data to the walker
- *
- * Callback function used when walking a list with xmlListWalk().
- *
- * Returns 0 to stop walking the list, 1 otherwise.
- */
-typedef int (*xmlListWalker) (const void *data, const void *user);
-
-/* Creation/Deletion */
-XMLPUBFUN xmlListPtr XMLCALL
-		xmlListCreate		(xmlListDeallocator deallocator,
-	                                 xmlListDataCompare compare);
-XMLPUBFUN void XMLCALL		
-		xmlListDelete		(xmlListPtr l);
-
-/* Basic Operators */
-XMLPUBFUN void * XMLCALL		
-		xmlListSearch		(xmlListPtr l,
-					 void *data);
-XMLPUBFUN void * XMLCALL		
-		xmlListReverseSearch	(xmlListPtr l,
-					 void *data);
-XMLPUBFUN int XMLCALL		
-		xmlListInsert		(xmlListPtr l,
-					 void *data) ;
-XMLPUBFUN int XMLCALL		
-		xmlListAppend		(xmlListPtr l,
-					 void *data) ;
-XMLPUBFUN int XMLCALL		
-		xmlListRemoveFirst	(xmlListPtr l,
-					 void *data);
-XMLPUBFUN int XMLCALL		
-		xmlListRemoveLast	(xmlListPtr l,
-					 void *data);
-XMLPUBFUN int XMLCALL		
-		xmlListRemoveAll	(xmlListPtr l,
-					 void *data);
-XMLPUBFUN void XMLCALL		
-		xmlListClear		(xmlListPtr l);
-XMLPUBFUN int XMLCALL		
-		xmlListEmpty		(xmlListPtr l);
-XMLPUBFUN xmlLinkPtr XMLCALL	
-		xmlListFront		(xmlListPtr l);
-XMLPUBFUN xmlLinkPtr XMLCALL	
-		xmlListEnd		(xmlListPtr l);
-XMLPUBFUN int XMLCALL		
-		xmlListSize		(xmlListPtr l);
-
-XMLPUBFUN void XMLCALL		
-		xmlListPopFront		(xmlListPtr l);
-XMLPUBFUN void XMLCALL		
-		xmlListPopBack		(xmlListPtr l);
-XMLPUBFUN int XMLCALL		
-		xmlListPushFront	(xmlListPtr l,
-					 void *data);
-XMLPUBFUN int XMLCALL		
-		xmlListPushBack		(xmlListPtr l,
-					 void *data);
-
-/* Advanced Operators */
-XMLPUBFUN void XMLCALL		
-		xmlListReverse		(xmlListPtr l);
-XMLPUBFUN void XMLCALL		
-		xmlListSort		(xmlListPtr l);
-XMLPUBFUN void XMLCALL		
-		xmlListWalk		(xmlListPtr l,
-					 xmlListWalker walker,
-					 const void *user);
-XMLPUBFUN void XMLCALL		
-		xmlListReverseWalk	(xmlListPtr l,
-					 xmlListWalker walker,
-					 const void *user);
-XMLPUBFUN void XMLCALL		
-		xmlListMerge		(xmlListPtr l1,
-					 xmlListPtr l2);
-XMLPUBFUN xmlListPtr XMLCALL	
-		xmlListDup		(const xmlListPtr old);
-XMLPUBFUN int XMLCALL		
-		xmlListCopy		(xmlListPtr cur,
-					 const xmlListPtr old);
-/* Link operators */
-XMLPUBFUN void * XMLCALL          
-		xmlLinkGetData          (xmlLinkPtr lk);
-
-/* xmlListUnique() */
-/* xmlListSwap */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __XML_LINK_INCLUDE__ */
diff --git a/interfaces/ext/libxml/nanoftp.h b/interfaces/ext/libxml/nanoftp.h
deleted file mode 100644
index e3c28a0..0000000
--- a/interfaces/ext/libxml/nanoftp.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Summary: minimal FTP implementation
- * Description: minimal FTP implementation allowing to fetch resources
- *              like external subset.
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
- 
-#ifndef __NANO_FTP_H__
-#define __NANO_FTP_H__
-
-#include <libxml/xmlversion.h>
-
-#ifdef LIBXML_FTP_ENABLED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * ftpListCallback: 
- * @userData:  user provided data for the callback
- * @filename:  the file name (including "->" when links are shown)
- * @attrib:  the attribute string
- * @owner:  the owner string
- * @group:  the group string
- * @size:  the file size
- * @links:  the link count
- * @year:  the year
- * @month:  the month
- * @day:  the day
- * @hour:  the hour
- * @minute:  the minute
- *
- * A callback for the xmlNanoFTPList command.
- * Note that only one of year and day:minute are specified.
- */
-typedef void (*ftpListCallback) (void *userData,
-	                         const char *filename, const char *attrib,
-	                         const char *owner, const char *group,
-				 unsigned long size, int links, int year,
-				 const char *month, int day, int hour,
-				 int minute);
-/**
- * ftpDataCallback: 
- * @userData: the user provided context
- * @data: the data received
- * @len: its size in bytes
- *
- * A callback for the xmlNanoFTPGet command.
- */
-typedef void (*ftpDataCallback) (void *userData,
-				 const char *data,
-				 int len);
-
-/*
- * Init
- */
-XMLPUBFUN void XMLCALL
-	xmlNanoFTPInit		(void);
-XMLPUBFUN void XMLCALL	
-	xmlNanoFTPCleanup	(void);
-
-/*
- * Creating/freeing contexts.
- */
-XMLPUBFUN void * XMLCALL	
-	xmlNanoFTPNewCtxt	(const char *URL);
-XMLPUBFUN void XMLCALL	
-	xmlNanoFTPFreeCtxt	(void * ctx);
-XMLPUBFUN void * XMLCALL 	
-	xmlNanoFTPConnectTo	(const char *server,
-				 int port);
-/*
- * Opening/closing session connections.
- */
-XMLPUBFUN void * XMLCALL 	
-	xmlNanoFTPOpen		(const char *URL);
-XMLPUBFUN int XMLCALL	
-	xmlNanoFTPConnect	(void *ctx);
-XMLPUBFUN int XMLCALL	
-	xmlNanoFTPClose		(void *ctx);
-XMLPUBFUN int XMLCALL	
-	xmlNanoFTPQuit		(void *ctx);
-XMLPUBFUN void XMLCALL	
-	xmlNanoFTPScanProxy	(const char *URL);
-XMLPUBFUN void XMLCALL	
-	xmlNanoFTPProxy		(const char *host,
-				 int port,
-				 const char *user,
-				 const char *passwd,
-				 int type);
-XMLPUBFUN int XMLCALL	
-	xmlNanoFTPUpdateURL	(void *ctx,
-				 const char *URL);
-
-/*
- * Rather internal commands.
- */
-XMLPUBFUN int XMLCALL	
-	xmlNanoFTPGetResponse	(void *ctx);
-XMLPUBFUN int XMLCALL	
-	xmlNanoFTPCheckResponse	(void *ctx);
-
-/*
- * CD/DIR/GET handlers.
- */
-XMLPUBFUN int XMLCALL	
-	xmlNanoFTPCwd		(void *ctx,
-				 const char *directory);
-XMLPUBFUN int XMLCALL	
-	xmlNanoFTPDele		(void *ctx,
-				 const char *file);
-
-XMLPUBFUN int XMLCALL	
-	xmlNanoFTPGetConnection	(void *ctx);
-XMLPUBFUN int XMLCALL	
-	xmlNanoFTPCloseConnection(void *ctx);
-XMLPUBFUN int XMLCALL	
-	xmlNanoFTPList		(void *ctx,
-				 ftpListCallback callback,
-				 void *userData,
-				 const char *filename);
-XMLPUBFUN int XMLCALL	
-	xmlNanoFTPGetSocket	(void *ctx,
-				 const char *filename);
-XMLPUBFUN int XMLCALL	
-	xmlNanoFTPGet		(void *ctx,
-				 ftpDataCallback callback,
-				 void *userData,
-				 const char *filename);
-XMLPUBFUN int XMLCALL	
-	xmlNanoFTPRead		(void *ctx,
-				 void *dest,
-				 int len);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* LIBXML_FTP_ENABLED */
-#endif /* __NANO_FTP_H__ */
diff --git a/interfaces/ext/libxml/nanohttp.h b/interfaces/ext/libxml/nanohttp.h
deleted file mode 100644
index 1d8ac24..0000000
--- a/interfaces/ext/libxml/nanohttp.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Summary: minimal HTTP implementation
- * Description: minimal HTTP implementation allowing to fetch resources
- *              like external subset.
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
- 
-#ifndef __NANO_HTTP_H__
-#define __NANO_HTTP_H__
-
-#include <libxml/xmlversion.h>
-
-#ifdef LIBXML_HTTP_ENABLED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-XMLPUBFUN void XMLCALL
-	xmlNanoHTTPInit		(void);
-XMLPUBFUN void XMLCALL	
-	xmlNanoHTTPCleanup	(void);
-XMLPUBFUN void XMLCALL	
-	xmlNanoHTTPScanProxy	(const char *URL);
-XMLPUBFUN int XMLCALL	
-	xmlNanoHTTPFetch	(const char *URL,
-				 const char *filename,
-				 char **contentType);
-XMLPUBFUN void * XMLCALL	
-	xmlNanoHTTPMethod	(const char *URL,
-				 const char *method,
-				 const char *input,
-				 char **contentType,
-				 const char *headers,
-				 int   ilen);
-XMLPUBFUN void * XMLCALL	
-	xmlNanoHTTPMethodRedir	(const char *URL,
-				 const char *method,
-				 const char *input,
-				 char **contentType,
-				 char **redir,
-				 const char *headers,
-				 int   ilen);
-XMLPUBFUN void * XMLCALL	
-	xmlNanoHTTPOpen		(const char *URL,
-				 char **contentType);
-XMLPUBFUN void * XMLCALL	
-	xmlNanoHTTPOpenRedir	(const char *URL,
-				 char **contentType,
-				 char **redir);
-XMLPUBFUN int XMLCALL	
-	xmlNanoHTTPReturnCode	(void *ctx);
-XMLPUBFUN const char * XMLCALL 
-	xmlNanoHTTPAuthHeader	(void *ctx);
-XMLPUBFUN const char * XMLCALL
-	xmlNanoHTTPRedir	(void *ctx);
-XMLPUBFUN int XMLCALL
-	xmlNanoHTTPContentLength( void * ctx );
-XMLPUBFUN const char * XMLCALL
-	xmlNanoHTTPEncoding	(void *ctx);
-XMLPUBFUN const char * XMLCALL
-	xmlNanoHTTPMimeType	(void *ctx);
-XMLPUBFUN int XMLCALL	
-	xmlNanoHTTPRead		(void *ctx,
-				 void *dest,
-				 int len);
-#ifdef LIBXML_OUTPUT_ENABLED
-XMLPUBFUN int XMLCALL	
-	xmlNanoHTTPSave		(void *ctxt,
-				 const char *filename);
-#endif /* LIBXML_OUTPUT_ENABLED */
-XMLPUBFUN void XMLCALL	
-	xmlNanoHTTPClose	(void *ctx);
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LIBXML_HTTP_ENABLED */
-#endif /* __NANO_HTTP_H__ */
diff --git a/interfaces/ext/libxml/parser.h b/interfaces/ext/libxml/parser.h
deleted file mode 100644
index 567addb..0000000
--- a/interfaces/ext/libxml/parser.h
+++ /dev/null
@@ -1,1226 +0,0 @@
-/*
- * Summary: the core parser module
- * Description: Interfaces, constants and types related to the XML parser
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#ifndef __XML_PARSER_H__
-#define __XML_PARSER_H__
-
-#include <stdarg.h>
-
-#include <libxml/xmlversion.h>
-#include <libxml/tree.h>
-#include <libxml/dict.h>
-#include <libxml/hash.h>
-#include <libxml/valid.h>
-#include <libxml/entities.h>
-#include <libxml/xmlerror.h>
-#include <libxml/xmlstring.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * XML_DEFAULT_VERSION:
- *
- * The default version of XML used: 1.0
- */
-#define XML_DEFAULT_VERSION	"1.0"
-
-/**
- * xmlParserInput:
- *
- * An xmlParserInput is an input flow for the XML processor.
- * Each entity parsed is associated an xmlParserInput (except the
- * few predefined ones). This is the case both for internal entities
- * - in which case the flow is already completely in memory - or
- * external entities - in which case we use the buf structure for
- * progressive reading and I18N conversions to the internal UTF-8 format.
- */
-
-/**
- * xmlParserInputDeallocate:
- * @str:  the string to deallocate
- *
- * Callback for freeing some parser input allocations.
- */
-typedef void (* xmlParserInputDeallocate)(xmlChar *str);
-
-struct _xmlParserInput {
-    /* Input buffer */
-    xmlParserInputBufferPtr buf;      /* UTF-8 encoded buffer */
-
-    const char *filename;             /* The file analyzed, if any */
-    const char *directory;            /* the directory/base of the file */
-    const xmlChar *base;              /* Base of the array to parse */
-    const xmlChar *cur;               /* Current char being parsed */
-    const xmlChar *end;               /* end of the array to parse */
-    int length;                       /* length if known */
-    int line;                         /* Current line */
-    int col;                          /* Current column */
-    /*
-     * NOTE: consumed is only tested for equality in the parser code,
-     *       so even if there is an overflow this should not give troubles
-     *       for parsing very large instances.
-     */
-    unsigned long consumed;           /* How many xmlChars already consumed */
-    xmlParserInputDeallocate free;    /* function to deallocate the base */
-    const xmlChar *encoding;          /* the encoding string for entity */
-    const xmlChar *version;           /* the version string for entity */
-    int standalone;                   /* Was that entity marked standalone */
-    int id;                           /* an unique identifier for the entity */
-};
-
-/**
- * xmlParserNodeInfo:
- *
- * The parser can be asked to collect Node informations, i.e. at what
- * place in the file they were detected. 
- * NOTE: This is off by default and not very well tested.
- */
-typedef struct _xmlParserNodeInfo xmlParserNodeInfo;
-typedef xmlParserNodeInfo *xmlParserNodeInfoPtr;
-
-struct _xmlParserNodeInfo {
-  const struct _xmlNode* node;
-  /* Position & line # that text that created the node begins & ends on */
-  unsigned long begin_pos;
-  unsigned long begin_line;
-  unsigned long end_pos;
-  unsigned long end_line;
-};
-
-typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq;
-typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;
-struct _xmlParserNodeInfoSeq {
-  unsigned long maximum;
-  unsigned long length;
-  xmlParserNodeInfo* buffer;
-};
-
-/**
- * xmlParserInputState:
- *
- * The parser is now working also as a state based parser.
- * The recursive one use the state info for entities processing.
- */
-typedef enum {
-    XML_PARSER_EOF = -1,	/* nothing is to be parsed */
-    XML_PARSER_START = 0,	/* nothing has been parsed */
-    XML_PARSER_MISC,		/* Misc* before int subset */
-    XML_PARSER_PI,		/* Within a processing instruction */
-    XML_PARSER_DTD,		/* within some DTD content */
-    XML_PARSER_PROLOG,		/* Misc* after internal subset */
-    XML_PARSER_COMMENT,		/* within a comment */
-    XML_PARSER_START_TAG,	/* within a start tag */
-    XML_PARSER_CONTENT,		/* within the content */
-    XML_PARSER_CDATA_SECTION,	/* within a CDATA section */
-    XML_PARSER_END_TAG,		/* within a closing tag */
-    XML_PARSER_ENTITY_DECL,	/* within an entity declaration */
-    XML_PARSER_ENTITY_VALUE,	/* within an entity value in a decl */
-    XML_PARSER_ATTRIBUTE_VALUE,	/* within an attribute value */
-    XML_PARSER_SYSTEM_LITERAL,	/* within a SYSTEM value */
-    XML_PARSER_EPILOG, 		/* the Misc* after the last end tag */
-    XML_PARSER_IGNORE,		/* within an IGNORED section */
-    XML_PARSER_PUBLIC_LITERAL 	/* within a PUBLIC value */
-} xmlParserInputState;
-
-/**
- * XML_DETECT_IDS:
- *
- * Bit in the loadsubset context field to tell to do ID/REFs lookups.
- * Use it to initialize xmlLoadExtDtdDefaultValue.
- */
-#define XML_DETECT_IDS		2
-
-/**
- * XML_COMPLETE_ATTRS:
- *
- * Bit in the loadsubset context field to tell to do complete the
- * elements attributes lists with the ones defaulted from the DTDs.
- * Use it to initialize xmlLoadExtDtdDefaultValue.
- */
-#define XML_COMPLETE_ATTRS	4
-
-/**
- * XML_SKIP_IDS:
- *
- * Bit in the loadsubset context field to tell to not do ID/REFs registration.
- * Used to initialize xmlLoadExtDtdDefaultValue in some special cases.
- */
-#define XML_SKIP_IDS		8
-
-/**
- * xmlParserMode:
- *
- * A parser can operate in various modes
- */
-typedef enum {
-    XML_PARSE_UNKNOWN = 0,
-    XML_PARSE_DOM = 1,
-    XML_PARSE_SAX = 2,
-    XML_PARSE_PUSH_DOM = 3,
-    XML_PARSE_PUSH_SAX = 4,
-    XML_PARSE_READER = 5
-} xmlParserMode;
-
-/**
- * xmlParserCtxt:
- *
- * The parser context.
- * NOTE This doesn't completely define the parser state, the (current ?)
- *      design of the parser uses recursive function calls since this allow
- *      and easy mapping from the production rules of the specification
- *      to the actual code. The drawback is that the actual function call
- *      also reflect the parser state. However most of the parsing routines
- *      takes as the only argument the parser context pointer, so migrating
- *      to a state based parser for progressive parsing shouldn't be too hard.
- */
-struct _xmlParserCtxt {
-    struct _xmlSAXHandler *sax;       /* The SAX handler */
-    void            *userData;        /* For SAX interface only, used by DOM build */
-    xmlDocPtr           myDoc;        /* the document being built */
-    int            wellFormed;        /* is the document well formed */
-    int       replaceEntities;        /* shall we replace entities ? */
-    const xmlChar    *version;        /* the XML version string */
-    const xmlChar   *encoding;        /* the declared encoding, if any */
-    int            standalone;        /* standalone document */
-    int                  html;        /* an HTML(1)/Docbook(2) document */
-
-    /* Input stream stack */
-    xmlParserInputPtr  input;         /* Current input stream */
-    int                inputNr;       /* Number of current input streams */
-    int                inputMax;      /* Max number of input streams */
-    xmlParserInputPtr *inputTab;      /* stack of inputs */
-
-    /* Node analysis stack only used for DOM building */
-    xmlNodePtr         node;          /* Current parsed Node */
-    int                nodeNr;        /* Depth of the parsing stack */
-    int                nodeMax;       /* Max depth of the parsing stack */
-    xmlNodePtr        *nodeTab;       /* array of nodes */
-
-    int record_info;                  /* Whether node info should be kept */
-    xmlParserNodeInfoSeq node_seq;    /* info about each node parsed */
-
-    int errNo;                        /* error code */
-
-    int     hasExternalSubset;        /* reference and external subset */
-    int             hasPErefs;        /* the internal subset has PE refs */
-    int              external;        /* are we parsing an external entity */
-
-    int                 valid;        /* is the document valid */
-    int              validate;        /* shall we try to validate ? */
-    xmlValidCtxt        vctxt;        /* The validity context */
-
-    xmlParserInputState instate;      /* current type of input */
-    int                 token;        /* next char look-ahead */    
-
-    char           *directory;        /* the data directory */
-
-    /* Node name stack */
-    const xmlChar     *name;          /* Current parsed Node */
-    int                nameNr;        /* Depth of the parsing stack */
-    int                nameMax;       /* Max depth of the parsing stack */
-    const xmlChar *   *nameTab;       /* array of nodes */
-
-    long               nbChars;       /* number of xmlChar processed */
-    long            checkIndex;       /* used by progressive parsing lookup */
-    int             keepBlanks;       /* ugly but ... */
-    int             disableSAX;       /* SAX callbacks are disabled */
-    int               inSubset;       /* Parsing is in int 1/ext 2 subset */
-    const xmlChar *    intSubName;    /* name of subset */
-    xmlChar *          extSubURI;     /* URI of external subset */
-    xmlChar *          extSubSystem;  /* SYSTEM ID of external subset */
-
-    /* xml:space values */
-    int *              space;         /* Should the parser preserve spaces */
-    int                spaceNr;       /* Depth of the parsing stack */
-    int                spaceMax;      /* Max depth of the parsing stack */
-    int *              spaceTab;      /* array of space infos */
-
-    int                depth;         /* to prevent entity substitution loops */
-    xmlParserInputPtr  entity;        /* used to check entities boundaries */
-    int                charset;       /* encoding of the in-memory content
-				         actually an xmlCharEncoding */
-    int                nodelen;       /* Those two fields are there to */
-    int                nodemem;       /* Speed up large node parsing */
-    int                pedantic;      /* signal pedantic warnings */
-    void              *_private;      /* For user data, libxml won't touch it */
-
-    int                loadsubset;    /* should the external subset be loaded */
-    int                linenumbers;   /* set line number in element content */
-    void              *catalogs;      /* document's own catalog */
-    int                recovery;      /* run in recovery mode */
-    int                progressive;   /* is this a progressive parsing */
-    xmlDictPtr         dict;          /* dictionnary for the parser */
-    const xmlChar *   *atts;          /* array for the attributes callbacks */
-    int                maxatts;       /* the size of the array */
-    int                docdict;       /* use strings from dict to build tree */
-
-    /*
-     * pre-interned strings
-     */
-    const xmlChar *str_xml;
-    const xmlChar *str_xmlns;
-    const xmlChar *str_xml_ns;
-
-    /*
-     * Everything below is used only by the new SAX mode
-     */
-    int                sax2;          /* operating in the new SAX mode */
-    int                nsNr;          /* the number of inherited namespaces */
-    int                nsMax;         /* the size of the arrays */
-    const xmlChar *   *nsTab;         /* the array of prefix/namespace name */
-    int               *attallocs;     /* which attribute were allocated */
-    void *            *pushTab;       /* array of data for push */
-    xmlHashTablePtr    attsDefault;   /* defaulted attributes if any */
-    xmlHashTablePtr    attsSpecial;   /* non-CDATA attributes if any */
-    int                nsWellFormed;  /* is the document XML Nanespace okay */
-    int                options;       /* Extra options */
-
-    /*
-     * Those fields are needed only for treaming parsing so far
-     */
-    int               dictNames;    /* Use dictionary names for the tree */
-    int               freeElemsNr;  /* number of freed element nodes */
-    xmlNodePtr        freeElems;    /* List of freed element nodes */
-    int               freeAttrsNr;  /* number of freed attributes nodes */
-    xmlAttrPtr        freeAttrs;    /* List of freed attributes nodes */
-
-    /*
-     * the complete error informations for the last error.
-     */
-    xmlError          lastError;
-    xmlParserMode     parseMode;    /* the parser mode */
-    unsigned long    nbentities;    /* number of entities references */
-    unsigned long  sizeentities;    /* size of parsed entities */
-};
-
-/**
- * xmlSAXLocator:
- *
- * A SAX Locator.
- */
-struct _xmlSAXLocator {
-    const xmlChar *(*getPublicId)(void *ctx);
-    const xmlChar *(*getSystemId)(void *ctx);
-    int (*getLineNumber)(void *ctx);
-    int (*getColumnNumber)(void *ctx);
-};
-
-/**
- * xmlSAXHandler:
- *
- * A SAX handler is bunch of callbacks called by the parser when processing
- * of the input generate data or structure informations.
- */
-
-/**
- * resolveEntitySAXFunc:
- * @ctx:  the user data (XML parser context)
- * @publicId: The public ID of the entity
- * @systemId: The system ID of the entity
- *
- * Callback:
- * The entity loader, to control the loading of external entities,
- * the application can either:
- *    - override this resolveEntity() callback in the SAX block
- *    - or better use the xmlSetExternalEntityLoader() function to
- *      set up it's own entity resolution routine
- *
- * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
- */
-typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx,
-				const xmlChar *publicId,
-				const xmlChar *systemId);
-/**
- * internalSubsetSAXFunc:
- * @ctx:  the user data (XML parser context)
- * @name:  the root element name
- * @ExternalID:  the external ID
- * @SystemID:  the SYSTEM ID (e.g. filename or URL)
- *
- * Callback on internal subset declaration.
- */
-typedef void (*internalSubsetSAXFunc) (void *ctx,
-				const xmlChar *name,
-				const xmlChar *ExternalID,
-				const xmlChar *SystemID);
-/**
- * externalSubsetSAXFunc:
- * @ctx:  the user data (XML parser context)
- * @name:  the root element name
- * @ExternalID:  the external ID
- * @SystemID:  the SYSTEM ID (e.g. filename or URL)
- *
- * Callback on external subset declaration.
- */
-typedef void (*externalSubsetSAXFunc) (void *ctx,
-				const xmlChar *name,
-				const xmlChar *ExternalID,
-				const xmlChar *SystemID);
-/**
- * getEntitySAXFunc:
- * @ctx:  the user data (XML parser context)
- * @name: The entity name
- *
- * Get an entity by name.
- *
- * Returns the xmlEntityPtr if found.
- */
-typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx,
-				const xmlChar *name);
-/**
- * getParameterEntitySAXFunc:
- * @ctx:  the user data (XML parser context)
- * @name: The entity name
- *
- * Get a parameter entity by name.
- *
- * Returns the xmlEntityPtr if found.
- */
-typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx,
-				const xmlChar *name);
-/**
- * entityDeclSAXFunc:
- * @ctx:  the user data (XML parser context)
- * @name:  the entity name 
- * @type:  the entity type 
- * @publicId: The public ID of the entity
- * @systemId: The system ID of the entity
- * @content: the entity value (without processing).
- *
- * An entity definition has been parsed.
- */
-typedef void (*entityDeclSAXFunc) (void *ctx,
-				const xmlChar *name,
-				int type,
-				const xmlChar *publicId,
-				const xmlChar *systemId,
-				xmlChar *content);
-/**
- * notationDeclSAXFunc:
- * @ctx:  the user data (XML parser context)
- * @name: The name of the notation
- * @publicId: The public ID of the entity
- * @systemId: The system ID of the entity
- *
- * What to do when a notation declaration has been parsed.
- */
-typedef void (*notationDeclSAXFunc)(void *ctx,
-				const xmlChar *name,
-				const xmlChar *publicId,
-				const xmlChar *systemId);
-/**
- * attributeDeclSAXFunc:
- * @ctx:  the user data (XML parser context)
- * @elem:  the name of the element
- * @fullname:  the attribute name 
- * @type:  the attribute type 
- * @def:  the type of default value
- * @defaultValue: the attribute default value
- * @tree:  the tree of enumerated value set
- *
- * An attribute definition has been parsed.
- */
-typedef void (*attributeDeclSAXFunc)(void *ctx,
-				const xmlChar *elem,
-				const xmlChar *fullname,
-				int type,
-				int def,
-				const xmlChar *defaultValue,
-				xmlEnumerationPtr tree);
-/**
- * elementDeclSAXFunc:
- * @ctx:  the user data (XML parser context)
- * @name:  the element name 
- * @type:  the element type 
- * @content: the element value tree
- *
- * An element definition has been parsed.
- */
-typedef void (*elementDeclSAXFunc)(void *ctx,
-				const xmlChar *name,
-				int type,
-				xmlElementContentPtr content);
-/**
- * unparsedEntityDeclSAXFunc:
- * @ctx:  the user data (XML parser context)
- * @name: The name of the entity
- * @publicId: The public ID of the entity
- * @systemId: The system ID of the entity
- * @notationName: the name of the notation
- *
- * What to do when an unparsed entity declaration is parsed.
- */
-typedef void (*unparsedEntityDeclSAXFunc)(void *ctx,
-				const xmlChar *name,
-				const xmlChar *publicId,
-				const xmlChar *systemId,
-				const xmlChar *notationName);
-/**
- * setDocumentLocatorSAXFunc:
- * @ctx:  the user data (XML parser context)
- * @loc: A SAX Locator
- *
- * Receive the document locator at startup, actually xmlDefaultSAXLocator.
- * Everything is available on the context, so this is useless in our case.
- */
-typedef void (*setDocumentLocatorSAXFunc) (void *ctx,
-				xmlSAXLocatorPtr loc);
-/**
- * startDocumentSAXFunc:
- * @ctx:  the user data (XML parser context)
- *
- * Called when the document start being processed.
- */
-typedef void (*startDocumentSAXFunc) (void *ctx);
-/**
- * endDocumentSAXFunc:
- * @ctx:  the user data (XML parser context)
- *
- * Called when the document end has been detected.
- */
-typedef void (*endDocumentSAXFunc) (void *ctx);
-/**
- * startElementSAXFunc:
- * @ctx:  the user data (XML parser context)
- * @name:  The element name, including namespace prefix
- * @atts:  An array of name/value attributes pairs, NULL terminated
- *
- * Called when an opening tag has been processed.
- */
-typedef void (*startElementSAXFunc) (void *ctx,
-				const xmlChar *name,
-				const xmlChar **atts);
-/**
- * endElementSAXFunc:
- * @ctx:  the user data (XML parser context)
- * @name:  The element name
- *
- * Called when the end of an element has been detected.
- */
-typedef void (*endElementSAXFunc) (void *ctx,
-				const xmlChar *name);
-/**
- * attributeSAXFunc:
- * @ctx:  the user data (XML parser context)
- * @name:  The attribute name, including namespace prefix
- * @value:  The attribute value
- *
- * Handle an attribute that has been read by the parser.
- * The default handling is to convert the attribute into an
- * DOM subtree and past it in a new xmlAttr element added to
- * the element.
- */
-typedef void (*attributeSAXFunc) (void *ctx,
-				const xmlChar *name,
-				const xmlChar *value);
-/**
- * referenceSAXFunc:
- * @ctx:  the user data (XML parser context)
- * @name:  The entity name
- *
- * Called when an entity reference is detected. 
- */
-typedef void (*referenceSAXFunc) (void *ctx,
-				const xmlChar *name);
-/**
- * charactersSAXFunc:
- * @ctx:  the user data (XML parser context)
- * @ch:  a xmlChar string
- * @len: the number of xmlChar
- *
- * Receiving some chars from the parser.
- */
-typedef void (*charactersSAXFunc) (void *ctx,
-				const xmlChar *ch,
-				int len);
-/**
- * ignorableWhitespaceSAXFunc:
- * @ctx:  the user data (XML parser context)
- * @ch:  a xmlChar string
- * @len: the number of xmlChar
- *
- * Receiving some ignorable whitespaces from the parser.
- * UNUSED: by default the DOM building will use characters.
- */
-typedef void (*ignorableWhitespaceSAXFunc) (void *ctx,
-				const xmlChar *ch,
-				int len);
-/**
- * processingInstructionSAXFunc:
- * @ctx:  the user data (XML parser context)
- * @target:  the target name
- * @data: the PI data's
- *
- * A processing instruction has been parsed.
- */
-typedef void (*processingInstructionSAXFunc) (void *ctx,
-				const xmlChar *target,
-				const xmlChar *data);
-/**
- * commentSAXFunc:
- * @ctx:  the user data (XML parser context)
- * @value:  the comment content
- *
- * A comment has been parsed.
- */
-typedef void (*commentSAXFunc) (void *ctx,
-				const xmlChar *value);
-/**
- * cdataBlockSAXFunc:
- * @ctx:  the user data (XML parser context)
- * @value:  The pcdata content
- * @len:  the block length
- *
- * Called when a pcdata block has been parsed.
- */
-typedef void (*cdataBlockSAXFunc) (
-	                        void *ctx,
-				const xmlChar *value,
-				int len);
-/**
- * warningSAXFunc:
- * @ctx:  an XML parser context
- * @msg:  the message to display/transmit
- * @...:  extra parameters for the message display
- * 
- * Display and format a warning messages, callback.
- */
-typedef void (XMLCDECL *warningSAXFunc) (void *ctx,
-				const char *msg, ...) ATTRIBUTE_PRINTF(2,3);
-/**
- * errorSAXFunc:
- * @ctx:  an XML parser context
- * @msg:  the message to display/transmit
- * @...:  extra parameters for the message display
- * 
- * Display and format an error messages, callback.
- */
-typedef void (XMLCDECL *errorSAXFunc) (void *ctx,
-				const char *msg, ...) ATTRIBUTE_PRINTF(2,3);
-/**
- * fatalErrorSAXFunc:
- * @ctx:  an XML parser context
- * @msg:  the message to display/transmit
- * @...:  extra parameters for the message display
- * 
- * Display and format fatal error messages, callback.
- * Note: so far fatalError() SAX callbacks are not used, error()
- *       get all the callbacks for errors.
- */
-typedef void (XMLCDECL *fatalErrorSAXFunc) (void *ctx,
-				const char *msg, ...) ATTRIBUTE_PRINTF(2,3);
-/**
- * isStandaloneSAXFunc:
- * @ctx:  the user data (XML parser context)
- *
- * Is this document tagged standalone?
- *
- * Returns 1 if true
- */
-typedef int (*isStandaloneSAXFunc) (void *ctx);
-/**
- * hasInternalSubsetSAXFunc:
- * @ctx:  the user data (XML parser context)
- *
- * Does this document has an internal subset.
- *
- * Returns 1 if true
- */
-typedef int (*hasInternalSubsetSAXFunc) (void *ctx);
-
-/**
- * hasExternalSubsetSAXFunc:
- * @ctx:  the user data (XML parser context)
- *
- * Does this document has an external subset?
- *
- * Returns 1 if true
- */
-typedef int (*hasExternalSubsetSAXFunc) (void *ctx);
-
-/************************************************************************
- *									*
- *			The SAX version 2 API extensions		*
- *									*
- ************************************************************************/
-/**
- * XML_SAX2_MAGIC:
- *
- * Special constant found in SAX2 blocks initialized fields
- */
-#define XML_SAX2_MAGIC 0xDEEDBEAF
-
-/**
- * startElementNsSAX2Func:
- * @ctx:  the user data (XML parser context)
- * @localname:  the local name of the element
- * @prefix:  the element namespace prefix if available
- * @URI:  the element namespace name if available
- * @nb_namespaces:  number of namespace definitions on that node
- * @namespaces:  pointer to the array of prefix/URI pairs namespace definitions
- * @nb_attributes:  the number of attributes on that node
- * @nb_defaulted:  the number of defaulted attributes. The defaulted
- *                  ones are at the end of the array
- * @attributes:  pointer to the array of (localname/prefix/URI/value/end)
- *               attribute values.
- *
- * SAX2 callback when an element start has been detected by the parser.
- * It provides the namespace informations for the element, as well as
- * the new namespace declarations on the element.
- */
-
-typedef void (*startElementNsSAX2Func) (void *ctx,
-					const xmlChar *localname,
-					const xmlChar *prefix,
-					const xmlChar *URI,
-					int nb_namespaces,
-					const xmlChar **namespaces,
-					int nb_attributes,
-					int nb_defaulted,
-					const xmlChar **attributes);
- 
-/**
- * endElementNsSAX2Func:
- * @ctx:  the user data (XML parser context)
- * @localname:  the local name of the element
- * @prefix:  the element namespace prefix if available
- * @URI:  the element namespace name if available
- *
- * SAX2 callback when an element end has been detected by the parser.
- * It provides the namespace informations for the element.
- */
-
-typedef void (*endElementNsSAX2Func)   (void *ctx,
-					const xmlChar *localname,
-					const xmlChar *prefix,
-					const xmlChar *URI);
-
-
-struct _xmlSAXHandler {
-    internalSubsetSAXFunc internalSubset;
-    isStandaloneSAXFunc isStandalone;
-    hasInternalSubsetSAXFunc hasInternalSubset;
-    hasExternalSubsetSAXFunc hasExternalSubset;
-    resolveEntitySAXFunc resolveEntity;
-    getEntitySAXFunc getEntity;
-    entityDeclSAXFunc entityDecl;
-    notationDeclSAXFunc notationDecl;
-    attributeDeclSAXFunc attributeDecl;
-    elementDeclSAXFunc elementDecl;
-    unparsedEntityDeclSAXFunc unparsedEntityDecl;
-    setDocumentLocatorSAXFunc setDocumentLocator;
-    startDocumentSAXFunc startDocument;
-    endDocumentSAXFunc endDocument;
-    startElementSAXFunc startElement;
-    endElementSAXFunc endElement;
-    referenceSAXFunc reference;
-    charactersSAXFunc characters;
-    ignorableWhitespaceSAXFunc ignorableWhitespace;
-    processingInstructionSAXFunc processingInstruction;
-    commentSAXFunc comment;
-    warningSAXFunc warning;
-    errorSAXFunc error;
-    fatalErrorSAXFunc fatalError; /* unused error() get all the errors */
-    getParameterEntitySAXFunc getParameterEntity;
-    cdataBlockSAXFunc cdataBlock;
-    externalSubsetSAXFunc externalSubset;
-    unsigned int initialized;
-    /* The following fields are extensions available only on version 2 */
-    void *_private;
-    startElementNsSAX2Func startElementNs;
-    endElementNsSAX2Func endElementNs;
-    xmlStructuredErrorFunc serror;
-};
-
-/*
- * SAX Version 1
- */
-typedef struct _xmlSAXHandlerV1 xmlSAXHandlerV1;
-typedef xmlSAXHandlerV1 *xmlSAXHandlerV1Ptr;
-struct _xmlSAXHandlerV1 {
-    internalSubsetSAXFunc internalSubset;
-    isStandaloneSAXFunc isStandalone;
-    hasInternalSubsetSAXFunc hasInternalSubset;
-    hasExternalSubsetSAXFunc hasExternalSubset;
-    resolveEntitySAXFunc resolveEntity;
-    getEntitySAXFunc getEntity;
-    entityDeclSAXFunc entityDecl;
-    notationDeclSAXFunc notationDecl;
-    attributeDeclSAXFunc attributeDecl;
-    elementDeclSAXFunc elementDecl;
-    unparsedEntityDeclSAXFunc unparsedEntityDecl;
-    setDocumentLocatorSAXFunc setDocumentLocator;
-    startDocumentSAXFunc startDocument;
-    endDocumentSAXFunc endDocument;
-    startElementSAXFunc startElement;
-    endElementSAXFunc endElement;
-    referenceSAXFunc reference;
-    charactersSAXFunc characters;
-    ignorableWhitespaceSAXFunc ignorableWhitespace;
-    processingInstructionSAXFunc processingInstruction;
-    commentSAXFunc comment;
-    warningSAXFunc warning;
-    errorSAXFunc error;
-    fatalErrorSAXFunc fatalError; /* unused error() get all the errors */
-    getParameterEntitySAXFunc getParameterEntity;
-    cdataBlockSAXFunc cdataBlock;
-    externalSubsetSAXFunc externalSubset;
-    unsigned int initialized;
-};
-
-
-/**
- * xmlExternalEntityLoader:
- * @URL: The System ID of the resource requested
- * @ID: The Public ID of the resource requested
- * @context: the XML parser context 
- *
- * External entity loaders types.
- *
- * Returns the entity input parser.
- */
-typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL,
-					 const char *ID,
-					 xmlParserCtxtPtr context);
-
-#ifdef __cplusplus
-}
-#endif
-
-#include <libxml/encoding.h>
-#include <libxml/xmlIO.h>
-#include <libxml/globals.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*
- * Init/Cleanup
- */
-XMLPUBFUN void XMLCALL		
-		xmlInitParser		(void);
-XMLPUBFUN void XMLCALL		
-		xmlCleanupParser	(void);
-
-/*
- * Input functions
- */
-XMLPUBFUN int XMLCALL		
-		xmlParserInputRead	(xmlParserInputPtr in,
-					 int len);
-XMLPUBFUN int XMLCALL		
-		xmlParserInputGrow	(xmlParserInputPtr in,
-					 int len);
-
-/*
- * Basic parsing Interfaces
- */
-#ifdef LIBXML_SAX1_ENABLED
-XMLPUBFUN xmlDocPtr XMLCALL	
-		xmlParseDoc		(const xmlChar *cur);
-XMLPUBFUN xmlDocPtr XMLCALL	
-		xmlParseFile		(const char *filename);
-XMLPUBFUN xmlDocPtr XMLCALL	
-		xmlParseMemory		(const char *buffer,
-					 int size);
-#endif /* LIBXML_SAX1_ENABLED */
-XMLPUBFUN int XMLCALL		
-		xmlSubstituteEntitiesDefault(int val);
-XMLPUBFUN int XMLCALL		
-		xmlKeepBlanksDefault	(int val);
-XMLPUBFUN void XMLCALL		
-		xmlStopParser		(xmlParserCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL		
-		xmlPedanticParserDefault(int val);
-XMLPUBFUN int XMLCALL		
-		xmlLineNumbersDefault	(int val);
-
-#ifdef LIBXML_SAX1_ENABLED
-/*
- * Recovery mode 
- */
-XMLPUBFUN xmlDocPtr XMLCALL	
-		xmlRecoverDoc		(xmlChar *cur);
-XMLPUBFUN xmlDocPtr XMLCALL	
-		xmlRecoverMemory	(const char *buffer,
-					 int size);
-XMLPUBFUN xmlDocPtr XMLCALL	
-		xmlRecoverFile		(const char *filename);
-#endif /* LIBXML_SAX1_ENABLED */
-
-/*
- * Less common routines and SAX interfaces
- */
-XMLPUBFUN int XMLCALL		
-		xmlParseDocument	(xmlParserCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL		
-		xmlParseExtParsedEnt	(xmlParserCtxtPtr ctxt);
-#ifdef LIBXML_SAX1_ENABLED
-XMLPUBFUN int XMLCALL		
-		xmlSAXUserParseFile	(xmlSAXHandlerPtr sax,
-					 void *user_data,
-					 const char *filename);
-XMLPUBFUN int XMLCALL		
-		xmlSAXUserParseMemory	(xmlSAXHandlerPtr sax,
-					 void *user_data,
-					 const char *buffer,
-					 int size);
-XMLPUBFUN xmlDocPtr XMLCALL	
-		xmlSAXParseDoc		(xmlSAXHandlerPtr sax,
-					 const xmlChar *cur,
-					 int recovery);
-XMLPUBFUN xmlDocPtr XMLCALL	
-		xmlSAXParseMemory	(xmlSAXHandlerPtr sax,
-					 const char *buffer,
-                                   	 int size,
-					 int recovery);
-XMLPUBFUN xmlDocPtr XMLCALL	
-		xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax,
-					 const char *buffer,
-                                   	 int size,
-					 int recovery,
-					 void *data);
-XMLPUBFUN xmlDocPtr XMLCALL	
-		xmlSAXParseFile		(xmlSAXHandlerPtr sax,
-					 const char *filename,
-					 int recovery);
-XMLPUBFUN xmlDocPtr XMLCALL	
-		xmlSAXParseFileWithData	(xmlSAXHandlerPtr sax,
-					 const char *filename,
-					 int recovery,
-					 void *data);
-XMLPUBFUN xmlDocPtr XMLCALL	
-		xmlSAXParseEntity	(xmlSAXHandlerPtr sax,
-					 const char *filename);
-XMLPUBFUN xmlDocPtr XMLCALL	
-		xmlParseEntity		(const char *filename);
-#endif /* LIBXML_SAX1_ENABLED */
-
-#ifdef LIBXML_VALID_ENABLED
-XMLPUBFUN xmlDtdPtr XMLCALL	
-		xmlSAXParseDTD		(xmlSAXHandlerPtr sax,
-					 const xmlChar *ExternalID,
-					 const xmlChar *SystemID);
-XMLPUBFUN xmlDtdPtr XMLCALL	
-		xmlParseDTD		(const xmlChar *ExternalID,
-					 const xmlChar *SystemID);
-XMLPUBFUN xmlDtdPtr XMLCALL	
-		xmlIOParseDTD		(xmlSAXHandlerPtr sax,
-					 xmlParserInputBufferPtr input,
-					 xmlCharEncoding enc);
-#endif /* LIBXML_VALID_ENABLE */
-#ifdef LIBXML_SAX1_ENABLED
-XMLPUBFUN int XMLCALL	
-		xmlParseBalancedChunkMemory(xmlDocPtr doc,
-					 xmlSAXHandlerPtr sax,
-					 void *user_data,
-					 int depth,
-					 const xmlChar *string,
-					 xmlNodePtr *lst);
-#endif /* LIBXML_SAX1_ENABLED */
-XMLPUBFUN xmlParserErrors XMLCALL
-		xmlParseInNodeContext	(xmlNodePtr node,
-					 const char *data,
-					 int datalen,
-					 int options,
-					 xmlNodePtr *lst);
-#ifdef LIBXML_SAX1_ENABLED
-XMLPUBFUN int XMLCALL          
-		xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc,
-                     xmlSAXHandlerPtr sax,
-                     void *user_data,
-                     int depth,
-                     const xmlChar *string,
-                     xmlNodePtr *lst,
-                     int recover);
-XMLPUBFUN int XMLCALL		
-		xmlParseExternalEntity	(xmlDocPtr doc,
-					 xmlSAXHandlerPtr sax,
-					 void *user_data,
-					 int depth,
-					 const xmlChar *URL,
-					 const xmlChar *ID,
-					 xmlNodePtr *lst);
-#endif /* LIBXML_SAX1_ENABLED */
-XMLPUBFUN int XMLCALL		
-		xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx,
-					 const xmlChar *URL,
-					 const xmlChar *ID,
-					 xmlNodePtr *lst);
-
-/*
- * Parser contexts handling.
- */
-XMLPUBFUN xmlParserCtxtPtr XMLCALL	
-		xmlNewParserCtxt	(void);
-XMLPUBFUN int XMLCALL		
-		xmlInitParserCtxt	(xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL		
-		xmlClearParserCtxt	(xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL		
-		xmlFreeParserCtxt	(xmlParserCtxtPtr ctxt);
-#ifdef LIBXML_SAX1_ENABLED
-XMLPUBFUN void XMLCALL		
-		xmlSetupParserForBuffer	(xmlParserCtxtPtr ctxt,
-					 const xmlChar* buffer,
-					 const char *filename);
-#endif /* LIBXML_SAX1_ENABLED */
-XMLPUBFUN xmlParserCtxtPtr XMLCALL 
-		xmlCreateDocParserCtxt	(const xmlChar *cur);
-
-#ifdef LIBXML_LEGACY_ENABLED
-/*
- * Reading/setting optional parsing features.
- */
-XMLPUBFUN int XMLCALL		
-		xmlGetFeaturesList	(int *len,
-					 const char **result);
-XMLPUBFUN int XMLCALL		
-		xmlGetFeature		(xmlParserCtxtPtr ctxt,
-					 const char *name,
-					 void *result);
-XMLPUBFUN int XMLCALL		
-		xmlSetFeature		(xmlParserCtxtPtr ctxt,
-					 const char *name,
-					 void *value);
-#endif /* LIBXML_LEGACY_ENABLED */
-
-#ifdef LIBXML_PUSH_ENABLED
-/*
- * Interfaces for the Push mode.
- */
-XMLPUBFUN xmlParserCtxtPtr XMLCALL 
-		xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax,
-					 void *user_data,
-					 const char *chunk,
-					 int size,
-					 const char *filename);
-XMLPUBFUN int XMLCALL		 
-		xmlParseChunk		(xmlParserCtxtPtr ctxt,
-					 const char *chunk,
-					 int size,
-					 int terminate);
-#endif /* LIBXML_PUSH_ENABLED */
-
-/*
- * Special I/O mode.
- */
-
-XMLPUBFUN xmlParserCtxtPtr XMLCALL 
-		xmlCreateIOParserCtxt	(xmlSAXHandlerPtr sax,
-					 void *user_data,
-					 xmlInputReadCallback   ioread,
-					 xmlInputCloseCallback  ioclose,
-					 void *ioctx,
-					 xmlCharEncoding enc);
-
-XMLPUBFUN xmlParserInputPtr XMLCALL 
-		xmlNewIOInputStream	(xmlParserCtxtPtr ctxt,
-					 xmlParserInputBufferPtr input,
-					 xmlCharEncoding enc);
-
-/*
- * Node infos.
- */
-XMLPUBFUN const xmlParserNodeInfo* XMLCALL
-		xmlParserFindNodeInfo	(const xmlParserCtxtPtr ctxt,
-				         const xmlNodePtr node);
-XMLPUBFUN void XMLCALL		
-		xmlInitNodeInfoSeq	(xmlParserNodeInfoSeqPtr seq);
-XMLPUBFUN void XMLCALL		
-		xmlClearNodeInfoSeq	(xmlParserNodeInfoSeqPtr seq);
-XMLPUBFUN unsigned long XMLCALL 
-		xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq,
-                                         const xmlNodePtr node);
-XMLPUBFUN void XMLCALL		
-		xmlParserAddNodeInfo	(xmlParserCtxtPtr ctxt,
-					 const xmlParserNodeInfoPtr info);
-
-/*
- * External entities handling actually implemented in xmlIO.
- */
-
-XMLPUBFUN void XMLCALL		
-		xmlSetExternalEntityLoader(xmlExternalEntityLoader f);
-XMLPUBFUN xmlExternalEntityLoader XMLCALL
-		xmlGetExternalEntityLoader(void);
-XMLPUBFUN xmlParserInputPtr XMLCALL
-		xmlLoadExternalEntity	(const char *URL,
-					 const char *ID,
-					 xmlParserCtxtPtr ctxt);
-
-/*
- * Index lookup, actually implemented in the encoding module
- */
-XMLPUBFUN long XMLCALL
-		xmlByteConsumed		(xmlParserCtxtPtr ctxt);
-
-/*
- * New set of simpler/more flexible APIs
- */
-/**
- * xmlParserOption:
- *
- * This is the set of XML parser options that can be passed down
- * to the xmlReadDoc() and similar calls.
- */
-typedef enum {
-    XML_PARSE_RECOVER	= 1<<0,	/* recover on errors */
-    XML_PARSE_NOENT	= 1<<1,	/* substitute entities */
-    XML_PARSE_DTDLOAD	= 1<<2,	/* load the external subset */
-    XML_PARSE_DTDATTR	= 1<<3,	/* default DTD attributes */
-    XML_PARSE_DTDVALID	= 1<<4,	/* validate with the DTD */
-    XML_PARSE_NOERROR	= 1<<5,	/* suppress error reports */
-    XML_PARSE_NOWARNING	= 1<<6,	/* suppress warning reports */
-    XML_PARSE_PEDANTIC	= 1<<7,	/* pedantic error reporting */
-    XML_PARSE_NOBLANKS	= 1<<8,	/* remove blank nodes */
-    XML_PARSE_SAX1	= 1<<9,	/* use the SAX1 interface internally */
-    XML_PARSE_XINCLUDE	= 1<<10,/* Implement XInclude substitition  */
-    XML_PARSE_NONET	= 1<<11,/* Forbid network access */
-    XML_PARSE_NODICT	= 1<<12,/* Do not reuse the context dictionnary */
-    XML_PARSE_NSCLEAN	= 1<<13,/* remove redundant namespaces declarations */
-    XML_PARSE_NOCDATA	= 1<<14,/* merge CDATA as text nodes */
-    XML_PARSE_NOXINCNODE= 1<<15,/* do not generate XINCLUDE START/END nodes */
-    XML_PARSE_COMPACT   = 1<<16,/* compact small text nodes; no modification of
-                                   the tree allowed afterwards (will possibly
-				   crash if you try to modify the tree) */
-    XML_PARSE_OLD10	= 1<<17,/* parse using XML-1.0 before update 5 */
-    XML_PARSE_NOBASEFIX = 1<<18,/* do not fixup XINCLUDE xml:base uris */
-    XML_PARSE_HUGE      = 1<<19, /* relax any hardcoded limit from the parser */
-    XML_PARSE_OLDSAX    = 1<<20 /* parse using SAX2 interface from before 2.7.0 */
-} xmlParserOption;
-
-XMLPUBFUN void XMLCALL
-		xmlCtxtReset		(xmlParserCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL
-		xmlCtxtResetPush	(xmlParserCtxtPtr ctxt,
-					 const char *chunk,
-					 int size,
-					 const char *filename,
-					 const char *encoding);
-XMLPUBFUN int XMLCALL
-		xmlCtxtUseOptions	(xmlParserCtxtPtr ctxt,
-					 int options);
-XMLPUBFUN xmlDocPtr XMLCALL
-		xmlReadDoc		(const xmlChar *cur,
-					 const char *URL,
-					 const char *encoding,
-					 int options);
-XMLPUBFUN xmlDocPtr XMLCALL
-		xmlReadFile		(const char *URL,
-					 const char *encoding,
-					 int options);
-XMLPUBFUN xmlDocPtr XMLCALL
-		xmlReadMemory		(const char *buffer,
-					 int size,
-					 const char *URL,
-					 const char *encoding,
-					 int options);
-XMLPUBFUN xmlDocPtr XMLCALL
-		xmlReadFd		(int fd,
-					 const char *URL,
-					 const char *encoding,
-					 int options);
-XMLPUBFUN xmlDocPtr XMLCALL
-		xmlReadIO		(xmlInputReadCallback ioread,
-					 xmlInputCloseCallback ioclose,
-					 void *ioctx,
-					 const char *URL,
-					 const char *encoding,
-					 int options);
-XMLPUBFUN xmlDocPtr XMLCALL
-		xmlCtxtReadDoc		(xmlParserCtxtPtr ctxt,
-					 const xmlChar *cur,
-					 const char *URL,
-					 const char *encoding,
-					 int options);
-XMLPUBFUN xmlDocPtr XMLCALL
-		xmlCtxtReadFile		(xmlParserCtxtPtr ctxt,
-					 const char *filename,
-					 const char *encoding,
-					 int options);
-XMLPUBFUN xmlDocPtr XMLCALL
-		xmlCtxtReadMemory		(xmlParserCtxtPtr ctxt,
-					 const char *buffer,
-					 int size,
-					 const char *URL,
-					 const char *encoding,
-					 int options);
-XMLPUBFUN xmlDocPtr XMLCALL
-		xmlCtxtReadFd		(xmlParserCtxtPtr ctxt,
-					 int fd,
-					 const char *URL,
-					 const char *encoding,
-					 int options);
-XMLPUBFUN xmlDocPtr XMLCALL
-		xmlCtxtReadIO		(xmlParserCtxtPtr ctxt,
-					 xmlInputReadCallback ioread,
-					 xmlInputCloseCallback ioclose,
-					 void *ioctx,
-					 const char *URL,
-					 const char *encoding,
-					 int options);
-
-/*
- * Library wide options
- */
-/**
- * xmlFeature:
- *
- * Used to examine the existance of features that can be enabled
- * or disabled at compile-time.
- * They used to be called XML_FEATURE_xxx but this clashed with Expat
- */
-typedef enum {
-    XML_WITH_THREAD = 1,
-    XML_WITH_TREE = 2,
-    XML_WITH_OUTPUT = 3,
-    XML_WITH_PUSH = 4,
-    XML_WITH_READER = 5,
-    XML_WITH_PATTERN = 6,
-    XML_WITH_WRITER = 7,
-    XML_WITH_SAX1 = 8,
-    XML_WITH_FTP = 9,
-    XML_WITH_HTTP = 10,
-    XML_WITH_VALID = 11,
-    XML_WITH_HTML = 12,
-    XML_WITH_LEGACY = 13,
-    XML_WITH_C14N = 14,
-    XML_WITH_CATALOG = 15,
-    XML_WITH_XPATH = 16,
-    XML_WITH_XPTR = 17,
-    XML_WITH_XINCLUDE = 18,
-    XML_WITH_ICONV = 19,
-    XML_WITH_ISO8859X = 20,
-    XML_WITH_UNICODE = 21,
-    XML_WITH_REGEXP = 22,
-    XML_WITH_AUTOMATA = 23,
-    XML_WITH_EXPR = 24,
-    XML_WITH_SCHEMAS = 25,
-    XML_WITH_SCHEMATRON = 26,
-    XML_WITH_MODULES = 27,
-    XML_WITH_DEBUG = 28,
-    XML_WITH_DEBUG_MEM = 29,
-    XML_WITH_DEBUG_RUN = 30,
-    XML_WITH_ZLIB = 31,
-    XML_WITH_NONE = 99999 /* just to be sure of allocation size */
-} xmlFeature;
-
-XMLPUBFUN int XMLCALL
-		xmlHasFeature		(xmlFeature feature);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __XML_PARSER_H__ */
-
diff --git a/interfaces/ext/libxml/parserInternals.h b/interfaces/ext/libxml/parserInternals.h
deleted file mode 100644
index a5e75b5..0000000
--- a/interfaces/ext/libxml/parserInternals.h
+++ /dev/null
@@ -1,611 +0,0 @@
-/*
- * Summary: internals routines exported by the parser.
- * Description: this module exports a number of internal parsing routines
- *              they are not really all intended for applications but
- *              can prove useful doing low level processing.
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#ifndef __XML_PARSER_INTERNALS_H__
-#define __XML_PARSER_INTERNALS_H__
-
-#include <libxml/xmlversion.h>
-#include <libxml/parser.h>
-#include <libxml/HTMLparser.h>
-#include <libxml/chvalid.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * xmlParserMaxDepth:
- *
- * arbitrary depth limit for the XML documents that we allow to
- * process. This is not a limitation of the parser but a safety
- * boundary feature, use XML_PARSE_HUGE option to override it.
- */
-XMLPUBVAR unsigned int xmlParserMaxDepth;
-
-/**
- * XML_MAX_TEXT_LENGTH:
- *
- * Maximum size allowed for a single text node when building a tree.
- * This is not a limitation of the parser but a safety boundary feature,
- * use XML_PARSE_HUGE option to override it.
- */
-#define XML_MAX_TEXT_LENGTH 10000000
-
-/**
- * XML_MAX_NAMELEN:
- *
- * Identifiers can be longer, but this will be more costly
- * at runtime.
- */
-#define XML_MAX_NAMELEN 100
-
-/**
- * INPUT_CHUNK:
- *
- * The parser tries to always have that amount of input ready.
- * One of the point is providing context when reporting errors.
- */
-#define INPUT_CHUNK	250
-
-/************************************************************************
- *									*
- * UNICODE version of the macros.      					*
- *									*
- ************************************************************************/
-/**
- * IS_BYTE_CHAR:
- * @c:  an byte value (int)
- *
- * Macro to check the following production in the XML spec:
- *
- * [2] Char ::= #x9 | #xA | #xD | [#x20...]
- * any byte character in the accepted range
- */
-#define IS_BYTE_CHAR(c)	 xmlIsChar_ch(c)
-
-/**
- * IS_CHAR:
- * @c:  an UNICODE value (int)
- *
- * Macro to check the following production in the XML spec:
- *
- * [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD]
- *                  | [#x10000-#x10FFFF]
- * any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
- */
-#define IS_CHAR(c)   xmlIsCharQ(c)
-
-/**
- * IS_CHAR_CH:
- * @c: an xmlChar (usually an unsigned char)
- *
- * Behaves like IS_CHAR on single-byte value
- */
-#define IS_CHAR_CH(c)  xmlIsChar_ch(c)
-
-/**
- * IS_BLANK:
- * @c:  an UNICODE value (int)
- *
- * Macro to check the following production in the XML spec:
- *
- * [3] S ::= (#x20 | #x9 | #xD | #xA)+
- */
-#define IS_BLANK(c)  xmlIsBlankQ(c)
-
-/**
- * IS_BLANK_CH:
- * @c:  an xmlChar value (normally unsigned char)
- *
- * Behaviour same as IS_BLANK
- */
-#define IS_BLANK_CH(c)  xmlIsBlank_ch(c)
-
-/**
- * IS_BASECHAR:
- * @c:  an UNICODE value (int)
- *
- * Macro to check the following production in the XML spec:
- *
- * [85] BaseChar ::= ... long list see REC ...
- */
-#define IS_BASECHAR(c) xmlIsBaseCharQ(c)
-
-/**
- * IS_DIGIT:
- * @c:  an UNICODE value (int)
- *
- * Macro to check the following production in the XML spec:
- *
- * [88] Digit ::= ... long list see REC ...
- */
-#define IS_DIGIT(c) xmlIsDigitQ(c)
-
-/**
- * IS_DIGIT_CH:
- * @c:  an xmlChar value (usually an unsigned char)
- *
- * Behaves like IS_DIGIT but with a single byte argument
- */
-#define IS_DIGIT_CH(c)  xmlIsDigit_ch(c)
-
-/**
- * IS_COMBINING:
- * @c:  an UNICODE value (int)
- *
- * Macro to check the following production in the XML spec:
- *
- * [87] CombiningChar ::= ... long list see REC ...
- */
-#define IS_COMBINING(c) xmlIsCombiningQ(c)
-
-/**
- * IS_COMBINING_CH:
- * @c:  an xmlChar (usually an unsigned char)
- *
- * Always false (all combining chars > 0xff)
- */
-#define IS_COMBINING_CH(c) 0 
-
-/**
- * IS_EXTENDER:
- * @c:  an UNICODE value (int)
- *
- * Macro to check the following production in the XML spec:
- *
- *
- * [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 |
- *                   #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] |
- *                   [#x309D-#x309E] | [#x30FC-#x30FE]
- */
-#define IS_EXTENDER(c) xmlIsExtenderQ(c)
-
-/**
- * IS_EXTENDER_CH:
- * @c:  an xmlChar value (usually an unsigned char)
- *
- * Behaves like IS_EXTENDER but with a single-byte argument
- */
-#define IS_EXTENDER_CH(c)  xmlIsExtender_ch(c)
-
-/**
- * IS_IDEOGRAPHIC:
- * @c:  an UNICODE value (int)
- *
- * Macro to check the following production in the XML spec:
- *
- *
- * [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029]
- */
-#define IS_IDEOGRAPHIC(c) xmlIsIdeographicQ(c)
-
-/**
- * IS_LETTER:
- * @c:  an UNICODE value (int)
- *
- * Macro to check the following production in the XML spec:
- *
- *
- * [84] Letter ::= BaseChar | Ideographic 
- */
-#define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c))
-
-/**
- * IS_LETTER_CH:
- * @c:  an xmlChar value (normally unsigned char)
- *
- * Macro behaves like IS_LETTER, but only check base chars
- *
- */
-#define IS_LETTER_CH(c) xmlIsBaseChar_ch(c)
-
-/**
- * IS_ASCII_LETTER:
- * @c: an xmlChar value
- *
- * Macro to check [a-zA-Z]
- *
- */
-#define IS_ASCII_LETTER(c)	(((0x41 <= (c)) && ((c) <= 0x5a)) || \
-				 ((0x61 <= (c)) && ((c) <= 0x7a)))
-
-/**
- * IS_ASCII_DIGIT:
- * @c: an xmlChar value
- *
- * Macro to check [0-9]
- *
- */
-#define IS_ASCII_DIGIT(c)	((0x30 <= (c)) && ((c) <= 0x39))
-
-/**
- * IS_PUBIDCHAR:
- * @c:  an UNICODE value (int)
- *
- * Macro to check the following production in the XML spec:
- *
- *
- * [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
- */
-#define IS_PUBIDCHAR(c)	xmlIsPubidCharQ(c)
-
-/**
- * IS_PUBIDCHAR_CH:
- * @c:  an xmlChar value (normally unsigned char)
- *
- * Same as IS_PUBIDCHAR but for single-byte value
- */
-#define IS_PUBIDCHAR_CH(c) xmlIsPubidChar_ch(c)
-
-/**
- * SKIP_EOL:
- * @p:  and UTF8 string pointer
- *
- * Skips the end of line chars.
- */
-#define SKIP_EOL(p) 							\
-    if (*(p) == 0x13) { p++ ; if (*(p) == 0x10) p++; }			\
-    if (*(p) == 0x10) { p++ ; if (*(p) == 0x13) p++; }
-
-/**
- * MOVETO_ENDTAG:
- * @p:  and UTF8 string pointer
- *
- * Skips to the next '>' char.
- */
-#define MOVETO_ENDTAG(p)						\
-    while ((*p) && (*(p) != '>')) (p)++
-
-/**
- * MOVETO_STARTTAG:
- * @p:  and UTF8 string pointer
- *
- * Skips to the next '<' char.
- */
-#define MOVETO_STARTTAG(p)						\
-    while ((*p) && (*(p) != '<')) (p)++
-
-/**
- * Global variables used for predefined strings.
- */
-XMLPUBVAR const xmlChar xmlStringText[];
-XMLPUBVAR const xmlChar xmlStringTextNoenc[];
-XMLPUBVAR const xmlChar xmlStringComment[];
-
-/*
- * Function to finish the work of the macros where needed.
- */
-XMLPUBFUN int XMLCALL                   xmlIsLetter     (int c);
-
-/**
- * Parser context.
- */
-XMLPUBFUN xmlParserCtxtPtr XMLCALL	
-			xmlCreateFileParserCtxt	(const char *filename);
-XMLPUBFUN xmlParserCtxtPtr XMLCALL	
-			xmlCreateURLParserCtxt	(const char *filename,
-						 int options);
-XMLPUBFUN xmlParserCtxtPtr XMLCALL	
-			xmlCreateMemoryParserCtxt(const char *buffer,
-						 int size);
-XMLPUBFUN xmlParserCtxtPtr XMLCALL	
-			xmlCreateEntityParserCtxt(const xmlChar *URL,
-						 const xmlChar *ID,
-						 const xmlChar *base);
-XMLPUBFUN int XMLCALL			
-			xmlSwitchEncoding	(xmlParserCtxtPtr ctxt,
-						 xmlCharEncoding enc);
-XMLPUBFUN int XMLCALL			
-			xmlSwitchToEncoding	(xmlParserCtxtPtr ctxt,
-					 xmlCharEncodingHandlerPtr handler);
-XMLPUBFUN int XMLCALL			
-			xmlSwitchInputEncoding	(xmlParserCtxtPtr ctxt,
-						 xmlParserInputPtr input,
-					 xmlCharEncodingHandlerPtr handler);
-
-#ifdef IN_LIBXML
-/* internal error reporting */
-XMLPUBFUN void XMLCALL
-			__xmlErrEncoding	(xmlParserCtxtPtr ctxt,
-						 xmlParserErrors xmlerr,
-						 const char *msg,
-						 const xmlChar * str1,
-						 const xmlChar * str2);
-#endif
-
-/**
- * Input Streams.
- */
-XMLPUBFUN xmlParserInputPtr XMLCALL	
-			xmlNewStringInputStream	(xmlParserCtxtPtr ctxt,
-						 const xmlChar *buffer);
-XMLPUBFUN xmlParserInputPtr XMLCALL	
-			xmlNewEntityInputStream	(xmlParserCtxtPtr ctxt,
-						 xmlEntityPtr entity);
-XMLPUBFUN int XMLCALL			
-			xmlPushInput		(xmlParserCtxtPtr ctxt,
-						 xmlParserInputPtr input);
-XMLPUBFUN xmlChar XMLCALL			
-			xmlPopInput		(xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL			
-			xmlFreeInputStream	(xmlParserInputPtr input);
-XMLPUBFUN xmlParserInputPtr XMLCALL	
-			xmlNewInputFromFile	(xmlParserCtxtPtr ctxt,
-						 const char *filename);
-XMLPUBFUN xmlParserInputPtr XMLCALL	
-			xmlNewInputStream	(xmlParserCtxtPtr ctxt);
-
-/**
- * Namespaces.
- */
-XMLPUBFUN xmlChar * XMLCALL		
-			xmlSplitQName		(xmlParserCtxtPtr ctxt,
-						 const xmlChar *name,
-						 xmlChar **prefix);
-
-/**
- * Generic production rules.
- */
-XMLPUBFUN const xmlChar * XMLCALL		
-			xmlParseName		(xmlParserCtxtPtr ctxt);
-XMLPUBFUN xmlChar * XMLCALL		
-			xmlParseNmtoken		(xmlParserCtxtPtr ctxt);
-XMLPUBFUN xmlChar * XMLCALL		
-			xmlParseEntityValue	(xmlParserCtxtPtr ctxt,
-						 xmlChar **orig);
-XMLPUBFUN xmlChar * XMLCALL		
-			xmlParseAttValue	(xmlParserCtxtPtr ctxt);
-XMLPUBFUN xmlChar * XMLCALL		
-			xmlParseSystemLiteral	(xmlParserCtxtPtr ctxt);
-XMLPUBFUN xmlChar * XMLCALL		
-			xmlParsePubidLiteral	(xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL			
-			xmlParseCharData	(xmlParserCtxtPtr ctxt,
-						 int cdata);
-XMLPUBFUN xmlChar * XMLCALL		
-			xmlParseExternalID	(xmlParserCtxtPtr ctxt,
-						 xmlChar **publicID,
-						 int strict);
-XMLPUBFUN void XMLCALL			
-			xmlParseComment		(xmlParserCtxtPtr ctxt);
-XMLPUBFUN const xmlChar * XMLCALL		
-			xmlParsePITarget	(xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL			
-			xmlParsePI		(xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL			
-			xmlParseNotationDecl	(xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL			
-			xmlParseEntityDecl	(xmlParserCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL			
-			xmlParseDefaultDecl	(xmlParserCtxtPtr ctxt,
-						 xmlChar **value);
-XMLPUBFUN xmlEnumerationPtr XMLCALL	
-			xmlParseNotationType	(xmlParserCtxtPtr ctxt);
-XMLPUBFUN xmlEnumerationPtr XMLCALL	
-			xmlParseEnumerationType	(xmlParserCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL			
-			xmlParseEnumeratedType	(xmlParserCtxtPtr ctxt,
-						 xmlEnumerationPtr *tree);
-XMLPUBFUN int XMLCALL			
-			xmlParseAttributeType	(xmlParserCtxtPtr ctxt,
-						 xmlEnumerationPtr *tree);
-XMLPUBFUN void XMLCALL			
-			xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt);
-XMLPUBFUN xmlElementContentPtr XMLCALL	
-			xmlParseElementMixedContentDecl
-						(xmlParserCtxtPtr ctxt,
-						 int inputchk);
-XMLPUBFUN xmlElementContentPtr XMLCALL	
-			xmlParseElementChildrenContentDecl
-						(xmlParserCtxtPtr ctxt,
-						 int inputchk);
-XMLPUBFUN int XMLCALL			
-			xmlParseElementContentDecl(xmlParserCtxtPtr ctxt,
-						 const xmlChar *name,
-						 xmlElementContentPtr *result);
-XMLPUBFUN int XMLCALL			
-			xmlParseElementDecl	(xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL			
-			xmlParseMarkupDecl	(xmlParserCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL			
-			xmlParseCharRef		(xmlParserCtxtPtr ctxt);
-XMLPUBFUN xmlEntityPtr XMLCALL		
-			xmlParseEntityRef	(xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL			
-			xmlParseReference	(xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL			
-			xmlParsePEReference	(xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL			
-			xmlParseDocTypeDecl	(xmlParserCtxtPtr ctxt);
-#ifdef LIBXML_SAX1_ENABLED
-XMLPUBFUN const xmlChar * XMLCALL		
-			xmlParseAttribute	(xmlParserCtxtPtr ctxt,
-						 xmlChar **value);
-XMLPUBFUN const xmlChar * XMLCALL		
-			xmlParseStartTag	(xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL			
-			xmlParseEndTag		(xmlParserCtxtPtr ctxt);
-#endif /* LIBXML_SAX1_ENABLED */
-XMLPUBFUN void XMLCALL			
-			xmlParseCDSect		(xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL			
-			xmlParseContent		(xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL			
-			xmlParseElement		(xmlParserCtxtPtr ctxt);
-XMLPUBFUN xmlChar * XMLCALL		
-			xmlParseVersionNum	(xmlParserCtxtPtr ctxt);
-XMLPUBFUN xmlChar * XMLCALL		
-			xmlParseVersionInfo	(xmlParserCtxtPtr ctxt);
-XMLPUBFUN xmlChar * XMLCALL		
-			xmlParseEncName		(xmlParserCtxtPtr ctxt);
-XMLPUBFUN const xmlChar * XMLCALL		
-			xmlParseEncodingDecl	(xmlParserCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL			
-			xmlParseSDDecl		(xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL			
-			xmlParseXMLDecl		(xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL			
-			xmlParseTextDecl	(xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL			
-			xmlParseMisc		(xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL			
-			xmlParseExternalSubset	(xmlParserCtxtPtr ctxt,
-						 const xmlChar *ExternalID,
-						 const xmlChar *SystemID); 
-/**
- * XML_SUBSTITUTE_NONE:
- *
- * If no entities need to be substituted.
- */
-#define XML_SUBSTITUTE_NONE	0
-/**
- * XML_SUBSTITUTE_REF:
- *
- * Whether general entities need to be substituted.
- */
-#define XML_SUBSTITUTE_REF	1
-/**
- * XML_SUBSTITUTE_PEREF:
- *
- * Whether parameter entities need to be substituted.
- */
-#define XML_SUBSTITUTE_PEREF	2
-/**
- * XML_SUBSTITUTE_BOTH:
- *
- * Both general and parameter entities need to be substituted.
- */
-#define XML_SUBSTITUTE_BOTH 	3
-
-XMLPUBFUN xmlChar * XMLCALL
-		xmlStringDecodeEntities		(xmlParserCtxtPtr ctxt,
-						 const xmlChar *str,
-						 int what,
-						 xmlChar end,
-						 xmlChar  end2,
-						 xmlChar end3);
-XMLPUBFUN xmlChar * XMLCALL
-		xmlStringLenDecodeEntities	(xmlParserCtxtPtr ctxt,
-						 const xmlChar *str,
-						 int len,
-						 int what,
-						 xmlChar end,
-						 xmlChar  end2,
-						 xmlChar end3);
-
-/*
- * Generated by MACROS on top of parser.c c.f. PUSH_AND_POP.
- */
-XMLPUBFUN int XMLCALL			nodePush		(xmlParserCtxtPtr ctxt,
-						 xmlNodePtr value);
-XMLPUBFUN xmlNodePtr XMLCALL		nodePop			(xmlParserCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL			inputPush		(xmlParserCtxtPtr ctxt,
-						 xmlParserInputPtr value);
-XMLPUBFUN xmlParserInputPtr XMLCALL	inputPop		(xmlParserCtxtPtr ctxt);
-XMLPUBFUN const xmlChar * XMLCALL	namePop			(xmlParserCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL			namePush		(xmlParserCtxtPtr ctxt,
-						 const xmlChar *value);
-
-/*
- * other commodities shared between parser.c and parserInternals.
- */
-XMLPUBFUN int XMLCALL			xmlSkipBlankChars	(xmlParserCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL			xmlStringCurrentChar	(xmlParserCtxtPtr ctxt,
-						 const xmlChar *cur,
-						 int *len);
-XMLPUBFUN void XMLCALL			xmlParserHandlePEReference(xmlParserCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL			xmlCheckLanguageID	(const xmlChar *lang);
-
-/*
- * Really core function shared with HTML parser.
- */
-XMLPUBFUN int XMLCALL			xmlCurrentChar		(xmlParserCtxtPtr ctxt,
-						 int *len);
-XMLPUBFUN int XMLCALL		xmlCopyCharMultiByte	(xmlChar *out,
-						 int val);
-XMLPUBFUN int XMLCALL			xmlCopyChar		(int len,
-						 xmlChar *out,
-						 int val);
-XMLPUBFUN void XMLCALL			xmlNextChar		(xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL			xmlParserInputShrink	(xmlParserInputPtr in);
-
-#ifdef LIBXML_HTML_ENABLED
-/*
- * Actually comes from the HTML parser but launched from the init stuff.
- */
-XMLPUBFUN void XMLCALL			htmlInitAutoClose	(void);
-XMLPUBFUN htmlParserCtxtPtr XMLCALL	htmlCreateFileParserCtxt(const char *filename,
-	                                         const char *encoding);
-#endif
-
-/*
- * Specific function to keep track of entities references
- * and used by the XSLT debugger.
- */
-#ifdef LIBXML_LEGACY_ENABLED
-/**
- * xmlEntityReferenceFunc:
- * @ent: the entity
- * @firstNode:  the fist node in the chunk
- * @lastNode:  the last nod in the chunk
- *
- * Callback function used when one needs to be able to track back the
- * provenance of a chunk of nodes inherited from an entity replacement.
- */
-typedef	void	(*xmlEntityReferenceFunc)	(xmlEntityPtr ent,
-						 xmlNodePtr firstNode,
-						 xmlNodePtr lastNode);
-  
-XMLPUBFUN void XMLCALL		xmlSetEntityReferenceFunc	(xmlEntityReferenceFunc func);
-
-XMLPUBFUN xmlChar * XMLCALL		
-			xmlParseQuotedString	(xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL
-                        xmlParseNamespace       (xmlParserCtxtPtr ctxt);
-XMLPUBFUN xmlChar * XMLCALL		
-			xmlNamespaceParseNSDef	(xmlParserCtxtPtr ctxt);
-XMLPUBFUN xmlChar * XMLCALL		
-			xmlScanName		(xmlParserCtxtPtr ctxt);
-XMLPUBFUN xmlChar * XMLCALL		
-			xmlNamespaceParseNCName	(xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL	xmlParserHandleReference(xmlParserCtxtPtr ctxt);
-XMLPUBFUN xmlChar * XMLCALL		
-			xmlNamespaceParseQName	(xmlParserCtxtPtr ctxt,
-						 xmlChar **prefix);
-/**
- * Entities
- */
-XMLPUBFUN xmlChar * XMLCALL
-		xmlDecodeEntities		(xmlParserCtxtPtr ctxt,
-						 int len,
-						 int what,
-						 xmlChar end,
-						 xmlChar  end2,
-						 xmlChar end3);
-XMLPUBFUN void XMLCALL			
-			xmlHandleEntity		(xmlParserCtxtPtr ctxt,
-						 xmlEntityPtr entity);
-
-#endif /* LIBXML_LEGACY_ENABLED */
-
-#ifdef IN_LIBXML
-/*
- * internal only
- */
-XMLPUBFUN void XMLCALL
-	xmlErrMemory		(xmlParserCtxtPtr ctxt,
-				 const char *extra);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __XML_PARSER_INTERNALS_H__ */
diff --git a/interfaces/ext/libxml/pattern.h b/interfaces/ext/libxml/pattern.h
deleted file mode 100644
index 97d2cd2..0000000
--- a/interfaces/ext/libxml/pattern.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Summary: pattern expression handling
- * Description: allows to compile and test pattern expressions for nodes
- *              either in a tree or based on a parser state.
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#ifndef __XML_PATTERN_H__
-#define __XML_PATTERN_H__
-
-#include <libxml/xmlversion.h>
-#include <libxml/tree.h>
-#include <libxml/dict.h>
-
-#ifdef LIBXML_PATTERN_ENABLED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * xmlPattern:
- *
- * A compiled (XPath based) pattern to select nodes
- */
-typedef struct _xmlPattern xmlPattern;
-typedef xmlPattern *xmlPatternPtr;
-
-/**
- * xmlPatternFlags:
- *
- * This is the set of options affecting the behaviour of pattern
- * matching with this module
- *
- */
-typedef enum {
-    XML_PATTERN_DEFAULT		= 0,	/* simple pattern match */
-    XML_PATTERN_XPATH		= 1<<0,	/* standard XPath pattern */
-    XML_PATTERN_XSSEL		= 1<<1,	/* XPath subset for schema selector */
-    XML_PATTERN_XSFIELD		= 1<<2	/* XPath subset for schema field */
-} xmlPatternFlags;
-
-XMLPUBFUN void XMLCALL
-			xmlFreePattern		(xmlPatternPtr comp);
-
-XMLPUBFUN void XMLCALL
-			xmlFreePatternList	(xmlPatternPtr comp);
-
-XMLPUBFUN xmlPatternPtr XMLCALL
-			xmlPatterncompile	(const xmlChar *pattern,
-						 xmlDict *dict,
-						 int flags,
-						 const xmlChar **namespaces);
-XMLPUBFUN int XMLCALL
-			xmlPatternMatch		(xmlPatternPtr comp,
-						 xmlNodePtr node);
-
-/* streaming interfaces */
-typedef struct _xmlStreamCtxt xmlStreamCtxt;
-typedef xmlStreamCtxt *xmlStreamCtxtPtr;
-
-XMLPUBFUN int XMLCALL
-			xmlPatternStreamable	(xmlPatternPtr comp);
-XMLPUBFUN int XMLCALL
-			xmlPatternMaxDepth	(xmlPatternPtr comp);
-XMLPUBFUN int XMLCALL
-			xmlPatternMinDepth	(xmlPatternPtr comp);
-XMLPUBFUN int XMLCALL
-			xmlPatternFromRoot	(xmlPatternPtr comp);
-XMLPUBFUN xmlStreamCtxtPtr XMLCALL
-			xmlPatternGetStreamCtxt	(xmlPatternPtr comp);
-XMLPUBFUN void XMLCALL
-			xmlFreeStreamCtxt	(xmlStreamCtxtPtr stream);
-XMLPUBFUN int XMLCALL
-			xmlStreamPushNode	(xmlStreamCtxtPtr stream,
-						 const xmlChar *name,
-						 const xmlChar *ns,
-						 int nodeType);
-XMLPUBFUN int XMLCALL
-			xmlStreamPush		(xmlStreamCtxtPtr stream,
-						 const xmlChar *name,
-						 const xmlChar *ns);
-XMLPUBFUN int XMLCALL
-			xmlStreamPushAttr	(xmlStreamCtxtPtr stream,
-						 const xmlChar *name,
-						 const xmlChar *ns);
-XMLPUBFUN int XMLCALL
-			xmlStreamPop		(xmlStreamCtxtPtr stream);
-XMLPUBFUN int XMLCALL
-			xmlStreamWantsAnyNode	(xmlStreamCtxtPtr stream);
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LIBXML_PATTERN_ENABLED */
-
-#endif /* __XML_PATTERN_H__ */
diff --git a/interfaces/ext/libxml/relaxng.h b/interfaces/ext/libxml/relaxng.h
deleted file mode 100644
index d3e39e0..0000000
--- a/interfaces/ext/libxml/relaxng.h
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Summary: implementation of the Relax-NG validation
- * Description: implementation of the Relax-NG validation
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#ifndef __XML_RELAX_NG__
-#define __XML_RELAX_NG__
-
-#include <libxml/xmlversion.h>
-#include <libxml/hash.h>
-#include <libxml/xmlstring.h>
-
-#ifdef LIBXML_SCHEMAS_ENABLED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct _xmlRelaxNG xmlRelaxNG;
-typedef xmlRelaxNG *xmlRelaxNGPtr;
-
-
-/**
- * xmlRelaxNGValidityErrorFunc:
- * @ctx: the validation context
- * @msg: the message
- * @...: extra arguments
- *
- * Signature of an error callback from a Relax-NG validation
- */
-typedef void (XMLCDECL *xmlRelaxNGValidityErrorFunc) (void *ctx, const char *msg, ...) ATTRIBUTE_PRINTF(2,3);
-
-/**
- * xmlRelaxNGValidityWarningFunc:
- * @ctx: the validation context
- * @msg: the message
- * @...: extra arguments
- *
- * Signature of a warning callback from a Relax-NG validation
- */
-typedef void (XMLCDECL *xmlRelaxNGValidityWarningFunc) (void *ctx, const char *msg, ...) ATTRIBUTE_PRINTF(2,3);
-
-/**
- * A schemas validation context
- */
-typedef struct _xmlRelaxNGParserCtxt xmlRelaxNGParserCtxt;
-typedef xmlRelaxNGParserCtxt *xmlRelaxNGParserCtxtPtr;
-
-typedef struct _xmlRelaxNGValidCtxt xmlRelaxNGValidCtxt;
-typedef xmlRelaxNGValidCtxt *xmlRelaxNGValidCtxtPtr;
-
-/*
- * xmlRelaxNGValidErr:
- *
- * List of possible Relax NG validation errors
- */
-typedef enum {
-    XML_RELAXNG_OK = 0,
-    XML_RELAXNG_ERR_MEMORY,
-    XML_RELAXNG_ERR_TYPE,
-    XML_RELAXNG_ERR_TYPEVAL,
-    XML_RELAXNG_ERR_DUPID,
-    XML_RELAXNG_ERR_TYPECMP,
-    XML_RELAXNG_ERR_NOSTATE,
-    XML_RELAXNG_ERR_NODEFINE,
-    XML_RELAXNG_ERR_LISTEXTRA,
-    XML_RELAXNG_ERR_LISTEMPTY,
-    XML_RELAXNG_ERR_INTERNODATA,
-    XML_RELAXNG_ERR_INTERSEQ,
-    XML_RELAXNG_ERR_INTEREXTRA,
-    XML_RELAXNG_ERR_ELEMNAME,
-    XML_RELAXNG_ERR_ATTRNAME,
-    XML_RELAXNG_ERR_ELEMNONS,
-    XML_RELAXNG_ERR_ATTRNONS,
-    XML_RELAXNG_ERR_ELEMWRONGNS,
-    XML_RELAXNG_ERR_ATTRWRONGNS,
-    XML_RELAXNG_ERR_ELEMEXTRANS,
-    XML_RELAXNG_ERR_ATTREXTRANS,
-    XML_RELAXNG_ERR_ELEMNOTEMPTY,
-    XML_RELAXNG_ERR_NOELEM,
-    XML_RELAXNG_ERR_NOTELEM,
-    XML_RELAXNG_ERR_ATTRVALID,
-    XML_RELAXNG_ERR_CONTENTVALID,
-    XML_RELAXNG_ERR_EXTRACONTENT,
-    XML_RELAXNG_ERR_INVALIDATTR,
-    XML_RELAXNG_ERR_DATAELEM,
-    XML_RELAXNG_ERR_VALELEM,
-    XML_RELAXNG_ERR_LISTELEM,
-    XML_RELAXNG_ERR_DATATYPE,
-    XML_RELAXNG_ERR_VALUE,
-    XML_RELAXNG_ERR_LIST,
-    XML_RELAXNG_ERR_NOGRAMMAR,
-    XML_RELAXNG_ERR_EXTRADATA,
-    XML_RELAXNG_ERR_LACKDATA,
-    XML_RELAXNG_ERR_INTERNAL,
-    XML_RELAXNG_ERR_ELEMWRONG,
-    XML_RELAXNG_ERR_TEXTWRONG
-} xmlRelaxNGValidErr;
-
-/*
- * xmlRelaxNGParserFlags:
- *
- * List of possible Relax NG Parser flags
- */
-typedef enum {
-    XML_RELAXNGP_NONE = 0,
-    XML_RELAXNGP_FREE_DOC = 1,
-    XML_RELAXNGP_CRNG = 2
-} xmlRelaxNGParserFlag;
-
-XMLPUBFUN int XMLCALL
-		    xmlRelaxNGInitTypes		(void);
-XMLPUBFUN void XMLCALL
-		    xmlRelaxNGCleanupTypes	(void);
-
-/*
- * Interfaces for parsing.
- */
-XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
-		    xmlRelaxNGNewParserCtxt	(const char *URL);
-XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
-		    xmlRelaxNGNewMemParserCtxt	(const char *buffer,
-						 int size);
-XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
-		    xmlRelaxNGNewDocParserCtxt	(xmlDocPtr doc);
-
-XMLPUBFUN int XMLCALL
-		    xmlRelaxParserSetFlag	(xmlRelaxNGParserCtxtPtr ctxt,
-						 int flag);
-
-XMLPUBFUN void XMLCALL
-		    xmlRelaxNGFreeParserCtxt	(xmlRelaxNGParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL
-		    xmlRelaxNGSetParserErrors(xmlRelaxNGParserCtxtPtr ctxt,
-					 xmlRelaxNGValidityErrorFunc err,
-					 xmlRelaxNGValidityWarningFunc warn,
-					 void *ctx);
-XMLPUBFUN int XMLCALL
-		    xmlRelaxNGGetParserErrors(xmlRelaxNGParserCtxtPtr ctxt,
-					 xmlRelaxNGValidityErrorFunc *err,
-					 xmlRelaxNGValidityWarningFunc *warn,
-					 void **ctx);
-XMLPUBFUN void XMLCALL
-		    xmlRelaxNGSetParserStructuredErrors(
-					 xmlRelaxNGParserCtxtPtr ctxt,
-					 xmlStructuredErrorFunc serror,
-					 void *ctx);
-XMLPUBFUN xmlRelaxNGPtr XMLCALL
-		    xmlRelaxNGParse		(xmlRelaxNGParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL
-		    xmlRelaxNGFree		(xmlRelaxNGPtr schema);
-#ifdef LIBXML_OUTPUT_ENABLED
-XMLPUBFUN void XMLCALL
-		    xmlRelaxNGDump		(FILE *output,
-					 xmlRelaxNGPtr schema);
-XMLPUBFUN void XMLCALL
-		    xmlRelaxNGDumpTree	(FILE * output,
-					 xmlRelaxNGPtr schema);
-#endif /* LIBXML_OUTPUT_ENABLED */
-/*
- * Interfaces for validating
- */
-XMLPUBFUN void XMLCALL
-		    xmlRelaxNGSetValidErrors(xmlRelaxNGValidCtxtPtr ctxt,
-					 xmlRelaxNGValidityErrorFunc err,
-					 xmlRelaxNGValidityWarningFunc warn,
-					 void *ctx);
-XMLPUBFUN int XMLCALL
-		    xmlRelaxNGGetValidErrors(xmlRelaxNGValidCtxtPtr ctxt,
-					 xmlRelaxNGValidityErrorFunc *err,
-					 xmlRelaxNGValidityWarningFunc *warn,
-					 void **ctx);
-XMLPUBFUN void XMLCALL
-			xmlRelaxNGSetValidStructuredErrors(xmlRelaxNGValidCtxtPtr ctxt,
-					  xmlStructuredErrorFunc serror, void *ctx);
-XMLPUBFUN xmlRelaxNGValidCtxtPtr XMLCALL
-		    xmlRelaxNGNewValidCtxt	(xmlRelaxNGPtr schema);
-XMLPUBFUN void XMLCALL
-		    xmlRelaxNGFreeValidCtxt	(xmlRelaxNGValidCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL
-		    xmlRelaxNGValidateDoc	(xmlRelaxNGValidCtxtPtr ctxt,
-						 xmlDocPtr doc);
-/*
- * Interfaces for progressive validation when possible
- */
-XMLPUBFUN int XMLCALL
-		    xmlRelaxNGValidatePushElement	(xmlRelaxNGValidCtxtPtr ctxt,
-					 xmlDocPtr doc,
-					 xmlNodePtr elem);
-XMLPUBFUN int XMLCALL
-		    xmlRelaxNGValidatePushCData	(xmlRelaxNGValidCtxtPtr ctxt,
-					 const xmlChar *data,
-					 int len);
-XMLPUBFUN int XMLCALL
-		    xmlRelaxNGValidatePopElement	(xmlRelaxNGValidCtxtPtr ctxt,
-					 xmlDocPtr doc,
-					 xmlNodePtr elem);
-XMLPUBFUN int XMLCALL
-		    xmlRelaxNGValidateFullElement	(xmlRelaxNGValidCtxtPtr ctxt,
-					 xmlDocPtr doc,
-					 xmlNodePtr elem);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LIBXML_SCHEMAS_ENABLED */
-
-#endif /* __XML_RELAX_NG__ */
diff --git a/interfaces/ext/libxml/schemasInternals.h b/interfaces/ext/libxml/schemasInternals.h
deleted file mode 100644
index b68a6e1..0000000
--- a/interfaces/ext/libxml/schemasInternals.h
+++ /dev/null
@@ -1,958 +0,0 @@
-/*
- * Summary: internal interfaces for XML Schemas
- * Description: internal interfaces for the XML Schemas handling
- *              and schema validity checking
- *		The Schemas development is a Work In Progress.
- *              Some of those interfaces are not garanteed to be API or ABI stable !
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-
-#ifndef __XML_SCHEMA_INTERNALS_H__
-#define __XML_SCHEMA_INTERNALS_H__
-
-#include <libxml/xmlversion.h>
-
-#ifdef LIBXML_SCHEMAS_ENABLED
-
-#include <libxml/xmlregexp.h>
-#include <libxml/hash.h>
-#include <libxml/dict.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    XML_SCHEMAS_UNKNOWN = 0,
-    XML_SCHEMAS_STRING,
-    XML_SCHEMAS_NORMSTRING,
-    XML_SCHEMAS_DECIMAL,
-    XML_SCHEMAS_TIME,
-    XML_SCHEMAS_GDAY,
-    XML_SCHEMAS_GMONTH,
-    XML_SCHEMAS_GMONTHDAY,
-    XML_SCHEMAS_GYEAR,
-    XML_SCHEMAS_GYEARMONTH,
-    XML_SCHEMAS_DATE,
-    XML_SCHEMAS_DATETIME,
-    XML_SCHEMAS_DURATION,
-    XML_SCHEMAS_FLOAT,
-    XML_SCHEMAS_DOUBLE,
-    XML_SCHEMAS_BOOLEAN,
-    XML_SCHEMAS_TOKEN,
-    XML_SCHEMAS_LANGUAGE,
-    XML_SCHEMAS_NMTOKEN,
-    XML_SCHEMAS_NMTOKENS,
-    XML_SCHEMAS_NAME,
-    XML_SCHEMAS_QNAME,
-    XML_SCHEMAS_NCNAME,
-    XML_SCHEMAS_ID,
-    XML_SCHEMAS_IDREF,
-    XML_SCHEMAS_IDREFS,
-    XML_SCHEMAS_ENTITY,
-    XML_SCHEMAS_ENTITIES,
-    XML_SCHEMAS_NOTATION,
-    XML_SCHEMAS_ANYURI,
-    XML_SCHEMAS_INTEGER,
-    XML_SCHEMAS_NPINTEGER,
-    XML_SCHEMAS_NINTEGER,
-    XML_SCHEMAS_NNINTEGER,
-    XML_SCHEMAS_PINTEGER,
-    XML_SCHEMAS_INT,
-    XML_SCHEMAS_UINT,
-    XML_SCHEMAS_LONG,
-    XML_SCHEMAS_ULONG,
-    XML_SCHEMAS_SHORT,
-    XML_SCHEMAS_USHORT,
-    XML_SCHEMAS_BYTE,
-    XML_SCHEMAS_UBYTE,
-    XML_SCHEMAS_HEXBINARY,
-    XML_SCHEMAS_BASE64BINARY,
-    XML_SCHEMAS_ANYTYPE,
-    XML_SCHEMAS_ANYSIMPLETYPE
-} xmlSchemaValType;
-
-/*
- * XML Schemas defines multiple type of types.
- */
-typedef enum {
-    XML_SCHEMA_TYPE_BASIC = 1, /* A built-in datatype */
-    XML_SCHEMA_TYPE_ANY,
-    XML_SCHEMA_TYPE_FACET,
-    XML_SCHEMA_TYPE_SIMPLE,
-    XML_SCHEMA_TYPE_COMPLEX,
-    XML_SCHEMA_TYPE_SEQUENCE = 6,
-    XML_SCHEMA_TYPE_CHOICE,
-    XML_SCHEMA_TYPE_ALL,
-    XML_SCHEMA_TYPE_SIMPLE_CONTENT,
-    XML_SCHEMA_TYPE_COMPLEX_CONTENT,
-    XML_SCHEMA_TYPE_UR,
-    XML_SCHEMA_TYPE_RESTRICTION,
-    XML_SCHEMA_TYPE_EXTENSION,
-    XML_SCHEMA_TYPE_ELEMENT,
-    XML_SCHEMA_TYPE_ATTRIBUTE,
-    XML_SCHEMA_TYPE_ATTRIBUTEGROUP,
-    XML_SCHEMA_TYPE_GROUP,
-    XML_SCHEMA_TYPE_NOTATION,
-    XML_SCHEMA_TYPE_LIST,
-    XML_SCHEMA_TYPE_UNION,
-    XML_SCHEMA_TYPE_ANY_ATTRIBUTE,
-    XML_SCHEMA_TYPE_IDC_UNIQUE,
-    XML_SCHEMA_TYPE_IDC_KEY,
-    XML_SCHEMA_TYPE_IDC_KEYREF,
-    XML_SCHEMA_TYPE_PARTICLE = 25, 
-    XML_SCHEMA_TYPE_ATTRIBUTE_USE, 
-    XML_SCHEMA_FACET_MININCLUSIVE = 1000,
-    XML_SCHEMA_FACET_MINEXCLUSIVE,
-    XML_SCHEMA_FACET_MAXINCLUSIVE,
-    XML_SCHEMA_FACET_MAXEXCLUSIVE,
-    XML_SCHEMA_FACET_TOTALDIGITS,
-    XML_SCHEMA_FACET_FRACTIONDIGITS,
-    XML_SCHEMA_FACET_PATTERN,
-    XML_SCHEMA_FACET_ENUMERATION,
-    XML_SCHEMA_FACET_WHITESPACE,
-    XML_SCHEMA_FACET_LENGTH,
-    XML_SCHEMA_FACET_MAXLENGTH,
-    XML_SCHEMA_FACET_MINLENGTH,
-    XML_SCHEMA_EXTRA_QNAMEREF = 2000,
-    XML_SCHEMA_EXTRA_ATTR_USE_PROHIB
-} xmlSchemaTypeType;
-
-typedef enum {
-    XML_SCHEMA_CONTENT_UNKNOWN = 0,
-    XML_SCHEMA_CONTENT_EMPTY = 1,
-    XML_SCHEMA_CONTENT_ELEMENTS,
-    XML_SCHEMA_CONTENT_MIXED,
-    XML_SCHEMA_CONTENT_SIMPLE,
-    XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS, /* Obsolete */
-    XML_SCHEMA_CONTENT_BASIC,
-    XML_SCHEMA_CONTENT_ANY
-} xmlSchemaContentType;
-
-typedef struct _xmlSchemaVal xmlSchemaVal;
-typedef xmlSchemaVal *xmlSchemaValPtr;
-
-typedef struct _xmlSchemaType xmlSchemaType;
-typedef xmlSchemaType *xmlSchemaTypePtr;
-
-typedef struct _xmlSchemaFacet xmlSchemaFacet;
-typedef xmlSchemaFacet *xmlSchemaFacetPtr;
-
-/**
- * Annotation
- */
-typedef struct _xmlSchemaAnnot xmlSchemaAnnot;
-typedef xmlSchemaAnnot *xmlSchemaAnnotPtr;
-struct _xmlSchemaAnnot {
-    struct _xmlSchemaAnnot *next;
-    xmlNodePtr content;         /* the annotation */
-};
-
-/**
- * XML_SCHEMAS_ANYATTR_SKIP:
- *
- * Skip unknown attribute from validation
- * Obsolete, not used anymore.
- */
-#define XML_SCHEMAS_ANYATTR_SKIP        1
-/**
- * XML_SCHEMAS_ANYATTR_LAX:
- *
- * Ignore validation non definition on attributes
- * Obsolete, not used anymore.
- */
-#define XML_SCHEMAS_ANYATTR_LAX                2
-/**
- * XML_SCHEMAS_ANYATTR_STRICT:
- *
- * Apply strict validation rules on attributes
- * Obsolete, not used anymore.
- */
-#define XML_SCHEMAS_ANYATTR_STRICT        3
-/**
- * XML_SCHEMAS_ANY_SKIP:
- *
- * Skip unknown attribute from validation
- */
-#define XML_SCHEMAS_ANY_SKIP        1
-/**
- * XML_SCHEMAS_ANY_LAX:
- *
- * Used by wildcards.
- * Validate if type found, don't worry if not found
- */
-#define XML_SCHEMAS_ANY_LAX                2
-/**
- * XML_SCHEMAS_ANY_STRICT:
- *
- * Used by wildcards.
- * Apply strict validation rules
- */
-#define XML_SCHEMAS_ANY_STRICT        3
-/**
- * XML_SCHEMAS_ATTR_USE_PROHIBITED:
- *
- * Used by wildcards.
- * The attribute is prohibited.
- */
-#define XML_SCHEMAS_ATTR_USE_PROHIBITED 0
-/**
- * XML_SCHEMAS_ATTR_USE_REQUIRED:
- *
- * The attribute is required.
- */
-#define XML_SCHEMAS_ATTR_USE_REQUIRED 1
-/**
- * XML_SCHEMAS_ATTR_USE_OPTIONAL:
- *
- * The attribute is optional.
- */
-#define XML_SCHEMAS_ATTR_USE_OPTIONAL 2
-/**
- * XML_SCHEMAS_ATTR_GLOBAL:
- *
- * allow elements in no namespace
- */
-#define XML_SCHEMAS_ATTR_GLOBAL        1 << 0
-/**
- * XML_SCHEMAS_ATTR_NSDEFAULT:
- *
- * allow elements in no namespace
- */
-#define XML_SCHEMAS_ATTR_NSDEFAULT        1 << 7
-/**
- * XML_SCHEMAS_ATTR_INTERNAL_RESOLVED:
- *
- * this is set when the "type" and "ref" references
- * have been resolved.
- */
-#define XML_SCHEMAS_ATTR_INTERNAL_RESOLVED        1 << 8
-/**
- * XML_SCHEMAS_ATTR_FIXED:
- *
- * the attribute has a fixed value
- */
-#define XML_SCHEMAS_ATTR_FIXED        1 << 9
-
-/**
- * xmlSchemaAttribute:
- * An attribute definition.
- */
-
-typedef struct _xmlSchemaAttribute xmlSchemaAttribute;
-typedef xmlSchemaAttribute *xmlSchemaAttributePtr;
-struct _xmlSchemaAttribute {
-    xmlSchemaTypeType type;
-    struct _xmlSchemaAttribute *next; /* the next attribute (not used?) */
-    const xmlChar *name; /* the name of the declaration */
-    const xmlChar *id; /* Deprecated; not used */
-    const xmlChar *ref; /* Deprecated; not used */
-    const xmlChar *refNs; /* Deprecated; not used */
-    const xmlChar *typeName; /* the local name of the type definition */
-    const xmlChar *typeNs; /* the ns URI of the type definition */
-    xmlSchemaAnnotPtr annot;
-
-    xmlSchemaTypePtr base; /* Deprecated; not used */
-    int occurs; /* Deprecated; not used */
-    const xmlChar *defValue; /* The initial value of the value constraint */
-    xmlSchemaTypePtr subtypes; /* the type definition */
-    xmlNodePtr node;
-    const xmlChar *targetNamespace;
-    int flags;
-    const xmlChar *refPrefix; /* Deprecated; not used */
-    xmlSchemaValPtr defVal; /* The compiled value constraint */
-    xmlSchemaAttributePtr refDecl; /* Deprecated; not used */
-};
-
-/**
- * xmlSchemaAttributeLink:
- * Used to build a list of attribute uses on complexType definitions.
- * WARNING: Deprecated; not used.
- */
-typedef struct _xmlSchemaAttributeLink xmlSchemaAttributeLink;
-typedef xmlSchemaAttributeLink *xmlSchemaAttributeLinkPtr;
-struct _xmlSchemaAttributeLink {
-    struct _xmlSchemaAttributeLink *next;/* the next attribute link ... */
-    struct _xmlSchemaAttribute *attr;/* the linked attribute */
-};
-
-/**
- * XML_SCHEMAS_WILDCARD_COMPLETE:
- *
- * If the wildcard is complete.
- */
-#define XML_SCHEMAS_WILDCARD_COMPLETE 1 << 0
-
-/**
- * xmlSchemaCharValueLink:
- * Used to build a list of namespaces on wildcards.
- */
-typedef struct _xmlSchemaWildcardNs xmlSchemaWildcardNs;
-typedef xmlSchemaWildcardNs *xmlSchemaWildcardNsPtr;
-struct _xmlSchemaWildcardNs {
-    struct _xmlSchemaWildcardNs *next;/* the next constraint link ... */
-    const xmlChar *value;/* the value */
-};
-
-/**
- * xmlSchemaWildcard.
- * A wildcard.
- */
-typedef struct _xmlSchemaWildcard xmlSchemaWildcard;
-typedef xmlSchemaWildcard *xmlSchemaWildcardPtr;
-struct _xmlSchemaWildcard {
-    xmlSchemaTypeType type;        /* The kind of type */
-    const xmlChar *id; /* Deprecated; not used */
-    xmlSchemaAnnotPtr annot;
-    xmlNodePtr node;
-    int minOccurs; /* Deprecated; not used */
-    int maxOccurs; /* Deprecated; not used */
-    int processContents;
-    int any; /* Indicates if the ns constraint is of ##any */
-    xmlSchemaWildcardNsPtr nsSet; /* The list of allowed namespaces */
-    xmlSchemaWildcardNsPtr negNsSet; /* The negated namespace */
-    int flags;
-};
-
-/**
- * XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED:
- *
- * The attribute wildcard has been already builded.
- */
-#define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED 1 << 0
-/**
- * XML_SCHEMAS_ATTRGROUP_GLOBAL:
- *
- * The attribute wildcard has been already builded.
- */
-#define XML_SCHEMAS_ATTRGROUP_GLOBAL 1 << 1
-/**
- * XML_SCHEMAS_ATTRGROUP_MARKED:
- *
- * Marks the attr group as marked; used for circular checks.
- */
-#define XML_SCHEMAS_ATTRGROUP_MARKED 1 << 2
-
-/**
- * XML_SCHEMAS_ATTRGROUP_REDEFINED:
- *
- * The attr group was redefined.
- */
-#define XML_SCHEMAS_ATTRGROUP_REDEFINED 1 << 3
-/**
- * XML_SCHEMAS_ATTRGROUP_HAS_REFS:
- *
- * Whether this attr. group contains attr. group references.
- */
-#define XML_SCHEMAS_ATTRGROUP_HAS_REFS 1 << 4
-
-/**
- * An attribute group definition.
- *
- * xmlSchemaAttribute and xmlSchemaAttributeGroup start of structures
- * must be kept similar
- */
-typedef struct _xmlSchemaAttributeGroup xmlSchemaAttributeGroup;
-typedef xmlSchemaAttributeGroup *xmlSchemaAttributeGroupPtr;
-struct _xmlSchemaAttributeGroup {
-    xmlSchemaTypeType type;        /* The kind of type */
-    struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */
-    const xmlChar *name;
-    const xmlChar *id;
-    const xmlChar *ref; /* Deprecated; not used */
-    const xmlChar *refNs; /* Deprecated; not used */
-    xmlSchemaAnnotPtr annot;
-
-    xmlSchemaAttributePtr attributes; /* Deprecated; not used */
-    xmlNodePtr node;
-    int flags;
-    xmlSchemaWildcardPtr attributeWildcard;
-    const xmlChar *refPrefix; /* Deprecated; not used */
-    xmlSchemaAttributeGroupPtr refItem; /* Deprecated; not used */
-    const xmlChar *targetNamespace;
-    void *attrUses;
-};
-
-/**
- * xmlSchemaTypeLink:
- * Used to build a list of types (e.g. member types of
- * simpleType with variety "union").
- */
-typedef struct _xmlSchemaTypeLink xmlSchemaTypeLink;
-typedef xmlSchemaTypeLink *xmlSchemaTypeLinkPtr;
-struct _xmlSchemaTypeLink {
-    struct _xmlSchemaTypeLink *next;/* the next type link ... */
-    xmlSchemaTypePtr type;/* the linked type */
-};
-
-/**
- * xmlSchemaFacetLink:
- * Used to build a list of facets.
- */
-typedef struct _xmlSchemaFacetLink xmlSchemaFacetLink;
-typedef xmlSchemaFacetLink *xmlSchemaFacetLinkPtr;
-struct _xmlSchemaFacetLink {
-    struct _xmlSchemaFacetLink *next;/* the next facet link ... */
-    xmlSchemaFacetPtr facet;/* the linked facet */
-};
-
-/**
- * XML_SCHEMAS_TYPE_MIXED:
- *
- * the element content type is mixed
- */
-#define XML_SCHEMAS_TYPE_MIXED                1 << 0
-/**
- * XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION:
- *
- * the simple or complex type has a derivation method of "extension".
- */
-#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION                1 << 1
-/**
- * XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION:
- *
- * the simple or complex type has a derivation method of "restriction".
- */
-#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION                1 << 2
-/**
- * XML_SCHEMAS_TYPE_GLOBAL:
- *
- * the type is global
- */
-#define XML_SCHEMAS_TYPE_GLOBAL                1 << 3
-/**
- * XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD:
- *
- * the complexType owns an attribute wildcard, i.e.
- * it can be freed by the complexType
- */
-#define XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD    1 << 4 /* Obsolete. */
-/**
- * XML_SCHEMAS_TYPE_VARIETY_ABSENT:
- *
- * the simpleType has a variety of "absent".
- * TODO: Actually not necessary :-/, since if
- * none of the variety flags occur then it's
- * automatically absent.
- */
-#define XML_SCHEMAS_TYPE_VARIETY_ABSENT    1 << 5
-/**
- * XML_SCHEMAS_TYPE_VARIETY_LIST:
- *
- * the simpleType has a variety of "list".
- */
-#define XML_SCHEMAS_TYPE_VARIETY_LIST    1 << 6
-/**
- * XML_SCHEMAS_TYPE_VARIETY_UNION:
- *
- * the simpleType has a variety of "union".
- */
-#define XML_SCHEMAS_TYPE_VARIETY_UNION    1 << 7
-/**
- * XML_SCHEMAS_TYPE_VARIETY_ATOMIC:
- *
- * the simpleType has a variety of "union".
- */
-#define XML_SCHEMAS_TYPE_VARIETY_ATOMIC    1 << 8
-/**
- * XML_SCHEMAS_TYPE_FINAL_EXTENSION:
- *
- * the complexType has a final of "extension".
- */
-#define XML_SCHEMAS_TYPE_FINAL_EXTENSION    1 << 9
-/**
- * XML_SCHEMAS_TYPE_FINAL_RESTRICTION:
- *
- * the simpleType/complexType has a final of "restriction".
- */
-#define XML_SCHEMAS_TYPE_FINAL_RESTRICTION    1 << 10
-/**
- * XML_SCHEMAS_TYPE_FINAL_LIST:
- *
- * the simpleType has a final of "list".
- */
-#define XML_SCHEMAS_TYPE_FINAL_LIST    1 << 11
-/**
- * XML_SCHEMAS_TYPE_FINAL_UNION:
- *
- * the simpleType has a final of "union".
- */
-#define XML_SCHEMAS_TYPE_FINAL_UNION    1 << 12
-/**
- * XML_SCHEMAS_TYPE_FINAL_DEFAULT:
- *
- * the simpleType has a final of "default".
- */
-#define XML_SCHEMAS_TYPE_FINAL_DEFAULT    1 << 13
-/**
- * XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE:
- *
- * Marks the item as a builtin primitive.
- */
-#define XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE    1 << 14
-/**
- * XML_SCHEMAS_TYPE_MARKED:
- *
- * Marks the item as marked; used for circular checks.
- */
-#define XML_SCHEMAS_TYPE_MARKED        1 << 16
-/**
- * XML_SCHEMAS_TYPE_BLOCK_DEFAULT:
- *
- * the complexType did not specify 'block' so use the default of the
- * <schema> item.
- */
-#define XML_SCHEMAS_TYPE_BLOCK_DEFAULT    1 << 17
-/**
- * XML_SCHEMAS_TYPE_BLOCK_EXTENSION:
- *
- * the complexType has a 'block' of "extension".
- */
-#define XML_SCHEMAS_TYPE_BLOCK_EXTENSION    1 << 18
-/**
- * XML_SCHEMAS_TYPE_BLOCK_RESTRICTION:
- *
- * the complexType has a 'block' of "restriction".
- */
-#define XML_SCHEMAS_TYPE_BLOCK_RESTRICTION    1 << 19
-/**
- * XML_SCHEMAS_TYPE_ABSTRACT:
- *
- * the simple/complexType is abstract.
- */
-#define XML_SCHEMAS_TYPE_ABSTRACT    1 << 20
-/**
- * XML_SCHEMAS_TYPE_FACETSNEEDVALUE:
- *
- * indicates if the facets need a computed value
- */
-#define XML_SCHEMAS_TYPE_FACETSNEEDVALUE    1 << 21
-/**
- * XML_SCHEMAS_TYPE_INTERNAL_RESOLVED:
- *
- * indicates that the type was typefixed
- */
-#define XML_SCHEMAS_TYPE_INTERNAL_RESOLVED    1 << 22
-/**
- * XML_SCHEMAS_TYPE_INTERNAL_INVALID:
- *
- * indicates that the type is invalid
- */
-#define XML_SCHEMAS_TYPE_INTERNAL_INVALID    1 << 23
-/**
- * XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE:
- *
- * a whitespace-facet value of "preserve"
- */
-#define XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE    1 << 24
-/**
- * XML_SCHEMAS_TYPE_WHITESPACE_REPLACE:
- *
- * a whitespace-facet value of "replace"
- */
-#define XML_SCHEMAS_TYPE_WHITESPACE_REPLACE    1 << 25
-/**
- * XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE:
- *
- * a whitespace-facet value of "collapse"
- */
-#define XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE    1 << 26
-/**
- * XML_SCHEMAS_TYPE_HAS_FACETS:
- *
- * has facets
- */
-#define XML_SCHEMAS_TYPE_HAS_FACETS    1 << 27
-/**
- * XML_SCHEMAS_TYPE_NORMVALUENEEDED:
- *
- * indicates if the facets (pattern) need a normalized value
- */
-#define XML_SCHEMAS_TYPE_NORMVALUENEEDED    1 << 28
-
-/**
- * XML_SCHEMAS_TYPE_FIXUP_1:
- *
- * First stage of fixup was done.
- */
-#define XML_SCHEMAS_TYPE_FIXUP_1    1 << 29
-
-/**
- * XML_SCHEMAS_TYPE_REDEFINED:
- *
- * The type was redefined.
- */
-#define XML_SCHEMAS_TYPE_REDEFINED    1 << 30
-/**
- * XML_SCHEMAS_TYPE_REDEFINING:
- *
- * The type redefines an other type.
- */
-/* #define XML_SCHEMAS_TYPE_REDEFINING    1 << 31 */
-
-/**
- * _xmlSchemaType:
- *
- * Schemas type definition.
- */
-struct _xmlSchemaType {
-    xmlSchemaTypeType type; /* The kind of type */
-    struct _xmlSchemaType *next; /* the next type if in a sequence ... */
-    const xmlChar *name;
-    const xmlChar *id ; /* Deprecated; not used */
-    const xmlChar *ref; /* Deprecated; not used */
-    const xmlChar *refNs; /* Deprecated; not used */
-    xmlSchemaAnnotPtr annot;
-    xmlSchemaTypePtr subtypes;
-    xmlSchemaAttributePtr attributes; /* Deprecated; not used */
-    xmlNodePtr node;
-    int minOccurs; /* Deprecated; not used */
-    int maxOccurs; /* Deprecated; not used */
-
-    int flags;
-    xmlSchemaContentType contentType;
-    const xmlChar *base; /* Base type's local name */
-    const xmlChar *baseNs; /* Base type's target namespace */
-    xmlSchemaTypePtr baseType; /* The base type component */
-    xmlSchemaFacetPtr facets; /* Local facets */
-    struct _xmlSchemaType *redef; /* Deprecated; not used */
-    int recurse; /* Obsolete */
-    xmlSchemaAttributeLinkPtr *attributeUses; /* Deprecated; not used */
-    xmlSchemaWildcardPtr attributeWildcard;
-    int builtInType; /* Type of built-in types. */
-    xmlSchemaTypeLinkPtr memberTypes; /* member-types if a union type. */
-    xmlSchemaFacetLinkPtr facetSet; /* All facets (incl. inherited) */
-    const xmlChar *refPrefix; /* Deprecated; not used */
-    xmlSchemaTypePtr contentTypeDef; /* Used for the simple content of complex types.
-                                        Could we use @subtypes for this? */
-    xmlRegexpPtr contModel; /* Holds the automaton of the content model */
-    const xmlChar *targetNamespace;
-    void *attrUses;
-};
-
-/*
- * xmlSchemaElement:
- * An element definition.
- *
- * xmlSchemaType, xmlSchemaFacet and xmlSchemaElement start of
- * structures must be kept similar
- */
-/**
- * XML_SCHEMAS_ELEM_NILLABLE:
- *
- * the element is nillable
- */
-#define XML_SCHEMAS_ELEM_NILLABLE        1 << 0
-/**
- * XML_SCHEMAS_ELEM_GLOBAL:
- *
- * the element is global
- */
-#define XML_SCHEMAS_ELEM_GLOBAL                1 << 1
-/**
- * XML_SCHEMAS_ELEM_DEFAULT:
- *
- * the element has a default value
- */
-#define XML_SCHEMAS_ELEM_DEFAULT        1 << 2
-/**
- * XML_SCHEMAS_ELEM_FIXED:
- *
- * the element has a fixed value
- */
-#define XML_SCHEMAS_ELEM_FIXED                1 << 3
-/**
- * XML_SCHEMAS_ELEM_ABSTRACT:
- *
- * the element is abstract
- */
-#define XML_SCHEMAS_ELEM_ABSTRACT        1 << 4
-/**
- * XML_SCHEMAS_ELEM_TOPLEVEL:
- *
- * the element is top level
- * obsolete: use XML_SCHEMAS_ELEM_GLOBAL instead
- */
-#define XML_SCHEMAS_ELEM_TOPLEVEL        1 << 5
-/**
- * XML_SCHEMAS_ELEM_REF:
- *
- * the element is a reference to a type
- */
-#define XML_SCHEMAS_ELEM_REF                1 << 6
-/**
- * XML_SCHEMAS_ELEM_NSDEFAULT:
- *
- * allow elements in no namespace
- * Obsolete, not used anymore.
- */
-#define XML_SCHEMAS_ELEM_NSDEFAULT        1 << 7
-/**
- * XML_SCHEMAS_ELEM_INTERNAL_RESOLVED:
- *
- * this is set when "type", "ref", "substitutionGroup"
- * references have been resolved.
- */
-#define XML_SCHEMAS_ELEM_INTERNAL_RESOLVED        1 << 8
- /**
- * XML_SCHEMAS_ELEM_CIRCULAR:
- *
- * a helper flag for the search of circular references.
- */
-#define XML_SCHEMAS_ELEM_CIRCULAR        1 << 9
-/**
- * XML_SCHEMAS_ELEM_BLOCK_ABSENT:
- *
- * the "block" attribute is absent
- */
-#define XML_SCHEMAS_ELEM_BLOCK_ABSENT        1 << 10
-/**
- * XML_SCHEMAS_ELEM_BLOCK_EXTENSION:
- *
- * disallowed substitutions are absent
- */
-#define XML_SCHEMAS_ELEM_BLOCK_EXTENSION        1 << 11
-/**
- * XML_SCHEMAS_ELEM_BLOCK_RESTRICTION:
- *
- * disallowed substitutions: "restriction"
- */
-#define XML_SCHEMAS_ELEM_BLOCK_RESTRICTION        1 << 12
-/**
- * XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION:
- *
- * disallowed substitutions: "substituion"
- */
-#define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION        1 << 13
-/**
- * XML_SCHEMAS_ELEM_FINAL_ABSENT:
- *
- * substitution group exclusions are absent
- */
-#define XML_SCHEMAS_ELEM_FINAL_ABSENT        1 << 14
-/**
- * XML_SCHEMAS_ELEM_FINAL_EXTENSION:
- *
- * substitution group exclusions: "extension"
- */
-#define XML_SCHEMAS_ELEM_FINAL_EXTENSION        1 << 15
-/**
- * XML_SCHEMAS_ELEM_FINAL_RESTRICTION:
- *
- * substitution group exclusions: "restriction"
- */
-#define XML_SCHEMAS_ELEM_FINAL_RESTRICTION        1 << 16
-/**
- * XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD:
- *
- * the declaration is a substitution group head
- */
-#define XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD        1 << 17
-/**
- * XML_SCHEMAS_ELEM_INTERNAL_CHECKED:
- *
- * this is set when the elem decl has been checked against
- * all constraints
- */
-#define XML_SCHEMAS_ELEM_INTERNAL_CHECKED        1 << 18
-
-typedef struct _xmlSchemaElement xmlSchemaElement;
-typedef xmlSchemaElement *xmlSchemaElementPtr;
-struct _xmlSchemaElement {
-    xmlSchemaTypeType type; /* The kind of type */
-    struct _xmlSchemaType *next; /* Not used? */
-    const xmlChar *name;
-    const xmlChar *id; /* Deprecated; not used */
-    const xmlChar *ref; /* Deprecated; not used */
-    const xmlChar *refNs; /* Deprecated; not used */
-    xmlSchemaAnnotPtr annot;
-    xmlSchemaTypePtr subtypes; /* the type definition */
-    xmlSchemaAttributePtr attributes;
-    xmlNodePtr node;
-    int minOccurs; /* Deprecated; not used */
-    int maxOccurs; /* Deprecated; not used */
-
-    int flags;
-    const xmlChar *targetNamespace;
-    const xmlChar *namedType;
-    const xmlChar *namedTypeNs;
-    const xmlChar *substGroup;
-    const xmlChar *substGroupNs;
-    const xmlChar *scope;
-    const xmlChar *value; /* The original value of the value constraint. */
-    struct _xmlSchemaElement *refDecl; /* This will now be used for the
-                                          substitution group affiliation */
-    xmlRegexpPtr contModel; /* Obsolete for WXS, maybe used for RelaxNG */
-    xmlSchemaContentType contentType;
-    const xmlChar *refPrefix; /* Deprecated; not used */
-    xmlSchemaValPtr defVal; /* The compiled value contraint. */
-    void *idcs; /* The identity-constraint defs */
-};
-
-/*
- * XML_SCHEMAS_FACET_UNKNOWN:
- *
- * unknown facet handling
- */
-#define XML_SCHEMAS_FACET_UNKNOWN        0
-/*
- * XML_SCHEMAS_FACET_PRESERVE:
- *
- * preserve the type of the facet
- */
-#define XML_SCHEMAS_FACET_PRESERVE        1
-/*
- * XML_SCHEMAS_FACET_REPLACE:
- *
- * replace the type of the facet
- */
-#define XML_SCHEMAS_FACET_REPLACE        2
-/*
- * XML_SCHEMAS_FACET_COLLAPSE:
- *
- * collapse the types of the facet
- */
-#define XML_SCHEMAS_FACET_COLLAPSE        3
-/**
- * A facet definition.
- */
-struct _xmlSchemaFacet {
-    xmlSchemaTypeType type;        /* The kind of type */
-    struct _xmlSchemaFacet *next;/* the next type if in a sequence ... */
-    const xmlChar *value; /* The original value */
-    const xmlChar *id; /* Obsolete */
-    xmlSchemaAnnotPtr annot;
-    xmlNodePtr node;
-    int fixed; /* XML_SCHEMAS_FACET_PRESERVE, etc. */
-    int whitespace;
-    xmlSchemaValPtr val; /* The compiled value */
-    xmlRegexpPtr    regexp; /* The regex for patterns */
-};
-
-/**
- * A notation definition.
- */
-typedef struct _xmlSchemaNotation xmlSchemaNotation;
-typedef xmlSchemaNotation *xmlSchemaNotationPtr;
-struct _xmlSchemaNotation {
-    xmlSchemaTypeType type; /* The kind of type */
-    const xmlChar *name;
-    xmlSchemaAnnotPtr annot;
-    const xmlChar *identifier;
-    const xmlChar *targetNamespace;
-};
-
-/*
-* TODO: Actually all those flags used for the schema should sit
-* on the schema parser context, since they are used only
-* during parsing an XML schema document, and not available
-* on the component level as per spec.
-*/
-/**
- * XML_SCHEMAS_QUALIF_ELEM:
- *
- * Reflects elementFormDefault == qualified in
- * an XML schema document.
- */
-#define XML_SCHEMAS_QUALIF_ELEM                1 << 0
-/**
- * XML_SCHEMAS_QUALIF_ATTR:
- *
- * Reflects attributeFormDefault == qualified in
- * an XML schema document.
- */
-#define XML_SCHEMAS_QUALIF_ATTR            1 << 1
-/**
- * XML_SCHEMAS_FINAL_DEFAULT_EXTENSION:
- *
- * the schema has "extension" in the set of finalDefault.
- */
-#define XML_SCHEMAS_FINAL_DEFAULT_EXTENSION        1 << 2
-/**
- * XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION:
- *
- * the schema has "restriction" in the set of finalDefault.
- */
-#define XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION            1 << 3
-/**
- * XML_SCHEMAS_FINAL_DEFAULT_LIST:
- *
- * the cshema has "list" in the set of finalDefault.
- */
-#define XML_SCHEMAS_FINAL_DEFAULT_LIST            1 << 4
-/**
- * XML_SCHEMAS_FINAL_DEFAULT_UNION:
- *
- * the schema has "union" in the set of finalDefault.
- */
-#define XML_SCHEMAS_FINAL_DEFAULT_UNION            1 << 5
-/**
- * XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION:
- *
- * the schema has "extension" in the set of blockDefault.
- */
-#define XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION            1 << 6
-/**
- * XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION:
- *
- * the schema has "restriction" in the set of blockDefault.
- */
-#define XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION            1 << 7
-/**
- * XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION:
- *
- * the schema has "substitution" in the set of blockDefault.
- */
-#define XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION            1 << 8
-/**
- * XML_SCHEMAS_INCLUDING_CONVERT_NS:
- *
- * the schema is currently including an other schema with
- * no target namespace.
- */
-#define XML_SCHEMAS_INCLUDING_CONVERT_NS            1 << 9
-/**
- * _xmlSchema:
- *
- * A Schemas definition
- */
-struct _xmlSchema {
-    const xmlChar *name; /* schema name */
-    const xmlChar *targetNamespace; /* the target namespace */
-    const xmlChar *version;
-    const xmlChar *id; /* Obsolete */
-    xmlDocPtr doc;
-    xmlSchemaAnnotPtr annot;
-    int flags;
-
-    xmlHashTablePtr typeDecl;
-    xmlHashTablePtr attrDecl;
-    xmlHashTablePtr attrgrpDecl;
-    xmlHashTablePtr elemDecl;
-    xmlHashTablePtr notaDecl;
-
-    xmlHashTablePtr schemasImports;
-
-    void *_private;        /* unused by the library for users or bindings */
-    xmlHashTablePtr groupDecl;
-    xmlDictPtr      dict;
-    void *includes;     /* the includes, this is opaque for now */
-    int preserve;        /* whether to free the document */
-    int counter; /* used to give ononymous components unique names */
-    xmlHashTablePtr idcDef; /* All identity-constraint defs. */
-    void *volatiles; /* Obsolete */
-};
-
-XMLPUBFUN void XMLCALL         xmlSchemaFreeType        (xmlSchemaTypePtr type);
-XMLPUBFUN void XMLCALL         xmlSchemaFreeWildcard(xmlSchemaWildcardPtr wildcard);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LIBXML_SCHEMAS_ENABLED */
-#endif /* __XML_SCHEMA_INTERNALS_H__ */
diff --git a/interfaces/ext/libxml/schematron.h b/interfaces/ext/libxml/schematron.h
deleted file mode 100644
index f442826..0000000
--- a/interfaces/ext/libxml/schematron.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Summary: XML Schemastron implementation
- * Description: interface to the XML Schematron validity checking.
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-
-#ifndef __XML_SCHEMATRON_H__
-#define __XML_SCHEMATRON_H__
-
-#include <libxml/xmlversion.h>
-
-#ifdef LIBXML_SCHEMATRON_ENABLED
-
-#include <libxml/tree.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    XML_SCHEMATRON_OUT_QUIET = 1 << 0,	/* quiet no report */
-    XML_SCHEMATRON_OUT_TEXT = 1 << 1,	/* build a textual report */
-    XML_SCHEMATRON_OUT_XML = 1 << 2,	/* output SVRL */
-    XML_SCHEMATRON_OUT_ERROR = 1 << 3,  /* output via xmlStructuredErrorFunc */
-    XML_SCHEMATRON_OUT_FILE = 1 << 8,	/* output to a file descriptor */
-    XML_SCHEMATRON_OUT_BUFFER = 1 << 9,	/* output to a buffer */
-    XML_SCHEMATRON_OUT_IO = 1 << 10	/* output to I/O mechanism */
-} xmlSchematronValidOptions;
-
-/**
- * The schemas related types are kept internal
- */
-typedef struct _xmlSchematron xmlSchematron;
-typedef xmlSchematron *xmlSchematronPtr;
-
-/**
- * xmlSchematronValidityErrorFunc:
- * @ctx: the validation context
- * @msg: the message
- * @...: extra arguments
- *
- * Signature of an error callback from a Schematron validation
- */
-typedef void (*xmlSchematronValidityErrorFunc) (void *ctx, const char *msg, ...);
-
-/**
- * xmlSchematronValidityWarningFunc:
- * @ctx: the validation context
- * @msg: the message
- * @...: extra arguments
- *
- * Signature of a warning callback from a Schematron validation
- */
-typedef void (*xmlSchematronValidityWarningFunc) (void *ctx, const char *msg, ...);
-
-/**
- * A schemas validation context
- */
-typedef struct _xmlSchematronParserCtxt xmlSchematronParserCtxt;
-typedef xmlSchematronParserCtxt *xmlSchematronParserCtxtPtr;
-
-typedef struct _xmlSchematronValidCtxt xmlSchematronValidCtxt;
-typedef xmlSchematronValidCtxt *xmlSchematronValidCtxtPtr;
-
-/*
- * Interfaces for parsing.
- */
-XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL 
-	    xmlSchematronNewParserCtxt	(const char *URL);
-XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL 
-	    xmlSchematronNewMemParserCtxt(const char *buffer,
-					 int size);
-XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
-	    xmlSchematronNewDocParserCtxt(xmlDocPtr doc);
-XMLPUBFUN void XMLCALL		
-	    xmlSchematronFreeParserCtxt	(xmlSchematronParserCtxtPtr ctxt);
-/*****
-XMLPUBFUN void XMLCALL		
-	    xmlSchematronSetParserErrors(xmlSchematronParserCtxtPtr ctxt,
-					 xmlSchematronValidityErrorFunc err,
-					 xmlSchematronValidityWarningFunc warn,
-					 void *ctx);
-XMLPUBFUN int XMLCALL
-		xmlSchematronGetParserErrors(xmlSchematronParserCtxtPtr ctxt,
-					xmlSchematronValidityErrorFunc * err,
-					xmlSchematronValidityWarningFunc * warn,
-					void **ctx);
-XMLPUBFUN int XMLCALL
-		xmlSchematronIsValid	(xmlSchematronValidCtxtPtr ctxt);
- *****/
-XMLPUBFUN xmlSchematronPtr XMLCALL	
-	    xmlSchematronParse		(xmlSchematronParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL		
-	    xmlSchematronFree		(xmlSchematronPtr schema);
-/*
- * Interfaces for validating
- */
-XMLPUBFUN void XMLCALL
-	    xmlSchematronSetValidStructuredErrors(
-	                                  xmlSchematronValidCtxtPtr ctxt,
-					  xmlStructuredErrorFunc serror,
-					  void *ctx);
-/******
-XMLPUBFUN void XMLCALL		
-	    xmlSchematronSetValidErrors	(xmlSchematronValidCtxtPtr ctxt,
-					 xmlSchematronValidityErrorFunc err,
-					 xmlSchematronValidityWarningFunc warn,
-					 void *ctx);
-XMLPUBFUN int XMLCALL
-	    xmlSchematronGetValidErrors	(xmlSchematronValidCtxtPtr ctxt,
-					 xmlSchematronValidityErrorFunc *err,
-					 xmlSchematronValidityWarningFunc *warn,
-					 void **ctx);
-XMLPUBFUN int XMLCALL
-	    xmlSchematronSetValidOptions(xmlSchematronValidCtxtPtr ctxt,
-					 int options);
-XMLPUBFUN int XMLCALL
-	    xmlSchematronValidCtxtGetOptions(xmlSchematronValidCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL
-            xmlSchematronValidateOneElement (xmlSchematronValidCtxtPtr ctxt,
-			                 xmlNodePtr elem);
- *******/
-
-XMLPUBFUN xmlSchematronValidCtxtPtr XMLCALL	
-	    xmlSchematronNewValidCtxt	(xmlSchematronPtr schema,
-	    				 int options);
-XMLPUBFUN void XMLCALL			
-	    xmlSchematronFreeValidCtxt	(xmlSchematronValidCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL			
-	    xmlSchematronValidateDoc	(xmlSchematronValidCtxtPtr ctxt,
-					 xmlDocPtr instance);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LIBXML_SCHEMATRON_ENABLED */
-#endif /* __XML_SCHEMATRON_H__ */
diff --git a/interfaces/ext/libxml/threads.h b/interfaces/ext/libxml/threads.h
deleted file mode 100644
index d31f16a..0000000
--- a/interfaces/ext/libxml/threads.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * Summary: interfaces for thread handling
- * Description: set of generic threading related routines
- *              should work with pthreads, Windows native or TLS threads
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#ifndef __XML_THREADS_H__
-#define __XML_THREADS_H__
-
-#include <libxml/xmlversion.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * xmlMutex are a simple mutual exception locks.
- */
-typedef struct _xmlMutex xmlMutex;
-typedef xmlMutex *xmlMutexPtr;
-
-/*
- * xmlRMutex are reentrant mutual exception locks.
- */
-typedef struct _xmlRMutex xmlRMutex;
-typedef xmlRMutex *xmlRMutexPtr;
-
-#ifdef __cplusplus
-}
-#endif
-#include <libxml/globals.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
-XMLPUBFUN xmlMutexPtr XMLCALL
-			xmlNewMutex	(void);
-XMLPUBFUN void XMLCALL
-			xmlMutexLock	(xmlMutexPtr tok);
-XMLPUBFUN void XMLCALL
-			xmlMutexUnlock	(xmlMutexPtr tok);
-XMLPUBFUN void XMLCALL
-			xmlFreeMutex	(xmlMutexPtr tok);
-
-XMLPUBFUN xmlRMutexPtr XMLCALL
-			xmlNewRMutex	(void);
-XMLPUBFUN void XMLCALL
-			xmlRMutexLock	(xmlRMutexPtr tok);
-XMLPUBFUN void XMLCALL
-			xmlRMutexUnlock	(xmlRMutexPtr tok);
-XMLPUBFUN void XMLCALL
-			xmlFreeRMutex	(xmlRMutexPtr tok);
-
-/*
- * Library wide APIs.
- */
-XMLPUBFUN void XMLCALL
-			xmlInitThreads	(void);
-XMLPUBFUN void XMLCALL
-			xmlLockLibrary	(void);
-XMLPUBFUN void XMLCALL
-			xmlUnlockLibrary(void);
-XMLPUBFUN int XMLCALL
-			xmlGetThreadId	(void);
-XMLPUBFUN int XMLCALL
-			xmlIsMainThread	(void);
-XMLPUBFUN void XMLCALL
-			xmlCleanupThreads(void);
-XMLPUBFUN xmlGlobalStatePtr XMLCALL
-			xmlGetGlobalState(void);
-
-#if defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && defined(LIBXML_STATIC_FOR_DLL)
-int XMLCALL xmlDllMain(void *hinstDLL, unsigned long fdwReason, void *lpvReserved);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* __XML_THREADS_H__ */
diff --git a/interfaces/ext/libxml/tree.h b/interfaces/ext/libxml/tree.h
deleted file mode 100644
index b733589..0000000
--- a/interfaces/ext/libxml/tree.h
+++ /dev/null
@@ -1,1252 +0,0 @@
-/*
- * Summary: interfaces for tree manipulation
- * Description: this module describes the structures found in an tree resulting
- *              from an XML or HTML parsing, as well as the API provided for
- *              various processing on that tree
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#ifndef __XML_TREE_H__
-#define __XML_TREE_H__
-
-#include <stdio.h>
-#include <libxml/xmlversion.h>
-#include <libxml/xmlstring.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Some of the basic types pointer to structures:
- */
-/* xmlIO.h */
-typedef struct _xmlParserInputBuffer xmlParserInputBuffer;
-typedef xmlParserInputBuffer *xmlParserInputBufferPtr;
-
-typedef struct _xmlOutputBuffer xmlOutputBuffer;
-typedef xmlOutputBuffer *xmlOutputBufferPtr;
-
-/* parser.h */
-typedef struct _xmlParserInput xmlParserInput;
-typedef xmlParserInput *xmlParserInputPtr;
-
-typedef struct _xmlParserCtxt xmlParserCtxt;
-typedef xmlParserCtxt *xmlParserCtxtPtr;
-
-typedef struct _xmlSAXLocator xmlSAXLocator;
-typedef xmlSAXLocator *xmlSAXLocatorPtr;
-
-typedef struct _xmlSAXHandler xmlSAXHandler;
-typedef xmlSAXHandler *xmlSAXHandlerPtr;
-
-/* entities.h */
-typedef struct _xmlEntity xmlEntity;
-typedef xmlEntity *xmlEntityPtr;
-
-/**
- * BASE_BUFFER_SIZE:
- *
- * default buffer size 4000.
- */
-#define BASE_BUFFER_SIZE 4096
-
-/**
- * LIBXML_NAMESPACE_DICT:
- *
- * Defines experimental behaviour:
- * 1) xmlNs gets an additional field @context (a xmlDoc)
- * 2) when creating a tree, xmlNs->href is stored in the dict of xmlDoc.
- */
-/* #define LIBXML_NAMESPACE_DICT */
-
-/**
- * xmlBufferAllocationScheme:
- *
- * A buffer allocation scheme can be defined to either match exactly the
- * need or double it's allocated size each time it is found too small.
- */
-
-typedef enum {
-    XML_BUFFER_ALLOC_DOUBLEIT,	/* double each time one need to grow */
-    XML_BUFFER_ALLOC_EXACT,	/* grow only to the minimal size */
-    XML_BUFFER_ALLOC_IMMUTABLE, /* immutable buffer */
-    XML_BUFFER_ALLOC_IO		/* special allocation scheme used for I/O */
-} xmlBufferAllocationScheme;
-
-/**
- * xmlBuffer:
- *
- * A buffer structure.
- */
-typedef struct _xmlBuffer xmlBuffer;
-typedef xmlBuffer *xmlBufferPtr;
-struct _xmlBuffer {
-    xmlChar *content;		/* The buffer content UTF8 */
-    unsigned int use;		/* The buffer size used */
-    unsigned int size;		/* The buffer size */
-    xmlBufferAllocationScheme alloc; /* The realloc method */
-    xmlChar *contentIO;		/* in IO mode we may have a different base */
-};
-
-/**
- * XML_XML_NAMESPACE:
- *
- * This is the namespace for the special xml: prefix predefined in the
- * XML Namespace specification.
- */
-#define XML_XML_NAMESPACE \
-    (const xmlChar *) "http://www.w3.org/XML/1998/namespace"
-
-/**
- * XML_XML_ID:
- *
- * This is the name for the special xml:id attribute
- */
-#define XML_XML_ID (const xmlChar *) "xml:id"
-
-/*
- * The different element types carried by an XML tree.
- *
- * NOTE: This is synchronized with DOM Level1 values
- *       See http://www.w3.org/TR/REC-DOM-Level-1/
- *
- * Actually this had diverged a bit, and now XML_DOCUMENT_TYPE_NODE should
- * be deprecated to use an XML_DTD_NODE.
- */
-typedef enum {
-    XML_ELEMENT_NODE=		1,
-    XML_ATTRIBUTE_NODE=		2,
-    XML_TEXT_NODE=		3,
-    XML_CDATA_SECTION_NODE=	4,
-    XML_ENTITY_REF_NODE=	5,
-    XML_ENTITY_NODE=		6,
-    XML_PI_NODE=		7,
-    XML_COMMENT_NODE=		8,
-    XML_DOCUMENT_NODE=		9,
-    XML_DOCUMENT_TYPE_NODE=	10,
-    XML_DOCUMENT_FRAG_NODE=	11,
-    XML_NOTATION_NODE=		12,
-    XML_HTML_DOCUMENT_NODE=	13,
-    XML_DTD_NODE=		14,
-    XML_ELEMENT_DECL=		15,
-    XML_ATTRIBUTE_DECL=		16,
-    XML_ENTITY_DECL=		17,
-    XML_NAMESPACE_DECL=		18,
-    XML_XINCLUDE_START=		19,
-    XML_XINCLUDE_END=		20
-#ifdef LIBXML_DOCB_ENABLED
-   ,XML_DOCB_DOCUMENT_NODE=	21
-#endif
-} xmlElementType;
-
-
-/**
- * xmlNotation:
- *
- * A DTD Notation definition.
- */
-
-typedef struct _xmlNotation xmlNotation;
-typedef xmlNotation *xmlNotationPtr;
-struct _xmlNotation {
-    const xmlChar               *name;	        /* Notation name */
-    const xmlChar               *PublicID;	/* Public identifier, if any */
-    const xmlChar               *SystemID;	/* System identifier, if any */
-};
-
-/**
- * xmlAttributeType:
- *
- * A DTD Attribute type definition.
- */
-
-typedef enum {
-    XML_ATTRIBUTE_CDATA = 1,
-    XML_ATTRIBUTE_ID,
-    XML_ATTRIBUTE_IDREF	,
-    XML_ATTRIBUTE_IDREFS,
-    XML_ATTRIBUTE_ENTITY,
-    XML_ATTRIBUTE_ENTITIES,
-    XML_ATTRIBUTE_NMTOKEN,
-    XML_ATTRIBUTE_NMTOKENS,
-    XML_ATTRIBUTE_ENUMERATION,
-    XML_ATTRIBUTE_NOTATION
-} xmlAttributeType;
-
-/**
- * xmlAttributeDefault:
- *
- * A DTD Attribute default definition.
- */
-
-typedef enum {
-    XML_ATTRIBUTE_NONE = 1,
-    XML_ATTRIBUTE_REQUIRED,
-    XML_ATTRIBUTE_IMPLIED,
-    XML_ATTRIBUTE_FIXED
-} xmlAttributeDefault;
-
-/**
- * xmlEnumeration:
- *
- * List structure used when there is an enumeration in DTDs.
- */
-
-typedef struct _xmlEnumeration xmlEnumeration;
-typedef xmlEnumeration *xmlEnumerationPtr;
-struct _xmlEnumeration {
-    struct _xmlEnumeration    *next;	/* next one */
-    const xmlChar            *name;	/* Enumeration name */
-};
-
-/**
- * xmlAttribute:
- *
- * An Attribute declaration in a DTD.
- */
-
-typedef struct _xmlAttribute xmlAttribute;
-typedef xmlAttribute *xmlAttributePtr;
-struct _xmlAttribute {
-    void           *_private;	        /* application data */
-    xmlElementType          type;       /* XML_ATTRIBUTE_DECL, must be second ! */
-    const xmlChar          *name;	/* Attribute name */
-    struct _xmlNode    *children;	/* NULL */
-    struct _xmlNode        *last;	/* NULL */
-    struct _xmlDtd       *parent;	/* -> DTD */
-    struct _xmlNode        *next;	/* next sibling link  */
-    struct _xmlNode        *prev;	/* previous sibling link  */
-    struct _xmlDoc          *doc;       /* the containing document */
-
-    struct _xmlAttribute  *nexth;	/* next in hash table */
-    xmlAttributeType       atype;	/* The attribute type */
-    xmlAttributeDefault      def;	/* the default */
-    const xmlChar  *defaultValue;	/* or the default value */
-    xmlEnumerationPtr       tree;       /* or the enumeration tree if any */
-    const xmlChar        *prefix;	/* the namespace prefix if any */
-    const xmlChar          *elem;	/* Element holding the attribute */
-};
-
-/**
- * xmlElementContentType:
- *
- * Possible definitions of element content types.
- */
-typedef enum {
-    XML_ELEMENT_CONTENT_PCDATA = 1,
-    XML_ELEMENT_CONTENT_ELEMENT,
-    XML_ELEMENT_CONTENT_SEQ,
-    XML_ELEMENT_CONTENT_OR
-} xmlElementContentType;
-
-/**
- * xmlElementContentOccur:
- *
- * Possible definitions of element content occurrences.
- */
-typedef enum {
-    XML_ELEMENT_CONTENT_ONCE = 1,
-    XML_ELEMENT_CONTENT_OPT,
-    XML_ELEMENT_CONTENT_MULT,
-    XML_ELEMENT_CONTENT_PLUS
-} xmlElementContentOccur;
-
-/**
- * xmlElementContent:
- *
- * An XML Element content as stored after parsing an element definition
- * in a DTD.
- */
-
-typedef struct _xmlElementContent xmlElementContent;
-typedef xmlElementContent *xmlElementContentPtr;
-struct _xmlElementContent {
-    xmlElementContentType     type;	/* PCDATA, ELEMENT, SEQ or OR */
-    xmlElementContentOccur    ocur;	/* ONCE, OPT, MULT or PLUS */
-    const xmlChar             *name;	/* Element name */
-    struct _xmlElementContent *c1;	/* first child */
-    struct _xmlElementContent *c2;	/* second child */
-    struct _xmlElementContent *parent;	/* parent */
-    const xmlChar             *prefix;	/* Namespace prefix */
-};
-
-/**
- * xmlElementTypeVal:
- *
- * The different possibilities for an element content type.
- */
-
-typedef enum {
-    XML_ELEMENT_TYPE_UNDEFINED = 0,
-    XML_ELEMENT_TYPE_EMPTY = 1,
-    XML_ELEMENT_TYPE_ANY,
-    XML_ELEMENT_TYPE_MIXED,
-    XML_ELEMENT_TYPE_ELEMENT
-} xmlElementTypeVal;
-
-#ifdef __cplusplus
-}
-#endif
-#include <libxml/xmlregexp.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * xmlElement:
- *
- * An XML Element declaration from a DTD.
- */
-
-typedef struct _xmlElement xmlElement;
-typedef xmlElement *xmlElementPtr;
-struct _xmlElement {
-    void           *_private;	        /* application data */
-    xmlElementType          type;       /* XML_ELEMENT_DECL, must be second ! */
-    const xmlChar          *name;	/* Element name */
-    struct _xmlNode    *children;	/* NULL */
-    struct _xmlNode        *last;	/* NULL */
-    struct _xmlDtd       *parent;	/* -> DTD */
-    struct _xmlNode        *next;	/* next sibling link  */
-    struct _xmlNode        *prev;	/* previous sibling link  */
-    struct _xmlDoc          *doc;       /* the containing document */
-
-    xmlElementTypeVal      etype;	/* The type */
-    xmlElementContentPtr content;	/* the allowed element content */
-    xmlAttributePtr   attributes;	/* List of the declared attributes */
-    const xmlChar        *prefix;	/* the namespace prefix if any */
-#ifdef LIBXML_REGEXP_ENABLED
-    xmlRegexpPtr       contModel;	/* the validating regexp */
-#else
-    void	      *contModel;
-#endif
-};
-
-
-/**
- * XML_LOCAL_NAMESPACE:
- *
- * A namespace declaration node.
- */
-#define XML_LOCAL_NAMESPACE XML_NAMESPACE_DECL
-typedef xmlElementType xmlNsType;
-
-/**
- * xmlNs:
- *
- * An XML namespace.
- * Note that prefix == NULL is valid, it defines the default namespace
- * within the subtree (until overridden).
- *
- * xmlNsType is unified with xmlElementType.
- */
-
-typedef struct _xmlNs xmlNs;
-typedef xmlNs *xmlNsPtr;
-struct _xmlNs {
-    struct _xmlNs  *next;	/* next Ns link for this node  */
-    xmlNsType      type;	/* global or local */
-    const xmlChar *href;	/* URL for the namespace */
-    const xmlChar *prefix;	/* prefix for the namespace */
-    void           *_private;   /* application data */
-    struct _xmlDoc *context;		/* normally an xmlDoc */
-};
-
-/**
- * xmlDtd:
- *
- * An XML DTD, as defined by <!DOCTYPE ... There is actually one for
- * the internal subset and for the external subset.
- */
-typedef struct _xmlDtd xmlDtd;
-typedef xmlDtd *xmlDtdPtr;
-struct _xmlDtd {
-    void           *_private;	/* application data */
-    xmlElementType  type;       /* XML_DTD_NODE, must be second ! */
-    const xmlChar *name;	/* Name of the DTD */
-    struct _xmlNode *children;	/* the value of the property link */
-    struct _xmlNode *last;	/* last child link */
-    struct _xmlDoc  *parent;	/* child->parent link */
-    struct _xmlNode *next;	/* next sibling link  */
-    struct _xmlNode *prev;	/* previous sibling link  */
-    struct _xmlDoc  *doc;	/* the containing document */
-
-    /* End of common part */
-    void          *notations;   /* Hash table for notations if any */
-    void          *elements;    /* Hash table for elements if any */
-    void          *attributes;  /* Hash table for attributes if any */
-    void          *entities;    /* Hash table for entities if any */
-    const xmlChar *ExternalID;	/* External identifier for PUBLIC DTD */
-    const xmlChar *SystemID;	/* URI for a SYSTEM or PUBLIC DTD */
-    void          *pentities;   /* Hash table for param entities if any */
-};
-
-/**
- * xmlAttr:
- *
- * An attribute on an XML node.
- */
-typedef struct _xmlAttr xmlAttr;
-typedef xmlAttr *xmlAttrPtr;
-struct _xmlAttr {
-    void           *_private;	/* application data */
-    xmlElementType   type;      /* XML_ATTRIBUTE_NODE, must be second ! */
-    const xmlChar   *name;      /* the name of the property */
-    struct _xmlNode *children;	/* the value of the property */
-    struct _xmlNode *last;	/* NULL */
-    struct _xmlNode *parent;	/* child->parent link */
-    struct _xmlAttr *next;	/* next sibling link  */
-    struct _xmlAttr *prev;	/* previous sibling link  */
-    struct _xmlDoc  *doc;	/* the containing document */
-    xmlNs           *ns;        /* pointer to the associated namespace */
-    xmlAttributeType atype;     /* the attribute type if validating */
-    void            *psvi;	/* for type/PSVI informations */
-};
-
-/**
- * xmlID:
- *
- * An XML ID instance.
- */
-
-typedef struct _xmlID xmlID;
-typedef xmlID *xmlIDPtr;
-struct _xmlID {
-    struct _xmlID    *next;	/* next ID */
-    const xmlChar    *value;	/* The ID name */
-    xmlAttrPtr        attr;	/* The attribute holding it */
-    const xmlChar    *name;	/* The attribute if attr is not available */
-    int               lineno;	/* The line number if attr is not available */
-    struct _xmlDoc   *doc;	/* The document holding the ID */
-};
-
-/**
- * xmlRef:
- *
- * An XML IDREF instance.
- */
-
-typedef struct _xmlRef xmlRef;
-typedef xmlRef *xmlRefPtr;
-struct _xmlRef {
-    struct _xmlRef    *next;	/* next Ref */
-    const xmlChar     *value;	/* The Ref name */
-    xmlAttrPtr        attr;	/* The attribute holding it */
-    const xmlChar    *name;	/* The attribute if attr is not available */
-    int               lineno;	/* The line number if attr is not available */
-};
-
-/**
- * xmlNode:
- *
- * A node in an XML tree.
- */
-typedef struct _xmlNode xmlNode;
-typedef xmlNode *xmlNodePtr;
-struct _xmlNode {
-    void           *_private;	/* application data */
-    xmlElementType   type;	/* type number, must be second ! */
-    const xmlChar   *name;      /* the name of the node, or the entity */
-    struct _xmlNode *children;	/* parent->childs link */
-    struct _xmlNode *last;	/* last child link */
-    struct _xmlNode *parent;	/* child->parent link */
-    struct _xmlNode *next;	/* next sibling link  */
-    struct _xmlNode *prev;	/* previous sibling link  */
-    struct _xmlDoc  *doc;	/* the containing document */
-
-    /* End of common part */
-    xmlNs           *ns;        /* pointer to the associated namespace */
-    xmlChar         *content;   /* the content */
-    struct _xmlAttr *properties;/* properties list */
-    xmlNs           *nsDef;     /* namespace definitions on this node */
-    void            *psvi;	/* for type/PSVI informations */
-    unsigned short   line;	/* line number */
-    unsigned short   extra;	/* extra data for XPath/XSLT */
-};
-
-/**
- * XML_GET_CONTENT:
- *
- * Macro to extract the content pointer of a node.
- */
-#define XML_GET_CONTENT(n)					\
-    ((n)->type == XML_ELEMENT_NODE ? NULL : (n)->content)
-
-/**
- * XML_GET_LINE:
- *
- * Macro to extract the line number of an element node. 
- */
-#define XML_GET_LINE(n)						\
-    (xmlGetLineNo(n))
-
-/**
- * xmlDocProperty
- *
- * Set of properties of the document as found by the parser
- * Some of them are linked to similary named xmlParserOption
- */
-typedef enum {
-    XML_DOC_WELLFORMED		= 1<<0, /* document is XML well formed */
-    XML_DOC_NSVALID		= 1<<1, /* document is Namespace valid */
-    XML_DOC_OLD10		= 1<<2, /* parsed with old XML-1.0 parser */
-    XML_DOC_DTDVALID		= 1<<3, /* DTD validation was successful */
-    XML_DOC_XINCLUDE		= 1<<4, /* XInclude substitution was done */
-    XML_DOC_USERBUILT		= 1<<5, /* Document was built using the API
-                                           and not by parsing an instance */
-    XML_DOC_INTERNAL		= 1<<6, /* built for internal processing */
-    XML_DOC_HTML		= 1<<7  /* parsed or built HTML document */
-} xmlDocProperties;
-
-/**
- * xmlDoc:
- *
- * An XML document.
- */
-typedef struct _xmlDoc xmlDoc;
-typedef xmlDoc *xmlDocPtr;
-struct _xmlDoc {
-    void           *_private;	/* application data */
-    xmlElementType  type;       /* XML_DOCUMENT_NODE, must be second ! */
-    char           *name;	/* name/filename/URI of the document */
-    struct _xmlNode *children;	/* the document tree */
-    struct _xmlNode *last;	/* last child link */
-    struct _xmlNode *parent;	/* child->parent link */
-    struct _xmlNode *next;	/* next sibling link  */
-    struct _xmlNode *prev;	/* previous sibling link  */
-    struct _xmlDoc  *doc;	/* autoreference to itself */
-
-    /* End of common part */
-    int             compression;/* level of zlib compression */
-    int             standalone; /* standalone document (no external refs) 
-				     1 if standalone="yes"
-				     0 if standalone="no"
-				    -1 if there is no XML declaration
-				    -2 if there is an XML declaration, but no
-					standalone attribute was specified */
-    struct _xmlDtd  *intSubset;	/* the document internal subset */
-    struct _xmlDtd  *extSubset;	/* the document external subset */
-    struct _xmlNs   *oldNs;	/* Global namespace, the old way */
-    const xmlChar  *version;	/* the XML version string */
-    const xmlChar  *encoding;   /* external initial encoding, if any */
-    void           *ids;        /* Hash table for ID attributes if any */
-    void           *refs;       /* Hash table for IDREFs attributes if any */
-    const xmlChar  *URL;	/* The URI for that document */
-    int             charset;    /* encoding of the in-memory content
-				   actually an xmlCharEncoding */
-    struct _xmlDict *dict;      /* dict used to allocate names or NULL */
-    void           *psvi;	/* for type/PSVI informations */
-    int             parseFlags;	/* set of xmlParserOption used to parse the
-				   document */
-    int             properties;	/* set of xmlDocProperties for this document
-				   set at the end of parsing */
-};
-
-
-typedef struct _xmlDOMWrapCtxt xmlDOMWrapCtxt;
-typedef xmlDOMWrapCtxt *xmlDOMWrapCtxtPtr;
-
-/**
- * xmlDOMWrapAcquireNsFunction:
- * @ctxt:  a DOM wrapper context
- * @node:  the context node (element or attribute) 
- * @nsName:  the requested namespace name
- * @nsPrefix:  the requested namespace prefix 
- *
- * A function called to acquire namespaces (xmlNs) from the wrapper.
- *
- * Returns an xmlNsPtr or NULL in case of an error.
- */
-typedef xmlNsPtr (*xmlDOMWrapAcquireNsFunction) (xmlDOMWrapCtxtPtr ctxt,
-						 xmlNodePtr node,
-						 const xmlChar *nsName,
-						 const xmlChar *nsPrefix);
-
-/**
- * xmlDOMWrapCtxt:
- *
- * Context for DOM wrapper-operations.
- */
-struct _xmlDOMWrapCtxt {
-    void * _private;
-    /*
-    * The type of this context, just in case we need specialized
-    * contexts in the future.
-    */
-    int type;
-    /*
-    * Internal namespace map used for various operations.
-    */
-    void * namespaceMap;
-    /*
-    * Use this one to acquire an xmlNsPtr intended for node->ns.
-    * (Note that this is not intended for elem->nsDef).
-    */
-    xmlDOMWrapAcquireNsFunction getNsForNodeFunc;
-};
-
-/**
- * xmlChildrenNode:
- *
- * Macro for compatibility naming layer with libxml1. Maps
- * to "children."
- */
-#ifndef xmlChildrenNode
-#define xmlChildrenNode children
-#endif
-
-/**
- * xmlRootNode:
- *
- * Macro for compatibility naming layer with libxml1. Maps 
- * to "children".
- */
-#ifndef xmlRootNode
-#define xmlRootNode children
-#endif
-
-/*
- * Variables.
- */
-
-/*
- * Some helper functions
- */
-#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED)
-XMLPUBFUN int XMLCALL
-		xmlValidateNCName	(const xmlChar *value,
-					 int space);
-#endif
-
-#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
-XMLPUBFUN int XMLCALL		
-		xmlValidateQName	(const xmlChar *value,
-					 int space);
-XMLPUBFUN int XMLCALL		
-		xmlValidateName		(const xmlChar *value,
-					 int space);
-XMLPUBFUN int XMLCALL		
-		xmlValidateNMToken	(const xmlChar *value,
-					 int space);
-#endif
-
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlBuildQName		(const xmlChar *ncname,
-					 const xmlChar *prefix,
-					 xmlChar *memory,
-					 int len);
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlSplitQName2		(const xmlChar *name,
-					 xmlChar **prefix);
-XMLPUBFUN const xmlChar * XMLCALL	
-		xmlSplitQName3		(const xmlChar *name,
-					 int *len);
-
-/*
- * Handling Buffers.
- */
-
-XMLPUBFUN void XMLCALL		
-		xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme);
-XMLPUBFUN xmlBufferAllocationScheme XMLCALL	 
-		xmlGetBufferAllocationScheme(void);
-
-XMLPUBFUN xmlBufferPtr XMLCALL	
-		xmlBufferCreate		(void);
-XMLPUBFUN xmlBufferPtr XMLCALL	
-		xmlBufferCreateSize	(size_t size);
-XMLPUBFUN xmlBufferPtr XMLCALL	
-		xmlBufferCreateStatic	(void *mem,
-					 size_t size);
-XMLPUBFUN int XMLCALL		
-		xmlBufferResize		(xmlBufferPtr buf,
-					 unsigned int size);
-XMLPUBFUN void XMLCALL		
-		xmlBufferFree		(xmlBufferPtr buf);
-XMLPUBFUN int XMLCALL		
-		xmlBufferDump		(FILE *file,
-					 xmlBufferPtr buf);
-XMLPUBFUN int XMLCALL		
-		xmlBufferAdd		(xmlBufferPtr buf,
-					 const xmlChar *str,
-					 int len);
-XMLPUBFUN int XMLCALL		
-		xmlBufferAddHead	(xmlBufferPtr buf,
-					 const xmlChar *str,
-					 int len);
-XMLPUBFUN int XMLCALL		
-		xmlBufferCat		(xmlBufferPtr buf,
-					 const xmlChar *str);
-XMLPUBFUN int XMLCALL	
-		xmlBufferCCat		(xmlBufferPtr buf,
-					 const char *str);
-XMLPUBFUN int XMLCALL		
-		xmlBufferShrink		(xmlBufferPtr buf,
-					 unsigned int len);
-XMLPUBFUN int XMLCALL		
-		xmlBufferGrow		(xmlBufferPtr buf,
-					 unsigned int len);
-XMLPUBFUN void XMLCALL		
-		xmlBufferEmpty		(xmlBufferPtr buf);
-XMLPUBFUN const xmlChar* XMLCALL	
-		xmlBufferContent	(const xmlBufferPtr buf);
-XMLPUBFUN void XMLCALL		
-		xmlBufferSetAllocationScheme(xmlBufferPtr buf,
-					 xmlBufferAllocationScheme scheme);
-XMLPUBFUN int XMLCALL		
-		xmlBufferLength		(const xmlBufferPtr buf);
-
-/*
- * Creating/freeing new structures.
- */
-XMLPUBFUN xmlDtdPtr XMLCALL	
-		xmlCreateIntSubset	(xmlDocPtr doc,
-					 const xmlChar *name,
-					 const xmlChar *ExternalID,
-					 const xmlChar *SystemID);
-XMLPUBFUN xmlDtdPtr XMLCALL	
-		xmlNewDtd		(xmlDocPtr doc,
-					 const xmlChar *name,
-					 const xmlChar *ExternalID,
-					 const xmlChar *SystemID);
-XMLPUBFUN xmlDtdPtr XMLCALL	
-		xmlGetIntSubset		(xmlDocPtr doc);
-XMLPUBFUN void XMLCALL		
-		xmlFreeDtd		(xmlDtdPtr cur);
-#ifdef LIBXML_LEGACY_ENABLED
-XMLPUBFUN xmlNsPtr XMLCALL	
-		xmlNewGlobalNs		(xmlDocPtr doc,
-					 const xmlChar *href,
-					 const xmlChar *prefix);
-#endif /* LIBXML_LEGACY_ENABLED */
-XMLPUBFUN xmlNsPtr XMLCALL	
-		xmlNewNs		(xmlNodePtr node,
-					 const xmlChar *href,
-					 const xmlChar *prefix);
-XMLPUBFUN void XMLCALL		
-		xmlFreeNs		(xmlNsPtr cur);
-XMLPUBFUN void XMLCALL		
-		xmlFreeNsList		(xmlNsPtr cur);
-XMLPUBFUN xmlDocPtr XMLCALL 	
-		xmlNewDoc		(const xmlChar *version);
-XMLPUBFUN void XMLCALL		
-		xmlFreeDoc		(xmlDocPtr cur);
-XMLPUBFUN xmlAttrPtr XMLCALL	
-		xmlNewDocProp		(xmlDocPtr doc,
-					 const xmlChar *name,
-					 const xmlChar *value);
-#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \
-    defined(LIBXML_SCHEMAS_ENABLED)
-XMLPUBFUN xmlAttrPtr XMLCALL	
-		xmlNewProp		(xmlNodePtr node,
-					 const xmlChar *name,
-					 const xmlChar *value);
-#endif
-XMLPUBFUN xmlAttrPtr XMLCALL	
-		xmlNewNsProp		(xmlNodePtr node,
-					 xmlNsPtr ns,
-					 const xmlChar *name,
-					 const xmlChar *value);
-XMLPUBFUN xmlAttrPtr XMLCALL	
-		xmlNewNsPropEatName	(xmlNodePtr node,
-					 xmlNsPtr ns,
-					 xmlChar *name,
-					 const xmlChar *value);
-XMLPUBFUN void XMLCALL		
-		xmlFreePropList		(xmlAttrPtr cur);
-XMLPUBFUN void XMLCALL		
-		xmlFreeProp		(xmlAttrPtr cur);
-XMLPUBFUN xmlAttrPtr XMLCALL	
-		xmlCopyProp		(xmlNodePtr target,
-					 xmlAttrPtr cur);
-XMLPUBFUN xmlAttrPtr XMLCALL	
-		xmlCopyPropList		(xmlNodePtr target,
-					 xmlAttrPtr cur);
-#ifdef LIBXML_TREE_ENABLED
-XMLPUBFUN xmlDtdPtr XMLCALL	
-		xmlCopyDtd		(xmlDtdPtr dtd);
-#endif /* LIBXML_TREE_ENABLED */
-#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
-XMLPUBFUN xmlDocPtr XMLCALL	
-		xmlCopyDoc		(xmlDocPtr doc,
-					 int recursive);
-#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */
-/*
- * Creating new nodes.
- */
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlNewDocNode		(xmlDocPtr doc,
-					 xmlNsPtr ns,
-					 const xmlChar *name,
-					 const xmlChar *content);
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlNewDocNodeEatName	(xmlDocPtr doc,
-					 xmlNsPtr ns,
-					 xmlChar *name,
-					 const xmlChar *content);
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlNewNode		(xmlNsPtr ns,
-					 const xmlChar *name);
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlNewNodeEatName	(xmlNsPtr ns,
-					 xmlChar *name);
-#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlNewChild		(xmlNodePtr parent,
-					 xmlNsPtr ns,
-					 const xmlChar *name,
-					 const xmlChar *content);
-#endif
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlNewDocText		(xmlDocPtr doc,
-					 const xmlChar *content);
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlNewText		(const xmlChar *content);
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlNewDocPI		(xmlDocPtr doc,
-					 const xmlChar *name,
-					 const xmlChar *content);
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlNewPI		(const xmlChar *name,
-					 const xmlChar *content);
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlNewDocTextLen	(xmlDocPtr doc,
-					 const xmlChar *content,
-					 int len);
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlNewTextLen		(const xmlChar *content,
-					 int len);
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlNewDocComment	(xmlDocPtr doc,
-					 const xmlChar *content);
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlNewComment		(const xmlChar *content);
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlNewCDataBlock	(xmlDocPtr doc,
-					 const xmlChar *content,
-					 int len);
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlNewCharRef		(xmlDocPtr doc,
-					 const xmlChar *name);
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlNewReference		(xmlDocPtr doc,
-					 const xmlChar *name);
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlCopyNode		(const xmlNodePtr node,
-					 int recursive);
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlDocCopyNode		(const xmlNodePtr node,
-					 xmlDocPtr doc,
-					 int recursive);
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlDocCopyNodeList	(xmlDocPtr doc,
-					 const xmlNodePtr node);
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlCopyNodeList		(const xmlNodePtr node);
-#ifdef LIBXML_TREE_ENABLED
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlNewTextChild		(xmlNodePtr parent,
-					 xmlNsPtr ns,
-					 const xmlChar *name,
-					 const xmlChar *content);
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlNewDocRawNode	(xmlDocPtr doc,
-					 xmlNsPtr ns,
-					 const xmlChar *name,
-					 const xmlChar *content);
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlNewDocFragment	(xmlDocPtr doc);
-#endif /* LIBXML_TREE_ENABLED */
-
-/*
- * Navigating.
- */
-XMLPUBFUN long XMLCALL		
-		xmlGetLineNo		(xmlNodePtr node);
-#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlGetNodePath		(xmlNodePtr node);
-#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) */
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlDocGetRootElement	(xmlDocPtr doc);
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlGetLastChild		(xmlNodePtr parent);
-XMLPUBFUN int XMLCALL		
-		xmlNodeIsText		(xmlNodePtr node);
-XMLPUBFUN int XMLCALL		
-		xmlIsBlankNode		(xmlNodePtr node);
-
-/*
- * Changing the structure.
- */
-#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlDocSetRootElement	(xmlDocPtr doc,
-					 xmlNodePtr root);
-#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */
-#ifdef LIBXML_TREE_ENABLED
-XMLPUBFUN void XMLCALL		
-		xmlNodeSetName		(xmlNodePtr cur,
-					 const xmlChar *name);
-#endif /* LIBXML_TREE_ENABLED */
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlAddChild		(xmlNodePtr parent,
-					 xmlNodePtr cur);
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlAddChildList		(xmlNodePtr parent,
-					 xmlNodePtr cur);
-#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlReplaceNode		(xmlNodePtr old,
-					 xmlNodePtr cur);
-#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */
-#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \
-    defined(LIBXML_SCHEMAS_ENABLED)
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlAddPrevSibling	(xmlNodePtr cur,
-					 xmlNodePtr elem);
-#endif /* LIBXML_TREE_ENABLED || LIBXML_HTML_ENABLED || LIBXML_SCHEMAS_ENABLED */
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlAddSibling		(xmlNodePtr cur,
-					 xmlNodePtr elem);
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlAddNextSibling	(xmlNodePtr cur,
-					 xmlNodePtr elem);
-XMLPUBFUN void XMLCALL		
-		xmlUnlinkNode		(xmlNodePtr cur);
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlTextMerge		(xmlNodePtr first,
-					 xmlNodePtr second);
-XMLPUBFUN int XMLCALL		
-		xmlTextConcat		(xmlNodePtr node,
-					 const xmlChar *content,
-					 int len);
-XMLPUBFUN void XMLCALL		
-		xmlFreeNodeList		(xmlNodePtr cur);
-XMLPUBFUN void XMLCALL		
-		xmlFreeNode		(xmlNodePtr cur);
-XMLPUBFUN void XMLCALL		
-		xmlSetTreeDoc		(xmlNodePtr tree,
-					 xmlDocPtr doc);
-XMLPUBFUN void XMLCALL		
-		xmlSetListDoc		(xmlNodePtr list,
-					 xmlDocPtr doc);
-/*
- * Namespaces.
- */
-XMLPUBFUN xmlNsPtr XMLCALL	
-		xmlSearchNs		(xmlDocPtr doc,
-					 xmlNodePtr node,
-					 const xmlChar *nameSpace);
-XMLPUBFUN xmlNsPtr XMLCALL	
-		xmlSearchNsByHref	(xmlDocPtr doc,
-					 xmlNodePtr node,
-					 const xmlChar *href);
-#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
-XMLPUBFUN xmlNsPtr * XMLCALL	
-		xmlGetNsList		(xmlDocPtr doc,
-					 xmlNodePtr node);
-#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) */
-
-XMLPUBFUN void XMLCALL		
-		xmlSetNs		(xmlNodePtr node,
-					 xmlNsPtr ns);
-XMLPUBFUN xmlNsPtr XMLCALL	
-		xmlCopyNamespace	(xmlNsPtr cur);
-XMLPUBFUN xmlNsPtr XMLCALL	
-		xmlCopyNamespaceList	(xmlNsPtr cur);
-
-/*
- * Changing the content.
- */
-#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
-XMLPUBFUN xmlAttrPtr XMLCALL	
-		xmlSetProp		(xmlNodePtr node,
-					 const xmlChar *name,
-					 const xmlChar *value);
-XMLPUBFUN xmlAttrPtr XMLCALL	
-		xmlSetNsProp		(xmlNodePtr node,
-					 xmlNsPtr ns,
-					 const xmlChar *name,
-					 const xmlChar *value);
-#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) */
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlGetNoNsProp		(xmlNodePtr node,
-					 const xmlChar *name);
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlGetProp		(xmlNodePtr node,
-					 const xmlChar *name);
-XMLPUBFUN xmlAttrPtr XMLCALL	
-		xmlHasProp		(xmlNodePtr node,
-					 const xmlChar *name);
-XMLPUBFUN xmlAttrPtr XMLCALL	
-		xmlHasNsProp		(xmlNodePtr node,
-					 const xmlChar *name,
-					 const xmlChar *nameSpace);
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlGetNsProp		(xmlNodePtr node,
-					 const xmlChar *name,
-					 const xmlChar *nameSpace);
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlStringGetNodeList	(xmlDocPtr doc,
-					 const xmlChar *value);
-XMLPUBFUN xmlNodePtr XMLCALL	
-		xmlStringLenGetNodeList	(xmlDocPtr doc,
-					 const xmlChar *value,
-					 int len);
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlNodeListGetString	(xmlDocPtr doc,
-					 xmlNodePtr list,
-					 int inLine);
-#ifdef LIBXML_TREE_ENABLED
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlNodeListGetRawString	(xmlDocPtr doc,
-					 xmlNodePtr list,
-					 int inLine);
-#endif /* LIBXML_TREE_ENABLED */
-XMLPUBFUN void XMLCALL		
-		xmlNodeSetContent	(xmlNodePtr cur,
-					 const xmlChar *content);
-#ifdef LIBXML_TREE_ENABLED
-XMLPUBFUN void XMLCALL		
-		xmlNodeSetContentLen	(xmlNodePtr cur,
-					 const xmlChar *content,
-					 int len);
-#endif /* LIBXML_TREE_ENABLED */
-XMLPUBFUN void XMLCALL		
-		xmlNodeAddContent	(xmlNodePtr cur,
-					 const xmlChar *content);
-XMLPUBFUN void XMLCALL		
-		xmlNodeAddContentLen	(xmlNodePtr cur,
-					 const xmlChar *content,
-					 int len);
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlNodeGetContent	(xmlNodePtr cur);
-XMLPUBFUN int XMLCALL
-		xmlNodeBufGetContent	(xmlBufferPtr buffer,
-					 xmlNodePtr cur);
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlNodeGetLang		(xmlNodePtr cur);
-XMLPUBFUN int XMLCALL		
-		xmlNodeGetSpacePreserve	(xmlNodePtr cur);
-#ifdef LIBXML_TREE_ENABLED
-XMLPUBFUN void XMLCALL		
-		xmlNodeSetLang		(xmlNodePtr cur,
-					 const xmlChar *lang);
-XMLPUBFUN void XMLCALL		
-		xmlNodeSetSpacePreserve (xmlNodePtr cur,
-					 int val);
-#endif /* LIBXML_TREE_ENABLED */
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlNodeGetBase		(xmlDocPtr doc,
-					 xmlNodePtr cur);
-#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
-XMLPUBFUN void XMLCALL		
-		xmlNodeSetBase		(xmlNodePtr cur,
-					 const xmlChar *uri);
-#endif
-
-/*
- * Removing content.
- */
-XMLPUBFUN int XMLCALL		
-		xmlRemoveProp		(xmlAttrPtr cur);
-#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
-XMLPUBFUN int XMLCALL		
-		xmlUnsetNsProp		(xmlNodePtr node,
-					 xmlNsPtr ns,
-					 const xmlChar *name);
-XMLPUBFUN int XMLCALL		
-		xmlUnsetProp		(xmlNodePtr node,
-					 const xmlChar *name);
-#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */
-
-/*
- * Internal, don't use.
- */
-XMLPUBFUN void XMLCALL		
-		xmlBufferWriteCHAR	(xmlBufferPtr buf,
-					 const xmlChar *string);
-XMLPUBFUN void XMLCALL		
-		xmlBufferWriteChar	(xmlBufferPtr buf,
-					 const char *string);
-XMLPUBFUN void XMLCALL		
-		xmlBufferWriteQuotedString(xmlBufferPtr buf,
-					 const xmlChar *string);
-
-#ifdef LIBXML_OUTPUT_ENABLED
-XMLPUBFUN void xmlAttrSerializeTxtContent(xmlBufferPtr buf,
-					 xmlDocPtr doc,
-					 xmlAttrPtr attr,
-					 const xmlChar *string);
-#endif /* LIBXML_OUTPUT_ENABLED */
-
-#ifdef LIBXML_TREE_ENABLED
-/*
- * Namespace handling.
- */
-XMLPUBFUN int XMLCALL		
-		xmlReconciliateNs	(xmlDocPtr doc,
-					 xmlNodePtr tree);
-#endif
-
-#ifdef LIBXML_OUTPUT_ENABLED
-/*
- * Saving.
- */
-XMLPUBFUN void XMLCALL		
-		xmlDocDumpFormatMemory	(xmlDocPtr cur,
-					 xmlChar **mem,
-					 int *size,
-					 int format);
-XMLPUBFUN void XMLCALL		
-		xmlDocDumpMemory	(xmlDocPtr cur,
-					 xmlChar **mem,
-					 int *size);
-XMLPUBFUN void XMLCALL		
-		xmlDocDumpMemoryEnc	(xmlDocPtr out_doc,
-					 xmlChar **doc_txt_ptr,
-					 int * doc_txt_len,
-					 const char *txt_encoding);
-XMLPUBFUN void XMLCALL		
-		xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc,
-					 xmlChar **doc_txt_ptr,
-					 int * doc_txt_len,
-					 const char *txt_encoding,
-					 int format);
-XMLPUBFUN int XMLCALL		
-		xmlDocFormatDump	(FILE *f,
-					 xmlDocPtr cur,
-					 int format);
-XMLPUBFUN int XMLCALL	
-		xmlDocDump		(FILE *f,
-					 xmlDocPtr cur);
-XMLPUBFUN void XMLCALL		
-		xmlElemDump		(FILE *f,
-					 xmlDocPtr doc,
-					 xmlNodePtr cur);
-XMLPUBFUN int XMLCALL		
-		xmlSaveFile		(const char *filename,
-					 xmlDocPtr cur);
-XMLPUBFUN int XMLCALL		
-		xmlSaveFormatFile	(const char *filename,
-					 xmlDocPtr cur,
-					 int format);
-XMLPUBFUN int XMLCALL		
-		xmlNodeDump		(xmlBufferPtr buf,
-					 xmlDocPtr doc,
-					 xmlNodePtr cur,
-					 int level,
-					 int format);
-
-XMLPUBFUN int XMLCALL		
-		xmlSaveFileTo		(xmlOutputBufferPtr buf,
-					 xmlDocPtr cur,
-					 const char *encoding);
-XMLPUBFUN int XMLCALL             
-		xmlSaveFormatFileTo     (xmlOutputBufferPtr buf,
-					 xmlDocPtr cur,
-				         const char *encoding,
-				         int format);
-XMLPUBFUN void XMLCALL		
-		xmlNodeDumpOutput	(xmlOutputBufferPtr buf,
-					 xmlDocPtr doc,
-					 xmlNodePtr cur,
-					 int level,
-					 int format,
-					 const char *encoding);
-
-XMLPUBFUN int XMLCALL		
-		xmlSaveFormatFileEnc    (const char *filename,
-					 xmlDocPtr cur,
-					 const char *encoding,
-					 int format);
-
-XMLPUBFUN int XMLCALL		
-		xmlSaveFileEnc		(const char *filename,
-					 xmlDocPtr cur,
-					 const char *encoding);
-
-#endif /* LIBXML_OUTPUT_ENABLED */
-/*
- * XHTML
- */
-XMLPUBFUN int XMLCALL		
-		xmlIsXHTML		(const xmlChar *systemID,
-					 const xmlChar *publicID);
-
-/*
- * Compression.
- */
-XMLPUBFUN int XMLCALL		
-		xmlGetDocCompressMode	(xmlDocPtr doc);
-XMLPUBFUN void XMLCALL		
-		xmlSetDocCompressMode	(xmlDocPtr doc,
-					 int mode);
-XMLPUBFUN int XMLCALL		
-		xmlGetCompressMode	(void);
-XMLPUBFUN void XMLCALL		
-		xmlSetCompressMode	(int mode);
-
-/*
-* DOM-wrapper helper functions.
-*/
-XMLPUBFUN xmlDOMWrapCtxtPtr XMLCALL
-		xmlDOMWrapNewCtxt	(void);
-XMLPUBFUN void XMLCALL
-		xmlDOMWrapFreeCtxt	(xmlDOMWrapCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL
-	    xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt,
-					 xmlNodePtr elem,
-					 int options);
-XMLPUBFUN int XMLCALL
-	    xmlDOMWrapAdoptNode		(xmlDOMWrapCtxtPtr ctxt,
-					 xmlDocPtr sourceDoc,
-					 xmlNodePtr node,
-					 xmlDocPtr destDoc,		    
-					 xmlNodePtr destParent,
-					 int options);
-XMLPUBFUN int XMLCALL
-	    xmlDOMWrapRemoveNode	(xmlDOMWrapCtxtPtr ctxt,
-					 xmlDocPtr doc,
-					 xmlNodePtr node,
-					 int options);
-XMLPUBFUN int XMLCALL
-	    xmlDOMWrapCloneNode		(xmlDOMWrapCtxtPtr ctxt,
-					 xmlDocPtr sourceDoc,
-					 xmlNodePtr node,
-					 xmlNodePtr *clonedNode,
-					 xmlDocPtr destDoc,
-					 xmlNodePtr destParent,
-					 int deep,
-					 int options);
-
-#ifdef LIBXML_TREE_ENABLED
-/*
- * 5 interfaces from DOM ElementTraversal, but different in entities
- * traversal.
- */
-XMLPUBFUN unsigned long XMLCALL
-            xmlChildElementCount        (xmlNodePtr parent);
-XMLPUBFUN xmlNodePtr XMLCALL
-            xmlNextElementSibling       (xmlNodePtr node);
-XMLPUBFUN xmlNodePtr XMLCALL
-            xmlFirstElementChild        (xmlNodePtr parent);
-XMLPUBFUN xmlNodePtr XMLCALL
-            xmlLastElementChild         (xmlNodePtr parent);
-XMLPUBFUN xmlNodePtr XMLCALL
-            xmlPreviousElementSibling   (xmlNodePtr node);
-#endif
-#ifdef __cplusplus
-}
-#endif
-#ifndef __XML_PARSER_H__
-#include <libxml/xmlmemory.h>
-#endif
-
-#endif /* __XML_TREE_H__ */
-
diff --git a/interfaces/ext/libxml/uri.h b/interfaces/ext/libxml/uri.h
deleted file mode 100644
index db48262..0000000
--- a/interfaces/ext/libxml/uri.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * Summary: library of generic URI related routines
- * Description: library of generic URI related routines
- *              Implements RFC 2396
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#ifndef __XML_URI_H__
-#define __XML_URI_H__
-
-#include <libxml/xmlversion.h>
-#include <libxml/tree.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * xmlURI:
- *
- * A parsed URI reference. This is a struct containing the various fields
- * as described in RFC 2396 but separated for further processing.
- *
- * Note: query is a deprecated field which is incorrectly unescaped.
- * query_raw takes precedence over query if the former is set.
- * See: http://mail.gnome.org/archives/xml/2007-April/thread.html#00127
- */
-typedef struct _xmlURI xmlURI;
-typedef xmlURI *xmlURIPtr;
-struct _xmlURI {
-    char *scheme;	/* the URI scheme */
-    char *opaque;	/* opaque part */
-    char *authority;	/* the authority part */
-    char *server;	/* the server part */
-    char *user;		/* the user part */
-    int port;		/* the port number */
-    char *path;		/* the path string */
-    char *query;	/* the query string (deprecated - use with caution) */
-    char *fragment;	/* the fragment identifier */
-    int  cleanup;	/* parsing potentially unclean URI */
-    char *query_raw;	/* the query string (as it appears in the URI) */
-};
-
-/*
- * This function is in tree.h:
- * xmlChar *	xmlNodeGetBase	(xmlDocPtr doc,
- *                               xmlNodePtr cur);
- */
-XMLPUBFUN xmlURIPtr XMLCALL
-		xmlCreateURI		(void);
-XMLPUBFUN xmlChar * XMLCALL
-		xmlBuildURI		(const xmlChar *URI,
-					 const xmlChar *base);
-XMLPUBFUN xmlChar * XMLCALL
-		xmlBuildRelativeURI	(const xmlChar *URI,
-					 const xmlChar *base);
-XMLPUBFUN xmlURIPtr XMLCALL
-		xmlParseURI		(const char *str);
-XMLPUBFUN xmlURIPtr XMLCALL
-		xmlParseURIRaw		(const char *str,
-					 int raw);
-XMLPUBFUN int XMLCALL
-		xmlParseURIReference	(xmlURIPtr uri,
-					 const char *str);
-XMLPUBFUN xmlChar * XMLCALL
-		xmlSaveUri		(xmlURIPtr uri);
-XMLPUBFUN void XMLCALL
-		xmlPrintURI		(FILE *stream,
-					 xmlURIPtr uri);
-XMLPUBFUN xmlChar * XMLCALL
-		xmlURIEscapeStr         (const xmlChar *str,
-					 const xmlChar *list);
-XMLPUBFUN char * XMLCALL
-		xmlURIUnescapeString	(const char *str,
-					 int len,
-					 char *target);
-XMLPUBFUN int XMLCALL
-		xmlNormalizeURIPath	(char *path);
-XMLPUBFUN xmlChar * XMLCALL
-		xmlURIEscape		(const xmlChar *str);
-XMLPUBFUN void XMLCALL
-		xmlFreeURI		(xmlURIPtr uri);
-XMLPUBFUN xmlChar* XMLCALL
-		xmlCanonicPath		(const xmlChar *path);
-XMLPUBFUN xmlChar* XMLCALL
-		xmlPathToURI		(const xmlChar *path);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __XML_URI_H__ */
diff --git a/interfaces/ext/libxml/valid.h b/interfaces/ext/libxml/valid.h
deleted file mode 100644
index f1892b0..0000000
--- a/interfaces/ext/libxml/valid.h
+++ /dev/null
@@ -1,458 +0,0 @@
-/*
- * Summary: The DTD validation
- * Description: API for the DTD handling and the validity checking
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-
-#ifndef __XML_VALID_H__
-#define __XML_VALID_H__
-
-#include <libxml/xmlversion.h>
-#include <libxml/xmlerror.h>
-#include <libxml/tree.h>
-#include <libxml/list.h>
-#include <libxml/xmlautomata.h>
-#include <libxml/xmlregexp.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Validation state added for non-determinist content model.
- */
-typedef struct _xmlValidState xmlValidState;
-typedef xmlValidState *xmlValidStatePtr;
-
-/**
- * xmlValidityErrorFunc:
- * @ctx:  usually an xmlValidCtxtPtr to a validity error context,
- *        but comes from ctxt->userData (which normally contains such
- *        a pointer); ctxt->userData can be changed by the user.
- * @msg:  the string to format *printf like vararg
- * @...:  remaining arguments to the format
- *
- * Callback called when a validity error is found. This is a message
- * oriented function similar to an *printf function.
- */
-typedef void (XMLCDECL *xmlValidityErrorFunc) (void *ctx,
-			     const char *msg,
-			     ...) ATTRIBUTE_PRINTF(2,3);
-
-/**
- * xmlValidityWarningFunc:
- * @ctx:  usually an xmlValidCtxtPtr to a validity error context,
- *        but comes from ctxt->userData (which normally contains such
- *        a pointer); ctxt->userData can be changed by the user.
- * @msg:  the string to format *printf like vararg
- * @...:  remaining arguments to the format
- *
- * Callback called when a validity warning is found. This is a message
- * oriented function similar to an *printf function.
- */
-typedef void (XMLCDECL *xmlValidityWarningFunc) (void *ctx,
-			       const char *msg,
-			       ...) ATTRIBUTE_PRINTF(2,3);
-
-#ifdef IN_LIBXML
-/**
- * XML_CTXT_FINISH_DTD_0:
- *
- * Special value for finishDtd field when embedded in an xmlParserCtxt
- */
-#define XML_CTXT_FINISH_DTD_0 0xabcd1234
-/**
- * XML_CTXT_FINISH_DTD_1:
- *
- * Special value for finishDtd field when embedded in an xmlParserCtxt
- */
-#define XML_CTXT_FINISH_DTD_1 0xabcd1235
-#endif
-
-/*
- * xmlValidCtxt:
- * An xmlValidCtxt is used for error reporting when validating.
- */
-typedef struct _xmlValidCtxt xmlValidCtxt;
-typedef xmlValidCtxt *xmlValidCtxtPtr;
-struct _xmlValidCtxt {
-    void *userData;			/* user specific data block */
-    xmlValidityErrorFunc error;		/* the callback in case of errors */
-    xmlValidityWarningFunc warning;	/* the callback in case of warning */
-
-    /* Node analysis stack used when validating within entities */
-    xmlNodePtr         node;          /* Current parsed Node */
-    int                nodeNr;        /* Depth of the parsing stack */
-    int                nodeMax;       /* Max depth of the parsing stack */
-    xmlNodePtr        *nodeTab;       /* array of nodes */
-
-    unsigned int     finishDtd;       /* finished validating the Dtd ? */
-    xmlDocPtr              doc;       /* the document */
-    int                  valid;       /* temporary validity check result */
-
-    /* state state used for non-determinist content validation */
-    xmlValidState     *vstate;        /* current state */
-    int                vstateNr;      /* Depth of the validation stack */
-    int                vstateMax;     /* Max depth of the validation stack */
-    xmlValidState     *vstateTab;     /* array of validation states */
-
-#ifdef LIBXML_REGEXP_ENABLED
-    xmlAutomataPtr            am;     /* the automata */
-    xmlAutomataStatePtr    state;     /* used to build the automata */
-#else
-    void                     *am;
-    void                  *state;
-#endif
-};
-
-/*
- * ALL notation declarations are stored in a table.
- * There is one table per DTD.
- */
-
-typedef struct _xmlHashTable xmlNotationTable;
-typedef xmlNotationTable *xmlNotationTablePtr;
-
-/*
- * ALL element declarations are stored in a table.
- * There is one table per DTD.
- */
-
-typedef struct _xmlHashTable xmlElementTable;
-typedef xmlElementTable *xmlElementTablePtr;
-
-/*
- * ALL attribute declarations are stored in a table.
- * There is one table per DTD.
- */
-
-typedef struct _xmlHashTable xmlAttributeTable;
-typedef xmlAttributeTable *xmlAttributeTablePtr;
-
-/*
- * ALL IDs attributes are stored in a table.
- * There is one table per document.
- */
-
-typedef struct _xmlHashTable xmlIDTable;
-typedef xmlIDTable *xmlIDTablePtr;
-
-/*
- * ALL Refs attributes are stored in a table.
- * There is one table per document.
- */
-
-typedef struct _xmlHashTable xmlRefTable;
-typedef xmlRefTable *xmlRefTablePtr;
-
-/* Notation */
-XMLPUBFUN xmlNotationPtr XMLCALL	    
-		xmlAddNotationDecl	(xmlValidCtxtPtr ctxt,
-					 xmlDtdPtr dtd,
-					 const xmlChar *name,
-					 const xmlChar *PublicID,
-					 const xmlChar *SystemID);
-#ifdef LIBXML_TREE_ENABLED
-XMLPUBFUN xmlNotationTablePtr XMLCALL 
-		xmlCopyNotationTable	(xmlNotationTablePtr table);
-#endif /* LIBXML_TREE_ENABLED */
-XMLPUBFUN void XMLCALL		    
-		xmlFreeNotationTable	(xmlNotationTablePtr table);
-#ifdef LIBXML_OUTPUT_ENABLED
-XMLPUBFUN void XMLCALL		    
-		xmlDumpNotationDecl	(xmlBufferPtr buf,
-					 xmlNotationPtr nota);
-XMLPUBFUN void XMLCALL		    
-		xmlDumpNotationTable	(xmlBufferPtr buf,
-					 xmlNotationTablePtr table);
-#endif /* LIBXML_OUTPUT_ENABLED */
-
-/* Element Content */
-/* the non Doc version are being deprecated */
-XMLPUBFUN xmlElementContentPtr XMLCALL 
-		xmlNewElementContent	(const xmlChar *name,
-					 xmlElementContentType type);
-XMLPUBFUN xmlElementContentPtr XMLCALL 
-		xmlCopyElementContent	(xmlElementContentPtr content);
-XMLPUBFUN void XMLCALL		     
-		xmlFreeElementContent	(xmlElementContentPtr cur);
-/* the new versions with doc argument */
-XMLPUBFUN xmlElementContentPtr XMLCALL 
-		xmlNewDocElementContent	(xmlDocPtr doc,
-					 const xmlChar *name,
-					 xmlElementContentType type);
-XMLPUBFUN xmlElementContentPtr XMLCALL 
-		xmlCopyDocElementContent(xmlDocPtr doc,
-					 xmlElementContentPtr content);
-XMLPUBFUN void XMLCALL		     
-		xmlFreeDocElementContent(xmlDocPtr doc,
-					 xmlElementContentPtr cur);
-XMLPUBFUN void XMLCALL		     
-		xmlSnprintfElementContent(char *buf,
-					 int size,
-	                                 xmlElementContentPtr content,
-					 int englob);
-#ifdef LIBXML_OUTPUT_ENABLED
-/* DEPRECATED */
-XMLPUBFUN void XMLCALL		     
-		xmlSprintfElementContent(char *buf,
-	                                 xmlElementContentPtr content,
-					 int englob);
-#endif /* LIBXML_OUTPUT_ENABLED */
-/* DEPRECATED */
-
-/* Element */
-XMLPUBFUN xmlElementPtr XMLCALL	   
-		xmlAddElementDecl	(xmlValidCtxtPtr ctxt,
-					 xmlDtdPtr dtd,
-					 const xmlChar *name,
-					 xmlElementTypeVal type,
-					 xmlElementContentPtr content);
-#ifdef LIBXML_TREE_ENABLED
-XMLPUBFUN xmlElementTablePtr XMLCALL 
-		xmlCopyElementTable	(xmlElementTablePtr table);
-#endif /* LIBXML_TREE_ENABLED */
-XMLPUBFUN void XMLCALL		   
-		xmlFreeElementTable	(xmlElementTablePtr table);
-#ifdef LIBXML_OUTPUT_ENABLED
-XMLPUBFUN void XMLCALL		   
-		xmlDumpElementTable	(xmlBufferPtr buf,
-					 xmlElementTablePtr table);
-XMLPUBFUN void XMLCALL		   
-		xmlDumpElementDecl	(xmlBufferPtr buf,
-					 xmlElementPtr elem);
-#endif /* LIBXML_OUTPUT_ENABLED */
-
-/* Enumeration */
-XMLPUBFUN xmlEnumerationPtr XMLCALL 
-		xmlCreateEnumeration	(const xmlChar *name);
-XMLPUBFUN void XMLCALL		   
-		xmlFreeEnumeration	(xmlEnumerationPtr cur);
-#ifdef LIBXML_TREE_ENABLED
-XMLPUBFUN xmlEnumerationPtr XMLCALL  
-		xmlCopyEnumeration	(xmlEnumerationPtr cur);
-#endif /* LIBXML_TREE_ENABLED */
-
-/* Attribute */
-XMLPUBFUN xmlAttributePtr XMLCALL	    
-		xmlAddAttributeDecl	(xmlValidCtxtPtr ctxt,
-					 xmlDtdPtr dtd,
-					 const xmlChar *elem,
-					 const xmlChar *name,
-					 const xmlChar *ns,
-					 xmlAttributeType type,
-					 xmlAttributeDefault def,
-					 const xmlChar *defaultValue,
-					 xmlEnumerationPtr tree);
-#ifdef LIBXML_TREE_ENABLED
-XMLPUBFUN xmlAttributeTablePtr XMLCALL 
-		xmlCopyAttributeTable  (xmlAttributeTablePtr table);
-#endif /* LIBXML_TREE_ENABLED */
-XMLPUBFUN void XMLCALL		     
-		xmlFreeAttributeTable  (xmlAttributeTablePtr table);
-#ifdef LIBXML_OUTPUT_ENABLED
-XMLPUBFUN void XMLCALL		     
-		xmlDumpAttributeTable  (xmlBufferPtr buf,
-					xmlAttributeTablePtr table);
-XMLPUBFUN void XMLCALL		     
-		xmlDumpAttributeDecl   (xmlBufferPtr buf,
-					xmlAttributePtr attr);
-#endif /* LIBXML_OUTPUT_ENABLED */
-
-/* IDs */
-XMLPUBFUN xmlIDPtr XMLCALL	
-		xmlAddID	       (xmlValidCtxtPtr ctxt,
-					xmlDocPtr doc,
-					const xmlChar *value,
-					xmlAttrPtr attr);
-XMLPUBFUN void XMLCALL		
-		xmlFreeIDTable	       (xmlIDTablePtr table);
-XMLPUBFUN xmlAttrPtr XMLCALL	
-		xmlGetID	       (xmlDocPtr doc,
-					const xmlChar *ID);
-XMLPUBFUN int XMLCALL		
-		xmlIsID		       (xmlDocPtr doc,
-					xmlNodePtr elem,
-					xmlAttrPtr attr);
-XMLPUBFUN int XMLCALL		
-		xmlRemoveID	       (xmlDocPtr doc, 
-					xmlAttrPtr attr);
-
-/* IDREFs */
-XMLPUBFUN xmlRefPtr XMLCALL	
-		xmlAddRef	       (xmlValidCtxtPtr ctxt,
-					xmlDocPtr doc,
-					const xmlChar *value,
-					xmlAttrPtr attr);
-XMLPUBFUN void XMLCALL		
-		xmlFreeRefTable	       (xmlRefTablePtr table);
-XMLPUBFUN int XMLCALL		
-		xmlIsRef	       (xmlDocPtr doc,
-					xmlNodePtr elem,
-					xmlAttrPtr attr);
-XMLPUBFUN int XMLCALL		
-		xmlRemoveRef	       (xmlDocPtr doc, 
-					xmlAttrPtr attr);
-XMLPUBFUN xmlListPtr XMLCALL	
-		xmlGetRefs	       (xmlDocPtr doc,
-					const xmlChar *ID);
-
-/**
- * The public function calls related to validity checking.
- */
-#ifdef LIBXML_VALID_ENABLED
-/* Allocate/Release Validation Contexts */
-XMLPUBFUN xmlValidCtxtPtr XMLCALL	    
-		xmlNewValidCtxt(void);
-XMLPUBFUN void XMLCALL		    
-		xmlFreeValidCtxt(xmlValidCtxtPtr);
-
-XMLPUBFUN int XMLCALL		
-		xmlValidateRoot		(xmlValidCtxtPtr ctxt,
-					 xmlDocPtr doc);
-XMLPUBFUN int XMLCALL		
-		xmlValidateElementDecl	(xmlValidCtxtPtr ctxt,
-					 xmlDocPtr doc,
-		                         xmlElementPtr elem);
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlValidNormalizeAttributeValue(xmlDocPtr doc,
-					 xmlNodePtr elem,
-					 const xmlChar *name,
-					 const xmlChar *value);
-XMLPUBFUN xmlChar * XMLCALL	
-		xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt,
-					 xmlDocPtr doc,
-					 xmlNodePtr elem,
-					 const xmlChar *name,
-					 const xmlChar *value);
-XMLPUBFUN int XMLCALL		
-		xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt,
-					 xmlDocPtr doc,
-		                         xmlAttributePtr attr);
-XMLPUBFUN int XMLCALL		
-		xmlValidateAttributeValue(xmlAttributeType type,
-					 const xmlChar *value);
-XMLPUBFUN int XMLCALL		
-		xmlValidateNotationDecl	(xmlValidCtxtPtr ctxt,
-					 xmlDocPtr doc,
-		                         xmlNotationPtr nota);
-XMLPUBFUN int XMLCALL		
-		xmlValidateDtd		(xmlValidCtxtPtr ctxt,
-					 xmlDocPtr doc,
-					 xmlDtdPtr dtd);
-XMLPUBFUN int XMLCALL		
-		xmlValidateDtdFinal	(xmlValidCtxtPtr ctxt,
-					 xmlDocPtr doc);
-XMLPUBFUN int XMLCALL		
-		xmlValidateDocument	(xmlValidCtxtPtr ctxt,
-					 xmlDocPtr doc);
-XMLPUBFUN int XMLCALL		
-		xmlValidateElement	(xmlValidCtxtPtr ctxt,
-					 xmlDocPtr doc,
-					 xmlNodePtr elem);
-XMLPUBFUN int XMLCALL		
-		xmlValidateOneElement	(xmlValidCtxtPtr ctxt,
-					 xmlDocPtr doc,
-		                         xmlNodePtr elem);
-XMLPUBFUN int XMLCALL	
-		xmlValidateOneAttribute	(xmlValidCtxtPtr ctxt,
-					 xmlDocPtr doc,
-					 xmlNodePtr	elem,
-					 xmlAttrPtr attr,
-					 const xmlChar *value);
-XMLPUBFUN int XMLCALL		
-		xmlValidateOneNamespace	(xmlValidCtxtPtr ctxt,
-					 xmlDocPtr doc,
-					 xmlNodePtr elem,
-					 const xmlChar *prefix,
-					 xmlNsPtr ns,
-					 const xmlChar *value);
-XMLPUBFUN int XMLCALL		
-		xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt,
-					 xmlDocPtr doc);
-#endif /* LIBXML_VALID_ENABLED */
-
-#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
-XMLPUBFUN int XMLCALL		
-		xmlValidateNotationUse	(xmlValidCtxtPtr ctxt,
-					 xmlDocPtr doc,
-					 const xmlChar *notationName);
-#endif /* LIBXML_VALID_ENABLED or LIBXML_SCHEMAS_ENABLED */
-
-XMLPUBFUN int XMLCALL		
-		xmlIsMixedElement	(xmlDocPtr doc,
-					 const xmlChar *name);
-XMLPUBFUN xmlAttributePtr XMLCALL	
-		xmlGetDtdAttrDesc	(xmlDtdPtr dtd,
-					 const xmlChar *elem,
-					 const xmlChar *name);
-XMLPUBFUN xmlAttributePtr XMLCALL	
-		xmlGetDtdQAttrDesc	(xmlDtdPtr dtd,
-					 const xmlChar *elem,
-					 const xmlChar *name,
-					 const xmlChar *prefix);
-XMLPUBFUN xmlNotationPtr XMLCALL	
-		xmlGetDtdNotationDesc	(xmlDtdPtr dtd,
-					 const xmlChar *name);
-XMLPUBFUN xmlElementPtr XMLCALL	
-		xmlGetDtdQElementDesc	(xmlDtdPtr dtd,
-					 const xmlChar *name,
-					 const xmlChar *prefix);
-XMLPUBFUN xmlElementPtr XMLCALL	
-		xmlGetDtdElementDesc	(xmlDtdPtr dtd,
-					 const xmlChar *name);
-
-#ifdef LIBXML_VALID_ENABLED
-
-XMLPUBFUN int XMLCALL		
-		xmlValidGetPotentialChildren(xmlElementContent *ctree,
-					 const xmlChar **names,
-					 int *len,
-					 int max);
-
-XMLPUBFUN int XMLCALL		
-		xmlValidGetValidElements(xmlNode *prev,
-					 xmlNode *next,
-					 const xmlChar **names,
-					 int max);
-XMLPUBFUN int XMLCALL		
-		xmlValidateNameValue	(const xmlChar *value);
-XMLPUBFUN int XMLCALL		
-		xmlValidateNamesValue	(const xmlChar *value);
-XMLPUBFUN int XMLCALL		
-		xmlValidateNmtokenValue	(const xmlChar *value);
-XMLPUBFUN int XMLCALL		
-		xmlValidateNmtokensValue(const xmlChar *value);
-
-#ifdef LIBXML_REGEXP_ENABLED
-/*
- * Validation based on the regexp support
- */
-XMLPUBFUN int XMLCALL		
-		xmlValidBuildContentModel(xmlValidCtxtPtr ctxt,
-					 xmlElementPtr elem);
-
-XMLPUBFUN int XMLCALL		
-		xmlValidatePushElement	(xmlValidCtxtPtr ctxt,
-					 xmlDocPtr doc,
-					 xmlNodePtr elem,
-					 const xmlChar *qname);
-XMLPUBFUN int XMLCALL		
-		xmlValidatePushCData	(xmlValidCtxtPtr ctxt,
-					 const xmlChar *data,
-					 int len);
-XMLPUBFUN int XMLCALL		
-		xmlValidatePopElement	(xmlValidCtxtPtr ctxt,
-					 xmlDocPtr doc,
-					 xmlNodePtr elem,
-					 const xmlChar *qname);
-#endif /* LIBXML_REGEXP_ENABLED */
-#endif /* LIBXML_VALID_ENABLED */
-#ifdef __cplusplus
-}
-#endif
-#endif /* __XML_VALID_H__ */
diff --git a/interfaces/ext/libxml/xinclude.h b/interfaces/ext/libxml/xinclude.h
deleted file mode 100644
index ba9c9b5..0000000
--- a/interfaces/ext/libxml/xinclude.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Summary: implementation of XInclude
- * Description: API to handle XInclude processing,
- * implements the
- * World Wide Web Consortium Last Call Working Draft 10 November 2003
- * http://www.w3.org/TR/2003/WD-xinclude-20031110
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#ifndef __XML_XINCLUDE_H__
-#define __XML_XINCLUDE_H__
-
-#include <libxml/xmlversion.h>
-#include <libxml/tree.h>
-
-#ifdef LIBXML_XINCLUDE_ENABLED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * XINCLUDE_NS:
- *
- * Macro defining the Xinclude namespace: http://www.w3.org/2003/XInclude
- */
-#define XINCLUDE_NS (const xmlChar *) "http://www.w3.org/2003/XInclude"
-/**
- * XINCLUDE_OLD_NS:
- *
- * Macro defining the draft Xinclude namespace: http://www.w3.org/2001/XInclude
- */
-#define XINCLUDE_OLD_NS (const xmlChar *) "http://www.w3.org/2001/XInclude"
-/**
- * XINCLUDE_NODE:
- *
- * Macro defining "include"
- */
-#define XINCLUDE_NODE (const xmlChar *) "include"
-/**
- * XINCLUDE_FALLBACK:
- *
- * Macro defining "fallback"
- */
-#define XINCLUDE_FALLBACK (const xmlChar *) "fallback"
-/**
- * XINCLUDE_HREF:
- *
- * Macro defining "href"
- */
-#define XINCLUDE_HREF (const xmlChar *) "href"
-/**
- * XINCLUDE_PARSE:
- *
- * Macro defining "parse"
- */
-#define XINCLUDE_PARSE (const xmlChar *) "parse"
-/**
- * XINCLUDE_PARSE_XML:
- *
- * Macro defining "xml"
- */
-#define XINCLUDE_PARSE_XML (const xmlChar *) "xml"
-/**
- * XINCLUDE_PARSE_TEXT:
- *
- * Macro defining "text"
- */
-#define XINCLUDE_PARSE_TEXT (const xmlChar *) "text"
-/**
- * XINCLUDE_PARSE_ENCODING:
- *
- * Macro defining "encoding"
- */
-#define XINCLUDE_PARSE_ENCODING (const xmlChar *) "encoding"
-/**
- * XINCLUDE_PARSE_XPOINTER:
- *
- * Macro defining "xpointer"
- */
-#define XINCLUDE_PARSE_XPOINTER (const xmlChar *) "xpointer"
-
-typedef struct _xmlXIncludeCtxt xmlXIncludeCtxt;
-typedef xmlXIncludeCtxt *xmlXIncludeCtxtPtr;
-
-/*
- * standalone processing
- */
-XMLPUBFUN int XMLCALL	
-		xmlXIncludeProcess	(xmlDocPtr doc);
-XMLPUBFUN int XMLCALL	
-		xmlXIncludeProcessFlags	(xmlDocPtr doc,
-					 int flags);
-XMLPUBFUN int XMLCALL	
-		xmlXIncludeProcessFlagsData(xmlDocPtr doc,
-					 int flags,
-					 void *data);
-XMLPUBFUN int XMLCALL	
-		xmlXIncludeProcessTree	(xmlNodePtr tree);
-XMLPUBFUN int XMLCALL	
-		xmlXIncludeProcessTreeFlags(xmlNodePtr tree,
-					 int flags);
-/*
- * contextual processing
- */
-XMLPUBFUN xmlXIncludeCtxtPtr XMLCALL
-		xmlXIncludeNewContext	(xmlDocPtr doc);
-XMLPUBFUN int XMLCALL
-		xmlXIncludeSetFlags	(xmlXIncludeCtxtPtr ctxt,
-					 int flags);
-XMLPUBFUN void XMLCALL
-		xmlXIncludeFreeContext	(xmlXIncludeCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL
-		xmlXIncludeProcessNode	(xmlXIncludeCtxtPtr ctxt,
-					 xmlNodePtr tree);
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LIBXML_XINCLUDE_ENABLED */
-
-#endif /* __XML_XINCLUDE_H__ */
diff --git a/interfaces/ext/libxml/xlink.h b/interfaces/ext/libxml/xlink.h
deleted file mode 100644
index 083c7ed..0000000
--- a/interfaces/ext/libxml/xlink.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Summary: unfinished XLink detection module
- * Description: unfinished XLink detection module
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#ifndef __XML_XLINK_H__
-#define __XML_XLINK_H__
-
-#include <libxml/xmlversion.h>
-#include <libxml/tree.h>
-
-#ifdef LIBXML_XPTR_ENABLED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Various defines for the various Link properties.
- *
- * NOTE: the link detection layer will try to resolve QName expansion
- *       of namespaces. If "foo" is the prefix for "http://foo.com/"
- *       then the link detection layer will expand role="foo:myrole"
- *       to "http://foo.com/:myrole".
- * NOTE: the link detection layer will expand URI-Refences found on
- *       href attributes by using the base mechanism if found.
- */
-typedef xmlChar *xlinkHRef;
-typedef xmlChar *xlinkRole;
-typedef xmlChar *xlinkTitle;
-
-typedef enum {
-    XLINK_TYPE_NONE = 0,
-    XLINK_TYPE_SIMPLE,
-    XLINK_TYPE_EXTENDED,
-    XLINK_TYPE_EXTENDED_SET
-} xlinkType;
-
-typedef enum {
-    XLINK_SHOW_NONE = 0,
-    XLINK_SHOW_NEW,
-    XLINK_SHOW_EMBED,
-    XLINK_SHOW_REPLACE
-} xlinkShow;
-
-typedef enum {
-    XLINK_ACTUATE_NONE = 0,
-    XLINK_ACTUATE_AUTO,
-    XLINK_ACTUATE_ONREQUEST
-} xlinkActuate;
-
-/**
- * xlinkNodeDetectFunc:
- * @ctx:  user data pointer
- * @node:  the node to check
- * 
- * This is the prototype for the link detection routine.
- * It calls the default link detection callbacks upon link detection.
- */
-typedef void (*xlinkNodeDetectFunc) (void *ctx, xmlNodePtr node);
-
-/*
- * The link detection module interact with the upper layers using
- * a set of callback registered at parsing time.
- */
-
-/**
- * xlinkSimpleLinkFunk:
- * @ctx:  user data pointer
- * @node:  the node carrying the link
- * @href:  the target of the link
- * @role:  the role string
- * @title:  the link title
- *
- * This is the prototype for a simple link detection callback.
- */
-typedef void
-(*xlinkSimpleLinkFunk)	(void *ctx,
-			 xmlNodePtr node,
-			 const xlinkHRef href,
-			 const xlinkRole role,
-			 const xlinkTitle title);
-
-/**
- * xlinkExtendedLinkFunk:
- * @ctx:  user data pointer
- * @node:  the node carrying the link
- * @nbLocators: the number of locators detected on the link
- * @hrefs:  pointer to the array of locator hrefs
- * @roles:  pointer to the array of locator roles
- * @nbArcs: the number of arcs detected on the link
- * @from:  pointer to the array of source roles found on the arcs
- * @to:  pointer to the array of target roles found on the arcs
- * @show:  array of values for the show attributes found on the arcs
- * @actuate:  array of values for the actuate attributes found on the arcs
- * @nbTitles: the number of titles detected on the link
- * @title:  array of titles detected on the link
- * @langs:  array of xml:lang values for the titles
- *
- * This is the prototype for a extended link detection callback.
- */
-typedef void
-(*xlinkExtendedLinkFunk)(void *ctx,
-			 xmlNodePtr node,
-			 int nbLocators,
-			 const xlinkHRef *hrefs,
-			 const xlinkRole *roles,
-			 int nbArcs,
-			 const xlinkRole *from,
-			 const xlinkRole *to,
-			 xlinkShow *show,
-			 xlinkActuate *actuate,
-			 int nbTitles,
-			 const xlinkTitle *titles,
-			 const xmlChar **langs);
-
-/**
- * xlinkExtendedLinkSetFunk:
- * @ctx:  user data pointer
- * @node:  the node carrying the link
- * @nbLocators: the number of locators detected on the link
- * @hrefs:  pointer to the array of locator hrefs
- * @roles:  pointer to the array of locator roles
- * @nbTitles: the number of titles detected on the link
- * @title:  array of titles detected on the link
- * @langs:  array of xml:lang values for the titles
- *
- * This is the prototype for a extended link set detection callback.
- */
-typedef void
-(*xlinkExtendedLinkSetFunk)	(void *ctx,
-				 xmlNodePtr node,
-				 int nbLocators,
-				 const xlinkHRef *hrefs,
-				 const xlinkRole *roles,
-				 int nbTitles,
-				 const xlinkTitle *titles,
-				 const xmlChar **langs);
-
-/**
- * This is the structure containing a set of Links detection callbacks.
- *
- * There is no default xlink callbacks, if one want to get link
- * recognition activated, those call backs must be provided before parsing.
- */
-typedef struct _xlinkHandler xlinkHandler;
-typedef xlinkHandler *xlinkHandlerPtr;
-struct _xlinkHandler {
-    xlinkSimpleLinkFunk simple;
-    xlinkExtendedLinkFunk extended;
-    xlinkExtendedLinkSetFunk set;
-};
-
-/*
- * The default detection routine, can be overridden, they call the default
- * detection callbacks. 
- */
-
-XMLPUBFUN xlinkNodeDetectFunc XMLCALL	
-		xlinkGetDefaultDetect	(void);
-XMLPUBFUN void XMLCALL			
-		xlinkSetDefaultDetect	(xlinkNodeDetectFunc func);
-
-/*
- * Routines to set/get the default handlers.
- */
-XMLPUBFUN xlinkHandlerPtr XMLCALL	
-		xlinkGetDefaultHandler	(void);
-XMLPUBFUN void XMLCALL		
-		xlinkSetDefaultHandler	(xlinkHandlerPtr handler);
-
-/*
- * Link detection module itself.
- */
-XMLPUBFUN xlinkType XMLCALL	 
-		xlinkIsLink		(xmlDocPtr doc,
-					 xmlNodePtr node);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LIBXML_XPTR_ENABLED */
-
-#endif /* __XML_XLINK_H__ */
diff --git a/interfaces/ext/libxml/xmlIO.h b/interfaces/ext/libxml/xmlIO.h
deleted file mode 100644
index eea9ed6..0000000
--- a/interfaces/ext/libxml/xmlIO.h
+++ /dev/null
@@ -1,360 +0,0 @@
-/*
- * Summary: interface for the I/O interfaces used by the parser
- * Description: interface for the I/O interfaces used by the parser
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#ifndef __XML_IO_H__
-#define __XML_IO_H__
-
-#include <stdio.h>
-#include <libxml/xmlversion.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Those are the functions and datatypes for the parser input
- * I/O structures.
- */
-
-/**
- * xmlInputMatchCallback:
- * @filename: the filename or URI
- *
- * Callback used in the I/O Input API to detect if the current handler 
- * can provide input fonctionnalities for this resource.
- *
- * Returns 1 if yes and 0 if another Input module should be used
- */
-typedef int (XMLCALL *xmlInputMatchCallback) (char const *filename);
-/**
- * xmlInputOpenCallback:
- * @filename: the filename or URI
- *
- * Callback used in the I/O Input API to open the resource
- *
- * Returns an Input context or NULL in case or error
- */
-typedef void * (XMLCALL *xmlInputOpenCallback) (char const *filename);
-/**
- * xmlInputReadCallback:
- * @context:  an Input context
- * @buffer:  the buffer to store data read
- * @len:  the length of the buffer in bytes
- *
- * Callback used in the I/O Input API to read the resource
- *
- * Returns the number of bytes read or -1 in case of error
- */
-typedef int (XMLCALL *xmlInputReadCallback) (void * context, char * buffer, int len);
-/**
- * xmlInputCloseCallback:
- * @context:  an Input context
- *
- * Callback used in the I/O Input API to close the resource
- *
- * Returns 0 or -1 in case of error
- */
-typedef int (XMLCALL *xmlInputCloseCallback) (void * context);
-
-#ifdef LIBXML_OUTPUT_ENABLED
-/*
- * Those are the functions and datatypes for the library output
- * I/O structures.
- */
-
-/**
- * xmlOutputMatchCallback:
- * @filename: the filename or URI
- *
- * Callback used in the I/O Output API to detect if the current handler 
- * can provide output fonctionnalities for this resource.
- *
- * Returns 1 if yes and 0 if another Output module should be used
- */
-typedef int (XMLCALL *xmlOutputMatchCallback) (char const *filename);
-/**
- * xmlOutputOpenCallback:
- * @filename: the filename or URI
- *
- * Callback used in the I/O Output API to open the resource
- *
- * Returns an Output context or NULL in case or error
- */
-typedef void * (XMLCALL *xmlOutputOpenCallback) (char const *filename);
-/**
- * xmlOutputWriteCallback:
- * @context:  an Output context
- * @buffer:  the buffer of data to write
- * @len:  the length of the buffer in bytes
- *
- * Callback used in the I/O Output API to write to the resource
- *
- * Returns the number of bytes written or -1 in case of error
- */
-typedef int (XMLCALL *xmlOutputWriteCallback) (void * context, const char * buffer,
-                                       int len);
-/**
- * xmlOutputCloseCallback:
- * @context:  an Output context
- *
- * Callback used in the I/O Output API to close the resource
- *
- * Returns 0 or -1 in case of error
- */
-typedef int (XMLCALL *xmlOutputCloseCallback) (void * context);
-#endif /* LIBXML_OUTPUT_ENABLED */
-
-#ifdef __cplusplus
-}
-#endif
-
-#include <libxml/globals.h>
-#include <libxml/tree.h>
-#include <libxml/parser.h>
-#include <libxml/encoding.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-struct _xmlParserInputBuffer {
-    void*                  context;
-    xmlInputReadCallback   readcallback;
-    xmlInputCloseCallback  closecallback;
-    
-    xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */
-    
-    xmlBufferPtr buffer;    /* Local buffer encoded in UTF-8 */
-    xmlBufferPtr raw;       /* if encoder != NULL buffer for raw input */
-    int	compressed;	    /* -1=unknown, 0=not compressed, 1=compressed */
-    int error;
-    unsigned long rawconsumed;/* amount consumed from raw */
-};
-
-
-#ifdef LIBXML_OUTPUT_ENABLED
-struct _xmlOutputBuffer {
-    void*                   context;
-    xmlOutputWriteCallback  writecallback;
-    xmlOutputCloseCallback  closecallback;
-    
-    xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */
-    
-    xmlBufferPtr buffer;    /* Local buffer encoded in UTF-8 or ISOLatin */
-    xmlBufferPtr conv;      /* if encoder != NULL buffer for output */
-    int written;            /* total number of byte written */
-    int error;
-};
-#endif /* LIBXML_OUTPUT_ENABLED */
-
-/*
- * Interfaces for input
- */
-XMLPUBFUN void XMLCALL	
-	xmlCleanupInputCallbacks		(void);
-
-XMLPUBFUN int XMLCALL
-	xmlPopInputCallbacks			(void);
-
-XMLPUBFUN void XMLCALL	
-	xmlRegisterDefaultInputCallbacks	(void);
-XMLPUBFUN xmlParserInputBufferPtr XMLCALL
-	xmlAllocParserInputBuffer		(xmlCharEncoding enc);
-
-XMLPUBFUN xmlParserInputBufferPtr XMLCALL
-	xmlParserInputBufferCreateFilename	(const char *URI,
-                                                 xmlCharEncoding enc);
-XMLPUBFUN xmlParserInputBufferPtr XMLCALL
-	xmlParserInputBufferCreateFile		(FILE *file,
-                                                 xmlCharEncoding enc);
-XMLPUBFUN xmlParserInputBufferPtr XMLCALL
-	xmlParserInputBufferCreateFd		(int fd,
-	                                         xmlCharEncoding enc);
-XMLPUBFUN xmlParserInputBufferPtr XMLCALL
-	xmlParserInputBufferCreateMem		(const char *mem, int size,
-	                                         xmlCharEncoding enc);
-XMLPUBFUN xmlParserInputBufferPtr XMLCALL
-	xmlParserInputBufferCreateStatic	(const char *mem, int size,
-	                                         xmlCharEncoding enc);
-XMLPUBFUN xmlParserInputBufferPtr XMLCALL
-	xmlParserInputBufferCreateIO		(xmlInputReadCallback   ioread,
-						 xmlInputCloseCallback  ioclose,
-						 void *ioctx,
-	                                         xmlCharEncoding enc);
-XMLPUBFUN int XMLCALL	
-	xmlParserInputBufferRead		(xmlParserInputBufferPtr in,
-						 int len);
-XMLPUBFUN int XMLCALL	
-	xmlParserInputBufferGrow		(xmlParserInputBufferPtr in,
-						 int len);
-XMLPUBFUN int XMLCALL	
-	xmlParserInputBufferPush		(xmlParserInputBufferPtr in,
-						 int len,
-						 const char *buf);
-XMLPUBFUN void XMLCALL	
-	xmlFreeParserInputBuffer		(xmlParserInputBufferPtr in);
-XMLPUBFUN char * XMLCALL	
-	xmlParserGetDirectory			(const char *filename);
-
-XMLPUBFUN int XMLCALL     
-	xmlRegisterInputCallbacks		(xmlInputMatchCallback matchFunc,
-						 xmlInputOpenCallback openFunc,
-						 xmlInputReadCallback readFunc,
-						 xmlInputCloseCallback closeFunc);
-
-xmlParserInputBufferPtr
-	__xmlParserInputBufferCreateFilename(const char *URI,
-										xmlCharEncoding enc);
-
-#ifdef LIBXML_OUTPUT_ENABLED
-/*
- * Interfaces for output
- */
-XMLPUBFUN void XMLCALL	
-	xmlCleanupOutputCallbacks		(void);
-XMLPUBFUN void XMLCALL	
-	xmlRegisterDefaultOutputCallbacks(void);
-XMLPUBFUN xmlOutputBufferPtr XMLCALL
-	xmlAllocOutputBuffer		(xmlCharEncodingHandlerPtr encoder);
-
-XMLPUBFUN xmlOutputBufferPtr XMLCALL
-	xmlOutputBufferCreateFilename	(const char *URI,
-					 xmlCharEncodingHandlerPtr encoder,
-					 int compression);
-
-XMLPUBFUN xmlOutputBufferPtr XMLCALL
-	xmlOutputBufferCreateFile	(FILE *file,
-					 xmlCharEncodingHandlerPtr encoder);
-
-XMLPUBFUN xmlOutputBufferPtr XMLCALL
-	xmlOutputBufferCreateBuffer	(xmlBufferPtr buffer,
-					 xmlCharEncodingHandlerPtr encoder);
-
-XMLPUBFUN xmlOutputBufferPtr XMLCALL
-	xmlOutputBufferCreateFd		(int fd,
-					 xmlCharEncodingHandlerPtr encoder);
-
-XMLPUBFUN xmlOutputBufferPtr XMLCALL
-	xmlOutputBufferCreateIO		(xmlOutputWriteCallback   iowrite,
-					 xmlOutputCloseCallback  ioclose,
-					 void *ioctx,
-					 xmlCharEncodingHandlerPtr encoder);
-
-XMLPUBFUN int XMLCALL	
-	xmlOutputBufferWrite		(xmlOutputBufferPtr out,
-					 int len,
-					 const char *buf);
-XMLPUBFUN int XMLCALL	
-	xmlOutputBufferWriteString	(xmlOutputBufferPtr out,
-					 const char *str);
-XMLPUBFUN int XMLCALL	
-	xmlOutputBufferWriteEscape	(xmlOutputBufferPtr out,
-					 const xmlChar *str,
-					 xmlCharEncodingOutputFunc escaping);
-
-XMLPUBFUN int XMLCALL	
-	xmlOutputBufferFlush		(xmlOutputBufferPtr out);
-XMLPUBFUN int XMLCALL	
-	xmlOutputBufferClose		(xmlOutputBufferPtr out);
-
-XMLPUBFUN int XMLCALL     
-	xmlRegisterOutputCallbacks	(xmlOutputMatchCallback matchFunc,
-					 xmlOutputOpenCallback openFunc,
-					 xmlOutputWriteCallback writeFunc,
-					 xmlOutputCloseCallback closeFunc);
-
-xmlOutputBufferPtr
-	__xmlOutputBufferCreateFilename(const char *URI,
-                              xmlCharEncodingHandlerPtr encoder,
-                              int compression);
-
-#ifdef LIBXML_HTTP_ENABLED
-/*  This function only exists if HTTP support built into the library  */
-XMLPUBFUN void XMLCALL	
-	xmlRegisterHTTPPostCallbacks	(void );
-#endif /* LIBXML_HTTP_ENABLED */
-	
-#endif /* LIBXML_OUTPUT_ENABLED */
-
-XMLPUBFUN xmlParserInputPtr XMLCALL
-	xmlCheckHTTPInput		(xmlParserCtxtPtr ctxt,
-					 xmlParserInputPtr ret);
-
-/*
- * A predefined entity loader disabling network accesses
- */
-XMLPUBFUN xmlParserInputPtr XMLCALL 
-	xmlNoNetExternalEntityLoader	(const char *URL,
-					 const char *ID,
-					 xmlParserCtxtPtr ctxt);
-
-/* 
- * xmlNormalizeWindowsPath is obsolete, don't use it. 
- * Check xmlCanonicPath in uri.h for a better alternative.
- */
-XMLPUBFUN xmlChar * XMLCALL 
-	xmlNormalizeWindowsPath		(const xmlChar *path);
-
-XMLPUBFUN int XMLCALL	
-	xmlCheckFilename		(const char *path);
-/**
- * Default 'file://' protocol callbacks 
- */
-XMLPUBFUN int XMLCALL	
-	xmlFileMatch 			(const char *filename);
-XMLPUBFUN void * XMLCALL	
-	xmlFileOpen 			(const char *filename);
-XMLPUBFUN int XMLCALL	
-	xmlFileRead 			(void * context, 
-					 char * buffer, 
-					 int len);
-XMLPUBFUN int XMLCALL	
-	xmlFileClose 			(void * context);
-
-/**
- * Default 'http://' protocol callbacks 
- */
-#ifdef LIBXML_HTTP_ENABLED
-XMLPUBFUN int XMLCALL	
-	xmlIOHTTPMatch 			(const char *filename);
-XMLPUBFUN void * XMLCALL	
-	xmlIOHTTPOpen 			(const char *filename);
-#ifdef LIBXML_OUTPUT_ENABLED
-XMLPUBFUN void * XMLCALL	
-	xmlIOHTTPOpenW			(const char * post_uri,
-					 int   compression );
-#endif /* LIBXML_OUTPUT_ENABLED */
-XMLPUBFUN int XMLCALL 	
-	xmlIOHTTPRead			(void * context, 
-					 char * buffer, 
-					 int len);
-XMLPUBFUN int XMLCALL	
-	xmlIOHTTPClose 			(void * context);
-#endif /* LIBXML_HTTP_ENABLED */
-
-/**
- * Default 'ftp://' protocol callbacks 
- */
-#ifdef LIBXML_FTP_ENABLED 
-XMLPUBFUN int XMLCALL	
-	xmlIOFTPMatch 			(const char *filename);
-XMLPUBFUN void * XMLCALL	
-	xmlIOFTPOpen 			(const char *filename);
-XMLPUBFUN int XMLCALL 	
-	xmlIOFTPRead			(void * context, 
-					 char * buffer, 
-					 int len);
-XMLPUBFUN int XMLCALL 	
-	xmlIOFTPClose 			(void * context);
-#endif /* LIBXML_FTP_ENABLED */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __XML_IO_H__ */
diff --git a/interfaces/ext/libxml/xmlautomata.h b/interfaces/ext/libxml/xmlautomata.h
deleted file mode 100644
index f98b55e..0000000
--- a/interfaces/ext/libxml/xmlautomata.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Summary: API to build regexp automata
- * Description: the API to build regexp automata
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#ifndef __XML_AUTOMATA_H__
-#define __XML_AUTOMATA_H__
-
-#include <libxml/xmlversion.h>
-#include <libxml/tree.h>
-
-#ifdef LIBXML_REGEXP_ENABLED
-#ifdef LIBXML_AUTOMATA_ENABLED
-#include <libxml/xmlregexp.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * xmlAutomataPtr:
- *
- * A libxml automata description, It can be compiled into a regexp
- */
-typedef struct _xmlAutomata xmlAutomata;
-typedef xmlAutomata *xmlAutomataPtr;
-
-/**
- * xmlAutomataStatePtr:
- *
- * A state int the automata description,
- */
-typedef struct _xmlAutomataState xmlAutomataState;
-typedef xmlAutomataState *xmlAutomataStatePtr;
-
-/*
- * Building API
- */
-XMLPUBFUN xmlAutomataPtr XMLCALL		
-		    xmlNewAutomata		(void);
-XMLPUBFUN void XMLCALL			
-		    xmlFreeAutomata		(xmlAutomataPtr am);
-
-XMLPUBFUN xmlAutomataStatePtr XMLCALL	
-		    xmlAutomataGetInitState	(xmlAutomataPtr am);
-XMLPUBFUN int XMLCALL			
-		    xmlAutomataSetFinalState	(xmlAutomataPtr am,
-						 xmlAutomataStatePtr state);
-XMLPUBFUN xmlAutomataStatePtr XMLCALL	
-		    xmlAutomataNewState		(xmlAutomataPtr am);
-XMLPUBFUN xmlAutomataStatePtr XMLCALL	
-		    xmlAutomataNewTransition	(xmlAutomataPtr am,
-						 xmlAutomataStatePtr from,
-						 xmlAutomataStatePtr to,
-						 const xmlChar *token,
-						 void *data);
-XMLPUBFUN xmlAutomataStatePtr XMLCALL	
-		    xmlAutomataNewTransition2	(xmlAutomataPtr am,
-						 xmlAutomataStatePtr from,
-						 xmlAutomataStatePtr to,
-						 const xmlChar *token,
-						 const xmlChar *token2,
-						 void *data);
-XMLPUBFUN xmlAutomataStatePtr XMLCALL
-                    xmlAutomataNewNegTrans	(xmlAutomataPtr am,
-						 xmlAutomataStatePtr from,
-						 xmlAutomataStatePtr to,
-						 const xmlChar *token,
-						 const xmlChar *token2,
-						 void *data);
-
-XMLPUBFUN xmlAutomataStatePtr XMLCALL	
-		    xmlAutomataNewCountTrans	(xmlAutomataPtr am,
-						 xmlAutomataStatePtr from,
-						 xmlAutomataStatePtr to,
-						 const xmlChar *token,
-						 int min,
-						 int max,
-						 void *data);
-XMLPUBFUN xmlAutomataStatePtr XMLCALL	
-		    xmlAutomataNewCountTrans2	(xmlAutomataPtr am,
-						 xmlAutomataStatePtr from,
-						 xmlAutomataStatePtr to,
-						 const xmlChar *token,
-						 const xmlChar *token2,
-						 int min,
-						 int max,
-						 void *data);
-XMLPUBFUN xmlAutomataStatePtr XMLCALL	
-		    xmlAutomataNewOnceTrans	(xmlAutomataPtr am,
-						 xmlAutomataStatePtr from,
-						 xmlAutomataStatePtr to,
-						 const xmlChar *token,
-						 int min,
-						 int max,
-						 void *data);
-XMLPUBFUN xmlAutomataStatePtr XMLCALL
-		    xmlAutomataNewOnceTrans2	(xmlAutomataPtr am, 
-						 xmlAutomataStatePtr from,
-						 xmlAutomataStatePtr to, 
-						 const xmlChar *token,
-						 const xmlChar *token2,
-						 int min, 
-						 int max, 
-						 void *data);
-XMLPUBFUN xmlAutomataStatePtr XMLCALL	
-		    xmlAutomataNewAllTrans	(xmlAutomataPtr am,
-						 xmlAutomataStatePtr from,
-						 xmlAutomataStatePtr to,
-						 int lax);
-XMLPUBFUN xmlAutomataStatePtr XMLCALL	
-		    xmlAutomataNewEpsilon	(xmlAutomataPtr am,
-						 xmlAutomataStatePtr from,
-						 xmlAutomataStatePtr to);
-XMLPUBFUN xmlAutomataStatePtr XMLCALL	
-		    xmlAutomataNewCountedTrans	(xmlAutomataPtr am,
-						 xmlAutomataStatePtr from,
-						 xmlAutomataStatePtr to,
-						 int counter);
-XMLPUBFUN xmlAutomataStatePtr XMLCALL	
-		    xmlAutomataNewCounterTrans	(xmlAutomataPtr am,
-						 xmlAutomataStatePtr from,
-						 xmlAutomataStatePtr to,
-						 int counter);
-XMLPUBFUN int XMLCALL			
-		    xmlAutomataNewCounter	(xmlAutomataPtr am,
-						 int min,
-						 int max);
-
-XMLPUBFUN xmlRegexpPtr XMLCALL		
-		    xmlAutomataCompile		(xmlAutomataPtr am);
-XMLPUBFUN int XMLCALL	    		
-		    xmlAutomataIsDeterminist	(xmlAutomataPtr am);
-
-#ifdef __cplusplus
-}
-#endif 
-
-#endif /* LIBXML_AUTOMATA_ENABLED */
-#endif /* LIBXML_REGEXP_ENABLED */
-
-#endif /* __XML_AUTOMATA_H__ */
diff --git a/interfaces/ext/libxml/xmlerror.h b/interfaces/ext/libxml/xmlerror.h
deleted file mode 100644
index 7cce9c3..0000000
--- a/interfaces/ext/libxml/xmlerror.h
+++ /dev/null
@@ -1,944 +0,0 @@
-/*
- * Summary: error handling
- * Description: the API used to report errors
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#include <libxml/parser.h>
-
-#ifndef __XML_ERROR_H__
-#define __XML_ERROR_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * xmlErrorLevel:
- *
- * Indicates the level of an error
- */
-typedef enum {
-    XML_ERR_NONE = 0,
-    XML_ERR_WARNING = 1,	/* A simple warning */
-    XML_ERR_ERROR = 2,		/* A recoverable error */
-    XML_ERR_FATAL = 3		/* A fatal error */
-} xmlErrorLevel;
-
-/**
- * xmlErrorDomain:
- *
- * Indicates where an error may have come from
- */
-typedef enum {
-    XML_FROM_NONE = 0,
-    XML_FROM_PARSER,	/* The XML parser */
-    XML_FROM_TREE,	/* The tree module */
-    XML_FROM_NAMESPACE,	/* The XML Namespace module */
-    XML_FROM_DTD,	/* The XML DTD validation with parser context*/
-    XML_FROM_HTML,	/* The HTML parser */
-    XML_FROM_MEMORY,	/* The memory allocator */
-    XML_FROM_OUTPUT,	/* The serialization code */
-    XML_FROM_IO,	/* The Input/Output stack */
-    XML_FROM_FTP,	/* The FTP module */
-    XML_FROM_HTTP,	/* The HTTP module */
-    XML_FROM_XINCLUDE,	/* The XInclude processing */
-    XML_FROM_XPATH,	/* The XPath module */
-    XML_FROM_XPOINTER,	/* The XPointer module */
-    XML_FROM_REGEXP,	/* The regular expressions module */
-    XML_FROM_DATATYPE,	/* The W3C XML Schemas Datatype module */
-    XML_FROM_SCHEMASP,	/* The W3C XML Schemas parser module */
-    XML_FROM_SCHEMASV,	/* The W3C XML Schemas validation module */
-    XML_FROM_RELAXNGP,	/* The Relax-NG parser module */
-    XML_FROM_RELAXNGV,	/* The Relax-NG validator module */
-    XML_FROM_CATALOG,	/* The Catalog module */
-    XML_FROM_C14N,	/* The Canonicalization module */
-    XML_FROM_XSLT,	/* The XSLT engine from libxslt */
-    XML_FROM_VALID,	/* The XML DTD validation with valid context */
-    XML_FROM_CHECK,	/* The error checking module */
-    XML_FROM_WRITER,	/* The xmlwriter module */
-    XML_FROM_MODULE,	/* The dynamically loaded module module*/
-    XML_FROM_I18N,	/* The module handling character conversion */
-    XML_FROM_SCHEMATRONV	/* The Schematron validator module */
-} xmlErrorDomain;
-
-/**
- * xmlError:
- *
- * An XML Error instance.
- */
-
-typedef struct _xmlError xmlError;
-typedef xmlError *xmlErrorPtr;
-struct _xmlError {
-    int		domain;	/* What part of the library raised this error */
-    int		code;	/* The error code, e.g. an xmlParserError */
-    char       *message;/* human-readable informative error message */
-    xmlErrorLevel level;/* how consequent is the error */
-    char       *file;	/* the filename */
-    int		line;	/* the line number if available */
-    char       *str1;	/* extra string information */
-    char       *str2;	/* extra string information */
-    char       *str3;	/* extra string information */
-    int		int1;	/* extra number information */
-    int		int2;	/* column number of the error or 0 if N/A (todo: rename this field when we would break ABI) */
-    void       *ctxt;   /* the parser context if available */
-    void       *node;   /* the node in the tree */
-};
-
-/**
- * xmlParserError:
- *
- * This is an error that the XML (or HTML) parser can generate
- */
-typedef enum {
-    XML_ERR_OK = 0,
-    XML_ERR_INTERNAL_ERROR, /* 1 */
-    XML_ERR_NO_MEMORY, /* 2 */
-    XML_ERR_DOCUMENT_START, /* 3 */
-    XML_ERR_DOCUMENT_EMPTY, /* 4 */
-    XML_ERR_DOCUMENT_END, /* 5 */
-    XML_ERR_INVALID_HEX_CHARREF, /* 6 */
-    XML_ERR_INVALID_DEC_CHARREF, /* 7 */
-    XML_ERR_INVALID_CHARREF, /* 8 */
-    XML_ERR_INVALID_CHAR, /* 9 */
-    XML_ERR_CHARREF_AT_EOF, /* 10 */
-    XML_ERR_CHARREF_IN_PROLOG, /* 11 */
-    XML_ERR_CHARREF_IN_EPILOG, /* 12 */
-    XML_ERR_CHARREF_IN_DTD, /* 13 */
-    XML_ERR_ENTITYREF_AT_EOF, /* 14 */
-    XML_ERR_ENTITYREF_IN_PROLOG, /* 15 */
-    XML_ERR_ENTITYREF_IN_EPILOG, /* 16 */
-    XML_ERR_ENTITYREF_IN_DTD, /* 17 */
-    XML_ERR_PEREF_AT_EOF, /* 18 */
-    XML_ERR_PEREF_IN_PROLOG, /* 19 */
-    XML_ERR_PEREF_IN_EPILOG, /* 20 */
-    XML_ERR_PEREF_IN_INT_SUBSET, /* 21 */
-    XML_ERR_ENTITYREF_NO_NAME, /* 22 */
-    XML_ERR_ENTITYREF_SEMICOL_MISSING, /* 23 */
-    XML_ERR_PEREF_NO_NAME, /* 24 */
-    XML_ERR_PEREF_SEMICOL_MISSING, /* 25 */
-    XML_ERR_UNDECLARED_ENTITY, /* 26 */
-    XML_WAR_UNDECLARED_ENTITY, /* 27 */
-    XML_ERR_UNPARSED_ENTITY, /* 28 */
-    XML_ERR_ENTITY_IS_EXTERNAL, /* 29 */
-    XML_ERR_ENTITY_IS_PARAMETER, /* 30 */
-    XML_ERR_UNKNOWN_ENCODING, /* 31 */
-    XML_ERR_UNSUPPORTED_ENCODING, /* 32 */
-    XML_ERR_STRING_NOT_STARTED, /* 33 */
-    XML_ERR_STRING_NOT_CLOSED, /* 34 */
-    XML_ERR_NS_DECL_ERROR, /* 35 */
-    XML_ERR_ENTITY_NOT_STARTED, /* 36 */
-    XML_ERR_ENTITY_NOT_FINISHED, /* 37 */
-    XML_ERR_LT_IN_ATTRIBUTE, /* 38 */
-    XML_ERR_ATTRIBUTE_NOT_STARTED, /* 39 */
-    XML_ERR_ATTRIBUTE_NOT_FINISHED, /* 40 */
-    XML_ERR_ATTRIBUTE_WITHOUT_VALUE, /* 41 */
-    XML_ERR_ATTRIBUTE_REDEFINED, /* 42 */
-    XML_ERR_LITERAL_NOT_STARTED, /* 43 */
-    XML_ERR_LITERAL_NOT_FINISHED, /* 44 */
-    XML_ERR_COMMENT_NOT_FINISHED, /* 45 */
-    XML_ERR_PI_NOT_STARTED, /* 46 */
-    XML_ERR_PI_NOT_FINISHED, /* 47 */
-    XML_ERR_NOTATION_NOT_STARTED, /* 48 */
-    XML_ERR_NOTATION_NOT_FINISHED, /* 49 */
-    XML_ERR_ATTLIST_NOT_STARTED, /* 50 */
-    XML_ERR_ATTLIST_NOT_FINISHED, /* 51 */
-    XML_ERR_MIXED_NOT_STARTED, /* 52 */
-    XML_ERR_MIXED_NOT_FINISHED, /* 53 */
-    XML_ERR_ELEMCONTENT_NOT_STARTED, /* 54 */
-    XML_ERR_ELEMCONTENT_NOT_FINISHED, /* 55 */
-    XML_ERR_XMLDECL_NOT_STARTED, /* 56 */
-    XML_ERR_XMLDECL_NOT_FINISHED, /* 57 */
-    XML_ERR_CONDSEC_NOT_STARTED, /* 58 */
-    XML_ERR_CONDSEC_NOT_FINISHED, /* 59 */
-    XML_ERR_EXT_SUBSET_NOT_FINISHED, /* 60 */
-    XML_ERR_DOCTYPE_NOT_FINISHED, /* 61 */
-    XML_ERR_MISPLACED_CDATA_END, /* 62 */
-    XML_ERR_CDATA_NOT_FINISHED, /* 63 */
-    XML_ERR_RESERVED_XML_NAME, /* 64 */
-    XML_ERR_SPACE_REQUIRED, /* 65 */
-    XML_ERR_SEPARATOR_REQUIRED, /* 66 */
-    XML_ERR_NMTOKEN_REQUIRED, /* 67 */
-    XML_ERR_NAME_REQUIRED, /* 68 */
-    XML_ERR_PCDATA_REQUIRED, /* 69 */
-    XML_ERR_URI_REQUIRED, /* 70 */
-    XML_ERR_PUBID_REQUIRED, /* 71 */
-    XML_ERR_LT_REQUIRED, /* 72 */
-    XML_ERR_GT_REQUIRED, /* 73 */
-    XML_ERR_LTSLASH_REQUIRED, /* 74 */
-    XML_ERR_EQUAL_REQUIRED, /* 75 */
-    XML_ERR_TAG_NAME_MISMATCH, /* 76 */
-    XML_ERR_TAG_NOT_FINISHED, /* 77 */
-    XML_ERR_STANDALONE_VALUE, /* 78 */
-    XML_ERR_ENCODING_NAME, /* 79 */
-    XML_ERR_HYPHEN_IN_COMMENT, /* 80 */
-    XML_ERR_INVALID_ENCODING, /* 81 */
-    XML_ERR_EXT_ENTITY_STANDALONE, /* 82 */
-    XML_ERR_CONDSEC_INVALID, /* 83 */
-    XML_ERR_VALUE_REQUIRED, /* 84 */
-    XML_ERR_NOT_WELL_BALANCED, /* 85 */
-    XML_ERR_EXTRA_CONTENT, /* 86 */
-    XML_ERR_ENTITY_CHAR_ERROR, /* 87 */
-    XML_ERR_ENTITY_PE_INTERNAL, /* 88 */
-    XML_ERR_ENTITY_LOOP, /* 89 */
-    XML_ERR_ENTITY_BOUNDARY, /* 90 */
-    XML_ERR_INVALID_URI, /* 91 */
-    XML_ERR_URI_FRAGMENT, /* 92 */
-    XML_WAR_CATALOG_PI, /* 93 */
-    XML_ERR_NO_DTD, /* 94 */
-    XML_ERR_CONDSEC_INVALID_KEYWORD, /* 95 */
-    XML_ERR_VERSION_MISSING, /* 96 */
-    XML_WAR_UNKNOWN_VERSION, /* 97 */
-    XML_WAR_LANG_VALUE, /* 98 */
-    XML_WAR_NS_URI, /* 99 */
-    XML_WAR_NS_URI_RELATIVE, /* 100 */
-    XML_ERR_MISSING_ENCODING, /* 101 */
-    XML_WAR_SPACE_VALUE, /* 102 */
-    XML_ERR_NOT_STANDALONE, /* 103 */
-    XML_ERR_ENTITY_PROCESSING, /* 104 */
-    XML_ERR_NOTATION_PROCESSING, /* 105 */
-    XML_WAR_NS_COLUMN, /* 106 */
-    XML_WAR_ENTITY_REDEFINED, /* 107 */
-    XML_ERR_UNKNOWN_VERSION, /* 108 */
-    XML_ERR_VERSION_MISMATCH, /* 109 */
-    XML_NS_ERR_XML_NAMESPACE = 200,
-    XML_NS_ERR_UNDEFINED_NAMESPACE, /* 201 */
-    XML_NS_ERR_QNAME, /* 202 */
-    XML_NS_ERR_ATTRIBUTE_REDEFINED, /* 203 */
-    XML_NS_ERR_EMPTY, /* 204 */
-    XML_NS_ERR_COLON, /* 205 */
-    XML_DTD_ATTRIBUTE_DEFAULT = 500,
-    XML_DTD_ATTRIBUTE_REDEFINED, /* 501 */
-    XML_DTD_ATTRIBUTE_VALUE, /* 502 */
-    XML_DTD_CONTENT_ERROR, /* 503 */
-    XML_DTD_CONTENT_MODEL, /* 504 */
-    XML_DTD_CONTENT_NOT_DETERMINIST, /* 505 */
-    XML_DTD_DIFFERENT_PREFIX, /* 506 */
-    XML_DTD_ELEM_DEFAULT_NAMESPACE, /* 507 */
-    XML_DTD_ELEM_NAMESPACE, /* 508 */
-    XML_DTD_ELEM_REDEFINED, /* 509 */
-    XML_DTD_EMPTY_NOTATION, /* 510 */
-    XML_DTD_ENTITY_TYPE, /* 511 */
-    XML_DTD_ID_FIXED, /* 512 */
-    XML_DTD_ID_REDEFINED, /* 513 */
-    XML_DTD_ID_SUBSET, /* 514 */
-    XML_DTD_INVALID_CHILD, /* 515 */
-    XML_DTD_INVALID_DEFAULT, /* 516 */
-    XML_DTD_LOAD_ERROR, /* 517 */
-    XML_DTD_MISSING_ATTRIBUTE, /* 518 */
-    XML_DTD_MIXED_CORRUPT, /* 519 */
-    XML_DTD_MULTIPLE_ID, /* 520 */
-    XML_DTD_NO_DOC, /* 521 */
-    XML_DTD_NO_DTD, /* 522 */
-    XML_DTD_NO_ELEM_NAME, /* 523 */
-    XML_DTD_NO_PREFIX, /* 524 */
-    XML_DTD_NO_ROOT, /* 525 */
-    XML_DTD_NOTATION_REDEFINED, /* 526 */
-    XML_DTD_NOTATION_VALUE, /* 527 */
-    XML_DTD_NOT_EMPTY, /* 528 */
-    XML_DTD_NOT_PCDATA, /* 529 */
-    XML_DTD_NOT_STANDALONE, /* 530 */
-    XML_DTD_ROOT_NAME, /* 531 */
-    XML_DTD_STANDALONE_WHITE_SPACE, /* 532 */
-    XML_DTD_UNKNOWN_ATTRIBUTE, /* 533 */
-    XML_DTD_UNKNOWN_ELEM, /* 534 */
-    XML_DTD_UNKNOWN_ENTITY, /* 535 */
-    XML_DTD_UNKNOWN_ID, /* 536 */
-    XML_DTD_UNKNOWN_NOTATION, /* 537 */
-    XML_DTD_STANDALONE_DEFAULTED, /* 538 */
-    XML_DTD_XMLID_VALUE, /* 539 */
-    XML_DTD_XMLID_TYPE, /* 540 */
-    XML_DTD_DUP_TOKEN, /* 541 */
-    XML_HTML_STRUCURE_ERROR = 800,
-    XML_HTML_UNKNOWN_TAG, /* 801 */
-    XML_RNGP_ANYNAME_ATTR_ANCESTOR = 1000,
-    XML_RNGP_ATTR_CONFLICT, /* 1001 */
-    XML_RNGP_ATTRIBUTE_CHILDREN, /* 1002 */
-    XML_RNGP_ATTRIBUTE_CONTENT, /* 1003 */
-    XML_RNGP_ATTRIBUTE_EMPTY, /* 1004 */
-    XML_RNGP_ATTRIBUTE_NOOP, /* 1005 */
-    XML_RNGP_CHOICE_CONTENT, /* 1006 */
-    XML_RNGP_CHOICE_EMPTY, /* 1007 */
-    XML_RNGP_CREATE_FAILURE, /* 1008 */
-    XML_RNGP_DATA_CONTENT, /* 1009 */
-    XML_RNGP_DEF_CHOICE_AND_INTERLEAVE, /* 1010 */
-    XML_RNGP_DEFINE_CREATE_FAILED, /* 1011 */
-    XML_RNGP_DEFINE_EMPTY, /* 1012 */
-    XML_RNGP_DEFINE_MISSING, /* 1013 */
-    XML_RNGP_DEFINE_NAME_MISSING, /* 1014 */
-    XML_RNGP_ELEM_CONTENT_EMPTY, /* 1015 */
-    XML_RNGP_ELEM_CONTENT_ERROR, /* 1016 */
-    XML_RNGP_ELEMENT_EMPTY, /* 1017 */
-    XML_RNGP_ELEMENT_CONTENT, /* 1018 */
-    XML_RNGP_ELEMENT_NAME, /* 1019 */
-    XML_RNGP_ELEMENT_NO_CONTENT, /* 1020 */
-    XML_RNGP_ELEM_TEXT_CONFLICT, /* 1021 */
-    XML_RNGP_EMPTY, /* 1022 */
-    XML_RNGP_EMPTY_CONSTRUCT, /* 1023 */
-    XML_RNGP_EMPTY_CONTENT, /* 1024 */
-    XML_RNGP_EMPTY_NOT_EMPTY, /* 1025 */
-    XML_RNGP_ERROR_TYPE_LIB, /* 1026 */
-    XML_RNGP_EXCEPT_EMPTY, /* 1027 */
-    XML_RNGP_EXCEPT_MISSING, /* 1028 */
-    XML_RNGP_EXCEPT_MULTIPLE, /* 1029 */
-    XML_RNGP_EXCEPT_NO_CONTENT, /* 1030 */
-    XML_RNGP_EXTERNALREF_EMTPY, /* 1031 */
-    XML_RNGP_EXTERNAL_REF_FAILURE, /* 1032 */
-    XML_RNGP_EXTERNALREF_RECURSE, /* 1033 */
-    XML_RNGP_FORBIDDEN_ATTRIBUTE, /* 1034 */
-    XML_RNGP_FOREIGN_ELEMENT, /* 1035 */
-    XML_RNGP_GRAMMAR_CONTENT, /* 1036 */
-    XML_RNGP_GRAMMAR_EMPTY, /* 1037 */
-    XML_RNGP_GRAMMAR_MISSING, /* 1038 */
-    XML_RNGP_GRAMMAR_NO_START, /* 1039 */
-    XML_RNGP_GROUP_ATTR_CONFLICT, /* 1040 */
-    XML_RNGP_HREF_ERROR, /* 1041 */
-    XML_RNGP_INCLUDE_EMPTY, /* 1042 */
-    XML_RNGP_INCLUDE_FAILURE, /* 1043 */
-    XML_RNGP_INCLUDE_RECURSE, /* 1044 */
-    XML_RNGP_INTERLEAVE_ADD, /* 1045 */
-    XML_RNGP_INTERLEAVE_CREATE_FAILED, /* 1046 */
-    XML_RNGP_INTERLEAVE_EMPTY, /* 1047 */
-    XML_RNGP_INTERLEAVE_NO_CONTENT, /* 1048 */
-    XML_RNGP_INVALID_DEFINE_NAME, /* 1049 */
-    XML_RNGP_INVALID_URI, /* 1050 */
-    XML_RNGP_INVALID_VALUE, /* 1051 */
-    XML_RNGP_MISSING_HREF, /* 1052 */
-    XML_RNGP_NAME_MISSING, /* 1053 */
-    XML_RNGP_NEED_COMBINE, /* 1054 */
-    XML_RNGP_NOTALLOWED_NOT_EMPTY, /* 1055 */
-    XML_RNGP_NSNAME_ATTR_ANCESTOR, /* 1056 */
-    XML_RNGP_NSNAME_NO_NS, /* 1057 */
-    XML_RNGP_PARAM_FORBIDDEN, /* 1058 */
-    XML_RNGP_PARAM_NAME_MISSING, /* 1059 */
-    XML_RNGP_PARENTREF_CREATE_FAILED, /* 1060 */
-    XML_RNGP_PARENTREF_NAME_INVALID, /* 1061 */
-    XML_RNGP_PARENTREF_NO_NAME, /* 1062 */
-    XML_RNGP_PARENTREF_NO_PARENT, /* 1063 */
-    XML_RNGP_PARENTREF_NOT_EMPTY, /* 1064 */
-    XML_RNGP_PARSE_ERROR, /* 1065 */
-    XML_RNGP_PAT_ANYNAME_EXCEPT_ANYNAME, /* 1066 */
-    XML_RNGP_PAT_ATTR_ATTR, /* 1067 */
-    XML_RNGP_PAT_ATTR_ELEM, /* 1068 */
-    XML_RNGP_PAT_DATA_EXCEPT_ATTR, /* 1069 */
-    XML_RNGP_PAT_DATA_EXCEPT_ELEM, /* 1070 */
-    XML_RNGP_PAT_DATA_EXCEPT_EMPTY, /* 1071 */
-    XML_RNGP_PAT_DATA_EXCEPT_GROUP, /* 1072 */
-    XML_RNGP_PAT_DATA_EXCEPT_INTERLEAVE, /* 1073 */
-    XML_RNGP_PAT_DATA_EXCEPT_LIST, /* 1074 */
-    XML_RNGP_PAT_DATA_EXCEPT_ONEMORE, /* 1075 */
-    XML_RNGP_PAT_DATA_EXCEPT_REF, /* 1076 */
-    XML_RNGP_PAT_DATA_EXCEPT_TEXT, /* 1077 */
-    XML_RNGP_PAT_LIST_ATTR, /* 1078 */
-    XML_RNGP_PAT_LIST_ELEM, /* 1079 */
-    XML_RNGP_PAT_LIST_INTERLEAVE, /* 1080 */
-    XML_RNGP_PAT_LIST_LIST, /* 1081 */
-    XML_RNGP_PAT_LIST_REF, /* 1082 */
-    XML_RNGP_PAT_LIST_TEXT, /* 1083 */
-    XML_RNGP_PAT_NSNAME_EXCEPT_ANYNAME, /* 1084 */
-    XML_RNGP_PAT_NSNAME_EXCEPT_NSNAME, /* 1085 */
-    XML_RNGP_PAT_ONEMORE_GROUP_ATTR, /* 1086 */
-    XML_RNGP_PAT_ONEMORE_INTERLEAVE_ATTR, /* 1087 */
-    XML_RNGP_PAT_START_ATTR, /* 1088 */
-    XML_RNGP_PAT_START_DATA, /* 1089 */
-    XML_RNGP_PAT_START_EMPTY, /* 1090 */
-    XML_RNGP_PAT_START_GROUP, /* 1091 */
-    XML_RNGP_PAT_START_INTERLEAVE, /* 1092 */
-    XML_RNGP_PAT_START_LIST, /* 1093 */
-    XML_RNGP_PAT_START_ONEMORE, /* 1094 */
-    XML_RNGP_PAT_START_TEXT, /* 1095 */
-    XML_RNGP_PAT_START_VALUE, /* 1096 */
-    XML_RNGP_PREFIX_UNDEFINED, /* 1097 */
-    XML_RNGP_REF_CREATE_FAILED, /* 1098 */
-    XML_RNGP_REF_CYCLE, /* 1099 */
-    XML_RNGP_REF_NAME_INVALID, /* 1100 */
-    XML_RNGP_REF_NO_DEF, /* 1101 */
-    XML_RNGP_REF_NO_NAME, /* 1102 */
-    XML_RNGP_REF_NOT_EMPTY, /* 1103 */
-    XML_RNGP_START_CHOICE_AND_INTERLEAVE, /* 1104 */
-    XML_RNGP_START_CONTENT, /* 1105 */
-    XML_RNGP_START_EMPTY, /* 1106 */
-    XML_RNGP_START_MISSING, /* 1107 */
-    XML_RNGP_TEXT_EXPECTED, /* 1108 */
-    XML_RNGP_TEXT_HAS_CHILD, /* 1109 */
-    XML_RNGP_TYPE_MISSING, /* 1110 */
-    XML_RNGP_TYPE_NOT_FOUND, /* 1111 */
-    XML_RNGP_TYPE_VALUE, /* 1112 */
-    XML_RNGP_UNKNOWN_ATTRIBUTE, /* 1113 */
-    XML_RNGP_UNKNOWN_COMBINE, /* 1114 */
-    XML_RNGP_UNKNOWN_CONSTRUCT, /* 1115 */
-    XML_RNGP_UNKNOWN_TYPE_LIB, /* 1116 */
-    XML_RNGP_URI_FRAGMENT, /* 1117 */
-    XML_RNGP_URI_NOT_ABSOLUTE, /* 1118 */
-    XML_RNGP_VALUE_EMPTY, /* 1119 */
-    XML_RNGP_VALUE_NO_CONTENT, /* 1120 */
-    XML_RNGP_XMLNS_NAME, /* 1121 */
-    XML_RNGP_XML_NS, /* 1122 */
-    XML_XPATH_EXPRESSION_OK = 1200,
-    XML_XPATH_NUMBER_ERROR, /* 1201 */
-    XML_XPATH_UNFINISHED_LITERAL_ERROR, /* 1202 */
-    XML_XPATH_START_LITERAL_ERROR, /* 1203 */
-    XML_XPATH_VARIABLE_REF_ERROR, /* 1204 */
-    XML_XPATH_UNDEF_VARIABLE_ERROR, /* 1205 */
-    XML_XPATH_INVALID_PREDICATE_ERROR, /* 1206 */
-    XML_XPATH_EXPR_ERROR, /* 1207 */
-    XML_XPATH_UNCLOSED_ERROR, /* 1208 */
-    XML_XPATH_UNKNOWN_FUNC_ERROR, /* 1209 */
-    XML_XPATH_INVALID_OPERAND, /* 1210 */
-    XML_XPATH_INVALID_TYPE, /* 1211 */
-    XML_XPATH_INVALID_ARITY, /* 1212 */
-    XML_XPATH_INVALID_CTXT_SIZE, /* 1213 */
-    XML_XPATH_INVALID_CTXT_POSITION, /* 1214 */
-    XML_XPATH_MEMORY_ERROR, /* 1215 */
-    XML_XPTR_SYNTAX_ERROR, /* 1216 */
-    XML_XPTR_RESOURCE_ERROR, /* 1217 */
-    XML_XPTR_SUB_RESOURCE_ERROR, /* 1218 */
-    XML_XPATH_UNDEF_PREFIX_ERROR, /* 1219 */
-    XML_XPATH_ENCODING_ERROR, /* 1220 */
-    XML_XPATH_INVALID_CHAR_ERROR, /* 1221 */
-    XML_TREE_INVALID_HEX = 1300,
-    XML_TREE_INVALID_DEC, /* 1301 */
-    XML_TREE_UNTERMINATED_ENTITY, /* 1302 */
-    XML_TREE_NOT_UTF8, /* 1303 */
-    XML_SAVE_NOT_UTF8 = 1400,
-    XML_SAVE_CHAR_INVALID, /* 1401 */
-    XML_SAVE_NO_DOCTYPE, /* 1402 */
-    XML_SAVE_UNKNOWN_ENCODING, /* 1403 */
-    XML_REGEXP_COMPILE_ERROR = 1450,
-    XML_IO_UNKNOWN = 1500,
-    XML_IO_EACCES, /* 1501 */
-    XML_IO_EAGAIN, /* 1502 */
-    XML_IO_EBADF, /* 1503 */
-    XML_IO_EBADMSG, /* 1504 */
-    XML_IO_EBUSY, /* 1505 */
-    XML_IO_ECANCELED, /* 1506 */
-    XML_IO_ECHILD, /* 1507 */
-    XML_IO_EDEADLK, /* 1508 */
-    XML_IO_EDOM, /* 1509 */
-    XML_IO_EEXIST, /* 1510 */
-    XML_IO_EFAULT, /* 1511 */
-    XML_IO_EFBIG, /* 1512 */
-    XML_IO_EINPROGRESS, /* 1513 */
-    XML_IO_EINTR, /* 1514 */
-    XML_IO_EINVAL, /* 1515 */
-    XML_IO_EIO, /* 1516 */
-    XML_IO_EISDIR, /* 1517 */
-    XML_IO_EMFILE, /* 1518 */
-    XML_IO_EMLINK, /* 1519 */
-    XML_IO_EMSGSIZE, /* 1520 */
-    XML_IO_ENAMETOOLONG, /* 1521 */
-    XML_IO_ENFILE, /* 1522 */
-    XML_IO_ENODEV, /* 1523 */
-    XML_IO_ENOENT, /* 1524 */
-    XML_IO_ENOEXEC, /* 1525 */
-    XML_IO_ENOLCK, /* 1526 */
-    XML_IO_ENOMEM, /* 1527 */
-    XML_IO_ENOSPC, /* 1528 */
-    XML_IO_ENOSYS, /* 1529 */
-    XML_IO_ENOTDIR, /* 1530 */
-    XML_IO_ENOTEMPTY, /* 1531 */
-    XML_IO_ENOTSUP, /* 1532 */
-    XML_IO_ENOTTY, /* 1533 */
-    XML_IO_ENXIO, /* 1534 */
-    XML_IO_EPERM, /* 1535 */
-    XML_IO_EPIPE, /* 1536 */
-    XML_IO_ERANGE, /* 1537 */
-    XML_IO_EROFS, /* 1538 */
-    XML_IO_ESPIPE, /* 1539 */
-    XML_IO_ESRCH, /* 1540 */
-    XML_IO_ETIMEDOUT, /* 1541 */
-    XML_IO_EXDEV, /* 1542 */
-    XML_IO_NETWORK_ATTEMPT, /* 1543 */
-    XML_IO_ENCODER, /* 1544 */
-    XML_IO_FLUSH, /* 1545 */
-    XML_IO_WRITE, /* 1546 */
-    XML_IO_NO_INPUT, /* 1547 */
-    XML_IO_BUFFER_FULL, /* 1548 */
-    XML_IO_LOAD_ERROR, /* 1549 */
-    XML_IO_ENOTSOCK, /* 1550 */
-    XML_IO_EISCONN, /* 1551 */
-    XML_IO_ECONNREFUSED, /* 1552 */
-    XML_IO_ENETUNREACH, /* 1553 */
-    XML_IO_EADDRINUSE, /* 1554 */
-    XML_IO_EALREADY, /* 1555 */
-    XML_IO_EAFNOSUPPORT, /* 1556 */
-    XML_XINCLUDE_RECURSION=1600,
-    XML_XINCLUDE_PARSE_VALUE, /* 1601 */
-    XML_XINCLUDE_ENTITY_DEF_MISMATCH, /* 1602 */
-    XML_XINCLUDE_NO_HREF, /* 1603 */
-    XML_XINCLUDE_NO_FALLBACK, /* 1604 */
-    XML_XINCLUDE_HREF_URI, /* 1605 */
-    XML_XINCLUDE_TEXT_FRAGMENT, /* 1606 */
-    XML_XINCLUDE_TEXT_DOCUMENT, /* 1607 */
-    XML_XINCLUDE_INVALID_CHAR, /* 1608 */
-    XML_XINCLUDE_BUILD_FAILED, /* 1609 */
-    XML_XINCLUDE_UNKNOWN_ENCODING, /* 1610 */
-    XML_XINCLUDE_MULTIPLE_ROOT, /* 1611 */
-    XML_XINCLUDE_XPTR_FAILED, /* 1612 */
-    XML_XINCLUDE_XPTR_RESULT, /* 1613 */
-    XML_XINCLUDE_INCLUDE_IN_INCLUDE, /* 1614 */
-    XML_XINCLUDE_FALLBACKS_IN_INCLUDE, /* 1615 */
-    XML_XINCLUDE_FALLBACK_NOT_IN_INCLUDE, /* 1616 */
-    XML_XINCLUDE_DEPRECATED_NS, /* 1617 */
-    XML_XINCLUDE_FRAGMENT_ID, /* 1618 */
-    XML_CATALOG_MISSING_ATTR = 1650,
-    XML_CATALOG_ENTRY_BROKEN, /* 1651 */
-    XML_CATALOG_PREFER_VALUE, /* 1652 */
-    XML_CATALOG_NOT_CATALOG, /* 1653 */
-    XML_CATALOG_RECURSION, /* 1654 */
-    XML_SCHEMAP_PREFIX_UNDEFINED = 1700,
-    XML_SCHEMAP_ATTRFORMDEFAULT_VALUE, /* 1701 */
-    XML_SCHEMAP_ATTRGRP_NONAME_NOREF, /* 1702 */
-    XML_SCHEMAP_ATTR_NONAME_NOREF, /* 1703 */
-    XML_SCHEMAP_COMPLEXTYPE_NONAME_NOREF, /* 1704 */
-    XML_SCHEMAP_ELEMFORMDEFAULT_VALUE, /* 1705 */
-    XML_SCHEMAP_ELEM_NONAME_NOREF, /* 1706 */
-    XML_SCHEMAP_EXTENSION_NO_BASE, /* 1707 */
-    XML_SCHEMAP_FACET_NO_VALUE, /* 1708 */
-    XML_SCHEMAP_FAILED_BUILD_IMPORT, /* 1709 */
-    XML_SCHEMAP_GROUP_NONAME_NOREF, /* 1710 */
-    XML_SCHEMAP_IMPORT_NAMESPACE_NOT_URI, /* 1711 */
-    XML_SCHEMAP_IMPORT_REDEFINE_NSNAME, /* 1712 */
-    XML_SCHEMAP_IMPORT_SCHEMA_NOT_URI, /* 1713 */
-    XML_SCHEMAP_INVALID_BOOLEAN, /* 1714 */
-    XML_SCHEMAP_INVALID_ENUM, /* 1715 */
-    XML_SCHEMAP_INVALID_FACET, /* 1716 */
-    XML_SCHEMAP_INVALID_FACET_VALUE, /* 1717 */
-    XML_SCHEMAP_INVALID_MAXOCCURS, /* 1718 */
-    XML_SCHEMAP_INVALID_MINOCCURS, /* 1719 */
-    XML_SCHEMAP_INVALID_REF_AND_SUBTYPE, /* 1720 */
-    XML_SCHEMAP_INVALID_WHITE_SPACE, /* 1721 */
-    XML_SCHEMAP_NOATTR_NOREF, /* 1722 */
-    XML_SCHEMAP_NOTATION_NO_NAME, /* 1723 */
-    XML_SCHEMAP_NOTYPE_NOREF, /* 1724 */
-    XML_SCHEMAP_REF_AND_SUBTYPE, /* 1725 */
-    XML_SCHEMAP_RESTRICTION_NONAME_NOREF, /* 1726 */
-    XML_SCHEMAP_SIMPLETYPE_NONAME, /* 1727 */
-    XML_SCHEMAP_TYPE_AND_SUBTYPE, /* 1728 */
-    XML_SCHEMAP_UNKNOWN_ALL_CHILD, /* 1729 */
-    XML_SCHEMAP_UNKNOWN_ANYATTRIBUTE_CHILD, /* 1730 */
-    XML_SCHEMAP_UNKNOWN_ATTR_CHILD, /* 1731 */
-    XML_SCHEMAP_UNKNOWN_ATTRGRP_CHILD, /* 1732 */
-    XML_SCHEMAP_UNKNOWN_ATTRIBUTE_GROUP, /* 1733 */
-    XML_SCHEMAP_UNKNOWN_BASE_TYPE, /* 1734 */
-    XML_SCHEMAP_UNKNOWN_CHOICE_CHILD, /* 1735 */
-    XML_SCHEMAP_UNKNOWN_COMPLEXCONTENT_CHILD, /* 1736 */
-    XML_SCHEMAP_UNKNOWN_COMPLEXTYPE_CHILD, /* 1737 */
-    XML_SCHEMAP_UNKNOWN_ELEM_CHILD, /* 1738 */
-    XML_SCHEMAP_UNKNOWN_EXTENSION_CHILD, /* 1739 */
-    XML_SCHEMAP_UNKNOWN_FACET_CHILD, /* 1740 */
-    XML_SCHEMAP_UNKNOWN_FACET_TYPE, /* 1741 */
-    XML_SCHEMAP_UNKNOWN_GROUP_CHILD, /* 1742 */
-    XML_SCHEMAP_UNKNOWN_IMPORT_CHILD, /* 1743 */
-    XML_SCHEMAP_UNKNOWN_LIST_CHILD, /* 1744 */
-    XML_SCHEMAP_UNKNOWN_NOTATION_CHILD, /* 1745 */
-    XML_SCHEMAP_UNKNOWN_PROCESSCONTENT_CHILD, /* 1746 */
-    XML_SCHEMAP_UNKNOWN_REF, /* 1747 */
-    XML_SCHEMAP_UNKNOWN_RESTRICTION_CHILD, /* 1748 */
-    XML_SCHEMAP_UNKNOWN_SCHEMAS_CHILD, /* 1749 */
-    XML_SCHEMAP_UNKNOWN_SEQUENCE_CHILD, /* 1750 */
-    XML_SCHEMAP_UNKNOWN_SIMPLECONTENT_CHILD, /* 1751 */
-    XML_SCHEMAP_UNKNOWN_SIMPLETYPE_CHILD, /* 1752 */
-    XML_SCHEMAP_UNKNOWN_TYPE, /* 1753 */
-    XML_SCHEMAP_UNKNOWN_UNION_CHILD, /* 1754 */
-    XML_SCHEMAP_ELEM_DEFAULT_FIXED, /* 1755 */
-    XML_SCHEMAP_REGEXP_INVALID, /* 1756 */
-    XML_SCHEMAP_FAILED_LOAD, /* 1757 */
-    XML_SCHEMAP_NOTHING_TO_PARSE, /* 1758 */
-    XML_SCHEMAP_NOROOT, /* 1759 */
-    XML_SCHEMAP_REDEFINED_GROUP, /* 1760 */
-    XML_SCHEMAP_REDEFINED_TYPE, /* 1761 */
-    XML_SCHEMAP_REDEFINED_ELEMENT, /* 1762 */
-    XML_SCHEMAP_REDEFINED_ATTRGROUP, /* 1763 */
-    XML_SCHEMAP_REDEFINED_ATTR, /* 1764 */
-    XML_SCHEMAP_REDEFINED_NOTATION, /* 1765 */
-    XML_SCHEMAP_FAILED_PARSE, /* 1766 */
-    XML_SCHEMAP_UNKNOWN_PREFIX, /* 1767 */
-    XML_SCHEMAP_DEF_AND_PREFIX, /* 1768 */
-    XML_SCHEMAP_UNKNOWN_INCLUDE_CHILD, /* 1769 */
-    XML_SCHEMAP_INCLUDE_SCHEMA_NOT_URI, /* 1770 */
-    XML_SCHEMAP_INCLUDE_SCHEMA_NO_URI, /* 1771 */
-    XML_SCHEMAP_NOT_SCHEMA, /* 1772 */
-    XML_SCHEMAP_UNKNOWN_MEMBER_TYPE, /* 1773 */
-    XML_SCHEMAP_INVALID_ATTR_USE, /* 1774 */
-    XML_SCHEMAP_RECURSIVE, /* 1775 */
-    XML_SCHEMAP_SUPERNUMEROUS_LIST_ITEM_TYPE, /* 1776 */
-    XML_SCHEMAP_INVALID_ATTR_COMBINATION, /* 1777 */
-    XML_SCHEMAP_INVALID_ATTR_INLINE_COMBINATION, /* 1778 */
-    XML_SCHEMAP_MISSING_SIMPLETYPE_CHILD, /* 1779 */
-    XML_SCHEMAP_INVALID_ATTR_NAME, /* 1780 */
-    XML_SCHEMAP_REF_AND_CONTENT, /* 1781 */
-    XML_SCHEMAP_CT_PROPS_CORRECT_1, /* 1782 */
-    XML_SCHEMAP_CT_PROPS_CORRECT_2, /* 1783 */
-    XML_SCHEMAP_CT_PROPS_CORRECT_3, /* 1784 */
-    XML_SCHEMAP_CT_PROPS_CORRECT_4, /* 1785 */
-    XML_SCHEMAP_CT_PROPS_CORRECT_5, /* 1786 */
-    XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1, /* 1787 */
-    XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_1, /* 1788 */
-    XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_2, /* 1789 */
-    XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_2, /* 1790 */
-    XML_SCHEMAP_DERIVATION_OK_RESTRICTION_3, /* 1791 */
-    XML_SCHEMAP_WILDCARD_INVALID_NS_MEMBER, /* 1792 */
-    XML_SCHEMAP_INTERSECTION_NOT_EXPRESSIBLE, /* 1793 */
-    XML_SCHEMAP_UNION_NOT_EXPRESSIBLE, /* 1794 */
-    XML_SCHEMAP_SRC_IMPORT_3_1, /* 1795 */
-    XML_SCHEMAP_SRC_IMPORT_3_2, /* 1796 */
-    XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_1, /* 1797 */
-    XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_2, /* 1798 */
-    XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_3, /* 1799 */
-    XML_SCHEMAP_COS_CT_EXTENDS_1_3, /* 1800 */
-    XML_SCHEMAV_NOROOT = 1801,
-    XML_SCHEMAV_UNDECLAREDELEM, /* 1802 */
-    XML_SCHEMAV_NOTTOPLEVEL, /* 1803 */
-    XML_SCHEMAV_MISSING, /* 1804 */
-    XML_SCHEMAV_WRONGELEM, /* 1805 */
-    XML_SCHEMAV_NOTYPE, /* 1806 */
-    XML_SCHEMAV_NOROLLBACK, /* 1807 */
-    XML_SCHEMAV_ISABSTRACT, /* 1808 */
-    XML_SCHEMAV_NOTEMPTY, /* 1809 */
-    XML_SCHEMAV_ELEMCONT, /* 1810 */
-    XML_SCHEMAV_HAVEDEFAULT, /* 1811 */
-    XML_SCHEMAV_NOTNILLABLE, /* 1812 */
-    XML_SCHEMAV_EXTRACONTENT, /* 1813 */
-    XML_SCHEMAV_INVALIDATTR, /* 1814 */
-    XML_SCHEMAV_INVALIDELEM, /* 1815 */
-    XML_SCHEMAV_NOTDETERMINIST, /* 1816 */
-    XML_SCHEMAV_CONSTRUCT, /* 1817 */
-    XML_SCHEMAV_INTERNAL, /* 1818 */
-    XML_SCHEMAV_NOTSIMPLE, /* 1819 */
-    XML_SCHEMAV_ATTRUNKNOWN, /* 1820 */
-    XML_SCHEMAV_ATTRINVALID, /* 1821 */
-    XML_SCHEMAV_VALUE, /* 1822 */
-    XML_SCHEMAV_FACET, /* 1823 */
-    XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1, /* 1824 */
-    XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_2, /* 1825 */
-    XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_3, /* 1826 */
-    XML_SCHEMAV_CVC_TYPE_3_1_1, /* 1827 */
-    XML_SCHEMAV_CVC_TYPE_3_1_2, /* 1828 */
-    XML_SCHEMAV_CVC_FACET_VALID, /* 1829 */
-    XML_SCHEMAV_CVC_LENGTH_VALID, /* 1830 */
-    XML_SCHEMAV_CVC_MINLENGTH_VALID, /* 1831 */
-    XML_SCHEMAV_CVC_MAXLENGTH_VALID, /* 1832 */
-    XML_SCHEMAV_CVC_MININCLUSIVE_VALID, /* 1833 */
-    XML_SCHEMAV_CVC_MAXINCLUSIVE_VALID, /* 1834 */
-    XML_SCHEMAV_CVC_MINEXCLUSIVE_VALID, /* 1835 */
-    XML_SCHEMAV_CVC_MAXEXCLUSIVE_VALID, /* 1836 */
-    XML_SCHEMAV_CVC_TOTALDIGITS_VALID, /* 1837 */
-    XML_SCHEMAV_CVC_FRACTIONDIGITS_VALID, /* 1838 */
-    XML_SCHEMAV_CVC_PATTERN_VALID, /* 1839 */
-    XML_SCHEMAV_CVC_ENUMERATION_VALID, /* 1840 */
-    XML_SCHEMAV_CVC_COMPLEX_TYPE_2_1, /* 1841 */
-    XML_SCHEMAV_CVC_COMPLEX_TYPE_2_2, /* 1842 */
-    XML_SCHEMAV_CVC_COMPLEX_TYPE_2_3, /* 1843 */
-    XML_SCHEMAV_CVC_COMPLEX_TYPE_2_4, /* 1844 */
-    XML_SCHEMAV_CVC_ELT_1, /* 1845 */
-    XML_SCHEMAV_CVC_ELT_2, /* 1846 */
-    XML_SCHEMAV_CVC_ELT_3_1, /* 1847 */
-    XML_SCHEMAV_CVC_ELT_3_2_1, /* 1848 */
-    XML_SCHEMAV_CVC_ELT_3_2_2, /* 1849 */
-    XML_SCHEMAV_CVC_ELT_4_1, /* 1850 */
-    XML_SCHEMAV_CVC_ELT_4_2, /* 1851 */
-    XML_SCHEMAV_CVC_ELT_4_3, /* 1852 */
-    XML_SCHEMAV_CVC_ELT_5_1_1, /* 1853 */
-    XML_SCHEMAV_CVC_ELT_5_1_2, /* 1854 */
-    XML_SCHEMAV_CVC_ELT_5_2_1, /* 1855 */
-    XML_SCHEMAV_CVC_ELT_5_2_2_1, /* 1856 */
-    XML_SCHEMAV_CVC_ELT_5_2_2_2_1, /* 1857 */
-    XML_SCHEMAV_CVC_ELT_5_2_2_2_2, /* 1858 */
-    XML_SCHEMAV_CVC_ELT_6, /* 1859 */
-    XML_SCHEMAV_CVC_ELT_7, /* 1860 */
-    XML_SCHEMAV_CVC_ATTRIBUTE_1, /* 1861 */
-    XML_SCHEMAV_CVC_ATTRIBUTE_2, /* 1862 */
-    XML_SCHEMAV_CVC_ATTRIBUTE_3, /* 1863 */
-    XML_SCHEMAV_CVC_ATTRIBUTE_4, /* 1864 */
-    XML_SCHEMAV_CVC_COMPLEX_TYPE_3_1, /* 1865 */
-    XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_1, /* 1866 */
-    XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_2, /* 1867 */
-    XML_SCHEMAV_CVC_COMPLEX_TYPE_4, /* 1868 */
-    XML_SCHEMAV_CVC_COMPLEX_TYPE_5_1, /* 1869 */
-    XML_SCHEMAV_CVC_COMPLEX_TYPE_5_2, /* 1870 */
-    XML_SCHEMAV_ELEMENT_CONTENT, /* 1871 */
-    XML_SCHEMAV_DOCUMENT_ELEMENT_MISSING, /* 1872 */
-    XML_SCHEMAV_CVC_COMPLEX_TYPE_1, /* 1873 */
-    XML_SCHEMAV_CVC_AU, /* 1874 */
-    XML_SCHEMAV_CVC_TYPE_1, /* 1875 */
-    XML_SCHEMAV_CVC_TYPE_2, /* 1876 */
-    XML_SCHEMAV_CVC_IDC, /* 1877 */
-    XML_SCHEMAV_CVC_WILDCARD, /* 1878 */
-    XML_SCHEMAV_MISC, /* 1879 */
-    XML_XPTR_UNKNOWN_SCHEME = 1900,
-    XML_XPTR_CHILDSEQ_START, /* 1901 */
-    XML_XPTR_EVAL_FAILED, /* 1902 */
-    XML_XPTR_EXTRA_OBJECTS, /* 1903 */
-    XML_C14N_CREATE_CTXT = 1950,
-    XML_C14N_REQUIRES_UTF8, /* 1951 */
-    XML_C14N_CREATE_STACK, /* 1952 */
-    XML_C14N_INVALID_NODE, /* 1953 */
-    XML_C14N_UNKNOW_NODE, /* 1954 */
-    XML_C14N_RELATIVE_NAMESPACE, /* 1955 */
-    XML_FTP_PASV_ANSWER = 2000,
-    XML_FTP_EPSV_ANSWER, /* 2001 */
-    XML_FTP_ACCNT, /* 2002 */
-    XML_FTP_URL_SYNTAX, /* 2003 */
-    XML_HTTP_URL_SYNTAX = 2020,
-    XML_HTTP_USE_IP, /* 2021 */
-    XML_HTTP_UNKNOWN_HOST, /* 2022 */
-    XML_SCHEMAP_SRC_SIMPLE_TYPE_1 = 3000,
-    XML_SCHEMAP_SRC_SIMPLE_TYPE_2, /* 3001 */
-    XML_SCHEMAP_SRC_SIMPLE_TYPE_3, /* 3002 */
-    XML_SCHEMAP_SRC_SIMPLE_TYPE_4, /* 3003 */
-    XML_SCHEMAP_SRC_RESOLVE, /* 3004 */
-    XML_SCHEMAP_SRC_RESTRICTION_BASE_OR_SIMPLETYPE, /* 3005 */
-    XML_SCHEMAP_SRC_LIST_ITEMTYPE_OR_SIMPLETYPE, /* 3006 */
-    XML_SCHEMAP_SRC_UNION_MEMBERTYPES_OR_SIMPLETYPES, /* 3007 */
-    XML_SCHEMAP_ST_PROPS_CORRECT_1, /* 3008 */
-    XML_SCHEMAP_ST_PROPS_CORRECT_2, /* 3009 */
-    XML_SCHEMAP_ST_PROPS_CORRECT_3, /* 3010 */
-    XML_SCHEMAP_COS_ST_RESTRICTS_1_1, /* 3011 */
-    XML_SCHEMAP_COS_ST_RESTRICTS_1_2, /* 3012 */
-    XML_SCHEMAP_COS_ST_RESTRICTS_1_3_1, /* 3013 */
-    XML_SCHEMAP_COS_ST_RESTRICTS_1_3_2, /* 3014 */
-    XML_SCHEMAP_COS_ST_RESTRICTS_2_1, /* 3015 */
-    XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_1, /* 3016 */
-    XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_2, /* 3017 */
-    XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_1, /* 3018 */
-    XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_2, /* 3019 */
-    XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_3, /* 3020 */
-    XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_4, /* 3021 */
-    XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_5, /* 3022 */
-    XML_SCHEMAP_COS_ST_RESTRICTS_3_1, /* 3023 */
-    XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1, /* 3024 */
-    XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1_2, /* 3025 */
-    XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_2, /* 3026 */
-    XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_1, /* 3027 */
-    XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_3, /* 3028 */
-    XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_4, /* 3029 */
-    XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_5, /* 3030 */
-    XML_SCHEMAP_COS_ST_DERIVED_OK_2_1, /* 3031 */
-    XML_SCHEMAP_COS_ST_DERIVED_OK_2_2, /* 3032 */
-    XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, /* 3033 */
-    XML_SCHEMAP_S4S_ELEM_MISSING, /* 3034 */
-    XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, /* 3035 */
-    XML_SCHEMAP_S4S_ATTR_MISSING, /* 3036 */
-    XML_SCHEMAP_S4S_ATTR_INVALID_VALUE, /* 3037 */
-    XML_SCHEMAP_SRC_ELEMENT_1, /* 3038 */
-    XML_SCHEMAP_SRC_ELEMENT_2_1, /* 3039 */
-    XML_SCHEMAP_SRC_ELEMENT_2_2, /* 3040 */
-    XML_SCHEMAP_SRC_ELEMENT_3, /* 3041 */
-    XML_SCHEMAP_P_PROPS_CORRECT_1, /* 3042 */
-    XML_SCHEMAP_P_PROPS_CORRECT_2_1, /* 3043 */
-    XML_SCHEMAP_P_PROPS_CORRECT_2_2, /* 3044 */
-    XML_SCHEMAP_E_PROPS_CORRECT_2, /* 3045 */
-    XML_SCHEMAP_E_PROPS_CORRECT_3, /* 3046 */
-    XML_SCHEMAP_E_PROPS_CORRECT_4, /* 3047 */
-    XML_SCHEMAP_E_PROPS_CORRECT_5, /* 3048 */
-    XML_SCHEMAP_E_PROPS_CORRECT_6, /* 3049 */
-    XML_SCHEMAP_SRC_INCLUDE, /* 3050 */
-    XML_SCHEMAP_SRC_ATTRIBUTE_1, /* 3051 */
-    XML_SCHEMAP_SRC_ATTRIBUTE_2, /* 3052 */
-    XML_SCHEMAP_SRC_ATTRIBUTE_3_1, /* 3053 */
-    XML_SCHEMAP_SRC_ATTRIBUTE_3_2, /* 3054 */
-    XML_SCHEMAP_SRC_ATTRIBUTE_4, /* 3055 */
-    XML_SCHEMAP_NO_XMLNS, /* 3056 */
-    XML_SCHEMAP_NO_XSI, /* 3057 */
-    XML_SCHEMAP_COS_VALID_DEFAULT_1, /* 3058 */
-    XML_SCHEMAP_COS_VALID_DEFAULT_2_1, /* 3059 */
-    XML_SCHEMAP_COS_VALID_DEFAULT_2_2_1, /* 3060 */
-    XML_SCHEMAP_COS_VALID_DEFAULT_2_2_2, /* 3061 */
-    XML_SCHEMAP_CVC_SIMPLE_TYPE, /* 3062 */
-    XML_SCHEMAP_COS_CT_EXTENDS_1_1, /* 3063 */
-    XML_SCHEMAP_SRC_IMPORT_1_1, /* 3064 */
-    XML_SCHEMAP_SRC_IMPORT_1_2, /* 3065 */
-    XML_SCHEMAP_SRC_IMPORT_2, /* 3066 */
-    XML_SCHEMAP_SRC_IMPORT_2_1, /* 3067 */
-    XML_SCHEMAP_SRC_IMPORT_2_2, /* 3068 */
-    XML_SCHEMAP_INTERNAL, /* 3069 non-W3C */
-    XML_SCHEMAP_NOT_DETERMINISTIC, /* 3070 non-W3C */
-    XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_1, /* 3071 */
-    XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_2, /* 3072 */
-    XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_3, /* 3073 */
-    XML_SCHEMAP_MG_PROPS_CORRECT_1, /* 3074 */
-    XML_SCHEMAP_MG_PROPS_CORRECT_2, /* 3075 */
-    XML_SCHEMAP_SRC_CT_1, /* 3076 */
-    XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_3, /* 3077 */
-    XML_SCHEMAP_AU_PROPS_CORRECT_2, /* 3078 */
-    XML_SCHEMAP_A_PROPS_CORRECT_2, /* 3079 */
-    XML_SCHEMAP_C_PROPS_CORRECT, /* 3080 */
-    XML_SCHEMAP_SRC_REDEFINE, /* 3081 */
-    XML_SCHEMAP_SRC_IMPORT, /* 3082 */
-    XML_SCHEMAP_WARN_SKIP_SCHEMA, /* 3083 */
-    XML_SCHEMAP_WARN_UNLOCATED_SCHEMA, /* 3084 */
-    XML_SCHEMAP_WARN_ATTR_REDECL_PROH, /* 3085 */
-    XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH, /* 3085 */
-    XML_SCHEMAP_AG_PROPS_CORRECT, /* 3086 */
-    XML_SCHEMAP_COS_CT_EXTENDS_1_2, /* 3087 */
-    XML_SCHEMAP_AU_PROPS_CORRECT, /* 3088 */
-    XML_SCHEMAP_A_PROPS_CORRECT_3, /* 3089 */
-    XML_SCHEMAP_COS_ALL_LIMITED, /* 3090 */
-    XML_SCHEMATRONV_ASSERT = 4000, /* 4000 */
-    XML_SCHEMATRONV_REPORT,
-    XML_MODULE_OPEN = 4900, /* 4900 */
-    XML_MODULE_CLOSE, /* 4901 */
-    XML_CHECK_FOUND_ELEMENT = 5000,
-    XML_CHECK_FOUND_ATTRIBUTE, /* 5001 */
-    XML_CHECK_FOUND_TEXT, /* 5002 */
-    XML_CHECK_FOUND_CDATA, /* 5003 */
-    XML_CHECK_FOUND_ENTITYREF, /* 5004 */
-    XML_CHECK_FOUND_ENTITY, /* 5005 */
-    XML_CHECK_FOUND_PI, /* 5006 */
-    XML_CHECK_FOUND_COMMENT, /* 5007 */
-    XML_CHECK_FOUND_DOCTYPE, /* 5008 */
-    XML_CHECK_FOUND_FRAGMENT, /* 5009 */
-    XML_CHECK_FOUND_NOTATION, /* 5010 */
-    XML_CHECK_UNKNOWN_NODE, /* 5011 */
-    XML_CHECK_ENTITY_TYPE, /* 5012 */
-    XML_CHECK_NO_PARENT, /* 5013 */
-    XML_CHECK_NO_DOC, /* 5014 */
-    XML_CHECK_NO_NAME, /* 5015 */
-    XML_CHECK_NO_ELEM, /* 5016 */
-    XML_CHECK_WRONG_DOC, /* 5017 */
-    XML_CHECK_NO_PREV, /* 5018 */
-    XML_CHECK_WRONG_PREV, /* 5019 */
-    XML_CHECK_NO_NEXT, /* 5020 */
-    XML_CHECK_WRONG_NEXT, /* 5021 */
-    XML_CHECK_NOT_DTD, /* 5022 */
-    XML_CHECK_NOT_ATTR, /* 5023 */
-    XML_CHECK_NOT_ATTR_DECL, /* 5024 */
-    XML_CHECK_NOT_ELEM_DECL, /* 5025 */
-    XML_CHECK_NOT_ENTITY_DECL, /* 5026 */
-    XML_CHECK_NOT_NS_DECL, /* 5027 */
-    XML_CHECK_NO_HREF, /* 5028 */
-    XML_CHECK_WRONG_PARENT,/* 5029 */
-    XML_CHECK_NS_SCOPE, /* 5030 */
-    XML_CHECK_NS_ANCESTOR, /* 5031 */
-    XML_CHECK_NOT_UTF8, /* 5032 */
-    XML_CHECK_NO_DICT, /* 5033 */
-    XML_CHECK_NOT_NCNAME, /* 5034 */
-    XML_CHECK_OUTSIDE_DICT, /* 5035 */
-    XML_CHECK_WRONG_NAME, /* 5036 */
-    XML_CHECK_NAME_NOT_NULL, /* 5037 */
-    XML_I18N_NO_NAME = 6000,
-    XML_I18N_NO_HANDLER, /* 6001 */
-    XML_I18N_EXCESS_HANDLER, /* 6002 */
-    XML_I18N_CONV_FAILED, /* 6003 */
-    XML_I18N_NO_OUTPUT /* 6004 */
-#if 0
-    XML_CHECK_, /* 5033 */
-    XML_CHECK_X /* 503 */
-#endif
-} xmlParserErrors;
-
-/**
- * xmlGenericErrorFunc:
- * @ctx:  a parsing context
- * @msg:  the message
- * @...:  the extra arguments of the varags to format the message
- *
- * Signature of the function to use when there is an error and
- * no parsing or validity context available .
- */
-typedef void (XMLCDECL *xmlGenericErrorFunc) (void *ctx,
-				 const char *msg,
-				 ...) ATTRIBUTE_PRINTF(2,3);
-/**
- * xmlStructuredErrorFunc:
- * @userData:  user provided data for the error callback
- * @error:  the error being raised.
- *
- * Signature of the function to use when there is an error and
- * the module handles the new error reporting mechanism.
- */
-typedef void (XMLCALL *xmlStructuredErrorFunc) (void *userData, xmlErrorPtr error);
-
-/*
- * Use the following function to reset the two global variables
- * xmlGenericError and xmlGenericErrorContext.
- */
-XMLPUBFUN void XMLCALL
-    xmlSetGenericErrorFunc	(void *ctx,
-				 xmlGenericErrorFunc handler);
-XMLPUBFUN void XMLCALL
-    initGenericErrorDefaultFunc	(xmlGenericErrorFunc *handler);
-
-XMLPUBFUN void XMLCALL
-    xmlSetStructuredErrorFunc	(void *ctx,
-				 xmlStructuredErrorFunc handler);
-/*
- * Default message routines used by SAX and Valid context for error
- * and warning reporting.
- */
-XMLPUBFUN void XMLCDECL
-    xmlParserError		(void *ctx,
-				 const char *msg,
-				 ...) ATTRIBUTE_PRINTF(2,3);
-XMLPUBFUN void XMLCDECL
-    xmlParserWarning		(void *ctx,
-				 const char *msg,
-				 ...) ATTRIBUTE_PRINTF(2,3);
-XMLPUBFUN void XMLCDECL
-    xmlParserValidityError	(void *ctx,
-				 const char *msg,
-				 ...) ATTRIBUTE_PRINTF(2,3);
-XMLPUBFUN void XMLCDECL
-    xmlParserValidityWarning	(void *ctx,
-				 const char *msg,
-				 ...) ATTRIBUTE_PRINTF(2,3);
-XMLPUBFUN void XMLCALL
-    xmlParserPrintFileInfo	(xmlParserInputPtr input);
-XMLPUBFUN void XMLCALL
-    xmlParserPrintFileContext	(xmlParserInputPtr input);
-
-/*
- * Extended error information routines
- */
-XMLPUBFUN xmlErrorPtr XMLCALL
-    xmlGetLastError		(void);
-XMLPUBFUN void XMLCALL
-    xmlResetLastError		(void);
-XMLPUBFUN xmlErrorPtr XMLCALL
-    xmlCtxtGetLastError		(void *ctx);
-XMLPUBFUN void XMLCALL
-    xmlCtxtResetLastError	(void *ctx);
-XMLPUBFUN void XMLCALL
-    xmlResetError		(xmlErrorPtr err);
-XMLPUBFUN int XMLCALL
-    xmlCopyError		(xmlErrorPtr from,
-				 xmlErrorPtr to);
-
-#ifdef IN_LIBXML
-/*
- * Internal callback reporting routine
- */
-XMLPUBFUN void XMLCALL
-    __xmlRaiseError		(xmlStructuredErrorFunc schannel,
-				 xmlGenericErrorFunc channel,
-				 void *data,
-                                 void *ctx,
-				 void *node,
-				 int domain,
-				 int code,
-				 xmlErrorLevel level,
-				 const char *file,
-				 int line,
-				 const char *str1,
-				 const char *str2,
-				 const char *str3,
-				 int int1,
-				 int col,
-				 const char *msg,
-				 ...) ATTRIBUTE_PRINTF(16,17);
-XMLPUBFUN void XMLCALL
-    __xmlSimpleError		(int domain,
-				 int code,
-				 xmlNodePtr node,
-				 const char *msg,
-				 const char *extra);
-#endif
-#ifdef __cplusplus
-}
-#endif
-#endif /* __XML_ERROR_H__ */
diff --git a/interfaces/ext/libxml/xmlexports.h b/interfaces/ext/libxml/xmlexports.h
deleted file mode 100644
index 29a6f54..0000000
--- a/interfaces/ext/libxml/xmlexports.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Summary: macros for marking symbols as exportable/importable.
- * Description: macros for marking symbols as exportable/importable.
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Igor Zlatovic <igor at zlatkovic.com>
- */
-
-#ifndef __XML_EXPORTS_H__
-#define __XML_EXPORTS_H__
-
-/**
- * XMLPUBFUN, XMLPUBVAR, XMLCALL
- *
- * Macros which declare an exportable function, an exportable variable and
- * the calling convention used for functions.
- *
- * Please use an extra block for every platform/compiler combination when
- * modifying this, rather than overlong #ifdef lines. This helps
- * readability as well as the fact that different compilers on the same
- * platform might need different definitions.
- */
-
-/**
- * XMLPUBFUN:
- *
- * Macros which declare an exportable function
- */
-#define XMLPUBFUN
-/**
- * XMLPUBVAR:
- *
- * Macros which declare an exportable variable
- */
-#define XMLPUBVAR extern
-/**
- * XMLCALL:
- *
- * Macros which declare the called convention for exported functions
- */
-#define XMLCALL
-/**
- * XMLCDECL:
- *
- * Macro which declares the calling convention for exported functions that 
- * use '...'.
- */
-#define XMLCDECL
-
-/** DOC_DISABLE */
-
-/* Windows platform with MS compiler */
-#if defined(_WIN32) && defined(_MSC_VER)
-  #undef XMLPUBFUN
-  #undef XMLPUBVAR
-  #undef XMLCALL
-  #undef XMLCDECL
-  #if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
-    #define XMLPUBFUN __declspec(dllexport)
-    #define XMLPUBVAR __declspec(dllexport)
-  #else
-    #define XMLPUBFUN
-    #if !defined(LIBXML_STATIC)
-      #define XMLPUBVAR __declspec(dllimport) extern
-    #else
-      #define XMLPUBVAR extern
-    #endif
-  #endif
-  #if defined(LIBXML_FASTCALL)
-    #define XMLCALL __fastcall
-  #else
-    #define XMLCALL __cdecl
-  #endif
-  #define XMLCDECL __cdecl
-  #if !defined _REENTRANT
-    #define _REENTRANT
-  #endif
-#endif
-
-/* Windows platform with Borland compiler */
-#if defined(_WIN32) && defined(__BORLANDC__)
-  #undef XMLPUBFUN
-  #undef XMLPUBVAR
-  #undef XMLCALL
-  #undef XMLCDECL
-  #if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
-    #define XMLPUBFUN __declspec(dllexport)
-    #define XMLPUBVAR __declspec(dllexport) extern
-  #else
-    #define XMLPUBFUN
-    #if !defined(LIBXML_STATIC)
-      #define XMLPUBVAR __declspec(dllimport) extern
-    #else
-      #define XMLPUBVAR extern
-    #endif
-  #endif
-  #define XMLCALL __cdecl
-  #define XMLCDECL __cdecl
-  #if !defined _REENTRANT
-    #define _REENTRANT
-  #endif
-#endif
-
-/* Windows platform with GNU compiler (Mingw) */
-#if defined(_WIN32) && defined(__MINGW32__)
-  #undef XMLPUBFUN
-  #undef XMLPUBVAR
-  #undef XMLCALL
-  #undef XMLCDECL
-  #if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
-    #define XMLPUBFUN __declspec(dllexport)
-    #define XMLPUBVAR __declspec(dllexport)
-  #else
-    #define XMLPUBFUN
-    #if !defined(LIBXML_STATIC)
-      #define XMLPUBVAR __declspec(dllimport) extern
-    #else
-      #define XMLPUBVAR extern
-    #endif
-  #endif
-  #define XMLCALL __cdecl
-  #define XMLCDECL __cdecl
-  #if !defined _REENTRANT
-    #define _REENTRANT
-  #endif
-#endif
-
-/* Cygwin platform, GNU compiler */
-#if defined(_WIN32) && defined(__CYGWIN__)
-  #undef XMLPUBFUN
-  #undef XMLPUBVAR
-  #undef XMLCALL
-  #undef XMLCDECL
-  #if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
-    #define XMLPUBFUN __declspec(dllexport)
-    #define XMLPUBVAR __declspec(dllexport)
-  #else
-    #define XMLPUBFUN
-    #if !defined(LIBXML_STATIC)
-      #define XMLPUBVAR __declspec(dllimport) extern
-    #else
-      #define XMLPUBVAR
-    #endif
-  #endif
-  #define XMLCALL __cdecl
-  #define XMLCDECL __cdecl
-#endif
-
-/* Compatibility */
-#if !defined(LIBXML_DLL_IMPORT)
-#define LIBXML_DLL_IMPORT XMLPUBVAR
-#endif
-
-#endif /* __XML_EXPORTS_H__ */
-
-
diff --git a/interfaces/ext/libxml/xmlmemory.h b/interfaces/ext/libxml/xmlmemory.h
deleted file mode 100644
index 8f3b109..0000000
--- a/interfaces/ext/libxml/xmlmemory.h
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Summary: interface for the memory allocator
- * Description: provides interfaces for the memory allocator,
- *              including debugging capabilities.
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-
-#ifndef __DEBUG_MEMORY_ALLOC__
-#define __DEBUG_MEMORY_ALLOC__
-
-#include <stdio.h>
-#include <libxml/xmlversion.h>
-
-/**
- * DEBUG_MEMORY:
- *
- * DEBUG_MEMORY replaces the allocator with a collect and debug
- * shell to the libc allocator.
- * DEBUG_MEMORY should only be activated when debugging
- * libxml i.e. if libxml has been configured with --with-debug-mem too.
- */
-/* #define DEBUG_MEMORY_FREED */
-/* #define DEBUG_MEMORY_LOCATION */
-
-#ifdef DEBUG
-#ifndef DEBUG_MEMORY
-#define DEBUG_MEMORY
-#endif
-#endif
-
-/**
- * DEBUG_MEMORY_LOCATION:
- *
- * DEBUG_MEMORY_LOCATION should be activated only when debugging
- * libxml i.e. if libxml has been configured with --with-debug-mem too.
- */
-#ifdef DEBUG_MEMORY_LOCATION
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * The XML memory wrapper support 4 basic overloadable functions.
- */
-/**
- * xmlFreeFunc:
- * @mem: an already allocated block of memory
- *
- * Signature for a free() implementation.
- */
-typedef void (XMLCALL *xmlFreeFunc)(void *mem);
-/**
- * xmlMallocFunc:
- * @size:  the size requested in bytes
- *
- * Signature for a malloc() implementation.
- *
- * Returns a pointer to the newly allocated block or NULL in case of error.
- */
-typedef void *(ATTRIBUTE_ALLOC_SIZE(1) XMLCALL *xmlMallocFunc)(size_t size);
-
-/**
- * xmlReallocFunc:
- * @mem: an already allocated block of memory
- * @size:  the new size requested in bytes
- *
- * Signature for a realloc() implementation.
- *
- * Returns a pointer to the newly reallocated block or NULL in case of error.
- */
-typedef void *(XMLCALL *xmlReallocFunc)(void *mem, size_t size);
-
-/**
- * xmlStrdupFunc:
- * @str: a zero terminated string
- *
- * Signature for an strdup() implementation.
- *
- * Returns the copy of the string or NULL in case of error.
- */
-typedef char *(XMLCALL *xmlStrdupFunc)(const char *str);
-
-/*
- * The 4 interfaces used for all memory handling within libxml.
-LIBXML_DLL_IMPORT extern xmlFreeFunc xmlFree;
-LIBXML_DLL_IMPORT extern xmlMallocFunc xmlMalloc;
-LIBXML_DLL_IMPORT extern xmlMallocFunc xmlMallocAtomic;
-LIBXML_DLL_IMPORT extern xmlReallocFunc xmlRealloc;
-LIBXML_DLL_IMPORT extern xmlStrdupFunc xmlMemStrdup;
- */
-
-/*
- * The way to overload the existing functions.
- * The xmlGc function have an extra entry for atomic block
- * allocations useful for garbage collected memory allocators
- */
-XMLPUBFUN int XMLCALL
-	xmlMemSetup	(xmlFreeFunc freeFunc,
-			 xmlMallocFunc mallocFunc,
-			 xmlReallocFunc reallocFunc,
-			 xmlStrdupFunc strdupFunc);
-XMLPUBFUN int XMLCALL
-	xmlMemGet	(xmlFreeFunc *freeFunc,
-			 xmlMallocFunc *mallocFunc,
-			 xmlReallocFunc *reallocFunc,
-			 xmlStrdupFunc *strdupFunc);
-XMLPUBFUN int XMLCALL
-	xmlGcMemSetup	(xmlFreeFunc freeFunc,
-			 xmlMallocFunc mallocFunc,
-			 xmlMallocFunc mallocAtomicFunc,
-			 xmlReallocFunc reallocFunc,
-			 xmlStrdupFunc strdupFunc);
-XMLPUBFUN int XMLCALL
-	xmlGcMemGet	(xmlFreeFunc *freeFunc,
-			 xmlMallocFunc *mallocFunc,
-			 xmlMallocFunc *mallocAtomicFunc,
-			 xmlReallocFunc *reallocFunc,
-			 xmlStrdupFunc *strdupFunc);
-
-/*
- * Initialization of the memory layer.
- */
-XMLPUBFUN int XMLCALL
-	xmlInitMemory	(void);
-
-/*
- * Cleanup of the memory layer.
- */
-XMLPUBFUN void XMLCALL
-                xmlCleanupMemory        (void);
-/*
- * These are specific to the XML debug memory wrapper.
- */
-XMLPUBFUN int XMLCALL
-	xmlMemUsed	(void);
-XMLPUBFUN int XMLCALL
-	xmlMemBlocks	(void);
-XMLPUBFUN void XMLCALL
-	xmlMemDisplay	(FILE *fp);
-XMLPUBFUN void XMLCALL
-	xmlMemDisplayLast(FILE *fp, long nbBytes);
-XMLPUBFUN void XMLCALL
-	xmlMemShow	(FILE *fp, int nr);
-XMLPUBFUN void XMLCALL
-	xmlMemoryDump	(void);
-XMLPUBFUN void * XMLCALL
-	xmlMemMalloc	(size_t size) ATTRIBUTE_ALLOC_SIZE(1);
-XMLPUBFUN void * XMLCALL
-	xmlMemRealloc	(void *ptr,size_t size);
-XMLPUBFUN void XMLCALL
-	xmlMemFree	(void *ptr);
-XMLPUBFUN char * XMLCALL
-	xmlMemoryStrdup	(const char *str);
-XMLPUBFUN void * XMLCALL
-	xmlMallocLoc	(size_t size, const char *file, int line) ATTRIBUTE_ALLOC_SIZE(1);
-XMLPUBFUN void * XMLCALL
-	xmlReallocLoc	(void *ptr, size_t size, const char *file, int line);
-XMLPUBFUN void * XMLCALL
-	xmlMallocAtomicLoc (size_t size, const char *file, int line) ATTRIBUTE_ALLOC_SIZE(1);
-XMLPUBFUN char * XMLCALL
-	xmlMemStrdupLoc	(const char *str, const char *file, int line);
-
-
-#ifdef DEBUG_MEMORY_LOCATION
-/**
- * xmlMalloc:
- * @size:  number of bytes to allocate
- *
- * Wrapper for the malloc() function used in the XML library.
- *
- * Returns the pointer to the allocated area or NULL in case of error.
- */
-#define xmlMalloc(size) xmlMallocLoc((size), __FILE__, __LINE__)
-/**
- * xmlMallocAtomic:
- * @size:  number of bytes to allocate
- *
- * Wrapper for the malloc() function used in the XML library for allocation
- * of block not containing pointers to other areas.
- *
- * Returns the pointer to the allocated area or NULL in case of error.
- */
-#define xmlMallocAtomic(size) xmlMallocAtomicLoc((size), __FILE__, __LINE__)
-/**
- * xmlRealloc:
- * @ptr:  pointer to the existing allocated area
- * @size:  number of bytes to allocate
- *
- * Wrapper for the realloc() function used in the XML library.
- *
- * Returns the pointer to the allocated area or NULL in case of error.
- */
-#define xmlRealloc(ptr, size) xmlReallocLoc((ptr), (size), __FILE__, __LINE__)
-/**
- * xmlMemStrdup:
- * @str:  pointer to the existing string
- *
- * Wrapper for the strdup() function, xmlStrdup() is usually preferred.
- *
- * Returns the pointer to the allocated area or NULL in case of error.
- */
-#define xmlMemStrdup(str) xmlMemStrdupLoc((str), __FILE__, __LINE__)
-
-#endif /* DEBUG_MEMORY_LOCATION */
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#ifndef __XML_GLOBALS_H
-#ifndef __XML_THREADS_H__
-#include <libxml/threads.h>
-#include <libxml/globals.h>
-#endif
-#endif
-
-#endif  /* __DEBUG_MEMORY_ALLOC__ */
-
diff --git a/interfaces/ext/libxml/xmlmodule.h b/interfaces/ext/libxml/xmlmodule.h
deleted file mode 100644
index 8f4a560..0000000
--- a/interfaces/ext/libxml/xmlmodule.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Summary: dynamic module loading
- * Description: basic API for dynamic module loading, used by
- *              libexslt added in 2.6.17
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Joel W. Reed
- */
-
-#ifndef __XML_MODULE_H__
-#define __XML_MODULE_H__
-
-#include <libxml/xmlversion.h>
-
-#ifdef LIBXML_MODULES_ENABLED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * xmlModulePtr:
- *
- * A handle to a dynamically loaded module
- */
-typedef struct _xmlModule xmlModule;
-typedef xmlModule *xmlModulePtr;
-
-/**
- * xmlModuleOption:
- *
- * enumeration of options that can be passed down to xmlModuleOpen()
- */
-typedef enum {
-    XML_MODULE_LAZY = 1,	/* lazy binding */
-    XML_MODULE_LOCAL= 2		/* local binding */
-} xmlModuleOption;
-
-XMLPUBFUN xmlModulePtr XMLCALL xmlModuleOpen	(const char *filename,
-						 int options);
-
-XMLPUBFUN int XMLCALL xmlModuleSymbol		(xmlModulePtr module,
-						 const char* name,
-						 void **result);
-
-XMLPUBFUN int XMLCALL xmlModuleClose		(xmlModulePtr module);
-
-XMLPUBFUN int XMLCALL xmlModuleFree		(xmlModulePtr module);
-
-#ifdef __cplusplus
-}
-#endif 
-
-#endif /* LIBXML_MODULES_ENABLED */
-
-#endif /*__XML_MODULE_H__ */
diff --git a/interfaces/ext/libxml/xmlreader.h b/interfaces/ext/libxml/xmlreader.h
deleted file mode 100644
index 6964482..0000000
--- a/interfaces/ext/libxml/xmlreader.h
+++ /dev/null
@@ -1,424 +0,0 @@
-/*
- * Summary: the XMLReader implementation
- * Description: API of the XML streaming API based on C# interfaces.
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#ifndef __XML_XMLREADER_H__
-#define __XML_XMLREADER_H__
-
-#include <libxml/xmlversion.h>
-#include <libxml/tree.h>
-#include <libxml/xmlIO.h>
-#ifdef LIBXML_SCHEMAS_ENABLED
-#include <libxml/relaxng.h>
-#include <libxml/xmlschemas.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * xmlParserSeverities:
- *
- * How severe an error callback is when the per-reader error callback API
- * is used.
- */
-typedef enum {
-    XML_PARSER_SEVERITY_VALIDITY_WARNING = 1,
-    XML_PARSER_SEVERITY_VALIDITY_ERROR = 2,
-    XML_PARSER_SEVERITY_WARNING = 3,
-    XML_PARSER_SEVERITY_ERROR = 4
-} xmlParserSeverities;
-
-#ifdef LIBXML_READER_ENABLED
-
-/**
- * xmlTextReaderMode:
- *
- * Internal state values for the reader.
- */
-typedef enum {
-    XML_TEXTREADER_MODE_INITIAL = 0,
-    XML_TEXTREADER_MODE_INTERACTIVE = 1,
-    XML_TEXTREADER_MODE_ERROR = 2,
-    XML_TEXTREADER_MODE_EOF =3,
-    XML_TEXTREADER_MODE_CLOSED = 4,
-    XML_TEXTREADER_MODE_READING = 5
-} xmlTextReaderMode;
-
-/**
- * xmlParserProperties:
- *
- * Some common options to use with xmlTextReaderSetParserProp, but it
- * is better to use xmlParserOption and the xmlReaderNewxxx and
- * xmlReaderForxxx APIs now.
- */
-typedef enum {
-    XML_PARSER_LOADDTD = 1,
-    XML_PARSER_DEFAULTATTRS = 2,
-    XML_PARSER_VALIDATE = 3,
-    XML_PARSER_SUBST_ENTITIES = 4
-} xmlParserProperties;
-
-/**
- * xmlReaderTypes:
- *
- * Predefined constants for the different types of nodes.
- */
-typedef enum {
-    XML_READER_TYPE_NONE = 0,
-    XML_READER_TYPE_ELEMENT = 1,
-    XML_READER_TYPE_ATTRIBUTE = 2,
-    XML_READER_TYPE_TEXT = 3,
-    XML_READER_TYPE_CDATA = 4,
-    XML_READER_TYPE_ENTITY_REFERENCE = 5,
-    XML_READER_TYPE_ENTITY = 6,
-    XML_READER_TYPE_PROCESSING_INSTRUCTION = 7,
-    XML_READER_TYPE_COMMENT = 8,
-    XML_READER_TYPE_DOCUMENT = 9,
-    XML_READER_TYPE_DOCUMENT_TYPE = 10,
-    XML_READER_TYPE_DOCUMENT_FRAGMENT = 11,
-    XML_READER_TYPE_NOTATION = 12,
-    XML_READER_TYPE_WHITESPACE = 13,
-    XML_READER_TYPE_SIGNIFICANT_WHITESPACE = 14,
-    XML_READER_TYPE_END_ELEMENT = 15,
-    XML_READER_TYPE_END_ENTITY = 16,
-    XML_READER_TYPE_XML_DECLARATION = 17
-} xmlReaderTypes;
-
-/**
- * xmlTextReader:
- *
- * Structure for an xmlReader context.
- */
-typedef struct _xmlTextReader xmlTextReader;
-
-/**
- * xmlTextReaderPtr:
- *
- * Pointer to an xmlReader context.
- */
-typedef xmlTextReader *xmlTextReaderPtr;
-
-/*
- * Constructors & Destructor
- */
-XMLPUBFUN xmlTextReaderPtr XMLCALL
-			xmlNewTextReader	(xmlParserInputBufferPtr input,
-	                                         const char *URI);
-XMLPUBFUN xmlTextReaderPtr XMLCALL
-			xmlNewTextReaderFilename(const char *URI);
-
-XMLPUBFUN void XMLCALL
-			xmlFreeTextReader	(xmlTextReaderPtr reader);
-
-XMLPUBFUN int XMLCALL
-            xmlTextReaderSetup(xmlTextReaderPtr reader,
-                   xmlParserInputBufferPtr input, const char *URL,
-                   const char *encoding, int options);
-
-/*
- * Iterators
- */
-XMLPUBFUN int XMLCALL
-			xmlTextReaderRead	(xmlTextReaderPtr reader);
-
-#ifdef LIBXML_WRITER_ENABLED
-XMLPUBFUN xmlChar * XMLCALL
-			xmlTextReaderReadInnerXml	(xmlTextReaderPtr reader);
-
-XMLPUBFUN xmlChar * XMLCALL
-			xmlTextReaderReadOuterXml	(xmlTextReaderPtr reader);
-#endif
-
-XMLPUBFUN xmlChar * XMLCALL
-			xmlTextReaderReadString		(xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
-			xmlTextReaderReadAttributeValue	(xmlTextReaderPtr reader);
-
-/*
- * Attributes of the node
- */
-XMLPUBFUN int XMLCALL
-			xmlTextReaderAttributeCount(xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
-			xmlTextReaderDepth	(xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
-			xmlTextReaderHasAttributes(xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
-			xmlTextReaderHasValue(xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
-			xmlTextReaderIsDefault	(xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
-			xmlTextReaderIsEmptyElement(xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
-			xmlTextReaderNodeType	(xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
-			xmlTextReaderQuoteChar	(xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
-			xmlTextReaderReadState	(xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
-                        xmlTextReaderIsNamespaceDecl(xmlTextReaderPtr reader);
-
-XMLPUBFUN const xmlChar * XMLCALL
-		    xmlTextReaderConstBaseUri	(xmlTextReaderPtr reader);
-XMLPUBFUN const xmlChar * XMLCALL
-		    xmlTextReaderConstLocalName	(xmlTextReaderPtr reader);
-XMLPUBFUN const xmlChar * XMLCALL
-		    xmlTextReaderConstName	(xmlTextReaderPtr reader);
-XMLPUBFUN const xmlChar * XMLCALL
-		    xmlTextReaderConstNamespaceUri(xmlTextReaderPtr reader);
-XMLPUBFUN const xmlChar * XMLCALL
-		    xmlTextReaderConstPrefix	(xmlTextReaderPtr reader);
-XMLPUBFUN const xmlChar * XMLCALL
-		    xmlTextReaderConstXmlLang	(xmlTextReaderPtr reader);
-XMLPUBFUN const xmlChar * XMLCALL
-		    xmlTextReaderConstString	(xmlTextReaderPtr reader,
-						 const xmlChar *str);
-XMLPUBFUN const xmlChar * XMLCALL
-		    xmlTextReaderConstValue	(xmlTextReaderPtr reader);
-
-/*
- * use the Const version of the routine for
- * better performance and simpler code
- */
-XMLPUBFUN xmlChar * XMLCALL
-			xmlTextReaderBaseUri	(xmlTextReaderPtr reader);
-XMLPUBFUN xmlChar * XMLCALL
-			xmlTextReaderLocalName	(xmlTextReaderPtr reader);
-XMLPUBFUN xmlChar * XMLCALL
-			xmlTextReaderName	(xmlTextReaderPtr reader);
-XMLPUBFUN xmlChar * XMLCALL
-			xmlTextReaderNamespaceUri(xmlTextReaderPtr reader);
-XMLPUBFUN xmlChar * XMLCALL
-			xmlTextReaderPrefix	(xmlTextReaderPtr reader);
-XMLPUBFUN xmlChar * XMLCALL
-			xmlTextReaderXmlLang	(xmlTextReaderPtr reader);
-XMLPUBFUN xmlChar * XMLCALL
-			xmlTextReaderValue	(xmlTextReaderPtr reader);
-
-/*
- * Methods of the XmlTextReader
- */
-XMLPUBFUN int XMLCALL
-		    xmlTextReaderClose		(xmlTextReaderPtr reader);
-XMLPUBFUN xmlChar * XMLCALL
-		    xmlTextReaderGetAttributeNo	(xmlTextReaderPtr reader,
-						 int no);
-XMLPUBFUN xmlChar * XMLCALL
-		    xmlTextReaderGetAttribute	(xmlTextReaderPtr reader,
-						 const xmlChar *name);
-XMLPUBFUN xmlChar * XMLCALL
-		    xmlTextReaderGetAttributeNs	(xmlTextReaderPtr reader,
-						 const xmlChar *localName,
-						 const xmlChar *namespaceURI);
-XMLPUBFUN xmlParserInputBufferPtr XMLCALL
-		    xmlTextReaderGetRemainder	(xmlTextReaderPtr reader);
-XMLPUBFUN xmlChar * XMLCALL
-		    xmlTextReaderLookupNamespace(xmlTextReaderPtr reader,
-						 const xmlChar *prefix);
-XMLPUBFUN int XMLCALL
-		    xmlTextReaderMoveToAttributeNo(xmlTextReaderPtr reader,
-						 int no);
-XMLPUBFUN int XMLCALL
-		    xmlTextReaderMoveToAttribute(xmlTextReaderPtr reader,
-						 const xmlChar *name);
-XMLPUBFUN int XMLCALL
-		    xmlTextReaderMoveToAttributeNs(xmlTextReaderPtr reader,
-						 const xmlChar *localName,
-						 const xmlChar *namespaceURI);
-XMLPUBFUN int XMLCALL
-		    xmlTextReaderMoveToFirstAttribute(xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
-		    xmlTextReaderMoveToNextAttribute(xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
-		    xmlTextReaderMoveToElement	(xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
-		    xmlTextReaderNormalization	(xmlTextReaderPtr reader);
-XMLPUBFUN const xmlChar * XMLCALL
-		    xmlTextReaderConstEncoding  (xmlTextReaderPtr reader);
-
-/*
- * Extensions
- */
-XMLPUBFUN int XMLCALL
-		    xmlTextReaderSetParserProp	(xmlTextReaderPtr reader,
-						 int prop,
-						 int value);
-XMLPUBFUN int XMLCALL
-		    xmlTextReaderGetParserProp	(xmlTextReaderPtr reader,
-						 int prop);
-XMLPUBFUN xmlNodePtr XMLCALL
-		    xmlTextReaderCurrentNode	(xmlTextReaderPtr reader);
-
-XMLPUBFUN int XMLCALL
-            xmlTextReaderGetParserLineNumber(xmlTextReaderPtr reader);
-
-XMLPUBFUN int XMLCALL
-            xmlTextReaderGetParserColumnNumber(xmlTextReaderPtr reader);
-
-XMLPUBFUN xmlNodePtr XMLCALL
-		    xmlTextReaderPreserve	(xmlTextReaderPtr reader);
-#ifdef LIBXML_PATTERN_ENABLED
-XMLPUBFUN int XMLCALL
-		    xmlTextReaderPreservePattern(xmlTextReaderPtr reader,
-						 const xmlChar *pattern,
-						 const xmlChar **namespaces);
-#endif /* LIBXML_PATTERN_ENABLED */
-XMLPUBFUN xmlDocPtr XMLCALL
-		    xmlTextReaderCurrentDoc	(xmlTextReaderPtr reader);
-XMLPUBFUN xmlNodePtr XMLCALL
-		    xmlTextReaderExpand		(xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
-		    xmlTextReaderNext		(xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
-		    xmlTextReaderNextSibling	(xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
-		    xmlTextReaderIsValid	(xmlTextReaderPtr reader);
-#ifdef LIBXML_SCHEMAS_ENABLED
-XMLPUBFUN int XMLCALL
-		    xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader,
-						 const char *rng);
-XMLPUBFUN int XMLCALL
-		    xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader,
-						 xmlRelaxNGPtr schema);
-XMLPUBFUN int XMLCALL
-		    xmlTextReaderSchemaValidate	(xmlTextReaderPtr reader,
-						 const char *xsd);
-XMLPUBFUN int XMLCALL
-		    xmlTextReaderSchemaValidateCtxt(xmlTextReaderPtr reader,
-						 xmlSchemaValidCtxtPtr ctxt,
-						 int options);
-XMLPUBFUN int XMLCALL
-		    xmlTextReaderSetSchema	(xmlTextReaderPtr reader,
-						 xmlSchemaPtr schema);
-#endif
-XMLPUBFUN const xmlChar * XMLCALL
-		    xmlTextReaderConstXmlVersion(xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
-		    xmlTextReaderStandalone     (xmlTextReaderPtr reader);
-
-
-/*
- * Index lookup
- */
-XMLPUBFUN long XMLCALL
-		xmlTextReaderByteConsumed	(xmlTextReaderPtr reader);
-
-/*
- * New more complete APIs for simpler creation and reuse of readers
- */
-XMLPUBFUN xmlTextReaderPtr XMLCALL
-		xmlReaderWalker		(xmlDocPtr doc);
-XMLPUBFUN xmlTextReaderPtr XMLCALL
-		xmlReaderForDoc		(const xmlChar * cur,
-					 const char *URL,
-					 const char *encoding,
-					 int options);
-XMLPUBFUN xmlTextReaderPtr XMLCALL
-		xmlReaderForFile	(const char *filename,
-					 const char *encoding,
-					 int options);
-XMLPUBFUN xmlTextReaderPtr XMLCALL
-		xmlReaderForMemory	(const char *buffer,
-					 int size,
-					 const char *URL,
-					 const char *encoding,
-					 int options);
-XMLPUBFUN xmlTextReaderPtr XMLCALL
-		xmlReaderForFd		(int fd,
-					 const char *URL,
-					 const char *encoding,
-					 int options);
-XMLPUBFUN xmlTextReaderPtr XMLCALL
-		xmlReaderForIO		(xmlInputReadCallback ioread,
-					 xmlInputCloseCallback ioclose,
-					 void *ioctx,
-					 const char *URL,
-					 const char *encoding,
-					 int options);
-
-XMLPUBFUN int XMLCALL
-		xmlReaderNewWalker	(xmlTextReaderPtr reader,
-					 xmlDocPtr doc);
-XMLPUBFUN int XMLCALL
-		xmlReaderNewDoc		(xmlTextReaderPtr reader,
-					 const xmlChar * cur,
-					 const char *URL,
-					 const char *encoding,
-					 int options);
-XMLPUBFUN int XMLCALL
-		xmlReaderNewFile	(xmlTextReaderPtr reader,
-					 const char *filename,
-					 const char *encoding,
-					 int options);
-XMLPUBFUN int XMLCALL
-		xmlReaderNewMemory	(xmlTextReaderPtr reader,
-					 const char *buffer,
-					 int size,
-					 const char *URL,
-					 const char *encoding,
-					 int options);
-XMLPUBFUN int XMLCALL
-		xmlReaderNewFd		(xmlTextReaderPtr reader,
-					 int fd,
-					 const char *URL,
-					 const char *encoding,
-					 int options);
-XMLPUBFUN int XMLCALL
-		xmlReaderNewIO		(xmlTextReaderPtr reader,
-					 xmlInputReadCallback ioread,
-					 xmlInputCloseCallback ioclose,
-					 void *ioctx,
-					 const char *URL,
-					 const char *encoding,
-					 int options);
-/*
- * Error handling extensions
- */
-typedef void *  xmlTextReaderLocatorPtr;
-
-/**
- * xmlTextReaderErrorFunc:
- * @arg: the user argument
- * @msg: the message
- * @severity: the severity of the error
- * @locator: a locator indicating where the error occured
- *
- * Signature of an error callback from a reader parser
- */
-typedef void   (XMLCALL *xmlTextReaderErrorFunc)(void *arg,
-						 const char *msg,
-						 xmlParserSeverities severity,
-						 xmlTextReaderLocatorPtr locator);
-XMLPUBFUN int XMLCALL
-		    xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator);
-/*int             xmlTextReaderLocatorLinePosition(xmlTextReaderLocatorPtr locator);*/
-XMLPUBFUN xmlChar * XMLCALL
-		    xmlTextReaderLocatorBaseURI (xmlTextReaderLocatorPtr locator);
-XMLPUBFUN void XMLCALL
-		    xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader,
-						 xmlTextReaderErrorFunc f,
-						 void *arg);
-XMLPUBFUN void XMLCALL
-		    xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader,
-							   xmlStructuredErrorFunc f,
-							   void *arg);
-XMLPUBFUN void XMLCALL
-		    xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader,
-						 xmlTextReaderErrorFunc *f,
-						 void **arg);
-
-#endif /* LIBXML_READER_ENABLED */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __XML_XMLREADER_H__ */
-
diff --git a/interfaces/ext/libxml/xmlregexp.h b/interfaces/ext/libxml/xmlregexp.h
deleted file mode 100644
index 7009645..0000000
--- a/interfaces/ext/libxml/xmlregexp.h
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * Summary: regular expressions handling
- * Description: basic API for libxml regular expressions handling used
- *              for XML Schemas and validation.
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#ifndef __XML_REGEXP_H__
-#define __XML_REGEXP_H__
-
-#include <libxml/xmlversion.h>
-
-#ifdef LIBXML_REGEXP_ENABLED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * xmlRegexpPtr:
- *
- * A libxml regular expression, they can actually be far more complex
- * thank the POSIX regex expressions.
- */
-typedef struct _xmlRegexp xmlRegexp;
-typedef xmlRegexp *xmlRegexpPtr;
-
-/**
- * xmlRegExecCtxtPtr:
- *
- * A libxml progressive regular expression evaluation context
- */
-typedef struct _xmlRegExecCtxt xmlRegExecCtxt;
-typedef xmlRegExecCtxt *xmlRegExecCtxtPtr;
-
-#ifdef __cplusplus
-}
-#endif
-#include <libxml/tree.h>
-#include <libxml/dict.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * The POSIX like API
- */
-XMLPUBFUN xmlRegexpPtr XMLCALL
-		    xmlRegexpCompile	(const xmlChar *regexp);
-XMLPUBFUN void XMLCALL			 xmlRegFreeRegexp(xmlRegexpPtr regexp);
-XMLPUBFUN int XMLCALL
-		    xmlRegexpExec	(xmlRegexpPtr comp,
-					 const xmlChar *value);
-XMLPUBFUN void XMLCALL
-		    xmlRegexpPrint	(FILE *output,
-					 xmlRegexpPtr regexp);
-XMLPUBFUN int XMLCALL
-		    xmlRegexpIsDeterminist(xmlRegexpPtr comp);
-
-/**
- * xmlRegExecCallbacks:
- * @exec: the regular expression context
- * @token: the current token string
- * @transdata: transition data
- * @inputdata: input data
- *
- * Callback function when doing a transition in the automata
- */
-typedef void (*xmlRegExecCallbacks) (xmlRegExecCtxtPtr exec,
-	                             const xmlChar *token,
-				     void *transdata,
-				     void *inputdata);
-
-/*
- * The progressive API
- */
-XMLPUBFUN xmlRegExecCtxtPtr XMLCALL
-		    xmlRegNewExecCtxt	(xmlRegexpPtr comp,
-					 xmlRegExecCallbacks callback,
-					 void *data);
-XMLPUBFUN void XMLCALL
-		    xmlRegFreeExecCtxt	(xmlRegExecCtxtPtr exec);
-XMLPUBFUN int XMLCALL
-		    xmlRegExecPushString(xmlRegExecCtxtPtr exec,
-					 const xmlChar *value,
-					 void *data);
-XMLPUBFUN int XMLCALL
-		    xmlRegExecPushString2(xmlRegExecCtxtPtr exec,
-					 const xmlChar *value,
-					 const xmlChar *value2,
-					 void *data);
-
-XMLPUBFUN int XMLCALL
-		    xmlRegExecNextValues(xmlRegExecCtxtPtr exec,
-					 int *nbval,
-					 int *nbneg,
-					 xmlChar **values,
-					 int *terminal);
-XMLPUBFUN int XMLCALL
-		    xmlRegExecErrInfo	(xmlRegExecCtxtPtr exec,
-					 const xmlChar **string,
-					 int *nbval,
-					 int *nbneg,
-					 xmlChar **values,
-					 int *terminal);
-#ifdef LIBXML_EXPR_ENABLED
-/*
- * Formal regular expression handling
- * Its goal is to do some formal work on content models
- */
-
-/* expressions are used within a context */
-typedef struct _xmlExpCtxt xmlExpCtxt;
-typedef xmlExpCtxt *xmlExpCtxtPtr;
-
-XMLPUBFUN void XMLCALL
-			xmlExpFreeCtxt	(xmlExpCtxtPtr ctxt);
-XMLPUBFUN xmlExpCtxtPtr XMLCALL
-			xmlExpNewCtxt	(int maxNodes,
-					 xmlDictPtr dict);
-
-XMLPUBFUN int XMLCALL
-			xmlExpCtxtNbNodes(xmlExpCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL
-			xmlExpCtxtNbCons(xmlExpCtxtPtr ctxt);
-
-/* Expressions are trees but the tree is opaque */
-typedef struct _xmlExpNode xmlExpNode;
-typedef xmlExpNode *xmlExpNodePtr;
-
-typedef enum {
-    XML_EXP_EMPTY = 0,
-    XML_EXP_FORBID = 1,
-    XML_EXP_ATOM = 2,
-    XML_EXP_SEQ = 3,
-    XML_EXP_OR = 4,
-    XML_EXP_COUNT = 5
-} xmlExpNodeType;
-
-/*
- * 2 core expressions shared by all for the empty language set
- * and for the set with just the empty token
- */
-XMLPUBVAR xmlExpNodePtr forbiddenExp;
-XMLPUBVAR xmlExpNodePtr emptyExp;
-
-/*
- * Expressions are reference counted internally
- */
-XMLPUBFUN void XMLCALL
-			xmlExpFree	(xmlExpCtxtPtr ctxt,
-					 xmlExpNodePtr expr);
-XMLPUBFUN void XMLCALL
-			xmlExpRef	(xmlExpNodePtr expr);
-
-/*
- * constructors can be either manual or from a string
- */
-XMLPUBFUN xmlExpNodePtr XMLCALL
-			xmlExpParse	(xmlExpCtxtPtr ctxt,
-					 const char *expr);
-XMLPUBFUN xmlExpNodePtr XMLCALL
-			xmlExpNewAtom	(xmlExpCtxtPtr ctxt,
-					 const xmlChar *name,
-					 int len);
-XMLPUBFUN xmlExpNodePtr XMLCALL
-			xmlExpNewOr	(xmlExpCtxtPtr ctxt,
-					 xmlExpNodePtr left,
-					 xmlExpNodePtr right);
-XMLPUBFUN xmlExpNodePtr XMLCALL
-			xmlExpNewSeq	(xmlExpCtxtPtr ctxt,
-					 xmlExpNodePtr left,
-					 xmlExpNodePtr right);
-XMLPUBFUN xmlExpNodePtr XMLCALL
-			xmlExpNewRange	(xmlExpCtxtPtr ctxt,
-					 xmlExpNodePtr subset,
-					 int min,
-					 int max);
-/*
- * The really interesting APIs
- */
-XMLPUBFUN int XMLCALL
-			xmlExpIsNillable(xmlExpNodePtr expr);
-XMLPUBFUN int XMLCALL
-			xmlExpMaxToken	(xmlExpNodePtr expr);
-XMLPUBFUN int XMLCALL
-			xmlExpGetLanguage(xmlExpCtxtPtr ctxt,
-					 xmlExpNodePtr expr,
-					 const xmlChar**langList,
-					 int len);
-XMLPUBFUN int XMLCALL
-			xmlExpGetStart	(xmlExpCtxtPtr ctxt,
-					 xmlExpNodePtr expr,
-					 const xmlChar**tokList,
-					 int len);
-XMLPUBFUN xmlExpNodePtr XMLCALL
-			xmlExpStringDerive(xmlExpCtxtPtr ctxt,
-					 xmlExpNodePtr expr,
-					 const xmlChar *str,
-					 int len);
-XMLPUBFUN xmlExpNodePtr XMLCALL
-			xmlExpExpDerive	(xmlExpCtxtPtr ctxt,
-					 xmlExpNodePtr expr,
-					 xmlExpNodePtr sub);
-XMLPUBFUN int XMLCALL
-			xmlExpSubsume	(xmlExpCtxtPtr ctxt,
-					 xmlExpNodePtr expr,
-					 xmlExpNodePtr sub);
-XMLPUBFUN void XMLCALL
-			xmlExpDump	(xmlBufferPtr buf,
-					 xmlExpNodePtr expr);
-#endif /* LIBXML_EXPR_ENABLED */
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LIBXML_REGEXP_ENABLED */
-
-#endif /*__XML_REGEXP_H__ */
diff --git a/interfaces/ext/libxml/xmlsave.h b/interfaces/ext/libxml/xmlsave.h
deleted file mode 100644
index 4201b4d..0000000
--- a/interfaces/ext/libxml/xmlsave.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Summary: the XML document serializer
- * Description: API to save document or subtree of document
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#ifndef __XML_XMLSAVE_H__
-#define __XML_XMLSAVE_H__
-
-#include <libxml/xmlversion.h>
-#include <libxml/tree.h>
-#include <libxml/encoding.h>
-#include <libxml/xmlIO.h>
-
-#ifdef LIBXML_OUTPUT_ENABLED
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * xmlSaveOption:
- *
- * This is the set of XML save options that can be passed down
- * to the xmlSaveToFd() and similar calls.
- */
-typedef enum {
-    XML_SAVE_FORMAT     = 1<<0,	/* format save output */
-    XML_SAVE_NO_DECL    = 1<<1,	/* drop the xml declaration */
-    XML_SAVE_NO_EMPTY	= 1<<2, /* no empty tags */
-    XML_SAVE_NO_XHTML	= 1<<3, /* disable XHTML1 specific rules */
-    XML_SAVE_XHTML	= 1<<4, /* force XHTML1 specific rules */
-    XML_SAVE_AS_XML     = 1<<5, /* force XML serialization on HTML doc */
-    XML_SAVE_AS_HTML    = 1<<6  /* force HTML serialization on XML doc */
-} xmlSaveOption;
-
-
-typedef struct _xmlSaveCtxt xmlSaveCtxt;
-typedef xmlSaveCtxt *xmlSaveCtxtPtr;
-
-XMLPUBFUN xmlSaveCtxtPtr XMLCALL
-		xmlSaveToFd		(int fd,
-					 const char *encoding,
-					 int options);
-XMLPUBFUN xmlSaveCtxtPtr XMLCALL
-		xmlSaveToFilename	(const char *filename,
-					 const char *encoding,
-					 int options);
-
-XMLPUBFUN xmlSaveCtxtPtr XMLCALL
-		xmlSaveToBuffer		(xmlBufferPtr buffer,
-					 const char *encoding,
-					 int options);
-
-XMLPUBFUN xmlSaveCtxtPtr XMLCALL
-		xmlSaveToIO		(xmlOutputWriteCallback iowrite,
-					 xmlOutputCloseCallback ioclose,
-					 void *ioctx,
-					 const char *encoding,
-					 int options);
-
-XMLPUBFUN long XMLCALL
-		xmlSaveDoc		(xmlSaveCtxtPtr ctxt,
-					 xmlDocPtr doc);
-XMLPUBFUN long XMLCALL
-		xmlSaveTree		(xmlSaveCtxtPtr ctxt,
-					 xmlNodePtr node);
-
-XMLPUBFUN int XMLCALL
-		xmlSaveFlush		(xmlSaveCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL
-		xmlSaveClose		(xmlSaveCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL
-		xmlSaveSetEscape	(xmlSaveCtxtPtr ctxt,
-					 xmlCharEncodingOutputFunc escape);
-XMLPUBFUN int XMLCALL
-		xmlSaveSetAttrEscape	(xmlSaveCtxtPtr ctxt,
-					 xmlCharEncodingOutputFunc escape);
-#ifdef __cplusplus
-}
-#endif
-#endif /* LIBXML_OUTPUT_ENABLED */
-#endif /* __XML_XMLSAVE_H__ */
-
-
diff --git a/interfaces/ext/libxml/xmlschemas.h b/interfaces/ext/libxml/xmlschemas.h
deleted file mode 100644
index ebef3a7..0000000
--- a/interfaces/ext/libxml/xmlschemas.h
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Summary: incomplete XML Schemas structure implementation
- * Description: interface to the XML Schemas handling and schema validity
- *              checking, it is incomplete right now.
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-
-#ifndef __XML_SCHEMA_H__
-#define __XML_SCHEMA_H__
-
-#include <libxml/xmlversion.h>
-
-#ifdef LIBXML_SCHEMAS_ENABLED
-
-#include <libxml/tree.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * This error codes are obsolete; not used any more.
- */
-typedef enum {
-    XML_SCHEMAS_ERR_OK		= 0,
-    XML_SCHEMAS_ERR_NOROOT	= 1,
-    XML_SCHEMAS_ERR_UNDECLAREDELEM,
-    XML_SCHEMAS_ERR_NOTTOPLEVEL,
-    XML_SCHEMAS_ERR_MISSING,
-    XML_SCHEMAS_ERR_WRONGELEM,
-    XML_SCHEMAS_ERR_NOTYPE,
-    XML_SCHEMAS_ERR_NOROLLBACK,
-    XML_SCHEMAS_ERR_ISABSTRACT,
-    XML_SCHEMAS_ERR_NOTEMPTY,
-    XML_SCHEMAS_ERR_ELEMCONT,
-    XML_SCHEMAS_ERR_HAVEDEFAULT,
-    XML_SCHEMAS_ERR_NOTNILLABLE,
-    XML_SCHEMAS_ERR_EXTRACONTENT,
-    XML_SCHEMAS_ERR_INVALIDATTR,
-    XML_SCHEMAS_ERR_INVALIDELEM,
-    XML_SCHEMAS_ERR_NOTDETERMINIST,
-    XML_SCHEMAS_ERR_CONSTRUCT,
-    XML_SCHEMAS_ERR_INTERNAL,
-    XML_SCHEMAS_ERR_NOTSIMPLE,
-    XML_SCHEMAS_ERR_ATTRUNKNOWN,
-    XML_SCHEMAS_ERR_ATTRINVALID,
-    XML_SCHEMAS_ERR_VALUE,
-    XML_SCHEMAS_ERR_FACET,
-    XML_SCHEMAS_ERR_,
-    XML_SCHEMAS_ERR_XXX
-} xmlSchemaValidError;
-
-/*
-* ATTENTION: Change xmlSchemaSetValidOptions's check
-* for invalid values, if adding to the validation
-* options below.
-*/
-/**
- * xmlSchemaValidOption:
- *
- * This is the set of XML Schema validation options.
- */
-typedef enum {
-    XML_SCHEMA_VAL_VC_I_CREATE			= 1<<0
-	/* Default/fixed: create an attribute node
-	* or an element's text node on the instance.
-	*/
-} xmlSchemaValidOption;
-
-/*
-    XML_SCHEMA_VAL_XSI_ASSEMBLE			= 1<<1,
-	* assemble schemata using
-	* xsi:schemaLocation and
-	* xsi:noNamespaceSchemaLocation
-*/
-
-/**
- * The schemas related types are kept internal
- */
-typedef struct _xmlSchema xmlSchema;
-typedef xmlSchema *xmlSchemaPtr;
-
-/**
- * xmlSchemaValidityErrorFunc:
- * @ctx: the validation context
- * @msg: the message
- * @...: extra arguments
- *
- * Signature of an error callback from an XSD validation
- */
-typedef void (XMLCDECL *xmlSchemaValidityErrorFunc) (void *ctx, const char *msg, ...) ATTRIBUTE_PRINTF(2,3);
-
-/**
- * xmlSchemaValidityWarningFunc:
- * @ctx: the validation context
- * @msg: the message
- * @...: extra arguments
- *
- * Signature of a warning callback from an XSD validation
- */
-typedef void (XMLCDECL *xmlSchemaValidityWarningFunc) (void *ctx, const char *msg, ...) ATTRIBUTE_PRINTF(2,3);
-
-/**
- * A schemas validation context
- */
-typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt;
-typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr;
-
-typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt;
-typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr;
-
-/*
- * Interfaces for parsing.
- */
-XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
-	    xmlSchemaNewParserCtxt	(const char *URL);
-XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
-	    xmlSchemaNewMemParserCtxt	(const char *buffer,
-					 int size);
-XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
-	    xmlSchemaNewDocParserCtxt	(xmlDocPtr doc);
-XMLPUBFUN void XMLCALL
-	    xmlSchemaFreeParserCtxt	(xmlSchemaParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL
-	    xmlSchemaSetParserErrors	(xmlSchemaParserCtxtPtr ctxt,
-					 xmlSchemaValidityErrorFunc err,
-					 xmlSchemaValidityWarningFunc warn,
-					 void *ctx);
-XMLPUBFUN void XMLCALL
-	    xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxtPtr ctxt,
-					 xmlStructuredErrorFunc serror,
-					 void *ctx);
-XMLPUBFUN int XMLCALL
-		xmlSchemaGetParserErrors(xmlSchemaParserCtxtPtr ctxt,
-					xmlSchemaValidityErrorFunc * err,
-					xmlSchemaValidityWarningFunc * warn,
-					void **ctx);
-XMLPUBFUN int XMLCALL
-		xmlSchemaIsValid	(xmlSchemaValidCtxtPtr ctxt);
-
-XMLPUBFUN xmlSchemaPtr XMLCALL
-	    xmlSchemaParse		(xmlSchemaParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL
-	    xmlSchemaFree		(xmlSchemaPtr schema);
-#ifdef LIBXML_OUTPUT_ENABLED
-XMLPUBFUN void XMLCALL
-	    xmlSchemaDump		(FILE *output,
-					 xmlSchemaPtr schema);
-#endif /* LIBXML_OUTPUT_ENABLED */
-/*
- * Interfaces for validating
- */
-XMLPUBFUN void XMLCALL
-	    xmlSchemaSetValidErrors	(xmlSchemaValidCtxtPtr ctxt,
-					 xmlSchemaValidityErrorFunc err,
-					 xmlSchemaValidityWarningFunc warn,
-					 void *ctx);
-XMLPUBFUN void XMLCALL
-	    xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt,
-					 xmlStructuredErrorFunc serror,
-					 void *ctx);
-XMLPUBFUN int XMLCALL
-	    xmlSchemaGetValidErrors	(xmlSchemaValidCtxtPtr ctxt,
-					 xmlSchemaValidityErrorFunc *err,
-					 xmlSchemaValidityWarningFunc *warn,
-					 void **ctx);
-XMLPUBFUN int XMLCALL
-	    xmlSchemaSetValidOptions	(xmlSchemaValidCtxtPtr ctxt,
-					 int options);
-XMLPUBFUN int XMLCALL
-	    xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxtPtr ctxt);
-
-XMLPUBFUN xmlSchemaValidCtxtPtr XMLCALL
-	    xmlSchemaNewValidCtxt	(xmlSchemaPtr schema);
-XMLPUBFUN void XMLCALL
-	    xmlSchemaFreeValidCtxt	(xmlSchemaValidCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL
-	    xmlSchemaValidateDoc	(xmlSchemaValidCtxtPtr ctxt,
-					 xmlDocPtr instance);
-XMLPUBFUN int XMLCALL
-            xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt,
-			                 xmlNodePtr elem);
-XMLPUBFUN int XMLCALL
-	    xmlSchemaValidateStream	(xmlSchemaValidCtxtPtr ctxt,
-					 xmlParserInputBufferPtr input,
-					 xmlCharEncoding enc,
-					 xmlSAXHandlerPtr sax,
-					 void *user_data);
-XMLPUBFUN int XMLCALL
-	    xmlSchemaValidateFile	(xmlSchemaValidCtxtPtr ctxt,
-					 const char * filename,
-					 int options);
-
-XMLPUBFUN xmlParserCtxtPtr XMLCALL
-	    xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt);
-
-/*
- * Interface to insert Schemas SAX validation in a SAX stream
- */
-typedef struct _xmlSchemaSAXPlug xmlSchemaSAXPlugStruct;
-typedef xmlSchemaSAXPlugStruct *xmlSchemaSAXPlugPtr;
-
-XMLPUBFUN xmlSchemaSAXPlugPtr XMLCALL
-            xmlSchemaSAXPlug		(xmlSchemaValidCtxtPtr ctxt,
-					 xmlSAXHandlerPtr *sax,
-					 void **user_data);
-XMLPUBFUN int XMLCALL
-            xmlSchemaSAXUnplug		(xmlSchemaSAXPlugPtr plug);
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LIBXML_SCHEMAS_ENABLED */
-#endif /* __XML_SCHEMA_H__ */
diff --git a/interfaces/ext/libxml/xmlschemastypes.h b/interfaces/ext/libxml/xmlschemastypes.h
deleted file mode 100644
index 9a3a7a1..0000000
--- a/interfaces/ext/libxml/xmlschemastypes.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Summary: implementation of XML Schema Datatypes
- * Description: module providing the XML Schema Datatypes implementation
- *              both definition and validity checking
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-
-#ifndef __XML_SCHEMA_TYPES_H__
-#define __XML_SCHEMA_TYPES_H__
-
-#include <libxml/xmlversion.h>
-
-#ifdef LIBXML_SCHEMAS_ENABLED
-
-#include <libxml/schemasInternals.h>
-#include <libxml/xmlschemas.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    XML_SCHEMA_WHITESPACE_UNKNOWN = 0,
-    XML_SCHEMA_WHITESPACE_PRESERVE = 1,
-    XML_SCHEMA_WHITESPACE_REPLACE = 2,
-    XML_SCHEMA_WHITESPACE_COLLAPSE = 3
-} xmlSchemaWhitespaceValueType;
-
-XMLPUBFUN void XMLCALL		
-    		xmlSchemaInitTypes		(void);
-XMLPUBFUN void XMLCALL		
-		xmlSchemaCleanupTypes		(void);
-XMLPUBFUN xmlSchemaTypePtr XMLCALL 
-		xmlSchemaGetPredefinedType	(const xmlChar *name,
-						 const xmlChar *ns);
-XMLPUBFUN int XMLCALL		
-		xmlSchemaValidatePredefinedType	(xmlSchemaTypePtr type,
-						 const xmlChar *value,
-						 xmlSchemaValPtr *val);
-XMLPUBFUN int XMLCALL		
-		xmlSchemaValPredefTypeNode	(xmlSchemaTypePtr type,
-						 const xmlChar *value,
-						 xmlSchemaValPtr *val,
-						 xmlNodePtr node);
-XMLPUBFUN int XMLCALL		
-		xmlSchemaValidateFacet		(xmlSchemaTypePtr base,
-						 xmlSchemaFacetPtr facet,
-						 const xmlChar *value,
-						 xmlSchemaValPtr val);
-XMLPUBFUN int XMLCALL
-		xmlSchemaValidateFacetWhtsp	(xmlSchemaFacetPtr facet,
-						 xmlSchemaWhitespaceValueType fws,
-						 xmlSchemaValType valType,						 
-						 const xmlChar *value,
-						 xmlSchemaValPtr val,
-						 xmlSchemaWhitespaceValueType ws);
-XMLPUBFUN void XMLCALL		
-		xmlSchemaFreeValue		(xmlSchemaValPtr val);
-XMLPUBFUN xmlSchemaFacetPtr XMLCALL 
-		xmlSchemaNewFacet		(void);
-XMLPUBFUN int XMLCALL		
-		xmlSchemaCheckFacet		(xmlSchemaFacetPtr facet,
-						 xmlSchemaTypePtr typeDecl,
-						 xmlSchemaParserCtxtPtr ctxt,
-						 const xmlChar *name);
-XMLPUBFUN void XMLCALL		
-		xmlSchemaFreeFacet		(xmlSchemaFacetPtr facet);
-XMLPUBFUN int XMLCALL		
-		xmlSchemaCompareValues		(xmlSchemaValPtr x,
-						 xmlSchemaValPtr y);
-XMLPUBFUN xmlSchemaTypePtr XMLCALL		
-    xmlSchemaGetBuiltInListSimpleTypeItemType	(xmlSchemaTypePtr type);
-XMLPUBFUN int XMLCALL
-    xmlSchemaValidateListSimpleTypeFacet	(xmlSchemaFacetPtr facet,
-						 const xmlChar *value,
-						 unsigned long actualLen,
-						 unsigned long *expectedLen);
-XMLPUBFUN xmlSchemaTypePtr XMLCALL
-		xmlSchemaGetBuiltInType		(xmlSchemaValType type);
-XMLPUBFUN int XMLCALL
-		xmlSchemaIsBuiltInTypeFacet	(xmlSchemaTypePtr type, 
-						 int facetType);
-XMLPUBFUN xmlChar * XMLCALL
-		xmlSchemaCollapseString		(const xmlChar *value);
-XMLPUBFUN xmlChar * XMLCALL
-		xmlSchemaWhiteSpaceReplace	(const xmlChar *value);
-XMLPUBFUN unsigned long  XMLCALL
-		xmlSchemaGetFacetValueAsULong	(xmlSchemaFacetPtr facet);
-XMLPUBFUN int XMLCALL
-		xmlSchemaValidateLengthFacet	(xmlSchemaTypePtr type, 
-						 xmlSchemaFacetPtr facet,
-						 const xmlChar *value,
-						 xmlSchemaValPtr val,
-						 unsigned long *length);
-XMLPUBFUN int XMLCALL
-		xmlSchemaValidateLengthFacetWhtsp(xmlSchemaFacetPtr facet,
-						  xmlSchemaValType valType,
-						  const xmlChar *value,
-						  xmlSchemaValPtr val,						  
-						  unsigned long *length,
-						  xmlSchemaWhitespaceValueType ws);
-XMLPUBFUN int XMLCALL
-		xmlSchemaValPredefTypeNodeNoNorm(xmlSchemaTypePtr type, 
-						 const xmlChar *value,
-						 xmlSchemaValPtr *val, 
-						 xmlNodePtr node);
-XMLPUBFUN int XMLCALL
-		xmlSchemaGetCanonValue		(xmlSchemaValPtr val,
-						 const xmlChar **retValue);
-XMLPUBFUN int XMLCALL
-		xmlSchemaGetCanonValueWhtsp	(xmlSchemaValPtr val,						 
-						 const xmlChar **retValue,
-						 xmlSchemaWhitespaceValueType ws);
-XMLPUBFUN int XMLCALL
-		xmlSchemaValueAppend		(xmlSchemaValPtr prev,
-						 xmlSchemaValPtr cur);
-XMLPUBFUN xmlSchemaValPtr XMLCALL
-		xmlSchemaValueGetNext		(xmlSchemaValPtr cur);
-XMLPUBFUN const xmlChar * XMLCALL
-		xmlSchemaValueGetAsString	(xmlSchemaValPtr val);
-XMLPUBFUN int XMLCALL
-		xmlSchemaValueGetAsBoolean	(xmlSchemaValPtr val);
-XMLPUBFUN xmlSchemaValPtr XMLCALL
-		xmlSchemaNewStringValue		(xmlSchemaValType type,
-						 const xmlChar *value);
-XMLPUBFUN xmlSchemaValPtr XMLCALL
-		xmlSchemaNewNOTATIONValue	(const xmlChar *name,
-						 const xmlChar *ns);
-XMLPUBFUN xmlSchemaValPtr XMLCALL
-		xmlSchemaNewQNameValue		(const xmlChar *namespaceName,
-						 const xmlChar *localName);
-XMLPUBFUN int XMLCALL
-		xmlSchemaCompareValuesWhtsp	(xmlSchemaValPtr x,
-						 xmlSchemaWhitespaceValueType xws,
-						 xmlSchemaValPtr y,
-						 xmlSchemaWhitespaceValueType yws);
-XMLPUBFUN xmlSchemaValPtr XMLCALL
-		xmlSchemaCopyValue		(xmlSchemaValPtr val);
-XMLPUBFUN xmlSchemaValType XMLCALL
-		xmlSchemaGetValType		(xmlSchemaValPtr val);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LIBXML_SCHEMAS_ENABLED */
-#endif /* __XML_SCHEMA_TYPES_H__ */
diff --git a/interfaces/ext/libxml/xmlstring.h b/interfaces/ext/libxml/xmlstring.h
deleted file mode 100644
index 1dfc5ea..0000000
--- a/interfaces/ext/libxml/xmlstring.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Summary: set of routines to process strings
- * Description: type and interfaces needed for the internal string handling
- *              of the library, especially UTF8 processing.
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#ifndef __XML_STRING_H__
-#define __XML_STRING_H__
-
-#include <stdarg.h>
-#include <libxml/xmlversion.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * xmlChar:
- *
- * This is a basic byte in an UTF-8 encoded string.
- * It's unsigned allowing to pinpoint case where char * are assigned
- * to xmlChar * (possibly making serialization back impossible).
- */
-typedef unsigned char xmlChar;
-
-/**
- * BAD_CAST:
- *
- * Macro to cast a string to an xmlChar * when one know its safe.
- */
-#define BAD_CAST (xmlChar *)
-
-/*
- * xmlChar handling
- */
-XMLPUBFUN xmlChar * XMLCALL
-                xmlStrdup                (const xmlChar *cur);
-XMLPUBFUN xmlChar * XMLCALL
-                xmlStrndup               (const xmlChar *cur,
-                                         int len);
-XMLPUBFUN xmlChar * XMLCALL
-                xmlCharStrndup           (const char *cur,
-                                         int len);
-XMLPUBFUN xmlChar * XMLCALL
-                xmlCharStrdup            (const char *cur);
-XMLPUBFUN xmlChar * XMLCALL
-                xmlStrsub                (const xmlChar *str,
-                                         int start,
-                                         int len);
-XMLPUBFUN const xmlChar * XMLCALL
-                xmlStrchr                (const xmlChar *str,
-                                         xmlChar val);
-XMLPUBFUN const xmlChar * XMLCALL
-                xmlStrstr                (const xmlChar *str,
-                                         const xmlChar *val);
-XMLPUBFUN const xmlChar * XMLCALL
-                xmlStrcasestr            (const xmlChar *str,
-                                         xmlChar *val);
-XMLPUBFUN int XMLCALL
-                xmlStrcmp                (const xmlChar *str1,
-                                         const xmlChar *str2);
-XMLPUBFUN int XMLCALL
-                xmlStrncmp               (const xmlChar *str1,
-                                         const xmlChar *str2,
-                                         int len);
-XMLPUBFUN int XMLCALL
-                xmlStrcasecmp            (const xmlChar *str1,
-                                         const xmlChar *str2);
-XMLPUBFUN int XMLCALL
-                xmlStrncasecmp           (const xmlChar *str1,
-                                         const xmlChar *str2,
-                                         int len);
-XMLPUBFUN int XMLCALL
-                xmlStrEqual              (const xmlChar *str1,
-                                         const xmlChar *str2);
-XMLPUBFUN int XMLCALL
-                xmlStrQEqual             (const xmlChar *pref,
-                                         const xmlChar *name,
-                                         const xmlChar *str);
-XMLPUBFUN int XMLCALL
-                xmlStrlen                (const xmlChar *str);
-XMLPUBFUN xmlChar * XMLCALL
-                xmlStrcat                (xmlChar *cur,
-                                         const xmlChar *add);
-XMLPUBFUN xmlChar * XMLCALL
-                xmlStrncat               (xmlChar *cur,
-                                         const xmlChar *add,
-                                         int len);
-XMLPUBFUN xmlChar * XMLCALL
-                xmlStrncatNew            (const xmlChar *str1,
-                                         const xmlChar *str2,
-                                         int len);
-XMLPUBFUN int XMLCALL
-                xmlStrPrintf             (xmlChar *buf,
-                                         int len,
-                                         const xmlChar *msg,
-                                         ...);
-XMLPUBFUN int XMLCALL
-                xmlStrVPrintf                (xmlChar *buf,
-                                         int len,
-                                         const xmlChar *msg,
-                                         va_list ap);
-
-XMLPUBFUN int XMLCALL
-        xmlGetUTF8Char                   (const unsigned char *utf,
-                                         int *len);
-XMLPUBFUN int XMLCALL
-        xmlCheckUTF8                     (const unsigned char *utf);
-XMLPUBFUN int XMLCALL
-        xmlUTF8Strsize                   (const xmlChar *utf,
-                                         int len);
-XMLPUBFUN xmlChar * XMLCALL 
-        xmlUTF8Strndup                   (const xmlChar *utf,
-                                         int len);
-XMLPUBFUN const xmlChar * XMLCALL 
-        xmlUTF8Strpos                    (const xmlChar *utf,
-                                         int pos);
-XMLPUBFUN int XMLCALL
-        xmlUTF8Strloc                    (const xmlChar *utf,
-                                         const xmlChar *utfchar);
-XMLPUBFUN xmlChar * XMLCALL 
-        xmlUTF8Strsub                    (const xmlChar *utf,
-                                         int start,
-                                         int len);
-XMLPUBFUN int XMLCALL
-        xmlUTF8Strlen                    (const xmlChar *utf);
-XMLPUBFUN int XMLCALL
-        xmlUTF8Size                      (const xmlChar *utf);
-XMLPUBFUN int XMLCALL
-        xmlUTF8Charcmp                   (const xmlChar *utf1,
-                                         const xmlChar *utf2);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __XML_STRING_H__ */
diff --git a/interfaces/ext/libxml/xmlunicode.h b/interfaces/ext/libxml/xmlunicode.h
deleted file mode 100644
index 01ac8b6..0000000
--- a/interfaces/ext/libxml/xmlunicode.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Summary: Unicode character APIs
- * Description: API for the Unicode character APIs
- *
- * This file is automatically generated from the
- * UCS description files of the Unicode Character Database
- * http://www.unicode.org/Public/4.0-Update1/UCD-4.0.1.html
- * using the genUnicode.py Python script.
- *
- * Generation date: Mon Mar 27 11:09:52 2006
- * Sources: Blocks-4.0.1.txt UnicodeData-4.0.1.txt
- * Author: Daniel Veillard
- */
-
-#ifndef __XML_UNICODE_H__
-#define __XML_UNICODE_H__
-
-#include <libxml/xmlversion.h>
-
-#ifdef LIBXML_UNICODE_ENABLED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-XMLPUBFUN int XMLCALL xmlUCSIsAegeanNumbers	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsAlphabeticPresentationForms	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsArabic	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsArabicPresentationFormsA	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsArabicPresentationFormsB	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsArmenian	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsArrows	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsBasicLatin	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsBengali	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsBlockElements	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsBopomofo	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsBopomofoExtended	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsBoxDrawing	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsBraillePatterns	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsBuhid	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsByzantineMusicalSymbols	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibility	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityForms	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityIdeographs	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityIdeographsSupplement	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCJKRadicalsSupplement	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCJKSymbolsandPunctuation	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographs	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographsExtensionA	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographsExtensionB	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCherokee	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCombiningDiacriticalMarks	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCombiningDiacriticalMarksforSymbols	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCombiningHalfMarks	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCombiningMarksforSymbols	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsControlPictures	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCurrencySymbols	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCypriotSyllabary	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCyrillic	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCyrillicSupplement	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsDeseret	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsDevanagari	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsDingbats	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsEnclosedAlphanumerics	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsEnclosedCJKLettersandMonths	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsEthiopic	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsGeneralPunctuation	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsGeometricShapes	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsGeorgian	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsGothic	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsGreek	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsGreekExtended	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsGreekandCoptic	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsGujarati	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsGurmukhi	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsHalfwidthandFullwidthForms	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsHangulCompatibilityJamo	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsHangulJamo	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsHangulSyllables	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsHanunoo	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsHebrew	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsHighPrivateUseSurrogates	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsHighSurrogates	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsHiragana	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsIPAExtensions	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsIdeographicDescriptionCharacters	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsKanbun	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsKangxiRadicals	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsKannada	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsKatakana	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsKatakanaPhoneticExtensions	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsKhmer	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsKhmerSymbols	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsLao	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsLatin1Supplement	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedA	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedB	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedAdditional	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsLetterlikeSymbols	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsLimbu	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsLinearBIdeograms	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsLinearBSyllabary	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsLowSurrogates	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsMalayalam	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsMathematicalAlphanumericSymbols	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsMathematicalOperators	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousMathematicalSymbolsA	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousMathematicalSymbolsB	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousSymbols	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousSymbolsandArrows	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousTechnical	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsMongolian	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsMusicalSymbols	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsMyanmar	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsNumberForms	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsOgham	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsOldItalic	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsOpticalCharacterRecognition	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsOriya	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsOsmanya	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsPhoneticExtensions	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsPrivateUse	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsPrivateUseArea	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsRunic	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsShavian	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsSinhala	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsSmallFormVariants	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsSpacingModifierLetters	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsSpecials	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsSuperscriptsandSubscripts	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsSupplementalArrowsA	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsSupplementalArrowsB	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsSupplementalMathematicalOperators	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsSupplementaryPrivateUseAreaA	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsSupplementaryPrivateUseAreaB	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsSyriac	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsTagalog	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsTagbanwa	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsTags	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsTaiLe	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsTaiXuanJingSymbols	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsTamil	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsTelugu	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsThaana	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsThai	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsTibetan	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsUgaritic	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsUnifiedCanadianAboriginalSyllabics	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsVariationSelectors	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsVariationSelectorsSupplement	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsYiRadicals	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsYiSyllables	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsYijingHexagramSymbols	(int code);
-
-XMLPUBFUN int XMLCALL xmlUCSIsBlock	(int code, const char *block);
-
-XMLPUBFUN int XMLCALL xmlUCSIsCatC	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatCc	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatCf	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatCo	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatCs	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatL	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatLl	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatLm	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatLo	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatLt	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatLu	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatM	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatMc	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatMe	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatMn	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatN	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatNd	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatNl	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatNo	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatP	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatPc	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatPd	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatPe	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatPf	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatPi	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatPo	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatPs	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatS	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatSc	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatSk	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatSm	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatSo	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatZ	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatZl	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatZp	(int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatZs	(int code);
-
-XMLPUBFUN int XMLCALL xmlUCSIsCat	(int code, const char *cat);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LIBXML_UNICODE_ENABLED */
-
-#endif /* __XML_UNICODE_H__ */
diff --git a/interfaces/ext/libxml/xmlversion.h b/interfaces/ext/libxml/xmlversion.h
deleted file mode 100644
index 0660956..0000000
--- a/interfaces/ext/libxml/xmlversion.h
+++ /dev/null
@@ -1,458 +0,0 @@
-/*
- * Summary: compile-time version informations
- * Description: compile-time version informations for the XML library
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#ifndef __XML_VERSION_H__
-#define __XML_VERSION_H__
-
-#include <libxml/xmlexports.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * use those to be sure nothing nasty will happen if
- * your library and includes mismatch
- */
-#ifndef LIBXML2_COMPILING_MSCCDEF
-XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
-#endif /* LIBXML2_COMPILING_MSCCDEF */
-
-/**
- * LIBXML_DOTTED_VERSION:
- *
- * the version string like "1.2.3"
- */
-#define LIBXML_DOTTED_VERSION "2.7.3"
-
-/**
- * LIBXML_VERSION:
- *
- * the version number: 1.2.3 value is 10203
- */
-#define LIBXML_VERSION 20703
-
-/**
- * LIBXML_VERSION_STRING:
- *
- * the version number string, 1.2.3 value is "10203"
- */
-#define LIBXML_VERSION_STRING "20703"
-
-/**
- * LIBXML_VERSION_EXTRA:
- *
- * extra version information, used to show a CVS compilation
- */
-#define LIBXML_VERSION_EXTRA ""
-
-/**
- * LIBXML_TEST_VERSION:
- *
- * Macro to check that the libxml version in use is compatible with
- * the version the software has been compiled against
- */
-#define LIBXML_TEST_VERSION xmlCheckVersion(20703);
-
-#ifndef VMS
-#if 0
-/**
- * WITH_TRIO:
- *
- * defined if the trio support need to be configured in
- */
-#define WITH_TRIO
-#else
-/**
- * WITHOUT_TRIO:
- *
- * defined if the trio support should not be configured in
- */
-#define WITHOUT_TRIO
-#endif
-#else /* VMS */
-/**
- * WITH_TRIO:
- *
- * defined if the trio support need to be configured in
- */
-#define WITH_TRIO 1
-#endif /* VMS */
-
-/**
- * LIBXML_THREAD_ENABLED:
- *
- * Whether the thread support is configured in
- */
-#if 1
-#if defined(_REENTRANT) || defined(__MT__) || \
-    (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE - 0 >= 199506L))
-#define LIBXML_THREAD_ENABLED
-#endif
-#endif
-
-/**
- * LIBXML_TREE_ENABLED:
- *
- * Whether the DOM like tree manipulation API support is configured in
- */
-#if 1
-#define LIBXML_TREE_ENABLED
-#endif
-
-/**
- * LIBXML_OUTPUT_ENABLED:
- *
- * Whether the serialization/saving support is configured in
- */
-#if 1
-#define LIBXML_OUTPUT_ENABLED
-#endif
-
-/**
- * LIBXML_PUSH_ENABLED:
- *
- * Whether the push parsing interfaces are configured in
- */
-#if 1
-#define LIBXML_PUSH_ENABLED
-#endif
-
-/**
- * LIBXML_READER_ENABLED:
- *
- * Whether the xmlReader parsing interface is configured in
- */
-#if 1
-#define LIBXML_READER_ENABLED
-#endif
-
-/**
- * LIBXML_PATTERN_ENABLED:
- *
- * Whether the xmlPattern node selection interface is configured in
- */
-#if 1
-#define LIBXML_PATTERN_ENABLED
-#endif
-
-/**
- * LIBXML_WRITER_ENABLED:
- *
- * Whether the xmlWriter saving interface is configured in
- */
-#if 1
-#define LIBXML_WRITER_ENABLED
-#endif
-
-/**
- * LIBXML_SAX1_ENABLED:
- *
- * Whether the older SAX1 interface is configured in
- */
-#if 1
-#define LIBXML_SAX1_ENABLED
-#endif
-
-/**
- * LIBXML_FTP_ENABLED:
- *
- * Whether the FTP support is configured in
- */
-#if 1
-#define LIBXML_FTP_ENABLED
-#endif
-
-/**
- * LIBXML_HTTP_ENABLED:
- *
- * Whether the HTTP support is configured in
- */
-#if 1
-#define LIBXML_HTTP_ENABLED
-#endif
-
-/**
- * LIBXML_VALID_ENABLED:
- *
- * Whether the DTD validation support is configured in
- */
-#if 1
-#define LIBXML_VALID_ENABLED
-#endif
-
-/**
- * LIBXML_HTML_ENABLED:
- *
- * Whether the HTML support is configured in
- */
-#if 1
-#define LIBXML_HTML_ENABLED
-#endif
-
-/**
- * LIBXML_LEGACY_ENABLED:
- *
- * Whether the deprecated APIs are compiled in for compatibility
- */
-#if 1
-#define LIBXML_LEGACY_ENABLED
-#endif
-
-/**
- * LIBXML_C14N_ENABLED:
- *
- * Whether the Canonicalization support is configured in
- */
-#if 1
-#define LIBXML_C14N_ENABLED
-#endif
-
-/**
- * LIBXML_CATALOG_ENABLED:
- *
- * Whether the Catalog support is configured in
- */
-#if 1
-#define LIBXML_CATALOG_ENABLED
-#endif
-
-/**
- * LIBXML_DOCB_ENABLED:
- *
- * Whether the SGML Docbook support is configured in
- */
-#if 1
-#define LIBXML_DOCB_ENABLED
-#endif
-
-/**
- * LIBXML_XPATH_ENABLED:
- *
- * Whether XPath is configured in
- */
-#if 1
-#define LIBXML_XPATH_ENABLED
-#endif
-
-/**
- * LIBXML_XPTR_ENABLED:
- *
- * Whether XPointer is configured in
- */
-#if 1
-#define LIBXML_XPTR_ENABLED
-#endif
-
-/**
- * LIBXML_XINCLUDE_ENABLED:
- *
- * Whether XInclude is configured in
- */
-#if 1
-#define LIBXML_XINCLUDE_ENABLED
-#endif
-
-/**
- * LIBXML_ICONV_ENABLED:
- *
- * Whether iconv support is available
- */
-#if 1
-#define LIBXML_ICONV_ENABLED
-#endif
-
-/**
- * LIBXML_ISO8859X_ENABLED:
- *
- * Whether ISO-8859-* support is made available in case iconv is not
- */
-#if 1
-#define LIBXML_ISO8859X_ENABLED
-#endif
-
-/**
- * LIBXML_DEBUG_ENABLED:
- *
- * Whether Debugging module is configured in
- */
-#if 0
-#define LIBXML_DEBUG_ENABLED
-#endif
-
-/**
- * DEBUG_MEMORY_LOCATION:
- *
- * Whether the memory debugging is configured in
- */
-#if 0
-#define DEBUG_MEMORY_LOCATION
-#endif
-
-/**
- * LIBXML_DEBUG_RUNTIME:
- *
- * Whether the runtime debugging is configured in
- */
-#if 0
-#define LIBXML_DEBUG_RUNTIME
-#endif
-
-/**
- * LIBXML_UNICODE_ENABLED:
- *
- * Whether the Unicode related interfaces are compiled in
- */
-#if 1
-#define LIBXML_UNICODE_ENABLED
-#endif
-
-/**
- * LIBXML_REGEXP_ENABLED:
- *
- * Whether the regular expressions interfaces are compiled in
- */
-#if 1
-#define LIBXML_REGEXP_ENABLED
-#endif
-
-/**
- * LIBXML_AUTOMATA_ENABLED:
- *
- * Whether the automata interfaces are compiled in
- */
-#if 1
-#define LIBXML_AUTOMATA_ENABLED
-#endif
-
-/**
- * LIBXML_EXPR_ENABLED:
- *
- * Whether the formal expressions interfaces are compiled in
- */
-#if 1
-#define LIBXML_EXPR_ENABLED
-#endif
-
-/**
- * LIBXML_SCHEMAS_ENABLED:
- *
- * Whether the Schemas validation interfaces are compiled in
- */
-#if 1
-#define LIBXML_SCHEMAS_ENABLED
-#endif
-
-/**
- * LIBXML_SCHEMATRON_ENABLED:
- *
- * Whether the Schematron validation interfaces are compiled in
- */
-#if 1
-#define LIBXML_SCHEMATRON_ENABLED
-#endif
-
-/**
- * LIBXML_MODULES_ENABLED:
- *
- * Whether the module interfaces are compiled in
- */
-#if 1
-#define LIBXML_MODULES_ENABLED
-/**
- * LIBXML_MODULE_EXTENSION:
- *
- * the string suffix used by dynamic modules (usually shared libraries)
- */
-#define LIBXML_MODULE_EXTENSION ".so" 
-#endif
-
-/**
- * LIBXML_ZLIB_ENABLED:
- *
- * Whether the Zlib support is compiled in
- */
-#if 0
-#define LIBXML_ZLIB_ENABLED
-#endif
-
-#ifdef __GNUC__
-#ifdef HAVE_ANSIDECL_H
-#include <ansidecl.h>
-#endif
-
-/**
- * ATTRIBUTE_UNUSED:
- *
- * Macro used to signal to GCC unused function parameters
- */
-
-#ifndef ATTRIBUTE_UNUSED
-#define ATTRIBUTE_UNUSED __attribute__((unused))
-#endif
-
-/**
- * ATTRIBUTE_ALLOC_SIZE:
- *
- * Macro used to indicate to GCC this is an allocator function
- */
-
-#ifndef ATTRIBUTE_ALLOC_SIZE
-# if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
-#  define ATTRIBUTE_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
-# else
-#  define ATTRIBUTE_ALLOC_SIZE(x)
-# endif
-#else
-# define ATTRIBUTE_ALLOC_SIZE(x)
-#endif
-
-/**
- * ATTRIBUTE_PRINTF:
- *
- * Macro used to indicate to GCC the parameter are printf like
- */
-
-#ifndef ATTRIBUTE_PRINTF
-# if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
-#  define ATTRIBUTE_PRINTF(fmt,args) __attribute__((__format__(__printf__,fmt,args)))
-# else
-#  define ATTRIBUTE_PRINTF(fmt,args)
-# endif
-#else
-# define ATTRIBUTE_PRINTF(fmt,args)
-#endif
-
-#else /* ! __GNUC__ */
-/**
- * ATTRIBUTE_UNUSED:
- *
- * Macro used to signal to GCC unused function parameters
- */
-#define ATTRIBUTE_UNUSED
-/**
- * ATTRIBUTE_ALLOC_SIZE:
- *
- * Macro used to indicate to GCC this is an allocator function
- */
-#define ATTRIBUTE_ALLOC_SIZE(x)
-/**
- * ATTRIBUTE_PRINTF:
- *
- * Macro used to indicate to GCC the parameter are printf like
- */
-#define ATTRIBUTE_PRINTF(fmt,args)
-#endif /* __GNUC__ */
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif
-
-
diff --git a/interfaces/ext/libxml/xmlwriter.h b/interfaces/ext/libxml/xmlwriter.h
deleted file mode 100644
index df4509d..0000000
--- a/interfaces/ext/libxml/xmlwriter.h
+++ /dev/null
@@ -1,485 +0,0 @@
-
-/*
- * Summary: text writing API for XML
- * Description: text writing API for XML
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Alfred Mickautsch <alfred at mickautsch.de>
- */
-
-#ifndef __XML_XMLWRITER_H__
-#define __XML_XMLWRITER_H__
-
-#include <libxml/xmlversion.h>
-
-#ifdef LIBXML_WRITER_ENABLED
-
-#include <stdarg.h>
-#include <libxml/xmlIO.h>
-#include <libxml/list.h>
-#include <libxml/xmlstring.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-    typedef struct _xmlTextWriter xmlTextWriter;
-    typedef xmlTextWriter *xmlTextWriterPtr;
-
-/*
- * Constructors & Destructor
- */
-    XMLPUBFUN xmlTextWriterPtr XMLCALL
-        xmlNewTextWriter(xmlOutputBufferPtr out);
-    XMLPUBFUN xmlTextWriterPtr XMLCALL
-        xmlNewTextWriterFilename(const char *uri, int compression);
-    XMLPUBFUN xmlTextWriterPtr XMLCALL
-        xmlNewTextWriterMemory(xmlBufferPtr buf, int compression);
-    XMLPUBFUN xmlTextWriterPtr XMLCALL
-        xmlNewTextWriterPushParser(xmlParserCtxtPtr ctxt, int compression);
-    XMLPUBFUN xmlTextWriterPtr XMLCALL
-        xmlNewTextWriterDoc(xmlDocPtr * doc, int compression);
-    XMLPUBFUN xmlTextWriterPtr XMLCALL
-        xmlNewTextWriterTree(xmlDocPtr doc, xmlNodePtr node,
-                             int compression);
-    XMLPUBFUN void XMLCALL xmlFreeTextWriter(xmlTextWriterPtr writer);
-
-/*
- * Functions
- */
-
-
-/*
- * Document
- */
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterStartDocument(xmlTextWriterPtr writer,
-                                   const char *version,
-                                   const char *encoding,
-                                   const char *standalone);
-    XMLPUBFUN int XMLCALL xmlTextWriterEndDocument(xmlTextWriterPtr
-                                                   writer);
-
-/*
- * Comments
- */
-    XMLPUBFUN int XMLCALL xmlTextWriterStartComment(xmlTextWriterPtr
-                                                    writer);
-    XMLPUBFUN int XMLCALL xmlTextWriterEndComment(xmlTextWriterPtr writer);
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteFormatComment(xmlTextWriterPtr writer,
-                                        const char *format, ...)
-					ATTRIBUTE_PRINTF(2,3);
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteVFormatComment(xmlTextWriterPtr writer,
-                                         const char *format,
-                                         va_list argptr)
-					 ATTRIBUTE_PRINTF(2,0);
-    XMLPUBFUN int XMLCALL xmlTextWriterWriteComment(xmlTextWriterPtr
-                                                    writer,
-                                                    const xmlChar *
-                                                    content);
-
-/*
- * Elements
- */
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterStartElement(xmlTextWriterPtr writer,
-                                  const xmlChar * name);
-    XMLPUBFUN int XMLCALL xmlTextWriterStartElementNS(xmlTextWriterPtr
-                                                      writer,
-                                                      const xmlChar *
-                                                      prefix,
-                                                      const xmlChar * name,
-                                                      const xmlChar *
-                                                      namespaceURI);
-    XMLPUBFUN int XMLCALL xmlTextWriterEndElement(xmlTextWriterPtr writer);
-    XMLPUBFUN int XMLCALL xmlTextWriterFullEndElement(xmlTextWriterPtr
-                                                      writer);
-
-/*
- * Elements conveniency functions
- */
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteFormatElement(xmlTextWriterPtr writer,
-                                        const xmlChar * name,
-                                        const char *format, ...)
-					ATTRIBUTE_PRINTF(3,4);
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteVFormatElement(xmlTextWriterPtr writer,
-                                         const xmlChar * name,
-                                         const char *format,
-                                         va_list argptr)
-					 ATTRIBUTE_PRINTF(3,0);
-    XMLPUBFUN int XMLCALL xmlTextWriterWriteElement(xmlTextWriterPtr
-                                                    writer,
-                                                    const xmlChar * name,
-                                                    const xmlChar *
-                                                    content);
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteFormatElementNS(xmlTextWriterPtr writer,
-                                          const xmlChar * prefix,
-                                          const xmlChar * name,
-                                          const xmlChar * namespaceURI,
-                                          const char *format, ...)
-					  ATTRIBUTE_PRINTF(5,6);
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteVFormatElementNS(xmlTextWriterPtr writer,
-                                           const xmlChar * prefix,
-                                           const xmlChar * name,
-                                           const xmlChar * namespaceURI,
-                                           const char *format,
-                                           va_list argptr)
-					   ATTRIBUTE_PRINTF(5,0);
-    XMLPUBFUN int XMLCALL xmlTextWriterWriteElementNS(xmlTextWriterPtr
-                                                      writer,
-                                                      const xmlChar *
-                                                      prefix,
-                                                      const xmlChar * name,
-                                                      const xmlChar *
-                                                      namespaceURI,
-                                                      const xmlChar *
-                                                      content);
-
-/*
- * Text
- */
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteFormatRaw(xmlTextWriterPtr writer,
-                                    const char *format, ...)
-				    ATTRIBUTE_PRINTF(2,3);
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteVFormatRaw(xmlTextWriterPtr writer,
-                                     const char *format, va_list argptr)
-				     ATTRIBUTE_PRINTF(2,0);
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteRawLen(xmlTextWriterPtr writer,
-                                 const xmlChar * content, int len);
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteRaw(xmlTextWriterPtr writer,
-                              const xmlChar * content);
-    XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatString(xmlTextWriterPtr
-                                                         writer,
-                                                         const char
-                                                         *format, ...)
-							 ATTRIBUTE_PRINTF(2,3);
-    XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatString(xmlTextWriterPtr
-                                                          writer,
-                                                          const char
-                                                          *format,
-                                                          va_list argptr)
-							  ATTRIBUTE_PRINTF(2,0);
-    XMLPUBFUN int XMLCALL xmlTextWriterWriteString(xmlTextWriterPtr writer,
-                                                   const xmlChar *
-                                                   content);
-    XMLPUBFUN int XMLCALL xmlTextWriterWriteBase64(xmlTextWriterPtr writer,
-                                                   const char *data,
-                                                   int start, int len);
-    XMLPUBFUN int XMLCALL xmlTextWriterWriteBinHex(xmlTextWriterPtr writer,
-                                                   const char *data,
-                                                   int start, int len);
-
-/*
- * Attributes
- */
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterStartAttribute(xmlTextWriterPtr writer,
-                                    const xmlChar * name);
-    XMLPUBFUN int XMLCALL xmlTextWriterStartAttributeNS(xmlTextWriterPtr
-                                                        writer,
-                                                        const xmlChar *
-                                                        prefix,
-                                                        const xmlChar *
-                                                        name,
-                                                        const xmlChar *
-                                                        namespaceURI);
-    XMLPUBFUN int XMLCALL xmlTextWriterEndAttribute(xmlTextWriterPtr
-                                                    writer);
-
-/*
- * Attributes conveniency functions
- */
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteFormatAttribute(xmlTextWriterPtr writer,
-                                          const xmlChar * name,
-                                          const char *format, ...)
-					  ATTRIBUTE_PRINTF(3,4);
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteVFormatAttribute(xmlTextWriterPtr writer,
-                                           const xmlChar * name,
-                                           const char *format,
-                                           va_list argptr)
-					   ATTRIBUTE_PRINTF(3,0);
-    XMLPUBFUN int XMLCALL xmlTextWriterWriteAttribute(xmlTextWriterPtr
-                                                      writer,
-                                                      const xmlChar * name,
-                                                      const xmlChar *
-                                                      content);
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteFormatAttributeNS(xmlTextWriterPtr writer,
-                                            const xmlChar * prefix,
-                                            const xmlChar * name,
-                                            const xmlChar * namespaceURI,
-                                            const char *format, ...)
-					    ATTRIBUTE_PRINTF(5,6);
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteVFormatAttributeNS(xmlTextWriterPtr writer,
-                                             const xmlChar * prefix,
-                                             const xmlChar * name,
-                                             const xmlChar * namespaceURI,
-                                             const char *format,
-                                             va_list argptr)
-					     ATTRIBUTE_PRINTF(5,0);
-    XMLPUBFUN int XMLCALL xmlTextWriterWriteAttributeNS(xmlTextWriterPtr
-                                                        writer,
-                                                        const xmlChar *
-                                                        prefix,
-                                                        const xmlChar *
-                                                        name,
-                                                        const xmlChar *
-                                                        namespaceURI,
-                                                        const xmlChar *
-                                                        content);
-
-/*
- * PI's
- */
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterStartPI(xmlTextWriterPtr writer,
-                             const xmlChar * target);
-    XMLPUBFUN int XMLCALL xmlTextWriterEndPI(xmlTextWriterPtr writer);
-
-/*
- * PI conveniency functions
- */
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteFormatPI(xmlTextWriterPtr writer,
-                                   const xmlChar * target,
-                                   const char *format, ...)
-				   ATTRIBUTE_PRINTF(3,4);
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteVFormatPI(xmlTextWriterPtr writer,
-                                    const xmlChar * target,
-                                    const char *format, va_list argptr)
-				    ATTRIBUTE_PRINTF(3,0);
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWritePI(xmlTextWriterPtr writer,
-                             const xmlChar * target,
-                             const xmlChar * content);
-
-/**
- * xmlTextWriterWriteProcessingInstruction:
- *
- * This macro maps to xmlTextWriterWritePI
- */
-#define xmlTextWriterWriteProcessingInstruction xmlTextWriterWritePI
-
-/*
- * CDATA
- */
-    XMLPUBFUN int XMLCALL xmlTextWriterStartCDATA(xmlTextWriterPtr writer);
-    XMLPUBFUN int XMLCALL xmlTextWriterEndCDATA(xmlTextWriterPtr writer);
-
-/*
- * CDATA conveniency functions
- */
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteFormatCDATA(xmlTextWriterPtr writer,
-                                      const char *format, ...)
-				      ATTRIBUTE_PRINTF(2,3);
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteVFormatCDATA(xmlTextWriterPtr writer,
-                                       const char *format, va_list argptr)
-				       ATTRIBUTE_PRINTF(2,0);
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteCDATA(xmlTextWriterPtr writer,
-                                const xmlChar * content);
-
-/*
- * DTD
- */
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterStartDTD(xmlTextWriterPtr writer,
-                              const xmlChar * name,
-                              const xmlChar * pubid,
-                              const xmlChar * sysid);
-    XMLPUBFUN int XMLCALL xmlTextWriterEndDTD(xmlTextWriterPtr writer);
-
-/*
- * DTD conveniency functions
- */
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteFormatDTD(xmlTextWriterPtr writer,
-                                    const xmlChar * name,
-                                    const xmlChar * pubid,
-                                    const xmlChar * sysid,
-                                    const char *format, ...)
-				    ATTRIBUTE_PRINTF(5,6);
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteVFormatDTD(xmlTextWriterPtr writer,
-                                     const xmlChar * name,
-                                     const xmlChar * pubid,
-                                     const xmlChar * sysid,
-                                     const char *format, va_list argptr)
-				     ATTRIBUTE_PRINTF(5,0);
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteDTD(xmlTextWriterPtr writer,
-                              const xmlChar * name,
-                              const xmlChar * pubid,
-                              const xmlChar * sysid,
-                              const xmlChar * subset);
-
-/**
- * xmlTextWriterWriteDocType:
- *
- * this macro maps to xmlTextWriterWriteDTD
- */
-#define xmlTextWriterWriteDocType xmlTextWriterWriteDTD
-
-/*
- * DTD element definition
- */
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterStartDTDElement(xmlTextWriterPtr writer,
-                                     const xmlChar * name);
-    XMLPUBFUN int XMLCALL xmlTextWriterEndDTDElement(xmlTextWriterPtr
-                                                     writer);
-
-/*
- * DTD element definition conveniency functions
- */
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteFormatDTDElement(xmlTextWriterPtr writer,
-                                           const xmlChar * name,
-                                           const char *format, ...)
-					   ATTRIBUTE_PRINTF(3,4);
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteVFormatDTDElement(xmlTextWriterPtr writer,
-                                            const xmlChar * name,
-                                            const char *format,
-                                            va_list argptr)
-					    ATTRIBUTE_PRINTF(3,0);
-    XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDElement(xmlTextWriterPtr
-                                                       writer,
-                                                       const xmlChar *
-                                                       name,
-                                                       const xmlChar *
-                                                       content);
-
-/*
- * DTD attribute list definition
- */
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterStartDTDAttlist(xmlTextWriterPtr writer,
-                                     const xmlChar * name);
-    XMLPUBFUN int XMLCALL xmlTextWriterEndDTDAttlist(xmlTextWriterPtr
-                                                     writer);
-
-/*
- * DTD attribute list definition conveniency functions
- */
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteFormatDTDAttlist(xmlTextWriterPtr writer,
-                                           const xmlChar * name,
-                                           const char *format, ...)
-					   ATTRIBUTE_PRINTF(3,4);
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteVFormatDTDAttlist(xmlTextWriterPtr writer,
-                                            const xmlChar * name,
-                                            const char *format,
-                                            va_list argptr)
-					    ATTRIBUTE_PRINTF(3,0);
-    XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDAttlist(xmlTextWriterPtr
-                                                       writer,
-                                                       const xmlChar *
-                                                       name,
-                                                       const xmlChar *
-                                                       content);
-
-/*
- * DTD entity definition
- */
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterStartDTDEntity(xmlTextWriterPtr writer,
-                                    int pe, const xmlChar * name);
-    XMLPUBFUN int XMLCALL xmlTextWriterEndDTDEntity(xmlTextWriterPtr
-                                                    writer);
-
-/*
- * DTD entity definition conveniency functions
- */
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteFormatDTDInternalEntity(xmlTextWriterPtr writer,
-                                                  int pe,
-                                                  const xmlChar * name,
-                                                  const char *format, ...)
-						  ATTRIBUTE_PRINTF(4,5);
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteVFormatDTDInternalEntity(xmlTextWriterPtr writer,
-                                                   int pe,
-                                                   const xmlChar * name,
-                                                   const char *format,
-                                                   va_list argptr)
-						   ATTRIBUTE_PRINTF(4,0);
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteDTDInternalEntity(xmlTextWriterPtr writer,
-                                            int pe,
-                                            const xmlChar * name,
-                                            const xmlChar * content);
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteDTDExternalEntity(xmlTextWriterPtr writer,
-                                            int pe,
-                                            const xmlChar * name,
-                                            const xmlChar * pubid,
-                                            const xmlChar * sysid,
-                                            const xmlChar * ndataid);
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteDTDExternalEntityContents(xmlTextWriterPtr
-                                                    writer,
-                                                    const xmlChar * pubid,
-                                                    const xmlChar * sysid,
-                                                    const xmlChar *
-                                                    ndataid);
-    XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDEntity(xmlTextWriterPtr
-                                                      writer, int pe,
-                                                      const xmlChar * name,
-                                                      const xmlChar *
-                                                      pubid,
-                                                      const xmlChar *
-                                                      sysid,
-                                                      const xmlChar *
-                                                      ndataid,
-                                                      const xmlChar *
-                                                      content);
-
-/*
- * DTD notation definition
- */
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterWriteDTDNotation(xmlTextWriterPtr writer,
-                                      const xmlChar * name,
-                                      const xmlChar * pubid,
-                                      const xmlChar * sysid);
-
-/*
- * Indentation
- */
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterSetIndent(xmlTextWriterPtr writer, int indent);
-    XMLPUBFUN int XMLCALL
-        xmlTextWriterSetIndentString(xmlTextWriterPtr writer,
-                                     const xmlChar * str);
-
-/*
- * misc
- */
-    XMLPUBFUN int XMLCALL xmlTextWriterFlush(xmlTextWriterPtr writer);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LIBXML_WRITER_ENABLED */
-
-#endif                          /* __XML_XMLWRITER_H__ */
diff --git a/interfaces/ext/libxml/xpath.h b/interfaces/ext/libxml/xpath.h
deleted file mode 100644
index 1a9e30e..0000000
--- a/interfaces/ext/libxml/xpath.h
+++ /dev/null
@@ -1,546 +0,0 @@
-/*
- * Summary: XML Path Language implementation
- * Description: API for the XML Path Language implementation
- *
- * XML Path Language implementation
- * XPath is a language for addressing parts of an XML document,
- * designed to be used by both XSLT and XPointer
- *     http://www.w3.org/TR/xpath
- *
- * Implements
- * W3C Recommendation 16 November 1999
- *     http://www.w3.org/TR/1999/REC-xpath-19991116
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#ifndef __XML_XPATH_H__
-#define __XML_XPATH_H__
-
-#include <libxml/xmlversion.h>
-
-#ifdef LIBXML_XPATH_ENABLED
-
-#include <libxml/xmlerror.h>
-#include <libxml/tree.h>
-#include <libxml/hash.h>
-#endif /* LIBXML_XPATH_ENABLED */
-
-#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
-#ifdef __cplusplus
-extern "C" {
-#endif
-#endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED */
-	
-#ifdef LIBXML_XPATH_ENABLED
-
-typedef struct _xmlXPathContext xmlXPathContext;
-typedef xmlXPathContext *xmlXPathContextPtr;
-typedef struct _xmlXPathParserContext xmlXPathParserContext;
-typedef xmlXPathParserContext *xmlXPathParserContextPtr;
-
-/**
- * The set of XPath error codes.
- */
-
-typedef enum {
-    XPATH_EXPRESSION_OK = 0,
-    XPATH_NUMBER_ERROR,
-    XPATH_UNFINISHED_LITERAL_ERROR,
-    XPATH_START_LITERAL_ERROR,
-    XPATH_VARIABLE_REF_ERROR,
-    XPATH_UNDEF_VARIABLE_ERROR,
-    XPATH_INVALID_PREDICATE_ERROR,
-    XPATH_EXPR_ERROR,
-    XPATH_UNCLOSED_ERROR,
-    XPATH_UNKNOWN_FUNC_ERROR,
-    XPATH_INVALID_OPERAND,
-    XPATH_INVALID_TYPE,
-    XPATH_INVALID_ARITY,
-    XPATH_INVALID_CTXT_SIZE,
-    XPATH_INVALID_CTXT_POSITION,
-    XPATH_MEMORY_ERROR,
-    XPTR_SYNTAX_ERROR,
-    XPTR_RESOURCE_ERROR,
-    XPTR_SUB_RESOURCE_ERROR,
-    XPATH_UNDEF_PREFIX_ERROR,
-    XPATH_ENCODING_ERROR,
-    XPATH_INVALID_CHAR_ERROR,
-    XPATH_INVALID_CTXT
-} xmlXPathError;
-
-/*
- * A node-set (an unordered collection of nodes without duplicates).
- */
-typedef struct _xmlNodeSet xmlNodeSet;
-typedef xmlNodeSet *xmlNodeSetPtr;
-struct _xmlNodeSet {
-    int nodeNr;			/* number of nodes in the set */
-    int nodeMax;		/* size of the array as allocated */
-    xmlNodePtr *nodeTab;	/* array of nodes in no particular order */
-    /* @@ with_ns to check wether namespace nodes should be looked at @@ */
-};
-
-/*
- * An expression is evaluated to yield an object, which
- * has one of the following four basic types:
- *   - node-set
- *   - boolean
- *   - number
- *   - string
- *
- * @@ XPointer will add more types !
- */
-
-typedef enum {
-    XPATH_UNDEFINED = 0,
-    XPATH_NODESET = 1,
-    XPATH_BOOLEAN = 2,
-    XPATH_NUMBER = 3,
-    XPATH_STRING = 4,
-    XPATH_POINT = 5,
-    XPATH_RANGE = 6,
-    XPATH_LOCATIONSET = 7,
-    XPATH_USERS = 8,
-    XPATH_XSLT_TREE = 9  /* An XSLT value tree, non modifiable */
-} xmlXPathObjectType;
-
-typedef struct _xmlXPathObject xmlXPathObject;
-typedef xmlXPathObject *xmlXPathObjectPtr;
-struct _xmlXPathObject {
-    xmlXPathObjectType type;
-    xmlNodeSetPtr nodesetval;
-    int boolval;
-    double floatval;
-    xmlChar *stringval;
-    void *user;
-    int index;
-    void *user2;
-    int index2;
-};
-
-/**
- * xmlXPathConvertFunc:
- * @obj:  an XPath object
- * @type:  the number of the target type
- *
- * A conversion function is associated to a type and used to cast
- * the new type to primitive values.
- *
- * Returns -1 in case of error, 0 otherwise
- */
-typedef int (*xmlXPathConvertFunc) (xmlXPathObjectPtr obj, int type);
-
-/*
- * Extra type: a name and a conversion function.
- */
-
-typedef struct _xmlXPathType xmlXPathType;
-typedef xmlXPathType *xmlXPathTypePtr;
-struct _xmlXPathType {
-    const xmlChar         *name;		/* the type name */
-    xmlXPathConvertFunc func;		/* the conversion function */
-};
-
-/*
- * Extra variable: a name and a value.
- */
-
-typedef struct _xmlXPathVariable xmlXPathVariable;
-typedef xmlXPathVariable *xmlXPathVariablePtr;
-struct _xmlXPathVariable {
-    const xmlChar       *name;		/* the variable name */
-    xmlXPathObjectPtr value;		/* the value */
-};
-
-/**
- * xmlXPathEvalFunc:
- * @ctxt: an XPath parser context
- * @nargs: the number of arguments passed to the function
- *
- * An XPath evaluation function, the parameters are on the XPath context stack.
- */
-
-typedef void (*xmlXPathEvalFunc)(xmlXPathParserContextPtr ctxt,
-	                         int nargs);
-
-/*
- * Extra function: a name and a evaluation function.
- */
-
-typedef struct _xmlXPathFunct xmlXPathFunct;
-typedef xmlXPathFunct *xmlXPathFuncPtr;
-struct _xmlXPathFunct {
-    const xmlChar      *name;		/* the function name */
-    xmlXPathEvalFunc func;		/* the evaluation function */
-};
-
-/**
- * xmlXPathAxisFunc:
- * @ctxt:  the XPath interpreter context
- * @cur:  the previous node being explored on that axis
- *
- * An axis traversal function. To traverse an axis, the engine calls
- * the first time with cur == NULL and repeat until the function returns
- * NULL indicating the end of the axis traversal.
- *
- * Returns the next node in that axis or NULL if at the end of the axis.
- */
-
-typedef xmlXPathObjectPtr (*xmlXPathAxisFunc) (xmlXPathParserContextPtr ctxt,
-				 xmlXPathObjectPtr cur);
-
-/*
- * Extra axis: a name and an axis function.
- */
-
-typedef struct _xmlXPathAxis xmlXPathAxis;
-typedef xmlXPathAxis *xmlXPathAxisPtr;
-struct _xmlXPathAxis {
-    const xmlChar      *name;		/* the axis name */
-    xmlXPathAxisFunc func;		/* the search function */
-};
-
-/**
- * xmlXPathFunction:
- * @ctxt:  the XPath interprestation context
- * @nargs:  the number of arguments
- *
- * An XPath function.
- * The arguments (if any) are popped out from the context stack
- * and the result is pushed on the stack.
- */
-
-typedef void (*xmlXPathFunction) (xmlXPathParserContextPtr ctxt, int nargs);
-
-/*
- * Function and Variable Lookup.
- */
-
-/**
- * xmlXPathVariableLookupFunc:
- * @ctxt:  an XPath context
- * @name:  name of the variable
- * @ns_uri:  the namespace name hosting this variable
- *
- * Prototype for callbacks used to plug variable lookup in the XPath
- * engine.
- *
- * Returns the XPath object value or NULL if not found.
- */
-typedef xmlXPathObjectPtr (*xmlXPathVariableLookupFunc) (void *ctxt,
-                                         const xmlChar *name,
-                                         const xmlChar *ns_uri);
-
-/**
- * xmlXPathFuncLookupFunc:
- * @ctxt:  an XPath context
- * @name:  name of the function
- * @ns_uri:  the namespace name hosting this function
- *
- * Prototype for callbacks used to plug function lookup in the XPath
- * engine.
- *
- * Returns the XPath function or NULL if not found.
- */
-typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt,
-					 const xmlChar *name,
-					 const xmlChar *ns_uri);
-
-/**
- * xmlXPathFlags:
- * Flags for XPath engine compilation and runtime
- */
-/**
- * XML_XPATH_CHECKNS:
- *
- * check namespaces at compilation
- */
-#define XML_XPATH_CHECKNS (1<<0)
-/**
- * XML_XPATH_NOVAR:
- *
- * forbid variables in expression
- */
-#define XML_XPATH_NOVAR	  (1<<1)
-
-/**
- * xmlXPathContext:
- *
- * Expression evaluation occurs with respect to a context.
- * he context consists of:
- *    - a node (the context node) 
- *    - a node list (the context node list) 
- *    - a set of variable bindings 
- *    - a function library 
- *    - the set of namespace declarations in scope for the expression 
- * Following the switch to hash tables, this need to be trimmed up at
- * the next binary incompatible release.
- * The node may be modified when the context is passed to libxml2
- * for an XPath evaluation so you may need to initialize it again
- * before the next call.
- */
-
-struct _xmlXPathContext {
-    xmlDocPtr doc;			/* The current document */
-    xmlNodePtr node;			/* The current node */
-
-    int nb_variables_unused;		/* unused (hash table) */
-    int max_variables_unused;		/* unused (hash table) */
-    xmlHashTablePtr varHash;		/* Hash table of defined variables */
-
-    int nb_types;			/* number of defined types */
-    int max_types;			/* max number of types */
-    xmlXPathTypePtr types;		/* Array of defined types */
-
-    int nb_funcs_unused;		/* unused (hash table) */
-    int max_funcs_unused;		/* unused (hash table) */
-    xmlHashTablePtr funcHash;		/* Hash table of defined funcs */
-
-    int nb_axis;			/* number of defined axis */
-    int max_axis;			/* max number of axis */
-    xmlXPathAxisPtr axis;		/* Array of defined axis */
-
-    /* the namespace nodes of the context node */
-    xmlNsPtr *namespaces;		/* Array of namespaces */
-    int nsNr;				/* number of namespace in scope */
-    void *user;				/* function to free */
-
-    /* extra variables */
-    int contextSize;			/* the context size */
-    int proximityPosition;		/* the proximity position */
-
-    /* extra stuff for XPointer */
-    int xptr;				/* is this an XPointer context? */
-    xmlNodePtr here;			/* for here() */
-    xmlNodePtr origin;			/* for origin() */
-
-    /* the set of namespace declarations in scope for the expression */
-    xmlHashTablePtr nsHash;		/* The namespaces hash table */
-    xmlXPathVariableLookupFunc varLookupFunc;/* variable lookup func */
-    void *varLookupData;		/* variable lookup data */
-
-    /* Possibility to link in an extra item */
-    void *extra;                        /* needed for XSLT */
-
-    /* The function name and URI when calling a function */
-    const xmlChar *function;
-    const xmlChar *functionURI;
-
-    /* function lookup function and data */
-    xmlXPathFuncLookupFunc funcLookupFunc;/* function lookup func */
-    void *funcLookupData;		/* function lookup data */
-
-    /* temporary namespace lists kept for walking the namespace axis */
-    xmlNsPtr *tmpNsList;		/* Array of namespaces */
-    int tmpNsNr;			/* number of namespaces in scope */
-
-    /* error reporting mechanism */
-    void *userData;                     /* user specific data block */
-    xmlStructuredErrorFunc error;       /* the callback in case of errors */
-    xmlError lastError;			/* the last error */
-    xmlNodePtr debugNode;		/* the source node XSLT */
-
-    /* dictionary */
-    xmlDictPtr dict;			/* dictionary if any */
-
-    int flags;				/* flags to control compilation */
-
-    /* Cache for reusal of XPath objects */
-    void *cache;
-};
-
-/*
- * The structure of a compiled expression form is not public.
- */
-
-typedef struct _xmlXPathCompExpr xmlXPathCompExpr;
-typedef xmlXPathCompExpr *xmlXPathCompExprPtr;
-
-/**
- * xmlXPathParserContext:
- *
- * An XPath parser context. It contains pure parsing informations,
- * an xmlXPathContext, and the stack of objects.
- */
-struct _xmlXPathParserContext {
-    const xmlChar *cur;			/* the current char being parsed */
-    const xmlChar *base;			/* the full expression */
-
-    int error;				/* error code */
-
-    xmlXPathContextPtr  context;	/* the evaluation context */
-    xmlXPathObjectPtr     value;	/* the current value */
-    int                 valueNr;	/* number of values stacked */
-    int                valueMax;	/* max number of values stacked */
-    xmlXPathObjectPtr *valueTab;	/* stack of values */
-
-    xmlXPathCompExprPtr comp;		/* the precompiled expression */
-    int xptr;				/* it this an XPointer expression */
-    xmlNodePtr         ancestor;	/* used for walking preceding axis */
-};
-
-/************************************************************************
- *									*
- *			Public API					*
- *									*
- ************************************************************************/
-
-/**
- * Objects and Nodesets handling
- */
-
-XMLPUBVAR double xmlXPathNAN;
-XMLPUBVAR double xmlXPathPINF;
-XMLPUBVAR double xmlXPathNINF;
-
-/* These macros may later turn into functions */
-/**
- * xmlXPathNodeSetGetLength:
- * @ns:  a node-set
- *
- * Implement a functionality similar to the DOM NodeList.length.
- *
- * Returns the number of nodes in the node-set.
- */
-#define xmlXPathNodeSetGetLength(ns) ((ns) ? (ns)->nodeNr : 0)
-/**
- * xmlXPathNodeSetItem:
- * @ns:  a node-set
- * @index:  index of a node in the set
- *
- * Implements a functionality similar to the DOM NodeList.item().
- *
- * Returns the xmlNodePtr at the given @index in @ns or NULL if
- *         @index is out of range (0 to length-1)
- */
-#define xmlXPathNodeSetItem(ns, index)				\
-		((((ns) != NULL) && 				\
-		  ((index) >= 0) && ((index) < (ns)->nodeNr)) ?	\
-		 (ns)->nodeTab[(index)]				\
-		 : NULL)
-/**
- * xmlXPathNodeSetIsEmpty:
- * @ns: a node-set
- *
- * Checks whether @ns is empty or not.
- *
- * Returns %TRUE if @ns is an empty node-set.
- */
-#define xmlXPathNodeSetIsEmpty(ns)                                      \
-    (((ns) == NULL) || ((ns)->nodeNr == 0) || ((ns)->nodeTab == NULL))
-
-
-XMLPUBFUN void XMLCALL		   
-		    xmlXPathFreeObject		(xmlXPathObjectPtr obj);
-XMLPUBFUN xmlNodeSetPtr XMLCALL	   
-		    xmlXPathNodeSetCreate	(xmlNodePtr val);
-XMLPUBFUN void XMLCALL		   
-		    xmlXPathFreeNodeSetList	(xmlXPathObjectPtr obj);
-XMLPUBFUN void XMLCALL		   
-		    xmlXPathFreeNodeSet		(xmlNodeSetPtr obj);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL  
-		    xmlXPathObjectCopy		(xmlXPathObjectPtr val);
-XMLPUBFUN int XMLCALL		   
-		    xmlXPathCmpNodes		(xmlNodePtr node1,
-						 xmlNodePtr node2);
-/**
- * Conversion functions to basic types.
- */
-XMLPUBFUN int XMLCALL		   
-		    xmlXPathCastNumberToBoolean	(double val);
-XMLPUBFUN int XMLCALL		   
-		    xmlXPathCastStringToBoolean	(const xmlChar * val);
-XMLPUBFUN int XMLCALL		   
-		    xmlXPathCastNodeSetToBoolean(xmlNodeSetPtr ns);
-XMLPUBFUN int XMLCALL		   
-		    xmlXPathCastToBoolean	(xmlXPathObjectPtr val);
-
-XMLPUBFUN double XMLCALL		   
-		    xmlXPathCastBooleanToNumber	(int val);
-XMLPUBFUN double XMLCALL		   
-		    xmlXPathCastStringToNumber	(const xmlChar * val);
-XMLPUBFUN double XMLCALL		   
-		    xmlXPathCastNodeToNumber	(xmlNodePtr node);
-XMLPUBFUN double XMLCALL		   
-		    xmlXPathCastNodeSetToNumber	(xmlNodeSetPtr ns);
-XMLPUBFUN double XMLCALL		   
-		    xmlXPathCastToNumber	(xmlXPathObjectPtr val);
-
-XMLPUBFUN xmlChar * XMLCALL	   
-		    xmlXPathCastBooleanToString	(int val);
-XMLPUBFUN xmlChar * XMLCALL	   
-		    xmlXPathCastNumberToString	(double val);
-XMLPUBFUN xmlChar * XMLCALL	   
-		    xmlXPathCastNodeToString	(xmlNodePtr node);
-XMLPUBFUN xmlChar * XMLCALL	   
-		    xmlXPathCastNodeSetToString	(xmlNodeSetPtr ns);
-XMLPUBFUN xmlChar * XMLCALL	   
-		    xmlXPathCastToString	(xmlXPathObjectPtr val);
-
-XMLPUBFUN xmlXPathObjectPtr XMLCALL  
-		    xmlXPathConvertBoolean	(xmlXPathObjectPtr val);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL  
-		    xmlXPathConvertNumber	(xmlXPathObjectPtr val);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL  
-		    xmlXPathConvertString	(xmlXPathObjectPtr val);
-
-/**
- * Context handling.
- */
-XMLPUBFUN xmlXPathContextPtr XMLCALL 
-		    xmlXPathNewContext		(xmlDocPtr doc);
-XMLPUBFUN void XMLCALL
-		    xmlXPathFreeContext		(xmlXPathContextPtr ctxt);
-XMLPUBFUN int XMLCALL
-		    xmlXPathContextSetCache(xmlXPathContextPtr ctxt,
-				            int active,
-					    int value,
-					    int options);
-/**
- * Evaluation functions.
- */
-XMLPUBFUN long XMLCALL               
-		    xmlXPathOrderDocElems	(xmlDocPtr doc);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL  
-		    xmlXPathEval		(const xmlChar *str,
-						 xmlXPathContextPtr ctx);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL  
-		    xmlXPathEvalExpression	(const xmlChar *str,
-						 xmlXPathContextPtr ctxt);
-XMLPUBFUN int XMLCALL                
-		    xmlXPathEvalPredicate	(xmlXPathContextPtr ctxt,
-						 xmlXPathObjectPtr res);
-/**
- * Separate compilation/evaluation entry points.
- */
-XMLPUBFUN xmlXPathCompExprPtr XMLCALL 
-		    xmlXPathCompile		(const xmlChar *str);
-XMLPUBFUN xmlXPathCompExprPtr XMLCALL 
-		    xmlXPathCtxtCompile		(xmlXPathContextPtr ctxt,
-		    				 const xmlChar *str);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL   
-		    xmlXPathCompiledEval	(xmlXPathCompExprPtr comp,
-						 xmlXPathContextPtr ctx);
-XMLPUBFUN int XMLCALL   
-		    xmlXPathCompiledEvalToBoolean(xmlXPathCompExprPtr comp,
-						 xmlXPathContextPtr ctxt);
-XMLPUBFUN void XMLCALL                
-		    xmlXPathFreeCompExpr	(xmlXPathCompExprPtr comp);
-#endif /* LIBXML_XPATH_ENABLED */
-#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
-XMLPUBFUN void XMLCALL		   
-		    xmlXPathInit		(void);
-XMLPUBFUN int XMLCALL
-		xmlXPathIsNaN	(double val);
-XMLPUBFUN int XMLCALL
-		xmlXPathIsInf	(double val);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED*/
-#endif /* ! __XML_XPATH_H__ */
diff --git a/interfaces/ext/libxml/xpathInternals.h b/interfaces/ext/libxml/xpathInternals.h
deleted file mode 100644
index dcd5243..0000000
--- a/interfaces/ext/libxml/xpathInternals.h
+++ /dev/null
@@ -1,630 +0,0 @@
-/*
- * Summary: internal interfaces for XML Path Language implementation
- * Description: internal interfaces for XML Path Language implementation
- *              used to build new modules on top of XPath like XPointer and
- *              XSLT
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#ifndef __XML_XPATH_INTERNALS_H__
-#define __XML_XPATH_INTERNALS_H__
-
-#include <libxml/xmlversion.h>
-#include <libxml/xpath.h>
-
-#ifdef LIBXML_XPATH_ENABLED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/************************************************************************
- *									*
- *			Helpers						*
- *									*
- ************************************************************************/
-
-/*
- * Many of these macros may later turn into functions. They
- * shouldn't be used in #ifdef's preprocessor instructions.
- */
-/**
- * xmlXPathSetError:
- * @ctxt:  an XPath parser context
- * @err:  an xmlXPathError code
- *
- * Raises an error.
- */
-#define xmlXPathSetError(ctxt, err)					\
-    { xmlXPatherror((ctxt), __FILE__, __LINE__, (err));			\
-      if ((ctxt) != NULL) (ctxt)->error = (err); }
-
-/**
- * xmlXPathSetArityError:
- * @ctxt:  an XPath parser context
- *
- * Raises an XPATH_INVALID_ARITY error.
- */
-#define xmlXPathSetArityError(ctxt)					\
-    xmlXPathSetError((ctxt), XPATH_INVALID_ARITY)
-
-/**
- * xmlXPathSetTypeError:
- * @ctxt:  an XPath parser context
- *
- * Raises an XPATH_INVALID_TYPE error.
- */
-#define xmlXPathSetTypeError(ctxt)					\
-    xmlXPathSetError((ctxt), XPATH_INVALID_TYPE)
-
-/**
- * xmlXPathGetError:
- * @ctxt:  an XPath parser context
- *
- * Get the error code of an XPath context.
- *
- * Returns the context error.
- */
-#define xmlXPathGetError(ctxt)	  ((ctxt)->error)
-
-/**
- * xmlXPathCheckError:
- * @ctxt:  an XPath parser context
- *
- * Check if an XPath error was raised.
- *
- * Returns true if an error has been raised, false otherwise.
- */
-#define xmlXPathCheckError(ctxt)  ((ctxt)->error != XPATH_EXPRESSION_OK)
-
-/**
- * xmlXPathGetDocument:
- * @ctxt:  an XPath parser context
- *
- * Get the document of an XPath context.
- *
- * Returns the context document.
- */
-#define xmlXPathGetDocument(ctxt)	((ctxt)->context->doc)
-
-/**
- * xmlXPathGetContextNode:
- * @ctxt: an XPath parser context
- *
- * Get the context node of an XPath context.
- *
- * Returns the context node.
- */
-#define xmlXPathGetContextNode(ctxt)	((ctxt)->context->node)
-
-XMLPUBFUN int XMLCALL		
-		xmlXPathPopBoolean	(xmlXPathParserContextPtr ctxt);
-XMLPUBFUN double XMLCALL		
-    		xmlXPathPopNumber	(xmlXPathParserContextPtr ctxt);
-XMLPUBFUN xmlChar * XMLCALL	
-    		xmlXPathPopString	(xmlXPathParserContextPtr ctxt);
-XMLPUBFUN xmlNodeSetPtr XMLCALL	
-    		xmlXPathPopNodeSet	(xmlXPathParserContextPtr ctxt);
-XMLPUBFUN void * XMLCALL		
-    		xmlXPathPopExternal	(xmlXPathParserContextPtr ctxt);
-
-/**
- * xmlXPathReturnBoolean:
- * @ctxt:  an XPath parser context
- * @val:  a boolean
- *
- * Pushes the boolean @val on the context stack.
- */
-#define xmlXPathReturnBoolean(ctxt, val)				\
-    valuePush((ctxt), xmlXPathNewBoolean(val))
-
-/**
- * xmlXPathReturnTrue:
- * @ctxt:  an XPath parser context
- *
- * Pushes true on the context stack.
- */
-#define xmlXPathReturnTrue(ctxt)   xmlXPathReturnBoolean((ctxt), 1)
-
-/**
- * xmlXPathReturnFalse:
- * @ctxt:  an XPath parser context
- *
- * Pushes false on the context stack.
- */
-#define xmlXPathReturnFalse(ctxt)  xmlXPathReturnBoolean((ctxt), 0)
-
-/**
- * xmlXPathReturnNumber:
- * @ctxt:  an XPath parser context
- * @val:  a double
- *
- * Pushes the double @val on the context stack.
- */
-#define xmlXPathReturnNumber(ctxt, val)					\
-    valuePush((ctxt), xmlXPathNewFloat(val))
-
-/**
- * xmlXPathReturnString:
- * @ctxt:  an XPath parser context
- * @str:  a string
- *
- * Pushes the string @str on the context stack.
- */
-#define xmlXPathReturnString(ctxt, str)					\
-    valuePush((ctxt), xmlXPathWrapString(str))
-
-/**
- * xmlXPathReturnEmptyString:
- * @ctxt:  an XPath parser context
- *
- * Pushes an empty string on the stack.
- */
-#define xmlXPathReturnEmptyString(ctxt)					\
-    valuePush((ctxt), xmlXPathNewCString(""))
-
-/**
- * xmlXPathReturnNodeSet:
- * @ctxt:  an XPath parser context
- * @ns:  a node-set
- *
- * Pushes the node-set @ns on the context stack.
- */
-#define xmlXPathReturnNodeSet(ctxt, ns)					\
-    valuePush((ctxt), xmlXPathWrapNodeSet(ns))
-
-/**
- * xmlXPathReturnEmptyNodeSet:
- * @ctxt:  an XPath parser context
- *
- * Pushes an empty node-set on the context stack.
- */
-#define xmlXPathReturnEmptyNodeSet(ctxt)				\
-    valuePush((ctxt), xmlXPathNewNodeSet(NULL))
-
-/**
- * xmlXPathReturnExternal:
- * @ctxt:  an XPath parser context
- * @val:  user data
- *
- * Pushes user data on the context stack.
- */
-#define xmlXPathReturnExternal(ctxt, val)				\
-    valuePush((ctxt), xmlXPathWrapExternal(val))
-
-/**
- * xmlXPathStackIsNodeSet:
- * @ctxt: an XPath parser context
- *
- * Check if the current value on the XPath stack is a node set or
- * an XSLT value tree.
- *
- * Returns true if the current object on the stack is a node-set.
- */
-#define xmlXPathStackIsNodeSet(ctxt)					\
-    (((ctxt)->value != NULL)						\
-     && (((ctxt)->value->type == XPATH_NODESET)				\
-         || ((ctxt)->value->type == XPATH_XSLT_TREE)))
-
-/**
- * xmlXPathStackIsExternal:
- * @ctxt: an XPath parser context
- *
- * Checks if the current value on the XPath stack is an external
- * object.
- *
- * Returns true if the current object on the stack is an external
- * object.
- */
-#define xmlXPathStackIsExternal(ctxt)					\
-	((ctxt->value != NULL) && (ctxt->value->type == XPATH_USERS))
-
-/**
- * xmlXPathEmptyNodeSet:
- * @ns:  a node-set
- *
- * Empties a node-set.
- */
-#define xmlXPathEmptyNodeSet(ns)					\
-    { while ((ns)->nodeNr > 0) (ns)->nodeTab[(ns)->nodeNr--] = NULL; }
-
-/**
- * CHECK_ERROR:
- *
- * Macro to return from the function if an XPath error was detected.
- */
-#define CHECK_ERROR							\
-    if (ctxt->error != XPATH_EXPRESSION_OK) return
-
-/**
- * CHECK_ERROR0:
- *
- * Macro to return 0 from the function if an XPath error was detected.
- */
-#define CHECK_ERROR0							\
-    if (ctxt->error != XPATH_EXPRESSION_OK) return(0)
-
-/**
- * XP_ERROR:
- * @X:  the error code
- *
- * Macro to raise an XPath error and return.
- */
-#define XP_ERROR(X)							\
-    { xmlXPathErr(ctxt, X); return; }
-
-/**
- * XP_ERROR0:
- * @X:  the error code
- *
- * Macro to raise an XPath error and return 0.
- */
-#define XP_ERROR0(X)							\
-    { xmlXPathErr(ctxt, X); return(0); }
-
-/**
- * CHECK_TYPE:
- * @typeval:  the XPath type
- *
- * Macro to check that the value on top of the XPath stack is of a given
- * type.
- */
-#define CHECK_TYPE(typeval)						\
-    if ((ctxt->value == NULL) || (ctxt->value->type != typeval))	\
-        XP_ERROR(XPATH_INVALID_TYPE)
-
-/**
- * CHECK_TYPE0:
- * @typeval:  the XPath type
- *
- * Macro to check that the value on top of the XPath stack is of a given
- * type. Return(0) in case of failure
- */
-#define CHECK_TYPE0(typeval)						\
-    if ((ctxt->value == NULL) || (ctxt->value->type != typeval))	\
-        XP_ERROR0(XPATH_INVALID_TYPE)
-
-/**
- * CHECK_ARITY:
- * @x:  the number of expected args
- *
- * Macro to check that the number of args passed to an XPath function matches.
- */
-#define CHECK_ARITY(x)							\
-    if (ctxt == NULL) return;						\
-    if (nargs != (x))							\
-        XP_ERROR(XPATH_INVALID_ARITY);
-
-/**
- * CAST_TO_STRING:
- *
- * Macro to try to cast the value on the top of the XPath stack to a string.
- */
-#define CAST_TO_STRING							\
-    if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_STRING))	\
-        xmlXPathStringFunction(ctxt, 1);
-
-/**
- * CAST_TO_NUMBER:
- *
- * Macro to try to cast the value on the top of the XPath stack to a number.
- */
-#define CAST_TO_NUMBER							\
-    if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_NUMBER))	\
-        xmlXPathNumberFunction(ctxt, 1);
-
-/**
- * CAST_TO_BOOLEAN:
- *
- * Macro to try to cast the value on the top of the XPath stack to a boolean.
- */
-#define CAST_TO_BOOLEAN							\
-    if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_BOOLEAN))	\
-        xmlXPathBooleanFunction(ctxt, 1);
-
-/*
- * Variable Lookup forwarding.
- */
-
-XMLPUBFUN void XMLCALL	
-	xmlXPathRegisterVariableLookup	(xmlXPathContextPtr ctxt,
-					 xmlXPathVariableLookupFunc f,
-					 void *data);
-
-/*
- * Function Lookup forwarding.
- */
-
-XMLPUBFUN void XMLCALL	
-	    xmlXPathRegisterFuncLookup	(xmlXPathContextPtr ctxt,
-					 xmlXPathFuncLookupFunc f,
-					 void *funcCtxt);
-
-/*
- * Error reporting.
- */
-XMLPUBFUN void XMLCALL		
-		xmlXPatherror	(xmlXPathParserContextPtr ctxt,
-				 const char *file,
-				 int line,
-				 int no);
-
-XMLPUBFUN void XMLCALL
-		xmlXPathErr	(xmlXPathParserContextPtr ctxt,
-				 int error);
-
-#ifdef LIBXML_DEBUG_ENABLED
-XMLPUBFUN void XMLCALL		
-		xmlXPathDebugDumpObject	(FILE *output,
-					 xmlXPathObjectPtr cur,
-					 int depth);
-XMLPUBFUN void XMLCALL		
-	    xmlXPathDebugDumpCompExpr(FILE *output,
-					 xmlXPathCompExprPtr comp,
-					 int depth);
-#endif
-/**
- * NodeSet handling.
- */
-XMLPUBFUN int XMLCALL		
-		xmlXPathNodeSetContains		(xmlNodeSetPtr cur,
-						 xmlNodePtr val);
-XMLPUBFUN xmlNodeSetPtr XMLCALL	
-		xmlXPathDifference		(xmlNodeSetPtr nodes1,
-						 xmlNodeSetPtr nodes2);
-XMLPUBFUN xmlNodeSetPtr XMLCALL	
-		xmlXPathIntersection		(xmlNodeSetPtr nodes1,
-						 xmlNodeSetPtr nodes2);
-
-XMLPUBFUN xmlNodeSetPtr XMLCALL	
-		xmlXPathDistinctSorted		(xmlNodeSetPtr nodes);
-XMLPUBFUN xmlNodeSetPtr XMLCALL	
-		xmlXPathDistinct		(xmlNodeSetPtr nodes);
-
-XMLPUBFUN int XMLCALL		
-		xmlXPathHasSameNodes		(xmlNodeSetPtr nodes1,
-						 xmlNodeSetPtr nodes2);
-
-XMLPUBFUN xmlNodeSetPtr XMLCALL	
-		xmlXPathNodeLeadingSorted	(xmlNodeSetPtr nodes,
-						 xmlNodePtr node);
-XMLPUBFUN xmlNodeSetPtr XMLCALL	
-		xmlXPathLeadingSorted		(xmlNodeSetPtr nodes1,
-						 xmlNodeSetPtr nodes2);
-XMLPUBFUN xmlNodeSetPtr XMLCALL	
-		xmlXPathNodeLeading		(xmlNodeSetPtr nodes,
-						 xmlNodePtr node);
-XMLPUBFUN xmlNodeSetPtr XMLCALL	
-		xmlXPathLeading			(xmlNodeSetPtr nodes1,
-						 xmlNodeSetPtr nodes2);
-
-XMLPUBFUN xmlNodeSetPtr XMLCALL	
-		xmlXPathNodeTrailingSorted	(xmlNodeSetPtr nodes,
-						 xmlNodePtr node);
-XMLPUBFUN xmlNodeSetPtr XMLCALL	
-		xmlXPathTrailingSorted		(xmlNodeSetPtr nodes1,
-						 xmlNodeSetPtr nodes2);
-XMLPUBFUN xmlNodeSetPtr XMLCALL	
-		xmlXPathNodeTrailing		(xmlNodeSetPtr nodes,
-						 xmlNodePtr node);
-XMLPUBFUN xmlNodeSetPtr XMLCALL	
-		xmlXPathTrailing		(xmlNodeSetPtr nodes1,
-						 xmlNodeSetPtr nodes2);
-
-
-/**
- * Extending a context.
- */
-
-XMLPUBFUN int XMLCALL		   
-		xmlXPathRegisterNs		(xmlXPathContextPtr ctxt,
-						 const xmlChar *prefix,
-						 const xmlChar *ns_uri);
-XMLPUBFUN const xmlChar * XMLCALL	   
-		xmlXPathNsLookup		(xmlXPathContextPtr ctxt,
-						 const xmlChar *prefix);
-XMLPUBFUN void XMLCALL		   
-		xmlXPathRegisteredNsCleanup	(xmlXPathContextPtr ctxt);
-
-XMLPUBFUN int XMLCALL		   
-		xmlXPathRegisterFunc		(xmlXPathContextPtr ctxt,
-						 const xmlChar *name,
-						 xmlXPathFunction f);
-XMLPUBFUN int XMLCALL		   
-		xmlXPathRegisterFuncNS		(xmlXPathContextPtr ctxt,
-						 const xmlChar *name,
-						 const xmlChar *ns_uri,
-						 xmlXPathFunction f);
-XMLPUBFUN int XMLCALL		   
-		xmlXPathRegisterVariable	(xmlXPathContextPtr ctxt,
-						 const xmlChar *name,
-						 xmlXPathObjectPtr value);
-XMLPUBFUN int XMLCALL		   
-		xmlXPathRegisterVariableNS	(xmlXPathContextPtr ctxt,
-						 const xmlChar *name,
-						 const xmlChar *ns_uri,
-						 xmlXPathObjectPtr value);
-XMLPUBFUN xmlXPathFunction XMLCALL   
-		xmlXPathFunctionLookup		(xmlXPathContextPtr ctxt,
-						 const xmlChar *name);
-XMLPUBFUN xmlXPathFunction XMLCALL   
-		xmlXPathFunctionLookupNS	(xmlXPathContextPtr ctxt,
-						 const xmlChar *name,
-						 const xmlChar *ns_uri);
-XMLPUBFUN void XMLCALL		   
-		xmlXPathRegisteredFuncsCleanup	(xmlXPathContextPtr ctxt);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL  
-		xmlXPathVariableLookup		(xmlXPathContextPtr ctxt,
-						 const xmlChar *name);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL  
-		xmlXPathVariableLookupNS	(xmlXPathContextPtr ctxt,
-						 const xmlChar *name,
-						 const xmlChar *ns_uri);
-XMLPUBFUN void XMLCALL		   
-		xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt);
-
-/**
- * Utilities to extend XPath.
- */
-XMLPUBFUN xmlXPathParserContextPtr XMLCALL
-		  xmlXPathNewParserContext	(const xmlChar *str,
-			  			 xmlXPathContextPtr ctxt);
-XMLPUBFUN void XMLCALL		  
-		xmlXPathFreeParserContext	(xmlXPathParserContextPtr ctxt);
-
-/* TODO: remap to xmlXPathValuePop and Push. */
-XMLPUBFUN xmlXPathObjectPtr XMLCALL 
-		valuePop			(xmlXPathParserContextPtr ctxt);
-XMLPUBFUN int XMLCALL		  
-		valuePush			(xmlXPathParserContextPtr ctxt,
-					 	 xmlXPathObjectPtr value);
-
-XMLPUBFUN xmlXPathObjectPtr XMLCALL 
-		xmlXPathNewString		(const xmlChar *val);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL 
-		xmlXPathNewCString		(const char *val);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL 
-		xmlXPathWrapString		(xmlChar *val);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL 
-		xmlXPathWrapCString		(char * val);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL 
-		xmlXPathNewFloat		(double val);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL 
-		xmlXPathNewBoolean		(int val);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL 
-		xmlXPathNewNodeSet		(xmlNodePtr val);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL 
-		xmlXPathNewValueTree		(xmlNodePtr val);
-XMLPUBFUN void XMLCALL		  
-		xmlXPathNodeSetAdd		(xmlNodeSetPtr cur,
-						 xmlNodePtr val);
-XMLPUBFUN void XMLCALL              
-		xmlXPathNodeSetAddUnique	(xmlNodeSetPtr cur,
-						 xmlNodePtr val);
-XMLPUBFUN void XMLCALL		  
-		xmlXPathNodeSetAddNs		(xmlNodeSetPtr cur, 
-						 xmlNodePtr node, 
-						 xmlNsPtr ns);
-XMLPUBFUN void XMLCALL              
-		xmlXPathNodeSetSort		(xmlNodeSetPtr set);
-
-XMLPUBFUN void XMLCALL		  
-		xmlXPathRoot			(xmlXPathParserContextPtr ctxt);
-XMLPUBFUN void XMLCALL		  
-		xmlXPathEvalExpr		(xmlXPathParserContextPtr ctxt);
-XMLPUBFUN xmlChar * XMLCALL	  
-		xmlXPathParseName		(xmlXPathParserContextPtr ctxt);
-XMLPUBFUN xmlChar * XMLCALL	  
-		xmlXPathParseNCName		(xmlXPathParserContextPtr ctxt);
-
-/*
- * Existing functions.
- */
-XMLPUBFUN double XMLCALL 
-		xmlXPathStringEvalNumber	(const xmlChar *str);
-XMLPUBFUN int XMLCALL 
-		xmlXPathEvaluatePredicateResult (xmlXPathParserContextPtr ctxt, 
-						 xmlXPathObjectPtr res);
-XMLPUBFUN void XMLCALL 
-		xmlXPathRegisterAllFunctions	(xmlXPathContextPtr ctxt);
-XMLPUBFUN xmlNodeSetPtr XMLCALL 
-		xmlXPathNodeSetMerge		(xmlNodeSetPtr val1, 
-						 xmlNodeSetPtr val2);
-XMLPUBFUN void XMLCALL 
-		xmlXPathNodeSetDel		(xmlNodeSetPtr cur, 
-						 xmlNodePtr val);
-XMLPUBFUN void XMLCALL 
-		xmlXPathNodeSetRemove		(xmlNodeSetPtr cur, 
-						 int val);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL 
-		xmlXPathNewNodeSetList		(xmlNodeSetPtr val);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL 
-		xmlXPathWrapNodeSet		(xmlNodeSetPtr val);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL 
-		xmlXPathWrapExternal		(void *val);
-
-XMLPUBFUN int XMLCALL xmlXPathEqualValues(xmlXPathParserContextPtr ctxt);
-XMLPUBFUN int XMLCALL xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt);
-XMLPUBFUN int XMLCALL xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict);
-XMLPUBFUN void XMLCALL xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt);
-XMLPUBFUN void XMLCALL xmlXPathAddValues(xmlXPathParserContextPtr ctxt);
-XMLPUBFUN void XMLCALL xmlXPathSubValues(xmlXPathParserContextPtr ctxt);
-XMLPUBFUN void XMLCALL xmlXPathMultValues(xmlXPathParserContextPtr ctxt);
-XMLPUBFUN void XMLCALL xmlXPathDivValues(xmlXPathParserContextPtr ctxt);
-XMLPUBFUN void XMLCALL xmlXPathModValues(xmlXPathParserContextPtr ctxt);
-
-XMLPUBFUN int XMLCALL xmlXPathIsNodeType(const xmlChar *name);
-
-/*
- * Some of the axis navigation routines.
- */
-XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextSelf(xmlXPathParserContextPtr ctxt,
-			xmlNodePtr cur);
-XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextChild(xmlXPathParserContextPtr ctxt,
-			xmlNodePtr cur);
-XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt,
-			xmlNodePtr cur);
-XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt,
-			xmlNodePtr cur);
-XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextParent(xmlXPathParserContextPtr ctxt,
-			xmlNodePtr cur);
-XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt,
-			xmlNodePtr cur);
-XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt,
-			xmlNodePtr cur);
-XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt,
-			xmlNodePtr cur);
-XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt,
-			xmlNodePtr cur);
-XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt,
-			xmlNodePtr cur);
-XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt,
-			xmlNodePtr cur);
-XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt,
-			xmlNodePtr cur);
-XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt,
-			xmlNodePtr cur);
-/*
- * The official core of XPath functions.
- */
-XMLPUBFUN void XMLCALL xmlXPathLastFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathPositionFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathLocalNameFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathConcatFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathContainsFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathStartsWithFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathSubstringBeforeFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathNotFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathTrueFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathFalseFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathSumFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathBooleanFunction(xmlXPathParserContextPtr ctxt, int nargs);
-
-/**
- * Really internal functions
- */
-XMLPUBFUN void XMLCALL xmlXPathNodeSetFreeNs(xmlNsPtr ns);
- 
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LIBXML_XPATH_ENABLED */
-#endif /* ! __XML_XPATH_INTERNALS_H__ */
diff --git a/interfaces/ext/libxml/xpointer.h b/interfaces/ext/libxml/xpointer.h
deleted file mode 100644
index dde1dfb..0000000
--- a/interfaces/ext/libxml/xpointer.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Summary: API to handle XML Pointers
- * Description: API to handle XML Pointers
- * Base implementation was made accordingly to
- * W3C Candidate Recommendation 7 June 2000
- * http://www.w3.org/TR/2000/CR-xptr-20000607
- *
- * Added support for the element() scheme described in:
- * W3C Proposed Recommendation 13 November 2002
- * http://www.w3.org/TR/2002/PR-xptr-element-20021113/  
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#ifndef __XML_XPTR_H__
-#define __XML_XPTR_H__
-
-#include <libxml/xmlversion.h>
-
-#ifdef LIBXML_XPTR_ENABLED
-
-#include <libxml/tree.h>
-#include <libxml/xpath.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * A Location Set
- */
-typedef struct _xmlLocationSet xmlLocationSet;
-typedef xmlLocationSet *xmlLocationSetPtr;
-struct _xmlLocationSet {
-    int locNr;		      /* number of locations in the set */
-    int locMax;		      /* size of the array as allocated */
-    xmlXPathObjectPtr *locTab;/* array of locations */
-};
-
-/*
- * Handling of location sets.
- */
-
-XMLPUBFUN xmlLocationSetPtr XMLCALL			
-		    xmlXPtrLocationSetCreate	(xmlXPathObjectPtr val);
-XMLPUBFUN void XMLCALL			
-		    xmlXPtrFreeLocationSet	(xmlLocationSetPtr obj);
-XMLPUBFUN xmlLocationSetPtr XMLCALL	
-		    xmlXPtrLocationSetMerge	(xmlLocationSetPtr val1,
-						 xmlLocationSetPtr val2);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL	
-		    xmlXPtrNewRange		(xmlNodePtr start,
-						 int startindex,
-						 xmlNodePtr end,
-						 int endindex);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL	
-		    xmlXPtrNewRangePoints	(xmlXPathObjectPtr start,
-						 xmlXPathObjectPtr end);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL	
-		    xmlXPtrNewRangeNodePoint	(xmlNodePtr start,
-						 xmlXPathObjectPtr end);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL	
-		    xmlXPtrNewRangePointNode	(xmlXPathObjectPtr start,
-						 xmlNodePtr end);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL			
-		    xmlXPtrNewRangeNodes	(xmlNodePtr start,
-						 xmlNodePtr end);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL	
-		    xmlXPtrNewLocationSetNodes	(xmlNodePtr start,
-						 xmlNodePtr end);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL	
-		    xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL	
-		    xmlXPtrNewRangeNodeObject	(xmlNodePtr start,
-						 xmlXPathObjectPtr end);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL	
-		    xmlXPtrNewCollapsedRange	(xmlNodePtr start);
-XMLPUBFUN void XMLCALL			
-		    xmlXPtrLocationSetAdd	(xmlLocationSetPtr cur,
-						 xmlXPathObjectPtr val);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL	
-		    xmlXPtrWrapLocationSet	(xmlLocationSetPtr val);
-XMLPUBFUN void XMLCALL			
-		    xmlXPtrLocationSetDel	(xmlLocationSetPtr cur,
-						 xmlXPathObjectPtr val);
-XMLPUBFUN void XMLCALL			
-		    xmlXPtrLocationSetRemove	(xmlLocationSetPtr cur,
-						 int val);
-
-/*
- * Functions.
- */
-XMLPUBFUN xmlXPathContextPtr XMLCALL	
-		    xmlXPtrNewContext		(xmlDocPtr doc,
-						 xmlNodePtr here,
-						 xmlNodePtr origin);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL	
-		    xmlXPtrEval			(const xmlChar *str,
-						 xmlXPathContextPtr ctx);
-XMLPUBFUN void XMLCALL					    
-		    xmlXPtrRangeToFunction	(xmlXPathParserContextPtr ctxt,
-       						 int nargs);
-XMLPUBFUN xmlNodePtr XMLCALL		
-		    xmlXPtrBuildNodeList	(xmlXPathObjectPtr obj);
-XMLPUBFUN void XMLCALL		
-		    xmlXPtrEvalRangePredicate	(xmlXPathParserContextPtr ctxt);
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LIBXML_XPTR_ENABLED */
-#endif /* __XML_XPTR_H__ */
diff --git a/interfaces/ext/magic.h b/interfaces/ext/magic.h
deleted file mode 100644
index 765ff2b..0000000
--- a/interfaces/ext/magic.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) Christos Zoulas 2003.
- * 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 immediately at the beginning of the file, without modification,
- *    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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- */
-#ifndef _MAGIC_H
-#define _MAGIC_H
-
-#include <sys/types.h>
-
-#define	MAGIC_NONE		0x000000 /* No flags */
-#define	MAGIC_DEBUG		0x000001 /* Turn on debugging */
-#define	MAGIC_SYMLINK		0x000002 /* Follow symlinks */
-#define	MAGIC_COMPRESS		0x000004 /* Check inside compressed files */
-#define	MAGIC_DEVICES		0x000008 /* Look at the contents of devices */
-#define	MAGIC_MIME_TYPE		0x000010 /* Return the MIME type */
-#define	MAGIC_CONTINUE		0x000020 /* Return all matches */
-#define	MAGIC_CHECK		0x000040 /* Print warnings to stderr */
-#define	MAGIC_PRESERVE_ATIME	0x000080 /* Restore access time on exit */
-#define	MAGIC_RAW		0x000100 /* Don't translate unprintable chars */
-#define	MAGIC_ERROR		0x000200 /* Handle ENOENT etc as real errors */
-#define	MAGIC_MIME_ENCODING	0x000400 /* Return the MIME encoding */
-#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
-#define	MAGIC_APPLE		0x000800 /* Return the Apple creator and type */
-#define	MAGIC_NO_CHECK_COMPRESS	0x001000 /* Don't check for compressed files */
-#define	MAGIC_NO_CHECK_TAR	0x002000 /* Don't check for tar files */
-#define	MAGIC_NO_CHECK_SOFT	0x004000 /* Don't check magic entries */
-#define	MAGIC_NO_CHECK_APPTYPE	0x008000 /* Don't check application type */
-#define	MAGIC_NO_CHECK_ELF	0x010000 /* Don't check for elf details */
-#define	MAGIC_NO_CHECK_TEXT	0x020000 /* Don't check for text files */
-#define	MAGIC_NO_CHECK_CDF	0x040000 /* Don't check for cdf files */
-#define	MAGIC_NO_CHECK_TOKENS	0x100000 /* Don't check tokens */
-#define MAGIC_NO_CHECK_ENCODING 0x200000 /* Don't check text encodings */
-
-/* Defined for backwards compatibility (renamed) */
-#define	MAGIC_NO_CHECK_ASCII	MAGIC_NO_CHECK_TEXT
-
-/* Defined for backwards compatibility; do nothing */
-#define	MAGIC_NO_CHECK_FORTRAN	0x000000 /* Don't check ascii/fortran */
-#define	MAGIC_NO_CHECK_TROFF	0x000000 /* Don't check ascii/troff */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct magic_set *magic_t;
-magic_t magic_open(int);
-void magic_close(magic_t);
-
-const char *magic_getpath(const char *, int);
-const char *magic_file(magic_t, const char *);
-const char *magic_descriptor(magic_t, int);
-const char *magic_buffer(magic_t, const void *, size_t);
-
-const char *magic_error(magic_t);
-int magic_setflags(magic_t, int);
-
-int magic_load(magic_t, const char *);
-int magic_compile(magic_t, const char *);
-int magic_check(magic_t, const char *);
-int magic_errno(magic_t);
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif /* _MAGIC_H */
diff --git a/interfaces/ext/regex.h b/interfaces/ext/regex.h
deleted file mode 100644
index b39c3f9..0000000
--- a/interfaces/ext/regex.h
+++ /dev/null
@@ -1,557 +0,0 @@
-/* Definitions for data structures and routines for the regular
-   expression library.
-   Copyright (C) 1985,1989-93,1995-98,2000,2001,2002,2003,2005,2006
-   Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _REGEX_H
-#define _REGEX_H 1
-
-#include <sys/types.h>
-
-/* Allow the use in C++ code.  */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* The following two types have to be signed and unsigned integer type
-   wide enough to hold a value of a pointer.  For most ANSI compilers
-   ptrdiff_t and size_t should be likely OK.  Still size of these two
-   types is 2 for Microsoft C.  Ugh... */
-typedef long int s_reg_t;
-typedef unsigned long int active_reg_t;
-
-/* The following bits are used to determine the regexp syntax we
-   recognize.  The set/not-set meanings are chosen so that Emacs syntax
-   remains the value 0.  The bits are given in alphabetical order, and
-   the definitions shifted by one from the previous bit; thus, when we
-   add or remove a bit, only one other definition need change.  */
-typedef unsigned long int reg_syntax_t;
-
-/* If this bit is not set, then \ inside a bracket expression is literal.
-   If set, then such a \ quotes the following character.  */
-#define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1)
-
-/* If this bit is not set, then + and ? are operators, and \+ and \? are
-     literals.
-   If set, then \+ and \? are operators and + and ? are literals.  */
-#define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)
-
-/* If this bit is set, then character classes are supported.  They are:
-     [:alpha:], [:upper:], [:lower:],  [:digit:], [:alnum:], [:xdigit:],
-     [:space:], [:print:], [:punct:], [:graph:], and [:cntrl:].
-   If not set, then character classes are not supported.  */
-#define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1)
-
-/* If this bit is set, then ^ and $ are always anchors (outside bracket
-     expressions, of course).
-   If this bit is not set, then it depends:
-        ^  is an anchor if it is at the beginning of a regular
-           expression or after an open-group or an alternation operator;
-        $  is an anchor if it is at the end of a regular expression, or
-           before a close-group or an alternation operator.
-
-   This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because
-   POSIX draft 11.2 says that * etc. in leading positions is undefined.
-   We already implemented a previous draft which made those constructs
-   invalid, though, so we haven't changed the code back.  */
-#define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1)
-
-/* If this bit is set, then special characters are always special
-     regardless of where they are in the pattern.
-   If this bit is not set, then special characters are special only in
-     some contexts; otherwise they are ordinary.  Specifically,
-     * + ? and intervals are only special when not after the beginning,
-     open-group, or alternation operator.  */
-#define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)
-
-/* If this bit is set, then *, +, ?, and { cannot be first in an re or
-     immediately after an alternation or begin-group operator.  */
-#define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1)
-
-/* If this bit is set, then . matches newline.
-   If not set, then it doesn't.  */
-#define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1)
-
-/* If this bit is set, then . doesn't match NUL.
-   If not set, then it does.  */
-#define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1)
-
-/* If this bit is set, nonmatching lists [^...] do not match newline.
-   If not set, they do.  */
-#define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)
-
-/* If this bit is set, either \{...\} or {...} defines an
-     interval, depending on RE_NO_BK_BRACES.
-   If not set, \{, \}, {, and } are literals.  */
-#define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
-
-/* If this bit is set, +, ? and | aren't recognized as operators.
-   If not set, they are.  */
-#define RE_LIMITED_OPS (RE_INTERVALS << 1)
-
-/* If this bit is set, newline is an alternation operator.
-   If not set, newline is literal.  */
-#define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1)
-
-/* If this bit is set, then `{...}' defines an interval, and \{ and \}
-     are literals.
-  If not set, then `\{...\}' defines an interval.  */
-#define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1)
-
-/* If this bit is set, (...) defines a group, and \( and \) are literals.
-   If not set, \(...\) defines a group, and ( and ) are literals.  */
-#define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1)
-
-/* If this bit is set, then \<digit> matches <digit>.
-   If not set, then \<digit> is a back-reference.  */
-#define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)
-
-/* If this bit is set, then | is an alternation operator, and \| is literal.
-   If not set, then \| is an alternation operator, and | is literal.  */
-#define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)
-
-/* If this bit is set, then an ending range point collating higher
-     than the starting range point, as in [z-a], is invalid.
-   If not set, then when ending range point collates higher than the
-     starting range point, the range is ignored.  */
-#define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1)
-
-/* If this bit is set, then an unmatched ) is ordinary.
-   If not set, then an unmatched ) is invalid.  */
-#define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1)
-
-/* If this bit is set, succeed as soon as we match the whole pattern,
-   without further backtracking.  */
-#define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1)
-
-/* If this bit is set, do not process the GNU regex operators.
-   If not set, then the GNU regex operators are recognized. */
-#define RE_NO_GNU_OPS (RE_NO_POSIX_BACKTRACKING << 1)
-
-/* If this bit is set, turn on internal regex debugging.
-   If not set, and debugging was on, turn it off.
-   This only works if regex.c is compiled -DDEBUG.
-   We define this bit always, so that all that's needed to turn on
-   debugging is to recompile regex.c; the calling code can always have
-   this bit set, and it won't affect anything in the normal case. */
-#define RE_DEBUG (RE_NO_GNU_OPS << 1)
-
-/* If this bit is set, a syntactically invalid interval is treated as
-   a string of ordinary characters.  For example, the ERE 'a{1' is
-   treated as 'a\{1'.  */
-#define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1)
-
-/* If this bit is set, then ignore case when matching.
-   If not set, then case is significant.  */
-#define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1)
-
-/* This bit is used internally like RE_CONTEXT_INDEP_ANCHORS but only
-   for ^, because it is difficult to scan the regex backwards to find
-   whether ^ should be special.  */
-#define RE_CARET_ANCHORS_HERE (RE_ICASE << 1)
-
-/* If this bit is set, then \{ cannot be first in an bre or
-   immediately after an alternation or begin-group operator.  */
-#define RE_CONTEXT_INVALID_DUP (RE_CARET_ANCHORS_HERE << 1)
-
-/* If this bit is set, then no_sub will be set to 1 during
-   re_compile_pattern.  */
-#define RE_NO_SUB (RE_CONTEXT_INVALID_DUP << 1)
-
-/* This global variable defines the particular regexp syntax to use (for
-   some interfaces).  When a regexp is compiled, the syntax used is
-   stored in the pattern buffer, so changing this does not affect
-   already-compiled regexps.  */
-extern reg_syntax_t re_syntax_options;
-
-/* Define combinations of the above bits for the standard possibilities.
-   (The [[[ comments delimit what gets put into the Texinfo file, so
-   don't delete them!)  */
-/* [[[begin syntaxes]]] */
-#define RE_SYNTAX_EMACS 0
-
-#define RE_SYNTAX_AWK							\
-  (RE_BACKSLASH_ESCAPE_IN_LISTS   | RE_DOT_NOT_NULL			\
-   | RE_NO_BK_PARENS              | RE_NO_BK_REFS			\
-   | RE_NO_BK_VBAR                | RE_NO_EMPTY_RANGES			\
-   | RE_DOT_NEWLINE		  | RE_CONTEXT_INDEP_ANCHORS		\
-   | RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS)
-
-#define RE_SYNTAX_GNU_AWK						\
-  ((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DEBUG)	\
-   & ~(RE_DOT_NOT_NULL | RE_INTERVALS | RE_CONTEXT_INDEP_OPS		\
-       | RE_CONTEXT_INVALID_OPS ))
-
-#define RE_SYNTAX_POSIX_AWK						\
-  (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS		\
-   | RE_INTERVALS	    | RE_NO_GNU_OPS)
-
-#define RE_SYNTAX_GREP							\
-  (RE_BK_PLUS_QM              | RE_CHAR_CLASSES				\
-   | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS				\
-   | RE_NEWLINE_ALT)
-
-#define RE_SYNTAX_EGREP							\
-  (RE_CHAR_CLASSES        | RE_CONTEXT_INDEP_ANCHORS			\
-   | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE			\
-   | RE_NEWLINE_ALT       | RE_NO_BK_PARENS				\
-   | RE_NO_BK_VBAR)
-
-#define RE_SYNTAX_POSIX_EGREP						\
-  (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES			\
-   | RE_INVALID_INTERVAL_ORD)
-
-/* P1003.2/D11.2, section 4.20.7.1, lines 5078ff.  */
-#define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC
-
-#define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC
-
-/* Syntax bits common to both basic and extended POSIX regex syntax.  */
-#define _RE_SYNTAX_POSIX_COMMON						\
-  (RE_CHAR_CLASSES | RE_DOT_NEWLINE      | RE_DOT_NOT_NULL		\
-   | RE_INTERVALS  | RE_NO_EMPTY_RANGES)
-
-#define RE_SYNTAX_POSIX_BASIC						\
-  (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM | RE_CONTEXT_INVALID_DUP)
-
-/* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
-   RE_LIMITED_OPS, i.e., \? \+ \| are not recognized.  Actually, this
-   isn't minimal, since other operators, such as \`, aren't disabled.  */
-#define RE_SYNTAX_POSIX_MINIMAL_BASIC					\
-  (_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS)
-
-#define RE_SYNTAX_POSIX_EXTENDED					\
-  (_RE_SYNTAX_POSIX_COMMON  | RE_CONTEXT_INDEP_ANCHORS			\
-   | RE_CONTEXT_INDEP_OPS   | RE_NO_BK_BRACES				\
-   | RE_NO_BK_PARENS        | RE_NO_BK_VBAR				\
-   | RE_CONTEXT_INVALID_OPS | RE_UNMATCHED_RIGHT_PAREN_ORD)
-
-/* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INDEP_OPS is
-   removed and RE_NO_BK_REFS is added.  */
-#define RE_SYNTAX_POSIX_MINIMAL_EXTENDED				\
-  (_RE_SYNTAX_POSIX_COMMON  | RE_CONTEXT_INDEP_ANCHORS			\
-   | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES				\
-   | RE_NO_BK_PARENS        | RE_NO_BK_REFS				\
-   | RE_NO_BK_VBAR	    | RE_UNMATCHED_RIGHT_PAREN_ORD)
-/* [[[end syntaxes]]] */
-
-/* Maximum number of duplicates an interval can allow.  Some systems
-   (erroneously) define this in other header files, but we want our
-   value, so remove any previous define.  */
-#ifdef RE_DUP_MAX
-# undef RE_DUP_MAX
-#endif
-/* If sizeof(int) == 2, then ((1 << 15) - 1) overflows.  */
-#define RE_DUP_MAX (0x7fff)
-
-
-/* POSIX `cflags' bits (i.e., information for `regcomp').  */
-
-/* If this bit is set, then use extended regular expression syntax.
-   If not set, then use basic regular expression syntax.  */
-#define REG_EXTENDED 1
-
-/* If this bit is set, then ignore case when matching.
-   If not set, then case is significant.  */
-#define REG_ICASE (REG_EXTENDED << 1)
-
-/* If this bit is set, then anchors do not match at newline
-     characters in the string.
-   If not set, then anchors do match at newlines.  */
-#define REG_NEWLINE (REG_ICASE << 1)
-
-/* If this bit is set, then report only success or fail in regexec.
-   If not set, then returns differ between not matching and errors.  */
-#define REG_NOSUB (REG_NEWLINE << 1)
-
-
-/* POSIX `eflags' bits (i.e., information for regexec).  */
-
-/* If this bit is set, then the beginning-of-line operator doesn't match
-     the beginning of the string (presumably because it's not the
-     beginning of a line).
-   If not set, then the beginning-of-line operator does match the
-     beginning of the string.  */
-#define REG_NOTBOL 1
-
-/* Like REG_NOTBOL, except for the end-of-line.  */
-#define REG_NOTEOL (1 << 1)
-
-/* Use PMATCH[0] to delimit the start and end of the search in the
-   buffer.  */
-#define REG_STARTEND (1 << 2)
-
-
-/* If any error codes are removed, changed, or added, update the
-   `re_error_msg' table in regex.c.  */
-typedef enum
-{
-#ifdef _XOPEN_SOURCE
-  REG_ENOSYS = -1,	/* This will never happen for this implementation.  */
-#endif
-
-  REG_NOERROR = 0,	/* Success.  */
-  REG_NOMATCH,		/* Didn't find a match (for regexec).  */
-
-  /* POSIX regcomp return error codes.  (In the order listed in the
-     standard.)  */
-  REG_BADPAT,		/* Invalid pattern.  */
-  REG_ECOLLATE,		/* Inalid collating element.  */
-  REG_ECTYPE,		/* Invalid character class name.  */
-  REG_EESCAPE,		/* Trailing backslash.  */
-  REG_ESUBREG,		/* Invalid back reference.  */
-  REG_EBRACK,		/* Unmatched left bracket.  */
-  REG_EPAREN,		/* Parenthesis imbalance.  */
-  REG_EBRACE,		/* Unmatched \{.  */
-  REG_BADBR,		/* Invalid contents of \{\}.  */
-  REG_ERANGE,		/* Invalid range end.  */
-  REG_ESPACE,		/* Ran out of memory.  */
-  REG_BADRPT,		/* No preceding re for repetition op.  */
-
-  /* Error codes we've added.  */
-  REG_EEND,		/* Premature end.  */
-  REG_ESIZE,		/* Compiled pattern bigger than 2^16 bytes.  */
-  REG_ERPAREN		/* Unmatched ) or \); not returned from regcomp.  */
-} reg_errcode_t;
-
-/* This data structure represents a compiled pattern.  Before calling
-   the pattern compiler, the fields `buffer', `allocated', `fastmap',
-   `translate', and `no_sub' can be set.  After the pattern has been
-   compiled, the `re_nsub' field is available.  All other fields are
-   private to the regex routines.  */
-
-#ifndef RE_TRANSLATE_TYPE
-# define RE_TRANSLATE_TYPE unsigned char *
-#endif
-
-struct re_pattern_buffer
-{
-  /* Space that holds the compiled pattern.  It is declared as
-     `unsigned char *' because its elements are sometimes used as
-     array indexes.  */
-  unsigned char *buffer;
-
-  /* Number of bytes to which `buffer' points.  */
-  unsigned long int allocated;
-
-  /* Number of bytes actually used in `buffer'.  */
-  unsigned long int used;
-
-  /* Syntax setting with which the pattern was compiled.  */
-  reg_syntax_t syntax;
-
-  /* Pointer to a fastmap, if any, otherwise zero.  re_search uses the
-     fastmap, if there is one, to skip over impossible starting points
-     for matches.  */
-  char *fastmap;
-
-  /* Either a translate table to apply to all characters before
-     comparing them, or zero for no translation.  The translation is
-     applied to a pattern when it is compiled and to a string when it
-     is matched.  */
-  RE_TRANSLATE_TYPE translate;
-
-  /* Number of subexpressions found by the compiler.  */
-  size_t re_nsub;
-
-  /* Zero if this pattern cannot match the empty string, one else.
-     Well, in truth it's used only in `re_search_2', to see whether or
-     not we should use the fastmap, so we don't set this absolutely
-     perfectly; see `re_compile_fastmap' (the `duplicate' case).  */
-  unsigned can_be_null : 1;
-
-  /* If REGS_UNALLOCATED, allocate space in the `regs' structure
-     for `max (RE_NREGS, re_nsub + 1)' groups.
-     If REGS_REALLOCATE, reallocate space if necessary.
-     If REGS_FIXED, use what's there.  */
-#define REGS_UNALLOCATED 0
-#define REGS_REALLOCATE 1
-#define REGS_FIXED 2
-  unsigned regs_allocated : 2;
-
-  /* Set to zero when `regex_compile' compiles a pattern; set to one
-     by `re_compile_fastmap' if it updates the fastmap.  */
-  unsigned fastmap_accurate : 1;
-
-  /* If set, `re_match_2' does not return information about
-     subexpressions.  */
-  unsigned no_sub : 1;
-
-  /* If set, a beginning-of-line anchor doesn't match at the beginning
-     of the string.  */
-  unsigned not_bol : 1;
-
-  /* Similarly for an end-of-line anchor.  */
-  unsigned not_eol : 1;
-
-  /* If true, an anchor at a newline matches.  */
-  unsigned newline_anchor : 1;
-};
-
-typedef struct re_pattern_buffer regex_t;
-
-/* Type for byte offsets within the string.  POSIX mandates this.  */
-typedef int regoff_t;
-
-
-/* This is the structure we store register match data in.  See
-   regex.texinfo for a full description of what registers match.  */
-struct re_registers
-{
-  unsigned num_regs;
-  regoff_t *start;
-  regoff_t *end;
-};
-
-
-/* If `regs_allocated' is REGS_UNALLOCATED in the pattern buffer,
-   `re_match_2' returns information about at least this many registers
-   the first time a `regs' structure is passed.  */
-#ifndef RE_NREGS
-# define RE_NREGS 30
-#endif
-
-
-/* POSIX specification for registers.  Aside from the different names than
-   `re_registers', POSIX uses an array of structures, instead of a
-   structure of arrays.  */
-typedef struct
-{
-  regoff_t rm_so;  /* Byte offset from string's start to substring's start.  */
-  regoff_t rm_eo;  /* Byte offset from string's start to substring's end.  */
-} regmatch_t;
-
-
-/* Declarations for routines.  */
-
-/* Sets the current default syntax to SYNTAX, and return the old syntax.
-   You can also simply assign to the `re_syntax_options' variable.  */
-extern reg_syntax_t re_set_syntax (reg_syntax_t __syntax);
-
-/* Compile the regular expression PATTERN, with length LENGTH
-   and syntax given by the global `re_syntax_options', into the buffer
-   BUFFER.  Return NULL if successful, and an error string if not.  */
-extern const char *re_compile_pattern (const char *__pattern, size_t __length,
-				       struct re_pattern_buffer *__buffer);
-
-
-/* Compile a fastmap for the compiled pattern in BUFFER; used to
-   accelerate searches.  Return 0 if successful and -2 if was an
-   internal error.  */
-extern int re_compile_fastmap (struct re_pattern_buffer *__buffer);
-
-
-/* Search in the string STRING (with length LENGTH) for the pattern
-   compiled into BUFFER.  Start searching at position START, for RANGE
-   characters.  Return the starting position of the match, -1 for no
-   match, or -2 for an internal error.  Also return register
-   information in REGS (if REGS and BUFFER->no_sub are nonzero).  */
-extern int re_search (struct re_pattern_buffer *__buffer, const char *__string,
-		      int __length, int __start, int __range,
-		      struct re_registers *__regs);
-
-
-/* Like `re_search', but search in the concatenation of STRING1 and
-   STRING2.  Also, stop searching at index START + STOP.  */
-extern int re_search_2 (struct re_pattern_buffer *__buffer,
-			const char *__string1, int __length1,
-			const char *__string2, int __length2, int __start,
-			int __range, struct re_registers *__regs, int __stop);
-
-
-/* Like `re_search', but return how many characters in STRING the regexp
-   in BUFFER matched, starting at position START.  */
-extern int re_match (struct re_pattern_buffer *__buffer, const char *__string,
-		     int __length, int __start, struct re_registers *__regs);
-
-
-/* Relates to `re_match' as `re_search_2' relates to `re_search'.  */
-extern int re_match_2 (struct re_pattern_buffer *__buffer,
-		       const char *__string1, int __length1,
-		       const char *__string2, int __length2, int __start,
-		       struct re_registers *__regs, int __stop);
-
-
-/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
-   ENDS.  Subsequent matches using BUFFER and REGS will use this memory
-   for recording register information.  STARTS and ENDS must be
-   allocated with malloc, and must each be at least `NUM_REGS * sizeof
-   (regoff_t)' bytes long.
-
-   If NUM_REGS == 0, then subsequent matches should allocate their own
-   register data.
-
-   Unless this function is called, the first search or match using
-   PATTERN_BUFFER will allocate its own register data, without
-   freeing the old data.  */
-extern void re_set_registers (struct re_pattern_buffer *__buffer,
-			      struct re_registers *__regs,
-			      unsigned int __num_regs,
-			      regoff_t *__starts, regoff_t *__ends);
-
-#if defined _REGEX_RE_COMP || defined _LIBC
-# ifndef _CRAY
-/* 4.2 bsd compatibility.  */
-extern char *re_comp (const char *);
-extern int re_exec (const char *);
-# endif
-#endif
-
-/* GCC 2.95 and later have "__restrict"; C99 compilers have
-   "restrict", and "configure" may have defined "restrict".  */
-#ifndef __restrict
-# if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__))
-#  if defined restrict || 199901L <= __STDC_VERSION__
-#   define __restrict restrict
-#  else
-#   define __restrict
-#  endif
-# endif
-#endif
-/* gcc 3.1 and up support the [restrict] syntax.  */
-#ifndef __restrict_arr
-# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) \
-     && !defined __GNUG__
-#  define __restrict_arr __restrict
-# else
-#  define __restrict_arr
-# endif
-#endif
-
-/* POSIX compatibility.  */
-extern int regcomp (regex_t *__restrict __preg,
-		    const char *__restrict __pattern,
-		    int __cflags);
-
-extern int regexec (const regex_t *__restrict __preg,
-		    const char *__restrict __string, size_t __nmatch,
-		    regmatch_t __pmatch[__restrict_arr],
-		    int __eflags);
-
-extern size_t regerror (int __errcode, const regex_t *__restrict __preg,
-			char *__restrict __errbuf, size_t __errbuf_size);
-
-extern void regfree (regex_t *__preg);
-
-
-#ifdef __cplusplus
-}
-#endif	/* C++ */
-
-#endif /* regex.h */
diff --git a/interfaces/ext/zconf.h b/interfaces/ext/zconf.h
deleted file mode 100644
index e81703c..0000000
--- a/interfaces/ext/zconf.h
+++ /dev/null
@@ -1,304 +0,0 @@
-/* zconf.h -- configuration of the zlib compression library
- * Copyright (C) 1995-2010 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#ifndef ZCONF_H
-#define ZCONF_H
-
-
-#if defined(__MSDOS__) && !defined(MSDOS)
-#  define MSDOS
-#endif
-#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
-#  define OS2
-#endif
-#if defined(_WINDOWS) && !defined(WINDOWS)
-#  define WINDOWS
-#endif
-#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
-#  ifndef WIN32
-#    define WIN32
-#  endif
-#endif
-#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
-#  if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
-#    ifndef SYS16BIT
-#      define SYS16BIT
-#    endif
-#  endif
-#endif
-
-/*
- * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
- * than 64k bytes at a time (needed on systems with 16-bit int).
- */
-#ifdef SYS16BIT
-#  define MAXSEG_64K
-#endif
-#ifdef MSDOS
-#  define UNALIGNED_OK
-#endif
-
-#ifdef __STDC_VERSION__
-#  ifndef STDC
-#    define STDC
-#  endif
-#  if __STDC_VERSION__ >= 199901L
-#    ifndef STDC99
-#      define STDC99
-#    endif
-#  endif
-#endif
-#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
-#  define STDC
-#endif
-#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
-#  define STDC
-#endif
-#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
-#  define STDC
-#endif
-#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
-#  define STDC
-#endif
-
-#if defined(__OS400__) && !defined(STDC)    /* iSeries (formerly AS/400). */
-#  define STDC
-#endif
-
-#ifndef STDC
-#  ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
-#    define const       /* note: need a more gentle solution here */
-#  endif
-#endif
-
-/* Some Mac compilers merge all .h files incorrectly: */
-#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
-#  define NO_DUMMY_DECL
-#endif
-
-/* Maximum value for memLevel in deflateInit2 */
-#ifndef MAX_MEM_LEVEL
-#  ifdef MAXSEG_64K
-#    define MAX_MEM_LEVEL 8
-#  else
-#    define MAX_MEM_LEVEL 9
-#  endif
-#endif
-
-/* Maximum value for windowBits in deflateInit2 and inflateInit2.
- * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
- * created by gzip. (Files created by minigzip can still be extracted by
- * gzip.)
- */
-#ifndef MAX_WBITS
-#  define MAX_WBITS   15 /* 32K LZ77 window */
-#endif
-
-/* The memory requirements for deflate are (in bytes):
-            (1 << (windowBits+2)) +  (1 << (memLevel+9))
- that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
- plus a few kilobytes for small objects. For example, if you want to reduce
- the default memory requirements from 256K to 128K, compile with
-     make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
- Of course this will generally degrade compression (there's no free lunch).
-
-   The memory requirements for inflate are (in bytes) 1 << windowBits
- that is, 32K for windowBits=15 (default value) plus a few kilobytes
- for small objects.
-*/
-
-                        /* Type declarations */
-
-#ifndef OF /* function prototypes */
-#  ifdef STDC
-#    define OF(args)  args
-#  else
-#    define OF(args)  ()
-#  endif
-#endif
-
-/* The following definitions for FAR are needed only for MSDOS mixed
- * model programming (small or medium model with some far allocations).
- * This was tested only with MSC; for other MSDOS compilers you may have
- * to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,
- * just define FAR to be empty.
- */
-#ifdef SYS16BIT
-#  if defined(M_I86SM) || defined(M_I86MM)
-     /* MSC small or medium model */
-#    define SMALL_MEDIUM
-#    ifdef _MSC_VER
-#      define FAR _far
-#    else
-#      define FAR far
-#    endif
-#  endif
-#  if (defined(__SMALL__) || defined(__MEDIUM__))
-     /* Turbo C small or medium model */
-#    define SMALL_MEDIUM
-#    ifdef __BORLANDC__
-#      define FAR _far
-#    else
-#      define FAR far
-#    endif
-#  endif
-#endif
-
-#if defined(WINDOWS) || defined(WIN32)
-   /* If building or using zlib as a DLL, define ZLIB_DLL.
-    * This is not mandatory, but it offers a little performance increase.
-    */
-#  ifdef ZLIB_DLL
-#    if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
-#      ifdef ZLIB_INTERNAL
-#        define ZEXTERN extern __declspec(dllexport)
-#      else
-#        define ZEXTERN extern __declspec(dllimport)
-#      endif
-#    endif
-#  endif  /* ZLIB_DLL */
-   /* If building or using zlib with the WINAPI/WINAPIV calling convention,
-    * define ZLIB_WINAPI.
-    * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
-    */
-#  ifdef ZLIB_WINAPI
-#    ifdef FAR
-#      undef FAR
-#    endif
-#    include <windows.h>
-     /* No need for _export, use ZLIB.DEF instead. */
-     /* For complete Windows compatibility, use WINAPI, not __stdcall. */
-#    define ZEXPORT WINAPI
-#    ifdef WIN32
-#      define ZEXPORTVA WINAPIV
-#    else
-#      define ZEXPORTVA FAR CDECL
-#    endif
-#  endif
-#endif
-
-#if defined (__BEOS__)
-#  ifdef ZLIB_DLL
-#    ifdef ZLIB_INTERNAL
-#      define ZEXPORT   __declspec(dllexport)
-#      define ZEXPORTVA __declspec(dllexport)
-#    else
-#      define ZEXPORT   __declspec(dllimport)
-#      define ZEXPORTVA __declspec(dllimport)
-#    endif
-#  endif
-#endif
-
-#ifndef ZEXTERN
-#  define ZEXTERN extern
-#endif
-#ifndef ZEXPORT
-#  define ZEXPORT
-#endif
-#ifndef ZEXPORTVA
-#  define ZEXPORTVA
-#endif
-
-#ifndef FAR
-#  define FAR
-#endif
-
-#if !defined(__MACTYPES__)
-typedef unsigned char  Byte;  /* 8 bits */
-#endif
-typedef unsigned int   uInt;  /* 16 bits or more */
-typedef unsigned long  uLong; /* 32 bits or more */
-
-#ifdef SMALL_MEDIUM
-   /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
-#  define Bytef Byte FAR
-#else
-   typedef Byte  FAR Bytef;
-#endif
-typedef char  FAR charf;
-typedef int   FAR intf;
-typedef uInt  FAR uIntf;
-typedef uLong FAR uLongf;
-
-#ifdef STDC
-   typedef void const *voidpc;
-   typedef void FAR   *voidpf;
-   typedef void       *voidp;
-#else
-   typedef Byte const *voidpc;
-   typedef Byte FAR   *voidpf;
-   typedef Byte       *voidp;
-#endif
-
-#if UNIX
-#  define Z_HAVE_UNISTD_H
-#endif
-
-#ifdef STDC
-#  include <sys/types.h>    /* for off_t */
-#endif
-
-/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
- * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
- * though the former does not conform to the LFS document), but considering
- * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
- * equivalently requesting no 64-bit operations
- */
-#if -_LARGEFILE64_SOURCE - -1 == 1
-#  undef _LARGEFILE64_SOURCE
-#endif
-
-#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
-#  include <unistd.h>       /* for SEEK_* and off_t */
-#  ifdef VMS
-#    include <unixio.h>     /* for off_t */
-#  endif
-#  ifndef z_off_t
-#    define z_off_t off_t
-#  endif
-#endif
-
-#ifndef SEEK_SET
-#  define SEEK_SET        0       /* Seek from beginning of file.  */
-#  define SEEK_CUR        1       /* Seek from current position.  */
-#  define SEEK_END        2       /* Set file pointer to EOF plus "offset" */
-#endif
-
-#ifndef z_off_t
-#  define z_off_t long
-#endif
-
-#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
-#  define z_off64_t off64_t
-#else
-#  define z_off64_t z_off_t
-#endif
-
-#if defined(__OS400__)
-#  define NO_vsnprintf
-#endif
-
-#if defined(__MVS__)
-#  define NO_vsnprintf
-#endif
-
-/* MVS linker does not support external names larger than 8 bytes */
-#if defined(__MVS__)
-  #pragma map(deflateInit_,"DEIN")
-  #pragma map(deflateInit2_,"DEIN2")
-  #pragma map(deflateEnd,"DEEND")
-  #pragma map(deflateBound,"DEBND")
-  #pragma map(inflateInit_,"ININ")
-  #pragma map(inflateInit2_,"ININ2")
-  #pragma map(inflateEnd,"INEND")
-  #pragma map(inflateSync,"INSY")
-  #pragma map(inflateSetDictionary,"INSEDI")
-  #pragma map(compressBound,"CMBND")
-  #pragma map(inflate_table,"INTABL")
-  #pragma map(inflate_fast,"INFA")
-  #pragma map(inflate_copyright,"INCOPY")
-#endif
-
-#endif /* ZCONF_H */
diff --git a/interfaces/ext/zlib.h b/interfaces/ext/zlib.h
deleted file mode 100644
index bfbba83..0000000
--- a/interfaces/ext/zlib.h
+++ /dev/null
@@ -1,1613 +0,0 @@
-/* zlib.h -- interface of the 'zlib' general purpose compression library
-  version 1.2.5, April 19th, 2010
-
-  Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jean-loup Gailly        Mark Adler
-  jloup at gzip.org          madler at alumni.caltech.edu
-
-
-  The data format used by the zlib library is described by RFCs (Request for
-  Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt
-  (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
-*/
-
-#ifndef ZLIB_H
-#define ZLIB_H
-
-#include "zconf.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define ZLIB_VERSION "1.2.5"
-#define ZLIB_VERNUM 0x1250
-#define ZLIB_VER_MAJOR 1
-#define ZLIB_VER_MINOR 2
-#define ZLIB_VER_REVISION 5
-#define ZLIB_VER_SUBREVISION 0
-
-/*
-    The 'zlib' compression library provides in-memory compression and
-  decompression functions, including integrity checks of the uncompressed data.
-  This version of the library supports only one compression method (deflation)
-  but other algorithms will be added later and will have the same stream
-  interface.
-
-    Compression can be done in a single step if the buffers are large enough,
-  or can be done by repeated calls of the compression function.  In the latter
-  case, the application must provide more input and/or consume the output
-  (providing more output space) before each call.
-
-    The compressed data format used by default by the in-memory functions is
-  the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
-  around a deflate stream, which is itself documented in RFC 1951.
-
-    The library also supports reading and writing files in gzip (.gz) format
-  with an interface similar to that of stdio using the functions that start
-  with "gz".  The gzip format is different from the zlib format.  gzip is a
-  gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
-
-    This library can optionally read and write gzip streams in memory as well.
-
-    The zlib format was designed to be compact and fast for use in memory
-  and on communications channels.  The gzip format was designed for single-
-  file compression on file systems, has a larger header than zlib to maintain
-  directory information, and uses a different, slower check method than zlib.
-
-    The library does not install any signal handler.  The decoder checks
-  the consistency of the compressed data, so the library should never crash
-  even in case of corrupted input.
-*/
-
-typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
-typedef void   (*free_func)  OF((voidpf opaque, voidpf address));
-
-struct internal_state;
-
-typedef struct z_stream_s {
-    Bytef    *next_in;  /* next input byte */
-    uInt     avail_in;  /* number of bytes available at next_in */
-    uLong    total_in;  /* total nb of input bytes read so far */
-
-    Bytef    *next_out; /* next output byte should be put there */
-    uInt     avail_out; /* remaining free space at next_out */
-    uLong    total_out; /* total nb of bytes output so far */
-
-    char     *msg;      /* last error message, NULL if no error */
-    struct internal_state FAR *state; /* not visible by applications */
-
-    alloc_func zalloc;  /* used to allocate the internal state */
-    free_func  zfree;   /* used to free the internal state */
-    voidpf     opaque;  /* private data object passed to zalloc and zfree */
-
-    int     data_type;  /* best guess about the data type: binary or text */
-    uLong   adler;      /* adler32 value of the uncompressed data */
-    uLong   reserved;   /* reserved for future use */
-} z_stream;
-
-typedef z_stream FAR *z_streamp;
-
-/*
-     gzip header information passed to and from zlib routines.  See RFC 1952
-  for more details on the meanings of these fields.
-*/
-typedef struct gz_header_s {
-    int     text;       /* true if compressed data believed to be text */
-    uLong   time;       /* modification time */
-    int     xflags;     /* extra flags (not used when writing a gzip file) */
-    int     os;         /* operating system */
-    Bytef   *extra;     /* pointer to extra field or Z_NULL if none */
-    uInt    extra_len;  /* extra field length (valid if extra != Z_NULL) */
-    uInt    extra_max;  /* space at extra (only when reading header) */
-    Bytef   *name;      /* pointer to zero-terminated file name or Z_NULL */
-    uInt    name_max;   /* space at name (only when reading header) */
-    Bytef   *comment;   /* pointer to zero-terminated comment or Z_NULL */
-    uInt    comm_max;   /* space at comment (only when reading header) */
-    int     hcrc;       /* true if there was or will be a header crc */
-    int     done;       /* true when done reading gzip header (not used
-                           when writing a gzip file) */
-} gz_header;
-
-typedef gz_header FAR *gz_headerp;
-
-/*
-     The application must update next_in and avail_in when avail_in has dropped
-   to zero.  It must update next_out and avail_out when avail_out has dropped
-   to zero.  The application must initialize zalloc, zfree and opaque before
-   calling the init function.  All other fields are set by the compression
-   library and must not be updated by the application.
-
-     The opaque value provided by the application will be passed as the first
-   parameter for calls of zalloc and zfree.  This can be useful for custom
-   memory management.  The compression library attaches no meaning to the
-   opaque value.
-
-     zalloc must return Z_NULL if there is not enough memory for the object.
-   If zlib is used in a multi-threaded application, zalloc and zfree must be
-   thread safe.
-
-     On 16-bit systems, the functions zalloc and zfree must be able to allocate
-   exactly 65536 bytes, but will not be required to allocate more than this if
-   the symbol MAXSEG_64K is defined (see zconf.h).  WARNING: On MSDOS, pointers
-   returned by zalloc for objects of exactly 65536 bytes *must* have their
-   offset normalized to zero.  The default allocation function provided by this
-   library ensures this (see zutil.c).  To reduce memory requirements and avoid
-   any allocation of 64K objects, at the expense of compression ratio, compile
-   the library with -DMAX_WBITS=14 (see zconf.h).
-
-     The fields total_in and total_out can be used for statistics or progress
-   reports.  After compression, total_in holds the total size of the
-   uncompressed data and may be saved for use in the decompressor (particularly
-   if the decompressor wants to decompress everything in a single step).
-*/
-
-                        /* constants */
-
-#define Z_NO_FLUSH      0
-#define Z_PARTIAL_FLUSH 1
-#define Z_SYNC_FLUSH    2
-#define Z_FULL_FLUSH    3
-#define Z_FINISH        4
-#define Z_BLOCK         5
-#define Z_TREES         6
-/* Allowed flush values; see deflate() and inflate() below for details */
-
-#define Z_OK            0
-#define Z_STREAM_END    1
-#define Z_NEED_DICT     2
-#define Z_ERRNO        (-1)
-#define Z_STREAM_ERROR (-2)
-#define Z_DATA_ERROR   (-3)
-#define Z_MEM_ERROR    (-4)
-#define Z_BUF_ERROR    (-5)
-#define Z_VERSION_ERROR (-6)
-/* Return codes for the compression/decompression functions. Negative values
- * are errors, positive values are used for special but normal events.
- */
-
-#define Z_NO_COMPRESSION         0
-#define Z_BEST_SPEED             1
-#define Z_BEST_COMPRESSION       9
-#define Z_DEFAULT_COMPRESSION  (-1)
-/* compression levels */
-
-#define Z_FILTERED            1
-#define Z_HUFFMAN_ONLY        2
-#define Z_RLE                 3
-#define Z_FIXED               4
-#define Z_DEFAULT_STRATEGY    0
-/* compression strategy; see deflateInit2() below for details */
-
-#define Z_BINARY   0
-#define Z_TEXT     1
-#define Z_ASCII    Z_TEXT   /* for compatibility with 1.2.2 and earlier */
-#define Z_UNKNOWN  2
-/* Possible values of the data_type field (though see inflate()) */
-
-#define Z_DEFLATED   8
-/* The deflate compression method (the only one supported in this version) */
-
-#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
-
-#define zlib_version zlibVersion()
-/* for compatibility with versions < 1.0.2 */
-
-
-                        /* basic functions */
-
-ZEXTERN const char * ZEXPORT zlibVersion OF((void));
-/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
-   If the first character differs, the library code actually used is not
-   compatible with the zlib.h header file used by the application.  This check
-   is automatically made by deflateInit and inflateInit.
- */
-
-/*
-ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
-
-     Initializes the internal stream state for compression.  The fields
-   zalloc, zfree and opaque must be initialized before by the caller.  If
-   zalloc and zfree are set to Z_NULL, deflateInit updates them to use default
-   allocation functions.
-
-     The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
-   1 gives best speed, 9 gives best compression, 0 gives no compression at all
-   (the input data is simply copied a block at a time).  Z_DEFAULT_COMPRESSION
-   requests a default compromise between speed and compression (currently
-   equivalent to level 6).
-
-     deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
-   memory, Z_STREAM_ERROR if level is not a valid compression level, or
-   Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
-   with the version assumed by the caller (ZLIB_VERSION).  msg is set to null
-   if there is no error message.  deflateInit does not perform any compression:
-   this will be done by deflate().
-*/
-
-
-ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
-/*
-    deflate compresses as much data as possible, and stops when the input
-  buffer becomes empty or the output buffer becomes full.  It may introduce
-  some output latency (reading input without producing any output) except when
-  forced to flush.
-
-    The detailed semantics are as follows.  deflate performs one or both of the
-  following actions:
-
-  - Compress more input starting at next_in and update next_in and avail_in
-    accordingly.  If not all input can be processed (because there is not
-    enough room in the output buffer), next_in and avail_in are updated and
-    processing will resume at this point for the next call of deflate().
-
-  - Provide more output starting at next_out and update next_out and avail_out
-    accordingly.  This action is forced if the parameter flush is non zero.
-    Forcing flush frequently degrades the compression ratio, so this parameter
-    should be set only when necessary (in interactive applications).  Some
-    output may be provided even if flush is not set.
-
-    Before the call of deflate(), the application should ensure that at least
-  one of the actions is possible, by providing more input and/or consuming more
-  output, and updating avail_in or avail_out accordingly; avail_out should
-  never be zero before the call.  The application can consume the compressed
-  output when it wants, for example when the output buffer is full (avail_out
-  == 0), or after each call of deflate().  If deflate returns Z_OK and with
-  zero avail_out, it must be called again after making room in the output
-  buffer because there might be more output pending.
-
-    Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
-  decide how much data to accumulate before producing output, in order to
-  maximize compression.
-
-    If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
-  flushed to the output buffer and the output is aligned on a byte boundary, so
-  that the decompressor can get all input data available so far.  (In
-  particular avail_in is zero after the call if enough output space has been
-  provided before the call.) Flushing may degrade compression for some
-  compression algorithms and so it should be used only when necessary.  This
-  completes the current deflate block and follows it with an empty stored block
-  that is three bits plus filler bits to the next byte, followed by four bytes
-  (00 00 ff ff).
-
-    If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the
-  output buffer, but the output is not aligned to a byte boundary.  All of the
-  input data so far will be available to the decompressor, as for Z_SYNC_FLUSH.
-  This completes the current deflate block and follows it with an empty fixed
-  codes block that is 10 bits long.  This assures that enough bytes are output
-  in order for the decompressor to finish the block before the empty fixed code
-  block.
-
-    If flush is set to Z_BLOCK, a deflate block is completed and emitted, as
-  for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to
-  seven bits of the current block are held to be written as the next byte after
-  the next deflate block is completed.  In this case, the decompressor may not
-  be provided enough bits at this point in order to complete decompression of
-  the data provided so far to the compressor.  It may need to wait for the next
-  block to be emitted.  This is for advanced applications that need to control
-  the emission of deflate blocks.
-
-    If flush is set to Z_FULL_FLUSH, all output is flushed as with
-  Z_SYNC_FLUSH, and the compression state is reset so that decompression can
-  restart from this point if previous compressed data has been damaged or if
-  random access is desired.  Using Z_FULL_FLUSH too often can seriously degrade
-  compression.
-
-    If deflate returns with avail_out == 0, this function must be called again
-  with the same value of the flush parameter and more output space (updated
-  avail_out), until the flush is complete (deflate returns with non-zero
-  avail_out).  In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
-  avail_out is greater than six to avoid repeated flush markers due to
-  avail_out == 0 on return.
-
-    If the parameter flush is set to Z_FINISH, pending input is processed,
-  pending output is flushed and deflate returns with Z_STREAM_END if there was
-  enough output space; if deflate returns with Z_OK, this function must be
-  called again with Z_FINISH and more output space (updated avail_out) but no
-  more input data, until it returns with Z_STREAM_END or an error.  After
-  deflate has returned Z_STREAM_END, the only possible operations on the stream
-  are deflateReset or deflateEnd.
-
-    Z_FINISH can be used immediately after deflateInit if all the compression
-  is to be done in a single step.  In this case, avail_out must be at least the
-  value returned by deflateBound (see below).  If deflate does not return
-  Z_STREAM_END, then it must be called again as described above.
-
-    deflate() sets strm->adler to the adler32 checksum of all input read
-  so far (that is, total_in bytes).
-
-    deflate() may update strm->data_type if it can make a good guess about
-  the input data type (Z_BINARY or Z_TEXT).  In doubt, the data is considered
-  binary.  This field is only for information purposes and does not affect the
-  compression algorithm in any manner.
-
-    deflate() returns Z_OK if some progress has been made (more input
-  processed or more output produced), Z_STREAM_END if all input has been
-  consumed and all output has been produced (only when flush is set to
-  Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
-  if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible
-  (for example avail_in or avail_out was zero).  Note that Z_BUF_ERROR is not
-  fatal, and deflate() can be called again with more input and more output
-  space to continue compressing.
-*/
-
-
-ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
-/*
-     All dynamically allocated data structures for this stream are freed.
-   This function discards any unprocessed input and does not flush any pending
-   output.
-
-     deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
-   stream state was inconsistent, Z_DATA_ERROR if the stream was freed
-   prematurely (some input or output was discarded).  In the error case, msg
-   may be set but then points to a static string (which must not be
-   deallocated).
-*/
-
-
-/*
-ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
-
-     Initializes the internal stream state for decompression.  The fields
-   next_in, avail_in, zalloc, zfree and opaque must be initialized before by
-   the caller.  If next_in is not Z_NULL and avail_in is large enough (the
-   exact value depends on the compression method), inflateInit determines the
-   compression method from the zlib header and allocates all data structures
-   accordingly; otherwise the allocation will be deferred to the first call of
-   inflate.  If zalloc and zfree are set to Z_NULL, inflateInit updates them to
-   use default allocation functions.
-
-     inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
-   memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
-   version assumed by the caller, or Z_STREAM_ERROR if the parameters are
-   invalid, such as a null pointer to the structure.  msg is set to null if
-   there is no error message.  inflateInit does not perform any decompression
-   apart from possibly reading the zlib header if present: actual decompression
-   will be done by inflate().  (So next_in and avail_in may be modified, but
-   next_out and avail_out are unused and unchanged.) The current implementation
-   of inflateInit() does not process any header information -- that is deferred
-   until inflate() is called.
-*/
-
-
-ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
-/*
-    inflate decompresses as much data as possible, and stops when the input
-  buffer becomes empty or the output buffer becomes full.  It may introduce
-  some output latency (reading input without producing any output) except when
-  forced to flush.
-
-  The detailed semantics are as follows.  inflate performs one or both of the
-  following actions:
-
-  - Decompress more input starting at next_in and update next_in and avail_in
-    accordingly.  If not all input can be processed (because there is not
-    enough room in the output buffer), next_in is updated and processing will
-    resume at this point for the next call of inflate().
-
-  - Provide more output starting at next_out and update next_out and avail_out
-    accordingly.  inflate() provides as much output as possible, until there is
-    no more input data or no more space in the output buffer (see below about
-    the flush parameter).
-
-    Before the call of inflate(), the application should ensure that at least
-  one of the actions is possible, by providing more input and/or consuming more
-  output, and updating the next_* and avail_* values accordingly.  The
-  application can consume the uncompressed output when it wants, for example
-  when the output buffer is full (avail_out == 0), or after each call of
-  inflate().  If inflate returns Z_OK and with zero avail_out, it must be
-  called again after making room in the output buffer because there might be
-  more output pending.
-
-    The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH,
-  Z_BLOCK, or Z_TREES.  Z_SYNC_FLUSH requests that inflate() flush as much
-  output as possible to the output buffer.  Z_BLOCK requests that inflate()
-  stop if and when it gets to the next deflate block boundary.  When decoding
-  the zlib or gzip format, this will cause inflate() to return immediately
-  after the header and before the first block.  When doing a raw inflate,
-  inflate() will go ahead and process the first block, and will return when it
-  gets to the end of that block, or when it runs out of data.
-
-    The Z_BLOCK option assists in appending to or combining deflate streams.
-  Also to assist in this, on return inflate() will set strm->data_type to the
-  number of unused bits in the last byte taken from strm->next_in, plus 64 if
-  inflate() is currently decoding the last block in the deflate stream, plus
-  128 if inflate() returned immediately after decoding an end-of-block code or
-  decoding the complete header up to just before the first byte of the deflate
-  stream.  The end-of-block will not be indicated until all of the uncompressed
-  data from that block has been written to strm->next_out.  The number of
-  unused bits may in general be greater than seven, except when bit 7 of
-  data_type is set, in which case the number of unused bits will be less than
-  eight.  data_type is set as noted here every time inflate() returns for all
-  flush options, and so can be used to determine the amount of currently
-  consumed input in bits.
-
-    The Z_TREES option behaves as Z_BLOCK does, but it also returns when the
-  end of each deflate block header is reached, before any actual data in that
-  block is decoded.  This allows the caller to determine the length of the
-  deflate block header for later use in random access within a deflate block.
-  256 is added to the value of strm->data_type when inflate() returns
-  immediately after reaching the end of the deflate block header.
-
-    inflate() should normally be called until it returns Z_STREAM_END or an
-  error.  However if all decompression is to be performed in a single step (a
-  single call of inflate), the parameter flush should be set to Z_FINISH.  In
-  this case all pending input is processed and all pending output is flushed;
-  avail_out must be large enough to hold all the uncompressed data.  (The size
-  of the uncompressed data may have been saved by the compressor for this
-  purpose.) The next operation on this stream must be inflateEnd to deallocate
-  the decompression state.  The use of Z_FINISH is never required, but can be
-  used to inform inflate that a faster approach may be used for the single
-  inflate() call.
-
-     In this implementation, inflate() always flushes as much output as
-  possible to the output buffer, and always uses the faster approach on the
-  first call.  So the only effect of the flush parameter in this implementation
-  is on the return value of inflate(), as noted below, or when it returns early
-  because Z_BLOCK or Z_TREES is used.
-
-     If a preset dictionary is needed after this call (see inflateSetDictionary
-  below), inflate sets strm->adler to the adler32 checksum of the dictionary
-  chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
-  strm->adler to the adler32 checksum of all output produced so far (that is,
-  total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described
-  below.  At the end of the stream, inflate() checks that its computed adler32
-  checksum is equal to that saved by the compressor and returns Z_STREAM_END
-  only if the checksum is correct.
-
-    inflate() can decompress and check either zlib-wrapped or gzip-wrapped
-  deflate data.  The header type is detected automatically, if requested when
-  initializing with inflateInit2().  Any information contained in the gzip
-  header is not retained, so applications that need that information should
-  instead use raw inflate, see inflateInit2() below, or inflateBack() and
-  perform their own processing of the gzip header and trailer.
-
-    inflate() returns Z_OK if some progress has been made (more input processed
-  or more output produced), Z_STREAM_END if the end of the compressed data has
-  been reached and all uncompressed output has been produced, Z_NEED_DICT if a
-  preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
-  corrupted (input stream not conforming to the zlib format or incorrect check
-  value), Z_STREAM_ERROR if the stream structure was inconsistent (for example
-  next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory,
-  Z_BUF_ERROR if no progress is possible or if there was not enough room in the
-  output buffer when Z_FINISH is used.  Note that Z_BUF_ERROR is not fatal, and
-  inflate() can be called again with more input and more output space to
-  continue decompressing.  If Z_DATA_ERROR is returned, the application may
-  then call inflateSync() to look for a good compression block if a partial
-  recovery of the data is desired.
-*/
-
-
-ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
-/*
-     All dynamically allocated data structures for this stream are freed.
-   This function discards any unprocessed input and does not flush any pending
-   output.
-
-     inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
-   was inconsistent.  In the error case, msg may be set but then points to a
-   static string (which must not be deallocated).
-*/
-
-
-                        /* Advanced functions */
-
-/*
-    The following functions are needed only in some special applications.
-*/
-
-/*
-ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
-                                     int  level,
-                                     int  method,
-                                     int  windowBits,
-                                     int  memLevel,
-                                     int  strategy));
-
-     This is another version of deflateInit with more compression options.  The
-   fields next_in, zalloc, zfree and opaque must be initialized before by the
-   caller.
-
-     The method parameter is the compression method.  It must be Z_DEFLATED in
-   this version of the library.
-
-     The windowBits parameter is the base two logarithm of the window size
-   (the size of the history buffer).  It should be in the range 8..15 for this
-   version of the library.  Larger values of this parameter result in better
-   compression at the expense of memory usage.  The default value is 15 if
-   deflateInit is used instead.
-
-     windowBits can also be -8..-15 for raw deflate.  In this case, -windowBits
-   determines the window size.  deflate() will then generate raw deflate data
-   with no zlib header or trailer, and will not compute an adler32 check value.
-
-     windowBits can also be greater than 15 for optional gzip encoding.  Add
-   16 to windowBits to write a simple gzip header and trailer around the
-   compressed data instead of a zlib wrapper.  The gzip header will have no
-   file name, no extra data, no comment, no modification time (set to zero), no
-   header crc, and the operating system will be set to 255 (unknown).  If a
-   gzip stream is being written, strm->adler is a crc32 instead of an adler32.
-
-     The memLevel parameter specifies how much memory should be allocated
-   for the internal compression state.  memLevel=1 uses minimum memory but is
-   slow and reduces compression ratio; memLevel=9 uses maximum memory for
-   optimal speed.  The default value is 8.  See zconf.h for total memory usage
-   as a function of windowBits and memLevel.
-
-     The strategy parameter is used to tune the compression algorithm.  Use the
-   value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
-   filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no
-   string match), or Z_RLE to limit match distances to one (run-length
-   encoding).  Filtered data consists mostly of small values with a somewhat
-   random distribution.  In this case, the compression algorithm is tuned to
-   compress them better.  The effect of Z_FILTERED is to force more Huffman
-   coding and less string matching; it is somewhat intermediate between
-   Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY.  Z_RLE is designed to be almost as
-   fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data.  The
-   strategy parameter only affects the compression ratio but not the
-   correctness of the compressed output even if it is not set appropriately.
-   Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler
-   decoder for special applications.
-
-     deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
-   memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid
-   method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is
-   incompatible with the version assumed by the caller (ZLIB_VERSION).  msg is
-   set to null if there is no error message.  deflateInit2 does not perform any
-   compression: this will be done by deflate().
-*/
-
-ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
-                                             const Bytef *dictionary,
-                                             uInt  dictLength));
-/*
-     Initializes the compression dictionary from the given byte sequence
-   without producing any compressed output.  This function must be called
-   immediately after deflateInit, deflateInit2 or deflateReset, before any call
-   of deflate.  The compressor and decompressor must use exactly the same
-   dictionary (see inflateSetDictionary).
-
-     The dictionary should consist of strings (byte sequences) that are likely
-   to be encountered later in the data to be compressed, with the most commonly
-   used strings preferably put towards the end of the dictionary.  Using a
-   dictionary is most useful when the data to be compressed is short and can be
-   predicted with good accuracy; the data can then be compressed better than
-   with the default empty dictionary.
-
-     Depending on the size of the compression data structures selected by
-   deflateInit or deflateInit2, a part of the dictionary may in effect be
-   discarded, for example if the dictionary is larger than the window size
-   provided in deflateInit or deflateInit2.  Thus the strings most likely to be
-   useful should be put at the end of the dictionary, not at the front.  In
-   addition, the current implementation of deflate will use at most the window
-   size minus 262 bytes of the provided dictionary.
-
-     Upon return of this function, strm->adler is set to the adler32 value
-   of the dictionary; the decompressor may later use this value to determine
-   which dictionary has been used by the compressor.  (The adler32 value
-   applies to the whole dictionary even if only a subset of the dictionary is
-   actually used by the compressor.) If a raw deflate was requested, then the
-   adler32 value is not computed and strm->adler is not set.
-
-     deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
-   parameter is invalid (e.g.  dictionary being Z_NULL) or the stream state is
-   inconsistent (for example if deflate has already been called for this stream
-   or if the compression method is bsort).  deflateSetDictionary does not
-   perform any compression: this will be done by deflate().
-*/
-
-ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
-                                    z_streamp source));
-/*
-     Sets the destination stream as a complete copy of the source stream.
-
-     This function can be useful when several compression strategies will be
-   tried, for example when there are several ways of pre-processing the input
-   data with a filter.  The streams that will be discarded should then be freed
-   by calling deflateEnd.  Note that deflateCopy duplicates the internal
-   compression state which can be quite large, so this strategy is slow and can
-   consume lots of memory.
-
-     deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
-   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
-   (such as zalloc being Z_NULL).  msg is left unchanged in both source and
-   destination.
-*/
-
-ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
-/*
-     This function is equivalent to deflateEnd followed by deflateInit,
-   but does not free and reallocate all the internal compression state.  The
-   stream will keep the same compression level and any other attributes that
-   may have been set by deflateInit2.
-
-     deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
-   stream state was inconsistent (such as zalloc or state being Z_NULL).
-*/
-
-ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
-                                      int level,
-                                      int strategy));
-/*
-     Dynamically update the compression level and compression strategy.  The
-   interpretation of level and strategy is as in deflateInit2.  This can be
-   used to switch between compression and straight copy of the input data, or
-   to switch to a different kind of input data requiring a different strategy.
-   If the compression level is changed, the input available so far is
-   compressed with the old level (and may be flushed); the new level will take
-   effect only at the next call of deflate().
-
-     Before the call of deflateParams, the stream state must be set as for
-   a call of deflate(), since the currently available input may have to be
-   compressed and flushed.  In particular, strm->avail_out must be non-zero.
-
-     deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
-   stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if
-   strm->avail_out was zero.
-*/
-
-ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
-                                    int good_length,
-                                    int max_lazy,
-                                    int nice_length,
-                                    int max_chain));
-/*
-     Fine tune deflate's internal compression parameters.  This should only be
-   used by someone who understands the algorithm used by zlib's deflate for
-   searching for the best matching string, and even then only by the most
-   fanatic optimizer trying to squeeze out the last compressed bit for their
-   specific input data.  Read the deflate.c source code for the meaning of the
-   max_lazy, good_length, nice_length, and max_chain parameters.
-
-     deflateTune() can be called after deflateInit() or deflateInit2(), and
-   returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
- */
-
-ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
-                                       uLong sourceLen));
-/*
-     deflateBound() returns an upper bound on the compressed size after
-   deflation of sourceLen bytes.  It must be called after deflateInit() or
-   deflateInit2(), and after deflateSetHeader(), if used.  This would be used
-   to allocate an output buffer for deflation in a single pass, and so would be
-   called before deflate().
-*/
-
-ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
-                                     int bits,
-                                     int value));
-/*
-     deflatePrime() inserts bits in the deflate output stream.  The intent
-   is that this function is used to start off the deflate output with the bits
-   leftover from a previous deflate stream when appending to it.  As such, this
-   function can only be used for raw deflate, and must be used before the first
-   deflate() call after a deflateInit2() or deflateReset().  bits must be less
-   than or equal to 16, and that many of the least significant bits of value
-   will be inserted in the output.
-
-     deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
-   stream state was inconsistent.
-*/
-
-ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
-                                         gz_headerp head));
-/*
-     deflateSetHeader() provides gzip header information for when a gzip
-   stream is requested by deflateInit2().  deflateSetHeader() may be called
-   after deflateInit2() or deflateReset() and before the first call of
-   deflate().  The text, time, os, extra field, name, and comment information
-   in the provided gz_header structure are written to the gzip header (xflag is
-   ignored -- the extra flags are set according to the compression level).  The
-   caller must assure that, if not Z_NULL, name and comment are terminated with
-   a zero byte, and that if extra is not Z_NULL, that extra_len bytes are
-   available there.  If hcrc is true, a gzip header crc is included.  Note that
-   the current versions of the command-line version of gzip (up through version
-   1.3.x) do not support header crc's, and will report that it is a "multi-part
-   gzip file" and give up.
-
-     If deflateSetHeader is not used, the default gzip header has text false,
-   the time set to zero, and os set to 255, with no extra, name, or comment
-   fields.  The gzip header is returned to the default state by deflateReset().
-
-     deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
-   stream state was inconsistent.
-*/
-
-/*
-ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
-                                     int  windowBits));
-
-     This is another version of inflateInit with an extra parameter.  The
-   fields next_in, avail_in, zalloc, zfree and opaque must be initialized
-   before by the caller.
-
-     The windowBits parameter is the base two logarithm of the maximum window
-   size (the size of the history buffer).  It should be in the range 8..15 for
-   this version of the library.  The default value is 15 if inflateInit is used
-   instead.  windowBits must be greater than or equal to the windowBits value
-   provided to deflateInit2() while compressing, or it must be equal to 15 if
-   deflateInit2() was not used.  If a compressed stream with a larger window
-   size is given as input, inflate() will return with the error code
-   Z_DATA_ERROR instead of trying to allocate a larger window.
-
-     windowBits can also be zero to request that inflate use the window size in
-   the zlib header of the compressed stream.
-
-     windowBits can also be -8..-15 for raw inflate.  In this case, -windowBits
-   determines the window size.  inflate() will then process raw deflate data,
-   not looking for a zlib or gzip header, not generating a check value, and not
-   looking for any check values for comparison at the end of the stream.  This
-   is for use with other formats that use the deflate compressed data format
-   such as zip.  Those formats provide their own check values.  If a custom
-   format is developed using the raw deflate format for compressed data, it is
-   recommended that a check value such as an adler32 or a crc32 be applied to
-   the uncompressed data as is done in the zlib, gzip, and zip formats.  For
-   most applications, the zlib format should be used as is.  Note that comments
-   above on the use in deflateInit2() applies to the magnitude of windowBits.
-
-     windowBits can also be greater than 15 for optional gzip decoding.  Add
-   32 to windowBits to enable zlib and gzip decoding with automatic header
-   detection, or add 16 to decode only the gzip format (the zlib format will
-   return a Z_DATA_ERROR).  If a gzip stream is being decoded, strm->adler is a
-   crc32 instead of an adler32.
-
-     inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
-   memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
-   version assumed by the caller, or Z_STREAM_ERROR if the parameters are
-   invalid, such as a null pointer to the structure.  msg is set to null if
-   there is no error message.  inflateInit2 does not perform any decompression
-   apart from possibly reading the zlib header if present: actual decompression
-   will be done by inflate().  (So next_in and avail_in may be modified, but
-   next_out and avail_out are unused and unchanged.) The current implementation
-   of inflateInit2() does not process any header information -- that is
-   deferred until inflate() is called.
-*/
-
-ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
-                                             const Bytef *dictionary,
-                                             uInt  dictLength));
-/*
-     Initializes the decompression dictionary from the given uncompressed byte
-   sequence.  This function must be called immediately after a call of inflate,
-   if that call returned Z_NEED_DICT.  The dictionary chosen by the compressor
-   can be determined from the adler32 value returned by that call of inflate.
-   The compressor and decompressor must use exactly the same dictionary (see
-   deflateSetDictionary).  For raw inflate, this function can be called
-   immediately after inflateInit2() or inflateReset() and before any call of
-   inflate() to set the dictionary.  The application must insure that the
-   dictionary that was used for compression is provided.
-
-     inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
-   parameter is invalid (e.g.  dictionary being Z_NULL) or the stream state is
-   inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
-   expected one (incorrect adler32 value).  inflateSetDictionary does not
-   perform any decompression: this will be done by subsequent calls of
-   inflate().
-*/
-
-ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
-/*
-     Skips invalid compressed data until a full flush point (see above the
-   description of deflate with Z_FULL_FLUSH) can be found, or until all
-   available input is skipped.  No output is provided.
-
-     inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
-   if no more input was provided, Z_DATA_ERROR if no flush point has been
-   found, or Z_STREAM_ERROR if the stream structure was inconsistent.  In the
-   success case, the application may save the current current value of total_in
-   which indicates where valid compressed data was found.  In the error case,
-   the application may repeatedly call inflateSync, providing more input each
-   time, until success or end of the input data.
-*/
-
-ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
-                                    z_streamp source));
-/*
-     Sets the destination stream as a complete copy of the source stream.
-
-     This function can be useful when randomly accessing a large stream.  The
-   first pass through the stream can periodically record the inflate state,
-   allowing restarting inflate at those points when randomly accessing the
-   stream.
-
-     inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
-   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
-   (such as zalloc being Z_NULL).  msg is left unchanged in both source and
-   destination.
-*/
-
-ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
-/*
-     This function is equivalent to inflateEnd followed by inflateInit,
-   but does not free and reallocate all the internal decompression state.  The
-   stream will keep attributes that may have been set by inflateInit2.
-
-     inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
-   stream state was inconsistent (such as zalloc or state being Z_NULL).
-*/
-
-ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,
-                                      int windowBits));
-/*
-     This function is the same as inflateReset, but it also permits changing
-   the wrap and window size requests.  The windowBits parameter is interpreted
-   the same as it is for inflateInit2.
-
-     inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source
-   stream state was inconsistent (such as zalloc or state being Z_NULL), or if
-   the windowBits parameter is invalid.
-*/
-
-ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
-                                     int bits,
-                                     int value));
-/*
-     This function inserts bits in the inflate input stream.  The intent is
-   that this function is used to start inflating at a bit position in the
-   middle of a byte.  The provided bits will be used before any bytes are used
-   from next_in.  This function should only be used with raw inflate, and
-   should be used before the first inflate() call after inflateInit2() or
-   inflateReset().  bits must be less than or equal to 16, and that many of the
-   least significant bits of value will be inserted in the input.
-
-     If bits is negative, then the input stream bit buffer is emptied.  Then
-   inflatePrime() can be called again to put bits in the buffer.  This is used
-   to clear out bits leftover after feeding inflate a block description prior
-   to feeding inflate codes.
-
-     inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
-   stream state was inconsistent.
-*/
-
-ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm));
-/*
-     This function returns two values, one in the lower 16 bits of the return
-   value, and the other in the remaining upper bits, obtained by shifting the
-   return value down 16 bits.  If the upper value is -1 and the lower value is
-   zero, then inflate() is currently decoding information outside of a block.
-   If the upper value is -1 and the lower value is non-zero, then inflate is in
-   the middle of a stored block, with the lower value equaling the number of
-   bytes from the input remaining to copy.  If the upper value is not -1, then
-   it is the number of bits back from the current bit position in the input of
-   the code (literal or length/distance pair) currently being processed.  In
-   that case the lower value is the number of bytes already emitted for that
-   code.
-
-     A code is being processed if inflate is waiting for more input to complete
-   decoding of the code, or if it has completed decoding but is waiting for
-   more output space to write the literal or match data.
-
-     inflateMark() is used to mark locations in the input data for random
-   access, which may be at bit positions, and to note those cases where the
-   output of a code may span boundaries of random access blocks.  The current
-   location in the input stream can be determined from avail_in and data_type
-   as noted in the description for the Z_BLOCK flush parameter for inflate.
-
-     inflateMark returns the value noted above or -1 << 16 if the provided
-   source stream state was inconsistent.
-*/
-
-ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
-                                         gz_headerp head));
-/*
-     inflateGetHeader() requests that gzip header information be stored in the
-   provided gz_header structure.  inflateGetHeader() may be called after
-   inflateInit2() or inflateReset(), and before the first call of inflate().
-   As inflate() processes the gzip stream, head->done is zero until the header
-   is completed, at which time head->done is set to one.  If a zlib stream is
-   being decoded, then head->done is set to -1 to indicate that there will be
-   no gzip header information forthcoming.  Note that Z_BLOCK or Z_TREES can be
-   used to force inflate() to return immediately after header processing is
-   complete and before any actual data is decompressed.
-
-     The text, time, xflags, and os fields are filled in with the gzip header
-   contents.  hcrc is set to true if there is a header CRC.  (The header CRC
-   was valid if done is set to one.) If extra is not Z_NULL, then extra_max
-   contains the maximum number of bytes to write to extra.  Once done is true,
-   extra_len contains the actual extra field length, and extra contains the
-   extra field, or that field truncated if extra_max is less than extra_len.
-   If name is not Z_NULL, then up to name_max characters are written there,
-   terminated with a zero unless the length is greater than name_max.  If
-   comment is not Z_NULL, then up to comm_max characters are written there,
-   terminated with a zero unless the length is greater than comm_max.  When any
-   of extra, name, or comment are not Z_NULL and the respective field is not
-   present in the header, then that field is set to Z_NULL to signal its
-   absence.  This allows the use of deflateSetHeader() with the returned
-   structure to duplicate the header.  However if those fields are set to
-   allocated memory, then the application will need to save those pointers
-   elsewhere so that they can be eventually freed.
-
-     If inflateGetHeader is not used, then the header information is simply
-   discarded.  The header is always checked for validity, including the header
-   CRC if present.  inflateReset() will reset the process to discard the header
-   information.  The application would need to call inflateGetHeader() again to
-   retrieve the header from the next gzip stream.
-
-     inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
-   stream state was inconsistent.
-*/
-
-/*
-ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
-                                        unsigned char FAR *window));
-
-     Initialize the internal stream state for decompression using inflateBack()
-   calls.  The fields zalloc, zfree and opaque in strm must be initialized
-   before the call.  If zalloc and zfree are Z_NULL, then the default library-
-   derived memory allocation routines are used.  windowBits is the base two
-   logarithm of the window size, in the range 8..15.  window is a caller
-   supplied buffer of that size.  Except for special applications where it is
-   assured that deflate was used with small window sizes, windowBits must be 15
-   and a 32K byte window must be supplied to be able to decompress general
-   deflate streams.
-
-     See inflateBack() for the usage of these routines.
-
-     inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
-   the paramaters are invalid, Z_MEM_ERROR if the internal state could not be
-   allocated, or Z_VERSION_ERROR if the version of the library does not match
-   the version of the header file.
-*/
-
-typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *));
-typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
-
-ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
-                                    in_func in, void FAR *in_desc,
-                                    out_func out, void FAR *out_desc));
-/*
-     inflateBack() does a raw inflate with a single call using a call-back
-   interface for input and output.  This is more efficient than inflate() for
-   file i/o applications in that it avoids copying between the output and the
-   sliding window by simply making the window itself the output buffer.  This
-   function trusts the application to not change the output buffer passed by
-   the output function, at least until inflateBack() returns.
-
-     inflateBackInit() must be called first to allocate the internal state
-   and to initialize the state with the user-provided window buffer.
-   inflateBack() may then be used multiple times to inflate a complete, raw
-   deflate stream with each call.  inflateBackEnd() is then called to free the
-   allocated state.
-
-     A raw deflate stream is one with no zlib or gzip header or trailer.
-   This routine would normally be used in a utility that reads zip or gzip
-   files and writes out uncompressed files.  The utility would decode the
-   header and process the trailer on its own, hence this routine expects only
-   the raw deflate stream to decompress.  This is different from the normal
-   behavior of inflate(), which expects either a zlib or gzip header and
-   trailer around the deflate stream.
-
-     inflateBack() uses two subroutines supplied by the caller that are then
-   called by inflateBack() for input and output.  inflateBack() calls those
-   routines until it reads a complete deflate stream and writes out all of the
-   uncompressed data, or until it encounters an error.  The function's
-   parameters and return types are defined above in the in_func and out_func
-   typedefs.  inflateBack() will call in(in_desc, &buf) which should return the
-   number of bytes of provided input, and a pointer to that input in buf.  If
-   there is no input available, in() must return zero--buf is ignored in that
-   case--and inflateBack() will return a buffer error.  inflateBack() will call
-   out(out_desc, buf, len) to write the uncompressed data buf[0..len-1].  out()
-   should return zero on success, or non-zero on failure.  If out() returns
-   non-zero, inflateBack() will return with an error.  Neither in() nor out()
-   are permitted to change the contents of the window provided to
-   inflateBackInit(), which is also the buffer that out() uses to write from.
-   The length written by out() will be at most the window size.  Any non-zero
-   amount of input may be provided by in().
-
-     For convenience, inflateBack() can be provided input on the first call by
-   setting strm->next_in and strm->avail_in.  If that input is exhausted, then
-   in() will be called.  Therefore strm->next_in must be initialized before
-   calling inflateBack().  If strm->next_in is Z_NULL, then in() will be called
-   immediately for input.  If strm->next_in is not Z_NULL, then strm->avail_in
-   must also be initialized, and then if strm->avail_in is not zero, input will
-   initially be taken from strm->next_in[0 ..  strm->avail_in - 1].
-
-     The in_desc and out_desc parameters of inflateBack() is passed as the
-   first parameter of in() and out() respectively when they are called.  These
-   descriptors can be optionally used to pass any information that the caller-
-   supplied in() and out() functions need to do their job.
-
-     On return, inflateBack() will set strm->next_in and strm->avail_in to
-   pass back any unused input that was provided by the last in() call.  The
-   return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR
-   if in() or out() returned an error, Z_DATA_ERROR if there was a format error
-   in the deflate stream (in which case strm->msg is set to indicate the nature
-   of the error), or Z_STREAM_ERROR if the stream was not properly initialized.
-   In the case of Z_BUF_ERROR, an input or output error can be distinguished
-   using strm->next_in which will be Z_NULL only if in() returned an error.  If
-   strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning
-   non-zero.  (in() will always be called before out(), so strm->next_in is
-   assured to be defined if out() returns non-zero.) Note that inflateBack()
-   cannot return Z_OK.
-*/
-
-ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
-/*
-     All memory allocated by inflateBackInit() is freed.
-
-     inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream
-   state was inconsistent.
-*/
-
-ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
-/* Return flags indicating compile-time options.
-
-    Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
-     1.0: size of uInt
-     3.2: size of uLong
-     5.4: size of voidpf (pointer)
-     7.6: size of z_off_t
-
-    Compiler, assembler, and debug options:
-     8: DEBUG
-     9: ASMV or ASMINF -- use ASM code
-     10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention
-     11: 0 (reserved)
-
-    One-time table building (smaller code, but not thread-safe if true):
-     12: BUILDFIXED -- build static block decoding tables when needed
-     13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed
-     14,15: 0 (reserved)
-
-    Library content (indicates missing functionality):
-     16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking
-                          deflate code when not needed)
-     17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect
-                    and decode gzip streams (to avoid linking crc code)
-     18-19: 0 (reserved)
-
-    Operation variations (changes in library functionality):
-     20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate
-     21: FASTEST -- deflate algorithm with only one, lowest compression level
-     22,23: 0 (reserved)
-
-    The sprintf variant used by gzprintf (zero is best):
-     24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format
-     25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!
-     26: 0 = returns value, 1 = void -- 1 means inferred string length returned
-
-    Remainder:
-     27-31: 0 (reserved)
- */
-
-
-                        /* utility functions */
-
-/*
-     The following utility functions are implemented on top of the basic
-   stream-oriented functions.  To simplify the interface, some default options
-   are assumed (compression level and memory usage, standard memory allocation
-   functions).  The source code of these utility functions can be modified if
-   you need special options.
-*/
-
-ZEXTERN int ZEXPORT compress OF((Bytef *dest,   uLongf *destLen,
-                                 const Bytef *source, uLong sourceLen));
-/*
-     Compresses the source buffer into the destination buffer.  sourceLen is
-   the byte length of the source buffer.  Upon entry, destLen is the total size
-   of the destination buffer, which must be at least the value returned by
-   compressBound(sourceLen).  Upon exit, destLen is the actual size of the
-   compressed buffer.
-
-     compress returns Z_OK if success, Z_MEM_ERROR if there was not
-   enough memory, Z_BUF_ERROR if there was not enough room in the output
-   buffer.
-*/
-
-ZEXTERN int ZEXPORT compress2 OF((Bytef *dest,   uLongf *destLen,
-                                  const Bytef *source, uLong sourceLen,
-                                  int level));
-/*
-     Compresses the source buffer into the destination buffer.  The level
-   parameter has the same meaning as in deflateInit.  sourceLen is the byte
-   length of the source buffer.  Upon entry, destLen is the total size of the
-   destination buffer, which must be at least the value returned by
-   compressBound(sourceLen).  Upon exit, destLen is the actual size of the
-   compressed buffer.
-
-     compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
-   memory, Z_BUF_ERROR if there was not enough room in the output buffer,
-   Z_STREAM_ERROR if the level parameter is invalid.
-*/
-
-ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));
-/*
-     compressBound() returns an upper bound on the compressed size after
-   compress() or compress2() on sourceLen bytes.  It would be used before a
-   compress() or compress2() call to allocate the destination buffer.
-*/
-
-ZEXTERN int ZEXPORT uncompress OF((Bytef *dest,   uLongf *destLen,
-                                   const Bytef *source, uLong sourceLen));
-/*
-     Decompresses the source buffer into the destination buffer.  sourceLen is
-   the byte length of the source buffer.  Upon entry, destLen is the total size
-   of the destination buffer, which must be large enough to hold the entire
-   uncompressed data.  (The size of the uncompressed data must have been saved
-   previously by the compressor and transmitted to the decompressor by some
-   mechanism outside the scope of this compression library.) Upon exit, destLen
-   is the actual size of the uncompressed buffer.
-
-     uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
-   enough memory, Z_BUF_ERROR if there was not enough room in the output
-   buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete.
-*/
-
-
-                        /* gzip file access functions */
-
-/*
-     This library supports reading and writing files in gzip (.gz) format with
-   an interface similar to that of stdio, using the functions that start with
-   "gz".  The gzip format is different from the zlib format.  gzip is a gzip
-   wrapper, documented in RFC 1952, wrapped around a deflate stream.
-*/
-
-typedef voidp gzFile;       /* opaque gzip file descriptor */
-
-/*
-ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
-
-     Opens a gzip (.gz) file for reading or writing.  The mode parameter is as
-   in fopen ("rb" or "wb") but can also include a compression level ("wb9") or
-   a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only
-   compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F'
-   for fixed code compression as in "wb9F".  (See the description of
-   deflateInit2 for more information about the strategy parameter.) Also "a"
-   can be used instead of "w" to request that the gzip stream that will be
-   written be appended to the file.  "+" will result in an error, since reading
-   and writing to the same gzip file is not supported.
-
-     gzopen can be used to read a file which is not in gzip format; in this
-   case gzread will directly read from the file without decompression.
-
-     gzopen returns NULL if the file could not be opened, if there was
-   insufficient memory to allocate the gzFile state, or if an invalid mode was
-   specified (an 'r', 'w', or 'a' was not provided, or '+' was provided).
-   errno can be checked to determine if the reason gzopen failed was that the
-   file could not be opened.
-*/
-
-ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
-/*
-     gzdopen associates a gzFile with the file descriptor fd.  File descriptors
-   are obtained from calls like open, dup, creat, pipe or fileno (if the file
-   has been previously opened with fopen).  The mode parameter is as in gzopen.
-
-     The next call of gzclose on the returned gzFile will also close the file
-   descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor
-   fd.  If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd,
-   mode);.  The duplicated descriptor should be saved to avoid a leak, since
-   gzdopen does not close fd if it fails.
-
-     gzdopen returns NULL if there was insufficient memory to allocate the
-   gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not
-   provided, or '+' was provided), or if fd is -1.  The file descriptor is not
-   used until the next gz* read, write, seek, or close operation, so gzdopen
-   will not detect if fd is invalid (unless fd is -1).
-*/
-
-ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));
-/*
-     Set the internal buffer size used by this library's functions.  The
-   default buffer size is 8192 bytes.  This function must be called after
-   gzopen() or gzdopen(), and before any other calls that read or write the
-   file.  The buffer memory allocation is always deferred to the first read or
-   write.  Two buffers are allocated, either both of the specified size when
-   writing, or one of the specified size and the other twice that size when
-   reading.  A larger buffer size of, for example, 64K or 128K bytes will
-   noticeably increase the speed of decompression (reading).
-
-     The new buffer size also affects the maximum length for gzprintf().
-
-     gzbuffer() returns 0 on success, or -1 on failure, such as being called
-   too late.
-*/
-
-ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
-/*
-     Dynamically update the compression level or strategy.  See the description
-   of deflateInit2 for the meaning of these parameters.
-
-     gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
-   opened for writing.
-*/
-
-ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
-/*
-     Reads the given number of uncompressed bytes from the compressed file.  If
-   the input file was not in gzip format, gzread copies the given number of
-   bytes into the buffer.
-
-     After reaching the end of a gzip stream in the input, gzread will continue
-   to read, looking for another gzip stream, or failing that, reading the rest
-   of the input file directly without decompression.  The entire input file
-   will be read if gzread is called until it returns less than the requested
-   len.
-
-     gzread returns the number of uncompressed bytes actually read, less than
-   len for end of file, or -1 for error.
-*/
-
-ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
-                                voidpc buf, unsigned len));
-/*
-     Writes the given number of uncompressed bytes into the compressed file.
-   gzwrite returns the number of uncompressed bytes written or 0 in case of
-   error.
-*/
-
-ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
-/*
-     Converts, formats, and writes the arguments to the compressed file under
-   control of the format string, as in fprintf.  gzprintf returns the number of
-   uncompressed bytes actually written, or 0 in case of error.  The number of
-   uncompressed bytes written is limited to 8191, or one less than the buffer
-   size given to gzbuffer().  The caller should assure that this limit is not
-   exceeded.  If it is exceeded, then gzprintf() will return an error (0) with
-   nothing written.  In this case, there may also be a buffer overflow with
-   unpredictable consequences, which is possible only if zlib was compiled with
-   the insecure functions sprintf() or vsprintf() because the secure snprintf()
-   or vsnprintf() functions were not available.  This can be determined using
-   zlibCompileFlags().
-*/
-
-ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
-/*
-     Writes the given null-terminated string to the compressed file, excluding
-   the terminating null character.
-
-     gzputs returns the number of characters written, or -1 in case of error.
-*/
-
-ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
-/*
-     Reads bytes from the compressed file until len-1 characters are read, or a
-   newline character is read and transferred to buf, or an end-of-file
-   condition is encountered.  If any characters are read or if len == 1, the
-   string is terminated with a null character.  If no characters are read due
-   to an end-of-file or len < 1, then the buffer is left untouched.
-
-     gzgets returns buf which is a null-terminated string, or it returns NULL
-   for end-of-file or in case of error.  If there was an error, the contents at
-   buf are indeterminate.
-*/
-
-ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
-/*
-     Writes c, converted to an unsigned char, into the compressed file.  gzputc
-   returns the value that was written, or -1 in case of error.
-*/
-
-ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
-/*
-     Reads one byte from the compressed file.  gzgetc returns this byte or -1
-   in case of end of file or error.
-*/
-
-ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
-/*
-     Push one character back onto the stream to be read as the first character
-   on the next read.  At least one character of push-back is allowed.
-   gzungetc() returns the character pushed, or -1 on failure.  gzungetc() will
-   fail if c is -1, and may fail if a character has been pushed but not read
-   yet.  If gzungetc is used immediately after gzopen or gzdopen, at least the
-   output buffer size of pushed characters is allowed.  (See gzbuffer above.)
-   The pushed character will be discarded if the stream is repositioned with
-   gzseek() or gzrewind().
-*/
-
-ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
-/*
-     Flushes all pending output into the compressed file.  The parameter flush
-   is as in the deflate() function.  The return value is the zlib error number
-   (see function gzerror below).  gzflush is only permitted when writing.
-
-     If the flush parameter is Z_FINISH, the remaining data is written and the
-   gzip stream is completed in the output.  If gzwrite() is called again, a new
-   gzip stream will be started in the output.  gzread() is able to read such
-   concatented gzip streams.
-
-     gzflush should be called only when strictly necessary because it will
-   degrade compression if called too often.
-*/
-
-/*
-ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
-                                   z_off_t offset, int whence));
-
-     Sets the starting position for the next gzread or gzwrite on the given
-   compressed file.  The offset represents a number of bytes in the
-   uncompressed data stream.  The whence parameter is defined as in lseek(2);
-   the value SEEK_END is not supported.
-
-     If the file is opened for reading, this function is emulated but can be
-   extremely slow.  If the file is opened for writing, only forward seeks are
-   supported; gzseek then compresses a sequence of zeroes up to the new
-   starting position.
-
-     gzseek returns the resulting offset location as measured in bytes from
-   the beginning of the uncompressed stream, or -1 in case of error, in
-   particular if the file is opened for writing and the new starting position
-   would be before the current position.
-*/
-
-ZEXTERN int ZEXPORT    gzrewind OF((gzFile file));
-/*
-     Rewinds the given file. This function is supported only for reading.
-
-     gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
-*/
-
-/*
-ZEXTERN z_off_t ZEXPORT    gztell OF((gzFile file));
-
-     Returns the starting position for the next gzread or gzwrite on the given
-   compressed file.  This position represents a number of bytes in the
-   uncompressed data stream, and is zero when starting, even if appending or
-   reading a gzip stream from the middle of a file using gzdopen().
-
-     gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
-*/
-
-/*
-ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file));
-
-     Returns the current offset in the file being read or written.  This offset
-   includes the count of bytes that precede the gzip stream, for example when
-   appending or when using gzdopen() for reading.  When reading, the offset
-   does not include as yet unused buffered input.  This information can be used
-   for a progress indicator.  On error, gzoffset() returns -1.
-*/
-
-ZEXTERN int ZEXPORT gzeof OF((gzFile file));
-/*
-     Returns true (1) if the end-of-file indicator has been set while reading,
-   false (0) otherwise.  Note that the end-of-file indicator is set only if the
-   read tried to go past the end of the input, but came up short.  Therefore,
-   just like feof(), gzeof() may return false even if there is no more data to
-   read, in the event that the last read request was for the exact number of
-   bytes remaining in the input file.  This will happen if the input file size
-   is an exact multiple of the buffer size.
-
-     If gzeof() returns true, then the read functions will return no more data,
-   unless the end-of-file indicator is reset by gzclearerr() and the input file
-   has grown since the previous end of file was detected.
-*/
-
-ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
-/*
-     Returns true (1) if file is being copied directly while reading, or false
-   (0) if file is a gzip stream being decompressed.  This state can change from
-   false to true while reading the input file if the end of a gzip stream is
-   reached, but is followed by data that is not another gzip stream.
-
-     If the input file is empty, gzdirect() will return true, since the input
-   does not contain a gzip stream.
-
-     If gzdirect() is used immediately after gzopen() or gzdopen() it will
-   cause buffers to be allocated to allow reading the file to determine if it
-   is a gzip file.  Therefore if gzbuffer() is used, it should be called before
-   gzdirect().
-*/
-
-ZEXTERN int ZEXPORT    gzclose OF((gzFile file));
-/*
-     Flushes all pending output if necessary, closes the compressed file and
-   deallocates the (de)compression state.  Note that once file is closed, you
-   cannot call gzerror with file, since its structures have been deallocated.
-   gzclose must not be called more than once on the same file, just as free
-   must not be called more than once on the same allocation.
-
-     gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a
-   file operation error, or Z_OK on success.
-*/
-
-ZEXTERN int ZEXPORT gzclose_r OF((gzFile file));
-ZEXTERN int ZEXPORT gzclose_w OF((gzFile file));
-/*
-     Same as gzclose(), but gzclose_r() is only for use when reading, and
-   gzclose_w() is only for use when writing or appending.  The advantage to
-   using these instead of gzclose() is that they avoid linking in zlib
-   compression or decompression code that is not used when only reading or only
-   writing respectively.  If gzclose() is used, then both compression and
-   decompression code will be included the application when linking to a static
-   zlib library.
-*/
-
-ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
-/*
-     Returns the error message for the last error which occurred on the given
-   compressed file.  errnum is set to zlib error number.  If an error occurred
-   in the file system and not in the compression library, errnum is set to
-   Z_ERRNO and the application may consult errno to get the exact error code.
-
-     The application must not modify the returned string.  Future calls to
-   this function may invalidate the previously returned string.  If file is
-   closed, then the string previously returned by gzerror will no longer be
-   available.
-
-     gzerror() should be used to distinguish errors from end-of-file for those
-   functions above that do not distinguish those cases in their return values.
-*/
-
-ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
-/*
-     Clears the error and end-of-file flags for file.  This is analogous to the
-   clearerr() function in stdio.  This is useful for continuing to read a gzip
-   file that is being written concurrently.
-*/
-
-
-                        /* checksum functions */
-
-/*
-     These functions are not related to compression but are exported
-   anyway because they might be useful in applications using the compression
-   library.
-*/
-
-ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
-/*
-     Update a running Adler-32 checksum with the bytes buf[0..len-1] and
-   return the updated checksum.  If buf is Z_NULL, this function returns the
-   required initial value for the checksum.
-
-     An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
-   much faster.
-
-   Usage example:
-
-     uLong adler = adler32(0L, Z_NULL, 0);
-
-     while (read_buffer(buffer, length) != EOF) {
-       adler = adler32(adler, buffer, length);
-     }
-     if (adler != original_adler) error();
-*/
-
-/*
-ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
-                                          z_off_t len2));
-
-     Combine two Adler-32 checksums into one.  For two sequences of bytes, seq1
-   and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
-   each, adler1 and adler2.  adler32_combine() returns the Adler-32 checksum of
-   seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.
-*/
-
-ZEXTERN uLong ZEXPORT crc32   OF((uLong crc, const Bytef *buf, uInt len));
-/*
-     Update a running CRC-32 with the bytes buf[0..len-1] and return the
-   updated CRC-32.  If buf is Z_NULL, this function returns the required
-   initial value for the for the crc.  Pre- and post-conditioning (one's
-   complement) is performed within this function so it shouldn't be done by the
-   application.
-
-   Usage example:
-
-     uLong crc = crc32(0L, Z_NULL, 0);
-
-     while (read_buffer(buffer, length) != EOF) {
-       crc = crc32(crc, buffer, length);
-     }
-     if (crc != original_crc) error();
-*/
-
-/*
-ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
-
-     Combine two CRC-32 check values into one.  For two sequences of bytes,
-   seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
-   calculated for each, crc1 and crc2.  crc32_combine() returns the CRC-32
-   check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
-   len2.
-*/
-
-
-                        /* various hacks, don't look :) */
-
-/* deflateInit and inflateInit are macros to allow checking the zlib version
- * and the compiler's view of z_stream:
- */
-ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
-                                     const char *version, int stream_size));
-ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
-                                     const char *version, int stream_size));
-ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int  level, int  method,
-                                      int windowBits, int memLevel,
-                                      int strategy, const char *version,
-                                      int stream_size));
-ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int  windowBits,
-                                      const char *version, int stream_size));
-ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
-                                         unsigned char FAR *window,
-                                         const char *version,
-                                         int stream_size));
-#define deflateInit(strm, level) \
-        deflateInit_((strm), (level),       ZLIB_VERSION, sizeof(z_stream))
-#define inflateInit(strm) \
-        inflateInit_((strm),                ZLIB_VERSION, sizeof(z_stream))
-#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
-        deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
-                      (strategy),           ZLIB_VERSION, sizeof(z_stream))
-#define inflateInit2(strm, windowBits) \
-        inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
-#define inflateBackInit(strm, windowBits, window) \
-        inflateBackInit_((strm), (windowBits), (window), \
-                                            ZLIB_VERSION, sizeof(z_stream))
-
-/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
- * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if
- * both are true, the application gets the *64 functions, and the regular
- * functions are changed to 64 bits) -- in case these are set on systems
- * without large file support, _LFS64_LARGEFILE must also be true
- */
-#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
-   ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
-   ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
-   ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
-   ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
-   ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t));
-   ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t));
-#endif
-
-#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0
-#  define gzopen gzopen64
-#  define gzseek gzseek64
-#  define gztell gztell64
-#  define gzoffset gzoffset64
-#  define adler32_combine adler32_combine64
-#  define crc32_combine crc32_combine64
-#  ifdef _LARGEFILE64_SOURCE
-     ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
-     ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
-     ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));
-     ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile));
-     ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
-     ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
-#  endif
-#else
-   ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *));
-   ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int));
-   ZEXTERN z_off_t ZEXPORT gztell OF((gzFile));
-   ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile));
-   ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
-   ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
-#endif
-
-/* hack for buggy compilers */
-#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
-    struct internal_state {int dummy;};
-#endif
-
-/* undocumented functions */
-ZEXTERN const char   * ZEXPORT zError           OF((int));
-ZEXTERN int            ZEXPORT inflateSyncPoint OF((z_streamp));
-ZEXTERN const uLongf * ZEXPORT get_crc_table    OF((void));
-ZEXTERN int            ZEXPORT inflateUndermine OF((z_streamp, int));
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ZLIB_H */
diff --git a/interfaces/insdc/insdc.h b/interfaces/insdc/insdc.h
deleted file mode 100644
index 33e6e94..0000000
--- a/interfaces/insdc/insdc.h
+++ /dev/null
@@ -1,277 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_insdc_insdc_
-#define _h_insdc_insdc_
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*==========================================================================
- * INSDC types, constants
- */
-
-
-/*--------------------------------------------------------------------------
- * dna
- *  represented in IUPAC characters
- */
-typedef char INSDC_dna_text;
-
-
-/*--------------------------------------------------------------------------
- * 4na
- *  nucleotide data with all possible ambiguity
- *  does not represent all possible EVENTS
- *
- *  text encodings use the IUPAC character set
- *  legal values: [ACMGRSVTWYHKDBNacmgrsvtwyhkdbn.]
- *  canonical values: [ACMGRSVTWYHKDBN]
- *
- *  binary values are 0..15 = { NACMGRSVTWYHKDBN }
- *
- *  4na values use bits for each letter:
- *
- *       A | C | G | T
- *    =================
- *    N    |   |   |
- *    A  * |   |   |
- *    C    | * |   |
- *    M  * | * |   |
- *    G    |   | * |
- *    R  * |   | * |
- *    S    | * | * |
- *    V  * | * | * |
- *    T    |   |   | *
- *    W  * |   |   | *
- *    Y    | * |   | *
- *    H  * | * |   | *
- *    K    |   | * | *
- *    D  * |   | * | *
- *    B    | * | * | *
- *    N  * | * | * | *
- *
- *  packed bytes have first base in upper nibble,
- *  and the following base in lower nibble.
- *
- *    bit:  76543210 76543210 76543210
- *    ================================
- *    base: 00001111 22223333 44445555 etc.
- *
- *  element offsets follow this pattern
- */
-typedef uint8_t INSDC_4na_bin;
-typedef uint8_t INSDC_4na_packed;
-
-#define INSDC_4na_map_BINSET \
-    { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 }
-#define INSDC_4na_map_CHARSET \
-    ".ACMGRSVTWYHKDBN"
-#define INSDC_4na_accept_CHARSET \
-    ".ACMGRSVTWYHKDBNacmgrsvtwyhkdbn"
-
-
-/*--------------------------------------------------------------------------
- * 2na
- *  nucleotide data { ATGC }
- * x2na
- *  nucleotide data with single ambiguity value
- *
- *  text encodings use the IUPAC character set
- *  legal values: [ACGTNacgtn.]
- *  canonical values: [ACGTN]
- *
- *  binary values are 0..4 = { ACGTN }
- *
- *  packed values exclude N:
- *    A = 0
- *    C = 1
- *    G = 2
- *    T = 3
- *
- *  packed bytes have first base in uppermost 2 bits,
- *  and the following bases in similar fashion:
- *
- *    bit:  76543210 76543210
- *    =======================
- *    base: 00112233 44556677 etc.
- *
- *  element offsets follow this pattern
- */
-typedef uint8_t INSDC_2na_bin;
-typedef uint8_t INSDC_x2na_bin;
-typedef uint8_t INSDC_2na_packed;
-
-#define INSDC_2na_map_BINSET \
-    { 0,1,2,3 }
-#define INSDC_2na_map_CHARSET \
-    "ACGT"
-#define INSDC_2na_accept_CHARSET \
-    "ACGTacgt"
-#define INSDC_x2na_map_BINSET \
-    { 0,1,2,3,4 }
-#define INSDC_x2na_map_CHARSET \
-    "ACGTN"
-#define INSDC_x2na_accept_CHARSET \
-    "ACGTNacgtn."
-
-
-/*--------------------------------------------------------------------------
- * color
- *  color-space data
- * 2cs
- *  color-space data 0,1,2,3
- * x2cs
- *  color-space data extended with single ambiguity value (.)
- *
- *  text encodings use the ASCII numeric character set
- *  values: [0123.]
- *
- *  x2cs values are 0..4 = { 0123. }
- *
- *  2cs values exclude '.':
- *    '0' = 0
- *    '1' = 1
- *    '2' = 2
- *    '3' = 3
- */
-typedef char INSDC_color_text;
-typedef uint8_t INSDC_2cs_bin;
-typedef uint8_t INSDC_x2cs_bin;
-typedef uint8_t INSDC_2cs_packed;
-
-#define INSDC_2cs_map_BINSET \
-    { 0,1,2,3 }
-#define INSDC_2cs_map_CHARSET \
-    "0123"
-#define INSDC_2cs_accept_CHARSET \
-    "0123"
-#define INSDC_x2cs_map_BINSET \
-    { 0,1,2,3,4 }
-#define INSDC_x2cs_map_CHARSET \
-    "0123."
-#define INSDC_x2cs_accept_CHARSET \
-    "0123."
-#define INSDC_color_default_matrix \
-{                                  \
-    0, 1, 2, 3, 4,                 \
-    1, 0, 3, 2, 4,                 \
-    2, 3, 0, 1, 4,                 \
-    3, 2, 1, 0, 4,                 \
-    4, 4, 4, 4, 4                  \
-}
-
-
-/*--------------------------------------------------------------------------
- * protein
- *  represented in IUPAC characters
- */
-typedef char INSDC_protein_text;
-
-
-/*--------------------------------------------------------------------------
- * aa
- *  protein data
- *  text encodings use the IUPAC character set
- */
-typedef	uint8_t INSDC_aa_bin;
-
-#define INSDC_aa_map_BINSET \
-    { 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 }
-#define INSDC_aa_map_CHARSET \
-    "ABCDEFGHIKLMNPQRSTVWXYZU*"
-#define INSDC_aa_accept_CHARSET \
-    "ABCDEFGHIKLMNPQRSTVWXYZU*abcdefghiklmnpqrstvwxyzu"
-
-
-/*--------------------------------------------------------------------------
- * quality
- *  quality scoring values
- *
- *  phred legal values_ 0..63
- */
-typedef uint8_t INSDC_quality_phred;
-typedef int8_t INSDC_quality_log_odds;
-
-
-/*--------------------------------------------------------------------------
- * coordinate
- *  zero and one based coordinates
- *  lengths are expressed as unsigned quantities
- */
-typedef int32_t INSDC_coord_val;
-typedef uint32_t INSDC_coord_len;
-typedef INSDC_coord_val INSDC_coord_zero;
-typedef INSDC_coord_val INSDC_coord_one;
-typedef INSDC_coord_zero INSDC_position_zero;
-typedef INSDC_coord_one INSDC_position_one;
-
-
-/*--------------------------------------------------------------------------
- * read description
- *  type and filter constants
- */
-
-
-/* read type
- *  describes the type of read within a spot
- *  the extended version also describes its orientation
- */
-typedef uint8_t INSDC_read_type;
-enum
-{
-    /* read_type */
-    READ_TYPE_TECHNICAL  = 0,
-    READ_TYPE_BIOLOGICAL = 1,
-
-    /* orientation - applied as bits, e.g.:
-       type = READ_TYPE_BIOLOGICAL | READ_TYPE_REVERSE */
-    READ_TYPE_FORWARD = 2,
-    READ_TYPE_REVERSE = 4
-};
-
-/* read filter
- */
-typedef uint8_t INSDC_read_filter;
-enum
-{
-    READ_FILTER_PASS = 0,
-    READ_FILTER_REJECT = 1,
-    READ_FILTER_CRITERIA = 2,
-    READ_FILTER_REDACTED = 3
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*  _h_insdc_insdc_ */
diff --git a/interfaces/insdc/insdc.vschema b/interfaces/insdc/insdc.vschema
deleted file mode 100644
index 47fdf63..0000000
--- a/interfaces/insdc/insdc.vschema
+++ /dev/null
@@ -1,210 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/*==========================================================================
- * INSDC types, constants
- */
-version 1;
-
-
-/*--------------------------------------------------------------------------
- * dna
- *  represented in IUPAC characters
- */
-typedef ascii INSDC:dna:text;
-
-
-/*--------------------------------------------------------------------------
- * 4na
- *  nucleotide data with all possible ambiguity
- *  does not represent all possible EVENTS
- *
- *  text encodings use the IUPAC character set
- *  legal values: [ACMGRSVTWYHKDBNacmgrsvtwyhkdbn.]
- *  canonical values: [ACMGRSVTWYHKDBN]
- *
- *  binary values are 0..15 = { NACMGRSVTWYHKDBN }
- *
- *  4na values use bits for each letter:
- *
- *       A | C | G | T
- *    =================
- *    N    |   |   |
- *    A  * |   |   |
- *    C    | * |   |
- *    M  * | * |   |
- *    G    |   | * |
- *    R  * |   | * |
- *    S    | * | * |
- *    V  * | * | * |
- *    T    |   |   | *
- *    W  * |   |   | *
- *    Y    | * |   | *
- *    H  * | * |   | *
- *    K    |   | * | *
- *    D  * |   | * | *
- *    B    | * | * | *
- *    N  * | * | * | *
- */
-typedef	U8 INSDC:4na:bin;
-typedef	B1 INSDC:4na:packed [ 4 ];
-
-const INSDC:4na:bin INSDC:4na:map:BINSET
-    = [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 ];
-const INSDC:dna:text INSDC:4na:map:CHARSET
-    = ".ACMGRSVTWYHKDBN";
-const INSDC:dna:text INSDC:4na:accept:CHARSET
-    = ".ACMGRSVTWYHKDBNacmgrsvtwyhkdbn";
-
-
-/*--------------------------------------------------------------------------
- * 2na  - nucleotide data A,T,G,C
- * x2na - nucleotide data extended with single ambiguity value (N)
- *
- *  text encodings use the IUPAC character set
- *  legal values: [ACGTNacgtn.]
- *  canonical values: [ACGTN]
- *
- *  x2na values are 0..4 = { ACGTN }
- *
- *  2na values exclude N:
- *    A = 0
- *    C = 1
- *    G = 2
- *    T = 3
- */
-typedef U8 INSDC:2na:bin;
-typedef U8 INSDC:x2na:bin;
-typedef B1 INSDC:2na:packed [ 2 ];
-
-const INSDC:2na:bin  INSDC:2na:map:BINSET      = [ 0,1,2,3 ];
-const INSDC:dna:text INSDC:2na:map:CHARSET     = "ACGT";
-const INSDC:dna:text INSDC:2na:accept:CHARSET  = "ACGTacgt";
-const INSDC:x2na:bin INSDC:x2na:map:BINSET     = [ 0,1,2,3,4 ];
-const INSDC:dna:text INSDC:x2na:map:CHARSET    = "ACGTN";
-const INSDC:dna:text INSDC:x2na:accept:CHARSET = "ACGTNacgtn.";
-
-
-/*--------------------------------------------------------------------------
- * color - color-space text
- * 2cs   - color-space data 0,1,2,3
- * x2cs  - color-space data extended with single ambiguity value (.)
- *
- *  text encodings use the ASCII numeric character set
- *  values: [0123.]
- *
- *  x2cs values are 0..4 = { 0123. }
- *
- *  2cs values exclude '.':
- *    '0' = 0
- *    '1' = 1
- *    '2' = 2
- *    '3' = 3
- */
-typedef ascii INSDC:color:text;
-typedef U8 INSDC:2cs:bin;
-typedef U8 INSDC:x2cs:bin;
-typedef B1 INSDC:2cs:packed [ 2 ];
-
-const INSDC:2cs:bin  INSDC:2cs:map:BINSET        = [ 0,1,2,3 ];
-const INSDC:color:text INSDC:2cs:map:CHARSET     = "0123";
-const INSDC:color:text INSDC:2cs:accept:CHARSET  = "0123";
-const INSDC:x2cs:bin INSDC:x2cs:map:BINSET       = [ 0,1,2,3,4 ];
-const INSDC:color:text INSDC:x2cs:map:CHARSET    = "0123.";
-const INSDC:color:text INSDC:x2cs:accept:CHARSET = "0123.";
-
-const U8 INSDC:color:default_matrix =
-[
-    0, 1, 2, 3, 4,
-    1, 0, 3, 2, 4,
-    2, 3, 0, 1, 4,
-    3, 2, 1, 0, 4,
-    4, 4, 4, 4, 4
-];
-
-
-/*--------------------------------------------------------------------------
- * protein
- *  represented in IUPAC characters
- */
-typedef ascii INSDC:protein:text;
-
-
-/*--------------------------------------------------------------------------
- * aa
- *  protein data
- *  text encodings use the IUPAC character set
- */
-typedef	U8 INSDC:aa:bin;
-
-const INSDC:aa:bin INSDC:aa:map:BINSET
-    = [ 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 ];
-const INSDC:protein:text INSDC:aa:map:CHARSET
-    = "ABCDEFGHIKLMNPQRSTVWXYZU*";
-const INSDC:protein:text INSDC:aa:accept:CHARSET
-    = "ABCDEFGHIKLMNPQRSTVWXYZU*abcdefghiklmnpqrstvwxyzu";
-
-
-/*--------------------------------------------------------------------------
- * quality
- *  quality scoring values
- *
- *  phred legal values: 0..63
- */
-typedef U8 INSDC:quality:phred;
-typedef I8 INSDC:quality:log_odds;
-
-// text-encoding of quality scores
-// offsets are 33 = '!' and 64 = '@'
-typedef ascii INSDC:quality:text:phred_33;
-typedef ascii INSDC:quality:text:phred_64;
-typedef ascii INSDC:quality:text:log_odds_64;
-
-
-/*--------------------------------------------------------------------------
- * coordinate
- *  zero and one based coordinates
- */
-
-// 32 bit coordinates
-typedef I32 INSDC:coord:val;
-typedef U32 INSDC:coord:len;
-
-// zero or one based coordinate system
-typedef INSDC:coord:val INSDC:coord:zero;
-typedef INSDC:coord:val INSDC:coord:one;
-
-// POSITION types for relating bases to their location in signal
-typedef INSDC:coord:zero INSDC:position:zero;
-typedef INSDC:coord:one INSDC:position:one;
-
-// one-based coordinate limits
-const INSDC:coord:one INSDC:coord:min:one = 0x80000001;
-const INSDC:coord:one INSDC:coord:max:one = 0x3FFFFFFF;
-
-// zero-based coordinate limits
-const INSDC:coord:zero INSDC:coord:min:zero = 0x80000000;
-const INSDC:coord:zero INSDC:coord:max:zero = 0x3FFFFFFE;
diff --git a/interfaces/insdc/seq.vschema b/interfaces/insdc/seq.vschema
deleted file mode 100644
index 8fb1b32..0000000
--- a/interfaces/insdc/seq.vschema
+++ /dev/null
@@ -1,210 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/*==========================================================================
- * Sequence schema
- */
-version 1;
-
-include 'vdb/vdb.vschema';
-include 'insdc/insdc.vschema';
-
-
-/*--------------------------------------------------------------------------
- * rand_4na_2na
- *  converts 4na to 2na
- *
- *  substitutes a random base for ambiguities
- *  from the bases allowed in the 4na.
- *
- *       A | C | G | T
- *    =================
- *    N    |   |   |     # any base may be substituted
- *    A  * |   |   |     # always A
- *    C    | * |   |     # always C
- *    M  * | * |   |     # A or C
- *    G    |   | * |     # always G
- *    R  * |   | * |     # A or G
- *    S    | * | * |     # C or G
- *    V  * | * | * |     # A, C or G
- *    T    |   |   | *   # always T
- *    W  * |   |   | *   # A or T
- *    Y    | * |   | *   # C or T
- *    H  * | * |   | *   # A, C or T
- *    K    |   | * | *   # G or T
- *    D  * |   | * | *   # A, G or T
- *    B    | * | * | *   # C, G or T
- *    N  * | * | * | *   # any base may be substituted
- */
-extern function
-    INSDC:2na:bin INSDC:SEQ:rand_4na_2na #1 ( INSDC:4na:bin rd_bin );
-
-
-/*--------------------------------------------------------------------------
- * sequence
- *  basic sequence table
- *
- * history:
- *  1.0.1 - introduced text-mode QUALITY columns
- */
-table INSDC:tbl:sequence #1.0.1
-{
-    /* READ
-     *  native or converted DNA sequence
-     */
-
-    // default is IUPAC character representation
-    extern default column INSDC:dna:text READ
-    {
-        read = out_dna_text;
-        validate = < INSDC:dna:text > compare ( in_dna_text, out_dna_text );
-    }
-
-    // 4na representation - unpacked and packed
-    extern column INSDC:4na:bin READ = out_4na_bin;
-    extern column INSDC:4na:packed READ = out_4na_packed;
-
-    // x2na representation - 2na with ambiguity
-    extern column INSDC:x2na:bin READ = out_x2na_bin;
-
-    // 2na representation - 2na with no ambiguity - unpacked and packed
-    extern column INSDC:2na:bin READ = out_2na_bin;
-    extern column INSDC:2na:packed READ = out_2na_packed;
-
-
-
-    /* CSREAD
-     *  native or converted color-space sequence
-     */
-
-    // default is ASCII character representation
-    extern default column INSDC:color:text CSREAD
-    {
-        read = out_color_text;
-        validate = < INSDC:color:text > compare ( in_color_text, out_color_text );
-    }
-
-    // x2cs representation - 2cs with ambiguity
-    extern column INSDC:x2cs:bin CSREAD = out_x2cs_bin;
-
-    // 2cs representation - 2cs with no ambiguity - unpacked and packed
-    extern column INSDC:2cs:bin CSREAD = out_2cs_bin;
-    extern column INSDC:2cs:packed CSREAD = out_2cs_packed;
-
-    /* CS_NATIVE
-     *  is color-space the native sequence space
-     */
-    readonly column bool CS_NATIVE = cs_native;
-
-    /* CS_KEY
-     *  leading call given in base-space
-     */
-    extern column INSDC:dna:text CS_KEY
-    {
-        read = out_cs_key;
-        validate = < INSDC:dna:text > compare ( in_cs_key, out_cs_key );
-    }
-
-    /* COLOR_MATRIX
-     *  matrix used for color-space conversions
-     */
-    extern column U8 COLOR_MATRIX = out_color_matrix;
-
-
-    /* QUALITY
-     *  base or color call qualities
-     */
-
-    // PHRED is default
-    extern default column INSDC:quality:phred QUALITY = out_qual_phred;
-
-    // textual encodings
-    extern column INSDC:quality:text:phred_33 QUALITY
-        = out_qual_text_phred_33
-        | ( INSDC:quality:text:phred_33 ) < B8 > sum < 33 > ( out_qual_phred );
-    extern column INSDC:quality:text:phred_64 QUALITY
-        = out_qual_text_phred_64
-        | ( INSDC:quality:text:phred_64 ) < B8 > sum < 64 > ( out_qual_phred );
-
-
-    /* SIGNAL
-     *  signal and intensity information is unspecified
-     */
-    INSDC:coord:len signal_len
-        = ( INSDC:coord:len ) row_len ( out_signal )
-        | < INSDC:coord:len > echo < 0 > ();
-    
-
-	/* VIRTUAL PRODUCTIONS
-	 *  cs_native
-	 *  in_cs_key
-	 *  out_cs_key
-	 *  out_signal
-	 *  in_dna_text
-	 *  out_2cs_bin
-	 *  out_2na_bin
-	 *  out_4na_bin
-	 *  out_dna_text
-	 *  out_x2cs_bin
-	 *  out_x2na_bin
-	 *  in_color_text
-	 *  out_2cs_packed
-	 *  out_2na_packed
-	 *  out_4na_packed
-	 *  out_color_text
-	 *  out_qual_phred
-	 *  out_color_matrix
-	 */
-};
-
-
-/*--------------------------------------------------------------------------
- * protein
- *  basic protein sequence table
- */
-table INSDC:tbl:protein #1
-{
-    /* PROTEIN
-     *  native or converted protein sequence
-     */
-
-    // default is IUPAC character representation
-    extern default column INSDC:protein:text PROTEIN
-    {
-        read = out_protein_text;
-        validate = < INSDC:protein:text > compare ( in_protein_text, out_protein_text );
-    }
-
-    // aa representation
-    extern column INSDC:aa:bin PROTEIN = out_aa_bin;
-
-
-	/* INSDC:tbl:protein productions
-	 *  out_aa_bin
-	 *  in_protein_text
-	 *  out_protein_text
-	 */
-};
diff --git a/interfaces/insdc/sra.h b/interfaces/insdc/sra.h
deleted file mode 100644
index 85a94f7..0000000
--- a/interfaces/insdc/sra.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_insdc_sra_
-#define _h_insdc_sra_
-
-#ifndef _h_insdc_insdc_
-#include <insdc/insdc.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*==========================================================================
- * INSDC SRA types, constants
- */
-
-
-/* spotid_t
- *  unique id given to every spot
- */
-typedef uint32_t INSDC_SRA_spotid_t;
-
-
-/* spot_ids_found
- *  returns a tuple of spot ids
- */
-typedef uint64_t INSDC_SRA_spot_ids_found [ 4 ];
-
-
-/* read filter
- */
-#define sra_read_filter_t "INSDC:SRA:read_filter"
-typedef INSDC_read_filter INSDC_SRA_read_filter;
-enum
-{
-    SRA_READ_FILTER_PASS = READ_FILTER_PASS,
-    SRA_READ_FILTER_REJECT = READ_FILTER_REJECT,
-    SRA_READ_FILTER_CRITERIA = READ_FILTER_CRITERIA,
-    SRA_READ_FILTER_REDACTED = READ_FILTER_REDACTED
-};
-
-
-/* read type
- *  describes the type of read within a spot
- *  the extended version also describes its orientation
- */
-#define sra_read_type_t "INSDC:SRA:xread_type"
-typedef INSDC_read_type INSDC_SRA_xread_type;
-typedef INSDC_SRA_xread_type INSDC_SRA_read_type;
-enum
-{
-    /* read_type and xread_type */
-    SRA_READ_TYPE_TECHNICAL  = READ_TYPE_TECHNICAL,
-    SRA_READ_TYPE_BIOLOGICAL = READ_TYPE_BIOLOGICAL,
-
-    /* xread_type only - applied as bits, e.g.:
-       type = SRA_READ_TYPE_BIOLOGICAL | SRA_READ_TYPE_REVERSE */
-    SRA_READ_TYPE_FORWARD = READ_TYPE_FORWARD,
-    SRA_READ_TYPE_REVERSE = READ_TYPE_REVERSE
-};
-
-
-/* platform id
- */
-#define sra_platform_id_t "INSDC:SRA:platform_id"
-typedef uint8_t INSDC_SRA_platform_id;
-enum
-{
-    SRA_PLATFORM_UNDEFINED         = 0,
-    SRA_PLATFORM_454               = 1,
-    SRA_PLATFORM_ILLUMINA          = 2,
-    SRA_PLATFORM_ABSOLID           = 3,
-    SRA_PLATFORM_COMPLETE_GENOMICS = 4,
-    SRA_PLATFORM_HELICOS           = 5,
-    SRA_PLATFORM_PACBIO_SMRT       = 6,
-    SRA_PLATFORM_ION_TORRENT       = 7,
-    SRA_PLATFORM_SANGER            = 8
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*  _h_insdc_sra_ */
diff --git a/interfaces/insdc/sra.vschema b/interfaces/insdc/sra.vschema
deleted file mode 100644
index e5dc2f6..0000000
--- a/interfaces/insdc/sra.vschema
+++ /dev/null
@@ -1,484 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/*==========================================================================
- * INSDC Sequence Read Archive schema
- */
-version 1;
-
-include 'insdc/seq.vschema';
-
-
-/*--------------------------------------------------------------------------
- * types
- */
-
-/* spotid_t
- *  unique id given to every spot
- */
-typedef U32 INSDC:SRA:spotid_t;
-
-
-/* spot_ids_found
- */
-typedef U64 INSDC:SRA:spot_ids_found [ 4 ];
-
-
-/*--------------------------------------------------------------------------
- * functions
- */
-
-
-/* format_spot_name
- *  given a name format string, X, and Y
- *  produce a reconstructed spot name string
- *
- *  "name_fmt" [ DATA ] - name format string ( see format explanation below )
- *
- *  "X" [ DATA ] - X coordinate for spot
- *
- *  "Y" [ DATA ] - Y coordinate for spot
- *
- *  "spot_name" [ DATA, OPTIONAL ] - potential source of unformatted names
- *
- * SYNOPSIS:
- *  "name_fmt" may have any ASCII characters
- *  the special character '$' is an escape symbol
- *  when followed by a recognized format character,
- *  both the '$' and its format character will be
- *  replaced with a numeral generated from X and/or Y.
- *
- *  when "spot_name" is present and the "name_fmt" row is empty,
- *  output is taken verbatim from "spot_name"
- */
-function
-ascii INSDC:SRA:format_spot_name #1 ( ascii name_fmt , I32 X , I32 Y * ascii spot_name );
-
-function
-ascii INSDC:SRA:format_spot_name_no_coord #1 ( ascii name_fmt  * ascii spot_name );
-
-
-/*--------------------------------------------------------------------------
- * spotcoord
- *  spot coordinate table
- *  gives X and Y and potentially other common coordinates
- */
-table INSDC:SRA:tbl:spotcoord #1
-{
-    /* X, Y
-     *  32 ( or 16 ) bit coordinates within plate region
-     *  the coordinate system ( zero or one-based ) is unspecified
-     */
-    extern default column INSDC:coord:val X = out_x_coord;
-    extern default column INSDC:coord:val Y = out_y_coord;
-
-    // backward compatibility for 16-bit unsigned coordinates
-    extern readonly column U16 X = cast ( x_clip_U16 );
-    extern readonly column U16 Y = cast ( y_clip_U16 );
-
-    // clip signed 32-bit coordinates to unsigned 16-bit
-    INSDC:coord:val x_clip_U16
-        = < INSDC:coord:val > clip < 0, 0xFFFF > ( out_x_coord );
-    INSDC:coord:val y_clip_U16
-        = < INSDC:coord:val > clip < 0, 0xFFFF > ( out_y_coord );
-
-
-	/* INSDC:SRA:tbl:spotcoord virtual productions
-	 *  out_x_coord
-	 *  out_y_coord
-	 */
-};
-
-
-/*--------------------------------------------------------------------------
- * spotname
- *  spot name table
- *  the name column is normally indexed
- *
- * history:
- *  1.0.1 - split X and Y into spotcoord table
- */
-table INSDC:SRA:tbl:spotname #1.0.1 = INSDC:SRA:tbl:spotcoord #1
-{
-    /* NAME
-     *  external name for spot
-     */
-    extern column ascii NAME = _out_name;
-
-
-    /* SPOT_IDS_FOUND
-     *  lookup by NAME column
-     */
-    readonly column INSDC:SRA:spot_ids_found SPOT_IDS_FOUND
-        =  spot_ids_found;
-
-
-    /* default rules */
-
-    // assemble NAME column output in order of preference
-    ascii _out_name
-        = INSDC:SRA:format_spot_name ( out_name_fmt, out_x_coord, out_y_coord, out_spot_name )
-        | INSDC:SRA:format_spot_name ( out_name_fmt, out_x_coord, out_y_coord )
-        | INSDC:SRA:format_spot_name_no_coord (out_name_fmt)
-        | out_spot_name;
-
-
-	/* INSDC:SRA:tbl:spotcoord inherited virtual productions
-	 *  out_x_coord
-	 *  out_y_coord
-	 */
-
-	/* INSDC:SRA:tbl:spotname virtual productions
-	 *  out_name_fmt
-	 *  out_spot_name
-	 *  spot_ids_found
-	 */
-};
-
-
-/*--------------------------------------------------------------------------
- * spotdesc
- *  spot descriptor table
- *
- * history:
- *  1.0.1 - base explicitly upon sequence #1.0.1
- *  1.0.2 - added alternate taps for in_read_type and in_read_len
- */
-
-// read filter bits
-typedef U8 INSDC:SRA:read_filter;
-const INSDC:SRA:read_filter SRA_READ_FILTER_PASS = 0;
-const INSDC:SRA:read_filter SRA_READ_FILTER_REJECT = 1;
-const INSDC:SRA:read_filter SRA_READ_FILTER_CRITERIA = 2;
-const INSDC:SRA:read_filter SRA_READ_FILTER_REDACTED = 3;
-
-// read type bits
-typedef U8 INSDC:SRA:xread_type;
-const INSDC:SRA:xread_type SRA_READ_TYPE_TECHNICAL  = 0;
-const INSDC:SRA:xread_type SRA_READ_TYPE_BIOLOGICAL = 1;
-const INSDC:SRA:xread_type SRA_READ_TYPE_FORWARD    = 2;
-const INSDC:SRA:xread_type SRA_READ_TYPE_REVERSE    = 4;
-
-// original read-types included only technical and biological
-typedef INSDC:SRA:xread_type INSDC:SRA:read_type;
-
-table INSDC:SRA:tbl:spotdesc #1.0.2 = INSDC:tbl:sequence #1.0.1
-{
-    /* NREADS
-     *  describes the number of reads within spot
-     */
-    extern column U8 NREADS = out_nreads;
-
-
-    /* SPOT_LEN
-     *  length of sequence
-     * FIXED_SPOT_LEN
-     *  non-zero if sequence length is fixed throughout table
-     */
-    readonly column INSDC:coord:len SPOT_LEN = spot_len;
-    readonly column INSDC:coord:len FIXED_SPOT_LEN = fixed_spot_len;
-
-
-    /* TRIM_START
-     * TRIM_LEN
-     *  define the spot segment after applying trimming
-     *  trimming may be based upon technical segments and read quality
-     */
-    readonly column INSDC:coord:zero TRIM_START
-        = trim_start
-        | < INSDC:coord:zero> echo < 0 > ();
-    readonly column INSDC:coord:one TRIM_START
-        = ( INSDC:coord:one ) < I32 > sum < 1 > ( trim_start )
-        | < INSDC:coord:one> echo < 1 > ();
-    readonly column INSDC:coord:len TRIM_LEN
-        = trim_len
-        | spot_len;
-
-
-    /* LABEL
-     * LABEL_START, LABEL_LEN
-     *  column pair for writing read labels
-     *  the label text for all reads is concatenated to form the LABEL row
-     *  starting coordinates and lengths delineate labels by read
-     *
-     * NB - row length for LABEL_START/LEN === NREADS,
-     *      row length for LABEL === SUM ( LABEL_LEN [ n ] ) for NREADS
-     */
-    extern column ascii LABEL = out_label;
-    extern column INSDC:coord:zero LABEL_START = out_label_start;
-    extern column INSDC:coord:len LABEL_LEN = out_label_len;
-
-    // 16-bit versions
-    readonly column U16 LABEL_START = cast ( out_label_start );
-    readonly column U16 LABEL_LEN = cast ( out_label_len );
-
-
-    /* READ_TYPE
-     *  binary values giving type of a read
-     *
-     * NB - row length === NREADS
-     */
-    extern default column INSDC:SRA:xread_type READ_TYPE = out_read_type;
-
-    INSDC:SRA:xread_type in_read_type
-        = READ_TYPE
-        | _alt_in_read_type;
-
-    readonly column INSDC:SRA:read_type READ_TYPE
-        = out_read_type
-        | < INSDC:SRA:xread_type, INSDC:SRA:read_type > map < [ 0,1,2,3,4,5,6,7 ], [ 0,1,0,1,0,1,0,1 ] > ( out_read_type );
-
-
-    /* READ_START
-     * READ_LEN
-     *  define starting coordinates and length of read segments
-     *
-     * NB - row length === NREADS
-     */
-    extern default column INSDC:coord:zero READ_START
-        = out_read_start;
-    extern column INSDC:coord:one READ_START
-        = ( INSDC:coord:one ) < I32 > sum < 1 > ( out_read_start );
-    extern column INSDC:coord:len READ_LEN = out_read_len;
-
-    // 16-bit versions
-    readonly column U16 READ_START = cast ( out_read_start );
-    readonly column U16 READ_LEN = cast ( out_read_len );
-
-    INSDC:coord:len in_read_len
-        = READ_LEN
-        | _alt_in_read_len;
-
-
-    /* READ_FILTER
-     *  bits indicate usability of sequence
-     *  always available
-     */
-    extern column INSDC:SRA:read_filter READ_FILTER
-        = out_rd_filter
-        | < INSDC:SRA:read_filter > echo < SRA_READ_FILTER_PASS > ( out_read_start );
-
-    // RD_FILTER - only available if physical column is present
-    extern readonly column INSDC:SRA:read_filter RD_FILTER = out_rd_filter;
-
-
-    /* spot_len is used internally */
-    INSDC:coord:len spot_len
-        = base_space_spot_len
-        | color_space_spot_len
-        | align_spot_len;
-    INSDC:coord:len fixed_spot_len
-        = static_fixed_spot_len
-        | base_space_fixed_spot_len
-        | color_space_fixed_spot_len;
-
-
-	/* INSDC:tbl:sequence inherited virtual productions
-	 *  out_2cs_packed
-	 *  out_2na_packed
-	 */
-
-	/* INSDC:SRA:tbl:spotdesc productions
-	 *  trim_len
-	 *  out_label
-	 *  out_nreads
-	 *  trim_start
-	 *  out_read_len
-	 *  out_label_len
-	 *  out_rd_filter
-	 *  out_read_type
-	 *  out_read_start
-	 *  out_label_start
-	 *  static_fixed_spot_len
-	 */
-};
-
-/*--------------------------------------------------------------------------
- * stats
- *  run and spot-group statistics
- *
- * history:
- *  1.1.0 - added CMP_BASE_COUNT
- */
-table INSDC:SRA:tbl:stats #1.1
-{
-    readonly column INSDC:SRA:spotid_t MIN_SPOT_ID
-        = min_spot_id
-        | < INSDC:SRA:spotid_t > echo < 1 > ();
-    readonly column INSDC:SRA:spotid_t MAX_SPOT_ID
-        = max_spot_id
-        | cast ( spot_count );
-    readonly column U64
-        SPOT_COUNT = spot_count;
-    readonly column U64
-        BASE_COUNT = base_count;
-    readonly column U64
-        BIO_BASE_COUNT = bio_base_count;
-    readonly column U64 CMP_BASE_COUNT
-        = cmp_base_count
-        | base_count;
-
-    U8 stats_dummy = in_stats_bin;
-
-	/* INSDC:SRA:tbl:stats productions
-	 *  base_count
-	 *  spot_count
-	 *  max_spot_id
-	 *  min_spot_id
-     *  in_stats_bin
-	 *  bio_base_count
-	 *  cmp_base_count
-	 */
-};
-
-/*--------------------------------------------------------------------------
- * sra
- *  the INSDC SRA table
- *
- * history:
- *  1.0.1 - base explicitly upon spotname #1.0.1
- *  1.0.2 - base explicitly upon sequence #1.0.1, spotdesc #1.0.1
- *  1.0.3 - base upon spotdesc #1.0.2
- */
-
-// platform constants from <insdc/sra.h>
-typedef U8 INSDC:SRA:platform_id;
-const INSDC:SRA:platform_id SRA_PLATFORM_UNDEFINED         = 0;
-const INSDC:SRA:platform_id SRA_PLATFORM_454               = 1;
-const INSDC:SRA:platform_id SRA_PLATFORM_ILLUMINA          = 2;
-const INSDC:SRA:platform_id SRA_PLATFORM_ABSOLID           = 3;
-const INSDC:SRA:platform_id SRA_PLATFORM_COMPLETE_GENOMICS = 4;
-const INSDC:SRA:platform_id SRA_PLATFORM_HELICOS           = 5;
-const INSDC:SRA:platform_id SRA_PLATFORM_PACBIO_SMRT       = 6;
-const INSDC:SRA:platform_id SRA_PLATFORM_ION_TORRENT       = 7;
-const INSDC:SRA:platform_id SRA_PLATFORM_SANGER            = 8;
-
-table INSDC:SRA:tbl:sra #1.0.3 =
-    INSDC:tbl:sequence #1.0.1, INSDC:SRA:tbl:spotname #1.0.1,
-    INSDC:SRA:tbl:spotdesc #1.0.2, INSDC:SRA:tbl:stats #1.1.0
-{
-    /* PLATFORM
-     *  platform description
-     *  one version returns a constant defined above
-     *  while the other returns a textual representation
-     */
-    extern column INSDC:SRA:platform_id PLATFORM
-        = .PLATFORM
-        | out_platform;
-    readonly column  ascii PLATFORM
-        = platform_name;
-
-    physical column
-        < INSDC:SRA:platform_id > zip_encoding .PLATFORM = PLATFORM;
-
-
-    /* SPOT_ID
-     *  reports spot id of current row
-     */
-    extern column INSDC:SRA:spotid_t SPOT_ID
-        = < INSDC:SRA:spotid_t > add_row_id ( .SPOT_ID )
-        | cast ( rowid_64 );
-    I64 rowid_64 = row_id ();
-
-    physical column < INSDC:SRA:spotid_t > izip_encoding .SPOT_ID
-        = < INSDC:SRA:spotid_t > sub_row_id ( SPOT_ID );
-
-
-    /* SPOT_GROUP
-     *  a name denoting group membership, ''
-     *  used for "barcode" support
-     */
-    extern column ascii SPOT_GROUP
-        = out_spot_group
-        | .SPOT_GROUP
-        | < ascii > echo < '' > ();
-
-    ascii in_spot_group = SPOT_GROUP;
-
-    physical column
-        < ascii > zip_encoding <  Z_DEFAULT_STRATEGY, Z_BEST_SPEED > .SPOT_GROUP = in_spot_group;
-
-
-	/* INSDC:tbl:sequence inherited virtual productions
-	 *  cs_native
-	 *  in_cs_key
-	 *  out_cs_key
-	 *  out_signal
-	 *  in_dna_text
-	 *  out_2cs_bin
-	 *  out_2na_bin
-	 *  out_4na_bin
-	 *  out_dna_text
-	 *  out_x2cs_bin
-	 *  out_x2na_bin
-	 *  in_color_text
-	 *  out_2cs_packed
-	 *  out_2na_packed
-	 *  out_4na_packed
-	 *  out_color_text
-	 *  out_qual_phred
-	 *  out_color_matrix
-	 */
-
-	/* INSDC:SRA:tbl:spotcoord inherited virtual productions
-	 *  out_x_coord
-	 *  out_y_coord
-	 */
-
-	/* INSDC:SRA:tbl:spotname inherited virtual productions
-	 *  out_name_fmt
-	 *  out_spot_name
-	 *  spot_ids_found
-	 */
-
-	/* INSDC:SRA:tbl:spotdesc inherited productions
-	 *  trim_len
-	 *  out_label
-	 *  out_nreads
-	 *  trim_start
-	 *  out_read_len
-	 *  out_label_len
-	 *  out_rd_filter
-	 *  out_read_type
-	 *  out_read_start
-	 *  out_label_start
-	 *  static_fixed_spot_len
-	 */
-
-	/* INSDC:SRA:tbl:stats inherited productions
-	 *  base_count
-	 *  spot_count
-	 *  max_spot_id
-	 *  min_spot_id
-     *  in_stats_bin
-	 *  bio_base_count
-	 */
-
-	/* INSDC:SRA:tbl:sra productions
-	 *  out_platform
-	 *  platform_name
-	 */
-};
diff --git a/interfaces/kapp/args.h b/interfaces/kapp/args.h
deleted file mode 100644
index e19a394..0000000
--- a/interfaces/kapp/args.h
+++ /dev/null
@@ -1,339 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kapp_args_
-#define _h_kapp_args_
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* this define is while adding the --option-file to standard options
- * and it might not be right yet */
-#define USE_OPTFILE    1
-
-/*
- * Terminology for this module:
- *
- * On the command line all things typed in are arguments
- * Those arguments that are string preceded by "-" or "--" are options
- * The -- preceded version of an Option is that Option's name.  A name
- * can have one or more aliases that are a single character.
- * The arguments that are not are parameters.
- *
- * This module treats all "strings" as if they were made of UTF-8 characters
- * that can be one or more bytes long.  An alias is a single Unicode character
- * in UTF-8 format.  7-bit ASCII is a true subset of UTF-8.  8-but ASCII might
- * not work.
- */
-
-
-/* ==========
- * Structure to define a command line option
- *
- * these are fed in one by one or through arrays to build up the
- * tables used to parse the caommand line argc/argv
- */
-typedef struct OptDef
-{
-    const char *  name;           	/* UTF8/ASCII NUL terminated long name */
-    const char *  aliases;        	/* UTF8/ASCII NUL terminated set of single utf8/ASCII character names: may be NULL or "" */
-    void (CC *    help_gen) (const char **);	/* function to generate help string */
-    const char ** help;                	/* help-gen can treat these as non-const */
-    uint16_t      max_count;      	/* maximum allowed; 0 is unlimited */
-#define OPT_UNLIM 0
-    bool          needs_value;    	/* does this require an argument value? */
-    bool          required;             /* is this a required parameter?  Not supported yet. */
-} OptDef;
-
-extern OptDef StandardOptions [];
-
-#define OPTION_DEBUG     "debug"
-#define OPTION_LOG_LEVEL "log-level"
-#define OPTION_HELP      "help"
-#define OPTION_VERSION   "version"
-#define OPTION_VERBOSE   "verbose"
-#define OPTION_QUIET     "quiet"
-#if USE_OPTFILE
-#define OPTION_OPTFILE   "option-file"
-#endif
-#define OPTION_NO_USER_SETTINGS "no-user-settings"
-#define ALIAS_DEBUG     "+"
-#define ALIAS_LOG_LEVEL "L"
-#define ALIAS_HELP      "h?"
-#define ALIAS_HELP1     "h"
-#define ALIAS_VERSION   "V"
-#define ALIAS_VERBOSE   "v"
-#define ALIAS_QUIET     "q"
-#if USE_OPTFILE
-#define ALIAS_OPTFILE   ""
-#endif
-
-#define OPTION_REPORT   "ncbi_error_report"
-#define ALIAS_REPORT    ""
-
-/*--------------------------------------------------------------------------
- * Args
- *  opaque class to build up option lists and parse the command line argc/argv
- *  not reference counted
- */
-typedef struct Args Args;
-
-
-/* Make
- *  create the empty object
- */
-rc_t CC ArgsMake ( Args ** pself );
-
-
-/* Whack
- *  undo all object and owned object construction
- */
-rc_t CC ArgsWhack ( Args * self );
-
-#ifndef ArgsRelease
-#define ArgsRelease(self) ArgsWhack(self)
-#endif
-
-/* AddOptionArray
- *  helper function to call the ArgsAddOption() multiple times
- */
-rc_t CC ArgsAddOptionArray ( Args * self, const OptDef * option, uint32_t count
-#if ADD_SOMETIME_LATER
-    , rc_t ( CC * header_fmt )( Args * args, const char * header ), const char * header
-#endif
-    );
-
-
-/* AddStandardOptions
- *  helper macro to add the arracy of internally defined
- *  "standard" options that we want all programs to support
- */
-rc_t CC ArgsAddStandardOptions ( Args * self );
-
-
-/* Parse
- *  parse the argc/argv as presented to KMain using the Args structure as built up
- */
-rc_t CC ArgsParse ( Args * self, int argc, char *argv[] );
-
-
-/* tokenizes a file into an user supplied argv array ( not the one from main() ! )
- * the result can be passed into ArgsParse(), enables commandline-options from a file
- *  caller has to free the created array via Args_free_token_argv()
- */
-rc_t CC Args_tokenize_file_into_argv( const char * filename, int * argc, char *** argv );
-
-rc_t CC Args_tokenize_file_and_progname_into_argv( const char * filename, const char * progname,
-                                                   int * argc, char *** argv );
-
-/* free's the array that was created by calling Args_tokenize_file_into_argv()
- */
-void CC Args_free_token_argv( int argc, char * argv[] );
-
-
-/* looks in args for file_option(s), if found loades the files, parses them
-   if this results in more files to be parsed ( kind of includes ),
-   the parsing continues recursivly
- */
-rc_t CC Args_parse_inf_file( Args * args, const char * file_option );
-
-
-/* looks in the unparsed original argv for the value of an option
-   >>> this is a hack to enable special treatment for tools that do not use
-       the standard args-parsing <<<
- */
-rc_t CC Args_find_option_in_argv( int argc, char * argv[],
-                                  const char * option_name,
-                                  char * option, size_t option_len );
-
-/* OptionCount
- *  how many times did this Option occur?
- */
-rc_t CC ArgsOptionCount ( const Args * self, const char * option_name, uint32_t * count );
-
-
-/* OptionValue
- *  what was the Nth value seen for this option?
- *  use OptionCount to know how many were seen.
- */
-rc_t CC ArgsOptionValue ( const Args * self, const char * option_name,
-    uint32_t iteration, const char ** value );
-
-/*
- * ParamCount
- *  How many Parameters were seen?
- */
-rc_t CC ArgsParamCount (const Args * self, uint32_t * count);
-
-/*
- * ParamValue
- *  What was the Nth parameter seen?  Use ParamCount to know how many
- *  were seen.
- */
-rc_t CC ArgsParamValue (const Args * self, uint32_t iteration, const char ** value_string);
-
-
-/*
- * ArgvCount
- *  This is the original main() argument count (argc or ac)
- */
-rc_t CC ArgsArgvCount (const Args * self, uint32_t * count);
-rc_t CC ArgsArgc (const Args * self, uint32_t * count);
-#define ArgsArgc ArgsArgvCount
-
-
-/*
- * ArgvValue
- *  What was the Nth parameter seen?  Use ArgvCount to know how many
- *  were seen.
- *
- * The 0th value will as with the original argc.argv c system be the program name
- * as given to us by the O/S and c start up code.
- */
-rc_t CC ArgsArgvValue (const Args * self, uint32_t iteration, const char ** value_string);
-
-
-
-/* Utility functions to do common combinations and activities */
-
-/*
- * MakeStandardOptions
- *  Calls both Make() and AddStandardOptions()
- *
- * This is probably the first thing to do in KMain(), then add other Options
- * via OptDef arracys and structures.  Then call parse.
- */
-rc_t CC ArgsMakeStandardOptions (Args** pself);
-
-rc_t CC ArgsHandleHelp (Args * self);
-rc_t CC ArgsHandleVersion (Args * self);
-rc_t CC ArgsHandleOptfile (Args * self);
-
-/*
- * ArgsHandleLogLevel
- *  calls OptionCount and OptionValue to get parameters for the log-level
- *  option then uses that/those values to set the Log level for the log module
- */
-rc_t CC ArgsHandleLogLevel (const Args * self);
-
-
-rc_t CC ArgsHandleStatusLevel (const Args * self);
-rc_t CC ArgsHandleDebug (const Args * self);
-rc_t CC ArgsHandleStandardOptions (Args * self);
-
-rc_t CC ArgsMakeAndHandle (Args ** pself, int argc, char ** argv, uint32_t table_count, ...);
-
-rc_t CC ArgsMakeAndHandleStandardOptions (Args ** pself, int argc, char ** argv,
-                                       OptDef * options, uint32_t opt_count);
-
-rc_t CC ArgsOptionSingleString (const Args * self, const char * option, const char ** value);
-
-/* either fullpath or progname can be NULL, args can not */
-rc_t CC ArgsProgram (const Args * args, const char ** fullpath, const char ** progname);
-
-
-/* after arguments are parsed; check to see if any required arguments are missing */
-rc_t CC ArgsCheckRequired (Args * args);
-
-
-/*
- * Help Interface:
- * This interface is an extention os the Args Interface that is used for
- * generating usage outputs for a command line program,  This interface is provided
- * to standardize the look of these usage messages.
- */
-
-/*
- * This function is defined per program and is the meat of the output
- * the the short-form usage and the first part of the long-form usage
- *
- * It should look something like this:
- *
- *
- *    rc_t UsageSummary (const char * progname)
- *    {
- *        return KOutMsg ("\n"
- *                        "Usage:\n"
- *                        "  %s [Options] [Parameters]\n"
- *                        "\n"
- *                        "Summary:\n"
- *                        "  Does something incredibly useful or we wouldn't have written it.\n"
- *                        "  I mean very very useful like pre-slicomg bread.\n",
- *                        "\n", progname);
- *    }
- *
- * More than one example line can be present if desired.
- */
-rc_t CC UsageSummary (const char * prog_name);
-
-/*
- * A program should define this which will be used only of the actual
- * program name as called is somehow irretrievable
- */
-extern const char UsageDefaultName[];
-
-
-/*
- * Version
- *   Generate the output for the -V or --version options.
- *   const char * fullpath:  The full argv[0] name for the program
- *   ver_t version:          the version for this program
- */
-void CC HelpVersion (const char * fullpath, ver_t version);
-
-void CC HelpOptionLine(const char * alias, const char * option, const char * param, const char ** msgs);
-
-void CC HelpParamLine (const char * param, const char * const * msgs);
-
-/*
- * OptionsStandard
- *   output the option lines for the standard options
- */
-void CC HelpOptionsStandard (void);
-
-
-/*
- * This Macro creates a default short form usage output typically
- * used when no options/parameters are given for a program
- *
- * It requires 'void summary (const char * program_name)' that is also
- * used in 'rc_t Usage (const Args* args)' that is the usage function
- * called when -? -h or --help is given as an option on the command line
- */
-
-rc_t CC MiniUsage ( const Args * args );
-rc_t CC Usage ( const Args * args );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kapp_args_ */
diff --git a/interfaces/kapp/extern.h b/interfaces/kapp/extern.h
deleted file mode 100644
index 726e555..0000000
--- a/interfaces/kapp/extern.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kapp_extern_
-#define _h_kapp_extern_
-
-#if ! defined EXPORT_LATCH && defined _LIBRARY
-
-#define KAPP_EXTERN LIB_EXPORT
-#define KAPP_EXTERN_DATA extern LIB_EXPORT
-#define EXPORT_LATCH 1
-
-#else
-
-#define KAPP_EXTERN LIB_IMPORT
-#define KAPP_EXTERN_DATA LIB_IMPORT
-
-#endif
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#endif /* _h_kapp_extern_ */
diff --git a/interfaces/kapp/loader-file.h b/interfaces/kapp/loader-file.h
deleted file mode 100644
index e4c0de8..0000000
--- a/interfaces/kapp/loader-file.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifndef _h_kapp_loader_file_
-#define _h_kapp_loader_file_
-
-#ifndef _h_kapp_extern_
-#include <kapp/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#include <stdarg.h>
-
-#include <klib/log.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct KDirectory;
-
-/*--------------------------------------------------------------------------
-* SRA reader buffered input file
-*/
-typedef struct KLoaderFile KLoaderFile;
-
-/*
-    md5_digest - not null forces MD5 verification for the file content
-    read_ahead - force reading of the file in a diff thread, ahead of time,
-                 usefull on compressed file, speeds up MD5 verify too
-*/
-KAPP_EXTERN rc_t CC KLoaderFile_Make(const KLoaderFile **file, struct KDirectory const* dir, const char* filename,
-                                     const uint8_t* md5_digest, bool read_ahead);
-
-KAPP_EXTERN rc_t CC KLoaderFile_Release(const KLoaderFile* cself, bool exclude_from_progress);
-
-/* temporary close the file to avoid too many open files, but stay on position */
-KAPP_EXTERN rc_t CC KLoaderFile_Close(const KLoaderFile* cself);
-
-/* restart reading from beginning of the file */
-KAPP_EXTERN rc_t CC KLoaderFile_Reset(const KLoaderFile* cself);
-
-KAPP_EXTERN rc_t CC KLoaderFile_SetReadAhead(const KLoaderFile* cself, bool read_ahead);
-
-/* print error msg file file info and return original!! rc
-   if msg is NULL fmt is not used so call with NULL, NULL if no msg needs to be printed */
-KAPP_EXTERN rc_t CC KLoaderFile_LOG(const KLoaderFile* cself, KLogLevel lvl, rc_t rc, const char *msg, const char *fmt, ...);
-KAPP_EXTERN rc_t CC KLoaderFile_VLOG(const KLoaderFile* cself, KLogLevel lvl, rc_t rc, const char *msg, const char *fmt, va_list args);
-
-/* returns true if eof is reached and buffer is empty */
-KAPP_EXTERN rc_t CC KLoaderFile_IsEof(const KLoaderFile* cself, bool* eof);
-
-/* returns current buffer position in file */
-KAPP_EXTERN rc_t CC KLoaderFile_Offset(const KLoaderFile* cself, uint64_t* offset);
-
-/* returns current line number in file */
-KAPP_EXTERN rc_t CC KLoaderFile_Line(const KLoaderFile* cself, uint64_t* line);
-
-/* file name */
-KAPP_EXTERN rc_t CC KLoaderFile_Name(const KLoaderFile *self, const char **name);
-
-/* real file name */
-KAPP_EXTERN rc_t CC KLoaderFile_FullName(const KLoaderFile *self, const char **name);
-
-/* file name completly resolved */
-KAPP_EXTERN rc_t CC KLoaderFile_ResolveName(const KLoaderFile *self, char *resolved, size_t rsize);
-
-/* Readline
- *  makes next line from a file available in buffer.
- *  eligable EOL symbols are: \n (unix), \r (older mac), \r\n (win)
- *  EOL symbol(s) never included in buffer length.
- *  if there is no EOL at EOF - not an error.
- *  fails if internal buffer is insufficient.
- *  buffer is NULL on EOF
- *  rc state of (rcString rcTooLong) means line was too long
- *              you may copy line and readline again for the tail of the line
- *
- *  "buffer" [ OUT ] and "length" [ OUT ] - returned line and it's length
- */
-KAPP_EXTERN rc_t CC KLoaderFile_Readline(const KLoaderFile* self, const void** buffer, size_t* length);
-
-/* Read
-*  reads "size" bytes from file and makes them available through "buffer"
-*  if "advance" is > 0 than before reading skips "advance" bytes in file
-*  if "size" == 0 then nothing is read and available "length" bytes is returned in "buffer"
-*
-*  "buffer" [ OUT ] - pointer to read bytes, "buffer" NULL means EOF
-*  "length" [ OUT ] - number of read bytes, normally == size,
-                      if less than requested size, rc is [rcBuffer,rcInsufficient], advance and read more!
-*/
-KAPP_EXTERN rc_t CC KLoaderFile_Read(const KLoaderFile* self, size_t advance, size_t size, const void** buffer, size_t* length);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kapp_loader_file_ */
diff --git a/interfaces/kapp/loader-meta.h b/interfaces/kapp/loader-meta.h
deleted file mode 100644
index 28a711a..0000000
--- a/interfaces/kapp/loader-meta.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*==============================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifndef _h_kapp_loader_meta_
-#define _h_kapp_loader_meta_
-
-#ifndef _h_kapp_extern_
-#include <kapp/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct KMDataNode;
-
-KAPP_EXTERN rc_t CC KLoaderMeta_Write(struct KMDataNode* root,
-                                      const char* argv0, const char* argv0_date,
-                                      const char* app_name, ver_t app_version);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kapp_loader_meta_*/
diff --git a/interfaces/kapp/log-xml.h b/interfaces/kapp/log-xml.h
deleted file mode 100644
index 9517fb8..0000000
--- a/interfaces/kapp/log-xml.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifndef _h_kapp_log_xml_h_
-#define _h_kapp_log_xml_h_
-
-#ifndef _kapp_extern_
-#include <kapp/extern.h>
-#endif
-
-#ifndef _kapp_args_
-#include <kapp/args.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct KDirectory;
-
-KAPP_EXTERN_DATA const OptDef XMLLogger_Args [];
-KAPP_EXTERN_DATA const size_t XMLLogger_ArgsQty;
-
-typedef struct XMLLogger XMLLogger;
-
-/*
-  Creates XML logging based on dir and command line
- */
-KAPP_EXTERN rc_t CC XMLLogger_Make(const XMLLogger** cself,
-    struct KDirectory* dir, const Args *args);
-
-/*
-  Creates XML logging based on dir, logpath pair or fd directly
-
-  dir     [IN,NULL] - directory object used to create and open logpath file
-  logpath [IN,NULL] - file name of the log file to _truncate_ and log into
-  fd  [IN,NEGATIVE] - direct file descriptor, if < 0 than not set
-
-  if both logpath == NULL and fd < 0 than no XML log is produced normal log gets full inforamtion
- */
-KAPP_EXTERN rc_t CC XMLLogger_Make2(const XMLLogger** cself,
-    struct KDirectory* dir, const char* logpath, const int fd);
-
-KAPP_EXTERN void CC XMLLogger_Usage(void);
-
-KAPP_EXTERN void CC XMLLogger_Release(const XMLLogger* cself);
-
-KAPP_EXTERN rc_t CC XMLLogger_Encode(const char* src, char *dst, size_t dst_sz, size_t *num_writ);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kapp_log_xml_h_ */
diff --git a/interfaces/kapp/main.h b/interfaces/kapp/main.h
deleted file mode 100644
index 5190f15..0000000
--- a/interfaces/kapp/main.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kapp_main_
-#define _h_kapp_main_
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifndef _h_kapp_args_
-#include <kapp/args.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KMain
- *  invoked by platform specific "main" entrypoint
- */
-
-/* Quitting
- *  is the program supposed to exit
- */
-rc_t CC Quitting ( void );
-
-/* SignalQuit
- *  tell the program to quit
- */
-rc_t CC SignalQuit ( void );
-
-/* Hangup
- *  has the program received a SIGHUP
- */
-rc_t CC Hangup ( void );
-
-/* SignalHup
- *  send the program a SIGHUP
- */
-rc_t CC SignalHup ( void );
-
-/* SignalNoHup
- *  tell the program to stay alive even after SIGHUP
- */
-rc_t CC SignalNoHup ( void );
-
-/* Version  EXTERN
- *  return 4-part version code: 0xMMmmrrrr, where
- *      MM = major release
- *      mm = minor release
- *    rrrr = bug-fix release
- */
-ver_t CC KAppVersion ( void );
-    
-/* KMain - EXTERN
- *  executable entrypoint "main" is implemented by
- *  an OS-specific wrapper that takes care of establishing
- *  signal handlers, logging, etc.
- *
- *  in turn, OS-specific "main" will invoke "KMain" as
- *  platform independent main entrypoint.
- *
- *  "argc" [ IN ] - the number of textual parameters in "argv"
- *  should never be < 0, but has been left as a signed int
- *  for reasons of tradition.
- *
- *  "argv" [ IN ] - array of NUL terminated strings expected
- *  to be in the shell-native character set: ASCII or UTF-8
- *  element 0 is expected to be executable identity or path.
- */
-rc_t CC KMain ( int argc, char *argv [] );
-
-
-/* Usage - EXTERN
- *  This function is called when the command line argument
- *  handling sees -? -h or --help
- */
-rc_t CC Usage ( struct Args const * args );
-
-
-/* Version - EXTERN
- *  Obsolete: formerly called when the command line option handler
- *  saw -V or --version
- */
-rc_t CC Version ( struct Args const * args );
-
-
-/* AsciiToXXX
- *  replacement for atoi
- *  converts NUL terminated string in "arg" to integer
- *  invokes error handler if there is a format error in string
- *
- *  "arg" [ IN ] - NUL terminated textual representation of integer
- *  obeys standard conversion rules:
- *    starts with "0x" or "0X" - interpret as hex
- *    starts with '0' - interpret as octal
- *    otherwise - interpret as decimal
- *
- *  "handler_error" [ IN, NULL OKAY ] and "data" [ IN, OPAQUE ] -
- *  optional callback function to handle case where "arg" could not
- *  be processed in its entirety. default behavior is to log error
- *  using "logerr" and invoke "exit".
- */
-int32_t CC AsciiToI32 ( const char *arg,
-    void ( CC * handle_error ) ( const char *arg, void *data ), void *data );
-uint32_t CC AsciiToU32 ( const char *arg,
-    void ( CC * handle_error ) ( const char *arg, void *data ), void *data );
-int64_t CC AsciiToI64 ( const char *arg,
-    void ( CC * handle_error ) ( const char *arg, void *data ), void *data );
-uint64_t CC AsciiToU64 ( const char *arg,
-    void ( CC * handle_error ) ( const char *arg, void *data ), void *data );
-
-
-/* NextLogLevel
- * NextLogLevelh
- *  these match NextArg and NextArgh but take the parameter and use it
- *  to set the Log Level.
- *
- * legal values for the parameter are:
- * 1. a sequence of + or - characters that each bump the current log level
- *    up or down one.
- * 2. an integer with a decimal value from 0 to 13 (octal and hex with the 
- *    same range are accepted.
- * 3. fatal, err, warn, info, debug1, debug3, debug3, debug4, debug5, debug6
- *    debug7, debug8, debug9, debug10
- */
-void CC NextLogLevel ( const char **argp, int *ip, int argc, char *argv [],
-    const char* ( CC * handle_null ) ( void *data ), void *data );
-void CC NextLogLevelh ( int *ip, int argc, char *argv [],
-    const char* ( CC * handle_null ) ( void *data ), void *data );
-
-#define LogLevelSet( S ) \
-    NextLogLevelCommon ( S )
-
-rc_t CC NextLogLevelCommon ( const char * level_parameter );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kapp_main_ */
diff --git a/interfaces/kapp/progressbar.h b/interfaces/kapp/progressbar.h
deleted file mode 100644
index 07d1555..0000000
--- a/interfaces/kapp/progressbar.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifndef _h_kapp_progressbar_
-#define _h_kapp_progressbar_
-
-#ifndef _h_kapp_extern_
-#include <kapp/extern.h>
-#endif
-
-#ifndef _h_klib_log_
-#include <klib/log.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct KFile;
-struct KDirectory;
-
-typedef struct KLoadProgressbar KLoadProgressbar;
-
-/**
-   Create new object in job
- */
-KAPP_EXTERN rc_t CC KLoadProgressbar_Make(const KLoadProgressbar** cself, uint64_t size);
-/**
-   if dir is NULL current directory assumed
- */
-KAPP_EXTERN rc_t CC KLoadProgressbar_File(const KLoadProgressbar** cself, const char* filename, struct KDirectory const* dir);
-KAPP_EXTERN rc_t CC KLoadProgressbar_KFile(const KLoadProgressbar** cself, struct KFile const* file);
-
-/**
-  Release job object
-  if exclude than job stats excluded from reports
-  */
-KAPP_EXTERN void CC KLoadProgressbar_Release(const KLoadProgressbar* cself, bool exclude);
-
-/**
-    Add a chunk of smth (bytes, rows, etc) to the job
- */
-KAPP_EXTERN rc_t CC KLoadProgressbar_Append(const KLoadProgressbar* cself, uint64_t chunk);
-
-
-/* Set severity level name
-   severity [IN] - default 'status'
- */
-KAPP_EXTERN rc_t CC KLoadProgressbar_Severity(const char* severity);
-
-/* mark a chunk of bytes as processed
-   report on full percent processed or if forced
- */
-KAPP_EXTERN rc_t CC KLoadProgressbar_Process(const KLoadProgressbar* cself, uint64_t chunk, bool force_report);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kapp_progressbar_ */
diff --git a/interfaces/kapp/queue-file.h b/interfaces/kapp/queue-file.h
deleted file mode 100644
index 79fa890..0000000
--- a/interfaces/kapp/queue-file.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifndef _h_kapp_queue_file_
-#define _h_kapp_queue_file_
-
-#ifndef _h_kapp_extern_
-#include <kapp/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KQueueFile
- *  an extension to KFile that runs on a background thread
- */
-struct KFile;
-
-
-/* MakeRead
- *  make a queue file for reading-ahead on background thread
- *
- *  when the file is created, a background thread is started
- *  that begins reading from "src" at position "pos", into
- *  buffers of size "buffer_size". each buffer is pushed into
- *  a cross-thread queue where it is consumed by the reading
- *  thread.
- *
- *  the background thread is throttled by queue capacity - determined
- *  by "queue_bytes" and "block_size", such that if the queue is full,
- *  the thread will sleep. the consumer thread is also throttled by the
- *  queue in that it will sleep if the queue is empty with pending data.
- *
- *  the background thread will exit upon reaching end of file,
- *  upon a permanent error, or if the queue is sealed by the consumer
- *  thread.
- *
- *  when the file is collected in response to a release message,
- *  the queue will be sealed against further inserts, pending buffers
- *  will be discarded, the background thread will be joined, and
- *  the source file will be released.
- *
- *  the intended usage is serial reading of the file. reads
- *  may only progress forward, i.e. backing up is not permitted.
- *
- *  "qf" [ OUT ] - return parameter for queue file
- *
- *  "pos" [ IN ] - starting position for reads from "src".
- *  NB - "src" must support being addressed at this position.
- *
- *  "src" [ IN ] - source file for read-ahead on background thread.
- *  must have read permissions.
- *
- *  "queue_bytes" [ IN ] - the read-ahead limit of the background
- *  thread, in bytes. this is the amount of data that will be queued
- *  for the consumer thread before the bg thread sleeps.
- *
- *  "block_size" [ IN, DEFAULT ZERO ] - optional parameter giving
- *  desired block size when reading from "src". this may be used
- *  to tune reading for source data, e.g. 64K blocks for gzip.
- *
- *  "timeout_ms" [ IN, DEFAULT ZERO ] - optional parameter specifying the period of time (in ms)
- *  at which the background thread will check whether it is to quit (e.g. the foregrount thread has sealed the buffer),
- *  when the queue cannot be written into.  If 0 specified, the timeout is set to 150 ms.
- */
-KAPP_EXTERN rc_t CC KQueueFileMakeRead ( struct KFile const **qf, uint64_t pos,
-    struct KFile const *src, size_t queue_bytes, size_t block_size, uint32_t timeout_ms );
-
-
-/* MakeWrite
- *  make a queue file for writing-behind on background thread
- *
- *  when the file is created, a background thread is started that
- *  waits for buffers to appear in the cross-thread queue. as the producer
- *  thread writes, data are accumulated into buffers which are pushed
- *  into the queue as they fill, and written in turn on the bg thread.
- *
- *  the producer thread is throttled by queue capacity - determined by
- *  "queue_bytes" and "block_size", such that if the queue is full,
- *  the thread will sleep. the background thread is also throttled by
- *  the queue in that it will sleep if the queue is empty with pending
- *  data.
- *
- *  the background thread will exit upon a permanent error, or if the
- *  queue is sealed by the producer thread.
- *
- *  when the file is collected in response to a release message,
- *  the queue will be sealed against further inserts, pending buffers
- *  will be written, the background thread will be joined, and
- *  the source file will be released.
- *
- *  the intended usage is serial writing of the file. random writes
- *  will be accepted, but may reduce the queue efficiency.
- *
- *  "qf" [ OUT ] - return parameter for queue file
- *
- *  "dst" [ IN ] - destination file for write-behind on background thread.
- *  must have write permissions.
- *
- *  "queue_bytes" [ IN ] - the write-behind limit of the producer
- *  thread, in bytes. this is the amount of data that will be queued
- *  for the background thread before the producer thread sleeps.
- *
- *  "block_size" [ IN, DEFAULT ZERO ] - optional parameter giving
- *  desired block size when writing to "dst". this may be used
- *  to tune writing for source data, e.g. 64K blocks for gzip.
- *
- *  "timeout_ms" [ IN, DEFAULT ZERO ] - optional parameter specifying the period of time (in ms)
- *  at which the background thread will check whether it is to quit (e.g. the foregrount thread has sealed the buffer),
- *  when the queue cannot be read from.  If 0 specified, the timeout is set to 150 ms.
- */
-KAPP_EXTERN rc_t CC KQueueFileMakeWrite ( struct KFile **qf,
-    struct KFile *dst, size_t queue_bytes, size_t block_size, uint32_t timeout_ms );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kapp_queue_file_ */
diff --git a/interfaces/kdb/btree.h b/interfaces/kdb/btree.h
deleted file mode 100644
index 0f6e85d..0000000
--- a/interfaces/kdb/btree.h
+++ /dev/null
@@ -1,371 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kdb_btree_
-#define _h_kdb_btree_
-
-#ifndef _h_kdb_extern_
-#include <kdb/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * defines
- */
-
-/* KEY2ID
- *  the original behavior of btree was to perform key=>value mapping
- *  by converting to a key=>id mapping, no values are stored in the b-tree
- *  page file, allowing for an external storage
- */
-#ifndef BTREE_KEY2ID
-#define BTREE_KEY2ID 1
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KFile;
-struct KDataBuffer;
-
-
-/*--------------------------------------------------------------------------
- * KBTreeCompareFunc
- */
-typedef int ( CC * KBTreeCompareFunc )
-    ( const void *a, size_t asize, const void *b, size_t bsize );
-
-
-#if ! BTREE_KEY2ID
-/*--------------------------------------------------------------------------
- * KBTreeValue
- *  gives access to a value within a data page
- */
-typedef struct KBTreeValue KBTreeValue;
-struct KBTreeValue
-{
-    uint64_t data [ 3 ];
-};
-
-/* Whack
- *  destroys object for further use
- *  may write modifications to disk ( see "write_through" below )
- */
-KDB_EXTERN rc_t CC KBTreeValueWhack ( KBTreeValue *self );
-
-
-/* AccessRead
- * AccessUpdate
- *  gain access to value address
- *  update access marks data page as modified
- *
- *  "mem" [ OUT ] - pointer to value
- *
- *  "bytes" [ OUT, NULL OKAY ] - size of value memory
- */
-KDB_EXTERN rc_t CC KBTreeValueAccessRead ( const KBTreeValue *self,
-    const void **mem, size_t *bytes );
-KDB_EXTERN rc_t CC KBTreeValueAccessUpdate ( KBTreeValue *self,
-    void **mem, size_t *bytes );
-
-#endif /* BTREE_KEY2ID */
-
-/*--------------------------------------------------------------------------
- * KBTree
- *  this implementation is an extremely simplified structure
- *  meant to provide the ability to create an index for temporary use
- */
-typedef struct KBTree KBTree;
-
-
-/* KBTreeKeyType
- *  describes the type of key to be used
- */
-typedef uint8_t KBTreeKeyType;
-enum
-{
-    kbtOpaqueKey,               /* key is a ( void*, size_t ) pair  */
-#if 0
-    kbtNulTermCharKey,          /* key is a NUL-terminated char []  */
-    kbtStringKey,               /* key is a String*                 */
-    kbtInt8Key,                 /* key is an int8_t                 */
-    kbtInt16Key,                /* key is an int16_t                */
-    kbtInt32Key,                /* key is an int32_t                */
-    kbtInt64Key,                /* key is an int64_t                */
-    kbtUint8Key,                /* key is a uint8_t                 */
-    kbtUint16Key,               /* key is a uint16_t                */
-    kbtUint32Key,               /* key is a uint32_t                */
-    kbtUint64Key,               /* key is a uint64_t                */
-    kbtFloatKey,                /* key is a float                   */
-    kbtDoubleKey,               /* key is a double                  */
-#endif
-    kbtPacked2naKey,            /* key is in packed 2na             */
-    kbtLastDefined
-};
-
-
-/* MakeRead
- * MakeUpdate
- *  make a b-tree object backed by supplied KFile
- *
- *  "backing" [ IN ] - open file with appropriate permissions:
- *   read is required in all cases, and write is required for update.
- *   NB - a reference will be attached to this file.
- *
- *  "climit" [ IN ] - cache limit in bytes. the internal cache will
- *   retain UP TO ( but not exceeding ) the limit specified. a value
- *   of 0 ( zero ) will disable caching.
- *
- *  "write_through" [ IN ] - if true, causes flushing of modified page
- *   after its value is released
- *
- *  "type" [ IN ] - describes the key type ( see above )
- *
- *  "key_chunk_size" [ IN ] - the "chunking" ( alignment ) factor for
- *   storing keys, rounded up to the nearest power of 2.
- *
- *  "value_chunk_size" [ IN ] - chunking factor for values
- *   ( see "key_chunk_size" )
- *
- *  "min_key_size" [ IN ] and "max_key_size" [ IN ] - specifies the allowed
- *   opaque key sizes. min == max implies fixed size. ignored for well
- *   known fixed size key types.
- *
- *  "id_size" [ IN ] - size of id in bytes, from 1 to 8.
- *
- *  "min_value_size" [ IN ] and "max_value_size" [ IN ] - specifies the allowed
- *   value sizes. min == max implies fixed size.
- *
- *  "cmp" [ IN, NULL OKAY ] - optional comparison callback function for opaque keys.
- *   specific key types will use internal comparison functions. for opaque keys, a
- *   NULL function pointer will cause ordering by size and binary comparison.
- */
-KDB_EXTERN rc_t CC KBTreeMakeRead ( const KBTree **bt,
-    struct KFile const *backing, size_t climit, KBTreeCompareFunc cmp );
-#if BTREE_KEY2ID
-KDB_EXTERN rc_t CC KBTreeMakeUpdate ( KBTree **bt, struct KFile *backing,
-    size_t climit, bool write_through, KBTreeKeyType type,
-    size_t min_key_size, size_t max_key_size, size_t id_size,
-    KBTreeCompareFunc cmp );
-#else
-KDB_EXTERN rc_t CC KBTreeMakeUpdate ( KBTree **bt, struct KFile *backing,
-    size_t climit, bool write_through, KBTreeKeyType type,
-    size_t key_chunk_size, size_t value_chunk_size,
-    size_t min_key_size, size_t max_key_size,
-    size_t min_value_size, size_t max_value_size,
-    KBTreeCompareFunc cmp );
-#endif
-
-
-/* AddRef
- * Release
- *  ignores NULL references
- */
-KDB_EXTERN rc_t CC KBTreeAddRef ( const KBTree *self );
-KDB_EXTERN rc_t CC KBTreeRelease ( const KBTree *self );
-
-
-/* DropBacking
- *  used immediately prior to releasing
- *  prevents modified pages from being flushed to disk
- *  renders object nearly useless
- */
-KDB_EXTERN rc_t CC KBTreeDropBacking ( KBTree *self );
-
-
-/* Size
- *  returns size in bytes of file and cache
- *
- *  "lsize" [ OUT, NULL OKAY ] - return parameter for logical size
- *
- *  "fsize" [ OUT, NULL OKAY ] - return parameter for file size
- *
- *  "csize" [ OUT, NULL OKAY ] - return parameter for cache size
- */
-KDB_EXTERN rc_t CC KBTreeSize ( const KBTree *self,
-    uint64_t *lsize, uint64_t *fsize, size_t *csize );
-
-
-/* Find
- *  searches for a match
- *
- *  "val" [ OUT ] - return parameter for value found
- *   accessed via KBTreeValueAccess* described above
- *   must be balanced with a call to KBTreeValueWhack.
- *
- *  "key" [ IN ] and "key_size" [ IN ] - describes an
- *   opaque key
- */
-#if BTREE_KEY2ID
-KDB_EXTERN rc_t CC KBTreeFind ( const KBTree *self, uint64_t *id,
-    const void *key, size_t key_size );
-#else
-KDB_EXTERN rc_t CC KBTreeFind ( const KBTree *self, KBTreeValue *val,
-    const void *key, size_t key_size );
-#endif
-
-
-/* FindOne
- *  searches for a match
- *  where "match" is defined as an exact match
- *  of the shorter ( key, entry ) against the
- *  corresponding prefix of the longer.
- *
- *  "id" [ OUT ] - return id of matching entry if found
- *
- *  "key" [ IN ] and "key_size" [ IN ] - describes an
- *   opaque key
- *
- *  "match_type" [ IN ] - choose search algorithm
- *
- *  "remainder" [ OUT ] - returns the number of bytes
- *  left unmatched by comparison between the key and entry.
- *  values:
- *    = 0    - exact match
- *    < 0    - key is shorter than entry
- *    > 0    - key is longer than entry
- */
-#if BTREE_KEY2ID && 1
-typedef uint32_t KBTreeMatchType;
-enum
-{
-    kbtMatchFirst = 1,       /* choose first matching entry       */
-    kbtMatchRandom           /* choose a matching entry at random */
-};
-
-typedef struct KBTreeMatchResult KBTreeMatchResult;
-struct KBTreeMatchResult
-{
-    uint64_t id;
-    int64_t remainder;
-};
-
-KDB_EXTERN rc_t CC KBTreeFindOne ( const KBTree *self,
-    KBTreeMatchResult *found, KBTreeMatchType match_type,
-    const void *key, size_t key_size );
-#endif
-
-
-/* FindAll
- *  searches for all matches
- *  where "match" is defined as an exact match
- *  of the shorter ( key, entry ) against the
- *  corresponding prefix of the longer.
- *
- *  "ids" [ IN/OUT ] - array of uint64_t gets dynamically
- *  resized based upon the number of matches
- *
- *  "key" [ IN ] and "key_size" [ IN ] - describes an
- *   opaque key
- *
- *  "remainder" [ OUT ] - returns the number of bytes
- *  left unmatched by comparison between the key and entry.
- *  values:
- *    = 0    - exact match
- *    < 0    - key is shorter than entry
- *    > 0    - key is longer than entry
- */
-#if BTREE_KEY2ID && 1
-KDB_EXTERN rc_t CC KBTreeFindAll ( const KBTree *self,
-    struct KDataBuffer *found_set,
-    const void *key, size_t key_size );
-#endif
-
-
-/* FindCustom
- *  searches for a match using a custom function
- *
- *  "val" [ OUT ] - return parameter for value found
- *   accessed via KBTreeValueAccess* described above
- *   must be balanced with a call to KBTreeValueWhack.
- *
- *  "key" [ IN ] and "key_size" [ IN ] - describes an
- *   opaque key
- */
-#if BTREE_KEY2ID && 0
-KDB_EXTERN rc_t CC KBTreeFindCustom ( const KBTree *self, uint64_t *id,
-    const void *key, size_t key_size, KBTreeCompareFunc custom_cmp );
-#endif
-
-
-/* Entry
- *  searches for a match or creates a new entry
- *
- *  "val" [ OUT ] - return parameter for value found
- *   accessed via KBTreeValueAccess* described above
- *   must be balanced with a call to KBTreeValueWhack.
- *
- *  "was_inserted" [ OUT ] - if true, the returned value was the result of an
- *   insertion and can be guaranteed to be all 0 bits. otherwise, the returned
- *   value will be whatever was there previously.
- *
- *  "alloc_size" [ IN ] - the number of value bytes to allocate upon insertion,
- *   i.e. if the key was not found. this value must agree with the limits
- *   specified in Make ( see above ).
- *
- *  "key" [ IN ] and "key_size" [ IN ] - describes an
- *   opaque key
- */
-#if BTREE_KEY2ID
-KDB_EXTERN rc_t CC KBTreeEntry ( KBTree *self, uint64_t *id,
-    bool *was_inserted, const void *key, size_t key_size );
-#else
-KDB_EXTERN rc_t CC KBTreeEntry ( KBTree *self, KBTreeValue *val,
-    bool *was_inserted, size_t alloc_size,
-    const void *key, size_t key_size );
-#endif
-
-
-/* ForEach
- *  executes a function on each tree element
- *
- *  "reverse" [ IN ] - if true, iterate in reverse order
- *
- *  "f" [ IN ] and "data" [ IN, OPAQUE ] - callback function
- */
-#if BTREE_KEY2ID
-KDB_EXTERN rc_t CC KBTreeForEach ( const KBTree *self, bool reverse,
-    void ( CC * f ) ( const void *key, size_t key_size, uint64_t id, void *data ), void *data );
-#else
-KDB_EXTERN rc_t CC KBTreeForEach ( const KBTree *self, bool reverse,
-    void ( CC * f ) ( const void *key, size_t key_size, KBTreeValue *val, void *data ), void *data );
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*  _h_kdb_btree_ */
diff --git a/interfaces/kdb/column.h b/interfaces/kdb/column.h
deleted file mode 100644
index 7ffbc3b..0000000
--- a/interfaces/kdb/column.h
+++ /dev/null
@@ -1,302 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kdb_column_
-#define _h_kdb_column_
-
-#ifndef _h_kdb_extern_
-#include <kdb/extern.h>
-#endif
-
-#ifndef _h_kfs_directory_
-#include <kfs/directory.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KTable;
-struct KDBManager;
-
-
-/*--------------------------------------------------------------------------
- * KChecksum
- *  describes blob checksum
- */
-typedef uint8_t KChecksum;
-enum
-{
-    kcsNone,
-    kcsCRC32,
-    kcsMD5
-};
-
-
-/*--------------------------------------------------------------------------
- * KColumn
- *  a collection of blobs indexed by oid
- */
-typedef struct KColumn KColumn;
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-KDB_EXTERN rc_t CC KColumnAddRef ( const KColumn *self );
-KDB_EXTERN rc_t CC KColumnRelease ( const KColumn *self );
-
-
-/* CreateColumn
- * VCreateColumn
- *  create a new or open an existing column
- *
- *  "col" [ OUT ] - return parameter for newly opened column
- *
- *  "cmode" [ IN ] - creation mode
- *
- *  "checksum" [ IN ] - the type of checksum information to
- *  apply when writing blobs
- *
- *  "pgsize" [ IN, DEFAULT ZERO ] - size of internal column "pages"
- *  the default value is indicated by 0 ( zero ).
- *  NB - CURRENTLY THE ONLY SUPPORTED PAGE SIZE IS 1 ( ONE ) BYTE.
- *
- *  "path" [ IN ] - NUL terminated string in UTF-8 giving path to col
- *  where "." acts as a structure name separator, i.e. struct.member
- */
-KDB_EXTERN rc_t CC KDBManagerCreateColumn ( struct KDBManager *self,
-    KColumn **col, KCreateMode cmode, KChecksum checksum,
-    size_t pgsize, const char *path, ... );
-KDB_EXTERN rc_t CC KTableCreateColumn ( struct KTable *self,
-    KColumn **col, KCreateMode cmode, KChecksum checksum,
-    size_t pgsize, const char *path, ... );
-
-KDB_EXTERN rc_t CC KDBManagerVCreateColumn ( struct KDBManager *self,
-    KColumn **col, KCreateMode cmode, KChecksum checksum,
-    size_t pgsize, const char *path, va_list args );
-KDB_EXTERN rc_t CC KTableVCreateColumn ( struct KTable *self,
-    KColumn **col, KCreateMode cmode, KChecksum checksum,
-    size_t pgsize, const char *path, va_list args );
-
-
-/* OpenColumnRead
- * VOpenColumnRead
- *  open a column for read
- *
- *  "col" [ OUT ] - return parameter for newly opened column
- *
- *  "path" [ IN ] - NUL terminated string in UTF-8 giving path to col
- *  where "." acts as a structure name separator, i.e. struct.member
- */
-KDB_EXTERN rc_t CC KDBManagerOpenColumnRead ( struct KDBManager const *self,
-    const KColumn **col, const char *path, ... );
-KDB_EXTERN rc_t CC KTableOpenColumnRead ( struct KTable const *self,
-    const KColumn **col, const char *path, ... );
-
-KDB_EXTERN rc_t CC KDBManagerVOpenColumnRead ( struct KDBManager const *self,
-    const KColumn **col, const char *path, va_list args );
-KDB_EXTERN rc_t CC KTableVOpenColumnRead ( struct KTable const *self,
-    const KColumn **col, const char *path, va_list args );
-
-
-/* OpenColumnUpdate
- * VOpenColumnUpdate
- *  open a column for read/write
- *
- *  "col" [ OUT ] - return parameter for newly opened column
- *
- *  "path" [ IN ] - NUL terminated string in UTF-8 giving path to col
- *  where "." acts as a structure name separator, i.e. struct.member
- */
-KDB_EXTERN rc_t CC KDBManagerOpenColumnUpdate ( struct KDBManager *self,
-    KColumn **col, const char *path, ... );
-KDB_EXTERN rc_t CC KTableOpenColumnUpdate ( struct KTable *self,
-    KColumn **col, const char *path, ... );
-
-KDB_EXTERN rc_t CC KDBManagerVOpenColumnUpdate ( struct KDBManager *self,
-    KColumn **col, const char *path, va_list args );
-KDB_EXTERN rc_t CC KTableVOpenColumnUpdate ( struct KTable *self,
-    KColumn **col, const char *path, va_list args );
-
-
-/* Locked
- *  returns true if locked
- */
-KDB_EXTERN bool CC KColumnLocked ( const KColumn *self );
-
-
-/* Version
- *  returns the format version
- */
-KDB_EXTERN rc_t CC KColumnVersion ( const KColumn *self, uint32_t *version );
-
-
-/* ByteOrder
- *  indicates whether original byte order is reversed
- *  under current architecture.
- *
- *  the byte order of the column is established by
- *  the host architecture when created.
- *
- *  "reversed" [ OUT ] - if true, the original byte
- *  order is reversed with regard to host native byte order.
- */
-KDB_EXTERN rc_t CC KColumnByteOrder ( const KColumn *self, bool *reversed );
-
-
-/* IdRange
- *  returns id range for column
- *
- *  "first" [ OUT ] - first id in column
- *
- *  "count" [ OUT ] - number of ids represented by this column
- */
-KDB_EXTERN rc_t CC KColumnIdRange ( const KColumn *self, int64_t *first, uint64_t *count );
-
-
-/* Reindex
- *  optimize indices
- */
-KDB_EXTERN rc_t CC KColumnReindex ( KColumn *self );
-
-
-/* CommitFreq
- * SetCommitFreq
- *  manage frequency of commits
- */
-KDB_EXTERN rc_t CC KColumnCommitFreq ( KColumn *self, uint32_t *freq );
-KDB_EXTERN rc_t CC KColumnSetCommitFreq ( KColumn *self, uint32_t freq );
-
-
-/* OpenManager
- *  duplicate reference to manager
- *  NB - returned reference must be released
- */
-KDB_EXTERN rc_t CC KColumnOpenManagerRead ( const KColumn *self, struct KDBManager const **mgr );
-KDB_EXTERN rc_t CC KColumnOpenManagerUpdate ( KColumn *self, struct KDBManager **mgr );
-
-
-/* OpenParent
- *  duplicate reference to parent table
- *  NB - returned reference must be released
- */
-KDB_EXTERN rc_t CC KColumnOpenParentRead ( const KColumn *self, struct KTable const **tbl );
-KDB_EXTERN rc_t CC KColumnOpenParentUpdate ( KColumn *self, struct KTable **tbl );
-
-
-/*--------------------------------------------------------------------------
- * KColumnBlob
- *  one or more rows of column data
- */
-typedef struct KColumnBlob KColumnBlob;
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-KDB_EXTERN rc_t CC KColumnBlobAddRef ( const KColumnBlob *self );
-KDB_EXTERN rc_t CC KColumnBlobRelease ( const KColumnBlob *self );
-
-
-/* CreateBlob
- *  creates a new, unassigned blob
- */
-KDB_EXTERN rc_t CC KColumnCreateBlob ( KColumn *self, KColumnBlob **blob );
-
-
-/* OpenBlobRead
- * OpenBlobUpdate
- *  opens an existing blob containing row data for id
- */
-KDB_EXTERN rc_t CC KColumnOpenBlobRead ( const KColumn *self, const KColumnBlob **blob, int64_t id );
-KDB_EXTERN rc_t CC KColumnOpenBlobUpdate ( KColumn *self, KColumnBlob **blob, int64_t id );
-
-
-/* Read
- *  read data from blob
- *
- *  "offset" [ IN ] - starting offset into blob
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT ] - number of bytes actually read
- *
- *  "remaining" [ OUT, NULL OKAY ] - optional return parameter for
- *  the number of bytes remaining to be read. specifically,
- *  "offset" + "num_read" + "remaining" == sizeof blob
- */
-KDB_EXTERN rc_t CC KColumnBlobRead ( const KColumnBlob *self,
-    size_t offset, void *buffer, size_t bsize,
-    size_t *num_read, size_t *remaining );
-
-
-/* Append
- *  append data to open blob
- *
- *  "buffer" [ IN ] and "size" [ IN ] - blob data
- */
-KDB_EXTERN rc_t CC KColumnBlobAppend ( KColumnBlob *self, const void *buffer, size_t size );
-
-
-/* Validate
- *  runs checksum validation on unmodified blob
- */
-KDB_EXTERN rc_t CC KColumnBlobValidate ( const KColumnBlob *self );
-
-
-/* IdRange
- * AssignRange
- *  access id range for blob
- *
- *  "first" [ OUT ] and  "count" [ OUT ] - return parameters for IdRange
-
- *  "first" [ IN ] and "count" [ IN ] - range parameters for assign
- */
-KDB_EXTERN rc_t CC KColumnBlobIdRange ( const KColumnBlob *self, int64_t *first, uint32_t *count );
-KDB_EXTERN rc_t CC KColumnBlobAssignRange ( KColumnBlob *self, int64_t first, uint32_t count );
-
-
-/* Commit
- *  commit changes to blob
- *  close to further updates
- */
-KDB_EXTERN rc_t CC KColumnBlobCommit ( KColumnBlob *self );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*  _h_kdb_column_ */
diff --git a/interfaces/kdb/consistency-check.h b/interfaces/kdb/consistency-check.h
deleted file mode 100644
index 18444e4..0000000
--- a/interfaces/kdb/consistency-check.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- *============================================================================
- *
- */
-
-#ifndef _h_kdb_consistency_check_
-#define _h_kdb_consistency_check_
-
-#ifndef _h_kdb_extern_
-#include <kdb/extern.h>
-#endif
-
-#ifndef _h_insdc_sra_
-#include <insdc/sra.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-    
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KDatabase;
-struct KTable;
-struct KColumn;
-
-
-/*--------------------------------------------------------------------------
- * CCReportTypes
- */
-enum
-{
-    ccrpt_Done,
-    ccrpt_MD5,
-    ccrpt_Blob,
-    ccrpt_Index,
-    ccrpt_Visit
-};
-
-
-/*--------------------------------------------------------------------------
- * CCReportInfoBlock
- */
-typedef struct CCReportInfoBlock CCReportInfoBlock;
-struct CCReportInfoBlock
-{
-    const char *objName;
-    uint32_t objId;
-    uint32_t objType;
-    uint32_t type;
-
-    union
-    {
-        struct /* ccrb_done_s */
-        {
-            const char *mesg;
-            rc_t rc;
-        } done;
-
-        struct ccrb_md5_s
-        {
-            const char *file;
-            rc_t rc;
-        } MD5;
-
-        struct ccrb_blob_s
-        {
-            uint64_t start;
-            uint64_t count;
-
-        } blob;
-
-        struct ccrb_index_s
-        {
-            int64_t start_id;
-            uint64_t id_range;
-            uint64_t num_keys;
-            uint64_t num_rows;
-            uint64_t num_holes;
-
-        } index;
-        
-        struct ccrb_visit_s {
-            unsigned depth;
-        } visit;
-    } info;
-};
-
-typedef rc_t ( CC *CCReportFunc ) ( const CCReportInfoBlock *info, void *data );
-
-/* a flag for level parameter */
-#define CC_INDEX_ONLY 0x80000000
-
-/*--------------------------------------------------------------------------
- * KDatabase
- */
-KDB_EXTERN rc_t CC KDatabaseConsistencyCheck ( struct KDatabase const *self,
-    uint32_t depth, uint32_t level, CCReportFunc report, void *data );
-
-
-/*--------------------------------------------------------------------------
- * KTable
- */
-KDB_EXTERN rc_t CC KTableConsistencyCheck ( struct KTable const *self,
-    uint32_t depth, uint32_t level, CCReportFunc report, void *data,
-    INSDC_SRA_platform_id platform);
-
-
-/*--------------------------------------------------------------------------
- * KColumn
- */
-KDB_EXTERN rc_t CC KColumnConsistencyCheck ( struct KColumn const *self,
-    uint32_t level, CCReportInfoBlock *info, CCReportFunc report, void *data );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kdb_consistency_check_ */
diff --git a/interfaces/kdb/database.h b/interfaces/kdb/database.h
deleted file mode 100644
index af65ebb..0000000
--- a/interfaces/kdb/database.h
+++ /dev/null
@@ -1,270 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kdb_database_
-#define _h_kdb_database_
-
-#ifndef _h_kdb_extern_
-#include <kdb/extern.h>
-#endif
-
-#ifndef _h_kfs_directory_
-#include <kfs/directory.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KDBManager;
-
-
-/*--------------------------------------------------------------------------
- * KDatabase
- *  opaque connection to a database within file system
- */
-typedef struct KDatabase KDatabase;
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-KDB_EXTERN rc_t CC KDatabaseAddRef ( const KDatabase *self );
-KDB_EXTERN rc_t CC KDatabaseRelease ( const KDatabase *self );
-
-
-/* CreateDB
- * VCreateDB
- *  create a new or open an existing database
- *
- *  "db" [ OUT ] - return parameter for newly opened database
- *
- *  "cmode" [ IN ] - creation mode
- *
- *  "path" [ IN ] - NUL terminated string in
- *  wd-native character set giving path to database
- */
-KDB_EXTERN rc_t CC KDBManagerCreateDB ( struct KDBManager *self,
-    KDatabase **db, KCreateMode cmode, const char *path, ... );
-KDB_EXTERN rc_t CC KDatabaseCreateDB ( KDatabase *self,
-    KDatabase **db, KCreateMode cmode, const char *name, ... );
-
-KDB_EXTERN rc_t CC KDBManagerVCreateDB ( struct KDBManager *self,
-    KDatabase **db, KCreateMode cmode, const char *path, va_list args );
-KDB_EXTERN rc_t CC KDatabaseVCreateDB ( KDatabase *self,
-    KDatabase **db, KCreateMode cmode, const char *name, va_list args );
-
-
-/* OpenDBRead
- * VOpenDBRead
- *  open a database for read
- *
- *  "db" [ OUT ] - return parameter for newly opened database
- *
- *  "path" [ IN ] - NUL terminated string in
- *  wd-native character set giving path to database
- */
-KDB_EXTERN rc_t CC KDBManagerOpenDBRead ( struct KDBManager const *self,
-    const KDatabase **db, const char *path, ... );
-KDB_EXTERN rc_t CC KDatabaseOpenDBRead ( const KDatabase *self,
-    const KDatabase **db, const char *name, ... );
-
-KDB_EXTERN rc_t CC KDBManagerVOpenDBRead ( struct KDBManager const *self,
-    const KDatabase **db, const char *path, va_list args );
-KDB_EXTERN rc_t CC KDatabaseVOpenDBRead ( const KDatabase *self,
-    const KDatabase **db, const char *name, va_list args );
-
-
-/* OpenDBUpdate
- * VOpenDBUpdate
- *  open a database for read/write
- *
- *  "db" [ OUT ] - return parameter for newly opened database
- *
- *  "path" [ IN ] - NUL terminated string in
- *  wd-native character set giving path to database
- */
-KDB_EXTERN rc_t CC KDBManagerOpenDBUpdate ( struct KDBManager *self,
-    KDatabase **db, const char *path, ... );
-KDB_EXTERN rc_t CC KDatabaseOpenDBUpdate ( KDatabase *self,
-    KDatabase **db, const char *name, ... );
-
-KDB_EXTERN rc_t CC KDBManagerVOpenDBUpdate ( struct KDBManager *self,
-    KDatabase **db, const char *path, va_list args );
-KDB_EXTERN rc_t CC KDatabaseVOpenDBUpdate ( KDatabase *self,
-    KDatabase **db, const char *name, va_list args );
-
-
-/* Locked
- *  returns true if locked
- */
-KDB_EXTERN bool CC KDatabaseLocked ( const KDatabase *self );
-
-
-/* Exists
- *  returns true if requested object exists
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptDatabase, kptTable and kptIndex
- *
- *  "name" [ IN ] - NUL terminated object name
- */
-KDB_EXTERN bool CC KDatabaseExists ( const KDatabase *self, uint32_t type,
-    const char *name, ... );
-KDB_EXTERN bool CC KDatabaseVExists ( const KDatabase *self, uint32_t type,
-    const char *name, va_list args );
-
-/* IsAlias
- *  returns true if object name is an alias
- *  returns path to fundamental name if it was aliased
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptDatabase, kptTable and kptIndex
- *
- *  "resolved" [ OUT ] and "rsize" [ IN ] - optional output buffer
- *  for fundamenta object name if "alias" is not a fundamental name, 
- *
- *  "name" [ IN ] - NUL terminated object name
- */
-KDB_EXTERN bool CC KDatabaseIsAlias ( const KDatabase *self, uint32_t type,
-    char *resolved, size_t rsize, const char *name );
-
-/* Writable
- *  returns 0 if object is writable
- *  or a reason why if not
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptDatabase, kptTable and kptIndex
- *
- *  "path" [ IN ] - NUL terminated path
- */
-KDB_EXTERN rc_t CC KDatabaseWritable ( const KDatabase *self, uint32_t type,
-    const char *name, ... );
-KDB_EXTERN rc_t CC KDatabaseVWritable ( const KDatabase *self, uint32_t type,
-    const char *name, va_list args );
-
-/* Lock
- *  apply lock
- *
- *  if object is already locked, the operation is idempotent
- *  and returns an rc state of rcLocked
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptDatabase, kptTable and kptIndex
- *
- *  "path" [ IN ] - NUL terminated path
- */
-KDB_EXTERN rc_t CC KDatabaseLock ( KDatabase *self, uint32_t type,
-    const char *name, ... );
-KDB_EXTERN rc_t CC KDatabaseVLock ( KDatabase *self, uint32_t type,
-    const char *name, va_list args );
-
-/* Unlock
- *  remove lock
- *
- *  if object is already unlocked, the operation is idempotent
- *  and returns an rc state of rcUnlocked
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptDatabase, kptTable and kptIndex
- *
- *  "path" [ IN ] - NUL terminated path
- */
-KDB_EXTERN rc_t CC KDatabaseUnlock ( KDatabase *self, uint32_t type,
-    const char *name, ... );
-KDB_EXTERN rc_t CC KDatabaseVUnlock ( KDatabase *self, uint32_t type,
-    const char *name, va_list args );
-
-
-/* Rename
- *  renames a contained object
- *
- *  "from" [ IN ] - NUL terminated string in UTF-8
- *  giving name of contained object
- *
- *  "to" [ IN ] - NUL terminated string in UTF-8
- *  giving new name
- */
-KDB_EXTERN rc_t CC KDatabaseRenameDB ( KDatabase *self, bool force, const char *from, const char *to );
-KDB_EXTERN rc_t CC KDatabaseRenameTable ( KDatabase *self, bool force, const char *from, const char *to );
-KDB_EXTERN rc_t CC KDatabaseRenameIndex ( KDatabase *self, bool force, const char *from, const char *to );
-
-
-/* Alias
- *  create an alias to an existing contained object
- *
- *  "obj" [ IN ] - NUL terminated string in UTF-8
- *  giving name of contained object
- *
- *  "alias" [ IN ] - NUL terminated string in UTF-8
- *  giving aliased name
- */
-KDB_EXTERN rc_t CC KDatabaseAliasDB ( KDatabase *self, const char *obj, const char *alias );
-KDB_EXTERN rc_t CC KDatabaseAliasTable ( KDatabase *self, const char *obj, const char *alias );
-KDB_EXTERN rc_t CC KDatabaseAliasIndex ( KDatabase *self, const char *obj, const char *alias );
-
-
-/* Drop
- *  drop a contained object
- *
- *  "name" [ IN ] - NUL terminated string in UTF-8 giving name of db
- */
-KDB_EXTERN rc_t CC KDatabaseDropDB ( KDatabase *self, const char *name, ... );
-KDB_EXTERN rc_t CC KDatabaseDropTable ( KDatabase *self, const char *name, ... );
-KDB_EXTERN rc_t CC KDatabaseDropIndex ( KDatabase *self, const char *name, ... );
-
-KDB_EXTERN rc_t CC KDatabaseVDropDB ( KDatabase *self, const char *name, va_list args );
-KDB_EXTERN rc_t CC KDatabaseVDropTable ( KDatabase *self, const char *name, va_list args );
-KDB_EXTERN rc_t CC KDatabaseVDropIndex ( KDatabase *self, const char *name, va_list args );
-
-
-/* OpenManager
- *  duplicate reference to manager
- *  NB - returned reference must be released
- */
-KDB_EXTERN rc_t CC KDatabaseOpenManagerRead ( const KDatabase *self, struct KDBManager const **mgr );
-KDB_EXTERN rc_t CC KDatabaseOpenManagerUpdate ( KDatabase *self, struct KDBManager **mgr );
-
-
-/* OpenParent
- *  duplicate reference to parent database
- *  NB - returned reference must be released
- */
-KDB_EXTERN rc_t CC KDatabaseOpenParentRead ( const KDatabase *self, const KDatabase **par );
-KDB_EXTERN rc_t CC KDatabaseOpenParentUpdate ( KDatabase *self, KDatabase **par );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kdb_database_ */
diff --git a/interfaces/kdb/extern.h b/interfaces/kdb/extern.h
deleted file mode 100644
index 2f8e0d0..0000000
--- a/interfaces/kdb/extern.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kdb_extern_
-#define _h_kdb_extern_
-
-#if ! defined EXPORT_LATCH && defined _LIBRARY
-#define KDB_EXTERN LIB_EXPORT
-#define EXPORT_LATCH 1
-#else
-#define KDB_EXTERN LIB_IMPORT
-#endif
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#endif /* _h_kdb_extern_ */
diff --git a/interfaces/kdb/index.h b/interfaces/kdb/index.h
deleted file mode 100644
index 3a36bc3..0000000
--- a/interfaces/kdb/index.h
+++ /dev/null
@@ -1,309 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kdb_index_
-#define _h_kdb_index_
-
-#ifndef _h_kdb_extern_
-#include <kdb/extern.h>
-#endif
-
-#ifndef _h_kfs_directory_
-#include <kfs/directory.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KTable;
-struct PBSTNode;
-struct KDatabase;
-
-
-/*--------------------------------------------------------------------------
- * KIdxType
- *  the type of index being dealt with
- */
-typedef uint8_t KIdxType;
-enum
-{
-    /* version 1 */
-
-    kitText,          /* text string => id */
-    kitU64,           /* uint64 (like file offset) to row id */
-
-    kitProj = 128     /* reverse index flag, row id => key */
-};
-
-
-/*--------------------------------------------------------------------------
- * KIndex
- *  an object capable of mapping an object to integer oid
- */
-typedef struct KIndex KIndex;
-
-
-/* Addref
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-KDB_EXTERN rc_t CC KIndexAddRef ( const KIndex *self );
-KDB_EXTERN rc_t CC KIndexRelease ( const KIndex *self );
-
-
-/* CreateIndex
- * VCreateIndex
- *  create a new or open an existing index
- *
- *  "idx" [ OUT ] - return parameter for newly opened index
- *
- *  "type" [ IN ] - type of index to create
- *
- *  "cmode" [ IN ] - creation mode
- *
- *  "name" [ IN ] - NUL terminated string in UTF-8 giving simple name of idx
- */
-KDB_EXTERN rc_t CC KDatabaseCreateIndex ( struct KDatabase *self, KIndex **idx,
-    KIdxType type, KCreateMode cmode, const char *name, ... );
-KDB_EXTERN rc_t CC KTableCreateIndex ( struct KTable *self, KIndex **idx,
-    KIdxType type, KCreateMode cmode, const char *name, ... );
-
-KDB_EXTERN rc_t CC KDatabaseVCreateIndex ( struct KDatabase *self, KIndex **idx,
-    KIdxType type, KCreateMode cmode, const char *name, va_list args );
-KDB_EXTERN rc_t CC KTableVCreateIndex ( struct KTable *self, KIndex **idx,
-    KIdxType type, KCreateMode cmode, const char *name, va_list args );
-
-
-/* OpenIndexRead
- * VOpenIndexRead
- *  open an index for read
- *
- *  "idx" [ OUT ] - return parameter for newly opened index
- *
- *  "name" [ IN ] - NUL terminated string in UTF-8 giving simple name of idx
- */
-KDB_EXTERN rc_t CC KDatabaseOpenIndexRead ( struct KDatabase const *self,
-    const KIndex **idx, const char *name, ... );
-KDB_EXTERN rc_t CC KTableOpenIndexRead ( struct KTable const *self,
-    const KIndex **idx, const char *name, ... );
-
-KDB_EXTERN rc_t CC KDatabaseVOpenIndexRead ( struct KDatabase const *self,
-    const KIndex **idx, const char *name, va_list args );
-KDB_EXTERN rc_t CC KTableVOpenIndexRead ( struct KTable const *self,
-    const KIndex **idx, const char *name, va_list args );
-
-
-/* OpenIndexUpdate
- * VOpenIndexUpdate
- *  open an index for read/write
- *
- *  "idx" [ OUT ] - return parameter for newly opened index
- *
- *  "name" [ IN ] - NUL terminated string in UTF-8 giving simple name of idx
- */
-
-KDB_EXTERN rc_t CC KDatabaseOpenIndexUpdate ( struct KDatabase *self,
-    KIndex **idx, const char *name, ... );
-KDB_EXTERN rc_t CC KTableOpenIndexUpdate ( struct KTable *self,
-    KIndex **idx, const char *name, ... );
-
-KDB_EXTERN rc_t CC KDatabaseVOpenIndexUpdate ( struct KDatabase *self,
-    KIndex **idx, const char *name, va_list args );
-KDB_EXTERN rc_t CC KTableVOpenIndexUpdate ( struct KTable *self,
-    KIndex **idx, const char *name, va_list args );
-
-
-/* Locked
- *  returns true if locked
- */
-KDB_EXTERN bool CC KIndexLocked ( const KIndex *self );
-
-
-/* Version
- *  returns the format version
- */
-KDB_EXTERN rc_t CC KIndexVersion ( const KIndex *self, uint32_t *version );
-
-
-/* Type
- *  returns the type of index
- */
-KDB_EXTERN rc_t CC KIndexType ( const KIndex *self, KIdxType *type );
-
-
-/* Commit
- *  ensure any changes are committed to disk
- */
-KDB_EXTERN rc_t CC KIndexCommit ( KIndex *self );
-
-
-/* CheckConsistency
- *  run a consistency check on the open index
- *
- *  "level" [ IN ] - a measure of rigor of the exercise:
- *    0 is the lightest
- *    1 will test all id mappings
- *    2 will perform key->id retrievals
- *    3 will perform id->key retrievals if a projection index exists
- *
- *  "start_id" [ OUT, NULL OKAY ] - returns the first id in index
- *
- *  "id_range" [ OUT, NULL OKAY ] - returns the range of ids from first to last
- *
- *  "num_keys" [ OUT, NULL OKAY ] - returns the number of key entries
- *
- *  "num_rows" [ OUT, NULL OKAY ] - returns the number of key->id mappings
- *
- *  "num_holes" [ OUT, NULL OKAY ] - returns the number of holes in the mapped id range
- */
-KDB_EXTERN rc_t CC KIndexConsistencyCheck ( const KIndex *self, uint32_t level,
-    int64_t *start_id, uint64_t *id_range, uint64_t *num_keys,
-    uint64_t *num_rows, uint64_t *num_holes );
-
-
-/* Insert
- *  creates a mapping from key to id
- *  and potentially from id to key if supported
- *
- *  "unique" [ IN ] - if true, key must be unique
- *
- *  "key" [ IN ] - NUL terminated string for text
- *
- *  "id" [ IN ] - id
- */
-KDB_EXTERN rc_t CC KIndexInsertText ( KIndex *self, bool unique,
-    const char *key, int64_t id );
-
-/* Delete
- *  deletes all mappings from key
- */
-KDB_EXTERN rc_t CC KIndexDeleteText ( KIndex *self, const char *key );
-
-/* Find
- *  finds a single mapping from key
- *
- *  "key" [ IN ] - NUL terminated string to be found
- *
- *  "start_id" [ OUT ] - starting id of found range
- *
- *  "id_count [ OUT, NULL OKAY ] - the number of contiguous
- *  row ids in found range
- *
- *  "custom_cmp" [ IN, NULL OKAY ] and "data" [ IN, OPAQUE ]
- *  optional comparison function for search
- */
-KDB_EXTERN rc_t CC KIndexFindText ( const KIndex *self,
-    const char *key, int64_t *start_id, uint64_t *id_count,
-    int ( CC * custom_cmp ) ( const void *item,
-        struct PBSTNode const *n, void *data ),
-    void *data );
-
-/* FindAll
- *  finds all mappings from key
- */
-KDB_EXTERN rc_t CC KIndexFindAllText ( const KIndex *self, const char *key,
-    rc_t ( CC * f ) ( int64_t start_id, uint64_t id_count, void *data ),
-    void *data );
-
-/* Project
- *  finds key(s) mapping to value/id if supported
- *
- *  "id" [ IN ] - row id to be located
- *
- *  "start_id [ OUT, NULL OKAY ] - the first id of found range
- *
- *  "id_count [ OUT, NULL OKAY ] - the number of contiguous
- *  row ids in found range
- *
- *  "key" [ OUT ] and "kmax" [ IN ] - return buffer
- *  for NUL terminated index text
- *
- *  "actsize" [ OUT, NULL OKAY ] - returns key size in bytes,
- *   excluding NUL termination
- *
- *  returns rcBuffer, rcInsufficient
- *  if kmax <= strlen ( key )
- */
-KDB_EXTERN rc_t CC KIndexProjectText ( const KIndex *self,
-    int64_t id, int64_t *start_id, uint64_t *id_count,
-    char *key, size_t kmax, size_t *actsize );
-
-
-/* ProjectAll
- *  finds key(s) mapping to value/id if supported
- */
-KDB_EXTERN rc_t CC KIndexProjectAllText ( const KIndex *self, int64_t id,
-    rc_t ( CC * f ) ( int64_t start_id, uint64_t id_count, const char *key, void *data ),
-    void *data );
-
-
-/* InsertU64
- *  creates a mapping from an (file) offset range to an id range
- *
- *  "unique" [ IN ] - if true, key ranges cannot overlap
- *
- *  "key" [ IN ] - offset (in file)
- *
- *  "key_size" [ IN ] - size of chunk (in file)
- *
- *  "start_id" [ IN ] - starting id 
- *
- *  "id_count" [ IN ] - number of ids in chunk
- */
-KDB_EXTERN rc_t CC KIndexInsertU64 ( KIndex *self, bool unique,
-    uint64_t key, uint64_t key_size, int64_t start_id, uint64_t id_count );
-
-/* DeleteU64
- *  deletes all mappings from key
- */
-KDB_EXTERN rc_t CC KIndexDeleteU64 ( KIndex *self, uint64_t key );
-
-/* FindU64
- *  finds a FIRST chunk by offset with in file
- */
-KDB_EXTERN rc_t CC KIndexFindU64 ( const KIndex *self, uint64_t offset,
-    uint64_t *key, uint64_t *key_size, int64_t *start_id, uint64_t *id_count );
-
-/* FindAllU64
- *  Iterate through all chunks with an offset and call f() for each range
- */
-KDB_EXTERN rc_t CC KIndexFindAllU64 ( const KIndex *self, uint64_t offset,
-    rc_t ( CC * f ) ( uint64_t key, uint64_t key_size,
-        int64_t start_id, uint64_t id_count, void *data ),
-    void *data);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*  _h_kdb_index_ */
diff --git a/interfaces/kdb/kdb-priv.h b/interfaces/kdb/kdb-priv.h
deleted file mode 100644
index 3f81b34..0000000
--- a/interfaces/kdb/kdb-priv.h
+++ /dev/null
@@ -1,156 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kdb_kdb_priv_
-#define _h_kdb_kdb_priv_
-
-#ifndef _h_kdb_extern_
-#include <kdb/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#include <stdarg.h> /* va_list */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KDBManager;
-struct KDatabase;
-struct KTable;
-struct KIndex;
-struct KColumn;
-struct KMetadata;
-struct KDirectory;
-struct VFSManager;
-
-
-/*--------------------------------------------------------------------------
- * KDBManager
- */
-
-/* ModDate
- *  return a modification timestamp for table
- */
-KDB_EXTERN rc_t CC KDBManagerGetTableModDate ( struct KDBManager const *self,
-    KTime_t *mtime, const char *path, ... );
-KDB_EXTERN rc_t CC KDBManagerVGetTableModDate ( struct KDBManager const *self,
-    KTime_t *mtime, const char *path, va_list args );
-
-
-/* Make using custom VFSManager */
-KDB_EXTERN rc_t CC KDBManagerMakeReadWithVFSManager (
-    const struct KDBManager **mgrp, const struct KDirectory *wd,
-    struct VFSManager *vmanager );
-
-KDB_EXTERN rc_t CC KDBManagerGetVFSManager ( const struct KDBManager *self,
-    const struct VFSManager **vmanager );
-
-
-/*--------------------------------------------------------------------------
- * KDatabase
- */
-
-/* OpenDirectory
- *  access the directory in use
- */
-KDB_EXTERN rc_t CC KDatabaseOpenDirectoryRead ( struct KDatabase const *self, struct KDirectory const **dir );
-KDB_EXTERN rc_t CC KDatabaseOpenDirectoryUpdate ( struct KDatabase *self, struct KDirectory **dir );
-
-/* GetPath
- *  return the absolute path to DB
- */
-KDB_EXTERN rc_t CC KDatabaseGetPath ( struct KDatabase const *self,
-    const char **path );
-
-
-/*--------------------------------------------------------------------------
- * KTable
- */
-
-/* OpenDirectory
- *  access the directory in use
- */
-KDB_EXTERN rc_t CC KTableOpenDirectoryRead ( struct KTable const *self, struct KDirectory const **dir );
-KDB_EXTERN rc_t CC KTableOpenDirectoryUpdate ( struct KTable *self, struct KDirectory **dir );
-
-#define KTableGetDirectoryRead KTableOpenDirectoryRead
-#define KTableGetDirectoryUpdate KTableOpenDirectoryUpdate
-
-/* GetPath
- *  return the absolute path to table
- */
-KDB_EXTERN rc_t CC KTableGetPath ( struct KTable const *self,
-    const char **path );
-
-
-/*--------------------------------------------------------------------------
- * KColumn
- */
-
-/* OpenDirectory
- *  duplicate reference to the directory in use
- *  NB - returned reference must be released
- */
-KDB_EXTERN rc_t CC KColumnOpenDirectoryRead ( struct KColumn const *self, struct KDirectory const **dir );
-KDB_EXTERN rc_t CC KColumnOpenDirectoryUpdate ( struct KColumn *self, struct KDirectory **dir );
-
-#define KColumnGetDirectoryRead KColumnOpenDirectoryRead
-#define KColumnGetDirectoryUpdate KColumnOpenDirectoryUpdate
-
-
-
-/*--------------------------------------------------------------------------
- * KIndex
- */
-
-/* MarkModified
- *  make the index think it has been modified, such that it may be committed
- *  useful when forcing conversion from an older version
- */
-KDB_EXTERN rc_t CC KIndexMarkModified ( struct KIndex *self );
-
-
-/* SetMaxId
- *  certain legacy versions of skey were built to know only the starting id
- *  of the NAME_FMT column, but were never given a maximum id. allow them
- *  to be corrected here.
- */
-KDB_EXTERN void CC KIndexSetMaxRowId ( struct KIndex const *self, int64_t max_row_id );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*  _h_kdb_kdb_priv_ */
diff --git a/interfaces/kdb/manager.h b/interfaces/kdb/manager.h
deleted file mode 100644
index 48576a3..0000000
--- a/interfaces/kdb/manager.h
+++ /dev/null
@@ -1,182 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kdb_manager_
-#define _h_kdb_manager_
-
-#ifndef _h_kdb_extern_
-#include <kdb/extern.h>
-#endif
-
-/* #ifndef _h_kfs_directory_ */
-/* #include <kfs/directory.h> */
-/* #endif */
-#include <kfs/defs.h> /* kpt types */
-
-#include <stdarg.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct VPath;
-struct KDirectory;
-
-/*--------------------------------------------------------------------------
- * KDBPathType
- *  extends KPathType from <kfs/defs.h>
- */
-enum
-{
-    /* must be handled carefully and can not go back to KDirectory 
-     * as this value has a different meaning in KDirectory */
-    kptAny = 0,
-    kptDatabase = kptLastDefined,
-    kptTable,
-    kptIndex,
-    kptColumn,
-
-    /* these values may not be used in KDBManagerExists below */
-    kptMetadata,
-    kptPrereleaseTbl
-};
-
-
-/*--------------------------------------------------------------------------
- * KDBManager
- *  opaque handle to library
- */
-typedef struct KDBManager KDBManager;
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-KDB_EXTERN rc_t CC KDBManagerAddRef ( const KDBManager *self );
-KDB_EXTERN rc_t CC KDBManagerRelease ( const KDBManager *self );
-
-
-/* MakeRead
- * MakeUpdate
- *  create library handle for specific use
- *  NB - only one of the functions will be implemented
- *
- *  "wd" [ IN, NULL OKAY ] - optional working directory for
- *  accessing the file system. mgr will attach its own reference.
- */
-KDB_EXTERN rc_t CC KDBManagerMakeRead ( const KDBManager **mgr, const struct KDirectory *wd );
-KDB_EXTERN rc_t CC KDBManagerMakeUpdate ( KDBManager **mgr, struct KDirectory *wd );
-
-
-/* Version
- *  returns the library version
- */
-KDB_EXTERN rc_t CC KDBManagerVersion ( const KDBManager *self, uint32_t *version );
-
-
-/* Exists
- *  returns true if requested object exists
- *
- *  "type" [ IN ] - a KDBPathType
- *
- *  "path" [ IN ] - NUL terminated path
- *
- * DEPRECATED:
- * Should use KDBManagerPathType for reduced network thrashing.
- */
-KDB_EXTERN bool CC KDBManagerExists ( const KDBManager *self, uint32_t type,
-    const char *name, ... );
-KDB_EXTERN bool CC KDBManagerVExists ( const KDBManager *self, uint32_t type,
-    const char *name, va_list args );
-
-
-/* Writable
- *  returns 0 if object is writable
- *  or a reason why if not
- *
- *  "path" [ IN ] - NUL terminated path
- */
-KDB_EXTERN rc_t CC KDBManagerWritable ( const KDBManager *self,
-    const char *path, ... );
-KDB_EXTERN rc_t CC KDBManagerVWritable ( const KDBManager *self,
-    const char *path, va_list args );
-
-/* Lock
- *  apply lock
- *
- *  if object is already locked, the operation is idempotent
- *  and returns an rc state of rcLocked
- *
- *  "path" [ IN ] - NUL terminated path
- */
-KDB_EXTERN rc_t CC KDBManagerLock ( KDBManager *self, const char *path, ... );
-KDB_EXTERN rc_t CC KDBManagerVLock ( KDBManager *self, const char *path, va_list args );
-
-/* Unlock
- *  remove lock
- *
- *  if object is already unlocked, the operation is idempotent
- *  and returns an rc state of rcUnlocked
- *
- *  "path" [ IN ] - NUL terminated path
- */
-KDB_EXTERN rc_t CC KDBManagerUnlock ( KDBManager *self, const char *path, ... );
-KDB_EXTERN rc_t CC KDBManagerVUnlock ( KDBManager *self, const char *path, va_list args );
-
-
-/* Drop
- *  drop an object based on its path
- *
- *  "path" [ IN ] - NUL terminated string in UTF-8 giving path to the kdb object
- */
-KDB_EXTERN rc_t CC KDBManagerDrop ( KDBManager *self, uint32_t obj_type, const char *path, ... );
-KDB_EXTERN rc_t CC KDBManagerVDrop ( KDBManager *self, uint32_t obj_type, const char *path, va_list args );
-
-
-/* RunPeriodicTasks
- *  executes periodic tasks, such as cache flushing
- */
-KDB_EXTERN rc_t CC KDBManagerRunPeriodicTasks ( const KDBManager *self );
-
-
-/* PathType
- *  check the path type of an object/directory path.
- *  this is an extension of the KDirectoryPathType and will return
- *  the KDirectory values if a path type is not specifically a
- *  kdb object
- */
-KDB_EXTERN int CC KDBManagerPathTypeVP ( const KDBManager * self, const struct VPath * path );
-KDB_EXTERN int CC KDBManagerPathType   ( const KDBManager * self, const char *path, ... );
-KDB_EXTERN int CC KDBManagerVPathType  ( const KDBManager * self, const char *path, va_list args );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kdb_manager_ */
diff --git a/interfaces/kdb/meta.h b/interfaces/kdb/meta.h
deleted file mode 100644
index cee3ed7..0000000
--- a/interfaces/kdb/meta.h
+++ /dev/null
@@ -1,411 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kdb_meta_
-#define _h_kdb_meta_
-
-#ifndef _h_kdb_extern_
-#include <kdb/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#include <stdarg.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KTable;
-struct KColumn;
-struct KDatabase;
-
-
-/*--------------------------------------------------------------------------
- * KMetadata
- *  a versioned, hierarchical structure
- */
-typedef struct KMetadata KMetadata;
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-KDB_EXTERN rc_t CC KMetadataAddRef ( const KMetadata *self );
-KDB_EXTERN rc_t CC KMetadataRelease ( const KMetadata *self );
-
-
-/* OpenMetadataRead
- *  opens metadata for read
- *
- *  "meta" [ OUT ] - return parameter for metadata
- */
-KDB_EXTERN rc_t CC KDatabaseOpenMetadataRead ( struct KDatabase const *self,
-    const KMetadata **meta );
-KDB_EXTERN rc_t CC KTableOpenMetadataRead ( struct KTable const *self,
-    const KMetadata **meta );
-KDB_EXTERN rc_t CC KColumnOpenMetadataRead ( struct KColumn const *self,
-    const KMetadata **meta );
-
-/* OpenMetadataUpdate
- *  open metadata for read/write
- *
- *  "meta" [ OUT ] - return parameter for metadata
- */
-KDB_EXTERN rc_t CC KDatabaseOpenMetadataUpdate ( struct KDatabase *self,
-    KMetadata **meta );
-KDB_EXTERN rc_t CC KTableOpenMetadataUpdate ( struct KTable *self,
-    KMetadata **meta );
-KDB_EXTERN rc_t CC KColumnOpenMetadataUpdate ( struct KColumn *self,
-    KMetadata **meta );
-
-
-/* Version
- *  returns the metadata format version
- */
-KDB_EXTERN rc_t CC KMetadataVersion ( const KMetadata *self, uint32_t *version );
-
-
-/* ByteOrder
- *  indicates whether original byte order is reversed
- *  under current architecture.
- *
- *  the byte order of the column is established by
- *  the host architecture when created.
- *
- *  "reversed" [ OUT ] - if true, the original byte
- *  order is reversed with regard to host native byte order.
- */
-KDB_EXTERN rc_t CC KMetadataByteOrder ( const KMetadata *self, bool *reversed );
-
-
-/* Revision
- *  returns current revision number
- *  where 0 ( zero ) means tip
- */
-KDB_EXTERN rc_t CC KMetadataRevision ( const KMetadata *self, uint32_t *revision );
-
-
-/* MaxRevision
- *  returns the maximum revision available
- */
-KDB_EXTERN rc_t CC KMetadataMaxRevision ( const KMetadata *self, uint32_t *revision );
-
-
-/* Commit
- *  ensure any changes are committed to disk
- */
-KDB_EXTERN rc_t CC KMetadataCommit ( KMetadata *self );
-
-
-/* Freeze
- *  freezes current metadata revision
- *  further modification will begin on a copy
- */
-KDB_EXTERN rc_t CC KMetadataFreeze ( KMetadata *self );
-
-
-/* OpenRevision
- *  opens a read-only indexed revision of metadata
- */
-KDB_EXTERN rc_t CC KMetadataOpenRevision ( const KMetadata *self,
-    const KMetadata **meta, uint32_t revision );
-
-
-/* GetSequence
- * SetSequence
- * NextSequence
- *  access a named sequence
- *
- *  "seq" [ IN ] - NUL terminated sequence name
- *
- *  "val" [ OUT ] - return parameter for sequence value
- *  "val" [ IN ] - new sequence value
- */
-KDB_EXTERN rc_t CC KMetadataGetSequence ( const KMetadata *self,
-    const char *seq, int64_t *val );
-KDB_EXTERN rc_t CC KMetadataSetSequence ( KMetadata *self,
-    const char *seq, int64_t val );
-KDB_EXTERN rc_t CC KMetadataNextSequence ( KMetadata *self,
-    const char *seq, int64_t *val );
-
-
-/*--------------------------------------------------------------------------
- * KMDataNode
- *  a node with an optional value,
- *  optional attributes, and optional children
- *
- *  nodes are identified by path, relative to a starting node,
- *  where "/" serves as a path separator.
- */
-typedef struct KMDataNode KMDataNode;
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-KDB_EXTERN rc_t CC KMDataNodeAddRef ( const KMDataNode *self );
-KDB_EXTERN rc_t CC KMDataNodeRelease ( const KMDataNode *self );
-
-
-/* OpenNodeRead
- * VOpenNodeRead
- *  opens a metadata node
- *
- *  "node" [ OUT ] - return parameter for indicated metadata node
- *
- *  "path" [ IN, NULL OKAY ] - optional path for specifying named
- *  node within metadata hierarchy. paths will be interpreted as
- *  if they were file system paths, using '/' as separator. the
- *  special values NULL and "" are interpreted as "."
- */
-KDB_EXTERN rc_t CC KMetadataOpenNodeRead ( const KMetadata *self,
-    const KMDataNode **node, const char *path, ... );
-KDB_EXTERN rc_t CC KMDataNodeOpenNodeRead ( const KMDataNode *self,
-    const KMDataNode **node, const char *path, ... );
-
-KDB_EXTERN rc_t CC KMetadataVOpenNodeRead ( const KMetadata *self,
-    const KMDataNode **node, const char *path, va_list args );
-KDB_EXTERN rc_t CC KMDataNodeVOpenNodeRead ( const KMDataNode *self,
-    const KMDataNode **node, const char *path, va_list args );
-
-
-/* OpenNodeUpdate
- * VOpenNodeUpdate
- *  opens a metadata node
- *
- *  "node" [ OUT ] - return parameter for indicated metadata node
- *
- *  "path" [ IN, NULL OKAY ] - optional path for specifying named
- *  node within metadata hierarchy. paths will be interpreted as
- *  if they were file system paths, using '/' as separator. the
- *  special values NULL and "" are interpreted as "."
- */
-KDB_EXTERN rc_t CC KMetadataOpenNodeUpdate ( KMetadata *self,
-    KMDataNode **node, const char *path, ... );
-KDB_EXTERN rc_t CC KMDataNodeOpenNodeUpdate ( KMDataNode *self,
-    KMDataNode **node, const char *path, ... );
-
-KDB_EXTERN rc_t CC KMetadataVOpenNodeUpdate ( KMetadata *self,
-    KMDataNode **node, const char *path, va_list args );
-KDB_EXTERN rc_t CC KMDataNodeVOpenNodeUpdate ( KMDataNode *self,
-    KMDataNode **node, const char *path, va_list args );
-
-
-/* ByteOrder
- *  indicates whether original byte order is reversed
- *  under current architecture.
- *
- *  the byte order of the column is established by
- *  the host architecture when created.
- *
- *  "reversed" [ OUT ] - if true, the original byte
- *  order is reversed with regard to host native byte order.
- */
-KDB_EXTERN rc_t CC KMDataNodeByteOrder ( const KMDataNode *self, bool *reversed );
-
-
-/* Read
- *  read a node value
- *
- *  "offset" [ IN ] - initial offset into metadata
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT ] - number of bytes actually read
- *
- *  "remaining" [ OUT, NULL OKAY ] - optional return parameter for
- *  the number of bytes remaining to be read.
- *  specifically, "offset" + "num_read" + "remaining" == sizeof node data
- */
-KDB_EXTERN rc_t CC KMDataNodeRead ( const KMDataNode *self,
-    size_t offset, void *buffer, size_t bsize,
-    size_t *num_read, size_t *remaining );
-
-
-/* Write
- *  write a node value or attribute
- *  overwrites anything already there
- *
- *  "buffer" [ IN ] and "size" [ IN ] - new value data
- */
-KDB_EXTERN rc_t CC KMDataNodeWrite ( KMDataNode *self, const void *buffer, size_t size );
-
-
-/* Append
- *  append data to value
- *
- *  "buffer" [ IN ] and "size" [ IN ] - value data to be appended
- */
-KDB_EXTERN rc_t CC KMDataNodeAppend ( KMDataNode *self, const void *buffer, size_t size );
-
-
-/* Read ( formatted )
- *  reads as integer or float value in native byte order
- *
- *  "bXX" [ OUT ] - return parameter for numeric value
- */
-KDB_EXTERN rc_t CC KMDataNodeReadB8 ( const KMDataNode *self, void *b8 );
-KDB_EXTERN rc_t CC KMDataNodeReadB16 ( const KMDataNode *self, void *b16 );
-KDB_EXTERN rc_t CC KMDataNodeReadB32 ( const KMDataNode *self, void *b32 );
-KDB_EXTERN rc_t CC KMDataNodeReadB64 ( const KMDataNode *self, void *b64 );
-KDB_EXTERN rc_t CC KMDataNodeReadB128 ( const KMDataNode *self, void *b128 );
-
-
-/* ReadAs ( formatted )
- *  reads as integer or float value in native byte order
- *  casts smaller-sized values to desired size, e.g.
- *    uint32_t to uint64_t
- *
- *  "i" [ OUT ] - return parameter for signed integer
- *  "u" [ OUT ] - return parameter for unsigned integer
- *  "f" [ OUT ] - return parameter for double float
- */
-KDB_EXTERN rc_t CC KMDataNodeReadAsI16 ( const KMDataNode *self, int16_t *i );
-KDB_EXTERN rc_t CC KMDataNodeReadAsU16 ( const KMDataNode *self, uint16_t *u );
-KDB_EXTERN rc_t CC KMDataNodeReadAsI32 ( const KMDataNode *self, int32_t *i );
-KDB_EXTERN rc_t CC KMDataNodeReadAsU32 ( const KMDataNode *self, uint32_t *u );
-KDB_EXTERN rc_t CC KMDataNodeReadAsI64 ( const KMDataNode *self, int64_t *i );
-KDB_EXTERN rc_t CC KMDataNodeReadAsU64 ( const KMDataNode *self, uint64_t *u );
-KDB_EXTERN rc_t CC KMDataNodeReadAsF64 ( const KMDataNode *self, double *f );
-
-
-/* Read ( formatted )
- *  reads as C-string
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - output buffer for
- *  NUL terminated string.
- *
- *  "size" [ OUT ] - return parameter giving size of string
- *  not including NUL byte. the size is set both upon success
- *  and insufficient buffer space error.
- */
-KDB_EXTERN rc_t CC KMDataNodeReadCString ( const KMDataNode *self,
-    char *buffer, size_t bsize, size_t *size );
-
-
-/* Write ( formatted )
- *  writes integer or float value in metadata byte order
- *
- *  "bXX" [ IN ] - numeric value
- */
-KDB_EXTERN rc_t CC KMDataNodeWriteB8 ( KMDataNode *self, const void *b8 );
-KDB_EXTERN rc_t CC KMDataNodeWriteB16 ( KMDataNode *self, const void *b16 );
-KDB_EXTERN rc_t CC KMDataNodeWriteB32 ( KMDataNode *self, const void *b32 );
-KDB_EXTERN rc_t CC KMDataNodeWriteB64 ( KMDataNode *self, const void *b64 );
-KDB_EXTERN rc_t CC KMDataNodeWriteB128 ( KMDataNode *self, const void *b128 );
-
-
-/* Write ( formatted )
- *  writes string
- *
- *  "str" [ IN ] - NUL terminated string.
- */
-KDB_EXTERN rc_t CC KMDataNodeWriteCString ( KMDataNode *self, const char *str );
-
-
-/* ReadAttr
- *  reads as NUL-terminated string
- *
- *  "name" [ IN ] - NUL terminated attribute name
- *
- *  "buffer" [ OUT ] and "bsize" - return parameter for attribute value
- *
- *  "size" [ OUT ] - return parameter giving size of string
- *  not including NUL byte. the size is set both upon success
- *  and insufficient buffer space error.
- */
-KDB_EXTERN rc_t CC KMDataNodeReadAttr ( const KMDataNode *self, const char *name,
-    char *buffer, size_t bsize, size_t *size );
-
-
-/* WriteAttr
- *  writes NUL-terminated string
- *
- *  "name" [ IN ] - NUL terminated attribute name
- *
- *  "value" [ IN ] - NUL terminated attribute value
- */
-KDB_EXTERN rc_t CC KMDataNodeWriteAttr ( KMDataNode *self,
-    const char *name, const char *value );
-
-
-/* ReadAttrAs ( formatted )
- *  reads as integer or float value in native byte order
- *  casts smaller-sized values to desired size, e.g.
- *    uint32_t to uint64_t
- *
- *  "i" [ OUT ] - return parameter for signed integer
- *  "u" [ OUT ] - return parameter for unsigned integer
- *  "f" [ OUT ] - return parameter for double float
- */
-KDB_EXTERN rc_t CC KMDataNodeReadAttrAsI16 ( const KMDataNode *self, const char *attr, int16_t *i );
-KDB_EXTERN rc_t CC KMDataNodeReadAttrAsU16 ( const KMDataNode *self, const char *attr, uint16_t *u );
-KDB_EXTERN rc_t CC KMDataNodeReadAttrAsI32 ( const KMDataNode *self, const char *attr, int32_t *i );
-KDB_EXTERN rc_t CC KMDataNodeReadAttrAsU32 ( const KMDataNode *self, const char *attr, uint32_t *u );
-KDB_EXTERN rc_t CC KMDataNodeReadAttrAsI64 ( const KMDataNode *self, const char *attr, int64_t *i );
-KDB_EXTERN rc_t CC KMDataNodeReadAttrAsU64 ( const KMDataNode *self, const char *attr, uint64_t *u );
-KDB_EXTERN rc_t CC KMDataNodeReadAttrAsF64 ( const KMDataNode *self, const char *attr, double *f );
-
-
-/* Drop
- * VDrop
- *  drop some or all node content
- */
-KDB_EXTERN rc_t CC KMDataNodeDropAll ( KMDataNode *self );
-KDB_EXTERN rc_t CC KMDataNodeDropAttr ( KMDataNode *self, const char *attr );
-KDB_EXTERN rc_t CC KMDataNodeDropChild ( KMDataNode *self, const char *path, ... );
-KDB_EXTERN rc_t CC KMDataNodeVDropChild ( KMDataNode *self, const char *path, va_list args );
-
-
-/* Rename
- *  renames a contained object
- *
- *  "from" [ IN ] - NUL terminated string in UTF-8
- *  giving simple name of existing attr
- *
- *  "to" [ IN ] - NUL terminated string in UTF-8
- *  giving new simple attr name
- */
-KDB_EXTERN rc_t CC KMDataNodeRenameAttr ( KMDataNode *self, const char *from, const char *to );
-KDB_EXTERN rc_t CC KMDataNodeRenameChild ( KMDataNode *self, const char *from, const char *to );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*  _h_kdb_meta_ */
diff --git a/interfaces/kdb/meta.hpp b/interfaces/kdb/meta.hpp
deleted file mode 100644
index ca2d9a9..0000000
--- a/interfaces/kdb/meta.hpp
+++ /dev/null
@@ -1,487 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _hpp_kdb_meta_
-#define _hpp_kdb_meta_
-
-#ifndef _h_kdb_meta_
-#include <kdb/meta.h>
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KMetadata
- *  a versioned, hierarchical structure
- */
-struct KMetadata
-{
-    /* AddRef
-     * Release
-     *  all objects are reference counted
-     *  NULL references are ignored
-     */
-    inline rc_t AddRef () const throw()
-    { return KMetadataAddRef ( this ); }
-
-    inline rc_t Release () const  throw()
-    { return KMetadataRelease ( this ); }
-
-
-    /* OpenNodeRead
-     *  opens a metadata node
-     *
-     *  "node" [ OUT ] - return parameter for indicated metadata node
-     *
-     *  "path" [ IN, NULL OKAY ] - optional path for specifying named
-     *  node within metadata hierarchy. paths will be interpreted as
-     *  if they were file system paths, using '/' as separator. the
-     *  special values NULL and "" are interpreted as "."
-     */
-    inline rc_t OpenNodeRead ( const KMDataNode **node, 
-        const char *path, ... ) const throw()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = KMetadataVOpenNodeRead ( this, node, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t OpenNodeRead ( const KMDataNode **node, 
-        const char *path, va_list args ) const throw()
-    { return KMetadataVOpenNodeRead ( this, node, path, args ); }
-
-
-    /* OpenNodeUpdate
-     *  opens a metadata node
-     *
-     *  "node" [ OUT ] - return parameter for indicated metadata node
-     *
-     *  "path" [ IN, NULL OKAY ] - optional path for specifying named
-     *  node within metadata hierarchy. paths will be interpreted as
-     *  if they were file system paths, using '/' as separator. the
-     *  special values NULL and "" are interpreted as "."
-     */
-    inline rc_t OpenNodeUpdate ( KMDataNode **node, 
-        const char *path, ... ) throw()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = KMetadataVOpenNodeUpdate ( this, node, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t OpenNodeUpdate ( KMDataNode **node, 
-        const char *path, va_list args ) throw()
-    { return KMetadataVOpenNodeUpdate ( this, node, path, args ); }
-
-
-    /* Version
-     *  returns the metadata format version
-     */
-    inline rc_t Version ( uint32_t *version ) const  throw()
-    { return KMetadataVersion ( this, version ); }
-
-
-    /* ByteOrder
-     *  indicates whether original byte order is reversed
-     *  under current architecture.
-     *
-     *  the byte order of the column is established by
-     *  the host architecture when created.
-     *
-     *  "reversed" [ OUT ] - if true, the original byte
-     *  order is reversed with regard to host native byte order.
-     */
-    inline rc_t ByteOrder ( bool *reversed ) const throw()
-    { return KMetadataByteOrder ( this, reversed ); }
-
-
-    /* Revision
-     *  returns current revision number
-     *  where 0 ( zero ) means tip
-     */
-    inline rc_t Revision ( uint32_t *revision ) const throw()
-    { return KMetadataRevision ( this, revision ); }
-
-
-    /* MaxRevision
-     *  returns the maximum revision available
-     */
-    inline rc_t MaxRevision ( uint32_t *revision ) const throw()
-    { return KMetadataMaxRevision ( this, revision ); }
-
-
-    /* Commit
-     *  ensure any changes are committed to disk
-     */
-    inline rc_t Commit () throw()
-    { return KMetadataCommit ( this ); }
-
-
-    /* Freeze
-     *  freezes current metadata revision
-     *  further modification will begin on a copy
-     */
-    inline rc_t Freeze () throw()
-    { return KMetadataFreeze ( this ); }
-
-
-    /* OpenRevision
-     *  opens a read-only indexed revision of metadata
-     */
-    inline rc_t OpenRevision ( const KMetadata **meta, uint32_t revision ) const throw()
-    { return KMetadataOpenRevision ( this, meta, revision ); }
-
-
-    /* GetSequence
-     * SetSequence
-     * NextSequence
-     *  access a named sequence
-     *
-     *  "seq" [ IN ] - NUL terminated sequence name
-     *
-     *  "val" [ OUT ] - return parameter for sequence value
-     *  "val" [ IN ] - new sequence value
-     */
-    inline rc_t GetSequence ( const char *seq, int64_t *val ) const throw()
-    { return KMetadataGetSequence ( this, seq, val ); }
-
-    inline rc_t SetSequence ( const char *seq, int64_t val ) throw()
-    { return KMetadataSetSequence ( this, seq, val ); }
-
-    inline rc_t NextSequence ( const char *seq, int64_t *val ) throw()
-    { return KMetadataNextSequence ( this, seq, val ); }
-
-private:
-    KMetadata ();
-    ~ KMetadata ();
-    KMetadata ( const KMetadata& );
-    KMetadata &operator = ( const KMetadata& );
-
-};
-
-
-/*--------------------------------------------------------------------------
- * KMDataNode
- *  a node with an optional value,
- *  optional attributes, and optional children
- *
- *  nodes are identified by path, relative to a starting node,
- *  where "/" serves as a path separator.
- */
-struct KMDataNode
-{
-    /* AddRef
-     * Release
-     *  ignores NULL references
-     */
-    inline rc_t AddRef () const  throw()
-    { return KMDataNodeAddRef ( this ); }
-
-    inline rc_t Release () const  throw()
-    { return KMDataNodeRelease ( this ); }
-
-
-    /* OpenNodeRead
-     * VOpenNodeRead
-     *  opens a metadata node
-     *
-     *  "node" [ OUT ] - return parameter for indicated metadata node
-     *
-     *  "path" [ IN, NULL OKAY ] - optional path for specifying named
-     *  node within metadata hierarchy. paths will be interpreted as
-     *  if they were file system paths, using '/' as separator. the
-     *  special values NULL and "" are interpreted as "."
-     */
-    inline rc_t OpenNodeRead ( const KMDataNode **node,
-        const char *path, ... ) const throw()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = KMDataNodeVOpenNodeRead ( this, node, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t OpenNodeRead ( const KMDataNode **node,
-        const char *path, va_list args ) const throw()
-    { return KMDataNodeVOpenNodeRead ( this, node, path, args ); }
-
-
-    /* OpenNodeUpdate
-     * VOpenNodeUpdate
-     *  opens a metadata node
-     *
-     *  "node" [ OUT ] - return parameter for indicated metadata node
-     *
-     *  "path" [ IN, NULL OKAY ] - optional path for specifying named
-     *  node within metadata hierarchy. paths will be interpreted as
-     *  if they were file system paths, using '/' as separator. the
-     *  special values NULL and "" are interpreted as "."
-     */
-    inline rc_t OpenNodeUpdate ( KMDataNode **node,
-        const char *path, ... ) throw()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = KMDataNodeVOpenNodeUpdate ( this, node, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t OpenNodeUpdate ( KMDataNode **node,
-        const char *path, va_list args ) throw()
-    { return KMDataNodeVOpenNodeUpdate ( this, node, path, args ); }
-
-
-    /* ByteOrder
-     *  indicates whether original byte order is reversed
-     *  under current architecture.
-     *
-     *  the byte order of the column is established by
-     *  the host architecture when created.
-     *
-     *  "reversed" [ OUT ] - if true, the original byte
-     *  order is reversed with regard to host native byte order.
-     */
-     inline rc_t ByteOrder ( bool *reversed ) const throw()
-     { return KMDataNodeByteOrder ( this, reversed ); }
-
-
-    /* Write
-     *  write a node value or attribute
-     *  overwrites anything already there
-     *
-     *  "buffer" [ IN ] and "size" [ IN ] - new value data
-     */
-     inline rc_t Write ( const void *buffer, size_t size ) throw()
-     { return KMDataNodeWrite ( this, buffer, size ); }
-
-
-     /* Append
-      *  append data to value
-      *
-      *  "buffer" [ IN ] and "size" [ IN ] - value data to be appended
-      */
-     inline rc_t Append ( const void *buffer, size_t size ) throw()
-     { return KMDataNodeAppend ( this, buffer, size ); }
-
-
-    /* Read ( formatted )
-     *  reads as integer or float value in native byte order
-     *
-     *  "bXX" [ OUT ] - return parameter for numeric value
-     */
-     inline rc_t ReadB8 ( void *b8 ) const throw()
-     { return KMDataNodeReadB8 ( this, b8 ); }
-     inline rc_t ReadB16 ( void *b16 ) const throw()
-     { return KMDataNodeReadB16 ( this, b16 ); }
-     inline rc_t ReadB32 ( void *b32 ) const throw()
-     { return KMDataNodeReadB32 ( this, b32 ); }
-     inline rc_t ReadB64 ( void *b64 ) const throw()
-     { return KMDataNodeReadB64 ( this, b64 ); }
-     inline rc_t ReadB128 ( void *b128 ) const throw()
-     { return KMDataNodeReadB128 ( this, b128 ); }
-
-
-    /* Read
-     *  read a node value
-     *
-     *  "offset" [ IN ] - initial offset into metadata
-     *
-     *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
-     *
-     *  "num_read" [ OUT ] - number of bytes actually read
-     *
-     *  "remaining" [ OUT, NULL OKAY ] - optional return parameter for
-     *  the number of bytes remaining to be read.
-     *  specifically, "offset" + "num_read" + "remaining" == sizeof node data
-     */
-     inline rc_t Read ( size_t offset, void *buffer, size_t bsize,
-        size_t *num_read, size_t *remaining ) const throw()
-     { return KMDataNodeRead ( this, offset, buffer, bsize, num_read, remaining ); }
-
-
-    /* Read ( formatted )
-     *  reads as integer or float value in native byte order
-     *  casts smaller-sized values to desired size, e.g.
-     *    uint32_t to uint64_t
-     *
-     *  "i" [ OUT ] - return parameter for signed integer
-     *  "u" [ OUT ] - return parameter for unsigned integer
-     *  "f" [ OUT ] - return parameter for double float
-     */
-     inline rc_t Read ( int16_t *value ) const  throw()
-    { return KMDataNodeReadAsI16 ( this, value ); }
-     inline rc_t Read ( uint16_t *value ) const  throw()
-    { return KMDataNodeReadAsU16 ( this, value ); }
-
-     inline rc_t Read ( int32_t *value ) const  throw()
-    { return KMDataNodeReadAsI32 ( this, value ); }
-     inline rc_t Read ( uint32_t *value ) const  throw()
-    { return KMDataNodeReadAsU32 ( this, value ); }
-
-    inline rc_t Read ( int64_t *value ) const  throw()
-    { return KMDataNodeReadAsI64 ( this, value ); }
-    inline rc_t Read ( uint64_t *value ) const  throw()
-    { return KMDataNodeReadAsU64 ( this, value ); }
-
-    inline rc_t Read ( double *value ) const  throw()
-    { return KMDataNodeReadAsF64 ( this, value ); }
-
-
-    /* Read ( formatted )
-     *  reads as C-string
-     *
-     *  "buffer" [ OUT ] and "bsize" [ IN ] - output buffer for
-     *  NUL terminated string.
-     *
-     *  "size" [ OUT ] - return parameter giving size of string
-     *  not including NUL byte. the size is set both upon success
-     *  and insufficient buffer space error.
-     */
-    inline rc_t Read ( char *buffer, size_t bsize, size_t *size ) const  throw()
-    { return KMDataNodeReadCString ( this, buffer, bsize, size ); }
-
-
-    /* Write ( formatted )
-     *  writes integer or float value in metadata byte order
-     *
-     *  "bXX" [ IN ] - numeric value
-     */
-     inline rc_t WriteB8 ( const void *b8 ) throw()
-     { return KMDataNodeWriteB8 ( this, b8 ); }
-     inline rc_t WriteB16 ( const void *b16 ) throw()
-     { return KMDataNodeWriteB16 ( this, b16 ); }
-     inline rc_t WriteB32 ( const void *b32 ) throw()
-     { return KMDataNodeWriteB32 ( this, b32 ); }
-     inline rc_t WriteB64 ( const void *b64 ) throw()
-     { return KMDataNodeWriteB64 ( this, b64 ); }
-     inline rc_t WriteB128 ( const void *b128 ) throw()
-     { return KMDataNodeWriteB128 ( this, b128 ); }
-
-
-    /* Write ( formatted )
-     *  writes string
-     *
-     *  "str" [ IN ] - NUL terminated string.
-     */
-     inline rc_t WriteCString ( const char *str ) throw()
-     { return KMDataNodeWriteCString ( this, str ); }
-
-
-    /* ReadAttr
-     *  reads as NUL-terminated string
-     *
-     *  "name" [ IN ] - NUL terminated attribute name
-     *
-     *  "buffer" [ OUT ] and "bsize" - return parameter for attribute value
-     *
-     *  "size" [ OUT ] - return parameter giving size of string
-     *  not including NUL byte. the size is set both upon success
-     *  and insufficient buffer space error.
-     */
-     inline rc_t ReadAttr ( const char *name, char *buffer, 
-        size_t bsize, size_t *size ) const throw()
-     { return KMDataNodeReadAttr ( this, name, buffer, bsize, size ); }
-
-
-    /* WriteAttr
-     *  writes NUL-terminated string
-     *
-     *  "name" [ IN ] - NUL terminated attribute name
-     *
-     *  "value" [ IN ] - NUL terminated attribute value
-     */
-    inline rc_t WriteAttr ( const char *name, const char *value )  throw()
-    { return KMDataNodeWriteAttr ( this, name, value ); }
-
-
-    /* ReadAttrAs ( formatted )
-     *  reads as integer or float value in native byte order
-     *  casts smaller-sized values to desired size, e.g.
-     *    uint32_t to uint64_t
-     *
-     *  "i" [ OUT ] - return parameter for signed integer
-     *  "u" [ OUT ] - return parameter for unsigned integer
-     *  "f" [ OUT ] - return parameter for double float
-     */
-     inline rc_t ReadAttrAsI16 ( const char *attr, int16_t *i ) const throw()
-     { return KMDataNodeReadAttrAsI16 ( this, attr, i ); }
-     inline rc_t ReadAttrAsU16 ( const char *attr, uint16_t *i ) const throw()
-     { return KMDataNodeReadAttrAsU16 ( this, attr, i ); }
-     inline rc_t ReadAttrAsI32 ( const char *attr, int32_t *i ) const throw()
-     { return KMDataNodeReadAttrAsI32 ( this, attr, i ); }
-     inline rc_t ReadAttrAsU32 ( const char *attr, uint32_t *i ) const throw()
-     { return KMDataNodeReadAttrAsU32 ( this, attr, i ); }
-     inline rc_t ReadAttrAsI64 ( const char *attr, int64_t *i ) const throw()
-     { return KMDataNodeReadAttrAsI64 ( this, attr, i ); }
-     inline rc_t ReadAttrAsU64 ( const char *attr, uint64_t *i ) const throw()
-     { return KMDataNodeReadAttrAsU64 ( this, attr, i ); }
-     inline rc_t ReadAttrAsF64 ( const char *attr, double *f ) const throw()
-     { return KMDataNodeReadAttrAsF64 ( this, attr, f ); }
-
-
-     /* Drop
-     *  drop some or all node content
-     */
-     inline rc_t DropAll () throw()
-     { return KMDataNodeDropAll ( this ); }
-     inline rc_t DropAttr ( const char *attr ) throw()
-     { return KMDataNodeDropAttr ( this, attr ); }
-     inline rc_t DropChild ( const char *path, ... ) throw()
-     {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = KMDataNodeVDropChild ( this, path, args );
-        va_end ( args );
-        return rc;
-     }
-     inline rc_t DropChild ( const char *path, va_list args ) throw()
-     { return KMDataNodeVDropChild ( this, path, args ); }
-
-
-    /* Rename
-     *  renames a contained object
-     *
-     *  "from" [ IN ] - NUL terminated string in UTF-8
-     *  giving simple name of existing attr
-     *
-     *  "to" [ IN ] - NUL terminated string in UTF-8
-     *  giving new simple attr name
-     */
-    inline rc_t RenameAttr ( const char *from, const char *to ) throw()
-    { return KMDataNodeRenameAttr ( this, from, to ); }
-    inline rc_t RenameChild ( const char *from, const char *to ) throw()
-    { return KMDataNodeRenameChild ( this, from, to ); }
-
-private:
-    KMDataNode ();
-    ~ KMDataNode ();
-    KMDataNode ( const KMDataNode& );
-    KMDataNode &operator = ( const KMDataNode& );
-};
-
-
-#endif // _hpp_kdb_meta_
diff --git a/interfaces/kdb/namelist.h b/interfaces/kdb/namelist.h
deleted file mode 100644
index 68233f4..0000000
--- a/interfaces/kdb/namelist.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kdb_namelist_
-#define _h_kdb_namelist_
-
-#ifndef _h_kdb_extern_
-#include <kdb/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KTable;
-struct KDatabase;
-struct KMDataNode;
-struct KNamelist;
-
-
-/*--------------------------------------------------------------------------
- * KNamelist
- */
-
-/* List
- *  create database listings
- */
-KDB_EXTERN rc_t CC KDatabaseListDB ( struct KDatabase const *self, struct KNamelist **names );
-KDB_EXTERN rc_t CC KDatabaseListTbl ( struct KDatabase const *self, struct KNamelist **names );
-KDB_EXTERN rc_t CC KDatabaseListIdx ( struct KDatabase const *self, struct KNamelist **names );
-
-/* List
- *  create table listings
- */
-KDB_EXTERN rc_t CC KTableListCol ( struct KTable const *self, struct KNamelist **names );
-KDB_EXTERN rc_t CC KTableListIdx ( struct KTable const *self, struct KNamelist **names );
-
-/* List
- *  create metadata node listings
- */
-KDB_EXTERN rc_t CC KMDataNodeListAttr ( struct KMDataNode const *self, struct KNamelist **names );
-KDB_EXTERN rc_t CC KMDataNodeListChildren ( struct KMDataNode const *self, struct KNamelist **names );
-#define KMDataNodeListChild KMDataNodeListChildren
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kdb_namelist_ */
diff --git a/interfaces/kdb/table.h b/interfaces/kdb/table.h
deleted file mode 100644
index 2d1a819..0000000
--- a/interfaces/kdb/table.h
+++ /dev/null
@@ -1,274 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kdb_table_
-#define _h_kdb_table_
-
-#ifndef _h_kdb_extern_
-#include <kdb/extern.h>
-#endif
-
-#ifndef _h_kfs_directory_
-#include <kfs/directory.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KDatabase;
-struct KDBManager;
-
-
-/*--------------------------------------------------------------------------
- * KTable
- *  a collection of columns indexed by row id, metadata, indices
- */
-typedef struct KTable KTable;
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-KDB_EXTERN rc_t CC KTableAddRef ( const KTable *self );
-KDB_EXTERN rc_t CC KTableRelease ( const KTable *self );
-
-
-/* CreateTable
- * VCreateTable
- *  create a new or open an existing table
- *
- *  "tbl" [ OUT ] - return parameter for newly opened table
- *
- *  "cmode" [ IN ] - creation mode
- *
- *  "path" [ IN ] - NUL terminated string in
- *  wd-native character set giving path to table
- */
-KDB_EXTERN rc_t CC KDBManagerCreateTable ( struct KDBManager *self,
-    KTable **tbl, KCreateMode cmode, const char *path, ... );
-KDB_EXTERN rc_t CC KDatabaseCreateTable ( struct KDatabase *self,
-    KTable **tbl, KCreateMode cmode, const char *name, ... );
-
-KDB_EXTERN rc_t CC KDBManagerVCreateTable ( struct KDBManager *self,
-    KTable **tbl, KCreateMode cmode, const char *path, va_list args );
-KDB_EXTERN rc_t CC KDatabaseVCreateTable ( struct KDatabase *self,
-    KTable **tbl, KCreateMode cmode, const char *name, va_list args );
-
-
-/* OpenTableRead
- * VOpenTableRead
- *  open a table for read
- *
- *  "tbl" [ OUT ] - return parameter for newly opened table
- *
- *  "path" [ IN ] - NUL terminated string in
- *  wd-native character set giving path to table
- */
-KDB_EXTERN rc_t CC KDBManagerOpenTableRead ( struct KDBManager const *self,
-    const KTable **tbl, const char *path, ... );
-KDB_EXTERN rc_t CC KDatabaseOpenTableRead ( struct KDatabase const *self,
-    const KTable **tbl, const char *name, ... );
-
-KDB_EXTERN rc_t CC KDBManagerVOpenTableRead ( struct KDBManager const *self,
-    const KTable **tbl, const char *path, va_list args );
-KDB_EXTERN rc_t CC KDatabaseVOpenTableRead ( struct KDatabase const *self,
-    const KTable **tbl, const char *name, va_list args );
-
-
-/* OpenTableUpdate
- * VOpenTableUpdate
- *  open a table for read/write
- *
- *  "tbl" [ OUT ] - return parameter for newly opened table
- *
- *  "name" [ IN ] - NUL terminated string in UTF-8 giving name of table
- */
-KDB_EXTERN rc_t CC KDBManagerOpenTableUpdate ( struct KDBManager *self,
-    KTable **tbl, const char *path, ... );
-KDB_EXTERN rc_t CC KDatabaseOpenTableUpdate ( struct KDatabase *self,
-    KTable **tbl, const char *name, ... );
-
-KDB_EXTERN rc_t CC KDBManagerVOpenTableUpdate ( struct KDBManager *self,
-    KTable **tbl, const char *path, va_list args );
-KDB_EXTERN rc_t CC KDatabaseVOpenTableUpdate ( struct KDatabase *self,
-    KTable **tbl, const char *name, va_list args );
-
-
-/* Locked
- *  returns true if table is locked
- */
-KDB_EXTERN bool CC KTableLocked ( const KTable *self );
-
-
-/* Exists
- *  returns true if requested object exists
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptIndex and kptColumn
- *
- *  "path" [ IN ] - NUL terminated path
- */
-KDB_EXTERN bool CC KTableExists ( const KTable *self, uint32_t type,
-    const char *name, ... );
-KDB_EXTERN bool CC KTableVExists ( const KTable *self, uint32_t type,
-    const char *name, va_list args );
-
-/* IsAlias
- *  returns true if object name is an alias
- *  returns path to fundamental name if it was aliased
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptIndex and kptColumn
- *
- *  "resolved" [ OUT ] and "rsize" [ IN ] - optional output buffer
- *  for fundamenta object name if "alias" is not a fundamental name, 
- *
- *  "name" [ IN ] - NUL terminated object name
- */
-KDB_EXTERN bool CC KTableIsAlias ( const KTable *self, uint32_t type,
-    char *resolved, size_t rsize, const char *name );
-
-/* Writable
- *  returns 0 if object is writable
- *  or a reason why if not
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptIndex and kptColumn
- *
- *  "path" [ IN ] - NUL terminated path
- */
-KDB_EXTERN rc_t CC KTableWritable ( const KTable *self, uint32_t type,
-    const char *name, ... );
-KDB_EXTERN rc_t CC KTableVWritable ( const KTable *self, uint32_t type,
-    const char *name, va_list args );
-
-/* Lock
- *  apply lock
- *
- *  if object is already locked, the operation is idempotent
- *  and returns an rc state of rcLocked
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptIndex and kptColumn
- *
- *  "path" [ IN ] - NUL terminated path
- */
-KDB_EXTERN rc_t CC KTableLock ( KTable *self, uint32_t type,
-    const char *name, ... );
-KDB_EXTERN rc_t CC KTableVLock ( KTable *self, uint32_t type,
-    const char *name, va_list args );
-
-/* Unlock
- *  remove lock
- *
- *  if object is already unlocked, the operation is idempotent
- *  and returns an rc state of rcUnlocked
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptIndex and kptColumn
- *
- *  "path" [ IN ] - NUL terminated path
- */
-KDB_EXTERN rc_t CC KTableUnlock ( KTable *self, uint32_t type,
-    const char *name, ... );
-KDB_EXTERN rc_t CC KTableVUnlock ( KTable *self, uint32_t type,
-    const char *name, va_list args );
-
-
-/* Rename
- *  renames a contained object
- *
- *  "from" [ IN ] - NUL terminated string in UTF-8
- *  giving name of contained object
- *
- *  "to" [ IN ] - NUL terminated string in UTF-8
- *  giving new name
- */
-KDB_EXTERN rc_t CC KTableRenameColumn ( KTable *self, bool force,
-    const char *from, const char *to );
-KDB_EXTERN rc_t CC KTableRenameIndex ( KTable *self, bool force,
-    const char *from, const char *to );
-
-
-/* Alias
- *  create an alias to an existing contained object
- *
- *  "name" [ IN ] - NUL terminated string in UTF-8
- *  giving name of contained object
- *
- *  "alias" [ IN ] - NUL terminated string in UTF-8
- *  giving aliased name
- */
-KDB_EXTERN rc_t CC KTableAliasColumn ( KTable *self, const char *path, const char *alias );
-KDB_EXTERN rc_t CC KTableAliasIndex ( KTable *self, const char *name, const char *alias );
-
-
-/* Drop
- *  drop a contained object
- *
- *  "name" [ IN ] - NUL terminated string in UTF-8 giving column name
- */
-KDB_EXTERN rc_t CC KTableDropColumn ( KTable *self, const char *name, ... );
-KDB_EXTERN rc_t CC KTableDropIndex ( KTable *self, const char *name, ... );
-
-KDB_EXTERN rc_t CC KTableVDropColumn ( KTable *self, const char *name, va_list args );
-KDB_EXTERN rc_t CC KTableVDropIndex ( KTable *self, const char *name, va_list args );
-
-
-/* Reindex
- *  optimize column indices
- */
-KDB_EXTERN rc_t CC KTableReindex ( KTable *self );
-
-
-/* OpenManager
- *  duplicate reference to manager
- *  NB - returned reference must be released
- */
-KDB_EXTERN rc_t CC KTableOpenManagerRead ( const KTable *self, struct KDBManager const **mgr );
-KDB_EXTERN rc_t CC KTableOpenManagerUpdate ( KTable *self, struct KDBManager **mgr );
-
-
-/* OpenParent
- *  duplicate reference to parent database
- *  NB - returned reference must be released
- */
-KDB_EXTERN rc_t CC KTableOpenParentRead ( const KTable *self, struct KDatabase const **db );
-KDB_EXTERN rc_t CC KTableOpenParentUpdate ( KTable *self, struct KDatabase **db );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*  _h_kdb_table_ */
diff --git a/interfaces/kfc/callconv.h b/interfaces/kfc/callconv.h
deleted file mode 100644
index 17bdd53..0000000
--- a/interfaces/kfc/callconv.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfc_callconv_
-#define _h_kfc_callconv_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * CC
- *  calling convention
- *  should be declared within compiler/os-specific files
- *  but to make external client builds work, do so here...
- */
-#ifndef CC
- #if defined _MSC_VER
-  #define CC __cdecl
- #else
-  #define CC
- #endif
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*  _h_kfc_callconv_ */
diff --git a/interfaces/kfc/ctx.h b/interfaces/kfc/ctx.h
deleted file mode 100644
index 20f7a78..0000000
--- a/interfaces/kfc/ctx.h
+++ /dev/null
@@ -1,214 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#ifndef _h_kfc_ctx_
-#define _h_kfc_ctx_
-
-#ifndef _h_kfc_extern_
-#include <kfc/extern.h>
-#endif
-
-#ifndef _h_kfc_defs_
-#include <kfc/defs.h>
-#endif
-
-#ifndef _h_kfc_rc_
-#include <kfc/rc.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KRsrc;
-
-
-/*--------------------------------------------------------------------------
- * KSourceLoc
- *  holds a static block identifying module, file and file extension.
- *  by including this file in a source compilation, a static block
- *  called "s_src_loc" will be automatically defined.
- */
-typedef struct KSourceLoc KSourceLoc;
-struct KSourceLoc
-{
-    const char * mod;
-    const char * file;
-    const char * ext;
-};
-
-#ifndef SRC_LOC_DEFINED
-static KSourceLoc s_src_loc = { __mod__, __file__, __fext__ };
-#define SRC_LOC_DEFINED 1
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KFuncLoc
- *  holds a static block identifying function and source file.
- */
-typedef struct KFuncLoc KFuncLoc;
-struct KFuncLoc
-{
-    const KSourceLoc * src;
-    const char * func;
-    rc_t rc_context;
-};
-
-#define DECLARE_FUNC_LOC( rc_mod, rc_targ, rc_ctx )                \
-    static KFuncLoc s_func_loc =                                   \
-    { & s_src_loc, __func__, RAW_CTX ( rc_mod, rc_targ, rc_ctx ) }
-
-
-/*--------------------------------------------------------------------------
- * ctx_t
- *  modified from vdb-3
- */
-typedef struct KCtx KCtx;
-struct KCtx
-{
-    struct KRsrc const * rsrc;
-    const KFuncLoc * loc;
-    const KCtx * caller;
-
-    /* here for hybrid-mode */
-    volatile rc_t rc;
-
-    /* set to true when an annotation/error
-       occurs - propagated up stack until stop */
-    volatile bool annotated;
-    volatile bool error;
-
-    /* set to true when an annotation/error
-       arrives at a stack frame with a previous
-       annotation or error - used as a marker
-       for clearing annotations/errors */
-    volatile bool clear_annot_stop;
-    volatile bool clear_error_stop;
-};
-
-/* assert
- * rsrc_assert
- */
-#define ctx_assert( ctx )                       \
-    assert ( ctx != NULL )
-#define ctx_rsrc_assert( ctx )                  \
-    ctx_assert ( ctx );                         \
-    assert ( ctx -> rsrc != NULL )
-
-
-/* init
- *  initialize local context block
- *  performs a particular contortion to allow:
- *   a) initialization of a local ctx_t block
- *   b) reassignment of "ctx" pointer to new block
- *   c) use as an initializer to allow declarations to follow
- */
-static __inline__
-KCtx ctx_init ( KCtx * new_ctx, ctx_t * ctxp, const KFuncLoc * func_loc )
-{
-    /* extract caller's ctx pointer */
-    ctx_t ctx = * ctxp;
-
-    /* construct a local copy of ctx_t as return value
-       allow compiler to zero trailing members more
-       efficiently than by explicit initialization */
-    KCtx local_ctx = { ctx -> rsrc, func_loc, ctx };
-
-    /* reassign the "ctx" pointer for stack frame */
-    * ctxp = new_ctx;
-
-    /* "return" the new block - a noop that permits
-       use of this function as an initializer, and
-       further declarations of local variables */
-    return local_ctx;
-}
-
-
-/* FUNC_ENTRY
- *  establishes context within a function
- *  legal to use wherever a normal declaration is allowed
- */
-#define FUNC_ENTRY( ctx, rc_mod, rc_targ, rc_ctx )                      \
-    DECLARE_FUNC_LOC ( rc_mod, rc_targ, rc_ctx );                       \
-    KCtx local_ctx = ctx_init ( & local_ctx, & ( ctx ), & s_func_loc )
-
-
-/* POP_CTX [ RESERVED USAGE ]
- *  unlinks ctx for a stack frame
- *  used ONLY for code that wants to remove itself from call chain
- *  after having executed FUNC_ENTRY, i.e. for thunk operations
- *
- *  normally, a thunk or other piece of code that does not want
- *  to participate in the call chain ctx linkage would simply
- *  avoid using FUNC_ENTRY. however, this can be dangerous if any
- *  errors occur during operation.
- *
- *  to handle this condition, a thunk-like function can use
- *  FUNC_ENTRY in a normal fashion, but unlink with POP_CTX
- *  just prior to calling through to the next function, usually
- *  as a tail-call.
- */
-#define POP_CTX( ctx ) \
-    ctx = ctx -> caller
-
-
-/* recover
- *  queries thread for previously stored KRsrc block
- *  creates a new one if necessary
- *  ensures that requested resources are present
- *  initializes a local ctx_t
- *  see <kfc/rsrc.h> for bitfield definitions
- */
-KFC_EXTERN ctx_t CC ctx_recover ( KCtx * new_ctx,
-    const KFuncLoc * func_loc, uint32_t rsrc_bits );
-
-
-/* HYBRID_FUNC_ENTRY
- *  recovers or creates thread-specific KRsrc block
- *  initializes a local ctx_t
- *  declares a local ctx pointer variable
- *
- *  "bits" [ BITFIELD, DFLT ZERO ] - optional bits for requesting resource caps
- *  normally, the resources available would be determined in KMane + KMain, but
- *  for the hybrid approach when being used without KMain, we need to be able
- *  to create a resource block out of nothing. these bits assist in so doing.
- *  ( see <kfc/rsrc.h> for bitfield definitions )
- */
-#define HYBRID_FUNC_ENTRY( rc_mod, rc_targ, rc_ctx, bits )      \
-    KCtx local_ctx;                                             \
-    DECLARE_FUNC_LOC ( rc_mod, rc_targ, rc_ctx );               \
-    ctx_t ctx = ctx_recover ( & local_ctx, & s_func_loc, bits )
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfc_ctx_ */
diff --git a/interfaces/kfc/defs.h b/interfaces/kfc/defs.h
deleted file mode 100644
index d790a4c..0000000
--- a/interfaces/kfc/defs.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfc_defs_
-#define _h_kfc_defs_
-
-#ifndef _h_kfc_callconv_
-#include <kfc/callconv.h>
-#endif
-
-#include <stdint.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <assert.h>
-
-#ifdef __cplusplus
-extern "C" {
-#else
-#include <stdbool.h>
-#endif
-
-/*--------------------------------------------------------------------------
- * ctx_t
- *  a thread context block
- */
-typedef struct KCtx const * ctx_t;
-
-
-/*--------------------------------------------------------------------------
- * xobj_t
- *  describes the type of object having problems
- */
-typedef struct { const char *name; } const xobj_t [ 1 ];
-
-
-/*--------------------------------------------------------------------------
- * xstate_t
- *  describes the state of an object having problems
- */
-typedef struct { const char *name; } const xstate_t [ 1 ];
-
-
-/*--------------------------------------------------------------------------
- * xc_t
- *  describes a class of error
- */
-typedef struct { const char *name; } const xc_t [ 1 ];
-
-
-/*--------------------------------------------------------------------------
- * under normal usage, the declarations below will create simple externs.
- * however, they may be redefined to create static objects
- */
-#ifndef XC_DEFINE
-
-#define XOBJ( name, desc, rc )                  \
-    extern xobj_t name
-#define XOBJ_EXT( name, supr, desc, rc )        \
-    extern xobj_t name
-
-#define XSTATE( name, desc, rc )                \
-    extern xstate_t name
-#define XSTATE_EXT( name, supr, desc, rc )      \
-    extern xstate_t name
-
-#define XC( name, obj, state )                  \
-    extern xc_t name
-#define XC_EXT( name, supr )                    \
-    extern xc_t name
-
-#endif /* XC_DEFINE */
-
-
-/*--------------------------------------------------------------------------
- * rc_t - VDB.2 LEGACY
- *  upon success, all functions will return code 0
- *  other codes indicate failure or additional status information
- */
-typedef uint32_t rc_t;
-
-
-/*--------------------------------------------------------------------------
- * ver_t - VDB.2 LEGACY
- *  32 bit 3 part type
- */
-typedef uint32_t ver_t;
-
-/* GetMajor
- *  return major component
- */
-#define VersionGetMajor( self ) \
-    ( ( self ) >> 24 )
-
-/* GetMinor
- *  return minor component
- */
-#define VersionGetMinor( self ) \
-    ( ( ( self ) >> 16 ) & 0xFF )
-
-/* GetRelease
- *  return release component
- */
-#define VersionGetRelease( self ) \
-    ( ( self ) & 0xFFFF )
-
-
-/*--------------------------------------------------------------------------
- * stringize
- *  it is useful to be able to convert PP defines on the command line
- */
-#define stringize( tok ) tok_to_string ( tok )
-#define tok_to_string( tok ) # tok
-
-
-/*--------------------------------------------------------------------------
- * __mod__, __file__ and __fext__
- *  these guys are slightly different from __FILE__
- *  and they complement __func__
- */
-#if ! defined __mod__ && defined __mod_name__
-#define __mod__ stringize ( __mod_name__ )
-#endif
-
-#if ! defined __file__ && defined __file_name__
-#define __file__ stringize ( __file_name__ )
-#endif
-
-#if ! defined __fext__ && defined __file_ext__
-#define __fext__ stringize ( __file_ext__ )
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*  _h_kfc_defs_ */
diff --git a/interfaces/kfc/except.h b/interfaces/kfc/except.h
deleted file mode 100644
index ed6e535..0000000
--- a/interfaces/kfc/except.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#ifndef _h_kfc_except_
-#define _h_kfc_except_
-
-#ifndef _h_kfc_defs_
-#include <kfc/defs.h>
-#endif
-
-#undef ERROR
-#undef FAILED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * exception-related macros
- */
-
-/* xc_sev_t
- *  severity
- */
-typedef enum xc_sev_t { xc_sev_system, xc_sev_internal, xc_sev_user } xc_sev_t;
-
-
-/* ANNOTATE
- *  make some annotation
- *  but not an error
- */
-void ctx_annotate ( ctx_t ctx, uint32_t lineno, const char *msg, ... );
-#define ANNOTATE( ... )                            \
-    ctx_annotate ( ctx, __LINE__, __VA_ARGS__ )
-
-
-/* ERROR
- *  make an annotation
- *  record an error as an xc_t
- */
-void ctx_error ( ctx_t ctx, uint32_t lineno, xc_sev_t sev, xc_t xc, const char *msg, ... );
-#define SYSTEM_ERROR( xc, ... )                                    \
-    ctx_error ( ctx, __LINE__, xc_sev_system, xc, __VA_ARGS__ )
-#define INTERNAL_ERROR( xc, ... )                                  \
-    ctx_error ( ctx, __LINE__, xc_sev_internal, xc, __VA_ARGS__ )
-#define USER_ERROR( xc, ... )                                      \
-    ctx_error ( ctx, __LINE__, xc_sev_user, xc, __VA_ARGS__ )
-
-
-/* ABORT
- *  make an annotation
- *  record an error as an x_t
- *  exit thread ( actually, exit process )
- */
-void ctx_abort ( ctx_t ctx, uint32_t lineno, xc_t xc, const char *msg, ... );
-#define ABORT( xc, ... )                               \
-    ctx_abort ( ctx, __LINE__, xc, __VA_ARGS__ )
-#define FATAL_ERROR( xc, ... )                         \
-    ctx_abort ( ctx, __LINE__, xc, __VA_ARGS__ )
-
-
-/* FAILED
- *  a test of rc within ctx_t
- */
-#define FAILED() \
-    ( ctx -> error != false )
-
-
-/* TRY
- *  another C language "try" macro
- */
-#define TRY( expr ) \
-    expr; \
-    if ( ! FAILED () )
-
-
-/* CATCH
- *  attempts to catch rc on certain types
- */
-bool ctx_xc_isa ( xc_t xc );
-bool ctx_xstate_isa ( xstate_t xs );
-bool ctx_xobj_isa ( xobj_t xs );
-
-#define CATCH( xc ) \
-    else if ( ctx_xc_isa ( xc ) )
-#define CATCH_OBJ( xo ) \
-    else if ( ctx_xobj_isa ( xo ) )
-#define CATCH_STATE( xs ) \
-    else if ( ctx_xstate_isa ( xs ) )
-#define CATCH_ALL() \
-    else
-
-
-/* ON_FAIL
- *  reverses TRY logic
- *  generally used for less-structured code,
- *  e.g. ON_FAIL ( x ) return y;
- */
-#define ON_FAIL( expr ) \
-    expr; \
-    if ( FAILED () )
-
-
-/* CLEAR
- *  clears annotation and error
- *  used from within CATCH handler
- */
-void ctx_clear_all ( ctx_t ctx );
-#define CLEAR() \
-    ctx_clear_all ( ctx )
-
-
-/* CLEAR_ERR
- *  clears just error state, leaving any annotation
- */
-void ctx_clear_error ( ctx_t ctx );
-#define CLEAR_ERR() \
-    ctx_clear_error ( ctx )
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* _h_kfc_except_ */
diff --git a/interfaces/kfc/extern.h b/interfaces/kfc/extern.h
deleted file mode 100644
index 0f9e9bf..0000000
--- a/interfaces/kfc/extern.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfc_extern_
-#define _h_kfc_extern_
-
-#ifndef _h_kfc_callconv_
-#include <kfc/callconv.h>
-#endif
-
-#if ! defined EXPORT_LATCH && _LIBRARY
-
-#define KFC_EXTERN LIB_EXPORT
-#define EXPORT_LATCH 1
-
-#else
-
-#define KFC_EXTERN LIB_IMPORT
-
-#endif
-
-#if defined _MSC_VER && ! _STATIC
-
-/* __declspec ( dllimport ) will cause creation of
-   function pointers rather than thunks, which makes
-   the code that imports unable to link statically
-   against a library. we leave this symbol defined as
-   "extern" to use thunks instead. as a result, all
-   function addresses resolve to the thunk and not
-   the actual function. */
-#define LIB_IMPORT extern
-#define LIB_IMPORT_DATA extern __declspec ( dllimport )
-#define LIB_EXPORT __declspec ( dllexport )
-#define LIB_EXPORT_DATA __declspec ( dllexport )
-
-#else
-
-#define LIB_IMPORT extern
-#define LIB_IMPORT_DATA extern
-#define LIB_EXPORT
-#define LIB_EXPORT_DATA
-
-#endif
-
-#endif /* _h_kfc_extern_ */
diff --git a/interfaces/kfc/rc.h b/interfaces/kfc/rc.h
deleted file mode 100644
index 4527445..0000000
--- a/interfaces/kfc/rc.h
+++ /dev/null
@@ -1,352 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfc_rc_
-#define _h_kfc_rc_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * under normal usage, the declarations below will create simple enums.
- * however, they may be redefined to create textual lookup tables.
- */
-#ifndef RC_ENUM
-
-#define RC_ENUM( type ) enum type
-
-#undef RC_ENTRY
-#define RC_ENTRY( id, txt ) id,
-
-#undef RC_VLAST
-#define RC_VLAST( id ) id,
-
-#undef RC_LAST
-#define RC_LAST( id ) id
-
-#define RC_EMIT 1
-
-#endif
-
-/*--------------------------------------------------------------------------
- * RC
- *  upon success, all functions will return code 0
- *  other codes indicate failure or additional status information
- */
-
-
-/* RCModule
- *  what code module generated the error
- */
-RC_ENUM ( RCModule )
-{
-    RC_ENTRY ( rcExe, NULL )
-    RC_ENTRY ( rcRuntime, "runtime" )
-    RC_ENTRY ( rcText, "text" )
-    RC_ENTRY ( rcCont, "container" )
-    RC_ENTRY ( rcCS, "checksum" )
-    RC_ENTRY ( rcFF, "file format detection" )
-    RC_ENTRY ( rcFS, "file system" )
-    RC_ENTRY ( rcPS, "process system" )
-    RC_ENTRY ( rcXF, "transform" )
-    RC_ENTRY ( rcDB, "database" )
-    RC_ENTRY ( rcVDB, "virtual database" )
-    RC_ENTRY ( rcApp, "application support" )
-    RC_ENTRY ( rcXML, "xml support" )
-    RC_ENTRY ( rcSRA, "short read archive" )
-    RC_VLAST ( rcLastModule_v1_0 )
-    RC_ENTRY ( rcKFG = rcLastModule_v1_0, "configuration" )
-    RC_ENTRY ( rcAlign, "alignment" )
-    RC_ENTRY ( rcKrypto, "cryptographic" )
-    RC_ENTRY ( rcRDBMS, "RDBMS" )
-    RC_ENTRY ( rcNS, "network system" )
-    RC_ENTRY ( rcVFS, "virtual file system" )
-    RC_LAST ( rcLastModule_v1_1 )
-};
-
-/* RCTarget
- *  describes the target object of the message
- */
-RC_ENUM ( RCTarget )
-{
-    RC_ENTRY ( rcNoTarg, NULL )
-    RC_ENTRY ( rcArc, "archive file" )
-    RC_ENTRY ( rcToc, "file system table of contents" )
-    RC_ENTRY ( rcTocEntry, "file table of contents entry" )
-    RC_ENTRY ( rcArgv, "argument list" )
-    RC_ENTRY ( rcAttr, "attribute" )
-    RC_ENTRY ( rcBarrier, "barrier" )
-    RC_ENTRY ( rcBlob, "binary large object" )
-    RC_ENTRY ( rcBuffer, "buffer" )
-    RC_ENTRY ( rcChar, "character" )
-    RC_ENTRY ( rcColumn, "column" )
-    RC_ENTRY ( rcCondition, "condition" )
-    RC_ENTRY ( rcCursor, "cursor" )
-    RC_ENTRY ( rcDatabase, "database" )
-    RC_ENTRY ( rcDirectory, "directory" )
-    RC_ENTRY ( rcDoc, "document" )
-    RC_ENTRY ( rcXmlDoc, "XML document" )
-    RC_ENTRY ( rcFile, "file" )
-    RC_ENTRY ( rcFileDesc, "file descriptor" )
-    RC_ENTRY ( rcFileFormat, "file format" )
-    RC_ENTRY ( rcFunction, "function" )
-    RC_ENTRY ( rcFormatter, "formatter" )
-    RC_ENTRY ( rcFunctParam, "function parameter" )
-    RC_ENTRY ( rcHeader, "header" )
-    RC_ENTRY ( rcIndex, "index" )
-    RC_ENTRY ( rcIterator, "iterator" )
-    RC_ENTRY ( rcLock, "lock" )
-    RC_ENTRY ( rcLog, "log" )
-    RC_ENTRY ( rcMD5SumFmt, "MD5 sum file" )
-    RC_ENTRY ( rcMemMap, "memory map" )
-    RC_ENTRY ( rcMetadata, "metadata" )
-    RC_ENTRY ( rcMgr, "manager" )
-    RC_ENTRY ( rcNamelist, "name list" )
-    RC_ENTRY ( rcNode, "node" )
-    RC_ENTRY ( rcNumeral, "numeral" )
-    RC_ENTRY ( rcPagemap, "page map" )
-    RC_ENTRY ( rcPath, "path" )
-    RC_ENTRY ( rcProcess, "process" ) 
-    RC_ENTRY ( rcQueue, "queue" )
-    RC_ENTRY ( rcRWLock, "read/write lock" )
-    RC_ENTRY ( rcSchema, "schema" )
-    RC_ENTRY ( rcSemaphore, "semaphore" )
-    RC_ENTRY ( rcStorage, "storage" )
-    RC_ENTRY ( rcString, "string" )
-    RC_ENTRY ( rcTable, "table" )
-    RC_ENTRY ( rcThread, "thread" )
-    RC_ENTRY ( rcTimeout, "timeout" )
-    RC_ENTRY ( rcToken, "token" )
-    RC_ENTRY ( rcTree, "tree" )
-    RC_ENTRY ( rcTrie, "trie" )
-    RC_ENTRY ( rcType, "type" )
-    RC_ENTRY ( rcVector, "vector" )
-    RC_ENTRY ( rcDylib, "dynamic library" )
-    RC_ENTRY ( rcExpression, "expression" )
-    RC_VLAST ( rcLastTarget_v1_0 )
-    RC_ENTRY ( rcProduction = rcLastTarget_v1_0, "schema production" )
-    RC_ENTRY ( rcEncryptionKey, "encryption key" )
-    RC_ENTRY ( rcRng, "random number generator" )
-    RC_ENTRY ( rcCmd, "command" )
-    RC_ENTRY ( rcData, "data" )
-    RC_ENTRY ( rcQuery, "query" )
-    RC_ENTRY ( rcUri, "uri" )
-    RC_LAST ( rcLastTarget_v1_1 )
-};
-
-/* RCContext
- *  context under which error occurred
- */
-RC_ENUM ( RCContext )
-{
-    RC_ENTRY ( rcAllocating, "allocating" )
-    RC_ENTRY ( rcCasting, "type-casting" )
-    RC_ENTRY ( rcConstructing, "constructing" )
-    RC_ENTRY ( rcDestroying, "destroying" )
-    RC_ENTRY ( rcReleasing, "releasing" )
-    RC_ENTRY ( rcAccessing, "accessing" )
-    RC_ENTRY ( rcListing, "listing" )
-    RC_ENTRY ( rcVisiting, "visiting" )
-    RC_ENTRY ( rcResolving, "resolving" )
-    RC_ENTRY ( rcLocking, "locking" )
-    RC_ENTRY ( rcUnlocking, "unlocking" )
-    RC_ENTRY ( rcRenaming, "renaming" )
-    RC_ENTRY ( rcAliasing, "aliasing" )
-    RC_ENTRY ( rcSelecting, "selecting" )
-    RC_ENTRY ( rcProjecting, "projecting" )
-    RC_ENTRY ( rcInserting, "inserting" )
-    RC_ENTRY ( rcRemoving, "removing" )
-    RC_ENTRY ( rcClearing, "clearing" )
-    RC_ENTRY ( rcUpdating, "updating" )
-    RC_ENTRY ( rcCreating, "creating" )
-    RC_ENTRY ( rcOpening, "opening" )
-    RC_ENTRY ( rcClosing, "closing" )
-    RC_ENTRY ( rcResizing, "resizing" )
-    RC_ENTRY ( rcReading, "reading" )
-    RC_ENTRY ( rcWriting, "writing" )
-    RC_ENTRY ( rcCommitting, "committing" )
-    RC_ENTRY ( rcReverting, "reverting" )
-    RC_ENTRY ( rcResetting, "resetting" )
-    RC_ENTRY ( rcPersisting, "persisting" )
-    RC_ENTRY ( rcFreezing, "freezing" )
-    RC_ENTRY ( rcCopying, "copying" )
-    RC_ENTRY ( rcConcatenating, "concatenating" )
-    RC_ENTRY ( rcFormatting, "formatting" )
-    RC_ENTRY ( rcPositioning, "positioning" )
-    RC_ENTRY ( rcPacking, "packing" )
-    RC_ENTRY ( rcUnpacking, "unpacking" )
-    RC_ENTRY ( rcEncoding, "encoding" )
-    RC_ENTRY ( rcDecoding,"decoding" )
-    RC_ENTRY ( rcValidating, "validating" )
-    RC_ENTRY ( rcExecuting, "executing" )
-    RC_ENTRY ( rcHuffmanCoding, "Huffman coding" )
-    RC_ENTRY ( rcReindexing, "re-indexing" )
-    RC_ENTRY ( rcRegistering, "registering" )
-    RC_ENTRY ( rcTokenizing, "tokenizing" )
-    RC_ENTRY ( rcParsing, "parsing" )
-    RC_ENTRY ( rcConverting, "converting" )
-    RC_ENTRY ( rcSignaling, "signaling" )
-    RC_ENTRY ( rcWaiting, "waiting" )
-    RC_ENTRY ( rcAttaching, "attaching" )
-    RC_ENTRY ( rcDetaching, "detaching" )
-    RC_ENTRY ( rcLogging, "logging" )
-    RC_ENTRY ( rcFPCoding, "floating point coding" )
-    RC_ENTRY ( rcMultiplexing, "(de)multiplexing" )
-    RC_ENTRY ( rcClassifying, "classifying" )
-    RC_ENTRY ( rcSearching, "searching" )
-    RC_ENTRY ( rcLoading, "loading" )
-    RC_ENTRY ( rcEvaluating, "evaluating" )
-    RC_ENTRY ( rcInflating, "inflating" )
-    RC_VLAST ( rcLastContext_v1_0 )
-    RC_ENTRY ( rcFlushing = rcLastContext_v1_0, "flushing" )
-    RC_ENTRY ( rcAppending, "appending" )
-    RC_ENTRY ( rcEncrypting, "encrypting" )
-    RC_ENTRY ( rcDecrypting, "decrypting" )
-    RC_ENTRY ( rcComparing, "comparing" )
-    RC_ENTRY ( rcInitializing, "initializing" )
-    RC_ENTRY ( rcRetrieving, "retrieving" )
-    RC_ENTRY ( rcSending, "sending" )
-    RC_ENTRY ( rcProcessing, "processing" )
-    RC_ENTRY ( rcIdentifying, "type identifying" )
-    RC_LAST ( rcLastContext_v1_1 )
-};
-
-/* RCObject
- *  type of object described by state
- */
-RC_ENUM ( RCObject )
-{
-    RC_ENTRY ( rcNoObj, NULL )
-    RC_ENTRY ( rcLink = ( int ) rcLastTarget_v1_1, "symbolic link" )
-    RC_ENTRY ( rcSelf, "self" )
-    RC_ENTRY ( rcParam, "param" )
-    RC_ENTRY ( rcOffset, "offset" )
-    RC_ENTRY ( rcMemory, "memory" )
-    RC_ENTRY ( rcName, "name" )
-    RC_ENTRY ( rcFormat, "format" )
-    RC_ENTRY ( rcTransfer, "transfer" )
-    RC_ENTRY ( rcInterface, "interface" )
-    RC_ENTRY ( rcId, "id" )
-    RC_ENTRY ( rcRange, "range" )
-    RC_ENTRY ( rcConstraint, "constraint" )
-    RC_ENTRY ( rcByteOrder, "byte order" )
-    RC_ENTRY ( rcMessage, "message" )
-    RC_ENTRY ( rcTag, "tag" )
-    RC_ENTRY ( rcResources, "system resources" )
-    RC_ENTRY ( rcDirEntry, "directory-toc entry" )
-    RC_ENTRY ( rcArcHardLink, "archive hard link" )
-    RC_ENTRY ( rcRow, "row" )
-    RC_ENTRY ( rcLibrary, "loadable library" )
-    RC_VLAST ( rcLastObject_v1_0 )
-    RC_ENTRY ( rcItem = rcLastObject_v1_0, "item" )
-    RC_ENTRY ( rcMode, "mode" )
-    RC_ENTRY ( rcEncryption, "encryption" )
-    RC_ENTRY ( rcCrc, "crc" )
-    RC_ENTRY ( rcChecksum, "checksum" )
-    RC_ENTRY ( rcSeed, "seed" )
-    RC_ENTRY ( rcConnection, "connection" )
-    RC_ENTRY ( rcError, "error" )
-    RC_ENTRY ( rcEnvironment, "environment" )
-    RC_ENTRY ( rcSignalSet, "signal set" )
-    RC_ENTRY ( rcSize, "size" )
-    RC_ENTRY ( rcRefcount, "reference count" )
-    RC_LAST ( rcLastObject_v1_1 )
-};
-
-/* RCState
- *  state of object described
- */
-RC_ENUM ( RCState )
-{
-    RC_ENTRY ( rcNoErr, "no error" )
-    RC_ENTRY ( rcDone, "done" )
-    RC_ENTRY ( rcUnknown, "unknown" )
-    RC_ENTRY ( rcUnsupported, "unsupported" )
-    RC_ENTRY ( rcUnexpected, "unexpected" )
-    RC_ENTRY ( rcUnrecognized, "unrecognized" )
-    RC_ENTRY ( rcAmbiguous, "ambiguous" )
-    RC_ENTRY ( rcNull, "NULL" )
-    RC_ENTRY ( rcBadVersion, "bad version" )
-    RC_ENTRY ( rcDestroyed, "destroyed" )
-    RC_ENTRY ( rcInvalid, "invalid" )
-    RC_ENTRY ( rcCorrupt, "corrupt" )
-    RC_ENTRY ( rcIncorrect, "incorrect" )
-    RC_ENTRY ( rcInconsistent, "inconsistent" )
-    RC_ENTRY ( rcBusy, "busy" )
-    RC_ENTRY ( rcIncomplete, "incomplete" )
-    RC_ENTRY ( rcInterrupted, "interrupted" )
-    RC_ENTRY ( rcCanceled, "canceled" )
-    RC_ENTRY ( rcEmpty, "empty" )
-    RC_ENTRY ( rcExhausted, "exhausted" )
-    RC_ENTRY ( rcInsufficient, "insufficient" )
-    RC_ENTRY ( rcExcessive, "excessive" )
-    RC_ENTRY ( rcViolated, "violated" )
-    RC_ENTRY ( rcExists, "exists" )
-    RC_ENTRY ( rcNotFound, "not found" )
-    RC_ENTRY ( rcLocked, "locked" )
-    RC_ENTRY ( rcUnlocked, "unlocked" )
-    RC_ENTRY ( rcDetached, "detached" )
-    RC_ENTRY ( rcDeadlock, "deadlock" )
-    RC_ENTRY ( rcUnauthorized, "unauthorized" )
-    RC_ENTRY ( rcReadonly, "read-only" )
-    RC_ENTRY ( rcWriteonly, "write-only" )
-    RC_ENTRY ( rcNoPerm, "no permission" )
-    RC_ENTRY ( rcInPlaceNotAllowed, "update in-place prohibited" )
-    RC_ENTRY ( rcTooShort, "too short" )
-    RC_ENTRY ( rcTooLong, "too long" )
-    RC_ENTRY ( rcTooBig, "too big" )
-    RC_ENTRY ( rcDuplicate, "duplicate" )
-    RC_ENTRY ( rcOutOfKDirectory, "path out of this KDirectory FS" )
-    RC_ENTRY ( rcIgnored, "ignored" )	
-    RC_ENTRY ( rcOutofrange, "out of range" )
-    RC_VLAST ( rcLastState_v1_0 )
-    RC_ENTRY ( rcOpen = rcLastState_v1_0, "open" )
-    RC_ENTRY ( rcOutoforder, "out of order" )
-    RC_ENTRY ( rcNotOpen, "not open" )
-    RC_ENTRY ( rcUndefined, "undefined" )
-    RC_ENTRY ( rcUnequal, "unequal" )
-    RC_ENTRY ( rcFailed, "failed" )
-    RC_ENTRY ( rcNotAvailable, "not available" )
-    RC_ENTRY ( rcWrongType, "wrong type" )
-    RC_LAST ( rcLastState_v1_1 )
-};
-
-/* RAW_CTX
- *  form a context from parts
- */
-#define RAW_CTX( mod, targ, ctx )                   \
-    ( ( ( rc_t ) ( mod )  << 27 ) | /* 5 bits */    \
-      ( ( rc_t ) ( targ ) << 21 ) | /* 6 bits */    \
-      ( ( rc_t ) ( ctx )  << 14 ) ) /* 7 bits */
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*  _h_kfc_rc_ */
diff --git a/interfaces/kfc/rsrc.h b/interfaces/kfc/rsrc.h
deleted file mode 100644
index b852e90..0000000
--- a/interfaces/kfc/rsrc.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#ifndef _h_kfc_rsrc_
-#define _h_kfc_rsrc_
-
-#ifndef _h_kfc_defs_
-#include <kfc/defs.h>
-#endif
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KMemMgr;
-struct KConfig;
-struct KDBManager;
-struct VDBManager;
-
-
-/*--------------------------------------------------------------------------
- * KRsrc
- *  a very watered-down version of vdb-3 resource capabilities
- */
-typedef struct KRsrc KRsrc;
-struct KRsrc
-{
-    struct KMemMgr * mem;
-    struct KConfig * cfg;
-    struct KDBManager * kdb;
-    struct VDBManager * vdb;
-};
-
-
-/* Init
- *  initialize a local block from another
- */
-void KRsrcInit ( KRsrc *rsrc, ctx_t ctx );
-
-
-/* Whack
- *  release references
- */
-void KRsrcWhack ( KRsrc *self, ctx_t ctx );
-
-
-/*--------------------------------------------------------------------------
- * KRsrcBits
- *  bitfield definitions for optional resources
- *  for use in hybrid approach of VDB-2
- */
-enum KRsrcBits
-{
-    rbKDBManager = ( 1 << 0 ),
-    rbVDBManager = ( 1 << 1 )
-};
-
-#endif /* _h_kfc_rsrc_ */
diff --git a/interfaces/kfc/xc.h b/interfaces/kfc/xc.h
deleted file mode 100644
index c95aaa9..0000000
--- a/interfaces/kfc/xc.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#ifndef _h_kfc_xc_
-#define _h_kfc_xc_
-
-#ifndef _h_kfc_extern_
-#include <kfc/extern.h>
-#endif
-
-#ifndef _h_kfc_defs_
-#include <kfc/defs.h>
-#endif
-
-
-/*--------------------------------------------------------------------------
- * XOBJ
- *  objects that can have problems
- */
-XOBJ ( xoSelf, "target object reference", rcSelf );
-XOBJ ( xoParam, "parameter", rcParam );
-XOBJ ( xoString, "string", rcString );
-XOBJ ( xoMemory, "process memory", rcMemory );
-XOBJ ( xoError, "error", rcNoObj );
-XOBJ ( xoBehavior, "behavior", rcFunction );
-XOBJ ( xoTable, "table", rcTable );
-XOBJ ( xoCursor, "cursor", rcCursor );
-XOBJ ( xoColumn, "column", rcColumn );
-XOBJ ( xoInteger, "integer", rcParam );
-XOBJ ( xoRow, "row", rcRow );
-
-
-/*--------------------------------------------------------------------------
- * XSTATE
- *  states that things can be in
- */
-XSTATE ( xsIsNull, "is null", rcNull );
-XSTATE ( xsEmpty, "is empty", rcEmpty );
-XSTATE ( xsExhausted, "exhausted", rcExhausted );
-XSTATE ( xsUnexpected, "unexpected", rcUnexpected );
-XSTATE ( xsUnimplemented, "unimplemented", rcUnknown );
-XSTATE ( xsCreateFailed, "failed to create", rcUnknown );
-XSTATE ( xsOpenFailed, "failed to open", rcUnknown );
-XSTATE ( xsNotFound, "not found", rcNotFound );
-XSTATE ( xsReadFailed, "failed to read", rcUnknown );
-XSTATE ( xsOutOfBounds, "out of bounds", rcOutofrange );
-XSTATE ( xsAccessFailed, "failed to access", rcUnknown );
-
-
-/*--------------------------------------------------------------------------
- * XC
- *  error types
- */
-XC ( xcSelfNull, xoSelf, xsIsNull );
-XC ( xcParamNull, xoParam, xsIsNull );
-XC ( xcStringEmpty, xoString, xsEmpty );
-XC ( xcNoMemory, xoMemory, xsExhausted );
-XC ( xcUnexpected, xoError, xsUnexpected );
-XC ( xcUnimplemented, xoBehavior, xsUnimplemented );
-XC ( xcTableOpenFailed, xoTable, xsOpenFailed );
-XC ( xcCursorCreateFailed, xoCursor, xsCreateFailed );
-XC ( xcCursorOpenFailed, xoCursor, xsOpenFailed );
-XC ( xcColumnNotFound, xoColumn, xsNotFound );
-XC ( xcColumnReadFailed, xoColumn, xsReadFailed );
-XC ( xcIntegerOutOfBounds, xoInteger, xsOutOfBounds );
-XC ( xcCursorAccessFailed, xoCursor, xsAccessFailed );
-XC ( xcRowNotFound, xoRow, xsNotFound );
-
-
-
-#endif /* _h_kfc_xc_ */
diff --git a/interfaces/kfc/xcdefs.h b/interfaces/kfc/xcdefs.h
deleted file mode 100644
index 7d88abe..0000000
--- a/interfaces/kfc/xcdefs.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfc_xcdefs_
-#define _h_kfc_xcdefs_
-
-#ifndef _h_kfc_defs_
-#include <kfc/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * XCObj
- */
-typedef struct XCObj XCObj;
-struct XCObj
-{
-    const char *name;
-    const char *desc;
-    const XCObj *dad;
-    uint32_t rc_obj;
-};
-
-
-/*--------------------------------------------------------------------------
- * XCState
- */
-typedef struct XCState XCState;
-struct XCState
-{
-    const char *name;
-    const char *desc;
-    const XCState *dad;
-    uint32_t rc_state;
-};
-
-
-/*--------------------------------------------------------------------------
- * XCErr
- */
-typedef struct XCErr XCErr;
-struct XCErr
-{
-    const char *name;
-    const XCErr *dad;
-    const XCObj *obj;
-    const XCState *state;
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*  _h_kfc_xcdefs_ */
diff --git a/interfaces/kfc/xcext.h b/interfaces/kfc/xcext.h
deleted file mode 100644
index 712e262..0000000
--- a/interfaces/kfc/xcext.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfc_xcext_
-#define _h_kfc_xcext_
-
-/* turn off default macros */
-#define XC_DEFINE 1
-
-#ifdef _h_kfc_defs_
-#error "<kfc/defs.h> must not be included before <kfc/xcext.h>"
-#endif
-
-#ifndef _h_kfc_xcdefs_
-#include <kfc/xcdefs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define XOBJ( name, desc, rc )                  \
-    extern const XCObj name
-#define XOBJ_EXT( name, supr, desc, rc )        \
-    extern const XCObj name
-
-#define XSTATE( name, desc, rc )                \
-    extern const XCState name
-#define XSTATE_EXT( name, supr, desc, rc )      \
-    extern const XCState name
-
-#define XC( name, obj, state )                  \
-    extern const XCErr name
-#define XC_EXT( name, supr )                    \
-    extern const XCErr name
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfc_xcext_ */
diff --git a/interfaces/kfc/xcgen.h b/interfaces/kfc/xcgen.h
deleted file mode 100644
index 9a64311..0000000
--- a/interfaces/kfc/xcgen.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfc_xcgen_
-#define _h_kfc_xcgen_
-
-#ifndef _h_kfc_xcext_
-#include <kfc/xcext.h>
-#endif
-
-#ifndef _h_kfc_rc_
-#include <kfc/rc.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#undef XOBJ
-#undef XOBJ_EXT
-#undef XSTATE
-#undef XSTATE_EXT
-#undef XC
-#undef XC_EXT
-
-#define XOBJ( name, desc, rc )                          \
-    const XCObj name = { # name, desc, NULL, rc }
-#define XOBJ_EXT( name, supr, desc, rc )                \
-    const XCObj name = { # name, desc, & supr, rc }
-
-#define XSTATE( name, desc, rc )                        \
-    const XCState name = { # name, desc, NULL, rc }
-#define XSTATE_EXT( name, supr, desc, rc )              \
-    const XCState name = { # name, desc, & super, rc }
-
-#define XC( name, obj, state )                          \
-    const XCErr name = { # name, NULL, & obj, & state }
-#define XC_EXT( name, supr )                            \
-    const XCErr name = { # name, & supr }
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfc_xcgen_ */
diff --git a/interfaces/kfg/config.h b/interfaces/kfg/config.h
deleted file mode 100644
index 5e429c4..0000000
--- a/interfaces/kfg/config.h
+++ /dev/null
@@ -1,407 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfg_config_
-#define _h_kfg_config_
-
-#ifndef _h_kfg_extern_
-#include <kfg/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#include <stdarg.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * This flag has important ramifications to all programs.
- * If set then all programs that use KMain()/KMane() 
- * become dependant on the kfg and kfs libraries.
- *
- * This will also modify the behavior of program tear down.
- * if unset the memory used by the singleton config manager
- * will not be freed.
- */
-#define KFG_COMMON_CREATION 0
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KFile;
-struct KDirectory;
-struct KNamelist;
-struct VPath;
-struct String;
-
-/*--------------------------------------------------------------------------
- * KConfig
- *  configuration paramter manager
- */
-typedef struct KConfig KConfig;
-
-
-/* Make
- *  create a process-global configuration manager
- *
- *  "cfg" [ OUT ] - return parameter for mgr
- *
- *  "optional_search_base" [ IN, NULL OKAY ]
- */
-KFG_EXTERN rc_t CC KConfigMake ( KConfig **cfg,
-    struct KDirectory const * optional_search_base );
-
-/* AddRef
- * Release
- */
-KFG_EXTERN rc_t CC KConfigAddRef ( const KConfig *self );
-KFG_EXTERN rc_t CC KConfigRelease ( const KConfig *self );
-
-
-/* LoadFile
- * loads a configuration file
- */
-KFG_EXTERN rc_t CC KConfigLoadFile ( KConfig * self,
-    const char * path, struct KFile const * file );
-
-
-/* Commit
- *  commits changes to user's private configuration file
- */
-KFG_EXTERN rc_t CC KConfigCommit ( KConfig *self );
-
-/* ReadBool
- *  read a boolean node value
- *
- * self [ IN ] - KConfig object
- * path [ IN ] - path to the node
- * result [ OUT ] - return value (true if "TRUE", false if "FALSE"; rc != 0 if neither)
- *
- */
-KFG_EXTERN rc_t CC KConfigReadBool ( const KConfig* self, const char* path, bool* result );
-    
-/* ReadI64
- *  read an integer node value
- *
- * self [ IN ] - KConfig object
- * path [ IN ] - path to the node
- * result [ OUT ] - return value (rc != 0 if cannot be converted)
- *
- */
-KFG_EXTERN rc_t CC KConfigReadI64 ( const KConfig* self, const char* path, int64_t* result );
-
-/* ReadU64
- *  read an unsigned node value
- *
- * self [ IN ] - KConfig object
- * path [ IN ] - path to the node
- * result [ OUT ] - return value (rc != 0 if cannot be converted)
- *
- */
-KFG_EXTERN rc_t CC KConfigReadU64 ( const KConfig* self, const char* path, uint64_t* result );
-
-/* ReadF64
- *  read an F64 node value
- *
- * self [ IN ] - KConfig object
- * path [ IN ] - path to the node
- * result [ OUT ] - return value (rc != 0 if cannot be converted)
- *
- */
-KFG_EXTERN rc_t CC KConfigReadF64( const KConfig* self, const char* path, double* result );
-
-#if 0
-/*** NB - temporarily lives in vfs due to library interdependencies ***/
-
-/* ReadVPath
- *  read a VPath node value
- *
- * self [ IN ] - KConfig object
- * path [ IN ] - path to the node
- * result [ OUT ] - return value (rc != 0 if cannot be converted)
- *
- */
-KFG_EXTERN rc_t CC KConfigReadVPath ( const KConfig* self, const char* path, struct VPath** result );
-#endif
-
-/* ReadString
- *  read a String node value
- *
- * self [ IN ] - KConfig object
- * path [ IN ] - path to the node
- * result [ OUT, NUL-TERMINATED ] - return value; caller responsible for deallocation
- *
- */
-KFG_EXTERN rc_t CC KConfigReadString ( const KConfig* self, const char* path, struct String** result );
-
-
-/* Print
- *  print configuration to output handler (using OUTMSG)
- */
-KFG_EXTERN rc_t CC KConfigPrint ( const KConfig * self, int indent );
-
-
-/* ImportNgc
- *  import ngc file into current configuration
- *
- * self [ IN ] - KConfig object
- * path [ IN ] - path to the ngc file
- * pathToProtectedRepository [ IN, NULL OKAY ] - optional - the
- *  special value NULL is interpreted as ${HOME}/ncbi/dbGaP-$(Project #)
- * newRepoParentPath [ OUT, NULL OKAY ] - optional - 
- *  path to the new protected repository: should not be released!
- */
-KFG_EXTERN rc_t CC KConfigImportNgc(KConfig *self,
-    const char *ngcPath, const char *pathToProtectedRepository,
-    const char **newRepoParentPath);
-
-/* DisableUserSettings
- *  for testing purposes
- */
-KFG_EXTERN void CC KConfigDisableUserSettings ( void );
-
-
-/*--------------------------------------------------------------------------
- * KConfigNode
- *  node within configuration tree
- */
-typedef struct KConfigNode KConfigNode;
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-KFG_EXTERN rc_t CC KConfigNodeAddRef ( const KConfigNode *self );
-KFG_EXTERN rc_t CC KConfigNodeRelease ( const KConfigNode *self );
-
-
-KFG_EXTERN rc_t CC KConfigNodeGetMgr( const KConfigNode * self, KConfig ** mgr );
-
-/* OpenNodeRead
- * VOpenNodeRead
- *  opens a configuration node
- *
- *  "node" [ OUT ] - return parameter for indicated configuration node
- *
- *  "path" [ IN, NULL OKAY ] - optional path for specifying named
- *  node within configuration hierarchy. paths will be interpreted as
- *  if they were file system paths, using '/' as separator. the
- *  special values NULL and "" are interpreted as "."
- */
-KFG_EXTERN rc_t CC KConfigOpenNodeRead ( const KConfig *self,
-    const KConfigNode **node, const char *path, ... );
-KFG_EXTERN rc_t CC KConfigNodeOpenNodeRead ( const KConfigNode *self,
-    const KConfigNode **node, const char *path, ... );
-
-KFG_EXTERN rc_t CC KConfigVOpenNodeRead ( const KConfig *self,
-    const KConfigNode **node, const char *path, va_list args );
-KFG_EXTERN rc_t CC KConfigNodeVOpenNodeRead ( const KConfigNode *self,
-    const KConfigNode **node, const char *path, va_list args );
-
-
-/* OpenNodeUpdate
- * VOpenNodeUpdate
- *  opens a configuration node
- *
- *  "node" [ OUT ] - return parameter for indicated configuration node
- *
- *  "path" [ IN, NULL OKAY ] - optional path for specifying named
- *  node within configuration hierarchy. paths will be interpreted as
- *  if they were file system paths, using '/' as separator. the
- *  special values NULL and "" are interpreted as "."
- */
-KFG_EXTERN rc_t CC KConfigOpenNodeUpdate ( KConfig *self,
-    KConfigNode **node, const char *path, ... );
-KFG_EXTERN rc_t CC KConfigNodeOpenNodeUpdate ( KConfigNode *self,
-    KConfigNode **node, const char *path, ... );
-
-KFG_EXTERN rc_t CC KConfigVOpenNodeUpdate ( KConfig *self,
-    KConfigNode **node, const char *path, va_list args );
-KFG_EXTERN rc_t CC KConfigNodeVOpenNodeUpdate ( KConfigNode *self,
-    KConfigNode **node, const char *path, va_list args );
-
-
-/* Read
- *  read a node value
- *
- *  "offset" [ IN ] - initial offset into configuration
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT ] - number of bytes actually read
- *
- *  "remaining" [ OUT, NULL OKAY ] - optional return parameter for
- *  the number of bytes remaining to be read.
- *  specifically, "offset" + "num_read" + "remaining" == sizeof node data
- */
-KFG_EXTERN rc_t CC KConfigNodeRead ( const KConfigNode *self,
-    size_t offset, char *buffer, size_t bsize,
-    size_t *num_read, size_t *remaining );
-
-/* ReadBool
- *  read a boolean node value
- *
- * self [ IN ] - KConfigNode object
- * result [ OUT ] - return value (true if "TRUE", false if "FALSE"; rc != 0 if neither)
- *
- */
-KFG_EXTERN rc_t CC KConfigNodeReadBool ( const KConfigNode *self, bool* result );
-    
-/* ReadI64
- *  read an integer node value
- *
- * self [ IN ] - KConfigNode object
- * result [ OUT ] - return value (rc != 0 if cannot be converted)
- *
- */
-KFG_EXTERN rc_t CC KConfigNodeReadI64 ( const KConfigNode *self, int64_t* result );
-
-/* ReadU64
- *  read an unsigned node value
- *
- * self [ IN ] - KConfigNode object
- * result [ OUT ] - return value (rc != 0 if cannot be converted)
- *
- */
-KFG_EXTERN rc_t CC KConfigNodeReadU64 ( const KConfigNode *self, uint64_t* result );
-
-/* ReadF64
- *  read an F64 node value
- *
- * self [ IN ] - KConfigNode object
- * result [ OUT ] - return value (rc != 0 if cannot be converted)
- *
- */
-KFG_EXTERN rc_t CC KConfigNodeReadF64 ( const KConfigNode *self, double* result );
-
-#if 0
-/*** NB - temporarily lives in vfs due to library interdependencies ***/
-
-/* ReadVPath
- *  read a VPath node value
- *
- * self [ IN ] - KConfigNode object
- * result [ OUT ] - return value (rc != 0 if cannot be converted)
- *
- */
-KFG_EXTERN rc_t CC KConfigNodeReadVPath ( const KConfigNode *self, struct VPath** result );
-#endif
-
-/* ReadString
- *  read a String node value
- *
- * self [ IN ] - KConfigNode object
- * result [ OUT ] - return value; caller responsible for deallocation
- *
- */
-KFG_EXTERN rc_t CC KConfigNodeReadString ( const KConfigNode *self, struct String** result );
-
-/* ListChildren - nee ListChild
- *  list all named children
- */
-#define KConfigNodeListChild KConfigNodeListChildren
-KFG_EXTERN rc_t CC KConfigNodeListChildren ( const KConfigNode *self,
-    struct KNamelist **names );
-
-
-/* Write
- *  write a node value or attribute
- *  overwrites anything already there
- *
- *  "buffer" [ IN ] and "size" [ IN ] - new value data
- */
-KFG_EXTERN rc_t CC KConfigNodeWrite ( KConfigNode *self, const char *buffer, size_t size );
-
-
-/* Append
- *  append data to value
- *
- *  "buffer" [ IN ] and "size" [ IN ] - value data to be appended
- */
-KFG_EXTERN rc_t CC KConfigNodeAppend ( KConfigNode *self, const char *buffer, size_t size );
-
-
-/* ReadAttr
- *  reads as NUL-terminated string
- *
- *  "name" [ IN ] - NUL terminated attribute name
- *
- *  "buffer" [ OUT ] and "bsize" - return parameter for attribute value
- *
- *  "size" [ OUT ] - return parameter giving size of string
- *  not including NUL byte. the size is set both upon success
- *  and insufficient buffer space error.
- */
-KFG_EXTERN rc_t CC KConfigNodeReadAttr ( const KConfigNode *self, const char *name,
-    char *buffer, size_t bsize, size_t *size );
-
-
-/* WriteAttr
- *  writes NUL-terminated string
- *
- *  "name" [ IN ] - NUL terminated attribute name
- *
- *  "value" [ IN ] - NUL terminated attribute value
- */
-KFG_EXTERN rc_t CC KConfigNodeWriteAttr ( KConfigNode *self,
-    const char *name, const char *value );
-
-
-/* Drop
- * VDrop
- *  drop some or all node content
- */
-KFG_EXTERN rc_t CC KConfigNodeDropAll ( KConfigNode *self );
-KFG_EXTERN rc_t CC KConfigNodeDropAttr ( KConfigNode *self, const char *attr );
-KFG_EXTERN rc_t CC KConfigNodeDropChild ( KConfigNode *self, const char *path, ... );
-KFG_EXTERN rc_t CC KConfigNodeVDropChild ( KConfigNode *self, const char *path, va_list args );
-
-
-/* Rename
- *  renames a contained object
- *
- *  "from" [ IN ] - NUL terminated string in UTF-8
- *  giving simple name of existing attr
- *
- *  "to" [ IN ] - NUL terminated string in UTF-8
- *  giving new simple attr name
- */
-KFG_EXTERN rc_t CC KConfigNodeRenameAttr ( KConfigNode *self, const char *from, const char *to );
-KFG_EXTERN rc_t CC KConfigNodeRenameChild ( KConfigNode *self, const char *from, const char *to );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfg_config_ */
diff --git a/interfaces/kfg/extern.h b/interfaces/kfg/extern.h
deleted file mode 100644
index 47e2f43..0000000
--- a/interfaces/kfg/extern.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfg_extern_
-#define _h_kfg_extern_
-
-#if ! defined EXPORT_LATCH && defined _LIBRARY
-#define KFG_EXTERN LIB_EXPORT
-#define EXPORT_LATCH 1
-#else
-#define KFG_EXTERN LIB_IMPORT
-#endif
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#endif /* _h_kfg_extern_ */
diff --git a/interfaces/kfg/kart.h b/interfaces/kfg/kart.h
deleted file mode 100644
index fa54fd4..0000000
--- a/interfaces/kfg/kart.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfg_kart_
-#define _h_kfg_kart_
-
-#ifndef _h_kfg_extern_
-#include <kfg/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifndef _h_klib_text_
-#include <klib/text.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct KDirectory;
-
-/* AA-833 */
-
-typedef struct KartItem KartItem;
-
-KFG_EXTERN rc_t CC KartItemAddRef(const KartItem *self);
-KFG_EXTERN rc_t CC KartItemRelease(const KartItem *self);
-
-/** Do not release the returned String !
- *  N.B. returned String is not required to be NULL-terminated !
-KFG_EXTERN rc_t CC KartItemTypeId(const KartItem *self, const String **elem);
- */
-KFG_EXTERN rc_t CC KartItemProjId(const KartItem *self, const String **elem);
-KFG_EXTERN rc_t CC KartItemProjIdNumber(const KartItem *self, uint64_t *id);
-KFG_EXTERN rc_t CC KartItemItemId(const KartItem *self, const String **elem);
-KFG_EXTERN rc_t CC KartItemItemIdNumber(const KartItem *self, uint64_t *id);
-KFG_EXTERN rc_t CC KartItemAccession(const KartItem *self, const String **elem);
-KFG_EXTERN rc_t CC KartItemName(const KartItem *self, const String **elem);
-KFG_EXTERN rc_t CC KartItemItemDesc(const KartItem *self, const String **elem);
-
-typedef struct Kart Kart;
-
-KFG_EXTERN rc_t CC KartAddRef(const Kart *self);
-KFG_EXTERN rc_t CC KartRelease(const Kart *self);
-
-KFG_EXTERN rc_t CC KartMake(const struct KDirectory *dir, const char *path,
-    Kart **kart, bool *isKart);
-#ifdef _DEBUGGING
-KFG_EXTERN rc_t CC KartMakeText(const struct KDirectory *dir, const char *path,
-    Kart **kart, bool *isKart);
-#endif
-
-KFG_EXTERN rc_t CC KartPrint(const Kart *self);
-KFG_EXTERN rc_t CC KartPrintNumbered(const Kart *self);
-
-KFG_EXTERN rc_t CC KartMakeNextItem(Kart *self, const KartItem **item);
-
-KFG_EXTERN rc_t CC KartItemsProcessed(const Kart *self, uint16_t *number);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfg_kart_ */
diff --git a/interfaces/kfg/keystore-priv.h b/interfaces/kfg/keystore-priv.h
deleted file mode 100644
index f86ac3d..0000000
--- a/interfaces/kfg/keystore-priv.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfg_keystore_priv_
-#define _h_kfg_keystore_priv_
-
-#ifndef _h_kfg_keystore_
-#include <kfg/keystore.h>
-#endif
-
-#ifndef _h_klib_refcount_
-#include <klib/refcount.h>
-#endif
-
-#ifndef _h_klib_text_
-#include <klib/text.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- KEncryptionKey
- */
- struct KEncryptionKey
- {
-    KRefcount   refcount;
-    String      value; /* 0-terminator is not included */
- };
-
-KFG_EXTERN rc_t CC KEncryptionKeyMake(const char* value, KEncryptionKey** key);
- 
-/*--------------------------------------------------------------------------
- KKeyStore 
- */
-#ifndef KKEYSTORE_IMPL
-    #define KKEYSTORE_IMPL struct KKeyStore
-#endif
-
-typedef struct KKeyStore_vt_v1_struct {
-    /* version == 1.x */
-    uint32_t maj;
-    uint32_t min;
-
-    /* start minor version == 0 */
-    rc_t ( *destroy   )                 ( KKEYSTORE_IMPL* self );
-    rc_t ( *getKey )                    ( const KKEYSTORE_IMPL* self, const char* obj_key, KEncryptionKey** enc_key);
-    /* end minor version == 0 */
-
-} KKeyStore_vt_v1;
-
-typedef union KKeyStore_vt {
-    KKeyStore_vt_v1* v1;
-} KKeyStore_vt;
-
-/* KKeyStoreSetConfig
- * Specify the Config object used by the KeyStore object. If the object is not specified, one will be created 
- * when required using KConfigMake
- *
- * kfg [ IN, NULL OK ] if NULL, forget the current kfg object
- */
-KFG_EXTERN rc_t CC KKeyStoreSetConfig(struct KKeyStore* self, const struct KConfig* kfg);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfg_keystore_priv_ */
diff --git a/interfaces/kfg/keystore.h b/interfaces/kfg/keystore.h
deleted file mode 100644
index 92fd7b7..0000000
--- a/interfaces/kfg/keystore.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfg_keystore_
-#define _h_kfg_keystore_
-
-#ifndef _h_kfg_extern_
-#include <kfg/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct KFile;
-struct KConfig;
-struct String;
-
-/*--------------------------------------------------------------------------
- * KEncryptionKey
- *  Encryption key, reference-counted and kept in non-swappable memory
- */
-typedef struct KEncryptionKey KEncryptionKey;
-
-KFG_EXTERN rc_t CC KEncryptionKeyAddRef ( struct KEncryptionKey *self );
-KFG_EXTERN rc_t CC KEncryptionKeyRelease ( struct KEncryptionKey *self );
-
-
-/*--------------------------------------------------------------------------
- * KKeyStore
- *  Encryption key storage interface
- */
-typedef struct KKeyStore KKeyStore;
-
- /* all strings are NUL-terminated */
- 
-/* AddRef
- */
-KFG_EXTERN rc_t CC KKeyStoreAddRef ( const KKeyStore *self );
-/* Release
- */
-KFG_EXTERN rc_t CC KKeyStoreRelease ( const KKeyStore *self );
-
-/* 
- * KKeyStoreSetTemporaryKeyFromFile
- *
- *  set a temporarily encryption key 
- *  the key will only be maintained for this instance of KKeyStore (use for externally supplied keys).
- * 
- *  enc_file[ IN, NULL OK ] - open KFile containing the key (characters after the first \n are ignored)
- *  if NULL is specified, forget the previously set temporary key
- */
-KFG_EXTERN rc_t CC KKeyStoreSetTemporaryKeyFromFile(KKeyStore* self, const struct KFile* enc_file);
-
-/* KKeyStoreGetKey
- *  returns the encryption key associated with the specified object
- * 
- *  obj_key [ IN, NULL OK ] - NUL-terminated key of the object in question. The key can be an accession name, or a file system path.
- *      If NULL, will return the current protected repository's key, or, if not within a protected repository, the global key if available
- *      from environment or configuration 
- *  enc_key [ OUT ] 
- */
-KFG_EXTERN rc_t CC KKeyStoreGetKey(const KKeyStore* self, const char* obj_key, KEncryptionKey** enc_key);
-
-/*
- * Registering bindings between numeric object Ids and object names
- */                                        
- 
-/* KKeyStoreSetBindingsFile
- *  Specifies location of a bindings file used by this instance of KeyStore. 
- *  If never set or set to NULL, uses default location ($NCBI_HOME/objid.mapping)
- * 
- * self [ IN ] - KKeyStore object
- * path [ IN, NUL-TERMINATED, NULL OK ] - pathname to the bindings file. If NULL, reset to default location ($NCBI_HOME/objid.mapping)
- */
-KFG_EXTERN rc_t CC KKeyStoreSetBindingsFile(struct KKeyStore* self, const char* path);
-
-/* KKeyStoreGetBindingsFile
- *  Returns location of a bindings file used by this instance of KeyStore. 
- * 
- * self [ IN ] - KKeyStore object
- * returns pathname to the bindings file. If NULL, default location will be used when needed
- */
-KFG_EXTERN const char* KKeyStoreGetBindingsFile(const struct KKeyStore* self);
- 
-/* KKeyStoreRegisterObject
- *  registers a binding between an object Id and an object name 
- * 
- * self [ IN ] - KKeyStore object
- * oid [ IN ] - object id
- * obj [ IN ] - object's name (any characters except '\r' and '\n' )
- */
-KFG_EXTERN rc_t CC KKeyStoreRegisterObject(struct KKeyStore* self, uint32_t oid, const struct String* name);
-
-/* KKeyStoreGetObjectId
- *  look up an object id by an object name 
- * 
- * self [ IN ] - KKeyStore object
- * obj [ IN ] - object's name 
- * oid [ OUT ] - object id
- */
-KFG_EXTERN rc_t CC VKKeyStoreGetObjectId(const struct KKeyStore* self, const struct String* name, uint32_t* oid);
-
-/* KKeyStoreGetObjectName
- *  look up an object name by an object id
- * 
- * self [ IN ] - KKeyStore object
- * obj [ IN ] - object's name 
- * oid [ OUT ] - object id
- */
-KFG_EXTERN rc_t CC KKeyStoreGetObjectName(const struct KKeyStore* self, uint32_t oid, const struct String** name);
-
-
-/* KKeyStoreMake
- * Creates a non-keyring implementation, which uses a combination of location-based and global encryption keys.
- * 
- * self [ OUT ]
- * kfg [ IN, NULL OK ] - optional config object to use
- */
-KFG_EXTERN rc_t CC KKeyStoreMake(KKeyStore** self, struct KConfig* kfg);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfg_keystore_ */
diff --git a/interfaces/kfg/kfg-priv.h b/interfaces/kfg/kfg-priv.h
deleted file mode 100644
index 8a7320d..0000000
--- a/interfaces/kfg/kfg-priv.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*==============================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfg_priv_
-#define _h_kfg_priv_
-
-#ifndef _h_kfg_extern_
-#include <kfg/extern.h>
-#endif
-
-#ifndef _h_kfg_config_
-#include <kfg/config.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KDirectory;
-struct KNamelist;
-
-
-/*--------------------------------------------------------------------------
- * Environment and configuration keys
- */
-#define ENV_KRYPTO_PWFILE   "VDB_PWFILE"
-#define KFG_KRYPTO_PWFILE   "krypto/pwfile"
-#define KFG_KRYPTO_PWFD     "krypto/pwfd"
-
-/*--------------------------------------------------------------------------
- * KConfig
- *  configuration paramter manager
- */
-
-/* ListIncluded
- *  list all included files
- */
-KFG_EXTERN rc_t CC KConfigListIncluded ( const KConfig *self,
-    struct KNamelist **names );
-
-/* GetLoadPath
- *  return colon-separated search path to load KConfig
- * NB. path should not be released
- */
-KFG_EXTERN rc_t CC KConfigGetLoadPath ( const KConfig *self,
-    const char **path );
-
-/* MakeLocal
- *  make a KConfig object that avoids singleton
- */
-KFG_EXTERN rc_t CC KConfigMakeLocal ( KConfig **cfg,
-    struct KDirectory const * cfgdir );
-
-/* PrintDebug
- *  print configuration including some internal nodes information
- */
-KFG_EXTERN rc_t CC KConfigPrintDebug ( const KConfig *self,
-    const char *root_node_name );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfg_priv_ */
diff --git a/interfaces/kfg/repository.h b/interfaces/kfg/repository.h
deleted file mode 100644
index 2bb998b..0000000
--- a/interfaces/kfg/repository.h
+++ /dev/null
@@ -1,290 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfg_repository_
-#define _h_kfg_repository_
-
-#ifndef _h_kfg_extern_
-#include <kfg/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KConfig;
-
-/*--------------------------------------------------------------------------
- * KRepository
- *  presents structured access to a storage repository
- *  as modeled in KConfig.
- *
- *  all objects are obtained via KRepositoryMgr ( see below )
- */
-typedef struct KRepository KRepository;
-
-
-/* AddRef
- * Release
- */
-KFG_EXTERN rc_t CC KRepositoryAddRef ( const KRepository *self );
-KFG_EXTERN rc_t CC KRepositoryRelease ( const KRepository *self );
-
-
-/* Category
- * SubCategory
- *  tells what the repository category or sub-category are
- *  or returns "bad" if the repository object is not usable.
- */
-typedef uint32_t KRepCategory;
-enum
-{
-    krepBadCategory,
-    krepUserCategory,
-    krepSiteCategory,
-    krepRemoteCategory
-};
-
-typedef uint32_t KRepSubCategory;
-enum
-{
-    krepBadSubCategory,
-    krepMainSubCategory,
-    krepAuxSubCategory,
-    krepProtectedSubCategory
-};
-
-KFG_EXTERN KRepCategory CC KRepositoryCategory ( const KRepository *self );
-KFG_EXTERN KRepSubCategory CC KRepositorySubCategory ( const KRepository *self );
-
-
-/* Name
- *  get the repository name
- *  attempts to copy NUL-terminated name into provided buffer
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - name output parameter
- *
- *  "name_size" [ OUT, NULL OKAY ] - returns the name size in
- *  bytes, excluding any NUL termination.
- */
-KFG_EXTERN rc_t CC KRepositoryName ( const KRepository *self,
-    char *buffer, size_t bsize, size_t *name_size );
-
-
-/* DisplayName
- *  get the repository display name,
- *  if different from its actual name
- *
- *  attempts to copy NUL-terminated name into provided buffer
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - name output parameter
- *
- *  "name_size" [ OUT, NULL OKAY ] - returns the name size in
- *  bytes, excluding any NUL termination.
- */
-KFG_EXTERN rc_t CC KRepositoryDisplayName ( const KRepository *self,
-    char *buffer, size_t bsize, size_t *name_size );
-
-
-/* Root
- *  read the root path as a POSIX path or URL
- *
- *  attempts to copy NUL-terminated path into provided buffer
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - path output parameter
- *
- *  "root_size" [ OUT, NULL OKAY ] - returns the path size in
- *  bytes, excluding any NUL termination.
- */
-KFG_EXTERN rc_t CC KRepositoryRoot ( const KRepository *self,
-    char *buffer, size_t bsize, size_t *root_size );
-
-
-/* Disabled
- *  discover whether the repository is enabled
- */
-KFG_EXTERN bool CC KRepositoryDisabled ( const KRepository *self );
-
-
-/* Set Disabled
- *  changes the status of a repository, writes status into kfg-file on disk
- *  disabled = true  ... disables the repository
- *  disabled = false ... enables the repository
- */
-KFG_EXTERN rc_t CC KRepositorySetDisabled ( const KRepository *self, bool disabled );
-
-
-/* CacheEnabled
- *  discover whether the repository supports caching
- */
-KFG_EXTERN bool CC KRepositoryCacheEnabled ( const KRepository *self );
-
-
-/* DownloadTicket
- *  return any associated download ticket
- *
- *  attempts to copy NUL-terminated ticket into provided buffer
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - ticket output parameter
- *
- *  "ticket_size" [ OUT, NULL OKAY ] - returns the ticket size in
- *  bytes, excluding any NUL termination.
- */
-KFG_EXTERN rc_t CC KRepositoryDownloadTicket ( const KRepository *self,
-    char *buffer, size_t bsize, size_t *ticket_size );
-
-
-/* EncryptionKey
- *  return any associated encryption key
- *
- *  attempts to copy NUL-terminated key into provided buffer
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - encryption key output parameter
- *
- *  "key_size" [ OUT, NULL OKAY ] - returns the key size in
- *  bytes, excluding any NUL termination.
- */
-KFG_EXTERN rc_t CC KRepositoryEncryptionKey ( const KRepository *self,
-    char *buffer, size_t bsize, size_t *key_size );
-
-
-/* EncryptionKeyFile
- *  return path to any associated encryption key file
- *
- *  attempts to copy NUL-terminated path into provided buffer
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - key file path output parameter
- *
- *  "path_size" [ OUT, NULL OKAY ] - returns the path size in
- *  bytes, excluding any NUL termination.
- */
-KFG_EXTERN rc_t CC KRepositoryEncryptionKeyFile ( const KRepository *self,
-    char *buffer, size_t bsize, size_t *path_size );
-
-
-/* Description
- *  return any associated descriptive text
- *
- *  attempts to copy NUL-terminated description into provided buffer
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - description text output parameter
- *
- *  "desc_size" [ OUT, NULL OKAY ] - returns the text size in
- *  bytes, excluding any NUL termination.
- */
-KFG_EXTERN rc_t CC KRepositoryDescription ( const KRepository *self,
-    char *buffer, size_t bsize, size_t *desc_size );
-
-/* Description
- *  register an encrypted object in association with the repository's encryption key
- */
-KFG_EXTERN rc_t CC KRepositoryRegisterObject ( const KRepository *self, const char* object_id );
-
-
-/*--------------------------------------------------------------------------
- * KRepositoryVector
- *  uses Vector API
- *  holds zero or more KRepository objects
- */
-typedef struct Vector KRepositoryVector;
-
-
-/* Whack
- *  destroy your vector
- */
-KFG_EXTERN rc_t CC KRepositoryVectorWhack ( KRepositoryVector *self );
-
-
-/*--------------------------------------------------------------------------
- * KRepositoryMgr
- *  manages structured access to repositories
- */
-typedef struct KRepositoryMgr KRepositoryMgr;
-
-
-/* Make
- *  create a repository manager
- *  uses values from "self"
- *
- *  mgr [ OUT ] 
- */
-KFG_EXTERN rc_t CC KConfigMakeRepositoryMgrRead ( struct KConfig const *self, const KRepositoryMgr **mgr );
-KFG_EXTERN rc_t CC KConfigMakeRepositoryMgrUpdate ( struct KConfig *self, KRepositoryMgr **mgr );
-
-
-/* AddRef
- * Release
- */
-KFG_EXTERN rc_t CC KRepositoryMgrAddRef ( const KRepositoryMgr *self );
-KFG_EXTERN rc_t CC KRepositoryMgrRelease ( const KRepositoryMgr *self );
-
-
-/* UserRepositories
- *  retrieve all user repositories in a Vector
- */
-KFG_EXTERN rc_t CC KRepositoryMgrUserRepositories ( const KRepositoryMgr *self,
-    KRepositoryVector *user_repositories );
-
-
-/* SiteRepositories
- *  retrieve all site repositories in a Vector
- */
-KFG_EXTERN rc_t CC KRepositoryMgrSiteRepositories ( const KRepositoryMgr *self,
-    KRepositoryVector *site_repositories );
-
-
-/* RemoteRepositories
- *  retrieve all remote repositories in a Vector
- */
-KFG_EXTERN rc_t CC KRepositoryMgrRemoteRepositories ( const KRepositoryMgr *self,
-    KRepositoryVector *remote_repositories );
-
-/* CurrentProtectedRepository
- *  returns the currently active user protected repository
- */
-KFG_EXTERN rc_t CC KRepositoryMgrCurrentProtectedRepository ( const KRepositoryMgr *self,
-    const KRepository **p_protected );
-
-/* GetProtectedRepository
- *  retrieves a (read-only) user protected repository by its associated project-id
- */
-KFG_EXTERN rc_t CC KRepositoryMgrGetProtectedRepository ( const KRepositoryMgr *self, 
-    uint32_t projectId, 
-    const KRepository **p_protected );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfg_repository_ */
diff --git a/interfaces/kfs/arc.h b/interfaces/kfs/arc.h
deleted file mode 100644
index 8eca2fe..0000000
--- a/interfaces/kfs/arc.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_arc_
-#define _h_kfs_arc_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#include <kfs/toc.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct KDirectory;
-struct KFile;
-struct KToc;
-struct vector;
-
-/* validate_header_offsets
- *	This function is a special friend function to the archive package used
- *	to validate that the compiler used to build the package matches 
- *	used structure offsets "correctly" to enable the parsing of TAR files.
- * NOTE:
- *	This function should not be used except by ktartest (klib/tools/ktartest.c).
- *	It is built only in a special logging version of the libraries.
- */
-KFS_EXTERN bool CC validate_header_offsets(void);
-
-typedef struct KArcDir KArcDir;
-typedef struct KArcFile KArcFile;
-
-typedef uint32_t KArcFSType;
-enum eKArcFSType
-{
-    tocUnknown,
-    tocKFile,
-    tocKDirectory,
-    tocKVirtual
-};
-
-
-/* OpenArcDirRead
- *
- * This should probably move into the toc-priv with a specific call to open each archive type
- * with the parse private and not needing the dad-gummed CC and KFS_EXTERN
- *  Open an archive file as a KDirectory derived type: made to match 
- *  KDirectoryOpenDirRead() where parse could be the first element of arg
- *
- * [IN]  dir    A KDirectory (of any derived type) to reach the archive file
- * [OUT] pdir   The KDirectory (of type KArcDir) that will be created
- * [IN]  chroot if non-zero, the new directory becomes chroot'd and interprets paths
- *      stating with '/'
- * [IN]  path   The path to the archive - this will become the directory path
- * [IN]  parse  A pointer to the function needed to build a TOC by parsing the file
- *
- * parameters to parse
- * REQUIRED:    KToc *
- * REQUIRED:    void *  KFile* | KDirectory* | ???
- * OPTIONAL:    bool (*)(const char*)           Filter: include or skip this path
- * OPTIONAL:    rc_t (*)(???)               Sort: reorder name list
- */
-KFS_EXTERN rc_t CC KDirectoryOpenArcDirRead(const struct KDirectory * self, 
-    const struct KDirectory ** pdir, bool chroot, const char * path, KArcFSType baseType,
-    rc_t ( CC * parse )(struct KToc *,const void *,
-        bool( CC * )(const struct KDirectory*, const char *, void*), void*),
-        bool (CC* filter )(const KDirectory*, const char *, void *), void * filterparam);
-
-KFS_EXTERN rc_t CC KDirectoryOpenArcDirRead_silent(const struct KDirectory * self, 
-    const struct KDirectory ** pdir, bool chroot, const char * path, KArcFSType baseType,
-    rc_t ( CC * parse )(struct KToc *,const void *,
-        bool( CC * )(const struct KDirectory*, const char *, void*), void*),
-        bool (CC* filter )(const KDirectory*, const char *, void *), void * filterparam);
-
-KFS_EXTERN rc_t CC KDirectoryOpenArcDirRead_silent_preopened(const struct KDirectory * self, 
-    const struct KDirectory ** pdir, bool chroot, const char * path, KArcFSType baseType,
-    void * f,
-    rc_t ( CC * parse )(struct KToc *,const void *,
-        bool( CC * )(const struct KDirectory*, const char *, void*), void*),
-        bool (CC* filter )(const KDirectory*, const char *, void *), void * filterparam);
-
-
-
-
-
-#if 0
-/* ----------------------------------------------------------------------
- * KDirectoryToKArcDir
- *
- * [IN]  const KDirectory * 	self	Object oriented C
- * [OUT] const KArcDir * 	cast	Object oriented C
- *
- *
- * Get a reference to a KArcDir from a KDirectory as a cast.  It is a new reference.
- */
-
-KFS_EXTERN rc_t CC KDirectoryToKArcDir (const KDirectory * self, const KArcDir ** cast);
-
-KFS_EXTERN rc_t CC KArcDirList ( const KArcDir *self, struct KNamelist **list,
-    bool ( CC * f ) ( const KArcDir *dir, const char *name, void *data ),
-    void *data, const char *path, ... );
-KFS_EXTERN rc_t CC KArcDirVList ( const KArcDir *self, struct KNamelist **list,
-    bool ( CC * f ) ( const KArcDir *dir, const char *name, void *data ),
-    void *data, const char *path, va_list args );
-#endif
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_arc_ */
diff --git a/interfaces/kfs/arrayfile.h b/interfaces/kfs/arrayfile.h
deleted file mode 100644
index 079c92c..0000000
--- a/interfaces/kfs/arrayfile.h
+++ /dev/null
@@ -1,180 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_arrayfile_
-#define _h_kfs_arrayfile_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifndef _h_klib_namelist_
-#include <klib/namelist.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KFile;
-
-
-/*--------------------------------------------------------------------------
- * KArrayFile
- *  an array-file is created from a KFile
- */
-typedef struct KArrayFile KArrayFile;
-
-
-/* Make
- *  make an array file from a KFile
- */
-/*
-KFS_EXTERN rc_t CC KArrayFileMakeRead ( const KArrayFile **af, struct KFile const *file );
-KFS_EXTERN rc_t CC KArrayFileMakeUpdate ( KArrayFile **af, struct KFile *file );
-*/
-
-
-/* AddRef
- * Release
- *  ignores NULL references
- */
-KFS_EXTERN rc_t CC KArrayFileAddRef ( const KArrayFile *self );
-KFS_EXTERN rc_t CC KArrayFileRelease ( const KArrayFile *self );
-
-
-/* Dimensionality
- *  returns the number of dimensions in the ArrayFile
- *
- *  "dim" [ OUT ] - return parameter for number of dimensions
- */
-KFS_EXTERN rc_t CC KArrayFileDimensionality ( const KArrayFile *self, uint8_t *dim );
-
-
-/* SetDimensionality
- *  sets the number of dimensions in the ArrayFile
- *
- *  "dim" [ IN ] - new number of dimensions; must be > 0
- */
-KFS_EXTERN rc_t CC KArrayFileSetDimensionality ( KArrayFile *self, uint8_t dim );
-
-
-/* DimExtents
- *  returns the extent of every dimension
- *
- *  "dim" [ IN ] - the dimensionality of "extents"
- *
- *  "extents" [ OUT ] - returns the extent for every dimension
- */
-KFS_EXTERN rc_t CC KArrayFileDimExtents ( const KArrayFile *self, uint8_t dim, uint64_t *extents );
-
-
-/* SetDimExtents
- *  sets the new extents for every dimension
- *
- *  "dim" [ IN ] - the dimensionality of "extents"
- *
- *  "extents" [ IN ] - new extents for every dimension
- */
-KFS_EXTERN rc_t CC KArrayFileSetDimExtents ( KArrayFile *self, uint8_t dim, uint64_t *extents );
-
-
-/* ElementSize
- *  returns the element size in bits
- *
- *  "elem_bits" [ OUT ] - size of each element in bits
- */
-KFS_EXTERN rc_t CC KArrayFileElementSize ( const KArrayFile *self, uint64_t *elem_bits );
-
-
-/* Read
- *  read from n-dimensional position
- *
- *  "dim" [ IN ] - the dimensionality of all vectors
- *
- *  "pos"  [ IN ] - n-dimensional starting position in elements
- *
- *  "buffer" [ OUT ] and "elem_count" [ IN ] - return buffer for read
- *  where "elem_count" is n-dimensional in elements
- *
- *  "num_read" [ OUT ] - n-dimensional return parameter giving back
- *      the number of read elements in every dimension
- */
-KFS_EXTERN rc_t CC KArrayFileRead ( const KArrayFile *self, uint8_t dim,
-    const uint64_t *pos, void *buffer, const uint64_t *elem_count,
-    uint64_t *num_read );
-
-
-/* Read_v
- *  read one element of variable length from n-dimensional position
- *
- *  "dim" [ IN ] - the dimensionality of all vectors
- *
- *  "pos"  [ IN ] - n-dimensional starting position in elements
- *
- *  "buffer" [ OUT ] and "elem_count" [ IN ] - return buffer for read
- *  where "elem_count" is length of buffer in elements
- *
- *  "num_read" [ OUT ] - return parameter giving back
- *      the number of read elements in every dimension
- */
-KFS_EXTERN rc_t CC KArrayFileRead_v ( const KArrayFile *self, uint8_t dim,
-    const uint64_t *pos, void *buffer, const uint64_t elem_count,
-    uint64_t *num_read );
-
-
-/* Write
- *  write into n-dimensional position
- *
- *  "dim" [ IN ] - the dimensionality of all vectors
- *
- *  "pos"  [ IN ] - n-dimensional offset where to write to
- *                   in elements
- *
- *  "buffer" [ IN ] and "elem_count" [ IN ] - data to be written
- *  where "elem_count" is n-dimensional in elements
- *
- *  "num_writ" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of elements actually written per dimension
- */
-KFS_EXTERN rc_t CC KArrayFileWrite ( KArrayFile *self, uint8_t dim,
-    const uint64_t *pos, const void *buffer, const uint64_t *elem_count,
-    uint64_t *num_writ );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_arrayfile_ */
diff --git a/interfaces/kfs/buffile.h b/interfaces/kfs/buffile.h
deleted file mode 100644
index f32837b..0000000
--- a/interfaces/kfs/buffile.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_buffile_
-#define _h_kfs_buffile_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KFile;
-
-
-/*--------------------------------------------------------------------------
- * KFile
- */
-
-/* MakeBufferedRead
- *  make a read-only file buffer
- *
- *  "buf" [ OUT ] - return parameter for new buffered file
- *
- *  "original" [ IN ] - source file to be buffered. must have read access
- *
- *  "bsize" [ IN ] - buffer size
- */
-KFS_EXTERN rc_t CC KBufFileMakeRead ( struct KFile const ** buf,
-    struct KFile const * original, size_t bsize );
-
-
-/* MakeBufferedWrite
- *  make a writable file buffer
- *
- *  "buf" [ OUT ] - return parameter for new buffered file
- *
- *  "original" [ IN ] - source file to be buffered. must have read access
- *
- *  "update" [ IN ] - if true, make a read/write buffer
- *
- *  "bsize" [ IN ] - buffer size
- */
-KFS_EXTERN rc_t CC KBufFileMakeWrite ( struct KFile ** buf,
-    struct KFile * original, bool update, size_t bsize );
-
-
-
-
-KFS_EXTERN rc_t CC KBufReadFileMakeRead ( const struct KFile ** bp,
-     const struct KFile * original, size_t bsize );
-
-KFS_EXTERN rc_t CC KBufWriteFileMakeWrite ( struct KFile ** bp,
-     struct KFile * original, size_t bsize );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_buffile_ */
diff --git a/interfaces/kfs/bzip.h b/interfaces/kfs/bzip.h
deleted file mode 100644
index f91db85..0000000
--- a/interfaces/kfs/bzip.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*=======================================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_bzip_
-#define _h_kfs_bzip_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KFile;
-
-/* MakeBzip2ForRead
- *  creates an adapter to bunzip2 a source file
- *
- *  "bz" [ OUT ] - return parameter for decompressed file
- *
- *  "src" [ IN ] - compressed source file with read permission
- *
- * NB - creates a read-only file that does NOT support random access
- *  i.e. must be consumed serially starting from offset 0
- */
-KFS_EXTERN rc_t CC KFileMakeBzip2ForRead ( struct KFile const **bz, struct KFile const *src );
-
-
-/* MakeBzip2ForWrite
- *  creates an adapter to gzip a source file
- *
- *  "bz" [ OUT ] - return parameter for compressed file
- *
- *  "src" [ IN ] - uncompressed source file with write permission
- *
- * NB - creates a write-only file that does NOT suppport random access
- *  i.e. must be written serially from offset 0
- */
-KFS_EXTERN rc_t CC KFileMakeBzip2ForWrite ( struct KFile **bz, struct KFile *src );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_bzip_ */
diff --git a/interfaces/kfs/cacheteefile.h b/interfaces/kfs/cacheteefile.h
deleted file mode 100644
index aad2b9c..0000000
--- a/interfaces/kfs/cacheteefile.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_cacheteefile_
-#define _h_kfs_cacheteefile_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#include <stdarg.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KFile;
-struct KDirectory;
-
-
-/*--------------------------------------------------------------------------
- * KDirectory
- */
-
-/* MakeCacheTee
- *  takes a KFile as source
- *
- *  "tee" [ OUT ] - return parameter for tee file
- *
- *  "remote" [ IN ] - the source file, generally costly to read which is
- *  the motivation behind caching its output
- *
- *  "logger" [ IN, NULL OKAY ] - optional debugging output for observing
- *  access patterns of "remote"
- *
- *  "blocksize" [ IN ] - the cache-file page size
- *                       ( if 0 ... default-value will be 32k )
- *
- *  "cluster" [ IN ] - a blocking factor for accessing "remote"
- *  reads are in blocks of size "blocksize" * "cluster"
- *  ( 1...4 makes most sense )
- *
- *  "report" [ IN ] - when true, provides more verbose debugging output
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting full cache file, i.e. the name of the file
- *  as it would appear after promoting from partial to full status.
- *
- * the function creates a new ( cached ) KFile in **tee
- *
- * the caller can access this file to read and query the filesize, these are the only
- * supported messages to this object
- *
- * when the caller requests data that is not already cached in the local file,
- * the cached file will read from the remote-file, write into the local-file and then
- * return the requested data in the read-buffer
- *
- * when the caller requests data that is already cached, the data will be read from
- * the local file only, no remote request will be made
- *
- * when the caller requests data this is partially cached, the file will return the
- * part that comes first either from the remote or from the local file
- * in this case the file will return less data than requested
- *
- * when the caller opens an existing local file that contains a full copy of the
- * remote file, the local KFile will be returned in self
- *
- * this function will check if the remote-file and the local file ( if it already exists )
- * do have the same size and blocksize
- *
- */
-KFS_EXTERN rc_t CC KDirectoryMakeCacheTee ( struct KDirectory *self,
-    struct KFile const **tee, struct KFile const *remote, struct KFile *logger,
-    uint32_t blocksize, uint32_t cluster, bool report, const char *path, ... );
-KFS_EXTERN rc_t CC KDirectoryVMakeCacheTee ( struct KDirectory *self,
-    struct KFile const **tee, struct KFile const *remote, struct KFile *logger,
-    uint32_t blocksize, uint32_t cluster, bool report, const char *path, va_list args );
-
-/* -----
- * checks if a given file ( has to be a local file )
- *
- * a ... is a backing cache-file for the CacheTee-file
- * b ... all blocks have been filled with the remote content
- *
- * it returns the result of the check in *is_complete
- */
-KFS_EXTERN rc_t CC IsCacheFileComplete( const struct KFile * self, bool * is_complete, bool silent);
-
-
-/* -----
- * truncates a cache-file for a CacheTee-filec by removing the bitmap/content-lenght/block-size
- *
- * it returns the result of the check in *is_complete
- */
-KFS_EXTERN rc_t CC TruncateCacheFile( struct KFile * self );
-
-
-/* -----
- * examens the file, and reports what percentage of blocks are in the cache...
- *
- */
-KFS_EXTERN rc_t CC GetCacheCompleteness( const struct KFile * self, float * percent );
-
-
-/* -----
- * examens the file, and reports the size of the original file ( without the cachefile-footer )
- *
- */
-KFS_EXTERN rc_t CC GetCacheTruncatedSize( const struct KFile * self, uint64_t * truncated_size, bool silent );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_teefile_ */
diff --git a/interfaces/kfs/countfile.h b/interfaces/kfs/countfile.h
deleted file mode 100644
index 4b1c720..0000000
--- a/interfaces/kfs/countfile.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_counterfile_
-#define _h_kfs_counterfile_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct KFile;
-
-typedef struct KCounterFile KCounterFile;
-
-/* -----
- * Copy can be a serialized type KFile for a KCounterFile opened for Read but
- * not when opened for write.
- *
- * Specifically this means copy can be a KMD5File for read but not for write
- * other KFile subtypes might have the same restriction.
- *
- * A seekless update KCounterfile can be created but does not now exist.
- *
- * bytecounter points to where to write a total byte count for the file.
- *
- * linecounter points to where to write a count of the lines of a file.
- *     if NULL this functionality is disabled.
- *
- * force_reads causes a read to the end of file on close rather than relying on pass along KFileSize
- */
-KFS_EXTERN rc_t CC KFileMakeCounterRead (const struct KFile ** self, const KFile * original,
-                                         uint64_t * bytecounter, uint64_t * linecounter, bool force_reads);
-KFS_EXTERN rc_t CC KFileMakeCounterWrite (struct KFile ** self, struct KFile * original,
-                                          uint64_t * bytecounter, uint64_t * linecounter, bool force_reads);
-KFS_EXTERN rc_t CC KFileMakeCounterUpdate (struct KFile ** self, struct KFile * original,
-                                           uint64_t * bytecounter, uint64_t * linecounter, bool force_reads);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_counterfile_ */
diff --git a/interfaces/kfs/crc.h b/interfaces/kfs/crc.h
deleted file mode 100644
index c3e56dd..0000000
--- a/interfaces/kfs/crc.h
+++ /dev/null
@@ -1,292 +0,0 @@
-/*=======================================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_crc_
-#define _h_kfs_crc_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KFile;
-
-
-/*--------------------------------------------------------------------------
- * KCRC32SumFmt
- *  a formatter for reading or writing an crc32sum-style checksum file
- */
-typedef struct KCRC32SumFmt KCRC32SumFmt;
-
-
-/* AddRef
- * Release
- */
-KFS_EXTERN rc_t CC KCRC32SumFmtAddRef ( const KCRC32SumFmt *self );
-KFS_EXTERN rc_t CC KCRC32SumFmtRelease ( const KCRC32SumFmt *self );
-
-
-/* Make
- *  creates a formatted accessor to textual checksum file
- *  takes over ownership of "in"/"out" file reference
- *
- *  "in" [ IN ] - readable checksum input file
- *  -OR-
- *  "out" [ IN ] - writable checksum file. if readable as well,
- *  its contents will be preserved.
- */
-KFS_EXTERN rc_t CC KCRC32SumFmtMakeRead ( const KCRC32SumFmt **f, struct KFile const *in );
-KFS_EXTERN rc_t CC KCRC32SumFmtMakeUpdate ( KCRC32SumFmt **f, struct KFile *out );
-
-
-/* Count
- *  return the number of checksums in file
- */
-KFS_EXTERN rc_t CC KCRC32SumFmtCount ( const KCRC32SumFmt *self, uint32_t *count );
-
-
-/* Get
- *  retrieve an indexed checksum line
- *
- *  "idx" [ IN ] - zero-based index of checksum to access
- *
- *  "path" [ OUT ] and "size" [ IN ] - return buffer for file path
- *
- *  "crc32" [ OUT ] - return parameter for the checksum
- *
- *  "bin" [ OUT, NULL OKAY ] - true if fopen mode used to
- *  calculate "digest" was binary, false if text. pertinent if
- *  digest was calculated using DOS text mode.
- */
-KFS_EXTERN rc_t CC KCRC32SumFmtGet ( const KCRC32SumFmt *self, uint32_t idx,
-    char *path, size_t size, uint32_t *crc32, bool *bin );
-
-
-/* Find
- *  retrieve checksum line by path
- *
- *  "path" [ IN ] - NUL terminated string in OS-native char set
- *  denoting path to file
- *
- *  "crc32" [ OUT ] - return parameter for the checksum
- *
- *  "bin" [ OUT, NULL OKAY ] - true if fopen mode used to
- *  calculate "digest" was binary, false if text. pertinent if
- *  digest was calculated using DOS text mode.
- */
-KFS_EXTERN rc_t CC KCRC32SumFmtFind ( const KCRC32SumFmt *self,
-    const char *path, uint32_t *crc32, bool *bin );
-
-
-/* Delete
- *  remove an existing line
- *
- *  "path" [ IN ] - NUL terminated string in OS-native char set
- *  denoting path to file
- *
- *  returns rcNotFound if not present
- */
-KFS_EXTERN rc_t CC KCRC32SumFmtDelete ( KCRC32SumFmt *self, const char *path );
-
-
-/* Update
- *  add a checksum line to file or update an existing line
- *
- *  "path" [ IN ] - NUL terminated string in OS-native char set
- *  denoting path to file
- *
- *  "crc32" [ IN ] - calculated checksum
- *
- *  "bin" [ IN ] - true if checksum was calculated on all bytes
- *  in file, false if fopen mode used to read file was text.
- *
- * NB - the crc32sum tool was designed to behave like md5sum.
- *  the md5sum tool operates with the assumption that files
- *  are opened using "fopen". it records the mode used by prepending
- *  '*' to indicate binary and ' ' to indicate text mode within the
- *  checksum line.
- *
- *  unfortunately, this creates a situation where text-mode files
- *  checksummed on DOS cannot be properly checked on any other
- *  platform without the aid of some filter to drop out '\r' from
- *  a '\r\n' sequence.
- *
- *  fortunately, most users are unaware of the binary/text mode
- *  switches available with md5sum and use the default mode, which
- *  is binary on DOS and text on Unix, which happens to be equivalent
- *  to binary ( making one wonder why binary is not instead the
- *  universal default ).
- *
- *  the end result is that we need to indicate whether CR stripping
- *  was performed while at the same time behaving like md5sum.
- */
-KFS_EXTERN rc_t CC KCRC32SumFmtUpdate ( KCRC32SumFmt *self, const char *path,
-    uint32_t crc32, bool bin );
-
-/* Rename
- * Rename the checksum line to reflect a file name change but no content change.
- *
- *  "newpath" [ IN ] - NUL terminated string in OS-native char set
- *  denoting path to file's new name
- *
- *  "oldpath" [ IN ] - NUL terminated string in OS-native char set
- *  denoting path to file's old name
- *
- * Parameter order matches KDirectoryRename()
- */
-KFS_EXTERN rc_t CC KCRC32SumFmtRename ( KCRC32SumFmt *self, const char *oldpath, const char *newpath );
-
-
-/* Flush
- *  write data to disk, but stay open
- */
-KFS_EXTERN rc_t CC KCRC32SumFmtFlush ( KCRC32SumFmt *self );
-
-
-/*--------------------------------------------------------------------------
- * CRC32 KFile extensions
- */
-
-/* MakeCRC32Read
- *  creates an adapter to check CRC32 checksum for a source file
- *
- *  "f" [ OUT ] - return parameter for file with crc check
- *
- *  "src" [ IN ] - source file with read permission
- *
- *  "crc32" [ IN ] - checksum to match
- *
- * NB - creates a read-only file that does NOT support random access
- *  i.e. must be consumed serially starting from offset 0
- */
-KFS_EXTERN rc_t CC KFileMakeCRC32Read ( struct KFile const **f,
-    struct KFile const *src, uint32_t crc32 );
-
-
-
-
-/*--------------------------------------------------------------------------
- * KCRC32File
- *  subclass of KFile
- */
-typedef struct KCRC32File KCRC32File;
-
-
-/* MakeWrite
- * MakeAppend
- *  creates an adapter to calculate CRC checksum for a file
- *
- *  "f" [ OUT ] - return parameter for file with crc check
- *
- *  "out" [ IN ] - output file with write permission
- *  since this file is being wrapped by "f", ownership of
- *  the provided reference is transferred to "f"
- *
- *  "fmt" [ IN ] - checksum output formatter.
- *  since this may be used for multiple checksums, "f" will
- *  attach its own reference to "fmt".
- *
- *  "path" [ IN ] - checksum output file path, used to
- *  create standard md5sum file entry.
- *
- * NB - creates a write-only file that does NOT suppport random access
- *  i.e. must be written serially from offset 0
- */
-KFS_EXTERN rc_t CC KCRC32FileMakeWrite ( KCRC32File **f,
-    struct KFile *out, KCRC32SumFmt *fmt, const char *path );
-KFS_EXTERN rc_t CC KCRC32FileMakeAppend ( KCRC32File **f,
-    struct KFile *out, KCRC32SumFmt *fmt, const char *path );
-
-/* MakeReadNew
- *  creates an adapter to calculate CRC checksum for a file
- *
- *  "f" [ OUT ] - return parameter for file with crc check
- *
- *  "in" [ IN ] - input file 
- *  since this file is being wrapped by "f", ownership of
- *  the provided reference is transferred to "f"
- *
- *  "fmt" [ IN ] - checksum output formatter.
- *  since this may be used for multiple checksums, "f" will
- *  attach its own reference to "fmt".
- *
- *  "path" [ IN ] - checksum output file path, used to
- *  create standard md5sum file entry.
- *
- * NB - creates a write-only file that does NOT suppport random access
- *  i.e. must be written serially from offset 0
- */
-KFS_EXTERN rc_t CC KFileMakeNewCRC32Read ( const struct KFile **fp,
-    const struct KFile *in, KCRC32SumFmt *fmt, const char *path );
-
-
-/* ToKFile
- *  a CRC32 file is a subclass of KFile
- *  this is an explicit cast operator
- */
-KFS_EXTERN struct KFile* CC KCRC32FileToKFile ( KCRC32File *self );
-KFS_EXTERN struct KFile const* CC KCRC32FileToKFileConst ( const KCRC32File *self );
-
-/* BeginTransaction
- *  preserve current CRC state and file marker
- *  in preparation for rollback
- */
-KFS_EXTERN rc_t CC KCRC32FileBeginTransaction ( KCRC32File *self );
-
-
-/* Commit
- *  accept current CRC state as correct
- */
-KFS_EXTERN rc_t CC KCRC32FileCommit ( KCRC32File *self );
-
-
-/* Revert
- *  reset state to previous transaction boundary conditions
- */
-KFS_EXTERN rc_t CC KCRC32FileRevert ( KCRC32File *self );
-
-/* Reset
- *  reset state to that of an empty file
- *  aborts any open transaction
- */
-KFS_EXTERN rc_t CC KCRC32FileReset ( KCRC32File *self );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_crc_ */
diff --git a/interfaces/kfs/defs.h b/interfaces/kfs/defs.h
deleted file mode 100644
index 3e76d9c..0000000
--- a/interfaces/kfs/defs.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_defs_
-#define _h_kfs_defs_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KPathType
- */
-typedef uint32_t KPathType;
-enum
-{
-    /* add in below zero so as not to change behavior of existing */
-    /* added for KDB that extended this enumeration */ 
-    /* if added it will clash with the kptAlias bit */
-    /* without care be taken */
-    kptFirstDefined = 0,
-
-    /* some paths are bad or non-existent */
-    kptNotFound = kptFirstDefined,
-    kptBadPath,
-
-    /* existing paths describe a directory entry */
-    kptFile,
-    kptDir,
-    kptCharDev,
-    kptBlockDev,
-    kptFIFO,
-
-    /* special types that aren't quite right or normal */
-
-    /* A zombie file is a file in the directory that can not be opened
-     * or read because it is for some reason not really present
-     * zombie as in not live and not dead */
-    kptZombieFile,
-
-    /* special cases for visiting a HDF5-file: */
-
-    /* a dataset is a container for data like a file, but typed */
-    kptDataset,
-    /* a datatype is a object inside a HDF5-group (directory) */
-    kptDatatype,
-
-    /* the type enum may be extended by virtual directories */
-    kptLastDefined,
-
-    /* aliases to the above types have the alias bit set */
-    kptAlias = 128
-};
-
-
-/*--------------------------------------------------------------------------
- * KCreateMode
- *  when creating a file or directory, the normal intent is to open it,
- *  creating it first if necessary, and then go on. alternatively, the
- *  intention may be to always return a newly initialized object, while
- *  the last may be to only proceed if actually created, i.e. if the
- *  object does not already exist in some form.
- */
-enum
-{
-    /* mode values 0..7 */
-    kcmOpen,
-    kcmInit,
-    kcmCreate,
-    kcmValueMask = 7,
-
-    /* modifier bits 3..7 */
-    kcmMD5     = ( 1 << 6 ),
-    kcmParents = ( 1 << 7 ),
-    kcmBitMask = ( 1 << 8 ) - kcmValueMask - 1
-};
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_defs_ */
diff --git a/interfaces/kfs/directory.h b/interfaces/kfs/directory.h
deleted file mode 100644
index 7d7f237..0000000
--- a/interfaces/kfs/directory.h
+++ /dev/null
@@ -1,522 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_directory_
-#define _h_kfs_directory_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifndef _h_kfs_defs_
-#include <kfs/defs.h>
-#endif
-
-#include <stdarg.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KFile;
-struct KNamelist;
-
-
-/*--------------------------------------------------------------------------
- * KDirectory
- *  a container node within file system
- */
-typedef struct KDirectory KDirectory;
-
-/* AddRef
- * Release
- *  ignores NULL references
- */
-KFS_EXTERN rc_t CC KDirectoryAddRef ( const KDirectory *self );
-KFS_EXTERN rc_t CC KDirectoryRelease ( const KDirectory *self );
-
-/* List
- *  create a directory listing
- *
- *  "list" [ OUT ] - return parameter for list object
- *
- *  "f" [ IN, NULL OKAY ] and "data" [ IN, OPAQUE ] - optional
- *  filter function to execute on each path. receives a base directory
- *  and relative path for each entry. if "f" returns true, the name will
- *  be added to the list.
- *
- *  "path" [ IN, NULL OKAY ] - optional parameter for target
- *  directory. if NULL or empty, interpreted to mean "."
- *
- *  function makes a flat list, does not step into sub-dirs!
- *
- */
-KFS_EXTERN rc_t CC KDirectoryList ( const KDirectory *self, struct KNamelist **list,
-    bool ( CC * f ) ( const KDirectory *dir, const char *name, void *data ),
-    void *data, const char *path, ... );
-KFS_EXTERN rc_t CC KDirectoryVList ( const KDirectory *self, struct KNamelist **list,
-    bool ( CC * f ) ( const KDirectory *dir, const char *name, void *data ),
-    void *data, const char *path, va_list args );
-
-/* Visit
- *  visit each path under designated directory,
- *  recursively if so indicated
- *
- *  "recurse" [ IN ] - if true, recursively visit sub-directories
- *
- *  "f" [ IN ] and "data" [ IN, OPAQUE ] - function to execute
- *  on each path. receives a base directory and relative path
- *  for each entry. if "f" returns true, the iteration will
- *  terminate and that value will be returned. NB - "dir" will not
- *  be the same as "self".
- *
- *  "path" [ IN, NULL OKAY ] - optional NUL terminated string
- *   in directory-native character set. if NULL or empty, interpreted to mean "."
- *
- * VisitFull hits all files types that including those are normally hidden
- */
-KFS_EXTERN rc_t CC KDirectoryVisit ( const KDirectory *self, bool recurse,
-    rc_t ( CC * f ) ( const KDirectory *dir, uint32_t type, const char *name, void *data ),
-    void *data, const char *path, ... );
-KFS_EXTERN rc_t CC KDirectoryVVisit ( const KDirectory *self, bool recurse,
-    rc_t ( CC * f ) ( const KDirectory *dir, uint32_t type, const char *name, void *data ),
-    void *data, const char *path, va_list args );
-
-/* VisitUpdate
- *  like Visit except that the directory passed back to "f"
- *  is available for update operations
- */
-KFS_EXTERN rc_t CC KDirectoryVisitUpdate ( KDirectory *self, bool recurse,
-    rc_t ( CC * f ) ( KDirectory *dir, uint32_t type, const char *name, void *data ),
-    void *data, const char *path, ... );
-KFS_EXTERN rc_t CC KDirectoryVVisitUpdate ( KDirectory *self, bool recurse,
-    rc_t ( CC * f ) ( KDirectory *dir, uint32_t type, const char *name, void *data ),
-    void *data, const char *path, va_list args );
-
-/* PathType
- *  returns a KPathType ( defined in kfs/defs.h )
- *
- *  "path" [ IN ] - NUL terminated string in directory-native character set
- */
-KFS_EXTERN uint32_t CC KDirectoryPathType ( const KDirectory *self,
-    const char *path, ... );
-KFS_EXTERN uint32_t CC KDirectoryVPathType ( const KDirectory *self,
-    const char *path, va_list args );
-
-/* ResolvePath
- *  resolves path to an absolute or directory-relative path
- *
- *  "absolute" [ IN ] - if true, always give a path starting
- *  with '/'. NB - if the directory is chroot'd, the absolute path
- *  will still be relative to directory root.
- *
- *  "resolved" [ OUT ] and "rsize" [ IN ] - buffer for
- *  NUL terminated result path in directory-native character set
- *  the resolved path will be directory relative
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target path. NB - need not exist.
- */
-KFS_EXTERN rc_t CC KDirectoryResolvePath ( const KDirectory *self, bool absolute,
-    char *resolved, size_t rsize, const char *path, ... );
-KFS_EXTERN rc_t CC KDirectoryVResolvePath ( const KDirectory *self, bool absolute,
-    char *resolved, size_t rsize, const char *path, va_list args );
-
-/* ResolveAlias
- *  resolves an alias path to its immediate target
- *  NB - the resolved path may be yet another alias
- *
- *  "absolute" [ IN ] - if true, always give a path starting
- *  with '/'. NB - if the directory is chroot'd, the absolute path
- *  will still be relative to directory root.
- *
- *  "resolved" [ OUT ] and "rsize" [ IN ] - buffer for
- *  NUL terminated result path in directory-native character set
- *  the resolved path will be directory relative
- *
- *  "alias" [ IN ] - NUL terminated string in directory-native
- *  character set denoting an object presumed to be an alias.
- */
-KFS_EXTERN rc_t CC KDirectoryResolveAlias ( const KDirectory *self, bool absolute,
-    char *resolved, size_t rsize, const char *alias, ... );
-KFS_EXTERN rc_t CC KDirectoryVResolveAlias ( const KDirectory *self, bool absolute,
-    char *resolved, size_t rsize, const char *alias, va_list args );
-
-/* Rename
- *  rename an object accessible from directory, replacing
- *  any existing target object of the same type
- *
- *  "from" [ IN ] - NUL terminated string in directory-native
- *  character set denoting existing object
- *
- *  "to" [ IN ] - NUL terminated string in directory-native
- *  character set denoting existing object
- *
- *  "force" [ IN ] - not false means try to do more if it fails internally
- */
-KFS_EXTERN rc_t CC KDirectoryRename ( KDirectory *self, bool force, const char *from, const char *to );
-
-/* Remove
- *  remove an accessible object from its directory
- *
- *  "force" [ IN ] - if true and target is a directory,
- *  remove recursively
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- */
-KFS_EXTERN rc_t CC KDirectoryRemove ( KDirectory *self, bool force,
-    const char *path, ... );
-KFS_EXTERN rc_t CC KDirectoryVRemove ( KDirectory *self, bool force,
-    const char *path, va_list args );
-
-/* ClearDir
- *  remove all directory contents
- *
- *  "force" [ IN ] - if true and directory entry is a
- *  sub-directory, remove recursively
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target directory
- */
-KFS_EXTERN rc_t CC KDirectoryClearDir ( KDirectory *self, bool force,
-    const char *path, ... );
-KFS_EXTERN rc_t CC KDirectoryVClearDir ( KDirectory *self, bool force,
-    const char *path, va_list args );
-
-/* Access
- *  get access to object
- *
- *  "access" [ OUT ] - return parameter for Unix access mode
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- */
-KFS_EXTERN rc_t CC KDirectoryAccess ( const KDirectory *self,
-    uint32_t *access, const char *path, ... );
-KFS_EXTERN rc_t CC KDirectoryVAccess ( const KDirectory *self,
-    uint32_t *access, const char *path, va_list args );
-
-/* SetAccess
- *  set access to object a la Unix "chmod"
- *
- *  "recurse" [ IN ] - if non zero and "path" is a directory,
- *  apply changes recursively.
- *
- *  "access" [ IN ] and "mask" [ IN ] - definition of change
- *  where "access" contains new bit values and "mask defines
- *  which bits should be changed.
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- */
-KFS_EXTERN rc_t CC KDirectorySetAccess ( KDirectory *self, bool recurse,
-    uint32_t access, uint32_t mask, const char *path, ... );
-KFS_EXTERN rc_t CC KDirectoryVSetAccess ( KDirectory *self, bool recurse,
-    uint32_t access, uint32_t mask, const char *path, va_list args );
-
-/* Date
- *  get date/time to object
- *
- *  "date" [ OUT ] - return parameter
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- */
-KFS_EXTERN rc_t CC KDirectoryDate ( const KDirectory *self,
-    KTime_t *date, const char *path, ... );
-KFS_EXTERN rc_t CC KDirectoryVDate ( const KDirectory *self,
-    KTime_t *date, const char *path, va_list args );
-
-/* SetDate
- *  set date to object
- *
- *  "recurse" [ IN ] - if non zero and "path" is a directory,
- *  apply changes recursively.
- *
- *  "date" [ IN ] - new time and date for the object
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- */
-KFS_EXTERN rc_t CC KDirectorySetDate ( KDirectory *self, bool recurse,
-    KTime_t date, const char *path, ... );
-KFS_EXTERN rc_t CC KDirectoryVSetDate ( KDirectory *self, bool recurse,
-    KTime_t date, const char *path, va_list args );
-
-/* CreateAlias
- *  creates a path alias according to create mode
- *  such that "alias" => "targ"
- *
- *  "access" [ IN ] - standard Unix directory access mode
- *  used when "mode" has kcmParents set and alias path does
- *  not exist.
- *
- *  "mode" [ IN ] - a creation mode ( see explanation in kfs/defs.h ).
- *
- *  "targ" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object, i.e. the object which
- *  is designated by symlink "alias". THE PATH IS GIVEN RELATIVE
- *  TO DIRECTORY ( "self" ), NOT SYMLINK ( "alias" )!
- *
- *  "alias" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target alias, i.e. the symlink that
- *  designates a target "targ".
- */
-KFS_EXTERN rc_t CC KDirectoryCreateAlias ( KDirectory *self,
-    uint32_t access, KCreateMode mode,
-    const char *targ, const char *alias );
-
-/* OpenFileRead
- *  opens an existing file with read-only access
- *
- *  "f" [ OUT ] - return parameter for newly opened file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- */
-KFS_EXTERN rc_t CC KDirectoryOpenFileRead ( const KDirectory *self,
-    struct KFile const **f, const char *path, ... );
-KFS_EXTERN rc_t CC KDirectoryVOpenFileRead ( const KDirectory *self,
-    struct KFile const **f, const char *path, va_list args );
-
-/* OpenFileWrite
- *  opens an existing file with write access
- *
- *  "f" [ OUT ] - return parameter for newly opened file
- *
- *  "update" [ IN ] - if true, open in read/write mode
- *  otherwise, open in write-only mode
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- */
-KFS_EXTERN rc_t CC KDirectoryOpenFileWrite ( KDirectory *self,
-    struct KFile **f, bool update, const char *path, ... );
-KFS_EXTERN rc_t CC KDirectoryVOpenFileWrite ( KDirectory *self,
-    struct KFile **f, bool update, const char *path, va_list args );
-
-/* CreateFile
- *  opens a file with write access
- *
- *  "f" [ OUT ] - return parameter for newly opened file
- *
- *  "update" [ IN ] - if true, open in read/write mode
- *  otherwise, open in write-only mode
- *
- *  "access" [ IN ] - standard Unix access mode, e.g. 0664
- *
- *  "mode" [ IN ] - a creation mode ( see explanation in kfs/defs.h ).
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- */
-KFS_EXTERN rc_t CC KDirectoryCreateFile ( KDirectory *self, struct KFile **f,
-    bool update, uint32_t access, KCreateMode mode, const char *path, ... );
-KFS_EXTERN rc_t CC KDirectoryVCreateFile ( KDirectory *self, struct KFile **f,
-    bool update, uint32_t access, KCreateMode mode, const char *path, va_list args );
-
-/* FileSize
- *  returns size in bytes of target file
- *
- *  "size" [ OUT ] - return parameter for file size
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- */
-KFS_EXTERN rc_t CC KDirectoryFileSize ( const KDirectory *self,
-    uint64_t *size, const char *path, ... );
-KFS_EXTERN rc_t CC KDirectoryVFileSize ( const KDirectory *self,
-    uint64_t *size, const char *path, va_list args );
-
-/* FilePhysicalSize
- *  returns physical allocated size in bytes of target file.  It might
- * or might not differ from FileSize
- *
- *  "size" [ OUT ] - return parameter for file size
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- */
-KFS_EXTERN rc_t CC KDirectoryFilePhysicalSize ( const KDirectory *self,
-    uint64_t *size, const char *path, ... );
-KFS_EXTERN rc_t CC KDirectoryVFilePhysicalSize ( const KDirectory *self,
-    uint64_t *size, const char *path, va_list args );
-
-/* SetFileSize
- *  sets size in bytes of target file
- *
- *  "size" [ IN ] - new file size
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- */
-KFS_EXTERN rc_t CC KDirectorySetFileSize ( KDirectory *self,
-    uint64_t size, const char *path, ... );
-KFS_EXTERN rc_t CC KDirectoryVSetFileSize ( KDirectory *self,
-    uint64_t size, const char *path, va_list args );
-
-/* FileLocator
- *  returns a 64-bit key pretinent only to the particular file
- *  system device holding tha file.
- *
- *  It can be used as a form of sort key except that it is not 
- *  guaranteed to be unique.
- *
- *  "locator" [ OUT ] - return parameter for file locator
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- */
-KFS_EXTERN rc_t CC KDirectoryFileLocator ( const KDirectory *self,
-    uint64_t *locator, const char *path, ... );
-KFS_EXTERN rc_t CC KDirectoryVFileLocator ( const KDirectory *self,
-    uint64_t *locator, const char *path, va_list args );
-
-/* FileContiguous
- *  returns true if the file is "contiguous".  Chunked or sparse files are not
- *  contiguous while most data files are.  Virtual generated files would likely
- *  not be contiguous.  
- *
- *  "contiguous" [ OUT ] - return parameter for file contiguous
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- */
-KFS_EXTERN rc_t CC KDirectoryFileContiguous ( const KDirectory *self,
-    bool *contiguous, const char *path, ... );
-KFS_EXTERN rc_t CC KDirectoryVFileContiguous ( const KDirectory *self,
-    bool *contiguous, const char *path, va_list args );
-
-/* OpenDirRead
- * OpenDirUpdate
- *  opens a sub-directory
- *
- *  "chroot" [ IN ] - if true, the new directory becomes
- *  chroot'd and will interpret paths beginning with '/'
- *  relative to itself.
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target directory
- */
-KFS_EXTERN rc_t CC KDirectoryOpenDirRead ( const KDirectory *self,
-    const KDirectory **sub, bool chroot, const char *path, ... );
-KFS_EXTERN rc_t CC KDirectoryVOpenDirRead ( const KDirectory *self,
-    const KDirectory **sub, bool chroot, const char *path, va_list args );
-
-KFS_EXTERN rc_t CC KDirectoryOpenDirUpdate ( KDirectory *self,
-    KDirectory **sub, bool chroot, const char *path, ... );
-KFS_EXTERN rc_t CC KDirectoryVOpenDirUpdate ( KDirectory *self,
-    KDirectory **sub, bool chroot, const char *path, va_list args );
-
-/* CreateDir
- *  create a sub-directory
- *
- *  "access" [ IN ] - standard Unix directory mode, e.g.0775
- *
- *  "mode" [ IN ] - a creation mode ( see explanation in defs.h ).
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target directory
- */
-KFS_EXTERN rc_t CC KDirectoryCreateDir ( KDirectory *self,
-    uint32_t access, KCreateMode mode, const char *path, ... );
-KFS_EXTERN rc_t CC KDirectoryVCreateDir ( KDirectory *self,
-    uint32_t access, KCreateMode mode, const char *path, va_list args );
-
-
-/* CopyPath
- *  copies a file
- *
- *  "src_path" [ IN ] - path to source-file
- *
- *  "dst_path" [ IN ] - file to create
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target directory
- */
-KFS_EXTERN rc_t CC KDirectoryCopyPath ( const KDirectory *src_dir,
-    KDirectory *dst_dir, const char *src_path, const char *dst_path );
-
-
-/* CopyPaths
- *  copies files, optional recursive in sub-dirs...
- *
- *  "recursive" [ IN ] - handle subdir's recursivly
- *
- *  "src" [ IN ] - what directory to copy
- *
- *  "dst" [ IN ] - into what directory to copy
- *      ( will be created if it does not already exist )
- *
- */
-KFS_EXTERN rc_t CC KDirectoryCopyPaths ( const KDirectory * src_dir,
-    KDirectory *dst_dir, bool recursive, const char *src, const char *dst );
-
-
-/* Copy
- *  detects if src is a file or a directory
- *
- *  "recursive" [ IN ] - handle subdir's recursivly 
- *            ( if srs is a directory )
- *
- *  "src" [ IN ] - what file/directory to copy
- *
- *  "dst" [ IN ] - into what file/directory to copy
- *      ( will be created if it does not already exist )
- *
- */
-KFS_EXTERN rc_t CC KDirectoryCopy ( const KDirectory *src_dir,
-    KDirectory *dst_dir, bool recursive, const char *src, const char *dst );
-
-
-/* NativeDir
- *  returns a native file-system directory node reference
- *  the directory root will be "/" and set to the native
- *  idea of current working directory
- *
- *  NB - the returned reference will be non-const, allowing
- *  modification operations to be attempted. these operations
- *  may still fail if the underlying FS disallows them.
- *
- *  "dir" [ OUT ] - return parameter for native directory
- */
-KFS_EXTERN rc_t CC KDirectoryNativeDir ( KDirectory **dir );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_directory_ */
diff --git a/interfaces/kfs/directory.hpp b/interfaces/kfs/directory.hpp
deleted file mode 100644
index 3b99a97..0000000
--- a/interfaces/kfs/directory.hpp
+++ /dev/null
@@ -1,582 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _hpp_kfs_directory_
-#define _hpp_kfs_directory_
-
-#ifndef _h_kfs_directory_
-#include <kfs/directory.h>
-#endif
-
-/*--------------------------------------------------------------------------
- * KDirectory
- *  a container node within file system
- */
-struct KDirectory {
-    /* AddRef
-     * Release
-     *  ignores NULL references
-     */
-    inline rc_t AddRef ( void ) const throw ()
-    { return KDirectoryAddRef ( this ); }
-    inline rc_t Release ( void ) const throw ()
-    { return KDirectoryRelease ( this ); }
-
-
-    /* List
-     *  create a directory listing
-     *
-     *  "list" [ OUT ] - return parameter for list object
-     *
-     *  "f" [ IN, NULL OKAY ] and "data" [ IN, OPAQUE ] - optional
-     *  filter function to execute on each path. receives a base directory
-     *  and relative path for each entry. if "f" returns true, the name will
-     *  be added to the list.
-     *
-     *  "path" [ IN, NULL OKAY ] - optional parameter for target
-     *  directory. if NULL, interpreted to mean "."
-     */
-    inline rc_t List ( struct KNamelist **list,
-        bool ( CC * f ) ( const KDirectory *dir, const char *name, void *data ),
-        void *data,
-        const char *path, ... ) const throw ()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = KDirectoryVList ( this, list, f, data, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t List ( struct KNamelist **list,
-        bool ( CC * f ) ( const KDirectory *dir, const char *name, void *data ),
-        void *data,
-        const char *path, va_list args ) const throw ()
-    { return KDirectoryVList ( this, list, f, data, path, args ); }
-
-
-    /* Visit
-     *  visit each path under designated directory
-     *
-     *  "recurse" [ IN ] - if true, recursively visit sub-directories
-     *
-     *  "f" [ IN ] and "data" [ IN, OPAQUE ] - function to execute
-     *  on each path. receives a base directory and relative path
-     *  for each entry. if "f" returns true, the iteration will
-     *  terminate and that value will be returned. NB - "dir" will not
-     *  be the same as "self".
-     *
-     *  "path" [ IN ] - NUL terminated string in directory-native character set
-     */
-    inline rc_t Visit ( bool recurse,
-        rc_t ( CC * f ) ( const KDirectory *dir, uint32_t type, const char *name, void *data ),
-        void *data,
-        const char *path, ... ) const throw ()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = KDirectoryVVisit ( this, recurse, f, data, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t Visit ( bool recurse,
-        rc_t ( CC * f ) ( const KDirectory *dir, uint32_t type, const char *name, void *data ),
-        void *data,
-        const char *path, va_list args ) const throw ()
-    { return KDirectoryVVisit ( this, recurse, f, data, path, args ); }
-
-
-    /* VisitUpdate
-     *  like Visit except that the directory passed back to "f"
-     *  is available for update operations
-     */
-    inline rc_t VisitUpdate ( bool recurse,
-        rc_t ( CC * f ) ( KDirectory *dir, uint32_t type, const char *name, void *data ),
-        void *data,
-        const char *path, ... ) throw ()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = KDirectoryVVisitUpdate ( this, recurse, f, data, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t VisitUpdate ( bool recurse,
-        rc_t ( CC * f ) ( KDirectory *dir, uint32_t type, const char *name, void *data ),
-        void *data,
-        const char *path, va_list args ) throw ()
-    { return KDirectoryVVisitUpdate ( this, recurse, f, data, path, args ); }
-
-
-    /* PathType
-     *  returns a KPathType
-     *
-     *  "path" [ IN ] - NUL terminated string in directory-native character set
-     */
-    inline uint32_t PathType ( const char *path, ... ) const throw ()
-    {
-        va_list args;
-        va_start ( args, path );
-        uint32_t r = KDirectoryVPathType ( this, path, args );
-        va_end ( args );
-        return r;
-    }
-    inline uint32_t PathType ( const char *path, va_list args ) const throw ()
-    { return KDirectoryVPathType ( this, path, args ); }
-
-
-    /* ResolvePath
-     *  resolves path to an absolute or directory-relative path
-     *
-     *  "absolute" [ IN ] - if true, always give a path starting
-     *  with '/'. NB - if the directory is chroot'd, the absolute path
-     *  will still be relative to directory root.
-     *
-     *  "resolved" [ OUT ] and "rsize" [ IN ] - buffer for
-     *  NUL terminated result path in directory-native character set
-     *  the resolved path will be directory relative
-     *
-     *  "path" [ IN ] - NUL terminated string in directory-native
-     *  character set denoting target path. NB - need not exist.
-    */
-    inline rc_t ResolvePath ( bool absolute, char *resolved, size_t rsize,
-        const char *path, ... ) const throw ()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = KDirectoryVResolvePath ( this, absolute, resolved, rsize, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t ResolvePath ( bool absolute, char *resolved, size_t rsize,
-        const char *path, va_list args ) const throw ()
-    { return KDirectoryVResolvePath ( this, absolute, resolved, rsize, path, args ); }
-
-
-    /* ResolveAlias
-     *  resolves an alias path to its immediate target
-     *  NB - the resolved path may be yet another alias
-     *
-     *  "absolute" [ IN ] - if true, always give a path starting
-     *  with '/'. NB - if the directory is chroot'd, the absolute path
-     *  will still be relative to directory root.
-     *
-     *  "resolved" [ OUT ] and "rsize" [ IN ] - buffer for
-     *  NUL terminated result path in directory-native character set
-     *  the resolved path will be directory relative
-     *
-     *  "alias" [ IN ] - NUL terminated string in directory-native
-     *  character set denoting an object presumed to be an alias.
-     */
-     inline rc_t ResolveAlias ( bool absolute, char *resolved, size_t rsize, 
-        const char *alias, ... ) const throw ()
-     {
-        va_list args;
-        va_start ( args, alias );
-        rc_t rc = KDirectoryVResolveAlias ( this, absolute, resolved, rsize, alias, args );
-        va_end ( args );
-        return rc;
-     }
-     inline rc_t ResolveAlias ( bool absolute, char *resolved, size_t rsize, 
-        const char *alias, va_list args ) const throw ()
-     { return KDirectoryVResolveAlias ( this, absolute, resolved, rsize, alias, args ); }
-
-
-     /* Rename
-     *  rename an object accessible from directory, replacing
-     *  any existing target object of the same type
-     *
-     *  "from" [ IN ] - NUL terminated string in directory-native
-     *  character set denoting existing object
-     *
-     *  "to" [ IN ] - NUL terminated string in directory-native
-     *  character set denoting existing object
-     *
-     *  "force" [ IN ] - not false means try to do more if it fails internally
-     */
-     inline rc_t Rename ( bool force, const char *from, const char *to ) throw ()
-     {  return KDirectoryRename ( this, force, from, to );  }
-
-
-     /* Remove
-     *  remove an accessible object from its directory
-     *
-     *  "force" [ IN ] - if true and target is a directory,
-     *  remove recursively
-     *
-     *  "path" [ IN ] - NUL terminated string in directory-native
-     *  character set denoting target object
-     */
-     inline rc_t Remove ( bool force, const char *path, ... ) throw ()
-     {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = KDirectoryVRemove ( this, force, path, args );
-        va_end ( args );
-        return rc;
-     }
-     inline rc_t Remove ( bool force, const char *path, va_list args ) throw ()
-     { return KDirectoryVRemove ( this, force, path, args ); }
-
-
-     /* ClearDir
-     *  remove all directory contents
-     *
-     *  "force" [ IN ] - if true and directory entry is a
-     *  sub-directory, remove recursively
-     *
-     *  "path" [ IN ] - NUL terminated string in directory-native
-     *  character set denoting target directory
-     */
-     inline rc_t ClearDir ( bool force, const char *path, ... ) throw ()
-     {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = KDirectoryVClearDir ( this, force, path, args );
-        va_end ( args );
-        return rc;
-     }
-     inline rc_t ClearDir ( bool force, const char *path,
-        va_list args ) throw ()
-     { return KDirectoryVClearDir ( this, force, path, args ); }
-
-
-     /* Access
-     *  get access to object
-     *
-     *  "access" [ OUT ] - return parameter for Unix access mode
-     *
-     *  "path" [ IN ] - NUL terminated string in directory-native
-     *  character set denoting target object
-     */
-     inline rc_t Access ( uint32_t *access,
-        const char *path, ... ) const throw ()
-     {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = KDirectoryVAccess ( this, access, path, args );
-        va_end ( args );
-        return rc;
-     }
-     inline rc_t Access ( uint32_t *access, const char *path, 
-        va_list args ) const throw ()
-     { return KDirectoryVAccess ( this, access, path, args ); }
-
-
-     /* SetAccess
-     *  set access to object a la Unix "chmod"
-     *
-     *  "recurse" [ IN ] - if non zero and "path" is a directory,
-     *  apply changes recursively.
-     *
-     *  "access" [ IN ] and "mask" [ IN ] - definition of change
-     *  where "access" contains new bit values and "mask defines
-     *  which bits should be changed.
-     *
-     *  "path" [ IN ] - NUL terminated string in directory-native
-     *  character set denoting target object
-     */
-     inline rc_t SetAccess ( bool recurse, uint32_t access, uint32_t mask,
-        const char *path, ... ) throw ()
-     {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = KDirectoryVSetAccess ( this, recurse, access, mask, path, args );
-        va_end ( args );
-        return rc;
-     }
-     inline rc_t SetAccess ( bool recurse, uint32_t access, uint32_t mask,
-        const char *path, va_list args ) throw ()
-     { return KDirectoryVSetAccess ( this, recurse, access, mask, path, args ); }
-
-
-     /* Date
-     *  get date/time to object
-     *
-     *  "date" [ OUT ] - return parameter
-     *
-     *  "path" [ IN ] - NUL terminated string in directory-native
-     *  character set denoting target object
-     */
-     inline rc_t Date ( KTime_t *date, const char *path, ... ) const throw ()
-     {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = KDirectoryVDate ( this, date, path, args );
-        va_end ( args );
-        return rc;
-     }
-     inline rc_t Date ( KTime_t *date, const char *path,
-        va_list args ) const throw ()
-     { return KDirectoryVDate ( this, date, path, args ); }
-
-
-     /* SetDate
-     *  set date to object
-     *
-     *  "recurse" [ IN ] - if non zero and "path" is a directory,
-     *  apply changes recursively.
-     *
-     *  "date" [ IN ] - new time and date for the object
-     *
-     *  "path" [ IN ] - NUL terminated string in directory-native
-     *  character set denoting target object
-     */
-     inline rc_t SetDate ( bool recurse, KTime_t date,
-        const char *path, ... ) throw ()
-     {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = KDirectoryVSetDate ( this, recurse, date, path, args );
-        va_end ( args );
-        return rc;
-     }
-     inline rc_t SetDate ( bool recurse, KTime_t date, const char *path,
-        va_list args ) throw ()
-     { return KDirectoryVSetDate ( this, recurse, date, path, args ); }
-
-
-     /* CreateAlias
-     *  creates a path alias according to create mode
-     *
-     *  "access" [ IN ] - standard Unix directory access mode
-     *  used when "mode" has kcmParents set and alias path does
-     *  not exist.
-     *
-     *  "mode" [ IN ] - a creation mode ( see explanation above ).
-     *
-     *  "targ" [ IN ] - NUL terminated string in directory-native
-     *  character set denoting target object
-     *
-     *  "alias" [ IN ] - NUL terminated string in directory-native
-     *  character set denoting target alias
-     */
-     inline rc_t CreateAlias ( uint32_t access, KCreateMode mode,
-        const char *targ, const char *alias ) throw ()
-     { return KDirectoryCreateAlias ( this, access, mode, targ, alias ); }
-
-
-    /* OpenFileRead
-     *  opens an existing file with read-only access
-     *
-     *  "f" [ OUT ] - return parameter for newly opened file
-     *
-     *  "path" [ IN ] - NUL terminated string in directory-native
-     *  character set denoting target file
-     */
-    inline rc_t OpenFileRead ( struct KFile const **f,
-        const char *path, ... ) const throw ()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = KDirectoryVOpenFileRead ( this, f, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t OpenFileRead ( struct KFile const **f, const char *path,
-        va_list args ) const throw ()
-    { return KDirectoryVOpenFileRead ( this, f, path, args ); }
-
-
-    /* OpenFileWrite
-     *  opens an existing file with write access
-     *
-     *  "f" [ OUT ] - return parameter for newly opened file
-     *
-     *  "update" [ IN ] - if true, open in read/write mode
-     *  otherwise, open in write-only mode
-     *
-     *  "path" [ IN ] - NUL terminated string in directory-native
-     *  character set denoting target file
-     */
-    inline rc_t OpenFileWrite ( struct KFile **f, bool update,
-        const char *path, ... ) throw ()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = KDirectoryVOpenFileWrite ( this, f, update, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t OpenFileWrite ( struct KFile **f, bool update,
-        const char *path, va_list args ) throw ()
-    { return KDirectoryVOpenFileWrite ( this, f, update, path, args ); }
-
-
-    /* CreateFile
-     *  opens a file with write access
-     *
-     *  "f" [ OUT ] - return parameter for newly opened file
-     *
-     *  "update" [ IN ] - if true, open in read/write mode
-     *  otherwise, open in write-only mode
-     *
-     *  "access" [ IN ] - standard Unix access mode, e.g. 0664
-     *
-     *  "mode" [ IN ] - a creation mode ( see explanation above ).
-     *
-     *  "path" [ IN ] - NUL terminated string in directory-native
-     *  character set denoting target file
-     */
-     inline rc_t CreateFile ( struct KFile **f, bool update, uint32_t access,
-        KCreateMode mode, const char *path, ... ) throw ()
-     {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = KDirectoryVCreateFile ( this, f, update, access, mode, path, args );
-        va_end ( args );
-        return rc;
-     }
-     inline rc_t CreateFile ( struct KFile **f, bool update, uint32_t access,
-        KCreateMode mode, const char *path, va_list args ) throw ()
-     { return KDirectoryVCreateFile ( this, f, update, access, mode, path, args ); }
-
-
-     /* FileSize
-     *  returns size in bytes of target file
-     *
-     *  "size" [ OUT ] - return parameter for file size
-     *
-     *  "path" [ IN ] - NUL terminated string in directory-native
-     *  character set denoting target file
-     */
-     inline rc_t FileSize ( uint64_t *size, 
-        const char *path, ... ) const throw ()
-     {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = KDirectoryVFileSize ( this, size, path, args );
-        va_end ( args );
-        return rc;
-     }
-     inline rc_t FileSize ( uint64_t *size, const char *path,
-        va_list args ) const throw ()
-     { return KDirectoryVFileSize ( this, size, path, args ); }
-
-
-     /* SetFileSize
-     *  sets size in bytes of target file
-     *
-     *  "size" [ IN ] - new file size
-     *
-     *  "path" [ IN ] - NUL terminated string in directory-native
-     *  character set denoting target file
-     */
-     inline rc_t SetFileSize ( uint64_t size, const char *path, ... ) throw ()
-     {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = KDirectoryVSetFileSize ( this, size, path, args );
-        va_end ( args );
-        return rc;
-     }
-     inline rc_t SetFileSize ( uint64_t size, const char *path,
-        va_list args ) throw ()
-     { return KDirectoryVSetFileSize ( this, size, path, args ); }
-
-
-     /* OpenDirRead
-     * OpenDirUpdate
-     *  opens a sub-directory
-     *
-     *  "chroot" [ IN ] - if true, the new directory becomes
-     *  chroot'd and will interpret paths beginning with '/'
-     *  relative to itself.
-     *
-     *  "path" [ IN ] - NUL terminated string in directory-native
-     *  character set denoting target directory
-     */
-     inline rc_t OpenDirRead ( const KDirectory **sub, bool chroot,
-        const char *path, ... ) const throw ()
-     {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = KDirectoryVOpenDirRead ( this, sub, chroot, path, args );
-        va_end ( args );
-        return rc;
-     }
-     inline rc_t OpenDirRead ( const KDirectory **sub, bool chroot,
-        const char *path, va_list args ) const throw ()
-     { return KDirectoryVOpenDirRead ( this, sub, chroot, path, args ); }
-
-     inline rc_t OpenDirUpdate ( KDirectory **sub, bool chroot,
-        const char *path, ... )
-     {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = KDirectoryVOpenDirUpdate ( this, sub, chroot, path, args );
-        va_end ( args );
-        return rc;
-     }
-     inline rc_t OpenDirUpdate ( KDirectory **sub, bool chroot,
-        const char *path, va_list args ) throw ()
-     { return KDirectoryVOpenDirUpdate ( this, sub, chroot, path, args ); }
-
-     /* CreateDir
-     *  create a sub-directory
-     *
-     *  "access" [ IN ] - standard Unix directory mode, e.g.0775
-     *
-     *  "mode" [ IN ] - a creation mode ( see explanation above ).
-     *
-     *  "path" [ IN ] - NUL terminated string in directory-native
-     *  character set denoting target directory
-     */
-     inline rc_t CreateDir ( uint32_t access, KCreateMode mode,
-        const char *path, ... ) throw ()
-     {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = KDirectoryVCreateDir ( this, access, mode, path, args );
-        va_end ( args );
-        return rc;
-     }
-     inline rc_t CreateDir ( uint32_t access, KCreateMode mode,
-        const char *path, va_list args ) throw ()
-     { return  KDirectoryVCreateDir ( this, access, mode, path, args ); }
-
-
-    /* NativeDir
-     *  returns a native file-system directory node reference
-     *  the directory root will be "/" and set to the native
-     *  idea of current working directory
-     *
-     *  NB - the returned reference will be non-const, allowing
-     *  modification operations to be attempted. these operations
-     *  may still fail if the underlying FS disallows them.
-     *
-     *  "dir" [ OUT ] - return parameter for native directory
-     */
-    inline static rc_t NativeDir ( KDirectory **dir ) throw ()
-    { return KDirectoryNativeDir ( dir ); }
-
-private:
-    KDirectory ();
-    ~ KDirectory ();
-    KDirectory ( const KDirectory& );
-    KDirectory &operator = ( const KDirectory& );
-};
-
-#endif /* _hpp_kfs_directory_ */
diff --git a/interfaces/kfs/dyload.h b/interfaces/kfs/dyload.h
deleted file mode 100644
index e06958a..0000000
--- a/interfaces/kfs/dyload.h
+++ /dev/null
@@ -1,223 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_dyload_
-#define _h_kfs_dyload_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#include <stdarg.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KDirectory;
-
-
-/*--------------------------------------------------------------------------
- * KDyld
- *  dynamic library loader
- *
- *  maintains cache of libraries it has opened while they remain open
- *  such that subsequent requests for an open library will return a
- *  new reference to the existing library.
- */
-typedef struct KDyld KDyld;
-
-
-/* Make
- *  create a dynamic loader object
- *
- *  "dl" [ OUT ] - return parameter for loader
- */
-KFS_EXTERN rc_t CC KDyldMake ( KDyld **dl );
-
-
-/* AddRef
- * Release
- */
-KFS_EXTERN rc_t CC KDyldAddRef ( const KDyld *self );
-KFS_EXTERN rc_t CC KDyldRelease ( const KDyld *self );
-
-
-/* AddSearchPath
- *  add a search path to loader for locating library files
- */
-KFS_EXTERN rc_t CC KDyldAddSearchPath ( KDyld *self, const char *path, ... );
-KFS_EXTERN rc_t CC KDyldVAddSearchPath ( KDyld *self, const char *path, va_list args );
-
-
-/* HomeDirectory
- *  returns a KDirectory where the binary for a given function is located
- *
- *  "dir" [ OUT ] - return parameter for home directory ( read-only ), if found
- *
- *  "func" [ IN ] - function pointer within binary to be located
- */
-KFS_EXTERN rc_t CC KDyldHomeDirectory ( const KDyld *self,
-    struct KDirectory const **dir, fptr_t func );
-
-
-/*--------------------------------------------------------------------------
- * KDylib
- *  dynamic library
- */
-typedef struct KDylib KDylib;
-
-
-/* LoadLib
- *  load a dynamic library
- *
- *  "lib" [ OUT ] - return parameter for loaded library
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target library
- */
-KFS_EXTERN rc_t CC KDyldLoadLib ( KDyld *self,
-    KDylib **lib, const char *path, ... );
-KFS_EXTERN rc_t CC KDyldVLoadLib ( KDyld *self,
-    KDylib **lib, const char *path, va_list args );
-
-
-/* AddRef
- * Release
- */
-KFS_EXTERN rc_t CC KDylibAddRef ( const KDylib *self );
-KFS_EXTERN rc_t CC KDylibRelease ( const KDylib *self );
-
-
-/* FullPath
- *  return full path to library
- */
-KFS_EXTERN rc_t CC KDylibFullPath ( const KDylib *self, char *path, size_t psize );
-
-
-/*--------------------------------------------------------------------------
- * KDlset
- *  set of dynamic libraries
- *  contained libraries remain resident until set is released
- */
-typedef struct KDlset KDlset;
-
-
-/* MakeSet
- *  load a dynamic library
- *
- *  "set" [ OUT ] - return parameter for lib set
- */
-KFS_EXTERN rc_t CC KDyldMakeSet ( const KDyld *self, KDlset **set );
-
-
-/* AddRef
- * Release
- */
-KFS_EXTERN rc_t CC KDlsetAddRef ( const KDlset *self );
-KFS_EXTERN rc_t CC KDlsetRelease ( const KDlset *self );
-
-
-/* AddLib
- *  adds a dynamic library to set
- *  returns "rcExists" error if already present
- *
- *  "lib" [ IN ] - library returned from KDyldLoadLib
- */
-KFS_EXTERN rc_t CC KDlsetAddLib ( KDlset *self, KDylib *lib );
-
-
-/* AddAll
- *  adds all dynamic libraries found in dl search path
- */
-KFS_EXTERN rc_t CC KDlsetAddAll ( KDlset *self );
-
-
-/*--------------------------------------------------------------------------
- * KSymAddr
- *  symbol address within a dynamic library
- */
-typedef struct KSymAddr KSymAddr;
-
-
-/* Symbol
- *  find a symbol within dynamic library
- *
- *  "sym" [ OUT ] - return parameter for exported symbol address
- *
- *  "name" [ IN ] - NUL terminated symbol name in
- *  library-native character set
- */
-KFS_EXTERN rc_t CC KDylibSymbol ( const KDylib *self, KSymAddr **sym, const char *name );
-KFS_EXTERN rc_t CC KDlsetSymbol ( const KDlset *self, KSymAddr **sym, const char *name );
-
-
-/* FirstSymbol
- * LastSymbol
- *  find a symbol within dynamic library set matching criteria
- *
- *  "sym" [ OUT ] - return parameter for exported symbol address
- *
- *  "name" [ IN ] - NUL terminated symbol name in
- *  library-native character set
- *
- *  "test" [ IN ] and "data" [ IN, OPAQUE ] - callback filter function
- *  return true if symbol matches criteria
- */
-KFS_EXTERN rc_t CC KDlsetFirstSymbol ( const KDlset *self, KSymAddr **sym, const char *name,
-    bool ( CC * test ) ( const KSymAddr *sym, void *data ), void *data );
-KFS_EXTERN rc_t CC KDlsetLastSymbol ( const KDlset *self, KSymAddr **sym, const char *name,
-    bool ( CC * test ) ( const KSymAddr *sym, void *data ), void *data );
-
-
-/* AddRef
- * Release
- */
-KFS_EXTERN rc_t CC KSymAddrAddRef ( const KSymAddr *self );
-KFS_EXTERN rc_t CC KSymAddrRelease ( const KSymAddr *self );
-
-
-/* AsObj
- * AsFunc
- *  retrieve symbol address as pointer to object
- */
-KFS_EXTERN void *CC KSymAddrAsObj ( const KSymAddr *self );
-KFS_EXTERN void CC KSymAddrAsFunc ( const KSymAddr *self, fptr_t *fp );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_dyload_ */
diff --git a/interfaces/kfs/extern.h b/interfaces/kfs/extern.h
deleted file mode 100644
index 0ea1d3c..0000000
--- a/interfaces/kfs/extern.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_extern_
-#define _h_kfs_extern_
-
-#if ! defined EXPORT_LATCH && defined _LIBRARY
-#define KFS_EXTERN LIB_EXPORT
-#define EXPORT_LATCH 1
-#else
-#define KFS_EXTERN LIB_IMPORT
-#endif
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#endif /* _h_kfs_extern_ */
diff --git a/interfaces/kfs/ffext.h b/interfaces/kfs/ffext.h
deleted file mode 100644
index ab4f16a..0000000
--- a/interfaces/kfs/ffext.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_fileformat_ext_
-#define _h_kfs_fileformat_ext_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct KFileFormat;
-
-KFS_EXTERN rc_t CC KExtFileFormatMake (struct KFileFormat ** pft,
-                                       const char* ext, size_t extlen,
-                                       const char * typeAndClass, size_t tclen);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_fileformat_ext_ */
diff --git a/interfaces/kfs/ffmagic.h b/interfaces/kfs/ffmagic.h
deleted file mode 100644
index 4049a49..0000000
--- a/interfaces/kfs/ffmagic.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_fileformat_magic_
-#define _h_kfs_fileformat_magic_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct KFileFormat;
-
-KFS_EXTERN rc_t CC KMagicFileFormatMake (struct KFileFormat ** pft, const char * magic_path,
-			const char* magic, size_t magiclen,
-			const char * typeAndClass, size_t tclen);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_fileformat_magic_ */
diff --git a/interfaces/kfs/file.h b/interfaces/kfs/file.h
deleted file mode 100644
index d27a34d..0000000
--- a/interfaces/kfs/file.h
+++ /dev/null
@@ -1,287 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_file_
-#define _h_kfs_file_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifndef _h_klib_namelist_
-#include <klib/namelist.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct timeout_t;
-
-
-/*--------------------------------------------------------------------------
- * KFileDesc
- *  describes basic file types
- */
-enum KFileDesc
-{
-    kfdNull,
-    kfdInvalid,
-    kfdFile,
-    kfdCharDev,
-    kfdBlockDev,
-    kfdFIFO,
-    kfdSocket,
-
-    /* the type enum may be extended */
-    kfdLastDefined
-};
-
-
-/*--------------------------------------------------------------------------
- * KFile
- *  a file is normally created with a KDirectory
- *  optionally, the 3 standard i/o files may be created directly
- */
-typedef struct KFile KFile;
-
-/* AddRef
- * Release
- *  ignores NULL references
- */
-KFS_EXTERN rc_t CC KFileAddRef ( const KFile *self );
-KFS_EXTERN rc_t CC KFileRelease ( const KFile *self );
-
-
-/* RandomAccess
- *  ALMOST by definition, the file is random access
- *
- *  certain file types will refuse random access
- *  these include FIFO and socket based files, but also
- *  wrappers that require serial access ( e.g. compression )
- *
- *  returns 0 if random access, error code otherwise
- */
-KFS_EXTERN rc_t CC KFileRandomAccess ( const KFile *self );
-
-
-/* Type
- *  returns a KFileDesc
- *  not intended to be a content type,
- *  but rather an implementation class
- */
-KFS_EXTERN uint32_t CC KFileType ( const KFile *self );
-
-
-/* Size
- *  returns size in bytes of file
- *
- *  "size" [ OUT ] - return parameter for file size
- */
-KFS_EXTERN rc_t CC KFileSize ( const KFile *self, uint64_t *size );
-
-
-/* SetSize
- *  sets size in bytes of file
- *
- *  "size" [ IN ] - new file size
- */
-KFS_EXTERN rc_t CC KFileSetSize ( KFile *self, uint64_t size );
-
-
-/* Read
- * TimedRead
- *  read file from known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT ] - return parameter giving number of bytes
- *  actually read. when returned value is zero and return code is
- *  also zero, interpreted as end of file.
- *
- *  "tm" [ IN/OUT, NULL OKAY ] - an optional indicator of
- *  blocking behavior. not all implementations will support
- *  timed reads. a NULL timeout will block indefinitely,
- *  a value of "tm->mS == 0" will have non-blocking behavior
- *  if supported by implementation, and "tm->mS > 0" will indicate
- *  a maximum wait timeout.
- */
-KFS_EXTERN rc_t CC KFileRead ( const KFile *self, uint64_t pos,
-    void *buffer, size_t bsize, size_t *num_read );
-KFS_EXTERN rc_t CC KFileTimedRead ( const KFile *self, uint64_t pos,
-    void *buffer, size_t bsize, size_t *num_read, struct timeout_t *tm );
-
-/* ReadAll
- * TimedReadAll
- *  read from file until "bsize" bytes have been retrieved
- *  or until end-of-input
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT ] - return parameter giving number of bytes
- *  actually read. when returned value is zero and return code is
- *  also zero, interpreted as end of file.
- *
- *  "tm" [ IN/OUT, NULL OKAY ] - an optional indicator of
- *  blocking behavior. not all implementations will support
- *  timed reads. a NULL timeout will block indefinitely,
- *  a value of "tm->mS == 0" will have non-blocking behavior
- *  if supported by implementation, and "tm->mS > 0" will indicate
- *  a maximum wait timeout.
- */
-KFS_EXTERN rc_t CC KFileReadAll ( const KFile *self, uint64_t pos,
-    void *buffer, size_t bsize, size_t *num_read );
-KFS_EXTERN rc_t CC KFileTimedReadAll ( const KFile *self, uint64_t pos,
-    void *buffer, size_t bsize, size_t *num_read, struct timeout_t *tm );
-
-/* ReadExactly
- * TimedReadExactly
- *  read from file until "bytes" have been retrieved
- *  or return incomplete transfer error
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ OUT ] and "bytes" [ IN ] - return buffer for read
- *
- *  "tm" [ IN/OUT, NULL OKAY ] - an optional indicator of
- *  blocking behavior. not all implementations will support
- *  timed reads. a NULL timeout will block indefinitely,
- *  a value of "tm->mS == 0" will have non-blocking behavior
- *  if supported by implementation, and "tm->mS > 0" will indicate
- *  a maximum wait timeout.
- */
-KFS_EXTERN rc_t CC KFileReadExactly ( const KFile *self,
-    uint64_t pos, void *buffer, size_t bytes );
-KFS_EXTERN rc_t CC KFileTimedReadExactly ( const KFile *self,
-    uint64_t pos, void *buffer, size_t bytes, struct timeout_t *tm );
-
-/* Write
- * TimedWrite
- *  write file at known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ IN ] and "size" [ IN ] - data to be written
- *
- *  "num_writ" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually written
- *
- *  "tm" [ IN/OUT, NULL OKAY ] - an optional indicator of
- *  blocking behavior. not all implementations will support
- *  timed writes. a NULL timeout will block indefinitely,
- *  a value of "tm->mS == 0" will have non-blocking behavior
- *  if supported by implementation, and "tm->mS > 0" will indicate
- *  a maximum wait timeout.
- */
-KFS_EXTERN rc_t CC KFileWrite ( KFile *self, uint64_t pos,
-    const void *buffer, size_t size, size_t *num_writ );
-KFS_EXTERN rc_t CC KFileTimedWrite ( KFile *self, uint64_t pos,
-    const void *buffer, size_t size, size_t *num_writ, struct timeout_t *tm );
-
-/* WriteAll
- * TimedWriteAll
- *  write to file until "size" bytes have been transferred
- *  or until no further progress can be made
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ IN ] and "size" [ IN ] - data to be written
- *
- *  "num_writ" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually written
- *
- *  "tm" [ IN/OUT, NULL OKAY ] - an optional indicator of
- *  blocking behavior. not all implementations will support
- *  timed writes. a NULL timeout will block indefinitely,
- *  a value of "tm->mS == 0" will have non-blocking behavior
- *  if supported by implementation, and "tm->mS > 0" will indicate
- *  a maximum wait timeout.
- */
-KFS_EXTERN rc_t CC KFileWriteAll ( KFile *self, uint64_t pos,
-    const void *buffer, size_t size, size_t *num_writ );
-KFS_EXTERN rc_t CC KFileTimedWriteAll ( KFile *self, uint64_t pos,
-    const void *buffer, size_t size, size_t *num_writ, struct timeout_t *tm );
-
-/* WriteExactly
- * TimedWriteExactly
- *  write to file until "bytes" have been transferred
- *  or return incomplete transfer error
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ IN ] and "bytes" [ IN ] - data to be written
- *
- *  "tm" [ IN/OUT, NULL OKAY ] - an optional indicator of
- *  blocking behavior. not all implementations will support
- *  timed writes. a NULL timeout will block indefinitely,
- *  a value of "tm->mS == 0" will have non-blocking behavior
- *  if supported by implementation, and "tm->mS > 0" will indicate
- *  a maximum wait timeout.
- */
-KFS_EXTERN rc_t CC KFileWriteExactly ( KFile *self,
-    uint64_t pos, const void *buffer, size_t bytes );
-KFS_EXTERN rc_t CC KFileTimedWriteExactly ( KFile *self,
-    uint64_t pos, const void *buffer, size_t bytes, struct timeout_t *tm );
-
-/* MakeStdIn
- *  creates a read-only file on stdin
- */
-KFS_EXTERN rc_t CC KFileMakeStdIn ( const KFile **std_in );
-
-/* MakeStdOut
- * MakeStdErr
- *  creates a write-only file on stdout or stderr
- */
-KFS_EXTERN rc_t CC KFileMakeStdOut ( KFile **std_out );
-KFS_EXTERN rc_t CC KFileMakeStdErr ( KFile **std_err );
-
-
-KFS_EXTERN rc_t CC LoadKFileToNameList( struct KFile const * self, struct VNamelist * namelist );
-KFS_EXTERN rc_t CC LoadFileByNameToNameList( struct VNamelist * namelist, const char * filename );
-
-KFS_EXTERN rc_t CC WriteNameListToKFile( struct KFile * self, const VNamelist * namelist, 
-                                         const char * delim );
-LIB_EXPORT rc_t CC WriteNamelistToFileByName( const VNamelist * namelist, const char * filename,
-                                            const char * delim );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_file_ */
diff --git a/interfaces/kfs/file.hpp b/interfaces/kfs/file.hpp
deleted file mode 100644
index 866a960..0000000
--- a/interfaces/kfs/file.hpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _hpp_kfs_file_
-#define _hpp_kfs_file_
-
-#ifndef _h_kfs_file_
-#include <kfs/file.h>
-#endif
-
-//#include <kfs/md5.h> // KFileMakeMd5ForReadFromString
-
-/*--------------------------------------------------------------------------
- * KFile
- *  a file
- */
-struct KFile
-{
-    /* AddRef
-     * Release
-     *  ignores NULL references
-     */
-    inline rc_t AddRef () const throw ()
-    { return KFileAddRef ( this ); }
-
-    inline rc_t Release () const throw ()
-    { return KFileRelease ( this ); }
-
-    /* RandomAccess
-     *  ALMOST by definition, the file is random access
-     *
-     *  certain file types will refuse random access
-     *  these include FIFO and socket based files, but also
-     *  wrappers that require serial access ( e.g. compression )
-     *
-     *  returns 0 if random access, error code otherwise
-    */
-    inline rc_t RandomAccess () const throw()
-    { return KFileRandomAccess ( this ); }
-
-
-    /* Type
-     *  returns a KFileDesc
-     *  not intended to be a content type,
-     *  but rather an implementation class
-     */
-    inline uint32_t FileType() const throw()
-    { return KFileType ( this ); }
-
-
-    /* Size
-     *  returns size in bytes of file
-     *
-     *  "size" [ OUT ] - return parameter for file size
-     */
-    inline rc_t Size ( uint64_t *size ) const throw ()
-    { return KFileSize ( this, size ); }
-
-    /* SetSize
-     *  sets size in bytes of file
-     *
-     *  "size" [ IN ] - new file size
-     */
-    inline rc_t SetSize ( uint64_t size ) throw ()
-    { return KFileSetSize ( this, size ); }
-
-    /* Read
-     *  read file from known position
-     *
-     *  "pos" [ IN ] - starting position within file
-     *
-     *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
-     *
-     *  "num_read" [ OUT ] - return parameter giving number of bytes
-     *  actually read. when returned value is zero and return code is
-     *  also zero, interpreted as end of file.
-     */
-    inline rc_t Read ( uint64_t pos,
-        void *buffer, size_t bsize, size_t *num_read ) const throw ()
-    { return KFileRead ( this, pos, buffer, bsize, num_read ); }
-
-    /* Write
-     *  write file at known position
-     *
-     *  "pos" [ IN ] - starting position within file
-     *
-     *  "buffer" [ IN ] and "size" [ IN ] - data to be written
-     *
-     *  "num_writ" [ OUT, NULL OKAY ] - optional return parameter
-     *  giving number of bytes actually written
-     */
-    inline rc_t Write ( uint64_t pos,
-        const void *buffer, size_t size, size_t *num_writ ) throw ()
-    { return KFileWrite ( this, pos, buffer, size, num_writ ); }
-
-    /* MakeStdIn
-     *  creates a read-only file on stdin
-     */
-    static inline rc_t MakeStdIn ( const KFile **std_in ) throw ()
-    { return KFileMakeStdIn ( std_in ); }
-
-    /* MakeStdOut
-     * MakeStdErr
-     *  creates a write-only file on stdout or stderr
-     */
-    static inline rc_t MakeStdOut ( KFile **std_out ) throw ()
-    { return KFileMakeStdOut ( std_out ); }
-    static inline rc_t MakeStdErr ( KFile **std_err ) throw ()
-    { return KFileMakeStdErr ( std_err ); }
-     
-
-    /*/ MD5
-    static inline rc_t MakeMd5ForRead ( const KFile **f,
-        const KFile *src, const char digest[MD5_DIGEST_SIZE] )
-    { return KFileMakeMd5ForReadFromString ( f, src, digest ); }*/
-
-private:
-    KFile ();
-    ~ KFile ();
-    KFile ( const KFile& );
-    KFile &operator = ( const KFile& );
-};
-
-#endif // _hpp_kfs_file_
diff --git a/interfaces/kfs/fileformat.h b/interfaces/kfs/fileformat.h
deleted file mode 100644
index b68c635..0000000
--- a/interfaces/kfs/fileformat.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_fileformat_
-#define _h_kfs_fileformat_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct KDirectory;
-
-/*
- * Multiple descriptions can be attached to a single key.
- * At most one key can be attached to a single description.
- *
- * Multiple types can be attached to a single class.
- * At most one class can be attached to a single type.
- */
-
-
-/*--------------------------------------------------------------------------
- * KFileFormatType
- *  describes basic file content types.  The type can be used to choose what
- *  parser is used to extract information for a loader, archive as filesystem,
- *  or decompress for further parsing.
- */
-typedef
-int32_t KFileFormatType;
-enum KFileFormatType_e
-{
-    kfftError = -2,		/* A file that can not be read for typing */
-    kfftNotFound = -1,		/* not found in a search */
-    kfftUnknown = 0		/* not yet or file format not understood. */
-    /* other types are registered during construction **?** */
-};
-
-/* -------------------------------------------------------------------------
- * KFileFormatClass
- *   Describes which class of operations can be performed in a given file.
- *     Unknown: nothing in particular
- *     Compressed: decompressed to reveal different expanded file contents
- *     Archive: treated as a file system to reach contained files
- *     Run: loaded into the SRA DB
- */
-typedef
-int32_t KFileFormatClass;
-enum KFileFormatClass_e
-{
-    kffcError = -2,		/* A file that can not be read for typing */
-    kffcNotFound = -1,		/* not found in a search */
-    kffcUnknown = 0		/* not yet or file format not understood. */
-};
-
-/*--------------------------------------------------------------------------
- * KFileFormat
- */
-typedef struct KFileFormat KFileFormat;
-
-/* AddRef
- * Release
- *  ignores NULL references
- */
-KFS_EXTERN rc_t CC KFileFormatAddRef (const KFileFormat *self);
-KFS_EXTERN rc_t CC KFileFormatRelease (const KFileFormat *self);
-
-/* Type
- *  intended to be a content type,
- *  if type, class or desc is NULL those types are not returned
- */
-KFS_EXTERN rc_t CC KFileFormatGetTypeBuff (const KFileFormat *self, const void * buff, size_t buff_len,
-			KFileFormatType * type, KFileFormatClass * class,
-			char * description, size_t descriptionmax,
-			size_t * length);
-
-#define KFileFormatGetTypeBuffType(self,buff,buff_len,type) \
-    KFileFormatGetTypeBuff(self,buff,buff_len,type,NULL,NULL,0,NULL)
-
-#define KFileFormatGetTypeBuffClass(self,buff,buff_len,class) \
-    KFileFormatGetTypeBuff(self,buff,buff_len,NULL,class,NULL,0,NULL)
-
-/* useful for logging perhaps */
-#define KFileFormatGetTypeBuffDescr(self,buff,buff_len,descr,descr_max,descr_len)	\
-    KFileFormatGetTypeBuff(self,buff,buff_len,NULL,NULL,descr,descr_max,descr_len)
-
-KFS_EXTERN rc_t CC KFileFormatGetTypePath(const KFileFormat *self, const struct KDirectory * dir,
-                                          const char * path, KFileFormatType * type,
-                                          KFileFormatClass * class, char * description,
-                                          size_t descriptionmax, size_t * length);
-#define KFileFormatGetTypePathType(self,dir,path,type)			\
-    KFileFormatGetTypePath(self,dir,path,type,NULL,NULL,0,NULL)
-
-#define KFileFormatGetTypePathClass(self,dir,path,class)			\
-    KFileFormatGetTypePath(self,dir,path,NULL,class,NULL,0,NULL)
-
-/* useful for logging perhaps */
-#define KFileFormatGetTypePathDescr(self,dir,path,descr,descr_max,descr_len) \
-    KFileFormatGetTypePath(self,dir,path,NULL,NULL,descr,descr_max,descr_len)
-
-
-KFS_EXTERN rc_t CC KFileFormatGetClassDescr (const KFileFormat *self, KFileFormatClass c,
-			char * description, size_t descriptionmax);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_fileformat_ */
diff --git a/interfaces/kfs/gzip.h b/interfaces/kfs/gzip.h
deleted file mode 100644
index c5639fc..0000000
--- a/interfaces/kfs/gzip.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_gzip_
-#define _h_kfs_gzip_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KFile;
-
-/* MakeGzipForRead
- *  creates an adapter to gunzip a source file
- *
- *  "gz" [ OUT ] - return parameter for decompressed file
- *
- *  "src" [ IN ] - compressed source file with read permission
- *
- * NB - creates a read-only file that does NOT support random access
- *  i.e. must be consumed serially starting from offset 0
- */
-KFS_EXTERN rc_t CC KFileMakeGzipForRead ( struct KFile const **gz, struct KFile const *src );
-
-
-/* MakeGzipForWrite
- *  creates an adapter to gzip a source file
- *
- *  "gz" [ OUT ] - return parameter for compressed file
- *
- *  "src" [ IN ] - uncompressed source file with write permission
- *
- * NB - creates a write-only file that does NOT suppport random access
- *  i.e. must be written serially from offset 0
- */
-KFS_EXTERN rc_t CC KFileMakeGzipForWrite ( struct KFile **gz, struct KFile *file );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_gzip_ */
diff --git a/interfaces/kfs/impl.h b/interfaces/kfs/impl.h
deleted file mode 100644
index 086d2d6..0000000
--- a/interfaces/kfs/impl.h
+++ /dev/null
@@ -1,337 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_impl_
-#define _h_kfs_impl_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#ifndef _h_kfs_file_
-#include <kfs/file.h>
-#endif
-
-#ifndef _h_kfs_directory_
-#include <kfs/directory.h>
-#endif
-
-#ifndef _h_kfs_arrayfile_
-#include <kfs/arrayfile.h>
-#endif
-
-#ifndef _h_klib_refcount_
-#include <klib/refcount.h>
-#endif
-
-#ifndef _h_klib_namelist_
-#include <klib/namelist.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KBufFile;
-struct KSysDir;
-struct KSysFile;
-typedef union KFile_vt KFile_vt;
-typedef union KDirectory_vt KDirectory_vt;
-
-
-/*--------------------------------------------------------------------------
- * KFile
- *  a virtual file
- */
-struct KFile
-{
-    const KFile_vt *vt;
-    const KDirectory *dir;
-    KRefcount refcount;
-    uint8_t read_enabled;
-    uint8_t write_enabled;
-    uint8_t align [ 2 ];
-};
-
-#ifndef KFILE_IMPL
-#define KFILE_IMPL struct KFile
-#endif
-
-typedef struct KFile_vt_v1 KFile_vt_v1;
-struct KFile_vt_v1
-{
-    /* version == 1.x */
-    uint32_t maj;
-    uint32_t min;
-
-    /* start minor version == 0 */
-    rc_t ( CC * destroy ) ( KFILE_IMPL *self );
-    struct KSysFile* ( CC * get_sysfile ) ( const KFILE_IMPL *self, uint64_t *offset );
-    rc_t ( CC * random_access ) ( const KFILE_IMPL *self );
-    rc_t ( CC * get_size ) ( const KFILE_IMPL *self, uint64_t *size );
-    rc_t ( CC * set_size ) ( KFILE_IMPL *self, uint64_t size );
-    /* num_read and num_writ are guaranteed non-NULL */
-    rc_t ( CC * read ) ( const KFILE_IMPL *self, uint64_t pos,
-        void *buffer, size_t bsize, size_t *num_read );
-    rc_t ( CC * write ) ( KFILE_IMPL *self, uint64_t pos,
-        const void *buffer, size_t size, size_t *num_writ );
-    /* end minor version == 0 */
-
-    /* start minor version == 1 */
-    uint32_t ( CC * get_type ) ( const KFILE_IMPL * self );
-    /* end minor version == 1 */
-
-    /* start minor version == 2 */
-    rc_t ( CC * timed_read ) ( const KFILE_IMPL *self, uint64_t pos,
-        void *buffer, size_t bsize, size_t *num_read, struct timeout_t *tm );
-    rc_t ( CC * timed_write ) ( KFILE_IMPL *self, uint64_t pos,
-        const void *buffer, size_t size, size_t *num_writ, struct timeout_t *tm );
-    /* end minor version == 2 */
-
-    /* ANY NEW ENTRIES MUST BE REFLECTED IN libs/kfs/file.c
-       BY BOTH THE CORRESPONDING MESSAGE DISPATCH FUNCTION(s) AND
-       VTABLE VALIDITY CHECKS IN KFileInit */
-};
-
-union KFile_vt
-{
-    KFile_vt_v1 v1;
-};
-
-/* Init
- *  initialize a newly allocated file object
- */
-KFS_EXTERN rc_t CC KFileInit ( KFile *self, const KFile_vt *vt,
-    const char *classname, const char *fname,
-    bool read_enabled, bool write_enabled );
-
-/* Destroy
- *  destroy file
- */
-KFS_EXTERN rc_t CC KFileDestroy ( KFile *self );
-
-/* GetSysFile
- *  returns an underlying system file object
- *  and starting offset to contiguous region
- *  suitable for memory mapping, or NULL if
- *  no such file is available.
- */
-KFS_EXTERN struct KSysFile* CC KFileGetSysFile ( const KFile *self, uint64_t *offset );
-
-
-/*--------------------------------------------------------------------------
- * KDirectory
- *  a virtual directory
- */
-struct KDirectory
-{
-    const KDirectory_vt *vt;
-    KRefcount refcount;
-    uint8_t read_only;
-    uint8_t align [ 3 ];
-};
-
-#ifndef KDIR_IMPL
-#define KDIR_IMPL KDirectory
-#endif
-
-typedef struct KDirectory_vt_v1 KDirectory_vt_v1;
-struct KDirectory_vt_v1
-{
-    /* version == 1.x */
-    uint32_t maj;
-    uint32_t min;
-
-    /* start minor version == 0 */
-    rc_t ( CC * destroy ) ( KDIR_IMPL *self );
-    rc_t ( CC * list_dir ) ( const KDIR_IMPL *self, struct KNamelist **list,
-         bool ( CC * f ) ( const KDirectory *dir, const char *name, void *data ),
-         void *data, const char *path, va_list args );
-    rc_t ( CC * visit ) ( const KDIR_IMPL *self, bool recurse,
-        rc_t ( CC * f ) ( const KDirectory*, uint32_t, const char*, void* ),
-        void *data, const char *path, va_list args );
-    rc_t ( CC * visit_update ) ( KDIR_IMPL *self, bool recurse,
-        rc_t ( CC * f ) ( KDirectory*, uint32_t, const char*, void* ),
-        void *data, const char *path, va_list args );
-    uint32_t ( CC * path_type ) ( const KDIR_IMPL *self, const char *path, va_list args );
-    rc_t ( CC * resolve_path ) ( const KDIR_IMPL *self, bool absolute,
-        char *resolved, size_t rsize, const char *path, va_list args );
-    rc_t ( CC * resolve_alias ) ( const KDIR_IMPL *self, bool absolute,
-        char *resolved, size_t rsize, const char *alias, va_list args );
-    rc_t ( CC * rename ) ( KDIR_IMPL *self, bool force, const char *from, const char *to );
-    rc_t ( CC * remove ) ( KDIR_IMPL *self, bool force, const char *path, va_list args );
-    rc_t ( CC * clear_dir ) ( KDIR_IMPL *self, bool force, const char *path, va_list args );
-    rc_t ( CC * access ) ( const KDIR_IMPL *self,
-        uint32_t *access, const char *path, va_list args );
-    rc_t ( CC * set_access ) ( KDIR_IMPL *self, bool recurse,
-        uint32_t access, uint32_t mask, const char *path, va_list args );
-    rc_t ( CC * create_alias ) ( KDIR_IMPL *self, uint32_t access,
-        KCreateMode mode, const char *targ, const char *alias );
-    rc_t ( CC * open_file_read ) ( const KDIR_IMPL *self,
-        const KFile **f, const char *path, va_list args );
-    rc_t ( CC * open_file_write ) ( KDIR_IMPL *self,
-        KFile **f, bool update, const char *path, va_list args );
-    rc_t ( CC * create_file ) ( KDIR_IMPL *self, KFile **f, bool update,
-        uint32_t access, KCreateMode mode, const char *path, va_list args );
-    rc_t ( CC * file_size ) ( const KDIR_IMPL *self,
-        uint64_t *size, const char *path, va_list args );
-    rc_t ( CC * set_size ) ( KDIR_IMPL *self,
-        uint64_t size, const char *path, va_list args );
-    rc_t ( CC * open_dir_read ) ( const KDIR_IMPL *self,
-        const KDirectory **sub, bool chroot, const char *path, va_list args );
-    rc_t ( CC * open_dir_update ) ( KDIR_IMPL *self,
-        KDirectory **sub, bool chroot, const char *path, va_list args );
-    rc_t ( CC * create_dir ) ( KDIR_IMPL *self, uint32_t access,
-        KCreateMode mode, const char *path, va_list args );
-
-    /* optional destructor method - leave NULL if not needed */
-    rc_t ( CC * destroy_file ) ( KDIR_IMPL *self, KFile *f );
-    /* end minor version == 0 */
-
-    /* start minor version == 1 */
-    rc_t ( CC * date ) ( const KDIR_IMPL *self,
-        KTime_t * date, const char *path, va_list args );
-    rc_t ( CC * setdate ) ( KDIR_IMPL * self, bool recurse,
-        KTime_t date, const char *path, va_list args );
-    struct KSysDir* ( CC * get_sysdir ) ( const KDIR_IMPL *self );
-    /* end minor version == 1 */
-
-    /* start minor version == 2 */
-    rc_t ( CC * file_locator ) ( const KDIR_IMPL *self,
-        uint64_t *locator, const char *path, va_list args );
-    /* end minor version == 2 */
-
-    /* start minor version == 3 */
-    rc_t ( CC * file_phys_size ) ( const KDIR_IMPL *self,
-        uint64_t *phys_size, const char *path, va_list args );
-    rc_t ( CC * file_contiguous ) ( const KDIR_IMPL *self,
-        bool *contiguous, const char *path, va_list args );
-    /* end minor version == 3 */
-
-    /* ANY NEW ENTRIES MUST BE REFLECTED IN libs/kfs/directory.c
-       BY BOTH THE CORRESPONDING MESSAGE DISPATCH FUNCTION(s) AND
-       VTABLE VALIDITY CHECKS IN KDirectoryInit */
-};
-
-union KDirectory_vt
-{
-    KDirectory_vt_v1 v1;
-};
-
-/* Init
- *  initialize a newly allocated directory object
- */
-KFS_EXTERN rc_t CC KDirectoryInit ( KDirectory *self, const KDirectory_vt *vt, 
-    const char * class_name, const char * path, bool update );
-
-/* DestroyFile
- *  does whatever is necessary with an unreferenced file
- */
-KFS_EXTERN rc_t CC KDirectoryDestroyFile ( const KDirectory *self, KFile *f );
-
-/* GetSysDir
- *  returns an underlying system file object
- */
-KFS_EXTERN struct KSysDir* CC KDirectoryGetSysDir ( const KDirectory *self );
-
-
-/* RealPath
- *  exposes functionality of system directory
- */
-KFS_EXTERN rc_t CC KSysDirRealPath ( struct KSysDir const *self,
-    char *real, size_t bsize, const char *path, ... );
-KFS_EXTERN rc_t CC KSysDirVRealPath ( struct KSysDir const *self,
-    char *real, size_t bsize, const char *path, va_list args );
-
-
-/*--------------------------------------------------------------------------
- * KArrayFile
- *  an array-file is created from a KFile
- */
-typedef union  KArrayFile_vt KArrayFile_vt;
-struct KArrayFile
-{
-    const KArrayFile_vt *vt;
-    KRefcount refcount;
-    uint8_t read_enabled;
-    uint8_t write_enabled;
-    uint8_t align [ 2 ];
-};
-
-#ifndef KARRAYFILE_IMPL
-#define KARRAYFILE_IMPL KArrayFile
-#endif
-
-typedef struct KArrayFile_vt_v1 KArrayFile_vt_v1;
-struct KArrayFile_vt_v1
-{
-    /* version number */
-    uint32_t maj, min;
-
-    /* start minor version == 0 */
-    rc_t ( CC * destroy ) ( KARRAYFILE_IMPL *self );
-    rc_t ( CC * dimensionality ) ( const KARRAYFILE_IMPL *self, uint8_t *dim );
-    rc_t ( CC * set_dimensionality ) ( KARRAYFILE_IMPL *self, uint8_t dim );
-    rc_t ( CC * dim_extents ) ( const KARRAYFILE_IMPL *self, uint8_t dim, uint64_t *extents );
-    rc_t ( CC * set_dim_extents ) ( KARRAYFILE_IMPL *self, uint8_t dim, uint64_t *extents );
-    rc_t ( CC * element_size ) ( const KARRAYFILE_IMPL *self, uint64_t *elem_bits );
-    rc_t ( CC * read ) ( const KARRAYFILE_IMPL *self, uint8_t dim,
-        const uint64_t *pos, void *buffer, const uint64_t *elem_count,
-        uint64_t *num_read );
-    rc_t ( CC * write ) ( KARRAYFILE_IMPL *self, uint8_t dim,
-        const uint64_t *pos, const void *buffer, const uint64_t *elem_count,
-        uint64_t *num_writ );
-    rc_t ( CC * get_meta ) ( const KARRAYFILE_IMPL *self, const char *key, 
-                             const KNamelist **list );
-
-    rc_t ( CC * read_v ) ( const KARRAYFILE_IMPL *self, uint8_t dim,
-        const uint64_t * pos, char * buffer, const uint64_t buffer_size,
-        uint64_t * num_read );
-
-    /* end minor version == 0 */
-};
-
-union KArrayFile_vt
-{
-    KArrayFile_vt_v1 v1;
-};
-
-/* Init
- *  initialize a newly allocated array-file object
- */
-KFS_EXTERN rc_t CC KArrayFileInit ( KArrayFile *self, const KArrayFile_vt *vt, 
-    bool read_enabled, bool write_enabled );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_impl_ */
diff --git a/interfaces/kfs/kfs-priv.h b/interfaces/kfs/kfs-priv.h
deleted file mode 100644
index 49d0c9c..0000000
--- a/interfaces/kfs/kfs-priv.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_priv_
-#define _h_kfs_priv_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * struct/class forwards
- */
-struct KArrayFile;
-struct KDirectory;
-struct KDlset;
-struct KFile;
-struct KNamelist;
-struct KPath;
-
-/* MakeFDFile
- *  creates a file from a file-descriptor
- *  not supported under Windows
- */
-KFS_EXTERN rc_t CC KFileMakeFDFileRead ( struct KFile const **f, int fd );
-KFS_EXTERN rc_t CC KFileMakeFDFileWrite ( struct KFile **f, bool update, int fd );
-
-/* GetMeta
- *  extracts metadata into a string-vector
- *
- *  "key"   [ IN ]  - the key which part of the metadata to retrieve
- *
- *  "list"  [ OUT ] - the metadata will be filled into this list
- *
- */
-KFS_EXTERN rc_t CC KArrayFileGetMeta ( struct KArrayFile const *self, const char *key,
-    const struct KNamelist **list );
-
-/* List
- *  list the paths to the libraries in the set
- */
-KFS_EXTERN rc_t CC KDlsetList ( struct KDlset const *self, struct KNamelist **list );
-
-
-#if WINDOWS
-
-/* PosixStringToSystemString
- * converts posix path string to system path
- *  "buffer" [ OUT ] - NUL terminated system path string
- *  "bsize" [ IN ] - buffer length
- *  "path" [ IN ] - NUL terminated posix path string
- */
-KFS_EXTERN rc_t CC KDirectoryPosixStringToSystemString (
-    const struct KDirectory *self,
-    char *buffer, size_t bsize, const char *path, ... );
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_priv_ */
diff --git a/interfaces/kfs/lockfile.h b/interfaces/kfs/lockfile.h
deleted file mode 100644
index ef83254..0000000
--- a/interfaces/kfs/lockfile.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_lockfile_
-#define _h_kfs_lockfile_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#ifndef _h_kfs_defs_
-#include <kfs/defs.h>
-#endif
-
-#include <stdarg.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KFile;
-struct KDirectory;
-
-
-/*--------------------------------------------------------------------------
- * KLockFile
- *  a mutual exclusion lock on a file
- *  the lock is acquired upon creation
- *  and released upon destruction
- *
- * NB - only guaranteed to work when used from a single host
- */
-typedef struct KLockFile KLockFile;
-
-
-/* AddRef
- * Release
- */
-KFS_EXTERN rc_t CC KLockFileAddRef ( const KLockFile *self );
-KFS_EXTERN rc_t CC KLockFileRelease ( const KLockFile *self );
-
-
-
-/*--------------------------------------------------------------------------
- * KDirectory
- *  interface extensions
- */
-
-
-/* CreateLockFile
- *  attempts to create a KLockFile
- *
- *  "lock" [ OUT ] - return parameter for newly created lock file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting lock file
- */
-KFS_EXTERN rc_t CC KDirectoryCreateLockFile ( struct KDirectory *self,
-    KLockFile **lock, const char *path, ... );
-KFS_EXTERN rc_t CC KDirectoryVCreateLockFile ( struct KDirectory *self,
-    KLockFile **lock, const char *path, va_list args );
-
-
-/* CreateExclusiveAccessFile
- *  opens a file with exclusive write access
- *
- *  "f" [ OUT ] - return parameter for newly opened file
- *
- *  "update" [ IN ] - if true, open in read/write mode
- *  otherwise, open in write-only mode
- *
- *  "access" [ IN ] - standard Unix access mode, e.g. 0664
- *
- *  "mode" [ IN ] - a creation mode ( see explanation above ).
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- */
-KFS_EXTERN rc_t CC KDirectoryCreateExclusiveAccessFile ( struct KDirectory *self, struct KFile **f,
-    bool update, uint32_t access, KCreateMode mode, const char *path, ... );
-KFS_EXTERN rc_t CC KDirectoryVCreateExclusiveAccessFile ( struct KDirectory *self, struct KFile **f,
-    bool update, uint32_t access, KCreateMode mode, const char *path, va_list args );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_lockfile_ */
diff --git a/interfaces/kfs/md5.h b/interfaces/kfs/md5.h
deleted file mode 100644
index 798f827..0000000
--- a/interfaces/kfs/md5.h
+++ /dev/null
@@ -1,289 +0,0 @@
-/*=======================================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_md5_
-#define _h_kfs_md5_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KFile;
-
-
-/*--------------------------------------------------------------------------
- * KMD5SumFmt
- *  a formatter for reading or writing an md5sum-style checksum file
- */
-typedef struct KMD5SumFmt KMD5SumFmt;
-
-
-/* AddRef
- * Release
- */
-KFS_EXTERN rc_t CC KMD5SumFmtAddRef ( const KMD5SumFmt *self );
-KFS_EXTERN rc_t CC KMD5SumFmtRelease ( const KMD5SumFmt *self );
-
-
-/* Make
- *  creates a formatted accessor to textual checksum file
- *  takes over ownership of "in"/"out" file reference
- *
- *  "in" [ IN ] - readable checksum input file
- *  -OR-
- *  "out" [ IN ] - writable checksum file. if readable as well,
- *  its contents will be preserved.
- */
-KFS_EXTERN rc_t CC KMD5SumFmtMakeRead ( const KMD5SumFmt **f, struct KFile const *in );
-KFS_EXTERN rc_t CC KMD5SumFmtMakeUpdate ( KMD5SumFmt **f, struct KFile *out );
-
-
-/* Count
- *  return the number of checksums in file
- */
-KFS_EXTERN rc_t CC KMD5SumFmtCount ( const KMD5SumFmt *self, uint32_t *count );
-
-
-/* Get
- *  retrieve an indexed checksum line
- *
- *  "idx" [ IN ] - zero-based index of checksum to access
- *
- *  "path" [ OUT ] and "size" [ IN ] - return buffer for file path
- *
- *  "digest" [ OUT ] - return parameter for the MD5 checksum
- *
- *  "bin" [ OUT, NULL OKAY ] - true if fopen mode used to
- *  calculate "digest" was binary, false if text. pertinent if
- *  digest was calculated using DOS text mode.
- */
-KFS_EXTERN rc_t CC KMD5SumFmtGet ( const KMD5SumFmt *self, uint32_t idx,
-    char *path, size_t size, uint8_t digest [ 16 ], bool *bin );
-
-
-/* Find
- *  retrieve checksum line by path
- *
- *  "path" [ IN ] - NUL terminated string in OS-native char set
- *  denoting path to file
- *
- *  "digest" [ OUT ] - return parameter for the MD5 checksum
- *
- *  "bin" [ OUT, NULL OKAY ] - true if fopen mode used to
- *  calculate "digest" was binary, false if text. pertinent if
- *  digest was calculated using DOS text mode.
- */
-KFS_EXTERN rc_t CC KMD5SumFmtFind ( const KMD5SumFmt *self,
-    const char *path, uint8_t digest [ 16 ], bool *bin );
-
-
-/* Delete
- *  remove an existing line
- *
- *  "path" [ IN ] - NUL terminated string in OS-native char set
- *  denoting path to file
- *
- *  returns rcNotFound if not present
- */
-KFS_EXTERN rc_t CC KMD5SumFmtDelete ( KMD5SumFmt *self, const char *path );
-
-
-/* Update
- *  add a checksum line to file or update an existing line
- *
- *  "path" [ IN ] - NUL terminated string in OS-native char set
- *  denoting path to file
- *
- *  "digest" [ IN ] - calculated MD5 checksum
- *
- *  "bin" [ IN ] - true if checksum was calculated on all bytes
- *  in file, false if fopen mode used to read file was text.
- *
- * NB - the md5sum tool operates with the assumption that files
- *  are opened using "fopen". it records the mode used by prepending
- *  '*' to indicate binary and ' ' to indicate text mode within the
- *  checksum line.
- *
- *  unfortunately, this creates a situation where text-mode files
- *  checksummed on DOS cannot be properly checked on any other
- *  platform without the aid of some filter to drop out '\r' from
- *  a '\r\n' sequence.
- *
- *  fortunately, most users are unaware of the binary/text mode
- *  switches available with md5sum and use the default mode, which
- *  is binary on DOS and text on Unix, which happens to be equivalent
- *  to binary ( making one wonder why binary is not instead the
- *  universal default ).
- *
- *  the end result is that we need to indicate whether CR stripping
- *  was performed while at the same time behaving like md5sum.
- */
-KFS_EXTERN rc_t CC KMD5SumFmtUpdate ( KMD5SumFmt *self, const char *path,
-    const uint8_t digest [ 16 ], bool bin );
-
-/* Rename
- * Rename the checksum line to reflect a file name change but no content change.
- *
- *  "newpath" [ IN ] - NUL terminated string in OS-native char set
- *  denoting path to file's new name
- *
- *  "oldpath" [ IN ] - NUL terminated string in OS-native char set
- *  denoting path to file's old name
- *
- * Parameter order matches KDirectoryRename()
- */
-KFS_EXTERN rc_t CC KMD5SumFmtRename ( KMD5SumFmt *self, const char *oldpath, const char *newpath );
-
-
-/* Flush
- *  write data to disk, but stay open
- */
-KFS_EXTERN rc_t CC KMD5SumFmtFlush ( KMD5SumFmt *self );
-
-
-/*--------------------------------------------------------------------------
- * MD5 KFile extensions
- */
-
-/* MakeMD5Read
- *  creates an adapter to check MD5 checksum for a source file
- *
- *  "f" [ OUT ] - return parameter for file with md5 check
- *
- *  "src" [ IN ] - source file with read permission
- *
- *  "digest" [ IN ] - MD5 checksum to match
- *
- * NB - creates a read-only file that does NOT support random access
- *  i.e. must be consumed serially starting from offset 0
- */
-KFS_EXTERN rc_t CC KFileMakeMD5Read ( struct KFile const **f,
-    struct KFile const *src, const uint8_t digest [ 16 ] );
-
-    
-/*--------------------------------------------------------------------------
- * KMD5File
- *  subclass of KFile
- */
-typedef struct KMD5File KMD5File;
-
-
-/* MakeWrite
- * MakeAppend
- *  creates an adapter to create MD5 checksum for a file
- *
- *  "f" [ OUT ] - return parameter for file with md5 check
- *
- *  "out" [ IN ] - output file with write permission
- *  since this file is being wrapped by "f", ownership of
- *  the provided reference is transferred to "f"
- *
- *  "md5" [ IN ] - md5 checksum output formatter.
- *  since this may be used for multiple checksums, "f" will
- *  attach its own reference to "md5".
- *
- *  "path" [ IN ] - md5 checksum output file path, used to
- *  create standard md5sum file entry.
- *
- * NB - creates a write-only file that does NOT suppport random access
- *  i.e. must be written serially from offset 0
- */
-KFS_EXTERN rc_t CC KMD5FileMakeWrite ( KMD5File **f,
-    struct KFile *out, KMD5SumFmt *md5, const char *path );
-KFS_EXTERN rc_t CC KMD5FileMakeAppend ( KMD5File **f,
-    struct KFile *out, KMD5SumFmt *md5, const char *path );
-
-/* MakeReadNew
- *  creates an adapter to create MD5 checksum for a file
- *
- *  "f" [ OUT ] - return parameter for file with md5 check
- *
- *  "in" [ IN ] - input file 
- *  since this file is being wrapped by "f", ownership of
- *  the provided reference is transferred to "f"
- *
- *  "md5" [ IN ] - md5 checksum output formatter.
- *  since this may be used for multiple checksums, "f" will
- *  attach its own reference to "md5".
- *
- *  "path" [ IN ] - md5 checksum output file path, used to
- *  create standard md5sum file entry.
- *
- * NB - creates a write-only file that does NOT suppport random access
- *  i.e. must be written serially from offset 0
- */
-KFS_EXTERN rc_t CC KFileMakeNewMD5Read ( const struct KFile **fp,
-    const struct KFile *in, KMD5SumFmt *md5, const char *path );
-
-
-/* ToKFile
- *  an MD5 file is a subclass of KFile
- *  this is an explicit cast operator
- */
-KFS_EXTERN struct KFile* CC KMD5FileToKFile ( KMD5File *self );
-KFS_EXTERN struct KFile const* CC KMD5FileToKFileConst ( const KMD5File *self );
-
-/* BeginTransaction
- *  preserve current MD5 state and file marker
- *  in preparation for rollback
- */
-KFS_EXTERN rc_t CC KMD5FileBeginTransaction ( KMD5File *self );
-
-
-/* Commit
- *  accept current MD5 state as correct
- */
-KFS_EXTERN rc_t CC KMD5FileCommit ( KMD5File *self );
-
-
-/* Revert
- *  reset state to previous transaction boundary conditions
- */
-KFS_EXTERN rc_t CC KMD5FileRevert ( KMD5File *self );
-
-/* Reset
- *  reset state to that of an empty file
- *  aborts any open transaction
- */
-KFS_EXTERN rc_t CC KMD5FileReset ( KMD5File *self );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_md5_ */
diff --git a/interfaces/kfs/mmap.h b/interfaces/kfs/mmap.h
deleted file mode 100644
index ca442d8..0000000
--- a/interfaces/kfs/mmap.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_mmap_
-#define _h_kfs_mmap_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KFile;
-
-
-/*--------------------------------------------------------------------------
- * KMMap
- *  a memory mapped region
- */
-typedef struct KMMap KMMap;
-
-/* AddRef
- * Release
- *  ignores NULL references
- */
-KFS_EXTERN rc_t CC KMMapAddRef ( const KMMap *self );
-KFS_EXTERN rc_t CC KMMapRelease ( const KMMap *self );
-
-/* Size
- *  returns size of memory region
- *
- *  "size" [ OUT ] - return parameter for region size
- */
-KFS_EXTERN rc_t CC KMMapSize ( const KMMap *self, size_t *size );
-
-/* Position
- *  returns region starting offset into mapped file
- *
- *  "pos" [ OUT ] - return parameter for file offset
- */
-KFS_EXTERN rc_t CC KMMapPosition ( const KMMap *self, uint64_t *pos );
-
-/* Reposition
- *  shift region to a new position
- *  may change region size
- *
- *  "pos" [ IN ] - new starting position for region
- *
- *  "size" [ OUT, NULL OKAY ] - optional return parameter
- *  for resultant region size
- */
-KFS_EXTERN rc_t CC KMMapReposition ( const KMMap *self, uint64_t pos, size_t *size );
-
-/* Addr
- *  returns starting address of memory region
- *
- *  "addr" [ OUT ] - return parameter for memory address
- */
-KFS_EXTERN rc_t CC KMMapAddrRead ( const KMMap *self, const void **addr );
-KFS_EXTERN rc_t CC KMMapAddrUpdate ( KMMap *self, void **addr );
-
-/* Make
- *  maps entire file
- *
- *  "f" [ IN ] - file to map.
- *  a new reference will be added
- */
-KFS_EXTERN rc_t CC KMMapMakeRead ( const KMMap **mm, struct KFile const *f );
-KFS_EXTERN rc_t CC KMMapMakeUpdate ( KMMap **mm, struct KFile *f );
-
-/* MakeMax
- *  maps as much of a file as possible
- *
- *  "f" [ IN ] - file to map.
- *  a new reference will be added
- */
-KFS_EXTERN rc_t CC KMMapMakeMaxRead ( const KMMap **mm, struct KFile const *f );
-KFS_EXTERN rc_t CC KMMapMakeMaxUpdate ( KMMap **mm, struct KFile *f );
-
-/* MakeRgn
- *  maps a portion of a file
- *
- *  "f" [ IN ] - file to map
- *  a new reference will be added
- *
- *  "pos" [ IN ] - starting offset into file
- *
- *  "size" [ IN, DEFAULT ZERO ] - size of resulting region. if 0,
- *  the size will be interpreted as meaning size of "f" - "pos".
- */
-KFS_EXTERN rc_t CC KMMapMakeRgnRead ( const KMMap **mm,
-    struct KFile const *f, uint64_t pos, size_t size );
-KFS_EXTERN rc_t CC KMMapMakeRgnUpdate ( KMMap **mm,
-    struct KFile *f, uint64_t pos, size_t size );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_mmap_ */
diff --git a/interfaces/kfs/nullfile.h b/interfaces/kfs/nullfile.h
deleted file mode 100644
index 35bf866..0000000
--- a/interfaces/kfs/nullfile.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_nullfile_
-#define _h_kfs_nullfile_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct KFile;
-
-typedef struct KNullFile KNullFile;
-
-/* -----
- * Copy can be a serialized type KFile for a KNullFile opened for Read but
- * not when opened for write.
- *
- * Specifically this means copy can be a KMD5File for read but not for write
- * other KFile nulltypes might have the same restriction.
- *
- * A seekless update KNullfile can be created but does not now exist.
- */
-KFS_EXTERN rc_t CC KFileMakeNullRead (const struct KFile ** self);
-KFS_EXTERN rc_t CC KFileMakeNullUpdate (struct KFile ** self);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_nullfile_ */
diff --git a/interfaces/kfs/pagefile.h b/interfaces/kfs/pagefile.h
deleted file mode 100644
index 3183576..0000000
--- a/interfaces/kfs/pagefile.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_pagefile_
-#define _h_kfs_pagefile_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KFile;
-
-
-/*--------------------------------------------------------------------------
- * KPage
- *  a reference counted page
- */
-typedef struct KPage KPage;
-
-
-/* AddRef
- * Release
- *  ignores NULL references
- */
-KFS_EXTERN rc_t CC KPageAddRef ( const KPage *self );
-KFS_EXTERN rc_t CC KPageRelease ( const KPage *self );
-
-
-/* Id
- *  returns page id
- *
- *  "page_id" [ OUT ] - return parameter for page id
- */
-KFS_EXTERN rc_t CC KPageId ( const KPage *self, uint32_t *page_id );
-
-
-/* ConstSize
- *  returns constant page size
- */
-KFS_EXTERN size_t CC KPageConstSize ( void );
-
-
-/* AccessRead
- * AccessUpdate
- *  gain access to page memory
- *  update access marks page as modified
- *
- *  "mem" [ OUT ] - pointer to page
- *
- *  "bytes" [ OUT, NULL OKAY ] - page size in bytes
- */
-KFS_EXTERN rc_t CC KPageAccessRead ( const KPage *self, const void **mem, size_t *bytes );
-KFS_EXTERN rc_t CC KPageAccessUpdate ( KPage *self, void **mem, size_t *bytes );
-
-
-/*--------------------------------------------------------------------------
- * KPageFile
- *  presents some level of page management on top of a random-access KFile
- */
-typedef struct KPageFile KPageFile;
-
-
-/* Make
- *  creates a page file
- *
- *  "pf" [ OUT ] - return parameter for page file
- *
- *  "backing" [ IN ] - backing file
- *   NB - attaches a new reference to file
- *        does not take ownership
- *
- *  "climit" [ IN ] - cache size limit
- *
- *  "write_through" [ IN ] - if true, causes page flushing
- *  on each KPageRelease message if modified.
- */
-KFS_EXTERN rc_t CC KPageFileMakeRead ( const KPageFile **pf,
-    struct KFile const *backing, size_t climit );
-KFS_EXTERN rc_t CC KPageFileMakeUpdate ( KPageFile **pf,
-    struct KFile *backing, size_t climit, bool write_through );
-
-
-/* AddRef
- * Release
- *  ignores NULL references
- */
-KFS_EXTERN rc_t CC KPageFileAddRef ( const KPageFile *self );
-KFS_EXTERN rc_t CC KPageFileRelease ( const KPageFile *self );
-
-
-/* Size
- *  returns size in bytes of file and cache
- *
- *  "lsize" [ OUT, NULL OKAY ] - return parameter for logical size
- *
- *  "fsize" [ OUT, NULL OKAY ] - return parameter for file size
- *
- *  "csize" [ OUT, NULL OKAY ] - return parameter for cache size
- */
-KFS_EXTERN rc_t CC KPageFileSize ( const KPageFile *self,
-    uint64_t *lsize, uint64_t *fsize, size_t *csize );
-
-
-/* SetSize
- *  extends or truncates underlying file
- *  may affect cache contents
- *
- *  "size" [ IN ] - logical size
- */
-KFS_EXTERN rc_t CC KPageFileSetSize ( KPageFile *self, uint64_t size );
-
-
-/* Alloc
- *  allocates a new page
- *  the page will be zeroed and initially unmodified
- *
- *  "page" [ OUT ] - return parameter for page object
- *
- *  "page_id" [ OUT, NULL OKAY ] - optional return parameter for page id
- */
-KFS_EXTERN rc_t CC KPageFileAlloc ( KPageFile *self, KPage **page, uint32_t *page_id );
-
-
-/* Get
- *  returns an existing page
- *
- *  "page" [ OUT ] - return parameter for page object
- *
- *  "page_id" [ IN ] - id of page to retrieve
- */
-KFS_EXTERN rc_t CC KPageFileGet ( KPageFile *self, KPage **page, uint32_t page_id );
-
-
-/* PosGet
- *  returns a page corresponding to position
- *
- *  "page" [ OUT ] - return parameter for page object
- *
- *  "offset" [ IN ] - offset to a byte within file
- */
-KFS_EXTERN rc_t CC KPageFilePosGet ( KPageFile *self, KPage **page, uint64_t offset );
-
-
-/* DropBacking
- *  used immediately prior to releasing
- *  prevents modified pages from being flushed to disk
- *  renders object nearly useless
- */
-KFS_EXTERN rc_t CC KPageFileDropBacking ( KPageFile *self );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_pagefile_ */
diff --git a/interfaces/kfs/pmem.h b/interfaces/kfs/pmem.h
deleted file mode 100644
index 4f0ece4..0000000
--- a/interfaces/kfs/pmem.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_pmem_
-#define _h_kfs_pmem_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KPageFile;
-
-
-/*--------------------------------------------------------------------------
- * KMemBank
- *  manages simple blocks of memory
- *  optionally backed by a persistent page file
- */
-typedef struct KMemBank KMemBank;
-
-
-/* Make
- *  make a memory bank with a fixed block size
- *  the total amount of memory may be limited
- *  the memory may be drawn from an externally supplied page file
- *
- *  "block_size" [ IN ] - must be an even multiple of 2, minimum 64
- *
- *  "limit" [ IN, DFLT ZERO ] - the maximum number of bytes
- *  to be allocated zero for unlimited
- *
- *  "backing" [ IN, NULL OKAY ] - a page source for allocator.
- *  a new reference will be added if not null.
- */
-KFS_EXTERN rc_t CC KMemBankMake ( KMemBank **bank,
-    size_t block_size, uint64_t limit, struct KPageFile *backing );
-
-
-/* AddRef
- * Release
- */
-KFS_EXTERN rc_t CC KMemBankAddRef ( const KMemBank *self );
-KFS_EXTERN rc_t CC KMemBankRelease ( const KMemBank *self );
-
-
-/* Alloc
- *  allocate memory
- *
- *  "id" [ OUT ] - return parameter for memory allocation id
- *
- *  "bytes" [ IN ] - the number of bytes to allocate
- *
- *  "clear" [ IN ] - if true, initialize the memory to zero
- */
-KFS_EXTERN rc_t CC KMemBankAlloc ( KMemBank *self,
-    uint64_t *id, uint64_t bytes, bool clear );
-
-
-/* Free
- *  free memory
- *
- *  "id" [ IN, ZERO OKAY ] - id of the allocation to be freed
- */
-KFS_EXTERN rc_t CC KMemBankFree ( KMemBank *self, uint64_t id );
-
-
-/* Size
- *  returns the allocated capacity of the memory object
- *
- *  "id" [ IN ] - id of the allocation
- *
- *  "size" [ OUT ] - return parameter
- */
-KFS_EXTERN rc_t CC KMemBankSize ( const KMemBank *self, uint64_t id, uint64_t *size );
-
-
-/* SetSize
- *  performs a reallocation of memory object
- *
- *  "id" [ IN ] - id of the allocation being resized
- *
- *  "size" [ IN ] - new capacity
- */
-KFS_EXTERN rc_t CC KMemBankSetSize ( KMemBank *self, uint64_t id, uint64_t size );
-
-
-/* Read
- *  linearly access memory
- *
- *  "id" [ IN ] - id of the allocation being read
- *
- *  "pos" [ IN ] - starting offset into allocation
- *
- *  "buffer" [ IN ] and "bsize" [ IN ] - buffer for returned data
- *
- *  "num_read" [ OUT ] - return parameter for the number of bytes read
- */
-KFS_EXTERN rc_t CC KMemBankRead ( const KMemBank *self, uint64_t id,
-   uint64_t pos, void *buffer, size_t bsize, size_t *num_read );
-
-
-/* Write
- *  linearly update memory
- *  will resize as required
- *
- *  "id" [ IN ] - id of the allocation being writ
- *
- *  "pos" [ IN ] - starting offset into allocation
- *
- *  "buffer" [ IN ] and "size" [ IN ] - data to write
- *
- *  "num_writ" [ OUT ] - return parameter for the number of bytes written
- */
-KFS_EXTERN rc_t CC KMemBankWrite ( KMemBank *self, uint64_t id,
-    uint64_t pos, const void *buffer, size_t size, size_t *num_writ );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_pmem_ */
diff --git a/interfaces/kfs/quickmount.h b/interfaces/kfs/quickmount.h
deleted file mode 100644
index 6ecbaef..0000000
--- a/interfaces/kfs/quickmount.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_quick_mount_
-#define _h_kfs_quick_mount_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct KDirectory;
-struct KFile;
-
-typedef struct KQuickMountDir KQuickMountDir;
-
-/* OpenQuickMountDirRead
- *
- */
-KFS_EXTERN rc_t KQuickMountDirMake (const struct KDirectory * self, 
-                                    const struct KDirectory ** pnewdir,
-                                    const struct KFile * file,
-                                    const char * path, size_t path_size,
-                                    const char * mount, size_t mount_size);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_quick_mount_ */
diff --git a/interfaces/kfs/ramfile.h b/interfaces/kfs/ramfile.h
deleted file mode 100644
index 65957b1..0000000
--- a/interfaces/kfs/ramfile.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_ramfile_
-#define _h_kfs_ramfile_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct KFile;
-
-typedef struct KRamFile KRamFile;
-
-/* -----
- * fakes file reads and writes into a buffer
- *
- * writes never fail. Acts like a sliding window from previous writes of possible
- * reads only succeed of they are from what was contained in the last write
- *
- * zero fills are put in where possible. If you write a buffer, slide the window with 
- * a write that doesn't fill the buffer, the rest will be zero not what was previously written
- *
- * The Read only form doesn;t allow writes but will reflect what was put in
- * the buffer outside of the KFile
- *
- * The write only will accept writes but can only be accessed outside of the KFile.
- *
- * The update form tries its best to give what was asked for [see above]
- */
-KFS_EXTERN rc_t CC KRamFileMakeRead (const struct KFile ** self,
-                                     char * buffer, size_t buffer_size);
-
-KFS_EXTERN rc_t CC KRamFileMakeWrite (struct KFile ** self,
-                                      char * buffer, size_t buffer_size);
-
-KFS_EXTERN rc_t CC KRamFileMakeUpdate (struct KFile ** self,
-                                       char * buffer, size_t buffer_size);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_ramfile_ */
diff --git a/interfaces/kfs/readheadfile.h b/interfaces/kfs/readheadfile.h
deleted file mode 100644
index 1cd47a1..0000000
--- a/interfaces/kfs/readheadfile.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_readheadfile_
-#define _h_kfs_readheadfile_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * forwards allowing opaque class typing
- */
-struct KFile;
-
-
-/* MakeReadHead
- *  make a read-only file where we buffer only the first part of the file
- *  this is pretty much only needed to type a file when we don't know
- *  or want to see if we can acess randomly.  This is a fairly smart type
- *  that will take ownership of the pointer to the 'original' KFile
- *  reference.  If it finds that the 'original' KFile is seekable (has
- *  random access) it will merely return a reference to that const KFile *
- *  rather than creating a new KFile that will in most cases pass through 
- *  all method calls to the original.
- *
- *  This type was created primarily to allow the reading of the first part
- *  of a file for type recognition with out forcing numerous cases of
- *  duplicated code to check for random access on an existing KFile reference
- *  and handling of the pre-read in the application.
- *
- *  This class is intended for files that once typed will be read straight
- *  through.  If more random access to the file is needed the KBufFile is 
- *  indicated rather than this one.  If a straight through access is needed
- *  this is a far lighter weight solution than KBufFile.
- *
- *  A references is added to the original even if it becomes used as the new
- *  file because it allows random access.
- *
- *  "buf" [ OUT ] - return parameter for new buffered file
- *
- *  "original" [ IN ] - source file to be buffered. must have read access
- *
- *  "bsize" [ IN ] - buffer size
- */
-KFS_EXTERN 
-rc_t CC KFileMakeReadHead (const struct KFile ** pself,
-                           const struct KFile * original,
-                           size_t buffer_size);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_readheadfile_ */
diff --git a/interfaces/kfs/sra.h b/interfaces/kfs/sra.h
deleted file mode 100644
index 7424e75..0000000
--- a/interfaces/kfs/sra.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_sra_
-#define _h_kfs_sra_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#include <klib/defs.h>
-
-#include <stdarg.h>
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * This file provides documentation and symbols for the single file archive
- * format originally created for the SRA project.
- */
-
-/*
- * filler bytes before data files can be inserted to make the start line
- * up on specified boundaries.  By using a single bit approach for the values
- * we get the bit-wise not of the mask that must be met for the start of the file.
- * Or one more than the maximum number of inserted bytes.  This is only used on
- * creation of the file and has no bearing at all on the parsing afterwards.
- * In it's only use so far any bit in a 32 bit bit number could be used not
- * just these enumerated values.  
- */
-typedef uint32_t KSRAFileAlignment;
-enum eKSRAFileAlignment
-{
-    /* align on byte count unit boundaries
-     * set this to the number of bytes in the alignment unit
-     */
-    sraAlignInvalid = 0,
-    sraAlign1Byte = 1,
-    sraAlign2Byte = 2,
-    sraAlign4Byte = 4,
-    sraAlign8Byte = 8,
-    sraAlign16Byte = 16,
-    sraAlign32Byte = 32,
-    sraAlign64Byte = 64
-};
-
-/* ======================================================================
- *
- * SRA File Format
- */
-typedef uint32_t SraEndian_t;
-/* enum fails to handle these due to integer overflow */
-#define eSraByteOrderTag     0x05031988
-#define eSraByteOrderReverse 0x88190305
-
-
-
-
-typedef struct KSraHeader KSraHeader;
-struct KSraHeader
-{
-    /* the first two fields are byte endian agnostic - they are low to high as shown */
-    uint8_t	ncbi[4];                /* 'N', 'C', 'B', 'I' */
-    uint8_t	sra[4];                 /* '.', 'S', 'R', 'A' */
-    /* this field lets you determine the byte order of the file */
-    SraEndian_t	byte_order;
-    /* not a ver_t - this is a 4 byte integer with no subfields */
-    uint32_t	version;
-    union 
-    {
-        struct
-        {
-            /* the only header field in the first version is the data offset */
-            uint64_t	file_offset;
-        } v1;
-    } u;
-};
-
-/* ======================================================================
- * Header format structures
- *
- */
-
-
-
-#define FS_SRA_CUR_VERSION 1
-KFS_EXTERN size_t CC SraHeaderSize ( const KSraHeader * self );
-
-KFS_EXTERN uint64_t CC SraHeaderGetFileOffset (const KSraHeader * self);
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KFile;
-struct KDirectory;
-struct KToc;
-
-/*--------------------------------------------------------------------------
- * KDirectory
- *  SRA-specific extensions
- */
-
-/* KArcParseSRA
- *	A parse function for sra files suitable for KDirectoryOpenArcDirRead
- *
- * [INOUT] KArcTOC*	self	The TOC (table of contents) to fill in with the parse
- * [IN]    const KFile*	kfile	The opened (as KFile) archive to parse.
- */
-KFS_EXTERN rc_t CC KArcParseSRA ( struct KToc * self,
-                                  const void * kvoid,
-                                  bool (CC*ignored) (const struct KDirectory*,  const char*, void*),
-                                  void *ignored_data);
-KFS_EXTERN rc_t CC KArcParseSRAUnbounded ( struct KToc * self,
-                                           const void * kvoid,
-                                           bool (CC*ignored) (const struct KDirectory*,  const char*, void*),
-                                           void *ignored_data);
-
-KFS_EXTERN rc_t CC KArcParseKDir( struct KToc * self,
-                                  const void * kdir,
-                                  bool(CC*f)(const struct KDirectory*,const char *, void*),
-                                  void *filterparam);
-
-
-/* KDirectoryOpenSraArchive
- *  opens a named SRA archive
- *
- *  "sra_dir" [ OUT ] - return parameter for archive
- *
- *  "chroot" [ IN ] - if non-zero, the new directory becomes
- *  chroot'd and will interpret paths beginning with '/'
- *  relative to itself.
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting sraget archive
- */
-KFS_EXTERN rc_t CC KDirectoryOpenSraArchiveRead ( struct KDirectory const *self,
-    struct KDirectory const **sra_dir, int chroot, const char *path, ... );
-KFS_EXTERN rc_t CC KDirectoryVOpenSraArchiveRead ( struct KDirectory const *self,
-    struct KDirectory const **sra_dir, int chroot, const char *path, va_list args );
-KFS_EXTERN rc_t CC KDirectoryOpenSraArchiveRead_silent ( struct KDirectory const *self,
-    struct KDirectory const **sra_dir, int chroot, const char *path, ... );
-KFS_EXTERN rc_t CC KDirectoryVOpenSraArchiveRead_silent ( struct KDirectory const *self,
-    struct KDirectory const **sra_dir, int chroot, const char *path, va_list args );
-KFS_EXTERN rc_t CC KDirectoryOpenSraArchiveRead_silent_preopened ( struct KDirectory const *self,
-    struct KDirectory const **sra_dir, int chroot, const struct KFile * f, const char *path, ... );
-KFS_EXTERN rc_t CC KDirectoryVOpenSraArchiveRead_silent_preopened ( struct KDirectory const *self,
-    struct KDirectory const **sra_dir, int chroot, const struct KFile * f, const char *path, va_list args );
-KFS_EXTERN rc_t CC KDirectoryOpenSraArchiveReadUnbounded_silent_preopened ( struct KDirectory const *self,
-    struct KDirectory const **sra_dir, int chroot, const struct KFile * f, const char *path, ... );
-KFS_EXTERN rc_t CC KDirectoryVOpenSraArchiveReadUnbounded_silent_preopened ( struct KDirectory const *self,
-    struct KDirectory const **sra_dir, int chroot, const struct KFile * f, const char *path, va_list args );
-/* copycat needs an unbounded version - that is filesize is not necessarily known
- * this is unsafe for most other uses */
-KFS_EXTERN rc_t CC KDirectoryOpenSraArchiveReadUnbounded ( struct KDirectory const *self,
-    struct KDirectory const **sra_dir, int chroot, const char *path, ... );
-KFS_EXTERN rc_t CC KDirectoryVOpenSraArchiveReadUnbounded ( struct KDirectory const *self,
-    struct KDirectory const **sra_dir, int chroot, const char *path, va_list args );
-
-KFS_EXTERN rc_t CC KFileIsSRA (const char * b, size_t z);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_sra_ */
diff --git a/interfaces/kfs/subfile.h b/interfaces/kfs/subfile.h
deleted file mode 100644
index bad2c5b..0000000
--- a/interfaces/kfs/subfile.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_subfile_
-#define _h_kfs_subfile_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct KFile;
-
-typedef struct KSubFile KSubFile;
-
-/* -----
- * Copy can be a serialized type KFile for a KSubFile opened for Read but
- * not when opened for write.
- *
- * Specifically this means copy can be a KMD5File for read but not for write
- * other KFile subtypes might have the same restriction.
- *
- * A seekless update KSubfile can be created but does not now exist.
- */
-KFS_EXTERN rc_t CC KFileMakeSubRead (const struct KFile ** self, const struct KFile * original,
-			uint64_t start_position, uint64_t size);
-KFS_EXTERN rc_t CC KFileMakeSubUpdate (struct KFile ** self, struct KFile * original,
-			uint64_t start_position, uint64_t size);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_subfile_ */
diff --git a/interfaces/kfs/tar.h b/interfaces/kfs/tar.h
deleted file mode 100644
index 96d8c63..0000000
--- a/interfaces/kfs/tar.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_tar_
-#define _h_kfs_tar_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#include <stdarg.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KFile;
-struct KDirectory;
-struct KToc;
-
-/*--------------------------------------------------------------------------
- * KDirectory
- *  TAR-specific extensions
- */
-
-/* ParseTAR
- *  A parse function for tar files suitable for KDirectoryOpenArcDirRead
- *
- * [INOUT] KToc*    self    The TOC (table of contents) to fill in with the parse
- * [IN]    const KFile* kfile   The opened (as KFile) archive to parse.
- */
-KFS_EXTERN rc_t CC KArcParseTAR( struct KToc * self, 
-                                 const void * kfile,
-                                 bool(CC*f)(const struct KDirectory*,const char *, void*),
-                                 void *filterparam);
-
-/* KDirectoryOpenTarArchive
- *  opens a named TAR archive
- *
- *  "tar_dir" [ OUT ] - return parameter for archive
- *
- *  "chroot" [ IN ] - if non-zero, the new directory becomes
- *  chroot'd and will interpret paths beginning with '/'
- *  relative to itself.
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target archive
- */
-KFS_EXTERN int CC KDirectoryOpenTarArchiveRead ( struct KDirectory const *self,
-    struct KDirectory const **tar_dir, int chroot, const char *path, ... );
-KFS_EXTERN int CC KDirectoryVOpenTarArchiveRead ( struct KDirectory const *self,
-    struct KDirectory const **tar_dir, int chroot, const char *path, va_list args );
-
-KFS_EXTERN int CC KDirectoryOpenTarArchiveRead_silent ( struct KDirectory const *self,
-    struct KDirectory const **tar_dir, int chroot, const char *path, ... );
-KFS_EXTERN int CC KDirectoryVOpenTarArchiveRead_silent ( struct KDirectory const *self,
-    struct KDirectory const **tar_dir, int chroot, const char *path, va_list args );
-
-KFS_EXTERN int CC KDirectoryOpenTarArchiveRead_silent_preopened ( struct KDirectory const *self,
-    struct KDirectory const **tar_dir, int chroot, const struct KFile * f, const char *path, ... );
-KFS_EXTERN int CC KDirectoryVOpenTarArchiveRead_silent_preopened ( struct KDirectory const *self,
-    struct KDirectory const **tar_dir, int chroot, const struct KFile * f, const char *path, va_list args );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_tar_ */
diff --git a/interfaces/kfs/teefile.h b/interfaces/kfs/teefile.h
deleted file mode 100644
index 698e91c..0000000
--- a/interfaces/kfs/teefile.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_teefile_
-#define _h_kfs_teefile_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct KFile;
-
-typedef struct KTeeFile KTeeFile;
-
-/* -----
- * Copy can be a serialized type KFile for a KTeeFile opened for Read but
- * not when opened for write.
- *
- * Specifically this means copy can be a KMD5File for read but not for write
- * other KFile subtypes might have the same restriction.
- *
- * A seekless update KTeefile can be created but does not now exist.
- */
-KFS_EXTERN rc_t CC KFileMakeTeeRead (const struct KFile ** self, 
-                                     const struct KFile * original,
-                                     struct KFile * copy);
-KFS_EXTERN rc_t CC KFileMakeTeeUpdate (struct KFile ** self,
-                                       struct KFile * original,
-                                       struct KFile * copy);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_teefile_ */
diff --git a/interfaces/kfs/toc.h b/interfaces/kfs/toc.h
deleted file mode 100644
index e0de152..0000000
--- a/interfaces/kfs/toc.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_toc_
-#define _h_kfs_toc_
-
-#ifndef _h_kfs_extern_
-#include <kfs/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifndef _h_kfs_directory_
-#include <kfs/directory.h>
-#endif
-
-#ifndef _h_klib_pbstree_
-#include <klib/pbstree.h>
-#endif
-
-#ifndef _h_kfs_sra_
-#include <kfs/sra.h>
-#endif
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*==========================================================================
- * The TOC (Table of Contents) is the basis of non-O/S level file systems
- * directory structures.
- *
- * The TOC is based on a set of entries.  An entry can represent a file
- * (collection of bytes), a directory (a list of entries, or a link (an
- * entry that refers to another entry).
- *
- * Files are represented either as a contiguous array of bytes or a
- * sequence of smaller chunks of contiguous bytes.  Other than the initial
- * creation of the chunked version, most operations on the chunked file
- * will be able to treat it as a contiguous sequence with any gaps between
- * contiguous chunks being treated as if they were all zero bytes.  So
- * for the most part the two types of file are the same to the outside
- * world.
- *
- * A directory is viewed as a sorted list of named references to files.
- * In the first versions the form is of a binary search tree per directory
- * but for the most part that detail is irrelevant.  In the tree a directory
- * is an entry that contains its own tree.  A path is a sequence of named
- * entries in order - the representation of a path is the Unix/Posix style
- * path.
- *
- * A link is either a hard or soft link 9using Unix/Posix terminology. A
- * soft link is a named item that contains a path that names another item.
- * A hard link will as much as possible refer directly to the same file,
- * directory or another link as another item.
- *
- * Each entry is represented by a TocEntry.
- *
- * A path as mentioned above is a list of facets (names of directories) up to
- * a final leaf item that can be any of the item types.
- *
- * Position is the logical offset within a file or a particualr byte,  The
- * first byte is at position 0.
- */
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct BSTree;
-struct Vector;
-struct String;
-struct KFile;
-
-
-/*--------------------------------------------------------------------------
- * KTocChunk
- *  Describes a chunk of valid data within a file.  The concept is that a file
- *  can be made up of discrete chunks that might not be consecutive on the 
- *  storage system.  There might also be gaps between the chunks - gaps that 
- *  read as all zeroes.  These could be tarred up versions of sparse files
- *  where the only things stored on disk are small regions of non-zero data. 
- *  Or it could be some archival format where data is broken into some form of
- *  packets.
- *
- *  64 bit values are used for file sizes up to 18,446,744,073,709,551,617 bytes
- *  up to exabytes.  The human genome is in the gigabyte range so 32 bit values
- *  are too close to the limits so the larger range was used.
- *
- *  This struct is very clear and public so chunks can be built up or used  freely
- *  by non-file-system specific code.
- */
-typedef struct KTocChunk KTocChunk;
-struct KTocChunk
-{
-    /* position of chunk within logical file */
-    uint64_t logical_position;
-
-    /* position of chunk within source container file */
-    uint64_t source_position;
-
-    /* chunk size */
-    uint64_t size;
-};
-
-
-
-KFS_EXTERN rc_t CC KDirectoryOpenTocFileRead( const KDirectory * self,
-                                              struct KFile const ** pfile,
-                                              KSRAFileAlignment align,
-                                              bool (CC * filter) (const KDirectory*,const char*,void*),
-                                              void * filter_param,
-                                              rc_t (CC * usort)(const KDirectory*, struct Vector*) );
-
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_toc_ */
diff --git a/interfaces/klib/callconv.h b/interfaces/klib/callconv.h
deleted file mode 100644
index 34eafc6..0000000
--- a/interfaces/klib/callconv.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_klib_callconv_
-#define _h_klib_callconv_
-
-#ifndef _h_kfc_callconv_
-#include <kfc/callconv.h>
-#endif
-
-#endif /*  _h_klib_callconv_ */
diff --git a/interfaces/klib/checksum.h b/interfaces/klib/checksum.h
deleted file mode 100644
index 5c38ee8..0000000
--- a/interfaces/klib/checksum.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_klib_checksum_
-#define _h_klib_checksum_
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * CRC32
- */
-
-/* CRC32Init
- *  initializes table
- *  IDEMPOTENT
- */
-KLIB_EXTERN void CC CRC32Init ( void );
-
-/* CRC32
- *  runs checksum on arbitrary data, returning result
- *  initial checksum to be passed in is 0
- *  subsequent checksums should be return from prior invocation
- */
-KLIB_EXTERN uint32_t CC CRC32 ( uint32_t checksum, const void *data, size_t size );
-
-
-/*--------------------------------------------------------------------------
- * MD5
- *  taken from Peter Deutsch's sources due to simplicity
- */
-typedef struct MD5State MD5State;
-struct MD5State
-{
-    uint32_t count [ 2 ];
-    uint32_t abcd [ 4 ];
-    uint8_t buf [ 64 ];
-};
-
-/* Init
- *  initialize the algorithm and state block
- */
-KLIB_EXTERN void CC MD5StateInit ( MD5State *md5 );
-
-/* Append
- *  run MD5 on data block
- *  accumulate results into "md5"
- *  processes data in chunks
- */
-KLIB_EXTERN void CC MD5StateAppend ( MD5State *md5, const void *data, size_t size );
-
-/* Finish
- *  processes any remaining data in "md5"
- *  returns 16 bytes of digest
- */
-KLIB_EXTERN void CC MD5StateFinish ( MD5State *md5, uint8_t digest [ 16 ] );
-
-
-/*--------------------------------------------------------------------------
- * SHA
- */
-typedef struct SHA32bitState SHA1State, SHA256State;
-struct SHA32bitState
-{
-    uint64_t len;
-    uint32_t H [ 8 ];
-    uint32_t cur;
-    uint8_t  W [ 64 ];
-};
-
-typedef struct SHA64bitState SHA384State, SHA512State;
-struct SHA64bitState
-{
-    uint64_t len;
-    uint64_t H [ 8 ];
-    unsigned long cur;
-    uint8_t W [ 128 ];
-};
-
-
-/* Init
- *  initialize the algorithm and state block
- */
-KLIB_EXTERN void CC SHA1StateInit ( SHA1State *state );
-KLIB_EXTERN void CC SHA256StateInit ( SHA256State *state );
-KLIB_EXTERN void CC SHA384StateInit ( SHA384State *state );
-KLIB_EXTERN void CC SHA512StateInit ( SHA512State *state );
-
-
-/* Append
- *  run SHA-x on data block
- *  accumulate results into "state"
- *  processes data in chunks
- */
-KLIB_EXTERN void CC SHA1StateAppend ( SHA1State *state, const void *data, size_t size );
-KLIB_EXTERN void CC SHA256StateAppend ( SHA256State *state, const void *data, size_t size );
-KLIB_EXTERN void CC SHA384StateAppend ( SHA384State *state, const void *data, size_t size );
-KLIB_EXTERN void CC SHA512StateAppend ( SHA512State *state, const void *data, size_t size );
-
-
-/* Finish
- *  processes any remaining data in "state"
- *  returns N bytes of digest
- *  N = 20 for SHA-1
- *  N = 32 for SHA-256
- *  N = 48 for SHA-384
- *  N = 64 for SHA-512
- */
-KLIB_EXTERN void CC SHA1StateFinish ( SHA1State *state, uint8_t digest [ 20 ] );
-KLIB_EXTERN void CC SHA256StateFinish ( SHA256State *state, uint8_t digest [ 32 ] );
-KLIB_EXTERN void CC SHA384StateFinish ( SHA384State *state, uint8_t digest [ 48 ] );
-KLIB_EXTERN void CC SHA512StateFinish ( SHA512State *state, uint8_t digest [ 64 ] );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_klib_checksum_ */
diff --git a/interfaces/klib/container.h b/interfaces/klib/container.h
deleted file mode 100644
index dab027c..0000000
--- a/interfaces/klib/container.h
+++ /dev/null
@@ -1,455 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_klib_container_
-#define _h_klib_container_
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * SLNode
- *  singly linked node
- */
-typedef struct SLNode SLNode;
-struct SLNode
-{
-    SLNode *next;
-};
-
-/* SLNodeNext
- *  returns next node
- */
-#define SLNodeNext( n ) \
-    ( n ) -> next
-
-#if 0
-/* SLNodeFindNext
- *  find next element satisfying criteria
- */
-KLIB_EXTERN SLNode* CC SLNodeFindNext ( const SLNode *n, bool ( CC * f ) ( const SLNode *n ) );
-#endif
-
-
-/*--------------------------------------------------------------------------
- * SLList
- *  singly linked list
- */
-typedef struct SLList SLList;
-struct SLList
-{
-    SLNode *head;
-    SLNode *tail;
-};
-
-
-/* SLListInit
- *  initialize a singly linked list
- */
-#define SLListInit( sl ) \
-    ( void ) ( ( sl ) -> head = ( sl ) -> tail = NULL )
-
-/* SLListHead
- *  returns list head
- */
-#define SLListHead( sl ) \
-    ( sl ) -> head
-
-/* SLListTail
- *  returns list tail
- */
-#define SLListTail( sl ) \
-    ( sl ) -> tail
-
-/* SLListPushHead
- *  push a single node onto head of list
- */
-#define SLListPushHead( sl, n ) \
-    ( void ) ( ( ( sl ) -> tail == NULL ? \
-        ( void ) ( ( sl ) -> tail = ( n ) ) : ( void ) 0 ), \
-        ( n ) -> next = ( sl ) -> head, ( sl ) -> head = ( n ) )
-
-/* SLListPushTail
- *  push a single node onto tail of list
- */
-KLIB_EXTERN void CC SLListPushTail ( SLList *sl, SLNode *n );
-
-/* SLListPopHead
- *  pop a single node from head of list
- */
-KLIB_EXTERN SLNode* CC SLListPopHead ( SLList *sl );
-
-/* SLListPopTail
- *  pop a single node from tail of list
- */
-KLIB_EXTERN SLNode* CC SLListPopTail ( SLList *sl );
-
-/* SLListUnlink
- *  removes a designated node from list
- */
-KLIB_EXTERN void CC SLListUnlink ( SLList *sl, SLNode *n );
-
-/* SLListForEach
- *  executes a function on each list element
- */
-KLIB_EXTERN void CC SLListForEach ( const SLList *sl,
-    void ( CC * f ) ( SLNode *n, void *data ), void *data );
-
-/* SLListDoUntil
- *  executes a function on each element
- *  until the function returns true
- */
-KLIB_EXTERN bool CC SLListDoUntil ( const SLList *sl,
-    bool ( CC * f ) ( SLNode *n, void *data ), void *data );
-
-/* SLListFindFirst
- *  find first element satisfying criteria
- */
-KLIB_EXTERN SLNode* CC SLListFindFirst ( const SLList *sl, bool ( CC * f ) ( const SLNode *n ) );
-
-/* SLListWhack
- *  pops elements from list and
- *  executes a user provided destructor
- */
-KLIB_EXTERN void CC SLListWhack ( SLList *sl, void ( CC * whack ) ( SLNode *n, void *data ), void *data );
-
-
-/*--------------------------------------------------------------------------
- * DLNode
- *  doubly linked node
- */
-typedef struct DLNode DLNode;
-struct DLNode
-{
-    DLNode *next;
-    DLNode *prev;
-};
-
-/* DLNodeNext
- *  returns next node
- */
-#define DLNodeNext( n ) \
-    ( n ) -> next
-
-/* DLNodePrev
- *  returns prev node
- */
-#define DLNodePrev( n ) \
-    ( n ) -> prev
-
-#if 0
-/* DLNodeFindNext
- *  find next element satisfying criteria
- */
-KLIB_EXTERN DLNode* CC DLNodeFindNext ( const DLNode *n, bool ( CC * f ) ( const DLNode *n ) );
-
-/* DLNodeFindPrev
- *  find previous element satisfying criteria
- */
-KLIB_EXTERN DLNode* CC DLNodeFindPrev ( const DLNode *n, bool ( CC * f ) ( const DLNode *n ) );
-#endif
-
-/*--------------------------------------------------------------------------
- * DLList
- *  doubly linked list
- */
-typedef struct DLList DLList;
-struct DLList
-{
-    DLNode *head;
-    DLNode *tail;
-};
-
-/* DLListInit
- *  initialize a doubly linked list
- */
-#define DLListInit( dl ) \
-    ( void ) ( ( dl ) -> head = ( dl ) -> tail = NULL )
-
-/* DLListHead
- *  returns list head
- */
-#define DLListHead( dl ) \
-    ( dl ) -> head
-
-/* DLListTail
- *  returns list tail
- */
-#define DLListTail( dl ) \
-    ( dl ) -> tail
-
-/* DLListPushHead
- *  push a single node onto the head of list
- */
-KLIB_EXTERN void CC DLListPushHead ( DLList *dl, DLNode *n );
-
-/* DLListPushTail
- *  push a single node onto the tail of list
- */
-KLIB_EXTERN void CC DLListPushTail ( DLList *dl, DLNode *n );
-
-/* DLListPopHead
- *  pop a single node from head of list
- */
-KLIB_EXTERN DLNode* CC DLListPopHead ( DLList *dl );
-
-/* DLListPopTail
- *  pop a single node from tail of list
- */
-KLIB_EXTERN DLNode* CC DLListPopTail ( DLList *dl );
-
-/* DLListPrependList
- *  pushes list contents onto the head of target
- */
-KLIB_EXTERN void CC DLListPrependList ( DLList *dl, DLList *l );
-
-/* DLListAppendList
- *  pushes list contents onto the tail of target
- */
-KLIB_EXTERN void CC DLListAppendList ( DLList *dl, DLList *l );
-
-/* DLListInsertNodeBefore
- *  inserts node "n" before "which" within list
- */
-KLIB_EXTERN void CC DLListInsertNodeBefore ( DLList *dl, DLNode *which, DLNode *n );
-
-/* DLListInsertNodeAfter
- *  inserts node "n" after "which" within list
- */
-KLIB_EXTERN void CC DLListInsertNodeAfter ( DLList *dl, DLNode *which, DLNode *n );
-
-/* DLListInsertListBefore
- *  inserts list "l" before "which" within list "dl"
- */
-KLIB_EXTERN void CC DLListInsertListBefore ( DLList *dl, DLNode *which, DLList *l );
-
-/* DLListInsertListAfter
- *  inserts list "l" after "which" within list "dl"
- */
-KLIB_EXTERN void CC DLListInsertListAfter ( DLList *dl, DLNode *which, DLList *l );
-
-/* DLListUnlink
- *  removes a designated node from list
- */
-KLIB_EXTERN void CC DLListUnlink ( DLList *dl, DLNode *n );
-
-/* DLListForEach
- *  executes a function on each list element
- */
-KLIB_EXTERN void CC DLListForEach ( const DLList *dl, bool reverse,
-    void ( CC * f ) ( DLNode *n, void *data ), void *data );
-
-/* DLListDoUntil
- *  executes a function on each element
- *  until the function returns true
- */
-KLIB_EXTERN bool CC DLListDoUntil ( const DLList *dl, bool reverse,
-    bool ( CC * f ) ( DLNode *n, void *data ), void *data );
-
-/* DLListFindFirst
- *  find first element satisfying criteria
- */
-KLIB_EXTERN DLNode* CC DLListFindFirst ( const DLList *dl, bool ( CC * f ) ( const DLNode *n ) );
-
-/* DLListFindLast
- *  find last element satisfying criteria
- */
-KLIB_EXTERN DLNode* CC DLListFindLast ( const DLList *dl, bool ( CC * f ) ( const DLNode *n ) );
-
-/* DLListWhack
- *  pops elements from list and
- *  executes a user provided destructor
- */
-KLIB_EXTERN void CC DLListWhack ( DLList *dl, void ( CC * whack ) ( DLNode *n, void *data ), void *data );
-
-
-/*--------------------------------------------------------------------------
- * BSTNode
- *  binary search tree node
- */
-typedef struct BSTNode BSTNode;
-struct BSTNode
-{
-    BSTNode *par;
-    BSTNode *child [ 2 ];
-};
-
-/* BSTNodeNext
- *  returns next node
- */
-KLIB_EXTERN BSTNode* CC BSTNodeNext ( const BSTNode *n );
-
-/* BSTNodePrev
- *  returns prev node
- */
-KLIB_EXTERN BSTNode* CC BSTNodePrev ( const BSTNode *n );
-
-/* BSTNodeParent
- *  returns a parent node if there, NULL otherwise
- */
-KLIB_EXTERN BSTNode* CC BSTNodeParent ( const BSTNode *n );
-
-/* BSTNodeFindNext
- *  find next element satisfying criteria
- */
-KLIB_EXTERN BSTNode* CC BSTNodeFindNext ( const BSTNode *n, bool ( CC * f ) ( const BSTNode *n ) );
-
-/* BSTNodeFindPrev
- *  find previous element satisfying criteria
- */
-KLIB_EXTERN BSTNode* CC BSTNodeFindPrev ( const BSTNode *n, bool ( CC * f ) ( const BSTNode *n ) );
-
-
-/*--------------------------------------------------------------------------
- * BSTree
- *  binary search tree
- */
-typedef struct BSTree BSTree;
-struct BSTree
-{
-    BSTNode *root;
-};
-
-/* BSTreeInit
- *  initialize tree
- */
-#define BSTreeInit( bt ) \
-    ( void ) ( ( bt ) -> root = NULL )
-
-/* BSTreeDepth
- *  returns number of layers in tree
- *
- *  if "exact" is true, then the maximum
- *  depth is returned. otherwise, the depth of
- *  an arbitrary leaf node is returned
- */
-KLIB_EXTERN uint32_t CC BSTreeDepth ( const BSTree *bt, bool exact );
-
-/* BSTreeFirst
- *  returns first node
- */
-KLIB_EXTERN BSTNode* CC BSTreeFirst ( const BSTree *bt );
-
-/* BSTreeLast
- *  returns last node
- */
-KLIB_EXTERN BSTNode* CC BSTreeLast ( const BSTree *bt );
-
-/* BSTreeFind
- *  find an object within tree
- *  "cmp" function returns equivalent of "item" - "n"
- */
-KLIB_EXTERN BSTNode* CC BSTreeFind ( const BSTree *bt, const void *item,
-    int ( CC * cmp ) ( const void *item, const BSTNode *n ) );
-
-/* BSTreeInsert
- *  insert an object within tree, even if duplicate
- *  "sort" function returns equivalent of "item" - "n"
- *
- *  the treatment of order for items reported as identical
- *  i.e. sort function returns zero when they are compared,
- *  is undefined.
- *
- *  the current implementation treats '<=' as '<' such
- *  that all inserts are converted to a '<' or '>' comparison,
- *  but this should not be relied upon.
- *
- *  returns 0 if insert succeeded or an OS error code otherwise.
- */
-KLIB_EXTERN rc_t CC BSTreeInsert ( BSTree *bt, BSTNode *item,
-    int ( CC * sort ) ( const BSTNode *item, const BSTNode *n ) );
-
-/* BSTreeInsertUnique
- *  insert an object within tree, but only if unique.
- *  "sort" function returns equivalent of "item" - "n"
- *
- *  returns 0 if insertion succeeded. or an OS error code otherwise.
- *  if error code is EEXIST, the existing object is returned in "exist".
- */
-KLIB_EXTERN rc_t CC BSTreeInsertUnique ( BSTree *bt, BSTNode *item, BSTNode **exist,
-    int ( CC * sort ) ( const BSTNode *item, const BSTNode *n ) );
-
-/* BSTreeResort
- *  an optimized removal and re-insertion of
- *  all contained elements using another function
- *
- *  the treatment of order for items reported as identical
- *  i.e. sort function returns zero when they are compared,
- *  is undefined.
- *
- *  the current implementation treats '<=' as '<' such
- *  that all inserts are converted to a '<' or '>' comparison,
- *  but this should not be relied upon.
- */
-KLIB_EXTERN void CC BSTreeResort ( BSTree *bt,
-    int ( CC * resort ) ( const BSTNode *item, const BSTNode *n ) );
-
-/* BSTreeUnlink
- *  removes a node from tree
- *
- *  returns true if node was removed from tree
- *  false if it could not be removed, e.g. was not in tree
- */
-KLIB_EXTERN bool CC BSTreeUnlink ( BSTree *bt, BSTNode *n );
-
-/* BSTreeForEach
- *  executes a function on each tree element
- */
-KLIB_EXTERN void CC BSTreeForEach ( const BSTree *bt, bool reverse,
-    void ( CC * f ) ( BSTNode *n, void *data ), void *data );
-
-/* BSTreeDoUntil
- *  executes a function on each element
- *  until the function returns true
- *
- *  return values:
- *    false unless the function returns true
- */
-KLIB_EXTERN bool CC BSTreeDoUntil ( const BSTree *bt, bool reverse,
-    bool ( CC * f ) ( BSTNode *n, void *data ), void *data );
-
-/* BSTreeWhack
- *  removes nodes from tree and
- *  executes a user provided destructor
- */
-KLIB_EXTERN void CC BSTreeWhack ( BSTree *bt, void ( CC * whack ) ( BSTNode *n, void *data ), void *data );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_klib_container_ */
diff --git a/interfaces/klib/data-buffer.h b/interfaces/klib/data-buffer.h
deleted file mode 100644
index dbb0bca..0000000
--- a/interfaces/klib/data-buffer.h
+++ /dev/null
@@ -1,206 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#ifndef _h_klib_data_buffer
-#define _h_klib_data_buffer
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KDataBuffer
- *  simple, open structure to reference an opaque data buffer
- *
- *  "base" - pointer to first byte of buffer
- *
- *  "elem_bits" - size of buffer element datatype in bits
- *
- *  "elem_count" - size of buffer in elements
- *
- *  "bit_offset" [ DEFAULT ZERO ] - offset from "base"
- *  to first bit of buffer, always 0 when "elem_bits" % 8 == 0
- *  bits are left-packed, i.e.:
- *
- *    bit_offset | starting bit
- *   ============+=============
- *            0  |  7
- *            1  |  6
- *            2  |  5
- *              ...
- *            6  |  1
- *            7  |  0
- */
-typedef struct KDataBuffer KDataBuffer;
-struct KDataBuffer
-{
-    const void *ignore;
-    void *base;
-    uint64_t elem_bits;
-    uint64_t elem_count;
-    uint8_t bit_offset;
-};
-
-
-/* Bits
- *  return buffer size in bits
- */
-#define KDataBufferBits( self ) \
-    ((((bitsz_t)((const KDataBuffer *)(self))->elem_bits) * ((const KDataBuffer *)(self))->elem_count))
-
-/* Bytes
- *  returns buffer size in bytes
- */
-#define KDataBufferBytes( self ) \
-   ((size_t)((KDataBufferBits(self) + 7) >> 3))
-
-
-/* Make
- *  create a new empty buffer
- *
- *  "buffer" [ OUT ] - pointer to structure to initialize
- *
- *  "elem_bits" [ IN ] - the number of bits in each element
- *
- *  "elem_capacity" [ IN ] - the minimum number of elements to be allocated
- */
-KLIB_EXTERN rc_t CC KDataBufferMake ( KDataBuffer *buffer,
-    uint64_t elem_bits, uint64_t elem_capacity );
-
-
-/* MakeBytes
- * MakeBits
- *  create a new empty buffer with default element size
- */
-#define KDataBufferMakeBytes( buffer, bytes ) \
-    KDataBufferMake ( buffer, 8, bytes )
-#define KDataBufferMakeBits( buffer, bits ) \
-    KDataBufferMake ( buffer, 1, bits )
-
-/* Sub
- *  create a sub-range reference to an existing buffer
- *
- *  "sub" [ OUT ] - pointer to subrange structure
- *
- *  "start" [ IN ] - element offset of subrange from start of "self".
- *  if given start >= self->elem_count, the resultant subrange
- *  will have an element count of 0.
- *
- *  "count" [ IN, DEFAULT UINT64_MAX ] - number of elements of subrange.
- *  when given count exceeds buffer size, the actual count is calculated to be
- *  all remaining count in "self" from "start". otherwise, the
- *  requested count will be limited to the actual count available
- *  in "self".
- */
-KLIB_EXTERN rc_t CC KDataBufferSub ( const KDataBuffer *self,
-    KDataBuffer *sub, uint64_t start, uint64_t count );
-
-
-/* MakeWritable
- *  make a writable copy of the buffer, copying contents if needed.
- *
- *  "writable" [ OUT ] - pointer to the structure to initialize
- *
- * The usage pattern is:
- *   KDataBuffer buffer;
- * ...
- * initialize buffer
- * do stuff which might make it shared
- *   (like pass it to a function that might retain it)
- * ...
- *   KDataBuffer writable;
- *   rc_t rc = KDataBufferMakeWritable(&buffer, &writable);
- *
- *   if (rc == 0) {
- *       / * until you whack the old one KDataBufferWritable(&writable) might be false! * /
- *       KDataBufferWhack(&buffer);
- *       buffer = writable;
- * ...
- * do whatever you want with buffer because it is now writable (not shared)
- * ...
- *   }
- *   KDataBufferWhack(&buffer);
- */
-KLIB_EXTERN rc_t CC KDataBufferMakeWritable ( const KDataBuffer *self, KDataBuffer *writable );
-
-
-/* Whack
- *  release memory associated with a buffer.
- */
-KLIB_EXTERN rc_t CC KDataBufferWhack ( KDataBuffer *self );
-
-
-/* Resize
- *  make a buffer bigger or smaller.
- *  can fail if not enough memory.
- *  can fail if not writable.
- *
- *  "new_count" [ IN ] - new number of elements
- */
-KLIB_EXTERN rc_t CC KDataBufferResize ( KDataBuffer *self, uint64_t new_count );
-
-
-/* Cast
- *  create a new data-buffer with a different element size
- *  won't increase the total number of bits
- *
- *  "cast" [ OUT ] - newly typed buffer
- *
- *  "new_elem_bits" [ IN ] - new element size in bits
- *
- *  "can_shrink" [ IN ] - when true allow
- *  KDataBufferBits ( cast ) < KDataBufferBits ( self )
- */
-KLIB_EXTERN rc_t CC KDataBufferCast ( const KDataBuffer *self,
-    KDataBuffer *cast, uint64_t new_elem_bits, bool can_shrink );
-
-
-/* Writable
- *  returns true if buffer is valid and writable
- */
-KLIB_EXTERN bool CC KDataBufferWritable ( const KDataBuffer *self );
-
-
-/* CheckIntegrity
- *  performs some level of integrity checking on buffer structure
- */
-KLIB_EXTERN rc_t CC KDataBufferCheckIntegrity ( const KDataBuffer *self );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_klib_data_buffer_ */
diff --git a/interfaces/klib/debug.h b/interfaces/klib/debug.h
deleted file mode 100644
index 7a046b4..0000000
--- a/interfaces/klib/debug.h
+++ /dev/null
@@ -1,541 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-
-#ifndef _h_klib_debug_
-#define _h_klib_debug_
-
-#if _DEBUGGING
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifndef _h_klib_status_
-#include <klib/status.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* ----------
- * KDbgModule and KDbgCondition
- *
- * KDbg messages are filtered by a pair of values: a module and a condition.
- *
- * A KDbgFlag is a single bit representing an enumerated condition ID
- *
- * In this context the module is merely a set and not specifically tied to any
- * other use of the term module.
- */
-
-
-
-/*
- * To add a new module, just add it to the list in MODULE_NAMES but as a 
- * parameter to the macro "_module"
- *
- * Then add the conditions for that module.  There must be at least one.
- * Put them in the macro "_condition"
- *
- * NOTE:
- * There must be at least one condition for a module.
- *
- * NOTE:
- * Do not seperate the items in eith MODULES or xxx_CONDITIONS by anything 
- * other than white space.
- *
- * NOTE:
- * The exact text must used in the _module(MOD) and the MOD_CONDITIONS()
- * so if you want all lower, all upper ot mixed case it must be the same.
- * this exact case will apply to the command line argument as well.
- *
- * NOTE:
- * The MOD and CONDITIONS must be legal C Identifiers. The exception is a
- * condition may start with a numeric or even be all numeric.  Punctuation other
- * than '_' is not allowed.
- *
- * NOTE:
- * No not use condition "ANY" or "NONE" as they are special flag names.
- *
- * The rest of the file will take care of adding the new strings, enumerations
- * and structures for the new modules and/or new conditions.
- *
- * The expected command line will be "-D mod" to add "any" for the module or
- * "-D mod-cond" to add only that condition with in the module.
- * "-D" and "--debug" are expected to be equivalent"
- *
- * The expected usage in a C source file is to use the flag value.
- * For an added module (MMM) and condition (CCC) the symbols used would be
- * "dbg_MMM" and "dbg_MMM_CCC" that will get an index
- * to a flag value and the flag to test for a condition.
- *
- * Any number of individual "-D conditions" are accepted.
- */
-
-#define MODULE_NAMES() \
-    _module(AES)    _module(ALIGN)   _module(APP)  _module(ARGS) \
-    _module(BLAST)  _module(KDB)    \
-    _module(KFG)    _module(KFS)     _module(KNS)  _module(KRYPTO) \
-    _module(LEGREF) _module(LOADLIB)              \
-    _module(REF)    _module(SEARCH)  _module(SRA) \
-    _module(VDB)    _module(VFS)     _module(XARC) _module(XML)  \
-    
-
-#define APP_CONDITIONS() \
-    _condition(APP,0)  _condition(APP,1)  _condition(APP,2)  _condition(APP,3)  \
-    _condition(APP,4)  _condition(APP,5)  _condition(APP,6)  _condition(APP,7)  \
-    _condition(APP,8)  _condition(APP,9)  _condition(APP,10) _condition(APP,11) \
-    _condition(APP,12) _condition(APP,13) _condition(APP,14) _condition(APP,15) \
-    _condition(APP,16) _condition(APP,17) _condition(APP,18) _condition(APP,19) \
-    _condition(APP,20) _condition(APP,21) _condition(APP,22) _condition(APP,23) \
-    _condition(APP,24) _condition(APP,25) _condition(APP,26) _condition(APP,27) \
-    _condition(APP,28) _condition(APP,29) _condition(APP,30) _condition(APP,31) \
-    _condition(APP,32) _condition(APP,33) _condition(APP,34) _condition(APP,35) \
-    _condition(APP,36) _condition(APP,37) _condition(APP,38) _condition(APP,39) \
-    _condition(APP,40) _condition(APP,41) _condition(APP,42) _condition(APP,43) \
-    _condition(APP,44) _condition(APP,45) _condition(APP,46) _condition(APP,47) \
-    _condition(APP,48) _condition(APP,49) _condition(APP,50) _condition(APP,51) \
-    _condition(APP,52) _condition(APP,53) _condition(APP,54) _condition(APP,55) \
-    _condition(APP,56) _condition(APP,57) _condition(APP,58) _condition(APP,59) \
-    _condition(APP,60) _condition(APP,61) _condition(APP,62) _condition(APP,63) 
-
-#define BLAST_CONDITIONS() \
-    _condition(BLAST,BLAST)
-
-#define KDB_CONDITIONS() \
-    _condition(KDB,KDB)
-
-/* place holder should be replaced by the first object that gets the debug stuff tested for krefcount_t */
-#define REF_CONDITIONS() \
-    _condition(REF,PLACEHOLDER)
-
-#define LEGREF_CONDITIONS() \
-    _condition(LEGREF,MD5) _condition(LEGREF,CRC)
-
-#define KFS_CONDITIONS() \
-    _condition(KFS,MD5)      _condition(KFS,DLL) _condition(KFS,KFFENTRY) _condition(KFS,KFF)  \
-    _condition(KFS,ARCENTRY) _condition(KFS,ARC) _condition(KFS,TOCENTRY) _condition(KFS,TOC)  \
-    _condition(KFS,TARENTRY) _condition(KFS,TAR) _condition(KFS,SRASORT)  _condition(KFS,GZIP) \
-    _condition(KFS,DIR)  _condition(KFS,COUNTER) _condition(KFS,BZIP)     _condition(KFS,SYS)
-
-#define KNS_CONDITIONS() \
-    _condition(KNS,ERR) _condition(KNS,HTTP) _condition(KNS,MGR)
-
-#define VFS_CONDITIONS() \
-    _condition(VFS,MGR)     _condition(VFS,PATH)
-
-#define XML_CONDITIONS() \
-    _condition(XML,XML)
-
-#define VDB_CONDITIONS() \
-    _condition(VDB,RESOLVE) \
-    _condition(VDB,COMPARE) \
-    _condition(VDB,FUNCTION) \
-    _condition(VDB,VDB) \
-    _condition(VDB,PARSE) \
-    _condition(VDB,MTCURSOR)
-
-#define SRA_CONDITIONS() \
-    _condition(SRA,INFO) _condition(SRA,SORT) 
-
-#define XARC_CONDITIONS() \
-    _condition(XARC,ENTRY) \
-    _condition(XARC,ARC)
-
-#define ALIGN_CONDITIONS() \
-    _condition(ALIGN,WRITER) _condition(ALIGN,COMPRESS) _condition(ALIGN,COVERAGE) \
-    _condition(ALIGN,BAM) _condition(ALIGN,BGZF) _condition(ALIGN,CFG)
-
-#define KFG_CONDITIONS() \
-    _condition(KFG,LOAD) _condition(KFG,NODE)
-
-#define KRYPTO_CONDITIONS() \
-    _condition(KRYPTO,STS) \
-    _condition(KRYPTO,CFG) \
-    _condition(KRYPTO,ENCRYPT) \
-    _condition(KRYPTO,DECRYPT)
-
-#define AES_CONDITIONS() \
-    _condition(AES,KEYEXP) _condition(AES,CIPHER) \
-    _condition(AES,INVKEYEXP) _condition(AES,INVCIPHER) \
-    _condition(AES,OBJECT)
-
-#define SEARCH_CONDITIONS() \
-    _condition(SEARCH,MYERS)
-
-#define LOADLIB_CONDITIONS() \
-    _condition(LOADLIB,PBAR) _condition(LOADLIB,FILE) _condition(LOADLIB,XLOG)
-
-#define ARGS_CONDITIONS() \
-    _condition(ARGS,WRITER)
-
-/*
- * Nothing below here needs to be changed when just adding new modules
- * and/or conditions
- */
-
-/* macros to do preprocessor token pasting and stringification */
-#define DBG_PASTE_2(a,b)        a##b
-#define DBG_PASTE_3(a,b,c)      a##b##c
-#define DBG_PASTE_4(a,b,c,d)    a##b##c##d
-#define DBG_PASTE_5(a,b,c,d,e)  a##b##c##d##e
-#define DBG_STRING(a)           #a
-
-/*
- * Build the module enumerations/flags.
- */
-#define _module(mod)   DBG_PASTE_2(DBG_,mod),
-
-typedef int32_t KDbgMod;
-enum
-{
-    DBG_MOD_NOT_FOUND = -1,
-    MODULE_NAMES()
-    DBG_MOD_COUNT
-};
-
-#undef _module
-
-
-/* 
- * the dbg_id and dbg_flag types are for ease of generically
- * typing flags with more specific types defined below.  These are more fully
- * filled out to help debuggers more than any real need for the code to work
- *
- * We'll just assume a limit of 32 bits for an enumeration.
- */
-
-/* dbg_id is approprite as a array index */
-    typedef uint32_t KDbgCond;
-enum
-{
-    DBG_COND_MIN = 0,
-    DBG_COND_0 = DBG_COND_MIN,      DBG_COND_1,     DBG_COND_2,
-    DBG_COND_3,     DBG_COND_4,     DBG_COND_5,     DBG_COND_6,
-    DBG_COND_7,     DBG_COND_8,     DBG_COND_9,     DBG_COND_10,
-    DBG_COND_11,    DBG_COND_12,    DBG_COND_13,    DBG_COND_14,
-    DBG_COND_15,    DBG_COND_16,    DBG_COND_17,    DBG_COND_18,
-    DBG_COND_19,    DBG_COND_20,    DBG_COND_21,    DBG_COND_22,
-    DBG_COND_23,    DBG_COND_24,    DBG_COND_25,    DBG_COND_26,
-    DBG_COND_27,    DBG_COND_28,    DBG_COND_29,    DBG_COND_30,
-    DBG_COND_31,    DBG_COND_32,    DBG_COND_33,    DBG_COND_34,
-    DBG_COND_35,    DBG_COND_36,    DBG_COND_37,    DBG_COND_38,
-    DBG_COND_39,    DBG_COND_40,    DBG_COND_41,    DBG_COND_42,
-    DBG_COND_43,    DBG_COND_44,    DBG_COND_45,    DBG_COND_46,
-    DBG_COND_47,    DBG_COND_48,    DBG_COND_49,    DBG_COND_50,
-    DBG_COND_51,    DBG_COND_52,    DBG_COND_53,    DBG_COND_54,
-    DBG_COND_55,    DBG_COND_56,    DBG_COND_57,    DBG_COND_58,
-    DBG_COND_59,    DBG_COND_60,    DBG_COND_61,    DBG_COND_62,
-    DBG_COND_63,    DBG_COND_MAX = DBG_COND_63
-};
-
-typedef uint64_t KDbgFlag;
-typedef uint64_t KDbgMask;
-
-
-/* to make a KDbgFlag out of a KDbgCond, shift 1 one by the condition id */
-/* to make as mask out of flags just OR them together */
-
-KLIB_EXTERN KDbgFlag CC KDbgCondToFlag ( KDbgCond cond );
-
-#if LOG_INLINING
-#define DBG_FLAG(debug_cond) (((KDbgFlag)1)<<debug_cond)
-#else
-#define DBG_FLAG(debug_cond) KDbgCondToFlag(debug_cond)
-#endif
-
-
-/* dbg_flag is a type that can be used to and against the enabled fkags/masks */
-typedef uint64_t dbg_flag;
-
-#define DBG_FLAG_NONE 0
-#define DBG_FLAG_0  (((dbg_flag)1)<<DBG_COND_0)
-#define DBG_FLAG_1  (((dbg_flag)1)<<DBG_COND_1)
-#define DBG_FLAG_2  (((dbg_flag)1)<<DBG_COND_2)
-#define DBG_FLAG_3  (((dbg_flag)1)<<DBG_COND_3)
-#define DBG_FLAG_4  (((dbg_flag)1)<<DBG_COND_4)
-#define DBG_FLAG_5  (((dbg_flag)1)<<DBG_COND_5)
-#define DBG_FLAG_6  (((dbg_flag)1)<<DBG_COND_6)
-#define DBG_FLAG_7  (((dbg_flag)1)<<DBG_COND_7)
-#define DBG_FLAG_8  (((dbg_flag)1)<<DBG_COND_8)
-#define DBG_FLAG_9  (((dbg_flag)1)<<DBG_COND_9)
-#define DBG_FLAG_10 (((dbg_flag)1)<<DBG_COND_10)
-#define DBG_FLAG_11 (((dbg_flag)1)<<DBG_COND_11)
-#define DBG_FLAG_12 (((dbg_flag)1)<<DBG_COND_12)
-#define DBG_FLAG_13 (((dbg_flag)1)<<DBG_COND_13)
-#define DBG_FLAG_14 (((dbg_flag)1)<<DBG_COND_14)
-#define DBG_FLAG_15 (((dbg_flag)1)<<DBG_COND_15)
-#define DBG_FLAG_16 (((dbg_flag)1)<<DBG_COND_16)
-#define DBG_FLAG_17 (((dbg_flag)1)<<DBG_COND_17)
-#define DBG_FLAG_18 (((dbg_flag)1)<<DBG_COND_18)
-#define DBG_FLAG_19 (((dbg_flag)1)<<DBG_COND_19)
-#define DBG_FLAG_20 (((dbg_flag)1)<<DBG_COND_20)
-#define DBG_FLAG_21 (((dbg_flag)1)<<DBG_COND_21)
-#define DBG_FLAG_22 (((dbg_flag)1)<<DBG_COND_22)
-#define DBG_FLAG_23 (((dbg_flag)1)<<DBG_COND_23)
-#define DBG_FLAG_24 (((dbg_flag)1)<<DBG_COND_24)
-#define DBG_FLAG_25 (((dbg_flag)1)<<DBG_COND_25)
-#define DBG_FLAG_26 (((dbg_flag)1)<<DBG_COND_26)
-#define DBG_FLAG_27 (((dbg_flag)1)<<DBG_COND_27)
-#define DBG_FLAG_28 (((dbg_flag)1)<<DBG_COND_28)
-#define DBG_FLAG_29 (((dbg_flag)1)<<DBG_COND_29)
-#define DBG_FLAG_30 (((dbg_flag)1)<<DBG_COND_30)
-#define DBG_FLAG_31 (((dbg_flag)1)<<DBG_COND_31)
-#define DBG_FLAG_32 (((dbg_flag)1)<<DBG_COND_32)
-#define DBG_FLAG_33 (((dbg_flag)1)<<DBG_COND_33)
-#define DBG_FLAG_34 (((dbg_flag)1)<<DBG_COND_34)
-#define DBG_FLAG_35 (((dbg_flag)1)<<DBG_COND_35)
-#define DBG_FLAG_36 (((dbg_flag)1)<<DBG_COND_36)
-#define DBG_FLAG_37 (((dbg_flag)1)<<DBG_COND_37)
-#define DBG_FLAG_38 (((dbg_flag)1)<<DBG_COND_38)
-#define DBG_FLAG_39 (((dbg_flag)1)<<DBG_COND_39)
-#define DBG_FLAG_40 (((dbg_flag)1)<<DBG_COND_40)
-#define DBG_FLAG_41 (((dbg_flag)1)<<DBG_COND_41)
-#define DBG_FLAG_42 (((dbg_flag)1)<<DBG_COND_42)
-#define DBG_FLAG_43 (((dbg_flag)1)<<DBG_COND_43)
-#define DBG_FLAG_44 (((dbg_flag)1)<<DBG_COND_44)
-#define DBG_FLAG_45 (((dbg_flag)1)<<DBG_COND_45)
-#define DBG_FLAG_46 (((dbg_flag)1)<<DBG_COND_46)
-#define DBG_FLAG_47 (((dbg_flag)1)<<DBG_COND_47)
-#define DBG_FLAG_48 (((dbg_flag)1)<<DBG_COND_48)
-#define DBG_FLAG_49 (((dbg_flag)1)<<DBG_COND_49)
-#define DBG_FLAG_50 (((dbg_flag)1)<<DBG_COND_50)
-#define DBG_FLAG_51 (((dbg_flag)1)<<DBG_COND_51)
-#define DBG_FLAG_52 (((dbg_flag)1)<<DBG_COND_52)
-#define DBG_FLAG_53 (((dbg_flag)1)<<DBG_COND_53)
-#define DBG_FLAG_54 (((dbg_flag)1)<<DBG_COND_54)
-#define DBG_FLAG_55 (((dbg_flag)1)<<DBG_COND_55)
-#define DBG_FLAG_56 (((dbg_flag)1)<<DBG_COND_56)
-#define DBG_FLAG_57 (((dbg_flag)1)<<DBG_COND_57)
-#define DBG_FLAG_58 (((dbg_flag)1)<<DBG_COND_58)
-#define DBG_FLAG_59 (((dbg_flag)1)<<DBG_COND_59)
-#define DBG_FLAG_60 (((dbg_flag)1)<<DBG_COND_60)
-#define DBG_FLAG_61 (((dbg_flag)1)<<DBG_COND_61)
-#define DBG_FLAG_62 (((dbg_flag)1)<<DBG_COND_62)
-#define DBG_FLAG_63 (((dbg_flag)1)<<DBG_COND_63)
-#define DBG_FLAG_ANY (~(dbg_flag)0)
-
-/*
- * Build the list of enums for the various modules.
- * These are descendant types of KDbgCond and KDbgFlag
- *
- * The use of ',' or ';' at the end of macros is precise to suit the use
- * in the initializers and enum definitions.
- *
- * These usually means no ',' or ';' at the end of instantiations.
- */
-#define _module(mod)                            \
-    typedef int32_t DBG_PASTE_2(DBG_COND_,mod); \
-    enum                                        \
-        {                                       \
-        DBG_PASTE_2(mod,_CONDITIONS())          \
-        DBG_PASTE_3(DBG_,mod,_COUNT)            \
-    };
-#define _condition(mod,flag) DBG_PASTE_4(DBG_,mod,_,flag),
-
-MODULE_NAMES()
-
-#undef _condition
-#undef _module
-
-typedef struct dbg_s_flag dbg_s_flag;
-struct dbg_s_flag
-{
-    const char * name;
-    KDbgFlag flag;
-};
-
-typedef struct dbg_s_mod dbg_s_mod;
-struct dbg_s_mod
-{
-    const char *       name;  /* matches item in MODULE_NAMES() */
-    const dbg_s_flag *  conds; /* array of structures for setting flags */
-    KDbgMask           flags; /* which flags are active */
-};
-
-extern dbg_s_mod dbg_flag_mod     [DBG_MOD_COUNT+1];
-
-
-#define _module(mod) \
-    extern KDbgMask DBG_PASTE_3(DBG_,mod,_ANY);
-
-MODULE_NAMES()
-
-#undef _module
-
-
-/*
- * strings will be defined only in the single C file that should
- * define the symbol below before including this file.
- *
- * This could have been done in the C file but was done here to
- * keep the spirit of the work done all in one place.
- */
-
-#ifdef _KLIB_DEBUG_C_
-
-#define _module(mod) \
-    KDbgFlag DBG_PASTE_3(DBG_,mod,_ANY) = ( DBG_PASTE_2(mod,_CONDITIONS()) 0);
-#define _condition(mod,flag) \
-    (((KDbgFlag)1)<<DBG_PASTE_4(DBG_,mod,_,flag)) |
-
-MODULE_NAMES()
-
-#undef _module
-#undef _condition
-
-#define _module(mod)                            \
-    dbg_s_flag DBG_PASTE_2(dbg_s_flag_,mod) [] = \
-    {                                            \
-        DBG_PASTE_2(mod,_CONDITIONS())           \
-        { NULL, DBG_FLAG_NONE }                      \
-    };
-
-#define _condition(mod,flag)                                           \
-    { DBG_STRING(flag), ((KDbgFlag)1)<<DBG_PASTE_4(DBG_,mod,_,flag) },
-
-MODULE_NAMES()
-
-#undef _module
-#undef _condition
-
-#define _module(mod)                           \
-    {                                           \
-        DBG_STRING(mod),                         \
-        DBG_PASTE_2(dbg_s_flag_,mod),        \
-        0                                       \
-    },
-
-dbg_s_mod dbg_flag_mod [] = 
-{
-    MODULE_NAMES()
-    { NULL, NULL }
-};
-#undef _module
-
-#define _module(mod) 
-
-#endif /* if _KLIB_TEST_C_ */
-
-
-/*
- * For module 'mod' turn on or off the specific flags in
- * mask flags
- *
- * bits in mask are effected.
- * return previous 
- */
-KLIB_EXTERN KDbgMask CC KDbgSetModConds ( KDbgMod mod, KDbgMask mask, KDbgMask flags );
-KLIB_EXTERN bool CC KDbgTestModConds ( KDbgMod mod, KDbgMask flags );
-
-
-/*
- * Init()
- * Initialize the debug messages module to a known state
- */
-KLIB_EXTERN rc_t CC KDbgInit (void);
-
-/* 
- * param is coming in as utf-8/ASCII with NUL terminator or we fail
- * we also assume no more than 127 significant characters
- *
- * These strings can be utf-8 or ASCII even if we are using 
- * clib strXXX functions.
- */
-KLIB_EXTERN rc_t CC KDbgSetString (const char * string);
-
-/* KDbgMask KDbgFlagsGet  (KDbgMod mod); */
-/* bool     KDbgTestCond  (KDbgMask mask); */
-
-
-/*
- * Get the KDbgMod associated with a name.
- */
-KLIB_EXTERN rc_t CC KDbgGetModId (KDbgMod * mod, 
-                   const char * mod_name, size_t mod_size);
-
-/*
- * Get the KDbgCond associated with a name.
- */
-KLIB_EXTERN rc_t CC KDbgGetCndFlag (KDbgMod mod, KDbgFlag * flag,
-                      const char * cnd_name, size_t cnd_size);
-
-KLIB_EXTERN KDbgMask CC KDbgGetModFlags ( KDbgMod mod );
-
-KLIB_EXTERN rc_t CC KDbgMsg (const char * fmt, ...);
-
-#define DBGMSG(mod,flags,msg) \
-    (void)(((KDbgWriterGet() != NULL) && (KDbgTestModConds (mod, flags)))  \
-           ? KDbgMsg msg : 0)
-
-/* -----
- * Handlers for application and library writers.
- */
-KLIB_EXTERN KWrtHandler* CC KDbgHandlerGet ( void );
-KLIB_EXTERN KWrtWriter CC KDbgWriterGet ( void );
-KLIB_EXTERN void* CC KDbgWriterDataGet ( void );
-
-/* Handler
- *  sets output handler for standard output
- *
- *  "logger" [ IN ] and "self" [ IN, OPAQUE ] - callback function
- *  to handle log output
- */
-KLIB_EXTERN rc_t CC KDbgHandlerSet ( KWrtWriter writer, void * data );
-
-KLIB_EXTERN rc_t CC KDbgHandlerSetStdOut();
-KLIB_EXTERN rc_t CC KDbgHandlerSetStdErr();
-
-#ifdef __cplusplus
-}
-#endif
-
-#else /* #if _DEBUGGING */
-
-#define DBGMSG(mod,flags,msg) ((void)0)
-
-#define KDbgInit() ((rc_t)0)
-
-#define KDbgHandlerSetStdOut() ((rc_t)0)
-#define KDbgHandlerSetStdErr() ((rc_t)0)
-
-#define KDbgSetString(s) ((rc_t)0)
-
-#define KDbgHandlerSet(a,b) ((rc_t)0)
-
-#define KDbgHandlerGet() ((void*)NULL)
-#define KDbgWriterGet() ((void*)NULL)
-#define KDbgWriterDataGet() ((void*)NULL)
-
-#endif /* #if _DEBUGGING */
-
-#endif /*  _h_klib_debug_ */
diff --git a/interfaces/klib/defs.h b/interfaces/klib/defs.h
deleted file mode 100644
index d28c5a5..0000000
--- a/interfaces/klib/defs.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_klib_defs_
-#define _h_klib_defs_
-
-#ifndef _h_kfc_defs_
-#include <kfc/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * bitsz_t
- *  where size_t always denotes a quantity of bytes,
- *  bitsz_t denotes a quantity of bits.
- */
-typedef uint64_t bitsz_t;
-
-
-/*--------------------------------------------------------------------------
- * fptr_t
- *  "generic" function pointer type
- *  has very little real use other than to calm down compilers
- */
-typedef int ( CC * fptr_t ) ( void );
-
-
-/*--------------------------------------------------------------------------
- * remove_t
- *  usually when message signatures change, the compiler can
- *  and will pick up the changes and trigger an error. sometimes
- *  it will just issue a warning, and other times will not pick
- *  up on the significance of a change.
- *
- *  to ensure that a change of signature gets caught everywhere
- *  by the compiler, we can introduce an extra parameter that
- *  causes us to visit all dependent code.
- */
-typedef struct remove_t remove_t;
-
-
-/*--------------------------------------------------------------------------
- * KTime_t
- *  64 bit time_t
- *  operations are declared in <klib/time.h>
- */
-typedef int64_t KTime_t;
-
-
-/*--------------------------------------------------------------------------
- * KCreateMode
- *  values are defined in <kfs/defs.h>
- */
-typedef uint32_t KCreateMode;
-
-#if 1
-
-/*--------------------------------------------------------------------------
- * LPFX
- * SHLX
- * MODX
- *  take their input from make
- */
-#ifndef LIBPREFIX
- #define LPFX ""
-#else
- #define LPFXSTR2( str ) # str
- #define LPFXSTR( str ) LPFXSTR2 ( str )
- #define LPFX LPFXSTR ( LIBPREFIX )
-#endif
-#ifndef SHLIBEXT
- #define SHLX ""
-#else
- #define SHLXSTR2( str ) "." # str
- #define SHLXSTR( str ) SHLXSTR2 ( str )
- #define SHLX SHLXSTR ( SHLIBEXT )
-#endif
-#ifndef MODEXT
- #define MODX SHLX
-#else
- #define MODXSTR2( str ) "." # str
- #define MODXSTR( str ) MODXSTR2 ( str )
- #define MODX MODXSTR ( MODIBEXT )
-#endif
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*  _h_klib_defs_ */
diff --git a/interfaces/klib/extern.h b/interfaces/klib/extern.h
deleted file mode 100644
index 39aaac5..0000000
--- a/interfaces/klib/extern.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_klib_extern_
-#define _h_klib_extern_
-
-#if ! defined EXPORT_LATCH && defined _LIBRARY
-
-#define KLIB_EXTERN LIB_EXPORT
-#define KLIB_EXTERN_DATA extern LIB_EXPORT
-#define EXPORT_LATCH 1
-
-#else
-
-#define KLIB_EXTERN LIB_IMPORT
-#ifdef __cplusplus
-#define KLIB_EXTERN_DATA extern /* LIB_IMPORT_DATA */
-#else
-#define KLIB_EXTERN_DATA LIB_IMPORT_DATA
-#endif
-
-#endif
-
-#ifndef _h_kfc_extern_
-#include <kfc/extern.h>
-#endif
-
-#endif /* _h_klib_extern_ */
diff --git a/interfaces/klib/impl.h b/interfaces/klib/impl.h
deleted file mode 100644
index 35959ea..0000000
--- a/interfaces/klib/impl.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_klib_impl_
-#define _h_klib_impl_
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#ifndef _h_klib_namelist_
-#include <klib/namelist.h>
-#endif
-
-#ifndef _h_atomic_
-#include <atomic.h>
-#endif
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-typedef union KNamelist_vt KNamelist_vt;
-
-
-/*--------------------------------------------------------------------------
- * KNamelist
- *  a virtual directory listing
- */
-struct KNamelist
-{
-    const KNamelist_vt *vt;
-    atomic_t refcount;
-};
-
-#ifndef KNAMELIST_IMPL
-#define KNAMELIST_IMPL KNamelist
-#endif
-
-typedef struct KNamelist_vt_v1 KNamelist_vt_v1;
-struct KNamelist_vt_v1
-{
-    /* version == 1.x */
-    uint32_t maj;
-    uint32_t min;
-
-    /* start minor version == 0 */
-    rc_t ( CC * destroy ) ( KNAMELIST_IMPL *self );
-    rc_t ( CC * count ) ( const KNAMELIST_IMPL *self, uint32_t *count );
-    rc_t ( CC * get ) ( const KNAMELIST_IMPL *self, uint32_t idx, const char **name );
-    /* end minor version == 0 */
-};
-
-union KNamelist_vt
-{
-    KNamelist_vt_v1 v1;
-};
-
-/* Init
- */
-KLIB_EXTERN rc_t CC KNamelistInit ( KNamelist *self, const KNamelist_vt *vt );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_klib_impl_ */
diff --git a/interfaces/klib/klib-priv.h b/interfaces/klib/klib-priv.h
deleted file mode 100644
index f3a0f6f..0000000
--- a/interfaces/klib/klib-priv.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_klib_priv_
-#define _h_klib_priv_
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifndef _h_klib_writer_
-#include <klib/writer.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- */
-
-
-/* reporting structure
- */
-typedef struct ReportFuncs ReportFuncs;
-struct ReportFuncs
-{
-    void ( CC * report ) ( uint32_t indent, const char* name, uint32_t count, ... );
-    void ( CC * reportData ) ( uint32_t indent, const char* name, const char* data, uint32_t count, ... );
-    rc_t ( CC * reportData1 ) ( const char* data );
-    void ( CC * reportOpen ) ( uint32_t indent, const char* name, uint32_t count, ... );
-    void ( CC * reportOpen1 ) ( uint32_t indent, const char* name );
-    void ( CC * reportClose ) ( uint32_t indent, const char* name );
-    void ( CC * reportClose1 ) ( const char* name );
-    void ( CC * reportError ) ( uint32_t indent, rc_t rc, const char* function );
-    void ( CC * reportErrorStr ) ( uint32_t indent, rc_t rc, const char* function,
-        const char* name, const char* val );
-    void ( CC * reportErrorStrImpl ) ( uint32_t indent, rc_t rc, const char* function,
-        const char* name, const char* val, bool eol );
-    void ( CC * reportErrorStrInt ) ( uint32_t indent, rc_t rc, const char* function,
-        const char* names, const char* vals, const char* namei, uint32_t vali );
-    void ( CC * reportError3Str ) ( uint32_t indent, rc_t rc, const char* function,
-        const char* name, const char* v1, const char* v2, const char* v3, bool eol );
-};
-
-
-/* InitKFS
- */
-KLIB_EXTERN void CC ReportInitKFS (
-    rc_t ( CC * report_cwd ) ( const ReportFuncs *f, uint32_t indent ),
-    rc_t ( CC * report_redirect ) ( KWrtHandler* handler,
-        const char* filename, bool* to_file, bool finalize ) );
-
-/* InitConfig
- *  returns appname if available
- */
-KLIB_EXTERN const char* CC ReportInitConfig ( rc_t ( CC * report ) ( const ReportFuncs *f, uint32_t indent ) );
-
-
-/* InitVDB
- */
-KLIB_EXTERN rc_t CC ReportInitVDB(
-    rc_t (CC *report_obj)(const ReportFuncs *f,
-        uint32_t indent, const char *path, bool *wasDbOrTableSet),
-    rc_t (CC *report_software)(const ReportFuncs *f,
-        uint32_t indent, const char *argv_0, const char *date, ver_t tool_ver),
-    rc_t (CC *whack)(void));
-
-
-/* RecordZombieFile
- */
-KLIB_EXTERN void CC ReportRecordZombieFile ( void );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_klib_priv_ */
diff --git a/interfaces/klib/ksort-macro.h b/interfaces/klib/ksort-macro.h
deleted file mode 100644
index e86d57b..0000000
--- a/interfaces/klib/ksort-macro.h
+++ /dev/null
@@ -1,257 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#ifndef _h_klib_ksort_macro_
-#define _h_klib_ksort_macro_
-
-#include <limits.h>
-#include <stdlib.h>
-
-
-/* Copyright (C) 1991,1992,1996,1997,1999,2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Written by Douglas C. Schmidt (schmidt at ics.uci.edu).
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* If you consider tuning this algorithm, you should consult first:
-   Engineering a sort function; Jon Bentley and M. Douglas McIlroy;
-   Software - Practice and Experience; Vol. 23 (11), 1249-1265, 1993.  */
-
-/* Discontinue quicksort algorithm when partition gets below this size.
-   This particular magic number was chosen to work best on a Sun 4/260. */
-#ifndef KSORT_MAX_THRESH
-#define KSORT_MAX_THRESH 4
-#endif
-
-/* Stack node declarations used to store unfulfilled partition obligations. */
-#ifndef ksort_stack_node_declared
-#define ksort_stack_node_declared 1
-typedef struct ksort_stack_node ksort_stack_node;
-struct ksort_stack_node
-{
-    char *lo;
-    char *hi;
-};
-#endif
-
-/* The next 4 #defines implement a very fast in-line stack abstraction. */
-/* The stack needs log (total_elements) entries (we could even subtract
-   log(MAX_THRESH)).  Since total_elements has type size_t, we get as
-   upper bound for log (total_elements):
-   bits per byte (CHAR_BIT) * sizeof(size_t).  */
-
-#ifndef KSORT_STACK_SIZE
-#define KSORT_STACK_SIZE	(CHAR_BIT * sizeof(size_t))
-#endif
-
-#ifndef KSORT_PUSH
-#define KSORT_PUSH(low, high)	((void) ((top->lo = (low)), (top->hi = (high)), ++top))
-#endif
-
-#ifndef KSORT_POP
-#define	KSORT_POP(low, high)	((void) (--top, (low = top->lo), (high = top->hi)))
-#endif
-
-#ifndef KSORT_STACK_EMPTY
-#define	KSORT_STACK_EMPTY	( stack >= top )
-#endif
-
-#ifndef KSORT_SWAP
-#define KSORT_SWAP( a, b, off, size )           \
-    do                                          \
-    {                                           \
-        register size_t i, end = off + size;    \
-        register char *__a = (a), *__b = (b);   \
-        for ( i = off; i < end; ++ i )          \
-        {                                       \
-            char __tmp = __a [ i ];             \
-            __a [ i ] = __b [ i ];              \
-            __b [ i ] = __tmp;                  \
-        }                                       \
-    } while (0)
-#endif
-
-#define KSORT_TSWAP( T, a, b )                  \
-    do                                          \
-    {                                           \
-        T tmp = * ( const T* ) ( a );           \
-        * ( T* ) ( a ) = * ( const T* ) ( b );  \
-        * ( T* ) ( b ) = tmp;                   \
-    }                                           \
-    while ( 0 )
-
-
-/* Order size using quicksort.  This implementation incorporates
-   four optimizations discussed in Sedgewick:
-
-   1. Non-recursive, using an explicit stack of pointer that store the
-   next array partition to sort.  To save time, this maximum amount
-   of space required to store an array of SIZE_MAX is allocated on the
-   stack.  Assuming a 32-bit (64 bit) integer for size_t, this needs
-   only 32 * sizeof(stack_node) == 256 bytes (for 64 bit: 1024 bytes).
-   Pretty cheap, actually.
-
-   2. Chose the pivot element using a median-of-three decision tree.
-   This reduces the probability of selecting a bad pivot value and
-   eliminates certain extraneous comparisons.
-
-   3. Only quicksorts TOTAL_ELEMS / MAX_THRESH partitions, leaving
-   insertion sort to order the MAX_THRESH items within each partition.
-   This is a big win, since insertion sort is faster for small, mostly
-   sorted array segments.
-
-   4. The larger of the two sub-partitions is always pushed onto the
-   stack first, with the algorithm then concentrating on the
-   smaller partition.  This *guarantees* no more than log (total_elems)
-   stack size is needed (actually O(1) in this case)!  */
-
-#define KSORT( PBASE, TOTAL_ELEMS, ELEM_SIZE, SWAP_OFFSET, SWAP_SIZE )            \
-    register char *base_ptr = ( char* ) ( PBASE );                                \
-    const size_t max_thresh = KSORT_MAX_THRESH * ( ELEM_SIZE );                   \
-    if ( ( TOTAL_ELEMS ) < 2)                                                     \
-        return;                                                                   \
-    if ( ( TOTAL_ELEMS ) > KSORT_MAX_THRESH)                                      \
-    {                                                                             \
-        char *lo = base_ptr;                                                      \
-        char *hi = & lo [ ( ELEM_SIZE ) * ( ( TOTAL_ELEMS ) - 1 ) ];              \
-        ksort_stack_node stack [ KSORT_STACK_SIZE ];                              \
-        ksort_stack_node *top = stack;                                            \
-        KSORT_PUSH (NULL, NULL);                                                  \
-        while ( ! KSORT_STACK_EMPTY )                                             \
-        {                                                                         \
-            char *left_ptr;                                                       \
-            char *right_ptr;                                                      \
-            char *mid = lo + ( ELEM_SIZE ) * ( ( hi - lo ) / ( ELEM_SIZE ) >> 1 );\
-            if ( CMP ( ( void* ) mid, ( void* ) lo ) < 0 )                        \
-                SWAP ( mid, lo, ( SWAP_OFFSET ), ( SWAP_SIZE ) );                 \
-            if ( CMP ( ( void* ) hi, ( void* ) mid) < 0 )                         \
-                SWAP ( mid, hi, ( SWAP_OFFSET ), ( SWAP_SIZE ) );                 \
-            else                                                                  \
-                goto jump_over;                                                   \
-            if ( CMP ( ( void* ) mid, ( void* ) lo ) < 0 )                        \
-                SWAP ( mid, lo, ( SWAP_OFFSET ), ( SWAP_SIZE ) );                 \
-        jump_over:                                                                \
-            left_ptr  = lo + ( ELEM_SIZE );                                       \
-            right_ptr = hi - ( ELEM_SIZE );                                       \
-            do                                                                    \
-            {                                                                     \
-                while ( CMP ( ( void* ) left_ptr, ( void* ) mid ) < 0 )           \
-                    left_ptr += ( ELEM_SIZE );                                    \
-                while ( CMP ( ( void* ) mid, ( void* ) right_ptr ) < 0 )          \
-                    right_ptr -= ( ELEM_SIZE );                                   \
-                if ( left_ptr < right_ptr )                                       \
-                {                                                                 \
-                    SWAP ( left_ptr, right_ptr, ( SWAP_OFFSET ), ( SWAP_SIZE ) ); \
-                    if ( mid == left_ptr )                                        \
-                        mid = right_ptr;                                          \
-                    else if ( mid == right_ptr )                                  \
-                        mid = left_ptr;                                           \
-                    left_ptr += ( ELEM_SIZE );                                    \
-                    right_ptr -= ( ELEM_SIZE );                                   \
-                }                                                                 \
-                else if ( left_ptr == right_ptr )                                 \
-                {                                                                 \
-                    left_ptr += ( ELEM_SIZE );                                    \
-                    right_ptr -= ( ELEM_SIZE );                                   \
-                    break;                                                        \
-                }                                                                 \
-            }                                                                     \
-            while ( left_ptr <= right_ptr );                                      \
-            if ((size_t) (right_ptr - lo) <= max_thresh)                          \
-            {                                                                     \
-                if ((size_t) (hi - left_ptr) <= max_thresh)                       \
-                    KSORT_POP (lo, hi);                                           \
-                else                                                              \
-                    lo = left_ptr;                                                \
-            }                                                                     \
-            else if ((size_t) (hi - left_ptr) <= max_thresh)                      \
-                hi = right_ptr;                                                   \
-            else if ((right_ptr - lo) > (hi - left_ptr))                          \
-            {                                                                     \
-                KSORT_PUSH (lo, right_ptr);                                       \
-                lo = left_ptr;                                                    \
-            }                                                                     \
-            else                                                                  \
-            {                                                                     \
-                KSORT_PUSH (left_ptr, hi);                                        \
-                hi = right_ptr;                                                   \
-            }                                                                     \
-        }                                                                         \
-    }                                                                             \
-    {                                                                             \
-        register char *run_ptr;                                                   \
-        char *const end_ptr = & base_ptr [(ELEM_SIZE)*((TOTAL_ELEMS)-1)];         \
-        char *tmp_ptr = base_ptr;                                                 \
-        char *thresh = base_ptr + max_thresh;                                     \
-        if ( thresh > end_ptr )                                                   \
-            thresh = end_ptr;                                                     \
-        for (run_ptr = tmp_ptr+(ELEM_SIZE);run_ptr<=thresh;run_ptr+=(ELEM_SIZE))  \
-            if ( CMP ( ( void* ) run_ptr, ( void* ) tmp_ptr ) < 0 )               \
-                tmp_ptr = run_ptr;                                                \
-        if (tmp_ptr != base_ptr)                                                  \
-            SWAP ( tmp_ptr, base_ptr, ( SWAP_OFFSET ), ( SWAP_SIZE ) );           \
-        tmp_ptr = base_ptr + ( ELEM_SIZE );                                       \
-        for ( run_ptr = base_ptr + ( 2 * ( ELEM_SIZE ) );                         \
-              run_ptr <= end_ptr; tmp_ptr = run_ptr, run_ptr += ( ELEM_SIZE ) )   \
-        {                                                                         \
-            for ( ; tmp_ptr >= base_ptr; tmp_ptr -= ( ELEM_SIZE ) )               \
-            {                                                                     \
-                if ( CMP ( run_ptr, tmp_ptr ) >= 0 )                              \
-                    break;                                                        \
-            }                                                                     \
-            tmp_ptr += ( ELEM_SIZE );                                             \
-            if ( tmp_ptr != run_ptr )                                             \
-            {                                                                     \
-                char *trav;                                                       \
-                trav = run_ptr + ( ELEM_SIZE );                                   \
-                while ( --trav >= run_ptr )                                       \
-                {                                                                 \
-                    char c = *trav;                                               \
-                    char *hi, *lo;                                                \
-                    for (hi=lo=trav; (lo-=(ELEM_SIZE)) >= tmp_ptr; hi=lo)         \
-                        *hi = *lo;                                                \
-                    *hi = c;                                                      \
-                }                                                                 \
-            }                                                                     \
-        }                                                                         \
-    }                                                                             \
-    ( void ) 0
-
-#endif /* _h_klib_ksort_macro_ */
diff --git a/interfaces/klib/log.h b/interfaces/klib/log.h
deleted file mode 100644
index b16ec6c..0000000
--- a/interfaces/klib/log.h
+++ /dev/null
@@ -1,380 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_klib_log_
-#define _h_klib_log_
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifndef _h_klib_logfmt_
-#include <klib/logfmt.h>
-#endif
-
-#ifndef _h_klib_writer_
-#include <klib/writer.h>
-#endif
-
-#include <stdarg.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * KLogLevel
- *  indicates the severity of message: emission of messages depends upon
- *  the setting of a global value that allows messages assigned higher priority
- * (lower numeric value) while filtering lower priority messages.
- *
- *  "fatal" - reported when about to abort
- *  "sys"   - an error occurred when interacting with OS
- *  "int"   - an internal logic error occurred
- *  "err"   - a user-level error occurred
- *  "warn"  - an unusual or undesired condition was detected
- *  "info"  - an event, state or condition is being reported
- *  "debug" - verbose output for use in debugging
- */
-typedef uint32_t KLogLevel;
-enum
-{
-    klogLevelMin = 0,
-    klogFatal = klogLevelMin,
-    klogSys,
-    klogInt,
-    klogErr,
-    klogWarn,
-    klogInfo,
-    klogLevelMax = klogInfo
-};
-
-/* Get
- *  retrieve current process-global log level
- */
-KLIB_EXTERN KLogLevel CC KLogLevelGet (void);
-
-/* Set
- *  set process-global log level
- */
-KLIB_EXTERN rc_t CC KLogLevelSet ( KLogLevel lvl );
-
-
-/* KLogLevelAdjust
- *  adjust process-global log level by an offset from current
- */
-KLIB_EXTERN void CC KLogLevelAdjust ( int32_t adjust );
-
-
-/* KLogLevelExplain
- *  inserts level description
- *
- * buffer may not be NULL, num_writ may be NULL
- */
-KLIB_EXTERN rc_t CC KLogLevelExplain ( KLogLevel lvl, char* buffer, size_t bsize, size_t* num_writ );
-
-KLIB_EXTERN const char ** CC KLogGetParamStrings ( void );
-
-/* LastErrorCode
- * LastErrorCodeReset
- *  return or clear the last reported rc_t with log level klogErr or above
- */
-KLIB_EXTERN rc_t CC KLogLastErrorCode ( void );
-KLIB_EXTERN void CC KLogLastErrorCodeReset ( void );
-
-/* LastErrorCodeSet
- *  set the last reported rc_t with log level klogErr or above
- */
-KLIB_EXTERN void CC KLogLastErrorCodeSet ( KLogLevel lvl, rc_t rc );
-
-/* -----
- * Handlers for application and library writers.
- */
-KLIB_EXTERN KWrtHandler* CC KLogHandlerGet (void);
-KLIB_EXTERN KWrtHandler* CC KLogLibHandlerGet (void);
-
-KLIB_EXTERN KWrtWriter CC KLogWriterGet (void);
-KLIB_EXTERN KWrtWriter CC KLogLibWriterGet (void);
-KLIB_EXTERN void* CC KLogDataGet (void);
-KLIB_EXTERN void* CC KLogLibDataGet (void);
-
-
-/* Handler
- *  sets output handler for standard output
- *
- *  "logger" [ IN ] and "self" [ IN, OPAQUE ] - callback function
- *  to handle log output
- */
-KLIB_EXTERN rc_t CC KLogHandlerSet    (KWrtWriter writer, void * data);
-KLIB_EXTERN rc_t CC KLogLibHandlerSet (KWrtWriter writer, void * data);
-
-KLIB_EXTERN rc_t CC KLogHandlerSetStdOut    (void);
-KLIB_EXTERN rc_t CC KLogLibHandlerSetStdOut (void);
-KLIB_EXTERN rc_t CC KLogHandlerSetStdErr    (void);
-KLIB_EXTERN rc_t CC KLogLibHandlerSetStdErr (void);
-
-/* formatting */
-
-typedef uint32_t KLogFmtFlags;
-enum
-{
-    klogFmtTimestamp = 0x00000001,
-    klogFmtSeverity = 0x00000002,
-    klogFmtPid = 0x00000004,
-    klogFmtAppName = 0x00000008,
-    klogFmtAppVersion = 0x00000010,
-    klogFmtMessage = 0x00000020, /* actual message  */
-    klogFmtReason = 0x00000040, /* full RC message */
-    klogFmtReasonShort = 0x00000080, /* object and state only */
-    klogFmtRC = 0x00000100, /* rc enum textual values */
-    klogFmtModule = 0x00000200, /* rc enum name for module */
-    klogFmtTarget = 0x00000400, /* rc enum name for target */
-    klogFmtContext = 0x00000800, /* rc enum name for context */
-    klogFmtObject = 0x00001000, /* rc enum name for object */
-    klogFmtState = 0x00002000, /* rc enum name for state */
-    klogFmtModuleText = 0x00004000, /* rc enum text for module */
-    klogFmtTargetText = 0x00008000, /* rc enum text for target */
-    klogFmtContextText = 0x00010000, /* rc enum text for context */
-    klogFmtObjectText = 0x00020000, /* rc enum text for object */
-    klogFmtStateText = 0x00040000, /* rc enum text for state */
-    klogFmtLocalTimestamp = 0x00080000 /* print time stamp in local time, if both bits set local takes over */
-};
-
-KLIB_EXTERN KFmtHandler* CC KLogFmtHandlerGet (void);
-KLIB_EXTERN KFmtHandler* CC KLogLibFmtHandlerGet (void);
-
-KLIB_EXTERN KLogFmtFlags CC KLogFmtFlagsGet ( void );
-KLIB_EXTERN KLogFmtFlags CC KLogLibFmtFlagsGet ( void );
-
-KLIB_EXTERN KFmtWriter CC KLogFmtWriterGet (void);
-KLIB_EXTERN KFmtWriter CC KLogLibFmtWriterGet (void);
-KLIB_EXTERN void* CC KLogFmtDataGet (void);
-KLIB_EXTERN void* CC KLogLibFmtDataGet (void);
-
-KLIB_EXTERN rc_t CC KLogFmtFlagsSet    (KLogFmtFlags flags);
-KLIB_EXTERN rc_t CC KLogLibFmtFlagsSet (KLogFmtFlags flags);
-
-KLIB_EXTERN rc_t CC KLogFmtHandlerSet    (KFmtWriter formatter, KLogFmtFlags flags, void* data);
-KLIB_EXTERN rc_t CC KLogLibFmtHandlerSet (KFmtWriter formatter, KLogFmtFlags flags, void* data);
-
-KLIB_EXTERN rc_t CC KLogFmtHandlerSetDefault(void);
-KLIB_EXTERN rc_t CC KLogLibFmtHandlerSetDefault(void);
-
-/*--------------------------------------------------------------------------
- * Log
- *  global logging
- *
- *  this logging API - like most others - attempts to remain isolated
- *  from any actual logging implementation, such that output may be
- *  routed in several ways.
- *
- *  the default handler
- *
- *  the path from unstructured text to formatted XML is difficult in that
- *  it requires parsing, and is therefore error prone.
- *
- *  the path from structured reports to XML as well as less or unstructured
- *  text is simple to implement, but generally more of a burden to use.
- *
- *  the challenge is therefore to present an API that makes structured
- *  logging less painful than it might be.
- */
-
-
-/* Init
- *  initialize the logging module with executable identity and version,
- *  plus logging level. actual behavior is determined by the logging
- *  implementation.
- *
- */
-KLIB_EXTERN rc_t CC KLogInit (void );
-
-/* LogMsg
- *  makes an entry to the log file
- *
- *  "lvl" [ IN ] - severity of message
- *
- *  "msg" [ IN ] - NUL terminated string
- */
-KLIB_EXTERN rc_t CC LogMsg ( KLogLevel lvl, const char *msg );
-KLIB_EXTERN rc_t CC LogLibMsg ( KLogLevel lvl, const char *msg );
-
-/* pLogMsg
- *  makes a parameterized entry to the log file
- *
- *  "lvl" [ IN ] - severity of message
- *
- *  "msg" [ IN ] - NUL terminated string with named parameters
- *
- *  "fmt" [ IN ] - NUL terminated format string, behaves according
- *  to standard printf-style formatting
- */
-KLIB_EXTERN rc_t CC pLogMsg ( KLogLevel lvl, const char *msg, const char *fmt, ... );
-KLIB_EXTERN rc_t CC vLogMsg ( KLogLevel lvl, const char *msg, const char *fmt, va_list args );
-KLIB_EXTERN rc_t CC pLogLibMsg ( KLogLevel lvl, const char *msg, const char *fmt, ... );
-KLIB_EXTERN rc_t CC vLogLibMsg ( KLogLevel lvl, const char *msg, const char *fmt, va_list args );
-
-
-/* LogErr
- *  reports an error to log file
- *
- *  "lvl" [ IN ] - severity of message
- *
- *  "rc" [ IN ] - return code to be decoded
- *
- *  "msg" [ IN, NULL OKAY ] - optional NUL terminated message string
- */
-KLIB_EXTERN rc_t CC LogErr ( KLogLevel lvl, rc_t rc, const char *msg );
-KLIB_EXTERN rc_t CC LogLibErr ( KLogLevel lvl, rc_t rc, const char *msg );
-
-
-/* pLogErr
- *  reports an error to log file
- *
- *  "lvl" [ IN ] - severity of message
- *
- *  "rc" [ IN ] - return code to be decoded
- *
- *  "msg" [ IN ] - NUL terminated message string with named parameters
- *
- *  "fmt" [ IN ] - NUL terminated format string, behaves according
- *  to standard printf-style formatting
- */
-KLIB_EXTERN rc_t CC pLogErr ( KLogLevel lvl, rc_t rc, const char *msg, const char *fmt, ... );
-KLIB_EXTERN rc_t CC vLogErr ( KLogLevel lvl, rc_t rc, const char *msg, const char *fmt, va_list args );
-KLIB_EXTERN rc_t CC pLogLibErr ( KLogLevel lvl, rc_t rc, const char *msg, const char *fmt, ... );
-KLIB_EXTERN rc_t CC vLogLibErr ( KLogLevel lvl, rc_t rc, const char *msg, const char *fmt, va_list args );
-
-/* conditional wrapper */
-#ifdef _LIBRARY
-
-/*
- * Usage:
- *  LOGMSG (logWarn, (logWarn, "Something happened"));
- *
- * But we can't HAVE a pony...
- */
-#define LOGMSG(lvl,msg)         \
-    ((((unsigned)lvl) <= KLogLevelGet()) ? LogLibMsg (lvl, msg) : (rc_t)0)
-
-/*
- * fmt is  two fmt strings plus parameters 
- * usage resembles
- *   PLOGMSG (logWarn, (logWarn, "message with $(PARAM)", "PARAM=%s", "parameter"));
- */
-#define PLOGMSG(lvl,msg)        \
-    ((((unsigned)lvl) <= KLogLevelGet()) ? pLogLibMsg msg : (rc_t)0)
-
-/*
- * fmt is  two fmt strings plus parameters 
- * usage resembles
- *   VLOGMSG (logWarn, (logWarn, "message with $(PARAM)", "PARAM=%s", args));
- */
-#define VLOGMSG(lvl,msg)        \
-    ((((unsigned)lvl) <= KLogLevelGet()) ? vLogLibMsg msg : (rc_t)0)
-
-/*
- * Usage:
- *  LOGMSG (logWarn, rc, "Something wicked this way comes");
- */
-#define LOGERR(lvl,rc,msg)        \
-    ((((unsigned)lvl) <= KLogLevelGet()) ? LogLibErr (lvl,rc,msg) : (rc_t)0)
-
-/*
- * fmt is  two fmt strings plus parameters 
- * usage resembles
- *   PLOGERR (logWarn, (logWarn, rc, "message with $(PARAM)", "PARAM=%s", "parameter"));
- */
-#define PLOGERR(lvl,msg)        \
-    ((((unsigned)lvl) <= KLogLevelGet()) ? pLogLibErr msg : (rc_t)0)
-
-/*
- * fmt is  two fmt strings plus parameters 
- * usage resembles
- *   VLOGERR (logWarn, (logWarn, rc, "message with $(PARAM)", "PARAM=%s", args));
- */
-#define VLOGERR(lvl,msg)        \
-    ((((unsigned)lvl) <= KLogLevelGet()) ? vLogLibErr msg : (rc_t)0)
-
-#else
-
-/*
- * Usage:
- *  LOGMSG (logWarn, "Something happened");
- */
-#define LOGMSG(lvl,msg)         \
-    ((((unsigned)lvl) <= KLogLevelGet()) ? LogMsg (lvl,msg) : (rc_t)0)
-
-/*
- * fmt is  two fmt strings plus parameters 
- * usage resembles
- *   PLOGMSG (logWarn, (logWarn, "message with $(PARAM)", "PARAM=%s", "parameter"));
- */
-#define PLOGMSG(lvl,msg)        \
-    ((((unsigned)lvl) <= KLogLevelGet()) ? pLogMsg msg : (rc_t)0)
-
-/*
- * fmt is  two fmt strings plus parameters 
- * usage resembles
- *   VLOGMSG (logWarn, (logWarn, "message with $(PARAM)", "PARAM=%s", args));
- */
-#define VLOGMSG(lvl,msg)        \
-    ((((unsigned)lvl) <= KLogLevelGet()) ? vLogMsg msg : (rc_t)0)
-
-/*
- * Usage:
- *  LOGMSG (logWarn, rc, "Something wicked this way comes");
- */
-#define LOGERR(lvl,rc,msg)        \
-    ((((unsigned)lvl) <= KLogLevelGet()) ? LogErr (lvl,rc,msg) : (rc_t)0)
-
-/*
- * fmt is  two fmt strings plus parameters 
- * usage resembles
- *   PLOGERR (logWarn, (logWarn, rc, "message with $(PARAM)", "PARAM=%s", "parameter"));
- */
-#define PLOGERR(lvl,msg)        \
-    ((((unsigned)lvl) <= KLogLevelGet()) ? pLogErr msg : (rc_t)0)
-
-/*
- * fmt is  two fmt strings plus parameters 
- * usage resembles
- *   VLOGERR (logWarn, (logWarn, rc, "message with $(PARAM)", "PARAM=%s", args));
- */
-#define VLOGERR(lvl,msg)        \
-    ((((unsigned)lvl) <= KLogLevelGet()) ? vLogErr msg : (rc_t)0)
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_klib_log_ */
diff --git a/interfaces/klib/logfmt.h b/interfaces/klib/logfmt.h
deleted file mode 100644
index 619a3ec..0000000
--- a/interfaces/klib/logfmt.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_klib_logfmt_
-#define _h_klib_logfmt_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define PLOG_NAME(name)   #name
-#define	PLOG_C(name)	  PLOG_NAME(name) "=%c"
-#define	PLOG_S(name)	  PLOG_NAME(name) "=%s"
-#define	PLOG_I8(name)	  PLOG_NAME(name) "=%hhd"
-#define	PLOG_U8(name)	  PLOG_NAME(name) "=%hhu"
-#define	PLOG_X8(name)	  PLOG_NAME(name) "=0x%2.2hhX"
-#define	PLOG_I16(name)	  PLOG_NAME(name) "=%hd"
-#define	PLOG_U16(name)	  PLOG_NAME(name) "=%hu"
-#define	PLOG_X16(name)	  PLOG_NAME(name) "=0x%4.4hX"
-#define	PLOG_I32(name)	  PLOG_NAME(name) "=%d"
-#define	PLOG_U32(name)	  PLOG_NAME(name) "=%u"
-#define	PLOG_X32(name)	  PLOG_NAME(name) "=0x%8.8X"
-#define	PLOG_I64(name)	  PLOG_NAME(name) "=%ld"
-#define	PLOG_U64(name)	  PLOG_NAME(name) "=%lu"
-#define	PLOG_X64(name)	  PLOG_NAME(name) "=0x%16.16lX"
-#define	PLOG_PDIFF(name)  PLOG_NAME(name) "=%zd"
-#define	PLOG_SIZE(name)	  PLOG_NAME(name) "=0x%zu"
-#define PLOG_P(name)      PLOG_NAME(name) "=%p"
-/* use the above to fill in the below */
-#define PLOG_2(a,b)		    a "," b
-#define PLOG_3(a,b,c)		a "," b "," c
-#define PLOG_4(a,b,c,d)		a "," b "," c "," d
-#define PLOG_5(a,b,c,d,e)	a "," b "," c "," d "," e
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_klib_logfmt_ */
diff --git a/interfaces/klib/misc.h b/interfaces/klib/misc.h
deleted file mode 100644
index 69bd5fd..0000000
--- a/interfaces/klib/misc.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_klib_misc_
-#define _h_klib_misc_
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-KLIB_EXTERN bool CC is_iser_an_admin(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*  _h_klib_misc_ */
diff --git a/interfaces/klib/namelist.h b/interfaces/klib/namelist.h
deleted file mode 100644
index 751a172..0000000
--- a/interfaces/klib/namelist.h
+++ /dev/null
@@ -1,181 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_klib_namelist_
-#define _h_klib_namelist_
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifndef _h_klib_text_
-#include <klib/text.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KNamelist
- *  a generic list of NUL-terminated name strings
- */
-typedef struct KNamelist KNamelist;
-
-/* AddRef
- * Release
- *  ignores NULL references
- */
-KLIB_EXTERN rc_t CC KNamelistAddRef ( const KNamelist *self );
-KLIB_EXTERN rc_t CC KNamelistRelease ( const KNamelist *self );
-
-/* Count
- *  returns the number of entries
- *
- *  "count" [ OUT ] - return parameter for entry count
- */
-KLIB_EXTERN rc_t CC KNamelistCount ( const KNamelist *self, uint32_t *count );
-
-/* Get
- *  get an indexed name
- *
- *  "idx" [ IN ] - a zero-based name index
- *
- *  "name" [ OUT ] - return parameter for NUL terminated name
- */
-KLIB_EXTERN rc_t CC KNamelistGet ( const KNamelist *self,
-    uint32_t idx, const char **name );
-
-
-/*--------------------------------------------------------------------------
- * VNamelist
- *  generic Vector namelist implementation
- */
-typedef struct VNamelist VNamelist;
-
-/* Make
- *  make an empty namelist
- *
- *  "names" [ OUT ] - return parameter for namelist object
- *
- *  "alloc_blocksize" [ IN ] - selects the number of names in
- *  a vector block; used for allocating and extending
- */
-KLIB_EXTERN rc_t CC VNamelistMake ( VNamelist **names, const uint32_t alloc_blocksize );
-
-/* Release
- *  ignores NULL references
- */
-KLIB_EXTERN rc_t CC VNamelistRelease ( const VNamelist *self );
-
-/* ToNamelist
- *  cast operator
- *
- *  "cast" [ OUT ] - return parameter for new KNamelist reference
- *  must be released by KNamelistRelease
- */
-KLIB_EXTERN rc_t CC VNamelistToNamelist ( VNamelist *self, KNamelist **cast );
-KLIB_EXTERN rc_t CC VNamelistToConstNamelist ( const VNamelist *self, const KNamelist **cast );
-
-
-/* Append
- *  appends a copy of string to the VNamelist
- *
- *  "src" [ IN ] - NUL terminated name string / String-struct ... to be copied
- *  and appended.
- */
-KLIB_EXTERN rc_t CC VNamelistAppend ( VNamelist *self, const char* src );
-KLIB_EXTERN rc_t CC VNamelistAppendString ( VNamelist *self, const String * src );
-
-/* Remove
- *  removes a string from the namelist
- *
- *  "s" [ IN ] - NUL terminated name string to be removed
- */
-KLIB_EXTERN rc_t CC VNamelistRemove( VNamelist *self, const char* s );
-
-/* Remove all
- *  removes all strings from the namelist ( calls free on them internally )
- *
- */
-KLIB_EXTERN rc_t CC VNamelistRemoveAll( VNamelist *self );
-
-
-/* Remove string at index ( and calls fron on it internally )
- *  returns error code if index is invalid
- *
- */
-KLIB_EXTERN rc_t CC VNamelistRemoveIdx( VNamelist *self, uint32_t idx );
-
-
-/* IndexOf
- *  searches linear in the namelist for the string
- *
- *  "s" [ IN ] - NUL terminated name string to be searched for
- *
- *  "found" [ OUT ] - index of the string if found
- *  unchanged if not found
- *
- *  returns RC( rcCont, rcNamelist, rcSearching, rcString, rcNotFound ) if not found
- */
-KLIB_EXTERN rc_t CC VNamelistIndexOf( VNamelist *self, const char* s, uint32_t *found );
-
-/* Count
- *  returns the number of entries
- *
- *  "count" [ OUT ] - return parameter for entry count
- */
-KLIB_EXTERN rc_t CC VNameListCount ( const VNamelist *self, uint32_t *count );
-
-/* Get
- *  get an indexed name
- *
- *  "idx" [ IN ] - a zero-based name index
- *
- *  "name" [ OUT ] - return parameter for NUL terminated name
- */
-KLIB_EXTERN rc_t CC VNameListGet ( const VNamelist *self, uint32_t idx, const char **name );
-
-
-/* Reorder
- *  sort the names according to case sensitivity
- *  and UNICODE character code ordering
- *
- *  "case_insensitive" [ IN ] - when true, perform "tolower" on
- *   each character before compare
- */
-KLIB_EXTERN void CC VNamelistReorder ( VNamelist *self, bool case_insensitive );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_klib_namelist_ */
diff --git a/interfaces/klib/namelist.hpp b/interfaces/klib/namelist.hpp
deleted file mode 100644
index 58c7d6a..0000000
--- a/interfaces/klib/namelist.hpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _hpp_klib_namelist_
-#define _hpp_klib_namelist_
-
-#ifndef _h_klib_namelist_
-#include <klib/namelist.h>
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KNamelist
- *  a generic list of NUL-terminated name strings
- */
-struct KNamelist
-{
-    /* AddRef
-     * Release
-     *  ignores NULL references
-     */
-    inline int AddRef () const throw()
-    { return KNamelistAddRef ( this ); }
-    inline int Release () const throw()
-    { return KNamelistRelease ( this ); }
-
-    /* Count
-     *  returns the number of entries
-     *
-     *  "count" [ OUT ] - return parameter for entry count
-     */
-    rc_t Count ( uint32_t *count ) const throw()
-    { return KNamelistCount ( this, count ); }
-
-    /* Get
-     *  get an indexed name
-     *
-     *  "idx" [ IN ] - a zero-based name index
-     *
-     *  "name" [ OUT ] - return parameter for NUL terminated name
-     */
-    rc_t Get ( uint32_t idx, const char **name ) const throw()
-    { return KNamelistGet ( this, idx, name ); }
-
-private:
-    KNamelist ();
-    ~ KNamelist ();
-    KNamelist ( const KNamelist& );
-    KNamelist &operator = ( const KNamelist& );
-};
-
-
-/*--------------------------------------------------------------------------
- * VNamelist
- *  a vector-based list of NUL-terminated name strings
- */
-struct VNamelist
-{
-
-    inline static rc_t Make ( VNamelist **namelist, const uint32_t alloc_blocksize ) throw ()
-    { return VNamelistMake ( namelist, alloc_blocksize ); }
-
-    /* AddRef
-     * Release
-     *  ignores NULL references
-     */
-    inline int AddRef () const throw()
-    { return KNamelistAddRef ( ( const KNamelist * )this ); }
-    inline int Release () const throw()
-    { return VNamelistRelease ( this ); }
-
-    /* Count
-     *  returns the number of entries
-     *
-     *  "count" [ OUT ] - return parameter for entry count
-     */
-    rc_t Count ( uint32_t *count ) const throw()
-    { return KNamelistCount ( ( const KNamelist * )this, count ); }
-
-    /* Get
-     *  get an indexed name
-     *
-     *  "idx" [ IN ] - a zero-based name index
-     *
-     *  "name" [ OUT ] - return parameter for NUL terminated name
-     */
-    rc_t Get ( uint32_t idx, const char **name ) const throw()
-    { return KNamelistGet ( ( const KNamelist * )this, idx, name ); }
-    
-    /* Append
-     *  append a string...
-     *
-     *  "src" [ IN ] - the string to append
-     */
-    rc_t Append ( const char *src ) throw()
-    { return VNamelistAppend ( this, src ); }
-
-
-private:
-    VNamelist ();
-    ~ VNamelist ();
-    VNamelist ( const VNamelist& );
-    VNamelist &operator = ( const VNamelist& );
-};
-
- 
-#endif // _hpp_klib_namelist_
diff --git a/interfaces/klib/out.h b/interfaces/klib/out.h
deleted file mode 100644
index 02aa06f..0000000
--- a/interfaces/klib/out.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_klib_out_
-#define _h_klib_out_
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#ifndef _h_klib_writer_
-#include <klib/writer.h>
-#endif
-
-#include <stdarg.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* -----
- * Handlers for application and library writers.
- */
-
-KLIB_EXTERN KWrtHandler* CC KOutHandlerGet (void);
-
-/* Handler
- *  sets output handler for standard output
- *
- *  "logger" [ IN ] and "self" [ IN, OPAQUE ] - callback function
- *  to handle log output
- */
-KLIB_EXTERN rc_t CC KOutHandlerSet          (KWrtWriter writer, void * data);
-KLIB_EXTERN rc_t CC KOutHandlerSetStdOut    (void);
-KLIB_EXTERN rc_t CC KOutHandlerSetStdErr    (void);
-
-KLIB_EXTERN KWrtWriter CC KOutWriterGet (void);
-KLIB_EXTERN void * CC KOutDataGet (void);
-
-KLIB_EXTERN rc_t CC KOutInit (void);
-
-KLIB_EXTERN rc_t CC KOutMsg (const char * fmt, ...);
-
-#define KOutStr(str) KOutMsg("%s",str)
-
-/*
- * A usage could look like
- *
- * OUTMSG (kout_2, "Current Out Level is %d\n", OutLevelGet());
- *
- */
-#define OUTMSG(msg) \
-    ((KOutWriterGet() != NULL) ? KOutMsg msg : 0)
-
-#define OUTSTR(msg) \
-    ((KOutWriterGet() != NULL) ? KOutStr (msg) : 0)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*  _h_klib_out_ */
diff --git a/interfaces/klib/pack.h b/interfaces/klib/pack.h
deleted file mode 100644
index fc28ef7..0000000
--- a/interfaces/klib/pack.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_klib_pack_
-#define _h_klib_pack_
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * bit-packing operations
- *  packed bits have leading zeros eliminated
- *  unpacked bits have no more information, but may occupy more storage
- *
- *  packed bits are stored in big-endian byte order and big-bit-endian
- *  bit order. unpacked bits are in architecture native order.
- *
- *  little-endian architectures place the least significant information
- *  in the left-most addresses. Intel architecture still has bit ordering
- *  with LSB to the right. the only way to view byte and bit order as
- *  coherent in this architecture is in 2 dimensions, such that bit ordering
- *  within a byte is along one dimension and the bytes are another.
- *
- *  viewing a stream of bits is by definition uni-dimensional, and thus
- *  this code treats bit streams in big-bit-endian order, with the most
- *  significant bit of the most significant byte to the left, and each
- *  bit to the right has decreasing significance.
- *
- *  packed bits are left-aligned, such that an 8=>2 packing of the bytes
- *  [ 1, 2, 3 ] will yield a single byte of 0b01101100 ( 0x6C ).
- *
- *  a pack or unpack operation with identical bit sizes ( e.g. 16=>16 )
- *  will act like a memcpy on big-endian architectures and a byte-swap
- *  on little-endian architectures.
- */
-
-
-/* Pack
- *  accepts a series of unpacked source bits
- *  produces a series of packed destination bits by eliminating MSB
- *
- *  "unpacked" [ IN ] - original element size in bits
- *  must be in 2^^[3..6], i.e. { 8, 16, 32, 64 }
- *
- *  "packed" [ IN ] - packed element size in bits
- *  must be <= "unpacked"
- *
- *  "src" [ IN ] and "ssize" [ IN ] - source buffer
- *  with size given in bytes
- *
- *  "consumed" [ OUT, NULL OKAY ] - number of source bytes
- *  consumed. if NULL, then all source bytes MUST be consumed
- *  or an error will be generated.
- *
- *  "dst" [ OUT ] and "dst_off" [ IN ] - destination
- *  buffer bit address
- *
- *  "dsize" [ IN ] - size of "dst" in bits, not including "dst_off"
- *
- *  "psize" [ OUT ] - resultant packed size in bits
- *
- * NB - the implementation may allow packing in place
- */
-KLIB_EXTERN rc_t CC Pack ( uint32_t unpacked, uint32_t packed,
-    const void *src, size_t ssize, size_t *consumed,
-    void *dst, bitsz_t dst_off, bitsz_t dsize, bitsz_t *psize );
-
-
-/* Unpack
- *  accepts a series of packed source bits
- *  produces a series of unpacked destination bits by left-padding zeros
- *
- *  "packed" [ IN ] - packed element size in bits
- *
- *  "unpacked [ IN ] - original element size in bits
- *  must be >= "packed" and
- *  must be in 2^^[3..6], i.e. { 8, 16, 32, 64 }
- *
- *  "src" [ IN ] and "src_off" [ IN ] - source buffer
- *  bit address
- *
- *  "ssize" [ IN ] - number of bits in "src", not including "src_off"
- *
- *  "consumed" [ OUT, NULL OKAY ] - number of source bits
- *  consumed. if NULL, then all source bits MUST be consumed
- *  or an error will be generated.
- *
- *  "dst" [ OUT ] and "dsize" [ IN ] - destination buffer
- *  where size is given in bytes
- *
- *  "usize" [ OUT ] - resultant unpacked size in bytes
- *
- * NB - "src" and "dst" may have same address since
- *  the implementation unpacks from right to left, smaller to larger
- */
-KLIB_EXTERN rc_t CC Unpack ( uint32_t packed, uint32_t unpacked,
-    const void *src, bitsz_t src_off, bitsz_t ssize, bitsz_t *consumed,
-    void *dst, size_t dsize, size_t *usize );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_klib_pack_ */
diff --git a/interfaces/klib/pbstree.h b/interfaces/klib/pbstree.h
deleted file mode 100644
index 3d69bbb..0000000
--- a/interfaces/klib/pbstree.h
+++ /dev/null
@@ -1,287 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_klib_pbstree_
-#define _h_klib_pbstree_
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct BSTree;
-
-
-/*--------------------------------------------------------------------------
- * PBSTNode
- *  identifies a node within persisted binary search tree
- *
- *  a BSTree will contain BSTNodes, which themselves are intrusive but
- *  irrelevant internal tree links plus an externally defined data
- *  structure, having both key and value, and supporting multiple
- *  keys per node. the internal links permit navigation from node
- *  to node that is not possible with the PBSTNode.
- *
- *  a PBSTree does not contain structured nodes, but stores linkage
- *  and ordering information separately from the externally defined
- *  data, and rather than using pointers, assigns integer ids to the
- *  nodes themselves. navigation by pointers would require allocations,
- *  which are unnecessary and expensive when traversing a read-only
- *  persisted image. navigation is therefore intrusive on an externally
- *  allocated node structure.
- */
-typedef struct PBSTNode PBSTNode;
-struct PBSTNode
-{
-    struct
-    {
-        const void *addr;
-        size_t size;
-
-    } data;
-
-    const void *internal;
-    uint32_t id;
-};
-
-/* PBSTNodeNext
- *  updates the structure
- *  returns next 1-based node id or 0 for NULL
- */
-KLIB_EXTERN uint32_t CC PBSTNodeNext ( PBSTNode *self );
-
-/* PBSTNodePrev
- *  updates the structure
- *  returns prev 1-based node id or 0 for NULL
- */
-KLIB_EXTERN uint32_t CC PBSTNodePrev ( PBSTNode *self );
-
-/* PBSTNodeFindNext
- *  find next element satisfying criteria
- *  fills out "n" if found
- *  returns 1-based node id or 0 for NULL
- */
-KLIB_EXTERN uint32_t CC PBSTNodeFindNext ( PBSTNode *self,
-     bool ( CC * f ) ( const PBSTNode *n ) );
-
-/* PBSTNodeFindPrev
- *  find previous element satisfying criteria
- *  fills out "n" if found
- *  returns 1-based node id or 0 for NULL
- */
-KLIB_EXTERN uint32_t CC PBSTNodeFindPrev ( PBSTNode *self,
-    bool ( CC * f ) ( const PBSTNode *n ) );
-
-
-/*--------------------------------------------------------------------------
- * PBSTree
- *  a flattened binary search tree
- *
- *  mimics read-only behavior of a BSTree
- */
-typedef struct PBSTree PBSTree;
-
-/* PBSTreeMake
- *  make a PBSTree structure
- *
- *  "mem" [ IN ] - constant memory image of persisted tree
- *  with a lifetime exceeding that of the PBSTree itself
- *
- *  "byteswap" [ IN ] - if true, the persisted image needs
- *  to be read with byteswapping
- */
-KLIB_EXTERN rc_t CC PBSTreeMake ( PBSTree **pt, const void *addr, size_t size, bool byteswap );
-
-/* PBSTreeCount
- *  returns number of elements in tree
- *  not included within the BSTree interface itself, but
- *  was included here due to the fact that it is constant
- *
- *  return value:
- *    integer value >= 0
- */
-KLIB_EXTERN uint32_t CC PBSTreeCount ( const PBSTree *self );
-
-/* PBSTreeDepth
- *  returns number of layers in tree
- *
- *  return value:
- *    integer value >= 0
- */
-KLIB_EXTERN uint32_t CC PBSTreeDepth ( const PBSTree *self );
-
-/* PBSTreeSize
- *  returns the size in bytes
- *  of the PBSTree image
- */
-KLIB_EXTERN size_t CC PBSTreeSize ( const PBSTree *self );
-
-/* PBSTreeGetNode
- *  gets a PBSTNode from an id
- *
- *  "node" [ OUT ] - return parameter for node
- *
- *  "id" [ IN ] - a 1-based integer node id
- *
- *  return values:
- *    EINVAL => an invalid parameter was passed
- *    ENOENT => id out of range
- */
-KLIB_EXTERN rc_t CC PBSTreeGetNode ( const PBSTree *self, PBSTNode *node, uint32_t id );
-
-/* PBSTreeFind
- *  find an object within tree
- *
- *  "rtn" [ OUT ] - return parameter for node if found. its value
- *  is undefined unless the function returns success.
- *
- *  "item" [ IN ] - item to be matched against a node. will be
- *  supplied as the first parameter to the comparison function.
- *
- *  "cmp" [ IN ] - function that evaluates "item" against each internal
- *  node for relative position, returning 0 for match, negative when
- *  "item" is to left of node, and positive otherwise.
- *
- *  return value:
- *    0    => not found
- *    1..n => internal id of node, also recorded within "rtn"
- */
-KLIB_EXTERN uint32_t CC PBSTreeFind ( const PBSTree *self, PBSTNode *rtn,
-    const void *item, int ( CC * cmp ) ( const void *item, const PBSTNode *n , void * data), void * data );
-
-/* PBSTreeForEach
- *  executes a function on each tree element
- *
- *  "reverse" [ IN ] - if true, traverse from last to first element,
- *  if false, traverse in the normal forward direction.
- *
- *  "f" [ IN ] and "data" [ IN ] - callback function for evaluating each
- *  node within the tree. the passed out node structure is itself fully
- *  modifiable.
- */
-KLIB_EXTERN void CC PBSTreeForEach ( const PBSTree *self, bool reverse,
-    void ( CC * f ) ( PBSTNode *n, void *data ), void *data );
-
-/* PBSTreeDoUntil
- *  executes a function on each element
- *  until the function returns true
- *
- *  "reverse" [ IN ] - if true, traverse from last to first element,
- *  if false, traverse in the normal forward direction.
- *
- *  "f" [ IN ] and "data" [ IN ] - callback function for evaluating each
- *  node within the tree. the passed out node structure is itself fully
- *  modifiable. the function returns "true" to halt iteration.
- *
- *  return values:
- *    the last value returned by "f" or false if never invoked
- */
-KLIB_EXTERN bool CC PBSTreeDoUntil ( const PBSTree *self, bool reverse,
-    bool ( CC * f ) ( PBSTNode *n, void *data ), void *data );
-
-/* PBSTreeWhack
- *  whacks PBSTree object
- *  the constant memory image used to create the PBSTree may now be released
- */
-KLIB_EXTERN void CC PBSTreeWhack ( PBSTree *self );
-
-
-
-/*--------------------------------------------------------------------------
- * persistence functions
- */
-
-/* PTWriteFunc
- *  a generic streaming function
- */
-typedef rc_t ( CC * PTWriteFunc )
-    ( void *param, const void *buffer, size_t bytes, size_t *num_writ );
-
-/* PTAuxFunc
- *  a function to measure or write auxiliary node data
- *  where "node" is a BSTNode or TTNode.
- *
- *  when "write" is NULL, the number of bytes that would
- *  be written is returned in "num_writ".
- */
-typedef rc_t ( CC * PTAuxFunc )
-    ( void *param, const void *node, size_t *num_writ,
-      PTWriteFunc write, void *write_param );
-
-
-/*--------------------------------------------------------------------------
- * BSTree
- */
-
-/* BSTreePersist
- *  write a binary search tree to some storage location
- *
- *  the tree is persisted by making between one and three passes
- *  over its nodes, see description of "write" parameter.
- *
- *  the first pass examines internal tree structure and invokes
- *  a user-supplied function to determine overall size.
- *
- *  the second pass persists the internal structure in a packed
- *  format, using the user-supplied generic "write" function.
- *
- *  the third pass invokes another user-supplied function to write
- *  auxiliary node data to output.
- *
- *  "num_writ" [ OUT, NULL OKAY ] -  returns parameter for the number
- *  of bytes written as a result of persisting the tree. this will
- *  be the actual bytes written regardless of return status.
- *
- *  "write" [ IN, NULL OKAY ]  and "write_param" [ IN ] -  a generic
- *  output streaming function used for all operations. if NULL, then
- *  the function will exit after its first pass with the number of
- *  bytes required in "num_writ".
- *
- *  "aux" [ IN ] and "aux_param" [ IN ] - a specialized function for
- *  streaming auxiliary node data to output using the supplied "write"
- *  function. it is invoked during the first pass with a NULL write
- *  function for gathering size data, and during the third pass with
- *  a non-NULL write function.
- */
-KLIB_EXTERN rc_t CC BSTreePersist ( struct BSTree const *self, size_t *num_writ,
-    PTWriteFunc write, void *write_param, PTAuxFunc aux, void *aux_param );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_klib_pbstree_ */
diff --git a/interfaces/klib/printf.h b/interfaces/klib/printf.h
deleted file mode 100644
index e56ed15..0000000
--- a/interfaces/klib/printf.h
+++ /dev/null
@@ -1,406 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_klib_printf_
-#define _h_klib_printf_
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#include <stdarg.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct String;
-struct KSymbol;
-struct KDataBuffer;
-struct KWrtHandler;
-
-
-/*--------------------------------------------------------------------------
- * FORMAT
- *  a description of the string_printf formatting
- */
-
-#define SUPPORT_PERCENT_N 1
-
-
-/*
-  The standard C library formatting approach was taken as a basis.
-
-  This interface differs in some ways, in that it presents a sub-set of
-  the std. C format convention, and then extends it for klib.
-
-  The general substitution parameter format is:
-
-    '%' [ <flags> ] [ <field-width> ] [ '.' <precision> ] [ ':' <index> ] \
-        [ <storage-class-width> ] <storage-class>
-
-  where:
-
-    flags
-        = ' '           : prepend space to a numeral if it does not have a sign
-        | '+'           : always produce a sign on numeric conversion
-        | '-'           : left-align parameter within field
-        | '0'           : left-pad with zeros rather than spaces
-        | '#'           : use "alternate" representation
-        | ','           : produce comma-separated triples
-        | '\''          :  "      "
-        ;
-
-    field-width *(1)
-        = DECIMAL       : an unsigned base-10 numeral
-        | '*'           : take field width from args as type 'uint32_t'
-        ;
-
-    precision *(1)(2)(3)
-        = DECIMAL       : an unsigned base-10 numeral
-        | '*'           : take precision from args as type 'uint32_t'
-        |               : an empty precision means 0
-        ;
-
-    index
-        = idx           : a single, zero-based vector element
-        | idx '-' idx   : a fully-closed, zero-based interval
-        | idx '/' len   : a start index plus length
-        ;
-
-    idx
-        = DECIMAL       : an unsigned base-10 numeral
-        | '*'           : take index from args as type 'uint32_t'
-        | '$'           : last vector element
-        |               : an empty index means 0 or $
-        ;
-
-    len
-        = DECIMAL       : a base-10 numeral
-        | '*'           : take length from args as type 'uint32_t'
-        | '$'           : length-of ( vector )
-        |               : an empty length means $
-        ;
-
-    storage-class-width
-        = 't'           : tiny integer ( i.e. byte )
-        | 'h'           : half the normal size
-        | 'l'           : twice the normal size
-        | 'z'           : sizeof size_t
-        | time-modifier
-        ;
-
-    time-modifier
-        = 'h'           : date only
-        | 'l'           : date and time
-        | 'z'           : date, time and zone
-        ;
-
-    scalar storage-class
-        = 'd' | 'i'     : decimal signed integer
-        | 'u'           : decimal unsigned integer
-        | 'x'           : lower-case hex integer
-        | 'X'           : upper-case hex integer
-        | 'o'           : octal integer
-        | 'b'           : binary integer
-        | 'p'           : hex void*
-        | 'f'           : double
-        | 'e'           : scientific notation double
-        | 'g'           : general double
-        | 'c'           : UTF-32 character
-        | 'N'           : const KSymbol* [ <klib/symbol.h> ]
-        | 'V' *(2)      : tri-part version [ ver_t ]
-        | 'R'           : return code [ rc_t ]
-        | 'T'           : const KTime*  [ <klib/time.h> ]
-        | '!'           ; operating specific error code ( i.e. errno or GetLastError() )
-        | 'n' *(5)      ; output of number of characters printed so far to uint32_t*
-        ;
-
-    single-index vector storage-class *(6)(7)
-        = 'd' | 'i'     : as above
-        | 'u' | 'x'     : index range is ignored
-        | 'X' | 'o'     : start index is used
-        | 'b' | 'p'     : to select element
-        | 'f' | 'e' | 'g'
-        | 'N'           : const KSymbol* [ <klib/symbol.h> ]
-        | 'V' *(2)      : tri-part version [ ver_t ]
-        | 'R'           : return code [ rc_t ]
-        | 'T'           : const KTime*  [ <klib/time.h> ]
-        ;
-
-    index-range vector storage-class *(8)
-        = 'c' *(9)      : unbounded character vector
-        | 's' | 'S'     : bounded character vector
-        ;
-
-  Notes:
-     1. field-width and precision measure characters, not bytes
-     2. for version numbers, precision gives the number of fields,
-        where 1 = major, 2 = major.minor and 3 = major.minor.release.
-     3. in the absence of precision, versions are written with the
-        minimum number of fields required.
-     4. the storage-class-width is interpreted differently for storage-class
-        'T' ( const KTime* )
-     5. %n may not be supported for security purposes
-     6. when an index is specified, the argument is taken as an
-        unbounded vector. if an index range is given, only the
-        starting index is used, and only a single element is selected.
-     7. the vector reference class is determined by both the format
-        and the size modifier.
-     8. an index for character classes may specify a string as the
-        selection. when missing, the default start index is 0 while
-        the default end index is $.
-     9. a character vector is NOT assumed to be NUL-terminated,
-        and in this case the default end index is the start index.
-
- */
-
-
-/* string_printf
- *  provides a facility similar to snprintf
- *  formatting is similar but differs somewhat [ see FORMAT at bottom ]
- *
- *  "dst" [ OUT ] and "bsize" [ IN ] - output buffer for string
- *  will be NUL-terminated if possible
- *
- *  "num_writ" [ OUT, NULL OKAY ] - returns the number of non-NUL bytes
- *  written to "dst" or the required "bsize" to complete successfully,
- *  not including the NUL termination.
- *
- *  "fmt" [ IN ] and "args" [ IN, OPTIONAL ] - data to write
- *
- *  returns 0 if all bytes were successfully written and a NUL-byte was
- *  written into the buffer.
- *
- *  returns rcBuffer, rcInsufficient if the buffer was too small. in this
- *  case, it is possible that the only missing byte would be the NUL
- *  termination, and the output string may still be usable since "num_writ"
- *  indicates the actual number of text bytes.
- */
-KLIB_EXTERN rc_t CC string_printf ( char *dst, size_t bsize,
-    size_t *num_writ, const char *fmt, ... );
-KLIB_EXTERN rc_t CC string_vprintf ( char *dst, size_t bsize,
-    size_t *num_writ, const char *fmt, va_list args );
-
-
-/* KDataBufferPrintf
- *  provides a facility similar to string_printf
- *  except that it appends into a KDataBuffer
- *
- *  "buf" [ IN ] - previously initialized buffer
- *  MUST be initialized, or results are unpredictable
- *  ( except for the prediction that all will fail )
- */
-KLIB_EXTERN rc_t CC KDataBufferPrintf ( struct KDataBuffer * buf,
-    const char * fmt, ... );
-KLIB_EXTERN rc_t CC KDataBufferVPrintf ( struct KDataBuffer * buf,
-    const char * fmt, va_list args );
-
-
-/*--------------------------------------------------------------------------
- * structured_printf
- *  the engine behind string_printf
- */
-
-/* formatting
- */
-enum
-{
-    spfNone,                                    /* 'n', sptTerm                       */
-    spfText,                                    /* 'csS', literal                     */
-    spfSignedInt,                               /* 'di'                               */
-    spfUnsigned,                                /* 'bouxX'                            */
-    spfStdFloat,                                /* 'f'                                */
-    spfGenFloat,                                /* 'g'                                */
-    spfSciFloat,                                /* 'e'                                */
-    spfVersion,                                 /* 'V'                                */
-    spfSymbol,                                  /* 'N'                                */
-    spfTime,                                    /* [ 'hlz' + ] 'T'                    */
-    spfRC,                                      /* 'R'                                */
-    spfOSErr                                    /* '!'                                */
-};
-
-/* types
- */
-enum
-{
-    sptTerm,                                    /* terminates format                  */
-    sptLiteral,                                 /* char literal        - arg in fmt   */
-    sptSignedInt,                               /* signed scalar int   - arg is d     */
-    sptSignedInt8Vect,                          /* signed vector int   - arg is d8    */
-    sptSignedInt16Vect,                         /* signed vector int   - arg is d16   */
-    sptSignedInt32Vect,                         /* signed vector int   - arg is d32   */
-    sptSignedInt64Vect,                         /* signed vector int   - arg is d64   */
-    sptUnsignedInt,                             /* unsigned scalar int - arg is u     */
-    sptUnsignedInt8Vect,                        /* unsigned vector int - arg is u8    */
-    sptUnsignedInt16Vect,                       /* unsigned vector int - arg is u16   */
-    sptUnsignedInt32Vect,                       /* unsigned vector int - arg is u32   */
-    sptUnsignedInt64Vect,                       /* unsigned vector int - arg is u64   */
-    sptFloat,                                   /* scalar float        - arg is f     */
-    sptFloat32Vect,                             /* vector float        - arg is f32   */
-    sptFloat64Vect,                             /* vector float        - arg is f64   */
-    sptFloatLongVect,                           /* vector float        - arg is flong */
-    sptChar,                                    /* scalar character    - arg is c     */
-    sptNulTermString,                           /* vector character    - arg is s     */
-    sptString,                                  /* vector character    - arg is S     */
-    sptUCS2String,                              /* vector character    - arg is S     */
-    sptUTF32String,                             /* vector character    - arg is S     */
-    sptPointer,                                 /* object reference    - arg is p     */
-    sptRowId,                                   /* current row id      - arg is d     */
-    sptRowLen                                   /* current row length  - arg is u     */
-#if SUPPORT_PERCENT_N
-    , sptBytesPrinted                           /* output parameter    - arg is n     */
-#endif
-};
-
-
-/* format
- *  structured and constant format information
- *  takes the place of format string
- *  flags indicate whether fields are active
- *  and in some cases whether the value is external, in the next arg
- */
-typedef struct PrintFmt PrintFmt;
-struct PrintFmt
-{
-    union
-    {
-        struct
-        {
-            uint64_t min_field_width;           /* minimum field width in characters  */
-            uint64_t precision;                 /* precision in characters            */
-            uint64_t start_idx;                 /* zero-based starting vector index   */
-            uint64_t select_len;                /* length of selection or 0 for inf   */
-        } f;
-        struct
-        {
-            const char *text;                   /* string literal text pointer        */
-            size_t size;                        /* string literal text size           */
-        } l;
-    } u;
-    unsigned int upper_case_num       : 1;      /* upper-case numerals                */
-    unsigned int reverse_alnum        : 1;      /* reverse ordering of alpha-numeric  */
-    unsigned int thousands_separate   : 1;      /* separate numerals by thousands     */
-    unsigned int ext_field_width      : 1;      /* field width is external argument   */
-    unsigned int ext_precision        : 1;      /* precision is external argument     */
-    unsigned int inf_start_index      : 1;      /* start index is last in vector      */
-    unsigned int ext_start_index      : 1;      /* start index is external argument   */
-    unsigned int inf_stop_index       : 1;      /* stop index is last in vector       */
-    unsigned int ext_stop_index       : 1;      /* stop index is an external argument */
-    unsigned int ext_select_len       : 1;      /* selection length is external       */
-    unsigned int add_prefix           : 1;      /* '#' flag on 'boxX'                 */
-    unsigned int force_decimal_point  : 1;      /* '#' flag on 'efg'                  */
-    unsigned int leave_trailing_zeros : 1;      /* '#' flag on 'g'                    */
-    unsigned int print_time           : 1;
-    unsigned int print_date           : 1;
-    unsigned int print_weekday        : 1;
-    unsigned int print_timezone       : 1;
-    unsigned int hour_24              : 1;
-    unsigned int min_vers_components  : 1;
-    unsigned int explain_rc           : 1;
-    unsigned int type_cast            : 1;      /* if true, convert type for fmt      */
-    unsigned int pointer_arg          : 1;      /* argument is a pointer              */
-    uint32_t radix;                             /* 0 default, 2, 8, 10, 16, .. 36     */
-    uint8_t fmt;                                /* spf... from above                  */
-    uint8_t type;                               /* spt... from above                  */
-    char sign;                                  /* 0, ' ' or '+'                      */
-    char left_fill;                             /* 0 for left-align, ' ' or '0'       */
-};
-
-
-/* argument
- *  union of argument values
- *  passed as an array, much like va_arg
- */
-typedef union PrintArg PrintArg;
-union PrintArg
-{
-    int64_t d;                                  /* signed integer scalar              */
-    const int8_t *d8;                           /* signed integer vectors             */
-    const int16_t *d16;
-    const int32_t *d32;
-    const int64_t *d64;
-
-    uint64_t u;                                 /* unsigned integer scalar            */
-    const uint8_t *u8;                          /* unsigned integer vectors           */
-    const uint16_t *u16;
-    const uint32_t *u32;
-    const uint64_t *u64;
-
-    double f;                                   /* floating point scalar              */
-    const float *f32;                           /* floating point vectors             */
-    const double *f64;
-    const long double *flong;
-
-    uint32_t c;                                 /* character scalar                   */
-    const char *s;                              /* NUL-terminated char vector         */
-    struct String const *S;                     /* character vector                   */
-
-    const void *p;                              /* object reference                   */
-
-#if SUPPORT_PERCENT_N
-    uint32_t *n;                                /* output parameter                   */
-#endif
-};
-
-
-/* structured_printf
- *  uses constant format descriptors and argument block
- *  prints to "out" handler
- */
-KLIB_EXTERN rc_t CC structured_printf ( struct KWrtHandler const *out,
-    size_t *num_writ, const PrintFmt *fmt, const PrintArg *args );
-
-
-/* structured_sprintf
- *  uses constant format descriptors and argument block
- *  prints to UTF-8 character buffer "dst"
- */
-KLIB_EXTERN rc_t CC structured_sprintf ( char *dst, size_t bsize,
-    size_t *num_writ, const PrintFmt *fmt, const PrintArg *args );
-
-
-/* TEMPORARY */
-KLIB_EXTERN rc_t CC new_string_printf ( char *dst, size_t bsize,
-    size_t *num_writ, const char *fmt, ... );
-KLIB_EXTERN rc_t CC new_string_vprintf ( char *dst, size_t bsize,
-    size_t *num_writ, const char *fmt, va_list args );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_klib_printf_ */
diff --git a/interfaces/klib/ptrie.h b/interfaces/klib/ptrie.h
deleted file mode 100644
index d19e29f..0000000
--- a/interfaces/klib/ptrie.h
+++ /dev/null
@@ -1,296 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_klib_ptrie_
-#define _h_klib_ptrie_
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#ifndef _h_klib_pbstree_
-#include <klib/pbstree.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct Trie;
-struct String;
-
-
-/*--------------------------------------------------------------------------
- * PTNode
- *  a node within text tree
- *
- *  a Trie will contain TNodes, which themselves are intrusive but
- *  irrelevant internal tree links plus a key string plus an externally
- *  defined data structure, representing a value, and supporting multiple
- *  nodes per key. the internal links permit navigation from node
- *  to node that is not possible with the PTNode. furthermore, they
- *  provide direct access to the key string that is not normally stored
- *  verbatim within a persisted image.
- *
- *  a PTrie does not contain structured nodes, but stores linkage
- *  and ordering information separately from the externally defined
- *  data, and rather than using pointers, assigns integer ids to the
- *  nodes themselves. navigation by pointers would require allocations,
- *  which are unnecessary and expensive when traversing a read-only
- *  persisted image. navigation is therefore intrusive on an externally
- *  allocated node structure.
- */
-typedef struct PTNode PTNode;
-struct PTNode
-{
-    /* minimally value data
-       may also contain key string information,
-       either by reference or literal text */
-    struct
-    {
-        const void *addr;
-        size_t size;
-
-    } data;
-
-    /* used internally */
-    const void *internal;
-    uint32_t id;
-};
-
-/* MakeKey
- *  tries to make a key string from node
- *  will fail if key text was not embedded into image when created
- *
- *  "key" [ OUT ] - return parameter for a key string allocation
- *  that must be whacked with StringWhack when no longer needed.
- */
-KLIB_EXTERN rc_t CC PTNodeMakeKey ( const PTNode *self, struct String const **key );
-
-
-/*--------------------------------------------------------------------------
- * PTrie
- *  a persisted tree of text nodes
- *
- *  this is a collection of { key, value } pairs, where a many-value
- *  to one key paradigm is naturally supported, as in the b-tree.
- *
- *  the desired retrieval operations are:
- *   a) key -> id : value
- *   b) key -> { id : value, ... }
- *   c) RE -> id : value
- *   d) RE -> { id : value, ... }
- *   e) iteration across { id : value, ... }
- *   f) id : value -> key
- *
- *  the reverse retrieval operation is:
- *   a) id -> value
- *
- *  indexing of the id is performed externally, and should not be interpreted
- *  as a serial, integer value. it may be a byte offset or a combination of
- *  two integer values, as well as anything else.
- */
-typedef struct PTrie PTrie;
-
-/* Make
- *  make a persisted tree structure
- * MakeOrig - DEPRECATED
- *  includes code to handle original composite node encoding
- *
- *  "addr" [ IN ] and "size" [ IN ] - constant memory image of
- *  persisted text tree with a lifetime exceeding that of the
- *  PTrie itself
- *
- *  "byteswap" [ IN ] - true if persisted image must be byteswapped
- */
-KLIB_EXTERN rc_t CC PTrieMake ( PTrie **tt,
-    const void *addr, size_t size, bool byteswap );
-KLIB_EXTERN rc_t CC PTrieMakeOrig ( PTrie **tt,
-    const void *addr, size_t size, bool byteswap );
-
-/* Count
- *  returns number of { id : value } pairs in text tree
- *  not included within the Trie interface itself, but
- *  was included here due to the fact that it is constant
- *
- *  return value:
- *    integer value >= 0
- */
-KLIB_EXTERN uint32_t CC PTrieCount ( const PTrie *self );
-
-/* Size
- *  returns the size in bytes
- *  of the PTrie image
- */
-KLIB_EXTERN size_t CC PTrieSize ( const PTrie *self );
-
-/* GetNode
- *  gets a PTNode from an id
- *
- *  "node" [ OUT ] - return parameter for node
- *
- *  "id" [ IN ] - a 1-based integer node id
- *
- *  return values:
- *    EINVAL => an invalid parameter was passed
- *    ENOENT => id out of range
- */
-KLIB_EXTERN rc_t CC PTrieGetNode ( const PTrie *self, PTNode *node, uint32_t id );
-
-/* Find
- * PTrieFindRE
- *  find a single { id, value } pair  within tree
- *
- *  "key" [ IN ] - an exact match text string
- *
- *  "re" [ IN ] - a regular expression string
- *
- *  "rtn" [ OUT ] - return parameter for node if found.
- *  its value is undefined unless the function returns success.
- *
- *  "custom_cmp" [ IN, NULL OKAY ] and "data" [ OPAQUE ] - optional
- *  comparison function
- *
- *  return value:
- *    0    => not found
- *    1..n => id of found pair
- */
-KLIB_EXTERN uint32_t CC PTrieFind ( const PTrie *self, struct String const *key, PTNode *rtn,
-    int ( CC * custom_cmp ) ( const void *item, const PBSTNode *n ,void *data), void * data );
-
-#if 0
-KLIB_EXTERN uint32_t CC PTrieFindRE ( const PTrie *self, struct String const *re, PTNode *rtn );
-#endif
-
-/* FindAll
- * PTrieFindAllRE
- *  find multiple objects within tree
- *
- *  "key" [ IN ] - an exact match text string
- *
- *  "re" [ IN ] - a regular expression string
- *
- *  "buffer" [ OUT ] and "capacity" [ IN ] - a user-supplied
- *  array of PTNode with a capacity of "capacity" elements.
- *  if successful, the entire found set will be returned unordered within.
- *
- *  "num_found" [ OUT ] - indicates the size of the found set,
- *  regardless of return value, such that if the supplied
- *  buffer were to be too small, the required size is returned.
- *
- *  "custom_cmp" [ IN, NULL OKAY ] and "data" [ OPAQUE ] - optional
- *  comparison function
- *
- *  returns status codes:
- *    EINVAL  => an invalid parameter
- *    ENOENT  => the found set was empty
- *    ENOBUFS => the found set was too large
- */
-#if 0
-KLIB_EXTERN rc_t CC PTrieFindAll ( const PTrie *self, struct String const *key,
-    PTNode buffer [], uint32_t capacity, uint32_t *num_found,
-    int ( CC * custom_cmp ) ( const void *item, const PBSTNode *n, void *data ), void *data );
-KLIB_EXTERN rc_t CC PTrieFindAllRE ( const PTrie *self, struct String const *re,
-    PTNode buffer [], uint32_t capacity, uint32_t *num_found );
-#endif
-
-/* ForEach
- *  executes a function on each tree element
- *
- *  "f" [ IN ] and "data" [ IN ] - iteration callback function for
- *  examining each TNode in the tree
- */
-KLIB_EXTERN void CC PTrieForEach ( const PTrie *self,
-    void ( CC * f ) ( PTNode *n, void *data ), void *data );
-
-/* DoUntil
- *  executes a function on each tree element
- *  until the function returns true
- *
- *  "f" [ IN ] and "data" [ IN ] - iteration callback function for
- *  examining each TNode in the tree. the function returns "true"
- *  to halt iteration.
- *
- *  return values:
- *    the last value returned by "f" or false if never invoked
- */
-KLIB_EXTERN bool CC PTrieDoUntil ( const PTrie *self,
-    bool ( CC * f ) ( PTNode *n, void *data ), void *data );
-
-/* Whack
- *  tears down internal structure
- */
-KLIB_EXTERN void CC PTrieWhack ( PTrie *self );
-
-
-/*--------------------------------------------------------------------------
- * Trie
- */
-
-/* Persist
- *  much like BSTreePersist but operates on a Trie
- *
- *  "num_writ" [ OUT, NULL OKAY ] -  returns parameter for the number
- *  of bytes written as a result of persisting the b-tree. this will
- *  be the actual bytes written regardless of return status.
- *
- *  "ext_keys" [ IN ] - if true, does not store key data internally.
- *  key text gets encoded into the tree structure in all cases. when
- *  stored internally, any key text not represented by the tree will
- *  be explicitly written by this function. otherwise, the caller will
- *  be expected to store the text as desired. while internal storage
- *  will probably be more efficient, it will cause this function to
- *  fail if the Trie was built with ambiguous key transitions, i.e.
- *  if initialized with "cs_expand" false and keys were added having
- *  characters not included within the "accept" character set. this
- *  is because the tree channels all unrecognized characters through
- *  a single code, making their recovery impossible without being
- *  stored externally.
- *
- *  "write" [ IN, NULL OKAY ] and "write_param" [ IN ] -  a generic
- *  output streaming function used for all operations. if NULL, then
- *  the function will exit after its first pass with the number of
- *  bytes required in "num_writ".
- *
- *  "aux" [ IN ] and "aux_param" [ IN ] - a specialized function for
- *  streaming auxiliary node data to output using the supplied "write"
- *  function. it is invoked during the first pass with a NULL write
- *  function for gathering size data, and during the third pass with
- *  a non-NULL write function.
- */
-KLIB_EXTERN rc_t CC TriePersist ( struct Trie const *self, size_t *num_writ, bool ext_keys,
-    PTWriteFunc write, void *write_param, PTAuxFunc aux, void *aux_param );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_klib_ptrie_ */
diff --git a/interfaces/klib/rc.h b/interfaces/klib/rc.h
deleted file mode 100644
index 08236ec..0000000
--- a/interfaces/klib/rc.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_klib_rc_
-#define _h_klib_rc_
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#if _DEBUGGING
-
-#ifndef _h_compiler_
-#include <compiler.h>
-#endif
-
-#include <assert.h>
-#endif
-
-
-/*--------------------------------------------------------------------------
- * RC
- *  upon success, all functions will return code 0
- *  other codes indicate failure or additional status information
- */
-
-#if _DEBUGGING && ! defined RECORD_RC_FILE_LINE
-#define RECORD_RC_FILE_LINE 1
-#elif ! defined RECORD_RC_FILE_LINE
-#define RECORD_RC_FILE_LINE 0
-#endif
-
-/* actual code declarations are in <kfc/rc.h> */
-#include <kfc/rc.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if RC_EMIT
-
-KLIB_EXTERN const char * CC GetRCFilename ( void );
-KLIB_EXTERN const char * CC GetRCFunction ( void );
-KLIB_EXTERN uint32_t CC GetRCLineno ( void );
-KLIB_EXTERN rc_t CC SetRCFileFuncLine ( rc_t rc, const char *filename, const char *funcname, uint32_t lineno );
-KLIB_EXTERN bool CC GetUnreadRCInfo ( rc_t *rc, const char **filename, const char **funcname, uint32_t *lineno );
-
-#if RECORD_RC_FILE_LINE
-
-    #if defined(__SUNPRO_CC)  &&  __SUNPRO_CC <= 0x590  &&  defined(__cplusplus)
-    
-        #define SET_RC_FILE_FUNC_LINE( rc ) \
-            SetRCFileFuncLine ( ( rc ), __FILE__, "(unknown)", __LINE__ )
-    
-    #else
-    
-        #define SET_RC_FILE_FUNC_LINE( rc ) \
-            SetRCFileFuncLine ( ( rc ), __FILE__, __func__, __LINE__ )
-    
-    #endif
-
-#else
-
-    #define SET_RC_FILE_FUNC_LINE( rc ) \
-        ( rc_t ) ( rc )
-
-#endif
-
-#ifdef assert
-#define ASSERT_MOD_TARG_CTX() \
-    assert ( ( int ) rcLastModule_v1_1  < ( 1 << 5 ) ), \
-    assert ( ( int ) rcLastTarget_v1_1  < ( 1 << 6 ) ), \
-    assert ( ( int ) rcLastContext_v1_1  < ( 1 << 7 ) )
-
-#define ASSERT_OBJ_STATE() \
-    assert ( ( int ) rcLastObject_v1_1  < ( 1 << 8 ) ), \
-    assert ( ( int ) rcLastState_v1_1  < ( 1 << 6 ) )
-#else
-#define ASSERT_MOD_TARG_CTX() ( void ) 0
-
-#define ASSERT_OBJ_STATE() ( void ) 0
-#endif
-
-/* CTX
- *  form a context from parts
- */
-#define CTX( mod, targ, ctx )                                \
-    ( rc_t ) ( ASSERT_MOD_TARG_CTX (),                       \
-               RAW_CTX ( mod, targ, ctx ) )
-
-/* RC
- *  form a complete return code from parts
- */
-#define SILENT_RC( mod, targ, ctx, obj, state )              \
-    ( rc_t ) ( ASSERT_OBJ_STATE (),                          \
-        CTX ( mod, targ, ctx )    | /* 18 bits */            \
-        ( ( rc_t ) ( obj ) << 6 ) | /*  8 bits */            \
-        ( ( rc_t ) ( state ) ) )    /*  6 bits */
-
-#define RC( mod, targ, ctx, obj, state )                     \
-    ( rc_t ) ( ASSERT_OBJ_STATE (),                          \
-    SET_RC_FILE_FUNC_LINE (                                  \
-        CTX ( mod, targ, ctx )    | /* 18 bits */            \
-        ( ( rc_t ) ( obj ) << 6 ) | /*  8 bits */            \
-        ( ( rc_t ) ( state ) ) ) )  /*  6 bits */
-
-/* ResetRCContext
- *  rewrite rc to reflect different context
- *  typically used to pass out return codes
- */
-#define ResetRCContext( rc, mod, targ, ctx ) \
-    ( ( ( rc ) & 0x3FFF ) | CTX ( mod, targ, ctx ) )
-
-/* ResetRCState
- *  rewrite rc to reflect different state
- *  typically used to pass out return codes
- */
-#define ResetRCState( rc, obj, state ) \
-    ( ( ( rc ) & 0xFFFFFFC0 ) | ( rc_t ) ( state ) )
-
-#endif /* __cplusplus */
-
-/* GetRCModule
- *  extract the module portion
- */
-#define GetRCModule( rc ) \
-    ( enum RCModule ) ( ( ( rc ) >> 27 ) & 0x1F )
-
-/* GetRCTarget
- *  extract the target portion
- */
-#define GetRCTarget( rc ) \
-    ( enum RCTarget ) ( ( ( rc ) >> 21 ) & 0x3F )
-
-/* GetRCContext
- *  extract the context portion
- */
-#define GetRCContext( rc ) \
-    ( enum RCContext ) ( ( ( rc ) >> 14 ) & 0x7F )
-
-/* GetRCObject
- *  extract the target object portion
- */
-#define GetRCObject( rc ) \
-    ( enum RCObject ) ( ( ( rc ) >> 6 ) & 0xFF )
-
-/* GetRCState
- *  extract the state portion
- */
-#define GetRCState( rc ) \
-    ( enum RCState ) ( ( rc ) & 0x3F )
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*  _h_klib_rc_ */
diff --git a/interfaces/klib/refcount.h b/interfaces/klib/refcount.h
deleted file mode 100644
index 9db3bd9..0000000
--- a/interfaces/klib/refcount.h
+++ /dev/null
@@ -1,264 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_klib_refcount_
-#define _h_klib_refcount_
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#ifndef _h_atomic32_
-#include <atomic32.h>
-#endif
-
-#ifndef FORCE_TRACK_REFERENCES
-#define FORCE_TRACK_REFERENCES 0
-#endif
-
-/* normally turned off */
-#if FORCE_TRACK_REFERENCES
-#undef TRACK_REFERENCES
-#define TRACK_REFERENCES 1
-#elif ! defined TRACK_REFERENCES
-#define TRACK_REFERENCES 0
-#endif
-
-/* normally turned on */
-#ifndef INLINE_REFCOUNT
-#define INLINE_REFCOUNT 0
-#endif
-
-/* include logging interface */
-#if TRACK_REFERENCES
-
-#include <klib/debug.h>
-
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KRefcount
- *  signed 32-bit reference counter
- * KDualRef
- *  dual signed/unsigned 16-bit reference counter
- */
-typedef atomic32_t KRefcount;
-typedef atomic32_t KDualRef;
-
-
-/* Actions
- *  enum of action indicators
- */
-enum KRefcountActions
-{
-    krefOkay,      /* no action needs to be taken           */
-    krefWhack,     /* total refcount zero crossing detected */
-    krefZero,      /* owned or dep reference zero crossing  */
-    krefLimit,     /* modification exceeds limits           */
-    krefNegative   /* negative prior or resulting count     */
-};
-
-
-/* Init
- *  initialize a refcount object
- *
- *  "refcount" [ IN/OUT ] - pointer to object being initialized
- *
- *  "value" [ IN ] - initial refcount value
- *    -OR-
- *  "owned" [ IN ] and "dep" [ IN ] - owned and dependent counts
- *  function will return krefLimit if counts exceed limits
- *
- *  "clsname" [ IN ] - NUL-terminated string stating classname
- *  of object instance being initialized.
- *
- *  "op" [ IN ] - NUL-terminated string stating construction operation
- *
- *  "name" [ IN ] - NUL-terminated name of instance
- */
-KLIB_EXTERN void CC KRefcountInit ( KRefcount *refcount, int value,
-    const char *clsname, const char *op, const char *name );
-KLIB_EXTERN int CC KDualRefInit ( KDualRef *refcount, int owned, int dep,
-    const char *clsname, const char *op, const char *name );
-
-
-/* Whack
- *  tear down whatever was built up in object
- */
-KLIB_EXTERN void CC KRefcountWhack ( KRefcount *self, const char *clsname );
-KLIB_EXTERN void CC KDualRefWhack ( KDualRef *self, const char *clsname );
-
-
-/* Add
- *  add an owned reference
- *  returns enum value indicating action to be taken
- *
- *  inline implementation always returns krefOkay.
- *
- *  linked-in implementation may return any of the following
- *  codes, depending upon how it was compiled:
- *    krefOkay     : reference was successfully added
- *    krefZero     : reference was added, but prior value was zero
- *    krefLimit    : reference was NOT added, too many references
- *    krefNegative : reference was NOT added, prior value was negative
- */
-KLIB_EXTERN int CC KRefcountAdd ( const KRefcount *self, const char *clsname );
-KLIB_EXTERN int CC KDualRefAdd ( const KDualRef *self, const char *clsname );
-
-
-/* Drop
- *  drop an owned reference
- *  returns enum value indicating action to be taken
- *
- *  inline implementation returns:
- *    krefOkay     : reference was successfully dropped
- *    krefWhack    : all references are gone and object can be collected
- *
- *  linked-in implementation may return any of the following
- *  codes, depending upon how it was compiled:
- *    krefOkay     : reference was successfully dropped
- *    krefWhack    : all references are gone and object can be collected
- *    krefZero     : reference was dropped, and no further owned refernces exist
- *    krefNegative : reference was NOT dropped, as resultant count would be negative
- */
-KLIB_EXTERN int CC KRefcountDrop ( const KRefcount *self, const char *clsname );
-KLIB_EXTERN int CC KDualRefDrop ( const KDualRef *self, const char *clsname );
-
-
-/* AddDep
- *  adds a dependency reference
- *  returns enum value indicating action to be taken
- *
- *  inline implementation always returns krefOkay.
- *
- *  linked-in implementation may return any of the following
- *  codes, depending upon how it was compiled:
- *    krefOkay     : reference was successfully added
- *    krefZero     : reference was added, but prior value was zero
- *    krefLimit    : reference was NOT added, too many references
- *    krefNegative : reference was NOT added, prior value was negative
- */
-KLIB_EXTERN int CC KRefcountAddDep ( const KRefcount *self, const char *clsname );
-KLIB_EXTERN int CC KDualRefAddDep ( const KDualRef *self, const char *clsname );
-
-
-/* DropDep
- *  drop a dependency reference
- *  returns enum value indicating action to be taken
- *
- *  inline implementation returns:
- *    krefOkay     : reference was successfully dropped
- *    krefWhack    : all references are gone and object can be collected
- *
- *  linked-in implementation may return any of the following
- *  codes, depending upon how it was compiled:
- *    krefOkay     : reference was successfully dropped
- *    krefWhack    : all references are gone and object can be collected
- *    krefZero     : reference was dropped, and no further dependent refernces exist
- *    krefNegative : reference was NOT dropped, as resultant count would be negative
- */
-KLIB_EXTERN int CC KRefcountDropDep ( const KRefcount *self, const char *clsname );
-KLIB_EXTERN int CC KDualRefDropDep ( const KDualRef *self, const char *clsname );
-
-
-
-/*--------------------------------------------------------------------------
- * KRefcount inline implementation
- */
-
-#if INLINE_REFCOUNT
-
-#define KRefcountInit( refcount, value, clsname, op, name ) \
-    ( REFNEW_COMMA ( clsname, op, name, refcount, value ) \
-      atomic32_set ( refcount, value ) )
-#define KRefcountWhack( self, clsname ) \
-    REFMSG ( clsname, "whack", self )
-#define KRefcountAdd( self, clsname ) \
-    ( REFMSG_COMMA ( clsname, "addref", self ) \
-      ( atomic32_read ( self ) < 0 ) ? krefNegative : \
-      ( atomic32_inc ( ( KRefcount* ) ( self ) ), krefOkay ) )
-#define KRefcountDrop( self, clsname ) \
-    ( REFMSG_COMMA ( clsname, "release", self ) \
-      ( atomic32_read ( self ) <= 0 ) ? krefNegative : \
-      ( atomic32_dec_and_test ( ( KRefcount* ) ( self ) ) ? krefWhack : krefOkay ) )
-#define KRefcountAddDep( self, clsname ) \
-    ( REFMSG_COMMA ( clsname, "attach", self ) \
-      ( atomic32_read ( self ) < 0 ) ? krefNegative : \
-      ( atomic32_inc ( ( KRefcount* ) ( self ) ), krefOkay ) )
-#define KRefcountDropDep( self, clsname ) \
-    ( REFMSG_COMMA ( clsname, "sever", self ) \
-      ( atomic32_read ( self ) <= 0 ) ? krefNegative : \
-      ( atomic32_dec_and_test ( ( KRefcount* ) ( self ) ) ? krefWhack : krefOkay ) )
-
-#endif
-
-
-#if TRACK_REFERENCES
-
-#ifndef REFMOD
-#define REFMOD DBG_REF
-#endif
-
-#ifndef REFCOND
-#define REFCOND DBG_REF_ANY
-#endif
-
-#define REFNEW( clsname, op, name, instance, refcount )                 \
-    DBGMSG ( REFMOD, REFCOND, ( "created %s, operation %s, name '%s', " \
-                                "instance 0x%zX: initial refcount %d\n",  \
-                                clsname, op, name, instance, refcount ))
-#define CNTMSG( clsname, op, instance, refcount )                       \
-    DBGMSG ( REFMOD, REFCOND, ( "about to %s instance 0x%zX: prior refcount = %d for %s\n", \
-                                op, instance, refcount, clsname ))
-#define REFMSG( clsname, op, instance ) \
-    CNTMSG ( clsname, op, instance, atomic32_read ( instance ) )
-#define REFNEW_COMMA( clsname, op, name, instance, refcount ) \
-    REFNEW ( clsname, op, name, instance, refcount ),
-#define REFMSG_COMMA( clsname, op, instance ) \
-    REFMSG ( clsname, op, instance ),
-#else
-
-#define REFNEW( clsname, op, name, instance, refcount ) \
-    ( void ) 0
-#define CNTMSG( clsname, op, instance, refcount ) \
-    ( void ) 0
-#define REFMSG( clsname, op, instance ) \
-    ( void ) 0
-#define REFNEW_COMMA( clsname, op, name, instance, refcount )
-#define REFMSG_COMMA( clsname, op, instance )
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_klib_refcount_ */
diff --git a/interfaces/klib/report.h b/interfaces/klib/report.h
deleted file mode 100644
index 4f00232..0000000
--- a/interfaces/klib/report.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_klib_report_
-#define _h_klib_report_
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * An unrecoverable error happened.
- * We can help to solve it
- * by reporting information about known application execution environment.
- */
-
-
-/* Init
- *  initialize with common information
- *
- *  "argc" [ IN ] and "argv" [ IN ] - intact command line
- *
- *  "tool_version" [ IN ] - version of tool
- */
-KLIB_EXTERN void CC ReportInit ( int argc, char *argv [],
-    ver_t tool_version );
-
-
-/* BuildDate
- *  set the build date of the tool
- *
- *  "date" [ IN ] - pre-processor __DATE__
- */
-KLIB_EXTERN void CC ReportBuildDate ( const char *date );
-
-
-/* Silence
- *  tell report to be silent at exit
- *  useful especially in response to ^C
- */
-KLIB_EXTERN void CC ReportSilence ( void );
-
-
-/* Finalize
- *  perform cleanup
- *  optionally report error condition
- *
- *  "rc" [ IN ] - report environment information if not zero
- */
-KLIB_EXTERN rc_t CC ReportFinalize ( rc_t rc );
-
-/* ForceFinalize
- *  Finalize forcing report generation to stdout
- */
-KLIB_EXTERN rc_t CC ReportForceFinalize ( void );
-
-
-/* ResetObject
- *  Resets the name of the current object beeing processes(path or accession),
- *  usually from command line.
- *  Should be called each time
- *  when starting next command line argument processing.
- */
-KLIB_EXTERN rc_t CC ReportResetObject ( const char *path );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_klib_report_ */
diff --git a/interfaces/klib/sort.h b/interfaces/klib/sort.h
deleted file mode 100644
index 4adf75a..0000000
--- a/interfaces/klib/sort.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_klib_sort_
-#define _h_klib_sort_
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifndef _h_klib_ksort_macro_
-#include <klib/ksort-macro.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * ksort
- *  qsort with a function data pointer
- */
-KLIB_EXTERN void CC ksort ( void *pbase, size_t total_elems, size_t size,
-    int ( CC * cmp ) ( const void*, const void*, void *data ), void *data );
-
-
-/* various custom ksort operations
- *  structures will generally want their own functions
- *  these fundamental types can be standardized
- */
-KLIB_EXTERN void CC ksort_int32_t ( int32_t *pbase, size_t total_elems );
-KLIB_EXTERN void CC ksort_uint32_t ( uint32_t *pbase, size_t total_elems );
-KLIB_EXTERN void CC ksort_int64_t ( int64_t *pbase, size_t total_elems );
-KLIB_EXTERN void CC ksort_uint64_t ( uint64_t *pbase, size_t total_elems );
-
-
-/* KSORT
- *  macro ( see <klib/ksort-macro.h> )
- *  allows creation of a custom qsort with inlined compare and swap
- *  MUCH faster than normal qsort or ksort.
- *
- *  basically you need to define a macro CMP() and another SWAP(),
- *  and the KSORT macro will fill in the rest.
- *
- *  CMP() needs to evaluate to a signed 32-bit integer.
- *  THIS WILL CHANGE TO BECOME LESS_THAN( a, b ).
- *
- *  SWAP() will generally be a custom operation, but can be
- *  defined in terms of a default operation similar to qsort.
- *
- *  an example usage follows:
- */
-#if 0
-static
-void ksort_int64_t ( int64_t *base, size_t count )
-{
-    /* swap is performed on full element, not byte-for-byte */
-#define SWAP( a, b, off, size )                             \
-    do                                                      \
-    {                                                       \
-        int64_t tmp = * ( const int64_t* ) ( a );           \
-        * ( int64_t* ) ( a ) = * ( const int64_t* ) ( b );  \
-        * ( int64_t* ) ( b ) = tmp;                         \
-    }                                                       \
-    while ( 0 )
-
-    /* 64-bit comparison producing a signed 32-bit result */
-#define CMP( a, b )                                                     \
-    ( ( * ( const int64_t* ) ( a ) < * ( const int64_t* ) ( b ) ) ? -1 : \
-      ( * ( const int64_t* ) ( a ) > * ( const int64_t* ) ( b ) ) )
-}
-
-    /* let the macro fill out the remainder */
-    KSORT ( base, count, sizeof * base, 0, sizeof * base );
-
-    /* free up macros for future use */
-#undef SWAP
-#undef CMP
-
-#endif
-
-
-/*--------------------------------------------------------------------------
- * kbsearch
- *  bsearch with a function data pointer
- */
-KLIB_EXTERN void* CC kbsearch ( const void *key, const void *base, size_t nmemb, size_t size,
-    int ( CC * cmp ) ( const void*, const void*, void *data ), void *data );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_klib_sort_ */
diff --git a/interfaces/klib/sra-release-version.h b/interfaces/klib/sra-release-version.h
deleted file mode 100644
index 11a2bfa..0000000
--- a/interfaces/klib/sra-release-version.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_klib_sra_release_version_
-#define _h_klib_sra_release_version_
-
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* major . minor . release [ - [ type - ] revision ]
- *
- * Examples:
- *  "2.3.4-a0"
- *  "2.3.4-b3"
- *  "2.3.4-rc1"
- *  "2.3.4"
- *  "2.3.4-2"
- */
-typedef struct SraReleaseVersion SraReleaseVersion;
-struct SraReleaseVersion
-{
-    ver_t version;     /* major . minor . release */
-    uint32_t revision;
-    enum {
-        eSraReleaseVersionTypeAlpha,
-        eSraReleaseVersionTypeBeta,
-        eSraReleaseVersionTypeRC, /* release candidate */
-        eSraReleaseVersionTypeFinal
-    } type;
-};
-
-
-/* Get
- *  Get release version of this build of SRA Toolkit */
-KLIB_EXTERN rc_t CC SraReleaseVersionGet ( SraReleaseVersion *version );
-
-/* Cmp
- *  Compare two release versions
- *  result return values:
- *       0 - the versions are the same 
- *       1 - version2 is more recent than self
- *      -1 - self is more recent than version2
- */
-KLIB_EXTERN rc_t CC SraReleaseVersionCmp ( const SraReleaseVersion *self,
-    const SraReleaseVersion *version2, int32_t *result );
-
-/* Parse
- *  Initialize SraReleaseVersion from char version[size]
- */
-KLIB_EXTERN rc_t CC SraReleaseVersionInit ( SraReleaseVersion *self,
-    const char *version, size_t size );
-
-/* Print
- *  Convert SraReleaseVersion to version[size]
- */
-KLIB_EXTERN rc_t CC SraReleaseVersionPrint ( const SraReleaseVersion *self,
-    char *version, size_t size, size_t *num_writ );
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* _h_klib_sra_release_version_ */
diff --git a/interfaces/klib/status.h b/interfaces/klib/status.h
deleted file mode 100644
index 718c38f..0000000
--- a/interfaces/klib/status.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_klib_status_
-#define _h_klib_status_
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#ifndef _h_klib_writer_
-#include <klib/writer.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef uint32_t KStsLevel;
-
-KLIB_EXTERN KStsLevel CC KStsLevelGet( void );
-KLIB_EXTERN void CC KStsLevelSet( KStsLevel level );
-KLIB_EXTERN void CC KStsLevelAdjust( int32_t adjust );
-
-/* -----
- * Handlers for application and library writers.
- */
-KLIB_EXTERN KWrtHandler* CC KStsHandlerGet (void);
-KLIB_EXTERN KWrtHandler* CC KStsLibHandlerGet (void);
-
-KLIB_EXTERN KWrtWriter CC KStsWriterGet (void);
-KLIB_EXTERN KWrtWriter CC KStsLibWriterGet (void);
-
-KLIB_EXTERN void* CC KStsDataGet (void);
-KLIB_EXTERN void* CC KStsLibDataGet (void);
-
-/*
- * Init()
- * Initialize the debug messages module to a known state
- */
-KLIB_EXTERN rc_t CC KStsInit (void);
-
-KLIB_EXTERN rc_t CC KStsMsg (const char * fmt, ...);
-KLIB_EXTERN rc_t CC KStsLibMsg (const char * fmt, ...);
-
-/* Set
- */
-KLIB_EXTERN rc_t CC KStsHandlerSet    (KWrtWriter writer, void * data);
-KLIB_EXTERN rc_t CC KStsLibHandlerSet (KWrtWriter writer, void * data);
-
-KLIB_EXTERN rc_t CC KStsHandlerSetStdOut    ( void );
-KLIB_EXTERN rc_t CC KStsLibHandlerSetStdOut ( void );
-KLIB_EXTERN rc_t CC KStsHandlerSetStdErr    ( void );
-KLIB_EXTERN rc_t CC KStsLibHandlerSetStdErr ( void );
-
-/* formatting */
-typedef uint32_t KStsFmtFlags;
-enum KStsFmtFlagsEnum
-{
-    kstsFmtTimestamp = 0x00000001,
-    kstsFmtPid = 0x00000002,
-    kstsFmtAppName = 0x00000004,
-    kstsFmtAppVersion = 0x00000008,
-    kstsFmtMessage = 0x00000010, /* actual message */
-    kstsFmtLocalTimestamp = 0x00000020 /* print time stamp in local time, if both bits set local takes over */
-};
-
-KLIB_EXTERN KFmtHandler* CC KStsFmtHandlerGet (void);
-KLIB_EXTERN KFmtHandler* CC KStsLibFmtHandlerGet (void);
-
-KLIB_EXTERN KStsFmtFlags CC KStsFmtFlagsGet ( void );
-KLIB_EXTERN KStsFmtFlags CC KStsLibFmtFlagsGet ( void );
-
-KLIB_EXTERN KFmtWriter CC KStsFmtWriterGet (void);
-KLIB_EXTERN KFmtWriter CC KStsLibFmtWriterGet (void);
-KLIB_EXTERN void* CC KStsFmtDataGet (void);
-KLIB_EXTERN void* CC KStsLibFmtDataGet (void);
-
-KLIB_EXTERN rc_t CC KStsFmtFlagsSet    (KStsFmtFlags flags);
-KLIB_EXTERN rc_t CC KStsLibFmtFlagsSet (KStsFmtFlags flags);
-
-KLIB_EXTERN rc_t CC KStsFmtHandlerSet    (KFmtWriter formatter, KStsFmtFlags flags, void * data);
-KLIB_EXTERN rc_t CC KStsLibFmtHandlerSet (KFmtWriter formatter, KStsFmtFlags flags, void * data);
-
-KLIB_EXTERN rc_t CC KStsFmtHandlerSetDefault(void);
-KLIB_EXTERN rc_t CC KStsLibFmtHandlerSetDefault(void);
-
-/*
- * A usage could look like
- *
- *  STSMSG(4, ("Current Status Level is %d\n", KStsLevelGet()));
- *
- */
-#ifdef _LIBRARY
-
-#define STSMSG(lvl,msg) \
-    (void)((((unsigned)lvl) <= KStsLevelGet()) ? KStsLibMsg msg : 0)
-
-#else
-
-#define STSMSG(lvl,msg) \
-    (void)((((unsigned)lvl) <= KStsLevelGet()) ? KStsMsg msg : 0)
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*  _h_klib_status_ */
diff --git a/interfaces/klib/symbol.h b/interfaces/klib/symbol.h
deleted file mode 100644
index d164f99..0000000
--- a/interfaces/klib/symbol.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_klib_symbol_
-#define _h_klib_symbol_
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#ifndef _h_klib_container_
-#include <klib/container.h>
-#endif
-
-#ifndef _h_klib_text_
-#include <klib/text.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KSymbol
- *  a name to object mapping
- */
-typedef struct KSymbol KSymbol;
-struct KSymbol
-{
-    /* currently kept in a BSTree
-       this could change, though */
-    BSTNode n;
-
-    union
-    {
-        /* external object
-           neither known, nor owned,
-           i.e. just a borrowed reference */
-        const void *obj;
-
-        /* if object is a namespace, its scope */
-        BSTree scope;
-
-        /* unresolved forward decl id */
-        struct { uint32_t ctx, id; } fwd;
-
-    } u;
-
-    /* enclosing namespace
-       for name traceback */
-    KSymbol *dad;
-
-    /* symbol name */
-    String name;
-
-    /* symbol type */
-    uint32_t type;
-};
-
-
-/* Make
- *  create a symbol
- *
- *  "sym" [ OUT ] - return parameter for symbol
- *
- *  "name" [ IN ] - symbol name
- *
- *  "type" [ IN ] - symbol type
- *
- *  "obj" [ IN, NULL OKAY ] - optional object mapping
- *
- * This make will allocate storage for the KSymbol and
- * it's name.
- */
-KLIB_EXTERN rc_t CC KSymbolMake ( KSymbol **sym,
-    const String *name, uint32_t type, const void *obj );
-
-
-/* Init
- *  initialize a symbol without allocating space
- *
- *  "self" [ IN ] - where to initialize
- *
- *  "name" [ IN ] - symbol name
- *
- *  "type" [ IN ] - symbol type
- *
- *  "obj" [ IN, NULL OKAY ] - optional object mapping
- *
- */
-KLIB_EXTERN rc_t CC KSymbolInit ( KSymbol * self, 
-    const String * name, uint32_t type, const void * obj);
-
-
-
-/* Whack
- *  from BSTree
- */
-KLIB_EXTERN void CC KSymbolWhack ( BSTNode *n, void *ignore );
-
-/* there is currently no need for a real Destroy function 
- * but a macro to do nothing is included for orthogonality.
- */
-#define KSymbolDestroy(s,i) ((void)0)
-
-/* Cmp
- *  compare String* against KSymbol*
- */
-KLIB_EXTERN int CC KSymbolCmp ( const void *item, const BSTNode *n );
-
-
-/* Sort
- *  compare KSymbol* against KSymbol*
- */
-KLIB_EXTERN int CC KSymbolSort ( const BSTNode *item, const BSTNode *n );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_klib_symbol_ */
diff --git a/interfaces/klib/symtab.h b/interfaces/klib/symtab.h
deleted file mode 100644
index fd2d406..0000000
--- a/interfaces/klib/symtab.h
+++ /dev/null
@@ -1,225 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_klib_symtab_
-#define _h_klib_symtab_
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#ifndef _h_klib_vector_
-#include <klib/vector.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct BSTree;
-struct String;
-struct KSymbol;
-
-
-/*--------------------------------------------------------------------------
- * KSymTable
- *  scoped stack of BSTrees
- */
-typedef struct KSymTable KSymTable;
-struct KSymTable
-{
-    /* head of open namespace stack */
-    struct KSymbol *ns;
-
-    /* scope stack */
-    Vector stack;
-
-    /* intrinsic scope count */
-    uint32_t intrinsic;
-};
-
-
-/* Init
- *  create an empty symbol table
- *
- *  "intrinsic" [ IN, NULL OKAY ] - initial protected scope
- *  if not NULL, will be used as initial non-modifiable scope
- */
-KLIB_EXTERN rc_t CC KSymTableInit ( KSymTable *self, struct BSTree const *intrinsic );
-
-
-/* Whack
- *  must be called to clean up stack
- */
-#if NOT_MACRO
-KLIB_EXTERN void CC KSymTableWhack ( KSymTable *self );
-#endif
-#define KSymTableWhack( self ) \
-    VectorWhack ( & ( self ) -> stack, NULL, NULL )
-
-
-/* PushScope
- *  pushes a tree onto stack
- *
- *  "scope" [ IN ] - current top scope
- */
-KLIB_EXTERN rc_t CC KSymTablePushScope ( const KSymTable *self, struct BSTree *scope );
-
-
-/* PopScope
- *  removes a tree from stack
- *  noop if count <= self->intrinsic,
- *  because stack bottom will be intrinsic scope
- */
-KLIB_EXTERN void CC KSymTablePopScope ( const KSymTable *self );
-
-
-/* PushNamespace
- *  pushes a namespace scope onto stack
- */
-KLIB_EXTERN rc_t CC KSymTablePushNamespace ( const KSymTable *self, struct KSymbol *ns );
-
-
-/* PopNamespace
- */
-KLIB_EXTERN void CC KSymTablePopNamespace ( const KSymTable *self );
-
-
-/* CreateNamespace
- *  given a name, make it into a namespace,
- *
- *  "name" [ IN ] - name of namespace. if being created within
- *  another namespace, it will be linked to the parent.
- */
-KLIB_EXTERN rc_t CC KSymTableCreateNamespace ( KSymTable *self,
-    struct KSymbol **ns, struct String const *name );
-
-
-/* CreateSymbol
- *  given a name, create an object reference
- *
- *  "sym" [ OUT, NULL OKAY ] - optional return parameter for
- *  newly created symbol, which is entered into the top scope
- *  and only returned for convenience.
- *
- *  "name" [ IN ] - symbol name. if being created within a
- *  namespace, the symbol will be linked to the parent.
- *
- *  "id" [ IN ] - if the symbol type
- *
- *  "obj" [ IN, NULL OKAY ] - if the object has been created
- *  at the point of symbol definition, it may be provided.
- */
-KLIB_EXTERN rc_t CC KSymTableCreateSymbol ( KSymTable *self, struct KSymbol **sym,
-    struct String const *name, uint32_t id, const void *obj );
-#define KSymTableCreateConstSymbol( self, sym, name, id, obj ) \
-    KSymTableCreateSymbol ( self, ( struct KSymbol** ) ( sym ), name, id, obj )
-
-
-/* DupSymbol
- *  given a symbol, create a duplicate
- *
- *  "dup" [ OUT, NULL OKAY ] - optional return parameter for
- *  newly created symbol, which is entered into the top scope
- *  and only returned for convenience.
- *
- *  "sym" [ IN ] - symbol to copy.
- *
- *  "id" [ IN ] - if the symbol type
- *
- *  "obj" [ IN, NULL OKAY ] - if the object has been created
- *  at the point of symbol definition, it may be provided.
- */
-KLIB_EXTERN rc_t CC KSymTableDupSymbol ( KSymTable *self, struct KSymbol **dup,
-    struct KSymbol const *sym, uint32_t id, const void *obj );
-
-
-/* RemoveSymbol
- *  removes symbol from table
- *
- *  "sym" [ IN ] - symbol to be removed
- */
-KLIB_EXTERN rc_t CC KSymTableRemoveSymbol ( KSymTable *self, struct KSymbol const *sym );
-
-
-/* Find
- *  finds a symbol within the scope stack
- */
-KLIB_EXTERN struct KSymbol* CC KSymTableFind ( const KSymTable *self,
-    struct String const *name );
-KLIB_EXTERN struct KSymbol* CC KSymTableFindSymbol ( const KSymTable *self,
-    struct KSymbol const *sym );
-
-
-/* FindIntrinsic
- *  find an intrinsic symbol
- *  looks in stack scopes <= self->intrinsic
- */
-KLIB_EXTERN struct KSymbol* CC KSymTableFindIntrinsic ( const KSymTable *self,
-    struct String const *name );
-
-
-/* FindGlobal
- *  find a symbol at global scope
- */
-KLIB_EXTERN struct KSymbol* CC KSymTableFindGlobal ( const KSymTable *self,
-    struct String const *name );
-
-
-/* FindShallow
- *  find a symbol in top scope
- */
-KLIB_EXTERN struct KSymbol* CC KSymTableFindShallow ( const KSymTable *self,
-    struct String const *name );
-
-
-/* FindNext
- *  given a symbol that was found in nearest scope
- *  find next symbol of the same simple name in
- *  farther scopes
- *
- *  "sym" [ IN ] - previously found symbol
- *
- *  "scope" [ IN/OUT, NULL OKAY ] - if NULL or value is 0,
- *  the scope id for "sym" is dynamically located. otherwise,
- *  the value on input is used for continuing a search. on
- *  output and if not NULL, the value is set to the scope id
- *  where the returned symbol was found, or 0 if not found.
- */
-KLIB_EXTERN struct KSymbol* CC KSymTableFindNext ( const KSymTable *self,
-    struct KSymbol const *sym, uint32_t *scope );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_klib_symtab_ */
diff --git a/interfaces/klib/text.h b/interfaces/klib/text.h
deleted file mode 100644
index 6972764..0000000
--- a/interfaces/klib/text.h
+++ /dev/null
@@ -1,498 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_klib_text_
-#define _h_klib_text_
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#include <stdarg.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * String
- *  pseudo-intrinsic string
- */
-typedef struct String String;
-struct String
-{
-    const char *addr;
-    size_t size;
-    uint32_t len;
-};
-
-/* StringInit
- *  initializes a String object
- */
-#define StringInit( s, val, sz, length ) \
-    ( void ) \
-        ( ( s ) -> addr = ( val ), \
-          ( s ) -> size = ( sz ), \
-          ( s ) -> len = ( length ) )
-
-#define StringInitCString( s, cstr ) \
-    ( void ) \
-        ( ( s ) -> len = string_measure \
-          ( ( s ) -> addr = ( cstr ), & ( s ) -> size ) )
-
-/* CONST_STRING
- *  initialize a string from a manifest constant
- */
-#define CONST_STRING( s, val ) \
-    StringInit ( s, val, sizeof val - 1, sizeof val - 1 )
-
-/* StringSize
- *  size of string in bytes
- */
-#define StringSize( s ) \
-    ( s ) -> size
-
-/* StringLength
- *  length of string in characters
- */
-#define StringLength( s ) \
-    ( s ) -> len
-
-/* StringCopy
- *  allocates a copy of a string
- */
-KLIB_EXTERN rc_t CC StringCopy ( const String **cpy, const String *str );
-
-/* StringConcat
- *  concatenate one string onto another
- */
-KLIB_EXTERN rc_t CC StringConcat ( const String **cat,
-    const String *a, const String *b );
-
-/* StringSubstr
- *  creates a substring of an existing one
- *  note that the substring is always a non-allocated copy
- *  and is dependent upon the lifetime of its source
- *
- *  returns "sub" if "idx" was valid
- *  or NULL otherwise
- *
- *  "len" may be 0 to indicate infinite length
- *  or may extend beyond end of source string.
- */
-KLIB_EXTERN String* CC StringSubstr ( const String *str,
-    String *sub, uint32_t idx, uint32_t len );
-
-/* StringHead
- *  access the first character
- *
- *  this is an efficient enough function to be included.
- *  the generic functions of accessing characters by index
- *  are apt to be extremely inefficient with UTF-8, and
- *  as such are not included.
- *
- *  returns EINVAL if the character is bad,
- *  or ENODATA if the string is empty
- */
-KLIB_EXTERN rc_t CC StringHead ( const String *str, uint32_t *ch );
-
-/* StringPopHead
- *  remove and return the first character
- *
- *  returns EINVAL if the character is bad,
- *  or ENODATA if the string is empty
- */
-KLIB_EXTERN rc_t CC StringPopHead ( String *str, uint32_t *ch );
-
-/* StringEqual
- *  compare strings for equality
- *  not lexical for all characters
- */
-#define StringEqual( a, b ) \
-    ( ( a ) -> len == ( b ) -> len && \
-    memcmp ( ( a ) -> addr, ( b ) -> addr, ( a ) -> len ) == 0 )
-
-/* StringCompare
- *  compare strings for relative ordering
- *  not strictly lexical - generally orders by character code
- */
-KLIB_EXTERN int CC StringCompare ( const String *a, const String *b );
-
-/* StringCaseEqual
- *  compare strings for case-insensitive equality
- */
-KLIB_EXTERN bool CC StringCaseEqual ( const String *a, const String *b );
-
-/* StringCaseCompare
- *  compare strings for relative case-insensitive ordering
- */
-KLIB_EXTERN int CC StringCaseCompare ( const String *a, const String *b );
-
-/* StringOrder
- * StringOrderNoNullCheck
- *  compares strings as quickly as possible for
- *  deterministic ordering: first by length, then
- *  by binary ( byte-wise ) content.
- *
- *  performs more quickly than StringCompare for cases
- *  where only deterministic ordering is needed ( e.g. symbol table ).
- *
- *  the "NoNullCheck" version will crash if either a or b are NULL
- *  but avoids the overhead of checking when both are known to be good
- */
-KLIB_EXTERN int CC StringOrder ( const String *a, const String *b );
-KLIB_EXTERN int CC StringOrderNoNullCheck ( const String *a, const String *b );
-
-/* StringMatch
- *  creates a substring of "a" in "match"
- *  for all of the sequential matching characters between "a" and "b"
- *  starting from character [ 0 ].
- *
- *  returns the number of characters that match.
- */
-KLIB_EXTERN uint32_t CC StringMatch ( String *match,
-    const String *a, const String *b );
-
-/* StringMatchExtend
- *  extends a substring of "a" in "match"
- *  for all of the sequential matching characters between "a" and "b"
- *  starting from character [ match -> len ].
- *
- *  returns the number of matching characters that were extended.
- */
-KLIB_EXTERN uint32_t CC StringMatchExtend ( String *match,
-    const String *a, const String *b );
-
-/* StringHash
- *  hash value for string
- */
-#define StringHash( s ) \
-    string_hash ( ( s ) -> addr, ( s ) -> size )
-
-/* StringCopyUTF...
- *  creates a String from UTF16 or UTF32 UNICODE input
- *  wchar_t is one or the other, depending upon OS and compiler.
- */
-KLIB_EXTERN rc_t CC StringCopyUTF16 ( const String **cpy,
-    const uint16_t *text, size_t bytes );
-KLIB_EXTERN rc_t CC StringCopyUTF32 ( const String **cpy,
-    const uint32_t *text, size_t bytes );
-
-/* StringCopyWChar_t
- *  wchar_t is alternately defined as 16 or 32 bits
- */
-#define StringCopyWChar_t( cpy, text, bytes ) \
-    ( ( sizeof ( wchar_t ) == sizeof ( uint16_t ) ) ? \
-      StringCopyUTF16 ( cpy, ( const uint16_t* ) ( text ), bytes ) : \
-      StringCopyUTF32 ( cpy, ( const uint32_t* ) ( text ), bytes ) )
-
-/* StringWhack
- *  deallocates a string
- *  ignores strings not allocated by this library
- */
-KLIB_EXTERN void CC StringWhack ( const String* self );
-
-
-/*--------------------------------------------------------------------------
- * raw text strings
- *  the internal representation of text strings is implementation
- *  dependent. it is assumed to be ASCII-7 or UTF-8, although
- *  this is determined by the implementation library of these functions.
- *
- * NB - ASCII implementations are no longer being provided
- *  all text handling is UTF-8 unless explictly stated otherwise
- */
-
-/* string_size
- *  length of string in bytes
- */
-KLIB_EXTERN size_t CC string_size ( const char *str );
-
-/* string_len
- *  length of string in characters, when the size is known
- */
-KLIB_EXTERN uint32_t CC string_len ( const char *str, size_t size );
-
-/* string_measure
- *  measures length of string in both characters and bytes
- */
-KLIB_EXTERN uint32_t CC string_measure ( const char *str, size_t *size );
-
-/* string_copy
- *  copies whole character text into a buffer
- *  terminates with NUL byte if possible
- *  returns the number of bytes copied
- */
-KLIB_EXTERN size_t CC string_copy ( char *dst, size_t dst_size,
-    const char *src, size_t src_size );
-
-/* string_copy_measure
- *  copies whole character text into a buffer
- *  terminates with NUL byte if possible
- *  returns the number of bytes copied
- */
-KLIB_EXTERN size_t CC string_copy_measure ( char *dst, size_t dst_size, const char *src );
-
-/* string_dup
- *  replaces the broken C library strndup
- *  creates a NUL-terminated malloc'd string
- */
-KLIB_EXTERN char* CC string_dup ( const char *str, size_t size );
-
-/* string_dup_measure
- *  replaces the broken C library strdup
- *  creates a NUL-terminated malloc'd string
- *  returns size of string unless "size" is NULL
- */
-KLIB_EXTERN char* CC string_dup_measure ( const char *str, size_t *size );
-
-/* string_printf
- *  NOW IN <klib/printf.h>
- */
-
-/* tolower_copy
- *  copies whole character text in lower-case
- *  terminates with NUL byte if possible
- *  returns the number of bytes copied
- */
-KLIB_EXTERN size_t CC tolower_copy ( char *dst, size_t dst_size,
-    const char *src, size_t src_size );
-
-/* toupper_copy
- *  copies whole character text in upper-case
- *  terminates with NUL byte if possible
- *  returns the number of bytes copied
- */
-KLIB_EXTERN size_t CC toupper_copy ( char *dst, size_t dst_size,
-    const char *src, size_t src_size );
-
-/* string_cmp
- *  performs a safe strncmp
- *
- *  "max_chars" limits the extent of the comparison
- *  to not exceed supplied value, i.e. the number of
- *  characters actually compared will be the minimum
- *  of asize, bsize and max_chars.
- *
- *  if either string size ( or both ) < max_chars and
- *  all compared characters match, then the result will
- *  be a comparison of asize against bsize.
- */
-KLIB_EXTERN int CC string_cmp ( const char *a, size_t asize,
-    const char *b, size_t bsize, uint32_t max_chars );
-
-/* strcase_cmp
- *  like string_cmp except case insensitive
- */
-KLIB_EXTERN int CC strcase_cmp ( const char *a, size_t asize,
-    const char *b, size_t bsize, uint32_t max_chars );
-
-/* string_match
- *  returns the number of matching characters
- *
- *  "max_chars" limits the extent of the comparison
- *  to not exceed supplied value, i.e. the number of
- *  characters actually compared will be the minimum
- *  of asize, bsize and max_chars.
- *
- *  "msize" will be set to the size of the matched string
- *  if not NULL
- */
-KLIB_EXTERN uint32_t CC string_match ( const char *a, size_t asize,
-    const char *b, size_t bsize, uint32_t max_chars, size_t *msize );
-
-/* strcase_match
- *  like string_match except case insensitive
- */
-KLIB_EXTERN uint32_t CC strcase_match ( const char *a, size_t asize,
-    const char *b, size_t bsize, uint32_t max_chars, size_t *msize );
-
-/* string_chr
- *  performs a safe strchr
- *  "ch" is in UTF32
- */
-KLIB_EXTERN char* CC string_chr ( const char *str, size_t size, uint32_t ch );
-
-/* string_rchr
- *  performs a safe strrchr
- */
-KLIB_EXTERN char* CC string_rchr ( const char *str, size_t size, uint32_t ch );
-
-/* string_brk
- *  performs a safe strpbrk
- */
-#if 0
-KLIB_EXTERN char* CC string_brk ( const char *str, size_t size,
-    const char *accept, size_t asize );
-#endif
-
-/* string_rbrk
- */
-#if 0
-KLIB_EXTERN char* CC string_rbrk ( const char *str, size_t size,
-    const char *accept, size_t asize );
-#endif
-
-/* string_hash
- *  hashes a string
- */
-KLIB_EXTERN uint32_t CC string_hash ( const char *str, size_t size );
-
-/* string_idx
- *  seek an indexed character
- *
- *  the efficiency is based upon chosen internal
- *  string representation, which, when using single byte chars,
- *  is simple and efficient.
- *
- *  on the other hand, UTF-8 has a variable character width,
- *  requiring scanning of the entire string until the indexed
- *  character is found.
- */
-KLIB_EXTERN char* CC string_idx ( const char *str, size_t size, uint32_t idx );
-
-
-/*--------------------------------------------------------------------------
- * conversion between UTF-32 and UTF-8 UNICODE
- */
-
-/* utf8_utf32
- *  converts UTF-8 text to a single UTF-32 character
- *  returns the number of UTF8 bytes consumed, such that:
- *    return > 0 means success
- *    return == 0 means insufficient input
- *    return < 0 means bad input
- */
-KLIB_EXTERN int CC utf8_utf32 ( uint32_t *ch, const char *begin, const char *end );
-
-/* utf32_utf8
- *  converts a single UTF-32 character to UTF-8 text
- *  returns the number of UTF8 bytes generated, such that:
- *    return > 0 means success
- *    return == 0 means insufficient output
- *    return < 0 means bad character
- */
-KLIB_EXTERN int CC utf32_utf8 ( char *begin, char *end, uint32_t ch );
-
-
-/*--------------------------------------------------------------------------
- * support for 16 and 32-bit UTF formats
- */
-
-/* utf16_string_size/len/measure
- *  measures UTF-16 strings
- */
-KLIB_EXTERN size_t CC utf16_string_size ( const uint16_t *str );
-KLIB_EXTERN uint32_t CC utf16_string_len ( const uint16_t *str, size_t size );
-KLIB_EXTERN uint32_t CC utf16_string_measure ( const uint16_t *str, size_t *size );
-
-/* utf32_string_size/len/measure
- */
-KLIB_EXTERN size_t CC utf32_string_size ( const uint32_t *str );
-KLIB_EXTERN uint32_t CC utf32_string_len ( const uint32_t *str, size_t size );
-KLIB_EXTERN uint32_t CC utf32_string_measure ( const uint32_t *str, size_t *size );
-
-/* wchar_string_size/len/measure
- *  measures wchar_t strings
- */
-KLIB_EXTERN size_t CC wchar_string_size ( const wchar_t *str );
-KLIB_EXTERN uint32_t CC wchar_string_len ( const wchar_t *str, size_t size );
-KLIB_EXTERN uint32_t CC wchar_string_measure ( const wchar_t *str, size_t *size );
-
-/* conversion from UTF-16 to internal standard */
-KLIB_EXTERN uint32_t CC utf16_cvt_string_len ( const uint16_t *src,
-    size_t src_size, size_t *dst_size );
-KLIB_EXTERN uint32_t CC utf16_cvt_string_measure ( const uint16_t *src,
-    size_t *src_size, size_t *dst_size );
-KLIB_EXTERN size_t CC utf16_cvt_string_copy ( char *dst, size_t dst_size,
-    const uint16_t *src, size_t src_size );
-
-/* conversion from UTF-32 to internal standard */
-KLIB_EXTERN uint32_t CC utf32_cvt_string_len ( const uint32_t *src,
-    size_t src_size, size_t *dst_size );
-KLIB_EXTERN uint32_t CC utf32_cvt_string_measure ( const uint32_t *src,
-    size_t *src_size, size_t *dst_size );
-KLIB_EXTERN size_t CC utf32_cvt_string_copy ( char *dst, size_t dst_size,
-    const uint32_t *src, size_t src_size );
-
-/* conversion from wchar_t to internal standard */
-KLIB_EXTERN uint32_t CC wchar_cvt_string_len ( const wchar_t *src,
-    size_t src_size, size_t *dst_size );
-KLIB_EXTERN uint32_t CC wchar_cvt_string_measure ( const wchar_t *src,
-    size_t *src_size, size_t *dst_size );
-KLIB_EXTERN size_t CC wchar_cvt_string_copy ( char *dst, size_t dst_size,
-    const wchar_t *src, size_t src_size );
-
-/* conversion to wchar_t from internal standard */
-KLIB_EXTERN size_t CC string_cvt_wchar_copy ( wchar_t *dst, size_t dst_size,
-    const char *src, size_t src_size );
-
-/*--------------------------------------------------------------------------
- * support for ISO-8859-x 8-bit character sets
- */
-
-/* iso8859_utf32
- *  converts 8-bit text to a single UTF-32 character
- *  returns the number of 8-bit bytes consumed, such that:
- *    return > 0 means success
- *    return == 0 means insufficient input
- *    return < 0 means bad input
- */
-KLIB_EXTERN int CC iso8859_utf32 ( const uint32_t map [ 128 ],
-    uint32_t *ch, const char *begin, const char *end );
-
-/* iso8859_string_size/len/measure
- *  measures UTF-16 strings
- */
-KLIB_EXTERN size_t CC iso8859_string_size ( const uint32_t map [ 128 ],
-    const char *str );
-KLIB_EXTERN uint32_t CC iso8859_string_len ( const uint32_t map [ 128 ],
-    const char *str, size_t size );
-KLIB_EXTERN uint32_t CC iso8859_string_measure ( const uint32_t map [ 128 ],
-    const char *str, size_t *size );
-
-/* conversion from ISO-8859-x to internal standard */
-KLIB_EXTERN uint32_t CC iso8859_cvt_string_len ( const uint32_t map [ 128 ],
-    const char *src, size_t src_size, size_t *dst_size );
-KLIB_EXTERN uint32_t CC iso8859_cvt_string_measure ( const uint32_t map [ 128 ],
-    const char *src, size_t *src_size, size_t *dst_size );
-KLIB_EXTERN size_t CC iso8859_cvt_string_copy ( const uint32_t map [ 128 ],
-    char *dst, size_t dst_size, const char *src, size_t src_size );
-
-/* some externally defined character maps */
-KLIB_EXTERN_DATA const uint32_t iso8859_1 [ 128 ];
-KLIB_EXTERN_DATA const uint32_t cp1252 [ 128 ];
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_klib_text_ */
diff --git a/interfaces/klib/time.h b/interfaces/klib/time.h
deleted file mode 100644
index 73760a0..0000000
--- a/interfaces/klib/time.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_klib_time_
-#define _h_klib_time_
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KTime_t
- *  64 bit time_t
- */
-
-
-/* Stamp
- *  current timestamp
- */
-KLIB_EXTERN KTime_t CC KTimeStamp ( void );
-
-
-/*--------------------------------------------------------------------------
- * KTime
- *  simple time structure
- */
-typedef struct KTime KTime;
-struct KTime
-{
-    uint32_t year;        /* full year                                */
-    uint16_t month;       /* 0 .. 11                                  */
-    uint16_t day;         /* 0 .. 30                                  */
-    uint16_t weekday;     /* 0 .. 6 : 0 is Sunday                     */
-    int16_t tzoff;        /* -719 .. +719 minutes from Prime Meridian */
-    uint8_t hour;         /* 0 .. 23                                  */
-    uint8_t minute;       /* 0 .. 59                                  */
-    uint8_t second;       /* 0 .. 61 :  61 used for leap seconds      */
-    bool dst;             /* true if Daylight Savings Time in effect  */
-};
-
-
-/* Local
- *  populate "kt" from "ts" in local time zone
- */
-KLIB_EXTERN const KTime* CC KTimeLocal ( KTime *kt, KTime_t ts );
-
-
-/* Global
- *  populate "kt" from "ts" in GMT
- */
-KLIB_EXTERN const KTime* CC KTimeGlobal ( KTime *kt, KTime_t ts );
-
-
-/* MakeTime
- *  make a KTime_t from KTime
- */
-KLIB_EXTERN KTime_t CC KTimeMakeTime ( const KTime *self );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*  _h_klib_time_ */
diff --git a/interfaces/klib/token.h b/interfaces/klib/token.h
deleted file mode 100644
index 80bf714..0000000
--- a/interfaces/klib/token.h
+++ /dev/null
@@ -1,254 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_klib_token_
-#define _h_klib_token_
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#ifndef _h_klib_text_
-#include <klib/text.h>
-#endif
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KSymbol;
-
-
-/*--------------------------------------------------------------------------
- * KTokenText
- *  named text
- *
- *  it's likely that the name will need to become a refcounted object...
- */
-typedef struct KTokenText KTokenText;
-struct KTokenText
-{
-    String str;
-    String path;
-
-    rc_t ( CC * read ) ( void *self, KTokenText *tt, size_t save );
-    void *data;
-};
-
-
-/* Init
- *  initialize structure
- */
-#define KTokenTextInit( tt, text, fpath ) \
-    ( void ) ( ( tt ) -> str = * ( text ), \
-               ( tt ) -> path = * ( fpath ), \
-               ( tt ) -> read = NULL, \
-               ( tt ) -> data = NULL )
-#ifndef KTokenTextInit
-KLIB_EXTERN void CC KTokenTextInit ( KTokenText *tt, const String *text, const String *path );
-#endif
-
-#define KTokenTextInitCString( tt, text, fpath ) \
-    ( void ) ( StringInitCString ( & ( tt ) -> str, text ), \
-               StringInitCString ( & ( tt ) -> path, fpath ), \
-               ( tt ) -> read = NULL, \
-               ( tt ) -> data = NULL )
-#ifndef KTokenTextInitCString
-KLIB_EXTERN void CC KTokenTextInitCString ( KTokenText *tt, const char *text, const char *path );
-#endif
-
-/*--------------------------------------------------------------------------
- * KTokenID
- *  pre-defined ids for text tokens
- *  not every tokenizer will return all tokens
- */
-enum KTokenID
-{
-    eEndOfInput, eUnrecognized, eUntermComment,
-
-    /* space separators */
-    eWhiteSpace, eEndOfLine,
-
-    /* numeric */
-    eDecimal, eHex, eOctal, eFloat, eExpFloat, eMajMinRel,
-
-    /* string */
-    eUntermString, eString, eUntermEscapedString, eEscapedString,
-
-    /* names */
-    eIdent, eName,
-
-    /* punctuation */
-    ePeriod, eComma, eColon, eSemiColon, eQuestion, eTilde, eExclam,
-    eAtSign, eHash, eDollar, ePercent, eCaret, eAmpersand, eAsterisk,
-    ePlus, eMinus, eAssign, eFwdSlash, eBackSlash, ePipe,
-
-    /* paired punctuation */
-    eLeftParen, eRightParen,
-    eLeftCurly, eRightCurly,
-    eLeftAngle, eRightAngle,
-    eLeftSquare, eRightSquare,
-
-    /* compound tokens */
-    eDblPeriod, eDblColon, eEllipsis, eLogAnd, eLogOr,
-    eEqual, eNotEqual, eColonAssign, ePlusAssign, eOverArrow,
-
-    eDblLeftAngle, eDblRightAngle,
-    eDblLeftSquare, eDblRightSquare,
-
-    /* first free id */
-    eNumTokenIDs,
-
-    /* namespace type - needed by KSymTable */
-    eNamespace = eNumTokenIDs,
-    eNumSymtabIDs
-};
-
-
-/*--------------------------------------------------------------------------
- * KToken
- *  a string with an id and source information
- */
-typedef struct KToken KToken;
-struct KToken
-{
-    const KTokenText *txt;
-    struct KSymbol *sym;
-    String str;
-    uint32_t id;
-    uint32_t lineno;
-};
-
-
-/* conversion operators
- *  since the constants have a type id, the entire token is used
- */
-KLIB_EXTERN rc_t CC KTokenToI32 ( const KToken *self, int32_t *i );
-KLIB_EXTERN rc_t CC KTokenToU32 ( const KToken *self, uint32_t *i );
-KLIB_EXTERN rc_t CC KTokenToI64 ( const KToken *self, int64_t *i );
-KLIB_EXTERN rc_t CC KTokenToU64 ( const KToken *self, uint64_t *i );
-KLIB_EXTERN rc_t CC KTokenToF64 ( const KToken *self, double *d );
-KLIB_EXTERN rc_t CC KTokenToVersion ( const KToken *self, uint32_t *v );
-KLIB_EXTERN rc_t CC KTokenToString ( const KToken *self, char *buffer, size_t bsize, size_t *size );
-KLIB_EXTERN rc_t CC KTokenToWideString ( const KToken *self, uint32_t *buffer, uint32_t blen, uint32_t *len );
-
-
-/*--------------------------------------------------------------------------
- * KTokenSource
- *  a modifiable source of tokens
- */
-typedef struct KTokenSource KTokenSource;
-struct KTokenSource
-{
-    const KTokenText *txt;
-    String str;
-    uint32_t lineno;
-};
-
-/* Init
- */
-#define KTokenSourceInit( self, tt ) \
-    ( void ) ( ( self ) -> str = ( tt ) -> str, \
-               ( self ) -> txt = ( tt ), \
-               ( self ) -> lineno = 1 )
-#ifndef KTokenSourceInit
-KLIB_EXTERN void CC KTokenSourceInit ( KTokenSource *self, const KTokenText *txt );
-#endif
-
-/* Return
- *  returns token to source
- */
-KLIB_EXTERN void CC KTokenSourceReturn ( KTokenSource *self, const KToken *t );
-
-
-/* Consume
- *  consumes all remaining data
- */
-KLIB_EXTERN void CC KTokenSourceConsume ( KTokenSource *self );
-
-
-/* Avail
- *  the number of characters available
- */
-#define KTokenSourceAvail( self ) \
-    ( ( ( const KTokenSource* ) ( self ) ) -> str . len )
-#ifndef KTokenSourceAvail
-KLIB_EXTERN uint32_t CC KTokenSourceAvail ( const KTokenSource *self );
-#endif
-
-/*--------------------------------------------------------------------------
- * KTokenizer
- *  an encapsulation of the tokenizer code
- */
-typedef struct KTokenizer KTokenizer;
-
-
-/* Next
- *  scan for next token
- *
- *  "src" [ IN ] - source of token text
- *
- *  "t" [ OUT ] - scanned token
- *
- *  returns a pointer to "t" for convenience
- */
-KLIB_EXTERN KToken* CC KTokenizerNext ( const KTokenizer *self, KTokenSource *src, KToken *t );
-
-
-/* kDefaultTokenizer
- *  a constant KTokenizer* to obtain default behavior
- */
-#define kDefaultTokenizer ( ( const KTokenizer* ) 0 )
-
-
-/* kLineTokenizer
- *  behaves like default tokenizer
- *  except that eEndOfLine tokens are returned
- */
-#define kLineTokenizer ( ( const KTokenizer* ) 1 )
-
-
-/* kPOSIXPathTokenizer
- *  tokenizes a POSIX path string
- */
-#define kPOSIXPathTokenizer ( ( const KTokenizer* ) 2 )
-
-/* kKfgTokenizer
- * tokenizes a KFG config file 
- * with its name value pairs and comments
- */
-#define kKfgTokenizer  ( ( const KTokenizer* ) 3 )
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_klib_token_ */
diff --git a/interfaces/klib/trie.h b/interfaces/klib/trie.h
deleted file mode 100644
index 0532c6a..0000000
--- a/interfaces/klib/trie.h
+++ /dev/null
@@ -1,293 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_klib_trie_
-#define _h_klib_trie_
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#ifndef _h_klib_container_
-#include <klib/container.h>
-#endif
-
-#ifndef _h_klib_text_
-#include <klib/text.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * TNode
- *  a node within trie
- */
-typedef struct TNode TNode;
-struct TNode
-{
-    BSTNode n;
-    String key;
-};
-
-/* TNodeMake
- *  creates a TNode of variable size
- *
- *  "n" will contain the returned node
- *
- *  "size" must be at least the size of a TNode
- */
-KLIB_EXTERN rc_t CC TNodeMake ( TNode **n, size_t size );
-
-/* TNodeWhack
- *  performs final whacking of node
- */
-KLIB_EXTERN void CC TNodeWhack ( TNode *self );
-
-
-/*--------------------------------------------------------------------------
- * Trie
- *  a tree of text nodes
- *
- *  this is a collection of { key, value } pairs, where a many-value
- *  to one key paradigm is naturally supported, as in the b-tree.
- *
- *  the desired insertion operations are:
- *   a) key -> value
- *   b) key -> { value, ... }
- *
- *  the desired retrieval operations are:
- *   a) key -> value
- *   b) key -> { value, ... }
- *   c) RE -> key : value
- *   d) RE -> { key : value, ... }
- *   e) iteration across { key : value, ... }
- *
- *  the reverse retrieval operation is externally managed by virtue of
- *  externalization of the TNode, which bundles together key and value.
- *  any external mechanism allowing access to the TNode will perform a
- *  reverse lookup.
- */
-typedef struct Trie Trie;
-struct Trie
-{
-    /* root node in the tree */
-    struct TTrans *root;
-
-    /* forward and reverse UTF-32 character maps */
-    const uint16_t *map;
-    const uint32_t *rmap;
-
-    /* range of acceptable UTF-32 input characters */
-    uint32_t first_char;
-    uint32_t last_char;
-
-    /* width of transition array */
-    uint16_t width;
-
-    /* limit to the number of values */
-    uint16_t limit;
-
-    /* automatically expand character set */
-    uint8_t cs_expand;
-
-#if _DEBUGGING
-    /* post-validate tree after every insert */
-    uint8_t validate;
-
-    uint8_t align1 [ 2 ];
-#else
-    uint8_t align1 [ 3 ];
-#endif
-};
-
-/* TrieInit
- *  initialize a text-tree structure
- *
- *  "accept" [ IN ] -  a character-set string where each character
- *  represents itself. the only exception is the '-' character,
- *  which - when sandwiched between two other characters - is
- *  interpreted en tot as a range expression. an example would be
- *  "-0-9" is identical to "-0123456789"
- *
- *  "limit" [ IN ] - sets the number of values to be accumulated in
- *  any container. if this limit would be exceeded by any insertion,
- *  the node is expanded and its values are re-distributed among
- *  its children.
- *
- *  "cs_expand" [ IN ] - if true, then any valid characters observed
- *  during insertions are automatically added to the accept character
- *  set. doing so will ensure that there are no ambiguous transitions.
- *
- *  returns status codes:
- *    EINVAL => an invalid parameter
- *    ENOMEM => failed to allocate internal structures
- */
-KLIB_EXTERN rc_t CC TrieInit ( Trie *tt, const char *accept,
-    uint32_t limit, bool cs_expand );
-
-/* TrieInsert
- *  inserts an item into tree
- *
- *  "item" [ IN ] -  a TNode forming the { key, value } pair.
- *
- *  returns status codes:
- *    EINVAL => an invalid parameter
- *    ENOMEM => failed to allocate internal structures
- */
-KLIB_EXTERN rc_t CC TrieInsert ( Trie *self, TNode *item );
-
-/* TrieInsertUnique
- *  behaves like TrieInsert if the key does not already have an
- *  associated value. fails otherwise, returning the existing node.
- *
- *  "item" [ IN ] - { key, value } pair
- *
- *  "exist" [ OUT, NULL OKAY ] - return parameter for existing node
- *  if insert failed due to unique constraint. NULL otherwise.
- *
- *  returns status codes:
- *    EINVAL => an invalid parameter
- *    EEXIST => the key is already bound to a value
- *    ENOMEM => failed to allocate internal structures
- */
-KLIB_EXTERN rc_t CC TrieInsertUnique ( Trie *self, TNode *item, TNode **exist );
-
-/* TrieUnlink
- *  remove an object from the tree
- *
- *  "item" [ IN ] - an actual TNode presumed to be held within tree.
- *
- *  return value:
- *    true  => node belonged to tree and was removed
- *    false => node does not belong to tree
- */
-KLIB_EXTERN bool CC TrieUnlink ( Trie *self, TNode *item );
-
-/* TrieValidate
- *  run validation check on tree structure
- *
- *  return status codes:
- *    ?
- *
- * TEMPORARY
- */
-#if 0
-KLIB_EXTERN int CC TrieValidate ( const Trie *self );
-#endif
-
-/* TrieFind
- * TrieFindRE
- *  find a single object within tree
- *
- *  "key" [ IN ] - an exact match text string
- *
- *  "re" [ IN ] - a regular expression string
- *
- *  return value:
- *    NULL    => no match
- *    TNode* => arbitrarily chosen matching node
- */
-KLIB_EXTERN TNode* CC TrieFind ( const Trie *self, const String *key );
-#if 0
-KLIB_EXTERN TNode* CC TrieFindRE ( const Trie *self, const String *re );
-#endif
-
-/* TrieFindAll
- * TrieFindAllRE
- *  find multiple objects within tree
- *
- *  "key" [ IN ] - an exact match text string
- *
- *  "re" [ IN ] - a regular expression string
- *
- *  "buffer" [ OUT ] and "capacity" [ IN ] - a user-supplied
- *  array of TNode* with a capacity of "capacity" elements.
- *  if successful, the entire found set will be returned unordered within.
- *
- *  "num_found" [ OUT ] - indicates the size of the found set,
- *  regardless of return value, such that if the supplied
- *  buffer were to be too small, the required size is returned.
- *
- *  returns status codes:
- *    EINVAL  => an invalid parameter
- *    ENOENT  => the found set was empty
- *    ENOBUFS => the found set was too large
- */
-KLIB_EXTERN rc_t CC TrieFindAll ( const Trie *self, const String *key,
-    TNode *buffer [], uint32_t capacity, uint32_t *num_found );
-#if 0
-KLIB_EXTERN rc_t CC TrieFindAllRE ( const Trie *self, const String *re,
-    TNode *buffer [], uint32_t capacity, uint32_t *num_found );
-#endif
-
-/* TrieForEach
- *  executes a function on each tree element
- *
- *  "f" [ IN ] and "data" [ IN ] - iteration callback function for
- *  examining each TNode in the tree
- */
-KLIB_EXTERN void CC TrieForEach ( const Trie *self,
-    void ( CC * f ) ( TNode *n, void *data ), void *data );
-
-/* TrieDoUntil
- *  executes a function on each tree element
- *  until the function returns true
- *
- *  "f" [ IN ] and "data" [ IN ] - iteration callback function for
- *  examining each TNode in the tree. the function returns "true"
- *  to halt iteration.
- *
- *  return values:
- *    the last value returned by "f" or false if never invoked
- */
-KLIB_EXTERN bool CC TrieDoUntil ( const Trie *self,
-    bool ( CC * f ) ( TNode *n, void *data ), void *data );
-
-/* TrieExplore
- *  executes a function on each element in the path of the key
- *  from furthest node to closest node
- *  until the function returns true or end of chain
- */
-KLIB_EXTERN bool CC TrieExplore ( const Trie *self, const String *key,
-    bool ( CC * f ) ( TNode *n, void *data ), void *data );
-
-/* TrieWhack
- *  tears down internal structure
- *
- *  "whack" [ IN, NULL OKAY ] and "data" [ IN ] - optional function
- *  to be invoked on TNode objects contained within. if NULL, the
- *  nodes will be whacked via "TNodeWhack"
- */
-KLIB_EXTERN void CC TrieWhack ( Trie *self,
-    void ( CC * whack ) ( TNode *n, void *data ), void *data );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_klib_trie_ */
diff --git a/interfaces/klib/vector.h b/interfaces/klib/vector.h
deleted file mode 100644
index be72b90..0000000
--- a/interfaces/klib/vector.h
+++ /dev/null
@@ -1,428 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_klib_vector_
-#define _h_klib_vector_
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KVector
- *  encapsulated vector interface
- *
- *  a vector obeys a particular set of messages
- *  it may be implemented as an array, but not necessarily.
- *
- *  the principal property of a vector is that it acts as a map
- *  between an integer key and a value of some type. in this case,
- *  we only accept unsigned integers as keys.
- */
-typedef struct KVector KVector;
-
-
-/* Make
- *  create an empty vector
- */
-KLIB_EXTERN rc_t CC KVectorMake ( KVector **v );
-
-
-/* AddRef
- * Release
- */
-KLIB_EXTERN rc_t CC KVectorAddRef ( const KVector *self );
-KLIB_EXTERN rc_t CC KVectorRelease ( const KVector *self );
-
-
-/* Get
- *  get an untyped value
- *  returns rc_t state of rcNull if index is not set
- *
- *  "key" [ IN ] - vector index
- *
- *  "value_buffer" [ OUT ] and "bsize" [ IN ] - return buffer for value
- *
- *  "bytes" [ OUT ] - return parameter for bytes in value
- *
- * NB - if rc_t state is rcInsufficient, "bytes" will contain
- *  the number of bytes required to access the indexed value
- */
-KLIB_EXTERN rc_t CC KVectorGet ( const KVector *self, uint64_t key,
-    void *value_buffer, size_t bsize, size_t *bytes );
-
-/* Get
- *  get typed values
- *  returns rc_t state of rcNull if index is not set
- *
- *  "key" [ IN ] - vector index
- *
- *  "value" [ OUT ] - return parameter for value
- */
-KLIB_EXTERN rc_t CC KVectorGetBool ( const KVector *self, uint64_t key, bool *value );
-
-KLIB_EXTERN rc_t CC KVectorGetI8 ( const KVector *self, uint64_t key, int8_t *value );
-KLIB_EXTERN rc_t CC KVectorGetI16 ( const KVector *self, uint64_t key, int16_t *value );
-KLIB_EXTERN rc_t CC KVectorGetI32 ( const KVector *self, uint64_t key, int32_t *value );
-KLIB_EXTERN rc_t CC KVectorGetI64 ( const KVector *self, uint64_t key, int64_t *value );
-
-KLIB_EXTERN rc_t CC KVectorGetU8 ( const KVector *self, uint64_t key, uint8_t *value );
-KLIB_EXTERN rc_t CC KVectorGetU16 ( const KVector *self, uint64_t key, uint16_t *value );
-KLIB_EXTERN rc_t CC KVectorGetU32 ( const KVector *self, uint64_t key, uint32_t *value );
-KLIB_EXTERN rc_t CC KVectorGetU64 ( const KVector *self, uint64_t key, uint64_t *value );
-
-KLIB_EXTERN rc_t CC KVectorGetF32 ( const KVector *self, uint64_t key, float *value );
-KLIB_EXTERN rc_t CC KVectorGetF64 ( const KVector *self, uint64_t key, double *value );
-
-KLIB_EXTERN rc_t CC KVectorGetPtr ( const KVector *self, uint64_t key, void **value );
-
-
-/* Set
- *  set an untyped value
- *
- *  "key" [ IN ] - vector index
- *
- *  "value" [ IN ] and "bytes" [ IN ] - value buffer
- */
-KLIB_EXTERN rc_t CC KVectorSet ( KVector *self, uint64_t key,
-    const void *value, size_t bytes );
-
-/* Set
- *  set typed values
- *
- *  "key" [ IN ] - vector index
- *
- *  "data" [ IN ] - value
- */
-KLIB_EXTERN rc_t CC KVectorSetBool ( KVector *self, uint64_t key, bool value );
-
-KLIB_EXTERN rc_t CC KVectorSetI8 ( KVector *self, uint64_t key, int8_t value );
-KLIB_EXTERN rc_t CC KVectorSetI16 ( KVector *self, uint64_t key, int16_t value );
-KLIB_EXTERN rc_t CC KVectorSetI32 ( KVector *self, uint64_t key, int32_t value );
-KLIB_EXTERN rc_t CC KVectorSetI64 ( KVector *self, uint64_t key, int64_t value );
-
-KLIB_EXTERN rc_t CC KVectorSetU8 ( KVector *self, uint64_t key, uint8_t value );
-KLIB_EXTERN rc_t CC KVectorSetU16 ( KVector *self, uint64_t key, uint16_t value );
-KLIB_EXTERN rc_t CC KVectorSetU32 ( KVector *self, uint64_t key, uint32_t value );
-KLIB_EXTERN rc_t CC KVectorSetU64 ( KVector *self, uint64_t key, uint64_t value );
-
-KLIB_EXTERN rc_t CC KVectorSetF32 ( KVector *self, uint64_t key, float value );
-KLIB_EXTERN rc_t CC KVectorSetF64 ( KVector *self, uint64_t key, double value );
-
-KLIB_EXTERN rc_t CC KVectorSetPtr ( KVector *self, uint64_t key, const void *value );
-
-
-/* Unset
- *  unset an entry
- *  returns rc_t state rcNull if index is not set
- *
- *  "key" [ IN ] - vector index
- */
-KLIB_EXTERN rc_t CC KVectorUnset ( KVector *self, uint64_t key );
-
-
-/* Visit
- *  executes a function on each key/value pair
- *  returns early if "f" returns non-zero rc_t
- *
- *  "reverse" [ IN ] - if true, execute in reverse order
- *
- *  "f" [ IN ] and "user_data" [ IN, OPAQUE ] - function to be
- *  executed on each vector element or until the function
- *  returns true.
- */
-KLIB_EXTERN rc_t CC KVectorVisit ( const KVector *self, bool reverse,
-    rc_t ( CC * f ) ( uint64_t key, const void *value, size_t bytes, void *user_data ),
-    void *user_data );
-
-/* Visit
- *  visit typed values
- *  returns early if "f" returns non-zero rc_t
- *
- *  "reverse" [ IN ] - if true, execute in reverse order
- *
- *  "f" [ IN ] and "user_data" [ IN, OPAQUE ] - function to be
- *  executed on each vector element or until the function
- *  returns true.
- */
-KLIB_EXTERN rc_t CC KVectorVisitBool ( const KVector *self, bool reverse,
-    rc_t ( CC * f ) ( uint64_t key, bool value, void *user_data ),
-    void *user_data );
-KLIB_EXTERN rc_t CC KVectorVisitI64 ( const KVector *self, bool reverse,
-    rc_t ( CC * f ) ( uint64_t key, int64_t value, void *user_data ),
-    void *user_data );
-KLIB_EXTERN rc_t CC KVectorVisitU64 ( const KVector *self, bool reverse,
-    rc_t ( CC * f ) ( uint64_t key, uint64_t value, void *user_data ),
-    void *user_data );
-KLIB_EXTERN rc_t CC KVectorVisitF64 ( const KVector *self, bool reverse,
-    rc_t ( CC * f ) ( uint64_t key, double value, void *user_data ),
-    void *user_data );
-KLIB_EXTERN rc_t CC KVectorVisitPtr ( const KVector *self, bool reverse,
-    rc_t ( CC * f ) ( uint64_t key, const void *value, void *user_data ),
-    void *user_data );
-
-
-
-/*--------------------------------------------------------------------------
- * Vector
- *  simple vector of void*
- */
-typedef struct Vector Vector;
-struct Vector
-{
-    void **v;
-    uint32_t start;
-    uint32_t len;
-    uint32_t mask;
-};
-
-/* Init
- *  initialize vector
- *
- *  "start" [ IN ] - initial index to vector, normally 0
- *
- *  "block" [ IN ] - selects the number of elements in
- *  a vector block; used for allocating and extending
- */
-KLIB_EXTERN void CC VectorInit ( Vector *self, uint32_t start, uint32_t block );
-
-
-/* Copy
- *  initialize a new vector from an existing one
- *  performs a shallow copy
- */
-KLIB_EXTERN rc_t CC VectorCopy ( const Vector *self, Vector *copy );
-
-
-/* Start
- *  returns the starting index
- */
-#define VectorStart( self ) \
-    ( * ( const uint32_t* ) & ( ( self ) -> start ) )
-
-
-/* Length
- *  return the vector length
- */
-#define VectorLength( self ) \
-    ( * ( const uint32_t* ) & ( ( self ) -> len ) )
-
-
-/* Block
- *  return the vector expansion block size
- */
-#define VectorBlock( self ) \
-    ( * ( const uint32_t* ) & ( ( self ) -> mask ) + 1 )
-
-
-/* Get
- *  retrieve an indexed element
- */
-KLIB_EXTERN void* CC VectorGet ( const Vector *self, uint32_t idx );
-
-
-/* Set
- *  sets an indexed element
- *  extends vector as required
- *
- *  "idx" [ IN ] - item index
- *
- *  "item" [ IN, OPAQUE ] - item to be appended to vector
- *
- *  returns rcExists if element is not NULL
- */
-KLIB_EXTERN rc_t CC VectorSet ( Vector *self, uint32_t idx, const void *item );
-
-
-/* Swap
- *  swaps value of an indexed element
- *  behaves like Set except that it allows overwrite
- *
- *  "idx" [ IN ] - item index
- *
- *  "item" [ IN, OPAQUE ] - new element value
- *
- *  "prior" [ OUT ] - prior element value
- */
-KLIB_EXTERN rc_t CC VectorSwap ( Vector *self, uint32_t idx,
-    const void *item, void **prior );
-
-
-/* Append
- *  appends item to end of vector
- *
- *  "idx" [ OUT, NULL OKAY ] - optional return parameter for item index
- *
- *  "item" [ IN, OPAQUE ] - item to be appended to vector
- */
-KLIB_EXTERN rc_t CC VectorAppend ( Vector *self, uint32_t *idx, const void *item );
-
-
-/* First
- * Last
- *  get item at either end of vector
- */
-KLIB_EXTERN void* CC VectorFirst ( const Vector *self );
-KLIB_EXTERN void* CC VectorLast ( const Vector *self );
-
-
-/* Find
- *  find an object within ordered vector
- *
- *  "key" [ IN ] - find criteria
- *
- *  "idx" [ OUT, NULL OKAY ] - optional return parameter for item index
- *
- *  "cmp" [ IN ] - comparison function that returns
- *  equivalent of "key" - "n"
- */
-KLIB_EXTERN void* CC VectorFind ( const Vector *self, const void *key, uint32_t *idx,
-    int ( CC * cmp ) ( const void *key, const void *n ) );
-
-
-/* Insert
- *  insert an object to vector, even if duplicate
- *
- *  "item" [ IN ] - object to insert
- *
- *  "idx" [ OUT, NULL OKAY ] - optional return parameter for item index
- *
- *  "sort" [ IN ] - comparison function that returns
- *  equivalent of "item" - "n"
- *
- *  the treatment of order for items reported as identical
- *  i.e. sort function returns zero when they are compared,
- *  is undefined.
- *
- *  the current implementation treats '<=' as '<' such
- *  that all inserts are converted to a '<' or '>' comparison,
- *  but this should not be relied upon.
- */
-KLIB_EXTERN rc_t CC VectorInsert ( Vector *self, const void *item, uint32_t *idx,
-    int ( CC * sort ) ( const void *item, const void *n ) );
-
-
-/* InsertUnique
- *  insert an object to vector, but only if unique.
- *
- *  "item" [ IN ] - object to insert
- *
- *  "idx" [ OUT, NULL OKAY ] - optional return parameter for
- *  item index. when return code state is rcExists, this value
- *  will be that of the existing item.
- *
- *  "sort" [ IN ] - comparison function that returns
- *  equivalent of "item" - "n"
- */
-KLIB_EXTERN rc_t CC VectorInsertUnique ( Vector *self, const void *item, uint32_t *idx,
-    int ( CC * sort ) ( const void *item, const void *n ) );
-
-
-/* Merge
- *  merge a sorted vector into an existing, sorted vector
- *
- *  "unique" [ IN ] - eliminate duplicates if true
- *
- *  "v" [ IN ] - sorted vector of elements to merge
- *
- *  "sort" [ IN ] - comparison function that returns
- *  equivalent of "item" - "n"
- */
-KLIB_EXTERN rc_t CC VectorMerge ( Vector *self, bool unique, const Vector *v,
-    int ( CC * sort ) ( const void *item, const void *n ) );
-
-
-/* Remove
- *  retrieves value at given index
- *  shifts all elements to right of index toward start,
- *  preserving order and decrements length by 1
- *  return removed item
- *
- *  "idx" [ IN ] - item index
- *
- *  "removed" [ OUT ] - removed element value
- */
-KLIB_EXTERN rc_t CC VectorRemove ( Vector *self, uint32_t idx, void **removed );
-
-
-/* Reorder
- *  execute ksort on vector with provided function
- */
-KLIB_EXTERN void CC VectorReorder ( Vector *self,
-    int ( CC * cmp ) ( const void**, const void**, void *data ), void *data );
-
-
-/* ForEach
- *  executes a function on each vector element
- *
- *  "reverse" [ IN ] - if true, execute in reverse order
- *
- *  "f" [ IN ] and "data" [ IN, OPAQUE ] - function to be
- *  executed on each vector element
- */
-KLIB_EXTERN void CC VectorForEach ( const Vector *self, bool reverse,
-    void ( CC * f ) ( void *item, void *data ), void *data );
-
-
-/* DoUntil
- *  executes a function on each element
- *  until the function returns true
- *
- *  "reverse" [ IN ] - if true, execute in reverse order
- *
- *  "f" [ IN ] and "data" [ IN, OPAQUE ] - function to be
- *  executed on each vector element or until the function
- *  returns true.
- *
- *  return values:
- *    false unless "f" returns true
- */
-KLIB_EXTERN bool CC VectorDoUntil ( const Vector *self, bool reverse,
-    bool ( CC * f ) ( void *item, void *data ), void *data );
-
-
-/* Whack
- *  removes entries from vector and
- *  executes a user provided destructor
- */
-KLIB_EXTERN void CC VectorWhack ( Vector *self,
-    void ( CC * whack ) ( void *item, void *data ), void *data );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_klib_vector_ */
diff --git a/interfaces/klib/vlen-encode.h b/interfaces/klib/vlen-encode.h
deleted file mode 100644
index c6527dc..0000000
--- a/interfaces/klib/vlen-encode.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#ifndef _h_klib_vlen_encode_
-#define _h_klib_vlen_encode_
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*****************************************************************************
- * This encoding is very similar to X.690's BER and/or Perl's pack('w').
- * It differs in that it handles signed values.
- * It uses bit 6 (of 7..0) of the first byte to store the sign.
- * The layout of bits from 7 to 0, from MSB to LSB is
- *  CSXXXXXX(CXXXXXXX)*
- * where:
- *  C is the continuation flag
- *  S is the sign flag, and
- *  X are the digits of the absolute value of the encoded number.
- * Thus a number x: |x| <
- *  0x40 is encoded in 1 byte,
- *  0x2000 in 2,
- *  0x80000000000000 (i.e. a 55 bit number) in 8, etc.
- * The worst case requires 10 bytes to encode.
- */
-
-/*****************************************************************************
- * encode 1 value into buffer
- *
- * Parameters:
- *  dst, dsize: buffer to write into of length dsize, can be null, 0
- *  act_size: (optional) number of bytes needed to encode
- *  x: the value to encode
- */
-KLIB_EXTERN rc_t CC vlen_encode1 ( void *dst, uint64_t dsize, uint64_t *act_size, int64_t x );
-
-/*****************************************************************************
- * encode array into buffer
- *
- * Parameters:
- *  dst, dsize: buffer to write into of length dsize, can be null, 0
- *  act_size: (optional) number of bytes needed to encode
- *  x, xcount: the array of xcount elements to encode
- */
-KLIB_EXTERN rc_t CC vlen_encode ( void *dst, uint64_t dsize, uint64_t *act_size, 
-        const int64_t x[], uint32_t xcount );
-
-/*****************************************************************************
- * decode 1 value from buffer
- *
- * Parameters:
- *  y: result
- *  src, ssize: buffer to read from of length ssize
- *  consumed: (optional) number of bytes used from src
- */
-KLIB_EXTERN rc_t CC vlen_decode1 ( int64_t *y, const void *src,
-        uint64_t ssize, uint64_t *consumed );
-
-/*****************************************************************************
- * decode array from buffer
- *
- * Parameters:
- *  y, count: result array of ycount elements
- *  src, ssize: buffer to read from of length ssize
- *  consumed: (optional) number of bytes used from src
- */
-KLIB_EXTERN rc_t CC vlen_decode ( int64_t *y, uint64_t ycount, const void *src,
-        uint64_t ssize, uint64_t *consumed );
-
-
-/*****************************************************************************
- * This encoding is very similar to X.690's BER and/or Perl's pack('w').
- * The layout of bits from 7 to 0, from MSB to LSB is
- *  CXXXXXXX(CXXXXXXX)*
- * where:
- *  C is the continuation flag
- *  X are the digits of the encoded number.
- * The worst case requires 10 bytes to encode.
- */
-
-/*****************************************************************************
- * encode 1 value into buffer
- *
- * Parameters:
- *  dst, dsize: buffer to write into of length dsize, can be null, 0
- *  act_size: (optional) number of bytes needed to encode
- *  x: the value to encode
- */
-KLIB_EXTERN rc_t CC vlen_encodeU1 ( void *dst, uint64_t dsize,
-        uint64_t *act_size, uint64_t x );
-
-/*****************************************************************************
- * encode array into buffer
- *
- * Parameters:
- *  dst, dsize: buffer to write into of length dsize, can be null, 0
- *  act_size: (optional) number of bytes needed to encode
- *  x, xcount: the array of xcount elements to encode
- */
-KLIB_EXTERN rc_t CC vlen_encodeU ( void *dst, uint64_t dsize, uint64_t *act_size,
-        const uint64_t x[], uint32_t xcount );
-
-/*****************************************************************************
- * decode 1 value from buffer
- *
- * Parameters:
- *  y: result
- *  src, ssize: buffer to read from of length ssize
- *  consumed: (optional) number of bytes used from src
- */
-KLIB_EXTERN rc_t CC vlen_decodeU1 ( uint64_t *y, const void *src, 
-        uint64_t ssize, uint64_t *consumed );
-
-/*****************************************************************************
- * decode array from buffer
- *
- * Parameters:
- *  y, count: result array of ycount elements
- *  src, ssize: buffer to read from of length ssize
- *  consumed: (optional) number of bytes used from src
- */
-KLIB_EXTERN rc_t CC vlen_decodeU ( uint64_t *y, uint64_t ycount, const void *src, 
-        uint64_t ssize, uint64_t *consumed );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_klib_vlen_encode_ */
diff --git a/interfaces/klib/writer.h b/interfaces/klib/writer.h
deleted file mode 100644
index 4c8c175..0000000
--- a/interfaces/klib/writer.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_klib_writer_
-#define _h_klib_writer_
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifndef _h_klib_logfmt_
-#include <klib/logfmt.h>
-#endif
-
-#include <stdarg.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* ----------
- * The writer module (which contains the log, status, out, and debug sub-modules)
- * is an ecapsulation and virtualization of standard output.
- *
- *  this logging API - like most others - attempts to remain isolated
- *  from any actual logging implementation, such that output may be
- *  routed in several ways.
- *
- *  the default handler
- *
- *  the path from unstructured text to formatted XML is difficult in that
- *  it requires parsing, and is therefore error prone.
- *
- *  the path from structured reports to XML as well as less or unstructured
- *  text is simple to implement, but generally more of a burden to use.
- *
- *  the challenge is therefore to present an API that makes structured
- *  logging less painful than it might be.
- *
- *
- * There are two parts with an unfortunate legacy quirky combination.
- *  There is a formater that will be shared by all sub-modules.
- *  There is the actual stream writer.
- *
- * Each submodule will have one or more calls that call the formatter and writer functions.
- */
-KLIB_EXTERN rc_t CC KWrtInit ( const char * appname, uint32_t vers );
-
-/* -----
- * The writer module core file/stream output function:
- *
- * The function's prototype matches as much as possible the KFS file writer prototype.
- *
- * If the self structure contained a KFile * and a position it could use the KFS file write
- */
-
-typedef rc_t ( CC * KWrtWriter ) ( void * self, const char * buffer, size_t bufsize, size_t * num_writ );
-
-/* ----
- * a Writer handler combines the function and its self object
- */
-typedef struct KWrtHandler
-{
-    KWrtWriter writer;
-    void *     data;    /* the actual type depends upon the writer function */
-} KWrtHandler;
-
-
-/*--------------------------------------------------------------------------
- * nvp - name/value pair
- */
-typedef struct wrt_nvp_t_struct {
-    const char *name;
-    const char *value;
-} wrt_nvp_t;
-
-KLIB_EXTERN void CC wrt_nvp_sort(size_t argc, wrt_nvp_t argv[]);
-KLIB_EXTERN const wrt_nvp_t* CC wrt_nvp_find( size_t argc, const wrt_nvp_t argv[], const char* key );
-KLIB_EXTERN const char* CC wrt_nvp_find_value( size_t argc, const wrt_nvp_t argv[], const char* key );
-
-/* -----
- * The formatter module core file/stream output function:
- *
- */
-
-typedef rc_t ( CC * KFmtWriter ) ( void* self, KWrtHandler* writer,
-                                   size_t argc, const wrt_nvp_t args[],
-                                   size_t envc, const wrt_nvp_t envs[]);
-/* ----
- * a formatter handler combines the function and custom data
- */
-typedef struct KFmtHandler KFmtHandler;
-struct KFmtHandler
-{
-    KFmtWriter formatter;
-    void* data;    /* the actual type depends upon the writer function */
-};
-
-
-/* kprintf
- *  performs a printf to our output writer
- */
-KLIB_EXTERN rc_t CC kprintf ( size_t *num_writ, const char * fmt, ... );
-KLIB_EXTERN rc_t CC vkprintf ( size_t *num_writ, const char * fmt, va_list args );
-
-
-/* kfprintf
- *  performs a printf to a KWrtHandler
- */
-KLIB_EXTERN rc_t CC kfprintf ( const KWrtHandler *out,
-    size_t *num_writ, const char * fmt, ... );
-KLIB_EXTERN rc_t CC vkfprintf ( const KWrtHandler *out,
-    size_t *num_writ, const char * fmt, va_list args );
-
-
-/* RCExplain
- *  explains rc code in "English'ish" language
- */
-KLIB_EXTERN rc_t CC RCExplain ( rc_t rc, char *buffer, size_t bsize, size_t *num_writ );
-
-KLIB_EXTERN rc_t CC LogInsertSpace(const char *spacer, char *buffer, size_t bsize, size_t *num_writ);
-
-/* generates a timestamp-string in GMT-time */
-KLIB_EXTERN rc_t CC LogTimestamp ( char *buffer, size_t bsize, size_t *num_writ );
-
-/* generates a timestamp-string in local time */
-KLIB_EXTERN rc_t CC LogSimpleTimestamp ( char *buffer, size_t bsize, size_t *num_writ );
-
-KLIB_EXTERN rc_t CC LogPID ( char *buffer, size_t bsize, size_t *num_writ );
-KLIB_EXTERN rc_t CC LogAppName ( char *buffer, size_t bsize, size_t *num_writ );
-KLIB_EXTERN rc_t CC LogAppVersion ( char *buffer, size_t bsize, size_t *num_writ );
-
-/* FlushLine
- *  flushes a buffer through output handler
- */
-KLIB_EXTERN rc_t CC LogFlush ( const KWrtHandler * handler, const char *buffer, const size_t bsize );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_klib_writer_ */
diff --git a/interfaces/kns/adapt.h b/interfaces/kns/adapt.h
deleted file mode 100644
index dd6d2c3..0000000
--- a/interfaces/kns/adapt.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kns_adapt_
-#define _h_kns_adapt_
-
-#ifndef _h_kns_extern_
-#include <kns/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KFile;
-struct KStream;
-
-
-/*--------------------------------------------------------------------------
- * KStream
- *  adapters between KFile and KStream
- */
-
-/* FromKFilePair
- *  create a KStream from a pair of KFiles
- *  maintains a "pos" marker for input and output files
- *
- *  "strm" [ OUT ] - resultant KStream
- *
- *  "read" [ IN, NULL OKAY ] - file to use for stream reading
- *
- *  "write" [ IN, NULL OKAY ] - file to use for stream writing
- *
- * NB - EITHER "read" or "write" may be NULL, but not both.
- */
-KNS_EXTERN rc_t CC KStreamFromKFilePair ( struct KStream **strm,
-    struct KFile const *read, struct KFile *write );
-
-/* FromKStreamPair
- *  create a KStream from a pair of KStreams
- *
- *  "strm" [ OUT ] - resultant KStream
- *
- *  "read" [ IN, NULL OKAY ] - stream to use for input
- *
- *  "write" [ IN, NULL OKAY ] - stream to use for output
- *
- * NB - EITHER "read" or "write" may be NULL, but not both.
- */
-KNS_EXTERN rc_t CC KStreamFromKStreamPair ( struct KStream **strm,
-    struct KStream const *read, struct KStream *write );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kns_adapt_ */
diff --git a/interfaces/kns/ascp.h b/interfaces/kns/ascp.h
deleted file mode 100644
index eea8bda..0000000
--- a/interfaces/kns/ascp.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kns_ascp_
-#define _h_kns_ascp_
-
-#ifndef _h_kns_extern_
-#include <kns/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum
-{
-    eAscpStateRunning,
-    eAscpStateExitSuccess,
-    eAscpStateExitWriteFailure,
-    eAscpStateExitFailure
-};
-
-typedef rc_t TQuitting ( void );
-typedef bool TProgress ( uint64_t id,
-    uint64_t state, uint64_t size, uint64_t percentage );
-
-typedef struct AscpOptions AscpOptions;
-struct AscpOptions
-{
-    uint64_t src_size;
-
-    uint64_t heartbeat;       /* in milliseconds */
-
-    uint64_t id; /* to pass to the callback */
-
-    const char *host;
-    const char *user;
-    const char *target_rate;
-       /* -l MAX-RATE Set the target transfer rate in Kbps */
-
-/* progress logging */
-    const char *name;
-
-    TProgress *callback;
-
-    TQuitting *quitting;
-
-    bool status; /* whether to call STSMSG */
-
-    bool cache_key; /* Add the server's host key to PuTTY's cache */
-
-    bool disabled; /* output parameter for aspera_options */
-};
-
-/**  status - whether to print STSMSG(1-2) - information messages
-    ascp_bin and private_file should be freed by the caller */
-KNS_EXTERN rc_t CC ascp_locate ( const char **ascp_bin, const char **private_file,
-    bool use_config, bool status );
-
-/** Get a file by running aspera ascp binary */
-KNS_EXTERN rc_t CC aspera_get ( const char *ascp_bin, const char *private_file,
-    const char *src, const char *dest, AscpOptions *opt );
-
-/** Fill AscpOptions members initialized by ascp library */
-KNS_EXTERN rc_t CC aspera_options ( AscpOptions *opt );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/interfaces/kns/endpoint.h b/interfaces/kns/endpoint.h
deleted file mode 100644
index 22e0df1..0000000
--- a/interfaces/kns/endpoint.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifndef _h_kns_endpoint_
-#define _h_kns_endpoint_
-
-#ifndef _h_kns_extern_
-#include <kns/extern.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct String;
-struct KNSManager;
-
-
-/*--------------------------------------------------------------------------
- * KEndPoint
- *  describe a socket endpoint
- */
- 
-typedef uint32_t KEndPointType;
-enum
-{
-    epIPV4,
-    epIPC
-};
-
-#define IPC_NAME_MAX 256
-
-typedef struct KEndPoint KEndPoint;
-struct KEndPoint
-{
-	union 
-	{
-		struct
-		{
-			uint32_t addr;
-			uint16_t port;
-		} ipv4;
-
-		char ipc_name [ IPC_NAME_MAX ];
-	} u;
-
-    KEndPointType type;
-};
-
-
-/* InitIPv4Endpoint
- *  initialize the endpoint with an IPv4 address and port
- *
- *  "ep" [ OUT ] - address of endpoint block to be intialized
- *
- *  "ipv4" [ IN, DEFAULT 0 ] - binary IPv4 address in native integer byte order
- *   i.e. 0x7F000001 represents 127.0.0.1. if the special address 0 is given, it
- *   represents any host-local interface address.
- *
- *  "port" [ IN, DEFAULT 0 ] - binary port number in native integer byte order.
- *   if the special port number 0 is given, it represents any available port.
- */
-KNS_EXTERN rc_t CC KNSManagerInitIPv4Endpoint ( struct KNSManager const *self,
-    KEndPoint *ep, uint32_t ipv4, uint16_t port );
-
-
-/* InitDNSEndpoint
- *  initialize the endpoint with a DNS name and a port number
- *
- *  "ep" [ OUT ] - address of endpoint block to be intialized
- *
- *  "dns" [ IN ] - textual DNS address.
- *
- *  "port" [ IN, DEFAULT 0 ] - binary port number in native integer byte order.
- *   if the special port number 0 is given, it represents any available port.
- */
-KNS_EXTERN rc_t CC KNSManagerInitDNSEndpoint ( struct KNSManager const *self,
-    KEndPoint *ep, struct String const *dns, uint16_t port );
-
-/* InitIPCEndpoint
- *  initialize the endpoint for interprocess communication
- *
- *  "ep" [ OUT ] - address of endpoint block to be intialized
- *
- *  "name" [ IN ] - IPC channel name
- *   ( a POSIX path to a Unix socket, or a name of a Windows pipe )
- */
-KNS_EXTERN rc_t CC KNSManagerInitIPCEndpoint ( struct KNSManager const *self,
-    KEndPoint *ep, struct String const * name );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kns_endpoint_ */
diff --git a/interfaces/kns/extern.h b/interfaces/kns/extern.h
deleted file mode 100644
index afd5c00..0000000
--- a/interfaces/kns/extern.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kns_extern_
-#define _h_kns_extern_
-
-#if ! defined EXPORT_LATCH && defined _LIBRARY
-#define KNS_EXTERN LIB_EXPORT
-#define EXPORT_LATCH 1
-#else
-#define KNS_EXTERN LIB_IMPORT
-#endif
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#endif /* _h_kns_extern_ */
diff --git a/interfaces/kns/http.h b/interfaces/kns/http.h
deleted file mode 100644
index 8d14063..0000000
--- a/interfaces/kns/http.h
+++ /dev/null
@@ -1,301 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kns_http_
-#define _h_kns_http_
-
-#ifndef _h_kns_extern_
-#include <kns/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#include <stdarg.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KFile;
-struct String;
-struct KStream;
-struct KNSManager;
-
-
-/*--------------------------------------------------------------------------
- * KNSManager
- */
-
-/* SetHTTPTimeouts
- *  sets default read/write timeouts to supply to HTTP connections
- *
- *  "readMillis" [ IN ] and "writeMillis" - when negative, infinite timeout
- *   when 0, return immediately, positive gives maximum wait time in mS
- *   for reads and writes respectively.
- */
-KNS_EXTERN rc_t CC KNSManagerSetHTTPTimeouts ( struct KNSManager *self,
-    int32_t readMillis, int32_t writeMillis );
-
-
-/*--------------------------------------------------------------------------
- * KHttp
- *  hyper text transfer protocol
- */
-typedef struct KHttp KHttp;
-
-
-/* MakeHttp
- *  create an HTTP protocol
- *
- *  "http" [ OUT ] - return parameter for HTTP object
- *
- *  "opt_conn" [ IN, NULL OKAY ] - previously opened stream for communications.
- *
- *  "vers" [ IN ] - http version
- *   the only legal types are 1.0 ( 0x01000000 ) and 1.1 ( 0x01010000 )
- *
- *  "readMillis" [ IN ] and "writeMillis" - when negative, infinite timeout
- *   when 0, return immediately, positive gives maximum wait time in mS
- *   for reads and writes respectively.
- *
- *  "host" [ IN ] - parameter to give the host dns name for the connection
- *
- *  "port" [ IN, DEFAULT ZERO ] - if zero, defaults to standard for scheme
- *   if non-zero, is taken as explicit port specification
- */
-KNS_EXTERN rc_t CC KNSManagerMakeHttp ( struct KNSManager const *self,
-    KHttp **http, struct KStream *conn, ver_t vers,
-    struct String const *host, uint32_t port );
-
-KNS_EXTERN rc_t CC KNSManagerMakeTimedHttp ( struct KNSManager const *self, KHttp **http,
-    struct KStream *opt_conn, ver_t vers, int32_t readMillis, int32_t writeMillis,
-    struct String const *host, uint32_t port );
-
-
-/* AddRef
- * Release
- *  ignores NULL references
- */
-KNS_EXTERN rc_t CC KHttpAddRef ( const KHttp *self );
-KNS_EXTERN rc_t CC KHttpRelease ( const KHttp *self );
-
-
-
-/*------------------------------------------------------------------------------
- * KFile
- *  a KFile over HTTP
- */
-
-/* Make
- */
-KNS_EXTERN rc_t CC KNSManagerMakeHttpFile ( struct KNSManager const *self,
-    struct KFile const **file, struct KStream *conn, ver_t vers, const char *url, ... );
-KNS_EXTERN rc_t CC KNSManagerVMakeHttpFile ( struct KNSManager const *self,
-    struct KFile const **file, struct KStream *conn, ver_t vers, const char *url, va_list args );
-
-
-/*------------------------------------------------------------------------------
- * KHttpRequest
- *  hyper text transfer protocol
- */
-typedef struct KHttpRequest KHttpRequest;
-
-
-/* MakeRequest
- *  create a request that can be used to contact HTTP server
- *
- *  "req" [ OUT ] - return parameter for HTTP request object
- *
- *  "vers" [ IN ] - http version
- *
- *  "conn" [ IN, NULL OKAY ] - previously opened stream for communications.
- *
- *  "url" [ IN ] - full resource identifier. if "conn" is NULL,
- *   the url is parsed for remote endpoint and is opened by mgr.
- */
-KNS_EXTERN rc_t CC KHttpMakeRequest ( const KHttp *self,
-    KHttpRequest **req, const char *url, ... );
-
-KNS_EXTERN rc_t CC KNSManagerMakeRequest ( struct KNSManager const *self,
-    KHttpRequest **req, ver_t version, struct KStream *conn, const char *url, ... );
-
-
-/* AddRef
- * Release
- *  ignores NULL references
- */
-KNS_EXTERN rc_t CC KHttpRequestAddRef ( const KHttpRequest *self );
-KNS_EXTERN rc_t CC KHttpRequestRelease ( const KHttpRequest *self );
-
-
-/* Connection
- *  sets connection management headers
- *
- *  "close" [ IN ] - if "true", inform the server to close the connection
- *   after its response ( default for version 1.0 ). when "false" ( default
- *   for version 1.1 ), ask the server to keep the connection open.
- *
- * NB - the server is not required to honor the request
- */
-KNS_EXTERN rc_t CC KHttpRequestConnection ( KHttpRequest *self, bool close );
-
-
-/* ByteRange
- *  set requested byte range of response
- *
- *  "pos" [ IN ] - beginning offset within remote entity
- *
- *  "bytes" [ IN ] - the number of bytes being requested
- */
-KNS_EXTERN rc_t CC KHttpRequestByteRange ( KHttpRequest *self, uint64_t pos, size_t bytes );
-
-
-/* AddHeader
- *  allow addition of an arbitrary HTTP header to message
- */
-KNS_EXTERN rc_t CC KHttpRequestAddHeader ( KHttpRequest *self,
-    const char *name, const char *val, ... );
-
-
-/* AddPostParam
- *  adds a parameter for POST
- */
-KNS_EXTERN rc_t CC KHttpRequestAddPostParam ( KHttpRequest *self, const char *fmt, ... );
-KNS_EXTERN rc_t CC KHttpRequestVAddPostParam ( KHttpRequest *self, const char *fmt, va_list args );
-
-
-/*--------------------------------------------------------------------------
- * KHttpResult
- *  hyper text transfer protocol
- */
-typedef struct KHttpResult KHttpResult;
-
-
-/* AddRef
- * Release
- *  ignores NULL references
- */
-KNS_EXTERN rc_t CC KHttpResultAddRef ( const KHttpResult *self );
-KNS_EXTERN rc_t CC KHttpResultRelease ( const KHttpResult *self );
-
-
-/* HEAD
- *  send HEAD message
- */
-KNS_EXTERN rc_t CC KHttpRequestHEAD ( KHttpRequest *self, KHttpResult **rslt ); 
-
-/* GET
- *  send GET message
- *  all query AND post parameters are combined in URL
- */
-KNS_EXTERN rc_t CC KHttpRequestGET ( KHttpRequest *self, KHttpResult **rslt ); 
-
-/* POST
- *  send POST message
- *  query parameters are sent in URL
- *  post parameters are sent in body
- */
-KNS_EXTERN rc_t CC KHttpRequestPOST ( KHttpRequest *self, KHttpResult **rslt ); 
-
-
-/* Status
- *  access the response status code
- *  and optionally the message
- *
- *  "code" [ OUT ] - return parameter for status code
- *
- *  "msg_buff" [ IN, NULL OKAY ] and "buff_size" [ IN, ZERO OKAY ] -
- *   buffer for capturing returned message
- *
- *  "msg_size" [ OUT, NULL OKAY ] - size of returned message in bytes
- */
-KNS_EXTERN rc_t CC KHttpResultStatus ( const KHttpResult *self, uint32_t *code,
-    char *msg_buff, size_t buff_size, size_t *msg_size );
-
-
-/* KeepAlive
- *  retrieves keep-alive property of response
- *  requires HTTP/1.1
- */
-KNS_EXTERN bool CC KHttpResultKeepAlive ( const KHttpResult *self );
-
-
-/* Range
- *  retrieves position and partial size for partial requests
- *
- *  "pos" [ OUT ] - offset to beginning portion of response
- *
- *  "bytes" [ OUT ] - size of range
- */
-KNS_EXTERN rc_t CC KHttpResultRange ( const KHttpResult *self, uint64_t *pos, size_t *bytes );
-
-
-/* Size
- *  retrieves overall size of entity, if known
- *
- *  "response_size" [ OUT ] - size in bytes of response
- *   this is the number of bytes that may be expected from the input stream
- */
-KNS_EXTERN bool CC KHttpResultSize ( const KHttpResult *self, uint64_t *size );
-
-
-/* AddHeader
- *  allow addition of an arbitrary HTTP header to RESPONSE
- *  this can be used to repair or normalize odd server behavior
- */
-KNS_EXTERN rc_t CC KHttpResultAddHeader ( KHttpResult *self,
-    const char *name, const char *val, ... );
-
-
-/* GetHeader
- *  retrieve named header if present
- *  this cand potentially return a comma separated value list
- */
-KNS_EXTERN rc_t CC KHttpResultGetHeader ( const KHttpResult *self, const char *name,
-    char *buffer, size_t bsize, size_t *num_read );
-
-
-/* GetInputStream
- *  access the body of response as a stream
- *  only reads are supported
- *
- *  "s" [ OUT ] - return parameter for input stream reference
- *   must be released via KStreamRelease
- */
-KNS_EXTERN rc_t CC KHttpResultGetInputStream ( KHttpResult *self,
-    struct KStream  ** s );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kns_http_ */
diff --git a/interfaces/kns/impl.h b/interfaces/kns/impl.h
deleted file mode 100644
index f04ad86..0000000
--- a/interfaces/kns/impl.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kns_impl_
-#define _h_kns_impl_
-
-#ifndef _h_kns_extern_
-#include <kns/extern.h>
-#endif
-
-#ifndef _h_kns_stream_
-#include <kns/stream.h>
-#endif
-
-#ifndef _h_klib_refcount_
-#include <klib/refcount.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-typedef union KStream_vt KStream_vt;
-
-
-/*--------------------------------------------------------------------------
- * KStream
- *  a virtual stream
- */
-struct KStream
-{
-    const KStream_vt *vt;
-    KRefcount refcount;
-    uint8_t read_enabled;
-    uint8_t write_enabled;
-    uint8_t align [ 2 ];
-};
-
-#ifndef KSTREAM_IMPL
-#define KSTREAM_IMPL struct KStream
-#endif
-
-typedef struct KStream_vt_v1 KStream_vt_v1;
-struct KStream_vt_v1
-{
-    /* version == 1.x */
-    uint32_t maj;
-    uint32_t min;
-
-    /* start minor version == 0 */
-    rc_t ( CC * destroy ) ( KSTREAM_IMPL *self );
-    rc_t ( CC * read ) ( const KSTREAM_IMPL *self,
-        void *buffer, size_t bsize, size_t *num_read );
-    rc_t ( CC * write ) ( KSTREAM_IMPL *self,
-        const void *buffer, size_t size, size_t *num_writ );
-    /* end minor version == 0 */
-
-    /* start minor version == 1 */
-    rc_t ( CC * timed_read ) ( const KSTREAM_IMPL *self,
-        void *buffer, size_t bsize, size_t *num_read, struct timeout_t *tm );
-    rc_t ( CC * timed_write ) ( KSTREAM_IMPL *self,
-        const void *buffer, size_t size, size_t *num_writ, struct timeout_t *tm );
-    /* end minor version == 1 */
-};
-
-union KStream_vt
-{
-    KStream_vt_v1 v1;
-};
-
-
-/* Init
- *  initialize a newly allocated stream object
- */
-KNS_EXTERN rc_t CC KStreamInit ( KStream *self, const KStream_vt *vt,
-    const char *classname, const char *strname,
-    bool read_enabled, bool write_enabled );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kns_impl_ */
diff --git a/interfaces/kns/manager-ext.h b/interfaces/kns/manager-ext.h
deleted file mode 100644
index cdab1d5..0000000
--- a/interfaces/kns/manager-ext.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifndef _h_kns_manager_ext_
-#define _h_kns_manager_ext_
-
-#ifndef _h_kns_manager_
-#include <kns/manager.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct SraReleaseVersion;
-
-
-/*--------------------------------------------------------------------------
- * KNSManager Extension
- */
-
-/* NewReleaseVersion
- *  Get release version of the new (latest available) public SRA Toolkit
- */
-KNS_EXTERN rc_t CC KNSManagerNewReleaseVersion ( const KNSManager *self,
-    struct SraReleaseVersion *newVersion );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kns_manager_ext_ */
diff --git a/interfaces/kns/manager.h b/interfaces/kns/manager.h
deleted file mode 100644
index fe731b2..0000000
--- a/interfaces/kns/manager.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifndef _h_kns_manager_
-#define _h_kns_manager_
-
-#ifndef _h_kns_extern_
-#include <kns/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-
-
-/*--------------------------------------------------------------------------
- * KNSManager
- *  manages the network system
- */
-typedef struct KNSManager KNSManager;
-
-
-/* Make
- *  create a manager instance
- */
-KNS_EXTERN rc_t CC KNSManagerMake ( KNSManager **mgr );
-
-
-/* AddRef
- * Release
- *  ignores NULL references
- */
-KNS_EXTERN rc_t CC KNSManagerAddRef ( const KNSManager *self );
-KNS_EXTERN rc_t CC KNSManagerRelease ( const KNSManager *self );
-
-
-/* SetVerbose
- *  set/clear verbosity flag of manager ( dflt is false )...
- *  the network-code has to request it
- */
-KNS_EXTERN void CC KNSManagerSetVerbose ( KNSManager *self, bool verbosity );
-
-
-/* IsVerbose
- *  request the verbosity flag of manager ( dflt is false )...
- */
-KNS_EXTERN bool CC KNSManagerIsVerbose ( const KNSManager *self );
-
-
-/* SetConnectionTimeouts
- *  sets default connect/read/write timeouts to supply to sockets
- *
- *  "connectMillis", "readMillis", "writeMillis" [ IN ] - when negative, infinite timeout
- *  when 0, return immediately, positive gives maximum wait time in sec/mS
- *  for connects, reads and writes respectively.
- */
-KNS_EXTERN rc_t CC KNSManagerSetConnectionTimeouts ( KNSManager *self,
-    int32_t connectSecs, int32_t readMillis, int32_t writeMillis );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kns_manager_ */
diff --git a/interfaces/kns/socket.h b/interfaces/kns/socket.h
deleted file mode 100644
index e47f55d..0000000
--- a/interfaces/kns/socket.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifndef _h_kns_socket_
-#define _h_kns_socket_
-
-#ifndef _h_kns_extern_
-#include <kns/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KStream;
-struct KEndPoint;
-struct KNSManager;
-
-/*--------------------------------------------------------------------------
- * KSocket
- */
-typedef struct KSocket KSocket;
-
-
-/* MakeConnection
- * MakeTimedConnection
- * MakeRetryConnection
- * MakeRetryTimedConnection
- *  create a connection-oriented stream
- *
- *  "conn" [ OUT ] - a stream for communication with the server
- *
- *  "retryTimeout" [ IN ] - if connection is refused, retry with 1ms intervals: when negative, retry infinitely,
- *   when 0, do not retry, positive gives maximum wait time in seconds 
- *
- *  "readMillis" [ IN ] and "writeMillis" - when negative, infinite timeout
- *   when 0, return immediately, positive gives maximum wait time in mS
- *   for reads and writes respectively.
- *
- *  "from" [ IN ] - client endpoint
- *
- *  "to" [ IN ] - server endpoint 
- *
- *  both endpoints have to be of type epIP; creates a TCP connection
- */
-KNS_EXTERN rc_t CC KNSManagerMakeConnection ( struct KNSManager const * self,
-    struct KStream **conn, struct KEndPoint const *from, struct KEndPoint const *to );
-
-KNS_EXTERN rc_t CC KNSManagerMakeTimedConnection ( struct KNSManager const * self,
-    struct KStream **conn, int32_t readMillis, int32_t writeMillis,
-    struct KEndPoint const *from, struct KEndPoint const *to );
-
-KNS_EXTERN rc_t CC KNSManagerMakeRetryConnection ( struct KNSManager const * self,
-    struct KStream **conn, int32_t retryTimeout, struct KEndPoint const *from, struct KEndPoint const *to );
-
-KNS_EXTERN rc_t CC KNSManagerMakeRetryTimedConnection ( struct KNSManager const * self,
-    struct KStream **conn, int32_t retryTimeout, int32_t readMillis, int32_t writeMillis,
-    struct KEndPoint const *from, struct KEndPoint const *to );
-
-/* MakeListener
- *  create a listener socket for accepting incoming IPC connections
- *
- *  "ep" [ IN ] - a local endpoint
- *
- *  "listener" [ IN ] - a listener socket
- */
-KNS_EXTERN rc_t CC KNSManagerMakeListener ( struct KNSManager const *self,
-    KSocket **listener, struct KEndPoint const * ep );
-
-
-/* AddRef
- * Release
- */
-KNS_EXTERN rc_t CC KSocketAddRef ( KSocket *self );
-KNS_EXTERN rc_t CC KSocketRelease ( KSocket *self );
-
-
-/* Accept
- *  enter listening state upon first use,
- *  wait for an incoming connection
- *
- *  "conn" [ OUT ] - a stream for communication with the client 
- */
-KNS_EXTERN rc_t CC KSocketAccept ( KSocket *self, struct KStream **conn );
-KNS_EXTERN rc_t CC KSocketListen ( KSocket *self, struct KStream **conn, remove_t *ignore );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kns_socket_ */
diff --git a/interfaces/kns/stream.h b/interfaces/kns/stream.h
deleted file mode 100644
index 31ac047..0000000
--- a/interfaces/kns/stream.h
+++ /dev/null
@@ -1,210 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kns_stream_
-#define _h_kns_stream_
-
-#ifndef _h_kns_extern_
-#include <kns/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct timeout_t;
-
-
-/*--------------------------------------------------------------------------
- * KStream
- *  the stream is defined to have no concept of size,
- *  and to not support any form of random access
- */
-typedef struct KStream KStream;
-
-
-/* AddRef
- * Release
- *  ignores NULL references
- */
-KNS_EXTERN rc_t CC KStreamAddRef ( const KStream *self );
-KNS_EXTERN rc_t CC KStreamRelease ( const KStream *self );
-
-
-/* Read
- * TimedRead
- *  read data from stream
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT ] - return parameter giving number of bytes
- *  actually read. when returned value is zero and return code is
- *  also zero, interpreted as end of stream.
- *
- *  "tm" [ IN/OUT, NULL OKAY ] - an optional indicator of
- *  blocking behavior. not all implementations will support
- *  timed reads. a NULL timeout will block indefinitely,
- *  a value of "tm->mS == 0" will have non-blocking behavior
- *  if supported by implementation, and "tm->mS > 0" will indicate
- *  a maximum wait timeout.
- */
-KNS_EXTERN rc_t CC KStreamRead ( const KStream *self,
-    void *buffer, size_t bsize, size_t *num_read );
-KNS_EXTERN rc_t CC KStreamTimedRead ( const KStream *self,
-    void *buffer, size_t bsize, size_t *num_read, struct timeout_t *tm );
-
-/* ReadAll
- * TimedReadAll
- *  read from stream until "bsize" bytes have been retrieved
- *  or until end-of-input
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT ] - return parameter giving number of bytes
- *  actually read. when returned value is zero and return code is
- *  also zero, interpreted as end of stream.
- *
- *  "tm" [ IN/OUT, NULL OKAY ] - an optional indicator of
- *  blocking behavior. not all implementations will support
- *  timed reads. a NULL timeout will block indefinitely,
- *  a value of "tm->mS == 0" will have non-blocking behavior
- *  if supported by implementation, and "tm->mS > 0" will indicate
- *  a maximum wait timeout.
- */
-KNS_EXTERN rc_t CC KStreamReadAll ( const KStream *self,
-    void *buffer, size_t bsize, size_t *num_read );
-KNS_EXTERN rc_t CC KStreamTimedReadAll ( const KStream *self,
-    void *buffer, size_t bsize, size_t *num_read, struct timeout_t *tm );
-
-/* ReadExactly
- * TimedReadExactly
- *  read from stream until "bytes" have been retrieved
- *  or return incomplete transfer
- *
- *  "buffer" [ OUT ] and "bytes" [ IN ] - return buffer for read
- *
- *  "tm" [ IN/OUT, NULL OKAY ] - an optional indicator of
- *  blocking behavior. not all implementations will support
- *  timed reads. a NULL timeout will block indefinitely,
- *  a value of "tm->mS == 0" will have non-blocking behavior
- *  if supported by implementation, and "tm->mS > 0" will indicate
- *  a maximum wait timeout.
- */
-KNS_EXTERN rc_t CC KStreamReadExactly ( const KStream *self,
-    void *buffer, size_t bytes );
-KNS_EXTERN rc_t CC KStreamTimedReadExactly ( const KStream *self,
-    void *buffer, size_t bytes, struct timeout_t *tm );
-
-
-/* Write
- * TimedWrite
- *  send data to stream
- *
- *  "buffer" [ IN ] and "size" [ IN ] - data to be written
- *
- *  "num_writ" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually written
- *
- *  "tm" [ IN/OUT, NULL OKAY ] - an optional indicator of
- *  blocking behavior. not all implementations will support
- *  timed writes. a NULL timeout will block indefinitely,
- *  a value of "tm->mS == 0" will have non-blocking behavior
- *  if supported by implementation, and "tm->mS > 0" will indicate
- *  a maximum wait timeout.
- */
-KNS_EXTERN rc_t CC KStreamWrite ( KStream *self,
-    const void *buffer, size_t size, size_t *num_writ );
-KNS_EXTERN rc_t CC KStreamTimedWrite ( KStream *self,
-    const void *buffer, size_t size, size_t *num_writ, struct timeout_t *tm );
-
-/* WriteAll
- * TimedWriteAll
- *  write to stream until "size" bytes have been transferred
- *  or until no further progress can be made
- *
- *  "buffer" [ IN ] and "size" [ IN ] - data to be written
- *
- *  "num_writ" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually written
- *
- *  "tm" [ IN/OUT, NULL OKAY ] - an optional indicator of
- *  blocking behavior. not all implementations will support
- *  timed writes. a NULL timeout will block indefinitely,
- *  a value of "tm->mS == 0" will have non-blocking behavior
- *  if supported by implementation, and "tm->mS > 0" will indicate
- *  a maximum wait timeout.
- */
-KNS_EXTERN rc_t CC KStreamWriteAll ( KStream *self,
-    const void *buffer, size_t size, size_t *num_writ );
-KNS_EXTERN rc_t CC KStreamTimedWriteAll ( KStream *self,
-    const void *buffer, size_t size, size_t *num_writ, struct timeout_t *tm );
-
-/* WriteExactly
- * TimedWriteExactly
- *  write to stream until "bytes" have been transferred
- *  or return incomplete transfer error
- *
- *  "buffer" [ IN ] and "bytes" [ IN ] - data to be written
- *
- *  "tm" [ IN/OUT, NULL OKAY ] - an optional indicator of
- *  blocking behavior. not all implementations will support
- *  timed writes. a NULL timeout will block indefinitely,
- *  a value of "tm->mS == 0" will have non-blocking behavior
- *  if supported by implementation, and "tm->mS > 0" will indicate
- *  a maximum wait timeout.
- */
-KNS_EXTERN rc_t CC KStreamWriteExactly ( KStream *self,
-    const void *buffer, size_t bytes );
-KNS_EXTERN rc_t CC KStreamTimedWriteExactly ( KStream *self,
-    const void *buffer, size_t bytes, struct timeout_t *tm );
-
-
-/* MakeStdIn
- *  creates a read-only stream on stdin
- */
-KNS_EXTERN rc_t CC KStreamMakeStdIn ( const KStream **std_in );
-
-/* MakeStdOut
- * MakeStdErr
- *  creates a write-only stream on stdout or stderr
- */
-KNS_EXTERN rc_t CC KStreamMakeStdOut ( KStream **std_out );
-KNS_EXTERN rc_t CC KStreamMakeStdErr ( KStream **std_err );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kns_stream_ */
diff --git a/interfaces/kproc/barrier.h b/interfaces/kproc/barrier.h
deleted file mode 100644
index 46655d7..0000000
--- a/interfaces/kproc/barrier.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kproc_barrier_
-#define _h_kproc_barrier_
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifndef _h_kproc_extern_
-#include <kproc/extern.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * KBarrier
- *  a thread synchronization device
- *  detains all callers until the required number has been reached
- */
-typedef struct KBarrier KBarrier;
-
-
-/* Make
- *  create a barrier
- *
- *  "count" [ IN ] - the number of threads to block
- */
-KPROC_EXTERN rc_t CC KBarrierMake ( KBarrier **b, uint32_t count );
-
-
-/* AddRef
- * Release
- */
-KPROC_EXTERN rc_t CC KBarrierAddRef ( const KBarrier *self );
-KPROC_EXTERN rc_t CC KBarrierRelease ( const KBarrier *self );
-
-
-/* Wait
- *  block until the required number of callers has been reached
- */
-KPROC_EXTERN rc_t CC KBarrierWait ( KBarrier *self );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kproc_barrier_ */
diff --git a/interfaces/kproc/barrier.hpp b/interfaces/kproc/barrier.hpp
deleted file mode 100644
index 38fde17..0000000
--- a/interfaces/kproc/barrier.hpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _hpp_kproc_barrier_
-#define _hpp_kproc_barrier_
-
-#ifndef _h_kproc_barrier_
-#include <kproc/barrier.h>
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KBarrier
- *  a thread synchronization device
- *  detains all callers until the required number has been reached
- */
-struct KBarrier
-{
-    /* Make
-     *  create a barrier
-     *
-     *  "count" [ IN ] - the number of threads to block
-     */
-    static inline rc_t Make ( KBarrier **b, uint32_t count )
-        throw ()
-    { return KBarrierMake ( b, count ); }
-
-
-    /* AddRef
-     * Release
-     */
-    inline rc_t AddRef () const
-        throw ()
-    { return KBarrierAddRef ( this ); }
-
-    inline rc_t Release () const
-        throw ()
-    { return KBarrierRelease ( this ); }
-
-
-    /* Wait
-     *  block until the required number of callers has been reached
-     */
-    inline rc_t Wait ()
-        throw ()
-    { return KBarrierWait ( this ); }
-
-private:
-    KBarrier ();
-    ~ KBarrier ();
-    KBarrier ( const KBarrier& );
-    KBarrier &operator = ( const KBarrier& );
-};
-
-
-#endif // _hpp_kproc_barrier_
diff --git a/interfaces/kproc/cond.h b/interfaces/kproc/cond.h
deleted file mode 100644
index f9eb4ad..0000000
--- a/interfaces/kproc/cond.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kproc_cond_
-#define _h_kproc_cond_
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifndef _h_kproc_extern_
-#include <kproc/extern.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KLock;
-struct timeout_t;
-
-
-/*--------------------------------------------------------------------------
- * KCondition
- *  a POSIX-style condition object
- *  ( requires an external lock object )
- *
- *  usage: the user first acquires an external lock. then, depending upon
- *  the operation, will either test for a condition or establish it, where
- *  the former involves the potential to wait for a signal and the latter
- *  to generate a signal using the external lock for blocking.
- */
-typedef struct KCondition KCondition;
-
-
-/* Make
- *  create a condition
- */
-KPROC_EXTERN rc_t CC KConditionMake ( KCondition **cond );
-
-
-/* AddRef
- * Release
- */
-KPROC_EXTERN rc_t CC KConditionAddRef ( const KCondition *self );
-KPROC_EXTERN rc_t CC KConditionRelease ( const KCondition *self );
-
-
-/* Wait
- *  block on external lock until signalled
- */
-KPROC_EXTERN rc_t CC KConditionWait ( KCondition *self, struct KLock *lock );
-KPROC_EXTERN rc_t CC KConditionTimedWait ( KCondition *self, struct KLock *lock, struct timeout_t *tm );
-
-
-/* Signal
- *  signal waiting threads
- *  awaken at most a single thread
- *
- * NB - external lock used for synchronization must be locked by current thread
- */
-KPROC_EXTERN rc_t CC KConditionSignal ( KCondition *self );
-
-
-/* Broadcast
- *  signal waiting threads
- *  awaken all waiting thread
- *
- * NB - external lock used for synchronization must be locked by current thread
- */
-KPROC_EXTERN rc_t CC KConditionBroadcast ( KCondition *self );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kproc_cond_ */
diff --git a/interfaces/kproc/cond.hpp b/interfaces/kproc/cond.hpp
deleted file mode 100644
index c1ff6b8..0000000
--- a/interfaces/kproc/cond.hpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _hpp_kproc_cond_
-#define _hpp_kproc_cond_
-
-#ifndef _h_kproc_cond_
-#include <kproc/cond.h>
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KCondition
- *  a POSIX-style condition object
- *  ( requires an external lock object )
- *
- *  usage: the user first acquires an external lock. then, depending upon
- *  the operation, will either test for a condition or establish it, where
- *  the former involves the potential to wait for a signal and the latter
- *  to generate a signal using the external lock for blocking.
- */
-struct KCondition
-{
-    /* Make
-     *  create a condition
-     */
-    static inline rc_t Make ( KCondition **cond )
-        throw ()
-    { return KConditionMake ( cond ); }
-
-
-    /* AddRef
-     * Release
-     */
-    inline rc_t AddRef () const
-        throw ()
-    { return KConditionAddRef ( this ); }
-
-    inline rc_t Release () const
-        throw ()
-    { return KConditionRelease ( this ); }
-
-
-    /* Wait
-     *  block on external lock until signaled
-     */
-    inline rc_t Wait ( struct KLock *lock )
-        throw ()
-    { return KConditionWait ( this, lock ); }
-
-    inline rc_t Wait ( struct KLock *lock, struct timeout_t *tm )
-        throw ()
-    { return KConditionTimedWait ( this, lock, tm ); }
-
-    inline rc_t TimedWait ( struct KLock *lock, struct timeout_t *tm )
-        throw ()
-    { return KConditionTimedWait ( this, lock, tm ); }
-
-
-    /* Signal
-     *  signal waiting threads
-     *  awaken at most a single thread
-     */
-    inline rc_t Signal ()
-        throw ()
-    { return KConditionSignal ( this ); }
-
-
-    /* Broadcast
-     *  signal waiting threads
-     *  awaken all waiting thread
-     */
-    inline rc_t Broadcast ()
-        throw ()
-    { return KConditionBroadcast ( this ); }
-
-private:
-    KCondition ();
-    ~ KCondition ();
-    KCondition ( const KCondition& );
-    KCondition &operator = ( const KCondition& );
-};
-
-#endif // _hpp_kproc_cond_
diff --git a/interfaces/kproc/extern.h b/interfaces/kproc/extern.h
deleted file mode 100644
index 874d6f2..0000000
--- a/interfaces/kproc/extern.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kproc_extern_
-#define _h_kproc_extern_
-
-#if ! defined EXPORT_LATCH && defined _LIBRARY
-#define KPROC_EXTERN LIB_EXPORT
-#define EXPORT_LATCH 1
-#else
-#define KPROC_EXTERN LIB_IMPORT
-#endif
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#endif /* _h_kproc_extern_ */
diff --git a/interfaces/kproc/impl.h b/interfaces/kproc/impl.h
deleted file mode 100644
index 4d99b04..0000000
--- a/interfaces/kproc/impl.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kproc_impl_
-#define _h_kproc_impl_
-
-#ifndef _h_kproc_extern_
-#include <kproc/extern.h>
-#endif
-
-#ifndef _h_kproc_task_
-#include <kproc/task.h>
-#endif
-
-#ifndef _h_klib_refcount_
-#include <klib/refcount.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-typedef union KTask_vt KTask_vt;
-
-
-/*--------------------------------------------------------------------------
- * KTask
- *  a deferred task abstraction
- *  specific task objects are constructed with required parameters
- *  and implement the Execute method to perform their operation
- */
-struct KTask
-{
-    const KTask_vt *vt;
-    KRefcount refcount;
-    uint8_t align [ 4 ];
-};
-
-#ifndef KTASK_IMPL
-#define KTASK_IMPL struct KTask
-#endif
-
-typedef struct KTask_vt_v1 KTask_vt_v1;
-struct KTask_vt_v1
-{
-    /* version == 1.x */
-    uint32_t maj;
-    uint32_t min;
-
-    /* start minor version == 0 */
-    rc_t ( CC * destroy ) ( KTASK_IMPL *self );
-    rc_t ( CC * execute ) ( KTASK_IMPL * self );
-    /* end minor version == 0 */
-};
-
-union KTask_vt
-{
-    KTask_vt_v1 v1;
-};
-
-/* Init
- *  initialize a newly allocated task object
- */
-KPROC_EXTERN rc_t CC KTaskInit ( KTask *self, const KTask_vt *vt, const char *clsname, const char *name );
-
-
-/* Destroy
- *  destroy task
- */
-KPROC_EXTERN rc_t CC KTaskDestroy ( KTask *self, const char *clsname );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kproc_impl_ */
diff --git a/interfaces/kproc/lock.h b/interfaces/kproc/lock.h
deleted file mode 100644
index 17109e1..0000000
--- a/interfaces/kproc/lock.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kproc_lock_
-#define _h_kproc_lock_
-
-#ifndef _h_kproc_extern_
-#include <kproc/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct timeout_t;
-
-
-/*--------------------------------------------------------------------------
- * KLock
- * KTimedLock
- *  a POSIX-style mutual exclusion lock
- *
- *  Mac/BSD doesn't supply proper support for timed pthread_mutex,
- *  so we have to provide additional structure to support it.
- *  in doing so, the timed version has become incompatible with
- *  the KCondition interface.
- *
- *  For reasons given above, we are dividing KLock into two classes
- *  to separate out support for timed acquire.
- */
-typedef struct KLock KLock;
-typedef struct KTimedLock KTimedLock;
-
-
-/* Make
- *  make a simple mutex
- */
-KPROC_EXTERN rc_t CC KLockMake ( KLock **lock );
-KPROC_EXTERN rc_t CC KTimedLockMake ( KTimedLock **lock );
-
-
-/* AddRef
- * Release
- */
-KPROC_EXTERN rc_t CC KLockAddRef ( const KLock *self );
-KPROC_EXTERN rc_t CC KLockRelease ( const KLock *self );
-KPROC_EXTERN rc_t CC KTimedLockAddRef ( const KTimedLock *self );
-KPROC_EXTERN rc_t CC KTimedLockRelease ( const KTimedLock *self );
-
-
-/* Acquire
- *  acquires lock
- *
- *  a NULL "tm" parameter should mean infinite
- */
-KPROC_EXTERN rc_t CC KLockAcquire ( KLock *self );
-KPROC_EXTERN rc_t CC KTimedLockAcquire ( KTimedLock *self, struct timeout_t *tm );
-
-/* Unlock
- *  releases lock
- */
-KPROC_EXTERN rc_t CC KLockUnlock ( KLock *self );
-KPROC_EXTERN rc_t CC KTimedLockUnlock ( KTimedLock *self );
-
-
-/*--------------------------------------------------------------------------
- * KRWLock
- *  a POSIX-style read/write lock
- */
-typedef struct KRWLock KRWLock;
-
-
-/* Make
- *  make a simple read/write lock
- */
-KPROC_EXTERN rc_t CC KRWLockMake ( KRWLock **lock );
-
-
-/* AddRef
- * Release
- */
-KPROC_EXTERN rc_t CC KRWLockAddRef ( const KRWLock *self );
-KPROC_EXTERN rc_t CC KRWLockRelease ( const KRWLock *self );
-
-
-/* AcquireShared
- *  acquires read ( shared ) lock
- *
- *  a NULL "tm" parameter should mean infinite
- */
-KPROC_EXTERN rc_t CC KRWLockAcquireShared ( KRWLock *self );
-KPROC_EXTERN rc_t CC KRWLockTimedAcquireShared ( KRWLock *self, struct timeout_t *tm );
-
-
-/* AcquireExcl
- *  acquires write ( exclusive ) lock
- *
- *  a NULL "tm" parameter should mean infinite
- */
-KPROC_EXTERN rc_t CC KRWLockAcquireExcl ( KRWLock *self );
-KPROC_EXTERN rc_t CC KRWLockTimedAcquireExcl ( KRWLock *self, struct timeout_t *tm );
-
-
-/* Unlock
- *  releases lock
- */
-KPROC_EXTERN rc_t CC KRWLockUnlock ( KRWLock *self );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kproc_lock_ */
diff --git a/interfaces/kproc/lock.hpp b/interfaces/kproc/lock.hpp
deleted file mode 100644
index 9e4c1bc..0000000
--- a/interfaces/kproc/lock.hpp
+++ /dev/null
@@ -1,163 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kproc_lock_
-#define _h_kproc_lock_
-
-#ifndef _h_kproc_lock_
-#include <kproc/lock.h>
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KLock
- *  a POSIX-style mutual exclusion lock
- */
-struct KLock
-{
-    /* Make
-     *  make a simple mutex
-     */
-    static inline rc_t Make ( KLock **lock )
-        throw ()
-    { return KLockMake ( lock ); }
-
-
-    /* AddRef
-     * Release
-     */
-    inline rc_t AddRef () const
-        throw ()
-    { return KLockAddRef ( this ); }
-
-    inline rc_t Release () const
-        throw ()
-    { return KLockRelease ( this ); }
-
-
-    /* Acquire
-     *  acquires lock
-     */
-    inline rc_t Acquire ()
-        throw ()
-    { return KLockAcquire ( this ); }
-
-    inline rc_t Acquire ( struct timeout_t *tm )
-        throw ()
-    { return KLockTimedAcquire ( tthis, tm ); }
-
-    inline rc_t TimedAcquire ( struct timeout_t *tm )
-        throw ()
-    { return KLockTimedAcquire ( tthis, tm ); }
-
-    /* Unlock
-     *  releases lock
-     */
-    inline rc_t Unlock ()
-        throw ()
-    { return KLockUnlock ( this ): }
-
-private:
-    KLock ();
-    ~ KLock ();
-    KLock ( const KLock& );
-    KLock &operator = ( const KLock& );
-};
-
-
-/*--------------------------------------------------------------------------
- * KRWLock
- *  a POSIX-style read/write lock
- */
-struct KRWLock
-{
-    /* Make
-     *  make a simple read/write lock
-     */
-    static inline rc_t Make ( KRWLock **lock )
-        throw ()
-    { return KRWLockMake ( lock ): }
-
-
-    /* AddRef
-     * Release
-     */
-    inline rc_t AddRef () const
-        throw ()
-    { return KRWLockAddRef ( this ); }
-
-    inline rc_t Release () const
-        throw ()
-    { return KRWLockRelease ( this ); }
-
-
-    /* AcquireShared
-     *  acquires read ( shared ) lock
-     */
-    inline rc_t AcquireShared ()
-        throw ()
-    { return KRWLockAcquireShared ( this ); }
-
-    inline rc_t AcquireShared ( struct timeout_t *tm )
-        throw ()
-    { return KRWLockTimedAcquireShared ( this, tm ); }
-
-    inline rc_t TimedAcquireShared ( struct timeout_t *tm )
-        throw ()
-    { return KRWLockTimedAcquireShared ( this, tm ); }
-
-
-    /* AcquireExcl
-     *  acquires write ( exclusive ) lock
-     */
-    inline rc_t AcquireExcl ()
-        throw ()
-    { return KRWLockAcquireExcl ( this ); }
-
-    inline rc_t AcquireExcl ( struct timeout_t *tm )
-        throw ()
-    { return KRWLockTimedAcquireExcl ( this, tm ); }
-
-    inline rc_t TimedAcquireExcl ( struct timeout_t *tm )
-        throw ()
-    { return KRWLockTimedAcquireExcl ( this, tm ); }
-
-
-    /* Unlock
-     *  releases lock
-     */
-    inline rc_t Unlock ()
-        throw ()
-    { return KRWLockUnlock ( this ); }
-
-private:
-    KRWLock ();
-    ~ KRWLock ();
-    KRWLock ( const KRWLock& );
-    KRWLock &operator = ( const KRWLock& );
-};
-
-#endif // _hpp_kproc_lock_
diff --git a/interfaces/kproc/procmgr.h b/interfaces/kproc/procmgr.h
deleted file mode 100644
index d0b0a44..0000000
--- a/interfaces/kproc/procmgr.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kproc_procmgr_
-#define _h_kproc_procmgr_
-
-#ifndef _h_kproc_extern_
-#include <kproc/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KTask;
-struct KTaskTicket;
-
-
-/*--------------------------------------------------------------------------
- * KProcMgr
- */
-typedef struct KProcMgr KProcMgr;
-
-
-/* Init
- *  initialize the proc mgr
- *  creates the singleton object
- */
-KPROC_EXTERN rc_t CC KProcMgrInit ( void );
-
-/* Whack
- *  tear down proc mgr
- *  runs any outstanding cleanup tasks
- *  deletes the singleton object
- *  intended to be called from an "atexit()" or similar task
- */
-KPROC_EXTERN rc_t CC KProcMgrWhack ( void );
-
-
-/* MakeSingleton
- *  access singleton process manager
- *  returns a new reference
- *  or an error code if not initialized
- *  VDB-2 ONLY
- */
-KPROC_EXTERN rc_t CC KProcMgrMakeSingleton ( KProcMgr ** mgr );
-
-
-/* AddRef
- * Release
- *  here to support refcounting API
- *  not generally useful in that the proc mgr
- *  will stay around until process exit
- */
-KPROC_EXTERN rc_t CC KProcMgrAddRef ( const KProcMgr *self );
-KPROC_EXTERN rc_t CC KProcMgrRelease ( const KProcMgr *self );
-
-
-/* AddCleanupTask
- *  add a task to be performed at process exit time
- *
- *  "ticket" [ OUT ] - an id that can be used later to remove task
- *
- *  "task" [ IN ] - task object that will be executed at process
- *   exit, unless previously removed ( see RemoveCleanupTask ).
- *   NB - a new reference to "task" will be created
- */
-KPROC_EXTERN rc_t CC KProcMgrAddCleanupTask ( KProcMgr *self,
-    struct KTaskTicket *ticket, struct KTask *task );
-
-
-/* RemoveCleanupTask
- *  remove a task from exit queue
- *  releases reference to task object
- *  returns an rcNotFound code if task no longer exists
- */
-KPROC_EXTERN rc_t CC KProcMgrRemoveCleanupTask ( KProcMgr *self,
-    struct KTaskTicket const *ticket );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kproc_procmgr_ */
diff --git a/interfaces/kproc/q-extern.h b/interfaces/kproc/q-extern.h
deleted file mode 100644
index 96f01d4..0000000
--- a/interfaces/kproc/q-extern.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kproc_q_extern_
-#define _h_kproc_q_extern_
-
-#if ! defined EXPORT_LATCH && _LIBRARY
-#define KQ_EXTERN LIB_EXPORT
-#define EXPORT_LATCH 1
-#else
-#define KQ_EXTERN LIB_IMPORT
-#endif
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#endif /* _h_kproc_q_extern_ */
diff --git a/interfaces/kproc/queue.h b/interfaces/kproc/queue.h
deleted file mode 100644
index e1d5bca..0000000
--- a/interfaces/kproc/queue.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kproc_queue_
-#define _h_kproc_queue_
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#include <kproc/q-extern.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct timeout_t;
-
-
-/*--------------------------------------------------------------------------
- * KQueue
- *  a simple thread-safe queue structure supporting push/pop operation
- *  makes use of semaphore objects for synchronization
- */
-typedef struct KQueue KQueue;
-
-/* AddRef
- * Release
- *  ignores NULL references
- */
-KQ_EXTERN rc_t CC KQueueAddRef ( const KQueue *self );
-KQ_EXTERN rc_t CC KQueueRelease ( const KQueue *self );
-
-/* Make
- * create an empty queue object
- *
- *  "capacity" [ IN ] - minimum queue length
- *  always expands to a power of 2, i.e. providing
- *  a length of 10 will result in a length of 16.
- */
-KQ_EXTERN rc_t CC KQueueMake ( KQueue **q, uint32_t capacity );
-
-/* Push
- *  add an object to the queue
- *
- *  "item" [ IN, OPAQUE ] - pointer to item being queued
- *
- *  "tm" [ IN, NULL OKAY ] - pointer to system specific timeout
- *  structure. if the queue is full, wait for indicated period
- *  of time for space to become available, or return status
- *  code indicating a timeout. when NULL and queue is full,
- *  Push will time out immediately and return status code.
- */
-KQ_EXTERN rc_t CC KQueuePush ( KQueue *self, const void *item, struct timeout_t *tm );
-
-/* Pop
- *  pop an object from queue
- *
- *  "item" [ OUT, OPAQUE* ] - return parameter for popped item
- *
- *  "tm" [ IN, NULL OKAY ] - pointer to system specific timeout
- *  structure. if the queue is empty, wait for indicated period
- *  of time for an object to become available, or return status
- *  code indicating a timeout. when NULL and queue is empty,
- *  Pop will time out immediately and return status code.
- */
-KQ_EXTERN rc_t CC KQueuePop ( KQueue *self, void **item, struct timeout_t *tm );
-
-/* Sealed
- *  ask if the queue has been closed off
- *  meaning there will be no further push operations
- *
- *  NB - if "self" is NULL, the return value is "true"
- *  since a NULL queue cannot accept items via push
- */
-KQ_EXTERN bool CC KQueueSealed ( const KQueue *self );
-
-/* Seal
- *  indicate that the queue has been closed off
- *  meaning there will be no further push operations
- */
-KQ_EXTERN rc_t CC KQueueSeal ( KQueue *self );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kproc_queue_ */
diff --git a/interfaces/kproc/sem.h b/interfaces/kproc/sem.h
deleted file mode 100644
index 32ee405..0000000
--- a/interfaces/kproc/sem.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kproc_sem_
-#define _h_kproc_sem_
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifndef _h_kproc_extern_
-#include <kproc/extern.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KLock;
-struct timeout_t;
-
-
-/*--------------------------------------------------------------------------
- * KSemaphore
- *  a metering device
- */
-typedef struct KSemaphore KSemaphore;
-
-
-/* Make
- *
- *  "count" [ IN ] - initial count value
- */
-KPROC_EXTERN rc_t CC KSemaphoreMake ( KSemaphore **sem, uint64_t count );
-
-
-/* AddRef
- * Release
- */
-KPROC_EXTERN rc_t CC KSemaphoreAddRef ( const KSemaphore *self );
-KPROC_EXTERN rc_t CC KSemaphoreRelease ( const KSemaphore *self );
-
-
-/* Wait
- *  block until a count becomes available
- *
- *  "lock" [ IN ] - externally acquired lock
- *
- *  "tm" [ IN, NULL OKAY ] - optional timeout where
- *  NULL means timeout value of 0
- */
-KPROC_EXTERN rc_t CC KSemaphoreWait ( KSemaphore *self, struct KLock *lock );
-KPROC_EXTERN rc_t CC KSemaphoreTimedWait ( KSemaphore *self,
-    struct KLock *lock, struct timeout_t *tm );
-
-
-/* Cancel
- *  signal that the count will never increase
- *
- * NB - external lock used for synchronization must be locked by current thread
- */
-KPROC_EXTERN rc_t CC KSemaphoreCancel ( KSemaphore *self );
-
-
-/* Signal
- *  signal that a count has become available
- *
- * NB - external lock used for synchronization must be locked by current thread
- */
-KPROC_EXTERN rc_t CC KSemaphoreSignal ( KSemaphore *self );
-
-
-/* Alloc
- *  allocate a count
- *  used for resource metering
- *
- *  "lock" [ IN ] - externally acquired lock
- *
- *  "count" [ IN ] - the resource count
- *
- *  "tm" [ IN, NULL OKAY ] - optional timeout where
- *  NULL means timeout value of 0
- */
-KPROC_EXTERN rc_t CC KSemaphoreAlloc ( KSemaphore *self,
-    struct KLock *lock, uint64_t count );
-KPROC_EXTERN rc_t CC KSemaphoreTimedAlloc ( KSemaphore *self,
-    struct KLock *lock, uint64_t count, struct timeout_t *tm );
-
-
-/* Free
- *  signal that resources have become available
- *
- * NB - external lock used for synchronization must be locked by current thread
- */
-KPROC_EXTERN rc_t CC KSemaphoreFree ( KSemaphore *self, uint64_t count );
-
-
-/* Count
- *  request the current resource usage
- *
- *  "count" [ OUT ] - return parameter for current count
- *
- * NB - external lock used for synchronization must be locked by current thread
- */
-KPROC_EXTERN rc_t CC KSemaphoreCount ( const KSemaphore *self, uint64_t *count );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kproc_sem_ */
diff --git a/interfaces/kproc/sem.hpp b/interfaces/kproc/sem.hpp
deleted file mode 100644
index 05b3178..0000000
--- a/interfaces/kproc/sem.hpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _hpp_kproc_sem_
-#define _hpp_kproc_sem_
-
-#ifndef _h_kproc_sem_
-#include <kproc/sem.h>
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KSemaphore
- *  a metering device
- */
-struct KSemaphore
-{
-    /* Make
-     *
-     *  "count" [ IN ] - initial count value
-     */
-    static inline rc_t Make ( KSemaphore **sem, uint64_t count )
-        throw ()
-    { return KSemaphoreMake ( sem, count ); }
-
-
-    /* AddRef
-     * Release
-     */
-    inline rc_t AddRef () const
-        throw ()
-    { return KSemaphoreAddRef ( this ); }
-
-    inline rc_t Release () const
-        throw ()
-    { return KSemaphoreRelease ( this ); }
-
-
-    /* Wait
-     *  block until a count becomes available
-     *
-     *  "lock" [ IN ] - externally acquired lock
-     */
-    inline rc_t Wait ( struct KLock *lock )
-        throw ()
-    { return KSemaphoreWait ( this, lock ); }
-
-    inline rc_t Wait ( struct KLock *lock, struct timeout_t *tm )
-        throw ()
-    { return KSemaphoreTimedWait ( this, lock, tm ); }
-
-    inline rc_t TimedWait ( struct KLock *lock, struct timeout_t *tm )
-        throw ()
-    { return KSemaphoreTimedWait ( this, lock, tm ); }
-
-
-    /* Signal
-     *  signal that a count has become available
-     */
-    inline rc_t Signal ()
-        throw ()
-    { return KSemaphoreSignal ( this ); }
-
-
-    /* Alloc
-     *  allocate a count
-     *  used for resource metering
-     *
-     *  "lock" [ IN ] - externally acquired lock
-     *
-     *  "count" [ IN ] - the resource count
-     */
-    inline rc_t Alloc ( struct KLock *lock, uint64_t count )
-        throw ()
-    { return KSemaphoreAlloc ( this, lock, count ); }
-
-    inline rc_t Alloc ( struct KLock *lock, uint64_t count, struct timeout_t *tm )
-        throw ()
-    { return KSemaphoreTimedAlloc ( this, lock, count, tm ); }
-
-    inline rc_t TimedAlloc ( struct KLock *lock, uint64_t count, struct timeout_t *tm )
-        throw ()
-    { return KSemaphoreTimedAlloc ( this, lock, count, tm ); }
-
-
-    /* Free
-     *  signal that resources have become available
-     */
-    inline rc_t Free ( uint64_t count )
-        throw ()
-    { return KSemaphoreFree ( this, count ); }
-
-
-    /* Count
-     *  request the current resource usage
-     *  valid only within lock
-     *
-     *  "count" [ OUT ] - return parameter for current count
-     */
-    inline rc_t Count ( uint64_t *count ) const
-        throw ()
-    { return KSemaphoreCount ( this, count ); }
-
-private:
-    KSemaphore ();
-    ~ KSemaphore ();
-    KSemaphore ( const KSemaphore& );
-    KSemaphore &operator = ( const KSemaphore& );
-};
-
-#endif // _hpp_kproc_sem_
diff --git a/interfaces/kproc/task.h b/interfaces/kproc/task.h
deleted file mode 100644
index 5e49547..0000000
--- a/interfaces/kproc/task.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kproc_task_
-#define _h_kproc_task_
-
-#ifndef _h_kproc_extern_
-#include <kproc/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-
-
-/*--------------------------------------------------------------------------
- * KTask
- *  a deferred task abstraction
- *  specific task objects are constructed with required parameters
- *  and implement the Execute method to perform their operation
- */
-typedef struct KTask KTask;
-
-
-/* AddRef
- * Release
- */
-KPROC_EXTERN rc_t CC KTaskAddRef ( const KTask *self );
-KPROC_EXTERN rc_t CC KTaskRelease ( const KTask *self );
-KPROC_EXTERN rc_t CC KTaskDestroy ( KTask *self, const char *clsname );
-
-/* Execute
- *  perform deferred operation
- */
-KPROC_EXTERN rc_t CC KTaskExecute ( KTask *self );
-
-/*--------------------------------------------------------------------------
- * KTaskTicket
- *  an opaque object holding task identification
- */
-typedef struct KTaskTicket KTaskTicket;
-struct KTaskTicket
-{
-    uint64_t info [ 2 ];
-};
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kproc_task_ */
diff --git a/interfaces/kproc/thread.h b/interfaces/kproc/thread.h
deleted file mode 100644
index e6ab600..0000000
--- a/interfaces/kproc/thread.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kproc_thread_
-#define _h_kproc_thread_
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifndef _h_kproc_extern_
-#include <kproc/extern.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KThread
- *  a CPU execution thread
- */
-typedef struct KThread KThread;
-
-/* Make
- *  create and run a thread
- *
- *  "run_thread" [ IN ] - thread entrypoint
- *
- *  "data" [ IN, OPAQUE ] - user-supplied thread data
- */
-KPROC_EXTERN rc_t CC KThreadMake ( KThread **t,
-    rc_t ( CC * run_thread ) ( const KThread *self, void *data ), void *data );
-
-
-/* AddRef
- * Release
- */
-KPROC_EXTERN rc_t CC KThreadAddRef ( const KThread *self );
-KPROC_EXTERN rc_t CC KThreadRelease ( const KThread *self );
-
-
-/* Cancel
- *  signal the thread to finish
- */
-KPROC_EXTERN rc_t CC KThreadCancel ( KThread *self );
-
-
-/* Wait
- *  waits for a thread to exit
- *
- *  "status" [ OUT, NULL OKAY ] - return parameter for thread's exit code
- */
-KPROC_EXTERN rc_t CC KThreadWait ( KThread *self, rc_t *status );
-
-
-/* Detach
- *  allow thread to run independently of group
- */
-KPROC_EXTERN rc_t CC KThreadDetach ( KThread *self );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kproc_thread_ */
diff --git a/interfaces/kproc/thread.hpp b/interfaces/kproc/thread.hpp
deleted file mode 100644
index 53b9510..0000000
--- a/interfaces/kproc/thread.hpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _hpp_kproc_thread_
-#define _hpp_kproc_thread_
-
-#ifndef _h_kproc_thread_
-#include <kproc/thread.h>
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KThread
- *  a CPU execution thread
- */
-struct KThread
-{
-    /* Make
-     *  create and run a thread
-     *
-     *  "run_thread" [ IN ] - thread entrypoint
-     *
-     *  "data" [ IN, OPAQUE ] - user-supplied thread data
-     */
-    static inline rc_t Make ( KThread **t,
-             rc_t ( CC * run_thread ) ( const KThread *, void * ), void * data )
-        throw ()
-    { return KThreadMake ( t, run_thread, data ); }
-
-
-    /* AddRef
-     * Release
-     */
-    inline rc_t AddRef () const
-        throw ()
-    { return KThreadAddRef ( this ); }
-
-    inline rc_t Release () const
-        throw ()
-    { return KThreadRelease ( this ); }
-
-
-    /* Cancel
-     *  signal the thread to finish
-     */
-    inline rc_t Cancel ()
-        throw ()
-    { return KThreadCancel ( this ); }
-
-
-    /* Wait
-     *  waits for a thread to exit
-     *
-     *  "status" [ OUT ] - return parameter for thread's exit code
-     */
-    inline rc_t Wait ( rc_t *status )
-        throw ()
-    { return KThreadWait ( this, status ); }
-
-
-    /* Detach
-     *  allow thread to run independently of group
-     */
-    inline rc_t Detach ()
-        throw ()
-    { return KThreadDetach ( this ); }
-
-private:
-    KThread ();
-    ~ KThread ();
-    KThread ( const KThread& );
-    KThread &operator = ( const KThread& );
-};
-
-#endif // _hpp_kproc_thread_
diff --git a/interfaces/kproc/timeout.h b/interfaces/kproc/timeout.h
deleted file mode 100644
index 017f1a3..0000000
--- a/interfaces/kproc/timeout.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kproc_timeout_
-#define _h_kproc_timeout_
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifndef _h_kproc_extern_
-#include <kproc/extern.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * system specific timeout object
- */
-typedef struct timeout_t timeout_t;
-
-
-/* Init
- *  initialize a timeout in milliseconds
- */
-KPROC_EXTERN rc_t CC TimeoutInit ( timeout_t *tm, uint32_t msec );
-
-
-/* Prepare
- *  ensures that a timeout is prepared with an absolute value
-*/
-KPROC_EXTERN rc_t CC TimeoutPrepare ( timeout_t *tm );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kproc_timeout_ */
diff --git a/interfaces/krypto/cipher-impl.h b/interfaces/krypto/cipher-impl.h
deleted file mode 100644
index 02214d4..0000000
--- a/interfaces/krypto/cipher-impl.h
+++ /dev/null
@@ -1 +0,0 @@
-#error "OBSOLETE do not use"
diff --git a/interfaces/krypto/cipher-priv.h b/interfaces/krypto/cipher-priv.h
deleted file mode 100644
index 328ba6d..0000000
--- a/interfaces/krypto/cipher-priv.h
+++ /dev/null
@@ -1 +0,0 @@
-#error "Obsolete do not use"
diff --git a/interfaces/krypto/cipher-test.h b/interfaces/krypto/cipher-test.h
deleted file mode 100644
index f123525..0000000
--- a/interfaces/krypto/cipher-test.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-#ifndef _h_krypto_cipher_test_
-#define _h_krypto_cipher_test_
-
-#include <krypto/extern.h>
-#include <klib/defs.h>
-
-#include <krypto/ciphermgr.h>
-
-KRYPTO_EXTERN rc_t KCipherTestVecAesNiMake (struct KCipher ** new_cipher,
-                                            kcipher_type type);
-KRYPTO_EXTERN rc_t KCipherTestVecRegMake   (struct KCipher ** new_cipher,
-                                            kcipher_type type);
-KRYPTO_EXTERN rc_t KCipherTestVecMake      (struct KCipher ** new_cipher,
-                                            kcipher_type type);
-KRYPTO_EXTERN rc_t KCipherTestByteMake     (struct KCipher ** new_cipher,
-                                            kcipher_type type);
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* #ifndef _h_krypto_cipher_test_ */
diff --git a/interfaces/krypto/cipher.h b/interfaces/krypto/cipher.h
deleted file mode 100644
index 2f22733..0000000
--- a/interfaces/krypto/cipher.h
+++ /dev/null
@@ -1,208 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-#ifndef _h_krypto_cipher_
-#define _h_krypto_cipher_
-
-#include <krypto/extern.h>
-#include <klib/defs.h>
-
-typedef struct KCipher KCipher;
-
-KRYPTO_EXTERN 
-rc_t CC KCipherAddref (const KCipher * self);
-
-KRYPTO_EXTERN rc_t CC KCipherRelease (const KCipher * self);
-
-KRYPTO_EXTERN rc_t CC KCipherBlockSize (const KCipher * self, size_t * bytes);
-
-KRYPTO_EXTERN rc_t CC KCipherSetEncryptKey (KCipher * self,
-                                            const void * user_key,
-                                            size_t user_key_size);
-
-KRYPTO_EXTERN rc_t CC KCipherSetDecryptKey (KCipher * self,
-                                            const void * user_key,
-                                            size_t user_key_size);
-
-/*
- * Set the ivec (Initialization vector or feedback) for the cipher
- * this is done automatically for the longer runs defined below.
- *
- * the size of ivec  must match KCipherBlockSize
- *
- * the ivec is copied into the cipher not used in place
- */
-KRYPTO_EXTERN
- rc_t CC KCipherSetEncryptIVec (KCipher * self, const void * ivec);
-
-KRYPTO_EXTERN
- rc_t CC KCipherSetDecryptIVec (KCipher * self, const void * ivec);
-
-
-typedef void (*cipher_ctr_func)(void * ivec);
-
-KRYPTO_EXTERN rc_t CC KCipherSetEncryptCtrFunc (KCipher * self, cipher_ctr_func func);
-
-KRYPTO_EXTERN rc_t CC KCipherSetDecryptCtrFunc (KCipher * self, cipher_ctr_func func);
-
-/*
- * 'in' can equal 'out'
- */
-KRYPTO_EXTERN rc_t CC KCipherEncrypt (KCipher * self, const void * in, void * out);
-
-KRYPTO_EXTERN rc_t CC KCipherDecrypt (KCipher * self, const void * in, void * out);
-
-
-/* ====================
- * longer runs of multiple blocks.
- *
- * The algorithms are well defined and standard in most cases.
- *
- * PT: plain text block
- * CT: cipher text block
- * EK: encryption key
- * DK: decryption key (might be sthe same as EK)
- * ENC: encrypt cipher function on a block using a key
- * DEC: decrypt cipher function on a block using a key
- * IV: initialization vector - used as feedback for chaining
- * N:  number used once (nonce)
- * FB: feedback is the next IV in a chained/feedback mode
- */
-
-/* -----
- * NOTE:
- * 'in' can be the same as 'out' but other overlaps are dangers as a block at a
- * time is written. The code does not look for overlaps at this point.
- */
-
-/* ----------
- * Electronic Code Book - simple cipher with no chaining feedback  just iterate
- * simple encrypt/decrypt with the plain, text, cipher text and key/
- *
- * CT = ENC (PT,EK)
- * PT = DEC (CT,DK)
- */
-
-/* -----
- * NOTE: currently an implmentation detail limits us to 8192 bit cipher block
- * size.  Changing MAX_BLOCK_SIZE in cipher.c can up that limit without 
- * causing any other compatibility issues. 
- *
- * Two local byte arrays are defined on the stack of 1024 bytes or 8192 bits.
- */
-KRYPTO_EXTERN rc_t CC KCipherEncryptECB (KCipher * self, const void * in, void * out,
-                                         uint32_t block_count);
-
-KRYPTO_EXTERN rc_t CC KCipherDecryptECB (KCipher * self, const void * in, void * out,
-                                         uint32_t block_count);
-
-/* ----------
- * Cipher-Block Chaining
- * CT = (FB = ENC (PT^IV, EK))
- * PT = DEC ((FB = CT), DK)
- *
- */
-KRYPTO_EXTERN rc_t CC KCipherEncryptCBC (KCipher * self, const void * in, void * out,
-                                         uint32_t block_count);
-
-KRYPTO_EXTERN rc_t CC KCipherDecryptCBC (KCipher * self, const void * in, void * out,
-                                         uint32_t block_count);
-
-/* ----------
- * Propagating cipher-block chaining
- * FB = PT ^ (CT = ENC ((PT^IV), EK))
- * FB = CT ^ (PT = DEC (CT,DK) ^ IV)
- */
-
-/* not yet implemented */
-
-/* ----------
- * Cipher Feedback
- * CT = (FB = PT) ^ ENC (IV, EK))
- * PT = (FB = CT) ^ ENC (IV, DK)
- *
- * NOTE the use of the encrypt function for decryption
- *
- * Not implemented as the openssl does something different
- */
-KRYPTO_EXTERN
-rc_t CC KCipherEncryptCFB (KCipher * self, const void * in, void * out,
-                           uint32_t block_count);
-
-KRYPTO_EXTERN
-rc_t CC KCipherDecryptCFB (KCipher * self, const void * in, void * out,
-                           uint32_t block_count);
-
-KRYPTO_EXTERN
-rc_t CC KCipherEncryptPCFB (KCipher * self, const void * in, void * out,
-                            uint32_t block_count);
-
-KRYPTO_EXTERN
-rc_t CC KCipherDecryptPCFB (KCipher * self, const void * in, void * out,
-                            uint32_t block_count);
-
-/* ----------
- * Output Feedback
- * CT = PT ^ (FB = ENC (IV, EK))
- * PT = CT ^ (FB = ENC (IV, DK))
- *
- * NOTE the use of the encrypt function for decryption
- *
- * Not implemented as the openssl does something different
- */
-KRYPTO_EXTERN
-rc_t CC KCipherEncryptOFB (KCipher * self, const void * in, void * out,
-                           uint32_t block_count);
-
-KRYPTO_EXTERN
-rc_t CC KCipherDecryptOFB (KCipher * self, const void * in, void * out,
-                           uint32_t block_count);
-
-/* ----------
- * Counter
- * IV is a nonce and not re-used as FB
- * CT = PT ^ ENC (N, EK)
- * PT = CT ^ ENC (N, DK)
- *
- * NOTE the use of the encrypt function for decryption
- *
- * nonce is a function that given an iv generates the next iv
- *
- */
-KRYPTO_EXTERN
-rc_t CC KCipherEncryptCTR (KCipher * self, const void * in,
-                           void * out, uint32_t block_count);
-KRYPTO_EXTERN
-rc_t CC KCipherDecryptCTR (KCipher * self, const void * in,
-                           void * out, uint32_t block_count);
-
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* #ifndef _h_krypto_cipher_ */
diff --git a/interfaces/krypto/ciphermgr-priv.h b/interfaces/krypto/ciphermgr-priv.h
deleted file mode 100644
index 943e067..0000000
--- a/interfaces/krypto/ciphermgr-priv.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifdef  __cplusplus
-extern "C" {
-#endif
-
-
-
-#ifdef  __cplusplus
-}
-#endif
-
-
-
-#endif /* #ifndef _h_krypto_manager_priv_ */
diff --git a/interfaces/krypto/ciphermgr.h b/interfaces/krypto/ciphermgr.h
deleted file mode 100644
index 2534400..0000000
--- a/interfaces/krypto/ciphermgr.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifndef _h_krypto_manager_
-#define _h_krypto_manager_
-
-#ifndef _h_krypto_extern_
-#include <krypto/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-
-#ifndef _h_kfs_defs_
-#include <kfs/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* enabled/disable a set of in-house clean;y written aes ciphers. some optimize
- * for certain c processors */
-
-#define USE_NCBI_AES 1
-
-
-/*--------------------------------------------------------------------------
- * KCipherManager
- */
-struct KCipher;
-
-typedef struct KCipherManager KCipherManager;
-
-/* AddRef
- * Release
- *  ignores NULL references
- */
-KRYPTO_EXTERN
-rc_t CC KCipherManagerAddRef (const KCipherManager *self);
-
-KRYPTO_EXTERN
-rc_t CC KCipherManagerRelease (const KCipherManager *self);
-
-
-/* MakeCipher
- */
-typedef uint32_t kcipher_type;
-enum
-{
-    kcipher_null, /* no encryption = just a copy */
-    kcipher_AES,
-    kcipher_count
-};
-
-
-KRYPTO_EXTERN
-rc_t CC KCipherManagerMakeCipher (const KCipherManager * self,
-                                  struct KCipher ** cipher,
-                                  kcipher_type type);
-
-/* Make
- */
-KRYPTO_EXTERN
-rc_t CC KCipherManagerMake (KCipherManager ** pmanager);
-
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_manager_ */
diff --git a/interfaces/krypto/encfile-priv.h b/interfaces/krypto/encfile-priv.h
deleted file mode 100644
index 84deaf7..0000000
--- a/interfaces/krypto/encfile-priv.h
+++ /dev/null
@@ -1,250 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_krypto_encfile_priv_
-#define _h_krypto_encfile_priv_
-
-#ifndef _h_krypto_extern_
-#include <krypto/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#include <krypto/encfile.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define DEBUG_STS(msg)     DBGMSG(DBG_KRYPTO,DBG_FLAG(DBG_KRYPTO_STS),msg)
-#define DEBUG_CFG(msg)     DBGMSG(DBG_KRYPTO,DBG_FLAG(DBG_KRYPTO_CFG_,msg)
-#define DEBUG_ENCRYPT(msg) DBGMSG(DBG_KRYPTO,DBG_FLAG(DBG_KRYPTO_ENCRYPT),msg)
-#define DEBUG_DECRYPT(msg) DBGMSG(DBG_KRYPTO,DBG_FLAG(DBG_KRYPTO_DECRYPT),msg)
-
-/* -----
- * Encrypted file structure:
- *   - File Header
- *   - zero or more data blocks
- *   - file footer
- *
- * File Header:
- *   - file signature "NCBInenc"
- *   - byte order flag 
- *   - version
- *
- * Data Block:
- *   - rkey - randomly generated 32 byte key for this block (encrypted using user key)
- *   - encrypted block of 32768 bytes size above says how many are really used (encrypted using rkey and salt above)
- *   - block-offset + (valid bytes in block % 32768)
- *   - crc-32 (includes phantom block start offset as initial seed)
- *
- * File Footer:
- *   - footer signature "foot"
- *   - checksum of crcs
- */
-
-
-/* ----------------------------------------------------------------------
- * Header - the file header
- * all constant values for the first version
- */
-typedef char KEncFileSig [8];
-typedef uint32_t Endian_t;
-typedef uint32_t KEncFileVersion;
-
-
-typedef struct KEncFileHeader KEncFileHeader;
-struct KEncFileHeader
-{
-    KEncFileSig     file_sig;   /* "NCBInenc" or "NCBIkenc" */
-    Endian_t        byte_order; /* do we byte swap on read? */
-    KEncFileVersion version;    /* simple incrementation starting at 1 */
-};
-
-
-/* ----------------------------------------------------------------------
- * KEncFileBlock
- *    The body of the file is blocks containing a portion of the decrypted
- *    file.  These are an ordered sequence with the last block being the
- *    same size as the rest but with only some of the data portion being
- *    a part of the file.
- *
- *    An encrypted file is longer than an unencrypted file by 
- *       a constant: the lengths of the header and the footer
- *       proportionally by the length of the block key and crc
- */
-
-/* -----
- * Key  the header for an encrypted block
- *
- * when initialized the first 38 bytes should be set to random data.
- * valid is a count of how many bytes in the block are valid data
- * offset is the offset of this block with in the decrypted file
- */
-typedef uint8_t KEncFileKey [32];
-
-
-/* -----
- * We sized the data portion of a block to match the KPageFile
- * structure allowing a KBufFile in front of a KEncFile to
- * operate in a fairly efficient manner
- */
-#define ENC_DATA_BLOCK_SIZE     (32*1024)
-typedef uint8_t KEncFileData [ENC_DATA_BLOCK_SIZE];
-
-typedef uint16_t KEncFileOffValid;
-
-typedef uint64_t KEncFileBlockId;
-typedef uint16_t KEncFileBlockValid;
-
-/* -----
- * we use the same 32 bit CRC as the rest of the project
- */
-typedef uint32_t KEncFileCRC;
-
-
-/*
- * NOTE:
- * The size of data + u + id + crc + crc_copy must remain divisible
- * by the size of key
- */
-typedef struct KEncFileBlock KEncFileBlock;
-struct KEncFileBlock
-{
-    KEncFileKey         key;  /* encrypted with the user key */
-    KEncFileData        data; /* encrypted with block key */
-    union
-    {
-        KEncFileBlockValid  valid; /* obscured and encrypted */
-        uint8_t bytes [16];        /* mostly fill */
-    } u;
-    KEncFileBlockId     id;        /* plain text */
-    KEncFileCRC         crc;       /* plain text */
-    KEncFileCRC         crc_copy;  /* plain text */
-};
-
-
-/* ----------------------------------------------------------------------
- * Foot - the ending of an encrypted file: 
- *   these are in plan text for non-decryption validation of the whole file
- *
- * In Version 1 the crc_checksum is required.
- * In Version 2 the crc_checksum is optional - if 0 it is not computed.
- */
-typedef uint64_t KEncFileFooter_t;
-typedef struct KEncFileFooter KEncFileFooter;
-struct KEncFileFooter
-{
-    KEncFileFooter_t block_count;  /* how many blocks do we have? */
-    KEncFileFooter_t crc_checksum; /* sum of crcs of all blocks */
-};
-
-
-/* ----------
- * Read mode is fully seekable if the underlying KFile is seekable some
- * integrity checking will not be performed in allowing this seeking.
- */
-KRYPTO_EXTERN rc_t CC KEncFileMakeRead_v1 (const struct KFile ** pself,
-                                           const struct KFile * encrypted_input,
-                                           const struct KKey * key);
-
-KRYPTO_EXTERN rc_t CC KEncFileMakeRead_v2 (const struct KFile ** pself,
-                                           const struct KFile * encrypted_input,
-                                           const struct KKey * key);
-
-
-/* ----------
- * Write mode encrypted file can only be written straight through from the
- * first byte to the last.
- */
-KRYPTO_EXTERN rc_t CC KEncFileMakeWrite_v1 (struct KFile ** pself,
-                                            struct KFile * encrypted_output,
-                                            const struct KKey * key);
-
-KRYPTO_EXTERN rc_t CC KEncFileMakeWrite_v2 (struct KFile ** pself,
-                                            struct KFile * encrypted_output,
-                                            const struct KKey * key);
-
-
-/* ----------
- * Update mode is read/write mode where seeking within the file is allowed.
- *
- * NOTE this is in the private interface because it is not actually working
- * yet.
- */
-KRYPTO_EXTERN rc_t CC KEncFileMakeUpdate_v1 (struct KFile ** pself, 
-                                             struct KFile * encrypted,
-                                             const struct KKey * key);
-
-KRYPTO_EXTERN rc_t CC KEncFileMakeUpdate_v2 (struct KFile ** pself, 
-                                             struct KFile * encrypted,
-                                             const struct KKey * key);
-
-
-/* ----------
- * Validate mode can not be read or written.
- * Upon open the whole file is read from beginning to end and all CRC
- * and other integrity checks are performed immediately
- */
-KRYPTO_EXTERN rc_t CC KEncFileValidate_v1 (const struct KFile * encrypted);
-
-KRYPTO_EXTERN rc_t CC KEncFileValidate_v2 (const struct KFile * encrypted);
-
-
-/* ----------
- * Identify whether a file is a KEncFile type encrypted file by the header.
- * read the header into a buffer and pass it into this function.  
- * The buffer_size needs to be at least 8 but more bytes lead to a better
- * check up to the size of the header of a KEncFile type encrypted file.
- * As the header may change in the future (in a backwards compatible way)
- * that size might change from the current 16.
- *
- * Possible returns:
- * 0:
- *      the file is an identified KEncFile type file.  False positives are
- *      possible if a file happens to match at 8 or more bytes
- *
- * RC (rcFS, rcFile, rcIdentifying, rcFile, rcWrongType)
- *      the file is definitely not a KEncFIle type encrypted file.
- *     
- * RC (rcFS, rcFile, rcIdentifying, rcParam, rcNull)
- *      bad parameters in the call
- *
- * RC (rcFS, rcFile, rcIdentifying, rcBuffer, rcInsufficient)
- *      not a large enough buffer to make an identification
- */
-KRYPTO_EXTERN rc_t CC KFileIsEnc_v1 (const char * buffer, size_t buffer_size);
-
-KRYPTO_EXTERN rc_t CC KFileIsEnc_v2 (const char * buffer, size_t buffer_size);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_krypto_encfile_priv_ */
diff --git a/interfaces/krypto/encfile.h b/interfaces/krypto/encfile.h
deleted file mode 100644
index df8efe1..0000000
--- a/interfaces/krypto/encfile.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/*
- * This needs to be changed to true in about the middle of summer 2013
- *
- * When re-enabling this feature also fix test/kreypto/Makefile
- */
-#define SENC_IS_NENC_FOR_WRITER 0
-
-
-#ifndef _h_krypto_encfile_
-#define _h_krypto_encfile_
-
-#ifndef _h_krypto_extern_
-#include <krypto/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct KFile;
-struct KKey;
-
-typedef struct KEncFile KEncFile;
-
-/* ----------
- * Read mode is fully seekable if the underlying KFile is seekable some
- * integrity checking will not be performed in allowing this seeking.
- *
- * One difference between update and read mode is the handling of
- * "missing blocks". Open for update will read a missing block as all
- * zero while 
- */
-KRYPTO_EXTERN rc_t CC KEncFileMakeRead (const struct KFile ** pself,
-                                        const struct KFile * encrypted_input,
-                                        const struct KKey * key);
-
-
-/* ----------
- * Write mode encrypted file can only be written straight through from the
- * first byte to the last.
- */
-KRYPTO_EXTERN rc_t CC KEncFileMakeWrite (struct KFile ** pself,
-                                         struct KFile * encrypted_output,
-                                         const struct KKey * key);
-
-
-/* ----------
- * Update mode is read/write mode where seeking within the file is allowed.
- * 
- * One difference between update and read mode is the handling of
- * "missing blocks". Open for update will read a missing block as all
- * zero while 
- */
-KRYPTO_EXTERN rc_t CC KEncFileMakeUpdate (struct KFile ** pself, 
-                                          struct KFile * encrypted,
-                                          const struct KKey * key);
-
-
-/* ----------
- * Validate mode can not be read or written.
- * Upon open the whole file is read from begining to end and all CRC
- * and other integrity checks are performed immedaitely
- */
-KRYPTO_EXTERN rc_t CC KEncFileValidate (const struct KFile * encrypted);
-
-
-/* ----------
- * Identify whether a file is a KEncFile type encrypted file by the header.
- * read the header into a buffer and pass it into this function.  
- * The buffer_size needs to be at least 8 but more bytes lead to a better
- * check up to the size of the header of a KEncFile type encrypted file.
- * As the header may change in the future (in a backwards compatible way)
- * that size might change from the current 16.
- *
- * Possible returns:
- * 0:
- *      the file is an identified KEncFile type file.  False positives are
- *      possible if a file happens to match at 8 or more bytes
- *
- * RC (rcFS, rcFile, rcIdentifying, rcFile, rcWrongType)
- *      the file is definitely not a KEncFIle type encrypted file.
- *     
- * RC (rcFS, rcFile, rcIdentifying, rcParam, rcNull)
- *      bad parameters in the call
- *
- * RC (rcFS, rcFile, rcIdentifying, rcBuffer, rcInsufficient)
- *      not a large enough buffer to make an identification
- */
-
-/* requires NCBInenc or NCBIsenc or signature but if available
- * checks the byte order and version fields
- */
-KRYPTO_EXTERN rc_t CC KFileIsEnc (const char * buffer, size_t buffer_size);
-
-/* same as above but requires NCBIsenc signature only */
-KRYPTO_EXTERN rc_t CC KFileIsSraEnc (const char * buffer, size_t buffer_size);
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_krypto_encfile_ */
diff --git a/interfaces/krypto/extern.h b/interfaces/krypto/extern.h
deleted file mode 100644
index 70c1b0c..0000000
--- a/interfaces/krypto/extern.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_krypto_extern_
-#define _h_krypto_extern_
-
-#if ! defined EXPORT_LATCH && defined _LIBRARY
-#define KRYPTO_EXTERN LIB_EXPORT
-#define KRYPTO_EXTERN_DATA extern LIB_EXPORT
-#define EXPORT_LATCH 1
-#else
-#define KRYPTO_EXTERN LIB_IMPORT
-#ifdef __cplusplus
-#define KRYPTO_EXTERN_DATA extern /* LIB_IMPORT_DATA */
-#else
-#define KRYPTO_EXTERN_DATA LIB_IMPORT_DATA
-#endif
-
-#endif
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#endif /* _h_krypto_extern_ */
diff --git a/interfaces/krypto/key.h b/interfaces/krypto/key.h
deleted file mode 100644
index f170d7d..0000000
--- a/interfaces/krypto/key.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_key_
-#define _h_kfs_key_
-
-#ifndef _h_krypto_extern_
-#include <krypto/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct KKey KKey;
-
-
-typedef uint32_t KKeyType;
-enum eKKeyType
-{
-    kkeyNone,
-    kkeyAES128,
-    kkeyAES192,
-    kkeyAES256,
-    kkeyTypeCount
-};
-
-#define KKeyTypeDefault (kkeyAES128)
-
-struct KKey
-{
-    KKeyType type;
-    uint8_t  text [32]; /* might be more, might be less */
-};
-
-enum eKKeySize
-{
-    kkeyMinimumSize = 6
-};
-
-KRYPTO_EXTERN_DATA KKey KKeyEncrypt;
-KRYPTO_EXTERN_DATA KKey KKeyDecrypt;
-
-/* WGA ncryption passwords are only significant to 32 characters */
-#define WGA_MAX_PASSWORD (32)
-KRYPTO_EXTERN_DATA char WGAEncryptPassword[WGA_MAX_PASSWORD];
-KRYPTO_EXTERN_DATA char WGADecryptPassword[WGA_MAX_PASSWORD];
-
-typedef char KryptoKeyMapNCBI [32*2];
-typedef char KryptoKeyMapWGA  [2 + 32*2];
-typedef char KryptoKeyMap [(2*sizeof(KryptoKeyMapNCBI))+(2*sizeof(KryptoKeyMapWGA))+1];
-enum
-{
-    KryptoKeyMapEncrypt = 0,
-    KryptoKeyMapDecrypt = sizeof(KryptoKeyMapNCBI),
-    KryptoKeyMapWGAEncrypt = KryptoKeyMapDecrypt + sizeof(KryptoKeyMapNCBI),
-    KryptoKeyMapWGADecrypt = KryptoKeyMapWGAEncrypt + sizeof(KryptoKeyMapWGA),
-    KryptoKeyMapNul = KryptoKeyMapWGADecrypt + sizeof(KryptoKeyMapWGA)
-};
-
-KRYPTO_EXTERN  rc_t CC KKeyInitRead (KKey * self, KKeyType key_type, 
-                                     const void * password, size_t password_size);
-
-KRYPTO_EXTERN rc_t CC KKeyInitUpdate (KKey * key, KKeyType key_type, 
-                                      const void * password, size_t password_size);
-
-
-#define FAIL_SHORT_PASSWORD (false)
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_key_ */
diff --git a/interfaces/krypto/manager-priv.h b/interfaces/krypto/manager-priv.h
deleted file mode 100644
index f2f3346..0000000
--- a/interfaces/krypto/manager-priv.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#error "OBSOLETE do not use"
diff --git a/interfaces/krypto/manager.h b/interfaces/krypto/manager.h
deleted file mode 100644
index 0581659..0000000
--- a/interfaces/krypto/manager.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_krypto_manager_
-#define _h_krypto_manager_
-
-
-DO NOT USE
-
-#endif /* _h_krypto_manager_ */
diff --git a/interfaces/krypto/reencfile.h b/interfaces/krypto/reencfile.h
deleted file mode 100644
index 02d4894..0000000
--- a/interfaces/krypto/reencfile.h
+++ /dev/null
@@ -1,91 +0,0 @@
-
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_krypto_reencfile_
-#define _h_krypto_reencfile_
-
-#ifndef _h_krypto_extern_
-#include <krypto/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Currently only the read version is implmented
- */
-#define REENCFILE_WRITE_SUPPORTED 0
-/*
- * Currently the input encrypted KFile must respond to KFileSize
- * with the size of the encrypted file. 
- */
-#define REENCFILE_STREAM_SUPPORTED 0
-
-
-struct KFile;
-struct KKey;
-
-typedef struct KReencFile KReencFile;
-
-/* ----------
- * Read mode is fully seekable if the underlying KFile is seekable some
- * integrity checking will not be performed in allowing this seeking.
- */
-KRYPTO_EXTERN rc_t CC KReencFileMakeRead (const struct KFile ** pself, 
-                                          const struct KFile * encrypted,
-                                          const struct KKey * deckey,
-                                          const struct KKey * enckey);
-
-KRYPTO_EXTERN rc_t CC KEncryptFileMakeRead (const struct KFile ** pself, 
-                                            const struct KFile * encrypted,
-                                            const struct KKey * enckey);
-
-
-/* ----------
- * Write mode encrypted file can only be written straight through form the
- * first byte to the last.
- */
-#if REENCFILE_WRITE_SUPPORTED
-KRYPTO_EXTERN rc_t CC KReencFileMakeWrite (struct KFile ** pself, 
-                                           struct KFile * encrypted,
-                                           const struct KKey * deckey,
-                                           const struct KKey * enckey);
-#endif
-
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_krypto_reencfile_ */
diff --git a/interfaces/krypto/rng-impl.h b/interfaces/krypto/rng-impl.h
deleted file mode 100644
index 96d03fe..0000000
--- a/interfaces/krypto/rng-impl.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kryptoimpl_
-#define _h_kryptoimpl_
-
-#include <krypto/extern.h>
-#include <krypto/rng.h>
-#include <klib/refcount.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-
-typedef union KRng_vt KRng_vt;
-
-struct KRng
-{
-    const union KRng_vt *vt;
-    KRefcount refcount;
-};
-
-#ifndef KRNG_IMPL
-#define KRNG_IMPL KRng
-#endif
-
-typedef struct KRng_vt_v1 KRng_vt_v1;
-struct KRng_vt_v1
-{
-    /* version == 1.x */
-    uint32_t maj;
-    uint32_t min;
-
-    /* start minor version == 0 */
-    rc_t (CC * destroy) (KRNG_IMPL * self);
-    rc_t (CC * seed)    (KRNG_IMPL * self);
-    rc_t (CC * reseed)  (KRNG_IMPL * self, const void * buff, size_t buff_size);
-    rc_t (CC * read)    (const KRNG_IMPL *self, void * buff, uint32_t buff_len,
-                         uint32_t * num_read);
-    /* end minor version == 0 */
-    /* start minor version == 1 */
-    /* end minor version == 1 */
-    /* end version == 1.x */
-};
-
-union KRng_vt
-{
-    KRng_vt_v1 v1;
-};
-
-KRYPTO_EXTERN rc_t CC KRngInit (KRng * self, union KRng_vt * vt, const char * type);
-KRYPTO_EXTERN rc_t CC KRngSysEntropy (KRng * self, uint8_t * buffer, size_t size);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kryptoimpl_ */
diff --git a/interfaces/krypto/rng.h b/interfaces/krypto/rng.h
deleted file mode 100644
index 32b0d47..0000000
--- a/interfaces/krypto/rng.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_krypto_rng_
-#define _h_krypto_rng_
-
-#ifndef _h_krypto_extern_
-#include <krypto/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct KRng KRng;
-
-/* attach a new 'ownership' reference */
-KRYPTO_EXTERN rc_t CC KRngAddRef (const KRng * self);
-
-/* release an 'ownership' reference */
-KRYPTO_EXTERN rc_t CC KRngRelease (const KRng * self);
-
-/* call to the system entropy function and [re-]seed the rng */
-KRYPTO_EXTERN rc_t CC KRngSeed (KRng * self);
-
-/* fill a buffer of a given size with random values: type sepcific as to the meaning or size of elements
- * return the number of elements actually written to the buffer */
-KRYPTO_EXTERN rc_t CC KRngRead (const KRng * self, void * buffer, uint32_t bsize, uint32_t * num_read);
-
-
-/*
- * Cryptographically secure pseudo-random number generator
- * elements are 8 bits long
- */
-KRYPTO_EXTERN rc_t CC KCSPRngMake (KRng ** pself);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_krypto_rng_ */
diff --git a/interfaces/krypto/testciphermgr.h b/interfaces/krypto/testciphermgr.h
deleted file mode 100644
index ffaa35a..0000000
--- a/interfaces/krypto/testciphermgr.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifndef _h_krypto_manager_test_
-#define _h_krypto_manager_test_
-
-#include <krypto/ciphermgr.h>
-
-/* MakeCipher
- */
-typedef int32_t kcipher_subtype;
-enum
-{
-    ksubcipher_none = -1,
-    ksubcipher_byte,
-    ksubcipher_vec,
-    ksubcipher_vecreg,
-    ksubcipher_accelerated, /* for example AES-NI */ 
-    ksubcipher_count
-};
-
-extern kcipher_subtype KCipherSubType;
-
-
-KRYPTO_EXTERN
-rc_t CC KCipherManagerTestMakeCipher (const KCipherManager * self,
-                                      struct KCipher ** cipher,
-                                      kcipher_type type,
-                                      kcipher_subtype subtype);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_manager_ */
diff --git a/interfaces/krypto/wgaencrypt.h b/interfaces/krypto/wgaencrypt.h
deleted file mode 100644
index b8cfeeb..0000000
--- a/interfaces/krypto/wgaencrypt.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_krypto_wgaencryptfile_
-#define _h_krypto_wgaencryptfile_
-
-#ifndef _h_krypto_extern_
-#include <krypto/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KFile;
-
-
-/*--------------------------------------------------------------------------
- * KFile
- *  wga extensions
- */
-
-/* MakeWGAEncRead
- *
- * Parameters:
- *   pself is a KFile that will represent the unencrypted side of operations.
- *
- *   encrypted is a KFile that will represent the encrypted side of operations.
- *
- *   key is an arbitrary array of characters
- *
- *   key_size is how many bytes to use from key.  Maximum used is 256.
- *
- *   encoding is one of the three values defined by FER_ENCODING above.  Any
- *   other values will cause a failure.
- *
- * KFileMakeWGAEncRead
- *   A file opened for read can only read and decrypt an encrypted file.  Seeks
- *   within the file are allowed if the KFile for the encrypted file allows
- *    seeks.
- * 
- * KFileMakeWGAEncUpdate
- *   A file opened for update must be able to read and write from the encrypted
- *   file.  Seeks within the file are allowed if the KFile for the encrypted 
- *   file allows seeks.
- *
- * KFileMakeWGAEncRead
- *   A Write opened file can only be written.  Seeks backwards are not allowed.
- *   Seeks forward will cause NUL data bytes to be inserted before encryption.
- *   An attempt will be made to truncate the encrypted file but failure of that
- *   operation will not fail this call.  Writes will begin at position 0.  If
- *   the file already existed and could not be truncated a corrupt file will
- *   result if the whole of the old contents are not over-written.
- *
- *
- * NOTE: cipher must be of type kcipherAES
- *
- */
-KRYPTO_EXTERN rc_t CC KFileMakeWGAEncRead (const struct KFile ** pself, 
-                                           const struct KFile * encrypted,
-                                           const char * key,
-                                           size_t key_size);
-
-
-/* IsWGAEnc
- *  identify whether a file is a KFileWGAEnc type encrypted file by the header.
- *  read the header into a buffer and pass it into this function.  
- *  The buffer_size needs to be at least 8 but more bytes lead to a better
- *  check up to the size of the header of a KFileWGAEnc type encrypted file.
- *  This file type is deprecated and is not versioned.  Hopefully we won't
- *  have to deal with changes to the format.
- *
- * Possible returns:
- *  0:
- *      the file is an identified KFileWGAEnc type file.  False positives are
- *      possible if a file happens to match at 8 or more bytes
- *
- *  RC (rcFS, rcFile, rcIdentifying, rcFile, rcWrongType)
- *      the file is definitely not a KFileWGAEnc type encrypted file.
- *     
- *  RC (rcFS, rcFile, rcIdentifying, rcParam, rcNull)
- *      bad parameters in the call
- *
- *  RC (rcFS, rcFile, rcIdentifying, rcBuffer, rcInsufficient)
- *      not a large enough buffer to make an identification
- */
-KRYPTO_EXTERN rc_t CC KFileIsWGAEnc (const void * buffer, size_t buffer_size);
-
-KRYPTO_EXTERN rc_t CC WGAEncValidate (const struct KFile * file, 
-                                      const char * password,
-                                      size_t password_size);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_wgaencryptfile_ */
diff --git a/interfaces/ktst/test_tools.hpp b/interfaces/ktst/test_tools.hpp
deleted file mode 100644
index 2e46d54..0000000
--- a/interfaces/ktst/test_tools.hpp
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef _h_ktst_test_tools_
-#define _h_ktst_test_tools_
-
-////////////////////////////////////////////////////////////////////////////////
-// these macros are available outside of test cases' code
-
-#define LOG(log_level, msg) \
-    (log_level >= ncbi::NK::TestEnv::verbosity ? (std::cerr << msg) : std::cerr)
-
-#define TEST_MESSAGE(M) \
-{ ncbi_NK_saveLocation(__FILE__,__LINE__); \
-    LOG(ncbi::NK::LogLevel::e_message, M << std::endl); }
-
-#define TEST_CHECKPOINT(M) TEST_MESSAGE(M)
-
-// report failure from a fixture
-#define FAIL( msg_ )     \
-      _REPORT_CRITICAL_ERROR_( (msg_), __FILE__, __LINE__, true )
-
-#define GET_TEST_SUITE ncbi::NK::GetTestSuite
-
-#endif// _h_ktst_test_tools_
diff --git a/interfaces/ktst/unit_test.hpp b/interfaces/ktst/unit_test.hpp
deleted file mode 100644
index e97b231..0000000
--- a/interfaces/ktst/unit_test.hpp
+++ /dev/null
@@ -1,255 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_ktst_unit_test_
-#define _h_ktst_unit_test_
-
-#include <ktst/unit_test_suite.hpp>
-
-////////////////////////////////////////////////////////////////////////////////
-namespace ncbi { namespace NK {
-
-// a utility template used to pass test character string case names to FixtureTestCase
-template<class T>
-struct TestCaseTraits
-{
-    static const char* name;
-};
-
-// create an executable test case class with the given fixture.
-template <class TCaseTraits, class TFixture>
-class FixtureTestCase : public ncbi::NK::TestCase, public TFixture { 
-public:
-    typedef TCaseTraits Traits;
-
-    // Represents the global test fixture. Cast to the correct data type in the test code
-    typedef void AUTO_TEST_CASE_FIXTURE;
-
-public: 
-    FixtureTestCase(void* globalFixture) 
-    : TestCase(TCaseTraits::name), _globalFixture (static_cast<AUTO_TEST_CASE_FIXTURE*>(globalFixture)) 
-    {
-    }
-
-protected: 
-    AUTO_TEST_CASE_FIXTURE* GET_GLOBAL_FIXTURE(void) const { return _globalFixture; } 
-    AUTO_TEST_CASE_FIXTURE* _globalFixture; 
-
-    const TFixture* GET_FIXTURE(void) const { return this; } 
-    TFixture* GET_FIXTURE(void) { return this; } 
-}; 
-
-// Create an invoker object for a test case with a given fixture.
-// The invoker object is static and registers itself with the global test suite during initialization.
-// When executed, the invoker will instantiate a fixture and a test case object and execute object's test method 
-// on the current thread.
-template <class TCase, class TFixture>
-class TestCaseInvoker : ncbi::NK::TestInvoker { 
-public: 
-    TestCaseInvoker() : TestInvoker(TCase::Traits::name) 
-    { 
-        ncbi::NK::GetTestSuite()->Add(this); 
-    } 
-private: 
-    virtual void Run(void* globalFixture) 
-    { 
-        try
-        { // in case constructor throws
-            TCase t(globalFixture); 
-            try { 
-                t.test_method(); 
-                SetErrorCounter(t.GetErrorCounter()); 
-            } catch (...) { 
-                SetErrorCounter(t.GetErrorCounter()); 
-                if (GetErrorCounter() == 0)
-                {
-                    SetErrorCounter(1);
-                }
-                throw; 
-            } 
-        }
-        catch (const execution_aborted&)
-        {
-            SetErrorCounter(1);
-            throw; 
-        } 
-        catch (const std::exception& ex)
-        {
-            if (!ncbi::NK::TestEnv::lastLocation.empty())
-            {
-                LOG(ncbi::NK::LogLevel::e_fatal_error, ncbi::NK::TestEnv::lastLocation << ": last checkpoint before exception \"" << ex.what() << "\"\n");
-            }        
-            SetErrorCounter(1);
-            throw; 
-        } 
-        catch (...) // a non-framework exception escaped
-        { 
-            if (!ncbi::NK::TestEnv::lastLocation.empty())
-            {
-                LOG(ncbi::NK::LogLevel::e_fatal_error, ncbi::NK::TestEnv::lastLocation << ": last checkpoint before an unknown exception\n");
-            }        
-            SetErrorCounter(1);
-            throw; 
-        } 
-    } 
-    static TestCaseInvoker instance;
-}; 
-
-// Create an out-of-thread invoker object for a test case with a given fixture.
-// The invoker object is static and registers itself with the global test suite during initialization.
-// When executed, the invoker will instantiate a fixture and a test case object and execute object's test method 
-// as a child process (Unix) or on a separate thread(Windows).
-template <class TCase, class TFixture, int rc, int timeout>
-class ProcessTestCaseInvoker : ncbi::NK::TestInvoker { 
-public: 
-    ProcessTestCaseInvoker() : TestInvoker(TCase::Traits::name) 
-    { 
-        ncbi::NK::GetTestSuite()->Add(this); 
-    } 
-private: 
-    virtual void Run(void* globalFixture) 
-    { 
-        try
-        {
-            TCase t(globalFixture); 
-            if (ncbi::NK::TestEnv::RunProcessTestCase(t, (void(ncbi::NK::TestCase::*)())&TCase::test_method, timeout) != rc)
-            {
-                throw ncbi::NK::execution_aborted(); 
-            }
-            SetErrorCounter(t.GetErrorCounter());
-        }
-        catch (...)
-        { 
-            if (GetErrorCounter() == 0)
-            {
-                SetErrorCounter(1);
-            }
-            throw; 
-        } 
-    }
-}; 
-
-}} // namespace
-
-// macros to be used to instantiate test cases
-
-// user code should not not use this directly. 
-#define DEFINE_TEST_CASE(testcase, F, rc, timeout) \
-    struct testcase { \
-        class dummy{}; \
-        typedef ncbi::NK::FixtureTestCase< ::ncbi::NK::TestCaseTraits<dummy>, F> Case;\
-        struct Instance : public Case { \
-            Instance(void* g) : Case(g){}\
-            void test_method(); } ; \
-        class Invoker : public ::ncbi::NK::TestCaseInvoker<Instance, F> {}; \
-        class ProcessInvoker : public ::ncbi::NK::ProcessTestCaseInvoker<Instance, F, rc, timeout> {}; \
-    };\
-    template<> const char* ::ncbi::NK::TestCaseTraits<testcase::dummy>::name=#testcase; 
-
-// define an in-thread test case with a fixture
-#define FIXTURE_TEST_CASE(testcase, F) \
-    DEFINE_TEST_CASE(testcase, F, 0, 0) \
-    static testcase::Invoker testcase##Invoker;\
-    void testcase::Instance::test_method()
-
-// define an in-thread test case without a fixture
-#define TEST_CASE(test_name) FIXTURE_TEST_CASE(test_name, ncbi::NK::Empty)
-
-// define an out-of-thread test case with a fixture, expected exit code, and a timeout (in seconds)
-#define PROCESS_FIXTURE_TEST_CASE(testcase, F, rc, timeout) \
-    DEFINE_TEST_CASE(testcase, F, rc, timeout) \
-    static testcase::ProcessInvoker testcase##Invoker;\
-    void testcase::Instance::test_method()
-
-// define an out-of-thread test case with an expected exit code and a timeout (in seconds), no fixture
-#define PROCESS_TEST_CASE(test_name, rc, timeout) PROCESS_FIXTURE_TEST_CASE(test_name, ncbi::NK::Empty, rc, timeout)
-
-// fix param type
-#if ALLOW_TESTING_CODE_TO_RELY_UPON_CODE_BEING_TESTED
-#define DECLARE_EXTERN_C_ENTRYPOINTS                             \
-    extern "C"                                                   \
-    {                                                            \
-        rc_t CC UsageSummary ( const char *progname )            \
-        { return ncbi::NK::TestEnv::UsageSummary ( progname ); } \
-                                                                 \
-        rc_t CC Usage ( const Args *args )                       \
-        { return ncbi::NK::TestEnv::Usage ( args ); }            \
-    }
-#else
-#define DECLARE_EXTERN_C_ENTRYPOINTS
-#endif
-
-// define a suite of test cases with a global fixture 
-// Note: Typed access to global fixture from the test cases' code is not currently implemented
-#define FIXTURE_TEST_SUITE( suite_name, F ) \
-DECLARE_EXTERN_C_ENTRYPOINTS \
-typedef F AUTO_TEST_CASE_FIXTURE; \
-int suite_name(int argc, char* argv[]) { \
-    try { \
-        ncbi::NK::TestEnv args(argc, argv); \
-        if (args.catch_system_errors) { \
-            args.set_handlers(); \
-        } \
-    } catch (...) { return 1; } \
-    ncbi::NK::counter_t ec = ncbi::NK::Main<AUTO_TEST_CASE_FIXTURE>(argc, argv, #suite_name); \
-    return ec == 0 ? 0 : -ec; /* positive rc represents the signal that killed the process */ \
-} 
-
-// define a suite of test cases with a global fixture
-// with callback to handle application command line arguments
-#define FIXTURE_TEST_SUITE_WITH_ARGS_HANDLER( suite_name, F, Handler ) \
-DECLARE_EXTERN_C_ENTRYPOINTS \
-typedef F AUTO_TEST_CASE_FIXTURE; \
-int suite_name(int argc, char* argv[]) { \
-    try { \
-        ncbi::NK::TestEnv args(argc, argv, Handler); \
-        if (args.catch_system_errors) { \
-            args.set_handlers(); \
-        } \
-    } catch (...) { return 1; } \
-    ncbi::NK::counter_t ec = ncbi::NK::Main<AUTO_TEST_CASE_FIXTURE>(argc, argv, #suite_name); \
-    return ec == 0 ? 0 : -ec; /* positive rc represents the signal that killed the process */ \
-}
-
-// define a suite of test cases with a global fixture; command line parsing, Usage and UsageSummary functions are supplied by the user's code
-#define FIXTURE_TEST_SUITE_WITH_USAGE( suite_name, F ) \
-typedef F AUTO_TEST_CASE_FIXTURE; \
-int suite_name(int argc, char* argv[]) { \
-    try { \
-        ncbi::NK::TestEnv args(argc, argv); \
-        if (args.catch_system_errors) { \
-            args.set_handlers(); \
-        } \
-    } catch (...) { return 1; } \
-    ncbi::NK::counter_t ec = ncbi::NK::Main<AUTO_TEST_CASE_FIXTURE>(argc, argv, #suite_name); \
-    return ec == 0 ? 0 : -ec; /* positive rc represents the signal that killed the process */ \
-} 
-
-#define TEST_SUITE( suite_name ) FIXTURE_TEST_SUITE(suite_name, ncbi::NK::Empty)
-#define TEST_SUITE_WITH_USAGE( suite_name ) FIXTURE_TEST_SUITE_WITH_USAGE(suite_name, ncbi::NK::Empty)
-#define TEST_SUITE_WITH_ARGS_HANDLER( suite_name, Handler ) FIXTURE_TEST_SUITE_WITH_ARGS_HANDLER(suite_name, ncbi::NK::Empty, Handler)
-
-#endif// _h_ktst_unit_test_
diff --git a/interfaces/ktst/unit_test_suite.hpp b/interfaces/ktst/unit_test_suite.hpp
deleted file mode 100644
index 9b260f8..0000000
--- a/interfaces/ktst/unit_test_suite.hpp
+++ /dev/null
@@ -1,491 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef NCBI_NK_UNIT_TEST__SUITE_HPP
-#define NCBI_NK_UNIT_TEST__SUITE_HPP
-
-// turn on INT64_C, UINT64_C etc.
-#define __STDC_CONSTANT_MACROS
-#include <klib/defs.h>
-
-#include <string>
-#include <vector>
-#include <cassert>
-#include <iostream>
-
-// it's generally a bad idea to make the test suite rely upon code under test
-#define ALLOW_TESTING_CODE_TO_RELY_UPON_CODE_BEING_TESTED 0
-
-////////////////////////////////////////////////////////////////////////////////
-// these macros are available outside of test cases' code
-
-#define LOG(log_level, msg) \
-    (log_level >= ncbi::NK::TestEnv::verbosity ? (std::cerr << msg) : std::cerr)
-
-/*#define TESTMESSAGE(M) \
-{ ncbi::NK::saveLocation(__FILE__,__LINE__); \
-    LOG(ncbi::NK::LogLevel::e_message, M); }*/
-
-#define TEST_MESSAGE(M) \
-{ ncbi::NK::saveLocation(__FILE__,__LINE__); \
-    LOG(ncbi::NK::LogLevel::e_message, M << std::endl); }
-
-#define TEST_CHECKPOINT(M) TEST_MESSAGE(M)
-
-// report failure from a fixture
-#define FAIL( msg_ )     \
-      ncbi::NK::_REPORT_CRITICAL_ERROR_( (msg_), __FILE__, __LINE__, true )
-
-#define GET_TEST_SUITE ncbi::NK::GetTestSuite
-
-////////////////////////////////////////////////////////////////////////////////
-
-#if ALLOW_TESTING_CODE_TO_RELY_UPON_CODE_BEING_TESTED
-struct Args;
-#endif
-
-namespace ncbi { namespace NK { 
-
-typedef int counter_t; 
-
-class Empty {};
-
-class execution_aborted {};
-
-class LogLevel {
-public:
-    enum E {
-        e_undefined,
-        e_all,
-        e_test_suite,
-        e_message,
-        e_warning,
-        e_error,
-        e_fatal_error,
-        e_nothing
-    };
-};
-
-extern void saveLocation(const char* file, int line);
-extern void _REPORT_CRITICAL_ERROR_(const std::string& msg, const char* file, int line, bool is_msg);
-
-template<class T> const T abs(const T& a) { return a >= 0 ? a : -a; }
-
-class TestCase;
-
-class TestEnv {
-public:
-    typedef rc_t ArgsHandler(int argc, char* argv[]);
-
-    TestEnv(int argc, char* argv[], ArgsHandler *argsHandler = NULL);
-    ~TestEnv(void);
-
-    static void set_handlers(void);
-
-    static std::string lastLocation;
-    static LogLevel::E verbosity;
-    bool catch_system_errors;
-
-    static int RunProcessTestCase(TestCase&, void(TestCase::*)(), int);
-    
-    // Sleep functions return false if sleep was interrupted
-    static bool Sleep(unsigned int seconds);
-    static bool SleepMs(unsigned int milliseconds);
-    
-    static const int TEST_CASE_TIMED_OUT=14;
-    static const int TEST_CASE_FAILED=255;
-
-#if ALLOW_TESTING_CODE_TO_RELY_UPON_CODE_BEING_TESTED
-    static struct Args* GetArgs() { return args; }
-#endif
-
-    static rc_t UsageSummary(const char* progname);
-#if ALLOW_TESTING_CODE_TO_RELY_UPON_CODE_BEING_TESTED
-    static rc_t Usage(const Args* args);
-#else
-    static rc_t Usage(const char *progname);
-#endif
-
-    static bool in_child_process;
-    static std::string GetPidString();
-
-private:
-    static void TermHandler();
-
-    static void SigHandler(int sig);
-
-    rc_t process_args(int argc, char* argv[], ArgsHandler* argsHandler);
-
-    int argc2;
-    char** argv2;
-
-#if ALLOW_TESTING_CODE_TO_RELY_UPON_CODE_BEING_TESTED
-    static struct Args* args;
-#endif
-};
-
-class TestCase {
-protected:
-    TestCase(const std::string& name);
-
-public:
-    ncbi::NK::counter_t GetErrorCounter(void) { return _ec; }
-    const std::string& GetName(void) const { return _name; }
-    void ErrorCounterAdd(ncbi::NK::counter_t ec) { _ec += ec; }
-
-protected:
-    void report_error(const char* msg, const char* file, int line, bool is_msg = false, bool isCritical = false);
-
-    void report_passed(const char* msg, const char* file, int line);
-
-    template<class T1>
-    void report_error2(const char* e1, const char* e2, T1 t1, T1 t2,
-        const char* file, int line, const char* eq, const char* ne,
-        bool isCritical = false)
-    {
-        ncbi::NK::saveLocation(file, line);
-        ++_ec;
-        LOG(LogLevel::e_error, file << "(" << line << "): ");
-        if (isCritical) {
-            LOG(LogLevel::e_error, "fatal ");
-        }
-        LOG(LogLevel::e_error, "error in \"" << _name << "\": ");
-        if (isCritical) {
-            LOG(LogLevel::e_error, "critical ");
-        }
-        LOG(LogLevel::e_error, "check " << e1 << " " << eq << " " << e2
-            << " failed [" << t1 << " " << ne << " " << t2 << "]");
-        LOG(LogLevel::e_error, std::endl);
-        if (isCritical)
-        { throw ncbi::NK::execution_aborted(); }
-    }
-    // pointers reported as ints (otherwise << may crash if given an invalid pointer)
-    template<class T1>
-    void report_error2(const char* e1, const char* e2, const T1* t1, const T1* t2,
-        const char* file, int line, const char* eq, const char* ne,
-        bool isCritical = false)
-    {
-        report_error2(e1, e2, (uint64_t)t1, (uint64_t)t2,file, line, eq, ne,isCritical);
-    }
-    template<class T1>
-    void report_error2(const char* e1, const char* e2, T1* t1, T1* t2,
-        const char* file, int line, const char* eq, const char* ne,
-        bool isCritical = false)
-    {
-        report_error2(e1, e2, (uint64_t)t1, (uint64_t)t2,file, line, eq, ne,isCritical);
-    }
-
-
-    template<class T1, class T2>
-    void report_passed2(const char* e1, const char* e2,
-        const T1& t1, const T2& t2,
-        const char* file, int line, const char* eq, const char* ne)
-    {
-        ncbi::NK::saveLocation(file, line);
-        LOG(LogLevel::e_all, file << "(" << line << "): info: "
-            "check " << e1 << " " << eq << " " << e2 << " passed" << std::endl);
-    }
-
-    template<class T1, class T2, class T3>
-    void report_passed_close(const char* e1, const char* e2,
-        const T1& t1, const T2& t2, const T3& tolerance,
-        const char* file, int line)
-    {
-        ncbi::NK::saveLocation(file, line);
-        LOG(LogLevel::e_all, file << "(" << line << "): "
-            "info: difference between "
-            << e1 << "{" << t1 << "} and " << e2 << "{" << t2 << "} "
-            "doesn't exceed " << tolerance << std::endl);
-    }
-
-    template<class T1, class T2, class T3, class T4>
-    void report_error_close(const char* e1, const char* e2,
-        const T1& t1, const T2& t2, const T3& tolerance, const T4& diff,
-        const char* file, int line, bool isCritical = false)
-    {
-        ncbi::NK::saveLocation(file, line);
-        ++_ec;
-        LOG(LogLevel::e_error, file << "(" << line << "): ");
-        if (isCritical) {
-            LOG(LogLevel::e_error, "fatal ");
-        }
-        LOG(LogLevel::e_error, "error in \"" << _name << "\": "
-            "difference{" << diff << "} between "
-            << e1 << "{" << t1 << "} and " << e2 << "{" << t2 << "} "
-            "exceeds " << tolerance << std::endl);
-        if (isCritical)
-        { throw ncbi::NK::execution_aborted(); }
-    }
-
-    void _REPORT_CRITICAL_ERROR_(const std::string& msg, const char* file, int line, bool is_msg = false);
-
-#define CHECK(exp)       \
-  ( (exp)                      \
-      ? report_passed((#exp), __FILE__, __LINE__) \
-      : report_error ((#exp), __FILE__, __LINE__) )
-
-#define REPORT_ERROR(exp)       \
-        report_error (exp, __FILE__, __LINE__)
-
-/* TODO #define CHECK_MESSAGE(exp, M)       \
-  std::ostringstream s, s << M, \
-  ( (exp)                      \
-      ? report_passed(s.str(),__FILE__,__LINE__) \
-      : report_error (s.str(),__FILE__,__LINE__) )*/
-
-#define REQUIRE(exp)     \
-  ( (exp)                      \
-      ? report_passed        ((#exp), __FILE__, __LINE__) \
-      : _REPORT_CRITICAL_ERROR_((#exp), __FILE__, __LINE__) )
-
-#define CHECK_CLOSE(left, right, tolerance) \
-( (ncbi::NK::abs((left) - (right)) < (tolerance)) \
-?report_passed_close(#left,#right,(left),(right),(tolerance),__FILE__,__LINE__)\
-: report_error_close(#left,#right,(left),(right),(tolerance), \
-    ncbi::NK::abs((left) - (right)), __FILE__, __LINE__) )
-
-#define REQUIRE_CLOSE(left, right, tolerance) \
-( (ncbi::NK::abs((left) - (right)) < (tolerance)) \
-?report_passed_close(#left,#right,(left),(right),(tolerance),__FILE__,__LINE__)\
-: report_error_close(#left,#right,(left),(right),(tolerance), \
-    ncbi::NK::abs((left) - (right)), __FILE__, __LINE__, true) )
-
-    template<class T>
-    void AssertEqual(const T& e1, const T& e2, const char* e1str, const char* e2str, const char* file, unsigned int line, bool critical=false)
-    {
-        if (e1 == e2)
-        {
-            report_passed2(e1str, e2str, e1, e2, file, line, "==", "!=");
-        }
-        else
-        {
-            report_error2 (e1str, e2str, e1, e2, file, line, "==", "!=", critical);
-        }
-    }
-#define CHECK_EQUAL(e1, e2)     AssertEqual((e1),(e2),#e1,#e2,__FILE__,__LINE__, false)
-#define CHECK_EQ(e1, e2)        CHECK_EQUAL(e1,e2)
-#define REQUIRE_EQUAL(e1, e2)   AssertEqual((e1),(e2),#e1,#e2,__FILE__,__LINE__, true)
-#define REQUIRE_EQ(e1, e2)      REQUIRE_EQUAL(e1,e2)
-
-    template<class T>
-    void AssertNotEqual(const T& e1, const T& e2, const char* e1str, const char* e2str, const char* file, unsigned int line, bool critical=false)
-    {
-        if (e1 != e2)
-        {
-            report_passed2(e1str, e2str, e1, e2, file, line, "!=", "==");
-        }
-        else
-        {
-            report_error2 (e1str, e2str, e1, e2, file, line, "!=", "==", critical);
-        }
-    }
-#define CHECK_NE(e1, e2)     AssertNotEqual((e1),(e2),#e1,#e2,__FILE__,__LINE__, false)
-#define REQUIRE_NE(e1, e2)   AssertNotEqual((e1),(e2),#e1,#e2,__FILE__,__LINE__, true)
-
-    template<class T>
-    void AssertGreaterOrEqual(const T& e1, const T& e2, const char* e1str, const char* e2str, const char* file, unsigned int line, bool critical=false)
-    {
-        if (e1 >= e2)
-        {
-            report_passed2(e1str, e2str, e1, e2, file, line, ">=", "<");
-        }
-        else
-        {
-            report_error2 (e1str, e2str, e1, e2, file, line, ">=", "<", critical);
-        }
-    }
-#define CHECK_GE(e1, e2)    AssertGreaterOrEqual((e1),(e2),#e1,#e2,__FILE__,__LINE__, false)
-#define REQUIRE_GE(e1, e2)  AssertGreaterOrEqual((e1),(e2),#e1,#e2,__FILE__,__LINE__, true)
-
-    template<class T>
-    void AssertGreater(const T& e1, const T& e2, const char* e1str, const char* e2str, const char* file, unsigned int line, bool critical=false)
-    {
-        if (e1 > e2)
-        {
-            report_passed2(e1str, e2str, e1, e2, file, line, ">", "<=");
-        }
-        else
-        {
-            report_error2 (e1str, e2str, e1, e2, file, line, ">", "<=", critical);
-        }
-    }
-#define CHECK_GT(e1, e2)    AssertGreater((e1),(e2),#e1,#e2,__FILE__,__LINE__, false)
-#define REQUIRE_GT(e1, e2)  AssertGreater((e1),(e2),#e1,#e2,__FILE__,__LINE__, true)
-
-    template<class T>
-    void AssertLessOrEqual(const T& e1, const T& e2, const char* e1str, const char* e2str, const char* file, unsigned int line, bool critical=false)
-    {
-        if (e1 <= e2)
-        {
-            report_passed2(e1str, e2str, e1, e2, file, line, "<=", ">");
-        }
-        else
-        {
-            report_error2 (e1str, e2str, e1, e2, file, line, "<=", ">", critical);
-        }
-    }
-#define CHECK_LE(e1, e2)    AssertLessOrEqual((e1),(e2),#e1,#e2,__FILE__,__LINE__, false)
-#define REQUIRE_LE(e1, e2)  AssertLessOrEqual((e1),(e2),#e1,#e2,__FILE__,__LINE__, true)
-
-    template<class T>
-    void AssertLess(const T& e1, const T& e2, const char* e1str, const char* e2str, const char* file, unsigned int line, bool critical=false)
-    {
-        if (e1 < e2)
-        {
-            report_passed2(e1str, e2str, e1, e2, file, line, "<", ">=");
-        }
-        else
-        {
-            report_error2 (e1str, e2str, e1, e2, file, line, "<", ">=", critical);
-        }
-    }
-#define CHECK_LT(e1, e2)    AssertLess((e1),(e2),#e1,#e2,__FILE__,__LINE__, false)
-#define REQUIRE_LT(e1, e2)  AssertLess((e1),(e2),#e1,#e2,__FILE__,__LINE__, true)
-
-    void report_rc(rc_t rc, const char* callStr, const char* file, int line, int successExpected, bool isCritical = false);
-
-#define CHECK_RC(exp)   report_rc((exp), #exp, __FILE__, __LINE__, true, false)
-#define REQUIRE_RC(exp) report_rc((exp), #exp, __FILE__, __LINE__, true, true)
-#define CHECK_RC_FAIL(exp)   report_rc((exp), #exp, __FILE__, __LINE__, false, false)
-#define REQUIRE_RC_FAIL(exp) report_rc((exp), #exp, __FILE__, __LINE__, false, true)
-
-    template<class T>
-    void AssertNull(const T* e1, const char* e1str,const char* file, unsigned int line, bool critical=false)
-    {
-        if (e1 == 0)
-        {
-            report_passed2(e1str, "NULL", e1, (const T*)0, file, line, "==", "!=");
-        }
-        else
-        {
-            report_error2 (e1str, "NULL", e1, (const T*)0, file, line, "==", "!=", critical);
-        }
-    }
-#define CHECK_NULL(e1)   AssertNull((e1), #e1, __FILE__,__LINE__, false)
-#define REQUIRE_NULL(e1) AssertNull((e1), #e1, __FILE__,__LINE__, true)
-
-    template<class T>
-    void AssertNotNull(const T* e1, const char* e1str,const char* file, unsigned int line, bool critical=false)
-    {
-        if (e1 != 0)
-        {
-            report_passed2(e1str, "NULL", e1, (const T*)0, file, line, "!=", "==");
-        }
-        else
-        {
-            report_error2 (e1str, "NULL", e1, (const T*)0, file, line, "!=", "==", critical);
-        }
-    }
-#define CHECK_NOT_NULL(e1)   AssertNotNull((e1), #e1, __FILE__,__LINE__, false)
-#define REQUIRE_NOT_NULL(e1) AssertNotNull((e1), #e1, __FILE__,__LINE__, true)
-
-private:
-    const std::string _name;
-    ncbi::NK::counter_t _ec;
-};
-
-class TestInvoker {
-protected:
-    TestInvoker(const std::string& name) : _name(name), _ec(0) {}
-    virtual ~TestInvoker(void) {}
-public:
-    virtual void Run(void* globalFixtute) = 0;
-    const std::string& GetName(void) const { return _name; }
-    ncbi::NK::counter_t GetErrorCounter(void) { return _ec; }
-protected:
-    void SetErrorCounter(ncbi::NK::counter_t ec) { _ec = ec; }
-private:
-    const std::string _name;
-    ncbi::NK::counter_t _ec;
-};
-
-class TestRunner {
-    typedef std::vector<ncbi::NK::TestInvoker*> T;
-    typedef T::const_iterator TCI;
-
-public:
-    TestRunner();
-
-    int    argc;
-    char** argv;
-
-    void ReportTestNumber(void);
-    void SetArgs(int argc, char* argv[]);
-    void Add(ncbi::NK::TestInvoker* t);
-    counter_t Run(void* globalFixtute) const;
-
-private:
-    T _cases;
-};
-
-extern ncbi::NK::TestRunner* GetTestSuite();
-
-template<class TFixture>
-ncbi::NK::counter_t Main(int argc, char* argv[],
-                         const char* suite_name)
-{
-    ncbi::NK::counter_t ec = 0;
-    ncbi::NK::TestRunner* t = ncbi::NK::GetTestSuite();
-    assert(t);
-    t->SetArgs(argc, argv);
-    t->ReportTestNumber();
-    try {
-        TFixture globalFixtute;
-        LOG(ncbi::NK::LogLevel::e_test_suite,
-            "Entering test suite \"" << suite_name << "\"\n");
-        ec = t->Run(&globalFixtute);
-        LOG(ncbi::NK::LogLevel::e_test_suite,
-            "Leaving test suite \"" << suite_name << "\"\n");
-    } 
-    catch (std::exception& ex) 
-    { 
-        LOG(ncbi::NK::LogLevel::e_nothing, std::string("*** Exception caught: ") + ex.what());
-        ++ec; 
-    }
-    catch (...) 
-    { 
-        ++ec; 
-    }
-    switch (ec) {
-        case 0:
-          LOG(ncbi::NK::LogLevel::e_nothing, "\n*** No errors detected\n");
-          break;
-        case 1:
-          LOG(ncbi::NK::LogLevel::e_nothing, "\n*** " << ec <<
-           " failure detected in test suite \"" << suite_name << "\"\n");
-          break;
-        default:
-          LOG(ncbi::NK::LogLevel::e_nothing, "\n*** " << ec <<
-           " failures detected in test suite \"" << suite_name << "\"\n");
-          break;
-    }
-    return ec;
-}
-
-} } // namespace ncbi::NK
-
-
-#endif// NCBI_NK_UNIT_TEST__SUITE_HPP
diff --git a/interfaces/kxml/xml.h b/interfaces/kxml/xml.h
deleted file mode 100644
index 2f42564..0000000
--- a/interfaces/kxml/xml.h
+++ /dev/null
@@ -1,382 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kxml_xml_
-#define _h_kxml_xml_
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#include <klib/defs.h>
-
-#include <stdarg.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KFile;
-struct KNamelist;
-struct KXMLNodeset;
-
-
-/*--------------------------------------------------------------------------
- * XML node
- */
-typedef struct KXMLNode KXMLNode;
-
-/* AddRef
- * Release
- */
-KLIB_EXTERN rc_t CC KXMLNodeAddRef ( const KXMLNode *self );
-KLIB_EXTERN rc_t CC KXMLNodeRelease ( const KXMLNode *self );
-
-/* GetName
- * Get node path from parent nodeset
- */
-KLIB_EXTERN rc_t CC KXMLNodeGetName ( const KXMLNode *self, const char **name );
-
-/* Get element name (tag)
- */
-KLIB_EXTERN rc_t CC KXMLNodeElementName ( const KXMLNode *self, const char **name );
-
-/* Read
- */
-KLIB_EXTERN rc_t CC KXMLNodeRead ( const KXMLNode *self,
-    size_t offset, void *buffer, size_t size,
-    size_t *num_read, size_t *remaining );
-
-/* Write
- */
-KLIB_EXTERN rc_t CC KXMLNodeWrite ( KXMLNode *self,
-    size_t offset, const void *buffer, size_t size );
-
-/* Append
- */
-KLIB_EXTERN rc_t CC KXMLNodeAppend ( KXMLNode *self,
-    const void *buffer, size_t bsize );
-
-
-/* ReadAs ( formatted )
- *  reads as integer or float value in native byte order
- *  casts smaller-sized values to desired size, e.g.
- *    uint32_t to uint64_t
- *
- *  "i" [ OUT ] - return parameter for signed integer
- *  "u" [ OUT ] - return parameter for unsigned integer
- *  "f" [ OUT ] - return parameter for double float
- */
-KLIB_EXTERN rc_t CC KXMLNodeReadAsI16 ( const KXMLNode *self, int16_t *i );
-KLIB_EXTERN rc_t CC KXMLNodeReadAsU16 ( const KXMLNode *self, uint16_t *u );
-KLIB_EXTERN rc_t CC KXMLNodeReadAsI32 ( const KXMLNode *self, int32_t *i );
-KLIB_EXTERN rc_t CC KXMLNodeReadAsU32 ( const KXMLNode *self, uint32_t *u );
-KLIB_EXTERN rc_t CC KXMLNodeReadAsI64 ( const KXMLNode *self, int64_t *i );
-KLIB_EXTERN rc_t CC KXMLNodeReadAsU64 ( const KXMLNode *self, uint64_t *u );
-KLIB_EXTERN rc_t CC KXMLNodeReadAsF64 ( const KXMLNode *self, double *f );
-
-
-/* ReadCString ( formatted )
- *  reads as C-string
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - output buffer for
- *  NUL terminated string.
- *
- *  "size" [ OUT ] - return parameter giving size of string
- *  not including NUL byte. the size is set both upon success
- *  and insufficient buffer space error.
- */
-KLIB_EXTERN rc_t CC KXMLNodeReadCString ( const KXMLNode *self,
-    char *buffer, size_t bsize, size_t *size );
-
-/* ReadCStr
- *  reads node value as C-string
- *
- *  "str" [ IN ] - returned pointer to a NULL terminated string.
- *                 Caller responsible to dealloc (free)!
- *  "default_value" [IN] - default value used in case node value is empty, NULL - none
- */
-KLIB_EXTERN rc_t CC KXMLNodeReadCStr( const KXMLNode *self, char** str, const char* default_value );
-
-/* Write ( formatted )
- *  writes string
- *
- *  "str" [ IN ] - NULL terminated string.
- */
-KLIB_EXTERN rc_t CC KXMLNodeWriteCString ( KXMLNode *self, const char *str );
-
-
-/* OpenNodesetRead
- *
- * NB. OpenNodesetRead could return Nodeset with 0 elements.
- *  To make sure the node exists you should verify that (KXMLNodesetCount > 0)
- */
-KLIB_EXTERN rc_t CC KXMLNodeOpenNodesetRead ( const KXMLNode *self,
-    struct KXMLNodeset const **ns, const char *path, ... );
-KLIB_EXTERN rc_t CC KXMLNodeVOpenNodesetRead ( const KXMLNode *self,
-    struct KXMLNodeset const **ns, const char *path, va_list args );
-
-/* OpenNodesetUpdate
- */
-KLIB_EXTERN rc_t CC KXMLNodeOpenNodesetUpdate ( KXMLNode *self,
-    struct KXMLNodeset **ns, const char *path, ... );
-KLIB_EXTERN rc_t CC KXMLNodeVOpenNodesetUpdate ( KXMLNode *self,
-    struct KXMLNodeset **ns, const char *path, va_list args );
-
-/* ReadAttr
- */
-KLIB_EXTERN rc_t CC KXMLNodeReadAttr ( const KXMLNode *self,
-     const char *attr, void *buffer, size_t bsize,
-     size_t *num_read, size_t *remaining );
-
-/* WriteAttr
- */
-KLIB_EXTERN rc_t CC KXMLNodeWriteAttr ( KXMLNode *self,
-     const char *attr, const void *buffer, size_t size );
-
-
-/* ReadAttrAs ( formatted )
- *  reads as integer or float value in native byte order
- *  casts smaller-sized values to desired size, e.g.
- *    uint32_t to uint64_t
- *
- *  "i" [ OUT ] - return parameter for signed integer
- *  "u" [ OUT ] - return parameter for unsigned integer
- *  "f" [ OUT ] - return parameter for double float
- */
-KLIB_EXTERN rc_t CC KXMLNodeReadAttrAsI16 ( const KXMLNode *self, const char *attr, int16_t *i );
-KLIB_EXTERN rc_t CC KXMLNodeReadAttrAsU16 ( const KXMLNode *self, const char *attr, uint16_t *u );
-KLIB_EXTERN rc_t CC KXMLNodeReadAttrAsI32 ( const KXMLNode *self, const char *attr, int32_t *i );
-KLIB_EXTERN rc_t CC KXMLNodeReadAttrAsU32 ( const KXMLNode *self, const char *attr, uint32_t *u );
-KLIB_EXTERN rc_t CC KXMLNodeReadAttrAsI64 ( const KXMLNode *self, const char *attr, int64_t *i );
-KLIB_EXTERN rc_t CC KXMLNodeReadAttrAsU64 ( const KXMLNode *self, const char *attr, uint64_t *u );
-KLIB_EXTERN rc_t CC KXMLNodeReadAttrAsF64 ( const KXMLNode *self, const char *attr, double *f );
-
-
-/* ReadAttrCString ( formatted )
- *  reads as C-string
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - output buffer for
- *  NUL terminated string.
- *
- *  "size" [ OUT ] - return parameter giving size of string
- *  not including NUL byte. the size is set both upon success
- *  and insufficient buffer space error.
- */
-KLIB_EXTERN rc_t CC KXMLNodeReadAttrCString ( const KXMLNode *self, const char *attr,
-    char *buffer, size_t bsize, size_t *size );
-
-/* ReadAttrCStr
- *  reads attribute as C-string
- *
- *  "str" [ IN ] - returned pointer to a NULL terminated string.
- *                 Caller responsible to dealloc (free)!
- *  "default_value" [IN] - default value used in case node value is empty, NULL - none
- */
-KLIB_EXTERN rc_t CC KXMLNodeReadAttrCStr( const KXMLNode *self, const char *attr, char** str, const char* default_value);
-
-/* CountChildNodes
- *  count child nodes
- */
-KLIB_EXTERN rc_t CC KXMLNodeCountChildNodes(const KXMLNode *self,
-    uint32_t *count);
-
-/* GetNodeRead
- *  access indexed node
- *  "idx" [ IN ] - a zero-based index
- */
-KLIB_EXTERN rc_t CC KXMLNodeGetNodeRead ( const KXMLNode *self,
-    const KXMLNode **node, uint32_t idx );
-
-/* ListAttr
- *  list all named attributes
- */
-KLIB_EXTERN rc_t CC KXMLNodeListAttr ( const KXMLNode *self,
-    struct KNamelist const **names );
-
-/* ListChild
- *  list all named children
- */
-KLIB_EXTERN rc_t CC KXMLNodeListChild ( const KXMLNode *self,
-    struct KNamelist const **names );
-
-
-/* GetFirstChildNodeRead
- *  Returns the first(with index 0) sub-node of self using path.
- *  Is equivalent to:
- *          KXMLNodeOpenNodesetRead(self, &nc, path, ...);
- *          KXMLNodesetGetNodeRead(ns, node, 0);
- *  It will return NotFound error if any node exists
- */
-KLIB_EXTERN rc_t CC KXMLNodeGetFirstChildNodeRead ( const KXMLNode *self,
-    const KXMLNode **node, const char *path, ... );
-KLIB_EXTERN rc_t CC KXMLNodeVGetFirstChildNodeRead ( const KXMLNode *self,
-    const KXMLNode **node, const char *path, va_list args );
-
-
-/*--------------------------------------------------------------------------
- * XML node set
- */
-typedef struct KXMLNodeset KXMLNodeset;
-
-/* AddRef
- * Release
- */
-KLIB_EXTERN rc_t CC KXMLNodesetAddRef ( const KXMLNodeset *self );
-KLIB_EXTERN rc_t CC KXMLNodesetRelease ( const KXMLNodeset *self );
-
-/* Count
- *  retrieve the number of nodes in set
- */
-KLIB_EXTERN rc_t CC KXMLNodesetCount ( const KXMLNodeset *self, uint32_t *count );
-
-/* GetNode
- *  access indexed node
- *  "idx" [ IN ] - a zero-based index
- */
-KLIB_EXTERN rc_t CC KXMLNodesetGetNodeRead ( const KXMLNodeset *self,
-    const KXMLNode **node, uint32_t idx );
-
-
-/*--------------------------------------------------------------------------
- * XML document
- */
-typedef struct KXMLDoc KXMLDoc;
-
-/* AddRef
- * Release
- *  ignores NULL references
- */
-KLIB_EXTERN rc_t CC KXMLDocAddRef ( const KXMLDoc *self );
-KLIB_EXTERN rc_t CC KXMLDocRelease ( const KXMLDoc *self );
-
-/* OpenNodesetRead
- *  opens a node set with given path
- */
-KLIB_EXTERN rc_t CC KXMLDocOpenNodesetRead ( const KXMLDoc *self,
-    const KXMLNodeset **ns, const char *path, ... );
-KLIB_EXTERN rc_t CC KXMLDocVOpenNodesetRead ( const KXMLDoc *self,
-    const KXMLNodeset **ns, const char *path, va_list args );
-
-/* OpenNodesetUpdate
- *  opens a node set with given path
- */
-KLIB_EXTERN rc_t CC KXMLDocOpenNodesetUpdate ( KXMLDoc *self,
-    KXMLNodeset **ns, const char *path, ... );
-KLIB_EXTERN rc_t CC KXMLDocVOpenNodesetUpdate ( KXMLDoc *self,
-    KXMLNodeset **ns, const char *path, va_list args );
-
-
-/*--------------------------------------------------------------------------
- * XML manager
- */
-typedef struct KXMLMgr KXMLMgr;
-
-/* Make
- *  make an XML manager object
- */
-KLIB_EXTERN rc_t CC KXMLMgrMakeRead ( const KXMLMgr **mgr );
-
-/* AddRef
- * Release
- *  ignores NULL references
- */
-KLIB_EXTERN rc_t CC KXMLMgrAddRef ( const KXMLMgr *self );
-KLIB_EXTERN rc_t CC KXMLMgrRelease ( const KXMLMgr *self );
-
-/* MakeDoc
- *  create a document object from source file
- */
-KLIB_EXTERN rc_t CC KXMLMgrMakeDocRead ( const KXMLMgr *self,
-    const KXMLDoc **doc, struct KFile const *src );
-
-/* MakeDoc
- *  create a document object from memory
- */
-KLIB_EXTERN rc_t KXMLMgrMakeDocReadFromMemory ( const KXMLMgr *self,
-    const KXMLDoc **result, const char* buffer, uint64_t size );
-
-/*--------------------------------------------------------------------------
- * KDirectory
- *  this will probably be relocated later on
- */
-struct KDirectory;
-struct KFile;
-struct String;
-struct VFSManager;
-struct VPath;
-
-/* OpenXTocDirRead
- *  open copycat XML as a chroot'd directory
- *  XML data comes from a KFile in this case
- *
- *  "dir" [ OUT ] - return parameter for directory object
- *
- *  "base_path" [ IN ] - NUL terminated string giving the path
- *   of the new directory relative to "self". NB - can be absolute
- *   or relative, but is always interpreted by "self".
- *
- *  "xml" [ IN ] - file containing XML data produced by copycat tool
- */
-rc_t CC KDirectoryOpenXTocDirRead (const struct KDirectory * self,
-                                   const struct KDirectory ** pnew_dir,
-                                   bool chroot,
-                                   const struct KFile * xml,
-                                   const char * path, ... );
-rc_t CC KDirectoryVOpenXTocDirRead (const struct KDirectory * self,
-                                    const struct KDirectory ** pnew_dir,
-                                    bool chroot,
-                                    const struct KFile * xml,
-                                    const char * _path,
-                                    va_list args );
-rc_t CC KDirectoryOpenXTocDirRead (const struct KDirectory * self,
-                                   const struct KDirectory ** pnew_dir,
-                                   bool chroot,
-                                   const struct KFile * xml,
-                                   const char * path, ... );
-rc_t CC KDirectoryOpenXTocDirReadDir (const struct KDirectory * self,
-                                      const struct KDirectory ** pnew_dir,
-                                      const struct KFile * xml,
-                                      const struct String * spath);
-
-rc_t CC VFSManagerOpenXTocDirRead (const struct VFSManager * self,
-                                   const struct KDirectory ** pnew_dir,
-                                   const struct KFile * xml,
-                                   const struct VPath * path);
-
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kxml_xml_ */
diff --git a/interfaces/loader/alignment-writer.h b/interfaces/loader/alignment-writer.h
deleted file mode 100644
index c995fb9..0000000
--- a/interfaces/loader/alignment-writer.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#ifndef BAM_LOAD_ALIGNMENT_WRITER_H_
-#define BAM_LOAD_ALIGNMENT_WRITER_H_ 1
-
-#include <klib/text.h>
-#include <vdb/database.h>
-#include <vdb/table.h>
-#include <vdb/cursor.h>
-
-#include <insdc/insdc.h>
-
-#include <align/writer-alignment.h>
-
-typedef struct AlignmentWriter AlignmentWriter;
-typedef struct AlignmentRecord AlignmentRecord;
-
-struct AlignmentRecord {
-    TableWriterAlgnData data;
-    int64_t alignId;
-    bool isPrimary;
-
-    INSDC_coord_one read_id;
-    int64_t ref_id;
-    INSDC_coord_zero ref_start;
-    uint64_t global_ref_start;
-    bool ref_orientation;
-    uint32_t mapq;
-    uint64_t tmp_key_id;
-
-    INSDC_coord_zero read_start;
-    INSDC_coord_len read_len;
-
-    bool mate_ref_orientation;
-    int64_t mate_ref_id;
-    INSDC_coord_zero mate_ref_pos;
-    int64_t mate_align_id;
-    int32_t template_len;
-};
-
-#define AR_REF_ID(X) ((X).ref_id)
-#define AR_REF_START(X) ((X).global_ref_start)
-#define AR_REF_LEN(X) ((X).ref_len)
-#define AR_REF_ORIENT(X) ((X).ref_orientation)
-#define AR_READNO(X) ((X).read_id)
-#define AR_MAPQ(X) ((X).mapq)
-#define AR_KEY(X) ((X).tmp_key_id)
-
-#define AR_BASECOUNT(X) ((X).data.has_mismatch.elements)
-#define AR_HAS_MISMATCH(X) ((bool *)((X).data.has_mismatch.buffer))
-#define AR_HAS_OFFSET(X) ((bool *)((X).data.has_ref_offset.buffer))
-
-#define AR_NUM_MISMATCH(X) ((X).data.mismatch.elements)
-#define AR_MISMATCH(X) ((char *)((X).data.mismatch.buffer))
-
-#define AR_NUM_MISMATCH_QUAL(X) ((X).data.mismatch_qual.elements)
-#define AR_MISMATCH_QUAL(X) ((uint8_t *)((X).data.mismatch_qual.buffer))
-
-#define AR_NUM_OFFSET(X) ((X).data.ref_offset.elements)
-#define AR_OFFSET(X) ((INSDC_coord_zero *)((X).data.ref_offset.buffer))
-
-AlignmentWriter *AlignmentMake(VDatabase *db);
-
-rc_t AlignmentWriteRecord(AlignmentWriter * const self, AlignmentRecord * const data, bool expectUnsorted);
-
-rc_t AlignmentStartUpdatingSpotIds(AlignmentWriter * const self);
-
-rc_t AlignmentGetSpotKey(AlignmentWriter * const self, uint64_t *keyId, int64_t *alignId, bool *isPrimary);
-
-rc_t AlignmentGetRefPos(AlignmentWriter *const self, int64_t row, ReferenceStart *const rslt);
-
-rc_t AlignmentUpdateInfo(AlignmentWriter *const self, int64_t const spotId,
-                         int64_t const mateId, ReferenceStart const *const mateRefPos);
-
-rc_t AlignmentWhack(AlignmentWriter * const self, bool const commit);
-
-size_t AlignmentRecordBufferSize(size_t const readlen, bool const hasMismatchQual);
-
-void AlignmentRecordInit(AlignmentRecord *self, void *buffer, unsigned readlen,
-                         char **endp,
-                         bool expectUnsorted,
-                         bool hasMismatchQual
-                         );
-
-#endif
diff --git a/interfaces/loader/common-reader-priv.h b/interfaces/loader/common-reader-priv.h
deleted file mode 100644
index 26a8e19..0000000
--- a/interfaces/loader/common-reader-priv.h
+++ /dev/null
@@ -1,300 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#ifndef _h_common_reader_priv_
-#define _h_common_reader_priv_
-
-#include <loader/common-reader.h>
-
-#include <klib/refcount.h>
-#include <klib/text.h>
-#include <klib/data-buffer.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*TODO: add module rcLoader to rc.h? */
-#define RC_MODULE rcAlign
-
-/*--------------------------------------------------------------------------
- ReaderFile
- */
-#ifndef READERFILE_IMPL
-    #define READERFILE_IMPL struct ReaderFile
-#endif
-
-typedef struct ReaderFile_vt_v1_struct {
-    /* version == 1.x */
-    uint32_t maj;
-    uint32_t min;
-
-    /* start minor version == 0 */
-    rc_t ( *destroy   )                 ( READERFILE_IMPL* self );
-    rc_t ( *getRecord )                 ( const READERFILE_IMPL *self, const Record** result );
-    float ( *getProportionalPosition )  ( const READERFILE_IMPL *self );
-    rc_t ( *getReferenceInfo )          ( const READERFILE_IMPL *self, const ReferenceInfo** result );
-    /* end minor version == 0 */
-
-} ReaderFile_vt_v1;
-
-typedef union ReaderFile_vt {
-    ReaderFile_vt_v1* v1;
-} ReaderFile_vt;
-
-struct ReaderFile
-{
-    ReaderFile_vt vt;
-    KRefcount refcount;
-    char* pathname;
-};
-
-/* Init
- *  polymorphic parent constructor
- */
-rc_t CC ReaderFileInit ( READERFILE_IMPL *self );
-
-/* Whack
- *  destructor
- */
-rc_t CC ReaderFileWhack ( ReaderFile *self );
-
-/*--------------------------------------------------------------------------
- Record
- */
-#ifndef RECORD_IMPL
-    #define RECORD_IMPL struct Record
-#endif
-
-typedef struct Record_vt_v1_struct {
-    /* version == 1.x */
-    uint32_t maj;
-    uint32_t min;
-
-    /* start minor version == 0 */
-    rc_t ( *addRef  ) ( const RECORD_IMPL* self );
-    rc_t ( *release ) ( const RECORD_IMPL* self );
-    rc_t ( *getSequence  ) ( const RECORD_IMPL *self, const Sequence** result );
-    rc_t ( *getAlignment ) ( const RECORD_IMPL *self, const Alignment** result );
-    rc_t ( *getRejected  ) ( const RECORD_IMPL *self, const Rejected** result );
-    /* end minor version == 0 */
-
-} Record_vt_v1;
-
-typedef union Record_vt {
-    Record_vt_v1* v1;
-} Record_vt;
-
-struct Record
-{
-    Record_vt vt;
-};
-
-/*--------------------------------------------------------------------------
- Sequence
- */
-#ifndef SEQUENCE_IMPL
-    #define SEQUENCE_IMPL struct Sequence
-#endif
-
-typedef struct Sequence_vt_v1_struct {
-    /* version == 1.x */
-    uint32_t maj;
-    uint32_t min;
-
-    /* start minor version == 0 */
-    rc_t ( *addRef  ) ( const SEQUENCE_IMPL* self );
-    rc_t ( *release ) ( const SEQUENCE_IMPL* self );
-
-    rc_t ( *getReadLength   )   ( const SEQUENCE_IMPL *self, uint32_t *length );
-    rc_t ( *getRead         )   ( const SEQUENCE_IMPL *self, char *sequence );
-    rc_t ( *getRead2        )   ( const SEQUENCE_IMPL *self, char *sequence, uint32_t start, uint32_t stop );
-    rc_t ( *getQuality      )   ( const SEQUENCE_IMPL *self, const int8_t **quality, uint8_t *offset, int *qualType );
-    rc_t ( *getSpotGroup    )   ( const SEQUENCE_IMPL *self, const char **name, size_t *length );
-    rc_t ( *getSpotName     )   ( const SEQUENCE_IMPL *self, const char **name, size_t *length );
-    bool ( *isColorSpace    )   ( const SEQUENCE_IMPL *self );
-    rc_t ( *getCSKey        )   ( const SEQUENCE_IMPL *self, char cskey[1] );
-    rc_t ( *getCSReadLength )   ( const SEQUENCE_IMPL *self, uint32_t *length );
-    rc_t ( *getCSRead       )   ( const SEQUENCE_IMPL *self, char *sequence );
-    rc_t ( *getCSQuality    )   ( const SEQUENCE_IMPL *self, const int8_t **quality, uint8_t *offset, int *qualType );
-                          
-    bool ( *wasPaired     )     ( const SEQUENCE_IMPL *self );
-    int  ( *orientationSelf )   ( const SEQUENCE_IMPL *self );
-    int  ( *orientationMate )   ( const SEQUENCE_IMPL *self );
-    bool ( *isFirst       )     ( const SEQUENCE_IMPL *self );
-    bool ( *isSecond      )     ( const SEQUENCE_IMPL *self );
-    bool ( *isDuplicate   )     ( const SEQUENCE_IMPL *self ); 
-    bool ( *isLowQuality   )    ( const SEQUENCE_IMPL *self ); 
-
-    rc_t ( *getTI ) ( const SEQUENCE_IMPL *self, uint64_t *ti );
-    
-    /* end minor version == 0 */
-
-} Sequence_vt_v1;
-
-typedef union Sequence_vt {
-    Sequence_vt_v1* v1;
-} Sequence_vt;
-
-struct Sequence
-{
-    Sequence_vt vt;
-};
-
-/*--------------------------------------------------------------------------
- Alignment
- */
-#ifndef ALIGNMENT_IMPL
-    #define ALIGNMENT_IMPL struct Alignment
-#endif
-
-typedef struct Alignment_vt_v1_struct {
-    /* version == 1.x */
-    uint32_t maj;
-    uint32_t min;
-
-    /* start minor version == 0 */
-    
-    rc_t ( *addRef  ) ( const ALIGNMENT_IMPL* self );
-    rc_t ( *release ) ( const ALIGNMENT_IMPL* self );
-    
-    rc_t ( *getRefSeqId         )   ( const ALIGNMENT_IMPL *self, int32_t *refSeqId );
-    rc_t ( *getMateRefSeqId     )   ( const ALIGNMENT_IMPL *self, int32_t *refSeqId );
-    rc_t ( *getPosition         )   ( const ALIGNMENT_IMPL *self, int64_t *pos );
-    rc_t ( *getMatePosition     )   ( const ALIGNMENT_IMPL *self, int64_t *pos );
-    rc_t ( *getMapQuality       )   ( const ALIGNMENT_IMPL *self, uint8_t *qual );
-    rc_t ( *getAlignmentDetail  )   ( const ALIGNMENT_IMPL *self, AlignmentDetail *rslt, uint32_t count, uint32_t *actual, int32_t *firstMatch, int32_t *lastMatch );
-    rc_t ( *getAlignOpCount     )   ( const ALIGNMENT_IMPL *self, uint32_t *n );
-    rc_t ( *getInsertSize       )   ( const ALIGNMENT_IMPL *self, int64_t *size );
-    rc_t ( *getCG               )   ( const ALIGNMENT_IMPL *self, const CGData** result );
-    rc_t ( *getBAMCigar         )   ( const ALIGNMENT_IMPL *self, uint32_t const **rslt, uint32_t *length );
-    
-    bool ( *isSecondary ) ( const ALIGNMENT_IMPL *self ); 
-    
-    /* end minor version == 0 */
-
-} Alignment_vt_v1;
-
-typedef union Alignment_vt {
-    Alignment_vt_v1* v1;
-} Alignment_vt;
-
-struct Alignment
-{
-    Alignment_vt vt;
-};
-
-/*--------------------------------------------------------------------------
- CGData
- */
-#ifndef CGDATA_IMPL
-    #define CGDATA_IMPL struct CGData
-#endif
-
-typedef struct CGData_vt_v1_struct {
-    /* version == 1.x */
-    uint32_t maj;
-    uint32_t min;
-
-    /* start minor version == 0 */
-    
-    rc_t ( *addRef  ) ( const CGDATA_IMPL* self );
-    rc_t ( *release ) ( const CGDATA_IMPL* self );
-
-    rc_t ( * getSeqQual )       ( const CGDATA_IMPL* self, char sequence[/* 35 */], uint8_t quality[/* 35 */] );
-    rc_t ( * getCigar )         ( const CGDATA_IMPL* self, uint32_t *cigar, uint32_t cig_max, uint32_t *cig_act );
-    rc_t ( * getAlignGroup )    ( const CGDATA_IMPL* self, char buffer[], size_t max_size, size_t *act_size);
-    /* end minor version == 0 */
-
-} CGData_vt_v1;
-
-typedef union CGData_vt {
-    CGData_vt_v1* v1;
-} CGData_vt;
-
-struct CGData
-{
-    CGData_vt vt;
-};
-
-/*--------------------------------------------------------------------------
- Rejected
- */
-
-struct Rejected {
-    KRefcount   refcount;
-
-    String      source;
-    const char* message;
-    uint64_t    line;
-    uint64_t    column;
-    bool        fatal;
-};
-
-rc_t CC RejectedInit ( Rejected *self );
-
-/*--------------------------------------------------------------------------
- ReferenceInfo
- */
-
-#ifndef REFERENCEINFO_IMPL
-    #define REFERENCEINFO_IMPL struct ReferenceInfo
-#endif
-
-typedef struct ReferenceInfo_vt_v1_struct {
-    /* version == 1.x */
-    uint32_t maj;
-    uint32_t min;
-
-    /* start minor version == 0 */
-    
-    rc_t ( *addRef  ) ( const REFERENCEINFO_IMPL* self );
-    rc_t ( *release ) ( const REFERENCEINFO_IMPL* self );
-
-    rc_t ( *getRefSeqCount )        ( const REFERENCEINFO_IMPL* self, uint32_t* count );
-    rc_t ( *getRefSeq )             ( const REFERENCEINFO_IMPL* self, uint32_t n, ReferenceSequence* result );
-    rc_t ( *getReadGroupCount )     ( const REFERENCEINFO_IMPL* self, uint32_t* count );
-    rc_t ( *getReadGroup )          ( const REFERENCEINFO_IMPL* self, unsigned n, ReadGroup* result );
-    rc_t ( *getReadGroupByName )    ( const REFERENCEINFO_IMPL* self, const char* name, ReadGroup* result );
-
-    /* end minor version == 0 */
-
-} ReferenceInfo_vt_v1;
-
-typedef union ReferenceInfo_vt {
-    ReferenceInfo_vt_v1* v1;
-} ReferenceInfo_vt;
-
-struct ReferenceInfo
-{
-    ReferenceInfo_vt vt;
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_common_reader_priv_ */
diff --git a/interfaces/loader/common-reader.h b/interfaces/loader/common-reader.h
deleted file mode 100644
index b6cd796..0000000
--- a/interfaces/loader/common-reader.h
+++ /dev/null
@@ -1,486 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#ifndef _h_common_reader_
-#define _h_common_reader_
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-typedef struct ReaderFile           ReaderFile;
-typedef struct Record               Record;
-typedef struct Sequence             Sequence;
-typedef struct Alignment            Alignment;
-typedef struct CGData               CGData;  
-typedef struct Rejected             Rejected;
-typedef struct ReferenceInfo        ReferenceInfo;
-
-/*--------------------------------------------------------------------------
- ReaderFile
- */
-rc_t CC ReaderFileAddRef ( const ReaderFile *self );
-rc_t CC ReaderFileRelease ( const ReaderFile *self );
-
-/* GetRecord
- * Parses the next record from the source. At the end of the file, rc == 0, *result == 0.
- */
-rc_t CC ReaderFileGetRecord( const ReaderFile *self, const Record** result);
-
-/* GetPathname
- * Returns input's pathname, if applicable.
- */
-const char* CC ReaderFileGetPathname ( const ReaderFile *self );
-
-/* GetProportionalPosition
- *  get the aproximate proportional position in the input file
- *  this is intended to be useful for computing progress
- *
- * NB - does not return rc_t
- */
-float CC ReaderFileGetProportionalPosition ( const ReaderFile *self );
-
-/* GetReferenceInfo
- *
- */
-rc_t CC ReaderFileGetReferenceInfo ( const ReaderFile *self, const ReferenceInfo** result );
-
-/*--------------------------------------------------------------------------
- Record
- */
-
-/* AddRef
- * Release
- */
-rc_t CC RecordAddRef ( const Record *self );
-rc_t CC RecordRelease ( const Record *self );
-
-rc_t CC RecordGetRejected ( const Record *self, const Rejected** result);
-rc_t CC RecordGetSequence ( const Record *self, const Sequence** result);
-rc_t CC RecordGetAlignment( const Record *self, const Alignment** result);
-
-/*--------------------------------------------------------------------------
- Sequence
- */
-
-/* AddRef
- * Release
- */
-rc_t CC SequenceAddRef ( const Sequence *self );
-rc_t CC SequenceRelease ( const Sequence *self );
-
-/* GetReadLength
- *  get the sequence length
- *  i.e. the number of elements of both sequence and quality
- *
- *  "length" [ OUT ] - length in bases of query sequence and quality
- */
-rc_t CC SequenceGetReadLength ( const Sequence *self, uint32_t *length );
-
-/* GetRead
- *  get the sequence data [0..ReadLength)
- *  caller provides buffer of ReadLength bytes
- *
- *  "sequence" [ OUT ] - pointer to a buffer of at least ReadLength bytes
- */
-rc_t CC SequenceGetRead( const Sequence *self, char *sequence );
-
-/* GetRead2
- *  get the sequence data [0..ReadLength)
- *  caller provides buffer of ReadLength bytes
- *
- *  "sequence" [ OUT ] - pointer to a buffer of at least ReadLength bytes
- *
- *  "start" [ IN ] and "stop" [ IN ] - zero-based coordinates, half-closed interval; both have to be within ReadLength
- */
-rc_t CC SequenceGetRead2 ( const Sequence *self, char *sequence, uint32_t start, uint32_t stop);
-
-enum QualityType {
-    QT_Unknown = 0,
-    QT_Phred,
-    QT_LogOdds
-};
-/* GetQuality
- *  get the raw quality data [0..ReadLength) from OQ if possible else from QUAL
- *  values are unsigned with 0xFF == missing
- *
- *  "quality" [ OUT ] - return param for quality sequence
- *   held internally, validity is guaranteed for the life of the sequence
- *  
- *  "offset" [ OUT ] - the zero point of quality (33, 64; 0 for binary)
- *  
- *  "qualType" [ OUT ] - quality type (phred, log-odds, unknown)
- */
-rc_t CC SequenceGetQuality(const Sequence *self, const int8_t **quality, uint8_t *offset, int *qualType);
-
-/* SequenceGetSpotGroup
- *  get the name of the spot group (e.g. accession)
- *
- *  "name" [ OUT ] - return param for group name
- *   held internally, validity is guaranteed for the life of the sequence
- *
- *  "length" [ OUT ] - return the number of bytes in "name"
- */
-rc_t CC SequenceGetSpotGroup ( const Sequence *self, const char **name, size_t *length );
-
-
-/* SequenceGetSpotName
- *  get the read name and length in bytes
- *
- *  "name" [ OUT ] - return param for read group name
- *   held internally, validity is guaranteed for the life of the sequence
- *
- *  "length" [ OUT ] - return the number of bytes in "name"
- */
-rc_t CC SequenceGetSpotName ( const Sequence *self, const char **name, size_t *length );
-
-/* IsColorSpace
- *  Does the sequence have colorspace info
- */
-bool CC SequenceIsColorSpace ( const Sequence *self );
-
-/* GetCSKey
- *  get the colorspace key
- *
- *  "cskey" [ OUT ] - return param 
- *
- *  return: if no colorspace info, RC is 0 but the value of cskey is undefined
- */
-rc_t CC SequenceGetCSKey ( const Sequence *self, char cskey[1] );
-
-/* GetCSReadLength
- *  get the color space sequence length
- *  i.e. the number of elements of both sequence and quality
- *
- *  "length" [ OUT ] - length in bases of query sequence and quality
- */
-rc_t CC SequenceGetCSReadLength ( const Sequence *self, uint32_t *length );
-
-/* GetCSRead
- *  get the color space sequence data [0..ReadLength)
- *  caller provides buffer of ReadLength bytes
- *
- *  "sequence" [ OUT ] - pointer to a buffer of at least ReadLength bytes
- */
-rc_t CC SequenceGetCSRead( const Sequence *self, char *sequence );
-
-/* GetCSQuality
- *  get the color spaqce sequence's raw quality data [0..ReadLength) from OQ if possible else from QUAL
- *  values are unsigned with 0xFF == missing
- *
- *  "quality" [ OUT ] - return param for quality sequence
- *   held internally, validity is guaranteed for the life of the sequence
- *  
- *  "offset" [ OUT ] - the zero point of quality (33, 64; 0 for binary)
- *  
- *  "qualType" [ OUT ] - quality type (phred, log-odds, unknown)
- */
-rc_t CC SequenceGetCSQuality(const Sequence *self, const int8_t **quality, uint8_t *offset, int *qualType);
-
-
-/* WasPaired
- * true if read number is present and not 0 
- */ 
-bool CC SequenceWasPaired     ( const Sequence *self ); 
-
-enum ReadOrientation {
-    ReadOrientationUnknown,
-    ReadOrientationForward,
-    ReadOrientationReverse
-};
-/* SequenceGetOrientationSelf
- */ 
-int CC SequenceGetOrientationSelf( const Sequence *self ); 
-/* SequenceGetOrientationMate
- */ 
-int CC SequenceGetOrientationMate( const Sequence *self ); 
-
-/* IsFirst
- * fastq: read number is present and equal to 1
- */ 
-bool CC SequenceIsFirst       ( const Sequence *self ); 
-/* IsSecond
- * fastq: read number is present and equal to 2
- */
-bool CC SequenceIsSecond      ( const Sequence *self ); 
-/* IsDuplicate
- * 
- */
-bool CC SequenceIsDuplicate( const Sequence *self ); 
-/* IsLowQuality
- * 
- */
-bool CC SequenceIsLowQuality( const Sequence *self ); 
-
-/*  RecordGetTI
- *
- */
-rc_t SequenceGetTI(Sequence const *self, uint64_t *ti);
-
-/*--------------------------------------------------------------------------
- Alignment
- */
-
-/* AddRef
- * Release
- */
-rc_t CC AlignmentAddRef ( const Alignment *self );
-rc_t CC AlignmentRelease ( const Alignment *self );
-
-/* GetRefSeqId
- *  get id of reference sequence
- *  pass result into BAMFileGetRefSeqById to get the Reference Sequence record
- *
- *  "refSeqId" [ OUT ] - zero-based id of reference sequence
- *   returns -1 if set is invalid within BAM ( rc may be zero )
- */
-rc_t CC AlignmentGetRefSeqId ( const Alignment *self, int32_t *refSeqId );
-
-/* GetMateRefSeqId
- *  get id of mate's reference sequence
- *  pass result into BAMFileGetRefSeqById to get the Reference Sequence record
- *
- *  "refSeqId" [ OUT ] - zero-based id of reference sequence
- *   returns -1 if invalid
- */
-rc_t CC AlignmentGetMateRefSeqId ( const Alignment *self, int32_t *refSeqId );
-
-/* GetPosition
- *  get the aligned position on the ref. seq.
- *
- *  "n" [ IN ] - zero-based position index for cases of multiple alignments
- *
- *  "pos" [ OUT ] - zero-based position on reference sequence
- *  returns -1 if invalid
- */
-rc_t CC AlignmentGetPosition ( const Alignment *self, int64_t *pos );
-
-/* GetMatePosition
- *  starting coordinate of mate's alignment on ref. seq.
- *
- *  "pos" [ OUT ] - zero-based position on reference sequence
- *  returns -1 if invalid
- */
-rc_t CC AlignmentGetMatePosition ( const Alignment *self, int64_t *pos );
-
-/* GetMapQuality
- *  return the quality score of mapping
- *
- *  "qual" [ OUT ] - return param for quality score
- */
-rc_t CC AlignmentGetMapQuality ( const Alignment *self, uint8_t *qual );
-
-/* GetAlignmentDetail
- *  get the alignment details
- *
- *  "rslt" [ OUT, NULL OKAY ] and "count" [ IN ] - array to hold detail records
- *
- *  "actual" [ OUT, NULL OKAY ] - number of elements written to "rslt"
- *   required if "rslt" is NULL
- *
- *  "firstMatch" [ OUT, NULL OKAY ] - zero-based index into "rslt" of the first match to the refSeq
- *   or < 0 if invalid
- *
- *  "lastMatch" [ OUT, NULL OKAY ] - zero-based index into "rslt" of the last match to the refSeq
- *   or < 0 if invalid
- */
-typedef uint32_t AlignOpType;
-enum AlignOpTypes
-{
-    align_Match    = 'M', /* 0 */
-    align_Insert   = 'I', /* 1 */
-    align_Delete   = 'D', /* 2 */
-    align_Skip     = 'N', /* 3 */
-    align_SoftClip = 'S', /* 4 */
-    align_HardClip = 'H', /* 5 */
-    align_Padded   = 'P', /* 6 */
-    align_Equal    = '=', /* 7 */
-    align_NotEqual = 'X', /* 8 */
-    align_Overlap  = 'B' /* Complete Genomics extension */
-};
-
-typedef struct AlignmentDetail AlignmentDetail;
-struct AlignmentDetail
-{
-    int64_t refSeq_pos; /* position on refSeq where this alignment region starts or -1 if NA */
-    int32_t read_pos;   /* position on read where this alignment region starts or -1 if NA */
-    uint32_t length;    /* length of alignment region */
-    AlignOpType type;  /* type of alignment */
-};
-
-rc_t CC AlignmentGetAlignmentDetail ( const Alignment *self,
-                                      AlignmentDetail *rslt, 
-                                      uint32_t count, 
-                                      uint32_t *actual,
-                                      int32_t *firstMatch, 
-                                      int32_t *lastMatch );
-
-
-/* GetCigarCount
- *  the number of CIGAR elements
- *  a CIGAR element consists of the pair of matching op code and op length
- *
- *  "n" [ OUT ] - return param for cigar count
- */
-rc_t CC AlignmentGetAlignOpCount ( const Alignment *self, uint32_t *n );
-
-
-/* GetInsertSize
- *  distance in bases to start of mate's alignment on ref. seq.
- *
- *  "size" [ OUT ] - >0 for first in pair, <0 for second
- */
-rc_t CC AlignmentGetInsertSize ( const Alignment *self, int64_t *size );
-
-/* GetBAMCigar
- *
- */
-rc_t CC AlignmentGetBAMCigar(const Alignment *cself, uint32_t const **rslt, uint32_t *length);
-
-/* IsSecondary
- * 
- */
-bool CC AlignmentIsSecondary( const Alignment *self ); 
-
-
-/* AlignmentGetCG
- * rc_t == 0, result == 0 if no CG data 
- */
-rc_t CC AlignmentGetCGData ( const Alignment *self, const CGData** result);
-
-/*--------------------------------------------------------------------------
- * CGData
- */
-rc_t CC CGDataAddRef ( const CGData *self );
-rc_t CC CGDataRelease ( const CGData *self );
-
-/* CGGetSeqQual
- */
-rc_t CC CGDataGetSeqQual ( const CGData* self,
-                           char sequence[/* 35 */],
-                           uint8_t quality[/* 35 */] );
-
-/* CGGetCigar
- */
-rc_t CC CGDataGetCigar ( const CGData* self,
-                         uint32_t *cigar,
-                         uint32_t cig_max,
-                         uint32_t *cig_act );
-
-/* CGGetAlignGroup
- */
-rc_t CC CGDataGetAlignGroup ( const CGData* self,
-                              char buffer[],
-                              size_t max_size,
-                              size_t *act_size );
-
-/*--------------------------------------------------------------------------
- * Rejected
- */
-
-/* AddRef
- * Release
- */
-rc_t CC RejectedAddRef ( const Rejected *self );
-rc_t CC RejectedRelease ( const Rejected *self );
-
-/* GetError
- *  "text" [ OUT ] - NUL-terminated error message, held internally
- *  "line" [ OUT ] - 1-based line # in the source (0 for binary formats)
- *  "column" [ OUT ] - 1-based column # in the source (offset from the start of the file for binary formats)
- *  "fatal" [ OUT ] - no further parsing should be done (likely an unsupported format)
- */
-rc_t CC RejectedGetError( const Rejected* self, const char** text, uint64_t* line, uint64_t* column, bool* fatal );
-
-/* GetData
- *  "data" [ OUT ] - raw input representing the rejected record. held internally
- *  "length" [ OUT ] - size of the data buffer
- */
-rc_t CC RejectedGetData( const Rejected* self, const void** text, size_t* length );
-
-/*--------------------------------------------------------------------------
- * ReferenceInfo
- */
-typedef struct ReferenceSequence 
-{
-    uint64_t length;
-    const char *name; /* not null unique */
-    const uint8_t *checksum;
-} ReferenceSequence;
-
-typedef struct ReadGroup
-{
-    const char *name; /* not null unique, accession e.g. SRR001138 */
-    const char *platform; /* e.g. ILLUMINA */
-} ReadGroup;
-
-rc_t CC ReferenceInfoAddRef ( const ReferenceInfo *self );
-rc_t CC ReferenceInfoRelease ( const ReferenceInfo *self );
-
-/* GetRefSeqCount
- *  get the number of Reference Sequences refered to in the header
- *  this is not necessarily the number of Reference Sequences referenced
- *  by the alignments
- */
-rc_t CC ReferenceInfoGetRefSeqCount ( const ReferenceInfo *self, uint32_t* count );
-
-/* GetRefSeq
- *  get the n'th Ref. Seq. where n is [0..RefSeqCount)
- *  the result is populated with pointers that are good for precisely at long as the ReferenceInfo exists.
- */
-rc_t CC ReferenceInfoGetRefSeq ( const ReferenceInfo *self, uint32_t n, ReferenceSequence *result );
-
-/* GetReadGroupCount
- *  get the number of Read Groups (accessions, etc.) refered to in the header
- *  this is not necessarily the number of Read Groups referenced
- *  by the alignments
- */
-rc_t CC ReferenceInfoGetReadGroupCount ( const ReferenceInfo *self, uint32_t *count );
-
-/* GetReadGroup
- *  get the n'th Read Group where n is [0..ReadGroupCount)
- *  the result is populated with pointers that are good for precisely at long as the ReferenceInfo exists.
- */
-rc_t CC ReferenceInfoGetReadGroup ( const ReferenceInfo *self, unsigned n, ReadGroup *result );
-
-/* GetReadGroupByName
- *  get a Read Group by its name
- *  the result is populated with pointers that are good for precisely at long as the ReferenceInfo exists.
- */
-rc_t CC ReferenceInfoGetReadGroupByName ( const ReferenceInfo *self, const char *name, ReadGroup *result );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_common_reader_ */
diff --git a/interfaces/loader/common-writer.h b/interfaces/loader/common-writer.h
deleted file mode 100644
index cf94231..0000000
--- a/interfaces/loader/common-writer.h
+++ /dev/null
@@ -1,192 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#ifndef _h_common_writer_
-#define _h_common_writer_
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifndef _h_insdc_sra_
-#include <insdc/sra.h>
-#endif
-
-#ifndef _h_mmarray_
-#include <loader/mmarray.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-
-struct VDBManager;
-struct VDatabase;
-struct KMemBank;
-struct KBTree;
-struct KLoadProgressbar;
-struct ReaderFile;
-struct CommonWriter;
-struct SequenceWriter;
-struct AlignmentWriter;
-struct Reference;
-
-/*--------------------------------------------------------------------------
- * CommonWriterSettings
- */
-enum LoaderModes {
-    mode_Archive,
-    mode_Analysis
-};
-
-typedef struct CommonWriterSettings
-{
-    uint64_t numfiles;
-    char const *inpath;
-    char const *outpath;
-    char const *tmpfs;
-    
-    struct KFile *noMatchLog;
-    
-    char const *schemaPath;
-    char const *schemaIncludePath;
-    
-    char const *refXRefPath;
-    
-    char const *QualQuantizer;
-    
-    char const *refFilter;
-
-    char const** refFiles; /* NULL-terminated array pointing to argv */
-    
-    char const *headerText;
-    
-    uint64_t maxAlignCount;
-    size_t cache_size;
-
-    uint64_t errCount;
-    uint64_t maxErrCount;
-    uint64_t maxErrPct;
-    uint64_t maxWarnCount_NoMatch;
-    uint64_t maxWarnCount_DupConflict;
-    uint64_t pid;
-    uint64_t minMatchCount; /* minimum number of matches to count as an alignment */
-    int minMapQual;
-    enum LoaderModes mode;
-    uint32_t maxSeqLen;
-    bool omit_aligned_reads;
-    bool omit_reference_reads;
-    bool no_real_output;
-    bool expectUnsorted;
-    bool noVerifyReferences;
-    bool onlyVerifyReferences;
-    bool useQUAL;
-    bool limit2config;
-    bool editAlignedQual;
-    bool keepMismatchQual;
-    bool acceptBadDups; /* accept spots with inconsistent PCR duplicate flags */
-    bool acceptNoMatch; /* accept without any matching bases */
-    uint8_t alignedQualValue;
-    bool allUnaligned; /* treat all records as unaligned */
-    bool noColorSpace;
-    bool noSecondary;
-    bool hasTI;
-    bool acceptHardClip;
-    INSDC_SRA_platform_id platform;
-    bool parseSpotName;
-    bool compressQuality;
-    uint64_t maxMateDistance;
-} CommonWriterSettings;
-
-/*--------------------------------------------------------------------------
- * SpotAssembler
- */
-
-#define FRAG_CHUNK_SIZE (128)
-
-typedef struct SpotAssembler {
-    const struct KLoadProgressbar *progress[4];
-    struct KBTree *key2id[NUM_ID_SPACES];
-    char *key2id_names;
-    struct MMArray *id2value;
-    struct KMemBank *fragsBoth; /*** mate will be there soon ***/
-    struct KMemBank *fragsOne;  /*** mate may not be found soon or even show up ***/
-    int64_t spotId;
-    int64_t primaryId;
-    int64_t secondId;
-    uint64_t alignCount;
-    
-    uint32_t idCount[NUM_ID_SPACES];
-    uint32_t key2id_hash[NUM_ID_SPACES];
-    
-    size_t key2id_max;
-    size_t key2id_name_max;
-    size_t key2id_name_alloc;
-    size_t key2id_count;
-    
-    size_t key2id_name[NUM_ID_SPACES];
-    /* this array is kept in name order */
-    /* this maps the names to key2id and idCount */
-    size_t key2id_oid[NUM_ID_SPACES];
-    
-    unsigned pass;
-    bool isColorSpace;
-    
-} SpotAssembler;
-
-INSDC_SRA_platform_id PlatformToId(const char* name);
-
-/*--------------------------------------------------------------------------
- * CommonWriter
- */
-typedef struct CommonWriter {
-    CommonWriterSettings settings;
-    SpotAssembler ctx;
-    struct Reference* ref;
-    struct SequenceWriter* seq;
-    struct AlignmentWriter* align;
-    bool had_alignments;
-    bool had_sequences;
-    unsigned err_count;
-    bool commit;
-} CommonWriter;
-
-rc_t CommonWriterInit(CommonWriter* self, struct VDBManager *mgr, struct VDatabase *db, const CommonWriterSettings* settings);
-
-rc_t CommonWriterArchive(CommonWriter* self, const struct ReaderFile *);
-rc_t CommonWriterComplete(CommonWriter* self, bool quitting, uint64_t maxDistance);
-
-rc_t CommonWriterWhack(CommonWriter* self);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_common_writer_ */
diff --git a/interfaces/loader/mmarray.h b/interfaces/loader/mmarray.h
deleted file mode 100644
index 7786b81..0000000
--- a/interfaces/loader/mmarray.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#ifndef _h_mmarray_
-#define _h_mmarray_
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-
-struct KFile;
-
-#define NUM_ID_SPACES (256u)
-
-struct MMArray;
-
-rc_t MMArrayMake(struct MMArray **rslt, struct KFile *fp, uint32_t elemSize);
-
-rc_t MMArrayGet(struct MMArray *const self, void **const value, uint64_t const element);
-
-void MMArrayWhack(struct MMArray *self);
-
-#endif
diff --git a/interfaces/loader/reference-writer.h b/interfaces/loader/reference-writer.h
deleted file mode 100644
index a928149..0000000
--- a/interfaces/loader/reference-writer.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#ifndef LOADER_REFERENCE_WRITER_H_
-#define LOADER_REFERENCE_WRITER_H_ 1
-
-#include <vdb/manager.h>
-#include <vdb/database.h>
-#include <vdb/table.h>
-#include <klib/data-buffer.h>
-
-#include <align/writer-reference.h>
-#include "alignment-writer.h"
-
-typedef struct Reference {
-    const ReferenceMgr *mgr;
-    const ReferenceSeq *rseq;
-    int64_t lastRefId;
-    int32_t lastOffset;
-    unsigned curPos;
-    unsigned endPos;
-    unsigned length;
-    KDataBuffer coverage;
-    KDataBuffer mismatches;
-    KDataBuffer indels;
-    KDataBuffer pri_align;
-    KDataBuffer sec_align;
-    KDataBuffer pri_overlap;
-    KDataBuffer sec_overlap;
-    bool out_of_order;
-    bool acceptHardClip;
-    char last_id[256];
-} Reference;
-
-rc_t ReferenceInit(Reference *self, const VDBManager *mgr, VDatabase *db, 
-                   bool expectUnsorted,
-                   bool acceptHardClip,
-                   char const *refXRefPath,
-                   char const *inpath,
-                   uint32_t maxSeqLen,  /*TODO: save in Reference object, reuse in other functions*/
-                   char const** refFiles
-                   );
-rc_t ReferenceSetFile(Reference *self, const char *id, uint64_t length, uint8_t const md5[16], uint32_t maxSeqLen);
-rc_t ReferenceVerify(Reference const *self, char const id[], uint64_t length, uint8_t const md5[16]);
-rc_t ReferenceGet1stRow(Reference const *self, int64_t *refID, char const refName[]);
-rc_t ReferenceAddAlignId(Reference *self,
-                         int64_t align_id,
-                         bool is_primary
-                         );
-rc_t ReferenceRead(Reference *self, AlignmentRecord *data, uint64_t const pos,
-                   uint32_t const rawCigar[], uint32_t const cigCount,
-                   char const seqDNA[], uint32_t const seqLen, uint32_t *matches, bool acceptNoMatch, unsigned minMatchCount, uint32_t maxSeqLen);
-rc_t ReferenceWhack(Reference *self, bool commit, uint32_t maxSeqLen, rc_t (*const quitting)(void));
-
-#endif
diff --git a/interfaces/loader/sequence-writer.h b/interfaces/loader/sequence-writer.h
deleted file mode 100644
index c7565cb..0000000
--- a/interfaces/loader/sequence-writer.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#ifndef BAM_LOAD_SEQUENCE_WRITER_H_
-#define BAM_LOAD_SEQUENCE_WRITER_H_ 1
-
-#include <insdc/sra.h>
-
-#include <vdb/manager.h>
-#include <vdb/database.h>
-#include <vdb/table.h>
-#include <vdb/cursor.h>
-
-#include <klib/text.h>
-#include <klib/data-buffer.h>
-
-struct TableWriterSeq;
-
-typedef struct s_sequence_record {
-    char *seq;
-    uint8_t *qual;
-    uint32_t *readStart;
-    uint32_t *readLen;
-    uint8_t *orientation;
-    uint8_t *is_bad;
-    uint8_t *alignmentCount;
-    char *spotGroup;
-    bool *aligned;
-    char *cskey;
-    uint64_t *ti;
-    uint64_t keyId;
-    unsigned spotGroupLen;
-    KDataBuffer storage;
-    uint8_t numreads;
-} SequenceRecord;
-
-
-rc_t SequenceRecordInit(SequenceRecord *self,
-                        unsigned numreads, unsigned readLen[]);
-
-rc_t SequenceRecordAppend(SequenceRecord *self,
-                          const SequenceRecord *other);
-
-typedef struct SequenceWriter {
-    VDatabase *db;
-    struct TableWriterSeq const *tbl;
-} SequenceWriter;
-
-SequenceWriter *SequenceWriterInit(SequenceWriter *self, VDatabase *db);
-
-rc_t SequenceWriteRecord(SequenceWriter *self, SequenceRecord const *rec,
-                         bool color, bool isDup, INSDC_SRA_platform_id platform,
-                         bool keepMismatchQual,
-                         bool no_real_output,
-                         bool hasTI,
-                         char const *QualQuantizer
-                         );
-
-rc_t SequenceDoneWriting(SequenceWriter *self);
-rc_t SequenceReadKey(const SequenceWriter *self, int64_t row, uint64_t *key);
-rc_t SequenceUpdateAlignData(SequenceWriter *self, int64_t row, unsigned nreads,
-                             const int64_t primeId[/* nreads */],
-                             const uint8_t alignCount[/* nreads */]);
-
-void SequenceWhack(SequenceWriter *self, bool commit);
-
-
-#endif /* ndef BAM_LOAD_SEQUENCE_WRITER_H_ */
diff --git a/interfaces/ncbi/clip.vschema b/interfaces/ncbi/clip.vschema
deleted file mode 100644
index d95efd3..0000000
--- a/interfaces/ncbi/clip.vschema
+++ /dev/null
@@ -1,143 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/*==========================================================================
- * NCBI Sequence Read Archive schema
- */
-version 1;
-
-include 'ncbi/sra.vschema';
-include 'ncbi/spotname.vschema';
-
-
-/*--------------------------------------------------------------------------
- * NCBI:SRA:tbl:clip
- *  common clip column processing
- *  shared by 454 and ion-torrent
- *
- *  uses spotdesc because it has a dependency upon spot_len
- *
- * history:
- *  1.0.1 - base explicitly upon spotdesc #1.0.1
- *  1.0.2 - base explicitly upon spotdesc #1.0.2
- */
-table NCBI:SRA:tbl:clip #1.0.2 = INSDC:SRA:tbl:spotdesc #1.0.2
-{
-    /* CLIP_ADAPTER_LEFT, CLIP_ADAPTER_RIGHT
-     *  adapter clips in 1-based coordinates
-     *  when value is 0, implies that they are NOT SET
-     */
-    column INSDC:coord:one CLIP_ADAPTER_LEFT = out_clip_adapt_left;
-    column INSDC:coord:one CLIP_ADAPTER_RIGHT = out_clip_adapt_right;
-
-    // casts are required to allow multple storage formats
-    INSDC:coord:one out_clip_adapt_left = cast ( .CLIP_ADAPTER_LEFT );
-    INSDC:coord:one out_clip_adapt_right = cast ( .CLIP_ADAPTER_RIGHT );
-
-
-    /* CLIP_QUALITY_LEFT, CLIP_QUALITY_RIGHT
-     *  quality clips in 1-based coordinates
-     *  when value is 0, implies that they are NOT SET
-     */
-    column INSDC:coord:one CLIP_QUALITY_LEFT = out_clip_qual_left;
-    column INSDC:coord:one CLIP_QUALITY_RIGHT = out_clip_qual_right;
-
-    // casts are required to allow multple storage formats
-    INSDC:coord:one out_clip_qual_left
-        = cast ( .CLIP_QUALITY_LEFT )
-        | < INSDC:coord:one > echo < 1 > ();
-    INSDC:coord:one out_clip_qual_right
-        = cast ( .CLIP_QUALITY_RIGHT )
-        | cast ( spot_len );
-
-    // support for reading 16-bit clips, as in v1 schema
-    readonly column U16 CLIP_ADAPTER_LEFT
-        = .CLIP_ADAPTER_LEFT
-        | cast ( out_clip_adapt_left );
-    readonly column U16 CLIP_ADAPTER_RIGHT
-        = .CLIP_ADAPTER_RIGHT
-        | cast ( out_clip_adapt_right );
-    readonly column U16 CLIP_QUALITY_LEFT = cast ( out_clip_qual_left );
-    readonly column U16 CLIP_QUALITY_RIGHT = cast ( out_clip_qual_right );
-
-
-    /* CLIP-MANIA
-     */
-
-    // 1-based fully-closed right edge is row-length
-    INSDC:coord:one spot_right = ( INSDC:coord:one ) spot_len;
-
-    // processed 1-based coordinates >= 1
-    INSDC:coord:one lim_clip_adapt_left
-        = < INSDC:coord:one > clip < 1, 0x7FFFFFFF > ( out_clip_adapt_left );
-    INSDC:coord:one max_clip_adapt_right
-        = < INSDC:coord:one, INSDC:coord:one > map < 0, 0x7FFFFFFF > ( out_clip_adapt_right );
-    INSDC:coord:one lim_clip_adapt_right
-        = < INSDC:coord:one > min ( spot_right, max_clip_adapt_right );
-    INSDC:coord:one lim_clip_qual_left
-        = < INSDC:coord:one > clip < 1, 0x7FFFFFFF > ( out_clip_qual_left );
-    INSDC:coord:one max_clip_qual_right
-        = < INSDC:coord:one, INSDC:coord:one > map < 0, 0x7FFFFFFF > ( out_clip_qual_right );
-    INSDC:coord:one lim_clip_qual_right
-        = < INSDC:coord:one > min ( spot_right, max_clip_qual_right );
-
-    // read-only columns with 0-based coordinates
-    readonly column INSDC:coord:zero CLIP_ADAPTER_LEFT
-        = ( INSDC:coord:zero ) < I32 > diff < 1 > ( lim_clip_adapt_left );
-    readonly column INSDC:coord:zero CLIP_ADAPTER_RIGHT
-        = ( INSDC:coord:zero ) < I32 > diff < 1 > ( lim_clip_adapt_right );
-    readonly column INSDC:coord:zero CLIP_QUALITY_LEFT
-        = ( INSDC:coord:zero ) < I32 > diff < 1 > ( lim_clip_qual_left );
-    readonly column INSDC:coord:zero CLIP_QUALITY_RIGHT
-        = ( INSDC:coord:zero ) < I32 > diff < 1 > ( lim_clip_qual_right );
-
-    // combined clips
-    INSDC:coord:one max_clip_left
-        = < INSDC:coord:one > max ( lim_clip_adapt_left, lim_clip_qual_left )
-        | lim_clip_adapt_left
-        | lim_clip_qual_left;
-    INSDC:coord:zero max_zclip_left
-        = ( INSDC:coord:zero ) < I32 > diff < 1 > ( max_clip_left );
-    INSDC:coord:one min_clip_right
-        = < INSDC:coord:one > min ( lim_clip_adapt_right, lim_clip_qual_right )
-        | lim_clip_adapt_right
-        | lim_clip_qual_right;
-
-
-    /* TRIMMED SEQUENCE
-     *  need to find the 0-based trim_start and trim_len
-     */
-    INSDC:coord:zero bio_start
-        = NCBI:SRA:bio_start ( out_read_start, out_read_type );
-    INSDC:coord:zero trim_start
-        = < INSDC:coord:zero > max ( bio_start, max_zclip_left )
-        | bio_start;
-    I32 trim_stop
-        = < I32 > max ( min_clip_right, trim_start )
-        | spot_right;
-    INSDC:coord:len trim_len
-        = ( INSDC:coord:len ) < I32 > diff ( trim_stop, trim_start );
-};
diff --git a/interfaces/ncbi/extern.h b/interfaces/ncbi/extern.h
deleted file mode 100644
index 278f394..0000000
--- a/interfaces/ncbi/extern.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_ncbi_extern_
-#define _h_ncbi_extern_
-
-#if ! defined EXPORT_LATCH && defined _LIBRARY
-#define NCBI_EXTERN LIB_EXPORT
-#define EXPORT_LATCH 1
-#else
-#define NCBI_EXTERN LIB_IMPORT
-#endif
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#endif /* _h_ncbi_extern_ */
diff --git a/interfaces/ncbi/ncbi.vschema b/interfaces/ncbi/ncbi.vschema
deleted file mode 100644
index 5dd7b1c..0000000
--- a/interfaces/ncbi/ncbi.vschema
+++ /dev/null
@@ -1,195 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/*==========================================================================
- * VDB Schema intrinsic types and functions
- */
-version 1;
-
-include 'vdb/vdb.vschema';
-include 'insdc/insdc.vschema';
-
-
-/*--------------------------------------------------------------------------
- * data types
- */
-
-// N-encoded phred has values limited to 1..63 and 0 used for N
-typedef INSDC:quality:phred NCBI:quality:n_encoded:phred;
-// N-encoded log-odds has values limite to -5..40 and -6 for N
-typedef INSDC:quality:log_odds NCBI:quality:n_encoded:log_odds;
-
-// these types have been restated
-alias INSDC:dna:text INSDC:fasta;
-alias INSDC:4na:packed INSDC:dna:4na;
-alias INSDC:2na:packed INSDC:dna:2na;
-alias INSDC:2na:packed NCBI:2na;
-alias INSDC:2cs:packed INSDC:color:2cs;
-alias INSDC:2cs:packed NCBI:2cs;
-alias INSDC:quality:phred NCBI:qual1;
-alias NCBI:quality:n_encoded:phred NCBI:SRA:enc_qual1;
-
-// 16-bit integer sample data
-typedef I16 NCBI:isamp1;
-
-// 32-bit floating point sample data
-typedef F32 NCBI:fsamp1, NCBI:fsamp4 [ 4 ];
-
-// ASN.1
-typedef B8 NCBI:asn:binary; 
-typedef ascii NCBI:asn:text;
-
-// GenInfo id - 64 bit because we are almost out of 32 bit ids
-typedef U64 NCBI:gi;
-
-// Taxonomy id
-typedef U32 NCBI:taxid;
-
-// Genbank status
-typedef U32 NCBI:gb_state;
-
-
-/*--------------------------------------------------------------------------
- * formats
- *  many of these formats are older than the current corresponding vdb fmts
- */
-
-fmtdef merged_t;
-fmtdef fp_encoded_t;
-fmtdef rl_encoded_t;
-fmtdef NCBI:zlib_encoded_t;
-fmtdef NCBI:fp_encoded_t;
-
-
-/*--------------------------------------------------------------------------
- * functions
- */
-
-
-/* merge
- * split
- *  the original versions of these functions
- *  used a slightly different format giving them
- *  a different signature from their vdb counterparts.
- *
- *  here to maintain backward compatibility for
- *  column schema functions
- */
-extern function
-merged_t NCBI:merge #1.0 ( any in, ... );
-
-extern function
-any NCBI:split #1.0 < U32 idx > ( merged_t in )
-    = vdb:split;
-
-
-/* cut
- * paste
- *  these have no compiler type-checking
- */
-extern function
-any NCBI:cut #1.0 < U32 idx, ... > ( any in )
-    = vdb:cut;
-
-extern function
-any NCBI:paste #1.0 ( any in, ... )
-    = vdb:paste;
-
-
-/* pack
- * unpack
- *  wildcard typed
- */
-extern function
-any NCBI:pack #1.0 < U32 from, U32 to > ( any in );
-
-extern function
-any NCBI:unpack #1.0 < U32 from, U32 to > ( any in );
-
-
-/* fp_decode
- *  OBSOLETE
- *  here to handle anything encoded with fp_encode
- */
-extern function
-any NCBI:fp_decode #1.0 ( fp_encoded_t in );
-
-
-/* fp_extend
- *  OBSOLETE
- *  here to handle anything encoded with fp_truncate
- */
-extern function
-any NCBI:fp_extend #1.0 < U32 bits > ( NCBI:fp_encoded_t in );
-
-
-/* run_length_encode
- * run_length_decode
- */
-extern function
-rl_encoded_t NCBI:run_length_encode #1.0 ( any in )
-    = vdb:rlencode;
-
-extern function
-any NCBI:run_length_decode #1.0 ( rl_encoded_t in )
-    = vdb:rldecode;
-
-
-/* zlib
- * unzip
- *  variation on the formatting
- */
-extern function
-NCBI:zlib_encoded_t NCBI:zlib #1.0 < * I32 strategy, I32 level > ( any in )
-    = vdb:zip;
-
-extern function
-any NCBI:unzip #1.0 ( NCBI:zlib_encoded_t in );
-
-
-/* zlib_huffman_compress
- *  invokes zlib in huffman + rle mode
- */
-schema function
-NCBI:zlib_encoded_t NCBI:zlib_huffman_compress #1.0 ( any in )
-{
-    // named as Huffman, but apply RLE as well
-    return NCBI:zlib < Z_RLE > ( in );
-}
-
-/* zlib_compress
- *  standard zlib
- */
-schema function
-NCBI:zlib_encoded_t NCBI:zlib_compress #1.0 ( any in )
-{
-    return NCBI:zlib < Z_DEFAULT_STRATEGY > ( in );
-}
-
-/* zlib_decompress
- *  alternate name for unzip
- */
-alias NCBI:unzip NCBI:zlib_decompress;
diff --git a/interfaces/ncbi/seq.vschema b/interfaces/ncbi/seq.vschema
deleted file mode 100644
index bfb8f1a..0000000
--- a/interfaces/ncbi/seq.vschema
+++ /dev/null
@@ -1,889 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/*==========================================================================
- * Sequence schema implementation tables
- */
-version 1;
-
-include 'vdb/vdb.vschema';
-include 'ncbi/ncbi.vschema';
-include 'insdc/sra.vschema';
-
-
-/*--------------------------------------------------------------------------
- * n_encoding - implementation
- *  introduces common virtual productions
- */
-table NCBI:tbl:n_encoding #1
-{
-    U8 n_encoding_dummy
-        = read_unpack
-        | read_ndecode;
-};
-
-
-/*--------------------------------------------------------------------------
- * seqloc
- *  NCBI sequence locator table
- */
-table NCBI:tbl:seqloc #1.0
-{
-    /* SEQ_ID
-     *  a FASTA-style SeqId
-     */
-    extern column < ascii > zip_encoding SEQ_ID;
-
-    /* SEQ_START
-     *  provided in both 1 ( default ) and 0-based coordinates
-     */
-    extern default column < INSDC:coord:one > izip_encoding SEQ_START;
-    readonly column INSDC:coord:zero SEQ_START
-        = ( INSDC:coord:zero ) < INSDC:coord:one > diff < 1 > ( .SEQ_START );
-
-    /* SEQ_LEN
-     */
-    extern column < INSDC:coord:len > izip_encoding SEQ_LEN;
-};
-
-
-/*--------------------------------------------------------------------------
- * base_space - implementation
- *  READ column rules
- */
-
-/* color_from_dna
- *  use starting keys and color matrix to convert individual reads
- *  to base space.
- */
-extern function
-INSDC:x2cs:bin NCBI:color_from_dna #1 ( INSDC:x2na:bin bin_x2na,
-    INSDC:coord:zero read_start, INSDC:coord:len read_len,
-    INSDC:dna:text cs_key, U8 color_matrix );
-
-
-/* dcmp_base_space
- *  table to introduce common virtual productions
- */
-table NCBI:tbl:dcmp_base_space #1
-{
-    // rules to introduce purely virtual productions
-    // never expected to resolve...
-    INSDC:dna:text dcmp_virtual_productions
-        = out_dcmp_4na_bin
-        | out_dcmp_x2na_bin
-        | out_dcmp_2na_bin
-        | out_dcmp_2na_packed;
-}
-
-/* history:
- *  1.0.1 - base explicitly upon sequence #1.0.1, spotdesc #1.0.1
- *  1.0.2 - spotdesc #1.0.2
- *  1.0.3 - base upon dcmp_base_space for "out_dcmp_2na_bin"
- */
-table NCBI:tbl:base_space_common #1.0.3
-    = INSDC:tbl:sequence #1.0.1
-    , INSDC:SRA:tbl:spotdesc #1.0.2
-    , INSDC:SRA:tbl:stats #1.1.0
-    , NCBI:tbl:dcmp_base_space #1.0.0
-{
-	/* INSDC:tbl:sequence inherited virtual productions
-     */
-
-    // cs_native - tells user color space is not native
-    bool cs_native = < bool > echo < false > ();
-
-    // in_cs_key is not writable in base_space
-
-    // color-space key is completely artificial
-    INSDC:dna:text out_cs_key
-        = .CS_KEY
-        | < INSDC:dna:text > echo < 'T' > ( out_read_type )
-        | < INSDC:dna:text > echo < 'T' > ( out_read_len )
-        | < INSDC:dna:text > echo < 'T' > ();
-
-    // unambiguous synthesized 2cs
-    INSDC:2cs:bin out_2cs_bin
-        = < INSDC:x2cs:bin, INSDC:2cs:bin > map < INSDC:x2cs:map:BINSET, [ 0, 1, 2, 3, 0 ] > ( out_x2cs_bin );
-
-    // unambiguous unpacked 2na
-    INSDC:2na:bin out_2na_bin
-        = out_dcmp_2na_bin
-        | ( INSDC:2na:bin ) unpack ( out_2na_packed );
-
-    // synthesized color sequence
-    INSDC:x2cs:bin out_x2cs_bin
-        = NCBI:color_from_dna ( out_x2na_bin, out_read_start, out_read_len, out_cs_key, out_color_matrix );
-
-    // synthesized packed 2cs
-    INSDC:2cs:packed out_2cs_packed
-        = ( INSDC:2cs:packed ) pack ( out_2cs_bin );
-
-    // synthesized packed 4na
-    INSDC:4na:packed out_4na_packed
-        = ( INSDC:4na:packed ) pack ( out_4na_bin );
-
-    // synthesized color text
-    INSDC:color:text out_color_text
-        = < INSDC:x2cs:bin, INSDC:color:text > map <  INSDC:x2cs:map:BINSET, INSDC:x2cs:map:CHARSET > ( out_x2cs_bin );
-
-    // published color matrix
-    U8 out_color_matrix
-        = < U8 > echo < INSDC:color:default_matrix > ();
-
-    // spot_len and fixed_spot_len
-    INSDC:coord:len base_space_spot_len
-        = ( INSDC:coord:len ) row_len ( out_2na_packed );
-    INSDC:coord:len base_space_fixed_spot_len
-        = ( INSDC:coord:len ) fixed_row_len ( out_2na_packed );
-
-
-	/* INSDC:tbl:sequence inherited productions
-	 *  out_signal
-	 *  in_dna_text
-	 *  out_4na_bin
-	 *  out_dna_text
-	 *  out_x2na_bin
-	 *  out_2na_packed
-	 */
-
-	/* INSDC:SRA:tbl:stats inherited productions
-	 *  in_stats_bin
-	 */
-
-	/* NCBI:tbl:dcmp_base_space inherited productions
-	 *  out_dcmp_2na_bin
-	 *  out_dcmp_4na_bin
-	 *  out_dcmp_x2na_bin
-	 *  out_dcmp_2na_packed
-	 */
-};
-
-
-/* base_space_nocol
- *  this table describes viewing rules
- *  but omits writing rules and physical column description
- *  in order to support older tables
- *
- * history:
- *  1.0.1 - base explicitly upon base_space_common #1.0.1
- *  1.0.2 - base explicitly upon base_space_common #1.0.2
- *  1.0.3 - " " 1.0.3
- */
-table NCBI:tbl:base_space_nocol #1.0.3
-    = NCBI:tbl:base_space_common #1.0.3
-    , NCBI:tbl:n_encoding #1
-{
-    // incoming is disabled
-
-    // synthesized dna text
-    INSDC:dna:text out_dna_text
-        = < INSDC:x2na:bin, INSDC:dna:text > map < INSDC:x2na:map:BINSET, INSDC:x2na:map:CHARSET > ( out_x2na_bin );
-
-    // synthesized 4na
-    INSDC:4na:bin out_4na_bin
-        = < INSDC:x2na:bin, INSDC:4na:bin > map < INSDC:x2na:map:BINSET, [ 1, 2, 4, 8, 15 ] > ( out_x2na_bin );
-
-    // unpacked 2na with ambiguities
-    INSDC:x2na:bin out_x2na_bin
-        = ( INSDC:x2na:bin ) read_ndecode;
-
-    // interface with n-encoded qualities
-    U8 read_unpack = out_2na_bin;
-
-	/* INSDC:tbl:sequence inherited productions
-	 *  out_signal
-	 *  out_2na_packed
-	 */
-
-	/* NCBI:tbl:n_encoding inherited productions
-	 *  read_ndecode
-	 */
-};
-
-/* base_space #1
- *  this schema brings in standard .READ column for v1 tables
- *
- * history:
- *  1.0.1 - base explicitly upon base_space_nocol #1.0.1
- *  1.0.2 - base explicitly upon base_space_nocol #1.0.2
- *  1.0.3 - base explicitly upon base_space_nocol #1.0.3
- */
-table NCBI:tbl:base_space #1.0.3 = NCBI:tbl:base_space_nocol #1.0.3
-{
-    // 2-bit 2na representation (0..3)
-    INSDC:2na:packed out_2na_packed = .READ;
-
-    // no rules for writing to .READ
-
-	/* INSDC:tbl:sequence inherited productions
-	 *  out_signal
-	 */
-
-	/* NCBI:tbl:n_encoding inherited productions
-	 *  read_ndecode
-	 */
-};
-
-
-/* base_space #2
- *  standard current base-space table
- *
- * history:
- *  2.0.2 - base_space_common #1.0.2
- *  2.0.3 - base_space_common #1.0.3 now has dcmp_base_space as well
- */
-table NCBI:tbl:base_space #2.0.3
-    = NCBI:tbl:base_space_common #1.0.3
-    , NCBI:tbl:dcmp_base_space #1
-{
-    /* input rules
-     */
-
-    // input text
-    INSDC:dna:text in_dna_text
-        = < INSDC:dna:text, INSDC:dna:text > map < '.acmgrsvtwyhkdbn','NACMGRSVTWYHKDBN' > ( READ );
-
-    // input 4na bin
-    INSDC:4na:bin in_4na_bin
-        = < INSDC:4na:bin > range_validate < 0, 15 > ( READ )
-        | ( INSDC:4na:bin ) unpack ( in_4na_packed )
-        | < INSDC:dna:text, INSDC:4na:bin > map < INSDC:4na:map:CHARSET, INSDC:4na:map:BINSET > ( in_dna_text )
-        | < INSDC:x2na:bin, INSDC:4na:bin > map < INSDC:x2na:map:BINSET, [ 1, 2, 4, 8, 15 ] > ( in_x2na_bin );
-
-    // input 4na packed
-    INSDC:4na:packed in_4na_packed = READ;
-
-    // input x2na bin
-    INSDC:x2na:bin in_x2na_bin
-        = < INSDC:x2na:bin > range_validate < 0, 4 > ( READ )
-        | < INSDC:4na:bin, INSDC:x2na:bin > map < INSDC:4na:map:BINSET, [ 4,0,1,4,2,4,4,4,3,4,4,4,4,4,4,4 ] > ( in_4na_bin );
-
-    // input 2na bin
-    INSDC:2na:bin in_2na_bin
-        = < INSDC:2na:bin > range_validate < 0, 3 > ( READ )
-        | ( INSDC:2na:bin ) unpack ( in_2na_packed )
-        | INSDC:SEQ:rand_4na_2na ( in_4na_bin );
-
-    // input 2na packed
-    INSDC:2na:packed in_2na_packed = READ;
-
-    // input 4na alt-read ( ambiguities )
-    INSDC:4na:bin in_alt_4na_bin
-        = < INSDC:4na:bin, INSDC:4na:bin > map < INSDC:4na:map:BINSET, [ 15,0,0,3,0,5,6,7,0,9,10,11,12,13,14,15 ] > ( in_4na_bin );
-
-    // preparing a feed into stats column
-    U8 in_stats_bin = in_2na_bin;
-
-
-    /* physical columns
-     */
-
-    physical column INSDC:2na:packed .READ
-        = in_2na_packed
-        | ( INSDC:2na:packed ) pack ( in_2na_bin );
-
-    physical column < INSDC:4na:bin > zip_encoding .ALTREAD
-        = < INSDC:4na:bin > trim < 0, 0 > ( in_alt_4na_bin );
-
-
-    /* output rules
-     */
-
-    // output 2na packed
-    INSDC:2na:packed out_2na_packed
-        = .READ
-        | out_dcmp_2na_packed;
-
-    // output x2na bin
-    INSDC:x2na:bin out_x2na_bin
-        = out_dcmp_x2na_bin
-        | < INSDC:4na:bin, INSDC:x2na:bin > map < INSDC:4na:map:BINSET, [ 4,0,1,4,2,4,4,4,3,4,4,4,4,4,4,4 ] > ( out_4na_bin );
-
-    // output 2na->4na bin
-    INSDC:4na:bin out_2na_4na_bin
-        = < INSDC:2na:bin, INSDC:4na:bin > map < INSDC:2na:map:BINSET, [ 1, 2, 4, 8 ] > ( out_2na_bin );
-
-    // output 4na bin
-    INSDC:4na:bin out_4na_bin
-        = < INSDC:4na:bin > bit_or < ALIGN_RIGHT > ( out_2na_4na_bin, .ALTREAD )
-        | out_dcmp_4na_bin
-        | out_2na_4na_bin;
-
-    // output text
-    INSDC:dna:text out_dna_text
-        = < INSDC:4na:bin, INSDC:dna:text > map < INSDC:4na:map:BINSET, INSDC:4na:map:CHARSET > ( out_4na_bin );
-
-
-	/* INSDC:tbl:sequence inherited productions
-	 *  out_signal
-	 */
-
-	/* NCBI:tbl:dcmp_base_space inherited productions
-	 *  out_dcmp_2na_bin
-	 *  out_dcmp_4na_bin
-	 *  out_dcmp_x2na_bin
-	 *  out_dcmp_2na_packed
-	 */
-};
-
-
-
-
-/*--------------------------------------------------------------------------
- * color_space - implementation
- *  nucleotide sequences in color space
- */
-
-extern function
-INSDC:x2na:bin NCBI:dna_from_color #1 ( INSDC:x2cs:bin color_bin,
-     INSDC:coord:zero read_start, INSDC:coord:len read_len,
-     INSDC:dna:text cs_key, U8 color_matrix );
-
-
-/* dcmp_color_space
- *  declares common virtual productions
- */
-table NCBI:tbl:dcmp_color_space #1
-{
-    // rules to introduce purely virtual productions
-    // never expected to resolve...
-    INSDC:dna:text dcmp_virtual_productions
-        = out_dcmp_x2cs_bin
-        | out_dcmp_2cs_bin
-        | out_dcmp_2cs_packed;
-}
-
-/* history:
- *  1.0.1 - base explicitly upn sequence #1.0.1, spotdesc #1.0.1
- *  1.0.2 - spotdesc #1.0.2
- *  1.0.3 - base upon dcmp_color_space for "out_dcmp_2cs_bin"
- */
-table NCBI:tbl:color_space_common #1.0.3
-    = INSDC:tbl:sequence #1.0.1
-    , INSDC:SRA:tbl:spotdesc #1.0.2
-    , INSDC:SRA:tbl:stats #1.1.0
-    , NCBI:tbl:dcmp_color_space #1.0.0
-{
-    // cs_native - tells user color space is native
-    bool cs_native = < bool > echo < true > ();
-
-     // unambiguous unpacked 2cs
-    INSDC:2cs:bin out_2cs_bin
-        = out_dcmp_2cs_bin
-        | ( INSDC:2cs:bin ) unpack ( out_2cs_packed );
-
-     // unambiguous synthesized 2na
-    INSDC:2na:bin out_2na_bin
-        = < INSDC:x2na:bin, INSDC:2na:bin > map < INSDC:x2na:map:BINSET, [ 0, 1, 2, 3, 0 ] > ( out_x2na_bin );
-
-     // synthesized unpacked 4na
-    INSDC:4na:bin out_4na_bin
-        = < INSDC:x2na:bin, INSDC:4na:bin > map < INSDC:x2na:map:BINSET, [ 1, 2, 4, 8, 15 ] > ( out_x2na_bin );
-
-    // synthesized dna text
-    INSDC:dna:text out_dna_text
-        = < INSDC:x2na:bin, INSDC:dna:text > map < INSDC:x2na:map:BINSET, INSDC:x2na:map:CHARSET > ( out_x2na_bin );
-
-    // synthesized dna sequence
-    INSDC:x2na:bin out_x2na_bin
-        = NCBI:dna_from_color ( out_x2cs_bin, out_read_start, out_read_len, out_cs_key, out_color_matrix );
-
-    // synthesized packed 2na
-    INSDC:2na:packed out_2na_packed
-        = ( INSDC:2na:packed ) pack ( out_2na_bin );
-
-    // synthesized packed 4na
-    INSDC:4na:packed out_4na_packed
-        = ( INSDC:4na:packed ) pack ( out_4na_bin );
-
-    // synthesized color text
-    INSDC:color:text out_color_text
-        = < INSDC:x2cs:bin, INSDC:color:text > map <  INSDC:x2cs:map:BINSET, INSDC:x2cs:map:CHARSET > ( out_x2cs_bin );
-
-    // spot_len and fixed_spot_len
-    INSDC:coord:len color_space_spot_len
-        = ( INSDC:coord:len ) row_len ( out_2cs_packed );
-    INSDC:coord:len color_space_fixed_spot_len
-        = ( INSDC:coord:len ) fixed_row_len ( out_2cs_packed );
-
-	/* INSDC:tbl:sequence inherited productions
-	 *  in_cs_key
-	 *  out_cs_key
-	 *  out_signal
-	 *  out_x2cs_bin
-	 *  in_color_text
-	 *  out_2cs_packed
-	 *  out_color_matrix
-	 */
-
-	/* INSDC:SRA:tbl:stats inherited productions
-	 *  in_stats_bin
-	 */
-
-	/* NCBI:tbl:dcmp_color_space inherited productions
-	 *  out_dcmp_2cs_bin
-	 *  out_dcmp_x2cs_bin
-	 *  out_dcmp_2cs_packed
-	 */
-};
-
-/* color_space_nocol
- *  this table describes viewing rules
- *  but omits writing rules and physical column description
- *  in order to support older tables
- *
- * history:
- *  1.0.1 - base explicitly upon color_space_common #1.0.1
- *  1.0.2 - color_space_common #1.0.2
- *  1.0.3 - color_space_common #1.0.3
- */
-table NCBI:tbl:color_space_nocol #1.0.3
-    = NCBI:tbl:color_space_common #1.0.3
-    , NCBI:tbl:n_encoding #1
-{
-    // incoming is disabled
-
-    // v1 color matrix was stored in metadata
-    U8 out_color_matrix
-        = < U8 > meta:read < "COLOR_MATRIX" > ()
-        | < U8 > echo < INSDC:color:default_matrix > ();
-
-    // unpacked 2cs with ambiguities
-    INSDC:x2cs:bin out_x2cs_bin
-        = ( INSDC:x2cs:bin ) read_ndecode;
-
-    // interface with n-encoded qualities
-    U8 read_unpack = out_2cs_bin;
-
-	/* INSDC:tbl:sequence inherited productions
-	 *  out_cs_key
-	 *  out_signal
-	 *  out_2cs_packed
-	 */
-
-	/* NCBI:tbl:n_encoding inherited productions
-	 *  read_ndecode
-	 */
-};
-
-/* color_space #1
- *  this schema brings in .CSREAD and .CS_KEY columns for v1 tables
- *
- * history:
- *  1.0.1 - base explicitly upon color_space_nocol #1.0.1
- *  1.0.2 - color_space_nocol #1.0.2
- *  1.0.3 - color_space_nocol #1.0.3
- */
-table NCBI:tbl:color_space #1.0.3 = NCBI:tbl:color_space_nocol #1.0.3
-{
-    // stored as text
-    INSDC:dna:text out_cs_key = .CS_KEY;
-
-    // stored color sequence
-    INSDC:2cs:packed out_2cs_packed = .CSREAD;
-
-	/* INSDC:tbl:sequence inherited productions
-	 *  out_signal
-	 */
-
-	/* NCBI:tbl:n_encoding inherited productions
-	 *  read_ndecode
-	 */
-};
-
-/* color_space #2
- *  standard current color-space table
- *
- * history:
- *  2.0.1 - base explicitly upon color_space_common #1.0.1
- *  2.0.2 - base explicitly upon color_space_common #1.0.2
- *  2.1.0 - introduce hooks for compressed color space
- */
-table NCBI:tbl:color_space #2.1
-    = NCBI:tbl:color_space_common #1.0.3
-    , NCBI:tbl:dcmp_color_space #1.0.0
-{
-    /* input rules
-     */
-
-    // input text is not modified
-    // illegal values are not detected here
-    INSDC:color:text in_color_text = CSREAD;
-
-    // input x2cs bin
-    // illegal values will be caught here
-    INSDC:x2cs:bin in_x2cs_bin
-        = < INSDC:x2cs:bin > range_validate < 0, 4 > ( CSREAD )
-        | < INSDC:color:text, INSDC:x2cs:bin > map < INSDC:x2cs:map:CHARSET, INSDC:x2cs:map:BINSET > ( in_color_text );
-
-    // input 2cs bin
-    INSDC:2cs:bin in_2cs_bin
-        = < INSDC:2cs:bin > range_validate < 0, 3 > ( CSREAD )
-        | ( INSDC:2cs:bin ) unpack ( in_2cs_packed )
-        | < INSDC:x2cs:bin, INSDC:2cs:bin > map < INSDC:x2cs:map:BINSET, [ 0, 1, 2, 3, 0 ] > ( in_x2cs_bin );
-
-    // input 2cs packed
-    INSDC:2cs:packed in_2cs_packed = CSREAD;
-
-    // input x2cs alt-csread ( ambiguity )
-    INSDC:x2cs:bin in_alt_x2cs_bin
-        = < INSDC:x2cs:bin, INSDC:x2cs:bin > map < INSDC:x2cs:map:BINSET, [ 0, 0, 0, 0, 4 ] > ( in_x2cs_bin );
-
-    // color-space keys ARE modified on input
-    INSDC:dna:text in_cs_key
-        = < INSDC:dna:text, INSDC:dna:text > map < 'acgt', 'ACGT' > ( CS_KEY );
-
-    // color matrix
-    U8 in_color_matrix = < U8 > range_validate < 0, 4 > ( COLOR_MATRIX );
-
-    // prepairing a feed into stats column
-    U8 in_stats_bin = in_2cs_bin;
-
-
-    /* physical columns
-     */
-
-    physical column INSDC:2cs:packed .CSREAD
-        = in_2cs_packed
-        | ( INSDC:2cs:packed ) pack ( in_2cs_bin );
-
-    physical column < INSDC:x2cs:bin > zip_encoding .ALTCSREAD
-        = < INSDC:x2cs:bin > trim < 0, 0 > ( in_alt_x2cs_bin );
-
-    physical column < INSDC:dna:text > zip_encoding .CS_KEY = in_cs_key;
-
-    physical column < U8 > zip_encoding .COLOR_MATRIX = in_color_matrix;
-
-
-    /* output rules
-     */
-
-    // output 2cs packed
-    INSDC:2cs:packed out_2cs_packed
-        = .CSREAD
-        | out_dcmp_2cs_packed;
-
-    // unpacked 2cs with ambiguity
-    INSDC:x2cs:bin out_x2cs_bin
-        = ( INSDC:x2cs:bin ) < U8 > bit_or < ALIGN_RIGHT > ( out_2cs_bin, .ALTCSREAD )
-        | out_dcmp_x2cs_bin
-        | ( INSDC:x2cs:bin ) out_2cs_bin;
-
-    // read directly from physical column
-    INSDC:dna:text out_cs_key = .CS_KEY;
-
-    // color matrix may be synthesized
-    U8 out_color_matrix
-        = .COLOR_MATRIX
-        | < U8 > echo < INSDC:color:default_matrix > ();
-
-
-	/* INSDC:tbl:sequence inherited productions
-	 *  out_signal
-	 */
-
-	/* NCBI:tbl:dcmp_color_space inherited productions
-	 *  out_dcmp_2cs_bin
-	 *  out_dcmp_x2cs_bin
-	 *  out_dcmp_2cs_packed
-	 */
-};
-
-
-/*--------------------------------------------------------------------------
- * protein
- */
-table NCBI:tbl:protein #1 = INSDC:tbl:protein
-{
-    /* upper-case letters */
-    INSDC:protein:text in_protein_text = < INSDC:protein:text, INSDC:protein:text >
-        map < 'abcdefghiklmnpqrstvwxyzu','ABCDEFGHIKLMNPQRSTVWXYZU' > ( PROTEIN );
-
-    /* std aa */
-    INSDC:aa:bin in_aa_bin
-        = < INSDC:aa:bin > range_validate < 1, 25 > ( PROTEIN )
-        | < INSDC:protein:text, INSDC:aa:bin > map < INSDC:aa:map:CHARSET, INSDC:aa:map:BINSET > ( in_protein_text );
-
-    /* physical column */
-    physical column < INSDC:aa:bin > zip_encoding .PROTEIN = in_aa_bin;
-
-    /* output rules */
-    INSDC:aa:bin out_aa_bin = .PROTEIN;
-    INSDC:protein:text out_protein_text = < INSDC:aa:bin, INSDC:protein:text >
-        map < INSDC:aa:map:BINSET, INSDC:aa:map:CHARSET > ( out_aa_bin );
-};
-
-
-/*--------------------------------------------------------------------------
- * phred
- *  standard phred quality representation
- *  limits values on input to 1..63
- *  reserves value 0 as ambiguity symbol for reads
- */
-
-
-/* history:
- *  1.0.1 - base explicitly upon sequence #1.0.1
- */
-table NCBI:tbl:phred_quality_nocol #1.0.1 = INSDC:tbl:sequence #1.0.1, NCBI:tbl:n_encoding #1
-{
-    /* [CS]READ - decoding
-     */
-    U8 read_ndecode
-        = < INSDC:quality:phred, U8 > map < 0, 4 > ( out_qual_phred, read_unpack );
-
-	/* INSDC:tbl:sequence inherited productions
-	 *  out_qual_phred
-	 *  out_qual_text_phred_33
-	 *  out_qual_text_phred_64
-	 */
-
-	/* NCBI:tbl:n_encoding inherited productions
-	 *  read_unpack
-	 */
-};
-
-/* history:
- *  1.0.1 - base explicitly upon phred_quality_nocol #1.0.1
- */
-table NCBI:tbl:phred_quality #1.0.1 = NCBI:tbl:phred_quality_nocol #1.0.1
-{
-    // read directly as n-encoded phred is compatible with phred
-    NCBI:quality:n_encoded:phred out_qual_phred = .QUALITY;
-
-	/* INSDC:tbl:sequence inherited productions
-	 *  out_qual_text_phred_33
-	 *  out_qual_text_phred_64
-	 */
-
-	/* NCBI:tbl:n_encoding inherited productions
-	 *  read_unpack
-	 */
-};
-
-/* history:
- *  2.0.1 - added feed of in_stats_qual
- *  2.0.2 - added input of text encodings
- *  2.0.3 - base explicitly upon sequence #1.0.1
- *  2.0.4 - change compression from izip to zip
- *  2.0.5 - change from zip to delta_average_zip
- */
-table NCBI:tbl:phred_quality #2.0.4 = INSDC:tbl:sequence #1.0.1
-{
-    // read directly quality as  phred
-    INSDC:quality:phred out_qual_phred = .QUALITY;
-
-    // input rules
-    INSDC:quality:text:phred_33 in_qual_text_phred_33 = QUALITY;
-    INSDC:quality:text:phred_64 in_qual_text_phred_64 = QUALITY;
-
-    INSDC:quality:phred in_qual_phred
-        = QUALITY
-        | ( INSDC:quality:phred ) < B8 > diff < 33 > ( in_qual_text_phred_33 )
-        | ( INSDC:quality:phred ) < B8 > diff < 64 > ( in_qual_text_phred_64 );
-
-    // physical storage
-/*** next line is  for future change in production, but we have to wait until supporting code is released to the public ***/
-// physical column < INSDC:quality:phred > delta_average_zip_encoding .QUALITY = in_qual_phred;
-/*** NB *** MUST change table version to 2.0.5 and propagate to all derived tables ***/
-    physical column < INSDC:quality:phred > zip_encoding .QUALITY = in_qual_phred;
-
-    // feed to compressed statistics
-    INSDC:quality:phred in_stats_qual = in_qual_phred;
-
-	/* INSDC:tbl:sequence inherited productions
-	 *  out_qual_text_phred_33
-	 *  out_qual_text_phred_64
-	 */
-};
-
-
-
-/*--------------------------------------------------------------------------
- * log_odds
- *  log-odds quality score support
- *
- *  conversion from log-odds to phred is via formula
- *    10 * log ( 1 + pow ( 10, x / 10 ) ) / log ( 10 ) + 0.499
- *  for x = -4..40 : when x = -5, phred = 0
- */
-
-// the map function requires two lookup tables:
-// the first table detects every legal value...
-const INSDC:quality:log_odds NCBI:quality:from:log_odds =
-[
-             -6,-5,-4,-3,-2,-1, 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
-];
-
-// ...the second table gives positional translations
-const INSDC:quality:phred NCBI:quality:to:phred =
-[
-              0, 1, 1, 2, 2, 3, 3,
-     4, 4, 5, 5, 6, 7, 8, 9,10,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
-];
-
-function
-INSDC:quality:phred NCBI:log_odds_to_phred #1 ( INSDC:quality:log_odds qual_log_odds )
-{
-    // this range enforcement may not be required
-    INSDC:quality:log_odds log_odds_clip
-        = < INSDC:quality:log_odds > clip < -6, 40 > ( qual_log_odds );
-
-    // use the tables above to map from log-odds to phred
-    return < INSDC:quality:log_odds, INSDC:quality:phred >
-        map < NCBI:quality:from:log_odds, NCBI:quality:to:phred > ( log_odds_clip );
-}
-
-/* history:
- *  1.0.1 - base explicitly upon sequence #1.0.1
- */
-table NCBI:tbl:log_odds_quality_nocol #1.0.1 = INSDC:tbl:sequence #1.0.1, NCBI:tbl:n_encoding #1
-{
-    /* READ - decoding
-     */
-    U8 read_ndecode
-        = < INSDC:quality:log_odds, U8 > map < -6, 4 > ( out_qual_log_odds, read_unpack );
-
-    /* QUALITY
-     *  declared in INSDC:tbl:sequence as phred
-     *  introduce here as log-odds
-     */
-    extern column INSDC:quality:log_odds QUALITY = out_qual_log_odds;
-
-    // resolve for phred
-    INSDC:quality:phred out_qual_phred
-        = out_qual2_phred
-        | NCBI:log_odds_to_phred ( out_qual_log_odds );
-
-	/* INSDC:tbl:sequence inherited productions
-	 *  out_qual_text_phred_33
-	 *  out_qual_text_phred_64
-	 */
-
-	/* NCBI:tbl:n_encoding inherited productions
-	 *  read_unpack
-	 */
-
-	/* NCBI:tbl:log_odds_quality_nocol productions
-	 *  out_qual2_phred
-	 *  out_qual_log_odds
-	 */
-};
-
-/* history:
- *  1.0.1 - base explicitly upon log_odds_quality_nocol #1.0.1
- */
-table NCBI:tbl:log_odds_quality #1.0.1 = NCBI:tbl:log_odds_quality_nocol #1.0.1
-{
-    // read directly as n-encoded log_odds is compatible with log_odds
-    NCBI:quality:n_encoded:log_odds out_qual_log_odds = .QUALITY;
-
-	/* INSDC:tbl:sequence inherited productions
-	 *  out_qual_text_phred_33
-	 *  out_qual_text_phred_64
-	 */
-
-	/* NCBI:tbl:n_encoding inherited productions
-	 *  read_unpack
-	 */
-
-	/* NCBI:tbl:log_odds_quality_nocol inherited productions
-	 *  out_qual2_phred
-	 */
-};
-
-/* history:
- *  2.0.1 - base explicitly upon sequence #1.0.1
- */
-table NCBI:tbl:log_odds_quality_nocol #2.0.1 = INSDC:tbl:sequence #1.0.1
-{
-    /* QUALITY
-     *  declared in INSDC:tbl:sequence as phred
-     *  introduce here as log-odds
-     */
-    extern column INSDC:quality:log_odds QUALITY
-        = out_qual_log_odds;
-
-    // resolve for phred
-    INSDC:quality:phred out_qual_phred
-        = NCBI:log_odds_to_phred ( out_qual_log_odds );
-
-
-	/* INSDC:tbl:sequence inherited productions
-	 *  out_qual_text_phred_33
-	 *  out_qual_text_phred_64
-	 */
-
-	/* NCBI:tbl:log_odds_quality_nocol productions
-	 *  out_qual_log_odds
-	 */
-};
-
-/* history:
- *  2.0.1 - added feed of in_stats_qual
- *  2.0.2 - added input of text encodings
- *  2.0.3 - base explicitly upon log_odds_quality_nocol #2.0.1
- *  2.0.4 - changed compression from izip to zip
- */
-table NCBI:tbl:log_odds_quality #2.0.4 = NCBI:tbl:log_odds_quality_nocol #2.0.1
-{
-    INSDC:quality:log_odds out_qual_log_odds= .QUALITY;
-
-    extern column INSDC:quality:text:log_odds_64 QUALITY
-        = out_qual_text_log_odds_64
-        | ( INSDC:quality:text:log_odds_64 ) < B8 > sum < 64 > ( out_qual_log_odds );
-
-    // input rules
-    INSDC:quality:text:log_odds_64 in_qual_text_log_odds_64 = QUALITY;
-
-    INSDC:quality:log_odds in_qual_log_odds
-        = QUALITY
-        | ( INSDC:quality:log_odds ) < B8 > diff < 64 > ( in_qual_text_log_odds_64 );
-
-    physical column < INSDC:quality:log_odds > zip_encoding .QUALITY
-        = in_qual_log_odds;
-
-    // feed to compressed statistics
-    INSDC:quality:log_odds in_stats_qual = in_qual_log_odds;
-
-
-	/* INSDC:tbl:sequence inherited productions
-	 *  out_qual_text_phred_33
-	 *  out_qual_text_phred_64
-	 */
-
-	/* NCBI:tbl:log_odds_quality productions
-	 *  out_qual_text_log_odds_64
-	 */
-};
diff --git a/interfaces/ncbi/spotname.vschema b/interfaces/ncbi/spotname.vschema
deleted file mode 100644
index 5993cda..0000000
--- a/interfaces/ncbi/spotname.vschema
+++ /dev/null
@@ -1,377 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/*==========================================================================
- * NCBI Sequence Read Archive schema
- */
-version 1;
-
-include 'vdb/vdb.vschema';
-include 'insdc/sra.vschema';
-
-
-/*--------------------------------------------------------------------------
- * types
- */
-
-/* spot_name_token
- *  a vector describing tokens recognized within a spot name
- *
- * COMPONENTS:
- *  0 - token id
- *  1 - token starting coordinate
- *  2 - token length
- */
-alias text:token NCBI:SRA:spot_name_token;
-
-
-/* token values
- *
- *  tokens are produced by a schema-specific tokenizer function
- *  this function is purposely abstract because it may rely upon
- *  whatever information it needs to perform its task. the only
- *  requirement is that it produce these tokens as its output.
- *
- *  an empty name input must produce no tokens. in this case,
- *  there is no name to tokenize or data to produce.
- *
- *  a non-empty name must produce 1 or more tokens of output.
- *  all tokens must be ordered by starting character position.
- *
- *  if a name does not conform to any pattern recognized by the
- *  tokenizer, then the tokenizer emits a single token of "unrecognized"
- *
- *  if a name conforms to some pattern but does not have any
- *  substitution tokens, the tokenizer emits a single token of "recognized"
- *
- *  if a name may be tokenized, then the resulting tokens should
- *  describe only the portions of the string that should be removed
- *  from the name, e.g. "X" or "Y".
- *
- *  the standard coordinates "X".."L" are given in unsigned decimal.
- *  alternate representations are contained within their respective
- *  namespaces: "signed", "hex" and "octal".
- *
- *  the special coordinate "Q" represents the 454-specific encoding
- *  of X and Y into base-36, where the formula for Q is:
- *    Q = 4096 * X + Y
- *  and ASCII encoding:
- *    0..25 => "A-Z", 26..35 => "0-9"
- */
-const U16 NCBI:SRA:name_token:unrecognized =  1;
-const U16 NCBI:SRA:name_token:recognized   =  2;
-const U16 NCBI:SRA:name_token:Q            =  3;
-const U16 NCBI:SRA:name_token:X            =  4;
-const U16 NCBI:SRA:name_token:Y            =  5;
-const U16 NCBI:SRA:name_token:T            =  6;
-const U16 NCBI:SRA:name_token:L            =  7;
-const U16 NCBI:SRA:name_token:signed:X     =  8;
-const U16 NCBI:SRA:name_token:signed:Y     =  9;
-const U16 NCBI:SRA:name_token:signed:T     = 10;
-const U16 NCBI:SRA:name_token:signed:L     = 11;
-const U16 NCBI:SRA:name_token:octal:X      = 12;
-const U16 NCBI:SRA:name_token:octal:Y      = 13;
-const U16 NCBI:SRA:name_token:octal:T      = 14;
-const U16 NCBI:SRA:name_token:octal:L      = 15;
-const U16 NCBI:SRA:name_token:hex:upper:X  = 16;
-const U16 NCBI:SRA:name_token:hex:upper:Y  = 17;
-const U16 NCBI:SRA:name_token:hex:upper:T  = 18;
-const U16 NCBI:SRA:name_token:hex:upper:L  = 19;
-const U16 NCBI:SRA:name_token:hex:lower:X  = 20;
-const U16 NCBI:SRA:name_token:hex:lower:Y  = 21;
-const U16 NCBI:SRA:name_token:hex:lower:T  = 22;
-const U16 NCBI:SRA:name_token:hex:lower:L  = 23;
-
-
-/* token symbols
- *  when a name matches some pattern and tokens are recognized,
- *  the tokens are extracted from the name and sent to individual
- *  columns, and replaced with the symbols below to create a
- *  formatted name.
- */
-const ascii NCBI:SRA:name_symbol:Q           = '$Q';
-const ascii NCBI:SRA:name_symbol:X           = '$X';
-const ascii NCBI:SRA:name_symbol:Y           = '$Y';
-const ascii NCBI:SRA:name_symbol:T           = '$T';
-const ascii NCBI:SRA:name_symbol:L           = '$L';
-const ascii NCBI:SRA:name_symbol:octal:X     = '$a';
-const ascii NCBI:SRA:name_symbol:octal:Y     = '$b';
-const ascii NCBI:SRA:name_symbol:octal:T     = '$c';
-const ascii NCBI:SRA:name_symbol:octal:L     = '$d';
-const ascii NCBI:SRA:name_symbol:hex:upper:X = '$e';
-const ascii NCBI:SRA:name_symbol:hex:upper:Y = '$f';
-const ascii NCBI:SRA:name_symbol:hex:upper:T = '$g';
-const ascii NCBI:SRA:name_symbol:hex:upper:L = '$h';
-const ascii NCBI:SRA:name_symbol:hex:lower:X = '$x';
-const ascii NCBI:SRA:name_symbol:hex:lower:Y = '$y';
-const ascii NCBI:SRA:name_symbol:hex:lower:T = '$t';
-const ascii NCBI:SRA:name_symbol:hex:lower:L = '$l';
-
-
-/*--------------------------------------------------------------------------
- * functions
- */
-
-/* extract_spot_name
- *  generates input to .SPOT_NAME column
- *
- *  on NCBI:SRA:name_token:unrecognized, produces the entire spot name row
- *  otherwise, produces an empty row
- *
- *  "name" [ DATA ] - raw spot names from NAME column
- *
- *  "tok" [ DATA ] - delimiting tokens produced by sub-table
- */
-function ascii
-    NCBI:SRA:extract_spot_name #1 ( ascii name, NCBI:SRA:spot_name_token tok );
-
-
-/* extract_name_fmt
- *  generates input to .NAME_FMT column and/or updates skey index
- *
- *  on NCBI:SRA:name_token:unrecognized, produces an empty row
- *  otherwise, it creates a temporary "name_fmt" string from name row
- *
- *  an attempt is made to insert name_fmt into indicated text index
- *  ( normally 'skey' ). if the insert succeeds, i.e. associates "name_fmt"
- *  with a row_id, then the output for the row is empty.
- *
- *  if the insert fails due to key duplication, an attempt is made to
- *  extend the id range of associated rows. depending upon the type of index,
- *  this may succeed or fail, e.g. if the existing row range for "name_fmt" is
- *  n..m where m = row_id - 1, the range can be extended to n..row_id and
- *  the update succeeds. if the index supports discontiguous id ranges, the
- *  update will also succeed. upon any success updating the index, the output
- *  row will be empty.
- *
- *  finally, if the temporary "name_fmt" cannot be inserted into the index
- *  nor the existing id range updated, the output for the row will be "name_fmt".
- *
- *  "name" [ DATA ] - raw spot names from NAME column
- *
- *  "tok" [ DATA ] - delimiting tokens produced by sub-table
- */
-function ascii
-    NCBI:SRA:extract_name_fmt #1 < ascii idx > ( ascii name, NCBI:SRA:spot_name_token tok );
-
-
-/* extract_name_coord
- *  generates inputs to .X and .Y and possibly other columns
- *
- *  if no tokens match "coord"constant, produces an empty row
- *  otherwise, produces binary coordinate value
- *  if multiple tokens match criteria, all values must be equivalent
- *  because only a single value will be output per row
- *
- *  "coord" [ CONST ] - either NCBI:SRA:name_token:X or NCBI:SRA:name_token:Y
- *  both of these values also match the token NCBI:SRA:name_token:Q and extract
- *  contents appropriately.
- *
- *  "name" [ DATA ] - raw spot names from NAME column
- *
- *  "tok" [ DATA ] - delimiting tokens produced by sub-table
- */
-function INSDC:coord:val
-    NCBI:SRA:extract_name_coord #1 < U16 coord > ( ascii name, NCBI:SRA:spot_name_token tok );
-
-
-/* lookup
- */
-function INSDC:SRA:spot_ids_found NCBI:SRA:lookup #1.0
-    < ascii index_name, ascii query_by_name, U8 name_fmt_version > ( * ascii name_prefix );
-
-
-/*--------------------------------------------------------------------------
- * spotcoord
- *  spot coordinate table implementation
- */
-table NCBI:SRA:tbl:spotcoord #1 = INSDC:SRA:tbl:spotcoord #1
-{
-    // X and Y stored as I32
-    INSDC:coord:val out_x_coord = .X;
-    INSDC:coord:val out_y_coord = .Y;
-
-    // T and L are usually present but optional
-    INSDC:coord:val out_t_coord = .T;
-    INSDC:coord:val out_l_coord = .L;
-
-    // .X, .Y, .T and .L get either empty coordinate or proper coordinate
-    physical column < INSDC:coord:val > izip_encoding .X
-        = in_x_coord
-        | in_name_x_coord;
-    physical column < INSDC:coord:val > izip_encoding .Y
-        = in_y_coord
-        | in_name_y_coord;
-    physical column < INSDC:coord:val > izip_encoding .T
-        = in_t_coord
-        | in_name_t_coord;
-    physical column < INSDC:coord:val > izip_encoding .L
-        = in_l_coord
-        | in_name_l_coord;
-};
-
-
-/*--------------------------------------------------------------------------
- * skeyname
- *  spot name table implementation built upon prefix-tree skey index
- *
- * v1 - maintains a 1->1 key=>spot_id relationship
- *      with unique constraint on key. it does NOT
- *      implement name_fmt or x_coord or y_coord.
- *
- * v2 - maintains a 1->1 key=>spot_id-range relationship
- *      with unique constraint on key. it does NOT
- *      implement spot_name. X and Y are stored using
- *      16-bit unsigned quantities.
- *
- * v3 - maintains a flexible naming approach
- *      retrieves name directly from column if so stored
- *      synthesizes name from name_fmt, X and Y otherwise
- *      name_fmt is either retrieved directly from column
- *      or from skey index. X and Y are stored as 32-bit
- *      signed quantities.
- *
- * history:
- *  1.0.1 - explicitly account for spotname #1.0.1 ancestry
- *  2.0.1 - " "
- *  3.0.1 - moved .X and .Y to spotcoord table
- */
-table NCBI:SRA:tbl:skeyname #1.0.1 = INSDC:SRA:tbl:spotname #1.0.1
-{
-    // read the skey entry
-    ascii out_skey = ( ascii ) idx:text:project #1 < 'skey' > ();
-
-    // spot_name
-    ascii out_spot_name
-        = rewritten_spot_name
-        | out_skey;
-
-    // search skey entry
-    INSDC:SRA:spot_ids_found spot_ids_found
-        = ( INSDC:SRA:spot_ids_found ) NCBI:SRA:lookup #1 < 'skey' , 'QUERY_BY_NAME', 1 > ( out_slx_prefix ) 
-        | ( INSDC:SRA:spot_ids_found ) NCBI:SRA:lookup #1 < 'skey' , 'QUERY_BY_NAME', 0 > ();
-
-
-	/* INSDC:SRA:tbl:spotname inherited productions
-	 *  out_x_coord
-	 *  out_y_coord
-	 *  out_name_fmt
-	 */
-
-	/* NCBI:SRA:tbl:skeyname productions
-	 *  out_slx_prefix
-	 *  rewritten_spot_name
-	 */
-};
-
-table NCBI:SRA:tbl:skeyname_nocol #2.0.1 = INSDC:SRA:tbl:spotname #1.0.1
-{
-    // name_fmt
-    //  perform reverse lookup through index to get key
-    ascii out_name_fmt = ( ascii ) idx:text:project #1 < 'skey' > ();
-
-    // search skey entry
-    INSDC:SRA:spot_ids_found spot_ids_found
-        = ( INSDC:SRA:spot_ids_found ) NCBI:SRA:lookup #1 < 'skey' , 'QUERY_BY_NAME', 2 > ( out_slx_prefix ) 
-        | ( INSDC:SRA:spot_ids_found ) NCBI:SRA:lookup #1 < 'skey' , 'QUERY_BY_NAME', 2 > ();
-
-    // X and Y stored as U16
-    INSDC:coord:val out_x_coord = cast ( .X );
-    INSDC:coord:val out_y_coord = cast ( .Y );
-
-
-	/* NCBI:SRA:tbl:skeyname_nocol virtual productions
-	 *  out_slx_prefix
-	 */
-};
-
-table NCBI:SRA:tbl:skeyname #2.0.1 = NCBI:SRA:tbl:skeyname_nocol #2.0.1
-{
-    // spot_name_tok comes from a platform-specific tokenizer
-    // and must be of type 'NCBI:SRA:spot_name_token'
-    physical column < INSDC:coord:val > izip_encoding #1 .X
-        = NCBI:SRA:extract_name_coord < NCBI:SRA:name_token:X > ( NAME, in_spot_name_tok );
-    physical column < INSDC:coord:val > izip_encoding .Y
-        = NCBI:SRA:extract_name_coord < NCBI:SRA:name_token:Y > ( NAME, in_spot_name_tok );
-
-	/* NCBI:SRA:tbl:skeyname_nocol inherited virtual productions
-	 *  out_slx_prefix
-	 */
-
-	/* NCBI:SRA:tbl:skeyname virtual productions
-	 *  in_spot_name_tok
-	 */
-};
-
-table NCBI:SRA:tbl:skeyname #3.0.1 = INSDC:SRA:tbl:spotname #1.0.1, NCBI:SRA:tbl:spotcoord #1
-{
-    // spot_name
-    //  retrieve from hard column
-    ascii out_spot_name = .SPOT_NAME;
-
-    // name_fmt
-    //  retrieve from hard column or reverse lookup through index
-    ascii out_name_fmt = ( ascii ) idx:text:project #1 < 'skey' > ( .NAME_FMT );
-
-    INSDC:SRA:spot_ids_found  spot_ids_found
-        = ( INSDC:SRA:spot_ids_found ) NCBI:SRA:lookup #1 < 'skey' , 'QUERY_BY_NAME', 2 > ();
-
-
-    /* encoding rules
-     *  the sub-table will provide a platform-specific parser that
-     *  produces as its output a series of NCBI:SRA:spot_name_token
-     *  for each input row in the virtual production "spot_name_tok"
-     *
-     *  the tokenizer will look for X, Y or Q (combined) coordinates
-     *  within the spot name and issue tokens when found, or in the
-     *  case that none are found, an "unrecognized" token is issued.
-     *
-     *  the tokens are then processed here by common rules
-     */
-
-    // .SPOT_NAME gets either empty strings or unrecognized strings
-    physical column < ascii > zip_encoding .SPOT_NAME
-        = NCBI:SRA:extract_spot_name ( NAME, in_spot_name_tok );
-
-    // .NAME_FMT gets either empty strings or unindexed but recognized strings
-    physical column < ascii > zip_encoding .NAME_FMT
-        = NCBI:SRA:extract_name_fmt < 'skey' > ( NAME, in_spot_name_tok );
-
-    // .X, .Y, .T and .L get either empty coordinate or proper coordinate
-    INSDC:coord:val in_name_x_coord
-        = NCBI:SRA:extract_name_coord < NCBI:SRA:name_token:X > ( NAME, in_spot_name_tok );
-    INSDC:coord:val in_name_y_coord
-        = NCBI:SRA:extract_name_coord < NCBI:SRA:name_token:Y > ( NAME, in_spot_name_tok );
-    INSDC:coord:val in_name_t_coord
-        = NCBI:SRA:extract_name_coord < NCBI:SRA:name_token:T > ( NAME, in_spot_name_tok );
-    INSDC:coord:val in_name_l_coord
-        = NCBI:SRA:extract_name_coord < NCBI:SRA:name_token:L > ( NAME, in_spot_name_tok );
-
-
-	/* NCBI:SRA:tbl:skeyname virtual productions
-	 *  in_spot_name_tok
-	 */
-};
diff --git a/interfaces/ncbi/sra.vschema b/interfaces/ncbi/sra.vschema
deleted file mode 100644
index fc4dd63..0000000
--- a/interfaces/ncbi/sra.vschema
+++ /dev/null
@@ -1,743 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/*==========================================================================
- * NCBI Sequence Read Archive schema
- */
-version 1;
-
-include 'vdb/vdb.vschema';
-include 'ncbi/seq.vschema';
-include 'ncbi/spotname.vschema';
-include 'insdc/sra.vschema';
-include 'ncbi/stats.vschema';
-
-
-/*--------------------------------------------------------------------------
- * types
- */
-
-
-/* Segment - DEPRECATED
- *  a ( start, len ) pair where start is a zero-based, unsigned coordinate
- */
-typedef U16 NCBI:SRA:Segment [ 2 ];
-
-
-/* SpotDesc - DEPRECATED
- *   uint16_t spot_len;
- *   uint16_t fixed_len;
- *   uint16_t signal_len;
- *   uint16_t clip_qual_right;
- *   uint8_t num_reads;
- *   uint8_t align [ 7 ];
- */
-typedef B8 NCBI:SRA:SpotDesc [ 16 ];
-
-
-/* ReadDesc - DEPRECATED
- *   SRASegment { uint16_t start, len; } seg;
- *   uint8_t type;
- *   char cs_key;
- *   char label [ 74 ];
- */
-typedef B8 NCBI:SRA:ReadDesc [ 80 ];
-
-
-// some types have been moved to INSDC
-alias INSDC:SRA:platform_id NCBI:SRA:platform_id;
-alias INSDC:SRA:read_type NCBI:SRA:read_type;
-alias INSDC:SRA:read_filter NCBI:SRA:read_filter;
-
-typedef NCBI:fsamp4 NCBI:SRA:rotated_fsamp4, NCBI:SRA:swapped_fsamp4;
-
-// 16-bit POSITION type
-typedef U16 NCBI:SRA:pos16;
-
-
-/*--------------------------------------------------------------------------
- * functions
- */
-
-/* bio_start
- *  searches through read_type vector
- *  returns the 0-based starting coordinate of first biological read
- *
- *  "read_start" [ DATA ] - vector of read start coordinates
- *
- *  "read_type" [ DATA ] - vector of read types
- */
-extern function INSDC:coord:zero
-    NCBI:SRA:bio_start #1 ( INSDC:coord:zero read_start, INSDC:SRA:xread_type read_type );
-
-
-/* fix_read_seg
- */
-extern function INSDC:coord:len [ 2 ]
-    NCBI:SRA:fix_read_seg #1 ( U16 [ 2 ] rd_seg, INSDC:coord:len spot_len );
-
-
-/* make_spot_desc
- *  assembles several bits of information together into a "C" structure
- *
- *  "spot_len" [ DATA ] - computed spot length value
- *
- *  "fixed_len" [ DATA, DFLT ZERO ] - the stated fixed length of all spots
- *  or zero if not fixed length
- *
- *  "sig_len" [ DATA, DFLT ZERO ] - the length of signal/intensity data
- *  or zero if not present
- *
- *  "trim_start" [ DATA ] - the first base included in the trim segment
- *
- *  "trim_len" [ DATA ] - the length of the trim segment
- *
- *  "num_reads" [ DATA ] - 1..n value
- */
-extern function NCBI:SRA:SpotDesc NCBI:SRA:make_spot_desc #1 ( INSDC:coord:len spot_len,
-    INSDC:coord:len fixed_len,  INSDC:coord:len sig_len, INSDC:coord:zero trim_start,
-    INSDC:coord:len trim_len, U8 num_reads );
-
-
-/* make_read_desc
- *  assembles several bits of information together into a "C" structure
- *  in theory resultant segments may intersect other read segments or leave holes in spot.
- *
- *  "num_reads" [ DATA ] - value indicating the resulting row-length of output
- *
- *  "read_start" [ DATA ] - ordered starting coordinates for each read
- *  not required to be sequential.
- *
- *  "read_len" [ DATA ] - ordered lengths of each read. may be zero when
- *  read has been described but is not identified in spot.
- *
- *  "read_type" [ DATA ] - ordered type id describing each read
- *
- *  "read_filt" [ DATA ] - ordered read filters
- *
- *  "cs_key" [ DATA ] - ordered color-space keys
- *
- *  "label_start" [ DATA ] - ordered starting coordinates for each label
- *  "label_len" [ DATA ] - ordered lengths of each label
- *
- *  "label" [ DATA ] - complete sequence of label characters, possibly empty
- *  individual read labels are identified as {start,len} pairs
- */
-extern function NCBI:SRA:ReadDesc NCBI:SRA:make_read_desc #1 ( U8 num_reads,
-    INSDC:coord:zero read_start, INSDC:coord:len read_len, INSDC:SRA:xread_type read_type,
-    INSDC:SRA:read_filter read_filt, INSDC:dna:text cs_key,
-    INSDC:coord:zero label_start, INSDC:coord:len label_len, ascii label );
-
-
-/* rotate
- *  rotate a quadruple by called base
- *  now normally replaced by swap
- *
- *  "T" [ TYPE ] - element type of quadruple to be rotated
- *
- *  "encoding" [ CONST ] - when true, rotate input left until corresponding
- *  element is in slot 0. when false, rotate input right to restore original
- *  order.
- *
- *  "in" [ DATA ] - data to be rotated, qualities, signal, intensities...
- *
- *  "called" [ DATA ] - {0..3} or {0..4} binary representation of called bases or colors
- */
-extern function < type T >
-T NCBI:SRA:rotate #1 < bool encoding > ( T in, U8 called );
-
-
-/* swap
- *  swap element 0 and the called element
- *  used to ensure that the called element is in slot 0
- *
- *  "T" [ TYPE ] - element type of quadruple to be swapped
- *
- *  "in" [ DATA ] - data to be swapped, qualities, signal, intensities...
- *
- *  "called" [ DATA ] - {0..3} or {0..4} binary representation of called bases or colors
- */
-extern function < type T >
-T NCBI:SRA:swap #1 ( T in, U8 called );
-
-
-/* normalize
- * denormalize
- *
- *  "T" [ TYPE ] - element type of quadruple to be [de]normalized
- *
- *  "intensity" [ DATA ] - intensity data
- *
- *  "called" [ DATA ] - {0..3} or {0..4} binary representation of called bases or colors
- */
-extern function < type T >
-T NCBI:SRA:normalize #1 ( T intensity, U8 called );
-
-extern function < type T >
-T NCBI:SRA:denormalize #1 ( T intensity, U8 called );
-
-
-/* make_position
- *  return a synthesized position row with 1-1 correspondence
- *
- *  "T" [ TYPE ] - position type being generated
- *
- *  "start" [ CONST ] - either 0 or 1, depending upon the coordinate system
- *
- *  "bases" [ DATA ] - the actual row of bases. the output row
- *  will be the same length, but with synthesized data
- */
-extern function < type T >
-T NCBI:SRA:make_position #1 < T start > ( any bases );
-
-/* fsamp4 compression
- *  performs compression individually
- *  on called channel and alternate channels
- */
-function NCBI:SRA:swapped_fsamp4 NCBI:SRA:fsamp4:decode #2 ( merged_fmt in )
-{
-    fzip_fmt cmp0 = split < 0 > ( in );
-    fzip_fmt cmp123 = split < 1 > ( in );
-    F32 ch0 = funzip ( cmp0 );
-    F32 ch123a = funzip ( cmp123 );
-    F32[3] ch123 = redimension ( ch123a );
-    return ( NCBI:SRA:swapped_fsamp4 ) < F32 > paste ( ch0, ch123 );
-}
-
-function merged_fmt NCBI:SRA:fsamp4:encode #2 < U32 called, U32 alt > ( NCBI:SRA:swapped_fsamp4 in )
-{
-    F32 ch0 = < F32 > cut < 0 > ( in );
-    F32[3] ch123 = < F32 > cut < 1, 2, 3 > ( in );
-    fzip_fmt cmp0 = fzip < called > ( ch0 );
-    F32 ch123a = redimension ( ch123 );
-    fzip_fmt cmp123 = fzip < alt > ( ch123a );
-    return merge ( cmp0, cmp123 );
-}
-
-
-/*--------------------------------------------------------------------------
- * spotdesc
- *  NCBI implementation productions
- */
-
-/* history:
- *  1.0.1 - base explicitly upon sequence #1.0.1, spotdesc #1.0.1
- *  1.0.2 - spotdesc #1.0.2
- */
-table NCBI:SRA:tbl:spotdesc_nocol #1.0.2 = INSDC:tbl:sequence #1.0.1, INSDC:SRA:tbl:spotdesc #1.0.2
-{
-    /* LABEL_SEG
-     */
-    readonly column NCBI:SRA:Segment LABEL_SEG
-        = out_label_seg
-        | cast ( out_label_seg32 )
-        | cast ( _out_label_seg32 );
-    U32 _out_label_startU32 = ( U32 ) out_label_start;
-    U32 [ 2 ] _out_label_seg32 = < U32 > paste ( _out_label_startU32, out_label_len );
-
-
-    /* READ_SEG
-     */
-    readonly column NCBI:SRA:Segment READ_SEG
-        = out_read_seg
-        | cast ( out_read_seg32 )
-        | cast ( _out_read_seg32 );
-    U32 _out_read_startU32 = ( U32 ) out_read_start;
-    U32 [ 2 ] _out_read_seg32 = < U32 > paste ( _out_read_startU32, out_read_len );
-
-
-    /* READ_DESC
-     */
-    readonly column NCBI:SRA:ReadDesc READ_DESC
-        = NCBI:SRA:make_read_desc ( out_nreads, out_read_start, out_read_len,
-              out_read_type, _out_rd_filter, out_cs_key, _out_label_start, _out_label_len, _out_label );
-    INSDC:SRA:read_filter _out_rd_filter
-        = out_rd_filter
-        | < INSDC:SRA:read_filter > echo < SRA_READ_FILTER_PASS > ( out_read_start );
-    ascii _out_label
-        = out_label
-        | < ascii > echo < '' > ();
-    INSDC:coord:zero _out_label_start
-        = out_label_start
-        | < INSDC:coord:zero > echo < 0 > ( out_read_start );
-    INSDC:coord:len _out_label_len
-        = out_label_len
-        | < INSDC:coord:len > echo < 0 > ( out_read_start );
-
-    /* SPOT_DESC
-     */
-    readonly column NCBI:SRA:SpotDesc SPOT_DESC
-        = NCBI:SRA:make_spot_desc ( spot_len, fixed_spot_len, signal_len,
-              trim_start, trim_len, out_nreads );
-
-    /* SIGNAL_LEN
-     *  normally the same as spot length when present,
-     *  but in some cases ( e.g. 454 ) it may be different
-     */
-    readonly column INSDC:coord:len SIGNAL_LEN
-        = signal_len;
-    readonly column U16 SIGNAL_LEN
-        = cast ( signal_len );
-
-
-	/* INSDC:SRA:tbl:spotdesc inherited productions
-	 *  trim_len
-	 *  out_label
-	 *  out_nreads
-	 *  trim_start
-	 *  out_read_len
-	 *  out_label_len
-	 *  out_rd_filter
-	 *  out_read_type
-	 *  out_read_start
-	 *  out_label_start
-	 *  static_fixed_spot_len
-	 */
-
-	/* NCBI:SRA:tbl:spotdesc_nocol productions
-	 *  out_read_seg
-	 *  out_label_seg
-	 *  out_read_seg32
-	 *  out_label_seg32
-	 */
-};
-
-/* history:
- *  1.0.1 - base explicitly upon spotdesc_nocol #1.0.1
- *  1.0.2 - base explicitly upon spotdesc_nocol #1.0.2
- */
-table NCBI:SRA:tbl:spotdesc_nophys #1.0.2 = NCBI:SRA:tbl:spotdesc_nocol #1.0.2
-{
-    // resolve virtual productions
-    U8 out_nreads = .NREADS; 
-    ascii out_label = .LABEL;
-    INSDC:SRA:xread_type out_read_type = .READ_TYPE;
-    INSDC:SRA:read_filter out_rd_filter  = .RD_FILTER;
-
-    INSDC:coord:zero out_label_start
-        = .LABEL_START
-        | ( INSDC:coord:zero ) < U32 > cut < 0 > ( out_label_seg32 );
-    INSDC:coord:len out_label_len
-        = .LABEL_LEN
-        | ( INSDC:coord:len ) < U32 > cut < 1 > ( out_label_seg32 );
-    U32 [ 2 ] out_label_seg32
-        = cast ( .LABEL_SEG );
-
-    INSDC:coord:zero out_read_start
-        = .READ_START
-        | ( INSDC:coord:zero ) < U32 > cut < 0 > ( out_read_seg32 );
-    INSDC:coord:len out_read_len
-        = .READ_LEN
-        | ( INSDC:coord:len ) < U32 > cut < 1 > ( out_read_seg32 );
-    U32 [ 2 ] out_read_seg32
-        = NCBI:SRA:fix_read_seg ( .READ_SEG, spot_len );
-
-
-	/* INSDC:SRA:tbl:spotdesc inherited productions
-	 *  trim_len
-	 *  trim_start
-	 *  out_read_type
-	 *  static_fixed_spot_len
-	 */
-
-	/* NCBI:SRA:tbl:spotdesc_nocol inherited productions
-	 *  out_read_seg
-	 *  out_label_seg
-	 */
-
-	/* NCBI:SRA:tbl:spotdesc_nophys productions
-	 *  .LABEL
-	 *  .NREADS
-	 *  .READ_LEN
-	 *  .READ_SEG
-	 *  .LABEL_LEN
-	 *  .LABEL_SEG
-	 *  .RD_FILTER
-	 *  .READ_TYPE
-	 *  .READ_START
-	 *  .LABEL_START
-	 */
-}
-
-/* history:
- *  1.0.1 - base explicitly upon spotdesc_nophys #1.0.1
- *  1.0.2 - base explicitly upon spotdesc_nophys #1.0.2
- */
-table NCBI:SRA:tbl:spotdesc #1.0.2 = NCBI:SRA:tbl:spotdesc_nophys #1.0.2
-{
-    // physical column encodings
-    // TBD - this has to be looked at, where dynamic segmentation is involved
-    physical column < U8 > zip_encoding .NREADS = NREADS;
-    physical column < ascii > zip_encoding .LABEL = LABEL;
-    physical column < INSDC:coord:zero > izip_encoding .LABEL_START = LABEL_START;
-    physical column < INSDC:coord:len > izip_encoding .LABEL_LEN = LABEL_LEN;
-    physical column < INSDC:coord:zero > izip_encoding .READ_START = READ_START;
-    physical column < INSDC:coord:len > izip_encoding .READ_LEN = in_read_len;
-    physical column < INSDC:SRA:xread_type > zip_encoding .READ_TYPE = in_read_type;
-    physical column < INSDC:SRA:read_filter > zip_encoding .RD_FILTER = READ_FILTER;
-
-
-	/* INSDC:SRA:tbl:spotdesc inherited productions
-	 *  trim_len
-	 *  trim_start
-	 *  out_read_type
-	 *  static_fixed_spot_len
-	 */
-
-	/* NCBI:SRA:tbl:spotdesc_nocol inherited productions
-	 *  out_read_seg
-	 *  out_label_seg
-	 */
-};
-
-
-/*--------------------------------------------------------------------------
- * pos
- *  synthetic POSITION column on read
- *
- * history:
- *  1.0.1 - base explicitly upon sequence #1.0.1
- */
-
-table NCBI:SRA:tbl:pos #1.0.1 = INSDC:tbl:sequence #1.0.1
-{
-    INSDC:position:one out_position
-        = < INSDC:position:one > NCBI:SRA:make_position < 1 > ( out_2na_packed )
-        | < INSDC:position:one > NCBI:SRA:make_position < 1 > ( out_2cs_packed );
-    NCBI:SRA:pos16 out_position16
-        = < NCBI:SRA:pos16 > NCBI:SRA:make_position < 1 > ( out_2na_packed )
-        | < NCBI:SRA:pos16 > NCBI:SRA:make_position < 1 > ( out_2cs_packed );
-};
-
-
-/*--------------------------------------------------------------------------
- * sra
- *  the NCBI SRA table
- */
-
-/* history:
- *  1.0.1 - base explicitly upon sra #1.0.1
- *  1.0.2 - base explicitly upon sra #1.0.2, spotdesc_nocol #1.0.1
- *  1.0.3 - base explicitly upon sra #1.0.3, spotdesc_nocol #1.0.2
- */
-table NCBI:SRA:tbl:sra_nopos #1.0.3 = INSDC:SRA:tbl:sra #1.0.3, NCBI:SRA:tbl:spotdesc_nocol #1.0.2
-{
-    // v1 declares the POSITION column for all tables
-    // but leaves all physical columns unstated
-
-    /* POSITION
-     *  1-based coordinates
-     *  describes a base's position on signal
-     */
-    column INSDC:position:one POSITION = out_position;
-    readonly column NCBI:SRA:pos16 POSITION = out_position16;
-
-    // zero-based coordinates available upon request
-    readonly column INSDC:position:zero POSITION
-        = ( INSDC:position:zero ) < I32 > diff < 1 > ( out_position );
-
-    // statistics
-    U64 base_count
-        = < U64 > meta:value < "BASE_COUNT" > ();
-    U64 spot_count
-        = < U64 > meta:value < ".seq/spot" > ()
-        | < U64 > meta:value < ".seq" > () ;
-
-
-	/* INSDC:tbl:sequence inherited productions
-	 *  cs_native
-	 *  in_cs_key
-	 *  out_cs_key
-	 *  out_signal
-	 *  in_dna_text
-	 *  out_2cs_bin
-	 *  out_2na_bin
-	 *  out_4na_bin
-	 *  out_dna_text
-	 *  out_x2cs_bin
-	 *  out_x2na_bin
-	 *  in_color_text
-	 *  out_2cs_packed
-	 *  out_2na_packed
-	 *  out_4na_packed
-	 *  out_color_text
-	 *  out_qual_phred
-	 *  out_color_matrix
-	 */
-
-	/* INSDC:SRA:tbl:spotname inherited productions
-	 *  out_x_coord
-	 *  out_y_coord
-	 *  out_name_fmt
-	 *  out_spot_name
-	 *  spot_ids_found
-	 */
-
-	/* INSDC:SRA:tbl:spotdesc inherited productions
-	 *  trim_len
-	 *  out_label
-	 *  out_nreads
-	 *  trim_start
-	 *  out_read_len
-	 *  out_label_len
-	 *  out_rd_filter
-	 *  out_read_type
-	 *  out_read_start
-	 *  out_label_start
-	 *  static_fixed_spot_len
-	 */
-
-	/* INSDC:SRA:tbl:stats inherited productions
-	 *  max_spot_id
-	 *  min_spot_id
-	 *  in_stats_bin
-	 *  bio_base_count
-	 */
-
-	/* INSDC:SRA:tbl:sra inherited productions
-	 *  out_platform
-	 *  platform_name
-	 */
-
-	/* NCBI:SRA:tbl:spotdesc_nocol inherited productions
-	 *  out_read_seg
-	 *  out_label_seg
-	 *  out_read_seg32
-	 *  out_label_seg32
-	 */
-
-	/* NCBI:SRA:tbl:sra_nopos productions
-	 *  out_position
-	 *  out_position16
-	 */
-};
-
-/* history:
- *  1.0.1 - base explicitly upon sra #1.0.1
- *  1.0.2 - base explicitly upon sra_nopos #1.0.2, pos #1.0.1
- *  1.0.3 - base explicitly upon sra_nopos #1.0.3
- */
-table NCBI:SRA:tbl:sra #1.0.3 = NCBI:SRA:tbl:sra_nopos #1.0.3, NCBI:SRA:tbl:pos #1.0.1
-{
-    // the POSITION column is synthesized for all contemporary platforms but 454
-
-	/* INSDC:tbl:sequence inherited productions
-	 *  cs_native
-	 *  in_cs_key
-	 *  out_cs_key
-	 *  out_signal
-	 *  in_dna_text
-	 *  out_2cs_bin
-	 *  out_2na_bin
-	 *  out_4na_bin
-	 *  out_dna_text
-	 *  out_x2cs_bin
-	 *  out_x2na_bin
-	 *  in_color_text
-	 *  out_2cs_packed
-	 *  out_2na_packed
-	 *  out_4na_packed
-	 *  out_color_text
-	 *  out_qual_phred
-	 *  out_color_matrix
-	 */
-
-	/* INSDC:SRA:tbl:spotname inherited productions
-	 *  out_x_coord
-	 *  out_y_coord
-	 *  out_name_fmt
-	 *  out_spot_name
-	 *  spot_ids_found
-	 */
-
-	/* INSDC:SRA:tbl:spotdesc inherited productions
-	 *  trim_len
-	 *  out_label
-	 *  out_nreads
-	 *  trim_start
-	 *  out_read_len
-	 *  out_label_len
-	 *  out_rd_filter
-	 *  out_read_type
-	 *  out_read_start
-	 *  out_label_start
-	 *  static_fixed_spot_len
-	 */
-
-	/* INSDC:SRA:tbl:stats inherited productions
-	 *  max_spot_id
-	 *  min_spot_id
-	 *  in_stats_bin
-	 *  bio_base_count
-	 */
-
-	/* INSDC:SRA:tbl:sra inherited productions
-	 *  out_platform
-	 *  platform_name
-	 */
-
-	/* NCBI:SRA:tbl:spotdesc_nocol inherited productions
-	 *  out_read_seg
-	 *  out_label_seg
-	 *  out_read_seg32
-	 *  out_label_seg32
-	 */
-};
-
-
-/* v2 consolidates many of the auxiliary columns into a single treatment
- * left out are reads, qualities and platform-specific columns
- *
- * history:
- * 2.1.2 - base upon sra #1.0.3, spotdesc #1.0.2, stats #1.1.2
- */
-table NCBI:SRA:tbl:sra_nopos #2.1.3 = INSDC:SRA:tbl:sra #1.0.3,
-    NCBI:SRA:tbl:skeyname #3.0.1, NCBI:SRA:tbl:spotdesc #1.0.2, NCBI:SRA:tbl:stats #1.2.0
-{
-    // this is already specified in INSDC:SRA:tbl:sra #1
-    // but putting it here will quiet down outputs
-    INSDC:SRA:platform_id out_platform = .PLATFORM;
-    
-    column INSDC:position:one POSITION
-        = out_position;
-    readonly column NCBI:SRA:pos16 POSITION
-        = cast ( _clip_position );
-    INSDC:position:one _clip_position
-        = < INSDC:position:one > clip < 0, 0xFFFF > ( out_position );
-    readonly column INSDC:position:zero POSITION
-        = ( INSDC:position:zero ) < I32 > diff < 1 > ( out_position );
-
-
-	/* INSDC:tbl:sequence inherited productions
-	 *  cs_native
-	 *  in_cs_key
-	 *  out_cs_key
-	 *  out_signal
-	 *  in_dna_text
-	 *  out_2cs_bin
-	 *  out_2na_bin
-	 *  out_4na_bin
-	 *  out_dna_text
-	 *  out_x2cs_bin
-	 *  out_x2na_bin
-	 *  in_color_text
-	 *  out_2cs_packed
-	 *  out_2na_packed
-	 *  out_4na_packed
-	 *  out_color_text
-	 *  out_qual_phred
-	 *  out_color_matrix
-	 */
-
-	/* INSDC:SRA:tbl:spotdesc inherited productions
-	 *  trim_len
-	 *  trim_start
-	 *  out_read_type
-	 *  static_fixed_spot_len
-	 */
-
-	/* INSDC:SRA:tbl:stats inherited productions
-	 *  in_stats_bin
-	 */
-
-	/* INSDC:SRA:tbl:sra inherited productions
-	 *  out_platform
-	 *  platform_name
-	 */
-
-	/* NCBI:SRA:tbl:skeyname inherited productions
-	 *  in_spot_name_tok
-	 */
-
-	/* NCBI:SRA:tbl:spotdesc_nocol inherited productions
-	 *  out_read_seg
-	 *  out_label_seg
-	 */
-
-	/* NCBI:SRA:tbl:sra_nopos productions
-	 *  out_position
-	 */
-};
-
-/* most platforms don't have a native POSITION
- * mix in "pos" table to synthesize it
- *
- * history:
- *  2.1.2 - base upon sra#1.0.3, spotdesc #1.0.2, stats #1.1.2
- */
-table NCBI:SRA:tbl:sra #2.1.3 = INSDC:SRA:tbl:sra #1.0.3,
-    NCBI:SRA:tbl:skeyname #3.0.1, NCBI:SRA:tbl:spotdesc #1.0.2,
-    NCBI:SRA:tbl:stats #1.2.0, NCBI:SRA:tbl:pos #1.0.1
-{
-    readonly column INSDC:position:one POSITION
-        = out_position;
-    readonly column NCBI:SRA:pos16 POSITION
-        = out_position16;
-    readonly column INSDC:position:zero POSITION
-        = ( INSDC:position:zero ) < I32 > diff < 1 > ( out_position );
-
-
-	/* INSDC:tbl:sequence inherited productions
-	 *  cs_native
-	 *  in_cs_key
-	 *  out_cs_key
-	 *  out_signal
-	 *  in_dna_text
-	 *  out_2cs_bin
-	 *  out_2na_bin
-	 *  out_4na_bin
-	 *  out_dna_text
-	 *  out_x2cs_bin
-	 *  out_x2na_bin
-	 *  in_color_text
-	 *  out_2cs_packed
-	 *  out_2na_packed
-	 *  out_4na_packed
-	 *  out_color_text
-	 *  out_qual_phred
-	 *  out_color_matrix
-	 */
-
-	/* INSDC:SRA:tbl:spotdesc inherited productions
-	 *  trim_len
-	 *  trim_start
-	 *  out_read_type
-	 *  static_fixed_spot_len
-	 */
-
-	/* INSDC:SRA:tbl:stats inherited productions
-	 *  in_stats_bin
-	 */
-
-	/* INSDC:SRA:tbl:sra inherited productions
-	 *  out_platform
-	 *  platform_name
-	 */
-
-	/* NCBI:SRA:tbl:skeyname inherited productions
-	 *  in_spot_name_tok
-	 */
-};
diff --git a/interfaces/ncbi/stats.vschema b/interfaces/ncbi/stats.vschema
deleted file mode 100644
index c462a8a..0000000
--- a/interfaces/ncbi/stats.vschema
+++ /dev/null
@@ -1,119 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/*==========================================================================
- * NCBI Sequence Read Archive schema
- */
-version 1;
-
-include 'insdc/sra.vschema';
-
-
-/*--------------------------------------------------------------------------
- * types
- */
-typeset NCBI:SRA:stats:qual_type
-{
-    INSDC:quality:phred,
-    INSDC:quality:log_odds,
-    INSDC:quality:log_odds [ 4 ]
-};
-
-
-/*--------------------------------------------------------------------------
- * functions
- */
-
-/*
-   trigger to build meta statistics: spot count, base count, etc.
- */
-extern function U8 NCBI:SRA:stats_trigger #1
-    ( U8 read_bin, U32 read_len, INSDC:SRA:xread_type read_type * ascii spot_group );
-
-/* trigger to build meta statistics from compressed reads
- */
-extern function
-U8 NCBI:SRA:cmp_stats_trigger #1 ( B8 cmp_read_bin, NCBI:SRA:stats:qual_type qual_bin,
-    U32 read_len, INSDC:SRA:xread_type read_type * ascii spot_group );
-
-extern function
-U8 NCBI:SRA:cmpf_stats_trigger #1 ( B8 cmp_read_bin, U32 spot_len,
-    U32 read_len, INSDC:SRA:xread_type read_type * ascii spot_group );
-
-
-/* trigger to build phred_quality statistics in meta
- */
-extern function
-U8 NCBI:SRA:phred_stats_trigger #1 ( INSDC:quality:phred qual_bin );
-
-/*--------------------------------------------------------------------------
- * table
- */
-
-/* stats
- *  holds sequence statistics
- *
- * history:
- *  1.0.1 - explicitly interit from sra #1.0.1
- *  1.1.0 - incorporate stats from compressed read
- *  1.1.1 - sra #1.0.2
- *  1.1.2 - sra #1.0.3 + cmp_base_count or to base_count
- */
-table NCBI:SRA:tbl:stats #1.2.0 = INSDC:SRA:tbl:stats #1.1, INSDC:SRA:tbl:sra #1.0.3
-{
-    INSDC:SRA:spotid_t min_spot_id
-        = < INSDC:SRA:spotid_t > meta:value < "STATS/TABLE/SPOT_MIN" > ();
-
-    INSDC:SRA:spotid_t max_spot_id
-        = < INSDC:SRA:spotid_t > meta:value < "STATS/TABLE/SPOT_MAX" > ();
-
-    U64 spot_count
-        = < U64 > meta:value < "STATS/TABLE/SPOT_COUNT" > ();
-
-    U64 base_count
-        = < U64 > meta:value < "STATS/TABLE/BASE_COUNT" > ();
-
-    U64 bio_base_count
-        = < U64 > meta:value < "STATS/TABLE/BIO_BASE_COUNT" > ();
-
-    U64 cmp_base_count
-        = < U64 > meta:value < "STATS/TABLE/CMP_BASE_COUNT" > () | base_count;
-
-    trigger meta_stats
-        = NCBI:SRA:stats_trigger ( in_stats_bin, in_read_len, in_read_type, in_spot_group )
-        | NCBI:SRA:stats_trigger ( in_stats_bin, in_read_len, in_read_type )
-        | NCBI:SRA:cmp_stats_trigger ( in_cmp_stats_bin, in_stats_qual, in_read_len, in_read_type, in_spot_group )
-        | NCBI:SRA:cmp_stats_trigger ( in_cmp_stats_bin, in_stats_qual, in_read_len, in_read_type )
-        | NCBI:SRA:cmpf_stats_trigger ( in_cmp_stats_bin, in_spot_len, in_read_len, in_read_type, in_spot_group )
-        | NCBI:SRA:cmpf_stats_trigger ( in_cmp_stats_bin, in_spot_len, in_read_len, in_read_type );
-        
-    trigger qual_stats
-        = NCBI:SRA:phred_stats_trigger #1 ( in_qual_phred );
-
-	/* INSDC:SRA:tbl:stats inherited virtual productions
-	 *  in_stats_bin
-	 */
-};
diff --git a/interfaces/ncbi/vdb-blast-priv.h b/interfaces/ncbi/vdb-blast-priv.h
deleted file mode 100644
index 065b866..0000000
--- a/interfaces/ncbi/vdb-blast-priv.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_ncbi_vdb_blast_priv_
-#define _h_ncbi_vdb_blast_priv_
-
-#ifndef _h_vdb_extern_
-#include <vdb/extern.h>
-#endif
-
-#include <stddef.h>
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct VdbBlast2naReader;
-
-VDB_EXTERN uint64_t CC _VdbBlast2naReaderRead(const struct VdbBlast2naReader *self,
-    uint32_t *status, uint64_t *read_id, size_t *starting_base,
-    uint8_t *buffer, size_t buffer_size);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_ncbi_vdb_blast_priv_ */
diff --git a/interfaces/ncbi/vdb-blast.h b/interfaces/ncbi/vdb-blast.h
deleted file mode 100644
index 6f8c1fe..0000000
--- a/interfaces/ncbi/vdb-blast.h
+++ /dev/null
@@ -1,489 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_ncbi_vdb_blast_
-#define _h_ncbi_vdb_blast_
-
-#ifndef _h_vdb_extern_
-#include <vdb/extern.h>
-#endif
-
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * defines
- */
-#ifdef __cplusplus
-#define VDB_BLAST_DECLARE( cls ) \
-    struct cls
-#else
-#define VDB_BLAST_DECLARE( cls ) \
-    typedef struct cls cls
-#endif
-
-
-/*--------------------------------------------------------------------------
- * status codes
- *  NB - TO BE COMPLETED DURING DEVELOPMENT OF TESTS AND INITIAL CODE
- */
-enum
-{
-    eVdbBlastNoErr,
-    eVdbBlastErr,
-    eVdbBlastMemErr,
-    eVdbBlastRunErr,
-    eVdbBlastEndOfSequence,
-    eVdbBlastChunkedSequence, /* can't hand out direct pointer into cache */
-    eVdbBlastTooExpensive,
-    eVdbBlastInvalidId /* an invalid read_id was used as an input parameter:
-                          usually accessing a filtered read via 4naReader */
-};
-
-
-/*------------------------------------------------------------------------------
- * VdbBlastMgr
- */
-VDB_BLAST_DECLARE ( VdbBlastMgr );
-
-
-/* Init
- *  initialize library
- *
- *  "status" [ OUT ] - return parameter for status code
- */
-VDB_EXTERN VdbBlastMgr* CC VdbBlastInit ( uint32_t *status );
-
-
-/* AddRef
- *  attach a reference to existing object
- * Release
- *  drop reference to object
- *  deletes object when last reference is gone
- */
-VDB_EXTERN VdbBlastMgr* CC VdbBlastMgrAddRef ( VdbBlastMgr *self );
-VDB_EXTERN void CC VdbBlastMgrRelease ( VdbBlastMgr *self );
-
-
-/* OTHER FUNCTIONS FOR CONFIGURING SESSION BEHAVIOR */
-
-
-/*------------------------------------------------------------------------------
- * VdbBlastRunSet
- */
-VDB_BLAST_DECLARE ( VdbBlastRunSet );
-
-
-/* MakeRunSet
- *  create an empty run set
- *
- *  "status" [ OUT ] - return parameter for status code
- *
- *  "min_read_length" [ IN ] - min-length parameter for filtering
- *
- *  "protein" [ IN ] - if true, run set will contain only protein sequences
- *
- *  returns NULL upon any error
- */
-VDB_EXTERN VdbBlastRunSet* CC VdbBlastMgrMakeRunSet ( const VdbBlastMgr *self,
-    uint32_t *status, uint32_t min_read_length, bool protein );
-
-
-/* AddRef
- *  attach a reference to existing object
- * Release
- *  drop reference to object
- *  deletes object when last reference is gone
- */
-VDB_EXTERN VdbBlastRunSet* CC VdbBlastRunSetAddRef ( VdbBlastRunSet *self );
-VDB_EXTERN void CC VdbBlastRunSetRelease ( VdbBlastRunSet *self );
-
-
-/* AddRun
- *  add a run by accession or path
- *
- *  "rundesc" [ IN ] - NUL-terminated UTF-8 string
- *  giving run accession or path
- *
- *  returns status code
- */
-VDB_EXTERN uint32_t CC VdbBlastRunSetAddRun ( VdbBlastRunSet *self,
-    const char *rundesc );
-
-
-/* GetNumSequences
- *  returns the total number of biological sequences in run set
- * GetNumSequencesApprox
- *  returns a calculated estimate of the number of biological
- *  sequences in run set. may be used if the exact count function
- *  returns "eVdbBlastTooExpensive".
- */
-VDB_EXTERN uint64_t CC VdbBlastRunSetGetNumSequences
-    ( const VdbBlastRunSet *self, uint32_t *status );
-VDB_EXTERN uint64_t CC VdbBlastRunSetGetNumSequencesApprox
-    ( const VdbBlastRunSet *self );
-
-
-/* GetTotalLength
- *  returns the total number of bases in run set
- * GetTotalLengthApprox
- *  returns a calculated estimate of the total number
- *  of bases in run set. may be used if the exact length function
- *  returns "eVdbBlastTooExpensive".
- */
-VDB_EXTERN uint64_t CC VdbBlastRunSetGetTotalLength
-    ( const VdbBlastRunSet *self, uint32_t *status );
-VDB_EXTERN uint64_t CC VdbBlastRunSetGetTotalLengthApprox
-    ( const VdbBlastRunSet *self );
-
-
-/* GetMinSeqLen
- * GetMaxSeqLen
- * GetAvgSeqLen
- *  returns metrics of biological reads
- *  may be the result of estimated calculations ( see above )
- */
-VDB_EXTERN uint64_t CC VdbBlastRunSetGetMaxSeqLen
-    ( const VdbBlastRunSet *self );
-VDB_EXTERN uint64_t CC VdbBlastRunSetGetMinSeqLen
-    ( const VdbBlastRunSet *self );
-VDB_EXTERN uint64_t CC VdbBlastRunSetGetAvgSeqLen
-    ( const VdbBlastRunSet *self );
-
-
-/* GetName
- *  returns the total number of bytes needed for name
- *  which, if > bsize, means insufficient buffer error
- *  and if == bsize, means the name is NOT NUL-terminated
- *  otherwise, the buffer is NUL-terminated as well.
- */
-VDB_EXTERN size_t CC VdbBlastRunSetGetName ( const VdbBlastRunSet *self,
-    uint32_t *status, char *name_buffer, size_t bsize );
-
-
-/* IsProtein
- *  return the boolean value given when the set was created
- */
-VDB_EXTERN bool CC VdbBlastRunSetIsProtein ( const VdbBlastRunSet *self );
-
-
-#if NOT_DEFERRED
-/* LastUpdatedDate
- *  request the modification date of the SEQUENCE data
- *  or the READ DESCRIPTOR data, whichever is more recent
- */
-time_t VdbBlastRunSetLastUpdatedDate ( const VdbBlastRunSet *self );
-#endif
-
-/* GetReadName
- */
-VDB_EXTERN size_t CC VdbBlastRunSetGetReadName ( const VdbBlastRunSet *self,
-    uint64_t read_id, char *name_buffer, size_t bsize );
-
-/* GetReadId
- * Inverse function to GetReadName
- *
- *  returns status code
- */
-VDB_EXTERN uint32_t CC VdbBlastRunSetGetReadId ( const VdbBlastRunSet *self,
-    const char *name_buffer, size_t bsize, uint64_t *read_id );
-
-#if NOT_DEFERRED
-/* GetReadLength
- *  this API bothers me, because it has the potential of blowing up the cache
- *  and subverts the guarantee of the readers exclusive use of caches.
- *  Note that by getting a read and its length using the "Data" functions
- *  below, you can get the length as cheaply as you would here, at least in
- *  VDB-2.
- */
-uint64_t VdbBlastRunSetGetReadLength ( const VdbBlastRunSet *self,
-    uint64_t read_id );
-#endif
-
-
-/*------------------------------------------------------------------------------
- * VdbBlast2naReader
- */
-VDB_BLAST_DECLARE ( VdbBlast2naReader );
-
-
-/* Make2naReader
- *  create a reader onto the run set
- *
- *  "status" [ OUT ] - return parameter for status code
- *
- *  "initial_read_id" [ IN ] - starting position for reader
- */
-VDB_EXTERN VdbBlast2naReader* CC VdbBlastRunSetMake2naReader
-    ( const VdbBlastRunSet *self, uint32_t *status, uint64_t initial_read_id );
-
-
-/* AddRef
- *  attach a reference to existing object
- * Release
- *  drop reference to object
- *  deletes object when last reference is gone
- */
-VDB_EXTERN VdbBlast2naReader* CC VdbBlast2naReaderAddRef
-    ( VdbBlast2naReader *self );
-VDB_EXTERN void CC VdbBlast2naReaderRelease ( VdbBlast2naReader *self );
-
-
-/* Read
- *  read a single sequence in packed 2na
- *
- *  "status" [ OUT ] - return parameter for status code
- *
- *  "read_id" [ OUT ] - id of read that was read
- *
- *  "buffer" [ OUT ] and "buffer_size" [ IN ] - externally provided buffer
- *  for single sequence in packed 2na, where buffer_size is in bytes.
- *
- *  returns number of bases read or 0 if no further bases could be read
- */
-VDB_EXTERN uint64_t CC VdbBlast2naReaderRead ( const VdbBlast2naReader *self,
-    uint32_t *status, uint64_t *read_id,
-    uint8_t *buffer, size_t buffer_size );
-
-
-/* Data
- *  read as many sequences as are available
- *
- *  "status" [ OUT ] - return parameter for status code
- *
- *  "buffer" [ OUT ] and "buffer_len" [ IN ] - externally provided buffer
- *  for biological read sequences
- *
- *  returns number of sequences available in "buffer"
- *  or 0 if nothing could be read
- */
-typedef struct Packed2naRead Packed2naRead;
-struct Packed2naRead
-{
-    uint64_t read_id;
-    void *starting_byte;
-    uint32_t offset_to_first_bit;
-    uint32_t length_in_bases;
-};
-
-VDB_EXTERN uint32_t CC VdbBlast2naReaderData ( VdbBlast2naReader *self,
-    uint32_t *status, Packed2naRead *buffer, uint32_t buffer_length );
-
-
-/*------------------------------------------------------------------------------
- * VdbBlast4naReader
- */
-VDB_BLAST_DECLARE ( VdbBlast4naReader );
-
-
-/* Make4naReader
- *  create a reader onto the run set
- *
- *  "status" [ OUT ] - return parameter for status code
- */
-VDB_EXTERN VdbBlast4naReader* CC VdbBlastRunSetMake4naReader
-    ( const VdbBlastRunSet *self, uint32_t *status );
-
-
-/* AddRef
- *  attach a reference to existing object
- * Release
- *  drop reference to object
- *  deletes object when last reference is gone
- */
-VDB_EXTERN VdbBlast4naReader* CC VdbBlast4naReaderAddRef
-    ( VdbBlast4naReader *self );
-VDB_EXTERN void CC VdbBlast4naReaderRelease ( VdbBlast4naReader *self );
-
-
-/* Read
- *  read a single sequence in unpacked, std 4na
- *
- *  "status" [ OUT ] - return parameter for status code
- *
- *  "read_id" [ IN ] - id of read to be read
- *
- *  "starting_base" [ IN ] - zero-based starting index into the sequence
- *
- *  "buffer" [ OUT ] and "buffer_len" [ IN ] - externally provided buffer
- *  for single sequence in unpacked 4na
- *
- *  returns number of bases read or 0 if no further bases could be read
- */
-VDB_EXTERN size_t CC VdbBlast4naReaderRead ( const VdbBlast4naReader *self,
-    uint32_t *status, uint64_t read_id, size_t starting_base,
-    uint8_t *buffer, size_t buffer_length );
-
-
-/* Data
- *  access cached data
- *
- *  "status" [ OUT ] - return parameter for status code
- *
- *  "read_id" [ IN ] - id of read to be accessed
- *
- *  "length" [ OUT ] - return parameter for sequence length
- *
- *  returns pointer to data or NULL upon error
- */
-VDB_EXTERN const uint8_t* CC VdbBlast4naReaderData
-    ( const VdbBlast4naReader *self,
-      uint32_t *status, uint64_t read_id, size_t *length );
-
-
-/*------------------------------------------------------------------------------
- * VdbBlastStdaaReader
- */
-VDB_BLAST_DECLARE ( VdbBlastStdaaReader );
-
-
-/* MakeStdaaReader
- *  create a reader onto the run set
- */
-VDB_EXTERN VdbBlastStdaaReader* CC VdbBlastRunSetMakeStdaaReader
-    ( const VdbBlastRunSet *self, uint32_t *status );
-
-
-/* AddRef
- *  attach a reference to existing object
- * Release
- *  drop reference to object
- *  deletes object when last reference is gone
- */
-VDB_EXTERN VdbBlastStdaaReader* CC VdbBlastStdaaReaderAddRef
-    ( VdbBlastStdaaReader *self );
-VDB_EXTERN void CC VdbBlastStdaaReaderRelease ( VdbBlastStdaaReader *self );
-
-
-/* Read
- *  read a single sequence in stdaa
- *
- *  "status" [ OUT ] - return parameter for status code
- *
- *  "pig" [ IN ] - protein id
- *
- *  "buffer" [ OUT ] and "buffer_len" [ IN ] - externally provided buffer
- *  for single sequence in unpacked Stdaa
- *
- *  returns number of residues read or 0 upon error
- */
-VDB_EXTERN size_t CC VdbBlastStdaaReaderRead ( const VdbBlastStdaaReader *self,
-    uint32_t *status, uint64_t pig, uint8_t *buffer, size_t buffer_length );
-
-
-/* Data
- *  access cached data
- *
- *  "status" [ OUT ] - return parameter for status code
- *
- *  "length" [ OUT ] - return parameter for sequence length
- *
- *  returns pointer to data or NULL upon error
- */
-VDB_EXTERN const uint8_t* CC VdbBlastStdaaReaderData
-    ( const VdbBlastStdaaReader *self,
-      uint32_t *status, uint64_t pig, size_t *length );
-
-
-/* FUNCTIONS TO CONTROL VDB-LIBRARIES LOG GENERATION */
-
-/* KLogLevelSet
- * set log level of VDB-libraries
- *
- * returns status code
- */
-VDB_EXTERN uint32_t CC VdbBlastMgrKLogLevelSetInfo ( const VdbBlastMgr *self );
-VDB_EXTERN uint32_t CC VdbBlastMgrKLogLevelSetWarn ( const VdbBlastMgr *self );
-
-/* for level description see klib/log.h */
-VDB_EXTERN uint32_t CC VdbBlastMgrKLogLevelSet ( const VdbBlastMgr *self,
-    uint32_t level );
-
-VDB_EXTERN void CC VdbBlastMgrKStsLevelSet ( const VdbBlastMgr *self,
-    uint32_t level );
-
-/* KLogHandlerSet, KLogLibHandlerSet, KStsHandlerSet, KOutHandlerSet
- * set logging output handlers for different channels
- *
- * returns status code
- */
-VDB_EXTERN uint32_t CC VdbBlastMgrKLogHandlerSetStdOut
-    ( const VdbBlastMgr *self );
-VDB_EXTERN uint32_t CC VdbBlastMgrKLogLibHandlerSetStdOut
-    ( const VdbBlastMgr *self );
-VDB_EXTERN uint32_t CC VdbBlastMgrKStsHandlerSetStdOut
-    ( const VdbBlastMgr *self );
-VDB_EXTERN uint32_t CC VdbBlastMgrKOutHandlerSetStdOut
-    ( const VdbBlastMgr *self );
-
-VDB_EXTERN uint32_t CC VdbBlastMgrKLogHandlerSetStdErr
-    ( const VdbBlastMgr *self );
-VDB_EXTERN uint32_t CC VdbBlastMgrKLogLibHandlerSetStdErr
-    ( const VdbBlastMgr *self );
-VDB_EXTERN uint32_t CC VdbBlastMgrKStsHandlerSetStdErr
-    ( const VdbBlastMgr *self );
-VDB_EXTERN uint32_t CC VdbBlastMgrKOutHandlerSetStdErr
-    ( const VdbBlastMgr *self );
-
-
-/*  upon success, the writer will return code 0 */
-typedef uint32_t ( CC * VdbBlastKWrtWriter )
-    ( void * self, const char * buffer, size_t bufsize, size_t * num_writ );
-
-VDB_EXTERN uint32_t CC VdbBlastMgrKLogHandlerSet ( const VdbBlastMgr *self,
-    VdbBlastKWrtWriter writer, void *data );
-VDB_EXTERN uint32_t CC VdbBlastMgrKLogLibHandlerSet ( const VdbBlastMgr *self,
-    VdbBlastKWrtWriter writer, void *data );
-VDB_EXTERN uint32_t CC VdbBlastMgrKOutHandlerSet ( const VdbBlastMgr *self,
-    VdbBlastKWrtWriter writer, void *data );
-
-
-/* KDbgSetString 
- * set a string used to turn on debug messages
- *
- * returns status code
- */
-VDB_EXTERN uint32_t CC VdbBlastMgrKDbgSetString ( const VdbBlastMgr *self,
-    const char *string );
-
-/* KConfigPrint
- * print current configuration to the output handler
- *
- * returns status code
- */
-VDB_EXTERN uint32_t VdbBlastMgrKConfigPrint ( const VdbBlastMgr *self );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_ncbi_vdb_blast_ */
diff --git a/interfaces/ncbi/wgs-contig.h b/interfaces/ncbi/wgs-contig.h
deleted file mode 100644
index cc547be..0000000
--- a/interfaces/ncbi/wgs-contig.h
+++ /dev/null
@@ -1,183 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_ncbi_wgs_contig_
-#define _h_ncbi_wgs_contig_
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*==========================================================================
- * WGS Contig
- */
-
-
-/*--------------------------------------------------------------------------
- * types
- * constants
- */
-
-/* component_props
- *  a signed value describing either contigs or gaps
- *  where values >= 0 refer to contigs
- *  and negatives describe gaps
- */
-typedef int16_t NCBI_WGS_component_props;
-
-/* component description
- *  the sequencing status of the component
- *
- *  These typically correspond to keywords in the INSDC submission.
- *  Current acceptable values are_
- *    A           Active Finishing
- *    D           Draft HTG (often phase1 and phase2 are called Draft,
- *                whether or not they have the draft keyword).
- *    F           Finished HTG (phase3)
- *    G           Whole Genome Finishing
- *    O           Other sequence (typically means no HTG keyword)
- *    P           Pre Draft
- *    W           WGS contig
- */
-enum
-{
-    NCBI_WGS_component_WGS                  = 0,
-    NCBI_WGS_component_ActiveFinishing      = 1,
-    NCBI_WGS_component_DraftHTG             = 2,
-    NCBI_WGS_component_FinishedHTG          = 3,
-    NCBI_WGS_component_WholeGenomeFinishing = 4,
-    NCBI_WGS_component_OtherSequence        = 5,
-    NCBI_WGS_component_PreDraft             = 6
-};
-
-/* strand
- *  specifies the orientation of the component relative to scaffold
- *  values given allow strand to be determined as "prop / 16"
- *  yielding_
- *    0           unknown orientation
- *    1           plus strand
- *    2           negative strand
- */
-enum
-{
-    NCBI_WGS_strand_plus                    = 1 * 16,
-    NCBI_WGS_strand_minus                   = 2 * 16
-};
-
-
-/* gap description
- *  These typically correspond to keywords in the INSDC submission.
- *  Current acceptable values are_
- *    N           gap with specified size
- *    U           gap of unknown size, defaulting to 100 bases.
- */
-enum
-{
-    NCBI_WGS_gap_known                      = 1 * -1,
-    NCBI_WGS_gap_unknown                    = 2 * -1
-};
-
-/* gap_linkage
- * Describes linkage and linkage evidence
- */
-typedef int32_t NCBI_WGS_gap_linkage;
-
-/* gap type
- *  scaffold          a gap between two sequence contigs in a scaffold
- *  contig            an unspanned gap between two sequence contigs
- *  centromere        a gap inserted for the centromere
- *  short_arm         a gap inserted at the start of an acrocentric chromosome
- *  heterochromatin   a gap inserted for an especially large region of heterochromatic sequence
- *  telomere          a gap inserted for the telomere
- *  repeat            an unresolvable repeat
- */
-enum
-{
-    NCBI_WGS_gap_scaffold                   = 1 * -4,
-    NCBI_WGS_gap_contig                     = 2 * -4,
-    NCBI_WGS_gap_centromere                 = 3 * -4,
-    NCBI_WGS_gap_short_arm                  = 4 * -4,
-    NCBI_WGS_gap_heterochromatin            = 5 * -4,
-    NCBI_WGS_gap_telomere                   = 6 * -4,
-    NCBI_WGS_gap_repeat                     = 7 * -4
-};
-
-/* gap linkage evidence
- *  paired-ends       paired sequences from the two ends of a DNA fragment
- *  align_genus       alignment to a reference genome within the same genus
- *  align_xgenus      alignment to a reference genome within another genus
- *  align_trnscpt     alignment to a transcript from the same species
- *  within_clone      sequence on both sides of the gap is derived from
- *                    the same clone, but the gap is not spanned by paired-ends
- *  clone_contig      linkage is provided by a clone contig in the tiling path
- *  map               linkage asserted using a non-sequence based map
- *                    such as RH, linkage, fingerprint or optical
- *  strobe            strobe sequencing (PacBio)
- *  unspecified
- */
-enum
-{
-    NCBI_WGS_gap_linkage_linked                      = 1,
-    NCBI_WGS_gap_linkage_evidence_paired_ends        = 2,
-    NCBI_WGS_gap_linkage_evidence_align_genus        = 4,
-    NCBI_WGS_gap_linkage_evidence_align_xgenus       = 8,
-    NCBI_WGS_gap_linkage_evidence_align_trnscpt      = 16,
-    NCBI_WGS_gap_linkage_evidence_within_clone       = 32,
-    NCBI_WGS_gap_linkage_evidence_clone_contig       = 64,
-    NCBI_WGS_gap_linkage_evidence_map                = 128,
-    NCBI_WGS_gap_linkage_evidence_strobe             = 256,
-    NCBI_WGS_gap_linkage_evidence_unspecified        = 512,
-    NCBI_WGS_gap_linkage_evidence_pcr                = 1024
-};
-
-
-/*--------------------------------------------------------------------------
- * accession tokenization constants
- */
-
-/* tokenize_nuc_accession
- * tokenize_prot_accession
- *  scans name on input
- *  tokenizes into parts
- */
-enum
-{
-    NCBI_WGS_acc_token_unrecognized =  1,
-    NCBI_WGS_acc_token_prefix       =  2,
-    NCBI_WGS_acc_token_contig       =  3
-};
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_ncbi_wgs_contig_ */
diff --git a/interfaces/ncbi/wgs-contig.vschema b/interfaces/ncbi/wgs-contig.vschema
deleted file mode 100644
index 2793aaa..0000000
--- a/interfaces/ncbi/wgs-contig.vschema
+++ /dev/null
@@ -1,695 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/*==========================================================================
- * WGS Contig
- */
-version 1;
-
-include 'vdb/vdb.vschema';
-include 'ncbi/ncbi.vschema';
-include 'ncbi/seq.vschema';
-include 'ncbi/spotname.vschema';
-include 'ncbi/stats.vschema';
-
-
-/*--------------------------------------------------------------------------
- * types
- * constants
- */
-
-/* component_props
- *  a signed value describing contig or gap components of scaffolds, or
- *  gaps in contig sequences.
- *  Positive values refer to contigs and negatives describe gaps
- */
-typedef I16 NCBI:WGS:component_props;
-
-/* component description
- *  the sequencing status of the component
- *
- *  These typically correspond to keywords in the INSDC submission.
- *  Current acceptable values are:
- *    A           Active Finishing
- *    D           Draft HTG (often phase1 and phase2 are called Draft,
- *                whether or not they have the draft keyword).
- *    F           Finished HTG (phase3)
- *    G           Whole Genome Finishing
- *    O           Other sequence (typically means no HTG keyword)
- *    P           Pre Draft
- *    W           WGS contig
- */
-const NCBI:WGS:component_props NCBI:WGS:component:WGS                  = 0;
-const NCBI:WGS:component_props NCBI:WGS:component:ActiveFinishing      = 1;
-const NCBI:WGS:component_props NCBI:WGS:component:DraftHTG             = 2;
-const NCBI:WGS:component_props NCBI:WGS:component:FinishedHTG          = 3;
-const NCBI:WGS:component_props NCBI:WGS:component:WholeGenomeFinishing = 4;
-const NCBI:WGS:component_props NCBI:WGS:component:OtherSequence        = 5;
-const NCBI:WGS:component_props NCBI:WGS:component:PreDraft             = 6;
-
-/* strand
- *  specifies the orientation of the component relative to scaffold
- *  values given allow strand to be determined as "prop / 16"
- *  yielding:
- *    0           unknown orientation
- *    1           plus strand
- *    2           negative strand
- */
-const NCBI:WGS:component_props NCBI:WGS:strand:plus                    = 16;
-const NCBI:WGS:component_props NCBI:WGS:strand:minus                   = 32;
-
-
-/* gap description
- *  These typically correspond to keywords in the INSDC submission.
- *  Current acceptable values are:
- *    N           gap with specified size
- *    U           gap of unknown size, defaulting to 100 bases.
- */
-const NCBI:WGS:component_props NCBI:WGS:gap:known                      = -1;
-const NCBI:WGS:component_props NCBI:WGS:gap:unknown                    = -2;
-
-/* gap type
- *  scaffold          a gap between two sequence contigs in a scaffold
- *  contig            an unspanned gap between two sequence contigs
- *  centromere        a gap inserted for the centromere
- *  short_arm         a gap inserted at the start of an acrocentric chromosome
- *  heterochromatin   a gap inserted for an especially large region of heterochromatic sequence
- *  telomere          a gap inserted for the telomere
- *  repeat            an unresolvable repeat
- */
-const NCBI:WGS:component_props NCBI:WGS:gap:scaffold                   = -4;
-const NCBI:WGS:component_props NCBI:WGS:gap:contig                     = -8;
-const NCBI:WGS:component_props NCBI:WGS:gap:centromere                 = -12;
-const NCBI:WGS:component_props NCBI:WGS:gap:short_arm                  = -16;
-const NCBI:WGS:component_props NCBI:WGS:gap:heterochromatin            = -20;
-const NCBI:WGS:component_props NCBI:WGS:gap:telomere                   = -24;
-const NCBI:WGS:component_props NCBI:WGS:gap:repeat                     = -28;
-
-/* gap_linkage
- */
-typedef I32 NCBI:WGS:gap_linkage;
-
-/* gap linkage and linkage evidence 
- * There can be multiple linkage evidences or linkage with no evidence
- * 
- *  paired-ends       paired sequences from the two ends of a DNA fragment
- *  align_genus       alignment to a reference genome within the same genus
- *  align_xgenus      alignment to a reference genome within another genus
- *  align_trnscpt     alignment to a transcript from the same species
- *  within_clone      sequence on both sides of the gap is derived from
- *                    the same clone, but the gap is not spanned by paired-ends
- *  clone_contig      linkage is provided by a clone contig in the tiling path
- *  map               linkage asserted using a non-sequence based map
- *                    such as RH, linkage, fingerprint or optical
- *  strobe            strobe sequencing (PacBio)
- *  unspecified
- *  pcr               PCR
- */
-const NCBI:WGS:gap_linkage NCBI:WGS:gap:linkage:linked                 = 1;
-const NCBI:WGS:gap_linkage NCBI:WGS:gap:linkage_evidence:paired_ends   = 2;
-const NCBI:WGS:gap_linkage NCBI:WGS:gap:linkage_evidence:align_genus   = 4;
-const NCBI:WGS:gap_linkage NCBI:WGS:gap:linkage_evidence:align_xgenus  = 8;
-const NCBI:WGS:gap_linkage NCBI:WGS:gap:linkage_evidence:align_trnscpt = 16;
-const NCBI:WGS:gap_linkage NCBI:WGS:gap:linkage_evidence:within_clone  = 32;
-const NCBI:WGS:gap_linkage NCBI:WGS:gap:linkage_evidence:clone_contig  = 64;
-const NCBI:WGS:gap_linkage NCBI:WGS:gap:linkage_evidence:map           = 128;
-const NCBI:WGS:gap_linkage NCBI:WGS:gap:linkage_evidence:strobe        = 256;
-const NCBI:WGS:gap_linkage NCBI:WGS:gap:linkage_evidence:unspecified   = 512;
-const NCBI:WGS:gap_linkage NCBI:WGS:gap:linkage_evidence:pcr           = 1024;
-
-/*--------------------------------------------------------------------------
- * functions
- */
-
-/* tokenize_nuc_accession
- * tokenize_prot_accession
- *  scans name on input
- *  tokenizes into parts
- */
-extern function text:token
-    NCBI:WGS:tokenize_nuc_accession #1 ( ascii acc );
-extern function text:token
-    NCBI:WGS:tokenize_prot_accession #1 ( ascii acc );
-
-const U16 NCBI:WGS:acc_token:unrecognized =  1;
-const U16 NCBI:WGS:acc_token:prefix       =  2;
-const U16 NCBI:WGS:acc_token:contig       =  3;
-
-
-/* build_scaffold_read
- *  assembles contigs and gaps into a single row
- *  transcribes + strand contigs as they are,
- *  performs reverse complement of - strand contigs,
- *  fills gaps with stated number of N
- *
- * build_scaffold_quality
- *  assembles contig and gap qualities into a single row
- *  contig qualities are taken as they are,
- *  gap qualities are assigned a constant
- *
- *  "component_start" [ DATA ] - starting locations on each
- *   component or 0 for gaps. normal starting point is 0,
- *   but offsets are supported.
- *  NB - ONE-BASED COORDINATES
- *
- *  "component_len" [ DATA ] - length of contig sequence
- *   from component_start, or length of gap, projected onto
- *   scaffold at scaffold_start.
- *
- *  "component_props" [ DATA ] - see discussion of type
- *   distinguish between contigs and gaps, indicate strand
- *
- *  "component_id" [ DATA ] - foreign keys into SEQUENCE table
- *   row_len ( component_id ) == count-of-contigs ( component_props )
- */
-extern function INSDC:4na:bin NCBI:WGS:build_scaffold_read #1
-    ( INSDC:coord:one component_start, INSDC:coord:len component_len,
-      NCBI:WGS:component_props component_props, I64 component_id );
-
-extern function INSDC:quality:phred NCBI:WGS:build_scaffold_qual #1
-    ( INSDC:coord:one component_start, INSDC:coord:len component_len,
-      NCBI:WGS:component_props component_props, I64 component_id );
-
-
-/* build_read_type
- *  generate standard SRA read type from component properties
- *  contigs are biological, gaps are technical
- *
- *  "component_props" [ DATA ] - see discussion of type
- *   distinguish between contigs and gaps, indicate strand
- */
-extern function INSDC:SRA:xread_type
-    NCBI:WGS:build_read_type #1 ( NCBI:WGS:component_props component_props );
-
-
-/*--------------------------------------------------------------------------
- * nucleotide
- */
-table NCBI:WGS:tbl:nucleotide #1.1
-    = NCBI:tbl:base_space #2.0.3
-    , NCBI:tbl:phred_quality #2.0.4
-    , NCBI:SRA:tbl:stats #1.2.0
-{
-    /* ACCESSION
-     *  [<opt-prefix>]<4-letter-prefix><2-digit-version><6-or-7-digit-contig>
-     */
-    extern column ascii ACCESSION = out_accession;
-    extern column U32   ACC_VERSION = .ACC_VERSION | <U32> echo <1> ();
-
-    // input
-    ascii in_accession = ACCESSION;
-
-    // parsed input
-    text:token in_acc_token
-        = NCBI:WGS:tokenize_nuc_accession ( in_accession );
-    //  [<opt-prefix>]<4-letter-prefix><2-digit-version>
-    ascii in_acc_prefix
-        = extract_token < 0 > ( in_accession, in_acc_token );
-    // <6-or-7-digit-contig>
-    ascii in_contig_text
-        = extract_token < 1 > ( in_accession, in_acc_token );
-    U32 in_contig_len
-        = row_len ( in_contig_text );
-    U64 in_contig_bin
-        = strtonum ( in_contig_text );
-
-    // physical storage
-    physical column < ascii > zip_encoding .ACC_PREFIX = in_acc_prefix;
-    physical column < U32 > izip_encoding .ACC_CONTIG_LEN = in_contig_len;
-    physical column < U64 > izip_encoding .ACC_CONTIG = in_contig_bin;
-    physical column < U32 > izip_encoding .ACC_VERSION = ACC_VERSION; //needed to back-fill WGS data from ID where version may be > 1
-
-    // output
-    ascii out_acc_prefix
-        = .ACC_PREFIX
-        | < ascii > meta:read < 'ACC_PREFIX', true > ()
-        ;
-    U32 out_acc_contig_len
-        = .ACC_CONTIG_LEN
-        | < U32 > meta:value < 'ACC_CONTIG_LEN', true > ()
-        ;
-    U64 out_acc_contig
-        = .ACC_CONTIG
-        | ( U64 ) row_id ()
-        ;
-    ascii out_accession
-        = sprintf < "%s%0*u" > ( out_acc_prefix, out_acc_contig_len, out_acc_contig );
-
-    readonly column ascii ACC_PREFIX
-        = .ACC_PREFIX
-        | < ascii > meta:read < 'ACC_PREFIX', true > ()
-        ;
-    readonly column U32 ACC_CONTIG_LEN
-        = .ACC_CONTIG_LEN
-        | < U32 > meta:value < 'ACC_CONTIG_LEN', true > ()
-        ;
-
-    /* CONTIG_NAME
-     *  principal name
-     */
-    extern column utf8 CONTIG_NAME
-        = idx:text:project < 'contig_name' > ( .CONTIG_NAME );
-
-    physical column < utf8 > zip_encoding .CONTIG_NAME
-        = idx:text:insert < 'contig_name' > ( CONTIG_NAME );
-
-    ascii out_contig_name = cast ( CONTIG_NAME );
-
-    // NB - this is only useful if CONTIG_NAME is unique
-    // or if clustered by CONTIG_NAME
-    readonly column vdb:row_id_range CONTIG_NAME_ROW_RANGE
-        = idx:text:lookup < 'contig_name', 'NAME_QUERY' > ();
-
-    /* EXTRA_SEQIDS
-     *  pipe-separated list of additional names
-     */
-    extern column < ascii > zip_encoding EXTRA_SEQIDS;
-
-    /* TITLE
-     */
-    extern column < ascii > zip_encoding TITLE;
-
-    /* GI
-     *  gi is indexed in a parallel table
-     */
-    extern column < NCBI:gi > izip_encoding GI;
-
-    /* TAXID
-     *  taxonomy id
-     */
-    extern column < NCBI:taxid > izip_encoding TAXID;
-
-    /* GB_STATE
-     *  genbank state
-     */
-    extern column < NCBI:gb_state > izip_encoding GB_STATE;
-
-    /* DESCR
-     *  ASN.1 description
-     */
-    extern column < NCBI:asn:binary > zip_encoding DESCR;
-
-    /* ANNOT
-     *  ASN.1 annotation
-     */
-    extern column < NCBI:asn:binary > zip_encoding ANNOT;
-
-    /* GAP_START
-     *  Starting position of a gap
-     */
-    extern column < INSDC:coord:zero > izip_encoding GAP_START;
-
-    /* GAP_LEN
-     *  Length of a gap
-     */
-    extern column < INSDC:coord:len > izip_encoding GAP_LEN;
-
-    /* GAP_PROPS
-     *  See description of type
-     */
-    extern column < NCBI:WGS:component_props > zip_encoding GAP_PROPS;
-
-    /* GAP_LINKAGE
-     *  See description of type
-     */
-    extern column < NCBI:WGS:gap_linkage> zip_encoding GAP_LINKAGE;
-
-
-    ascii out_seqid_gi = sprintf < "gi|%u" > ( .GI );
-    ascii out_seqid_gb = sprintf < "gb|%s.%u|" > ( out_accession, ACC_VERSION )
-                       | sprintf < "gb|%s.1|" > ( out_accession );
-    ascii out_seqid_gnl = sprintf < "gnl|WGS:%s|%s" > (.ACC_PREFIX, out_contig_name ) | <ascii> echo < '' > ();
-
-
-    /* outputs to spotname */
-    ascii out_seqid_name
-        = sprintf < "%s|%s" > ( out_seqid_gi , out_seqid_gb )
-		| sprintf < "%s" > ( out_seqid_gb );
-
-    ascii out_spot_name = sprintf < "%s %s" > ( out_seqid_name, .TITLE );
-
-    readonly column ascii SEQ_ID = out_seqid_name;
-    readonly column ascii SEQ_ID_GNL = out_seqid_gnl;
-
-    /* outputs to spotdesc */
-    // INSDC:coord:len in_read_len  = (INSDC:coord:len) row_len ( in_2na_bin );
-    INSDC:coord:len  out_read_len = (INSDC:coord:len) row_len ( out_2na_bin );
-    INSDC:coord:len  trim_len = (INSDC:coord:len) row_len ( out_2na_bin );
-    INSDC:coord:zero out_read_start = <INSDC:coord:zero> echo < 0 > ();
-    INSDC:coord:zero trim_start = <INSDC:coord:zero> echo < 0 > ();
-    INSDC:SRA:read_filter out_rd_filter = < INSDC:SRA:read_filter > echo < SRA_READ_FILTER_PASS > ();
-    INSDC:SRA:xread_type  out_read_type = < INSDC:SRA:xread_type > echo < SRA_READ_TYPE_BIOLOGICAL > ();
-    // help trigger statistics
-    INSDC:SRA:xread_type  _alt_in_read_type = < INSDC:SRA:xread_type > echo < SRA_READ_TYPE_BIOLOGICAL > ();
-    INSDC:coord:len       _alt_in_read_len  = (INSDC:coord:len) row_len ( in_2na_bin );
-
-    ascii out_label = < ascii > echo < "contig" > ();
-    INSDC:coord:len out_label_len = < INSDC:coord:len > echo < 6 > ();
-    INSDC:coord:zero out_label_start = < INSDC:coord:zero > echo < 0 > ();
-
-    INSDC:SRA:platform_id out_platform = < INSDC:SRA:platform_id > echo < SRA_PLATFORM_UNDEFINED > ();
-};
-
-
-/*--------------------------------------------------------------------------
- * protein
- *  contig
- */
-table NCBI:WGS:tbl:protein #1
-    = NCBI:tbl:protein #1.0.0
-{
-    /* ACCESSION
-     *  [<opt-prefix>]<4-letter-prefix><2-digit-version><6-or-7-digit-contig>
-     */
-    extern column ascii ACCESSION = out_accession;
-
-    // input
-    ascii in_accession = ACCESSION;
-
-    // parsed input
-    text:token in_acc_token
-        = NCBI:WGS:tokenize_prot_accession ( in_accession );
-    //  [<opt-prefix>]<4-letter-prefix><2-digit-version>
-    ascii in_acc_prefix
-        = extract_token < 0 > ( in_accession, in_acc_token );
-    // <6-or-7-digit-contig>
-    ascii in_contig_text
-        = extract_token < 1 > ( in_accession, in_acc_token );
-    U32 in_contig_len
-        = row_len ( in_contig_text );
-    I64 in_contig_bin
-        = strtonum ( in_contig_text );
-
-    // physical storage
-    physical column < ascii > zip_encoding .ACC_PREFIX = in_acc_prefix;
-    physical column < U32 > izip_encoding .ACC_CONTIG_LEN = in_contig_len;
-    physical column < U64 > izip_encoding .ACC_CONTIG = in_contig_bin;
-
-    // output
-    ascii out_acc_prefix
-        = .ACC_PREFIX
-        | < ascii > meta:read < 'ACC_PREFIX', true > ()
-        ;
-    U32 out_acc_contig_len
-        = .ACC_CONTIG_LEN
-        | < U32 > meta:value < 'ACC_CONTIG_LEN', true > ()
-        ;
-    U64 out_acc_contig
-        = .ACC_CONTIG
-        | ( U64 ) row_id ()
-        ;
-    ascii out_accession
-        = sprintf < "%s%0*u" > ( out_acc_prefix, out_acc_contig_len, out_acc_contig );
-
-    /* TITLE
-     */
-    extern column < ascii > zip_encoding TITLE;
-
-    /* GI
-     *  gi is indexed in a parallel table
-     */
-    extern column < NCBI:gi > izip_encoding GI;
-
-    /* GB_STATE
-     *  genbank state
-     */
-    extern column < NCBI:gb_state > izip_encoding GB_STATE;
-
-    /* DESCR
-     *  ASN.1 description
-     */
-    extern column < NCBI:asn:binary > zip_encoding DESCR;
-
-    /* ANNOT
-     *  ASN.1 annotation
-     */
-    extern column < NCBI:asn:binary > zip_encoding ANNOT;
-
-    /* outputs to spotname */
-    ascii out_seqid_name = sprintf < "TBD" > ( .ACC_PREFIX, out_accession );
-    ascii out_spot_name = sprintf < "%s %s" > ( out_seqid_name, .TITLE );
-
-    /* TBD
-     *  need to create an extension to NCBI:tbl:protein
-     *  that satisfies fastq-dump requirements for READ and QUALITY
-     */
-};
-
-
-/*--------------------------------------------------------------------------
- * gi_idx
- *  gi is row-id
- */
-table NCBI:WGS:tbl:gi_idx #1
-{
-    /* NUC_ROW_ID
-     *  row-id in nucleotide table
-     */
-    extern column < I64 > izip_encoding NUC_ROW_ID;
-
-    /* PROT_ROW_ID
-     *  row-id in protein table
-     */
-    extern column < I64 > izip_encoding PROT_ROW_ID;
-};
-
-
-/*--------------------------------------------------------------------------
- * scaffold
- *  records AGP data
- */
-table NCBI:WGS:tbl:scaffold #1
-{
-    /* SCAFFOLD_NAME
-     *  This is the identifier for the object being assembled.
-     *  This can be a chromosome, scaffold or contig.
-     *  If an accession.version identifier is not used to describe
-     *  the object the naming convention is to precede chromosome numbers
-     *  (e.g. chr1) and linkage group numbers  (e.g. LG3).
-     *  Contigs or scaffolds may have any identifier that is unique
-     *  within the assembly
-     */
-    extern column utf8 SCAFFOLD_NAME
-        = out_scaffold_name;
-    extern column ascii SCAFFOLD_NAME = cast (out_scaffold_name);
-    utf8 out_scaffold_name
-        = idx:text:project < 'scaffold_name' > ( .SCAFFOLD_NAME );
-    physical column < utf8 > zip_encoding .SCAFFOLD_NAME
-        = idx:text:insert < 'scaffold_name' > ( SCAFFOLD_NAME );
-
-    /* COMPONENT_START
-     *  starting position within the component sequence
-     */
-    extern column < INSDC:coord:one > izip_encoding COMPONENT_START;
-
-    /* COMPONENT_LEN
-     *  length of the component/gap projected onto the scaffold
-     */
-    extern column < INSDC:coord:len > izip_encoding COMPONENT_LEN;
-
-    /* COMPONENT_PROPS
-     *  see description of type
-     */
-    extern column < NCBI:WGS:component_props > zip_encoding COMPONENT_PROPS;
-
-    /* COMPONENT_ID
-     *  one row-id for each non-gap component
-     */
-    extern column < I64 > izip_encoding COMPONENT_ID;
-
-    /* COMPONENT_LINKAGE
-     *  see description of type
-     *  one row-id for each gap component
-     */
-    extern column < NCBI:WGS:gap_linkage > zip_encoding COMPONENT_LINKAGE;
-}
-
-table NCBI:WGS:view:scaffold #1 = NCBI:WGS:tbl:scaffold #1
-{
-    /* ACCESSION
-     *  scaffold accession
-     */
-    readonly column ascii ACCESSION
-        = out_accession;
-    I64 scaffold_row_id
-        = row_id ();
-    I64 acc_row_id
-        = < I64 > echo < 1 > ();
-    ascii acc_prefix
-        = < ascii > simple_sub_select < 'SEQUENCE', 'ACC_PREFIX' > ( acc_row_id );
-    U32 acc_contig_len
-        = < U32 > simple_sub_select < 'SEQUENCE', 'ACC_CONTIG_LEN' > ( acc_row_id );
-    ascii out_accession
-        = sprintf < "%sS%0*d" > ( acc_prefix, acc_contig_len, scaffold_row_id );
-
-    /* READ
-     *  base space construction of entire scaffold
-     */
-
-    // construct the read from contigs and gaps
-    INSDC:4na:bin out_4na_bin = NCBI:WGS:build_scaffold_read
-        ( .COMPONENT_START, .COMPONENT_LEN, .COMPONENT_PROPS, .COMPONENT_ID );
-
-    // various READ columns
-    default readonly column INSDC:dna:text READ
-        = < INSDC:4na:bin, INSDC:dna:text > map < INSDC:4na:map:BINSET, INSDC:4na:map:CHARSET > ( out_4na_bin );
-    readonly column INSDC:4na:bin READ
-        = out_4na_bin;
-    readonly column INSDC:4na:packed READ
-        = pack ( out_4na_bin );
-    readonly column INSDC:x2na:bin READ
-        = out_x2na_bin;
-    INSDC:x2na:bin out_x2na_bin
-        = < INSDC:4na:bin, INSDC:x2na:bin > map < INSDC:4na:map:BINSET, [ 4,0,1,4,2,4,4,4,3,4,4,4,4,4,4,4 ] > ( out_4na_bin );
-    readonly column INSDC:2na:bin READ
-        = out_2na_bin;
-    INSDC:2na:bin out_2na_bin
-        = < INSDC:x2na:bin, INSDC:2na:bin > map < INSDC:x2na:map:BINSET, [ 0, 1, 2, 3, 0 ] > ( out_x2na_bin );
-    readonly column INSDC:2na:packed READ
-        = pack ( out_2na_bin );
-
-
-    /* CSREAD
-     *  base space converted to color space
-     */
-    default readonly column INSDC:color:text CSREAD
-        = < INSDC:x2cs:bin, INSDC:color:text > map <  INSDC:x2cs:map:BINSET, INSDC:x2cs:map:CHARSET > ( out_x2cs_bin );
-    readonly column INSDC:x2cs:bin CSREAD
-        = out_x2cs_bin;
-    INSDC:x2cs:bin out_x2cs_bin
-        = NCBI:color_from_dna ( out_x2na_bin, out_read_start, .COMPONENT_LEN, out_cs_key, out_color_matrix );
-    readonly column INSDC:2cs:bin CSREAD
-        = out_2cs_bin;
-    INSDC:2cs:bin out_2cs_bin
-        = < INSDC:x2cs:bin, INSDC:2cs:bin > map < INSDC:x2cs:map:BINSET, [ 0, 1, 2, 3, 0 ] > ( out_x2cs_bin );
-    readonly column INSDC:2cs:packed CSREAD
-        = pack ( out_2cs_bin );
-
-    /* CS_NATIVE
-     *  is color-space the native sequence space
-     */
-    readonly column bool CS_NATIVE
-        = < bool > echo < false > ();
-
-    /* CS_KEY
-     *  leading call given in base-space
-     */
-    readonly column INSDC:dna:text CS_KEY
-        = out_cs_key;
-    INSDC:dna:text out_cs_key
-        = < INSDC:dna:text > echo < 'T' > ( .COMPONENT_LEN );
-
-    /* COLOR_MATRIX
-     *  matrix used for color-space conversions
-     */
-    readonly column U8 COLOR_MATRIX
-        = out_color_matrix;
-    U8 out_color_matrix
-        = < U8 > echo < INSDC:color:default_matrix > ();
-
-
-    /* QUALITY
-     *  base or color call qualities
-     */
-    INSDC:quality:phred out_qual_phred = NCBI:WGS:build_scaffold_qual
-        ( .COMPONENT_START, .COMPONENT_LEN, .COMPONENT_PROPS, .COMPONENT_ID );
-
-    // PHRED is default
-    default readonly column INSDC:quality:phred QUALITY
-        = out_qual_phred;
-
-    // textual encodings
-    readonly column INSDC:quality:text:phred_33 QUALITY
-        = ( INSDC:quality:text:phred_33 ) < B8 > sum < 33 > ( out_qual_phred );
-    readonly column INSDC:quality:text:phred_64 QUALITY
-        = ( INSDC:quality:text:phred_64 ) < B8 > sum < 64 > ( out_qual_phred );
-
-
-    /* PLATFORM
-     *  sequencing platform, if known
-     */
-    INSDC:SRA:platform_id out_platform
-        = < INSDC:SRA:platform_id > echo < SRA_PLATFORM_UNDEFINED > ();
-    readonly column INSDC:SRA:platform_id PLATFORM
-        = out_platform;
-
-    /* SPOT_ID
-     *  support for libsra
-     */
-    INSDC:SRA:spotid_t out_spot_id
-        = cast ( scaffold_row_id );
-    readonly column INSDC:SRA:spotid_t SPOT_ID
-        = out_spot_id;
-
-    /* NAME
-     *  spot name
-     */
-    readonly column ascii NAME
-        = out_scaffold_name;
-
-    /* SPOT_LEN
-     * TRIM_START
-     * TRIM_LEN
-     *  spot descriptor
-     */
-    readonly column INSDC:coord:len SPOT_LEN
-        = out_spot_len;
-    INSDC:coord:len out_spot_len
-        = < INSDC:coord:len > vec_sum ( .COMPONENT_LEN );
-    readonly column INSDC:coord:zero TRIM_START
-        = < INSDC:coord:zero > echo < 0 > ();
-    readonly column INSDC:coord:len TRIM_LEN
-        = out_spot_len;
-
-
-    /* READ_START
-     * READ_LEN
-     * READ_TYPE
-     *  read descriptor portion
-     */
-    readonly column INSDC:coord:zero READ_START
-        = out_read_start;
-    INSDC:coord:zero out_read_start
-        = ( INSDC:coord:zero ) < U32 > integral ( .COMPONENT_LEN );
-    readonly column INSDC:coord:len READ_LEN
-        = .COMPONENT_LEN;
-    readonly column INSDC:SRA:xread_type READ_TYPE
-        = out_read_type;
-    INSDC:SRA:xread_type out_read_type
-        = NCBI:WGS:build_read_type ( .COMPONENT_PROPS );
-}
-
-
-/*--------------------------------------------------------------------------
- * contig
- */
-database NCBI:WGS:db:contig #1.1
-{
-    table NCBI:WGS:tbl:nucleotide SEQUENCE;
-    table NCBI:WGS:tbl:protein PROTEIN;
-    table NCBI:WGS:tbl:gi_idx GI_IDX;
-    table NCBI:WGS:view:scaffold SCAFFOLD;
-};
diff --git a/interfaces/os/linux/os-native.h b/interfaces/os/linux/os-native.h
deleted file mode 100644
index 7dc63e8..0000000
--- a/interfaces/os/linux/os-native.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_os_native_
-#define _h_os_native_
-
-#ifndef _h_unix_native_
-#include "../unix/unix-native.h"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_os_native_ */
diff --git a/interfaces/os/mac/byteswap.h b/interfaces/os/mac/byteswap.h
deleted file mode 100644
index 172fd8b..0000000
--- a/interfaces/os/mac/byteswap.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_mac_byteswap_
-#define _h_mac_byteswap_
-
-#include <architecture/byte_order.h>
-
-/* make these look the same as on Linux
-   use the lower-level Mac routines, as
-   they are specific in their data types */
-#define bswap_16(x) OSSwapInt16 (x)
-#define bswap_32(x) OSSwapInt32 (x)
-#define bswap_64(x) OSSwapInt64 (x)
-
-#endif /* _h_mac_byteswap_ */
diff --git a/interfaces/os/mac/endian.h b/interfaces/os/mac/endian.h
deleted file mode 100644
index 367e1f0..0000000
--- a/interfaces/os/mac/endian.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_mac_endian_
-#define _h_mac_endian_
-
-#include <machine/endian.h>
-
-#define __LITTLE_ENDIAN   LITTLE_ENDIAN
-#define __BIG_ENDIAN      BIG_ENDIAN
-#define __PDP_ENDIAN      PDP_ENDIAN
-
-#define __BYTE_ORDER      BYTE_ORDER
-
-
-#endif /* _h_mac_endian_ */
diff --git a/interfaces/os/mac/os-native.h b/interfaces/os/mac/os-native.h
deleted file mode 100644
index 3e26ff5..0000000
--- a/interfaces/os/mac/os-native.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_os_native_
-#define _h_os_native_
-
-#ifndef _h_unix_native_
-#include "../unix/unix-native.h"
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * strdup - declared unless _ANSI_SOURCE is defined - redeclare anyway
- * strndup - implemented inline here
- */
-char *strdup ( const char *str );
-
-#if !defined(__MAC_10_6) || (__MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_6)
-static __inline__
-char *strndup ( const char *str, size_t n )
-{
-    char *dupstr;
-
-    const char *end = ( const char* ) memchr ( str, 0, n );
-    if ( end != NULL )
-        n = end - str;
-
-    dupstr = (char*)malloc ( n + 1 );
-    if ( dupstr != NULL )
-    {
-        memcpy ( dupstr, str, n );
-        dupstr [ n ] = 0;
-    }
-
-    return dupstr;
-}
-#endif
-
-/*--------------------------------------------------------------------------
- * strchrnul - implemented inline here
- */
-static __inline__
-char *strchrnul ( const char *str, int c )
-{
-    int i;
-    for ( i = 0; str [ i ] != 0 && str [ i ] != c; ++i )
-        ( void ) 0;
-    return & ( ( char* ) str ) [ i ];
-}
-
-/*--------------------------------------------------------------------------
- * memchr - implemented inline here
- */
-static __inline__
-void *memrchr ( const void *s, int c, size_t n )
-{
-    size_t i;
-    const char *cp = (const char*)s;
-    for ( i = n; i > 0; )
-    {
-        if ( ( int ) cp [ -- i ] == c )
-            return ( void* ) & cp [ i ];
-    }
-    return NULL;
-}
-
-
-/*--------------------------------------------------------------------------
- * strtoll - declared unless _ANSI_SOURCE is defined - redeclare anyway
- * strtoul - older includes were not ready for c99
- *
- *  NB - the define __DARWIN_NO_LONG_LONG will be true for
- *       cases when long long would be int64_t.
- */
-#if __DARWIN_NO_LONG_LONG
-int64_t strtoll ( const char *s, char **end, int base );
-uint64_t strtoull ( const char *s, char **end, int base );
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_os_native_ */
diff --git a/interfaces/os/unix/sysalloc.h b/interfaces/os/unix/sysalloc.h
deleted file mode 100644
index 2207943..0000000
--- a/interfaces/os/unix/sysalloc.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_sysalloc_
-#define _h_sysalloc_
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_sysalloc_ */
diff --git a/interfaces/os/unix/unix-native.h b/interfaces/os/unix/unix-native.h
deleted file mode 100644
index 236806a..0000000
--- a/interfaces/os/unix/unix-native.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_unix_native_
-#define _h_unix_native_
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#include <time.h>
-#include <sys/time.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * timeout_t
- *  a structure for communicating a timeout
- *  which under Unix converts to an absolute time once prepared
- */
-struct timeout_t
-{
-    struct timespec ts;
-    uint32_t mS;
-    uint32_t prepared;
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_unix_native_ */
diff --git a/interfaces/os/win/atomic.h b/interfaces/os/win/atomic.h
deleted file mode 100644
index 57a2f8f..0000000
--- a/interfaces/os/win/atomic.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_atomic_
-#define _h_atomic_
-
-#define DFLT_ATOMIC_BITS 32
-
-#ifndef _h_atomic32_
-#include "atomic32.h"
-#endif
-
-#if ! defined _h_atomic64_ && _ARCH_BITS == 64
-#include "atomic64.h"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if DFLT_ATOMIC_BITS == 32
-#define ATOMIC_NAME( suffix ) \
-    atomic32_ ## suffix
-typedef LONG atomic_int;
-#else
-#define ATOMIC_NAME( suffix ) \
-    atomic64_ ## suffix
-typedef LONGLONG atomic_int;
-#endif
-
-typedef struct ATOMIC_NAME ( t ) atomic_t;
-
-/* ( * v ) */
-#define atomic_read( v ) \
-    ATOMIC_NAME ( read ) ( v )
-
-/* ( * v ) = i */
-#define atomic_set( v, i ) \
-    ATOMIC_NAME ( set ) ( v, i )
-
-/* prior = ( * v ), ( * v ) += i, prior */
-#define atomic_read_and_add( v, i ) \
-    ATOMIC_NAME ( read_and_add ) ( v, i )
-
-/* ( * v ) += i */
-#define atomic_add( v, i ) \
-    ATOMIC_NAME ( add ) ( v, i )
-
-/* ( * v ) += i */
-#define atomic_add_and_read( v, i ) \
-    ATOMIC_NAME ( add_and_read ) ( v, i )
-
-/* ( void ) ++ ( * v ) */
-#define atomic_inc( v ) \
-    ATOMIC_NAME ( inc ) ( v )
-
-/* ( void ) -- ( * v ) */
-#define atomic_dec( v ) \
-    ATOMIC_NAME ( dec ) ( v )
-
-/* -- ( * v ) == 0 */
-#define atomic_dec_and_test( v ) \
-    ATOMIC_NAME ( dec_and_test ) ( v )
-
-/* ++ ( * v ) == 0
-   when atomic_dec_and_test uses predecrement, you want
-   postincrement to this function. so it isn't very useful */
-#define atomic_inc_and_test( v ) \
-    ATOMIC_NAME ( inc_and_test ) ( v )
-
-/* ( * v ) -- == 0
-   HERE's useful */
-#define atomic_test_and_inc( v ) \
-    ATOMIC_NAME ( test_and_inc ) ( v )
-
-/* prior = ( * v ), ( * v ) = ( prior == t ? s : prior ), prior */
-#define atomic_test_and_set( v, s, t ) \
-    ATOMIC_NAME ( test_and_set ) ( v, s, t )
-
-/* THIS FUNCTION IS universal in the case of windows, it uses the sizeof(ptr) */
-#define atomic_test_and_set_ptr( v, s, t ) \
-    InterlockedCompareExchangePointer( ( v ), ( s ), ( t ) )
-
-/* val = ( * v ), ( ( * v ) = ( val < t ) ? val + i : val ), val */
-#define atomic_read_and_add_lt( v, i, t ) \
-    ATOMIC_NAME ( read_and_add_lt ) ( v, i, t )
-
-/* val = ( * v ), ( ( * v ) = ( val <= t ) ? val + i : val ), val */
-#define atomic_read_and_add_le( v, i, t ) \
-    ATOMIC_NAME ( read_and_add_le ) ( v, i, t )
-
-/* val = ( * v ), ( ( * v ) = ( val == t ) ? val + i : val ), val */
-#define atomic_read_and_add_eq( v, i, t ) \
-    ATOMIC_NAME ( read_and_add_eq ) ( v, i, t )
-
-/* val = ( * v ), ( ( * v ) = ( val != t ) ? val + i : val ), val */
-#define atomic_read_and_add_ne( v, i, t ) \
-    ATOMIC_NAME ( read_and_add_ne ) ( v, i, t )
-
-/* val = ( * v ), ( ( * v ) = ( val >= t ) ? val + i : val ), val */
-#define atomic_read_and_add_ge( v, i, t ) \
-    ATOMIC_NAME ( read_and_add_ge ) ( v, i, t )
-
-/* val = ( * v ), ( ( * v ) = ( val > t ) ? val + i : val ), val */
-#define atomic_read_and_add_gt( v, i, t ) \
-    ATOMIC_NAME ( read_and_add_gt ) ( v, i, t )
-
-/* val = ( * v ), ( ( * v ) = ( ( val & 1 ) == 1 ) ? val + i : val ), val */
-#define atomic_read_and_add_odd( v, i ) \
-    ATOMIC_NAME ( read_and_add_odd ) ( v, i )
-
-/* val = ( * v ), ( ( * v ) = ( ( val & 1 ) == 0 ) ? val + i : val ), val */
-#define atomic_read_and_add_even( v, i ) \
-    ATOMIC_NAME ( read_and_add_even ) ( v, i )
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_atomic_ */
diff --git a/interfaces/os/win/atomic32.h b/interfaces/os/win/atomic32.h
deleted file mode 100644
index 0e9e0fc..0000000
--- a/interfaces/os/win/atomic32.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_atomic32_
-#define _h_atomic32_
-
-#include <WINDOWS.H>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct atomic32_t atomic32_t;
-struct atomic32_t
-{
-    volatile LONG counter;
-};
-
-/* int atomic32_read ( const atomic32_t *v ); */
-#define atomic32_read( v ) \
-    ( ( v ) -> counter )
-
-/* void atomic32_set ( atomic32_t *v, int i ); */
-#define atomic32_set( v, i ) \
-    ( ( void ) ( ( ( v ) -> counter ) = ( i ) ) )
-
-/* add to v -> counter and return the prior value */
-/* int atomic32_read_and_add ( atomic32_t *v, int i ) */
-#define atomic32_read_and_add( v, i ) \
-    InterlockedExchangeAdd ( & ( v ) -> counter, ( i ) )
-
-/* if no read is needed, define the least expensive atomic add */
-#define atomic32_add( v, i ) \
-    atomic32_read_and_add ( v, i )
-
-/* add to v -> counter and return the result */
-static __inline int atomic32_add_and_read ( atomic32_t *v, int i )
-{
-	return atomic32_read_and_add ( v, i ) + i;
-}
-
-/* void atomic32_inc ( atomic32_t *v ) */
-#define atomic32_inc( v ) \
-    InterlockedIncrement ( & ( v ) -> counter )
-
-/* void atomic32_dec ( atomic32_t *v ) */
-#define atomic32_dec( v ) \
-    InterlockedDecrement ( & ( v ) -> counter )
-
-/* decrement by one and test result for 0 */
-/* int atomic32_dec_and_test ( atomic32_t *v ) */
-#define atomic32_dec_and_test( v ) \
-    ( InterlockedDecrement ( & ( v ) -> counter ) == 0 )
-
-/* when atomic32_dec_and_test uses predecrement, you want
-   postincrement to this function. so it isn't very useful */
-/* int atomic32_inc_and_test ( atomic32_t *v ) */
-#define atomic32_inc_and_test( v ) \
-    ( InterlockedIncrement ( & ( v ) -> counter ) == 0 )
-
-/* HERE's useful */
-#define atomic32_test_and_inc( v ) \
-    ( atomic32_read_and_add ( v, 1 ) == 0 )
-
-/* int atomic32_test_and_set ( atomic32_t *v, int s, int t ) */
-#define atomic32_test_and_set( v, s, t ) \
-    InterlockedCompareExchange ( & ( v ) -> counter, ( s ), ( t ) )
-
-/* conditional modifications */
-static __inline int atomic32_read_and_add_lt ( atomic32_t *v, int i, int t )
-{
-	LONG val, val_intern;
-	for ( val = atomic32_read ( v ); val < t; val = val_intern )
-	{
-		val_intern = atomic32_test_and_set ( v, val + i, val );
-		if ( val_intern == val )
-			break;
-	}
-	return val;
-}
-
-static __inline int atomic32_read_and_add_le ( atomic32_t *v, int i, int t )
-{
-	LONG val, val_intern;
-	for ( val = atomic32_read ( v ); val <= t; val = val_intern )
-	{
-		val_intern = atomic32_test_and_set ( v, val + i, val );
-		if ( val_intern == val )
-			break;
-	}
-	return val;
-}
-
-static __inline int atomic32_read_and_add_eq ( atomic32_t *v, int i, int t )
-{
-	LONG val, val_intern;
-	for ( val = atomic32_read ( v ); val == t; val = val_intern )
-	{
-		val_intern = atomic32_test_and_set ( v, val + i, val );
-		if ( val_intern == val )
-			break;
-	}
-	return val;
-}
-
-static __inline int atomic32_read_and_add_ne ( atomic32_t *v, int i, int t )
-{
-	LONG val, val_intern;
-	for ( val = atomic32_read ( v ); val != t; val = val_intern )
-	{
-		val_intern = atomic32_test_and_set ( v, val + i, val );
-		if ( val_intern == val )
-			break;
-	}
-	return val;
-}
-
-static __inline int atomic32_read_and_add_ge ( atomic32_t *v, int i, int t )
-{
-	LONG val, val_intern;
-	for ( val = atomic32_read ( v ); val >= t; val = val_intern )
-	{
-		val_intern = atomic32_test_and_set ( v, val + i, val );
-		if ( val_intern == val )
-			break;
-	}
-	return val;
-}
-
-static __inline int atomic32_read_and_add_gt ( atomic32_t *v, int i, int t )
-{
-	LONG val, val_intern;
-	for ( val = atomic32_read ( v ); val > t; val = val_intern )
-	{
-		val_intern = atomic32_test_and_set ( v, val + i, val );
-		if ( val_intern == val )
-			break;
-	}
-	return val;
-}
-
-static __inline int atomic32_read_and_add_odd ( atomic32_t *v, int i )
-{
-	LONG val, val_intern;
-	for ( val = atomic32_read ( v ); ( val & 1 ) != 0; val = val_intern )
-	{
-		val_intern = atomic32_test_and_set ( v, val + i, val );
-		if ( val_intern == val )
-			break;
-	}
-	return val;
-}
-
-static __inline int atomic32_read_and_add_even ( atomic32_t *v, int i )
-{
-	LONG val, val_intern;
-	for ( val = atomic32_read ( v ); ( val & 1 ) == 0; val = val_intern )
-	{
-		val_intern = atomic32_test_and_set ( v, val + i, val );
-		if ( val_intern == val )
-			break;
-	}
-	return val;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_atomic32_ */
diff --git a/interfaces/os/win/atomic64.h b/interfaces/os/win/atomic64.h
deleted file mode 100644
index cb9870e..0000000
--- a/interfaces/os/win/atomic64.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_atomic64_
-#define _h_atomic64_
-
-#include <WINDOWS.H>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct atomic64_t atomic64_t;
-struct atomic64_t
-{
-    volatile LONGLONG counter;
-};
-
-/* int atomic64_read ( const atomic64_t *v ); */
-#define atomic64_read( v ) \
-    ( ( v ) -> counter )
-
-/* void atomic64_set ( atomic64_t *v, long int i ); */
-#define atomic64_set( v, i ) \
-    ( ( void ) ( ( ( v ) -> counter ) = ( i ) ) )
-
-/* add to v -> counter and return the prior value */
-/* int atomic32_read_and_add ( atomic32_t *v, int i ) */
-#define atomic64_read_and_add( v, i ) \
-    InterlockedExchangeAdd64 ( & ( v ) -> counter, ( i ) )
-
-/* if no read is needed, define the least expensive atomic add */
-#define atomic64_add( v, i ) \
-    atomic64_read_and_add ( v, i )
-
-/* add to v -> counter and return the result */
-static __inline LONG64 atomic64_add_and_read ( atomic64_t *v, int i )
-{
-	return atomic64_read_and_add ( v, i ) + i;
-}
-
-/* void atomic64_inc ( atomic64_t *v ) */
-#define atomic64_inc( v ) \
-    InterlockedIncrement64 ( & ( v ) -> counter )
-
-/* void atomic64_dec ( atomic64_t *v ) */
-#define atomic64_dec( v ) \
-    InterlockedDecrement64 ( & ( v ) -> counter )
-
-/* decrement by one and test result for 0 */
-/* int atomic64_dec_and_test ( atomic64_t *v ) */
-#define atomic64_dec_and_test( v ) \
-    ( InterlockedDecrement64 ( & ( v ) -> counter ) == 0 )
-
-/* when atomic64_dec_and_test uses predecrement, you want
-   postincrement to this function. so it isn't very useful */
-/* int atomic64_inc_and_test ( atomic64_t *v ) */
-#define atomic64_inc_and_test( v ) \
-    ( InterlockedIncrement64 ( & ( v ) -> counter ) == 0 )
-
-/* HERE's useful */
-#define atomic64_test_and_inc( v ) \
-    ( atomic64_read_and_add ( v, 1 ) == 0 )
-
-/* int atomic64_test_and_set ( atomic64_t *v, int s, int t ) */
-#define atomic64_test_and_set( v, s, t ) \
-    InterlockedCompareExchange64 ( & ( v ) -> counter, ( s ), ( t ) )
-
-/* conditional modifications */
-static __inline LONG64 atomic64_read_and_add_lt ( atomic64_t *v, int i, int t )
-{
-	LONG64 val, val_intern;
-	for ( val = atomic64_read ( v ); val < t; val = val_intern )
-	{
-		val_intern = atomic64_test_and_set ( v, val + i, val );
-		if ( val_intern == val )
-			break;
-	}
-	return val;
-}
-
-static __inline LONG64 atomic64_read_and_add_le ( atomic64_t *v, int i, int t )
-{
-	LONG64 val, val_intern;
-	for ( val = atomic64_read ( v ); val <= t; val = val_intern )
-	{
-		val_intern = atomic64_test_and_set ( v, val + i, val );
-		if ( val_intern == val )
-			break;
-	}
-	return val;
-}
-
-static __inline LONG64 atomic64_read_and_add_eq ( atomic64_t *v, int i, int t )
-{
-	LONG64 val, val_intern;
-	for ( val = atomic64_read( v ); val == t; val = val_intern )
-	{
-		val_intern = atomic64_test_and_set ( v, val + i, val );
-		if ( val_intern == val )
-			break;
-	}
-	return val;
-}
-
-static __inline LONG64 atomic64_read_and_add_ne ( atomic64_t *v, int i, int t )
-{
-	LONG64 val, val_intern;
-	for ( val = atomic64_read ( v ); val != t; val = val_intern )
-	{
-		val_intern = atomic64_test_and_set ( v, val + i, val );
-		if ( val_intern == val )
-			break;
-	}
-	return val;
-}
-
-static __inline LONG64 atomic64_read_and_add_ge ( atomic64_t *v, int i, int t )
-{
-	LONG64 val, val_intern;
-	for ( val = atomic64_read ( v ); val >= t; val = val_intern )
-	{
-		val_intern = atomic64_test_and_set ( v, val + i, val );
-		if ( val_intern == val )
-			break;
-	}
-	return val;
-}
-
-static __inline LONG64 atomic64_read_and_add_gt ( atomic64_t *v, int i, int t )
-{
-	LONG64 val, val_intern;
-	for ( val = atomic64_read ( v ); val > t; val = val_intern )
-	{
-		val_intern = atomic64_test_and_set ( v, val + i, val );
-		if ( val_intern == val )
-			break;
-	}
-	return val;
-}
-
-static __inline LONG64 atomic64_read_and_add_odd ( atomic64_t *v, int i )
-{
-	LONG64 val, val_intern;
-	for ( val = atomic64_read ( v ); ( val & 1 ) != 0; val = val_intern )
-	{
-		val_intern = atomic64_test_and_set ( v, val + i, val );
-		if ( val_intern == val )
-			break;
-	}
-	return val;
-}
-
-static __inline LONG64 atomic64_read_and_add_even ( atomic64_t *v, int i )
-{
-	LONG64 val, val_intern;
-	for ( val = atomic64_read ( v ); ( val & 1 ) == 0; val = val_intern )
-	{
-		val_intern = atomic64_test_and_set ( v, val + i, val );
-		if ( val_intern == val )
-			break;
-	}
-	return val;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_atomic64_ */
diff --git a/interfaces/os/win/byteswap.h b/interfaces/os/win/byteswap.h
deleted file mode 100644
index 4b92f51..0000000
--- a/interfaces/os/win/byteswap.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_win_byteswap_
-#define _h_win_byteswap_
-
-#ifndef _INC_STDLIB
-#include <stdlib.h>
-#endif
-
-/* make these look the same as on Linux
-   use the lower-level Windows routines, as
-   they are specific in their data types */
-#undef bswap_16
-#define bswap_16(x) _byteswap_ushort(x)
-#undef bswap_32
-#define bswap_32(x) _byteswap_ulong(x)
-#undef bswap_64
-#define bswap_64(x) _byteswap_uint64(x)
-
-#endif /* _h_win_byteswap_ */
diff --git a/interfaces/os/win/endian.h b/interfaces/os/win/endian.h
deleted file mode 100644
index 61d9c7d..0000000
--- a/interfaces/os/win/endian.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_win_endian_
-#define _h_win_endian_
-
-/* magic values pulled from RPCNDR.H */
-
-#define __LITTLE_ENDIAN   (0X00000010L)
-#define __BIG_ENDIAN      (0X00000000L)
-
-#if defined(__RPC_MAC__)
-#define __BYTE_ORDER      __BIG_ENDIAN
-#else
-#define __BYTE_ORDER      __LITTLE_ENDIAN
-#endif
-
-
-#endif /* _h_win_endian_ */
diff --git a/interfaces/os/win/os-native.h b/interfaces/os/win/os-native.h
deleted file mode 100644
index 224129a..0000000
--- a/interfaces/os/win/os-native.h
+++ /dev/null
@@ -1,207 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_os_native_
-#define _h_os_native_
-
-/* get this guy included so that off_t is 64 bit */
-#ifndef _STDINT_H
-#include "stdint.h"
-#endif
-
-/* specify at least NT 4.0 */
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0400
-#endif
-
-/* we should never include this directly */
-#include <WINDOWS.H>
-#include <limits.h>
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifndef _h_klib_text_
-#include <klib/text.h>
-#endif
-
-#include <ctype.h>
-#include <direct.h>
-#include <math.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-
-/* to make code work that depends on POSIX-bits (octal!) under Windows */
-#define S_IWGRP 0020
-#define S_IWOTH 0002
-
-#define mode_t uint32_t
-
-/*--------------------------------------------------------------------------
- * timeout_t
- *  a structure for communicating a timeout
- *  which under Windows is a relative time
- */
-struct timeout_t
-{
-    uint32_t mS;
-    uint32_t prepared;
-};
-
-/* not consistent across all windows? */
-/* #define snprintf _snprintf */
-
-
-#ifndef putenv
-#define putenv( s ) _putenv ( s )
-#endif
-
-#define mkdir( d, m ) _mkdir( d )
-#define strcasecmp _stricmp
-#define strtoll _strtoi64
-#define strtok_r strtok_s
-
-#undef strdup
-#define strdup( str ) \
-    string_dup_measure ( ( str ), NULL )
-
-#undef strndup
-#define strndup( str, n ) \
-    string_dup ( ( str ), ( n ) )
-
-static __inline int isblank(int x)
-{
-    return (((x) == ' ') || ((x) == '\t'));
-}
-
-int snprintf (char * buffer, size_t bufsize, const char * format, ...);
-
-
-static __inline__
-void *memrchr ( const void *s, int c, size_t n )
-{
-    size_t i;
-    const char *cp = (const char*)s;
-    for ( i = n; i > 0; )
-    {
-        if ( ( int ) cp [ -- i ] == c )
-            return (void *)(cp + i);
-    }
-    return NULL;
-}
-
-static __inline
-char *strchrnul ( const char *s, int c_in )
-{
-    uint32_t i;
-    for ( i=0; s[i] != 0; ++i )
-    {
-        if ( s[i] == c_in ) 
-            break;
-    }
-  return ( char * )&s[ i ];
-}
-
-static __inline
-char *strsep ( char **stringp, const char *delim )
-{
-	char *s, *tok, c, delim_char;
-	const char *p_delim;
-
-	if ( ( s = *stringp ) == NULL )
-		return NULL;
-
-	for ( tok = s; ; )
-	{
-		c = *s++;
-		p_delim = delim;
-		do {
-			if ( ( delim_char = *p_delim++ ) == c )
-			{
-				if ( c == 0 )
-					s = NULL;
-				else
-					s[-1] = 0;
-				*stringp = s;
-				return ( tok );
-			}
-		} while ( delim_char != 0 );
-	}
-	return NULL;
-}
-
-#define gmtime_r(t, tm) gmtime_s(tm, t)
-#define timegm _mkgmtime
-
-static __inline
-int strncasecmp( const char *s1, const char *s2, size_t n )
-{
-    return _strnicmp( s1, s2, n );
-}
-
-static __inline 
-const char *strcasestr (const char *s1, const char *s2)
-{
-    unsigned char c2 = tolower((unsigned char) *s2);
-    size_t l1 = strlen(s1), l2 = strlen(s2);
-    
-    if (l2 == 0) {
-        return s1;
-    }
-
-    while (l1 >= l2) {
-        if (tolower((unsigned char) *s1) == c2
-            &&  (l2 == 1  ||  _strnicmp(s1 + 1, s2 + 1, l2 - 1) == 0)) {
-            return s1;
-        }
-        ++s1;
-        --l1;
-    }
-
-    return NULL;
-}
-
-static __inline
-long int lround ( double x )
-{
-    double val = ( x < 0.0 ) ? ceil ( x - 0.5 ) : floor ( x + 0.5 );
-    if ( val > ( double ) LONG_MAX )
-        return LONG_MAX;
-    if ( val < ( double ) LONG_MIN )
-        return LONG_MIN;
-    return ( long int ) val;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_os_native_ */
diff --git a/interfaces/os/win/strtol.h b/interfaces/os/win/strtol.h
deleted file mode 100644
index 3475dcc..0000000
--- a/interfaces/os/win/strtol.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_strtol_
-#define _h_strtol_
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#include <ctype.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * strtoi32
- * strtoi32
- *  based upon actual usage
- */
-#define strtoi32( str, endp, base ) \
-    ( int32_t ) strtol ( str, endp, base )
-
-#define strtou32( str, endp, base ) \
-    ( uint32_t ) strtoul ( str, endp, base )
-
-
-/*--------------------------------------------------------------------------
- * strtoi64
- * strtoi64
- *  based upon actual usage
- */
-static __inline
-__int64 strtoi64( const char* str, char** endp, uint32_t base )
-{
-    int i = 0;
-    __int64 ret_value = 0;
-
-    if ( str != NULL && base != 1 && base <= 36 )
-    {
-        bool negate = false;
-
-        for ( ; isspace( str [ i ] ); ++ i )
-            ( void ) 0;
-
-        switch ( str [ i ] )
-        {
-        case '-':
-            negate = true;
-        case '+':
-            ++ i;
-            break;
-        }
-
-        if ( base == 0 )
-        {
-            if ( str [ i ] != '0' )
-                base = 10;
-            else if ( tolower ( str [ i + 1 ] == 'x' ) )
-            {
-                base = 16;
-                i += 2;
-            }
-            else
-            {
-                base = 8;
-                i += 1;
-            }
-        }
-
-        if ( base <= 10 )
-        {
-            for ( ; isdigit ( str [ i ] ); ++ i )
-            {
-                uint32_t digit = str [ i ] - '0';
-                if ( digit >= base )
-                    break;
-                ret_value *= base;
-                ret_value += digit;
-            }
-        }
-        else
-        {
-            for ( ; ; ++ i )
-            {
-                if ( isdigit ( str [ i ] ) )
-                {
-                    ret_value *= base;
-                    ret_value += str [ i ] - '0';
-                }
-                else if ( ! isalpha ( str [ i ] ) )
-                    break;
-                else
-                {
-                    uint32_t digit = toupper ( str [ i ] ) - 'A' + 10;
-                    if ( digit >= base )
-                        break;
-                    ret_value *= base;
-                    ret_value += digit;
-                }
-            }
-        }
-
-        if ( negate )
-            ret_value = - ret_value;
-    }
-
-    if ( endp != NULL )
-        * endp = (char *)str + i;
-
-    return ret_value;
-}
-
-static __inline
-unsigned __int64 strtou64( const char* str, char** endp, uint32_t base )
-{
-    return strtoi64( str, endp, base );
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_strtol_ */
diff --git a/interfaces/os/win/sysalloc.h b/interfaces/os/win/sysalloc.h
deleted file mode 100644
index 16c530e..0000000
--- a/interfaces/os/win/sysalloc.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_sysalloc_
-#define _h_sysalloc_
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#include <malloc.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* malloc, calloc, realloc
- */
-KLIB_EXTERN void * CC klib_malloc ( size_t bytes );
-KLIB_EXTERN void * CC klib_calloc ( size_t count, size_t size );
-KLIB_EXTERN void * CC klib_realloc ( void *obj, size_t bytes );
-
-/* free
- */
-KLIB_EXTERN void CC klib_free ( void *obj );
-
-#ifndef _c_sysalloc_
-
-#undef malloc
-#undef calloc
-#undef realloc
-#undef free
-
-#define malloc klib_malloc
-#define calloc klib_calloc
-#define realloc klib_realloc
-#define free klib_free
-
-#endif /* _c_sysalloc_ */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_sysalloc_ */
diff --git a/interfaces/search/extern.h b/interfaces/search/extern.h
deleted file mode 100644
index 453811a..0000000
--- a/interfaces/search/extern.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_search_extern_
-#define _h_search_extern_
-
-#if ! defined EXPORT_LATCH && defined _LIBRARY
-#define SEARCH_EXTERN LIB_EXPORT
-#define EXPORT_LATCH 1
-#else
-#define SEARCH_EXTERN LIB_IMPORT
-#endif
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#endif /* _h_search_extern_ */
diff --git a/interfaces/search/grep.h b/interfaces/search/grep.h
deleted file mode 100644
index c79a205..0000000
--- a/interfaces/search/grep.h
+++ /dev/null
@@ -1,263 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_search_grep_
-#define _h_search_grep_
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#include <search/extern.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * Fgrep
- */
-typedef struct Fgrep Fgrep;
-
-
-/* MatchCallback
- *
- *  "matchinfo" [ IN ] -
- *
- *  "flag" [ OUT ] -
- */
-typedef uint8_t FgrepContinueFlag;
-enum
-{
-    FGREP_CONTINUE = 1,
-    FGREP_STOP = 2
-};
-
-typedef struct FgrepMatch FgrepMatch;
-struct FgrepMatch
-{
-    int32_t position;
-    int32_t length;
-    int32_t whichpattern;
-};
-
-typedef rc_t ( CC * FgrepMatchCallback ) ( void *cbinfo,
-    const FgrepMatch *matchinfo, FgrepContinueFlag *flag );
-
-
-/* Make
- *
- *  "fg" [ OUT ] -
- *
- *  "mode" [ IN ]
- *
- *  "strings" [ IN ] and "numstrings" [ IN ] -
- */
-typedef uint8_t FgrepFlags;
-enum
-{
-    FGREP_MODE_ASCII = 1,
-    FGREP_MODE_ACGT = 2,
-    FGREP_TEXT_EXPANDED_2NA = 4,
-    FGREP_ALG_DUMB = 8,
-    FGREP_ALG_BOYERMOORE = 0x10,
-    FGREP_ALG_AHOCORASICK = 0x20
-};
-
-SEARCH_EXTERN rc_t CC FgrepMake ( Fgrep **fg, FgrepFlags mode,
-    const char *strings[], uint32_t numstrings );
-
-/* Whack
- */
- #if 0
-SEARCH_EXTERN void CC FgrepWhack ( Fgrep *self );
-#endif
-SEARCH_EXTERN void CC FgrepFree ( Fgrep *self );
-
-/* FindFirst
- *  Pass a matchinfo structure to get the info.
- *  Returns nonzero if found, 0 if nothing found.
- *
- *   "buf" [ IN ] and "len" [ IN ]
- *
- *  "matchinfo" [ OUT ]
- */
-SEARCH_EXTERN uint32_t CC FgrepFindFirst ( const Fgrep *self,
-    const char *buf, size_t len, FgrepMatch *matchinfo );
-
-
-/* FindAll
- * TBD - should this return rc_t?
- */
- #if 0
-SEARCH_EXTERN void CC FgrepFindAll ( const Fgrep *self, const char *buf, size_t len,
-    FgrepMatchCallback cb, void *cbinfo );
-#endif
-
-/*----------------------------------------------------------------
- * Fgrep appendix 
- */
-
-/*
- * Sees if a suffix of the pattern exact matches a prefix of the buffer.
- */
-SEARCH_EXTERN uint32_t CC has_left_exact_match(char *pattern, char *buf, size_t buflen,
-                              int32_t *length);
-
-SEARCH_EXTERN uint32_t CC has_right_exact_match(char *pattern, char *buf, size_t buflen, 
-                               int32_t *bestpos);
-
-SEARCH_EXTERN uint32_t CC has_inside_exact_match(char *pattern, char *buf, size_t buflen, 
-                                int32_t *skip);
-
-/*--------------------------------------------------------------------------
- * Agrep
- */
-typedef struct Agrep Agrep;
-
-
-/* MatchCallback
- */
-typedef struct AgrepMatch AgrepMatch;
-struct AgrepMatch
-{
-    int32_t position;
-    int32_t length;
-    int32_t score;
-};
-
-typedef uint8_t AgrepContinueFlag;
-enum
-{
-    AGREP_STOP = 1,
-    AGREP_CONTINUE = 2,
-    AGREP_MOREINFO = 4
-};
-
-typedef rc_t ( CC * AgrepMatchCallback ) ( const void *cbinfo, const AgrepMatch *matchinfo, AgrepContinueFlag *flag );
-
-
-/* Make
- */
-typedef uint32_t AgrepFlags;
-enum
-{
-    AGREP_MODE_ASCII = 0x0001, /* simple text grep */
-    AGREP_PATTERN_4NA = 0x0002, /* pattern is 4na - bio mode */
-    /* text flags */
-    AGREP_IGNORE_CASE = 0x0004, /* ignore case in ascii mode, bio mode always ignores case */
-    /* bio mode flags */
-    AGREP_TEXT_EXPANDED_2NA = 0x0008, /* search string can have 2na */
-    AGREP_ANYTHING_ELSE_IS_N = 0x0010, /* periods, dashes in 4na pattern treated as N */
-    
-    /* algorithm choice */
-    AGREP_ALG_DP = 0x0020,
-    AGREP_ALG_WUMANBER = 0x0040,
-    AGREP_ALG_MYERS = 0x0080, /* shoud be same, internally detect algo based on pattern size */
-    AGREP_ALG_MYERS_UNLTD = 0x0100, /* very faulty, at least will crash on low memory */
-
-    AGREP_EXTEND_SAME = 0x200,
-    AGREP_EXTEND_BETTER = 0x400,
-    AGREP_LEFT_MAINTAIN_SCORE = 0x800, /* Only supported in DP for now */
-    AGREP_ANCHOR_LEFT = 0x1000 /* Only supported in DP for now */
-};
-
-SEARCH_EXTERN rc_t CC AgrepMake(Agrep **self, AgrepFlags mode, const char *pattern);
-
-/* Whack
- */
-SEARCH_EXTERN void CC AgrepWhack ( Agrep *self );
-
-/* FindFirst
- *  Pass in a pointer to an AgrepMatch, and it will be filled out.
- *  Returns nonzero if something found, zero if nothing found.
- */
-SEARCH_EXTERN uint32_t CC AgrepFindFirst( const Agrep *self, int32_t threshold, const char *buf, size_t len, AgrepMatch *matchinfo);
-
-SEARCH_EXTERN uint32_t CC AgrepFindBest( const Agrep *self, int32_t threshold, const char *buf, int32_t len, AgrepMatch *match);
-
-/* FindAll
- */
-typedef struct AgrepCallArgs AgrepCallArgs;
-struct AgrepCallArgs
-{
-    const Agrep *self;
-
-    const char *buf;
-    size_t buflen;
-
-    AgrepMatchCallback cb;
-    void *cbinfo;
-
-    /*
-      This threshold is really intended for algorithms like DP and MYERS
-      that do not require the threshold to be part of the initial setup.
-      We may use this to override the one specified in the setup,
-      but we may not; if you want to use the one in the setup function,
-      pass -1 as the threshold.
-    */
-    int32_t threshold;
-};
-
-SEARCH_EXTERN void CC AgrepFindAll ( const AgrepCallArgs *args );
-
-/*--------------------------------------------------------------------------
- * Agrep appendix
- */
-
-SEARCH_EXTERN uint32_t CC has_left_approx_match(char *pattern, uint32_t errors, 
-                               char *buf, size_t buflen, 
-                               uint32_t *length, uint32_t *errcnt);
-
-SEARCH_EXTERN uint32_t CC has_right_approx_match(char *pattern, uint32_t errors, 
-                                char *buf, size_t buflen, 
-                                uint32_t *bestpos, uint32_t *errcnt);
-
-SEARCH_EXTERN uint32_t CC has_inside_approx_match(char *pattern, uint32_t plen, uint32_t errors, 
-                                 char *buf, size_t buflen, 
-                                 uint32_t *skip, uint32_t *errcnt);
-
-typedef struct LeftMatch LeftMatch;
-struct LeftMatch
-{
-    int32_t position;
-    int32_t hits;
-    int32_t misses;
-};
-
-typedef rc_t ( CC * LeftMatchCallback ) ( void *cbinfo, const LeftMatch *matchinfo, AgrepContinueFlag *flag );
-
-
-
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_search_grep_ */
diff --git a/interfaces/search/nucstrstr.h b/interfaces/search/nucstrstr.h
deleted file mode 100644
index 095bcf4..0000000
--- a/interfaces/search/nucstrstr.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/*==============================================================================
-
-  search/nucstrstr.h
-
-    nucleotide k-mer searching facility
- */
-
-
-#ifndef _h_search_nucstrstr_
-#define _h_search_nucstrstr_
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#include <search/extern.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* set to 1 if buffer supplied to NucStrstrSearch is
-   always at least 16 bytes beyond than the sequence */
-#ifndef ENDLESS_BUFFER
-#define ENDLESS_BUFFER 1
-#endif
-
-/* normally used for test only */
-#ifndef ENABLE_AT_EXPR
-#define ENABLE_AT_EXPR 0
-#endif
-
-/* positional returns make little sense with Boolean logic */
-#ifndef ALLOW_POSITIONAL_OPERATOR_MIX
-#define ALLOW_POSITIONAL_OPERATOR_MIX 1
-#endif
-
-
-/*--------------------------------------------------------------------------
- * NucStrstr
- *  prepared handle for nucleotide k-mer strstr
- */
-typedef union NucStrstr NucStrstr;
-
-/* NucStrstrMake
- *  prepares search by parsing expression query string
- *  returns error if conversion was not possible.
- *
- *  "nss" [ OUT ] - return parameter for one-time search handle
- *
- *  "positional" [ IN ] - if non-zero, build an expression tree
- *  to return found position rather than simply a Boolean found.
- *  see NucStrstrSearch. if ENABLE_AT_EXPR is defined as non-zero,
- *  the <position_expr> production can switch this flag to true
- *  for the immediately following fasta_expr from within the
- *  expression string itself. if ALLOW_POSITIONAL_OPERATOR_MIX
- *  is defined as non-zero, operators '!', '&&' and '||' will
- *  be allowed when generating positional results. they will make
- *  no sense otherwise.
- *
- *  "query" [ IN ] and "len" [ IN ] - query string expression, such that:
- *       expr           : <unary_expr>
- *                      | <unary_expr> <boolean_op> <expr>
- *       unary_expr     : <primary_expr>
- *                      | '!' <unary_expr>
- *       primary_expr   : <position_expr>
- *                      | '^' <position_expr>
- *                      | <position_expr> '$'
- *                      | '(' <expr> ')'
- *       position_expr  : <fasta_expr>
- *                      | '@' <fasta_expr>
- *       fasta_expr     : FASTA
- *                      | "'" FASTA "'"
- *                      | '"' FASTA '"'
- *       boolean_op     : '&', '|', '&&', '||'
- *
- *    where the '@' operator may be used to force the "positional"
- *    flag to be true - conditionally enabled.
- *
- *  return values:
- *    EINVAL - invalid parameter or invalid expression
- */
-SEARCH_EXTERN int CC NucStrstrMake ( NucStrstr **nss, int positional,
-    const char *query, unsigned int len );
-
-/* NucStrstrWhack
- *  discard structure when no longer needed
- */
-SEARCH_EXTERN void CC NucStrstrWhack ( NucStrstr *self );
-
-/* NucStrstrSearch
- *  search buffer from starting position
- *
- *  "ncbi2na" [ IN ] - pointer to 2na data
- *
- *    N.B. - "ncbi2na" must be at least long enough to allow for
- *    full 16-byte loads at the tail of the search sequence:
- *
- *    - technically, the size requirement is:
- *     ( ( pos + len + 3 ) / 4 ) == bytes,
- *     ( ( bytes + 15 ) / 16 ) * 16 == min data size
- *
- *    - practically, if "ncbi2na" points to a data buffer
- *      that is at least 16 bytes longer than "bytes" above,
- *      then it is always sufficient, and sometimes excessive.
- *
- *  "pos" [ IN ] - starting base position for search,
- *  relative to "ncbi2na". may be >= 4.
- *
- *  "len" [ IN ] - the number of bases to include in
- *  the search, relative to "pos".
- *
- *  return values:
- *    0 if the pattern was not found
- *    1..N indicating starting position if "self" was
- *      prepared for positional return
- *   !0 if "self" was prepared normally by NucStrstrMake
- */
-SEARCH_EXTERN int CC NucStrstrSearch ( const NucStrstr *self,
-    const void *ncbi2na, unsigned int pos, unsigned int len,unsigned int* selflen );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_search_nucstrstr_ */
-
diff --git a/interfaces/sra/454.vschema b/interfaces/sra/454.vschema
deleted file mode 100644
index a3f5bc5..0000000
--- a/interfaces/sra/454.vschema
+++ /dev/null
@@ -1,289 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/*==========================================================================
- * NCBI 454 Sequence Read Archive schema
- */
-version 1;
-
-include 'ncbi/sra.vschema';
-include 'ncbi/spotname.vschema';
-include 'ncbi/clip.vschema';
-
-
-/*--------------------------------------------------------------------------
- * functions
- */
-
-/* dynamic_read_desc
- *  uses inputs to determine read type and segmentation
- *
- *  "edit_distance" [ CONST, OPTIONAL ] - a tolerance figure for
- *  linker matching, where 0 requires exact match, 5 is default.
- *
- *  "spot" [ DATA ] - bases for entire spot
- *
- *  "key" [ DATA, CONTROL ] - bases for key sequence. for version 1,
- *  the first base following key is taken as biological start
- *
- *  "linker" [ DATA, CONTROL, OPTIONAL ] - if present, is used to separate
- *  all bases following "key" into mate pair biological reads
- *
- *  returns a trio for each identified read, with read type, start and length
- */
-typeset NCBI:SRA:_454_:drdparam_set { ascii, U8, INSDC:2na:packed };
-extern function
-U32 [ 3 ] NCBI:SRA:_454_:dynamic_read_desc #1 < * U32 edit_distance >
-    ( NCBI:SRA:_454_:drdparam_set spot, NCBI:SRA:_454_:drdparam_set key
-      * NCBI:SRA:_454_:drdparam_set linker );
-
-const U32 NCBI:SRA:_454_:dyn_read_type  = 0;
-const U32 NCBI:SRA:_454_:dyn_read_start = 1;
-const U32 NCBI:SRA:_454_:dyn_read_len   = 2;
-
-
-/* tokenize_spot_name
- *  scans name on input
- *  tokenizes into parts
- */
-extern function NCBI:SRA:spot_name_token
-    NCBI:SRA:_454_:tokenize_spot_name #1 ( ascii name );
-
-
-/*--------------------------------------------------------------------------
- * NCBI:SRA:_454_:common
- *  Roche 454 SRA Platform
- *
- * history:
- *  1.0.1 - explictly base upon sra #1.0.1
- *  1.0.2 - bring in clip processing from external table
- *  1.0.3 - base explicitly upon sra #1.0.2, clip #1.0.1
- *  1.0.4 - base explicitly upon sra #1.0.3, clip #1.0.2
- */
-table NCBI:SRA:_454_:common #1.0.4 = INSDC:SRA:tbl:sra #1.0.3, NCBI:SRA:tbl:clip #1.0.2
-{
-    /* PLATFORM
-     *  platform name is always 454
-     */
-    ascii platform_name
-        = < ascii > echo < "454" > ();
-
-    /* 454 TECHNICAL SEQUENCES
-     */
-    column INSDC:dna:text FLOW_CHARS = out_flow_chars;
-    INSDC:dna:text in_flow_chars
-        = < INSDC:dna:text, INSDC:dna:text > map < 'acgtn.', 'ACGTNN' > ( FLOW_CHARS );
-    column INSDC:dna:text KEY_SEQUENCE = out_key_sequence;
-    INSDC:dna:text in_key_sequence
-        = < INSDC:dna:text, INSDC:dna:text > map < 'acgtn.', 'ACGTNN' > ( KEY_SEQUENCE );
-    column INSDC:dna:text LINKER_SEQUENCE = out_linker_sequence;
-    INSDC:dna:text in_linker_sequence
-        = < INSDC:dna:text, INSDC:dna:text > map < 'acgtn.', 'ACGTNN' > ( LINKER_SEQUENCE );
-
-    // binary technical sequences
-    INSDC:x2na:bin out_flow_bin
-        = < INSDC:dna:text, INSDC:x2na:bin > map < INSDC:x2na:map:CHARSET, INSDC:x2na:map:BINSET > ( out_flow_chars );
-    INSDC:x2na:bin out_key_bin
-        = < INSDC:dna:text, INSDC:x2na:bin > map < INSDC:x2na:map:CHARSET, INSDC:x2na:map:BINSET > ( out_key_sequence );
-    INSDC:x2na:bin out_linker_bin
-        = < INSDC:dna:text, INSDC:x2na:bin > map < INSDC:x2na:map:CHARSET, INSDC:x2na:map:BINSET > ( out_linker_sequence );
-
-    /* SIGNAL
-     *  single channel integer
-     */
-    column NCBI:isamp1 SIGNAL = out_signal;
-    NCBI:isamp1 out_signal = .SIGNAL;
-
-
-	/* INSDC:tbl:sequence inherited productions
-	 *  cs_native
-	 *  out_cs_key
-	 *  in_dna_text
-	 *  out_2cs_bin
-	 *  out_2na_bin
-	 *  out_4na_bin
-	 *  out_dna_text
-	 *  out_x2cs_bin
-	 *  out_x2na_bin
-	 *  out_2cs_packed
-	 *  out_2na_packed
-	 *  out_4na_packed
-	 *  out_color_text
-	 *  out_qual_phred
-	 *  out_color_matrix
-	 */
-
-	/* INSDC:SRA:tbl:spotname inherited productions
-	 *  out_x_coord
-	 *  out_y_coord
-	 *  out_name_fmt
-	 *  out_spot_name
-	 *  spot_ids_found
-	 */
-
-	/* INSDC:SRA:tbl:spotdesc inherited productions
-	 *  trim_len
-	 *  out_label
-	 *  out_nreads
-	 *  trim_start
-	 *  out_read_len
-	 *  out_label_len
-	 *  out_rd_filter
-	 *  out_read_type
-	 *  out_read_start
-	 *  out_label_start
-	 *  static_fixed_spot_len
-	 */
-
-	/* INSDC:SRA:tbl:stats inherited productions
-	 *  base_count
-	 *  spot_count
-	 *  max_spot_id
-	 *  min_spot_id
-	 *  in_stats_bin
-	 *  bio_base_count
-	 */
-
-	/* NCBI:tbl:n_encoding inherited productions
-	 *  read_unpack
-	 */
-
-	/* NCBI:SRA:_454_:common productions
-	 *  .SIGNAL
-	 *  .CLIP_ADAPTER_LEFT
-	 *  .CLIP_QUALITY_LEFT
-	 *  .CLIP_ADAPTER_RIGHT
-	 *  .CLIP_QUALITY_RIGHT
-	 *  out_flow_chars
-	 *  out_key_sequence
-	 *  out_linker_sequence
-	 */
-};
-
-
-/*--------------------------------------------------------------------------
- * NCBI:SRA:_454_:tbl:v2
- *  Roche 454 SRA Platform
- *
- * history:
- *  1.0.1 - explictly base upon sra #1.0.1 and related changes
- *  1.0.2 - respond to change to 454:common base table #1.0.2
- */
-
-// encodings are declared to have their own version
-// so that they may be changed over time independently
-physical INSDC:coord:one NCBI:SRA:_454_:encoding:CLIP #2
-{
-    decode { return ( INSDC:coord:one ) iunzip ( @ ); }
-    encode { return izip ( @ ); }
-}
-
-physical NCBI:isamp1 NCBI:SRA:_454_:encoding:SIGNAL #2
-{
-    decode { return ( NCBI:isamp1 ) iunzip ( @ ); }
-    encode { return izip ( @ ); }
-}
-
-physical INSDC:position:one NCBI:SRA:_454_:encoding:POSITION #2
-{
-    decode
-    {
-        I32 pos_1st_deriv = iunzip ( @ );
-        return ( INSDC:position:one ) < I32 > integral ( pos_1st_deriv );
-    }
-    encode
-    { 
-        I32 pos_1st_deriv = < I32 > deriv ( @ );
-        return izip ( pos_1st_deriv ); 
-    }
-}
-
-/* normalized v2 table
- *
- * history:
- *  1.0.6 - base upon updated ancestry
- *  1.0.7 - base upon updated ancestry
- */
-table NCBI:SRA:_454_:tbl:v2 #1.0.7
-    = NCBI:SRA:tbl:sra_nopos #2.1.3
-    , NCBI:tbl:base_space #2.0.3
-    , NCBI:tbl:phred_quality #2.0.3
-    , NCBI:SRA:_454_:common #1.0.4
-{
-    /* NAME tokenizing and coordinates
-     *  most work happens in skeyname table
-     *  we still obtain REGION from name
-     */
-    readonly column INSDC:coord:val REGION = ( INSDC:coord:val )
-        NCBI:SRA:extract_name_coord < NCBI:SRA:name_token:T > ( _out_name, out_spot_name_tok );
-    NCBI:SRA:spot_name_token out_spot_name_tok
-        = NCBI:SRA:_454_:tokenize_spot_name ( _out_name );
-
-    NCBI:SRA:spot_name_token in_spot_name_tok
-        = NCBI:SRA:_454_:tokenize_spot_name ( NAME );
-
-    // special sequences
-    INSDC:dna:text out_flow_chars
-        = .FLOW_CHARS
-        | < INSDC:dna:text > echo < 'TACG' > ( .SIGNAL )
-        | < INSDC:dna:text > echo < 'TACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACG' > ();
-
-    physical column < INSDC:dna:text > zip_encoding
-        .FLOW_CHARS = in_flow_chars;
-
-    INSDC:dna:text out_key_sequence
-        = .KEY_SEQUENCE
-        | < INSDC:dna:text > echo < 'TCAG' > ();
-
-    physical column < INSDC:dna:text > zip_encoding
-        .KEY_SEQUENCE = in_key_sequence;
-
-    INSDC:dna:text out_linker_sequence = .LINKER_SEQUENCE;
-    physical column < INSDC:dna:text > zip_encoding
-        .LINKER_SEQUENCE = in_linker_sequence;
-
-// linker needs to be representable by its own table
-// either in metadata or somewhere else
-
-    // position stored as normal 1-based coordinate
-    INSDC:position:one out_position = .POSITION;
-    physical column NCBI:SRA:_454_:encoding:POSITION #2
-        .POSITION = POSITION;
-
-    // clips
-    physical column NCBI:SRA:_454_:encoding:CLIP #2
-        .CLIP_ADAPTER_LEFT = CLIP_ADAPTER_LEFT;
-    physical column NCBI:SRA:_454_:encoding:CLIP #2
-        .CLIP_ADAPTER_RIGHT = CLIP_ADAPTER_RIGHT;
-    physical column NCBI:SRA:_454_:encoding:CLIP #2
-        .CLIP_QUALITY_LEFT = CLIP_QUALITY_LEFT;
-    physical column NCBI:SRA:_454_:encoding:CLIP #2
-        .CLIP_QUALITY_RIGHT = CLIP_QUALITY_RIGHT;
-
-    // signal
-    physical column NCBI:SRA:_454_:encoding:SIGNAL #2
-        .SIGNAL = SIGNAL;
-};
diff --git a/interfaces/sra/abi.h b/interfaces/sra/abi.h
deleted file mode 100644
index 5fdc108..0000000
--- a/interfaces/sra/abi.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifndef _h_sra_abi_
-#define _h_sra_abi_
-
-#ifndef _h_sra_rd_extern_
-#include <sra/rd-extern.h>
-#endif
-
-#ifndef _h_sra_sradb_
-#include <sra/sradb.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * AbsolidReader
- */
-typedef struct AbsolidReader AbsolidReader;
-
-/* Make
- *  create AbsolidReader reference based
- *  on opened table and properties:
- *     table      - SRATable
- *     accession  - accession
- *     minReadLen - minimal length of the outputed read, 0 - no minimum (FUSE)
- *     origFormat - excludes SRR accession & length on defline
- *     noclip     - don't clip quality left and right
- *     minSpotId  - starting spot id, 0 - ignored (run information used)
- *     maxSpotId  - ending spot id, 0 - ignored (run information used)
- *                  you cannot seek out of range of [minSpotId:maxSpotId]
- */
-SRA_RD_EXTERN rc_t CC AbsolidReaderMake(const AbsolidReader** self, const SRATable* table,
-                                        const char* accession, bool origFormat,
-                                        bool noClip, uint32_t minReadLen,
-                                        spotid_t minSpotId, spotid_t maxSpotId, bool signal);
-
-/* Whack
- *  releases object obtained from AbsolidReaderMake
- */
-SRA_RD_EXTERN rc_t CC AbsolidReaderWhack(const AbsolidReader* self);
-
-/* FirstSpot
- *  set current spot to first in the run
- */
-SRA_RD_EXTERN rc_t CC AbsolidReaderFirstSpot(const AbsolidReader* self);
-
-/* SeekSpot
- *  set current spot
- * if error occured current spot position becomes 0
- */
-SRA_RD_EXTERN rc_t CC AbsolidReaderSeekSpot(const AbsolidReader* self, spotid_t spot);
-
-/* NextSpot
- *  Seek to next spot from current
- */
-SRA_RD_EXTERN rc_t CC AbsolidReaderNextSpot(const AbsolidReader* self);
-
-/* CurrentSpot
- *  Get current spot
- *  sopt [OUT] - pointer to assign value of the current spot
- * returns GetRCState(rc) == rcExhausted when out of spots
- */
-SRA_RD_EXTERN rc_t CC AbsolidReaderCurrentSpot(const AbsolidReader* self, spotid_t* spot);
-
-/* SpotInfo
- *  Get current spot information
- *  spotname [OUT] - pointer to assign value of the current spot name (can be NULL)
- *  spotname_sz [OUT] - pointer to assign value of the length of the spot name (can be NULL)
- *  spot_len [OUT] - pointer to assign value of the current spot length (can be NULL)
- *  num_reads[OUT] - pointer to assign value of the number of reads in current spot (can be NULL)
- */
-SRA_RD_EXTERN rc_t CC AbsolidReader_SpotInfo(const AbsolidReader* self,
-                                             const char** spotname, size_t* spotname_sz,
-                                             uint32_t* spot_len, uint32_t* num_reads);
-/* SpotReadInfo
- *  Get read information for current spot
- *  readid    [IN]  - 1-based read id
- *  read_type [OUT] - pointer to assign value of the read type (can be NULL)
- *  read_label[OUT] - pointer to assign value of the read label (can be NULL)
- *  read_label_sz [OUT] - pointer to assign value of the length of the read label (can be NULL)
- *  read_start[OUT] - pointer to assign value of the read start in spot (can be NULL)
- *  read_len  [OUT] - pointer to assign value of the read length (can be NULL)
- *  cskey     [OUT] - pointer to assign value of the read color space key (can be NULL)
- *  if start and len is == 0 read is empty
- */
-SRA_RD_EXTERN rc_t CC AbsolidReader_SpotReadInfo(const AbsolidReader* self, uint32_t readId, SRAReadTypes* read_type, 
-                                                 const char** read_label, INSDC_coord_len* read_label_sz,
-                                                 INSDC_coord_zero* read_start, INSDC_coord_len* read_len);
-
-/* SpotPrefix
- *  retrieve current spot name prefix
- *  prefix [OUT] - pointer to assign value of the spot name prefix
- *  prefix_sz [OUT] - pointer to assign value of the length of the spot name prefix
- */
-SRA_RD_EXTERN rc_t CC AbsolidReaderSpotName(const AbsolidReader* self,
-                                            const char** prefix, size_t* prefix_sz,
-                                            const char** suffix, size_t* suffix_sz);
-
-/* BaseName
- *  retrieve name string for the spot, result always has '\0' at the and (asciiz string)
- *  readid [IN] - 1-based, if <= 0 than the whole spot, otherwise particular read
- *  label  [IN] - overrides read label appending (printLabel), set to NULL by default
- *  data   [IN] - pointer to buffer for printing
- *  dsize  [IN] - data buffer size
- *  written [IN,OUT] - optional number of bytes occupied by string
- *                     (not including the trailing '\0' used to end output), may by more than dsize
- */
-SRA_RD_EXTERN rc_t CC AbsolidReaderHeader(const AbsolidReader* self, uint32_t readId,
-                                          char* data, size_t dsize, size_t* written);
-
-/* Base
- *  retrieve bases for the spot
- *  other parameters see description for AbsolidReaderBaseName above
- */
-SRA_RD_EXTERN rc_t CC AbsolidReaderBase(const AbsolidReader* self, uint32_t readId,
-                                        char* data, size_t dsize, size_t* written);
-
-/* Quality
- *  retrieve quality string for the spot
- *  other parameters see description for AbsolidReaderBaseName above
- */
-SRA_RD_EXTERN rc_t CC AbsolidReaderQuality(const AbsolidReader* self, uint32_t readId,
-                                           char* data, size_t dsize, size_t* written);
-
-/* Signals
- *  retrieve signal string for the spot
- *  other parameters see description for AbsolidReaderBaseName above
- */
-SRA_RD_EXTERN rc_t CC AbsolidReaderSignalFTC(const AbsolidReader* self, uint32_t readId,
-                                             char* data, size_t dsize, size_t* written);
-SRA_RD_EXTERN rc_t CC AbsolidReaderSignalCY3(const AbsolidReader* self, uint32_t readId,
-                                             char* data, size_t dsize, size_t* written);
-SRA_RD_EXTERN rc_t CC AbsolidReaderSignalTXR(const AbsolidReader* self, uint32_t readId,
-                                             char* data, size_t dsize, size_t* written);
-SRA_RD_EXTERN rc_t CC AbsolidReaderSignalCY5(const AbsolidReader* self, uint32_t readId,
-                                             char* data, size_t dsize, size_t* written);
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_sra_abi_ */
diff --git a/interfaces/sra/abi.vschema b/interfaces/sra/abi.vschema
deleted file mode 100644
index dbdfa12..0000000
--- a/interfaces/sra/abi.vschema
+++ /dev/null
@@ -1,241 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/*==========================================================================
- * NCBI ABI Sequence Read Archive schema
- */
-version 1;
-
-include 'ncbi/sra.vschema';
-include 'ncbi/spotname.vschema';
-
-
-/*--------------------------------------------------------------------------
- * NCBI:SRA:ABI
- *  ABI SRA Platform
- */
-
-/* tokenize_spot_name
- *  scans name on input
- *  tokenizes into parts
- */
-extern function NCBI:SRA:spot_name_token
-    NCBI:SRA:ABI:tokenize_spot_name #1 ( ascii name );
-
-
-/* NCBI:SRA:ABI:common
- *  basic table interface based upon ABI's pipelines
- *
- * history:
- *  1.0.1 - base explicitly upon changes to sra #1.0.1
- *  1.0.2 - base explicitly upon sra #1.0.2
- *  1.0.3 - base explicitly upon sra #1.0.3
- */
-table NCBI:SRA:ABI:common #1.0.3 = INSDC:SRA:tbl:sra #1.0.3
-{
-    // platform name is always 'ABSOLID'
-    ascii platform_name
-        = < ascii > echo < "ABSOLID" > ();
-
-    /* TRIMMED SEQUENCE
-     *  need to find the 0-based trim_start and trim_len
-     */
-    INSDC:coord:zero bio_start = NCBI:SRA:bio_start ( out_read_start, out_read_type );
-    INSDC:coord:zero trim_start = bio_start;
-    U32 trim_left = ( U32 ) trim_start;
-    INSDC:coord:len trim_len = ( INSDC:coord:len ) < U32 > diff ( spot_len, trim_left );
-
-    /* COORDINATES
-     *  in addition to X and Y,
-     *  ABI has PANEL
-     */
-    column INSDC:coord:val PANEL = out_panel_coord;
-
-    // signal
-    column NCBI:fsamp4 SIGNAL
-        = out_signal;
-
-    NCBI:fsamp4 out_signal = ( NCBI:fsamp4 )
-        < NCBI:SRA:swapped_fsamp4 > NCBI:SRA:swap ( out_signal_swapped, out_x2cs_bin );
-
-
-	/* INSDC:tbl:sequence inherited productions
-	 *  cs_native
-	 *  in_cs_key
-	 *  out_cs_key
-	 *  out_signal_swapped
-	 *  out_2cs_bin
-	 *  out_2na_bin
-	 *  out_4na_bin
-	 *  out_dna_text
-	 *  out_x2cs_bin
-	 *  out_x2na_bin
-	 *  in_color_text
-	 *  out_2cs_packed
-	 *  out_2na_packed
-	 *  out_4na_packed
-	 *  out_color_text
-	 *  out_qual_phred
-	 *  out_color_matrix
-	 */
-
-	/* INSDC:SRA:tbl:spotname inherited productions
-	 *  out_x_coord
-	 *  out_y_coord
-	 *  out_name_fmt
-	 *  out_spot_name
-	 *  spot_ids_found
-	 */
-
-	/* INSDC:SRA:tbl:spotdesc inherited productions
-	 *  out_label
-	 *  out_nreads
-	 *  out_read_len
-	 *  out_label_len
-	 *  out_rd_filter
-	 *  out_read_type
-	 *  out_read_start
-	 *  out_label_start
-	 *  static_fixed_spot_len
-	 */
-
-	/* INSDC:SRA:tbl:stats inherited productions
-	 *  base_count
-	 *  spot_count
-	 *  max_spot_id
-	 *  min_spot_id
-	 *  in_stats_bin
-	 *  bio_base_count
-	 */
-
-	/* INSDC:SRA:tbl:sra inherited productions
-	 *  out_platform
-	 */
-
-	/* NCBI:SRA:ABI:common productions
-	 *  out_panel_coord
-	 */
-};
-
-
-/* NCBI:SRA:ABI:tbl:v2 #1
- *  normalized v2 table
- *
- * history:
- *  1.0.1 - changes to sra #1.0.1
- *  1.0.2 - changes to common #1.0.2
- *  1.0.3 - sra #2.1.2, color_space #2.0.2, common #1.0.3
- *  1.0.4 - updated ancestry
- */
-physical NCBI:SRA:swapped_fsamp4 NCBI:SRA:ABI:encoding:SIGNAL #2
-{
-    decode { return NCBI:SRA:fsamp4:decode #2 ( @ ); }
-    encode { return NCBI:SRA:fsamp4:encode #2 < 14, 10 > ( @ ); }
-}
-
-table NCBI:SRA:ABI:tbl:v2 #1.0.4
-    = NCBI:SRA:tbl:sra #2.1.3
-    , NCBI:tbl:color_space #2.1.0
-    , NCBI:tbl:phred_quality #2.0.3
-    , NCBI:SRA:ABI:common #1.0.3
-{
-    /* NAME tokenizing and coordinates
-     *  most work happens in skeyname table
-     *  we still obtain PANEL from name
-     */
-    INSDC:coord:val out_panel_coord = ( INSDC:coord:val )
-        NCBI:SRA:extract_name_coord < NCBI:SRA:name_token:T > ( _out_name, out_spot_name_tok );
-    NCBI:SRA:spot_name_token out_spot_name_tok
-        = NCBI:SRA:ABI:tokenize_spot_name ( _out_name );
-
-    NCBI:SRA:spot_name_token in_spot_name_tok
-        = NCBI:SRA:ABI:tokenize_spot_name ( NAME );
-
-
-    /* SIGNAL
-     *  optional, no longer archived
-     */
-
-    // support for individual color inputs
-    extern column NCBI:fsamp1 FTC
-    {
-        read = out_ftc;
-        validate = < F32 > no_compare #1 ( in_ftc, out_ftc );
-    }
-    NCBI:fsamp1 in_ftc = FTC;
-    NCBI:fsamp1 out_ftc
-        = ( NCBI:fsamp1 ) < F32 > cut < 0 > ( out_signal );
-
-    extern column NCBI:fsamp1 FAM
-    {
-        read = out_fam;
-        validate = < F32 > no_compare #1 ( in_fam, out_fam );
-    }
-    NCBI:fsamp1 in_fam = FAM;
-    NCBI:fsamp1 out_fam
-        = ( NCBI:fsamp1 ) < F32 > cut < 0 > ( out_signal );
-
-    extern column NCBI:fsamp1 CY3
-    {
-        read = out_cy3;
-        validate = < F32 > no_compare #1 ( in_cy3, out_cy3 );
-    }
-    NCBI:fsamp1 in_cy3 = CY3;
-    NCBI:fsamp1 out_cy3
-        = ( NCBI:fsamp1 ) < F32 > cut < 1 > ( out_signal );
-
-    extern column NCBI:fsamp1 TXR
-    {
-        read = out_txr;
-        validate = < F32 > no_compare #1 ( in_txr, out_txr );
-    }
-    NCBI:fsamp1 in_txr = TXR;
-    NCBI:fsamp1 out_txr
-        = ( NCBI:fsamp1 ) < F32 > cut < 2 > ( out_signal );
-
-    extern column NCBI:fsamp1 CY5
-    {
-        read = out_cy5;
-        validate = < F32 > no_compare #1 ( in_cy5, out_cy5 );
-    }
-    NCBI:fsamp1 in_cy5 = CY5;
-    NCBI:fsamp1 out_cy5
-        = ( NCBI:fsamp1 ) < F32 > cut < 3 > ( out_signal );
-
-    // intermediate input (writing) production
-    NCBI:fsamp4 in_signal
-        = SIGNAL
-        | ( NCBI:fsamp4 ) < F32 > paste ( in_ftc, in_cy3, in_txr, in_cy5 )
-        | ( NCBI:fsamp4 ) < F32 > paste ( in_fam, in_cy3, in_txr, in_cy5 );
-
-    // overridden output production
-    NCBI:SRA:swapped_fsamp4 out_signal_swapped = .SIGNAL;
-
-    // rule for writing SIGNAL
-    physical column NCBI:SRA:ABI:encoding:SIGNAL #2 .SIGNAL
-        = ( NCBI:SRA:swapped_fsamp4 ) < NCBI:fsamp4 > NCBI:SRA:swap ( in_signal, in_x2cs_bin )
-        | ( NCBI:SRA:swapped_fsamp4 ) < NCBI:fsamp4 > NCBI:SRA:swap ( in_signal, in_2cs_bin );
-};
diff --git a/interfaces/sra/extern.h b/interfaces/sra/extern.h
deleted file mode 100644
index aa32b37..0000000
--- a/interfaces/sra/extern.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_sra_extern_
-#define _h_sra_extern_
-
-#if ! defined EXPORT_LATCH && defined _LIBRARY
-#define SRA_EXTERN LIB_EXPORT
-#define EXPORT_LATCH 1
-#else
-#define SRA_EXTERN LIB_IMPORT
-#endif
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#endif /* _h_sra_extern_ */
diff --git a/interfaces/sra/fastq.h b/interfaces/sra/fastq.h
deleted file mode 100644
index b53c3b3..0000000
--- a/interfaces/sra/fastq.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifndef _h_sra_fastq_
-#define _h_sra_fastq_
-
-#ifndef _h_sra_rd_extern_
-#include <sra/rd-extern.h>
-#endif
-
-#ifndef _h_sra_sradb_
-#include <sra/sradb.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * FastqReader
- */
-typedef struct FastqReader FastqReader;
-
-/* Make
- *  create FastqReader reference based
- *  on opened table and properties:
- *     table      - SRATable
- *     accession  - accession
- *     minReadLen - minimal length of the outputed read, 0 - no minimum (FUSE)
- *     colorSpace - color space sequence
- *     origFormat - excludes SRR accession & length on defline
- *     fasta      - prepare only reads, no qualities
- *     readLabel  - prints read label on the name line
- *     readId     - prints .read in spot id on the name line (not in origFormat)
- *     noclip     - don't clip quality left and right
- *     offset     - offset to use for quality conversion (default is 33)
- *     csKey      - desired color space key, '\0' - do not convert
- *     minSpotId  - starting spot id, 0 - ignored (run information used)
- *     maxSpotId  - ending spot id, 0 - ignored (run information used)
- *                  you cannot seek out of range of [minSpotId:maxSpotId]
- */
-SRA_RD_EXTERN rc_t CC FastqReaderMake(const FastqReader** self, const SRATable* table, const char* accession,
-                                      bool colorSpace, bool origFormat, bool fasta,
-                                      bool printLabel, bool printReadId,
-                                      bool noClip, bool SuppressQualForCSKey, uint32_t minReadLen,
-                                      char offset, char csKey,
-                                      spotid_t minSpotId, spotid_t maxSpotId);
-
-/* Whack
- *  releases object obtained from FastqReaderMake
- */
-SRA_RD_EXTERN rc_t CC FastqReaderWhack(const FastqReader* self);
-
-/* FirstSpot
- *  set current spot to first in the run
- */
-SRA_RD_EXTERN rc_t CC FastqReaderFirstSpot(const FastqReader* self);
-
-/* SeekSpot
- *  set current spot
- * if error occured current spot position becomes 0
- */
-SRA_RD_EXTERN rc_t CC FastqReaderSeekSpot(const FastqReader* self, spotid_t spot);
-
-/* NextSpot
- *  Seek to next spot from current
- */
-SRA_RD_EXTERN rc_t CC FastqReaderNextSpot(const FastqReader* self);
-
-/* CurrentSpot
- *  Get current spot
- *  sopt [OUT] - pointer to assign value of the current spot
- * returns GetRCState(rc) == rcExhausted when out of spots
- */
-SRA_RD_EXTERN rc_t CC FastqReaderCurrentSpot(const FastqReader* self, spotid_t* spot);
-
-/* SpotInfo
- *  Get current spot information
- *  spotname [OUT] - pointer to assign value of the current spot name (can be NULL)
- *  spotname_sz [OUT] - pointer to assign value of the length of the spot name (can be NULL)
- *  spotgroup [OUT] - pointer to assign value of the current spot group (can be NULL)
- *  spotgroup_sz [OUT] - pointer to assign value of the length of the spot group (can be NULL)
- *  spot_len [OUT] - pointer to assign value of the current spot length (can be NULL)
- *  num_reads[OUT] - pointer to assign value of the number of reads in current spot (can be NULL)
- */
-SRA_RD_EXTERN rc_t CC FastqReader_SpotInfo(const FastqReader* self,
-                                           const char** spotname, size_t* spotname_sz,
-                                           const char** spotgroup, size_t* spotgroup_sz,
-                                           uint32_t* spot_len, uint32_t* num_reads);
-
-/* SpotReadInfo
- *  Get read information for current spot
- *  readid    [IN]  - 1-based read id
- *  read_type [OUT] - pointer to assign value of the read type (can be NULL)
- *  read_label[OUT] - pointer to assign value of the read label (can be NULL)
- *  read_label_sz [OUT] - pointer to assign value of the length of the read label (can be NULL)
- *  read_start[OUT] - pointer to assign value of the read start in spot (can be NULL)
- *  read_len  [OUT] - pointer to assign value of the read length (can be NULL)
- *  cskey     [OUT] - pointer to assign value of the read color space key (can be NULL)
- *  if start and len is == 0 read is empty
- */
-SRA_RD_EXTERN rc_t CC FastqReader_SpotReadInfo(const FastqReader* self, uint32_t readId, SRAReadTypes* read_type, 
-                                               const char** read_label, INSDC_coord_len* read_label_sz,
-                                               INSDC_coord_zero* read_start, INSDC_coord_len* read_len);
-
-/* BaseName
- *  retrieve name string for the spot, result always has '\0' at the and (asciiz string)
- *  readid [IN] - 1-based, if <= 0 than the whole spot, otherwise particular read
- *  label  [IN] - overrides read label appending (printLabel), set to NULL by default
- *  data   [IN] - pointer to buffer for printing
- *  dsize  [IN] - data buffer size
- *  written [IN,OUT] - optional number of bytes occupied by string
- *                     (not including the trailing '\0' used to end output), may by more than dsize
- */
-SRA_RD_EXTERN rc_t CC FastqReaderBaseName(const FastqReader* self, uint32_t readId,
-                                          bool* label, char* data, size_t dsize, size_t* written);
-
-/* Base
- *  retrieve bases for the spot
- *  other parameters see description for FastqReaderBaseName above
- */
-SRA_RD_EXTERN rc_t CC FastqReaderBase(const FastqReader* self, uint32_t readId,
-                                      char* data, size_t dsize, size_t* written);
-
-/* QualityName
- *  retrieve quality name string for the spot
- *  other parameters see description for FastqReaderBaseName above
- */
-SRA_RD_EXTERN rc_t CC FastqReaderQualityName(const FastqReader* self, uint32_t readId,
-                                             bool* label, char* data, size_t dsize, size_t* written);
-
-/* Quality
- *  retrieve quality string for the spot
- *  other parameters see description for FastqReaderBaseName above
- */
-SRA_RD_EXTERN rc_t CC FastqReaderQuality(const FastqReader* self, uint32_t readId,
-                                         char* data, size_t dsize, size_t* written);
-
-/* GetCurrentSpotData
- *  retrieve current spot data as a blob
- *  other parameters see description for FastqReaderBaseName above
- */
-SRA_RD_EXTERN rc_t CC FastqReader_GetCurrentSpotData(const FastqReader* self,
-                                                     char* data, size_t dsize, size_t* written);
-
-/* GetCurrentSpotSplitData
- * same as above but split spot into line with individual reads
- */
-SRA_RD_EXTERN rc_t CC FastqReader_GetCurrentSpotSplitData(const FastqReader* self,
-                                                          char* data, size_t dsize, size_t* written);
-
-/* GetNextSpotData (streaming function)
- *  move to the next spot and retrieve current spot data as a blob
- *  other parameters see description for FastqReaderBaseName above
- */
-SRA_RD_EXTERN rc_t CC FastqReader_GetNextSpotData(const FastqReader* self,
-                                                  char* data, size_t dsize, size_t* written);
-
-/* GetNextSpotSplitData (streaming function)
- * same as above but split spot into line with individual reads
- */
-SRA_RD_EXTERN rc_t CC FastqReader_GetNextSpotSplitData(const FastqReader* self,
-                                                       char* data, size_t dsize, size_t* written);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_sra_fastq_ */
diff --git a/interfaces/sra/helicos.vschema b/interfaces/sra/helicos.vschema
deleted file mode 100644
index e758a0b..0000000
--- a/interfaces/sra/helicos.vschema
+++ /dev/null
@@ -1,85 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/*==========================================================================
- * NCBI Helicos Sequence Read Archive schema
- */
-version 1;
-
-include 'ncbi/sra.vschema';
-include 'ncbi/spotname.vschema';
-
-
-/*--------------------------------------------------------------------------
- * functions
- */
-
-/* tokenize_spot_name
- *  scans name on input
- *  tokenizes into parts
- */
-extern function NCBI:SRA:spot_name_token
-    NCBI:SRA:Helicos:tokenize_spot_name #1 ( ascii name );
-
-
-/* Helicos:tbl
- *
- * history:
- *  1.0.1 - explictly base upon ancestry
- *  1.0.2 - base explicitly upon latest ancestry
- *  1.0.3 - base explicitly upon latest ancestry
- *  1.0.4 - base explicitly upon latest ancestry
- */
-table NCBI:SRA:Helicos:tbl:v2 #1.0.4
-    = NCBI:SRA:tbl:sra #2.1.3
-    , NCBI:tbl:base_space #2.0.3
-    , NCBI:tbl:phred_quality #2.0.3
-{
-    ascii platform_name
-        = < ascii > echo < "HELICOS" > ();
-
-    /* NAME tokenizing and coordinates
-     *  most work happens in skeyname table
-     *  we still obtain REGION from name
-     */
-
-    readonly column INSDC:coord:val CHANNEL = ( INSDC:coord:val )
-        NCBI:SRA:extract_name_coord < NCBI:SRA:name_token:L > ( _out_name, out_spot_name_tok );
-    readonly column INSDC:coord:val FIELD = ( INSDC:coord:val )
-        NCBI:SRA:extract_name_coord < NCBI:SRA:name_token:T > ( _out_name, out_spot_name_tok );
-    NCBI:SRA:spot_name_token out_spot_name_tok
-        = NCBI:SRA:Helicos:tokenize_spot_name ( _out_name );
-
-    readonly column INSDC:coord:val CAMERA = out_x_coord;
-    readonly column INSDC:coord:val POS = out_y_coord;
-
-    NCBI:SRA:spot_name_token in_spot_name_tok
-        = NCBI:SRA:Helicos:tokenize_spot_name ( NAME );
-
-    INSDC:coord:zero trim_start
-        = < INSDC:coord:zero > echo < 0 > ();
-    INSDC:coord:len trim_len = spot_len;
-};
diff --git a/interfaces/sra/illumina.h b/interfaces/sra/illumina.h
deleted file mode 100644
index 73062f8..0000000
--- a/interfaces/sra/illumina.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifndef _h_sra_illumina_
-#define _h_sra_illumina_
-
-#ifndef _h_sra_rd_extern_
-#include <sra/rd-extern.h>
-#endif
-
-#ifndef _h_sra_sradb_
-#include <sra/sradb.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * IlluminaReader
- */
-typedef struct IlluminaReader IlluminaReader;
-
-/* Make
- *  create IlluminaReader reference based
- *  on opened table and properties:
- *     table      - SRATable
- *     accession  - accession
- *     read       - output reads
- *     qual1      - output quality1
- *     qual4      - output quality4
- *     intensity  - output intensity
- *     noise      - output noise
- *     signal     - output signal
- *     qseq       - output QSEQ format
- *     minSpotId  - starting spot id, 0 - ignored (run information used)
- *     maxSpotId  - ending spot id, 0 - ignored (run information used)
- *                  you cannot seek out of range of [minSpotId:maxSpotId]
- */
-SRA_RD_EXTERN rc_t CC IlluminaReaderMake(const IlluminaReader** self, const SRATable* table, const char* accession,
-                                         bool read, bool qual1, bool qual4,
-                                         bool intensity, bool noise, bool signal, bool qseq,
-                                         spotid_t minSpotId, spotid_t maxSpotId);
-/* Whack
- *  releases object obtained from IlluminaReaderMake
- */
-SRA_RD_EXTERN rc_t CC IlluminaReaderWhack(const IlluminaReader* self);
-
-/* FirstSpot
- *  set current spot to first in the run
- */
-SRA_RD_EXTERN rc_t CC IlluminaReaderFirstSpot(const IlluminaReader* self);
-
-/* SeekSpot
- *  set current spot
- * if error occured current spot position becomes 0
- */
-SRA_RD_EXTERN rc_t CC IlluminaReaderSeekSpot(const IlluminaReader* self, spotid_t spot);
-
-/* NextSpot
- *  Seek to next spot from current
- */
-SRA_RD_EXTERN rc_t CC IlluminaReaderNextSpot(const IlluminaReader* self);
-
-/* CurrentSpot
- *  Get current spot
- *  sopt [OUT] - pointer to assign value of the current spot
- * returns GetRCState(rc) == rcExhausted when out of spots
- */
-SRA_RD_EXTERN rc_t CC IlluminaReaderCurrentSpot(const IlluminaReader* self, spotid_t *spot);
-
-/* SpotInfo
- *  Get current spot information
- *  spotname [OUT] - pointer to assign value of the current spot name (can be NULL)
- *  spot_len [OUT] - pointer to assign value of the current spot length (can be NULL)
- *  num_reads[OUT] - pointer to assign value of the number of reads in current spot (can be NULL)
- */
-SRA_RD_EXTERN rc_t CC IlluminaReader_SpotInfo(const IlluminaReader* self,
-                                              const char** spotname, size_t* spotname_sz,
-                                              INSDC_coord_val* lane, INSDC_coord_val* tile, 
-                                              INSDC_coord_val* x, INSDC_coord_val* y,
-                                              uint32_t* spot_len, uint32_t* num_reads);
-/* SpotReadInfo
- *  Get read information for current spot
- *  readid    [IN]  - 1-based read id
- *  read_label[OUT] - pointer to assign value of the read label (can be NULL)
- *  read_type [OUT] - pointer to assign value of the read type (can be NULL)
- *  read_start[OUT] - pointer to assign value of the read start in spot (can be NULL)
- *  read_len  [OUT] - pointer to assign value of the read length (can be NULL)
- *  cskey     [OUT] - pointer to assign value of the read color space key (can be NULL)
- *  if start and len is == 0 read is empty
- */
-SRA_RD_EXTERN rc_t CC IlluminaReader_SpotReadInfo(const IlluminaReader* self, uint32_t readId, SRAReadTypes* read_type,
-                                                  const char** read_label, INSDC_coord_len* read_label_sz,
-                                                  INSDC_coord_zero* read_start, INSDC_coord_len* read_len);
-
-/* Base
- *  retrieve bases for the spot, result always has '\0' at the and (asciiz string)
- *  data   [IN] - pointer to buffer for printing
- *  dsize  [IN] - data buffer size
- *  written [IN,OUT] - optional number of bytes occupied by string
- *                     (not including the trailing '\0' used to end output), may by more than dsize
- */
-SRA_RD_EXTERN rc_t CC IlluminaReaderBase(const IlluminaReader* self, char* data, size_t dsize, size_t* written);
-
-/* Noise
- *  retrieve noise in 4 floats per base format
- *  other parameters see description for IlluminaReaderBase above
- */
-SRA_RD_EXTERN rc_t CC IlluminaReaderNoise(const IlluminaReader* self, char* data, size_t dsize, size_t* written);
-
-/* Intensity
- *  retrieve intensity in 4 floats per base format
- *  other parameters see description for IlluminaReaderBase above
- */
-SRA_RD_EXTERN rc_t CC IlluminaReaderIntensity(const IlluminaReader* self, char* data, size_t dsize, size_t* written);
-
-/* Signal
- *  retrieve signal in 4 floats per base format
- *  other parameters see description for IlluminaReaderBase above
- */
-SRA_RD_EXTERN rc_t CC IlluminaReaderSignal(const IlluminaReader* self, char* data, size_t dsize, size_t* written);
-
-/* Quality (BINARY)
- *  retrieve quality as single bytes per bases
- *  readid [IN] - 1-based, if <= 0 than the whole spot, otherwise particular read
- *  other parameters see description for IlluminaReaderBase above
- */
-SRA_RD_EXTERN rc_t CC IlluminaReaderQuality1(const IlluminaReader* self, uint32_t readId, char* data, size_t dsize, size_t* written);
-
-/* Quality
- *  retrieve quality in 4 integers per base format
- *  other parameters see description for IlluminaReaderBase above
- */
-SRA_RD_EXTERN rc_t CC IlluminaReaderQuality4(const IlluminaReader* self, char* data, size_t dsize, size_t* written);
-
-/* QSeq
- *  spot information as in QSEQ format
- *  other parameters see description for IlluminaReaderBase above
- */
-SRA_RD_EXTERN rc_t CC IlluminaReaderQSeq(const IlluminaReader* self, uint32_t readId, bool spot_group,
-                                         char* data, size_t dsize, size_t* written);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_sra_illumina_ */
diff --git a/interfaces/sra/illumina.vschema b/interfaces/sra/illumina.vschema
deleted file mode 100644
index af4dbe4..0000000
--- a/interfaces/sra/illumina.vschema
+++ /dev/null
@@ -1,403 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/*==========================================================================
- * NCBI Illumina Sequence Read Archive schema
- */
-version 1;
-
-include 'ncbi/sra.vschema';
-include 'ncbi/spotname.vschema';
-
-
-/*--------------------------------------------------------------------------
- * types
- */
-
-typedef INSDC:quality:log_odds NCBI:qual4 [ 4 ];
-typedef NCBI:qual4 NCBI:SRA:rotated_qual4, NCBI:SRA:swapped_qual4;
-
-
-/*--------------------------------------------------------------------------
- * functions
- */
-
-/* tokenize_spot_name
- *  scans name on input
- *  tokenizes into parts
- */
-extern function NCBI:SRA:spot_name_token
-    NCBI:SRA:Illumina:tokenize_spot_name #1 ( ascii name );
-
-
-/*--------------------------------------------------------------------------
- * NCBI:SRA:Illumina:qual4
- *  4-channel log-odds-ish quality
- */
-
-/* history:
- *  1.0.1 - base explicitly upon updated ancestry
- */
-table NCBI:SRA:Illumina:qual4_nocol #1.0.1
-    = INSDC:tbl:sequence #1.0.1
-    , NCBI:tbl:log_odds_quality_nocol #1.0.1
-{
-    /* QUALITY
-     *  4-channel quality column
-     */
-    readonly column NCBI:qual4 QUALITY = out_qual4;
-
-    NCBI:qual4 out_qual4
-        = < NCBI:qual4 > NCBI:SRA:swap ( out_qual4_swapped, read_unpack )
-        | < NCBI:qual4 > NCBI:SRA:rotate < false > ( out_qual4_rotated, read_unpack );
-
-
-    /* single-channel output
-     *  convert 4-channel log-odds to single channel
-     *  must retain n-encoding, which was intended to be the 4-channel pattern
-     *  ( -5, -5, -5, -5 ) and a base of 'A'
-     */
-
-    // first, extract quality for called base
-    INSDC:quality:log_odds out_qual1_ch0
-        = < INSDC:quality:log_odds> cut < 0 > ( out_qual4_swapped )
-        | < INSDC:quality:log_odds> cut < 0 > ( out_qual4_rotated );
-
-    // clip it to -5 and above
-    INSDC:quality:log_odds out_qual1_clip
-        = < INSDC:quality:log_odds > clip < -5, 127 > ( out_qual1_ch0 );
-
-    // convert 4 channel to single 32-bit value
-    U32 out_qual4_32
-        = redimension ( out_qual4_swapped )
-        | redimension ( out_qual4_rotated );
-
-    // detect ( -5, -5, -5, -5 ) and introduce a -6 value into log-odds
-    // this is treated as an 'N', but still not ready
-    INSDC:quality:log_odds out_qual1_fives
-        = < U32, INSDC:quality:log_odds > map < 0xFBFBFBFB, -6 > ( out_qual4_32, out_qual1_clip );
-
-    // now slam zeros into anything that doesn't correspond to an A
-    // essentially this leaves all of the A qualities. any having -6 are really N.
-    INSDC:quality:log_odds out_qual1_n
-        = < U8, INSDC:quality:log_odds > map < [ 1, 2, 3 ], [ 0, 0, 0 ] > ( read_unpack, out_qual1_fives );
-
-    // finally, produce log-odds with n-encoded as -6
-    INSDC:quality:log_odds out_qual_log_odds
-        = < INSDC:quality:log_odds, INSDC:quality:log_odds > map < -6, -6 > ( out_qual1_n, out_qual1_clip );
-
-
-	/* NCBI:tbl:n_encoding inherited productions
-	 *  read_unpack
-	 */
-
-	/* NCBI:SRA:Illumina:qual4_nocol productions
-	 *  out_qual4_rotated
-	 *  out_qual4_swapped
-	 */
-};
-
-
-/* 4-channel log-odds compression
- */
-
-// encoded type - a single byte code for 4-channel pattern
-typedef B8 NCBI:SRA:encoded_qual4;
-
-// decoding function
-extern function
-NCBI:SRA:swapped_qual4 NCBI:SRA:qual4_decode #1 ( NCBI:SRA:encoded_qual4 in );
-
-// encoding function
-extern function
-NCBI:SRA:encoded_qual4 NCBI:SRA:qual4_encode #1 ( NCBI:SRA:swapped_qual4 in );
-
-// compression rules
-physical NCBI:SRA:swapped_qual4 NCBI:SRA:qual4_encoding #1
-{
-    encode
-    {
-        // produce codes
-        NCBI:SRA:encoded_qual4 encoded = NCBI:SRA:qual4_encode ( @ );
-
-        // gzip
-        return zip < Z_RLE, Z_BEST_SPEED > ( encoded );
-    }
-
-    decode
-    {
-        // gunzip
-        NCBI:SRA:encoded_qual4 unzipped = unzip ( @ );
-        
-        // inflate to swapped
-        return NCBI:SRA:qual4_decode ( unzipped );
-    }
-}
-
-/* history:
- *  1.0.1 - base upon updated qual4_nocol
- */
-table NCBI:SRA:Illumina:qual4 #1.0.1 = NCBI:SRA:Illumina:qual4_nocol #1.0.1
-{
-    // read directly as swapped, n-encoded log_odds
-    NCBI:SRA:swapped_qual4 out_qual4_swapped = .QUALITY;
-
-	/* NCBI:tbl:n_encoding inherited virtual productions
-	 *  read_unpack
-	 */
-};
-
-/* history:
- *  2.0.2 - base upon updated ancestry
- *  2.0.3 - base upon updated ancestry
- *  2.0.4 - base upon updated ancestry
- */
-table NCBI:SRA:Illumina:qual4 #2.0.4
-    = NCBI:tbl:base_space #2.0.3
-    , NCBI:tbl:log_odds_quality_nocol #2.0.1
-{
-    /* QUALITY
-     *  4-channel log-odds
-     */
-    extern column NCBI:qual4 QUALITY = out_qual4;
-
-    NCBI:SRA:swapped_qual4 in_qual4
-        = ( NCBI:SRA:swapped_qual4 ) < NCBI:qual4 > NCBI:SRA:swap ( QUALITY, in_x2na_bin )
-        | ( NCBI:SRA:swapped_qual4 ) < NCBI:qual4 > NCBI:SRA:swap ( QUALITY, in_2na_bin );
-
-    NCBI:qual4 out_qual4
-        = < NCBI:SRA:swapped_qual4 > NCBI:SRA:swap ( .QUALITY, out_x2na_bin );
-
-    physical column NCBI:SRA:qual4_encoding .QUALITY = in_qual4;
-
-    // feed to compressed statistics
-    NCBI:qual4 in_stats_qual = in_qual4;
-
-    // single channel
-    INSDC:quality:log_odds out_qual_log_odds
-        = < INSDC:quality:log_odds > cut < 0 > ( .QUALITY );
-};
-
-
-/*--------------------------------------------------------------------------
- * NCBI:SRA:Illumina
- *  Illumina SRA Platform
- */
-
-
-/* NCBI:SRA:Illumina:common #1
- *  basic table interface based upon Illumina's pipelines
- *
- * history:
- *  1.0.1 - explictly base upon sra #1.0.1
- *  1.0.2 - base explicitly upon sra #1.0.2
- *  1.0.3 - base explicitly upon sra #1.0.3
- */
-table NCBI:SRA:Illumina:common #1.0.3 = INSDC:SRA:tbl:sra #1.0.3
-{
-    // platform name is always 'ILLUMINA'
-    ascii platform_name
-        = < ascii > echo < "ILLUMINA" > ();
-
-    /* TRIMMED SEQUENCE
-     *  need to find the 0-based trim_start and trim_len
-     */
-    INSDC:coord:zero bio_start = NCBI:SRA:bio_start ( out_read_start, out_read_type );
-    INSDC:coord:zero trim_start = bio_start;
-    U32 trim_left = ( U32 ) trim_start;
-    INSDC:coord:len trim_len = (INSDC:coord:len) < U32 > diff ( spot_len, trim_left );
-
-    /* COORDINATES
-     *  in addition to X and Y,
-     *  Illumina has LANE and TILE
-     */
-    readonly column INSDC:coord:val LANE = out_lane_coord;
-    readonly column INSDC:coord:val TILE = out_tile_coord;
-};
-
-
-/*--------------------------------------------------------------------------
- * NCBI:SRA:Illumina:tbl:v2 #1
- *  normalized v2 table
- *  still has variants based upon quality type
- *
- * history:
- *  1.0.1 - explictly base upon sra #1.0.1 and related tables
- *  1.0.2 - updated ancestry
- *  1.0.3 - updated ancestry
- */
-
-physical NCBI:SRA:swapped_fsamp4 NCBI:SRA:Illumina:encoding:SIGNAL #2
-{
-    decode { return NCBI:SRA:fsamp4:decode #2 ( @ ); }
-    encode { return NCBI:SRA:fsamp4:encode #2 < 14, 10 > ( @ ); }
-}
-
-physical NCBI:fsamp4 NCBI:SRA:Illumina:encoding:NOISE #2
-{
-    decode
-    {
-        F32 dcmp = funzip ( @ );
-        return redimension ( dcmp );
-    }
-    encode
-    {
-	F32 ncmp = redimension ( @ );
-        return fzip < 10 > ( ncmp );
-    }
-}
-
-physical NCBI:SRA:swapped_fsamp4 NCBI:SRA:Illumina:encoding:INTENSITY #2
-{
-    decode { return NCBI:SRA:fsamp4:decode #2 ( @ ); }
-    encode { return NCBI:SRA:fsamp4:encode #2 < 14, 10 > ( @ ); }
-}
-
-// v2 base table
-table NCBI:SRA:Illumina:tbl:v2 #1.0.4
-    = NCBI:SRA:tbl:sra #2.1.3
-    , NCBI:tbl:base_space #2.0.3
-    , NCBI:SRA:Illumina:common #1.0.3
-{
-    /* NAME tokenizing and coordinates
-     *  most work happens in skeyname table
-     *  we still obtain LANE and TILE from name
-     */
-    INSDC:coord:val out_lane_coord = ( INSDC:coord:val )
-        NCBI:SRA:extract_name_coord < NCBI:SRA:name_token:L > ( _out_name, out_spot_name_tok );
-    INSDC:coord:val out_tile_coord = ( INSDC:coord:val )
-        NCBI:SRA:extract_name_coord < NCBI:SRA:name_token:T > ( _out_name, out_spot_name_tok );
-    NCBI:SRA:spot_name_token out_spot_name_tok
-        = NCBI:SRA:Illumina:tokenize_spot_name ( _out_name );
-
-    NCBI:SRA:spot_name_token in_spot_name_tok
-        = NCBI:SRA:Illumina:tokenize_spot_name ( NAME );
-
-    /* SIGNAL
-     *  optional, no longer archived
-     */
-    extern column NCBI:fsamp4 SIGNAL
-    {
-        read = out_signal;
-        validate = < NCBI:fsamp4 > no_compare #1 ( in_signal, out_signal );
-    }
-    NCBI:fsamp4 in_signal = SIGNAL;
-    NCBI:fsamp4 out_signal
-        = < NCBI:SRA:swapped_fsamp4 > NCBI:SRA:swap ( .SIGNAL, out_x2na_bin );
-
-    physical column NCBI:SRA:Illumina:encoding:SIGNAL #2 .SIGNAL
-        = ( NCBI:SRA:swapped_fsamp4 ) < NCBI:fsamp4 > NCBI:SRA:swap ( in_signal, in_x2na_bin )
-        | ( NCBI:SRA:swapped_fsamp4 ) < NCBI:fsamp4 > NCBI:SRA:swap ( in_signal, in_2na_bin );
-
-    /* NOISE
-     *  optional, no longer archived
-     */
-    extern column NCBI:fsamp4 NOISE
-    {
-        read = out_noise;
-        validate = < NCBI:fsamp4 > no_compare #1 ( in_noise, out_noise );
-    }
-    NCBI:fsamp4 in_noise = NOISE;
-    NCBI:fsamp4 out_noise = .NOISE;
-
-    physical column NCBI:SRA:Illumina:encoding:NOISE #2 .NOISE = in_noise;
-
-    /* INTENSITY
-     *  optional, no longer archived
-     */
-    extern column NCBI:fsamp4 INTENSITY
-    {
-        read = out_intensity;
-        validate = < NCBI:fsamp4 > no_compare #1 ( in_intensity, out_intensity );
-    }
-    NCBI:fsamp4 in_intensity = INTENSITY;
-    NCBI:fsamp4 out_intensity
-        = < NCBI:fsamp4 > NCBI:SRA:denormalize ( out_norm_intensity, out_x2na_bin );
-    NCBI:fsamp4 out_norm_intensity
-        = ( NCBI:fsamp4 ) < NCBI:SRA:swapped_fsamp4 > NCBI:SRA:swap ( .INTENSITY, out_x2na_bin );
-    NCBI:fsamp4 in_norm_intensity
-        = < NCBI:fsamp4 > NCBI:SRA:normalize ( in_intensity, in_x2na_bin )
-        | < NCBI:fsamp4 > NCBI:SRA:normalize ( in_intensity, in_2na_bin );
-    physical column NCBI:SRA:Illumina:encoding:INTENSITY #2 .INTENSITY
-        = ( NCBI:SRA:swapped_fsamp4 ) < NCBI:fsamp4 > NCBI:SRA:swap ( in_norm_intensity, in_x2na_bin )
-        | ( NCBI:SRA:swapped_fsamp4 ) < NCBI:fsamp4 > NCBI:SRA:swap ( in_norm_intensity, in_2na_bin );
-
-	/* INSDC:tbl:sequence inherited virtual productions
-	 *  out_qual_phred
-	 */
-
-	/* INSDC:SRA:tbl:spotdesc inherited productions
-	 *  static_fixed_spot_len
-	 */
-};
-
-/* 4-channel log-odds qualities
- *
- * history:
- *  1.0.2 - updated ancestry
- *  1.0.3 - updated ancestry
- *  1.0.4 - updated ancestry
- */
-table NCBI:SRA:Illumina:tbl:q4:v2 #1.0.4
-    = NCBI:SRA:Illumina:tbl:v2 #1.0.4
-    , NCBI:SRA:Illumina:qual4 #2.0.4
-{
-	/* INSDC:SRA:tbl:spotdesc inherited virtual productions
-	 *  static_fixed_spot_len
-	 */
-};
-
-/* 1-channel log-odds qualities
- *
- * history:
- *  1.0.2 - updated ancestry
- *  1.0.3 - updated ancestry
- *  1.0.4 - updated ancestry
- */
-table NCBI:SRA:Illumina:tbl:q1:v2 #1.0.4
-    = NCBI:SRA:Illumina:tbl:v2 #1.0.4
-    , NCBI:tbl:log_odds_quality #2.0.3
-{
-	/* INSDC:SRA:tbl:spotdesc inherited productions
-	 *  static_fixed_spot_len
-	 */
-};
-
-/* phred qualities
- *
- * history:
- *  1.0.2 - updated ancestry
- *  1.0.3 - updated ancestry
- *  1.0.4 - updated ancestry
- */
-table NCBI:SRA:Illumina:tbl:phred:v2 #1.0.4
-    = NCBI:SRA:Illumina:tbl:v2 #1.0.4
-    , NCBI:tbl:phred_quality #2.0.3
-{
-	/* INSDC:SRA:tbl:spotdesc inherited virtual productions
-	 *  static_fixed_spot_len
-	 */
-};
diff --git a/interfaces/sra/impl.h b/interfaces/sra/impl.h
deleted file mode 100644
index 815d5a6..0000000
--- a/interfaces/sra/impl.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_sra_impl_h_
-#define _h_sra_impl_h_
-
-#ifndef _h_sra_path_extern_
-#include <sra/path-extern.h>
-#endif
-
-#ifndef _h_vdb_extern_
-#include <vdb/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KNamelist;
-struct KDirectory;
-typedef union SRAPath_vt SRAPath_vt;
-typedef struct SRAPath_vt_v1 SRAPath_vt_v1;
-typedef struct SRAPath_vt_v2 SRAPath_vt_v2;
-
-
-/*--------------------------------------------------------------------------
- * SRAPath
- */
-struct SRAPath
-{
-    const SRAPath_vt *vt;
-};
-
-#ifndef SRAPATH_IMPL
-#define SRAPATH_IMPL struct SRAPath
-#endif
-
-struct SRAPath_vt_v1
-{
-    /* version == 1.x */
-    uint32_t maj;
-    uint32_t min;
-
-    rc_t ( CC *addref ) ( const SRAPATH_IMPL *self );
-    rc_t ( CC *release ) ( const SRAPATH_IMPL *self );
-    rc_t ( CC *version ) ( const SRAPATH_IMPL *self, uint32_t *version );
-    rc_t ( CC *clear ) ( SRAPATH_IMPL *self );
-    rc_t ( CC *addRepPath ) ( SRAPATH_IMPL *self, const char *path );
-    rc_t ( CC *addVolPath ) ( SRAPATH_IMPL *self, const char *path );
-    rc_t ( CC *fullPath ) ( const SRAPATH_IMPL *self, const char *rep, const char *vol,
-			 const char *acc, char *path, size_t path_max );
-    bool ( CC *testPath ) ( const SRAPATH_IMPL *self, const char *path );
-    rc_t ( CC *findPath ) ( const SRAPATH_IMPL *self, const char *acc, char *path, size_t path_max, size_t *rep_len );
-    rc_t ( CC *listPath ) ( const SRAPATH_IMPL *self, struct KNamelist **runs, bool deep );
-};
-
-struct SRAPath_vt_v2
-{
-    /* version == 2.x */
-    uint32_t maj;
-    uint32_t min;
-
-    rc_t ( CC *addref ) ( const SRAPATH_IMPL *self );
-    rc_t ( CC *release ) ( const SRAPATH_IMPL *self );
-    rc_t ( CC *version ) ( const SRAPATH_IMPL *self, uint32_t *version );
-    rc_t ( CC *clear ) ( SRAPATH_IMPL *self );
-    rc_t ( CC *addRepPath ) ( SRAPATH_IMPL *self, const char *path );
-    rc_t ( CC *addVolPath ) ( SRAPATH_IMPL *self, const char *path );
-    rc_t ( CC *fullPath ) ( const SRAPATH_IMPL *self, const char *rep, const char *vol,
-			 const char *acc, char *path, size_t path_max );
-    bool ( CC *testPath ) ( const SRAPATH_IMPL *self, const char *path );
-    rc_t ( CC *findPath ) ( const SRAPATH_IMPL *self, const char *acc, char *path, size_t path_max, size_t *rep_len );
-};
-
-union SRAPath_vt
-{
-    SRAPath_vt_v1 v1;
-    SRAPath_vt_v2 v2;
-};
-
-
-/* SRAPathMakeImpl
- *  make the SRAPath object within a shared library called "libsra-path"
- */
-MOD_EXPORT rc_t CC SRAPathMakeImpl ( struct SRAPath **pm, struct KDirectory const *dir );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_sra_impl_h_ */
diff --git a/interfaces/sra/ion-torrent.vschema b/interfaces/sra/ion-torrent.vschema
deleted file mode 100644
index ed0d97c..0000000
--- a/interfaces/sra/ion-torrent.vschema
+++ /dev/null
@@ -1,117 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/*==========================================================================
- * NCBI Ion Torrent Sequence Read Archive schema
- */
-version 1;
-
-include 'ncbi/sra.vschema';
-include 'ncbi/spotname.vschema';
-include 'ncbi/clip.vschema';
-
-
-/*--------------------------------------------------------------------------
- * functions
- */
-
-
-/* tokenize_spot_name
- *  scans name on input
- *  tokenizes into parts
- */
-extern function NCBI:SRA:spot_name_token
-    NCBI:SRA:IonTorrent:tokenize_spot_name #1 ( ascii name );
-
-
-/*--------------------------------------------------------------------------
- * table
- */
-
-physical INSDC:position:one NCBI:SRA:IonTorrent:encoding:POSITION #1
-{
-    decode
-    {
-        I32 pos_1st_deriv = iunzip ( @ );
-        return ( INSDC:position:one ) < I32 > integral ( pos_1st_deriv );
-    }
-    encode
-    { 
-        I32 pos_1st_deriv = < I32 > deriv ( @ );
-        return izip ( pos_1st_deriv ); 
-    }
-}
-
-/* IonTorrent:tbl
- *
- * history:
- *  1.0.1 - updated ancestry
- *  1.0.2 - updated ancestry
- *  1.0.3 - updated ancestry
- */
-table NCBI:SRA:IonTorrent:tbl:v2 #1.0.3
-    = INSDC:SRA:tbl:sra #1.0.3
-    , NCBI:SRA:tbl:sra_nopos #2.1.3
-    , NCBI:tbl:base_space #2.0.3
-    , NCBI:tbl:phred_quality #2.0.3
-    , NCBI:SRA:tbl:clip #1.0.2
-{
-    /* PLATFORM is always ION_TORRENT */
-    ascii platform_name
-        = < ascii > echo < "ION_TORRENT" > ();
-
-    /* NAME tokenizing and coordinates
-     *  most work happens in skeyname table
-     */
-    NCBI:SRA:spot_name_token out_spot_name_tok
-        = NCBI:SRA:IonTorrent:tokenize_spot_name ( _out_name );
-
-    NCBI:SRA:spot_name_token in_spot_name_tok
-        = NCBI:SRA:IonTorrent:tokenize_spot_name ( NAME );
-
-    // special sequences
-    column < INSDC:dna:text > zip_encoding FLOW_CHARS;
-    column < INSDC:dna:text > zip_encoding KEY_SEQUENCE;
-
-    // position stored as normal 1-based coordinate
-    INSDC:position:one out_position = .POSITION;
-    physical column NCBI:SRA:IonTorrent:encoding:POSITION
-        .POSITION = POSITION;
-
-
-    // clips
-    physical column < INSDC:coord:one > izip_encoding
-        .CLIP_ADAPTER_LEFT = CLIP_ADAPTER_LEFT;
-    physical column < INSDC:coord:one > izip_encoding
-        .CLIP_ADAPTER_RIGHT = CLIP_ADAPTER_RIGHT;
-    physical column < INSDC:coord:one > izip_encoding
-        .CLIP_QUALITY_LEFT = CLIP_QUALITY_LEFT;
-    physical column < INSDC:coord:one > izip_encoding
-        .CLIP_QUALITY_RIGHT = CLIP_QUALITY_RIGHT;
-
-    // signal
-    column < NCBI:isamp1 > izip_encoding SIGNAL;
-};
diff --git a/interfaces/sra/pacbio.h b/interfaces/sra/pacbio.h
deleted file mode 100644
index 0c3ea64..0000000
--- a/interfaces/sra/pacbio.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_sra_pacbio_
-#define _h_sra_pacbio_
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*==========================================================================
- * PACBIO types, constants
- */
-
-
-/* hole status for pacbio spots
- */
-#define sra_read_filter_t "INSDC:SRA:read_filter"
-typedef uint8_t PACBIO_HOLE_STATUS;
-enum
-{
-    SRA_PACBIO_HOLE_SEQUENCING = 0,
-    SRA_PACBIO_HOLE_ANTIHOLE = 1,
-    SRA_PACBIO_HOLE_FIDUCIAL = 2,
-    SRA_PACBIO_HOLE_SUSPECT = 3,
-    SRA_PACBIO_HOLE_ANTIMIRROR = 4,
-    SRA_PACBIO_HOLE_FDZMW = 5,
-    SRA_PACBIO_HOLE_FBZMW = 6,
-    SRA_PACBIO_HOLE_ANTIBEAMLET = 7,
-    SRA_PACBIO_HOLE_OUTSIDEFOV = 8
-};
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*  _h_sra_pacbio_ */
diff --git a/interfaces/sra/path-extern.h b/interfaces/sra/path-extern.h
deleted file mode 100644
index 26f671c..0000000
--- a/interfaces/sra/path-extern.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_sra_path_extern_
-#define _h_sra_path_extern_
-
-#if ! defined EXPORT_LATCH && defined _LIBRARY
-#define SRA_PATH_EXTERN LIB_EXPORT
-#define EXPORT_LATCH 1
-#else
-#define SRA_PATH_EXTERN LIB_IMPORT
-#endif
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#endif /* _h_sra_path_extern_ */
diff --git a/interfaces/sra/pevents.vschema b/interfaces/sra/pevents.vschema
deleted file mode 100644
index 8072810..0000000
--- a/interfaces/sra/pevents.vschema
+++ /dev/null
@@ -1,91 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/*==========================================================================
- * NCBI Likelihood & Event schema
- */
-version 1;
-include 'vdb/vdb.vschema';
-
-typedef U8 INSDC:phred;
-typedef ascii INSDC:event:text;
-const INSDC:event:text INSDC:event:CHARSET = "ACGT0123B+-";
-const INSDC:event:text INSDC:event:ACCEPTSET = "ACGTacgt0123B+-";
-
-extern function < U32 dim >
-U32 NCBI:SRA:sort_order #1.0 ( F32[dim] likelihoods );
-
-extern function < U32 dim >
-F32 NCBI:SRA:reorder #1.0 ( U32 sort_order, F32[dim] likelihoods );
-
-extern function < U32 dim >
-F32 NCBI:SRA:restore_order #1.0 ( U32 sort_order, F32[dim] likelihoods );
-
-extern function < U32 sdim, U32 rdim >
-INSDC:phred[rdim] NCBI:SRA:likelihood_to_phred #1.0 ( F32 like_scale, F32[sdim] likelihoods );
-
-extern function < U32 sdim, U32 rdim >
-F32[rdim] NCBI:SRA:phred_to_likelihood #1.0 ( F32 like_scale, F32[sdim] phred );
-
-table NCBI:SRA:tbl:pevents #1.0
-{
-    // event labels - single character events
-    extern column
-        INSDC:event:text PEVENTS = .PEVENTS;
-
-    physical column < INSDC:event:text >
-        zip_encoding #1.0 .PEVENTS = PEVENTS;
-
-    // likelihoods
-    extern default column
-        F32[4] LIKELIHOODS = likelihoods;
-    extern readonly column
-        INSDC:phred[4] LIKELIHOODS = phred;
-
-    U32 sort_encode = NCBI:SRA:sort_order < 4 > ( LIKELIHOODS );
-
-    physical column < U32 >
-        zip_encoding #1.0 < Z_RLE > .SORT_ORDER = sort_encode;
-
-    F32 reorder = NCBI:SRA:reorder < 4 > ( sort_encode, LIKELIHOODS );
-    F32 like_scale = vdb:fixed_vec_sum < F32, 4 > ( reorder );
-
-    physical column < F32 >
-        fzip_encoding #1.0 < 4 > .SCALE = like_scale;
-
-    INSDC:phred cut_phred = NCBI:SRA:likelihood_to_phred #1.0 < 4, 3 > ( like_scale, reorder );
-
-    physical column < INSDC:phred >
-        zip_encoding #1.0 < 5 > .PHRED = cut_phred;
-
-    // normalization scaling factors
-    extern readonly column
-        F32 LIKELIHOOD_NORM = .SCALE;
-
-    // phred scores
-    extern readonly column
-        INSDC:phred[4] PHRED = phred;
-};
diff --git a/interfaces/sra/rd-extern.h b/interfaces/sra/rd-extern.h
deleted file mode 100644
index 02c2984..0000000
--- a/interfaces/sra/rd-extern.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_sra_rd_extern_
-#define _h_sra_rd_extern_
-
-#if ! defined EXPORT_LATCH && defined _LIBRARY
-#define SRA_RD_EXTERN LIB_EXPORT
-#define EXPORT_LATCH 1
-#else
-#define SRA_RD_EXTERN LIB_IMPORT
-#endif
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#endif /* _h_sra_rd_extern_ */
diff --git a/interfaces/sra/sch-extern.h b/interfaces/sra/sch-extern.h
deleted file mode 100644
index 37d38b8..0000000
--- a/interfaces/sra/sch-extern.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_sra_sch_extern_
-#define _h_sra_sch_extern_
-
-#if ! defined EXPORT_LATCH && defined _LIBRARY
-#define SRA_SCH_EXTERN LIB_EXPORT
-#define EXPORT_LATCH 1
-#else
-#define SRA_SCH_EXTERN LIB_IMPORT
-#endif
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#endif /* _h_sra_sch_extern_ */
diff --git a/interfaces/sra/sff-file.h b/interfaces/sra/sff-file.h
deleted file mode 100644
index 4b36bc3..0000000
--- a/interfaces/sra/sff-file.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifndef _h_sra_sff_file_
-#define _h_sra_sff_file_
-
-#include <klib/defs.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* ======================================================================
- * SFF defines an 8 bit value in the file that tells of the format of the 
- * data signal (flowgrams in Roche 454 SFF parlance).
- *
- * The only currently defined format is a 16 bit unsigned integer in
- * units one hundredths. This enum is to easily allow us to add other
- * formats if ever required.
- */
-typedef enum SFFFormatCode
-{
-    SFFFormatCodeUnset = 0,
-    /* values are 16 integers of hundreths of units: 0 = 0.00, 1 = 0.01, 2 = 0.02, ... */
-    SFFFormatCodeUI16Hundreths,
-    /* currently (SFF (00000001) yet this is the only one SFFFormatCode is defined */
-    SFFFormatCodeUndefined
-}	SFFFormatCode;
-
-/* ----------------------------------------------------------------------
- * Common Header Section 
- * (Genome Sequencer Data Analysis Software Manual Section 13.3.8.1)
- */
-#define SFFCommonHeader_size 31
-
-typedef struct SFFCommonHeader_struct
-{
-    uint32_t magic_number;         /* four bytes ".sff" as string: with wrong endian it would be "ffs." */
-    uint32_t version;              /* four bytes 0x00000001 */
-    uint64_t index_offset;         /* index_offset and index_length are the offset and length of an */
-    uint32_t index_length;         /* optional index of the reads in the file. If no index both are 0 */
-    uint32_t number_of_reads;      /* The number of reads in the file (not individual datum) */
-    uint16_t header_length;        /* length of all headers in this set.  31 + flow_length + key_length + pad to 8 byte boundary */
-    uint16_t key_length;           /* length of the key sequence for these reads */
-    uint16_t num_flows_per_read;   /* the number of flows for each read in this file */
-    uint8_t  flowgram_format_code; /* SFFFormatCode between (SFFFormatCodeUnset..FormateCodeUndefined) exclusive */
-    /* not included variable length portion of header:
-        flow chars   - sequence of uint8_t, actual length is num_flows_per_read above
-        key sequence - sequence of uint8_t, actual length is key_length above
-        padding      - sequence of zeroed uint8_t to make total length of file header 8-byte padded
-    */
-} SFFCommonHeader;
-
-/* ----------------------------------------------------------------------
- * Read Header Section 
- * (Genome Sequencer Data Analysis Software Manual Section 13.3.8.2)
- */
-#define SFFReadHeader_size 16
-
-typedef struct SFFReadHeader_struct
-{
-    uint16_t    header_length;            /* length in bytes of the full section including padding */
-    uint16_t    name_length;            /* length of the name of this spot */
-    uint32_t    number_of_bases;
-    uint16_t    clip_quality_left;
-    uint16_t    clip_quality_right;
-    uint16_t    clip_adapter_left;
-    uint16_t    clip_adapter_right;
-    /* not included variable length portion of header:
-        name    - sequence of uint8_t, actual length is name_length above
-        padding - sequence of zeroed uint8_t to make total length of read header 8-byte padded
-
-        read data section:
-
-        signal - sequence of uint16_t (if flowgram_format_code == SFFFormatCodeUI16Hundreths, see enum above),
-                 actual length is num_flows_per_read from file header above
-        flow_index_per_base (position) - sequence of uint8_t, actual length in number_of_bases above
-        bases - sequence of uint8_t, actual length in number_of_bases above
-        quality_scores - sequence of uint8_t, actual length in number_of_bases above
-        padding - sequence of zeroed uint8_t to make total length of read data section 8-byte padded
-    */
-} SFFReadHeader;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_sra_sff_file_ */
diff --git a/interfaces/sra/sff.h b/interfaces/sra/sff.h
deleted file mode 100644
index b958d49..0000000
--- a/interfaces/sra/sff.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifndef _h_sra_sff_
-#define _h_sra_sff_
-
-#ifndef _h_sra_rd_extern_
-#include <sra/rd-extern.h>
-#endif
-
-#ifndef _h_sra_sradb_
-#include <sra/sradb.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * SFFReader
- */
-typedef struct SFFReader SFFReader;
-
-/* Make
- *  create SFFReader reference based
- *  on table and properties:
- *     table      - SRATable
- *     accession  - accession
- *     minSpotId  - starting spot id, 0 - ignored (run information used)
- *     maxSpotId  - ending spot id, 0 - ignored (run information used)
- *                  you cannot seek out of range of [minSpotId:maxSpotId]
- */
-SRA_RD_EXTERN rc_t CC SFFReaderMake(const SFFReader** self, const SRATable* table, const char* accession,
-                                    spotid_t minSpotId, spotid_t maxSpotId);
-
-/* Whack
- *  releases object obtained from SFFReaderMake
- */
-SRA_RD_EXTERN rc_t CC SFFReaderWhack(const SFFReader* self);
-
-/* FirstSpot
- *  set current spot to first in the run
- */
-SRA_RD_EXTERN rc_t CC SFFReaderFirstSpot(const SFFReader* self);
-
-/* SeekSpot
- *  set current spot
- * if error occured current spot position becomes 0
- */
-SRA_RD_EXTERN rc_t CC SFFReaderSeekSpot(const SFFReader* self, spotid_t spot);
-
-/* NextSpot
- *  Seek to next spot from current
- */
-SRA_RD_EXTERN rc_t CC SFFReaderNextSpot(const SFFReader* self);
-
-/* CurrentSpot
- *  Get current spot
- *  sopt [OUT] - pointer to assign value of the current spot
- * returns GetRCState(rc) == rcExhausted when out of spots
- */
-SRA_RD_EXTERN rc_t CC SFFReaderCurrentSpot(const SFFReader* self, spotid_t* spot);
-
-/* SpotInfo
- *  Get current spot information
- *  spotname [OUT] - pointer to assign value of the current spot name (can be NULL)
- *  spot_len [OUT] - pointer to assign value of the current spot length (can be NULL)
- *  num_reads[OUT] - pointer to assign value of the number of reads in current spot (can be NULL)
- */
-SRA_RD_EXTERN rc_t CC SFFReader_SpotInfo(const SFFReader* self, const char** spotname, size_t* spotname_sz,
-                                         uint32_t* spot_len, uint32_t* num_reads);
-
-/* SpotReadInfo
- *  Get read information for current spot
- *  readid    [IN]  - 1-based read id
- *  read_label[OUT] - pointer to assign value of the read label (can be NULL)
- *  read_type [OUT] - pointer to assign value of the read type (can be NULL)
- *  read_start[OUT] - pointer to assign value of the read start in spot (can be NULL)
- *  read_len  [OUT] - pointer to assign value of the read length (can be NULL)
- *  cskey     [OUT] - pointer to assign value of the read color space key (can be NULL)
- *  if start and len is == 0 read is empty
- */
-SRA_RD_EXTERN rc_t CC SFFReader_SpotReadInfo(const SFFReader* self, uint32_t readId, SRAReadTypes* read_type,
-                                             const char** read_label, INSDC_coord_len* read_label_sz,
-                                             INSDC_coord_zero* read_start, INSDC_coord_len* read_len);
-
-/* Header
- *  retrieve binary file header
- *  spots [IN,OPT]   - sets number of reads in header, ignored if spots == 0
- *  data [IN]        - pointer to buffer for printing
- *  dsize [IN]       - data buffer size
- *  written [IN,OUT] - number of bytes occupied by data, may by more than dsize
- */
-SRA_RD_EXTERN rc_t CC SFFReaderHeader(const SFFReader* self, spotid_t spots, char* data, size_t dsize, size_t* written);
-
-/* Base
- *  retrieve bases for the spot
- *  other parameters see description for SFFReaderHeader above
- */
-SRA_RD_EXTERN rc_t CC SFFReaderReadHeader(const SFFReader* self, char* data, size_t dsize, size_t* written);
-
-/* QualityName
- *  retrieve quality name string for the spot
- *  other parameters see description for SFFReaderHeader above
- */
-SRA_RD_EXTERN rc_t CC SFFReaderReadData(const SFFReader* self, char* data, size_t dsize, size_t* written);
-
-/* GetCurrentSpotData
- *  retrieve current spot data as a blob
- *  other parameters see description for SFFReaderHeader above
- */
-SRA_RD_EXTERN rc_t CC SFFReader_GetCurrentSpotData(const SFFReader* self, char* data, size_t dsize, size_t* written);
-
-/* GetNextSpotData (streaming function)
- *  move to the next spot and retrieve current spot data as a blob
- *  other parameters see description for SFFReaderHeader above
- */ 
-SRA_RD_EXTERN rc_t CC SFFReader_GetNextSpotData(const SFFReader* self, char* data, size_t dsize, size_t* written);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_sra_sff_ */
diff --git a/interfaces/sra/sradb-priv.h b/interfaces/sra/sradb-priv.h
deleted file mode 100644
index 8fdf027..0000000
--- a/interfaces/sra/sradb-priv.h
+++ /dev/null
@@ -1,407 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_sra_sradb_priv_
-#define _h_sra_sradb_priv_
-
-#ifndef _h_klib_container_
-#include <klib/container.h>
-#endif
-
-#ifndef _h_klib_text
-#include <klib/text.h>
-#endif
-
-#ifndef _h_klib_vector
-#include <klib/vector.h>
-#endif
-
-#ifndef _h_sra_sradb_
-#include <sra/sradb.h>
-#endif
-
-#ifndef _h_sra_srapath_
-#include <sra/srapath.h>
-#endif
-
-#ifndef _h_sra_path_extern_
-#include <sra/path-extern.h>
-#endif
-
-#ifndef _h_sra_sch_extern_
-#include <sra/sch-extern.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KFile;
-struct KDirectory;
-struct KDBManager;
-struct KTable;
-struct KLock;
-struct KConfig;
-struct VDBManager;
-struct VTable;
-struct VSchema;
-struct SRAPath;
-struct SRACacheUsage;
-struct SRACacheMetrics;
-/*--------------------------------------------------------------------------
- * SRAMgr
- *  opaque handle to SRA library
- */
- 
-/*  SRAMgrResolve
- *  Convert accession name into a file system path
- */
- 
-SRA_EXTERN rc_t CC SRAMgrResolve( const SRAMgr *self, const char* acc, char* buf, size_t buf_size );
-
-/* Flush
- *  flushes least recently used accessions until the cache size is under the specified threshold
- */
-SRA_EXTERN rc_t CC SRAMgrFlush ( struct SRAMgr const *self, const struct SRACacheMetrics* );
-
-/* RunBGTasks
- *  perform single pass of garbage collection tasks and exit.
- *  also retrieves and processes update messages.
- */
-SRA_EXTERN rc_t CC SRAMgrRunBGTasks ( struct SRAMgr const *self );
-
-/* GetVDBManager
- *  returns a new reference to VDBManager used by SRAMgr
- */
-SRA_EXTERN rc_t CC SRAMgrGetVDBManagerRead ( const SRAMgr *self, struct VDBManager const **vmgr );
-SRA_EXTERN rc_t CC SRAMgrGetVDBManagerUpdate ( SRAMgr *self, struct VDBManager **vmgr );
-
-/* GetKDBManager
- *  returns a new reference to KDBManager used indirectly by SRAMgr
- */
-SRA_EXTERN rc_t CC SRAMgrGetKDBManagerRead ( const SRAMgr *self, struct KDBManager const **kmgr );
-SRA_EXTERN rc_t CC SRAMgrGetKDBManagerUpdate ( SRAMgr *self, struct KDBManager **kmgr );
-
-/* ModDate
- *  return a modification timestamp for table
- */
-SRA_EXTERN rc_t CC SRAMgrVGetTableModDate ( const SRAMgr *self,
-    KTime_t *mtime, const char *spec, va_list args );
-
-SRA_EXTERN rc_t CC SRAMgrGetTableModDate ( const SRAMgr *self,
-    KTime_t *mtime, const char *spec, ... );
-
-/* ConfigReload
- *  update SRAPath object
- */
-SRA_EXTERN rc_t CC SRAMgrConfigReload( const SRAMgr *self, struct KDirectory const *wd );
-
-/* 
- *  Accession Cache usage stats
- */
-SRA_EXTERN rc_t CC SRAMgrGetCacheUsage( const SRAMgr *self, struct SRACacheUsage* stats );
-
-/* 
- *  Configure Accession Cache 
- *  soft_threshold, hard_threshold - new threshold values ( -1 : do not change; < -1 invalid )
- */
-SRA_EXTERN rc_t CC SRAMgrConfigureCache( const SRAMgr *self,  int32_t soft_threshold, int32_t hard_threshold );
-
-/*--------------------------------------------------------------------------
- * SRATable
- */
-
-/* OpenAltTableRead
- *  opens a table within a database structure with a specific name
- */
-SRA_EXTERN rc_t CC SRAMgrOpenAltTableRead ( const SRAMgr *self,
-    const SRATable **tbl, const char *altname, const char *spec, ... );
-
-/* GetVTable
- *  returns a new reference to underlying VTable
- */
-SRA_EXTERN rc_t CC SRATableGetVTableRead ( const SRATable *self, struct VTable const **vtbl );
-SRA_EXTERN rc_t CC SRATableGetVTableUpdate ( SRATable *self, struct VTable **vtbl );
-
-/* GetKTable
- *  returns a new reference to underlying KTable
- */
-SRA_EXTERN rc_t CC SRATableGetKTableRead ( const SRATable *self, struct KTable const **ktbl );
-SRA_EXTERN rc_t CC SRATableGetKTableUpdate ( SRATable *self, struct KTable **ktbl );
-
-
-/* MakeSingleFileArchive
- *  makes a single-file-archive file from an SRA table
- *
- *  contents are ordered by frequency and necessity of access
- *
- *  "lightweight" [ IN ] - when true, include only those components
- *  required for read and quality operations.
- *
- *  "ext" [OUT,NULL] - optional file name extension to use for file
- */
-SRA_EXTERN rc_t CC SRATableMakeSingleFileArchive ( const SRATable *self,
-    struct KFile const **sfa, bool lightweight, const char** ext );
-
-/* SingleFileArchiveExt
- *  retrieve archive extension based on object in the spec
- */
-SRA_EXTERN rc_t CC SRAMgrSingleFileArchiveExt(const SRAMgr *self,
-    const char* spec, const bool lightweight, const char** ext);
-/*--------------------------------------------------------------------------
- * SRAPath
- */
-
-/* FindWithRepLen
- *  finds location of run within rep-server/volume matrix
- *  returns length of rep-server portion
- */
-SRA_EXTERN rc_t CC SRAPathFindWithRepLen ( struct SRAPath const *self,
-    const char *accession, char *path, size_t path_max, size_t *rep_len );
-
-
-
-/*--------------------------------------------------------------------------
- * SRASchema
- */
-
-SRA_SCH_EXTERN rc_t CC SRASchemaMake ( struct VSchema **schema, struct VDBManager const *mgr );
-
-
-#if 0
-
-/*--------------------------------------------------------------------------
- * SRATableData  - DEPRECATED
- *  a collection of spots with several data series, minimally including
- *  base or color calls and their quality ( confidence ) values, and
- *  optionally signal-related values ( signal, intensity, noise, ... ).
- */
-union NucStrstr;
-
-typedef struct SRASpotStructure SRASpotStructure;
-struct SRASpotStructure
-{ 
-    /* preformatted query expression
-       for fixed_seq when search is needed */
-    union NucStrstr *q_str;
-
-    /* read of fixed len if != 0
-       either teminated by fixed_seq or by the end */
-    uint16_t fixed_len;
-
-    /* SRAReadTypes */
-	uint8_t read_type;
-
-    /* colorspace key */
-    char cs_key;
-
-    char fixed_seq [ 1024 ];
-
-    /* label for the read */
-    char read_label [ 54 ];
-
-};
-
-typedef struct SRASpotCoord SRASpotCoord;
-struct SRASpotCoord
-{
-    uint32_t x, y, tile;
-	uint32_t  lane;
-	spotid_t id;
-
-    /* prefix part of spotname */
-	uint32_t platename_len;
-	char spotname [ 1024 ];
-
-};
-
-typedef struct SRATableData SRATableData;
-struct SRATableData
-{
-	uint64_t base_count;
-	uint64_t spot_count;
-	uint64_t bad_spot_count;
-	spotid_t max_spotid;
-
-    /* the spot is always fixed len read */
-	uint32_t fixed_len;
-
-    /* number of reads per spot */
-	uint32_t num_reads;
-
-    /* read mask containing bio reads */
-	uint32_t read_mask_bio;
-
-    /* read description */
-	SRASpotStructure read_descr [ 32 ];
-    uint16_t read_len [ 32 ];
-
-    /* platform type and name */
-	uint8_t platform;
-	char platform_str [ 31 ];
-
-	uint16_t prefix_len;
-
-    /* spot coordinates */
-	SRASpotCoord coord;
-
-};
-
-/* GetTableData
- *  returns a pointer to internal table data
- *  or NULL if "self" is invalid
- *
- * NB - THIS OBJECT IS NOT REFERENCE COUNTED
- */
-SRA_EXTERN const SRATableData *CC SRATableGetTableData ( const SRATable *self );
-
-#endif
-
-/*--------------------------------------------------------------------------
- * SRA Accession Cache
- */
-struct SRACacheIndex;
-
-typedef struct SRACacheMetrics
-{   
-    uint32_t elements; /* open accessions */
-    
-    /* not in use currently: */
-    uint64_t bytes; /* expanded cache bytes, i.e. cursor */
-    uint32_t threads;
-    uint32_t fds;
-} SRACacheMetrics;
-
-#define SRACacheThresholdSoftBytesDefault       ((uint64_t)0)
-#define SRACacheThresholdSoftElementsDefault    ((uint32_t)1000)
-#define SRACacheThresholdSoftThreadsDefault     ((uint32_t)0)
-#define SRACacheThresholdSoftFdsDefault         ((uint32_t)0)
-
-#define SRACacheThresholdHardBytesDefault       ((uint64_t)0)
-#define SRACacheThresholdHardElementsDefault    ((uint32_t)10000)
-#define SRACacheThresholdHardThreadsDefault     ((uint32_t)0)
-#define SRACacheThresholdHardFdsDefault         ((uint32_t)0)
-
-SRA_EXTERN bool CC SRACacheMetricsLessThan(const SRACacheMetrics* a, const SRACacheMetrics* b);
-
-typedef struct SRACacheElement 
-{
-    DLNode dad;
-    
-    SRATable*   object;
-    
-    KTime_t lastAccessed;
-    
-    struct SRACacheIndex* index;
-    uint32_t key;
-
-    SRACacheMetrics metrics;
-} SRACacheElement;
-
-SRA_EXTERN rc_t CC SRACacheElementMake(SRACacheElement**        self, 
-                                       SRATable*                object, 
-                                       struct SRACacheIndex*    index, 
-                                       uint32_t                 key, 
-                                       const SRACacheMetrics*   metrics);
-SRA_EXTERN rc_t CC SRACacheElementDestroy(SRACacheElement* self);
-
-typedef struct SRACacheIndex
-{
-    BSTNode dad;
-    
-    String* prefix;
-    KVector* body; /* KVector<SRACacheElement*> */
-} SRACacheIndex;
-
-SRA_EXTERN rc_t CC SRACacheIndexMake(SRACacheIndex** self, String* prefix);
-SRA_EXTERN rc_t CC SRACacheIndexDestroy(SRACacheIndex* self);
-
-typedef struct SRACacheUsage {
-    /* config */
-    uint32_t soft_threshold;
-    uint32_t hard_threshold;    
-    /* usage stats */ 
-    uint32_t elements;
-    uint64_t requests;
-    uint64_t hits;
-    uint64_t misses;
-    uint64_t busy;
-} SRACacheUsage;
-
-typedef struct SRACache
-{
-    BSTree indexes; /* grows as needed */
-
-    DLList lru; /* DLList<SRACacheElement*>;  head is the oldest */
-    
-    struct KLock* mutex; 
-
-    SRACacheMetrics softThreshold;
-    SRACacheMetrics hardThreshold;
-    SRACacheMetrics current;
-    
-    uint64_t requests;
-    uint64_t hits;
-    uint64_t misses;
-    uint64_t busy;
-} SRACache;
-
-SRA_EXTERN rc_t CC SRACacheInit(SRACache**, struct KConfig*);
-
-SRA_EXTERN rc_t CC SRACacheGetSoftThreshold(SRACache* self, SRACacheMetrics* metrics);
-SRA_EXTERN rc_t CC SRACacheSetSoftThreshold(SRACache* self, const SRACacheMetrics* metrics);
-
-SRA_EXTERN rc_t CC SRACacheGetHardThreshold(SRACache* self, SRACacheMetrics* metrics);
-SRA_EXTERN rc_t CC SRACacheSetHardThreshold(SRACache* self, const SRACacheMetrics* metrics);
-
-SRA_EXTERN rc_t CC SRACacheGetUsage(SRACache* self, SRACacheUsage* usage);
-
-/* flush tables until usage is lower than specified in self->softThreshold */
-SRA_EXTERN rc_t CC SRACacheFlush(SRACache* self); 
-
-/* 
-    if found, moves element to the back of the list; return NULL object if not in the cache 
-    if found but the refcount is not 1, returns RC( rcSRA, rcData, rcAccessing, rcParam, rcBusy)
-*/
-SRA_EXTERN rc_t CC SRACacheGetTable(SRACache* self, const char* acc, const SRATable** object); 
-
-/* 
- * fails if table is already in the cache.
- * Does not affect usage stats.
- */
-SRA_EXTERN rc_t CC SRACacheAddTable(SRACache* self, const char* acc, SRATable*); 
-
-SRA_EXTERN rc_t CC SRACacheWhack(SRACache* self);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_sra_sradb_priv_ */
diff --git a/interfaces/sra/sradb.h b/interfaces/sra/sradb.h
deleted file mode 100644
index 747a109..0000000
--- a/interfaces/sra/sradb.h
+++ /dev/null
@@ -1,545 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_sra_sradb_
-#define _h_sra_sradb_
-
-#ifndef _h_sra_extern_
-#include <sra/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifndef _h_insdc_insdc_
-#include <insdc/insdc.h>
-#endif
-
-#ifndef _h_insdc_sra_
-#include <insdc/sra.h>
-#endif
-
-#include <stdarg.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct VSchema;
-struct VTypedef;
-struct VTypedecl;
-struct VDatatypes;
-struct KMDataNode;
-struct KDirectory;
-struct SRANamelist;
-
-
-/*--------------------------------------------------------------------------
- * version
- *  current API version is 3.1
- */
-#define SRADB_CURRENT_VERSION 0x03010000
-
-
-/*--------------------------------------------------------------------------
- * spotid_t
- *  a 1-based integer spot identifier
- *  unique within table
- *  see <insdc/sra.h>
- */
-typedef INSDC_SRA_spotid_t spotid_t;
-
-
-/*--------------------------------------------------------------------------
- * REFERENCE COUNTING
- *  most objects used in the API are reference counted.
- *
- *  all functions that return an object return an original reference
- *  to that object ( unless otherwise noted ).
- *
- *  *Release functions are used to discard a reference. under normal
- *  operation objects will be returned by an API function and freed via
- *  the corresponding release.
- *
- *  *AddRef functions are used to attach an additional reference to
- *  an object, which increases the number of *Release messages needed
- *  to actually free an object. manipulating the reference count of an
- *  object is not normally required.
- */
-
-
-/*--------------------------------------------------------------------------
- * SRAMgr
- *  opaque handle to SRA library
- */
-typedef struct SRAMgr SRAMgr;
-
-
-/* MakeRead
- *  create library reference for read-only access
- *
- *  "wd" [ IN, NULL OKAY ] - optional working directory for
- *  accessing the file system. mgr will attach its own reference
- *
- *  NB - not implemented in update libary
- *  and the read-only library may not be mixed with read/write
- */
-SRA_EXTERN rc_t CC SRAMgrMakeRead ( const SRAMgr **mgr );
-SRA_EXTERN rc_t CC SRAMgrMakeReadWithDir ( const SRAMgr **mgr, struct KDirectory const *wd );
-
-
-/* Release
- *  releases reference to object
- *  obtained from MakeRead, MakeUpdate,
- *  or AddRef ( see above )
- */
-SRA_EXTERN rc_t CC SRAMgrRelease ( const SRAMgr *self );
-
-
-/* AddRef
- *  attach a new reference to an existing object
- *  ( see above )
- */
-SRA_EXTERN rc_t CC SRAMgrAddRef ( const SRAMgr *self );
-
-
-/* Version
- *  returns the library version
- */
-SRA_EXTERN rc_t CC SRAMgrVersion ( const SRAMgr *self, uint32_t *version );
-
-
-/* OpenDatatypes - DEPRECATED
- *  open datatype registry object for requested access
- *
- *  "dt" [ OUT ] - return parameter for datatypes object
- */
-SRA_EXTERN rc_t CC SRAMgrOpenDatatypesRead ( const SRAMgr *self,
-    struct VDatatypes const **dt );
-
-
-/* GetSchema
- *  get a reference to the schema used to create new tables
- *
- *  "schema" [ OUT ] - return parameter for reference to SRA schema
- *
- * NB - returns a new reference that must be released via VSchemaRelease
- */
-SRA_EXTERN rc_t CC SRAMgrGetSchemaRead ( const SRAMgr *self, struct VSchema const **schema );
-
-
-/* UseSchema
- *  allows SRA schema to be entirely replaced
- *  affects creation/update of all subsequent tables
- *
- *  "schema" [ IN ] - new schema to be applied
- *
- * NB - manager will attach a new reference to schema object,
- *  you are still responsible for releasing it via VSchemaRelease
- */
-SRA_EXTERN rc_t CC SRAMgrUseSchemaRead ( const SRAMgr *self, struct VSchema const *schema );
-
-
-/* Writable
- *  returns 0 if table is writable
- *  rcLocked if locked, rcReadonly if read-only
- *  other code upon error
- *
- *  "path" [ IN ] - NUL terminated table path
- */
-SRA_EXTERN rc_t CC SRAMgrWritable ( const SRAMgr *self, const char *path, ... );
-SRA_EXTERN rc_t CC SRAMgrVWritable ( const SRAMgr *self, const char *path, va_list args );
-
-
-/*--------------------------------------------------------------------------
- * SRANamelist
- */
-typedef struct SRANamelist SRANamelist;
-
-/* AddRef
- * Release
- *  see REFERENCE COUNTING, above
- */
-SRA_EXTERN rc_t CC SRANamelistAddRef ( const SRANamelist *self );
-SRA_EXTERN rc_t CC SRANamelistRelease ( const SRANamelist *self );
-
-
-/* Count
- *  gets the number of names
- *
- *  "count" [ OUT ] - return value
- */
-SRA_EXTERN rc_t CC SRANamelistCount ( const SRANamelist *self, uint32_t *count );
-
-
-/* Get
- *  gets an indexed name
- *
- *  "idx" [ IN ] - zero-based name index
- *
- *  "name" [ OUT ] - return parameter for NUL terminated name
- */
-SRA_EXTERN rc_t CC SRANamelistGet ( const SRANamelist *self,
-    uint32_t idx, const char **name );
-    
-    
-/*--------------------------------------------------------------------------
- * SRATable
- *  a collection of spots with several data series, minimally including
- *  base or color calls and their quality ( confidence ) values, and
- *  optionally signal-related values ( signal, intensity, noise, ... ).
- *
- *  to discover the series available, use "SRATableListCol" to get
- *  the names, and "SRATableColDatatypes" to list data types available
- *  for each name.
- *
- *  see below for standard readable columns
- */
-typedef struct SRATable SRATable;
-
-/* AddRef
- * Release
- *  see REFERENCE COUNTING, above
- */
-SRA_EXTERN rc_t CC SRATableAddRef ( const SRATable *self );
-SRA_EXTERN rc_t CC SRATableRelease ( const SRATable *self );
-
-
-/* OpenRead
- *  open an existing table
- *
- *  "tbl" [ OUT ] - return parameter for table
- *
- *  "spec" [ IN ] - NUL terminated UTF-8 string giving path
- *  to table.
- */
-SRA_EXTERN rc_t CC SRAMgrOpenTableRead ( const SRAMgr *self,
-    const SRATable **tbl, const char *spec, ... );
-SRA_EXTERN rc_t CC SRAMgrVOpenTableRead ( const SRAMgr *self,
-    const SRATable **tbl, const char *spec, va_list args );
-
-/* Locked
- *  returns true if locked
- */
-SRA_EXTERN bool CC SRATableLocked ( const SRATable *self );
-
-
-/* BaseCount
- *  get the number of stored bases
- *
- *  "num_bases" [ OUT ] - return parameter for base count
- */
-SRA_EXTERN rc_t CC SRATableBaseCount ( const SRATable *self, uint64_t *num_bases );
-
-
-/* SpotCount
- *  get the number of stored spots
- *
- *  "spot_count" [ OUT ] - return parameter for spot count
- */
-SRA_EXTERN rc_t CC SRATableSpotCount ( const SRATable *self, uint64_t *spot_count );
-
-
-/* MinSpotId
- *  returns the minimum spot id
- *
- *  a table will contain a collection of spots with ids from
- *  min(spot_id) to max(spot_id) unless empty.
- *
- *  "id" [ OUT ] - return parameter of last spot id
- *  or zero if the table is empty.
- */
-SRA_EXTERN rc_t CC SRATableMinSpotId ( const SRATable *self, spotid_t *id );
-
-/* MaxSpotId
- *  returns the maximum spot id
- *
- *  a table will contain a collection of spots with ids from
- *  1 to max ( spot_id ) unless empty.
- *
- *  "id" [ OUT ] - return parameter of last spot id
- *  or zero if the table is empty.
- */
-SRA_EXTERN rc_t CC SRATableMaxSpotId ( const SRATable *self, spotid_t *id );
-
-
-/* GetSpotId
- *  convert spot name to spot id
- *  may fail if original textual spot name is not present
- *
- *  "id" [ OUT ] - return parameter for 1-based spot id
- *
- *  "spot_name" [ IN ] - external spot name string
- *  in platform canonical format.
- */
-SRA_EXTERN rc_t CC SRATableGetSpotId ( const SRATable *self,
-    spotid_t *id, const char *spot_name );
-
-
-/* ListCol
- *  returns a list of simple column names
- *  each name represents at least one typed column
- *
- *  "names" [ out ] - return parameter for names list
- */
-SRA_EXTERN rc_t CC SRATableListCol ( const SRATable *self, SRANamelist **names );
-
-
-/* ColDatatypes
- *  returns list of typedecls for named column
- *
- *  "col" [ IN ] - column name
- *
- *  "dflt_idx" [ OUT, NULL OKAY ] - returns the zero-based index
- *  into "typedecls" of the default datatype for the named column
- *
- *  "typedecls" [ OUT ] - list of datatypes available for named column
- */
-SRA_EXTERN rc_t CC SRATableColDatatypes ( const SRATable *self, const char *col,
-    uint32_t *dflt_idx, SRANamelist **typedecls );
-
-
-/* MetaRevision
- *  returns current revision number
- *  where 0 ( zero ) means tip
- */
-SRA_EXTERN rc_t CC SRATableMetaRevision ( const SRATable *self, uint32_t *revision );
-
-
-/* MaxRevision
- *  returns the maximum revision available
- */
-SRA_EXTERN rc_t CC SRATableMaxMetaRevision ( const SRATable *self, uint32_t *revision );
-
-
-/* UseMetaRevision
- *  opens indicated revision of metadata
- *  all non-zero revisions are read-only
- */
-SRA_EXTERN rc_t CC SRATableUseMetaRevision ( const SRATable *self, uint32_t revision );
-
-
-/* OpenMDataNode
- *  open a metadata node
- *
- *  "node" [ OUT ] - return parameter for metadata node
- *
- *  "path" [ IN ] - simple or hierarchical NUL terminated
- *  path to node
- */
-SRA_EXTERN rc_t CC SRATableOpenMDataNodeRead ( const SRATable *self,
-    struct KMDataNode const **node, const char *path, ... );
-SRA_EXTERN rc_t CC SRATableVOpenMDataNodeRead ( const SRATable *self,
-    struct KMDataNode const **node, const char *path, va_list args );
-
-
-/*  SRATableGetSchema
- *  returns current schema of the open cursor
- */
-SRA_EXTERN struct VSchema const* CC SRATableGetSchema ( const SRATable *self );
-
-
-
-/*--------------------------------------------------------------------------
- * SRAColumn
- *  represents a spot data column, where the column is configured as
- *  a sequence of blobs, and each blob is a sequence of records,
- *  indexed by spot id.
- */
-typedef struct SRAColumn SRAColumn;
-
-/* AddRef
- * Release
- *  see REFERENCE COUNTING, above
- */
-SRA_EXTERN rc_t CC SRAColumnAddRef ( const SRAColumn *self );
-SRA_EXTERN rc_t CC SRAColumnRelease ( const SRAColumn *self );
-
-
-/* OpenColumnRead
- *  open a column for read
- *
- *  "col" [ OUT ] - return parameter for newly opened column
- *
- *  "name" [ IN ] - NUL terminated string in UTF-8 giving column name
- *
- *  "datatype" [ IN, NULL OKAY ] - optional NUL terminated typedecl
- *  string describing fully qualified column data type, or if NULL
- *  the default type for column.
- */
-SRA_EXTERN rc_t CC SRATableOpenColumnRead ( const SRATable *self,
-    const SRAColumn **col, const char *name, const char *datatype );
-
-
-/* Datatype
- *  access data type
- *
- *  "type" [ OUT, NULL OKAY ] - returns the column type declaration
- *
- *  "def" [ OUT, NULL OKAY ] - returns the definition of the type
- *  returned in "type_decl"
- *
- * NB - one of "type" and "def" must be non-NULL
- */
-SRA_EXTERN rc_t CC SRAColumnDatatype ( const SRAColumn *self,
-    struct VTypedecl *type, struct VTypedef *def );
-
-
-/* GetRange
- *  get a contiguous range around a spot id, e.g. tile for Illumina
- *
- *  "id" [ IN ] - return parameter for 1-based spot id
- *
- *  "first" [ OUT, NULL OKAY ] and "last" [ OUT, NULL OKAY ] -
- *  id range is returned in these output parameters, where
- *  at least ONE must be NOT-NULL
- */
-SRA_EXTERN rc_t CC SRAColumnGetRange ( const SRAColumn *self,
-    spotid_t id, spotid_t *first, spotid_t *last );
-
-
-/* Read
- *  read row data
- *
- *  "id" [ IN ] - spot row id between 1 and max ( spot id )
- *
- *  "base" [ OUT ] and "offset" [ OUT ] - pointer and bit offset
- *  to start of spot row data.
- *
- *  "size" [ OUT ] - size in bits of row data
- */
-SRA_EXTERN rc_t CC SRAColumnRead ( const SRAColumn *self, spotid_t id,
-    const void **base, bitsz_t *offset, bitsz_t *size );
-
-
-
-/*--------------------------------------------------------------------------
- * SRA column formatted type descriptions
- *
- *  most datatypes are constructed as vectors, rather than structures.
- *  this permits flexibility in data transformations and removes compiler
- *  dependency in layout.
- */
-
-
-/* SRAPlatforms
- *  see <insdc/sra.h>
- */
-typedef INSDC_SRA_platform_id SRAPlatforms;
-
-
-/* SRAReadTypes
- *  read type bits
- *  see <insdc/sra.h>
- */
-typedef INSDC_SRA_xread_type SRAReadTypes;
-
-
-/* SRAReadFilter
- *  read filter attribute bits
- *  see <insdc/sra.h>
- */
-typedef INSDC_SRA_read_filter SRAReadFilter;
-
-
-/* SRASpotDesc - DEPRECATED
- *  a structure returned by SPOT_DESC column
- */
-#define sra_spot_desc_t "NCBI:SRA:SpotDesc"
-typedef struct SRASpotDesc SRASpotDesc;
-struct SRASpotDesc
-{
-    /* lengths in bases */
-    uint16_t spot_len;
-    uint16_t fixed_len;
-    uint16_t signal_len;
-
-    /* quality clips */
-    uint16_t clip_qual_right;
-
-    /* number of reads per spot */
-    uint8_t num_reads;
-
-    /* pad out to have 16 byte structure size */
-    uint8_t align [ 7 ];
-};
-
-/* SRASegment - DEPRECATED
- *  a paired starting coordinate and length
- */
-#define sra_segment_t "NCBI:SRA:Segment"
-typedef struct SRASegment SRASegment;
-struct SRASegment
-{
-    uint16_t start;
-    uint16_t len;
-};
-
-/* SRAReadDesc - DEPRECATED
- *  a structure 
- */
-#define sra_read_desc_t "NCBI:SRA:ReadDesc"
-typedef struct SRAReadDesc SRAReadDesc;
-struct SRAReadDesc
-{
-    /* location and length in bases of read
-       within READ and QUALITY columns */
-    SRASegment seg;
-
-    /* read type from SRAReadTypes */
-    uint8_t type;
-
-    /* optional color space key */
-    char cs_key;
-
-    /* NUL terminated read label */
-    char label [ 74 ];
-};
-
-/* SRAPhredPair
- *  pairs an event character with a phred score
- *  event characters are "ACGT0123B+-"
- */
-#define sra_phred_pair_t "NCBI:SRA:PhredPair"
-typedef struct SRAPhredPair SRAPhredPair;
-struct SRAPhredPair
-{
-    char event;
-    INSDC_quality_phred phred;
-};
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_sra_sradb_ */
diff --git a/interfaces/sra/sradb.hpp b/interfaces/sra/sradb.hpp
deleted file mode 100644
index 2bb3b5b..0000000
--- a/interfaces/sra/sradb.hpp
+++ /dev/null
@@ -1,441 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _hpp_sra_sradb_
-#define _hpp_sra_sradb_
-
-#ifdef _hpp_sra_wsradb_
-#error "read and update libraries are mutually exclusive"
-#endif
-
-#ifndef _h_sra_sradb_
-#include <sra/sradb.h>
-#endif
-
-
-/*--------------------------------------------------------------------------
- * SRAMgr
- *  opaque handle to SRA library
- */
-struct SRAMgr
-{
-    /* AddRef
-     * Release
-     */
-    inline rc_t AddRef () const throw ()
-    { return SRAMgrAddRef ( this ); }
-
-    inline rc_t Release () const throw ()
-    { return SRAMgrRelease ( this ); }
-
-
-    /* Make
-     *  create library handle for read-only access
-     *
-     *  NB - not implemented in read/write library,
-     *  and the read-only library may not be mixed with read/write
-     */
-    static inline rc_t Make ( const SRAMgr **mgr ) throw ()
-    { return SRAMgrMakeRead ( mgr ); }
-    static inline rc_t Make ( const SRAMgr **mgr, const KDirectory *wd ) throw ()
-    { return SRAMgrMakeReadWithDir ( mgr, wd ); }
-
-
-    /* Version
-     *  returns the library version
-     */
-    inline rc_t Version ( uint32_t *version ) const throw ()
-    { return SRAMgrVersion ( this, version ); }
-
-
-    /* OpenDatatypes
-     *  open datatype registry object for requested access
-     *  see <vdb/types.hpp> for VDatatypes
-     *
-     *  "dt" [ OUT ] - return parameter for datatypes object
-     */
-    inline rc_t OpenDatatypes ( const VDatatypes **dt ) const throw ()
-    { return SRAMgrOpenDatatypesRead ( this, dt ); }
-
-
-    /* GetSchema
-     *  get a reference to the schema used to create new tables
-     *
-     *  "schema" [ OUT ] - return parameter for reference to SRA schema
-     *
-     * NB - returns a new reference that must be released via VSchemaRelease
-     */
-    inline rc_t GetSchemaRead ( const VSchema **schema ) const throw ()
-    { return SRAMgrGetSchemaRead ( this, schema ); }
-
-
-    /* UseSchema
-     *  allows SRA schema to be entirely replaced
-     *  affects creation/update of all subsequent tables
-     *
-     *  "schema" [ IN ] - new schema to be applied
-     *
-     * NB - manager will attach a new reference to schema object,
-     *  you are still responsible for releasing it via VSchemaRelease
-     */
-    inline rc_t UseSchemaRead ( const VSchema *schema ) const throw ()
-    { return SRAMgrUseSchemaRead ( this, schema ); }
-
-
-    /* Writable
-     *  returns 0 if table is writable
-     *  rcLocked if locked, rcReadonly if read-only
-     *  other code upon error
-     *
-     *  "path" [ IN ] - NUL terminated table path
-     */
-    inline bool Writable ( const char *path, ... ) const throw ()
-    {
-        va_list args;
-        va_start ( args, path );
-        bool locked = SRAMgrVWritable ( this, path, args );
-        va_end ( args );
-        return locked;
-    }
-    inline bool Writable ( const char *path, va_list args ) const throw ()
-    { return SRAMgrVWritable ( this, path, args ); }
-
-
-    /* OpenTable
-     *  open an existing table for read
-     *
-     *  "tbl" [ OUT ] - return parameter for table
-     *
-     *  "path" [ IN ] - NUL terminated run name
-     */
-    inline rc_t OpenTable ( const SRATable **tbl,
-        const char *path, ... ) const throw ()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = SRAMgrVOpenTableRead ( this, tbl, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t OpenTable ( const SRATable **tbl, const char *path,
-        va_list args ) const throw ()
-    { return SRAMgrVOpenTableRead ( this, tbl, path, args ); }
-    
-private:
-    SRAMgr ();
-    ~ SRAMgr ();
-    SRAMgr ( const SRAMgr& );
-    SRAMgr &operator = ( const SRAMgr& );
-};
-
-
-/*--------------------------------------------------------------------------
- * SRATable
- *  a collection of spots with several data series, minimally including
- *  base or color calls and their quality ( confidence ) values, and
- *  optionally signal-related values ( signal, intensity, noise, ... ).
- */
-struct SRATable
-{
-    /* AddRef
-     * Release
-     */
-    inline rc_t AddRef () const throw ()
-    { return SRATableAddRef ( this ); }
-
-    inline rc_t Release () const throw ()
-    { return SRATableRelease ( this ); }
-
-
-    /* Locked
-     *  returns true if locked
-     */
-    inline bool Locked () const throw ()
-    { return SRATableLocked ( this ); }
-
-
-    /* BaseCount
-     *  get the number of stored bases
-     *
-     *  "num_bases" [ OUT ] - return parameter for base count
-     */
-    inline rc_t BaseCount ( uint64_t *num_bases ) const throw ()
-    { return SRATableBaseCount ( this, num_bases ); }
-
-
-    /* SpotCount
-     *  get the number of stored spots
-     *
-     *  "spot_count" [ OUT ] - return parameter for spot count
-     */
-    inline rc_t SpotCount ( uint64_t *spot_count ) const throw ()
-    { return SRATableSpotCount ( this, spot_count ); }
-
-
-    /* MaxSpotId
-     *  returns the maximum spot id
-     *
-     *  a table will contain a collection of spots with ids from
-     *  1 to max ( spot_id ).
-     *
-     *  "id" [ OUT ] - return parameter of last spot id
-     */
-    inline rc_t MaxSpotId ( spotid_t *id ) const throw ()
-    { return SRATableMaxSpotId ( this, id ); }
-
-
-    /* MinSpotId
-     *  returns the minimum spot id
-     *
-     *  a table will contain a collection of spots with ids from
-     *  min to max ( spot_id ).
-     *
-     *  "id" [ OUT ] - return parameter of last spot id
-     */
-    inline rc_t MinSpotId ( spotid_t *id ) const throw ()
-    { return SRATableMinSpotId ( this, id ); }
-
-    /* GetSpotId
-     *  project a spot id from a spot name
-     *
-     *  "id" [ OUT ] - return parameter for 1-based spot id
-     *
-     *  "spot_name" [ IN ] - external spot name string
-     */
-    inline rc_t GetSpotId ( spotid_t *id, const char *spot_name ) const throw ()
-    { return SRATableGetSpotId ( this, id, spot_name ); }
-
-
-    /* ListCol
-     *  returns a list of column names
-     *
-     *  "names" [ out ] - return parameter for names list
-     */
-    inline rc_t ListCol ( SRANamelist **names ) const throw ()
-    { return SRATableListCol ( this, names ); }
-
-
-    /* ColDatatypes
-     *  returns list of typedecls for named column
-     *
-     *  "col" [ IN ] - column name
-     *
-     *  "dflt_idx" [ OUT, NULL OKAY ] - returns the zero-based index
-     *  into "typedecls" of the default datatype for the named column
-     *
-     *  "typedecls" [ OUT ] - list of datatypes available for named column
-     */
-    inline rc_t ColDatatypes ( const char *col,
-        uint32_t *dflt_idx, SRANamelist **typedecls ) const throw ()
-    { return SRATableColDatatypes ( this, col, dflt_idx, typedecls ); }
-
-
-    /* OpenColumn
-     *  open a column for read
-     *
-     *  "col" [ OUT ] - return parameter for newly opened column
-     *
-     *  "name" [ IN ] - NUL terminated string in UTF-8 giving column name
-     *
-     *  "datatype" [ IN - NULL OKAY ] - optional NUL terminated
-     *   string describing fully qualified column data type in ASCII
-     */
-    inline rc_t OpenColumn ( const SRAColumn **col,
-        const char *name, const char *datatype = 0 ) const throw ()
-    { return SRATableOpenColumnRead ( this, col, name, datatype ); }
-
-
-    /* MetaRevision
-     *  returns current revision number
-     *  where 0 ( zero ) means tip
-     */
-    inline rc_t MetaRevision ( uint32_t *revision ) const throw ()
-    { return SRATableMetaRevision ( this, revision ); }
-
-
-    /* MaxRevision
-     *  returns the maximum revision available
-     */
-    inline rc_t MaxMetaRevision ( uint32_t *revision ) const throw ()
-    { return SRATableMaxMetaRevision ( this, revision ); }
-
-
-    /* UseMetaRevision
-     *  opens indicated revision of metadata
-     *  all non-zero revisions are read-only
-     */
-    inline rc_t UseMetaRevision ( uint32_t revision ) const throw ()
-    { return SRATableUseMetaRevision ( this, revision ); }
-
-
-    /* OpenMDataNode
-     *  open a metadata node
-     *
-     *  "node" [ OUT ] - return parameter for metadata node
-     *
-     *  "path" [ IN ] - simple or hierarchical NUL terminated
-     *  path to node
-     */
-    inline rc_t OpenMDataNode ( const KMDataNode **node,
-        const char *path, ... ) const throw ()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = SRATableVOpenMDataNodeRead ( this, node, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t OpenMDataNode ( const KMDataNode **node,
-        const char *path, va_list args ) const throw ()
-    { return SRATableVOpenMDataNodeRead ( this, node, path, args ); }
-
-
-    /*  GetSchema
-    *  returns current schema of the open cursor
-    */
-    inline struct VSchema const* GetSchema () const throw ()
-    { return SRATableGetSchema ( this ); }
-
-private:
-    SRATable ();
-    ~ SRATable ();
-    SRATable ( const SRATable& );
-    SRATable &operator = ( const SRATable& );
-};
-
-
-/*--------------------------------------------------------------------------
- * SRAColumn
- *  represents a spot data column, where the column is configured as
- *  a sequence of blobs, and each blob is a sequence of records,
- *  indexed by spot id.
- */
-struct SRAColumn
-{
-    /* AddRef
-     * Release
-     */
-    inline rc_t AddRef () const throw ()
-    { return SRAColumnAddRef ( this ); }
-
-    inline rc_t Release () const throw ()
-    { return SRAColumnRelease ( this ); }
-
-
-    /* Datatype
-     *  access data type
-     *
-     *  "type" [ OUT, NULL OKAY ] - returns the column type declaration
-     *
-     *  "def" [ OUT, NULL OKAY ] - returns the definition of the type
-     *  returned in "type_decl"
-     *
-     * NB - one of "type" and "def" must be non-NULL
-     */
-    inline int Datatype ( struct VTypedecl *type, struct VTypedef *def ) const throw ()
-    { return SRAColumnDatatype ( this, type, def ); }
-
-
-    /* GetRange
-     *  get a contiguous range around a spot id, e.g. tile for Illumina
-     *
-     *  "id" [ IN ] - return parameter for 1-based spot id
-     *
-     *  "first" [ OUT, NULL OKAY ] and "last" [ OUT, NULL OKAY ] -
-     *  id range is returned in these output parameters, where
-     *  at least ONE must be NOT-NULL
-     */
-    inline rc_t GetRange ( spotid_t id, spotid_t *first, spotid_t *last ) const throw ()
-    { return SRAColumnGetRange ( this, id, first, last ); }
-
-
-    /* Read
-     *  read row data
-     *
-     *  "id" [ IN ] - spot row id between 1 and max ( spot id )
-     *
-     *  "base" [ OUT ] and "offset" [ OUT ] - pointer and bit offset
-     *  to start of spot row data.
-     *
-     *  "size" [ OUT ] - size in bits of row data
-     */
-    inline rc_t Read ( spotid_t id,
-        const void **base, bitsz_t *offset, bitsz_t *size ) const throw ()
-    { return SRAColumnRead ( this, id, base, offset, size ); }
-
-
-private:
-    SRAColumn ();
-    ~ SRAColumn ();
-    SRAColumn ( const SRAColumn& );
-    SRAColumn &operator = ( const SRAColumn& );
-};
-
-
-/*--------------------------------------------------------------------------
- * SRANamelist
- *  a list of names, types or other strings
- */
-struct SRANamelist
-{
-    /* AddRef
-     * Release
-     */
-    inline rc_t AddRef () const throw ()
-    { return SRANamelistAddRef ( this ); }
-
-    inline rc_t Release () const throw ()
-    { return SRANamelistRelease ( this ); }
-
-
-    /* Count
-     *  gets the number of names
-     *
-     *  "count" [ OUT ] - return value
-     */
-    inline rc_t Count ( uint32_t *count ) const throw ()
-    { return SRANamelistCount ( this, count ); }
-
-
-    /* Get
-     *  gets an indexed name
-     *
-     *  "idx" [ IN ] - zero-based name index
-     *
-     *  "name" [ OUT ] - return parameter for NUL terminated name
-     */
-    inline rc_t Get ( uint32_t idx, const char **name ) const throw ()
-    { return SRANamelistGet ( this, idx, name ); }
-
-
-private:
-    SRANamelist ();
-    ~ SRANamelist ();
-    SRANamelist ( const SRANamelist& );
-    SRANamelist &operator = ( const SRANamelist& );
-};
-
-#endif // _hpp_sra_sradb_
diff --git a/interfaces/sra/srapath.h b/interfaces/sra/srapath.h
deleted file mode 100644
index 9965e8d..0000000
--- a/interfaces/sra/srapath.h
+++ /dev/null
@@ -1,181 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_sra_srapath_
-#define _h_sra_srapath_
-
-#ifndef _h_sra_extern_
-#include <sra/extern.h>
-#endif
-
-#ifndef _h_klib_callconv_
-#include <klib/callconv.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define TOOLS_USE_SRAPATH 0
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KNamelist;
-struct KDirectory;
-
-
-/*--------------------------------------------------------------------------
- * SRAPath
- *  manages accession -> path conversion
- */
-typedef struct SRAPath SRAPath;
-
-
-/* Make
- *  create path manager
- *
- *  the path manager should already be configured with
- *  standard search paths, but can be augmented by using
- *  the Add*Path messages.
- *
- *  "dir" [ IN, NULL OKAY ] - optional root directory to use
- *  attaches a new reference
- */
-SRA_EXTERN rc_t CC SRAPathMake ( SRAPath **pm, struct KDirectory const *dir );
-
-
-/* AddRef
- * Release
- */
-SRA_EXTERN rc_t CC SRAPathAddRef ( const SRAPath *self );
-SRA_EXTERN rc_t CC SRAPathRelease ( const SRAPath *self );
-
-/* Version
- *  returns the library version
- */
-SRA_EXTERN rc_t CC SRAPathVersion ( const SRAPath *self, uint32_t *version );
-
-
-/* Clear
- *  forget existing server and volume paths for the default repository
- */
-SRA_EXTERN rc_t CC SRAPathClear ( SRAPath *self );
-
-
-/* AddRepPath
- *  add a replication path to the default repository
- *
- *  "rep" [ IN ] - NUL-terminated server search path
- *  may be a compound path with ':' separator characters, e.g.
- *  "/panfs/traces01:/panfs/traces31"
- *
- *  NB - servers are searched in the order provided,
- *  first to last, until one of them satisfies a request,
- *  at which time the successful server is placed at the
- *  head of the search path.
- */
-SRA_EXTERN rc_t CC SRAPathAddRepPath ( SRAPath *self, const char *rep );
-
-
-/* AddVolPath
- *  add a volume path to the default repository
- *
- *  "vol" [ IN ] - NUL-terminated volume search path
- *  may be a compound path with ':' separator characters, e.g.
- *  "sra2:sra1:sra0"
- *
- *  NB - volumes are searched in the order provided,
- *  first to last. they are never re-ordered.
- */
-SRA_EXTERN rc_t CC SRAPathAddVolPath ( SRAPath *self, const char *vol );
-
-
-/* Full
- *  creates full path from server, volume & accession
- *
- *  "rep" [ IN ] - NUL terminated full path of replication
- *  server, e.g. "/panfs/traces01"
- *
- *  "vol" [ IN ] - NUL terminated relative path of volume,
- *  e.g. "sra2"
- *
- *  "accession" [ IN ] - NUL terminated run accession,
- *  e.g. "SRR000001"
- *
- *  "path" [ OUT ] and "path_max" [ IN ] - return buffer for
- *  NUL-terminated full path to accession.
- */
-SRA_EXTERN rc_t CC SRAPathFull ( const SRAPath *self, const char *rep,
-    const char *vol, const char *accession, char *path, size_t path_max );
-
-
-/* Test
- *  returns true if path appears to be accession
- *  the test is a heuristic, and may return false positives
- *
- *  "path" [ IN ] - NUL terminated path to run
- */
-SRA_EXTERN bool CC SRAPathTest ( const SRAPath *self, const char *path );
-
-
-/* Find
- *  finds location of run within rep-server/volume matrix
- *
- *  "accession" [ IN ] - NUL terminated run accession,
- *   e.g. "SRR000001"
- *
- *  "path" [ OUT ] and "path_max" [ IN ] - return buffer for
- *  NUL-terminated full path to accession.
- *
- *  returns 0 if path exists, rc state rcNotFound if
- *  path cannot be found, and rcInsufficient if buffer is
- *  too small.
- */
-SRA_EXTERN rc_t CC SRAPathFind ( const SRAPath *self,
-    const char *accession, char *path, size_t path_max );
-
-
-/* List
- *  list all runs known to SRAPath
- *  this can be VERY SLOW due to the large number of runs
- *
- *  "runs" [ OUT ] - return parameter for ordered list of accessions
- *
- *  "deep" [ IN ] - when false, list only first responding server
- */
-SRA_EXTERN rc_t CC SRAPathList ( const SRAPath *self, struct KNamelist **runs, bool deep );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_sra_srapath_ */
diff --git a/interfaces/sra/srapath.hpp b/interfaces/sra/srapath.hpp
deleted file mode 100644
index a863dfa..0000000
--- a/interfaces/sra/srapath.hpp
+++ /dev/null
@@ -1,176 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _hpp_sra_srapath_
-#define _hpp_sra_srapath_
-
-#ifndef _h_sra_srapath_
-#include <sra/srapath.h>
-#endif
-
-
-/*--------------------------------------------------------------------------
- * SRAPath
- *  archive specific path manager
- */
-struct SRAPath
-{
-    /* Make
-     *  create path manager
-     *
-     *  the path manager should already be configured with
-     *  standard search paths, but can be augmented by using
-     *  the Add*Path messages.
-     *
-     *  "dir" [ IN, NULL OKAY ] - optional root directory to use
-     *  attaches a new reference
-     */
-    static inline rc_t Make ( SRAPath **pm,
-        struct KDirectory const *dir = NULL ) throw()
-    { return SRAPathMake ( pm, dir ); }
-
-
-    /* AddRef
-     * Release
-     */
-    inline rc_t AddRef () const  throw()
-    { return SRAPathAddRef ( this ); }
-
-    inline rc_t Release () const  throw()
-    { return SRAPathRelease ( this ); }
-
-
-    /* Version
-     *  returns the library version
-     */
-    inline rc_t Version ( uint32_t *version ) const  throw()
-    { return SRAPathVersion ( this, version ); }
-
-
-    /* Clear
-     *  forget all existing server and volume paths
-     */
-    inline rc_t Clear () throw()
-    { return SRAPathClear ( this ); }
-
-    /* AddRepPath
-     *  add a replication path
-     *
-     *  "rep" [ IN ] - NUL-terminated server search path
-     *  may be a compound path with ':' separator characters, e.g.
-     *  "/panfs/traces01:/panfs/traces31"
-     *
-     *  NB - servers are searched in the order provided,
-     *  first to last, until one of them satisfies a request,
-     *  at which time the successful server is placed at the
-     *  head of the search path.
-     */
-    inline rc_t AddRepPath ( const char *rep )  throw()
-    { return SRAPathAddRepPath ( this, rep ); }
-
-
-    /* AddVolPath
-     *  add a volume path
-     *
-     *  "vol" [ IN ] - NUL-terminated volume search path
-     *  may be a compound path with ':' separator characters, e.g.
-     *  "sra2:sra1:sra0"
-     *
-     *  NB - volumes are searched in the order provided,
-     *  first to last. they are never re-ordered.
-     */
-    inline rc_t AddVolPath ( const char *vol )  throw()
-    { return SRAPathAddVolPath ( this, vol ); }
-
-
-    /* Full
-     *  creates full path from server, volume & accession
-     *
-     *  "rep" [ IN ] - NUL terminated full path of replication
-     *  server, e.g. "/panfs/traces01"
-     *
-     *  "vol" [ IN ] - NUL terminated relative path of volume,
-     *  e.g. "sra2"
-     *
-     *  "accession" [ IN ] - NUL terminated run accession,
-     *  e.g. "SRR000001"
-     *
-     *  "path" [ OUT ] and "path_max" [ IN ] - return buffer for
-     *  NUL-terminated full path to accession.
-     */
-    inline rc_t Full ( const char *rep, const char *vol,
-        const char *accession, char *path, size_t path_max ) const  throw()
-    { return SRAPathFull ( this, rep, vol, accession, path, path_max ); }
-
-
-    /* Test
-     *  returns true if path appears to be accession
-     *  the test is a heuristic, and may return false positives
-     *
-     *  "path" [ IN ] - NUL terminated path to run
-     */
-    inline bool Test ( const char *path ) const  throw()
-    { return SRAPathTest ( this, path ); }
-
-
-    /* Find
-     *  finds location of run within rep-server/volume matrix
-     *
-     *  "accession" [ IN ] - NUL terminated run accession,
-     *   e.g. "SRR000001"
-     *
-     *  "path" [ OUT ] and "path_max" [ IN ] - return buffer for
-     *  NUL-terminated full path to accession.
-     *
-     *  returns 0 if path exists, rc state rcNotFound if
-     *  path cannot be found, and rcInsufficient if buffer is
-     *  too small.
-     */
-    inline rc_t Find ( const char *accession, char *path,
-        size_t path_max ) const throw()
-    { return SRAPathFind ( this, accession, path, path_max ); }
-
-
-    /* List
-     *  list all runs known to SRAPath
-     *  this can be VERY SLOW due to the large number of runs
-     *
-     *  "runs" [ OUT ] - return parameter for ordered list of accessions
-     *
-     *  "deep" [ IN ] - when false, list only first responding server
-     */
-    inline rc_t List ( struct KNamelist **runs,
-        bool deep = false ) const  throw()
-    { return SRAPathList ( this, runs, deep ); }
-
-private:
-    SRAPath ();
-    ~ SRAPath ();
-    SRAPath ( const SRAPath& );
-    SRAPath &operator = ( const SRAPath& );
-};
-
-#endif // _hpp_sra_srapath_
diff --git a/interfaces/sra/sraschema.h b/interfaces/sra/sraschema.h
deleted file mode 100644
index 428061c..0000000
--- a/interfaces/sra/sraschema.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_sra_sraschema_
-#define _h_sra_sraschema_
-
-#ifndef _h_sra_extern_
-#include <sra/extern.h>
-#endif
-
-#ifndef _h_klib_callconv_
-#include <klib/callconv.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct SRAMgr;
-struct VSchema;
-struct VDBManager;
-
-
-/*--------------------------------------------------------------------------
- * SRASchema
- *  a schema object pre-loaded with default SRA schema
- */
-
-
-/* Make
- *  create an instance of the default SRA schema
- */
-SRA_EXTERN rc_t CC SRAMgrMakeSRASchema ( struct SRAMgr const *self, struct VSchema **schema );
-SRA_EXTERN rc_t CC VDBManagerMakeSRASchema ( struct VDBManager const *self, struct VSchema **schema );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_sra_sraschema_ */
diff --git a/interfaces/sra/types.h b/interfaces/sra/types.h
deleted file mode 100644
index 5cfa126..0000000
--- a/interfaces/sra/types.h
+++ /dev/null
@@ -1,350 +0,0 @@
-/*=======================================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_sra_types_
-#define _h_sra_types_
-
-#ifndef _h_sra_extern_
-#include <sra/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#include <stdarg.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * logical intrinsics
- *  CS101 datatypes
- *
- *  logical types are intrinsic and have no signed property. they exist
- *  mainly to support bit manipulation operations. actual numeric types
- *  inherit their size and byte-swapping from logical types.
- */
-
-#define vdb_bit1_t          "B1"
-#define vdb_bit8_t          "B8"
-#define vdb_bit16_t        "B16"
-#define vdb_bit32_t        "B32"
-#define vdb_bit64_t        "B64"
-#define vdb_bit128_t      "B128"
-
-
-/*--------------------------------------------------------------------------
- * numeric types
- *  CS101 datatypes
- *
- *  in general, all numbers are named type + size in bits, where
- *  type = "U" for unsigned, "I" for signed, and "F" for floats.
- */
-
-#define vdb_uint1_t         "U1"       /* supertype "B1"      */
-#define vdb_int8_t          "I8"       /* supertype "B8"      */
-#define vdb_uint8_t         "U8"       /* supertype "B8"      */
-#define vdb_int16_t        "I16"       /* supertype "B16"     */
-#define vdb_uint16_t       "U16"       /* supertype "B16"     */
-#define vdb_int32_t        "I32"       /* supertype "B32"     */
-#define vdb_uint32_t       "U32"       /* supertype "B32"     */
-#define vdb_int64_t        "I64"       /* supertype "B64"     */
-#define vdb_uint64_t       "U64"       /* supertype "B64"     */
-#define vdb_int128_t      "I128"       /* supertype "B128"    */
-#define vdb_uint128_t     "U128"       /* supertype "B128"    */
-#define vdb_float32_t      "F32"       /* supertype "B32"     */
-#define vdb_float64_t      "F64"       /* supertype "B64"     */
-
-
-/*--------------------------------------------------------------------------
- * boolean
- */
-
-#define vdb_bool_t      "bool"          /* supertype "U8"     */
-
-
-/*--------------------------------------------------------------------------
- * character types
- */
-
-#define vdb_utf8_t      "utf8"          /* supertype "B8"     */
-#define vdb_utf16_t     "utf16"         /* supertype "B16"    */
-#define vdb_utf32_t     "utf32"         /* supertype "B32"    */
-#define vdb_ascii_t     "ascii"         /* supertype "utf8"   */
-
-
-/*--------------------------------------------------------------------------
- * INSDC types
- */
-#define insdc_fasta_t   "INSDC:dna:text"        /* supertype "ascii"  */
-#define insdc_csfasta_t "INSDC:color:text"      /* supertype "ascii"  */
-#define insdc_2na_t     "INSDC:2na:packed"      /* supertype "B1[2]"  */
-#define insdc_4na_t     "INSDC:4na:packed"      /* supertype "B1[4]"  */
-#define insdc_2cs_t     "INSDC:2cs:packed"      /* supertype "B1[2]"  */
-#define insdc_phred_t   "INSDC:quality:phred"   /* supertype "U8"     */
-#define insdc_logodds_t "INSDC:quality:log_odds"/* supertype "I8"     */
-
-
-/*--------------------------------------------------------------------------
- * NCBI types
- *  types common within NCBI.
- *
- *  partial byte sized types do not have a registered supertype,
- *  but are commented to indicate their size
- */
-
-#define ncbi_qual4_t    "NCBI:qual4"         /* supertype "I8[4]"  */
-#define ncbi_isamp1_t   "NCBI:isamp1"        /* supertype "I16"    */
-#define ncbi_isamp4_t   "NCBI:isamp4"        /* supertype "I16[4]" */
-#define ncbi_fsamp1_t   "NCBI:fsamp1"        /* supertype "F32"    */
-#define ncbi_fsamp4_t   "NCBI:fsamp4"        /* supertype "F32[4]" */
-
-
-/* alias names */
-#define ncbi_2na_t      insdc_2na_t
-#define ncbi_4na_t      insdc_4na_t
-#define ncbi_2cs_t      insdc_2cs_t
-#define ncbi_qual1_t    insdc_phred_t
-
-
-/*--------------------------------------------------------------------------
- * VTypedef
- *  used to describe properties of a type
- *
- *  when properly filled out, the structure indicates
- *  the 1-based runtime id of type, that of its supertype
- *  or 0 if none, the size in bits of type, the size in
- *  bits of the supertype ( or element type, when dim > 1 )
- *  and the vector dimension given when type was introduced,
- *  as well as whether the type is a signed numeric.
- *
- *  example: "typedef I8 NCBI:qual4 [ 4 ]" translates to:
- *    type_id   = runtime type id of NCBI:qual4
- *    super_id  = runtime type id of I8
- *    size      = 8
- *    dim       = 4
- *    sign      = true
- */
-typedef struct VTypedef VTypedef;
-struct VTypedef
-{
-    /* runtime type id */
-    uint32_t type_id;
-
-    /* supertype id */
-    uint32_t super_id;
-
-    /* size of type element */
-    bitsz_t type_size;
-
-    /* vector dimension */
-    uint32_t dim;
-
-    /* signed property */
-    uint32_t sign;
-};
-
-
-/* Sizeof
- *  returns the bit size of declared type
- *
- *  technically, this is self -> size * self -> dim.
- */
-/* bitsz_t VTypedefSizeof ( const VTypedef *self ); */
-#define VTypedefSizeof(T) ((bitsz_t)(((T)->type_size) * ((T)->dim)))
-
-
-/*--------------------------------------------------------------------------
- * VDatatypes
- */
-typedef struct VDatatypes VDatatypes;
-
-
-/* forward */
-struct VTypedecl;
-
-
-/* AddRef
- * Release
- */
-SRA_EXTERN rc_t CC VDatatypesAddRef ( const VDatatypes *self );
-SRA_EXTERN rc_t CC VDatatypesRelease ( const VDatatypes *self );
-
-
-/* RegisterOpaque
- * RegisterSubtype
- *  registers new datatypes
- *
- *  "newtype" [ IN ] - NUL terminated fully qualified type name
- *
- *  "supertype" [ IN ] and "dim" [ IN ] - NUL terminated fully
- *  qualified parent equivalency type and vector dimension
- *  -OR-
- *  "bits" [ IN ] - size in bits of element.
- *
- *  "byte_swap" [ IN, CONDITIONALLY NULL OKAY ] - a byte swapping function
- *  required when size > 8 and and integral multiple of 8.
- */
-#if 0
-SRA_EXTERN rc_t CC VDatatypesRegisterOpaque ( VDatatypes *self,
-    const char *newtype, uint16_t bits,
-    void ( CC * byte_swap ) ( void *elem ) );
-SRA_EXTERN rc_t CC VDatatypesRegisterSubtype ( VDatatypes *self,
-    const char *newtype, const char *supertype, uint16_t dim,
-    void ( CC * byte_swap ) ( void *elem ) );
-#endif
-
-/* DefineSubtype
- *  creates a subtype definition
- *
- *    typedef = [ 'typedef' ] <supertype> <typedecl>
- */
-#if 0
-SRA_EXTERN rc_t CC VDatatypesDefineSubtype ( VDatatypes *self,
-    const char *definition, ... );
-SRA_EXTERN rc_t CC VDatatypesVDefineSubtype ( VDatatypes *self,
-    const char *definition, va_list args );
-#endif
-
-/* ResolveTypedecl
- *  converts a typedecl string to type id and vector dimension
- *
- *  "resolved" [ OUT ] - resolved type declaration
- *
- *  "typedecl" [ IN ] - type declaration
- */
-SRA_EXTERN rc_t CC VDatatypesResolveTypedecl ( const VDatatypes *self,
-    struct VTypedecl *resolved, const char *typedecl, ... );
-SRA_EXTERN rc_t CC VDatatypesVResolveTypedecl ( const VDatatypes *self,
-    struct VTypedecl *resolved, const char *typedecl, va_list args );
-
-
-/* ResolveTypename
- *  convert a type id into its type definition
- *
- *  "resolved" [ OUT ] - resolved type definition
- *
- *  "typname" [ IN ] - NUL-terminated type name
- */
-SRA_EXTERN rc_t CC VDatatypesResolveTypename ( const VDatatypes *self,
-    VTypedef *resolved, const char *typname );
-
-
-/* ResolveTypeid
- *  convert a type id into its type definition
- *
- *  "resolved" [ OUT ] - resolved type definition
- *
- *  "type_id" [ IN ] - 1-based runtime type id
- */
-SRA_EXTERN rc_t CC VDatatypesResolveTypeid ( const VDatatypes *self,
-    VTypedef *resolved, uint32_t type_id );
-
-
-/* SizeofTypedecl
- *  returns the bit size of type declaration
- */
-SRA_EXTERN rc_t CC VDatatypesSizeofTypedecl ( const VDatatypes *self,
-    bitsz_t *type_size, struct VTypedecl const *td );
-
-
-/* SizeofTypeid
- *  returns the bit size of typeid
- *
- *  "type_size" [ OUT ] - bit size of a type
- *
- *  "type_id" [ IN ] - numerical index of a type
- *
- *  "all_elements" [ IN ] - for multi-dimesional types
- *  return the sum of sizes, otherwise - only for a single element
- */
-SRA_EXTERN rc_t CC VDatatypesSizeofTypeid ( const VDatatypes *self,
-    bitsz_t *type_size, uint32_t type_id, bool all_elements );
-
-
-/* MakeTypedecl
- *  convert a VTypedecl into canonical text
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - output buffer for
- *  NUL terminated type declaration string
- *
- *  "typedecl" [ IN ] - binary representation of typedecl
- */
-SRA_EXTERN rc_t CC VDatatypesMakeTypedecl ( const VDatatypes *self,
-    char *buffer, size_t bsize, struct VTypedecl const *typedecl );
-
-
-/* ToSupertype
- *  cast a typedecl to a size-equivalent supertype decl
- *  returns not-found and leaves "typedecl" unchanged
- *  if no supertype exists
- *
- *  "typedecl" [ IN, OUT ] - populated with a correct
- *  type id and vector dimension on input, will be updated
- *  to contain a supertype and equivalent dimension on
- *  output. e.g.:
- *
- *    IN -  { type_id NCBI:qual4, dim 1 }
- *    OUT - { type_id I8, dim 4 }
- */
-SRA_EXTERN rc_t CC VDatatypesToSupertype ( const VDatatypes *self, struct VTypedecl *typedecl );
-
-
-/* ToIntrinsic
- *  cast a typedecl ( if necessary ) to a size-equivalent
- *  intrinsic typedecl.
- *
- *  returns not-found and leaves "typedecl" unchanged
- *  if no intrinsic supertype exists
- *
- *  leaves "typedecl" unchanged if it is already intrinsic.
- *
- *  "typedecl" [ IN, OUT ] - populated with a correct
- *  type id and vector dimension on input, will be updated
- *  to contain a supertype and equivalent dimension on
- *  output. e.g.:
- *
- *    IN -  { type_id NCBI:qual4, dim 1 }
- *    OUT - { type_id I8, dim 4 }
- */
-SRA_EXTERN rc_t CC VDatatypesToIntrinsic ( const VDatatypes *self, struct VTypedecl *typedecl );
-
-
-/* ToAncestor
- *  cast a typedecl to a size-equivalent ancestor decl
- *  returns true if cast can be performed
- */
-SRA_EXTERN bool CC VDatatypesToAncestor ( const VDatatypes *self,
-    struct VTypedecl const *to, struct VTypedecl const *from );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*  _h_sra_types_ */
diff --git a/interfaces/sra/wsradb.h b/interfaces/sra/wsradb.h
deleted file mode 100644
index 70baa6b..0000000
--- a/interfaces/sra/wsradb.h
+++ /dev/null
@@ -1,242 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_sra_wsradb_
-#define _h_sra_wsradb_
-
-#ifndef _h_sra_extern_
-#include <sra/extern.h>
-#endif
-
-#ifndef _h_sra_sradb_
-#include <sra/sradb.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct VSchema;
-struct KDirectory;
-
-
-/*--------------------------------------------------------------------------
- * SRAMgr
- *  opaque handle to SRA library
- */
-
-
-/* MakeUpdate
- *  create library handle for read/write access
- *
- *  "wd" [ IN, NULL OKAY ] - optional working directory for
- *  accessing the file system. mgr will attach its own reference.
- *
- *  NB - not implemented in read-only library,
- *  and the read-only library may not be mixed with read/write
- */
-SRA_EXTERN rc_t CC SRAMgrMakeUpdate ( SRAMgr **mgr, struct KDirectory *wd );
-
-
-/* SetMD5Mode
- *  sets default MD5 file mode for all objects
- *  opened for update under manager
- */
-SRA_EXTERN rc_t CC SRAMgrSetMD5Mode ( SRAMgr *self, bool useMD5 );
-
-
-/* Lock
- *  apply lock
- *
- *  if object is already locked, the operation is idempotent
- *  and returns an rc state of rcLocked
- *
- *  "path" [ IN ] - NUL terminated path
- */
-SRA_EXTERN rc_t CC SRAMgrLock ( SRAMgr *self, const char *path, ... );
-SRA_EXTERN rc_t CC SRAMgrVLock ( SRAMgr *self, const char *path, va_list args );
-
-
-/* Unlock
- *  remove lock
- *
- *  if object is already unlocked, the operation is idempotent
- *  and returns an rc state of rcUnlocked
- *
- *  "path" [ IN ] - NUL terminated path
- */
-SRA_EXTERN rc_t CC SRAMgrUnlock ( SRAMgr *self, const char *path, ... );
-SRA_EXTERN rc_t CC SRAMgrVUnlock ( SRAMgr *self, const char *path, va_list args );
-
-
-/* DropTable
- *  drop an existing table
- *
- *  "force" [ IN ] - if true, make every attempt to remove table
- *
- *  "path" [ IN ]  - NUL terminated table name
- */
- SRA_EXTERN rc_t CC SRAMgrDropTable ( SRAMgr *self, bool force, const char *path, ... );
- SRA_EXTERN rc_t CC SRAMgrVDropTable ( SRAMgr *self, bool force, const char *path, va_list args );
-
-
-/*--------------------------------------------------------------------------
- * SRATable
- *  a collection of spots with several data series, minimally including
- *  base or color calls and their quality ( confidence ) values, and
- *  optionally signal-related values ( signal, intensity, noise, ... ).
- */
-
-/* Create
- *  creates a new table
- *
- *  "tbl" [ OUT ] - return parameter for table
- *
- *  "typespec" [ IN ] - type and optionally version of table schema,
- *  e.g. 'MY_NAMESPACE:MyTable' or 'MY_NAMESPACE:MyTable#1.1'
- *
- *  "path" [ IN ] - NUL terminated table name
- */
-SRA_EXTERN rc_t CC SRAMgrCreateTable ( SRAMgr *self, SRATable **tbl,
-    const char *typespec, const char *path, ... );
-SRA_EXTERN rc_t CC SRAMgrVCreateTable ( SRAMgr *self, SRATable **tbl,
-    const char *typespec, const char *path, va_list args );
-
-
-/* OpenUpdate
- *  open an existing table
- *
- *  "run" [ OUT ] - return parameter for table
- *
- *  "path" [ IN ] - NUL terminated table name
- */
-SRA_EXTERN rc_t CC SRAMgrOpenTableUpdate ( SRAMgr *self,
-    SRATable **tbl, const char *path, ... );
-SRA_EXTERN rc_t CC SRAMgrVOpenTableUpdate ( SRAMgr *self,
-    SRATable **tbl, const char *path, va_list args );
-
-
-/* NewSpot
- *  creates a new spot record, returns spot id.
- *
- *  "id" [ OUT ] - return parameter for id of newly created spot
- */
-SRA_EXTERN rc_t CC SRATableNewSpot ( SRATable *self, spotid_t *id );
-
-
-/* OpenSpot
- *  opens an existing spot record from id
- *
- *  "id" [ IN ] - 1-based spot id
- */
-SRA_EXTERN rc_t CC SRATableOpenSpot ( SRATable *self, spotid_t id );
-
-
-/* CloseSpot
- *  closes a spot opened with either NewSpot or OpenSpot
- */
-SRA_EXTERN rc_t CC SRATableCloseSpot ( SRATable *self );
-
-
-/* Commit
- *  commit all changes
- */
-SRA_EXTERN rc_t CC SRATableCommit ( SRATable *self );
-
-
-/* OpenColumnWrite
- *  open a column for write
- *
- *  "idx" [ OUT ] - return parameter for 1-based column index.
- *
- *  "col" [ OUT, NULL OKAY ] - optional return parameter for
- *  newly opened column.
- *
- *  "name" [ IN ] - NUL terminated string in UTF-8 giving column name
- *
- *  "datatype" [ IN ] - NUL terminated string in ASCII
- *   describing fully qualified column data type
- */
-SRA_EXTERN rc_t CC SRATableOpenColumnWrite ( SRATable *self, uint32_t *idx,
-    SRAColumn **col, const char *name, const char *datatype );
-
-
-/* SetIdxColumnDefault
- *  give a default value for column
- *
- *  if no value gets written to a column within an open spot,
- *  this value is substituted.
- *
- *  "idx" [ IN ] - 1-based column index
- *
- *  "base" [ IN ] and "offset" [ IN ] - pointer and bit offset
- *  to start of row data
- *
- *  "size" [ IN ] - size in bits of row data
- */
-SRA_EXTERN rc_t CC SRATableSetIdxColumnDefault ( SRATable *self, uint32_t idx,
-    const void *base, bitsz_t offset, bitsz_t size );
-
-
-/* WriteIdxColumn
- *  write row data to an indexed column
- *
- *  "idx" [ IN ] - 1-based column index
- *
- *  "base" [ IN ] and "offset" [ IN ] - pointer and bit offset
- *  to start of row data
- *
- *  "size" [ IN ] - size in bits of row data
- */
-SRA_EXTERN rc_t CC SRATableWriteIdxColumn ( SRATable *self, uint32_t idx,
-    const void *base, bitsz_t offset, bitsz_t size );
-
-
-/* MetaFreeze
- *  freezes current metadata revision
- *  further modification will begin on a copy
- */
-SRA_EXTERN rc_t CC SRATableMetaFreeze ( SRATable *self );
-
-
-/* OpenMDataNode
- *  open a metadata node
- */
-SRA_EXTERN rc_t CC SRATableOpenMDataNodeUpdate ( SRATable *self,
-    struct KMDataNode **node, const char *path, ... );
-SRA_EXTERN rc_t CC SRATableVOpenMDataNodeUpdate ( SRATable *self,
-    struct KMDataNode **node, const char *path, va_list args );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_sra_wsradb_ */
diff --git a/interfaces/sra/wsradb.hpp b/interfaces/sra/wsradb.hpp
deleted file mode 100644
index cd69111..0000000
--- a/interfaces/sra/wsradb.hpp
+++ /dev/null
@@ -1,591 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _hpp_sra_wsradb_
-#define _hpp_sra_wsradb_
-
-#ifdef _hpp_sra_sradb_
-#error "read and update libraries are mutually exclusive"
-#endif
-
-#ifndef _h_sra_wsradb_
-#include <sra/wsradb.h>
-#endif
-
-
-/*--------------------------------------------------------------------------
- * SRAMgr
- *  opaque handle to SRA library
- */
-struct SRAMgr
-{
-    /* AddRef
-     * Release
-     */
-    inline rc_t AddRef () const throw()
-    { return SRAMgrAddRef ( this ); }
-
-    inline rc_t Release () const throw()
-    { return SRAMgrRelease ( this ); }
-
-
-    /* Make
-     *  create library handle for read/write access
-     *
-     *  NB - not implemented in read-only library,
-     *  and the read-only library may not be mixed with read/write
-     */
-    static inline rc_t Make ( SRAMgr **mgr, struct KDirectory *wd = 0 )  throw()
-    { return SRAMgrMakeUpdate ( mgr, wd ); }
-
-
-
-    /* SetMD5Mode
-     *  sets default MD5 file mode for all objects
-     *  opened for update under manager
-     */
-    inline rc_t SetMD5Mode ( bool useMD5 )  throw()
-    { return SRAMgrSetMD5Mode ( this, useMD5 ); }
-
-
-    /* Lock
-     *  apply lock
-     *
-     *  if table is already locked, the operation is idempotent
-     *  and returns an rc state of rcLocked
-     *
-     *  "path" [ IN ] - NUL terminated table path
-     */
-    inline rc_t Lock ( const char *path, ... ) throw()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = SRAMgrVLock ( this, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t Lock ( const char *path, va_list args ) throw()
-    { return SRAMgrVLock ( this, path, args ); }
-
-
-    /* Unlock
-     *  remove lock
-     *
-     *  if table is already unlocked, the operation is idempotent
-     *  and returns an rc state of rcUnlocked
-     *
-     *  "path" [ IN ] - NUL terminated table path
-     */
-    inline rc_t SRAMgrUnlock ( SRAMgr *self, const char *path, ... ) throw()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = SRAMgrVUnlock ( this, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t SRAMgrUnlock ( SRAMgr *self, const char *path, 
-        va_list args ) throw()
-    { return SRAMgrVUnlock ( this, path, args ); }
-
-
-    /* DropTable
-     *  drop an existing table
-     *
-     *  "force" [ IN ] - if true, make every attempt to remove table
-     *
-     *  "path" [ IN ]  - NUL terminated table name
-     */
-    inline rc_t DropTable ( bool force, const char *path, ... ) throw()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = SRAMgrVDropTable ( this, force, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t DropTable ( bool force, const char *path, va_list args ) throw()
-    { return SRAMgrVDropTable ( this, force, path, args ); }
-
-
-    /* OpenDatatypes
-     *  open datatype registry object for requested access
-     *  see <vdb/types.hpp> for VDatatypes
-     *
-     *  "dt" [ OUT ] - return parameter for datatypes object
-     */
-    inline rc_t OpenDatatypes ( struct VDatatypes const **dt ) const throw()
-    { return SRAMgrOpenDatatypesRead ( this, dt ); }
-
-
-    /* GetSchema
-     *  get a reference to the schema used to create new tables
-     *
-     *  "schema" [ OUT ] - return parameter for reference to SRA schema
-     *
-     * NB - returns a new reference that must be released via VSchemaRelease
-     */
-    inline rc_t GetSchemaRead ( struct VSchema const **schema ) const throw()
-    { return SRAMgrGetSchemaRead ( this, schema ); }
-
-
-    /* UseSchema
-     *  allows SRA schema to be entirely replaced
-     *  affects creation/update of all subsequent tables
-     *
-     *  "schema" [ IN ] - new schema to be applied
-     *
-     * NB - manager will attach a new reference to schema object,
-     *  you are still responsible for releasing it via VSchemaRelease
-     */
-    inline rc_t UseSchemaRead ( struct VSchema const *schema ) const throw()
-    { return SRAMgrUseSchemaRead ( this, schema ); }
-
-
-    /* Writable
-     *  returns 0 if table is writable
-     *  rcLocked if locked, rcReadonly if read-only
-     *  other code upon error
-     *
-     *  "path" [ IN ] - NUL terminated table path
-     */
-    inline bool Writable ( const char *path, ... ) const throw()
-    {
-        va_list args;
-        va_start ( args, path );
-        bool locked = SRAMgrVWritable ( this, path, args );
-        va_end ( args );
-        return locked;
-    }
-    inline bool Writable ( const char *path, va_list args ) const throw()
-    { return SRAMgrVWritable ( this, path, args ); }
-
-    /* Create
-     *  creates a new table
-     *
-     *  "tbl" [ OUT ] - return parameter for table
-     *
-     *  "typespec" [ IN ] - type and optionally version of table schema,
-     *  e.g. 'MY_NAMESPACE:MyTable' or 'MY_NAMESPACE:MyTable#1.1'
-     *
-     *  "path" [ IN ] - NUL terminated table name
-     */
-    inline rc_t CreateTable ( SRATable **tbl, const char *typespec,
-        const char *path, ... ) throw()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = SRAMgrVCreateTable ( this, tbl, typespec, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t CreateTable ( SRATable **tbl, const char *typespec,
-        const char *path, va_list args ) throw()
-    { return SRAMgrVCreateTable ( this, tbl, typespec, path, args ); }
-
-
-    /* OpenTable
-     *  open an existing table for read
-     *
-     *  "tbl" [ OUT ] - return parameter for table
-     *
-     *  "path" [ IN ] - NUL terminated run name
-     */
-    inline rc_t OpenTable ( const SRATable **tbl,
-        const char *path, ... ) const throw()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = SRAMgrVOpenTableRead ( this, tbl, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t OpenTable ( const SRATable **tbl, const char *path,
-        va_list args ) const throw()
-    { return SRAMgrVOpenTableRead ( this, tbl, path, args ); }
-
-
-    inline rc_t OpenTable ( SRATable **tbl, const char *path, ... ) throw()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = SRAMgrVOpenTableUpdate ( this, tbl, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t OpenTable ( SRATable **tbl, const char *path, va_list args ) throw()
-    { return SRAMgrVOpenTableUpdate ( this, tbl, path, args ); }
-
-
-private:
-    SRAMgr ();
-    ~ SRAMgr ();
-    SRAMgr ( const SRAMgr& );
-    SRAMgr &operator = ( const SRAMgr& );
-};
-
-
-/*--------------------------------------------------------------------------
- * SRATable
- *  a collection of spots with several data series, minimally including
- *  base or color calls and their quality ( confidence ) values, and
- *  optionally signal-related values ( signal, intensity, noise, ... ).
- */
-struct SRATable
-{
-    /* AddRef
-     * Release
-     */
-    inline rc_t AddRef () const throw()
-    { return SRATableAddRef ( this ); }
-
-    inline rc_t Release () const throw()
-    { return SRATableRelease ( this ); }
-
-
-    /* Locked
-     *  returns true if locked
-     */
-    inline bool Locked () const throw()
-    { return SRATableLocked ( this ); }
-
-
-    /* BaseCount
-     *  get the number of stored bases
-     *
-     *  "num_bases" [ OUT ] - return parameter for base count
-     */
-    inline rc_t BaseCount ( uint64_t *num_bases ) const throw()
-    { return SRATableBaseCount ( this, num_bases ); }
-
-
-    /* SpotCount
-     *  get the number of stored spots
-     *
-     *  "spot_count" [ OUT ] - return parameter for spot count
-     */
-    inline rc_t SpotCount ( uint64_t *spot_count ) const throw()
-    { return SRATableSpotCount ( this, spot_count ); }
-
-
-    /* MaxSpotId
-     *  returns the maximum spot id
-     *
-     *  a table will contain a collection of spots with ids from
-     *  min to max ( spot_id ).
-     *
-     *  "id" [ OUT ] - return parameter of last spot id
-     */
-    inline rc_t MaxSpotId ( spotid_t *id ) const throw()
-    { return SRATableMaxSpotId ( this, id ); }
-
-    /* MinSpotId
-     *  returns the minimum spot id
-     *
-     *  a table will contain a collection of spots with ids from
-     *  min to max ( spot_id ).
-     *
-     *  "id" [ OUT ] - return parameter of last spot id
-     */
-    inline rc_t MinSpotId ( spotid_t *id ) const throw()
-    { return SRATableMinSpotId ( this, id ); }
-
-    /* GetSpotId
-     *  project a spot id from a spot name
-     *
-     *  "id" [ OUT ] - return parameter for 1-based spot id
-     *
-     *  "spot_name" [ IN ] - external spot name string
-     */
-    inline rc_t GetSpotId ( spotid_t *id, const char *spot_name ) const throw()
-    { return SRATableGetSpotId ( this, id, spot_name ); }
-
-
-    /* NewSpot
-     *  creates a new spot record, returning spot id.
-     *
-     *  "id" [ OUT ] - return parameter for id of newly created spot
-     */
-    inline rc_t NewSpot ( spotid_t *id ) throw()
-    { return SRATableNewSpot ( this, id ); }
-
-
-    /* OpenSpot
-     *  opens an existing spot record from id
-     *
-     *  "id" [ IN ] - 1-based spot id
-     */
-    inline rc_t OpenSpot ( spotid_t id ) throw()
-    { return SRATableOpenSpot ( this, id ); }
-
-
-    /* CloseSpot
-     *  closes a spot opened with either NewSpot or OpenSpot
-     */
-    inline rc_t CloseSpot () throw()
-    { return SRATableCloseSpot ( this ); }
-
-
-    /* Commit
-     *  commit all changes
-     */
-    inline rc_t Commit () throw()
-    { return SRATableCommit ( this ); }
-
-
-    /* ListCol
-     *  returns a list of column names
-     *
-     *  "names" [ out ] - return parameter for names list
-     */
-    inline rc_t ListCol ( SRANamelist **names ) const throw()
-    { return SRATableListCol ( this, names ); }
-
-
-    /* ColDatatypes
-     *  returns list of typedecls for named column
-     *
-     *  "col" [ IN ] - column name
-     *
-     *  "dflt_idx" [ OUT, NULL OKAY ] - returns the zero-based index
-     *  into "typedecls" of the default datatype for the named column
-     *
-     *  "typedecls" [ OUT ] - list of datatypes available for named column
-     */
-    inline rc_t ColDatatypes ( const char *col,
-        uint32_t *dflt_idx, SRANamelist **typedecls ) const throw()
-    { return SRATableColDatatypes ( this, col, dflt_idx, typedecls ); }
-
-
-    /* OpenColumn
-     *  open a column for read
-     *
-     *  "col" [ OUT ] - return parameter for newly opened column
-     *
-     *  "name" [ IN ] - NUL terminated string in UTF-8 giving column name
-     *
-     *  "datatype" [ IN - NULL OKAY ] - optional NUL terminated
-     *   string describing fully qualified column data type in ASCII
-     */
-    inline rc_t OpenColumn ( const SRAColumn **col,
-        const char *name, const char *datatype = 0 ) const throw()
-    { return SRATableOpenColumnRead ( this, col, name, datatype ); }
-
-
-    /* OpenColumn
-     *  open a column for write
-     *
-     *  "idx" [ OUT ] - return parameter for 1-based column index.
-     *
-     *  "col" [ OUT, NULL OKAY ] - optional return parameter for
-     *  newly opened column.
-     *
-     *  "name" [ IN ] - NUL terminated string in UTF-8 giving column name
-     *
-     *  "datatype" [ IN ] - NUL terminated string in ASCII
-     *   describing fully qualified column data type
-     */
-    inline rc_t OpenColumn ( uint32_t *idx, SRAColumn **col,
-        const char *name, const char *datatype ) throw()
-    { return SRATableOpenColumnWrite ( this, idx, col, name, datatype ); }
-
-
-    /* SetIdxColumnDefault
-     *  give a default value for column
-     *
-     *  if no value gets written to a column within an open spot,
-     *  this value is substituted.
-     *
-     *  "idx" [ IN ] - 1-based column index
-     *
-     *  "base" [ IN ] and "offset" [ IN ] - pointer and bit offset
-     *  to start of row data
-     *
-     *  "size" [ IN ] - size in bits of row data
-     */
-    inline rc_t SetIdxColumnDefault ( uint32_t idx,
-        const void *base, bitsz_t offset, bitsz_t size ) throw()
-    { return SRATableSetIdxColumnDefault ( this, idx, base, offset, size ); }
-
-
-    /* WriteIdxColumn
-     *  write row data to an indexed column
-     *
-     *  "idx" [ IN ] - 1-based column index
-     *
-     *  "base" [ IN ] and "offset" [ IN ] - pointer and bit offset
-     *  to start of row data
-     *
-     *  "size" [ IN ] - size in bits of row data
-     */
-    inline rc_t WriteIdxColumn ( uint32_t idx,
-        const void *base, bitsz_t offset, bitsz_t size ) throw()
-    { return SRATableWriteIdxColumn ( this, idx, base, offset, size ); }
-
-
-    /* MetaRevision
-     *  returns current revision number
-     *  where 0 ( zero ) means tip
-     */
-    inline rc_t MetaRevision ( uint32_t *revision ) const throw()
-    { return SRATableMetaRevision ( this, revision ); }
-
-
-    /* MaxRevision
-     *  returns the maximum revision available
-     */
-    inline rc_t MaxMetaRevision ( uint32_t *revision ) const throw()
-    { return SRATableMaxMetaRevision ( this, revision ); }
-
-
-    /* UseMetaRevision
-     *  opens indicated revision of metadata
-     *  all non-zero revisions are read-only
-     */
-    inline rc_t UseMetaRevision ( uint32_t revision ) const throw()
-    { return SRATableUseMetaRevision ( this, revision ); }
-
-
-    /* MetaFreeze
-     *  freezes current metadata revision
-     *  further modification will begin on a copy
-     */
-    inline rc_t MetaFreeze () throw()
-    { return SRATableMetaFreeze ( this ); }
-
-
-    /* OpenMDataNode
-     *  open a metadata node
-     *
-     *  "node" [ OUT ] - return parameter for metadata node
-     *
-     *  "path" [ IN ] - simple or hierarchical NUL terminated
-     *  path to node
-     */
-    inline rc_t OpenMDataNode ( struct KMDataNode const **node,
-        const char *path, ... ) const throw()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = SRATableVOpenMDataNodeRead ( this, node, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t OpenMDataNode ( struct KMDataNode const **node,
-        const char *path, va_list args ) const throw()
-    { return SRATableVOpenMDataNodeRead ( this, node, path, args ); }
-
-    inline rc_t OpenMDataNode ( struct KMDataNode **node,
-        const char *path, ... ) throw()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = SRATableVOpenMDataNodeUpdate ( this, node, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t OpenMDataNode ( struct KMDataNode **node,
-        const char *path, va_list args ) throw()
-    { return SRATableVOpenMDataNodeUpdate ( this, node, path, args ); }
-
-
-private:
-    SRATable ();
-    ~ SRATable ();
-    SRATable ( const SRATable& );
-    SRATable &operator = ( const SRATable& );
-};
-
-
-/*--------------------------------------------------------------------------
- * SRAColumn
- *  represents a spot data column, where the column is configured as
- *  a sequence of blobs, and each blob is a sequence of records,
- *  indexed by spot id.
- */
-struct SRAColumn
-{
-    /* AddRef
-     * Release
-     */
-    inline rc_t AddRef () const throw()
-    { return SRAColumnAddRef ( this ); }
-
-    inline rc_t Release () const throw()
-    { return SRAColumnRelease ( this ); }
-
-
-    /* Datatype
-     *  access data type
-     *
-     *  "type" [ OUT, NULL OKAY ] - returns the column type declaration
-     *
-     *  "def" [ OUT, NULL OKAY ] - returns the definition of the type
-     *  returned in "type_decl"
-     *
-     * NB - one of "type" and "def" must be non-NULL
-     */
-    inline int Datatype ( struct VTypedecl *type,
-        struct VTypedef *def ) const throw()
-    { return SRAColumnDatatype ( this, type, def ); }
-
-
-    /* GetRange
-     *  get a contiguous range around a spot id, e.g. tile for Illumina
-     *
-     *  "id" [ IN ] - return parameter for 1-based spot id
-     *
-     *  "first" [ OUT, NULL OKAY ] and "last" [ OUT, NULL OKAY ] -
-     *  id range is returned in these output parameters, where
-     *  at least ONE must be NOT-NULL
-     */
-    inline rc_t GetRange ( spotid_t id, spotid_t *first,
-        spotid_t *last ) const throw()
-    { return SRAColumnGetRange ( this, id, first, last ); }
-
-
-    /* Read
-     *  read row data
-     *
-     *  "id" [ IN ] - spot row id between 1 and max ( spot id )
-     *
-     *  "base" [ OUT ] and "offset" [ OUT ] - pointer and bit offset
-     *  to start of spot row data.
-     *
-     *  "size" [ OUT ] - size in bits of row data
-     */
-    inline rc_t Read ( spotid_t id,
-        const void **base, bitsz_t *offset, bitsz_t *size ) const throw()
-    { return SRAColumnRead ( this, id, base, offset, size ); }
-
-private:
-    SRAColumn ();
-    ~ SRAColumn ();
-    SRAColumn ( const SRAColumn& );
-    SRAColumn &operator = ( const SRAColumn& );
-};
-
-#endif // _hpp_sra_sradb_
diff --git a/interfaces/vdb/blob.h b/interfaces/vdb/blob.h
deleted file mode 100644
index 89feaa5..0000000
--- a/interfaces/vdb/blob.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_vdb_blob_
-#define _h_vdb_blob_
-
-#ifndef _h_vdb_extern_
-#include <vdb/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-
-
-/*--------------------------------------------------------------------------
- * VBlob
- *  a collection of data cells
- */
-typedef struct VBlob VBlob;
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-VDB_EXTERN rc_t CC VBlobAddRef ( const VBlob *self );
-VDB_EXTERN rc_t CC VBlobRelease ( const VBlob *self );
-
-
-/* IdRange
- *  returns id range for blob
- *
- *  "first" [ OUT, NULL OKAY ] and "count" [ OUT, NULL OKAY ] -
- *  id range is returned in these output parameters, where
- *  at least ONE must be NOT-NULL
- */
-VDB_EXTERN rc_t CC VBlobIdRange ( const VBlob *self,
-    int64_t *first, uint64_t *count );
-
-
-/* Read
- *  read entire single cell of byte-aligned data into a buffer
- *
- *  "row_id" [ IN ] - allows ReadDirect random access to any cell
- *  in column
- *
- *  "elem_bits" [ IN ] - expected element size in bits, required
- *  to be compatible with the actual element size, and be a multiple
- *  of 8 ( byte-aligned ). for non-byte-aligned data, see ReadBits
- *
- *  "buffer" [ OUT ] and "blen" [ IN ] - return buffer for row data
- *  where "blen" gives buffer capacity in elements. the total buffer
- *  size in bytes == ( "elem_bits" * "blen" + 7 ) / 8.
- *
- *  "row_len" [ OUT ] - return parameter for the number of elements
- *  in the requested row.
- *
- *  when the return code is 0, "row_len" will contain the number of
- *  elements read into buffer. if the return code indicates that the
- *  buffer is too small, "row_len" will give the required buffer length.
- */
-VDB_EXTERN rc_t CC VBlobRead ( const VBlob *self, int64_t row_id,
-    uint32_t elem_bits, void *buffer, uint32_t blen, uint32_t *row_len );
-
-
-/* ReadBits
- *  read single row of potentially bit-aligned cell data into a buffer
- *
- *  "elem_bits" [ IN ] - expected element size in bits, required to be
- *  compatible with the actual element size, and may ( or may not ) be
- *  a multiple of 8 ( byte aligned ).
- *
- *  "start" [ IN ] - zero-based starting index to first element,
- *  valid from 0 .. row_len - 1
- *
- *  "buffer" [ IN ], "boff" [ IN ] and "blen" [ IN ] -
- *  return buffer for row data, where "boff" is in BITS
- *  and "blen" is in ELEMENTS.
- *
- *  "num_read" [ OUT ] - return parameter for the number of elements
- *  read, which is <= "blen"
- *
- *  "remaining" [ OUT, NULL OKAY ] - optional return parameter for
- *  the number of elements remaining to be read. specifically,
- *  "start" + "num_read" + "remaining" == row length, assuming that
- *  "start" <= row length.
- */
-VDB_EXTERN rc_t CC VBlobReadBits ( const VBlob *self, int64_t row_id,
-    uint32_t elem_bits, uint32_t start, void *buffer, uint32_t boff,
-    uint32_t blen, uint32_t *num_read, uint32_t *remaining );
-
-
-/* CellData
- *  access pointer to single cell of potentially bit-aligned cell data
- *
- *  "elem_bits" [ OUT, NULL OKAY ] - optional return parameter for
- *  element size in bits
- *
- *  "base" [ OUT ] and "boff" [ OUT, NULL OKAY ] -
- *  compound return parameter for pointer to row starting bit
- *  where "boff" is in BITS
- *
- *  "row_len" [ OUT, NULL OKAY ] - the number of elements in cell
- */
-VDB_EXTERN rc_t CC VBlobCellData ( const VBlob *self, int64_t row_id,
-    uint32_t *elem_bits, const void **base, uint32_t *boff, uint32_t *row_len );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*  _h_vdb_blob_ */
diff --git a/interfaces/vdb/built-in.vschema b/interfaces/vdb/built-in.vschema
deleted file mode 100644
index 07b28c0..0000000
--- a/interfaces/vdb/built-in.vschema
+++ /dev/null
@@ -1,397 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/*==========================================================================
- * VDB built-in functions, formats and types
- */
-version 1;
-
-
-/*--------------------------------------------------------------------------
- * types
- */
-
-// Row id range consist of row_id_start and row_id_stop
-typedef I64 vdb:row_id_range [ 2 ];
-
-
-/*--------------------------------------------------------------------------
- * typesets
- */
-typeset integer_set { I8, U8, I16, U16, I32, U32, I64, U64 };
-typeset float_set { F32, F64 };
-typeset numeric_set { integer_set, float_set };
-typeset text_set { utf8, utf16, utf32, ascii };
-typeset text8_set { utf8, ascii };
-typeset transpose_set { B8, B16, B32, B64 };
-
-
-/*--------------------------------------------------------------------------
- * formats
- */
-fmtdef merged_fmt;
-fmtdef transposed_fmt;
-fmtdef delta_averaged_fmt;
-
-
-/*--------------------------------------------------------------------------
- * constants
- */
-const U8 ALIGN_LEFT = 0;
-const U8 ALIGN_RIGHT = 1;
-
-/*--------------------------------------------------------------------------
- * functions
- */
-
-
-/* cast
- *  performs a "C++ reinterpret_cast" style cast
- *  rewrites input as required to produce output
- *
- *  legal operations include numeric_set -> numeric_set,
- *  numeric <-> character, etc.
- */
-function
-any cast #1.0 ( any in )
-    = vdb:cast;
-
-/* bit_or
- *  performs a bitwise operation 'OR' for every byte in A and B
- *  A and B are not neccesarily have the same size
- *  the resulting row will have the size of B while OR operation is done for portion of A overlapping B
- *  For different sizes of A and B 'align' parameter provides what edge of A and B are aligned
- *  possible values ALIGN_LEFT, ALIGN_RIGHT
- * 
- */
-function < type T >
-T  bit_or #1 < U8 align > ( T  A, T B  )
-    = vdb:bit_or;
-
-/* trim
- * performs trimming of value val from column A
- * align provides left- or right- trimming
- */
-function < type T >
-T trim #1 < U8 align, T val > ( T A )
-    = vdb:trim;
-
-
-/* redimension
- *  performs a change of dimension without changing bit pattern
- */
-function
-any redimension #1.0 ( any in )
-    = vdb:redimension;
-
-
-/* row_id
- *  returns the row id of a request
- */
-function
-I64 row_id #1.0 ()
-    = vdb:row_id;
-
-
-/* row_len
- *  returns the number of elements in a row
- *
- *  "in" [ DATA ] - column supplying row. if row does not exist
- *  in column, the resultant length is 0.
- */
-function
-U32 row_len #1.0 ( any in )
-    = vdb:row_len;
-
-
-/* fixed_row_len
- *  returns non-zero if the entire page
- *  has a uniform row-length, zero otherwise
- *
- *  "in" [ DATA ] - column to query
- */
-function
-U32 fixed_row_len #1.0 ( any in )
-    = vdb:fixed_row_len;
-
-
-/* compare
- *  evaluates src [ i ] == cmp [ i ]
- *  causes writing exception if unequal.
- *
- *  For whole types, equality is bitwise equal
- *  for floating point types see below.
- *
- *  "T" [ TYPE ] - base element type to be processed
- *
- *  "sig_bits" [ OPTIONAL CONST >= 1 ] - for floating point types, ignored
- *  otherwise, the number of significant binary digits in the mantissas to
- *  compare such that |x - y| <= 1, for corresponding numbers x (in a) and
- *  y (in b) both scaled according to sig_bits and their common magnitude.
- *  "sig_bits" may be an array, if so "sel" is required (see below).
- *
- *  "src" [ DATA ] - standard input data derived from source
- *
- *  "cmp" [ DATA ] - feedback data after being written and re-read
- *
- */
-validate function < type T >
-void compare #1.0 < * U32 sig_bits > ( T src, T cmp )
-    = vdb:compare;
-
-validate function < type T >
-void no_compare #1.0 ( T src, T cmp )
-    = vdb:no_compare;
-
-
-/* compare2f
- *  evaluates src [ i ] == cmp [ i ]
- *  causes writing exception if unequal.
- *
- *  "T" [ TYPE ] - base element type to be processed
- *
- *  "sig_bits" [ CONST >= 1 ] - for floating point types, ignored otherwise,
- *  array containing the number of significant binary digits in the mantissas
- *  to compare such that |x - y| <= 1, for corresponding numbers x (in a) and
- *  y (in b) both scaled according to sig_bits and their common magnitude.
- *
- *  "src" [ DATA ] - standard input data derived from source
- *
- *  "cmp" [ DATA ] - feedback data after being written and re-read
- *
- *  "sel" [ DATA ] - data to select which element of "sig_bits" to
- *  use for the comparison.  The valid values of "sel" are
- *  [0 .. length sig_bits).
- *
-validate function < type T >
-void compare2f #1.0 < U32 sig_bits > ( float_set src, float_set cmp, T sel )
-    = vdb:compare2f;
-*/
-
-/* range_validate
- *  passes input through if all values fall between lower and
- *  upper bounds, INCLUSIVE
- *
- *  "T" [ TYPE ] - type to be validated
- *
- *  "lower" [ CONST ] and "upper" [ CONST ] - inclusive
- *  bounds on input values
- *
- *  "in" [ DATA ] - data to be validated
- */
-function < type T >
-T range_validate #1.0 < T lower, T upper > ( T in )
-    = vdb:range_validate;
-
-
-/* select
- *  return first non-empty input for id
- *  inputs are taken from first to last
- *
- *  "T" [ TYPE ] - data type of selection
- *
- *  "first" [ DATA ] - first of N inputs
- *
- *  "second" [ DATA ] - second of N inputs
- *  all other inputs are optional and must
- *  be compatible with type "T"
- */
-function < type T >
-T select #1.0 ( T first, T second, ... )
-    = vdb:select;
-
-
-/* transpose
- *  transpose a page of unformatted data
- *
- *  for example - convert a simple page of values,
- *  where vertical scale is row id and horizontal element index:
- *
- *        1   2   3
- *      +---+---+---+
- *    1 | a | b | c |
- *      +---+---+---+
- *    2 | d | e | f |
- *      +---+---+---+
- *    3 | g | h | i |
- *      +---+---+---+
- *    4 | j | k | l |
- *      +---+---+---+
- *
- *  into:
- *
- *        1   2   3   4
- *      +---+---+---+---+
- *    1 | a | d | g | j |
- *      +---+---+---+---+
- *    2 | b | e | h | k |
- *      +---+---+---+---+
- *    3 | c | f | i | l |
- *      +---+---+---+---+
- *
- *  variable row-lengths are supported. The output blob is
- *  formatted, meaning that the result can no longer be addressed
- *  as a matrix, but the transposition has be applied to data.
- *
- *  "in" [ DATA ] - unformatted data to be transposed
- */
-function
-transposed_fmt transpose #1 ( transpose_set in )
-    = vdb:transpose;
-
-
-/* detranspose
- *  pardoning the awful name, apply a transposition on the result
- *  of "transpose" to produce the original blob. "transpose"
- *  itself cannot be reused because of its signature.
- */
-function
-transpose_set detranspose #1 ( transposed_fmt in )
-    = vdb:detranspose;
-
-/*
- * delta_average computes average representation of the maximium 
- * lengh row and deltas every row against it
- */
-function
-delta_averaged_fmt delta_average #1 ( any in ) 
-     = vdb:delta_average;
-
-function
-any undelta_average #1 ( delta_averaged_fmt in )
-    = vdb:undelta_average;
-
-/* merge
- *  merges all input blobs of any format/type into a single blob
- */
-function
-merged_fmt merge #1.0 ( any in, ... )
-    = vdb:merge;
-
-
-/* split
- *  extracts a single blob from a merged blob by index
- *
- *  "idx" [ CONST ] - blob index
- */
-
-function
-any split #1.0 < U32 idx > ( merged_fmt in )
-    = vdb:split;
-
-
-/* meta:read
- *  reads table metadata node as a row
- * meta:value
- *  reads metadata node as single value,
- *  performing size conversion if necessary,
- *  e.g. I8 TO I64, I32 TO I16
- *
- *  "T" [ TYPE ] - cast data type of metadata node
- *
- *  "node" [ CONST ] - path to metadata node
- */
-function < type T >
-T meta:read #1.0 < ascii node, * bool deterministic > ();
-
-function < type T >
-T meta:value #1.0 < ascii node, * bool deterministic > ();
-
-
-/* meta:write
- *  writes row data to table metadata node
- *
- *  "T" [ TYPE ] - cast data type of metadata node
- *
- *  "node" [ CONST ] - path to metadata node
- *
- *  "in" [ DATA ] - source of row data
- */
-function < type T >
-T meta:write #1.0 < ascii node > ( T in );
-
-
-/* meta:attr:read
- *  reads table metadata attribute as a row
- *
- *  "node" [ CONST ] - path to metadata node
- *
- *  "attr" [ CONST ] - attribute name on node
- */
-function
-ascii meta:attr:read #1.0 < ascii node, ascii attr, * bool deterministic > ();
-
-
-/* meta:attr:write
- *  write row data as table metadata attribute
- *
- *  "node" [ CONST ] - path to metadata node
- *
- *  "attr" [ CONST ] - attribute name on node
- */
-function
-ascii meta:attr:write #1.0 < ascii node, ascii attr > ( ascii in );
-
-
-/* parameter:read
- *  reads named cursor parameter text
- *
- *  "name" [ CONST ] - parameter name
- */
-function
-text8_set parameter:read #1.0 < ascii name, * bool deterministic > ();
-
-
-/* environment:read
- *  reads named environment variable text
- *
- *  "name" [ CONST ] - environment variable name
- */
-function
-text8_set environment:read #1.0 < ascii name > ();
-
-
-/* idx:text:project
- *  perform a reverse lookup in an index
- *  if key not found then use substitute
- *
- *  "index_name" [ CONST ] - name of text index
- *
- *  "substitute" [ DATA, OPTIONAL ] - source
- *  of values to substitute for values not
- *  found in the index.
- */
-function text8_set idx:text:project #1.0 < ascii index_name > ( * text8_set substitute );
-
-
-/* idx:text:insert
- */
-function text8_set idx:text:insert #1.0 < ascii index_name > ( text8_set key );
-
-
-/* vdb:row_id_range
- */
-function vdb:row_id_range  idx:text:lookup #1 < ascii index_name , ascii query_by_name > ();
diff --git a/interfaces/vdb/cursor.h b/interfaces/vdb/cursor.h
deleted file mode 100644
index 55dce40..0000000
--- a/interfaces/vdb/cursor.h
+++ /dev/null
@@ -1,441 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_vdb_cursor_
-#define _h_vdb_cursor_
-
-#ifndef _h_vdb_extern_
-#include <vdb/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifndef _h_klib_namelist_
-#include <klib/namelist.h>
-#endif
-
-#include <stdarg.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct VBlob;
-struct VTable;
-struct VTypedesc;
-struct VTypedecl;
-
-
-/*--------------------------------------------------------------------------
- * KCreateMode
- *  mode definitions for cursor creation
- *
- *  NB - typedef'd as uint32_t in <klib/defs.h> to ensure uniformly
- *  predictable binary representation.
- */
-enum
-{
-    kcmUpdate,          /* kcmOpen   */
-    kcmReplace,         /* kcmInit   */
-    kcmInsert           /* kcmCreate */
-};
-
-/*--------------------------------------------------------------------------
- * VCursor
- *  a row cursor onto a VTable
- */
-typedef struct VCursor VCursor;
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-VDB_EXTERN rc_t CC VCursorAddRef ( const VCursor *self );
-VDB_EXTERN rc_t CC VCursorRelease ( const VCursor *self );
-
-
-/* CreateCursor
- *  creates a cursor object onto table
- *  multiple read cursors are allowed
- *  only a single write cursor is allowed
- *
- *  "curs" [ OUT ] - return parameter for newly created cursor
- *
- *  "mode" [ IN ] - describes update behavior
- *    kcmUpdate   : allow inserts or updates
- *    kcmReplace  : replace all existing rows with newly written rows
- *    kcmInsert   : allow only inserts, i.e. new rows
- *
- *  NB - CreateCursorRead will be deprecated in future releases
- *  use CreateCachedCursorRead instead.
- */
-VDB_EXTERN rc_t CC VTableCreateCursorRead ( struct VTable const *self, const VCursor **curs );
-VDB_EXTERN rc_t CC VTableCreateCursorWrite ( struct VTable *self, VCursor **curs, KCreateMode mode );
-
-
-/* CreateCachedCursorRead
- *  creates a read cursor object onto table with a cache limit in bytes
- *
- *  AVAILABILITY: version 2.1
- *
- *  "curs" [ OUT ] - return parameter for newly created cursor
- *
- *  "capacity" [ IN ] - the maximum bytes to cache on the cursor before
- *  dropping least recently used blobs
- */
-VDB_EXTERN rc_t CC VTableCreateCachedCursorRead ( struct VTable const *self,
-    const VCursor **curs, size_t capacity );
-
-
-/* AddColumn
- *  add a column to an unopened cursor
- *
- *  "idx" [ OUT ] - return parameter for column index
- *
- *  "name" [ IN ] - NUL terminated column name spec.
- *  to identify a column by name, provide the column name
- *  by itself. if there are multiple types available under
- *  that name, the default type for that column will be
- *  selected. to select a specific type, the name may
- *  be cast to that type using a cast expression, e.g.
- *    "( type ) name"
- *
- * NB - may return a non-zero status code of rcColumn, rcExists
- *  if the column was not added. the return "idx" will still
- *  be set properly and this does NOT indicate an error.
- */
-VDB_EXTERN rc_t CC VCursorAddColumn ( const VCursor *self,
-    uint32_t *idx, const char *name, ... );
-VDB_EXTERN rc_t CC VCursorVAddColumn ( const VCursor *self,
-    uint32_t *idx, const char *name, va_list args );
-
-
-/* GetColumnIdx
- *  retrieve column index by name spec
- *
- *  "idx" [ OUT ] - return parameter for column index
- *
- *  "name" [ IN ] - NUL terminated column name spec.
- */
-VDB_EXTERN rc_t CC VCursorGetColumnIdx ( const VCursor *self,
-    uint32_t *idx, const char *name, ... );
-VDB_EXTERN rc_t CC VCursorVGetColumnIdx ( const VCursor *self,
-    uint32_t *idx, const char *name, va_list args );
-
-
-/* Datatype
- *  returns typedecl and/or typedef for column data
- *
- *  "idx" [ IN ] - column index
- *
- *  "type" [ OUT, NULL OKAY ] - returns the column type declaration
- *
- *  "def" [ OUT, NULL OKAY ] - returns the definition of the type
- *  returned in "type_decl"
- *
- * NB - one of "type" and "def" must be non-NULL
- */
-VDB_EXTERN rc_t CC VCursorDatatype ( const VCursor *self, uint32_t idx,
-    struct VTypedecl *type, struct VTypedesc *desc );
-
-
-/* IdRange
- *  returns id range for column
- *
- *  "idx" [ IN, DEFAULT ZERO ] - single column index or
- *  zero to indicate the range for all columns in cursor
- *
- *  "id" [ IN ] - page containing this row id is target
- *
- *  "first" [ OUT, NULL OKAY ] and "count" [ OUT, NULL OKAY ] -
- *  id range is returned in these output parameters, where
- *  at least ONE must be NOT-NULL
- */
-VDB_EXTERN rc_t CC VCursorIdRange ( const VCursor *self, uint32_t idx,
-    int64_t *first, uint64_t *count );
-
-
-/* Open
- *  open cursor, resolving schema for the set of opened columns
- *
- *  when cursor is created for read, its initial row id
- *  is set to first row available in any contained column.
- *
- *  when cursor is created for write, its initial row id
- *  is set for inserts ( appending ). when empty, initial
- *  row id is set to 1. otherwise, it is set to 1 beyond
- *  the last row available in any contained column.
- *
- *  NB - there is no corresponding "Close"
- *  use "Release" instead.
- */
-VDB_EXTERN rc_t CC VCursorOpen ( const VCursor *self );
-
-
-/* RowId
- *  report current row id
- * SetRowId
- *  seek to given row id
- */
-VDB_EXTERN rc_t CC VCursorRowId ( const VCursor *self, int64_t *row_id );
-VDB_EXTERN rc_t CC VCursorSetRowId ( const VCursor *self, int64_t row_id );
-
-
-/* OpenRow
- *  open currently closed row indicated by row id
- */
-VDB_EXTERN rc_t CC VCursorOpenRow ( const VCursor *self );
-
-/* CommitRow
- *  commit row after writing
- *  prevents further writes
- */
-VDB_EXTERN rc_t CC VCursorCommitRow ( VCursor *self );
-
-/* RepeatRow
- *  repeats the current row by the count provided
- *  row must have been committed
- *
- *  AVAILABILITY: version 2.6
- *
- *  "count" [ IN ] - the number of times to repeat
- *  the current row.
- */
-VDB_EXTERN rc_t CC VCursorRepeatRow ( VCursor *self, uint64_t count );
-
-/* CloseRow
- *  balances OpenRow message
- *  if there are uncommitted modifications,
- *  discard all changes. otherwise,
- *  advance to next row
- */
-VDB_EXTERN rc_t CC VCursorCloseRow ( const VCursor *self );
-
-
-/* FlushPage
- *  forces flush of all buffered page data
- *  fails if row is open
- *
- *  pages are normally auto-committed based upon
- *  size and column affinity
- */
-VDB_EXTERN rc_t CC VCursorFlushPage ( VCursor *self );
-
-
-/* GetBlob
- *  retrieve a blob of data containing the current row id
- * GetBlobDirect
- *  retrieve a blob of data containing the requested row id
- *
- *  "blob" [ OUT ] - return parameter for a new reference
- *  to VBlob containing requested cell. NB - must be released
- *  via VBlobRelease when no longer needed.
- *
- *  "row_id" [ IN ] - allows ReadDirect random access to any cell
- *  in column
- *
- *  "col_idx" [ IN ] - index of column to be read, returned by "AddColumn"
- */
-VDB_EXTERN rc_t CC VCursorGetBlob ( const VCursor *self,
-    struct VBlob const **blob, uint32_t col_idx );
-VDB_EXTERN rc_t CC VCursorGetBlobDirect ( const VCursor *self,
-    struct VBlob const **blob, int64_t row_id, uint32_t col_idx );
-
-
-/* Read
- *  read entire single row of byte-aligned data into a buffer
- * ReadDirect
- *  bypass the need to use SetRowId/OpenRow/CloseRow for addressing
- *
- *  "row_id" [ IN ] - allows ReadDirect random access to any cell
- *  in column
- *
- *  "col_idx" [ IN ] - index of column to be read, returned by "AddColumn"
- *
- *  "elem_bits" [ IN ] - expected element size in bits, required
- *  to be compatible with the actual element size, and be a multiple
- *  of 8 ( byte-aligned ). for non-byte-aligned data, see ReadBits
- *
- *  "buffer" [ OUT ] and "blen" [ IN ] - return buffer for row data
- *  where "blen" gives buffer capacity in elements. the total buffer
- *  size in bytes == ( "elem_bits" * "blen" + 7 ) / 8.
- *
- *  "row_len" [ OUT ] - return parameter for the number of elements
- *  in the requested row.
- *
- *  when the return code is 0, "row_len" will contain the number of
- *  elements read into buffer. if the return code indicates that the
- *  buffer is too small, "row_len" will give the required buffer length.
- */
-VDB_EXTERN rc_t CC VCursorRead ( const VCursor *self, uint32_t col_idx,
-    uint32_t elem_bits, void *buffer, uint32_t blen, uint32_t *row_len );
-VDB_EXTERN rc_t CC VCursorReadDirect ( const VCursor *self, int64_t row_id, uint32_t col_idx,
-    uint32_t elem_bits, void *buffer, uint32_t blen, uint32_t *row_len );
-
-
-/* ReadBits
- *  read single row of potentially bit-aligned column data into a buffer
- * ReadBitsDirect
- *  bypass the need to use SetRowId/OpenRow/CloseRow for addressing
- *
- *  "col_idx" [ IN ] - index of column to be read, returned by "AddColumn"
- *
- *  "elem_bits" [ IN ] - expected element size in bits, required to be
- *  compatible with the actual element size, and may ( or may not ) be
- *  a multiple of 8 ( byte aligned ).
- *
- *  "start" [ IN ] - zero-based starting index to first element,
- *  valid from 0 .. row_len - 1
- *
- *  "buffer" [ IN ], "boff" [ IN ] and "blen" [ IN ] -
- *  return buffer for row data, where "boff" is in BITS
- *  and "blen" is in ELEMENTS.
- *
- *  "num_read" [ OUT ] - return parameter for the number of elements
- *  read, which is <= "blen"
- *
- *  "remaining" [ OUT, NULL OKAY ] - optional return parameter for
- *  the number of elements remaining to be read. specifically,
- *  "start" + "num_read" + "remaining" == row length, assuming that
- *  "start" <= row length.
- */
-VDB_EXTERN rc_t CC VCursorReadBits ( const VCursor *self, uint32_t col_idx,
-    uint32_t elem_bits, uint32_t start, void *buffer, uint32_t boff,
-    uint32_t blen, uint32_t *num_read, uint32_t *remaining );
-VDB_EXTERN rc_t CC VCursorReadBitsDirect ( const VCursor *self, int64_t row_id, uint32_t col_idx,
-    uint32_t elem_bits, uint32_t start, void *buffer, uint32_t boff,
-    uint32_t blen, uint32_t *num_read, uint32_t *remaining );
-
-
-/* CellData
- *  access pointer to single cell of potentially bit-aligned column data
- * CellDataDirect
- *  bypass the need to use SetRowId/OpenRow/CloseRow for addressing
- *
- *  "col_idx" [ IN ] - index of column to be read, returned by "AddColumn"
- *
- *  "elem_bits" [ OUT, NULL OKAY ] - optional return parameter for
- *  element size in bits
- *
- *  "base" [ OUT ] and "boff" [ OUT, NULL OKAY ] -
- *  compound return parameter for pointer to row starting bit
- *  where "boff" is in BITS
- *
- *  "row_len" [ OUT, NULL OKAY ] - the number of elements in cell
- */
-VDB_EXTERN rc_t CC VCursorCellData ( const VCursor *self, uint32_t col_idx,
-    uint32_t *elem_bits, const void **base, uint32_t *boff,
-    uint32_t *row_len );
-VDB_EXTERN rc_t CC VCursorCellDataDirect ( const VCursor *self, int64_t row_id,
-    uint32_t col_idx, uint32_t *elem_bits, const void **base,
-    uint32_t *boff, uint32_t *row_len );
-
-
-/* Default
- *  give a default row value for cell
- *  TBD - document full cell data, not append
- *
- *  "col_idx" [ IN ] - index of column to be read, returned by "AddColumn"
- *
- *  "elem_bits" [ IN ] - stated element size in bits, required
- *  to be compatible with the actual element size
- *
- *  "buffer" [ IN ] and "boff" [ IN ] - compound pointer and offset
- *  to start of default row data where "boff" is in BITS
- *
- *  "row_len" [ IN ] - the number of elements in default row
- */
-VDB_EXTERN rc_t CC VCursorDefault ( VCursor *self, uint32_t col_idx,
-    bitsz_t elem_bits, const void *buffer, bitsz_t boff,
-    uint64_t row_len );
-
-
-/* Write
- *  append bit-aligned column data to cell
- *
- *  "col_idx" [ IN ] - index of column to be read, returned by "AddColumn"
- *
- *  "elem_bits" [ IN ] - stated element size in bits, required
- *  to be compatible with the actual element size
- *
- *  "buffer" [ IN ] and "boff" [ IN ] - compound pointer and offset
- *  to start of default row data where "boff" is in BITS
- *
- *  "count" [ IN ] - the number of elements to append
- */
-VDB_EXTERN rc_t CC VCursorWrite ( VCursor *self, uint32_t col_idx,
-    bitsz_t elem_bits, const void *buffer, bitsz_t boff,
-    uint64_t count );
-
-
-/* Commit
- *  commit changes made to cursor
- *  fails if row is open
- */
-VDB_EXTERN rc_t CC VCursorCommit ( VCursor *self );
-
-
-/* OpenParent
- *  duplicate reference to parent table
- *  NB - returned reference must be released
- */
-VDB_EXTERN rc_t CC VCursorOpenParentRead ( const VCursor *self, struct VTable const **tbl );
-VDB_EXTERN rc_t CC VCursorOpenParentUpdate ( VCursor *self, struct VTable **tbl );
-
-
-/* GetUserData
- * SetUserData
- *  store/retrieve an opaque pointer to user data
- *
- *  "data" [ OUT ] - return parameter for getting data
- *  "data" [ IN ] - parameter for setting data
- *
- *  "destroy" [ IN, NULL OKAY ] - optional destructor param
- *  invoked from destructor of "self"
- */
-VDB_EXTERN rc_t CC VCursorGetUserData ( const VCursor *self, void **data );
-VDB_EXTERN rc_t CC VCursorSetUserData ( const VCursor *self,
-    void *data, void ( CC * destroy ) ( void *data ) );
-
-
-VDB_EXTERN rc_t CC VCursorLinkedCursorGet(const VCursor *cself,const char *tbl,VCursor const **curs);
-VDB_EXTERN rc_t CC VCursorLinkedCursorSet(const VCursor *cself,const char *tbl,VCursor const *curs);
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*  _h_vdb_cursor_ */
diff --git a/interfaces/vdb/cursor.hpp b/interfaces/vdb/cursor.hpp
deleted file mode 100644
index ba89e2d..0000000
--- a/interfaces/vdb/cursor.hpp
+++ /dev/null
@@ -1,388 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _hpp_vdb_cursor_
-#define _hpp_vdb_cursor_
-
-#ifndef _h_vdb_cursor_
-#include <vdb/cursor.h>
-#endif
-
-
-/*--------------------------------------------------------------------------
- * VCursor
- *  a row cursor onto a VTable
- */
-struct VCursor
-{
-    /* AddRef
-     * Release
-     *  all objects are reference counted
-     *  NULL references are ignored
-     */
-    inline rc_t AddRef () const throw()
-    { return VCursorAddRef ( this ); }
-
-    inline rc_t Release () const throw()
-    { return VCursorRelease ( this ); }
-
-
-    /* AddColumn
-     *  add a column to an unopened cursor
-     *
-     *  "idx" [ OUT ] - return parameter for column index
-     *
-     *  "name" [ IN ] - NUL terminated column name spec.
-     *  to identify a column by name, provide the column name
-     *  by itself. if there are multiple types available under
-     *  that name, the default type for that column will be
-     *  selected. to select a specific type, the name may
-     *  be cast to that type using a cast expression, e.g.
-     *    "( type ) name"
-     *  the special name "*" may be added to a read cursor.
-     */
-    inline rc_t AddColumn ( uint32_t *idx,
-        const char *name, ... ) const throw()
-    {
-        va_list args;
-        va_start ( args, name );
-        rc_t rc = VCursorVAddColumn ( this, idx, name, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t AddColumn ( uint32_t *idx,
-        const char *name, va_list args ) const throw()
-    { return VCursorVAddColumn ( this, idx, name, args ); }
-
-
-    /* GetColumnIdx
-     *  retrieve column index by name spec
-     *
-     *  "idx" [ OUT ] - return parameter for column index
-     *
-     *  "name" [ IN ] - NUL terminated column name spec.
-     */
-    inline rc_t GetColumnIdx ( uint32_t *idx,
-        const char *name, ... ) const throw()
-    {
-        va_list args;
-        va_start ( args, name );
-        rc_t rc = VCursorVGetColumnIdx ( this, idx, name, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t GetColumnIdx ( uint32_t *idx,
-        const char *name, va_list args ) const throw()
-    { return  VCursorVGetColumnIdx ( this, idx, name, args ); }
-
-
-    /* Datatype
-     *  returns typedecl and/or typedef for column data
-     *
-     *  "idx" [ IN ] - column index
-     *
-     *  "type" [ OUT, NULL OKAY ] - returns the column type declaration
-     *
-     *  "def" [ OUT, NULL OKAY ] - returns the definition of the type
-     *  returned in "type_decl"
-     *
-     * NB - one of "type" and "def" must be non-NULL
-     */
-    inline rc_t Datatype ( uint32_t idx, VTypedecl *type, 
-        VTypedesc *desc ) const throw()
-    { return VCursorDatatype ( this, idx, type, desc ); }
-
-
-    /* IdRange
-     *  returns id range for column
-     *
-     *  "idx" [ IN, OPTIONAL ] - single column index or
-     *  zero to indicate the range for all columns in cursor
-     *
-     *  "id" [ IN ] - page containing this row id is target
-     *
-     *  "first" [ OUT, NULL OKAY ] and "last" [ OUT, NULL OKAY ] -
-     *  id range is returned in these output parameters, where
-     *  at least ONE must be NOT-NULL
-     */
-    inline rc_t IdRange ( int64_t *first, uint64_t *count ) const throw()
-    { return VCursorIdRange ( this, 0, first, count ); }
-
-    inline rc_t IdRange ( uint32_t idx, int64_t *first,
-        uint64_t *count ) const throw()
-    { return VCursorIdRange ( this, idx, first, count ); }
-
-
-    /* Open
-     *  open cursor, resolving schema for the set of opened columns
-     *
-     *  when cursor is created for read, its initial row id
-     *  is set to first row available in any contained column.
-     *
-     *  when cursor is created for write, its initial row id
-     *  is set for inserts ( appending ). when empty, initial
-     *  row id is set to 1. otherwise, it is set to 1 beyond
-     *  the last row available in any contained column.
-     *
-     *  NB - there is no corresponding "Close"
-     *  use "Release" instead.
-     */
-    inline rc_t Open () const throw()
-    { return VCursorOpen ( this ); }
-
-
-    /* RowId
-     *  report current row id
-     * SetRowId
-     *  seek to given row id
-     */
-    inline rc_t RowId ( int64_t *row_id ) const throw()
-    { return VCursorRowId ( this, row_id ); }
-
-    inline rc_t SetRowId ( int64_t row_id ) const throw()
-    { return VCursorSetRowId ( this, row_id ); }
-
-
-    /* OpenRow
-     *  open currently closed row indicated by row id
-     */
-    inline rc_t OpenRow () const throw()
-    { return VCursorOpenRow ( this ); }
-
-
-    /* CommitRow
-     *  commit row after writing
-     *  prevents further writes
-     */
-    inline rc_t CommitRow () throw()
-    { return VCursorCommitRow ( this ); }
-
-
-    /* CloseRow
-     *  balances OpenRow message
-     *  if there are uncommitted modifications,
-     *  discard all changes. otherwise,
-     *  advance to next row
-     */
-    inline rc_t CloseRow () const throw()
-    { return VCursorCloseRow ( this ); }
-
-
-    /* FlushPage
-     *  forces flush of all buffered page data
-     *  fails if row is open
-     *
-     *  pages are normally auto-committed based upon
-     *  size and column affinity
-     */
-    inline rc_t FlushPage () throw()
-    { return VCursorFlushPage ( this ); }
-
-
-    /* Read
-     *  read entire single row of byte-aligned data into a buffer
-     *
-     *  "col_idx" [ IN ] - index of column to be read, returned by "AddColumn"
-     *
-     *  "elem_bits" [ IN ] - expected element size in bits, required
-     *  to be compatible with the actual element size, and be a multiple
-     *  of 8 ( byte-aligned ). for non-byte-aligned data, see ReadBits
-     *
-     *  "buffer" [ OUT ] and "blen" [ IN ] - return buffer for row data
-     *  where "blen" gives buffer capacity in elements. the total buffer
-     *  size in bytes == ( "elem_bits" * "blen" + 7 ) / 8.
-     *
-     *  "row_len" [ OUT ] - return parameter for the number of elements
-     *  in the requested row.
-     *
-     *  when the return code is 0, "row_len" will contain the number of
-     *  elements read into buffer. if the return code indicates that the
-     *  buffer is too small, "row_len" will give the required buffer length.
-     */
-    inline rc_t Read ( uint32_t col_idx, uint32_t elem_bits,
-        void *buffer, uint32_t blen, uint32_t *row_len ) const throw()
-    {
-        return VCursorRead ( this, col_idx, elem_bits, buffer, blen,  row_len );
-    }
-    inline rc_t Read ( int64_t row_id, uint32_t col_idx, uint32_t elem_bits,
-        void *buffer, uint32_t blen, uint32_t *row_len ) const throw()
-    {
-        return VCursorReadDirect ( this, row_id, col_idx, elem_bits, buffer, blen, row_len );
-    }
-
-
-    /* ReadBits
-     *  read single row of potentially bit-aligned column data into a buffer
-     *
-     *  "col_idx" [ IN ] - index of column to be read, returned by "AddColumn"
-     *
-     *  "elem_bits" [ IN ] - expected element size in bits, required to be
-     *  compatible with the actual element size, and may ( or may not ) be
-     *  a multiple of 8 ( byte aligned ).
-     *
-     *  "start" [ IN ] - zero-based starting index to first element,
-     *  valid from 0 .. row_len - 1
-     *
-     *  "buffer" [ IN ], "boff" [ IN ] and "blen" [ IN ] -
-     *  return buffer for row data, where "boff" is in BITS
-     *  and "blen" is in ELEMENTS.
-     *
-     *  "num_read" [ OUT ] - return parameter for the number of elements
-     *  read, which is <= "blen"
-     *
-     *  "remaining" [ OUT, NULL OKAY ] - optional return parameter for
-     *  the number of elements remaining to be read. specifically,
-     *  "start" + "num_read" + "remaining" == row length, assuming that
-     *  "start" <= row length.
-     */
-    inline rc_t ReadBits ( const VCursor *self, uint32_t col_idx,
-        uint32_t elem_bits, uint32_t start, void *buffer, uint32_t boff,
-        uint32_t blen, uint32_t *num_read, uint32_t *remaining ) const throw()
-    {
-        return VCursorReadBits ( this, col_idx, elem_bits, start,
-            buffer, boff, blen, num_read, remaining );
-    }
-    inline rc_t ReadBits ( const VCursor *self, int64_t row_id, uint32_t col_idx,
-        uint32_t elem_bits, uint32_t start, void *buffer, uint32_t boff,
-        uint32_t blen, uint32_t *num_read, uint32_t *remaining ) const throw()
-    {
-        return VCursorReadBitsDirect ( this, row_id, col_idx, elem_bits, 
-            start, buffer, boff, blen, num_read, remaining );
-    }
-
-
-    /* CellData
-     *  access pointer to single cell of potentially bit-aligned column data
-     *  can fail if row is dynamically generated
-     *
-     *  "col_idx" [ IN ] - index of column to be read, returned by "AddColumn"
-     *
-     *  "elem_bits" [ OUT, NULL OKAY ] - optional return parameter for
-     *  element size in bits
-     *
-     *  "base" [ OUT ] and "boff" [ OUT, NULL OKAY ] -
-     *  compound return parameter for pointer to row starting bit
-     *  where "boff" is in BITS
-     *
-     *  "row_len" [ OUT, NULL OKAY ] - the number of elements in cell
-     */
-    inline rc_t CellData ( uint32_t col_idx, uint32_t *elem_bits,
-        const void **base, uint32_t *boff, uint32_t *row_len ) const throw()
-    {
-        return VCursorCellData ( this, col_idx, elem_bits, base, boff, row_len );
-    }
-    inline rc_t CellData ( int64_t row_id, uint32_t col_idx, uint32_t *elem_bits,
-        const void **base, uint32_t *boff, uint32_t *row_len ) const throw()
-    {
-        return VCursorCellDataDirect ( this, row_id, col_idx, elem_bits,
-            base, boff, row_len );
-    }
-
-    /* Default
-     *  give a default row value for column
-     *
-     *  "col_idx" [ IN ] - index of column to be read, returned by "AddColumn"
-     *
-     *  "elem_bits" [ IN ] - stated element size in bits, required
-     *  to be compatible with the actual element size
-     *
-     *  "buffer" [ IN ] and "boff" [ IN ] - compound pointer and offset
-     *  to start of default row data where "boff" is in BITS
-     *
-     *  "row_len" [ IN ] - the number of elements in default row
-     */
-    inline rc_t Default ( uint32_t col_idx, uint32_t elem_bits,
-        const void *buffer, uint32_t boff, uint32_t row_len ) throw()
-    {
-        return VCursorDefault ( this, col_idx, elem_bits, buffer, boff, row_len );
-    }
-
-
-    /* Write
-     *  append bit-aligned column data to row
-     *
-     *  "col_idx" [ IN ] - index of column to be read, returned by "AddColumn"
-     *
-     *  "elem_bits" [ IN ] - stated element size in bits, required
-     *  to be compatible with the actual element size
-     *
-     *  "buffer" [ IN ] and "boff" [ IN ] - compound pointer and offset
-     *  to start of default row data where "boff" is in BITS
-     *
-     *  "count" [ IN ] - the number of elements to append
-     */
-    inline rc_t Write ( uint32_t col_idx, uint32_t elem_bits,
-        const void *buffer, uint32_t boff, uint32_t count ) throw()
-    {
-        return VCursorWrite ( this, col_idx, elem_bits, buffer, boff, count );
-    }
-
-
-    /* Commit
-     *  commit changes made to cursor
-     *  fails if row is open
-     */
-    inline rc_t Commit () throw()
-    { return VCursorCommit ( this ); }
-
-
-    /* OpenParent
-     *  duplicate reference to parent table
-     *  NB - returned reference must be released
-     */
-    inline rc_t OpenParent ( const VTable **tbl ) const throw()
-    { return VCursorOpenParentRead ( this, tbl ); }
-
-    inline rc_t OpenParent ( VTable **tbl ) throw()
-    { return VCursorOpenParentUpdate ( this, tbl ); }
-
-
-    /* GetUserData
-     * SetUserData
-     *  store/retrieve an opaque pointer to user data
-     *
-     *  "data" [ OUT ] - return parameter for getting data
-     *  "data" [ IN ] - parameter for setting data
-     *
-     *  "destroy" [ IN, NULL OKAY ] - optional destructor param
-     *  invoked from destructor of "self"
-     */
-    inline rc_t GetUserData ( void **data ) const throw()
-    { return VCursorGetUserData ( this, data ); }
-
-    inline rc_t SetUserData ( void *data,
-        void ( CC * destroy ) ( void *data ) = 0 ) const throw()
-    { return VCursorSetUserData ( this, data, destroy ); }
-
-
-private:
-    VCursor ();
-    ~ VCursor ();
-    VCursor ( const VCursor& );
-    VCursor &operator = ( const VCursor& );
-};
-
-#endif // _hpp_vdb_cursor_
diff --git a/interfaces/vdb/database.h b/interfaces/vdb/database.h
deleted file mode 100644
index 2753eee..0000000
--- a/interfaces/vdb/database.h
+++ /dev/null
@@ -1,334 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_vdb_database_
-#define _h_vdb_database_
-
-#ifndef _h_vdb_extern_
-#include <vdb/extern.h>
-#endif
-
-#ifndef _h_kfs_directory_
-#include <kfs/directory.h>
-#endif
-
-#ifndef _h_kdb_column_
-#include <kdb/column.h>
-#endif
-
-#ifndef _h_klib_namelist_
-#include <klib/namelist.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct VSchema;
-struct KMetadata;
-struct VDBManager;
-
-
-/*--------------------------------------------------------------------------
- * VDatabase
- *  opaque connection to a database within file system
- */
-typedef struct VDatabase VDatabase;
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-VDB_EXTERN rc_t CC VDatabaseAddRef ( const VDatabase *self );
-VDB_EXTERN rc_t CC VDatabaseRelease ( const VDatabase *self );
-
-
-/* CreateDB
- *  create a new or open an existing database using manager
- *
- *  "db" [ OUT ] - return parameter for newly opened database
- *
- *  "schema" [ IN ] - schema object containg database
- *  declaration to be used in creating db.
- *
- *  "typespec" [ IN ] - type and optionally version of db schema,
- *  e.g. 'MY_NAMESPACE:MyDatabase' or 'MY_NAMESPACE:MyDatabase#1.1'
- *
- *  "cmode" [ IN ] - creation mode
- *
- *  "path" [ IN ] - NUL terminated string in
- *  wd-native character set giving path to database
- */
-VDB_EXTERN rc_t CC VDBManagerCreateDB ( struct VDBManager *self, VDatabase **db,
-    struct VSchema const *schema, const char *typespec,
-    KCreateMode cmode, const char *path, ... );
-VDB_EXTERN rc_t CC VDBManagerVCreateDB ( struct VDBManager *self, VDatabase **db,
-    struct VSchema const *schema, const char *typespec,
-    KCreateMode cmode, const char *path, va_list args );
-
-
-/* CreateDB
- *  create a new or open an existing database under parent database
- *
- *  "db" [ OUT ] - return parameter for newly opened database
- *
- *  "member" [ IN ] - name of database member template under parent
- *  the named member is a db template rather than a named database.
- *
- *  "cmode" [ IN ] - creation mode
- *
- *  "name" [ IN ] - NUL terminated string in
- *  db-native character set giving actual table name
- */
-VDB_EXTERN rc_t CC VDatabaseCreateDB ( VDatabase *self, VDatabase **db,
-    const char *member, KCreateMode cmode, const char *name, ... );
-VDB_EXTERN rc_t CC VDatabaseVCreateDB ( VDatabase *self, VDatabase **db,
-    const char *member, KCreateMode cmode, const char *name, va_list args );
-
-VDB_EXTERN rc_t CC VDatabaseDropDB ( VDatabase *self, const char *name, ... );
-VDB_EXTERN rc_t CC VDatabaseVDropDB ( VDatabase *self, const char *name, va_list args );
-
-VDB_EXTERN rc_t CC VDatabaseDropTable ( VDatabase *self, const char *name, ... );
-VDB_EXTERN rc_t CC VDatabaseVDropTable ( VDatabase *self, const char *name, va_list args );
-    
-
-/* OpenDBRead
- *  open a database for read using manager
- * OpenDBUpdate
- *  open a database for read/write using manager
- *
- *  "db" [ OUT ] - return parameter for newly opened database
- *
- *  "schema" [ IN, NULL OKAY ] - schema object containg database
- *  declaration to be used in creating db [ needed by manager ].
- *
- *  "path" [ IN ] - NUL terminated string in
- *  wd-native character set giving path to database
- */
-VDB_EXTERN rc_t CC VDBManagerOpenDBRead ( struct VDBManager const *self,
-    const VDatabase **db, struct VSchema const *schema,
-    const char *path, ... );
-VDB_EXTERN rc_t CC VDBManagerVOpenDBRead ( struct VDBManager const *self,
-    const VDatabase **db, struct VSchema const *schema,
-    const char *path, va_list args );
-
-VDB_EXTERN rc_t CC VDBManagerOpenDBUpdate ( struct VDBManager *self,
-    VDatabase **db, struct VSchema const *schema,
-    const char *path, ... );
-VDB_EXTERN rc_t CC VDBManagerVOpenDBUpdate ( struct VDBManager *self,
-    VDatabase **db, struct VSchema const *schema,
-    const char *path, va_list args );
-
-
-/* OpenDBRead
- *  open a database for read under parent db
- * OpenDBUpdate
- *  open or create a database for read/write under parent db
- *
- *  "db" [ OUT ] - return parameter for newly opened database
- *
- *  "name" [ IN ] - NUL terminated string in
- *  db-native character set giving name of database member
- */
-VDB_EXTERN rc_t CC VDatabaseOpenDBRead ( const VDatabase *self,
-    const VDatabase **db, const char *name, ... );
-VDB_EXTERN rc_t CC VDatabaseVOpenDBRead ( const VDatabase *self,
-    const VDatabase **db, const char *name, va_list args );
-
-VDB_EXTERN rc_t CC VDatabaseOpenDBUpdate ( VDatabase *self,
-    VDatabase **db, const char *name, ... );
-VDB_EXTERN rc_t CC VDatabaseVOpenDBUpdate ( VDatabase *self,
-    VDatabase **db, const char *name, va_list args );
-
-
-/* Typespec
- *  retrieve database typespec
- *
- *  AVAILABILITY: version 2.2
- *
- *  "ts_buff" [ IN ] and "ts_size" [ IN ] - buffer for return of NUL-terminated
- *  database typespec, e.g. 'NCBI:db:abc #1.1'
- */
-VDB_EXTERN rc_t CC VDatabaseTypespec ( const VDatabase *self,
-    char *ts_buff, size_t ts_size );
-
-
-/* Locked
- *  returns true if locked
- */
-VDB_EXTERN bool CC VDatabaseLocked ( const VDatabase *self );
-
-
-/* IsAlias
- *  returns true if object name is an alias
- *  returns path to fundamental name if it was aliased
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptDatabase, kptTable and kptIndex
- *
- *  "resolved" [ OUT ] and "rsize" [ IN ] - optional output buffer
- *  for fundamenta object name if "alias" is not a fundamental name, 
- *
- *  "name" [ IN ] - NUL terminated object name
- */
-VDB_EXTERN bool CC VDatabaseIsAlias ( const VDatabase *self, uint32_t type,
-    char *resolved, size_t rsize, const char *name );
-
-
-/* Writable
- *  returns 0 if object is writable
- *  or a reason why if not
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptDatabase, kptTable and kptIndex
- *
- *  "path" [ IN ] - NUL terminated path
- */
-VDB_EXTERN rc_t CC VDatabaseWritable ( const VDatabase *self, uint32_t type,
-    const char *name, ... );
-VDB_EXTERN rc_t CC VDatabaseVWritable ( const VDatabase *self, uint32_t type,
-    const char *name, va_list args );
-
-/* Lock
- *  apply lock
- *
- *  if object is already locked, the operation is idempotent
- *  and returns an rc state of rcLocked
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptDatabase, kptTable and kptIndex
- *
- *  "path" [ IN ] - NUL terminated path
- */
-VDB_EXTERN rc_t CC VDatabaseLock ( VDatabase *self, uint32_t type,
-    const char *name, ... );
-VDB_EXTERN rc_t CC VDatabaseVLock ( VDatabase *self, uint32_t type,
-    const char *name, va_list args );
-
-/* Unlock
- *  remove lock
- *
- *  if object is already unlocked, the operation is idempotent
- *  and returns an rc state of rcUnlocked
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptDatabase, kptTable and kptIndex
- *
- *  "path" [ IN ] - NUL terminated path
- */
-VDB_EXTERN rc_t CC VDatabaseUnlock ( VDatabase *self, uint32_t type,
-    const char *name, ... );
-VDB_EXTERN rc_t CC VDatabaseVUnlock ( VDatabase *self, uint32_t type,
-    const char *name, va_list args );
-
-
-/* OpenMetadataRead
- * OpenMetadataUpdate
- *  opens metadata file
- *
- *  "meta" [ OUT ] - return parameter for metadata
- */
-VDB_EXTERN rc_t CC VDatabaseOpenMetadataRead ( const VDatabase *self, struct KMetadata const **meta );
-VDB_EXTERN rc_t CC VDatabaseOpenMetadataUpdate ( VDatabase *self, struct KMetadata **meta );
-
-
-/* ColumnCreateParams
- *  sets the creation parameters for physical columns
- *
- *  "cmode" [ IN ] - creation mode
- *
- *  "checksum" [ IN ] - the type of checksum information to
- *  apply when writing blobs
- *
- *  "pgsize" [ IN, DEFAULT ZERO ] - size of internal column "pages"
- *  the default value is indicated by 0 ( zero ).
- *  NB - CURRENTLY THE ONLY SUPPORTED PAGE SIZE IS 1 ( ONE ) BYTE.
- */
-VDB_EXTERN rc_t CC VDatabaseColumnCreateParams ( VDatabase *self,
-    KCreateMode cmode, KChecksum checksum, size_t pgsize );
-
-
-/* OpenManager
- *  duplicate reference to manager
- *  NB - returned reference must be released
- */
-VDB_EXTERN rc_t CC VDatabaseOpenManagerRead ( const VDatabase *self, struct VDBManager const **mgr );
-VDB_EXTERN rc_t CC VDatabaseOpenManagerUpdate ( VDatabase *self, struct VDBManager **mgr );
-
-
-/* OpenParent
- *  duplicate reference to parent database
- *  NB - returned reference must be released
- */
-VDB_EXTERN rc_t CC VDatabaseOpenParentRead ( const VDatabase *self, const VDatabase **par );
-VDB_EXTERN rc_t CC VDatabaseOpenParentUpdate ( VDatabase *self, VDatabase **par );
-
-
-/* OpenSchema
- *  duplicate reference to db schema
- *  NB - returned reference must be released
- */
-VDB_EXTERN rc_t CC VDatabaseOpenSchema ( const VDatabase *self, struct VSchema const **schema );
-
-
-/* lists the tables of the database
- *
- * "names" [ OUT ] - return parameter for table 
- */
-VDB_EXTERN rc_t CC VDatabaseListTbl ( const VDatabase *self, KNamelist **names );
-
-/* lists the sub-databases of the database
- *
- * "names" [ OUT ] - return parameter for databases
- */
-VDB_EXTERN rc_t CC VDatabaseListDB ( const VDatabase *self, KNamelist **names );
-
-/* GetUserData
- * SetUserData
- *  store/retrieve an opaque pointer to user data
- *
- *  "data" [ OUT ] - return parameter for getting data
- *  "data" [ IN ] - parameter for setting data
- *
- *  "destroy" [ IN, NULL OKAY ] - optional destructor param
- *  invoked from destructor of "self"
- */
-VDB_EXTERN rc_t CC VDatabaseGetUserData ( const VDatabase *self, void **data );
-VDB_EXTERN rc_t CC VDatabaseSetUserData ( const VDatabase *self,
-    void *data, void ( CC * destroy ) ( void *data ) );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_vdb_database_ */
diff --git a/interfaces/vdb/dependencies.h b/interfaces/vdb/dependencies.h
deleted file mode 100644
index 353ecb7..0000000
--- a/interfaces/vdb/dependencies.h
+++ /dev/null
@@ -1,231 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-
-#ifndef _h_vdb_dependencies_
-#define _h_vdb_dependencies_
-
-
-#ifndef _h_vdb_extern_
-#include <vdb/extern.h>
-#endif
-
-#ifndef _h_klib_rc_
-#include <klib/rc.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct VDatabase;
-struct VTable;
-
-
-/*--------------------------------------------------------------------------
- * VDBDependencies
- *  information about VDatabase dependencies
- *
- *  object contains zero or more dependencies
- *
- *  each dependency has a number of properties, accessible via index
- */
-typedef struct VDBDependencies VDBDependencies;
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored */
-VDB_EXTERN rc_t CC VDBDependenciesAddRef ( const VDBDependencies *self );
-VDB_EXTERN rc_t CC VDBDependenciesRelease ( const VDBDependencies *self );
-
-/* ListDependencies
- *  create dependencies object: list dependencies
- *
- *  Cache could be updated after the fuction call, if caching is enabled.
- *
- *  "dep" [ OUT ] - return for VDBDependencies object
- *
- *  "missing" [ IN ] - if true, list only missing dependencies
- *  otherwise, list all dependencies
- */
-VDB_EXTERN rc_t CC VDatabaseListDependencies ( struct VDatabase const *self,
-    const VDBDependencies **dep, bool missing );
-
-/* ListDependenciesWithCaching
- *  create dependencies object: list dependencies
- *
- *  Allows to control cache update inside the function.
- *
- *  "dep" [ OUT ] - return for VDBDependencies object
- *
- *  "missing" [ IN ] - if true, list only missing dependencies
- *  otherwise, list all dependencies
- *
- *  "disableCaching" [ IN ] - if true, disable caching inside of the function
- *  otherwise, do not change the caching state
- */
-VDB_EXTERN rc_t CC VDatabaseListDependenciesWithCaching (
-    struct VDatabase const *self,
-    const VDBDependencies **dep, bool missing,
-    bool disableCaching );
-
-/* Count
- *  retrieve the number of dependencies
- *
- *  "count" [ OUT ] - return parameter for dependencies count
- */
-VDB_EXTERN rc_t CC VDBDependenciesCount ( const VDBDependencies *self,
-    uint32_t *count );
-
-
-/* Type
- *  describe the dependency object type ( see kbd/manager.h )
- *
- *  "type" [ OUT ] - a KDBPathType
- *
- *  "idx" [ IN ] - zero-based index of dependency
- */
-VDB_EXTERN rc_t CC VDBDependenciesType ( const VDBDependencies *self,
-    uint32_t *type, uint32_t idx );
-
-
-/* Local
- *  retrieve local property
- *
- *  "local" [ OUT ] - true if object is stored internally
- *
- *  "idx" [ IN ] - zero-based index of dependency
- */
-VDB_EXTERN rc_t CC VDBDependenciesLocal ( const VDBDependencies *self,
-    bool *local, uint32_t idx );
-
-
-/* SeqId
- *  retrieve sequence id of object
- *
- *  "seq_id" [ OUT ] - returned pointer should not be freed.
- *   becomes invalid after VDBDependenciesRelease
- *
- *  "idx" [ IN ] - zero-based index of dependency
- */
-VDB_EXTERN rc_t CC VDBDependenciesSeqId ( const VDBDependencies *self,
-    const char **seq_id, uint32_t idx );
-
-
-/* Name
- *  retrieve object name
- *
- * "name" [ OUT ] - returner pointed should not be freed.
- *  it becomes invalid after VDBDependenciesRelease
- *
- *  "idx" [ IN ] - zero-based index of dependency
- */
-VDB_EXTERN rc_t CC VDBDependenciesName ( const VDBDependencies *self,
-    const char **name, uint32_t idx );
-
-
-/* Circular
- *  retrieve circular property
- *  reference sequences may be circular
- *
- *  "circular" [ OUT ] - true if dependency is a circular reference table
- *
- *  "idx" [ IN ] - zero-based index of dependency
- */
-VDB_EXTERN rc_t CC VDBDependenciesCircular ( const VDBDependencies *self,
-    bool *circular, uint32_t idx );
-
-
-/* Path
- *  returns [Local] path for resolved dependency,
- *  returns NULL for local and missing dependency.
- *
- *  "path" [ OUT ] - returned pointer should not be freed.
- *   it becomes invalid after VDBDependenciesRelease
- *
- *  "idx" [ IN ] - zero-based index of dependency
- */
-VDB_EXTERN rc_t CC VDBDependenciesPath ( const VDBDependencies *self,
-    const char **path, uint32_t idx );
-
-/* PathRemote
- *  returns Remote path for dependency,
- *  returns NULL for not found dependency.
- *
- *  "path" [ OUT ] - returned pointer should not be freed.
- *   it becomes invalid after VDBDependenciesRelease
- *
- *  "idx" [ IN ] - zero-based index of dependency
- */
-VDB_EXTERN rc_t CC VDBDependenciesPathRemote ( const VDBDependencies *self,
-    const char **path, uint32_t idx );
-
-/* PathCache
- *  returns Cache path for dependency,
- *  returns NULL for not found dependency.
- *
- *  "path" [ OUT ] - returned pointer should not be freed.
- *   it becomes invalid after VDBDependenciesRelease
- *
- *  "idx" [ IN ] - zero-based index of dependency
- */
-VDB_EXTERN rc_t CC VDBDependenciesPathCache ( const VDBDependencies *self,
-    const char **path, uint32_t idx );
-
-/* Error
- *  trying to analyze rc code and object
- *  in order to recognize dependencies error
- *
- *  db OR table - only one is required
- */
-VDB_EXTERN bool CC UIError( rc_t rc,
-    struct VDatabase const *db, struct VTable const *table);
-
-/* report error(s) via PLOGERR based on an object
- * log_list - if true logs the missing items list also
- */
-VDB_EXTERN void CC UIDatabaseLOGError( rc_t rc,
-    struct VDatabase const *db, bool log_list );
-VDB_EXTERN void CC UITableLOGError( rc_t rc,
-    struct VTable const *table, bool log_list );
-
-/* return human-readable string explaining rc code.
- * the string should not be freed
- */
-VDB_EXTERN const char* CC UIDatabaseGetErrorString(rc_t rc);
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* _h_vdb_dependencies_ */
diff --git a/interfaces/vdb/extern.h b/interfaces/vdb/extern.h
deleted file mode 100644
index 1ea8926..0000000
--- a/interfaces/vdb/extern.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_vdb_extern_
-#define _h_vdb_extern_
-
-#if ! defined EXPORT_LATCH && defined _LIBRARY
-#define VDB_EXTERN LIB_EXPORT
-#define EXPORT_LATCH 1
-#else
-#define VDB_EXTERN LIB_IMPORT
-#endif
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#ifdef _MSC_VER
-#define MOD_EXPORT __declspec ( dllexport )
-#else
-#define MOD_EXPORT
-#endif
-
-#endif /* _h_vdb_extern_ */
diff --git a/interfaces/vdb/manager.h b/interfaces/vdb/manager.h
deleted file mode 100644
index d7edd37..0000000
--- a/interfaces/vdb/manager.h
+++ /dev/null
@@ -1,200 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_vdb_manager_
-#define _h_vdb_manager_
-
-#ifndef _h_vdb_extern_
-#include <vdb/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#include <stdarg.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KDirectory;
-
-/*--------------------------------------------------------------------------
- * VDBManager
- *  opaque handle to library
- */
-typedef struct VDBManager VDBManager;
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-VDB_EXTERN rc_t CC VDBManagerAddRef ( const VDBManager *self );
-VDB_EXTERN rc_t CC VDBManagerRelease ( const VDBManager *self );
-
-
-/* MakeRead
- * MakeUpdate
- *  create library handle for specific use
- *  NB - only one of the functions will be implemented
- *
- *  "wd" [ IN, NULL OKAY ] - optional working directory for
- *  accessing the file system. mgr will attach its own reference.
- */
-VDB_EXTERN rc_t CC VDBManagerMakeRead ( const VDBManager **mgr, struct KDirectory const *wd );
-VDB_EXTERN rc_t CC VDBManagerMakeUpdate ( VDBManager **mgr, struct KDirectory *wd );
-
-
-/* Version
- *  returns the library version
- */
-VDB_EXTERN rc_t CC VDBManagerVersion ( const VDBManager *self, uint32_t *version );
-
-
-/* Writable
- *  returns 0 if table is writable
- *  rcLocked if locked, rcReadonly if read-only
- *  other code upon error
- *
- *  "path" [ IN ] - NUL terminated path
- */
-VDB_EXTERN rc_t CC VDBManagerWritable ( const VDBManager *self,
-    const char *path, ... );
-VDB_EXTERN rc_t CC VDBManagerVWritable ( const VDBManager *self,
-    const char *path, va_list args );
-
-/* Lock
- *  apply lock
- *
- *  if object is already locked, the operation is idempotent
- *  and returns an rc state of rcLocked
- *
- *  "path" [ IN ] - NUL terminated path
- */
-VDB_EXTERN rc_t CC VDBManagerLock ( VDBManager *self, const char *path, ... );
-VDB_EXTERN rc_t CC VDBManagerVLock ( VDBManager *self, const char *path, va_list args );
-
-/* Unlock
- *  remove lock
- *
- *  if object is already unlocked, the operation is idempotent
- *  and returns an rc state of rcUnlocked
- *
- *  "path" [ IN ] - NUL terminated path
- */
-VDB_EXTERN rc_t CC VDBManagerUnlock ( VDBManager *self, const char *path, ... );
-VDB_EXTERN rc_t CC VDBManagerVUnlock ( VDBManager *self, const char *path, va_list args );
-
-
-/* Drop
- *  drop an object based on its path
- *
- *  "path" [ IN ] - NUL terminated string in UTF-8 giving path to the vdb object
- */
-VDB_EXTERN rc_t CC VDBManagerDrop ( VDBManager *self, uint32_t obj_type, const char *path, ... );
-VDB_EXTERN rc_t CC VDBManagerVDrop ( VDBManager *self, uint32_t obj_type, const char *path, va_list args );
-
-
-/* AddSchemaIncludePath
- *  add a path to schema for locating input files
- */
-VDB_EXTERN rc_t CC VDBManagerAddSchemaIncludePath ( const VDBManager *self,
-    const char *path, ... );
-VDB_EXTERN rc_t CC VDBManagerVAddSchemaIncludePath ( const VDBManager *self,
-    const char *path, va_list args );
-
-
-/* AddLoadLibraryPath
- *  add a path to loader for locating dynamic libraries
- */
-VDB_EXTERN rc_t CC VDBManagerAddLoadLibraryPath ( const VDBManager *self,
-    const char *path, ... );
-VDB_EXTERN rc_t CC VDBManagerVAddLoadLibraryPath ( const VDBManager *self,
-    const char *path, va_list args );
-
-
-/* GetUserData
- * SetUserData
- *  store/retrieve an opaque pointer to user data
- *
- *  "data" [ OUT ] - return parameter for getting data
- *  "data" [ IN ] - parameter for setting data
- *
- *  "destroy" [ IN, NULL OKAY ] - optional destructor param
- *  invoked from destructor of "self"
- */
-VDB_EXTERN rc_t CC VDBManagerGetUserData ( const VDBManager *self, void **data );
-VDB_EXTERN rc_t CC VDBManagerSetUserData ( const VDBManager *self,
-    void *data, void ( CC * destroy ) ( void *data ) );
-
-
-/* GetObjVersion
- *  returns the vdb-version of the given object
- *
- *  "version" [ OUT ] - discovered vdb-version
- *
- *  "path"    [ IN ] - path to the object to be examined ( database or table )
- */
-VDB_EXTERN rc_t CC VDBManagerGetObjVersion ( const VDBManager *self,
-    ver_t * version, const char *path );
-
-
-/* GetObjModDate
- *  returns the load/modification timestamp of the given object
- *
- *  "ts" [ OUT ] - discovered modification timestamp written in object,
- *  or from filesystem
- *
- *  "path"    [ IN ] - path to the object to be examined ( database or table )
- */
-VDB_EXTERN rc_t CC VDBManagerGetObjModDate ( const VDBManager *self,
-    KTime_t * ts, const char *path );
-
-
-/* PathType
- *  check the path type of an object/directory path.
- *
- *  this is an extension of the KDirectoryPathType ( see <kdb/manager.h> )
- *  and will return the KDirectory values if a path type is not specifically
- *  a VDB or KDB object.
- */
-VDB_EXTERN int CC VDBManagerPathType ( const VDBManager * self,
-    const char *path, ... );
-VDB_EXTERN int CC VDBManagerVPathType ( const VDBManager * self,
-    const char *path, va_list args );
-        
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_vdb_manager_ */
diff --git a/interfaces/vdb/manager.hpp b/interfaces/vdb/manager.hpp
deleted file mode 100644
index b7becc3..0000000
--- a/interfaces/vdb/manager.hpp
+++ /dev/null
@@ -1,371 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _hpp_vdb_manager_
-#define _hpp_vdb_manager_
-
-#ifndef _h_vdb_manager_
-#include <vdb/manager.h>
-#endif
-
-#ifndef _h_vdb_table_
-#include <vdb/table.h>
-#endif
-
-#ifndef _h_vdb_schema_
-#include <vdb/schema.h>
-#endif
-
-#ifndef _h_vdb_database_
-#include <vdb/database.h>
-#endif
-
-/*--------------------------------------------------------------------------
- * forward decl. for CreateDB
- */
-struct VDatabase;
-struct VSchema;
-
-/*--------------------------------------------------------------------------
- * VDBManager
- *  opaque handle to library
- */
-struct VDBManager
-{
-    /* AddRef
-     * Release
-     *  all objects are reference counted
-     *  NULL references are ignored
-     */
-    inline rc_t AddRef () const throw()
-    { return VDBManagerAddRef ( this ); }
-
-    inline rc_t Release () const throw()
-    { return VDBManagerRelease ( this ); }
-
-
-    /* CreateDB
-     *  create a new or open an existing database using manager
-     *
-     *  "db" [ OUT ] - return parameter for newly opened database
-     *
-     *  "schema" [ IN ] - schema object containg database
-     *  declaration to be used in creating db.
-     *
-     *  "typespec" [ IN ] - type and optionally version of db schema,
-     *  e.g. 'MY_NAMESPACE:MyDatabase' or 'MY_NAMESPACE:MyDatabase#1.1'
-     *
-     *  "cmode" [ IN ] - creation mode
-     *
-     *  "path" [ IN ] - NUL terminated string in
-     *  wd-native character set giving path to database
-     */
-    inline rc_t CreateDB ( VDatabase **db, struct VSchema const *schema,
-        const char *typespec, KCreateMode cmode, const char *path, ... ) throw()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = VDBManagerVCreateDB ( this, db, schema, typespec, cmode, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t CreateDB ( VDatabase **db, struct VSchema const *schema,
-        const char *typespec, KCreateMode cmode, const char *path, va_list args ) throw()
-    { return VDBManagerVCreateDB ( this, db, schema, typespec, cmode, path, args ); }
-
-
-    /* OpenDBRead
-     *  open a database for read using manager
-     * OpenDBUpdate
-     *  open a database for read/write using manager
-     *
-     *  "db" [ OUT ] - return parameter for newly opened database
-     *
-     *  "schema" [ IN, NULL OKAY ] - schema object containg database
-     *  declaration to be used in creating db [ needed by manager ].
-     *
-     *  "path" [ IN ] - NUL terminated string in
-     *  wd-native character set giving path to database
-     */
-    inline rc_t OpenDB( const VDatabase **db, struct VSchema const *schema,
-        const char *path, ... ) const throw()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = VDBManagerVOpenDBRead ( this, db, schema, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t OpenDB( const VDatabase **db, struct VSchema const *schema,
-        const char *path, va_list args ) const throw()
-    { return VDBManagerVOpenDBRead ( this, db, schema, path, args ); }
-
-    inline rc_t OpenDB( VDatabase **db, struct VSchema const *schema,
-        const char *path, ... ) throw()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = VDBManagerVOpenDBUpdate ( this, db, schema, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t OpenDB( VDatabase **db, struct VSchema const *schema,
-        const char *path, va_list args ) throw()
-    { return VDBManagerVOpenDBUpdate ( this, db, schema, path, args ); }
-
-
-    /* CreateTable
-     *  create a new or open an existing table using manager
-     *
-     *  "tbl" [ OUT ] - return parameter for newly opened table
-     *
-     *  "schema" [ IN ] - schema object containg table
-     *  declaration to be used in creating tbl.
-     *
-     *  "typespec" [ IN ] - type and optionally version of table schema,
-     *  e.g. 'MY_NAMESPACE:MyTable' or 'MY_NAMESPACE:MyTable#1.1'
-     *
-     *  "cmode" [ IN ] - creation mode
-     *
-     *  "path" [ IN ] - NUL terminated string in
-     *  wd-native character set giving path to table
-     */
-    inline rc_t CreateTable ( VTable **tbl, struct VSchema const *schema,
-        const char *typespec, KCreateMode cmode, const char *path, ... ) throw()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = VDBManagerVCreateTable ( this, tbl, schema, typespec, cmode, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t CreateTable ( VTable **tbl, struct VSchema const *schema,
-        const char *typespec, KCreateMode cmode, const char *path, va_list args ) throw()
-    { return VDBManagerVCreateTable ( this, tbl, schema, typespec, cmode, path, args ); }
-
-
-    /* OpenTableRead
-     *  open a table for read using manager
-     * OpenTableUpdate
-     *  open a table for read/write using manager
-     *
-     *  "tbl" [ OUT ] - return parameter for newly opened table
-     *
-     *  "schema" [ IN, NULL OKAY ] - optional schema object with
-     *  latest versions of table schema.
-     *
-     *  "path" [ IN ] - NUL terminated string in
-     *  wd-native character set giving path to table
-     */
-    inline rc_t OpenTable ( const VTable **tbl, struct VSchema const *schema,
-        const char *path, ... ) const throw ()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = VDBManagerVOpenTableRead ( this, tbl, schema, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t OpenTable ( const VTable **tbl, struct VSchema const *schema,
-        const char *path, va_list args ) const throw ()
-    { return VDBManagerVOpenTableRead ( this, tbl, schema, path, args ); }
-
-    inline rc_t OpenTable ( VTable **tbl, struct VSchema const *schema,
-        const char *path, ... ) throw ()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = VDBManagerVOpenTableUpdate ( this, tbl, schema, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t OpenTable ( VTable **tbl, struct VSchema const *schema,
-        const char *path, va_list args ) throw ()
-    { return VDBManagerVOpenTableUpdate ( this, tbl, schema, path, args ); }
-
-
-    /* MakeSchema
-     *  create a schema object
-     */
-    inline rc_t MakeSchema ( VSchema **schema ) const throw()
-    { return VDBManagerMakeSchema ( this, schema ); }
-
-
-    /* MakeRead
-     * MakeUpdate
-     *  create library handle for specific use
-     *  NB - only one of the functions will be implemented
-     *
-     *  "wd" [ IN, NULL OKAY ] - optional working directory for
-     *  accessing the file system. mgr will attach its own reference.
-     */
-    static inline rc_t MakeRead ( const VDBManager **mgr,
-        const KDirectory *wd = 0 ) throw()
-    { return VDBManagerMakeRead ( mgr, wd ); }
-
-    static inline rc_t MakeUpdate ( VDBManager **mgr,
-        KDirectory *wd = 0 ) throw()
-    { return VDBManagerMakeUpdate ( mgr, wd ); }
-
-
-    /* Version
-     *  returns the library version
-     */
-    inline rc_t Version ( uint32_t *version ) const throw()
-    { return VDBManagerVersion ( this, version ); }
-
-
-    /* Writable
-     *  returns 0 if object is writable
-     *  or a reason why if not
-     *
-     *  "path" [ IN ] - NUL terminated path
-     */
-    inline rc_t Writable ( const char *path, ... ) const throw()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = VDBManagerVWritable ( this, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t Writable ( const char *path, va_list args ) const throw()
-    { return VDBManagerVWritable ( this, path, args ); }
-
-
-    /* Lock
-     *  apply lock
-     *
-     *  if object is already locked, the operation is idempotent
-     *  and returns an rc state of rcLocked
-     *
-     *  "path" [ IN ] - NUL terminated path
-     */
-    inline rc_t Lock ( const char *path, ... ) throw()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = VDBManagerVLock ( this, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t Lock ( const char *path, va_list args ) throw()
-    { return VDBManagerVLock ( this, path, args ); }
-
-
-    /* Unlock
-     *  remove lock
-     *
-     *  if object is already unlocked, the operation is idempotent
-     *  and returns an rc state of rcUnlocked
-     *
-     *  "path" [ IN ] - NUL terminated path
-     */
-    inline rc_t Unlock ( const char *path, ... ) throw()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = VDBManagerVUnlock ( this, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t Unlock ( const char *path, va_list args ) throw()
-    { return VDBManagerVUnlock ( this, path, args ); }
-
-
-    /* Drop
-     *  drop an object based on its path
-     *
-     *  "path" [ IN ] - NUL terminated string in UTF-8 giving path to the vdb object
-     */
-    inline rc_t Drop( uint32_t obj_type, const char *path, ... ) throw()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = VDBManagerVDrop ( this, obj_type, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t Drop( uint32_t obj_type, const char *path, va_list args ) throw()
-    { return VDBManagerVDrop ( this, obj_type, path, args ); }
-
-
-    /* AddSchemaIncludePath
-     *  add a path to schema for locating input files
-     */
-    inline rc_t AddSchemaIncludePath ( const char *path, ... ) throw()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = VDBManagerVAddSchemaIncludePath ( this, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t AddSchemaIncludePath ( const char *path, va_list args ) throw()
-    { return VDBManagerVAddSchemaIncludePath ( this, path, args ); }
-
-
-    /* AddLoadLibraryPath
-     *  add a path to loader for locating dynamic libraries
-     */
-    inline rc_t AddLoadLibraryPath ( const char *path, ... ) throw()
-    {
-        va_list args;
-        va_start ( args, path );
-        rc_t rc = VDBManagerVAddLoadLibraryPath ( this, path, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t AddLoadLibraryPath ( const char *path, va_list args ) throw()
-    { return VDBManagerVAddLoadLibraryPath ( this, path, args ); }
-
-
-    /* GetUserData
-     * SetUserData
-     *  store/retrieve an opaque pointer to user data
-     *
-     *  "data" [ OUT ] - return parameter for getting data
-     *  "data" [ IN ] - parameter for setting data
-     *
-     *  "destroy" [ IN, NULL OKAY ] - optional destructor param
-     *  invoked from destructor of "self"
-     */
-    inline rc_t GetUserData ( void **data ) const throw()
-    { return VDBManagerGetUserData ( this, data ); }
-
-    inline rc_t SetUserData ( void *data,
-        void ( CC * destroy ) ( void *data ) = 0 ) const throw()
-    { return VDBManagerSetUserData ( this, data, destroy ); }
-
-
-private:
-    VDBManager ();
-    ~ VDBManager ();
-    VDBManager ( const VDBManager& );
-    VDBManager &operator = ( const VDBManager& );
-};
-
-#endif // _hpp_vdb_manager_
diff --git a/interfaces/vdb/report.h b/interfaces/vdb/report.h
deleted file mode 100644
index 90d3695..0000000
--- a/interfaces/vdb/report.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_vdb_report_
-#define _h_vdb_report_
-
-#ifndef _h_vdb_extern_
-#include <vdb/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct VDBManager;
-struct VDatabase;
-struct VTable;
-
-
-/*--------------------------------------------------------------------------
- * An unrecoverable error happened.
- * We can help to solve it
- * by reporting information about known application execution environment.
- */
-
-
-/* SetVDBManager
- *  remember the manager in use
- */
-VDB_EXTERN rc_t CC ReportSetVDBManager ( struct VDBManager const *mgr );
-
-
-/* SetDatabase
- *  To be called after application successfully opened Database
- *  specified in command line.
- *  If the application supports multiple objects passed in command line
- *  to be processed in a loop: should be called for each argument database.
- *
- *  "path" [ IN ] - path to the database that is used to access it
- */
-VDB_EXTERN rc_t CC ReportResetDatabase ( const char *path,
-    struct VDatabase const *db );
-
-
-/* SetTable
- *  To be called after application successfully opened Table
- *  specified in command line.
- *  If the application supports multiple objects passed in command line
- *  to be processed in a loop: should be called for each argument table.
- *
- *  "path" [ IN ] - path to the table that is used to access it
- */
-VDB_EXTERN rc_t CC ReportResetTable ( const char *path,
-    struct VTable const *tbl );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_vdb_report_ */
diff --git a/interfaces/vdb/schema.h b/interfaces/vdb/schema.h
deleted file mode 100644
index e0db467..0000000
--- a/interfaces/vdb/schema.h
+++ /dev/null
@@ -1,460 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_vdb_schema_
-#define _h_vdb_schema_
-
-#ifndef _h_vdb_extern_
-#include <vdb/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#include <stdarg.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KNamelist;
-struct VDBManager;
-
-
-/*--------------------------------------------------------------------------
- * VSchema
- *  a virtual table schema
- *
- *  a schema is built from column, type and sub-schema declarations. The
- *  pseudo-BNF below gives a simplified description of the structure,
- *  with certain contextual constraints omitted.
- *
- *  at the global level, both read and write column declarations are permitted.
- *  type declarations are permitted at any level but always enter into global
- *  scope.
- *
- *  column names may be overloaded to allow for multiple data types under a
- *  single name. a column is identified by its ( name, datatype ) pair. the
- *  pairing ( name, NULL ) identifies the default type for name.
- *
- *  column declarations are intentionally created by assignment ( '=' ) or
- *  are updated with additional productions by appending ( '+=' ). this
- *  distinction is intended to prevent unintended consequences.
- *
- *  column productions come in the form of a simple column assignment, a
- *  data conversion function, or a sub-schema function. the simple column
- *  production takes a column name, the functions take some combination of
- *  constant and column name parameters.
- *
- *  a column assignment source ( column, function or sub-schema ) will have
- *  its own data type. when assigned directly, it must match the destination
- *  type either exactly or as the result of implicit type promotion. as an
- *  alternative, an explicit up or down cast ( or casts ) may be performed as
- *  an aid in source resolution.
- *
- *  read column declarations introduce a virtual column by ( name, datatype ).
- *  globally, they may be declared as "extern" to make them accessible via the
- *  API. extern columns may have any of their productions tagged as "default"
- *  to assign significance to the pair ( name, NULL ). when more than one type
- *  for a name is tagged as default, the most recently resolved is arbitrarily
- *  chosen. read source columns may be virtual or physical if the latter is
- *  within scope.
- *
- *  write column declarations introduce virtual columns by ( name, datatype ),
- *  and define physical column ( encoding, decoding ) bindings. virtual columns
- *  may be introduced as "extern" at global scope, where they have no source
- *  productions given that they take their input from the API. non-extern
- *  write columns are virtual and allow normal column productions with the
- *  exception that they may not be sourced by physical columns.
- *
- *  one special write column declaration introduces physical columns by
- *  name only ( name overloading cannot exist in the physical layer ) and
- *  requires a special production that binds together two sub-schema functions;
- *  one for encoding and the other for decoding.
- */
-typedef struct VSchema VSchema;
-
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-VDB_EXTERN rc_t CC VSchemaAddRef ( const VSchema *self );
-VDB_EXTERN rc_t CC VSchemaRelease ( const VSchema *self );
-
-
-/* Make
- *  create a schema object
- */
-VDB_EXTERN rc_t CC VDBManagerMakeSchema ( struct VDBManager const *self, VSchema **schema );
-
-
-/* AddIncludePath
- *  add an include path to schema for locating input files
- */
-VDB_EXTERN rc_t CC VSchemaAddIncludePath ( VSchema *self, const char *path, ... );
-VDB_EXTERN rc_t CC VSchemaVAddIncludePath ( VSchema *self, const char *path, va_list args );
-
-
-/* ParseText
- *  parse schema text
- *  add productions to existing schema
- *
- *  "name" [ IN, NULL OKAY ] - optional name
- *  representing text, e.g. filename
- *
- *  "text" [ IN ] and "bytes" [ IN ] - input buffer of text
- */
-VDB_EXTERN rc_t CC VSchemaParseText ( VSchema *self, const char *name,
-    const char *text, size_t bytes );
-
-
-/* ParseFile
- *  parse schema file
- *  add productions to existing schema
- *
- *  "name" [ IN ] - filename, absolute or valid relative to
- *  working directory or within an include path
- */
-VDB_EXTERN rc_t CC VSchemaParseFile ( VSchema *self, const char *name, ... );
-VDB_EXTERN rc_t CC VSchemaVParseFile ( VSchema *self, const char *name, va_list args );
-
-
-/* Dump
- *  dump schema as text
- *
- *  "mode" [ IN ] - selects textual conversion mode ( see VSchemaDumpMode )
- *
- *  "decl" [ IN, NULL OKAY ] - selects a declaration to dump
- *
- *  "flush" [ IN ] and "dst" [ IN, OPAQUE ] - callback for delivering
- *  buffered schema text
- */
-enum VSchemaDumpMode
-{
-    sdmPrint,            /* standard display for reading and printing */
-    sdmCompact           /* compacted white-space representation      */
-};
-
-VDB_EXTERN rc_t CC VSchemaDump ( const VSchema *self, uint32_t mode, const char *decl,
-    rc_t ( CC * flush ) ( void *dst, const void *buffer, size_t bsize ), void *dst );
-
-
-/* IncludeFiles
- *  generates a list of paths to include file
- */
-VDB_EXTERN rc_t CC VSchemaIncludeFiles ( const VSchema *self, struct KNamelist const **list );
-
-
-/*--------------------------------------------------------------------------
- * VTypedecl
- *  a runtime type id and vector dimension
- *
- *  describes the general form of a type declaration: "TYPE [ DIM ]"
- */
-typedef struct VTypedecl VTypedecl;
-struct VTypedecl
-{
-    /* runtime type id */
-    uint32_t type_id;
-
-    /* vector dimension */
-    uint32_t dim;
-};
-
-
-/* Resolve
- *  converts a typedecl string to type id and vector dimension
- *
- *  "resolved" [ OUT ] - resolved type declaration
- *
- *  "typedecl" [ IN ] - type declaration
- */
-VDB_EXTERN rc_t CC VSchemaResolveTypedecl ( const VSchema *self,
-    VTypedecl *resolved, const char *typedecl, ... );
-VDB_EXTERN rc_t CC VSchemaVResolveTypedecl ( const VSchema *self,
-    VTypedecl *resolved, const char *typedecl, va_list args );
-
-
-/* ToText
- *  convert a VTypedecl into canonical text
- *
- *  "schema" [ IN ] - schema object that would know about this type
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - output buffer for
- *  NUL terminated type declaration string
- */
-VDB_EXTERN rc_t CC VTypedeclToText ( const VTypedecl *self,
-    const VSchema *schema, char *buffer, size_t bsize );
-
-
-/* ToSupertype
- *  attempt to cast a typedecl to a size-equivalent supertype decl
- *
- *  "schema" [ IN ] - schema object that would know about this type
- *
- *  "cast" [ OUT ] - return parameter for supertype decl
- *  valid only if function returns true.
- *
- *  returns true if cast succeeded
- */
-VDB_EXTERN bool CC VTypedeclToSupertype ( const VTypedecl *self,
-    const VSchema *schema, VTypedecl *cast );
-
-
-/* ToType
- *  attempt to cast a typedecl to a size-equivalent ancestor decl
- *
- *  "schema" [ IN ] - schema object that would know about this type
- *
- *  "ancestor" [ IN ] - target type or typeset for cast
- *
- *  "cast" [ OUT ] - return parameter for ancestor decl
- *  valid only if function returns true. if "ancestor" was a typeset,
- *  the value of "cast" will be the closest matching ancestral type.
- *
- *  "distance" [ OUT, NULL OKAY ] - optional linear measure of casting
- *  generations. valid only if function returns true. a value of 0 means
- *  that "self" is a direct match with "ancestor", a value of 1 means that
- *  "self" is an immediate subtype of "ancestor", etc.
- *
- *  returns true if cast succeeded
- */
-VDB_EXTERN bool CC VTypedeclToType ( const VTypedecl *self,
-    const VSchema *schema,  uint32_t ancestor,
-    VTypedecl *cast, uint32_t *distance );
-
-
-/* ToTypedecl
- *  attempt to cast a typedecl to a size-equivalent ancestor decl
- *
- *  "schema" [ IN ] - schema object that would know about this type
- *
- *  "ancestor" [ IN ] - target typedecl or typeset for cast
- *
- *  "cast" [ OUT, NULL OKAY ] - return parameter for ancestor decl
- *  valid only if function returns true. if "ancestor" was a typeset,
- *  the value of "cast" will be the closest matching ancestral type.
- *
- *  "distance" [ OUT, NULL OKAY ] - optional linear measure of casting
- *  generations. valid only if function returns true. a value of 0 means
- *  that "self" is a direct match with "ancestor", a value of 1 means that
- *  "self" is an immediate subtype of "ancestor", etc.
- *
- *  returns true if cast succeeded
- */
-VDB_EXTERN bool CC VTypedeclToTypedecl ( const VTypedecl *self,
-    const VSchema *schema, const VTypedecl *ancestor,
-    VTypedecl *cast, uint32_t *distance );
-
-
-/* CommonAncestor
- *  find a common ancestor between "self" and "peer"
- *  returns distance as sum of distances from each to "ancestor"
- *
- *  "schema" [ IN ] - schema object that would know about this type
- *
- *  "peer" [ IN ] - typedecl or typeset to compare against self
- *
- *  "ancestor" [ OUT, NULL OKAY ] - return parameter for closest
- *  common ancestor decl. valid only if function returns true.
- *
- *  "distance" [ OUT, NULL OKAY ] - optional linear measure of casting
- *  generations. valid only if function returns true. a value of 0 means
- *  that "self" is a direct match with "peer", a value of 1 means that
- *  "self" is an immediate subtype of "peer", or vice-versa, etc.
- *  measured as the sum of distances self=>ancestor and peer=>ancestor
- */
-VDB_EXTERN bool CC VTypedeclCommonAncestor ( const VTypedecl *self, const VSchema *schema,
-    const VTypedecl *peer, VTypedecl *ancestor, uint32_t *distance );
-
-
-/*--------------------------------------------------------------------------
- * VTypedesc
- *  describes the fundamental properties of a VTypedecl
- *  replaces the deprecated structure VTypedef
- *
- *  VTypedecl describes an element in terms of the element's
- *  super-type id and vector dimension.
- *
- *  VTypedesc describes an element in terms of the element's
- *  intrinsic type domain and size, and the vector dimension
- *  is adjusted to reflect the intrinsic super-type.
- *
- *  the effect is as if a VTypedecl were cast toward its most
- *  fundamental supertype using "VTypedeclToSupertype", and
- *  the final size and dimension are taken from there:
- *
- *    given - VTypedecl td; const VSchema *schema;
- *    while ( VTypedeclToSupertype ( & td, schema, & td ) )
- *        ( void ) 0;
- *
- *    then -
- *    VTypedesc desc =
- *    {
- *      bit_sizeof_type ( td . type_id ),
- *      td . dim,
- *      domain_of_type ( td . type_id )
- *    }
- */
-enum
-{
-    /* boolean domain */
-    vtdBool = 1,
-
-    /* numeric domains */
-    vtdUint, vtdInt, vtdFloat,
-
-    /* textual domains */
-    vtdAscii, vtdUnicode
-};
-
-typedef struct VTypedesc VTypedesc;
-struct VTypedesc
-{
-    /* sizeof intrinsic supertype */
-    uint32_t intrinsic_bits;
-
-    /* recalculated vector dimension */
-    uint32_t intrinsic_dim;
-
-    /* data domain */
-    uint32_t domain;
-};
-
-
-/* Sizeof
- */
-VDB_EXTERN uint32_t CC VTypedescSizeof ( const VTypedesc *self );
-
-
-/* DescribeTypedecl
- *  produce a description of typedecl properties
- */
-VDB_EXTERN rc_t CC VSchemaDescribeTypedecl ( const VSchema *self,
-    VTypedesc *desc, const VTypedecl *td );
-
-
-
-/*--------------------------------------------------------------------------
- * VSchemaRuntimeTable
- *  an object that represents a table ( or sub-table ) created at runtime
- *  that can be used to create a VTable object
- */
-typedef struct VSchemaRuntimeTable VSchemaRuntimeTable;
-
-
-/* Make
- *  make a table in the schema provided
- *
- *  "tbl" [ OUT ] - return parameter for new schema table object
- *
- *  "type_name" [ IN ] - NUL terminated string giving desired typename of table
- *   may include version spec - otherwise, a version of #1.0 will be assigned.
- *
- *  "supertype_spec" [ IN, NULL OKAY ] - optional supertype spec, giving
- *   either a single super-table type string or multiple comma-separated tables
- */
-VDB_EXTERN rc_t CC VSchemaMakeRuntimeTable ( VSchema *self,
-    VSchemaRuntimeTable **tbl, const char *type_name, const char *supertype_spec );
-
-
-/* Close
- *  close the schema table handle
- *  discards any uncomitted data
- */
-VDB_EXTERN rc_t CC VSchemaRuntimeTableClose ( VSchemaRuntimeTable *self );
-
-
-/* Commit
- *  commits table data
- *  closes object to further modification
- */
-VDB_EXTERN rc_t CC VSchemaRuntimeTableCommit ( VSchemaRuntimeTable *self );
-
-
-/* AddColumn
- *  add a simple column to the table
- *
- *  "td" [ IN ] - data type of column, obtained from schema object
- *
- *  "encoding" [ IN, NULL OKAY ] - optional compression/encoding type
- *  specified as a NUL-terminated string
- *
- *  "name" [ IN ] - NUL-terminated simple ASCII name
- *   conforming to column name requirements
- */
-VDB_EXTERN rc_t CC VSchemaRuntimeTableAddColumn ( VSchemaRuntimeTable *self, 
-    const VTypedecl *td, const char *encoding, const char *name, ... );
-VDB_EXTERN rc_t CC VSchemaRuntimeTableVAddColumn ( VSchemaRuntimeTable *self, 
-    const VTypedecl *td, const char *encoding, const char *name, va_list args );
-
-
-/* AddTypedColumn
- *  Gerber versions of AddColumn
- *
- *  AddBooleanColumn - simple boolean column with default compression
- *                     provides both packed ( single bit ) and byte versions
- *  AddIntegerColumn - sized integer column with appropriate sign, size and compression
- *  AddFloatColumn   - sized floating point column with lossy compression
- *  AddAsciiColumn   - 8-bit ASCII text column with standard compression
- *  AddUnicodeColumn - UTF8, UTF16, or UTF32 text column with standard compression
- */
-VDB_EXTERN rc_t CC VSchemaRuntimeTableAddBooleanColumn ( VSchemaRuntimeTable *self,
-    const char *name, ... );
-VDB_EXTERN rc_t CC VSchemaRuntimeTableAddIntegerColumn ( VSchemaRuntimeTable *self,
-    uint32_t bits, bool has_sign,  const char *name, ... );
-VDB_EXTERN rc_t CC VSchemaRuntimeTableAddFloatColumn ( VSchemaRuntimeTable *self,
-    uint32_t bits, uint32_t significant_mantissa_bits,  const char *name, ... );
-VDB_EXTERN rc_t CC VSchemaRuntimeTableAddAsciiColumn ( VSchemaRuntimeTable *self,
-    const char *name, ... );
-VDB_EXTERN rc_t CC VSchemaRuntimeTableAddUnicodeColumn ( VSchemaRuntimeTable *self,
-    uint32_t bits, const char *name, ... );
-
-VDB_EXTERN rc_t CC VSchemaRuntimeTableVAddBooleanColumn ( VSchemaRuntimeTable *self,
-    const char *name, va_list args );
-VDB_EXTERN rc_t CC VSchemaRuntimeTableVAddIntegerColumn ( VSchemaRuntimeTable *self,
-    uint32_t bits, bool has_sign,  const char *name, va_list args );
-VDB_EXTERN rc_t CC VSchemaRuntimeTableVAddFloatColumn ( VSchemaRuntimeTable *self,
-    uint32_t bits, uint32_t significant_mantissa_bits,  const char *name, va_list args );
-VDB_EXTERN rc_t CC VSchemaRuntimeTableVAddAsciiColumn ( VSchemaRuntimeTable *self,
-    const char *name, va_list args );
-VDB_EXTERN rc_t CC VSchemaRuntimeTableVAddUnicodeColumn ( VSchemaRuntimeTable *self,
-    uint32_t bits, const char *name, va_list args );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*  _h_vdb_schema_ */
diff --git a/interfaces/vdb/table.h b/interfaces/vdb/table.h
deleted file mode 100644
index 601740b..0000000
--- a/interfaces/vdb/table.h
+++ /dev/null
@@ -1,401 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_vdb_table_
-#define _h_vdb_table_
-
-#ifndef _h_vdb_extern_
-#include <vdb/extern.h>
-#endif
-
-#ifndef _h_kfs_directory_
-#include <kfs/directory.h>
-#endif
-
-#ifndef _h_kdb_column_
-#include <kdb/column.h>
-#endif
-
-#ifndef _h_kdb_index_
-#include <kdb/index.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct VSchema;
-struct KMetadata;
-struct KNamelist;
-struct VDatabase;
-struct VDBManager;
-
-
-/*--------------------------------------------------------------------------
- * VTable
- *  a collection of columns indexed by row id, metadata, indices
- */
-typedef struct VTable VTable;
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-VDB_EXTERN rc_t CC VTableAddRef ( const VTable *self );
-VDB_EXTERN rc_t CC VTableRelease ( const VTable *self );
-
-
-/* CreateTable
- *  create a new or open an existing table using manager
- *
- *  "tbl" [ OUT ] - return parameter for newly opened table
- *
- *  "schema" [ IN ] - schema object containg table
- *  declaration to be used in creating tbl.
- *
- *  "typespec" [ IN ] - type and optionally version of table schema,
- *  e.g. 'MY_NAMESPACE:MyTable' or 'MY_NAMESPACE:MyTable#1.1'
- *
- *  "cmode" [ IN ] - creation mode
- *
- *  "path" [ IN ] - NUL terminated string in
- *  wd-native character set giving path to table
- */
-VDB_EXTERN rc_t CC VDBManagerCreateTable ( struct VDBManager *self, VTable **tbl,
-    struct VSchema const *schema, const char *typespec,
-    KCreateMode cmode, const char *path, ... );
-VDB_EXTERN rc_t CC VDBManagerVCreateTable ( struct VDBManager *self, VTable **tbl,
-    struct VSchema const *schema, const char *typespec,
-    KCreateMode cmode, const char *path, va_list args );
-
-
-/* CreateTable
- *  create a new or open an existing table under database
- *
- *  "tbl" [ OUT ] - return parameter for newly opened table
- *
- *  "member" [ IN ] - name of table member template under database
- *  the named member is a table template rather than a named table.
- *
- *  "cmode" [ IN ] - creation mode
- *
- *  "name" [ IN ] - NUL terminated string in
- *  db-native character set giving actual table name
- */
-VDB_EXTERN rc_t CC VDatabaseCreateTable ( struct VDatabase *self, VTable **tbl,
-    const char *member, KCreateMode cmode, const char *name, ... );
-VDB_EXTERN rc_t CC VDatabaseVCreateTable ( struct VDatabase *self, VTable **tbl,
-    const char *member, KCreateMode cmode, const char *name, va_list args );
-
-
-/* OpenTableRead
- *  open a table for read using manager
- * OpenTableUpdate
- *  open a table for read/write using manager
- *
- *  "tbl" [ OUT ] - return parameter for newly opened table
- *
- *  "schema" [ IN, NULL OKAY ] - optional schema object with
- *  latest versions of table schema.
- *
- *  "path" [ IN ] - NUL terminated string in
- *  wd-native character set giving path to table
- */
-VDB_EXTERN rc_t CC VDBManagerOpenTableRead ( struct VDBManager const *self,
-    const VTable **tbl, struct VSchema const *schema,
-    const char *path, ... );
-VDB_EXTERN rc_t CC VDBManagerVOpenTableRead ( struct VDBManager const *self,
-    const VTable **tbl, struct VSchema const *schema,
-    const char *path, va_list args );
-
-VDB_EXTERN rc_t CC VDBManagerOpenTableUpdate ( struct VDBManager *self,
-    VTable **tbl, struct VSchema const *schema,
-    const char *path, ... );
-VDB_EXTERN rc_t CC VDBManagerVOpenTableUpdate ( struct VDBManager *self,
-    VTable **tbl, struct VSchema const *schema,
-    const char *path, va_list args );
-
-
-/* OpenTableRead
- *  open a table for read under database
- * OpenTableUpdate
- *  open or create a table for read/write under database
- *
- *  "tbl" [ OUT ] - return parameter for newly opened table
- *
- *  "name" [ IN ] - NUL terminated string in
- *  db-native character set giving name of table member
- */
-VDB_EXTERN rc_t CC VDatabaseOpenTableRead ( struct VDatabase const *self,
-    const VTable **tbl, const char *name, ... );
-VDB_EXTERN rc_t CC VDatabaseVOpenTableRead ( struct VDatabase const *self,
-    const VTable **tbl, const char *name, va_list args );
-
-VDB_EXTERN rc_t CC VDatabaseOpenTableUpdate ( struct VDatabase *self,
-    VTable **tbl, const char *name, ... );
-VDB_EXTERN rc_t CC VDatabaseVOpenTableUpdate ( struct VDatabase *self,
-    VTable **tbl, const char *name, va_list args );
-
-
-/* Typespec
- *  retrieve table typespec
- *
- *  AVAILABILITY: version 2.1
- *
- *  "ts_buff" [ IN ] and "ts_size" [ IN ] - buffer for return of NUL-terminated
- *  table typespec, e.g. 'NCBI:tbl:abc #1.1'
- */
-VDB_EXTERN rc_t CC VTableTypespec ( const VTable *self,
-    char *ts_buff, size_t ts_size );
-
-
-/* Locked
- *  returns true if locked
- */
-VDB_EXTERN bool CC VTableLocked ( const VTable *self );
-
-
-/* Writable
- *  returns 0 if object is writable
- *  or a reason why if not
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptIndex and kptColumn
- *
- *  "path" [ IN ] - NUL terminated path
- */
-VDB_EXTERN rc_t CC VTableWritable ( const VTable *self, uint32_t type,
-    const char * name, ... );
-VDB_EXTERN rc_t CC VTableVWritable ( const VTable *self, uint32_t type,
-    const char * name, va_list args );
-
-/* Lock
- *  apply lock
- *
- *  if object is already locked, the operation is idempotent
- *  and returns an rc state of rcLocked
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptIndex and kptColumn
- *
- *  "path" [ IN ] - NUL terminated path
- */
-VDB_EXTERN rc_t CC VTableLock ( VTable *self, uint32_t type,
-    const char * name, ... );
-VDB_EXTERN rc_t CC VTableVLock ( VTable *self, uint32_t type,
-    const char * name, va_list args );
-
-/* Unlock
- *  remove lock
- *
- *  if object is already unlocked, the operation is idempotent
- *  and returns an rc state of rcUnlocked
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptIndex and kptColumn
- *
- *  "path" [ IN ] - NUL terminated path
- */
-VDB_EXTERN rc_t CC VTableUnlock ( VTable *self, uint32_t type,
-    const char * name, ... );
-VDB_EXTERN rc_t CC VTableVUnlock ( VTable *self, uint32_t type,
-    const char * name, va_list args );
-
-
-/* OpenMetadataRead
- * OpenMetadataUpdate
- *  opens metadata file
- *
- *  "meta" [ OUT ] - return parameter for metadata
- */
-VDB_EXTERN rc_t CC VTableOpenMetadataRead ( const VTable *self, struct KMetadata const **meta );
-VDB_EXTERN rc_t CC VTableOpenMetadataUpdate ( VTable *self, struct KMetadata **meta );
-
-
-/* ColumnCreateParams
- *  sets the creation parameters for physical columns
- *
- *  "cmode" [ IN ] - creation mode
- *
- *  "checksum" [ IN ] - the type of checksum information to
- *  apply when writing blobs
- *
- *  "pgsize" [ IN, DEFAULT ZERO ] - size of internal column "pages"
- *  the default value is indicated by 0 ( zero ).
- *  NB - CURRENTLY THE ONLY SUPPORTED PAGE SIZE IS 1 ( ONE ) BYTE.
- */
-VDB_EXTERN rc_t CC VTableColumnCreateParams ( VTable *self,
-    KCreateMode cmode, KChecksum checksum, size_t pgsize );
-
-
-/* CreateIndex
- * VCreateIndex
- *  create a new or open an existing index
- *
- *  "idx" [ OUT ] - return parameter for newly opened index
- *
- *  "type" [ IN ] - type of index to create
- *
- *  "cmode" [ IN ] - creation mode
- *
- *  "name" [ IN ] - NUL terminated string in UTF-8 giving simple name of idx
- */
-VDB_EXTERN rc_t CC VTableCreateIndex ( VTable *self, KIndex **idx,
-    KIdxType type, KCreateMode cmode, const char *name, ... );
-VDB_EXTERN rc_t CC VTableVCreateIndex ( VTable *self, KIndex **idx,
-    KIdxType type, KCreateMode cmode, const char *name, va_list args );
-
-
-/* OpenIndexRead
- * VOpenIndexRead
- *  open an index for read
- *
- *  "idx" [ OUT ] - return parameter for newly opened index
- *
- *  "name" [ IN ] - NUL terminated string in UTF-8 giving simple name of idx
- */
-VDB_EXTERN rc_t CC VTableOpenIndexRead ( const VTable *self,
-    const KIndex **idx, const char *name, ... );
-VDB_EXTERN rc_t CC VTableVOpenIndexRead ( const VTable *self,
-    const KIndex **idx, const char *name, va_list args );
-
-
-/* OpenIndexUpdate
- * VOpenIndexUpdate
- *  open an index for read/write
- *
- *  "idx" [ OUT ] - return parameter for newly opened index
- *
- *  "name" [ IN ] - NUL terminated string in UTF-8 giving simple name of idx
- */
-
-VDB_EXTERN rc_t CC VTableOpenIndexUpdate ( VTable *self,
-    KIndex **idx, const char *name, ... );
-VDB_EXTERN rc_t CC VTableVOpenIndexUpdate ( VTable *self,
-    KIndex **idx, const char *name, va_list args );
-
-
-/* ListColumns
- *  list readable or writable column names
- *
- *  "names" [ OUT ] - return parameter for namelist
- *
- *  availability: v2.1
- */
-VDB_EXTERN rc_t CC VTableListReadableColumns ( const VTable *self, struct KNamelist **names );
-VDB_EXTERN rc_t CC VTableListWritableColumns ( VTable *self, struct KNamelist **names );
-
-
-/* ListCol
- *  alias for VTableListReadableColumns
- *
- *  availability: v2.0
- */
-VDB_EXTERN rc_t CC VTableListCol ( const VTable *self, struct KNamelist **names );
-
-
-/* ListDatatypes
- *  returns list of typedecls for named column
- *
- *  "col" [ IN ] - column name
- *
- *  "dflt_idx" [ OUT, NULL OKAY ] - returns the zero-based index
- *  into "typedecls" of the default datatype for the named column
- *
- *  "typedecls" [ OUT ] - list of datatypes available for named column
- *
- *  availability: v2.1
- */
-VDB_EXTERN rc_t CC VTableListReadableDatatypes ( const VTable *self, const char *col,
-    uint32_t *dflt_idx, struct KNamelist **typedecls );
-VDB_EXTERN rc_t CC VTableListWritableDatatypes ( VTable *self,
-    const char *col, struct KNamelist **typedecls );
-
-
-/* ColumnDatatypes
- *  alias for VTableListReadableDatatypes
- *
- *  availability: v2.0
- */
-VDB_EXTERN rc_t CC VTableColumnDatatypes ( const VTable *self, const char *col,
-    uint32_t *dflt_idx, struct KNamelist **typedecls );
-
-
-/* Reindex
- *  optimize column indices
- */
-VDB_EXTERN rc_t CC VTableReindex ( VTable *self );
-
-
-/* OpenManager
- *  duplicate reference to manager
- *  NB - returned reference must be released
- */
-VDB_EXTERN rc_t CC VTableOpenManagerRead ( const VTable *self, struct VDBManager const **mgr );
-VDB_EXTERN rc_t CC VTableOpenManagerUpdate ( VTable *self, struct VDBManager **mgr );
-
-
-/* OpenParent
- *  duplicate reference to parent database
- *  NB - returned reference must be released
- */
-VDB_EXTERN rc_t CC VTableOpenParentRead ( const VTable *self, struct VDatabase const **db );
-VDB_EXTERN rc_t CC VTableOpenParentUpdate ( VTable *self, struct VDatabase **db );
-
-
-/* OpenSchema
- *  duplicate reference to table schema
- *  NB - returned reference must be released
- */
-VDB_EXTERN rc_t CC VTableOpenSchema ( const VTable *self, struct VSchema const **schema );
-
-
-/* GetUserData
- * SetUserData
- *  store/retrieve an opaque pointer to user data
- *
- *  "data" [ OUT ] - return parameter for getting data
- *  "data" [ IN ] - parameter for setting data
- *
- *  "destroy" [ IN, NULL OKAY ] - optional destructor param
- *  invoked from destructor of "self"
- */
-VDB_EXTERN rc_t CC VTableGetUserData ( const VTable *self, void **data );
-VDB_EXTERN rc_t CC VTableSetUserData ( const VTable *self,
-    void *data, void ( CC * destroy ) ( void *data ) );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*  _h_vdb_table_ */
diff --git a/interfaces/vdb/table.hpp b/interfaces/vdb/table.hpp
deleted file mode 100644
index 3270a22..0000000
--- a/interfaces/vdb/table.hpp
+++ /dev/null
@@ -1,328 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _hpp_vdb_table_
-#define _hpp_vdb_table_
-
-#ifndef _h_vdb_table_
-#include <vdb/table.h>
-#endif
-
-#ifndef _h_vdb_cursor_
-#include <vdb/cursor.h>
-#endif
-
-
-/*--------------------------------------------------------------------------
- * VTable
- *  a collection of columns indexed by row id, metadata, indices
- */
-struct VTable
-{
-    /* AddRef
-     * Release
-     *  all objects are reference counted
-     *  NULL references are ignored
-     */
-    inline rc_t AddRef ( const VTable *self ) const throw()
-    { return VTableAddRef ( this ); }
-    inline rc_t Release ( const VTable *self ) const throw()
-    { return VTableRelease ( this ); }
-
-    /* Locked
-     *  returns true if locked
-     */
-    inline bool Locked () const throw()
-    { return VTableLocked ( this ); }
-
-
-    /* Writable
-     *  returns 0 if object is writable
-     *  or a reason why if not
-     *
-     *  "type" [ IN ] - a KDBPathType
-     *  valid values are kptIndex and kptColumn
-     *
-     *  "path" [ IN ] - NUL terminated path
-     */
-     inline rc_t Writable ( uint32_t type, 
-        const char * name, ... ) const throw()
-     {
-        va_list args;
-        va_start ( args, name );
-        rc_t rc = VTableVWritable ( this, type, name, args );
-        va_end ( args );
-        return rc;
-     }
-     inline rc_t Writable ( uint32_t type, 
-        const char * name, va_list args ) const throw()
-    { return VTableVWritable ( this, type, name, args ); }
-
-
-    /* Lock
-     *  apply lock
-     *
-     *  if object is already locked, the operation is idempotent
-     *  and returns an rc state of rcLocked
-     *
-     *  "type" [ IN ] - a KDBPathType
-     *  valid values are kptIndex and kptColumn
-     *
-     *  "name" [ IN ] - NUL terminated path
-     */
-    inline rc_t Lock ( uint32_t type, const char * name, ... ) throw()
-    {
-        va_list args;
-        va_start ( args, name );
-        rc_t rc = VTableVLock ( this, type, name, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t Lock ( uint32_t type, const char * name, va_list args ) throw()
-    { return VTableVLock ( this, type, name, args ); }
-
-    
-    /* Unlock
-     *  remove lock
-     *
-     *  if object is already unlocked, the operation is idempotent
-     *  and returns an rc state of rcUnlocked
-     *
-     *  "type" [ IN ] - a KDBPathType
-     *  valid values are kptIndex and kptColumn
-     *
-     *  "name" [ IN ] - NUL terminated path
-     */
-     inline rc_t Unlock ( uint32_t type, const char * name, ... ) throw()
-     {
-        va_list args;
-        va_start ( args, name );
-        rc_t rc = VTableVUnlock ( this, type, name, args );
-        va_end ( args );
-        return rc;
-     }
-    inline rc_t UnLock ( uint32_t type, const char * name, va_list args ) throw()
-    { return VTableVUnlock ( this, type, name, args ); }
-
-
-    /* OpenMetadataRead
-     * OpenMetadataUpdate
-     *  opens metadata file
-     *
-     *  "meta" [ OUT ] - return parameter for metadata
-     */
-    inline rc_t OpenMetadataRead ( struct KMetadata const **meta ) const throw()
-    { return VTableOpenMetadataRead ( this, meta ); }
-    inline rc_t OpenMetadataUpdate ( struct KMetadata **meta ) throw()
-    { return VTableOpenMetadataUpdate ( this, meta ); }
-    
-
-    /* ColumnCreateParams
-     *  sets the creation parameters for physical columns
-     *
-     *  "cmode" [ IN ] - creation mode
-     *
-     *  "checksum" [ IN ] - the type of checksum information to
-     *  apply when writing blobs
-     *
-     *  "pgsize" [ IN, DEFAULT ZERO ] - size of internal column "pages"
-     *  the default value is indicated by 0 ( zero ).
-     *  NB - CURRENTLY THE ONLY SUPPORTED PAGE SIZE IS 1 ( ONE ) BYTE.
-     */
-    inline rc_t ColumnCreateParams ( KCreateMode cmode, 
-        KChecksum checksum, size_t pgsize ) throw()
-    { return VTableColumnCreateParams ( this, cmode, checksum, pgsize ); }
-
-
-    /* CreateIndex
-     * VCreateIndex
-     *  create a new or open an existing index
-     *
-     *  "idx" [ OUT ] - return parameter for newly opened index
-     *
-     *  "type" [ IN ] - type of index to create
-     *
-     *  "cmode" [ IN ] - creation mode
-     *
-     *  "name" [ IN ] - NUL terminated string in UTF-8 giving simple name of idx
-     */
-    inline rc_t CreateIndex ( KIndex **idx,
-        KIdxType type, KCreateMode cmode, const char *name, ... ) throw()
-    {
-        va_list args;
-        va_start ( args, name );
-        rc_t rc = VTableVCreateIndex ( this, idx, type, cmode, name, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t CreateIndex ( KIndex **idx,
-        KIdxType type, KCreateMode cmode, const char *name, va_list args ) throw()
-    { return VTableVCreateIndex ( this, idx, type, cmode, name, args ); }
-
-
-    /* OpenIndexRead
-     * VOpenIndexRead
-     *  open an index for read
-     *
-     *  "idx" [ OUT ] - return parameter for newly opened index
-     *
-     *  "name" [ IN ] - NUL terminated string in UTF-8 giving simple name of idx
-     */
-    inline rc_t OpenIndexRead ( const KIndex **idx,
-        const char *name, ... ) const throw()
-    {
-        va_list args;
-        va_start ( args, name );
-        rc_t rc = VTableVOpenIndexRead ( this, idx, name, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t OpenIndexRead ( const KIndex **idx,
-        const char *name, va_list args ) const throw()
-    { return VTableVOpenIndexRead ( this, idx, name, args ); }
-
-
-    /* OpenIndexUpdate
-     * VOpenIndexUpdate
-     *  open an index for read/write
-     *
-     *  "idx" [ OUT ] - return parameter for newly opened index
-     *
-     *  "name" [ IN ] - NUL terminated string in UTF-8 giving simple name of idx
-     */
-    inline rc_t OpenIndexUpdate ( KIndex **idx,
-        const char *name, ... ) throw()
-    {
-        va_list args;
-        va_start ( args, name );
-        rc_t rc = VTableVOpenIndexUpdate ( this, idx, name, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t OpenIndexUpdate ( KIndex **idx,
-        const char *name, va_list args ) throw()
-    { return VTableVOpenIndexUpdate ( this, idx, name, args ); }
-
-
-    /* List
-     *  create table listings
-     */
-    inline rc_t ListCol ( struct KNamelist **names ) const throw()
-    { return VTableListCol ( this, names ); }
-
-
-    /* ColumnDatatypes
-     *  returns list of typedecls for named column
-     *
-     *  "col" [ IN ] - column name
-     *
-     *  "dflt_idx" [ OUT, NULL OKAY ] - returns the zero-based index
-     *  into "typedecls" of the default datatype for the named column
-     *
-     *  "typedecls" [ OUT ] - list of datatypes available for named column
-     */
-    inline rc_t ColumnDatatypes ( const char *col,
-        uint32_t *dflt_idx, struct KNamelist **typedecls ) const throw()
-    { return VTableColumnDatatypes ( this, col, dflt_idx, typedecls ); }
-
-
-    /* Reindex
-     *  optimize column indices
-     */
-    inline rc_t Reindex () throw()
-    { return VTableReindex ( this ); }
-
-
-    /* OpenManager
-     *  duplicate reference to manager
-     *  NB - returned reference must be released
-     */
-    inline rc_t OpenManager ( struct VDBManager const **mgr ) const throw()
-    { return VTableOpenManagerRead ( this, mgr ); }
-    inline rc_t OpenManager ( struct VDBManager **mgr ) throw()
-    { return VTableOpenManagerUpdate ( this, mgr ); }
-
-
-    /* OpenParent
-     *  duplicate reference to parent database
-     *  NB - returned reference must be released
-     */
-    inline rc_t OpenParent ( struct VDatabase const **db ) const throw()
-    { return VTableOpenParentRead ( this, db ); }
-    inline rc_t OpenParent ( struct VDatabase **db ) throw()
-    { return VTableOpenParentUpdate ( this, db ); }
-
-
-    /* OpenSchema
-     *  duplicate reference to table schema
-     *  NB - returned reference must be released
-     */
-    inline rc_t OpenSchema ( struct VSchema const **schema ) const throw()
-    { return  VTableOpenSchema ( this, schema ); }
-
-
-    /* GetUserData
-     * SetUserData
-     *  store/retrieve an opaque pointer to user data
-     *
-     *  "data" [ OUT ] - return parameter for getting data
-     *  "data" [ IN ] - parameter for setting data
-     *
-     *  "destroy" [ IN, NULL OKAY ] - optional destructor param
-     *  invoked from destructor of "self"
-     */
-    inline rc_t GetUserData ( void **data ) const throw()
-    { return VTableGetUserData ( this, data ); }
-    inline rc_t SetUserData ( void *data,
-        void ( CC * destroy ) ( void *data ) ) const throw()
-    { return VTableSetUserData ( this, data, destroy ); }
-
-
-    /* CreateCursor
-     *  creates a cursor object onto table
-     *  multiple read cursors are allowed
-     *  only a single write cursor is allowed
-     *
-     *  "curs" [ OUT ] - return parameter for newly created cursor
-     *
-     *  "mode" [ IN ] - describes update behavior
-     *    kcmUpdate   : allow inserts or updates
-     *    kcmReplace  : replace all existing rows with newly written rows
-     *    kcmInsert   : allow only inserts, i.e. new rows
-     */
-    inline rc_t CreateCursor ( const VCursor **curs ) const throw()
-    { return VTableCreateCursorRead ( this, curs ); }
-    inline rc_t CreateCursor ( VCursor **curs, KCreateMode mode ) throw()
-    { return VTableCreateCursorWrite ( this, curs, mode ); }
-
-private:
-    VTable ();
-    ~ VTable ();
-    VTable ( const VTable& );
-    VTable &operator = ( const VTable& );
-};
-
-#endif //  _hpp_vdb_table_
diff --git a/interfaces/vdb/types.h b/interfaces/vdb/types.h
deleted file mode 100644
index 9e79909..0000000
--- a/interfaces/vdb/types.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*=======================================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/* THIS FILE IS DEPRECATED. */
-#if _DEBUGGING && defined __GNUC__
-#warning "this file is deprecated"
-#endif
-
-#ifndef _h_vdb_types_
-#define _h_vdb_types_
-
-#ifndef _h_sra_types_
-#include <sra/types.h>
-#endif
-
-#endif /*  _h_vdb_types_ */
diff --git a/interfaces/vdb/types.hpp b/interfaces/vdb/types.hpp
deleted file mode 100644
index 1865964..0000000
--- a/interfaces/vdb/types.hpp
+++ /dev/null
@@ -1,230 +0,0 @@
-/*=======================================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _hpp_vdb_types_
-#define _hpp_vdb_types_
-
-// types are defined here
-#ifndef _h_vdb_types_
-#include <vdb/types.h>
-#endif
-
-
-/*--------------------------------------------------------------------------
- * VDatatypes
- */
-struct VDatatypes
-{
-    /* AddRef
-     * Release
-     */
-    inline rc_t AddRef () const throw()
-    { return VDatatypesAddRef ( this ); }
-
-    inline rc_t Release () const throw()
-    { return VDatatypesRelease ( this ); }
-
-
-    /* RegisterOpaque
-     * RegisterSubtype
-     *  registers new datatypes
-     *
-     *  "newtype" [ IN ] - NUL terminated fully qualified type name
-     *
-     *  "supertype" [ IN ] and "dim" [ IN ] - NUL terminated fully
-     *  qualified parent equivalency type and vector dimension
-     *  -OR-
-     *  "bits" [ IN ] - size in bits of element.
-     *
-     *  "byte_swap" [ IN, CONDITIONALLY NULL OKAY ] - a byte swapping function
-     *  required when size > 8 and and integral multiple of 8.
-     */
-#if 0 /* is omitted in sra/types.h too */
-    inline rc_t RegisterOpaque ( const char *newtype,
-       uint16_t bits, void ( CC *byte_swap ) ( void *elem ) ) throw()
-    { return VDatatypesRegisterOpaque ( this, newtype, bits, byte_swap ); }
-
-    inline rc_t RegisterSubtype ( const char *newtype, const char *supertype,
-        uint16_t dim, void ( CC *byte_swap ) ( void *elem ) ) throw()
-    { return VDatatypesRegisterSubtype ( this, newtype, supertype, dim, byte_swap ); }
-#endif
-
-
-    /* DefineSubtype
-     *  creates a subtype definition
-     *
-     *    typedef = [ 'typedef' ] <supertype> <typedecl>
-     */
-#if 0 /* is omitted in sra/types.h too */
-     inline rc_t DefineSubtype ( const char *definition, ... ) throw()
-    {
-        va_list args;
-        va_start ( args, definition );
-        rc_t rc = VDatatypesVDefineSubtype ( this, definition, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t DefineSubtype ( const char *definition, va_list args ) throw()
-    { return VDatatypesVDefineSubtype ( this, definition, args ); }
-#endif
-
-
-    /* ResolveTypedecl
-     *  converts a typedecl string to type id and vector dimension
-     *
-     *  "resolved" [ OUT ] - resolved type declaration
-     *
-     *  "typedecl" [ IN ] - type declaration
-     */
-    inline rc_t ResolveTypedecl ( VTypedecl *resolved,
-        const char *typedecl, ... ) const throw()
-    {
-        va_list args;
-        va_start ( args, typedecl );
-        rc_t rc = VDatatypesVResolveTypedecl ( this, resolved, typedecl, args );
-        va_end ( args );
-        return rc;
-    }
-    inline rc_t ResolveTypedecl ( VTypedecl *resolved,
-        const char *typedecl, va_list args ) const throw()
-    { return VDatatypesVResolveTypedecl ( this, resolved, typedecl, args ); }
-
-
-    /* ResolveTypename
-     *  convert a type id into its type definition
-     *
-     *  "resolved" [ OUT ] - resolved type definition
-     *
-     *  "typname" [ IN ] - NUL-terminated type name
-     */
-    inline rc_t ResolveTypename ( VTypedef *resolved,
-        const char *typname ) const throw()
-    { return VDatatypesResolveTypename ( this, resolved, typname ); }
-
-
-    /* ResolveTypeid
-     *  convert a type id into its type definition
-     *
-     *  "resolved" [ OUT ] - resolved type definition
-     *
-     *  "type_id" [ IN ] - 1-based runtime type id
-     */
-    inline rc_t ResolveTypeid ( VTypedef *resolved,
-        uint32_t type_id ) const throw()
-    { return VDatatypesResolveTypeid ( this, resolved, type_id ); }
-
-
-    /* SizeofTypedecl
-     *  returns the bit size of type declaration
-     */
-    inline rc_t SizeofTypedecl ( bitsz_t *type_size,
-        const VTypedecl *td ) const throw()
-    { return VDatatypesSizeofTypedecl ( this, type_size, td ); }
-
-
-    /* SizeofTypeid
-     *  returns the bit size of typeid
-     *
-     *  "type_size" [ OUT ] - bit size of a type
-     *
-     *  "type_id" [ IN ] - numerical index of a type
-     *
-     *  "all_elements" [ IN ] - for multi-dimesional types
-     *  return the sum of sizes, otherwise - only for a single element
-     */
-    inline rc_t SizeofTypeid ( bitsz_t *type_size, uint32_t type_id,
-        bool all_elements ) const throw()
-    { return VDatatypesSizeofTypeid ( this, type_size, type_id, all_elements ); }
-
-
-    /* MakeTypedecl
-     *  convert a VTypedecl into canonical text
-     *
-     *  "buffer" [ OUT ] and "bsize" [ IN ] - output buffer for
-     *  NUL terminated type declaration string
-     *
-     *  "typedecl" [ IN ] - binary representation of typedecl
-     */
-    inline rc_t MakeTypedecl ( char *buffer, size_t bsize,
-        const VTypedecl *typedecl ) const throw()
-    { return VDatatypesMakeTypedecl ( this, buffer, bsize, typedecl ); }
-
-
-    /* ToSupertype
-     *  cast a typedecl to a size-equivalent supertype decl
-     *  returns not-found and leaves "typedecl" unchanged
-     *  if no supertype exists
-     *
-     *  "typedecl" [ IN, OUT ] - populated with a correct
-     *  type id and vector dimension on input, will be updated
-     *  to contain a supertype and equivalent dimension on
-     *  output. e.g.:
-     *
-     *    IN -  { type_id NCBI:qual4, dim 1 }
-     *    OUT - { type_id I8, dim 4 }
-     */
-    inline rc_t ToSupertype ( VTypedecl *typedecl ) const throw()
-    { return VDatatypesToSupertype ( this,  typedecl ); }
-
-
-    /* ToIntrinsic
-     *  cast a typedecl ( if necessary ) to a size-equivalent
-     *  intrinsic typedecl.
-     *
-     *  returns not-found and leaves "typedecl" unchanged
-     *  if no intrinsic supertype exists
-     *
-     *  leaves "typedecl" unchanged if it is already intrinsic.
-     *
-     *  "typedecl" [ IN, OUT ] - populated with a correct
-     *  type id and vector dimension on input, will be updated
-     *  to contain a supertype and equivalent dimension on
-     *  output. e.g.:
-     *
-     *    IN -  { type_id NCBI:qual4, dim 1 }
-     *    OUT - { type_id I8, dim 4 }
-     */
-    inline rc_t ToIntrinsic ( VTypedecl *typedecl ) const throw()
-    { return VDatatypesToIntrinsic ( this, typedecl ); }
-
-
-    /* ToAncestor
-     *  cast a typedecl to a size-equivalent ancestor decl
-     *  returns true if cast can be performed
-     */
-    inline bool ToAncestor ( const VTypedecl *to,
-        const VTypedecl *from ) const throw()
-    { return VDatatypesToAncestor ( this, to, from ); }
-
-
-private:
-    VDatatypes ();
-    ~ VDatatypes ();
-    VDatatypes ( const VDatatypes& );
-    VDatatypes &operator = ( const VDatatypes& );
-};
-
-#endif //  _hpp_vdb_types_
diff --git a/interfaces/vdb/vdb-priv.h b/interfaces/vdb/vdb-priv.h
deleted file mode 100644
index 6ab1d62..0000000
--- a/interfaces/vdb/vdb-priv.h
+++ /dev/null
@@ -1,319 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_vdb_vdb_priv_
-#define _h_vdb_vdb_priv_
-
-#ifndef _h_vdb_extern_
-#include <vdb/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#include <stdarg.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KDatabase;
-struct KTable;
-struct KMetadata;
-struct KDBManager;
-struct KDirectory;
-struct VDBManager;
-struct VFSManager;
-struct VSchema;
-struct VTypedef;
-struct VDatabase;
-struct VTable;
-struct VCursor;
-struct VCursorParams;
-struct VXformInfo;
-struct KDataBuffer;
-struct KNamelist;
-
-
-/*--------------------------------------------------------------------------
- * VDBManager
- */
-
-/* OpenKDBManager
- *  returns a new reference to KDBManager used by VDBManager
- */
-VDB_EXTERN rc_t CC VDBManagerOpenKDBManagerRead ( struct VDBManager const *self,
-    struct KDBManager const **kmgr );
-VDB_EXTERN rc_t CC VDBManagerOpenKDBManagerUpdate ( struct VDBManager *self,
-    struct KDBManager **kmgr );
-
-#define VDBManagerGetKDBManagerRead VDBManagerOpenKDBManagerRead
-#define VDBManagerGetKDBManagerUpdate VDBManagerOpenKDBManagerUpdate
-
-
-/* ListExternalSchemaModules
- */
-VDB_EXTERN rc_t CC VDBManagerListExternalSchemaModules ( struct VDBManager const *self,
-    struct KNamelist **list );
-
-/* DisablePagemapThread
- *  this can cause difficulties for some clients
- */
-VDB_EXTERN rc_t CC VDBManagerDisablePagemapThread ( struct VDBManager const *self );
-
-
-/* Make with custom VFSManager */
-VDB_EXTERN rc_t CC VDBManagerMakeReadWithVFSManager (
-    const struct VDBManager **mgr,
-    struct KDirectory const *wd, struct VFSManager *vmgr );
-
-
-/*--------------------------------------------------------------------------
- * VSchema
- */
-
-/* DescribeTypedef - PRIVATE
- *  a type is defined as either:
- */
-VDB_EXTERN rc_t CC VSchemaDescribeTypedef ( struct VSchema const *self,
-    struct VTypedef *def, uint32_t type_id );
-
-/* LastIntrinsicTypeId - PRIVATE
- *  used to allow cast to intrinsics
- */
-VDB_EXTERN uint32_t CC VSchemaLastIntrinsicTypeId ( struct VSchema const *self );
-
-/* ListLegacyTables - PRIVATE
- *  scan all tables defined in schema
- *  return the fully-qualified and versioned name of each legacy SRA table
- */
-VDB_EXTERN rc_t CC VSchemaListLegacyTables ( struct VSchema const *self, struct KNamelist **list );
-
-
-/*--------------------------------------------------------------------------
- * VDatabase
- */
-
-/* OpenKDatabase
- *  returns a new reference to underlying KDatabase
- */
-VDB_EXTERN rc_t CC VDatabaseOpenKDatabaseRead ( struct VDatabase const *self, struct KDatabase const **kdb );
-VDB_EXTERN rc_t CC VDatabaseOpenKDatabaseUpdate ( struct VDatabase *self, struct KDatabase **kdb );
-
-
-/* IsCSRA
- *  ask an open database if it conforms to cSRA schema
- */
-VDB_EXTERN bool CC VDatabaseIsCSRA ( struct VDatabase const *self );
-
-
-/*--------------------------------------------------------------------------
- * VTable
- */
-
-/* OpenKTable
- *  returns a new reference to underlying KTable
- */
-VDB_EXTERN rc_t CC VTableOpenKTableRead ( struct VTable const *self, struct KTable const **ktbl );
-VDB_EXTERN rc_t CC VTableOpenKTableUpdate ( struct VTable *self, struct KTable **ktbl );
-
-#define VTableGetKTableRead VTableOpenKTableRead
-#define VTableGetKTableUpdate VTableOpenKTableUpdate
-
-
-/* DropColumn
- */
-VDB_EXTERN rc_t CC VTableDropColumn ( struct VTable *self, const char *name, ... );
-VDB_EXTERN rc_t CC VTableVDropColumn ( struct VTable *self, const char *name, va_list args );
-
-/* RenameColumn
- */
-VDB_EXTERN rc_t CC VTableRenameColumn ( struct VTable *self, bool force,
-    const char *from, const char *to );
-
-/* ListPhysColumns
- * ListSeededWritableColumns
- *  avail: 2.4
- */
-VDB_EXTERN rc_t CC VTableListPhysColumns ( struct VTable const *self, struct KNamelist **names );
-VDB_EXTERN rc_t CC VTableListSeededWritableColumns ( struct VTable *self,
-    struct KNamelist **names, struct KNamelist const *seed );
-
-
-/* HasStaticColumn
- *  given a physical column name, report whether it exists
- *  and is ( currently ) static
- *  avail: 2.5
- */
-VDB_EXTERN bool CC VTableHasStaticColumn ( struct VTable const *self, const char *name );
-
-
-/* VUntypedTableTest
- *  support for tables created before embedded schema
- *
- *  "ktbl" [ IN ] - physical table to recognize
- *
- *  "meta" [ IN ] - open metadata for table
- *
- *  returns true if table is recognized
- */
-typedef bool ( CC * VUntypedTableTest )
-   ( struct KTable const *ktbl, struct KMetadata const *meta );
-
-
-/* StoreSchema
- *  stores current schema definition in metadata
- *
- *  useful if table was opened using a later version of schema than
- *  was used for its creation.
- */
-VDB_EXTERN rc_t VTableStoreSchema ( struct VTable *self );
-
-
-/*--------------------------------------------------------------------------
- * VCursor
- */
-
-
-/* CreateCursorView
- *  creates a read-only cursor onto table
- *  uses table schema as base
- *  uses view described in viewspec as view
- *
- *  AVAILABILITY: version 2.3
- *
- *  for pre-vdb-2.3 tables, defaults to CreateCursorRead, ignoring
- *  schema specification
- *
- *  "curs" [ OUT ] - return parameter for newly created cursor
- *
- *  "viewspec" [ IN ] - NUL terminated string describing the view schema
- */
-VDB_EXTERN rc_t CC VTableCreateCursorView ( struct VTable const *self,
-    struct VCursor const **curs, const char *viewspec );
-
-/* PermitPostOpenAdd
- *  allows columns to be added to open cursor
- *  for write cursor, the effect lasts until the first row commit
- */
-VDB_EXTERN rc_t CC VCursorPermitPostOpenAdd ( struct VCursor const *self );
-/*  SuspendTriggers
- *  blocks resolution of schema-based triggers
- *
- */
-VDB_EXTERN rc_t CC VCursorSuspendTriggers ( struct VCursor const *self );
-
-/*  VCursorGetSchema
- *  returns current schema of the open cursor
- */
-VDB_EXTERN struct VSchema const* CC VCursorGetSchema ( struct VCursor const *self);
-
-/* PageIdRange
- *  returns id range for page
- *
- *  "id" [ IN ] - page containing this row id is target
- *
- *  "first" [ OUT, NULL OKAY ] and "last" [ OUT, NULL OKAY ] -
- *  id range is returned in these output parameters, where
- *  at least ONE must be NOT-NULL
- */
-VDB_EXTERN rc_t CC VCursorPageIdRange ( struct VCursor const *self,
-    uint32_t idx, int64_t id, int64_t *first, int64_t *last );
-
-
-/* IsStaticColumn
- *  answers question: "does this column have the same value for every cell?"
- */
-VDB_EXTERN rc_t CC VCursorIsStaticColumn ( struct VCursor const *self,
-    uint32_t col_idx, bool *is_static );
-
-
-VDB_EXTERN rc_t CC VCursorLinkedCursorGet(const struct VCursor *cself,const char *tbl, struct VCursor const **curs);
-VDB_EXTERN rc_t CC VCursorLinkedCursorSet(const struct VCursor *cself,const char *tbl, struct VCursor const *curs);
-
-
-/*--------------------------------------------------------------------------
- * VCursorParams
- */
-
-/* Get
- *  return KDataBuffer value by reference
- */
-VDB_EXTERN rc_t CC VCursorParamsGet ( struct VCursorParams const *self,
-    const char *name, struct KDataBuffer **value );
-
-/* Set
- *  set a textual parameter value
- */
-VDB_EXTERN rc_t CC VCursorParamsSet( struct VCursorParams const *self,
-    const char *name, const char *fmt, ... );
-VDB_EXTERN rc_t CC VCursorParamsVSet ( struct VCursorParams const *self,
-    const char *name, const char *fmt, va_list args );
-
-/* Unset
- *  set the value of a named parameter to "undefined"
- */
-VDB_EXTERN rc_t CC VCursorParamsUnset ( struct VCursorParams const *self, const char *name );
-
-
-/*--------------------------------------------------------------------------
- * xform
- */
-
-/*
-  uses vftReserved code
-  returns little-endian data, no row-wise rle
-  fixed row-length is calculated as dst->elem_count / num_rows
- */
-#define vftLegacyBlob vftReserved
-
-typedef struct VLegacyBlobResult VLegacyBlobResult;
-struct VLegacyBlobResult
-{
-    struct KDataBuffer *dst;
-    uint8_t byte_order;
-};
-
-typedef rc_t ( CC * VNoHdrBlobFunc ) ( void *self,
-    struct VXformInfo const *info, VLegacyBlobResult *rslt,
-    struct KDataBuffer const *src );
-
-/* function to call to test table against schema */
-typedef bool ( CC * VUntypedFunc )
-    ( struct KTable const *tbl, struct KMetadata const *meta );
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_vdb_vdb_priv_ */
diff --git a/interfaces/vdb/vdb.vschema b/interfaces/vdb/vdb.vschema
deleted file mode 100644
index 9153474..0000000
--- a/interfaces/vdb/vdb.vschema
+++ /dev/null
@@ -1,820 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/*==========================================================================
- * VDB external functions, formats and types
- */
-version 1;
-
-// built-in functions should be known to all
-include 'vdb/built-in.vschema';
-
-
-/*--------------------------------------------------------------------------
- * types
- */
-
-/* text_token
- *  a vector describing tokens recognized within a text string
- *
- * COMPONENTS:
- *  0 - token id
- *  1 - token starting coordinate
- *  2 - token length
- */
-typedef U16 text:token [ 3 ];
-
-
-/*--------------------------------------------------------------------------
- * typesets
- */
-typeset pack_set { B8, B16, B32, B64, integer_set };
-typeset izip_set { integer_set };
-typeset fzip_set { F32 };
-
-
-/*--------------------------------------------------------------------------
- * formats
- */
-fmtdef izip_fmt;
-fmtdef fzip_fmt;
-fmtdef rle_fmt;
-fmtdef zlib_fmt;
-fmtdef bzip2_fmt;
-
-
-/*--------------------------------------------------------------------------
- * functions
- */
-
-/* echo
- *  returns single or repeated constant value
- *
- *  "T" [ TYPE ] - type of constant data to return
- *
- *  "val" [ CONST ] - a data constant
- *
- *  "row_len" [ DATA, OPTIONAL ] - if omitted, "val" will be
- *  issued once and the resultant row-length will be the length
- *  of "val". otherwise, "val" will be repeated and/or truncated
- *  as necessary to produce a row-length equal to that of input.
- *
- * USAGE:
- *  to echo a single constant value
- *    U16 len = row_len ( col ) | < U16 > echo < 0 > ();
- *
- *  to create a row of repeated values
- *    ascii allN = < ascii > echo < 'N' > ( col );
- */
-function < type T >
-T echo #1.0 < T val > ( * any row_len )
-    = vdb:echo;
-
-
-/* exists
- *  returns constant or dynamic value if predicate input exists
- *
- *  "T" [ TYPE ] - type of data to return
- *
- *  "cval" [ CONST, OPTIONAL ] - a data constant. when present,
- *  the function will behave like "echo" ( see below )
- *
- *  "predicate" [ DATA ] - an input whose existence determines
- *  whether the function will operate or not.
- *
- *  "dval" [ DATA, OPTIONAL ] - data value, either passed through
- *  or used to determine a repeat count of "cval" ( see below )
- *
- * USAGE:
- *  when "cval" is omitted, "dval" must be present and will be
- *  passed through depending upon the existence of "predicate"
- *    U8 count = < U8 > exists ( col, count2 );
- *
- *  when "cval" is present, "dval" may be omitted, and "cval" will
- *  be passed through just like echo depending upon "predicate"
- *   U8 count = < U8 > exists < 2 > ( col2 ) | < U8 > echo < 1 > ();
- *
- *  when "cval" and "dval" are both present, the behavior is
- *  like echo, but gated with "predicate"
- *    ascii poly = < ascii > exists < 'a' > ( col, repeat );
- */
-function < type T >
-T exists #1.0 < * T cval > ( any predicate, * T dval )
-    = vdb:exists;
-
-
-/* map
- *  translate input elements
- *  behaves much like the Unix "tr" command
- *  except that charsets are not [currently] supported
- *
- *  "A" [ TYPE ] - input data type, e.g. "ascii"
- *
- *  "B" [ TYPE ] - output data type, e.g. "ascii" or "U8"
- *
- *  "from" [ CONST ] - set of key values.
- *
- *  "to" [ CONST ] - set of mapped values,
- *  where length ( from ) === length ( to )
- *
- *  "in" [ DATA ] - input data to be matched against keys
- *  in "from". also serves as source data when "src" is omitted
- *
- *  "src" [ DATA, OPTIONAL ] - source data to be edited by
- *  substituting "to" values when corresponding "in" value
- *  matches key in "from". if omitted, "in" is used.
- *
- * USAGE:
- *  to upper case letters from a given alphabet
- *    ascii upper = < ascii, ascii > map < 'acgtn', 'ACGTN' > ( in );
- *
- *  to translate from ascii to binary
- *    U8 bin = < ascii, U8 > map < 'ACGTN', [ 0, 1, 2, 3, 0 ] > ( in );
- *
- *  to alter certain values of a column based upon values in another
- *    U8 n_encoded = < ascii, U8 > map < 'N', 0 > ( read, quality );
- *
- * CAVEATS:
- *  the full canonical mode of operation uses separate inputs
- *  for key matching and output source.
- *
- *  when a single input is specified:
- *   - sizeof ( A ) must equal sizeof ( B )
- *   - A must be a proper subset of B -OR-
- *   - "from" keys must match every possible "in" value ( total substitution )
- */
-function < type A, type B >
-B map #1.0 < A from, B to > ( A in, * B src )
-    = vdb:map;
-
-
-/* clip
- *  limit data values to given bounds
- *
- *  "T" [ TYPE ] - input and output data type
- *
- *  "dim" [ CONST >= 1 ] - fixed dimension on
- *  input and output vectors
- *
- *  "lower" [ CONST ] - lower bound, inclusive
- *
- *  "upper" [ CONST ] - upper bounds, inclusive
- *
- *  "in" [ DATA ] - data to be clipped
- */
-function < type T >
-T clip #1.0 < T lower, T upper > ( T in )
-    = vdb:clip;
-
-function < type T, U32 dim >
-T [ dim ] vclip #1.0 < T lower, T upper > ( T [ dim ] in )
-    = vdb:clip;
-
-
-/* ceil
- *  round up to the nearest integer
- *
- *  "in" [ DATA ] - data to be processed
- */
-function
-numeric_set ceil #1.0 ( float_set in )
-    = vdb:ceil;
-
-/* floor
- *  round down to the nearest integer
- *
- *  "in" [ DATA ] - data to be processed
- */
-function
-numeric_set floor #1.0 ( float_set in )
-    = vdb:floor;
-
-/* round
- *  round to nearest integer away from zero
- *
- *  "T" [ TYPE = { F32, F64 } ] - input and output data type
- *
- *  "in" [ DATA ] - data to be processed
- */
-function
-numeric_set round #1.0 ( float_set in )
-    = vdb:round;
-
-/* trunc
- *  round to the nearest integer not larger in absolute value
- *
- *  "T" [ TYPE = { F32, F64 } ] - input and output data type
- *
- *  "in" [ DATA ] - data to be processed
- */
-function
-numeric_set trunc #1.0 ( float_set in )
-    = vdb:trunc;
-
-
-/* min
- *  return the minimum value of each element
- * max
- *  return the maximum value of each element
- *
- *  "T" [ TYPE ] - input and output data type
- *
- *  "a" [ DATA ] - first operand
- *
- *  "b" [ DATA ] - second operand
- *
- * SYNOPSIS:
- *  compares two inputs element by element
- *  returns min or max element of each
- *
- * USAGE:
- *  intersections
- *    U32 left = < U32 > max ( left_a, left_b );
- *    U32 right = < U32 > min ( right_a, right_b );
- */
-function < type T >
-T min #1.0 ( T a, T b )
-    = vdb:min;
-
-function < type T >
-T max #1.0 ( T a, T b )
-    = vdb:max;
-
-
-/* sum
- *  return the sum of inputs
- * diff
- *  return the difference of inputs
- *
- *  "T" [ TYPE ] - input and output data type
- *  must be member of numeric_set
- *
- *  "k" [ CONST, DEFAULT 0 ] - optional constant
- *  to be added or subtracted
- *
- *  "a" [ DATA ] - left-most operand
- *
- *  "b" [ DATA ] - optional subtractand
- *
- * SYNOPSIS:
- *  incorporates "k" into expression for every row
- *  returns sum or difference of inputs for all rows
- *
- * USAGE:
- *  length of half-closed interval
- *    U32 len = < U32 > diff ( stop, start );
- *  convert one-based coordinate to zero based
- *    U32 zero_based = < U32 > diff < 1 > ( one_based );
- */
-function < type T >
-T sum #1.0 < * T k > ( T a, ... )
-    = vdb:sum;
-
-function < type T >
-T diff #1.0 < * T k > ( T a * T b )
-    = vdb:diff;
-
-/* deriv
- *  return the 1st derivative of an input row
- * integral
- *  return the integral of an input row
- *   integral   -> starts with 1st value
- *   integral_0 -> starts with 0
- *
- *  "T" [ TYPE ] - input and output data type
- *  must be signed integer of any size
- *
- *  "in" [ DATA ] - input to be modified
- *
- * SYNOPSIS:
- *  Takes/restores chained deltas of integer elements in a row
- *  Fist element is unmodified
- */
-
-function < type T > T deriv #1.0  ( T in ) = vdb:deriv;
-function < type T > T integral #1.0  ( T in ) = vdb:integral;
-function < type T > T integral_0 #1.0  ( T in ) = vdb:integral_0;
-
-/* delta
- *  return the 1st derivative of a whole blob
- * undelta
- *  return the integral of a whole blob
- *
- *  "T" [ TYPE ] - input and output data type
- *  must be signed integer of any size
- *
- *  "in" [ DATA ] - input to be modified
- *
- * SYNOPSIS:
- *  similar to deriv/integral but operates on full blob
- */
-
-function < type T > T delta #1.0  ( T in ) = vdb:delta;
-function < type T > T undelta #1.0  ( T in ) = vdb:undelta;
-
-
-/* outlier_encode
- *  removes a given outlier from a data series
- * outlier_decode
- *  removes the effect of outlier_encode
- *
- *  "T" [ TYPE ] - input and output data type
- *  must be an integer of any size
- *
- *  "in" [ DATA ] - input to be modified
- *
- * SYNOPSIS:
- *  The encode replaces every element that is equal to the
- *  outlier with (the value of the previous element) * 2 + 1
- *  and the remaining elements are replaced with their value * 2.
- */
-
-function < type T > T outlier_encode #1.0 < T outlier > ( T in ) = vdb:outlier_encode;
-function < type T > T outlier_decode #1.0 < T outlier > ( T in ) = vdb:outlier_decode;
-
-/* add_row_id
- *  return the sum of an input and its row-id
- * sub_row_id
- *  return the difference of an input and its row-id
- *
- *  "T" [ TYPE ] - input and output data type
- *  must be member of numeric_set
- *
- *  "in" [ DATA ] - input to be modified
- *
- * SYNOPSIS:
- *  adjusts for relationship between input and row-id
- *  used primarily to reduce serial ids to constants
- */
-function < type T >
-T add_row_id #1.0 ( T in )
-    = vdb:add_row_id;
-
-function < type T >
-T sub_row_id #1.0 ( T in )
-    = vdb:sub_row_id;
-
-
-/* cut
- *  extract one or more elements from input vector
- *  to form an output vector of equal or less dimension
- *
- *  "T" [ TYPE ] - base element type to be processed
- *
- *  "idx" [ CONST ] - mandatory initial element index
- *  count of parameters must equal dimension of output type
- *
- *  "in" [ DATA ] - source of input vectors where the vector
- *  element type is known, but any dimension is accepted.
- *
- * USAGE:
- *  extracting a single channel from a 4 channel vector
- *    F32 [ 4 ] vect ...
- *    F32 chan = < F32 > cut < 0 > ( vect );
- *
- *  extracting multiple channels
- *    U8 [ 16 ] in ...
- *    U8 [ 3 ] out = < U8 > cut < 5, 1, 3 > ( in );
- *
- *  reversing channels
- *    I16 [ 2 ] norm ...
- *    I16 [ 2 ] rev = < I16 > cut < 1, 0 > ( norm );
- */
-function < type T >
-T [ * ] cut #1.0 < U32 idx, ... > ( T [ * ] in )
-    = vdb:cut;
-
-
-/* paste
- *  combine all elements of all inputs into a single vector
- *  output dimension is sum of all input dimensions after type normalization
- *
- *  "T" [ TYPE ] - base element type to be processed
- *
- *  "in" [ DATA ] - first of an arbitrary number of columns
- *  the total of input elements produces an output of "T [ total ]"
- */
-function < type T >
-T [ * ] paste #1.0 ( T [ * ] in, ... )
-    = vdb:paste;
-
-
-/* vec_sum
- *  compute the sum of all the elements of the row
- *
- *  "T" [ TYPE ] - base element type to be processed
- *
- *  "in" [ DATA ] - the input
- */
-function < type T >
-T vec_sum #1.0 ( T [ * ] in )
-    = vdb:vec_sum;
-
-/* vec_sum
- *  compute the sum of all the elements of the input vector
- *
- *  "T" [ TYPE ] - base element type to be processed
- *
- *  "in" [ DATA ] - the input
- */
-function < type T >
-T fixed_vec_sum #1.0 ( T [ * ] in )
-    = vdb:fixed_vec_sum;
-
-
-/* checksum
- *  compute a checksum ( hash ) of all of the input bytes
- *  to be used in a trigger production
- *
- *  "node" [ CONST ] - path to metadata node where checksum
- *   will be stored.
- *
- *  "algorithm" [ CONST ] - type of checksum to perform:
- *    'crc-32'  # match against POSIX cksum
- *    'md5'     #  "   "  md5sum
- *    'sha-1'   #  "   "  sha1sum
- *    'sha-256' #  "   "  sha256sum
- *    'sha-384' #  "   "  sha384sum
- *    'sha-512' #  "   "  sha512sum
- *
- *  "in" [ DATA ] - the octet-stream to be checksummed
- */
-function
-bool checksum #1.0 < ascii node, ascii algorithm > ( B8 in )
-    = vdb:checksum;
-
-/* md5sum
- *  compute an md5 checksum of all of the input bytes
- */
-function
-bool md5sum #1.0 < ascii node > ( B8 in )
-{
-    return checksum < node, 'md5' > ( in );
-}
-
-
-/* pack
- *  packs words into bit-aligned units
- *  words are expected in architecture native byte-order
- *  and returned in "big-bit-endian" order
- *
- *  the packed size is determined by the dimension of the
- *  left-hand assignment value.
- *
- *  "in" [ DATA ] - B8, B16, B32 or B64 data
- */
-function
-B1 [ * ] pack #1.0 ( pack_set in )
-    = vdb:pack;
-
-
-/* unpack
- *  unpacks bit-aligned units into words
- *  input is expected in "big-bit-endian" order
- *  and returned in architecture native byte-order
- *
- *  the unpacked type is determined from the left-hand
- *  assignment value.
- *
- *  "in" [ DATA ] - B[1]..B[64]
- */
-function
-pack_set unpack #1.0 ( B1 [ * ] in )
-    = vdb:unpack;
-
-
-/* izip
- * iunzip
- *  integer compression
- */
-function
-izip_fmt izip #2.1 ( izip_set in )
-    = vdb:izip;
-
-function
-izip_set iunzip #2.1 ( izip_fmt in )
-    = vdb:iunzip;
-
-physical < type T >
-T izip_encoding #1.0
-{
-    decode { return ( T ) iunzip ( @ ); }
-    encode { return izip ( @ ); }
-};
-
-
-/* fzip
- * funzip
- *  floating point compression
- *
- *  "mantissa" [ CONST ] - the number of mantissa bits
- *  to preserve
- */
-function
-fzip_fmt fzip #1.0 < U32 mantissa > ( fzip_set in )
-    = vdb:fzip;
-
-function
-fzip_set funzip #1.0 ( fzip_fmt in )
-    = vdb:funzip;
-
-physical < type T >
-T fzip_encoding #1.0 < U32 mantissa >
-{
-    decode { return funzip ( @ ); }
-    encode { return fzip < mantissa > ( @ ); }
-};
-
-
-/* rlencode
- * rldecode
- *  run-length encoding
- */
-function
-rle_fmt rlencode #1.0 ( any in )
-    = vdb:rlencode;
-
-function
-any rldecode #1.0 ( rle_fmt in )
-    = vdb:rldecode;
-
-
-/* zip
- * unzip
- *  run things through zlib
- *
- *  "strategy" [ CONST, OPTIONAL ] - set the compression strategy
- *
- *  "level" [ CONST, OPTIONAL ] - set the amount of compression
- *  from 0..9 ( none to best compression ), or use -1 for zlib
- *  default behavior.
- */
-
-// zlib strategy
-const I32 Z_FILTERED            =  1;
-const I32 Z_HUFFMAN_ONLY        =  2;
-const I32 Z_RLE                 =  3;
-const I32 Z_DEFAULT_STRATEGY    =  0;
-
-// zlib level
-const I32 Z_NO_COMPRESSION      =  0;
-const I32 Z_BEST_SPEED          =  1;
-const I32 Z_BEST_COMPRESSION    =  9;
-const I32 Z_DEFAULT_COMPRESSION = -1;
-
-function
-zlib_fmt zip #1.0 < * I32 strategy, I32 level > ( any in )
-    = vdb:zip;
-
-function
-any unzip #1.0 ( zlib_fmt in )
-    = vdb:unzip;
-
-physical < type T >
-T zip_encoding #1.0 < * I32 strategy, I32 level >
-{
-    decode { return unzip ( @ ); }
-    encode { return zip < strategy, level > ( @ ); }
-};
-
-physical
-bool bool_encoding #1.0
-{
-    decode
-    {
-        B1 bit = unzip ( @ );
-        return ( bool ) unpack ( bit );
-    }
-
-    encode
-    {
-        U8 lim = < U8 > clip < 0, 1 > ( @ );
-        B1 bit = pack ( lim );
-        return zip < Z_RLE, Z_BEST_SPEED > ( bit );
-    }
-}
-
-physical < type T >
-T delta_izip_encoding #1.0
-{
-    decode
-    {
-        T dlt = iunzip ( @ );
-        return < T > undelta ( dlt );
-    }
-
-    encode
-    {
-        T dlt = <T> delta ( @ );
-        return izip ( dlt );
-    }
-}
-physical < type T >
-T delta_zip_encoding #1.0
-{
-    decode
-    {
-        T dlt = unzip ( @ );
-        return < T > undelta ( dlt );
-    }
-
-    encode
-    {
-        T dlt = <T> delta ( @ );
-        return zip < Z_RLE, Z_BEST_SPEED > ( dlt );
-    }
-}
-physical < type T >
-T delta_average_zip_encoding #1.0
-{
-    decode
-    {
-        delta_averaged_fmt t = unzip ( @ );
-        return undelta_average ( t );
-    }
-
-    encode
-    {
-        delta_averaged_fmt t = delta_average ( @ );
-        return zip < Z_RLE, Z_BEST_SPEED > ( t );
-    }
-}
-
-/* bzip
- * bunzip
- *  run things through bzip2
- *
- *  "blockSize100k" [ CONST, OPTIONAL ] - set the compression workspace size
- *  from 1..9 inclusive, produces a workspace of blockSize100K * 100000 bytes
- *  default is 5
- *
- *  "workFactor" [ CONST, OPTIONAL ] - set compression level
- *  from 0..250 inclusive, where 0 means bzip2 default, currently 30
- */
-
-function
-bzip2_fmt bzip #1.0 < * U32 blockSize100k, U32 workFactor > ( any in )
-    = vdb:bzip;
-
-function
-any bunzip #1.0 ( bzip2_fmt in )
-    = vdb:bunzip;
-
-physical < type T >
-T bzip_encoding #1.0 < * U32 blockSize100k, U32 workFactor >
-{
-    decode { return bunzip ( @ ); }
-    encode { return bzip < blockSize100k, workFactor > ( @ ); }
-};
-
-
-/* simple_sub_select
- *  project a column from another table within database
- *
- *  "T" [ TYPE ] - data type of column
- *   must be compatible with source column
- *
- *  "tbl" [ CONST ] - name of table within parent
- *
- *  "col" [ CONST ] - column spec, i.e. simple name or
- *   typed name spec
- *
- *  "row" [ DATA ] - row to select
- *
- *  "idx" [ DATA ] - one-based indexing of what element to pick, defaults to all if not given
- */
-function < type T >
-T simple_sub_select #1.0 < ascii tbl, ascii col > ( I64 row *  I32 idx )
-    = vdb:simple_sub_select_1;
-
-
-/* extract_token
- *  extract a textual token from an input string
- *
- *  "idx" [ CONST ] - a zero-based index of the token
- *  if value < row_len ( tok ), then the substring of
- *  indexed token is returned. otherwise, returns empty.
- *
- *  "str" [ DATA ] - input text. type must be compatible with
- *  output production, meaning types must be same, or ascii input
- *  with utf8 output.
- *
- *  "tok" [ DATA ] - results of tokenizing "str"
- */
-function
-text_set extract_token #1.0 < U32 idx > ( text_set str, text:token tok )
-    = vdb:extract_token;
-
-
-/* strtonum
- *  convert string to number
- *
- *  "radix" [ CONST, DEFAULT 10 ]
- *   if not specified, or if given as 0, the default will be 10
- *   unless the string begins with "0x" or "0X", in which case radix will be 16
- *   octal is NOT inferred ( i.e. leading "0" does not imply octal )
- *
- *  "str" [ DATA ] - text to be converted
- */
-function
-numeric_set strtonum #1.0 < * U32 radix > ( text_set str )
-    = vdb:strtonum;
-
-
-/* sprintf
- *  formatted print to a string
- *
- *  formatting rules differ somewhat from C sprintf:
- *
- *        '%' [ <flags> ] [ <field-width> ] [ '.' <precision> ] [ ':' <index> ] <storage-class>
- *
- *  where:
- *
- *    flags
- *        = ' '           : prepend space to a numeral if it does not have a sign
- *        | '+'           : always produce a sign on numeric conversion
- *        | '-'           : left-align parameter within field
- *        | '0'           : left-pad with zeroes rather than spaces
- *        | '#'           : use "alternate" representation
- *        | ','           : produce comma-separated triples
- *        ;
- *
- *    field-width
- *        = DECIMAL       : a base-10 numeral
- *        | '*'           : take field width from args
- *        ;
- *
- *    precision
- *        = DECIMAL       : a base-10 numeral
- *        | '*'           : take precision from args
- *        |               : an empty precision means 0
- *        ;
- *
- *    index
- *        = idx           : a single, zero-based vector element
- *        | idx '-' idx   : a fully-closed, zero-based interval
- *        | idx '/' len   : a start index plus length
- *        ;
- *
- *    idx
- *        = DECIMAL       : an unsigned base-10 numeral
- *        | '*'           : take index from args
- *        | '$'           : last element in cell
- *        |               : an empty index means 0 or $
- *        ;
- *
- *    len
- *        = DECIMAL       : a base-10 numeral
- *        | '*'           : take length from args
- *        | '$'           : row-length of ( cell )
- *        |               : an empty length means $
- *        ;
- *
- *
- *    storage-class
- *        = 'd' | 'i'     : general decimal integer
- *        | 'u'           : decimal unsigned integer
- *        | 'x'           : lower-case hex
- *        | 'X'           : upper-case hex
- *        | 'o'           : octal
- *        | 'b'           : binary
- *        | 'f'           : floating point
- *        | 'e'           : scientific notation
- *        | 'g'           : general floating point
- *        | 'c' | 's'     : character
- *        ;
- *
- *
- *  "fmt" [ CONST ] - constant format string, adhering to
- *  the description above
- *
- *  "p1" [ DATA ] - first param
- *  this and any subsequent params must correspond to format
- *  in type/position/number.
- */
-function
-text_set sprintf #1.0 < ascii fmt > ( any p1, ... )
-    = vdb:sprintf;
diff --git a/interfaces/vdb/xform.h b/interfaces/vdb/xform.h
deleted file mode 100644
index 5e1cea1..0000000
--- a/interfaces/vdb/xform.h
+++ /dev/null
@@ -1,824 +0,0 @@
-/*=======================================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_vdb_xform_
-#define _h_vdb_xform_
-
-#ifndef _h_vdb_extern_
-#include <vdb/extern.h>
-#endif
-
-#ifndef _h_vdb_schema_
-#include <vdb/schema.h>
-#endif
-
-#include <stdarg.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KDataBuffer;
-struct VCursorParams;
-
-/*--------------------------------------------------------------------------
- * VFormatdecl
- */
-typedef struct VFormatdecl VFormatdecl;
-struct VFormatdecl
-{
-    VTypedecl td;
-    uint32_t fmt;
-};
-
-
-/* Resolve
- *  converts a fmtdecl string to fmt id, type id and vector dimension
- *
- *  "resolved" [ OUT ] - resolved fmtdecl
- *
- *  "fmtdecl" [ IN ] - type declaration
- */
-VDB_EXTERN rc_t CC VSchemaResolveFmtdecl ( struct VSchema const *self,
-    VFormatdecl *resolved, const char *fmtdecl, ... );
-VDB_EXTERN rc_t CC VSchemaVResolveFmtdecl ( struct VSchema const *self,
-    VFormatdecl *resolved, const char *fmtdecl, va_list args );
-
-
-/* ToText
- *  convert a VFormatdecl into canonical text
- *
- *  "schema" [ IN ] - schema object that would know about this type
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - output buffer for
- *  NUL terminated type declaration string
- */
-VDB_EXTERN rc_t CC VFormatdeclToText ( const VFormatdecl *self,
-    struct VSchema const *schema, char *buffer, size_t bsize );
-
-
-/* ToFormatdecl
- *  attempt to cast a fmtdecl to a size-equivalent ancestor decl
- *
- *  "schema" [ IN ] - schema object that would know about this type
- *
- *  "ancestor" [ IN ] - target fmtdecl or typespec for cast
- *
- *  "cast" [ OUT, NULL OKAY ] - return parameter for ancestor decl
- *  valid only if function returns true. if "ancestor" contained a typeset,
- *  the value of "cast" will be the closest matching ancestral type.
- *
- *  "distances" [ OUT, NULL OKAY ] - optional linear measure of independent
- *  casting generations for format ( 0 ) and type ( 1 ). valid only if function
- *  returns true. a value of 0 means that "self" is a direct match with "ancestor",
- *  a value of 1 means that "self" is an immediate subtype of "ancestor", etc.
- *
- *  returns true if cast succeeded
- */
-VDB_EXTERN bool CC VFormatdeclToFormatdecl ( const VFormatdecl *self,
-    const VSchema *schema, const VFormatdecl *ancestor,
-    VFormatdecl *cast, uint32_t distances [ 2 ] );
-
-
-/*--------------------------------------------------------------------------
- * VBlobHeader
- *  opaque blob header
- *  used by external functions to read and populate blob headers
- */
-typedef struct VBlobHeader VBlobHeader;
-
-
-/* Release
- *  used to release forked headers
- */
-VDB_EXTERN rc_t CC VBlobHeaderRelease ( const VBlobHeader *self );
-
-
-/* Version
- *  returns previously written blob format version
- */
-VDB_EXTERN uint8_t CC VBlobHeaderVersion ( const VBlobHeader *self );
-VDB_EXTERN void CC VBlobHeaderSetVersion ( VBlobHeader *self, uint8_t version );
-
-
-/* OpPushTail
- * OpPopHead
- * OpPopTail
- *  op-code stack interface
- *
- *  functions that apply encoding to a blob may use this stack to
- *  record one or more "op-codes" that may be useful to decoders
- *  when used in combination with the argument (operand) stack.
- *
- *  the op-code values and significance is entirely defined by the
- *  external functions, and their use is optional (a trivial example
- *  is described below in the argument stack comment).
- *
- *  during update operations, the stack may be pushed as well as popped.
- *  during read-only operations, only pop is permitted.
- */
-VDB_EXTERN rc_t CC VBlobHeaderOpPushTail ( VBlobHeader *self, uint8_t op );
-VDB_EXTERN rc_t CC VBlobHeaderOpPopHead ( const VBlobHeader *self, uint8_t *op );
-VDB_EXTERN rc_t CC VBlobHeaderOpPopTail ( const VBlobHeader *self, uint8_t *op );
-
-
-/* ArgPushTail
- * ArgPopHead
- * ArgPopTail
- *  argument (operand) stack interface
- *
- *  provides arguments to accompany encoding and decoding operations,
- *  where the operation may be implicit or indicated via a related
- *  op-code.
- *
- *  here is a trivial example for a hypothetical function that performs
- *  bit-packing on a series of signed integers. it has two possible
- *  operations: translation and pack. it translates the values by subtracting
- *  the MIN(x) value, converting the sequence into unsigned values starting
- *  at 0. pack will left-truncate bits if the translated MAX(x) can be represented
- *  with fewer bits than in use:
- *
- *    1. calculate min/max
- *    2. if MIN(x) != 0
- *       2a. ArgPushTail ( MIN ( x ) )
- *       2b. OpPushTail ( TRANSLATE-OPCODE ) # e.g. 1
- *       2c. translate sequence by - min
- *       2d. translate MAX ( x )
- *    3. calculate bits required for MAX(x)
- *    4. if bits-required < bits-used
- *       4a. ArgPushTail ( bits-required )
- *       4b. OpPushTail ( PACK-OPCODE )      # e.g. 2
- *       4c. pack sequence
- *
- *  on decode, the process would be reversed:
- *
- *    1. OpPopTail ( & op-code )
- *    2. if op-code == PACK-OPCODE
- *       2a. ArgPopTail ( & packed-bits )
- *       2b. unpack sequence from packed-bits to current size
- *       2c. OpPopTail ( & op-code )
- *    3. if op-code == TRANSLATE-OPCODE
- *       3a. ArgPopTail ( & offset )
- *       3b. translate sequence by + offset
- *
- *  during update operations, the stack may be pushed as well as popped.
- *  during read-only operations, only pop is permitted.
- */
-VDB_EXTERN rc_t CC VBlobHeaderArgPushTail ( VBlobHeader *self, int64_t arg );
-VDB_EXTERN rc_t CC VBlobHeaderArgPopHead ( const VBlobHeader *self, int64_t *arg );
-VDB_EXTERN rc_t CC VBlobHeaderArgPopTail ( const VBlobHeader *self, int64_t *arg );
-
-
-/* CreateFork
- *  create a parallel, writable blob header
- *
- *  blob headers are designed to record operations and arguments
- *  that are serially applied to data. some functions may need to
- *  run operations in parallel ( e.g. compresion ) where each fork
- *  is allowed to compete for best performance.
- *
- *  this function creates an alternate, parallel header object that
- *  may be used to replace the actual headers associated with the blob.
- *
- * NB - returned object must ALWAYS be released before exiting function
- */
-VDB_EXTERN rc_t CC VBlobHeaderCreateFork ( const VBlobHeader *self, VBlobHeader **rslt );
-
-
-/*==========================================================================
- * transformation functions
- *
- *  transformation functions are declared in schema and provided in
- *  dynamically loadable shared libraries. the types described in the
- *  following section will be used during data processing.
- */
-
-
-/* VFormatdesc
- *  combines VFormatdecl and VTypedesc
- */
-typedef struct VFormatdesc VFormatdesc;
-struct VFormatdesc
-{
-    VFormatdecl fd;
-    VTypedesc desc;
-};
-
-
-/* XformInfo
- *  constant input parameter block
- *
- *  "mgr" [ IN ] - db mgr object
- *
- *  "schema" [ IN ] - cursor schema
- *
- *  "tbl" [ IN ] - owning table. can be used
- *   to access enclosing database
- */
-#define VTABLE_PASSED_TO_XFORM 1
-#define VPRODUCTION_PASSED_TO_XFORM 1
-
-struct VProduction;
-typedef struct VXformInfo VXformInfo;
-struct VXformInfo
-{
-#if VMGR_PASSED_TO_XFORM
-    struct VDBManager const *mgr;
-#endif
-#if VSCHEMA_PASSED_TO_XFORM
-    struct VSchema const *schema;
-#endif
-#if VTABLE_PASSED_TO_XFORM
-    struct VTable const *tbl;
-#endif
-#if VPRODUCTION_PASSED_TO_XFORM
-    struct VProduction const *prod;
-#endif
-    VFormatdesc fdesc;
-};
-
-
-/* VRowData
- *  row function input block
- *
- *  "base" [ IN ] and "first_elem" [ IN ] - first element in row
- *  i.e. for any row of type "T", "( ( const T* ) base ) [ first_elem ]"
- *  is the first element.
- *
- *  "elem_count" [ IN ] - the number of elements in this row
- *
- *  "element_bits" [ IN ] - the number of bits in each element
- *
- *  "variant" [ IN ] - describes variant of union "u"
- */
-typedef uint8_t VRowDataVariant;
-enum { vrdData, vrdControl };
-
-typedef struct VRowData VRowData;
-struct VRowData
-{
-    union
-    {
-        struct
-        {
-            /* the number of elements in this row */
-            uint64_t elem_count;
-
-            /* element size in bits */
-            uint64_t elem_bits;
-
-            /* page data base address plus
-               offset to first element of row */
-            uint64_t first_elem;
-            const void *base;
-
-        } data;
-
-    } u;
-
-    /* describes variant of "u" */
-    VRowDataVariant variant;
-};
-
-
-/* VRowResult
- *  row function output block
- *
- *  for functions that operate on a single row of input
- *  but generate an output of independent length.
- *
- *  "data" [ IN/OUT ] - externally allocated data buffer
- *  may be resized or replaced, and must be checked for
- *  adequate capacity before writing.
- *
- *  "elem_count" [ OUT, DEFAULT ZERO ] - return parameter for
- *  the number of elements in result
- *
- *  "elem_bits" [ IN ] - element size in bits
- *
- *  "no_cache" [ OUT, DEFAULT ZERO ] - to indicate whether this result is
- *  cache-able
- */
-typedef struct VRowResult VRowResult;
-struct VRowResult
-{
-    /* return slot for number of elements written */
-    uint64_t elem_count;
-
-    /* size of elements in bits */
-    uint64_t elem_bits;
-
-    /* externally allocated data buffer
-       NB - must be checked for storage capacity before writing */
-    struct KDataBuffer *data;
-    
-    uint8_t no_cache;
-};
-
-
-/* VFixedRowResult
- *  fixed row function output block
- *
- *  for functions that operate on a single row of input
- *  and generate an output row of the same length.
- *
- *  NB. These functions are considered to be deterministic.
- *
- *  "base" [ IN ] and "first_element" [ IN ] - first element in row
- *  i.e. for any row of type "T", "( ( const T* ) base ) [ row_start ]"
- *  is the first element.
- *
- *  "elem_count" [ IN ] - fixed length of output row
- *
- *  "elem_bits" [ IN ] - element size in bits
- */
-typedef struct VFixedRowResult VFixedRowResult;
-struct VFixedRowResult
-{
-    /* fixed row length */
-    uint64_t elem_count;
-
-    /* size of elements in bits */
-    uint64_t elem_bits;
-
-    /* externally allocated buffer of fixed length */
-    uint64_t first_elem;
-    void *base;
-};
-
-
-/* VByteOrder
- *  single byte indicator of byte order
- *
- *  "vboNone" - data are byte order independent
- *
- *  "vboNative" - data are in native byte order
- *
- *  "vboLittleEndian" - specific byte orders
- *  "vboBigEndian"
- */
-typedef uint8_t VByteOrder;
-enum
-{
-    vboNone,
-    vboNative,
-    vboLittleEndian,
-    vboBigEndian
-};
-
-
-/* VBlobData
- *  blob function input block
- *
- *  describes entire blob of input without row boundaries
- *  the size of the blob in bits will be "elem_count" * "elem_bits"
- *
- *  "data" [ IN ] - pointer to first byte in blob
- *
- *  "elem_count" [ IN ] - the number of elements in blob
- *
- *  "elem_bits" [ IN ] - element size in bits
- *
- *  "byte_order" [ IN ] - byte order of input data
- */
-typedef struct VBlobData VBlobData;
-struct VBlobData
-{
-    /* element size in bits */
-    uint64_t elem_bits;
-
-    /* blob data buffer */
-    uint64_t elem_count;
-    const void *data;
-
-    /* byte order of data */
-    VByteOrder byte_order;
-};
-
-
-/* VBlobResult
- *  blob function output block
- *
- *  describes entire blob of output without row boundaries
- *
- *  "header" [ OUT, NULL OKAY ] - optional return parameter
- *  for substituted header when encoding
- *
- *  "data" [ IN ] - pointer to output buffer
- *
- *  "elem_count" [ IN/OUT ] - the maximum number
- *  of elements in blob ( at the current elem_bits )
- *
- *  "elem_bits" [ IN/OUT ] - element size in bits
- *
- *  "byte_order" [ IN/OUT ] - byte order of input data
- */
-typedef struct VBlobResult VBlobResult;
-struct VBlobResult
-{
-    /* element size in bits */
-    uint64_t elem_bits;
-
-    /* blob data buffer */
-    uint64_t elem_count;
-    void *data;
-
-    /* optional replacement header */
-    VBlobHeader *header;
-
-    /* byte order of data */
-    VByteOrder byte_order;
-};
-
-
-/* VBlobFunc
- *  functions that create blobs from a single input
- *
- *  "info" [ IN ] - runtime objects and information
- *
- *  "dst" [ IN ] - return parameter block
- *
- *  "src" [ IN ] - single input parameter
- *
- *  "hdr" [ IN ] - blob header belonging to either the "src"
- *  or "dst" blob depending upon activity. when encoding, "hdr"
- *  pertains to the "dst" blob, and should be populated with
- *  information needed when decoding, when "hdr" will pertain
- *  to "src".
- *
- *  return values:
- *    0 for no error
- *    RC ( *, rcFunction, rcExecuting, rcBuffer, rcInsufficient )
- *      when output buffer is insufficient. this condition is an
- *      error on decompression, but not on compress. on compress,
- *      the size of input buffer == size of output buffer. if no
- *      compression is possible, the library will store data as is.
- *    RC ( *, rcFunction, rcExecuting, *, * )
- *      general errors have this RC format, where your module
- *      and proper object and state defines are substituted.
- */
-typedef rc_t ( CC * VBlobFunc ) ( void *self, const VXformInfo *info,
-    VBlobResult *dst, const VBlobData *src, VBlobHeader *hdr );
-
-
-/* VArrayFunc
- *  functions that perform element-wise transforms
- *
- *  "info" [ IN ] - runtime objects and information
- *
- *  "dst" [ IN ] - return buffer
- *
- *  "src" [ IN ] - input buffer
- *
- *  "elem_count" [ IN ] - the number of elements
- *  in both input and output
- */
-typedef rc_t ( CC * VArrayFunc ) ( void *self, const VXformInfo *info,
-    void *dst, const void *src, uint64_t elem_count );
-
-
-/* VNonDetRowFunc
- *  functions that operate on a single row of input data
- *  and produce a single row of output data, where the
- *  number of elements in the output row is unrelated to
- *  the number of elements of input.
- *  NB. these functions are considered non-deterministic.
- *
- *  "info" [ IN ] - runtime objects and information
- *
- *  "row_id" [ IN ] - specific row id being processed
- *
- *  "rslt" [ IN ] - return parameter block
- *
- *  "argc" [ IN ] and "argv" [ IN ] - zero or more input
- *  parameter blocks
- */
-typedef rc_t ( CC * VNonDetRowFunc ) ( void *self,
-    const VXformInfo *info, int64_t row_id, VRowResult *rslt,
-    uint32_t argc, const VRowData argv [] );
-
-
-/* VRowFunc
- *  functions that operate on a single row of input data
- *  and produce a single row of output data, where the
- *  number of elements in the output row is unrelated to
- *  the number of elements of input.  The results are
- *  cached.
- *
- *  "info" [ IN ] - runtime objects and information
- *
- *  "row_id" [ IN ] - specific starting row id being processed
- *
- *  "rslt" [ IN ] - return parameter block
- *
- *  "argc" [ IN ] and "argv" [ IN ] - zero or more input
- *  parameter blocks
- */
-typedef rc_t ( CC * VRowFunc ) ( void *self,
-     const VXformInfo *info, int64_t row_id, VRowResult *rslt,
-     uint32_t argc, const VRowData argv [] );
-
-    
-/* VFixedRowFunc
- *  functions that operate on a single row of input data
- *  and produce a single row of output data, where the
- *  number of elements in the output row is known to be
- *  equal to the number of elements of input.
- *
- *  "info" [ IN ] - runtime objects and information
- *
- *  "row_id" [ IN ] - specific row id being processed
- *
- *  "rslt" [ IN ] - return parameter block
- *
- *  "argc" [ IN ] and "argv" [ IN ] - zero or more input
- *  parameter blocks
- */
-typedef rc_t ( CC * VFixedRowFunc ) ( void *self,
-    const VXformInfo *info, int64_t row_id, const VFixedRowResult *rslt,
-    uint32_t argc, const VRowData argv [] );
-
-
-
-/*==========================================================================
- * factory functions
- *
- *  factory functions are declared in schema - normally implicitly but
- *  sometimes explicitly - and provided in dynamically loadable shared
- *  libraries. the types described in the following section will be used
- *  during cursor open to generate optimized code for data processing.
- */
-
-
-/* XfactInfo
- *  constant input parameter block
- *  holds references to managers and container hierarchy
- *  as well as transform return type information
- *
- *  "mgr" [ IN ] - db mgr object
- *
- *  "dt" [ IN ] - type system mgr
- *
- *  "tbl" [ IN ] - owning table. can be used
- *   to access enclosing database
- *
- *  "desc" [ IN ] - description of return data type
- */
-typedef struct VXfactInfo VXfactInfo;
-struct VXfactInfo
-{
-    struct VDBManager const *mgr;
-    struct VSchema const *schema;
-    struct VTable const *tbl;
-    struct VCursorParams const *parms;
-    VFormatdesc fdesc;
-};
-
-
-/* VFactoryParams
- *  block of parameters to be evaluated by factory
- *  used to "templatize" runtime function
- *
- *  "argc" [ IN ] and "argv" [ IN, DYNAMIC ] - variable
- *  length array of input parameter description blocks:
- *
- *    "desc" [ IN ] - type descriptor tells data domain
- *    and size information for a single element of input
- *
- *    "count" [ IN ] - gives the dimensionality of
- *    data vector.
- *
- *    "data" [ IN, UNION ] - array of input elements
- *    selected by "desc.domain" and "desc.intrinsic_bits"
- */
-typedef struct VFactoryParams VFactoryParams;
-struct VFactoryParams
-{
-    uint32_t argc;
-    uint32_t align;
-
-    struct
-    {
-        /* describes constant element,
-           i.e. sizeof ( arg typedecl ) */
-        VTypedesc desc;
-
-        /* describes length of param vector:
-           bool, numeric: count of [ elem, elem, ... ]
-           utf8: number of bytes
-           other text: number of characters */
-        uint32_t count;
-
-        union
-        {
-            /* boolean */
-            const bool *b;
-
-            /* integer */
-            const int8_t *i8;
-            const int16_t *i16;
-            const int32_t *i32;
-            const int64_t *i64;
-
-            /* unsigned integer */
-            const uint8_t *u8;
-            const uint16_t *u16;
-            const uint32_t *u32;
-            const uint64_t *u64;
-
-            /* floating point */
-            const float *f32;
-            const double *f64;
-
-            /* ascii */
-            const char *ascii;
-
-            /* unicode */
-            const char *utf8;
-            const uint16_t *utf16;
-            const uint32_t *utf32;
-
-            /* missing function pointer */
-
-        } data;
-
-    } argv [ 16 ];
-};
-
-
-/* FunctionParams
- *  block of parameter typedecls to be evaluated by factory
- *  used to "templatize" runtime function
- *
- *  "argc" [ IN ] and "argv" [ IN, DYNAMIC ] - description
- *  of runtime parameters. actual dimension is given by "argc"
- */
-typedef struct VFunctionParams VFunctionParams;
-struct VFunctionParams
-{
-    uint32_t argc;
-    uint32_t align;
-    VFormatdesc argv [ 16 ];
-};
-
-
-/* FuncDesc
- *  parameter block for describing runtime function
- *  guaranteed to be zeroed on input
- *
- *  "self"  [ OUT, OPAQUE ] - optional object or
- *  data pointer for function.
- *
- *  "whack" [ OUT, NULL OKAY ] - optional destructor
- *  called with "self" when function is released
- *
- *  "u" [ OUT ] - several variants of function
- *
- *  "variant" [ OUT ] - selects variant of "u"
- */
-typedef uint32_t VFuncType;
-enum
-{
-    vftInvalid,
-    vftReserved,
-    vftRow,
-    vftIdDepRow, /*** function dependent on row_id ***/
-    vftFixedRow,
-    vftNonDetRow,
-    vftArray,
-    vftBlob
-};
-
-typedef struct VFuncDesc VFuncDesc;
-struct VFuncDesc
-{
-    /* object and optional destructor */
-    void *self;
-    void ( CC * whack ) ( void *self );
-    
-    /* runtime function */
-    union
-    {
-        VRowFunc rf;
-        VNonDetRowFunc ndf;
-        VFixedRowFunc pf;
-        VArrayFunc af;
-        VBlobFunc bf;
-    } u;
-    
-    VFuncType variant;
-};
-
-
-/* TransformFactory
- *  unified typedef for row, page and blob transformation function factories
- *
- *  "self" [ IN, OPAQUE ] - NULL or const object pointer
- *  value registered with the manager
- *
- *  "info" [ IN ] - managers and table for the column,
- *  plus column type information
- *
- *  "rslt" [ IN ] - return value parameter block for resolved function
- *
- *  "cp" [ IN ] - constant template parameters
- *
- *  "dp" [ IN ] - type information for runtime parameters
- */
-typedef
-rc_t ( CC * VTransformFactory ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp );
-
-
-/* VTransDesc
- *  describes a transform factory
- */
-typedef struct VTransDesc VTransDesc;
-struct VTransDesc
-{
-    /* opaque factory data object */
-    void *fself;
-    void ( CC * whack ) ( void *fself );
-
-    /* factory entrypoint */
-    VTransformFactory factory;
-
-    /* interface version */
-    uint32_t itf_version;
-};
-
-#define VTRANSVERS( maj, min, rel ) \
-    ( ( ( maj ) << 24 ) | ( ( min ) << 16 ) | ( rel ) )
-
-/* actual factory function implementation name */
-#define VTRANSFACT_NAME( fact ) \
-    fact ## _fact
-
-/* exported factory name */
-#define VTRANSFACT_DECL( fact ) \
-    rc_t CC fact ( VTransDesc *desc )
-
-/* factory declaration with no self parameter */
-#define VTRANSFACT_IMPL( fact, maj, min, rel ) \
-    VTRANSFACT_IMPL_SELF( fact, maj, min, rel, NULL )
-
-/* factory declaration with static or constant self parameter */
-#define VTRANSFACT_IMPL_SELF( fact, maj, min, rel, self ) \
-    static rc_t CC VTRANSFACT_NAME ( fact ) ( const void*, \
-        const VXfactInfo*, VFuncDesc*, const VFactoryParams*, const VFunctionParams* ); \
-    rc_t CC fact ( VTransDesc *desc ) \
-    { \
-        desc -> fself = ( self ); \
-        desc -> whack = NULL; \
-        desc -> factory = VTRANSFACT_NAME ( fact ); \
-        desc -> itf_version = VTRANSVERS ( maj, min, rel ); \
-        return 0; \
-    } \
-    static rc_t CC VTRANSFACT_NAME ( fact )
-
-/* factory declaration with dynamically allocated self parameter */
-#define VTRANSFACT_IMPL_CONSTRUCT( fact, maj, min, rel, construct, destroy ) \
-    static rc_t CC VTRANSFACT_NAME ( fact ) ( const void*, \
-        const VXfactInfo*, VFuncDesc*, const VFactoryParams*, const VFunctionParams* ); \
-    rc_t CC fact ( VTransDesc *desc ) \
-    { \
-        desc -> whack = ( destroy ); \
-        desc -> factory = VTRANSFACT_NAME ( fact ); \
-        desc -> itf_version = VTRANSVERS ( maj, min, rel ); \
-        return construct ( & desc -> fself ); \
-    } \
-    static rc_t CC VTRANSFACT_NAME ( fact )
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_vdb_xform_ */
diff --git a/interfaces/vfs/extern.h b/interfaces/vfs/extern.h
deleted file mode 100644
index fd1731a..0000000
--- a/interfaces/vfs/extern.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_vfs_extern_
-#define _h_vfs_extern_
-
-#if ! defined EXPORT_LATCH && defined _LIBRARY
-#define VFS_EXTERN LIB_EXPORT
-#define VFS_EXTERN_DATA extern LIB_EXPORT
-#define EXPORT_LATCH 1
-#else
-#define VFS_EXTERN LIB_IMPORT
-#ifdef __cplusplus
-#define VFS_EXTERN_DATA extern /* LIB_IMPORT_DATA */
-#else
-#define VFS_EXTERN_DATA LIB_IMPORT_DATA
-#endif
-#endif
-
-#ifndef _h_klib_extern_
-#include <klib/extern.h>
-#endif
-
-#endif /* _h_vfs_extern_ */
diff --git a/interfaces/vfs/manager-priv.h b/interfaces/vfs/manager-priv.h
deleted file mode 100644
index 9046572..0000000
--- a/interfaces/vfs/manager-priv.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifndef _h_vfs_manager_priv_
-#define _h_vfs_manager_priv_
-
-#ifndef _h_vfs_extern_
-#include <vfs/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-
-#ifndef _h_kfs_defs_
-#include <kfs/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct VFSManager;
-struct KDirectory;
-struct KFile;
-struct VPath;
-struct SRAPath;
-struct KConfig;
-
-/* this resembles the interface functions in manager.h
- * but allows the use of a KDirectory for the base instead of a VPath
- * of a directory
- *
- * this is expected to be more temporary if this code base continues.
- * much longer
- */
-VFS_EXTERN rc_t CC VFSManagerResolvePathRelativeDir (const struct VFSManager * self,
-                                                     uint32_t flags,
-                                                     const struct  KDirectory * base_dir,
-                                                     const struct  VPath * in_path,
-                                                     struct VPath ** out_path);
-
-
-
-/* bad interface.  Bad! Bad!
- * but needed to hack VFS into KDB
- * MORE THAN BAD. REFLECTS A TOTAL MISUNDERSTANDING OF FS.
- */
-VFS_EXTERN rc_t CC VFSManagerOpenFileReadDirectoryRelative (const struct VFSManager *self, 
-    const struct KDirectory * dir, struct KFile const **f, const struct VPath * path);
-
-VFS_EXTERN rc_t CC VFSManagerOpenFileReadDirectoryRelativeDecrypt (const struct VFSManager *self, 
-    const struct KDirectory * dir, struct KFile const **f, const struct VPath * path);
-
-VFS_EXTERN rc_t CC VFSManagerOpenDirectoryReadDirectoryRelative ( const struct VFSManager *self,
-    struct KDirectory const * dir, struct KDirectory const **d, const struct VPath * path );
-
-VFS_EXTERN rc_t CC VFSManagerOpenDirectoryReadDirectoryRelativeDecrypt ( const struct VFSManager *self,
-    struct KDirectory const * dir, struct KDirectory const **d, const struct VPath * path );
-
-VFS_EXTERN rc_t CC VFSManagerOpenDirectoryUpdateDirectoryRelative ( const struct VFSManager *self,
-    struct KDirectory const * dir, struct KDirectory **d, const struct VPath * path );
-
-#define VPathMakeDirectoryRelative LegacyVPathMakeDirectoryRelative
-VFS_EXTERN rc_t CC VPathMakeDirectoryRelative ( struct VPath ** new_path,
-    struct KDirectory const * dir, const char * posix_path);
-
-
-VFS_EXTERN rc_t CC VFSManagerOpenFileReadDecrypt (const struct VFSManager *self,
-                                                  struct KFile const **f,
-                                                  const struct VPath * path);
-
-
-/*
- * quick hack for vdb-validate for immediate testing release
- */
-VFS_EXTERN rc_t CC VFSManagerWGAValidateHack (const struct VFSManager * self, 
-                                              const struct KFile * file,
-                                              const char * path); /* we'll move this to a vpath */
-
-/*
- * Access to VFSManager's instance of configuration object, for testing purposes
- */
-VFS_EXTERN const struct KConfig* CC VFSManagerGetConfig(const struct VFSManager * self);
-
-/* Make using a custom KConfig
- */
-VFS_EXTERN rc_t CC VFSManagerMakeFromKfg ( struct VFSManager ** pmanager,
-    struct KConfig * cfg );
-
-/*
- * Set/get pathname of the object_id/object_name bindings file (used for testing; should go away when the functionality
- *  is rolled into KeyRing server)
- * Set to NULL to use the default location ("~/.ncbi/objid.mapping")
- */
-VFS_EXTERN void VFSManagerSetBindingsFile(struct VFSManager * self, const char* path);
-VFS_EXTERN const char* VFSManagerGetBindingsFile(struct VFSManager * self);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_vfs_manager_priv_ */
diff --git a/interfaces/vfs/manager.h b/interfaces/vfs/manager.h
deleted file mode 100644
index f7e19ae..0000000
--- a/interfaces/vfs/manager.h
+++ /dev/null
@@ -1,319 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifndef _h_vfs_manager_
-#define _h_vfs_manager_
-
-#ifndef _h_vfs_extern_
-#include <vfs/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-
-#ifndef _h_kfs_defs_
-#include <kfs/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KFile;
-struct VPath;
-struct VResolver;
-struct KDirectory;
-struct KNSManager;
-struct VPath;
-
-/* temporary */
-
-
-/*--------------------------------------------------------------------------
- * VFSManager
- */
-typedef struct VFSManager VFSManager;
-
-#define VFS_KRYPTO_PASSWORD_MAX_SIZE 4096
-
-
-/* AddRef
- * Release
- *  ignores NULL references
- */
-VFS_EXTERN rc_t CC VFSManagerAddRef ( const VFSManager *self );
-VFS_EXTERN rc_t CC VFSManagerRelease ( const VFSManager *self );
-
-/* OpenFileRead
- *  opens an existing file with read-only access
- *
- *  "f" [ OUT ] - return parameter for newly opened file
- *
- *  "path" [ IN ] VPath representing the path, URL or URN of the desired file
- */
-VFS_EXTERN rc_t CC VFSManagerOpenFileRead (const VFSManager *self, 
-                                           struct KFile const **f,
-                                           const struct VPath * path);
-
-VFS_EXTERN rc_t CC VFSManagerOpenDirectoryRead ( const VFSManager *self,
-    struct KDirectory const **d, const struct VPath * path );
-
-/* it forces decryption to be used for kdb */
-VFS_EXTERN rc_t CC VFSManagerOpenDirectoryReadDecrypt ( const VFSManager *self,
-    struct KDirectory const **d, const struct VPath * path );
-
-VFS_EXTERN rc_t CC VFSManagerOpenDirectoryUpdate ( const VFSManager *self,
-    struct KDirectory **d, const struct VPath * path );
-
-
-/* OpenFileWrite
- *  opens an existing file with write access
- *
- *  "f" [ OUT ] - return parameter for newly opened file
- *
- *  "update" [ IN ] - if true, open in read/write mode
- *  otherwise, open in write-only mode
- *
- *  "path" [ IN ] VPath representing the path, URL or URN of the desired file
- */
-VFS_EXTERN rc_t CC VFSManagerOpenFileWrite (const VFSManager *self,
-                                            struct KFile **f,
-                                            bool update,
-                                            const struct VPath * path);
-
-/* CreateFile
- *  opens a file with write access
- *
- *  "f" [ OUT ] - return parameter for newly opened file
- *
- *  "update" [ IN ] - if true, open in read/write mode
- *  otherwise, open in write-only mode
- *
- *  "access" [ IN ] - standard Unix access mode, e.g. 0664
- *
- *  "mode" [ IN ] - a creation mode ( see explanation above ).
- *
- *  "path" [ IN ] VPath representing the path, URL or URN of the desired file
- */
-VFS_EXTERN rc_t CC VFSManagerCreateFile (const VFSManager *self, 
-                                         struct KFile **f,
-                                         bool update, uint32_t access,
-                                         KCreateMode mode,
-                                         const struct VPath * path );
-
-
-/* Remove
- *  remove an accessible object from its directory
- *
- *  "force" [ IN ] - if true and target is a directory,
- *  remove recursively
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- */
-VFS_EXTERN rc_t CC VFSManagerRemove (const VFSManager *self, bool force,
-                                     const struct VPath * path );
-
-
-/* Make
- */
-VFS_EXTERN rc_t CC VFSManagerMake ( VFSManager ** pmanager );
-
-/* GetCWD
- */
-VFS_EXTERN rc_t CC VFSManagerGetCWD (const VFSManager * self, struct KDirectory ** cwd);
-
-VFS_EXTERN rc_t CC VFSManagerGetResolver ( const VFSManager * self, struct VResolver ** resolver );
-
-VFS_EXTERN rc_t CC VFSManagerGetKNSMgr ( const VFSManager * self, struct KNSManager ** kns );
-
-
-VFS_EXTERN rc_t CC VFSManagerGetKryptoPassword (const VFSManager * self, char * new_password, size_t max_size, size_t * size);
-
-/*
-  NULL value for self
-  RC (rcVFS, rcEncryptionKey, rcUpdating, rcSelf, rcNull);
-
-  NULL value for password or 0 value for size
-  RC (rcVFS, rcEncryptionKey, rcUpdating, rcParam, rcNull);
-
-  size greater than VFS_KRYPTO_PASSWORD_MAX_SIZE
-  RC (rcVFS, rcEncryptionKey, rcUpdating, rcSize, rcExcessive);
-
-  illegal CR or LF (NL) in the password
-  RC (rcVFS, rcEncryptionKey, rcUpdating, rcEncryptionKey, rcInvalid);
-
-  path/file name for password too long for function as written
-  RC (rcVFS, rcEncryptionKey, rcUpdating, rcPath, rcExcessive);
-
-  existing password path/file name is not a file
-  RC (rcVFS, rcEncryptionKey, rcUpdating, rcPath, rcIncorrect);
-
-  unknown file type for configured path/file name
-  RC (rcVFS, rcEncryptionKey, rcUpdating, rcPath, rcCorrupt);
-
-  incomplete writes to temporary password file
-  RC (rcVFS, rcEncryptionKey, rcWriting, rcFile, rcInsufficient);
-
-  other errors from KFS and KLIB
-*/
-
-/* pwd_dir[pwd_dir_size] -
-    Output parameters for path to directory containing the password file.
-    pwd_dir is not updated if pwd_dir == NULL or pwd_dir_size == 0
-                  or pwd_dir_size is insufficient to copy the path
- */
-VFS_EXTERN rc_t CC VFSManagerUpdateKryptoPassword (const VFSManager * self, 
-                                                   const char * password,
-                                                   size_t size,
-                                                   char * pwd_dir,
-                                                   size_t pwd_dir_size);
-
-
-VFS_EXTERN rc_t CC VFSManagerResolveSpec ( const VFSManager * self,
-                                           const char * spec,
-                                           struct VPath ** path_to_build,
-                                           const struct KFile ** remote_file,
-                                           const struct VPath ** local_cache,
-                                           bool resolve_acc );
-
-struct KDirectory;
-
-VFS_EXTERN rc_t CC VFSManagerResolveSpecIntoDir ( const VFSManager * self,
-                                                  const char * spec,
-                                                  const struct KDirectory ** dir,
-                                                  bool resolve_acc );
-
-/*--------------------------------------------------------------------------
- * KConfig
- *  placing some KConfig code that relies upon VFS here
- */
-struct KConfig;
-struct KConfigNode;
-
-/* ReadVPath
- *  read a VPath node value
- *
- * self [ IN ] - KConfig object
- * path [ IN ] - path to the node
- * result [ OUT ] - return value (rc != 0 if cannot be converted)
- *
- */
-VFS_EXTERN rc_t CC KConfigReadVPath ( struct KConfig const* self, const char* path, struct VPath** result );
-
-/* ReadVPath
- *  read a VPath node value
- *
- * self [ IN ] - KConfigNode object
- * result [ OUT ] - return value (rc != 0 if cannot be converted)
- *
- */
-VFS_EXTERN rc_t CC KConfigNodeReadVPath ( struct KConfigNode const *self, struct VPath** result );
-
-/* ResolvePath
- *
- * take a VPath and resolve to a final form apropriate for KDB
- *
- * that is take a relative path and resolve it against the CWD
- * or take an accession and resolve into the local or remote 
- * VResolver file based on config. It is just a single resolution percall
- *
- * flags
- *      can disable all Accession resolution
- *      can let VPath With no scheme be treated as a possible accession
- *
- */
-
-/* bit values for flags */
-    /* allow no local accession resolution */
-#define vfsmgr_rflag_no_acc_local (1<<0)
-    /* allow no remote accession resolution */
-#define vfsmgr_rflag_no_acc_remote (1<<1)
-    /* never do VResolver Accession resolution */
-#define vfsmgr_rflag_no_acc  (vfsmgr_rflag_no_acc_local|vfsmgr_rflag_no_acc_remote)
-    /* use VResolver Accession resolution for simple names with no scheme */
-
-#define vfsmgr_rflag_kdb_acc (1<<2)
-    /* over ridden by vfsmgr_rflag_no_acc */
-
-
-VFS_EXTERN rc_t CC VFSManagerResolvePath (const VFSManager * self,
-                                          uint32_t flags,
-                                          const struct  VPath * in_path,
-                                          struct VPath ** out_path);
-
-VFS_EXTERN rc_t CC VFSManagerResolvePathRelative (const VFSManager * self,
-                                                  uint32_t flags,
-                                                  const struct  VPath * base_path,
-                                                  const struct  VPath * in_path,
-                                                  struct VPath ** out_path);
-
-/*
- * Registering bindings between dbGaP object Ids and object names
- */                                                  
-
-/* VFSManagerRegisterObject
- *  registers a binding between an object Id and an object name (object = accession or dbGaP file) 
- * 
- * self [ IN ] - VFSManager object
- * oid [ IN ] - object id
- * obj [ IN ] - Vpath representing the object's name (scheme is "ncbi-acc" for accessions, "ncbi-file" for dbGaP files; 
- *              the name itself is the 'path' component
- */
-VFS_EXTERN rc_t CC VFSManagerRegisterObject(struct VFSManager* self, uint32_t oid, const struct VPath* obj);
-
-/* VFSManagerGetObjectId
- *  look up an object id by an object name 
- * 
- * self [ IN ] - VFSManager object
- * obj [ IN ] - Vpath representing the object's name (scheme is "ncbi-acc" for accessions, "ncbi-file" for dbGaP files; 
- *              the name itself is the 'path' component
- * oid [ OUT ] - object id
- */
-VFS_EXTERN rc_t CC VFSManagerGetObjectId(const struct VFSManager* self, const struct VPath* obj, uint32_t* oid);
-
-/* VFSManagerGetObject
- *  look up an object name by an object id
- * 
- * self [ IN ] - VFSManager object
- * oid [ IN ] - object id
- * obj [ OUT ] - Vpath representing the object's name (scheme is "ncbi-acc" for accessions, "ncbi-file" for dbGaP files; 
- *              the name itself is the 'path' component
- */
-VFS_EXTERN rc_t CC VFSManagerGetObject(const struct VFSManager* self, uint32_t oid, struct VPath** obj);
-
-
-                                                  
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_manager_ */
diff --git a/interfaces/vfs/path-priv.h b/interfaces/vfs/path-priv.h
deleted file mode 100644
index 66c3fb3..0000000
--- a/interfaces/vfs/path-priv.h
+++ /dev/null
@@ -1,266 +0,0 @@
-/*===========================================================================
-*
-*                            Public Domain Notice
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_vfs_path_priv_
-#define _h_vfs_path_priv_
-
-#ifndef _h_vfs_extern_
-#include <vfs/extern.h>
-#endif
-
-#ifndef _h_vfs_path_
-#include <vfs/path.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct String;
-
-
-#define NCBI_FILE_SCHEME       "ncbi-file"
-#define NCBI_ACCESSION_SCHEME  "ncbi-acc"
-#define HTTP_SCHEME            "http"
-#define FTP_SCHEME             "ftp"
-#define FASP_SCHEME            "fasp"
-#define NCBI_LEGREFSEQ_SCHEME  "x-ncbi-legrefseq"
-#define NCBI_OBJECT_SCHEME     "ncbi-obj"
-
-/* options for a VPath possibly obtained from a query string on an URI */
-typedef uint32_t VPOption_t;
-enum eVPOption_t
-{
-    vpopt_encrypted,
-    vpopt_pwpath,
-    vpopt_pwfd,
-    vpopt_readgroup,
-#if 0    
-    vpopt_temporary_pw_hack,
-#endif    
-    vpopt_vdb_ctx,
-    vpopt_gap_ticket, 
-    vpopt_count
-};
-
-
-/* =====
- * Much of what follows is expected to move into the interface vfs/path.h
- * once it becomes supported.
- */
-
-/* MakeFmt
- *  make a path object from a format string plus arguments
- *
- *  "new_path" [ OUT ] - a reference to the new object.
- *
- *  "fmt" [ IN ] and "args" [ IN ] - arguments to string_printf
- *  ( see <klib/text.h> ) to build a NUL-terminated string
- *  that conforms with the rules for "posix_path"
- *
- * NB - SECURITY RISK IF USED DIRECTLY FROM EXTERNAL STRINGS.
- *      ALSO, FMT IS **NOT** PRINTF COMPATIBLE - see string_printf.
- */
-
-#if 0
-VFS_EXTERN rc_t CC VPathMakeRelative ( VPath ** new_path, const VPath * base_path,
-                                       const char * relative_path );
-VFS_EXTERN rc_t CC VPathMakeRelativeFmt ( VPath ** new_path, const VPath * base_path,
-                                          const char * fmt, ... );
-VFS_EXTERN rc_t CC VPathVMakeRelativeFmt ( VPath ** new_path, const VPath * base_path,
-                                           const char * fmt, va_list args );
-VFS_EXTERN rc_t CC VPathMakeCurrentPath ( VPath ** new_path );
-
-VFS_EXTERN rc_t CC VPathMakeURI ( VPath ** new_path, const char * uri );
-#endif
-
-
-/* Option
- *  rc == 0 if the option has been specified
- *  for options with a parameter, the value of the parameter is copied to buffer
- */
-VFS_EXTERN rc_t CC VPathOption ( const VPath * self, VPOption_t option,
-                                char * buffer, size_t buffer_size,
-                                size_t * num_read);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_vfs_path_priv_ */
-
-/*--------------------------------------------------------------------------
- *
- * The ABNF form described in RFC5234 will be used to define URLS and paths
- * with some handwaving instead of complete character definitions for case 
- * insensitivity.  CORE definitions from RFC5234 will be used again handwaving
- * case insensitivity.
- *
- * --------------------
- *
- * URL for a VPath
- *
- *  as per RFC 3986, an URI consists of:
- *
- *    URI           = scheme ":" heir-part [ "?" query ] [ "#" fragment ]
- *
- *  We will support however something intbetween an URI and an IRI in that we'll
- *  all UTF-8 rather than limit certain characters to ASCII.
- *
- *  For the NCBI path  URL:  The hier-part is intended to be compatible with the 
- *                    "file:" scheme  Authority on any of the Unix-like operating
- *                    systems must either be empty or "localhost".  For Windows
- *                    it must  be a host that can be used if the "file" url is
- *                    translated into a UNC style Windows path.  Also in a
- *                    Windows vfs: URL a single colon ':' will be allowed only at
- *                    the end of a single character rive letter for the first
- *                    sub-part of the path.
- *
- *    scheme        = "ncbi-file" ; ( case insensitive )
- *
- *    hier-part     = "//" authority path-abempty
- *                  / path-absolute
- *                  / path-relative
- *                  / path-empty
- *
- * by RFC 3986 authority is
- *    authority     = [ userinfo "@" ] host [ ":" port]
- * but at this point we only recognize
- *    authority     = host
- *
- * by RFC 3986 host is
- *    host          = IP-literal / IPv4address / reg-name
- * but at this point we only recognize
- *    host          = reg-name
- *
- *    reg-name      = *( unreserved / pct-encoded / sub-delims )
- *
- *    path          = path-abempty
- *                  / path-absolute
- *                  / path-noscheme
- *                  / path-rootless
- *                  / path-empty
- *
- *    path-abempty  = * ( "/" segment )
- *
- *    path-absolute = "/" segment-nz *( "/" segment )
- *
- *    path-noscheme = segment-nz-nc *( "/" segment )
- *
- *    path-rootless = segment-nz *( "/" segment )
- *
- *    path-empty    = ""
- *
- *    segment       = *pchar       ; can be empty
- *    segment-nz    = 1*pchar      ; can't be empty
- *    segment-nz-nc = 1*pchar-nz   ; can't be empty
- *
- *    pchar         = ":" / pchar-nc
- *
- *    pchar-nc      = unreserved / pct-encoded / sub-delims ? "@"
- *
- *    pct-encoded   = "%" HEXDIG HEXDIG ; hex digits are 0-9, a-f or A-F
- *
- *    authority   = "localhost" / host-name ; the host name is an O/S specific 
- *                                          ; name of a remote host 
- *
- *    query       = query_entry [ * ( "&" query_entry ) ]
- *
- *    query_entry = "encrypt" / "enc" / ( "pwfile=" hier-part ) / ( "pwfd=" fd )
- *
- *    fd          = 1* DIGIT
- *
- *    unreserved  = ALPHA / DIGIT / "-" / "." / "_" / "~" / UTF-8
- *
- *    reserved    = gen-delims / subdelims
- *
- *    gen-delims  = ":" / "/" / "?" / "#" / "[" / "]" / "@"
- *
- *    sub-delims  = "!" / "$" / "&" / "'" / "(" / ")" / "*"
- *                / "+" / "," / ";" / "="
- *
- * Handwaving on the UTF-8.  We'll accept it rather than requiring percent encoding
- * in most cases.
-
- * Examples:
- *         "ncbi-file://home/my-name/data-files"
- *         "ncbi-file://win-server/archive/secure/read12345?encrypted"
- *         "ncbi-file:///c:/scanned-data/0001/file.sra?enc?pwd-file=c:/Users/JamesMcCoy/ncbi.pwd"
- *
- *  We allow an implied scheme of "vfs" if none present.
- *  'host-name' is partially implemented for Windows.  Not currently for any the
- *  of the supported Unix systems.  We do not support IP addresses instead of 
- *  host names.
- *
- *  'path' can be either absolute or relative and must be posix style as per 
- *  RFC 3986 and matches the "file" scheme.
- *
- *  'fragment' is not yet implemented or defined.
- *
- *  'fd' is a system specific file handle.  Not yet supported on Windows.
- *
- * --------------------
- *
- * VFS posix_path representation:
- *
- * The internal representation of a path for VFS resembles very closely the
- * POSIX pathname crossed with the Windows UNC path.  Only the Unix "/" 
- * separator is allowed not the "\" for paths.
- *
- * posix-path     = full-path / relative-path
- *
- * full-path      = ["//" host] "/" [ directory-path "/" ] resource
- *
- * relative-path  = [ directory-path "/" ] resource
- *
- * directory-path = resource [ "/" directory-path ]
- *
- * resource       = string ; (UTF-8 O/S specific name for a directory or a file)
- *
- * host           = string ; (UTF-8 O/S specific name for the local or remote host)
- *
- * For a host "localhost" is a synonym for the current host.
- * The "//host" is not guaranteed to work for all systems except "//localhost"
- *
- * The resource "." is assumed to mean the local directory and will be stripped
- * when a path is made canonical.
- *
- * The resource ".." is assumed to mean the containing directory and when made 
- * canonical it will be left in at the begining for relative paths or removed along 
- * with the preceding resource name.
- *
- * For Windows the device is handled in a unique way with some potential for ambiguity.
- * The UNC approach for a named drive "C:" becomes "/c".  So "C:\" becomes "/c/".
- *
- * In the future the complex approach from the "file:" URL should be adopted 
- * with the ":" allowed only in the first directory name in a path.  RFC 3986 
- * notes though that this complex approach puts some five variants into the ABNF
- * to describe the path portion of an URL.
- */
diff --git a/interfaces/vfs/path.h b/interfaces/vfs/path.h
deleted file mode 100644
index 70d81cf..0000000
--- a/interfaces/vfs/path.h
+++ /dev/null
@@ -1,253 +0,0 @@
-/*===========================================================================
-*
-*                            Public Domain Notice
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_vfs_path_
-#define _h_vfs_path_
-
-#ifndef _h_vfs_extern_
-#include <vfs/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#include <stdarg.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct String;
-struct VFSManager;
-
-
-/*--------------------------------------------------------------------------
- * VPath
- *  represents an unbound object query key
- *  may be created from a simple file-system path,
- *  a more formal URN or URL,
- *  or other modes of creation
- *
- *  a path will have these parts:
- *    scheme       : a scheme for retrieval
- *    auth         : login name for authentication
- *    host         : authoritative source
- *    port         : port for connecting with host
- *    path         : host-relative path
- *    query        : parameters for interpretation
- *    fragment     : internal component of object
- *    proj         : project id
- *    name         : alternate or primary name
- *
- *  file-system paths with no modifying parameters
- *  will be given standard "file" scheme. paths having
- *  parameters will be given the scheme "ncbi-file".
- *
- *  standard networking schemes ( "http", "ftp", etc. )
- *  are supported.
- *
- *  NCBI accessions are given the scheme "ncbi-acc".
- *
- *  NCBI remote object id paths receive scheme "ncbi-obj".
- */
-typedef struct VPath VPath;
-
-
-/* MakePath
- *  make a path object from a string conforming to
- *  either a standard POSIX path or a URI
- *
- *  "new_path" [ OUT ] - return parameter for new path object
- *
- *  "path_str" [ IN ] - a UTF-8 NUL-terminated string
- *  representing a POSIX path or URI, or
- *  a string_printf compatible format string
- *
- *  "path_fmt" [ IN ] and "args" [ IN ] - a UTF-8 NUL-terminated fmt string
- *  compatible with string_vprintf, plus argument list
- *
- *  Examples:
- *      "ncbi-file:/home/my-name/data-files"
- *      "ncbi-file://win-server/archive/secure/read12345?encrypted"
- *      "ncbi-file:///c/scanned-data/0001/file.sra?enc&pwfile=/c/Users/JamesMcCoy/ncbi.pwd"
- */
-VFS_EXTERN rc_t CC VFSManagerMakePath ( struct VFSManager const * self,
-    VPath ** new_path, const char * path_str, ... );
-VFS_EXTERN rc_t CC VFSManagerVMakePath ( struct VFSManager const * self,
-    VPath ** new_path, const char * path_fmt, va_list args );
-
-
-/* MakeSysPath
- *  make a path object from an OS native filesystem path string
- *
- *  "new_path" [ OUT ] - return parameter for new path object
- *
- *  "sys_path" [ IN ] - a UTF-8 NUL-terminated string
- *  representing a native filesystem path
- *
- *  "wide_sys_path" [ IN ] - a wide NUL-terminated string
- *  representing a native filesystem path, where
- *  wchar_t is either USC-2 or UTF-32 depending upon libraries
- */
-VFS_EXTERN rc_t CC VFSManagerMakeSysPath ( struct VFSManager const * self,
-    VPath ** new_path, const char * sys_path );
-VFS_EXTERN rc_t CC VFSManagerWMakeSysPath ( struct VFSManager const * self,
-    VPath ** new_path, const wchar_t * wide_sys_path );
-
-
-/* MakeAccPath - TEMPORARY
- *  takes a textual accession representation
- *  creates a VPath representing an accession
- *
- *  "new_path" [ OUT ] - return parameter for new path object
- *
- *  "acc" [ IN ] - a NUL-terminated ASCII fmt string
- */
-VFS_EXTERN rc_t CC VFSManagerMakeAccPath ( struct VFSManager const * self,
-    VPath ** new_path, const char * acc, ... );
-VFS_EXTERN rc_t CC VFSManagerVMakeAccPath ( struct VFSManager const * self,
-    VPath ** new_path, const char * fmt, va_list args );
-
-
-/* MakeOidPath - TEMPORARY
- *  takes an integer oid
- *  creates a VPath representing an obj-id
- *
- *  "new_path" [ OUT ] - return parameter for new path object
- *
- *  "oid" [ IN ] - a non-zero object id
- */
-VFS_EXTERN rc_t CC VFSManagerMakeOidPath ( struct VFSManager const * self,
-    VPath ** new_path, uint32_t oid );
-
-
-/* AddRef
- * Release
- *  ignores NULL references
- */
-VFS_EXTERN rc_t CC VPathAddRef ( const VPath *self );
-VFS_EXTERN rc_t CC VPathRelease ( const VPath *self );
-
-
-/* IsFSCompatible
- *  asks if the path can be used with the OS' filesystems
- */
-VFS_EXTERN bool CC VPathIsFSCompatible ( const VPath * self );
-
-
-/* FromUri
- *  asks if the path was created from a formal URI
- */
-VFS_EXTERN bool CC VPathFromUri ( const VPath * self );
-
-
-/* Read*
- *  read the various parts
- *  copies out data into user-supplied buffer
- *
- *  "buffer" [ OUT ] and "buffer_size" [ IN ] - output buffer
- *  for data read. if sufficient space is available, the copy
- *  will be NUL-terminated.
- *
- *  "num_read" [ OUT, NULL OKAY ] - optional return parameter
- *  for the number of valid bytes in "buffer" after a successful
- *  read. on failure due to insufficient buffer, contains the
- *  number of bytes required for transfer.
- */
-VFS_EXTERN rc_t CC VPathReadUri ( const VPath * self,
-    char * buffer, size_t buffer_size, size_t * num_read );
-VFS_EXTERN rc_t CC VPathReadScheme ( const VPath * self,
-    char * buffer, size_t buffer_size, size_t * num_read );
-VFS_EXTERN rc_t CC VPathReadAuth ( const VPath * self,
-    char * buffer, size_t buffer_size, size_t * num_read );
-VFS_EXTERN rc_t CC VPathReadHost ( const VPath * self,
-    char * buffer, size_t buffer_size, size_t * num_read );
-VFS_EXTERN rc_t CC VPathReadPortName ( const VPath * self,
-    char * buffer, size_t buffer_size, size_t * num_read );
-VFS_EXTERN rc_t CC VPathReadPath ( const VPath * self,
-    char * buffer, size_t buffer_size, size_t * num_read );
-VFS_EXTERN rc_t CC VPathReadQuery ( const VPath * self,
-    char * buffer, size_t buffer_size, size_t * num_read );
-VFS_EXTERN rc_t CC VPathReadParam ( const VPath * self, const char * param,
-    char * buffer, size_t buffer_size, size_t * num_read );
-VFS_EXTERN rc_t CC VPathReadFragment ( const VPath * self,
-    char * buffer, size_t buffer_size, size_t * num_read );
-
-
-/* MakeUri
- *  convert a VPath into a URI
- */
-VFS_EXTERN rc_t CC VPathMakeUri ( const VPath * self,
-    struct String const ** uri );
-
-
-/* MakeString
- *  convert a VPath into a String
- *  respects original source of path,
- *  i.e. does not add scheme unnecessarily
- */
-VFS_EXTERN rc_t CC VPathMakeString ( const VPath * self,
-    struct String const ** str );
-
-
-/* Get*
- *  retrieves internal parts
- *  returns pointers to internal String data
- *  Strings remain valid while "self" is valid
- */
-VFS_EXTERN rc_t CC VPathGetScheme ( const VPath * self, struct String * str );
-VFS_EXTERN rc_t CC VPathGetAuth ( const VPath * self, struct String * str );
-VFS_EXTERN rc_t CC VPathGetHost ( const VPath * self, struct String * str );
-VFS_EXTERN rc_t CC VPathGetPortName ( const VPath * self, struct String * str );
-VFS_EXTERN uint16_t CC VPathGetPortNum ( const VPath * self );
-VFS_EXTERN rc_t CC VPathGetPath ( const VPath * self, struct String * str );
-VFS_EXTERN rc_t CC VPathGetQuery ( const VPath * self, struct String * str );
-VFS_EXTERN rc_t CC VPathGetParam ( const VPath * self, const char * param, struct String * str );
-VFS_EXTERN rc_t CC VPathGetFragment ( const VPath * self, struct String * str );
-/* TEMPORARY */
-VFS_EXTERN uint32_t CC VPathGetOid ( const VPath * self );
-
-/* legacy support */
-#define VPathMake LegacyVPathMake
-VFS_EXTERN rc_t VPathMake ( VPath ** new_path, const char * posix_path );
-#define VPathMakeFmt LegacyVPathMakeFmt
-rc_t VPathMakeFmt ( VPath ** new_path, const char * fmt, ... );
-#define VPathMakeVFmt LegacyVPathMakeVFmt
-rc_t VPathMakeVFmt ( VPath ** new_path, const char * fmt, va_list args );
-#define VPathMakeSysPath LegacyVPathMakeSysPath
-VFS_EXTERN rc_t VPathMakeSysPath ( VPath ** new_path, const char * sys_path );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_vfs_path_ */
diff --git a/interfaces/vfs/resolver.h b/interfaces/vfs/resolver.h
deleted file mode 100644
index 46024d5..0000000
--- a/interfaces/vfs/resolver.h
+++ /dev/null
@@ -1,263 +0,0 @@
-/*===========================================================================
-*
-*                            Public Domain Notice
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_vfs_resolver_
-#define _h_vfs_resolver_
-
-#ifndef _h_vfs_extern_
-#include <vfs/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KFile;
-struct VPath;
-struct KConfig;
-struct KRepository;
-struct VFSManager;
-
-
-/*--------------------------------------------------------------------------
- * VResolver
- */
-typedef struct VResolver VResolver;
-
-
-/* Make
- *  ask the VFS manager to make a resolver
- */
-VFS_EXTERN rc_t CC VFSManagerMakeResolver ( struct VFSManager const * self,
-    VResolver ** new_resolver, struct KConfig const * cfg );
-VFS_EXTERN rc_t CC KRepositoryMakeResolver ( struct KRepository const * self,
-    VResolver ** new_resolver, struct KConfig const * cfg );
-
-
-/* AddRef
- * Release
- */
-VFS_EXTERN rc_t CC VResolverAddRef ( const VResolver * self );
-VFS_EXTERN rc_t CC VResolverRelease ( const VResolver * self );
-
-
-/* Accepted protocol list ordered by preference */
-typedef uint32_t VRemoteProtocols;
-enum
-{
-      eProtocolHttp
-    , eProtocolFasp
-    , eProtocolFaspHttp
-    , eProtocolHttpFasp
-    , eProtocolLastDefined
-};
-
-
-/* Query
- *  resolve object location to either an existing local path,
- *  or a pair of remote URL + local cache location.
- *
- *  "protocols" [ IN ] - the desired protocols for remote resolution
- *
- *  "query" [ IN ] - a path that can represent:
- *     accession : a recognizable accession from NCBI or known organization
- *     obj-id    : a dbGaP object id
- *     name      : a dbGaP filename
- *     path      : a filesystem path
- *     url       : a remote location
- *
- *  "local" [ OUT, NULL OKAY ] - optional return parameter for local path:
- *     accession : resolve to local user or site path
- *     obj-id    : resolve to local user protected path
- *     name      : resolve to local user protected path
- *     url       : set to NULL
- *
- *  "remote" [ OUT, NULL OKAY ] - optional return parameter for remote path:
- *     accession : resolve to URL
- *     obj-id    : resolve to URL
- *     name      : resolve to URL
- *     url       : set to duplicate
- *
- *  "cache" [ OUT, NULL OKAY ] - optional return parameter for cache path:
- *     accession : resolve to user cache path
- *     obj-id    : resolve to user cache path
- *     path      : set to NULL
- *     url       : resolve to user cache path
- *
- *  any of the output parameters may be NULL, but not all, i.e. there
- *  must be at least one non-NULL return parameter.
- *
- *  if you DON'T want local resolution, pass NULL for "local" and
- *  the query will be resolved remotely. if you don't want remote
- *  resolution, pass NULL for "remote".
- *
- *  a query that is resolved locally will always return NULL for
- *  "remote" and "cache", if the parameters are provided.
- */
-VFS_EXTERN rc_t CC VResolverQuery ( const VResolver * self,
-    VRemoteProtocols protocols, struct VPath const * query,
-    struct VPath const ** local, struct VPath const ** remote,
-    struct VPath const ** cache );
-
-
-/* Local - DEPRECATED
- *  Find an existing local file/directory that is named by the accession.
- *  rcState of rcNotFound means it does not exist.
- *
- *  other rc code for failure are possible.
- *
- *  Accession must be an ncbi-acc scheme or a simple name with no 
- *  directory paths.
- */
-VFS_EXTERN rc_t CC VResolverLocal ( const VResolver * self,
-    struct VPath const * accession, struct VPath const ** path );
-
-
-/* Remote - DEPRECATED
- *  Find an existing remote file that is named by the accession.
- *
- *  rcState of rcNotFound means it did not exist and can not be 
- *  downloaded. Probably a bad accession name.
- *
- *  Need a specific rc for no network configured.
- *  Need a specific rc for network access permitted.
- *
- *  Other rc code for failure are possible.
- *
- *  Accession must be an ncbi-acc scheme or a simple name with no 
- *  directory paths.
- *
- */
-VFS_EXTERN rc_t CC VResolverRemote ( const VResolver * self,
-    VRemoteProtocols protocols, struct VPath const * accession,
-    struct VPath const ** path /* , struct KFile const ** opt_file_rtn */ );
-
-/* Cache - DEPRECATED
- *  Find a cache directory that might or might not contain a partially
- *  downloaded file.
- *
- *  Accession must be an ncbi-acc scheme, an http url or a simple name with no 
- *  directory paths. All three should return the same directory URL as a VPath. (?)
- *  Or should it be a directory or a file url depending upon finding a partial
- *  download? This would require co-ordination with all download mechanisms that
- *  we permit.
- *
- *  With refseq holding wgs objects we have a case were the downloaded file is not
- *  named the same as the original accession as the file archive you want is a
- *  container for other files.
- *
- *  Find local will give a path that has a special scheme in these cases. 
- *  Find remote will give the url for the container that contains the accession
- *  so using the returned VPath from resolve remote is better than the original
- *  accession in this one case.  I think...
- */
-VFS_EXTERN rc_t CC VResolverCache ( const VResolver * self,
-    struct VPath const * url, struct VPath const ** path, uint64_t file_size );
-
-
-/* EnableState
- *  modifies how the various properties are interpreted
- */
-typedef uint32_t VResolverEnableState;
-enum
-{
-    vrUseConfig = 0,            /* take enable/disable state from KConfig */
-    vrAlwaysEnable = 1,         /* always enable, regardless of KConfig   */
-    vrAlwaysDisable = 2         /* always disable, regardless of KConfig  */
-};
-
-
-/* LocalEnable
- *  modify settings for using local repositories,
- *  meaning site, user-public and user-protected.
- *
- *  "enable" [ IN ] - enable or disable local access,
- *  or follow settings in KConfig
- *
- *  returns the previous state of "remote-enabled" property
- *
- * NB - in VDB-2, the state is associated with library code
- *  shared libraries in separate closures will have separate
- *  state. this can only occur if dynamic ( manual ) loading of
- *  shared libraries is used, and will not occur with normal
- *  usage. in VDB-3 the state will be stored with the process,
- *  not the library.
- */
-VFS_EXTERN VResolverEnableState CC VResolverLocalEnable ( const VResolver * self,
-    VResolverEnableState enable );
-
-
-/* RemoteEnable
- *  modify settings for using remote repositories
- *
- *  "enable" [ IN ] - enable or disable remote access,
- *  or follow settings in KConfig
- *
- *  returns the previous state of "remote-enabled" property
- *
- * NB - in VDB-2, the state is associated with library code
- *  shared libraries in separate closures will have separate
- *  state. this can only occur if dynamic ( manual ) loading of
- *  shared libraries is used, and will not occur with normal
- *  usage. in VDB-3 the state will be stored with the process,
- *  not the library.
- */
-VFS_EXTERN VResolverEnableState CC VResolverRemoteEnable ( const VResolver * self,
-    VResolverEnableState enable );
-
-
-/* CacheEnable
- *  modify settings for caching files in user repositories
- *
- *  "enable" [ IN ] - enable or disable user repository cache,
- *  or follow settings in KConfig
- *
- *  returns the previous state of "cache-enabled" property
- *
- * NB - in VDB-2, the state is associated with library code
- *  shared libraries in separate closures will have separate
- *  state. this can only occur if dynamic ( manual ) loading of
- *  shared libraries is used, and will not occur with normal
- *  usage. in VDB-3 the state will be stored with the process,
- *  not the library.
- */
-VFS_EXTERN VResolverEnableState CC VResolverCacheEnable ( const VResolver * self,
-    VResolverEnableState enable );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_vfs_resolver_ */
diff --git a/konfigure.perl b/konfigure.perl
new file mode 100644
index 0000000..245bd33
--- /dev/null
+++ b/konfigure.perl
@@ -0,0 +1,1204 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+use strict;
+
+sub println  { print @_; print "\n" }
+
+my ($filename, $directories, $suffix) = fileparse($0);
+if ($directories ne "./") {
+    println "configure: error: $filename should be run as ./$filename";
+    exit 1;
+}
+
+require 'package.pm';
+require 'os-arch.pm';
+
+use Cwd qw (abs_path getcwd);
+use File::Basename 'fileparse';
+use File::Spec 'catdir';
+use FindBin qw($Bin);
+use Getopt::Long 'GetOptions';
+
+check();
+
+my %PKG = PKG();
+
+my $PACKAGE_NAME = PACKAGE_NAME();
+my $OUT_MAKEFILE = 'Makefile.config';
+
+my $PACKAGE = PACKAGE();
+
+my $HOME = $ENV{HOME} || $ENV{USERPROFILE}
+    || $ENV{LOGDIR} || getcwd || (getpwuid($<))[7] || abs_path('.');
+
+$PKG{UPATH} =~ s/(\$\w+)/$1/eeg;
+
+my $OUTDIR = File::Spec->catdir($HOME, $PKG{OUT});
+
+my $package_default_prefix = $PKG{PATH};
+my $schema_default_dir = $PKG{SCHEMA_PATH} if ($PKG{SCHEMA_PATH});
+
+my @REQ = REQ();
+
+my @options = ( "arch=s",
+                "build=s",
+                "clean",
+                "debug",
+                "help",
+#               "output-makefile=s",
+                "prefix=s",
+                "status",
+                "with-debug",
+                "without-debug" );
+foreach my $href (@REQ) {
+    my %a = %$href;
+    push @options, "$a{option}=s";
+    push @options, "$a{boption}=s" if ($a{boption});
+    $href->{usrpath} =~ s/(\$\w+)/$1/eeg;
+}
+push @options, "shemadir" if ($PKG{SCHEMA_PATH});
+
+my %OPT;
+die "configure: error" unless (GetOptions(\%OPT, @options));
+
+if ($OPT{'help'}) {
+    help();
+    exit(0);
+} elsif ($OPT{'clean'}) {
+    {
+        foreach (glob(CONFIG_OUT() . '/Makefile.config*'),
+            File::Spec->catdir(CONFIG_OUT(), 'user.status'),
+            File::Spec->catdir(CONFIG_OUT(), 'Makefile.userconfig'))
+        {
+            my $f = $_;
+            print "removing $f... ";
+            if (-e $f) {
+                if (unlink $f) {
+                    println "ok";
+                } else {
+                    println "failed";
+                }
+            } else {
+                println "not found";
+            }
+        }
+    }
+    if (CONFIG_OUT() ne '.') {
+        foreach
+            (glob('Makefile.config*'), 'user.status', 'Makefile.userconfig')
+        {
+            my $f = $_;
+            print "removing $f... ";
+            if (-e $f) {
+                if (unlink $f) {
+                    println "ok";
+                } else {
+                    println "failed";
+                }
+            } else {
+                println "not found";
+            }
+        }
+    }
+    exit(0);
+} elsif ($OPT{'status'}) {
+    status(1);
+    exit(0);
+}
+$OPT{'prefix'} = $package_default_prefix unless ($OPT{'prefix'});
+
+my $AUTORUN = $OPT{status};
+print "checking system type... " unless ($AUTORUN);
+my ($OS, $ARCH, $OSTYPE, $MARCH, @ARCHITECTURES) = OsArch();
+println $OSTYPE unless ($AUTORUN);
+
+{
+    $OPT{'prefix'} = expand($OPT{'prefix'});
+    my $prefix = $OPT{'prefix'};
+    $OPT{eprefix} = $prefix unless ($OPT{eprefix} || $OS eq 'win');
+    my $eprefix = $OPT{eprefix};
+    unless ($OPT{bindir} || $OS eq 'win') {
+        $OPT{bindir} = File::Spec->catdir($eprefix, 'bin') ;
+    }
+    unless ($OPT{libdir} || $OS eq 'win') {
+        $OPT{libdir} = File::Spec->catdir($eprefix, 'lib');
+    }
+    unless ($OPT{includedir} || $OS eq 'win') {
+        $OPT{includedir} = File::Spec->catdir($eprefix, 'include');
+    }
+    if ($PKG{LNG} eq 'PYTHON' && ! $OPT{pythondir} && $OS ne 'win') {
+        $OPT{pythondir} = $eprefix;
+    }
+    if ($PKG{LNG} eq 'JAVA' && ! $OPT{javadir} && $OS ne 'win') {
+        $OPT{javadir} = File::Spec->catdir($eprefix, 'jar');
+    }
+    if ($PKG{EXAMP} && ! $OPT{sharedir} && $OS ne 'win') {
+        $OPT{sharedir} = File::Spec->catdir($eprefix, 'share');
+    }
+}
+
+# initial values
+my $TARGDIR = File::Spec->catdir($OUTDIR, $PACKAGE);
+$TARGDIR = expand($OPT{'build'}) if ($OPT{'build'});
+
+my $BUILD = 'rel';
+
+# parse command line
+$BUILD = 'dbg' if ($OPT{'with-debug'});
+$BUILD = 'rel' if ($OPT{'without-debug'});
+
+my $BUILD_TYPE = "release";
+$BUILD_TYPE = "debug" if ( $BUILD eq "dbg" );
+
+#println unless ($AUTORUN);
+
+if ($OPT{arch}) {
+    my $found;
+    foreach (@ARCHITECTURES) {
+        if ($_ eq $OPT{arch}) {
+            ++$found;
+            last;
+        }
+    }
+    if ($found) {
+        $ARCH = $MARCH = $OPT{arch};
+    } else {
+        delete $OPT{arch};
+    }
+}
+
+$OUT_MAKEFILE .= ".$OS.$ARCH";
+$OUT_MAKEFILE = File::Spec->catdir(CONFIG_OUT(), $OUT_MAKEFILE);
+
+#my $OSTYPE = `uname -s`; chomp $OSTYPE;
+
+print "checking machine architecture... " unless ($AUTORUN);
+#my $MARCH = `uname -m`; chomp $MARCH;
+println $MARCH unless ($AUTORUN);
+
+my $TOOLS = "";
+$TOOLS = "jdk" if ($PKG{LNG} eq 'JAVA');
+
+print "checking $PACKAGE_NAME version... " unless ($AUTORUN);
+my $FULL_VERSION = VERSION();
+println $FULL_VERSION unless ($AUTORUN);
+
+# determine architecture
+
+print "checking for supported architecture... " unless ($AUTORUN);
+
+my $BITS;
+
+if ( $MARCH =~ m/x86_64/i )
+{
+    $BITS = 64;
+}
+elsif ( $MARCH =~ m/i?86/i )
+{
+    $BITS = 32;
+}
+else
+{
+    die "unrecognized Architecture - " . $ARCH;
+}
+println "$MARCH ($BITS bits) is supported" unless ($AUTORUN);
+
+# determine OS and related norms
+my ($LPFX, $OBJX, $LOBX, $LIBX, $SHLX, $EXEX, $OSINC);
+
+print "checking for supported OS... " unless ($AUTORUN);
+if ( $OSTYPE =~ m/linux/i )
+{
+    $LPFX = "lib";
+    $OBJX = "o";
+    $LOBX = "pic.o";
+    $LIBX = "a";
+    $SHLX = "so";
+    $EXEX = "";
+    $OSINC = "unix";
+    if ( $TOOLS eq "" )
+    {
+        $TOOLS = "gcc";
+    }
+}
+elsif ( $OSTYPE =~ m/darwin/i )
+{
+    $LPFX = "lib";
+    $OBJX = "o";
+    $LOBX = "pic.o";
+    $LIBX = "a";
+    $SHLX = "dylib";
+    $EXEX = "";
+    $OSINC = "unix";
+    if ( $TOOLS eq "" )
+    {
+        $TOOLS = "clang";
+    }
+} elsif ($OSTYPE eq 'win') {
+    $TOOLS = "vc++";
+} else
+{
+    die "unrecognized OS - " . $OSTYPE;
+}
+println "$OSTYPE ($OS) is supported" unless ($AUTORUN);
+
+# tool chain
+my ($CC, $CP, $AR, $ARX, $ARLS, $LD, $LP);
+my ($JAVAC, $JAVAH, $JAR);
+my ($DBG, $OPT, $PIC, $INC, $MD);
+
+print "checking for supported tool chain... " unless ($AUTORUN);
+if ( $TOOLS =~ m/gcc/i )
+{
+    $CC = "gcc -c";
+    $CP = "g++ -c";
+    $AR = "ar rc";
+    $ARX = "ar x";
+    $ARLS = "ar t";
+    $LD = "gcc";
+    $LP = "g++";
+
+    $DBG = "-g -DDEBUG";
+    $OPT = "-O3";
+    $PIC = "-fPIC";
+    $INC = "-I";
+    $MD  = "-MD";
+}
+elsif ( $TOOLS =~ m/clang/i )
+{
+    $CC = "clang -c";
+    $CP = "clang++ -c";
+    $AR = "ar rc";
+    $ARX = "ar x";
+    $ARLS = "ar t";
+    $LD = "clang";
+    $LP = "clang++";
+
+    $DBG = "-g -DDEBUG";
+    $OPT = "-O3";
+    $PIC = "-fPIC";
+    $INC = "-I";
+    $MD  = "-MD";
+}
+elsif ( $TOOLS =~ m/jdk/i )
+{
+    $JAVAC = "javac";
+    $JAVAH = "javah";
+    $JAR   = "jar cf";
+
+    $DBG = "-g";
+} elsif ($TOOLS eq 'vc++') {
+} else
+{
+    die "unrecognized tool chain - " . $TOOLS;
+}
+println "$TOOLS tool chain is supported" unless ($AUTORUN);
+
+if ($OS ne 'win') {
+    $TARGDIR = File::Spec->catdir($TARGDIR, $OS, $TOOLS, $ARCH, $BUILD);
+}
+
+my @dependencies;
+
+foreach my $href (DEPENDS()) {
+    $_ = $href->{name};
+    my ($I, $L) = ($href->{Include});
+    if ($OPT{"with-$_-prefix"}) {
+        $I = File::Spec->catdir($OPT{"with-$_-prefix"}, 'include'); 
+        $L = File::Spec->catdir($OPT{"with-$_-prefix"}, 'lib'); 
+    }
+    my ($i, $l) = find_lib($_, $I, $L);
+    if (defined $i || $l) {
+        my $d = 'HAVE_' . uc($_) . ' = 1';
+        push @dependencies, $d;
+        println "\t\t$d" if ($OPT{'debug'});
+    }
+    if ($i) {
+        my $d = uc($_) . "_INCDIR = $i";
+        push @dependencies, $d;
+        println "\t\t$d" if ($OPT{'debug'});
+    }
+    if ($l) {
+        my $d = uc($_) . "_LIBDIR = $l";
+        push @dependencies, $d;
+        println "\t\t$d" if ($OPT{'debug'});
+    }
+}
+
+foreach my $href (@REQ) {
+    $href->{bldpath} =~ s/(\$\w+)/$1/eeg if ($href->{bldpath});
+    my ($found_itf, $found_lib, $found_ilib);        # found directories
+    my %a = %$href;
+    my $is_optional = optional($a{type});
+    my $need_source = $a{type} =~ /S/;
+    my $need_build = $a{type} =~ /B/;
+    my $need_lib = $a{type} =~ /L/;
+    
+    my ($inc, $lib, $ilib) = ($a{include}, $a{lib}); # file names to check
+    $lib =~ s/(\$\w+)/$1/eeg;
+
+    if ($need_build) {
+        $ilib = $a{ilib};
+        ++$need_lib;
+    }
+    unless ($AUTORUN) {
+        if ($need_source && $need_build) {
+            println
+               "checking for $a{name} package source files and build results..."
+        } elsif ($need_source) {
+            println "checking for $a{name} package source files...";
+        } else {
+            println "checking for $a{name} package...";
+        }
+    }
+    my %has_option;
+    foreach my $option ($a{option}, $a{boption}) {
+        next unless ($option);
+        if ($OPT{$option}) {
+            my $try = expand($OPT{$option});
+            my ($i, $l, $il) = ($inc, $lib, $ilib);
+            if ($option =~ /-build$/) {
+                undef $i;
+                ++$has_option{build};
+            } elsif ($option =~ /-prefix$/) {
+                undef $il;
+                ++$has_option{prefix};
+            } elsif ($option =~ /-sources$/) {
+                undef $l;
+                undef $il;
+                ++$has_option{sources};
+            }
+            my ($fi, $fl, $fil) = find_in_dir($try, $i, $l, $il);
+            $found_itf  = $fi  if (! $found_itf  && $fi);
+            $found_lib  = $fl  if (! $found_lib  && $fl);
+            $found_ilib = $fil if (! $found_ilib && $fil);
+        }
+    }
+    if (! $found_itf && ! $has_option{sources} && $a{srcpath}) {
+        my $try = $a{srcpath};
+        ($found_itf) = find_in_dir($try, $inc);
+    }
+    if (! $has_option{prefix}) {
+        if (! $found_itf || ($need_lib && ! $found_lib)) {
+            my $try = $a{pkgpath};
+            my ($fi, $fl) = find_in_dir($try, $inc, $lib);
+            $found_itf  = $fi  if (! $found_itf  && $fi);
+            $found_lib  = $fl  if (! $found_lib  && $fl);
+        }
+
+        if (! $found_itf || ($need_lib && ! $found_lib)) {
+            my $try = $a{usrpath};
+            my ($fi, $fl) = find_in_dir($try, $inc, $lib);
+            $found_itf  = $fi  if (! $found_itf  && $fi);
+            $found_lib  = $fl  if (! $found_lib  && $fl);
+        }
+    }
+    if (! $has_option{build}) {
+        if (($need_build || ($need_lib && ! $found_lib)) && $a{bldpath}) {
+            my $try = $a{bldpath};
+            my (undef, $fl, $fil) = find_in_dir($try, undef, $lib, $ilib);
+            $found_lib  = $fl  if (! $found_lib  && $fl);
+            $found_ilib = $fil if (! $found_ilib && $fil);
+        }
+    }
+    if (! $found_itf || ($need_lib && ! $found_lib) || ($ilib && ! $found_ilib))
+    {
+        if ($is_optional) {
+            println "configure: optional $a{name} package not found: skipped.";
+        } else {
+            if ($OPT{'debug'}) {
+                $_ = "$a{name}: includes: ";
+                $found_itf = '' unless $found_itf;
+                $_ .= $found_itf;
+                unless ($need_lib) {
+                    $_ .= "; libs: not needed";
+                } else {
+                    $found_lib = '' unless $found_lib;
+                    $_ .= "; libs: " . $found_lib;
+                }
+                unless ($ilib) {
+                    $_ .= "; ilibs: not needed";
+                } else {
+                    $found_ilib = '' unless $found_ilib;
+                    $_ .= "; ilibs: " . $found_ilib;
+                }
+                println "\t\t$_";
+            }
+            println "configure: error: required $a{name} package not found.";
+            exit 1;
+        }
+    } else {
+        $found_itf = abs_path($found_itf);
+        push(@dependencies, "$a{namew}_INCDIR = $found_itf");
+        if ($found_lib) {
+            $found_lib = abs_path($found_lib);
+            push(@dependencies, "$a{namew}_LIBDIR = $found_lib");
+        }
+        if ($ilib && $found_ilib) {
+            $found_ilib = abs_path($found_ilib);
+            push(@dependencies, "$a{namew}_ILIBDIR = $found_ilib");
+        }
+    }
+}
+
+if ($OS ne 'win' && ! $OPT{'status'}) {
+    # create Makefile.config
+    println "configure: creating '$OUT_MAKEFILE'" unless ($AUTORUN);
+    open my $F, ">$OUT_MAKEFILE" or die "cannot open $OUT_MAKEFILE to write";
+
+    print $F <<EndText;
+### AUTO-GENERATED FILE ###
+
+OS_ARCH = \$(shell perl \$(TOP)/os-arch.perl)
+
+# install paths
+EndText
+
+    L($F, "INST_BINDIR = $OPT{bindir}"        ) if ($OPT{bindir});
+    L($F, "INST_LIBDIR = $OPT{libdir}"        ) if ($OPT{libdir});
+    L($F, "INST_INCDIR = $OPT{includedir}"    ) if ($OPT{includedir});
+    L($F, "INST_SCHEMADIR = $OPT{'shemadir'}" ) if ($OPT{'shemadir'});
+    L($F, "INST_SHAREDIR = $OPT{'sharedir'}"  ) if ($OPT{'sharedir'});
+    L($F, "INST_JARDIR = $OPT{'javadir'}"     ) if ($OPT{'javadir'});
+    L($F, "INST_PYTHONDIR = $OPT{'pythondir'}") if ($OPT{'pythondir'});
+
+    my ($VERSION_SHLX, $MAJMIN_SHLX, $MAJVERS_SHLX);
+    if ($OSTYPE =~ /darwin/i) {
+        $VERSION_SHLX = '$(VERSION).$(SHLX)';
+        $MAJMIN_SHLX  = '$(MAJMIN).$(SHLX)';
+        $MAJVERS_SHLX = '$(MAJVERS).$(SHLX)';
+    } else {
+        $VERSION_SHLX = '$(SHLX).$(VERSION)';
+        $MAJMIN_SHLX  = '$(SHLX).$(MAJMIN)';
+        $MAJVERS_SHLX = '$(SHLX).$(MAJVERS)';
+    }
+
+
+    print $F <<EndText;
+
+# build type
+BUILD = $BUILD
+
+# target OS
+OS    = $OS
+OSINC = $OSINC
+
+# prefix string for system libraries
+LPFX = $LPFX
+
+# suffix strings for system libraries
+LIBX = $LIBX
+VERSION_LIBX = \$(LIBX).\$(VERSION)
+MAJMIN_LIBX  = \$(LIBX).\$(MAJMIN)
+MAJVERS_LIBX = \$(LIBX).\$(MAJVERS)
+
+SHLX = $SHLX
+VERSION_SHLX = $VERSION_SHLX
+MAJMIN_SHLX  = $MAJMIN_SHLX
+MAJVERS_SHLX = $MAJVERS_SHLX
+
+# suffix strings for system object files
+OBJX = $OBJX
+LOBX = $LOBX
+
+# suffix string for system executable
+EXEX = $EXEX
+VERSION_EXEX = \$(EXEX).\$(VERSION)
+MAJMIN_EXEX  = \$(EXEX).\$(MAJMIN)
+MAJVERS_EXEX = \$(EXEX).\$(MAJVERS)
+
+# system architecture and wordsize
+ARCH = $ARCH
+EndText
+
+    L($F, "# ARCH = $ARCH ( $MARCH )") if ($ARCH ne $MARCH);
+
+    print $F <<EndText;
+BITS = $BITS
+
+# tools
+EndText
+
+    L($F, "CC    = $CC"   ) if ($CC);
+    L($F, "CP    = $CP"   ) if ($CP);
+    L($F, "AR    = $AR"   ) if ($AR);
+    L($F, "ARX   = $ARX"  ) if ($ARX);
+    L($F, "ARLS  = $ARLS" ) if ($ARLS);
+    L($F, "LD    = $LD"   ) if ($LD);
+    L($F, "LP    = $LP"   ) if ($LP);
+    L($F, "JAVAC = $JAVAC") if ($JAVAC);
+    L($F, "JAVAH = $JAVAH") if ($JAVAH);
+    L($F, "JAR   = $JAR"  ) if ($JAR);
+    L($F);
+
+    L($F, '# tool options');
+    if ($BUILD eq "dbg") {
+        L($F, "DBG     = $DBG");
+        L($F, "OPT     = ");
+    } else {
+        L($F, "DBG     = -DNDEBUG") if ($PKG{LNG} eq 'C');
+        L($F, "OPT     = $OPT"    ) if ($OPT);
+    }
+    L($F, "PIC     = $PIC") if ($PIC);
+    if ($PKG{LNG} eq 'C') {
+        if ($TOOLS =~ /clang/i) {
+   L($F, 'SONAME  = -install_name ' .
+               '$(INST_LIBDIR)$(BITS)/$(subst $(VERSION),$(MAJVERS),$(@F)) \\');
+   L($F, '    -compatibility_version $(MAJMIN) -current_version $(VERSION) \\');
+   L($F, '    -flat_namespace -undefined suppress');
+        } else {
+      L($F, 'SONAME = -Wl,-soname=$(subst $(VERSION),$(MAJVERS),$(@F))');
+     }
+     L($F, "SRCINC  = $INC. $INC\$(SRCDIR)");
+    } elsif ($PKG{LNG} eq 'JAVA') {
+        L($F, 'SRCINC  = -sourcepath $(INCPATHS)');
+    }
+    L($F, "INCDIRS = \$(SRCINC) $INC\$(TOP)") if ($PIC);
+    if ($PKG{LNG} eq 'C') {
+        L($F, "CFLAGS  = \$(DBG) \$(OPT) \$(INCDIRS) $MD");
+    }
+
+    L($F, 'CLSPATH = -classpath $(CLSDIR)');
+    L($F);
+
+    # version information
+
+    my ($VERSION, $MAJMIN, $MAJVERS);
+
+    if ($FULL_VERSION =~ /(\d+)\.(\d+)\.(\d+)-?\w*\d*/) {
+        $VERSION = "$1.$2.$3";
+        $MAJMIN = "$1.$2";
+        $MAJVERS = $1;
+    } else {
+        die $VERSION;
+    }
+
+    print $F <<EndText;
+# $PACKAGE_NAME and library version
+VERSION = $VERSION
+MAJMIN  = $MAJMIN
+MAJVERS = $MAJVERS
+
+# output path
+TARGDIR = $TARGDIR
+
+# derived paths
+MODPATH  ?= \$(subst \$(TOP)/,,\$(CURDIR))
+SRCDIR   ?= \$(TOP)/\$(MODPATH)
+MAKEFILE ?= \$(abspath \$(firstword \$(MAKEFILE_LIST)))
+BINDIR    = \$(TARGDIR)/bin
+EndText
+
+    if ($PKG{LNG} eq 'C') {
+        L($F, 'LIBDIR    = $(TARGDIR)/lib');
+    } elsif ($PKG{LNG} eq 'JAVA') {
+        L($F, 'LIBDIR    = $(TARGDIR)/jar');
+    }
+
+    print $F <<EndText;
+ILIBDIR   = \$(TARGDIR)/ilib
+OBJDIR    = \$(TARGDIR)/obj/\$(MODPATH)
+CLSDIR    = \$(TARGDIR)/cls
+EndText
+
+    if ($PKG{LNG} eq 'JAVA') {
+        L($F,
+            "INCPATHS = \$(SRCDIR):\$(SRCDIR)/itf:\$(TOP)/gov/nih/nlm/ncbi/ngs")
+    }
+
+    print $F <<EndText;
+
+# exports
+export TOP
+export MODPATH
+export SRCDIR
+export MAKEFILE
+
+# auto-compilation rules
+EndText
+
+    if ($PKG{LNG} eq 'C') {
+        L($F, '$(OBJDIR)/%.$(OBJX): %.c');
+        T($F, '$(CC) -o $@ $< $(CFLAGS)');
+        L($F, '$(OBJDIR)/%.$(LOBX): %.c');
+        T($F, '$(CC) -o $@ $< $(PIC) $(CFLAGS)');
+    }
+    L($F, '$(OBJDIR)/%.$(OBJX): %.cpp');
+    T($F, '$(CP) -o $@ $< $(CFLAGS)');
+    L($F, '$(OBJDIR)/%.$(LOBX): %.cpp');
+    T($F, '$(CP) -o $@ $< $(PIC) $(CFLAGS)');
+    L($F);
+
+    # this is part of Makefile
+    L($F, 'VPATH = $(SRCDIR)');
+    L($F);
+
+    # we know how to find jni headers
+    if ($PKG{LNG} eq 'JAVA' and $OPT{'with-ngs-sdk-src'}) {
+        L($F, "JNIPATH = $OPT{'with-ngs-sdk-src'}/language/java");
+    }
+
+    L($F, '# directory rules');
+    if ($PKG{LNG} eq 'C') {
+        L($F, '$(BINDIR) $(LIBDIR) $(ILIBDIR) '
+            . '$(OBJDIR) $(INST_LIBDIR) $(INST_LIBDIR)$(BITS):');
+        T($F, 'mkdir -p $@');
+    } elsif ($PKG{LNG} eq 'JAVA') {
+        # test if we have jni header path
+        L($F, '$(LIBDIR) $(CLSDIR) $(INST_JARDIR):');
+        T($F, 'mkdir -p $@');
+    }
+    L($F);
+
+    L($F, '# not real targets');
+    L($F, '.PHONY: default clean install all std $(TARGETS)');
+    L($F);
+
+    L($F, '# dependencies');
+    if ($PKG{LNG} eq 'C') {
+        L($F, 'include $(wildcard $(OBJDIR)/*.d)');
+    } elsif ($PKG{LNG} eq 'JAVA') {
+        L($F, 'include $(wildcard $(CLSDIR)/*.d)');
+    }
+    L($F, $_) foreach (@dependencies);
+    L($F);
+
+    if ($OS eq 'linux' || $OS eq 'mac') {
+        L($F, '# installation rules');
+        L($F,
+        '$(INST_LIBDIR)$(BITS)/%.$(VERSION_LIBX): $(LIBDIR)/%.$(VERSION_LIBX)');
+        T($F, '@ echo -n "installing \'$(@F)\'... "');
+        T($F, '@ if cp $^ $@ && chmod 644 $@;                         \\');
+        T($F, '  then                                                 \\');
+        T($F, '      rm -f $(subst $(VERSION),$(MAJVERS),$@) '
+                      . '$(subst $(VERSION_LIBX),$(LIBX),$@) '
+                      . '$(subst .$(VERSION_LIBX),-static.$(LIBX),$@); \\');
+        T($F, '      ln -s $(@F) $(subst $(VERSION),$(MAJVERS),$@);   \\');
+        T($F, '      ln -s $(subst $(VERSION),$(MAJVERS),$(@F)) '
+                      . '$(subst $(VERSION_LIBX),$(LIBX),$@); \\');
+        T($F, '      ln -s $(subst $(VERSION_LIBX),$(LIBX),$(@F)) ' .
+       '$(INST_LIBDIR)$(BITS)/$(subst .$(VERSION_LIBX),-static.$(LIBX),$(@F));'
+                                                              . ' \\');
+        T($F, '      echo success;                                    \\');
+        T($F, '  else                                                 \\');
+        T($F, '      echo failure;                                    \\');
+        T($F, '      false;                                           \\');
+        T($F, '  fi');
+        L($F);
+
+        L($F,
+        '$(INST_LIBDIR)$(BITS)/%.$(VERSION_SHLX): $(LIBDIR)/%.$(VERSION_SHLX)');
+        T($F, '@ echo -n "installing \'$(@F)\'... "');
+        T($F, '@ if cp $^ $@ && chmod 755 $@;                         \\');
+        T($F, '  then                                                 \\');
+        T($F, '      rm -f $(subst $(VERSION),$(MAJVERS),$@) '
+                      . '$(subst $(VERSION_SHLX),$(SHLX),$@);    \\');
+        T($F, '      ln -s $(@F) $(subst $(VERSION),$(MAJVERS),$@);   \\');
+        T($F, '      ln -s $(subst $(VERSION),$(MAJVERS),$(@F)) '
+                      . '$(subst $(VERSION_SHLX),$(SHLX),$@); \\');
+        T($F, '      echo success;                                    \\');
+        T($F, '  else                                                 \\');
+        T($F, '      echo failure;                                    \\');
+        T($F, '      false;                                           \\');
+        T($F, '  fi');
+        L($F);
+
+        L($F, '$(INST_BINDIR)/%$(VERSION_EXEX): $(BINDIR)/%$(VERSION_EXEX)');
+        T($F, '@ echo -n "installing \'$(@F)\'... "');
+        T($F, '@ if cp $^ $@ && chmod 755 $@;                         \\');
+        T($F, '  then                                                 \\');
+        T($F, '      rm -f $(subst $(VERSION),$(MAJVERS),$@) '
+                      . '$(subst $(VERSION_EXEX),$(EXEX),$@);     \\');
+        T($F, '      ln -s $(@F) $(subst $(VERSION),$(MAJVERS),$@);   \\');
+        T($F, '      ln -s $(subst $(VERSION),$(MAJVERS),$(@F)) '
+                      . '$(subst $(VERSION_EXEX),$(EXEX),$@); \\');
+        T($F, '      echo success;                                    \\');
+        T($F, '  else                                                 \\');
+        T($F, '      echo failure;                                    \\');
+        T($F, '      false;                                           \\');
+        T($F, '  fi');
+    }
+    close $F;
+}
+
+if (! $OPT{'status'} ) {
+    if ($OS eq 'win') {
+        my $OUT = File::Spec->catdir(CONFIG_OUT(), 'Makefile.config.win');
+        println "configure: creating '$OUT'";
+        open OUT, ">$OUT" or die "cannot open $OUT to write";
+        my $name = PACKAGE_NAMW();
+        my $outdir = $name . '_OUTDIR';
+        my $root = $name . '_ROOT';
+
+        print OUT <<EndText;
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">  
+  <PropertyGroup Label="Globals">
+    <$outdir>$TARGDIR/\</$outdir>
+EndText
+        foreach my $href (@REQ) {
+            my %a = %$href;
+            my $NGS_SDK_PREFIX = '';
+            $NGS_SDK_PREFIX = $a{found_itf} if ($a{found_itf});
+            if ($a{name} eq 'ngs-sdk') {
+                my $root = "$a{namew}_ROOT";
+                print OUT "    <$root>$NGS_SDK_PREFIX\/</$root>\n";
+                last;
+            }
+        }
+        print OUT <<EndText;
+    <$root>$Bin/\</$root>
+  </PropertyGroup>
+</Project>
+EndText
+        close OUT;
+    } else {
+        println "configure: creating 'Makefile.config'" unless ($AUTORUN);
+        my $CONFIG_OUT = CONFIG_OUT();
+        my $out = File::Spec->catdir($CONFIG_OUT, 'Makefile.config');
+        open COUT, ">$out" or die "cannot open $out to write";
+        print COUT "### AUTO-GENERATED FILE ###\n";
+        print COUT "\n";
+        print COUT "OS_ARCH = \$(shell perl \$(TOP)/os-arch.perl)\n";
+        print COUT "include \$(TOP)/$CONFIG_OUT/Makefile.config.\$(OS_ARCH)\n";
+        close COUT;
+    }
+}
+
+status() if ($OS ne 'win');
+
+unlink 'a.out';
+
+sub L { $_[1] = '' unless ($_[1]); print { $_[0] }   "$_[1]\n" }
+sub T {                            print { $_[0] } "\t$_[1]\n" }
+
+sub status {
+    my ($load) = @_;
+    if ($load) {
+        ($OS, $ARCH, $OSTYPE, $MARCH, @ARCHITECTURES) = OsArch();
+        my $MAKEFILE
+            = File::Spec->catdir(CONFIG_OUT(), "$OUT_MAKEFILE.$OS.$ARCH");
+        println "\t\tloading $MAKEFILE" if ($OPT{'debug'});
+        unless (-e $MAKEFILE) {
+            print STDERR "configure: error: run ./configure [OPTIONS] first.\n";
+            exit 1;
+        }
+        open F, $MAKEFILE or die "cannot open $MAKEFILE";
+        foreach (<F>) {
+            chomp;
+            if (/BUILD = (.+)/) {
+                $BUILD_TYPE = $1;
+            } elsif (/BUILD \?= /) {
+                $BUILD_TYPE = $_ unless ($BUILD_TYPE);
+            }
+            elsif (/TARGDIR = /) {
+                $TARGDIR = $_;
+                println "\t\tgot $_" if ($OPT{'debug'});
+            } elsif (/TARGDIR \?= (.+)/) {
+                $TARGDIR = $1 unless ($TARGDIR);
+                println "\t\tgot $_" if ($OPT{'debug'});
+            }
+            elsif (/INST_INCDIR = (.+)/) {
+                $OPT{includedir} = $1;
+            }
+            elsif (/INST_BINDIR = (.+)/) {
+                $OPT{bindir} = $1;
+            }
+            elsif (/INST_LIBDIR = (.+)/) {
+                $OPT{libdir} = $1;
+            }
+        }
+    }
+
+    println "build type: $BUILD_TYPE";
+    println "build output path: $TARGDIR" if ($OS ne 'win');
+
+#   print "prefix: ";    print $OPT{'prefix'} if ($OS ne 'win');    println;
+#   print "eprefix: ";    print $OPT{'eprefix'} if ($OPT{'eprefix'});   println;
+
+    print "includedir: ";
+    print $OPT{'includedir'} if ($OPT{'includedir'});
+    println;
+
+    print "bindir: ";
+    print $OPT{'bindir'} if ($OPT{'bindir'});
+    println;
+
+    print "libdir: ";
+    print $OPT{'libdir'} if ($OPT{'libdir'});
+    println;
+
+    println "schemadir: $OPT{'shemadir'}" if ($OPT{'shemadir'});
+    println "sharedir: $OPT{'sharedir'}" if ($OPT{'sharedir'});
+    println "javadir: $OPT{'javadir'}" if ($OPT{'javadir'});
+    println "pythondir: $OPT{'pythondir'}" if ($OPT{'pythondir'});
+
+    println;
+}
+
+sub expand {
+    my ($filename) = @_;
+    return unless ($filename);
+    if ($filename =~ /^~/) {
+        $filename =~ s{ ^ ~ ( [^/]* ) }
+                      { $1
+                            ? (getpwnam($1))[7]
+                            : ( $ENV{HOME} || $ENV{USERPROFILE} || $ENV{LOGDIR}
+                                || (getpwuid($<))[7]
+                              )
+                      }ex;
+    }
+    my $a = abs_path($filename);
+    $filename = $a if ($a);
+    $filename;
+}
+
+sub find_in_dir {
+    my ($dir, $include, $lib, $ilib) = @_;
+    print "\t$dir... " unless ($AUTORUN);
+    unless (-d $dir) {
+        println "no" unless ($AUTORUN);
+        println "\t\tnot found $dir" if ($OPT{'debug'});
+        return;
+    }
+    print "[found] " if ($OPT{'debug'});
+    my ($found_inc, $found_lib, $found_ilib);
+    my $nl = 1;
+    if ($include) {
+        print "includes... " unless ($AUTORUN);
+        if (-e "$dir/$include") {
+            println 'yes' unless ($AUTORUN);
+            $found_inc = $dir;
+        } elsif (-e "$dir/include/$include") {
+            println 'yes' unless ($AUTORUN);
+            $found_inc = "$dir/include";
+        } elsif (-e "$dir/interfaces/$include") {
+            println 'yes' unless ($AUTORUN);
+            $found_inc = "$dir/interfaces";
+        } else {
+            println 'no' unless ($AUTORUN);
+        }
+        $nl = 0;
+    }
+    if ($lib || $ilib) {
+        print "\n\t" if ($nl && !$AUTORUN);
+        print "libraries... " unless ($AUTORUN);
+        if ($lib) {
+            my $builddir = File::Spec->catdir($dir, $OS, $TOOLS, $ARCH, $BUILD);
+            my $libdir  = File::Spec->catdir($builddir, 'lib');
+            my $ilibdir = File::Spec->catdir($builddir, 'ilib');
+            my $f = File::Spec->catdir($libdir, $lib);
+            print "\n\t\tchecking $f\n\t" if ($OPT{'debug'});
+            my $found;
+            if (-e $f) {
+                $found_lib = $libdir;
+                if ($ilib) {
+                    my $f = File::Spec->catdir($ilibdir, $ilib);
+                    print "\tchecking $f\n\t" if ($OPT{'debug'});
+                    if (-e $f) {
+                        println 'yes';
+                        $found_ilib = $ilibdir;
+                    } else {
+                        println 'no' unless ($AUTORUN);
+                        return;
+                    }
+                } else {
+                    println 'yes';
+                }
+                ++$found;
+            }
+            if (! $found) {
+                my $libdir = File::Spec->catdir($dir, 'lib' . $BITS);
+                my $f = File::Spec->catdir($libdir, $lib);
+                print "\tchecking $f\n\t" if ($OPT{'debug'});
+                if (-e $f) {
+                    println 'yes';
+                    $found_lib = $libdir;
+                    ++$found;
+                }
+            }
+            if (! $found) {
+                my $builddir = File::Spec->catdir
+                    ($dir, $OS, $TOOLS, $ARCH, reverse_build($BUILD));
+                my $libdir  = File::Spec->catdir($builddir, 'lib');
+                my $ilibdir = File::Spec->catdir($builddir, 'ilib');
+                my $f = File::Spec->catdir($libdir, $lib);
+                print "\tchecking $f\n\t" if ($OPT{'debug'});
+                if (-e $f) {
+                    $found_lib = $libdir;
+                    if ($ilib) {
+                        my $f = File::Spec->catdir($ilibdir, $ilib);
+                        print "\tchecking $f\n\t" if ($OPT{'debug'});
+                        if (-e $f) {
+                            println 'yes';
+                            $found_ilib = $ilibdir;
+                        } else {
+                            println 'no' unless ($AUTORUN);
+                            return;
+                        }
+                    } else {
+                        println 'yes';
+                    }
+                    ++$found;
+                }
+            }
+        }
+        if ($found_lib && $ilib && ! $found_ilib) {
+            println "\n\t\tfound $found_lib but no ilib/" if ($OPT{'debug'});
+            print "\t" if ($OPT{'debug'});
+            println 'no' unless ($AUTORUN);
+            undef $found_lib;
+        }
+        ++$nl;
+    }
+    return ($found_inc, $found_lib, $found_ilib);
+}
+
+sub reverse_build {
+    ($_) = @_;
+    if ($_ eq 'rel') {
+        return 'dbg';
+    } elsif ($_ eq 'dbg') {
+        return 'rel';
+    } else {
+        die $_;
+    }
+}
+
+################################################################################
+
+sub find_lib {
+    my ($n, $i, $l) = @_;
+
+    print "checking for $n library... ";
+
+    while (1) {
+        my ($library, $log);
+
+        if ($n eq 'hdf5') {
+            $library = '-lhdf5';
+            $log = '#include <hdf5.h>            \n main() { H5close     (); }';
+        } elsif ($n eq 'xml2') {
+            $library = '-lxml2';
+            $log = '#include <libxml/xmlreader.h>\n main() { xmlInitParser();}';
+        } elsif ($n eq 'magic') {
+            $library = '-lmagic';
+            $log = '#include <magic.h>           \n main() { magic_open (0); }';
+        } else {
+            println 'unknown: skipped';
+            return;
+        }
+
+        if (($i && ! -d $i) || ($l && ! -d $l)) {
+            println 'no';
+            return;
+        }
+
+        my $cmd = $log;
+        $cmd =~ s/\\n/\n/g;
+
+        my $gcc = "| gcc -xc " . ($i ? "-I$i " : ' ')
+                               . ($l ? "-L$l " : ' ') . "- $library";
+        $gcc .= ' 2> /dev/null' unless ($OPT{'debug'});
+
+        open GCC, $gcc or last;
+        print "\n\t\trunning echo -e '$log' $gcc\n" if ($OPT{'debug'});
+        print GCC "$cmd" or last;
+        my $ok = close GCC;
+        print "\t" if ($OPT{'debug'});
+        println $ok ? 'yes' : 'no';
+
+        unlink 'a.out';
+
+        return if (!$ok);
+
+        return ($i, $l);
+    }
+
+    println 'cannot run gcc: skipped';
+}
+
+################################################################################
+
+sub check {
+    die "No CONFIG_OUT"   unless CONFIG_OUT();
+    die "No PACKAGE"      unless PACKAGE();
+    die "No PACKAGE_NAME" unless PACKAGE_NAME();
+    die "No PACKAGE_NAMW" unless PACKAGE_NAMW();
+    die "No PACKAGE_TYPE" unless PACKAGE_TYPE();
+    die "No VERSION"      unless VERSION();
+
+    my %PKG = PKG();
+
+    die "No LNG"   unless $PKG{LNG};
+    die "No OUT"   unless $PKG{OUT};
+    die "No PATH"  unless $PKG{PATH};
+    die "No UPATH" unless $PKG{UPATH};
+
+    foreach my $href (DEPENDS()) { die "No DEPENDS::name" unless $href->{name} }
+
+    foreach my $href (REQ()) {
+        die "No REQ::name" unless $href->{name};
+
+        my $origin = $href->{origin};
+        die  "No $href->{name}:origin"  unless $origin;
+        die  "No $href->{name}:include" unless $href->{include};
+        die  "No $href->{name}:lib"     unless $href->{lib};
+        die  "No $href->{name}:option"  unless $href->{option};
+        die  "No $href->{name}:pkgpath" unless $href->{pkgpath};
+        die  "No $href->{name}:type"    unless $href->{type};
+        die  "No $href->{name}:usrpath" unless $href->{usrpath};
+        if ($origin eq 'I') {
+         die "No $href->{name}:bldpath" unless $href->{bldpath};
+         die "No $href->{name}:ilib"    unless $href->{ilib};
+         die "No $href->{name}:namew"   unless $href->{namew};
+         die "No $href->{name}:srcpath" unless $href->{srcpath};
+        }
+    }
+}
+
+################################################################################
+
+sub optional { $_[0] =~ /^[LS]I$/ }
+
+sub help {
+#  --prefix=PREFIX         install architecture-independent files in PREFIX
+    print <<EndText;
+`configure' configures $PACKAGE_NAME to adapt to many kinds of systems.
+
+Usage: ./configure [OPTION]...
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+
+EndText
+
+    if ($^O ne 'MSWin32') {
+        print <<EndText;
+Installation directories:
+  --prefix=PREFIX         install all files in PREFIX
+                          [$package_default_prefix]
+
+EndText
+
+        my $other_prefix = $PKG{UPATH};
+        if ($PACKAGE eq 'sra-tools' && 0) {
+            print <<EndText;
+  --shemadir=DIR          install schema files in DIR
+                          [$schema_default_dir]
+
+EndText
+        }
+
+        print "By default, \`make install' will install all the files in\n";
+    
+        if (PACKAGE_TYPE() eq 'B') {
+            print "\`$package_default_prefix/bin', ";
+        } else {
+            print "\`$package_default_prefix/include', ";
+        }
+        println "\`$package_default_prefix/lib' etc.";
+
+        print <<EndText;
+You can specify an installation prefix other than \`$package_default_prefix'
+using \`--prefix', for instance \`--prefix=$other_prefix'.
+EndText
+    }
+
+    print <<EndText;
+
+For better control, use the options below.
+
+EndText
+
+    my ($required, $optional);
+    foreach my $href (@REQ) {
+        if (optional($href->{type})) {
+            ++$optional;
+        } else {
+            ++$required;
+        }
+    }
+
+    if ($required) {
+        print "Required Packages:\n";
+        foreach my $href (@REQ) {
+            next if (optional($href->{type}));
+            my %a = %$href;
+            if ($a{type} =~ /S/) {
+                println "  --$a{option}=DIR    search for $a{name} package";
+                println "                                 source files in DIR";
+            } else {
+                println
+                    "  --$a{option}=DIR      search for $a{name} package in DIR"
+            }
+            if ($a{boption}) {
+                println "  --$a{boption}=DIR      search for $a{name} package";
+                println "                                 build output in DIR";
+            }
+            println;
+        }
+    }
+    
+    if ($optional) {
+        print "Optional Packages:\n";
+        foreach my $href (@REQ) {
+            next unless (optional($href->{type}));
+            my %a = %$href;
+            if ($a{option} =~ /-sources$/) {
+                println "  --$a{option}=DIR    search for $a{name} package";
+                println "                                source files in DIR";
+            } else {
+                println "  --$a{option}=DIR    search for $a{name} files in DIR"
+            }
+        }
+        println;
+    }
+
+    print <<EndText if ($^O ne 'MSWin32');
+Build tuning:
+  --with-debug
+  --without-debug
+  --arch=name             specify the name of the target architecture
+
+  --build=DIR             generate build output into DIR directory
+                          [$OUTDIR]
+
+EndText
+
+    println "Miscellaneous:";
+    if ($^O ne 'MSWin32') {
+        println
+            "  --status                print current configuration information"
+    }
+    println "  --clean                 remove all configuration results";
+    println "  --debug                 print lots of debugging information";
+    println;
+}
+
+=pod
+################################################################################
+=cut
diff --git a/libs/Makefile b/libs/Makefile
deleted file mode 100644
index ac66110..0000000
--- a/libs/Makefile
+++ /dev/null
@@ -1,75 +0,0 @@
-# ===========================================================================
-#
-#                            PUBLIC DOMAIN NOTICE
-#               National Center for Biotechnology Information
-#
-#  This software/database is a "United States Government Work" under the
-#  terms of the United States Copyright Act.  It was written as part of
-#  the author's official duties as a United States Government employee and
-#  thus cannot be copyrighted.  This software/database is freely available
-#  to the public for use. The National Library of Medicine and the U.S.
-#  Government have not placed any restriction on its use or reproduction.
-#
-#  Although all reasonable efforts have been taken to ensure the accuracy
-#  and reliability of the software and data, the NLM and the U.S.
-#  Government do not and cannot warrant the performance or results that
-#  may be obtained by using this software or data. The NLM and the U.S.
-#  Government disclaim all warranties, express or implied, including
-#  warranties of performance, merchantability or fitness for any particular
-#  purpose.
-#
-#  Please cite the author in any work or product based on this material.
-#
-# ===========================================================================
-
-
-TOP ?= $(shell ../build/abspath.sh ..)
-MODULE = libs
-
-include $(TOP)/build/Makefile.shell
-
-#-------------------------------------------------------------------------------
-# default
-#
-SUBDIRS = \
-	ext \
-	klib \
-	kproc \
-	kfs \
-	kns \
-	kxml \
-	kfg \
-	krypto \
-	vfs \
-	kapp \
-	kdb \
-	vdb \
-	vxf \
-	search \
-	sraxf \
-	align \
-	axf \
-	wgsxf \
-	ktst \
-	loader \
-	blast \
-	ascp \
-	sra \
-	ncbi-vdb
-
-
-# common targets for non-leaf Makefiles; must follow a definition of SUBDIRS
-include $(TOP)/build/Makefile.targets
-
-$(SUBDIRS):
-	@ $(MAKE) -C $@
-
-.PHONY: default $(SUBDIRS)
-
-#-------------------------------------------------------------------------------
-# pass-through
-#
-out debug profile release GCC ICC VC++:
-	@ $(MAKE) TOP=$(TOP) -f $(TOP)/build/Makefile.env $@
-
-.PHONY: out debug profile release GCC ICC VC++
diff --git a/libs/align/Makefile b/libs/align/Makefile
deleted file mode 100644
index b2d8808..0000000
--- a/libs/align/Makefile
+++ /dev/null
@@ -1,151 +0,0 @@
-# ===========================================================================
-#
-#                            PUBLIC DOMAIN NOTICE
-#               National Center for Biotechnology Information
-#
-#  This software/database is a "United States Government Work" under the
-#  terms of the United States Copyright Act.  It was written as part of
-#  the author's official duties as a United States Government employee and
-#  thus cannot be copyrighted.  This software/database is freely available
-#  to the public for use. The National Library of Medicine and the U.S.
-#  Government have not placed any restriction on its use or reproduction.
-#
-#  Although all reasonable efforts have been taken to ensure the accuracy
-#  and reliability of the software and data, the NLM and the U.S.
-#  Government do not and cannot warrant the performance or results that
-#  may be obtained by using this software or data. The NLM and the U.S.
-#  Government disclaim all warranties, express or implied, including
-#  warranties of performance, merchantability or fitness for any particular
-#  purpose.
-#
-#  Please cite the author in any work or product based on this material.
-#
-# ===========================================================================
-
-
-default: std
-
-TOP ?= $(shell ../../build/abspath.sh ../..)
-MODULE = libs/align
-
-INT_LIBS = \
-	libncbi-bam \
-	libalign-writer \
-	libalign-access \
-	libalign-reader
-
-ALL_LIBS = \
-	$(INT_LIBS)
-
-include $(TOP)/build/Makefile.env
-
-#-------------------------------------------------------------------------------
-# outer targets
-#
-all std: makedirs
-	@ $(MAKE_CMD) $(TARGDIR)/std
-
-$(INT_LIBS): makedirs
-	@ $(MAKE_CMD) $(ILIBDIR)/$@
-
-.PHONY: all std $(ALL_LIBS)
-
-#-------------------------------------------------------------------------------
-# std
-#
-$(TARGDIR)/std: \
-	$(addprefix $(ILIBDIR)/,$(INT_LIBS))
-
-.PHONY: $(TARGDIR)/std
-
-#-------------------------------------------------------------------------------
-# clean
-#
-clean: stdclean
-
-.PHONY: clean
-
-#-------------------------------------------------------------------------------
-# libncbi-bam
-#
-$(ILIBDIR)/libncbi-bam: $(addprefix $(ILIBDIR)/libncbi-bam.,$(ILIBEXT))
-
-BAM_SRC = \
-	bam
-
-BAM_OBJ = \
-	$(addsuffix .$(LOBX),$(BAM_SRC))
-
-BAM_LIB = 
-
-$(ILIBDIR)/libncbi-bam.$(LIBX): $(BAM_OBJ)
-	$(LD) --slib -o $@ $^ $(BAM_LIB)
-
-
-#-------------------------------------------------------------------------------
-# align-access
-#
-$(ILIBDIR)/libalign-access: $(addprefix $(ILIBDIR)/libalign-access.,$(ILIBEXT))
-
-ALIGN_ACCESS_SRC = \
-	align-access
-
-ALIGN_ACCESS_OBJ = \
-	$(addsuffix .$(LOBX),$(ALIGN_ACCESS_SRC))
-
-ALIGN_ACCESS_LIB = 
-
-$(ILIBDIR)/libalign-access.$(LIBX): $(ALIGN_ACCESS_OBJ)
-	$(LD) --slib -o $@ $^ $(ALIGN_ACCESS_LIB)
-
-#-------------------------------------------------------------------------------
-# align-reader
-#
-$(ILIBDIR)/libalign-reader: $(addprefix $(ILIBDIR)/libalign-reader.,$(ILIBEXT))
-
-ALIGN_READER_SRC = \
-	align_mgr \
-	al_iterator \
-	ref_iterator \
-	pl_iterator \
-	dna-reverse-cmpl \
-	reference-cmn \
-	reader-cmn \
-	reader-refseq \
-	reference \
-	refseq-mgr \
-	quality-quantizer
-
-ALIGN_READER_OBJ = \
-	$(addsuffix .$(LOBX),$(ALIGN_READER_SRC))
-
-ALIGN_READER_LIB = 
-
-$(ILIBDIR)/libalign-reader.$(LIBX): $(ALIGN_READER_OBJ)
-	$(LD) --slib -o $@ $^ $(ALIGN_READER_LIB)
-
-#-------------------------------------------------------------------------------
-# align-writer
-#
-$(ILIBDIR)/libalign-writer: $(addprefix $(ILIBDIR)/libalign-writer.,$(LIBX))
-
-ALIGN_WRITER_SRC = \
-    dna-reverse-cmpl \
-	reader-cmn \
-	reference-cmn \
-	reader-refseq \
-	refseq-mgr \
-	writer-cmn \
-	writer-refseq \
-	writer-alignment \
-	writer-sequence \
-	writer-ref \
-	writer-reference
-
-ALIGN_WRITER_OBJ = \
-	$(addsuffix .$(LOBX),$(ALIGN_WRITER_SRC))
-
-ALIGN_WRITER_LIB = 
-
-$(ILIBDIR)/libalign-writer.$(LIBX): $(ALIGN_WRITER_OBJ)
-	$(LD) --slib -o $@ $^ $(ALIGN_WRITER_LIB)
diff --git a/libs/align/al_iterator.c b/libs/align/al_iterator.c
deleted file mode 100644
index e53fc27..0000000
--- a/libs/align/al_iterator.c
+++ /dev/null
@@ -1,562 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <align/extern.h>
-
-#include <klib/rc.h>
-#include <klib/container.h>
-#include <klib/refcount.h>
-#include <klib/sort.h>
-#include <klib/log.h>
-#include <klib/out.h>
-#include <insdc/insdc.h>
-#include <align/iterator.h>
-#include <align/manager.h>
-#include <vdb/cursor.h>
-#include <sysalloc.h>
-
-#include "debug.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-#define COL_READ "READ"
-#define COL_HAS_MISMATCH "HAS_MISMATCH"
-#define COL_HAS_REF_OFFSET "HAS_REF_OFFSET"
-#define COL_REF_OFFSET "REF_OFFSET"
-
-typedef struct pos_offset
-{
-    uint32_t pos;
-    int32_t offset;
-} pos_offset;
-
-
-struct AlignmentIterator
-{
-    struct AlignMgr const *amgr;   /* the alignment-manager... */
-
-    /* data to walk */
-    bool * has_mismatch;    /* copy of HAS_MISMATCH */
-    INSDC_4na_bin * read;   /* copy of READ */
-    uint32_t read_len;      /* length of READ */
-    uint32_t ref_len;       /* length of projection on reference */
-
-    INSDC_coord_zero ref_window_start;  /* where the requested window on the reference starts */
-    INSDC_coord_len  ref_window_len;    /* how long the requested window on the reference is */
-
-    pos_offset * pos_ofs;   /* computed by walking HAS_REF_OFFSET, REF_OFFSET ( method 1 ) */
-    uint32_t pos_ofs_idx;   /* current index into pos_ofs[] */
-    uint32_t pos_ofs_cnt;   /* how many pos_ofs-values are there */
-
-    int32_t abs_ref_start;  /* absolute reference-related start-position   */
-    int32_t rel_ref_pos;    /* relative reference-related position ( relative to start of sequence )  */
-    uint32_t seq_pos;       /* position on the sequence, as the reference sees it */
-    uint32_t skip;          /* how many bases to skip if we are in DELETE */
-    uint32_t flags;         /* flags it, when we are in INSERT/DELETE */
-    uint32_t inserts;       /* how many inserts */
-
-    KRefcount refcount;
-    bool free_on_whack;     /* true if allocated and allowing references */
-    uint8_t align [ 3 ];
-};
-
-
-/* forward decl. for private helper functions */
-static rc_t compute_posofs(  AlignmentIterator * self,
-    const bool * has_ref_offset,
-    const int32_t * ref_offset,
-    uint32_t ref_offset_len );
-
-static void al_iter_adjust_next( AlignmentIterator * self );
-
-LIB_EXPORT void CC AlignIteratorRecordDestroy ( void *obj, void *data )
-{
-    /* nothing to do, because there are no sub-allocations etc. ... */
-}
-
-
-static rc_t get_idx_and_read( struct VCursor const *curs,
-                              const char * name,
-                              int64_t row_id,
-                              const void ** base,
-                              uint32_t * len )
-{
-    uint32_t column_idx;
-    rc_t rc = VCursorGetColumnIdx ( curs, &column_idx, name );
-    if ( rc != 0 )
-        LOGERR( klogInt, rc, "VCursorGetColumnIdx() failed" );
-    else
-    {
-        uint32_t elem_bits, boff, len_intern;
-        const void * ptr;
-        rc = VCursorCellDataDirect ( curs, row_id, column_idx, 
-                                     &elem_bits, &ptr, &boff, &len_intern );
-        if ( rc != 0 )
-            LOGERR( klogInt, rc, "VCursorCellDataDirect() failed" );
-        else
-        {
-            assert( boff == 0 );
-            if ( len != NULL ) *len = len_intern;
-            if ( base != NULL ) *base = ptr;
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC AlignIteratorRecordPopulate ( void *obj,
-    const PlacementRecord *placement, struct VCursor const *curs, 
-    INSDC_coord_zero ref_window_start, INSDC_coord_len ref_window_len, void *data )
-{
-    /* read the data required to build a Alignment-Iterator,
-       then create the Alignment-Iterator into the already allocated memory */
-    const void * base;
-    const void * base_has_ref_offset;
-    const void * base_ref_offset;
-
-    INSDC_coord_len data_len;
-    uint32_t ref_offset_len;
-    rc_t rc;
-
-    AlignmentIterator *iter = ( AlignmentIterator * ) obj;
-    AlignMgr *almgr = ( AlignMgr * ) data;
-
-    uint8_t * ptr = ( void* ) iter;
-    ptr += ( sizeof *iter );
-
-    rc = get_idx_and_read( curs, COL_HAS_MISMATCH, placement->id, &base, &data_len );
-    if ( rc == 0 )
-    {
-        /* copy HAS_MISMATCH into place, point the header-value to it, advance */
-        memcpy( ptr, base, data_len );
-        iter->has_mismatch = (bool *)ptr;
-        ptr += data_len;
-    }
-
-    if ( rc == 0 )
-    {
-        rc = get_idx_and_read( curs, COL_READ, placement->id, &base, &data_len );
-        /* copy READ into place, point the header-value to it, advance */
-        if ( rc == 0 )
-        {
-            memcpy( ptr, base, data_len );
-            iter->read = ( INSDC_4na_bin * )ptr;
-            iter->read_len = data_len;
-            iter->abs_ref_start = placement->pos;
-            iter->ref_len = placement->len;
-            iter->rel_ref_pos = 0;
-            iter->seq_pos = 0;
-            ptr += data_len;
-            iter->pos_ofs = (pos_offset *)ptr;
-            iter->ref_window_start = ref_window_start;
-            iter->ref_window_len = ref_window_len;
-            iter->free_on_whack = false;
-        }
-    }
-
-    if ( rc == 0 )
-    {
-        rc = get_idx_and_read( curs, COL_HAS_REF_OFFSET, placement->id, &base_has_ref_offset, &data_len );
-    }
-    if ( rc == 0 )
-    {
-        rc = get_idx_and_read( curs, COL_REF_OFFSET, placement->id, &base_ref_offset, &ref_offset_len );
-    }
-    if ( rc == 0 )
-    {
-        rc = compute_posofs( iter,
-                             ( const bool * )base_has_ref_offset, 
-                             ( const int32_t * )base_ref_offset, 
-                             ref_offset_len );
-    }
-    if ( rc == 0 )
-    {
-        if ( iter->pos_ofs_idx == 0 )
-            al_iter_adjust_next( iter );
-        KRefcountInit( &iter->refcount, 1, "AlignmentIterator", "Make", "align" );
-        data_len = 0;
-        while( ( iter->abs_ref_start + iter->rel_ref_pos ) < ref_window_start && rc == 0 )
-        {
-            rc = AlignmentIteratorNext ( iter );
-            data_len++;
-        }
-    }
-    if ( rc == 0 )  {   rc = AlignMgrAddRef ( almgr );  }
-    if ( rc == 0 )  {   iter->amgr = almgr;  }
-
-/*
-    if ( rc == 0 )
-    {
-        OUTMSG(( "placement[%lu] at %u (w=%u) next(%u) \n", 
-                 placement->id, iter->abs_ref_start, ref_window_start, data_len ));
-    }
-*/
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC AlignIteratorRecordSize ( struct VCursor const *curs, int64_t row_id, size_t *size, void *data )
-{
-    uint32_t ref_offset_len, read_len;
-
-    rc_t rc = get_idx_and_read( curs, COL_REF_OFFSET, row_id, NULL, &ref_offset_len );
-    if ( rc == 0 )
-        rc = get_idx_and_read( curs, COL_READ, row_id, NULL, &read_len );
-
-    if ( rc == 0 )
-    {
-        AlignmentIterator * ali = NULL;
-        size_t po_size = ( ( sizeof *(ali->pos_ofs) ) * ( ref_offset_len ) );
-        *size = ( ( sizeof *ali ) + ( read_len * 2 ) + po_size );
-    }
-
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC AlignMgrMakeAlignmentIterator ( struct AlignMgr const *self,
-    AlignmentIterator **iter,
-    bool copy,
-    INSDC_coord_zero ref_pos,
-    INSDC_coord_len ref_len,
-    const INSDC_4na_bin *read,
-    INSDC_coord_len read_len,
-    const bool *has_mismatch,
-    const bool *has_ref_offset,
-    const int32_t *ref_offset,
-    uint32_t ref_offset_len,
-    INSDC_coord_zero ref_window_start,
-    INSDC_coord_len ref_window_len )
-{
-    rc_t rc = 0;
-    if ( self == NULL )
-        rc = RC( rcAlign, rcIterator, rcConstructing, rcSelf, rcNull );
-    else
-    {
-        if ( iter == NULL || has_mismatch == NULL || has_ref_offset == NULL ||
-             read == NULL || read_len == 0 )
-            rc = RC( rcAlign, rcIterator, rcConstructing, rcParam, rcNull );
-        else
-        {
-            AlignmentIterator * ali = NULL;
-            size_t po_size = ( ( sizeof *(ali->pos_ofs) ) * ( ref_offset_len ) );
-            size_t full_size = ( sizeof *ali ) + ( read_len * 2 ) + po_size;
-      
-            uint8_t * ptr = calloc( full_size, 1 );
-            *iter = NULL;
-            if ( ptr == NULL )
-                rc = RC( rcAlign, rcIterator, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                ali = ( AlignmentIterator * )ptr;
-                ptr += ( sizeof *ali );
-
-                KRefcountInit( &ali->refcount, 1, "AlignmentIterator", "Make", "align" );
-
-                /* copy HAS_MISMATCH into place, point the header-value to it, advance */
-                memcpy( ptr, has_mismatch, read_len );
-                ali->has_mismatch = (bool *)ptr;
-                ptr += read_len;
-
-                /* copy READ into place, point the header-value to it, advance */
-                memcpy( ptr, read, read_len );
-                ali->read = ( INSDC_4na_bin * )ptr;
-                ptr += read_len;
-
-                ali->read_len = read_len;
-                ali->ref_len = ref_len;
-                ali->abs_ref_start = ref_pos;
-                ali->pos_ofs = (pos_offset *)ptr;
-                ali->ref_window_start = ref_window_start;
-                ali->ref_window_len = ref_window_len;
-                ali->free_on_whack = true;
-
-                rc = compute_posofs( ali, has_ref_offset, ref_offset, ref_offset_len );
-                if ( ali->pos_ofs_idx == 0 )
-                    al_iter_adjust_next( ali );
-
-                if ( rc == 0 )
-                {
-                    rc = AlignMgrAddRef ( self );
-                    if ( rc == 0 )
-                        ali->amgr = self;
-                }
-            }
-
-            if ( rc == 0 )
-                *iter = ali;
-            else
-                free( ali );
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC AlignmentIteratorAddRef( const AlignmentIterator * cself )
-{
-    rc_t rc = 0;
-    if ( cself == NULL )
-        rc = RC( rcAlign, rcIterator, rcAttaching, rcSelf, rcNull );
-    else
-    {
-        if ( KRefcountAdd( &cself->refcount, "AlignmentIterator" ) != krefOkay )
-        {
-            rc = RC( rcAlign, rcIterator, rcAttaching, rcError, rcUnexpected );
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC AlignmentIteratorRelease( const AlignmentIterator * cself )
-{
-    rc_t rc = 0;
-    if ( cself == NULL )
-        rc = RC( rcAlign, rcIterator, rcReleasing, rcSelf, rcNull );
-    else
-    {
-        if ( KRefcountDrop( &cself->refcount, "AlignmentIterator" ) == krefWhack )
-        {
-            AlignmentIterator * self = ( AlignmentIterator * ) cself;
-            AlignMgrRelease ( self->amgr );
-            if ( self->free_on_whack )
-                free( self );
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC AlignmentIteratorNext ( AlignmentIterator *self )
-{
-    rc_t rc = 0;
-    if ( self == NULL )
-        rc = RC( rcAlign, rcIterator, rcPositioning, rcSelf, rcNull );
-    else
-    {
-        self->flags = 0;
-        self->rel_ref_pos++;
-
-        if ( self->rel_ref_pos >= self->ref_len )
-            rc = SILENT_RC( rcAlign, rcIterator, rcPositioning, rcItem, rcDone );
-        else
-        {
-            if ( self->skip > 0 )
-            {
-                self->flags |=  align_iter_skip;
-                self->skip--;
-            }
-            else if ( self->inserts > 0 )
-            {
-                self->seq_pos += ( self->inserts + 1 );
-                self->inserts = 0;
-            }
-            else
-            {
-                self->seq_pos++;
-            }
-            al_iter_adjust_next( self );
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT int32_t CC AlignmentIteratorState ( const AlignmentIterator *self,
-                                               INSDC_coord_zero *seq_pos )
-{
-    uint32_t res = align_iter_invalid;
-    if ( self != NULL )
-    {
-        INSDC_coord_zero pos = self->seq_pos;
-        if ( pos < self->read_len )
-        {
-            res = ( self->read[ pos ] & 0x0F );
-
-            if ( self->rel_ref_pos < 1 )
-                res |= align_iter_first;
-
-            if ( self->rel_ref_pos == ( self->ref_len - 1 ) )
-                res |= align_iter_last;
-
-            if ( !self->has_mismatch[ pos ] )
-                res |= align_iter_match;
-
-            res |= self->flags;
-
-            if ( seq_pos != NULL )
-                *seq_pos = pos;
-        }
-    }
-    return res;
-}
-
-
-LIB_EXPORT rc_t CC AlignmentIteratorPosition ( const AlignmentIterator *self,
-                                               INSDC_coord_zero *pos )
-{
-    rc_t rc = 0;
-    if ( self == NULL )
-        rc = RC( rcAlign, rcIterator, rcPositioning, rcSelf, rcNull );
-    else
-    {
-        if ( pos == NULL )
-            rc = RC( rcAlign, rcIterator, rcPositioning, rcParam, rcNull );
-        else
-        {
-            *pos = ( self->abs_ref_start + self->rel_ref_pos );
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT uint32_t CC AlignmentIteratorBasesInserted
-    ( const AlignmentIterator *self, const INSDC_4na_bin **bases )
-{
-    uint32_t res = 0;
-    if ( ( self != NULL )&&( bases != NULL ) )
-    {
-        res = self->inserts;
-        *bases = &( self->read[ self->seq_pos + 1 ] );
-    }
-    return res;
-}
-
-
-LIB_EXPORT uint32_t CC AlignmentIteratorBasesDeleted
-    ( const AlignmentIterator *self, INSDC_coord_zero *pos )
-{
-    uint32_t res = 0;
-    if ( ( self != NULL )&&( pos != NULL ) )
-    {
-        res = ( self->skip );
-        *pos = ( self->abs_ref_start + self->rel_ref_pos + 1 ); 
-    }
-    return res;
-}
-
-
-/* ============ private static functions ============ */
-static rc_t compute_posofs(  AlignmentIterator * self,
-    const bool * has_ref_offset, const int32_t * ref_offset, uint32_t ref_offset_len )
-{
-    rc_t rc = 0;
-
-    self->pos_ofs_idx = 0;
-    self->pos_ofs_cnt = ref_offset_len;
-    if ( ref_offset_len > 0 )
-    {
-        int32_t shift = 0;
-        uint32_t seq_position;
-        uint32_t src = 0;
-        uint32_t dst = 0;
-
-        if ( has_ref_offset[ 0 ] && ( ref_offset[ 0 ] < 0 ) )
-        {
-            shift = ref_offset[ src++ ];
-            self->seq_pos = -( shift );
-            self->pos_ofs_cnt--;
-        }
-
-        seq_position = self->seq_pos;
-        while( seq_position < self->read_len && rc == 0 )
-        {
-            if ( has_ref_offset[ seq_position ] )
-            {
-                /* we do have to process a reference-offset ! */
-                if ( src < ref_offset_len )
-                {
-                    /* we do have a ref-offset value available... */
-                    int32_t ro = ref_offset[ src++ ];
-                    if ( ro == 0 )
-                    {
-                        /* zero-values in REF_OFFSET are an error ! */
-                        rc = RC( rcAlign, rcIterator, rcConstructing, rcItem, rcNull );
-                    }
-                    else
-                    {
-                        /* ref-offset is positive: DELETE against the reference */
-                        self->pos_ofs[ dst ].pos = ( seq_position + shift - 1 );
-                        self->pos_ofs[ dst++ ].offset = ro;
-                        shift += ro;
-
-                        /* !!! CHANGE on May 04 2012 !!!
-                           the unused bits in has_ref_offset after an insert ( negative ro )
-                           are used now to hint the position of a "B"-cigar-string-case
-                           for cSRA-files created Complete-Genomic-Submissions
-                           that means we have to jump forward with seq_position in this case!
-                        */
-                        if ( ro < 0 )
-                        {
-                            seq_position -= ( ro + 1 );
-                        }
-                    }
-                }
-                else
-                {
-                    /* if has_ref_offset has more flags than ref_offset has values... */
-                    rc = RC( rcAlign, rcIterator, rcConstructing, rcItem, rcTooBig );
-                }
-            }
-            ++seq_position;
-        }
-
-/*      OUTMSG(( "pos_ofs:" ));
-        for ( src = 0; src < self->pos_ofs_cnt; ++src )
-        {
-            OUTMSG(( "[%u/%u]", self->pos_ofs[ src ].pos, self->pos_ofs[ src ].offset ));
-        }
-        OUTMSG(( "\n" )); */
-    }
-    return rc;
-}
-
-
-static void al_iter_adjust_next( AlignmentIterator * self )
-{
-    if ( self->pos_ofs_idx < self->pos_ofs_cnt )
-    {
-        if ( self->rel_ref_pos == self->pos_ofs[ self->pos_ofs_idx ].pos )
-        {
-            /* we have to adjust... */
-            int32_t ro = self->pos_ofs[ self->pos_ofs_idx++ ].offset;
-            if ( ro < 0 )
-            {
-                self->flags |= align_iter_insert;
-                self->inserts = (-ro);
-            }
-            else
-            {
-                self->flags |= align_iter_delete;
-                self->skip = ro;
-            }
-        }
-    }
-}
diff --git a/libs/align/align-access.c b/libs/align/align-access.c
deleted file mode 100644
index 642aff2..0000000
--- a/libs/align/align-access.c
+++ /dev/null
@@ -1,792 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <align/extern.h>
-#include <klib/rc.h>
-#include <klib/text.h>
-#include <align/align-access.h>
-#include <atomic32.h>
-
-#include <vfs/path.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#include "bam-priv.h"
-
-struct AlignAccessMgr
-{
-    atomic32_t refcount;
-};
-
-LIB_EXPORT rc_t CC AlignAccessMgrMake(const AlignAccessMgr **mgr) {
-    AlignAccessMgr *self = malloc(sizeof(*self));
-
-    *mgr = self;
-    if (self != NULL) {
-        atomic32_set(&self->refcount, 1);
-        return 0;
-    }
-    return RC(rcAlign, rcMgr, rcConstructing, rcMemory, rcExhausted);
-}
-
-LIB_EXPORT rc_t CC AlignAccessMgrAddRef( const AlignAccessMgr *self ) {
-    if (self != NULL)
-        atomic32_inc(&((AlignAccessMgr *)self)->refcount);
-    return 0;
-}
-
-static
-rc_t CC AlignAccessMgrWhack(AlignAccessMgr *self) {
-    return 0;
-}
-
-LIB_EXPORT rc_t CC AlignAccessMgrRelease(const AlignAccessMgr *cself) {
-    rc_t rc = 0;
-    AlignAccessMgr *self = (AlignAccessMgr *)cself;
-    
-    if (cself != NULL) {
-        if (atomic32_dec_and_test(&self->refcount)) {
-            rc = AlignAccessMgrWhack(self);
-            if (rc)
-                atomic32_set(&self->refcount, 1);
-            else
-                free(self);
-        }
-    }
-    return rc;
-}
-
-struct AlignAccessDB {
-    atomic32_t refcount;
-    const AlignAccessMgr *mgr;
-    const BAMFile *innerSelf;
-};
-
-LIB_EXPORT rc_t CC AlignAccessMgrMakeBAMDB(const AlignAccessMgr *self, const AlignAccessDB **db, const VPath *bam) {
-    AlignAccessDB *lhs = malloc(sizeof(*lhs));
-    rc_t rc;
-
-    if (lhs == NULL)
-        return RC(rcAlign, rcMgr, rcConstructing, rcMemory, rcExhausted);
-    
-    rc = BAMFileMakeWithVPath(&lhs->innerSelf, bam);
-    if (rc) {
-        free(lhs);
-        return rc;
-    }
-    lhs->mgr = self;
-    AlignAccessMgrAddRef(lhs->mgr);
-    atomic32_set(&lhs->refcount, 1);
-    
-    *db = lhs;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC AlignAccessMgrMakeIndexBAMDB(const AlignAccessMgr *self, const AlignAccessDB **db, const VPath *bam, const VPath *bam_index) {
-    rc_t rc = AlignAccessMgrMakeBAMDB(self, db, bam);
-    if (rc == 0) {
-        rc = BAMFileOpenIndexWithVPath((**db).innerSelf, bam_index);
-        if (rc == 0)
-            return 0;
-        AlignAccessDBRelease(*db);
-        *db = NULL;
-    }
-    return rc;
-}
-
-
-/* ExportBAMFile
- *  export the BAMFile object in use by the AlignAccessDB, if any
- *  must be released via BAMFileRelease
- */
-LIB_EXPORT rc_t CC AlignAccessDBExportBAMFile ( const AlignAccessDB *self, const BAMFile **result )
-{
-    rc_t rc;
-
-    if ( result == NULL )
-        rc = RC ( rcAlign, rcTable, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcAlign, rcTable, rcAccessing, rcSelf, rcNull );
-        else if ( self -> innerSelf == NULL )
-            rc = RC ( rcAlign, rcTable, rcAccessing, rcType, rcIncorrect );
-        else
-        {
-            rc = BAMFileAddRef ( * result = self -> innerSelf );
-            if ( rc == 0 )
-                return 0;
-        }
-
-        * result = NULL;
-    }
-
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC AlignAccessDBAddRef(const AlignAccessDB *cself) {
-    if (cself != NULL)
-        atomic32_inc(&((AlignAccessDB *)cself)->refcount);
-    return 0;
-}
-
-static rc_t CC AlignAccessDBWhack(AlignAccessDB *self) {
-    rc_t rc;
-    
-    rc = BAMFileRelease(self->innerSelf);
-    if (rc)
-        return rc;
-    return AlignAccessMgrRelease(self->mgr);
-}
-
-LIB_EXPORT rc_t CC AlignAccessDBRelease(const AlignAccessDB *cself) {
-    rc_t rc = 0;
-    AlignAccessDB *self = (AlignAccessDB *)cself;
-    
-    if (cself != NULL) {
-        if (atomic32_dec_and_test(&self->refcount)) {
-            rc = AlignAccessDBWhack(self);
-            if (rc)
-                atomic32_set(&self->refcount, 1);
-            else
-                free(self);
-        }
-    }
-    return rc;
-}
-
-struct AlignAccessRefSeqEnumerator {
-    atomic32_t refcount;
-    const AlignAccessDB *parent;
-    int cur, end;
-};
-
-LIB_EXPORT rc_t CC AlignAccessDBEnumerateRefSequences(const AlignAccessDB *self, AlignAccessRefSeqEnumerator **refseq_enum) {
-    AlignAccessRefSeqEnumerator *lhs;
-    unsigned cur = 0;
-    unsigned end;
-    
-    BAMFileGetRefSeqCount(self->innerSelf, &end);
-    if (BAMFileIsIndexed(self->innerSelf)) {
-        while (cur != end && BAMFileIndexHasRefSeqId(self->innerSelf, cur) == 0)
-            ++cur;
-        if (cur == end)
-            return AlignAccessRefSeqEnumeratorEOFCode;
-    }
-    lhs = malloc(sizeof(*lhs));
-    *refseq_enum = lhs;
-    if (lhs != NULL) {
-        lhs->parent = self;
-        AlignAccessDBAddRef(lhs->parent);
-        lhs->cur = cur;
-        lhs->end = end;
-        atomic32_set(&lhs->refcount, 1);
-        return 0;
-    }
-    return RC(rcAlign, rcDatabase, rcConstructing, rcMemory, rcExhausted);
-}
-
-LIB_EXPORT rc_t CC AlignAccessRefSeqEnumeratorAddRef(const AlignAccessRefSeqEnumerator *self) {
-    if (self != NULL)
-        atomic32_inc(&((AlignAccessRefSeqEnumerator *)self)->refcount);
-    return 0;
-}
-
-static
-rc_t CC AlignAccessRefSeqEnumeratorWhack(AlignAccessRefSeqEnumerator *self) {
-    return AlignAccessDBRelease(self->parent);
-}
-
-LIB_EXPORT rc_t CC AlignAccessRefSeqEnumeratorRelease(const AlignAccessRefSeqEnumerator *cself) {
-    rc_t rc = 0;
-    AlignAccessRefSeqEnumerator *self = (AlignAccessRefSeqEnumerator *)cself;
-    
-    if (cself != NULL) {
-        if (atomic32_dec_and_test(&self->refcount)) {
-            rc = AlignAccessRefSeqEnumeratorWhack(self);
-            if (rc)
-                atomic32_set(&self->refcount, 1);
-            else
-                free(self);
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC AlignAccessRefSeqEnumeratorGetID(const AlignAccessRefSeqEnumerator *cself, char *id_buffer, size_t buffer_size, size_t *id_size) {
-    rc_t rc = 0;
-    const BAMRefSeq *cur;
-    size_t id_act_size;
-    
-    if (cself == NULL)
-        return 0;
-    if (id_buffer == NULL && id_size == NULL)
-        return RC(rcAlign, rcTable, rcAccessing, rcParam, rcNull);
-    rc = BAMFileGetRefSeq(cself->parent->innerSelf, cself->cur, &cur);
-    if (rc)
-        return rc;
-    id_act_size = string_size( cur->name ) + 1;
-    if (id_size != NULL)
-        *id_size = id_act_size;
-    if (id_buffer != NULL) {
-        if (buffer_size >= id_act_size)
-            memcpy(id_buffer, cur->name, id_act_size);
-        else
-            rc = RC(rcAlign, rcTable, rcAccessing, rcBuffer, rcInsufficient);
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC AlignAccessRefSeqEnumeratorGetLength ( const AlignAccessRefSeqEnumerator *cself,
-                                           uint64_t *length )
-{
-    rc_t rc = 0;
-    const BAMRefSeq *cur;
-    
-    if (cself == NULL)
-        return 0;
-    if (length == NULL)
-        return RC(rcAlign, rcTable, rcAccessing, rcParam, rcNull);
-    rc = BAMFileGetRefSeq(cself->parent->innerSelf, cself->cur, &cur);
-    if (rc)
-        return rc;
-    *length = cur->length;
-    
-    return 0;
-}
-
-LIB_EXPORT rc_t CC AlignAccessRefSeqEnumeratorNext(const AlignAccessRefSeqEnumerator *cself) {
-    AlignAccessRefSeqEnumerator *self = (AlignAccessRefSeqEnumerator *)cself;
-    
-    if (cself->cur + 1 >= cself->end)
-        return AlignAccessRefSeqEnumeratorEOFCode;
-    
-    ++self->cur;
-    if (!BAMFileIsIndexed(cself->parent->innerSelf))
-    	return 0;
-	if (BAMFileIndexHasRefSeqId(cself->parent->innerSelf, cself->cur))
-		return 0;
-	return AlignAccessRefSeqEnumeratorNext(cself);
-}
-
-struct AlignAccessAlignmentEnumerator {
-    const AlignAccessDB *parent;
-    const BAMAlignment *innerSelf;
-    uint64_t endpos;
-    uint64_t startpos;
-    BAMFilePosition pos;
-    atomic32_t refcount;
-    int atend;
-    int refSeqID;
-};
-
-static rc_t CC AlignAccessDBMakeEnumerator(const AlignAccessDB *self, AlignAccessAlignmentEnumerator **align_enum) {
-    AlignAccessAlignmentEnumerator *lhs = malloc(sizeof(*lhs));
-    
-    *align_enum = lhs;
-    if (lhs == NULL)
-        return RC(rcAlign, rcTable, rcConstructing, rcMemory, rcExhausted);
-    
-    lhs->innerSelf = NULL;
-    lhs->parent = self;
-    AlignAccessDBAddRef(lhs->parent);
-    atomic32_set(&lhs->refcount, 1);
-    lhs->atend = 0;
-    lhs->refSeqID = -1;
-    lhs->endpos = 0;
-    lhs->startpos = 0;
-    
-    return 0;
-}
-
-LIB_EXPORT rc_t CC AlignAccessDBEnumerateAlignments(const AlignAccessDB *self, AlignAccessAlignmentEnumerator **align_enum) {
-    rc_t rc;
-    
-    *align_enum = NULL;
-
-    rc = BAMFileRewind(self->innerSelf);
-    if (rc)
-        return rc;
-    rc = AlignAccessDBMakeEnumerator(self, align_enum);
-    if (rc)
-        return rc;
-    return AlignAccessAlignmentEnumeratorNext(*align_enum);
-}
-
-LIB_EXPORT rc_t CC AlignAccessDBWindowedAlignments(
-                                     const AlignAccessDB *self,
-                                     AlignAccessAlignmentEnumerator **align_enum,
-                                     const char *refSeqName, uint64_t pos, uint64_t wsize
-) {
-    AlignAccessAlignmentEnumerator *lhs;
-    unsigned i, n;
-    const BAMRefSeq *rs;
-    uint64_t endpos = pos + wsize;
-    rc_t rc;
-    
-    *align_enum = NULL;
-
-    BAMFileGetRefSeqCount(self->innerSelf, &n);
-    for (i = 0; i != n; ++i) {
-        BAMFileGetRefSeq(self->innerSelf, i, &rs);
-        if (strcmp(refSeqName, rs->name) == 0)
-            break;
-    }
-    if (i == n || pos >= rs->length) {
-        return RC(rcAlign, rcTable, rcConstructing, rcParam, rcInvalid);
-    }
-
-    if (wsize == 0 || endpos > rs->length)
-        endpos = rs->length;
-
-    rc = BAMFileSeek(self->innerSelf, i, pos, endpos);
-    if (rc) {
-        if (GetRCState(rc) == rcNotFound && GetRCObject(rc) == rcData)
-            rc = AlignAccessAlignmentEnumeratorEOFCode;
-        return rc;
-    }
-    rc = AlignAccessDBMakeEnumerator(self, &lhs);
-    if (rc)
-        return rc;
-
-    lhs->refSeqID = i;
-    lhs->endpos = endpos;
-    lhs->startpos = pos;
-
-    *align_enum = lhs;
-    return AlignAccessAlignmentEnumeratorNext(*align_enum);
-}
-
-LIB_EXPORT rc_t CC AlignAccessAlignmentEnumeratorNext(const AlignAccessAlignmentEnumerator *cself) {
-    rc_t rc;
-    AlignAccessAlignmentEnumerator *self = (AlignAccessAlignmentEnumerator *)cself;
-    int32_t refSeqID;
-
-AGAIN:
-    if (self->innerSelf != NULL) {
-        BAMAlignmentRelease(self->innerSelf);
-        self->innerSelf = NULL;
-    }
-    if (self->atend != 0)
-        return AlignAccessAlignmentEnumeratorEOFCode;
-    
-    BAMFileGetPosition(self->parent->innerSelf, &self->pos);
-    rc = BAMFileRead(self->parent->innerSelf, &self->innerSelf);
-    if (rc) {
-        if (GetRCState(rc) == rcNotFound && GetRCObject(rc) == rcRow) {
-            self->atend = 1;
-            rc = AlignAccessAlignmentEnumeratorEOFCode;
-        }
-        return rc;
-    }
-    if (self->refSeqID == -1)
-        return 0;
-    
-    BAMAlignmentGetRefSeqId(self->innerSelf, &refSeqID);
-    if (self->refSeqID != refSeqID) {
-        self->atend = 1;
-        rc = AlignAccessAlignmentEnumeratorEOFCode;
-    }
-    else if (self->endpos != 0) {
-        int64_t pos;
-        uint32_t length;
-        uint64_t endpos;
-        
-        BAMAlignmentGetPosition2(self->innerSelf, &pos, &length);
-        if (pos < 0 || pos >= (int64_t)self->endpos) {
-            self->atend = 1;
-            rc = AlignAccessAlignmentEnumeratorEOFCode;
-        }
-        else {
-            endpos = (uint64_t)pos + length;
-            if (endpos <= self->startpos)
-                goto AGAIN;
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC AlignAccessAlignmentEnumeratorAddRef ( const AlignAccessAlignmentEnumerator *self ) {
-    if (self != NULL)
-        atomic32_inc(&((AlignAccessAlignmentEnumerator *)self)->refcount);
-    return 0;
-}
-
-static
-rc_t CC AlignAccessAlignmentEnumeratorWhack(AlignAccessAlignmentEnumerator *self) {
-    if (self->innerSelf)
-        BAMAlignmentRelease(self->innerSelf);
-    AlignAccessDBRelease(self->parent);
-    return 0;
-}
-
-LIB_EXPORT rc_t CC AlignAccessAlignmentEnumeratorRelease ( const AlignAccessAlignmentEnumerator *cself ) {
-    rc_t rc = 0;
-    AlignAccessAlignmentEnumerator *self = (AlignAccessAlignmentEnumerator *)cself;
-    
-    if (cself != NULL) {
-        if (atomic32_dec_and_test(&self->refcount)) {
-            rc = AlignAccessAlignmentEnumeratorWhack(self);
-            if (rc)
-                atomic32_set(&self->refcount, 1);
-            else
-                free(self);
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC AlignAccessAlignmentEnumeratorGetRefSeqID(
-                                               const AlignAccessAlignmentEnumerator *self,
-                                               char *id_buffer, size_t buffer_size, size_t *id_size
-) {
-    rc_t rc = 0;
-    int32_t id;
-    const BAMRefSeq *cur;
-    size_t id_act_size;
-    
-    if (self == NULL)
-        return 0;
-    if (id_buffer == NULL && id_size == NULL)
-        return RC(rcAlign, rcTable, rcAccessing, rcParam, rcNull);
-    rc = BAMAlignmentGetRefSeqId(self->innerSelf, &id);
-    if (rc)
-        return rc;
-    if (id < 0)
-        return RC(rcAlign, rcTable, rcAccessing, rcData, rcNotFound);
-    rc = BAMFileGetRefSeq(self->parent->innerSelf, id, &cur);
-    if (rc)
-        return rc;
-    id_act_size = string_size( cur->name ) + 1;
-    if (id_size != NULL)
-        *id_size = id_act_size;
-    if (id_buffer != NULL) {
-        if (buffer_size >= id_act_size)
-            memcpy(id_buffer, cur->name, id_act_size);
-        else
-            rc = RC(rcAlign, rcTable, rcAccessing, rcBuffer, rcInsufficient);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC AlignAccessAlignmentEnumeratorGetRefSeqPos(
-                                                const AlignAccessAlignmentEnumerator *self,
-                                                uint64_t *start_pos
-) {
-    rc_t rc;
-    int64_t pos;
-    
-    rc = BAMAlignmentGetPosition(self->innerSelf, &pos);
-    if (rc)
-        return rc;
-    if (pos < 0)
-        return RC(rcAlign, rcTable, rcAccessing, rcData, rcNotFound);
-
-    *start_pos = pos;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC AlignAccessAlignmentEnumeratorGetMapQuality(
-                                                 const AlignAccessAlignmentEnumerator *self,
-                                                 uint8_t *score
-) {
-    uint8_t y = 0;
-    
-    if (self && self->innerSelf) {
-        uint16_t flags;
-    
-        BAMAlignmentGetFlags(self->innerSelf, &flags);
-        if ((flags & BAMFlags_SelfIsUnmapped) == 0)
-            BAMAlignmentGetMapQuality(self->innerSelf, &y);
-	}
-    if (score) *score = y;
-    
-    return 0;
-}
-
-
-LIB_EXPORT rc_t CC AlignAccessAlignmentEnumeratorGetShortSeqAccessionID(
-                                                        const AlignAccessAlignmentEnumerator *self,
-                                                        char *id_buffer, size_t buffer_size, size_t *id_size
-) {
-    rc_t rc;
-    size_t id_act_size;
-    const char *readGroupName;
-    
-    if (self == NULL)
-        return 0;
-    if (id_buffer == NULL && id_size == NULL)
-        return RC(rcAlign, rcTable, rcAccessing, rcParam, rcNull);
-    
-    rc = BAMAlignmentGetReadGroupName(self->innerSelf, &readGroupName);
-    if (rc)
-        return rc;
-    if (readGroupName == 0)
-        *id_size = 0;
-    else {
-        id_act_size = string_size( readGroupName ) + 1;
-        if (id_size != NULL)
-            *id_size = id_act_size;
-        if (id_buffer != NULL) {
-            if (buffer_size >= id_act_size)
-                memcpy(id_buffer, readGroupName, id_act_size);
-            else
-                rc = RC(rcAlign, rcTable, rcAccessing, rcBuffer, rcInsufficient);
-        }
-    }
-    return rc;    
-}
-
-LIB_EXPORT rc_t CC AlignAccessAlignmentEnumeratorGetShortSeqID(
-                                                 const AlignAccessAlignmentEnumerator *self,
-                                                 char *id_buffer, size_t buffer_size, size_t *id_size
-) {
-    rc_t rc;
-    size_t id_act_size;
-    const char *readName;
-    
-    if (self == NULL)
-        return 0;
-    if (id_buffer == NULL && id_size == NULL)
-        return RC(rcAlign, rcTable, rcAccessing, rcParam, rcNull);
-    
-    rc = BAMAlignmentGetReadName(self->innerSelf, &readName);
-    if (rc)
-        return rc;
-
-    id_act_size = string_size( readName ) + 1;
-    if (id_size != NULL)
-        *id_size = id_act_size;
-    if (id_buffer != NULL) {
-        if (buffer_size >= id_act_size)
-            memcpy(id_buffer, readName, id_act_size);
-        else
-            rc = RC(rcAlign, rcTable, rcAccessing, rcBuffer, rcInsufficient);
-    }
-    return rc;    
-}
-
-LIB_EXPORT rc_t CC AlignAccessAlignmentEnumeratorGetCIGAR(
-    const AlignAccessAlignmentEnumerator *self,
-    uint64_t *start_pos, char *cigar_buffer, size_t buffer_size, size_t *cigar_size
-) {
-    int i;
-    unsigned n;
-    rc_t rc;
-    uint32_t sp = 0;
-    char *cigbuf = cigar_buffer;
-    const char *const endp = cigar_buffer + buffer_size;
-    
-    if (cigar_buffer == NULL && cigar_size == NULL) {
-        /* no result can be returned */
-        rc = RC(rcAlign, rcTable, rcAccessing, rcParam, rcNull);
-    }
-    
-    rc = BAMAlignmentGetCigarCount(self->innerSelf, &n);
-    if (rc)
-        return rc;
-    if (n == 0) {
-        if (cigar_size != NULL)
-            *cigar_size = 0;
-        if (start_pos != NULL)
-            *start_pos = 0;
-        cigbuf[0] = 0;
-        return 0;
-    }
-    for (i = 0; i != n; ++i) {
-        char cig1[20];
-        BAMCigarType op;
-        uint32_t len;
-        int cig1len;
-        
-        BAMAlignmentGetCigar(self->innerSelf, i, &op, &len);
-        if (i == 0 && op == ct_SoftClip) {
-            sp = len;
-            continue;
-        }
-        if (i == 0 && op == ct_HardClip)
-            continue;
-        if (i == n - 1 && (op == ct_SoftClip || op == ct_HardClip))
-            continue;
-        
-        cig1len = sprintf(cig1, "%c%u", op, len);
-        if (cigbuf + cig1len < endp) {
-            if (cigar_buffer != NULL) {
-                memcpy(cigbuf, cig1, cig1len);
-                cigbuf[cig1len] = 0;
-            }
-        }
-        else
-            rc = RC(rcAlign, rcTable, rcAccessing, rcBuffer, rcInsufficient);
-        cigbuf += cig1len;
-    }
-    if (cigar_size != NULL)
-        *cigar_size = cigbuf - cigar_buffer + 1;
-    if (start_pos != NULL)
-        *start_pos = sp;
-    return rc;
-}
-
-LIB_EXPORT rc_t CC AlignAccessAlignmentEnumeratorGetShortSequence(
-                                                    const AlignAccessAlignmentEnumerator *self,
-                                                    char *seq_buffer, size_t buffer_size, size_t *seq_size
-) {
-    rc_t rc;
-    uint32_t act_size;
-
-    if (self == NULL)
-        return 0;
-    if (seq_buffer == NULL && seq_size == NULL)
-        return RC(rcAlign, rcTable, rcAccessing, rcParam, rcNull);
-    
-    rc = BAMAlignmentGetReadLength(self->innerSelf, &act_size);
-    if (rc)
-        return rc;
-    
-    ++act_size;
-    if (seq_size != NULL)
-        *seq_size = act_size;
-    
-    if (seq_buffer != NULL) {
-        if (buffer_size >= act_size) {
-            rc = BAMAlignmentGetSequence(self->innerSelf, seq_buffer);
-            seq_buffer[act_size - 1] = 0;
-        }
-        else
-            rc = RC(rcAlign, rcTable, rcAccessing, rcBuffer, rcInsufficient);
-    }
-    return rc;    
-}
-
-LIB_EXPORT rc_t CC AlignAccessAlignmentEnumeratorGetStrandDirection(
-                                                      const AlignAccessAlignmentEnumerator *self,
-                                                      AlignmentStrandDirection *result
-) {
-    uint16_t flags;
-    rc_t rc;
-    
-    if (result == NULL)
-        return RC(rcAlign, rcTable, rcAccessing, rcParam, rcNull);
-
-    *result = asd_Unknown;
-    if (self == NULL)
-        return 0;
-    
-    rc = BAMAlignmentGetFlags(self->innerSelf, &flags);
-    if (rc)
-        return rc;
-    
-    *result = ((flags & BAMFlags_SelfIsReverse) == BAMFlags_SelfIsReverse) ? asd_Reverse : asd_Forward;
-    
-    return 0;
-}
-
-LIB_EXPORT rc_t CC AlignAccessAlignmentEnumeratorGetIsPaired(const AlignAccessAlignmentEnumerator *self,
-                                               bool *result)
-{
-    uint16_t flags;
-    rc_t rc;
-    
-    if (result == NULL)
-        return RC(rcAlign, rcTable, rcAccessing, rcParam, rcNull);
-    
-    *result = asd_Unknown;
-    if (self == NULL)
-        return 0;
-    
-    rc = BAMAlignmentGetFlags(self->innerSelf, &flags);
-    if (rc)
-        return rc;
-    
-    *result = ((flags & BAMFlags_IsMappedAsPair) == 0) ? false : true;
-    
-    return 0;
-}
-
-LIB_EXPORT rc_t CC AlignAccessAlignmentEnumeratorGetIsFirstInPair(const AlignAccessAlignmentEnumerator *self,
-                                                    bool *result)
-{
-    uint16_t flags;
-    rc_t rc;
-    
-    if (result == NULL)
-        return RC(rcAlign, rcTable, rcAccessing, rcParam, rcNull);
-    
-    if (self == NULL)
-        return 0;
-    
-    rc = BAMAlignmentGetFlags(self->innerSelf, &flags);
-    if (rc)
-        return rc;
-    
-    *result = ((flags & BAMFlags_IsFirst) == 0) ? false : true;
-    
-    return 0;
-}
-
-LIB_EXPORT rc_t CC AlignAccessAlignmentEnumeratorGetIsSecondInPair(const AlignAccessAlignmentEnumerator *self,
-                                                     bool *result)
-{
-    uint16_t flags;
-    rc_t rc;
-    
-    if (result == NULL)
-        return RC(rcAlign, rcTable, rcAccessing, rcParam, rcNull);
-    
-    if (self == NULL)
-        return 0;
-    
-    rc = BAMAlignmentGetFlags(self->innerSelf, &flags);
-    if (rc)
-        return rc;
-    
-    *result = ((flags & BAMFlags_IsSecond) == 0) ? false : true;
-    
-    return 0;
-}
-
-LIB_EXPORT rc_t CC AlignAccessAlignmentEnumeratorGetRecordID(const AlignAccessAlignmentEnumerator *self, uint64_t *result)
-{
-    if (result == NULL)
-        return RC(rcAlign, rcTable, rcAccessing, rcParam, rcNull);
-    
-    if (self == NULL)
-        return 0;
-    
-    *(BAMFilePosition *)result = self->pos;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC AlignAccessAlignmentEnumeratorGetBAMAlignment(const AlignAccessAlignmentEnumerator *self, const BAMAlignment **result)
-{
-    *result = self->innerSelf;
-    return BAMAlignmentAddRef(self->innerSelf);
-}
diff --git a/libs/align/align_mgr.c b/libs/align/align_mgr.c
deleted file mode 100644
index c700463..0000000
--- a/libs/align/align_mgr.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <align/extern.h>
-
-#include <klib/rc.h>
-#include <klib/container.h>
-#include <klib/refcount.h>
-#include <klib/sort.h>
-#include <insdc/insdc.h>
-#include <align/iterator.h>
-#include <align/manager.h>
-#include <sysalloc.h>
-
-#include "debug.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-
-struct AlignMgr
-{
-    KRefcount refcount;
-    /* what else will be here ? */
-};
-
-
-LIB_EXPORT rc_t CC AlignMgrMakeRead ( const struct AlignMgr **self )
-{
-    rc_t rc = 0;
-    if ( self == NULL )
-        rc = RC( rcAlign, rcIterator, rcConstructing, rcSelf, rcNull );
-    else
-    {
-        AlignMgr * alm = calloc( sizeof * alm, 1 );
-        if ( alm == NULL )
-            rc = RC( rcAlign, rcIterator, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            KRefcountInit( &alm->refcount, 1, "AlignMgr", "Make", "align" );
-        }
-
-        if ( rc == 0 )
-            *self = alm;
-        else
-            free( alm );
-    }
-    return rc;
-
-}
-
-
-LIB_EXPORT rc_t CC AlignMgrAddRef ( const AlignMgr *self )
-{
-    rc_t rc = 0;
-    if ( self == NULL )
-        rc = RC( rcAlign, rcIterator, rcAttaching, rcSelf, rcNull );
-    else
-    {
-        if ( KRefcountAdd( &self->refcount, "AlignMgr" ) != krefOkay )
-        {
-            rc = RC( rcAlign, rcIterator, rcAttaching, rcError, rcUnexpected );
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC AlignMgrRelease ( const AlignMgr *cself )
-{
-    rc_t rc = 0;
-    if ( cself == NULL )
-        rc = RC( rcAlign, rcIterator, rcReleasing, rcSelf, rcNull );
-    else
-    {
-        if ( KRefcountDrop( &cself->refcount, "AlignMgr" ) == krefWhack )
-        {
-            AlignMgr * self = ( AlignMgr * ) cself;
-            free( self );
-        }
-    }
-    return rc;
-
-}
diff --git a/libs/align/bam-priv.h b/libs/align/bam-priv.h
deleted file mode 100644
index 1b2d37c..0000000
--- a/libs/align/bam-priv.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#ifndef _h_bam_priv_
-#define _h_bam_priv_
-
-#ifndef _h_align_bam_
-#include <align/bam.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* Get the aligned position on the Ref. Seq.
- */
-rc_t BAMAlignmentGetNthPosition(const BAMAlignment *cself, uint32_t n, int64_t *pos);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_bam_priv_ */
diff --git a/libs/align/bam.c b/libs/align/bam.c
deleted file mode 100644
index 3fbb09f..0000000
--- a/libs/align/bam.c
+++ /dev/null
@@ -1,4906 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <align/extern.h>
-#include <klib/defs.h>
-#include <klib/debug.h>
-#include <klib/sort.h>
-#include <klib/rc.h>
-#include <kfs/file.h>
-#include <kfs/directory.h>
-#include <kfs/mmap.h>
-#include <klib/printf.h>
-#include <klib/log.h>
-#include <klib/text.h>
-#include <klib/refcount.h>
-#include <sysalloc.h>
-
-#include <atomic32.h>
-#include <strtol.h>
-
-#include <align/bam.h>
-#include "bam-priv.h"
-
-#include <vfs/path.h>
-#include <vfs/path-priv.h>
-#include <kfs/kfs-priv.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-#if 1
-/*_DEBUGGING*/
-#include <stdio.h>
-#endif
-
-#include <endian.h>
-#include <byteswap.h>
-
-#include <zlib.h>
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-static uint16_t LE2HUI16(void const *X) { uint16_t y; memcpy(&y, X, sizeof(y)); return y; }
-static uint32_t LE2HUI32(void const *X) { uint32_t y; memcpy(&y, X, sizeof(y)); return y; }
-static uint64_t LE2HUI64(void const *X) { uint64_t y; memcpy(&y, X, sizeof(y)); return y; }
-static  int16_t  LE2HI16(void const *X) {  int16_t y; memcpy(&y, X, sizeof(y)); return y; }
-static  int32_t  LE2HI32(void const *X) {  int32_t y; memcpy(&y, X, sizeof(y)); return y; }
-static  int64_t  LE2HI64(void const *X) {  int64_t y; memcpy(&y, X, sizeof(y)); return y; }
-#endif
-#if __BYTE_ORDER == __BIG_ENDIAN
-static uint16_t LE2HUI16(void const *X) { uint16_t y; memcpy(&y, X, sizeof(y)); return (uint16_t)bswap_16(y); }
-static uint32_t LE2HUI32(void const *X) { uint32_t y; memcpy(&y, X, sizeof(y)); return (uint32_t)bswap_32(y); }
-static uint64_t LE2HUI64(void const *X) { uint64_t y; memcpy(&y, X, sizeof(y)); return (uint64_t)bswap_64(y); }
-static  int16_t  LE2HI16(void const *X) {  int16_t y; memcpy(&y, X, sizeof(y)); return ( int16_t)bswap_16(y); }
-static  int32_t  LE2HI32(void const *X) {  int32_t y; memcpy(&y, X, sizeof(y)); return ( int32_t)bswap_32(y); }
-static  int64_t  LE2HI64(void const *X) {  int64_t y; memcpy(&y, X, sizeof(y)); return ( int64_t)bswap_64(y); }
-#endif
-
-typedef struct BAMIndex BAMIndex;
-typedef struct BGZFile BGZFile;
-
-/* MARK: BGZFile *** Start *** */
-
-#define VALIDATE_BGZF_HEADER 1
-#if (ZLIB_VERNUM < 0x1230)
-#undef VALIDATE_BGZF_HEADER
-#warning "zlib too old, inflateGetHeader not available, not validating BGZF headers"
-#else
-#endif
-
-#define ZLIB_BLOCK_SIZE ( 64 * 1024 )
-typedef uint8_t zlib_block_t[ZLIB_BLOCK_SIZE];
-
-#define MEM_ALIGN_SIZE ( 64 * 1024 )
-/* MEM_CHUNK_SIZE must be an integer multiple of ZLIB_BLOCK_SIZE.
- * The multiple must be >= 2 shouldn't be < 3.
- */
-#define MEM_CHUNK_SIZE ( 256 * ZLIB_BLOCK_SIZE )
-#define CG_NUM_SEGS 4
-
-typedef struct BGZFile_vt_s {
-    rc_t (*FileRead)(void *, zlib_block_t, unsigned *);
-    uint64_t (*FileGetPos)(void const *);
-    float (*FileProPos)(void const *);
-    uint64_t (*FileGetSize)(void const *);
-    rc_t (*FileSetPos)(void *, uint64_t);
-    void (*FileWhack)(void *);
-} BGZFile_vt;
-
-struct BGZFile {
-    uint64_t fsize;
-    uint64_t fpos;  /* position in file of first byte in buffer */
-    const uint8_t *buf;   /* page aligned or memmapped */
-    const KFile *kfp;
-    uint8_t *_buf;  /* allocated */
-    unsigned malign;
-    size_t bcount;  /* number of valid bytes in buffer */
-    uint32_t bpos;  /* position in buffer of read head */
-    z_stream zs;
-};
-
-static
-rc_t BGZFileGetMoreBytes(BGZFile *self)
-{
-    rc_t rc;
-    
-    self->fpos += self->bpos;
-    self->bpos &= (MEM_ALIGN_SIZE - 1);
-    self->fpos -= self->bpos;
-
-    rc = KFileRead(self->kfp, self->fpos, self->_buf + self->malign,
-                   MEM_CHUNK_SIZE, &self->bcount);
-    if (rc) {
-        DBGMSG(DBG_ALIGN, DBG_FLAG(DBG_ALIGN_BGZF), ("Error reading BAM file: %R\n", rc));
-        return rc;
-    }
-    if (self->bcount == 0 || self->bcount == self->bpos)
-        return RC(rcAlign, rcFile, rcReading, rcData, rcInsufficient);
-
-    self->zs.avail_in = (uInt)(self->bcount - self->bpos);
-    self->zs.next_in = (Bytef *)&self->buf[self->bpos];
-    DBGMSG(DBG_ALIGN, DBG_FLAG(DBG_ALIGN_BGZF), ("Read %u bytes from BAM file at position %lu\n", self->zs.avail_in, self->fpos));
-    
-    return 0;
-}
-
-static
-rc_t BGZFileRead(BGZFile *self, zlib_block_t dst, unsigned *pNumRead)
-{
-#if VALIDATE_BGZF_HEADER
-    uint8_t extra[256];
-    gz_header head;
-#endif
-    rc_t rc = 0;
-    unsigned loops;
-    int zr;
-    
-    *pNumRead = 0;
-    if (self->bcount == 0 || self->zs.avail_in == 0) {
-        rc = BGZFileGetMoreBytes(self);
-        if (rc)
-            return rc;
-    }
-
-#if VALIDATE_BGZF_HEADER
-    memset(&head, 0, sizeof(head));
-    head.extra = extra;
-    head.extra_max = sizeof(extra);
-    
-    zr = inflateGetHeader(&self->zs, &head);
-    assert(zr == Z_OK);
-#endif
-    
-    self->zs.next_out = (Bytef *)dst;
-    self->zs.avail_out = sizeof(zlib_block_t);
-
-    for (loops = 0; loops != 2; ++loops) {
-        {
-            uLong const initial = self->zs.total_in;
-            
-            zr = inflate(&self->zs, Z_FINISH);
-            {
-                uLong const final = self->zs.total_in;
-                uLong const len = final - initial;
-                
-                self->bpos += len;
-            }
-        }
-        assert(self->zs.avail_in == self->bcount - self->bpos);
-        
-        switch (zr) {
-        case Z_OK:
-        case Z_BUF_ERROR:
-            rc = BGZFileGetMoreBytes(self);
-            if (rc) {
-                if (GetRCObject(rc) == rcData && GetRCState(rc) == rcInsufficient) {
-                    DBGMSG(DBG_ALIGN, DBG_FLAG(DBG_ALIGN_BGZF), ("EOF in Zlib block after %lu bytes\n", self->fpos + self->bpos));
-                    rc = RC(rcAlign, rcFile, rcReading, rcFile, rcTooShort);
-                }
-                return rc;
-            }
-            break;
-        case Z_STREAM_END:
-            DBGMSG(DBG_ALIGN, DBG_FLAG(DBG_ALIGN_BGZF), ("Zlib block size (before/after): %u/%u\n", self->zs.total_in, self->zs.total_out));
-#if VALIDATE_BGZF_HEADER
-            if (head.done) {
-                unsigned const extra_len = head.extra_len;
-                unsigned i;
-                unsigned bsize = 0;
-                
-                DBGMSG(DBG_ALIGN, DBG_FLAG(DBG_ALIGN_BGZF), ("GZIP Header extra length: %u\n", extra_len));
-                for (i = 0; i < extra_len; ) {
-                    uint8_t const si1 = extra[i + 0];
-                    uint8_t const si2 = extra[i + 1];
-                    unsigned const slen = LE2HUI16(&extra[i + 2]);
-                    
-                    DBGMSG(DBG_ALIGN, DBG_FLAG(DBG_ALIGN_BGZF), ("GZIP Header extra: %c%c(%u)\n", si1, si2, slen));
-                    if (si1 == 'B' && si2 == 'C') {
-                        bsize = 1 + LE2HUI16(&extra[i + 4]);
-                        DBGMSG(DBG_ALIGN, DBG_FLAG(DBG_ALIGN_BGZF), ("BGZF Header extra field BC: bsize %u\n", bsize));
-                        break;
-                    }
-                    i += slen + 4;
-                }
-                if (bsize == 0 || bsize != self->zs.total_in) {
-                    DBGMSG(DBG_ALIGN, DBG_FLAG(DBG_ALIGN_BGZF), ("BGZF Header extra field BC not found\n"));
-                    rc = RC(rcAlign, rcFile, rcReading, rcFormat, rcInvalid); /* not BGZF */
-                }
-            }
-            else {
-                DBGMSG(DBG_ALIGN, DBG_FLAG(DBG_ALIGN_BGZF), ("GZIP Header not found\n"));
-                rc = RC(rcAlign, rcFile, rcReading, rcFile, rcCorrupt);
-            }
-#endif
-            *pNumRead = (unsigned)self->zs.total_out; /* <= 64k */
-            zr = inflateReset(&self->zs);
-            assert(zr == Z_OK);
-            return rc;
-        default:
-            DBGMSG(DBG_ALIGN, DBG_FLAG(DBG_ALIGN_BGZF), ("Unexpected Zlib result %i\n", zr));
-            return RC(rcAlign, rcFile, rcReading, rcFile, rcCorrupt);
-        }
-    }
-    DBGMSG(DBG_ALIGN, DBG_FLAG(DBG_ALIGN_BGZF), ("Failed reading BAM file after %lu bytes\n", self->fpos + self->bpos));
-    return RC(rcAlign, rcFile, rcReading, rcFile, rcTooShort);
-}
-
-static uint64_t BGZFileGetPos(const BGZFile *self)
-{
-    return self->fpos + self->bpos;
-}
-
-/* returns the position as proportion of the whole file */ 
-static float BGZFileProPos(BGZFile const *const self)
-{
-    return BGZFileGetPos(self) / (double)self->fsize;
-}
-
-static rc_t BGZFileSetPos(BGZFile *const self, uint64_t const pos)
-{
-    if (self->fpos > pos || pos >= self->fpos + self->bcount) {
-        /* desired position is outside of current buffer */
-        self->fpos = pos ^ (pos & ((uint64_t)(MEM_ALIGN_SIZE - 1)));
-        self->bpos = (unsigned)(pos - self->fpos);
-        self->bcount = 0; /* force re-read */
-    }
-    else {
-        /* desired position is inside of current buffer */
-        unsigned const bpos = (unsigned)(pos - self->fpos); /* < 64k */
-
-        self->bpos = bpos; /* pos - self->fpos; */
-        self->zs.avail_in = (uInt)(self->bcount - bpos);
-        self->zs.next_in = (Bytef *)&self->buf[bpos];
-    }
-    return 0;
-}
-
-typedef rc_t (*BGZFileWalkBlocks_cb)(void *ctx, const BGZFile *file,
-                                     rc_t rc, uint64_t fpos,
-                                     const zlib_block_t data, unsigned dsize);
-
-/* Without Decompression */
-static rc_t BGZFileWalkBlocksND(BGZFile *const self, BGZFileWalkBlocks_cb const cb, void *const ctx)
-{
-    rc_t rc = 0;
-#if VALIDATE_BGZF_HEADER
-    uint8_t extra[256];
-    char dummy[64];
-    gz_header head;
-    int zr;
-
-    memset(&head, 0, sizeof(head));
-    head.extra = extra;
-    head.extra_max = sizeof(extra);
-    
-    do {
-        unsigned loops;
-        unsigned hsize = 0;
-        unsigned bsize = 0;
-        unsigned bsize2;
-        uint64_t const fpos = self->fpos + self->bpos;
-        
-        self->zs.next_out = (Bytef *)dummy;
-        self->zs.avail_out = sizeof(dummy);
-        
-        zr = inflateGetHeader(&self->zs, &head);
-        assert(zr == Z_OK);
-        
-        for (loops = 0; loops != 2; ++loops) {
-            {
-                uLong const orig = self->zs.total_in;
-                
-                zr = inflate(&self->zs, Z_BLOCK);
-                {
-                    uLong const final = self->zs.total_in;
-                    uLong const bytes = final - orig;
-                    
-                    self->bpos += bytes;
-                    hsize += bytes;
-                }
-            }
-            if (head.done) {
-                unsigned i;
-                
-                for (i = 0; i < head.extra_len; ) {
-                    if (extra[i] == 'B' && extra[i + 1] == 'C') {
-                        bsize = 1 + LE2HUI16(&extra[i + 4]);
-                        break;
-                    }
-                    i += LE2HUI16(&extra[i + 2]);
-                }
-                break;
-            }
-            else if (self->zs.avail_in == 0) {
-                rc = BGZFileGetMoreBytes(self);
-                if (rc) {
-                    rc = RC(rcAlign, rcFile, rcReading, rcFile, rcTooShort);
-                    goto DONE;
-                }
-            }
-            else {
-                rc = RC(rcAlign, rcFile, rcReading, rcFile, rcCorrupt);
-                goto DONE;
-            }
-        }
-        if (bsize == 0) {
-            rc = RC(rcAlign, rcFile, rcReading, rcFormat, rcInvalid); /* not BGZF */
-            break;
-        }
-        bsize2 = bsize;
-        bsize -= hsize;
-        for ( ; ; ) {
-            unsigned const max = (unsigned)(self->bcount - self->bpos); /* <= 64k */
-            unsigned const len = bsize > max ? max : bsize;
-            
-            self->bpos += len;
-            bsize -= len;
-            if (self->bpos == self->bcount) {
-                rc = BGZFileGetMoreBytes(self);
-                if (rc) {
-                    if (bsize)
-                        rc = RC(rcAlign, rcFile, rcReading, rcFile, rcTooShort);
-                    goto DONE;
-                }
-            }
-            else {
-                zr = inflateReset(&self->zs);
-                assert(zr == Z_OK);
-                self->zs.avail_in = (uInt)(self->bcount - self->bpos);
-                self->zs.next_in = (Bytef *)&self->buf[self->bpos];
-                rc = cb(ctx, self, 0, fpos, NULL, bsize2);
-                break;
-            }
-        }
-    } while (rc == 0);
-DONE:
-    if (GetRCState(rc) == rcInsufficient && GetRCObject(rc) == rcData)
-        rc = 0;
-    rc = cb(ctx, self, rc, self->fpos + self->bpos, NULL, 0);
-#endif
-    return rc;
-}
-
-static rc_t BGZFileWalkBlocksUnzip(BGZFile *const self, zlib_block_t *const bufp, BGZFileWalkBlocks_cb const cb, void *const ctx)
-{
-    rc_t rc;
-    rc_t rc2;
-    
-    do {
-        uint64_t const fpos = self->fpos + self->bpos;
-        unsigned dsize;
-        
-        rc2 = BGZFileRead(self, *bufp, &dsize);
-        rc = cb(ctx, self, rc2, fpos, *bufp, dsize);
-    } while (rc == 0 && rc2 == 0);
-    if (GetRCState(rc2) == rcInsufficient && GetRCObject(rc2) == rcData)
-        rc2 = 0;
-    rc = cb(ctx, self, rc2, self->fpos + self->bpos, NULL, 0);
-    return rc ? rc : rc2;
-}
-
-static rc_t BGZFileWalkBlocks(BGZFile *self, bool decompress, zlib_block_t *bufp,
-                              BGZFileWalkBlocks_cb cb, void *ctx)
-{
-    rc_t rc;
-    
-#if VALIDATE_BGZF_HEADER
-#else
-    decompress = true;
-#endif
-    self->fpos = 0;
-    self->bpos = 0;
-    
-    rc = BGZFileGetMoreBytes(self);
-    if (rc)
-        return rc;
-    
-    if (decompress)
-        return BGZFileWalkBlocksUnzip(self, bufp, cb, ctx);
-    else
-        return BGZFileWalkBlocksND(self, cb, ctx);
-}
-
-static uint64_t BGZFileGetSize(BGZFile const *const self)
-{
-    return self->fsize;
-}
-
-static void BGZFileWhack(BGZFile *self)
-{
-    inflateEnd(&self->zs);
-    KFileRelease(self->kfp);
-    if (self->_buf)
-        free(self->_buf);
-}
-
-static rc_t BGZFileInit(BGZFile *self, const KFile *kfp, BGZFile_vt *vt)
-{
-    int i;
-    rc_t rc;
-    static BGZFile_vt const my_vt = {
-        (rc_t (*)(void *, zlib_block_t, unsigned *))BGZFileRead,
-        (uint64_t (*)(void const *))BGZFileGetPos,
-        (float (*)(void const *))BGZFileProPos,
-        (uint64_t (*)(void const *))BGZFileGetSize,
-        (rc_t (*)(void *, uint64_t))BGZFileSetPos,
-        (void (*)(void *))BGZFileWhack
-    };
-    
-    memset(self, 0, sizeof(*self));
-    memset(vt, 0, sizeof(*vt));
-    
-    i = inflateInit2(&self->zs, MAX_WBITS + 16); /* max + enable gzip headers */
-    switch (i) {
-    case Z_OK:
-        break;
-    case Z_MEM_ERROR:
-        return RC(rcAlign, rcFile, rcConstructing, rcMemory, rcExhausted);
-    default:
-        return RC(rcAlign, rcFile, rcConstructing, rcNoObj, rcUnexpected);
-    }
-    
-    rc = KFileSize(kfp, &self->fsize);
-    if (rc)
-        return rc;
-    
-    self->_buf = malloc(MEM_CHUNK_SIZE + MEM_ALIGN_SIZE);
-    if (self->_buf == NULL)
-        return RC(rcAlign, rcFile, rcConstructing, rcMemory, rcExhausted);
-    self->malign = (MEM_ALIGN_SIZE - ((intptr_t)self->_buf & (MEM_ALIGN_SIZE - 1))) & (MEM_ALIGN_SIZE - 1);
-    self->buf = self->_buf + self->malign;
-    
-    self->kfp = kfp;
-    KFileAddRef(kfp);
-
-    *vt = my_vt;
-    
-    return 0;
-}
-
-#ifndef WINDOWS
-
-/* MARK: BGZThreadFile *** Start *** */
-
-#include <kproc/thread.h>
-#include <kproc/lock.h>
-#include <kproc/cond.h>
-
-typedef struct BGZThreadFile_s BGZThreadFile;
-
-#define BUFFER_COUNT (3)
-
-typedef struct BGZThreadFileWorkQElem_s BGZThreadFileWorkQElem;
-
-struct BGZThreadFileWorkQElem_s {
-    uint8_t *buf;
-    uint64_t pos;
-    unsigned bsz;
-};
-
-struct BGZThreadFile_s {
-    BGZFile file;
-    KLock *lock;
-    KCondition *have_data;
-    KCondition *need_data;
-    KThread *th;
-    uint64_t pos;
-    BGZThreadFileWorkQElem que[BUFFER_COUNT];
-    rc_t volatile rc;
-    unsigned volatile nque;
-    bool eof;
-    uint8_t buffer[sizeof(zlib_block_t) * BUFFER_COUNT];
-};
-
-static rc_t BGZThreadFileRead(BGZThreadFile *self, zlib_block_t dst, unsigned *pNumRead)
-{
-    rc_t rc;
-    
-    *pNumRead = 0;
-    
-    KLockAcquire(self->lock);
-    if ((rc = self->rc) == 0) {
-        while (self->nque == 0 && (rc = self->rc) == 0)
-            KConditionWait(self->have_data, self->lock);
-        if (rc == 0) {
-            BGZThreadFileWorkQElem const work = self->que[0];
-            
-            self->pos = work.pos;
-            if (work.buf) {
-                memcpy(dst, work.buf, *pNumRead = work.bsz);
-                memmove(&self->que[0], &self->que[1], --self->nque * sizeof(self->que[0]));
-                KConditionSignal(self->need_data);
-            }
-            else {
-                self->eof = true;
-                self->rc = rc = RC(rcAlign, rcFile, rcReading, rcData, rcInsufficient);
-            }
-        }
-    }
-    KLockUnlock(self->lock);
-    return rc;
-}
-
-static rc_t CC BGZThreadFileMain(KThread const *const th, void *const vp)
-{
-    BGZThreadFile *const self = (BGZThreadFile *)vp;
-    rc_t rc = 0;
-    unsigned bufno;
-    
-    KLockAcquire(self->lock);
-    for (bufno = 0; ; bufno = (bufno + 1) % BUFFER_COUNT) {
-        while (self->nque == BUFFER_COUNT)
-            KConditionWait(self->need_data, self->lock);
-        {
-            BGZThreadFileWorkQElem work;
-            
-            work.pos = BGZFileGetPos(&self->file);
-            work.buf = &self->buffer[bufno * sizeof(zlib_block_t)];
-            rc = BGZFileRead(&self->file, work.buf, &work.bsz);
-            if (GetRCObject(rc) == rcData && GetRCState(rc) == rcInsufficient)
-                work.buf = NULL;
-            else if (rc)
-                break;
-            self->que[self->nque++] = work;
-            KConditionSignal(self->have_data);
-        }
-    }
-    self->rc = rc;
-    KLockUnlock(self->lock);
-    return 0;
-}
-
-static uint64_t BGZThreadFileGetPos(BGZThreadFile const *const self)
-{
-    return self->pos;
-}
-
-/* returns the position as proportion of the whole file */ 
-static float BGZThreadFileProPos(BGZThreadFile const *const self)
-{
-    return BGZThreadFileGetPos(self) / (double)self->file.fsize;
-}
-
-static uint64_t BGZThreadFileGetSize(BGZThreadFile const *const self)
-{
-    return BGZFileGetSize(&self->file);
-}
-
-static rc_t BGZThreadFileSetPos(BGZThreadFile *const self)
-{
-    return RC(rcAlign, rcFile, rcPositioning, rcFunction, rcUnsupported);
-}
-
-static void BGZThreadFileWhack(BGZThreadFile *const self)
-{
-    KThreadCancel(self->th);
-    KThreadWait(self->th, NULL);
-    BGZFileWhack(&self->file);
-    KConditionRelease(self->need_data);
-    KConditionRelease(self->have_data);
-    KLockRelease(self->lock);
-    KThreadRelease(self->th);
-}
-
-static rc_t BGZThreadFileInit(BGZThreadFile *self, const KFile *kfp, BGZFile_vt *vt)
-{
-    rc_t rc;
-    static BGZFile_vt const my_vt = {
-        (rc_t (*)(void *, zlib_block_t, unsigned *))BGZThreadFileRead,
-        (uint64_t (*)(void const *))BGZThreadFileGetPos,
-        (float (*)(void const *))BGZThreadFileProPos,
-        (uint64_t (*)(void const *))BGZThreadFileGetSize,
-        (rc_t (*)(void *, uint64_t))BGZThreadFileSetPos,
-        (void (*)(void *))BGZThreadFileWhack
-    };
-    
-    memset(self, 0, sizeof(*self));
-    
-    rc = BGZFileInit(&self->file, kfp, vt);
-    if (rc == 0) {
-        rc = KLockMake(&self->lock);
-        if (rc == 0) {
-            rc = KConditionMake(&self->have_data);
-            if (rc == 0) {
-                rc = KConditionMake(&self->need_data);
-                if (rc == 0) {
-                    rc = KThreadMake(&self->th, BGZThreadFileMain, self);
-                    if (rc == 0) {
-                        *vt = my_vt;
-                        return 0;
-                    }
-                    KConditionRelease(self->need_data);
-                }
-                KConditionRelease(self->have_data);
-            }
-            KLockRelease(self->lock);
-        }
-        BGZFileWhack(&self->file);
-    }
-    memset(self, 0, sizeof(*self));
-    memset(vt, 0, sizeof(*vt));
-    return rc;
-}
-
-#endif
-
-/* MARK: BAMFile structures */
-
-struct BAMIndex {
-    BAMFilePosition *refSeq[1];
-};
-
-struct BAMFile {
-    uint64_t fpos_first;
-    uint64_t fpos_cur;
-    
-    union {
-        BGZFile plain;
-#ifndef WINDOWS
-        BGZThreadFile thread;
-#endif
-    } file;
-    BGZFile_vt vt;
-    
-    BAMRefSeq *refSeq;          /* pointers into headerData1 except name points into headerData2 */ 
-    BAMReadGroup *readGroup;    /* pointers into headerData1 */
-    char const *version;
-    char const *header;
-    char    *headerData1;       /* gets used for refSeq and readGroup */
-    uint8_t *headerData2;       /* gets used for refSeq */
-    BAMAlignment *bufLocker;
-    BAMAlignment *nocopy;       /* used to hold current record for BAMFileRead2 */
-    BAMIndex const *ndx;
-    
-    size_t nocopy_size;
-    
-    unsigned refSeqs;
-    unsigned readGroups;
-    
-    KRefcount refcount;
-    unsigned ucfirst;           /* offset of first record in uncompressed buffer */
-    unsigned bufSize;           /* current size of uncompressed buffer */
-    unsigned bufCurrent;        /* location in uncompressed buffer of read head */
-    bool eof;
-    bool threaded;
-    zlib_block_t buffer;        /* uncompressed buffer */
-};
-
-/* MARK: Alignment structures */
-
-struct bam_alignment_s {
-    uint8_t rID[4];
-    uint8_t pos[4];
-    uint8_t read_name_len;
-    uint8_t mapQual;
-    uint8_t bin[2];
-    uint8_t n_cigars[2];
-    uint8_t flags[2];
-    uint8_t read_len[4];
-    uint8_t mate_rID[4];
-    uint8_t mate_pos[4];
-    uint8_t ins_size[4];
-    char read_name[1 /* read_name_len */];
-/* if you change length of read_name,
- * adjust calculation of offsets in BAMAlignmentSetOffsets */
-/*  uint32_t cigar[n_cigars];
- *  uint8_t seq[(read_len + 1) / 2];
- *  uint8_t qual[read_len];
- *  uint8_t extra[...];
- */
-};
-
-typedef union bam_alignment_u {
-    struct bam_alignment_s cooked;
-    uint8_t raw[sizeof(struct bam_alignment_s)];
-} bam_alignment;
-
-struct offset_size_s {
-    unsigned offset;
-    unsigned size; /* this is the total length of the tag; length of data is size - 3 */
-};
-
-struct BAMAlignment {
-    KRefcount refcount;
-    
-    BAMFile *parent;
-    bam_alignment const *data;
-    uint8_t *storage;
-    unsigned datasize;
-        
-    unsigned cigar;
-    unsigned seq;
-    unsigned qual;
-    unsigned numExtra;
-    struct offset_size_s extra[1];
-};
-
-static const char cigarChars[] = {
-    ct_Match,
-    ct_Insert,
-    ct_Delete,
-    ct_Skip,
-    ct_SoftClip,
-    ct_HardClip,
-    ct_Padded,
-    ct_Equal,
-    ct_NotEqual
-    /* ct_Overlap must not appear in actual BAM file */
-};
-
-/* MARK: Alignment accessors */
-
-static int32_t getRefSeqId(const BAMAlignment *cself) {
-    return LE2HI32(cself->data->cooked.rID);
-}
-
-static int32_t getPosition(const BAMAlignment *cself) {
-    return LE2HI32(cself->data->cooked.pos);
-}
-
-static uint8_t getReadNameLength(const BAMAlignment *cself) {
-    return cself->data->cooked.read_name_len;
-}
-
-static uint16_t getBin(const BAMAlignment *cself) {
-    return LE2HUI16(cself->data->cooked.bin);
-}
-
-static uint8_t getMapQual(const BAMAlignment *cself) {
-    return cself->data->cooked.mapQual;
-}
-
-static uint16_t getCigarCount(const BAMAlignment *cself) {
-    return LE2HUI16(cself->data->cooked.n_cigars);
-}
-
-static uint16_t getFlags(const BAMAlignment *cself) {
-    return LE2HUI16(cself->data->cooked.flags);
-}
-
-static uint32_t getReadLen(const BAMAlignment *cself) {
-    return LE2HUI32(cself->data->cooked.read_len);
-}
-
-static int32_t getMateRefSeqId(const BAMAlignment *cself) {
-    return LE2HI32(cself->data->cooked.mate_rID);
-}
-
-static int32_t getMatePos(const BAMAlignment *cself) {
-    return LE2HI32(cself->data->cooked.mate_pos);
-}
-
-static int32_t getInsertSize(const BAMAlignment *cself) {
-    return LE2HI32(cself->data->cooked.ins_size);
-}
-
-static char const *getReadName(const BAMAlignment *cself) {
-    return &cself->data->cooked.read_name[0];
-}
-
-static void const *getCigarBase(BAMAlignment const *cself)
-{
-    return &cself->data->raw[cself->cigar];
-}
-
-static int opt_tag_cmp(uint8_t const a[2], uint8_t const b[2])
-{
-    int const d0 = (int)a[0] - (int)b[0];
-    return d0 ? d0 : ((int)a[1] - (int)b[1]);
-}
-
-static int CC OptTag_sort(void const *a, void const *b, void *ctx)
-{
-    BAMAlignment const *const self = ctx;
-    unsigned const a_off = ((struct offset_size_s const *)a)->offset;
-    unsigned const b_off = ((struct offset_size_s const *)b)->offset;
-    
-    return opt_tag_cmp(&self->data->raw[a_off], &self->data->raw[b_off]);
-}
-
-static int CC OptTag_cmp(void const *key, void const *item, void *ctx)
-{
-    BAMAlignment const *const self = ctx;
-    unsigned const offset = ((struct offset_size_s const *)item)->offset;
-    
-    return opt_tag_cmp(key, &self->data->raw[offset]);
-}
-
-static char const *get_RG(BAMAlignment const *cself)
-{
-    struct offset_size_s const *const x = kbsearch("RG", cself->extra, cself->numExtra, sizeof(cself->extra[0]), OptTag_cmp, (void *)cself);
-    return (char const *)(x && cself->data->raw[x->offset + 2] == 'Z' ? &cself->data->raw[x->offset + 3] : NULL);
-}
-
-static struct offset_size_s const *get_CS_info(BAMAlignment const *cself)
-{
-    return kbsearch("CS", cself->extra, cself->numExtra, sizeof(cself->extra[0]), OptTag_cmp, (void *)cself);
-}
-
-static struct offset_size_s const *get_CQ_info(BAMAlignment const *cself)
-{
-    return kbsearch("CQ", cself->extra, cself->numExtra, sizeof(cself->extra[0]), OptTag_cmp, (void *)cself);
-}
-
-static char const *get_CS(BAMAlignment const *cself)
-{
-    struct offset_size_s const *const x = get_CS_info(cself);
-    return (char const *)(x && cself->data->raw[x->offset + 2] == 'Z' ? &cself->data->raw[x->offset + 3] : NULL);
-}
-
-static uint8_t const *get_CQ(BAMAlignment const *cself)
-{
-    struct offset_size_s const *const x = get_CQ_info(cself);
-    return (uint8_t const *)(x && cself->data->raw[x->offset + 2] == 'Z' ? &cself->data->raw[x->offset + 3] : NULL);
-}
-
-static struct offset_size_s const *get_OQ_info(BAMAlignment const *cself)
-{
-    return kbsearch("OQ", cself->extra, cself->numExtra, sizeof(cself->extra[0]), OptTag_cmp, (void *)cself);
-}
-
-static uint8_t const *get_OQ(BAMAlignment const *cself)
-{
-    struct offset_size_s const *const x = get_OQ_info(cself);
-    return (uint8_t const *)(x && cself->data->raw[x->offset + 2] == 'Z' ? &cself->data->raw[x->offset + 3] : NULL);
-}
-
-static char const *get_XT(BAMAlignment const *cself)
-{
-    struct offset_size_s const *const x = kbsearch("XT", cself->extra, cself->numExtra, sizeof(cself->extra[0]), OptTag_cmp, (void *)cself);
-    return (char const *)(x && cself->data->raw[x->offset + 2] == 'Z' ? &cself->data->raw[x->offset + 3] : NULL);
-}
-
-static struct offset_size_s const *get_CG_ZA_info(BAMAlignment const *cself)
-{
-    return kbsearch("ZA", cself->extra, cself->numExtra, sizeof(cself->extra[0]), OptTag_cmp, (void *)cself);
-}
-
-static struct offset_size_s const *get_CG_ZI_info(BAMAlignment const *cself)
-{
-    return kbsearch("ZI", cself->extra, cself->numExtra, sizeof(cself->extra[0]), OptTag_cmp, (void *)cself);
-}
-
-static struct offset_size_s const *get_CG_GC_info(BAMAlignment const *cself)
-{
-    return kbsearch("GC", cself->extra, cself->numExtra, sizeof(cself->extra[0]), OptTag_cmp, (void *)cself);
-}
-
-static struct offset_size_s const *get_CG_GS_info(BAMAlignment const *cself)
-{
-    return kbsearch("GS", cself->extra, cself->numExtra, sizeof(cself->extra[0]), OptTag_cmp, (void *)cself);
-}
-
-static struct offset_size_s const *get_CG_GQ_info(BAMAlignment const *cself)
-{
-    return kbsearch("GQ", cself->extra, cself->numExtra, sizeof(cself->extra[0]), OptTag_cmp, (void *)cself);
-}
-
-/* MARK: BAMFile Reading functions */
-
-/* returns (rcData, rcInsufficient) if eof */
-static rc_t BAMFileFillBuffer(BAMFile *self)
-{
-    rc_t const rc = self->vt.FileRead(&self->file, self->buffer, &self->bufSize);
-    if (rc)
-        return rc;
-    if (self->bufSize == 0 || self->bufSize <= self->bufCurrent)
-        return RC(rcAlign, rcFile, rcReading, rcData, rcInsufficient);
-    return 0;
-}
-
-static rc_t BAMFileReadn(BAMFile *self, const unsigned len, uint8_t dst[/* len */]) {
-    rc_t rc;
-    unsigned cur;
-    unsigned n = 0;
-    
-    if (len == 0)
-        return 0;
-    
-    for (cur = 0; ; cur += n) {
-        if (self->bufSize > self->bufCurrent) {
-            n = self->bufSize - self->bufCurrent;
-            if (cur + n > len)
-                n = len - cur;
-            memcpy(&dst[cur], &self->buffer[self->bufCurrent], n);
-            self->bufCurrent += n;
-        }
-        if (self->bufCurrent != self->bufSize && self->bufSize != 0)
-            return 0;
-        if (self->bufSize != 0) {
-            /* a seek has not just been done so update the file position.
-             * if we didn't and a request for the position is made before the
-             * next read, we will not have the position of the next read.
-             *
-             * if a seek had just been done then
-             *    self->fpos_cur == BGZFileGetPos(&self->file)
-             * is already true.
-             */
-            self->fpos_cur = self->vt.FileGetPos(&self->file);
-            self->bufCurrent = 0;
-            self->bufSize = 0;
-            if (cur + n == len)
-                return 0;
-        }
-
-        rc = BAMFileFillBuffer(self);
-        if (rc)
-            return rc;
-    }
-}
-
-static void const *BAMFilePeek(BAMFile const *const self, unsigned const offset)
-{
-    return &self->buffer[self->bufCurrent + offset];
-}
-
-static unsigned BAMFileMaxPeek(BAMFile const *self)
-{
-    return self->bufSize > self->bufCurrent ? self->bufSize - self->bufCurrent : 0;
-}
-
-static int32_t BAMFilePeekI32(BAMFile *self)
-{
-    return LE2HI32(BAMFilePeek(self, 0));
-}
-
-static rc_t BAMFileReadI32(BAMFile *self, int32_t *rhs)
-{
-    uint8_t buf[sizeof(int32_t)];
-    rc_t rc = BAMFileReadn(self, sizeof(int32_t), buf);
-    
-    if (rc == 0)
-        *rhs = LE2HI32(buf);
-    return rc;
-}
-
-/* MARK: BAM File header parsing functions */
-
-static int CC comp_ReadGroup(const void *a, const void *b, void *ignored) {
-    return strcmp(((BAMReadGroup const *)a)->name, ((BAMReadGroup const *)b)->name);
-}
-
-static rc_t ParseHD(BAMFile *self, char hdata[], size_t hlen, unsigned *used)
-{
-    unsigned i;
-    unsigned tag;
-    unsigned value;
-    int st = 0;
-    int ws = 1;
-
-    for (i = 0; i < hlen; ++i) {
-        char const cc = hdata[i];
-        
-        if (ws && isspace(cc))
-            continue;
-        ws = 0;
-        
-        switch (st) {
-        case 0:
-            tag = i;
-            ++st;
-            break;
-        case 1:
-            if (isspace(cc))
-                return RC(rcAlign, rcFile, rcParsing, rcData, rcInvalid);
-            ++st;
-            break;
-        case 2:
-            if (cc != ':')
-                return RC(rcAlign, rcFile, rcParsing, rcData, rcInvalid);
-            hdata[i] = '\0';
-            value = i + 1;
-            ++st;
-            break;
-        case 3:
-            if (cc == '\t' || cc == '\r' || cc == '\n') {
-                hdata[i] = '\0';
-                
-                if (strcmp(&hdata[tag], "VN") == 0)
-                    self->version = &hdata[value];
-                
-                ++st;
-                ws = 1;
-            }
-            break;
-        case 4:
-            if (cc == '@')
-                goto DONE;
-            tag = i;
-            st = 1;
-            break;
-        }
-    }
-    if (st == 4) {
-DONE:
-        *used = i;
-        return 0;
-    }
-    return RC(rcAlign, rcFile, rcParsing, rcData, rcInvalid);
-}
-
-static rc_t ParseSQ(BAMFile *self, char hdata[], size_t hlen, unsigned *used, unsigned const rs_by_name[])
-{
-    unsigned i;
-    unsigned tag;
-    unsigned value;
-    int st = 0;
-    int ws = 1;
-    BAMRefSeq rs;
-    
-    memset(&rs, 0, sizeof(rs));
-    
-    for (i = 0; i < hlen; ++i) {
-        char const cc = hdata[i];
-        
-        if (ws && isspace(cc))
-            continue;
-        ws = 0;
-        
-        switch (st) {
-        case 0:
-            tag = i;
-            ++st;
-            break;
-        case 1:
-            if (isspace(cc))
-                return RC(rcAlign, rcFile, rcParsing, rcData, rcInvalid);
-            ++st;
-            break;
-        case 2:
-#define HACKAMATIC 1
-#if HACKAMATIC
-            if (cc != ':') {
-                if (i + 1 >= hlen || hdata[i+1] != ':')
-                    return RC(rcAlign, rcFile, rcParsing, rcData, rcInvalid);
-                else
-                    ++i;
-            }
-#else
-            if (cc != ':')
-                return RC(rcAlign, rcFile, rcParsing, rcData, rcInvalid);
-#endif
-            hdata[i] = '\0';
-            value = i + 1;
-            ++st;
-            break;
-        case 3:
-            if (cc == '\t' || cc == '\r' || cc == '\n') {
-                unsigned j;
-                
-                hdata[i] = '\0';
-                
-                while (value < i && isspace(hdata[value]))
-                    ++value;
-                for (j = i; value < j && isspace(hdata[j - 1]); )
-                    hdata[--j] = '\0';
-                
-                if (strcmp(&hdata[tag], "SN") == 0)
-                    rs.name = &hdata[value];
-                else if (strcmp(&hdata[tag], "LN") == 0)
-                    rs.length = strtou64(&hdata[value], NULL, 10);
-                else if (strcmp(&hdata[tag], "AS") == 0)
-                    rs.assemblyId = &hdata[value];
-#if HACKAMATIC
-                else if (strcmp(&hdata[tag], "M5") == 0 || strcmp(&hdata[tag], "MD5") == 0)
-#else
-                else if (strcmp(&hdata[tag], "M5") == 0)
-#endif
-#undef HACKAMATIC
-                {
-                    unsigned len = j - value;
-                    
-                    if ((hdata[value] == '\'' || hdata[value] == '"') && hdata[value + len - 1] == hdata[value]) {
-                        ++value;
-                        len -= 2;
-                    }
-                    if (len == 32) {
-                        rs.checksum = &rs.checksum_array[0];
-                        for (j = 0; j != 16; ++j) {
-                            int const ch1 = toupper(hdata[value + j * 2 + 0]);
-                            int const ch2 = toupper(hdata[value + j * 2 + 1]);
-                            
-                            if (isxdigit(ch1) && isxdigit(ch2)) {
-                                rs.checksum_array[j] =
-                                    ((ch1 > '9' ? (ch1 - ('A' - 10)) : (ch1 - '0')) << 4) +
-                                     (ch2 > '9' ? (ch2 - ('A' - 10)) : (ch2 - '0'));
-                            }
-                            else {
-                                rs.checksum = NULL;
-                                break;
-                            }
-                        }
-                    }
-                }
-                else if (strcmp(&hdata[tag], "UR") == 0)
-                    rs.uri = &hdata[value];
-                else if (strcmp(&hdata[tag], "SP") == 0)
-                    rs.species = &hdata[value];
-                
-                ++st;
-                ws = 1;
-            }
-            break;
-        case 4:
-            if (cc == '@')
-                goto DONE;
-            tag = i;
-            st = 1;
-            break;
-        }
-    }
-DONE:
-    if (st == 4) {
-        unsigned f = 0;
-        unsigned e = self->refSeqs;
-        
-        if (rs.name == NULL) /* required tags */
-            return RC(rcAlign, rcFile, rcParsing, rcConstraint, rcViolated);
-        
-        while (f < e) {
-            unsigned const m = (f + e) >> 1;
-            BAMRefSeq *const x = &self->refSeq[rs_by_name[m]];
-            int const cmp = strcmp(rs.name, x->name);
-            
-            if (cmp < 0)
-                e = m;
-            else if (cmp > 0)
-                f = m + 1;
-            else {
-                x->assemblyId = rs.assemblyId;
-                x->uri = rs.uri;
-                x->species = rs.species;
-                if (rs.checksum) {
-                    x->checksum = &x->checksum_array[0];
-                    memcpy(x->checksum_array, rs.checksum_array, 16);
-                }
-                else
-                    x->checksum = NULL;
-                break;
-            }
-        }
-        *used = i;
-        return 0;
-    }
-    return RC(rcAlign, rcFile, rcParsing, rcData, rcInvalid);
-}
-
-static rc_t ParseRG(BAMFile *self, char hdata[], size_t hlen, unsigned *used, BAMReadGroup *dst)
-{
-    unsigned i;
-    unsigned tag;
-    unsigned value;
-    int st = 0;
-    int ws = 1;
-#if _DEBUGGING
-    char const *cur = hdata;
-#endif
-    
-    memset(dst, 0, sizeof(*dst));
-    
-    for (i = 0; i < hlen; ++i) {
-        char const cc = hdata[i];
-        
-        if (ws && isspace(cc))
-            continue;
-        ws = 0;
-        
-        switch (st) {
-        case 0:
-            tag = i;
-            ++st;
-            break;
-        case 1:
-            if (isspace(cc))
-                return RC(rcAlign, rcFile, rcParsing, rcData, rcInvalid);
-            ++st;
-            break;
-        case 2:
-            if (cc != ':')
-                return RC(rcAlign, rcFile, rcParsing, rcData, rcInvalid);
-#if _DEBUGGING
-            cur = hdata + i + 1;
-#endif
-            hdata[i] = '\0';
-            value = i + 1;
-            ++st;
-            break;
-        case 3:
-            if (cc == '\t' || cc == '\r' || cc == '\n') {
-                unsigned j = i;
-#if _DEBUGGING
-                cur = hdata + i + 1;
-#endif
-                hdata[i] = '\0';
-
-                while (value < i && isspace(hdata[value]))
-                    ++value;
-                while (value < j && isspace(hdata[j - 1]))
-                    hdata[--j] = '\0';
-                
-                if ((hdata[value] == '\"' || hdata[value] == '\'') && hdata[value] == hdata[j - 1]) {
-                    ++value;
-                    hdata[j - 1] = '\0';
-                }
-                if (strcmp(&hdata[tag], "ID") == 0)
-                    dst->name = &hdata[value];
-                else if (strcmp(&hdata[tag], "SM") == 0)
-                    dst->sample = &hdata[value];
-                else if (strcmp(&hdata[tag], "LB") == 0)
-                    dst->library = &hdata[value];
-                else if (strcmp(&hdata[tag], "DS") == 0)
-                    dst->description = &hdata[value];
-                else if (strcmp(&hdata[tag], "PU") == 0)
-                    dst->unit = &hdata[value];
-                else if (strcmp(&hdata[tag], "PI") == 0)
-                    dst->insertSize = &hdata[value];
-                else if (strcmp(&hdata[tag], "CN") == 0)
-                    dst->center = &hdata[value];
-                else if (strcmp(&hdata[tag], "DT") == 0)
-                    dst->runDate = &hdata[value];
-                else if (strcmp(&hdata[tag], "PL") == 0)
-                    dst->platform = &hdata[value];
-                
-                ++st;
-                ws = 1;
-            }
-            break;
-        case 4:
-            if (cc == '@')
-                goto DONE;
-            tag = i;
-            st = 1;
-            break;
-        }
-    }
-    if (st == 4) {
-DONE:
-        *used = i;
-        if (dst->name == NULL) /* required */
-            return RC(rcAlign, rcFile, rcParsing, rcConstraint, rcViolated);
-        return 0;
-    }
-    return RC(rcAlign, rcFile, rcParsing, rcData, rcInvalid);
-}
-
-static rc_t ParseHeader(BAMFile *self, char hdata[], size_t hlen, unsigned const rs_by_name[]) {
-    unsigned rg = 0;
-    unsigned i;
-    unsigned tag;
-    int st = 0;
-    int ws = 1;
-    unsigned used;
-    rc_t rc;
-    
-    for (i = 0; i < hlen; ++i) {
-        char const cc = hdata[i];
-        
-        if (ws && isspace(cc))
-            continue;
-        ws = 0;
-        
-        switch (st) {
-        case 0:
-            if (cc == '@')
-                ++st;
-            else
-                return RC(rcAlign, rcFile, rcParsing, rcData, rcInvalid);
-            break;
-        case 1:
-            if (isspace(cc))
-                return RC(rcAlign, rcFile, rcParsing, rcData, rcInvalid);
-            tag = i;
-            ++st;
-            break;
-        case 2:
-            if (isspace(cc)) {
-                hdata[i] = '\0';
-                if (i - tag == 2) {
-                    if (strcmp(&hdata[tag], "HD") == 0) {
-                        rc = ParseHD(self, &hdata[i + 1], hlen - i - 1, &used);
-                        if (rc) return rc;
-                        i += used;
-                        st = 0;
-                    }
-                    else if (strcmp(&hdata[tag], "SQ") == 0) {
-                        rc = ParseSQ(self, &hdata[i + 1], hlen - i - 1, &used, rs_by_name);
-                        if (rc) return rc;
-                        i += used;
-                        st = 0;
-                    }
-                    else if (strcmp(&hdata[tag], "RG") == 0) {
-                        rc = ParseRG(self, &hdata[i + 1], hlen - i - 1, &used, &self->readGroup[rg]);
-                        if (GetRCObject(rc) == rcConstraint && GetRCState(rc) == rcViolated) {
-                            (void)LOGERR(klogWarn, rc, "Read Group is missing ID in BAM header");
-                            rc = 0;
-                            if (self->readGroups) --self->readGroups;
-                        }
-                        else if (rc)
-                            return rc;
-                        else
-                            ++rg;
-                        i += used;
-                        st = 0;
-                    }
-                }
-                if (st == 2) {
-                    ++st;
-                    ws = 0;
-                }
-            }
-            else if (i - tag > 2)
-                ++st;
-            break;
-        case 3:
-            if (cc == '\r' || cc == '\n') {
-                st = 0;
-                ws = 1;
-            }
-            break;
-        }
-    }
-    ksort( self->readGroup, self->readGroups, sizeof(self->readGroup[0]), comp_ReadGroup, NULL );
-    for (rg = 0; rg != self->readGroups; ++rg) {
-        if (rg > 0 && strcmp(self->readGroup[rg - 1].name, self->readGroup[rg].name) == 0)
-            return RC(rcAlign, rcFile, rcParsing, rcConstraint, rcViolated);  /* name must be unique */
-        self->readGroup[rg].id = rg;
-    }
-    for (i = 0; i < self->refSeqs; ++i) {
-        if (self->refSeq[i].length == 0) {
-            (void)PLOGMSG(klogWarn, (klogWarn, "Reference '$(ref)' has zero length", "ref=%s", self->refSeq[i].name));
-        }
-    }
-    
-    return 0;
-}
-
-static rc_t CountReadGroups(char const txt[], size_t len, unsigned *reads) {
-    const char *const endp = txt + len;
-    
-    *reads = 0;
-    
-    do {
-        while (txt != endp && isspace(*txt))
-            ++txt;
-        if (txt == endp || txt + 3 >= endp)
-            break;
-        
-        if (txt[0] == '@' && txt[1] == 'R' && txt[2] == 'G')
-            ++*reads;
-        
-        txt = memchr(txt, '\n', endp - txt);
-    } while (txt);
-    return 0;
-}
-
-static rc_t ReadMagic(BAMFile *self)
-{
-    uint8_t sig[4];
-    rc_t rc = BAMFileReadn(self, 4, sig);
-    
-    DBGMSG(DBG_ALIGN, DBG_FLAG(DBG_ALIGN_BAM), ("BAM signature: '%c%c%c' %u\n", sig[0], sig[1], sig[2], sig[3]));
-    if (rc == 0 && (sig[0] != 'B' || sig[1] != 'A' || sig[2] != 'M' || sig[3] != 1))
-        rc = RC(rcAlign, rcFile, rcReading, rcHeader, rcBadVersion);
-    return rc;
-}
-
-static rc_t ReadHeaders(BAMFile *self,
-                        char **headerText, size_t *headerTextLen,
-                        uint8_t **refData, unsigned *numrefs)
-{
-    unsigned hlen;
-    char *htxt = NULL;
-    unsigned nrefs;
-    uint8_t *rdat = NULL;
-    unsigned rdsz;
-    unsigned rdms;
-    unsigned i;
-    int32_t i32;
-    rc_t rc = BAMFileReadI32(self, &i32);
-    
-    if (rc) return rc;
-
-    if (i32 < 0) {
-        rc = RC(rcAlign, rcFile, rcReading, rcHeader, rcInvalid);
-        goto BAILOUT;
-    }
-    hlen = i32;
-    DBGMSG(DBG_ALIGN, DBG_FLAG(DBG_ALIGN_BAM), ("BAM Header text size: %u\n", hlen));
-    if (hlen) {
-        htxt = malloc(hlen + 1);
-        if (htxt == NULL) {
-            rc = RC(rcAlign, rcFile, rcReading, rcMemory, rcExhausted);
-            goto BAILOUT;
-        }
-        
-        rc = BAMFileReadn(self, hlen, (uint8_t *)htxt); if (rc) goto BAILOUT;
-        htxt[hlen] = '\0';
-    }
-    rc = BAMFileReadI32(self, &i32); if (rc) goto BAILOUT;
-    if (i32 < 0) {
-        rc = RC(rcAlign, rcFile, rcReading, rcHeader, rcInvalid);
-        goto BAILOUT;
-    }
-    nrefs = i32;
-    DBGMSG(DBG_ALIGN, DBG_FLAG(DBG_ALIGN_BAM), ("BAM Header reference count: %u\n", nrefs));
-    if (nrefs) {
-        rdms = nrefs * 16;
-        if (rdms < 4096)
-            rdms = 4096;
-        rdat = malloc(rdms);
-        if (rdat == NULL) {
-            rc = RC(rcAlign, rcFile, rcReading, rcMemory, rcExhausted);
-            goto BAILOUT;
-        }
-        for (i = rdsz = 0; i < nrefs; ++i) {
-            rc = BAMFileReadI32(self, &i32); if (rc) goto BAILOUT;
-            if (i32 <= 0) {
-                rc = RC(rcAlign, rcFile, rcReading, rcHeader, rcInvalid);
-                goto BAILOUT;
-            }
-            if (rdsz + i32 + 8 > rdms) {
-                void *tmp;
-                
-                do { rdms <<= 1; } while (rdsz + i32 + 8 > rdms);
-                tmp = realloc(rdat, rdms);
-                if (tmp == NULL) {
-                    rc = RC(rcAlign, rcFile, rcReading, rcMemory, rcExhausted);
-                    goto BAILOUT;
-                }
-                rdat = tmp;
-            }
-            memcpy(rdat + rdsz, &i32, 4);
-            rdsz += 4;
-            rc = BAMFileReadn(self, i32, &rdat[rdsz]); if (rc) goto BAILOUT;
-            rdsz += i32;
-            rc = BAMFileReadI32(self, &i32); if (rc) goto BAILOUT;
-            memcpy(rdat + rdsz, &i32, 4);
-            rdsz += 4;
-        }
-    }
-    DBGMSG(DBG_ALIGN, DBG_FLAG(DBG_ALIGN_BAM), ("BAM Header reference size: %u\n", rdsz));
-    
-    *headerText = htxt;
-    *headerTextLen = hlen;
-    *refData = rdat;
-    *numrefs = nrefs;
-    return 0;
-    
-BAILOUT:
-    if (htxt)
-        free(htxt);
-    if (rdat)
-        free(rdat);
-    
-    return rc;
-}
-
-static int CC comp_RefSeqName(const void *A, const void *B, void *ignored) {
-    BAMFile const *self = (BAMFile const *)ignored;
-    unsigned const a = *(unsigned const *)A;
-    unsigned const b = *(unsigned const *)B;
-    
-    return strcmp(self->refSeq[a].name, self->refSeq[b].name);
-}
-
-static rc_t ProcessHeader(BAMFile *self, char const headerText[])
-{
-    unsigned *rs_by_name = NULL;
-    unsigned i;
-    unsigned cp;
-    char *htxt;
-    uint8_t *rdat;
-    size_t hlen;
-    unsigned nrefs;
-    rc_t rc = ReadMagic(self);
-
-    if (rc) return rc;
-
-    rc = ReadHeaders(self, &htxt, &hlen, &rdat, &nrefs);
-    if (rc) return rc;
-    
-    self->fpos_first = self->fpos_cur;
-    self->ucfirst = self->bufCurrent;
-    DBGMSG(DBG_ALIGN, DBG_FLAG(DBG_ALIGN_BAM), ("BAM Data records start at: %lu+%u\n", self->ucfirst, self->fpos_first));
-
-    if (headerText) {
-        free(htxt);
-        hlen = string_size( headerText );
-        htxt = malloc(hlen + 1);
-        if (htxt == NULL) {
-            free(rdat);
-            return RC(rcAlign, rcFile, rcConstructing, rcMemory, rcExhausted);
-        }
-        memcpy(htxt, headerText, hlen + 1);
-    }
-    
-    self->headerData2 = rdat;
-    if (hlen) {
-        self->header = htxt;
-        self->headerData1 = malloc(hlen + 1);
-        if (self->headerData1 == NULL)
-            return RC(rcAlign, rcFile, rcConstructing, rcMemory, rcExhausted);
-        memcpy(self->headerData1, self->header, hlen + 1);
-    }
-    else {
-        htxt = malloc(1);
-        htxt[0] = '\0';
-        self->header = htxt;
-        self->headerData1 = NULL;
-    }
-    self->refSeqs = nrefs;
-    if (nrefs) {
-        self->refSeq = calloc(nrefs, sizeof(self->refSeq[0]));
-        if (self->refSeq == NULL)
-            return RC(rcAlign, rcFile, rcConstructing, rcMemory, rcExhausted);
-        
-        rs_by_name = calloc(nrefs, sizeof(rs_by_name[0]));
-        if (rs_by_name == NULL)
-            return RC(rcAlign, rcFile, rcConstructing, rcMemory, rcExhausted);
-        
-        for (i = cp = 0; i < nrefs; ++i) {
-            uint32_t nlen;
-            uint32_t rlen;
-            
-            rs_by_name[i] = i;
-            self->refSeq[i].id = i;
-            memcpy(&nlen, &self->headerData2[cp], 4);
-            cp += 4;
-            self->refSeq[i].name = (char const *)&self->headerData2[cp];
-            cp += nlen;
-            memcpy(&rlen, &self->headerData2[cp], 4);
-            self->headerData2[cp] = 0;
-            cp += 4;
-            self->refSeq[i].length = rlen;
-        }
-        ksort((void *)rs_by_name, self->refSeqs, sizeof(rs_by_name[0]), comp_RefSeqName, self);
-    }
-    if (self->headerData1) {
-        rc = CountReadGroups(self->headerData1, hlen, &self->readGroups);
-        if (rc == 0) {
-            self->readGroup = calloc(self->readGroups, sizeof(self->readGroup[0]));
-            if (self->readGroup != NULL)
-                rc = ParseHeader(self, self->headerData1, hlen, rs_by_name);
-            else
-                rc = RC(rcAlign, rcFile, rcConstructing, rcMemory, rcExhausted);
-        }
-    }
-    if (rs_by_name != NULL)
-        free((void *)rs_by_name);
-    
-    return rc;
-}
-
-/* MARK: BAM File destructor */
-
-static rc_t BAMIndexWhack(const BAMIndex *);
-
-static rc_t BAMFileWhack(BAMFile *self) {
-    if (self->refSeq)
-        free(self->refSeq);
-    if (self->readGroup)
-        free(self->readGroup);
-    if (self->header)
-        free((void *)self->header);
-    if (self->headerData1)
-        free((void *)self->headerData1);
-    if (self->headerData2)
-        free((void *)self->headerData2);
-    if (self->ndx)
-        BAMIndexWhack(self->ndx);
-    if (self->nocopy)
-        free(self->nocopy);
-    if (self->vt.FileWhack)
-        self->vt.FileWhack(&self->file);
-
-    return 0;
-}
-
-/* MARK: BAM File constructors */
-
-/* file is retained */
-static rc_t BAMFileMakeWithKFileAndHeader(BAMFile const **cself,
-                                          KFile const *file,
-                                          char const *headerText,
-                                          bool threaded)
-{
-    BAMFile *self = calloc(1, sizeof(*self));
-    rc_t rc;
-    
-    if (self == NULL)
-        return RC(rcAlign, rcFile, rcConstructing, rcMemory, rcExhausted);
-    
-    KRefcountInit(&self->refcount, 1, "BAMFile", "new", "");
-#ifndef WINDOWS
-    if (threaded)
-        rc = BGZThreadFileInit(&self->file.thread, file, &self->vt);
-    else
-#endif
-        rc = BGZFileInit(&self->file.plain, file, &self->vt);
-
-    if (rc == 0) {
-        rc = ProcessHeader(self, headerText);
-        if (rc == 0) {
-            *cself = self;
-            return 0;
-        }
-    }
-    BAMFileWhack(self);
-    return rc;
-}
-
-/* file is retained */
-LIB_EXPORT rc_t CC BAMFileMakeWithKFile(const BAMFile **cself, const KFile *file)
-{
-    return BAMFileMakeWithKFileAndHeader(cself, file, NULL, false);
-}
-
-LIB_EXPORT rc_t CC BAMFileVMakeWithDir(const BAMFile **result,
-                                         const KDirectory *dir,
-                                         const char *path,
-                                         va_list args
-                                         )
-{
-    rc_t rc;
-    const KFile *kf;
-    
-    if (result == NULL)
-        return RC(rcAlign, rcFile, rcOpening, rcParam, rcNull);
-    *result = NULL;
-    rc = KDirectoryVOpenFileRead(dir, &kf, path, args);
-    if (rc == 0) {
-        rc = BAMFileMakeWithKFile(result, kf);
-        KFileRelease(kf);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC BAMFileMakeWithDir(const BAMFile **result,
-                                        const KDirectory *dir,
-                                        const char *path, ...
-                                        )
-{
-    va_list args;
-    rc_t rc;
-    
-    va_start(args, path);
-    rc = BAMFileVMakeWithDir(result, dir, path, args);
-    va_end(args);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC BAMFileMake(const BAMFile **cself, const char *path, ...)
-{
-    KDirectory *dir;
-    va_list args;
-    rc_t rc;
-    
-    if (cself == NULL)
-        return RC(rcAlign, rcFile, rcOpening, rcParam, rcNull);
-    *cself = NULL;
-    
-    rc = KDirectoryNativeDir(&dir);
-    if (rc) return rc;
-    va_start(args, path);
-    rc = BAMFileVMakeWithDir(cself, dir, path, args);
-    va_end(args);
-    KDirectoryRelease(dir);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC BAMFileMakeWithHeader ( const BAMFile **cself,
-                                          char const headerText[],
-                                          char const path[], ... )
-{
-    KDirectory *dir;
-    va_list args;
-    rc_t rc;
-    const KFile *kf;
-    
-    if (cself == NULL)
-        return RC(rcAlign, rcFile, rcOpening, rcParam, rcNull);
-    *cself = NULL;
-    
-    rc = KDirectoryNativeDir(&dir);
-    if (rc) return rc;
-    va_start(args, path);
-    rc = KDirectoryVOpenFileRead(dir, &kf, path, args);
-    if (rc == 0) {
-        rc = BAMFileMakeWithKFileAndHeader(cself, kf, headerText, false);
-        KFileRelease(kf);
-    }
-    va_end(args);
-    KDirectoryRelease(dir);
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC BAMFileMakeWithVPath(const BAMFile **cself, const VPath *kpath)
-{
-    char path[4096];
-    size_t nread;
-    rc_t rc;
-
-    rc = VPathReadPath(kpath, path, sizeof(path), &nread);
-    if (rc == 0)
-        rc = BAMFileMake(cself, "%.*s", (int)nread, path);
-    return rc;
-}
-
-/* MARK: BAM File ref-counting */
-
-LIB_EXPORT rc_t CC BAMFileAddRef(const BAMFile *cself) {
-    if (cself != NULL)
-        KRefcountAdd(&cself->refcount, "BAMFile");
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMFileRelease(const BAMFile *cself) {
-    rc_t rc = 0;
-    BAMFile *self = (BAMFile *)cself;
-    
-    if (cself != NULL) {
-        if (KRefcountDrop(&self->refcount, "BAMFile") == krefWhack) {
-            rc = BAMFileWhack(self);
-            free(self);
-        }
-    }
-    return rc;
-}
-
-/* MARK: BAM File positioning */
-
-LIB_EXPORT float CC BAMFileGetProportionalPosition(const BAMFile *self)
-{
-    return self->vt.FileProPos(&self->file);
-}
-
-LIB_EXPORT rc_t CC BAMFileGetPosition(const BAMFile *self, BAMFilePosition *pos) {
-    *pos = (self->fpos_cur << 16) | self->bufCurrent;
-    return 0;
-}
-
-static rc_t BAMFileSetPositionInt(const BAMFile *cself, uint64_t fpos, uint16_t bpos)
-{
-    rc_t rc;
-    BAMFile *self = (BAMFile *)cself;
-    
-    if (cself->fpos_first > fpos || fpos > cself->vt.FileGetSize(&cself->file) ||
-        (fpos == cself->fpos_first && bpos < cself->ucfirst))
-    {
-        return RC(rcAlign, rcFile, rcPositioning, rcParam, rcInvalid);
-    }
-    if (cself->fpos_cur == fpos) {
-        if (bpos <= cself->bufSize) {
-            self->eof = false;
-            self->bufCurrent = bpos;
-            return 0;
-        }
-        return RC(rcAlign, rcFile, rcPositioning, rcParam, rcInvalid);
-    }
-    rc = self->vt.FileSetPos(&self->file, fpos);
-    if (rc == 0) {
-        self->eof = false;
-        self->bufSize = 0; /* force re-read */
-        self->bufCurrent = bpos;
-        self->fpos_cur = fpos;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC BAMFileSetPosition(const BAMFile *cself, const BAMFilePosition *pos)
-{
-    return BAMFileSetPositionInt(cself, *pos >> 16, (uint16_t)(*pos));
-}
-
-LIB_EXPORT rc_t CC BAMFileRewind(const BAMFile *cself)
-{
-    return BAMFileSetPositionInt(cself, cself->fpos_first, cself->ucfirst);
-}
-
-static void BAMFileAdvance(BAMFile *const self, unsigned distance)
-{
-    self->bufCurrent += distance;
-    if (self->bufCurrent == self->bufSize) {
-        self->fpos_cur = self->vt.FileGetPos(&self->file);
-        self->bufCurrent = 0;
-        self->bufSize = 0;
-    }
-}
-
-/* MARK: BAM Alignment contruction */
-
-static int TagTypeSize(int const type)
-{
-    switch (type) {
-        case dt_ASCII:      /* A */
-        case dt_INT8:       /* c */
-        case dt_UINT8:      /* C */
-            return 1;
-
-        case dt_INT16:      /* s */
-        case dt_UINT16:     /* S */
-            return 2;
-
-        case dt_INT:        /* i */
-        case dt_UINT:       /* I */
-        case dt_FLOAT32:    /* f */
-            return 4;
-#if 0
-        case dt_FLOAT64:    /* d */
-            return 8;
-#endif
-        case dt_CSTRING:    /* Z */
-        case dt_HEXSTRING:  /* H */
-            return -'S';
-
-        case dt_NUM_ARRAY:  /* B */
-            return -'A';
-    }
-    return 0;
-}
-
-static rc_t ParseOptData(BAMAlignment *const self, size_t const maxsize,
-                         size_t const xtra, size_t const datasize)
-{
-    size_t const maxExtra = (maxsize - (sizeof(*self) - sizeof(self->extra))) / sizeof(self->extra[0]);
-    char const *const base = (char const *)self->data->raw;
-    unsigned i = 0;
-    unsigned len;
-    unsigned offset;
-    
-    self->numExtra = 0;
-    for (len = 0, offset = (unsigned)xtra; offset < datasize; offset += len) {
-        int const valuelen1 = TagTypeSize(base[offset + 2]);
-        unsigned valuelen;
-        
-        if (valuelen1 < 0) {
-            char const *const value = &base[offset + 3];
-            
-            if (-valuelen1 == 'S') {
-                valuelen = 0;
-                while (value[valuelen] != '\0') {
-                    ++valuelen;
-                    if (offset + valuelen >= datasize) {
-                        rc_t const rc = RC(rcAlign, rcFile, rcReading, rcData, rcInvalid);
-                        return rc;
-                    }
-                }
-                ++valuelen;
-            }
-            else {
-                int const elem_size = TagTypeSize(value[0]);
-                
-                assert(-valuelen1 == 'A');
-                if (elem_size <= 0) {
-                    rc_t const rc = RC(rcAlign, rcFile, rcReading, rcData, rcUnexpected);
-                    return rc;
-                }
-                else {
-                    int const elem_count = LE2HI32(&value[1]);
-                    
-                    valuelen = elem_size * elem_count + 1 + 4;
-                    if (offset + valuelen >= datasize) {
-                        rc_t const rc = RC(rcAlign, rcFile, rcReading, rcData, rcInvalid);
-                        return rc;
-                    }
-                }
-            }
-        }
-        else if (valuelen1 == 0) {
-            rc_t const rc = RC(rcAlign, rcFile, rcReading, rcData, rcUnexpected);
-            return rc;
-        }
-        else
-            valuelen = valuelen1;
-        
-        len = valuelen + 3;
-        if (i < maxExtra) {
-            self->extra[i].offset = offset;
-            self->extra[i].size   = len;
-        }
-        ++i;
-    }
-    self->numExtra = i;
-    if (2 <= i && i <= maxExtra)
-        ksort(self->extra, i, sizeof(self->extra[0]), OptTag_sort, self);
-
-    return 0;
-}
-
-static rc_t ParseOptDataLog(BAMAlignment *const self, unsigned const maxsize,
-                            unsigned const xtra, unsigned const datasize)
-{
-    unsigned const maxExtra = (maxsize - (sizeof(*self) - sizeof(self->extra))) / sizeof(self->extra[0]);
-    char const *const base = (char const *)self->data->raw;
-    unsigned i = 0;
-    unsigned len;
-    unsigned offset;
-    
-    self->numExtra = 0;
-    for (len = 0, offset = (unsigned)xtra; offset < datasize; offset += len) {
-        int const type = base[offset + 2];
-        int const valuelen1 = TagTypeSize(type);
-        unsigned valuelen;
-        
-        if (valuelen1 > 0)
-            valuelen = valuelen1;
-        else if (valuelen1 < 0) {
-            char const *const value = &base[offset + 3];
-            
-            if (-valuelen1 == 'S') {
-                valuelen = 0;
-                while (value[valuelen] != '\0') {
-                    ++valuelen;
-                    if (offset + valuelen >= datasize) {
-                        rc_t const rc = RC(rcAlign, rcFile, rcReading, rcData, rcInvalid);
-                        (void)LOGERR(klogErr, rc,
-                                     "Parsing BAM optional fields: "
-                                     "unterminated string");
-                        return rc;
-                    }
-                }
-                ++valuelen;
-            }
-            else {
-                int const elem_type = value[0];
-                int const elem_size = TagTypeSize(elem_type);
-                
-                assert(-valuelen1 == 'A');
-                if (elem_size <= 0) {
-                    rc_t const rc = RC(rcAlign, rcFile, rcReading, rcData, rcUnexpected);
-                    (void)LOGERR(klogErr, rc,
-                                 "Parsing BAM optional fields: "
-                                 "unknown array type");
-                    return rc;
-                }
-                else {
-                    int const elem_count = LE2HI32(&value[1]);
-                    
-                    valuelen = elem_size * elem_count + 1 + 4;
-                    if (offset + valuelen >= datasize) {
-                        rc_t const rc = RC(rcAlign, rcFile, rcReading, rcData, rcInvalid);
-                        (void)LOGERR(klogErr, rc,
-                                     "Parsing BAM optional fields: "
-                                     "array too big");
-                        return rc;
-                    }
-                }
-            }
-        }
-        else {
-            rc_t const rc = RC(rcAlign, rcFile, rcReading, rcData, rcUnexpected);
-            (void)LOGERR(klogErr, rc,
-                                    "Parsing BAM optional fields: "
-                                    "unknown type");
-            return rc;
-        }
-        
-        len = valuelen + 3;
-        if (i < maxExtra) {
-            self->extra[i].offset = offset;
-            self->extra[i].size   = len;
-        }
-        ++i;
-    }
-    self->numExtra = i;
-    if (2 <= i && i <= maxExtra)
-        ksort(self->extra, i, sizeof(self->extra[0]), OptTag_sort, self);
-    
-    return 0;
-}
-
-static unsigned CC BAMAlignmentSize(unsigned const max_extra_tags)
-{
-    BAMAlignment const *const y = NULL;
-    
-    return sizeof(*y) + (max_extra_tags ? max_extra_tags - 1 : 0) * sizeof(y->extra);
-}
-
-static unsigned BAMAlignmentSetOffsets(BAMAlignment *const self)
-{
-    unsigned const nameLen = getReadNameLength(self);
-    unsigned const cigCnt  = getCigarCount(self);
-    unsigned const readLen = getReadLen(self);
-    unsigned const cigar   = (unsigned)(&((struct bam_alignment_s const *)NULL)->read_name[nameLen] - (const char *)NULL);
-    unsigned const seq     = cigar + 4 * cigCnt;
-    unsigned const qual    = seq + (readLen + 1) / 2;
-    unsigned const xtra    = qual + readLen;
-    
-    self->cigar = cigar;
-    self->seq   = seq;
-    self->qual  = qual;
-    
-    return xtra;
-}
-
-static bool BAMAlignmentInit(BAMAlignment *const self, unsigned const maxsize,
-                             unsigned const datasize, void const *const data)
-{
-    self->data = data;
-    self->datasize = datasize;
-    {
-        unsigned const xtra = BAMAlignmentSetOffsets(self);
-        
-        if (   datasize >= xtra
-            && datasize >= self->cigar
-            && datasize >= self->seq
-            && datasize >= self->qual)
-        {
-            rc_t const rc = ParseOptData(self, maxsize, xtra, datasize);
-
-            if (rc == 0)
-                return true;
-        }
-        return false;
-    }
-}
-
-static bool BAMAlignmentInitLog(BAMAlignment *const self, unsigned const maxsize,
-                                unsigned const datasize, void const *const data)
-{
-    self->data = data;
-    self->datasize = datasize;
-    {
-        unsigned const xtra = BAMAlignmentSetOffsets(self);
-        
-        if (   datasize >= xtra
-            && datasize >= self->cigar
-            && datasize >= self->seq
-            && datasize >= self->qual)
-        {
-            rc_t const rc = ParseOptDataLog(self, maxsize, xtra, datasize);
-            
-            if (rc == 0) {
-                DBGMSG(DBG_ALIGN, DBG_FLAG(DBG_ALIGN_BAM), ("{"
-                                                                "\"BAM record\": "
-                                                                "{ "
-                                                                    "\"size\": %u, "
-                                                                    "\"name length\": %u, "
-                                                                    "\"cigar count\": %u, "
-                                                                    "\"read length\": %u, "
-                                                                    "\"extra count\": %u "
-                                                                "}"
-                                                            "}\n",
-                                                            (unsigned)datasize,
-                                                            (unsigned)getReadNameLength(self),
-                                                            (unsigned)getCigarCount(self),
-                                                            (unsigned)getReadLen(self),
-                                                            (unsigned)self->numExtra));
-                return true;
-            }
-        }
-        DBGMSG(DBG_ALIGN, DBG_FLAG(DBG_ALIGN_BAM), ("{"
-                                                        "\"BAM record\": "
-                                                        "{ "
-                                                            "\"size\": %u, "
-                                                            "\"name length\": %u, "
-                                                            "\"cigar count\": %u, "
-                                                            "\"read length\": %u "
-                                                        "}"
-                                                    "}\n",
-                                                    (unsigned)datasize,
-                                                    (unsigned)getReadNameLength(self),
-                                                    (unsigned)getCigarCount(self),
-                                                    (unsigned)getReadLen(self)));
-        return false;
-    }
-}
-
-static void BAMAlignmentLogParseError(BAMAlignment const *self)
-{
-    char const *const reason = self->cigar > self->datasize ? "BAM Record CIGAR too long"
-                             : self->seq   > self->datasize ? "BAM Record SEQ too long"
-                             : self->qual  > self->datasize ? "BAM Record QUAL too long"
-                             : self->qual + getReadLen(self) > self->datasize ? "BAM Record EXTRA too long"
-                             : "BAM Record EXTRA parsing failure";
-    
-    LOGERR(klogErr, RC(rcAlign, rcFile, rcReading, rcRow, rcInvalid), reason);
-}
-
-/* MARK: BAM Alignment readers */
-
-/* returns
- *  (rcAlign, rcFile, rcReading, rcBuffer, rcNotAvailable)
- * or
- *  (rcAlign, rcFile, rcReading, rcBuffer, rcInsufficient)
- * if should read with copy
- */
-static
-rc_t BAMFileReadNoCopy(BAMFile *const self, unsigned actsize[], BAMAlignment rhs[],
-                       unsigned const maxsize)
-{
-    unsigned const maxPeek = BAMFileMaxPeek(self);
-    bool isgood;
-
-    *actsize = 0;
-    
-    rhs[0].parent = self;
-    if (maxPeek == 0) {
-        rc_t const rc = BAMFileFillBuffer(self);
-
-        if (rc == 0)
-            return BAMFileReadNoCopy(self, actsize, rhs, maxsize);
-
-        if (GetRCObject(rc) == rcData && GetRCState(rc) == rcInsufficient) {
-            self->eof = true;
-            return RC(rcAlign, rcFile, rcReading, rcRow, rcNotFound);
-        }
-        return rc;
-    }
-    if (maxPeek < 4)
-        return RC(rcAlign, rcFile, rcReading, rcBuffer, rcNotAvailable);
-    else {
-        int32_t const i32 = BAMFilePeekI32(self);
-
-        if (i32 <= 0)
-            return RC(rcAlign, rcFile, rcReading, rcData, rcInvalid);
-        
-        if (maxPeek < i32 + 4)
-            return RC(rcAlign, rcFile, rcReading, rcBuffer, rcNotAvailable);
-        
-        isgood = BAMAlignmentInitLog(rhs, maxsize, i32, BAMFilePeek(self, 4));
-        KRefcountInit(&rhs->refcount, 1, "BAMAlignment", "ReadNoCopy", "");
-    }
-    *actsize = BAMAlignmentSize(rhs[0].numExtra);
-    if (isgood && *actsize > maxsize)
-        return RC(rcAlign, rcFile, rcReading, rcBuffer, rcInsufficient);
-
-    BAMFileAdvance(self, 4 + rhs->datasize);
-    return isgood ? 0 : RC(rcAlign, rcFile, rcReading, rcRow, rcInvalid);
-}
-
-static
-unsigned BAMAlignmentSizeFromData(unsigned const datasize, void const *data)
-{
-    BAMAlignment temp;
-    
-    memset(&temp, 0, sizeof(temp));
-    BAMAlignmentInit(&temp, sizeof(temp), datasize, data);
-    
-    return BAMAlignmentSize(temp.numExtra);
-}
-
-static
-rc_t BAMFileReadCopy(BAMFile *const self, BAMAlignment const *rslt[], bool const log)
-{
-    void *storage;
-    void const *data;
-    unsigned datasize;
-    rc_t rc;
-    
-    rslt[0] = NULL;
-    {
-        int32_t i32;
-
-        rc = BAMFileReadI32(self, &i32);
-        if (rc) {
-            if (GetRCObject(rc) == rcData && GetRCState(rc) == rcInsufficient) {
-                self->eof = true;
-                rc = RC(rcAlign, rcFile, rcReading, rcRow, rcNotFound);
-            }
-            return rc;
-        }
-        if (i32 <= 0)
-            return RC(rcAlign, rcFile, rcReading, rcData, rcInvalid);
-        
-        datasize = i32;
-    }
-    if (BAMFileMaxPeek(self) < datasize) {
-        data = storage = malloc(datasize);
-        if (storage == NULL)
-            return RC(rcAlign, rcFile, rcReading, rcMemory, rcExhausted);
-        
-        rc = BAMFileReadn(self, datasize, storage);
-    }
-    else {
-        storage = NULL;
-        data = (bam_alignment *)&self->buffer[self->bufCurrent];
-        
-        BAMFileAdvance(self, datasize);
-    }
-    if (rc == 0) {
-        unsigned const rsltsize = BAMAlignmentSizeFromData(datasize, data);
-        BAMAlignment *const y = calloc(rsltsize, 1);
-
-        if (y) {
-            if ((log ? BAMAlignmentInitLog : BAMAlignmentInit)(y, rsltsize, datasize, data)) {
-                if (storage == NULL)
-                    self->bufLocker = y;
-                else
-                    y->storage = storage;
-
-                KRefcountInit(&y->refcount, 1, "BAMAlignment", "ReadCopy", "");
-                y->parent = self;
-                BAMFileAddRef(self);
-                rslt[0] = y;
-
-                if (getReadLen(y) == 0 && getCigarCount(y) == 0)
-                    return RC(rcAlign, rcFile, rcReading, rcRow, rcEmpty);
-                return 0;
-            }
-            rc = RC(rcAlign, rcFile, rcReading, rcRow, rcInvalid);
-            free(y);
-        }
-        else
-            rc = RC(rcAlign, rcFile, rcReading, rcMemory, rcExhausted);
-    }
-    free(storage);
-
-    return rc;
-}
-
-static
-rc_t BAMFileBreakLock(BAMFile *const self)
-{
-    if (self->bufLocker != NULL) {
-        if (self->bufLocker->storage == NULL)
-            self->bufLocker->storage = malloc(self->bufLocker->datasize);
-        if (self->bufLocker->storage == NULL)
-            return RC(rcAlign, rcFile, rcReading, rcMemory, rcExhausted);
-        
-        memcpy(self->bufLocker->storage, self->bufLocker->data, self->bufLocker->datasize);
-        self->bufLocker->data = (bam_alignment *)&self->bufLocker->storage[0];
-        self->bufLocker = NULL;
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMFileRead2(const BAMFile *cself, const BAMAlignment **rhs)
-{
-    BAMFile *const self = (BAMFile *)cself;
-    unsigned actsize = 0;
-    rc_t rc;
-    
-    if (self == NULL || rhs == NULL)
-        return RC(rcAlign, rcFile, rcReading, rcParam, rcNull);
-    
-    *rhs = NULL;
-    
-    if (self->bufCurrent >= self->bufSize && self->eof)
-        return RC(rcAlign, rcFile, rcReading, rcRow, rcNotFound);
-
-    rc = BAMFileBreakLock(self);
-    if (rc)
-        return rc;
-
-    if (self->nocopy_size == 0) {
-        size_t const size = 4096u;
-        void *const temp = malloc(size);
-
-        if (temp == NULL)
-            return RC(rcAlign, rcFile, rcReading, rcMemory, rcExhausted);
-
-        self->nocopy = temp;
-        self->nocopy_size = size;
-    }
-
-AGAIN:
-    rc = BAMFileReadNoCopy(self, &actsize, self->nocopy, (unsigned)self->nocopy_size);
-    if (rc == 0) {
-        *rhs = self->nocopy;
-        if (getReadLen(*rhs) == 0 && getCigarCount(*rhs) == 0) {
-            rc = RC(rcAlign, rcFile, rcReading, rcRow, rcEmpty);
-            LOGERR(klogWarn, rc, "BAM Record contains no alignment or sequence data");
-        }
-    }
-    else if (GetRCObject(rc) == rcBuffer && GetRCState(rc) == rcInsufficient) {
-        unsigned const size = (actsize + 4095u) & ~4095u;
-        void *const temp = realloc(self->nocopy, size);
-
-        if (temp == NULL)
-            return RC(rcAlign, rcFile, rcReading, rcMemory, rcExhausted);
-        
-        self->nocopy = temp;
-        self->nocopy_size = size;
-
-        goto AGAIN;
-    }
-    else if (GetRCObject(rc) == rcBuffer && GetRCState(rc) == rcNotAvailable) {
-        rc = BAMFileReadCopy(self, rhs, true);
-    }
-    else if (GetRCObject(rc) == rcRow && GetRCState(rc) == rcInvalid) {
-        BAMAlignmentLogParseError(self->nocopy);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC BAMFileRead(const BAMFile *cself, const BAMAlignment **rhs)
-{
-    BAMFile *const self = (BAMFile *)cself;
-    
-    if (self == NULL || rhs == NULL)
-        return RC(rcAlign, rcFile, rcReading, rcParam, rcNull);
-    
-    *rhs = NULL;
-    
-    if (self->bufCurrent >= self->bufSize && self->eof)
-        return RC(rcAlign, rcFile, rcReading, rcRow, rcNotFound);
-    else {
-        rc_t const rc = BAMFileBreakLock(self);
-        if (rc)
-            return rc;
-    }
-    return BAMFileReadCopy(self, rhs, false);
-}
-
-/* MARK: BAM File header info accessor */
-
-LIB_EXPORT rc_t CC BAMFileGetRefSeqById(const BAMFile *cself, int32_t id, const BAMRefSeq **rhs)
-{
-    *rhs = NULL;
-    if (id >= 0 && id < cself->refSeqs)
-        *rhs = &cself->refSeq[id];
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMFileGetReadGroupByName(const BAMFile *cself, const char *name, const BAMReadGroup **rhs)
-{
-    BAMReadGroup rg;
-    
-    *rhs = NULL;
-
-    rg.name = name;
-    if (rg.name != NULL)
-        *rhs = kbsearch(&rg, cself->readGroup, cself->readGroups, sizeof(rg), comp_ReadGroup, NULL);
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMFileGetRefSeqCount(const BAMFile *cself, unsigned *rhs)
-{
-    *rhs = cself->refSeqs;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMFileGetRefSeq(const BAMFile *cself, unsigned i, const BAMRefSeq **rhs)
-{
-    *rhs = NULL;
-    if (i < cself->refSeqs)
-        *rhs = &cself->refSeq[i];
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMFileGetReadGroupCount(const BAMFile *cself, unsigned *rhs)
-{
-    *rhs = cself->readGroups;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMFileGetReadGroup(const BAMFile *cself, unsigned i, const BAMReadGroup **rhs)
-{
-    *rhs = NULL;
-    if (i < cself->readGroups)
-        *rhs = &cself->readGroup[i];
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMFileGetHeaderText(BAMFile const *cself, char const **header, size_t *header_len)
-{
-    *header = cself->header;
-    *header_len = *header ? string_size( *header ) : 0;
-    return 0;
-}
-
-/* MARK: BAM Alignment destructor */
-
-static rc_t BAMAlignmentWhack(BAMAlignment *self)
-{
-    if (self->parent->bufLocker == self)
-        self->parent->bufLocker = NULL;
-    if (self != self->parent->nocopy) {
-        BAMFileRelease(self->parent);
-        free(self->storage);
-        free(self);
-    }
-    return 0;
-}
-
-/* MARK: BAM Alignment ref-counting */
-
-LIB_EXPORT rc_t CC BAMAlignmentAddRef(const BAMAlignment *cself)
-{
-    if (cself != NULL)
-        KRefcountAdd(&cself->refcount, "BAMAlignment");
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMAlignmentRelease(const BAMAlignment *cself)
-{
-    if (cself && KRefcountDrop(&cself->refcount, "BAMAlignment") == krefWhack)
-        BAMAlignmentWhack((BAMAlignment *)cself);
-
-    return 0;
-}
-
-#if 0
-LIB_EXPORT uint16_t CC BAMAlignmentIffyFields(const BAMAlignment *self)
-{
-}
-
-LIB_EXPORT uint16_t CC BAMAlignmentBadFields(const BAMAlignment *self)
-{
-}
-#endif
-
-/* MARK: BAM Alignment accessors */
-
-static uint32_t BAMAlignmentGetCigarElement(const BAMAlignment *self, unsigned i)
-{
-    return LE2HUI32(&((uint8_t const *)getCigarBase(self))[i * 4]);
-}
-
-LIB_EXPORT rc_t CC BAMAlignmentGetRefSeqId(const BAMAlignment *cself, int32_t *rhs)
-{
-    *rhs = getRefSeqId(cself);
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMAlignmentGetPosition(const BAMAlignment *cself, int64_t *rhs)
-{
-    *rhs = getPosition(cself);
-    return 0;
-}
-
-LIB_EXPORT bool CC BAMAlignmentIsMapped(const BAMAlignment *cself)
-{
-    if (((getFlags(cself) & BAMFlags_SelfIsUnmapped) == 0) && getRefSeqId(cself) >= 0 && getPosition(cself) >= 0)
-        return true;
-    return false;
-}
-
-static bool BAMAlignmentIsMateMapped(const BAMAlignment *cself)
-{
-    if (((getFlags(cself) & BAMFlags_MateIsUnmapped) == 0) && getMateRefSeqId(cself) >= 0 && getMatePos(cself) >= 0)
-        return true;
-    return false;
-}
-
-LIB_EXPORT rc_t CC BAMAlignmentGetAlignmentDetail(
-                                                  const BAMAlignment *self,
-                                                  BAMAlignmentDetail *rslt, uint32_t count, uint32_t *actual,
-                                                  int32_t *pfirst, int32_t *plast
-                                                  )
-{
-    unsigned i;
-    unsigned ccnt; /* cigar count */
-    int32_t  gpos; /* refSeq pos in global coordinates */
-    unsigned rpos; /* read pos (always local coordinates) */
-    uint32_t rlen; /* read length */
-    int32_t first = -1;
-    int32_t last = -1;
-
-    if (!self)
-        return RC(rcAlign, rcFile, rcReading, rcSelf, rcNull);
-
-    rlen = getReadLen(self);
-    ccnt = getCigarCount(self);
-    gpos = getPosition(self);
-    
-    if (gpos < 0)
-        ccnt = 0;
-    
-    if (actual)
-        *actual = ccnt;
-    
-    if (pfirst)
-        *pfirst = -1;
-
-    if (plast)
-        *plast = -1;
-
-    if (ccnt == 0)
-        return 0;
-    
-    if (rslt == NULL) {
-        if (actual == NULL)
-            return RC(rcAlign, rcFile, rcReading, rcParam, rcNull);
-        count = 0;
-    }
-    
-    if (count < ccnt)
-        return RC(rcAlign, rcFile, rcReading, rcBuffer, rcInsufficient);
-        
-    for (rpos = 0, i = 0; i != ccnt; ++i) {
-        uint32_t len = BAMAlignmentGetCigarElement(self, i);
-        int op = len & 0x0F;
-        
-        if (op > sizeof(cigarChars))
-            return RC(rcAlign, rcFile, rcReading, rcData, rcInvalid);
-        
-        op = cigarChars[op];
-        len >>= 4;
-        
-        rslt[i].refSeq_pos = gpos;
-        rslt[i].read_pos = rpos;
-        rslt[i].length = len;
-        rslt[i].type = (BAMCigarType)op;
-        
-        switch ((BAMCigarType)op) {
-        case ct_Match:
-        case ct_Equal:
-            if (first == -1)
-                first = i;
-            last = i;
-            gpos += len;
-            rpos += len;
-            break;
-        case ct_Insert:
-        case ct_SoftClip:
-            gpos += len;
-            break;
-        case ct_Delete:
-        case ct_Skip:
-            rpos += len;
-            break;
-        case ct_HardClip:
-        case ct_Padded:
-            rslt[i].refSeq_pos = -1;
-            rslt[i].read_pos = -1;
-            break;
-        default:
-            break;
-        }
-        
-        if (rslt[i].read_pos > rlen)
-            return RC(rcAlign, rcFile, rcReading, rcData, rcInvalid);
-    }
-    if (pfirst)
-        *pfirst = first;
-    
-    if (plast)
-        *plast = last;
-    
-    return 0;
-}
-
-static
-unsigned ReferenceLengthFromCIGAR(const BAMAlignment *self)
-{
-    unsigned i;
-    unsigned n = getCigarCount(self);
-    unsigned y;
-    
-    for (i = 0, y = 0; i != n; ++i) {
-        uint32_t const len = BAMAlignmentGetCigarElement(self, i);
-        
-        switch (cigarChars[len & 0x0F]) {
-        case ct_Match:
-        case ct_Equal:
-        case ct_NotEqual:
-        case ct_Delete:
-        case ct_Skip:
-            y += len >> 4;
-            break;
-        default:
-            break;
-        }
-    }
-    return y;
-}
-
-static
-unsigned SequenceLengthFromCIGAR(const BAMAlignment *self)
-{
-    unsigned i;
-    unsigned n = getCigarCount(self);
-    unsigned y;
-    
-    for (i = 0, y = 0; i != n; ++i) {
-        uint32_t const len = BAMAlignmentGetCigarElement(self, i);
-        
-        switch (cigarChars[len & 0x0F]) {
-        case ct_Match:
-        case ct_Equal:
-        case ct_NotEqual:
-        case ct_Insert:
-        case ct_SoftClip:
-            y += len >> 4;
-            break;
-        default:
-            break;
-        }
-    }
-    return y;
-}
-
-LIB_EXPORT rc_t CC BAMAlignmentGetPosition2(const BAMAlignment *cself, int64_t *rhs, uint32_t *length)
-{
-    *rhs = getPosition(cself);
-    if (*rhs >= 0)
-        *length = ReferenceLengthFromCIGAR(cself);
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMAlignmentGetReadGroupName(const BAMAlignment *cself, const char **rhs)
-{
-    *rhs = get_RG(cself);
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMAlignmentGetReadName(const BAMAlignment *cself, const char **rhs)
-{
-    *rhs = getReadName(cself);
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMAlignmentGetReadName2(const BAMAlignment *cself, const char **rhs, size_t *length)
-{
-    *length = getReadNameLength(cself) - 1;
-    *rhs = getReadName(cself);
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMAlignmentGetReadName3(const BAMAlignment *cself, const char **rhs, size_t *length)
-{
-    char const *const name = getReadName(cself);
-    size_t len = getReadNameLength(cself);
-    size_t i;
-    
-    for (i = len; i; ) {
-        int const ch = name[--i];
-        
-        if (ch == '/') {
-            len = i;
-            break;
-        }
-        if (!isdigit(ch))
-            break;
-    }
-    *rhs = name;
-    *length = len;
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMAlignmentGetFlags(const BAMAlignment *cself, uint16_t *rhs)
-{
-    *rhs = getFlags(cself);
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMAlignmentGetMapQuality(const BAMAlignment *cself, uint8_t *rhs)
-{
-    *rhs = getMapQual(cself);
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMAlignmentGetCigarCount(const BAMAlignment *cself, unsigned *rhs)
-{
-    *rhs = getCigarCount(cself);
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMAlignmentGetRawCigar(const BAMAlignment *cself, uint32_t const *rslt[], uint32_t *length)
-{
-    *rslt = getCigarBase(cself);
-    *length = getCigarCount(cself);
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMAlignmentGetCigar(const BAMAlignment *cself, uint32_t i, BAMCigarType *type, uint32_t *length)
-{
-    uint32_t x;
-    
-    if (i >= getCigarCount(cself))
-        return RC(rcAlign, rcFile, rcReading, rcParam, rcInvalid);
-
-    x = BAMAlignmentGetCigarElement(cself, i);
-    *type = (BAMCigarType)(cigarChars[x & 0x0F]);
-    *length = x >> 4;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMAlignmentGetReadLength(const BAMAlignment *cself, uint32_t *rhs)
-{
-    *rhs = getReadLen(cself);
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMAlignmentGetSequence2(const BAMAlignment *cself, char *rhs, uint32_t start, uint32_t stop)
-{
-    /*
-     *   =    A    C    M    G    R    S    V    T    W    Y    H    K    D    B    N
-     * 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
-     * 1111 1000 0100 1100 0010 1010 0110 1110 0001 1001 0101 1101 0011 1011 0111 0000
-     *   N    T    G    K    C    Y    S    B    A    W    R    D    M    H    V    =
-     */
-    static const char  tr[16] = "=ACMGRSVTWYHKDBN";
- /* static const char ctr[16] = "=TGKCYSBAWRDMHVN"; */
-    unsigned const n = getReadLen(cself);
-    const uint8_t * const seq = &cself->data->raw[cself->seq];
-    unsigned si, di;
-    
-    if (stop == 0 || stop > n)
-        stop = n;
-    
-    for (di = 0, si = start; si != stop; ++si, ++di) {
-        unsigned const b4na2 = seq[si >> 1];
-        unsigned const b4na = (si & 1) == 0 ? (b4na2 >> 4) : (b4na2 & 0x0F);
-        
-        rhs[di] = tr[b4na];
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMAlignmentGetSequence(const BAMAlignment *cself, char *rhs)
-{
-    return BAMAlignmentGetSequence2(cself, rhs, 0, 0);
-}
-
-LIB_EXPORT bool CC BAMAlignmentHasColorSpace(BAMAlignment const *cself)
-{
-    return get_CS(cself) != NULL;
-}
-
-LIB_EXPORT rc_t CC BAMAlignmentGetCSKey(BAMAlignment const *cself, char rhs[1])
-{
-    char const *const vCS = get_CS(cself);
-    
-    if (vCS)
-        rhs[0] = vCS[0];
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMAlignmentGetCSSeqLen(BAMAlignment const *cself, uint32_t *rhs)
-{
-    struct offset_size_s const *const vCS = get_CS_info(cself);
-    
-    *rhs = vCS ? vCS->size - 5 : 0;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMAlignmentGetCSSequence(BAMAlignment const *cself, char rhs[], uint32_t seqlen)
-{
-    char const *const vCS = get_CS(cself);
-    
-    if (vCS) {
-        unsigned i;
-        
-        for (i = 0;i != seqlen; ++i) {
-            char const ch = vCS[i+1];
-            
-            rhs[i] = (ch == '4') ? '.' : ch;
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMAlignmentGetQuality(const BAMAlignment *cself, const uint8_t **rhs)
-{
-    *rhs = &cself->data->raw[cself->qual];
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMAlignmentGetQuality2(BAMAlignment const *cself, uint8_t const **rhs, uint8_t *offset)
-{
-    uint8_t const *const OQ = get_OQ(cself);
-    
-    if (OQ) {
-        struct offset_size_s const *const oq = get_OQ_info(cself);
-        
-        if (oq->size - 4 == getReadLen(cself)) {
-            *offset = 33;
-            *rhs = OQ;
-        }
-        else
-            return RC(rcAlign, rcRow, rcReading, rcData, rcInconsistent);
-    }
-    else {
-        *offset = 0;
-        *rhs = &cself->data->raw[cself->qual];
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMAlignmentGetCSQuality(BAMAlignment const *cself, uint8_t const **rhs, uint8_t *offset)
-{
-    struct offset_size_s const *const cs = get_CS_info(cself);
-    struct offset_size_s const *const cq = get_CQ_info(cself);
-    uint8_t const *const CQ = get_CQ(cself);
-    
-    if (cs && cq && CQ) {
-        if (cs->size == cq->size) {
-            *offset = 33;
-            *rhs = CQ + 1;
-            return 0;
-        }
-        if (cs->size == cq->size + 1) {
-            *offset = 33;
-            *rhs = CQ;
-            return 0;
-        }
-        return RC(rcAlign, rcRow, rcReading, rcData, rcInconsistent);
-    }
-    *offset = 0;
-    *rhs = &cself->data->raw[cself->qual];
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMAlignmentGetMateRefSeqId(const BAMAlignment *cself, int32_t *rhs)
-{
-    *rhs = getMateRefSeqId(cself);
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMAlignmentGetMatePosition(const BAMAlignment *cself, int64_t *rhs)
-{
-    *rhs = getMatePos(cself);
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMAlignmentGetInsertSize(const BAMAlignment *cself, int64_t *rhs)
-{
-    *rhs = getInsertSize(cself);
-    return 0;
-}
-
-static int FormatOptData(BAMAlignment const *const self,
-                         size_t const maxsize,
-                         char buffer[])
-{
-    char const *const base = (char const *)&self->data->raw[self->qual + getReadLen(self)];
-    unsigned i;
-    unsigned offset;
-    unsigned cur = 0;
-    int j;
-    
-    for (i = 0, offset = 0; i < self->numExtra; ++i) {
-        int type;
-        union { float f; uint32_t i; } fi;
-        
-        if (cur + 7 > maxsize)
-            return -1;
-        buffer[cur++] = '\t';
-        buffer[cur++] = base[offset++];
-        buffer[cur++] = base[offset++];
-        buffer[cur++] = ':';
-        type = base[offset++];
-
-        switch (type) {
-            case dt_ASCII:      /* A */
-                buffer[cur++] = 'A';
-                buffer[cur++] = ':';
-                buffer[cur++] = base[offset++];
-                break;
-
-            case dt_INT8:       /* c */
-                buffer[cur++] = 'i';
-                buffer[cur++] = ':';
-                j = snprintf(buffer + cur, maxsize - cur, "%i", (int)*((int8_t const *)(base + offset)));
-                if ((cur += j) >= maxsize)
-                    return -1;
-                offset += 1;
-                break;
-
-            case dt_UINT8:      /* C */
-                buffer[cur++] = 'i';
-                buffer[cur++] = ':';
-                j = snprintf(buffer + cur, maxsize - cur, "%u", (unsigned)*((uint8_t const *)(base + offset)));
-                if ((cur += j) >= maxsize)
-                    return -1;
-                offset += 1;
-                break;
-                
-            case dt_INT16:      /* s */
-                buffer[cur++] = 'i';
-                buffer[cur++] = ':';
-                j = snprintf(buffer + cur, maxsize - cur, "%i", (int)LE2HI16(base + offset));
-                if ((cur += j) >= maxsize)
-                    return -1;
-                offset += 2;
-                break;
-
-            case dt_UINT16:     /* S */
-                buffer[cur++] = 'i';
-                buffer[cur++] = ':';
-                j = snprintf(buffer + cur, maxsize - cur, "%u", (unsigned)LE2HUI16(base + offset));
-                if ((cur += j) >= maxsize)
-                    return -1;
-                offset += 2;
-                break;
-                
-            case dt_INT:        /* i */
-                buffer[cur++] = 'i';
-                buffer[cur++] = ':';
-                j = snprintf(buffer + cur, maxsize - cur, "%i", (int)LE2HI32(base + offset));
-                if ((cur += j) >= maxsize)
-                    return -1;
-                offset += 4;
-                break;
-
-            case dt_UINT:       /* I */
-                buffer[cur++] = 'i';
-                buffer[cur++] = ':';
-                j = snprintf(buffer + cur, maxsize - cur, "%i", (int)LE2HI32(base + offset));
-                if ((cur += j) >= maxsize)
-                    return -1;
-                offset += 4;
-                break;
-
-            case dt_FLOAT32:    /* f */
-                buffer[cur++] = 'f';
-                buffer[cur++] = ':';
-                fi.i = LE2HUI32(base + offset);
-                j = snprintf(buffer + cur, maxsize - cur, "%f", fi.f);
-                if ((cur += j) >= maxsize)
-                    return -1;
-                offset += 4;
-                break;
-
-            case dt_HEXSTRING:  /* H */
-            case dt_CSTRING:    /* Z */
-                buffer[cur++] = type == dt_CSTRING ? 'Z' : 'H';
-                buffer[cur++] = ':';
-                for ( ; ; ) {
-                    int const ch = base[offset++];
-                    
-                    if (ch == '\0')
-                        break;
-                    if (cur >= maxsize)
-                        return -1;
-                    buffer[cur++] = ch;
-                }
-                break;
-
-            case dt_NUM_ARRAY:  /* B */
-                buffer[cur++] = 'B';
-                buffer[cur++] = ':';
-                {
-                    int const elemtype = base[offset++];
-                    unsigned const elemcount = LE2HUI32(base + offset);
-                    unsigned k;
-
-                    if (cur + 2 >= maxsize)
-                        return -1;
-                    buffer[cur++] = elemtype;
-                    offset += 4;
-                    for (k = 0; k < elemcount; ++k) {
-                        buffer[cur++] = ',';
-                        switch (elemtype) {
-                            case dt_INT8:
-                                j = snprintf(buffer + cur, maxsize - cur, "%i", (int)*((int8_t const *)(base + offset)));
-                                if ((cur += j) >= maxsize)
-                                    return -1;
-                                offset += 1;
-                                break;
-                                
-                            case dt_UINT8:
-                                j = snprintf(buffer + cur, maxsize - cur, "%u", (unsigned)*((uint8_t const *)(base + offset)));
-                                if ((cur += j) >= maxsize)
-                                    return -1;
-                                offset += 1;
-                                break;
-                                
-                            case dt_INT16:
-                                j = snprintf(buffer + cur, maxsize - cur, "%i", (int)LE2HI16(base + offset));
-                                if ((cur += j) >= maxsize)
-                                    return -1;
-                                offset += 2;
-                                break;
-                                
-                            case dt_UINT16:
-                                j = snprintf(buffer + cur, maxsize - cur, "%u", (unsigned)LE2HUI16(base + offset));
-                                if ((cur += j) >= maxsize)
-                                    return -1;
-                                offset += 2;
-                                break;
-                                
-                            case dt_INT:
-                                j = snprintf(buffer + cur, maxsize - cur, "%i", (int)LE2HI32(base + offset));
-                                if ((cur += j) >= maxsize)
-                                    return -1;
-                                offset += 4;
-                                break;
-                                
-                            case dt_UINT:
-                                j = snprintf(buffer + cur, maxsize - cur, "%u", (unsigned)LE2HUI32(base + offset));
-                                if ((cur += j) >= maxsize)
-                                    return -1;
-                                offset += 4;
-                                break;
-                                
-                            case dt_FLOAT32:
-                                fi.i = LE2HUI32(base + offset);
-                                j = snprintf(buffer + cur, maxsize - cur, "%f", fi.f);
-                                if ((cur += j) >= maxsize)
-                                    return -1;
-                                offset += 4;
-
-                            default:
-                                return -1;
-                                break;
-                        }
-                    }
-                }
-                break;
-
-            default:
-                return -1;
-                break;
-        }
-    }
-    return cur;
-}
-
-static rc_t FormatSAM(BAMAlignment const *self,
-                      size_t *const actsize,
-                      size_t const maxsize,
-                      char *const buffer)
-{
-    int i = 0;
-    size_t cur = 0;
-    unsigned j;
-    int const refSeqId = getRefSeqId(self);
-    int const refPos = getPosition(self);
-    unsigned const cigCount = getCigarCount(self);
-    uint32_t const *const cigar = getCigarBase(self);
-    int const mateRefSeqId = getMateRefSeqId(self);
-    int const mateRefPos = getMatePos(self);
-    unsigned const readlen = getReadLen(self);
-
-    i = snprintf(&buffer[cur], maxsize - cur,
-                 "%s\t%i\t%s\t%i\t%i\t",
-                 getReadName(self),
-                 getFlags(self),
-                 refSeqId < 0 ? "*" : self->parent->refSeq[refSeqId].name,
-                 refPos < 0 ? 0 : refPos + 1,
-                 getMapQual(self)
-                 );
-    if ((cur += i) > maxsize)
-        return RC(rcAlign, rcRow, rcReading, rcData, rcExcessive);
-
-    if (cigCount > 0) {
-        for (j = 0; j < cigCount; ++j) {
-            uint32_t const el = cigar[j];
-            BAMCigarType const type = (BAMCigarType)(cigarChars[el & 0x0F]);
-            unsigned const length = el >> 4;
-
-            i = snprintf(&buffer[cur], maxsize - cur, "%u%c", length, type);
-            if ((cur += i) > maxsize)
-                return RC(rcAlign, rcRow, rcReading, rcData, rcExcessive);
-        }
-    }
-    else {
-        if ((cur + 1) > maxsize)
-            return RC(rcAlign, rcRow, rcReading, rcData, rcExcessive);
-        buffer[cur++] = '*';
-    }
-    i = snprintf(&buffer[cur], maxsize - cur,
-                 "\t%s\t%i\t%i\t",
-                 mateRefSeqId < 0 ? "*" : mateRefSeqId == refSeqId ? "=" : self->parent->refSeq[mateRefSeqId].name,
-                 mateRefPos < 0 ? 0 : mateRefPos + 1,
-                 getInsertSize(self)
-                 );
-    if ((cur += i) > maxsize)
-        return RC(rcAlign, rcRow, rcReading, rcData, rcExcessive);
-    if (readlen) {
-        uint8_t const *const qual = &self->data->raw[self->qual];
-        
-        if (cur + 2 * readlen + 1 > maxsize)
-            return RC(rcAlign, rcRow, rcReading, rcData, rcExcessive);
-        BAMAlignmentGetSequence(self, &buffer[cur]);
-        cur += readlen;
-        buffer[cur] = '\t';
-        ++cur;
-        
-        for (j = 0; j < readlen; ++j) {
-            if (qual[j] != 0xFF)
-                goto HAS_QUAL;
-        }
-        if (1) {
-            buffer[cur++] = '*';
-        }
-        else {
-    HAS_QUAL:
-            for (j = 0; j < readlen; ++j)
-                buffer[cur++] = qual[j] + 33;
-        }
-    }
-    else {
-        i = snprintf(&buffer[cur], maxsize - cur, "*\t*");
-        if ((cur += i) > maxsize)
-            return RC(rcAlign, rcRow, rcReading, rcData, rcExcessive);
-    }
-    i = FormatOptData(self, maxsize - cur, &buffer[cur]);
-    if (i < 0)
-        return RC(rcAlign, rcRow, rcReading, rcData, rcExcessive);
-    if ((cur += i) + 2 > maxsize)
-        return RC(rcAlign, rcRow, rcReading, rcData, rcExcessive);
-    buffer[cur++] = '\n';
-    buffer[cur] = '\0';
-    *actsize = cur;
-
-    return 0;
-}
-
-#define FORMAT_SAM_SCRATCH_SIZE ((size_t)(64u * 1024u))
-static rc_t FormatSAMBuffer(BAMAlignment const *self,
-                            size_t actSize[],
-                            size_t const maxsize,
-                            char *const buffer)
-{
-    char scratch[FORMAT_SAM_SCRATCH_SIZE];
-    size_t actsize = 0;
-    rc_t const rc = FormatSAM(self, &actsize, FORMAT_SAM_SCRATCH_SIZE, scratch);
-
-    actSize[0] = actsize;
-    if (rc) return rc;
-    
-    if (actsize > maxsize)
-        return RC(rcAlign, rcReading, rcRow, rcBuffer, rcInsufficient);
-
-    memcpy(buffer, scratch, actsize);
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMAlignmentFormatSAM(BAMAlignment const *self,
-                                         size_t *const actSize,
-                                         size_t const maxsize,
-                                         char *const buffer)
-{
-    if (self == NULL)
-        return RC(rcAlign, rcReading, rcRow, rcSelf, rcNull);
-    if (buffer == NULL)
-        return RC(rcAlign, rcReading, rcRow, rcParam, rcNull);
-    else {
-        size_t actsize = 0;
-        rc_t const rc = (maxsize < FORMAT_SAM_SCRATCH_SIZE ? FormatSAMBuffer : FormatSAM)(self, &actsize, maxsize, buffer);
-
-        if (actSize)
-            *actSize = actsize;
-        return rc;
-    }
-}
-
-typedef struct OptForEach_ctx_s {
-    BAMOptData *val;
-    BAMOptData **alloced;
-    size_t valsize;
-    rc_t rc;
-    BAMOptionalDataFunction user_f;
-    void *user_ctx;
-} OptForEach_ctx_t;
-
-static bool i_OptDataForEach(BAMAlignment const *cself, void *Ctx, char const tag[2], BAMOptDataValueType type, unsigned count, void const *value, unsigned size)
-{
-    OptForEach_ctx_t *ctx = (OptForEach_ctx_t *)Ctx;
-    size_t const need = (size_t)&((BAMOptData const *)NULL)->u.f64[(count * size + sizeof(double) - 1)/sizeof(double)];
-    
-    if (need > ctx->valsize) {
-        void *const temp = realloc(ctx->alloced, need);
-        if (temp == NULL) {
-            ctx->rc = RC(rcAlign, rcFile, rcReading, rcMemory, rcExhausted);
-            return true;
-        }
-        *ctx->alloced = ctx->val = temp;
-        ctx->valsize = need;
-    }
-    ctx->val->type = type;
-    ctx->val->element_count = (type == dt_CSTRING || type == dt_HEXSTRING) ? size - 1 : count;
-    
-    memcpy(ctx->val->u.u8, value, size * count);
-#if __BYTE_ORDER == __BIG_ENDIAN
-    {{
-        unsigned di;
-        uint32_t elem_count = ctx->val->element_count;
-        
-        switch (size) {
-        case 2:
-            for (di = 0; di != elem_count; ++di)
-                ctx->val->u.u16[di] = LE2HUI16(&ctx->val->u.u16[di]);
-            break;
-        case 4:
-            for (di = 0; di != elem_count; ++di)
-                ctx->val->u.u32[di] = LE2HUI32(&ctx->val->u.u32[di]);
-            break;
-        case 8:
-            for (di = 0; di != elem_count; ++di)
-                ctx->val->u.u64[di] = LE2HUI64(&ctx->val->u.u64[di]);
-            break;
-        }
-    }}
-#endif
-    ctx->rc = ctx->user_f(ctx->user_ctx, tag, ctx->val);
-    return ctx->rc != 0;
-}
-
-LIB_EXPORT rc_t CC BAMAlignmentOptDataForEach(const BAMAlignment *cself, void *user_ctx, BAMOptionalDataFunction f)
-{
-    union u {
-        BAMOptData value;
-        uint8_t storage[4096];
-    } value_auto;
-    OptForEach_ctx_t ctx;
-    rc_t rc = 0;
-    unsigned i;
-    
-    ctx.val = &value_auto.value;
-    ctx.alloced = NULL;
-    ctx.valsize = sizeof(value_auto);
-    ctx.rc = 0;
-    ctx.user_f = f;
-    ctx.user_ctx = user_ctx;
-    
-    for (i = 0; i != cself->numExtra; ++i) {
-        char const *const tag = (char const *)&cself->data->raw[cself->extra[i].offset];
-        uint8_t type = tag[2];
-        uint8_t const *const vp = (uint8_t const *)&tag[3];
-        unsigned len = cself->extra[i].size - 3;
-        unsigned size = cself->extra[i].size - 3;
-        unsigned count = 1;
-        unsigned offset = 0;
-        
-        if (type == dt_NUM_ARRAY) {
-            unsigned elem_size = 0;
-            uint32_t elem_count = 0;
-            
-            offset = len = 5;
-            switch (vp[0]) {
-            case dt_INT8:
-            case dt_UINT8:
-                elem_size = 1;
-                break;
-            case dt_INT16:
-            case dt_UINT16:
-                elem_size = 2;
-                break;
-            case dt_FLOAT32:
-            case dt_INT:
-            case dt_UINT:
-                elem_size = 4;
-                break;
-#if 0
-            case dt_FLOAT64:
-                elem_size = 8;
-                break;
-#endif
-            default:
-                rc = RC(rcAlign, rcFile, rcReading, rcData, rcUnexpected);
-                break;
-            }
-            if (rc)
-                break;
-            elem_count = LE2HUI32(&vp[1]);
-            len += elem_size * elem_count;
-            type = vp[0];
-            count = elem_count;
-            size = elem_size;
-            break;
-        }
-        if (i_OptDataForEach(cself, &ctx, tag, type, count, &vp[offset], size))
-            break;
-    }
-    rc = rc ? rc : ctx.rc;
-    if (ctx.alloced)
-        free(ctx.alloced);
-    return rc;
-}
-
-/* MARK: Complete Genomics stuff */
-
-LIB_EXPORT bool CC BAMAlignmentHasCGData(BAMAlignment const *self)
-{
-    return get_CG_GC_info(self) && get_CG_GS_info(self) && get_CG_GQ_info(self);
-}
-
-static bool BAMAlignmentParseCGTag(BAMAlignment const *self, size_t const max_cg_segs, unsigned cg_segs[/* max_cg_segs */])
-{
-    /*** patern in cg_segs should be nSnGnSnG - no more then 7 segments **/
-    struct offset_size_s const *const GCi = get_CG_GC_info(self);
-    char const *cg  = (char const *)&self->data->raw[GCi->offset + 3];
-    char const *const end = cg + GCi->size - 4;
-    unsigned iseg = 0;
-    char last_op = 'S';
-
-    memset(cg_segs, 0, max_cg_segs * sizeof(cg_segs[0]));
-    
-    while (cg < end && iseg < max_cg_segs) {
-        char *endp;
-        long const op_len = strtol(cg, &endp, 10);
-        char const op = *(cg = endp);
-        
-        ++cg;
-        if (op==last_op) {
-            cg_segs[iseg] += op_len;
-        }
-        else {
-            last_op = op;
-            ++iseg;
-            cg_segs[iseg] = (unsigned)op_len;
-        }
-    }
-    return true;
-}
-
-static
-rc_t ExtractInt32(BAMAlignment const *self, int32_t *result,
-                  struct offset_size_s const *const tag)
-{
-    int64_t y;
-    int const type = self->data->raw[tag->offset + 2];
-    void const *const pvalue = &self->data->raw[tag->offset + 3];
-    
-    switch (type) {
-    case 'c':
-        if (tag->size == 4)
-            y = *((int8_t const *)pvalue);
-        else
-            return RC(rcAlign, rcRow, rcReading, rcData, rcInvalid);
-        break;
-    case 'C':
-        if (tag->size == 4)
-            y = *((uint8_t const *)pvalue);
-        else
-            return RC(rcAlign, rcRow, rcReading, rcData, rcInvalid);
-        break;
-    case 's':
-        if (tag->size == 5)
-            y = LE2HI16(pvalue);
-        else
-            return RC(rcAlign, rcRow, rcReading, rcData, rcInvalid);
-        break;
-    case 'S':
-        if (tag->size == 5)
-            y = LE2HUI16(pvalue);
-        else
-            return RC(rcAlign, rcRow, rcReading, rcData, rcInvalid);
-        break;
-    case 'i':
-        if (tag->size == 7)
-            y = LE2HI32(pvalue);
-        else
-            return RC(rcAlign, rcRow, rcReading, rcData, rcInvalid);
-        break;
-    case 'I':
-        if (tag->size == 7)
-            y = LE2HUI32(pvalue);
-        else
-            return RC(rcAlign, rcRow, rcReading, rcData, rcInvalid);
-        break;
-    default:
-        return RC(rcAlign, rcRow, rcReading, rcData, rcNotFound);
-    }
-    if (INT32_MIN <= y && y <= INT32_MAX) {
-        *result = (int32_t)y;
-        return 0;
-    }
-    return RC(rcAlign, rcRow, rcReading, rcData, rcInvalid);
-}
-
-LIB_EXPORT
-rc_t CC BAMAlignmentGetCGAlignGroup(BAMAlignment const *self,
-                                    char buffer[],
-                                    size_t max_size,
-                                    size_t *act_size)
-{
-    struct offset_size_s const *const ZA = get_CG_ZA_info(self);
-    struct offset_size_s const *const ZI = get_CG_ZI_info(self);
-    
-    if (ZA && ZI) {
-        rc_t rc;
-        int32_t za;
-        int32_t zi;
-        
-        rc = ExtractInt32(self, &za, ZA); if (rc) return rc;
-        rc = ExtractInt32(self, &zi, ZI); if (rc) return rc;
-        return string_printf(buffer, max_size, act_size, "%i_%i", zi, za);
-    }
-    return RC(rcAlign, rcRow, rcReading, rcData, rcNotFound);
-}
-
-LIB_EXPORT
-rc_t CC BAMAlignmentGetCGSeqQual(BAMAlignment const *self,
-                                 char sequence[],
-                                 uint8_t quality[])
-{
-    struct offset_size_s const *const GCi = get_CG_GC_info(self);
-    struct offset_size_s const *const GSi = get_CG_GS_info(self);
-    struct offset_size_s const *const GQi = get_CG_GQ_info(self);
-    
-    if (GCi && GSi && GQi) {
-        char const *const vGS = (char const *)&self->data->raw[GSi->offset + 3];
-        char const *const GQ  = (char const *)&self->data->raw[GQi->offset + 3];
-        unsigned const GSsize = GSi->size - 4;
-        unsigned const sn = getReadLen(self);
-        unsigned cg_segs[2*CG_NUM_SEGS-1]; /** 4 segments + 3gaps **/
-        unsigned i,G,S;
-        
-        if (GSi->size != GQi->size)
-            return RC(rcAlign, rcRow, rcReading, rcData, rcInvalid);
-        
-        if (SequenceLengthFromCIGAR(self) != sn)
-            return RC(rcAlign, rcRow, rcReading, rcData, rcInvalid);
-
-        if (!BAMAlignmentParseCGTag(self, 2*CG_NUM_SEGS-1, cg_segs))
-            return RC(rcAlign, rcRow, rcReading, rcData, rcInvalid);
-        
-        for (S = cg_segs[0], G = 0, i = 1; i < CG_NUM_SEGS; ++i) { /** sum all S and G **/
-            S += cg_segs[2*i];
-            G += cg_segs[2*i-1];
-        }
-        if (G + G != GSsize || S + G > sn || sn + G != 35) {
-            /*fprintf(stderr, "GSsize: %u; sn: %u; S: %u; G: %u\n", GSsize, sn, S, G);*/
-            return RC(rcAlign, rcRow, rcReading, rcData, rcInvalid);
-        }
-        if (G > 0) {
-            unsigned nsi = cg_segs[0];   /** new index into sequence */
-            unsigned osi = nsi + G;      /** old index into sequence */
-            unsigned k;                  /** index into inserted sequence **/
-            
-            /***make room for inserts **/
-            memmove(sequence + osi, sequence + nsi, sn - nsi);
-            memmove(quality  + osi, quality  + nsi, sn - nsi);
-            
-            for (i = 1, k = 0; i < CG_NUM_SEGS && nsi < osi; ++i) {/*** when osi and nsi meet we are done ***/
-                unsigned j;
-                
-                for (j = cg_segs[2*i-1]; j > 0; --j) { /** insert mode **/
-                    sequence[nsi] = vGS[k];
-                    quality [nsi] = GQ[k] - 33;
-                    ++nsi; ++k;
-                    sequence[nsi] = vGS[k];
-                    quality [nsi] = GQ[k] - 33;
-                    ++nsi;
-                    ++osi;
-                    ++k;
-                }
-                if (nsi < osi){
-                    for (j = cg_segs[2*i]; j > 0; --j) { /** copy mode **/
-                        sequence[nsi] = sequence[osi];
-                        quality[nsi]  = quality[osi];
-                        ++nsi;
-                        ++osi;
-                    }
-                }
-            }
-        }
-        return 0;
-    }
-    return RC(rcAlign, rcRow, rcReading, rcData, rcNotFound);
-}
-
-
-static unsigned splice(uint32_t cigar[], unsigned n, unsigned at, unsigned out, unsigned in, uint32_t const new_values[/* in */])
-{
-    assert(at + out <= n);
-    memmove(&cigar[at + in], &cigar[at + out], (n - at - out) * 4);
-    if (in)
-        memcpy(&cigar[at], new_values, in * 4);
-    return n + in - out;
-}
-
-#define OPCODE_2_FIX (0xF)
-
-static unsigned insert_B(unsigned S, unsigned G, unsigned const n, uint32_t cigar[/* n */])
-{
-    unsigned i;
-    unsigned pos;
-    unsigned const T = S + G;
-    
-    for (pos = i = 0; i < n; ++i) {
-        int const opcode = cigar[i] & 0xF;
-        
-        switch (opcode) {
-        case 0:
-        case 1:
-        case 4:
-        case 7:
-        case 8:
-            {{
-                unsigned const len = cigar[i] >> 4;
-                unsigned const nxt = pos + len;
-                
-                if (pos <= T && T <= nxt) {
-                    unsigned const l = T - pos;
-                    unsigned const r = len - l;
-                    unsigned B = i + 2;
-                    unsigned in = 4;
-                    uint32_t Ops[4];
-                    uint32_t *ops = Ops;
-                    
-                    Ops[0] = (l << 4) | opcode;
-                    Ops[1] = (G << 4) | 9; /* B */
-                    Ops[2] = (G << 4) | 0; /* M this is not backwards */
-                    Ops[3] = (r << 4) | opcode;
-                    
-                    if (r == 0)
-                        --in;
-                    if (l == 0) {
-                        ++ops;
-                        --in;
-                        --B;
-                    }
-                    return splice(cigar, n, i, 1, in, ops);
-                }
-                pos = nxt;
-            }}
-            break;
-        default:
-            break;
-        }
-    }
-    return n;
-}
-
-static unsigned fix_I(uint32_t cigar[], unsigned n)
-{
-    unsigned i;
-    int last_b = 0;
-    
-    for (i = 0; i < n; ++i) {
-        unsigned const opcode = cigar[i] & 0xF;
-        
-        if (opcode == 0xF) {
-            unsigned const oplen = cigar[i] >> 4;
-            uint32_t ops[2];
-            
-            if (0/*last_b*/) {
-                ops[0] = (oplen << 4) | 0; /* M */
-                ops[1] = (oplen << 4) | 9; /* B */
-            }
-            else {
-                ops[0] = (oplen << 4) | 9; /* B */
-                ops[1] = (oplen << 4) | 0; /* M */
-            }
-            
-            n = splice(cigar, n, i, 1, 2, ops);
-            ++i;
-        }
-        else if (opcode == 9)
-            last_b = 1;
-        else
-            last_b = 0;
-    }
-    return n;
-}
-
-static unsigned fix_IN(uint32_t cigar[], unsigned n)
-{
-    unsigned i;
-    
-    for (i = 1; i < n; ++i) {
-        unsigned const opL = cigar[i-1] & 0xF;
-        unsigned const opI = cigar[ i ] & 0xF;
-        
-        if (opL == 1 && opI == 3) {
-            unsigned const oplen = cigar[i-1] >> 4;
-            uint32_t ops[2];
-            
-            ops[0] = (oplen << 4) | 9; /* B */
-            ops[1] = (oplen << 4) | 0; /* M */
-            
-            n = splice(cigar, n, i-1, 1, 2, ops);
-            ++i;
-        }
-        else if (opL == 3 && opI == 1) {
-            unsigned const oplen = cigar[i] >> 4;
-            uint32_t ops[2];
-            
-            ops[0] = (oplen << 4) | 9; /* M */
-            ops[1] = (oplen << 4) | 0; /* B */
-            
-            n = splice(cigar, n, i, 1, 2, ops);
-            ++i;
-        }
-    }
-    return n;
-}
-
-static unsigned canonicalize(uint32_t cigar[], unsigned n)
-{
-    unsigned i;
-    
-    for (i = n; i > 0; ) {
-        --i;
-        if (cigar[i] >> 4 == 0 || (cigar[i] & 0xF) == 6)
-            n = splice(cigar, n, i, 1, 0, NULL);
-    }
-    for (i = 1; i < n; ) {
-        unsigned const opL = cigar[i-1] & 0xF;
-        unsigned const opI = cigar[ i ] & 0xF;
-        
-        if (opI == opL) {
-            unsigned const oplen = (cigar[i] >> 4) + (cigar[i-1] >> 4);
-            uint32_t const op = (oplen << 4) | opI;
-
-            n = splice(cigar, n, i-1, 2, 1, &op);
-        }
-        else
-            ++i;
-    }
-#if 0
-    if ((cigar[0] & 0xF) == 1)
-        cigar[0] = (cigar[0] & ~(uint32_t)0xF) | 4; /* I -> S */
-    if ((cigar[n - 1] & 0xF) == 1)
-        cigar[n - 1] = (cigar[n - 1] & ~(uint32_t)0xF) | 4; /* I -> S */
-#endif
-    return n;
-}
-
-static void reverse(uint32_t cigar[], unsigned n)
-{
-    unsigned i;
-    unsigned j;
-    
-    for (j = n - 1, i = 0; i < j; ++i, --j) {
-        uint32_t const tmp = cigar[i];
-        cigar[i] = cigar[j];
-        cigar[j] = tmp;
-    }
-}
-
-static unsigned GetCGCigar(BAMAlignment const *self, unsigned const N, uint32_t cigar[/* N */])
-{
-    unsigned i;
-    unsigned G;
-    unsigned S;
-    unsigned n = getCigarCount(self);
-    unsigned cg_segs[2*CG_NUM_SEGS-1]; /** 4 segments + 3 gaps **/
-    
-    if (!BAMAlignmentParseCGTag(self, 2*CG_NUM_SEGS-1, cg_segs))
-        return RC(rcAlign, rcRow, rcReading, rcData, rcInvalid);
-    
-    if (N < n + 5)
-        return RC(rcAlign, rcRow, rcReading, rcBuffer, rcInsufficient);
-    
-    memcpy(cigar, getCigarBase(self), n * 4);
-    n = canonicalize(cigar, n); /* just in case */
-    for (i = 0, S = 0; i < CG_NUM_SEGS - 1; ++i) {
-        S += cg_segs[2*i];
-        G  = cg_segs[2*i+1];
-        if (G > 0) {
-            n = insert_B(S, G, n, cigar);
-            S += G;
-        }
-    }
-    return n;
-}
-
-LIB_EXPORT
-rc_t CC BAMAlignmentGetCGCigar(BAMAlignment const *self,
-                               uint32_t *cigar,
-                               uint32_t cig_max,
-                               uint32_t *cig_act)
-{
-    struct offset_size_s const *const GCi = get_CG_GC_info(self);
-    
-    *cig_act = 0;
-    
-    if (GCi) {
-        *cig_act = GetCGCigar(self, cig_max, cigar);
-        return 0;
-    }
-    return RC(rcAlign, rcRow, rcReading, rcData, rcNotFound);
-}
-
-/* MARK: end CG stuff */
-
-LIB_EXPORT rc_t BAMAlignmentGetTI(BAMAlignment const *self, uint64_t *ti)
-{
-    char const *const TI = get_XT(self);
-    long long unsigned temp;
-    
-    if (TI && sscanf(TI, "ti|%llu", &temp) == 1) {
-        *ti = (uint64_t)temp;
-        return 0;
-    }
-    return RC(rcAlign, rcRow, rcReading, rcData, rcNotFound);
-}
-
-/* MARK: BAMIndex stuff */
-
-static uint64_t get_pos(uint8_t const buf[])
-{
-    return LE2HUI64(buf);
-}
-
-#define MAX_BIN 37449
-static uint16_t bin2ival(uint16_t bin)
-{
-    if (bin < 1)
-        return 0; /* (bin - 0) << 15; */
-    
-    if (bin < 9)
-        return (bin - 1) << 12;
-    
-    if (bin < 73)
-        return (bin - 9) << 9;
-    
-    if (bin < 585)
-        return (bin - 73) << 6;
-    
-    if (bin < 4681)
-        return (bin - 585) << 3;
-    
-    if (bin < 37449)
-        return (bin - 4681) << 0;
-    
-    return 0;
-}
-
-static uint16_t bin_ival_count(uint16_t bin)
-{
-    if (bin < 1)
-        return 1 << 15;
-    
-    if (bin < 9)
-        return 1 << 12;
-    
-    if (bin < 73)
-        return 1 << 9;
-    
-    if (bin < 585)
-        return 1 << 6;
-    
-    if (bin < 4681)
-        return 1 << 3;
-    
-    if (bin < 37449)
-        return 1;
-    
-    return 0;
-}
-
-enum BAMIndexStructureTypes {
-    bai_StartStopPairs,
-    bai_16kIntervals
-};
-
-typedef rc_t (*WalkIndexStructureCallBack)(const uint8_t data[], size_t dlen,
-                                           unsigned refNo,
-                                           unsigned refs,
-                                           enum BAMIndexStructureTypes type,
-                                           unsigned binNo,
-                                           unsigned bins,
-                                           unsigned elements,
-                                           void *ctx);
-
-static
-rc_t WalkIndexStructure(uint8_t const buf[], size_t const blen,
-                        WalkIndexStructureCallBack func,
-                        void *ctx
-                        )
-{
-    unsigned cp = 0;
-    int32_t nrefs;
-    unsigned i;
-    rc_t rc;
-    
-    DBGMSG(DBG_ALIGN, DBG_FLAG(DBG_ALIGN_BAM), ("Index data length: %u", blen));
-
-    if (cp + 4 > blen)
-        return RC(rcAlign, rcIndex, rcReading, rcData, rcInsufficient);
-    
-    DBGMSG(DBG_ALIGN, DBG_FLAG(DBG_ALIGN_BAM), ("Index signature: '%c%c%c%u'", buf[cp+0], buf[cp+1], buf[cp+2], buf[cp+3]));
-    if (memcmp(buf + cp, "BAI\1", 4) != 0)
-        return RC(rcAlign, rcIndex, rcReading, rcFormat, rcUnknown);
-    
-    cp += 4;
-    if (cp + 4 > blen)
-        return RC(rcAlign, rcIndex, rcReading, rcData, rcInsufficient);
-
-    nrefs = LE2HI32(buf + cp); cp += 4;
-    DBGMSG(DBG_ALIGN, DBG_FLAG(DBG_ALIGN_BAM), ("Index reference count: %i", nrefs));
-    
-    if (nrefs == 0)
-        return RC(rcAlign, rcIndex, rcReading, rcData, rcEmpty);
-    
-    for (i = 0; i < nrefs; ++i) {
-        int32_t bins;
-        int32_t chunks;
-        int32_t intervals;
-        unsigned di;
-        
-        DBGMSG(DBG_ALIGN, DBG_FLAG(DBG_ALIGN_BAM), ("Index reference %u: starts at %u", i, cp));
-        if (cp + 4 > blen)
-            return RC(rcAlign, rcIndex, rcReading, rcData, rcInsufficient);
-        
-        bins = LE2HI32(buf + cp); cp += 4;
-        DBGMSG(DBG_ALIGN, DBG_FLAG(DBG_ALIGN_BAM), ("Index reference %u: %i bins", i, nrefs));
-
-        for (di = 0; di < bins; ++di) {
-            uint32_t binNo;
-            
-            if (cp + 8 > blen)
-                return RC(rcAlign, rcIndex, rcReading, rcData, rcInsufficient);
-
-            binNo = LE2HUI32(buf + cp); cp += 4;
-            chunks = LE2HI32(buf + cp); cp += 4;
-            DBGMSG(DBG_ALIGN, DBG_FLAG(DBG_ALIGN_BAM), ("Index reference %u, bin %u: %i chunks", i, binNo, chunks));
-            
-            if (cp + 16 * chunks > blen)
-                return RC(rcAlign, rcIndex, rcReading, rcData, rcInsufficient);
-            rc = func(&buf[cp], 16 * chunks, i, nrefs, bai_StartStopPairs, binNo, bins, chunks, ctx);
-            if (rc)
-                return rc;
-            cp += 16 * chunks;
-        }
-        if (cp + 4 > blen)
-            return RC(rcAlign, rcIndex, rcReading, rcData, rcInsufficient);
-
-        intervals = LE2HI32(buf + cp); cp += 4;
-        DBGMSG(DBG_ALIGN, DBG_FLAG(DBG_ALIGN_BAM), ("Index reference %u: %i intervals", i, intervals));
-
-        if (cp + 8 * intervals > blen)
-            return RC(rcAlign, rcIndex, rcReading, rcData, rcInsufficient);
-        rc = func(&buf[cp], 8 * intervals, i, nrefs, bai_16kIntervals, ~(unsigned)0, bins, intervals, ctx);
-        if (rc)
-            return rc;
-        cp += 8 * intervals;
-    }
-    if (cp > blen)
-        return RC(rcAlign, rcIndex, rcReading, rcData, rcInsufficient);
-    return 0;
-}
-
-struct LoadIndex1_s {
-    const BAMFile *self;
-    int refNo;
-    unsigned refs;
-    unsigned intervals;
-    unsigned total_interval_count;
-};
-
-static
-rc_t LoadIndex1(const uint8_t data[], size_t dlen, unsigned refNo,
-                unsigned refs, enum BAMIndexStructureTypes type,
-                unsigned binNo, unsigned bins,
-                unsigned elements, void *Ctx)
-{
-    struct LoadIndex1_s *ctx = (struct LoadIndex1_s *)Ctx;
-    
-    ctx->refs = refs;
-    if (refNo != ctx->refNo) {
-        ctx->total_interval_count += ctx->intervals;
-        ctx->intervals = 0;
-        ctx->refNo = refNo;
-    }
-    if (elements != 0) {
-        if (refNo > ctx->self->refSeqs)
-            return RC(rcAlign, rcIndex, rcReading, rcData, rcInvalid);
-        ctx->intervals = (ctx->self->refSeq[refNo].length + 16383) >> 14;
-        if (type == bai_16kIntervals && elements > ctx->intervals)
-            return RC(rcAlign, rcIndex, rcReading, rcData, rcExcessive);
-    }
-    return 0;
-}
-
-struct LoadIndex2_s {
-    const BAMFile *self;
-    BAMFilePosition **refSeq;
-    BAMFilePosition *cur;
-#if _DEBUGGING
-    BAMFilePosition *end;
-#endif
-    const uint8_t *base;
-    unsigned bins[MAX_BIN + 1];
-    bool hasData;
-};
-
-static
-rc_t LoadIndex2a(const uint8_t data[], size_t dlen, unsigned refNo,
-                 unsigned refs, enum BAMIndexStructureTypes type,
-                 unsigned binNo, unsigned bins,
-                 unsigned elements, struct LoadIndex2_s *ctx)
-{
-    const unsigned max_ival = (ctx->self->refSeq[refNo].length + 16383) >> 14;
-    unsigned i;
-    unsigned cp;
-    unsigned k;
-    uint32_t chunk_count;
-    uint64_t minOffset[1u << 15];
-
-    assert(ctx->refSeq[refNo] == NULL);
-    ctx->refSeq[refNo] = ctx->cur;
-    ctx->cur += max_ival;
-    
-#if _DEBUGGING
-    assert(refNo < ctx->self->refSeqs);
-    assert(ctx->cur <= ctx->end);
-    assert(elements <= max_ival);
-#endif
-    /* get the positions of the first records in the 16kbp intervals */
-    for (cp = i = 0; i != elements; ++i, cp += 8)
-        ctx->refSeq[refNo][i] = get_pos(&data[cp]);
-    /* get the positions of the first records in the 16kbp bins */
-    for (i = MAX_BIN; i != 0; ) {
-        const unsigned ival = bin2ival(--i);
-        const unsigned n_ival = bin_ival_count(i);
-        uint64_t found;
-        
-        cp = ctx->bins[i];
-        if (cp == 0)
-            continue;
-        if (n_ival > 1)
-            break;
-        
-        assert(i == LE2HI32(ctx->base + cp));
-        cp += 4;
-        chunk_count = LE2HI32(ctx->base + cp); cp += 4;
-        found = ctx->refSeq[refNo][ival];
-        for (k = 0; k < chunk_count; ++k) {
-            const uint64_t start = get_pos(ctx->base + cp);
-            
-            cp += 16;
-            if (found == 0 || start < found)
-                found = start;
-        }
-        ctx->refSeq[refNo][ival] = found;
-    }
-    /* The interval list now contains the offsets to the first alignment
-     * that starts at or after the interval's starting position.
-     * An interval's starting position is 16kpb * interval number.
-     *
-     * We will now use the information from the bigger bins to find the
-     * offsets of the first chunk of alignments that ends after an
-     * interval's first alignment.
-     */
-    memset(minOffset, 0, sizeof(minOffset));
-    for (i = 0; i != MAX_BIN; ++i) {
-        const unsigned ival = bin2ival(i);
-        unsigned n_ival = bin_ival_count(i);
-        
-        cp = ctx->bins[i];
-        if (cp == 0)
-            continue;
-        if (n_ival <= 1)
-            break;
-        
-        if (ival + n_ival > max_ival)
-            n_ival = max_ival - ival;
-        
-        chunk_count = LE2HI32(ctx->base + cp + 4); cp += 8;
-        for (k = 0; k < chunk_count; ++k) {
-            const uint64_t start = get_pos(ctx->base + cp);
-            const uint64_t end   = get_pos(ctx->base + cp + 8);
-            unsigned l;
-            
-            cp += 16;
-            for (l = 0; l != n_ival; ++l) {
-                if (start < ctx->refSeq[refNo][ival + l] &&
-                    ctx->refSeq[refNo][ival + l] <= end &&
-                    (start < minOffset[ival + l] ||
-                     minOffset[ival + l] == 0
-                     )
-                    )
-                {
-                    minOffset[ival + l] = start;
-                }
-            }
-        }
-    }
-    /* update the intervals to the new earlier offsets if any */
-    for (i = 0; i != max_ival; ++i) {
-        if (minOffset[i] != 0)
-            ctx->refSeq[refNo][i] = minOffset[i];
-    }
-    memset(ctx->bins, 0, sizeof(ctx->bins));
-    ctx->hasData = false;
-    return 0;
-}
-
-static
-rc_t LoadIndex2(const uint8_t data[], size_t dlen, unsigned refNo,
-                unsigned refs, enum BAMIndexStructureTypes type,
-                unsigned binNo, unsigned bins,
-                unsigned elements, void *Ctx)
-{
-    struct LoadIndex2_s *ctx = (struct LoadIndex2_s *)Ctx;
-    
-    if (type == bai_StartStopPairs) {
-        if (binNo < MAX_BIN && elements != 0) {
-            ctx->bins[binNo] = &data[-8] - ctx->base;
-            ctx->hasData = true;
-        }
-    }
-    else if (elements != 0 || ctx->hasData)
-        return LoadIndex2a(data, dlen, refNo, refs, type, binNo, bins,
-                           elements, (struct LoadIndex2_s *)Ctx);
-    return 0;
-}    
-
-static
-rc_t LoadIndex(BAMFile *self, const uint8_t buf[], size_t blen)
-{
-    BAMIndex *idx;
-    rc_t rc;
-    struct LoadIndex1_s loadIndex1ctx;
-    unsigned const posArray = ((uintptr_t)&((const BAMFilePosition **)(NULL))[self->refSeqs]) / sizeof(BAMFilePosition *);
-
-    memset(&loadIndex1ctx, 0, sizeof(loadIndex1ctx));
-    loadIndex1ctx.refNo = -1;
-    loadIndex1ctx.self = self;
-    
-    rc = WalkIndexStructure(buf, blen, LoadIndex1, &loadIndex1ctx);
-    if (rc == 0) {
-        loadIndex1ctx.total_interval_count += loadIndex1ctx.intervals;
-        idx = calloc(1, posArray * sizeof(BAMFilePosition *) +
-                     loadIndex1ctx.total_interval_count * sizeof(BAMFilePosition));
-        if (idx == NULL)
-            rc = RC(rcAlign, rcIndex, rcReading, rcMemory, rcExhausted);
-        else {
-            struct LoadIndex2_s *loadIndex2ctx;
-            
-            if (self->ndx)
-                BAMIndexWhack(self->ndx);
-            self->ndx = idx;
-            
-            loadIndex2ctx = malloc(sizeof(*loadIndex2ctx));
-            if (loadIndex2ctx == NULL) {
-                rc = RC(rcAlign, rcIndex, rcReading, rcMemory, rcExhausted);
-                free(idx);
-                self->ndx = NULL;
-            }
-            else {
-                memset(loadIndex2ctx->bins, 0, sizeof(loadIndex2ctx->bins));
-                loadIndex2ctx->self = self;
-                loadIndex2ctx->refSeq = &idx->refSeq[0];
-                loadIndex2ctx->base = buf;
-                loadIndex2ctx->hasData = false;
-                loadIndex2ctx->cur = (BAMFilePosition *)&idx->refSeq[posArray];
-#if _DEBUGGING
-                loadIndex2ctx->end = loadIndex2ctx->cur + loadIndex1ctx.total_interval_count;
-#endif
-                
-                WalkIndexStructure(buf, blen, LoadIndex2, loadIndex2ctx);
-                free(loadIndex2ctx);
-            }
-        }
-    }
-    return rc;
-}
-
-static
-rc_t BAMFileOpenIndexInternal(const BAMFile *self, const char *path)
-{
-    const KFile *kf;
-    rc_t rc;
-    size_t fsize;
-    uint8_t *buf;
-    KDirectory *dir;
-    
-    rc = KDirectoryNativeDir(&dir);
-    if (rc) return rc;
-    rc = KDirectoryOpenFileRead(dir, &kf, path);
-    KDirectoryRelease(dir);
-    if (rc) return rc;
-    {
-        uint64_t u64;
-
-        rc = KFileSize(kf, &u64);
-        if (sizeof(size_t) < sizeof(u64) && (size_t)u64 != u64) {
-            KFileRelease(kf);
-            return RC(rcAlign, rcIndex, rcReading, rcData, rcExcessive);
-        }
-        fsize = u64;
-    }
-    if (rc == 0) {
-        buf = malloc(fsize);
-        if (buf != NULL) {
-            size_t nread;
-            
-            rc = KFileRead(kf, 0, buf, fsize, &nread);
-            KFileRelease(kf);
-            if (rc == 0) {
-                if (nread == fsize) {
-                    rc = LoadIndex((BAMFile *)self, buf, nread);
-                    free(buf);
-                    return rc;
-                }
-                rc = RC(rcAlign, rcIndex, rcReading, rcData, rcInvalid);
-            }
-            free(buf);
-        }
-        else
-            rc = RC(rcAlign, rcIndex, rcReading, rcMemory, rcExhausted);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC BAMFileOpenIndex(const BAMFile *self, const char *path)
-{
-    return BAMFileOpenIndexInternal(self, path);
-}
-
-LIB_EXPORT rc_t CC BAMFileOpenIndexWithVPath(const BAMFile *self, const VPath *kpath)
-{
-    char path[4096];
-    size_t nread;
-    rc_t rc = VPathReadPath(kpath, path, sizeof(path), &nread);
-
-    if (rc == 0) {
-        path[nread] = '\0';
-        rc = BAMFileOpenIndexInternal(self, path);
-    }
-    return rc;
-}
-
-LIB_EXPORT bool CC BAMFileIsIndexed(const BAMFile *self)
-{
-	if (self && self->ndx)
-		return true;
-	return false;
-}
-
-LIB_EXPORT bool CC BAMFileIndexHasRefSeqId(const BAMFile *self, uint32_t refSeqId)
-{
-	if (self && self->ndx && self->ndx->refSeq[refSeqId])
-		return true;
-	return false;
-}
-
-static rc_t BAMFileGetAlignPos(const BAMFile *self, int64_t *beg, int64_t *end, int32_t *refSeq)
-{
-    const BAMAlignment *check;
-    rc_t rc;
-    
-    rc = BAMFileRead(self, &check);
-    if (rc)
-        return rc;
-    BAMAlignmentGetPosition(check, beg);
-    BAMAlignmentGetRefSeqId(check, refSeq);
-    *end = *beg + ReferenceLengthFromCIGAR(check);
-    BAMAlignmentRelease(check);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC BAMFileSeek(const BAMFile *self, uint32_t refSeqId, uint64_t alignStart, uint64_t alignEnd)
-{
-    BAMFilePosition rpos = 0;
-    rc_t rc;
-    int64_t prev_alignPos;
-    int64_t alignPos;
-    int64_t alignEndPos;
-    int32_t refSeq;
-    
-    if (self->ndx == NULL)
-        return RC(rcAlign, rcFile, rcPositioning, rcIndex, rcNotFound);
-    if (refSeqId >= self->refSeqs)
-        return RC(rcAlign, rcFile, rcPositioning, rcData, rcNotFound);
-    if (self->ndx->refSeq[refSeqId] == NULL)
-        return RC(rcAlign, rcFile, rcPositioning, rcData, rcNotFound);
-    if (alignStart >= self->refSeq[refSeqId].length)
-        return RC(rcAlign, rcFile, rcPositioning, rcData, rcNotFound);
-    if (alignEnd > self->refSeq[refSeqId].length)
-        alignEnd = self->refSeq[refSeqId].length;
-    
-    {{
-        unsigned adjust = 0;
-        uint32_t ival_start = (uint32_t)(alignStart >> 14);
-        uint32_t ival_end = (uint32_t)((alignEnd + 16383) >> 14);
-        
-        /* find the first interval >= alignStart that has an alignment */
-        while (ival_start != ival_end && (rpos = self->ndx->refSeq[refSeqId][ival_start]) == 0)
-            ++ival_start;
-        
-        if (rpos == 0)
-            return RC(rcAlign, rcFile, rcPositioning, rcData, rcNotFound);
-        do {
-            rc = BAMFileSetPosition(self, &rpos);
-            if (rc == 0)
-                rc = BAMFileGetAlignPos(self, &alignPos, &alignEndPos, &refSeq);
-            if (rc)
-                return RC(rcAlign, rcFile, rcPositioning, rcIndex, rcInvalid);
-            if (refSeq != refSeqId)
-                return RC(rcAlign, rcFile, rcPositioning, rcData, rcNotFound);
-            if (alignPos <= alignEnd)
-                break; /* we found the interval we were looking for */
-            
-            /* we over-shot */
-            if (++adjust >= ival_start)
-                return RC(rcAlign, rcFile, rcPositioning, rcData, rcNotFound);
-            if ((rpos = self->ndx->refSeq[refSeqId][ival_start - adjust]) == 0)
-                return RC(rcAlign, rcFile, rcPositioning, rcData, rcNotFound);
-        } while (1);
-    }}
-    prev_alignPos = alignPos;
-    
-    do {
-        if (alignPos > alignEnd)
-            return RC(rcAlign, rcFile, rcPositioning, rcData, rcNotFound);
-        
-        /* if the alignment overlaps the target range then we are done */
-        if (alignPos >= alignStart || alignEndPos >= alignStart)
-            return BAMFileSetPosition(self, &rpos);
-        
-        /* start linear scan */
-        rc = BAMFileGetPosition(self, &rpos);
-        if (rc)
-            return rc;
-        rc = BAMFileGetAlignPos(self, &alignPos, &alignEndPos, &refSeq);
-        if (rc) return rc;
-        if (refSeq != refSeqId)
-            return RC(rcAlign, rcFile, rcPositioning, rcData, rcNotFound);
-        
-        /*  indexed BAM must be sorted by position
-         *  so verify that we are not out of order
-         *  whether this means that the index is bad
-         *  or the file is bad, likely both
-         *  fix the file and regenerate the index
-         */
-        if (prev_alignPos > alignPos)
-            return RC(rcAlign, rcFile, rcPositioning, rcIndex, rcInvalid);
-        prev_alignPos = alignPos;
-    } while (1);
-}
-
-static rc_t BAMIndexWhack(const BAMIndex *cself) {
-    free((void *)cself);
-    return 0;
-}
-
-/* MARK: BAM Validation Stuff */
-
-static rc_t OpenVPathRead(const KFile **fp, struct VPath const *path)
-{
-    char buffer[4096];
-    size_t blen;
-    rc_t rc = VPathReadPath(path, buffer, sizeof(buffer), &blen);
-    
-    if (rc == 0) {
-        KDirectory *dir;
-        
-        rc = KDirectoryNativeDir(&dir);
-        if (rc == 0) {
-            rc = KDirectoryOpenFileRead(dir, fp, "%.*s", (int)blen, buffer);
-            KDirectoryRelease(dir);
-        }
-    }
-    return rc;
-}
-
-static rc_t ReadVPath(void **data, size_t *dsize, struct VPath const *path)
-{
-    const KFile *fp;
-    rc_t rc = OpenVPathRead(&fp, path);
-    
-    if (rc == 0) {
-        uint8_t *buff;
-        uint64_t fsz;
-        size_t bsz = 0;
-        
-        rc = KFileSize(fp, &fsz);
-        if (rc == 0) {
-            if ((size_t)fsz != fsz)
-                return RC(rcAlign, rcFile, rcReading, rcFile, rcTooBig);
-            buff = malloc(fsz);
-            if (buff == NULL)
-                return RC(rcAlign, rcFile, rcReading, rcMemory, rcExhausted);
-            do {
-                size_t nread;
-                
-                rc = KFileRead(fp, 0, buff + bsz, fsz - bsz, &nread);
-                if (rc)
-                    break;
-                bsz += nread;
-            } while (bsz < (size_t)fsz);
-            if (rc == 0) {
-                *data = buff;
-                *dsize = bsz;
-                return 0;
-            }
-            free(buff);
-        }
-    }
-    return rc;
-}
-
-static rc_t VPath2BGZF(BGZFile *bgzf, struct VPath const *path)
-{
-    const KFile *fp;
-    BGZFile_vt dummy;
-    rc_t rc = OpenVPathRead(&fp, path);
-    
-    if (rc == 0) {
-        rc = BGZFileInit(bgzf, fp, &dummy);
-        KFileRelease(fp);
-    }
-    return rc;
-}
-
-struct index_data {
-    uint64_t position;
-    unsigned refNo;
-    unsigned binNo;
-    bool found;
-};
-
-struct buffer_data {
-    uint64_t position;
-    size_t size;
-};
-
-typedef struct BAMValidate_ctx_s BAMValidate_ctx_t;
-struct BAMValidate_ctx_s {
-    BAMValidateCallback callback;
-    void *ctx;
-    BAMValidateStats *stats;
-    const uint8_t *bai;
-    int32_t *refLen;
-    struct index_data *position;
-    uint8_t *buf;
-    uint8_t *nxt;
-    size_t bsize;
-    size_t alloced;
-    size_t dnext;
-    uint32_t options;
-    uint32_t lastRefId;
-    uint32_t lastRefPos;
-    unsigned npositions;
-    unsigned mpositions;
-    unsigned nrefs;
-    bool cancelled;
-};
-
-static
-rc_t IndexValidateStructure(const uint8_t data[], size_t dlen,
-                            unsigned refNo,
-                            unsigned refs,
-                            enum BAMIndexStructureTypes type,
-                            unsigned binNo,
-                            unsigned bins,
-                            unsigned elements,
-                            void *Ctx)
-{
-    BAMValidate_ctx_t *ctx = Ctx;
-    rc_t rc = 0;
-    
-    ctx->stats->baiFilePosition = data - ctx->bai;
-    rc = ctx->callback(ctx->ctx, 0, ctx->stats);
-    if (rc)
-        ctx->cancelled = true;
-    return rc;
-}
-
-static int CC comp_index_data(const void *A, const void *B, void *ignored)
-{
-    const struct index_data *a = A;
-    const struct index_data *b = B;
-    
-    if (a->position < b->position)
-        return -1;
-    else if (a->position > b->position)
-        return 1;
-    else
-        return 0;
-}
-
-static
-rc_t BAMValidateLoadIndex(const uint8_t data[], size_t dlen,
-                          unsigned refNo,
-                          unsigned refs,
-                          enum BAMIndexStructureTypes type,
-                          unsigned binNo,
-                          unsigned bins,
-                          unsigned elements,
-                          void *Ctx)
-{
-    BAMValidate_ctx_t *ctx = Ctx;
-    unsigned const n = type == bai_16kIntervals ? elements : elements * 2;
-    unsigned i;
-    unsigned j;
-    
-    if (type == bai_StartStopPairs && binNo >= MAX_BIN)
-        return 0;
-    
-    if (ctx->npositions + elements > ctx->mpositions) {
-        void *temp;
-        
-        do { ctx->mpositions <<= 1; } while (ctx->npositions + elements > ctx->mpositions);
-        temp = realloc(ctx->position, ctx->mpositions * sizeof(ctx->position[0]));
-        if (temp == NULL)
-            return RC(rcAlign, rcIndex, rcReading, rcMemory, rcExhausted);
-        ctx->position = temp;
-    }
-    for (j = i = 0; i != n; ++i) {
-        uint64_t const pos = get_pos(&data[i * 8]);
-        
-        if (type == bai_StartStopPairs && (i & 1) != 0)
-            continue;
-        
-        if (pos) {
-            ctx->position[ctx->npositions + j].refNo = refNo;
-            ctx->position[ctx->npositions + j].binNo = binNo;
-            ctx->position[ctx->npositions + j].position = pos;
-            ++j;
-        }
-    }
-    ctx->npositions += j;
-    return 0;
-}
-
-static
-rc_t BAMValidateHeader(const uint8_t data[],
-                       unsigned dsize,
-                       unsigned *header_len,
-                       unsigned *refs_start,
-                       unsigned *nrefs,
-                       unsigned *data_start
-                       )
-{
-    int32_t hlen;
-    int32_t refs;
-    unsigned i;
-    unsigned cp;
-    
-    if (dsize < 8)
-        return RC(rcAlign, rcFile, rcValidating, rcData, rcIncomplete);
-    
-    if (memcmp(data, "BAM\1", 4) != 0)
-        return RC(rcAlign, rcFile, rcValidating, rcFormat, rcUnrecognized);
-    
-    hlen = LE2HI32(&data[4]);
-    if (hlen < 0)
-        return RC(rcAlign, rcFile, rcValidating, rcData, rcInvalid);
-    
-    if (dsize < hlen + 12)
-        return RC(rcAlign, rcFile, rcValidating, rcData, rcIncomplete);
-    
-    refs = LE2HI32(&data[hlen + 8]);
-    if (refs < 0)
-        return RC(rcAlign, rcFile, rcValidating, rcData, rcInvalid);
-    
-    for (cp = hlen + 12, i = 0; i != refs; ++i) {
-        int32_t nlen;
-        
-        if (dsize < cp + 4)
-            return RC(rcAlign, rcFile, rcValidating, rcData, rcIncomplete);
-        
-        nlen = LE2HI32(&data[cp]);
-        if (nlen < 0)
-            return RC(rcAlign, rcFile, rcValidating, rcData, rcInvalid);
-        
-        if (dsize < cp + nlen + 4)
-            return RC(rcAlign, rcFile, rcValidating, rcData, rcIncomplete);
-        
-        cp += nlen + 4;
-    }
-    
-    *nrefs = refs;
-    *refs_start = 12 + (*header_len = hlen);
-    *data_start = cp;
-    return 0;
-}
-
-static rc_t BAMValidateIndex(struct VPath const *bampath,
-                             struct VPath const *baipath,
-                             BAMValidateOption options,
-                             BAMValidateCallback callback,
-                             void *callbackContext
-                             )
-{
-    rc_t rc = 0;
-    BGZFile bam;
-    uint8_t *bai = NULL;
-    size_t bai_size;
-    BAMValidateStats stats;
-    BAMValidate_ctx_t ctx;
-    uint8_t data[2 * ZLIB_BLOCK_SIZE];
-    uint32_t dsize = 0;
-    uint64_t pos = 0;
-    uint32_t temp;
-    int32_t ref = -1;
-    int32_t rpos = -1;
-    
-    if ((options & bvo_IndexOptions) == 0)
-        return callback(callbackContext, 0, &stats);
-
-    rc = ReadVPath((void **)&bai, &bai_size, baipath);
-    if (rc)
-        return rc;
-    
-    memset(&stats, 0, sizeof(stats));
-    memset(&ctx, 0, sizeof(ctx));
-    
-    ctx.bai = bai;
-    ctx.stats = &stats;
-    ctx.options = options;
-    ctx.ctx = callbackContext;
-    ctx.callback = callback;
-    
-    if ((options & bvo_IndexOptions) == bvo_IndexStructure)
-        return WalkIndexStructure(bai, bai_size, IndexValidateStructure, &ctx);
-
-    rc = VPath2BGZF(&bam, bampath);
-    if (rc == 0) {
-        ctx.mpositions = 1024 * 32;
-        ctx.position = malloc(ctx.mpositions * sizeof(ctx.position[0]));
-        if (ctx.position == NULL)
-            return RC(rcAlign, rcIndex, rcReading, rcMemory, rcExhausted);
-        
-        rc = WalkIndexStructure(bai, bai_size, BAMValidateLoadIndex, &ctx);
-        free(bai);
-        if (rc) {
-            stats.indexStructureIsBad = true;
-            rc = callback(callbackContext, rc, &stats);
-        }
-        else {
-            unsigned i = 0;
-            
-            stats.indexStructureIsGood = true;
-            stats.baiFileSize = ctx.npositions;
-            
-            ksort(ctx.position, ctx.npositions, sizeof(ctx.position[0]), comp_index_data, 0);
-            
-            stats.bamFileSize = bam.fsize;
-            
-            while (i < ctx.npositions) {
-                uint64_t const ifpos = ctx.position[i].position >> 16;
-                uint16_t const bpos = (uint16_t)ctx.position[i].position;
-                
-                stats.baiFilePosition = i;
-                if (i == 0 || ifpos != pos) {
-                    stats.bamFilePosition = pos = ifpos;
-                    rc = BGZFileSetPos(&bam, pos);
-                    if (rc == 0)
-                        rc = BGZFileRead(&bam, data, &dsize);
-                    if (rc) {
-                        ++stats.indexFileOffset.error;
-                        do {
-                            ++i;
-                            if (i == ctx.npositions)
-                                break;
-                            if (ctx.position[i].position >> 16 != pos)
-                                break;
-                            ++stats.indexFileOffset.error;
-                        } while (1);
-                    }
-                    else
-                        ++stats.indexFileOffset.good;
-
-                    rc = callback(callbackContext, rc, &stats);
-                    if (rc)
-                        break;
-                }
-                else
-                    ++stats.indexFileOffset.good;
-                if ((options & bvo_IndexOptions) > bvo_IndexOffsets1) {
-                    int32_t rsize = 0;
-                    BAMAlignment algn;
-                    
-                    if (bpos >= dsize)
-                        goto BAD_BLOCK_OFFSET;
-                    if (dsize - bpos < 4) {
-                    READ_MORE:
-                        if (dsize > ZLIB_BLOCK_SIZE)
-                            goto BAD_BLOCK_OFFSET;
-
-                        rc = BGZFileRead(&bam, data + dsize, &temp);
-                        if (rc) {
-                            ++stats.blockCompression.error;
-                            goto BAD_BLOCK_OFFSET;
-                        }
-                        dsize += temp;
-                        if (dsize - bpos < 4 || dsize - bpos < rsize)
-                            goto BAD_BLOCK_OFFSET;
-                    }
-                    rsize = LE2HI32(data + bpos);
-                    if (rsize <= 0)
-                        goto BAD_BLOCK_OFFSET;
-                    if (rsize > 0xFFFF) {
-                        ++stats.indexBlockOffset.warning;
-                        ++i;
-                        continue;
-                    }
-                    if (dsize - bpos < rsize)
-                        goto READ_MORE;
-/*                    rc = BAMAlignmentParse(&algn, data + bpos + 4, rsize); */
-                    if (rc)
-                        goto BAD_BLOCK_OFFSET;
-                    ++stats.indexBlockOffset.good;
-                    if ((options & bvo_IndexOptions) > bvo_IndexOffsets2) {
-                        int32_t const refSeqId = getRefSeqId(&algn);
-                        uint16_t const binNo = getBin(&algn);
-                        int32_t const position = getPosition(&algn);
-                        
-                        if (ctx.position[i].refNo == refSeqId &&
-                            (ctx.position[i].binNo == binNo ||
-                             ctx.position[i].binNo == ~((unsigned)0)
-                        ))
-                            ++stats.indexBin.good;
-                        else if (ctx.position[i].refNo == refSeqId)
-                            ++stats.indexBin.warning;
-                        else
-                            ++stats.indexBin.error;
-                        
-                        if (refSeqId < ref || position < rpos)
-                            ++stats.inOrder.error;
-                        
-                        ref = refSeqId;
-                        rpos = position;
-                    }
-                }
-                if (0) {
-                BAD_BLOCK_OFFSET:
-                    ++stats.indexBlockOffset.error;
-                }
-                ++i;
-            }
-        }
-        
-        free(ctx.position);
-        BGZFileWhack(&bam);
-    }
-    stats.bamFilePosition = stats.bamFileSize;
-    return callback(callbackContext, rc, &stats);
-}
-
-static rc_t BAMValidate3(BAMValidate_ctx_t *ctx,
-                         BAMAlignment const *algn
-                         )
-{
-    rc_t rc = 0;
-    uint16_t const flags = getFlags(algn);
-    int32_t const refSeqId = getRefSeqId(algn);
-    int32_t const refPos = getPosition(algn);
-    unsigned const mapQ = getMapQual(algn);
-    bool const aligned =
-        ((flags & BAMFlags_SelfIsUnmapped) == 0) && 
-        (refSeqId >= 0) && (refSeqId < ctx->nrefs) &&
-        (refPos >= 0) && (refPos < ctx->refLen[refSeqId]) && (mapQ > 0);
-    
-    if (ctx->options & bvo_ExtraFields) {
-    }
-    if (aligned) {
-        if ((ctx->options & bvo_Sorted) != 0) {
-            if (ctx->lastRefId < refSeqId || (ctx->lastRefId == refSeqId && ctx->lastRefPos <= refPos))
-                ++ctx->stats->inOrder.good;
-            else
-                ++ctx->stats->inOrder.error;
-            ctx->lastRefId = refSeqId;
-            ctx->lastRefPos = refPos;
-        }
-        if (ctx->options & bvo_CIGARConsistency) {
-        }
-        if (ctx->options & bvo_BinConsistency) {
-        }
-    }
-    if (ctx->options & bvo_FlagsConsistency) {
-    }
-    if (ctx->options & bvo_QualityValues) {
-    }
-    if (ctx->options & bvo_MissingSequence) {
-    }
-    if (ctx->options & bvo_MissingQuality) {
-    }
-    if (ctx->options & bvo_FlagsStats) {
-    }
-    return rc;
-}
-
-static rc_t BAMValidate2(void *Ctx, const BGZFile *file,
-                         rc_t rc, uint64_t fpos,
-                         const zlib_block_t data, unsigned dsize)
-{
-    BAMValidate_ctx_t *ctx = Ctx;
-    rc_t rc2;
-    bool fatal = false;
-    
-    ctx->stats->bamFilePosition = fpos;
-    if (rc) {
-        if (ctx->options == bvo_BlockHeaders)
-            ++ctx->stats->blockHeaders.error;
-        else
-            ++ctx->stats->blockCompression.error;
-    }
-    else if (ctx->options == bvo_BlockHeaders) {
-        ++ctx->stats->blockHeaders.good;
-    }
-    else if (ctx->options == bvo_BlockCompression) {
-        ++ctx->stats->blockHeaders.good;
-        ++ctx->stats->blockCompression.good;
-    }
-    else if (dsize) {
-        ctx->bsize += dsize;
-        if (!ctx->stats->bamHeaderIsBad && !ctx->stats->bamHeaderIsGood) {
-            unsigned header_len;
-            unsigned refs_start;
-            unsigned nrefs;
-            unsigned data_start;
-            
-            rc2 = BAMValidateHeader(ctx->buf, ctx->bsize,
-                                       &header_len, &refs_start,
-                                       &nrefs, &data_start);
-            
-            if (rc2 == 0) {
-                ctx->stats->bamHeaderIsGood = true;
-                if (ctx->options & bvo_BinConsistency) {
-                    ctx->refLen = malloc(nrefs * sizeof(ctx->refLen[0]));
-                    if (ctx->refLen == NULL) {
-                        rc = RC(rcAlign, rcFile, rcValidating, rcMemory, rcExhausted);
-                        fatal = true;
-                    }
-                    else {
-                        unsigned cp;
-                        unsigned i;
-                        
-                        ctx->nrefs = nrefs;
-                        for (i = 0, cp = refs_start; cp != data_start; ++i) {
-                            int32_t len;
-                            
-                            memcpy(&len, &ctx->buf[cp], 4);
-                            memcpy(&ctx->refLen[i], &ctx->buf[cp + 4 + len], 4);
-                            cp += len + 8;
-                        }
-                    }
-                }
-                ctx->dnext = data_start;
-            }
-            else if (GetRCState(rc2) != rcIncomplete || GetRCObject(rc2) != rcData) {
-                ctx->stats->bamHeaderIsBad = true;
-                ctx->options = bvo_BlockCompression;
-                rc = rc2;
-            }
-            else
-                ctx->dnext = ctx->bsize;
-        }
-        if (rc == 0) {
-            if (ctx->stats->bamHeaderIsGood) {
-                unsigned cp = ctx->dnext;
-                
-                while (cp + 4 < ctx->bsize) {
-                    int32_t rsize;
-                    
-                    rsize = LE2HI32(&ctx->buf[cp]);
-                    if (rsize < 0) {
-                        ++ctx->stats->blockStructure.error;
-                        ctx->options = bvo_BlockStructure;
-                        
-                        /* throw away the rest of the current buffer */
-                        if (cp >= ctx->bsize - dsize)
-                            cp = ctx->bsize;
-                        else
-                            cp = ctx->bsize - dsize;
-                        
-                        rc = RC(rcAlign, rcFile, rcValidating, rcData, rcInvalid);
-                        break;
-                    }
-                    else if (cp + 4 + rsize < ctx->bsize) {
-                        if (rsize > UINT16_MAX)
-                            ++ctx->stats->blockStructure.warning;
-                        else
-                            ++ctx->stats->blockStructure.good;
-                        if (ctx->options > bvo_BlockStructure) {
-                            BAMAlignment algn;
-                            
-/*                            rc = BAMAlignmentParse(&algn, &ctx->buf[cp + 4], rsize); */
-                            if (rc == 0) {
-                                ++ctx->stats->recordStructure.good;
-                                if (ctx->options > bvo_RecordStructure)
-                                    rc = BAMValidate3(ctx, &algn);
-                            }
-                            else
-                                ++ctx->stats->recordStructure.error;
-                        }
-                        cp += 4 + rsize;
-                    }
-                    else
-                        break;
-                }
-                if (&ctx->buf[cp] >= data) {
-                    if (cp < ctx->bsize) {
-                        ctx->bsize -= cp;
-                        memmove(ctx->buf, &ctx->buf[cp], ctx->bsize);
-                        cp = ctx->bsize;
-                    }
-                    else {
-                        assert(cp == ctx->bsize);
-                        cp = ctx->bsize = 0;
-                    }
-                }
-                ctx->dnext = cp;
-            }
-            if (ctx->alloced < ctx->bsize + ZLIB_BLOCK_SIZE) {
-                void *temp;
-                
-                temp = realloc(ctx->buf, ctx->alloced + ZLIB_BLOCK_SIZE);
-                if (temp == NULL) {
-                    rc = RC(rcAlign, rcFile, rcValidating, rcMemory, rcExhausted);
-                    fatal = true;
-                }
-                else {
-                    ctx->buf = temp;
-                    ctx->alloced += ZLIB_BLOCK_SIZE;
-                }
-            }
-            ctx->nxt = &ctx->buf[ctx->dnext];
-        }
-    }
-    rc2 = ctx->callback(ctx->ctx, rc, ctx->stats);
-    ctx->cancelled |= rc2 != 0;
-    return fatal ? rc : rc2;
-}
-
-static rc_t BAMValidateBAM(struct VPath const *bampath,
-                           BAMValidateOption options,
-                           BAMValidateCallback callback,
-                           void *callbackContext
-                           )
-{
-    rc_t rc;
-    BGZFile bam;
-    BAMValidate_ctx_t ctx;
-    BAMValidateStats stats;
-
-    if (bampath == NULL)
-        return RC(rcAlign, rcFile, rcValidating, rcParam, rcNull);
-    
-    memset(&ctx, 0, sizeof(ctx));
-    memset(&stats, 0, sizeof(stats));
-    
-    ctx.callback = callback;
-    ctx.ctx = callbackContext;
-    ctx.options = options;
-    ctx.stats = &stats;
-    
-    if (options > bvo_BlockCompression) {
-        ctx.alloced = ZLIB_BLOCK_SIZE * 2;
-        ctx.nxt = ctx.buf = malloc(ctx.alloced);
-        
-        if (ctx.buf == NULL)
-            return RC(rcAlign, rcFile, rcValidating, rcMemory, rcExhausted);
-    }
-    
-    if (options > bvo_RecordStructure)
-        options = bvo_RecordStructure | (options & 0xFFF0);
-    
-    rc = VPath2BGZF(&bam, bampath);
-    if (rc == 0) {
-        stats.bamFileSize = bam.fsize;
-        if ((options & 7) > bvo_BlockHeaders)
-            rc = BGZFileWalkBlocks(&bam, true, (zlib_block_t *)&ctx.nxt, BAMValidate2, &ctx);
-        else
-            rc = BGZFileWalkBlocks(&bam, false, NULL, BAMValidate2, &ctx);
-    }
-    BGZFileWhack(&bam);
-    return rc;
-}
-
-static rc_t CC dummy_cb(void *ctx, rc_t result, const BAMValidateStats *stats)
-{
-    return 0;
-}
-
-LIB_EXPORT rc_t CC BAMValidate(struct VPath const *bampath,
-                               struct VPath const *baipath,
-                               BAMValidateOption options,
-                               BAMValidateCallback callback,
-                               void *callbackContext
-                               )
-{
-    if (callback == NULL)
-        callback = dummy_cb;
-    if (bampath == NULL)
-        return RC(rcAlign, rcFile, rcValidating, rcParam, rcNull);
-    if (baipath == NULL) {
-        if (options & bvo_IndexOptions)
-            return RC(rcAlign, rcFile, rcValidating, rcParam, rcNull);
-        return BAMValidateBAM(bampath, options, callback, callbackContext);
-    }
-    return BAMValidateIndex(bampath, baipath, options, callback, callbackContext);
-}
diff --git a/libs/align/debug.h b/libs/align/debug.h
deleted file mode 100644
index 7c03771..0000000
--- a/libs/align/debug.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#ifndef _h_align_debug_
-#define _h_align_debug_
-
-#include <klib/debug.h>
-
-#if _DEBUGGING
-
-#define ALIGN_DBGF(msg) DBGMSG(DBG_ALIGN, DBG_FLAG(DBG_ALIGN_WRITER), msg)
-#define ALIGN_DBG(fmt, ...) ALIGN_DBGF(("%s:%u: " fmt "\n", __func__, __LINE__, __VA_ARGS__))
-#define ALIGN_DBGERR(rc) if(rc != 0) {ALIGN_DBGF(("%s:%u: %R\n", __func__, __LINE__, rc));}
-#define ALIGN_DBGERRP(fmt, rc, ...) if(rc != 0) {ALIGN_DBGF(("%s:%u: %R " fmt "\n", __func__, __LINE__, rc, __VA_ARGS__));}
-
-#define ALIGN_C_DBGF(msg) DBGMSG(DBG_ALIGN, DBG_FLAG(DBG_ALIGN_COMPRESS), msg)
-#define ALIGN_C_DBG(fmt, ...) ALIGN_C_DBGF(("%s:%u: " fmt "\n", __func__, __LINE__, __VA_ARGS__))
-#define ALIGN_C_DBGERR(rc) if(rc != 0) {ALIGN_C_DBGF(("%s:%u: %R\n", __func__, __LINE__, rc));}
-#define ALIGN_C_DBGERRP(fmt, rc, ...) if(rc != 0) {ALIGN_C_DBGF(("%s:%u: %R " fmt "\n", __func__, __LINE__, rc, __VA_ARGS__));}
-
-#define ALIGN_R_DBGF(msg) DBGMSG(DBG_ALIGN, DBG_FLAG(DBG_ALIGN_COVERAGE), msg)
-#define ALIGN_R_DBG(fmt, ...) ALIGN_R_DBGF(("%s:%u: " fmt "\n", __func__, __LINE__, __VA_ARGS__))
-#define ALIGN_R_DBGERR(rc) if(rc != 0) {ALIGN_R_DBGF(("%s:%u: %R\n", __func__, __LINE__, rc));}
-#define ALIGN_R_DBGERRP(fmt, rc, ...) if(rc != 0) {ALIGN_R_DBGF(("%s:%u: %R " fmt "\n", __func__, __LINE__, rc, __VA_ARGS__));}
-
-#define ALIGN_CF_DBGF(msg) DBGMSG(DBG_ALIGN, DBG_FLAG(DBG_ALIGN_CFG), msg)
-#define ALIGN_CF_DBG(fmt, ...) ALIGN_CF_DBGF(("%s:%u: " fmt "\n", __func__, __LINE__, __VA_ARGS__))
-#define ALIGN_CF_DBGERR(rc) if(rc != 0) {ALIGN_CF_DBGF(("%s:%u: %R\n", __func__, __LINE__, rc));}
-#define ALIGN_CF_DBGERRP(fmt, rc, ...) if(rc != 0) {ALIGN_CF_DBGF(("%s:%u: %R " fmt "\n", __func__, __LINE__, rc, __VA_ARGS__));}
-
-#else
-
-#define ALIGN_DBGF(msg) ((void)0)
-#define ALIGN_DBG(fmt, ...) ((void)0)
-#define ALIGN_DBGERR(rc) ((void)0)
-#define ALIGN_DBGERRP(fmt, rc, ...) ((void)0)
-
-#define ALIGN_C_DBGF(msg) ((void)0)
-#define ALIGN_C_DBG(fmt, ...) ((void)0)
-#define ALIGN_C_DBGERR(rc) ((void)0)
-#define ALIGN_C_DBGERRP(fmt, rc, ...) ((void)0)
-
-#define ALIGN_R_DBGF(msg) ((void)0)
-#define ALIGN_R_DBG(fmt, ...) ((void)0)
-#define ALIGN_R_DBGERR(rc) ((void)0)
-#define ALIGN_R_DBGERRP(fmt, rc, ...) ((void)0)
-
-#define ALIGN_CF_DBGF(msg) ((void)0)
-#define ALIGN_CF_DBG(fmt, ...) ((void)0)
-#define ALIGN_CF_DBGERR(rc) ((void)0)
-#define ALIGN_CF_DBGERRP(fmt, rc, ...) ((void)0)
-
-#endif
-
-#endif /* _h_align_debug_ */
diff --git a/libs/align/dna-reverse-cmpl.c b/libs/align/dna-reverse-cmpl.c
deleted file mode 100644
index 3476106..0000000
--- a/libs/align/dna-reverse-cmpl.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <align/extern.h>
-
-#include <klib/rc.h>
-#include <insdc/insdc.h>
-#include <sysalloc.h>
-
-#include "debug.h"
-#include <align/dna-reverse-cmpl.h>
-#include <string.h>
-
-LIB_EXPORT rc_t CC DNAReverseCompliment(const INSDC_dna_text* seq, INSDC_dna_text* cmpl, uint32_t len)
-{
-    rc_t rc = 0;
-    uint32_t i;
-    static INSDC_dna_text compl[256] = "~";
-
-    if( seq == NULL || compl == NULL ) {
-        rc = RC( rcAlign, rcType, rcConverting, rcParam, rcNull);
-    } else {
-        if( compl[0] == '~' ) {
-            INSDC_dna_text* x = (INSDC_dna_text*)&compl[0];
-            memset(x, 0, sizeof(compl));
-            x['A'] = x['a'] = 'T';
-            x['T'] = x['t'] = 'A';
-            x['U'] = x['u'] = 'A';
-            x['G'] = x['g'] = 'C';
-            x['C'] = x['c'] = 'G';
-            x['Y'] = x['y'] = 'R';
-            x['R'] = x['r'] = 'Y';
-            x['S'] = x['s'] = 'S';
-            x['W'] = x['w'] = 'W';
-            x['K'] = x['k'] = 'M';
-            x['M'] = x['m'] = 'K';
-            x['B'] = x['b'] = 'V';
-            x['D'] = x['d'] = 'H';
-            x['H'] = x['h'] = 'D';
-            x['V'] = x['v'] = 'B';
-            x['N'] = x['n'] = 'N';
-            x['0'] = '0';
-            x['1'] = '1';
-            x['2'] = '2';
-            x['3'] = '3';
-        }
-        cmpl += len;
-        for(i = 0; i < len; i++) {
-            *--cmpl= compl[(int)seq[i]];
-            if( *cmpl == '\0' ) {
-                rc = RC(rcAlign, rcFormatter, rcWriting, rcData, rcInvalid);
-                break;
-            }
-        }
-    }
-    ALIGN_DBGERR(rc);
-    return rc;
-}
diff --git a/libs/align/pl_iterator.c b/libs/align/pl_iterator.c
deleted file mode 100644
index 2d2a931..0000000
--- a/libs/align/pl_iterator.c
+++ /dev/null
@@ -1,686 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <align/extern.h>
-
-#include <klib/rc.h>
-#include <klib/vector.h>
-#include <klib/refcount.h>
-#include <klib/sort.h>
-#include <klib/text.h>
-#include <klib/out.h>
-#include <insdc/insdc.h>
-#include <align/manager.h>
-#include <align/iterator.h>
-#include <sysalloc.h>
-
-#include "debug.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-
-typedef struct window
-{
-    INSDC_coord_zero first;
-    INSDC_coord_len len;
-} window;
-
-
-typedef struct pi_entry
-{
-    DLNode n;                       /* to have it in a DLList */
-    PlacementIterator *pi;          /* the placement-iterator we have added */
-    window nxt_avail;               /* the next available position of the placement-iterator */
-} pi_entry;
-
-
-typedef struct pi_window
-{
-    DLNode n;                       /* to have it in a DLList */
-    window w;                       /* the window of the placement-iterator */
-    DLList pi_entries;              /* it has a DLList of pi_entry-struct's */
-    uint32_t count;                 /* how many entries do we have */
-} pi_window;
-
-
-typedef struct pi_ref
-{
-    DLNode n;                       /* to have it in a DLList */
-    char * name;                    /* the name of the reference it referes to */
-    window outer;                   /* the sum of all windows it has... */
-    bool outer_initialized;         /* has the outer-window been initialized */
-    DLList pi_windows;              /* it has a DLList of pi_window-struct's */
-} pi_ref;
-
-
-struct PlacementSetIterator
-{
-    KRefcount refcount;
-    struct AlignMgr const *amgr;    /* the alignment-manager... ( right now: we store it, but that's it )*/
-    DLList pi_refs;                 /* a list of references we have to iterate over... */
-    pi_ref * current_ref;           /* what is the current reference, we are handling ? */
-    pi_window * current_window;     /* what is the current window, we are handling ? */
-    pi_entry * current_entry;       /* what is the current pi-entry, we are handling ? */
-};
-
-
-/* =================================================================================================== */
-
-
-LIB_EXPORT rc_t CC AlignMgrMakePlacementSetIterator ( struct AlignMgr const *self,
-    PlacementSetIterator **iter )
-{
-    rc_t rc = 0;
-    if ( self == NULL )
-        rc = RC( rcAlign, rcIterator, rcConstructing, rcSelf, rcNull );
-    else
-    {
-        if ( iter == NULL  )
-            rc = RC( rcAlign, rcIterator, rcConstructing, rcParam, rcNull );
-        else
-        {
-            PlacementSetIterator * psi = calloc( sizeof * psi, 1 );
-            if ( psi == NULL )
-                rc = RC( rcAlign, rcIterator, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                rc = AlignMgrAddRef ( self );
-                if ( rc == 0 )
-                {
-                    KRefcountInit( &psi->refcount, 1, "PlacementSetIterator", "Make", "align" );
-                    psi->amgr = self;
-                    psi->current_ref = NULL;          /* we don't know that yet */
-                    psi->current_window = NULL;
-                    psi->current_entry = NULL;
-                    DLListInit( &psi->pi_refs );
-                }
-            }
-            if ( rc == 0 )
-                *iter = psi;
-            else
-                free( psi );
-        }
-    }
-
-    return rc;
-}
-
-
-/* =================================================================================================== */
-
-
-static int cmp_pchar( const char * a, const char * b )
-{
-    int res = 0;
-    if ( ( a != NULL )&&( b != NULL ) )
-    {
-        size_t len_a = string_size( a );
-        size_t len_b = string_size( b );
-        res = string_cmp ( a, len_a, b, len_b, ( len_a < len_b ) ? len_b : len_a );
-    }
-    return res;
-}
-
-
-/* =================================================================================================== */
-
-
-typedef struct pi_ref_cb_ctx
-{
-    const char * name;
-    pi_ref *res;
-} pi_ref_cb_ctx;
-
-
-static bool CC find_pi_ref_callback( DLNode *n, void *data )
-{
-    pi_ref_cb_ctx *ctx = ( pi_ref_cb_ctx * )data;
-    pi_ref * pr = ( pi_ref * ) n;
-    bool res = ( cmp_pchar( ctx->name, pr->name ) == 0 );
-    if ( res )
-    {
-        ctx->res = pr;
-    }
-    return res;
-}
-
-
-static pi_ref * find_pi_ref( const DLList * list, const char * name )
-{
-    pi_ref_cb_ctx ctx;
-    ctx.res = NULL;
-    ctx.name = name;
-    DLListDoUntil ( list, false, find_pi_ref_callback, &ctx );
-    return ctx.res;
-}
-
-
-/* =================================================================================================== */
-
-typedef struct pi_window_cb_ctx
-{
-    window *w;
-    pi_window *res;
-} pi_window_cb_ctx;
-
-
-static bool CC find_pi_window_callback( DLNode *n, void *data )
-{
-    pi_window_cb_ctx *ctx = ( pi_window_cb_ctx * )data;
-    pi_window * pw = ( pi_window * ) n;
-    bool res = ( pw->w.first == ctx->w->first && pw->w.len == ctx->w->len );
-    if ( res )
-        ctx->res = pw;
-    return res;
-}
-
-
-static pi_window * find_pi_window( const DLList * list, window * w )
-{
-    pi_window_cb_ctx ctx;
-    ctx.res = NULL;
-    ctx.w = w;
-    DLListDoUntil ( list, false, find_pi_window_callback, &ctx );
-    return ctx.res;
-}
-
-
-/* =================================================================================================== */
-
-
-static rc_t make_pi_window( pi_window ** pw, DLList * list, window * w )
-{
-    rc_t rc = 0;
-    *pw = calloc( 1, sizeof ** pw );
-    if ( *pw == NULL )
-        rc = RC( rcAlign, rcIterator, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        (*pw)->w.first = w->first;
-        (*pw)->w.len = w->len;
-        DLListInit( &( (*pw)->pi_entries ) );
-        DLListPushTail ( list, ( DLNode * )(*pw) );
-    }
-    return rc;
-}
-
-
-static rc_t add_to_pi_window( pi_window * pw, PlacementIterator *pi )
-{
-    rc_t rc = 0;
-    pi_entry * pie = calloc( 1, sizeof *pie );
-    if ( pie == NULL )
-        rc = RC( rcAlign, rcIterator, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        pie->pi = pi;       /* store the placement-iterator in it's entry-struct */
-        rc = PlacementIteratorNextAvailPos ( pi, &(pie->nxt_avail.first), &(pie->nxt_avail.len) );
-        if ( rc == 0 )
-        {
-            PlacementIteratorAddRef ( pi );
-            DLListPushTail ( &pw->pi_entries, ( DLNode * )pie );
-            pw->count += 1;
-        }
-        else
-        {
-            free( pie );
-            ALIGN_DBG( "PlacementIter has no placements...", 0 );
-        }
-    }
-    return rc;
-}
-
-
-/* =================================================================================================== */
-
-
-static rc_t make_pi_ref( pi_ref ** pr, DLList * list, const char * name )
-{
-    rc_t rc = 0;
-    *pr = calloc( 1, sizeof ** pr );
-    if ( *pr == NULL )
-        rc = RC( rcAlign, rcIterator, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        (*pr)->name = string_dup_measure ( name, NULL );
-        DLListInit( &( (*pr)->pi_windows ) );
-        DLListPushTail ( list, ( DLNode * )(*pr) );
-    }
-    return rc;
-}
-
-
-static rc_t add_to_pi_ref( pi_ref * pr, window * w, PlacementIterator *pi )
-{
-    rc_t rc = 0;
-    pi_window * pw = find_pi_window( &pr->pi_windows, w );
-
-    if ( pw == NULL )
-        rc = make_pi_window( &pw, &pr->pi_windows, w );
-    if ( rc == 0 )
-        rc = add_to_pi_window( pw, pi );
-
-    if ( rc == 0 )
-    {
-        /* keep track of the outer window... */
-        if ( DLListHead( &pr->pi_windows ) == NULL )
-        {
-            /* first window ?*/
-            pr->outer.first = w->first;
-            pr->outer.len = w->len;
-        }
-        else
-        {
-            if ( w->first < pr->outer.first )
-                pr->outer.first = w->first;
-            if ( w->first + w->len > pr->outer.first + pr->outer.len )
-                pr->outer.len = ( ( w->first + w->len ) - pr->outer.first ) + 1;
-        }
-    }
-    else if ( ( pw != NULL )&&( GetRCState( rc ) == rcDone ) )
-    {
-        /* add_to_pi_window() was not successful because iterator has no
-           alignments int the requested window, that means we have to delete
-           the window if it is empty */
-        if ( pw->count == 0 )
-        {
-            /* first we have to take the pw out of the pr->pi_windows - list...
-               it was pushed at the tail of it, so we pop it from there */
-            DLListPopTail( &pr->pi_windows );
-            /* because it is empty ( count == 0 ) we can just free it now */
-            free( pw );
-        }
-    }
-    return rc;
-}
-
-
-/* =================================================================================================== */
-
-
-LIB_EXPORT rc_t CC PlacementSetIteratorAddPlacementIterator ( PlacementSetIterator *self,
-    PlacementIterator *pi )
-{
-    rc_t rc = 0;
-    if ( self == NULL )
-        rc = RC( rcAlign, rcIterator, rcConstructing, rcSelf, rcNull );
-    else
-    {
-        if ( pi == NULL  )
-            rc = RC( rcAlign, rcIterator, rcConstructing, rcParam, rcNull );
-        else
-        {
-            const char * name;      /* what reference are we aligning against */
-            window w;               /* where does the pi start/end, against said reference */
-
-            /* to find the name of the reference used, important for adding the iterator */
-            rc = PlacementIteratorRefWindow ( pi, &name, &(w.first), &(w.len) );
-            if ( rc == 0 )
-            {
-                pi_ref * pr = find_pi_ref( &self->pi_refs, name );
-                /* if we do not have a pi_ref yet with this name: make one! */
-                if ( pr == NULL )
-                    rc = make_pi_ref( &pr, &self->pi_refs, name );
-                /* add the placement-iterator to the newly-made or existing pi_ref! */
-                if ( rc == 0 )
-                    rc = add_to_pi_ref( pr, &w, pi );
-            }
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC PlacementSetIteratorAddRef ( const PlacementSetIterator *cself )
-{
-    rc_t rc = 0;
-    if ( cself == NULL )
-        rc = RC( rcAlign, rcIterator, rcAttaching, rcSelf, rcNull );
-    else
-    {
-        if ( KRefcountAdd( &cself->refcount, "PlacementSetIterator" ) != krefOkay )
-        {
-            rc = RC( rcAlign, rcIterator, rcAttaching, rcError, rcUnexpected );
-        }
-    }
-    return rc;
-}
-
-
-/* =================================================================================================== */
-
-
-static void CC pi_entry_whacker( DLNode *n, void *data )
-{
-    pi_entry * pie = ( pi_entry * )n;
-    PlacementIteratorRelease ( pie->pi );
-    free( pie );
-}
-
-static void CC pi_window_whacker( DLNode *n, void *data )
-{
-    pi_window * pw = ( pi_window * )n;
-    DLListWhack ( &pw->pi_entries, pi_entry_whacker, NULL );
-    free( pw );
-}
-
-static void CC pi_ref_whacker( DLNode *n, void *data )
-{
-    pi_ref * pr = ( pi_ref * )n;
-    DLListWhack ( &pr->pi_windows, pi_window_whacker, NULL );
-    free( pr->name );
-    free( pr );
-}
-
-
-static void pl_set_iter_clear_curr_ref_window( PlacementSetIterator *self )
-{
-    if ( self->current_window != NULL )
-    {
-        pi_window_whacker( (DLNode *)self->current_window, NULL );
-        self->current_window = NULL;
-    }
-}
-
-
-static void pl_set_iter_clear_curr_ref( PlacementSetIterator *self )
-{
-    if ( self->current_ref != NULL )
-    {
-        pi_ref_whacker( (DLNode *)self->current_ref, NULL );
-        self->current_ref = NULL;
-    }
-}
-
-/* =================================================================================================== */
-
-
-LIB_EXPORT rc_t CC PlacementSetIteratorRelease ( const PlacementSetIterator *cself )
-{
-    rc_t rc = 0;
-    if ( cself == NULL )
-        rc = RC( rcAlign, rcIterator, rcReleasing, rcSelf, rcNull );
-    else
-    {
-        if ( KRefcountDrop( &cself->refcount, "PlacementSetIterator" ) == krefWhack )
-        {
-            PlacementSetIterator * self = ( PlacementSetIterator * ) cself;
-
-            pl_set_iter_clear_curr_ref_window( self );
-            pl_set_iter_clear_curr_ref( self );
-
-            /* release the DLList of pi-ref's and the pi's in it... */
-            DLListWhack ( &self->pi_refs, pi_ref_whacker, NULL );
-
-            AlignMgrRelease ( self->amgr );
-
-            free( self );
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC PlacementSetIteratorNextReference ( PlacementSetIterator *self,
-    INSDC_coord_zero *first_pos, INSDC_coord_len *len, struct ReferenceObj const ** refobj )
-{
-    rc_t rc = 0;
-    if ( refobj != NULL ) { *refobj = NULL; }
-
-    if ( self == NULL )
-        return RC( rcAlign, rcIterator, rcReleasing, rcSelf, rcNull );
-
-    pl_set_iter_clear_curr_ref_window( self );
-    pl_set_iter_clear_curr_ref( self );
-    self->current_entry = NULL;     /* what is the current pi-entry, we are handling ? */
-
-    /* !!! here we are taking the next reference from the top of the list */
-    self->current_ref = ( pi_ref * )DLListPopHead ( &self->pi_refs );
-
-    if ( self->current_ref == NULL )
-    {
-        return SILENT_RC( rcAlign, rcIterator, rcAccessing, rcOffset, rcDone );
-    }
-
-    if ( first_pos != NULL ) *first_pos = self->current_ref->outer.first;
-    if ( len != NULL) *len = self->current_ref->outer.len;
-
-    /* if the caller wants to know the ref-obj... */
-    if ( refobj != NULL )
-    {
-        pi_window *pw = ( pi_window * )DLListHead( &(self->current_ref->pi_windows) );
-        if ( pw != NULL )
-        {
-            pi_entry * pie = ( pi_entry * )DLListHead( &(pw->pi_entries) );
-            if ( pie != NULL )
-            {
-                rc = PlacementIteratorRefObj( pie->pi, refobj );
-            }
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC PlacementSetIteratorNextWindow ( PlacementSetIterator *self,
-    INSDC_coord_zero *first_pos, INSDC_coord_len *len )
-{
-    rc_t rc = 0;
-    if ( first_pos != NULL ) { *first_pos = 0; }
-    if ( len != NULL ) { *len = 0; }
-
-    if ( self == NULL )
-        return RC( rcAlign, rcIterator, rcReleasing, rcSelf, rcNull );
-
-    self->current_entry = NULL;     /* what is the current pi-entry, we are handling ? */
-
-    if ( self->current_ref == NULL )
-    {
-        return SILENT_RC( rcAlign, rcIterator, rcAccessing, rcOffset, rcDone );
-    }
-
-    pl_set_iter_clear_curr_ref_window( self );
-
-    /* !!! here we are taking the next window from the top of the list */
-    self->current_window = ( pi_window * )DLListPopHead ( &(self->current_ref->pi_windows) );
-
-    /* check if we have reached the last window on this reference... */
-    if ( self->current_window == NULL )
-    {
-        return SILENT_RC( rcAlign, rcIterator, rcAccessing, rcOffset, rcDone );
-    }
-
-    /* point to the first entry in this window... */
-    self->current_entry = ( pi_entry * )DLListHead( &(self->current_window->pi_entries) );
-
-    /* if the caller wants to know first_pos / len */
-    if ( first_pos != NULL )
-    {
-        *first_pos = self->current_window->w.first;
-    }
-    if ( len != NULL )
-    {
-        *len = self->current_window->w.len;
-    }
-
-    return rc;
-}
-
-typedef struct pi_ref_nxt_avail_pos_ctx
-{
-    uint32_t count;
-    INSDC_coord_zero min_pos;
-    INSDC_coord_len min_len;
-    bool min_pos_initialized;
-    rc_t rc;
-} pi_ref_nxt_avail_pos_ctx;
-
-static void CC nxt_avail_pos_cb( DLNode * n, void * data )
-{
-    pi_ref_nxt_avail_pos_ctx * ctx = ( pi_ref_nxt_avail_pos_ctx * ) data;
-    if ( ctx->rc == 0 )
-    {
-        pi_entry * pie = ( pi_entry * )n;
-        rc_t rc = PlacementIteratorNextAvailPos ( pie->pi, &(pie->nxt_avail.first), &(pie->nxt_avail.len) );
-        if ( rc == 0 )
-        {
-/*            OUTMSG(( "nxt_avail.first=%u w.last=%u\n", pie->nxt_avail.first, pie->w.last )); */
-            ( ctx->count )++;
-            if ( ctx->min_pos_initialized )
-            {
-                if ( pie->nxt_avail.first < ctx->min_pos )
-                {
-                    ctx->min_pos = pie->nxt_avail.first;
-                    ctx->min_len = pie->nxt_avail.len;
-                }
-            }
-            else
-            {
-                ctx->min_pos = pie->nxt_avail.first;
-                ctx->min_len = pie->nxt_avail.len;
-                ctx->min_pos_initialized = true;
-            }
-        }
-        else
-        {
-            if ( GetRCState( rc ) != rcDone )
-                ctx->rc = rc;
-        }
-    }
-}
-
-
-LIB_EXPORT rc_t CC PlacementSetIteratorNextAvailPos ( const PlacementSetIterator *cself,
-    INSDC_coord_zero *pos, INSDC_coord_len *len )
-{
-    rc_t rc = 0;
-    if ( cself == NULL )
-        rc = RC( rcAlign, rcIterator, rcAccessing, rcSelf, rcNull );
-    else
-    {
-        if ( pos == NULL )
-            rc = RC( rcAlign, rcIterator, rcAccessing, rcParam, rcNull );
-        else
-        {
-            PlacementSetIterator *self = ( PlacementSetIterator * )cself;
-            if ( self->current_ref == NULL || self->current_window == NULL )
-            {
-                rc = SILENT_RC( rcAlign, rcIterator, rcAccessing, rcOffset, rcDone );
-            }
-            else
-            {
-                /* loop through all the pi_entry int the current_pi_ref */
-                pi_ref_nxt_avail_pos_ctx ctx;
-                ctx.count = 0;
-                ctx.rc = 0;
-                ctx.min_pos = 0;
-                ctx.min_len = 0;
-                ctx.min_pos_initialized = false;
-                DLListForEach ( &(self->current_window->pi_entries),
-                                false, nxt_avail_pos_cb, &ctx );
-                rc = ctx.rc;
-                if ( ctx.count == 0 )
-                {
-                    rc = SILENT_RC( rcAlign, rcIterator, rcAccessing, rcOffset, rcDone );
-                }
-                else
-                {
-                    *pos = ctx.min_pos;
-                    if ( len != NULL )
-                    {
-                        *len = ctx.min_len;
-                    }
-                }
-            } 
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC PlacementSetIteratorNextRecordAt ( PlacementSetIterator *self,
-    INSDC_coord_zero pos, const PlacementRecord **rec )
-{
-    rc_t rc = 0;
-    pi_window * pw;
-    bool done;
-
-    if ( rec == NULL )
-        return RC( rcAlign, rcIterator, rcAccessing, rcParam, rcNull );
-    *rec = NULL;
-    if ( self == NULL )
-        return RC( rcAlign, rcIterator, rcAccessing, rcSelf, rcNull );
-    if ( self->current_ref == NULL )
-    {
-        /* no more reference to iterator over! the iterator is done! */
-        return SILENT_RC( rcAlign, rcIterator, rcAccessing, rcOffset, rcDone );
-    }
-    if ( self->current_window == NULL )
-    {
-        /* no more windows to iterator over! the iterator is done! */
-        return SILENT_RC( rcAlign, rcIterator, rcAccessing, rcOffset, rcDone );
-    }
-
-    pw = self->current_window;
-    done = false;
-    do
-    {
-        if ( self->current_entry == NULL )
-        {
-            self->current_entry = ( pi_entry * )DLListHead( &(pw->pi_entries) );
-        }
-        done = ( self->current_entry == NULL );
-        rc = ( done ? SILENT_RC( rcAlign, rcIterator, rcAccessing, rcOffset, rcDone ) : 0 );
-        if ( rc == 0 )
-        {
-            rc = PlacementIteratorNextRecordAt ( self->current_entry->pi, pos, rec );
-            done = ( GetRCState( rc ) != rcDone );
-            if ( !done )
-            {
-                self->current_entry = ( pi_entry * )DLNodeNext( ( DLNode * )self->current_entry );
-                done = ( self->current_entry == NULL );
-                rc = ( done ? SILENT_RC( rcAlign, rcIterator, rcAccessing, rcOffset, rcDone ) : 0 );
-            }
-        }
-    } while ( !done );
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC PlacementSetIteratorNextIdAt ( PlacementSetIterator *self,
-    INSDC_coord_zero pos, int64_t *row_id, INSDC_coord_len *len )
-{
-    const PlacementRecord *rec;
-    rc_t rc = PlacementSetIteratorNextRecordAt ( self, pos, &rec );
-    if ( rc == 0 )
-    {
-        if ( row_id != NULL ) *row_id = rec->id;
-        if ( len != NULL ) *len = rec->len;
-    }
-    return rc;
-}
diff --git a/libs/align/quality-quantizer.c b/libs/align/quality-quantizer.c
deleted file mode 100644
index 15205ca..0000000
--- a/libs/align/quality-quantizer.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <stdint.h>
-#include <string.h>
-#include <ctype.h>
-
-#include <klib/defs.h>
-#include <align/quality-quantizer.h>
-
-LIB_EXPORT
-bool CC QualityQuantizerInitMatrix(uint8_t dst[256], char const quant[])
-{
-    unsigned i = 0;
-    unsigned limit = 0;
-    unsigned value = 0;
-    unsigned cur;
-    int ws = 1;
-    int st = 0;
-    
-    memset(dst, 0, 256);
-    for (cur = 0; quant[cur] != 0; ++cur) {
-        int const ch = quant[cur];
-        
-        if (ws) {
-            if (isspace(ch))
-                continue;
-            ws = false;
-        }
-        switch (st) {
-        case 0:
-            if (isdigit(ch)) {
-                value = (value * 10) + ch - '0';
-                break;
-            }
-            else if (isspace(ch)) {
-                ++st;
-                ws = true;
-                break;
-            }
-            ++st;
-            /* no break */
-        case 1:
-            if (ch != ':')
-                return false;
-            ws = true;
-            ++st;
-            break;
-        case 2:
-            if (isdigit(ch)) {
-                limit  = (limit * 10) + ch - '0';
-                break;
-            }
-            else if (isspace(ch)) {
-                ++st;
-                ws = true;
-                break;
-            }
-            else if (ch == '-' && limit == 0) {
-                memset(dst + i, value, 256 - i);
-                return true;
-            }
-            ++st;
-            /* no break */
-        case 3:
-            if (ch != ',')
-                return false;
-            ws = true;
-            st = 0;
-            if (i > limit)
-                return false;
-            /* set from dst[i..(limit - 1)] = value
-             * not inclusive of the endpoint
-             */
-            memset(dst + i, value, limit - i);
-            i = limit;
-            limit = value = 0;
-            break;
-        }
-    }
-    return false;
-}
diff --git a/libs/align/reader-cmn.c b/libs/align/reader-cmn.c
deleted file mode 100644
index 607ac09..0000000
--- a/libs/align/reader-cmn.c
+++ /dev/null
@@ -1,317 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was readten as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <klib/rc.h>
-#include <vdb/table.h>
-#include <vdb/cursor.h>
-#include <vdb/vdb-priv.h>
-
-#include "reader-cmn.h"
-#include "debug.h"
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-
-struct TableReader
-{
-    const VCursor* curs;
-    const TableReaderColumn* cols;
-    int64_t curr;
-};
-
-
-rc_t CC TableReader_Make( const TableReader** cself, const VTable* table,
-                          TableReaderColumn* cols, size_t cache )
-{
-    rc_t rc = 0;
-    const VCursor* curs;
-
-    if ( table == NULL )
-    {
-        rc = RC( rcAlign, rcType, rcConstructing, rcParam, rcInvalid );
-    }
-    else
-    {
-        rc = VTableCreateCachedCursorRead( table, &curs, cache );
-        if ( rc == 0 )
-        {
-            rc = TableReader_MakeCursor( cself, curs, cols );
-            VCursorRelease( curs );
-        }
-    }
-    ALIGN_DBGERR( rc );
-    return rc;
-}
-
-
-rc_t CC TableReader_MakeCursor( const TableReader** cself, const VCursor* cursor,
-                                TableReaderColumn* cols )
-{
-    rc_t rc = 0;
-    TableReader* obj = NULL;
-
-    if ( cself == NULL || cursor == NULL || cols == NULL || cols->name == NULL )
-    {
-        rc = RC( rcAlign, rcType, rcConstructing, rcParam, rcInvalid );
-    }
-    else if ( ( obj = calloc( 1, sizeof( *obj ) ) ) == NULL )
-    {
-        rc = RC( rcAlign, rcType, rcConstructing, rcMemory, rcExhausted );
-    }
-    else
-    {
-        rc = VCursorAddRef( cursor );
-        if ( rc == 0 )
-        {
-            obj->curs = cursor;
-/*            obj->cursor_open = false; */
-            obj->cols = cols;
-            while ( rc == 0 && cols->name != NULL)
-            {
-                if ( !( cols->flags & ercol_Skip ) )
-                {
-                    rc = VCursorAddColumn( obj->curs, &cols->idx, cols->name );
-                    if ( rc != 0 )
-                    {
-                        if ( ( rc != 0 && ( cols->flags & ercol_Optional ) ) || GetRCState( rc ) == rcExists )
-                        {
-                            rc = 0;
-                        }
-                        else
-                        {
-                            ALIGN_DBGERRP( "cannot add column '%s' to cursor", rc, cols->name );
-                        }
-                    }
-                }
-                cols++;
-            }
-            if ( rc == 0 )
-            {
-                rc = VCursorOpen( obj->curs );
-            }
-        }
-    }
-
-
-    if( rc == 0 )
-    {
-        *cself = obj;
-/*        ALIGN_DBG("ok%c", '!'); */
-    }
-    else
-    {
-        TableReader_Whack( obj );
-        ALIGN_DBGERRP( "TableReader_MakeCursor() failed", rc, 0 );
-    }
-    return rc;
-}
-
-
-void CC TableReader_Whack( const TableReader* cself )
-{
-    if ( cself != NULL )
-    {
-        VCursorRelease( cself->curs );
-        free( ( TableReader* ) cself );
-    }
-}
-
-/*
-rc_t CC TableReader_OpenCursor( const TableReader* cself )
-{
-    TableReader * tr = ( TableReader * )cself;
-    VCursor * curs = ( VCursor * )tr->curs;
-    rc_t rc = VCursorOpen( curs );
-    tr->cursor_open = ( rc == 0 );
-    return rc;
-}
-*/
-
-rc_t CC TableReader_ReadRow( const TableReader* cself, int64_t rowid )
-{
-    rc_t rc = 0;
-    TableReaderColumn* c = NULL;
-
-    if ( cself == NULL )
-    {
-        rc = RC(rcAlign, rcType, rcOpening, rcSelf, rcNull);
-    }
-    else if ( cself->curr != rowid )
-    {
-/*
-        if ( !cself->cursor_open )
-            rc = TableReader_OpenCursor( cself );
-*/
-        if ( rc == 0 )
-        {
-            rc = VCursorCloseRow( cself->curs );
-            if ( rc == 0 )
-            {
-                rc = VCursorSetRowId( cself->curs, rowid );
-                if ( rc == 0 )
-                {
-                    rc = VCursorOpenRow( cself->curs );
-                    if ( rc == 0 )
-                    {
-                        uint32_t boff = 0;
-                        c = ( TableReaderColumn* )( cself->cols );
-                        while ( c->name != NULL )
-                        {
-                            if ( c->idx != 0 )
-                            {
-                                /* TBD - FIX ME
-                                   this can be dangerous, since VCursorCellData
-                                   can cause cache flushes, invalidating previous
-                                   reads. THESE MUST BE FETCHED UPON DEMAND, NOT
-                                   PREFETCHED!!
-                                */
-                                rc = VCursorCellData( cself->curs, c->idx, NULL, (const void**)&c->base.var, &boff, &c->len );
-                                if ( rc != 0 )
-                                {
-                                    if ( c->flags & ercol_Optional )
-                                        rc = 0;
-                                    c->base.var = NULL;
-                                    c->len = 0;
-                                }
-                                else if ( boff != 0 )
-                                {
-                                    rc = RC( rcAlign, rcType, rcReading, rcData, rcUnsupported );
-                                }
-                            }
-                            c++;
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    if ( rc != 0 )
-    {
-        ALIGN_DBGERRP( "column %s row %ld", rc, c ? c->name : "<none>", rowid );
-    }
-    else
-    {
-        ( ( TableReader* )cself )->curr = rowid;
-    }
-    return rc;
-}
-
-
-rc_t CC TableReader_IdRange( const TableReader* cself, int64_t* first, uint64_t* count )
-{
-    rc_t rc = 0;
-    if ( cself == NULL )
-    {
-        rc = RC( rcAlign, rcType, rcRetrieving, rcSelf, rcNull );
-    }
-    else
-    {
-/*
-        if ( !cself->cursor_open )
-            rc = TableReader_OpenCursor( cself );
-        if ( rc == 0 )
-*/
-            rc = VCursorIdRange( cself->curs, 0, first, count );
-    }
-    return rc;
-}
-
-
-rc_t CC TableReader_OpenIndex( const TableReader* cself, const char* name, const KIndex** idx )
-{
-    rc_t rc = 0;
-
-    if ( cself == NULL || name == NULL || idx == NULL )
-    {
-        rc = RC( rcAlign, rcType, rcAccessing, rcParam, rcNull );
-    }
-    else
-    {
-/*
-        if ( !cself->cursor_open )
-            rc = TableReader_OpenCursor( cself );
-        if ( rc == 0 )
-        {
-*/
-            const VTable* tbl;
-            rc = VCursorOpenParentRead( cself->curs, &tbl );
-            if ( rc == 0 )
-            {
-                rc = VTableOpenIndexRead( tbl, idx, name );
-                VTableRelease( tbl );
-            }
-/*        } */
-    }
-    return rc;
-}
-
-
-rc_t CC TableReader_PageIdRange( const TableReader *cself, int64_t rowid,
-                                 int64_t *pfirst, int64_t *plast )
-{
-    rc_t rc = 0;
-    
-    if ( cself == NULL )
-    {
-        rc = RC( rcAlign, rcType, rcOpening, rcSelf, rcNull );
-    }
-    else
-    {
-/*
-        if ( !cself->cursor_open )
-            rc = TableReader_OpenCursor( cself );
-        if ( rc == 0 )
-        {
-*/
-            if ( pfirst != NULL || plast != NULL )
-            {
-                int64_t first = INT64_MAX;
-                int64_t last = INT64_MIN;
-                unsigned i;
-                
-                for ( i = 0; cself->cols[ i ].name != NULL; ++i )
-                {
-                    if ( cself->cols[i].idx != 0 )
-                    {
-                        int64_t tfirst;
-                        int64_t tlast;
-                        
-                        rc = VCursorPageIdRange( cself->curs, cself->cols[ i ].idx, rowid, &tfirst, &tlast );
-                        if ( rc == 0 )
-                        {
-                            if ( first > tfirst ) { first = tfirst; }
-                            if ( last < tlast ) { last = tlast; }
-                        }
-                    }
-                }
-                if ( pfirst != NULL ) { *pfirst = first; }
-                if ( plast  != NULL ) { *plast  = last; }
-            }
-/*        } */
-    }
-    return rc;
-}
diff --git a/libs/align/reader-cmn.h b/libs/align/reader-cmn.h
deleted file mode 100644
index 3310999..0000000
--- a/libs/align/reader-cmn.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was readten as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#ifndef _h_align_reader_cmn_
-#define _h_align_reader_cmn_
-
-#include <insdc/insdc.h>
-#include <insdc/sra.h>
-
-enum TableReaderColumn_Array {
-    ercol_Optional = 0x01,
-    ercol_Skip = 0x02
-};
-
-/* use ercol_Ignore to skip optional column when cursor is created */
-typedef struct TableReaderColumn_struct {
-    uint32_t idx;
-    const char* name;
-    union {
-        const void* var;
-        const char* str;
-        const bool* buul;
-        const uint8_t* u8;
-        const int16_t* i16;
-        const uint16_t* u16;
-        const int32_t* i32;
-        const uint32_t* u32;
-        const int64_t* i64;
-        const uint64_t* u64;
-        const INSDC_coord_one* coord1;
-        const INSDC_coord_zero* coord0;
-        const INSDC_coord_len* coord_len;
-        const INSDC_coord_val* coord_val;
-        const INSDC_SRA_xread_type* read_type;
-        const INSDC_SRA_read_filter* read_filter;
-    } base;
-    uint32_t len;
-    uint32_t flags;
-} TableReaderColumn;
-
-typedef struct TableReader TableReader;
-
-rc_t CC TableReader_Make(const TableReader** cself, const VTable* table, TableReaderColumn* cols, size_t cache);
-
-rc_t CC TableReader_MakeCursor(const TableReader** cself, const VCursor* cursor, TableReaderColumn* cols );
-
-rc_t CC TableReader_OpenCursor( const TableReader* cself );
-
-void CC TableReader_Whack(const TableReader* cself);
-
-rc_t CC TableReader_ReadRow(const TableReader* cself, int64_t rowid);
-
-rc_t CC TableReader_IdRange(const TableReader* cself, int64_t* first, uint64_t* count);
-
-rc_t CC TableReader_OpenIndex(const TableReader* cself, const char* name, const KIndex** idx);
-
-rc_t CC TableReader_PageIdRange(const TableReader *cself, int64_t rowid, int64_t *first, int64_t *last);
-
-#endif /* _h_align_reader_cmn_ */
diff --git a/libs/align/reader-refseq.c b/libs/align/reader-refseq.c
deleted file mode 100644
index 0a29c53..0000000
--- a/libs/align/reader-refseq.c
+++ /dev/null
@@ -1,255 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was readten as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <align/extern.h>
-
-#include <klib/rc.h>
-#include <klib/text.h>
-#include <insdc/insdc.h>
-#include <vdb/manager.h>
-#include <vdb/table.h>
-#include <vdb/cursor.h>
-#include <align/reader-refseq.h>
-#include <os-native.h>
-#include <sysalloc.h>
-
-#include "reader-cmn.h"
-#include "reference-cmn.h"
-#include "debug.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <ctype.h>
-#include <assert.h>
-
-static const TableReaderColumn TableReaderRefSeq_cols[] =
-{
-    /* order important, see code below! */
-    {0, "(INSDC:dna:text)READ", {NULL}, 0, 0},
-    {0, "(INSDC:4na:bin)READ", {NULL}, 0, ercol_Skip},
-    {0, "QUALITY", {NULL}, 0, ercol_Skip | ercol_Optional},
-    {0, "SEQ_LEN", {NULL}, 0, 0},
-    {0, NULL, {NULL}, 0, 0}
-};
-
-struct TableReaderRefSeq {
-    const TableReader* base;
-    TableReaderColumn cols[sizeof(TableReaderRefSeq_cols)/sizeof(TableReaderRefSeq_cols[0])];
-    char seq_id[256];
-    uint32_t max_seq_len;
-    INSDC_coord_len total_seq_len;
-    bool circular;
-    bool has_md5;
-    uint8_t md5[16];
-    const TableReaderColumn* read;
-    const TableReaderColumn* seq_len;
-};
-
-LIB_EXPORT rc_t CC TableReaderRefSeq_MakeTable(const TableReaderRefSeq** cself, const VDBManager* vmgr,
-                                               const VTable* table, uint32_t options, size_t cache)
-{
-    rc_t rc = 0;
-    TableReaderRefSeq* self = NULL;
-
-    if( cself == NULL || table == NULL ) {
-        rc = RC(rcAlign, rcType, rcConstructing, rcParam, rcNull);
-    } else if( (self = calloc(1, sizeof(*self))) == NULL ) {
-        rc = RC(rcAlign, rcType, rcConstructing, rcMemory, rcExhausted);
-    } else {
-        const TableReader* tmp;
-        TableReaderColumn static_cols[] = {
-            /* order important, see code below! */
-            {0, "MAX_SEQ_LEN", {NULL}, 0, 0},
-            {0, "SEQ_ID", {NULL}, 0, 0},
-            {0, "TOTAL_SEQ_LEN", {NULL}, 0, 0},
-            {0, "CIRCULAR", {NULL}, 0, 0},
-            {0, "MD5", {NULL}, 0, ercol_Optional},
-            {0, NULL, {NULL}, 0, 0}
-        };
-        if( (rc = TableReader_Make(&tmp, table, static_cols, 0)) == 0 ) {
-            if( (rc = TableReader_ReadRow(tmp, 1)) == 0 ) {
-                self->max_seq_len = static_cols[0].base.u32[0];
-                self->total_seq_len = static_cols[2].base.u64[0];
-                if( self->total_seq_len != static_cols[2].base.u64[0] ) {
-                    rc = RC(rcAlign, rcType, rcConstructing, rcData, rcOutofrange);
-                }
-                if( static_cols[1].base.var != NULL ) {
-                    if ( static_cols[ 1 ].len > sizeof( self->seq_id ) - 1 )
-                    {
-                        rc = RC( rcAlign, rcType, rcConstructing, rcBuffer, rcInsufficient );
-                    }
-                    else
-                    {
-                        string_copy( self->seq_id, ( sizeof self->seq_id ) -  1, static_cols[1].base.str, static_cols[1].len );
-                        self->seq_id[ static_cols[ 1 ].len ] = '\0';
-                    }
-                }
-                self->circular = static_cols[3].base.buul[0];
-                if( static_cols[4].base.var != NULL ) {
-                    memcpy(self->md5, static_cols[4].base.var, sizeof(self->md5));
-                    self->has_md5 = true;
-                }
-            }
-            TableReader_Whack(tmp);
-        }
-
-        memcpy(self->cols, TableReaderRefSeq_cols, sizeof(TableReaderRefSeq_cols));
-        if( options & errefseq_4NA) {
-            self->cols[0].flags |= ercol_Skip;
-            self->cols[1].flags &= ~ercol_Skip;
-            self->read = &self->cols[1];
-        } else {
-            self->read = &self->cols[0];
-        }
-        self->seq_len = &self->cols[3];
-        rc = TableReader_Make(&self->base, table, self->cols, cache);
-    }
-    if( rc == 0 ) {
-        *cself = self;
-        /* ALIGN_DBG("table 0x%p opened 0x%p", table, self); */
-    } else {
-        TableReaderRefSeq_Whack(self);
-        ALIGN_DBGERRP("table for 0x%p", rc, table);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC TableReaderRefSeq_MakePath(const TableReaderRefSeq** cself, const VDBManager* vmgr,
-                                              const char* path, uint32_t options, size_t cache)
-{
-    rc_t rc = 0;
-    const VTable* tbl = NULL;
-
-    if( vmgr == NULL || path == NULL ) {
-        rc = RC(rcAlign, rcType, rcConstructing, rcParam, rcNull);
-    } else if( (rc = VDBManagerOpenTableRead(vmgr, &tbl, NULL, path)) == 0 ) {
-        rc = TableReaderRefSeq_MakeTable(cself, vmgr, tbl, options, cache);
-        VTableRelease(tbl);
-    }
-    if( rc == 0 ) {
-        /* ALIGN_DBG("table %s opened 0x%p", path, *cself); */
-    } else {
-        ALIGN_DBGERRP("table for %s", rc, path);
-    }
-    return rc;
-}
-
-LIB_EXPORT void CC TableReaderRefSeq_Whack(const TableReaderRefSeq* cself)
-{
-    if( cself != NULL ) {
-        /* ALIGN_DBG("table 0x%p closed", cself); */
-        TableReader_Whack(cself->base);
-        free((TableReaderRefSeq*)cself);
-    }
-}
-
-LIB_EXPORT rc_t CC TableReaderRefSeq_SeqId(const TableReaderRefSeq* cself, const char** id, uint32_t* id_sz)
-{
-    rc_t rc = 0;
-    if( cself == NULL || id == NULL || id_sz == NULL ) {
-        rc = RC(rcAlign, rcType, rcReading, rcParam, rcNull);
-    } else {
-        *id = cself->seq_id;
-        *id_sz = string_size(cself->seq_id);
-    }
-    ALIGN_DBGERR(rc);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC TableReaderRefSeq_SeqLength(const TableReaderRefSeq* cself, INSDC_coord_len* len)
-{
-    rc_t rc = 0;
-    if( cself == NULL || len == NULL ) {
-        rc = RC(rcAlign, rcType, rcReading, rcParam, rcNull);
-    } else {
-        *len = cself->total_seq_len;
-    }
-    ALIGN_DBGERR(rc);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC TableReaderRefSeq_Circular(const TableReaderRefSeq* cself, bool* circular)
-{
-    rc_t rc = 0;
-    if( cself == NULL || circular == NULL ) {
-        rc = RC(rcAlign, rcType, rcReading, rcParam, rcNull);
-    } else {
-        *circular = cself->circular;
-    }
-    ALIGN_DBGERR(rc);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC TableReaderRefSeq_MD5(const TableReaderRefSeq* cself, const uint8_t** md5)
-{
-    rc_t rc = 0;
-    if( cself == NULL || md5 == NULL ) {
-        rc = RC(rcAlign, rcType, rcReading, rcParam, rcNull);
-    } else {
-        *md5 = cself->has_md5 ? cself->md5 : NULL;
-    }
-    ALIGN_DBGERR(rc);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC TableReaderRefSeq_Read(const TableReaderRefSeq* cself, INSDC_coord_zero offset, INSDC_coord_len len,
-                                          uint8_t* buffer, INSDC_coord_len* written)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL || buffer == NULL || written == NULL ) {
-        rc = RC(rcAlign, rcType, rcReading, rcParam, rcNull);
-    } else if( len == 0 ) {
-        *written = 0;
-    } else if( (rc = ReferenceSeq_ReOffset(cself->circular, cself->total_seq_len, &offset)) == 0 ) {
-        INSDC_coord_len q = 0;
-        *written = 0;
-        do {
-            int64_t rowid = offset / cself->max_seq_len + 1;
-            INSDC_coord_zero s = offset % cself->max_seq_len;
-            if( (rc = TableReader_ReadRow(cself->base, rowid)) == 0 ) {
-                q = cself->seq_len->base.coord_len[0] - s;
-                if( q > len ) {
-                    q = len;
-                }
-                memcpy(&buffer[*written], cself->read->base.str + s, q);
-                *written += q;
-                offset += q;
-                len -= q;
-            }
-            /* SEQ_LEN < MAX_SEQ_LEN is last row unless it is CIRCULAR */
-            if( cself->seq_len->base.coord_len[0] < cself->max_seq_len ) {
-                if( !cself->circular ) {
-                    break;
-                }
-                offset = 0;
-            }
-        } while(rc == 0 && q > 0 && len > 0 );
-    }
-    ALIGN_DBGERR(rc);
-    return rc;
-}
diff --git a/libs/align/ref_iterator.c b/libs/align/ref_iterator.c
deleted file mode 100644
index 32e4e5c..0000000
--- a/libs/align/ref_iterator.c
+++ /dev/null
@@ -1,866 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <align/extern.h>
-
-#include <klib/rc.h>
-#include <klib/container.h>
-#include <klib/refcount.h>
-#include <klib/sort.h>
-#include <klib/text.h>
-#include <klib/out.h>
-#include <insdc/insdc.h>
-#include <align/reference.h>
-#include <align/iterator.h>
-#include <align/manager.h>
-#include <sysalloc.h>
-
-#include "debug.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-#define COL_READ "(INSDC:4na:bin)READ"
-#define COL_HAS_MISMATCH "(bool)HAS_MISMATCH"
-#define COL_HAS_REF_OFFSET "(bool)HAS_REF_OFFSET"
-#define COL_REF_OFFSET "(I32)REF_OFFSET"
-#define COL_READ_GROUP "(ascii)SEQ_SPOT_GROUP"
-
-
-typedef struct spot_group
-{
-    DLNode n;                       /* to have it in a DLList */
-    char * name;                    /* the name of the read-group, can be NULL */
-    size_t len;                     /* the length of the name */
-    DLList records;                 /* has list of PlacementRecords... */
-} spot_group;
-
-
-static rc_t make_spot_group( spot_group ** sg, DLList * list, const char * name, size_t len )
-{
-    rc_t rc = 0;
-    *sg = calloc( 1, sizeof ** sg );
-    if ( *sg == NULL )
-        rc = RC( rcAlign, rcIterator, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        if ( len > 0 && name != NULL )
-        {
-            (*sg)->name = string_dup( name, len );
-            if ( (*sg)->name != NULL )
-            {
-                (*sg)->len = len;
-            }
-        }
-        /* if name is NULL, the spot-group is initialized with 0 via calloc() */
-        DLListInit( &( (*sg)->records ) );
-        DLListPushTail ( list, ( DLNode * )(*sg) );
-    }
-    return rc;
-}
-
-
-static void CC whack_the_placement_record( DLNode *n, void *data )
-{    PlacementRecordWhack ( ( PlacementRecord * )n );   }
-
-static void free_spot_group( spot_group *sg )
-{
-    if ( sg->name != NULL ) free( sg->name );
-    DLListWhack ( &sg->records, whack_the_placement_record, NULL );
-    free( sg );
-}
-
-
-static void CC whack_the_spot_group( DLNode *n, void *data )
-{    free_spot_group ( ( spot_group * )n );   }
-
-static void clear_spot_group_list( DLList * list )
-{
-    DLListWhack ( list, whack_the_spot_group, NULL );
-}
-
-
-typedef struct find_spot_group_cb_ctx
-{
-    const char * name;
-    size_t len;
-    spot_group *res;
-} find_spot_group_cb_ctx;
-
-
-static bool CC find_spot_group_callback( DLNode *n, void *data )
-{
-    find_spot_group_cb_ctx *ctx = ( find_spot_group_cb_ctx * )data;
-    spot_group * sg = ( spot_group * ) n;
-    bool res = false;
-
-    if ( ctx->name == NULL || sg->name == NULL )
-    {
-        res = true;
-    }
-    else
-    {
-        res = ( string_cmp ( sg->name, sg->len, 
-                             ctx->name, ctx->len, 
-                             ( sg->len < ctx->len ) ? ctx->len : sg->len ) == 0 );
-    }
-
-    if ( res )
-    {
-        ctx->res = sg;
-    }
-    return res;
-}
-
-static spot_group * find_spot_group( DLList * list, const char * name, size_t len )
-{
-    find_spot_group_cb_ctx ctx;
-    ctx.res = NULL;
-    ctx.name = name;
-    ctx.len = len;
-    DLListDoUntil ( list, false, find_spot_group_callback, &ctx );
-    return ctx.res;
-}
-
-static rc_t add_to_spot_groups( DLList * list, const PlacementRecord *rec )
-{
-    rc_t rc = 0;
-    spot_group * sg = find_spot_group( list, rec->spot_group, rec->spot_group_len );
-    if ( sg == NULL )
-    {
-        rc = make_spot_group( &sg, list, rec->spot_group, rec->spot_group_len );
-    }
-    if ( rc == 0 )
-    {
-        DLListPushTail ( &sg->records, ( DLNode * )(rec) );
-    }
-    return rc;
-}
-
-
-static uint32_t remove_invalid_records( const struct ReferenceObj * const refobj,
-                                        DLList * list, INSDC_coord_zero pos )
-{
-    uint32_t res = 0;
-    spot_group * sg = ( spot_group * )DLListHead( list );
-    while ( sg != NULL )
-    {
-        spot_group *nxt = ( spot_group * )DLNodeNext( ( DLNode * )sg );
-        PlacementRecord *rec = ( PlacementRecord * )DLListHead( &sg->records );
-        while ( rec != NULL )
-        {
-            PlacementRecord *nxt_rec = ( PlacementRecord * )DLNodeNext( ( DLNode * )rec );
-            INSDC_coord_zero end_pos = ( rec->pos + rec->len );
-            bool remove = ( end_pos <= pos );
-            if ( !remove )
-            {
-                AlignmentIterator * al_iter = PlacementRecordCast ( rec, placementRecordExtension0 );
-                int32_t state = AlignmentIteratorState ( al_iter, NULL );
-                remove = ( ( state & align_iter_invalid ) == align_iter_invalid );
-            }
-            if ( remove )
-            {
-                DLListUnlink ( &sg->records, ( DLNode * )rec );
-                PlacementRecordWhack ( rec );
-            }
-            else
-            {
-                res++;
-            }
-            rec = nxt_rec;
-        }
-        sg = nxt;
-    }
-    return res;
-}
-
-
-static void inc_alignment_iterators( DLList * list, INSDC_coord_zero pos )
-{
-    spot_group * sg = ( spot_group * )DLListHead( list );
-    while ( sg != NULL )
-    {
-        spot_group *nxt = ( spot_group * )DLNodeNext( ( DLNode * )sg );
-        PlacementRecord *rec = ( PlacementRecord * )DLListHead( &sg->records );
-        while ( rec != NULL )
-        {
-            PlacementRecord *nxt_rec = ( PlacementRecord * )DLNodeNext( ( DLNode * )rec );
-            AlignmentIterator * al_iter = PlacementRecordCast ( rec, placementRecordExtension0 );
-            if ( rec->pos <= pos && al_iter != NULL )
-            {
-                AlignmentIteratorNext ( al_iter );
-            }
-            rec = nxt_rec;
-        }
-        sg = nxt;
-    }
-}
-
-/* ======================================================================================== */
-
-
-struct ReferenceIterator
-{
-    KRefcount refcount;
-    struct AlignMgr const *amgr;
-
-    DLList spot_groups;                     /* has a list of spot-groups... */
-
-    int32_t min_mapq;                       /* has a minimum mapq-value... */
-    PlacementRecordExtendFuncs ext_func;    /* has a struct with record-extension-functions from client*/
-    PlacementRecordExtendFuncs int_func;    /* has a struct with record-extension-functions for itself*/
-
-    uint32_t depth;                         /* how many records are in the list */
-    INSDC_coord_zero current_pos;           /* what is the current ref-position on the current ref. */
-    INSDC_coord_zero last_pos;              /* what is the current ref-position on the current ref. */
-    INSDC_coord_zero nxt_avail_pos;         /* what is the next available ref-position on the current ref. */
-    spot_group *current_spot_group;         /* what is the next spot-group to be handled */
-    PlacementRecord *current_rec;           /* the current-record at the current position */
-    bool need_init;                         /* do we need to init for the first next()-call */
-    PlacementSetIterator * pl_set_iter;     /* holds a list of placement-iterators */
-    struct ReferenceObj const * refobj;     /* cached result of ReferenceIteratorNextReference(...) */
-};
-
-
-LIB_EXPORT void CC RefIterRecordDestroy ( void *obj, void *data )
-{
-    /* nothing to do, because there are no sub-allocations etc. ... */
-}
-
-
-LIB_EXPORT rc_t CC RefIterRecordSize ( struct VCursor const *curs,
-    int64_t row_id, size_t * size, void *data, void * placement_ctx )
-{
-    /* discover the size of the ref-iter-part to be allocated... */
-    return AlignIteratorRecordSize ( curs, row_id, size, data );
-}
-
-
-LIB_EXPORT rc_t CC RefIterRecordPopulate ( void *obj,
-    const PlacementRecord *placement, struct VCursor const *curs,
-    INSDC_coord_zero ref_window_start, INSDC_coord_len ref_window_len, void *data, void * placement_ctx )
-{
-    return AlignIteratorRecordPopulate ( obj, placement, curs, ref_window_start, ref_window_len, data );
-}
-
-
-static void CC RefIterDestroyRecPart( void *obj, void *data )
-{
-    AlignmentIterator *iter = ( AlignmentIterator * )obj;
-    if ( iter != NULL )
-        AlignmentIteratorRelease( iter );
-}
-
-LIB_EXPORT rc_t CC AlignMgrMakeReferenceIterator ( struct AlignMgr const *self,
-    ReferenceIterator **iter, const PlacementRecordExtendFuncs *ext_1, int32_t min_mapq )
-{
-    rc_t rc = 0;
-    if ( self == NULL )
-        rc = RC( rcAlign, rcIterator, rcConstructing, rcSelf, rcNull );
-    else
-    {
-        if ( iter == NULL  )
-            rc = RC( rcAlign, rcIterator, rcConstructing, rcParam, rcNull );
-        else
-        {
-            ReferenceIterator * refi = calloc( sizeof * refi, 1 );
-            if ( refi == NULL )
-                rc = RC( rcAlign, rcIterator, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                KRefcountInit( &refi->refcount, 1, "ReferenceIterator", "Make", "align" );
-                refi->min_mapq = min_mapq;
-                if ( ext_1 != NULL )
-                {
-                    refi->ext_func.data = ext_1->data;
-                    refi->ext_func.destroy = ext_1->destroy;
-                    refi->ext_func.populate = ext_1->populate;
-                    refi->ext_func.alloc_size = ext_1->alloc_size;
-                    refi->ext_func.fixed_size = ext_1->fixed_size;
-                }
-
-                refi->int_func.data = ( void * )self;
-                refi->int_func.destroy = RefIterDestroyRecPart;
-                refi->int_func.populate = RefIterRecordPopulate;
-                refi->int_func.alloc_size = RefIterRecordSize; 
-
-                DLListInit( &(refi->spot_groups) );
-                rc = AlignMgrMakePlacementSetIterator ( self, &refi->pl_set_iter );
-                refi->need_init = true;
-            }
-
-            if ( rc == 0 )
-                rc = AlignMgrAddRef ( self );
-
-            if ( rc == 0 )
-            {
-                refi->amgr = self;
-                *iter = refi;
-            }
-            else
-                free( refi );
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC ReferenceIteratorAddRef ( const ReferenceIterator *self )
-{
-    rc_t rc = 0;
-    if ( self == NULL )
-        rc = RC( rcAlign, rcIterator, rcAttaching, rcSelf, rcNull );
-    else
-    {
-        if ( KRefcountAdd( &self->refcount, "ReferenceIterator" ) != krefOkay )
-        {
-            rc = RC( rcAlign, rcIterator, rcAttaching, rcError, rcUnexpected );
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC ReferenceIteratorRelease ( const ReferenceIterator *cself )
-{
-    rc_t rc = 0;
-    if ( cself == NULL )
-        rc = RC( rcAlign, rcIterator, rcReleasing, rcSelf, rcNull );
-    else
-    {
-        if ( KRefcountDrop( &cself->refcount, "ReferenceIterator" ) == krefWhack )
-        {
-            ReferenceIterator * self = ( ReferenceIterator * ) cself;
-            /* we 'own' the records! - we have to destroy them, if some are left in here */
-            clear_spot_group_list( &self->spot_groups );
-            rc = PlacementSetIteratorRelease ( self->pl_set_iter );
-            AlignMgrRelease ( self->amgr );
-            free( self );
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC ReferenceIteratorAddPlacementIterator( ReferenceIterator *self,
-    PlacementIterator *pi )
-{
-    rc_t rc = 0;
-    if ( self == NULL )
-        rc = RC( rcAlign, rcIterator, rcConstructing, rcSelf, rcNull );
-    else
-    {
-        if ( pi == NULL )
-            rc = RC( rcAlign, rcIterator, rcConstructing, rcParam, rcNull );
-        else
-        {
-            rc = PlacementSetIteratorAddPlacementIterator ( self->pl_set_iter, pi );
-        }
-    }
-    return rc;
-}
-
-
-#define ALIGN_COL_COUNT 4
-
-static const char * align_cols[ ALIGN_COL_COUNT ] = 
-{ COL_REF_OFFSET, COL_HAS_REF_OFFSET, COL_HAS_MISMATCH, COL_READ };
-
-
-static rc_t prepare_align_cursor( struct VCursor const *align )
-{
-    rc_t rc = 0;
-    uint32_t i, throw_away_idx;
-
-    for ( i = 0; i < ALIGN_COL_COUNT && rc == 0; ++i ) {
-        rc =VCursorAddColumn ( align, &throw_away_idx, "%s", align_cols[ i ] );
-        if( GetRCState(rc) == rcExists ) {
-            rc = 0;
-        }
-    }
-        
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC ReferenceIteratorAddPlacements( ReferenceIterator *self,
-     struct ReferenceObj const *ref_obj, INSDC_coord_zero ref_pos, INSDC_coord_len ref_len,
-     struct VCursor const *ref, struct VCursor const *align, align_id_src ids,
-     const char * spot_group, void * placement_ctx )
-{
-    rc_t rc = 0;
-    if ( self == NULL )
-        rc = RC( rcAlign, rcIterator, rcConstructing, rcSelf, rcNull );
-    else
-    {
-        if ( ref_obj == NULL )
-            rc = RC( rcAlign, rcIterator, rcConstructing, rcParam, rcNull );
-        else
-        {
-            if ( align != NULL )
-                rc = prepare_align_cursor( align );
-
-            if ( rc == 0 )
-            {
-                PlacementIterator *pi;
-
-                rc = ReferenceObj_MakePlacementIterator ( ref_obj, &pi, ref_pos, ref_len, self->min_mapq,
-                        ref, align, ids, &self->int_func, &self->ext_func, spot_group, placement_ctx );
-                if ( rc == 0 )
-                {
-                    rc = PlacementSetIteratorAddPlacementIterator ( self->pl_set_iter, pi );
-                    if ( GetRCState( rc ) == rcDone ) { rc = 0; }
-                }
-            }
-            /* if rc != 0 then ref_obj had NO AddRef inside  ReferenceObj_MakePlacementIterator() ! */
-            if ( rc == 0 )
-                ReferenceObj_Release( ref_obj );
-        }
-    }
-    return rc;
-}
-
-
-static rc_t fill_recordlist( ReferenceIterator *self, INSDC_coord_zero pos )
-{
-    rc_t rc;
-    do
-    {
-        const PlacementRecord *rec;
-        /* from the placement-set-iterator into our list... */
-        rc = PlacementSetIteratorNextRecordAt ( self->pl_set_iter, pos, &rec );
-        if ( rc == 0 )
-        {
-            if ( rec->pos == pos )
-            {
-                self->depth++;
-                rc = add_to_spot_groups( &self->spot_groups, rec );
-            }
-            else
-                PlacementRecordWhack ( rec );
-        }
-    } while( rc == 0 );
-
-    if ( GetRCState( rc ) == rcDone ) { rc = 0; }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC ReferenceIteratorNextReference ( ReferenceIterator *self,
-    INSDC_coord_zero *first_pos, INSDC_coord_len *len, struct ReferenceObj const ** refobj )
-{
-    rc_t rc = 0;
-
-    if ( refobj != NULL )
-        *refobj = NULL;
-
-    if ( self == NULL )
-        rc = RC( rcAlign, rcIterator, rcAccessing, rcSelf, rcNull );
-    else
-    {
-        struct ReferenceObj const * robj;
-        rc = PlacementSetIteratorNextReference ( self->pl_set_iter, first_pos, len, &robj );
-        clear_spot_group_list( &self->spot_groups );
-        if ( rc == 0 )
-        {
-            /* cache the returned refobj in order to get to reference-bases later... */
-            self->refobj = robj;
-            self->need_init = true;
-        }
-        else
-        {
-            self->refobj = NULL;
-        }
-
-        if ( refobj != NULL )
-        {
-            *refobj = self->refobj;
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC ReferenceIteratorNextWindow ( ReferenceIterator *self,
-    INSDC_coord_zero *first_pos, INSDC_coord_len *len )
-{
-    rc_t rc = 0;
-    if ( self == NULL )
-        rc = RC( rcAlign, rcIterator, rcAccessing, rcSelf, rcNull );
-    else
-    {
-        rc = PlacementSetIteratorNextWindow ( self->pl_set_iter, first_pos, len );
-        clear_spot_group_list( &self->spot_groups );
-        if ( rc == 0 )
-        {
-            self->need_init = true;
-            self->current_pos = *first_pos;
-            self->current_spot_group = NULL;
-            self->last_pos = self->current_pos + *len - 1;
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC ReferenceIteratorNextSpotGroup ( ReferenceIterator *self,
-    const char ** name, size_t * len )
-{
-    rc_t rc = 0;
-
-    if ( self->current_spot_group == NULL )
-    {
-        self->current_spot_group = ( spot_group * )DLListHead( &self->spot_groups );
-        if ( self->current_spot_group == NULL )
-        {
-            rc = SILENT_RC( rcAlign, rcIterator, rcAccessing, rcOffset, rcDone );
-        }
-    }
-    else
-    {
-        spot_group *nxt  = ( spot_group * )DLNodeNext( ( DLNode * ) self->current_spot_group );
-        if ( nxt == NULL )
-        {
-            rc = SILENT_RC( rcAlign, rcIterator, rcAccessing, rcOffset, rcDone );
-        }
-        else
-        {
-            self->current_spot_group = nxt;
-        }
-    }
-    self->current_rec = NULL;
-
-    if ( rc == 0 && self->current_spot_group != NULL )
-    {
-        if ( name != NULL )
-        {
-            *name = self->current_spot_group->name;
-        }
-        if ( len != NULL )
-        {
-            *len = self->current_spot_group->len;
-        }
-    }
-    return rc;
-}
-
-
-/* iterates the PlacementSetIterator forward to reach self->current_pos on the reference */
-static rc_t first_ref_iter_nxt_pos( ReferenceIterator *self, bool skip_empty )
-{
-    rc_t rc;
-    bool loop;
-    self->need_init = false;
-    do
-    {
-        rc = PlacementSetIteratorNextAvailPos ( self->pl_set_iter, &self->nxt_avail_pos, NULL );
-        loop = ( rc == 0 );
-        if ( loop )
-        {
-            loop = ( self->nxt_avail_pos <= self->current_pos );
-            if ( loop )
-            {
-                rc = fill_recordlist( self, self->nxt_avail_pos );
-                self->depth = remove_invalid_records( self->refobj, &self->spot_groups, self->nxt_avail_pos - 1 );
-            }
-        }
-    } while ( loop );
-
-    if ( skip_empty && self->nxt_avail_pos > self->current_pos && self->depth == 0 )
-    {
-        self->current_pos = self->nxt_avail_pos;
-    }
-    self->depth = remove_invalid_records( self->refobj, &self->spot_groups, self->current_pos );
-
-    if ( GetRCState( rc ) == rcDone ) rc = 0;
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC ReferenceIteratorNextPos ( ReferenceIterator *self, bool skip_empty )
-{
-    rc_t rc = 0;
-    if ( self == NULL )
-        rc = RC( rcAlign, rcIterator, rcAccessing, rcSelf, rcNull );
-    else
-    {
-        self->current_rec = NULL;
-        if ( self->need_init )
-        {
-            rc = first_ref_iter_nxt_pos( self, skip_empty );
-        }
-        else
-        {
-            /* increment the current position */
-            self->current_pos++;
-
-            if ( self->current_pos <= self->last_pos )
-            {
-                /* jump over gaps, if requested ... */
-                if ( self->depth == 0 && skip_empty )
-                {
-                    self->current_pos = self->nxt_avail_pos;
-                }
-
-                /* increment the internal alignment-iterator of every placement-record */
-                inc_alignment_iterators( &self->spot_groups, self->current_pos );
-
-                /* loop through the list to look if we have to remove records,
-                   that do end before this new position */
-                self->depth = remove_invalid_records( self->refobj, &self->spot_groups, self->current_pos );
-
-                rc = fill_recordlist( self, self->current_pos );
-                if ( rc == 0 )
-                {
-                    self->current_spot_group = NULL;
-                    /* set our sights to the next position... */
-                    rc = PlacementSetIteratorNextAvailPos ( self->pl_set_iter, &self->nxt_avail_pos, NULL );
-                    if ( GetRCState( rc ) == rcDone )
-                    {
-                        if ( self->depth > 0 )
-                        {
-                            rc = 0;
-                        }
-                        else if ( !skip_empty )
-                        {
-                            if ( self->current_pos <= self->last_pos ) rc = 0;
-                        }
-                    }
-                }
-            }
-            else
-            {
-                rc = SILENT_RC( rcAlign, rcIterator, rcAccessing, rcOffset, rcDone );
-                clear_spot_group_list( &self->spot_groups );
-            }
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC ReferenceIteratorPosition ( const ReferenceIterator *self,
-    INSDC_coord_zero *pos, uint32_t * depth, INSDC_4na_bin * base )
-{
-    rc_t rc = 0;
-    if ( self == NULL )
-        rc = RC( rcAlign, rcIterator, rcAccessing, rcSelf, rcNull );
-    else
-    {
-        /* return position, many records our record-list, and the base at this position */
-        if ( pos != NULL )
-        {
-            *pos = self->current_pos;
-        }
-
-        if ( depth != NULL )
-        {
-            *depth = self->depth;
-        }
-
-        if ( base != NULL )
-        {
-            uint32_t written;
-            *base = 0;
-            /* problem! how to get the base if depth == 0 */
-            if ( self->current_rec != NULL )
-            {
-                rc = ReferenceObj_Read( self->current_rec->ref, self->current_pos, 1, base, &written );
-            }
-            else if ( self->refobj != NULL )
-            {
-                rc = ReferenceObj_Read( self->refobj, self->current_pos, 1, base, &written );
-            }
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC ReferenceIteratorNextPlacement ( ReferenceIterator *self,
-    const PlacementRecord **rec )
-{
-    rc_t rc = 0;
-    if ( self == NULL )
-    {
-        rc = RC( rcAlign, rcIterator, rcAccessing, rcSelf, rcNull );
-    }
-    else if ( rec == NULL )
-    {
-        rc = RC( rcAlign, rcIterator, rcAccessing, rcParam, rcNull );
-    }
-    else
-    {
-        if ( self->current_spot_group == NULL )
-        {
-            rc = SILENT_RC( rcAlign, rcIterator, rcAccessing, rcOffset, rcDone );
-        }
-        else
-        {
-            if ( self->current_rec == NULL )
-            {
-                self->current_rec = ( PlacementRecord * )DLListHead( &self->current_spot_group->records );
-            }
-            else
-            {
-                self->current_rec = ( PlacementRecord * )DLNodeNext( ( DLNode * )self->current_rec );
-            }
-
-            if ( self->current_rec == NULL )
-            {
-                rc = SILENT_RC( rcAlign, rcIterator, rcAccessing, rcOffset, rcDone );
-            }
-            else
-            {
-                *rec = self->current_rec;
-            }
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC ReferenceIteratorGetPlacement ( ReferenceIterator *self,
-    const PlacementRecord **rec )
-{
-    rc_t rc = 0;
-    if ( self == NULL )
-    {
-        rc = RC( rcAlign, rcIterator, rcAccessing, rcSelf, rcNull );
-    }
-    else if ( rec == NULL )
-    {
-        rc = RC( rcAlign, rcIterator, rcAccessing, rcParam, rcNull );
-    }
-    else
-    {
-        if ( self->current_spot_group == NULL )
-        {
-            rc = SILENT_RC( rcAlign, rcIterator, rcAccessing, rcOffset, rcDone );
-        }
-        else
-        {
-            if ( self->current_rec != NULL )
-            {
-                /* remove the 'previous' current-rec! */
-                DLListPopHead ( &self->current_spot_group->records );
-                PlacementRecordWhack ( self->current_rec );
-                self->depth--;
-                self->current_rec = NULL;
-            }
-
-            self->current_rec = ( PlacementRecord * )DLListHead( &self->current_spot_group->records );
-            if ( self->current_rec == NULL )
-            {
-                rc = SILENT_RC( rcAlign, rcIterator, rcAccessing, rcOffset, rcDone );
-            }
-            else
-            {
-                *rec = self->current_rec;
-            }
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT int32_t CC ReferenceIteratorState ( const ReferenceIterator *self,
-    INSDC_coord_zero *seq_pos )
-{
-    int32_t res = align_iter_invalid;
-    if ( seq_pos != NULL )
-    {
-        *seq_pos = 0;
-    }
-    if ( self != NULL )
-    {
-        /* PlacementRecordCast returns NULL if self->current_rec is NULL */
-        AlignmentIterator * al_iter = PlacementRecordCast ( self->current_rec, placementRecordExtension0 );
-        if ( al_iter != NULL )
-            res = AlignmentIteratorState ( al_iter, seq_pos );
-    }
-    return res;
-}
-
-
-LIB_EXPORT uint32_t CC ReferenceIteratorBasesInserted ( const ReferenceIterator *self,
-    const INSDC_4na_bin **bases )
-{
-    uint32_t res = align_iter_invalid;
-    if ( bases != NULL )
-    {
-        *bases = NULL;
-    }
-    if ( self != NULL )
-    {
-        /* PlacementRecordCast returns NULL if self->current_rec is NULL */
-        AlignmentIterator * al_iter = PlacementRecordCast ( self->current_rec, placementRecordExtension0 );
-        if ( al_iter != NULL )
-            res = AlignmentIteratorBasesInserted( al_iter, bases );
-    }
-    return res;
-}
-
-
-LIB_EXPORT uint32_t CC ReferenceIteratorBasesDeleted ( const ReferenceIterator *self,
-    INSDC_coord_zero *pos, const INSDC_4na_bin **bases )
-{
-    uint32_t res = align_iter_invalid;
-    if ( bases != NULL )
-    {
-        *bases = NULL;
-    }
-    if ( self != NULL )
-    {
-        /* PlacementRecordCast returns NULL if self->current_rec is NULL */
-        AlignmentIterator * al_iter = PlacementRecordCast ( self->current_rec, placementRecordExtension0 );
-        if ( al_iter != NULL )
-        {
-            INSDC_coord_zero temp_pos;
-            res = AlignmentIteratorBasesDeleted( al_iter, &temp_pos );
-            if ( ( res & align_iter_invalid ) != align_iter_invalid )
-            {
-                if ( pos != NULL ) { *pos = temp_pos; }
-                /* where to get the reference-bases from ? PlacementRecord.ref ! */
-                if ( res > 0 && bases != NULL )
-                {
-                    uint8_t * buffer = malloc( res );
-                    if ( buffer != NULL )
-                    {
-                        INSDC_coord_len written;
-                        rc_t rc = ReferenceObj_Read( self->current_rec->ref, temp_pos, res, buffer, &written );
-                        if ( rc == 0 )
-                        {
-                            *bases = buffer;
-                        }
-                    }
-                }
-            }
-        }
-    }
-    return res;
-}
diff --git a/libs/align/reference-cmn.c b/libs/align/reference-cmn.c
deleted file mode 100644
index 59e7c3d..0000000
--- a/libs/align/reference-cmn.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*==============================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*/
-#include <align/extern.h>
-
-#include <klib/rc.h>
-#include <insdc/insdc.h>
-
-#include "reference-cmn.h"
-#include <sysalloc.h>
-
-rc_t CC ReferenceSeq_ReOffset(bool circular, INSDC_coord_len seq_len, INSDC_coord_zero* offset)
-{
-    if( !circular && (*offset < 0 || *offset >= seq_len) ) {
-        return RC(rcAlign, rcType, rcReading, rcOffset, rcOutofrange);
-    } else if( *offset < 0 ) {
-        *offset = seq_len - ((-(*offset)) % seq_len);
-    } else if( circular && *offset > seq_len ) {
-        *offset %= seq_len;
-    }
-    return 0;
-}
diff --git a/libs/align/reference-cmn.h b/libs/align/reference-cmn.h
deleted file mode 100644
index 76fac49..0000000
--- a/libs/align/reference-cmn.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was readten as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#ifndef _h_align_reference_cmn_
-#define _h_align_reference_cmn_
-
-#include <klib/defs.h>
-
-/* Validates and adjusts offset for a RefSeq based on its attributes
- * circular [IN]
- * seq_len [IN]
- * offset [IN,OUT] always be >= 0 upon return
- */
-rc_t CC ReferenceSeq_ReOffset(bool circular, INSDC_coord_len seq_len, INSDC_coord_zero* offset);
-
-#endif /* _h_align_reference_cmn_ */
diff --git a/libs/align/reference.c b/libs/align/reference.c
deleted file mode 100644
index 8f9835d..0000000
--- a/libs/align/reference.c
+++ /dev/null
@@ -1,1947 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was readten as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <align/extern.h>
-
-#include <klib/rc.h>
-#include <klib/container.h>
-#include <klib/refcount.h>
-#include <klib/vector.h>
-#include <klib/out.h>
-#include <klib/text.h>
-#include <insdc/insdc.h>
-#include <vdb/manager.h>
-#include <vdb/database.h>
-#include <vdb/cursor.h>
-#include <vdb/table.h>
-#include <vdb/vdb-priv.h>
-#include <align/iterator.h>
-#include <align/reference.h>
-#include <align/refseq-mgr.h>
-#include <os-native.h>
-#include <sysalloc.h>
-
-#include "reader-cmn.h"
-#include "reference-cmn.h"
-#include "debug.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <ctype.h>
-#include <assert.h>
-
-/* This is a temporary define, used to test code to deal with
-   circular references and new means of tracking window end */
-
-enum EReferenceList_ColNames
-{
-    ereflst_cn_READ_dna,
-    ereflst_cn_READ_4na,
-    ereflst_cn_SEQ_LEN,
-    ereflst_cn_PRIMARY_ALIGNMENT_IDS,
-    ereflst_cn_SECONDARY_ALIGNMENT_IDS,
-    ereflst_cn_EVIDENCE_INTERVAL_IDS,
-    ereflst_cn_OVERLAP_REF_POS,
-    ereflst_cn_OVERLAP_REF_LEN
-};
-
-const TableReaderColumn ReferenceList_cols[] =
-{
-    { 0, "(INSDC:dna:text)READ",    { NULL }, 0, 0 },
-    { 0, "(INSDC:4na:bin)READ",     { NULL }, 0, ercol_Skip },
-    { 0, "SEQ_LEN",                 { NULL }, 0, 0 },
-    { 0, "PRIMARY_ALIGNMENT_IDS",   { NULL }, 0, ercol_Skip },
-    { 0, "SECONDARY_ALIGNMENT_IDS", { NULL }, 0, ercol_Skip | ercol_Optional },
-    { 0, "EVIDENCE_INTERVAL_IDS",   { NULL }, 0, ercol_Skip | ercol_Optional },
-    { 0, "OVERLAP_REF_POS",         { NULL }, 0, ercol_Optional },
-    { 0, "OVERLAP_REF_LEN",         { NULL }, 0, ercol_Optional },
-    { 0, NULL,                      { NULL }, 0, 0 }
-};
-
-enum EPlacementIterator_ColNames
-{
-    eplacementiter_cn_REF_POS,
-    eplacementiter_cn_REF_LEN,
-    eplacementiter_cn_MAPQ,
-    eplacementiter_cn_READ_GROUP
-};
-
-const TableReaderColumn PlacementIterator_cols[] =
-{
-    { 0, "REF_POS",     { NULL }, 0, 0 },
-    { 0, "REF_LEN",     { NULL }, 0, 0 },
-    { 0, "MAPQ",        { NULL }, 0, 0 },
-    { 0, "SPOT_GROUP",  { NULL }, 0, 0 },
-    { 0, NULL,          { NULL }, 0, 0 }
-};
-
-struct ReferenceList
-{
-    KRefcount refcount;
-    const RefSeqMgr* refseqmgr;
-    const VCursor* cursor;
-    BSTree name_tree;
-    BSTree seqid_tree;
-    uint32_t options;
-    size_t cache;
-    uint32_t max_seq_len;
-    uint32_t nodes_qty;
-    uint32_t nodes_max_qty;
-    const TableReader* reader;
-    TableReaderColumn reader_cols[ sizeof( ReferenceList_cols ) / sizeof( ReferenceList_cols[ 0 ] ) ];
-    const TableReader* iter;
-    TableReaderColumn iter_cols[ sizeof( PlacementIterator_cols ) / sizeof( PlacementIterator_cols[ 0 ] ) ];
-    /* last are children using realloc!! */
-    ReferenceObj* nodes[ 2 ];
-};
-
-struct ReferenceObj
-{
-    /* we use this in 2 lists so we need to adjust results of Find, etc calls for name tree!! */
-    BSTNode by_seqid; /* primary key */
-    BSTNode by_name; /* struct addr will be by_name[-1]; */
-    ReferenceList* mgr;
-    uint32_t id;
-    uint32_t bin;
-    char* name;
-    char* seqid;
-    bool circular;
-    bool read_present;
-    int64_t start_rowid;
-    int64_t end_rowid;
-    INSDC_coord_len seq_len;
-};
-
-
-static int CC ReferenceObj_CmpSeqId( const void *item, const BSTNode *n )
-{
-    return strcasecmp( ( const char* )item, ( ( const ReferenceObj* )n )->seqid );
-}
-
-
-static int CC ReferenceObj_SortSeqId( const BSTNode *item, const BSTNode *n )
-{
-    return ReferenceObj_CmpSeqId( ( ( const ReferenceObj* )item )->seqid, n );
-}
-
-
-static int CC ReferenceObj_CmpName( const void *item, const BSTNode *n )
-{
-    return strcasecmp( ( const char* )item, ( ( const ReferenceObj* )&n[ -1 ] )->name );
-}
-
-
-static int CC ReferenceObj_SortName( const BSTNode *item, const BSTNode *n )
-{
-    return ReferenceObj_CmpName( ( ( const ReferenceObj* )&item[ -1 ] )->name, n );
-}
-
-static rc_t ReferenceObj_Alloc( ReferenceObj** self, const char* seqid, size_t seqid_sz,
-                                const char* name, size_t name_sz)
-{
-    rc_t rc = 0;
-    if ( self == NULL || seqid == NULL || seqid_sz == 0 || name == NULL || name_sz == 0 )
-    {
-        rc = RC( rcAlign, rcIndex, rcConstructing, rcParam, rcNull );
-    }
-    else
-    {
-        ReferenceObj* obj = calloc( 1,  sizeof( *obj ) + seqid_sz + 1 + name_sz + 1 );
-        if ( obj == NULL )
-        {
-            rc = RC( rcAlign, rcIndex, rcConstructing, rcMemory, rcExhausted );
-        }
-        else
-        {
-            obj->seqid = ( char* )&obj[ 1 ];
-            obj->name = obj->seqid;
-            obj->name += seqid_sz + 1;
-            memcpy( obj->seqid, seqid, seqid_sz );
-            obj->seqid[ seqid_sz ] = '\0';
-            memcpy( obj->name, name, name_sz );
-            obj->name[ name_sz ] = '\0';
-            *self = obj;
-        }
-    }
-    return rc;
-}
-
-
-/* helper function for ReferenceList_MakeCursor() */
-static rc_t ReferenceList_handle_filter( const KIndex* iname, const char * filt_name, uint32_t bin_size,
-                                         int64_t *start, int64_t tbl_start, uint64_t *count, int *bin_num,
-                                         TableReaderColumn *h, const TableReader* tmp )
-{
-    rc_t rc = 0;
-    if ( strncmp( filt_name, "START_ROW:", 10 ) )
-    {
-        if ( bin_size == 0 || strncmp( filt_name, "BIN_NUM:", 8 ) )
-        {
-            rc = KIndexFindText( iname, filt_name, start, count, NULL, NULL );
-            if( rc == 0 && bin_size > 0 )
-            {
-                /** change start to the beginning of the bin **/
-                *bin_num = ( *start - tbl_start ) / bin_size;
-            }
-        }
-        else
-        {
-            *bin_num = atoi( filt_name + 8 );
-        }
-        if ( bin_size > 0 )
-        {
-            *start = tbl_start + ( bin_size * (*bin_num) );
-            rc = TableReader_ReadRow( tmp, *start );
-            if ( rc == 0 )
-            {
-                int64_t r_start;
-                char name[ 4096 ];
-                if ( h[ 0 ].len < sizeof( name ) )
-                {
-                    memcpy( name, h[ 0 ].base.str, h[ 0 ].len );
-                    name[ h[ 0 ].len ] = '\0';
-                    rc = KIndexFindText( iname, name, &r_start, count, NULL, NULL );
-                    if ( rc == 0 && *start > r_start )
-                    { /*** move start to the beginning of the fully contained sequence **/
-                        *start = r_start + *count;
-                    }
-                }
-                else
-                {
-                    rc = RC( rcAlign, rcType, rcConstructing, rcName, rcTooLong );
-                }
-            }
-        }
-    }
-    else
-    {
-        int64_t req_start = atoi( filt_name + 10 );
-        if ( req_start >= *start && req_start < *start + *count )
-        {
-            int64_t delta = req_start - *start;
-            *start = req_start;
-            *count -= delta;
-        }
-        else
-        {
-            rc = RC( rcAlign, rcType, rcConstructing, rcId, rcOutofrange );
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC ReferenceList_MakeCursor( const ReferenceList** cself, const VCursor* cursor, uint32_t options,
-                                             const char* filt_name, const uint32_t numbins )
-{
-    rc_t rc = 0;
-    ReferenceList* self = NULL;
-
-    if ( cself == NULL || cursor == NULL )
-    {
-        rc = RC( rcAlign, rcType, rcConstructing, rcParam, rcNull );
-    }
-    else if ( ( self = calloc( 1, sizeof( *self ) ) ) == NULL )
-    {
-        rc = RC( rcAlign, rcType, rcConstructing, rcMemory, rcExhausted );
-    }
-    else
-    {
-        const TableReader* tmp = NULL;
-        uint32_t bin_size;
-        int bin_num = -1;
-        TableReaderColumn h[] =
-        {
-            { 0, "NAME",        {NULL}, 0, 0 }, /*0*/
-            { 0, "SEQ_ID",      {NULL}, 0, 0 }, /*1*/
-            { 0, "SEQ_LEN",     {NULL}, 0, 0 }, /*2*/
-            { 0, "CIRCULAR",    {NULL}, 0, 0 }, /*3*/
-            { 0, "MAX_SEQ_LEN", {NULL}, 0, 0 }, /*4*/
-            { 0, "SEQ_START",   {NULL}, 0, 0 }, /*5*/
-            { 0, "CMP_READ",    {NULL}, 0, 0 }, /*6*/
-            { 0, NULL,          {NULL}, 0, 0 }
-        };
-        KRefcountInit( &self->refcount, 1, "ReferenceList", "Make", "align" );
-        BSTreeInit( &self->name_tree );
-        BSTreeInit( &self->seqid_tree );
-        self->options = options;
-        self->nodes_max_qty = sizeof( self->nodes ) / sizeof( self->nodes[ 0 ] );
-
-        rc = VCursorAddRef( self->cursor = cursor );
-        if ( rc == 0 )
-        {
-            rc = TableReader_MakeCursor( &tmp, cursor, h );
-            if ( rc == 0 )
-            {
-                int64_t start, tbl_start, tbl_stop;
-                uint64_t count;
-                const KIndex* iname = NULL;
-                bool only_one = false;
-
-                /* index is optional */
-                rc_t rctmp = TableReader_OpenIndex( tmp, "i_name", &iname );
-                ALIGN_DBGERRP( "index '%s' was not found", rctmp, "i_name" );
-
-                rc = TableReader_IdRange( tmp, &start, &count );
-                assert( rc == 0 );
-                tbl_start = start;
-                tbl_stop  = start + count -1;
-                if ( numbins > 0 )
-                {
-                    bin_size = ( count + numbins -1 ) / numbins;
-                }
-                else
-                {
-                    bin_size = 0;
-                }
-
-                if ( iname && filt_name )
-                {
-                    if ( bin_size == 0 )
-                    {
-                        only_one = true;
-                    }
-                    rc = ReferenceList_handle_filter( iname, filt_name, bin_size, &start, tbl_start,
-                                                      &count, &bin_num, h, tmp );
-                }
-
-                if ( rc == 0 )
-                {
-                    ReferenceObj* node = NULL;
-                    uint32_t last_name_len = 0;
-                    bool read_determination_done = false;
-
-                    while ( rc == 0  && start <= tbl_stop )
-                    {
-                        if ( bin_num < 0 && count == 0 )
-                        {
-                            /*** normal loop without binning ***/
-                            break;
-                        }
-                        rc = TableReader_ReadRow( tmp, start );
-                        if ( rc == 0 )
-                        {
-                            if ( node == NULL || last_name_len != h[0].len ||
-                                 strncmp( h[ 0 ].base.str, node->name, h[ 0 ].len) != 0 )
-                            {
-                                uint32_t cur_bin = ( bin_size > 0 ) ? ( start-tbl_start ) / bin_size : 0;
-                                if ( only_one && self->nodes_qty == 1 )
-                                {
-                                    break;
-                                }
-                                if ( bin_num >= 0 && cur_bin != bin_num )
-                                {
-                                    break;
-                                }
-                                if ( node == NULL && h[ 4 ].len > 0 )
-                                {
-                                    self->max_seq_len = h[ 4 ].base.u32[ 0 ];
-                                }
-                                if ( self->nodes_qty == self->nodes_max_qty )
-                                {
-                                    ReferenceList* tmp = realloc( self, sizeof( *self ) + sizeof( node ) * self->nodes_max_qty );
-                                    if ( tmp == NULL )
-                                    {
-                                        rc = RC(rcAlign, rcType, rcConstructing, rcMemory, rcExhausted);
-                                    }
-                                    else
-                                    {
-                                        self = tmp;
-                                        self->nodes_max_qty += sizeof( self->nodes ) / sizeof( self->nodes[ 0 ] );
-                                    }
-                                }
-                                if ( rc == 0 )
-                                {
-                                    rc = ReferenceObj_Alloc( &node, h[ 1 ].base.str, h[ 1 ].len, h[ 0 ].base.str, h[ 0 ].len );
-                                    if ( rc == 0 )
-                                    {
-                                        node->id = self->nodes_qty;
-                                        self->nodes[ self->nodes_qty++ ] = node;
-                                        last_name_len = h[ 0 ].len;
-                                        node->circular = h[ 3 ].len ? h[ 3 ].base.buul[ 0 ] : false;
-                                        node->start_rowid = start;
-                                        node->seq_len = 0;
-                                        node->bin = cur_bin;
-                                        read_determination_done = false;
-                                        rc = BSTreeInsertUnique( &self->seqid_tree, &node->by_seqid, NULL, ReferenceObj_SortSeqId );
-                                        if ( rc == 0 )
-                                        {
-                                            rc = BSTreeInsertUnique( &self->name_tree, &node->by_name, NULL, ReferenceObj_SortName );
-                                        }
-                                    }
-                                }
-                            }
-                            if ( rc == 0 )
-                            {
-                                INSDC_coord_len cur_seq_len = h[ 2 ].base.coord_len[ 0 ];
-                                if ( cur_seq_len == 0 )
-                                {
-                                    /* assign it to max-seq-len */
-                                    cur_seq_len = h[ 4 ].base.coord_len[ 0 ];
-                                }
-
-                                if ( h[ 6 ].len > 0 )
-                                {/** CMP_READ > 0 -- truly local ***/
-                                    node->read_present = true; 
-                                    read_determination_done = true;
-                                }
-                                else if ( h[ 5 ].base.coord1[ 0 ] != 0 )
-                                { /*** truly remote ***/
-                                    node->read_present = false;
-                                    read_determination_done = true;
-                                } /*** else still not sure **/
-
-                                if ( read_determination_done && iname != NULL )
-                                {
-                                    /* scroll to last row for this reference projecting the seq_len */
-                                    int64_t r_start;
-                                    uint64_t r_count;
-                                    if ( KIndexFindText( iname, node->name, &r_start, &r_count, NULL, NULL ) == 0 )
-                                    {
-                                        assert( node->start_rowid == r_start );
-                                        /* not last ref row */
-                                        if ( start != r_start + r_count - 1 )
-                                        {
-                                            /* we need to pickup last row SEQ_LEN for this reference
-                                            so we step back 2 rows in table from this ref end row
-                                            and also skip rows already scanned for read presence */
-                                            r_count -= ( start - r_start ) + 2;
-                                            node->seq_len += cur_seq_len * r_count;
-                                            start += r_count;
-                                            count -= r_count;
-                                        }
-                                    }
-                                }
-                                node->seq_len += cur_seq_len;
-                                node->end_rowid = start;
-                            }
-                        }
-                        else if ( GetRCState( rc ) == rcNotFound && GetRCObject( rc ) == rcRow )
-                        {
-                            rc = 0;
-                        }
-                        start++;
-                        count--;
-                    }
-                    for ( start = 0; rc == 0 && start < self->nodes_qty; start++ )
-                    {
-                        self->nodes[ start ]->mgr = self;
-                    }
-                    if ( rc == 0 && self->max_seq_len == 0 )
-                    {
-                        rc = RC(rcAlign, rcType, rcConstructing, rcData, rcCorrupt);
-                    }
-                }
-                KIndexRelease( iname );
-            }
-        }
-        TableReader_Whack( tmp );
-    }
-
-    if ( rc == 0 )
-    {
-        *cself = self;
-        /* ALIGN_DBG("created 0x%p with cursor 0x%p", self, cursor); */
-    }
-    else
-    {
-        *cself = NULL;
-        ReferenceList_Release( self );
-        /* ALIGN_DBGERRP( "failed for cursor 0x%p", rc, cursor ); */
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC ReferenceList_MakeTable( const ReferenceList** cself, const VTable* table, uint32_t options,
-                                            size_t cache, const char* filt_name, const uint32_t numbins )
-{
-    rc_t rc = 0;
-    const VCursor* curs;
-
-    if ( table == NULL )
-    {
-        rc = RC( rcAlign, rcType, rcConstructing, rcParam, rcNull );
-    }
-    else
-    {
-        rc = VTableCreateCachedCursorRead( table, &curs, cache );
-        if ( rc == 0 )
-        {
-            rc = VCursorPermitPostOpenAdd( curs );
-            if ( rc == 0 )
-            {
-                rc = ReferenceList_MakeCursor( cself, curs, options, filt_name, numbins );
-                if ( rc == 0 )
-                {
-                    ( (ReferenceList*)(*cself))->cache = cache;
-                }
-                VCursorRelease(curs);
-            }
-        }
-    }
-    ALIGN_DBGERRP( "failed for table 0x%p", rc, table );
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC ReferenceList_MakeDatabase( const ReferenceList** cself, const VDatabase* db, uint32_t options,
-                                               size_t cache, const char* name, const uint32_t numbins )
-{
-    rc_t rc = 0;
-    const VTable* tbl = NULL;
-    const char* nm = "REFERENCE";
-    /*const char* nm = (options & ereferencelist_useEvidence) ? "EVIDENCE_INTERVAL" : "REFERENCE";*/
-
-    if ( db == NULL )
-    {
-        rc = RC( rcAlign, rcType, rcConstructing, rcParam, rcNull );
-    }
-    else
-    {
-        rc = VDatabaseOpenTableRead( db, &tbl, nm );
-        if ( rc == 0 )
-        {
-            rc = ReferenceList_MakeTable( cself, tbl, options, cache, name, numbins );
-            VTableRelease( tbl );
-        }
-    }
-    ALIGN_DBGERRP( "failed for database 0x%p", rc, db );
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC ReferenceList_MakePath( const ReferenceList** cself, const VDBManager* vmgr, const char* dbpath,
-                                           uint32_t options, size_t cache, const char* name, const uint32_t numbins )
-{
-    rc_t rc = 0;
-    const VDatabase* db = NULL;
-
-    if ( vmgr == NULL || dbpath == NULL )
-    {
-        rc = RC( rcAlign, rcType, rcConstructing, rcParam, rcNull );
-    }
-    else
-    {
-        rc = VDBManagerOpenDBRead( vmgr, &db, NULL, "%s", dbpath );
-        if ( rc == 0 )
-        {
-            rc = ReferenceList_MakeDatabase( cself, db, options, cache, name, numbins );
-            VDatabaseRelease( db );
-        }
-    }
-    ALIGN_DBGERRP( "failed for database %s", rc, dbpath );
-    return rc;
-}
-
-
-static rc_t ReferenceList_OpenCursor( ReferenceList* self )
-{
-    rc_t rc = 0;
-
-    assert( self != NULL );
-
-    memcpy( self->reader_cols, ReferenceList_cols, sizeof( ReferenceList_cols ) );
-
-    if ( self->options & ereferencelist_4na )
-    {
-        self->reader_cols[ ereflst_cn_READ_dna ].flags |= ercol_Skip;
-        self->reader_cols[ ereflst_cn_READ_4na ].flags &= ~ercol_Skip;
-    }
-
-    if ( self->options & ereferencelist_usePrimaryIds )
-    {
-        self->reader_cols[ ereflst_cn_PRIMARY_ALIGNMENT_IDS ].flags &= ~ercol_Skip;
-    }
-
-    if ( self->options & ereferencelist_useSecondaryIds )
-    {
-        self->reader_cols[ ereflst_cn_SECONDARY_ALIGNMENT_IDS ].flags &= ~ercol_Skip;
-    }
-
-    if ( self->options & ereferencelist_useEvidenceIds )
-    {
-        self->reader_cols[ ereflst_cn_EVIDENCE_INTERVAL_IDS ].flags &= ~ercol_Skip;
-    }
-
-    if ( !( self->options &
-          ( ereferencelist_usePrimaryIds | ereferencelist_useSecondaryIds | ereferencelist_useEvidenceIds ) ) )
-    {
-        self->reader_cols[ ereflst_cn_OVERLAP_REF_POS ].flags |= ercol_Skip;
-        self->reader_cols[ ereflst_cn_OVERLAP_REF_LEN ].flags |= ercol_Skip;
-    }
-    rc = TableReader_MakeCursor( &self->reader, self->cursor, self->reader_cols );
-    ALIGN_DBGERR( rc );
-    return rc;
-}
-
-
-static rc_t ReferenceList_OpenCursor2( ReferenceList* self, align_id_src ids )
-{
-    rc_t rc = 0;
-
-    assert( self != NULL );
-    if ( ids != primary_align_ids && ids != secondary_align_ids && ids != evidence_align_ids )
-    {
-        rc = RC( rcAlign, rcType, rcAccessing, rcParam, rcOutofrange );
-    }
-    else if ( ids == primary_align_ids && !( self->options & ereferencelist_usePrimaryIds ) )
-    {
-        rc = RC( rcAlign, rcType, rcAccessing, rcParam, rcInvalid );
-    }
-    else if ( ids == secondary_align_ids && !( self->options & ereferencelist_useSecondaryIds ) )
-    {
-        rc = RC( rcAlign, rcType, rcAccessing, rcParam, rcInvalid );
-    }
-    else if ( ids == evidence_align_ids && !( self->options & ereferencelist_useEvidenceIds ) )
-    {
-        rc = RC( rcAlign, rcType, rcAccessing, rcParam, rcInvalid );
-    }
-    else
-    {
-        const VTable* vtbl = NULL;
-        rc = VCursorOpenParentRead( self->cursor, &vtbl );
-        if ( rc == 0 )
-        {
-            if ( rc == 0 )
-            {
-                const VDatabase* db = NULL;
-                rc = VTableOpenParentRead( vtbl, &db );
-                if ( rc == 0 )
-                {
-                    rc = VDatabaseOpenTableRead( db, &vtbl, ids == primary_align_ids ? "PRIMARY_ALIGNMENT" :
-                           ( ids == secondary_align_ids ? "SECONDARY_ALIGNMENT" : "EVIDENCE_INTERVAL" ) );
-                    if ( rc == 0 )
-                    {
-                        memcpy( self->iter_cols, PlacementIterator_cols, sizeof( PlacementIterator_cols ) );
-                        rc = TableReader_Make( &self->iter, vtbl, self->iter_cols, self->cache );
-                    }
-                    VDatabaseRelease( db );
-                }
-            }
-            VTableRelease( vtbl );
-        }
-    }
-    ALIGN_DBGERR( rc );
-    return rc;
-}
-
-
-static rc_t ReferenceList_RefSeqMgr( const ReferenceList* cself, const RefSeqMgr** rmgr )
-{
-    rc_t rc = 0;
-
-    assert( rmgr != NULL );
-
-    if ( cself->refseqmgr == NULL )
-    {
-        const VTable* vtbl = NULL;
-        rc = VCursorOpenParentRead( cself->cursor, &vtbl );
-        if ( rc == 0 )
-        {
-            const VDBManager* vmgr;
-            rc = VTableOpenManagerRead( vtbl, &vmgr );
-            if ( rc == 0 )
-            {
-                rc = RefSeqMgr_Make( &( (ReferenceList*)cself )->refseqmgr, vmgr,
-                                     ( cself->options & ereferencelist_4na ) ? errefseq_4NA : 0, cself->cache, 2 );
-                VDBManagerRelease( vmgr );
-            }
-            VTableRelease( vtbl );
-        }
-    }
-    *rmgr = cself->refseqmgr;
-    ALIGN_DBGERR(rc);
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC ReferenceList_AddRef( const ReferenceList *cself )
-{
-    rc_t rc = 0;
-    if ( cself != NULL )
-    {
-        if ( KRefcountAdd( &cself->refcount, "ReferenceList" ) != krefOkay )
-        {
-            rc = RC( rcAlign, rcType, rcAttaching, rcError, rcUnexpected );
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT void CC ReferenceList_Release( const ReferenceList* cself )
-{
-    if ( cself != NULL )
-    {
-        if ( KRefcountDrop(&cself->refcount, "ReferenceList") == krefWhack )
-        {
-            ReferenceList* self = ( ReferenceList* )cself;
-            TableReader_Whack( self->reader );
-            TableReader_Whack( cself->iter );
-            RefSeqMgr_Release( self->refseqmgr );
-            while( self->nodes_qty-- > 0 )
-            {
-                free( self->nodes[ self->nodes_qty ] );
-            }
-            VCursorRelease( cself->cursor );
-            KRefcountWhack( &self->refcount, "ReferenceList" );
-            free( self );
-        }
-    }
-}
-
-
-LIB_EXPORT rc_t CC ReferenceList_Count(const ReferenceList* cself, uint32_t* count)
-{
-    rc_t rc = 0;
-    if ( cself == NULL || count == NULL )
-    {
-        rc = RC( rcAlign, rcType, rcAccessing, rcParam, rcNull );
-    }
-    else
-    {
-        *count = cself->nodes_qty;
-    }
-    ALIGN_DBGERR( rc );
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC ReferenceList_Find( const ReferenceList* cself, const ReferenceObj** obj,
-                                       const char* key, size_t key_sz )
-{
-    rc_t rc = 0;
-    char buf[4096], *b = buf;
-
-    if ( cself == NULL || obj == NULL || key == NULL )
-    {
-        rc = RC( rcAlign, rcType, rcSearching, rcParam, rcNull );
-    }
-    else if ( key_sz >= sizeof( buf ) && ( b = malloc( key_sz + 1 ) ) == NULL )
-    {
-        rc = RC(rcAlign, rcType, rcSearching, rcMemory, rcExhausted);
-    }
-    else
-    {
-        memcpy( b, key, key_sz );
-        b[ key_sz ] = '\0';
-        *obj = ( ReferenceObj* )BSTreeFind( &cself->seqid_tree, b, ReferenceObj_CmpSeqId );
-        if ( *obj == NULL )
-        {
-            const BSTNode* n = BSTreeFind( &cself->name_tree, b, ReferenceObj_CmpName );
-            if ( n != NULL )
-            {
-                *obj = ( ReferenceObj* )&n[ -1 ];
-            }
-        }
-        if ( *obj == NULL )
-        {
-            rc = RC( rcAlign, rcType, rcSearching, rcItem, rcNotFound );
-        }
-        else
-        {
-            rc = ReferenceList_AddRef( cself );
-            if ( rc != 0 )
-            {
-                *obj = NULL;
-            }
-        }
-
-        if ( b != buf )
-        {
-            free( b );
-        }
-    }
-    ALIGN_DBGERR( rc );
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC ReferenceList_Get( const ReferenceList* cself, const ReferenceObj** obj, uint32_t idx )
-{
-    rc_t rc = 0;
-    if ( cself == NULL || obj == NULL || idx >= cself->nodes_qty )
-    {
-        rc = RC( rcAlign, rcType, rcRetrieving, rcParam, rcInvalid );
-    }
-    else
-    {
-        rc = ReferenceList_AddRef( cself );
-        if ( rc == 0 )
-        {
-            *obj = cself->nodes[ idx ];
-        }
-        else
-        {
-            *obj = NULL;
-        }
-    }
-    ALIGN_DBGERR( rc );
-    return rc;
-}
-
-
-LIB_EXPORT rc_t ReferenceObj_AddRef( const ReferenceObj *cself )
-{
-    if ( cself == NULL )
-    {
-        return RC( rcAlign, rcType, rcAccessing, rcParam, rcInvalid );
-    } 
-    else
-    {
-        return ReferenceList_AddRef( cself->mgr );
-    }
-}
-
-
-LIB_EXPORT void ReferenceObj_Release( const ReferenceObj *cself )
-{
-    ReferenceList_Release( cself ? cself->mgr : NULL );
-}
-
-
-LIB_EXPORT rc_t CC ReferenceObj_Idx( const ReferenceObj* cself, uint32_t* idx )
-{
-    rc_t rc = 0;
-    if ( cself == NULL || idx == NULL )
-    {
-        rc = RC( rcAlign, rcType, rcAccessing, rcParam, rcInvalid );
-    }
-    else
-    {
-        *idx = cself->id;
-    }
-    ALIGN_DBGERR( rc );
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC ReferenceObj_IdRange( const ReferenceObj* cself, int64_t* start, int64_t* stop )
-{
-    rc_t rc = 0;
-    if ( cself == NULL || (start == NULL && stop == NULL) )
-    {
-        rc = RC( rcAlign, rcType, rcAccessing, rcParam, rcInvalid );
-    }
-    else
-    {
-        if ( start != NULL )
-        {
-            *start = cself->start_rowid;
-        }
-        if ( stop != NULL )
-        {
-            *stop = cself->end_rowid;
-        }
-    }
-    ALIGN_DBGERR( rc );
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC ReferenceObj_Bin( const ReferenceObj* cself, uint32_t* bin )
-{
-    rc_t rc = 0;
-    if ( cself == NULL || bin == NULL )
-    {
-        rc = RC( rcAlign, rcType, rcAccessing, rcParam, rcInvalid );
-    }
-    else
-    {
-        *bin = cself->bin;
-    }
-    ALIGN_DBGERR( rc );
-    return rc;
-
-}
-
-
-LIB_EXPORT rc_t CC ReferenceObj_SeqId( const ReferenceObj* cself, const char** seqid )
-{
-    rc_t rc = 0;
-    if ( cself == NULL || seqid == NULL )
-    {
-        rc = RC( rcAlign, rcType, rcAccessing, rcParam, rcInvalid );
-    }
-    else
-    {
-        *seqid = cself->seqid;
-    }
-    ALIGN_DBGERR( rc );
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC ReferenceObj_Name( const ReferenceObj* cself, const char** name )
-{
-    rc_t rc = 0;
-    if ( cself == NULL || name == NULL )
-    {
-        rc = RC( rcAlign, rcType, rcAccessing, rcParam, rcInvalid );
-    }
-    else
-    {
-        *name = cself->name;
-    }
-    ALIGN_DBGERR( rc );
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC ReferenceObj_SeqLength( const ReferenceObj* cself, INSDC_coord_len* len )
-{
-    rc_t rc = 0;
-    if ( cself == NULL || len == NULL )
-    {
-        rc = RC( rcAlign, rcType, rcAccessing, rcParam, rcInvalid );
-    }
-    else
-    {
-        *len = cself->seq_len;
-    }
-    ALIGN_DBGERR( rc );
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC ReferenceObj_Circular( const ReferenceObj* cself, bool* circular )
-{
-    rc_t rc = 0;
-    if ( cself == NULL || circular == NULL )
-    {
-        rc = RC( rcAlign, rcType, rcAccessing, rcParam, rcInvalid );
-    }
-    else
-    {
-        *circular = cself->circular;
-    }
-    ALIGN_DBGERR( rc );
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC ReferenceObj_External( const ReferenceObj* cself, bool* external, char** path )
-{
-    rc_t rc = 0;
-
-    if ( cself == NULL || external == NULL )
-    {
-        rc = RC( rcAlign, rcType, rcAccessing, rcParam, rcInvalid );
-    }
-    else
-    {
-        const RefSeqMgr* rmgr;
-        *external = !cself->read_present;
-        if ( path != NULL && !cself->read_present )
-        {
-            rc = ReferenceList_RefSeqMgr( cself->mgr, &rmgr );
-            if ( rc == 0 )
-            {
-                *path = NULL;
-                rc = RefSeqMgr_Exists( rmgr, cself->seqid, string_size( cself->seqid ), NULL );
-                if ( GetRCObject( rc ) == rcTable && GetRCState( rc ) == rcNotFound )
-                {
-                    rc = 0;
-                }
-            }
-        }
-    }
-    ALIGN_DBGERR( rc );
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC ReferenceObj_Read( const ReferenceObj* cself, INSDC_coord_zero offset, INSDC_coord_len len,
-                                      uint8_t* buffer, INSDC_coord_len* written )
-{
-    rc_t rc = 0;
-
-    if( cself == NULL || buffer == NULL || written == NULL )
-    {
-        rc = RC ( rcAlign, rcType, rcAccessing, rcParam, rcInvalid );
-    }
-    else
-    {
-        rc = ReferenceSeq_ReOffset( cself->circular, cself->seq_len, &offset );
-        if ( rc == 0 )
-        {
-            if ( cself->mgr->reader != NULL || ( rc = ReferenceList_OpenCursor( cself->mgr ) ) == 0 )
-            {
-                int cid = ( cself->mgr->options & ereferencelist_4na ) ? ereflst_cn_READ_4na : ereflst_cn_READ_dna;
-                INSDC_coord_len q = 0;
-                *written = 0;
-                do
-                {
-                    int64_t rowid = cself->start_rowid + offset / cself->mgr->max_seq_len;
-                    INSDC_coord_zero s = offset % cself->mgr->max_seq_len;
-                    rc = TableReader_ReadRow( cself->mgr->reader, rowid );
-                    if ( rc == 0 )
-                    {
-                        q = cself->mgr->reader_cols[ereflst_cn_SEQ_LEN].base.coord_len[0] - s;
-                        if ( q > len ) { q = len; }
-                        memcpy( &buffer[ *written ], &cself->mgr->reader_cols[ cid ].base.str[ s ], q );
-                        *written += q;
-                        offset += q;
-                        len -= q;
-                    }
-                    /* SEQ_LEN < MAX_SEQ_LEN is last row unless it is CIRCULAR */
-                    if ( cself->mgr->reader_cols[ ereflst_cn_SEQ_LEN ].base.coord_len[ 0 ] < cself->mgr->max_seq_len )
-                    {
-                        if ( !cself->circular ) { break; }
-                        offset = 0;
-                    }
-                } while ( rc == 0 && q > 0 && len > 0 );
-            }
-        }
-    }
-    ALIGN_DBGERR( rc );
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC ReferenceObj_GetIdCount( const ReferenceObj* cself, int64_t row_id, uint32_t *count )
-{
-    rc_t rc = 0;
-
-    if ( cself == NULL || count == NULL )
-    {
-        rc = RC ( rcAlign, rcType, rcAccessing, rcParam, rcInvalid );
-    }
-    else if ( cself->mgr == NULL )
-    {
-        rc = RC ( rcAlign, rcType, rcAccessing, rcItem, rcInvalid );
-    }
-    else
-    {
-        *count = 0;
-
-        if ( cself->mgr->reader == NULL )
-            rc = ReferenceList_OpenCursor( cself->mgr );
-
-        if ( rc == 0 )
-        {
-            rc = TableReader_ReadRow( cself->mgr->reader, row_id );
-            if ( rc == 0 )
-            {
-                TableReaderColumn *col = &( cself->mgr->reader_cols[ ereflst_cn_PRIMARY_ALIGNMENT_IDS ] );
-                count[ 0 ] = col->len;
-                col = &( cself->mgr->reader_cols[ ereflst_cn_SECONDARY_ALIGNMENT_IDS ] );
-                count[ 1 ] = col->len;
-                col = &( cself->mgr->reader_cols[ ereflst_cn_EVIDENCE_INTERVAL_IDS ] );
-                count[ 2 ] = col->len;
-            }
-        }
-    }
-    return rc;
-}
-
-
-typedef struct PlacementRecExtensionInfo PlacementRecExtensionInfo;
-struct PlacementRecExtensionInfo
-{
-    /* data, destructor and size for extension 1 */
-    void * data;
-    void ( CC * destroy ) ( void *obj, void *data );
-    size_t size;
-};
-
-
-LIB_EXPORT void * CC PlacementRecordCast ( const PlacementRecord *self, uint32_t ext )
-{
-    void * res = NULL;
-    if ( self != NULL )
-    {
-        uint8_t * ptr = ( uint8_t * ) self;
-        PlacementRecExtensionInfo * ext_info;
-
-/**********************************************
-    +---------------+
-    | core          |   PlacementRecord *
-    +---------------+
-    | read_group    |   char *
-    +---------------+
-    | ext_info1     |   PlacementRecExtensionInfo *
-    | ext_info2     |   PlacementRecExtensionInfo *
-    +---------------+
-    | ext1          |   ??? *
-    +---------------+
-    | ext2          |   ??? *
-    +---------------+
-**********************************************/
-        ptr += ( sizeof * self );
-        ptr += self->spot_group_len;
-        ext_info = ( PlacementRecExtensionInfo * )( ptr );
-        ptr += ( 2 * ( sizeof * ext_info ) );
-        switch( ext )
-        {
-            case placementRecordExtension0 : res = ( void * ) ptr;
-                                             break;
-
-            case placementRecordExtension1 : res = ( void * ) ( ptr + ext_info->size );
-                                             break;
-        }
-    }
-    return res;
-}
-
-
-LIB_EXPORT void * CC PlacementRecord_get_ext_data_ptr ( const PlacementRecord *self, uint32_t ext )
-{
-    void * res = NULL;
-    if ( self != NULL )
-    {
-        uint8_t * ptr = ( uint8_t * ) self;
-        PlacementRecExtensionInfo * ext_info;
-        ptr += ( sizeof * self );
-        ptr += self->spot_group_len;    /* ptr points now to the 1st ext-info-block */
-        ext_info = ( PlacementRecExtensionInfo * )( ptr );
-        switch( ext )
-        {
-        case placementRecordExtension0 : res = ext_info[ 0 ].data; break;
-        case placementRecordExtension1 : res = ext_info[ 1 ].data; break;
-        }
-    }
-    return res;
-}
-
-
-LIB_EXPORT void CC PlacementRecordWhack( const PlacementRecord *cself )
-{
-    if ( cself != NULL ) 
-    {
-        PlacementRecord * self = ( PlacementRecord * )cself;
-        PlacementRecExtensionInfo * ext_info;
-        uint8_t * ptr = ( uint8_t * )self;
-        ptr += sizeof( *self );
-        ptr += self->spot_group_len;
-        ext_info = ( PlacementRecExtensionInfo * ) ptr;
-
-        /* destroy from the outer callback-block beginning */
-        if ( ext_info[ 1 ].destroy != NULL )
-        {
-            void *obj = PlacementRecordCast ( self, placementRecordExtension1 );
-            ext_info[ 1 ].destroy( obj, ext_info[ 1 ].data );
-        }
-
-        if ( ext_info[ 0 ].destroy != NULL )
-        {
-            void *obj = PlacementRecordCast ( self, placementRecordExtension0 );
-            ext_info[ 0 ].destroy( obj, ext_info[ 0 ].data );
-        }
-        /* now deallocate ( or put back into pool ) */
-        free( self );
-    }
-}
-
-struct PlacementIterator
-{
-    const ReferenceObj* obj;
-    INSDC_coord_zero ref_window_start;
-    INSDC_coord_len ref_window_len;
-
-    int64_t last_ref_row_of_window_rel;     /* relative to start of reference, not window */
-    int64_t cur_ref_row_rel;                /* current row relative to start of reference */
-    int64_t rowcount_of_ref;                /* precomputed: how many rows does this reference has */
-
-    /* own reader in case of ref cursor based construction */
-    const TableReader* ref_reader;
-    TableReaderColumn* ref_cols;
-    TableReaderColumn ref_cols_own[sizeof(ReferenceList_cols)/sizeof(ReferenceList_cols[0])];
-
-    /* own reader in case of align cursor based construction */
-    const TableReader* align_reader;
-    TableReaderColumn* align_cols;
-    TableReaderColumn align_cols_own[sizeof(PlacementIterator_cols)/sizeof(PlacementIterator_cols[0])];
-
-    /* current reference table row */
-    int64_t current_reftable_row;
-
-    const TableReaderColumn* ids_col;
-    Vector ids;
-    /* PlacementRecord c-tor params */
-    PlacementRecordExtendFuncs ext_0;
-    PlacementRecordExtendFuncs ext_1;
-
-    /* if this field is :
-     * NULL ... group by original read-group from the source-file
-     * points to empty string ... do not perform grouping at all
-     * point to non-empty string ... group by this string
-    */
-    const char * spot_group;
-    size_t spot_group_len;
-    int32_t min_mapq;
-
-    const VCursor* align_curs;
-    void * placement_ctx;           /* source-specific context */
-};
-
-
-static void enter_spotgroup ( PlacementIterator *iter, const char * spot_group )
-{
-    if ( spot_group == NULL )
-    {
-        iter->spot_group = NULL;
-        iter->spot_group_len = 0;
-    }
-    else
-    {
-        iter->spot_group_len = string_size ( spot_group );
-        if ( iter->spot_group_len > 0 )
-        {
-            iter->spot_group = string_dup_measure ( spot_group, NULL );
-        }
-        else
-        {
-            iter->spot_group = calloc( 1, 1 );
-        }
-    }
-}
-
-
-static int64_t calc_overlaped( PlacementIterator * o, align_id_src ids )
-{
-    int64_t res = o->ref_window_start;
-    bool from_ref_table = false;
-
-/*
-    uint32_t ofs = 0;
-    switch ( ids )
-    {
-        case primary_align_ids   : ofs = 0; break;
-        case secondary_align_ids : ofs = 1; break;
-        case evidence_align_ids  : ofs = 2; break;
-    }
-
-    if ( o->ref_cols[ ereflst_cn_OVERLAP_REF_LEN ].idx != 0 && 
-         o->ref_cols[ ereflst_cn_OVERLAP_REF_LEN ].len > ofs )
-    {
-        INSDC_coord_len overlap_ref_len = o->ref_cols[ ereflst_cn_OVERLAP_REF_LEN ].base.coord_len[ ofs ];
-        if ( overlap_ref_len < o->obj->mgr->max_seq_len )
-        {
-            if ( o->ref_cols[ ereflst_cn_OVERLAP_REF_POS ].idx != 0 && 
-                 o->ref_cols[ ereflst_cn_OVERLAP_REF_POS ].len > ofs )
-            {
-                res = o->ref_cols[ereflst_cn_OVERLAP_REF_POS].base.coord0[ ofs ];
-                from_ref_table = true;
-            }
-        }
-    }
-*/
-
-    if ( !from_ref_table )
-    {
-        /* default is step back 10 rows/50k bases */
-        int64_t ref_pos_lookback = ( 10 * o->obj->mgr->max_seq_len );
-        if ( o->obj->circular )
-        {
-            int64_t const half = ( o->obj->seq_len / 2 );
-
-            if ( ref_pos_lookback > half )
-            {
-                /* go back no more than one full length */
-                ref_pos_lookback = half;
-            }
-            res = ( o->ref_window_start - ref_pos_lookback ); /* could become negative */
-        }
-        else
-        {
-            res = ( o->ref_window_start < ref_pos_lookback ? 0 : ( o->ref_window_start - ref_pos_lookback ) );
-        }
-    }
-    return res;
-}
-
-
-LIB_EXPORT rc_t CC ReferenceObj_MakePlacementIterator ( const ReferenceObj* cself,
-    PlacementIterator **iter,
-    INSDC_coord_zero ref_window_start, INSDC_coord_len ref_window_len,
-    int32_t min_mapq,
-    struct VCursor const *ref_cur, struct VCursor const *align_cur, align_id_src ids,
-    const PlacementRecordExtendFuncs *ext_0, const PlacementRecordExtendFuncs *ext_1,
-    const char * spot_group, void * placement_ctx )
-{
-    rc_t rc = 0;
-    PlacementIterator* o = NULL;
-
-    if ( cself == NULL || iter == NULL )
-    {
-        rc = RC(rcAlign, rcType, rcAccessing, rcParam, rcInvalid);
-    }
-    else if ( ( rc = ReferenceSeq_ReOffset( cself->circular, cself->seq_len, &ref_window_start ) ) != 0 )
-    {
-    }
-    else if ( ( o = calloc( 1, sizeof( *o ) ) ) == NULL )
-    {
-        rc = RC( rcAlign, rcType, rcAccessing, rcMemory, rcExhausted );
-    }
-    else
-    {
-        rc = ReferenceList_AddRef( cself->mgr );
-        if ( rc == 0 )
-        {
-            ReferenceList* mgr = cself->mgr;
-            o->obj = cself;
-            /* o->wrapped_around = false; */
-            ReferenceObj_AddRef( o->obj );
-            o->min_mapq = min_mapq;
-            o->placement_ctx = placement_ctx;
-
-            if ( ext_0 != NULL )
-            {
-                o->ext_0.data = ext_0->data;
-                o->ext_0.destroy = ext_0->destroy;
-                o->ext_0.populate = ext_0->populate;
-                o->ext_0.alloc_size = ext_0->alloc_size;
-                o->ext_0.fixed_size = ext_0->fixed_size;
-            }
-
-            if ( ext_1 != NULL )
-            {
-                o->ext_1.data = ext_1->data;
-                o->ext_1.destroy = ext_1->destroy;
-                o->ext_1.populate = ext_1->populate;
-                o->ext_1.alloc_size = ext_1->alloc_size;
-                o->ext_1.fixed_size = ext_1->fixed_size;
-            }
-
-            if ( ref_cur == NULL )
-            {
-                if ( mgr->reader == NULL )
-                {
-                    rc = ReferenceList_OpenCursor( mgr );
-                }
-                if ( rc == 0 )
-                {
-                    o->ref_reader = mgr->reader;
-                    o->ref_cols = mgr->reader_cols;
-                }
-            }
-            else
-            {
-                memcpy( o->ref_cols_own, ReferenceList_cols, sizeof( o->ref_cols_own ) );
-                o->ref_cols = o->ref_cols_own;
-                rc = TableReader_MakeCursor( &o->ref_reader, ref_cur, o->ref_cols_own );
-            }
-
-            if ( align_cur == NULL )
-            {
-                bool b_assign = ( mgr->iter != NULL );
-                if ( !b_assign )
-                {
-                    rc = ReferenceList_OpenCursor2( mgr, ids );
-                    b_assign = ( rc == 0 );
-                }
-                if ( b_assign )
-                {
-                    o->align_reader = mgr->iter;
-                    o->align_cols = mgr->iter_cols;
-                }
-            }
-            else
-            {
-                memcpy( o->align_cols_own, PlacementIterator_cols, sizeof( o->align_cols_own ) );
-                o->align_cols = o->align_cols_own;
-                o->align_curs = align_cur;
-                rc = TableReader_MakeCursor( &o->align_reader, align_cur, o->align_cols );
-            }
-
-            if ( rc == 0 )
-            {
-                int64_t first_ref_row_of_window_rel = ( ref_window_start / mgr->max_seq_len );
-                int64_t first_ref_row_of_window_abs = ( cself->start_rowid + first_ref_row_of_window_rel );
-
-                /* in bases */
-                o->ref_window_start = ref_window_start;
-                o->ref_window_len = ref_window_len;
-
-                /* in reference-rows */
-                o->last_ref_row_of_window_rel = ref_window_start;
-                o->last_ref_row_of_window_rel += ref_window_len;
-                o->last_ref_row_of_window_rel /= mgr->max_seq_len;
-                o->rowcount_of_ref = ( cself->end_rowid - cself->start_rowid ) + 1;
-
-                /* get effective starting offset based on overlap
-                   from alignments which started before the requested pos */
-                rc = TableReader_ReadRow( o->ref_reader, first_ref_row_of_window_abs );
-                if ( rc == 0 )
-                {
-                    int64_t ref_pos_overlapped = calc_overlaped( o, ids );
-                    ALIGN_DBG( "ref_pos_overlapped: %,li", ref_pos_overlapped );
-
-                    /* the absolute row where we are reading from */
-                    o->cur_ref_row_rel = ( ref_pos_overlapped / mgr->max_seq_len ) - 1;
-
-                    VectorInit( &o->ids, 0, 100 );
-
-                    o->ids_col = &o->ref_cols[ids == primary_align_ids ? ereflst_cn_PRIMARY_ALIGNMENT_IDS :
-                            ( ids == secondary_align_ids ? ereflst_cn_SECONDARY_ALIGNMENT_IDS : ereflst_cn_EVIDENCE_INTERVAL_IDS ) ];
-
-                    ALIGN_DBG( "iter.last_ref_row_of_window_rel: %,li", o->last_ref_row_of_window_rel );
-                    ALIGN_DBG( "iter.rowcount_of_ref: %,li", o->rowcount_of_ref );
-                    ALIGN_DBG( "iter.cur_ref_row_rel: %,li", o->cur_ref_row_rel );
-                }
-            }
-
-            if ( rc != 0 )
-            {
-                ReferenceObj_Release( o->obj );
-            }
-        }
-    }
-
-    if ( rc == 0 )
-    {
-        enter_spotgroup ( o, spot_group );
-        *iter = o;
-        ALIGN_DBG( "iter for %s:%s opened 0x%p", cself->seqid, cself->name, o );
-    }
-    else
-    {
-        *iter = NULL;
-        PlacementIteratorRelease( o );
-        ALIGN_DBGERRP( "iter for %s:%s", rc, cself->seqid, cself->name );
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC PlacementIteratorAddRef ( const PlacementIterator *cself )
-{
-    return ReferenceList_AddRef(cself ? cself->obj->mgr : NULL);
-}
-
-
-static void CC PlacementIterator_whack_recs( void *item, void *data )
-{
-    PlacementRecordWhack( ( PlacementRecord * ) item );
-}
-
-
-LIB_EXPORT rc_t CC PlacementIteratorRelease ( const PlacementIterator *cself )
-{
-    if ( cself != NULL )
-    {
-        PlacementIterator* self = ( PlacementIterator* )cself;
-
-        VectorWhack( &self->ids, PlacementIterator_whack_recs, NULL );
-
-        if ( self->ref_reader != self->obj->mgr->reader )
-        {
-            TableReader_Whack( self->ref_reader );
-        }
-        if ( self->align_reader != self->obj->mgr->iter )
-        {
-            TableReader_Whack( self->align_reader );
-        }
-        ReferenceObj_Release( self->obj );
-        ReferenceList_Release( self->obj->mgr );
-        if ( self->spot_group != NULL )
-        {
-            free( ( void * )self->spot_group );
-        }
-        free( self );
-    }
-    return 0;
-}
-
-
-LIB_EXPORT rc_t CC PlacementIteratorRefWindow( const PlacementIterator *self,
-                                               const char **idstr, INSDC_coord_zero* pos, INSDC_coord_len* len )
-{
-    rc_t rc = 0;
-
-    if ( self == NULL || (idstr == NULL || pos == NULL || len == NULL ) )
-    {
-        rc = RC(rcAlign, rcType, rcAccessing, rcParam, rcInvalid);
-    }
-    else
-    {
-        if ( idstr != NULL ) { *idstr = self->obj->seqid; }
-        if ( pos != NULL )   { *pos = self->ref_window_start; }
-        if ( len != NULL )   { *len = self -> ref_window_len; }
-    }
-    ALIGN_DBGERR( rc );
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC PlacementIteratorRefObj( const PlacementIterator * self,
-                                            struct ReferenceObj const ** refobj )
-{
-    rc_t rc = 0;
-
-    if ( self == NULL || refobj == NULL )
-    {
-        rc = RC( rcAlign, rcType, rcAccessing, rcParam, rcInvalid );
-    }
-    else
-    {
-        *refobj = self->obj;
-    }
-    ALIGN_DBGERR( rc );
-    return rc;
-}
-
-
-#if _DEBUGGING
-static void CC PlacementRecordVector_dump( void *item, void *data )
-{
-    const PlacementRecord* i = ( const PlacementRecord* )item;
-    ALIGN_DBG( " {pos:%,u, len:%,u, id:%,li}", i->pos, i->len, i->id );
-}
-#endif
-
-
-/* this comparison function performs last-to-first
-   ordering in the Vector. for this reason, all
-   comparisons and return values are reversed. */
-static int CC PlacementRecordVector_cmp( const void** left, const void** right, void* data )
-{
-    const PlacementRecord* l = *( ( const PlacementRecord** )left );
-    const PlacementRecord* r = *( ( const PlacementRecord** )right );
-
-    /* order by pos desc
-       return right - left rather than
-       normal left - right to reverse result */
-    int32_t d = r -> pos - l -> pos;
-    if ( d != 0 )
-        return d;
-
-    /* ...len asc */
-    if ( l -> len < r -> len )
-        return -1;
-    if ( l -> len > r -> len )
-        return 1;
-
-    /* ...id desc */
-    if ( l -> id > r -> id )
-        return -1;
-    if ( l -> id < r -> id )
-        return 1;
-    return 0;
-}
-
-
-static rc_t allocate_populate_rec( const PlacementIterator *cself,
-                                   PlacementRecord **rec,
-                                   struct VCursor const *curs,
-                                   int64_t id,
-                                   INSDC_coord_zero apos,
-                                   INSDC_coord_len alen )
-{
-    rc_t rc = 0;
-
-    {
-        PlacementRecExtensionInfo * ext_info;
-        size_t spot_group_len, size0, size1, total_size;
-
-        if ( cself->spot_group_len > 0 )
-        {
-            /* use the read-group from the PlacementIterator as an fix override ... */
-            spot_group_len = cself->spot_group_len;
-        }
-        else
-        {
-            if ( cself->spot_group != NULL )
-            {
-                /* iterator has an empty (not NULL) spot-group: use the orignal data! */
-                spot_group_len = cself->align_cols[eplacementiter_cn_READ_GROUP].len;
-            }
-            else
-            {
-                /* do not use spotgroups at all ! */
-                spot_group_len = 0;
-            }
-        }
-
-        /* use callback or fixed size to discover the size of portions 0 and 1 */
-        if ( cself->ext_0.alloc_size != NULL )
-        {
-            rc = cself->ext_0.alloc_size( curs, id, &size0, cself->ext_0.data, cself->placement_ctx );
-            if ( rc != 0 )
-                return rc;
-        }
-        else
-            size0 = cself->ext_0.fixed_size;
-
-        if ( cself->ext_1.alloc_size != NULL )
-        {
-            rc = cself->ext_1.alloc_size( curs, id, &size1, cself->ext_1.data, cself->placement_ctx );
-            if ( rc != 0 )
-                return rc;
-        }
-        else
-            size1 = cself->ext_1.fixed_size;
-        
-        /* allocate the record ( or take it from a pool ) */
-        total_size = ( sizeof **rec ) + spot_group_len + ( 2 * ( sizeof *ext_info ) ) + size0 + size1;
-        *rec = calloc( 1, total_size );
-        if ( *rec == NULL )
-        {
-            rc = RC( rcAlign, rcType, rcAccessing, rcMemory, rcExhausted );
-        }
-        else
-        {
-            PlacementRecord *pr = * rec;
-            uint8_t * ptr = ( uint8_t * )( * rec );
-            ptr += sizeof ( **rec );
-            pr->spot_group = (char *)ptr;
-            ptr += spot_group_len ;
-            ext_info = ( PlacementRecExtensionInfo * )ptr;
-
-            /* prepopulate the core-record : */
-            pr->id  = id;               /* the row-id */
-            pr->ref = cself->obj;       /* the ReferenceObj it refers to */
-            pr->pos = apos;             /* the positon on the reference */
-            pr->len = alen;             /* the length on the reference */
-            pr->mapq = cself->align_cols[eplacementiter_cn_MAPQ].base.i32[ 0 ]; /* mapq */
-
-            /* populate the spot-group : (with the values discovered at the "size-phase" ) */
-            pr->spot_group_len = spot_group_len;
-            if ( cself->spot_group_len > 0 )
-            {
-                /* we make a copy of the spot-group-override commin from the iterator */
-                string_copy ( pr->spot_group, spot_group_len, cself->spot_group, spot_group_len );
-            }
-            else
-            {
-                if ( cself->spot_group != NULL )
-                {
-                    /* iterator has an empty (not NULL) spot-group: use the orignal data! */
-                    string_copy( pr->spot_group, spot_group_len,
-                                 cself->align_cols[eplacementiter_cn_READ_GROUP].base.str, spot_group_len );
-                }
-            }
-
-            ext_info[ 0 ].data = cself->ext_0.data;          /* the opt. context ptr. */
-            ext_info[ 0 ].destroy = cself->ext_0.destroy;    /* the opt. destructor */
-            ext_info[ 0 ].size = size0;                      /* discovered size from above */
-
-            ext_info[ 1 ].data = cself->ext_1.data;          /* the opt. context ptr. */
-            ext_info[ 1 ].destroy = cself->ext_1.destroy;    /* the opt. destructor */
-            ext_info[ 1 ].size = size1;                      /* discovered size from above */
-
-            /* pass the record now to the opt. populate-callbacks */
-            if ( cself->ext_0.populate != NULL )
-            {
-                void * obj = PlacementRecordCast ( pr, placementRecordExtension0 );
-                rc = cself->ext_0.populate( obj, pr, curs,
-                                            cself->ref_window_start,
-                                            cself->ref_window_len,
-                                            cself->ext_0.data,
-                                            cself->placement_ctx );
-                if ( rc != 0 && cself->ext_0.destroy != NULL )
-                {
-                    void *obj = PlacementRecordCast ( pr, placementRecordExtension0 );
-                    cself->ext_0.destroy( obj, cself->ext_0.data );
-                }
-            }
-
-            if ( rc == 0 && cself->ext_1.populate != NULL )
-            {
-                void * obj = PlacementRecordCast ( pr, placementRecordExtension1 );
-                rc = cself->ext_1.populate( obj, pr, curs, 
-                                            cself->ref_window_start,
-                                            cself->ref_window_len,
-                                            cself->ext_1.data,
-                                            cself->placement_ctx );
-                if ( rc != 0 )
-                {
-                    if ( cself->ext_1.destroy != NULL )
-                    {
-                        void *obj = PlacementRecordCast ( pr, placementRecordExtension1 );
-                        cself->ext_1.destroy( obj, cself->ext_1.data );
-                    }
-                    if ( cself->ext_0.destroy != NULL )
-                    {
-                        void *obj = PlacementRecordCast ( pr, placementRecordExtension0 );
-                        cself->ext_0.destroy( obj, cself->ext_0.data );
-                    }
-
-                }
-            }
-
-            if ( rc != 0 )
-            {
-                /* free */
-                free( *rec );
-                *rec = NULL;
-            }
-        }
-    }
-    return rc;
-}
-
-
-static rc_t make_alignment( PlacementIterator *self, int64_t align_id,
-                            INSDC_coord_zero apos, INSDC_coord_len alen )
-{
-    PlacementRecord *rec;
-    rc_t rc = allocate_populate_rec( self, &rec, self->align_curs, align_id, apos, alen );
-    if ( rc == 0 )
-    {
-        /*ALIGN_DBG("align %p: {%li, %u, %u} - added[%u]", rec, cself->ids_col->base.i64[i],
-            apos, alen, VectorLength(&cself->ids));*/
-        rc = VectorAppend( &self->ids, NULL, rec );
-        if ( rc != 0 )
-            PlacementRecordWhack( rec );
-    }
-    else
-    {
-        if ( GetRCState( rc ) == rcIgnored )
-            rc = 0; /* do not break the loop if a record is filtered out! */
-    }
-    return rc;
-}
-
-
-/*
-  we have read a single row from REFERENCE, including the
-  alignment ids. use each alignment id from this row to
-  populate internal vector
-*/
-static rc_t read_alignments( PlacementIterator *self )
-{
-    rc_t rc = 0;
-    uint32_t i;
-    /* fill out vector */
-    /*ALIGN_DBG("align rows: %u", cself->ids_col->len);*/
-    for ( i = 0; rc == 0 && i < self->ids_col->len; i++ )
-    {
-        int64_t row_id = self->ids_col->base.i64[ i ];
-        rc = TableReader_ReadRow( self->align_reader, row_id );
-        if ( rc == 0 )
-        {
-            INSDC_coord_zero apos = self->align_cols[ eplacementiter_cn_REF_POS ].base.coord0[ 0 ];
-            INSDC_coord_len alen  = self->align_cols[ eplacementiter_cn_REF_LEN ].base.coord_len[ 0 ];
-
-#if 0
-            ALIGN_DBG( "alignment read: {row_id:%,li, apos:%,d, alen:%u}", row_id, apos, alen );
-#endif
-
-            /* at this point we have the position of the alignment.
-               we want it to intersect with the window */
-
-            /* test mapq */
-            if ( self->align_cols[eplacementiter_cn_MAPQ].base.i32[ 0 ] < self->min_mapq )
-                continue;
-
-            /* case 1: alignment, which is expressed in
-               linear coordinates, is entirely to left of
-               window. */
-            if ( (INSDC_coord_zero)( apos + alen ) <= self -> ref_window_start )
-            {
-                /* ignore this alignment */
-                continue;
-            }
-
-            /* case 2: alignment is to the right of window */
-            if ( apos >= ( self -> ref_window_start + self -> ref_window_len ) )
-            {
-                /* if not circular, it cannot intersect */
-                if ( ! self -> obj -> circular )
-                {
-                    /* this seems like it indicates end of window,
-                       however there is no guarantee that the ids
-                       being fetched are in reference order. they are
-                       supposed to be in row order ( cluster ) to
-                       reduce random access to cursor. unless row
-                       order is guaranteed to be reference order,
-                       we cannot know that the loop can be terminated. */
-                    continue;
-                }
-
-                /* circular, but still within linear range
-                   means it cannot wrap around to intersect */
-                if ( (INSDC_coord_zero)( apos + alen ) <= self->obj->seq_len )
-                    continue;
-
-            }
-            else if ( ( self->obj->circular )&&
-                       ( apos + alen > self->obj->seq_len )&&
-                       ( self->cur_ref_row_rel < 0 ) ) 
-            {
-                /* the end of the alignment sticks over the end of the reference! 
-                   ---> we have the rare case of an alignment that wraps arround !
-                   let as insert the alignment 2 times!
-                   ( one with neg. position, one at real position ) */
-                rc =  make_alignment( self, row_id, apos - self->obj->seq_len, alen );
-            }
-
-            /* having arrived here, we know the alignment intersects our window
-               apos MAY be < 0 if the alignment wrapped around */
-            if ( rc == 0 && self->cur_ref_row_rel >= 0 )
-                rc =  make_alignment( self, row_id, apos, alen );
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC PlacementIteratorNextAvailPos( const PlacementIterator *cself,
-    INSDC_coord_zero *pos, INSDC_coord_len *len )
-{
-    rc_t rc = 0;
-    PlacementIterator* self = (PlacementIterator*)cself;
-
-    if ( self == NULL || ( pos == NULL && len == NULL ) )
-    {
-        rc = RC( rcAlign, rcType, rcSelecting, rcParam, rcInvalid );
-    }
-    else
-    {
-        while ( rc == 0 && VectorLength( &self->ids ) == 0 )
-        {
-            /* read ids */
-
-            self->cur_ref_row_rel++;   /* increment row offset */
-
-#if 0
-            ALIGN_DBG( "ref row: ref-start-row-id:%,li - curr-rel-row:%,li - of:%,li",
-                       self->obj->start_rowid, self->cur_ref_row_rel, self->last_ref_row_of_window_rel );
-#endif
-
-            if ( self->cur_ref_row_rel > self->last_ref_row_of_window_rel )
-                rc = SILENT_RC( rcAlign, rcType, rcSelecting, rcRange, rcDone );
-            else
-            {
-                int64_t row = ( self->obj->start_rowid + self->cur_ref_row_rel );
-                if ( self->cur_ref_row_rel < 0 )
-                    row += self->rowcount_of_ref;
-
-                rc = TableReader_ReadRow( self->ref_reader, row );
-                if ( rc == 0 )
-                    rc = read_alignments( self );
-
-                if ( ( rc == 0 || GetRCState( rc ) == rcDone) && VectorLength( &cself->ids ) > 0 )
-                {
-                    VectorReorder( &self->ids, PlacementRecordVector_cmp, NULL );
-#if _DEBUGGING && 0
-                    ALIGN_DBG( "REFERENCE row %li %u recs order by pos asc, len desc, id asc",
-                                row, VectorLength( &cself->ids ) );
-                    VectorForEach( &self->ids, true, PlacementRecordVector_dump, NULL );
-#endif
-                }
-            }
-        }
-
-        if ( rc == 0 || GetRCState( rc ) == rcDone )
-        {
-            uint32_t count = VectorLength( &cself->ids );
-            if ( count > 0 )
-            {
-                PlacementRecord * r = VectorLast( &cself->ids );
-                rc = 0;
-                if ( pos != NULL ) { *pos = r->pos; }
-                if ( len != NULL ) { *len = r->len; }
-
-#if 0
-                ALIGN_DBG( "PlacementIteratorNextAvailPos( id=%,li, pos=%,d, len=%,u, n=%,u )", r->id, r->pos, r->len, count );
-#endif
-
-                if ( !( cself->obj->circular ) && ( r->pos >= ( cself->ref_window_start + cself->ref_window_len ) ) )
-                {
-                    /* the alignment !starts! after the end of the of the requested window! */
-                    rc = SILENT_RC( rcAlign, rcType, rcSelecting, rcRange, rcDone );
-                }
-            }
-            else
-            {
-                ALIGN_DBG( "PlacementIteratorNextAvailPos( no placements )", 0 );
-            }
-        }
-    }
-
-    if ( rc != 0 && GetRCState(rc) != rcDone )
-        ALIGN_DBGERR( rc );
-
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC PlacementIteratorNextRecordAt( PlacementIterator *cself,
-    INSDC_coord_zero pos, const PlacementRecord **rec )
-{
-    rc_t rc = 0;
-    if ( cself == NULL || rec == NULL )
-    {
-        rc = RC( rcAlign, rcType, rcAccessing, rcParam, rcInvalid );
-    }
-    else
-    {
-        uint32_t vlen = VectorLength( &cself->ids );
-        *rec = NULL;
-        if ( vlen > 0 )
-        {
-            PlacementRecord* r = VectorLast( &cself->ids );
-            if ( r->pos == pos )
-            {
-                VectorRemove( &cself->ids, vlen - 1, (void**)rec );
-            }
-        }
-    }
-
-    if ( rc == 0 && *rec == NULL )
-    {
-        rc = SILENT_RC( rcAlign, rcType, rcSelecting, rcOffset, rcDone );
-    }
-    else
-    {
-        ALIGN_DBGERR( rc );
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC PlacementIteratorNextIdAt( PlacementIterator *cself,
-                                              INSDC_coord_zero pos, int64_t *row_id, INSDC_coord_len *len )
-{
-    rc_t rc = 0;
-    const PlacementRecord* r = NULL;
-
-    if ( cself == NULL || row_id == NULL )
-    {
-        rc = RC( rcAlign, rcType, rcAccessing, rcParam, rcInvalid );
-    }
-    else
-    {
-        rc = PlacementIteratorNextRecordAt( cself, pos, &r );
-        if ( rc  == 0 )
-        {
-            *row_id = r->id;
-            if ( len != NULL ) { *len = r->len; }
-            PlacementRecordWhack( r );
-        }
-    }
-
-    if ( GetRCState( rc ) != rcDone )
-    {
-        ALIGN_DBGERR( rc );
-    }
-    return rc;
-}
diff --git a/libs/align/refseq-mgr-priv.h b/libs/align/refseq-mgr-priv.h
deleted file mode 100644
index 4e746c7..0000000
--- a/libs/align/refseq-mgr-priv.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was readten as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#ifndef _h_align_refseq_mgr_priv_
-#define _h_align_refseq_mgr_priv_
-
-#include <align/refseq-mgr.h>
-
-typedef bool (*RefSeqMgr_ForEachVolume_callback)(char const server[], char const volume[], void *data);
-
-rc_t RefSeqMgr_ForEachVolume(const RefSeqMgr* cself, RefSeqMgr_ForEachVolume_callback cb, void *data);
-
-#endif /* _h_align_refseq_mgr_priv_ */
diff --git a/libs/align/refseq-mgr.c b/libs/align/refseq-mgr.c
deleted file mode 100644
index a9e9979..0000000
--- a/libs/align/refseq-mgr.c
+++ /dev/null
@@ -1,813 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was readten as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <align/extern.h>
-
-#include <klib/rc.h>
-#include <klib/container.h>
-#include <klib/text.h>
-#include <klib/printf.h>
-#include <klib/log.h>
-#include <kdb/manager.h>
-#include <kfg/config.h>
-#include <insdc/insdc.h>
-#include <vdb/database.h>
-#include <vdb/vdb-priv.h>
-#include <vdb/cursor.h>
-#include <align/refseq-mgr.h>
-#include <os-native.h>
-#include <sysalloc.h>
-
-#include "refseq-mgr-priv.h"
-#include "debug.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <ctype.h>
-#include <assert.h>
-
-/*#define ALIGN_DBG KOutMsg*/
-
-#define USE_OWN_REFSEQ_RESOLVER 0
-
-struct RefSeqMgr {
-    BSTree tree;
-    KConfig *kfg;
-    const VDBManager* vmgr;
-    uint32_t reader_options;
-    size_t cache;
-    uint32_t num_open_max;
-    uint32_t num_open;
-    uint64_t usage;
-    RefSeq* last_used;
-    BSTree vdbs;
-};
-
-struct RefSeq {
-    BSTNode dad;
-    const RefSeqMgr* mgr;
-    const TableReaderRefSeq* reader;
-    uint64_t usage;
-    uint32_t accession_sz;
-    /* must be last member of struct */
-    char accession[1];
-};
-
-typedef struct RefSeqMgr_Db_struct {
-    BSTNode dad;
-    char key[4096];
-    const VDatabase* db;
-} RefSeqMgr_Db;
-
-#if USE_OWN_REFSEQ_RESOLVER
-struct FindTable_ctx {
-    RefSeqMgr* self;
-    const KDBManager* kmgr;
-    const VTable** tbl;
-    char const* name;
-    uint32_t name_sz;
-    bool found;
-    rc_t rc;
-    char** path; /* optional */
-};
-#endif
-
-static
-rc_t RefSeqMgr_ConfigValue ( const KConfig *kfg, const char *node_path, char *value, size_t value_size )
-{
-    const KConfigNode *node;
-    rc_t rc = KConfigOpenNodeRead ( kfg, & node, node_path );
-    if ( rc == 0 )
-    {
-        size_t num_read, remaining;
-        rc = KConfigNodeRead ( node, 0, value, value_size - 1, & num_read,  & remaining );
-        if ( rc == 0 )
-        {
-            if ( remaining != 0 )
-                rc = RC ( rcSRA, rcMgr, rcConstructing, rcString, rcExcessive );
-            else
-                value [ num_read ] = 0;
-        }
-        
-        KConfigNodeRelease ( node );
-    }
-    return rc;
-}
-
-static
-rc_t RefSeqMgr_KfgReadRepositories(const KConfig* kfg, char* paths, size_t paths_sz)
-{
-    /* servers are children of refseq/repository, e.g.:             /refseq/repository/main="..." */ 
-    /* volumes are in refseq/repository/<serverName>/volumes, e.g.: /refseq/repository/main/volumes="..." */
-    /* all server/volume combinations are returned in paths separated by ':' */
-    
-    rc_t rc = 0;
-    const KConfigNode *node;
-#define KFG_PATH "/refseq/repository/"
-    paths[0] = 0;
-    
-    rc = KConfigOpenNodeRead ( kfg, & node, KFG_PATH );
-    if ( rc == 0 )
-    {
-        KNamelist* children;
-        rc = KConfigNodeListChild ( node, &children );
-        if ( rc == 0 )
-        {
-            uint32_t count;
-            rc = KNamelistCount ( children, &count );
-            if ( rc == 0 )
-            {
-                uint32_t i;
-                for (i = 0; i < count; ++i) /* for all servers */
-                {
-                    const char* name;
-                    rc = KNamelistGet ( children, i, &name );
-                    if ( rc == 0 )
-                    {
-#define BufSize 4096
-                        char server[ BufSize ];
-                        char buf[ BufSize ];
-                        size_t num_writ;
-                        
-                        rc = string_printf(buf, BufSize, &num_writ, KFG_PATH "%s", name);
-                        if (rc == 0)
-                        {
-                            rc = RefSeqMgr_ConfigValue ( kfg, buf, server, sizeof(server) );
-                            if (rc == 0)
-                            {
-                                rc = string_printf(buf, BufSize, &num_writ, KFG_PATH "%s/volumes", name);
-                                if (rc == 0)
-                                {
-                                    char volumes[ BufSize ];
-                                    rc = RefSeqMgr_ConfigValue ( kfg, buf, volumes, sizeof(volumes) );
-                                    if (rc == 0)
-                                    {   /* create a server/volume pair for every combination, append to paths, ':' - separate */ 
-                                        char *vol_rem = volumes;
-                                        char *vol_sep;
-                                        
-                                        do {
-                                            char const *volume = vol_rem;
-                                            vol_sep = string_chr(volume, string_size(volume), ':');
-                                            if(vol_sep) {
-                                                vol_rem = vol_sep + 1;
-                                                *vol_sep = 0;
-                                            }
-                                            string_copy(paths + string_size(paths), paths_sz - string_size(paths), server, string_size(server));
-                                            if (paths[string_size(paths)-1] != '/')
-                                            {
-                                                string_copy(paths + string_size(paths), paths_sz - string_size(paths), "/", 1);
-                                            }
-                                            string_copy(paths + string_size(paths), paths_sz - string_size(paths), volume, string_size(volume));
-                                            string_copy(paths + string_size(paths), paths_sz - string_size(paths), ":", 1);
-                                        } while(vol_sep);
-                                    }
-                                }
-                            }
-                        }
-#undef BufSize
-                    }
-                    if ( rc != 0 )
-                    {
-                        break;
-                    }
-                }
-            }
-            KNamelistRelease ( children );
-        }
-        
-        KConfigNodeRelease ( node );
-    }
-    if (GetRCState(rc) == rcNotFound)
-    {
-        paths[0] = '\0';
-        return 0;
-    }
-    return 0;
-}
-
-static
-rc_t RefSeqMgr_KfgReadStr(const KConfig* kfg, const char* path, char* value, size_t value_sz)
-{
-    rc_t rc = 0;
-    const KConfigNode *node;
-    
-    if ( (rc = KConfigOpenNodeRead(kfg, &node, path)) == 0 ) {
-        size_t num_read, remaining;
-        if( (rc = KConfigNodeRead(node, 0, value, value_sz - 1, &num_read, &remaining)) == 0 ) {
-            if( remaining != 0 ) {
-                rc = RC(rcAlign, rcIndex, rcConstructing, rcString, rcTooLong);
-            } else {
-                value[num_read] = '\0';
-            }
-        }
-        KConfigNodeRelease(node);
-    } else if( GetRCState(rc) == rcNotFound ) {
-        rc = 0;
-        value[0] = '\0';
-    }
-    return rc;
-}
-
-rc_t RefSeqMgr_ForEachVolume(const RefSeqMgr* cself, RefSeqMgr_ForEachVolume_callback cb, void *data)
-{
-    rc_t rc = 0;
-    char servers[4096];
-    char volumes[4096];
-    
-    if( cself == NULL || cb == NULL ) {
-        rc = RC(rcAlign, rcType, rcConstructing, rcParam, rcNull);
-    } else if( cb(".", NULL, data) ) {
-        /* found in local dir */
-    } else if( (rc = RefSeqMgr_KfgReadStr(cself->kfg, "refseq/paths", servers, sizeof(servers))) != 0 ) {
-        ALIGN_DBGERRP("%s", rc, "RefSeqMgr_KfgReadStr(paths)");
-    } else {
-        bool found = false;
-        if( servers[0] != '\0' ) {
-            char *srv_sep;
-            char *srv_rem = servers;
-            do {
-                char const* server = srv_rem;
-                
-                srv_sep = strchr(server, ':');
-                if(srv_sep) {
-                    srv_rem = srv_sep + 1;
-                    *srv_sep = 0;
-                }
-                if( cb(server, NULL, data) ) {
-                    found = true;
-                    break;
-                }
-            } while(srv_sep);
-        }
-        if( !found ) {
-            /* locate refseq servers/volumes in possibly multiple repositories */
-            if( (rc = RefSeqMgr_KfgReadRepositories(cself->kfg, servers, sizeof(servers))) != 0 ) {
-                ALIGN_DBGERRP("%s", rc, "RefSeqMgr_KfgReadStr(refseq/repository/*)");
-            };
-            if( servers[0] != '\0' ) {
-                char *srv_sep;
-                char *srv_rem = servers;
-                do {
-                    char const* server = srv_rem;
-                    
-                    srv_sep = strchr(server, ':');
-                    if(srv_sep) {
-                        srv_rem = srv_sep + 1;
-                        *srv_sep = 0;
-                    }
-                    if( cb(server, NULL, data) ) {
-                        found = true;
-                        break;
-                    }
-                } while(srv_sep);
-            }
-        }
-        if( !found ) {
-            if ( (rc = RefSeqMgr_KfgReadStr(cself->kfg, "refseq/servers", servers, sizeof(servers))) != 0 ||
-                (rc = RefSeqMgr_KfgReadStr(cself->kfg, "refseq/volumes", volumes, sizeof(volumes))) != 0 ) {
-                ALIGN_DBGERRP("%s", rc, "RefSeqMgr_KfgReadStr(servers/volumes)");
-            } 
-            /* servers and volumes are deprecated and optional */
-            if( rc == 0 && (servers[0] != '\0' || volumes[0] != '\0') ) {
-                char *srv_sep;
-                char *srv_rem = servers;
-                do {
-                    char vol[ 4096 ];
-                    char const *server = srv_rem;
-                    char *vol_rem = vol;
-                    char *vol_sep;
-                    
-                    string_copy ( vol, sizeof vol, volumes, string_size( volumes ) );
-                    srv_sep = strchr(server, ':');
-                    if(srv_sep) {
-                        srv_rem = srv_sep + 1;
-                        *srv_sep = 0;
-                    }
-                    do {
-                        char const *volume = vol_rem;
-                        
-                        vol_sep = strchr(volume, ':');
-                        if(vol_sep) {
-                            vol_rem = vol_sep + 1;
-                            *vol_sep = 0;
-                        }
-                        found = cb(server, volume, data);
-                    } while(!found && vol_sep);
-                } while(!found && srv_sep);
-            }
-        }
-    }
-    return rc;
-}
-
-#if USE_OWN_REFSEQ_RESOLVER
-static
-int CC RefSeqMgr_DbSort(const BSTNode* item, const BSTNode* node)
-{
-    return strcmp(((const RefSeqMgr_Db*)item)->key, ((const RefSeqMgr_Db*)node)->key);
-}
-
-static
-int CC RefSeqMgr_FindDb(const void *item, const BSTNode *node)
-{
-    return strcmp((const char*)item, ((const RefSeqMgr_Db*)node)->key);
-}
-
-static
-bool FindTable(char const server[], char const volume[], void *data)
-{
-    const VTable* tbl = NULL;
-    struct FindTable_ctx *ctx = data;
-    const char* vol_sep = "/";
-    
-    if( volume == NULL || string_size(volume) == 0) {
-        volume = "";
-        vol_sep = "";
-    }
-    ctx->rc = VDBManagerOpenTableRead(ctx->self->vmgr, &tbl, NULL, "%s%s%s/%.*s", server, vol_sep, volume, ctx->name_sz, ctx->name);
-    ALIGN_DBG("trying '%s%s%s/%.*s'...", server, vol_sep, volume, ctx->name_sz, ctx->name);
-    
-    ctx->found = false;
-    
-    if(ctx->rc == 0){
-        ALIGN_DBG("found\n", "");
-	    ctx->found = true;
-    }
-    else if (GetRCState(ctx->rc) == rcNotFound) {
-        ctx->rc = 0;
-        ALIGN_DBG("not found\n", "");
-        
-        /* can be kar */
-        if( ctx->name_sz > 7 ) {
-            uint32_t i = 0;
-            
-            /* check for pattern '\w{4}\d{2}[\.\d]+' */
-            while( isalpha(ctx->name[i]) && i < 4 ) {
-                i++;
-            }
-            if( i == 4 && isdigit(ctx->name[i]) && isdigit(ctx->name[++i]) ) {
-                while( ++i < ctx->name_sz ) {
-                    if( !isdigit(ctx->name[i]) && ctx->name[i] != '.' ) {
-                        break;
-                    }
-                }
-            }
-            if( i == ctx->name_sz ) {
-                char key[4096];
-                size_t n;
-                
-                if( string_printf(key, sizeof(key), &n, "%s%s%s/%.*s", server, vol_sep, volume, 6, ctx->name) != 0 ) {
-                    (void)LOGMSG(klogWarn, "kar-vdb lookup buffer");
-                } else {
-                    RefSeqMgr_Db *db = (RefSeqMgr_Db*)BSTreeFind(&ctx->self->vdbs, key, RefSeqMgr_FindDb);
-                    
-                    ALIGN_DBG("trying database '%s%s%s/%.*s'...", server, vol_sep, volume, 6, ctx->name);
-                    if( db == NULL ) {
-                        const VDatabase* vdb = NULL;
-                        if( (ctx->rc = VDBManagerOpenDBRead(ctx->self->vmgr, &vdb, NULL, key)) == 0 ) {
-                            db = malloc(sizeof(*db));
-                            if( db == NULL ) {
-                                ctx->rc = RC(rcAlign, rcDatabase, rcOpening, rcMemory, rcExhausted);
-                            } else {
-                                string_copy( db->key, sizeof db->key, key, string_size( key ) );
-                                db->db = vdb;
-                                ctx->rc = BSTreeInsertUnique(&ctx->self->vdbs, &db->dad, NULL, RefSeqMgr_DbSort);
-                            }
-                        }
-                        if( ctx->rc != 0 ) {
-                            VDatabaseRelease(vdb);
-                            free(db);
-                            db = NULL;
-                        }
-                    }
-                    if( db != NULL ) {
-                        ALIGN_DBG(" table '%.*s'", ctx->name_sz, ctx->name);
-                        if( (ctx->rc = VDatabaseOpenTableRead(db->db, &tbl, "%.*s", ctx->name_sz, ctx->name)) == 0 ) {
-                            ctx->found = true;
-                            ALIGN_DBG("found\n", "");
-                        }
-                        else
-                            ALIGN_DBG("not found\n", "");
-                    }
-                    else
-                        ALIGN_DBG("not found\n", "");
-                }
-            }
-        }
-    }
-    if( ctx->found){
-        if(ctx->tbl)  *(ctx->tbl) = tbl;
-        else VTableRelease(tbl);
-    }
-    if( ctx->found && ctx->path != NULL ) {
-        size_t path_sz = string_size( server ) + string_size( vol_sep ) + string_size( volume ) + 1 + ctx->name_sz + 1;
-        char* path = malloc(path_sz);
-        if( path == NULL ) {
-            ctx->rc = RC(rcAlign, rcPath, rcConstructing, rcMemory, rcExhausted);
-        } else {
-            if( (ctx->rc = string_printf(path, path_sz, &path_sz, "%s%s%s/%.*s", server, vol_sep, volume, ctx->name_sz, ctx->name)) == 0 ) {
-                *(ctx->path) = path;
-            } else {
-                free(path);
-            }
-        }
-    }
-    return ctx->found;
-}
-
-static
-rc_t RefSeqMgr_FindTable(const RefSeqMgr* cself, char const accession[], uint32_t accession_sz, VTable const **tbl, char** path)
-{
-    rc_t rc;
-    struct FindTable_ctx ctx;
-    
-    if( (rc = VDBManagerOpenKDBManagerRead(cself->vmgr, &ctx.kmgr)) != 0 ) {
-        ALIGN_DBGERRP("%s", rc, "VDBManagerOpenKDBManagerRead");
-    } else {
-        ctx.self = (RefSeqMgr*)cself;
-        ctx.name = accession;
-        ctx.name_sz = accession_sz;
-        ctx.found = false;
-        ctx.tbl = tbl;
-        ctx.rc = 0;
-        ctx.path = path;
-        
-        rc = RefSeqMgr_ForEachVolume(cself, FindTable, &ctx);
-        if(rc == 0 && ctx.rc == 0 && !ctx.found) {
-            rc = RC(rcAlign, rcTable, rcOpening, rcTable, rcNotFound);
-        }
-        KDBManagerRelease(ctx.kmgr);
-    }
-    return rc ? rc : ctx.rc;
-}
-#endif
-
-LIB_EXPORT rc_t CC RefSeqMgr_SetCache(RefSeqMgr const *const cself, size_t cache, uint32_t keep_open_num)
-{
-    if (cself) {
-        RefSeqMgr *const self = (RefSeqMgr *)cself;
-        
-        self->cache = cache;
-        self->num_open_max = keep_open_num;
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC RefSeqMgr_Make( const RefSeqMgr** cself, const VDBManager* vmgr,
-                                   uint32_t reader_options, size_t cache, uint32_t keep_open_num )
-{
-    rc_t rc = 0;
-    RefSeqMgr* obj = NULL;
-    
-    if ( cself == NULL || vmgr == NULL )
-    {
-        rc = RC( rcAlign, rcIndex, rcConstructing, rcParam, rcNull );
-    }
-    else
-    {
-        obj = calloc( 1, sizeof( *obj ) );
-        if ( obj == NULL )
-        {
-            rc = RC( rcAlign, rcIndex, rcConstructing, rcMemory, rcExhausted );
-        }
-        else
-        {
-            rc = KConfigMake( &obj->kfg, NULL );
-            if ( rc == 0 )
-            {
-                rc = VDBManagerAddRef( vmgr );
-                if ( rc == 0 )
-                {
-                    BSTreeInit( &obj->tree );
-                    BSTreeInit( &obj->vdbs );
-                    obj->vmgr = vmgr;
-                    obj->cache = cache;
-                    obj->num_open_max = keep_open_num;
-                    obj->reader_options = reader_options;
-                }
-            }
-        }
-    }
-
-    if ( rc == 0 )
-    {
-        *cself = obj;
-/*        ALIGN_DBG( "max_open: %u", obj->num_open_max ); */
-    }
-    else
-    {
-        RefSeqMgr_Release( obj );
-        ALIGN_DBGERR( rc );
-    }
-    return rc;
-}
-
-static
-void CC RefSeqMgr_RefSeqWhack(BSTNode *n, void *data)
-{
-    RefSeq* self = (RefSeq*)n;
-    TableReaderRefSeq_Whack(self->reader);
-    free(self);
-}
-
-static
-void CC RefSeqMgr_VDbRelease(BSTNode *n, void *data)
-{
-    RefSeqMgr_Db* self = (RefSeqMgr_Db*)n;
-    VDatabaseRelease(self->db);
-    free(self);
-}
-
-LIB_EXPORT rc_t CC RefSeqMgr_Release(const RefSeqMgr* cself)
-{
-    if( cself != NULL ) {
-        RefSeqMgr* self = (RefSeqMgr*)cself;
-        BSTreeWhack(&self->tree, RefSeqMgr_RefSeqWhack, NULL);
-        BSTreeWhack(&self->vdbs, RefSeqMgr_VDbRelease, NULL);
-        VDBManagerRelease(self->vmgr);
-        KConfigRelease(self->kfg);
-        free(self);
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t RefSeqMgr_Exists(const RefSeqMgr* cself, const char* accession, uint32_t accession_sz, char** path)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL || accession == NULL || accession_sz == 0 ) {
-        rc = RC(rcAlign, rcIndex, rcAccessing, rcParam, rcNull);
-    }
-    else {
-#if USE_OWN_REFSEQ_RESOLVER
-        rc = RefSeqMgr_FindTable(cself, accession, accession_sz, NULL, path);
-#else
-        VTable const *tbl = NULL;
-
-        /* if "accession" is not a path,
-           prepend special scheme to tell VResolver
-           to treat WGS accessions as Refseq */
-        if ( string_chr ( accession, accession_sz, '/' ) == NULL )
-            rc = VDBManagerOpenTableRead(cself->vmgr, &tbl, NULL, "ncbi-acc:%.*s?vdb-ctx=refseq", accession_sz, accession);
-        else
-            rc = VDBManagerOpenTableRead(cself->vmgr, &tbl, NULL, "%.*s", accession_sz, accession);
-        if (tbl == NULL) {
-            ALIGN_DBG("failed to open %.*s", accession_sz, accession);
-            ALIGN_DBGERR(rc);
-        }
-        VTableRelease(tbl);
-#endif
-    }
-    return rc;
-}
-
-static
-int CC RefSeq_Cmp(const void* item, const BSTNode* node)
-{
-    const String* i = (const String*)item;
-    const RefSeq* n = (const RefSeq*)node;
-
-    if( i->size == n->accession_sz ) {
-        return strncasecmp(i->addr, n->accession, i->size);
-    }
-    return i->size - n->accession_sz;
-}
-
-static
-int CC RefSeq_Sort(const BSTNode* item, const BSTNode* node)
-{
-    const RefSeq* i = (const RefSeq*)item;
-    const RefSeq* n = (const RefSeq*)node;
-
-    if( i->accession_sz == n->accession_sz ) {
-        return strncasecmp(i->accession, n->accession, i->accession_sz);
-    }
-    return i->accession_sz - n->accession_sz;
-}
-
-LIB_EXPORT rc_t CC RefSeqMgr_Read(const RefSeqMgr* cself, const char* seq_id, uint32_t seq_id_sz,
-                                  INSDC_coord_zero offset, INSDC_coord_len len,
-                                  uint8_t* buffer, INSDC_coord_len* written)
-{
-    rc_t rc = 0;
-    const RefSeq* obj;
-
-    if( (rc = RefSeqMgr_GetSeq(cself, &obj, seq_id, seq_id_sz)) == 0 ) {
-        rc = RefSeq_Read(obj, offset, len, buffer, written);
-        RefSeq_Release(obj);
-    }
-    return rc;
-}
-
-static
-void CC RefSeq_Oldest( BSTNode *node, void *Data )
-{
-    RefSeq const *const n = (RefSeq const *)node;
-    RefSeq const **const rslt = (RefSeq const **)Data;
-    RefSeq const *const d = *rslt;
-    
-    if (n->reader != NULL && (d == NULL || n->usage < d->usage))
-        *rslt = n;
-}
-
-static
-rc_t RefSeqMgr_GetReader(RefSeqMgr *const mgr, RefSeq *const obj)
-{
-    rc_t rc = 0;
-    
-    if (obj->reader == NULL) {
-        VTable const *tbl;
-        
-        while (mgr->num_open_max > 0 && mgr->num_open >= mgr->num_open_max) {
-            RefSeq *old;
-            
-        REMOVE_OLDEST:
-            old = NULL;
-            BSTreeForEach(&mgr->tree, false, RefSeq_Oldest, &old);
-            if (old == NULL)
-                break;
-            
-            TableReaderRefSeq_Whack(old->reader);
-            old->reader = NULL;
-            --mgr->num_open;
-        }
-#if USE_OWN_REFSEQ_RESOLVER
-        rc = RefSeqMgr_FindTable(mgr, obj->accession, obj->accession_sz, &tbl, NULL);
-#else
-        /* if "accession" is not a path,
-           prepend special scheme to tell VResolver
-           to treat WGS accessions as Refseq */
-        if ( string_chr ( obj -> accession, obj -> accession_sz, '/' ) == NULL )
-            rc = VDBManagerOpenTableRead(mgr->vmgr, &tbl, NULL, "ncbi-acc:%.*s?vdb-ctx=refseq", obj->accession_sz, obj->accession);
-        else
-            rc = VDBManagerOpenTableRead(mgr->vmgr, &tbl, NULL, "%.*s", obj->accession_sz, obj->accession);
-#endif
-        if (rc == 0)
-            rc = TableReaderRefSeq_MakeTable(&obj->reader, mgr->vmgr, tbl,
-                                             mgr->reader_options, mgr->cache);
-        if (rc == 0) {
-            VTableRelease(tbl);
-            ++mgr->num_open;
-        }
-        else if ( GetRCObject(rc) == rcMemory &&
-                 (GetRCState (rc) == rcInsufficient || GetRCState(rc) == rcExhausted))
-        {
-            if (mgr->num_open_max == 0 || mgr->num_open < mgr->num_open_max)
-                return rc;
-            rc = 0;
-            goto REMOVE_OLDEST;
-        }
-        else
-            return rc;
-    }
-    mgr->last_used = obj;
-    return rc;
-}
-
-static
-rc_t RefSeqMgr_GetSeqInternal(RefSeqMgr *const mgr, RefSeq const **const cself,
-                              char const seq_id[], unsigned const seq_id_sz)
-{
-    
-    rc_t rc;
-    RefSeq *obj;
-    String s;
-    
-    StringInit(&s, seq_id, seq_id_sz, seq_id_sz);
-    
-    *cself = NULL;
-    if (mgr->last_used != NULL && RefSeq_Cmp(&s, &mgr->last_used->dad) == 0)
-        obj = mgr->last_used;
-    else {
-        obj = (RefSeq*)BSTreeFind(&mgr->tree, &s, RefSeq_Cmp);
-        if (obj == NULL) {
-            obj = calloc(1, sizeof(*obj) + seq_id_sz);
-            if (obj) {
-                memcpy(obj->accession, seq_id, seq_id_sz);
-                obj->accession_sz = seq_id_sz;
-                obj->mgr = mgr;
-                rc = BSTreeInsertUnique(&mgr->tree, &obj->dad, NULL, RefSeq_Sort);
-                if (rc) {
-                    free(obj);
-                    return rc;
-                }
-            }
-            else
-                return RC(rcAlign, rcIndex, rcConstructing, rcMemory, rcExhausted);
-        }
-    }
-    rc = RefSeqMgr_GetReader(mgr, obj);
-    *cself = obj;
-    
-    return rc;
-}
-
-LIB_EXPORT rc_t CC RefSeqMgr_GetSeq(const RefSeqMgr* cmgr, const RefSeq** cself, const char* seq_id, uint32_t seq_id_sz)
-{
-    rc_t rc;
-
-    if (cmgr == NULL || cself == NULL || seq_id == NULL)
-        rc = RC(rcAlign, rcIndex, rcConstructing, rcParam, rcNull);
-    else
-        rc = RefSeqMgr_GetSeqInternal((RefSeqMgr *)cmgr, cself, seq_id, seq_id_sz);
-
-    if (rc)
-        ALIGN_DBGERRP("SEQ_ID: '%.*s'", rc, seq_id_sz, seq_id);
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC RefSeq_Read(const RefSeq* cself, INSDC_coord_zero offset, INSDC_coord_len len,
-                               uint8_t* buffer, INSDC_coord_len* written)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL || buffer == NULL || written == NULL ) {
-        rc = RC(rcAlign, rcFile, rcReading, rcParam, rcNull);
-    }
-    else {
-        RefSeq *const self = (RefSeq *)cself;
-        RefSeqMgr *const mgr = (RefSeqMgr *)self->mgr;
-        
-        rc = RefSeqMgr_GetReader(mgr, self);
-        if (rc == 0) {
-            TableReaderRefSeq const *const reader = self->reader;
-            
-            rc = TableReaderRefSeq_Read(reader, offset, len, buffer, written);
-            if (rc == 0)
-                self->usage = ++mgr->usage;
-        }
-    }
-    ALIGN_DBGERR(rc);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC RefSeq_Circular(const RefSeq* cself, bool* circular)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL ) {
-        rc = RC(rcAlign, rcFile, rcReading, rcParam, rcNull);
-    } else {
-        rc = TableReaderRefSeq_Circular(cself->reader, circular);
-    }
-    ALIGN_DBGERR(rc);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC RefSeq_SeqLength(const RefSeq* cself, INSDC_coord_len* len)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL ) {
-        rc = RC(rcAlign, rcFile, rcReading, rcParam, rcNull);
-    } else {
-        rc = TableReaderRefSeq_SeqLength(cself->reader, len);
-    }
-    ALIGN_DBGERR(rc);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC RefSeq_MD5(const RefSeq* cself, const uint8_t** md5)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL ) {
-        rc = RC(rcAlign, rcFile, rcReading, rcParam, rcNull);
-    } else {
-        rc = TableReaderRefSeq_MD5(cself->reader, md5);
-    }
-    ALIGN_DBGERR(rc);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC RefSeq_Release(const RefSeq* cself)
-{
-    return 0;
-}
-
diff --git a/libs/align/writer-alignment.c b/libs/align/writer-alignment.c
deleted file mode 100644
index 031fde1..0000000
--- a/libs/align/writer-alignment.c
+++ /dev/null
@@ -1,430 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <align/extern.h>
-
-#include <klib/rc.h>
-#include <insdc/insdc.h>
-#include <vdb/database.h>
-#include <vdb/cursor.h>
-#include <align/writer-alignment.h>
-#include "writer-priv.h"
-#include "reader-cmn.h"
-#include "debug.h"
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <ctype.h>
-#include <assert.h>
-
-static const TableWriterColumn TableWriterAlgn_cols[ewalgn_cn_Last] =
-{
-    /* order is important, see enum in .h !!! */
-    {0, "TMP_KEY_ID", sizeof(uint64_t) * 8, ewcol_Temporary | ewcol_Ignore},
-    {0, "PLOIDY", sizeof(uint32_t) * 8, ewcol_Ignore},
-    {0, "SEQ_SPOT_ID", sizeof(int64_t) * 8, ewcol_IsArray | ewcol_Ignore},
-    {0, "SEQ_READ_ID", sizeof(INSDC_coord_one) * 8, ewcol_IsArray },
-    {0, "READ_START", sizeof(INSDC_coord_zero) * 8, ewcol_IsArray | ewcol_Ignore},
-    {0, "READ_LEN", sizeof(INSDC_coord_len) * 8, ewcol_IsArray | ewcol_Ignore},
-    {0, "REF_ID", sizeof(int64_t) * 8, ewcol_Ignore},
-    {0, "REF_START", sizeof(INSDC_coord_zero) * 8, ewcol_Ignore},
-    {0, "GLOBAL_REF_START", sizeof(uint64_t) * 8, 0},
-    {0, "REF_LEN", sizeof(INSDC_coord_len) * 8, 0},
-    {0, "REF_ORIENTATION", sizeof(bool) * 8, 0},
-    {0, "REF_PLOIDY", sizeof(uint32_t) * 8, ewcol_IsArray | ewcol_Ignore},
-    {0, "MATE_REF_ORIENTATION", sizeof(bool) * 8, ewcol_Ignore},
-    {0, "MATE_REF_ID", sizeof(int64_t) * 8, ewcol_Ignore},
-    {0, "MATE_REF_POS", sizeof(INSDC_coord_zero) * 8, ewcol_Ignore},
-    {0, "MATE_ALIGN_ID", sizeof(int64_t) * 8, ewcol_Ignore},
-    {0, "TEMPLATE_LEN", sizeof(INSDC_coord_zero) * 8, ewcol_Ignore},
-    {0, "MAPQ", sizeof(int32_t) * 8, 0},
-    {0, "HAS_MISMATCH", sizeof(bool) * 8, ewcol_IsArray},
-    {0, "(bool)HAS_REF_OFFSET", sizeof(bool) * 8, ewcol_IsArray},
-    {0, "MISMATCH", sizeof(INSDC_dna_text) * 8, ewcol_IsArray},
-    {0, "REF_OFFSET", sizeof(int32_t) * 8, ewcol_IsArray},
-    {0, "EVIDENCE_ALIGNMENT_IDS", sizeof(int64_t) * 8, ewcol_IsArray | ewcol_Ignore},
-    {0, "ALIGN_GROUP", sizeof(char) * 8, ewcol_IsArray | ewcol_Ignore },
-    {0, "MISMATCH_QUALITY", sizeof(uint8_t) * 8, ewcol_IsArray | ewcol_Ignore},
-    {0, "MATE_GLOBAL_REF_START", sizeof(uint64_t) * 8, ewcol_Ignore},
-    {0, "MATE_REF_START", sizeof(INSDC_coord_zero) * 8, ewcol_Ignore}
-};
-
-static const TableReaderColumn TableAlgnReadTmpKey_cols[] = {
-    {0, "TMP_KEY_ID", {NULL}, 0, 0},
-    {0, "GLOBAL_REF_START", {NULL}, 0, ercol_Skip},
-    {0, "REF_ID", {NULL}, 0, ercol_Skip},
-    {0, "REF_START", {NULL}, 0, ercol_Skip},
-    {0, NULL, {NULL}, 0, 0}
-};
-
-struct TableWriterAlgn {
-    uint32_t options;
-    const TableWriter* base;
-    const char* ref_table_name;
-    uint8_t cursor_id;
-    TableWriterColumn cols[ewalgn_cn_Last];
-    uint8_t spotid_cursor_id;
-    TableWriterColumn cols_spotid[5];
-    const TableReader* tmpkey_reader;
-    TableReaderColumn cols_read_tmpkey[sizeof(TableAlgnReadTmpKey_cols) / sizeof(TableAlgnReadTmpKey_cols[0])];
-};
-
-LIB_EXPORT rc_t CC TableWriterAlgn_Make(const TableWriterAlgn** cself, VDatabase* db,
-                                        ETableWriterAlgn_TableType type, uint32_t options)
-{
-    rc_t rc = 0;
-    TableWriterAlgn* self = NULL;
-    const char* tbl_nm = __func__;
-
-    if( cself == NULL || db == NULL ) {
-        rc = RC(rcAlign, rcFormatter, rcConstructing, rcParam, rcNull);
-    } else {
-        self = calloc(1, sizeof(*self));
-        if( self == NULL ) {
-            rc = RC(rcAlign, rcFormatter, rcConstructing, rcMemory, rcExhausted);
-        } else {
-            self->ref_table_name = "REFERENCE";
-            memcpy(self->cols, TableWriterAlgn_cols, sizeof(TableWriterAlgn_cols));
-            switch(type) {
-            case ewalgn_tabletype_PrimaryAlignment:
-                tbl_nm = "PRIMARY_ALIGNMENT";
-                self->cols[ewalgn_cn_ALIGN_GROUP].flags &= ~ewcol_Ignore;
-                if (options & ewalgn_co_MISMATCH_QUALITY)
-                    self->cols[ewalgn_cn_MISMATCH_QUALITY].flags &= ~ewcol_Ignore;
-                break;
-            case ewalgn_tabletype_SecondaryAlignment:
-                tbl_nm = "SECONDARY_ALIGNMENT";
-#if 0
-                self->cols[ewalgn_cn_HAS_MISMATCH].flags |= ewcol_Ignore;
-                self->cols[ewalgn_cn_MISMATCH].flags |= ewcol_Ignore;
-#else
-                self->cols[ewalgn_cn_MISMATCH].name = "TMP_MISMATCH";
-                self->cols[ewalgn_cn_HAS_MISMATCH].name = "TMP_HAS_MISMATCH";
-#endif
-                self->cols[ewalgn_cn_MATE_REF_ORIENTATION].flags &= ~ewcol_Ignore;
-                self->cols[ewalgn_cn_MATE_REF_ID].flags &= ~ewcol_Ignore;
-                self->cols[ewalgn_cn_MATE_REF_POS].flags &= ~ewcol_Ignore;
-                self->cols[ewalgn_cn_MATE_ALIGN_ID].flags &= ~ewcol_Ignore;
-                self->cols[ewalgn_cn_TEMPLATE_LEN].flags &= ~ewcol_Ignore;
-                break;
-            case ewalgn_tabletype_EvidenceInterval:
-                tbl_nm = "EVIDENCE_INTERVAL";
-                options |= ewalgn_co_unsorted;
-                options |= ewalgn_co_PLOIDY;
-                self->cols[ewalgn_cn_SEQ_SPOT_ID].flags |= ewcol_Ignore;
-                self->cols[ewalgn_cn_SEQ_READ_ID].flags |= ewcol_Ignore;
-                self->cols[ewalgn_cn_EVIDENCE_ALIGNMENT_IDS].flags &= ~ewcol_Ignore;
-                break;
-            case ewalgn_tabletype_EvidenceAlignment:
-                tbl_nm = "EVIDENCE_ALIGNMENT";
-                self->ref_table_name = "EVIDENCE_INTERVAL";
-                self->cols[ewalgn_cn_REF_PLOIDY].flags &= ~ewcol_Ignore;
-#if 0
-                self->cols[ewalgn_cn_HAS_MISMATCH].flags |= ewcol_Ignore;
-                self->cols[ewalgn_cn_MISMATCH].flags |= ewcol_Ignore;
-#else
-                self->cols[ewalgn_cn_MISMATCH].name = "TMP_MISMATCH";
-                self->cols[ewalgn_cn_HAS_MISMATCH].name = "TMP_HAS_MISMATCH";
-#endif
-                options |= ewalgn_co_unsorted;
-                break;
-            default:
-                rc = RC(rcAlign, rcFormatter, rcConstructing, rcType, rcUnrecognized);
-            }
-            if( options & ewalgn_co_SEQ_SPOT_ID ) {
-                self->cols[ewalgn_cn_SEQ_SPOT_ID].flags &= ~ewcol_Ignore;
-            }
-            if( options & ewalgn_co_TMP_KEY_ID ) {
-                self->cols[ewalgn_cn_TMP_KEY_ID].flags &= ~ewcol_Ignore;
-            }
-            if( options & ewalgn_co_PLOIDY ) {
-                self->cols[ewalgn_cn_PLOIDY].flags &= ~ewcol_Ignore;
-                self->cols[ewalgn_cn_READ_START].flags &= ~ewcol_Ignore;
-                self->cols[ewalgn_cn_READ_LEN].flags &= ~ewcol_Ignore;
-            }
-            if( options & ewalgn_co_unsorted ) {
-                self->cols[ewalgn_cn_REF_ID].flags &= ~ewcol_Ignore;
-                self->cols[ewalgn_cn_REF_START].flags &= ~ewcol_Ignore;
-                self->cols[ewalgn_cn_GLOBAL_REF_START].flags |= ewcol_Ignore;
-                if( type == ewalgn_tabletype_SecondaryAlignment ) {
-                    self->cols[ewalgn_cn_MISMATCH].name = "TMP_MISMATCH";
-                    self->cols[ewalgn_cn_MISMATCH].flags &= ~ewcol_Ignore;
-                    self->cols[ewalgn_cn_HAS_MISMATCH].name = "TMP_HAS_MISMATCH";
-                    self->cols[ewalgn_cn_HAS_MISMATCH].flags &= ~ewcol_Ignore;
-                }
-            }
-            if( options & ewalgn_co_MATE_ALIGN_ID_only ) {
-                self->cols[ewalgn_cn_MATE_REF_ORIENTATION].flags |= ewcol_Ignore;
-                self->cols[ewalgn_cn_MATE_REF_ID].flags |= ewcol_Ignore;
-                self->cols[ewalgn_cn_MATE_REF_POS].flags |= ewcol_Ignore;
-                self->cols[ewalgn_cn_TEMPLATE_LEN].flags |= ewcol_Ignore;
-            }
-            if( (rc = TableWriter_Make(&self->base, db, tbl_nm, NULL)) == 0 ) {
-                rc = TableWriter_AddCursor(self->base, self->cols, sizeof(self->cols)/sizeof(self->cols[0]), &self->cursor_id);
-                self->options = options;
-            }
-        }
-    }
-    if( rc == 0 ) {
-        *cself = self;
-        ALIGN_DBG("table %s created", tbl_nm);
-    } else {
-        TableWriterAlgn_Whack(self, false, NULL);
-        ALIGN_DBGERR(rc);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC TableWriterAlgn_Whack(const TableWriterAlgn* cself, bool commit, uint64_t* rows)
-{
-    rc_t rc = 0;
-    if( cself != NULL ) {
-        VTable* vtbl;
-
-        TableReader_Whack(cself->tmpkey_reader);
-        if( (rc = TableWriter_GetVTable(cself->base, &vtbl)) == 0 ) {
-            KMetadata* meta;
-            if( (rc = VTableOpenMetadataUpdate(vtbl, &meta)) == 0 ) {
-                KMDataNode* node;
-                if( (rc = KMetadataOpenNodeUpdate(meta, &node, "CONFIG/REF_TABLE")) == 0 ) {
-                    rc = KMDataNodeWriteCString(node, cself->ref_table_name);
-                    KMDataNodeRelease(node);
-                }
-                KMetadataRelease(meta);
-            }
-        }
-        rc = TableWriter_Whack(cself->base, commit, rows);
-        free((TableWriterAlgn*)cself);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC TableWriterAlgn_WriteDefault(const TableWriterAlgn* cself, enum ETableWriterAlgn_ColNames col, const TableWriterData* data)
-{
-    return TableWriter_ColumnDefault(cself->base, 0, &cself->cols[col], data);
-}
-
-LIB_EXPORT rc_t CC TableWriterAlgn_GetNextRowId(const TableWriterAlgn* cself, int64_t* rowid)
-{
-    return TableWriter_GetNextRowId(cself->base, rowid, cself->cursor_id);
-}
-
-LIB_EXPORT rc_t CC TableWriterAlgn_Write(const TableWriterAlgn* cself, const TableWriterAlgnData* data, int64_t* rowid)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL || data == NULL ) {
-        rc = RC( rcAlign, rcType, rcWriting, rcParam, rcNull);
-        ALIGN_DBGERR(rc);
-    } else if( (rc = TableWriter_OpenRow(cself->base, rowid, cself->cursor_id)) == 0 ) {
-        TW_COL_WRITE_VAR(cself->base, cself->cols[ewalgn_cn_PLOIDY], data->ploidy);
-
-        TW_COL_WRITE(cself->base, cself->cols[ewalgn_cn_SEQ_SPOT_ID], data->seq_spot_id);
-        TW_COL_WRITE(cself->base, cself->cols[ewalgn_cn_SEQ_READ_ID], data->seq_read_id);
-        TW_COL_WRITE(cself->base, cself->cols[ewalgn_cn_READ_START], data->read_start);
-        TW_COL_WRITE(cself->base, cself->cols[ewalgn_cn_READ_LEN], data->read_len);
-        TW_COL_WRITE(cself->base, cself->cols[ewalgn_cn_TMP_KEY_ID], data->tmp_key_id);
-
-        TW_COL_WRITE(cself->base, cself->cols[ewalgn_cn_HAS_REF_OFFSET], data->has_ref_offset);
-        TW_COL_WRITE(cself->base, cself->cols[ewalgn_cn_REF_OFFSET], data->ref_offset);
-        TW_COL_WRITE(cself->base, cself->cols[ewalgn_cn_REF_ID], data->ref_id);
-        TW_COL_WRITE(cself->base, cself->cols[ewalgn_cn_REF_START], data->ref_start);
-        TW_COL_WRITE(cself->base, cself->cols[ewalgn_cn_GLOBAL_REF_START], data->global_ref_start);
-        TW_COL_WRITE(cself->base, cself->cols[ewalgn_cn_HAS_MISMATCH], data->has_mismatch);
-        TW_COL_WRITE(cself->base, cself->cols[ewalgn_cn_MISMATCH], data->mismatch);
-        TW_COL_WRITE_VAR(cself->base, cself->cols[ewalgn_cn_REF_LEN], data->ref_len);
-
-        TW_COL_WRITE(cself->base, cself->cols[ewalgn_cn_REF_ORIENTATION], data->ref_orientation);
-        TW_COL_WRITE(cself->base, cself->cols[ewalgn_cn_REF_PLOIDY], data->ref_ploidy);
-        TW_COL_WRITE(cself->base, cself->cols[ewalgn_cn_MAPQ], data->mapq);
-
-        if( data->mate_align_id.elements != 1 ) {
-            TW_COL_WRITE(cself->base, cself->cols[ewalgn_cn_MATE_ALIGN_ID], data->mate_align_id);
-        } else {
-            TW_COL_WRITE_BUF(cself->base, cself->cols[ewalgn_cn_MATE_ALIGN_ID], data->mate_align_id.buffer,
-                             ((const int64_t*)(data->mate_align_id.buffer))[0] ? 1 : 0);
-        }
-        TW_COL_WRITE(cself->base, cself->cols[ewalgn_cn_MATE_REF_ORIENTATION], data->mate_ref_orientation);
-        TW_COL_WRITE(cself->base, cself->cols[ewalgn_cn_MATE_REF_ID], data->mate_ref_id);
-        TW_COL_WRITE(cself->base, cself->cols[ewalgn_cn_MATE_REF_POS], data->mate_ref_pos);
-        TW_COL_WRITE(cself->base, cself->cols[ewalgn_cn_TEMPLATE_LEN], data->template_len);
-        TW_COL_WRITE(cself->base, cself->cols[ewalgn_cn_EVIDENCE_ALIGNMENT_IDS], data->alingment_ids);
-        TW_COL_WRITE(cself->base, cself->cols[ewalgn_cn_ALIGN_GROUP], data->align_group);
-
-        if( rc == 0 ) {
-            rc = TableWriter_CloseRow(cself->base);
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC TableWriterAlgn_TmpKeyStart(const TableWriterAlgn* cself)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL ) {
-        rc = RC(rcAlign, rcType, rcWriting, rcParam, rcNull);
-        ALIGN_DBGERR(rc);
-    } else if( (cself->options & ewalgn_co_SEQ_SPOT_ID) || !(cself->options & ewalgn_co_TMP_KEY_ID) ) {
-        rc = RC(rcAlign, rcType, rcWriting, rcParam, rcViolated);
-        ALIGN_DBGERR(rc);
-    } else if( (rc = TableWriter_CloseCursor(cself->base, cself->cursor_id, NULL)) == 0 ) {
-        TableWriterAlgn* self = (TableWriterAlgn*)cself;
-        VTable* vtbl = NULL;
-        
-        memcpy(&self->cols_read_tmpkey, &TableAlgnReadTmpKey_cols, sizeof(TableAlgnReadTmpKey_cols));
-        if (self->cols[ewalgn_cn_GLOBAL_REF_START].flags & ewcol_Ignore) {
-            self->cols_read_tmpkey[2].flags = 0;
-            self->cols_read_tmpkey[3].flags = 0;
-        }
-        else
-            self->cols_read_tmpkey[1].flags = 0;
-
-        if( (rc = TableWriter_GetVTable(self->base, &vtbl)) == 0 &&
-            (rc = TableReader_Make(&self->tmpkey_reader, vtbl, self->cols_read_tmpkey, 50 * 1024 * 1024)) == 0 ) {
-            int64_t v = 0;
-            
-            memcpy(self->cols_spotid + 0, &TableWriterAlgn_cols[ewalgn_cn_SEQ_SPOT_ID], sizeof(self->cols_spotid[0]));
-            memcpy(self->cols_spotid + 1, &TableWriterAlgn_cols[ewalgn_cn_MATE_GLOBAL_REF_START], sizeof(self->cols_spotid[0]));
-            memcpy(self->cols_spotid + 2, &TableWriterAlgn_cols[ewalgn_cn_MATE_REF_ID], sizeof(self->cols_spotid[0]));
-            memcpy(self->cols_spotid + 3, &TableWriterAlgn_cols[ewalgn_cn_MATE_REF_START], sizeof(self->cols_spotid[0]));
-            memcpy(self->cols_spotid + 4, &TableWriterAlgn_cols[ewalgn_cn_MATE_ALIGN_ID], sizeof(self->cols_spotid[0]));
-            
-            self->cols_spotid[0].flags &= ~ewcol_Ignore;
-            if (self->options & ewalgn_co_MATE_POSITION) {
-                if (self->cols[ewalgn_cn_GLOBAL_REF_START].flags & ewcol_Ignore) {
-                    self->cols_spotid[2].flags &= ~ewcol_Ignore;
-                    self->cols_spotid[3].flags &= ~ewcol_Ignore;
-                }
-                else
-                    self->cols_spotid[1].flags &= ~ewcol_Ignore;
-                self->cols_spotid[4].flags &= ~ewcol_Ignore;
-            }
-            else {
-                self->cols_spotid[1].flags |= ewcol_Ignore;
-                self->cols_spotid[2].flags |= ewcol_Ignore;
-                self->cols_spotid[3].flags |= ewcol_Ignore;
-                self->cols_spotid[4].flags |= ewcol_Ignore;
-            }
-            rc = TableWriter_AddCursor(self->base, self->cols_spotid,
-                                       sizeof(self->cols_spotid) / sizeof(self->cols_spotid[0]),
-                                       &self->spotid_cursor_id);
-
-            TW_COL_WRITE_DEF_VAR(self->base, self->spotid_cursor_id, self->cols_spotid[0], v);
-            TW_COL_WRITE_DEF_VAR(self->base, self->spotid_cursor_id, self->cols_spotid[1], v);
-            TW_COL_WRITE_DEF_VAR(self->base, self->spotid_cursor_id, self->cols_spotid[2], v);
-            TW_COL_WRITE_DEF_VAR(self->base, self->spotid_cursor_id, self->cols_spotid[3], v);
-            TW_COL_WRITE_DEF_VAR(self->base, self->spotid_cursor_id, self->cols_spotid[4], v);
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC TableWriterAlgn_TmpKey(const TableWriterAlgn* cself, int64_t rowid, uint64_t* key_id)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL || rowid == 0 || key_id == NULL ) {
-        rc = RC( rcAlign, rcType, rcReading, rcParam, rcNull);
-        ALIGN_DBGERR(rc);
-    } else if( cself->tmpkey_reader == NULL ) {
-        rc = RC( rcAlign, rcType, rcReading, rcMode, rcNotOpen);
-        ALIGN_DBGERR(rc);
-    } else if( (rc = TableReader_ReadRow(cself->tmpkey_reader, rowid)) == 0 ) {
-        memcpy(key_id, cself->cols_read_tmpkey[0].base.var, sizeof(*key_id));
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC TableWriterAlgn_RefStart(const TableWriterAlgn* cself, int64_t rowid, ReferenceStart *const rslt)
-{
-    rc_t rc = 0;
-    
-    if( cself == NULL || rowid == 0 || rslt == NULL ) {
-        rc = RC( rcAlign, rcType, rcReading, rcParam, rcNull);
-        ALIGN_DBGERR(rc);
-    } else if( cself->tmpkey_reader == NULL ) {
-        rc = RC( rcAlign, rcType, rcReading, rcMode, rcNotOpen);
-        ALIGN_DBGERR(rc);
-    } else if( (rc = TableReader_ReadRow(cself->tmpkey_reader, rowid)) == 0 ) {
-        if (cself->cols_read_tmpkey[1].flags & ewcol_Ignore) {
-            memcpy(&rslt->local.ref_id, cself->cols_read_tmpkey[2].base.var, sizeof(rslt->local.ref_id));
-            memcpy(&rslt->local.ref_start, cself->cols_read_tmpkey[3].base.var, sizeof(rslt->local.ref_start));
-        }
-        else
-            memcpy(&rslt->global_ref_start, cself->cols_read_tmpkey[1].base.var, sizeof(rslt->global_ref_start));
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC TableWriterAlgn_Write_SpotId(const TableWriterAlgn* cself, int64_t rowid, int64_t spot_id)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL || rowid == 0 ) {
-        rc = RC( rcAlign, rcType, rcWriting, rcParam, rcNull);
-        ALIGN_DBGERR(rc);
-    } else if( cself->options & ewalgn_co_SEQ_SPOT_ID ) {
-        rc = RC( rcAlign, rcType, rcWriting, rcParam, rcViolated);
-        ALIGN_DBGERR(rc);
-    } else if( (rc = TableWriter_OpenRowId(cself->base, rowid, cself->spotid_cursor_id)) == 0 ) {
-        TW_COL_WRITE_VAR(cself->base, cself->cols_spotid[0], spot_id);
-        if( rc == 0 ) {
-            rc = TableWriter_CloseRow(cself->base);
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC TableWriterAlgn_Write_SpotInfo(const TableWriterAlgn* cself,
-                                                  int64_t rowid,
-                                                  int64_t spot_id,
-                                                  int64_t mate_id,
-                                                  ReferenceStart const *ref_start)
-{
-    rc_t rc = 0;
-    
-    if( cself == NULL || rowid == 0 ) {
-        rc = RC( rcAlign, rcType, rcWriting, rcParam, rcNull);
-        ALIGN_DBGERR(rc);
-    } else if( cself->options & ewalgn_co_SEQ_SPOT_ID ) {
-        rc = RC( rcAlign, rcType, rcWriting, rcParam, rcViolated);
-        ALIGN_DBGERR(rc);
-    } else if( (rc = TableWriter_OpenRowId(cself->base, rowid, cself->spotid_cursor_id)) == 0 ) {
-        TW_COL_WRITE_VAR(cself->base, cself->cols_spotid[0], spot_id);
-        TW_COL_WRITE_VAR(cself->base, cself->cols_spotid[1], ref_start->global_ref_start);
-        TW_COL_WRITE_VAR(cself->base, cself->cols_spotid[2], ref_start->local.ref_id);
-        TW_COL_WRITE_VAR(cself->base, cself->cols_spotid[3], ref_start->local.ref_start);
-        TW_COL_WRITE_VAR(cself->base, cself->cols_spotid[4], mate_id);
-        
-        if( rc == 0 ) {
-            rc = TableWriter_CloseRow(cself->base);
-        }
-    }
-    return rc;
-}
diff --git a/libs/align/writer-cmn.c b/libs/align/writer-cmn.c
deleted file mode 100644
index 4659a1d..0000000
--- a/libs/align/writer-cmn.c
+++ /dev/null
@@ -1,568 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <klib/rc.h>
-#include <klib/log.h>
-#include <klib/printf.h>
-#include <klib/text.h>
-#include <kdb/meta.h>
-#include <kapp/main.h>
-#include <vdb/table.h>
-#include <vdb/cursor.h>
-#include <vdb/schema.h>
-#include <vdb/vdb-priv.h>
-#include <align/writer-cmn.h>
-#include "writer-priv.h"
-#include "debug.h"
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-#define TW_MAX_CURSORS 8
-
-struct TableWriter {
-    /* db OR mgr not both */
-    VDatabase* vdb;
-    VDBManager* vmgr;
-    char* table_path;
-    VSchema* vschema;
-    bool is_update;
-
-    VTable* vtbl;
-    char* table;
-    struct {
-        uint32_t col_qty; /* != 0 cursor is used */
-        const TableWriterColumn* cols;
-        VCursor* cursor; /* != NULL cursor is opened */
-        uint64_t rows;
-    } *curr, cursors[TW_MAX_CURSORS];
-};
-
-static
-rc_t TableWriter_Init(TableWriter** self, const char* table, const char* table_path)
-{
-    rc_t rc = 0;
-
-    if( self == NULL || table == NULL ) {
-        rc = RC(rcAlign, rcType, rcConstructing, rcParam, rcNull);
-    } else if( (*self = calloc(1, sizeof(**self))) == NULL ) {
-        rc = RC(rcAlign, rcType, rcConstructing, rcMemory, rcExhausted);
-    } else {
-        (*self)->table = string_dup( table, string_size( table ) );
-        if( (*self)->table == NULL ) {
-            rc = RC(rcAlign, rcType, rcConstructing, rcMemory, rcExhausted);
-        } else if( table_path != NULL ) {
-            (*self)->table_path = string_dup( table_path, string_size( table_path ) );
-            if( (*self)->table_path == NULL ) {
-                rc = RC(rcAlign, rcType, rcConstructing, rcMemory, rcExhausted);
-            }
-        }
-    }
-    return rc;
-}
-
-static
-rc_t TableWriter_OpenCursor(const TableWriter* cself, uint8_t cursor_id)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL || cursor_id >= TW_MAX_CURSORS || cself->cursors[cursor_id].col_qty == 0 ) {
-        rc = RC(rcAlign, rcType, rcConstructing, rcParam, rcInvalid);
-    } else if( cself->cursors[cursor_id].cursor == NULL ) {
-        TableWriter* self = (TableWriter*)cself;
-
-        if( self->vtbl == NULL ) {
-            if( self->vmgr != NULL ) {
-                rc = VDBManagerCreateTable(self->vmgr, &self->vtbl, self->vschema, self->table, kcmCreate | kcmMD5, self->table_path);
-            } else if( self->is_update ) {
-                rc = VDatabaseOpenTableUpdate(self->vdb, &self->vtbl, self->table);
-            } else {
-                rc = VDatabaseCreateTable(self->vdb, &self->vtbl, self->table, kcmCreate | kcmMD5, self->table_path);
-            }
-        }
-
-        if( rc == 0 &&
-            (rc = VTableColumnCreateParams(self->vtbl, kcmCreate, kcsCRC32, 0)) == 0 &&
-            (rc = VTableCreateCursorWrite(self->vtbl, &self->cursors[cursor_id].cursor, kcmInsert)) == 0 ) {
-            uint32_t i;
-            for(i = 0; rc == 0 && i < self->cursors[cursor_id].col_qty; i++) {
-                if( !(self->cursors[cursor_id].cols[i].flags & ewcol_Ignore) ) {
-                    if( (rc = VCursorAddColumn(self->cursors[cursor_id].cursor,
-                                               (uint32_t*)&self->cursors[cursor_id].cols[i].idx,
-                                               self->cursors[cursor_id].cols[i].name)) == 0 ) {
-                        ALIGN_DBG("column %s opened", self->cursors[cursor_id].cols[i].name);
-                    } else {
-                        (void)PLOGERR(klogErr, (klogErr, rc, "table $(table) failed to create column '$(column)'",
-                                                             "table=%s,column=%s", self->table, self->cursors[cursor_id].cols[i].name));
-                    }
-                }
-            }
-            if( rc == 0 ) {
-                rc = VCursorOpen(self->cursors[cursor_id].cursor);
-            }
-        }
-        if( rc == 0 ) {
-            ALIGN_DBG("table %s opened cursor %u for writing", self->table, cursor_id);
-        } else {
-            ALIGN_DBGERRP("table %s failed to open cursor %u for writing", rc, self->table, cursor_id);
-        }
-    }
-    return rc;
-}
-
-rc_t CC TableWriter_Make(const TableWriter** cself, VDatabase *db, const char* table, const char* table_path)
-{
-    rc_t rc = 0;
-    TableWriter* obj = NULL;
-
-    if( cself == NULL ) {
-        rc = RC(rcAlign, rcType, rcConstructing, rcParam, rcNull);
-    } else if( (rc = TableWriter_Init(&obj, table, table_path ? table_path : table)) == 0 &&
-               (rc = VDatabaseAddRef(db)) == 0 ) {
-        obj->vdb = db;
-    }
-    if( rc == 0 ) {
-        *cself = obj;
-        ALIGN_DBG("table %s opened for writing", (*cself)->table);
-    } else {
-        TableWriter_Whack(obj, false, NULL);
-        ALIGN_DBGERRP("table %s at %s", rc, table, table_path);
-    }
-    return rc;
-}
-
-rc_t CC TableWriter_MakeMgr(const TableWriter** cself, VDBManager* mgr, const char* schema_path,
-                            const char* type, const char* table_path)
-{
-    rc_t rc = 0;
-    TableWriter* obj = NULL;
-
-    if( cself == NULL || mgr == NULL || schema_path == NULL || type == NULL || table_path == NULL) {
-        rc = RC(rcAlign, rcType, rcConstructing, rcParam, rcNull);
-    } else if( (rc = TableWriter_Init(&obj, type, table_path)) == 0 &&
-               (rc = VDBManagerMakeSchema(mgr, &obj->vschema)) == 0 &&
-               (rc = VSchemaParseFile(obj->vschema, schema_path)) == 0 &&
-               (rc = VDBManagerAddRef(mgr)) == 0 ) {
-       obj->vmgr = mgr;
-    }
-    if( rc == 0 ) {
-        *cself = obj;
-        ALIGN_DBG("table %s at %s opened for writing", (*cself)->table, (*cself)->table_path);
-    } else {
-        TableWriter_Whack(obj, false, NULL);
-        ALIGN_DBGERRP("table %s at %s", rc, type, table_path);
-    }
-    return rc;
-}
-
-rc_t CC TableWriter_MakeUpdate(const TableWriter** cself, VDatabase *db, const char* table)
-{
-    rc_t rc = 0;
-    TableWriter* obj = NULL;
-
-    if( cself == NULL || db == NULL ) {
-        rc = RC(rcAlign, rcType, rcConstructing, rcParam, rcNull);
-    } else if( (rc = TableWriter_Init(&obj, table, NULL)) == 0 &&
-               (rc = VDatabaseAddRef(db)) == 0 ) {
-        obj->is_update = true;
-        obj->vdb = db;
-    }
-    if( rc == 0 ) {
-        *cself = obj;
-        ALIGN_DBG("table %s opened for update", (*cself)->table);
-    } else {
-        TableWriter_Whack(obj, false, NULL);
-        ALIGN_DBGERRP("table %s", rc, table);
-    }
-    return rc;
-}
-
-rc_t CC TableWriter_GetVTable(const TableWriter* cself, VTable** vtbl)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL || vtbl == NULL ) {
-        rc = RC(rcAlign, rcType, rcAccessing, rcParam, rcNull);
-    } else {
-        *vtbl = cself->vtbl;
-    }
-    return rc;
-}
-
-rc_t CC TableWriter_Sign(const TableWriter *const cself,
-                         const char loader_name[],
-                         const ver_t loader_version,
-                         const char loader_date[],
-                         const char app_name[],
-                         const ver_t app_version)
-{
-    rc_t rc = 0;
-    KMetadata* meta = NULL;
-    KMDataNode* root = NULL;
-
-    if( cself == NULL || loader_name == NULL || loader_date == NULL || app_name == NULL || app_version == 0 ) {
-        rc = RC(rcAlign, rcMetadata, rcWriting, rcParam, rcNull);
-    } else if( (rc = VTableOpenMetadataUpdate(cself->vtbl, &meta)) == 0 &&
-               (rc = KMetadataOpenNodeUpdate(meta, &root, "/")) == 0 ) {
-        KMDataNode *node = NULL;
-        if( (rc = KMDataNodeOpenNodeUpdate(root, &node, "SOFTWARE")) == 0 ) {
-            char str_vers[64];
-            KMDataNode *subNode = NULL;
-            if( (rc = KMDataNodeOpenNodeUpdate(node, &subNode, "loader")) == 0 ) {
-                if( (rc = string_printf(str_vers, sizeof(str_vers), NULL, "%V", loader_version)) == 0 ) {
-                    rc = KMDataNodeWriteAttr(subNode, "vers", str_vers);
-                }
-                if(rc == 0) {
-                    rc = KMDataNodeWriteAttr(subNode, "date", loader_date);
-                }
-                if(rc == 0) {
-                    const char* tool_name = strrchr(loader_name, '/');
-                    const char* r = strrchr(loader_name, '\\');
-                    if( tool_name != NULL && r != NULL && tool_name < r ) {
-                        tool_name = r;
-                    }
-                    if( tool_name++ == NULL) {
-                        tool_name = loader_name;
-                    }
-                    rc = KMDataNodeWriteAttr(subNode, "name", tool_name);
-                }
-                KMDataNodeRelease(subNode);
-            }
-            if(rc == 0 && (rc = KMDataNodeOpenNodeUpdate(node, &subNode, "formatter")) == 0 ) {
-                if( (rc = string_printf(str_vers, sizeof(str_vers), NULL, "%V", app_version)) == 0 ) {
-                    rc = KMDataNodeWriteAttr(subNode, "vers", str_vers);
-                }
-                if(rc == 0) {
-                    rc = KMDataNodeWriteAttr(subNode, "name", app_name);
-                }
-                KMDataNodeRelease(subNode);
-            }
-            KMDataNodeRelease(node);
-        }
-        if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(root, &node, "LOAD")) == 0 ) {
-            KMDataNode *subNode = NULL;
-            if( (rc = KMDataNodeOpenNodeUpdate(node, &subNode, "timestamp")) == 0 ) {
-                time_t t = time(NULL);
-                rc = KMDataNodeWrite(subNode, &t, sizeof(t));
-                KMDataNodeRelease(subNode);
-            }
-            KMDataNodeRelease(node);
-        }
-    }
-    KMDataNodeRelease(root);
-    KMetadataRelease(meta);
-    return rc;
-}
-
-rc_t CC TableWriter_Whack(const TableWriter* cself, bool commit, uint64_t* rows)
-{
-    rc_t rc = 0;
-
-    if( rows != NULL ) {
-        *rows = 0;
-    }
-    if( cself != NULL ) {
-        TableWriter* self = (TableWriter*)cself;
-        uint32_t i, j;
-        
-        for(i = 0; i < TW_MAX_CURSORS; i++) {
-            if( self->cursors[i].col_qty > 0 ) {
-                self->curr = &self->cursors[i];
-                if( self->curr->cursor != NULL ) {
-                    rc_t rc1 = 0, rc2;
-                    if( commit ) {
-                        rc1 = VCursorCommit(self->curr->cursor);
-                    }
-                    rc2 = VCursorRelease(self->curr->cursor);
-                    rc = rc ? rc : (rc1 ? rc1 : rc2);
-                    self->curr->cursor = NULL;
-                }
-                if( i == 0 && rows != NULL ) {
-                    *rows = self->curr->rows;
-                }
-            }
-        }
-        for(i = 0; i < TW_MAX_CURSORS; i++) {
-            if( self->cursors[i].col_qty > 0 ) {
-                self->curr = &self->cursors[i];
-                for(j = 0; j < self->curr->col_qty; j++) {
-                    if( self->curr->cols[j].idx != 0 && (self->curr->cols[j].flags & ewcol_Temporary) ) {
-                        rc_t rc1;
-                        if( (rc1 = VTableDropColumn(self->vtbl, self->curr->cols[j].name)) != 0 ) {
-                            (void)PLOGERR(klogWarn, (klogWarn, rc1,
-                                "table $(table) failed to drop temporary column '$(column)'",
-                                "table=%s,column=%s", self->table, self->curr->cols[j].name));
-                        } else {
-                            ALIGN_DBG("table %s dropped tmp col %s", self->table, self->curr->cols[j].name);
-                        }
-                    }
-                }
-            }
-        }
-        if( commit && rc == 0 && self->vtbl != NULL ) {
-            rc = VTableReindex(self->vtbl);
-        }
-        VTableRelease(self->vtbl);
-        VSchemaRelease(self->vschema);
-        VDBManagerRelease(self->vmgr);
-        VDatabaseRelease(self->vdb);
-        if( rc == 0 ) {
-            ALIGN_DBG("table %s%s%s", self->table, self->table_path ? " at " : "", self->table_path ? self->table_path : "");
-        } else {
-            ALIGN_DBGERRP("table %s%s%s", rc, self->table, self->table_path ? " at " : "", self->table_path ? self->table_path : "");
-        }
-        free(self->table);
-        free(self->table_path);
-        free(self);
-    }
-    return rc;
-}
-
-rc_t CC TableWriter_AddCursor(const TableWriter* cself, TableWriterColumn* cols, uint32_t col_qty, uint8_t* cursor_id)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL || cols == NULL || col_qty == 0 || cursor_id == NULL ) {
-        rc = RC(rcAlign, rcType, rcOpening, rcParam, rcInvalid);
-        ALIGN_DBGERR(rc);
-    } else {
-        uint32_t i;
-        TableWriter* self = (TableWriter*)cself;
-
-        *cursor_id = TW_MAX_CURSORS;
-        for(i = 0; i < TW_MAX_CURSORS; i++) {
-            if( self->cursors[i].col_qty == 0 ) {
-                self->cursors[i].col_qty = col_qty;
-                self->cursors[i].cols = cols;
-                self->cursors[i].cursor = NULL;
-                self->cursors[i].rows = 0;
-                *cursor_id = i;
-                break;
-            }
-        }
-        if( *cursor_id >= TW_MAX_CURSORS ) {
-            rc = RC(rcAlign, rcType, rcOpening, rcConstraint, rcExhausted);
-        }
-    }
-    if( rc != 0 ) {
-        ALIGN_DBGERRP("table %s", rc, cself->table);
-    } else {
-        ALIGN_DBG("table %s added cursor %hu", cself->table, *cursor_id);
-    }
-    return rc;
-}
-
-rc_t CC TableWriter_CloseCursor(const TableWriter* cself, uint8_t cursor_id, uint64_t* rows)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL || cursor_id >= TW_MAX_CURSORS || cself->cursors[cursor_id].cursor == NULL ) {
-        rc = RC(rcAlign, rcType, rcOpening, rcParam, rcInvalid);
-        ALIGN_DBGERR(rc);
-    } else {
-        rc_t rc2;
-        TableWriter* self = (TableWriter*)cself;
-        uint64_t r = 0;
-
-        if( rows == NULL ) {
-            rows = &r;
-        }
-        self->curr = &self->cursors[cursor_id];
-        rc = VCursorCommit(self->curr->cursor);
-        *rows = cself->curr->rows;
-        rc2 = VCursorRelease(self->curr->cursor);
-        self->curr->cursor = NULL;
-        rc = rc ? rc : rc2;
-    }
-    if( rc == 0 ) {
-        ALIGN_DBG("table %s closed cursor %hu rows %ld", cself->table, cursor_id, *rows);
-    } else {
-        ALIGN_DBGERRP("table %s cursor %hu row %ld", rc, cself->table, cursor_id, *rows);
-    }
-    return rc;
-}
-
-rc_t CC TableWriter_Flush(const TableWriter *cself, const uint8_t cursor_id)
-{
-    rc_t rc = 0;
-    
-    if( cself == NULL || cursor_id >= TW_MAX_CURSORS || cself->cursors[cursor_id].col_qty == 0 ) {
-        rc = RC(rcAlign, rcType, rcOpening, rcParam, rcInvalid);
-        ALIGN_DBGERR(rc);
-    }
-    else if( cself->cursors[cursor_id].cursor != NULL ) {
-        rc = VCursorFlushPage(cself->cursors[cursor_id].cursor);
-        if( rc == 0 ) {
-            ALIGN_DBG("table %s cursor %hu flushed", cself->table, cursor_id);
-        } else {
-            ALIGN_DBGERRP("table %s cursor %hu flushing", rc, cself->table, cursor_id);
-        }
-    }
-    return rc;
-}
-
-rc_t CC TableWriter_OpenRow(const TableWriter* cself, int64_t* rowid, const uint8_t cursor_id)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL || cursor_id >= TW_MAX_CURSORS || cself->cursors[cursor_id].col_qty == 0 ) {
-        rc = RC(rcAlign, rcType, rcOpening, rcParam, rcInvalid);
-        ALIGN_DBGERR(rc);
-    }
-    else if( cself->cursors[cursor_id].cursor != NULL || (rc = TableWriter_OpenCursor(cself, cursor_id)) == 0 ) {
-        TableWriter* self = (TableWriter*)cself;
-
-        self->curr = &self->cursors[cursor_id];
-        if( (rc = VCursorOpenRow(self->curr->cursor)) == 0 && rowid != NULL ) {
-            rc = VCursorRowId(self->curr->cursor, rowid);
-        }
-        if( rc == 0 ) {
-            ALIGN_DBG("table %s cursor %hu opened row %ld", self->table, cursor_id, self->curr->rows + 1);
-        } else {
-            ALIGN_DBGERRP("table %s cursor %hu row %ld", rc, self->table, cursor_id, self->curr->rows + 1);
-        }
-    }
-    return rc;
-}
-
-rc_t CC TableWriter_OpenRowId(const TableWriter* cself, const int64_t rowid, const uint8_t cursor_id)
-{
-    rc_t rc = 0;
-    
-    if( cself == NULL || cursor_id >= TW_MAX_CURSORS || cself->cursors[cursor_id].col_qty == 0 ) {
-        rc = RC(rcAlign, rcType, rcOpening, rcParam, rcInvalid);
-        ALIGN_DBGERR(rc);
-    } else if( cself->cursors[cursor_id].cursor != NULL || (rc = TableWriter_OpenCursor(cself, cursor_id)) == 0 ) {
-        TableWriter* self = (TableWriter*)cself;
-
-        self->curr = &self->cursors[cursor_id];
-        /* loop through missed rows to assign default values */
-        if( rowid > self->curr->rows + 1 ) {
-            int64_t r;
-            for(r = self->curr->rows + 1; rc == 0 && r < rowid; r++) {
-                if( (rc = VCursorOpenRow(self->curr->cursor)) == 0 &&
-                    (rc = VCursorCommitRow(self->curr->cursor)) == 0 ) {
-                    ALIGN_DBG("table %s written default row for cursor %hu row %ld", self->table, cursor_id, r);
-                    rc = VCursorCloseRow(self->curr->cursor);
-                }
-            }
-        }
-        if( rc == 0 /* && (rc = VCursorSetRowId(cself->curr->cursor, rowid)) == 0 */ ) {
-            rc = VCursorOpenRow(cself->curr->cursor);
-        }
-        if( rc == 0 ) {
-            if( rowid > self->curr->rows + 1) {
-                self->curr->rows = rowid - 1;
-            }
-            ALIGN_DBG("table %s cursor %hu opened row %ld", self->table, cursor_id, rowid);
-        } else {
-            ALIGN_DBGERRP("table %s cursor %hu row %ld", rc, self->table, cursor_id, rowid);
-        }
-    }
-    return rc;
-}
-
-rc_t CC TableWriter_GetNextRowId(const TableWriter* cself, int64_t* rowid, const uint8_t cursor_id)
-{
-    rc_t rc = 0;
-    
-    if( cself == NULL || cursor_id >= TW_MAX_CURSORS || cself->cursors[cursor_id].col_qty == 0 ) {
-        rc = RC(rcAlign, rcType, rcOpening, rcParam, rcInvalid);
-        ALIGN_DBGERR(rc);
-    } else {
-        *rowid = cself->cursors[cursor_id].rows + 1;
-        ALIGN_DBG("table %s next rowid %li", cself->table, *rowid);
-    }
-    return rc;
-}
-
-rc_t CC TableWriter_ColumnDefault(const TableWriter* cself, const uint8_t cursor_id,
-                                  const TableWriterColumn* column, const TableWriterData *data)
-{
-    rc_t rc = 0;
-    if( cself == NULL || cursor_id >= TW_MAX_CURSORS || cself->cursors[cursor_id].col_qty == 0 ||
-        column == NULL || data == NULL ) {
-        rc = RC( rcAlign, rcType, rcWriting, rcParam, rcNull);
-    } else if( !(column->flags & ewcol_IsArray) && data->elements != 1 ) {
-        rc = RC( rcAlign, rcType, rcWriting, rcData, rcTooLong);
-        ALIGN_DBGERRP("column %s is not an array of values", rc, column->name);
-    } else if( cself->cursors[cursor_id].cursor != NULL || (rc = TableWriter_OpenCursor(cself, cursor_id)) == 0 ) {
-        if( column->idx != 0 ) {
-            rc = VCursorDefault(cself->cursors[cursor_id].cursor, column->idx, column->element_bits, data->buffer, 0, data->elements);
-        }
-    }
-    if( rc != 0 ) {
-        ALIGN_DBGERRP("table %s column %s default value", rc, cself->table, column->name);
-    } else {
-        ALIGN_DBG("table %s column %s default value %lu elements", cself->table, column->name, data->elements);
-    }
-    return rc;
-}
-
-rc_t CC TableWriter_ColumnWrite(const TableWriter* cself, const TableWriterColumn* column, const TableWriterData *data)
-{
-    rc_t rc = 0;
-    if( cself == NULL || column == NULL || data == NULL ) {
-        rc = RC( rcAlign, rcType, rcWriting, rcParam, rcInvalid);
-    } else if( cself->curr == NULL || cself->curr->cursor == NULL ) {
-        rc = RC( rcAlign, rcType, rcWriting, rcMode, rcInvalid);
-    } else if( !(column->flags & ewcol_IsArray) && data->elements > 1 ) {
-        rc = RC( rcAlign, rcType, rcWriting, rcData, rcTooLong);
-        ALIGN_DBGERRP("column %s is not an array of values", rc, column->name);
-    } else if( column->idx != 0 ) {
-        rc = VCursorWrite(cself->curr->cursor, column->idx, column->element_bits, data->buffer, 0, data->elements);
-    }
-    if( rc != 0 ) {
-        ALIGN_DBGERRP("table %s column %s row %ld", rc, cself->table, column->name, cself->curr->rows + 1);
-    } else {
-        ALIGN_DBG("table %s column %s value %lu elements", cself->table, column->name, data->elements);
-    }
-    return rc;
-}
-
-rc_t CC TableWriter_CloseRow(const TableWriter* cself)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL ) {
-        rc = RC(rcAlign, rcType, rcClosing, rcSelf, rcNull);
-        ALIGN_DBGERR(rc);
-    } else if( cself->curr == NULL || cself->curr->cursor == NULL ) {
-        rc = RC( rcAlign, rcType, rcClosing, rcMode, rcInvalid);
-    } else {
-        if( (rc = VCursorCommitRow(cself->curr->cursor)) == 0 ) {
-            rc = VCursorCloseRow(cself->curr->cursor);
-        }
-        if( rc == 0 ) {
-            cself->curr->rows++;
-        } else {
-            ALIGN_DBGERRP("table %s row %ld", rc, cself->table, cself->curr->rows + 1);
-        }
-        ((TableWriter*)cself)->curr = NULL;
-    }
-    return rc;
-}
diff --git a/libs/align/writer-priv.h b/libs/align/writer-priv.h
deleted file mode 100644
index dab67f5..0000000
--- a/libs/align/writer-priv.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#ifndef _h_align_writer_priv_
-#define _h_align_writer_priv_
-
-#include <vdb/manager.h>
-#include <vdb/database.h>
-#include <vdb/table.h>
-#include <kdb/meta.h>
-
-#include <align/writer-cmn.h>
-
-enum TableWriterColumn_Array {
-    ewcol_Ignore = 0x01,
-    ewcol_IsArray = 0x02,
-    ewcol_Temporary = 0x04
-};
-
-/* use ewcol_Ignore to skip optional column when cursor is created */
-typedef struct TableWriterColumn_struct {
-    uint32_t idx;
-    const char* name;
-    bitsz_t element_bits;
-    uint32_t flags;
-} TableWriterColumn;
-
-typedef struct TableWriter TableWriter;
-
-rc_t CC TableWriter_Make(const TableWriter** cself, VDatabase *db, const char* table, const char* table_path /* NULL */);
-
-rc_t CC TableWriter_MakeMgr(const TableWriter** cself, VDBManager* mgr, const char* schema_path, const char* type, const char* table_path);
-
-rc_t CC TableWriter_MakeUpdate(const TableWriter** cself, VDatabase *db, const char* table);
-
-/* add scursor based on column list */
-rc_t CC TableWriter_AddCursor(const TableWriter* cself, TableWriterColumn* cols, uint32_t col_qty, uint8_t* cursor_id);
-
-rc_t CC TableWriter_GetVTable(const TableWriter* cself, VTable** vtbl);
-
-rc_t CC TableWriter_Sign(const TableWriter *const cself,
-                         const char loader_name[],
-                         const ver_t loader_version,
-                         const char loader_date[],
-                         const char app_name[],
-                         const ver_t app_version);
-
-/* optionally return internal vtbl still open but committed */
-rc_t CC TableWriter_Whack(const TableWriter* cself, bool commit, uint64_t* rows);
-
-/* commits and closes cursor_id, returns number of rows written in cursor, optionally */
-rc_t CC TableWriter_CloseCursor(const TableWriter* cself, uint8_t cursor_id, uint64_t* rows);
-
-/* flushes any pending writes into the table */
-rc_t CC TableWriter_Flush(const TableWriter *cself, const uint8_t cursor_id);
-
-/* CANNOT OPEN ROWS IN MULTIPLE CURSORS AT ONCE
-    Use sequence:
-    OpenRow
-    ColumnWrite - 0 (better set some defaults if not writing to a column!) or more times.
-    CloseRow
- */
-/* open a row for writing by cursor_id */
-rc_t CC TableWriter_OpenRow(const TableWriter* cself, int64_t* rowid, const uint8_t cursor_id);
-
-/* open a specific row for writing by cursor_id */
-rc_t CC TableWriter_OpenRowId(const TableWriter* cself, const int64_t rowid, const uint8_t cursor_id);
-
-/* return sequentially next rowid which will be created on OpenRow request */
-rc_t CC TableWriter_GetNextRowId(const TableWriter* cself, int64_t* rowid, const uint8_t cursor_id);
-
-/* writes cursor_id cursor default value to column
-   column pointer must use same object as passed into AddCursor
- */
-rc_t CC TableWriter_ColumnDefault(const TableWriter* cself, const uint8_t cursor_id,
-                                  const TableWriterColumn* column, const TableWriterData *data);
-
-/* writes value to column into cursor last passed to OpenRow*
-   column pointer must use same object as passed into AddCursor
- */
-rc_t CC TableWriter_ColumnWrite(const TableWriter* cself,
-                                const TableWriterColumn* column, const TableWriterData *data);
-
-/* closes row in cursor last used in OpenRow* */
-rc_t CC TableWriter_CloseRow(const TableWriter* cself);
-
-#define TW_COL_WRITE_DEF(writer, curs, col, data) \
-    if( rc == 0 ) { \
-        rc = TableWriter_ColumnDefault(writer, curs, &(col), &(data)); \
-    }
-
-#define TW_COL_WRITE_DEF_VAR(writer, curs, col, var) \
-    if( rc == 0 ) { \
-        TableWriterData dz; \
-        dz.buffer = &(var); \
-        dz.elements = 1; \
-        TW_COL_WRITE_DEF(writer, curs, col, dz); \
-    }
-
-#define TW_COL_WRITE_DEF_BUF(writer, curs, col, buf, elems) \
-    if( rc == 0 ) { \
-        TableWriterData dz; \
-        dz.buffer = buf; \
-        dz.elements = elems; \
-        TW_COL_WRITE_DEF(writer, curs, col, dz); \
-    }
-
-#define TW_COL_WRITE(writer, col, data) \
-    if( rc == 0 && (col).idx != 0) { \
-        rc = TableWriter_ColumnWrite(writer, &(col), &(data)); \
-    }
-
-#define TW_COL_WRITE_VAR(writer, col, var) \
-    if( rc == 0 && (col).idx != 0) { \
-        TableWriterData dz; \
-        dz.buffer = &(var); \
-        dz.elements = 1; \
-        TW_COL_WRITE(writer, col, dz); \
-    }
-
-#define TW_COL_WRITE_BUF(writer, col, buf, elems) \
-    if( rc == 0 && (col).idx != 0) { \
-        TableWriterData dz; \
-        dz.buffer = buf; \
-        dz.elements = elems; \
-        TW_COL_WRITE(writer, col, dz); \
-    }
-
-#endif /* _h_align_writer_priv_ */
diff --git a/libs/align/writer-ref.c b/libs/align/writer-ref.c
deleted file mode 100644
index d4d04a9..0000000
--- a/libs/align/writer-ref.c
+++ /dev/null
@@ -1,481 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <align/extern.h>
-
-#include <klib/rc.h>
-#include <kfs/file.h>
-#include <insdc/insdc.h>
-#include <vdb/table.h>
-#include <align/writer-refseq.h>
-#include "writer-ref.h"
-#include "writer-priv.h"
-#include "debug.h"
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <ctype.h>
-#include <assert.h>
-
-static const TableWriterColumn TableWriterRefData_cols[ewrefd_cn_Last + 1] =
-{
-    /* order is important, see enum in .h !!! */
-    {0, "MAX_SEQ_LEN", sizeof(uint32_t) * 8, 0},
-    {0, "NAME", sizeof(char) * 8, ewcol_IsArray},
-    {0, "(INSDC:dna:text)CS_KEY", sizeof(char) * 8, 0},
-    {0, "(INSDC:dna:text)CMP_READ", sizeof(char) * 8, ewcol_IsArray},
-    {0, "QUALITY", sizeof(INSDC_quality_phred) * 8, ewcol_IsArray},
-    {0, "SEQ_ID", sizeof(char) * 8, ewcol_IsArray},
-    {0, "SEQ_START", sizeof(INSDC_coord_one) * 8, 0},
-    {0, "SEQ_LEN", sizeof(INSDC_coord_len) * 8, 0},
-    {0, "CIRCULAR", sizeof(bool) * 8, 0}
-};
-
-static const TableWriterColumn TableWriterRefCoverage_cols[ewrefcv_cn_Last + 1] =
-{
-    /* order is important, see enum in .h !!! */
-    {0, "CGRAPH_HIGH", sizeof(uint8_t) * 8, 0},
-    {0, "CGRAPH_LOW", sizeof(uint8_t) * 8, 0},
-    {0, "CGRAPH_MISMATCHES", sizeof(uint32_t) * 8, 0},
-    {0, "CGRAPH_INDELS", sizeof(uint32_t) * 8, 0},
-    {0, "OVERLAP_REF_POS", sizeof(INSDC_coord_zero) * 8, ewcol_IsArray},
-    {0, "OVERLAP_REF_LEN", sizeof(INSDC_coord_len) * 8, ewcol_IsArray},
-    {0, "PRIMARY_ALIGNMENT_IDS", sizeof(int64_t) * 8, ewcol_IsArray},
-    {0, "SECONDARY_ALIGNMENT_IDS", sizeof(int64_t) * 8, ewcol_IsArray},
-    {0, "EVIDENCE_INTERVAL_IDS", sizeof(int64_t) * 8, ewcol_IsArray}
-};
-
-struct TableWriterRef {
-    uint32_t options;
-    const TableWriter* base;
-    uint8_t cursor_id;
-    TableWriterColumn cols_data[sizeof(TableWriterRefData_cols)/sizeof(TableWriterRefData_cols[0])];
-    uint8_t coverage_cursor_id;
-    TableWriterColumn cols_coverage[sizeof(TableWriterRefCoverage_cols)/sizeof(TableWriterRefCoverage_cols[0])];
-    INSDC_coord_one seq_start_last;
-    uint32_t max_seq_len;
-    char last_cs_key;
-    uint64_t last_seq_id_len;
-    char last_seq_id[2048];
-    int64_t last_coverage_row;
-};
-
-rc_t CC TableWriterRef_Make(const TableWriterRef** cself, VDatabase* db, const uint32_t options)
-{
-    rc_t rc = 0;
-    TableWriterRef* self = NULL;
-
-    if( cself == NULL ) {
-        rc = RC(rcAlign, rcFormatter, rcConstructing, rcParam, rcNull);
-    } else {
-        self = calloc(1, sizeof(*self));
-        if( self == NULL ) {
-            rc = RC(rcAlign, rcFormatter, rcConstructing, rcMemory, rcExhausted);
-        } else {
-            memcpy(self->cols_data, TableWriterRefData_cols, sizeof(TableWriterRefData_cols));
-            memcpy(self->cols_coverage, TableWriterRefCoverage_cols, sizeof(TableWriterRefCoverage_cols));
-            if( !(options & ewref_co_QUALITY) ) {
-                self->cols_data[ewrefd_cn_QUALITY].flags |= ewcol_Ignore;
-            }
-            if( (rc = TableWriter_Make(&self->base, db, "REFERENCE", NULL)) == 0 &&
-                (rc = TableWriter_AddCursor(self->base, self->cols_data,
-                            sizeof(self->cols_data) / sizeof(self->cols_data[0]), &self->cursor_id)) == 0 ) {
-                self->options = options;
-            }
-            if( rc == 0 && (options & ewref_co_Coverage) ) {
-                rc = TableWriter_AddCursor(self->base, self->cols_coverage,
-                    sizeof(self->cols_coverage) / sizeof(self->cols_coverage[0]), &self->coverage_cursor_id);
-            }
-        }
-    }
-    if( rc == 0 ) {
-        *cself = self;
-        ALIGN_DBG("table %s", "created");
-    } else {
-        TableWriterRef_Whack(self, false, NULL);
-        ALIGN_DBGERR(rc);
-    }
-    return rc;
-}
-
-static
-rc_t TableWriterRef_DefaultCoverage(const TableWriterRef* cself, int64_t rowid)
-{
-    rc_t rc = 0;
-    int64_t i;
-    ReferenceSeqCoverage c;
-
-    memset(&c, 0, sizeof(c));
-    for(i = cself->last_coverage_row + 1; rc == 0 && i < rowid; i++) {
-        rc = TableWriterRef_WriteCoverage(cself, i, 0, &c);
-    }
-    return rc;
-}
-
-rc_t CC TableWriterRef_Whack(const TableWriterRef* cself, bool commit, uint64_t* rows)
-{
-    rc_t rc = 0;
-    if( cself != NULL ) {
-        TableWriterRef* self = (TableWriterRef*)cself;
-
-        if( commit && (cself->options & ewref_co_Coverage) ) {
-            int64_t next_row;
-            if( (rc = TableWriter_GetNextRowId(cself->base, &next_row, 0)) == 0 ) {
-                if( (next_row - 1) > cself->last_coverage_row ) {
-                    ALIGN_DBG("adding default coverage to tail of table (%li,%li]", cself->last_coverage_row, next_row);
-                    rc = TableWriterRef_DefaultCoverage(cself, next_row);
-                }
-            }
-        }
-        if( rc == 0 ) {
-            rc = TableWriter_Whack(cself->base, commit, rows);
-        }
-        free(self);
-    }
-    return rc;
-}
-
-static
-rc_t TableWriterRef_WriteDefaults(const TableWriterRef* cself)
-{
-    rc_t rc = 0;
-    if( cself != NULL ) {
-        TableWriterRef* self = (TableWriterRef*)cself;
-        self->max_seq_len = TableWriterRefSeq_MAX_SEQ_LEN;
-        self->seq_start_last = 1;
-        self->last_cs_key = 'T';
-        self->last_seq_id_len = 0;
-        TW_COL_WRITE_DEF_VAR(self->base, cself->cursor_id, self->cols_data[ewrefd_cn_MAX_SEQ_LEN], self->max_seq_len);
-        if( rc == 0 && (cself->options & ewref_co_Coverage) ) {
-            ReferenceSeqCoverage c;
-
-            memset(&c, 0, sizeof(c));
-            TW_COL_WRITE_DEF_VAR(self->base, self->coverage_cursor_id, self->cols_coverage[ewrefcv_cn_CGRAPH_HIGH], c.low);
-            TW_COL_WRITE_DEF_VAR(self->base, self->coverage_cursor_id, self->cols_coverage[ewrefcv_cn_CGRAPH_LOW], c.high);
-            TW_COL_WRITE_DEF_VAR(self->base, self->coverage_cursor_id, self->cols_coverage[ewrefcv_cn_CGRAPH_MISMATCHES], c.mismatches);
-            TW_COL_WRITE_DEF_VAR(self->base, self->coverage_cursor_id, self->cols_coverage[ewrefcv_cn_CGRAPH_INDELS], c.indels);
-            TW_COL_WRITE_DEF_BUF(self->base, self->coverage_cursor_id, self->cols_coverage[ewrefcv_cn_OVERLAP_REF_POS],
-                    c.overlap_ref_pos, sizeof(c.overlap_ref_pos) / sizeof(c.overlap_ref_pos[0]));
-            TW_COL_WRITE_DEF_BUF(self->base, self->coverage_cursor_id, self->cols_coverage[ewrefcv_cn_OVERLAP_REF_LEN],
-                    c.overlap_ref_len, sizeof(c.overlap_ref_len) / sizeof(c.overlap_ref_len[0]));
-            TW_COL_WRITE_DEF(self->base, self->coverage_cursor_id, self->cols_coverage[ewrefcv_cn_PRIMARY_ALIGNMENT_IDS], c.ids[ewrefcov_primary_table]);
-            TW_COL_WRITE_DEF(self->base, self->coverage_cursor_id, self->cols_coverage[ewrefcv_cn_SECONDARY_ALIGNMENT_IDS], c.ids[ewrefcov_secondary_table]);
-            TW_COL_WRITE_DEF(self->base, self->coverage_cursor_id, self->cols_coverage[ewrefcv_cn_EVIDENCE_INTERVAL_IDS], c.ids[ewrefcov_evidence_table]);
-        }
-    }
-    return rc;
-}
-
-rc_t CC TableWriterRef_WriteDefaultData(const TableWriterRef* cself, enum ETableWriterRefData_ColNames col,
-                                        const TableWriterData* data)
-{
-    rc_t rc = 0;
-    if( cself == NULL || data == NULL ) {
-        rc = RC(rcAlign, rcType, rcWriting, rcParam, rcNull);
-        ALIGN_DBGERR(rc);
-    } else if( cself->last_cs_key == '\0' && (rc = TableWriterRef_WriteDefaults(cself)) != 0 ) {
-        ALIGN_DBGERR(rc);
-    } else {
-        TW_COL_WRITE_DEF(cself->base, cself->cursor_id, cself->cols_data[col], (*data));
-        if( col == ewrefd_cn_MAX_SEQ_LEN ) {
-            ((TableWriterRef*)cself)->max_seq_len = *((uint32_t*)data->buffer);
-        }
-    }
-    return rc;
-}
-
-rc_t CC TableWriterRef_WriteDefaultCovarage(const TableWriterRef* cself, enum ETableWriterRefCoverage_ColNames col,
-                                            const TableWriterData* data)
-{
-    rc_t rc = 0;
-    if( cself == NULL || data == NULL ) {
-        rc = RC(rcAlign, rcType, rcWriting, rcParam, rcNull);
-        ALIGN_DBGERR(rc);
-    } else if( cself->last_cs_key == '\0' && (rc = TableWriterRef_WriteDefaults(cself)) != 0 ) {
-        ALIGN_DBGERR(rc);
-    } else {
-        TW_COL_WRITE_DEF(cself->base, cself->coverage_cursor_id, cself->cols_coverage[col], (*data));
-    }
-    return rc;
-}
-
-rc_t CC TableWriterRef_Write(const TableWriterRef* cself, const TableWriterRefData* data, int64_t* rowid)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL || data == NULL ) {
-        rc = RC(rcAlign, rcType, rcWriting, rcParam, rcNull);
-        ALIGN_DBGERR(rc);
-    } else if( cself->last_cs_key == '\0' && (rc = TableWriterRef_WriteDefaults(cself)) != 0 ) {
-        ALIGN_DBGERR(rc);
-    } else if( data->read.elements > cself->max_seq_len ) {
-        rc = RC(rcAlign, rcType, rcWriting, rcData, rcInvalid);
-        ALIGN_DBGERRP("%s is longer than %s", rc, cself->cols_data[ewrefd_cn_READ].name, cself->cols_data[ewrefd_cn_MAX_SEQ_LEN].name);
-    } else if( data->seq_id.elements > sizeof(cself->last_seq_id) ) {
-        rc = RC(rcAlign, rcType, rcWriting, rcBuffer, rcInsufficient);
-        ALIGN_DBGERRP("%s is longer than %s", rc, cself->cols_data[ewrefd_cn_READ].name, cself->cols_data[ewrefd_cn_MAX_SEQ_LEN].name);
-    } else if( (rc = TableWriter_OpenRow(cself->base, rowid, cself->cursor_id)) == 0 ) {
-        const INSDC_dna_text* b = data->read.buffer;
-        INSDC_coord_len const len = data->read.elements;
-        bool write_read = data->seq_id.elements < 1 || data->force_READ_write;
-        INSDC_coord_len trim_len = len;
-        
-        if( cself->last_seq_id_len != data->seq_id.elements ||
-            strncmp(cself->last_seq_id, data->seq_id.buffer, cself->last_seq_id_len) != 0 ) {
-            /* new seq_id: reset counters and mem it */
-            TableWriterRef* self = (TableWriterRef*)cself;
-            self->last_seq_id_len = data->seq_id.elements;
-            memcpy(self->last_seq_id, data->seq_id.buffer, cself->last_seq_id_len);
-            self->seq_start_last = 1;
-            self->last_cs_key = 'T';
-        }
-        /* trunc trailing N */
-        b += len - 1;
-        while( trim_len > 0 && (*b == 'N' || *b == 'n' || *b == '.') ) {
-            trim_len--; b--;
-        }
-        TW_COL_WRITE(cself->base, cself->cols_data[ewrefd_cn_NAME], data->name);
-        TW_COL_WRITE_BUF(cself->base, cself->cols_data[ewrefd_cn_READ], data->read.buffer, (write_read ? trim_len : 0));
-        TW_COL_WRITE(cself->base, cself->cols_data[ewrefd_cn_QUALITY], data->quality);
-        TW_COL_WRITE(cself->base, cself->cols_data[ewrefd_cn_SEQ_ID], data->seq_id);
-        if( trim_len == 0 ) {
-            TW_COL_WRITE_VAR(cself->base, cself->cols_data[ewrefd_cn_SEQ_START], trim_len);
-        } else {
-            TW_COL_WRITE_VAR(cself->base, cself->cols_data[ewrefd_cn_SEQ_START], cself->seq_start_last);
-        }
-        TW_COL_WRITE_VAR(cself->base, cself->cols_data[ewrefd_cn_SEQ_LEN], len);
-        TW_COL_WRITE_VAR(cself->base, cself->cols_data[ewrefd_cn_CS_KEY], cself->last_cs_key);
-        TW_COL_WRITE_VAR(cself->base, cself->cols_data[ewrefd_cn_CIRCULAR], data->circular);
-        if( rc == 0 && (rc = TableWriter_CloseRow(cself->base)) == 0 ) {
-            TableWriterRef* self = (TableWriterRef*)cself;
-            
-            self->last_cs_key = ((const char*)(data->read.buffer))[data->read.elements - 1];
-            switch (self->last_cs_key) {
-            case 'A':
-            case 'C':
-            case 'G':
-            case 'T':
-                break;
-            default:
-                self->last_cs_key = 'T';
-                break;
-            }
-            self->seq_start_last += data->read.elements;
-        }
-    }
-    return rc;
-}
-
-rc_t CC TableWriterRef_WriteCoverage(const TableWriterRef* cself, int64_t rowid, INSDC_coord_zero offset, const ReferenceSeqCoverage* coverage)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL || coverage == NULL ) {
-        rc = RC(rcAlign, rcType, rcWriting, rcParam, rcNull);
-        ALIGN_DBGERR(rc);
-    } else if( cself->last_cs_key == '\0' && (rc = TableWriterRef_WriteDefaults(cself)) != 0 ) {
-        ALIGN_DBGERR(rc);
-    } else if( !(cself->options & ewref_co_Coverage) ) {
-        rc = RC(rcAlign, rcType, rcWriting, rcData, rcUnexpected);
-        ALIGN_DBGERRP("coverage %s", rc, "data");
-    } else if( offset > cself->seq_start_last ) {
-        rc = RC(rcAlign, rcType, rcWriting, rcData, rcInvalid);
-        ALIGN_DBGERRP("%i is beyond last written chunk", rc, offset);
-    } else {
-        if( (rowid + offset / cself->max_seq_len) - cself->last_coverage_row > 1 ) {
-            /* fill in gap in coverage rows with default values */
-            ALIGN_DBG("gap in coverage rows (%li,%li) -> use defaults", cself->last_coverage_row, rowid + offset / cself->max_seq_len);
-            rc = TableWriterRef_DefaultCoverage(cself, rowid + offset / cself->max_seq_len);
-        }
-        if( rc == 0 && (rc = TableWriter_OpenRowId(cself->base, rowid + offset / cself->max_seq_len, cself->coverage_cursor_id)) == 0 ) {
-            TW_COL_WRITE_VAR(cself->base, cself->cols_coverage[ewrefcv_cn_CGRAPH_HIGH], coverage->high);
-            TW_COL_WRITE_VAR(cself->base, cself->cols_coverage[ewrefcv_cn_CGRAPH_LOW], coverage->low);
-            TW_COL_WRITE_VAR(cself->base, cself->cols_coverage[ewrefcv_cn_CGRAPH_MISMATCHES], coverage->mismatches);
-            TW_COL_WRITE_VAR(cself->base, cself->cols_coverage[ewrefcv_cn_CGRAPH_INDELS], coverage->indels);
-            TW_COL_WRITE_BUF(cself->base, cself->cols_coverage[ewrefcv_cn_OVERLAP_REF_POS],
-                    coverage->overlap_ref_pos, sizeof(coverage->overlap_ref_pos) / sizeof(coverage->overlap_ref_pos[0]));
-            TW_COL_WRITE_BUF(cself->base, cself->cols_coverage[ewrefcv_cn_OVERLAP_REF_LEN],
-                    coverage->overlap_ref_len, sizeof(coverage->overlap_ref_len) / sizeof(coverage->overlap_ref_len[0]));
-            TW_COL_WRITE(cself->base, cself->cols_coverage[ewrefcv_cn_PRIMARY_ALIGNMENT_IDS], coverage->ids[ewrefcov_primary_table]);
-            TW_COL_WRITE(cself->base, cself->cols_coverage[ewrefcv_cn_SECONDARY_ALIGNMENT_IDS], coverage->ids[ewrefcov_secondary_table]);
-            TW_COL_WRITE(cself->base, cself->cols_coverage[ewrefcv_cn_EVIDENCE_INTERVAL_IDS], coverage->ids[ewrefcov_evidence_table]);
-            if( rc == 0 ) {
-                TableWriterRef* self = (TableWriterRef*)cself;
-                self->last_coverage_row = rowid + offset / cself->max_seq_len;
-                rc = TableWriter_CloseRow(cself->base);
-            }
-        }
-    }
-    return rc;
-}
-
-struct TableWriterRefCoverage {
-    const TableWriter* base;
-    bool init; /* default written indicator */
-    uint8_t cursor_id;
-    TableWriterColumn cols[ewrefcv_cn_ReCover + 1];
-};
-
-rc_t CC TableWriterRefCoverage_MakeCoverage(const TableWriterRefCoverage** cself, VDatabase* db, const uint32_t options)
-{
-    rc_t rc = 0;
-    TableWriterRefCoverage* self = NULL;
-
-    if( cself == NULL ) {
-        rc = RC(rcAlign, rcFormatter, rcConstructing, rcParam, rcNull);
-    } else {
-        self = calloc(1, sizeof(*self));
-        if( self == NULL ) {
-            rc = RC(rcAlign, rcFormatter, rcConstructing, rcMemory, rcExhausted);
-        } else {
-            memcpy(self->cols, TableWriterRefCoverage_cols, sizeof(self->cols));
-            if( (rc = TableWriter_MakeUpdate(&self->base, db, "REFERENCE")) == 0 ) {
-                rc = TableWriter_AddCursor(self->base, self->cols,
-                        sizeof(self->cols) / sizeof(self->cols[0]), &self->cursor_id);
-            }
-        }
-    }
-    if( rc == 0 ) {
-        *cself = self;
-        ALIGN_R_DBG("table %s", "opened");
-    } else {
-        TableWriterRefCoverage_Whack(self, false, NULL);
-        ALIGN_DBGERR(rc);
-    }
-    return rc;
-}
-rc_t CC TableWriterRefCoverage_MakeIds(const TableWriterRefCoverage** cself, VDatabase* db, const char  * col_name)
-{
-    rc_t rc = 0;
-    TableWriterRefCoverage* self = NULL;
-
-    if( cself == NULL ) {
-        rc = RC(rcAlign, rcFormatter, rcConstructing, rcParam, rcNull);
-    } else {
-        self = calloc(1, sizeof(*self));
-        if( self == NULL ) {
-            rc = RC(rcAlign, rcFormatter, rcConstructing, rcMemory, rcExhausted);
-        } else {
-            if( (rc = TableWriter_MakeUpdate(&self->base, db, "REFERENCE")) == 0 ) {
-                self->cols[0].idx = 0;
-                self->cols[0].name = col_name;
-                self->cols[0].element_bits = 8 * sizeof(int64_t);
-                self->cols[0].flags=ewcol_IsArray;
-                rc = TableWriter_AddCursor(self->base, self->cols,1, &self->cursor_id);
-            }
-        }
-    }
-    if( rc == 0 ) {
-        *cself = self;
-        ALIGN_R_DBG("table %s", "opened");
-    } else {
-        TableWriterRefCoverage_Whack(self, false, NULL);
-        ALIGN_DBGERR(rc);
-    }
-    return rc;
-}
-
-
-rc_t CC TableWriterRefCoverage_Whack(const TableWriterRefCoverage* cself, bool commit, uint64_t* rows)
-{
-    rc_t rc = 0;
-    if( cself != NULL ) {
-        TableWriterRefCoverage* self = (TableWriterRefCoverage*)cself;
-        rc = TableWriter_Whack(cself->base, commit, rows);
-        free(self);
-    }
-    return rc;
-}
-
-
-rc_t CC TableWriterRefCoverage_WriteCoverage(const TableWriterRefCoverage* cself, int64_t rowid, const ReferenceSeqCoverage* coverage)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL || coverage == NULL ) {
-        rc = RC(rcAlign, rcType, rcWriting, rcParam, rcNull);
-        ALIGN_DBGERR(rc);
-    }
-    else {
-        if( !cself->init ) {
-            /* set the defaults */
-            ReferenceSeqCoverage c;
-            
-            memset(&c, 0, sizeof(c));
-            TW_COL_WRITE_DEF_VAR(cself->base, cself->cursor_id, cself->cols[ewrefcv_cn_CGRAPH_HIGH], c.low);
-            TW_COL_WRITE_DEF_VAR(cself->base, cself->cursor_id, cself->cols[ewrefcv_cn_CGRAPH_LOW], c.high);
-            TW_COL_WRITE_DEF_VAR(cself->base, cself->cursor_id, cself->cols[ewrefcv_cn_CGRAPH_MISMATCHES], c.mismatches);
-            TW_COL_WRITE_DEF_VAR(cself->base, cself->cursor_id, cself->cols[ewrefcv_cn_CGRAPH_INDELS], c.indels);
-            TW_COL_WRITE_DEF_BUF(cself->base, cself->cursor_id, cself->cols[ewrefcv_cn_OVERLAP_REF_POS],
-                                 c.overlap_ref_pos, sizeof(c.overlap_ref_pos) / sizeof(c.overlap_ref_pos[0]));
-            TW_COL_WRITE_DEF_BUF(cself->base, cself->cursor_id, cself->cols[ewrefcv_cn_OVERLAP_REF_LEN],
-                                 c.overlap_ref_len, sizeof(c.overlap_ref_len) / sizeof(c.overlap_ref_len[0]));
-            
-            ((TableWriterRefCoverage*)cself)->init = true;
-        }
-        if( rc == 0 && (rc = TableWriter_OpenRowId(cself->base, rowid, cself->cursor_id)) == 0 ) {
-            TW_COL_WRITE_VAR(cself->base, cself->cols[ewrefcv_cn_CGRAPH_HIGH], coverage->high);
-            TW_COL_WRITE_VAR(cself->base, cself->cols[ewrefcv_cn_CGRAPH_LOW], coverage->low);
-            TW_COL_WRITE_VAR(cself->base, cself->cols[ewrefcv_cn_CGRAPH_MISMATCHES], coverage->mismatches);
-            TW_COL_WRITE_VAR(cself->base, cself->cols[ewrefcv_cn_CGRAPH_INDELS], coverage->indels);
-            TW_COL_WRITE_BUF(cself->base, cself->cols[ewrefcv_cn_OVERLAP_REF_POS],
-                             coverage->overlap_ref_pos, sizeof(coverage->overlap_ref_pos) / sizeof(coverage->overlap_ref_pos[0]));
-            TW_COL_WRITE_BUF(cself->base, cself->cols[ewrefcv_cn_OVERLAP_REF_LEN],
-                             coverage->overlap_ref_len, sizeof(coverage->overlap_ref_len) / sizeof(coverage->overlap_ref_len[0]));
-            
-            if( rc == 0 ) {
-                rc = TableWriter_CloseRow(cself->base);
-            }
-        }
-    }
-    return rc;
-}
-rc_t CC TableWriterRefCoverage_WriteIds(const TableWriterRefCoverage* cself, int64_t rowid, const int64_t* buf,uint32_t num)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL || (buf  == NULL && num > 0)) {
-        rc = RC(rcAlign, rcType, rcWriting, rcParam, rcNull);
-        ALIGN_DBGERR(rc);
-    }
-    else {
-        if( !cself->init ) {
-            /* set the defaults */
-            TW_COL_WRITE_DEF_BUF(cself->base, cself->cursor_id, cself->cols[0],NULL,0);
-            ((TableWriterRefCoverage*)cself)->init = true;
-        }
-        if( rc == 0 && (rc = TableWriter_OpenRowId(cself->base, rowid, cself->cursor_id)) == 0 ) {
-            TW_COL_WRITE_BUF(cself->base, cself->cols[0],buf,num);
-            if( rc == 0 ) {
-                rc = TableWriter_CloseRow(cself->base);
-            }
-        }
-    }
-    return rc;
-}
-
diff --git a/libs/align/writer-ref.h b/libs/align/writer-ref.h
deleted file mode 100644
index e059a0b..0000000
--- a/libs/align/writer-ref.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifndef _h_align_writer_ref_
-#define _h_align_writer_ref_
-
-#include <vdb/database.h>
-#include <align/writer-alignment.h>
-#include <align/writer-reference.h>
-
-enum ETableWriterRefData_ColNames {
-    ewrefd_cn_MAX_SEQ_LEN, /* static/default value from refseq writer */
-    ewrefd_cn_NAME,
-    ewrefd_cn_CS_KEY, /* handled by writer */
-    ewrefd_cn_READ,
-    ewrefd_cn_QUALITY,
-    ewrefd_cn_SEQ_ID,
-    ewrefd_cn_SEQ_START, /* calculated on fly by writer */
-    ewrefd_cn_SEQ_LEN, /* calculated on fly by writer */
-    ewrefd_cn_CIRCULAR, 
-    ewrefd_cn_Last = ewrefd_cn_CIRCULAR
-};
-
-enum ETableWriterRefCoverage_ColNames {
-    /* coverage data starts here */
-    ewrefcv_cn_CGRAPH_HIGH=0,
-    ewrefcv_cn_CGRAPH_LOW,
-    ewrefcv_cn_CGRAPH_MISMATCHES,
-    ewrefcv_cn_CGRAPH_INDELS,
-    ewrefcv_cn_OVERLAP_REF_POS,
-    ewrefcv_cn_OVERLAP_REF_LEN,
-    ewrefcv_cn_ReCover = ewrefcv_cn_OVERLAP_REF_LEN,
-    ewrefcv_cn_PRIMARY_ALIGNMENT_IDS,
-    ewrefcv_cn_SECONDARY_ALIGNMENT_IDS,
-    ewrefcv_cn_EVIDENCE_INTERVAL_IDS,
-    ewrefcv_cn_Last = ewrefcv_cn_EVIDENCE_INTERVAL_IDS
-};
-
-enum ETableWriterRef_ColOptions {
-    ewref_co_SaveRead = 0x01, /* always write READ */
-    ewref_co_QUALITY = 0x02,  /* use QUALITY column, by default not opened */
-    ewref_co_Coverage = 0x04  /* use coverage columns, by default not opened */
-};
-
-typedef struct TableWriterRefData_struct {
-    TableWriterData name;
-    bool force_READ_write;
-    TableWriterData read;
-    TableWriterData quality;
-    TableWriterData seq_id;
-    bool circular;
-} TableWriterRefData;
-
-typedef struct TableWriterRef TableWriterRef;
-
-rc_t CC TableWriterRef_Make(const TableWriterRef** cself, VDatabase* db, const uint32_t options);
-
-/* rows optional here */
-rc_t CC TableWriterRef_Whack(const TableWriterRef* cself, bool commit, uint64_t* rows);
-
-rc_t CC TableWriterRef_WriteDefaultData(const TableWriterRef* cself, enum ETableWriterRefData_ColNames col,
-                                        const TableWriterData* data);
-
-rc_t CC TableWriterRef_WriteDefaultCovarage(const TableWriterRef* cself, enum ETableWriterRefCoverage_ColNames col,
-                                            const TableWriterData* data);
-
-/* rowid optional here */
-rc_t CC TableWriterRef_Write(const TableWriterRef* cself, const TableWriterRefData* data, int64_t* rowid);
-
-rc_t CC TableWriterRef_WriteCoverage(const TableWriterRef* cself, int64_t rowid, INSDC_coord_zero offset, const ReferenceSeqCoverage* coverage);
-
-
-
-
-typedef struct TableWriterRefCoverage TableWriterRefCoverage;
-
-rc_t CC TableWriterRefCoverage_MakeCoverage(const TableWriterRefCoverage** cself, VDatabase* db, const uint32_t options);
-rc_t CC TableWriterRefCoverage_MakeIds(const TableWriterRefCoverage** cself, VDatabase* db, const char *col_name);
-/* rows optional here */
-rc_t CC TableWriterRefCoverage_Whack(const TableWriterRefCoverage* cself, bool commit, uint64_t* rows);
-rc_t CC TableWriterRefCoverage_WriteCoverage(const TableWriterRefCoverage* cself, int64_t rowid, const ReferenceSeqCoverage* coverage);
-rc_t CC TableWriterRefCoverage_WriteIds(const TableWriterRefCoverage* cself, int64_t rowid, const int64_t* buf,uint32_t num);
-
-#endif /* _h_align_writer_ref_ */
diff --git a/libs/align/writer-reference.c b/libs/align/writer-reference.c
deleted file mode 100644
index 8c98e7e..0000000
--- a/libs/align/writer-reference.c
+++ /dev/null
@@ -1,2584 +0,0 @@
-/*==============================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*/
-#include <align/extern.h>
-
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <klib/sort.h>
-#include <klib/data-buffer.h>
-#include <klib/container.h>
-#include <klib/checksum.h>
-#include <klib/text.h>
-#include <kfs/mmap.h>
-#include <kfs/file.h>
-#include <kdb/manager.h>
-#include <vdb/database.h>
-#include <vdb/table.h>
-#include <vdb/cursor.h>
-#include <vdb/manager.h>
-#include <vdb/vdb-priv.h>
-#include <sra/sradb.h>
-
-#include <align/writer-reference.h>
-#include <align/writer-refseq.h>
-#include <align/refseq-mgr.h>
-#include "refseq-mgr-priv.h"
-#include "writer-ref.h"
-#include "reader-cmn.h"
-#include "reference-cmn.h"
-#include "debug.h"
-#include <os-native.h>
-#include <sysalloc.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-/*
- * ReferenceSeq objects:
- *  ReferenceSeq objects may be unattached, i.e. they might not yet represent an
- *  actual sequence.
- *
- *  ReferenceSeq objects may be attached, i.e. they represent a sequence from
- *  either RefSeq or a fasta file.
- *
- *  A ReferenceSeq object may be refered to by more than one id, but a
- *  ReferenceSeq object has only one canonical id.
- *
- *  More than one ReferenceSeq object may be associated with the same seqId.
- *
- *  More than one ReferenceSeq object may be attached to the same sequence.
- *  This will cause the REFERENCE table to have more than one copy of the
- *  sequence.
- *
- *  ReferenceSeq objects may be created from the config file.  These objects
- *  will have an id, a seqId, but no fastaSeqId.  These are unattached.
- *
- *  ReferenceSeq objects may be created from explicit fasta files.  These
- *  objects will have a fastaSeqId, but *** NO id OR seqId ***. These are
- *  attached.
- *
- *  ReferenceSeq objects may be created on the fly by requesting an id that
- *  isn't already in the collection.  These objects will have the requested id.
- *
- * When a reference is requested (by id):
- *  Resolve the id to a ReferenceSeq object.
- *  If the object is unattached, attach it to a sequence.
- *  If the sequence is not yet written to the REFERENCE table, write it to the
- *  REFERENCE table.  NAME gets id; SEQID gets seqId unless seqId is null, then
- *  SEQID gets id.
- *
- * Resolving id's to ReferenceSeq objects:
- *  Search the id index and if the found object is attached, return it.
- *  Search the identifiers in the fastaSeqIds or seqIds.
- *  If different objects were found from both searches, use sequence length and
- *  MD5 to break the tie (if both match then use RefSeq).  If no sequence length
- *  or MD5 then fail.
- *  If no objects were found from either search, then create a new unattached
- *  ReferenceSeq object.
- *  If the object's id is null, set it to the id.
- *  It the object was not found in the id index, add it.
- *
- * Attaching ReferenceSeq objects to sequences:
- *  Search RefSeq for seqId.
- *  Else search RefSeq for id.
- *  Else search for seqId in the loaded fasta files.
- *  Else search data directory for id.fasta or id.fa; load it or fail.
- *  Else search data directory for seqId.fasta or seqId.fa; load it or fail.
- *  Else fail.
- *  If failed, mark the object as dead.
- *
- *
- *
- * Config file:
- *  The config file consists of lines containing whitespace (preferably tab)
- *  seperated fields.  The fields are:
- *      NAME (unique)
- *      SEQID
- *      extra (optional)
- *
- *  There is one ReferenceSeq object created per record in the config file.
- *  NAME is stored in id; SEQID is stored in seqId; if extra contains the word
- *  'circular' (case-insensitive), true is stored in circular.  These
- *  ReferenceSeq object are created in the unattached state, i.e. not attached
- *  to a fasta file or a RefSeq library object.
- *
- * Fasta files:
- *  Fasta file consists of one of more sequences.  A sequence in a fasta file
- *  consists of a seqid line followed by lines containing the bases of the
- *  sequence.  A seqid line starts with '>' and the next word (whitespace
- *  delimited) is the seqid.  The seqid may consist of '|' delimited identifiers
- *  (this is purposely vague).  The fasta seqid is stored in fastaSeqId.
- *
- * Fasta files may be loaded explicitly:
- *  When a fasta file is loaded explicitly, a new ReferenceSeq object is created
- *  (with id == NULL) for each sequence found in the file.
- *
- * Fasta files may be loaded implicitly:
- *  When an id can't be found in the set of ReferenceSeq objects and can't be
- *  found as an accession by RefSeq, an attempt is made to load a fasta file
- *  named <id>.fasta or <id>.fa in the directory given to the constructor.  If
- *  this succeeds, a new ReferenceSeq object with the given id is attached to
- *  the sequence.  In this situation, to avoid ambiquity, there can be only one
- *  sequence in the fasta file.
- *
- */
-
-enum ReferenceSeqType {
-    rst_unattached,
-    rst_local,
-    rst_refSeqById,
-    rst_refSeqBySeqId,
-    rst_dead
-};
-
-struct ReferenceSeq {
-    ReferenceMgr *mgr;
-    char *id;
-    char *seqId;
-    char *fastaSeqId;
-    /* ref table position */
-    int64_t start_rowid;
-    /* total reference length */
-    INSDC_coord_len seq_len;
-    int type;
-    bool circular;
-    uint8_t md5[16];
-    union {
-        struct {
-            KDataBuffer buf;
-            uint8_t const *data;
-        } local;
-        RefSeq const *refseq;
-    } u;
-};
-
-struct ReferenceMgr {
-    TableWriterRef const *writer;
-    KDirectory const *dir;
-    RefSeqMgr const *rmgr;
-    VDatabase *db;
-    ReferenceSeq *refSeq;
-    
-    int64_t ref_rowid;
-    
-    size_t cache;
-    
-    uint32_t options;
-    uint32_t num_open_max;
-    uint32_t num_open;
-    uint32_t max_seq_len;
-    
-    KDataBuffer compress;
-    KDataBuffer seq;
-    KDataBuffer refSeqs;
-    KDataBuffer refSeqsById;
-};
-
-typedef struct key_id_t {
-    char const *key;
-    int64_t id;
-} key_id_t;
-
-static
-int CC key_id_cmp(const void *arg1, const void *arg2, void *data)
-{
-    key_id_t const *a = arg1;
-    key_id_t const *b = arg2;
-    
-    return strcmp(a->key, b->key);
-}
-
-static
-void CC ReferenceSeq_Whack(ReferenceSeq *self)
-{
-    if (self->type == rst_local) {
-        KDataBufferWhack(&self->u.local.buf);
-    }
-    else if (self->type == rst_refSeqById || self->type == rst_refSeqBySeqId) {
-        RefSeq_Release(self->u.refseq);
-    }
-    free(self->id);
-    free(self->seqId);
-    free(self->fastaSeqId);
-}
-
-struct OpenConfigFile_ctx {
-    char const *name;
-    KDirectory const *dir;
-    KFile const **kfp;
-    rc_t rc;
-};
-
-static
-bool OpenConfigFile(char const server[], char const volume[], void *Ctx)
-{
-    struct OpenConfigFile_ctx *ctx = Ctx;
-    KDirectory const *dir;
-    
-    if( volume == NULL ) {
-        ctx->rc = KDirectoryOpenDirRead(ctx->dir, &dir, false, "%s", server);
-    } else {
-        ctx->rc = KDirectoryOpenDirRead(ctx->dir, &dir, false, "%s/%s", server, volume);
-    }
-    if (ctx->rc == 0) {
-        ctx->rc = KDirectoryOpenFileRead(dir, ctx->kfp, ctx->name);
-        KDirectoryRelease(dir);
-        if (ctx->rc == 0) {
-            return true;
-        }
-    }
-    return false;
-}
-
-static
-rc_t FindAndOpenConfigFile(RefSeqMgr const *const rmgr,
-                           KDirectory const *const dir,
-                           KFile const **const kfp, char const conf[])
-{
-    rc_t rc = KDirectoryOpenFileRead(dir, kfp, conf);
-    
-    if (rc) {
-        struct OpenConfigFile_ctx ctx;
-
-        ctx.name = conf;
-        ctx.dir = dir;
-        ctx.kfp = kfp;
-        ctx.rc = 0;
-        
-        rc = RefSeqMgr_ForEachVolume(rmgr, OpenConfigFile, &ctx);
-        if (rc == 0 && *kfp == NULL) {
-            rc = RC(rcAlign, rcIndex, rcConstructing, rcFile, rcNotFound);
-        }
-    }
-    return rc;
-}
-
-enum comparison_weights {
-    no_match        = 0,
-    substring_match = (1u << 0),
-    expected_prefix = (1u << 1),
-    exact_match     = (1u << 2),
-    seq_len_match   = (1u << 3),
-    md5_match       = (1u << 4)
-};
-
-static
-unsigned str_weight(char const str[], char const qry[], unsigned const qry_len)
-{
-    char const *const fnd = strcasestr(str, qry);
-    unsigned wt = no_match;
-    
-    if (fnd) {
-        unsigned const fnd_len = string_size( fnd );
-        unsigned const fndlen = (fnd_len > qry_len && fnd[qry_len] == '|') ? qry_len : fnd_len;
-        
-        if (fndlen == qry_len && (fnd == str || fnd[-1] == '|')) {
-            wt |= substring_match;
-            
-            if (fnd == str) {
-                if (fnd[fndlen] == '\0')
-                    wt |= exact_match;
-            }
-            else {
-                /* check for expected prefices */
-                char const *ns = fnd - 1;
-                
-                while (ns != str && ns[-1] != '|')
-                    --ns;
-                
-                if (   memcmp(ns, "ref|", 4) == 0
-                    || memcmp(ns, "emb|", 4) == 0
-                    || memcmp(ns, "dbg|", 4) == 0
-                    || memcmp(ns, "tpg|", 4) == 0
-                    || memcmp(ns, "tpe|", 4) == 0
-                    || memcmp(ns, "tpd|", 4) == 0
-                    || memcmp(ns, "gpp|", 4) == 0
-                    || memcmp(ns,  "gb|", 3) == 0
-                    )
-                {
-                    wt |= expected_prefix;
-                }
-            }
-        }
-    }
-    return wt;
-}
-
-static
-rc_t ReferenceMgr_AddId(ReferenceMgr *const self, char const ID[],
-                        ReferenceSeq const *const obj)
-{
-    char *id = string_dup( ID, string_size( ID ) );
-    unsigned const last_id = self->refSeqsById.elem_count;
-    
-    if (id) {
-        rc_t rc = KDataBufferResize(&self->refSeqsById, last_id + 1);
-        
-        if (rc == 0) {
-            key_id_t *kid = &((key_id_t *)self->refSeqsById.base)[last_id];
-            
-            kid->key = id;
-            kid->id = obj - self->refSeq;
-            
-            ksort(self->refSeqsById.base, self->refSeqsById.elem_count, sizeof(key_id_t), key_id_cmp, NULL);
-        }
-        else
-            free(id);
-        
-        return rc;
-    }
-    else
-        return RC(rcAlign, rcIndex, rcInserting, rcMemory, rcExhausted);
-}
-
-static
-key_id_t *ReferenceMgr_FindId(ReferenceMgr const *const self, char const id[])
-{
-    key_id_t qry;
-    
-    qry.key = id;
-    qry.id = 0;
-    
-    return kbsearch(&qry, self->refSeqsById.base,
-                    self->refSeqsById.elem_count,
-                    sizeof(qry), key_id_cmp, NULL);
-}
-
-static
-rc_t ReferenceMgr_NewReferenceSeq(ReferenceMgr *const self, ReferenceSeq **const rslt)
-{
-    unsigned const last_rs = self->refSeqs.elem_count;
-    rc_t rc = KDataBufferResize(&self->refSeqs, last_rs + 1);
-    
-    if (rc) return rc;
-    self->refSeq = self->refSeqs.base;
-    
-    *rslt = &self->refSeq[last_rs];
-    memset(&self->refSeq[last_rs], 0, sizeof(self->refSeq[0]));
-    self->refSeq[last_rs].mgr = self;
-
-    return 0;
-}
-
-static
-int CC config_cmp(void const *A, void const *B, void *Data)
-{
-    struct {
-        unsigned id;
-        unsigned seqId;
-        unsigned extra;
-        unsigned extralen;
-    } const *const a = A;
-    struct {
-        unsigned id;
-        unsigned seqId;
-        unsigned extra;
-        unsigned extralen;
-    } const *const b = B;
-    char const *const data = Data;
-    
-    return strcmp(&data[a->id], &data[b->id]);
-}
-
-static
-rc_t ReferenceMgr_ProcessConf(ReferenceMgr *const self, char Data[], unsigned const len)
-{
-    rc_t rc;
-    unsigned i;
-    unsigned j;
-    struct {
-        unsigned id;
-        unsigned seqId;
-        unsigned extra;
-        unsigned extralen;
-    } *data, tmp;
-    KDataBuffer buf;
-    
-    memset(&buf, 0, sizeof(buf));
-    buf.elem_bits = sizeof(data[0]) * 8;
-    
-    for (j = i = 0; i < len; ++j) {
-        unsigned lineEnd;
-        unsigned id;
-        unsigned acc;
-        unsigned ii;
-        
-        for (lineEnd = i; lineEnd != len; ++lineEnd) {
-            int const ch = Data[lineEnd];
-            
-            if (ch == '\n')
-                break;
-            if (ch == '\r')
-                break;
-        }
-        if (i == lineEnd) {
-            ++i;
-            continue;
-        }
-        Data[lineEnd] = '\0';
-        for (id = i; id != lineEnd; ++id) {
-            int const ch = Data[id];
-            
-            if (!isspace(ch))
-                break;
-        }
-        for (ii = id; ii != lineEnd; ++ii) {
-            int const ch = Data[ii];
-            
-            if (isspace(ch)) {
-                Data[ii++] = '\0';
-                break;
-            }
-        }
-        for (acc = ii; acc < lineEnd; ++acc) {
-            int const ch = Data[acc];
-            
-            if (!isspace(ch))
-                break;
-        }
-        if (acc >= lineEnd)
-            return RC(rcAlign, rcFile, rcReading, rcFormat, rcInvalid);
-        
-        for (ii = acc; ii != lineEnd; ++ii) {
-            int const ch = Data[ii];
-            
-            if (isspace(ch)) {
-                Data[ii++] = '\0';
-                break;
-            }
-        }
-        tmp.id = id;
-        tmp.seqId = acc;
-        tmp.extra = ii;
-        tmp.extralen = lineEnd > ii ? lineEnd - ii : 0;
-        
-        if ((rc = KDataBufferResize(&buf, buf.elem_count + 1)) != 0) return rc;
-        data = buf.base;
-        
-        data[buf.elem_count-1] = tmp;
-        i = lineEnd + 1;
-    }
-    
-    /* check unique */
-    ksort(data, buf.elem_count, sizeof(data[0]), config_cmp, Data);
-    for (i = 1; i < buf.elem_count; ++i) {
-        if (strcmp(&Data[data[i-1].id], &Data[data[i].id]) == 0)
-            return RC(rcAlign, rcIndex, rcConstructing, rcItem, rcExists);
-    }
-
-    for (i = 0; i != buf.elem_count; ++i) {
-        unsigned const extralen = data[i].extralen;
-        char const *const id    = &Data[data[i].id];
-        char const *const seqId = &Data[data[i].seqId];
-        char const *const extra = extralen ? &Data[data[i].extra] : NULL;
-        bool circular = false;
-        ReferenceSeq *rs;
-        
-        if (extra && extralen >= 8) {
-            char const *const circ = strcasestr(extra, "circular");
-            
-            circular = circ && (circ == extra || isspace(circ[-1])) &&
-                       (circ[8] == '\0' || isspace(circ[8]));
-        }
-        if ((rc = ReferenceMgr_NewReferenceSeq(self, &rs)) != 0) return rc;
-        
-        rs->id = string_dup( id, string_size( id ) );
-        if ( rs->id == NULL )
-            return RC(rcAlign, rcFile, rcReading, rcMemory, rcExhausted);
-
-        rs->seqId = string_dup( seqId, string_size( seqId ) );
-        if ( rs->seqId == NULL )
-            return RC(rcAlign, rcFile, rcReading, rcMemory, rcExhausted);
-        
-        rs->circular = circular;
-    }
-    KDataBufferWhack(&buf);
-    return 0;
-}
-
-static
-rc_t ReferenceMgr_Conf(ReferenceMgr *const self, char const conf[])
-{
-    rc_t rc;
-    const KFile* kf = NULL;
-
-    if (conf == NULL)
-        return 0;
-    
-    rc = FindAndOpenConfigFile(self->rmgr, self->dir, &kf, conf);
-    if (rc == 0) {
-        uint64_t sz;
-        KDataBuffer buf;
-        
-        rc = KFileSize(kf, &sz);
-        assert(rc == 0);
-        if (sz == 0)
-            (void)PLOGMSG(klogWarn, (klogWarn, "Configuration file '$(file)' is empty", "file=%s", conf));
-        else {
-            rc = KDataBufferMakeBytes(&buf, sz + 1);
-            if (rc == 0) {
-                size_t nread;
-                
-                rc = KFileReadAll(kf, 0, buf.base, sz, &nread);
-                if (rc == 0) {
-                    assert(nread == sz);
-                    ((char *)buf.base)[sz] = '\n'; /* make sure that last line is terminated */
-                    rc = ReferenceMgr_ProcessConf(self, buf.base, sz + 1);
-                }
-                KDataBufferWhack(&buf);
-            }
-        }
-        KFileRelease(kf);
-    }
-    return rc;
-}
-
-static
-rc_t ReferenceMgr_FastaFile_GetSeqIds(KDataBuffer *const buf, char const data[], uint64_t const len)
-{
-    uint64_t pos;
-    int st = 0;
-    
-    for (pos = 0; pos < len; ++pos) {
-        int const ch = data[pos];
-        
-        if (st == 0) {
-            if (ch == '>') {
-                uint64_t const n = buf->elem_count;
-                rc_t rc = KDataBufferResize(buf, n + 1);
-                
-                if (rc)
-                    return rc;
-                ((uint64_t *)buf->base)[n] = pos;
-                st = 1;
-            }
-        }
-        else if (ch == '\r' || ch == '\n') 
-            st = 0;
-    }
-    return 0;
-}
-
-static
-rc_t ReferenceMgr_ImportFasta(ReferenceMgr *const self, ReferenceSeq *obj, KDataBuffer *const buf)
-{
-    unsigned seqId;
-    unsigned seqIdLen;
-    unsigned ln;
-    unsigned src;
-    unsigned dst;
-    unsigned start=0;
-    char *const data = buf->base;
-    unsigned const len = buf->elem_count;
-    rc_t rc;
-    MD5State mds;
-    
-    memset(obj, 0, sizeof(*obj));
-    obj->mgr = self;
-    
-    if (len == 0)
-        return 0;
-    assert(data[0] == '>');
-    
-    for (ln = 1; ln != len; ++ln) {
-        int const ch = data[ln];
-        
-        if (ch == '\r' || ch == '\n') {
-            data[ln] = '\0';
-            start = ln + 1;
-            break;
-        }
-    }
-    for (seqId = 1; seqId != ln; ++seqId) {
-        if (!isspace(data[seqId]))
-            break;
-    }
-    for (seqIdLen = 0; seqId + seqIdLen < ln; ++seqIdLen) {
-        if (isspace(data[seqId + seqIdLen])) {
-            ln = seqId + seqIdLen;
-            data[ln] = '\0';
-            break;
-        }
-    }
-    if (seqIdLen == 0)
-        return RC(rcAlign, rcFile, rcReading, rcData, rcInvalid);
-    
-    obj->fastaSeqId = string_dup( &data[ seqId ], string_size( &data[ seqId ] ) );
-    if ( obj->fastaSeqId == NULL )
-        return RC(rcAlign, rcFile, rcReading, rcMemory, rcExhausted);
-    
-    MD5StateInit(&mds);
-    for (dst = src = start; src != len; ++src) {
-        int const ch = toupper(data[src]);
-        
-        if (isspace(ch))
-            continue;
-        
-        if (strchr(INSDC_4na_map_CHARSET, ch) == NULL && ch != 'X')
-            return RC(rcAlign, rcFile, rcReading, rcData, rcInvalid);
-        
-        data[dst] = ch == 'X' ? 'N' : ch;
-        MD5StateAppend(&mds, data + dst, 1);
-        ++dst;
-    }
-    MD5StateFinish(&mds, obj->md5);
-    rc = KDataBufferSub(buf, &obj->u.local.buf, start, dst - start);
-    if (rc == 0) {
-        obj->type = rst_local;
-        obj->seq_len = dst - start;
-    }
-    else
-        obj->type = rst_dead;
-    return rc;
-}
-
-#define READ_CHUNK_SIZE (1024 * 1024)
-
-static
-rc_t ReferenceMgr_ImportFastaFile(ReferenceMgr *const self, KFile const *kf,
-                                  ReferenceSeq *rslt)
-{
-    uint64_t file_size;
-    rc_t rc = KFileSize(kf, &file_size);
-    
-    if (rc == 0) {
-        KDataBuffer fbuf;
-        
-        rc = KDataBufferMake(&fbuf, 8, file_size);
-        if (rc == 0) {
-            fbuf.elem_count = 0;
-            do {
-                size_t const readable = file_size - fbuf.elem_count;
-                size_t const to_read = readable > READ_CHUNK_SIZE ? READ_CHUNK_SIZE : readable;
-                size_t nread = 0;
-                
-                rc = KFileRead(kf, fbuf.elem_count, &((uint8_t *)fbuf.base)[fbuf.elem_count], to_read, &nread);
-                if (rc != 0 || nread == 0)
-                    break;
-                fbuf.elem_count += nread;
-            } while (fbuf.elem_count < file_size);
-            if (rc == 0) {
-                char const *const base = fbuf.base;
-                KDataBuffer seqIdBuf;
-                
-                memset(&seqIdBuf, 0, sizeof(seqIdBuf));
-                seqIdBuf.elem_bits = sizeof(file_size) * 8;
-                
-                rc = ReferenceMgr_FastaFile_GetSeqIds(&seqIdBuf, base, file_size);
-                if (rc == 0) {
-                    uint64_t const *const seqIdOffset = seqIdBuf.base;
-                    unsigned const seqIds = seqIdBuf.elem_count;
-                    unsigned i;
-                    KDataBuffer sub;
-                    
-                    if (rslt) {
-                        if (seqIds > 1)
-                            rc = RC(rcAlign, rcFile, rcReading, rcItem, rcUnexpected);
-                        
-                        memset(&sub, 0, sizeof(sub));
-                        KDataBufferSub(&fbuf, &sub, seqIdOffset[0], file_size - seqIdOffset[0]);
-                        rc = ReferenceMgr_ImportFasta(self, rslt, &sub);
-                        KDataBufferWhack(&sub);
-                    }
-                    else
-                        for (i = 0; i != seqIds; ++i) {
-                            uint64_t const ofs = seqIdOffset[i];
-                            uint64_t const nxt = (i < seqIds - 1) ? seqIdOffset[i + 1] : file_size;
-                            uint64_t const len = nxt - ofs;
-                            ReferenceSeq tmp;
-                            ReferenceSeq *new_seq;
-                            
-                            memset(&sub, 0, sizeof(sub));
-                            KDataBufferSub(&fbuf, &sub, ofs, len);
-                            rc = ReferenceMgr_ImportFasta(self, &tmp, &sub);
-                            KDataBufferWhack(&sub);
-                            if (rc) break;
-                            
-                            rc = ReferenceMgr_NewReferenceSeq(self, &new_seq);
-                            if (rc) break;
-                            
-                            *new_seq = tmp;
-                        }
-                }
-                KDataBufferWhack(&seqIdBuf);
-            }
-            KDataBufferWhack(&fbuf);
-        }
-    }
-    return rc;
-}
-
-static
-rc_t OpenFastaFile(KFile const **const kf,
-                   KDirectory const *const dir,
-                   char const base[],
-                   unsigned const len)
-{
-    char fname_a[4096];
-    char *fname_h = NULL;
-    char *fname = fname_a;
-    rc_t rc;
-    
-    if (len + 7 >= sizeof(fname_a)) {
-        fname_h = malloc(len + 7);
-        if (fname_h)
-            fname = fname_h;
-        else
-            return RC(rcAlign, rcFile, rcOpening, rcMemory, rcExhausted);
-    }
-    memcpy(fname, base, len);
-    memcpy(fname + len, ".fasta", 7);
-    
-    rc = KDirectoryOpenFileRead(dir, kf, fname);
-    if (rc) {
-        fname[len + 3] = '\0'; /* base.fasta -> base.fa */
-        
-        rc = KDirectoryOpenFileRead(dir, kf, fname);
-    }
-    free(fname_h);
-    return rc;
-}
-
-#if 1
-void ReferenceSeq_Dump(ReferenceSeq const *const rs, unsigned const i, key_id_t const *const key_id_array, unsigned const m)
-{
-    static char const *types[] = {
-        "'unattached'",
-        "'fasta'",
-        "'RefSeq-by-id'",
-        "'RefSeq-by-seqid'",
-        "'dead'"
-    };
-    unsigned j;
-    
-    ALIGN_CF_DBGF(("{ "));
-    ALIGN_CF_DBGF(("type: %s, ", (rs->type < 0 || rs->type > rst_dead) ? "null" : types[rs->type]));
-    
-    if (rs->id)
-        ALIGN_CF_DBGF(("id: '%s', ", rs->id));
-    else
-        ALIGN_CF_DBGF(("id: null, "));
-    
-    if (rs->seqId)
-        ALIGN_CF_DBGF(("seqId: '%s', ", rs->seqId));
-    else
-        ALIGN_CF_DBGF(("seqId: null, "));
-    
-    if (rs->fastaSeqId)
-        ALIGN_CF_DBGF(("fastaSeqId: '%s', ", rs->fastaSeqId));
-    else
-        ALIGN_CF_DBGF(("fastaSeqId: null, "));
-    
-    ALIGN_CF_DBGF(("seq-len: %u, ", rs->seq_len));
-    ALIGN_CF_DBGF(("circular: %s, ", rs->circular ? "true" : "false"));
-    
-    if (rs->md5) {
-        ALIGN_CF_DBGF(("md5: '"));
-        for (j = 0; j != 16; ++j)
-            ALIGN_CF_DBGF(("%02X", rs->md5[j]));
-        ALIGN_CF_DBGF(("', "));
-    }
-    else
-        ALIGN_CF_DBGF(("md5: null, "));
-    
-    
-    ALIGN_CF_DBGF(("keys: [ "));
-    for (j = 0; j != m; ++j) {
-        key_id_t const *const kid = &key_id_array[j];
-        
-        if (kid->id == i)
-            ALIGN_CF_DBGF(("'%s', ", kid->key));
-    }
-    ALIGN_CF_DBGF(("] }"));
-}
-
-void ReferenceMgr_DumpConfig(ReferenceMgr const *const self)
-{
-    unsigned const n = self->refSeqs.elem_count;
-    unsigned const m = self->refSeqsById.elem_count;
-    key_id_t const *const key_id_array = self->refSeqsById.base;
-    unsigned i;
-    
-    ALIGN_CF_DBGF(("config: [\n"));
-    for (i = 0; i != n; ++i) {
-        ALIGN_CF_DBGF(("\t"));
-        ReferenceSeq_Dump(&self->refSeq[i], i, key_id_array, m);
-        ALIGN_CF_DBGF((",\n"));
-    }
-    ALIGN_CF_DBGF(("]\n"));
-}
-#endif
-
-static
-rc_t ReferenceMgr_TryFasta(ReferenceMgr *const self, ReferenceSeq *const seq,
-                           char const id[], unsigned const idLen)
-{
-    KFile const *kf = NULL;
-    rc_t rc;
-    
-    rc = OpenFastaFile(&kf, self->dir, id, idLen);
-    
-    if (rc == 0) {
-        rc = ReferenceMgr_ImportFastaFile(self, kf, seq);
-        KFileRelease(kf);
-    }
-    return rc;
-}
-
-static
-rc_t ReferenceSeq_GetRefSeqInfo(ReferenceSeq *const self)
-{
-    rc_t rc;
-    uint8_t const *md5;
-    
-    assert(self != NULL);
-    assert(self->type == rst_refSeqById || self->type == rst_refSeqBySeqId);
-    
-    if ((rc = RefSeq_Circular(self->u.refseq, &self->circular)) != 0)
-        return rc;
-    if ((rc = RefSeq_SeqLength(self->u.refseq, &self->seq_len)) != 0)
-        return rc;
-    if ((rc = RefSeq_MD5(self->u.refseq, &md5)) != 0)
-        return rc;
-    
-    memcpy(self->md5, md5, 16);
-    return 0;
-}
-
-static
-rc_t ReferenceSeq_Attach(ReferenceMgr *const self, ReferenceSeq *const rs)
-{
-    unsigned const seqid_len = rs->seqId ? string_size( rs->seqId ) : 0;
-    unsigned const id_len = rs->id ? string_size( rs->id ) : 0;
-    rc_t rc = 0;
-    KFile const *kf = NULL;
-    
-    assert(rs->type == rst_unattached);
-    assert(id_len != 0 || seqid_len != 0);
-    
-    if (seqid_len) {
-        ALIGN_CF_DBGF(("trying to open refseq: %.*s\n", seqid_len, rs->seqId));
-        if (RefSeqMgr_Exists(self->rmgr, rs->seqId, seqid_len, NULL) == 0) {
-            rc = RefSeqMgr_GetSeq(self->rmgr, &rs->u.refseq, rs->seqId, seqid_len);
-            if (rc == 0) {
-                rs->type = rst_refSeqBySeqId;
-                rc = ReferenceSeq_GetRefSeqInfo(rs);
-            }
-            return rc;
-        }
-    }
-    if (id_len) {
-        ALIGN_CF_DBGF(("trying to open refseq: %.*s\n", id_len, rs->id));
-        if (RefSeqMgr_Exists(self->rmgr, rs->id, id_len, NULL) == 0) {
-            rc = RefSeqMgr_GetSeq(self->rmgr, &rs->u.refseq, rs->id, id_len);
-            if (rc == 0) {
-                rs->type = rst_refSeqById;
-                rc = ReferenceSeq_GetRefSeqInfo(rs);
-            }
-            return rc;
-        }
-    }
-    if (id_len) {
-        ALIGN_CF_DBGF(("trying to open fasta: %.*s\n", id_len, rs->id));
-        rc = OpenFastaFile(&kf, self->dir, rs->id, id_len);
-        if (rc && seqid_len) {
-            ALIGN_CF_DBGF(("trying to open fasta: %.*s\n", seqid_len, rs->seqId));
-            rc = OpenFastaFile(&kf, self->dir, rs->seqId, seqid_len);
-        }
-    }
-    else {
-        ALIGN_CF_DBGF(("trying to open fasta: %.*s\n", seqid_len, rs->seqId));
-        rc = OpenFastaFile(&kf, self->dir, rs->seqId, seqid_len);
-    }
-    if (kf) {
-        ReferenceSeq tmp;
-        
-        ALIGN_CF_DBGF(("importing fasta"));
-        rc = ReferenceMgr_ImportFastaFile(self, kf, &tmp);
-        KFileRelease(kf);
-        if (rc == 0) {
-            tmp.id = rs->id;
-            tmp.seqId = rs->seqId;
-            tmp.circular = rs->circular;
-            
-            *rs = tmp;
-        }
-        return rc;
-    }
-    return 0;
-}
-
-static
-rc_t ReferenceMgr_OpenSeq(ReferenceMgr *const self, ReferenceSeq **const rslt,
-                          char const id[],
-                          unsigned const seq_len,
-                          uint8_t const md5[16])
-{
-    unsigned const idLen = string_size( id );
-    key_id_t const *const fnd = ReferenceMgr_FindId(self, id);
-    
-    assert(rslt != NULL);
-    *rslt = NULL;
-    if (fnd) {
-        if (self->refSeq[fnd->id].type == rst_dead)
-            return RC(rcAlign, rcIndex, rcSearching, rcItem, rcInvalid);
-        *rslt = &self->refSeq[fnd->id];
-        return 0;
-    }
-    else {
-        unsigned const n = self->refSeqs.elem_count;
-        unsigned i;
-        ReferenceSeq *seq = NULL;
-        rc_t rc = 0;
-        
-        /* try to find by id; this should work most of the time */
-        for (i = 0; i != n; ++i) {
-            ReferenceSeq *const rs = &self->refSeq[i];
-
-            if (rs->type == rst_dead)
-                continue;
-            
-            if (rs->id && strcmp(rs->id, id) == 0) {
-                seq = rs;
-                break;
-            }
-        }
-        if (seq == NULL) {
-            /* try to find by seqId */
-            for (i = 0; i != n; ++i) {
-                ReferenceSeq *const rs = &self->refSeq[i];
-                
-                if (rs->type == rst_dead)
-                    continue;
-                
-                if (rs->seqId && strcasecmp(rs->seqId, id) == 0) {
-                    seq = rs;
-                    break;
-                }
-            }
-        }
-        if (seq == NULL) {
-            /* try to find id within fasta seqIds */
-            unsigned best_wt = 0;
-            unsigned best = n;
-            
-            for (i = 0; i != n; ++i) {
-                ReferenceSeq const *const rs = &self->refSeq[i];
-                
-                if (rs->fastaSeqId) {
-                    unsigned wt = str_weight(rs->fastaSeqId, id, idLen);
-                    
-                    if (wt != no_match) {
-                        if (seq_len && rs->seq_len == seq_len)
-                            wt |= seq_len_match;
-                        if (md5 && memcmp(rs->md5, md5, 16) == 0)
-                            wt |= md5_match;
-                    }
-                    if (best_wt < wt) {
-                        best_wt = wt;
-                        best = i;
-                    }
-                }
-            }
-            if (best < n)
-                seq = &self->refSeq[best];
-        }
-        if (seq == NULL) {
-            /* try id.fasta or id.fa */
-            rc = ReferenceMgr_NewReferenceSeq(self, &seq);
-            if (rc) return rc;
-            rc = ReferenceMgr_TryFasta(self, seq, id, idLen);
-            if (GetRCState(rc) == rcNotFound && GetRCObject(rc) == rcPath)
-                rc = 0;
-            else if (rc) return rc;
-        }
-        else if (seq->type == rst_unattached) {
-            /* expect to get here most of the time
-             *
-             * ReferenceSeq_Attach tries to get reference:
-             *  from RefSeqMgr:
-             *   by seqId
-             *   by id
-             *  from self->dir (data directory)
-             *   id.fasta
-             *   id.fa
-             *   seqId.fasta
-             *   seqId.fa
-             */
-            rc = ReferenceSeq_Attach(self, seq);
-            if (rc) return rc;
-            
-            if (seq->type == rst_unattached && seq->seqId != NULL) {
-                /* attach didn't work for id; try to find seqId within fasta seqIds */
-                unsigned const seqIdLen = string_size( seq->seqId );
-                unsigned best_wt = 0;
-                unsigned best = n;
-                
-                for (i = 0; i != n; ++i) {
-                    ReferenceSeq const *const rs = &self->refSeq[i];
-                    
-                    if (rs->type == rst_local && rs->fastaSeqId) {
-                        unsigned wt = str_weight(rs->fastaSeqId, seq->seqId, seqIdLen);
-                        
-                        if (wt != no_match) {
-                            if (seq_len && rs->seq_len == seq_len)
-                                wt |= seq_len_match;
-                            if (md5 && memcmp(rs->md5, md5, 16) == 0)
-                                wt |= md5_match;
-                        }
-                        if (best_wt < wt) {
-                            best_wt = wt;
-                            best = i;
-                        }
-                    }
-                }
-                if (best < n) {
-                    char *const tmp_id = seq->id;
-                    char *const tmp_seqId = seq->seqId;
-                    bool const tmp_circ = seq->circular;
-                    
-                    *seq = self->refSeq[best];
-                    seq->id = tmp_id;
-                    seq->seqId = tmp_seqId;
-                    seq->fastaSeqId = NULL;
-                    seq->circular = tmp_circ;
-
-                    /* add another reference to the data buffer */
-                    rc = KDataBufferSub(&self->refSeq[best].u.local.buf, &seq->u.local.buf, 0, 0);
-                    if (rc) return rc;
-                }
-            }
-        }
-        assert(seq != NULL);
-        if (seq->type == rst_unattached) {
-            /* nothing has worked and nothing left to try */
-            seq->type = rst_dead;
-            rc = RC(rcAlign, rcFile, rcConstructing, rcId, rcNotFound);
-        }
-        else {
-            ReferenceSeq *alt = NULL;
-            
-            /* perform ambiguity check
-             *
-             * This search follows the same pattern as the main search but has
-             * more stringent conditions.  One hopes that it fails to find
-             * anything.
-             */
-            for (i = 0; i != n; ++i) {
-                ReferenceSeq *const rs = &self->refSeq[i];
-                
-                if (   rs->type != rst_dead
-                    && rs->type != rst_unattached
-                    && rs != seq
-                    && rs->id != NULL
-                    && strcmp(id, rs->id) == 0
-                    && (seq_len == 0 || seq_len == rs->seq_len))
-                {
-                    alt = rs;
-                    break;
-                }
-            }
-            if (alt == NULL) {
-                for (i = 0; i != n; ++i) {
-                    ReferenceSeq *const rs = &self->refSeq[i];
-                    
-                    if (   rs->type != rst_dead
-                        && rs->type != rst_unattached
-                        && rs != seq
-                        && rs->seqId != NULL
-                        && strcasecmp(id, rs->seqId) == 0
-                        && (seq_len == 0 || seq_len == rs->seq_len))
-                    {
-                        alt = rs;
-                        break;
-                    }
-                }
-            }
-            if (alt == NULL) {
-                unsigned best_wt = 0;
-                unsigned best = n;
-                
-                for (i = 0; i != n; ++i) {
-                    ReferenceSeq const *const rs = &self->refSeq[i];
-                    
-                    if (rs != seq && rs->fastaSeqId && rs != seq) {
-                        unsigned wt = str_weight(rs->fastaSeqId, id, idLen);
-                        
-                        if (wt != no_match) {
-                            if (seq_len && rs->seq_len == seq_len)
-                                wt |= seq_len_match;
-                            if (md5 && memcmp(rs->md5, md5, 16) == 0)
-                                wt |= md5_match;
-                        }
-                        if (best_wt < wt) {
-                            best_wt = wt;
-                            best = i;
-                        }
-                    }
-                }
-                if (best < n)
-                    alt = &self->refSeq[best];
-            }
-            /* try to knock the alternative out of consideration
-             * if it survives length and md5 tests, it is *really* likely to be
-             * a duplicate.
-             */
-            if (alt != NULL && seq_len != 0 && seq_len != alt->seq_len)
-                alt = NULL;
-            if (alt != NULL && md5 != NULL && memcmp(md5, alt->md5, 16) != 0)
-                alt = NULL;
-            if (alt != NULL) {
-                seq->type = rst_dead;
-                rc = RC(rcAlign, rcFile, rcConstructing, rcId, rcAmbiguous);
-            }
-        }
-        if ( seq->id == NULL )
-        {
-            seq->id = string_dup( id, string_size( id ) );
-            if ( seq->id == NULL )
-                return RC(rcAlign, rcFile, rcConstructing, rcMemory, rcExhausted);
-        }
-        /* finally, associate the id with the object and put it in the index */
-        {{
-            rc_t rc2 = ReferenceMgr_AddId(self, id, seq);
-            if (rc == 0)
-                rc = rc2;
-        }}
-        if (rc == 0)
-            *rslt = seq;
-        return rc;
-    }
-}
-
-LIB_EXPORT rc_t CC ReferenceMgr_SetCache(ReferenceMgr const *const self, size_t cache, uint32_t num_open)
-{
-    return RefSeqMgr_SetCache(self->rmgr, cache, num_open);
-}
-
-static
-rc_t OpenDataDirectory(KDirectory const **rslt, char const path[])
-{
-    KDirectory *dir;
-    rc_t rc = KDirectoryNativeDir(&dir);
-    
-    if (rc == 0) {
-        if (path) {
-            rc = KDirectoryOpenDirRead(dir, rslt, false, path);
-            KDirectoryRelease(dir);
-        }
-        else
-            *rslt = dir;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC ReferenceMgr_Make(ReferenceMgr const **cself, VDatabase *db,
-                                     VDBManager const* vmgr,
-                                     const uint32_t options, char const conf[], char const path[],
-                                     uint32_t max_seq_len, size_t cache, uint32_t num_open)
-{
-    rc_t rc;
-    ReferenceMgr *self;
-    uint32_t wopt = 0;
-    
-    if (cself == NULL)
-        return RC(rcAlign, rcIndex, rcConstructing, rcParam, rcNull);
-    
-    wopt |= (options & ewrefmgr_co_allREADs) ? ewref_co_SaveRead : 0;
-    wopt |= (options & ewrefmgr_co_Coverage) ? ewref_co_Coverage : 0;
-
-    if (max_seq_len == 0)
-        max_seq_len = TableWriterRefSeq_MAX_SEQ_LEN;
-    
-    self = calloc(1, sizeof(*self));
-    if (self) {
-        rc = KDataBufferMakeBytes(&self->seq, max_seq_len);
-        if (rc == 0) {
-            self->compress.elem_bits = 32;
-            self->refSeqs.elem_bits = sizeof(ReferenceSeq) * 8;
-            self->refSeqsById.elem_bits = sizeof(key_id_t) * 8;
-            
-            self->options = options;
-            self->cache = cache;
-            self->num_open_max = num_open;
-            self->max_seq_len = max_seq_len;
-            if (db) VDatabaseAddRef(self->db = db);
-            rc = OpenDataDirectory(&self->dir, path);
-            if (rc == 0) {
-                rc = RefSeqMgr_Make(&self->rmgr, vmgr, 0, cache, num_open);
-                if (rc == 0) {
-                    rc = ReferenceMgr_Conf(self, conf);
-                    if (rc == 0) {
-                        *cself = self;
-                        ALIGN_DBG("conf %s, local path '%s'", conf ? conf : "", path ? path : "");
-                        return 0;
-                    }
-                    (void)PLOGERR(klogErr, (klogErr, rc, "failed to open configuration $(file)", "file=%s/%s", path ? path : ".", conf));
-                }
-            }
-        }
-        ReferenceMgr_Release(self, false, NULL, false, NULL);
-    }
-    else
-        rc = RC(rcAlign, rcIndex, rcConstructing, rcMemory, rcExhausted);
-
-    ALIGN_DBGERR(rc);
-
-    return rc;
-}
-
-#define ID_CHUNK_SZ 256
-
-typedef struct TChunk32_struct {
-    struct TChunk32_struct* next;
-    uint32_t id[ID_CHUNK_SZ]; /*** will only work with positive ids **/
-} TChunk32;
-
-typedef struct AlignId32List_struct {
-	TChunk32* head;
-	TChunk32* tail;
-	uint32_t  tail_qty;  /** number elements in the last chunk **/
-	uint32_t  chunk_qty; /** number of chunks */
-} AlignId32List;
-typedef struct AlignIdList_struct {
-	AlignId32List **sub_list;
-	uint32_t        sub_list_count; 
-} AlignIdList;
-
-static uint64_t AlignId32ListCount(AlignId32List *l)
-{ return (l->chunk_qty>0)?ID_CHUNK_SZ*(l->chunk_qty-1)+ l->tail_qty:0;}
-
-static uint64_t AlignIdListCount(AlignIdList *l)
-{
-	uint64_t ret=0;
-	if(l){
-		uint32_t i;
-		for(i=0;i<l->sub_list_count;i++){
-			if(l->sub_list[i]){
-				ret += AlignId32ListCount(l->sub_list[i]);
-			}
-		}
-	}
-	return ret;
-}
-static int int64_compare(const void *A, const void *B, void *ignore)
-{
-	return *(int64_t*)A -  *(int64_t*)B;
-}
-static uint64_t AlignIdListFlatCopy(AlignIdList *l,int64_t *buf,uint64_t num_elem,bool do_sort)
-{
-	uint64_t res=0;
-	uint32_t i,j;
-	AlignId32List* cl;
-	assert(l!=0);
-
-	if((cl = l->sub_list[0])!=NULL){
-		TChunk32* head  = cl->head;
-		while(head !=  cl->tail){
-			for(i=0;i<ID_CHUNK_SZ && res < num_elem;i++,res++){
-				buf[res] = head->id[i];
-			}
-			head = head->next;
-		}
-		for(i=0;i<cl->tail_qty && res < num_elem;i++,res++){
-			buf[res] = head->id[i];
-		}
-	}
-	for(j = 1; j< l->sub_list_count && res < num_elem;j++){
-		if((cl = l->sub_list[j])!=NULL){
-			TChunk32* head  = cl->head;
-			uint64_t  hi = ((uint64_t)j) << 32;
-			while(head !=  cl->tail){
-				for(i=0;i<ID_CHUNK_SZ && res < num_elem;i++,res++){
-					buf[res] = hi | head->id[i];
-				}
-				head = head->next;
-			}
-			for(i=0;i<cl->tail_qty && res < num_elem;i++,res++){
-				buf[res] = hi | head->id[i];
-			}
-		}
-	}
-	if(do_sort && res > 1) 
-		ksort(buf,res,sizeof(*buf),int64_compare,NULL);
-	return res;
-}
-
-static rc_t AlignId32ListAddId(AlignId32List *l,const uint32_t id)
-{
-	if(l->tail  == NULL){
-		l->head = l->tail = malloc(sizeof(*l->tail));
-		if(l->tail == NULL) return RC(rcAlign, rcTable, rcCommitting, rcMemory, rcExhausted);
-		l->chunk_qty =1;
-		l->tail_qty = 0;	
-	}
-	if(l->tail_qty == ID_CHUNK_SZ){/** chunk is full **/
-		l->tail->next = malloc(sizeof(*l->tail));
-		if(l->tail == NULL) return RC(rcAlign, rcTable, rcCommitting, rcMemory, rcExhausted);
-		l->tail = l->tail->next;
-		l->chunk_qty ++;
-		l->tail_qty = 0;	
-	}
-	l->tail->id[l->tail_qty++]=id;
-	return 0;
-}
-
-static rc_t AlignIdListAddId(AlignIdList *l,const int64_t id)
-{
-	uint32_t  sub_id,id32;
-	if(id < 0) return RC(rcAlign, rcTable, rcCommitting, rcId, rcOutofrange);
-	id32 = (uint32_t) id;
-	sub_id = id >> 32;
-	if(sub_id >= l->sub_list_count) return RC(rcAlign, rcTable, rcCommitting, rcId, rcOutofrange);
-	if(l->sub_list[sub_id] == NULL){
-		l->sub_list[sub_id] = calloc(1,sizeof(AlignId32List));
-		if(l->sub_list[sub_id] == NULL) return RC(rcAlign, rcTable, rcCommitting, rcMemory, rcExhausted);
-	}
-	return AlignId32ListAddId(l->sub_list[sub_id],id32);
-}
-
-static void AlignId32ListRelease(AlignId32List *l)
-{
-	if(l){
-		while(l->head != l->tail){
-			TChunk32* head = l->head;
-			l->head = l->head->next;
-			free(head);
-		}
-		free(l->head);
-		free(l);
-	}
-}
-static void AlignIdListRelease(AlignIdList *l)
-{
-        if(l){
-		uint32_t i;
-		for(i=0;i<l->sub_list_count;i++){
-			AlignId32ListRelease(l->sub_list[i]);
-		}
-		free(l->sub_list);
-		free(l);
-        }
-}
-
-
-typedef struct {
-    AlignIdList*	idlist;
-    ReferenceSeqCoverage cover;
-    INSDC_coord_len bin_seq_len;
-} TCover;
-
-static
-void ReferenceMgr_TCoverRelease(TCover* c)
-{
-	if(c){
-		AlignIdListRelease(c->idlist);
-		c->idlist = NULL;
-	}
-}
-static 
-rc_t ReferenceMgr_TCoverSetMaxId(TCover* c,int64_t id)
-{
-	uint32_t  sub_id;
-	if(id < 0) return RC(rcAlign, rcTable, rcCommitting, rcId, rcOutofrange);
-	sub_id = id >> 32;
-	if(c->idlist == NULL){
-		c->idlist = calloc(1,sizeof(AlignIdList));
-		if(c->idlist==NULL) return RC(rcAlign, rcTable, rcCommitting, rcMemory, rcExhausted);
-		c->idlist->sub_list_count = sub_id+1;
-		c->idlist->sub_list = calloc(c->idlist->sub_list_count,sizeof(c->idlist->sub_list[0]));
-		if( c->idlist->sub_list == NULL) return RC(rcAlign, rcTable, rcCommitting, rcMemory, rcExhausted);
-	} else {
-		return RC(rcAlign, rcTable, rcCommitting, rcParam, rcUnexpected);
-	}
-	return 0;
-}
-
-static
-rc_t CoverageGetSeqLen(ReferenceMgr const *const mgr, TCover data[], uint64_t const rows)
-{
-    TableReaderColumn acols[] =
-    {
-        {0, "(INSDC:coord:len)SEQ_LEN", {NULL}, 0, 0},
-        {0, NULL, {NULL}, 0, 0}
-    };
-    VTable const *tbl;
-    rc_t rc = VDatabaseOpenTableRead(mgr->db, &tbl, "REFERENCE");
-    
-    if (rc == 0) {
-        TableReader const *reader;
-        
-        rc = TableReader_Make(&reader, tbl, acols, 0);
-        if (rc == 0) {
-            uint64_t i;
-            
-            for (i = 0; i != rows; ++i) {
-                rc = TableReader_ReadRow(reader, i + 1);
-                if (rc == 0 && acols->len > 0)
-                    data[i].bin_seq_len = acols->base.coord_len[0];
-            }
-            TableReader_Whack(reader);
-        }
-        VTableRelease(tbl);
-    }
-    return rc;
-}
-
-static
-rc_t ReferenceMgr_ReCover(const ReferenceMgr* cself, uint64_t ref_rows, rc_t (*const quitting)(void))
-{
-    rc_t rc = 0;
-    uint64_t new_rows = 0;
-    const TableWriterRefCoverage* cover_writer = NULL;
-    
-    TableReaderColumn acols[] =
-    {
-        {0, "REF_ID", {NULL}, 0, 0},
-        {0, "REF_START", {NULL}, 0, 0},
-        {0, "CIGAR_LONG",{NULL}, 0, 0},
-        {0, "REF_POS",{NULL}, 0, 0},
-        {0, NULL, {NULL}, 0, 0}
-    };
-    const int64_t** al_ref_id = &acols[0].base.i64;
-    const INSDC_coord_zero** al_ref_start = &acols[1].base.coord0;
-    const TableReaderColumn* cigar =  &acols[2];
-    const INSDC_coord_zero** al_ref_pos = &acols[3].base.coord0;
-    /* order is important see ReferenceSeqCoverage struct */
-    struct {
-        const char* nm;
-	    const char* col;
-        bool ids_only;
-    } tbls[] = { {"PRIMARY_ALIGNMENT", "PRIMARY_ALIGNMENT_IDS",false},
-        {"SECONDARY_ALIGNMENT", "SECONDARY_ALIGNMENT_IDS",false},
-        {"EVIDENCE_INTERVAL", "EVIDENCE_INTERVAL_IDS", true} };
-	int tbls_qty=(sizeof(tbls)/sizeof(tbls[0]));
-    rc_t rc1 = 0;
-    int64_t rr;
-    uint32_t i;
-    uint8_t* hilo=NULL;
-    TCover* data = NULL;
-    
-    /* allocate mem for ref_rows of reference coverage*/
-    if((data = calloc(ref_rows, (sizeof(*data) + cself->max_seq_len))) == NULL ) {
-		rc = RC(rcAlign, rcTable, rcCommitting, rcMemory, rcExhausted);
-    } else {
-		/** allocation for both data and hilo was done in 1 shot ***/
-		hilo = (uint8_t *)&data[ref_rows];
-        rc = CoverageGetSeqLen(cself, data, ref_rows);
-    }
-    /* grep through tables for coverage data */
-    ALIGN_R_DBG("covering REFERENCE rowid range [1:%ld]",ref_rows);
-    for(i = 0; rc == 0 && i < tbls_qty; i++) { /* TABLE LOOP STARTS */
-        const VTable* table = NULL;
-        const TableReader* reader = NULL;
-        int64_t al_from;
-        uint64_t al_qty;
-        
-        ALIGN_R_DBG("covering REFERENCE with %s", tbls[i].nm);
-        if( (rc = VDatabaseOpenTableRead(cself->db, &table, tbls[i].nm)) != 0 ) {
-            if( GetRCState(rc) == rcNotFound ) {
-                ALIGN_R_DBG("table %s was not found, ignored", tbls[i].nm);
-                rc = 0;
-                continue;
-            } else {
-                break;
-            }
-        }
-        if( (rc = TableReader_Make(&reader, table, acols, cself->cache)) == 0 &&
-           (rc = TableReader_IdRange(reader, &al_from, &al_qty)) == 0 ) {
-            int64_t al_rowid;
-            
-            for(al_rowid = al_from; rc == 0 && al_rowid < al_from + al_qty; al_rowid++) {
-                if( (rc = TableReader_ReadRow(reader, al_rowid)) != 0 ) {
-                    break;
-                }
-                rr    = **al_ref_id-1;
-                /**** Record ALIGNMENT_IDS ***/
-                if(   data[rr].idlist == NULL 
-                   && (rc = ReferenceMgr_TCoverSetMaxId(data+rr,al_from + al_qty))!=0){
-                    break; /*** out-of-memory ***/
-                }
-                if((rc = AlignIdListAddId(data[rr].idlist,al_rowid))!=0){
-                    break; /*** out-of-memory ***/
-                }
-                /**** Done alignment ids ***/
-                if( !tbls[i].ids_only ) { /*** work on statistics ***/
-                    char const *c = cigar->base.str;
-                    const char *c_end = c + cigar->len;
-                    int64_t const global_ref_pos = rr*cself->max_seq_len + **al_ref_start; /** global_ref_start **/
-                    int64_t const global_refseq_start = global_ref_pos -  **al_ref_pos;   /** global_ref_start of current reference **/
-                    unsigned const bin_no = global_ref_pos / cself->max_seq_len;
-                    TCover *const bin = &data[bin_no];
-                    uint8_t *const cov = &hilo[global_ref_pos];
-                    int64_t ref_offset = 0;
-                    int64_t max_ref_offset = 0;
-                    int64_t min_ref_offset = 0;
-                    int64_t j;
-
-                    while (rc == 0 && c < c_end) {
-                        int op_len = strtol(c, (char **)&c, 10);
-                        int const op = *c++;
-                        
-                        switch (op){
-                        case 'I':/* extra bases in the read **/
-                            ++bin->cover.indels;
-                        case 'S':/* skip in the read */
-                            break;
-                        case 'B':/* back up in the sequence */
-                            if (ref_offset > op_len)
-                                ref_offset -= op_len;
-                            else
-                                ref_offset = 0;
-                            break;
-                        case 'D': /** delete in the reference ***/
-                            ++bin->cover.indels;
-                        case 'N': /** expected skip in the reference ***/
-                            ref_offset += op_len;
-                            break;
-                        case 'X':
-                            bin->cover.mismatches += op_len;
-                        case '=':
-                            ref_offset += op_len;
-                            break;
-                        default:
-                            rc = RC(rcAlign, rcTable, rcCommitting, rcData, rcUnrecognized);
-                        }
-                        if (min_ref_offset > ref_offset)
-                            min_ref_offset = ref_offset;
-                        if (max_ref_offset < ref_offset)
-                            max_ref_offset = ref_offset;
-                    }
-                    for (j = min_ref_offset; j < max_ref_offset; ++j) {
-                        unsigned const hl = cov[j];
-                        
-                        if (hl < UINT8_MAX)
-                            cov[j] = hl + 1;
-                    }
-                    /*** check if OVERLAPS are needed ***/
-                    {
-                        int64_t min_rr = (global_ref_pos + min_ref_offset)/cself->max_seq_len;
-                        int64_t max_rr = (global_ref_pos + max_ref_offset)/cself->max_seq_len;
-                        
-                        if(min_rr < 0) min_rr = 0;
-                        if(max_rr >= ref_rows) max_rr = ref_rows -1;
-                        
-                        assert(min_rr<= max_rr);
-                        
-                        if(min_rr < max_rr){
-                            int64_t  overlap_ref_pos; /** relative the beginning of the reference **/
-                            uint32_t overlap_ref_len = (global_ref_pos + max_ref_offset) % cself->max_seq_len ;
-                            
-                            min_rr++;
-                            if (global_ref_pos + min_ref_offset > global_refseq_start) {
-                                overlap_ref_pos = global_ref_pos + min_ref_offset - global_refseq_start;
-                            }
-                            else {
-                                overlap_ref_pos = 1;
-                            }
-                            for ( ; min_rr < max_rr; ++min_rr) {
-                                if (   data[min_rr].cover.overlap_ref_pos[i] == 0 /*** NOT SET***/
-                                    || overlap_ref_pos < data[min_rr].cover.overlap_ref_pos[i])
-                                {
-									data[min_rr].cover.overlap_ref_pos[i] = overlap_ref_pos;
-                                }
-                                data[min_rr].cover.overlap_ref_len[i] = cself->max_seq_len; /*** in between chunks get full length of overlap **/
-                            }
-                            if (   data[min_rr].cover.overlap_ref_pos[i] == 0
-                                || overlap_ref_pos < data[min_rr].cover.overlap_ref_pos[i])
-                            {
-								data[min_rr].cover.overlap_ref_pos[i] = overlap_ref_pos;
-                            }
-                            if (overlap_ref_len > data[min_rr].cover.overlap_ref_len[i])
-								data[min_rr].cover.overlap_ref_len[i] = overlap_ref_len;
-                        }
-                    }
-                } /**** DONE WITH WORK ON STATISTICS ***/
-                ALIGN_DBGERR(rc);
-                rc = rc ? rc : quitting();
-            }
-		    /*** HAVE TO RELEASE **/
-		    TableReader_Whack(reader);
-		    VTableRelease(table);
-		    /*** NOW SAVE AND RELEASE THE COLUMN ***/
-		    if( (rc = TableWriterRefCoverage_MakeIds(&cover_writer, cself->db, tbls[i].col)) == 0 ) {
-                for(rr=0; rc ==0 &&  rr < ref_rows; rr ++){
-                    uint64_t num_elem = AlignIdListCount( data[rr].idlist);
-                    uint64_t num_elem_copied = 0;
-                    if(num_elem > 0 ){
-#define BUF_STACK_COUNT 128 * 1024
-                        int64_t buf_stack[BUF_STACK_COUNT];
-                        int64_t *buf_alloc = NULL;
-                        int64_t *buf = buf_stack;
-                        if(num_elem > BUF_STACK_COUNT){
-                            buf=buf_alloc=malloc(num_elem*sizeof(buf[0]));
-                            if(buf_alloc == NULL) 
-                                rc = RC(rcAlign, rcTable, rcCommitting, rcMemory, rcExhausted);
-                        }
-                        if(rc == 0){
-                            num_elem_copied = AlignIdListFlatCopy(data[rr].idlist,buf,num_elem,true);
-                            assert(num_elem == num_elem_copied);
-                        }
-                        ReferenceMgr_TCoverRelease(data+rr); /** release memory ***/
-                        if(rc == 0){
-                            rc = TableWriterRefCoverage_WriteIds(cover_writer, rr+1, buf,num_elem);
-                        }
-                        if(buf_alloc) free(buf_alloc);
-                    } else {
-                        rc = TableWriterRefCoverage_WriteIds(cover_writer, rr+1, NULL,0);
-                    }
-                }
-                if(rc == 0){
-                    rc = TableWriterRefCoverage_Whack(cover_writer, rc == 0, &new_rows);
-                    if( rc == 0  && ref_rows != new_rows ) {
-                        rc = RC(rcAlign, rcTable, rcCommitting, rcData, rcInconsistent);
-                    }
-                }
-                ALIGN_DBGERR(rc);
-		    }
-		} else {
-			TableReader_Whack(reader);
-			VTableRelease(table);
-		}
-	}/* TABLE LOOP ENDS **/
-    /* prep and write coverage data */
-	if(rc == 0) {
-        uint64_t k;
-        
-		rc = TableWriterRefCoverage_MakeCoverage(&cover_writer, cself->db, 0);
-		for (rr = 0, k = 0; rc == 0 && rr != ref_rows; ++rr, k += cself->max_seq_len) {
-            unsigned hi = 0;
-            unsigned lo = 255;
-            
-		    for (i = 0; i != data[rr].bin_seq_len; ++i) {
-                unsigned const depth = hilo[k + i];
-                
-                if (hi < depth) hi = depth;
-                if (lo > depth) lo = depth;
-		    }
-            data[rr].cover.high = hi;
-            data[rr].cover.low  = lo;
-		    rc = TableWriterRefCoverage_WriteCoverage(cover_writer,rr+1, &data[rr].cover);
-		}
-		free(data);
-		rc1 = TableWriterRefCoverage_Whack(cover_writer, rc == 0, &new_rows);
-		rc = rc ? rc : rc1;
-		if( rc == 0 && ref_rows != new_rows ) {
-		    rc = RC(rcAlign, rcTable, rcCommitting, rcData, rcInconsistent);
-		}
-	}
-    ALIGN_DBGERR(rc);
-	return rc;
-}
-
-LIB_EXPORT rc_t CC ReferenceMgr_Release(const ReferenceMgr *cself,
-                                        const bool commit,
-                                        uint64_t *const Rows,
-                                        const bool build_coverage,
-                                        rc_t (*const quitting)(void)
-                                        )
-{
-    rc_t rc = 0;
-
-    if (cself != NULL) {
-        ReferenceMgr *const self = (ReferenceMgr *)cself;
-        uint64_t rows = 0;
-        unsigned i;
-
-        rc = TableWriterRef_Whack(self->writer, commit, &rows);
-        if (Rows) *Rows = rows;
-        KDirectoryRelease(self->dir);
-
-        for (i = 0; i != self->refSeqsById.elem_count; ++i)
-            free((void *)((key_id_t *)self->refSeqsById.base)[i].key);
-
-        for (i = 0; i != self->refSeqs.elem_count; ++i)
-            ReferenceSeq_Whack(&self->refSeq[i]);
-
-        KDataBufferWhack(&self->compress);
-        KDataBufferWhack(&self->seq);
-        KDataBufferWhack(&self->refSeqs);
-        KDataBufferWhack(&self->refSeqsById);
-
-        if (rc == 0 && build_coverage && commit && rows > 0)
-            rc = ReferenceMgr_ReCover(cself, rows, quitting);
-#if 0 
-        {
-            VTable* t = NULL;
-            
-            if (VDatabaseOpenTableUpdate(self->db, &t, "SECONDARY_ALIGNMENT") == 0) {
-                VTableDropColumn(t, "TMP_MISMATCH");
-                VTableDropColumn(t, "TMP_HAS_MISMATCH");
-            }
-            VTableRelease(t);
-        }
-#endif
-        VDatabaseRelease(self->db);
-        RefSeqMgr_Release(self->rmgr);
-        free(self);
-    }
-    return rc;
-}
-
-static
-rc_t ReferenceSeq_ReadDirect(ReferenceSeq *self,
-                             int offset,
-                             unsigned const len,
-                             bool read_circular,
-                             uint8_t buffer[],
-                             unsigned* written,
-                             bool force_linear)
-{
-    *written = 0;
-    if (len == 0)
-        return 0;
-    
-    if (read_circular || self->circular) {
-        if (offset < 0) {
-            unsigned const n = (-offset) / self->seq_len;
-            offset = (self->seq_len * (n + 1) + offset) % self->seq_len;
-        }
-        else if (offset > self->seq_len)
-            offset %= self->seq_len;
-    }
-    else if (offset >= self->seq_len)
-        return RC(rcAlign, rcType, rcReading, rcOffset, rcOutofrange);
-    
-    if (self->type == rst_local) {
-        uint8_t const *const src = self->u.local.buf.base;
-        unsigned dst_off = 0;
-        
-        while (dst_off < len) {
-            unsigned const writable = len - dst_off;
-            unsigned const readable = self->seq_len - offset;
-            unsigned const to_write = readable < writable ? readable : writable;
-            
-            memcpy(&buffer[dst_off], &src[offset], to_write);
-            *written += to_write;
-            if (!self->circular)
-                break;
-            offset = 0;
-            dst_off += to_write;
-        }
-        return 0;
-    }
-    else if (self->type == rst_refSeqById || self->type == rst_refSeqBySeqId) {
-        unsigned to_write = len;
-        
-        if (!self->circular || force_linear) {
-            unsigned const readable = self->seq_len - offset;
-            
-            if (to_write > readable)
-                to_write = readable;
-        }
-        return RefSeq_Read(self->u.refseq, offset, to_write, buffer, written);
-    }
-    return RC(rcAlign, rcType, rcReading, rcType, rcInvalid);
-}
-
-static
-rc_t ReferenceMgr_LoadSeq(ReferenceMgr *const self, ReferenceSeq *obj)
-{
-    KDataBuffer readBuf;
-    rc_t rc = KDataBufferMake(&readBuf, 8, self->max_seq_len);
-    
-    if (rc == 0) {
-        char const *const id = obj->id;
-        char const *const seqId = obj->seqId ? obj->seqId : id;
-        TableWriterRefData data;
-        INSDC_coord_zero offset = 0;
-        
-        obj->start_rowid = self->ref_rowid + 1;
-        data.name.buffer = id;
-        data.name.elements = string_size( id );
-        data.read.buffer = readBuf.base;
-        data.seq_id.buffer = seqId;
-        data.seq_id.elements = string_size( seqId );
-        data.force_READ_write = obj->type == rst_local || (self->options & ewrefmgr_co_allREADs);
-        data.circular = obj->circular;
-        
-        if (self->writer == NULL) {
-            uint32_t wopt = 0;
-            
-            wopt |= (self->options & ewrefmgr_co_allREADs) ? ewref_co_SaveRead : 0;
-            wopt |= (self->options & ewrefmgr_co_Coverage) ? ewref_co_Coverage : 0;
-            if( (rc = TableWriterRef_Make(&self->writer, self->db, wopt)) == 0 ) {
-                TableWriterData mlen;
-                
-                mlen.buffer = &self->max_seq_len;
-                mlen.elements = 1;
-                rc = TableWriterRef_WriteDefaultData(self->writer, ewrefseq_cn_MAX_SEQ_LEN, &mlen);
-            }
-        }
-        while (rc == 0 && offset < obj->seq_len) {
-            unsigned row_len;
-            
-            rc = ReferenceSeq_ReadDirect(obj, offset, self->max_seq_len, false,
-                                         readBuf.base, &row_len, true);
-            if (rc != 0 || row_len == 0) break;
-            
-            data.read.elements = row_len;
-            rc = TableWriterRef_Write(self->writer, &data, NULL);
-            offset += row_len;
-            ++self->ref_rowid;
-        }
-        KDataBufferWhack(&readBuf);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC ReferenceMgr_GetSeq(ReferenceMgr const *const cself,
-                                       ReferenceSeq const **const seq,
-                                       char const id[])
-{
-    ReferenceMgr *const self = (ReferenceMgr *)cself;
-    
-    if  (self == NULL || seq == NULL || id == NULL )
-        return RC(rcAlign, rcFile, rcConstructing, rcParam, rcNull);
-    
-    *seq = NULL;
-    {
-        ReferenceSeq *obj;
-        rc_t rc = ReferenceMgr_OpenSeq(self, &obj, id, 0, NULL);
-        
-        if (rc) return rc;
-        if (obj->start_rowid == 0) {
-            rc = ReferenceMgr_LoadSeq(self, obj);
-            if (rc) return rc;
-        }
-        *seq = obj;
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC ReferenceMgr_Verify(const ReferenceMgr* cself, const char* id, INSDC_coord_len seq_len, const uint8_t* md5)
-{
-#if 0
-    rc_t rc = 0;
-    ReferenceSeq* rseq;
-    const KFile* kf;
-    
-    if( cself == NULL || id == NULL ) {
-        rc = RC(rcAlign, rcFile, rcConstructing, rcParam, rcNull);
-    } else if( (rc = ReferenceMgr_Find(cself, id, &rseq, &kf)) == 0 ) {
-        if( rseq == NULL ) {
-            uint64_t size = 0;
-            if( (rc = KFileSize(kf, &size)) == 0 && size == 0 ) {
-                rc = RC(rcAlign, rcTable, rcValidating, rcSize, rcEmpty);
-            }
-            KFileRelease(kf);
-        } else if( rseq->local ) {
-            if( rseq->seq_len != seq_len ) {
-                rc = RC(rcAlign, rcFile, rcValidating, rcSize, rcUnequal);
-                ALIGN_DBGERRP("%s->%s SEQ_LEN verification", rc, id, rseq->accession);
-            }
-            if( rc == 0 && md5 != NULL && memcmp(md5, rseq->u.local.md5, sizeof(rseq->u.local.md5)) != 0 ) {
-                unsigned i;
-                rc = RC(rcAlign, rcTable, rcValidating, rcChecksum, rcUnequal);
-                ALIGN_DBGERRP("%s->%s MD5 verification", rc, id, rseq->accession);
-                ALIGN_DBGF((" local '"));
-                for(i = 0; i < sizeof(rseq->u.local.md5); i++) {
-                    ALIGN_DBGF(("%02hx", rseq->u.local.md5[i]));
-                }
-                ALIGN_DBGF(("'  <> match '"));
-                for(i = 0; i < sizeof(rseq->u.local.md5); i++) {
-                    ALIGN_DBGF(("%02hx", md5[i]));
-                }
-                ALIGN_DBGF(("'\n"));
-            } else {
-                ALIGN_DBG("%s->%s MD5 verification ok", id, rseq->accession);
-            }
-        } else {
-            const RefSeq* tmp = rseq->u.refseq.o;
-            INSDC_coord_len o_len;
-            const uint8_t* o_md5;
-
-            if( tmp == NULL ) {
-                if( (rc = RefSeqMgr_GetSeq(cself->rmgr, &tmp, rseq->accession, string_size( rseq->accession ))) != 0 ||
-                    (rc = RefSeq_SeqLength(tmp, &o_len)) != 0 ) {
-                    ALIGN_DBGERRP("%s->%s verification", rc, id, rseq->accession);
-                }
-            } else {
-                o_len = rseq->seq_len;
-            }
-            if( rc == 0 ) {
-                if( seq_len != 0 && o_len != seq_len ) {
-                    rc = RC(rcAlign, rcTable, rcValidating, rcSize, rcUnequal);
-                    ALIGN_DBGERRP("%s->%s SEQ_LEN verification", rc, id, rseq->accession);
-                } else {
-                    ALIGN_DBG("%s->%s SEQ_LEN verification ok", id, rseq->accession);
-                }
-            }
-            if( rc == 0 && (rc = RefSeq_MD5(tmp, &o_md5)) == 0 ) {
-                if( md5 != NULL && o_md5 != NULL && memcmp(md5, o_md5, sizeof(rseq->u.local.md5)) != 0 ) {
-                    rc = RC(rcAlign, rcTable, rcValidating, rcChecksum, rcUnequal);
-                    ALIGN_DBGERRP("%s->%s MD5 verification", rc, id, rseq->accession);
-                } else {
-                    ALIGN_DBG("%s->%s MD5 verification ok", id, rseq->accession);
-                }
-            }
-            if( tmp != rseq->u.refseq.o ) {
-                RefSeq_Release(tmp);
-            }
-        }
-    }
-    if( rc == 0 ) {
-        ALIGN_DBG("%s verification ok", id);
-    } else {
-        ALIGN_DBGERRP("%s verification", rc, id);
-    }
-    return rc;
-#else
-    if (cself == NULL || id == NULL)
-        return RC(rcAlign, rcFile, rcValidating, rcParam, rcNull);
-    {
-        ReferenceMgr *self = (ReferenceMgr *)cself;
-        ReferenceSeq *rseq;
-        rc_t rc = ReferenceMgr_OpenSeq(self, &rseq, id, seq_len, md5);
-        
-        if (rc) return rc;
-        if (rseq->seq_len != seq_len) {
-            rc = RC(rcAlign, rcFile, rcValidating, rcSize, rcUnequal);
-            ALIGN_DBGERRP("%s->%s SEQ_LEN verification", rc, id, rseq->seqId);
-        }
-        if (md5 && memcmp(md5, rseq->md5, sizeof(rseq->md5)) != 0 ) {
-            unsigned i;
-            
-            rc = RC(rcAlign, rcTable, rcValidating, rcChecksum, rcUnequal);
-            ALIGN_DBGERRP("%s->%s MD5 verification", rc, id, rseq->seqId);
-            ALIGN_DBGF((" found '"));
-            for(i = 0; i < sizeof(rseq->md5); i++) {
-                ALIGN_DBGF(("%02hx", rseq->md5[i]));
-            }
-            ALIGN_DBGF(("'  != requested '"));
-            for(i = 0; i < sizeof(rseq->md5); i++) {
-                ALIGN_DBGF(("%02hx", md5[i]));
-            }
-            ALIGN_DBGF(("'\n"));
-        } else {
-            ALIGN_DBG("%s->%s MD5 verification ok", id, rseq->seqId);
-        }
-        if( rc == 0 ) {
-            ALIGN_DBG("%s verification ok", id);
-        } else {
-            ALIGN_DBGERRP("%s verification", rc, id);
-        }
-        return rc;
-    }
-#endif
-}
-
-LIB_EXPORT rc_t CC ReferenceMgr_FastaPath(const ReferenceMgr* cself, const char* fasta_path)
-{
-    rc_t rc = 0;
-    KDirectory* dir;
-
-    if( cself == NULL || fasta_path == NULL ) {
-        rc = RC(rcAlign, rcFile, rcConstructing, rcParam, rcNull);
-    } else if( (rc = KDirectoryNativeDir(&dir)) == 0 ) {
-        const KFile* kf;
-        if( (rc = KDirectoryOpenFileRead(dir, &kf, "%s", fasta_path)) == 0 ) {
-            rc = ReferenceMgr_FastaFile(cself, kf);
-            KFileRelease(kf);
-        }
-        KDirectoryRelease(dir);
-    }
-    ALIGN_DBGERRP("from file %s", rc, fasta_path);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC ReferenceMgr_FastaFile(const ReferenceMgr* cself, const KFile* file)
-{
-    if( cself == NULL || file == NULL ) {
-        return RC(rcAlign, rcFile, rcConstructing, rcParam, rcNull);
-    }
-    return ReferenceMgr_ImportFastaFile((ReferenceMgr *)cself, file, NULL);
-}
-
-static
-int extrace_cigar_op(char *op,
-                     uint32_t *op_len,
-                     char const *const cigar,
-                     uint32_t const cigar_len,
-                     uint32_t const offset,
-                     uint32_t const options,
-                     unsigned *const bin)
-{
-    static char const op_txt[] = "MIDNSHP=XB??????";
-    uint32_t i = offset;
-    
-    if (options & ewrefmgr_cmp_Binary) {
-        uint32_t c;
-        
-        memcpy(&c, cigar + i * 4, 4);
-        *bin = c & 0x0F;
-        *op = op_txt[c & 0x0F];
-        *op_len = c >> 4;
-    }
-    else {
-        uint32_t len = 0;
-        int ch;
-
-        while(i < cigar_len && (ch = cigar[i]) != '\0' && isdigit(ch)) {
-            len *= 10;
-            len += ch - '0';
-            ++i;
-        }
-        *bin = *op = ch;
-        *op_len = len;
-    }
-    return i - offset;
-}
-
-static
-rc_t cigar2offset(const uint32_t options, const void* cigar, uint32_t cigar_len, int32_t* out, uint32_t out_sz, uint32_t out_used,
-                  INSDC_coord_len* seq_len, INSDC_coord_len* ref_len, INSDC_coord_len* max_ref_len)
-{
-    rc_t rc = 0;
-    uint32_t i;
-    uint32_t last_match = 0;
-    uint32_t op_len;
-    uint32_t last_soft_len = 0;
-    uint32_t b_len = 0;
-    uint32_t last_op = cigar_len - 1;
-    char op;
-    unsigned op_bin;
-    
-    if ((options & ewrefmgr_cmp_Binary) == 0) {
-        for (i = 0; i < cigar_len; last_op = ++i) {
-            i += extrace_cigar_op(&op, &op_len, cigar, cigar_len, i, options, &op_bin);
-        }
-    }
-    
-#if _DEBUGGING
-    ALIGN_C_DBGF(("%s:%u: ", __func__, __LINE__));
-    if( options & ewrefmgr_cmp_Binary ) {
-        ALIGN_C_DBGF(("bin cigar '"));
-        for(i = 0; i < cigar_len; i++) {
-            extrace_cigar_op(&op, &op_len, cigar, cigar_len, i, options, &op_bin);
-            ALIGN_C_DBGF(("%u%c", op_len, op));
-        }
-    } else {
-        ALIGN_C_DBGF(("cigar '%.*s", cigar_len, cigar));
-    }
-    ALIGN_C_DBGF(("'[%u]\n", cigar_len));
-#endif
-    
-    *seq_len = 0;
-    *ref_len = 0;
-    *max_ref_len = 0;
-    memset(out, 0, out_used * sizeof(*out) * 2);
-    for(i = 0; rc == 0 && i < cigar_len; i++) {
-        i += extrace_cigar_op(&op, &op_len, cigar, cigar_len, i, options, &op_bin);
-        if (op == 'P') {
-            continue;
-        }
-        if( op != 'S' && op != 'I' ) {
-            last_soft_len = 0;
-        }
-        switch(op) {
-        case 'M':
-        case '=':
-        case 'X':
-            *seq_len += op_len;
-            *ref_len += op_len;
-            *max_ref_len += op_len;
-            if(b_len > op_len) {
-                b_len -= op_len;
-            }
-            else {
-                b_len=0;
-                last_match = *seq_len;
-            }
-            break;
-        case 'S':
-        case 'I':
-            last_soft_len += op_len;
-            *max_ref_len += op_len;
-            *seq_len += op_len;
-            if (last_match < out_sz) {
-                if (i < last_op) {
-                    if (b_len > 0) {/** not right soft clip **/
-                        assert(out[last_match] < 0);
-                        out[last_match-out[last_match]] = 0x80000000;
-                    }
-                    out[last_match] += -op_len;
-                }
-                if (b_len == 0) last_match = *seq_len;
-            } else {
-                rc = RC(rcAlign, rcFile, rcProcessing, rcData, rcInconsistent);
-            }
-            
-            break;
-        case 'B':
-            /* Complete Genomics CIGAR style specific:
-             overlap between consecutive reads
-             ex: sequence 6 bases: ACACTG, reference 2 bases: ACTG,
-             cigar will be: 2M2B2M
-             no need to move sequence position
-             */
-            if( last_match < out_sz ) {
-                if(b_len > 0 && i < cigar_len -1){/** not right soft clip **/
-                    assert(out[last_match] < 0);
-                    out[last_match-out[last_match]] = 0x80000000;
-                }
-                out[last_match] -= op_len;
-            } else {
-                rc = RC(rcAlign, rcFile, rcProcessing, rcData, rcInconsistent);
-            }
-            if( *ref_len < op_len ) {
-                *ref_len = 0;
-            } else {
-                *ref_len -= op_len;
-            }
-            *max_ref_len += op_len;
-            b_len += op_len;
-            break;
-        case 'D':
-        case 'N':
-            if( last_match < out_sz ) {
-                out[last_match] += op_len;
-            } else if (last_match == out_sz && last_match > 0 ){ /*** delete at the end ***/
-                out[last_match-1] += op_len;
-            } else {
-                rc = RC(rcAlign, rcFile, rcProcessing, rcData, rcInconsistent);
-            }
-            *ref_len += op_len;
-            *max_ref_len += op_len;
-            break;
-        case 'H':
-            if ((options & ewrefmgr_co_AcceptHardClip) == 0)
-            {
-                rc = RC(rcAlign, rcFile, rcProcessing, rcData, rcInvalid);
-                (void)LOGERR(klogErr, rc, "Hard clipping of sequence data is not allowed");
-            }
-            break;
-        default:
-            rc = RC(rcAlign, rcFile, rcProcessing, rcData, rcUnrecognized);
-            if ((options & ewrefmgr_cmp_Binary) == 0)
-                (void)PLOGERR(klogErr, (klogErr, rc, "Invalid or unrecognized CIGAR operation '$(opcode)'", "opcode=%c", op));
-            else if (op != '?')
-                (void)PLOGERR(klogErr, (klogErr, rc, "Invalid or unrecognized CIGAR operation '$(opcode)' (binary code: $(opbin))", "opcode=%c,opbin=%u", op, op_bin));
-            else
-                (void)PLOGERR(klogErr, (klogErr, rc, "Invalid or unrecognized CIGAR operation (binary code: $(opbin))", "opbin=%u", op_bin));
-            break;
-        }
-    }
-    if( !(options & ewrefmgr_cmp_Exact) && last_soft_len > 0 ) {
-        ALIGN_C_DBG("trailing soft clip %u @ %u", last_soft_len, last_match);
-        out[last_match] += last_soft_len;
-    }
-#if _DEBUGGING
-    ALIGN_C_DBGF(("%s:%u: offsets: ", __func__, __LINE__));
-    last_match = last_match > *seq_len ? last_match : *seq_len;
-    for(i = 0; i <= last_match; i++) {
-        if( i == *seq_len ) {
-            ALIGN_C_DBGF((" | "));
-        }
-        ALIGN_C_DBGF(("%i%c", out[i], ((i + 1) % 5) ? ',' : ' '));
-    }
-    ALIGN_C_DBGF((" cigar derived seq_len %u, ref_len %u, max_ref_len %u\n", *seq_len, *ref_len, *max_ref_len));
-#endif
-    return rc;
-}
-
-LIB_EXPORT rc_t CC ReferenceSeq_TranslateOffset_int(ReferenceSeq const *const cself,
-                                                    INSDC_coord_zero const offset,
-                                                    int64_t *const ref_id,
-                                                    INSDC_coord_zero *const ref_start,
-                                                    uint64_t *const global_ref_start)
-{
-    if( cself == NULL )
-        return RC(rcAlign, rcFile, rcProcessing, rcSelf, rcNull);
-        
-    if (ref_id)
-        *ref_id = cself->start_rowid + offset / cself->mgr->max_seq_len;
-    
-    if (ref_start)
-        *ref_start = offset % cself->mgr->max_seq_len;
-    
-    if (global_ref_start)
-        *global_ref_start = (cself->start_rowid - 1) * cself->mgr->max_seq_len + offset;
-        
-    return 0;
-}
-
-LIB_EXPORT rc_t CC ReferenceMgr_Compress(const ReferenceMgr* cself, uint32_t options,
-                                         const char* id, INSDC_coord_zero offset,
-                                         const char* seq, INSDC_coord_len seq_len,
-                                         const void* cigar, uint32_t cigar_len,
-                                         INSDC_coord_zero allele_offset, const char* allele, INSDC_coord_len allele_len,INSDC_coord_zero offset_in_allele,
-                                         const void* allele_cigar, uint32_t allele_cigar_len,
-                                         TableWriterAlgnData* data)
-{
-    rc_t rc = 0;
-    const ReferenceSeq* refseq;
-
-    if( cself == NULL || id == NULL ) {
-        rc = RC(rcAlign, rcFile, rcProcessing, rcParam, rcNull);
-    } else if( (rc = ReferenceMgr_GetSeq(cself, &refseq, id)) == 0 ) {
-        rc = ReferenceSeq_Compress(refseq, options, offset, seq, seq_len, cigar, cigar_len,
-                                   allele_offset, allele, allele_len,offset_in_allele,
-				   allele_cigar, allele_cigar_len, data);
-        ReferenceSeq_Release(refseq);
-    }
-    ALIGN_C_DBGERR(rc);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC ReferenceSeq_Compress(const ReferenceSeq* cself, uint32_t options, INSDC_coord_zero offset,
-                                         const char* seq, INSDC_coord_len seq_len,
-                                         const void* cigar, uint32_t cigar_len,
-                                         INSDC_coord_zero allele_offset, const char* allele,
-                                         INSDC_coord_len allele_len,
-                                         INSDC_coord_zero offset_in_allele,
-                                         const void* allele_cigar, uint32_t allele_cigar_len,
-                                         TableWriterAlgnData* data)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL || seq == NULL || cigar == NULL || cigar_len == 0 || data == NULL ||
-        (!(allele == NULL && allele_len == 0 && allele_cigar == NULL && allele_cigar_len == 0) &&
-         !(allele != NULL && allele_cigar != NULL && allele_cigar_len != 0)) ) {
-        return RC(rcAlign, rcFile, rcProcessing, rcParam, rcInvalid);
-    }
-    if (seq_len * 2 > cself->mgr->compress.elem_count) {
-        rc = KDataBufferResize(&cself->mgr->compress, seq_len * 2);
-        if (rc) return rc;
-    }
-    if ((rc = ReferenceSeq_ReOffset(cself->circular, cself->seq_len, &offset)) == 0 ) {
-        INSDC_coord_len i, seq_pos = 0, allele_ref_end = 0, ref_len = 0, rl = 0, max_rl = 0;
-        INSDC_coord_zero* read_start = &((INSDC_coord_zero*)(data->read_start.buffer))[data->ploidy];
-        INSDC_coord_len* read_len = &((INSDC_coord_len*)(data->read_len.buffer))[data->ploidy];
-        bool* has_ref_offset, *has_mismatch;
-        int32_t* ref_offset;
-        uint8_t* mismatch; 
-        uint8_t sref_buf[64 * 1024];
-        void *href_buf = NULL;
-        uint8_t *ref_buf = sref_buf;
-	int32_t  allele_off_buf[1024];
-#if _DEBUGGING
-        uint64_t i_ref_offset_elements, i_mismatch_elements;
-        char x[4096];
-#endif
-
-        if( data->ploidy == 0 ) {
-            data->has_ref_offset.elements = seq_len;
-            data->ref_offset.elements = 0;
-            data->has_mismatch.elements = seq_len;
-            data->mismatch.elements = 0;
-            *read_start = 0;
-        }
-        else {
-            data->has_ref_offset.elements += seq_len;
-            data->has_mismatch.elements += seq_len;
-            *read_start = read_start[-1] + read_len[-1];
-        }
-        *read_len = seq_len;
-        has_ref_offset = &((bool*)(data->has_ref_offset.buffer))[*read_start];
-        ref_offset = (int32_t*)(data->ref_offset.buffer);
-        has_mismatch = &((bool*)(data->has_mismatch.buffer))[*read_start];
-        mismatch = (uint8_t*)(data->mismatch.buffer);
-
-#if _DEBUGGING
-        i_ref_offset_elements = data->ref_offset.elements;
-        i_mismatch_elements = data->mismatch.elements;
-        ALIGN_C_DBG("align%s '%.*s'[%u] to '%s:%s' at %i", (options & ewrefmgr_cmp_Exact) ? " EXACT" : "",
-                    seq_len, seq, seq_len, cself->id, cself->seqId, offset);
-#endif
-        if( allele != NULL ) {
-            /* determine length of reference for subst by allele */
-            ALIGN_C_DBG("apply allele %.*s[%u] at %i w/cigar below",
-                        allele_len, allele, allele_len, allele_offset);
-            rc = cigar2offset(options, allele_cigar, allele_cigar_len,
-                    allele_off_buf, sizeof(allele_off_buf)/sizeof(*allele_off_buf)/2,
-                    allele_len, &seq_pos, &allele_ref_end, &max_rl);
-            /* where allele ends on reference */
-            allele_ref_end += allele_offset;
-        }
-        if( rc == 0 ) {
-            rc = cigar2offset(options, cigar, cigar_len,
-                              (int32_t*)(cself->mgr->compress.base), cself->mgr->compress.elem_count / 2,
-                             seq_len, &seq_pos, &rl, &max_rl);
-        }
-        if( allele != NULL ) {
-            if( allele_offset + allele_ref_end < offset || allele_offset >= offset + rl ) {
-                (void)PLOGMSG(klogWarn, (klogWarn,
-                    "allele $(a) offset $(ao) $(ac) is not within referenced region in $(id) at offset $(ro) $(rc)",
-                    "a=%.*s,ao=%i,ac=%.*s,id=%s,ro=%i,rc=%.*s",
-                    allele_len, allele, allele_offset, (options & ewrefmgr_cmp_Binary) ? 0 : allele_cigar_len, allele_cigar,
-                    cself->seqId, offset, (options & ewrefmgr_cmp_Binary) ? 0 : cigar_len, cigar));
-                allele = NULL;
-            }
-        }
-        if( rc == 0 ) {
-            if( !(options & ewrefmgr_cmp_Exact) ) {
-                /* do not write leading deletes just move reference offset */
-                int32_t *const compress_buf = cself->mgr->compress.base;
-                if( compress_buf[0] > 0 ) {
-                    offset += compress_buf[0];
-                    rl -= compress_buf[0];
-                    max_rl -= compress_buf[0];
-                    compress_buf[0] = 0;
-                    ALIGN_C_DBG("adjusted offset %i", offset);
-                }
-            }
-            ref_len = rl;
-            if( (offset + max_rl) > cself->seq_len && !cself->circular ) {
-                max_rl = cself->seq_len - offset;
-                if( max_rl < rl ) {
-                    /* ref_len used for compression cannot be shorter than ref_len derived from cigar,
-                       if there is a shortage it will fail later here */
-                    max_rl = rl;
-                }
-                ALIGN_C_DBG("max_ref_len truncated to %u cause it goes beyond refseq length %lu at offset %i",
-                             max_rl, cself->seq_len, offset);
-            }
-            ALIGN_C_DBG("chosen REF_LEN %u, ref len for match %u", ref_len, max_rl);
-
-            assert(seq_len == seq_pos);
-            if (max_rl > sizeof(sref_buf)) {
-                if (href_buf)
-                    free(href_buf);
-                href_buf = malloc(max_rl);
-                if (href_buf == NULL)
-                    rc = RC(rcAlign, rcFile, rcProcessing, rcMemory, rcExhausted);
-                ref_buf = href_buf;
-            }
-            if (rc == 0) {
-                int64_t ref_pos;
-
-                if( allele != NULL ) {
-                    /* subst allele in reference */
-                    if( allele_offset <= offset ) {
-                        /* move allele start inside referenced chunk */
-			    allele     += offset_in_allele;
-			    allele_len -= offset_in_allele;
-                            rl = 0;
-                    } else {
-                        /* fetch portion of reference which comes before allele */
-                        rl = allele_offset - offset;
-                        rc = ReferenceSeq_ReadDirect((ReferenceSeq*)cself, offset, rl, true, ref_buf, &i, false);
-                        if( rc == 0 && rl != i ) {
-                            /* here we need to test it otherwise excessive portion of allele could be fetch in next if */
-                            rc = RC(rcAlign, rcFile, rcProcessing, rcRange, rcExcessive);
-                        }
-                    }
-                    if( rc == 0 && allele_len < (max_rl - rl) ) {
-                        memcpy(&ref_buf[rl], allele, allele_len);
-                        rl += allele_len;
-                        /* append tail of actual reference */
-                        rc = ReferenceSeq_ReadDirect((ReferenceSeq*)cself, allele_ref_end, max_rl - rl, true, &ref_buf[rl], &i, false);
-                        rl += i;
-                    } else if( rc == 0 ) {
-                        /* allele is longer than needed */
-                        memcpy(&ref_buf[rl], allele, max_rl - rl);
-                        rl = max_rl;
-                    }
-                } else {
-                    rc = ReferenceSeq_ReadDirect((ReferenceSeq*)cself, offset, max_rl, true, ref_buf, &rl, false);
-                }
-                if( rc != 0 || max_rl != rl ) {
-                    rc = rc ? rc : RC(rcAlign, rcFile, rcProcessing, rcRange, rcExcessive);
-                    ALIGN_C_DBGERRP("refseq is shorter: at offset %i need %u bases", rc, offset, max_rl);
-                } else {
-                    int32_t *const compress_buf = cself->mgr->compress.base;
-                    for(seq_pos = 0, ref_pos = 0; seq_pos < seq_len; seq_pos++, ref_pos++) {
-                        has_ref_offset[seq_pos] = compress_buf[seq_pos] != 0;
-                        if( has_ref_offset[seq_pos]){
-                            if(compress_buf[seq_pos] == 0x80000000 ){
-                                compress_buf[seq_pos] = 0; /** the hack has served its purpose **/
-                            } else {
-                                ref_offset[data->ref_offset.elements++] = compress_buf[seq_pos];
-                                ref_pos += compress_buf[seq_pos];
-                            }
-                        }
-                        if( (ref_pos < 0) || (ref_pos >= max_rl) || 
-                            ((toupper(ref_buf[ref_pos]) != toupper(seq[seq_pos])) && (seq[seq_pos] != '=')) ) {
-                            has_mismatch[seq_pos] = true;
-                            mismatch[data->mismatch.elements++] = seq[seq_pos];
-                        } else {
-                            /* match! */
-                            has_mismatch[seq_pos] = false;
-                        }
-                    }
-                }
-            }
-        }
-#if _DEBUGGING
-        if(rc == 0 ) {
-            int32_t j;
-            memset(x, '-', sizeof(x) - 1);
-            x[sizeof(x) - 2] = '\0';
-
-            ALIGN_C_DBG("ref: %.*s [%u]", max_rl, ref_buf, max_rl);
-            ALIGN_C_DBGF(("%s:%u: ref: ", __func__, __LINE__));
-            for(seq_pos = 0, j = 0, rl = 0, i = 0; seq_pos < seq_len; seq_pos++, j++) {
-                if( has_ref_offset[seq_pos] ) {
-                    if( ref_offset[i_ref_offset_elements + rl] > 0 ) {
-                        ALIGN_C_DBGF(("%.*s", (uint32_t)(ref_offset[i_ref_offset_elements + rl]), &ref_buf[j]));
-                    } else {
-                        i = -ref_offset[i_ref_offset_elements + rl];
-                    }
-                    j += ref_offset[i_ref_offset_elements + rl];
-                    rl++;
-                }
-                ALIGN_C_DBGF(("%c", (j < 0 || j >= max_rl) ? '-' : (i > 0) ? tolower(ref_buf[j]) : ref_buf[j]));
-                if( i > 0  ) {
-                    i--;
-                }
-            }
-            ALIGN_C_DBGF(("\n%s:%u: seq: ", __func__, __LINE__));
-            for(i = 0, j = 0; i < seq_len; i++) {
-                if( has_ref_offset[i] && ref_offset[i_ref_offset_elements + j++] > 0 ) {
-                    ALIGN_C_DBGF(("%.*s", ref_offset[i_ref_offset_elements + j - 1], x));
-                }
-                ALIGN_C_DBGF(("%c", seq[i]));
-            }
-            ALIGN_C_DBGF((" [%u]\n", seq_len));
-            ALIGN_C_DBGF(("%s:%u: hro: ", __func__, __LINE__));
-            for(i = 0, j = 0; i < seq_len; i++) {
-                if( has_ref_offset[i] && ref_offset[i_ref_offset_elements + j++] > 0 ) {
-                    ALIGN_C_DBGF(("%.*s", ref_offset[i_ref_offset_elements + j - 1], x));
-                }
-                ALIGN_C_DBGF(("%c", has_ref_offset[i] + '0'));
-            }
-            ALIGN_C_DBGF((", ro:"));
-            for(i = i_ref_offset_elements; i < data->ref_offset.elements; i++) {
-                ALIGN_C_DBGF((" %i,", ref_offset[i]));
-            }
-            ALIGN_C_DBGF(("[%u]\n", data->ref_offset.elements - i_ref_offset_elements));
-            ALIGN_C_DBGF(("%s:%u: hmm: ", __func__, __LINE__));
-            for(i = 0, j = 0; i < seq_len; i++) {
-                if( has_ref_offset[i] && ref_offset[i_ref_offset_elements + j++] > 0 ) {
-                    ALIGN_C_DBGF(("%.*s", ref_offset[i_ref_offset_elements + j - 1], x));
-                }
-                ALIGN_C_DBGF(("%c", has_mismatch[i] + '0'));
-            }
-            ALIGN_C_DBGF((", mm: '%.*s'[%u]\n", (int)(data->mismatch.elements - i_mismatch_elements),
-                &mismatch[i_mismatch_elements], data->mismatch.elements - i_mismatch_elements));
-        }
-#endif
-        if( rc == 0 ) {
-            if( data->ploidy == 0 ) {
-                int64_t *const ref_id = (int64_t *)data->ref_id.buffer;
-                INSDC_coord_zero *const ref_start = (INSDC_coord_zero *)data->ref_start.buffer;
-                uint64_t *const global_ref_start = (uint64_t *)data->global_ref_start.buffer;
-                
-                data->ref_1st_row_id = cself->start_rowid;
-                data->effective_offset = offset;
-                data->ref_len = ref_len;
-                ALIGN_C_DBGF(("%s:%u: reference 1st ROW_ID %li OFFSET %i REF_LEN %u",
-                    __func__, __LINE__, data->ref_1st_row_id, data->effective_offset, data->ref_len));
-                
-                ReferenceSeq_TranslateOffset_int(cself, offset, ref_id, ref_start, global_ref_start);
-                
-                if (ref_id) {
-                    data->ref_id.elements = 1;
-                    ALIGN_C_DBGF((" REF_ID %li", ref_id[0]));
-                }
-                if (ref_start) {
-                    data->ref_start.elements = 1;
-                    ALIGN_C_DBGF((" REF_START %i", ref_start[0]));
-                }
-                if (global_ref_start) {
-                    data->global_ref_start.elements = 1;
-                    ALIGN_C_DBGF((" GLOBAL_REF_START %lu", global_ref_start[0]));
-                }
-                ALIGN_C_DBGF(("\n"));
-            } else {
-                if( data->ref_1st_row_id != cself->start_rowid || data->effective_offset != offset ) {
-                    rc = RC(rcAlign, rcFile, rcProcessing, rcData, rcInconsistent);
-                    (void)PLOGERR(klogErr, (klogErr, rc,
-                        "all reads in alignment record must align to same refseq at same location $(r1)@$(o1) <> $(r2):$(a2)@$(o2)",
-                        "r1=%li,o1=%i,r2=%s,a2=%s,o2=%i", data->ref_1st_row_id, data->effective_offset, cself->id, cself->seqId, offset));
-                } else if( data->ref_len != ref_len ) {
-                    rc = RC(rcAlign, rcFile, rcProcessing, rcData, rcInconsistent);
-                    (void)PLOGERR(klogErr, (klogErr, rc,
-                        "all reads in alignment record must have same size projection on refseq $(rl1) <> $(rl2) $(r):$(a)@$(o)",
-                        "rl1=%u,rl2=%u,r=%s,a=%s,o=%i", data->ref_len, ref_len, cself->id, cself->seqId, offset));
-                }
-            }
-        }
-        if( rc == 0 ) {
-            data->ploidy++;
-            data->read_start.elements = data->ploidy;
-            data->read_len.elements = data->ploidy;
-        }
-        if (href_buf)
-            free(href_buf);
-    }
-    ALIGN_C_DBGERR(rc);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC ReferenceSeq_Read(const ReferenceSeq* cself, INSDC_coord_zero offset, INSDC_coord_len len,
-                                     uint8_t* buffer, INSDC_coord_len* ref_len)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL || buffer == NULL || ref_len == NULL ) {
-        rc = RC(rcAlign, rcFile, rcReading, rcParam, rcNull);
-    } else {
-        rc = ReferenceSeq_ReadDirect((ReferenceSeq*)cself, offset, len, true, buffer, ref_len, false);
-    }
-    ALIGN_DBGERR(rc);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC ReferenceSeq_Get1stRow(const ReferenceSeq* cself, int64_t* row_id)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL || row_id == NULL ) {
-        rc = RC(rcAlign, rcFile, rcReading, rcParam, rcNull);
-    } else {
-        *row_id = cself->start_rowid;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC ReferenceSeq_AddCoverage(const ReferenceSeq* cself, INSDC_coord_zero offset, const ReferenceSeqCoverage* data)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL || data == NULL) {
-        rc = RC(rcAlign, rcFile, rcReading, rcParam, rcNull);
-    } else if( !(cself->mgr->options & ewrefmgr_co_Coverage) ) {
-        rc = RC( rcAlign, rcType, rcWriting, rcData, rcUnexpected);
-        ALIGN_R_DBGERRP("coverage %s", rc, "data");
-    } else if( (rc = ReferenceSeq_ReOffset(cself->circular, cself->seq_len, &offset)) == 0 ) {
-        rc = TableWriterRef_WriteCoverage(cself->mgr->writer, cself->start_rowid, offset, data);
-    }
-    ALIGN_DBGERR(rc);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC ReferenceSeq_Release(const ReferenceSeq *cself)
-{
-    return 0;
-}
diff --git a/libs/align/writer-refseq.c b/libs/align/writer-refseq.c
deleted file mode 100644
index c180b8b..0000000
--- a/libs/align/writer-refseq.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <align/extern.h>
-
-#include <klib/rc.h>
-#include <insdc/insdc.h>
-#include <vdb/manager.h>
-#include <align/writer-refseq.h>
-#include "writer-priv.h"
-#include "debug.h"
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <ctype.h>
-#include <assert.h>
-
-static const TableWriterColumn TableWriterRefSeq_cols[ewrefseq_cn_Last + 1] =
-{
-    /* order is important, see enum in .h !!! */
-    {0, "MAX_SEQ_LEN", sizeof(uint32_t) * 8, 0},
-    {0, "DEF_LINE", sizeof(char) * 8, ewcol_IsArray},
-    {0, "(INSDC:dna:text)CS_KEY", sizeof(char) * 8, 0},
-    {0, "(INSDC:dna:text)READ", sizeof(char) * 8, ewcol_IsArray},
-    {0, "QUALITY", sizeof(INSDC_quality_phred) * 8, ewcol_IsArray},
-    {0, "SEQ_ID", sizeof(char) * 8, ewcol_IsArray},
-    {0, "SEQ_START", sizeof(INSDC_coord_one) * 8, 0},
-    {0, "SEQ_LEN", sizeof(INSDC_coord_len) * 8, 0},
-    {0, "CIRCULAR", sizeof(bool) * 8, 0}
-};
-
-struct TableWriterRefSeq {
-    const TableWriter* base;
-    uint8_t cursorid;
-    TableWriterColumn cols[sizeof(TableWriterRefSeq_cols)/sizeof(TableWriterRefSeq_cols[0])];
-    INSDC_coord_one seq_start_last;
-    uint32_t max_seq_len;
-    INSDC_dna_text last_cs_key;
-};
-
-LIB_EXPORT rc_t CC TableWriterRefSeq_Make(const TableWriterRefSeq** cself, VDBManager* mgr, const char* schema_path,
-                                          const char* table_path, const uint32_t options)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL ) {
-        rc = RC(rcAlign, rcFormatter, rcConstructing, rcParam, rcNull);
-    } else {
-        TableWriterRefSeq* self = calloc(1, sizeof(*self));
-        if( self == NULL ) {
-            rc = RC(rcAlign, rcFormatter, rcConstructing, rcMemory, rcExhausted);
-        } else {
-            memcpy(self->cols, TableWriterRefSeq_cols, sizeof(TableWriterRefSeq_cols));
-            if( !(options & ewrefseq_co_QUALITY) ) {
-                self->cols[ewrefseq_cn_QUALITY].flags |= ewcol_Ignore;
-            }
-            if( (rc = TableWriter_MakeMgr(&self->base, mgr, schema_path, "NCBI:refseq:tbl:reference", table_path)) == 0 ) {
-                rc = TableWriter_AddCursor(self->base, self->cols, sizeof(self->cols)/sizeof(self->cols[0]), &self->cursorid);
-            }
-        }
-        if( rc == 0 ) {
-            *cself = self;
-            ALIGN_DBG("table %s created", table_path);
-        } else {
-            TableWriterRefSeq_Whack(self, false, NULL, 0, 0, NULL, NULL, 0);
-            ALIGN_DBGERRP("table %s", rc, table_path);
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC TableWriterRefSeq_Whack(const TableWriterRefSeq* cself,
-                                           bool commit, uint64_t* rows,
-                                           const char loader_name[],
-                                           const ver_t loader_version,
-                                           const char loader_date[],
-                                           const char app_name[],
-                                           const ver_t app_version)
-{
-    rc_t rc = 0;
-
-    if( cself != NULL ) {
-        rc_t rc1;
-        if( commit ) {
-            rc = TableWriter_Sign(cself->base, loader_name, loader_version, loader_date, app_name, app_version);
-        }
-        rc1 = TableWriter_Whack(cself->base, rc ? false : commit, rows);
-        rc = rc ? rc : rc1;
-        free((TableWriterRefSeq*)cself);
-    }
-    return rc;
-}
-
-static
-rc_t TableWriterRefSeq_WriteDefaults(const TableWriterRefSeq* cself)
-{
-    rc_t rc = 0;
-    if( cself != NULL ) {
-        TableWriterRefSeq* self = (TableWriterRefSeq*)cself;
-        self->max_seq_len = TableWriterRefSeq_MAX_SEQ_LEN;
-        self->seq_start_last = 1;
-        self->last_cs_key = 'T';
-        TW_COL_WRITE_DEF_VAR(cself->base, cself->cursorid, cself->cols[ewrefseq_cn_MAX_SEQ_LEN], cself->max_seq_len);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC TableWriterRefSeq_WriteDefault(const TableWriterRefSeq* cself,
-                                                  enum ETableWriterRefSeq_ColNames col, const TableWriterData* data)
-{
-    rc_t rc = 0;
-    if( cself == NULL || data == NULL ) {
-        rc = RC( rcAlign, rcType, rcWriting, rcParam, rcNull);
-        ALIGN_DBGERR(rc);
-    } else if( cself->last_cs_key == '\0' && (rc = TableWriterRefSeq_WriteDefaults(cself)) != 0 ) {
-        ALIGN_DBGERR(rc);
-    } else {
-        TW_COL_WRITE_DEF(cself->base, cself->cursorid, cself->cols[col], (*data));
-        if( col == ewrefseq_cn_MAX_SEQ_LEN ) {
-            ((TableWriterRefSeq*)cself)->max_seq_len = *((uint32_t*)data->buffer);
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC TableWriterRefSeq_Write(const TableWriterRefSeq* cself, const TableWriterRefSeqData* data, int64_t* rowid)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL || data == NULL ) {
-        rc = RC( rcAlign, rcType, rcWriting, rcParam, rcNull);
-        ALIGN_DBGERR(rc);
-    } else if( cself->last_cs_key == '\0' && (rc = TableWriterRefSeq_WriteDefaults(cself)) != 0 ) {
-        ALIGN_DBGERR(rc);
-    } else if( data->read.elements > cself->max_seq_len ) {
-        rc = RC( rcAlign, rcType, rcWriting, rcData, rcInvalid);
-        ALIGN_DBGERRP("%s is longer than %s", rc, cself->cols[ewrefseq_cn_READ].name, cself->cols[ewrefseq_cn_MAX_SEQ_LEN].name);
-    } else if( (rc = TableWriter_OpenRow(cself->base, rowid, cself->cursorid)) == 0 ) {
-        INSDC_coord_len len = data->read.elements;
-        TW_COL_WRITE(cself->base, cself->cols[ewrefseq_cn_READ], data->read);
-        TW_COL_WRITE(cself->base, cself->cols[ewrefseq_cn_QUALITY], data->quality);
-        TW_COL_WRITE_VAR(cself->base, cself->cols[ewrefseq_cn_SEQ_START], cself->seq_start_last);
-        TW_COL_WRITE_VAR(cself->base, cself->cols[ewrefseq_cn_SEQ_LEN], len);
-        TW_COL_WRITE_VAR(cself->base, cself->cols[ewrefseq_cn_CS_KEY], cself->last_cs_key);
-        if( rc == 0 && (rc = TableWriter_CloseRow(cself->base)) == 0 ) {
-            TableWriterRefSeq* self = (TableWriterRefSeq*)cself;
-            
-            self->last_cs_key = ((const INSDC_dna_text*)(data->read.buffer))[data->read.elements - 1];
-            self->seq_start_last += len;
-        }
-    }
-    return rc;
-}
diff --git a/libs/align/writer-sequence.c b/libs/align/writer-sequence.c
deleted file mode 100644
index 3cd09cb..0000000
--- a/libs/align/writer-sequence.c
+++ /dev/null
@@ -1,636 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <align/extern.h>
-
-#include <klib/rc.h>
-#include <klib/vector.h>
-#include <klib/sort.h>
-#include <klib/data-buffer.h>
-#include <klib/printf.h>
-#include <insdc/insdc.h>
-#include <vdb/database.h>
-#include <vdb/cursor.h>
-#include <sra/sradb.h>
-#include <align/writer-sequence.h>
-#include "writer-priv.h"
-#include "reader-cmn.h"
-#include "debug.h"
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <ctype.h>
-#include <assert.h>
-
-static const TableWriterColumn TableWriterSeq_cols[ewseq_cn_Last + 1] =
-{
-    /* order is important, see Write below!!! */
-    {0, "(INSDC:dna:text)CMP_READ", sizeof(char) * 8, ewcol_IsArray},
-    {0, "(INSDC:color:text)CMP_CSREAD", sizeof(char) * 8, ewcol_IsArray | ewcol_Ignore},
-    {0, "CS_KEY", sizeof(char) * 8, ewcol_IsArray | ewcol_Ignore},
-    {0, "QUALITY", sizeof(INSDC_quality_phred) * 8, ewcol_IsArray},
-    {0, "PRIMARY_ALIGNMENT_ID", sizeof(int64_t) * 8, ewcol_IsArray},
-    {0, "ALIGNMENT_COUNT", sizeof(uint8_t) * 8, ewcol_IsArray},
-    {0, "PLATFORM", sizeof(INSDC_SRA_platform_id) * 8, 0},
-    {0, "LABEL", sizeof(char) * 8, ewcol_IsArray},
-    {0, "LABEL_START", sizeof(INSDC_coord_zero) * 8, ewcol_IsArray},
-    {0, "LABEL_LEN", sizeof(INSDC_coord_len) * 8, ewcol_IsArray},
-    {0, "READ_TYPE", sizeof(SRAReadTypes) * 8, ewcol_IsArray},
-    {0, "READ_START", sizeof(INSDC_coord_zero) * 8, ewcol_IsArray},
-    {0, "READ_LEN", sizeof(INSDC_coord_len) * 8, ewcol_IsArray},
-    {0, "TMP_KEY_ID", sizeof(uint64_t) * 8, ewcol_Temporary},
-    {0, "SPOT_GROUP", sizeof(char) * 8, ewcol_IsArray | ewcol_Ignore},
-    {0, "READ_FILTER", sizeof(uint8_t) * 8, ewcol_IsArray},
-    {0, "TI", sizeof(uint64_t) * 8, ewcol_IsArray | ewcol_Ignore}
-};
-
-static const TableReaderColumn TableSeqReadTmpKey_cols[] = {
-    {0, "TMP_KEY_ID", {NULL}, 0, 0},
-    {0, "READ_LEN", {NULL}, 0, 0},
-    {0, NULL, {NULL}, 0, 0}
-};
-
-struct TableWriterSeq {
-    uint32_t options;
-    const TableWriter* base;
-    uint8_t cursor_id;
-    TableWriterColumn cols[sizeof(TableWriterSeq_cols)/sizeof(TableWriterSeq_cols[0])];
-    bool init; /* default written indicator */
-    int64_t qual_buf_sz;
-    uint8_t* qual_buf;
-    uint8_t discrete_qual[256];
-    uint8_t alignd_cursor_id;
-    TableWriterColumn cols_alignd[2];
-    const TableReader* tmpkey_reader;
-    TableReaderColumn cols_read_tmpkey[sizeof(TableSeqReadTmpKey_cols) / sizeof(TableSeqReadTmpKey_cols[0])];
-    KVector *stats;
-    unsigned statsCount;
-    int64_t tmpKeyIdFirst;
-    int64_t tmpKeyIdLast;
-    bool flush;
-};
-
-static bool TableWriterSeq_InitQuantMatrix(uint8_t dst[256], char const quant[])
-{
-    unsigned i = 0;
-    unsigned limit = 0;
-    unsigned value = 0;
-    unsigned cur;
-    int ws = 1;
-    int st = 0;
-    
-    memset(dst, 0, 256);
-    for (cur = 0; quant[cur] != 0; ++cur) {
-        int const ch = quant[cur];
-        
-        if (ws) {
-            if (isspace(ch))
-                continue;
-            ws = false;
-        }
-        switch (st) {
-        case 0:
-            if (isdigit(ch)) {
-                value = (value * 10) + ch - '0';
-                break;
-            }
-            else if (isspace(ch)) {
-                ++st;
-                ws = true;
-                break;
-            }
-            ++st;
-            /* no break */
-        case 1:
-            if (ch != ':')
-                return false;
-            ws = true;
-            ++st;
-            break;
-        case 2:
-            if (isdigit(ch)) {
-                limit  = (limit * 10) + ch - '0';
-                break;
-            }
-            else if (isspace(ch)) {
-                ++st;
-                ws = true;
-                break;
-            }
-            else if (ch == '-' && limit == 0) {
-                memset(dst + i, value, 256 - i);
-                return true;
-            }
-            ++st;
-            /* no break */
-        case 3:
-            if (ch != ',')
-                return false;
-            ws = true;
-            st = 0;
-            if (i > limit)
-                return false;
-            memset(dst + i, value, limit - i);
-            i = limit;
-            limit = value = 0;
-            break;
-        }
-    }
-    if (st == 0) {
-        switch (value) {
-        case 1:
-            break;
-        case 2:
-            break;
-        }
-    }
-    return false;
-}
-
-typedef struct { uint64_t distance, count; } stats_pair_t;
-
-typedef struct { 
-    stats_pair_t *stats;
-    unsigned i;
-} pb_t;
-
-static rc_t CC stats_cb(uint64_t key, uint64_t value, void *user_data)
-{
-    pb_t *pb = user_data;
-    
-    pb->stats[pb->i].distance = key;
-    pb->stats[pb->i].count = value;
-    ++pb->i;
-    
-    return 0;
-}
-
-static int CC stats_cmp_count(const void *A, const void *B, void *ignore)
-{
-    if (((stats_pair_t const *)A)->distance == 0)
-        return -1;
-    if (((stats_pair_t const *)B)->distance == 0)
-        return 1;
-    if (((stats_pair_t const *)B)->count < ((stats_pair_t const *)A)->count)
-        return -1;
-    if (((stats_pair_t const *)B)->count > ((stats_pair_t const *)A)->count)
-        return 1;
-    if (((stats_pair_t const *)B)->distance < ((stats_pair_t const *)A)->distance)
-        return 1;
-    if (((stats_pair_t const *)B)->distance > ((stats_pair_t const *)A)->distance)
-        return -1;
-    return 0;
-}
-
-static int CC stats_cmp_distance(const void *A, const void *B, void *ignore)
-{
-    if (((stats_pair_t const *)A)->distance < ((stats_pair_t const *)B)->distance)
-        return -1;
-    if (((stats_pair_t const *)A)->distance > ((stats_pair_t const *)B)->distance)
-        return 1;
-    return 0;
-}
-
-static rc_t TableWriterSeq_WriteStatistics(TableWriterSeq const *cself, KMDataNode *node)
-{
-    pb_t pb;
-    rc_t rc;
-    KDataBuffer buf;
-    
-    rc = KDataBufferMake(&buf, 8 * sizeof(pb.stats[0]), cself->statsCount);
-    if (rc) return rc;
-    
-    pb.stats = buf.base;
-    pb.i = 0;
-    rc = KVectorVisitU64(cself->stats, 0, stats_cb, &pb);
-    if (rc == 0) {
-        unsigned i;
-        unsigned const n = cself->statsCount < 126 ? cself->statsCount : 126;
-        uint64_t *const distance = buf.base;
-        
-        ksort(pb.stats, cself->statsCount, sizeof(pb.stats[0]), stats_cmp_count, NULL);
-        ksort(pb.stats, n, sizeof(pb.stats[0]), stats_cmp_distance, NULL);
-        for (i = 0; i != n; ++i) {
-            distance[i] = pb.stats[i].distance;
-        }
-        rc = KMDataNodeWrite(node, distance, n * sizeof(distance[0]));
-    }
-    KDataBufferWhack(&buf);
-    return rc;
-}
-
-static rc_t TableWriterSeq_CollectStatistics(TableWriterSeq *self, const TableWriterData* primary_alignment_id)
-{
-    rc_t rc;
-    int64_t mate[2] = {0, 0};
-    uint64_t distance = 0;
-    uint64_t count = 0;
-    
-    memcpy(mate, primary_alignment_id->buffer, sizeof(mate[0]) * primary_alignment_id->elements);
-    if (mate[0] && mate[1]) {
-        distance = (mate[0] < mate[1]) ? (mate[1] - mate[0]) : (mate[0] - mate[1]);
-    }
-    else
-        return 0;
-    if (self->stats == NULL) {
-        rc = KVectorMake(&self->stats); if (rc) return rc;
-    }
-    rc = KVectorGetU64(self->stats, distance, &count);
-    if (GetRCObject(rc) == rcItem && GetRCState(rc) == rcNotFound) {
-        rc = KVectorSetU64(self->stats, distance, 1);
-        if (rc == 0) ++self->statsCount;
-    }
-    else if (rc == 0) {
-        ++count;
-        rc = KVectorSetU64(self->stats, distance, count);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC TableWriterSeq_Make(const TableWriterSeq** cself, VDatabase* db,
-                                       uint32_t options, char const qual_quantization[])
-{
-    rc_t rc = 0;
-    TableWriterSeq* self = NULL;
-    char const *tblName = (options & ewseq_co_ColorSpace) ? "CS_SEQUENCE" : "SEQUENCE";
-
-    options |= ewseq_co_SaveQual; /* TODO: remove when ready */
-    if( cself == NULL || db == NULL ) {
-        rc = RC(rcAlign, rcFormatter, rcConstructing, rcParam, rcNull);
-    } else {
-        self = calloc(1, sizeof(*self));
-        if( self == NULL ) {
-            rc = RC(rcAlign, rcFormatter, rcConstructing, rcMemory, rcExhausted);
-        } else {
-            memcpy(self->cols, TableWriterSeq_cols, sizeof(TableWriterSeq_cols));
-            if( options & ewseq_co_AlignData ) {
-                self->cols[ewseq_cn_TMP_KEY_ID].flags |= ewcol_Ignore;
-            } else {
-                self->cols[ewseq_cn_PRIMARY_ALIGNMENT_ID].flags |= ewcol_Ignore;
-                self->cols[ewseq_cn_ALIGNMENT_COUNT].flags |= ewcol_Ignore;
-            }
-            if(options & ewseq_co_NoLabelData) {
-                self->cols[ewseq_cn_LABEL].flags |= ewcol_Ignore;
-                self->cols[ewseq_cn_LABEL_LEN].flags |= ewcol_Ignore;
-                self->cols[ewseq_cn_LABEL_START].flags |= ewcol_Ignore;
-            }
-            if(options & ewseq_co_ColorSpace) {
-                self->cols[ewseq_cn_READ].flags |= ewcol_Ignore;
-                self->cols[ewseq_cn_CSREAD].flags &= ~ewcol_Ignore;
-                self->cols[ewseq_cn_CSKEY].flags &= ~ewcol_Ignore;
-            }
-            if( options & ewseq_co_SpotGroup) {
-                self->cols[ewseq_cn_SPOT_GROUP].flags &= ~ewcol_Ignore;
-            }
-            if( options & ewseq_co_TI) {
-                self->cols[ewseq_cn_TI].flags &= ~ewcol_Ignore;
-            }
-            if( (rc = TableWriter_Make(&self->base, db, tblName, "SEQUENCE")) == 0 ) {
-                rc = TableWriter_AddCursor(self->base, self->cols, sizeof(self->cols)/sizeof(self->cols[0]), &self->cursor_id);
-            }
-        }
-        if( rc == 0 ) {
-            self->options = options;
-            if (qual_quantization && strcmp(qual_quantization, "0") == 0) {
-                self->options |= ewseq_co_FullQuality;
-            }
-            if( !(self->options & ewseq_co_FullQuality) ) {
-                char const *quant_string = qual_quantization;
-                
-                if (quant_string == NULL || strcmp(quant_string, "1") == 0) {
-                    quant_string = "1:10,10:20,20:30,30:-";
-                } else if (strcmp(quant_string, "2") == 0) {
-                    quant_string = "1:30,30:-";
-                }
-                if (!TableWriterSeq_InitQuantMatrix(self->discrete_qual, quant_string)) {
-                    rc = RC(rcAlign, rcFormatter, rcConstructing, rcParam, rcInvalid);
-                }
-            }
-        }
-    }
-    if( rc == 0 ) {
-        *cself = self;
-        ALIGN_DBG("table %s", "created");
-    } else {
-        TableWriterSeq_Whack(self, false, NULL);
-        ALIGN_DBGERR(rc);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC TableWriterSeq_Whack(const TableWriterSeq* cself, bool commit, uint64_t* rows)
-{
-    rc_t rc = 0;
-
-    if( cself != NULL ) {
-        TableWriterSeq* self = (TableWriterSeq*)cself;
-        VTable *vtbl;
-        
-        TableReader_Whack(cself->tmpkey_reader);
-#if 1
-        if (cself->stats && commit && (rc = TableWriter_GetVTable(cself->base, &vtbl)) == 0 ) {
-            KMetadata* meta;
-            if( (rc = VTableOpenMetadataUpdate(vtbl, &meta)) == 0 ) {
-                KMDataNode* node;
-                if( (rc = KMetadataOpenNodeUpdate(meta, &node, "MATE_STATISTICS")) == 0 ) {
-                    rc = TableWriterSeq_WriteStatistics(cself, node);
-                    KMDataNodeRelease(node);
-                }
-                KMetadataRelease(meta);
-            }
-        }
-#endif
-        rc = TableWriter_Whack(cself->base, commit && (rc == 0), rows);
-        KVectorRelease(cself->stats);
-        free(self->qual_buf);
-        free(self);
-    }
-    return rc;
-}
-
-static
-rc_t TableWriteSeq_WriteDefaults(const TableWriterSeq* cself)
-{
-    rc_t rc = 0;
-    if( cself != NULL ) {
-        TableWriterSeq* self = (TableWriterSeq*)cself;
-        self->init = true;
-        if( (self->options & ewseq_co_AlignData) ) {
-            static TableWriterData const d = { "", 0 };
-            TW_COL_WRITE_DEF(self->base, cself->cursor_id, self->cols[ewseq_cn_PRIMARY_ALIGNMENT_ID], d);
-            TW_COL_WRITE_DEF(self->base, cself->cursor_id, self->cols[ewseq_cn_ALIGNMENT_COUNT], d);
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC TableWriteSeq_WriteDefault(const TableWriterSeq* cself,
-                                              enum ETableWriterSeq_ColNames col, const TableWriterData* data)
-{
-    rc_t rc = 0;
-    if( !cself->init ) {
-        rc = TableWriteSeq_WriteDefaults(cself);
-    }
-    if( rc == 0 ) {
-        rc = TableWriter_ColumnDefault(cself->base, cself->cursor_id, &cself->cols[col], data);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC TableWriterSeq_GetNextRowId(const TableWriterSeq* cself, int64_t* rowid)
-{
-    return TableWriter_GetNextRowId(cself->base, rowid, cself->cursor_id);
-}
-
-LIB_EXPORT rc_t CC TableWriterSeq_Write(const TableWriterSeq* cself, const TableWriterSeqData* data, int64_t* rowid)
-{
-    rc_t rc = 0;
-    int lbl;
-    
-    if( cself == NULL || data == NULL ) {
-        rc = RC( rcAlign, rcType, rcWriting, rcParam, rcNull);
-        ALIGN_DBGERR(rc);
-    } else if( !cself->init && (rc = TableWriteSeq_WriteDefaults(cself)) != 0 ) {
-        ALIGN_DBGERR(rc);
-    } else if( data->quality.buffer == NULL || data->sequence.elements != data->quality.elements ) {
-        rc = RC(rcAlign, rcType, rcWriting, rcData, data->quality.buffer ? rcInconsistent : rcEmpty);
-        ALIGN_DBGERRP("sequence and quality length %lu <> %lu", rc, data->sequence.elements, data->quality.elements);
-    } else if( data->read_start.elements != data->nreads ) {
-        rc = RC(rcAlign, rcType, rcWriting, rcData, rcInconsistent);
-        ALIGN_DBGERRP("nreads and read_start length %u <> %lu", rc, data->nreads, data->read_start.elements);
-    } else if( data->read_len.elements != data->nreads ) {
-        rc = RC(rcAlign, rcType, rcWriting, rcData, rcInconsistent );
-        ALIGN_DBGERRP("nreads and read_len length %u <> %lu", rc, data->nreads, data->read_len.elements);
-    } else if( (cself->options & ewseq_co_AlignData) && data->primary_alignment_id.elements != data->nreads ) {
-        rc = RC(rcAlign, rcType, rcWriting, rcData, rcInconsistent);
-        ALIGN_DBGERRP("nreads and primary_alignment_id length %u <> %lu", rc, data->nreads, data->primary_alignment_id.elements);
-    } else if( (cself->options & ewseq_co_AlignData) && data->alignment_count.elements != data->nreads ) {
-        rc = RC(rcAlign, rcType, rcWriting, rcData, rcInconsistent);
-        ALIGN_DBGERRP("nreads and alignment_count length %u <> %lu", rc, data->nreads, data->alignment_count.elements);
-    } else if( data->no_quantize_mask.buffer && data->no_quantize_mask.elements != data->quality.elements ) {
-        rc = RC(rcAlign, rcType, rcWriting, rcData, rcInconsistent);
-        ALIGN_DBGERRP("quality and no_quantize_mask length %u <> %lu", rc, data->quality.elements, data->no_quantize_mask.elements);
-    } else if( !(cself->options & ewseq_co_NoLabelData) &&
-               (lbl = ((data->label.buffer ? 1 : 0) + (data->label_start.buffer ? 1 : 0) +
-                                                  (data->label_len.buffer ? 1 : 0))) != 0 && lbl != 3 ) {
-        rc = RC(rcAlign, rcType, rcWriting, rcData, rcInconsistent);
-        ALIGN_DBGERRP("LABEL %s", rc, "incomplete");
-    } else if( (rc = TableWriter_OpenRow(cself->base, rowid, cself->cursor_id)) == 0 ) {
-        if( cself->options & ewseq_co_AlignData ) {
-            TW_COL_WRITE(cself->base, cself->cols[ewseq_cn_PRIMARY_ALIGNMENT_ID], data->primary_alignment_id);
-            TW_COL_WRITE(cself->base, cself->cols[ewseq_cn_ALIGNMENT_COUNT], data->alignment_count);
-            if (rc == 0) {
-                rc = TableWriterSeq_CollectStatistics((TableWriterSeq *)cself, &data->primary_alignment_id);
-            }
-        }
-        if( cself->options & ewseq_co_SaveRead ) {
-            TW_COL_WRITE(cself->base, cself->cols[ewseq_cn_READ], data->sequence);
-        }
-        else {
-            uint32_t i;
-            const char* seq = data->sequence.buffer;
-            const uint8_t* ac = data->alignment_count.buffer;
-            const INSDC_coord_zero* rs = data->read_start.buffer;
-            const INSDC_coord_len* rl = data->read_len.buffer;
-
-            TW_COL_WRITE_BUF(cself->base, cself->cols[ewseq_cn_READ], NULL, 0);
-            TW_COL_WRITE_BUF(cself->base, cself->cols[ewseq_cn_CSREAD], NULL, 0);
-            for(i = 0; i < data->nreads; i++ ) {
-                if( ac[i] == 0 ) {
-                    TW_COL_WRITE_BUF(cself->base, cself->cols[ewseq_cn_READ], &seq[rs[i]], rl[i]);
-                    TW_COL_WRITE_BUF(cself->base, cself->cols[ewseq_cn_CSREAD], &seq[rs[i]], rl[i]);
-                }
-            }
-        }
-        if( cself->options & ewseq_co_FullQuality ) {
-            TW_COL_WRITE(cself->base, cself->cols[ewseq_cn_QUALITY], data->quality);
-        } else {
-            uint64_t i;
-            const uint8_t* b = data->quality.buffer;
-            if( data->quality.elements > cself->qual_buf_sz ) {
-                uint8_t* p = realloc(cself->qual_buf, data->quality.elements * cself->cols[ewseq_cn_QUALITY].element_bits);
-                if( p == NULL ) {
-                    rc = RC(rcAlign, rcType, rcWriting, rcMemory, rcExhausted);
-                    ALIGN_DBGERRP("quality %s", rc, "discretization");
-                } else {
-                    ((TableWriterSeq*)cself)->qual_buf_sz = data->quality.elements;
-                    ((TableWriterSeq*)cself)->qual_buf = p;
-                }
-            }
-            if (data->no_quantize_mask.buffer) {
-                bool const *mask = data->no_quantize_mask.buffer;
-                
-                for(i = 0; i < data->quality.elements; i++ ) {
-                    uint8_t const q = b[i] & 0x3F;
-                    cself->qual_buf[i] = mask[i] ? q : cself->discrete_qual[q];
-                }
-            }
-            else {
-                for(i = 0; i < data->quality.elements; i++ ) {
-                    cself->qual_buf[i] = cself->discrete_qual[b[i]];
-                }
-            }
-            if (cself->options & ewseq_co_SaveQual) {
-                TW_COL_WRITE_BUF(cself->base, cself->cols[ewseq_cn_QUALITY], cself->qual_buf, data->quality.elements);
-            }
-            else {
-                uint32_t i;
-                uint8_t const *const qual = data->sequence.buffer;
-                uint8_t const *const aligned = data->alignment_count.buffer;
-                INSDC_coord_zero const *const rs = data->read_start.buffer;
-                INSDC_coord_len const *const rl = data->read_len.buffer;
-                
-                TW_COL_WRITE_BUF(cself->base, cself->cols[ewseq_cn_QUALITY], NULL, 0);
-                for (i = 0; i < data->nreads; ++i) {
-                    if (!aligned[i]) {
-                        INSDC_coord_zero const readStart = rs[i];
-                        INSDC_coord_len const readLen = rl[i];
-                        
-                        TW_COL_WRITE_BUF(cself->base, cself->cols[ewseq_cn_QUALITY], &qual[readStart], readLen);
-                    }
-                }
-            }
-        }
-        if( !(cself->options & ewseq_co_NoLabelData) ) {
-            TW_COL_WRITE(cself->base, cself->cols[ewseq_cn_LABEL], data->label);
-            TW_COL_WRITE(cself->base, cself->cols[ewseq_cn_LABEL_START], data->label_start);
-            TW_COL_WRITE(cself->base, cself->cols[ewseq_cn_LABEL_LEN], data->label_len);
-        }
-        TW_COL_WRITE(cself->base, cself->cols[ewseq_cn_READ_TYPE], data->read_type);
-        TW_COL_WRITE(cself->base, cself->cols[ewseq_cn_READ_START], data->read_start);
-        TW_COL_WRITE(cself->base, cself->cols[ewseq_cn_READ_LEN], data->read_len);
-        TW_COL_WRITE_VAR(cself->base, cself->cols[ewseq_cn_TMP_KEY_ID], data->tmp_key_id);
-        TW_COL_WRITE(cself->base, cself->cols[ewseq_cn_SPOT_GROUP], data->spot_group);
-        TW_COL_WRITE(cself->base, cself->cols[ewseq_cn_CSKEY], data->cskey);
-        TW_COL_WRITE(cself->base, cself->cols[ewseq_cn_READ_FILTER], data->read_filter);
-        TW_COL_WRITE(cself->base, cself->cols[ewseq_cn_PLATFORM], data->platform);
-        TW_COL_WRITE(cself->base, cself->cols[ewseq_cn_TI], data->ti);
-        if( rc == 0 ) {
-            rc = TableWriter_CloseRow(cself->base);
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC TableWriterSeq_TmpKeyStart(const TableWriterSeq* cself)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL ) {
-        rc = RC( rcAlign, rcType, rcWriting, rcParam, rcNull);
-        ALIGN_DBGERR(rc);
-    } else if( cself->options & ewseq_co_AlignData ) {
-        rc = RC( rcAlign, rcType, rcWriting, rcParam, rcViolated);
-        ALIGN_DBGERR(rc);
-    } else if( (rc = TableWriter_CloseCursor(cself->base, 0, NULL)) == 0 ) {
-        TableWriterSeq* self = (TableWriterSeq*)cself;
-        VTable* vtbl = NULL;
-        
-        self->tmpKeyIdFirst = INT64_MAX;
-        self->tmpKeyIdLast = INT64_MIN;
-        memcpy(&self->cols_read_tmpkey, &TableSeqReadTmpKey_cols, sizeof(TableSeqReadTmpKey_cols));
-        if( (rc = TableWriter_GetVTable(cself->base, &vtbl)) == 0 &&
-            (rc = TableReader_Make(&self->tmpkey_reader, vtbl, self->cols_read_tmpkey, 50 * 1024 * 1024)) == 0 ) {
-            memcpy(self->cols_alignd, &TableWriterSeq_cols[ewseq_cn_PRIMARY_ALIGNMENT_ID], sizeof(self->cols_alignd));
-            rc = TableWriter_AddCursor(self->base, self->cols_alignd,
-                                       sizeof(self->cols_alignd) / sizeof(self->cols_alignd[0]),
-                                       &self->alignd_cursor_id);
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC TableWriterSeq_TmpKey(const TableWriterSeq* cself, int64_t rowid, uint64_t* key_id)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL || rowid == 0 || key_id == NULL ) {
-        rc = RC( rcAlign, rcType, rcReading, rcParam, rcNull);
-        ALIGN_DBGERR(rc);
-    } else if( cself->tmpkey_reader == NULL ) {
-        rc = RC( rcAlign, rcType, rcReading, rcMode, rcNotOpen);
-        ALIGN_DBGERR(rc);
-    } else if( (rc = TableReader_ReadRow(cself->tmpkey_reader, rowid)) == 0 ) {
-        memcpy(key_id, cself->cols_read_tmpkey[0].base.var, sizeof(*key_id));
-        if (cself->tmpKeyIdLast < rowid || rowid < cself->tmpKeyIdFirst) {
-            rc = TableReader_PageIdRange(cself->tmpkey_reader, rowid,
-                                        &((TableWriterSeq*)cself)->tmpKeyIdFirst,
-                                        &((TableWriterSeq*)cself)->tmpKeyIdLast);
-            ((TableWriterSeq*)cself)->flush = rc == 0;
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC TableWriterSeq_WriteAlignmentData(const TableWriterSeq* cself, int64_t rowid,
-                                                     const TableWriterData* primary_alignment_id,
-                                                     const TableWriterData* alignment_count)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL ) {
-        rc = RC( rcAlign, rcType, rcWriting, rcParam, rcNull);
-        ALIGN_DBGERR(rc);
-    } else if( cself->options & ewseq_co_AlignData ) {
-        rc = RC( rcAlign, rcType, rcWriting, rcParam, rcViolated);
-        ALIGN_DBGERR(rc);
-    } else if( rowid == 0 ) {
-        rc = TableWriter_Flush(cself->base, cself->alignd_cursor_id);
-    }
-    else if( primary_alignment_id == NULL || alignment_count == NULL ) {
-        rc = RC( rcAlign, rcType, rcWriting, rcParam, rcNull);
-        ALIGN_DBGERR(rc);
-    } else if( (rc = TableReader_ReadRow(cself->tmpkey_reader, rowid)) != 0 ||
-        cself->cols_read_tmpkey[1].len != primary_alignment_id->elements ) {
-        rc = rc ? rc : RC(rcAlign, rcType, rcWriting, rcData, rcInconsistent);
-        ALIGN_DBGERRP("nreads and primary_alignment_id length %u <> %lu",
-            rc, cself->cols_read_tmpkey[1].len, primary_alignment_id->elements);
-    } else if( primary_alignment_id->elements != alignment_count->elements ) {
-        rc = RC(rcAlign, rcType, rcWriting, rcData, rcInconsistent);
-        ALIGN_DBGERRP("primary_alignment_id and alignment_count length %u <> %lu",
-            rc, primary_alignment_id->elements, alignment_count->elements);
-    }
-    else {
-        if (cself->flush) {
-            rc = TableWriter_Flush(cself->base, cself->alignd_cursor_id);
-            ((TableWriterSeq*)cself)->flush = false;
-        }
-        if( rc == 0 &&
-           (rc = TableWriter_OpenRowId(cself->base, rowid, cself->alignd_cursor_id)) == 0 ) {
-            TW_COL_WRITE(cself->base, cself->cols_alignd[0], *primary_alignment_id);
-            TW_COL_WRITE(cself->base, cself->cols_alignd[1], *alignment_count);
-            if( rc == 0 ) {
-                rc = TableWriter_CloseRow(cself->base);
-            }
-            if (rc == 0/* && (cself->options & ewseq_co_WantMateStats)*/) {
-                rc = TableWriterSeq_CollectStatistics((TableWriterSeq *)cself, primary_alignment_id);
-            }
-        }
-    }
-    return rc;
-}
diff --git a/libs/ascp/Makefile b/libs/ascp/Makefile
deleted file mode 100644
index 59c3a4c..0000000
--- a/libs/ascp/Makefile
+++ /dev/null
@@ -1,80 +0,0 @@
-# ===========================================================================
-#
-#                            PUBLIC DOMAIN NOTICE
-#               National Center for Biotechnology Information
-#
-#  This software/database is a "United States Government Work" under the
-#  terms of the United States Copyright Act.  It was written as part of
-#  the author's official duties as a United States Government employee and
-#  thus cannot be copyrighted.  This software/database is freely available
-#  to the public for use. The National Library of Medicine and the U.S.
-#  Government have not placed any restriction on its use or reproduction.
-#
-#  Although all reasonable efforts have been taken to ensure the accuracy
-#  and reliability of the software and data, the NLM and the U.S.
-#  Government do not and cannot warrant the performance or results that
-#  may be obtained by using this software or data. The NLM and the U.S.
-#  Government disclaim all warranties, express or implied, including
-#  warranties of performance, merchantability or fitness for any particular
-#  purpose.
-#
-#  Please cite the author in any work or product based on this material.
-#
-# ===========================================================================
-
-
-default: std
-
-TOP ?= $(shell ../../build/abspath.sh ../..)
-MODULE = libs/ascp
-
-INT_LIBS = \
-    libascp
-
-ALL_LIBS = \
-	$(INT_LIBS)
-
-include $(TOP)/build/Makefile.env
-
-#-------------------------------------------------------------------------------
-# outer targets
-#
-all std: makedirs
-	@ $(MAKE_CMD) $(TARGDIR)/std
-
-$(INT_LIBS): makedirs
-	@ $(MAKE_CMD) $(ILIBDIR)/$@
-
-.PHONY: all std $(ALL_LIBS)
-
-#-------------------------------------------------------------------------------
-# std
-#
-$(TARGDIR)/std: \
-	$(addprefix $(ILIBDIR)/,$(INT_LIBS))
-
-.PHONY: $(TARGDIR)/std
-
-#-------------------------------------------------------------------------------
-# clean
-#
-clean: stdclean
-
-.PHONY: clean
-
-#-------------------------------------------------------------------------------
-# testing framework
-#
-$(ILIBDIR)/libascp: $(addprefix $(ILIBDIR)/libascp.,$(LIBX))
-
-SRC = \
-	ascp \
-	ascp-path \
-	connect
-#	silent-system
-
-OBJ = \
-	$(addsuffix .$(LOBX),$(SRC))
-
-$(ILIBDIR)/libascp.$(LIBX): $(OBJ)
-	$(LD) --slib -o $@ $^ $(LIB)
diff --git a/libs/ascp/ascp-priv.h b/libs/ascp/ascp-priv.h
deleted file mode 100644
index 557adbc..0000000
--- a/libs/ascp/ascp-priv.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_libs_ascp_ascp_priv_
-#define _h_libs_ascp_ascp_priv_
-
-#include <kns/ascp.h> /* EAscpState */
-#include <klib/text.h> /* String */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define STS_INFO 1
-#define STS_DBG 2
-
-typedef enum {
-      eUnknown
-    , eChild
-    , eStart
-    , eLog
-    , eKeyStart
-    , eKeyMayBeIn
-    , eKeyIn
-    , eKeyEnd
-    , eProgress
-    , eWriteFailed
-    , eFailed
-    , eCompleted
-    , eEnd
-} EAscpState;
-
-rc_t ascpParse(const char *buf, size_t len, const char *filename,
-    EAscpState *state, String *line);
-
-bool ascp_path(const char **cmd, const char **key);
-
-rc_t run_ascp(const char *ascp_bin, const char *private_file,
-    const char *src, const char *dest, const AscpOptions *opt);
-
-rc_t mkAscpCmd(const char *ascp_bin, const char *private_file,
-    const char *src, const char *dest, const AscpOptions *opt,
-    char *const argv[], size_t argvSz);
-
-int silent_system(const char *command);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/libs/ascp/ascp.c b/libs/ascp/ascp.c
deleted file mode 100644
index 133155b..0000000
--- a/libs/ascp/ascp.c
+++ /dev/null
@@ -1,745 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ==============================================================================
-*
-*/
-
-#include "ascp-priv.h"
-
-#include <kfg/config.h> /* KConfig */
-
-#include <kfs/directory.h> /* KDirectory */
-
-#include <klib/log.h> /* LOGERR */
-#include <klib/out.h> /* OUTMSG */
-#include <klib/printf.h> /* string_vprintf */
-#include <klib/rc.h>
-#include <klib/status.h> /* STSMSG */
-
-#include <sysalloc.h> /* free */
-
-#include <assert.h>
-#include <stdlib.h> /* free */
-#include <string.h> /* memset */
-
-#define DISP_RC(rc, err) (void)((rc == 0) ? 0 : LOGERR(klogInt, rc, err))
-
-#define RELEASE(type, obj) do { rc_t rc2 = type##Release(obj); \
-    if (rc2 != 0 && rc == 0) { rc = rc2; } obj = NULL; } while (false)
-
-#define STS_INFO 1
-#define STS_FIN 3
-
-static bool _StringStartsWith(const String *self, const char *buf) {
-    size_t len = 0;
-    assert(self && buf);
-    len = string_size(buf);
-    assert(len);
-/*printf("_StringStartsWith(%.*s, %s)\n", self->len, self->addr, buf);*/
-    if (self->len < len) {
-        return false;
-    }
-    return string_cmp(self->addr, self->len, buf, len, (uint32_t)len) == 0;
-}
-
-static
-bool _StringHas(const String *self, const char *buf, String *res)
-{
-    String dummy;
-    size_t len = 0;
-    assert(self && buf);
-    if (res == NULL) {
-        res = &dummy;
-    }
-    len = string_size(buf);
-    assert(len);
-    StringInit(res, self->addr, self->size, self->len);
-    while (true) {
-        if (res->len < len) {
-            StringInit(res, NULL, 0, 0);
-            return false;
-        }
-        if (_StringStartsWith(res, buf)) {
-            res->len = (uint32_t)len;
-            res->size = len;
-            return true;
-        }
-        res->size = res->len - 1;
-        res->len = res->len - 1;
-        ++res->addr;
-    }
-}
-
-typedef struct {
-    EAscpState s;
-    char *msg;
-    bool failure;
-} SAscpState;
-static void SAscpStateFini(SAscpState *self) {
-    assert(self);
-
-/* #if ! WINDOWS #endif */
-    free(self->msg);
-
-    memset(self, 0, sizeof *self);
-}
-
-static bool sStatus = false;
-
-static rc_t parseAscpLine(const String *s, SAscpState *state, const char *name)
-{
-    bool debug = true;
-    if (!sStatus) {
-        debug = false;
-    }
-
-    assert(s && state);
-
-    memset(state, 0, sizeof *state);
-
-    if (_StringHas(s, "CHILD: ", NULL)) {
-        if (sStatus) {
-            OUTMSG(("%.*s\n",  s->len, s->addr));
-        }
-        state->s = eChild;
-    }
-    else if (_StringStartsWith(s, "Cannot open log file: ")) {
-        if (debug) OUTMSG(("matched: LOG: '%.*s'\n", s->len, s->addr));
-        state->s = eLog;
-    }
-    else if (_StringStartsWith(s, "The server's host key is not")) {
-        if (debug) OUTMSG(("matched: KeySTART: '%.*s'\n", s->len, s->addr));
-        state->s = eKeyStart;
-    }
-    else if (_StringHas(s, "no guarantee that the server is th", NULL)) {
-        if (debug) OUTMSG(("matched: KeyIN: '%.*s'\n", s->len, s->addr));
-        state->s = eKeyIn;
-    }
-    else if (_StringHas(s, "think it is.", NULL)) {
-        if (debug) OUTMSG(("matched: KeyIN: '%.*s'\n", s->len, s->addr));
-        state->s = eKeyIn;
-    }
-    else if (_StringHas(s, "The server's rsa2 key fingerprint ", NULL)) {
-        if (debug) OUTMSG(("matched: KeyIN: '%.*s'\n", s->len, s->addr));
-        state->s = eKeyIn;
-    }
-    else if (_StringHas(s, "ssh-rsa 1024 ", NULL)) {
-        if (debug) OUTMSG(("matched: KeyIN: '%.*s'\n", s->len, s->addr));
-        state->s = eKeyIn;
-    }
-    else if (_StringHas(s, "If you trust this host, enter ", NULL)) {
-        if (debug) OUTMSG(("matched: KeyIN: '%.*s'\n", s->len, s->addr));
-        state->s = eKeyIn;
-    }
-    else if (_StringHas(s, "PuTTY's cache and carry on connect", NULL)) {
-        if (debug) OUTMSG(("matched: KeyIN: '%.*s'\n", s->len, s->addr));
-        state->s = eKeyIn;
-    }
-    else if (_StringHas(s, "If you want to carry on connecting", NULL)) {
-        if (debug) OUTMSG(("matched: KeyIN: '%.*s'\n", s->len, s->addr));
-        state->s = eKeyIn;
-    }
-    else if (_StringHas(s, "adding the key to the cache, enter", NULL)) {
-        if (debug) OUTMSG(("matched: KeyIN: '%.*s'\n", s->len, s->addr));
-        state->s = eKeyIn;
-    }
-    else if (_StringHas(s, " you do not trust this host, press", NULL)) {
-        if (debug) OUTMSG(("matched: KeyIN: '%.*s'\n", s->len, s->addr));
-        state->s = eKeyIn;
-    }
-    else if (_StringHas(s, "connection.", NULL)) {
-        if (debug) OUTMSG(("matched: KeyIN: '%.*s'\n", s->len, s->addr));
-        state->s = eKeyIn;
-    }
-    else if (_StringHas(s, "Store key in cache? (y/n) ", NULL)) {
-        if (debug) OUTMSG(("matched: KeyEND: '%.*s'\n", s->len, s->addr));
-        state->s = eKeyEnd;
-    }
-    else if (string_chr(s->addr, s->len, '%') != NULL) {
-        if (debug) OUTMSG(("matched: PROGRESS: '%.*s'\n", s->len, s->addr));
-        state->s = eProgress;
-        if ((state->msg = string_dup(s->addr, s->len)) == NULL) {
-            return RC(rcExe, rcStorage, rcAllocating, rcMemory, rcExhausted);
-        }
-    }
-    else if (_StringStartsWith(s, "Completed: ")) {
-        if (debug) OUTMSG(("matched: COMPLETED: '%.*s'\n", s->len, s->addr));
-        state->s = eCompleted;
-        if ((state->msg = string_dup(s->addr, s->len)) == NULL) {
-            return RC(rcExe, rcStorage, rcAllocating, rcMemory, rcExhausted);
-        }
-    }
-    else if (_StringStartsWith(s, "Partial Completion: ")) {
-        if (debug) OUTMSG(("matched: END: '%.*s'\n", s->len, s->addr));
-        state->s = eEnd;
-        if ((state->msg = string_dup(s->addr, s->len)) == NULL) {
-            return RC(rcExe, rcStorage, rcAllocating, rcMemory, rcExhausted);
-        }
-    }    
-    else if (_StringStartsWith(s, "Connection abandoned.")) {
-/* printed in caller     printf("matched: END: '%.*s'\n", s->len, s->addr); */
-        state->s = eFailed;
-        if ((state->msg = string_dup(s->addr, s->len)) == NULL) {
-            return RC(rcExe, rcStorage, rcAllocating, rcMemory, rcExhausted);
-        }
-    }
-    else if (_StringHas(s, "failed to open connection to remot", NULL)) {
-/* printed in caller       printf("matched: END: '%.*s'\n", s->len, s->addr); */
-        state->s = eFailed;
-        if ((state->msg = string_dup(s->addr, s->len)) == NULL) {
-            return RC(rcExe, rcStorage, rcAllocating, rcMemory, rcExhausted);
-        }
-    }
-    else if (_StringHas(s, "exiting", NULL)) {
-        state->s = eFailed;
-        if ((state->msg = string_dup(s->addr, s->len)) == NULL) {
-            return RC(rcExe, rcStorage, rcAllocating, rcMemory, rcExhausted);
-        }
-    }
-    else if (_StringStartsWith(s, "Session Stop  (Error: Disk write ")) {
-   if (debug) OUTMSG(("matched: Disk write failed: '%.*s'\n", s->len, s->addr));
-        state->s = eWriteFailed;
-        if ((state->msg = string_dup(s->addr, s->len)) == NULL) {
-            return RC(rcExe, rcStorage, rcAllocating, rcMemory, rcExhausted);
-        }
-    }
-    else if (_StringStartsWith(s, "Session Stop ")) {
-        if (debug) OUTMSG(("matched: COMPLETED: '%.*s'\n", s->len, s->addr));
-        state->s = eFailed;
-        if ((state->msg = string_dup(s->addr, s->len)) == NULL) {
-            return RC(rcExe, rcStorage, rcAllocating, rcMemory, rcExhausted);
-        }
-    }
-    else if (_StringHas(s, " bits/sec), in 1 file", NULL)) {
-        if (debug) OUTMSG(("matched: END: '%.*s'\n", s->len, s->addr));
-        state->s = eEnd;
-        if ((state->msg = string_dup(s->addr, s->len)) == NULL) {
-            return RC(rcExe, rcStorage, rcAllocating, rcMemory, rcExhausted);
-        }
-    }
-    else if (_StringStartsWith(s, name)) {
-        /* in the beginning:
-           line starting by dest file name, then some white characters */
-        if (debug) OUTMSG(("matched: PROGRESS: '%.*s'\n", s->len, s->addr));
-        state->s = eProgress;
-        if ((state->msg = string_dup(s->addr, s->len)) == NULL) {
-            return RC(rcExe, rcStorage, rcAllocating, rcMemory, rcExhausted);
-        }
-    }
-    else {
-        OUTMSG(("LINE = (%d) '%.*s'\n", s->len, s->len, s->addr));
-/*      assert(0); */
-    }
-    return 0;
-}
-
-rc_t ascpParse(const char *buf, size_t len, const char *filename,
-    EAscpState *state, String *line)
-{
-    bool failure = false;
-    const char *p = buf;
-    int64_t l = len;
-    assert(buf && len && filename && state && line);
-    StringInit(line, NULL, 0, 0);
-    while (true) {
-        const char *n = string_chr(p, l, '\n');
-        const char *r = string_chr(p, l, '\r');
-        if (n == NULL) {
-            if (r != NULL) {
-                n = r;
-            }
-        }
-        else {
-            if (r != NULL) {
-                if (r < n) {
-                    n = r;
-                }
-            }
-        }
-        if (n != NULL) {
-            StringInit(line, p, n - p, (uint32_t)(n - p));
-            l -= n - p + 1;
-        }
-        else {
-            StringInit(line, p, l, (uint32_t)l);
-        }
-        if (line->addr && line->len && line->addr[line->len - 1] == '\r') {
-            line->size = line->len - 1;
-            line->len = line->len - 1;
-        }
-        if (line->addr && line->len && line->addr[0] == '\r') {
-            ++line->addr;
-            line->size = line->len - 1;
-            line->len = line->len - 1;
-        }
-        if (line->len != 0) {
-            SAscpState full;
-            rc_t rc = parseAscpLine(line, &full, filename);
-            if (rc != 0) {
-                return rc;
-            }
-            switch (full.s) {
-                case eChild:
-                    break;
-                case eUnknown:
-                    switch (*state) {
-                        case eKeyStart:
-                        case eKeyMayBeIn:
-                        case eKeyIn:
-                            *state = eKeyMayBeIn;
-                            break;
-                        case eCompleted:
-                        case eFailed:
-                        case eWriteFailed:
-                            *state = eEnd;
-                            /* report to user */
-                            break;
-                        case eProgress:
-                            if (sStatus) {
-                                OUTMSG(("\n"));
-                            }
-/*                          no break; */
-                        default:
-                            *state = eUnknown;
-                            /* report to user */
-                            break;
-                    }
-                    break;
-                case eFailed:
-                    if (*state == eProgress) {
-                        if (sStatus) {
-                            OUTMSG(("\n"));
-                        }
-                    }
-                    failure = true;
-                    *state = full.s;
-                    if (sStatus) {
-                        OUTMSG(("%s\n", full.msg));
-                    }
-/*                  no break; */
-                    break;
-                case eWriteFailed:
-                    if (*state == eProgress) {
-                        if (sStatus) {
-                            OUTMSG(("\n"));
-                        }
-                    }
-                    failure = true;
-                    *state = full.s;
-                    if (sStatus) {
-                        OUTMSG(("%s\n", full.msg));
-                    }
-/*                  no break; */
-                    break;
-                case eCompleted:
-                    if (*state == eProgress) {
-                        if (sStatus) {
-                            OUTMSG(("\n"));
-                        }
-                    }
-                    failure = false;
-                    *state = full.s;
-                    if (sStatus) {
-                        OUTMSG(("%s\n", full.msg));
-                    }
-/*                  no break; */
-                    break;
-                case eProgress:
-                    if (*state == eProgress) {
-                        if (sStatus) {
-                            OUTMSG(("\r"));
-                        }
-                    }
-                    *state = full.s;
-                    if (sStatus) {
-                        OUTMSG(("%s", full.msg));
-                    }
-                    break;
-                case eEnd:
-                    if (*state == eProgress) {
-                        if (sStatus) {
-                            OUTMSG(("\n"));
-                        }
-                    }
-                    *state = full.s;
-                    if (sStatus) {
-                        OUTMSG(("%s\n", full.msg));
-                    }
-                    /* report to user */
-                    break;
-                default:
-                    *state = full.s;
-                    break;
-            }
-            SAscpStateFini(&full);
-        }
-        if (n == NULL || l <= 0) {
-            break;
-        }
-        if (*state == eKeyEnd) {
-            String end;
-            if (_StringHas(line, "Store key in cache? (y/n) ", &end)) {
-                if (n > end.addr + end.len) {
-                    l += n - end.addr + end.len;
-                    n = end.addr + end.len - 1;
-                }
-            }
-        }
-        p = n + 1;
-        if (p >= buf + len) {
-            break;
-        }
-    }
-    if (sStatus) {
-        STSMSG(STS_FIN, ("%.*s", len, buf));
-    }
-    return 0;
-}
-
-static bool _KConfigAscpDisabled(const KConfig *self, bool status) {
-    bool disabled = false;
-    const char path[] = "tools/ascp/disabled";
-    rc_t rc = KConfigReadBool(self, path, &disabled);
-    if (rc != 0) {
-        if (rc != SILENT_RC(rcKFG, rcNode, rcOpening, rcPath, rcNotFound)) {
-            DISP_RC(rc, path);
-        }
-        else {
-            if (status) {
-                STSMSG(STS_DBG, ("'%s': not found in configuration", path));
-            }
-        }
-        disabled = false;
-    }
-    else {
-        if (status) {
-            STSMSG(STS_DBG, ("'%s' = '%s'", path, disabled ? "true" : "false"));
-        }
-    }
-    return disabled;
-}
-
-static String* _KConfigAscpString(const KConfig *self,
-    const char *path, const char *name)
-{
-    String *ascp = NULL;
-    rc_t rc = KConfigReadString(self, path, &ascp);
-    if (rc == 0) {
-        assert(ascp);
-/*      STSMSG(STS_INFO, ("Using %s from configuration: '%s'",
-            name, ascp->addr)); */
-        return ascp;
-    }
-    else {
-        if (rc != SILENT_RC(rcKFG, rcNode, rcOpening, rcPath, rcNotFound)) {
-            DISP_RC(rc, path);
-        }
-        else {
-/*          STSMSG(STS_DBG, ("'%s': not found in configuration", path)); */
-        }
-        free(ascp);
-        return NULL;
-    }
-}
-
-/******************************************************************************/
-
-static int _SilentSystem(const char *fmt, ...) {
-    rc_t rc = 0;
-    char buffer[4096];
-    size_t num_writ = 0;
-    va_list args;
-    va_start(args, fmt);
-    rc = string_vprintf(buffer, sizeof buffer, &num_writ, fmt, args);
-    va_end(args);
-    if (rc != 0) {
-        LOGERR(klogInt, rc, "while making ascp command line");
-        return 1;
-    }
-    return silent_system(buffer);
-}
-
-static bool _SystemHelp(const char *command, bool status) {
-    int value = 0;
-    if (status) {
-        STSMSG(STS_DBG, ("Checking '%s'", command));
-    }
-    value = _SilentSystem("\"%s\" -h", command);
-    if (value == 0) {
-        if (status) {
-            STSMSG(STS_INFO, ("Using '%s'", command));
-        }
-        return true;
-    }
-    else {
-        if (status) {
-            STSMSG(STS_DBG, ("'%s': not found", command));
-        }
-        return false;
-    }
-}
-
-static rc_t _KConfigGetAscpRate(const KConfig *self, const char **max_rate) {
-    String *s = NULL;
-    assert(self && max_rate);
-    *max_rate = NULL;
-    s = _KConfigAscpString(self, "tools/ascp/max_rate", "Aspera max rate");
-    if (s != NULL) {
-        if (s->size == 0) {
-            free(s);
-        }
-        else {
-            *max_rate = string_dup_measure(s->addr, NULL);
-            free(s);
-            if (*max_rate == NULL) {
-                free((void*)*max_rate);
-                return RC(rcNS, rcStorage, rcAllocating, rcMemory, rcExhausted);
-            }
-        }
-        return 0;
-    }
-    return 0;
-}
-
-static rc_t _KConfigGetAscp(const KConfig *self,
-    const char **ascp_bin, const char **private_file)
-{
-    String *bin = NULL;
-    String *key = NULL;
-    assert(self && ascp_bin && private_file);
-    *ascp_bin = *private_file = NULL;
-    bin = _KConfigAscpString(self, "tools/ascp/path", "ascp");
-    key = _KConfigAscpString(self, "tools/ascp/key", "Aspera key");
-    if (bin != NULL && key != NULL) {
-        *ascp_bin = string_dup_measure(bin->addr, NULL);
-        *private_file = string_dup_measure(key->addr, NULL);
-        free(bin);
-        free(key);
-        if (*ascp_bin == NULL || *private_file == NULL) {
-            free((void*)*ascp_bin);
-            free((void*)*private_file);
-            *ascp_bin = *private_file = NULL;
-            return RC(rcNS, rcStorage, rcAllocating, rcMemory, rcExhausted);
-        }
-        return 0;
-    }
-    free(bin);
-    free(key);
-    return 0;
-}
-static bool _KDirectoryFileFound(const KDirectory *self,
-    const char *path, bool status)
-{
-    KPathType type = kptNotFound;
-    if (status) {
-        STSMSG(STS_DBG, ("Checking '%s'", path));
-    }
-    type = KDirectoryPathType(self, path);
-    if ((type & ~kptAlias) == kptFile) {
-        if (status) {
-            STSMSG(STS_DBG, ("'%s': found", path));
-        }
-        return true;
-    }
-    else {
-        if (status) {
-            STSMSG(STS_DBG, ("'%s': not found", path));
-        }
-        return false;
-    }
-}
-
-LIB_EXPORT rc_t CC ascp_locate(const char **ascp_bin, const char **private_file,
-    bool use_config, bool status)
-{
-    rc_t rc = 0;
-    KConfig *cfg = NULL;
-    if (ascp_bin == NULL || private_file == NULL) {
-        return RC(rcNS, rcFile, rcCopying, rcParam, rcNull);
-    }
-    *ascp_bin = *private_file = NULL;
-    rc = KConfigMake(&cfg, NULL);
-    if (rc != 0) {
-        return rc;
-    }
-    if (_KConfigAscpDisabled(cfg, status)) {
-        if (status) {
-            STSMSG(STS_INFO, ("Use of Aspera transfer is disabled "
-                "by the configuration, using HTTP transfer"));
-        }
-    }
-    else {
-        KDirectory *dir = NULL;
-        const char *bin = NULL;
-        const char *key = NULL;
-        rc = _KConfigGetAscp(cfg, ascp_bin, private_file);
-        if (*ascp_bin != NULL) {
-            assert(*private_file && !rc);
-            RELEASE(KConfig, cfg);
-            return 0;
-        }
-        rc = KDirectoryNativeDir(&dir);
-        if (rc != 0) {
-            return rc;
-        }
-        while (ascp_path(&bin, &key)) {
-            if (_SystemHelp(bin, status)) {
-                if (_KDirectoryFileFound(dir, key, status)) {
-                    *ascp_bin = string_dup_measure(bin, NULL);
-                    *private_file = string_dup_measure(key, NULL);
-                    if (*ascp_bin == NULL || *private_file == NULL) {
-                        free((void*)*ascp_bin);
-                        free((void*)*private_file);
-                        *ascp_bin = *private_file = NULL;
-                        return RC(rcNS,
-                            rcStorage, rcAllocating, rcMemory, rcExhausted);
-                    }
-                    break;
-                }
-            }
-        }
-        RELEASE(KDirectory, dir);
-    }
-    RELEASE(KConfig, cfg);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC aspera_get(
-    const char *ascp_bin, const char *private_file, const char *src,
-    const char *dest, AscpOptions *opt)
-{
-    AscpOptions dummy;
-    bool status = false;
-    uint64_t prev = 0;
-    int attempt = 0;
-    KDirectory *dir = NULL;
-    TQuitting *quitting = NULL;
-    rc_t rc = KDirectoryNativeDir(&dir);
-    if (rc != 0) {
-        return rc;
-    }
-    if (ascp_bin == NULL || private_file == NULL ||
-        src == NULL || dest == NULL)
-    {
-        return RC(rcNS, rcFile, rcCopying, rcParam, rcNull);
-    }
-    if (opt == NULL) {
-        memset(&dummy, 0, sizeof dummy);
-        opt = &dummy;
-    }
-
-    if (opt->target_rate == NULL) {
-        KConfig *cfg = NULL;
-        rc_t rc = KConfigMake(&cfg, NULL);
-        DISP_RC(rc, "cannot KConfigMake");
-        if (rc == 0) {
-            rc = _KConfigGetAscpRate(cfg, &opt->target_rate);
-            DISP_RC(rc, "cannot get aspera max rate");
-        }
-        RELEASE(KConfig, cfg);
-    }
-
-    sStatus = status = opt->status;
-    quitting = opt->quitting;
-
-    while (true) {
-        rc = run_ascp(ascp_bin, private_file, src, dest, opt);
-        if (rc == 0) {
-            if (status) {
-                STSMSG(STS_DBG, ("ascp finished with success"));
-            }
-            break;
-        }
-        else if (rc == SILENT_RC(rcExe,
-            rcProcess, rcExecuting, rcMemory, rcExhausted))
-        {
-            if (status) {
-                STSMSG(STS_DBG, ("ascp failed: %R", rc));
-            }
-            break;
-        }
-        else {
-            rc_t rc = 0;
-            uint64_t size = 0;
-            if (quitting != NULL) {
-                rc = quitting();
-                if (rc != 0) {
-                    break;
-                }
-            }
-            if (status) {
-                STSMSG(STS_DBG, ("ascp failed: %R", rc));
-            }
-            rc = KDirectoryFileSize(dir, &size, dest);
-            if (rc != 0 || size < prev) {
-            if (status) {
-STSMSG(0, ("KDirectoryFileSize after ascp run: "
-"rc = %ld, size = %ld", rc, size));
-            }
-                break;
-            }
-            else if (size > prev) {
-                if (status) {
-                    STSMSG(STS_INFO, ("  fasp download failed. %ld bytes "
-                        "received so far. Retrying...", size));
-                }
-                attempt = 0;
-                prev = size;
-            } else {
-                if (attempt++ > 3) {
-                    break;
-                }
-                if (status) {
-                    STSMSG(STS_INFO, ("  fasp download failed. %ld bytes "
-                        "received so far. Retrying %d...", size, attempt));
-                }
-            }
-        }
-    }
-    RELEASE(KDirectory, dir);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC aspera_options(AscpOptions *opt) {
-    KConfig *cfg = NULL;
-    rc_t rc = 0;
-    if (opt == NULL) {
-        return RC(rcNS, rcFile, rcVisiting, rcParam, rcNull);
-    }
-    memset(opt, 0, sizeof *opt);
-    rc = KConfigMake(&cfg, NULL);
-    if (rc == 0) {
-        rc = _KConfigGetAscpRate(cfg, &opt->target_rate);
-        opt->disabled = _KConfigAscpDisabled(cfg, false);
-    }
-    RELEASE(KConfig, cfg);
-    return rc;
-}
-
-/*rc_t mkAscpCmd(const char *ascp_bin, const char *private_file,
-    const char *src, const char *dest, const AscpOptions *opt,
-    char *const argv[], size_t argvSz)
-{
-    rc_t rc = 0;
-    return rc;
-}*/
diff --git a/libs/ascp/linux/ascp-path.c b/libs/ascp/linux/ascp-path.c
deleted file mode 100644
index 68ebfb7..0000000
--- a/libs/ascp/linux/ascp-path.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ==============================================================================
-*
-*/
-
-#include "ascp-priv.h" /* ascp_path */
-
-#include <klib/printf.h> /* string_printf */
-
-#include <assert.h>
-#include <limits.h> /* PATH_MAX */
-#include <stdlib.h> /* getenv */
-
-bool ascp_path(const char **cmd, const char **key) {
-    static int idx = 0;
-    static const char k[] = "/opt/aspera/etc/asperaweb_id_dsa.putty";
-    static const char *c[]
-        = { "ascp", "/usr/bin/ascp", "/opt/aspera/bin/ascp" };
-    assert(cmd && key);
-    if (idx < sizeof c / sizeof c[0]) {
-        *cmd = c[idx];
-        *key = k;
-        ++idx;
-        return true;
-    }
-    else if (idx == sizeof c / sizeof c[0]) {
-        rc_t rc = 0;
-        static char k[PATH_MAX] = "";
-        static char c[PATH_MAX] = "";
-        if (k[0] == '\0') {
-            size_t num_writ = 0;
-            const char* home = getenv("HOME");
-            if (home == NULL) {
-                home = "";
-            }
-            rc = string_printf(k, sizeof k, &num_writ,
-                    "%s/.aspera/connect/etc/asperaweb_id_dsa.putty", home);
-            if (rc != 0 || num_writ >= PATH_MAX) {
-                assert(0);
-                k[0] = '\0';
-            }
-            else {
-                rc = string_printf(c, sizeof c, &num_writ,
-                    "%s/.aspera/connect/bin/ascp", home);
-                if (rc != 0 || num_writ >= PATH_MAX) {
-                    assert(0);
-                    c[0] = '\0';
-                }
-            }
-        }
-        if (rc != 0) {
-            *cmd = *key = NULL;
-            idx = 0;
-            return false;
-        }
-        else {
-            *cmd = c;
-            *key = k;
-            ++idx;
-            return true;
-        }
-    }
-    else {
-        *cmd = *key = NULL;
-        idx = 0;
-        return false;
-    }
-}
\ No newline at end of file
diff --git a/libs/ascp/mac/ascp-path.c b/libs/ascp/mac/ascp-path.c
deleted file mode 100644
index f1e79d4..0000000
--- a/libs/ascp/mac/ascp-path.c
+++ /dev/null
@@ -1,65 +0,0 @@
-#include "ascp-priv.h" /* ascp_path */
-#include <klib/printf.h> /* string_printf */
-#include <assert.h>
-#include <limits.h> /* PATH_MAX */
-#include <stdlib.h> /* getenv */
-
-bool ascp_path(const char **cmd, const char **key) {
-    static int idx = 0;
-    static const char k[] = "/Applications/Aspera Connect.app/Contents/"
-        "Resources/asperaweb_id_dsa.putty";
-    static const char c[] = "/Applications/Aspera Connect.app/Contents/"
-        "Resources/ascp";
-    assert(cmd && key);
-    if (idx == 0) {
-        ++idx;
-        *cmd = c;
-        *key = k;
-        return true;
-    }
-    else if (idx == 1) {
-        rc_t rc = 0;
-        static char k[PATH_MAX] = "";
-        static char c[PATH_MAX] = "";
-        if (k[0] == '\0') {
-            size_t num_writ = 0;
-            const char* home = getenv("HOME");
-            if (home == NULL) {
-                home = "";
-            }
-            rc = string_printf(k, sizeof k, &num_writ,
- "%s/Applications/Aspera Connect.app/Contents/Resources/asperaweb_id_dsa.putty"
-                , home);
-            if (rc != 0 || num_writ >= PATH_MAX) {
-                assert(0);
-                k[0] = '\0';
-            }
-            else {
-                rc = string_printf(c, sizeof c, &num_writ,
- "%s/Applications/Aspera Connect.app/Contents/Resources/ascp"
-                   , home);
-                if (rc != 0 || num_writ >= PATH_MAX) {
-                    assert(0);
-                    c[0] = '\0';
-                }
-            }
-        }
-        if (rc != 0) {
-            *cmd = *key = NULL;
-            idx = 0;
-            return false;
-        }
-        else {
-            *cmd = c;
-            *key = k;
-            ++idx;
-            return true;
-        }
-        return true;
-    }
-    else {
-        idx = 0;
-        *cmd =  *key = NULL;
-        return false;
-    }
-}
diff --git a/libs/ascp/unix/connect.c b/libs/ascp/unix/connect.c
deleted file mode 100644
index 002c264..0000000
--- a/libs/ascp/unix/connect.c
+++ /dev/null
@@ -1,555 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include "ascp-priv.h" /* STS_DBG */
-
-#include <kfs/directory.h> /* KDirectory */
-
-#include <klib/time.h> /* KTimeStamp */
-#include <klib/printf.h> /* string_printf */
-#include <klib/text.h> /* string_copy */
-#include <klib/log.h> /* LOGERR */
-#include <klib/status.h> /* STSMSG */
-#include <klib/out.h> /* OUTMSG */
-#include <klib/rc.h> /* RC */
-
-#include <assert.h>
-#include <errno.h>
-#include <fcntl.h> /* open */
-#include <signal.h> /* kill */
-#include <stdlib.h> /* system */
-#include <stdio.h> /* fflush */
-#include <unistd.h> /* dup */
-#include <sys/wait.h> /* waitpid */
-
-#define DISP_RC(rc, err) (void)((rc == 0) ? 0 : LOGERR(klogInt, rc, err))
-
-#define RELEASE(type, obj) do { rc_t rc2 = type##Release(obj); \
-    if (rc2 != 0 && rc == 0) { rc = rc2; } obj = NULL; } while (false)
-
-static int logevp(const char *file, char *const argv[]) {
-    int result = 0;
-    if (STS_INFO > KStsLevelGet()) {
-        return 0;
-    }
-    result = printf("%s", file);
-    while (true) {
-        int res = printf(" %s", *argv);
-        if (result >= 0) {
-            if (res < 0) {
-                result = res;
-            }
-            else {
-                result += res;
-            }
-        }
-        if (*(++argv) == NULL) {
-            break;
-        }
-    }
-    printf("\n");
-    return result;
-}
-
-static
-uint64_t humanize(uint64_t number, char *sfx, uint64_t *fraction)
-{
-    assert(sfx);
-    if (fraction != NULL) {
-        *fraction = 0;
-    }
-    *sfx = 'B';
-    if (number > 1024L * 1024L * 1024L) {
-        if (fraction != NULL) {
-            number *= 1000;
-        }
-        number /=     1024L * 1024L * 1024L;
-        if (fraction != NULL) {
-            *fraction = number % 1000;
-            number /= 1000;
-        }
-        *sfx = 'G';
-    }
-    else if (number > 1024L * 1024L) {
-        number /=     1024L * 1024L;
-        *sfx = 'M';
-    }
-    else if (number > 1024) {
-        number /=     1024;
-        *sfx = 'K';
-    }
-    return number;
-}
-
-static void progress(const char *acc, uint64_t sz,
-    uint64_t srcSz, uint64_t hSrc, char sfSrc, KTime_t date)
-{
-    if (sz > 0) {
-        if (srcSz > 0) {
-            uint64_t p = 100 * sz / srcSz;
-            char sf = 'B';
-            uint64_t fr = 0;
-            uint64_t h = humanize(sz, &sf, &fr);
-            if (p > 0) {
-                if (sfSrc != 'B' && sf != 'B') {
-                    if (fr == 0) {
-                        if (date == 0) {
-                            OUTMSG(("%s %,ld/%,ld %ld%c/%,ld%c %ld%%        \r",
-                                    acc, sz, srcSz, h,sf,hSrc,sfSrc,p));
-                        }
-                        else {
-                            OUTMSG(("%s %,ld/%,ld %ld%c/%,ld%c %ld%% %ld    \r",
-                                    acc, sz, srcSz, h,sf,hSrc,sfSrc,p,
-                                    KTimeStamp() - date));
-                        }
-                    }
-                    else {
-                        OUTMSG(("%s %,ld/%,ld %ld.%03ld%c/%,ld%c %ld%%      \r",
-                                acc, sz, srcSz,h,fr,sf,hSrc,sfSrc,p));
-                    }
-                }
-                else {
-                    OUTMSG(("%s %,ld/%,ld %ld%%                             \r",
-                        acc, sz, srcSz, p));
-                }
-            }
-            else {
-                if (sfSrc != 'B' && sf != 'B') {
-                    if (fr == 0) {
-                        OUTMSG((
-                        "%s %,ld/%,ld %ld%c/%ld%c                           \r",
-                         acc, sz,srcSz,h, sf,hSrc,sfSrc));
-                    }
-                    else {
-                        OUTMSG((
-                        "%s %,ld/%,ld %ld.%03ld%c/%ld%c                     \r",
-                         acc, sz,srcSz,h, fr,sf,hSrc,sfSrc));
-                    }
-                }
-                else {
-                    OUTMSG(("%s %,ld/%,ld                 \r", acc, sz, srcSz));
-                }
-            }
-        }
-        else {
-            OUTMSG(("%s %,ld                                     \r", acc, sz));
-        }
-    }
-    else {
-        OUTMSG(("                                                \r%s\r", acc));
-    }
-}
-
-/******************************************************************************/
-rc_t run_ascp(const char *path, const char *key,
-    const char *src, const char *dest, const AscpOptions *opt)
-{
-    const char *host = NULL;
-    const char *user = NULL;
-    const char *maxRate = NULL;
-    bool cache_key = false;
-    uint64_t heartbeat = 0;
-    const char *acc = NULL;
-    uint64_t srcSz = 0;
-    uint64_t id = 0;
-    TProgress *callback = NULL;
-    TQuitting *quitting = NULL;
-    rc_t rc = 0;
-    pid_t nPid = 0;
-    int pipeto[2];      /* pipe to feed the exec'ed program input */
-    int pipefrom[2];    /* pipe to get the exec'ed program output */
-    char *argv[64];
-
-    int i = 0;
-    int ret = 0;
-    i = 0;
-
-    if (opt != NULL) {
-        acc = opt->name;
-        cache_key = opt->cache_key;
-        callback = opt->callback;
-        heartbeat = opt->heartbeat;
-        host = opt->host;
-        id = opt->id;
-        maxRate = opt->target_rate;
-        quitting = opt->quitting;
-        srcSz = opt->src_size;
-        user = opt->user;
-    }
-
-    if (acc == NULL) {
-        acc = dest;
-    }
-
-    if (heartbeat > 0) {
-        heartbeat /= 1000;
-        if (heartbeat == 0) {
-            heartbeat = 1;
-        }
-    }
-
-    if (pipe(pipeto) != 0) {
-        perror("pipe() to");
-        rc = RC(rcExe, rcFileDesc, rcCreating, rcFileDesc, rcFailed);
-        LOGERR(klogErr, rc, "while pipe");
-        return rc;
-    }
-    if (pipe(pipefrom) != 0) {
-        perror("pipe() from");
-        rc = RC(rcExe, rcFileDesc, rcCreating, rcFileDesc, rcFailed);
-        LOGERR(klogErr, rc, "while pipe");
-        return rc;
-    }
-
-    argv[i++] = (char*)path;
-    argv[i++] = "-i";
-    argv[i++] = (char*)key;
-    argv[i++] = "-pQTk1";
-    if (maxRate != NULL) {
-        argv[i++] = "-l";
-        argv[i++] = (char*)maxRate;
-    }
-    if (user != NULL) {
-        argv[i++] = "--user";
-        argv[i++] = (char*)user;
-    }
-    if (host != NULL) {
-        argv[i++] = "--host";
-        argv[i++] = (char*)user;
-    }
-    argv[i++] = (char*)src;
-    argv[i++] = (char*)dest;
-    argv[i++] = NULL;
-
-    logevp(path, argv);
-
-    if (quitting) {
-        rc = quitting();
-    }
-    if (rc != 0) {
-        return rc;
-    }
-
-    nPid = fork();
-    if (nPid < 0 ) {
-        perror("fork() 1");
-        rc = RC(rcExe, rcProcess, rcCreating, rcProcess, rcFailed);
-        LOGERR(klogErr, rc, "after fork");
-        return rc;
-    }
-    else if (nPid == 0) {
-        /* dup pipe read/write to stdin/stdout */
-        dup2(pipeto  [0], STDIN_FILENO);
-        dup2(pipefrom[1], STDOUT_FILENO);
-        dup2(pipefrom[1], STDERR_FILENO);
-        close(pipeto[1]);
-        ret = execvp(path, argv);
-        STSMSG(STS_DBG, ("CHILD: Done %s %s %s = %d", path, src, dest, ret));
-        exit(EXIT_FAILURE);
-    }
-    else {
-        bool progressing = false;
-        bool writeFailed = false;
-        EAscpState state = eStart;
-        const char y[] = "y\n";
-        const char n[] = "n\n";
-        int status = 0;
-        int w = 0;
-        int fd = pipefrom[0];
-        const char *answer = n;
-        String line;
-        StringInit(&line, NULL, 0, 0);
-        if (cache_key) {
-            answer = y;
-        }
-
-        {
-            int flags = fcntl(fd, F_GETFL, 0);
-            fcntl(fd, F_SETFL, flags | O_NONBLOCK);
-        }
-
-        close(pipeto[0]);
-        close(pipefrom[1]);
-        assert(sizeof y == sizeof n);
-
-        {
-            int hang = 0;
-            uint64_t prev = 0;
-            KTime_t tPrev = 0;
-            char sfSrc = 'B';
-            uint64_t hSrc = humanize(srcSz, &sfSrc, NULL);
-            int sig = 0;
-            uint64_t i = 0;
-            KDirectory *dir = NULL;
-            rc_t rc = KDirectoryNativeDir(&dir);
-            DISP_RC(rc, "KDirectoryNativeDir");
-            if (rc != 0) {
-                return rc;
-            }
-            while (w == 0) {
-                bool quit = false;
-                w = waitpid(nPid, &status, WNOHANG);
-                if (w == 0) {
-                    bool got = false;
-                    rc_t rc = 0;
-                    if (quitting) {
-                        rc = quitting();
-                    }
-                    if (rc != 0 || quit) {
-                        if (sig == 0) {
-                            sig = SIGINT;
-                        }
-                        else if (sig >= SIGKILL) {
-                            break;
-                        }
-                        else {
-                            ++sig;
-                        }
-                        if (progressing) {
-                            OUTMSG(("\n"));
-                        }
-                        PLOGMSG(klogInfo, (klogInfo, "^C pressed: "
-                            "Senging $(sgn) to ascp", "sgn=%s", sig));
-                        kill(nPid, sig);
-                    }
-                    while (true) {
-                        char buf[4096];
-                        int s = read(fd, buf, sizeof buf);
-                        if (s == 0) {
-                            break;
-                        }
-                        else if (s < 0) {
-                            if (errno != EAGAIN) {
-                                if (progressing) {
-                                    OUTMSG(("\n"));
-                                }
-                                perror("read(child)");
-                            }
-                            break;
-                        }
-                        ascpParse(buf, s, dest, &state, &line);
-                        switch (state) {
-                            case eKeyEnd:
-                                write(pipeto[1], answer, sizeof y - 1);
-                                break;
-                            case eWriteFailed:
-                                writeFailed = true;
-                                break;
-                            default:
-                                break;
-                        }
-                        got = true;
-                    }
-                    if (!got) {
-                        sleep(1);
-                        ++i;
-                        if ((heartbeat > 0 && i >= heartbeat) || (i > 99)) {
-                            uint64_t size = 0;
-                            rc_t rc = KDirectoryFileSize(dir, &size, dest);
-                            if (rc != 0) {
-                                size = 0;
-                            }
-                            else {
-                                if (size != prev) {
-                                   prev = size;
-                                   tPrev = 0;
-                                   hang = 0;
-                                }
-                                else {
-                                    KTime_t date = 0;
-                                    rc_t rc = KDirectoryDate(dir, &date, dest);
-                                    if (rc == 0) {
-                                        tPrev = date;
-                                        if ((KTimeStamp() - date) > 60 * 99) {
-                                            /* no file update during 99' */
-                                            if (hang == 0) {
-                                                write(pipeto[1],
-                                                    answer, sizeof y - 1);
-                                                ++hang;
-                                            }
-                                            else if (hang < 9) {
-                                                ++hang;
-                                                sig = 0;
-                                            }
-                                            else {
-                                                if (sig == 0) {
-                                                    sig = SIGINT;
-                                                }
-                                                else {
-                                                    ++sig;
-                                                }
-                                                if (progressing) {
-                                                   OUTMSG(("\n"));
-                                                }
-                                                if (sig > SIGKILL) {
-                                                   rc = RC(rcExe,
-                                                       rcProcess, rcExecuting,
-                                                       rcProcess,rcDetached);
-                                                   return rc;
-                                                }
-
-                                                PLOGMSG(klogInfo, (klogInfo,
-                                                    "Senging $(sgn) to ascp",
-                                                    "sgn=%s", sig));
-                                                kill(nPid, sig);
-                                            }
-                                        }
-                                    }
-                                }
-                            }
-                            if (heartbeat > 0) {
-                                if (callback) {
-                                    quit = !callback(id,
-                                        eAscpStateRunning, size, 0);
-                                }
-                                else {
-                                    progress(acc, size, srcSz, hSrc, sfSrc,
-                                        tPrev);
-                                }
-                                progressing = true;
-                            }
-                            i = 0;
-                        }
-                    }
-                }
-            }
-            RELEASE(KDirectory, dir);
-        }
-
-        if (progressing) {
-            OUTMSG(("\n"));
-        }
-
-        while (1) {
-            char buf[4096];
-            int s = read(fd, buf, sizeof buf);
-            if (s == 0) {
-                break;
-            }
-            else if (s < 0) {
-                if (errno != EAGAIN) {
-                    perror("read(child)");
-                    break;
-                }
-                continue;
-            }
-            ascpParse(buf, s, dest, &state, &line);
-            if (state == eWriteFailed) {
-                writeFailed = true;
-            }
-        }
-        STSMSG(    STS_DBG, ("ascp exited with pid=%d status=%d", w, status));
-        if (WIFEXITED(status)) {
-            STSMSG(STS_DBG, ("ascp exited with exit status %d",
-                WEXITSTATUS(status)));
-        }
-        else {
-            STSMSG(STS_DBG, ("ascp has not terminated correctly"));
-        }
-        if (w == -1) {
-            perror("waitpid");
-            rc = RC(rcExe, rcProcess, rcWaiting, rcProcess, rcFailed);
-            LOGERR(klogErr, rc, "after waitpid");
-            exit(EXIT_FAILURE);
-        }
-        if (WIFEXITED(status)) {
-    	    if (WEXITSTATUS(status) == 0) {
-	            STSMSG(STS_DBG, ("ascp succeed"));
-                if (callback) {
-                    callback(id, eAscpStateExitSuccess, 0, 0);
-                }
-            } else if (writeFailed) {
-                rc = RC(rcExe, rcProcess, rcExecuting, rcMemory, rcExhausted);
-                if (callback) {
-                    callback(id, eAscpStateExitWriteFailure, 0, 0);
-                }
-            }
-            else {
-                if (rc == 0) {
-                    rc = RC(rcExe, rcProcess, rcWaiting, rcProcess, rcFailed);
-                }
-                PLOGERR(klogErr, (klogErr, rc,
-                    "ascp failed with $(ret)", "ret=%d", WEXITSTATUS(status)));
-                if (callback) {
-                    callback(id, eAscpStateExitFailure, 0, 0);
-                }
-            }
-        } else if (WIFSIGNALED(status)) {
-            if (rc == 0) {
-                if (quitting) {
-                    rc = quitting();
-                    if (rc == 0) {
-                        rc = RC(rcExe,
-                            rcProcess, rcWaiting, rcProcess, rcFailed);
-                    }
-                }
-            }
-            if (rc != SILENT_RC(rcExe, rcProcess, rcExecuting,
-                rcProcess, rcCanceled))
-            {
-                PLOGERR(klogErr, (klogErr, rc, "ascp killed by signal $(sig)",
-                    "sig=%d", WTERMSIG(status)));
-                if (callback) {
-                    callback(id, eAscpStateExitFailure, 0, 0);
-                }
-            }
-        }
-    }
-    return rc;
-}
-
-int silent_system(const char *command) {
-    int ret = 0;
-
-    int oldOut = 0;
-    int youngOut = 0;
-    int oldErr = 0;
-    int youngErr = 0;
-
-    fflush(stdout);
-    oldOut = dup(STDOUT_FILENO);
-    youngOut = open("/dev/null", O_WRONLY);
-    dup2(youngOut, STDOUT_FILENO);
-    close(youngOut);
-
-    fflush(stderr);
-    oldErr = dup(STDERR_FILENO);
-    youngErr = open("/dev/null", O_WRONLY);
-    dup2(youngErr, STDERR_FILENO);
-    close(youngErr);
-
-    ret = system(command);
-
-    fflush(stdout);
-    dup2(oldOut, STDOUT_FILENO);
-    close(oldOut);    
-
-    fflush(stderr);
-    dup2(oldErr, STDERR_FILENO);
-    close(oldErr);    
-
-    return ret;
-}
diff --git a/libs/ascp/win/ascp-path.c b/libs/ascp/win/ascp-path.c
deleted file mode 100644
index bb1e144..0000000
--- a/libs/ascp/win/ascp-path.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#include "ascp-priv.h" /* ascp_path */
-#include <assert.h>
-
-bool ascp_path(const char **cmd, const char **key) {
-    static int idx = 0;
-    static const char *c[] = {
-        "C:\\Program Files (x86)\\Aspera\\Aspera Connect\\bin\\ascp.exe",
-        "C:\\Program Files\\Aspera\\Aspera Connect\\bin\\ascp.exe"
-    };
-    static const char *k[] = {
- "C:\\Program Files (x86)\\Aspera\\Aspera Connect\\etc\\asperaweb_id_dsa.putty",
- "C:\\Program Files\\Aspera\\Aspera Connect\\etc\\asperaweb_id_dsa.putty"
-    };
-    assert(cmd && key && sizeof c / sizeof c[0] == sizeof k / sizeof k[0]);
-    if (idx < sizeof c / sizeof c[0]) {
-        *cmd = c[idx];
-        *key = k[idx];
-        ++idx;
-        return true;
-    }
-    else {
-        *cmd =  *key = NULL;
-        idx = 0;
-        return false;
-    }
-}
diff --git a/libs/ascp/win/connect.c b/libs/ascp/win/connect.c
deleted file mode 100644
index 301cf79..0000000
--- a/libs/ascp/win/connect.c
+++ /dev/null
@@ -1,510 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include "ascp-priv.h" /* STS_DBG */
-
-#include <kfs/directory.h> /* KDirectory */
-#include <kfs/impl.h> /* KSysDir */
-#include <kfs/kfs-priv.h> /* KDirectoryPosixStringToSystemString */
-
-#include <klib/log.h> /* LOGERR */
-#include <klib/out.h> /* OUTMSG */
-#include <klib/printf.h> /* string_printf */
-#include <klib/rc.h>
-#include <klib/status.h> /* STSMSG */
-
-#include <Windows.h>
-
-#include <assert.h>
-#include <stdio.h> /* stderr */
-
-#define RELEASE(type, obj) do { rc_t rc2 = type##Release(obj); \
-    if (rc2 && !rc) { rc = rc2; } obj = NULL; } while (false)
-
-#define STS_FIN 3
-
-static void beat(uint64_t heartbeat, bool flush) {
-    static int i = 0;
-    static char c = '1';
-    return;
-    if (heartbeat == 0) {
-        return;
-    }
-    if (flush) {
-        fprintf(stderr, "\n");
-/*      fflush(stderr); */
-        return;
-    }
-    fprintf(stderr, "%c", c);
-    if (++i >= 60) {
-        fprintf(stderr,
-            "\r                                                            \r");
-        i = 0;
-        ++c;
-        switch (c) {
-            case ':':
-                c = 'A';
-                break;
-            case '[':
-                c = 'a';
-                break;
-            case 127:
-                c = '!';
-                break;
-        }
-    }
-}
-
-static rc_t mkAscpCommand(char *buffer, size_t len,
-    const char *path, const char *key,
-    const char *src, const char *dest, const AscpOptions *opt)
-{
-    KDirectory *dir = NULL;
-    const char *maxRate = NULL;
-    const char *host = NULL;
-    const char *user = NULL;
-    size_t num_writ = 0;
-
-    size_t pos = 0;
-
-    char system[MAX_PATH] = "";
-
-    rc_t rc = KDirectoryNativeDir(&dir);
-    if (rc != 0) {
-        return rc;
-    }
-
-    rc = KDirectoryPosixStringToSystemString(dir, system, sizeof system, dest);
-    if (rc == 0) {
-        if (opt != NULL) {
-            host = opt->host;
-            maxRate = opt->target_rate;
-            user = opt->user;
-        }
-
-        rc = string_printf(buffer, len, &num_writ,
-            "\"%s\" -i \"%s\" -pQTk1%s%s%s%s%s%s %s %s",
-            path, key,
-            maxRate == NULL ? "" : " -l", maxRate == NULL ? "" : maxRate,
-            host == NULL ? "" : " --host ", host == NULL ? "" : host,
-            user == NULL ? "" : " --user ", user == NULL ? "" : host,
-            src, system);
-        if (rc != 0) {
-            LOGERR(klogInt, rc, "while creating ascp command line");
-        }
-        else {
-            assert(num_writ < len);
-        }
-    }
-
-    RELEASE(KDirectory, dir);
-
-    return rc;
-}
-
-static int execute(const char *command, uint64_t heartbeat,
-    bool cacheKey, bool *writeFailed, bool *canceled,
-    const char *name, TQuitting *quitting)
-{
-    DWORD exitCode = STILL_ACTIVE;
-    HANDLE g_hChildStd_IN_Rd = NULL;
-    HANDLE g_hChildStd_IN_Wr = NULL;
-    HANDLE g_hChildStd_OUT_Rd = NULL;
-    HANDLE g_hChildStd_OUT_Wr = NULL;
-    SECURITY_ATTRIBUTES saAttr; 
-    BOOL bSuccess = FALSE;
-    PROCESS_INFORMATION pi;
-    STARTUPINFO si;
-
-    assert(writeFailed && canceled);
-    *writeFailed = false;
-
-    STSMSG(STS_INFO, ("Starting %s ", command));
-
-    saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); 
-    saAttr.bInheritHandle = TRUE; 
-    saAttr.lpSecurityDescriptor = NULL; 
-
-    // Create a pipe for the child process's STDOUT. 
-    if (!CreatePipe(&g_hChildStd_OUT_Rd, &g_hChildStd_OUT_Wr, &saAttr,
-        0))
-    {
-        rc_t rc = RC(rcExe, rcFileDesc, rcCreating, rcFileDesc, rcFailed);
-        LOGERR(klogErr, rc, "Stdout CreatePipe");
-        return 1;
-    }
-
-    // Ensure the read handle to the pipe for STDOUT is not inherited.
-    if (!SetHandleInformation(g_hChildStd_OUT_Rd, HANDLE_FLAG_INHERIT,
-        0))
-    {
-        rc_t rc = RC(rcExe, rcFileDesc, rcCreating, rcFileDesc, rcFailed);
-        LOGERR(klogErr, rc, "Stdout SetHandleInformation");
-        return 1;
-    }
-
-    // Create a pipe for the child process's STDIN. 
-    if (!CreatePipe(&g_hChildStd_IN_Rd, &g_hChildStd_IN_Wr, &saAttr,
-        0))
-    {
-        puts("Stdin CreatePipe");
-        return 1;
-    }
-
-    // Ensure the write handle to the pipe for STDIN is not inherited.  
-    if (!SetHandleInformation(g_hChildStd_IN_Wr, HANDLE_FLAG_INHERIT,
-        0))
-    {
-        puts("Stdin SetHandleInformation");
-        return 1;
-    }
-
-    // Set up members of the PROCESS_INFORMATION structure. 
-    ZeroMemory(&pi, sizeof(pi)); 
-
-    // Set up members of the STARTUPINFO structure. 
-    // This structure specifies the STDIN and STDOUT handles for redirection.
-    ZeroMemory(&si, sizeof(si));
-    si.cb = sizeof(si);
-    si.hStdError = g_hChildStd_OUT_Wr;
-    si.hStdOutput = g_hChildStd_OUT_Wr;
-    si.hStdInput = g_hChildStd_IN_Rd;
-    si.dwFlags |= STARTF_USESTDHANDLES;
-
-    bSuccess = CreateProcess(
-        NULL,//_In_opt_ LPCTSTR              lpApplicationName,
-        (char*)command,//_Inout_opt_  LPTSTR lpCommandLine, command line 
-        NULL,//_In_opt_ LPSECURITY_ATTRIBUTES process security attributes 
-        NULL,//_In_opt_ LPSECURITY_ATTRIBUTES primary thread security attributes
-        TRUE,//_In_     BOOL                  handles are inherited 
-        0,   //_In_     DWORD                 creation flags 
-        NULL,//_In_opt_ LPVOID                use parent's environment 
-        NULL,//_In_opt_ LPCTSTR               use parent's current directory 
-        &si, //_In_     LPSTARTUPINFO         STARTUPINFO pointer 
-        &pi  //_Out_    LPPROCESS_INFORMATION receives PROCESS_INFORMATION 
-    );
-    if (bSuccess) {
-        bool progressing = false;
-        EAscpState state = eStart;
-        const char y[] = "y\r\n";
-        const char n[] = "n\r\n";
-        const char *answer = cacheKey ? y : n;
-        bool first = true;
-        CHAR chBuf[4096];
-        DWORD dwRead = 0;
-        DWORD dwWritten = 0;
-        DWORD dwFileSize = 0;
-        HANDLE hParentStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
-        DWORD dwMilliseconds = 1000;
-        DWORD dwMillisecondsRemains = 1000;
-        String line;
-        StringInit(&line, NULL, 0, 0);
-        if (heartbeat > 0) {
-            dwMillisecondsRemains = (DWORD)heartbeat;
-        }
-        // Write to the pipe that is the standard input for a child process. 
-        // Data is written to the pipe's buffers, so it is not necessary to wait
-        // until the child process is running before writing data.
-        assert(sizeof y == sizeof n);
-        bSuccess = WriteFile(g_hChildStd_IN_Wr, answer, sizeof y - 1,
-            &dwWritten, NULL);
-        if (!bSuccess) {
-            puts("failed to write to child's Stdin");
-            return 1;
-        }
-        if (!CloseHandle(g_hChildStd_IN_Wr)) {
-            puts("StdInWr CloseHandle");
-            return 1;
-        }
-        CloseHandle(pi.hThread);
-
-        // Successfully created the process.  Wait for it to finish.
-        while (true) {
-            char noprogress[] = "\r                                "
-                "                                               \r";
-            if (exitCode != STILL_ACTIVE) {
-/*                  printf(">>GetExitCodeProcess = %d\n", exitCode); */
-            }
-            bSuccess = GetExitCodeProcess(pi.hProcess, &exitCode);
-            if (exitCode != STILL_ACTIVE) {
-/*                  printf(">>GetExitCodeProcess = %d\n", exitCode); */
-            }
-            if (!bSuccess) {
-                rc_t rc = RC(rcExe,
-                    rcProcess, rcExecuting, rcProcess, rcFailed);
-                if (progressing) {
-                    WriteFile(hParentStdOut, noprogress, sizeof noprogress - 1,
-                        &dwWritten, NULL);
-                }
-                LOGERR(klogErr, rc,
-                    "Executed command, couldn't get exit code");
-                return 1;
-            }
-            if (exitCode == STILL_ACTIVE) {
-                if (first) {
-                    first = false;
-                }
-                else {
-                    if (STS_DBG > KStsLevelGet()) {
-                        beat(heartbeat, false);
-                    }
-                }
-                WaitForSingleObject(pi.hProcess, dwMilliseconds);
-                dwFileSize = GetFileSize(g_hChildStd_OUT_Rd,  NULL);
-                if (dwFileSize > 0) {
-                    STSMSG(STS_FIN + 1,
-                        ("GetFileSize(ChildStdOut) = %d", dwFileSize));
-                }
-                while (dwFileSize > 0) {
-                    bSuccess = ReadFile(g_hChildStd_OUT_Rd,
-                        chBuf, sizeof chBuf, &dwRead, NULL);
-                    if (!bSuccess) {
-                        if (progressing) {
-                            WriteFile(hParentStdOut, noprogress,
-                                sizeof noprogress - 1, &dwWritten, NULL);
-                        }
-                        break;
-                    }
-                    ascpParse(chBuf, dwRead, name, &state, &line);
-                    if (state == eWriteFailed) {
-                        *writeFailed = true;
-                    }
-                    else if (state == eProgress) {
-                        if (heartbeat > 0) {
-                            if (dwMillisecondsRemains > dwMilliseconds) {
-                                dwMillisecondsRemains -= dwMilliseconds;
-                            }
-                            else {
-                                const char *p = chBuf;
-                                size_t l = dwRead;
-                                if (line.addr != NULL && line.len != 0) {
-                                    p = line.addr;
-                                    l = line.len;
-                                    WriteFile(hParentStdOut, "\r", 1,
-                                        &dwWritten, NULL);
-                                    bSuccess = WriteFile(hParentStdOut, p,
-                                        (DWORD)l, &dwWritten, NULL);
-                                    dwMillisecondsRemains = (DWORD)heartbeat;
-                                    progressing = true;
-                                }
-                            }
-                        }
-                    }
-/*                      OUTMSG(("%.*s", dwRead, chBuf)); */
-                    if (STS_DBG <= KStsLevelGet()) {
-                        if (KStsMsg("%.*s", dwRead, chBuf) != 0) {
-                            bSuccess = WriteFile(hParentStdOut, chBuf,
-                                dwRead, &dwWritten, NULL);
-                        }
-                    }
-                    dwFileSize = GetFileSize(g_hChildStd_OUT_Rd,  NULL);
-                    if (dwFileSize > 0) {
-                        STSMSG(STS_FIN + 1,
-                            ("GetFileSize(ChildStdOut) = %d", dwFileSize));
-                    }
-                }
-            }
-            else {
-                if (STS_DBG > KStsLevelGet()) {
-//                  beat(heartbeat, true);
-                }
-                if (progressing) {
-                    WriteFile(hParentStdOut, noprogress,
-                        sizeof noprogress - 1, &dwWritten, NULL);
-                }
-                break;
-            }
-            if (quitting != NULL) {
-                rc_t rc = quitting();
-                if (rc != 0) {
-                    if (progressing) {
-                        WriteFile(hParentStdOut, noprogress,
-                            sizeof noprogress - 1, &dwWritten, NULL);
-                    }
-                    *canceled = true;
-                    break;
-                }
-            }
-        }
-        if (!*canceled) {
-            WaitForSingleObject(pi.hProcess, INFINITE);
-
-        // Get the exit code.
-/*      printf(">GetExitCodeProcess = %d\n", exitCode); */
-            bSuccess = GetExitCodeProcess(pi.hProcess, &exitCode);
-            if (!bSuccess) {
-                rc_t rc = RC(rcExe,
-                    rcProcess, rcExecuting, rcProcess, rcFailed);
-                LOGERR(klogErr,
-                    rc, "Executed command but couldn't get exit code");
-                return 1;
-            }
-        }
-/*      printf("<GetExitCodeProcess = %d\n", exitCode); */
-
-        CloseHandle(pi.hProcess);
-
-        if (exitCode != 0 && STS_DBG > KStsLevelGet()) {
-            if (KStsMsg("%.*s", dwRead, chBuf) != 0) {
-                bSuccess = WriteFile(hParentStdOut, chBuf,
-                    dwRead, &dwWritten, NULL);
-            }
-        }
-        if (dwFileSize > 0) {
-            STSMSG(STS_FIN, ("GetFileSize(ChildStdOut) = %d", dwFileSize));
-        }
-        while (dwFileSize > 0) { 
-            bSuccess = ReadFile(g_hChildStd_OUT_Rd,
-                chBuf, sizeof chBuf, &dwRead, NULL);
-            if (!bSuccess || dwRead == 0) {
-                break; 
-            }
-            ascpParse(chBuf, dwRead, name, &state, &line);
-            if (state == eWriteFailed) {
-                *writeFailed = true;
-            }
-            dwFileSize = GetFileSize(g_hChildStd_OUT_Rd,  NULL);
-            if (dwFileSize > 0) {
-                STSMSG(STS_FIN, ("GetFileSize(ChildStdOut) = %d", dwFileSize));
-            }
-        }
-
-        return exitCode;
-    }
-    else {
-        return GetLastError();
-    }
-}
-
-rc_t run_ascp(const char *path, const char *key,
-    const char *src, const char *dest, const AscpOptions *opt)
-{
-    rc_t rc = 0;
-    uint64_t heartbeat = 0;
-    char buffer[MAX_PATH * 3] = "";
-    bool writeFailed = false;
-    TQuitting *quitting = NULL;
-
-    if (opt != NULL) {
-        heartbeat = opt->heartbeat;
-        quitting = opt->quitting;
-    }
-
-    rc = mkAscpCommand(buffer, sizeof buffer, path, key, src, dest, opt);
-    if (rc == 0) {
-        bool cacheKey = false;
-        if (opt != NULL && opt->cache_key) {
-            cacheKey = true;
-        }
-        {
-            int value = 0;
-            bool canceled = false;
-            const char *name = strrchr(dest, '/');
-            if (name == NULL) {
-                name = dest;
-            }
-            else {
-                if (*(name + 1) != '\0') {
-                    ++name;
-                }
-                else {
-                    name = dest;
-                }
-            }
-            value = execute(buffer, heartbeat, cacheKey,
-                &writeFailed, &canceled, name, quitting);
-            if (value != 0) {
-                if (writeFailed) {
-                    rc = RC(rcExe, rcProcess, rcExecuting,
-                        rcMemory, rcExhausted);
-                }
-                else {
-                    rc = RC(rcExe, rcProcess, rcExecuting, rcProcess, rcFailed);
-                }
-            }
-            if (value == 0 && rc == 0 && canceled && quitting != NULL) {
-                rc = quitting();
-            }
-        }
-    }
-
-    return rc;
-}
-
-int silent_system(const char *command) {
-    HANDLE g_hChildStd_OUT_Rd = NULL;
-    HANDLE g_hChildStd_OUT_Wr = NULL;
-    BOOL bSuccess = FALSE;
-    PROCESS_INFORMATION pi;
-    STARTUPINFO si;
-    SECURITY_ATTRIBUTES saAttr; 
-
-    // Set the bInheritHandle flag so pipe handles are inherited. 
-    saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); 
-    saAttr.bInheritHandle = TRUE; 
-    saAttr.lpSecurityDescriptor = NULL; 
-
-    // Create a pipe for the child process's STDOUT. 
-    if (!CreatePipe(&g_hChildStd_OUT_Rd, &g_hChildStd_OUT_Wr, &saAttr, 0)) {
-        rc_t rc = RC(rcExe, rcFileDesc, rcCreating, rcFileDesc, rcFailed);
-        LOGERR(klogErr, rc, "Stdout CreatePipe");
-        return 1;
-    }
-
-    // Ensure the read handle to the pipe for STDOUT is not inherited.
-    if (!SetHandleInformation(g_hChildStd_OUT_Rd, HANDLE_FLAG_INHERIT, 0)) {
-        rc_t rc = RC(rcExe, rcFileDesc, rcCreating, rcFileDesc, rcFailed);
-        LOGERR(klogErr, rc, "Stdout SetHandleInformation");
-        return 1;
-    }
-
-    ZeroMemory(&pi, sizeof(pi)); 
-
-    ZeroMemory(&si, sizeof(si));
-    si.cb = sizeof(si);
-    si.hStdError = g_hChildStd_OUT_Wr;
-    si.hStdOutput = g_hChildStd_OUT_Wr;
-    si.dwFlags |= STARTF_USESTDHANDLES;
-
-    bSuccess = CreateProcess(
-        NULL,           //_In_opt_    LPCTSTR               lpApplicationName,
-        (char*)command, //_Inout_opt_ LPTSTR                lpCommandLine,
-        NULL,           //_In_opt_    LPSECURITY_ATTRIBUTES lpProcessAttributes,
-        NULL,           //_In_opt_    LPSECURITY_ATTRIBUTES lpThreadAttributes,
-        TRUE,           //_In_        BOOL                  bInheritHandles,
-        0,              //_In_        DWORD                 dwCreationFlags,
-        NULL,           //_In_opt_    LPVOID                lpEnvironment,
-        NULL,           //_In_opt_    LPCTSTR               lpCurrentDirectory,
-        &si,            //_In_        LPSTARTUPINFO         lpStartupInfo,
-        &pi             //_Out_       LPPROCESS_INFORMATION lpProcessInformation
-    );
-    if (bSuccess) {
-        return 0;
-    }
-    else {
-        return GetLastError();
-    }
-}
diff --git a/libs/axf/Makefile b/libs/axf/Makefile
deleted file mode 100644
index 45f0026..0000000
--- a/libs/axf/Makefile
+++ /dev/null
@@ -1,133 +0,0 @@
-# ===========================================================================
-#
-#                            PUBLIC DOMAIN NOTICE
-#               National Center for Biotechnology Information
-#
-#  This software/database is a "United States Government Work" under the
-#  terms of the United States Copyright Act.  It was written as part of
-#  the author's official duties as a United States Government employee and
-#  thus cannot be copyrighted.  This software/database is freely available
-#  to the public for use. The National Library of Medicine and the U.S.
-#  Government have not placed any restriction on its use or reproduction.
-#
-#  Although all reasonable efforts have been taken to ensure the accuracy
-#  and reliability of the software and data, the NLM and the U.S.
-#  Government do not and cannot warrant the performance or results that
-#  may be obtained by using this software or data. The NLM and the U.S.
-#  Government disclaim all warranties, express or implied, including
-#  warranties of performance, merchantability or fitness for any particular
-#  purpose.
-#
-#  Please cite the author in any work or product based on this material.
-#
-# ===========================================================================
-
-
-default: std
-
-TOP ?= $(shell ../../build/abspath.sh ../..)
-MODULE = libs/axf
-
-INT_LIBS = \
-	libaxf \
-	libwaxf
-
-ALL_LIBS = \
-	$(INT_LIBS)
-
-include $(TOP)/build/Makefile.env
-
-#-------------------------------------------------------------------------------
-# outer targets
-#
-all std: makedirs
-	@ $(MAKE_CMD) $(TARGDIR)/std
-
-$(ALL_LIBS): makedirs
-	@ $(MAKE_CMD) $(TARGDIR)/$@
-
-.PHONY: all std $(ALL_LIBS)
-
-#-------------------------------------------------------------------------------
-# std
-#
-$(TARGDIR)/std: \
-	$(addprefix $(TARGDIR)/,$(ALL_LIBS))
-
-.PHONY: $(TARGDIR)/all $(TARGDIR)/std
-
-#-------------------------------------------------------------------------------
-# clean
-#
-clean: stdclean
-
-.PHONY: clean
-
-#-------------------------------------------------------------------------------
-# alignment transform library
-#
-$(TARGDIR)/libaxf: $(addprefix $(ILIBDIR)/libaxf.,$(ILIBEXT))
-
-AXF_SRC = \
-	ref-tbl-sub-select \
-	ref-restore-read \
-	align-restore-read \
-	raw-restore-read \
-	raw-restore-qual \
-	seq-restore-read \
-	seq-construct-read \
-	cigar \
-	project_read_from_sequence \
-	not-my-row \
-	template-len \
-	get-sam-flags \
-	align-ref-pos \
-	align-ref-name \
-	align-ref-seq-id \
-	align-local_ref_id \
-	align-local_ref_start \
-	generate-mismatch-qual \
-	mismatch-restore-qual \
-	ref-preserve_qual \
-	ref-tbl \
-	make-cmp-read_desc \
-	get_mate_align_ids
-
-AXF_OBJ = \
-	$(addsuffix .$(LOBX),$(AXF_SRC))
-
-AXF_LIB = \
-	-lalign-reader \
-	-dvdb \
-	-dkdb \
-	-dklib \
-	-dm \
-	-dz
-
-$(ILIBDIR)/libaxf.$(LIBX): $(AXF_OBJ)
-	$(LD) --slib -o $@ $^ $(AXF_LIB)
-
-
-#-------------------------------------------------------------------------------
-# alignment transform update library
-#
-$(TARGDIR)/libwaxf: $(addprefix $(ILIBDIR)/libwaxf.,$(ILIBEXT))
-
-WAXF_SRC = \
-	$(AXF_SRC) \
-	refseq-stats
-
-WAXF_OBJ = \
-	$(addsuffix .$(LOBX),$(WAXF_SRC))
-
-WAXF_LIB = \
-	-lalign-reader \
-	-dwvdb \
-	-dwkdb \
-	-lkfg \
-	-dklib \
-	-dm \
-	-dz
-
-$(ILIBDIR)/libwaxf.$(LIBX): $(WAXF_OBJ)
-	$(LD) --slib -o $@ $^ $(WAXF_LIB)
diff --git a/libs/axf/align-local_ref_id.c b/libs/axf/align-local_ref_id.c
deleted file mode 100644
index 97f8efb..0000000
--- a/libs/axf/align-local_ref_id.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-
-#include <vdb/xform.h>
-#include <vdb/database.h>
-#include <vdb/table.h>
-#include <vdb/cursor.h>
-#include <vdb/vdb-priv.h>
-#include <insdc/insdc.h>
-#include <klib/data-buffer.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <bitstr.h>
-
-#include "ref-tbl.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-typedef struct LocalRefID LocalRefID;
-struct LocalRefID
-{
-    uint32_t max_seq_len;
-};
-
-static
-void CC LocalRefIDWhack ( void *obj )
-{
-    LocalRefID * self = obj;
-    if ( self != NULL )
-    {
-        free ( self );
-    }
-}
-
-static
-rc_t LocalRefIDMake ( LocalRefID **objp, const VTable *tbl, const VCursor *native_curs)
-{
-    rc_t rc;
-    /* create the object */
-    LocalRefID *obj = malloc ( sizeof * obj );
-    if ( obj == NULL ) {
-        rc = RC ( rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted );
-    } else {
-	const VCursor *curs=NULL;
-	 /* open the reference table cursor*/
-	if( (rc = AlignRefTableCursor(tbl, native_curs, &curs, NULL)) == 0 ){
-		uint32_t itmp;
-                if(  (rc = VCursorAddColumn(curs, &itmp, "(U32)MAX_SEQ_LEN")) == 0 || GetRCState(rc) == rcExists)  {
-                    const void *base;
-                    uint32_t row_len;
-                    rc = VCursorCellDataDirect(curs, 1, itmp, NULL, &base, NULL, &row_len);
-                    if(rc == 0) {
-                        assert(row_len == 1);
-                        memcpy(&obj->max_seq_len, base, 4);
-                    }
-                }
-                if( GetRCObject(rc) == rcColumn && GetRCState(rc) == rcNotFound ) {
-                    obj->max_seq_len = 0;
-                    rc = 0;
-                }
-		VCursorRelease(curs);
-		if(rc == 0){
-			*objp = obj;
-			return 0;
-		}
-	}
-        free ( obj );
-    }
-    return rc;
-}
-
-/*
- function I64 NCBI:align:local_ref_id ( U64 global_ref_start )
- */
-static
-rc_t CC align_local_ref_id ( void *data, const VXformInfo *info, void *Dst, const void *Src, uint64_t elem_count )
-{
-    LocalRefID const *self = (void const *)data;
-    int64_t *dst=(int64_t*)Dst;
-    uint64_t const *global_ref_start = Src; 
-    uint64_t i;
-
-    for (i = 0; i != elem_count; ++i) {
-        dst[i] = global_ref_start[i] / self->max_seq_len + 1;
-    }
-    return 0;
-}
-
-VTRANSFACT_IMPL ( NCBI_align_local_ref_id, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    LocalRefID *fself;
-    rc_t rc = LocalRefIDMake ( & fself, info -> tbl,  (const VCursor*)info->parms );
-    if ( rc == 0 )
-    {
-        rslt -> self = fself;
-        rslt -> whack = LocalRefIDWhack;
-        rslt -> u . af = align_local_ref_id;
-        rslt -> variant = vftArray;
-    }
-
-    return rc;
-}
diff --git a/libs/axf/align-local_ref_start.c b/libs/axf/align-local_ref_start.c
deleted file mode 100644
index 6b37120..0000000
--- a/libs/axf/align-local_ref_start.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-
-#include <vdb/xform.h>
-#include <vdb/database.h>
-#include <vdb/table.h>
-#include <vdb/cursor.h>
-#include <vdb/vdb-priv.h>
-#include <insdc/insdc.h>
-#include <klib/data-buffer.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <bitstr.h>
-
-#include "ref-tbl.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-typedef struct LocalRefStart LocalRefStart;
-struct LocalRefStart
-{
-    uint32_t max_seq_len;
-};
-
-static
-void CC LocalRefStartWhack ( void *obj )
-{
-    LocalRefStart * self = obj;
-    if ( self != NULL )
-    {
-        free ( self );
-    }
-}
-
-static
-rc_t LocalRefStartMake ( LocalRefStart **objp, const VTable *tbl, const VCursor *native_curs )
-{
-    rc_t rc;
-
-    /* create the object */
-    LocalRefStart *obj = malloc ( sizeof * obj );
-    if ( obj == NULL ) {
-        rc = RC ( rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted );
-    } else {
-	const VCursor *curs=NULL;
-         /* open the reference table cursor*/
-        if( (rc = AlignRefTableCursor(tbl, native_curs, &curs, NULL)) == 0 ){
-                uint32_t itmp;
-                if(  (rc = VCursorAddColumn(curs, &itmp, "(U32)MAX_SEQ_LEN")) == 0 || GetRCState(rc) == rcExists)  {
-                    const void *base;
-                    uint32_t row_len;
-                    rc = VCursorCellDataDirect(curs, 1, itmp, NULL, &base, NULL, &row_len);
-                    if(rc == 0) {
-                        assert(row_len == 1);
-                        memcpy(&obj->max_seq_len, base, 4);
-                    }
-                }
-                if( GetRCObject(rc) == rcColumn && GetRCState(rc) == rcNotFound ) {
-                    obj->max_seq_len = 0;
-                    rc = 0;
-                }
-                VCursorRelease(curs);
-                if(rc == 0){
-                        *objp = obj;
-                        return 0;
-                }
-        }
-        free ( obj );
-    }
-    return rc;
-}
-
-/*
- function INSDC:coord:zero NCBI:align:local_ref_start ( U64 global_ref_start )
- */
-static
-rc_t CC align_local_ref_start ( void *data, const VXformInfo *info, void *Dst, const void *Src, uint64_t elem_count )
-{
-    LocalRefStart const *self = (void const *)data;
-    INSDC_coord_zero *dst=Dst;
-    uint64_t const *global_ref_start = Src;
-    unsigned i;
-    
-    for (i = 0; i != elem_count; ++i) {
-        dst[i] = global_ref_start[i] % self->max_seq_len;
-    }
-    return 0;
-}
-
-VTRANSFACT_IMPL ( NCBI_align_local_ref_start, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    LocalRefStart *fself;
-    rc_t rc = LocalRefStartMake ( & fself, info -> tbl, (const VCursor*)info->parms  );
-    if ( rc == 0 )
-    {
-        rslt -> self = fself;
-        rslt -> whack = LocalRefStartWhack;
-        rslt -> u . af = align_local_ref_start;
-        rslt -> variant = vftArray;
-    }
-
-    return rc;
-}
diff --git a/libs/axf/align-ref-name.c b/libs/axf/align-ref-name.c
deleted file mode 100644
index ce7fc21..0000000
--- a/libs/axf/align-ref-name.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-
-#include <vdb/xform.h>
-#include <vdb/database.h>
-#include <vdb/table.h>
-#include <vdb/cursor.h>
-#include <vdb/vdb-priv.h>
-#include <insdc/insdc.h>
-#include <klib/data-buffer.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <bitstr.h>
-
-#include "ref-tbl.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-typedef struct RefName RefName;
-struct RefName
-{
-    const VCursor *curs;
-    uint32_t name_idx;
-};
-
-static
-void CC RefNameWhack ( void *obj )
-{
-    RefName * self = obj;
-    if ( self != NULL )
-    {
-        VCursorRelease ( self -> curs );
-        free ( self );
-    }
-}
-
-static
-rc_t RefNameMake ( RefName **objp, const VTable *tbl, const VCursor *native_curs )
-{
-    rc_t rc;
-
-    /* create the object */
-    RefName *obj = malloc ( sizeof * obj );
-    if ( obj == NULL ) {
-        rc = RC ( rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted );
-    } else {
-	obj->curs=NULL;
-        /* open the reference cursor */
-	rc = AlignRefTableCursor(tbl, native_curs, &obj->curs, NULL);
-	if(rc == 0){
-                /* add columns to cursor */
-		rc = VCursorAddColumn(obj->curs, &obj->name_idx, "(utf8)REF_NAME");
-		if( GetRCObject(rc) == rcColumn && GetRCState(rc) == rcNotFound ) {
-			rc = VCursorAddColumn(obj->curs, &obj->name_idx, "(utf8)NAME");
-		}
-		if(GetRCState(rc) == rcExists){
-			rc = 0;
-		}
-                if( rc == 0 ) {
-                    *objp = obj;
-                    return 0;
-                }
-                VCursorRelease ( obj -> curs );
-        }
-        free ( obj );
-    }
-    return rc;
-}
-
-enum align_ref_name_args {
-    REF_ID
-};
-
-/*
- function ascii NCBI:align:ref_name ( I64 ref_id );
-*/
-static
-rc_t CC align_ref_name ( void *data, const VXformInfo *info,
-    int64_t row_id, VRowResult *rslt, uint32_t argc, const VRowData argv[] )
-{
-    rc_t rc;
-    RefName const *self = (void const *)data;
-    char const *name = NULL;
-    uint32_t name_len;
-
-    /* get start and length of reference segment */
-    int64_t const *ref_id = argv[REF_ID].u.data.base;
-
-    if (argv[REF_ID].u.data.elem_count == 0)
-        rc = RC(rcAlign, rcFunction, rcExecuting, rcRow, rcNotFound);
-    else {
-        assert(argv[REF_ID].u.data.elem_bits == sizeof(*ref_id) * 8);
-        
-        ref_id += argv[REF_ID].u.data.first_elem;
-        
-        rc = VCursorCellDataDirect(self->curs, ref_id[0], self->name_idx, NULL, (void const **)&name, NULL, &name_len);
-    }
-    
-    if (GetRCState(rc) == rcNotFound && GetRCObject(rc) == rcRow) {
-        name = "";
-        name_len = 0;
-    }
-    else if (rc) return rc;
-    
-    rc = KDataBufferCast(rslt->data, rslt->data, sizeof(name[0]) * 8, true);
-    if (rc) return rc;
-
-    rc = KDataBufferResize(rslt->data, name_len);
-    if (rc) return rc;
-    
-    memcpy(rslt->data->base, name, sizeof(name[0]) * name_len);
-    rslt->elem_count = name_len;
-    rslt->elem_bits = sizeof(name[0]) * 8;
-    return rc;
-}
-
-VTRANSFACT_IMPL ( NCBI_align_ref_name, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    RefName *fself;
-    rc_t rc = RefNameMake ( & fself, info -> tbl,(const VCursor*)info->parms  );
-    if ( rc == 0 )
-    {
-        rslt -> self = fself;
-        rslt -> whack = RefNameWhack;
-        rslt -> u . rf = align_ref_name;
-        rslt -> variant = vftRow;
-    }
-
-    return rc;
-}
diff --git a/libs/axf/align-ref-pos.c b/libs/axf/align-ref-pos.c
deleted file mode 100644
index 4143553..0000000
--- a/libs/axf/align-ref-pos.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-
-#include <vdb/xform.h>
-#include <vdb/database.h>
-#include <vdb/table.h>
-#include <vdb/cursor.h>
-#include <vdb/vdb-priv.h>
-#include <insdc/insdc.h>
-#include <klib/data-buffer.h>
-#include <klib/container.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <bitstr.h>
-
-#include "ref-tbl.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-typedef struct RefPos RefPos;
-
-
-struct RefPos
-{
-    const VCursor *curs;
-    uint32_t name_idx;
-    uint32_t name_range_idx;
-    uint32_t max_seq_len;
-/***** cache ****/
-    BSTree   tr_range; /** region tree ***/
-};
-
-typedef struct {
-    int64_t start_id;
-    int64_t stop_id;
-}RowRange;
-
-typedef struct {
-    BSTNode  n;
-    RowRange rr;
-}BSTRowRange;
-
-static
-int CC row_range_cmp ( const void *a, const BSTNode *b )
-{
-	const int64_t  *key=a;
-	const BSTRowRange *node = ( const BSTRowRange* ) b;
-	if(key[0] < node->rr.start_id) return -1;
-	if(key[0] > node->rr.stop_id) return +1;
-	return 0;
-}
-static
-int CC row_range_sort(const BSTNode *a, const BSTNode *b )
-{
-    const BSTRowRange * item = ( const BSTRowRange* ) a;
-    const BSTRowRange * node = ( const BSTRowRange* ) b;
-
-    return item->rr.start_id - node->rr.start_id;
-}    
-
-
-static
-void CC bst_range_free ( BSTNode *n, void *ignore )
-{
-    free ( n );
-}
-
-
-static
-void CC RefPosWhack ( void *obj )
-{
-    RefPos * self = obj;
-    if ( self != NULL )
-    {
-    	BSTreeWhack(&self->tr_range,bst_range_free,NULL);
-        VCursorRelease ( self -> curs );
-        free ( self );
-    }
-}
-
-static
-rc_t RefPosMake ( RefPos **objp, const VTable *tbl, const VCursor *native_curs )
-{
-    rc_t rc;
-
-    /* create the object */
-    RefPos *obj = malloc ( sizeof * obj );
-    if ( obj == NULL ) {
-        rc = RC ( rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted );
-    } else {
-	obj->curs=NULL;
-        BSTreeInit(&obj->tr_range);
-        /* open the reference table cursor*/
-	  
-	if( (rc = AlignRefTableCursor(tbl, native_curs, &obj->curs, NULL)) == 0 ) {
-                uint32_t itmp;
-                if(  (rc = VCursorAddColumn(obj->curs, &itmp, "(U32)MAX_SEQ_LEN")) == 0 || GetRCState(rc) == rcExists)  {
-                    const void *base;
-                    uint32_t row_len;
-                    rc = VCursorCellDataDirect(obj->curs, 1, itmp, NULL, &base, NULL, &row_len);
-                    if(rc == 0) {
-                        assert(row_len == 1);
-                        memcpy(&obj->max_seq_len, base, 4);
-                    }
-                }
-                if( GetRCObject(rc) == rcColumn && GetRCState(rc) == rcNotFound ) {
-		    /*** no MAX_SEQ_LEN means that REF_POS==REF_START **/
-		    VCursorRelease(obj->curs);
-		    obj->curs = NULL;
-                    obj->max_seq_len = 0;
-		    obj->name_range_idx = 0;
-		    obj->name_idx = 0;
-                    rc = 0;
-                } else if( rc == 0 ) {
-                        /* add columns to cursor */
-			rc = VCursorAddColumn(obj->curs, &obj->name_idx, "(utf8)NAME");
-			if(rc == 0 || GetRCState(rc) == rcExists)
-				rc = VCursorAddColumn(obj->curs, &obj->name_range_idx, "NAME_RANGE");
-			if(GetRCState(rc) == rcExists)
-				rc = 0;
-                }
-        }
-        if( rc == 0 ) {
-            *objp = obj;
-        } else {
-	    VCursorRelease(obj->curs);
-            free(obj);
-        }
-    }
-    return rc;
-}
-
-enum align_ref_pos_args {
-    REF_ID,
-    REF_START,
-    REF_PLOIDY,
-    PLOIDY
-};
-
-/*
-function INSDC:coord:zero NCBI:align:ref_pos ( I64 ref_id, INSDC:coord:zero ref_start );
-*/
-static
-rc_t CC align_ref_pos ( void *data, const VXformInfo *info,
-    int64_t row_id, VRowResult *rslt, uint32_t argc, const VRowData argv[] )
-{
-    rc_t rc;
-    RefPos const *self = (void const *)data;
-    int64_t ref_row_id = 0;
-    INSDC_coord_zero *ref_pos;
-    unsigned const ploidy = argv[REF_START].u.data.elem_count;
-    unsigned i;
-
-    /* get start and length of reference segment */
-    int64_t const *ref_id = 0;
-    INSDC_coord_zero const *ref_start;
-
-    assert(argv[REF_ID].u.data.elem_bits == sizeof(*ref_id) * 8);
-    assert(argv[REF_START].u.data.elem_bits == sizeof(*ref_start) * 8);
-
-    ref_start = argv[REF_START].u.data.base;
-    ref_start += argv[REF_START].u.data.first_elem;
-
-    if( self->curs != NULL ) {
-        char const *name = NULL;
-        uint32_t name_len;
-        BSTRowRange *brr;
-
-        ref_id = argv[REF_ID].u.data.base;
-        ref_id += argv[REF_ID].u.data.first_elem;
-
-        brr = (BSTRowRange*)BSTreeFind(&self->tr_range,&ref_id[0],row_range_cmp);
-        if(brr==NULL) {
-            RowRange *new_rr;
-            rc = VCursorCellDataDirect(self->curs, ref_id[0], self->name_idx, NULL, (void const **)&name, NULL, &name_len);
-            if (rc) return rc;
-            rc = VCursorParamsSet((struct VCursorParams const *)self->curs, "QUERY_SEQ_NAME", "%.*s", name_len, name);
-            if (rc) return rc;
-
-            rc = VCursorCellDataDirect(self->curs, ref_id[0], self->name_range_idx, NULL, (void const **)&new_rr, NULL, NULL);
-            if (rc) return rc;
-
-            brr=malloc(sizeof(*brr));
-            memcpy(&brr->rr,new_rr,sizeof(*new_rr));
-            BSTreeInsert((BSTree*)&self->tr_range,(BSTNode*)brr, row_range_sort);
-        }
-        ref_row_id = brr->rr.start_id;
-    }
-
-    rc = KDataBufferResize(rslt->data, ploidy);
-    if (rc) return rc;
-    
-    ref_pos = rslt->data->base;
-    for (i = 0; i != ploidy; ++i) {
-        ref_pos[i] = ref_start[i];
-        if( self->curs != NULL ) {
-            ref_pos[i] += (ref_id[0] - ref_row_id) * self->max_seq_len;
-        }
-    }
-    rslt->elem_count = ploidy;
-    rslt->elem_bits = sizeof(ref_pos[0]) * 8;
-    return rc;
-}
-
-VTRANSFACT_IMPL ( NCBI_align_ref_pos, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    RefPos *fself;
-    rc_t rc = RefPosMake ( & fself, info -> tbl,  (const VCursor*)info->parms);
-    if ( rc == 0 )
-    {
-        rslt -> self = fself;
-        rslt -> whack = RefPosWhack;
-        rslt -> u . rf = align_ref_pos;
-        rslt -> variant = vftRow;
-    }
-
-    return rc;
-}
diff --git a/libs/axf/align-ref-seq-id.c b/libs/axf/align-ref-seq-id.c
deleted file mode 100644
index 6d0d8a7..0000000
--- a/libs/axf/align-ref-seq-id.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-
-#include <vdb/xform.h>
-#include <vdb/database.h>
-#include <vdb/table.h>
-#include <vdb/cursor.h>
-#include <vdb/vdb-priv.h>
-#include <insdc/insdc.h>
-#include <klib/data-buffer.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <bitstr.h>
-
-#include "ref-tbl.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-typedef struct RefSeqID RefSeqID;
-struct RefSeqID
-{
-    const VCursor *curs;
-    uint32_t seqID_idx;
-};
-
-static
-void CC RefSeqIDWhack ( void *obj )
-{
-    RefSeqID * self = obj;
-    if ( self != NULL )
-    {
-        VCursorRelease ( self -> curs );
-        free ( self );
-    }
-}
-
-static
-rc_t RefSeqIDMake ( RefSeqID **objp, const VTable *tbl, const VCursor *native_curs )
-{
-    rc_t rc;
-
-    /* create the object */
-    RefSeqID *obj = malloc ( sizeof * obj );
-    if ( obj == NULL ) {
-        rc = RC ( rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted );
-    } else {
-	obj->curs=NULL;
-        /* open the reference cursor */
-        rc = AlignRefTableCursor(tbl, native_curs, &obj->curs, NULL);
-        if(rc == 0){
-                /* add columns to cursor */
-                rc = VCursorAddColumn(obj->curs, &obj->seqID_idx, "SEQ_ID");
-                if( GetRCObject(rc) == rcColumn && GetRCState(rc) == rcNotFound ) {
-                        rc = VCursorAddColumn(obj->curs, &obj->seqID_idx, "REF_SEQ_ID");
-                }
-                if(GetRCState(rc) == rcExists){
-                        rc = 0;
-                }
-                if( rc == 0 ) {
-                    *objp = obj;
-                    return 0;
-                }
-                VCursorRelease ( obj -> curs );
-        }
-        free ( obj );
-    }
-    return rc;
-}
-
-enum align_ref_name_args {
-    REF_ID
-};
-
-/*
- function ascii NCBI:align:ref_seq_id ( I64 ref_id );
-*/
-static
-rc_t CC align_ref_seq_id ( void *data, const VXformInfo *info,
-    int64_t row_id, VRowResult *rslt, uint32_t argc, const VRowData argv[] )
-{
-    rc_t rc;
-    RefSeqID const *self = (void const *)data;
-    char const *name = NULL;
-    uint32_t name_len;
-
-    /* get start and length of reference segment */
-    int64_t const *ref_id = argv[REF_ID].u.data.base;
-
-    assert(argv[REF_ID].u.data.elem_bits == sizeof(*ref_id) * 8);
-
-    if( self->curs == NULL || argv[REF_ID].u.data.elem_count == 0 ) {
-        rslt->elem_count = 0;
-        return 0;
-    }
-    ref_id += argv[REF_ID].u.data.first_elem;
-    
-    rc = VCursorCellDataDirect(self->curs, ref_id[0], self->seqID_idx, NULL, (void const **)&name, NULL, &name_len);
-    if (GetRCState(rc) == rcNotFound && GetRCObject(rc) == rcRow) {
-        name = "";
-        name_len = 0;
-    } else if( rc != 0 ) {
-        return rc;
-    }
-    rc = KDataBufferCast(rslt->data, rslt->data, sizeof(name[0]) * 8, true);
-    if (rc) return rc;
-
-    rc = KDataBufferResize(rslt->data, name_len);
-    if (rc) return rc;
-    
-    memcpy(rslt->data->base, name, sizeof(name[0]) * name_len);
-    rslt->elem_count = name_len;
-    rslt->elem_bits = sizeof(name[0]) * 8;
-    return rc;
-}
-
-VTRANSFACT_IMPL ( NCBI_align_ref_seq_id, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    RefSeqID *fself;
-    rc_t rc = RefSeqIDMake ( & fself, info -> tbl, (const VCursor*)info->parms  );
-    if ( rc == 0 )
-    {
-        rslt -> self = fself;
-        rslt -> whack = RefSeqIDWhack;
-        rslt -> u . rf = align_ref_seq_id;
-        rslt -> variant = vftRow;
-    }
-
-    return rc;
-}
diff --git a/libs/axf/align-restore-read.c b/libs/axf/align-restore-read.c
deleted file mode 100644
index 95b2066..0000000
--- a/libs/axf/align-restore-read.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-#include <insdc/insdc.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/table.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <bitstr.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-
-
-static
-rc_t CC align_restore_read_impl ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    int mmi,roi,rri,di,bi;
-    const INSDC_4na_bin	*ref_read 	= argv[0].u.data.base;
-    const uint32_t	ref_read_len 	= argv[0].u.data.elem_count;
-    const uint8_t	*has_mismatch	= argv[1].u.data.base;
-    const uint32_t	has_mismatch_len= argv[1].u.data.elem_count;
-    const INSDC_4na_bin *mismatch	= argv[2].u.data.base;
-    const uint32_t	mismatch_len	= argv[2].u.data.elem_count;
-    const uint8_t	*has_ref_offset	   = argv[3].u.data.base;
-    const uint32_t	has_ref_offset_len = argv[3].u.data.elem_count;
-    const int32_t 	*ref_offset	= argv[4].u.data.base;
-    const uint32_t	ref_offset_len  = argv[4].u.data.elem_count;
-    uint32_t ploidy = 1, rl;
-    const INSDC_coord_len* read_len = &has_mismatch_len;
-
-    INSDC_4na_bin *dst;
-    uint32_t	dst_len;
-    
-    assert(argv[0].u.data.elem_bits == 8);
-    assert(argv[1].u.data.elem_bits == 8);
-    assert(argv[2].u.data.elem_bits == 8);
-    assert(argv[3].u.data.elem_bits == 8);
-    assert(argv[4].u.data.elem_bits == 32);
-
-    ref_read	   += argv [ 0 ] . u . data . first_elem;
-    has_mismatch   += argv [ 1 ] . u . data . first_elem;
-    mismatch	   += argv [ 2 ] . u . data . first_elem;
-    has_ref_offset += argv [ 3 ] . u . data . first_elem;
-    ref_offset     += argv [ 4 ] . u . data . first_elem;
-
-    if ( has_mismatch_len != has_ref_offset_len )
-		return RC(rcXF, rcFunction, rcExecuting, rcData, rcInconsistent);
-
-    if( argc > 5 ) {
-        assert(argv[5].u.data.elem_bits == 32);
-        ploidy = argv[5].u.data.elem_count;
-        read_len = argv[5].u.data.base;
-        read_len += argv[5].u.data.first_elem;
-    }
-    dst_len = has_mismatch_len;
-
-    /* resize output row for the total number of reads */    
-    rslt -> data -> elem_bits = 8;
-    rc = KDataBufferResize ( rslt -> data, dst_len );
-    if ( rc != 0 ) return rc;
-    rslt -> elem_count = dst_len;
-    dst = rslt -> data -> base;
-    /**** MAIN RESTORATION LOOP ***/
-    for(mmi=roi=rri=di=bi=0, rl = 1; di < dst_len; di++,rri++,rl++,bi++){
-        if(has_ref_offset[di] && bi >= 0){ /** bi can only become negative on Bs; skip has_ref_offset if Bs are not exhausted ***/
-            if(roi >= ref_offset_len)
-                return RC(rcXF, rcFunction, rcExecuting, rcData, rcInconsistent);
-            memcpy ( & bi, ref_offset + roi, sizeof bi );
-            rri += bi; /** can lead to negative rri ***/                
-            roi++;
-        }
-        if(has_mismatch[di]){
-            if(mmi >= mismatch_len)
-                return RC(rcXF, rcFunction, rcExecuting, rcData, rcInconsistent);
-            dst[di]=mismatch[mmi];
-            mmi++;
-        } else {
-            if(rri < 0 || rri >= ref_read_len){ /*** can not have match after rolling back off the right edge ***/
-                return RC(rcXF, rcFunction, rcExecuting, rcData, rcInconsistent);
-            }
-            dst[di]=ref_read[rri];
-        }
-        if( ploidy > 1 && rl == read_len[0] ) {
-            rri = -1;
-            rl = 0;
-            ploidy--;
-            read_len++;
-        }
-    }
-    return 0;
-}
-
-
-/* 
- * function
- * INSDC:4na:bin ALIGN:align_restore_read #1( INSDC:4na:bin ref_read, bool has_mismatch, INSDC:4na:bin mismatch, bool has_ref_offset, I32 ref_offset);
- */
-VTRANSFACT_IMPL ( ALIGN_align_restore_read, 1, 0, 1 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-
-    rslt->u.rf = align_restore_read_impl;
-    rslt->variant = vftRow;
-    rslt -> whack = NULL;
-    return 0;
-}
diff --git a/libs/axf/cigar.c b/libs/axf/cigar.c
deleted file mode 100644
index 487c61c..0000000
--- a/libs/axf/cigar.c
+++ /dev/null
@@ -1,1914 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/table.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <bitstr.h>
-#include <sysalloc.h>
-#include <klib/printf.h>
-
-#include <klib/out.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include <ctype.h>
-
-#include <insdc/insdc.h>
-
-#define ARG_BASE(TYPE, N) (((TYPE const *)argv[(N)].u.data.base) + argv[(N)].u.data.first_elem)
-#define ARG_ALIAS(TYPE, NAME, N) TYPE const *const NAME = ARG_BASE(TYPE, N)
-#define ARG_ALIAS_COND(TYPE, NAME, N, ALT) TYPE const *const NAME = ((argc > (N)) ? ARG_BASE(TYPE, N) : ALT)
-
-typedef struct trim_self_struct {
-    uint8_t version;
-} self_t;
-
-static
-rc_t op2b(KDataBuffer *dst, unsigned const offset, unsigned *const count, int const opcode, unsigned oplen)
-{
-    unsigned digits = 1;
-    unsigned scale = 10;
-    
-    if (oplen == 0) {
-        *count = 0;
-        return 0;
-    }
-    while (scale < oplen) {
-        scale *= 10;
-        ++digits;
-    }
-    if (scale == oplen) /* oplen is whole power of 10 */
-        ++digits;
-
-    *count = digits + 1;
-    
-    if (dst) {
-        unsigned const need = offset + digits + 1;
-        
-        if (need > dst->elem_count) {
-            rc_t rc = KDataBufferResize(dst, need);
-            if (rc) return rc;
-        }
-        {
-            char *const base = &((char *)dst->base)[offset];
-            
-            base[digits] = opcode;
-            do {
-                unsigned const digit = oplen % 10;
-                
-                oplen /= 10;
-                base[--digits] = digit + '0';
-            } while (digits);
-        }
-    }
-    return 0;
-}
-
-static
-rc_t cigar_string(KDataBuffer *dst, size_t boff, uint64_t *bsize, bool const full,
-                  bool const has_mismatch[], bool const has_ref_offset[],
-                  INSDC_coord_zero const read_start, INSDC_coord_zero const read_end,
-                  int32_t const ref_offset[], unsigned const ro_len, unsigned *ro_offset)
-{
-    size_t bsz = 0;
-    unsigned nwrit;
-    uint32_t i,m,mm;
-    rc_t rc;
-    unsigned cur_off = ro_offset ? *ro_offset : 0;
-    
-#define BUF_WRITE(OP, LEN) if ((rc = op2b(dst, bsz + boff, &nwrit, (OP), (LEN))) != 0) return rc; bsz += nwrit;
-
-#define MACRO_FLUSH_MATCH    { BUF_WRITE('=', m); m = 0; }
-#define MACRO_FLUSH_MISMATCH { BUF_WRITE(i == read_end ? 'S' : 'X', mm); mm = 0; }
-
-#define MACRO_FLUSH_BOTH \
-if(m+mm > 0) { \
-    if(i==read_end && has_ref_offset[i]) { \
-        BUF_WRITE('M', m); BUF_WRITE('S', mm); \
-    } else { \
-        BUF_WRITE('M', m + mm) \
-    } \
-    m=mm=0; \
-}
-
-#define MACRO_FLUSH \
-if(full){ \
-    MACRO_FLUSH_MATCH; \
-    MACRO_FLUSH_MISMATCH; \
-} else { \
-    MACRO_FLUSH_BOTH; \
-}
-    for(i = read_start, bsz = m = mm = 0; i < read_end; i++) {
-        if(has_ref_offset[i]){ /*** No offset in the reference **/
-            int32_t offset;
-            
-            if( cur_off >= ro_len) /*** bad data ***/
-                return RC(rcXF, rcFunction, rcExecuting, rcData, rcInvalid);
-            
-            offset = ref_offset[cur_off++];
-            
-            if( offset > 0 ){ /*** insert in the reference, delete in sequence ***/
-                if(i==0) /**** deletes in the beginning are disallowed, REF_START should have been moved and delete converted to insert **/
-                    return RC(rcXF, rcFunction, rcExecuting, rcData, rcInvalid );
-                MACRO_FLUSH;
-                BUF_WRITE('D', offset);
-            } else if ( offset < 0){ /**** delete from the reference ***/
-                offset = -offset;
-                if( i + offset > read_end)
-                    return RC(rcXF, rcFunction, rcExecuting, rcData, rcInvalid );
-                if(i > 0) { /** normally indels are before the current base ***/
-                    MACRO_FLUSH;
-                    BUF_WRITE('I', offset);
-                } else { /***  this  is a soft clip at the beginning ***/
-                    BUF_WRITE('S', offset);
-                }
-                i += offset;
-            } else { /*** Not possible ??? ***/
-                return RC(rcXF, rcFunction, rcExecuting, rcData, rcInvalid );
-            }
-        }
-        if(i < read_end ){
-            if(has_mismatch[i]){
-                if(full) {
-                    MACRO_FLUSH_MATCH;
-                }
-                mm++;
-            } else {
-                if(full) {
-                    MACRO_FLUSH_MISMATCH;
-                } else {
-                    m+=mm;
-                    mm=0;
-                }
-                m++;
-            }
-        }
-    }
-    MACRO_FLUSH;
-    *bsize = bsz;
-    if (ro_offset) *ro_offset = cur_off;
-    return 0;
-    
-#undef BUF_WRITE
-#undef MACRO_FLUSH_MATCH
-#undef MACRO_FLUSH_MISMATCH
-#undef MACRO_FLUSH_BOTH
-#undef MACRO_FLUSH
-}
-
-
-static
-rc_t cigar_string_2(KDataBuffer *dst, size_t boff, uint64_t *bsize, const int version,
-                    bool const has_mismatch[], bool const has_ref_offset[],
-                    INSDC_coord_zero const read_start, INSDC_coord_zero const read_end,
-                    int32_t const ref_offset[], unsigned const ro_len, unsigned* ro_offset,
-                    unsigned const reflen, bool use_S)
-{
-    int ri;
-    unsigned si;
-    unsigned di;
-    rc_t rc;
-    unsigned nwrit;
-    unsigned cur_off = ro_offset ? *ro_offset : 0;
-    unsigned op_len;
-    int opcode;
-    int const opM = version == 1 ? '=' : 'M';
-    int const opX = version == 1 ? 'X' : 'M';
-    int const opS = use_S ? 'S' : 'I';
-    
-#define BUF_WRITE(OP, LEN) { if ((rc = op2b(dst, di + boff, &nwrit, (OP), (LEN))) != 0) return rc; di += nwrit; }
-    si=read_start;
-    if (/* !use_S && */read_start == read_end && reflen > 0) {/** full delete as a last ploidy ends up written nowhere  **/
-        di=0;
-        opcode = 'D';
-        op_len = reflen;
-    }
-    else for (op_len = di = 0, opcode = ri = 0; si < read_end && ri <= (int)reflen; ) {
-        if (has_ref_offset[si]) {
-            int offs;
-            
-            if(op_len > 0) {
-                BUF_WRITE(opcode, op_len);
-                op_len = 0;
-            }
-            if (cur_off >= ro_len) /*** bad data ***/
-                return RC(rcXF, rcFunction, rcExecuting, rcData, rcInvalid);
-
-            offs = ref_offset[cur_off++];
-            if (offs < 0) {
-                unsigned j;
-                for(j=1; j<-offs && (si + j) < read_end;){
-                    if(has_ref_offset[si+j]){/*** structured insert **/
-                        BUF_WRITE(si ? 'I' : opS, j);
-                        offs += j;
-                        si   += j;
-                        j=1;
-                    } else {
-                        j++;
-                    }
-                }
-                if(offs < 0){
-                    BUF_WRITE(si ? 'I' : opS, -offs);
-                    si -= offs;
-                }
-                continue;
-            }
-            else if (offs > 0) {
-                BUF_WRITE('D', offs);
-                ri += offs;
-            }
-            else
-                return RC(rcXF, rcFunction, rcExecuting, rcData, rcInvalid);
-        }
-        if (ri < (int)reflen) {
-            int const op_nxt = (has_mismatch[si] ? opX : opM);
-            
-            if (op_len == 0 || opcode == op_nxt)
-                ++op_len;
-            else {
-                BUF_WRITE(opcode, op_len);
-                op_len = 1;
-            }
-            opcode = op_nxt;
-        }
-        else
-            break;
-        ++si;
-        ++ri;
-    }
-    BUF_WRITE(opcode, op_len);
-    if (si < read_end){
-        if (cur_off + 1 < ro_len) { 
-            assert(read_end + ref_offset[cur_off] == si);
-            cur_off++;
-            BUF_WRITE('I', read_end - si);
-        }
-        else {
-            BUF_WRITE(opS, read_end - si);
-        }
-    }
-    *bsize = di;
-    if (ro_offset) *ro_offset = cur_off;
-
-    return 0;
-#undef BUF_WRITE
-}
-
-static INSDC_coord_len right_soft_clip(unsigned seq_len, unsigned ref_len,
-                                       unsigned noffsets,
-                                       int32_t const ref_offset[])
-{
-    INSDC_coord_len a = ref_len;
-    unsigned i;
-    
-    for (i = 0; i < noffsets; ++i)
-        a -= ref_offset[i];
-    return a < seq_len ? seq_len - a : 0;
-}
-
-static
-rc_t CC cigar_impl ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    self_t const *self = data;
-    unsigned const rdln = argv[0].u.data.elem_count;
-    unsigned const ro_len = argv[2].u.data.elem_count;
-    bool const *has_mismatch   = argv[0].u.data.base;
-    bool const *has_ref_offset = argv[1].u.data.base;
-    int32_t const *ref_offset   = argv[2].u.data.base;
-    rc_t rc;
-    
-    assert(argv[0].u.data.elem_bits == 8);
-    assert(argv[1].u.data.elem_bits == 8);
-    assert(argv[2].u.data.elem_bits == 32);
-
-    assert(rdln == argv[1].u.data.elem_count);
-
-    has_mismatch   += argv[0].u.data.first_elem;
-    has_ref_offset += argv[1].u.data.first_elem;
-    ref_offset     += argv[2].u.data.first_elem;
-
-    rslt->data->elem_bits = 8;
-    if (argc == 3)
-        rc = cigar_string(rslt->data, 0, &rslt->elem_count, self->version & 0x1,
-                          has_mismatch, has_ref_offset,
-                          0, rdln, ref_offset, ro_len, NULL);
-    else {
-        int32_t const *const rfln = argv[3].u.data.base;
-        
-        rc = cigar_string_2(rslt->data, 0, &rslt->elem_count, self->version & 0x1,
-                            has_mismatch, has_ref_offset,
-                            0, rdln, ref_offset, ro_len, NULL,
-                            rfln[argv[3].u.data.first_elem],true);
-    }
-    return rc;
-}
-
-static
-rc_t CC cigar_impl_2 ( void *data, const VXformInfo *info, int64_t row_id,
-                        VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    self_t const *self = data;
-    bool const *has_mismatch        = argv[0].u.data.base;
-    bool const *has_ref_offset      = argv[1].u.data.base;
-    int32_t const *ref_offset       = argv[2].u.data.base;
-    INSDC_coord_len const *read_len = argv[3].u.data.base;
-    uint32_t const nreads = argv[3].u.data.elem_count;
-    uint32_t const ro_len = argv[2].u.data.elem_count;
-    uint32_t n;
-    uint32_t ro_offset = 0;
-    rc_t rc = 0;
-    uint64_t cnt;
-    INSDC_coord_zero start;
-    INSDC_coord_len *cigar_len = NULL;
-    KDataBuffer *buf = (self->version & 0x04) ? NULL : rslt->data;
-    
-    assert(argv[0].u.data.elem_bits == 8);
-    assert(argv[1].u.data.elem_bits == 8);
-    assert(argv[2].u.data.elem_bits == 32);
-    assert(argv[3].u.data.elem_bits == 32);
-    
-    has_mismatch   += argv[0].u.data.first_elem;
-    has_ref_offset += argv[1].u.data.first_elem;
-    ref_offset     += argv[2].u.data.first_elem;
-    read_len       += argv[3].u.data.first_elem;
-
-    if( self->version & 0x4 ) {
-        rslt->data->elem_bits = sizeof(*cigar_len) * 8;
-        rslt->elem_count = nreads;
-        rc = KDataBufferResize(rslt->data, rslt->elem_count); if (rc) return rc;
-        cigar_len = rslt->data->base;
-        if (argv[0].u.data.elem_count == 0 ||
-            argv[1].u.data.elem_count == 0)
-        {
-            memset(cigar_len, 0, sizeof(cigar_len[0]) * nreads);
-            return 0;
-        }
-    }
-    else {
-        rslt->data->elem_bits = 8;
-        rslt->elem_count = 0;
-    }
-    for (n = 0, start = 0, ro_offset = 0; n < nreads; start += read_len[n++]) {
-        if (argc == 4)
-            rc = cigar_string(buf, rslt->elem_count, &cnt, self->version & 0x1,
-                              has_mismatch, has_ref_offset,
-                              start, start + read_len[n],
-                              ref_offset, ro_len, &ro_offset);
-        else {
-            int32_t const *const reflen = argv[4].u.data.base;
-            
-            rc = cigar_string_2(buf, rslt->elem_count, &cnt, self->version & 0x1,
-                                has_mismatch, has_ref_offset,
-                                start, start + read_len[n],
-                                ref_offset, ro_len, &ro_offset,
-                                reflen[argv[4].u.data.first_elem],(nreads==1));
-        }
-        if (rc) return rc;
-        if (cigar_len != NULL /*self->version & 0x04*/)
-            cigar_len[n] = cnt;
-        else
-            rslt->elem_count += cnt;
-    }
-    return 0;
-}
-
-static
-void CC self_whack( void *ptr )
-{
-    free( ptr );
-}
-
-
-/* 
- * function
- * ascii ALIGN:cigar #1 ( bool has_mismatch, bool has_ref_offset, I32 ref_offset);
- */
-VTRANSFACT_IMPL ( ALIGN_cigar, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    self_t self;
-
-    self.version =cp -> argv [ 0 ] . data . u8 [ 0 ];
-    switch(self.version){
-    case 0:
-    case 1:
-        break;
-    default:
-        return RC ( rcXF, rcFunction, rcConstructing, rcParam, rcIncorrect );
-    }
-    rslt->u.rf = cigar_impl;
-    rslt->variant = vftRow;
-    rslt -> self = malloc ( sizeof self );
-    memcpy(rslt -> self,&self,sizeof(self));
-    rslt -> whack = self_whack;
-
-    return 0;
-}
-
-VTRANSFACT_IMPL ( ALIGN_cigar_2, 2, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-                                          VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    self_t self;
-    const VTypedesc* tp = &info->fdesc.desc;
-
-    self.version = cp->argv[0].data.u8[0];
-    switch(self.version) {
-    case 0x0:
-    case 0x1:
-        break;
-    default:
-        return RC(rcXF, rcFunction, rcConstructing, rcParam, rcIncorrect);
-    }
-
-    if( tp->domain == vtdAscii && tp->intrinsic_bits == 8 ) {
-        self.version |= 0x2;
-    } else if( tp->domain == vtdUint && tp->intrinsic_bits == sizeof(INSDC_coord_len) * 8 ) {
-        self.version |= 0x4;
-    } else {
-        return RC(rcXF, rcFunction, rcConstructing, rcParam, rcIncorrect);
-    }
-    rslt->u.rf = cigar_impl_2;
-    rslt->variant = vftRow;
-    rslt->self = malloc(sizeof self);
-    memcpy(rslt->self, &self, sizeof(self));
-    rslt->whack = self_whack;
-    return 0;
-}
-
-static
-rc_t CC edit_distance_impl ( void *data, const VXformInfo *info, int64_t row_id,
-                            VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    uint32_t i,roi,mrun;
-    uint32_t len    = argv[0].u.data.elem_count;
-    uint32_t *dst;
-    
-    uint8_t const *has_mismatch   = argv [ 0 ] . u . data . base;
-    uint8_t const *has_ref_offset = argv [ 1 ] . u . data . base;
-    int32_t const *ref_offset     = argv [ 2 ] . u . data . base;
-    
-    assert(argv[0].u.data.elem_bits == 8);
-    assert(argv[1].u.data.elem_bits == 8);
-    assert(argv[2].u.data.elem_bits == 32);
-    
-    assert(len == argv[1].u.data.elem_count);
-    
-    has_mismatch   += argv [ 0 ] . u . data . first_elem;
-    has_ref_offset += argv [ 1 ] . u . data . first_elem;
-    ref_offset     += argv [ 2 ] . u . data . first_elem;
-    
-    /* resize output row for the total number of reads */    
-    rslt->data->elem_bits = rslt->elem_bits;
-    rc = KDataBufferResize ( rslt -> data, 1);
-    if ( rc != 0 ) return rc;
-    
-    rslt -> elem_count = 1;
-    dst = rslt -> data -> base;
-    dst[0]=0;
-    if(len == 0) return 0; /** nothing to do **/
-    
-    if(has_ref_offset[0]){/** skip mismatches from the beginning == soft clip ***/
-        if(ref_offset[0] > 0)  /**** deletes in the beginning are disallowed, REF_START should have been moved and delete converted to insert **/
-            return RC(rcXF, rcFunction, rcExecuting, rcData, rcInvalid );
-        i=-ref_offset[0];
-        roi=1;
-        mrun=0;
-    } else {
-        i=roi=0;
-    }
-    for(mrun=0;i<len;i++){
-        if(has_mismatch[i]){
-            mrun++;
-        } else {/*** intentionally skipping last run of mismatches **/
-            dst[0]+=mrun;
-            mrun=0;
-        }
-    }
-    return 0;
-}
-
-/*
- * function
- * ascii NCBI:align:edit_distance #1 ( bool has_mismatch, bool has_ref_offset, I32 ref_offset);
- */
-VTRANSFACT_IMPL ( NCBI_align_edit_distance, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->u.rf = edit_distance_impl;
-    rslt->variant = vftRow;
-    return 0;
-}
-
-
-/*
- * edit distance = sum of lengths of inserts
- *               + sum of lengths of deletes
- *               + number of mismatches
- * excluding soft clips
- */
-
-unsigned edit_distance(bool const has_ref_offset[],
-                       bool const has_mismatch[],
-                       unsigned const readlen,
-                       unsigned const reflen,
-                       int32_t const ref_offset[],
-                       unsigned const offsets)
-{
-    if (readlen == 0) {
-        /* full delete */
-        return reflen;
-    }
-    else {
-        INSDC_coord_len const rsc = right_soft_clip(readlen, reflen, offsets, ref_offset);
-        unsigned indels = 0;
-        unsigned misses = 0;
-        unsigned i = 0;
-        unsigned j = 0;
-        
-        if (has_ref_offset[0] && ref_offset[j] < 0)
-            j = i = 1;
-        
-        /* sum of insert lengths + sum of delete lengths excluding soft clips */
-        for ( ; i < readlen - rsc; ++i) {
-            if (has_ref_offset[i]) {
-                int const offset = ref_offset[j++];
-                
-                if (offset < 0)
-                    indels += -offset;
-                else
-                    indels +=  offset;
-            }
-        }
-        /* sum of mismatches not in inserts or soft clips */
-        for (j = i = 0; i < readlen - rsc;) {
-            if (has_ref_offset[i]) {
-                int offset = ref_offset[j++];
-                
-                if (offset < 0) {
-                    i += -offset;
-                    continue;
-                }
-            }
-            misses += has_mismatch[i] ? 1 : 0;
-            ++i;
-        }
-        return indels + misses;
-    }
-}
-
-static
-rc_t CC edit_distance_2_impl ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    unsigned const nreads = argc > 4 ? argv[4].u.data.elem_count : 1;
-    unsigned const len = argv[0].u.data.elem_count;
-    unsigned const noffsets = argv[2].u.data.elem_count;
-    INSDC_coord_len const dummy_rl = len;
-
-    ARG_ALIAS     (bool           , has_mismatch  , 0);
-    ARG_ALIAS     (bool           , has_ref_offset, 1);
-    ARG_ALIAS     (int32_t        , ref_offset    , 2);
-    ARG_ALIAS     (INSDC_coord_len, ref_len       , 3);
-    ARG_ALIAS_COND(INSDC_coord_len, readlen       , 4, &dummy_rl);
-    
-    assert(argv[0].u.data.elem_bits == sizeof(has_mismatch  [0]) * 8);
-    assert(argv[1].u.data.elem_bits == sizeof(has_ref_offset[0]) * 8);
-    assert(argv[2].u.data.elem_bits == sizeof(ref_offset    [0]) * 8);
-    assert(argv[3].u.data.elem_bits == sizeof(ref_len       [0]) * 8);
-
-    rslt->data->elem_bits = rslt->elem_bits;
-    if (len == 0) {
-        return KDataBufferResize(rslt->data, rslt->elem_count = 0);
-    }
-    
-    assert(len == argv[1].u.data.elem_count);
-
-    rslt->elem_count = nreads;
-    rc = KDataBufferResize(rslt->data, nreads);
-    if (rc == 0) {
-        unsigned i;
-        unsigned start = 0;
-        unsigned offset = 0;
-        uint32_t *const dst = rslt->data->base;
-        
-        for (i = 0; i < nreads; ++i) {
-            unsigned const rlen = readlen[i];
-            unsigned j;
-            unsigned offsets = 0;
-            
-            for (j = 0; j < rlen; ++j) {
-                if (has_ref_offset[start + j])
-                    ++offsets;
-            }
-            if (offsets + offset > noffsets)
-                return RC(rcXF, rcFunction, rcExecuting, rcData, rcInvalid);
-            
-            dst[i] = edit_distance(has_ref_offset + start,
-                                   has_mismatch + start,
-                                   rlen,
-                                   ref_len[0],
-                                   ref_offset + offset,
-                                   offsets);
-            start += rlen;
-            offset += offsets;
-        }
-    }
-    return rc;
-}
-
-/*
- * function
- * U32 NCBI:align:edit_distance #2 ( bool has_mismatch, bool has_ref_offset,
- *     I32 ref_offset, INSDC:coord:len ref_len );
- */
-VTRANSFACT_IMPL ( NCBI_align_edit_distance_2, 2, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->u.rf = edit_distance_2_impl;
-    rslt->variant = vftRow;
-    return 0;
-}
-
-
-/*
- * function bool ALIGN:generate_has_mismatch #1 (INSDC:4na:bin reference,
- *     INSDC:4na:bin subject, bool has_ref_offset, I32 ref_offset);
- */
-static
-rc_t CC generate_has_mismatch_impl ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    int32_t si,ri,roi;
-    uint32_t ref_len = argv[0].u.data.elem_count;
-    uint32_t sbj_len = argv[1].u.data.elem_count;
-    uint32_t hro_len = argv[2].u.data.elem_count;
-    uint32_t ro_len  = argv[3].u.data.elem_count;
-    const uint8_t *ref  = argv [ 0 ] . u . data . base;
-    const uint8_t *sbj  = argv [ 1 ] . u . data . base;
-    const uint8_t *has_ref_offset     = argv [ 2 ] . u . data . base;
-    const int32_t *ref_offset = argv [ 3 ] . u . data . base;
-
-    uint8_t * dst;
-    uint32_t  len = 0;
-
-    rslt -> data -> elem_bits = 8;
-    if (sbj_len == 0) {
-        rc = KDataBufferResize ( rslt -> data, 0 );
-        if ( rc != 0 )
-            return rc;
-        rslt -> elem_count = 0;
-        return 0;
-    }
-    assert(sbj_len == hro_len);
-    len = sbj_len;
-
-    ref            += argv [ 0 ] . u . data . first_elem;
-    sbj            += argv [ 1 ] . u . data . first_elem;
-    has_ref_offset += argv [ 2 ] . u . data . first_elem;
-    ref_offset     += argv [ 3 ] . u . data . first_elem;
-
-    /* resize output row for the total number of reads */
-    rslt -> data -> elem_bits = 8;
-    rc = KDataBufferResize ( rslt -> data, len );
-    if ( rc != 0 )
-        return rc;
-    rslt -> elem_count = len;
-    dst = rslt -> data->base;
-    for(si=ri=roi=0;si< len;si++,ri++){
-        if(has_ref_offset[si] != 0){/*** need to offset the reference ***/
-            if( roi >= ro_len){
-                return RC(rcXF, rcFunction, rcExecuting, rcData, rcInvalid );
-            }
-            ri += ref_offset[roi++];
-        }
-        if(ri >=0 && ri < ref_len && sbj[si]==ref[ri])
-            dst[si]=0;
-        else
-            dst[si]=1;
-    }
-    return 0;
-}
-
-
-VTRANSFACT_IMPL ( ALIGN_generate_has_mismatch, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->u.rf = generate_has_mismatch_impl;
-    rslt->variant = vftRow;
-    rslt -> self = NULL;
-    rslt -> whack = NULL;
-    return 0;
-}
-
-/*
- * function bool ALIGN:generate_mismatch #1 (INSDC:4na:bin reference,INSDC:4na:bin subject, bool has_ref_offset, I32 ref_offset);
- */
-static
-rc_t CC generate_mismatch_impl ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    int32_t si,ri,roi;
-    uint32_t ref_len = argv[0].u.data.elem_count;
-    uint32_t sbj_len = argv[1].u.data.elem_count;
-    uint32_t hro_len = argv[2].u.data.elem_count;
-    uint32_t ro_len  = argv[3].u.data.elem_count;
-    const uint8_t *ref  = argv [ 0 ] . u . data . base;
-    const uint8_t *sbj  = argv [ 1 ] . u . data . base;
-    const uint8_t *has_ref_offset     = argv [ 2 ] . u . data . base;
-    const int32_t *ref_offset = argv [ 3 ] . u . data . base;
-    uint8_t	buf[5*1024];
-    uint32_t  len;
-
-    rslt -> data -> elem_bits = 8;
-    if (sbj_len == 0) {
-        return KDataBufferResize(rslt->data, rslt->elem_count = 0);
-    }
-    assert(sbj_len == hro_len );
-
-    ref            += argv [ 0 ] . u . data . first_elem;
-    sbj            += argv [ 1 ] . u . data . first_elem;
-    has_ref_offset += argv [ 2 ] . u . data . first_elem;
-    ref_offset     += argv [ 3 ] . u . data . first_elem;
-
-    for(si=ri=roi=0,len=0;si<sbj_len;si++,ri++){
-        if(has_ref_offset[si] != 0){/*** need to offset the reference ***/
-            if( roi >= ro_len){
-                return RC(rcXF, rcFunction, rcExecuting, rcData, rcInvalid );
-            }
-            ri += ref_offset[roi++];
-        }
-        if(ri >=0 && ri < ref_len && sbj[si]==ref[ri]){/*noop*/}
-        else {
-            if(len > sizeof(buf)) return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-            buf[len++]=sbj[si];
-        }
-    }
-    /* resize output row for the total number of reads */
-    rc = KDataBufferResize ( rslt -> data, len );
-    if ( rc != 0 )
-        return rc;
-    rslt -> elem_count = len;
-    memcpy(rslt -> data->base,buf,len);
-    return 0;
-}
-
-VTRANSFACT_IMPL ( ALIGN_generate_mismatch, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->u.rf = generate_mismatch_impl;
-    rslt->variant = vftRow;
-    rslt -> self = NULL;
-    rslt -> whack = NULL;
-    return 0;
-}
-
-
-
-/*
- * function INSDC:quality:phred NCBI:align:generate_mismatch_qual #1 (INSDC:quality:phred qual,bool has_mismatch)
- */
-static
-rc_t CC generate_mismatch_qual_impl ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    const uint8_t *q  = argv[0].u.data.base; 
-    const uint8_t *h_mm           = argv[1].u.data.base;
-    uint8_t	buf[5*1024];
-    uint32_t	mm_cnt,i;
-
-    q    += argv[0].u.data.first_elem;
-    h_mm += argv[1].u.data.first_elem;
-    for(mm_cnt=0,i=0;i<argv[0].u.data.elem_count;i++){
-        if(h_mm[i]){
-            buf[mm_cnt++]=q[i];
-        }
-    }
-    /* resize output row for the total number of reads */
-    rslt -> data -> elem_bits = 8;
-    rc = KDataBufferResize ( rslt -> data, mm_cnt );
-    if ( rc != 0 )
-        return rc;
-    rslt -> elem_count = mm_cnt;
-    if(mm_cnt > 0) memcpy(rslt -> data->base,buf,mm_cnt);
-    return 0;
-}
-
-
-VTRANSFACT_IMPL ( ALIGN_generate_mismatch_qual, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->u.rf = generate_mismatch_qual_impl;
-    rslt->variant = vftRow;
-    rslt -> self = NULL;
-    rslt -> whack = NULL;
-    return 0;
-}
-
-
-
-/*
- * function ascii NCBI:align:get_mismatch_read #1
- *    ( bool has_mismatch, INSDC:dna:text mismatch )
- */
-static
-rc_t CC get_mismatch_read_impl ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    char *result;
-    unsigned const readlen = argv[0].u.data.elem_count;
-    
-    rslt->data->elem_bits = sizeof(result[0]) * 8;
-    rslt->elem_count = readlen;
-    rc = KDataBufferResize(rslt->data, rslt->elem_count);
-    if (rc == 0) {
-        unsigned i;
-        unsigned j;
-        bool const *has_mismatch = argv[0].u.data.base;
-        char const *mismatch = argv[1].u.data.base;
-        
-        assert(argv[0].u.data.elem_bits == sizeof(has_mismatch[0]) * 8);
-        has_mismatch += argv[0].u.data.first_elem;
-        
-        assert(argv[1].u.data.elem_bits == sizeof(mismatch[0]) * 8);
-        mismatch += argv[1].u.data.first_elem;
-        
-        result = rslt->data->base;
-        for (i = j = 0; i != readlen; ++i) {
-            result[i] = has_mismatch[i] ? mismatch[j++] : '=';
-        }
-    }
-    return rc;
-}
-
-VTRANSFACT_IMPL ( NCBI_align_get_mismatch_read, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->u.rf = get_mismatch_read_impl;
-    rslt->variant = vftRow;
-    rslt -> self = NULL;
-    rslt -> whack = NULL;
-    return 0;
-}
-
-
-
-/*
- * function INSDC:coord:len NCBI:align:get_left_soft_clip #1 (
- *     bool has_ref_offset, INSDC:coord:zero ref_offset )
- */
-static
-rc_t CC left_soft_clip_impl ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    INSDC_coord_len result;
-    unsigned const n_offsets = argv[1].u.data.elem_count;
-    
-    result = 0;
-    
-    if (n_offsets > 0) {
-        bool const *has_ref_offset = argv[0].u.data.base;
-        int32_t const *ref_offset = argv[1].u.data.base;
-        
-        assert(argv[0].u.data.elem_bits == sizeof(has_ref_offset[0]) * 8);
-        assert(argv[1].u.data.elem_bits == sizeof(ref_offset[0]) * 8);
-        
-        has_ref_offset += argv[0].u.data.first_elem;
-        ref_offset += argv[1].u.data.first_elem;
-        
-        if (has_ref_offset[0] && ref_offset[0] < 0) {
-            result = -ref_offset[0];
-        }
-    }
-    rslt->data->elem_bits = sizeof(result) * 8;
-    rslt->elem_count = 1;
-    rc = KDataBufferResize(rslt->data, 1);
-    if (rc == 0)
-        memcpy(rslt->data->base, &result, sizeof(result));
-    return rc;
-}
-
-static
-rc_t CC left_soft_clip_impl_2 ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    INSDC_coord_len* result;
-    const bool* has_ref_offset = argv[0].u.data.base;
-    const int32_t* ref_offset = argv[1].u.data.base;
-    const uint64_t n_offsets = argv[1].u.data.elem_count;
-    const INSDC_coord_len* read_len = argv[2].u.data.base;
-    const uint32_t nreads = argv[2].u.data.elem_count;
-    uint32_t n, roi;
-    INSDC_coord_zero start;
-
-    assert(argv[0].u.data.elem_bits == sizeof(has_ref_offset[0]) * 8);
-    assert(argv[1].u.data.elem_bits == sizeof(ref_offset[0]) * 8);
-    assert(argv[2].u.data.elem_bits == sizeof(read_len[0]) * 8);
-    
-    has_ref_offset += argv[0].u.data.first_elem;
-    ref_offset += argv[1].u.data.first_elem;
-    read_len += argv[2].u.data.first_elem;
-
-    rslt->data->elem_bits = sizeof(*result) * 8;
-    rslt->elem_count = nreads;
-    rc = KDataBufferResize(rslt->data, rslt->elem_count);
-    result = rslt->data->base;
-
-    for(n = roi = start = 0; rc == 0 && n < nreads; start += read_len[n++]) {
-        if(has_ref_offset[start] && ref_offset[roi] < 0) {
-            if( roi >= n_offsets ) {
-                rc = RC(rcXF, rcFunction, rcExecuting, rcData, rcInvalid);
-                break;
-            }
-            result[n] = -ref_offset[roi];
-        } else {
-            result[n] = 0;
-        }
-        if( n < nreads - 1 && roi < n_offsets ) {
-            /* scroll through has_ref_offset and consume ref_offsets for this read
-               only if there is next read or more offsets */
-            uint32_t k;
-            for(k = start; k < start + read_len[n]; k++) {
-                if( has_ref_offset[k] ) {
-                    if( roi >= n_offsets ) {
-                        rc = RC(rcXF, rcFunction, rcExecuting, rcData, rcInvalid);
-                        break;
-                    }
-                    roi++;
-                }
-            }
-        }
-    }
-    return rc;
-}
-
-VTRANSFACT_IMPL ( NCBI_align_get_left_soft_clip, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->u.rf = left_soft_clip_impl;
-    rslt->variant = vftRow;
-    rslt -> self = NULL;
-    rslt -> whack = NULL;
-    return 0;
-}
-
-VTRANSFACT_IMPL ( NCBI_align_get_left_soft_clip_2, 2, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->u.rf = left_soft_clip_impl_2;
-    rslt->variant = vftRow;
-    rslt -> self = NULL;
-    rslt -> whack = NULL;
-    return 0;
-}
-
-/*
- * function INSDC:coord:len NCBI:align:get_right_soft_clip #1 ( 
- *     bool has_mismatch, INSDC:coord:len left_clip )
- */
-static
-rc_t CC right_soft_clip_impl ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    INSDC_coord_len result = 0;
-    INSDC_coord_len left = 0;
-    uint32_t    right = argv[0].u.data.elem_count;
-    bool const *has_mismatch = argv[0].u.data.base;
-    bool const *has_ref_offset = NULL;
-    int32_t    last_ref_offset = 0;
-    
-    assert(argv[0].u.data.elem_bits == sizeof(has_mismatch[0]) * 8);
-    has_mismatch += argv[0].u.data.first_elem;
-    
-    if( argc > 2 ) {
-        has_ref_offset = argv[2].u.data.base;
-        has_ref_offset += argv[2].u.data.first_elem;
-        if(argc > 3 ) {
-            const int32_t *ro = argv[3].u.data.base;
-            ro += argv[3].u.data.first_elem;
-            if(argv[3].u.data.elem_count > 0){
-                last_ref_offset = ro[argv[3].u.data.elem_count-1];
-            }
-        }
-    }
-    
-    assert(argv[1].u.data.elem_bits == sizeof(left) * 8);
-    left = ((INSDC_coord_len const *)argv[1].u.data.base)[argv[1].u.data.first_elem];
-    
-    while (right != left && has_mismatch[right - 1] &&
-           (has_ref_offset == NULL || has_ref_offset[right - 1] == 0) )
-    {
-        ++result;
-        --right;
-    }
-    while(right > 0 && last_ref_offset <0 && has_ref_offset[right - 1] == 0){ /*** some mismatches from left needs to be recovered to cover for inserts **/
-        last_ref_offset++;
-        right--;
-    }
-    if(last_ref_offset < -1 ){
-        last_ref_offset ++;
-        if(result < -last_ref_offset) result=0;
-        else result += last_ref_offset;
-    } else if (last_ref_offset > 0){
-	result += last_ref_offset;
-    }
-    
-    rslt->data->elem_bits = sizeof(result) * 8;
-    rslt->elem_count = 1;
-    rc = KDataBufferResize(rslt->data, 1);
-    if (rc == 0)
-        memcpy(rslt->data->base, &result, sizeof(result));
-    return rc;
-}
-
-VTRANSFACT_IMPL ( NCBI_align_get_right_soft_clip, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->u.rf = right_soft_clip_impl;
-    rslt->variant = vftRow;
-    rslt -> self = NULL;
-    rslt -> whack = NULL;
-    return 0;
-}
-
-VTRANSFACT_IMPL ( NCBI_align_get_right_soft_clip_2, 2, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->u.rf = right_soft_clip_impl;
-    rslt->variant = vftRow;
-    rslt -> self = NULL;
-    rslt -> whack = NULL;
-    return 0;
-}
-
-
-/*
- * function INSDC:coord:len NCBI:align:get_right_soft_clip #3 
- *     ( bool has_ref_offset, I32 ref_offset, INSDC:coord:len ref_len )
- */
-static
-rc_t CC right_soft_clip_3_impl ( void *data, const VXformInfo *info, int64_t row_id,
-                              VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    INSDC_coord_len const ref_len = ((INSDC_coord_len const *)argv[2].u.data.base)[argv[2].u.data.first_elem];
-    unsigned const seq_len = argv[0].u.data.elem_count;
-    int32_t const *ref_offset  = &((int32_t const *)argv[1].u.data.base)[argv[1].u.data.first_elem];
-    unsigned const n = argv[1].u.data.elem_count;
-    
-    assert(argv[1].u.data.elem_bits == sizeof(ref_offset    [0]) * 8);
-    assert(argv[2].u.data.elem_bits == sizeof(ref_len          ) * 8);
-
-    rslt->data->elem_bits = rslt->elem_bits;
-    rslt->elem_count = 1;
-    rc = KDataBufferResize(rslt->data, 1);
-    if (rc == 0)
-        ((INSDC_coord_len *)rslt->data->base)[0] = right_soft_clip(seq_len, ref_len, n, ref_offset);
-    return rc;
-}
-
-VTRANSFACT_IMPL ( NCBI_align_get_right_soft_clip_3, 3, 0, 0 )
-    ( const void *Self, const VXfactInfo *info, VFuncDesc *rslt,
-      const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->u.rf = right_soft_clip_3_impl;
-    rslt->variant = vftRow;
-    rslt -> self = NULL;
-    rslt -> whack = NULL;
-    return 0;
-}
-
-static
-rc_t CC right_soft_clip_4_impl ( void *data, const VXformInfo *info, int64_t row_id,
-                                 VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    INSDC_coord_len* result;
-    const bool* has_ref_offset = argv[0].u.data.base;
-    const int32_t* ref_offset = argv[1].u.data.base;
-    const uint64_t n_offsets = argv[1].u.data.elem_count;
-    const INSDC_coord_len* read_len = argv[2].u.data.base;
-    const uint32_t nreads = argv[2].u.data.elem_count;
-    const INSDC_coord_len* ref_len = argv[3].u.data.base;
-    uint32_t n, roi;
-    INSDC_coord_zero start;
-
-    assert(argv[0].u.data.elem_bits == sizeof(has_ref_offset[0]) * 8);
-    assert(argv[1].u.data.elem_bits == sizeof(ref_offset[0]) * 8);
-    assert(argv[2].u.data.elem_bits == sizeof(read_len[0]) * 8);
-    assert(argv[3].u.data.elem_bits == sizeof(ref_len[0]) * 8);
-    assert(argv[3].u.data.elem_count == 1);
-    
-    has_ref_offset += argv[0].u.data.first_elem;
-    ref_offset += argv[1].u.data.first_elem;
-    read_len += argv[2].u.data.first_elem;
-    ref_len += argv[3].u.data.first_elem;
-
-    rslt->data->elem_bits = sizeof(*result) * 8;
-    rslt->elem_count = nreads;
-    rc = KDataBufferResize(rslt->data, rslt->elem_count);
-    result = rslt->data->base;
-
-    for(n = roi = start = 0; rc == 0 && n < nreads; ++n) {
-        INSDC_coord_len const rlen = read_len[n];
-        unsigned k;
-        unsigned offset_count;
-        
-        for (k = offset_count = 0; k < rlen; ++k) {
-            if (has_ref_offset[k + start])
-                ++offset_count;
-        }
-        result[n] = right_soft_clip(rlen, ref_len[0], offset_count, ref_offset);
-        ref_offset += offset_count;
-        start += rlen;
-#if 0
-        result[n] = read_len[n] - ref_len[0];
-        for(k = start; k < start + read_len[n]; k++) {
-            if( has_ref_offset[k] ) {
-                if( roi >= n_offsets ) {
-                    rc = RC(rcXF, rcFunction, rcExecuting, rcData, rcInvalid);
-                    break;
-                }
-                result[n] += ref_offset[roi++];
-            }
-        }
-#endif
-    }
-    return rc;
-}
-
-VTRANSFACT_IMPL ( NCBI_align_get_right_soft_clip_4, 4, 0, 0 )
-    ( const void *Self, const VXfactInfo *info, VFuncDesc *rslt,
-      const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->u.rf = right_soft_clip_4_impl;
-    rslt->variant = vftRow;
-    rslt -> self = NULL;
-    rslt -> whack = NULL;
-    return 0;
-}
-
-/*
- * function ascii NCBI:align:get_clipped_cigar #1 ( ascii cigar )
- */
-static
-rc_t CC clipped_cigar_impl ( void *data, const VXformInfo *info, int64_t row_id,
-                              VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    char const *cigar = argv[0].u.data.base;
-    unsigned const ciglen = argv[0].u.data.elem_count;
-    int n;
-    unsigned start = 0;
-    unsigned end = ciglen;
-    
-    assert(argv[0].u.data.elem_bits == sizeof(cigar[0]) * 8);
-    cigar += argv[0].u.data.first_elem;
-    
-    for (n = 0; n != ciglen; ++n) {
-        if (!isdigit(cigar[n]))
-            break;
-    }
-    if (cigar[n] == 'S')
-        start = n + 1;
-    
-    if (cigar[end - 1] == 'S') {
-        --end;
-        while (end > start && isdigit(cigar[end - 1]))
-            --end;
-    }
-    
-    rslt->data->elem_bits = sizeof(cigar[0]) * 8;
-    rslt->elem_count = (end > start)? end - start:0;
-    rc = KDataBufferResize(rslt->data, rslt->elem_count);
-    if (rc == 0 && rslt->elem_count > 0)
-        memcpy(rslt->data->base, &cigar[start], rslt->elem_count);
-    
-    return rc;
-}
-
-static
-rc_t CC clipped_cigar_impl_v2 ( void *data, const VXformInfo *info, int64_t row_id,
-                                VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc = 0;
-    const char* cigar = argv[0].u.data.base;
-    const INSDC_coord_len* cigar_len = argv[1].u.data.base;
-    const uint32_t nreads = argv[1].u.data.elem_count;
-    INSDC_coord_len* new_cigar_len;
-    uint32_t n;
-    INSDC_coord_zero rstart;
-    
-    assert(argv[0].u.data.elem_bits == sizeof(*cigar) * 8);
-    assert(argv[1].u.data.elem_bits == sizeof(*cigar_len) * 8);
-
-    if (argv[0].u.data.elem_count == 0) {
-        return KDataBufferResize(rslt->data, rslt->elem_count = 0);
-    }
-    
-    cigar += argv[0].u.data.first_elem;
-    cigar_len += argv[1].u.data.first_elem;
-
-    if( data != NULL ) {
-        rslt->data->elem_bits = sizeof(*cigar_len) * 8;
-        rslt->elem_count = nreads;
-        rc = KDataBufferResize(rslt->data, rslt->elem_count);
-        new_cigar_len = rslt->data->base;
-    } else {
-        rslt->elem_count = 0;
-        rslt->data->elem_bits = sizeof(*cigar) * 8;
-    }
-    for(n = rstart = 0; n < nreads; rstart += cigar_len[n++]) {
-        INSDC_coord_zero i = rstart, start = rstart;
-        INSDC_coord_zero end = start + cigar_len[n];
-
-        /* drop all \d+S groups at head */
-        while(i < end) {
-            if(cigar[i] == 'S') {
-                start = i + 1;
-            } else if( !isdigit(cigar[i]) ) {
-                break;
-            }
-            i++;
-        }
-        /* drop all \d+S groups at tail */
-        while(end > start) {
-            end--;
-            if(cigar[end] != 'S' && !isdigit(cigar[end]) ) {
-                break;
-            }
-        }
-        if( data == NULL ) {
-            int64_t x = end - start + 1;
-            if( x > 0 && (rc = KDataBufferResize(rslt->data, rslt->elem_count + x)) == 0 ) {
-                char* b = rslt->data->base;
-                memcpy(&b[rslt->elem_count], &cigar[start], x);
-                rslt->elem_count += x;
-            }
-        } else {
-            new_cigar_len[n] = end - start + 1;
-        }
-    }
-    return rc;
-}
-
-VTRANSFACT_IMPL ( NCBI_align_get_clipped_cigar, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->u.rf = clipped_cigar_impl;
-    rslt->variant = vftRow;
-    rslt -> self = NULL;
-    rslt -> whack = NULL;
-    return 0;
-}
-
-VTRANSFACT_IMPL ( NCBI_align_get_clipped_cigar_2, 2, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    const VTypedesc* tp = &info->fdesc.desc;
-
-    if( tp->domain == vtdAscii && tp->intrinsic_bits == 8 ) {
-        rslt->self = NULL;
-    } else if( tp->domain == vtdUint && tp->intrinsic_bits == sizeof(INSDC_coord_len) * 8 ) {
-        rslt->self = rslt; /* something different from NULL :) */
-    } else {
-        return RC(rcXF, rcFunction, rcConstructing, rcParam, rcIncorrect);
-    }
-    rslt->u.rf = clipped_cigar_impl_v2;
-    rslt->variant = vftRow;
-    rslt->whack = NULL;
-    return 0;
-}
-
-
-
-/*
- * function I32 NCBI:align:get_clipped_ref_offset #1 (
- *     bool has_ref_offset, I32 ref_offset )
- */
-static
-rc_t CC clipped_ref_offset_impl ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    unsigned start = 0;
-    unsigned const n_offsets = argv[1].u.data.elem_count;
-    int32_t const *ref_offset = argv[1].u.data.base;
-    
-    assert(argv[1].u.data.elem_bits == sizeof(ref_offset[0]) * 8);
-    ref_offset += argv[1].u.data.first_elem;
-    
-    if (n_offsets > 0) {
-        bool const *has_ref_offset = argv[0].u.data.base;
-        
-        assert(argv[0].u.data.elem_bits == sizeof(has_ref_offset[0]) * 8);
-        has_ref_offset += argv[0].u.data.first_elem;
-        
-        if (has_ref_offset[0] && ref_offset[0] < 0)
-            start = 1;
-    }
-    rslt->data->elem_bits = sizeof(ref_offset[0]) * 8;
-    rslt->elem_count = n_offsets - start;
-    rc = KDataBufferResize(rslt->data, rslt->elem_count);
-    if (rc == 0)
-        memcpy(rslt->data->base, &ref_offset[start], sizeof(ref_offset[0]) * rslt->elem_count);
-    return rc;
-}
-
-VTRANSFACT_IMPL ( NCBI_align_get_clipped_ref_offset, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->u.rf = clipped_ref_offset_impl;
-    rslt->variant = vftRow;
-    rslt -> self = NULL;
-    rslt -> whack = NULL;
-    return 0;
-}
-
-
-
-/*
- * function INSDC:coord:len NCBI:align:get_ref_len #1 (
- *     bool has_ref_offset, I32 ref_offset, INSDC:coord:len right_clip )
- */
-static
-rc_t CC get_ref_len_impl ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    INSDC_coord_len result,right=0;
-    
-    unsigned const read_len = argv[0].u.data.elem_count;
-    unsigned const n_offsets = argv[1].u.data.elem_count;
-    bool const *hro = argv[0].u.data.base;
-    int32_t const *ref_offset = argv[1].u.data.base;
-    
-    assert(argv[1].u.data.elem_bits == sizeof(ref_offset[0]) * 8);
-    
-    hro += argv[0].u.data.first_elem;
-    ref_offset += argv[1].u.data.first_elem;
-
-    if( argc > 2 ) {
-	right = ((INSDC_coord_len*)argv[2].u.data.base)[argv[2].u.data.first_elem];
-        
-        assert(argv[2].u.data.elem_bits == sizeof(right) * 8);
-        assert(read_len >= right);
-    }
-    if( n_offsets == 0){
-	if(read_len < right) return RC(rcXF, rcFunction, rcExecuting, rcData, rcInvalid);
-	result = read_len - right;
-    } else {
-	int32_t  ires, rov;
-	unsigned i;
-	
-	if(argc > 2){/*** clipping ***/
-		for(i=0,ires=read_len - right;i<n_offsets;i++){
-			memcpy( & rov, ref_offset + i, sizeof rov );
-			ires += rov;
-        }
-	} else {
-		int32_t sum_pos,sum_neg;
-		for(i=0,sum_pos=sum_neg=0;i<n_offsets;i++){
-			memcpy( & rov, ref_offset + i, sizeof rov );
-			if (rov > 0) sum_pos += rov;
-			else         sum_neg += rov;            
-		}
-		if(sum_pos + sum_neg >= 0){/** all offsets may not over-shorten needed reference ***/
-			ires = read_len + sum_pos + sum_neg;
-		} else { /** inefficient case - exact reach into the reference is needed **/
-			unsigned j;
-			for(i=0,j=0,sum_pos=0,ires=0;j<read_len; j++){
-				if(hro[i]){
-					if(i >= n_offsets) return RC(rcXF, rcFunction, rcExecuting, rcData, rcInvalid);
-					memcpy( & rov, ref_offset + i, sizeof rov );
-					ires += rov;
-					i++;
-				}
-				sum_pos ++;
-				if(sum_pos > ires) ires=sum_pos;
-			}
-		}
-	}
-	if(ires < 0) return RC(rcXF, rcFunction, rcExecuting, rcData, rcInvalid);
-	result=ires;
-    }
-    rslt->data->elem_bits = sizeof(result) * 8;
-    rslt->elem_count = 1;
-    rc = KDataBufferResize(rslt->data, rslt->elem_count);
-    if (rc == 0)
-	memcpy(rslt->data->base,&result,sizeof(result));
-    return rc;
-}
-
-VTRANSFACT_IMPL ( NCBI_align_get_ref_len, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->u.rf = get_ref_len_impl;
-    rslt->variant = vftRow;
-    rslt -> self = NULL;
-    rslt -> whack = NULL;
-    return 0;
-}
-
-
-
-/*
- * function < type T > T NCBI:align:clip #1 ( T value,
- *     INSDC:coord:len left, INSDC:coord:len right )
- */
-static
-rc_t CC clip_impl ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    INSDC_coord_len left =  ((INSDC_coord_len const *)argv[1].u.data.base)[argv[1].u.data.first_elem];
-    INSDC_coord_len right = ((INSDC_coord_len const *)argv[2].u.data.base)[argv[2].u.data.first_elem];
-
-    rslt->data->elem_bits = argv[0].u.data.elem_bits;
-    if (argv[0].u.data.elem_count >= left + right)
-        rslt->elem_count = argv[0].u.data.elem_count - left - right;
-    else
-        rslt->elem_count = 0;
-    rc = KDataBufferResize(rslt->data, rslt->elem_count);
-    if (rc == 0) {
-        if ((rslt->data->elem_bits & 7) == 0)
-            memcpy(rslt->data->base,
-                   &((char const *)argv[0].u.data.base)[((left + argv[0].u.data.first_elem) * argv[0].u.data.elem_bits) >> 3],
-                   (rslt->elem_count * rslt->data->elem_bits) >> 3);
-        else
-            bitcpy(rslt->data->base, 0, argv[0].u.data.base,
-                   (left + argv[0].u.data.first_elem) * argv[0].u.data.elem_bits,
-                   rslt->elem_count * rslt->data->elem_bits);
-    }
-    return rc;
-}
-
-VTRANSFACT_IMPL ( NCBI_align_clip, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->u.rf = clip_impl;
-    rslt->variant = vftRow;
-    rslt -> self = NULL;
-    rslt -> whack = NULL;
-    return 0;
-}
-
-static
-rc_t CC clip_impl_2 ( void *data, const VXformInfo *info, int64_t row_id,
-                      VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    const INSDC_coord_len* read_len = argv[1].u.data.base;
-    const uint32_t nreads = argv[1].u.data.elem_count;
-    const INSDC_coord_len* left =  argv[2].u.data.base;
-    const INSDC_coord_len* right = argv[3].u.data.base;
-    uint32_t n;
-    INSDC_coord_zero start;
-
-    assert(argv[1].u.data.elem_count == argv[2].u.data.elem_count);
-    assert(argv[1].u.data.elem_count == argv[3].u.data.elem_count);
-    assert(argv[1].u.data.elem_bits == sizeof(read_len[0]) * 8);
-    assert(argv[2].u.data.elem_bits == sizeof(left[0]) * 8);
-    assert(argv[2].u.data.elem_bits == sizeof(right[0]) * 8);
-
-    read_len += argv[1].u.data.first_elem;
-    left += argv[2].u.data.first_elem;
-    right += argv[3].u.data.first_elem;
-
-    rslt->data->elem_bits = argv[0].u.data.elem_bits;
-    rslt->elem_count = 0;
-    rc = KDataBufferResize(rslt->data, rslt->elem_count);
-    if (rc)
-        return rc;
-    if (argv[0].u.data.elem_count == 0)
-        return 0;
-
-    for(n = start = 0; rc == 0 && n < nreads; start += read_len[n++]) {
-        uint64_t x = left[n] + right[n];
-        assert(argv[0].u.data.elem_count >= start);
-        assert(argv[0].u.data.elem_count >= start + read_len[n]);
-        if( read_len[n] > x ) {
-            x = read_len[n] - x;
-            if( x > 0 && (rc = KDataBufferResize(rslt->data, rslt->elem_count + x)) == 0) {
-                bitcpy(rslt->data->base, rslt->elem_count * argv[0].u.data.elem_bits,
-                       argv[0].u.data.base, (argv[0].u.data.first_elem + start + left[n]) * argv[0].u.data.elem_bits,
-                       x * rslt->data->elem_bits);
-                rslt->elem_count += x;
-            }
-        }
-    }
-    return rc;
-}
-
-VTRANSFACT_IMPL ( NCBI_align_clip_2, 2, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->u.rf = clip_impl_2;
-    rslt->variant = vftRow;
-    rslt -> self = NULL;
-    rslt -> whack = NULL;
-    return 0;
-}
-
-/*
- * function bool NCBI:align:get_ref_mismatch #1
- *     ( bool has_mismatch, bool has_ref_offset, I32 ref_offset,
- *       INSDC:coord:len ref_len )
- */
-static
-rc_t CC get_ref_mismatch_impl ( void *data, const VXformInfo *info, int64_t row_id,
-                   VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    bool const *has_mismatch       = argv [ 0 ] . u . data . base;
-    bool const *has_ref_offset     = argv [ 1 ] . u . data . base;
-    int32_t const *ref_offset      = argv [ 2 ] . u . data . base;
-    INSDC_coord_len const *ref_len = argv [ 3 ] . u . data . base; 
-    
-    assert(argv[0].u.data.elem_bits == sizeof(has_mismatch[0]) * 8);
-    assert(argv[1].u.data.elem_bits == sizeof(has_ref_offset[0]) * 8);
-    assert(argv[2].u.data.elem_bits == sizeof(ref_offset[0]) * 8);
-    assert(argv[3].u.data.elem_bits == sizeof(ref_len[0]) * 8);
-    
-    has_mismatch   += argv[0].u.data.first_elem;
-    has_ref_offset += argv[1].u.data.first_elem;
-    ref_offset     += argv[2].u.data.first_elem;
-    
-    rslt->data->elem_bits = sizeof(bool) * 8;
-    rslt->elem_count = ref_len[argv[3].u.data.first_elem];
-    rc = KDataBufferResize(rslt->data, rslt->elem_count);
-    if (rc == 0) {
-        bool *result = (bool *)rslt->data->base;
-        unsigned j;
-        unsigned ri;
-        unsigned si;
-        
-        memset(result, 0, sizeof(result[0]) * rslt->elem_count);
-        for (j = ri = si = 0; si < argv[0].u.data.elem_count;) {
-            if (has_ref_offset[si]) {
-                int offset = ref_offset[j++];
-                
-                if (offset > 0)
-                    ri += offset;
-                else {
-                    si -= offset;
-                    continue;
-                }
-            }
-            if (ri >= rslt->elem_count) break;
-            if (has_mismatch[si]) {
-                result[ri] = 1;
-            }
-            ++si;
-            ++ri;
-        }
-    }
-    return rc;
-}
-
-VTRANSFACT_IMPL ( NCBI_align_get_ref_mismatch, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->u.rf = get_ref_mismatch_impl;
-    rslt->variant = vftRow;
-    rslt -> self = NULL;
-    rslt -> whack = NULL;
-    return 0;
-}
-
-
-
-/*
- * function bool NCBI:align:get_ref_insert #1
- *     ( bool has_mismatch, bool has_ref_offset, I32 ref_offset,
- *       INSDC:coord:len ref_len )
- */
-static
-rc_t CC get_ref_insert_impl ( void *data, const VXformInfo *info, int64_t row_id,
-                               VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    bool const *has_mismatch       = argv [ 0 ] . u . data . base;
-    bool const *has_ref_offset     = argv [ 1 ] . u . data . base;
-    int32_t const *ref_offset      = argv [ 2 ] . u . data . base;
-    INSDC_coord_len const *ref_len = argv [ 3 ] . u . data . base; 
-    
-    assert(argv[0].u.data.elem_bits == sizeof(has_mismatch[0]) * 8);
-    assert(argv[1].u.data.elem_bits == sizeof(has_ref_offset[0]) * 8);
-    assert(argv[2].u.data.elem_bits == sizeof(ref_offset[0]) * 8);
-    assert(argv[3].u.data.elem_bits == sizeof(ref_len[0]) * 8);
-    
-    has_mismatch   += argv[0].u.data.first_elem;
-    has_ref_offset += argv[1].u.data.first_elem;
-    ref_offset     += argv[2].u.data.first_elem;
-    
-    rslt->data->elem_bits = sizeof(bool) * 8;
-    rslt->elem_count = ref_len[argv[3].u.data.first_elem];
-    rc = KDataBufferResize(rslt->data, rslt->elem_count);
-    if (rc == 0) {
-        bool *result = (bool *)rslt->data->base;
-        unsigned j;
-        unsigned ri;
-        unsigned si;
-        
-        memset(result, 0, sizeof(result[0]) * rslt->elem_count);
-        for (j = ri = si = 0; si < argv[0].u.data.elem_count;) {
-            if (has_ref_offset[si]) {
-                int offset = ref_offset[j++];
-                
-                if (offset > 0) {
-                    ri += offset;
-                }
-                else {
-                    if (si) {
-                        if (ri >= 1) result[ri-1] = 1;
-                        result[ri] = 1;
-                    }
-                    si -= offset;
-                    continue;
-                }
-            }
-            ++si;
-            ++ri;
-        }
-    }
-    return rc;
-}
-
-VTRANSFACT_IMPL ( NCBI_align_get_ref_insert, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->u.rf = get_ref_insert_impl;
-    rslt->variant = vftRow;
-    rslt -> self = NULL;
-    rslt -> whack = NULL;
-    return 0;
-}
-
-
-
-/*
- * function bool NCBI:align:get_ref_delete #1
- *     ( bool has_mismatch, bool has_ref_offset, I32 ref_offset,
- *       INSDC:coord:len ref_len )
- */
-static
-rc_t CC get_ref_delete_impl ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    bool const *has_mismatch       = argv [ 0 ] . u . data . base;
-    bool const *has_ref_offset     = argv [ 1 ] . u . data . base;
-    int32_t const *ref_offset      = argv [ 2 ] . u . data . base;
-    INSDC_coord_len const *ref_len = argv [ 3 ] . u . data . base; 
-    
-    assert(argv[0].u.data.elem_bits == sizeof(has_mismatch[0]) * 8);
-    assert(argv[1].u.data.elem_bits == sizeof(has_ref_offset[0]) * 8);
-    assert(argv[2].u.data.elem_bits == sizeof(ref_offset[0]) * 8);
-    assert(argv[3].u.data.elem_bits == sizeof(ref_len[0]) * 8);
-    
-    has_mismatch   += argv[0].u.data.first_elem;
-    has_ref_offset += argv[1].u.data.first_elem;
-    ref_offset     += argv[2].u.data.first_elem;
-    
-    rslt->data->elem_bits = sizeof(bool) * 8;
-    rslt->elem_count = ref_len[argv[3].u.data.first_elem];
-    rc = KDataBufferResize(rslt->data, rslt->elem_count);
-    if (rc == 0) {
-        bool *result = (bool *)rslt->data->base;
-        unsigned j;
-        unsigned ri;
-        unsigned si;
-        
-        memset(result, 0, sizeof(result[0]) * rslt->elem_count);
-        for (j = ri = si = 0; si < argv[0].u.data.elem_count;) {
-            if (has_ref_offset[si]) {
-                int offset = ref_offset[j++];
-                
-                if (offset > 0) {
-                    memset(&result[ri], 1, offset);
-                    ri += offset;
-                }
-                else {
-                    si -= offset;
-                    continue;
-                }
-            }
-            ++si;
-            ++ri;
-        }
-    }
-    return rc;
-}
-
-VTRANSFACT_IMPL ( NCBI_align_get_ref_delete, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->u.rf = get_ref_delete_impl;
-    rslt->variant = vftRow;
-    rslt -> self = NULL;
-    rslt -> whack = NULL;
-    return 0;
-}
-
-
-
-#define USE_BIGGER_PRESERVE_BORDER 1
-/*
- * function bool NCBI:align:get_preserve_qual #1
- *     ( bool has_mismatch, bool has_ref_offset, I32 ref_offset,
- *       INSDC:coord:len ref_len )
- */
-static
-rc_t CC get_ref_preserve_qual_impl ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    bool const *has_mismatch       = argv [ 0 ] . u . data . base;
-    bool const *has_ref_offset     = argv [ 1 ] . u . data . base;
-    int32_t const *ref_offset      = argv [ 2 ] . u . data . base;
-    INSDC_coord_len const *ref_len = argv [ 3 ] . u . data . base; 
-    
-    assert(argv[0].u.data.elem_bits == sizeof(has_mismatch[0]) * 8);
-    assert(argv[1].u.data.elem_bits == sizeof(has_ref_offset[0]) * 8);
-    assert(argv[2].u.data.elem_bits == sizeof(ref_offset[0]) * 8);
-    assert(argv[3].u.data.elem_bits == sizeof(ref_len[0]) * 8);
-    
-    has_mismatch   += argv[0].u.data.first_elem;
-    has_ref_offset += argv[1].u.data.first_elem;
-    ref_offset     += argv[2].u.data.first_elem;
-    
-    rslt->data->elem_bits = sizeof(bool) * 8;
-    rslt->elem_count = ref_len[argv[3].u.data.first_elem];
-    rc = KDataBufferResize(rslt->data, rslt->elem_count);
-    if (rc == 0) {
-        bool *result = (bool *)rslt->data->base;
-        unsigned j;
-        unsigned ri;
-        unsigned si;
-        
-        memset(result, 0, sizeof(result[0]) * rslt->elem_count);
-        for (j = ri = si = 0; si < argv[0].u.data.elem_count;) {
-            if (has_ref_offset[si]) {
-                int offset = ref_offset[j++];
-                
-                if (offset > 0) {
-                    /* Preserve the qualities for deleted bases + plus the border */
-#if USE_BIGGER_PRESERVE_BORDER
-                    if (ri >= 2) result[ri-2] = 1;
-#endif
-                    if (ri >= 1) result[ri-1] = 1;
-                    memset(&result[ri], 1, offset);
-                    ri += offset;
-                    result[ri] = 1;
-#if USE_BIGGER_PRESERVE_BORDER
-                    if (ri + 1 < rslt->elem_count) result[ri+1] = 1;
-#endif
-                }
-                else {
-                    if (si) {
-                        /* Preserve the qualites for the bases bordering the insert */
-#if USE_BIGGER_PRESERVE_BORDER
-                        if (ri >= 2) result[ri-2] = 1;
-#endif
-                        if (ri >= 1) result[ri-1] = 1;
-                        result[ri] = 1;
-#if USE_BIGGER_PRESERVE_BORDER
-                        if (ri + 1 < rslt->elem_count) result[ri+1] = 1;
-#endif
-                    }
-                    si -= offset;
-                    continue;
-                }
-            }
-            if (ri >= rslt->elem_count) break;
-            if (has_mismatch[si]) {
-#if USE_BIGGER_PRESERVE_BORDER
-                if (ri >= 1) result[ri-1] = 1;
-#endif
-                result[ri] = 1;
-#if USE_BIGGER_PRESERVE_BORDER
-                if (ri + 1 < rslt->elem_count) result[ri+1] = 1;
-#endif
-            }
-            ++si;
-            ++ri;
-        }
-    }
-    return rc;
-}
-
-VTRANSFACT_IMPL ( NCBI_align_get_ref_preserve_qual, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->u.rf = get_ref_preserve_qual_impl;
-    rslt->variant = vftRow;
-    rslt -> self = NULL;
-    rslt -> whack = NULL;
-    return 0;
-}
-
-
-
-/*
- * function bool NCBI:align:get_seq_preserve_qual #1
- *    ( bool ref_preserve_qual, bool has_ref_offset, I32 ref_offset );
- */
-static
-rc_t CC get_seq_preserve_qual_impl ( void *data, const VXformInfo *info, int64_t row_id,
-                                    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    bool const *ref_pq             = argv [ 0 ] . u . data . base;
-    bool const *has_ref_offset     = argv [ 1 ] . u . data . base;
-    int32_t const *ref_offset      = argv [ 2 ] . u . data . base;
-    
-    assert(argv[0].u.data.elem_bits == sizeof(ref_pq[0]) * 8);
-    assert(argv[1].u.data.elem_bits == sizeof(has_ref_offset[0]) * 8);
-    assert(argv[2].u.data.elem_bits == sizeof(ref_offset[0]) * 8);
-    
-    ref_pq         += argv[0].u.data.first_elem;
-    has_ref_offset += argv[1].u.data.first_elem;
-    ref_offset     += argv[2].u.data.first_elem;
-    
-    rslt->data->elem_bits = sizeof(bool) * 8;
-    rslt->elem_count = argv[1].u.data.elem_count;
-    rc = KDataBufferResize(rslt->data, rslt->elem_count);
-    if (rc == 0) {
-        bool *result = (bool *)rslt->data->base;
-        unsigned j;
-        unsigned ri;
-        unsigned si;
-        
-        memset(result, 1, sizeof(result[0]) * rslt->elem_count);
-        for (j = ri = si = 0; si < argv[1].u.data.elem_count;) {
-            if (has_ref_offset[si]) {
-                int offset = ref_offset[j++];
-                
-                if (offset > 0) {
-                    ri += offset;
-                }
-                else {
-                    si -= offset;
-                    continue;
-                }
-            }
-            if (ri >= argv[0].u.data.elem_count) break;
-            result[si] = ref_pq[ri];
-            ++si;
-            ++ri;
-        }
-    }
-    return rc;
-}
-
-VTRANSFACT_IMPL ( NCBI_align_get_seq_preserve_qual, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-                                                               VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->u.rf = get_seq_preserve_qual_impl;
-    rslt->variant = vftRow;
-    rslt -> self = NULL;
-    rslt -> whack = NULL;
-    return 0;
-}
diff --git a/libs/axf/generate-mismatch-qual.c b/libs/axf/generate-mismatch-qual.c
deleted file mode 100644
index 5adbd09..0000000
--- a/libs/axf/generate-mismatch-qual.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-
-#include <vdb/xform.h>
-#include <vdb/database.h>
-#include <vdb/table.h>
-#include <vdb/cursor.h>
-#include <vdb/vdb-priv.h>
-#include <insdc/insdc.h>
-#include <klib/data-buffer.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <bitstr.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-enum args {
-    QUAL,
-    HAS_MISMATCH,
-    LEFT_CLIP,
-    RIGHT_CLIP
-};
-
-static
-rc_t CC generate_mismatch_qual ( void *data, const VXformInfo *info,
-    int64_t row_id, VRowResult *rslt, uint32_t argc, const VRowData argv[] )
-{
-    INSDC_quality_phred const *qual = argv[QUAL].u.data.base;
-    bool const *has_mismatch = argv[HAS_MISMATCH].u.data.base;
-    INSDC_coord_len const *left  = argv[LEFT_CLIP].u.data.base;
-    INSDC_coord_len const *right = argv[RIGHT_CLIP].u.data.base;
-    unsigned const readlen = argv[QUAL].u.data.elem_count;
-    INSDC_quality_phred *dst;
-    rc_t rc;
-    unsigned i;
-    unsigned j;
-    
-    assert(argv[QUAL].u.data.elem_bits == sizeof(qual[0]) * 8);
-    assert(argv[HAS_MISMATCH].u.data.elem_bits == sizeof(has_mismatch[0]) * 8);
-    assert(argv[LEFT_CLIP].u.data.elem_bits == sizeof(left[0]) * 8);
-    assert(argv[RIGHT_CLIP].u.data.elem_bits == sizeof(right[0]) * 8);
-    assert(argv[HAS_MISMATCH].u.data.elem_count == readlen);
-    
-    qual += argv[QUAL].u.data.first_elem;
-    has_mismatch += argv[HAS_MISMATCH].u.data.first_elem;
-    left  += argv[LEFT_CLIP ].u.data.first_elem;
-    right += argv[RIGHT_CLIP].u.data.first_elem;
-    
-    rslt->data->elem_bits = argv[QUAL].u.data.elem_bits;
-    rc = KDataBufferResize(rslt->data, argv[QUAL].u.data.elem_count);
-    if (rc)
-        return rc;
-    dst = rslt->data->base;
-    
-    for (j = 0, i = left[0]; i != readlen - right[0]; ++i) {
-        if (has_mismatch[i])
-            dst[j++] = qual[i];
-    }
-    rslt->elem_count = j;
-    return 0;
-}
-
-/*
- * function INSDC:quality:phred NCBI:align:generate_mismatch_qual #2 (
- *    INSDC:quality:phred qual, bool has_mismatch,
- *    INSDC:coord:len left_clip, INSDC:coord:len right_clip );
- */
-VTRANSFACT_IMPL ( NCBI_align_generate_mismatch_qual_2, 2, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt -> u . rf = generate_mismatch_qual;
-    rslt -> variant = vftRow;
-    
-    return 0;
-}
-
-static
-rc_t CC compress_quality_impl ( void *data, const VXformInfo *info,
-    int64_t row_id, VRowResult *rslt, uint32_t argc, const VRowData argv[] )
-{
-    INSDC_quality_phred const *qual = argv[0].u.data.base;
-    bool const *preserve = argv[1].u.data.base;
-    unsigned const readlen = argv[0].u.data.elem_count;
-    INSDC_quality_phred *dst;
-    rc_t rc;
-    unsigned i;
-    unsigned j;
-    
-    assert(argv[0].u.data.elem_bits == sizeof(qual[0]) * 8);
-    assert(argv[1].u.data.elem_bits == sizeof(preserve[0]) * 8);
-    assert(argv[1].u.data.elem_count == readlen);
-    
-    qual += argv[0].u.data.first_elem;
-    preserve += argv[1].u.data.first_elem;
-    
-    rslt->data->elem_bits = argv[0].u.data.elem_bits;
-    rc = KDataBufferResize(rslt->data, argv[0].u.data.elem_count);
-    if (rc)
-        return rc;
-    dst = rslt->data->base;
-    
-    for (j = 0, i = 0; i != readlen; ++i) {
-        if (preserve[i])
-            dst[j++] = qual[i];
-    }
-    rslt->elem_count = j;
-    return 0;
-}
-
-/*
- * function INSDC:quality:phred NCBI:align:compress_quality #1
- *    ( INSDC:quality:phred quality, bool preserved );
- */
-VTRANSFACT_IMPL ( NCBI_align_compress_quality, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt -> u . rf = compress_quality_impl;
-    rslt -> variant = vftRow;
-    
-    return 0;
-}
diff --git a/libs/axf/get-sam-flags.c b/libs/axf/get-sam-flags.c
deleted file mode 100644
index 4d6574f..0000000
--- a/libs/axf/get-sam-flags.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include <sra/sradb.h>
-#include <vdb/xform.h>
-#include <vdb/table.h>
-#include <klib/data-buffer.h>
-#include <klib/text.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <insdc/sra.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-
-/* "properly aligned" fragments according to the aligner
-   may mean minimally that the fragments are on the same
-   chromosome. */
-#define PROPER_ALIGNED_MEANS_SAME_CHROMOSOME 1
-
-
-static
-rc_t CC get_sam_flags_impl(void *data, const VXformInfo *info,
-                           int64_t row_id, VRowResult *rslt,
-                           uint32_t nreads,
-                           uint32_t argc, const VRowData argv [] ) 
-{
-    rc_t 	rc;
-    int32_t	*dst;
-    const INSDC_coord_one  *rid = argv[1].u.data.base; /* SEQ_READ_ID */
-    const int32_t         *tlen = argv[2].u.data.base; /* TEMPLATE_LEN */
-    const bool	           *ro1 = argv[3].u.data.base; /* REF_ORIENTATION */
-    const bool             *ro2 = argv[4].u.data.base; /* MATE_REF_ORIENTATION */
-    const bool             *sec = argv[5].u.data.base; 
-    const bool             mate_present = (argv[4].u.data.elem_count > 0 );
-    const SRAReadFilter    *flt = argc > 6 ? argv[6].u.data.base : NULL;
-
-    assert(argv[1].u.data.elem_count == 1);
-    assert(argv[2].u.data.elem_count == 1);
-    assert(argv[3].u.data.elem_count == 1);
-    assert(argv[5].u.data.elem_count == 1);
-    
-    
-    
-    rc = KDataBufferResize(rslt->data, 1);
-    if(rc != 0)
-        return rc;
-    rslt->elem_count=1;
-    dst = rslt->data->base;
-    dst[0]=0;
-    if(nreads == 0) return 0;
-    
-    
-    rid  += argv[1].u.data.first_elem;
-    tlen += argv[2].u.data.first_elem;
-    ro1  += argv[3].u.data.first_elem;
-    ro2  += argv[4].u.data.first_elem;
-    sec  += argv[5].u.data.first_elem;
-    if (flt)
-        flt += argv[6].u.data.first_elem;
-    
-    /***************** SAM FLAGS************
-      Bit  Description
-     0x001 template having multiple fragments in sequencing
-     0x002 each fragment properly aligned according to the aligner
-     0x004 fragment unmapped
-     0x008 next fragment in the template unmapped
-     0x010 SEQ being reverse complemented
-     0x020 SEQ of the next fragment in the template being reversed
-     0x040 the first fragment in the template
-     0x080 the last fragment in the template
-     0x100 secondary alignment
-     0x200 not passing quality controls
-     0x400 PCR or optical duplicate
-    ****************************/
-    if(ro1[0])
-        dst[0] |= 0x10;
-    if(sec[0])
-        dst[0] |= 0x100;
-    if(nreads > 1) {
-        if(rid[0] == 1)
-            dst[0] |= 0x40;
-        if (rid[0] == nreads)
-            dst[0] |= 0x80;
-        dst[0] |= 0x1;
-        if(mate_present) {
-#if PROPER_ALIGNED_MEANS_SAME_CHROMOSOME
-           if( tlen[0] != 0 )
-#endif
-                dst[0] |= 0x2;
-           if(ro2[0])
-                dst[0] |= 0x20;
-        } else {
-            dst[0] |= 0x8;
-        }
-    }
-    if( flt ) {
-        if( flt[0] == SRA_READ_FILTER_REJECT ) {
-            dst[0] |= 0x200;
-        } else if( flt[0] == SRA_READ_FILTER_CRITERIA ) {
-            dst[0] |= 0x400;
-        }
-    }
-    return rc;	
-}
-
-static
-rc_t CC get_sam_flags_impl_v1(void *data,const VXformInfo *info, int64_t row_id, VRowResult *rslt, uint32_t argc, const VRowData argv [] ) 
-{
-	uint32_t nreads = 0;
-    INSDC_coord_len const *read_len = argv[0].u.data.base;
-    unsigned i;
-    
-    assert(argv[0].u.data.elem_bits == sizeof(read_len[0]) * 8);
-    read_len += argv[0].u.data.first_elem;
-   
-#if 1 
-    for (i = 0, nreads = 0; i != argv[0].u.data.elem_count; ++i) {
-        if (read_len[i] != 0)
-            ++nreads;
-    }
-#else
-    nreads = argv[0].u.data.elem_count;
-#endif
-    return get_sam_flags_impl(data, info, row_id, rslt, nreads, argc, argv);
-}
-
-static
-rc_t CC get_sam_flags_impl_v2(void *data,const VXformInfo *info, int64_t row_id, VRowResult *rslt, uint32_t argc, const VRowData argv [] ) 
-{
-	uint32_t nreads = 1;
-    int64_t const *mate_id = argv[0].u.data.base;
-    unsigned i;
-    
-    assert(argv[0].u.data.elem_bits == sizeof(mate_id[0]) * 8);
-    mate_id += argv[0].u.data.first_elem;
-    
-    for (i = 0; i != argv[0].u.data.elem_count; ++i) {
-        if (mate_id[i] != 0)
-            ++nreads;
-    }
-    return get_sam_flags_impl(data, info, row_id, rslt, nreads, argc, argv);
-}
-
-/*
- * extern function U32 NCBI:align:get_sam_flags #1 (INSDC:coord:len read_len,
- *                                                  INSDC:coord:one read_id,
- *                                                  I32 template_len,
- *                                                  bool strand,
- *                                                  bool mate_strand,
- *                                                  bool is_secondary);
- *
- */
-VTRANSFACT_IMPL ( NCBI_align_get_sam_flags, 1, 0, 0 ) ( const void *self, const VXfactInfo *info, VFuncDesc *rslt,
-                                                 const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->variant = vftRow;
-    rslt->u.rf = get_sam_flags_impl_v1;
-    return 0;
-}
-
-/*
- * extern function U32 NCBI:align:get_sam_flags #2 (I64 mate_id,
- *                                                  INSDC:coord:one read_id,
- *                                                  I32 template_len,
- *                                                  bool strand,
- *                                                  bool mate_strand,
- *                                                  bool is_secondary);
- *
- */
-VTRANSFACT_IMPL ( NCBI_align_get_sam_flags_2, 2, 0, 0 ) ( const void *self, const VXfactInfo *info, VFuncDesc *rslt,
-                                                       const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->variant = vftRow;
-    rslt->u.rf = get_sam_flags_impl_v2;
-    return 0;
-}
diff --git a/libs/axf/get_mate_align_ids.c b/libs/axf/get_mate_align_ids.c
deleted file mode 100644
index d96e65d..0000000
--- a/libs/axf/get_mate_align_ids.c
+++ /dev/null
@@ -1,271 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-#include <vdb/xform.h>
-#include <vdb/database.h>
-#include <vdb/table.h>
-#include <vdb/cursor.h>
-#include <vdb/vdb-priv.h>
-
-#include <kdb/meta.h>
-
-#include <klib/rc.h>
-#include <klib/data-buffer.h>
-#include <klib/sort.h>
-#include <klib/vector.h>
-
-#include <insdc/sra.h>
-#include <insdc/insdc.h>
-
-#include <bitstr.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include <ctype.h>
-
-typedef struct ID_cache_t
-{
-    uint32_t idx;
-    VCursor const *curs;
-    KVector *j_cache;
-    KVector *p_cache;
-}ID_cache_t;
-
-#define MIN_DIFF_TO_CACHE 10000
-#define TMP_CACHE_PAGESIZE (16*1024)
-
-
-static rc_t lookup_mate(ID_cache_t *const self, int64_t const id, int64_t *mateid)
-{
-    return KVectorGetI64(self->j_cache, (uint64_t)id,mateid);
-}
-
-static rc_t cache_mate(ID_cache_t *self, int64_t id, int64_t mateid)
-{
-    return KVectorSetU64(self->j_cache, (uint64_t)id, mateid);
-}
-
-static rc_t fetch_mates(ID_cache_t *self, int64_t spotid, const int64_t **ids,uint32_t *rlen)
-{
-    rc_t rc = 0;
-    uint32_t elem_bits;
-    uint32_t boff;
-
-    rc = VCursorCellDataDirect(self->curs, spotid, self->idx,&elem_bits, (const void**) ids, &boff, rlen);
-    assert(*rlen==0 || elem_bits==64);
-    assert(boff==0);
-    return rc;
-}
-static rc_t fetch_mate_id(ID_cache_t *self, int64_t spotid, int64_t const id, int64_t *mateid)
-{
-    rc_t rc = 0;
-    uint32_t rlen;
-    int i;
-    const int64_t *base;
-
-    
-
-    rc = fetch_mates(self, spotid,&base,&rlen);
-    if(rc) return rc;
-    if (rlen > 2) return RC(rcXF, rcFunction, rcExecuting, rcConstraint, rcViolated);
-    mateid[0]=0;
-    for(i=0;i<rlen;i++){
-	if(base[i] != id) {
-		mateid[0] = base[i];
-	}
-    }
-    return rc;
-}
-
-static
-rc_t get_mate_algn_id_impl(ID_cache_t *const self,
-                          int64_t const row, int64_t rslt[],
-                          int64_t const spotid)
-{
-    rc_t rc = 0;
-    bool    page_processed=false;
-    int64_t first,first_blob,last,last_blob;
-
-    /** check cache **/
-    rc = lookup_mate(self, row, rslt);
-    if (rc == 0) return 0;
-
-    /** Page boundary is defined by the variable "first" **/
-    rc = VCursorPageIdRange(self->curs, self->idx, spotid, &first_blob, &last_blob);      if (rc) return rc;
-    first = spotid & ~(TMP_CACHE_PAGESIZE - 1 );
-    if(first < first_blob) first = first_blob;
-    last = first + TMP_CACHE_PAGESIZE -1;
-    if(last > last_blob) last = last_blob;
-
-    rc = KVectorGetBool(self->p_cache, (uint64_t)first,&page_processed);
-    if (rc == 0 && page_processed) { /*** This page was processed before. Row did not need caching. Just fetch Row being asked **/
-	return fetch_mate_id(self, spotid, row, rslt);
-    } else { /** unprocessed page **/
-	int64_t i;
-	
-	rc = KVectorSetBool(self->p_cache, (uint64_t)first,true); /** mark as processed **/
-	if(rc) return rc;
-	
-	for(i=first;i<=last;i++){
-		int64_t	ids[2]={0,0};
-		const int64_t *ptr;
-		uint32_t rlen;
-		rc = fetch_mates(self, i, &ptr,&rlen);
-		if(rc){
-			if(GetRCState ( rc ) == rcNotFound ) rc = 0;
-			else return rc;
-		}
-		memcpy(ids,ptr,rlen*sizeof(*ptr));
-		if(ids[0]!= 0 && ids[1] != 0 && labs(ids[0] - ids[1])> MIN_DIFF_TO_CACHE){
-			rc = cache_mate((ID_cache_t*)self,ids[0],ids[1]);
-			if(rc) return rc;
-			rc = cache_mate((ID_cache_t*)self,ids[1],ids[0]);
-			if(rc) return rc;
-		}
-		if(i==spotid){
-			if(ids[0] == row){
-				rslt[0] = ids[1];
-			} else if(ids[1] == row){
-				rslt[0] = ids[0];
-			} else {
-				return RC(rcXF, rcFunction, rcExecuting, rcData, rcInconsistent);
-			} 
-		}
-	}
-    }
-    return rc;
-}
-static
-rc_t CC get_mate_algn_id_drvr(void *Self,
-                              const VXformInfo *info, int64_t row_id,
-                              VRowResult *rslt,
-                              uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    ID_cache_t *self = Self;
-
-    rslt->data->elem_bits = rslt->elem_bits;
-    rc = KDataBufferResize(rslt->data, 1);
-    if (rc == 0) {
-#if 0
-        rc = get_mate_algn_id_impl(self, row_id, rslt->data->base,
-           ((int64_t const *)argv[0].u.data.base)[argv[0].u.data.first_elem]);
-#else
-	rc = fetch_mate_id(self, ((int64_t const *)argv[0].u.data.base)[argv[0].u.data.first_elem], row_id, rslt->data->base);
-#endif
-        if (rc == 0){
-	    if(*(int64_t*)rslt->data->base == 0) rslt->elem_count = 0;
-            else rslt->elem_count = 1;
-	}
-    }
-    return rc;
-}
-
-/* open_sub_cursor
- */
-static
-rc_t open_sub_cursor(ID_cache_t *self, const VXfactInfo *info, const VCursor *native_curs)
-{
-    rc_t rc;
-
-    rc = VCursorLinkedCursorGet(native_curs,"SEQUENCE",&self->curs);
-    if(rc != 0){
-	const VDatabase *db;
-	const VTable *tbl;
-	/* get at the parent database */
-	rc = VTableOpenParentRead ( info -> tbl, & db );
-	if(rc != 0) return rc;
-	/* open the table */
-	rc = VDatabaseOpenTableRead ( db, &tbl, "SEQUENCE" );
-	VDatabaseRelease ( db );
-	if(rc != 0) return rc;
-	/* create a cursor */
-	rc = VTableCreateCachedCursorRead(tbl, &self->curs,2UL*1024*1024*1024);
-	VTableRelease(tbl);
-	if(rc != 0) return rc;
-	rc = VCursorPermitPostOpenAdd( self->curs );
-	if(rc != 0) return rc;
-	rc = VCursorOpen( self->curs );
-	if(rc != 0) return rc;
-	rc = VCursorLinkedCursorSet(native_curs,"SEQUENCE",self->curs);
-	if(rc != 0) return rc;
-    } else {
-	    VCursorAddRef(self->curs);
-    }
-    rc = VCursorAddColumn(self->curs, &self->idx, "(I64)PRIMARY_ALIGNMENT_ID");
-    if (rc == 0) {
-	rc = KVectorMake(&self->j_cache);
-	if(rc==0) rc = KVectorMake(&self->p_cache);
-	if(rc==0) return 0;
-    }
-    VCursorRelease(self->curs);
-    return rc;
-}
-
-
-/* close_sub_cursor
- */
-static
-void CC close_sub_cursor(void *data)
-{
-    ID_cache_t *self = data;
-
-    VCursorRelease(self->curs);
-    KVectorRelease(self->j_cache);
-    KVectorRelease(self->p_cache);
-    free(self);
-}
-
-
-/*
- * extern function I64[2] NCBI:align:get_mate_id #1 (I64 spotId);
- */
-VTRANSFACT_IMPL(NCBI_align_get_mate_align_id, 1, 0, 0) (const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp)
-{
-    rc_t rc;
-    ID_cache_t *self = calloc(1, sizeof(*self));
-
-    if (self == NULL)
-        return RC(rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted);
-
-    rc = open_sub_cursor(self, info, (const VCursor*)info->parms);
-    if (rc == 0) {
-        rslt->self = self;
-        rslt->u.rf = get_mate_algn_id_drvr;
-        rslt->variant = vftIdDepRow;
-        rslt->whack = close_sub_cursor;
-    }
-    else {
-        free(self);
-    }
-
-    return rc;
-}
diff --git a/libs/axf/make-cmp-read_desc.c b/libs/axf/make-cmp-read_desc.c
deleted file mode 100644
index 67026c0..0000000
--- a/libs/axf/make-cmp-read_desc.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-#include <vdb/xform.h>
-#include <vdb/database.h>
-#include <vdb/table.h>
-#include <vdb/cursor.h>
-#include <vdb/schema.h>
-
-
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <insdc/insdc.h>
-#include <align/refseq-mgr.h>
-#include <bitstr.h>
-#include <sysalloc.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include <insdc/sra.h>
-
-static void copy(void *dst, size_t doff, void const *src, size_t soff, size_t bits)
-{
-    if ((doff & 7) == 0 && (soff & 7) == 0 && (bits & 7) == 0)
-        memcpy(&((char *)dst)[doff >> 3], &((char const *)src)[soff >> 3], bits >> 3);
-    else
-        bitcpy(dst, doff, src, soff, bits);
-}
-
-static
-rc_t CC make_cmp_read_desc_inv_impl(void *data, const VXformInfo *info, int64_t row_id,
-    VFixedRowResult const *rslt, uint32_t argc, VRowData const argv [] )
-{
-    int64_t const *const alignId = &((int64_t const *)argv[1].u.data.base)[argv[1].u.data.first_elem];
-    void const *const ZERO = data;
-    void const *const base = argv[0].u.data.base;
-    unsigned src = argv[0].u.data.first_elem * rslt->elem_bits;
-    unsigned dst = rslt->first_elem * rslt->elem_bits;
-    unsigned i;
-    
-    for (i = 0; i != rslt->elem_count; ++i) {
-        bool const aligned = alignId[i] != 0;
-
-        copy(rslt->base, dst, !aligned ? base : ZERO, !aligned ? src : 0, rslt->elem_bits);
-
-        src += rslt->elem_bits;
-        dst += rslt->elem_bits;
-    }
-    return 0;
-}
-
-static
-rc_t CC make_cmp_read_desc_impl(void *data, const VXformInfo *info, int64_t row_id,
-    VFixedRowResult const *rslt, uint32_t argc, VRowData const argv [] )
-{
-    int64_t const *const alignId = &((int64_t const *)argv[1].u.data.base)[argv[1].u.data.first_elem];
-    void const *const ZERO = data;
-    void const *const base = argv[0].u.data.base;
-    unsigned src = argv[0].u.data.first_elem * rslt->elem_bits;
-    unsigned dst = rslt->first_elem * rslt->elem_bits;
-    unsigned i;
-    
-    for (i = 0; i != rslt->elem_count; ++i) {
-        bool const aligned = alignId[i] != 0;
-
-        copy(rslt->base, dst, aligned ? base : ZERO, aligned ? src : 0, rslt->elem_bits);
-
-        src += rslt->elem_bits;
-        dst += rslt->elem_bits;
-    }
-    return 0;
-}
-
-static
-rc_t CC make_read_start_impl(void *data, const VXformInfo *info, int64_t row_id,
-                             VFixedRowResult const *rslt, uint32_t argc, VRowData const argv [] )
-{
-    INSDC_coord_zero *const dst = &((INSDC_coord_zero *)rslt->base)[rslt->first_elem];
-    INSDC_coord_len const *const readlen = &((INSDC_coord_len const *)argv[0].u.data.base)[argv[0].u.data.first_elem];
-    INSDC_coord_zero start;
-    unsigned i;
-    
-    for (start = 0, i = 0; i != rslt->elem_count; ++i) {
-        INSDC_coord_len const rlen = readlen[i];
-
-        dst[i] = start;
-        start += rlen;
-    }
-    return 0;
-}
-
-static rc_t make_cmp_read_desc_factory(const void *Self,
-                                       const VXfactInfo *info,
-                                       VFuncDesc *rslt,
-                                       const VFactoryParams *cp,
-                                       const VFunctionParams *dp)
-{
-    rslt->self = calloc(1, (info->fdesc.desc.intrinsic_bits * info->fdesc.desc.intrinsic_bits + 7) >> 3);
-    if (rslt->self == NULL)
-        return RC(rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted);
-    rslt->whack = free;
-    rslt->u.pf = cp->argv[0].data.b[0] ? make_cmp_read_desc_inv_impl : make_cmp_read_desc_impl;
-    rslt->variant = vftFixedRow;
-    return 0;
-}
-
-/* 
- * function < type T >
- * T NCBI:align:make_cmp_read_desc #1 <bool invert>(T operand, I64 align_id);
- */
-VTRANSFACT_IMPL ( NCBI_align_make_cmp_read_desc, 1, 0, 0 )
-    ( const void *Self, const VXfactInfo *info, VFuncDesc *rslt,
-      const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    return make_cmp_read_desc_factory(Self, info, rslt, cp, dp);
-}
-
-/*
- * extern function INSDC:coord:zero NCBI:align:make_read_start #1
- *     (INSDC:coord:len read_len, I64 align_id);
- */
-VTRANSFACT_IMPL ( NCBI_align_make_read_start, 1, 0, 0 )
-    ( const void *Self, const VXfactInfo *info, VFuncDesc *rslt,
-      const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->u.pf = make_read_start_impl;
-    rslt->variant = vftFixedRow;
-    return 0;
-}
diff --git a/libs/axf/mismatch-restore-qual.c b/libs/axf/mismatch-restore-qual.c
deleted file mode 100644
index 8460751..0000000
--- a/libs/axf/mismatch-restore-qual.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-#include <insdc/insdc.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/table.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <bitstr.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-
-static
-rc_t CC mismatch_restore_qual_impl ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    unsigned i, j;
-    INSDC_quality_phred const *qual	= argv[0].u.data.base;
-    unsigned const nqual = argv[0].u.data.elem_count;
-    bool const *mismatch = argv[1].u.data.base;
-    unsigned const nmis = argv[1].u.data.elem_count;
-    INSDC_quality_phred const rqual = (intptr_t)data;
-    INSDC_quality_phred *dst;
-    
-    qual += argv[0].u.data.first_elem;
-    mismatch += argv[1].u.data.first_elem;
-    
-    rslt->data->elem_bits = argv[0].u.data.elem_bits;
-    rc = KDataBufferResize( rslt -> data, nmis );
-    if ( rc != 0 ) return rc;
-    rslt -> elem_count = nmis;
-    dst = rslt -> data -> base;
-    
-    for (j = i = 0; i != nmis; ++i) {
-        dst[i] = mismatch[i] ? qual[j++] : rqual;
-    }
-    assert(j == nqual);
-    return 0;
-}
-
-/* 
- * function INSDC:quality:phred NCBI:align:mismatch_restore_qual #1 < INSDC:quality:phred matched_qual >
- *    ( INSDC:quality:phred mismatch_qual, bool has_mismatch );
- */
-VTRANSFACT_IMPL ( NCBI_align_mismatch_restore_qual, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->self = (void *)(intptr_t)cp->argv[0].data.u8[0];
-    rslt->u.rf = mismatch_restore_qual_impl;
-    rslt->variant = vftRow;
-    rslt -> whack = NULL;
-    return 0;
-}
-
-static
-rc_t CC decompress_quality_impl ( void *data, const VXformInfo *info, int64_t row_id,
-                                    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    unsigned i, j;
-    INSDC_quality_phred const *qual	= argv[0].u.data.base;
-    unsigned const nqual = argv[0].u.data.elem_count;
-    bool const *preserved = argv[1].u.data.base;
-    unsigned const readlen = argv[1].u.data.elem_count;
-    INSDC_quality_phred const rqual = (intptr_t)data;
-    INSDC_quality_phred *dst;
-    
-    qual += argv[0].u.data.first_elem;
-    preserved += argv[1].u.data.first_elem;
-    
-    rslt->data->elem_bits = argv[0].u.data.elem_bits;
-    rc = KDataBufferResize( rslt -> data, readlen );
-    if ( rc != 0 ) return rc;
-    rslt -> elem_count = readlen;
-    dst = rslt -> data -> base;
-    
-    for (j = i = 0; i != readlen; ++i) {
-        dst[i] = preserved[i] ? qual[j++] : rqual;
-    }
-    assert(j == nqual);
-    return 0;
-}
-
-/* 
- * function INSDC:quality:phred NCBI:align:decompress_quality #1
- *    < INSDC:quality:phred restored_qual_value >
- *    ( INSDC:quality:phred cmp_quality, bool preserved );
- */
-VTRANSFACT_IMPL ( NCBI_align_decompress_quality, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-                                                               VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->self = (void *)(intptr_t)cp->argv[0].data.u8[0];
-    rslt->u.rf = decompress_quality_impl;
-    rslt->variant = vftRow;
-    rslt -> whack = NULL;
-    return 0;
-}
diff --git a/libs/axf/not-my-row.c b/libs/axf/not-my-row.c
deleted file mode 100644
index 165b205..0000000
--- a/libs/axf/not-my-row.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include <sra/sradb.h>
-#include <vdb/xform.h>
-#include <vdb/table.h>
-#include <klib/data-buffer.h>
-#include <klib/text.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-static
-rc_t CC not_my_row_impl(void *data,const VXformInfo *info, int64_t row_id, VRowResult *rslt, uint32_t argc, const VRowData argv [] ) 
-{
-	rc_t 	rc;
-	const int64_t*	src=argv[0].u.data.base;
-	uint32_t	len=argv[0].u.data.elem_count;
-	
-	src += argv[0].u.data.first_elem;
-	assert(argv[0].u.data.elem_bits == 64);
-	rc = KDataBufferResize(rslt->data, len);
-	if(rc == 0){
-		int64_t*        dst;
-		int i,j;
-		dst = rslt->data->base;
-		for(i=j=0;i<len;i++){
-			if(src[i]!=row_id && src[i] > 0/**we used alignment is as 0 to indicate no alignmnent**/){
-				dst[j++]=src[i];
-			}
-		}
-		rslt->elem_count = j;
-	}
-	return rc;	
-}
-
-VTRANSFACT_IMPL ( NCBI_align_not_my_row, 1, 0, 0 ) ( const void *self, const VXfactInfo *info, VFuncDesc *rslt,
-                                                 const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->variant = vftIdDepRow; /*** row_id influences behavior of the function ***/ 
-    rslt->u.ndf = not_my_row_impl;
-    return 0;
-}
diff --git a/libs/axf/project_read_from_sequence.c b/libs/axf/project_read_from_sequence.c
deleted file mode 100644
index cb2e6f2..0000000
--- a/libs/axf/project_read_from_sequence.c
+++ /dev/null
@@ -1,228 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-#include <vdb/xform.h>
-#include <vdb/database.h>
-#include <vdb/table.h>
-#include <vdb/cursor.h>
-#include <vdb/vdb-priv.h>
-
-
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <insdc/insdc.h>
-#include <align/refseq-mgr.h>
-#include <bitstr.h>
-#include <sysalloc.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include <insdc/sra.h>
-
-typedef struct RestoreRead RestoreRead;
-struct RestoreRead
-{
-    const VCursor *curs;
-    uint32_t col_idx;
-    uint32_t read_len_idx;
-    uint32_t read_start_idx;
-};
-
-static
-void CC RestoreReadWhack ( void *obj )
-{
-    RestoreRead * self = obj;
-    if ( self != NULL ) {
-        VCursorRelease ( self -> curs );
-        free ( self );
-    }
-}
-
-static
-rc_t RestoreReadMake ( RestoreRead **objp, const VXfactInfo *info, const VFactoryParams *cp, const VCursor *native_curs )
-{
-    rc_t rc;
-
-    /* create the object */
-    RestoreRead *obj = malloc ( sizeof * obj );
-    if ( obj == NULL ) {
-        rc = RC ( rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted );
-    } else {
-        rc = VCursorLinkedCursorGet(native_curs,"SEQUENCE",&obj->curs);
-	if(rc != 0){
-		const VDatabase *db;
-		const VTable *tbl;
-		/* get at the parent database */
-		rc = VTableOpenParentRead ( info -> tbl, & db );
-		if(rc != 0) return rc;
-		/* open the table */
-		rc = VDatabaseOpenTableRead ( db, &tbl, "SEQUENCE" );
-		VDatabaseRelease ( db );
-		if(rc != 0) return rc;
-		/* create a cursor */
-                rc = VTableCreateCachedCursorRead(tbl, &obj->curs,2UL*1024*1024*1024);
-		VTableRelease(tbl);
-		if(rc != 0) return rc;
-		rc = VCursorPermitPostOpenAdd( obj->curs );
-                if(rc != 0) return rc;
-                rc = VCursorOpen( obj->curs );
-                if(rc != 0) return rc;
-                rc = VCursorLinkedCursorSet(native_curs,"SEQUENCE",obj->curs);
-                if(rc != 0) return rc;
-	} else {
-		VCursorAddRef(obj->curs);
-	}
-	if ( rc == 0 )
-	{
-	    /* add columns to cursor */
-	    assert ( cp -> argc == 1 );
-	    rc = VCursorAddColumn ( obj -> curs, & obj -> col_idx, "%.*s",
-		cp -> argv [ 0 ] . count, cp -> argv [ 0 ] . data . ascii );
-	    if ( rc == 0 || GetRCState(rc) == rcExists )
-		rc = VCursorAddColumn ( obj -> curs, & obj -> read_len_idx, "(INSDC:coord:len)READ_LEN" );
-	    if ( rc == 0 || GetRCState(rc) == rcExists )
-		rc = VCursorAddColumn ( obj -> curs, & obj -> read_start_idx, "(INSDC:coord:zero)READ_START");
-	    if ( rc == 0  || GetRCState(rc) == rcExists) {
-		VTypedesc src;
-		rc = VCursorDatatype ( obj -> curs, obj -> col_idx, NULL, & src );
-		if ( rc == 0 ){
-			/* selected column should have same characteristics */
-			if ( src . domain != info -> fdesc . desc . domain                 ||
-			     src . intrinsic_bits != info -> fdesc . desc . intrinsic_bits ||
-			     src . intrinsic_dim != info -> fdesc . desc. intrinsic_dim )
-			{
-			    rc = RC ( rcXF, rcFunction, rcConstructing, rcType, rcInconsistent );
-			}
-			else if ( ( src . intrinsic_bits & 7 ) != 0 )
-			    rc = RC ( rcXF, rcFunction, rcConstructing, rcType, rcUnsupported );
-			else
-			{
-			    * objp = obj;
-			    return 0;
-			}
-		}
-	    }
-        }
-        free ( obj );
-    }
-    return rc;
-}
-
-static
-rc_t CC project_from_sequence_impl ( void *data, const VXformInfo *info,
-    int64_t row_id, VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    const RestoreRead *self = ( const void* ) data;
-
-    rc_t rc;
-    INSDC_coord_zero read_id;
-    const int64_t *spot_id = argv [ 0 ] . u . data . base;
-    const INSDC_coord_one *read_id_in = argv [ 1 ] . u . data . base;
-    const INSDC_coord_one *read_start;
-    const INSDC_coord_len *read_len;
-    const void *src;
-    uint32_t src_sz;
-    uint32_t src_bits;
-    uint32_t nreads;
-    uint32_t nreads_2;
-    
-    spot_id += argv [ 0 ] . u . data . first_elem;
-    read_id_in += argv [ 1 ] . u . data . first_elem;
-
-    assert(argv[0].u.data.elem_bits == 64);
-    assert(argv[0].u.data.elem_count == 1);
-
-    assert(argv[1].u.data.elem_bits == 32);
-    assert(argv[1].u.data.elem_count == 1);
-
-    if(spot_id[0] == 0){ /*** valid case , the projection should be empty ***/
-	rslt->elem_count =0;
-	return 0;
-    }
-    assert ( read_id_in[0] > 0 );
-    read_id = read_id_in[0] - 1; /** make zero - based **/
-
-
-    rc = VCursorCellDataDirect(self->curs, spot_id[0], self->read_len_idx, NULL, (void const **)&read_len, NULL, &nreads);
-    if (rc) return rc;
-    
-    rc = VCursorCellDataDirect(self->curs, spot_id[0], self->read_start_idx, NULL, (void const **)&read_start, NULL, &nreads_2);
-    if (rc) return rc;
-    
-    if (nreads != nreads_2 || read_id >= nreads) {
-        return RC(rcXF, rcFunction, rcExecuting, rcData, rcInvalid );
-    }
-    
-    rc = VCursorCellDataDirect(self->curs, spot_id[0], self->col_idx, &src_bits, &src, NULL, &src_sz);
-    if (rc) return rc;
-    
-    if (src_sz == nreads) {
-        rslt->elem_count = 1;
-        rslt->data->elem_bits = src_bits;
-        rc = KDataBufferResize(rslt->data, 1);
-        if (rc == 0)
-            memcpy(rslt->data->base, &((char const *)src)[(read_id * src_bits) >> 3],
-                   src_bits >> 3);
-    }
-    else if (src_sz == read_start[nreads - 1] + read_len[nreads - 1]) {
-        /* like READ or QUALITY */
-        rslt->elem_count = read_len[read_id];
-        rslt->data->elem_bits = src_bits;
-        rc = KDataBufferResize(rslt->data, rslt->elem_count);
-        if (rc == 0)
-            memcpy(rslt->data->base, &((char const *)src)[(read_start[read_id] * src_bits) >> 3],
-                   (src_bits * rslt->elem_count) >> 3);
-    }
-    else {
-        /* don't know how to break up the read or should use simple_sub_select */
-        return RC(rcXF, rcFunction, rcExecuting, rcConstraint, rcViolated );
-    }
-    return 0;
-}
-
-/* 
- * function
- * INSDC:4na:bin NCBI:align:project_from_sequence #1 < ascii col > ( I64 seq_spot_id, INSDC:coord:one seq_read_id )
- *     = ALIGN:project_from_sequence;
- */
-VTRANSFACT_IMPL ( ALIGN_project_from_sequence, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    RestoreRead *fself;
-    rc_t rc = RestoreReadMake ( & fself, info, cp, (const VCursor*)info->parms  );
-    if(rc == 0 ) {
-        rslt->self = fself;
-        rslt->u.ndf = project_from_sequence_impl;
-        rslt->variant = vftRow;
-        rslt -> whack = RestoreReadWhack;
-    }
-    return rc;
-}
-
diff --git a/libs/axf/raw-restore-qual.c b/libs/axf/raw-restore-qual.c
deleted file mode 100644
index de4469f..0000000
--- a/libs/axf/raw-restore-qual.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-#include <insdc/insdc.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/table.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <bitstr.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-
-static
-rc_t CC raw_restore_read_impl ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    int i,j;
-    const INSDC_4na_bin	*qual	= argv[0].u.data.base;
-    const uint32_t	read_len 	= argv[0].u.data.elem_count;
-    const uint8_t	*strand		= argv[1].u.data.base;
-    const uint32_t	strand_len 	= argv[1].u.data.elem_count;
-    
-    INSDC_4na_bin *dst;
-    
-    assert(argv[0].u.data.elem_bits == 8);
-    assert(argv[1].u.data.elem_bits == 8);
-    assert(strand_len==1);
-    
-    qual   += argv[0].u.data.first_elem;
-    strand += argv[1].u.data.first_elem;
-    
-    /* resize output row for the total number of reads */    
-    rslt -> data -> elem_bits = 8;
-    rc = KDataBufferResize ( rslt -> data, read_len );
-    if ( rc != 0 ) return rc;
-    rslt -> elem_count = read_len;
-    dst = rslt -> data -> base;
-    /**** MAIN RESTORATION LOOP ***/
-    if(strand[0] == false){ /*** nothing to do **/
-        memcpy(dst,qual,read_len);
-    } else for(i=0,j=read_len-1;i<read_len;i++,j--){
-        dst[i]=qual[j];
-    }
-    return 0;
-}
-
-/* 
- * function
- * INSDC:quality:phred NCBI:align:raw_restore_qual #1( INSDC:quality:phred align_qual, bool ref_orientation);
- */
-VTRANSFACT_IMPL ( NCBI_align_raw_restore_qual, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-
-    rslt->u.rf = raw_restore_read_impl;
-    rslt->variant = vftRow;
-    rslt -> whack = NULL;
-    return 0;
-}
diff --git a/libs/axf/raw-restore-read.c b/libs/axf/raw-restore-read.c
deleted file mode 100644
index 7db8bc1..0000000
--- a/libs/axf/raw-restore-read.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-#include <insdc/insdc.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/table.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <bitstr.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-
-
-static INSDC_4na_bin  map[]={
-/*0  0000 - 0000*/ 0,
-/*1  0001 - 1000*/ 8,
-/*2  0010 - 0100*/ 4,
-/*3  0011 - 1100*/ 12,
-/*4  0100 - 0010*/ 2,
-/*5  0101 - 1010*/ 10,
-/*6  0110 - 0110*/ 6,
-/*7  0111 - 1110*/ 14,
-/*8  1000 - 0001*/ 1,
-/*9  1001 - 1001*/ 9,
-/*10  1010 - 0101*/ 5,
-/*11  1011 - 1101*/ 13,
-/*12  1100 - 0011*/ 3,
-/*13  1101 - 1011*/ 11,
-/*14  1110 - 0111*/ 7,
-/*15  1111 - 1111*/ 15
-};
-
-
-
-static
-rc_t CC raw_restore_read_impl ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    int i,j;
-    const INSDC_4na_bin	*read 		= argv[0].u.data.base;
-    const uint32_t	read_len 	= argv[0].u.data.elem_count;
-    const uint8_t	*strand		= argv[1].u.data.base;
-    const uint32_t	strand_len 	= argv[1].u.data.elem_count;
-    
-    INSDC_4na_bin *dst;
-    
-    assert(argv[0].u.data.elem_bits == 8);
-    assert(argv[1].u.data.elem_bits == 8);
-    assert(strand_len==1);
-    
-    read   += argv[0].u.data.first_elem;
-    strand += argv[1].u.data.first_elem;
-    
-    /* resize output row for the total number of reads */    
-    rslt -> data -> elem_bits = 8;
-    rc = KDataBufferResize ( rslt -> data, read_len );
-    if ( rc != 0 ) return rc;
-    rslt -> elem_count = read_len;
-    dst = rslt -> data -> base;
-    /**** MAIN RESTORATION LOOP ***/
-    if(strand[0] == false){ /*** nothing to do **/
-        memcpy(dst,read,read_len);
-    } else for(i=0,j=read_len-1;i<read_len;i++,j--){
-        dst[i]=map[read[j]&15];
-    }
-    return 0;
-}
-
-
-/* 
- * function
- * INSDC:4na:bin ALIGN:raw_restore_read #1( INSDC:4na:bin ref_read, bool ref_orientation);
- */
-VTRANSFACT_IMPL ( ALIGN_raw_restore_read, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-
-    rslt->u.rf = raw_restore_read_impl;
-    rslt->variant = vftRow;
-    rslt -> whack = NULL;
-    return 0;
-}
diff --git a/libs/axf/ref-preserve_qual.c b/libs/axf/ref-preserve_qual.c
deleted file mode 100644
index b4d1e3f..0000000
--- a/libs/axf/ref-preserve_qual.c
+++ /dev/null
@@ -1,363 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-#include <insdc/insdc.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/table.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <vdb/cursor.h>
-#include <vdb/database.h>
-#include <vdb/vdb-priv.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <klib/container.h>
-#include <klib/text.h>
-#include <klib/pack.h>
-#include <klib/sort.h>
-#include <bitstr.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-
-struct node {
-    BSTNode link;
-    char const *name;
-    uint8_t *bitmap;
-    int64_t first_row;
-    uint64_t row_count;
-    size_t namelen;
-};
-typedef struct node Node;
-
-static
-int CC NodeNameCmp(void const *a, BSTNode const *n)
-{
-    String b;
-    
-    StringInit(&b, ((Node const *)n)->name, ((Node const *)n)->namelen, ((Node const *)n)->namelen);
-    return StringOrderNoNullCheck(a, &b);
-}
-
-static
-int CC NodeCmp(BSTNode const *A, BSTNode const *B)
-{
-    String a;
-    String b;
-    
-    StringInit(&a, ((Node const *)A)->name, ((Node const *)A)->namelen, ((Node const *)A)->namelen);
-    StringInit(&b, ((Node const *)B)->name, ((Node const *)B)->namelen, ((Node const *)B)->namelen);
-    return StringOrderNoNullCheck(&a, &b);
-}
-
-static
-void CC NodeWhack(BSTNode *n, void *data)
-{
-    free(n);
-}
-
-static
-rc_t NodeProcessIDs(Node *self, unsigned row, VCursor const *curs, uint32_t const cid[],
-                    bool buf[], size_t sz, size_t *bmax, INSDC_coord_len const max_seq_len,
-                    bool isPrimary, int64_t const ID[], unsigned N)
-{
-    rc_t rc = 0;
-    unsigned i;
-    bitsz_t dummy;
-    size_t max = *bmax;
-    
-    for (i = 0; i != N; ++i) {
-        uint64_t const *globalRefStart;
-        bool const *preserveQual;
-        uint32_t elem_bits;
-        uint32_t boff;
-        uint32_t n;
-        unsigned offset;
-
-        rc = VCursorCellDataDirect(curs, ID[i], cid[0], &elem_bits, (void const **)&globalRefStart, &boff, &n);
-        if (rc) return rc;
-        rc = VCursorCellDataDirect(curs, ID[i], cid[1], &elem_bits, (void const **)&preserveQual, &boff, &n);
-        if (rc) return rc;
-        
-        offset = (globalRefStart[0]) % max_seq_len;
-        if (offset + n > max)
-            max = offset + n;
-        if (max >= sz) 
-            return RC(rcXF, rcNode, rcConstructing, rcBuffer, rcInsufficient);
-        {
-            unsigned j;
-            
-            for (j = 0; j != n; ++j) {
-                buf[j + offset] |= preserveQual[j];
-            }
-        }
-    }
-    Pack(8, 1, buf, max_seq_len, NULL, self->bitmap, (size_t)row * max_seq_len,
-         (size_t)self->row_count * max_seq_len, &dummy);
-
-    if (max > max_seq_len) {
-        max -= max_seq_len;
-        memmove(buf, buf + max_seq_len, max);
-        memset(buf + max, 0, max_seq_len);
-    }
-    else {
-        memset(buf, 0, max); 
-        max = 0;
-    }
-    *bmax = max;
-
-    return rc;
-}
-
-static
-rc_t OpenAlignCursor(VCursor const **curs, uint32_t cid[], VDatabase const *db, bool isPrimary)
-{
-    char const *tname = isPrimary ? "PRIMARY_ALIGNMENT" : "SECONDARY_ALIGNMENT";
-    VTable const *atbl;
-    rc_t rc = VDatabaseOpenTableRead(db, &atbl, tname);
-    
-    if (rc == 0) {
-        VCursor const *acurs;
-        rc = VTableCreateCursorRead(atbl, &acurs);
-        VTableRelease(atbl);
-        
-        while (rc == 0) {
-            rc = VCursorAddColumn(acurs, &cid[0], "(U64)GLOBAL_REF_START");
-            assert(rc == 0);
-            if (rc) break;
-            
-            rc = VCursorAddColumn(acurs, &cid[1], "(bool)REF_PRESERVE_QUAL");
-            assert(rc == 0);
-            if (rc) break;
-            
-            rc = VCursorOpen(acurs); if (rc) break;
-            *curs = acurs;
-            return 0;
-        }
-        VCursorRelease(acurs);
-    }
-    return rc;
-}
-
-static
-rc_t NodeLoadIDs(Node *self, VTable const *tbl, VDatabase const *db, bool buf[],
-              size_t sz, INSDC_coord_len const max_seq_len, bool isPrimary)
-{
-    char const *cname = isPrimary ? "PRIMARY_ALIGNMENT_IDS" : "SECONDARY_ALIGNMENT_IDS";
-    VCursor const *algn;
-    uint32_t algn_cid[2];
-    rc_t rc = OpenAlignCursor(&algn, algn_cid, db, isPrimary);
-
-    if (rc == 0) {
-        VCursor const *curs;
-        rc = VTableCreateCursorRead(tbl, &curs);
-        
-        if (rc == 0) {
-            uint32_t cid;
-            
-            rc = VCursorAddColumn(curs, &cid, cname);
-            if (rc == 0) {
-                rc = VCursorOpen(curs);
-                if (rc == 0) {
-                    unsigned i;
-                    size_t bmax = 0;
-                    
-                    memset(buf, 0, sz);
-                    for (i = 0; i != self->row_count; ++i) {
-                        void const *base;
-                        uint32_t elem_bits;
-                        uint32_t boff;
-                        uint32_t n;
-                        
-                        rc = VCursorCellDataDirect(curs, self->first_row + i, cid,
-                                                   &elem_bits, &base, &boff, &n);
-                        if (rc) break;
-                        if (n) {
-                            rc = NodeProcessIDs(self, i, algn, algn_cid,
-                                                buf, sz, &bmax, max_seq_len,
-                                                isPrimary, base, n);
-                            if (rc) break;
-                        }
-                    }
-                }
-            }
-            VCursorRelease(curs);
-        }
-        VCursorRelease(algn);
-    }
-    else if (!isPrimary)
-        rc = 0;
-    
-    return rc;
-}
-
-static
-rc_t NodeLoad(Node *self, VTable const *tbl, VDatabase const *db, bool buf[],
-              size_t sz, INSDC_coord_len const max_seq_len)
-{
-    rc_t rc = NodeLoadIDs(self, tbl, db, buf, sz, max_seq_len, true);
-    if (rc == 0) {
-        rc = NodeLoadIDs(self, tbl, db, buf, sz, max_seq_len, false);
-    }
-    return rc;
-}
-
-static
-rc_t NodeMake(Node **rslt, VTable const *tbl, String const *refName, INSDC_coord_len const max_seq_len)
-{
-    Node *self;
-    int64_t data[2];
-    VDatabase const *db;
-    VCursor const *curs;
-    rc_t rc = VTableCreateCursorRead(tbl, &curs);
-    
-    if (rc == 0) {
-        uint32_t cid;
-        
-        rc = VCursorAddColumn(curs, &cid, "NAME_RANGE");
-        if (rc == 0) {
-            rc = VCursorParamsSet((struct VCursorParams const *)curs, "QUERY_SEQ_NAME", "%.*s", refName->len, refName->addr);
-            if (rc == 0) {
-                rc = VCursorOpen(curs);
-                if (rc == 0) {
-                    rc = VCursorOpenRow(curs);
-                    if (rc == 0) {
-                        uint32_t dummy;
-                        
-                        rc = VCursorRead(curs, cid, 64, data, 2, &dummy);
-                    }
-                }
-            }
-        }
-        VCursorRelease(curs);
-    }
-    if (rc) return rc;
-    
-    self = malloc(sizeof(*self) + refName->len + (((data[1] - data[0] + 1) * max_seq_len + 7) >> 3));
-    if (self == NULL) return RC(rcXF, rcNode, rcConstructing, rcMemory, rcExhausted);
-    
-    memcpy(&self[1], refName->addr, self->namelen = refName->len);
-    self->name = (char const *)&self[1];
-    self->bitmap = (uint8_t *)&self->name[refName->len];
-    self->row_count = data[1] - (self->first_row = data[0]) + 1;
-    
-    rc = VTableOpenParentRead(tbl, &db);
-    if (rc == 0) {
-        void *scratch = malloc(32 * max_seq_len);
-        if (scratch) {
-            rc = NodeLoad(self, tbl, db, scratch, 32 * max_seq_len, max_seq_len);
-            if (rc == 0) {
-                VDatabaseRelease(db);
-                free(scratch);
-                *rslt = self;
-                return 0;
-            }
-            free(scratch);
-        }
-        else
-            rc = RC(rcXF, rcNode, rcConstructing, rcMemory, rcExhausted);
-        VDatabaseRelease(db);
-    }
-    free(self);
-    *rslt = NULL;
-    
-    return rc;
-}
-
-/* generate_preserve_qual
- *  compute the positions where corresponding qualities should be preserved
- *  when converting to an analysis database.
- * Preserve where:
- *  there is a mismatch
- *  two positions to each side of an insert
- *
- * extern function bool NCBI:align:generate_preserve_qual #1
- *  ( utf8 ref_name, INSDC:coord:len seq_len, U32 max_seq_len );
- */
-static
-rc_t CC generate_preserve_qual_impl(void *Self, VXformInfo const *info,
-                                    int64_t row_id, VRowResult *rslt,
-                                    uint32_t argc, VRowData const argv[])
-{
-    BSTree *tree = Self;
-    Node *map;
-    rc_t rc;
-    String refName;
-    uint32_t const max_seq_len = ((uint32_t const *)argv[2].u.data.base)[argv[2].u.data.first_elem];
-    INSDC_coord_len const seq_len = ((INSDC_coord_len const *)argv[1].u.data.base)[argv[1].u.data.first_elem];
-
-    assert(argv[1].u.data.elem_bits == sizeof(seq_len) * 8);
-    assert(argv[2].u.data.elem_bits == sizeof(max_seq_len) * 8);
-    
-    rslt->data->elem_bits = rslt->elem_bits;
-    rslt->elem_count = seq_len;
-    rc = KDataBufferResize(rslt->data, rslt->elem_count);                       if (rc) return rc;
-    memset(rslt->data->base, 0, (seq_len * rslt->elem_bits + 7) >> 3);
-    return 0;
-    
-    StringInit(&refName, &((char const *)argv[0].u.data.base)[argv[0].u.data.first_elem],
-               argv[0].u.data.elem_count, argv[0].u.data.elem_count);
-    map = (Node *)BSTreeFind(tree, &refName, NodeNameCmp);
-    if (!map) {
-        rc = NodeMake(&map, info->tbl, &refName, max_seq_len);                  if (rc) return rc;
-        rc = BSTreeInsert(tree, &map->link, NodeCmp);                           if (rc) return rc;
-    }
-    {{
-        size_t const start = (row_id - map->first_row) * max_seq_len;
-        size_t dummy;
-        
-        Unpack(1, 8, map->bitmap, start, seq_len, NULL, rslt->data->base, seq_len, &dummy);
-    }}
-    
-    return 0;
-}
-
-static
-void CC Whack_generate_preserve_qual(void *vp)
-{
-    BSTreeWhack(vp, NodeWhack, NULL);
-    free(vp);
-}
-
-VTRANSFACT_IMPL ( NCBI_align_generate_preserve_qual, 1, 0, 0 )
-    ( const void *Self, VXfactInfo const *info,
-      VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->self = malloc(sizeof(BSTree));
-    if (rslt->self) {
-        BSTreeInit((BSTree *)rslt->self);
-        rslt->u.rf = generate_preserve_qual_impl;
-        rslt->variant = vftIdDepRow;
-        rslt -> whack = Whack_generate_preserve_qual;
-        return 0;
-    }
-    return RC(rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted);
-}
diff --git a/libs/axf/ref-restore-read.c b/libs/axf/ref-restore-read.c
deleted file mode 100644
index beb4599..0000000
--- a/libs/axf/ref-restore-read.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/table.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <vdb/cursor.h>
-#include <vdb/manager.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <insdc/insdc.h>
-#include <align/refseq-mgr.h>
-#include <bitstr.h>
-#include <sysalloc.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-
-typedef struct RestoreRead RestoreRead;
-struct RestoreRead
-{
-    const RefSeqMgr* rmgr;
-};
-
-static
-void CC RestoreReadWhack ( void *obj )
-{
-    RestoreRead * self = obj;
-    if( self != NULL ) {
-        rc_t rc;
-        rc = RefSeqMgr_Release(self->rmgr);
-        assert(rc == 0);
-        free(self);
-    }
-}
-
-static
-rc_t RestoreReadMake ( RestoreRead **objp, const VDBManager *mgr )
-{
-	rc_t rc = 0;
-	RestoreRead *obj;
-
-	assert(objp != NULL);
-    assert(mgr != NULL);
-
-    obj = calloc(1, sizeof(*obj));
-    if( obj == NULL ) {
-		rc = RC(rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted);
-    } else {
-        if( (rc = RefSeqMgr_Make(&obj->rmgr, mgr, errefseq_4NA, 1024 * 1024 * 1024, 30)) == 0 ) {
-		    *objp = obj;
-        } else {
-            *objp = NULL;
-            RestoreReadWhack(obj);
-        }
-	}
-	return rc;
-}
-
-static
-rc_t CC ref_restore_read_impl ( void *data, const VXformInfo *info, int64_t row_id,
-                               VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    RestoreRead* self = data;
-    uint8_t* dst;
-    uint32_t read_len     = argv[0].u.data.elem_count;
-    const uint8_t *read   = argv[0].u.data.base;
-    uint32_t seqid_len    = argv[1].u.data.elem_count;
-    const char* seqid     = argv[1].u.data.base;
-    INSDC_coord_one   seq_start;
-    INSDC_coord_len   seq_len;
-
-    assert(argv[0].u.data.elem_bits == 8);
-    assert(argv[1].u.data.elem_bits == 8);
-    assert(argv[2].u.data.elem_bits == sizeof(INSDC_coord_one)*8);
-    assert(argv[3].u.data.elem_bits == sizeof(INSDC_coord_len)*8);
-    assert(argv[2].u.data.elem_count == 1);
-    assert(argv[3].u.data.elem_count == 1);
-
-    read   += argv [ 0 ] . u . data . first_elem;
-    seqid  += argv [ 1 ] . u . data . first_elem;
-    seq_start = ((INSDC_coord_one*)argv[2].u.data.base)[argv[2].u.data.first_elem];
-    seq_len   = ((INSDC_coord_len*)argv[3].u.data.base)[argv[3].u.data.first_elem];
-
-    if(seq_len < read_len) {
-        rc = RC(rcXF, rcFunction, rcExecuting, rcData, rcInvalid );
-    } else {
-        /* resize output row for the total number of reads */    
-        rslt->data->elem_bits = 8;
-        rc = KDataBufferResize(rslt->data, seq_len);
-        if ( rc == 0 ) {
-            rslt->elem_count = seq_len;
-            dst = rslt->data->base;
-
-            if(seq_len > 0) {
-                if(read_len > 0) {
-                    memcpy(dst, read, read_len);
-                    if(read_len < seq_len) {
-                        memset(dst + read_len, 15, seq_len - read_len); /* pad with 'N' */
-                    }
-                } else if(seq_start == 0) {
-                    memset(dst, 15, seq_len); /* fill with 'N' */
-                } else {
-                    INSDC_coord_len read = 0;
-                    if( (rc = RefSeqMgr_Read(self->rmgr, seqid, seqid_len, seq_start - 1, seq_len, dst, &read)) == 0 ) {
-                        if( read != seq_len) {
-                            rc = RC(rcXF, rcFunction, rcExecuting, rcData, read < seq_len ? rcTooShort : rcTooLong);
-                        }
-                    }
-                }
-            }
-        }
-    }
-    return rc;
-}
-
-/* 
- * function
- * INSDC:4na:bin ALIGN:ref_restore_read #1 (  INSDC:4na:bin rd , ascii seq_id , INSDC:coord:one seq_start, INSDC:coord:len seq_len);
- */
-VTRANSFACT_IMPL ( ALIGN_ref_restore_read, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-                                                     VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    RestoreRead *fself;
-    rc_t rc = RestoreReadMake ( & fself, info -> mgr);
-    if(rc == 0 ) {
-        rslt->self = fself;
-        rslt->u.ndf = ref_restore_read_impl;
-        rslt->variant = vftRow;
-        rslt -> whack = RestoreReadWhack;
-    }
-    return rc;
-}
diff --git a/libs/axf/ref-tbl-sub-select.c b/libs/axf/ref-tbl-sub-select.c
deleted file mode 100644
index 7354fbf..0000000
--- a/libs/axf/ref-tbl-sub-select.c
+++ /dev/null
@@ -1,429 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-
-#include <vdb/xform.h>
-#include <vdb/database.h>
-#include <vdb/table.h>
-#include <vdb/cursor.h>
-#include <vdb/vdb-priv.h>
-#include <insdc/insdc.h>
-#include <klib/data-buffer.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <bitstr.h>
-
-#include "ref-tbl.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-typedef struct RefTableSubSelect RefTableSubSelect;
-struct RefTableSubSelect
-{
-    rc_t (*func)(struct RefTableSubSelect* self, int64_t ref_row_id,
-                 INSDC_coord_zero offset, INSDC_coord_len ref_len,
-                 uint32_t ref_ploidy, VRowResult* rslt);
-    const VCursor *curs;
-    uint32_t out_idx;
-    union {
-        struct {
-            uint32_t circular_idx;
-            uint32_t name_idx;
-            uint32_t name_range_idx;
-            uint32_t seq_len_idx;
-            uint32_t max_seq_len_idx;
-            uint32_t cmp_read_idx;
-            /* set once upon 1st call */
-            /* set once per each call, if changed from previous */
-            char* name;
-            int64_t start_id;
-            int64_t stop_id;
-            uint32_t name_len;
-            uint32_t max_seq_len;
-            INSDC_coord_len seq_len;
-            bool circular;
-            bool local;
-        } ref;
-        struct {
-            uint32_t ref_id_idx;
-            uint32_t ref_start_idx;
-            uint32_t ref_len_idx;
-            uint32_t read_start_idx;
-            uint32_t read_len_idx;
-            struct RefTableSubSelect* parent;
-        } mod;
-    } u;
-};
-
-/*
-  ref_ploidy != 0 means that offset here is relative to ref_row_id, so it can be
-    negative or positive and can extend between rows within same refseq
-  ref_ploidy means that offset is normal REF_START
- */
-
-static
-rc_t CC REFERENCE_TABLE_sub_select(RefTableSubSelect* self, int64_t ref_row_id,
-                             INSDC_coord_zero offset, INSDC_coord_len ref_len,
-                             uint32_t ref_ploidy, VRowResult* rslt)
-{
-    rc_t rc = 0;
-    INSDC_coord_len num_read;
-    
-    if (ref_row_id < self->u.ref.start_id || ref_row_id > self->u.ref.stop_id ) {
-        /* update cached ref data if ref has changed */
-        const char* n;
-        uint32_t n_len;
-        struct {
-            int64_t start_id;
-            int64_t stop_id;
-        } *out;
-        
-        if ((rc = VCursorCellDataDirect(self->curs, ref_row_id, self->u.ref.name_idx, NULL, (const void**)&n, NULL, &n_len)) == 0 &&
-            /* use i_name to find current ref rowid range */
-            (rc = VCursorParamsSet((const struct VCursorParams *)(self->curs), "QUERY_SEQ_NAME", "%.*s", n_len, n)) == 0 &&
-            (rc = VCursorCellDataDirect(self->curs, ref_row_id, self->u.ref.name_range_idx, NULL, (const void**)&out, NULL, NULL)) == 0 )
-        {
-            if (self->u.ref.name_len < n_len ) {
-                void* p = realloc(self->u.ref.name, n_len);
-                if (p == NULL ) {
-                    rc = RC(rcXF, rcFunction, rcSelecting, rcMemory, rcExhausted);
-                }
-                else {
-                    self->u.ref.name = (char*)p;
-                }
-            }
-            if (rc == 0) {
-                const bool* c;
-                INSDC_coord_len* sl;
-                uint32_t* m;
-                uint32_t cmp_read_len = 0;
-                int64_t row;
-                
-                memcpy(self->u.ref.name, n, n_len);
-                self->u.ref.name_len = n_len;
-                self->u.ref.start_id = out->start_id;
-                self->u.ref.stop_id = out->stop_id;
-                for (row = out->start_id; row <= out->stop_id && cmp_read_len == 0; ++row) {
-                    uint32_t tmp_len = 0;
-                    void const *dummy = NULL;
-                    
-                    rc = VCursorCellDataDirect(self->curs, row, self->u.ref.cmp_read_idx, NULL, &dummy, NULL, &tmp_len);
-                    if (rc) break;
-                    cmp_read_len += tmp_len;
-                }
-                if (rc == 0
-                    && (rc = VCursorCellDataDirect(self->curs, self->u.ref.stop_id, self->u.ref.circular_idx, NULL, (const void**)&c, NULL, NULL)) == 0
-                    && (rc = VCursorCellDataDirect(self->curs, self->u.ref.stop_id, self->u.ref.seq_len_idx, NULL, (const void**)&sl, NULL, NULL)) == 0
-                    && (rc = VCursorCellDataDirect(self->curs, self->u.ref.stop_id, self->u.ref.max_seq_len_idx, NULL, (const void**)&m, NULL, NULL)) == 0
-                    )
-                {
-                    self->u.ref.circular = c[0] || cmp_read_len != 0;
-                    self->u.ref.seq_len = m[0] * (self->u.ref.stop_id - self->u.ref.start_id) + sl[0];
-                    self->u.ref.max_seq_len = m[0];
-                    
-                }
-            }
-        }
-    }
-    if (rc == 0 && ref_ploidy != 0 ) {
-        /* convert offset to normal from start of ref relative to current row */
-        offset += self->u.ref.max_seq_len * (ref_row_id - self->u.ref.start_id);
-        if (self->u.ref.circular ) {
-            /* make offset positive starting from refseq actual start */
-            if (offset < 0 ) {
-                offset = self->u.ref.seq_len - ((-offset) % self->u.ref.seq_len);
-            }
-            else {
-                offset %= self->u.ref.seq_len;
-            }
-        } else if (offset < 0 || offset >= self->u.ref.seq_len ) {
-            rc = RC(rcXF, rcFunction, rcSelecting, rcData, rcCorrupt);
-        }
-        ref_row_id = self->u.ref.start_id + offset / self->u.ref.max_seq_len;
-        offset %= self->u.ref.max_seq_len;
-    }
-    /* read the data */
-    for(num_read = 0; rc == 0 && num_read < ref_len && ref_row_id <= self->u.ref.stop_id; offset = 0) {
-        uint32_t bits;
-        const void* output;
-        uint32_t boff;
-        uint32_t row_len;
-        
-        if ((rc = VCursorCellDataDirect(self->curs, ref_row_id,self->out_idx, &bits, &output, &boff, &row_len)) == 0 ) {
-            /* row_len MUST be > offset */
-            if (row_len <= offset ) {
-                rc = RC(rcXF, rcFunction, rcSelecting, rcData, rcCorrupt);
-            }
-            else {
-                row_len -= offset;
-                if(ref_len < row_len + num_read) {
-                    row_len = ref_len - num_read;
-                }
-                /* copy data */
-                bitcpy(rslt->data->base, rslt->elem_count * bits, output, offset * bits + boff, row_len * bits);
-                rslt->elem_count += row_len;
-                num_read += row_len;
-                if (++ref_row_id > self->u.ref.stop_id && self->u.ref.circular ) {
-                    ref_row_id = self->u.ref.start_id;
-                }
-            }
-        }
-    }
-    /* detect incomplete read */
-    if (rc == 0 && num_read == 0 ) {
-        rc = RC(rcXF, rcFunction, rcSelecting, rcTransfer, rcIncomplete);
-    }
-    return rc;
-}
-
-static
-rc_t CC ALIGN_CMN_TABLE_sub_select(RefTableSubSelect* self, int64_t ref_row_id,
-                                   INSDC_coord_zero offset, INSDC_coord_len ref_len,
-                                   uint32_t ref_ploidy, VRowResult* rslt)
-{
-	rc_t rc=0;
-    INSDC_coord_len num_read = 0;
-    const int64_t* al_ref_id = NULL;
-    int64_t al_ref_id_value;
-    const INSDC_coord_zero* al_ref_start = NULL;
-    
-    if (offset < 0 ) {
-        if ((rc = VCursorCellDataDirect(self->curs, ref_row_id, self->u.mod.ref_id_idx, NULL, (void const **)&al_ref_id, NULL, NULL)) == 0 &&
-            (rc = VCursorCellDataDirect(self->curs, ref_row_id,self->u.mod.ref_start_idx, NULL, (void const **)&al_ref_start, NULL, NULL)) == 0 )
-        {
-            memcpy ( & al_ref_id_value, al_ref_id, sizeof *al_ref_id );
-            if (-offset > ref_len ) {
-                /* requested chunk is to the left and is not using allele data */
-                rc = RC(rcXF, rcFunction, rcSelecting, rcData, rcCorrupt);
-            }
-            else if ((rc = self->u.mod.parent->func(self->u.mod.parent, al_ref_id_value, offset + al_ref_start[0],
-                                                      -offset, ref_ploidy, rslt)) == 0 )
-            {
-                /* read left portion of underlying reference */
-                num_read += rslt->elem_count;
-                offset = 0;
-            }
-        }
-    }
-    if (rc == 0 && num_read < ref_len ) {
-        /* copy self */
-        void const* output;
-        uint32_t bits, boff, rs_len, rl_len;
-        const INSDC_coord_zero* rs;
-        const INSDC_coord_len* rl;
-        
-        if ((rc = VCursorCellDataDirect(self->curs, ref_row_id, self->out_idx, &bits, &output, &boff, NULL)) == 0 &&
-            (rc = VCursorCellDataDirect(self->curs, ref_row_id, self->u.mod.read_start_idx, NULL, (void const **)&rs, NULL, &rs_len)) == 0 &&
-            (rc = VCursorCellDataDirect(self->curs, ref_row_id, self->u.mod.read_len_idx, NULL, (void const **)&rl, NULL, &rl_len)) == 0 )
-        {
-            assert(rs_len == rl_len);
-            assert(ref_ploidy > 0 && ref_ploidy <= rl_len);
-            if (offset > rl[ref_ploidy - 1] ) {
-                /* requested chunk starts beyond allele */
-                rc = RC(rcXF, rcFunction, rcSelecting, rcData, rcCorrupt);
-            }
-            else {
-                INSDC_coord_len left = ref_len - num_read;
-                if ((rl[ref_ploidy - 1] - offset) < left ) {
-                    left = rl[ref_ploidy - 1] - offset;
-                }
-                bitcpy(rslt->data->base, rslt->elem_count * bits, output, (rs[ref_ploidy - 1] + offset) * bits + boff, left * bits);
-                num_read += left;
-                rslt->elem_count += left;
-            }
-        }
-    }
-    if (rc == 0 && num_read < ref_len ) {
-        const INSDC_coord_len* al_ref_len;
-        /* copy right portion of underlying reference */
-        if (al_ref_id == NULL || al_ref_start == NULL ) {
-            if ((rc = VCursorCellDataDirect(self->curs, ref_row_id, self->u.mod.ref_id_idx, NULL, (void const **)&al_ref_id, NULL, NULL)) == 0 ) {
-                rc = VCursorCellDataDirect(self->curs, ref_row_id, self->u.mod.ref_start_idx, NULL, (void const **)&al_ref_start, NULL, NULL);
-            }
-        }
-        if (rc == 0 ) {
-            rc = VCursorCellDataDirect(self->curs, ref_row_id, self->u.mod.ref_len_idx, NULL, (void const **)&al_ref_len, NULL, NULL);
-        }
-        memcpy ( & al_ref_id_value, al_ref_id, sizeof *al_ref_id );
-        if ( rc == 0 &&
-            (rc = self->u.mod.parent->func(self->u.mod.parent, al_ref_id_value, al_ref_start[0] + al_ref_len[0],
-                                           ref_len - num_read, ref_ploidy, rslt)) == 0 )
-        {
-        }
-    }
-    return rc;
-}
-
-static
-void CC RefTableSubSelect_Whack ( void *obj )
-{
-    if (obj != NULL ) {
-        RefTableSubSelect* self = (RefTableSubSelect*)obj;
-        VCursorRelease(self->curs);
-        if (self->func != REFERENCE_TABLE_sub_select ) {
-            RefTableSubSelect_Whack(self->u.mod.parent);
-        }
-        else {
-            free(self->u.ref.name);
-        }
-        free(self);
-    }
-}
-
-/* normal way to do it */
-#define IS_ADDED(c, i, n) ((rc = VCursorAddColumn(c, i, n)) == 0 || \
-                           (GetRCObject(rc) == rcColumn && GetRCState(rc) == rcExists))
-
-static
-rc_t RefTableSubSelect_Make( RefTableSubSelect **objp, const VTable *tbl, const VCursor *native_curs, const char* out_col_name )
-{
-    rc_t rc;
-
-    /* create the object */
-    RefTableSubSelect* obj = (RefTableSubSelect*)calloc(1, sizeof(*obj));
-    if (obj == NULL ) {
-        rc = RC(rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted);
-    }
-    else {
-        const VTable *reftbl=NULL;
-        /* open the reference table cursor*/
-        if ((rc = AlignRefTableCursor(tbl, native_curs, &obj->curs, &reftbl)) == 0 ) {
-            /* add columns to cursor */
-            if (IS_ADDED(obj->curs, &obj->u.ref.circular_idx, "CIRCULAR") ) {
-                /* normal REFERENCE table */
-                if (   IS_ADDED(obj->curs, &obj->u.ref.name_idx, "(utf8)NAME")
-                    && IS_ADDED(obj->curs, &obj->u.ref.name_range_idx, "NAME_RANGE")
-                    && IS_ADDED(obj->curs, &obj->u.ref.seq_len_idx, "SEQ_LEN")
-                    && IS_ADDED(obj->curs, &obj->u.ref.max_seq_len_idx, "MAX_SEQ_LEN")
-                    && IS_ADDED(obj->curs, &obj->u.ref.cmp_read_idx, "CMP_READ")
-                    )
-                {
-                    obj->func = REFERENCE_TABLE_sub_select;
-                    rc = 0;
-                }
-            }
-            else if (GetRCObject(rc) == rcColumn && GetRCState(rc) == rcNotFound ) {
-                /* try as align_cmn */
-                if ((rc = RefTableSubSelect_Make(&obj->u.mod.parent, reftbl, native_curs, out_col_name)) ==0 &&
-                    IS_ADDED(obj->curs, &obj->u.mod.ref_id_idx, "REF_ID") &&
-                    IS_ADDED(obj->curs, &obj->u.mod.ref_start_idx, "REF_START") &&
-                    IS_ADDED(obj->curs, &obj->u.mod.ref_len_idx, "REF_LEN") &&
-                    IS_ADDED(obj->curs, &obj->u.mod.read_start_idx, "READ_START") &&
-                    IS_ADDED(obj->curs, &obj->u.mod.read_len_idx, "READ_LEN") )
-                {
-                    obj->func = ALIGN_CMN_TABLE_sub_select;
-                    rc = 0;
-                }
-            }
-            if (rc == 0 && IS_ADDED(obj->curs, &obj->out_idx,  out_col_name) ) {
-                rc = 0;
-            }
-            if (rc == 0 ) {
-                *objp = obj;
-                VTableRelease(reftbl);
-                return 0;
-            }
-            VCursorRelease(obj->curs);
-        }
-        VTableRelease(reftbl);
-        free(obj);
-    }
-    return rc;
-}
-
-static
-rc_t CC reftbl_sub_select ( void *data, const VXformInfo *info,
-                           int64_t row_id, VRowResult *rslt, uint32_t argc, const VRowData argv[] )
-{
-    rc_t rc;
-    RefTableSubSelect* self = (RefTableSubSelect*)data;
-    const int64_t* ref_id = (const int64_t*)argv[0].u.data.base;
-    const INSDC_coord_zero* ref_start = (const INSDC_coord_zero*)argv[1].u.data.base;
-    const INSDC_coord_len* ref_len = (const INSDC_coord_len*)argv[2].u.data.base;
-    const uint32_t* ref_ploidy = NULL;
-    
-    if (argc > 3 ) {
-        ref_ploidy = (const uint32_t*)argv[3].u.data.base;
-        ref_ploidy += argv[3].u.data.first_elem;
-        assert(argv[3].u.data.elem_bits == sizeof(*ref_ploidy) * 8 );
-    }
-    assert(argv[0].u.data.elem_bits == sizeof(*ref_id) * 8 );
-    assert(argv[1].u.data.elem_bits == sizeof(*ref_start) * 8 );
-    assert(argv[2].u.data.elem_bits == sizeof(*ref_len) * 8 );
-
-    ref_id += argv[0].u.data.first_elem;
-    ref_start += argv[1].u.data.first_elem;
-    ref_len += argv[2].u.data.first_elem;
-
-    /* get the memory for output row */
-    rslt->data->elem_bits = rslt->elem_bits;
-    if ((rc = KDataBufferResize(rslt->data, ref_len[0])) == 0 ) {
-        /* must set it to 0 here - functions above accumulate */
-        rslt->elem_count = 0;
-	if(ref_len[0] > 0){
-		int64_t ref_id_val;
-		memcpy ( & ref_id_val, ref_id, sizeof ref_id_val );
-		rc = self->func(self, ref_id_val, ref_start[0], ref_len[0], ref_ploidy ? ref_ploidy[0] : 0, rslt);
-	}
-    }
-    return rc;
-}
-
-VTRANSFACT_IMPL ( ALIGN_ref_sub_select, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    RefTableSubSelect *fself;
-    rc_t rc = RefTableSubSelect_Make ( & fself, info -> tbl, (const VCursor*)info->parms ,"(INSDC:4na:bin)READ" );
-    if ( rc == 0 )
-    {
-        rslt -> self = fself;
-        rslt -> whack = RefTableSubSelect_Whack;
-        rslt -> u . ndf = reftbl_sub_select;
-        rslt -> variant = vftRow;
-    }
-
-    return rc;
-}
-
-VTRANSFACT_IMPL ( NCBI_align_ref_sub_select_preserve_qual, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-                                                   VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    RefTableSubSelect *fself;
-    rc_t rc = RefTableSubSelect_Make( & fself, info -> tbl, (const VCursor*)info->parms , "(bool)PRESERVE_QUAL" );
-    if ( rc == 0 )
-    {
-        rslt -> self = fself;
-        rslt -> whack = RefTableSubSelect_Whack;
-        rslt -> u . ndf = reftbl_sub_select;
-        rslt -> variant = vftRow;
-    }
-    
-    return rc;
-}
diff --git a/libs/axf/ref-tbl.c b/libs/axf/ref-tbl.c
deleted file mode 100644
index 57e0933..0000000
--- a/libs/axf/ref-tbl.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/database.h>
-#include <vdb/table.h>
-#include <vdb/vdb-priv.h>
-#include <vdb/cursor.h>
-#include <kdb/meta.h>
-#include <klib/rc.h>
-
-#include "ref-tbl.h"
-#include <string.h>
-
-rc_t AlignRefTableCursor(const VTable* table, const VCursor *native_curs, const VCursor** ref_cursor,const VTable **reftbl)
-{
-	rc_t rc = 0;
-	char ref_tbl_name[512] =  "REFERENCE";
-	const KMetadata* meta;
-	const VCursor *curs;
-
-	if( (rc = VTableOpenMetadataRead(table, &meta)) == 0 ) {
-	    const KMDataNode* node;
-            if( (rc = KMetadataOpenNodeRead(meta, &node, "CONFIG/REF_TABLE")) == 0 ) {
-                size_t sz;
-                rc = KMDataNodeReadCString(node, ref_tbl_name, sizeof(ref_tbl_name), &sz);
-                ref_tbl_name[sz] = '\0';
-                KMDataNodeRelease(node);
-            }
-            KMetadataRelease(meta);
-        }
-	rc = VCursorLinkedCursorGet(native_curs,ref_tbl_name,&curs);
-	if(rc != 0){
-		const VDatabase *db;
-                const VTable *tbl;
-                /* get at the parent database */
-                rc = VTableOpenParentRead ( table, & db );
-                if(rc != 0) return rc;
-                /* open the table */
-                rc = VDatabaseOpenTableRead ( db, &tbl, ref_tbl_name);
-                VDatabaseRelease ( db );
-                if(rc != 0) return rc;
-                /* create a cursor */
-                rc = VTableCreateCachedCursorRead(tbl, &curs,256*1024*1024);
-		if(reftbl){
-			*reftbl = tbl;
-                } else {
-			VTableRelease(tbl);
-		}
-                if(rc != 0) return rc;
-                rc = VCursorPermitPostOpenAdd( curs );
-                if(rc != 0) return rc;
-                rc = VCursorOpen( curs );
-                if(rc != 0) return rc;
-                if(native_curs)
-                    rc = VCursorLinkedCursorSet(native_curs,ref_tbl_name,curs);
-                
-                if(rc != 0) return rc;
-	} else {
-		VCursorAddRef(curs);
-	}
-	*ref_cursor = curs;
-	return 0;
-}
diff --git a/libs/axf/ref-tbl.h b/libs/axf/ref-tbl.h
deleted file mode 100644
index 24cbf80..0000000
--- a/libs/axf/ref-tbl.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifndef _h_axf_ref_tbl_
-#define _h_axf_ref_tbl_
-
-/* Caller must release ref_cursor */
-rc_t AlignRefTableCursor(const VTable* table, const VCursor *native_curs, const VCursor** ref_cursor, const VTable **reftbl);
-
-#endif /* _h_axf_ref_tbl_ */
diff --git a/libs/axf/refseq-stats.c b/libs/axf/refseq-stats.c
deleted file mode 100644
index c77368c..0000000
--- a/libs/axf/refseq-stats.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include <sra/sradb.h>
-#include <vdb/xform.h>
-#include <vdb/table.h>
-#include <klib/data-buffer.h>
-#include <klib/text.h>
-#include <klib/rc.h>
-#include <klib/checksum.h>
-#include <kdb/meta.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-typedef struct refseq_meta_stats_data_struct {
-    uint64_t total_seq_len;
-    uint32_t crc32;
-    MD5State md5;
-    KMDataNode* stats;
-    uint64_t buf_sz;
-    char* buf;
-} refseq_meta_stats_data;
-
-
-static
-void CC refseq_meta_stats_whack( void* self )
-{
-    if( self != NULL ) {
-        refseq_meta_stats_data* data = self;
-        KMDataNodeRelease(data->stats);
-        free(data->buf);
-        free(data);
-    }
-}
-
-static
-rc_t CC refseq_meta_stats( void *self, const VXformInfo *info, int64_t row_id,
-                             VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc = 0;
-    KMDataNode* node;
-    refseq_meta_stats_data* data = self;
-    uint64_t i, seq_len = argv[0].u.data.elem_count;
-    const INSDC_4na_bin * seq = argv[0].u.data.base;
-   
-    seq +=  argv[0].u.data.first_elem;
-
-    assert(data != NULL);
-
-    if( data->buf_sz < seq_len ) {
-        char* x = realloc(data->buf, seq_len);
-        if( x == NULL ) {
-            rc = RC(rcVDB, rcFunction, rcUpdating, rcMemory, rcExhausted);
-        } else {
-            data->buf = x;
-            data->buf_sz = seq_len;
-        }
-    }
-    for(i = 0; rc == 0 && i < seq_len; i++) {
-        data->buf[i] = INSDC_4na_map_CHARSET[seq[i]];
-    }
-    if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(data->stats, &node, "TOTAL_SEQ_LEN")) == 0 ) {
-        if( data->total_seq_len + seq_len < data->total_seq_len ) {
-            rc = RC(rcVDB, rcFunction, rcUpdating, rcMetadata, rcOutofrange);
-        } else {
-            data->total_seq_len += seq_len;
-            rc = KMDataNodeWriteB64(node, &data->total_seq_len);
-        }
-        KMDataNodeRelease(node);
-    }
-    if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(data->stats, &node, "CRC32")) == 0 ) {
-        data->crc32 = CRC32(data->crc32, data->buf, seq_len);
-        rc = KMDataNodeWriteB32(node, &data->crc32);
-        KMDataNodeRelease(node);
-    }
-    if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(data->stats, &node, "MD5")) == 0 ) {
-        uint8_t digest[16];
-        MD5State md5;
-        MD5StateAppend(&data->md5, data->buf, seq_len);
-        memcpy(&md5, &data->md5, sizeof(md5));
-        MD5StateFinish(&md5, digest);
-        rc = KMDataNodeWrite(node, digest, sizeof(digest));
-        KMDataNodeRelease(node);
-    }
-    return rc;
-}
-
-VTRANSFACT_IMPL ( NCBI_refSeq_stats, 1, 0, 0 ) ( const void *self, const VXfactInfo *info, VFuncDesc *rslt,
-                                                 const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rc_t rc = 0;
-
-    if( dp->argc < 1 ) {
-        rc = RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-    } else {
-        refseq_meta_stats_data* data;
-        if( (data = calloc(1, sizeof(refseq_meta_stats_data))) == NULL ) {
-            rc = RC(rcVDB, rcFunction, rcConstructing, rcMemory, rcExhausted);
-        } else {
-            KMetadata *meta;
-            if( (rc = VTableOpenMetadataUpdate((VTable*)info->tbl, &meta)) == 0 ) {
-                rc = KMetadataOpenNodeUpdate(meta, &data->stats, "STATS");
-                KMetadataRelease(meta);
-            }
-            if( rc == 0 ) {
-                rslt->self = data;
-                rslt->whack = refseq_meta_stats_whack;
-                rslt->variant = vftRow;
-                rslt->u.rf = refseq_meta_stats;
-                data->crc32 = 0;
-                CRC32Init();
-                MD5StateInit(&data->md5);
-            } else {
-                refseq_meta_stats_whack(data);
-            }
-        }
-    }
-    return rc;
-}
diff --git a/libs/axf/seq-construct-read.c b/libs/axf/seq-construct-read.c
deleted file mode 100644
index d0fc66e..0000000
--- a/libs/axf/seq-construct-read.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-#include <vdb/xform.h>
-#include <vdb/database.h>
-#include <vdb/table.h>
-#include <vdb/cursor.h>
-#include <vdb/schema.h>
-
-
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <insdc/insdc.h>
-#include <align/refseq-mgr.h>
-#include <bitstr.h>
-#include <sysalloc.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include <insdc/sra.h>
-
-
-static
-rc_t CC seq_construct_read ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    uint8_t *dst;
-
-    /* base pointers to input data */
-    const uint8_t *aligned = argv [ 0 ] . u . data . base;
-    const INSDC_coord_len *aligned_len = argv [ 1 ] . u . data . base;
-    const uint8_t *unaligned = argv [ 2 ] . u . data . base;
-    const INSDC_coord_len *unaligned_len = argv [ 3 ] . u . data . base;
-
-    /* the number of reads */
-    uint32_t i, seqlen, aligned_seqlen, unaligned_seqlen;
-    uint32_t nreads = argv [ 1 ] . u . data . elem_count;
-
-    /* require the same dimension for both inputs */
-    if ( argv [ 1 ] . u . data . elem_count != argv [ 3 ] . u . data . elem_count )
-        return RC ( rcXF, rcFunction, rcExecuting, rcData, rcInconsistent );
-
-    /* offset base pointers to start of row */
-    aligned += argv [ 0 ] . u . data . first_elem;
-    aligned_len += argv [ 1 ] . u . data . first_elem;
-    unaligned += argv [ 2 ] . u . data . first_elem;
-    unaligned_len += argv [ 3 ] . u . data . first_elem;
-
-    /* calculate new sequence length */
-    for ( i = seqlen = 0; i < nreads; ++ i )
-        seqlen += unaligned_len [ i ] != 0 ? unaligned_len [ i ] : aligned_len [ i ];
-
-    /* set output buffer size */
-    rslt -> data -> elem_bits = 8;
-    rc = KDataBufferResize ( rslt -> data, seqlen );
-    if ( rc != 0 )
-        return rc;
-
-    /* produce final sequence */
-    for ( dst = rslt -> data -> base, i = seqlen = aligned_seqlen = unaligned_seqlen = 0; i < nreads; ++ i )
-    {
-        /* give preference to unaligned */
-        if ( unaligned_len [ i ] != 0 )
-        {
-            memcpy ( & dst [ seqlen ], & unaligned [ unaligned_seqlen ], unaligned_len [ i ] );
-            seqlen += unaligned_len [ i ];
-        }
-        else
-        {
-            memcpy ( & dst [ seqlen ], & aligned [ aligned_seqlen ], aligned_len [ i ] );
-            seqlen += aligned_len [ i ];
-        }
-
-        aligned_seqlen += aligned_len [ i ];
-        unaligned_seqlen += unaligned_len [ i ];
-    }
-
-    rslt -> elem_count = seqlen;
-
-    return 0;
-}
-
-/* 
- * function < type T >
- * T NCBI:align:seq_construct_read #1 (T     read, INSDC:coord:len     read_len,
- *                                     T cmp_read, INSDC:coord:len cmp_read_len);
- */
-VTRANSFACT_IMPL ( NCBI_align_seq_construct_read, 1, 0, 0 )
-    ( const void *Self, const VXfactInfo *info,
-      VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    if (info->fdesc.desc.intrinsic_bits * info->fdesc.desc.intrinsic_dim != 8)
-        return RC(rcAlign, rcFunction, rcConstructing, rcType, rcIncorrect);
-    rslt->u.ndf = seq_construct_read;
-    rslt->variant = vftRow;
-    return 0;
-}
diff --git a/libs/axf/seq-restore-read.c b/libs/axf/seq-restore-read.c
deleted file mode 100644
index 1141717..0000000
--- a/libs/axf/seq-restore-read.c
+++ /dev/null
@@ -1,216 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-#include <vdb/xform.h>
-#include <vdb/database.h>
-#include <vdb/table.h>
-#include <vdb/cursor.h>
-#include <vdb/schema.h>
-
-
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <insdc/insdc.h>
-#include <align/refseq-mgr.h>
-#include <bitstr.h>
-#include <sysalloc.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include <insdc/sra.h>
-
-typedef struct RestoreRead RestoreRead;
-struct RestoreRead
-{
-    const VCursor *curs;
-    uint32_t read_idx;
-};
-
-static
-void CC RestoreReadWhack ( void *obj )
-{
-    RestoreRead * self = obj;
-    if ( self != NULL ) {
-        VCursorRelease ( self -> curs );
-        free ( self );
-    }
-}
-
-static
-rc_t RestoreReadMake ( RestoreRead **objp, const VTable *tbl )
-{
-    rc_t rc;
-
-    /* create the object */
-    RestoreRead *obj = malloc ( sizeof * obj );
-    if ( obj == NULL ) {
-        rc = RC ( rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted );
-    } else {
-        /* get at the parent database */
-        const VDatabase *db;
-        rc = VTableOpenParentRead ( tbl, & db );
-        if ( rc == 0 ) {
-            /* open the primary alignment table */
-            const VTable *patbl;
-            rc = VDatabaseOpenTableRead ( db, & patbl, "PRIMARY_ALIGNMENT" );
-            VDatabaseRelease ( db );
-            if ( rc == 0 ) {
-                /* create a cursor */
-                rc = VTableCreateCachedCursorRead(patbl, &obj->curs, 256*1024*1024UL);
-                VTableRelease ( patbl );
-                if ( rc == 0 ) {
-                    /* add columns to cursor */
-                    rc = VCursorAddColumn ( obj -> curs, & obj -> read_idx, "( INSDC:4na:bin ) READ" );
-                    if ( rc == 0 ){
-                        rc = VCursorOpen ( obj -> curs );
-			if ( rc == 0 ) {
-			   * objp = obj;
-			   return 0;
-			}
-		    }
-                    VCursorRelease ( obj -> curs );
-                }
-            }
-        }
-        free ( obj );
-    }
-    return rc;
-}
-static INSDC_4na_bin  map[]={
-/*0  0000 - 0000*/ 0,
-/*1  0001 - 1000*/ 8,
-/*2  0010 - 0100*/ 4,
-/*3  0011 - 1100*/ 12,
-/*4  0100 - 0010*/ 2,
-/*5  0101 - 1010*/ 10,
-/*  0110 - 0110*/ 6,
-/*7  0111 - 1110*/ 14,
-/*8  1000 - 0001*/ 1,
-/*9  1001 - 1001*/ 9,
-/*10  1010 - 0101*/ 5,
-/*11  1011 - 1101*/ 13,
-/*12  1100 - 0011*/ 3,
-/*13  1101 - 1011*/ 11,
-/*14  1110 - 0111*/ 7,
-/*15  1111 - 1111*/ 15
-};
-
-static
-rc_t CC seq_restore_read_impl ( void *data, const VXformInfo *info, int64_t row_id,
-                               VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    int i;
-    RestoreRead		*self = data;
-    INSDC_4na_bin	*dst;
-    INSDC_coord_len 	len;
-    uint32_t		src_len		= argv[0].u.data.elem_count;
-    const INSDC_4na_bin	*src		= argv[0].u.data.base;
-    const uint32_t 	num_reads	= argv[1].u.data.elem_count;
-    const int64_t	*align_id	= argv[1].u.data.base;
-    const INSDC_coord_len *read_len  	= argv[2].u.data.base;
-    const uint8_t	*read_type	= argv[3].u.data.base;
-    
-    assert(argv[0].u.data.elem_bits == 8);
-    assert(argv[1].u.data.elem_bits == 64);
-    assert(argv[2].u.data.elem_bits == sizeof(INSDC_coord_len)*8);
-    assert(argv[2].u.data.elem_count == num_reads);
-    assert(argv[3].u.data.elem_count == num_reads);
-    
-    
-    src   += argv [ 0 ] . u . data . first_elem;
-    align_id  += argv [ 1 ] . u . data . first_elem;
-    read_len  += argv [ 2 ] . u . data . first_elem;
-    read_type += argv [ 3 ] . u . data . first_elem;
-    
-    for(i=0,len=0;i<num_reads;i++){
-        len+=read_len[i];
-    }
-    /* resize output row */    
-    rslt->data->elem_bits = 8;
-    rc = KDataBufferResize(rslt->data, len);
-    rslt->elem_count = len;
-    dst = rslt->data->base;
-    if ( rc == 0  && len > 0 ) {
-        if(len == src_len){ /*** shortcut - all data is local ***/
-            memcpy(dst,src,len);
-        } else for(i=0;i<num_reads && rc == 0;i++){ /*** checking read by read ***/
-            if(align_id[i] > 0) {
-                    const INSDC_4na_bin *r_src;
-                    uint32_t             r_src_len;
-                    rc = VCursorCellDataDirect ( self -> curs,  align_id[i], self -> read_idx, NULL, ( const void** ) & r_src, NULL, & r_src_len );
-                    if(rc == 0){
-                        if(r_src_len == read_len[i]){
-                            if(read_type[i]&SRA_READ_TYPE_FORWARD){
-                                memcpy(dst,r_src,read_len[i]);
-                            }else if(read_type[i]&SRA_READ_TYPE_REVERSE){
-                                int j,k;
-                                for(j=0,k=read_len[i]-1;j<read_len[i];j++,k--){
-                                    dst[j]=map[r_src[k]&15];
-                                }
-                            } else {
-                                rc = RC(rcXF, rcFunction, rcExecuting, rcData, rcInconsistent);
-                            }
-                        } else {
-                            rc = RC(rcXF, rcFunction, rcExecuting, rcData, rcInconsistent);
-                        }
-                    }
-            } else { /*** data is in READ column **/
-                if(src_len >= read_len[i]){
-                    memcpy(dst,src,read_len[i]);
-                    src_len -= read_len[i];
-                    src     += read_len[i];
-                } else {
-                    return RC(rcXF, rcFunction, rcExecuting, rcData, rcInconsistent );
-                }
-            }
-            dst += read_len[i];
-        }
-    }
-    return rc;
-}
-
-/* 
- * function
- * INSDC:4na:bin ALIGN:seq_restore_read #1 (  INSDC:4na:bin rd , I64 align_id , INSDC:coord:len read_len);
- */
-VTRANSFACT_IMPL ( ALIGN_seq_restore_read, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-                                                     VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    RestoreRead *fself;
-    rc_t rc = RestoreReadMake ( & fself, info -> tbl);
-    if(rc == 0 ) {
-        rslt->self = fself;
-        rslt->u.ndf = seq_restore_read_impl;
-        rslt->variant = vftRow;
-        rslt -> whack = RestoreReadWhack;
-    }
-    return rc;
-}
diff --git a/libs/axf/template-len.c b/libs/axf/template-len.c
deleted file mode 100644
index 07266db..0000000
--- a/libs/axf/template-len.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include <sra/sradb.h>
-#include <vdb/xform.h>
-#include <vdb/table.h>
-#include <klib/data-buffer.h>
-#include <klib/text.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-static
-rc_t CC template_len_impl(void *data,const VXformInfo *info, int64_t row_id, VRowResult *rslt, uint32_t argc, const VRowData argv [] ) 
-{
-    rc_t 	rc;
-    int32_t	*dst;
-    const INSDC_coord_zero *p1 = argv[0].u.data.base;
-    const INSDC_coord_zero *p2 = argv[1].u.data.base;
-    const INSDC_coord_len  *l1 = argv[2].u.data.base;
-    const INSDC_coord_len  *l2 = argv[3].u.data.base;
-    const char             *n1 = argv[4].u.data.base;
-    const char             *n2 = argv[5].u.data.base;
-    const INSDC_coord_one  *r1 = argv[6].u.data.base;
-
-    /** primary should have everything defines ***/
-    assert(argv[0].u.data.elem_count == 1);
-    assert(argv[2].u.data.elem_count == 1);
-    assert(argv[4].u.data.elem_count > 0 );
-    assert(argv[6].u.data.elem_count == 1);
-
-    rc = KDataBufferResize(rslt->data, 1);
-    if(rc != 0) return rc;
-    rslt->elem_count=1;
-    dst = rslt->data->base;
-    dst[0] = 0;
-
-    /*** check if the mate is mapped **/
-    if(   argv[1].u.data.elem_count > 0
-        && argv[3].u.data.elem_count > 0
-        && argv[4].u.data.elem_count == argv[5].u.data.elem_count)
-    {
-        n1+=argv[4].u.data.first_elem;
-        n2+=argv[5].u.data.first_elem;
-        r1+=argv[6].u.data.first_elem;
-        
-        if(   argv[4].u.data.elem_count == argv[5].u.data.elem_count
-            && memcmp(n1,n2,argv[4].u.data.elem_count)==0) /*** same reference name ***/
-        {
-#if 1
-            unsigned const self_left  = p1[argv[0].u.data.first_elem];
-            unsigned const mate_left  = p2[argv[1].u.data.first_elem];
-            unsigned const self_right = self_left + l1[argv[2].u.data.first_elem];
-            unsigned const mate_right = mate_left + l2[argv[3].u.data.first_elem];
-            unsigned const  leftmost  = (self_left  < mate_left ) ? self_left  : mate_left;
-            unsigned const rightmost  = (self_right > mate_right) ? self_right : mate_right;
-            unsigned const tlen = rightmost - leftmost;
-            
-            /* The standard says, "The leftmost segment has a plus sign and the rightmost has a minus sign." */
-            if (   (self_left <= mate_left && self_right >= mate_right)     /* mate fully contained within self or */
-                || (mate_left <= self_left && mate_right >= self_right))    /* self fully contained within mate; */
-            {
-                if (self_left < mate_left || (r1[0] == 1 && self_left == mate_left))
-                    dst[0] = tlen;
-                else
-                    dst[0] = -tlen;
-            }
-            else if (   (self_right == mate_right && mate_left == leftmost) /* both are rightmost, but mate is leftmost */
-                     ||  self_right == rightmost)
-            {
-                dst[0] = -tlen;
-            }
-            else
-                dst[0] = tlen;
-#else
-            dst[0] = p2[argv[1].u.data.first_elem] -  p1[argv[0].u.data.first_elem];
-            if(dst[0] < 0){
-                dst[0] -= l1[argv[2].u.data.first_elem];
-            } else if (dst[0] > 0) {
-                dst[0] += l2[argv[3].u.data.first_elem];
-            } else if(r1[0]==1){/*** bam wants to give positive TLEN ***/
-                dst[0] = l1[argv[2].u.data.first_elem];
-            } else if(r1[0]==2){/*** bam wants to give negative TLEN ***/
-                dst[0] = -l2[argv[3].u.data.first_elem];
-            } 
-#endif
-        }
-    }
-    return 0;	
-}
-
-VTRANSFACT_IMPL ( NCBI_align_template_len, 1, 0, 0 ) ( const void *self, const VXfactInfo *info, VFuncDesc *rslt,
-                                                 const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->variant = vftRow;
-    rslt->u.rf = template_len_impl;
-    return 0;
-}
diff --git a/libs/blast/Makefile b/libs/blast/Makefile
deleted file mode 100644
index 800ba77..0000000
--- a/libs/blast/Makefile
+++ /dev/null
@@ -1,85 +0,0 @@
-# ===========================================================================
-#
-#                            PUBLIC DOMAIN NOTICE
-#               National Center for Biotechnology Information
-#
-#  This software/database is a "United States Government Work" under the
-#  terms of the United States Copyright Act.  It was written as part of
-#  the author's official duties as a United States Government employee and
-#  thus cannot be copyrighted.  This software/database is freely available
-#  to the public for use. The National Library of Medicine and the U.S.
-#  Government have not placed any restriction on its use or reproduction.
-#
-#  Although all reasonable efforts have been taken to ensure the accuracy
-#  and reliability of the software and data, the NLM and the U.S.
-#  Government do not and cannot warrant the performance or results that
-#  may be obtained by using this software or data. The NLM and the U.S.
-#  Government disclaim all warranties, express or implied, including
-#  warranties of performance, merchantability or fitness for any particular
-#  purpose.
-#
-#  Please cite the author in any work or product based on this material.
-#
-# ===========================================================================
-
-default: all
-
-TOP ?= $(abspath ../..)
-
-MODULE = libs/blast
-
-INT_LIBS = \
-
-ALL_LIBS = \
-	$(INT_LIBS) \
-	$(EXT_LIBS)
-
-include $(TOP)/build/Makefile.env
-
-ifeq (linux,$(OS))
-ifeq (64,$(BITS))
-	INT_LIBS += libvdb-blast
-endif    
-endif    
-
-#-------------------------------------------------------------------------------
-# outer targets
-#
-all std: makedirs
-	@ $(MAKE_CMD) $(TARGDIR)/std
-
-$(INT_LIBS): makedirs
-	@ $(MAKE_CMD) $(ILIBDIR)/$@
-
-.PHONY: all std $(ALL_LIBS)
-
-#-------------------------------------------------------------------------------
-# std
-#
-$(TARGDIR)/std: \
-	$(addprefix $(ILIBDIR)/,$(INT_LIBS))
-
-.PHONY: $(TARGDIR)/std
-
-#-------------------------------------------------------------------------------
-# clean
-#
-clean: stdclean
-
-.PHONY: clean
-
-#-------------------------------------------------------------------------------
-# blast
-#
-$(ILIBDIR)/libvdb-blast: $(addprefix $(ILIBDIR)/libvdb-blast.,$(ILIBEXT))
-
-BLAST_SRC = \
-	blast \
-
-BLAST_OBJ = \
-	$(addsuffix .$(LOBX),$(BLAST_SRC))
-
-BLAST_LIB = \
-
-$(ILIBDIR)/libvdb-blast.$(LIBX): $(BLAST_OBJ)
-	$(LD) --slib -o $@ $^ $(BLAST_LIB)
diff --git a/libs/blast/blast.c b/libs/blast/blast.c
deleted file mode 100644
index 143f3ed..0000000
--- a/libs/blast/blast.c
+++ /dev/null
@@ -1,5243 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <vdb/extern.h>
-
-#include <ncbi/vdb-blast.h> /* VdbBlastMgr */
-#include <ncbi/vdb-blast-priv.h> /* VdbBlastMgr */
-
-#include <insdc/insdc.h> /* INSDC_read_type */
-#include <insdc/sra.h> /* SRA_READ_TYPE_BIOLOGICAL */
-
-#include <sra/srapath.h> /* SRAPath */
-#include <sra/sraschema.h> /* VDBManagerMakeSRASchema */
-
-#include <vdb/manager.h> /* VDBManager */
-#include <vdb/schema.h> /* VSchema */
-#include <vdb/database.h> /* VDatabase */
-#include <vdb/table.h> /* VTable */
-#include <vdb/cursor.h> /* VCursor */
-#include <vdb/blob.h> /* VBlob */
-#include <vdb/vdb-priv.h> /* VTableOpenKTableRead */
-
-#include <kdb/kdb-priv.h> /* KTableGetPath */
-#include <kdb/manager.h> /* kptDatabase */
-#include <kdb/meta.h> /* KMetadataRelease */
-#include <kdb/table.h> /* KTable */
-
-#include <vfs/manager.h> /* VFSManager */
-#include <vfs/resolver.h> /* VResolver */
-#include <vfs/path.h> /* VPath */
-
-#include <kfg/config.h> /* KConfig */
-
-#include <kproc/lock.h> /* KLock */
-
-#include <klib/printf.h> /* string_printf */
-#include <klib/refcount.h> /* KRefcount */
-#include <klib/log.h> /* PLOGMSG */
-#include <klib/out.h> /* KOutHandlerSetStdOut */
-#include <klib/debug.h> /* DBGMSG */
-#include <klib/status.h>
-#include <klib/text.h> /* String */
-#include <klib/rc.h> /* GetRCState */
-
-#include <sysalloc.h>
-
-#include <assert.h>
-#include <stdlib.h> /* calloc */
-#include <string.h> /* memset */
-#include <time.h> /* time_t */
-
-#include <stdio.h> /* fprintf */
-
-typedef uint32_t VdbBlastStatus;
-
-#if _DEBUGGING
-#define S STSMSG(9,(""));
-#else
-#define S
-#endif
-
-#define RELEASE(type, obj) do { rc_t rc2 = type##Release(obj); \
-    if (rc2 != 0 && rc == 0) { rc = rc2; } obj = NULL; } while (false)
-
-/******************************************************************************/
-
-static void *_NotImplementedP(const char *func) {
-    PLOGERR(klogErr, (klogErr, -1,
-        "$(func): is not implemented", "func=%s", func));
-    return 0;
-}
-
-static size_t _NotImplemented(const char *func)
-{   return (size_t)_NotImplementedP(func); }
-
-/******************************************************************************/
-
-static
-void _Packed2naReadPrint(const Packed2naRead *self, const void *blob)
-{
-    static char *b = NULL;
-    static size_t bsz = 0;
-    int last = 0;
-    unsigned i = 0;
-    size_t size;
-    assert(self);
-    fflush(stderr);
-    if (b == NULL) {
-        bsz = self->length_in_bases + 64;
-        b = malloc(bsz);
-        if (b == NULL)
-        {   return; }
-    }
-    else if (bsz < self->length_in_bases + 64) {
-        char *tmp = NULL;
-        bsz = self->length_in_bases + 64;
-        tmp = realloc(b, bsz);
-        if (tmp == NULL)
-        {   return; }
-        b = tmp;
-    }
-    sprintf(b, "%lu\t%p\t", self->read_id, blob);
-    last = string_measure(b, &size);
-    {
-        unsigned ib = 0;
-        uint32_t offset = self->offset_to_first_bit;
-        for (ib = 0; ib < self->length_in_bases; ++ib) {
-            int j = 0;
-            uint8_t a[4];
-            uint8_t u = 0;
-            if (i >= self->length_in_bases)
-            {   break; }
-            u = ((uint8_t*)self->starting_byte)[ib];
-            a[0] = (u >> 6) & 3;
-            a[1] = (u >> 4) & 3;
-            a[2] = (u >> 2) & 3;
-            a[3] = u & 3;
-            for (j = offset / 2; j < 4; ++j) {
-                const char c[] = "ACGT";
-                uint8_t h = a[j];
-                if (i >= self->length_in_bases)
-                {   break; }
-                assert(h < 4);
-                b[last++] = c[h];
-                ++i;
-            }
-            offset = 0;
-        }
-        b[last++] = '\n';
-        b[last++] = '\0';
-        fprintf(stderr, "%s", b);
-        fflush(stderr);
-    }
-}
-
-/******************************************************************************/
-
-static
-rc_t _VTableLogRowData(const VTable *self,
-    const char *column,
-    void *buffer,
-    uint32_t blen)
-{
-    rc_t rc = 0;
-
-#if _DEBUGGING
-    if (buffer && blen == 64) {
-        uint64_t data = *((uint64_t*)buffer);
-        const KTable *ktbl = NULL;
-        rc_t rc = VTableOpenKTableRead(self, &ktbl);
-        if (rc == 0) {
-            const char *path = NULL;
-            rc = KTableGetPath(ktbl, &path);
-            if (rc == 0) {
-                DBGMSG(DBG_BLAST, DBG_FLAG(DBG_BLAST_BLAST),
-                    ("%s: %s: %lu\n", path, column, data));
-            }
-        }
-
-        KTableRelease(ktbl);
-    }
-#endif
-
-    if (rc != 0)
-    {   PLOGERR(klogInt, (klogInt, rc, "Error in $(f)", "f=%s", __func__)); }
-
-    return rc;
-}
-
-static
-rc_t _VTableMakeCursorImpl(const VTable *self,
-    const VCursor **curs,
-    uint32_t *col_idx,
-    const char *col_name, bool canBeLost)
-{
-    rc_t rc = 0;
-
-    assert(curs && col_name);
-
-    if (rc == 0) {
-        rc = VTableCreateCursorRead(self, curs);
-        if (rc != 0) {
-            LOGERR(klogInt, rc, "Error during VTableCreateCursorRead");
-        }
-    }
-
-    if (rc == 0) {
-        VCursorPermitPostOpenAdd(*curs);
-        if (rc != 0) {
-            LOGERR(klogInt, rc, "Error during VCursorPermitPostOpenAdd");
-        }
-    }
-
-    if (rc == 0) {
-        rc = VCursorOpen(*curs);
-        if (rc != 0) {
-            PLOGERR(klogInt, (klogInt, rc,
-                "Error in VCursorOpen($(name))", "name=%s", col_name));
-        }
-    }
-
-    if (rc == 0) {
-        assert(*curs);
-        rc = VCursorAddColumn(*curs, col_idx, col_name);
-        if (rc != 0 && !canBeLost) {
-            PLOGERR(klogInt, (klogInt, rc,
-                "Error in VCursorAddColumn($(name))", "name=%s", col_name));
-        }
-    }
-
-    STSMSG(2, ("Prepared a VCursor to read '%s'", col_name));
-
-    return rc;
-}
-
-static rc_t _VTableMakeCursor(const VTable *self,
-    const VCursor **curs, uint32_t *col_idx, const char *col_name)
-{
-    return _VTableMakeCursorImpl(self, curs, col_idx, col_name, false);
-}
-
-static bool _VTableCSra(const VTable *self) {
-    bool cSra = false;
-
-    KNamelist *names = NULL;
-
-    uint32_t i = 0, count = 0;
-
-    rc_t rc = VTableListPhysColumns(self, &names);
-
-    if (rc == 0) {
-        rc = KNamelistCount(names, &count);
-    }
-
-    for (i = 0 ; i < count && rc == 0; ++i) {
-        const char *name = NULL;
-        rc = KNamelistGet(names, i, &name);
-        if (rc == 0) {
-            const char b[] = "CMP_READ";
-            if (string_cmp(name, string_measure(name, NULL),
-                b, sizeof b - 1, sizeof b - 1) == 0)
-            {
-                cSra = true;
-                break;
-            }
-        }
-    }
-
-    RELEASE(KNamelist, names);
-
-    return cSra;
-}
-
-typedef enum {
-    eColTypeError,
-    eColTypeAbsent,
-    eColTypeStatic,
-    eColTypeNonStatic
-} EColType;
-static
-uint32_t _VTableReadFirstRowImpl(const VTable *self,
-    const char *name,
-    void *buffer,
-    uint32_t blen,
-    EColType *is_static, bool canBeLost)
-{
-    uint32_t status = eVdbBlastNoErr;
-
-    rc_t rc = 0;
-
-    const VCursor *curs = NULL;
-    uint32_t idx = 0;
-    uint32_t row_len = 0;
-
-    assert(self && name);
-
-    blen *= 8;
-
-    rc = _VTableMakeCursorImpl(self, &curs, &idx, name, canBeLost);
-    if (rc != 0) {
-        if (rc ==
-            SILENT_RC(rcVDB, rcCursor, rcOpening, rcColumn, rcUndefined)
-         || rc ==
-            SILENT_RC(rcVDB, rcCursor, rcUpdating, rcColumn, rcNotFound))
-        {
-            if (!canBeLost) {
-                PLOGMSG(klogInfo, (klogInfo, "$(f): Column '$(name)' not found",
-                    "f=%s,name=%s", __func__, name));
-            }
-            if (is_static != NULL) {
-                *is_static = eColTypeAbsent;
-            }
-            status = eVdbBlastTooExpensive;
-        }
-        else {
-            status = eVdbBlastErr;
-            if (is_static != NULL) {
-                *is_static = eColTypeError;
-            }
-        }
-    }
-
-    if (status == eVdbBlastNoErr && rc == 0) {
-        rc = VCursorOpenRow(curs);
-        if (rc != 0) {
-            PLOGERR(klogInt, (klogInt, rc,
-                "Error in VCursorOpenRow($(name))", "name=%s", name));
-        }
-    }
-
-    if (status == eVdbBlastNoErr && rc == 0 && buffer != NULL && blen > 0) {
-        rc = VCursorRead(curs, idx, 8, buffer, blen, &row_len);
-        if (rc != 0) {
-            PLOGERR(klogInt, (klogInt, rc,
-                "Error in VCursorRead($(name))", "name=%s", name));
-        }
-    }
-
-/* TODO: needs to be verified what row_len is expected
-    if (row_len != 1) return eVdbBlastErr; */
-
-    STSMSG(2, ("Read the first row of '%s'", name));
-
-    if (status == eVdbBlastNoErr && rc == 0) {
-        if (blen == 64) {
-            _VTableLogRowData(self, name, buffer, blen);
-        }
-        if (is_static != NULL) {
-            bool isStatic = false;
-            rc = VCursorIsStaticColumn(curs, idx, &isStatic);
-            if (rc != 0) {
-                PLOGERR(klogInt, (klogInt, rc,
-                    "Error in VCursorIsStaticColumn($(name))",
-                    "name=%s", name));
-            }
-            else {
-                *is_static = isStatic ? eColTypeStatic : eColTypeNonStatic;
-            }
-        }
-    }
-
-    VCursorRelease(curs);
-
-    if (status == eVdbBlastNoErr && rc != 0) {
-        status = eVdbBlastErr;
-    }
-    return status;
-}
-
-static uint32_t _VTableReadFirstRow(const VTable *self,
-    const char *name, void *buffer, uint32_t blen, EColType *is_static)
-{
-    return _VTableReadFirstRowImpl(self, name, buffer, blen, is_static, false);
-}
-
-static uint32_t _VTableGetNReads(const VTable *self, uint32_t *nreads) {
-    rc_t rc = 0;
-    uint32_t status = eVdbBlastNoErr;
-    const VCursor *curs = NULL;
-    uint32_t idx = 0;
-
-    const char name[] = "READ_LEN";
-
-    assert(nreads);
-
-    rc = _VTableMakeCursor(self, &curs, &idx, name);
-    if (rc != 0) {
-        status = eVdbBlastErr;
-        if (rc ==
-            SILENT_RC(rcVDB, rcCursor, rcOpening, rcColumn, rcUndefined))
-        {
-            PLOGMSG(klogInfo, (klogInfo, "$(f): Column '$(name)' not found",
-                "f=%s,name=%s", __func__, name));
-        }
-        else {
-            PLOGMSG(klogInfo, (klogInfo, "$(f): Cannot open column '$(name)'",
-                "f=%s,name=%s", __func__, name));
-        }
-    }
-
-    if (status == eVdbBlastNoErr) {
-        uint32_t elem_bits, elem_off, elem_cnt;
-        const void *base = NULL;
-        rc = VCursorCellDataDirect(curs, 1, idx,
-                &elem_bits, &base, &elem_off, &elem_cnt);
-        if (rc != 0) {
-            status = eVdbBlastErr;
-            PLOGMSG(klogInfo, (klogInfo,
-                "$(f): Cannot '$(name)' CellDataDirect",
-                "f=%s,name=%s", __func__, name));
-        }
-        else if (elem_off != 0 || elem_bits != 32) {
-            status = eVdbBlastErr;
-            PLOGERR(klogInt, (klogInt, rc,
-                "Bad VCursorCellDataDirect(READ_LEN) result: "
-                "boff=$(elem_off), elem_bits=$(elem_bits)",
-                "elem_off=%u, elem_bits=%u", elem_off, elem_bits));
-        }
-        else {
-            *nreads = elem_cnt;
-        }
-    }
-    
-    RELEASE(VCursor, curs);
-
-    return status;
-}
-
-
-/******************************************************************************/
-
-typedef struct ReaderCols {
-    uint32_t col_PRIMARY_ALIGNMENT_ID;
-    uint32_t col_READ_FILTER;
-    uint32_t col_READ_LEN;
-    uint32_t col_TRIM_LEN;
-    uint32_t col_TRIM_START;
-
-    int64_t *primary_alignment_id;
-    uint8_t *read_filter;
-    uint32_t *read_len;
-    INSDC_coord_len TRIM_LEN;
-    INSDC_coord_val TRIM_START;
-
-    uint8_t nReadsAllocated;
-} ReaderCols;
-static void ReaderColsReset(ReaderCols *self) {
-    assert(self);
-
-    self   ->col_PRIMARY_ALIGNMENT_ID
-     = self->col_READ_FILTER
-     = self->col_READ_LEN
-     = self->col_TRIM_LEN
-     = self->col_TRIM_START
-     = 0;
-}
-
-static
-void ReaderColsFini(ReaderCols *self)
-{
-    assert(self);
-
-    free(self->primary_alignment_id);
-    free(self->read_filter);
-    free(self->read_len);
-
-    memset(self, 0, sizeof *self);
-}
-
-/* readId is an index in primary_alignment_id : 0-based */
-static bool ReaderColsIsReadCompressed(const ReaderCols *self, uint32_t readId)
-{
-    assert(self);
-
-    if (self->col_PRIMARY_ALIGNMENT_ID == 0) {
-        return false; /* not cSRA */
-    }
-
-    assert(self->primary_alignment_id);
-    if (self->primary_alignment_id[readId] != 0) {
-        return true; /* has alignment == compressed */
-    }
-    else {
-        /* does not have alignment == not compressed == is stored in CMP_READ */
-        return false;
-    }
-}
-
-/******************************************************************************/
-
-static
-uint32_t _VCursorReadArray(const VCursor *self,
-    int64_t row_id,
-    uint32_t col,
-    void **buffer,
-    uint8_t elem_size,
-    uint8_t nReads,
-    const char *name)
-{
-    rc_t rc = 0;
-    uint32_t row_len = 0;
-
-    assert(buffer && elem_size && nReads && name);
-
-    if (*buffer == NULL) {
-        *buffer = calloc(nReads, elem_size);
-        if (*buffer == NULL)
-        {   return eVdbBlastMemErr; }
-    }
-
-    rc = VCursorReadDirect(self,
-        row_id, col, 8, *buffer, nReads * elem_size * 8, &row_len);
-    if (rc != 0) {
-        PLOGERR(klogInt, (klogInt, rc,
-            "Error in VCursorReadDirect($(name))", "name=%s", name));
-    }
-
-/* TODO: needs to be verified what row_len is expected
-    if (row_len != 1) return eVdbBlastErr; */
-
-    S
-
-    return rc == 0 ? eVdbBlastNoErr : eVdbBlastErr;
-}
-
-static
-uint32_t _VCursorAddCols(const VCursor *self,
-    ReaderCols *cols, bool cSra)
-{
-    rc_t rc = 0;
-
-    assert(self && cols);
-
-    if (rc == 0) {
-        const char name[] = "READ_FILTER";
-        rc = VCursorAddColumn(self, &cols->col_READ_FILTER, name);
-        if (rc != 0) {
-            PLOGERR(klogInt, (klogInt, rc,
-                "Error in VCursorOpen($(name))", "name=%s", name));
-        }
-        else {
-            assert(cols->col_READ_FILTER);
-        }
-    }
-
-    if (rc == 0) {
-        const char name[] = "READ_LEN";
-        rc = VCursorAddColumn(self, &cols->col_READ_LEN, name);
-        if (rc != 0) {
-            PLOGERR(klogInt, (klogInt, rc,
-                "Error in VCursorOpen($(name))", "name=%s", name));
-        }
-        else {
-            assert(cols->col_READ_LEN);
-        }
-    }
-
-    if (rc == 0) {
-        const char name[] = "TRIM_LEN";
-        rc = VCursorAddColumn(self, &cols->col_TRIM_LEN, name);
-        if (rc != 0) {
-            PLOGERR(klogInt, (klogInt, rc,
-                "Error in VCursorOpen($(name))", "name=%s", name));
-        }
-        else {
-            assert(cols->col_TRIM_LEN);
-        }
-    }
-
-    if (rc == 0) {
-        const char name[] = "TRIM_START";
-        rc = VCursorAddColumn(self, &cols->col_TRIM_START, name);
-        if (rc != 0) {
-            PLOGERR(klogInt, (klogInt, rc,
-                "Error in VCursorOpen($(name))", "name=%s", name));
-        }
-        else {
-            assert(cols->col_TRIM_START);
-        }
-    }
-
-    if (rc == 0 && cSra) {
-        const char name[] = "PRIMARY_ALIGNMENT_ID";
-        rc = VCursorAddColumn(self, &cols->col_PRIMARY_ALIGNMENT_ID, name);
-        if (rc != 0) {
-            PLOGERR(klogInt, (klogInt, rc,
-                "Error in VCursorOpen($(name))", "name=%s", name));
-        }
-        else {
-            assert(cols->col_PRIMARY_ALIGNMENT_ID);
-        }
-    }
-
-    return rc ? eVdbBlastErr : eVdbBlastNoErr;
-}
-
-static
-uint32_t _VCursorReadCols(const VCursor *self,
-    int64_t row_id,
-    ReaderCols *cols,
-    uint8_t nReads)
-{
-    uint32_t status = eVdbBlastNoErr;
-    rc_t rc = 0;
-    uint32_t row_len = ~0;
-
-    assert(cols);
-
-    if (cols->nReadsAllocated != 0 && cols->nReadsAllocated < nReads) {
-        /* LOG */
-
-        /* TODO: find a better way/place to realloc cols data buffers */
-        free(cols->primary_alignment_id);
-        cols->primary_alignment_id = NULL;
-        free(cols->read_filter);
-        cols->read_filter = NULL;
-        free(cols->read_len);
-        cols->read_len = NULL;
-    }
-
-    status = _VCursorReadArray(self, row_id, cols->col_READ_LEN,
-        (void **)&cols->read_len, sizeof *cols->read_len, nReads,
-        "READ_LEN");
-    if (status != eVdbBlastNoErr)
-    {   return status; }
-
-    status = _VCursorReadArray(self, row_id, cols->col_READ_FILTER,
-        (void **)&cols->read_filter, sizeof *cols->read_filter, nReads,
-        "READ_FILTER");
-    if (status != eVdbBlastNoErr)
-    {   return status; }
-
-    if (cols->col_PRIMARY_ALIGNMENT_ID != 0) {
-        status = _VCursorReadArray(self, row_id, cols->col_PRIMARY_ALIGNMENT_ID,
-        (void **)&cols->primary_alignment_id, sizeof *cols->primary_alignment_id,
-        nReads, "PRIMARY_ALIGNMENT_ID");
-        if (status != eVdbBlastNoErr) {
-            return status;
-        }
-    }
-
-    cols->nReadsAllocated = nReads;
-
-    rc = VCursorReadDirect(self, row_id, cols->col_TRIM_LEN,
-        8 * sizeof cols->TRIM_LEN, &cols->TRIM_LEN, sizeof cols->TRIM_LEN,
-        &row_len);
-    if (rc != 0) {
-        PLOGERR(klogInt, (klogInt, rc, "Error in VCursorReadDirect"
-            " TRIM_LEN, spot=$(spot))", "spot=%ld", row_id));
-        return eVdbBlastErr;
-    }
-    else if (row_len != 1) {
-        STSMSG(1, ("Error: VCursorReadDirect(TRIM_LEN, spot=%lu) "
-            "returned row_len=%u", row_id, row_len));
-/* TODO */ return eVdbBlastErr;
-    }
-
-    rc = VCursorReadDirect(self, row_id, cols->col_TRIM_START,
-        8 * sizeof cols->TRIM_LEN, &cols->TRIM_START, sizeof cols->TRIM_START,
-        &row_len);
-    if (rc != 0) {
-        PLOGERR(klogInt, (klogInt, rc, "Error in VCursorReadDirect"
-            " TRIM_START, spot=$(spot))", "spot=%ld", row_id));
-        return eVdbBlastErr;
-    }
-    else if (row_len != 1) {
-        STSMSG(1, ("Error: VCursorReadDirect(TRIM_START, spot=%lu) "
-            "returned row_len=%u", row_id, row_len));
-/* TODO */ return eVdbBlastErr;
-    }
-
-    return status;
-}
-
-/******************************************************************************/
-typedef uint32_t BTableType;
-enum {
-      btpUndefined
-    , btpSRA
-    , btpWGS
-    , btpREFSEQ
-};
-/******************************************************************************/
-static const char VDB_BLAST_MGR[] = "VdbBlastMgr";
-
-struct VdbBlastMgr {
-    KRefcount refcount;
-#if NO_NO_NO_NO_NO
-    SRAPath *path;
-#endif
-    VSchema *schema;
-    const VDBManager *mgr;
-    const KDBManager *kmgr;
-    VFSManager * vfs;
-    KDirectory *dir;
-    VResolver *resolver;
-};
-
-static
-void _VdbBlastMgrWhack(VdbBlastMgr *self)
-{
-    assert(self);
-
-    VSchemaRelease(self->schema);
-    VDBManagerRelease(self->mgr);
-    KDBManagerRelease(self->kmgr);
-    VFSManagerRelease ( self -> vfs );
-    KDirectoryRelease(self->dir);
-    VResolverRelease(self->resolver);
-
-    memset(self, 0, sizeof *self);
-
-    free(self);
-
-    STSMSG(1, ("Deleted VdbBlastMgr"));
-}
-
-LIB_EXPORT
-VdbBlastMgr* CC VdbBlastInit(uint32_t *status)
-{
-    VdbBlastMgr *obj = NULL;
-    rc_t rc = 0;
-
-    uint32_t dummy = eVdbBlastNoErr;
-    if (status == NULL)
-    {   status = &dummy; }
-
-    *status = eVdbBlastErr;
-
-    obj = calloc(1, sizeof *obj);
-    if (obj == NULL) {
-        *status = eVdbBlastMemErr;
-        return obj;
-    }
-
-    if ( rc == 0 )
-    {
-        rc = VFSManagerMake ( & obj -> vfs );
-        if ( rc != 0 )
-            LOGERR ( klogInt, rc, "Error in VFSManagerMake" );
-    }
-
-    if (rc == 0) {
-        rc = VFSManagerGetCWD( obj -> vfs, &obj->dir);
-        if (rc != 0)
-        {   LOGERR(klogInt, rc, "Error in VFSManagerGetCWD"); }
-    }
-
-#if 0
-    if (rc == 0) {
-        rc = SRAPathMake(&obj->path, NULL);
-        if (rc != 0) {
-            LOGERR(klogInt, rc,
-                "Error in SRAPathMake: is libsra-path.so in LD_LIBRARY_PATH?");
-        }
-    }
-#endif
-
-    if (rc == 0) {
-        rc = VDBManagerMakeRead(&obj->mgr, NULL);
-        if (rc != 0)
-        {   LOGERR(klogInt, rc, "Error in VDBManagerMakeRead"); }
-    }
-
-    if (rc == 0) {
-        rc = VDBManagerOpenKDBManagerRead(obj->mgr, &obj->kmgr);
-        if (rc != 0)
-        {   LOGERR(klogInt, rc, "Error in VDBManagerOpenKDBManagerRead"); }
-    }
-
-    if (rc == 0) {
-        rc = VDBManagerMakeSRASchema(obj->mgr, &obj->schema);
-        if (rc != 0)
-        {   LOGERR(klogInt, rc, "Error in VDBManagerMakeSRASchema"); }
-    }
-
-    if (rc == 0) {
-        VFSManager* mgr = NULL;
-        KConfig* cfg = NULL;
-        if (rc == 0) {
-            rc = VFSManagerMake(&mgr);
-        }
-        if (rc == 0) {
-            rc = KConfigMake(&cfg, NULL);
-        }
-        if (rc == 0) {
-            rc = VFSManagerMakeResolver(mgr, &obj->resolver, cfg);
-        }
-        RELEASE(KConfig, cfg);
-        RELEASE(VFSManager, mgr);
-    }
-
-    if (rc != 0) {
-        _VdbBlastMgrWhack(obj);
-        obj = NULL;
-        STSMSG(1, ("Error: failed to create VdbBlastMgr"));
-    }
-    else {
-        KRefcountInit(&obj->refcount, 1, VDB_BLAST_MGR, __func__, "mgr");
-        *status = eVdbBlastNoErr;
-        STSMSG(1, ("Created VdbBlastMgr"));
-    }
-
-    return obj;
-}
-
-LIB_EXPORT
-VdbBlastMgr* CC VdbBlastMgrAddRef(VdbBlastMgr *self)
-{
-    if (self == NULL) {
-        STSMSG(1, ("VdbBlastMgrAddRef(NULL)"));
-        return self;
-    }
-
-    if (KRefcountAdd(&self->refcount, VDB_BLAST_MGR) == krefOkay) {
-        STSMSG(1, ("VdbBlastMgrAddRef"));
-        return self;
-    }
-
-    STSMSG(1, ("Error: failed to VdbBlastMgrAddRef"));
-    return NULL;
-}
-
-LIB_EXPORT
-void CC VdbBlastMgrRelease(VdbBlastMgr *self)
-{
-    if (self == NULL)
-    {   return; }
-
-    STSMSG(1, ("VdbBlastMgrRelease"));
-    if (KRefcountDrop(&self->refcount, VDB_BLAST_MGR) != krefWhack)
-    {   return; }
-
-    _VdbBlastMgrWhack(self);
-}
-
-/* schema at name in metadata for WGS runs starts with "NCBI:WGS:db:contig" */
-static
-bool _VdbBlastMgrIsRunWgs(VdbBlastMgr *self, const char *rundesc)
-{
-    bool wgs = false;
-    rc_t rc = 0;
-    const VDatabase *db = NULL;
-    const KMetadata *meta = NULL;
-    const KMDataNode *node = NULL;
-    char buffer[512] = "";
-    size_t size = 0;
-    assert(self);
-    rc = VDBManagerOpenDBRead(self->mgr, &db, NULL, rundesc);
-    if (rc == 0) {
-        rc = VDatabaseOpenMetadataRead(db, &meta);
-    }
-    if (rc == 0) {
-        rc = KMetadataOpenNodeRead(meta, &node, "schema");
-    }
-    if (rc == 0) {
-        rc = KMDataNodeReadAttr(node, "name", buffer, sizeof buffer, &size);
-    }
-    if (rc == 0) {
-        const char database[] = "NCBI:WGS:db:contig";
-        uint32_t max_chars = sizeof database - 1;
-        STSMSG(2,("%s.schema at name='%.*s'", rundesc, (uint32_t)size, buffer));
-        if (size >= sizeof database && 
-            string_cmp(buffer, max_chars, database, max_chars, max_chars) == 0)
-        {
-            STSMSG(1,("%s is wgs", rundesc));
-            wgs = true;
-        }
-    }
-    RELEASE(KMDataNode, node);
-    RELEASE(KMetadata, meta);
-    RELEASE(VDatabase, db);
-    return wgs;
-}
-
-/* TODO: should be replaced by a function to get the type from run [meta] */
-static
-BTableType _VdbBlastMgrBTableTypeFromPath(VdbBlastMgr *self,
-    const char *rundesc)
-{
-    rc_t rc = 0;
-    VPath *acc = NULL;
-    const VPath *local = NULL;
-    const String *str = NULL;
-    char *s = NULL;
-    BTableType t = btpSRA;
-    const char *log = "UNEXPECTED";
-
-    assert(self && rundesc);
-
-    rc = VFSManagerMakePath ( self -> vfs, &acc, rundesc);
-    if (rc == 0) {
-        rc = VResolverQuery(self->resolver,
-            eProtocolHttp, acc, &local, NULL, NULL);
-    }
-    if (rc == 0) {
-        rc = VPathMakeString(local, &str);
-    }
-
-    if (rc == 0) {
-        s = strstr(str->addr, "/WGS/");
-        if (s != NULL) {
-            t = btpWGS;
-        }
-        else {
-            s = strstr(str->addr, "/refseq/");
-            if (s != NULL) {
-                t = btpREFSEQ;
-            }
-            else {
-                if (_VdbBlastMgrIsRunWgs(self, rundesc)) {
-                    t = btpWGS;
-                }
-            }
-        }
-    }
-
-    switch (t) {
-        case btpSRA:
-            log = "SRA";
-            break;
-        case btpWGS:
-            log = "WGS";
-            break;
-        case btpREFSEQ:
-            log = "REFSEQ";
-            break;
-        default:
-            log = "UNEXPECTED";
-            break;
-    }
-
-    STSMSG(1, ("Type of %s is %s", rundesc, log));
-
-    RELEASE(VPath, local);
-    RELEASE(VPath, acc);
-    free((void*)str);
-
-    return t;
-}
-
-static
-uint32_t _VdbBlastMgrOpenTable(const VdbBlastMgr *self,
-    const char *path,
-    const VTable **tbl)
-{
-    KPathType type = kptNotFound;
-    VSchema *schema = NULL;
-
-    assert(self && tbl);
-    *tbl = NULL;
-
-    /* Always use VDBManagerMakeSRASchema to VDBManagerOpenTableRead
-       Otherwise CMP_BASE_COUNT column sometimes cannot be found */
-    schema = self->schema;
-
-    type = KDBManagerPathType(self->kmgr, path);
-    if (type == kptNotFound) {
-        STSMSG(1, ("Error: cannot find '%s'", path));
-        return eVdbBlastErr;
-    }
-
-    if ((type & ~kptAlias) == kptDatabase) {
-        const char *table = "SEQUENCE";
-        const VDatabase *db = NULL;
-        rc_t rc = VDBManagerOpenDBRead(self->mgr, &db, NULL, path);
-        if (rc != 0) {
-            PLOGERR(klogInt, (klogInt, rc,
-                "Error in VDBManagerOpenDBRead($(name))", "name=%s", path));
-            STSMSG(1, ("Error: failed to open DB '%s'", path));
-            return eVdbBlastErr;
-        }
-        rc = VDatabaseOpenTableRead(db, tbl, table);
-        if (rc != 0) {
-            PLOGERR(klogInt, (klogInt, rc,
-                "Error in VDatabaseOpenTableRead($(name), $(tbl))",
-                "name=%s,tbl=%s", path, table));
-            STSMSG(1, ("Error: failed to open DB table '%s/%s'", path, table));
-        }
-        else {
-            STSMSG(1, ("Opened DB table '%s/%s'", path, table));
-        }
-        VDatabaseRelease(db);
-
-        return rc != 0 ? eVdbBlastErr : eVdbBlastNoErr;
-    }
-
-    while (true) {
-        rc_t rc = VDBManagerOpenTableRead(self->mgr, tbl, schema, path);
-        if (rc == 0) {
-            if (schema == NULL) {
-                STSMSG(1, ("Opened table '%s'(schema=NULL)", path));
-            }
-            else {
-                STSMSG(1, ("Opened table '%s'(SRASchema)", path));
-            }
-            return eVdbBlastNoErr;
-        }
-
-        assert(self->schema);
-
-        if (schema == NULL)
-        {   schema = self->schema; }
-        else {
-            PLOGERR(klogInt, (klogInt, rc,
-                "Error in VDBManagerOpenTableRead($(name))", "name=%s", path));
-            STSMSG(1, ("Error: failed to open table '%s'", path));
-            return eVdbBlastRunErr;
-        }
-    }
-}
-
-static
-uint32_t _VdbBlastMgrFindNOpenTable(VdbBlastMgr *self,
-    const char *rundesc,
-    const VTable **tbl,
-    BTableType *type,
-    char **fullpath)
-{
-    uint32_t status = eVdbBlastNoErr;
-    char *path = (char*) rundesc;
-
-    assert(self && type);
-
-#if 0
-    if (KDirectoryPathType(self->dir, path) == kptNotFound) {
-        if (!SRAPathTest(self->path, rundesc)) {
-            size_t bufsize = 4096;
-            while (true) {
-                rc_t rc = 0;
-                path = malloc(bufsize);
-                if (path == NULL)
-                {   return eVdbBlastMemErr; }
-
-                rc = SRAPathFind(self->path, rundesc, path, bufsize);
-                if (rc == 0) {
-                    STSMSG(2, ("%s -> %s", rundesc, path));
-                    if (fullpath != NULL)
-                    {   *fullpath = string_dup(path, bufsize); }
-                    break;
-                }
-
-                free(path);
-                path = NULL;
-                if (GetRCState(rc) == rcNotFound) {
-                    PLOGERR(klogInt, (klogInt, rc,
-                        "Not found: '$(path)'", "path=%s", rundesc));
-                    STSMSG(1, ("Error: not found '%s'", rundesc));
-                    return eVdbBlastRunErr;
-                }
-                else if (GetRCState(rc) == rcInsufficient) {
-                    bufsize *= 2;
-                    continue;
-                }
-                else {
-                    PLOGERR(klogInt, (klogInt, rc,
-                        "Error while searching for '$(path)'",
-                        "path=%s", rundesc));
-                    STSMSG(1, ("Error: while searching for '%s'", rundesc));
-                    return eVdbBlastErr;
-                }
-            }
-        }
-    }
-#endif
-
-    status = _VdbBlastMgrOpenTable(self, path, tbl);
-    if (status == eVdbBlastNoErr) {
-        STSMSG(1, ("Added run %s(%s)", rundesc, path));
-    }
-    else {
-        STSMSG(1, ("Error: failed to add run %s(%s)", rundesc, path));
-    }
-
-    *type = _VdbBlastMgrBTableTypeFromPath(self, path);
-
-    if (path != rundesc) {
-        free(path);
-        path = NULL;
-    }
-
-    return status;
-}
-
-/******************************************************************************/
-
-LIB_EXPORT uint32_t CC VdbBlastMgrKLogLevelSet(const VdbBlastMgr *self,
-    KLogLevel lvl)
-{
-    rc_t rc = KLogLevelSet(lvl);
-
-    if (rc != 0) {
-        S
-        return eVdbBlastErr;
-    }
-
-    return eVdbBlastNoErr;
-}
-
-LIB_EXPORT uint32_t CC VdbBlastMgrKLogLevelSetInfo(
-    const VdbBlastMgr *self)
-{   return VdbBlastMgrKLogLevelSet(self, klogInfo); }
-
-LIB_EXPORT uint32_t CC VdbBlastMgrKLogLevelSetWarn(
-    const VdbBlastMgr *self)
-{   return VdbBlastMgrKLogLevelSet(self, klogWarn); }
-
-LIB_EXPORT uint32_t CC VdbBlastMgrKLogHandlerSetStdOut(
-    const VdbBlastMgr *self)
-{
-    rc_t rc = KLogHandlerSetStdOut();
-
-    if (rc != 0) {
-        S
-        return eVdbBlastErr;
-    }
-
-    return eVdbBlastNoErr;
-}
-
-LIB_EXPORT
-uint32_t CC VdbBlastMgrKLogLibHandlerSetStdOut(const VdbBlastMgr *self)
-{
-    rc_t rc = KLogLibHandlerSetStdOut();
-
-    if (rc != 0) {
-        S
-        return eVdbBlastErr;
-    }
-
-    return eVdbBlastNoErr;
-}
-
-LIB_EXPORT uint32_t CC VdbBlastMgrKLogHandlerSetStdErr(
-    const VdbBlastMgr *self)
-{
-    rc_t rc = KLogHandlerSetStdErr();
-
-    if (rc != 0) {
-        S
-        return eVdbBlastErr;
-    }
-
-    return eVdbBlastNoErr;
-}
-
-LIB_EXPORT
-uint32_t CC VdbBlastMgrKLogLibHandlerSetStdErr(const VdbBlastMgr *self)
-{
-    rc_t rc = KLogLibHandlerSetStdErr();
-
-    if (rc != 0) {
-        S
-        return eVdbBlastErr;
-    }
-
-    return eVdbBlastNoErr;
-}
-
-LIB_EXPORT uint32_t CC VdbBlastMgrKLogHandlerSet(const VdbBlastMgr *self,
-    KWrtWriter writer, void *data)
-{
-    rc_t rc = KLogHandlerSet(writer, data);
-
-    if (rc != 0) {
-        S
-        return eVdbBlastErr;
-    }
-
-    return eVdbBlastNoErr;
-}
-
-LIB_EXPORT uint32_t CC VdbBlastMgrKLogLibHandlerSet(const VdbBlastMgr *self,
-    KWrtWriter writer, void *data)
-{
-    rc_t rc = KLogLibHandlerSet(writer, data);
-
-    if (rc != 0) {
-        S
-        return eVdbBlastErr;
-    }
-
-    return eVdbBlastNoErr;
-}
-
-/******************************************************************************/
-
-LIB_EXPORT void CC VdbBlastMgrKStsLevelSet(const VdbBlastMgr *self,
-    uint32_t level)
-{   KStsLevelSet(level); }
-
-LIB_EXPORT
-uint32_t CC VdbBlastMgrKStsHandlerSetStdOut(const VdbBlastMgr *self)
-{
-    rc_t rc = KStsHandlerSetStdOut();
-
-    if (rc != 0) {
-        S
-        return eVdbBlastErr;
-    }
-
-    return eVdbBlastNoErr;
-}
-
-LIB_EXPORT
-uint32_t CC VdbBlastMgrKStsHandlerSetStdErr(const VdbBlastMgr *self)
-{
-    rc_t rc = KStsHandlerSetStdErr();
-
-    if (rc != 0) {
-        S
-        return eVdbBlastErr;
-    }
-
-    return eVdbBlastNoErr;
-}
-
-/******************************************************************************/
-/* KOutHandlerSet
- * set output handler for different channels
- *
- * returns status code
- */
-LIB_EXPORT
-uint32_t CC VdbBlastMgrKOutHandlerSetStdOut(const VdbBlastMgr *self)
-{
-    rc_t rc = KOutHandlerSetStdOut();
-
-    if (rc != 0) {
-        S
-        return eVdbBlastErr;
-    }
-
-    return eVdbBlastNoErr;
-}
-
-LIB_EXPORT
-uint32_t CC VdbBlastMgrKOutHandlerSetStdErr(const VdbBlastMgr *self)
-{
-    rc_t rc = KOutHandlerSetStdErr();
-
-    if (rc != 0) {
-        S
-        return eVdbBlastErr;
-    }
-
-    return eVdbBlastNoErr;
-}
-
-LIB_EXPORT uint32_t CC VdbBlastMgrKOutHandlerSet(const VdbBlastMgr *self,
-    VdbBlastKWrtWriter writer, void *data)
-{
-    rc_t rc = KOutHandlerSet(writer, data);
-
-    if (rc != 0) {
-        S
-        return eVdbBlastErr;
-    }
-
-    return eVdbBlastNoErr;
-}
-
-/******************************************************************************/
-
-LIB_EXPORT uint32_t CC VdbBlastMgrKDbgSetString(const VdbBlastMgr *self,
-    const char *string)
-{
-    rc_t rc = KDbgSetString(string);
-
-    if (rc != 0) {
-        S
-        return eVdbBlastErr;
-    }
-
-    return eVdbBlastNoErr;
-}
-
-/******************************************************************************/
-
-/* KConfigPrint
- * print current configuration to the output handler
- */
-LIB_EXPORT uint32_t VdbBlastMgrKConfigPrint ( const VdbBlastMgr *self ) {
-    KConfig *kfg = NULL;
-
-    rc_t rc = KConfigMake(&kfg, NULL);
-
-    if (rc == 0) {
-        rc = KConfigPrint(kfg, 0);
-    }
-
-    {
-        rc_t rc2 = KConfigRelease(kfg);
-        if (rc == 0 && rc2 != 0) {
-            rc = rc2;
-        }
-    }
-
-    if (rc != 0) {
-        S
-        return eVdbBlastErr;
-    }
-
-    return eVdbBlastNoErr;
-}
-
-/******************************************************************************/
-typedef struct {
-    uint64_t spotCount;
-    uint8_t nReads;
-    uint8_t nBioReads; /* knowing filtering (if static) and min_read_len info */
-    uint64_t bioLen; /* per read. is assigned just when allStatic */
-    INSDC_SRA_platform_id platform;
-
-    uint64_t bioBaseCount; /* BIO_BASE_COUNT, ~0 if not found */
-    uint64_t cmpBaseCount; /* CMP_BASE_COUNT, ~0 if not found */
-
-    INSDC_read_type *readType;
-    EColType readTypeStatic;
-
-    uint32_t *readLen;
-    EColType readLenStatic;
-
-    uint8_t *rdFilter;
-    EColType rdFilterStatic;
-
-    bool varReadLen;
-} RunDesc;
-static
-void _RunDescFini(RunDesc *self)
-{
-    assert(self);
-    free(self->readLen);
-    free(self->readType);
-    free(self->rdFilter);
-    memset(self, 0, sizeof *self);
-}
-
-static char* _CanonocalName(const char *name) {
-    size_t noExtSize = 0;
-    size_t namelen = 0;
-    const char ext[] = ".sra";
-
-    if (name == NULL) {
-        return NULL;
-    }
-
-    noExtSize = namelen = string_size(name);
-
-    if (namelen >= sizeof(ext)) {
-        const char *tail = NULL;
-        noExtSize -= sizeof ext - 1;
-        tail = name + noExtSize;
-        if (string_cmp(ext, sizeof ext - 1, tail, sizeof ext - 1, 99) != 0) {
-            noExtSize = namelen;
-        }
-    }
-
-    return string_dup(name, noExtSize);
-}
-
-/******************************************************************************/
-typedef struct VdbBlastRun {
-    /* rundesc; */
-    char *acc;
-    char *path;
-
-    const VTable *tbl;
-    BTableType type;
-    bool cSra;
-
-    uint64_t bioReads;       /* numSequences; */
-    bool bioReadsTooExpensive; /* numSequences is TooExpensive */
-    uint64_t bioReadsApprox; /* numSequencesApprox; */
-
-    uint64_t bioBases;       /* length; */
-    bool bioBasesTooExpensive; /* totalLength is TooExpensive */
-    uint64_t bioBasesApprox; /* lengthApprox; */
-
-    RunDesc rd;
-
-    uint32_t min_read_length;
-
-    /* WGS */
-    const VCursor *cursACCESSION;
-    uint32_t col_ACCESSION;
-} VdbBlastRun;
-static
-uint32_t _VdbBlastRunFillRunDesc(VdbBlastRun *self)
-{
-    uint32_t status = eVdbBlastNoErr;
-    RunDesc *rd = NULL;
-
-    int i = 0;
-    const char *col = NULL;
-
-    assert(self);
-
-    rd = &self->rd;
-
-    if (rd->spotCount || rd->readType || rd->nReads || rd->nBioReads) {
-        if (self->cSra && rd->cmpBaseCount == ~0) {
-            rc_t rc = RC(rcSRA, rcTable, rcReading, rcColumn, rcNotFound);
-            PLOGERR(klogInt, (klogInt, rc,
-                "Cannot read CMP_BASE_COUNT column for $(p)",
-                "p=%s", self->path));
-            STSMSG(1, ("Error: failed to read %s/%s",
-                self->path, "CMP_BASE_COUNT"));
-            return eVdbBlastErr;
-        }
-        else {
-            S
-            return eVdbBlastNoErr;
-        }
-    }
-
-    assert(self->path);
-
-    col = "SPOT_COUNT";
-    status = _VTableReadFirstRow(self->tbl,
-        col, &rd->spotCount, sizeof rd->spotCount, NULL);
-    if (status != eVdbBlastNoErr) {
-        STSMSG(1, ("Error: failed to read %s/%s", self->path, col));
-        return status;
-    }
-
-    if (self->type == btpWGS) {
-        S
-        status = eVdbBlastNoErr;
-        rd->nReads = rd->spotCount > 0 ? 1 : 0;
-    }
-    else if (self->type == btpREFSEQ) {
-        S
-        status = eVdbBlastNoErr;
-        rd->nReads = 1;
-    }
-    else {
-        uint32_t nreads = 0;
-        status = _VTableGetNReads(self->tbl, &nreads);
-        if (status == eVdbBlastNoErr) {
-            rd->nReads = nreads;
-        }
-    }
-
-    switch (self->type) {
-        case btpSRA:
-            col = "PLATFORM";
-            status = _VTableReadFirstRow(self->tbl,
-                col, &rd->platform, sizeof rd->platform, NULL);
-            if (status != eVdbBlastNoErr) {
-                STSMSG(1, ("Error: failed to read %s/%s", self->path, col));
-                return status;
-            }
-            switch (rd->platform) { /* TODO */
-                case SRA_PLATFORM_ILLUMINA:
-                case SRA_PLATFORM_ABSOLID:
-                case SRA_PLATFORM_COMPLETE_GENOMICS:
-                    rd->varReadLen = false;
-                    break;
-                case SRA_PLATFORM_UNDEFINED:
-                case SRA_PLATFORM_454:
-                case SRA_PLATFORM_HELICOS:
-                case SRA_PLATFORM_PACBIO_SMRT:
-                case SRA_PLATFORM_ION_TORRENT:
-                default:
-                    rd->varReadLen = true;
-                    break;
-            }
-            break;
-        case btpWGS:
-            rd->varReadLen = true;
-            break;
-        case btpREFSEQ:
-            break;
-        default:
-            assert(0);
-            break;
-    }
-
-    col = "READ_TYPE";
-    if (rd->readType == NULL) {
-        rd->readType = calloc(rd->nReads, sizeof *rd->readType);
-        if (rd->readType == NULL)
-        {   return eVdbBlastMemErr; }
-    }
-    status = _VTableReadFirstRow(self->tbl, col,
-        rd->readType, rd->nReads * sizeof *rd->readType, &rd->readTypeStatic);
-    /* TODO: check case when ($#READ_TYPE == 0 && nreads > 0) */
-    if (status != eVdbBlastNoErr) {
-        if (status == eVdbBlastTooExpensive) {
-            status = eVdbBlastNoErr;
-        }
-        else {
-            STSMSG(1, ("Error: failed to read %s/%s", self->path, col));
-            return status;
-        }
-    }
-
-    col = "READ_LEN";
-    if (rd->readLen == NULL) {
-        rd->readLen = calloc(rd->nReads, sizeof *rd->readLen);
-        if (rd->readLen == NULL)
-        {   return eVdbBlastMemErr; }
-    }
-    status = _VTableReadFirstRow(self->tbl, col,
-        rd->readLen, rd->nReads * sizeof *rd->readLen, &rd->readLenStatic);
-    /* TODO: check case when ($#READ_TYPE == 0 && nreads > 0) */
-    if (status != eVdbBlastNoErr) {
-        STSMSG(1, ("Error: failed to read %s/%s", self->path, col));
-        return status;
-    }
-
-    col = "READ_FILTER"; /* col = "RD_FILTER"; */
-    if (rd->rdFilter == NULL) {
-        rd->rdFilter = calloc(rd->nReads, sizeof *rd->rdFilter);
-        if (rd->rdFilter == NULL)
-        {   return eVdbBlastMemErr; }
-    }
-    status = _VTableReadFirstRow(self->tbl, col,
-        rd->rdFilter, rd->nReads * sizeof *rd->rdFilter, &rd->rdFilterStatic);
-    if (status != eVdbBlastNoErr) {
-        if (status == eVdbBlastTooExpensive) {
-            status = eVdbBlastNoErr;
-        }
-        else {
-            STSMSG(1, ("Error: failed to read %s/%s", self->path, col));
-            return status;
-        }
-    }
-
-    col = "BIO_BASE_COUNT";
-    status = _VTableReadFirstRowImpl(self->tbl, col,
-        &rd->bioBaseCount, sizeof rd->bioBaseCount, NULL,
-        true);/*Do not generate error message when BIO_BASE_COUNT is not found*/
-
-    if (status != eVdbBlastNoErr) {
-        if (status == eVdbBlastTooExpensive) {
-            status = eVdbBlastNoErr;
-            rd->bioBaseCount = ~0;
-        }
-        else {
-            STSMSG(1, ("Error: failed to read %s/%s", self->path, col));
-            return status;
-        }
-    }
-
-    col = "CMP_BASE_COUNT";
-    status = _VTableReadFirstRow(self->tbl, col,
-        &rd->cmpBaseCount, sizeof rd->cmpBaseCount, NULL);
-    if (status != eVdbBlastNoErr) {
-        if (status == eVdbBlastTooExpensive) {
-            /* CMP_BASE_COUNT should be always found */
-            rc_t rc = RC(rcSRA, rcTable, rcReading, rcColumn, rcNotFound);
-            PLOGERR(klogInt, (klogInt, rc,
-                "Cannot read CMP_BASE_COUNT column for $(p)",
-                "p=%s", self->path));
-            STSMSG(1, ("Error: failed to read %s/%s",
-                self->path, "CMP_BASE_COUNT"));
-            rd->cmpBaseCount = ~0;
-            return eVdbBlastErr;
-        }
-        else {
-            STSMSG(1, ("Error: failed to read %s/%s", self->path, col));
-            return status;
-        }
-    }
-
-    for (rd->nBioReads = 0, i = 0; i < rd->nReads; ++i) {
-        S
-        if (rd->readType[i] & SRA_READ_TYPE_BIOLOGICAL) {
-            if ((rd->rdFilterStatic == eColTypeStatic &&
-                 rd->rdFilter[i] == READ_FILTER_PASS) 
-                || (rd->rdFilterStatic == eColTypeAbsent))
-            {
-                ++rd->nBioReads;
-                rd->bioLen += rd->readLen[i];
-            }
-            else {
-                ++rd->nBioReads;
-            }
-        }
-    }
-    S /* LOG nBioReads */
-
-    return status;
-}
-
-static VdbBlastStatus _VdbBlastRunInit(VdbBlastRun *self,
-    const VTable *tbl, const char *rundesc, BTableType type,
-    const KDirectory *dir, char *fullpath, uint32_t min_read_length)
-{
-    rc_t rc = 0;
-    const char *acc = rundesc;
-    char rbuff[4096] = "";
-    size_t size = 0;
-
-#if WINDOWS
-    char slash = '\\';
-#else
-    char slash = '/';
-#endif
-
-    assert(self && tbl && type != btpUndefined && rundesc);
-
-/* TODO This is obsolete and incorrect */
-    rc = KDirectoryResolvePath(dir, true, rbuff, sizeof rbuff, rundesc);
-    if (rc != 0) {
-        S
-        return eVdbBlastErr;
-    }
-
-    memset(self, 0, sizeof *self);
-
-    self->tbl = tbl;
-    self->type = type;
-
-    self->bioReads = self->bioReadsApprox
-        = self->bioBases = self->bioBasesApprox = ~0;
-
-    acc = strrchr(rbuff, slash);
-    if (acc == NULL) {
-        acc = rbuff;
-    }
-    else if (string_measure(acc, &size) > 1) {
-        ++acc;
-    }
-    else {
-        acc = rbuff;
-    }
-
-    if (fullpath == NULL) {
-        self->path = string_dup(rbuff, sizeof(rbuff));
-        if (self->path == NULL) {
-            return eVdbBlastMemErr;
-        }
-    }
-    else {
-        self->path = fullpath;
-    }
-    self->acc = _CanonocalName(acc);
-    if (self->acc == NULL) {
-        return eVdbBlastMemErr;
-    }
-
-    self->min_read_length = min_read_length;
-
-    self->cSra = _VTableCSra(self->tbl);
-
-    return eVdbBlastNoErr;
-}
-
-static
-void _VdbBlastRunFini(VdbBlastRun *self)
-{
-    if (self == NULL)
-    {   return; }
-
-    VCursorRelease(self->cursACCESSION);
-    VTableRelease(self->tbl);
-
-    free(self->acc);
-    free(self->path);
-
-    _RunDescFini(&self->rd);
-
-    memset(self, 0, sizeof *self);
-}
-
-/* _VdbBlastRunGetNumSequences
-    returns (number of spots) * (number of biological reads in spot).
-    If read_filter is not static: some reads could be filtered,
-    so status is set to eVdbBlastTooExpensive */
-static
-uint64_t _VdbBlastRunGetNumSequences(VdbBlastRun *self,
-    uint32_t *status)
-{
-    assert(self && status);
-
-    *status = eVdbBlastNoErr;
-
-    if (self->bioReads == ~0) {
-        RunDesc *rd = NULL;
-
-        if (self->type == btpREFSEQ) {
-            S
-            self->bioReads = 1;
-        }
-        else {
-            *status = _VdbBlastRunFillRunDesc(self);
-            if (*status != eVdbBlastNoErr) {
-                S
-                return 0;
-            }
-
-            rd = &self->rd;
-
-            if (rd->rdFilterStatic != eColTypeStatic) {
-                self->bioReadsTooExpensive = true;
-            }
-
-            if (self->cSra) {
-                self->bioReadsTooExpensive = true;
-            }
-
-            self->bioReads = rd->spotCount * rd->nBioReads;
-            S
-        }
-    }
-    else {
-        S
-    }
-
-    if (*status == eVdbBlastNoErr && self->bioReadsTooExpensive) {
-        *status = eVdbBlastTooExpensive;
-    }
-    return self->bioReads;
-}
-
-static
-uint64_t _VdbBlastRunGetLength(VdbBlastRun *self,
-    uint32_t *status)
-{
-    uint32_t dummy = eVdbBlastNoErr;
-    if (status == NULL)
-    {   status = &dummy; }
-
-    *status = eVdbBlastNoErr;
-
-    if (self->bioBasesTooExpensive) {
-        *status = eVdbBlastTooExpensive;
-        return 0;
-    }
-    else if (self->bioBases == ~0) {
-        if (self->cSra) {
-            *status = _VdbBlastRunFillRunDesc(self);
-            if (*status != eVdbBlastNoErr) {
-                S
-                return 0;
-            }
-            self->bioBases = self->rd.cmpBaseCount;
-        }
-        else {
-//    if BIO_BASE_COUNT is not found then status is set to eVdbBlastTooExpensive
-            *status = _VTableReadFirstRowImpl(self->tbl, "BIO_BASE_COUNT",
-                &self->bioBases, sizeof self->bioBases, NULL, true);
-            if (*status == eVdbBlastTooExpensive) {
-                self->bioBasesTooExpensive = true;
-            }
-        }
-    }
-
-    if (*status == eVdbBlastNoErr) {
-        S
-        return self->bioBases;
-    }
-    else {
-        S
-        return 0;
-    }
-}
-static
-rc_t _VCursorCellDataDirect(const VCursor *self,
-    int64_t row_id,
-    uint32_t col_idx,
-    uint32_t elemBits,
-    const void **base,
-    uint32_t nreads,
-    const char *name)
-{
-    uint32_t elem_bits = 0;
-    uint32_t row_len = 0;
-    uint32_t boff = 0;
-
-    rc_t rc = VCursorCellDataDirect(self, row_id, col_idx,
-        &elem_bits, base, &boff, &row_len);
-
-    if (rc != 0) {
-        PLOGERR(klogInt, (klogInt, rc,
-            "Error during VCursorCellDataDirect($(name), $(spot))",
-            "name=%s,spot=%lu", name, col_idx));
-    }
-    else if (boff != 0 || elem_bits != elemBits) {
-        rc = RC(rcSRA, rcCursor, rcReading, rcData, rcUnexpected);
-        PLOGERR(klogInt, (klogInt, rc,
-            "Bad VCursorCellDataDirect($(name), $(spot)) result: "
-            "boff=$(boff), elem_bits=$(elem_bits)",
-            "name=%s,spot=%lu,boff=%u,elem_bits=%u",
-            name, col_idx, boff, elem_bits));
-    }
-    else if (row_len != nreads) {
-        rc = RC(rcSRA, rcCursor, rcReading, rcData, rcUnexpected);
-        PLOGERR(klogInt, (klogInt, rc,
-            "Bad VCursorCellDataDirect($(name), $(spot)) result: "
-            "row_len=$(row_len)",
-            "name=%s,spot=%lu,row_len=%u", name, col_idx, row_len));
-    }
-
-    return rc;
-}
-
-typedef struct {
-    const VCursor *curs;
-    uint32_t colREAD_LEN;
-    uint32_t colREAD_TYPE;
-    uint64_t techBasesPerSpot;
-    bool techBasesPerSpotEquals;
-    uint64_t bioBasesCnt;
-} ApprCnt;
-static rc_t _ApprCntChunk(ApprCnt *self,
-    uint64_t chunk, uint64_t l, uint64_t nspots, uint32_t nreads)
-{
-    rc_t rc = 0;
-    uint64_t start = nspots / 10 * chunk + 1;
-    uint64_t spot = 0;
-    uint64_t end = start + l;
-    assert(self);
-    if (end - 1 > nspots) {
-        end = nspots + 1;
-    }
-    for (spot = start; spot < end; ++spot) {
-        uint64_t techBases = 0;
-        uint64_t bioBases = 0;
-        uint32_t read = 0;
-        const uint32_t *readLen = NULL;
-        const INSDC_read_type *readType = NULL;
-        const void *base = NULL;
-        rc = _VCursorCellDataDirect(self->curs, spot, self->colREAD_LEN,
-            32, &base, nreads, "READ_LEN");
-        if (rc != 0) {
-            return rc;
-        }
-        readLen = base;
-        rc = _VCursorCellDataDirect(self->curs, spot, self->colREAD_TYPE,
-            8, &base, nreads, "READ_TYPE");
-        if (rc != 0) {
-            return rc;
-        }
-        readType = base;
-        for (read = 0; read < nreads; ++read) {
-            INSDC_read_type type = readType[read] & 1;
-            if (type == READ_TYPE_BIOLOGICAL) {
-                bioBases += readLen[read];
-            }
-            else {
-                techBases += readLen[read];
-            }
-        }
-        if (self->techBasesPerSpotEquals) {
-            if (self->techBasesPerSpot != techBases) {
-                if (self->techBasesPerSpot == ~0) {
-                    self->techBasesPerSpot = techBases;
-                }
-                else {
-                    self->techBasesPerSpotEquals = false;
-                }
-            }
-        }
-        self->bioBasesCnt += bioBases;
-    }
-    return rc;
-}
-static
-rc_t _ApprCntInit(ApprCnt *self,
-    const VTable *tbl)
-{
-    rc_t rc = 0;
-
-    assert(self);
-
-    memset(self, 0, sizeof *self);
-
-    self->techBasesPerSpotEquals = true;
-    self->techBasesPerSpot = ~0;
-
-    if (rc == 0) {
-        rc = VTableCreateCursorRead(tbl, &self->curs);
-        if (rc != 0) {
-            LOGERR(klogInt, rc, "Error during VTableCreateCursorRead");
-        }
-    }
-
-    if (rc == 0) {
-        const char name[] = "READ_LEN";
-        rc = VCursorAddColumn(self->curs, &self->colREAD_LEN, name);
-        if (rc != 0) {
-            PLOGERR(klogInt, (klogInt, rc,
-                "Error during VCursorAddColumn($(name))", "name=%s", name));
-        }
-    }
-
-    if (rc == 0) {
-        const char name[] = "READ_TYPE";
-        rc = VCursorAddColumn(self->curs, &self->colREAD_TYPE, name);
-        if (rc != 0) {
-            PLOGERR(klogInt, (klogInt, rc,
-                "Error during VCursorAddColumn($(name))", "name=%s", name));
-        }
-    }
-
-    if (rc == 0) {
-        rc = VCursorOpen(self->curs);
-        if (rc != 0) {
-            LOGERR(klogInt, rc, "Error during VCursorOpen");
-        }
-    }
-
-    return rc;
-}
-static
-rc_t _ApprCntFini(ApprCnt *self)
-{
-    rc_t rc = 0;
-    assert(self);
-    RELEASE(VCursor, self->curs);
-    memset(self, 0, sizeof *self);
-    return rc;
-}
-static uint64_t BIG = 10000 /*11*/; 
-static
-rc_t _VTableBioBaseCntApprox(const VTable *self,
-    uint64_t nspots, uint32_t nreads, uint64_t *bio_base_count)
-{
-    rc_t rc = 0;
-    uint64_t c = nspots;
-    uint64_t d = 1;
-    ApprCnt ac;
-    rc = _ApprCntInit(&ac, self);
-    assert(bio_base_count);
-    if (rc == 0) {
-        if (nspots < BIG) {
-            STSMSG(2,
-                ("VdbBlastRunSetGetTotalLengthApprox: counting all reads\n"));
-            rc = _ApprCntChunk(&ac, 0, nspots, nspots, nreads);
-        }
-        else {
-            uint64_t i = 0;
-            uint64_t l = 0;
-            uint64_t n = 10 /* 3 */;
-            while (c > BIG) {
-                c /= 2;
-                d *= 2;
-            }
-            l = c / n;
-            if (l == 0) {
-                l = 1;
-            }
-            for (i = 1; i < n - 1 && rc == 0; ++i) {
-                rc = _ApprCntChunk(&ac, i, l, nspots, nreads);
-            }
-        }
-    }
-    if (rc == 0) {
-        uint32_t status = eVdbBlastNoErr;
-        if (nspots < BIG) {
-            *bio_base_count = ac.bioBasesCnt;
-        }
-        else {
-            if (ac.techBasesPerSpotEquals && ac.techBasesPerSpot == ~0) {
-                ac.techBasesPerSpotEquals = false;
-            }
-            if (ac.techBasesPerSpotEquals ) {
-                uint64_t baseCount = 0;
-                status = _VTableReadFirstRow(
-                    self, "BASE_COUNT", &baseCount, sizeof baseCount, NULL);
-                if (status == eVdbBlastNoErr) {
-                    STSMSG(2, ("VdbBlastRunSetGetTotalLengthApprox: "
-                        "fixed technical reads length\n"));
-                    *bio_base_count = baseCount - nspots * ac.techBasesPerSpot;
-                }
-                else {
-                    STSMSG(1, ("VdbBlastRunSetGetTotalLengthApprox: "
-                        "cannot read BASE_COUNT\n"));
-                }
-            }
-            if (!ac.techBasesPerSpotEquals || status != eVdbBlastNoErr) {
-/*              double dd = nspots / c; */
-                STSMSG(2, ("VdbBlastRunSetGetTotalLengthApprox: "
-                    "extrapolating variable read length\n"));
-                *bio_base_count = ac.bioBasesCnt * d;
-            }
-        }
-    }
-    _ApprCntFini(&ac);
-    return rc;
-}
-static 
-uint64_t _VdbBlastRunCountBioBaseCount(VdbBlastRun *self,
-    uint32_t *status)
-{
-    uint64_t bio_base_count = 0;
-    rc_t rc = _VTableBioBaseCntApprox(self->tbl,
-        self->rd.spotCount, self->rd.nReads, &bio_base_count);
-#if 0
-    const VCursor *curs = NULL;
-/*  uint32_t colREAD_FILTER = 0; */
-    uint32_t colREAD_LEN = 0;
-    uint32_t colREAD_TYPE = 0;
-    uint64_t spot = 0;
-    assert(self && status);
-    if (rc == 0) {
-        rc = VTableCreateCursorRead(self->tbl, &curs);
-        if (rc != 0) {
-            LOGERR(klogInt, rc, "Error during VTableCreateCursorRead");
-        }
-    }
-/*  if (rc == 0) {
-        const char name[] = "READ_FILTER";
-        rc = VCursorAddColumn(curs, &colREAD_FILTER, name);
-        if (rc != 0) {
-            PLOGERR(klogInt, (klogInt, rc,
-                "Error during VCursorAddColumn($(name))", "name=%s", name));
-        }
-    }*/
-    if (rc == 0) {
-        const char name[] = "READ_LEN";
-        rc = VCursorAddColumn(curs, &colREAD_LEN, name);
-        if (rc != 0) {
-            PLOGERR(klogInt, (klogInt, rc,
-                "Error during VCursorAddColumn($(name))", "name=%s", name));
-        }
-    }
-    if (rc == 0) {
-        const char name[] = "READ_TYPE";
-        rc = VCursorAddColumn(curs, &colREAD_TYPE, name);
-        if (rc != 0) {
-            PLOGERR(klogInt, (klogInt, rc,
-                "Error during VCursorAddColumn($(name))", "name=%s", name));
-        }
-    }
-    if (rc == 0) {
-        rc = VCursorOpen(curs);
-        if (rc != 0) {
-            LOGERR(klogInt, rc, "Error during VCursorOpen");
-        }
-    }
-    for (spot = 1; spot <= self->rd.spotCount && rc == 0; ++spot) {
-        const void *base = NULL;
-        uint32_t elem_bits = 0;
-/*      uint8_t *readFilter = NULL; */
-        const uint32_t *readLen = NULL;
-        const INSDC_read_type *readType = NULL;
-        uint32_t boff = 0;
-        uint32_t row_len = 0;
-        uint32_t nreads = 0;
-        if (rc == 0) {
-            rc = VCursorCellDataDirect(curs, spot, colREAD_LEN,
-                 &elem_bits, &base, &boff, &row_len);
-            if (rc != 0) {
-                PLOGERR(klogInt, (klogInt, rc,
-                    "Error during VCursorCellDataDirect(READ_LEN, $(spot))",
-                    "spot=%lu", spot));
-            }
-            else if (boff != 0 || elem_bits != 32) {
-                rc = RC(rcSRA, rcCursor, rcReading, rcData, rcUnexpected);
-                PLOGERR(klogInt, (klogInt, rc,
-                    "Bad VCursorCellDataDirect(READ_LEN, $(spot)) result: "
-                    "boff=$(boff), elem_bits=$(elem_bits)",
-                    "spot=%lu, boff=%u, elem_bits=%u", spot, boff, elem_bits));
-            }
-            else {
-                readLen = base;
-                nreads = row_len;
-            }
-        }
-        /*if (rc == 0) {
-            rc = VCursorCellDataDirect(curs, spot, colREAD_FILTER,
-                 &elem_bits, &base, &boff, &row_len);
-            if (rc != 0) {
-                PLOGERR(klogInt, (klogInt, rc,
-                    "Error during VCursorCellDataDirect(READ_FILTER, $(spot))",
-                    "spot=%lu", spot));
-            }
-            else if (boff != 0 || elem_bits != 8) {
-                rc = RC(rcSRA, rcCursor, rcReading, rcData, rcUnexpected);
-                PLOGERR(klogInt, (klogInt, rc,
-                    "Bad VCursorCellDataDirect(READ_FILTER, $(spot)) result: "
-                    "boff=$(boff), row_len=$(row_len)",
-                    "spot=%lu, boff=%u, row_len=%u", spot, boff, row_len));
-            }
-            else if (row_len != nreads) {
-                rc = RC(rcSRA, rcCursor, rcReading, rcData, rcUnexpected);
-                PLOGERR(klogInt, (klogInt, rc,
-                    "spot $(spot): READ_LEN[$(len)], FILTER[$(type)]",
-                    "spot=%lu, len=%u, type=%u", spot, nreads, row_len));
-            }
-            else {
-                readFilter = base;
-            }
-        }*/
-        if (rc == 0) {
-            rc = VCursorCellDataDirect(curs, spot, colREAD_TYPE,
-                 &elem_bits, &base, &boff, &row_len);
-            if (rc != 0) {
-                PLOGERR(klogInt, (klogInt, rc,
-                    "Error during VCursorCellDataDirect(READ_TYPE, $(spot))",
-                    "spot=%lu", spot));
-            }
-            else if (boff != 0 || elem_bits != 8) {
-                rc = RC(rcSRA, rcCursor, rcReading, rcData, rcUnexpected);
-                PLOGERR(klogInt, (klogInt, rc,
-                    "Bad VCursorCellDataDirect(READ_TYPE, $(spot)) result: "
-                    "boff=$(boff), row_len=$(row_len)",
-                    "spot=%lu, boff=%u, row_len=%u", spot, boff, row_len));
-            }
-            else if (row_len != nreads) {
-                rc = RC(rcSRA, rcCursor, rcReading, rcData, rcUnexpected);
-                PLOGERR(klogInt, (klogInt, rc,
-                    "spot $(spot): READ_LEN[$(len)], READ_TYPE[$(type)]",
-                    "spot=%lu, len=%u, type=%u", spot, nreads, row_len));
-            }
-            else {
-                readType = base;
-            }
-        }
-        if (rc == 0) {
-            uint32_t i = 0;
-            for (i = 0; i < nreads; ++i) {
-                INSDC_read_type type = readType[i];
-                type &= 1;
-                if (type == READ_TYPE_BIOLOGICAL) {
-/*                  if (readFilter[i] == READ_FILTER_PASS) */
-                        bio_base_count += readLen[i];
-                }
-            }
-        }
-    }
-    RELEASE(VCursor, curs);
-#endif
-    if (rc != 0) {
-        *status = eVdbBlastErr;
-    }
-    return bio_base_count;
-}
-
-static
-uint64_t _VdbBlastSraRunGetLengthApprox(VdbBlastRun *self,
-    uint32_t *status)
-{
-    assert(self && status);
-
-    *status = eVdbBlastNoErr;
-
-    if (self->bioBasesApprox == ~0) {
-        RunDesc *rd = NULL;
-        *status = _VdbBlastRunFillRunDesc(self);
-        if (*status != eVdbBlastNoErr) {
-            S
-            return 0;
-        }
-
-        rd = &self->rd;
-        if (rd->nReads == 0) {
-            S
-            self->bioBasesApprox = 0;
-        }
-        else if (rd->varReadLen) {
-            S
-            self->bioBasesApprox = _VdbBlastRunCountBioBaseCount(self, status);
-        }
-        else {
-            if (self->type == btpREFSEQ) {
-                if (rd->bioBaseCount == ~0) {
-                    S
-                    *status = eVdbBlastErr;
-                }
-                else {
-                    self->bioBasesApprox = rd->bioBaseCount;
-                }
-            }
-            else {
-                uint8_t read = 0;
-                S
-                for (read = 0, self->bioBasesApprox = 0;
-                    read < rd->nReads; ++read)
-                {
-                    if (rd->readType[read] & SRA_READ_TYPE_BIOLOGICAL) {
-                        self->bioBasesApprox += rd->readLen[read];
-                    }
-                }
-                self->bioBasesApprox *= rd->spotCount;
-            }
-        }
-    }
-
-    return self->bioBasesApprox;
-}
-
-static uint64_t _VdbBlastRunGetLengthApprox(VdbBlastRun *self, uint32_t *status)
-{
-    if (self->cSra) {
-        return _VdbBlastRunGetLength(self, status);
-    }
-    else {
-        return _VdbBlastSraRunGetLengthApprox(self, status);
-    }
-}
-
-static
-uint64_t _VdbBlastRunGetNumSequencesApprox(VdbBlastRun *self,
-    uint32_t *status)
-{
-
-    assert(self && status);
-
-    *status = eVdbBlastNoErr;
-
-    if (self->bioReadsApprox == ~0) {
-        RunDesc *rd = NULL;
-
-        if (self->bioReads != ~0 && ! self->bioReadsTooExpensive) {
-            self->bioReadsApprox = self->bioReads;
-        }
-        else if (self->type == btpREFSEQ) {
-            S
-            self->bioReadsApprox = 1;
-        }
-        else if (self->cSra) {
-/* Number of Bio Reads for cSra == number of CMP reads
-    = Number of all bio reads * CMP_BASE_COUNT / BIO_BASE_COUNT
-   Number of all bio reads = nSpots * n of bio reads per spot */
-            double r = 0;
-            uint64_t n = 0;
-
-            *status = _VdbBlastRunFillRunDesc(self);
-            if (*status != eVdbBlastNoErr) {
-                S
-                return 0;
-            }
-
-            rd = &self->rd;
-
-            n = _VdbBlastSraRunGetLengthApprox(self, status);
-            if (*status != eVdbBlastNoErr) {
-                S
-                return 0;
-            }
-            r = rd->cmpBaseCount * rd->spotCount * rd->nBioReads;
-            r /= n;
-            self->bioReadsApprox = r;
-        }
-        else {
-            *status = _VdbBlastRunFillRunDesc(self);
-            if (*status != eVdbBlastNoErr) {
-                S
-                return 0;
-            }
-
-            rd = &self->rd;
-
-            self->bioReadsApprox = rd->spotCount * rd->nBioReads;
-            S
-        }
-    }
-    else
-    {   S }
-
-    return self->bioReadsApprox;
-}
-
-static
-uint32_t _VdbBlastRunGetWgsAccession(VdbBlastRun *self,
-    int64_t spot,
-    char *name_buffer,
-    size_t bsize,
-    size_t *num_required)
-{
-    rc_t rc = 0;
-    uint32_t row_len = 0;
-
-    assert(num_required);
-
-    if (self == NULL || spot <= 0 || name_buffer == NULL || bsize == 0) {
-        STSMSG(0, ("Error: some of %s parameters is NULL or 0", __func__));
-        return eVdbBlastErr;
-    }
-    if (self->tbl == NULL) {
-        STSMSG(0, ("Error: %s: VTable is NULL in VdbBlastRun", __func__));
-        return eVdbBlastErr;
-    }
-
-    if (self->cursACCESSION == NULL) {
-        rc = _VTableMakeCursor(self->tbl,
-            &self->cursACCESSION, &self->col_ACCESSION, "ACCESSION");
-        if (rc != 0) {
-            VCursorRelease(self->cursACCESSION);
-            self->cursACCESSION = NULL;
-            return eVdbBlastErr;
-        }
-    }
-
-    assert(self->cursACCESSION && rc == 0);
-
-    rc = VCursorReadDirect(self->cursACCESSION, spot,
-        self->col_ACCESSION, 8, name_buffer, bsize, &row_len);
-    *num_required = row_len;
-    if (row_len > 0) /* include ending '\0' */
-    {   ++(*num_required); }
-    if (rc == 0) {
-        if (bsize > row_len)
-        { name_buffer[row_len] = '\0'; }
-        return eVdbBlastNoErr;
-    }
-    else if (rc == SILENT_RC
-        (rcVDB, rcCursor, rcReading, rcBuffer, rcInsufficient))
-    {   return eVdbBlastNoErr; }
-    else {
-        assert(self->path);
-        PLOGERR(klogInt, (klogInt, rc, "Error in VCursorReadDirect"
-            "$(path), ACCESSION, spot=$(spot))",
-            "path=%s,spot=%ld", self->path, spot));
-        return eVdbBlastErr;
-    }
-}
-
-/******************************************************************************/
-typedef struct ReadDesc {
-    const VdbBlastRun *prev;
-
-    VdbBlastRun *run;
-    uint64_t spot; /* 1-based */
-    uint32_t read; /* 1-based */
-
-    uint64_t read_id; /* BioReadId in RunSet */
-} ReadDesc;
-static
-bool _ReadDescNextRead(ReadDesc *self)
-{
-    uint32_t read = 0;
-    int i = 0;
-    const RunDesc *rd = NULL;
-
-    assert(self && self->run);
-
-    rd = &self->run->rd;
-
-    if (rd->nBioReads == 0) {
-        S
-        return false;
-    }
-
-    for (i = self->read + 1; i <= rd->nReads; ++i) {
-        if (rd->readType[i - 1] & SRA_READ_TYPE_BIOLOGICAL) {
-            S
-            read = i;
-            break;
-        }
-    }
-
-    if (read == 0) {
-        if (++self->spot > rd->spotCount) {
-            S
-            return false;
-        }
-
-        for (i = 1; i <= rd->nReads; ++i) {
-            if (rd->readType[i - 1] & SRA_READ_TYPE_BIOLOGICAL) {
-                S
-                read = i;
-                break;
-            }
-        }
-    }
-
-    if (read) {
-        S
-        self->read = read;
-        ++self->read_id;
-    }
-    else
-    {   S }
-
-    return read;
-}
-
-static
-bool _ReadDescSameRun(const ReadDesc *self)
-{
-    assert(self);
-
-    if (self->prev == NULL && self->run == NULL) {
-        S
-        return false;
-    }
-
-    S
-    return self->prev == self->run;
-}
-
-#ifdef TEST_VdbBlastRunFillReadDesc
-LIB_EXPORT
-#else
-static
-#endif
-uint32_t _VdbBlastRunFillReadDesc(VdbBlastRun *self,
-    uint64_t read_id,
-    ReadDesc *desc)
-{
-    const VdbBlastRun *prev = NULL;
-    const RunDesc *rd = NULL;
-    
-    int bioIdx = 0;
-
-    if (self == NULL || desc == NULL) {
-        S
-        return eVdbBlastErr;
-    }
-
-    prev = desc->run;
-    memset(desc, 0, sizeof *desc);
-    desc->prev = prev;
-    desc->run = self;
-
-    rd = &self->rd;
-
-    if (rd->nReads == 0 || rd->readType == NULL) {
-        uint32_t status = _VdbBlastRunFillRunDesc(self);
-        if (status != eVdbBlastNoErr)
-        {   return status; }
-        assert(rd->nReads && rd->readType);
-    }
-
-    desc->spot = read_id / rd->nBioReads + 1;
-    if (desc->spot <= rd->spotCount) {
-        int idInSpot = read_id - (desc->spot - 1) * rd->nBioReads; /* 0-based */
-
-        int i = 0;
-        for (i = 0; i < rd->nReads; ++i) {
-            if (rd->readType[i] & SRA_READ_TYPE_BIOLOGICAL) {
-                if (bioIdx++ == idInSpot) {
-                    S
-                    desc->read = i + 1;
-                    return eVdbBlastNoErr;
-                }
-            }
-        }
-        S
-    }
-    else { S }
-
-    memset(desc, 0, sizeof *desc);
-    return eVdbBlastErr;
-}
-
-static
-uint32_t _VdbBlastRunGetReadId(VdbBlastRun *self,
-    const char *acc,
-    uint64_t spot, /* 1-based */
-    uint32_t read, /* 1-based */
-    uint64_t *read_id)
-{
-    uint64_t id = ~0;
-    uint32_t status = eVdbBlastErr;
-    size_t size;
-
-    assert(self && acc && read_id && self->acc);
-    assert(memcmp(self->acc, acc, string_measure(self->acc, &size)) == 0);
-
-    if ((spot <= 0 && read > 0) || (spot > 0 && read <= 0)) {
-        S
-        return eVdbBlastErr;
-    }
-
-    if (spot > 0) {
-        if (self->type != btpSRA) {
-            return eVdbBlastErr;
-        }
-
-        for (id = (spot - 1) * self->rd.nBioReads; ; ++id) {
-            ReadDesc desc;
-            status = _VdbBlastRunFillReadDesc(self, id, &desc);
-            if (status != eVdbBlastNoErr)
-            {   return status; }
-            if (desc.spot < spot) {
-                S
-                return eVdbBlastErr;
-            }
-            if (desc.spot > spot) {
-                S
-                return eVdbBlastErr;
-            }
-            if (desc.read == read) {
-                *read_id = id;
-                return eVdbBlastNoErr;
-            }
-        }
-        S
-        return eVdbBlastErr;
-    }
-    else {
-        uint64_t n = ~0;
-        uint64_t i = ~0;
-        if (self->type == btpSRA)
-        {   return eVdbBlastErr; }
-        else if (self->type == btpREFSEQ) {
-            *read_id = 0;
-            return eVdbBlastNoErr;
-        }
-        else if (self->type == btpWGS) {
-            n = _VdbBlastRunGetNumSequences(self, &status);
-            if (status != eVdbBlastNoErr && status != eVdbBlastTooExpensive) {
-                return status;
-            }
-            /* TODO optimize: avoid full run scan */
-            for (i = 0; i < n ; ++i) {
-                size_t need = ~0;
-#define SZ 4096
-                char name_buffer[SZ + 1];
-                if (string_measure(acc, &size) > SZ) {
-                    S
-                    return eVdbBlastErr;
-                }
-#undef SZ
-               status = _VdbBlastRunGetWgsAccession(
-                    self, i + 1, name_buffer, sizeof name_buffer, &need);
-                if (need > sizeof name_buffer) {
-                    S
-                    return eVdbBlastErr;
-                }
-                if (strcmp(name_buffer, acc) == 0) {
-                    *read_id = i;
-                    return eVdbBlastNoErr;
-                }
-            }
-        }
-        else { assert(0); }
-        return eVdbBlastErr;
-    }
-}
-
-/*
-static
-rc_t _VTableStatic(const VTable *self,
-    const char *col_name, bool *isStatic)
-{
-    rc_t rc = 0;
-    const VCursor *curs = NULL;
-    uint32_t idx = 0;
-    rc = _VTableMakeCursor(self, &curs, &idx, col_name);
-    if (rc == 0) {
-        rc = VCursorIsStaticColumn(curs, idx, isStatic);
-    }
-    RELEASE(VCursor, curs);
-    return rc;
-}
-static
-uint32_t _VdbBlastRunFillBioInfo(VdbBlastRun *self) {
-    rc_t rc = 0;
-    bool isStatic = true;
-    bool aStatic = false;
-
-    assert(self);
-
-    if (self->bioReads == ~0 || self->bioReadsApprox == ~0) {
-        return eVdbBlastTooExpensive;
-    }
-    if (self->bioReads != 0 || self->bioReadsApprox != 0) {
-        return eVdbBlastNoErr;
-    }
-    rc = _VTableStatic(self->tbl, "READ_LEN");
-    return eVdbBlastNoErr;
-}*/
-
-typedef struct Data2na {
-    uint32_t irun;
-    const VBlob *blob;
-} Data2na;
-/******************************************************************************/
-typedef struct Reader2na {
-    bool eor;
-    ReadDesc desc;
-    uint32_t col_READ;
-    const VCursor *curs;
-    size_t starting_base; /* 0-based, in current read */
-    ReaderCols cols;
-} Reader2na;
-static
-uint64_t _Reader2naFini(Reader2na *self)
-{
-    uint64_t read_id = 0;
-
-    assert(self);
-
-    read_id = self->desc.read_id;
-
-    VCursorRelease(self->curs);
-
-    ReaderColsFini(&self->cols);
-
-    memset(self, 0, sizeof *self);
-
-    return read_id;
-}
-
-static
-bool _Reader2naEor(const Reader2na *self)
-{
-    assert(self);
-    S
-    return self->eor;
-}
-
-static
-uint32_t _Reader2naReadCols(Reader2na *self)
-{
-    assert(self && self->desc.run);
-    return _VCursorReadCols
-        (self->curs, self->desc.spot, &self->cols, self->desc.run->rd.nReads);
-}
-
-static
-uint32_t _Reader2naGetBlob(Reader2na *self,
-    const VBlob **blob,
-    const ReadDesc *desc,
-    int64_t *first,
-    uint64_t *count)
-{
-    bool fresh = false;
-
-    assert(self && blob && desc && first && count
-        && desc->run && desc->run->path);
-
-    for (fresh = false; ;) {
-        rc_t rc = 0;
-
-        if (*blob == NULL) {
-            rc = VCursorGetBlobDirect
-                (self->curs, blob, desc->spot, self->col_READ);
-            if (rc) {
-                PLOGERR(klogInt, (klogInt, rc, "Error in VCursorGetBlobDirect"
-                    "($(path), READ, spot=$(spot))",
-                    "path=%s,spot=%ld", desc->run->path, desc->spot));
-                return eVdbBlastErr;
-            }
-
-            fresh = true;
-        }
-
-        rc = VBlobIdRange(*blob, first, count);
-        if (rc) {
-            PLOGERR(klogInt, (klogInt, rc, "Error in VBlobIdRange($(path))",
-                "path=%s", desc->run->path));
-            return eVdbBlastErr;
-        }
-
-        if (desc->spot >= *first && desc->spot < *first + *count) {
-            S
-            return eVdbBlastNoErr;
-        }
-
-        if (fresh) {
-            S
-            return eVdbBlastErr;
-        }
-
-        rc = VBlobRelease(*blob);
-        *blob = NULL;
-        if (rc) {
-            PLOGERR(klogInt, (klogInt, rc, "Error in VBlobRelease($(path))",
-                "path=%s", desc->run->path));
-            return eVdbBlastErr;
-        }
-    }
-
-    S
-    return eVdbBlastErr;
-}
-
-static
-uint32_t _Reader2naCalcReadParams(const ReadDesc *desc,
-    const ReaderCols *cols,
-    uint32_t *start,
-    uint32_t min_read_length)
-{
-    int i = ~0;
-    uint32_t to_read = 0;
-    assert(desc && cols && start);
-    assert(desc->run && desc->run->path);
-
-    *start = 0;
-
-    assert(cols->read_len && cols->read_filter);
-    for (i = 1; i < desc->read; ++i) {
-        assert(i <= desc->run->rd.nReads);
-
-        /* do not count CMP_READ-s where primary_alignment_id != 0
-           as are not stored in CMP_READ) */
-        if (!ReaderColsIsReadCompressed(cols, i - 1)) {
-            *start += cols->read_len[i - 1];
-        }
-    }
-    S
-
-    if (cols->read_len[desc->read - 1] == 0) {
-        S
-        DBGMSG(DBG_BLAST, DBG_FLAG(DBG_BLAST_BLAST),
-            ("%s: %s:%d:%d(%d): READ_LEN=0\n",
-            __func__, desc->run->path, desc->spot, desc->read, desc->read_id));
-        return 0;
-    }
-    else if (cols->read_filter[desc->read - 1] != READ_FILTER_PASS) {
-        S
-        DBGMSG(DBG_BLAST, DBG_FLAG(DBG_BLAST_BLAST),
-            ("%s: %s:%d:%d(%d): READ_FILTER != READ_FILTER_PASS\n",
-            __func__, desc->run->path, desc->spot, desc->read, desc->read_id));
-        return 0;
-    }
-    else if (cols->TRIM_LEN > 0
-        && *start >= cols->TRIM_START + cols->TRIM_LEN)
-    {
-        return 0;
-    }
-    else {
-        uint32_t end = 0;
-
-        /* do not count CMP_READ-s where primary_alignment_id != 0
-           as are not stored in CMP_READ) */
-        if (ReaderColsIsReadCompressed(cols, desc->read - 1)) {
-            to_read = 0;
-            S
-            DBGMSG(DBG_BLAST, DBG_FLAG(DBG_BLAST_BLAST),
-                ("%s: %s:%d:%d(%d): PRIMARY_ALIGNMENT_ID != 0\n", __func__,
-                 desc->run->path, desc->spot, desc->read, desc->read_id));
-        }
-        else {
-            to_read = cols->read_len[desc->read - 1];
-            end = *start + to_read;
-            if (cols->TRIM_LEN > 0 && cols->TRIM_START > *start) {
-                uint32_t delta = cols->TRIM_START - *start;
-                if (to_read > delta) {
-                    *start = cols->TRIM_START;
-                    to_read -= delta;
-                    assert(*start + to_read == end);
-                }
-                else {
-                    to_read = 0;
-                }
-            }
-        }
-        if (to_read > 0) {
-            if (cols->TRIM_LEN > 0 &&
-                end > (cols->TRIM_START + cols->TRIM_LEN))
-            {
-                uint32_t delta = end - (cols->TRIM_START + cols->TRIM_LEN);
-                assert(delta < to_read);
-                to_read -= delta;
-            }
-            if (to_read < min_read_length) {
-                S
-                DBGMSG(DBG_BLAST, DBG_FLAG(DBG_BLAST_BLAST),
-                    ("%s: %s:%d:%d(%d): READ_LEN=%d: TOO SHORT (<%d)\n",
-                    __func__, desc->run->path, desc->spot, desc->read,
-                    desc->read_id, cols->read_len[desc->read - 1],
-                    min_read_length));
-                return 0;
-            }
-            else {
-                DBGMSG(DBG_BLAST, DBG_FLAG(DBG_BLAST_BLAST),
-                    ("%s: %s:%d:%d(%d): READ_LEN=%d\n", __func__,
-                    desc->run->path, desc->spot, desc->read,
-                    desc->read_id, cols->read_len[desc->read - 1]));
-            }
-        }
-    }
-
-    return to_read;
-}
-
-static
-bool _Reader2naNextData(Reader2na *self,
-    const VBlob *blob,
-    uint32_t *status,
-    Packed2naRead *out,
-    uint32_t min_read_length)
-{
-    uint32_t start = 0;
-    uint32_t to_read = 0;
-    const ReadDesc *desc = NULL;
-    assert(self && status && out && self->curs);
-    desc = &self->desc;
-    memset(out, 0, sizeof *out);
-
-    *status = _Reader2naReadCols(self);
-    if (*status != eVdbBlastNoErr) {
-        S
-        return false;
-    }
-    if (!self->curs || !desc->run) {
-        S
-        *status = eVdbBlastErr;
-        return false;
-    }
-
-    assert(self->cols.read_len && self->cols.read_filter);
-    assert(desc->read <= desc->run->rd.nReads);
-
-    to_read = _Reader2naCalcReadParams(&self->desc, &self->cols,
-        &start, min_read_length);
-    if (to_read == 0) {
-        return true;
-    }
-    else {
-        uint32_t elem_bits = 0;
-        rc_t rc = 0;
-
-        S
-        DBGMSG(DBG_BLAST, DBG_FLAG(DBG_BLAST_BLAST),
-            ("%s: %s:%d:%d(%d): READ_LEN=%d\n", __func__,
-            self->desc.run->path, self->desc.spot, self->desc.read,
-            self->desc.read_id, self->cols.read_len[desc->read - 1]));
-
-        rc = VBlobCellData(blob, desc->spot, &elem_bits,
-            (const void **)&out->starting_byte, &out->offset_to_first_bit,
-            &out->length_in_bases);
-        if (rc != 0) {
-            S
-            DBGMSG(DBG_BLAST, DBG_FLAG(DBG_BLAST_BLAST),
-               ("%s: %s:%d:%d(%d): READ_LEN=%d: "
-                "ERROR WHILE READING: SKIPPED FOR NOW\n", __func__,
-                self->desc.run->path, self->desc.spot, self->desc.read,
-                self->desc.read_id, self->cols.read_len[desc->read - 1]));
-            /* special case */
-            *status = eVdbBlastErr;
-            return true;
-        }
-
-        if (elem_bits != 2) {
-            S
-            *status = eVdbBlastErr;
-            return false;
-        }
-
-        if (out->length_in_bases < start) {
-            S
-            *status = eVdbBlastErr;
-            return false;
-        }
-
-        out->offset_to_first_bit += start * 2;
-        S
-
-        out->length_in_bases = to_read;
-        while (out->offset_to_first_bit >= 8) {
-            out->starting_byte = ((uint8_t*)out->starting_byte) + 1;
-            out->offset_to_first_bit -= 8;
-        }
-        out->read_id = desc->read_id;
-        S
-        return true;
-    }
-}
-
-static
-uint32_t _Reader2naData(Reader2na *self,
-    Data2na *data,
-    uint32_t *status,
-    Packed2naRead *buffer,
-    uint32_t buffer_length,
-    uint32_t min_read_length)
-{
-    ReadDesc *desc = NULL;
-    uint32_t n = 0;
-    int64_t first = 0;
-    uint64_t count = 0;
-    uint32_t dummy = eVdbBlastNoErr;
-    if (status == NULL)
-    {   status = &dummy; }
-    *status = eVdbBlastErr;
-    if (buffer_length && buffer == NULL) {
-        S
-        return 0;
-    }
-
-    assert(self && self->curs && data);
-    desc = &self->desc;
-    *status = _Reader2naGetBlob(self, &data->blob, desc, &first, &count);
-    if (*status == eVdbBlastErr) {
-        S
-        return 0;
-    }
-
-    for (n = 0; n < buffer_length; ) {
-        Packed2naRead *p = buffer + n;
-        bool ignorable
-            = _Reader2naNextData(self, data->blob, status, p, min_read_length);
-        if (*status == eVdbBlastErr) {
-            if (ignorable) {
-                /* special case */
-                if (n > 0) { /* let's retry during next call */
-                    S
-                    *status = eVdbBlastNoErr;
-                }
-                else
-                {   S }
-                return n;
-            }
-            S
-            return 0;
-        }
-        if (p->length_in_bases > 0)
-        {   ++n; }
-        if (!_ReadDescNextRead(desc)) {
-            S
-            self->eor = true;
-            break;
-        }
-        if (desc->spot >= first + count) {
-            S
-            break;
-        }
-    }
-
-    *status = eVdbBlastNoErr;
-    return n;
-}
-/* struct Packed2naRead {
-    uint64_t read_id;
-    void *starting_byte;
-    uint32_t offset_to_first_bit;
-    uint32_t length_in_bases; }; */
-
-static
-uint64_t _Reader2naRead(Reader2na *self,
-    uint32_t *status,
-    uint64_t *read_id,
-    size_t *starting_base,
-    uint8_t *buffer,
-    size_t buffer_size,
-    uint32_t min_read_length)
-{
-    uint32_t num_read = 0;
-    uint32_t to_read = 0;
-    ReadDesc *desc = NULL;
-    uint32_t start = 0;
-    uint32_t remaining = 0;
-    rc_t rc = 0;
-    assert(self && status && read_id && starting_base);
-    desc = &self->desc;
-    *read_id = desc->read_id;
-    *starting_base = self->starting_base;
-
-    if (_Reader2naEor(self)) {
-        S
-        *status = eVdbBlastNoErr;
-        return 0;
-    }
-
-    *status = _Reader2naReadCols(self);
-    if (*status != eVdbBlastNoErr) {
-        S
-        return 0;
-    }
-
-    *status = eVdbBlastErr;
-    if (!self->curs || !desc->run) {
-        S
-        return 0;
-    }
-
-    assert(desc->run->path);
-
-    *status = eVdbBlastNoErr;
-    if (desc->run->rd.nBioReads == 0) {
-        S
-        return 0;
-    }
-
-    *status = eVdbBlastNoErr;
-
-    to_read = _Reader2naCalcReadParams(&self->desc, &self->cols,
-        &start, min_read_length);
-    if (to_read <= self->starting_base) {
-        S
-        DBGMSG(DBG_BLAST, DBG_FLAG(DBG_BLAST_BLAST), (
-        "%s: %s:%d:%d(%d): READ_LEN=%d: TOO SHORT (starting_base=%d)\n",
-            __func__, desc->run->path, desc->spot, desc->read,
-            desc->read_id, self->cols.read_len[desc->read - 1],
-            self->starting_base));
-        to_read = 0;
-    }
-    else {
-        to_read -= self->starting_base;
-        start += self->starting_base;
-    }
-    if (to_read > 0) {
-        S
-        rc = VCursorReadBitsDirect(self->curs, desc->spot, self->col_READ, 2,
-            start, buffer, 0, buffer_size * 4, &num_read, &remaining);
-        if (rc) {
-            if (rc == SILENT_RC
-                (rcVDB, rcCursor, rcReading, rcBuffer, rcInsufficient))
-            {
-                S
-                rc = 0;
-                num_read = buffer_size * 4;
-            }
-            else {
-                PLOGERR(klogInt, (klogInt, rc,
-                    "Error in VCursorReadBitsDirect"
-                    "($(path), READ, spot=$(spot))", "path=%s,spot=%ld",
-                    desc->run->path, desc->spot));
-                *status = eVdbBlastErr;
-                return 0;
-            }
-        }
-        *status
-            = (num_read == 0 && remaining == 0) ? eVdbBlastErr : eVdbBlastNoErr;
-        S
-    }
-
-    if (num_read >= to_read) {
-        self->starting_base = 0;
-        num_read = to_read;
-        if (!_ReadDescNextRead(desc))
-        {   self->eor = true; }
-        S
-    }
-    else {
-        self->starting_base += num_read;
-        S
-    }
-
-    return num_read;
-}
-
-static VdbBlastStatus _VdbBlastRunMakeCursor(const VdbBlastRun *self,
-    const VCursor **curs, uint32_t *read_col_idx, bool INSDC2na,
-    ReaderCols *cols)
-{
-    rc_t rc = 0;
-    const char *read_col_name = INSDC2na ? "(INSDC:2na:packed)READ"
-                                         : "(INSDC:4na:bin)READ";
-    assert(self);
-    if (self->cSra) {
-        read_col_name = INSDC2na ? "(INSDC:2na:packed)CMP_READ"
-                                 : "(INSDC:4na:bin)CMP_READ";
-    }
-    rc = _VTableMakeCursor(self->tbl, curs, read_col_idx, read_col_name);
-    if (rc == 0) {
-        assert(*curs);
-        VdbBlastStatus status = _VCursorAddCols(*curs, cols, self->cSra);
-        return status;
-    }
-    return eVdbBlastErr;
-}
-
-static
-VdbBlastStatus _Reader2naOpenCursor(Reader2na *self)
-{
-    const ReadDesc *desc = NULL;
-    const VdbBlastRun *run = NULL;
-
-    assert(self);
-
-    desc = &self->desc;
-    run = desc->run;
-
-    assert(run && self->curs == NULL);
-
-    return _VdbBlastRunMakeCursor(run,
-        &self->curs, &self->col_READ, true, &self->cols);
-}
-
-/******************************************************************************/
-typedef struct RunSet {
-    VdbBlastRun *run;
-    uint32_t krun; /* number of run-s */
-    uint32_t nrun; /* sizeof of run-s */
-} RunSet;
-static
-void _RunSetFini(RunSet *self)
-{
-    assert(self);
-    if (self->run) {
-        uint32_t i = 0;
-        for (i = 0; i < self->krun; ++i)
-        {   _VdbBlastRunFini(&self->run[i]); }
-        free(self->run);
-    }
-    memset(self, 0, sizeof *self);
-}
-
-static
-uint32_t _RunSetAllocTbl(RunSet *self)
-{
-    size_t nmemb = 16;
-
-    if (self == NULL)
-    {   return eVdbBlastErr; }
-
-    if (self->run && self->krun < self->nrun) {
-        return eVdbBlastNoErr;
-    }
-
-    if (self->run == NULL) {
-        self->run = calloc(nmemb, sizeof *self->run);
-        if (self->run == NULL)
-        {   return eVdbBlastMemErr; }
-        S
-    }
-    else {
-        void *p = NULL;
-        nmemb += self->nrun;
-        p = realloc(self->run, nmemb * sizeof *self->run);
-        if (p == NULL)
-        {   return eVdbBlastMemErr; }
-        self->run = p;
-        S
-    }
-
-    self->nrun = nmemb;
-    return eVdbBlastNoErr;
-}
-
-static
-uint32_t _RunSetAddTbl(RunSet *self,
-    const VTable *tbl,
-    const char *rundesc,
-    BTableType type,
-    const KDirectory *dir,
-    char *fullpath,
-    uint32_t min_read_length)
-{
-
-    VdbBlastRun* run = NULL;
-    uint32_t status = _RunSetAllocTbl(self);
-    if (status) {
-        return status;
-    }
-
-    if (tbl == NULL) {
-        return eVdbBlastNoErr;
-    }
-
-    assert(self && self->run);
-    run = &self->run[self->krun++];
-    status = _VdbBlastRunInit(run,
-        tbl, rundesc, type, dir, fullpath, min_read_length);
-    return status;
-}
-
-static
-uint64_t _RunSetGetNumSequencesApprox(const RunSet *self,
-    uint32_t *status)
-{
-    uint64_t num = 0;
-    uint32_t i = 0;
-    assert(self && status);
-    *status = eVdbBlastNoErr;
-    for (i = 0; i < self->krun; ++i) {
-        VdbBlastRun *run = NULL;
-        assert(self->run);
-        run = &self->run[i];
-        num += _VdbBlastRunGetNumSequencesApprox(run, status);
-        if (*status != eVdbBlastNoErr) {
-            assert(run->path);
-            STSMSG(1, (
-                "Error: failed to GetNumSequencesApprox(on run %s)",
-                run->path));
-            return 0;
-        }
-    }
-
-    STSMSG(1, ("_RunSetGetNumSequencesApprox = %ld", num));
-
-    return num;
-}
-
-static
-uint64_t _RunSetGetNumSequences(const RunSet *self,
-    VdbBlastStatus *aStatus)
-{
-    uint64_t num = 0;
-    uint32_t i = 0;
-    assert(self && aStatus);
-    *aStatus = eVdbBlastNoErr;
-    for (i = 0; i < self->krun; ++i) {
-        VdbBlastStatus status = eVdbBlastNoErr;
-        VdbBlastRun *run = NULL;
-        assert(self->run);
-        run = &self->run[i];
-        num += _VdbBlastRunGetNumSequences(run, &status);
-        if (status != eVdbBlastNoErr) {
-            assert(run->path);
-            if (*aStatus == eVdbBlastNoErr) {
-                *aStatus = status; 
-            }
-            if (status != eVdbBlastTooExpensive) {
-                STSMSG(1, (
-                    "Error: failed to GetNumSequences(on run %s)", run->path));
-                return 0;
-            }
-            assert(*aStatus == eVdbBlastTooExpensive);
-        }
-    }
-
-    STSMSG(1, ("_RunSetGetNumSequences = %ld", num));
-
-    return num;
-}
-
-static
-uint64_t _RunSetGetTotalLength(const RunSet *self,
-    uint32_t *status)
-{
-    uint64_t num = 0;
-    uint32_t i = 0;
-    assert(self && status);
-
-    if (self->krun)
-    {   assert(self->run); }
-
-    for (i = 0; i < self->krun; ++i) {
-        VdbBlastRun *run = &self->run[i];
-        assert(run && run->path);
-        num += _VdbBlastRunGetLength(run, status);
-        if (*status != eVdbBlastNoErr) {
-            STSMSG(1, (
-                "Error: failed to _RunSetGetTotalLength(on run %s)",
-                run->path));
-            return 0;
-        }
-    }
-
-    STSMSG(1, ("_RunSetGetTotalLength = %ld", num));
-
-    return num;
-}
-
-static
-uint64_t _RunSetGetTotalLengthApprox(const RunSet *self,
-    uint32_t *status)
-{
-    uint64_t num = 0;
-    uint32_t i = 0;
-
-    assert(self && status);
-
-    for (num = 0, i = 0; i < self->krun; ++i) {
-        VdbBlastRun *run = NULL;
-        assert(self->run);
-        run = &self->run[i];
-        num += _VdbBlastRunGetLengthApprox(run, status);
-        if (*status != eVdbBlastNoErr) {
-            STSMSG(1, ("Error: failed "
-                "to _VdbBlastRunGetLengthApprox(on run %s)", run->path));
-            return 0;
-        }
-    }
-
-    STSMSG(1, ("VdbBlastRunSetGetTotalLengthApprox = %ld", num));
-    return num;
-}
-
-static
-size_t _RunSetGetName(const RunSet *self,
-    uint32_t *status,
-    char *name_buffer,
-    size_t bsize)
-{
-    size_t need = 0, idx = 0;
-    int i = 0;
-    size_t size;
-    
-    assert(self && status);
-    for (i = 0; i < self->krun; ++i) {
-        VdbBlastRun *run = &self->run[i];
-        if (run && run->acc) {
-            if (i)
-            {   ++need; }
-            need += string_measure(run->acc, &size);
-        }
-        else {
-            S
-            return 0;
-        }
-    }
-
-    if (name_buffer == NULL || bsize == 0) {
-        S
-        return need;
-    }
-
-    for (i = 0; i < self->krun; ++i) {
-        VdbBlastRun *run = &self->run[i];
-        if (run && run->acc) {
-            if (i)
-            {   name_buffer[idx++] = '|'; }
-            if (idx >= bsize) {
-                S
-                return need;
-            }
-            string_copy(name_buffer + idx, bsize - idx,
-                run->acc, string_size(run->acc));
-            idx += string_measure(run->acc, &size);
-            if (idx >= bsize) {
-                S
-                return need;
-            }
-        }
-    }
-    name_buffer[idx++] = '\0';
-    *status = eVdbBlastNoErr;
-
-    S
-    return need;
-}
-
-static
-uint32_t _RunSetFindReadDesc(const RunSet *self,
-    uint64_t read_id,
-    ReadDesc *desc)
-{
-    uint64_t i = 0;
-    uint64_t prev = 0;
-    uint64_t crnt = 0;
-
-    if (self == NULL || desc == NULL) {
-        S
-        return eVdbBlastErr;
-    }
-
-    for (i = 0, prev = 0; i < self->krun; ++i) {
-        uint32_t status = eVdbBlastNoErr;
-        VdbBlastRun *run = NULL;
-        uint64_t l = 0;
-
-        if (prev > 0 && i < prev) {
-            S
-            return eVdbBlastErr;
-        }
-
-        run = &self->run[i];
-        if (run == NULL) {
-            S
-            return eVdbBlastErr;
-        }
-
-        l = _VdbBlastRunGetNumSequences(run, &status);
-        if (status != eVdbBlastNoErr && status != eVdbBlastTooExpensive) {
-            S
-            return status;
-        }
-
-        if (crnt + l <= read_id) {
-            crnt += l;
-        }
-        else {
-            status = _VdbBlastRunFillReadDesc(run, read_id - crnt, desc);
-            if (status == eVdbBlastNoErr) {
-                S
-                desc->read_id = read_id;
-            }
-            else
-            {   S }
-
-            return status;
-        }
-
-        prev = i;
-    }
-
-    S
-    return eVdbBlastErr;
-}
-
-/******************************************************************************/
-typedef struct Core2na {
-    uint32_t min_read_length;
-    bool hasReader;
-    KLock *mutex;
-    uint64_t initial_read_id;
-    uint32_t irun; /* index in RunSet */
-    bool eos;
-    Reader2na reader;
-} Core2na;
-static void _Core2naFini(Core2na *self)
-{
-    assert(self);
-    _Reader2naFini(&self->reader);
-    KLockRelease(self->mutex);
-    memset(self, 0, sizeof *self);
-}
-
-static
-uint32_t _Core2naOpen1stRead(Core2na *self,
-    const RunSet *runs,
-    uint64_t initial_read_id)
-{
-    Reader2na *reader = NULL;
-    uint32_t status = eVdbBlastNoErr;
-
-    assert(self && runs);
-
-    reader = &self->reader;
-
-    if (reader->curs)
-    {   return eVdbBlastNoErr; }
-
-    if (runs->run && runs->krun) {
-        self->initial_read_id = initial_read_id;
-        status = _RunSetFindReadDesc
-            (runs, initial_read_id, &reader->desc);
-        if (status == eVdbBlastNoErr) {
-            status = _Reader2naOpenCursor(reader);
-            if (status != eVdbBlastNoErr) {
-                S
-                _Reader2naFini(reader);
-            }
-        }
-        else
-        {   S }
-    }
-    else {
-        S
-        self->eos = true;
-    }
-
-    return status;
-}
-
-static
-uint32_t _Core2naOpenNextRead(Core2na *core,
-    const RunSet *runs)
-{
-    uint64_t read_id = 0;
-    ReadDesc *desc = NULL;
-    Reader2na *reader = NULL;
-
-    assert(core && runs);
-
-    reader = &core->reader;
-    desc = &reader->desc;
-
-    assert(desc->run);
-
-    read_id = _Reader2naFini(reader) + 1;
-
-    if (core->irun >= runs->krun - 1) { /* No more runs to read */
-        S
-        core->eos = true;
-        return eVdbBlastNoErr;
-    }
-
-    while (++core->irun < runs->krun) {
-        uint32_t status = eVdbBlastNoErr;
-
-        VdbBlastRun *run = &runs->run[core->irun];
-        if (run == NULL) {
-            S
-            return eVdbBlastErr;
-        }
-
-        status = _VdbBlastRunFillReadDesc(run, 0, desc);
-        if (status != eVdbBlastNoErr) {
-            S
-            return status;
-        }
-
-        desc->read_id = read_id;
-        status = _Reader2naOpenCursor(reader);
-        if (status == eVdbBlastNoErr)
-        {      S }
-        else { S }
-
-        return status;
-    }
-
-    S
-    return eVdbBlastNoErr;
-}
-
-static
-uint32_t _Core2naData(Core2na *self,
-    Data2na *data,
-    const RunSet *runs,
-    uint32_t *status,
-    Packed2naRead *buffer,
-    uint32_t buffer_length)
-{
-    uint32_t num_read = 0;
-
-    assert(self && data && status && runs);
-
-    *status = eVdbBlastNoErr;
-
-    while (*status == eVdbBlastNoErr && num_read == 0) {
-        if (_Reader2naEor(&self->reader) || data->irun != self->irun) {
-            S
-            VBlobRelease(data->blob);
-            data->blob = NULL;
-        }
-        if (_Reader2naEor(&self->reader)) {
-            S
-            *status = _Core2naOpenNextRead(self, runs);
-            if (*status != eVdbBlastNoErr) {
-                STSMSG(1, ("Error: "
-                    "failed to VdbBlast2naReaderData: cannot open next read"));
-                return 0;
-            }
-        }
-        if (data->irun != self->irun)
-        {   data->irun = self->irun; }
-
-        if (self->eos) {
-            STSMSG(1, ("VdbBlast2naReaderData: End Of Set"));
-            return 0;
-        }
-
-        num_read = _Reader2naData(&self->reader, data, status,
-            buffer, buffer_length, self->min_read_length);
-    }
-
-    if (*status == eVdbBlastNoErr) {
-        STSMSG(3, ("VdbBlast2naReaderData = %ld", num_read));
-    }
-    else {
-        STSMSG(1, ("Error: failed to VdbBlast2naReaderData"));
-    }
-
-    return num_read;
-}
-
-static
-uint64_t _Core2naRead(Core2na *self,
-    const RunSet *runs,
-    uint32_t *status,
-    uint64_t *read_id,
-    size_t *starting_base,
-    uint8_t *buffer,
-    size_t buffer_size)
-{
-    uint64_t num_read = 0;
-
-    assert(self && status && runs);
-
-    if (buffer_size == 0) {
-        S
-        *status = eVdbBlastErr;
-        return 0;
-    }
-
-    *status = eVdbBlastNoErr;
-
-    while (*status == eVdbBlastNoErr && num_read == 0) {
-        if (_Reader2naEor(&self->reader)) {
-            S
-            *status = _Core2naOpenNextRead(self, runs);
-            if (*status != eVdbBlastNoErr) {
-                S
-                return 0;
-            }
-        }
-
-        if (self->eos) {
-            S
-            return 0;
-        }
-
-        num_read = _Reader2naRead(&self->reader, status,
-            read_id, starting_base, buffer, buffer_size, self->min_read_length);
-        S
-    }
-
-    return num_read;
-}
-
-typedef struct Core4na {
-    uint32_t min_read_length;
-    KLock *mutex;
-    ReadDesc desc;
-    const VCursor *curs;
-    const VBlob *blob; /* TODO */
-    ReaderCols cols;
-    uint32_t col_READ;
-} Core4na;
-
-static
-void _Core4naFini(Core4na *self)
-{
-    assert(self);
-
-    VCursorRelease(self->curs);
-    VBlobRelease(self->blob);
-    KLockRelease(self->mutex);
-
-    ReaderColsFini(&self->cols);
-
-    memset(self, 0, sizeof *self);
-}
-
-static
-size_t _Core4naRead(Core4na *self,
-    const RunSet *runs,
-    uint32_t *status,
-    uint64_t read_id,
-    size_t starting_base,
-    uint8_t *buffer,
-    size_t buffer_length)
-{
-    uint32_t num_read = 0;
-    ReadDesc *desc = NULL;
-    assert(self && runs && status);
-    desc = &((Core4na*)self)->desc;
-
-    *status = _RunSetFindReadDesc(runs, read_id, desc);
-    if (*status != eVdbBlastNoErr)
-    {   S }
-    else {
-        rc_t rc = 0;
-        if (!_ReadDescSameRun(desc)) {
-            S
-            ReaderColsReset(&self->cols);
-            VCursorRelease(self->curs);
-            ((Core4na*)self)->curs = NULL;
-            *status = _VdbBlastRunMakeCursor(desc->run,
-                &((Core4na*)self)->curs,
-                &((Core4na*)self)->col_READ, false,
-                &(((Core4na*)self)->cols));
-            S
-        }
-
-        if (*status == eVdbBlastNoErr && rc == 0) {
-            uint32_t remaining = 0;
-            uint32_t start = 0;
-            uint32_t to_read = 0;
-            assert(desc->run && desc->read <= desc->run->rd.nReads
-                && desc->run->path);
-            *status = _VCursorReadCols(self->curs,
-                desc->spot, &((Core4na*)self)->cols, desc->run->rd.nReads);
-            if (*status == eVdbBlastNoErr) {
-                assert(self->cols.read_len && self->cols.read_filter);
-                to_read = _Reader2naCalcReadParams(&self->desc,
-                    &self->cols, &start, self->min_read_length);
-                if (to_read == 0) {
-                    /* When _Reader2naCalcReadParams returns 0
-                    then this read is skipped by 2na reader (usually filtered)
-                    and should not be accessed by 4na reader */
-                    *status = eVdbBlastInvalidId;
-                    S
-                }
-                else {
-                    if (to_read >= starting_base) {
-                        to_read -= starting_base;
-                        start += starting_base;
-                       if (buffer_length < to_read) {
-                           to_read = buffer_length;
-                       }
-                        S
-                        rc = VCursorReadBitsDirect(self->curs,
-                            desc->spot, self->col_READ, 8,
-                            start, buffer, 0, to_read, &num_read, &remaining);
-                        if (rc != 0) {
-                            PLOGERR(klogInt, (klogInt, rc,
-                                "Error in VCursorReadBitsDirect"
-                                "($(path), READ, spot=$(spot))",
-                                "path=%s,spot=%ld",
-                                desc->run->path, desc->spot));
-                        }
-                    }
-                    else {
-                        S
-                        *status = eVdbBlastErr;
-                    }
-                }
-            }
-        }
-
-        if (*status == eVdbBlastNoErr)
-        {   *status = rc ? eVdbBlastErr : eVdbBlastNoErr; }
-    }
-
-    S
-    return num_read;
-}
-
-static
-const uint8_t* _Core4naData(Core4na *self,
-    const RunSet *runs,
-    uint32_t *status,
-    uint64_t read_id,
-    size_t *length)
-{
-    ReadDesc *desc = NULL;
-    assert(self && runs && status && length);
-    desc = &self->desc;
-
-    *length = 0;
-
-    *status = _RunSetFindReadDesc(runs, read_id, desc);
-    if (*status != eVdbBlastNoErr)
-    {   S }
-    else {
-        rc_t rc = 0;
-        const uint8_t *base = NULL;
-        if (!_ReadDescSameRun(desc)) {
-            S
-            ReaderColsReset(&self->cols);
-            VCursorRelease(self->curs);
-            self->curs = NULL;
-            *status = _VdbBlastRunMakeCursor(desc->run,
-                &self->curs, &self->col_READ, false,
-                &self->cols);
-            S
-        }
-
-        if (*status == eVdbBlastNoErr) {
-            *status = _VCursorReadCols(self->curs, desc->spot,
-                &self->cols, desc->run->rd.nReads);
-            S
-        }
-
-        if (rc == 0 && *status == eVdbBlastNoErr) {
-            assert(self->cols.read_len && self->cols.read_filter
-                && desc->run->path);
-
-            if (self->cols.read_filter[desc->read - 1]
-                != READ_FILTER_PASS)
-            {   /* FILTERed reads are not returned by 2na reader:
-                   4na readed should not ask for them */
-                *status = eVdbBlastInvalidId;
-                S
-            }
-            else if (ReaderColsIsReadCompressed(&self->cols, desc->read - 1)) {
-                /* Compressed CMP_READs are not returned by 2na reader:
-                   4na readed should not ask for them */
-                *status = eVdbBlastInvalidId; /*  */
-                S
-            }
-            else {
-                if (self->blob) {
-                    VBlobRelease(self->blob);
-                    self->blob = NULL;
-                }
-
-                if (rc == 0 && *status == eVdbBlastNoErr) {
-                    rc = VCursorGetBlobDirect
-                        (self->curs, &self->blob, desc->spot, self->col_READ);
-                    if (rc != 0) {
-                        PLOGERR(klogInt, (klogInt, rc,
-                            "Error in VCursorGetBlobDirect"
-                            "($(path), READ, spot=$(spot))",
-                            "path=%s,spot=%ld", desc->run->path, desc->spot));
-                    }
-                }
-
-                if (rc == 0 && *status == eVdbBlastNoErr) {
-                    uint32_t boff = 0;
-                    uint32_t elem_bits = 0;
-                    uint32_t row_len = 0;
-
-                    rc = VBlobCellData(self->blob, desc->spot,
-                        &elem_bits, (const void**)&base, &boff, &row_len);
-                    if (rc != 0) {
-                        PLOGERR(klogInt, (klogInt, rc, "Error in VBlobCellData"
-                            "$(path), READ, spot=$(spot))",
-                            "path=%s,spot=%ld", desc->run->path, desc->spot));
-                    }
-                    else {
-                        if (elem_bits != 8) {
-                            S
-                            *status = eVdbBlastErr;
-                            base = NULL;
-                        }
-                        else {
-                            size_t to_read
-                                = self->cols.read_len[desc->read - 1];
-
-                            if (to_read < self->min_read_length) {
-                                S
-                                /* NOP */
-                            }
-                            else {
-                                uint32_t start = 0;
-                                to_read = _Reader2naCalcReadParams(&self->desc,
-                                    &self->cols, &start, self->min_read_length);
-/*
-                                uint32_t offset = 0;
-                                int i = 0;
-                                assert(desc->run
-                                    && desc->read <= desc->run->rd.nReads);
-                                for (i = 1; i < desc->read; ++i)
-                                {   offset += self->cols.read_len[i - 1]; }
-                                base += boff + offset;
-                                */
-                                base += boff + start;
-                                if (row_len >= start) {
-                                    row_len -= start;
-                                    if (to_read > row_len) {
-                                        S
-                                        *status = eVdbBlastErr;
-                                    }
-                                    else {
-                                        S
-                                        *length = to_read;
-                                        *status = eVdbBlastNoErr;
-                                    }
-                                }
-                                else {
-                                    S
-                                    *status = eVdbBlastErr;
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-
-        if (*status == eVdbBlastNoErr) {
-            if (rc != 0)
-            {   *status = eVdbBlastErr; }
-        }
-
-        return base;
-    }
-
-    return NULL;
-}
-
-/******************************************************************************/
-static const char VDB_BLAST_RUN_SET[] = "VdbBlastRunSet";
-
-struct VdbBlastRunSet {
-    KRefcount refcount;
-    bool protein;
-    VdbBlastMgr *mgr;
-
-    RunSet runs;
-
-    bool beingRead;
-    Core2na core2na;
-    Core4na core4na;
-
-    uint64_t minSeqLen;
-    uint64_t avgSeqLen;
-    uint64_t maxSeqLen;
-};
-
-static
-void _VdbBlastRunSetWhack(VdbBlastRunSet *self)
-{
-    assert(self);
-
-    STSMSG(1, ("Deleting VdbBlastRunSet(min_read_length=%d, protein=%s)",
-        self->core2na.min_read_length, self->protein ? "true" : "false"));
-
-    VdbBlastMgrRelease(self->mgr);
-
-    _RunSetFini(&self->runs);
-    _Core2naFini(&self->core2na);
-    _Core4naFini(&self->core4na);
-
-    memset(self, 0, sizeof *self);
-    free(self);
-}
-
-VdbBlastRunSet *VdbBlastMgrMakeRunSet(const VdbBlastMgr *cself,
-    uint32_t *status,
-    uint32_t min_read_length,
-    bool protein)
-{
-    rc_t rc = 0;
-    VdbBlastRunSet *obj = NULL;
-    VdbBlastMgr *self = (VdbBlastMgr*)cself;
-
-    uint32_t dummy = eVdbBlastNoErr;
-    if (status == NULL)
-    {   status = &dummy; }
-
-    *status = eVdbBlastNoErr;
-
-    obj = calloc(1, sizeof *obj);
-    if (obj == NULL) {
-        *status = eVdbBlastMemErr;
-        return obj;
-    }
-
-    obj->protein = protein;
-    obj->core2na.min_read_length = min_read_length;
-    obj->core4na.min_read_length = min_read_length;
-
-    obj->minSeqLen = ~0;
-    obj->avgSeqLen = ~0;
-    obj->maxSeqLen = ~0;
-
-    if (rc == 0) {
-        rc = KLockMake(&obj->core2na.mutex);
-        if (rc != 0)
-        {   LOGERR(klogInt, rc, "Error in KLockMake"); }
-    }
-    if (rc == 0) {
-        rc = KLockMake(&obj->core4na.mutex);
-        if (rc != 0)
-        {   LOGERR(klogInt, rc, "Error in KLockMake"); }
-    }
-    if (rc == 0) {
-        obj->mgr = VdbBlastMgrAddRef(self);
-        if (obj->mgr) {
-            KRefcountInit(&obj->refcount,
-                1, VDB_BLAST_RUN_SET, __func__, "set");
-            STSMSG(1, ("Created VdbBlastRunSet(min_read_length=%d, protein=%s)",
-                min_read_length, protein ? "true" : "false"));
-            return obj;
-        }
-    }
-
-    STSMSG(1, ("Error: failed to create VdbBlastRunSet"));
-    _VdbBlastRunSetWhack(obj);
-
-    *status = eVdbBlastErr;
-
-    return NULL;
-}
-
-LIB_EXPORT
-VdbBlastRunSet* CC VdbBlastRunSetAddRef(VdbBlastRunSet *self)
-{
-    if (self == NULL) {
-        STSMSG(1, ("VdbBlastRunSetAddRef(NULL)"));
-        return self;
-    }
-
-    if (KRefcountAdd(&self->refcount, VDB_BLAST_RUN_SET) == krefOkay) {
-        STSMSG(1, ("VdbBlastRunSetAddRef"));
-        return self;
-    }
-
-    STSMSG(1, ("Error: failed to VdbBlastRunSetAddRef"));
-    return NULL;
-}
-
-LIB_EXPORT
-void CC VdbBlastRunSetRelease(VdbBlastRunSet *self)
-{
-    if (self == NULL)
-    {   return; }
-
-    STSMSG(1, ("VdbBlastRunSetRelease"));
-    if (KRefcountDrop(&self->refcount, VDB_BLAST_RUN_SET) != krefWhack)
-    {   return; }
-
-    _VdbBlastRunSetWhack(self);
-}
-
-LIB_EXPORT
-uint32_t CC VdbBlastRunSetAddRun(VdbBlastRunSet *self,
-    const char *rundesc)
-{
-    uint32_t status = eVdbBlastNoErr;
-    const VTable *tbl = NULL;
-    BTableType type = btpUndefined;
-
-    /* allocated in _VdbBlastMgrFindNOpenTable()
-       in _RunSetAddTbl() is assigned to VdbBlastRun::path
-       freed during VdbBlastRun release */
-    char *fullpath = NULL;
-
-    if (self == NULL || self->mgr == NULL || self->beingRead) {
-        S
-        return eVdbBlastErr;
-    }
-
-    status =
-        _VdbBlastMgrFindNOpenTable(self->mgr, rundesc, &tbl, &type, &fullpath);
-    if (status) {
-        S
-        PLOGMSG(klogInfo,
-            (klogInfo, "failed to open $(rundesc)", "rundesc=%s", rundesc));
-    }
-    else {
-        S
-        PLOGMSG(klogInfo,
-            (klogInfo, "opened $(rundesc)", "rundesc=%s", rundesc));
-        status = _RunSetAddTbl(&self->runs, tbl, rundesc, type,
-            self->mgr->dir, fullpath, self->core2na.min_read_length);
-        S
-    }
-
-    return status;
-}
-
-static
-void _VdbBlastRunSetBeingRead(const VdbBlastRunSet *self)
-{
-    if (self == NULL)
-    {   return; }
-    ((VdbBlastRunSet *)self)->beingRead = true;
-}
-
-LIB_EXPORT
-uint64_t CC VdbBlastRunSetGetNumSequences(const VdbBlastRunSet *self,
-    uint32_t *status)
-{
-    uint32_t dummy = eVdbBlastNoErr;
-    if (status == NULL)
-    {   status = &dummy; }
-
-    if (self == NULL) {
-        *status = eVdbBlastErr;
-        return 0;
-    }
-
-    _VdbBlastRunSetBeingRead(self);
-
-    return _RunSetGetNumSequences(&self->runs, status);
-}
-
-LIB_EXPORT
-uint64_t CC VdbBlastRunSetGetNumSequencesApprox(
-    const VdbBlastRunSet *self)
-{
-    uint64_t num = 0;
-    uint32_t status = eVdbBlastNoErr;
-
-    _VdbBlastRunSetBeingRead(self);
-
-    num = _RunSetGetNumSequencesApprox(&self->runs, &status);
-
-    STSMSG(1, ("VdbBlastRunSetGetNumSequencesApprox=%lu", num));
-
-    return num;
-}
-
-LIB_EXPORT
-uint64_t CC VdbBlastRunSetGetTotalLength(const VdbBlastRunSet *self,
-    uint32_t *status)
-{
-    uint32_t dummy = eVdbBlastNoErr;
-    if (status == NULL)
-    {   status = &dummy; }
-
-    if (self == NULL) {
-        *status = eVdbBlastErr;
-        return 0;
-    }
-
-    _VdbBlastRunSetBeingRead(self);
-
-    return _RunSetGetTotalLength(&self->runs, status);
-}
-
-LIB_EXPORT
-uint64_t CC VdbBlastRunSetGetTotalLengthApprox(
-    const VdbBlastRunSet *self)
-{
-    uint32_t status = eVdbBlastNoErr;
-
-    if (self == NULL) {
-        STSMSG(1, ("VdbBlastRunSetGetTotalLengthApprox(self=NULL)"));
-        return 0;
-    }
-
-    _VdbBlastRunSetBeingRead(self);
-
-    return _RunSetGetTotalLengthApprox(&self->runs, &status);
-}
-
-LIB_EXPORT
-uint64_t CC VdbBlastRunSetGetAvgSeqLen(const VdbBlastRunSet *self)
-{
-    uint64_t num = 0;
-
-    if (self == NULL) {
-        STSMSG(1, ("VdbBlastRunSetGetAvgSeqLen(self=NULL)"));
-        return 0;
-    }
-
-    if (self->avgSeqLen == ~0) {
-        uint64_t n = 0;
-        _VdbBlastRunSetBeingRead(self);
-
-        n = VdbBlastRunSetGetNumSequencesApprox(self);
-        if (n != 0) {
-            num = VdbBlastRunSetGetTotalLengthApprox(self) / n;
-        }
-        else {
-            num = n;
-        }
-        ((VdbBlastRunSet*)self)->avgSeqLen = num;
-    }
-
-    STSMSG(1, ("VdbBlastRunSetGetAvgSeqLen = %ld", num));
-    return self->avgSeqLen;
-}
-
-LIB_EXPORT
-size_t CC VdbBlastRunSetGetName(const VdbBlastRunSet *self,
-    uint32_t *status,
-    char *name_buffer,
-    size_t bsize)
-{
-    size_t sz = 0;
-
-    uint32_t dummy = eVdbBlastNoErr;
-    if (status == NULL)
-    {   status = &dummy; }
-
-    *status = eVdbBlastErr;
-
-    if (self == NULL)
-    {   return 0; }
-
-    _VdbBlastRunSetBeingRead(self);
-
-    sz = _RunSetGetName(&self->runs, status, name_buffer, bsize);
-
-    STSMSG(1, ("VdbBlastRunSetGetName = '%.*s'", bsize, name_buffer));
-
-    return sz;
-}
-
-LIB_EXPORT
-bool CC VdbBlastRunSetIsProtein(const VdbBlastRunSet *self)
-{
-    if (self == NULL) {
-        STSMSG(1, ("VdbBlastRunSetIsProtein(self=NULL)"));
-        return false;
-    }
-    STSMSG(1, (
-        "VdbBlastRunSetIsProtein = %s", self->protein ? "true" : "false"));
-    return self->protein;
-}
-
-LIB_EXPORT
-time_t CC VdbBlastRunSetLastUpdatedDate(const VdbBlastRunSet *self)
-{
-    _VdbBlastRunSetBeingRead(self);
-    return _NotImplemented(__func__);
-}
-
-LIB_EXPORT
-size_t CC VdbBlastRunSetGetReadName(const VdbBlastRunSet *self,
-    uint64_t read_id, /* 0-based in RunSet */
-    char *name_buffer,
-    size_t bsize)
-{
-    rc_t rc = 0;
-    uint32_t status = eVdbBlastNoErr;
-    size_t need = 0;
-    size_t num_writ = 0;
-
-    ReadDesc desc;
-    memset(&desc, 0, sizeof desc);
-
-    if (name_buffer && bsize)
-    {   name_buffer[0] = '\0'; }
-
-    if (self == NULL) {
-        STSMSG(1, ("VdbBlastRunSetGetReadName(self=NULL)"));
-        return 0;
-    }
-
-    _VdbBlastRunSetBeingRead(self);
-
-    status = _RunSetFindReadDesc(&self->runs, read_id, &desc);
-    if (status != eVdbBlastNoErr) {
-        STSMSG(1, ("Error: failed to VdbBlastRunSetGetReadName: "
-            "cannot find RunSet ReadDesc"));
-        return 0;
-    }
-
-    assert(desc.run && desc.run->path && desc.run->acc && desc.spot
-        && desc.read);
-
-    if (desc.run->type == btpUndefined) {
-        desc.run->type
-            = _VdbBlastMgrBTableTypeFromPath(self->mgr, desc.run->path);
-        assert(desc.run->type != btpUndefined);
-    }
-    if (desc.run->type == btpWGS) {
-        if (desc.read != 1) {
-            STSMSG(1, ("Error: failed to VdbBlastRunSetGetReadName: "
-                "Unexpected read='%u' for run '%s', spot='%lu'",
-                desc.read, desc.run->path, desc.spot));
-            return 0;
-        }
-        status = _VdbBlastRunGetWgsAccession(
-            desc.run, desc.spot, name_buffer, bsize, &need);
-        if (status != eVdbBlastNoErr)
-        {   need = 0; }
-        return need;
-    }
-    else if (desc.run->type == btpREFSEQ) {
-        rc = string_printf(name_buffer, bsize, &num_writ, "%s", desc.run->acc);
-        if (rc == 0) {
-            S
-            need = num_writ;
-        }
-        else if (GetRCObject(rc) == (enum RCObject)rcBuffer
-            && GetRCState(rc) == rcInsufficient)
-        {
-            size_t size;
-            S
-            need = string_measure(desc.run->acc, &size) + 1;
-        }
-    }
-    else {
-        rc = string_printf(name_buffer, bsize, &num_writ,
-            "%s.%lu.%u", desc.run->acc, desc.spot, desc.read);
-        if (rc == 0) {
-            S
-            need = num_writ;
-        }
-        else if (GetRCObject(rc) == (enum RCObject)rcBuffer
-            && GetRCState(rc) == rcInsufficient)
-        {
-            int i = 0;
-            size_t size;
-            S
-            need = string_measure(desc.run->acc, &size) + 2;
-            i = desc.spot;
-            while (i > 0) {
-                ++need;
-                i /= 10;
-            }
-            i = desc.read;
-            while (i > 0) {
-                ++need;
-                i /= 10;
-            }
-        }
-        else
-        {   LOGERR(klogInt, rc, "Unexpecter error in string_printf"); }
-    }
-
-    STSMSG(1, ("VdbBlastRunSetGetName = '%.*s'", bsize, name_buffer));
-    return need;
-}
-
-LIB_EXPORT
-uint32_t CC VdbBlastRunSetGetReadId(const VdbBlastRunSet *self,
-    const char *name_buffer,
-    size_t bsize,
-    uint64_t *read_id)
-{
-    uint32_t status = eVdbBlastNoErr;
-    bool found = false;
-
-    uint64_t result = 0;
-    char *acc = NULL;
-    uint64_t spot = 0;
-    uint32_t read = 0;
-    uint32_t i = ~0;
-    if (self == NULL || name_buffer == NULL || name_buffer[0] == '\0' ||
-        bsize == 0 || read_id == 0)
-    {   return eVdbBlastErr; }
-
-    {
-        size_t n = bsize;
-        const char *end = name_buffer + bsize;
-        char *dot2 = NULL;
-        char *dot1 = memchr(name_buffer, '.', bsize);
-        if (dot1 != NULL) {
-            if (dot1 == name_buffer)
-            {   return eVdbBlastErr; }
-            if (dot1 - name_buffer + 1 >= bsize)
-            {   return eVdbBlastErr; }
-            n -= (dot1 - name_buffer + 1);
-            dot2 = memchr(dot1 + 1, '.', n);
-            if (dot2 != NULL) {
-                if (dot2 - name_buffer + 1 >= bsize)
-                {   return eVdbBlastErr; }
-                acc = string_dup(name_buffer, dot1 - name_buffer + 1);
-                if (acc == NULL)
-                {   return eVdbBlastMemErr; }
-                acc[dot1 - name_buffer] = '\0';
-                while (++dot1 < dot2) {
-                    char c = *dot1;
-                    if (c < '0' || c > '9') {
-                        S
-                        status = eVdbBlastErr;
-                        break;
-                    }
-                    spot = spot * 10 + c - '0';
-                }
-                while (status == eVdbBlastNoErr && ++dot2 < end) {
-                    char c = *dot2;
-                    if (c < '0' || c > '9') {
-                        S
-                        status = eVdbBlastErr;
-                        break;
-                    }
-                    read = read * 10 + c - '0';
-                }
-            }
-            else {
-                acc = malloc(bsize + 1);
-                if (acc == NULL)
-                {   return eVdbBlastMemErr; }
-                string_copy(acc, bsize + 1, name_buffer, bsize);
-                acc[bsize] = '\0';
-            }
-        }
-        else {
-            acc = malloc(bsize + 1);
-            if (acc == NULL)
-            {   return eVdbBlastMemErr; }
-            string_copy(acc, bsize + 1, name_buffer, bsize);
-            acc[bsize] = '\0';
-        }
-    }
-
-    for (i = 0; i < self->runs.krun && status == eVdbBlastNoErr; ++i) {
-        uint64_t id = ~0;
-        VdbBlastRun *run = self->runs.run + i;
-        size_t size;
-        assert(run && run->acc);
-        if (string_measure(run->acc, &size) == string_measure(acc, &size)) {
-            if (strcmp(run->acc, acc) == 0) {
-                status = _VdbBlastRunGetReadId(run, acc, spot, read, &id);
-                if (status == eVdbBlastNoErr) {
-                    *read_id = result + id;
-                    found = true;
-                }
-                break;
-            }
-        }
-        else if ((string_measure(run->acc, &size) < string_measure(acc, &size))
-            && (run->type == btpWGS)
-            && (memcmp(run->acc, acc, string_measure(run->acc, &size)) == 0))
-        {
-            status = _VdbBlastRunGetReadId(run, acc, spot, read, &id);
-            if (status == eVdbBlastNoErr) {
-                *read_id = result + id;
-                found = true;
-            }
-            break;
-        }
-        result += _VdbBlastRunGetNumSequences(run, &status);
-        if (status != eVdbBlastNoErr) {
-            if (status == eVdbBlastTooExpensive) {
-                status = eVdbBlastNoErr;
-            }
-            else {
-                break;
-            }
-        }
-    }
-
-    if (status == eVdbBlastNoErr && !found) {
-        S
-        status = eVdbBlastErr;
-    }
-
-    free (acc);
-    acc = NULL;
-
-    return status;
-}
-
-/* TODO: make sure
-         ReadLength is correct when there are multiple reads in the same spot */
-LIB_EXPORT
-uint64_t CC VdbBlastRunSetGetReadLength(const VdbBlastRunSet *self,
-    uint64_t read_id)
-{
-    rc_t rc = 0;
-    const VCursor *curs = NULL;
-    uint32_t col_idx = 0;
-    char buffer[84] = "";
-    uint32_t row_len = 0;
-    ReadDesc desc;
-    uint32_t status = eVdbBlastErr;
-
-    if (self == NULL) {
-        STSMSG(1, ("VdbBlastRunSetGetReadLength(self=NULL)"));
-        return 0;
-    }
-
-    status = _RunSetFindReadDesc(&self->runs, read_id, &desc);
-    if (status != eVdbBlastNoErr) {
-        STSMSG(1, ("Error: failed to VdbBlastRunSetGetReadLength: "
-            "cannot find RunSet ReadDesc"));
-        return 0;
-    }
-    assert(desc.run && desc.spot && desc.run->path);
-
-    _VdbBlastRunSetBeingRead(self);
-
-    if (rc == 0) {
-        rc = _VTableMakeCursor(desc.run->tbl, &curs, &col_idx, "READ");
-        if (rc != 0) {
-            PLOGERR(klogInt, (klogInt, rc, "Error in _VTableMakeCursor"
-                "$(path), READ)", "path=%s", desc.run->path));
-        }
-    }
-    if (rc == 0) {
-        rc = VCursorReadDirect
-            (curs, desc.spot, col_idx, 8, buffer, sizeof buffer, &row_len);
-        if (rc != 0) {
-            PLOGERR(klogInt, (klogInt, rc, "Error in VCursorReadDirect"
-                "$(path), READ, spot=$(spot))",
-                "path=%s,spot=%ld", desc.run->path, desc.spot));
-        }
-    }
-    VCursorRelease(curs);
-    curs = NULL;
-    if (rc == 0) {
-        STSMSG(1, ("VdbBlastRunSetGetReadLength = %ld", row_len));
-        return row_len;
-    }
-    else {
-        STSMSG(1, ("Error: failed to VdbBlastRunSetGetReadLength"));
-        return 0;
-    }
-}
-
-static
-uint64_t _VdbBlastRunSet2naRead(const VdbBlastRunSet *self,
-    uint32_t *status,
-    uint64_t *read_id,
-    size_t *starting_base,
-    uint8_t *buffer,
-    size_t buffer_size)
-{
-    uint64_t n = 0; 
-    rc_t rc = 0;
-    assert(self && status);
-    rc = KLockAcquire(self->core2na.mutex);
-    if (rc != 0) {
-        LOGERR(klogInt, rc, "Error in KLockAcquire");
-    }
-    else {
-        n = _Core2naRead((Core2na*)&self->core2na, &self->runs,
-            status, read_id, starting_base, buffer, buffer_size);
-        if (n == 0 && self->core2na.eos) {
-            *read_id = ~0;
-        }
-        rc = KLockUnlock(self->core2na.mutex);
-        if (rc != 0) {
-            LOGERR(klogInt, rc, "Error in KLockUnlock");
-        }
-    }
-    if (rc) {
-        *status = eVdbBlastErr;
-    }
-    if (*status == eVdbBlastNoErr) {
-        if (read_id != NULL && starting_base != NULL) {
-            STSMSG(3, (
-                "VdbBlast2naReaderRead(read_id=%ld, starting_base=%ld) = %ld",
-                *read_id, *starting_base, n));
-        }
-        else {
-            STSMSG(2, ("VdbBlast2naReaderRead = %ld", n));
-        }
-    }
-    else {
-        if (read_id != NULL && starting_base != NULL) {
-            STSMSG(1, ("Error: failed to "
-                "VdbBlast2naReaderRead(read_id=%ld, starting_base=%ld)", n));
-        }
-        else {
-            STSMSG(1, ("Error: failed to VdbBlast2naReaderRead"));
-        }
-    }
-    return n;
-}
-
-/******************************************************************************/
-static const char VDB_BLAST_2NA_READER[] = "VdbBlast2naReader";
-
-struct VdbBlast2naReader {
-    KRefcount refcount;
-    VdbBlastRunSet *set;
-    Data2na data;
-};
-
-static
-VdbBlast2naReader *_VdbBlastRunSetMake2naReader(VdbBlastRunSet *self,
-    uint32_t *status,
-    uint64_t initial_read_id,
-    Core2na *core2na)
-{
-    VdbBlast2naReader *obj = NULL;
-    assert(self && status);
-    if (core2na == NULL) {
-        core2na = &self->core2na;
-    }
-    else {
-        core2na->initial_read_id = initial_read_id;
-    }
-    if (!core2na->hasReader) {
-        *status = _Core2naOpen1stRead(core2na, &self->runs, initial_read_id);
-        if (*status != eVdbBlastNoErr) {
-            STSMSG(1, ("Error: failed to create VdbBlast2naReader: "
-                "cannot open the first read"));
-            return NULL;
-        }
-        _VdbBlastRunSetBeingRead(self);
-        core2na->initial_read_id = initial_read_id;
-        core2na->hasReader = true;
-    }
-    else if (core2na->initial_read_id != initial_read_id) {
-        STSMSG(1, ("Error: failed to create VdbBlast2naReader"
-            "(initial_read_id=%ld): allowed initial_read_id=%ld",
-            initial_read_id, core2na->initial_read_id));
-        *status = eVdbBlastErr;
-        return NULL;
-    }
-    obj = calloc(1, sizeof *obj);
-    if (obj == NULL) {
-        *status = eVdbBlastMemErr;
-        return NULL;
-    }
-
-    obj->set = VdbBlastRunSetAddRef((VdbBlastRunSet*)self);
-
-    KRefcountInit(&obj->refcount, 1,
-        VDB_BLAST_2NA_READER, __func__, "2naReader");
-
-    *status = eVdbBlastNoErr;
-
-    return obj;
-}
-
-LIB_EXPORT
-VdbBlast2naReader* CC VdbBlastRunSetMake2naReader(const VdbBlastRunSet *self,
-    uint32_t *status,
-    uint64_t initial_read_id)
-{
-    VdbBlast2naReader *obj = NULL;
-
-    uint32_t dummy = eVdbBlastNoErr;
-    if (status == NULL)
-    {   status = &dummy; }
-
-    if (self) {
-        rc_t rc = KLockAcquire(self->core2na.mutex);
-        if (rc != 0)
-        {   LOGERR(klogInt, rc, "Error in KLockAcquire"); }
-        else {
-            obj = _VdbBlastRunSetMake2naReader
-                ((VdbBlastRunSet*)self, status, initial_read_id, NULL);
-            rc = KLockUnlock(self->core2na.mutex);
-            if (rc != 0) {
-                LOGERR(klogInt, rc, "Error in KLockUnlock");
-                VdbBlast2naReaderRelease(obj);
-                obj = NULL;
-            }
-        }
-        if (rc != 0) {
-            *status = eVdbBlastErr;
-        }
-    }
-    else {
-        *status = eVdbBlastErr;
-    }
-
-    if (obj != NULL) {
-        STSMSG(1, (
-            "Created VdbBlast2naReader(initial_read_id=%ld)", initial_read_id));
-    }
-    else {
-        STSMSG(1, ("Error: failed to create "
-            "VdbBlast2naReader(initial_read_id=%ld)", initial_read_id));
-    }
-
-    return obj;
-}
-
-LIB_EXPORT
-VdbBlast2naReader* CC VdbBlast2naReaderAddRef(VdbBlast2naReader *self)
-{
-    if (self == NULL) {
-        STSMSG(1, ("VdbBlast2naReaderAddRef(NULL)"));
-        return self;
-    }
-
-    if (KRefcountAdd(&self->refcount, VDB_BLAST_2NA_READER)
-        == krefOkay)
-    {
-        STSMSG(1, ("VdbBlast2naReaderAddRef"));
-        return self;
-    }
-
-    STSMSG(1, ("Error: failed to VdbBlast2naReaderAddRef"));
-    return NULL;
-}
-
-static
-void _VdbBlast2naReaderWhack(VdbBlast2naReader *self)
-{
-    if (self == NULL)
-    {   return; }
-
-    if (self->set != NULL) {
-        STSMSG(1, ("Deleting VdbBlast2naReader(initial_read_id=%ld)",
-            self->set->core2na.initial_read_id));
-    }
-    else {
-        STSMSG(1, ("Deleting VdbBlast2naReader(self->set=NULL)",
-            self->set->core2na.initial_read_id));
-    }
-
-    VBlobRelease(self->data.blob);
-    VdbBlastRunSetRelease(self->set);
-
-    memset(self, 0, sizeof *self);
-
-    free(self);
-}
-
-LIB_EXPORT
-void CC VdbBlast2naReaderRelease(VdbBlast2naReader *self)
-{
-    if (self == NULL)
-    {   return; }
-
-    STSMSG(1, ("VdbBlast2naReaderRelease"));
-    if (KRefcountDrop(&self->refcount, VDB_BLAST_2NA_READER) != krefWhack)
-    {   return; }
-
-    _VdbBlast2naReaderWhack(self);
-}
-
-LIB_EXPORT
-uint64_t CC _VdbBlast2naReaderRead(const VdbBlast2naReader *self,
-    uint32_t *status,
-    uint64_t *read_id,
-    size_t *starting_base,
-    uint8_t *buffer,
-    size_t buffer_size)
-{
-    uint32_t dummy = eVdbBlastNoErr;
-    if (status == NULL)
-    {   status = &dummy; }
-
-    if (self == NULL) {
-        *status = eVdbBlastErr;
-        return 0;
-    }
-
-    return _VdbBlastRunSet2naRead(self->set,
-        status, read_id, starting_base, buffer, buffer_size);
-}
-
-LIB_EXPORT
-uint64_t CC VdbBlast2naReaderRead(const VdbBlast2naReader *self,
-    uint32_t *status,
-    uint64_t *read_id,
-    uint8_t *buffer,
-    size_t buffer_size)
-{
-    size_t starting_base = 0;
-
-    return _VdbBlast2naReaderRead(self,
-        status, read_id, &starting_base, buffer, buffer_size);
-}
-
-LIB_EXPORT
-uint32_t CC VdbBlast2naReaderData(VdbBlast2naReader *self,
-    uint32_t *status,
-    Packed2naRead *buffer,
-    uint32_t buffer_length)
-{
-    bool verbose = false;
-    uint32_t n = 0;
-    rc_t rc = 0;
-
-    uint32_t dummy = eVdbBlastNoErr;
-    if (status == NULL)
-    {   status = &dummy; }
-
-    *status = eVdbBlastErr;
-
-    if (self == NULL)
-    {   return 0; }
-
-    if ((buffer_length != 0 && buffer == NULL) || (buffer_length == 0))
-    {   return 0; }
-
-    *status = eVdbBlastNoErr;
-
-    assert(self->set);
-
-    rc = KLockAcquire(self->set->core2na.mutex);
-    if (rc != 0)
-    {   LOGERR(klogInt, rc, "Error in KLockAcquire"); }
-    if (0 && verbose) {
-        char b[256];
-        string_printf(b, sizeof b, NULL, "KLockAcquire(%p)\n",
-            self->set->core2na.mutex);
-            assert(!rc);
-        fprintf(stderr, "%s", b);
-        fflush(stderr);
-    }
-    if (rc == 0) {
-        n = _Core2naData((Core2na*)&self->set->core2na, &self->data,
-            &self->set->runs, status, buffer, buffer_length);
-        S
-        if (n > 0 && verbose)
-        {   _Packed2naReadPrint(buffer, self->data.blob); }
-        if (0 && verbose) {
-            char b[256];
-            string_printf(b, sizeof b, NULL, "KLockUnlock(%p)\n",
-                self->set->core2na.mutex);
-            assert(!rc);
-            fprintf(stderr, "%s", b);
-            fflush(stderr);
-        }
-        rc = KLockUnlock(self->set->core2na.mutex);
-        if (rc != 0)
-        {   LOGERR(klogInt, rc, "Error in KLockUnlock"); }
-    }
-    if (rc)
-    {   *status = eVdbBlastErr; }
-
-    S
-    return n;
-}
-
-static uint64_t _VdbBlastRunScan(const VdbBlastRun *self,
-    uint64_t (*cmp)
-        (uint64_t cand, uint64_t champ, int64_t minRead, bool *done),
-    uint64_t minRead, uint64_t start, uint32_t *status)
-{
-    uint64_t res = start;
-    uint64_t bad = start;
-    uint64_t spot = 0;
-    bool done = false;
-    rc_t rc = 0;
-    const VCursor *curs = NULL;
-    uint32_t idx = 0;
-    assert(self && status &&
-        (self->rd.spotCount || self->rd.readType ||
-         self->rd.nReads    || self->rd.nBioReads));
-    rc = _VTableMakeCursor(self->tbl, &curs, &idx, "READ_LEN");
-    if (rc != 0) {
-        return bad;
-    }
-    for (spot = 1;
-        spot <= self->rd.spotCount && *status == eVdbBlastNoErr && !done;
-        ++spot)
-    {
-        uint32_t elem_bits, elem_off, elem_cnt;
-        const void *base = NULL;
-        rc = VCursorCellDataDirect(curs, spot, idx,
-            &elem_bits, &base, &elem_off, &elem_cnt);
-        if (rc != 0) {
-            *status = eVdbBlastErr;
-            PLOGMSG(klogInfo, (klogInfo,
-                "$(f): Cannot '$(name)' CellDataDirect",
-                "f=%s,name=%s", __func__, "READ_LEN"));
-            res = bad;
-            break;
-        }
-        else if (elem_off != 0 || elem_bits != 32) {
-            *status = eVdbBlastErr;
-            PLOGERR(klogInt, (klogInt, rc,
-                "Bad VCursorCellDataDirect(READ_LEN) result: "
-                "boff=$(elem_off), elem_bits=$(elem_bits)",
-                "elem_off=%u,elem_bits=%u", elem_off, elem_bits));
-            res = bad;
-            break;
-        }
-        else {
-            uint8_t read = 0;
-            const uint32_t *readLen = base;
-            assert(self->rd.readType && self->rd.readLen);
-            assert(self->rd.nReads == elem_cnt);
-            for (read = 0; read < self->rd.nReads; ++read) {
-                if (self->rd.readType[read] & SRA_READ_TYPE_BIOLOGICAL) {
-                   res = cmp(readLen[read], res, minRead, &done);
-                }
-            }
-        }
-    }
-    RELEASE(VCursor, curs);
-    return res;
-}
-
-/*static
-uint64_t CC _VdbBlastRunSetGetSomeSeqLen2(const VdbBlastRunSet *self, bool max)
-{
-    uint64_t num = max ? 0 : ~0;
-    bool done = false;
-    Packed2naRead buffer[1024];
-    uint32_t status = eVdbBlastNoErr;
-    VdbBlast2naReader* r = NULL;
-
-    Core2na core2na;
-    memset(&core2na, 0, sizeof core2na);
-
-    _VdbBlastRunSetBeingRead(self);
-
-    r = _VdbBlastRunSetMake2naReader(
-        (VdbBlastRunSet*)self, &status, 0, &core2na);
-    while (status == eVdbBlastNoErr) {
-        uint32_t i = 0;
-        uint32_t n = _Core2naData(&core2na, &r->data,
-             &self->runs, &status, buffer, sizeof buffer / sizeof buffer[0]);
-        if (status != eVdbBlastNoErr) {
-            num = max ? 0 : ~0;
-            break;
-        }
-        if (n == 0) {
-            break;
-        }
-        for (i = 0; i < n; ++i) {
-            if (max) {
-                if (num < buffer[i].length_in_bases) {
-                    num = buffer[i].length_in_bases;
-                }
-            }
-            else {
-                if (num > buffer[i].length_in_bases) {
-                    num = buffer[i].length_in_bases;
-                    if (num > 0 && num - 1 == r->set->core2na.min_read_length) {
-                        done = true;
-                        break;
-                    }
-                }
-            }
-        }
-        if (done) {
-            break;
-        }
-    }
-    _Core2naFini(&core2na);
-    VdbBlast2naReaderRelease(r);
-    return num;
-}*/
-
-static
-uint64_t CC Min(uint64_t cand,
-    uint64_t champ, int64_t minRead, bool *done)
-{
-    assert(done);
-    if (minRead >= 0) {
-        if (cand < minRead) {
-            return champ;
-        }
-        else if (cand == minRead) {
-            *done = true;
-            return minRead;
-        }
-    } 
-    return cand < champ ? cand : champ;
-}
-
-static
-uint64_t CC Max(uint64_t cand,
-    uint64_t champ, int64_t minRead, bool *done)
-{
-    return cand > champ ? cand : champ;
-}
-
-/*static
-uint64_t CC Sum(uint64_t cand, uint64_t champ, int64_t minRead, bool *done)
-{
-    return cand + champ;
-}*/
-
-LIB_EXPORT
-uint64_t CC VdbBlastRunSetGetMinSeqLen(const VdbBlastRunSet *self)
-{
-    if (self->minSeqLen == ~0) {
-        bool empty = true;
-        uint32_t status = eVdbBlastNoErr;
-        uint64_t res = ~0;
-        uint32_t i = 0;
-        _VdbBlastRunSetBeingRead(self);
-        for (i = 0; i < self->runs.krun; ++i) {
-            VdbBlastRun *run = &self->runs.run[i];
-            assert(run);
-            if (run->type == btpREFSEQ) {
-                uint64_t cand = _VdbBlastRunGetLengthApprox(run, &status);
-                if (status != eVdbBlastNoErr) {
-                    S
-                    return ~0;
-                }
-                if (cand < res && cand >= self->core2na.min_read_length) {
-                    res = cand;
-                }
-            }
-            else {
-                status = _VdbBlastRunFillRunDesc(run);
-                if (status != eVdbBlastNoErr) {
-                    S
-                    return ~0;
-                }
-                if (!run->rd.varReadLen) {
-                    uint8_t read = 0;
-                    assert(run->rd.readType && run->rd.readLen);
-                    for (read = 0; read < run->rd.nReads; ++read) {
-                        if (run->rd.readType[i] & SRA_READ_TYPE_BIOLOGICAL) {
-                            if (run->rd.readLen[i]
-                                == self->core2na.min_read_length)
-                            {
-                                ((VdbBlastRunSet*)self)->minSeqLen
-                                    = self->core2na.min_read_length;
-                                return self->minSeqLen;
-                            }
-                            else if (run->rd.readLen[i]
-                                    > self->core2na.min_read_length
-                                && run->rd.readLen[i] < res)
-                            {
-                                res = run->rd.readLen[i];
-                                empty = false;
-                            }
-                        }
-                    }
-                }
-                else {
-                    res = _VdbBlastRunScan(
-                        run, Min, self->core2na.min_read_length, res, &status);
-                    if (status != eVdbBlastNoErr) {
-                        S
-                        return ~0;
-                    }
-                }
-            }
-        }
-        if (empty && res == ~0) {
-            res = 0;
-        }
-        ((VdbBlastRunSet*)self)->minSeqLen = res;
-    }
-    return self->minSeqLen;
-}
-LIB_EXPORT
-uint64_t CC VdbBlastRunSetGetMaxSeqLen(const VdbBlastRunSet *self)
-{
-    if (self->maxSeqLen == ~0) {
-        uint32_t status = eVdbBlastNoErr;
-        uint64_t res = 0;
-        uint32_t i = 0;
-        _VdbBlastRunSetBeingRead(self);
-        for (i = 0; i < self->runs.krun; ++i) {
-            VdbBlastRun *run = &self->runs.run[i];
-            assert(run);
-            if (run->type == btpREFSEQ) {
-                uint64_t cand = _VdbBlastRunGetLengthApprox(run, &status);
-                if (status != eVdbBlastNoErr) {
-                    S
-                    return ~0;
-                }
-                if (cand > res) {
-                    res = cand;
-                }
-            }
-            else {
-                status = _VdbBlastRunFillRunDesc(run);
-                if (status != eVdbBlastNoErr) {
-                    S
-                    return ~0;
-                }
-                if (!run->rd.varReadLen) {
-                    uint8_t read = 0;
-                    assert(run->rd.readType && run->rd.readLen);
-                    for (read = 0; read < run->rd.nReads; ++read) {
-                        if (run->rd.readType[i] & SRA_READ_TYPE_BIOLOGICAL) {
-                            if (run->rd.readLen[i] > res) {
-                                res = run->rd.readLen[i];
-                            }
-                        }
-                    }
-                }
-                else {
-                    res = _VdbBlastRunScan(
-                        run, Max, -1, res, &status);
-                    if (status != eVdbBlastNoErr) {
-                        S
-                        return ~0;
-                    }
-                }
-            }
-        }
-        ((VdbBlastRunSet*)self)->maxSeqLen = res;
-    }
-    return self->maxSeqLen;
-}
-
-/******************************************************************************/
-static const char VDB_BLAST_4NA_READER[] = "VdbBlast4naReader";
-
-struct VdbBlast4naReader {
-    KRefcount refcount;
-    VdbBlastRunSet *set;
-};
-
-LIB_EXPORT
-VdbBlast4naReader* CC VdbBlastRunSetMake4naReader(const VdbBlastRunSet *self,
-    uint32_t *status)
-{
-    uint32_t dummy = eVdbBlastNoErr;
-    if (status == NULL) {
-        status = &dummy;
-    }
-
-    if (self) {
-        VdbBlast4naReader *obj = calloc(1, sizeof *obj);
-        if (obj == NULL) {
-            *status = eVdbBlastMemErr;
-            return NULL;
-        }
-
-        obj->set = VdbBlastRunSetAddRef((VdbBlastRunSet*)self);
-
-        KRefcountInit(&obj->refcount, 1,
-            VDB_BLAST_4NA_READER, __func__, "4naReader");
-
-        _VdbBlastRunSetBeingRead(self);
-
-        *status = eVdbBlastNoErr;
-
-        STSMSG(1, ("Created VdbBlast4naReader"));
-
-        return obj;
-    }
-    else {
-        *status = eVdbBlastErr;
-
-        STSMSG(1, ("VdbBlastRunSetMake4naReader(self=NULL)"));
-
-        return NULL;
-    }
-}
-
-LIB_EXPORT
-VdbBlast4naReader* CC VdbBlast4naReaderAddRef(VdbBlast4naReader *self)
-{
-    if (self == NULL) {
-        STSMSG(1, ("VdbBlast4naReaderAddRef(NULL)"));
-        return self;
-    }
-
-    if (KRefcountAdd(&self->refcount, VDB_BLAST_4NA_READER)
-        == krefOkay)
-    {
-        STSMSG(1, ("VdbBlast4naReaderAddRef"));
-        return self;
-    }
-
-    STSMSG(1, ("Error: failed to VdbBlast4naReaderAddRef"));
-    return NULL;
-}
-
-LIB_EXPORT
-void CC VdbBlast4naReaderRelease(VdbBlast4naReader *self)
-{
-    if (self == NULL)
-    {   return; }
-
-    STSMSG(1, ("VdbBlast4naReaderRelease"));
-    if (KRefcountDrop(&self->refcount, VDB_BLAST_4NA_READER) != krefWhack)
-    {   return; }
-
-    STSMSG(1, ("Deleting VdbBlast4naReader"));
-
-    VdbBlastRunSetRelease(self->set);
-
-    memset(self, 0, sizeof *self);
-    free(self);
-}
-
-LIB_EXPORT
-size_t CC VdbBlast4naReaderRead(const VdbBlast4naReader *self,
-    uint32_t *status,
-    uint64_t read_id,
-    size_t starting_base,
-    uint8_t *buffer,
-    size_t buffer_length)
-{
-    size_t n = 0;
-    rc_t rc = 0;
-
-    uint32_t dummy = eVdbBlastNoErr;
-    if (status == NULL)
-    {   status = &dummy; }
-
-    if (self == NULL) {
-        S
-        *status = eVdbBlastErr;
-        return 0;
-    }
-
-    assert(self->set);
-
-    rc = KLockAcquire(self->set->core4na.mutex);
-    if (rc != 0)
-    {   LOGERR(klogInt, rc, "Error in KLockAcquire"); }
-    else {
-        n = _Core4naRead(&self->set->core4na, &self->set->runs,
-            status, read_id, starting_base, buffer, buffer_length);
-        rc = KLockUnlock(self->set->core4na.mutex);
-        if (rc != 0)
-        {   LOGERR(klogInt, rc, "Error in KLockUnlock"); }
-    }
-    if (rc != 0)
-    {   *status = eVdbBlastErr; }
-
-    if (*status == eVdbBlastNoErr) {
-        STSMSG(3, (
-            "VdbBlast4naReaderRead(read_id=%ld, starting_base=%ld) = %ld",
-            read_id, starting_base, n));
-    }
-    else {
-        STSMSG(2, ("Error: failed to "
-            "VdbBlast4naReaderRead(read_id=%ld, starting_base=%ld)",
-            read_id, starting_base));
-    }
-
-    return n;
-}
-
-LIB_EXPORT
-const uint8_t* CC VdbBlast4naReaderData(const VdbBlast4naReader *self,
-    uint32_t *status,
-    uint64_t read_id,
-    size_t *length)
-{
-    const uint8_t *d = NULL;
-    rc_t rc = 0;
-
-    uint32_t dummy = eVdbBlastNoErr;
-    if (status == NULL)
-    {   status = &dummy; }
-
-    if (self == NULL || length == NULL) {
-        if (self == NULL)
-        {   STSMSG(1, ("VdbBlast4naReaderData(self=NULL)")); }
-        if (length == NULL)
-        {   STSMSG(1, ("VdbBlast4naReaderData(length=NULL)")); }
-        *status = eVdbBlastErr;
-        return 0;
-    }
-
-    assert(self->set);
-
-    rc = KLockAcquire(self->set->core4na.mutex);
-    if (rc != 0)
-    {   LOGERR(klogInt, rc, "Error in KLockAcquire"); }
-    else {
-        d = _Core4naData(( Core4na*)&self->set->core4na,
-            &self->set->runs, status, read_id, length);
-        rc = KLockUnlock(self->set->core4na.mutex);
-        if (rc != 0)
-        {   LOGERR(klogInt, rc, "Error in KLockUnlock"); }
-    }
-    if (rc)
-    {   *status = eVdbBlastErr; }
-
-    if (*status == eVdbBlastNoErr) {
-        STSMSG(3, ("VdbBlast4naReaderData(read_id=%ld, length=%ld)",
-            read_id, *length));
-    }
-    else {
-        STSMSG(1, ("Error: failed to VdbBlast4naReaderData(read_id=%ld)",
-            read_id));
-    }
-
-    return d;
-}
-
-/******************************************************************************/
-static const char VDB_BLAST_AA_READER[] = "VdbBlastStdaaReader";
-
-struct VdbBlastStdaaReader {
-    KRefcount refcount;
-};
-
-LIB_EXPORT
-VdbBlastStdaaReader* CC VdbBlastRunSetMakeStdaaReader(
-    const VdbBlastRunSet *self,
-    uint32_t *status)
-{
-    VdbBlastStdaaReader *obj = NULL;
-
-    uint32_t dummy = eVdbBlastNoErr;
-    if (status == NULL)
-    {   status = &dummy; }
-
-    obj = calloc(1, sizeof *obj);
-    if (obj == NULL) {
-        *status = eVdbBlastMemErr;
-        STSMSG(1, ("Error: failed to create VdbBlastStdaaReader"));
-        return NULL;
-    }
-
-    KRefcountInit(&obj->refcount, 1, VDB_BLAST_AA_READER, __func__, "aaReader");
-
-    _VdbBlastRunSetBeingRead(self);
-
-    *status = eVdbBlastNoErr;
-
-    STSMSG(1, ("Created VdbBlastStdaaReader"));
-
-    return obj;
-}
-
-LIB_EXPORT
-VdbBlastStdaaReader* CC VdbBlastStdaaReaderAddRef(
-    VdbBlastStdaaReader *self)
-{
-    if (self == NULL) {
-        STSMSG(1, ("VdbBlastStdaaReaderAddRef(NULL)"));
-        return self;
-    }
-
-    if (KRefcountAdd(&self->refcount, VDB_BLAST_AA_READER) == krefOkay) {
-        STSMSG(1, ("VdbBlastStdaaReaderAddRef"));
-        return self;
-    }
-
-    STSMSG(1, ("Error: failed to VdbBlastStdaaReaderAddRef"));
-    return NULL;
-}
-
-LIB_EXPORT
-void CC VdbBlastStdaaReaderRelease(VdbBlastStdaaReader *self)
-{
-    if (self == NULL)
-    {   return; }
-
-    STSMSG(1, ("VdbBlastStdaaReaderRelease"));
-    if (KRefcountDrop(&self->refcount, VDB_BLAST_AA_READER) != krefWhack)
-    {   return; }
-
-    STSMSG(1, ("Deleting VdbBlastStdaaReader"));
-    free(self);
-    memset(self, 0, sizeof *self);
-}
-
-LIB_EXPORT
-size_t CC VdbBlastStdaaReaderRead(const VdbBlastStdaaReader *self,
-    uint32_t *status,
-    uint64_t pig,
-    uint8_t *buffer,
-    size_t buffer_length)
-{   return _NotImplemented(__func__); }
-
-LIB_EXPORT
-const uint8_t* CC VdbBlastStdaaReaderData(const VdbBlastStdaaReader *self,
-    uint32_t *status,
-    uint64_t pig,
-    size_t *length)
-{   return _NotImplementedP(__func__); }
-
-/* EOF */
diff --git a/libs/kapp/Makefile b/libs/kapp/Makefile
deleted file mode 100644
index f833d17..0000000
--- a/libs/kapp/Makefile
+++ /dev/null
@@ -1,115 +0,0 @@
-# ===========================================================================
-#
-#                            PUBLIC DOMAIN NOTICE
-#               National Center for Biotechnology Information
-#
-#  This software/database is a "United States Government Work" under the
-#  terms of the United States Copyright Act.  It was written as part of
-#  the author's official duties as a United States Government employee and
-#  thus cannot be copyrighted.  This software/database is freely available
-#  to the public for use. The National Library of Medicine and the U.S.
-#  Government have not placed any restriction on its use or reproduction.
-#
-#  Although all reasonable efforts have been taken to ensure the accuracy
-#  and reliability of the software and data, the NLM and the U.S.
-#  Government do not and cannot warrant the performance or results that
-#  may be obtained by using this software or data. The NLM and the U.S.
-#  Government disclaim all warranties, express or implied, including
-#  warranties of performance, merchantability or fitness for any particular
-#  purpose.
-#
-#  Please cite the author in any work or product based on this material.
-#
-# ===========================================================================
-
-
-default: std
-
-TOP ?= $(shell ../../build/abspath.sh ../..)
-MODULE = libs/kapp
-
-include $(TOP)/build/Makefile.env
-
-INT_LIBS = \
-	libkapp \
-    libload
-
-ALL_LIBS = \
-	$(INT_LIBS)
-
-#-------------------------------------------------------------------------------
-# outer targets
-#
-all std: makedirs
-	@ $(MAKE_CMD) $(TARGDIR)/std
-
-$(INT_LIBS): makedirs
-	@ $(MAKE_CMD) $(ILIBDIR)/$@
-
-.PHONY: all std $(ALL_LIBS)
-
-#-------------------------------------------------------------------------------
-# std
-#
-$(TARGDIR)/std: \
-	$(addprefix $(ILIBDIR)/,$(INT_LIBS))
-
-.PHONY: $(TARGDIR)/std
-
-#-------------------------------------------------------------------------------
-# clean
-#
-clean: stdclean
-
-.PHONY: clean
-
-#-------------------------------------------------------------------------------
-# OS specific application support
-#
-$(ILIBDIR)/libkapp: $(addprefix $(ILIBDIR)/libkapp.,$(LIBX))
-
-KAPP_SRC = \
-	main \
-	args \
-	tokenizer \
-	sysmain
-
-KAPP_OBJ = \
-	$(addsuffix .$(OBJX),$(KAPP_SRC))
-
-KAPP_LIB = \
-	-dvfs \
-	-dklib
-
-$(ILIBDIR)/libkapp.$(LIBX): $(KAPP_OBJ)
-	$(LD) --slib -o $@ $^ $(KAPP_LIB)
-
-
-#-------------------------------------------------------------------------------
-# loaders common libarary
-#
-$(ILIBDIR)/libload: $(addprefix $(ILIBDIR)/libload.,$(LIBX))
-
-LOADLIB_SRC = \
-	progressbar \
-	loader-file \
-	loader-meta \
-	log-xml
-
-ifneq (win,$(OS))
-	LOADLIB_SRC += queue-file
-endif
-
-LOADLIB_OBJ = \
-	$(addsuffix .$(LOBX),$(LOADLIB_SRC))
-
-LOADLIB_LIB = \
-	-dkfs \
-	-dklib
-
-ifneq (win,$(OS))
-	LOADLIB_LIB += -dkq
-endif
-
-$(ILIBDIR)/libload.$(LIBX): $(LOADLIB_OBJ)
-	$(LD) --slib -o $@ $^ $(LOADLIB_LIB)
diff --git a/libs/kapp/args.c b/libs/kapp/args.c
deleted file mode 100644
index 0a0d096..0000000
--- a/libs/kapp/args.c
+++ /dev/null
@@ -1,2004 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <kapp/extern.h>
-#include <sysalloc.h>
-
-#include <klib/report.h>
-#include <klib/rc.h>
-#include <klib/container.h>
-#include <klib/text.h>
-#include <klib/printf.h>
-#include <klib/vector.h>
-#include <klib/log.h>
-#include <klib/out.h>
-#include <klib/status.h>
-#include <klib/debug.h>
-#include <kfg/config.h>
-#include <kapp/main.h>
-#include <kapp/args.h>
-
-#include "args_debug.h"
-
-#include <assert.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-
-#define USE_INLINING   0
-#ifndef USE_OPTFILE
-#define USE_OPTFILE    0
-#endif
-#define USE_EARLY_HELP 1
-#define USE_EARLY_VERSION 1
-
-/* many tools acquired some usage for '-q'
-   other than the standard meaning of "be quiet".
-   while we phase this out, allow these tools
-   to replace the default usage. */
-#define HONOR_LEGACY_Q_ALIAS 1
-#if HONOR_LEGACY_Q_ALIAS
-#define LEGACY_Q_ALIAS_DEPRECATED 1
-#define LEGACY_Q_ALIAS_ERROR      0
-#endif
-
-bool CC is_valid_name (const char * string)
-{
-    /* we do not allow leading - or empty names */
-    if ((*string == '\0') || (*string == '-'))
-        return false;
-    /* we do not allow ASCII control or ASCII space
-     * but we do not disallow punctuation.  Use at your own risk */
-    for ( ; *string != '\0'; ++string)
-        if (isspace (*string) || iscntrl (*string))
-            return false;
-    return true;
-}
-
-
-/* ==========
- * ParamValue
- *   the value for an option is a NUL terminated ASCII / UTF-8 string
- */
-typedef char ParamValue [1];
-
-/*
- * Make
- *   allocated memory for a ASCII/UTF-8 string including one extra for NUL
- *   the value passed in must be a NUL termintaed string as well
- */
-static
-rc_t CC ParamValueMake (ParamValue ** pself, const char * value, size_t value_size)
-{
-    size_t alloc_size;
-
-    assert (pself);
-    assert (value);
-    assert (value_size);
-
-    alloc_size = sizeof (ParamValue) + value_size;
-    *pself = malloc (alloc_size);
-
-    if (*pself == NULL)
-    {
-        fprintf (stderr, "Error allocating memory for option parameter %s\n",
-                 value);
-        return RC (rcRuntime, rcArgv, rcConstructing, rcMemory, rcExhausted);
-    }
-
-    string_copy (**pself, alloc_size, value, value_size);
-    return 0;
-}
-
-/*
- * Whack
- *   undo the Make.  That is free the memory
- */
-static
-void CC ParamValueWhack (void * self)
-{
-    assert (self); /* not an absolute requirement but if NULL we got programming error */
-
-    free (self);
-}
-
-static
-void CC ParamValueVectorWhack (void * self, void * ignored)
-{
-    assert (self);
-
-    ParamValueWhack(self);
-}
-
-
-/* ==========
- * Option
- *  this is the primary node ofr an option
- *  It contains the name of the long option that is also the key to pulling
- *  out values.  The storage of these nodes is in a BSTree.
- */
-typedef struct Option
-{
-    BSTNode     n;              /* BSTree node storage */
-
-    size_t      size;           /* name length (size if UTF-8) */
-    Vector      values;         /* Vector of set values */
-    uint32_t    count;          /* count of times option seen on the command line */
-    uint32_t    max_count;      /* if non-zero, how many times is it legal to be seen */
-    bool        needs_value;    /* does this option take/require a value? */
-    bool        required;       
-    bool        deprecated;     /* a warning if used */
-    bool        error;          /* an error if used */
-    char        name [1];       /* key value The 1 will be the NUL */
-} Option;
-
-static
-rc_t CC OptionMake (Option ** pself, const char * name, size_t size, uint32_t max_count, bool needs_value, bool required)
-{
-    Option *   self;
-    rc_t rc;
-
-    assert (pself);
-    assert (name);
-    assert ((needs_value == true)||(needs_value == false)); /* not really but lets be rigorous */
-    assert ((required == true)||(required == false)); /* not really but lets be rigorous */
-
-    self = malloc (sizeof (*self) + size);
-    if (self == NULL)
-    {
-        rc = RC (rcRuntime, rcArgv, rcConstructing, rcMemory, rcExhausted);
-        PLOGERR (klogErr, (klogErr, rc, "Error adding option '$(O)'","O=--%s",name));
-    }
-    else 
-    {
-        if ((self->needs_value = needs_value) != false)
-            VectorInit (&self->values,0,4);
-        else
-            memset (&self->values, sizeof(self->values), 0);
-
-        self->required = required;
-        self->deprecated = self->error = false;
-        self->count = 0;
-        self->max_count = max_count;
-        self->size = size;
-        string_copy (self->name, size+1, name, size);
-    }
-    *pself = self;
-    return 0;
-}
-
-static
-void CC OptionWhack (Option * self)
-{
-    assert (self);
-
-    if (self->needs_value)
-        VectorWhack (&self->values, ParamValueVectorWhack, NULL);
-
-    free (self);
-}
-
-static
-void CC OptionTreeWhack (BSTNode * node, void * ignored)
-{
-    OptionWhack ((Option*)node);
-}
-#ifdef OptionGetName_needed
-static
-const char * CC OptionGetName (const Option * self, size_t * size)
-{
-    assert (self);
-    if (size)
-        *size = self->size;
-    return self->name;
-}
-#endif
-/*
- * NeedsValue
- *  return bool, does this option require a value
- */
-static
-bool CC OptionNeedsValue (const Option * self)
-{
-    assert (self);
-
-    return self->needs_value;
-}
-
-/*
- * GetCount
- *  return the count of values seen so far.
- */
-static
-uint32_t CC OptionGetCount (const Option *self)
-{
-    assert (self);
-
-    return self->count;
-}
-
-/* 
- * GetValue
- *    returns the address of the Nth value (not a copy of the value)
- */
-static
-rc_t CC OptionGetValue (const Option * self, uint32_t number, const char ** value)
-{
-    /* SKH -- not sure why this was here. 
-       const char * pc; */
-    uint32_t count;
-
-    assert (self);
-    assert (value);
-
-    count = OptionGetCount(self);
-
-    *value = VectorGet (&self->values, number);
-    /* SKH -- this was checking pc, which is uninitialized */
-    if (*value == NULL)
-        return RC (rcRuntime, rcArgv, rcAccessing, rcIndex, rcExcessive);
-
-    return 0;
-}
-
-/*
- * add a value to this node.  If a value isn't needed this is just incrementing the count
- */
-static
-rc_t CC OptionAddValue (Option * self, const char * value, size_t size)
-{
-    ParamValue * pvalue;
-    rc_t rc = 0;
-
-    assert (self);
-
-    ++self->count;
-
-/*     KOutMsg ("%s: name %s count %u max_count %u value %s\n", __func__, self->name, self->count, self->max_count, value); */
-    if (self->max_count && (self->count > self->max_count))
-    {
-        --self->count;
-        rc = RC (rcRuntime, rcArgv, rcInserting, rcData, rcExcessive);
-        PLOGERR (klogErr,
-                 (klogErr, rc, "Too many occurrences of option '$(O)'",
-                  "O=--%s", self->name));
-    }
-    else if (self->needs_value)
-    {
-        assert (value);     /* gotta have a value */
-        assert (size);      /* value can't be a NUL string */
-
-        rc = ParamValueMake (&pvalue, value, size);
-        if (rc == 0)
-        {
-            /* NOTE: effectively going in as a char ** though we will 
-             * pull it out as a char* with the same value */
-            rc = VectorAppend (&self->values, NULL, pvalue);
-            if (rc)
-            {
-                PLOGERR (klogErr,
-                         (klogErr, rc, "error capturing parameter '$(O)'",
-                          "O=--%s", self->name));
-                ParamValueWhack (pvalue);
-            }
-            else
-            {
-                ARGS_DBG( "added option-value %s", self->name );
-            }
-        }
-    }
-    return rc;
-}
-
-static
-int CC OptionCmp (const void * item, const BSTNode * n)
-{
-    const char * name;
-    const Option * option;
-    size_t l;
-
-    assert (item);
-    assert (n);
-
-    name = item;
-    option = (Option*)n;
-    l = string_size (name);
-    return string_cmp (name, l, option->name, option->size, (uint32_t)(l + option->size) );
-}
-
-static
-int CC OptionSort (const BSTNode * item, const BSTNode * n)
-{
-    const Option * l = (Option*)item;
-    const Option * r = (Option*)n;
-    return string_cmp (l->name, l->size, r->name, r->size, (uint32_t)(l->size + r->size) );
-}
-
-/* ==========
- */
-typedef struct OptAlias
-{
-    BSTNode     n;              /* BSTree Node storage */
-
-    Option *   option;          /* full name node for which this is an alias */
-    size_t      size;
-    bool        deprecated;     /* warning if used */
-    bool        error;          /* error if used */
-    char        name[1];        /* utf8 name */
-} OptAlias;
-
-static
-rc_t CC OptAliasMake (OptAlias ** pself, const char * name, size_t size,
-                      Option * option)
-{
-    OptAlias * self;
-
-    assert (pself);
-    assert (name);
-    assert (size);
-
-    self = malloc (sizeof (*self) + size);
-    if (self == NULL)
-    {
-        rc_t rc = RC (rcRuntime, rcArgv, rcConstructing, rcMemory, rcExhausted);
-        PLOGERR (klogErr,
-                 (klogErr, rc, "Error creating structure for alias '$(A)' for parameter '$(B)", 
-                  "A=%s,B=%s", name, option->name));
-        *pself = NULL;
-        return rc;
-    }
-    self->option = option;
-    self->size = size;
-    self->deprecated = self->error = false;
-    string_copy (self->name, size + 1, name, size);
-    *pself = self;
-    return 0;
-}
-
-static
-void CC OptAliasWhack (const OptAlias * self)
-{
-    assert (self);
-    free ((void*)self);
-}
-
-static
-void CC OptAliasTreeWhack (BSTNode * node, void * ignored)
-{
-    assert (node); /* catch programming errors; freeing NULL wouldn't hurt */
-
-    OptAliasWhack ((OptAlias*)node);
-}
-
-#if 0
-static
-const char * CC OptAliasName (const OptAlias * self, size_t * size)
-{
-    assert (self);
-
-    if (size)
-        *size = self->size;
-    return self->name;
-}
-#endif
-static
-Option * CC OptAliasOption (const OptAlias *self)
-{
-    assert (self != NULL);
-
-    return self->option;
-}
-
-static
-int CC OptAliasCmp (const void * item, const BSTNode * n)
-{
-    const char * name;
-    const OptAlias * option;
-    size_t l;
-
-    assert (item);
-    assert (n);
-
-    name = item;
-    option = (OptAlias*)n;
-    l = string_size (name);
-    return string_cmp (name, l, option->name, option->size, (uint32_t)( l + option->size ) );
-}
-
-static
-int CC OptAliasSort (const BSTNode * item, const BSTNode * n)
-{
-    const OptAlias * l;
-    const OptAlias * r;
-
-    assert (item);
-    assert (n);
-
-    l = (OptAlias*)item;
-    r = (OptAlias*)n;
-    return string_cmp (l->name, l->size, r->name, r->size, (uint32_t)( l->size + r->size ) );
-}
-
-#if NOT_USED_YET
-static
-rc_t CC OptDefMakeCopy (OptDef ** pself, OptDef * original)
-{
-    OptDef * self;
-    size_t nsize;
-    size_t asize;
-    size_t hsize;
-
-    nsize = string_size (original->name);
-    asize = original->aliases ? string_size (original->aliases) : 0;
-    hsize = original->help ? string_size (original->help) : 0;
-
-    self = malloc (sizeof (*self) + nsize + 1 + asize + 1 + hsize + 1);
-    if (self == NULL)
-    {
-        rc_t rc;
-        /* assuming DebugMsg is stderr equivalent */
-        rc = RC (rcRuntime, rcArgv, rcConstructing, rcMemory, rcExhausted);
-        LOGERR (klogFatal, rc, "error creating help for option");
-        return rc;
-    }
-    self->name = (char*)(self+1);
-    string_copy (self->name, nsize + 1, original->name, nsize);
-    self->aliases = self->name + nsize + 1;
-    if (original->aliases)
-    {
-        string_copy (self->aliases, asize + 1, original->aliases, asize);
-    }
-    else
-        self->aliases[0] = '\0';
-    self->help = self->aliases + asize + 1;
-    if (original->help)
-    {
-        string_copy (self->help, hsize + 1, original->help, asize);
-    }
-    else
-        self->help[0] = '\0';
-    self->max_count = original->max_count;
-    self->needs_value = original->needs_value;
-    *pself = self;
-    return 0;
-}
-static
-void CC OptDefCopyVectorWhack (void * self, void * ignored)
-{
-    free (self);
-}
-
-#endif
-
-#if NOT_USED_YET
-
-typedef struct HelpGroup
-{
-    rc_t ( CC * header_fmt) (Args * args, const char * header);
-    Vector options;
-    const char header[1];
-} HelpGroup;
-
-
-static
-rc_t CC HelpGroupMake (HelpGroup ** pself, const char * name)
-{
-    HelpGroup * self;
-    size_t size;
-
-    size = string_size (name);
-    self = malloc (sizeof (*self) + size);
-    if (self == NULL)
-    {
-        fprintf (stderr, "Error allocating help group structure %s\n", name);
-        return RC (rcRuntime, rcArgv, rcConstructing, rcMemory, rcExhausted);
-    }
-    string_copy (self->name, size+1, name, size);
-    VectorInit (&self->optdefs, 0, 16);
-
-    *pself = self;
-    return 0;
-}
-
-
-static
-rc_t CC HelpGroupAddOptDef (HelpGroup * self, OptDef * option)
-{
-    OptDef * opt;
-    rc_t rc;
-
-    rc = OptDefCopy (&opt, option);
-    if (rc)
-        return rc;
-
-    rc = VectorAppend (&self->optdefs, NULL, opt);
-    if (rc)
-    {
-        fprintf (stderr, "Error appending option for help\n");
-        OptDefCopyVectorWhack (opt, NULL);
-        return rc;
-    }
-    return 0;
-}
-
-static
-void CC HelpGroupVectorWhack (void * item, void * ignored)
-{
-    HelpGroup * self = item;
-
-    assert (self);
-    VectorWhack (&self->optdefs, OptDefCopyVectorWhack, NULL);
-    free (self);
-}
-#endif
-
-/* ==========
- */
-struct Args
-{
-    BSTree names;
-    BSTree aliases;
-    Vector argv;
-    Vector params;
-    Vector help;
-#if NOT_USED_YET
-    HelpGroup * def_help;
-#endif
-#if HONOR_LEGACY_Q_ALIAS
-    bool   qalias_replaced;
-#endif
-};
-
-rc_t CC ArgsMake (Args ** pself)
-{
-    rc_t rc;
-    Args * self;
-
-    assert (pself);
-
-    self = malloc (sizeof (*self));
-    if (self == NULL)
-    {
-        rc = RC (rcRuntime, rcArgv, rcConstructing, rcMemory, rcExhausted);
-    }
-    else
-    {
-#if NOT_USED_YET
-        HelpGroup * help;
-#endif
-        BSTreeInit (&self->names);
-        BSTreeInit (&self->aliases);
-        VectorInit (&self->argv,0,8);
-        VectorInit (&self->params,0,8);
-        VectorInit (&self->help,0,16);
-#if HONOR_LEGACY_Q_ALIAS
-        self -> qalias_replaced = false;
-#endif
-#if NOT_USED_YET
-        rc = HelpGroupMake (&help, "NCBI Options");
-        if (rc)
-        {
-            ArgsWhack (self);
-        }
-        else
-        {
-            self->def_help = help;
-            rc = VectorAppend (&self->help, NULL, help);
-        }
-#else
-        rc = 0;
-#endif
-    }
-    *pself = (rc == 0) ? self : NULL;
-    return rc;
-}
-
-rc_t CC ArgsWhack (Args * self)
-{
-    if (self)
-    {
-        BSTreeWhack (&self->names, OptionTreeWhack, NULL);
-        BSTreeWhack (&self->aliases, OptAliasTreeWhack, NULL);
-        VectorWhack (&self->argv, ParamValueVectorWhack, NULL);
-        VectorWhack (&self->params, NULL, NULL);
-#if NOT_USED_YET
-        VectorWhack (&self->help, HelpGroupVectorWhack, NULL);
-#endif
-        free (self);
-    }
-    return 0;
-}
-
-static
-rc_t CC ArgsAddOption (Args * self, const OptDef * option)
-{
-    rc_t rc = 0;
-    Option * node;
-    Option * prev;
-    const char * name;
-    size_t size; /* will be used for the help tree side */
-
-    if (self == NULL)
-    {
-        rc = RC (rcRuntime, rcArgv, rcConstructing, rcSelf, rcNull);
-        LOGERR (klogInt, rc, "Error adding an opion with no object");
-        return rc;
-    }
-    if (option == NULL)
-    {
-        rc = RC (rcRuntime, rcArgv, rcConstructing, rcParam, rcNull);
-        LOGERR (klogInt, rc, "Error adding an option with no option name");
-        return rc;
-    }
-    name = option->name;
-    if (! is_valid_name (name))
-    {
-        rc = RC (rcRuntime, rcArgv, rcConstructing, rcName, rcInvalid);
-        PLOGERR (klogInt, (klogInt, rc, "Error using illegal option name '$(O)'", "O=--%s", name));
-        return rc;
-    }
-    size = string_size (name);
-    rc = OptionMake (&node, name, size, option->max_count, option->needs_value, option->required);
-    if (rc)
-        return rc;
-    size ++;
-
-    prev = NULL;
-    rc = BSTreeInsertUnique (&self->names, &node->n, (BSTNode**)&prev, OptionSort);
-    if (rc)
-    {
-        if (GetRCState(rc) == rcBusy)
-        {
-            rc = RC (rcRuntime, rcArgv, rcConstructing, rcName, rcBusy);
-            PLOGERR (klogInt,
-                     (klogInt, rc, "duplicate option name '$(O)'", "O=--%s", name));
-        }
-        else
-            PLOGERR (klogInt,
-                     (klogInt, rc, "unknown error inserting option name '$(O)'", "O=--%s", name));
-
-        OptionWhack (node);
-        return rc;
-    }
-    if (option->aliases)     /* any single character aliases? */
-    {
-        const char * startc;
-        const char * endc;
-        int incr;
-
-        for ((startc = option->aliases),(endc = startc + string_size (startc));
-             startc < endc; startc += incr)
-        {
-            OptAlias * snode;
-            OptAlias * sprev;
-            uint32_t c;
-            char alias_name [8]; /* 4 should be enough + 1 for NUL */
-
-            incr = utf8_utf32 (&c, startc, endc);
-            if (incr < 0)
-            {
-                rc = RC (rcRuntime, rcArgv, rcConstructing, rcName, rcCorrupt);
-                PLOGERR (klogInt,
-                         (klogInt, rc, "Error parsing alias string '$(A)' from '$(B)' for '$(C)'",
-                          "A=%s,B=%s,C=%s", startc, option->aliases, name));
-                break;
-            }
-            if (incr > 4)
-            {
-                rc = RC (rcRuntime, rcArgv, rcConstructing, rcName, rcCorrupt);
-                PLOGERR (klogInt,
-                         (klogInt, rc,"Error parsing UTF-8 string '$(S)'",
-                          "S=%s", startc));
-                break;
-            }
-            size = string_copy (alias_name, sizeof (alias_name), startc, incr);
-            if (! is_valid_name (alias_name))
-            {
-                rc = RC (rcRuntime, rcArgv, rcConstructing, rcName, rcInvalid);
-                PLOGERR (klogInt,
-                         (klogInt, rc, "Error using invalid alias name '$(S)'",
-                          "S=%s", alias_name));
-                break;
-            }
-#if 0
-            size += incr + 1;
-#endif
-            rc = OptAliasMake (&snode, alias_name, incr, node);
-            if (rc)
-                break;
-            rc = BSTreeInsertUnique (&self->aliases, &snode->n, (BSTNode**)&sprev, OptAliasSort);
-            if (rc)
-            {
-                if (GetRCState(rc) == rcExists)
-                {
-#if HONOR_LEGACY_Q_ALIAS
-                    if ( ! self -> qalias_replaced && size == 1 && alias_name [ 0 ] == 'q' )
-                    {
-                        BSTreeUnlink ( & self -> aliases, & sprev -> n );
-                        rc = BSTreeInsertUnique ( & self -> aliases, & snode -> n, NULL, OptAliasSort );
-                        if ( rc != 0 )
-                            BSTreeInsert ( & self -> aliases, & sprev -> n, OptAliasSort );
-                        else
-                        {
-                            OptAliasWhack ( sprev );
-                            self -> qalias_replaced = true;
-#if LEGACY_Q_ALIAS_DEPRECATED
-                            snode -> deprecated = true;
-#elif LEGACY_Q_ALIAS_ERROR
-                            snode -> error = true;
-#endif
-                            continue;
-                        }
-                    }
-#endif
-                    rc = RC (rcRuntime, rcArgv, rcConstructing, rcName, rcExists);
-                    PLOGERR (klogInt,
-                             (klogInt, rc, "duplicate alias name '$(S)'",
-                              "S=%s", alias_name));
-                }
-                else
-                {
-                    PLOGERR (klogErr,
-                             (klogErr, rc, "unknown error inserting alias '$(S)'",
-                              "S=%s", alias_name));
-                }
-
-                OptAliasWhack (snode);
-                break;
-            }
-        }
-    }
-    return rc;
-}
-
-rc_t CC ArgsAddOptionArray (Args * self, const OptDef * option, uint32_t count /*, 
-                                                                                             rc_t (*header_fmt)(Args * args, const char * header),
-                                                                                             const char * header */)
-{
-    rc_t rc;
-#if NOT_USED_YET
-    HelpGroup * hg;
-
-    rc = HelpGroupMake (&hg, header, header_fmt, option, count);
-    if (rc == 0)
-    {
-
-        rc = VectorAppend (&self->help, NULL, hg);
-        if (rc == 0)
-        {
-
-            /* count might be zero for help only sections */
-            for (rc = 0; count > 0; --count, ++option)
-            {
-                rc = ArgsAddOption (self, option);
-                if (rc)
-                    break;
-            }
-            if (rc == 0)
-                return 0;
-        }
-        else
-            HelpGroupVectorWhack (hg, NULL);
-    }
-#else
-    for (rc = 0; (rc == 0) && (count > 0); --count, ++option)
-    {
-        rc = ArgsAddOption (self, option);
-    }
-#endif
-    return rc;
-}
-
-/*
- */
-rc_t CC next_arg (const Args * self, int * pix, int max, const char ** pvalue)
-{
-    int ix;
-
-    if (*pix >= max)
-        return RC (rcApp, rcArgv, rcAccessing, rcString, rcNotFound);
-
-    ix = *pix;
-    ix++;
-    *pvalue = (const char *) VectorGet (&self->argv, ix);
-    *pix = ix;
-    return 0;
-}
-
-typedef struct ArgsReqCheckData
-{
-    Option * missing_option;
-    rc_t rc;
-} ArgsReqCheckData;
-
-static
-void CC ArgsCheckRequiredInt (BSTNode * n, void * _data)
-{
-#if 1
-    ArgsReqCheckData * data;
-    Option * opt;
-    rc_t rc;
-
-    data = _data;
-    opt = (Option*)n;
-    if (opt->required && ! opt->count)
-    {
-        rc = RC( rcRuntime, rcArgv, rcParsing, rcParam, rcNotFound );
-        PLOGERR (klogWarn, (klogWarn, rc, "Error missing required parameter '$(P)'",
-                            "P=%s", opt->name));
-        if (data->missing_option == NULL)
-        {
-            data->missing_option = opt;
-            data->rc = rc;
-        }
-    }
-#endif
-}
-
-/* check for required parameters */
-rc_t CC ArgsCheckRequired (Args * self)
-{
-    ArgsReqCheckData r = { NULL, false };
-
-    BSTreeForEach ( &self->names, false, ArgsCheckRequiredInt, &r );
-
-    return r.rc;
-}
-
-static
-rc_t ArgsParseInt (Args * self, int argc, char *argv[])
-{
-    rc_t rc = 0;        /* hard fail - quit processing */
-    rc_t orc = 0;       /* soft fail - keep processing but we'll fail in the end */
-    rc_t qrc = 0;       /* transient - if set will move to a previously unset orc */
-    int ix, ix_from, ix_to;
-    size_t jx;
-    Option * node;
-    const char * parg;
-    char * equal_sign;
-    ParamValue * arg;
-    char name [32];
-    const char * value = NULL;
-    size_t value_len;
-    bool needs_value;
-    uint32_t n_in_argv_before;
-
-    n_in_argv_before = VectorLength( &self->argv );
-
-    /* first capture original argument list and store in our format */
-    for ( ix = 0; ix < argc; ++ix )
-    {
-        size_t len;
-
-        parg = argv[ix];
-        len = strlen ( parg );
-
-        rc = ParamValueMake ( &arg, parg, len );
-        if ( rc == 0 )
-            rc = VectorAppend ( &self->argv, NULL, arg );
-        if ( rc )
-            break;
-        else
-            ARGS_DBG( "ArgsParse: inserted '%s' into self->argv", parg );
-    }
-    
-    if ( rc )
-        return rc;
-
-    if ( n_in_argv_before == 0 )
-    {
-        ix_from = 1;
-        ix_to = argc;
-    }
-    else
-    {
-        ix_from = n_in_argv_before;
-        ix_to = n_in_argv_before + argc;
-    }
-
-    for ( ix = ix_from; ix < ix_to; ++ix )
-    {
-        parg = ( const char * )VectorGet( &self->argv, ix );
-
-        ARGS_DBG( "ArgsParse: parsing '%s' from self->argv", parg );
-
-        if ( parg[ 0 ] != '-' )
-        {
-            /* we can do this because it is already a (const char *)
-             * and (ParamValue *) after the first loop */
-            rc = VectorAppend ( &self->params, NULL, parg );
-            if ( rc )
-                break;
-            ARGS_DBG( "ArgsParse: appending to params '%s'", parg );
-        }
-        else
-        {
-            node = NULL;
-            if ( parg[ 1 ] == '-' )
-            {
-                size_t nlen = string_copy( name, sizeof( name ), parg + 2, string_size( parg + 2 ) );
-                ARGS_DBG( "ArgsParse: '%s' is a '--' parameter!", parg );
-                equal_sign = string_chr( name, nlen, '=' );
-                if ( equal_sign )
-                    *equal_sign = '\0';
-
-                node = ( Option* )BSTreeFind( &self->names, name, OptionCmp );
-                if ( node == NULL )
-                {
-                    qrc = RC( rcApp, rcArgv, rcParsing, rcParam, rcUnknown );
-                    PLOGERR (klogErr,
-                             (klogErr, qrc,
-                              "Unknown argument '$(O)'", "O=--%s", name ));
-/*                     break; */
-                    if (orc == 0) /* non-fatal */
-                        orc = qrc;
-                }
-                else
-                {
-                    needs_value = OptionNeedsValue( node );
-                    ARGS_DBG( "ArgsParse: found node for parameter '%s'", parg );
-                    if ( needs_value )
-                    {
-                        ARGS_DBG( "ArgsParse: parameter '%s' needs value", parg );
-                        if ( equal_sign != NULL )
-                            value = parg + 2 + ( ( equal_sign + 1 ) - name );
-
-                        else if ( ix + 1 >= ix_to )
-                        {
-                            rc = RC( rcRuntime, rcArgv, rcParsing, rcParam, rcExhausted );
-                            PLOGERR (klogErr,
-                                     (klogErr, qrc,"Option '$(O)' is missing a value", "O=--%s", node->name ));
-                        }
-                        else
-                        {
-                            ARGS_DBG( "ArgsParse: calling next_arg()", 0 );
-                            rc = next_arg( self, &ix, ix_to, &value );
-                        }
-
-                        if ( rc == 0 )
-                        {
-                            assert ( value != NULL );
-
-                            value_len = string_size( value );
-
-                            rc = OptionAddValue( node, value, value_len );
-                        }
-                    }
-                    else
-                    {
-                        rc = OptionAddValue( node, NULL, 0 );
-                    }
-
-                    if ( rc != 0 )
-                        break;
-
-                    if ( node -> error )
-                    {
-                        rc = RC ( rcApp, rcArgv, rcParsing, rcParam, rcUnsupported );
-                        PLOGERR (klogErr,
-                                 (klogErr, rc,
-                                  "Deprecated argument '$(O)' is no longer supported.", "O=--%s", name ));
-                        break;
-                    }
-
-                    if ( node -> deprecated )
-                    {
-                        PLOGMSG (klogWarn,
-                                 (klogWarn,
-                                  "Deprecated argument '$(O)' may not be supported in future releases.", "O=--%s", name ));
-                    }
-                }
-            }
-            else
-            {
-                const char * end;
-                uint32_t name_len;
-
-                end = parg + string_size( parg );
-                ARGS_DBG( "ArgsParse: '%s' is a '-' parameter!", parg );
-                for ( jx = 1; parg[ jx ]; jx += name_len )
-                {
-                    OptAlias *alias;
-                    uint32_t c;
-
-                    name_len = utf8_utf32( &c, parg + jx, end ); 
-                    string_copy( name, sizeof( name ), parg + jx, name_len );
-
-                    alias = ( OptAlias* )BSTreeFind( &self->aliases, name, OptAliasCmp );
-                    if ( alias == NULL )
-                    {
-                        qrc = RC( rcApp, rcArgv, rcParsing, rcParam, rcUnknown );
-                        PLOGERR (klogErr,
-                                 (klogErr, qrc,
-                                  "Unknown argument '$(O)'", "O=-%s", name ));
-
-                        if (orc == 0)
-                            orc = qrc;
-                    }
-                    else
-                    {
-                        bool break_loop = false;
-                        node = OptAliasOption( alias );
-                        if ( OptionNeedsValue( node ) )
-                        {
-                            if ( parg[ jx + name_len ] == '=' )
-                            {
-                                ++jx;
-                                if ( parg[ jx + name_len ] )
-                                    value = parg + jx + name_len;
-                                else
-                                {
-                                    qrc = RC( rcRuntime, rcArgv, rcParsing, rcParam, rcExhausted );
-                                    LOGERR (klogErr, qrc,
-                                            "Value missing with alias followed by =" );
-                                    if (orc == 0)
-                                        orc = qrc;
-                                    break_loop = true;
-                                }
-                            }
-                            else if ( parg[ jx + name_len ] )
-                            {
-                                value = parg + jx + name_len;
-                            }
-                            else if ( ix + 1 >= ix_to )
-                            {
-                                rc = RC( rcRuntime, rcArgv, rcParsing, rcParam, rcExhausted );
-                                PLOGERR (klogErr,
-                                         (klogErr, rc,
-                                          "Option '$(O)' ( alias for '$(N)' ) is missing a value",
-                                          "O=-%s,N=--%s", name, node->name ));
-                                break;
-                            }
-                            else
-                            {
-                                value = ( const char * )VectorGet( &self->argv, ++ix );
-                            }
-                            ARGS_DBG( "ArgsParse: the value of '%s' is '%s'", name, value );
-
-                            if ( rc == 0 )
-                                rc = OptionAddValue( node, value, string_size( value ) );
-                            break_loop = true;
-                        }
-                        else
-                        {
-                            rc = OptionAddValue( node, NULL, 0 );
-                        }
-
-                        if ( rc != 0 )
-                            break;
-
-                        if ( node -> error )
-                        {
-                            rc = RC ( rcApp, rcArgv, rcParsing, rcParam, rcUnsupported );
-                            PLOGERR (klogErr,
-                                     (klogErr, rc,
-                                      "Deprecated argument '$(O)' ( alias for '$(N)' ) is no longer supported.",
-                                      "O=-%s,N=--%s"
-                                      , name
-                                      , node->name
-                                         ));
-                            break;
-                        }
-
-                        if ( alias -> error )
-                        {
-                            rc = RC ( rcApp, rcArgv, rcParsing, rcParam, rcUnsupported );
-                            PLOGERR (klogErr,
-                                     (klogErr, rc,
-                                      "Deprecated argument '$(O)' is no longer supported. "
-                                      "Please use '$(N)' instead.",
-                                      "O=-%s,N=--%s"
-                                      , name
-                                      , node->name
-                                         ));
-                            break;
-                        }
-
-                        if ( node -> error )
-                        {
-                            PLOGMSG (klogWarn,
-                                     (klogWarn,
-                                      "Deprecated argument '$(O)' ( alias for '$(N)' ) may not be supported in future releases.",
-                                      "O=-%s,N=--%s"
-                                      , name
-                                      , node->name
-                                         ));
-                        }
-
-                        else if ( alias -> deprecated )
-                        {
-                            PLOGMSG (klogWarn,
-                                     (klogWarn,
-                                      "Deprecated argument '$(O)' may not be supported in future releases. "
-                                      "Please use '$(N)' instead.",
-                                      "O=-%s,N=--%s"
-                                      , name
-                                      , node->name
-                                         ));
-                        }
-
-                        if ( break_loop )
-                            break;
-                    }
-                }
-            }
-        }
-        if ( rc )
-            break;
-    }
-
-#if _DEBUGGING
-    (void)ArgsHandleDebug (self);
-#endif
-#if USE_EARLY_HELP
-    if (rc == 0)
-    {
-        rc = ArgsHandleHelp (self);
-        /* if "help" wasn't found we aren't using standard arguments so don't
-         * call it an error: if OptionGout changes this might have to as well */
-        if (rc == SILENT_RC (rcRuntime, rcArgv, rcAccessing, rcName, rcNotFound))
-            rc = 0;
-    }
-#endif
-#if USE_EARLY_VERSION
-    if (rc == 0)
-    {
-        rc = ArgsHandleVersion (self);
-        if (rc == SILENT_RC (rcRuntime, rcArgv, rcAccessing, rcName, rcNotFound))
-            rc = 0;
-    }
-#endif
-    /* now recovery non-fatal errors into final rc */
-    if (rc == 0)
-        rc = orc;
-
-    if ( rc )
-    {
-        ReportSilence();
-    }
-    return rc;
-}
-
-rc_t CC ArgsParse (Args * self, int argc, char *argv[])
-{
-    KLogLevel lvl = KLogLevelGet ();
-    rc_t rc = KLogLevelSet ( klogWarn );
-    rc = ArgsParseInt ( self, argc, argv );
-    KLogLevelSet ( lvl );
-    return rc;
-}
-
-rc_t CC ArgsOptionCount (const Args * self, const char * option_name, uint32_t * count)
-{
-    rc_t rc;
-
-    if (self == NULL)
-        return RC (rcRuntime, rcArgv, rcAccessing, rcSelf, rcNull);
-    else if (count == NULL)
-        return RC (rcRuntime, rcArgv, rcAccessing, rcParam, rcNull);
-    else
-    {
-        const Option * node;
-
-        node = (const Option*)BSTreeFind (&self->names, option_name, OptionCmp);
-        if (node == NULL)
-        {
-            rc = RC (rcRuntime, rcArgv, rcAccessing, rcName, rcNotFound);
-/* this was removed to shut up about "help" not being found during tests
-            PLOGERR (klogWarn, (klogWarn, rc, "Option name not found '$(S)'", "S=%s", option_name));
- */
-            return rc;
-        }
-
-        *count = OptionGetCount (node);
-        return 0;
-    }
-}
-
-rc_t CC ArgsOptionValue (const Args * self, const char * option_name, uint32_t iteration,
-                                     const char ** value_string)
-{
-    const Option * node;
-
-    if (self == NULL)
-        return RC (rcRuntime, rcArgv, rcAccessing, rcSelf, rcNull);
-
-    if ((option_name == NULL) || (value_string == NULL))
-        return RC (rcRuntime, rcArgv, rcAccessing, rcParam, rcNull);
-
-    *value_string = NULL;
-
-    node = (const Option*)BSTreeFind (&self->names, option_name, OptionCmp);
-    if (node == NULL)
-        return RC (rcRuntime, rcArgv, rcAccessing, rcName, rcNotFound);
-    else
-        return  OptionGetValue (node, iteration, value_string);
-}
-
-rc_t CC ArgsParamCount (const Args * self, uint32_t * count)
-{
-    if (self == NULL)
-        return RC (rcRuntime, rcArgv, rcAccessing, rcSelf, rcNull);
-    else if (count == NULL)
-        return RC (rcRuntime, rcArgv, rcAccessing, rcParam, rcNull);
-
-    *count = VectorLength (&self->params);
-    return 0;
-}
-
-rc_t CC ArgsParamValue (const Args * self, uint32_t iteration, const char ** value_string)
-{
-    if (self == NULL)
-        return RC (rcRuntime, rcArgv, rcAccessing, rcSelf, rcNull);
-
-    if (value_string == NULL)
-        return RC (rcRuntime, rcArgv, rcAccessing, rcParam, rcNull);
-
-    if (iteration >= VectorLength (&self->params))
-    {
-        *value_string = NULL;
-        return RC (rcRuntime, rcArgv, rcAccessing, rcParam, rcExcessive);
-    }
-
-    *value_string = (const char*) VectorGet (&self->params, iteration);
-    return 0;
-}
-
-rc_t CC ArgsArgvCount (const Args * self, uint32_t * count)
-{
-    if (self == NULL)
-        return RC (rcRuntime, rcArgv, rcAccessing, rcSelf, rcNull);
-    else if (count == NULL)
-        return RC (rcRuntime, rcArgv, rcAccessing, rcArgv, rcNull);
-
-    *count = VectorLength (&self->argv);
-    return 0;
-}
-#ifdef ArgsArgc
-#undef ArgsArgc
-#endif
-
-rc_t CC ArgsArgc (const Args * self, uint32_t * count)
-{
-    return ArgsArgvCount (self, count);
-}
-
-rc_t CC ArgsArgvValue (const Args * self, uint32_t iteration, const char ** value_string)
-{
-    if (self == NULL)
-        return RC (rcRuntime, rcArgv, rcAccessing, rcSelf, rcNull);
-
-    if (value_string == NULL)
-        return RC (rcRuntime, rcArgv, rcAccessing, rcArgv, rcNull);
-
-    if (iteration >= VectorLength (&self->argv))
-    {
-        *value_string = NULL;
-        return RC (rcRuntime, rcArgv, rcAccessing, rcArgv, rcExcessive);
-    }
-
-    *value_string = (const char*) VectorGet (&self->argv, iteration);
-    return 0;
-}
-
-#define USAGE_MAX_SIZE 81
-static
-const char * verbose_usage[] = 
-{ "Increase the verbosity of the program status messages.",
-  "Use multiple times for more verbosity.","Negates quiet.", NULL };
-static
-const char * quiet_usage[] = 
-{ "Turn off all status messages for the program.",
-  "Negated by verbose.", NULL };
-static
-const char * debug_usage[] = 
-{ "Turn on debug output for module.",
-  "All flags if not specified.", NULL };
-static
-const char * help_usage[] = 
-{ "Output a brief explanation for the program.", NULL };
-static
-const char * report_usage[] = 
-{ "Control program execution environment report generation (if implemented).",
-    "One of (never|error|always). Default is error", NULL };
-static
-const char * version_usage[] = 
-{ "Display the version of the program then quit.", NULL };
-static
-const char * optfile_usage[] = 
-{ "Read more options and parameters from the file.", NULL};
-static 
-char log0 [USAGE_MAX_SIZE];
-static 
-char log1 [USAGE_MAX_SIZE];
-static
-const char * log_usage[] = 
-{ "Logging level as number or enum string.", log0, log1, NULL };
-static
-const char * no_user_settings_usage[] = 
-{ "Turn off user-specific configuration.", NULL };
-
-static
-void CC gen_log_usage (const char ** _buffers)
-{
-    static const char div[] = "|";
-
-    /* these have to be mutable for this to work */
-    char ** buffers = (char **) _buffers;
-
-    char * pc;
-    char * p0;
-    char * p1;
-    size_t rem;
-    size_t used;
-    KLogLevel level;
-
-    rc_t rc;
-    char buffv[USAGE_MAX_SIZE];
-
-
-    p0 = pc = buffers[1];
-    p1 = pc = buffers[2];
-
-    *p0 = *p1 = '\0';
-
-    rem = USAGE_MAX_SIZE; /* makes an assumption */
-    pc = buffv;
-    for (level = klogLevelMin; level <= klogLevelMax; ++level)
-    {
-        rc = KLogLevelExplain (level, pc, rem, &used);
-        if (rc || used == 0)
-        {
-            p0 = NULL;
-            pc = NULL;
-            break;
-        }
-        pc += used;
-        rem -= used;
-        strcpy (pc, div);
-        pc += sizeof div - 1;
-        rem -= sizeof div - 1;
-    }
-    if (p0)
-    {
-        pc -= sizeof div - 1;
-        rem += sizeof div - 1;
-        *pc = '\0';
-        
-        rc = string_printf (p0, USAGE_MAX_SIZE, & used,
-                            "One of (%s) or (%u-%u)",
-                            buffv, klogLevelMin, klogLevelMax);
-        if (used == 0)
-            p0 = NULL;
-    }
-    rc = KLogLevelExplain (KLogLevelGet(), buffv, sizeof buffv, &used);
-    if (rc || used == 0)
-        p1 = NULL;
-    else
-    {
-        buffv[used] = '\0';
-        rc = string_printf (p1, USAGE_MAX_SIZE, & used,
-                         "Current/default is %s",
-                         buffv);
-        if (used == 0)
-            p1 = NULL;
-    }
-    if (p0 == NULL)
-    {
-        p0 = p1;
-        p1 = NULL;
-    }
-}
-
-
-
-OptDef StandardOptions[]  =
-{
-    {
-        OPTION_HELP,    ALIAS_HELP,    NULL, 
-        help_usage,
-        OPT_UNLIM, false, false
-    },
-    {
-        OPTION_VERSION, ALIAS_VERSION, NULL,
-        version_usage,
-        OPT_UNLIM, false, false
-    },
-    {
-        OPTION_LOG_LEVEL, ALIAS_LOG_LEVEL, gen_log_usage,
-        log_usage,
-        OPT_UNLIM, true, false
-    },
-    {
-        OPTION_VERBOSE, ALIAS_VERBOSE, NULL,
-        verbose_usage,
-        OPT_UNLIM, false, false
-    },
-    {
-        OPTION_QUIET, ALIAS_QUIET, NULL,
-        quiet_usage,
-        OPT_UNLIM, false, false
-    },
-#if USE_OPTFILE
-    {
-        OPTION_OPTFILE, ALIAS_OPTFILE, NULL,
-        optfile_usage,
-        OPT_UNLIM, true, false
-    },
-#endif
-    {
-        OPTION_DEBUG, ALIAS_DEBUG, NULL,
-        debug_usage, 
-        OPT_UNLIM, true, false
-    },
-    {
-        OPTION_NO_USER_SETTINGS, NULL, NULL,
-        no_user_settings_usage,
-        OPT_UNLIM, false, false
-    },
-    {   /* OPTION_REPORT is used in klib/report.c */
-        OPTION_REPORT, NULL, NULL,
-        report_usage, 
-        OPT_UNLIM, true, false
-    }
-};
-
-rc_t CC ArgsAddStandardOptions(Args * self)
-{
-    return ArgsAddOptionArray (self, StandardOptions,
-                               sizeof (StandardOptions) / sizeof (OptDef)
-                               /*, NULL, NULL */ );
-}
-
-rc_t CC ArgsMakeStandardOptions (Args** pself)
-{
-    Args * self;
-    rc_t rc;
-
-    rc = ArgsMake (&self);
-    if (rc == 0)
-    {
-        rc = ArgsAddStandardOptions (self);
-        if (rc)
-            ArgsWhack (self);
-    }
-    *pself = (rc == 0) ? self : NULL;
-    return rc;
-}
-
-rc_t CC ArgsHandleHelp (Args * self)
-{
-    uint32_t count;
-    rc_t rc;
-
-    rc = ArgsOptionCount (self, OPTION_HELP, &count);
-    if (rc == 0)
-    {
-        if (count)
-        {
-            /* this is a call into the main program code */
-            Usage(self);
-            ArgsWhack (self);
-            exit (0);
-        }
-    }
-    return rc;
-}
-
-
-rc_t CC ArgsHandleVersion (Args * self)
-{
-    uint32_t count;
-    rc_t rc;
-
-    rc = ArgsOptionCount (self, OPTION_VERSION, &count);
-    if (rc == 0)
-    {
-        if (count)
-        {
-            const char * progname = UsageDefaultName;
-            const char * fullpath = UsageDefaultName;
-
-            if (self)
-                rc = ArgsProgram (self, &fullpath, &progname);
-
-            HelpVersion (fullpath, KAppVersion());
-
-            ArgsWhack (self);
-            exit (0);
-        }
-    }
-    return rc;
-}
-
-
-rc_t CC ArgsHandleLogLevel (const Args * self)
-{
-    uint32_t count;
-    rc_t rc;
-
-    rc = ArgsOptionCount (self, OPTION_LOG_LEVEL, &count);
-    if (rc == 0)
-    {
-        if (count == 0)
-        {
-        }
-        else
-        {
-            const char * value;
-            uint32_t ix;
-
-            for (ix = 0; ix < count; ++ix)
-            {
-                rc = ArgsOptionValue (self, OPTION_LOG_LEVEL,
-                                      ix, &value);
-                if (rc == 0)
-                    rc = LogLevelSet (value);
-                if (rc)
-                    break;
-            }
-        }
-    }
-    return rc;
-}
-
-rc_t CC ArgsHandleStatusLevel (const Args * self)
-{
-    uint32_t vcount, qcount;
-    rc_t rc;
-
-    rc = ArgsOptionCount (self, OPTION_VERBOSE, &vcount);
-    if (rc == 0)
-    {
-        rc = ArgsOptionCount (self, OPTION_QUIET, &qcount);
-        if (rc == 0)
-        {
-            KStsLevel current;
-
-            current = KStsLevelGet();
-
-            if (vcount)
-            {
-                rc_t irc;
-
-                irc = SILENT_RC (rcRuntime, rcArgv, rcParsing, rcParam, rcIncorrect);
-                if (qcount)
-                {
-                    PLOGERR (klogErr,
-                             (klogErr, irc,
-                              "$(V)($(v)) and $(Q)($(q)) should not be used together",
-                              "V=%s,v=%s,Q=$s,q=%s",
-                              OPTION_VERBOSE,ALIAS_VERBOSE,
-                              OPTION_QUIET,ALIAS_QUIET));
-                }
-                KStsLevelSet (current + vcount);
-            }
-            else if (qcount)
-                KStsLevelSet (0);
-        }
-    }
-    return rc;
-}
-
-rc_t CC ArgsHandleNoUserSettings (const Args * self)
-{
-    uint32_t count = 0;
-    rc_t rc = ArgsOptionCount (self, OPTION_NO_USER_SETTINGS, &count);
-    if (rc == 0 && count != 0)
-        KConfigDisableUserSettings ();
-    return rc;
-}
-
-
-#if USE_OPTFILE
-rc_t CC ArgsHandleOptfile (Args * self)
-{
-    return Args_parse_inf_file (self, OPTION_OPTFILE);
-}
-#endif
-
-
-#if _DEBUGGING
-rc_t CC ArgsHandleDebug (const Args * self)
-{
-    uint32_t count;
-    rc_t rc;
-
-    rc = ArgsOptionCount (self, OPTION_DEBUG, &count);
-    if (rc == 0)
-    {
-        if (count == 0)
-        {
-        }
-        else
-        {
-            const char * value;
-            uint32_t ix;
-
-            for (ix = 0; ix < count; ++ix)
-            {
-                rc = ArgsOptionValue (self, OPTION_DEBUG,
-                                      ix, &value);
-                if (rc == 0)
-                    rc = KDbgSetString (value);
-                if (rc)
-                    break;
-            }
-        }
-    }
-    return rc;
-}
-#endif
-
-rc_t CC ArgsHandleStandardOptions (Args * self)
-{
-    rc_t rc;
-
-    do
-    {
-        rc = ArgsHandleHelp (self);
-        if (rc)
-            break;
-        rc = ArgsHandleVersion (self);
-        if (rc)
-            break;
-        rc = ArgsHandleLogLevel (self);
-        if (rc)
-            break;
-
-        rc = ArgsHandleStatusLevel (self);
-        if (rc)
-            break;
-
-        rc = ArgsHandleNoUserSettings (self);
-        if (rc)
-            break;
-
-#if _DEBUGGING 
-	/* called a second time in case more symbols in in files */
-        rc = ArgsHandleDebug (self);
-#endif
-    } while (0); /* not a real loop */
-    return rc;
-}
-
-rc_t CC ArgsMakeAndHandle (Args ** pself, int argc, char ** argv, uint32_t table_count, ...)
-{
-    rc_t rc;
-    Args * self;
-
-    *pself = NULL;
-    rc = ArgsMakeStandardOptions (&self);
-    if (rc == 0)
-    {
-        for (;;)
-        {
-            /* load added OptDef tables */
-            if (table_count)
-            {
-                va_list ap;
-
-                va_start (ap, table_count);
-
-                while (table_count--)
-                {
-                    OptDef * options;
-                    uint32_t opt_count;
-
-                    options = va_arg (ap, OptDef *);
-                    opt_count = va_arg (ap, uint32_t);
-
-                    rc = ArgsAddOptionArray (self, options, opt_count /* , NULL, NULL */);
-                    if (rc)
-                        break;
-                }
-
-                va_end (ap);
-
-                if (rc)
-                    break;
-            }
-
-            rc = ArgsParse (self, argc, argv);
-            if (rc)
-                break;
-
-#if USE_OPTFILE
-            /*
-             * recursively check for files full of options
-             * we want this done before flagging missing arguments
-             */
-            rc = ArgsHandleOptfile (self);
-            if (rc)
-                break;
-#endif
-            /*
-             * now handle (maybe even rehandle except the optfile
-             * the standard arguments all applications/tools support
-             */
-            rc = ArgsHandleStandardOptions (self);
-            if (rc)
-                break;
-
-            rc = ArgsCheckRequired (self);
-            if (rc)
-            {
-                MiniUsage(self);
-                break;
-            }
-
-            *pself = self;
-            return 0;
-
-            break;
-        }
-    
-        ArgsWhack (self);
-    }
-    return rc;
-}
-
-
-
-
-/* NOTE:
- * This needs to move into a unix/win32 seperated file
- * and quite probably outside of args.
- */
-
-const char * CC trim_path (const char * full_name)
-{
-    const char * name;
-
-    name = strrchr (full_name, '/');
-    if (name == NULL)
-        name = full_name;
-    else
-        ++name; /* skip past '/' */
-    return name;
-}
-
-
-rc_t CC ArgsProgram (const Args * args, const char ** fullpath, const char ** progname)
-{
-    const char * defaultname = UsageDefaultName;
-    const char * f;
-    rc_t rc;
-
-    rc = ArgsArgvValue (args, 0, &f);
-    if (rc == 0)
-    {
-        if (fullpath)
-            *fullpath = f;
-        if (progname)
-            *progname = trim_path (f);
-    }
-    else
-    {
-        f = defaultname;
-        
-        if (fullpath != NULL)
-        {
-            if (*fullpath == NULL)
-                *fullpath = f;
-            else
-                f = *fullpath;
-        }
-        if (progname)
-        {
-            if (*progname == NULL)
-                *progname = trim_path (f);
-        }
-    }
-    return rc;
-}
-
-void CC HelpVersion (const char * fullpath, ver_t version)
-{
-    OUTMSG (("\n%s : %.3V\n\n", fullpath, version));
-}
-
-
-static void print_indented( const size_t first_indent, const size_t indent,
-                            const size_t max_line_len, const char ** msgs )
-{
-    const char * msg;
-    size_t line_len;
-
-    if ( *msgs == NULL )
-    {
-        OUTMSG(( "\n" ));
-        return;
-    }
-
-    if ( first_indent < indent )
-    {
-        OUTMSG(( "%*s", indent - first_indent, " " ));
-        line_len = indent;
-    }
-    else
-    {
-        OUTMSG(( "  " ));
-        line_len = first_indent + 2;
-    }
-    while ( ( msg = *msgs++ ) != NULL )
-    {
-        while ( msg != NULL )
-        {
-            const char * space = strchr( msg, ' ' );
-            if ( space != NULL )
-            {
-                /* space found, can we print the word on the current line? */
-                int wordlen = (int) ( space - msg );
-                if ( ( line_len + wordlen + 1 ) < max_line_len )
-                {
-                    if ( wordlen > 1 )
-                        OUTMSG(( "%.*s", wordlen + 1, msg )); /* yes */
-                }
-                else
-                {
-                    OUTMSG(( "\n%*s%.*s", indent, " ", wordlen + 1, msg )); /* no: new line */
-                    line_len = indent;
-                }
-                line_len += ( wordlen + 1 );
-                msg += ( wordlen + 1 );
-            }
-            else
-            {
-                /* no space found, can we print the string on the current line? */
-                size_t remainder = string_size( msg );
-                if ( line_len + remainder < max_line_len )
-                {
-                    OUTMSG(( "%s ", msg )); /* yes */
-                }
-                else
-                {
-                    OUTMSG(( "\n%*s%s ", indent, " ", msg )); /* no: new line */
-                    line_len = indent;
-                }
-                line_len += remainder;
-                msg = NULL; /* we are done with one source-line... */
-            }
-        }
-    }
-    OUTMSG(( "\n" ));
-}
-
-void CC HelpOptionLine(const char * alias, const char * option, const char * param, const char ** msgs)
-{
-/*    const char * msg; */
-#define INDENT 2
-#define MSG_INDENT 35
-#define MSG_MAXLEN 80
-
-    bool has_alias = (alias != NULL && alias[0] != '\0');
-    bool has_opt = (option != NULL && option[0] != '\0');
-
-    if( has_alias || has_opt )
-    {
-        int n, msgc;
-
-        OUTMSG(("%*s%n", INDENT, " ", & msgc ));
-
-        if( has_alias )
-        {
-            OUTMSG(("-%s%n", alias, &n));
-            msgc += n;
-        }
-
-        if( has_alias && has_opt )
-        {
-            OUTMSG(("|"));
-            msgc++;
-        }
-
-        if( has_opt )
-        {
-            OUTMSG(("--%s%n", option, &n));
-            msgc += n;
-        }
-
-        if( param != NULL)
-        {
-            OUTMSG((" <%s>%n", param, &n));
-            msgc += n;
-        }
-
-        print_indented( msgc, MSG_INDENT, MSG_MAXLEN, msgs );
-    }
-}
-
-void CC HelpParamLine (const char * param, const char * const * msgs)
-{
-    int msgc;
-    const char * msg;
-
-    msg = *msgs++;
-
-    if (param)
-    {
-        OUTMSG (("%*s%s%n", INDENT, " ", param, &msgc));
-	if (msg == NULL)
-	    OUTMSG (("\n"));
-	else
-	{
-	    OUTMSG (("%*s%s\n", MSG_INDENT-msgc, " ", msg));
-	}
-    }
-    if (msg != NULL)
-	while ((msg = *msgs++) != NULL)
-	    OUTMSG (("%*s%s\n", MSG_INDENT, " ", msg));
-}
-
-void CC HelpOptionsStandard (void)
-{
-    HelpOptionLine (ALIAS_HELP1, OPTION_HELP, NULL, help_usage);
-
-    HelpOptionLine (ALIAS_VERSION, OPTION_VERSION, NULL, version_usage);
-
-    gen_log_usage (log_usage);
-    HelpOptionLine (ALIAS_LOG_LEVEL, OPTION_LOG_LEVEL, "level", log_usage);
-
-    HelpOptionLine (ALIAS_VERBOSE, OPTION_VERBOSE, NULL, verbose_usage);
-    HelpOptionLine (ALIAS_QUIET, OPTION_QUIET, NULL, quiet_usage);
-#if USE_OPTFILE
-    HelpOptionLine (ALIAS_OPTFILE, OPTION_OPTFILE, "file", optfile_usage);
-#endif
-#if _DEBUGGING
-    HelpOptionLine (ALIAS_DEBUG, OPTION_DEBUG, "Module[-Flag]", debug_usage); 
-#endif
-}
-
-
-void CC HelpOptionsReport (void)
-{
-    HelpOptionLine (ALIAS_REPORT, OPTION_REPORT, "type", report_usage);
-}
-
-
-rc_t CC MiniUsage (const Args * args)
-{
-    KWrtWriter w;
-    void * d;
-    const char * progname;
-    rc_t rc;
-
-    w = KOutWriterGet();
-    d = KOutDataGet();
-
-    rc = ArgsProgram (args, NULL, &progname);
-    if (rc)
-        progname = UsageDefaultName;
-    KOutHandlerSetStdErr();
-    UsageSummary (progname);
-    KOutMsg ("\nUse option --help for more information.\n\n");
-
-    KOutHandlerSet (w,d);
-
-    return rc;
-}
diff --git a/libs/kapp/args_debug.h b/libs/kapp/args_debug.h
deleted file mode 100644
index ea4c509..0000000
--- a/libs/kapp/args_debug.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-#ifndef _h_args_priv_libs_
-#define _h_args_priv_libs_
-
-#include <klib/debug.h>
-
-#if _DEBUGGING
-
-#define ARGS_DBGF(msg) DBGMSG(DBG_ARGS, DBG_FLAG(DBG_ARGS_WRITER), msg)
-#define ARGS_DBG(fmt, ...) ARGS_DBGF(("%s:%u: " fmt "\n", __func__, __LINE__, __VA_ARGS__))
-#define ARGS_DBGERR(rc) if(rc != 0) {ARGS_DBGF(("%s:%u: %R\n", __func__, __LINE__, rc));}
-#define ARGS_DBGERRP(fmt, rc, ...) if(rc != 0) {ARGS_DBGF(("%s:%u: %R " fmt "\n", __func__, __LINE__, rc, __VA_ARGS__));}
-
-#else
-
-#define ARGS_DBGF(msg) ((void)0)
-#define ARGS_DBG(fmt, ...) ((void)0)
-#define ARGS_DBGERR(rc) ((void)0)
-#define ARGS_DBGERRP(fmt, rc, ...) ((void)0)
-
-#endif
-
-#endif
diff --git a/libs/kapp/loader-file.c b/libs/kapp/loader-file.c
deleted file mode 100644
index f048815..0000000
--- a/libs/kapp/loader-file.c
+++ /dev/null
@@ -1,643 +0,0 @@
-/*==============================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*/
-#include <kapp/extern.h>
-#include <klib/debug.h>
-#include <klib/log.h>
-#include <klib/text.h>
-#include <klib/printf.h>
-#include <klib/rc.h>
-#include <kfs/directory.h>
-#include <kfs/file.h>
-#include <kfs/md5.h>
-#include <kfs/bzip.h>
-#include <kfs/gzip.h>
-#include <kapp/progressbar.h>
-#include <kapp/queue-file.h>
-
-#include <kapp/loader-file.h>
-#define KFILE_IMPL KLoaderFile
-#include <kfs/impl.h>
-
-#include <sysalloc.h>
-#include <stdlib.h>
-#include <string.h>
-#include <os-native.h> /* for strdup on Windows */
-
-#define DBG(msg) DBGMSG(DBG_LOADLIB,DBG_FLAG(DBG_LOADLIB_FILE), msg)
-
-#if _DEBUGGING
-#   ifndef KLoaderFile_BUFFERSIZE
-#       define KLoaderFile_BUFFERSIZE (256 * 1024)
-#   endif
-#else
-#   undef KLoaderFile_BUFFERSIZE
-#   define KLoaderFile_BUFFERSIZE (256 * 1024)
-#endif
-
-struct KLoaderFile
-{
-    KFile dad;
-    /* physical file */
-    uint64_t kfile_pos;
-    const KFile* kfile;
-    const KLoadProgressbar* job;
-
-    const KFile* file;
-    const KDirectory* dir;
-    char* filename;
-    char* realname;
-    bool has_md5;
-    bool ahead;
-    uint8_t md5_digest[16];
-
-    /* current file */
-    enum {
-        compress_none = 0,
-        compress_gzip,
-        compress_bzip2
-    } compress_type;
-    uint64_t pos;
-    bool eof;
-    uint32_t eol; /* next line start in buffer (next symbol after previously detected eol) */
-    uint64_t line_no;
-
-    /* file buffer */
-    uint8_t *buffer_pos;
-    uint32_t avail;
-    uint8_t *buffer;
-    size_t buffer_size;
-#if _DEBUGGING
-    uint32_t small_reads; /* used to detect ineffective reads from file */
-#endif
-};
-
-static
-rc_t CC KLoaderFile_Destroy(KLoaderFile* self)
-{
-    if( self != NULL ) {
-        DBG(("%s %s\n", __func__, self->realname));
-        KFileRelease(self->kfile);
-        self->kfile = NULL;
-    }
-    return 0;
-}
-
-static
-struct KSysFile* CC KLoaderFile_GetSysFile(const KLoaderFile *self, uint64_t *offset)
-{
-    return KFileGetSysFile(self ? self->kfile : NULL, offset);
-}
-
-static
-rc_t CC KLoaderFile_RandomAccess(const KLoaderFile *self)
-{
-    return KFileRandomAccess(self ? self->kfile : NULL);
-}
-
-static
-uint32_t CC KLoaderFile_Type(const KLoaderFile *self)
-{
-    if( self && self->kfile ) {
-        return KFileType(self->kfile);
-    }
-    return KDirectoryPathType(self ? self->dir : NULL, self->realname);
-}
-
-static
-rc_t CC KLoaderFile_Size(const KLoaderFile *self, uint64_t *size)
-{
-    if( self && self->kfile ) {
-        return KFileSize(self->kfile, size);
-    }
-    return KDirectoryFileSize(self ? self->dir : NULL, size, self->realname);
-}
-
-static
-rc_t CC KLoaderFile_SetSize(KLoaderFile *self, uint64_t size)
-{
-    return RC(rcApp, rcFile, rcUpdating, rcInterface, rcUnsupported);
-}
-
-static
-rc_t CC KLoaderFile_ReadKFile(const KLoaderFile* cself, uint64_t pos, void *buffer, size_t size, size_t *num_read)
-{
-    rc_t rc = KFileRead(cself ? cself->kfile : NULL, pos, buffer, size, num_read);
-    DBG(("%s: %s: %lu\n", __func__, cself->realname, *num_read));
-    if( rc == 0 && cself->job != NULL ) {
-        if( pos > cself->kfile_pos ) {
-            rc = KLoadProgressbar_Process(cself->job, pos - cself->kfile_pos, false);
-            ((KLoaderFile*)cself)->kfile_pos = pos;
-        }
-        pos += *num_read;
-        if( pos > cself->kfile_pos ) {
-            rc = KLoadProgressbar_Process(cself->job, pos - cself->kfile_pos, false);
-            ((KLoaderFile*)cself)->kfile_pos= pos;
-        }
-    }
-    return rc;
-}
-
-static
-rc_t CC KLoaderFile_WriteKFile(KLoaderFile *self, uint64_t pos, const void *buffer, size_t size, size_t *num_writ)
-{
-    return RC(rcApp, rcFile, rcWriting, rcInterface, rcUnsupported);
-}
-
-static KFile_vt_v1 KLoaderFile_vtbl = {
-    1, 1,
-    KLoaderFile_Destroy,
-    KLoaderFile_GetSysFile,
-    KLoaderFile_RandomAccess,
-    KLoaderFile_Size,
-    KLoaderFile_SetSize,
-    KLoaderFile_ReadKFile,
-    KLoaderFile_WriteKFile,
-    KLoaderFile_Type
-};
-
-static
-rc_t KLoaderFile_Open(KLoaderFile* self)
-{
-    rc_t rc = 0;
-
-    DBG(("%s opening %s\n", __func__, self->realname));
-    if( (rc = KDirectoryOpenFileRead(self->dir, &self->kfile, self->realname)) == 0 ) {
-        if( self->has_md5 ) {
-            const KFile *md5File = NULL;
-            DBG(("%s opening as md5 wrapped %s\n", __func__, self->realname));
-            if( (rc = KFileMakeMD5Read(&md5File, self->file, self->md5_digest)) == 0) {
-                self->file = md5File;
-            }
-        }
-        if( rc == 0 ) {
-            const KFile *z = NULL;
-            switch(self->compress_type) {
-                case compress_none:
-                    break;
-                case compress_gzip:
-                    DBG(("%s opening as gzip wrapped %s\n", __func__, self->realname));
-                    if( (rc = KFileMakeGzipForRead(&z, self->file)) == 0 ) {
-                        KFileRelease(self->file);
-                        self->file = z;
-                    }
-                    break;
-                case compress_bzip2:
-                    DBG(("%s opening as bzip2 wrapped %s\n", __func__, self->realname));
-                    if( (rc = KFileMakeBzip2ForRead(&z, self->file)) == 0 ) {
-                        KFileRelease(self->file);
-                        self->file = z;
-                    }
-                    break;
-                default:
-                    rc = RC(rcApp, rcFile, rcOpening, rcType, rcUnexpected);
-                    break;
-            }
-#if ! WINDOWS
-            if( rc == 0 && self->ahead ) {
-                const KFile *z = NULL;
-                if( (rc = KQueueFileMakeRead(&z, self->pos, self->file,
-                                             self->buffer_size * 10,  self->buffer_size, 0)) == 0 ) {
-                    KFileRelease(self->file);
-                    self->file = z;
-                }
-            }
-#endif
-        }
-    }
-    if( rc != 0 ) {
-        PLOGERR(klogErr, (klogErr, rc, "opening $(file)", PLOG_S(file), self->filename));
-        KFileRelease(self->file);
-    }
-    return rc;
-}
-
-/* Fill
- *  fill buffer as far as possible, shift unread data in buffer to buffer start
- */
-static
-rc_t KLoaderFile_Fill(KLoaderFile *self)
-{
-    rc_t rc = 0;
-
-    if (self->kfile == NULL) {
-        rc = KLoaderFile_Open(self);
-    }
-    if( rc == 0 ) {
-        /* determine space in buffer available */
-        size_t to_read = self->buffer_size - self->avail;
-        if( to_read > 0 ) {
-#if _DEBUGGING
-            if( to_read < self->buffer_size * 0.5 ) {
-                self->small_reads++;
-                if( self->small_reads > 10 ) {
-                    PLOGMSG(klogWarn, (klogWarn, "$(filename) INEFFECTIVE READING: $(times) times, now $(bytes) bytes",
-                        PLOG_3(PLOG_S(filename),PLOG_U32(times),PLOG_U32(bytes)), self->filename, self->small_reads, to_read));
-                }
-            }
-#endif
-            /* shift left unread data */
-            memmove(self->buffer, self->buffer_pos, self->avail);
-            /* skip read chunk in buffer */
-            self->pos += self->buffer_pos - self->buffer;
-            /* reset pointer */
-            self->buffer_pos = self->buffer;
-            do { /* fill buffer up to eof */
-                size_t num_read = 0;
-                if( (rc = KFileRead(self->file, self->pos + self->avail,
-                                    &self->buffer[self->avail], to_read, &num_read)) == 0 ) {
-                    self->eof = (num_read == 0);
-                    self->avail += (uint32_t) num_read;
-                    to_read -= num_read;
-                    DBG(("KLoaderFile read %s from %lu %u bytes%s\n",
-                         self->filename, self->pos + self->avail - num_read, num_read, self->eof ? " EOF" : ""));
-                }
-            } while( rc == 0 && to_read > 0 && !self->eof );
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KLoaderFile_IsEof(const KLoaderFile* cself, bool* eof)
-{
-    if( cself == NULL || eof == NULL ) {
-        return RC(rcApp, rcFile, rcConstructing, rcParam, rcNull);
-    }
-    /* end of file is when file is at eof and nothing in buffer or last readline returned the buffer */
-    *eof = cself->eof && ((cself->avail - cself->eol) == 0);
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KLoaderFile_Close(const KLoaderFile* cself)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL ) {
-        rc = RC(rcApp, rcFile, rcConstructing, rcParam, rcNull);
-    } else {
-        /* TBD possible delays if file has md5 set */
-        DBG(("%s closing %s\n", __func__, cself->realname));
-        rc = KFileRelease(cself->file);
-        KFileAddRef(&cself->dad);
-        ((KLoaderFile*)cself)->file = &cself->dad;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KLoaderFile_Reset(const KLoaderFile* cself)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL ) {
-        rc = RC(rcApp, rcFile, rcConstructing, rcParam, rcNull);
-    } else {
-        KLoaderFile* self = (KLoaderFile*)cself;
-        if( cself->pos != 0 && (cself->ahead || cself->compress_type != compress_none) ) {
-            /* threaded buffering || data in buffer is not first portion of the file */
-            rc = KLoaderFile_Close(cself);
-            self->avail = 0;
-            self->buffer[0] = 0;
-            self->eof = false;
-        } else {
-            self->avail += (uint32_t) ( self->buffer_pos - self->buffer );
-        }
-        self->pos = 0;
-        self->eol = 0;
-        self->line_no = 0;
-        self->buffer_pos = self->buffer;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KLoaderFile_SetReadAhead(const KLoaderFile* cself, bool read_ahead)
-{
-    if( cself == NULL ) {
-        return RC(rcApp, rcFile, rcConstructing, rcParam, rcNull);
-    }
-#if ! WINDOWS
-    ((KLoaderFile*)cself)->ahead = read_ahead;
-#endif
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KLoaderFile_LOG(const KLoaderFile* cself, KLogLevel lvl, rc_t rc, const char *msg, const char *fmt, ...)
-{
-    va_list args;
-    va_start(args, fmt);
-    rc = KLoaderFile_VLOG(cself, lvl, rc, msg, fmt, args);
-    va_end(args);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KLoaderFile_VLOG(const KLoaderFile* cself, KLogLevel lvl, rc_t rc, const char *msg, const char *fmt, va_list args)
-{
-    if( cself == NULL || (msg == NULL && rc == 0) ) {
-        rc = RC(rcApp, rcFile, rcAccessing, rcParam, rcInvalid);
-        LOGERR(klogErr, rc, __func__);
-    }  else if( msg == NULL && rc != 0 ) {
-        if( cself->line_no == 0 ) {
-            PLOGERR(lvl, (lvl, rc, "$(file):$(offset)", "file=%s,offset=%lu", cself->filename, cself->pos));
-        } else {
-            PLOGERR(lvl, (lvl, rc, "$(file):$(line)", "file=%s,line=%lu", cself->filename, cself->line_no));
-        }
-    } else {
-        rc_t fmt_rc;
-        char xfmt[4096];
-        const char* f = fmt ? fmt : "";
-        const char* c = fmt ? "," : "";
-
-        if( cself->line_no == 0 ) {
-            fmt_rc = string_printf(xfmt, sizeof xfmt, NULL, "file=%s,offset=%lu%s%s", cself->filename, cself->pos, c, f);
-        } else {
-            fmt_rc = string_printf(xfmt, sizeof xfmt, NULL, "file=%s,line=%lu%s%s", cself->filename, cself->line_no, c, f);
-        }
-        if ( fmt_rc == 0 ) {
-            fmt = xfmt;
-        }
-        if( rc == 0 ) {
-            VLOGMSG(lvl, (lvl, msg, fmt, args));
-        } else {
-            VLOGERR(lvl, (lvl, rc, msg, fmt, args));
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KLoaderFile_Offset(const KLoaderFile* cself, uint64_t* offset)
-{
-    if( cself == NULL || offset == NULL ) {
-        return RC(rcApp, rcFile, rcConstructing, rcParam, rcNull);
-    }
-    *offset = cself->pos + (cself->buffer_pos - cself->buffer);
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KLoaderFile_Line(const KLoaderFile* cself, uint64_t* line)
-{
-    if( cself == NULL || line == NULL ) {
-        return RC(rcApp, rcFile, rcConstructing, rcParam, rcNull);
-    }
-    *line = cself->line_no;
-    return 0;
-}
-
-static
-rc_t KLoaderFile_AllocateBuffer(KLoaderFile *self)
-{
-    self->buffer_size = KLoaderFile_BUFFERSIZE;
-    if( (self->buffer = malloc(self->buffer_size)) == NULL ) {
-        self->buffer_size = 0;
-        return RC(rcApp, rcFile, rcConstructing, rcMemory, rcExhausted);
-    }
-    self->buffer[0] = 0;
-    self->buffer_pos = self->buffer;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KLoaderFile_Readline(const KLoaderFile* cself, const void** buffer, size_t* length)
-{
-    rc_t rc = 0;
-
-    if(cself == NULL || buffer == NULL || length == NULL) {
-        rc = RC( rcApp, rcFile, rcAccessing, rcParam, rcNull);
-    } else {
-        KLoaderFile *self = (KLoaderFile*)cself;
-        uint8_t* nl;
-        bool refilled = false;
-        bool eof;
-        
-        rc = KLoaderFile_IsEof(cself, &eof);
-        if( rc == 0 && eof ) {
-            *buffer = NULL;
-            return 0;
-        }
-        
-        while( rc == 0 ) {
-            bool CR_last = false;
-            int i, cnt = self->avail - self->eol;
-            uint8_t* buf = &self->buffer_pos[self->eol];
-            *buffer = buf;
-            /* find first eol from current position */
-            for(nl = NULL, i = 0; i < cnt && nl == NULL; i++) {
-                if(buf[i] == '\n' || buf[i] == '\r') {
-                    nl = &buf[i];
-                }
-            }
-            if( nl != NULL || refilled ) {
-                break;
-            }
-            refilled = true;
-            /* none found we need to push out processed portion and load full buffer */
-            if( self->eol > 0 ) {
-                /* mark that line ended on buffer end and last char in buffer is \r */
-                CR_last = self->eol == self->avail && self->buffer_pos[self->eol - 1] == '\r';
-                self->buffer_pos += self->eol;
-                self->avail -= self->eol;
-                self->eol = 0;
-            }
-            if( (rc = KLoaderFile_Fill(self)) == 0 ) {
-                if( CR_last && self->buffer_pos[0] == '\n' ) {
-                    /* in previous chunk last char was \r and in next chunk 1st char is \n
-                    this is \r\n seq split by buffer, need to ignore \n */
-                    self->eol++;
-                }
-            }
-        }
-        if( rc == 0 ) {
-            if( nl == NULL ) {
-                self->eol = self->avail;
-                *length = self->avail;
-                if( self->buffer_size == self->avail ) {
-                    /* buffer could be copied and next call will provide tail of line */
-                    rc = RC( rcApp, rcFile, rcReading, rcString, rcTooLong);
-                } 
-            } else {
-                *length = nl - (uint8_t*)*buffer;
-                self->eol = (uint32_t) ( nl - self->buffer_pos + 1 );
-                if( *nl == '\r' && nl < &self->buffer[self->buffer_size - 1] && *(nl + 1) == '\n' ) {
-                    /* \r\n */
-                    self->eol++;
-                }
-                self->line_no++;
-            }
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KLoaderFile_Read(const KLoaderFile* cself, size_t advance, size_t size, const void** buffer, size_t* length)
-{
-    rc_t rc = 0;
-
-    if (cself == NULL || buffer == NULL || length == NULL ) {
-        return RC(rcApp, rcFile, rcPositioning, rcSelf, rcNull);
-    } else {
-        KLoaderFile* self = (KLoaderFile*)cself;
-        if( advance > 0 ) {
-            if(advance >= self->avail) {
-                self->pos += advance;
-                self->avail = 0;
-                self->eol = 0;
-            } else {
-                self->buffer_pos += advance;
-                self->avail -= (uint32_t) advance;
-                self->eol = (uint32_t) ( self->eol > advance ? self->eol - advance : 0 );
-            }
-        }
-        if( size > self->avail || self->avail == 0 ) {
-            rc = KLoaderFile_Fill(self);
-        }
-        if( rc == 0 ) {
-            *buffer = self->buffer_pos;
-            *length = self->avail;
-            if( self->avail == 0 && self->eof ) {
-                *buffer = NULL;
-            } else if( size > self->avail ) {
-                if( !self->eof ) {
-                    rc = RC( rcApp, rcFile, rcReading, rcBuffer, rcInsufficient);
-                }
-            } else if( size > 0 ) {
-                *length = size;
-            }
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KLoaderFile_Name(const KLoaderFile *self, const char **name)
-{
-    if( self == NULL || name == NULL ) {
-        return RC(rcApp, rcFile, rcAccessing, rcParam, rcNull);
-    }
-    *name = self->filename;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KLoaderFile_FullName(const KLoaderFile *self, const char **name)
-{
-    if( self == NULL || name == NULL ) {
-        return RC(rcApp, rcFile, rcAccessing, rcParam, rcNull);
-    } else {
-        *name = self->realname;
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KLoaderFile_ResolveName(const KLoaderFile *self, char *resolved, size_t rsize)
-{
-    if( self == NULL || resolved == NULL ) {
-        return RC(rcApp, rcFile, rcAccessing, rcParam, rcNull);
-    }
-    return KDirectoryResolvePath(self->dir, true, resolved, rsize, self->realname);
-}
-
-LIB_EXPORT rc_t CC KLoaderFile_Release(const KLoaderFile* cself, bool exclude_from_progress)
-{
-    rc_t rc = 0;
-
-    if( cself != NULL ) {
-        KLoaderFile* self = (KLoaderFile*)cself;
-        DBG(("%s: '%s'%s\n", __func__, cself->filename, exclude_from_progress ? " excluded" : ""));
-        /* may return md5 check error here */
-        if( (rc = KFileRelease(self->file)) == 0 && !exclude_from_progress ) {
-            PLOGMSG(klogInt, (klogInfo, "done file $(file) $(bytes) bytes",
-                    "severity=file,file=%s,bytes=%lu",
-                    self->filename, self->pos + (self->buffer_pos - self->buffer)));
-        }
-        KLoadProgressbar_Release(self->job, exclude_from_progress);
-        KDirectoryRelease(self->dir);
-        free(self->filename);
-        free(self->realname);
-        free(self->buffer);
-        free(self);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KLoaderFile_Make(const KLoaderFile **file, const KDirectory* dir, const char* filename,
-                                    const uint8_t* md5_digest, bool read_ahead)
-{
-    rc_t rc = 0;
-    KLoaderFile* obj = NULL;
-
-    if( file == NULL || dir == NULL || filename == NULL ) {
-        rc = RC(rcApp, rcFile, rcConstructing, rcParam, rcNull);
-    } else {
-        *file = NULL;
-        if( (obj = calloc(1, sizeof(*obj))) == NULL ||
-            (obj->filename = strdup(filename)) == NULL ) {
-            rc = RC(rcApp, rcFile, rcConstructing, rcMemory, rcExhausted);
-        } else {
-            if( (rc = KDirectoryAddRef(dir)) == 0 ) {
-                obj->dir = dir;
-                if( md5_digest != NULL ) {
-                    obj->has_md5 = true;
-                    memcpy(obj->md5_digest, md5_digest, sizeof(obj->md5_digest));
-                }
-                if( (rc = KLoaderFile_AllocateBuffer(obj)) == 0 ) {
-                    char resolved[4096];
-                    char* ext = NULL;
-
-                    strcpy(resolved, filename);
-                    ext = strrchr(resolved, '.');
-                    DBG(("%s adding %s\n", __func__, resolved));
-                    rc = KLoadProgressbar_File(&obj->job, resolved, obj->dir);
-                    if( ext != NULL && strcmp(ext, ".gz") == 0 ) {
-                        obj->compress_type = compress_gzip;
-                    } else if( ext != NULL && strcmp(ext, ".bz2") == 0 ) {
-                        obj->compress_type = compress_bzip2;
-                    }
-                    if( rc != 0 && obj->compress_type != compress_none ) {
-                        *ext = '\0';
-                        DBG(("%s retry adding as %s\n", __func__, resolved));
-                        if( (rc = KLoadProgressbar_File(&obj->job, resolved, obj->dir)) == 0 ) {
-                            obj->has_md5 = false;
-                            obj->compress_type = compress_none;
-                        }
-                    }
-                    if( rc == 0 &&
-                        (rc = KFileInit(&obj->dad, (const KFile_vt*)&KLoaderFile_vtbl, "KLoaderFile", filename, true, false)) == 0 ) {
-                        obj->file = &obj->dad;
-#if WINDOWS
-                        obj->ahead = false;
-#else
-                        obj->ahead = read_ahead;
-#endif
-                        obj->realname = strdup(resolved);
-                        if( obj->realname == NULL ) {
-                            rc = RC(rcApp, rcFile, rcConstructing, rcMemory, rcExhausted);
-                        }
-                    }
-                }
-            }
-        }
-    }
-    if( rc == 0 ) {
-        *file = obj;
-    } else {
-        *file = NULL;
-        KLoaderFile_Release(obj, false);
-    }
-    return rc;
-}
diff --git a/libs/kapp/loader-meta.c b/libs/kapp/loader-meta.c
deleted file mode 100644
index 131ddb3..0000000
--- a/libs/kapp/loader-meta.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*==============================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <kapp/extern.h>
-#include <klib/text.h>
-#include <klib/printf.h>
-#include <klib/rc.h>
-#include <kdb/meta.h>
-#include <kapp/loader-meta.h>
-#include <kapp/main.h>
-
-#include <string.h>
-#include <assert.h>
-#include <time.h>
-
-static
-rc_t MakeVersion(ver_t vers, char* b, size_t bsize)
-{
-    assert(b != NULL && bsize != 0);
-    return string_printf(b, bsize, NULL, "%V", vers);
-}
-
-LIB_EXPORT rc_t CC KLoaderMeta_Write(KMDataNode* root,
-                                     const char* argv0, const char* argv0_date,
-                                     const char* app_name, ver_t app_version)
-{
-    rc_t rc = 0;
-    KMDataNode *node = NULL;
-
-    if( root == NULL || argv0 == NULL || argv0_date == NULL ) {
-        rc = RC(rcApp, rcMetadata, rcWriting, rcParam, rcNull);
-    } else if( (rc = KMDataNodeOpenNodeUpdate(root, &node, "SOFTWARE")) == 0 ) {
-        char str_vers[64];
-        KMDataNode *subNode = NULL;
-        if( (rc = KMDataNodeOpenNodeUpdate(node, &subNode, "loader")) == 0 ) {
-            if( (rc = MakeVersion(KAppVersion(), str_vers, sizeof(str_vers))) == 0 ) {
-                rc = KMDataNodeWriteAttr(subNode, "vers", str_vers);
-            }
-            if(rc == 0) {
-                rc = KMDataNodeWriteAttr(subNode, "date", argv0_date);
-            }
-            if(rc == 0) {
-                const char* tool_name = strrchr(argv0, '/');
-                const char* r = strrchr(argv0, '\\');
-                if( tool_name != NULL && r != NULL && tool_name < r ) {
-                    tool_name = r;
-                }
-                if( tool_name++ == NULL) {
-                    tool_name = argv0;
-                }
-                rc = KMDataNodeWriteAttr(subNode, "name", tool_name);
-            }
-            KMDataNodeRelease(subNode);
-        }
-        if(rc == 0 && (rc = KMDataNodeOpenNodeUpdate(node, &subNode, "formatter")) == 0 ) {
-            if( (rc = MakeVersion(app_version, str_vers, sizeof(str_vers))) == 0 ) {
-                rc = KMDataNodeWriteAttr(subNode, "vers", str_vers);
-            }
-            if(rc == 0) {
-                rc = KMDataNodeWriteAttr(subNode, "name", app_name ? app_name : "internal");
-            }
-            KMDataNodeRelease(subNode);
-        }
-        KMDataNodeRelease(node);
-    }
-    if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(root, &node, "LOAD")) == 0 ) {
-        KMDataNode *subNode = NULL;
-        if( (rc = KMDataNodeOpenNodeUpdate(node, &subNode, "timestamp")) == 0 ) {
-            time_t t = time(NULL);
-            rc = KMDataNodeWrite(subNode, &t, sizeof(t));
-            KMDataNodeRelease(subNode);
-        }
-        KMDataNodeRelease(node);
-    }
-    return rc;
-}
diff --git a/libs/kapp/log-xml.c b/libs/kapp/log-xml.c
deleted file mode 100644
index 891dbfc..0000000
--- a/libs/kapp/log-xml.c
+++ /dev/null
@@ -1,416 +0,0 @@
-/*==============================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <kapp/extern.h>
-#include <kapp/main.h>
-#include <klib/debug.h>
-#include <klib/log.h>
-#include <klib/out.h>
-#include <klib/status.h>
-#include <klib/text.h>
-#include <klib/printf.h>
-#include <kxml/xml.h>
-#include <kfs/file.h>
-#include <kfs/kfs-priv.h>
-#include <kfs/directory.h>
-#include <klib/rc.h>
-#include <kapp/log-xml.h>
-
-#include <os-native.h>
-
-#include <ctype.h>
-#include <string.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <limits.h>
-#include <assert.h>
-
-#define DBG(msg) DBGMSG(DBG_LOADLIB,DBG_FLAG(DBG_LOADLIB_XLOG), msg)
-
-enum OptDefIndex {
-    eopt_file = 0,
-    eopt_fd
-};
-
-const char* XMLLogger_file_usage[] = {"produce XML-formatted log file", NULL};
-const char* XMLLogger_fd_usage[] = {NULL, "produce XML-formatted output to given file descriptor", NULL};
-
-const OptDef XMLLogger_Args[] =
-{
-    {"xml-log", "z", NULL, XMLLogger_file_usage, 1, true, false},
-    {"xml-log-fd", NULL, NULL, XMLLogger_fd_usage, 1, true, false}
-};
-const size_t XMLLogger_ArgsQty = sizeof(XMLLogger_Args) / sizeof(XMLLogger_Args[0]);
-
-typedef struct XMLFormatterFile
-{
-    KFile* file;
-    uint64_t pos;
-} XMLFormatterFile;
-
-typedef struct XMLFormatterData
-{
-    XMLFormatterFile* file;
-    KFmtHandler fmt;
-    KWrtHandler wrt;
-} XMLFormatterData;
-
-struct XMLLogger {
-    XMLFormatterFile file;
-    XMLFormatterData log;
-    XMLFormatterData loglib;
-    XMLFormatterData sts;
-    XMLFormatterData stslib;
-};
-
-LIB_EXPORT
-rc_t CC XMLLogger_Encode(const char* src, char *dst, size_t dst_sz, size_t *num_writ)
-{
-    rc_t rc = 0;
-
-    if( src == NULL || dst == NULL || num_writ == NULL ) {
-        rc = RC(rcApp, rcArgv, rcParsing, rcParam, rcNull);
-    } else {
-        *num_writ = 0;
-        do {
-            size_t bytes;
-            const char* p;
-            switch(*src) {
-                case '\'':
-                    bytes = 6;
-                    p = "'";
-                    break;
-                case '"':
-                    bytes = 6;
-                    p = """;
-                    break;
-                case '&':
-                    bytes = 5;
-                    p = "&";
-                    break;
-                case '<':
-                    bytes = 4;
-                    p = "<";
-                    break;
-                case '>':
-                    bytes = 4;
-                    p = ">";
-                    break;
-                default:
-                    bytes = 1;
-                    p = src;
-                    break;
-            }
-            if( (*num_writ + bytes) > dst_sz ) {
-                rc = RC(rcApp, rcLog, rcEncoding, rcBuffer, rcInsufficient);
-                break;
-            } else {
-                memcpy(dst, p, bytes);
-                *num_writ = *num_writ + bytes;
-                dst += bytes;
-            }
-        } while(*src++ != '\0');
-        *num_writ = *num_writ - 1;
-    }
-    return rc;
-}
-
-static
-rc_t CC LoaderXMLFormatter( void* data, KWrtHandler* writer,
-                            size_t argc, const wrt_nvp_t args[],
-                            size_t envc, const wrt_nvp_t envs[])
-
-{
-    rc_t rc = 0;
-    size_t i, remaining, num_writ = 0;
-    XMLFormatterData* self = (XMLFormatterData*)data;
-    char buffer[4096];
-    const char* severity, *msg_val = NULL;
-    bool severity_std = false;
-    char* pbuffer;
-    const char* const tag_nvp_name = "severity";
-    const wrt_nvp_t* msg_nvp = NULL;
-    static const char* tags[] = {
-        "fatal",
-        "system",
-        "internal",
-        "error",
-        "warning",
-        "info"
-    };
-
-    msg_nvp = wrt_nvp_find(envc, envs, "message");
-    if( msg_nvp != NULL ) {
-        msg_val = msg_nvp->value;
-    }
-    severity = wrt_nvp_find_value(argc, args, tag_nvp_name);
-    if( severity == NULL ) {
-        severity = wrt_nvp_find_value(envc, envs, tag_nvp_name);
-        if( severity != NULL ) {
-            severity_std = true;
-            /* translate std severity name to full name */
-            for(i = 0; i < sizeof(tags)/sizeof(tags[0]); i++) {
-                if( strncmp(severity, tags[i], strlen(severity)) == 0 ) {
-                    severity = tags[i];
-                    break;
-                }
-            }
-        }
-    }
-    if( severity == NULL ) {
-        severity = "status";
-    }
-
-#define FIX_UP() if(rc != 0){break;} remaining -= num_writ; pbuffer += num_writ
-    
-    pbuffer = buffer;
-    remaining = sizeof(buffer);
-    do {
-        size_t k, pq = envc;
-        const wrt_nvp_t* p = envs;
-        const char* subst = NULL;
-
-        rc = LogInsertSpace("<", pbuffer, remaining, &num_writ);
-        FIX_UP();
-        rc = LogInsertSpace(severity, pbuffer, remaining, &num_writ);
-        FIX_UP();
-        /* print env first and than args! */
-        for(k = 0; rc == 0 && k < 2; k++) {
-            for(i = 0; i < pq; i++ ) {
-                if( strcmp(p[i].name, tag_nvp_name) == 0 ) {
-                    continue;
-                }
-                if( p == args ) {
-                    if( i == 0 && msg_nvp != NULL ) {
-                        /* grab args attr buffer start */
-                        subst = pbuffer;
-                    }
-                    if( severity_std ) {
-                        /* allow only specific attributes from message into xml log
-                           for LOG calls with standard severity */
-                        int x, yes = 0;
-                        static const char* allowed_attr[] = {
-                            "file", "line", "offset",
-                            "spot", "spot_name", "spotname"
-                        };
-                        for(x = 0; x < sizeof(allowed_attr)/sizeof(allowed_attr[0]); x++) {
-                            if( strcasecmp(p[i].name, allowed_attr[x]) == 0 ) {
-                                yes = 1;
-                                break;
-                            }
-                        }
-                        if( !yes ) {
-                            continue;
-                        }
-                    }
-                }
-                rc = LogInsertSpace(" ", pbuffer, remaining, &num_writ);
-                FIX_UP();
-                rc = XMLLogger_Encode(p[i].name, pbuffer, remaining, &num_writ);
-                FIX_UP();
-                rc = LogInsertSpace("=\"", pbuffer, remaining, &num_writ);
-                FIX_UP();
-                rc = XMLLogger_Encode(p[i].value, pbuffer, remaining, &num_writ);
-                FIX_UP();
-                rc = LogInsertSpace("\"", pbuffer, remaining, &num_writ);
-                FIX_UP();
-            }
-            p = args;
-            pq = argc;
-        }
-        if( subst != NULL && subst[0] != '\0' ) {
-            /* hack 'message' to print curr argv to std log as text attr="value" */
-            ((wrt_nvp_t*)msg_nvp)->value = subst + 1; /* \0 terminated pre LogInsertSpace behavior */
-            if( (rc = self->fmt.formatter(self->fmt.data, &self->wrt, 0, NULL, envc, envs)) != 0 ) {
-                break;
-            }
-            ((wrt_nvp_t*)msg_nvp)->value = msg_val;
-        }
-        rc = LogInsertSpace("/>\n", pbuffer, remaining, &num_writ);
-        FIX_UP();
-    } while(false);
-
-    if( self->file->file != NULL ) {
-        if( rc != 0 ) {
-            pbuffer = buffer;
-            remaining = sizeof(buffer);
-            rc = string_printf(pbuffer, remaining, & num_writ, "<error severity=\"err\" message=\"XML log failed: %R\"/>\n", rc);
-            pbuffer += num_writ <= remaining ? num_writ : 0;
-        }
-        rc = KFileWrite(self->file->file, self->file->pos, buffer, pbuffer - buffer, &num_writ);
-        self->file->pos += num_writ;
-    }
-    rc = self->fmt.formatter(self->fmt.data, &self->wrt, argc, args, envc, envs);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC XMLLogger_Make(const XMLLogger** cself, KDirectory* dir, const Args *args)
-{
-    rc_t rc = 0;
-    const char* path = NULL, *sfd = NULL;
-    int fd = -1;
-    uint32_t count;
-
-    if( (rc = ArgsOptionCount(args, XMLLogger_Args[eopt_file].name, &count)) != 0 || count > 1 ) {
-        rc = rc ? rc : RC(rcApp, rcArgv, rcParsing, rcParam, rcExcessive);
-    } else if( count > 0 && (rc = ArgsOptionValue(args, XMLLogger_Args[eopt_file].name, 0, &path)) != 0 ) {
-
-    } else if( (rc = ArgsOptionCount(args, XMLLogger_Args[eopt_fd].name, &count)) != 0 || count > 1 ) {
-        rc = rc ? rc : RC(rcApp, rcArgv, rcParsing, rcParam, rcExcessive);
-    } else if( count > 0 && (rc = ArgsOptionValue(args, XMLLogger_Args[eopt_fd].name, 0, &sfd)) != 0 ) {
-
-    } else {
-        do {
-            long val = 0;
-            char* end = NULL;
-
-            if( sfd != NULL ) {
-                if( path != NULL ) {
-                    rc = RC(rcApp, rcArgv, rcParsing, rcParam, rcExcessive);
-                    break;
-                }
-                errno = 0;
-                val = strtol(sfd, &end, 10);
-                if( errno != 0 || sfd == end || *end != '\0' || val < 0 || val > INT_MAX ) {
-                    rc = RC(rcApp, rcArgv, rcReading, rcParam, rcInvalid);
-                    break;
-                }
-                fd = val;
-            }
-            rc = XMLLogger_Make2(cself, dir, path, fd);
-        } while( false );
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC XMLLogger_Make2(const XMLLogger** self, KDirectory* dir, const char* logpath, const int fd)
-{
-    rc_t rc = 0;
-    XMLLogger* obj;
-    KDirectory* my_dir = NULL;
-
-    const uint32_t lopt = klogFmtTimestamp | klogFmtSeverity |
-                          klogFmtMessage | klogFmtAppName | klogFmtAppVersion | klogFmtReasonShort;
-
-    const uint32_t sopt = kstsFmtTimestamp | kstsFmtMessage | kstsFmtAppName | kstsFmtAppVersion;
-
-    KLogFmtFlagsSet(lopt);
-    KLogLibFmtFlagsSet(lopt);
-    KStsFmtFlagsSet(sopt);
-    KStsLibFmtFlagsSet(sopt);
-
-    obj = calloc(1, sizeof(*obj));
-    if( obj == NULL ) {
-        rc = RC(rcApp, rcLog, rcAllocating, rcMemory, rcExhausted);
-    } else if( fd < 0 && dir == NULL && (rc = KDirectoryNativeDir(&my_dir)) != 0 ) {
-    } else if( fd >= 0 && (rc = KFileMakeFDFileWrite(&obj->file.file, false, fd)) != 0 ) {
-    } else if( logpath != NULL && fd < 0 && (rc = KDirectoryCreateFile(dir ? dir : my_dir, &obj->file.file, false, 0644, kcmInit, logpath)) != 0 ) {
-    } else {
-    
-        obj->file.pos = 0;
-        obj->log.file = &obj->file;
-        obj->log.fmt.formatter = KLogFmtWriterGet();
-        obj->log.fmt.data = KLogFmtDataGet();
-        obj->log.wrt.writer = KLogWriterGet();
-        obj->log.wrt.data = KLogDataGet();
-
-        obj->loglib.file = &obj->file;
-        obj->loglib.fmt.formatter = KLogLibFmtWriterGet();
-        obj->loglib.fmt.data = KLogLibFmtDataGet();
-        obj->loglib.wrt.writer = KLogLibWriterGet();
-        obj->loglib.wrt.data = KLogLibDataGet();
-
-        obj->sts.file = &obj->file;
-        obj->sts.fmt.formatter = KStsFmtWriterGet();
-        obj->sts.fmt.data = KStsFmtDataGet();
-        obj->sts.wrt.writer = KStsWriterGet();
-        obj->sts.wrt.data = KStsDataGet();
-
-        obj->stslib.file = &obj->file;
-        obj->stslib.fmt.formatter = KStsLibFmtWriterGet();
-        obj->stslib.fmt.data = KStsLibFmtDataGet();
-        obj->stslib.wrt.writer = KStsLibWriterGet();
-        obj->stslib.wrt.data = KStsLibDataGet();
-
-        if( (rc = KLogFmtHandlerSet(LoaderXMLFormatter, lopt, &obj->log)) == 0 &&
-            (rc = KLogLibFmtHandlerSet(LoaderXMLFormatter, lopt, &obj->loglib)) == 0 &&
-            (rc = KStsFmtHandlerSet(LoaderXMLFormatter, sopt, &obj->sts)) == 0 &&
-            (rc = KStsLibFmtHandlerSet(LoaderXMLFormatter, sopt, &obj->stslib)) == 0 ) {
-            /* make log valid XML */
-            if( obj->file.file != NULL ) {
-                size_t num_writ = 0;
-                rc = KFileWrite(obj->file.file, obj->file.pos, "<Log>\n", 6, &num_writ);
-                obj->file.pos += num_writ;
-            }
-        }
-    }
-    KDirectoryRelease(my_dir);
-    if( rc == 0 ) {
-        *self = obj;
-        if( fd >= 0 ) {
-            DBG(("XML Log file set to handle %d\n", fd));
-        } else if( logpath != NULL) {
-            DBG(("XML Log file set to %s\n", logpath));
-        } 
-    } else {
-        XMLLogger_Release(obj);
-        *self = NULL;
-    }
-    return rc;
-}
-
-LIB_EXPORT void CC XMLLogger_Usage(void)
-{
-    int i;
-    for(i = 0; i < XMLLogger_ArgsQty; i++ ) {
-        if( XMLLogger_Args[i].help[0] != NULL ) {
-            HelpOptionLine(XMLLogger_Args[i].aliases, XMLLogger_Args[i].name, NULL, XMLLogger_Args[i].help);
-        }
-    }
-}
-
-LIB_EXPORT void CC XMLLogger_Release(const XMLLogger* cself)
-{
-    if( cself != NULL ) {
-        XMLLogger* self = (XMLLogger*)cself;
-        KLogFmtHandlerSet(self->log.fmt.formatter, 0, self->log.fmt.data);
-        KLogLibFmtHandlerSet(self->loglib.fmt.formatter, 0, self->loglib.fmt.data);
-        KLogHandlerSet(self->log.wrt.writer, self->log.wrt.data);
-        KLogLibHandlerSet(self->loglib.wrt.writer, self->loglib.wrt.data);
-        KStsFmtHandlerSet(self->sts.fmt.formatter, 0, self->sts.fmt.data);
-        KStsLibFmtHandlerSet(self->stslib.fmt.formatter, 0, self->stslib.fmt.data);
-        KStsHandlerSet(self->sts.wrt.writer, self->sts.wrt.data);
-        KStsLibHandlerSet(self->stslib.wrt.writer, self->stslib.wrt.data);
-        /* make log valid XML */
-        if( self->file.file != NULL ) {
-            if( self->file.pos > 0 ) {
-                KFileWrite(self->file.file, self->file.pos, "</Log>\n", 7, NULL);
-            }
-            KFileRelease(self->file.file);
-        }
-        free(self);
-    }
-}
diff --git a/libs/kapp/main-priv.h b/libs/kapp/main-priv.h
deleted file mode 100644
index f6aa7c3..0000000
--- a/libs/kapp/main-priv.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_main_priv_
-#define _h_main_priv_
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifndef _h_kapp_extern_
- #include <kapp/extern.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-    
-/*--------------------------------------------------------------------------
- * KMane
- *  invoked by platform specific "main" entrypoint
- */
-
-/* KMane
- *  executable entrypoint "main" is implemented by
- *  an OS-specific wrapper that takes care of establishing
- *  signal handlers, logging, etc.
- *
- *  in turn, OS-specific "main" will invoke "KMain" as
- *  platform independent main entrypoint.
- *
- *  "argc" [ IN ] - the number of textual parameters in "argv"
- *  should never be < 0, but has been left as a signed int
- *  for reasons of tradition.
- *
- *  "argv" [ IN ] - array of NUL terminated strings expected
- *  to be in the shell-native character set: ASCII or UTF-8
- *  element 0 is expected to be executable identity or path.
- */
-rc_t KMane ( int argc, char *argv [] );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_main_priv_ */
diff --git a/libs/kapp/main.c b/libs/kapp/main.c
deleted file mode 100644
index 125a64d..0000000
--- a/libs/kapp/main.c
+++ /dev/null
@@ -1,431 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kapp/extern.h>
-#include "main-priv.h"
-#include <sysalloc.h>
-#include <kapp/main.h>
-#include <kfg/config.h>
-#include <kproc/procmgr.h>
-#include <klib/report.h>
-#include <klib/writer.h>
-#include <klib/log.h>
-#include <klib/status.h>
-#include <klib/rc.h>
-
-#include <strtol.h>
-
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-#if 0
-/* NextArg
- *  extracts the next argument from a switch parameter
- *
- *  "arg" is an indirect pointer to somewhere within an
- *  argument string, representing the last character parsed,
- *  e.g. "-auv"
- *         ^    : "arg" indicates the 'a'.
- *  in the example given, NextArg will advance the pointer
- *  to point to the 'u'.
- *
- *  had "arg" pointed instead to the 'v' above, i.e. there
- *  are no characters remaining in "arg" to be parsed, then
- *  an attempt to return the next element of "argv" will be
- *  made by invoking NextArgh.
- *
- *  "arg" [ IN, OUT ] - current argument string as indicated above
- *
- *  "i" [ IN, OUT ] - loop counter. required to be < argc,
- *  advanced if necessary to access next argument in argv.
- *
- *  "argc" [ IN ] - number of arguments in argv
- *
- *  "argv" [ IN ] - program arguments
- *
- *  "handle_null" [ IN, NULL OKAY ] and "data" [ IN, OPAQUE ] -
- *  optional callback function to handle NULL arguments. default
- *  behavior is to log error using "logerr" and invoke "exit".
- */
-const char * CC NextArg ( const char **argp, int *i, int argc, char *argv [],
-    const char * ( CC * handle_null ) ( void *data ), void *data )
-{
-    if ( argp != NULL )
-    {
-        const char *arg = * argp;
-        if ( arg != NULL && arg [ 0 ] != 0 && arg [ 1 ] != 0 )
-        {
-            * argp = "-";
-            return arg + 1;
-        }
-        return NextArgh ( i, argc, argv, handle_null, data );
-    }
-
-    /* report a fatal error if no arg given */
-    if ( handle_null == NULL )
-    {
-        rc_t rc = RC ( rcApp, rcArgv, rcAccessing, rcParam, rcNull );
-        LOGERR ( klogFatal, ( klogFatal, rc, "internal error" ));
-        exit ( 5 );
-    }
-
-    return ( * handle_null ) ( data );
-}
-#endif
-
-/* AsciiToXXX
- *  replacement for atoi
- *  converts NUL terminated string in "arg" to integer
- *  invokes error handler if there is a format error in string
- *
- *  "arg" [ IN ] - NUL terminated textual representation of integer
- *  obeys standard conversion rules:
- *    starts with "0x" or "0X" - interpret as hex
- *    starts with '0' - interpret as octal
- *    otherwise - interpret as decimal
- *
- *  "handler_error" [ IN, NULL OKAY ] and "data" [ IN, OPAQUE ] -
- *  optional callback function to handle case where "arg" could not
- *  be processed in its entirety. default behavior is to log error
- *  using "logerr" and invoke "exit".
- */
-static
-void CC HandleAsciiToIntError ( const char *arg, void *ignore )
-{
-    rc_t rc;
-
-    if ( arg == NULL )
-        rc = RC ( rcApp, rcNumeral, rcConverting, rcString, rcNull );
-    else if ( arg [ 0 ] == 0 )
-        rc = RC ( rcApp, rcNumeral, rcConverting, rcString, rcEmpty );
-    else
-        rc = RC ( rcApp, rcNumeral, rcConverting, rcString, rcInvalid );
-
-    LOGERR ( klogFatal, rc, "expected numeral" );
-    exit ( 10 );
-}
-
-int32_t CC AsciiToI32 ( const char *arg,
-    void ( CC * handle_error ) ( const char *arg, void *data ), void *data )
-{
-    if ( handle_error == NULL )
-        handle_error = HandleAsciiToIntError;
-
-    if ( arg != NULL && arg [ 0 ] != 0 )
-    {
-        char *end;
-        long int i = strtol ( arg, & end, 0 );
-        if ( end [ 0 ] == 0 )
-        {
-            if ( sizeof i == sizeof ( int32_t ) )
-                return ( int32_t ) i;
-
-            if ( ( ( i < 0 ) && ( ( ( uint64_t ) - i ) >> 32 ) == 0 ) ||
-                 ( ( i > 0 ) && ( ( ( uint64_t ) i ) >> 32 ) == 0 ) )
-                return ( int32_t ) i;
-        }
-    }
-
-    ( * handle_error ) ( arg, data );
-    return 0;
-}
-
-uint32_t CC AsciiToU32 ( const char *arg,
-    void ( CC * handle_error ) ( const char *arg, void *data ), void *data )
-{
-    if ( handle_error == NULL )
-        handle_error = HandleAsciiToIntError;
-
-    if ( arg != NULL && arg [ 0 ] != 0 )
-    {
-        char *end;
-        unsigned long int i = strtoul ( arg, & end, 0 );
-        if ( end [ 0 ] == 0 )
-        {
-            if ( sizeof i == sizeof ( uint32_t ) )
-                return ( uint32_t ) i;
-
-            if ( ( ( ( uint64_t ) i ) >> 32 ) == 0 )
-                return ( uint32_t ) i;
-        }
-    }
-
-    ( * handle_error ) ( arg, data );
-    return 0;
-}
-
-int64_t CC AsciiToI64 ( const char *arg,
-    void ( CC * handle_error ) ( const char *arg, void *data ), void *data )
-{
-    if ( handle_error == NULL )
-        handle_error = HandleAsciiToIntError;
-
-    if ( arg != NULL && arg [ 0 ] != 0 )
-    {
-        char *end;
-        int64_t i = strtoi64 ( arg, & end, 0 );
-
-        if ( end [ 0 ] == 0 )
-            return i;
-    }
-
-    ( * handle_error ) ( arg, data );
-    return 0;
-}
-
-uint64_t CC AsciiToU64 ( const char *arg,
-    void ( CC * handle_error ) ( const char *arg, void *data ), void *data )
-{
-    if ( handle_error == NULL )
-        handle_error = HandleAsciiToIntError;
-
-    if ( arg != NULL && arg [ 0 ] != 0 )
-    {
-        char *end;
-        uint64_t i = strtou64 ( arg, & end, 0 );
-
-        if ( end [ 0 ] == 0 )
-            return i;
-    }
-
-    ( * handle_error ) ( arg, data );
-    return 0;
-}
-
-/* KLogLevelParamStrings
- *  Used to compare against command line parameters
- *  These must match KLogLEvel enum in log.h
- */
-static
-void CC logLevelFromString ( const char * str, void *data )
-{
-    KLogLevel ix;
-    const char ** paramStrings;
-
-    paramStrings = KLogGetParamStrings();
-
-    for ( ix = klogLevelMin; ix <= klogLevelMax; ++ix )
-    {
-        if ( strcmp ( str, paramStrings [ ( int ) ix ] ) == 0 )
-        {
-            * ( int32_t* ) data = ix;
-            return;
-        }
-    }
-
-    /* this RC should reflect an invalid string parameter to set the log level */
-    PLOGERR ( klogFatal, ( klogFatal, RC ( rcApp, rcArgv, rcParsing, rcRange, rcInvalid ),
-                           "log level '$(lvl)' is unrecognized", "lvl=%s", str ));
-    exit ( 10 );
-}
-
-static
-rc_t LogLevelAbsolute ( const char * string )
-{
-    int32_t 	new_level;
-    int32_t	absolute_level = -1;	/* if this remains -1 then we didn't have a good symbolic string */
-
-    /* parse as if integer value but fail over to symbolic strings */
-    new_level = AsciiToU32 ( string, logLevelFromString, & absolute_level );
-
-    return KLogLevelSet( ( KLogLevel ) ( ( absolute_level == -1 ) ? new_level : absolute_level ) );
-}
-
-static
-rc_t LogLevelRelative ( const char * string )
-{
-    int32_t adjust = 0;
-    int i;
-
-    for ( i = 0; string [ i ] != 0; ++ i )
-    {
-        switch ( string [ i ] )
-        {
-        case '+':
-            ++ adjust;
-            break;
-            
-        case '-':
-            -- adjust;
-            break;
-            
-        default:
-            return RC ( rcApp, rcArgv, rcParsing, rcToken, rcUnrecognized );
-        }
-    }
-    KLogLevelAdjust(adjust);
-    return 0;
-}
-
-rc_t CC NextLogLevelCommon ( const char * level_parameter )
-{
-    if ( level_parameter == NULL )
-        return RC ( rcApp, rcArgv, rcParsing, rcString, rcNull );
-
-    if ( ( level_parameter [ 0 ] == '+' ) || ( level_parameter [ 0 ] == '-' ) )
-        return LogLevelRelative ( level_parameter );
-
-    return LogLevelAbsolute ( level_parameter );
-}
-
-#if 0
-static
-void CC HandleLogLevelError ( rc_t rc )
-{
-    LOGERR ( klogFatal, rc, "expected log level" );
-    exit ( 10 );
-}
-
-/* NextLogLevel
- *  handle a numeric or textual argument to --log-level <level>  The --log-level is not
- *  specified here and could be any string of the programmers choice
- */ 
-void CC NextLogLevel ( const char ** argp,
-		    int *ip,
-		    int argc,
-		    char *argv [],
-		    const char* ( CC * handle_null ) ( void *data ), void *data )
-{
-    rc_t rc = NextLogLevelCommon ( NextArg ( argp, ip, argc, argv, handle_null, data ) );
-    if ( rc != 0 )
-    {
-        if ( handle_null != NULL )
-            ( * handle_null ) ( data );
-        else
-            HandleLogLevelError ( rc );
-    }
-}
-
-/* NextLogLevelh
- *  handle a numeric or textual argument to --log-level <level>  The --log-level is not
- *  specified here and could be any string of the programmers choice
- */ 
-void CC NextLogLevelh (int *ip,
-		    int argc,
-		    char *argv [],
-		    const char* ( CC * handle_null ) ( void *data ), void *data )
-{
-    rc_t rc = NextLogLevelCommon ( NextArgh ( ip, argc, argv, handle_null, data ) );
-    if ( rc != 0 )
-    {
-        if ( handle_null != NULL )
-            ( * handle_null ) ( data );
-        else
-            HandleLogLevelError ( rc );
-    }
-}
-#endif
-
-/* KMane
- *  executable entrypoint "main" is implemented by
- *  an OS-specific wrapper that takes care of establishing
- *  signal handlers, logging, etc.
- *
- *  in turn, OS-specific "main" will invoke "KMain" as
- *  platform independent main entrypoint.
- *
- *  "argc" [ IN ] - the number of textual parameters in "argv"
- *  should never be < 0, but has been left as a signed int
- *  for reasons of tradition.
- *
- *  "argv" [ IN ] - array of NUL terminated strings expected
- *  to be in the shell-native character set: ASCII or UTF-8
- *  element 0 is expected to be executable identity or path.
- */
-static
-void CC atexit_task ( void )
-{
-    KProcMgrWhack ();
-}
-
-rc_t KMane ( int argc, char *argv [] )
-{
-    rc_t rc;
-
-    /* get application version */
-    ver_t vers = KAppVersion ();
-
-    /* initialize cleanup tasks */
-    int status = atexit ( atexit_task );
-    if ( status != 0 )
-        return SILENT_RC ( rcApp, rcNoTarg, rcInitializing, rcFunction, rcNotAvailable );
-
-    /* initialize error reporting */
-    ReportInit ( argc, argv, vers );
-
-    /* initialize proc mgr */
-    rc = KProcMgrInit ();
-    if ( rc != 0 )
-        return rc;
-
-    /* initialize logging */
-    rc = KWrtInit(argv[0], vers);
-    if ( rc == 0 )
-        rc = KLogLibHandlerSetStdErr ();
-    if ( rc == 0 )
-        rc = KStsLibHandlerSetStdOut ();
-
-    if ( rc == 0 )
-    {
-#if KFG_COMMON_CREATION
-        KConfig *kfg;
-        rc = KConfigMake ( & kfg );
-        if ( rc == 0 )
-        {
-#endif
-            rc = KMain ( argc, argv );
-            if ( rc != 0 )
-            {
-
-#if _DEBUGGING
-                rc_t rc2;
-                uint32_t lineno;
-                const char *filename, *function;
-                while ( GetUnreadRCInfo ( & rc2, & filename, & function, & lineno ) )
-                {
-                    pLogErr ( klogWarn, rc2, "$(filename):$(lineno) within $(function)"
-                              , "filename=%s,lineno=%u,function=%s"
-                              , filename
-                              , lineno
-                              , function
-                        );
-                }
-#endif
-
-            }
-#if KFG_COMMON_CREATION
-            KConfigRelease ( kfg );
-        }
-#endif
-    }
-
-    /* finalize error reporting */
-    ReportSilence ();
-    ReportFinalize ( rc );
-
-    return rc;
-}
diff --git a/libs/kapp/progressbar.c b/libs/kapp/progressbar.c
deleted file mode 100644
index 130efaf..0000000
--- a/libs/kapp/progressbar.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/*==============================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*/
-#include <kapp/extern.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <klib/debug.h>
-#include <klib/container.h>
-#include <kfs/directory.h>
-#include <kfs/file.h>
-#include <kapp/progressbar.h>
-
-#include <stdlib.h>
-#include <string.h>
-
-#define DBG(msg) DBGMSG(DBG_LOADLIB,DBG_FLAG(DBG_LOADLIB_PBAR), msg)
-
-struct KLoadProgressbar
-{
-    SLNode node;
-    bool active;
-    uint64_t used;
-    uint64_t total;
-};
-
-struct KJobs {
-    const char* severity;
-    SLList jobs;
-    uint64_t percent;
-} g_jobs =
-{
-    "status",
-    {NULL, NULL},
-    0
-};
-
-LIB_EXPORT rc_t CC KLoadProgressbar_Make(const KLoadProgressbar** cself, uint64_t size)
-{
-    rc_t rc = 0;
-    KLoadProgressbar* obj = NULL;
-
-    if( cself == NULL ) {
-        rc = RC(rcApp, rcFunction, rcConstructing, rcSelf, rcNull);
-    } else if( (obj = calloc(1, sizeof(*obj))) == NULL ) {
-        *cself = NULL;
-        rc = RC(rcApp, rcFunction, rcConstructing, rcMemory, rcExhausted);
-    } else {
-        DBG(("%s: %p %lu\n", __func__, obj, size));
-        SLListPushTail(&g_jobs.jobs, &obj->node);
-        *cself = obj;
-        obj->active = true;
-        obj->total = size;
-    }
-    return rc;
-}
-
-static
-bool CC job_active( SLNode *n, void *data )
-{
-    return ((KLoadProgressbar*)n)->active;
-}
-
-static
-void CC job_whack( SLNode *n, void *data )
-{
-    free(n);
-}
-
-struct job_data {
-    float percent;
-    uint64_t qty;
-};
-
-static
-void CC job_percent( SLNode *node, void *data )
-{
-    const KLoadProgressbar* n = (const KLoadProgressbar*)node;
-    struct job_data* d = (struct job_data*)data;
-    if (n->used && n->total)
-        d->percent += n->used * 100 / n->total;
-    d->qty++;
-}
-
-static
-void CC job_report(bool force_report, bool final)
-{
-    struct job_data d;
-
-    memset(&d, 0, sizeof(d));
-    SLListForEach(&g_jobs.jobs, job_percent, &d);
-    d.qty = (uint64_t) (d.qty ? d.percent / d.qty : (final ? 100 : 0) );
-    if( force_report || d.qty != g_jobs.percent ) {
-        g_jobs.percent = d.qty;
-        PLOGMSG(klogInfo, (klogInfo, "processed $(percent)%",
-            "severity=%s,percent=%lu", g_jobs.severity, g_jobs.percent));
-    }
-}
-
-LIB_EXPORT void CC KLoadProgressbar_Release(const KLoadProgressbar* cself, bool exclude)
-{
-    if( cself ) {
-        KLoadProgressbar* self = (KLoadProgressbar*)cself;
-        if( exclude ) {
-            SLListUnlink(&g_jobs.jobs, &self->node);
-            free(self);
-        } else {
-            self->active = false;
-        }
-        if( !SLListDoUntil(&g_jobs.jobs, job_active, NULL) ) {
-            /* no more active jobs: make last report and drop whole list */
-            job_report(false, true);
-            SLListWhack(&g_jobs.jobs, job_whack, NULL);
-        }
-    }
-}
-
-LIB_EXPORT rc_t CC KLoadProgressbar_Append(const KLoadProgressbar* cself, uint64_t chunk)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL ) {
-        rc = RC(rcApp, rcFunction, rcWriting, rcSelf, rcNull);
-    } else {
-        uint64_t c = cself->total + chunk;
-        DBG(("%s: +%lu\n", __func__, chunk));
-        if( c >= cself->total ) {
-            ((KLoadProgressbar*)cself)->total += chunk;
-        } else {
-            rc = RC(rcApp, rcFunction, rcResizing, rcData, rcOutofrange);
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KLoadProgressbar_File(const KLoadProgressbar** cself, const char* filename, const KDirectory* dir)
-{
-    rc_t rc = 0;
-    uint64_t sz;
-    KDirectory* tmp = (KDirectory*)dir;
-
-    if( cself == NULL || filename == NULL ) {
-        rc = RC(rcApp, rcFunction, rcWriting, rcParam, rcNull);
-    } else if( tmp == NULL && (rc = KDirectoryNativeDir(&tmp)) != 0 ) {
-    } else if( (rc = KDirectoryFileSize(tmp, &sz, filename)) == 0 ) {
-        rc = KLoadProgressbar_Make(cself, sz);
-    }
-    if( tmp != dir ) {
-        KDirectoryRelease(tmp);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KLoadProgressbar_KFile(const KLoadProgressbar** cself, const KFile* file)
-{
-    rc_t rc = 0;
-    uint64_t sz;
-
-    if( cself == NULL || file == NULL ) {
-        rc = RC(rcApp, rcFunction, rcWriting, rcParam, rcNull);
-    } else if( (rc = KFileSize(file, &sz)) == 0 ) {
-        rc = KLoadProgressbar_Make(cself, sz);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KLoadProgressbar_Process(const KLoadProgressbar* cself, uint64_t chunk, bool force_report)
-{
-    rc_t rc = 0;
-
-    if( cself == NULL ) {
-        rc = RC(rcApp, rcFunction, rcLogging, rcSelf, rcNull);
-    } else {
-        ((KLoadProgressbar*)cself)->used += chunk;
-        DBG(("%s: %p +%lu %lu of %lu\n", __func__, cself, chunk, cself->used, cself->total));
-        job_report(force_report, false);
-    }
-    return rc;
-}
diff --git a/libs/kapp/queue-file.c b/libs/kapp/queue-file.c
deleted file mode 100644
index e8dfd14..0000000
--- a/libs/kapp/queue-file.c
+++ /dev/null
@@ -1,925 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-typedef struct KQueueFile KQueueFile;
-#define KFILE_IMPL KQueueFile
-
-#include <kapp/extern.h>
-#include <kapp/queue-file.h>
-#include <kfs/file.h>
-#include <kfs/impl.h>
-#include <kproc/timeout.h>
-#include <kproc/thread.h>
-#include <kproc/queue.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <os-native.h>
-#include <klib/out.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-#if _DEBUGGING && 0
-#define DEFAULT_BLOCK_SIZE 4 * 1024
-#define QFMSG( msg, ... ) \
-    KOutMsg ( msg, __VA_ARGS__ )
-#else
-#define DEFAULT_BLOCK_SIZE 64 * 1024
-#define QFMSG( msg, ... ) \
-    ( void ) 0
-#endif
-
-#define DEFAULT_TIMEOUT_MS 150
-
-/*--------------------------------------------------------------------------
- * KQueueFileBuffer
- *  a block that describes its valid bytes and position
- */
-typedef struct KQueueFileBuffer KQueueFileBuffer;
-struct KQueueFileBuffer
-{
-    uint64_t pos;
-    size_t bytes;
-    rc_t rc;
-    uint32_t align;
-    uint8_t data [ 1 ];
-};
-
-static
-bool KQueueFileBufferContains ( const KQueueFileBuffer *self, uint64_t pos )
-{
-    if ( self != NULL )
-    {
-        if ( self -> pos <= pos && ( self -> pos + self -> bytes ) > pos )
-            return true;
-    }
-    return false;
-}
-
-
-/*--------------------------------------------------------------------------
- * KQueueFile
- *  an extension to KFile that runs on a background thread
- */
-struct KQueueFile
-{
-    KFile dad;
-
-    /* the source file's size on open */
-    uint64_t apparent_size;
-
-    /* starting position for read-ahead */
-    uint64_t start_pos;
-
-    /* the file really being accessed */
-    KFile *f;
-
-    /* buffer info */
-    KQueueFileBuffer *b;
-    size_t bsize;
-
-    /* thread and buffer queue */
-    KThread *t;
-    KQueue *q;
-
-    /* captured upon open */
-    rc_t rc_from_size_on_open;
-
-    /* timeout when queue is not responding */
-    uint32_t timeout_ms;
-};
-
-/* Whack
- */
-static
-rc_t KQueueFileWhackRead ( KQueueFile *self )
-{
-    void *b;
-
-    /* no more reading */
-    QFMSG ( "%s: sealing queue\n", __func__ );
-    KQueueSeal ( self -> q );
-
-    /* flush the queue */
-    QFMSG ( "%s: popping queue\n", __func__ );
-    while ( KQueuePop ( self -> q, & b, NULL ) == 0 )
-    {
-        QFMSG ( "%s: dousing a buffer\n", __func__ );
-        free ( b );
-    }
-
-    /* wait for thread to exit */
-    QFMSG ( "%s: waiting for bg thread to exit\n", __func__ );
-    KThreadWait ( self -> t, NULL );
-
-    /* tear it down */
-    QFMSG ( "%s: freeing object\n", __func__ );
-    free ( self -> b );
-    KThreadRelease ( self -> t );
-    KQueueRelease ( self -> q );
-    KFileRelease ( self -> f );
-    free ( self );
-
-    return 0;
-}
-
-static
-rc_t KQueueFileFlush ( KQueueFile *self, KQueueFileBuffer *b )
-{
-    rc_t rc;
-
-    /* timeout is in mS */
-    timeout_t tm;
-    QFMSG ( "%s: initializing timeout for %,umS\n", __func__, self->timeout_ms);
-    TimeoutInit ( & tm, self->timeout_ms );
-
-    /* push buffer */
-    QFMSG ( "%s: pushing buffer...\n", __func__ );
-    rc = KQueuePush ( self -> q, b, & tm );
-    QFMSG ( "%s: ...done: rc = %R\n", __func__, rc );
-    if ( rc != 0 )
-    {
-        /* see if the bg thread exited */
-        if ( GetRCState ( rc ) == rcReadonly )
-        {
-            rc = RC ( rcApp, rcFile, rcWriting, rcTransfer, rcIncomplete );
-            QFMSG ( "%s: resetting rc to %R\n", __func__, rc );
-        }
-        return rc;
-    }
-
-    QFMSG ( "%s: forgetting about buffer\n", __func__ );
-    self -> b = NULL;
-    return 0;
-}
-
-static
-rc_t KQueueFileWhackWrite ( KQueueFile *self )
-{
-    void *b;
-    rc_t rc = 0;
-
-    /* flush last buffer */
-    if ( self -> b != NULL )
-    {
-        QFMSG ( "%s: have non-null buffer\n", __func__ );
-        if ( self -> b -> bytes != 0 )
-        {
-            QFMSG ( "%s: buffer has %zu bytes\n", __func__, self -> b -> bytes );
-            rc = KQueueFileFlush ( self, self -> b );
-        }
-
-        free ( self -> b );
-        self -> b = NULL;
-    }
-
-    /* no more writing */
-    QFMSG ( "%s: sealing queue\n", __func__ );
-    KQueueSeal ( self -> q );
-
-    /* wait for thread to exit */
-    QFMSG ( "%s: waiting for bg thread to exit\n", __func__ );
-    KThreadWait ( self -> t, NULL );
-
-    /* the file should be written
-       but flush the queue if bg thread didn't */
-    QFMSG ( "%s: popping queue\n", __func__ );
-    while ( KQueuePop ( self -> q, & b, NULL ) == 0 )
-    {
-        QFMSG ( "%s: dousing a buffer\n", __func__ );
-        free ( b );
-    }
-
-    /* tear it down */
-    QFMSG ( "%s: freeing object\n", __func__ );
-    KThreadRelease ( self -> t );
-    KQueueRelease ( self -> q );
-    KFileRelease ( self -> f );
-    free ( self );
-
-    return rc;
-}
-
-/* GetSysFile
- *  returns an underlying system file object
- *  and starting offset to contiguous region
- *  suitable for memory mapping, or NULL if
- *  no such file is available.
- */
-static
-struct KSysFile* CC KQueueFileGetSysFile ( const KQueueFile *self, uint64_t *offset )
-{
-    return NULL;
-}
-
-/* RandomAccess
- *  ALMOST by definition, the file is random access
- *
- *  certain file types will refuse random access
- *  these include FIFO and socket based files, but also
- *  wrappers that require serial access ( e.g. compression )
- *
- *  returns 0 if random access, error code otherwise
- */
-static
-rc_t CC KQueueFileRandomAccess ( const KQueueFile *self )
-{
-    return RC ( rcFS, rcFile, rcAccessing, rcFunction, rcUnsupported );
-}
-
-/* Type
- *  returns a KQueueFileDesc
- *  not intended to be a content type,
- *  but rather an implementation class
- */
-static
-uint32_t CC KQueueFileType ( const KQueueFile *self )
-{
-    return kptFIFO;
-}
-
-/* Size
- *  returns size in bytes of file
- *
- *  "size" [ OUT ] - return parameter for file size
- */
-static
-rc_t CC KQueueFileSize ( const KQueueFile *self, uint64_t *size )
-{
-    * size = self -> apparent_size;
-    return self -> rc_from_size_on_open;
-}
-
-/* SetSize
- *  sets size in bytes of file
- *
- *  "size" [ IN ] - new file size
- */
-static
-rc_t CC KQueueFileSetSize ( KQueueFile *self, uint64_t size )
-{
-    return RC ( rcFS, rcFile, rcAccessing, rcFunction, rcUnsupported );
-}
-
-
-/* RunRead
- *  runs read loop on background thread
- */
-static
-rc_t CC KQueueFileRunRead ( const KThread *t, void *data )
-{
-    KQueueFile *self = data;
-
-    rc_t rc;
-    bool loop;
-    uint64_t pos;
-    size_t num_read;
-
-    QFMSG ( "BG: %s: running read-ahead loop\n", __func__ );
-    for ( rc = 0, loop = true, pos = self -> start_pos; loop; pos += num_read )
-    {
-        timeout_t tm;
-
-        KQueueFileBuffer *b = malloc ( sizeof * b - sizeof b -> data + self -> bsize );
-        if ( b == NULL )
-        {
-            rc = RC ( rcApp, rcFile, rcReading, rcMemory, rcExhausted );
-            QFMSG ( "BG: %s: failed to allocate %zu byte buffer\n", __func__, self -> bsize );
-            b = malloc ( sizeof * b );
-            if ( b == NULL )
-                break;
-
-            num_read = 0;
-            b -> rc = rc;
-            QFMSG ( "BG: %s: created empty buffer with rc = %R.\n", __func__, b -> rc );
-            loop = false;
-        }
-        else
-        {
-            QFMSG ( "BG: %s: reading %zu byte buffer\n", __func__, self -> bsize );
-            b -> rc = KFileReadAll ( self -> f, pos, b -> data, self -> bsize, & num_read );
-            QFMSG ( "BG: %s: read %zu bytes, rc = %R\n", __func__, num_read, b -> rc );
-            if ( b -> rc != 0 || num_read == 0 )
-                loop = false;
-        }
-
-        /* update buffer data */
-        b -> pos = pos;
-        b -> bytes = num_read;
-#if _DEBUGGING
-        b -> align = 0;
-#endif
-
-PushAgain:
-        /* timeout is in mS */
-        QFMSG ( "BG: %s: initializing timeout for %,umS\n", __func__, self->timeout_ms );
-        TimeoutInit ( & tm, self->timeout_ms );
-
-        /* push buffer */
-        QFMSG ( "BG: %s: pushing buffer...\n", __func__ );
-        rc = KQueuePush ( self -> q, b, & tm );
-        QFMSG ( "BG: %s: ...done: rc = %R\n", __func__, rc );
-        if ( rc != 0 )
-        {
-            /* if queue has been sealed by fg */
-            if ( GetRCState ( rc ) == rcReadonly )
-            {
-                rc = 0;
-                QFMSG ( "BG: %s: clearing rc\n", __func__ );
-
-            } else if( GetRCObject(rc) == rcTimeout && GetRCState(rc) == rcExhausted ) {
-                goto PushAgain;
-            }
-            QFMSG ( "BG: %s: dousing buffer\n", __func__ );
-            free ( b );
-            break;
-        }
-    }
-    
-    /* going to exit thread */
-    QFMSG ( "BG: %s: sealing thread\n", __func__ );
-    KQueueSeal ( self -> q );
-
-    QFMSG ( "BG: %s: exit with rc = %R\n", __func__, rc );
-    return rc;
-}
-
-/* Read
- *  read file from known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT ] - return parameter giving number of bytes
- *  actually read. when returned value is zero and return code is
- *  also zero, interpreted as end of file.
- */
-static
-rc_t CC KQueueFileNoRead ( const KQueueFile *self, uint64_t pos,
-    void *buffer, size_t bsize, size_t *num_read )
-{
-    return RC ( rcFS, rcFile, rcReading, rcFile, rcWriteonly );
-}
-
-static
-rc_t CC KQueueFileRead ( const KQueueFile *cself, uint64_t pos,
-    void *buffer, size_t bsize, size_t *num_read )
-{
-    rc_t rc;
-    size_t to_read;
-    KQueueFile *self = ( KQueueFile* ) cself;
-    KQueueFileBuffer *b = self -> b;
-
-    assert ( num_read != NULL );
-    assert ( * num_read == 0 );
-    assert ( buffer != NULL && bsize != 0 );
-
-    /* detect attempt to back up */
-    if ( b != NULL && pos < b -> pos )
-    {
-        QFMSG ( "%s: detected attempt to back up from %lu to %lu\n", __func__, b -> pos, pos );
-        return RC ( rcApp, rcFile, rcReading, rcConstraint, rcViolated );
-    }
-    
-    QFMSG ( "%s: loop to read %zu bytes at offset %lu\n", __func__, bsize, pos );
-    while ( ! KQueueFileBufferContains ( b, pos ) )
-    {
-        /* fetch next buffer */
-        KQueueFileBuffer *tmp;
-
-        /* timeout is in mS */
-        timeout_t tm;
-        QFMSG ( "%s: initializing timeout for %,umS\n", __func__, self->timeout_ms );
-        TimeoutInit ( & tm, self->timeout_ms );
-
-        /* pop buffer */
-        QFMSG ( "%s: popping buffer...\n", __func__ );
-        rc = KQueuePop ( self -> q, ( void** ) & tmp, & tm );
-        QFMSG ( "%s: ...done: rc = %R\n", __func__, rc );
-        if ( rc != 0 )
-        {
-            /* see if the bg thread is done */
-            if ( GetRCState ( rc ) == rcDone && GetRCObject ( rc ) == rcData )
-            {
-                QFMSG ( "%s: BG thread has exited with end-of-input\n", __func__ );
-                return 0;
-            } else if( GetRCObject(rc) == rcTimeout && GetRCState(rc) == rcExhausted ) {
-                continue; /* timeout is not a problem, try again */
-            }
-
-            QFMSG ( "%s: read failed with rc = %R\n", __func__, rc );
-            return rc;
-        }
-
-        /* queue is not supposed to be able to contain NULL */
-        assert ( tmp != NULL );
-
-        /* buffer may indicate read error or end of input */
-        if ( tmp -> rc != 0 || tmp -> bytes == 0 )
-        {
-            rc = tmp -> rc;
-            QFMSG ( "%s: BG thread has delivered %zu size buffer with rc = %R\n", __func__, tmp -> bytes, rc );
-            free ( tmp );
-            return rc;
-        }
-
-        /* free existing buffer */
-        if ( b != NULL )
-        {
-            QFMSG ( "%s: freeing buffer of %zu bytes at position %lu\n", __func__, b -> bytes, b -> pos );
-            free ( b );
-        }
-
-        /* take new buffer */
-        self -> b = b = tmp;
-        QFMSG ( "%s: caching buffer of %zu bytes at position %lu\n", __func__, b -> bytes, b -> pos );
-    }
-
-    pos -= b -> pos;
-    to_read = b -> bytes - ( size_t ) pos;
-    if ( to_read > bsize )
-        to_read = bsize;
-
-    QFMSG ( "%s: copying %zu bytes from buffer at local offset %lu\n", __func__, to_read, pos );
-    memcpy ( buffer, & b -> data [ pos ], to_read );
-
-    QFMSG ( "%s: successful read\n", __func__ );
-    * num_read = to_read;
-    return 0;
-}
-
-
-/* RunWrite
- *  runs write loop on background thread
- */
-static
-rc_t CC KQueueFileRunWrite ( const KThread *t, void *data )
-{
-    KQueueFile *self = data;
-
-    rc_t rc;
-    do
-    {
-        size_t num_writ;
-        KQueueFileBuffer *b;
-
-        /* timeout is in mS */
-        timeout_t tm;
-        TimeoutInit ( & tm, self->timeout_ms );
-
-        /* pop buffer */
-        rc = KQueuePop ( self -> q, ( void** ) & b, & tm );
-        if ( rc != 0 )
-        {
-            /* see if the fg thread is done */
-            if ( GetRCState ( rc ) == rcDone && GetRCObject ( rc ) == rcData )
-            {
-                rc = 0;
-            }
-            else if ( GetRCObject(rc) == rcTimeout && GetRCState(rc) == rcExhausted )
-            {
-                rc = 0;
-                continue;
-            }
-
-            break;
-        }
-
-        /* queue won't accept NULL object references */
-        assert ( b != NULL );
-
-        /* look at buffer for end of input */
-        if ( b -> rc != 0 || b -> bytes == 0 )
-        {
-            free ( b );
-            break;
-        }
-
-        /* write to file */
-        rc = KFileWriteAll ( self -> f, b -> pos, b -> data, b -> bytes, & num_writ );
-        assert ( num_writ == b -> bytes || rc != 0 );
-
-        /* TBD - need a better way to deal with this */
-        if ( rc != 0 )
-        {
-            PLOGERR ( klogSys, ( klogSys, rc, "$(func): wrote $(num_writ) of $(bytes) bytes to file",
-                                 "func=%s,num_writ=%zu,bytes=%zu", __func__, num_writ, b -> bytes ) );
-        }
-
-        /* done with buffer */
-        free ( b );
-    }
-    while ( rc == 0 );
-
-    /* going to exit thread */
-    KQueueSeal ( self -> q );
-
-    return rc;
-}
-
-/* Write
- *  write file at known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ IN ] and "size" [ IN ] - data to be written
- *
- *  "num_writ" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually written
- */
-static
-rc_t CC KQueueFileNoWrite ( KQueueFile *self, uint64_t pos,
-    const void *buffer, size_t size, size_t *num_writ )
-{
-    return RC ( rcApp, rcFile, rcWriting, rcFile, rcReadonly );
-}
-
-static
-rc_t CC KQueueFileWrite ( KQueueFile *self, uint64_t pos,
-    const void *buffer, size_t size, size_t *num_writ )
-{
-    rc_t rc;
-    size_t total, to_write;
-
-    for ( rc = 0, total = 0; total < size; pos += to_write, total += to_write )
-    {
-        /* current buffer */
-        KQueueFileBuffer *b = self -> b;
-
-        /* if we have a buffer, test for a write within bounds */
-        if ( self -> b != NULL )
-        {
-            /* an attempt to write first byte BEFORE
-               current buffer or BEYOND current contents
-               or AT current end while being full provokes
-               a flush of the current buffer */
-            if ( pos < b -> pos ||
-                 pos > b -> pos + b -> bytes ||
-                 pos == b -> pos + self -> bsize )
-            {
-                rc = KQueueFileFlush ( self, b );
-                if ( rc != 0 )
-                {   /* the background thread is probably gone */
-                    break;
-                }
-            }
-        }
-
-        /* if by now we don't have a buffer, allocate one */
-        if ( self -> b == NULL )
-        {
-            b = malloc ( sizeof * b - sizeof b -> data + self -> bsize );
-            if ( b == NULL )
-            {
-                rc = RC ( rcApp, rcFile, rcWriting, rcMemory, rcExhausted );
-                break;
-            }
-
-            self -> b = b;
-            b -> pos = pos/* + total*/;
-            b -> bytes = 0;
-            b -> rc = 0;
-#if _DEBUGGING
-            b -> align = 0;
-#endif
-        }
-
-        assert ( b != NULL );
-        assert ( b == self -> b );
-/*        assert ( pos >= b -> pos ); */
-        assert ( pos <= b -> pos + b -> bytes );
-        assert ( pos < b -> pos + self -> bsize );
-
-        /* write into the buffer */
-        to_write = size - total;
-        if ( b -> bytes + to_write > self -> bsize )
-            to_write = self -> bsize - b -> bytes;
-
-        memcpy ( & b -> data [ b -> bytes ], & ( ( const uint8_t* ) buffer ) [ total ], to_write );
-        b -> bytes += to_write;
-    }
-
-
-    * num_writ = total;
-    if ( total != 0 )
-        return 0;
-
-    return rc;
-}
-
-
-static KFile_vt_v1 KQueueFileRead_vt_v1 =
-{
-    /* version 1.1 */
-    1, 1,
-
-    /* v1.0 */
-    KQueueFileWhackRead,
-    KQueueFileGetSysFile,
-    KQueueFileRandomAccess,
-    KQueueFileSize,
-    KQueueFileSetSize,
-    KQueueFileRead,
-    KQueueFileNoWrite,
-
-    /* v1.1 */
-    KQueueFileType
-};
-
-
-static KFile_vt_v1 KQueueFileWrite_vt_v1 =
-{
-    /* version 1.1 */
-    1, 1,
-
-    /* v1.0 */
-    KQueueFileWhackWrite,
-    KQueueFileGetSysFile,
-    KQueueFileRandomAccess,
-    KQueueFileSize,
-    KQueueFileSetSize,
-    KQueueFileNoRead,
-    KQueueFileWrite,
-
-    /* v1.1 */
-    KQueueFileType
-};
-
-
-/* MakeRead
- *  make a queue file for reading-ahead on background thread
- *
- *  when the file is created, a background thread is started
- *  that begins reading from "src" at position "pos", into
- *  buffers of size "buffer_size". each buffer is pushed into
- *  a cross-thread queue where it is consumed by the reading
- *  thread.
- *
- *  the background thread is throttled by queue capacity - determined
- *  by "queue_bytes" and "block_size", such that if the queue is full,
- *  the thread will sleep. the consumer thread is also throttled by the
- *  queue in that it will sleep if the queue is empty with pending data.
- *
- *  the background thread will exit upon reaching end of file,
- *  upon a permanent error, or if the queue is sealed by the consumer
- *  thread.
- *
- *  when the file is collected in response to a release message,
- *  the queue will be sealed against further inserts, pending buffers
- *  will be discarded, the background thread will be joined, and
- *  the source file will be released.
- *
- *  the intended usage is serial reading of the file. reads
- *  may only progress forward, i.e. backing up is not permitted.
- *
- *  "qf" [ OUT ] - return parameter for queue file
- *
- *  "pos" [ IN ] - starting position for reads from "src".
- *  NB - "src" must support being addressed at this position.
- *
- *  "src" [ IN ] - source file for read-ahead on background thread.
- *  must have read permissions.
- *
- *  "queue_bytes" [ IN ] - the read-ahead limit of the background
- *  thread, in bytes. this is the amount of data that will be queued
- *  for the consumer thread before the bg thread sleeps.
- *
- *  "block_size" [ IN, DEFAULT ZERO ] - optional parameter giving
- *  desired block size when reading from "src". this may be used
- *  to tune reading for source data, e.g. 64K blocks for gzip.
- */
-LIB_EXPORT rc_t CC KQueueFileMakeRead ( const KFile **qfp, uint64_t pos,
-    const KFile *src, size_t queue_bytes, size_t block_size, uint32_t timeout_ms )
-{
-    rc_t rc;
-
-    if ( qfp == NULL )
-        rc = RC ( rcApp, rcFile, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( src == NULL )
-            rc = RC ( rcApp, rcFile, rcConstructing, rcFile, rcNull );
-        else if ( ! src -> read_enabled )
-        {
-            if ( src -> write_enabled )
-                rc = RC ( rcApp, rcFile, rcConstructing, rcFile, rcWriteonly );
-            else
-                rc = RC ( rcApp, rcFile, rcConstructing, rcFile, rcNoPerm );
-        }
-        else if ( pos == 0 || ( rc = KFileRandomAccess ( src ) ) == 0 )
-        {
-            KQueueFile *qf = malloc ( sizeof * qf );
-            if ( qf == NULL )
-                rc = RC ( rcApp, rcFile, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                rc = KFileInit ( & qf -> dad, ( const KFile_vt* ) & KQueueFileRead_vt_v1, "KQueueFile", "no-name", true, false );
-                if ( rc == 0 )
-                {
-                    qf -> f = ( KFile* ) src;
-                    rc = KFileAddRef ( src );
-                    if ( rc == 0 )
-                    {
-                        uint32_t capacity;
-
-                        /* zero block size means default */
-                        if ( block_size == 0 )
-                            block_size = DEFAULT_BLOCK_SIZE;
-
-                        /* queue capacity is expressed in bytes originally
-                           translate to buffer count */
-                        capacity = ( queue_bytes + block_size - 1 ) / block_size;
-                        if ( capacity == 0 )
-                            capacity = 1;
-
-                        /* actual capacity will be a power of 2 */
-                        rc = KQueueMake ( & qf -> q, capacity );
-                        if ( rc == 0 )
-                        {
-                            /* capture current size if supported */
-                            qf -> rc_from_size_on_open = KFileSize ( src, & qf -> apparent_size );
-
-                            /* starting position for read */
-                            qf -> start_pos = pos;
-
-                            /* requested buffer size */
-                            qf -> b = NULL;
-                            qf -> bsize = block_size;
-
-                            /* timeout */
-                            qf -> timeout_ms = timeout_ms == 0 ? DEFAULT_TIMEOUT_MS : timeout_ms;
-
-                            /* finally, start the background thread */
-                            rc = KThreadMake ( & qf -> t, KQueueFileRunRead, qf );
-                            if ( rc == 0 )
-                            {
-                                * qfp = & qf -> dad;
-                                return 0;
-                            }
-
-                            KQueueRelease ( qf -> q );
-                        }
-
-                        KFileRelease ( qf -> f );
-                    }
-                }
-
-                free ( qf );
-            }
-        }
-
-        * qfp = NULL;
-    }
-
-    return rc;
-}
-
-
-/* MakeWrite
- *  make a queue file for writing-behind on background thread
- *
- *  when the file is created, a background thread is started that
- *  waits for buffers to appear in the cross-thread queue. as the producer
- *  thread writes, data are accumulated into buffers which are pushed
- *  into the queue as they fill, and written in turn on the bg thread.
- *
- *  the producer thread is throttled by queue capacity - determined by
- *  "queue_bytes" and "block_size", such that if the queue is full,
- *  the thread will sleep. the background thread is also throttled by
- *  the queue in that it will sleep if the queue is empty with pending
- *  data.
- *
- *  the background thread will exit upon a permanent error, or if the
- *  queue is sealed by the producer thread.
- *
- *  when the file is collected in response to a release message,
- *  the queue will be sealed against further inserts, pending buffers
- *  will be written, the background thread will be joined, and
- *  the source file will be released.
- *
- *  the intended usage is serial writing of the file. random writes
- *  will be accepted, but may reduce the queue efficiency.
- *
- *  "qf" [ OUT ] - return parameter for queue file
- *
- *  "dst" [ IN ] - destination file for write-behind on background thread.
- *  must have write permissions.
- *
- *  "queue_bytes" [ IN ] - the write-behind limit of the producer
- *  thread, in bytes. this is the amount of data that will be queued
- *  for the background thread before the producer thread sleeps.
- *
- *  "block_size" [ IN, DEFAULT ZERO ] - optional parameter giving
- *  desired block size when writing to "dst". this may be used
- *  to tune writing for source data, e.g. 64K blocks for gzip.
- */
-LIB_EXPORT rc_t CC KQueueFileMakeWrite ( KFile **qfp,
-    KFile *dst, size_t queue_bytes, size_t block_size, uint32_t timeout_ms )
-{
-    rc_t rc;
-
-    if ( qfp == NULL )
-        rc = RC ( rcApp, rcFile, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( dst == NULL )
-            rc = RC ( rcApp, rcFile, rcConstructing, rcFile, rcNull );
-        else if ( ! dst -> write_enabled )
-        {
-            if ( dst -> read_enabled )
-                rc = RC ( rcApp, rcFile, rcConstructing, rcFile, rcReadonly );
-            else
-                rc = RC ( rcApp, rcFile, rcConstructing, rcFile, rcNoPerm );
-        }
-        else
-        {
-            KQueueFile *qf = malloc ( sizeof * qf );
-            if ( qf == NULL )
-                rc = RC ( rcApp, rcFile, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                rc = KFileInit ( & qf -> dad, ( const KFile_vt* ) & KQueueFileWrite_vt_v1, "KQueueFile", "no-name", false, true );
-                if ( rc == 0 )
-                {
-                    qf -> f = dst;
-                    rc = KFileAddRef ( dst );
-                    if ( rc == 0 )
-                    {
-                        uint32_t capacity;
-
-                        /* zero block size means default */
-                        if ( block_size == 0 )
-                            block_size = DEFAULT_BLOCK_SIZE;
-
-                        /* queue capacity is expressed in bytes originally
-                           translate to buffer count */
-                        capacity = ( queue_bytes + block_size - 1 ) / block_size;
-                        if ( capacity == 0 )
-                            capacity = 1;
-
-                        /* actual capacity will be a power of 2 */
-                        rc = KQueueMake ( & qf -> q, capacity );
-                        if ( rc == 0 )
-                        {
-                            /* capture current size if supported */
-                            qf -> rc_from_size_on_open = KFileSize ( dst, & qf -> apparent_size );
-
-                            /* starting position not used */
-                            qf -> start_pos = 0;
-
-                            /* requested buffer size */
-                            qf -> b = NULL;
-                            qf -> bsize = block_size;
-
-                            /* timeout */
-                            qf -> timeout_ms = timeout_ms == 0 ? DEFAULT_TIMEOUT_MS : timeout_ms;
-
-                            /* finally, start the background thread */
-                            rc = KThreadMake ( & qf -> t, KQueueFileRunWrite, qf );
-                            if ( rc == 0 )
-                            {
-                                * qfp = & qf -> dad;
-                                return 0;
-                            }
-
-                            KQueueRelease ( qf -> q );
-                        }
-
-                        KFileRelease ( qf -> f );
-                    }
-                }
-
-                free ( qf );
-            }
-        }
-
-        * qfp = NULL;
-    }
-
-    return rc;
-}
diff --git a/libs/kapp/tokenizer.c b/libs/kapp/tokenizer.c
deleted file mode 100644
index 27cfdce..0000000
--- a/libs/kapp/tokenizer.c
+++ /dev/null
@@ -1,525 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kapp/extern.h>
-#include <sysalloc.h>
-
-#include <kapp/args.h>
-
-#include <klib/rc.h>
-#include <klib/log.h>
-#include <klib/text.h>
-
-#include <vfs/path.h>
-#include <vfs/manager.h>
-#include <kfs/file.h>
-
-#include <os-native.h>
-
-#include <string.h>
-#include <stdlib.h>
-
-
-#define ARGV_INC 10
-#define TOKEN_INC 512
-
-/*
-   strtok() not used, because we tokenize the content of a file!
-   we do that in chunks of 4096 char's
-   a token can span multiple chunks!
-   we also support quoting and escaping ( a la bash )
-*/
-
-typedef struct tokenzr
-{
-    int * argc;
-    char *** argv;
-    char *token;
-    size_t allocated;
-    size_t used;
-    uint32_t state;
-    uint32_t nargs;
-    char escape[ 3 ];
-    char n_escape;
-    char m_escape;
-} tokenzr;
-
-
-static rc_t make_tokenzr( tokenzr **t, int * argc, char *** argv )
-{
-    rc_t rc = 0;
-    if ( t == NULL )
-    {
-        rc = RC( rcApp, rcNoTarg, rcConstructing, rcSelf, rcNull );
-    }
-    else
-    {
-        tokenzr *t1 = malloc( sizeof *t1 );
-        if ( t1 == NULL )
-        {
-            rc = RC( rcApp, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
-        }
-        else
-        {
-            t1->token = malloc( TOKEN_INC );
-            if ( t1->token == NULL )
-            {
-                rc = RC( rcApp, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
-            }
-            else
-            {
-                t1->allocated = TOKEN_INC;
-                t1->used = 0;
-                t1->state = 0;
-                t1->nargs = 0;
-                t1->argc = argc;
-                t1->argv = argv;
-                t1->n_escape = 0;
-                t1->m_escape = 0;
-            }
-        }
-        if ( rc == 0 )
-        {
-            *t = t1;
-        }
-    }
-    return rc;
-}
-
-
-static void free_tokenzr( tokenzr *t )
-{
-    if ( t != NULL )
-    {
-        if ( t->token != NULL )
-            free( t->token );
-        free( t );
-    }
-}
-
-
-static rc_t expand_argv( tokenzr *t )
-{
-    rc_t rc = 0;
-    char ** pargv = *(t->argv);
-
-    if ( pargv == NULL )
-    {
-        pargv = malloc( ARGV_INC * ( sizeof pargv[ 0 ] ) );
-        if ( pargv != NULL )
-        {
-            t->nargs = ARGV_INC;
-            ( *(t->argc) ) = 0;
-        }
-        else
-            rc = RC( rcApp, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
-    }
-    else
-    {
-        if ( (uint32_t) ( *(t->argc) ) >= t->nargs )
-        {
-            char ** pargv1 = realloc( pargv, ( ( t->nargs + ARGV_INC ) * ( sizeof pargv[ 0 ] ) ) );
-            if ( pargv1 != NULL )
-            {
-                t->nargs += ARGV_INC;
-                pargv = pargv1;
-            }
-            else
-            {
-                rc = RC( rcApp, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
-                free( pargv );
-                pargv = NULL;
-            }
-        }
-    }
-    if ( rc == 0 )
-    {
-        *(t->argv) =  pargv;
-    }
-    return rc;
-}
-
-
-static rc_t add_string_to_argv( tokenzr *t, const char * str, size_t len )
-{
-    rc_t rc = expand_argv( t );
-    if ( rc == 0 )
-    {
-        int argc = *(t->argc);
-        char ** pargv = *(t->argv);
-
-        pargv[ argc ] = string_dup ( str, len );
-        if ( pargv[ argc ] == NULL )
-            rc = RC( rcApp, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            ( *(t->argc) )++;
-            *(t->argv) =  pargv;
-            t->used = 0;
-        }
-    }
-    return rc;
-}
-
-
-static rc_t add_token_to_argv( tokenzr *t )
-{
-    return add_string_to_argv( t, t->token, t->used );
-}
-
-
-static rc_t add_buffer_to_token( tokenzr *t, const char *buffer, size_t buflen )
-{
-    rc_t rc = 0;
-    if ( t->used + buflen > t->allocated )
-    {
-        size_t new_size = t->used + buflen + TOKEN_INC;
-        char * temp = realloc( t->token, new_size );
-        if ( temp == NULL )
-        {
-            rc = RC( rcApp, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
-        }
-        else
-        {
-            t->token = temp;
-            t->allocated = new_size;
-        }
-    }
-    if ( rc == 0 )
-    {
-        memcpy( t->token + t->used, buffer, buflen );
-        t->used += buflen;
-    }
-    return rc;
-}
-
-
-/* this is the 'normal' state, that the buffer is divided into tokens by white-space */
-const static char delim0[] = " \r\n\f\t\v\\\"";
-static rc_t tokenize_state0( tokenzr *t, bool *done, char ** ptr, const char *buffer, size_t buflen )
-{
-    rc_t rc;
-    char * s = strpbrk ( *ptr, delim0 );
-    if ( s == NULL )
-    {
-        /* delimiting char not found!
-            ---> add everything to the tokenbuffer */
-        size_t to_add = buflen - ( *ptr - buffer );
-        rc = add_buffer_to_token( t, *ptr, to_add );
-        *done = true;
-    }
-    else
-    {
-        /* delimiting char found!
-            ---> add everything from ptr to s to the tokenbuffer
-            ---> then add token to argv
-            ---> then clear token */
-        rc = add_buffer_to_token( t, *ptr, s - *ptr );
-        if ( rc == 0 )
-        {
-            if ( t->used > 0 && *s != '\\' )
-                rc = add_token_to_argv( t );
-            *ptr = s + 1;
-            *done = ( *ptr >= buffer + buflen );
-            switch( *s )
-            {
-                case '"'  : t->state =  1; break;
-                case '\\' : t->state =  2; break;
-            }
-        }
-    }
-    return rc;
-}
-
-
-/* this state, provides 'quoting' ( prevents tokenizing by putting quotes "" around strings
-    which would be otherwise separated by whitespace ) */
-const static char delim1[] = "\"";
-static rc_t tokenize_state1( tokenzr *t, bool *done, char ** ptr, const char *buffer, size_t buflen )
-{
-    rc_t rc;
-    char * s = strpbrk ( *ptr, delim1 );
-    if ( s == NULL )
-    {
-        /* delimiting char not found!
-            ---> add everything to the tokenbuffer */
-        size_t to_add = buflen - ( *ptr - buffer );
-        rc = add_buffer_to_token( t, *ptr, to_add );
-        *done = true;
-    }
-    else
-    {
-        /* delimiting char found!
-            ---> add everything from ptr to s to the tokenbuffer
-            ---> then add token to argv
-            ---> then clear token */
-        rc = add_buffer_to_token( t, *ptr, s - *ptr );
-        if ( rc == 0 )
-        {
-            if ( t->used > 0 )
-                rc = add_token_to_argv( t );
-            *ptr = s + 1;
-            *done = ( *ptr >= buffer + buflen );
-            if ( *s == '"' )
-                t->state = 0;
-        }
-    }
-    return rc;
-}
-
-
-/* this state, provides 'escaping' ( \nnn or \xHH or \' or \" ) */
-static rc_t tokenize_state2( tokenzr *t, bool *done, char ** ptr, const char *buffer, size_t buflen )
-{
-    rc_t rc = 0;
-    char c = **ptr;
-    switch( c )
-    {
-        case '\\' : /* no break intended ! */
-        case '\'' :
-        case '\"' : rc = add_buffer_to_token( t, (*ptr)++, 1 );
-                    break;
-
-        case 't'  : rc = add_buffer_to_token( t, "\t", 1 );
-                    (*ptr)++;
-                    break;
-        case 'n'  : rc = add_buffer_to_token( t, "\n", 1 );
-                    (*ptr)++;
-                    break;
-        case 'r'  : rc = add_buffer_to_token( t, "\r", 1 );
-                    (*ptr)++;
-                    break;
-
-    }
-    t->state = 0;
-    *done = ( *ptr >= buffer + buflen );
-    return rc;
-}
-
-
-static rc_t tokenize_buffer( tokenzr *t, const char *buffer, size_t buflen )
-{
-    rc_t rc = 0;
-    char * ptr = ( char * ) buffer;
-    bool done = false;
-    while ( rc == 0 && !done )
-        switch( t->state )
-        {
-            case 0 : rc = tokenize_state0( t, &done, &ptr, buffer, buflen ); break;
-            case 1 : rc = tokenize_state1( t, &done, &ptr, buffer, buflen ); break;
-            case 2 : rc = tokenize_state2( t, &done, &ptr, buffer, buflen ); break;
-        }
-    return rc;
-}
-
-
-static rc_t tokenize_file_and_progname_into_argv( const char * filename, const char * progname,
-                                                  int * argc, char *** argv )
-{
-    rc_t rc2, rc = 0;
-    VFSManager *vfs_mgr;
-
-    ( *argv ) = NULL;
-    ( *argc ) = 0;
-    rc = VFSManagerMake ( &vfs_mgr );
-    if ( rc != 0 )
-        LOGERR( klogInt, rc, "VFSManagerMake() failed" );
-    else
-    {
-        VPath * vfs_path;
-        rc = VFSManagerMakePath ( vfs_mgr, &vfs_path, filename );
-        if ( rc != 0 )
-            LOGERR( klogInt, rc, "VPathMake() failed" );
-        else
-        {
-            struct KFile const *my_file;
-            rc = VFSManagerOpenFileRead ( vfs_mgr, &my_file, vfs_path );
-            if ( rc != 0 )
-                LOGERR( klogInt, rc, "VFSManagerOpenFileRead() failed" );
-            else
-            {
-                tokenzr *t;
-                uint64_t pos = 0;
-                char buffer[ 4096 + 1 ];
-                size_t num_read;
-
-                rc = make_tokenzr( &t, argc, argv );
-                if ( rc != 0 )
-                    LOGERR( klogInt, rc, "make_tokenzr() failed" );
-                else
-                {
-                    if ( progname != NULL )
-                        rc = add_string_to_argv( t, progname, string_size( progname ) );
-
-                    if ( rc == 0 )
-                    {
-                        do
-                        {
-                            rc = KFileRead ( my_file, pos, buffer, ( sizeof buffer ) - 1, &num_read );
-                            if ( rc != 0 )
-                                LOGERR( klogInt, rc, "KFileRead() failed" );
-                            else if ( num_read > 0 )
-                            {
-                                buffer[ num_read ]  = 0;
-                                rc = tokenize_buffer( t, buffer, num_read );
-                                if ( rc != 0 )
-                                    LOGERR( klogInt, rc, "tokenize_buffer() failed" );
-                                pos += num_read;
-                            }
-                        } while ( rc == 0 && num_read > 0 );
-                    }
-
-                    if ( rc == 0 && t->used > 0 )
-                    {
-                        rc = add_token_to_argv( t );
-                        if ( rc != 0 )
-                            LOGERR( klogInt, rc, "add_token_to_argv() failed" );
-                    }
-                    free_tokenzr( t );
-                }
-                rc2 = KFileRelease ( my_file );
-                if ( rc2 != 0 )
-                    LOGERR( klogInt, rc2, "KFileRelease() failed" );
-            }
-            rc2 = VPathRelease ( vfs_path );
-            if ( rc2 != 0 )
-                LOGERR( klogInt, rc2, "VPathRelease() failed" );
-        }
-        rc2 = VFSManagerRelease ( vfs_mgr );
-        if ( rc2 != 0 )
-            LOGERR( klogInt, rc2, "VFSManagerRelease() failed" );
-    }
-    return rc;
-}
-
-
-rc_t CC Args_tokenize_file_into_argv( const char * filename, int * argc, char *** argv )
-{
-    return tokenize_file_and_progname_into_argv( filename, NULL, argc, argv );
-}
-
-
-rc_t CC Args_tokenize_file_and_progname_into_argv( const char * filename, const char * progname,
-                                                               int * argc, char *** argv )
-{
-    return tokenize_file_and_progname_into_argv( filename, progname, argc, argv );
-}
-
-
-void CC Args_free_token_argv( int argc, char * argv[] )
-{
-    if ( argv != NULL )
-    {
-        int i;
-        for ( i = 0; i < argc; ++i )
-            free( argv[ i ] );
-        free( argv );
-    }
-}
-
-
-static int sized_str_cmp( const char *a, const char *b )
-{
-    size_t asize = string_size ( a );
-    size_t bsize = string_size ( b );
-    return strcase_cmp ( a, asize, b, bsize, (uint32_t) ( ( asize > bsize ) ? asize : bsize ) );
-}
-
-
-/* get's the filename following a file_option - parameter into the file-name-buffer */
-rc_t CC Args_find_option_in_argv( int argc, char * argv[],
-                                              const char * option_name,
-                                              char * option, size_t option_len )
-{
-    rc_t rc = 0;
-    int i, opt_idx;
-
-    if ( option == NULL )
-        return RC( rcRuntime, rcArgv, rcConstructing, rcParam, rcNull );
-
-    option[ 0 ] = 0;
-
-    if ( argv == NULL || argc < 1 )
-        return RC( rcRuntime, rcArgv, rcConstructing, rcSelf, rcNull );
-    if ( option_name == NULL || option_len == 0 )
-        return RC( rcRuntime, rcArgv, rcConstructing, rcParam, rcNull );
-
-    opt_idx = -1;
-    for ( i = 0; i < argc && ( option[ 0 ] == 0 ); ++i )
-    {
-        if ( sized_str_cmp( (const char *)argv[i], option_name ) == 0 )
-        {
-                opt_idx = ( i + 1 );
-        }
-        else if ( i == opt_idx )
-        {
-            string_copy( option, option_len, argv[i], string_size( argv[i] ) );
-        }
-    }
-    if ( option[ 0 ] == 0 )
-        rc = RC( rcRuntime, rcArgv, rcConstructing, rcParam, rcNotFound );
-    return rc;
-}
-
-
-rc_t CC Args_parse_inf_file( Args * args, const char * file_option )
-{
-    uint32_t count;
-    rc_t rc = ArgsOptionCount( args, file_option, &count );
-    if ( rc != 0 )
-        LOGERR( klogInt, rc, "ArgsOptionCount() failed" );
-    else if ( count > 0 )
-    {
-        uint32_t count2 = 0;
-        do
-        {
-            uint32_t idx;
-            for ( idx = count2; idx < count && rc == 0; ++idx )
-            {
-                const char *filename;
-                rc = ArgsOptionValue( args, file_option, idx, &filename );
-                if ( rc != 0 )
-                    LOGERR( klogInt, rc, "ArgsOptionValue() failed" );
-                else if ( filename != NULL )
-                {
-                    int argc;
-                    char ** argv;
-                    rc = Args_tokenize_file_into_argv( filename, &argc, &argv );
-                    if ( rc == 0 && argv != NULL && argc > 0 )
-                    {
-                        rc = ArgsParse ( args, argc, argv );
-                        Args_free_token_argv( argc, argv );
-                    }
-                }
-            }
-            count2 = count;
-            rc = ArgsOptionCount( args, file_option, &count );
-            if ( rc != 0 )
-                LOGERR( klogInt, rc, "ArgsOptionCount() failed" );
-        } while ( rc == 0 && count > count2 );
-    }
-    return rc;
-}
diff --git a/libs/kapp/unix/sysmain.c b/libs/kapp/unix/sysmain.c
deleted file mode 100644
index 8bb8925..0000000
--- a/libs/kapp/unix/sysmain.c
+++ /dev/null
@@ -1,238 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include "../main-priv.h"
-#include <sysalloc.h>
-#include <kapp/main.h>
-#include <klib/log.h>
-#include <klib/debug.h>
-#include <klib/status.h>
-#include <klib/report.h>
-#include <klib/rc.h>
-#include <atomic32.h>
-
-#include <unistd.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-#include <errno.h>
-#include <assert.h>
-
-#if ! _DEBUGGING && ! defined CATCH_SIGSEGV
-#define CATCH_SIGSEGV 1
-#endif
-
-#if ! defined CATCH_SIGHUP
-#define CATCH_SIGHUP 0
-#endif
-
-/*--------------------------------------------------------------------------
- * Main
- */
-
-static bool no_hup;
-static atomic32_t hangup;
-static atomic32_t quitting;
-
-/* Quitting
- *  is the program supposed to exit
- */
-rc_t Quitting ( void )
-{
-    if ( atomic32_read ( & quitting ) == 0 )
-        return 0;
-    LOGMSG ( klogInfo, "EXITING..." );
-    return RC ( rcExe, rcProcess, rcExecuting, rcProcess, rcCanceled );
-}
-
-/* SignalQuit
- *  tell the program to quit
- */
-rc_t SignalQuit ( void )
-{
-    ReportSilence ();
-
-    if ( kill ( 0, SIGTERM ) != 0 ) switch ( errno )
-    {
-    case EINVAL:
-        return RC ( rcExe, rcProcess, rcSignaling, rcMessage, rcInvalid );
-    case EPERM:
-        return RC ( rcExe, rcProcess, rcSignaling, rcMessage, rcUnauthorized );
-    default:
-        return RC ( rcExe, rcProcess, rcSignaling, rcNoObj, rcUnknown );
-    }
-    return 0;
-}
-
-/* Hangup
- *  has the program received a SIGHUP
- */
-rc_t Hangup ( void )
-{
-    if ( atomic32_read ( & hangup ) == 0 )
-        return 0;
-    LOGMSG ( klogInfo, "HANGUP...\n" );
-    return RC ( rcExe, rcProcess, rcExecuting, rcProcess, rcIncomplete );
-}
-
-/* SignalHup
- *  send the program a SIGHUP
- */
-rc_t SignalHup ( void )
-{
-    if ( kill ( 0, SIGHUP ) != 0 ) switch ( errno )
-    {
-    case EINVAL:
-        return RC ( rcExe, rcProcess, rcSignaling, rcMessage, rcInvalid );
-    case EPERM:
-        return RC ( rcExe, rcProcess, rcSignaling, rcMessage, rcUnauthorized );
-    default:
-        return RC ( rcExe, rcProcess, rcSignaling, rcNoObj, rcUnknown );
-    }
-    return 0;
-}
-
-/* SignalNoHup
- *  tell the program to stay alive even after SIGHUP
- */
-rc_t SignalNoHup ( void )
-{
-    no_hup = true;
-    return 0;
-}
-
-/* SigHupHandler
- */
-static
-void SigHupHandler ( int sig )
-{
-    ( ( void ) sig );
-    atomic32_inc ( & hangup );
-    if ( ! no_hup )
-        atomic32_inc ( & quitting );
-    PLOGMSG ( klogInfo, (klogInfo, "SIGNAL - $(sig)\n", "sig=HUP" ));
-}
-
-/* SigQuitHandler
- */
-static
-void SigQuitHandler ( int sig )
-{
-    const char *msg;
-
-    ReportSilence ();
-
-    atomic32_inc ( & quitting );
-    switch ( sig )
-    {
-    case SIGINT:
-        msg = "^C";
-        break;
-    case SIGQUIT:
-        msg = "QUIT";
-        break;
-    case SIGTERM:
-        msg = "TERM";
-        break;
-    default:
-        PLOGMSG ( klogWarn, ( klogWarn, "SIGNAL - $(sig)\n", "sig=%d", sig ));
-        return;
-    }
-
-    PLOGMSG ( klogInfo, ( klogInfo, "SIGNAL - $(sig)", "sig=%s", msg ));
-}
-
-/* SigSegvHandler
- */
-#if CATCH_SIGSEGV
-static
-void SigSegvHandler ( int sig )
-{
-    ( ( void ) sig );
-    PLOGMSG ( klogFatal, ( klogFatal, "SIGNAL - $(sig)\n", "sig=Segmentation fault" ));
-    abort ();
-    exit ( 1 );
-}
-#endif
-
-/* main
- *  Unix specific main entrypoint
- */
-int main ( int argc, char *argv [] )
-{
-    static struct
-    {
-        void ( * handler ) ( int );
-        int sig;
-    } sigs [] =
-    {
-#if CATCH_SIGHUP
-        { SigHupHandler, SIGHUP },
-#endif
-        { SigQuitHandler, SIGINT },
-        { SigQuitHandler, SIGQUIT },
-#if CATCH_SIGSEGV
-        { SigSegvHandler, SIGSEGV },
-#endif
-        { SigQuitHandler, SIGTERM }
-    };
-
-    rc_t rc;
-    int i, status;
-    struct sigaction sig_saves [ sizeof sigs / sizeof sigs [ 0 ] ];
-
-    /* install signal handlers */
-    for ( i = 0; i < sizeof sigs / sizeof sigs [ 0 ]; ++ i )
-    {
-        struct sigaction act;
-        memset ( & act, 0, sizeof act );
-        act . sa_handler = sigs [ i ] . handler;
-        act . sa_flags = SA_RESETHAND;
-
-        status = sigaction ( sigs [ i ] . sig, & act, & sig_saves [ i ] );
-        if ( status < 0 )
-        {
-            PLOGMSG ( klogFatal, ( klogFatal,
-                     "failed to install handler for signal $(sig) - $(msg)"
-                     , "sig=%d,msg='%s'"
-                     , sigs [ i ] . sig
-                     , strerror ( errno )
-                          ));
-            return 2;
-        }
-    }
-
-    /* run this guy */
-    rc = KMane ( argc, argv );
-
-    /* remove handlers, for what it's worth */
-    for ( i = 0; i < sizeof sigs / sizeof sigs [ 0 ]; ++ i )
-        sigaction ( sigs [ i ] . sig, & sig_saves [ i ], NULL );
-
-    return ( rc == 0 ) ? 0 : 3;
-}
diff --git a/libs/kapp/win/sysmain.c b/libs/kapp/win/sysmain.c
deleted file mode 100644
index a6d1a39..0000000
--- a/libs/kapp/win/sysmain.c
+++ /dev/null
@@ -1,272 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#define UNICODE 1
-#define _UNICODE 1
-
-#include "../main-priv.h"
-#include <sysalloc.h>
-#include <kapp/main.h>
-#include <klib/log.h>
-#include <klib/status.h>
-#include <klib/debug.h>
-#include <klib/rc.h>
-#include <klib/text.h>
-#include <klib/report.h> 
-#include <atomic32.h>
-
-/* #define _WIN32_WINNT 0x0500 */
-/* commented out: 10/21/2010 by wolfgang
-   reason: Kurt introduced in sysdll.c a new functionality
-   which requires a newer windows-version 
-   (i realized it as compiler parameter in build/Makefile.vc++) */
-
-#include <WINDOWS.H>
-#include <OBJBASE.H>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-#include <assert.h>
-#include <ctype.h>
-
-/*--------------------------------------------------------------------------
- * Main
- */
-
-static bool no_hup;
-static atomic32_t hangup;
-static atomic32_t quitting;
-
-/* Quitting
- *  is the program supposed to exit
- */
-rc_t CC Quitting ( void )
-{
-    if ( atomic32_read ( & quitting ) == 0 )
-        return 0;
-    LOGMSG ( klogInfo, "EXITING..." );
-    return RC ( rcExe, rcProcess, rcExecuting, rcProcess, rcCanceled );
-}
-
-/* SignalQuit
- *  tell the program to quit
- */
-rc_t CC SignalQuit ( void )
-{
-    return RC ( rcExe, rcProcess, rcSignaling, rcNoObj, rcUnknown );
-}
-
-/* Hangup
- *  has the program received a SIGHUP
- */
-rc_t CC Hangup ( void )
-{
-    if ( atomic32_read ( & hangup ) == 0 )
-        return 0;
-    LOGMSG ( klogInfo, "HANGUP...\n" );
-    return RC ( rcExe, rcProcess, rcExecuting, rcProcess, rcIncomplete );
-}
-
-/* SignalHup
- *  send the program a SIGHUP
- */
-rc_t CC SignalHup ( void )
-{
-    return RC ( rcExe, rcProcess, rcSignaling, rcNoObj, rcUnknown );
-}
-
-/* SignalNoHup
- *  tell the program to stay alive even after SIGHUP
- */
-rc_t CC SignalNoHup ( void )
-{
-    no_hup = true;
-    return 0;
-}
-
-
-BOOL CC Our_HandlerRoutine( DWORD dwCtrlType )
-{
-    BOOL res = FALSE;
-    switch( dwCtrlType )
-    {
-    case CTRL_C_EVENT : ReportSilence ();
-                        atomic32_inc ( & quitting );
-                        res = TRUE;
-                        break;
-    }
-    return res;
-}
-
-
-/* main
- *  Windows specific main entrypoint
- */
-static
-int main2 ( int argc, char *argv [] )
-{
-    rc_t rc;
-
-    SetConsoleCtrlHandler( ( PHANDLER_ROUTINE ) Our_HandlerRoutine, TRUE );
-
-    /* run this guy */
-    rc = KMane ( argc, argv );
-
-    return ( rc == 0 ) ? 0 : 3;
-}
-
-static
-char *rewrite_arg ( const wchar_t *arg )
-{
-    char *utf8;
-    bool has_drive = false;
-    size_t i, src_size, dst_size;
-    DWORD len;
-
-    /* detect drive or full path */
-    wchar_t rewrit [ MAX_PATH ];
-    if ( arg [ 0 ] < 128 )
-    {
-        bool rewrite = false;
-
-        /* look for non-drive path */
-        if ( arg [ 0 ] == '\\' || arg [ 0 ] == '/' )
-        {
-            /* full path - not network */
-            if ( arg [ 1 ] != '\\' && arg [ 1 ] != '/' )
-            {
-                /* check for cygdrive */
-                if ( memcmp( arg, L"/cygdrive/", sizeof L"/cygdrive/" - sizeof L"" ) == 0 )
-                    arg += sizeof "/cygdrive" - 1;
-                else
-                    rewrite = true;
-             
-            }
-            
-        }
-        /* look for drive path */
-        else if ( isalpha ( arg [ 0 ] ) && arg [ 1 ] == ':' )
-        {
-            has_drive = true;
-
-            /* look for drive relative */
-            if ( arg [ 2 ] != '\\' && arg [ 2 ] != '/' )
-                rewrite = true;
-        }
-        if ( rewrite )
-        {
-            /* incomplete path */
-            len = GetFullPathNameW ( arg, sizeof rewrit / sizeof rewrit [ 0 ], rewrit, NULL );
-            if ( len == 0 || len >= MAX_PATH )
-            {
-                /* complain */
-                return NULL;
-            }
-            arg = rewrit;
-        }
-    }
-
-    /* this point, we should only have normal arguments,
-       or network/full/drive-full/relative paths */
-
-    /* measure the string */
-    len = wchar_cvt_string_measure ( arg, & src_size, & dst_size );
-
-    /* allocate a UTF-8 buffer */
-    utf8 = malloc ( dst_size + 1 );
-    if ( utf8 != NULL )
-    {
-        /* normal arguments get no offsets */
-        uint32_t offset = 0;
-
-        /* check for need to convert drive */
-        if ( has_drive )
-        {
-            /* convert to pseudo mount point */
-            utf8 [ 0 ] = '/';
-            utf8 [ 1 ] = ( char ) arg [ 0 ];
-            offset = 2;
-        }
-
-        /* copy the wide argument to utf8 */
-        wchar_cvt_string_copy ( & utf8 [ offset ], dst_size - offset + 1,
-            & arg [ offset ], src_size - offset * sizeof * arg );
-
-        /* terminate the string */
-        utf8 [ dst_size ] = 0;
-
-        /* map all backslashes to fwdslashes */
-        for ( i = 0; i < dst_size; ++ i )
-        {
-            if ( utf8 [ i ] == '\\' )
-                utf8 [ i ] = '/';
-        }
-    }
-
-    return utf8;
-}
-
-
-int __cdecl wmain ( int argc, wchar_t *wargv [], wchar_t *envp [] )
-{
-    char **argv;
-    int i, status;
-
-    /* must initialize COM... must initialize COM... */
-    /* CoInitializeEx ( NULL, COINIT_MULTITHREADED ); */
-    CoInitialize(NULL);
-
-    /* create a copy of args */
-    argv = calloc ( argc + 1, sizeof * argv );
-    if ( argv == NULL )
-        status = 5;
-    else
-    {
-        /* convert wchar_t arguments to UTF-8
-           rewriting anything that looks like a path */
-        for ( i = 0; i < argc; ++ i )
-        {
-            argv [ i ] = rewrite_arg ( wargv [ i ] );
-            if ( argv [ i ] == NULL )
-                break;
-        }
-
-        /* perform normal main operations on UTF-8 with POSIX-style paths */
-        if ( i == argc )
-            status = main2 ( argc, argv );
-
-        /* tear down argv */
-        while ( -- i >= 0 )
-            free ( argv [ i ] );
-        free ( argv );
-    }
-
-    /* balance the COM initialization */
-    CoUninitialize ();
-
-    return status;
-}
diff --git a/libs/kdb/Makefile b/libs/kdb/Makefile
deleted file mode 100644
index 67bb0ff..0000000
--- a/libs/kdb/Makefile
+++ /dev/null
@@ -1,153 +0,0 @@
-# ===========================================================================
-#
-#                            PUBLIC DOMAIN NOTICE
-#               National Center for Biotechnology Information
-#
-#  This software/database is a "United States Government Work" under the
-#  terms of the United States Copyright Act.  It was written as part of
-#  the author's official duties as a United States Government employee and
-#  thus cannot be copyrighted.  This software/database is freely available
-#  to the public for use. The National Library of Medicine and the U.S.
-#  Government have not placed any restriction on its use or reproduction.
-#
-#  Although all reasonable efforts have been taken to ensure the accuracy
-#  and reliability of the software and data, the NLM and the U.S.
-#  Government do not and cannot warrant the performance or results that
-#  may be obtained by using this software or data. The NLM and the U.S.
-#  Government disclaim all warranties, express or implied, including
-#  warranties of performance, merchantability or fitness for any particular
-#  purpose.
-#
-#  Please cite the author in any work or product based on this material.
-#
-# ===========================================================================
-
-
-default: std
-
-TOP ?= $(shell ../../build/abspath.sh ../..)
-MODULE = libs/kdb
-
-INT_LIBS = \
-	libkdb \
-	libwkdb
-
-ALL_LIBS = \
-	$(INT_LIBS)
-
-include $(TOP)/build/Makefile.env
-
-#-------------------------------------------------------------------------------
-# outer targets
-#
-all std: makedirs
-	@ $(MAKE_CMD) $(TARGDIR)/std
-
-$(INT_LIBS): makedirs
-	@ $(MAKE_CMD) $(ILIBDIR)/$@
-
-.PHONY: all std $(ALL_LIBS) $(ALL_DEFS)
-
-
-#-------------------------------------------------------------------------------
-# std
-#
-$(TARGDIR)/std: \
-	$(addprefix $(ILIBDIR)/,$(INT_LIBS))
-
-.PHONY: $(TARGDIR)/std
-
-#-------------------------------------------------------------------------------
-# clean
-#
-clean: stdclean
-
-.PHONY: clean
-
-#-------------------------------------------------------------------------------
-# kdb
-#
-$(ILIBDIR)/libkdb: $(addprefix $(ILIBDIR)/libkdb.,$(ILIBEXT))
-
-KDB_CMN = \
-	btree \
-	dbmgr-cmn \
-#	database-cmn
-
-KDB_SRC = \
-	$(KDB_CMN) \
-	kdb \
-	dbmgr \
-	dbcc-cmn \
-	database \
-	database-cc \
-	table \
-	table-cc \
-	column \
-	column-cc \
-	coldata \
-	colidx \
-	colidx0 \
-	colidx1 \
-	colidx2 \
-	idxblk \
-	meta \
-	index \
-	idstats \
-	trieidx-v1 \
-	trieval-v1 \
-	ptrieval-v1 \
-	trieidx-v2 \
-	trieval-v2 \
-	ptrieval-v2 \
-	u64idx-v3
-
-KDB_OBJ = \
-	$(addsuffix .$(LOBX),$(KDB_SRC))
-
-KDB_LIB = \
-	-dvfs \
-	-dkrypto \
-	-dkfs \
-	-dklib
-
-$(ILIBDIR)/libkdb.$(LIBX): $(KDB_OBJ)
-	$(LD) --slib -o $@ $^ $(KDB_LIB)
-
-
-#-------------------------------------------------------------------------------
-# wkdb
-#
-$(ILIBDIR)/libwkdb: $(addprefix $(ILIBDIR)/libwkdb.,$(ILIBEXT))
-
-WKDB_SRC = \
-	$(KDB_CMN) \
-	wkdb \
-	wdbmgr \
-	wdatabase \
-	wtable \
-	wcolumn \
-	wcoldata \
-	wcolidx \
-	wcolidx0 \
-	wcolidx1 \
-	wcolidx2 \
-	idxblk \
-	widxblk \
-	wmeta \
-	windex \
-	wtrieidx-v1 \
-	wtrieidx-v2 \
-	wu64idx-v3
-
-WKDB_OBJ = \
-	$(addsuffix .$(LOBX),$(WKDB_SRC))
-
-WKDB_LIB = \
-	-dvfs \
-	-dkrypto \
-	-dkfs \
-	-dklib
-
-$(ILIBDIR)/libwkdb.$(LIBX): $(WKDB_OBJ)
-	$(LD) --slib -o $@ $^ $(WKDB_LIB)
diff --git a/libs/kdb/btree.c b/libs/kdb/btree.c
deleted file mode 100644
index 600dec3..0000000
--- a/libs/kdb/btree.c
+++ /dev/null
@@ -1,3055 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#define BTREE_KEY2ID 1
-
-#include <kdb/extern.h>
-#include <kdb/btree.h>
-#include <kfs/file.h>
-#include <kfs/pagefile.h>
-#include <klib/refcount.h>
-#include <klib/sort.h>
-#include <klib/rc.h>
-#include <klib/text.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-/* must be kept in sync with kfs/pagefile.c */
-#define PGBITS 15
-#define PGSIZE ( 1U << PGBITS )
-
-#if _DEBUGGING
-static
-rc_t page_access_read ( const KPage *page, const void **mem )
-{
-    size_t bytes;
-    rc_t rc = KPageAccessRead ( page, mem, & bytes );
-    if ( rc == 0 && bytes != PGSIZE )
-        rc = RC ( rcDB, rcBlob, rcAccessing, rcFormat, rcIncorrect );
-    return rc;
-}
-
-static
-rc_t page_access_update ( KPage *page, void **mem )
-{
-    size_t bytes;
-    rc_t rc = KPageAccessUpdate ( page, mem, & bytes );
-    if ( rc == 0 && bytes != PGSIZE )
-        rc = RC ( rcDB, rcBlob, rcAccessing, rcFormat, rcIncorrect );
-    return rc;
-}
-#else
-
-#define page_access_read( page, mem ) \
-    KPageAccessRead ( page, mem, NULL )
-#define page_access_update( page, mem ) \
-    KPageAccessUpdate ( page, mem, NULL )
-
-#endif
-
-
-#if ! BTREE_KEY2ID
-
-/*--------------------------------------------------------------------------
- * KBTreeValue
- *  gives access to a value within a data page
- */
-typedef struct KBTreeValueImpl KBTreeValueImpl;
-struct KBTreeValueImpl
-{
-    KPage *page;
-    size_t offset;
-    size_t size;
-};
-
-/* Whack
- *  destroys object for further use
- *  may write modifications to disk ( see "write_through" below )
- */
-LIB_EXPORT rc_t CC KBTreeValueWhack ( KBTreeValue *xself )
-{
-    KBTreeValueImpl *self = ( KBTreeValueImpl* ) xself;
-    assert ( sizeof * self <= sizeof * xself );
-    if ( self != NULL )
-    {
-        rc_t rc = KPageRelease ( self -> page );
-        memset ( self, 0, sizeof * xself );
-        return rc;
-    }
-    return 0;
-}
-
-
-/* AccessRead
- * AccessUpdate
- *  gain access to value address
- *  update access marks data page as modified
- *
- *  "mem" [ OUT ] - pointer to value
- *
- *  "bytes" [ OUT, NULL OKAY ] - size of value memory
- */
-LIB_EXPORT rc_t CC KBTreeValueAccessRead ( const KBTreeValue *xself,
-    const void **mem, size_t *bytes )
-{
-    rc_t rc;
-    size_t dummy;
-
-    const KBTreeValueImpl *self = ( const KBTreeValueImpl* ) xself;
-    assert ( sizeof * self <= sizeof * xself );
-
-    if ( bytes == NULL )
-        bytes = & dummy;
-
-    if ( mem == NULL )
-        rc = RC ( rcDB, rcBlob, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcBlob, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = KPageAccessRead ( self -> page, mem, bytes );
-            if ( rc == 0 )
-            {
-                const uint8_t *byte_ptr = * mem;
-                assert ( self -> offset + self -> size <= * bytes );
-                * bytes = self -> size;
-                * mem = byte_ptr + self -> offset;
-                return 0;
-            }
-        }
-
-        * mem = NULL;
-    }
-
-    * bytes = 0;
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KBTreeValueAccessUpdate ( KBTreeValue *xself, void **mem, size_t *bytes )
-{
-    rc_t rc;
-    size_t dummy;
-
-    KBTreeValueImpl *self = ( KBTreeValueImpl* ) xself;
-    assert ( sizeof * self <= sizeof * xself );
-
-    if ( bytes == NULL )
-        bytes = & dummy;
-
-    if ( mem == NULL )
-        rc = RC ( rcDB, rcBlob, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcBlob, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = KPageAccessUpdate ( self -> page, mem, bytes );
-            if ( rc == 0 )
-            {
-                uint8_t *byte_ptr = * mem;
-                assert ( self -> offset + self -> size <= * bytes );
-                * bytes = self -> size;
-                * mem = byte_ptr + self -> offset;
-                return 0;
-            }
-        }
-
-        * mem = NULL;
-    }
-
-    * bytes = 0;
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * KPageFileStream
- *  represents a data stream made of pages and nodes
- *
- *  empty representation
- *    eof == 0, root == 0
- *
- *  simplest representation:
- *    0 < eof <= PGSIZE, root != 0 :: root page is data
- *
- *  common representation:
- *    PGSIZE < eof, root != 0 :: root page is a node
- */
-typedef struct KPageFileStream KPageFileStream;
-struct KPageFileStream
-{
-    uint64_t eof;                         /* logical end of file */
-    uint32_t root;                        /* starting page id    */
-    uint32_t min_size;                    /* minimum entry size  */
-    uint32_t max_size;                    /* maximum entry size  */
-    uint32_t chunk_bytes;                 /* alignment factor    */
-    uint32_t page_adj;                    /* bytes to adjust pg  */
-    uint32_t size_bytes;                  /* leading size bytes  */
-};
-
-#define SNBITS ( PGBITS - 2 )
-#define SNSIZE ( 1U << SNBITS )
-
-typedef struct KStreamNode KStreamNode;
-struct KStreamNode
-{
-    uint32_t page [ SNSIZE ];             /* data or node pages  */
-};
-
-
-/* Init
- */
-static
-rc_t KPageFileStreamInit ( KPageFileStream *s, size_t min_size, size_t max_size, size_t chunk_size )
-{
-    /* zero is a good default for most things */
-    memset ( s, 0, sizeof * s );
-
-    /* min and max size must be reasonable */
-    if ( min_size > max_size || max_size == 0 )
-        return RC ( rcDB, rcFile, rcConstructing, rcRange, rcInvalid );
-    if ( max_size > PGSIZE )
-        return RC ( rcDB, rcFile, rcConstructing, rcRange, rcExcessive );
-
-    /* chunk size cannot be too large, either */
-    if ( chunk_size > PGSIZE )
-        return RC ( rcDB, rcFile, rcConstructing, rcParam, rcExcessive );
-
-    /* record limits */
-    s -> min_size = ( uint32_t ) min_size;
-    s -> max_size = ( uint32_t ) max_size;
-
-    /* detect size bytes */
-    if ( min_size == max_size )
-        s -> chunk_bytes = ( uint32_t ) max_size;
-    else
-    {
-        if ( max_size <= UINT8_MAX )
-            s -> size_bytes = 1;
-        else if ( max_size <= UINT16_MAX )
-            s -> size_bytes = 2;
-        else
-            s -> size_bytes = 4;
-
-        s -> chunk_bytes = ( uint32_t ) chunk_size;
-    }
-
-    /* produce page adjustment for chunking */
-    s -> page_adj = PGSIZE % s -> chunk_bytes;
-
-    return 0;
-}
-
-
-/* Check
- */
-static
-rc_t KPageFileStreamCheck ( KPageFileStream *self, size_t min_size, size_t max_size, size_t chunk_size )
-{
-    if ( self -> eof == 0 )
-    {
-        assert ( self -> root == 0 );
-        return KPageFileStreamInit ( self, min_size, max_size, chunk_size );
-    }
-
-    assert ( self -> root != 0 );
-    if ( self -> min_size > min_size || self -> max_size < max_size )
-        return RC ( rcDB, rcFile, rcConstructing, rcParam, rcInconsistent );
-
-    return 0;
-}
-
-
-/* Alloc
- *  allocate space in stream
- *
- *  there are 7 cases to handle within this function
- *
- *  1. allocation within first page of data, including initial allocation
- *  2. initial allocation from second data page
- *  3. no space in root node for allocation
- *  4. allocation crosses slot boundaries
- *  5. end slot is null
- *  6. end slot has data page
- *  7. end slot has node page
- */
-static
-rc_t KPageFileStreamAlloc ( KPageFileStream *self, KPageFile *pgfile, KBTreeValue *valp, size_t size, uint32_t *chunk )
-{
-    /* give return parameter a type */
-    KBTreeValueImpl *val = ( KBTreeValueImpl* ) valp;
-
-    rc_t rc;
-    KPage *page;
-    uint32_t new_root;
-    KStreamNode *node;
-    uint64_t start, end, chunk_mask;
-    uint64_t num_pages, virt_eof;
-
-    /* chunk parameter can be NULL */
-    uint32_t dummy;
-    if ( chunk == NULL )
-        chunk = & dummy;
-
-    /* we're static - these should be okay */
-    assert ( self != NULL );
-    assert ( pgfile != NULL );
-    assert ( val != NULL );
-
-    /* check against size constraint */
-    if ( size < self -> min_size || size > self -> max_size )
-        return RC ( rcDB, rcFile, rcAllocating, rcConstraint, rcViolated );
-
-    /* calcuate starting offset */
-    chunk_mask = self -> chunk_bytes - 1;
-    if ( self -> page_adj != 0 )
-    {
-        /* this is a case where the chunking is not a power of two
-           which is generally used only for fixed sized elements.
-           the case is that a single data page will not completely
-           fill with an integral number of elements, leaving an amount
-           in "page_adj" for each page used.
-
-           for simplicity, the actual eof is converted to a virtual
-           eof by imagining contiguous storage, subtracting off the
-           page adjust for each page used.
-
-           the chunk alignment is then performed against the virtual
-           eof, giving a new start offset which is finally converted
-           back to actual space by adding in an adjustment for each
-           page used.
-        */
-        
-        num_pages = self -> eof >> PGBITS;
-        virt_eof = self -> eof - num_pages * self -> page_adj; 
-        start = virt_eof + chunk_mask;
-        start -= start % ( chunk_mask + 1 );
-        if ( ( ( start / self -> chunk_bytes ) >> 32 ) != 0 )
-            return RC ( rcDB, rcFile, rcAllocating, rcId, rcExhausted );
-        * chunk = start / self -> chunk_bytes;
-        start += ( start / ( PGSIZE - self -> page_adj ) ) * self -> page_adj;
-    }
-    else
-    {
-        /* this is the general case where chunk size is a nice power of 2 */
-        assert ( ( self -> chunk_bytes & ( self -> chunk_bytes - 1 ) ) == 0 );
-        start = ( self -> eof + chunk_mask ) & ~ chunk_mask;
-        if ( ( ( start / self -> chunk_bytes ) >> 32 ) != 0 )
-            return RC ( rcDB, rcFile, rcAllocating, rcId, rcExhausted );
-        * chunk = start / self -> chunk_bytes;
-    }
-
-    end = start + size + self -> size_bytes;
-
-    /* detect need to go to next page */
-    if ( ( start >> PGBITS ) != ( ( end - 1 ) >> PGBITS ) )
-    {
-        start = ( start + PGSIZE - 1 ) & ~ ( uint64_t ) ( PGSIZE - 1 );
-        end = start + size;
-        assert ( ( start >> PGBITS ) == ( ( end - 1 ) >> PGBITS ) );
-
-        /* reassign chunk */
-        if ( self -> page_adj != 0 )
-        {
-            num_pages = start >> PGBITS;
-            virt_eof = start - num_pages * self -> page_adj; 
-            virt_eof += chunk_mask;
-            virt_eof -= virt_eof % ( chunk_mask + 1 );
-            if ( ( ( virt_eof / self -> chunk_bytes ) >> 32 ) != 0 )
-                return RC ( rcDB, rcFile, rcAllocating, rcId, rcExhausted );
-            * chunk = virt_eof / self -> chunk_bytes;
-        }
-        else
-        {
-            * chunk = start / self -> chunk_bytes;
-        }
-    }
-
-    /* CASE 1 - stream is empty or has single data page */
-    if ( end <= PGSIZE )
-    {
-        /* return data page reference in "val" */
-        if ( self -> root == 0 )
-            /* create initial root data page */
-            rc = KPageFileAlloc ( pgfile, & val -> page, & self -> root );
-        else
-            /* access existing page */
-            rc = KPageFileGet ( pgfile, & val -> page, self -> root );
-    }
-    /* CASE 2 - conversion from data to node page */
-    else if ( self -> eof <= PGSIZE )
-    {
-        /* create new root */
-        rc = KPageFileAlloc ( pgfile, & page, & new_root );
-        if ( rc == 0 )
-        {
-            rc = page_access_update ( page, ( void** ) & node );
-            if ( rc == 0 )
-            {
-                /* put old root in slot 0 */
-                node -> page [ 0 ] = self -> root;
-
-                /* create new data page, returning reference in "val" */
-                rc = KPageFileAlloc ( pgfile, & val -> page, & node -> page [ 1 ] );
-                if ( rc == 0 )
-
-                    /* update root */
-                    self -> root = new_root;
-            }
-
-            /* release new root page */
-            KPageRelease ( page );
-        }
-    }
-    /* root is a node page and eof > PGSIZE, node_size */
-    else
-    {
-        /* bytes currently represented by root node */
-        uint64_t slot_size = PGSIZE;
-        while ( self -> eof > slot_size )
-            slot_size <<= SNBITS;
-
-        /* CASE 3 - create a new root page due to overflow at this level */
-        rc = 0;
-        if ( end > slot_size )
-        {
-            /* create a new root as before */
-            rc = KPageFileAlloc ( pgfile, & page, & new_root );
-            if ( rc == 0 )
-            {
-                rc = page_access_update ( page, ( void** ) & node );
-                if ( rc == 0 )
-                {
-                    /* put old root in slot 0 */
-                    node -> page [ 0 ] = self -> root;
-
-                    /* update root */
-                    self -> root = new_root;
-
-                    /* root size is now much bigger */
-                    slot_size <<= SNBITS;
-                }
-                
-                KPageRelease ( page );
-            }
-        }
-        if ( rc == 0 )
-        {
-            bool done;
-            uint32_t page_id, slot_id;
-
-            /* convert to size represented by each slot */
-            slot_size >>= SNBITS;
-
-            /* slot number
-               NB - "end" has been modified to point AT last byte */
-            slot_id = ( uint32_t ) ( -- end / slot_size );
-
-            for ( done = false, page_id = self -> root; rc == 0 && ! done; )
-            {
-                rc = KPageFileGet ( pgfile, & page, page_id );
-                if ( rc == 0 )
-                {
-                    const KStreamNode *cnode;
-                    rc = page_access_read ( page, ( const void** ) & cnode );
-                    if ( rc == 0 )
-                    {
-                        /* slots hold data pages */
-                        if ( slot_size == PGSIZE )
-                        {
-                            /* return reference to page in "val" */
-                            if ( cnode -> page [ slot_id ] != 0 )
-                                rc = KPageFileGet ( pgfile, & val -> page, cnode -> page [ slot_id ] );
-                            else
-                            {
-                                rc = page_access_update ( page, ( void** ) & node );
-                                if ( rc == 0 )
-                                    rc = KPageFileAlloc ( pgfile, & val -> page, & node -> page [ slot_id ] );
-                            }
-                            done = true;
-                        }
-
-                        /* slots hold node pages */
-                        else
-                        {
-                            /* look for empty node slot */
-                            if ( cnode -> page [ slot_id ] == 0 )
-                            {
-                                /* make current node writable */
-                                rc = page_access_update ( page, ( void** ) & node );
-                                if ( rc == 0 )
-                                {
-                                    /* allocate a new child */
-                                    KPage *newpage;
-                                    rc = KPageFileAlloc ( pgfile, & newpage, & node -> page [ slot_id ] );
-                                    if ( rc == 0 )
-                                        KPageRelease ( newpage );
-                                }
-                            }
-
-                            /* retrieve child node page id */
-                            page_id = cnode -> page [ slot_id ];
-
-                            /* convert end to offset within child */
-                            end %= slot_size;
-
-                            /* convert slot_size to child slot_size */
-                            slot_size >>= SNBITS;
-
-                            /* new slot_id within child */
-                            slot_id = ( uint32_t ) ( end / slot_size );
-                        }
-                    }
-
-                    KPageRelease ( page );
-                }
-            }
-        }
-    }
-
-    /* finish the value */
-    if ( rc == 0 )
-    {
-        self -> eof = start + size + self -> size_bytes;
-
-        if ( self -> size_bytes != 0 )
-        {
-            uint8_t *mem;
-
-            /* access the node data for update */
-            assert ( val -> page != NULL );
-            rc = page_access_update ( val -> page, ( void** ) & mem );
-
-            /* store the size if variable */
-            mem += start & ( PGSIZE - 1 );
-            switch ( self -> size_bytes )
-            {
-            case 1:
-                mem [ 0 ] = ( uint8_t ) size;
-                break;
-            case 2:
-                ( ( uint16_t* ) mem ) [ 0 ] = ( uint16_t ) size;
-                break;
-            case 4:
-                ( ( uint32_t* ) mem ) [ 0 ] = ( uint32_t ) size;
-                break;
-            }
-        }
-
-        /* record the page offset to DATA and data size */
-        val -> offset = ( ( uint32_t ) start + self -> size_bytes ) & ( PGSIZE - 1 );
-        val -> size = size;
-
-        return 0;
-    }
-
-    * chunk = 0;
-    memset ( val, 0, sizeof * val );
-    return rc;
-}
-
-
-/* Get
- *  retrieve data from stream
- *
- *  there are N cases to handle within this function
- *
- *  1. chunk not contained within stream
- *  2. root page is data
- *  3. root page is node
- */
-static
-rc_t KPageFileStreamGet ( const KPageFileStream *self, KPageFile *pgfile, KBTreeValue *valp, uint32_t chunk )
-{
-    KBTreeValueImpl *val = ( KBTreeValueImpl* ) valp;
-
-    rc_t rc;
-    uint64_t start, num_pages;
-
-    assert ( self != NULL );
-    assert ( val != NULL );
-    assert ( self -> eof == 0 || self -> root != 0 );
-
-    /* convert chunk into byte offset */
-    start = ( uint64_t ) chunk * self -> chunk_bytes;
-    num_pages = start / ( PGSIZE - self -> page_adj );
-    start += num_pages * self -> page_adj;
-
-    /* CASE 1 - chunk is not in stream */
-    if ( start >= self -> eof )
-        rc = RC ( rcDB, rcFile, rcReading, rcData, rcNotFound );
-
-    /* CASE 2 - root page is data */
-    else if ( self -> eof <= PGSIZE )
-        rc = KPageFileGet ( pgfile, & val -> page, self -> root );
-
-    /* CASE 3 - root page is node */
-    else
-    {
-        bool done;
-        uint32_t pgid;
-        uint32_t shift_bits;
-        uint64_t slot_id = ( self -> eof - 1 ) >> PGBITS;
-
-        /* determine CURRENT root node status */
-        uint64_t slot_size;
-        for ( shift_bits = PGBITS, slot_size = PGSIZE; slot_id >= SNSIZE; slot_id >>= SNBITS, shift_bits += SNBITS )
-            slot_size <<= SNBITS;
-
-        /* now generate slot_id */
-        slot_id = start >> shift_bits;
-
-        for ( rc = 0, pgid = self -> root, done = false; rc == 0 && ! done; )
-        {
-            KPage *page;
-            rc = KPageFileGet ( pgfile, & page, pgid );
-            if ( rc == 0 )
-            {
-                const KStreamNode *cnode;
-                rc = page_access_read ( page, ( const void** ) & cnode );
-                if ( rc == 0 )
-                {
-                    assert ( cnode -> page [ slot_id ] != 0 );
-                    if ( slot_size <= PGSIZE )
-                    {
-                        rc = KPageFileGet ( pgfile, & val -> page, cnode -> page [ slot_id ] );
-                        done = true;
-                    }
-                    else
-                    {
-                        pgid = cnode -> page [ slot_id ];
-                        slot_size >>= SNBITS;
-                        slot_id = ( start / slot_size ) & ( SNSIZE - 1 );
-                    }
-                }
-
-                KPageRelease ( page );
-            }
-        }
-    }
-
-    if ( rc == 0 )
-    {
-        const uint8_t *mem;
-
-        /* access the node data for update */
-        assert ( val -> page != NULL );
-        rc = page_access_read ( val -> page, ( const void** ) & mem );
-
-        /* store the size if variable */
-        mem += start & ( PGSIZE - 1 );
-        switch ( self -> size_bytes )
-        {
-        case 0:
-            val -> size = self -> max_size;
-            break;
-        case 1:
-            val -> size = mem [ 0 ];
-            break;
-        case 2:
-            val -> size = ( ( const uint16_t* ) mem ) [ 0 ];
-            break;
-        case 4:
-            val -> size = ( ( const uint32_t* ) mem ) [ 0 ];
-            break;
-        }
-
-        /* record the page offset to DATA */
-        val -> offset = ( ( uint32_t ) start + self -> size_bytes ) & ( PGSIZE - 1 );
-
-        return 0;
-    }
-
-    memset ( val, 0, sizeof * val );
-    return rc;
-}
-
-#endif /* BTREE_KEY2ID */
-
-
-/*--------------------------------------------------------------------------
- * KBTree
- *  this implementation is an extremely simplified structure
- *  meant to provide the ability to create an index for temporary use
- */
-#define eByteOrderTag 0x05031988
-#define eByteOrderReverse 0x88190305
-
-#if ! BTREE_KEY2ID
-
-/* v1 stores keys in a stream */
-typedef struct KBTreeHdr_v1 KBTreeHdr_v1;
-struct KBTreeHdr_v1
-{
-    /* streams of data */
-    KPageFileStream key_stream;
-    KPageFileStream val_stream;
-
-    /* only type [ 0 ] is used - rest are for alignment */
-    KBTreeKeyType type [ 4 ];
-
-    /* tree root */
-    uint32_t root;
-
-    /* next to last */
-    uint32_t version;
-
-    /* last */
-    uint32_t endian;
-};
-
-/* v2 does not have a key stream, but keeps the size */
-typedef struct KBTreeHdr_v2 KBTreeHdr_v2;
-struct KBTreeHdr_v2
-{
-    /* data stream */
-    KPageFileStream val_stream;
-
-    /* key min/max */
-    uint16_t key_min, key_max;
-
-    /* type [ 0 ] is type
-       type [ 1 ] is non-zero if comparison function was used
-       rest are for alignment */
-    KBTreeKeyType type [ 4 ];
-
-    /* tree root */
-    uint32_t root;
-
-    /* next to last */
-    uint32_t version;
-
-    /* last */
-    uint32_t endian;
-};
-
-#endif /* ! BTREE_KEY2ID */
-
-/* v3 does not store values, but stores keys in node pages */
-typedef struct KBTreeHdr_v3 KBTreeHdr_v3;
-struct KBTreeHdr_v3
-{
-    /* last entry id */
-    uint32_t id_seq;
-
-    /* key min/max */
-    uint16_t key_min, key_max;
-
-    /* type [ 0 ] is type
-       type [ 1 ] is non-zero if comparison function was used
-       rest are for alignment */
-    KBTreeKeyType type [ 4 ];
-
-    /* tree root */
-    uint32_t root;
-
-    /* next to last */
-    uint32_t version;
-
-    /* last */
-    uint32_t endian;
-};
-
-#if BTREE_KEY2ID
-typedef struct KBTreeHdr_v3 KBTreeHdr;
-#else
-typedef struct KBTreeHdr_v2 KBTreeHdr;
-#endif
-
-
-static
-rc_t KBTreeReadHeader ( KBTreeHdr *hdr, const KFile *f )
-{
-    uint64_t eof;
-    rc_t rc = KFileSize ( f, & eof );
-    if ( rc == 0 )
-    {
-        size_t num_read;
-
-        /* this would be an empty file */
-        if ( eof == 0 )
-        {
-            memset ( hdr, 0, sizeof * hdr );
-            return RC ( rcDB, rcTree, rcConstructing, rcData, rcNotFound );
-        }
-
-        if ( eof < sizeof * hdr )
-            return RC ( rcDB, rcTree, rcConstructing, rcData, rcCorrupt );
-
-        rc = KFileReadAll ( f, eof - sizeof * hdr, hdr, sizeof * hdr, & num_read );
-        if ( rc == 0 && num_read != sizeof * hdr )
-            rc = RC ( rcDB, rcTree, rcConstructing, rcData, rcInsufficient );
-        if ( rc == 0 )
-        {
-            if ( hdr -> endian != eByteOrderTag )
-            {
-                if ( hdr -> endian == eByteOrderReverse )
-                    return RC ( rcDB, rcTree, rcConstructing, rcByteOrder, rcIncorrect );
-                return RC ( rcDB, rcTree, rcConstructing, rcData, rcCorrupt );
-            }
-            if ( hdr -> version != 2 )
-                return RC ( rcDB, rcTree, rcConstructing, rcHeader, rcBadVersion );
-        }
-    }
-    return rc;
-}
-
-struct KBTree
-{
-    /* file itself */
-    KFile *file;
-
-    /* page cache layered on top */
-    KPageFile *pgfile;
-
-    /* comparison function */
-    KBTreeCompareFunc cmp;
-
-    /* "header" is stored at end */
-    KBTreeHdr hdr;
-
-    KRefcount refcount;
-
-    bool read_only;
-};
-
-typedef struct KBTreeSrchWindow{
-   uint16_t	lower;
-   uint16_t	upper;
-} KBTreeSrchWindow;
-
-
-/* the leaf node works out naturally to be an odd count
-   which is needed for splitting at the median. so we
-   let a leaf fill, then split before further insert */
-#define LNSIZE ( ( PGSIZE - 2 ) / 8 )
-#define LNMEDIAN ( LNSIZE / 2 )
-#define LNHALF ( LNSIZE / 2 )
-
-typedef struct KBTreeLeafNode_v1 KBTreeLeafNode_v1;
-struct KBTreeLeafNode_v1
-{
-    uint32_t key [ LNSIZE ];
-    uint32_t val [ LNSIZE ];
-    uint16_t count;
-};
-
-typedef struct KBTreeLeafEntry_v2 KBTreeLeafEntry_v2;
-struct KBTreeLeafEntry_v2
-{
-    uint16_t key;
-    uint16_t ksize;
-};
-
-typedef struct KBTreeLeafNode_v2 KBTreeLeafNode_v2;
-struct KBTreeLeafNode_v2
-{
-    uint16_t key_prefix;       /*** prefix offset into the blob ***/
-    uint16_t key_prefix_len;   /*** length of the prefix ***/
-    KBTreeSrchWindow   win[256]; /*** search windows for first letter of the key ***/
-    uint16_t count;	       /*** number of elements **/
-    uint16_t key_bytes;        /*** bytes used for storing keys ***/
-    KBTreeLeafEntry_v2 ord [ ( PGSIZE - 8 - 256 * sizeof(KBTreeSrchWindow)) / sizeof ( KBTreeLeafEntry_v2 ) ];
-};
-
-typedef struct KBTreeLeafEntry_v2 KBTreeLeafEntry;
-
-
-/* the branch node works out to be an even key count
-   which means that we also split before insert when
-   full, but the split leaves the target insert side
-   light, corrected immediately with an insert */
-#define BRSIZE ( ( PGSIZE - 2 - 4 ) / 12 )
-
-typedef struct KBTreeBranchNode_v1 KBTreeBranchNode_v1;
-struct KBTreeBranchNode_v1
-{
-    uint32_t key [ BRSIZE ];
-    uint32_t val [ BRSIZE ];
-    uint32_t trans [ BRSIZE + 1 ];
-    uint16_t count;
-};
-
-typedef struct KBTreeBranchEntry_v2 KBTreeBranchEntry_v2;
-struct KBTreeBranchEntry_v2
-{
-    uint16_t key;
-    uint16_t ksize;
-    uint32_t trans;
-};
-
-typedef struct KBTreeBranchNode_v2 KBTreeBranchNode_v2;
-struct KBTreeBranchNode_v2
-{
-    uint16_t key_prefix;       /*** offset into the blob ***/
-    uint16_t key_prefix_len;   /*** length of the prefix ***/
-    KBTreeSrchWindow   win[256]; /*** search windows for first letter of the key ***/
-    /* the exact structure here is important:
-       "ltrans" will be accessed as node -> ord [ -1 ] . trans */
-    uint16_t count;
-    uint16_t key_bytes;
-    
-    uint32_t ltrans;
-    KBTreeBranchEntry_v2 ord [ ( PGSIZE - 12 - 256 * sizeof(KBTreeSrchWindow) ) / sizeof ( KBTreeBranchEntry_v2 ) ];
-};
-
-typedef struct KBTreeBranchEntry_v2 KBTreeBranchEntry;
-
-typedef struct KBTreeLeafNode_v2 KBTreeLeafNode;
-typedef struct KBTreeBranchNode_v2 KBTreeBranchNode;
-
-/* when keys are stored in pages, the max key size
-   will be such that some number of keys are guaranteed to fit */
-#define MIN_KEY_COUNT 2
-#define MAX_KEY_SIZE \
-    (( PGSIZE - 12 - 256 * sizeof(KBTreeSrchWindow)   - \
-        MIN_KEY_COUNT * ( sizeof ( KBTreeBranchEntry_v2 ) + sizeof ( uint32_t ) ) \
-        ) / MIN_KEY_COUNT )
-
-
-
-#if _DEBUGGING 
-#define VALIDATE_SEARCH_WINDOW 0
-#endif
-
-#if VALIDATE_SEARCH_WINDOW
-static
-bool validate_search_window(KBTreeSrchWindow *win)
-{
-	int i;
-	if(win[0].lower != 0) return false;
-	for(i=0;i<255;i++){
-		if(win[i+1].lower != win[i].upper) return false;
-	}
-	return true;
-}
-#else
-#define validate_search_window(A) true
-#endif
-
-/* Whack
- */
-static
-rc_t KBTreeWhack ( KBTree *self )
-{
-    if ( self -> read_only || self -> file == NULL )
-        KPageFileRelease ( self -> pgfile );
-    else
-    {
-        size_t num_writ;
-
-        /* request page file size */
-        uint64_t eof;
-        rc_t rc = KPageFileSize ( self -> pgfile, & eof, NULL, NULL );
-        if ( rc != 0 )
-            return rc;
-
-        /* drop the page file and its cache */
-        KPageFileRelease ( self -> pgfile );
-
-        /* write header to tail */        
-        rc = KFileWrite ( self -> file, eof, & self -> hdr, sizeof self -> hdr, & num_writ );
-        if ( rc == 0 && num_writ != sizeof self -> hdr )
-            rc = RC ( rcDB, rcTree, rcPersisting, rcTransfer, rcIncomplete );
-        if ( rc == 0 )
-            rc = KFileSetSize ( self -> file, eof + sizeof self -> hdr );
-        if ( rc != 0 )
-        {
-            /* TBD - can issue a warning here */
-        }
-    }
-
-    KFileRelease ( self -> file );
-    free ( self );
-    return 0;
-}
-
-
-/* MakeRead
- * MakeUpdate
- *  make a b-tree object backed by supplied KFile
- *
- *  "backing" [ IN ] - open file with read permissions.
- *   NB - a reference will be attached to this file.
- *
- *  "climit" [ IN ] - cache limit in bytes. the internal cache will
- *   retain UP TO ( but not exceeding ) the limit specified. a value
- *   of 0 ( zero ) will disable caching.
- *
- *  "cmp" [ IN, NULL OKAY ] - optional comparison callback function for opaque keys.
- *   specific key types will use internal comparison functions. for opaque keys, a
- *   NULL function pointer will cause ordering by size and binary comparison.
- */
-LIB_EXPORT rc_t CC KBTreeMakeRead ( const KBTree **btp,
-    const KFile *backing, size_t climit, KBTreeCompareFunc cmp )
-{
-    rc_t rc;
-
-    if ( btp == NULL )
-        rc = RC ( rcDB, rcTree, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( backing == NULL )
-            rc = RC ( rcDB, rcTree, rcConstructing, rcFile, rcNull );
-        else
-        {
-            KBTree *bt = malloc ( sizeof * bt );
-            if ( bt == NULL )
-                rc = RC ( rcDB, rcTree, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                rc = KBTreeReadHeader ( & bt -> hdr, backing );
-                if ( rc == 0 )
-                {
-                    rc = KFileAddRef ( backing );
-                    if ( rc == 0 )
-                    {
-                        /* create page file */
-                        rc = KPageFileMakeRead ( ( const KPageFile** ) & bt -> pgfile, backing, climit );
-                        if ( rc == 0 )
-                        {
-                            /* ready to go */
-                            bt -> file = ( KFile* ) backing;
-                            if ( bt -> hdr . type [ 1 ] )
-                                bt -> cmp = cmp;
-                            KRefcountInit ( & bt -> refcount, 1, "KBTree", "make-read", "btree" );
-                            bt -> read_only = true;
-
-                            * btp = bt;
-                            return 0;
-                        }
-
-                        KFileRelease ( backing );
-                    }
-                }
-
-                free ( bt );
-            }
-        }
-
-        * btp = NULL;
-    }
-
-    return rc;
-}
-
-
-/* MakeUpdate
- *  make a b-tree object backed by supplied KFile
- *
- *  "backing" [ IN ] - open file with read & write permissions.
- *   NB - a reference will be attached to this file.
- *
- *  "climit" [ IN ] - cache limit in bytes. the internal cache will
- *   retain UP TO ( but not exceeding ) the limit specified. a value
- *   of 0 ( zero ) will disable caching.
- *
- *  "write_through" [ IN ] - if true, causes flushing of modified page
- *   after its value is released
- *
- *  "type" [ IN ] - describes the key type ( see above )
- *
- *  "key_chunk_size" [ IN ] - the "chunking" ( alignment ) factor for
- *   storing keys, rounded up to the nearest power of 2.
- *
- *  "value_chunk_size" [ IN ] - chunking factor for values
- *   ( see "key_chunk_size" )
- *
- *  "min_key_size" [ IN ] and "max_key_size" [ IN ] - specifies the allowed
- *   opaque key sizes. min == max implies fixed size. ignored for well
- *   known fixed size key types.
- *
- *  "min_value_size" [ IN ] and "max_value_size" [ IN ] - specifies the allowed
- *   value sizes. min == max implies fixed size.
- *
- *  "cmp" [ IN ] - comparison callback function for opaque keys.
- */
-#if BTREE_KEY2ID
-LIB_EXPORT rc_t CC KBTreeMakeUpdate ( KBTree **btp, KFile *backing,
-    size_t climit, bool write_through, KBTreeKeyType type,
-    size_t min_key_size, size_t max_key_size, size_t id_size,
-    KBTreeCompareFunc cmp )
-#else
-LIB_EXPORT rc_t CC KBTreeMakeUpdate ( KBTree **btp, KFile *backing,
-    size_t climit, bool write_through, KBTreeKeyType type,
-    size_t key_chunk_size, size_t value_chunk_size,
-    size_t min_key_size, size_t max_key_size,
-    size_t min_value_size, size_t max_value_size,
-    KBTreeCompareFunc cmp )
-#endif
-{
-    rc_t rc;
-
-    if ( btp == NULL )
-        rc = RC ( rcDB, rcTree, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( type >= kbtLastDefined )
-            rc = RC ( rcDB, rcTree, rcConstructing, rcType, rcUnrecognized );
-        else if ( min_key_size == 0 )
-            rc = RC ( rcDB, rcTree, rcConstructing, rcParam, rcInvalid );
-        else if ( max_key_size > MAX_KEY_SIZE )
-            rc = RC ( rcDB, rcTree, rcConstructing, rcParam, rcExcessive );
-        else if ( min_key_size > max_key_size )
-            rc = RC ( rcDB, rcTree, rcConstructing, rcParam, rcInconsistent );
-#if BTREE_KEY2ID && ! BTREE_KEY2ID64
-        else if ( id_size != sizeof ( uint32_t ) )
-            rc = RC ( rcDB, rcTree, rcConstructing, rcParam, rcInvalid );
-#endif
-        else
-        {
-            KBTree *bt = calloc ( 1,sizeof * bt );
-            if ( bt == NULL )
-                rc = RC ( rcDB, rcTree, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                if ( backing == NULL || ( rc = KBTreeReadHeader ( & bt -> hdr, backing )) == 0 || GetRCState ( rc ) == rcNotFound )
-                {
-                    /* detect empty file */
-                    if ( bt -> hdr . version == 0 )
-                    {
-#if BTREE_KEY2ID
-                        assert ( bt -> hdr . id_seq == 0 );
-#else
-                        KPageFileStreamInit ( & bt -> hdr . val_stream, min_value_size, max_value_size, value_chunk_size );
-#endif
-                        bt -> hdr . type [ 0 ] = type;
-                        bt -> hdr . type [ 1 ] = cmp != NULL;
-                        bt -> hdr . key_min = ( uint16_t ) min_key_size;
-                        bt -> hdr . key_max = ( uint16_t ) max_key_size;
-#if BTREE_KEY2ID
-                        bt -> hdr . version = 3;
-#else
-                        bt -> hdr . version = 2;
-#endif
-                        bt -> hdr . endian = eByteOrderTag;
-                        rc = 0;
-                    }
-                    else
-                    {
-                        /* check for parameter equivalence */
-#if BTREE_KEY2ID
-                        if ( bt -> hdr . version < 3 )
-#else
-                        if ( bt -> hdr . version < 2 )
-#endif
-                            rc = RC ( rcDB, rcTree, rcConstructing, rcHeader, rcBadVersion );
-                        else if ( bt -> hdr . key_min > min_key_size || bt -> hdr . key_max < max_key_size )
-                            rc = RC ( rcDB, rcTree, rcConstructing, rcParam, rcInconsistent );
-                        else
-#if ! BTREE_KEY2ID
-                            rc = KPageFileStreamCheck ( & bt -> hdr . val_stream, min_value_size, max_value_size, value_chunk_size );
-#endif
-                        if ( rc == 0 && bt -> hdr . type [ 0 ] != type )
-                            rc = RC ( rcDB, rcTree, rcConstructing, rcType, rcInconsistent );
-                    }
-
-                    if ( rc == 0 )
-                    {
-                        if(backing) rc = KFileAddRef ( backing );
-                        if ( rc == 0 )
-                        {
-                            /* create page file */
-                            rc = KPageFileMakeUpdate ( & bt -> pgfile, backing, climit, write_through );
-                            if ( rc == 0 )
-                            {
-                                /* ready to go */
-                                bt -> file = backing;
-                                if ( ! bt -> hdr . type [ 1 ] )
-                                    bt -> cmp = NULL;
-                                else
-                                    bt -> cmp = cmp;
-                                KRefcountInit ( & bt -> refcount, 1, "KBTree", "make-update", "btree" );
-                                bt -> read_only = false;
-
-                                * btp = bt;
-                                return 0;
-                            }
-
-                            if(backing) KFileRelease ( backing );
-                        }
-                    }
-                }
-
-                free ( bt );
-            }
-        }
-
-        * btp = NULL;
-    }
-
-    return rc;
-}
-
-
-/* AddRef
- * Release
- *  ignores NULL references
- */
-LIB_EXPORT rc_t CC KBTreeAddRef ( const KBTree *self )
-{
-    if ( self != NULL ) switch ( KRefcountAdd ( & self -> refcount, "KBTree" ) )
-    {
-    case krefOkay:
-        break;
-    default:
-        return RC ( rcDB, rcTree, rcAttaching, rcConstraint, rcViolated );
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KBTreeRelease ( const KBTree *self )
-{
-    if ( self != NULL ) switch ( KRefcountDrop ( & self -> refcount, "KBTree" ) )
-    {
-    case krefOkay:
-        break;
-    case krefWhack:
-        return KBTreeWhack ( ( KBTree* ) self );
-    default:
-        return RC ( rcDB, rcTree, rcReleasing, rcConstraint, rcViolated );
-    }
-    return 0;
-}
-
-
-/* DropBacking
- *  used immediately prior to releasing
- *  prevents modified pages from being flushed to disk
- *  renders object nearly useless
- */
-LIB_EXPORT rc_t CC KBTreeDropBacking ( KBTree *self )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcTree, rcDetaching, rcSelf, rcNull );
-
-    rc = KPageFileDropBacking ( self -> pgfile );
-    if ( rc == 0 )
-    {
-        rc = KFileRelease ( self -> file );
-        if ( rc == 0 )
-            self -> file = NULL;
-    }
-
-    return rc;
-}
-
-
-/* Size
- *  returns size in bytes of file and cache
- *
- *  "lsize" [ OUT, NULL OKAY ] - return parameter for logical size
- *
- *  "fsize" [ OUT, NULL OKAY ] - return parameter for file size
- *
- *  "csize" [ OUT, NULL OKAY ] - return parameter for cache size
- */
-LIB_EXPORT rc_t CC KBTreeSize ( const KBTree *self,
-    uint64_t *lsize, uint64_t *fsize, size_t *csize )
-{
-    size_t dummysz;
-    uint64_t dummy64;
-
-    if ( self != NULL )
-        return KPageFileSize ( self -> pgfile, lsize, fsize, csize );
-
-    if ( lsize == NULL )
-        lsize = & dummy64;
-    if ( fsize == NULL )
-        fsize = & dummy64;
-    if ( csize == NULL )
-        csize = & dummysz;
-
-    * lsize = 0;
-    * fsize = 0;
-    * csize = 0;
-
-    return RC ( rcDB, rcTree, rcAccessing, rcSelf, rcNull );
-}
-
-
-/* Find
- *  searches for a match
- *
- *  "val" [ OUT ] - return parameter for value found
- *   accessed via KBTreeValueAccess* described above
- *   must be balanced with a call to KBTreeValueWhack.
- *
- *  "key" [ IN ] and "key_size" [ IN ] - describes an
- *   opaque key
- */
-
-static __inline__
-int compare_keys ( const KBTree *self, const void *query, size_t qsize, const void *key, size_t key_size )
-{
-    if ( self -> cmp != NULL )
-        return ( * self -> cmp ) ( query, qsize, key, key_size );
-    else {
-        size_t csize = (qsize < key_size) ? qsize : key_size;
-        int diff = memcmp ( query, key, csize);
-        if (diff == 0)
-            return (int)qsize - (int)key_size;
-        return diff;
-    }
-}
-
-#if BTREE_KEY2ID
-static
-rc_t leaf_find ( const KBTree *self, const KPage *page,
-    uint32_t *id, const void *query, size_t qsize )
-#else
-static
-rc_t leaf_find ( const KBTree *self, const KPage *page,
-    KBTreeValue *val, const void *query, size_t qsize )
-#endif
-{
-    int lower, upper;
-    const uint8_t *query_8 = query;
-    uint16_t	q;
-
-    const KBTreeLeafNode *cnode;
-    rc_t rc = page_access_read ( page, ( const void** ) & cnode );
-    if ( rc != 0 )
-        return rc;
-    if(cnode->key_prefix_len > 0){
-    	const size_t key_prefix_len=cnode->key_prefix_len;
- 	/*** prefix must match ***/	
-        assert(compare_keys(self,query,key_prefix_len, ((char *)cnode )+cnode->key_prefix,key_prefix_len) == 0);
-	/*************************/
-	query_8 += key_prefix_len;
-	qsize   -= key_prefix_len;
-    }
-
-    /* perform search on branch node */
-    q = (qsize > 0)?*query_8:0;
-    for ( lower = cnode->win[q].lower, upper = cnode -> win[q].upper; lower < upper; )
-    {
-        /* determine the slot to examine */
-        int slot = ( lower + upper ) >> 1;
-
-        /* perform comparison */
-        const uint8_t *key = & ( ( const uint8_t* ) cnode ) [ cnode -> ord [ slot ] . key ];
-        int diff = compare_keys ( self, query_8, qsize, key , cnode -> ord [ slot ] . ksize);
-        if ( diff == 0 )
-        {
-            uint32_t val_id = * ( const uint32_t* ) & key [ cnode -> ord [ slot ] . ksize ];
-#if BTREE_KEY2ID
-            * id = val_id;
-            return 0;
-#else
-            return KPageFileStreamGet ( & self -> hdr . val_stream, self -> pgfile, val, val_id );
-#endif
-        }
-        if ( diff < 0 )
-            upper = slot;
-        else
-            lower = slot + 1;
-    }
-
-    return RC ( rcDB, rcTree, rcSelecting, rcItem, rcNotFound );
-}
-
-#if BTREE_KEY2ID
-static
-rc_t branch_find ( const KBTree *self, const KPage *page,
-    uint32_t *id, const void *query, size_t qsize )
-#else
-static
-rc_t branch_find ( const KBTree *self, const KPage *page,
-    KBTreeValue *val, const void *query, size_t qsize )
-#endif
-{
-    int lower, upper;
-    const uint8_t *query_8 = query;
-    size_t  qsize_8 = qsize;
-    uint16_t q;
-    KPage *child;
-    uint32_t nid;
-
-    const KBTreeBranchNode *cnode;
-    rc_t rc = page_access_read ( page, ( const void** ) & cnode );
-    if ( rc != 0 )
-        return rc;
-    if(cnode->key_prefix_len > 0){
-        const size_t key_prefix_len=cnode->key_prefix_len;
- 	/*** prefix must match ***/	
-        assert(compare_keys(self,query,key_prefix_len, ((char *)cnode )+cnode->key_prefix,key_prefix_len) == 0);
-	/*************************/
-	query_8 += key_prefix_len;
-        qsize_8 -= key_prefix_len;
-    }
-    /* perform search on branch node */
-    q = (qsize_8 > 0)?*query_8:0;
-    for ( lower = cnode->win[q].lower, upper = cnode -> win[q].upper; lower < upper; )
-    {
-        /* determine the slot to examine */
-        int slot = ( lower + upper ) >> 1;
-
-        /* perform comparison */
-        const uint8_t *key = & ( ( const uint8_t* ) cnode ) [ cnode -> ord [ slot ] . key ];
-        int diff = compare_keys ( self, query_8, qsize_8, key , cnode -> ord [ slot ] . ksize );
-        if ( diff == 0 )
-        {
-            uint32_t val_id = * ( const uint32_t* ) & key [ cnode -> ord [ slot ] . ksize ];
-#if BTREE_KEY2ID
-            * id = val_id;
-            return 0;
-#else
-            return KPageFileStreamGet ( & self -> hdr . val_stream, self -> pgfile, val, val_id );
-#endif
-        }
-        if ( diff < 0 )
-            upper = slot;
-        else
-            lower = slot + 1;
-    }
-    /* should have the last slot tried ( < 0 ) or next slot to try ( > 0 ) */
-    assert ( lower == upper );
-
-    /* the node id is left-shifted by 1 and has the "branch-bit" indicator
-       in the LSB. the remaining bits should NOT be zero */
-    /* NB - if "upper" is 0 and type is signed,
-       this will access entry -1, giving "ltrans" */
-    nid = cnode -> ord [ upper - 1 ] . trans;
-    assert ( ( nid >> 1 ) != 0 );
-
-    /* access child node */
-    rc = KPageFileGet ( self -> pgfile, & child, nid >> 1 );
-    if ( rc == 0 )
-    {
-        rc = ( ( ( nid & 1 ) == 0 ) ? leaf_find : branch_find )
-#if BTREE_KEY2ID
-            ( self, child, id, query, qsize );
-#else
-            ( self, child, val, query, qsize );
-#endif
-
-        KPageRelease ( child );
-    }
-
-    return rc;
-}
-
-
-#if BTREE_KEY2ID
-LIB_EXPORT rc_t CC KBTreeFind ( const KBTree *self, uint64_t *id,
-    const void *key, size_t key_size )
-#else
-LIB_EXPORT rc_t CC KBTreeFind ( const KBTree *self, KBTreeValue *val,
-    const void *key, size_t key_size )
-#endif
-{
-    rc_t rc;
-
-#if BTREE_KEY2ID
-    if ( id == NULL )
-#else
-    if ( val == NULL )
-#endif
-        rc = RC ( rcDB, rcTree, rcSelecting, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcTree, rcSelecting, rcSelf, rcNull );
-        else if ( key_size == 0 )
-            rc = RC ( rcDB, rcTree, rcSelecting, rcParam, rcEmpty );
-        else if ( key == NULL )
-            rc = RC ( rcDB, rcTree, rcSelecting, rcParam, rcNull );
-        else if ( self -> hdr . root == 0 )
-            rc = RC ( rcDB, rcTree, rcSelecting, rcItem, rcNotFound );
-        else
-        {
-            /* bring in root page */
-            KPage *page;
-            rc = KPageFileGet ( self -> pgfile, & page, self -> hdr . root >> 1 );
-            if ( rc == 0 )
-            {
-#if BTREE_KEY2ID && ! BTREE_KEY2ID64
-                uint32_t id32;
-#endif
-                rc = ( ( ( self -> hdr . root & 1 ) == 0 ) ? leaf_find : branch_find )
-#if BTREE_KEY2ID64
-                    ( self, page, id, key, key_size );
-#elif BTREE_KEY2ID
-                    ( self, page, & id32, key, key_size );
-#else
-                    ( self, page, val, key, key_size );
-#endif
-#if BTREE_KEY2ID && ! BTREE_KEY2ID64
-                    * id = id32;
-#endif
-                
-                KPageRelease ( page );
-            }
-        }
-
-        if ( rc != 0 )
-#if BTREE_KEY2ID
-            * id = 0;
-#else
-            memset ( val, 0, sizeof * val );
-#endif
-    }
-
-    return rc;
-}
-
-
-/* Entry
- *  searches for a match or creates a new entry
- *
- *  "val" [ OUT ] - return parameter for value found
- *   accessed via KBTreeValueAccess* described above
- *   must be balanced with a call to KBTreeValueWhack.
- *
- *  "was_inserted" [ OUT ] - if true, the returned value was the result of an
- *   insertion and can be guaranteed to be all 0 bits. otherwise, the returned
- *   value will be whatever was there previously.
- *
- *  "alloc_size" [ IN ] - the number of value bytes to allocate upon insertion,
- *   i.e. if the key was not found. this value must agree with the limits
- *   specified in Make ( see above ).
- *
- *  "key" [ IN ] and "key_size" [ IN ] - describes an
- *   opaque key
- */
-typedef struct KBTreeSplit_v1 KBTreeSplit_v1;
-struct KBTreeSplit_v1
-{
-    uint32_t left;
-    uint32_t right;
-    uint32_t key;
-    uint32_t val;
-};
-
-typedef struct KBTreeSplit_v2 KBTreeSplit_v2;
-struct KBTreeSplit_v2
-{
-    void *key;
-    uint32_t left;
-    uint32_t right;
-    uint16_t ksize;
-    uint8_t buff [ 256 ];
-};
-
-typedef struct KBTreeSplit_v2 KBTreeSplit;
-#define KBTreeSplitInit( split ) \
-    ( void ) ( ( split ) -> key = NULL )
-#define KBTreeSplitWhack( split ) \
-    ( ( split ) -> key != NULL && ( split ) -> key != ( void* ) ( split ) -> buff ) ? \
-    free ( ( split ) -> key ) : ( void ) 0
-
-typedef struct KBTreeEntryData KBTreeEntryData;
-struct KBTreeEntryData
-{
-    KBTree *self;
-#if BTREE_KEY2ID
-    uint32_t *id;
-#else
-    KBTreeValue *val;
-    size_t alloc_size;
-#endif
-    const void *key;
-    size_t key_size;
-    bool was_inserted;
-};
-
-
-#if _DEBUGGING
-#include <stdio.h>
-
-static
-void dump_leaf_page ( const KBTreeLeafNode *cnode )
-{
-    int i;
-    const char *page;
-
-    if ( cnode == NULL )
-    {
-        printf ( "NULL\n\n" );
-        return;
-    }
-
-    printf ( "KBTreeLeafNode\n"
-             "  count:     %u\n"
-             "  key bytes: %u\n"
-             , cnode -> count
-             , cnode -> key_bytes
-        );
-
-    if ( cnode -> count == 0 )
-    {
-        putchar ( '\n' );
-        return;
-    }
-
-    page = ( const void* ) cnode;
-
-    printf ( "  entries:\n" );
-    for ( i = 0; i < cnode -> count; ++ i )
-    {
-        int key_size = cnode -> ord [ i ] . ksize;
-        const char *key = & page [ cnode -> ord [ i ] . key ];
-        uint32_t val_id = * ( const uint32_t* ) & key [ key_size ];
-        printf ( "  % 5d. key = '%.*s', offset = %u, value-id = %u\n"
-                 , i
-                 , key_size, key
-                 , cnode -> ord [ i ] . key
-                 , val_id
-            );
-    }
-
-    putchar ( '\n' );
-}
-
-
-#if _HUGE_CROWBAR_KLUDGE
-static
-void validate_key_order ( const KBTree *self, const KBTreeEntryData *pb, const KBTreeLeafNode *cnode )
-{
-    if ( cnode -> count != 0 )
-    {
-        KBTreeValue left, right;
-        rc_t rc = KPageFileStreamGet ( & self -> hdr . key_stream, self -> pgfile, & left, cnode -> key [ 0 ] );
-        if ( rc == 0 )
-        {
-            uint32_t i;
-            size_t sleft, sright;
-            const void *mleft, *mright;
-            rc = KBTreeValueAccessRead ( & left, & mleft, & sleft );
-
-            for ( i = 1; rc == 0 && i < cnode -> count; ++ i )
-            {
-                rc = KPageFileStreamGet ( & self -> hdr . key_stream, self -> pgfile, & right, cnode -> key [ i ] );
-                if ( rc == 0 )
-                {
-                    rc = KBTreeValueAccessRead ( & right, & mright, & sright );
-                    if ( rc == 0 )
-                    {
-                        int diff = ( * self -> cmp ) ( mleft, sleft, mright, sright );
-                        if ( diff > 0 )
-                        {
-                            fprintf ( stderr, "AAAAAHHHH!!!!\n" );
-                            rc = -1;
-                        }
-                    }
-
-                    KBTreeValueWhack ( & left );
-                    left = right;
-                }
-            }
-
-            KBTreeValueWhack ( & left );
-        }
-    }
-}
-#endif /* _HUGE_CROWBAR_KLUDGE */
-#endif /* _DEBUGGING */
-
-static
-rc_t make_entry ( KBTree *self, KBTreeEntryData *pb, void *hdrp, void *ordp )
-{
-#if BTREE_KEY2ID
-    rc_t rc=0;
-    /* use id provided from outside */
-#if 0 /* automatically generate */
-    if ( ( * pb -> id = ++ self -> hdr . id_seq ) == 0 )
-    {
-        -- self -> hdr . id_seq;
-        rc = RC ( rcDB, rcTree, rcInserting, rcId, rcExhausted );
-    }
-    else
-#endif
-#else
-    /* insert value */
-    uint32_t val_id;
-    rc_t rc = KPageFileStreamAlloc ( & self -> hdr . val_stream, self -> pgfile,
-            pb -> val, pb -> alloc_size, & val_id );
-    if ( rc == 0 )
-#endif
-    {
-        uint8_t *page = hdrp;
-        KBTreeLeafNode *hdr = hdrp;
-        KBTreeLeafEntry *ord = ordp;
-        const uint8_t *key = pb -> key;
-        uint16_t key_size = (uint16_t) ( pb -> key_size - hdr->key_prefix_len );
-
-
-        assert(memcmp(key,page + hdr->key_prefix, hdr -> key_prefix_len)==0);/*** validate in debug mode **/ 
-        key += hdr->key_prefix_len;
-
-        /* grab memory for key and value-id */
-        hdr -> key_bytes += key_size + sizeof ( uint32_t );
-        assert ( hdr -> key_bytes < PGSIZE );
-
-        /* location of key within page */
-        ord -> key = PGSIZE - hdr -> key_bytes;
-        ord -> ksize = ( uint16_t ) key_size;
-
-        /* insert key */
-        memcpy ( page + ord -> key, key,  key_size );
-
-        /* record value id */
-#if BTREE_KEY2ID
-        memcpy ( & page [ ord -> key + key_size ], pb -> id, sizeof * pb -> id );
-#else
-        memcpy ( page  +  ord -> key + key_size, & val_id, sizeof val_id );
-#endif
-
-        /* mark inserted */
-        pb -> was_inserted = true;
-    }
-
-    return rc;
-}
-
-static
-bool leaf_node_full ( const KBTreeLeafNode *node, size_t key_size )
-{
-    /*** add existing keys ***/
-    size_t size = node -> key_bytes;
-    /*** add new key ***/
-
-    assert( key_size >= node -> key_prefix_len);
-    size += key_size + sizeof ( uint32_t ) - node -> key_prefix_len;
-    /*** add key index **/
-    size += (uint8_t*)(node->ord + node -> count+1)  - (uint8_t*)node ;
-
-    if ( size > PGSIZE )
-        return true;
-    return false;
-}
-
-static
-rc_t leaf_insert ( KBTree *self, KBTreeEntryData *pb, KBTreeLeafNode *node, uint32_t slot )
-{
-    rc_t rc;
-    uint16_t q;
-
-    /* check that key will fit */
-    if ( leaf_node_full ( node, pb->key_size ) ) {
-        return RC ( rcDB, rcTree, rcInserting, rcConstraint, rcViolated );
-    }
-
-    /* open hole */
-    if ( slot != node -> count )
-        memmove ( & node -> ord [ slot + 1 ], & node -> ord [ slot ], sizeof node -> ord [ 0 ] * ( node -> count - slot ) );
-
-    /* enter into the leaf */
-    rc = make_entry ( self, pb, node, & node -> ord [ slot ] );
-    if ( rc == 0 )
-        ++ node -> count;
-
-    /* recover from error */
-    else if ( slot != node -> count )
-        memmove ( & node -> ord [ slot ], & node -> ord [ slot + 1 ], sizeof node -> ord [ 0 ] * ( node -> count - slot ) );
-
-    /* correct search windows */
-    q=(pb->key_size > node->key_prefix_len)?((uint8_t*)pb->key)[node->key_prefix_len]:0;
-    /*** unused windows should have been maintained properly ****/
-    assert((node->win[q].upper==node->win[q].lower)?(node->win[q].lower==slot):true);
-    node->win[q].upper ++; 
-    for(q=q+1; q < 256; q++){
-	node->win[q].lower++;
-	node->win[q].upper++;
-    }
-    assert(validate_search_window(node->win));
-    return rc;
-}
-
-static
-int CC KBTreeLeafEntry_sort_desc_by_offset ( const void *a, const void *b, void *data )
-{
-    const KBTreeLeafEntry *ord = ( const void* ) data;
-    int left = * ( const uint16_t* ) a;
-    int right = * ( const uint16_t* ) b;
-    return ord [ right ] . key - ord [ left ] . key;
-}
-
-static
-rc_t split_leaf ( KBTree *self, KBTreeEntryData *pb,
-    KBTreeLeafNode *left, KBTreeLeafNode *right, uint32_t slot, KBTreeSplit *split)
-{
-    size_t off, ksize;
-    bool hoist_existing;
-    uint16_t ord [ ( sizeof left -> ord / sizeof left -> ord [ 0 ] + 1 ) / 2 ];
-
-    /* calculate median */
-    int32_t i, j, median = ( left -> count + 1 ) >> 1;
-
-    /* pointers to pages */
-    uint8_t * lpage = ( void* ) left;
-    uint8_t * rpage = ( void* ) right;
-
-    /* check to see if key being inserted would be hoisted */
-    if ( slot == median && median > ( left -> count >> 1 ) )
-    {
-        hoist_existing = false;
-        ksize = pb -> key_size;
-    }
-    else
-    {
-        /* TBD - choose median based upon count and slot */
-        /* get median key size */
-        hoist_existing = true;
-        ksize = left -> ord [ median ] . ksize + left -> key_prefix_len;
-    }
-
-    /* allocate key space */
-    split -> key = split -> buff;
-    if ( ksize > ( sizeof split -> buff - sizeof ( uint32_t ) ) )
-    {
-        split -> key = malloc ( ksize + sizeof ( uint32_t ) );
-        if ( split -> key == NULL )
-            return RC ( rcDB, rcTree, rcInserting, rcMemory, rcExhausted );
-    }
-
-    /* copy out key plus value id */
-    if ( hoist_existing ){
-	split -> ksize = 0;
-	if(left -> key_prefix_len > 0){
-		memcpy ( ((uint8_t*)split -> key) + split -> ksize, lpage + left -> key_prefix, left -> key_prefix_len );
-		split -> ksize +=left -> key_prefix_len;
-	}
-        memcpy(((uint8_t*)split -> key) + split -> ksize, lpage + left -> ord [ median ] . key , left -> ord [ median ] . ksize + sizeof ( uint32_t ) );
-    	split -> ksize += left -> ord [ median ] . ksize;
-    }
-
-    /* right page is empty */
-    right -> key_bytes = 0;
-
-    /* copy all of the keys to the right of median from left to right */
-    for ( i = 0, j = median + hoist_existing; j < left -> count; ++ i, ++ j )
-    {
-        ksize = left -> ord [ j ] . ksize + sizeof ( uint32_t );
-        right -> ord [ i ] . ksize = left -> ord [ j ] . ksize;
-        right -> key_bytes += (uint16_t) ksize;
-        right -> ord [ i ] . key = ( uint16_t ) ( PGSIZE - right -> key_bytes );
-        memcpy (rpage + right -> ord [ i ] . key, lpage + left -> ord [ j ] . key, ksize );
-	if(i == 0 && left->key_prefix_len > 0){
-		right -> key_prefix_len = left -> key_prefix_len;
-		right -> key_bytes     += left -> key_prefix_len;
-		right -> key_prefix     = PGSIZE - right -> key_bytes;
-		memcpy ( rpage + right -> key_prefix, lpage + left->key_prefix, left -> key_prefix_len );
-	}
-    }
-
-    /* each node has half its former count */
-    right -> count = ( uint16_t ) i;
-    left -> count = median;
-
-    /* compact the keys */
-    for ( i = 0; i < median; ++ i )
-        ord [ i ] = i;
-    ksort ( ord, median, sizeof ord [ 0 ], KBTreeLeafEntry_sort_desc_by_offset, left -> ord );
-    for ( left -> key_bytes = 0, i = 0; i < median; ++ i )
-    {
-        j = ord [ i ];
-        ksize = left -> ord [ j ] . ksize + sizeof ( uint32_t );
-        off = PGSIZE - ( left -> key_bytes += (uint16_t) ksize );
-        if ( left -> ord [ j ] . key != off )
-        {
-            memmove ( & lpage [ off ], & lpage [ left -> ord [ j ] . key ], ksize );
-            left -> ord [ j ] . key = ( uint16_t ) off;
-        }
-	if(i == 0 && left->key_prefix_len > 0){ /** need to restore prefix from the right ***/
-		left -> key_bytes += left -> key_prefix_len;
-		left -> key_prefix = PGSIZE - left -> key_bytes;
-		memcpy ( lpage + left -> key_prefix, rpage + right -> key_prefix, left -> key_prefix_len );
-	}
-    }
-    /*** maintain search windows ****/
-    /*** find the last window of left ***/
-    for(i=0;left->win[i].upper < left->count; i++){
-	assert(i<256);
-	right->win[i].lower=0;
-	right->win[i].upper=0;
-    }
-    j=right->ord[0].ksize?((uint8_t*)right)[right->ord[0].key]:0;
-    assert(i<=j);
-    for(;i<j;i++){
-	right->win[i].lower=0;
-        right->win[i].upper=0;
-        left->win[i].upper=left->count;
-	left->win[i+1].lower=left->count;
-    }
-    /*** set first window of right ***/
-    right->win[i].lower = 0;
-    assert( left->win[i].upper >= left->count + hoist_existing);
-    right->win[i].upper = left->win[i].upper - left->count - hoist_existing;
-    /*** set last window of left ***/ 
-    left->win[i].upper = left->count;
-    i++;
-    /*** set right windows from left, reset left ***/
-    for(;i<256;i++){
-	assert( left->win[i].lower >= left->count + hoist_existing );
-	assert( left->win[i].upper >= left->count + hoist_existing );
-	right->win[i].lower = left->win[i].lower - left->count  - hoist_existing;
-	right->win[i].upper = left->win[i].upper - left->count  - hoist_existing;
-	left->win[i].lower=left->count;
-	left->win[i].upper=left->count;
-    }
-    assert(right->win[255].upper == right -> count);
-    /*** reset right window ***/
-    for(;i<256;i++){
-	right->win[i].lower=right->count;
-        right->win[i].upper=right->count;
-    }
-    assert(validate_search_window(right->win));
-    assert(validate_search_window(left->win));
-    /*****************************************/
-
-    /* if insert would be hoisted, do it directly */
-    if ( ! hoist_existing )
-    {
-#if BTREE_KEY2ID
-#if 0 /*** use external id ***/
-        if ( ( * pb -> id = ++ self -> hdr . id_seq ) == 0 )
-        {
-            -- self -> hdr . id_seq;
-            return RC ( rcDB, rcTree, rcInserting, rcId, rcExhausted );
-        }
-#endif
-        memcpy ( split -> key, pb -> key , pb -> key_size );
-        memcpy ( & ( ( uint8_t* ) split -> key ) [ pb -> key_size ], pb -> id, sizeof * pb -> id );
-        split -> ksize =  (uint16_t) pb -> key_size;
-        return 0;
-#else
-        /* insert value */
-        uint32_t val_id;
-        rc_t rc = KPageFileStreamAlloc ( & self -> hdr . val_stream, self -> pgfile,
-            pb -> val, pb -> alloc_size, & val_id );
-        if ( rc == 0 )
-        {
-            memcpy ( split -> key, pb->key, pb->key_size);
-            * ( uint32_t* ) & ( ( uint8_t* ) split -> key ) [ pb->key_size ] = val_id;
-	    split -> ksize =  pb -> key_size;
-        }
-        return rc;
-#endif
-    }
-
-    /* TBD - with keys in pages, there is no guarantee that the following insert
-       will succeed, unless there would be a provision for overflow. */
-
-    /* decide where to insert entry */
-    if ( slot <= (uint32_t) median )
-        return leaf_insert ( self, pb, left, slot );
-    return leaf_insert ( self, pb, right, slot - median - 1 );
-}
-
-
-
-static
-rc_t leaf_entry ( KBTree *self, KBTreeEntryData *pb, KPage *page, KBTreeSplit *split)
-{
-    int lower, upper;
-    KBTreeLeafNode *node;
-
-    const uint8_t *query = pb -> key;
-    size_t qsize = pb -> key_size;
-    uint16_t q;
-
-    /* access page for read */
-    const KBTreeLeafNode *cnode;
-    rc_t rc = page_access_read ( page, ( const void** ) & cnode );
-    if ( rc != 0 )
-        return rc;
-
-    /* special case for root node initial insert */
-    if ( cnode -> count == 0 )
-    {
-        rc = page_access_update ( page, ( void** ) & node );
-        if ( rc == 0 )
-        {
-            rc = make_entry ( self, pb, node, & node -> ord [ 0 ] );
-            if ( rc == 0 ){
-		int i;
-	    	q=(qsize >0)? *query:0;
-                node -> count = 1;
-		node -> win[q].lower = 0;
-		node -> win[q].upper = 1;
-		for(i=0;i<q;i++){
-			node -> win[i].lower = 0;
-			node -> win[i].upper = 0;
-		}
-		for(i=q+1;i<256;i++){
-                        node -> win[i].lower = 1;
-                        node -> win[i].upper = 1;
-                }
-    		assert(validate_search_window(node->win));
-
-	    }
-        }
-        return rc;
-    }
-
-    /* perform search on branch node */
-    /* start with prefix compare */
-    if(cnode->key_prefix_len > 0){
-        const size_t key_prefix_len=cnode->key_prefix_len;
- 	/*** prefix must match ***/	
-        assert(compare_keys(self,query,key_prefix_len, ((char *)cnode )+cnode->key_prefix,key_prefix_len) == 0);
-	/*************************/
-	query += cnode->key_prefix_len;
-	qsize -= cnode->key_prefix_len;
-	
-    }
-    q=(qsize >0)? *query:0;
-    for ( lower = cnode->win[q].lower, upper = cnode -> win[q].upper; lower < upper; )
-    {
-        /* determine the slot to examine */
-        int slot = ( lower + upper ) >> 1;
-
-        /* perform comparison */
-        const uint8_t *key = & ( ( const uint8_t* ) cnode ) [ cnode -> ord [ slot ] . key ];
-        int diff = compare_keys ( self, query, qsize, key, cnode -> ord [ slot ] . ksize );
-        if ( diff == 0 )
-        {
-            uint32_t val_id;
-            memcpy ( & val_id, & key [ cnode -> ord [ slot ] . ksize ], sizeof val_id );
-#if BTREE_KEY2ID
-            * pb -> id = val_id;
-            return 0;
-#else
-            return KPageFileStreamGet ( & self -> hdr . val_stream, self -> pgfile, pb -> val, val_id );
-#endif
-        }
-        if ( diff < 0 )
-            upper = slot;
-        else
-            lower = slot + 1;
-    }
-
-    /* should have the last slot tried ( < 0 ) or next slot to try ( > 0 ) */
-    assert ( lower == upper );
-
-    /* going to need to update the node */
-    rc = page_access_update ( page, ( void** ) & node );
-    if ( rc != 0 )
-        return rc;
-
-    /* unless an error occurs */
-    pb -> was_inserted = true;
-
-    /* test for split */
-    if ( leaf_node_full ( node, pb->key_size ) )
-    {
-        KPage *dup;
-
-        /* create another leaf node to right */
-        rc = KPageFileAlloc ( self -> pgfile, & dup, & split -> right );
-        if ( rc == 0 )
-        {
-            void *mem;
-            rc = page_access_update ( dup, & mem );
-            if ( rc == 0 )
-            {
-                rc = split_leaf ( self, pb, node, mem, upper, split);
-                if ( rc == 0 )
-                {
-                    rc = RC ( rcDB, rcTree, rcInserting, rcId, rcInsufficient );
-                    split -> right <<= 1;
-                }
-            }
-
-            KPageRelease ( dup );
-        }
-    }
-    else
-    {
-        /* simple insert */
-        rc = leaf_insert ( self, pb, node, upper );
-
-#if _DEBUGGING && _HUGE_CROWBAR_KLUDGE
-        validate_key_order ( self, pb, node );
-#endif
-    }
-
-    return rc;
-}
-
-
-#if _DEBUGGING
-static
-void dump_branch_page ( const KBTreeBranchNode *cnode )
-{
-    int i;
-    const char *page;
-
-    if ( cnode == NULL )
-    {
-        printf ( "NULL\n\n" );
-        return;
-    }
-
-    printf ( "KBTreeBranchNode\n"
-             "  count:     %u\n"
-             "  key bytes: %u\n"
-             , cnode -> count
-             , cnode -> key_bytes
-        );
-
-    if ( cnode -> count == 0 )
-    {
-        putchar ( '\n' );
-        return;
-    }
-
-    page = ( const void* ) cnode;
-
-    printf ( "  entries:\n" );
-    for ( i = 0; i < cnode -> count; ++ i )
-    {
-        int key_size = cnode -> ord [ i ] . ksize;
-        const char *key = & page [ cnode -> ord [ i ] . key ];
-        uint32_t val_id = * ( const uint32_t* ) & key [ key_size ];
-        printf ( "  % 5d. key = '%.*s', offset = %u, value-id = %u\n"
-                 , i
-                 , key_size, key
-                 , cnode -> ord [ i ] . key
-                 , val_id
-            );
-    }
-
-    printf ( "  transitions:\n" );
-    for ( i = 0; i <= cnode -> count; ++ i )
-    {
-        uint32_t node_id = cnode -> ord [ i - 1 ] . trans;
-        printf ( "  % 5d. node-id = %u\n"
-                 , i
-                 , node_id
-            );
-    }
-
-    putchar ( '\n' );
-}
-#endif
-
-static
-bool branch_node_full ( const KBTreeBranchNode *node, size_t key_size )
-{
-    /*** add existing keys ***/
-    size_t size = node -> key_bytes;
-    /*** add new key ***/
-    assert( key_size >= node -> key_prefix_len);
-    size += key_size + sizeof ( uint32_t ) - node -> key_prefix_len;
-
-    /*** add key index **/
-    size += (uint8_t*)(node->ord + node -> count+1)  - (uint8_t*)node ;
-    if ( size > PGSIZE )
-        return true;
-    return false;
-}
-
-static
-rc_t branch_insert ( KBTree *self, KBTreeBranchNode *node, const KBTreeSplit *split, uint32_t slot )
-{
-    uint16_t ksize = split -> ksize;
-    uint8_t *key   = split -> key;
-    uint8_t *page = (uint8_t*) node;
-    uint16_t q;
-
-    /* remove prefix from the key */
-    ksize -= node -> key_prefix_len;
-
-    assert(memcmp(key,page + node->key_prefix, node -> key_prefix_len)==0);/*** validate in debug mode **/ 
-    key   += node -> key_prefix_len;
-
-    /* check that key will fit */
-    if ( branch_node_full ( node, split -> ksize ) )
-        return RC ( rcDB, rcTree, rcInserting, rcConstraint, rcViolated );
-
-    /* open hole */
-    if ( slot != node -> count )
-        memmove ( & node -> ord [ slot + 1 ], & node -> ord [ slot ], sizeof node -> ord [ 0 ] * ( node -> count - slot ) );
-
-    /* enter key value pair */
-    node -> key_bytes += ksize + sizeof ( uint32_t );
-    node -> ord [ slot ] . ksize = ksize;
-    node -> ord [ slot ] . key = ( uint16_t ) ( PGSIZE - node -> key_bytes );
-    memcpy ( & ( ( uint8_t* ) node ) [ PGSIZE - node -> key_bytes ], key, ksize + sizeof ( uint32_t ) );
-
-    /* enter the new transitions */
-    assert ( node -> ord [ ( int ) slot - 1 ] . trans == split -> left );
-    node -> ord [ ( int ) slot - 1 ] . trans = split -> left;
-    node -> ord [ slot ] . trans = split -> right;
-#if 0
-    printf("branch_insert: count:%d prefix_len:%d slot:%d left:%d right:%d \n",node->count, node->key_prefix_len, slot,split -> left,split -> right);
-#endif
-
-    ++ node -> count;
-    
-    /* correct search windows */
-    q=(split->ksize > node->key_prefix_len)?((uint8_t*)split->key)[node->key_prefix_len]:0;
-    /*** unused windows should have beed maintained properly ****/
-    assert((node->win[q].upper==node->win[q].lower)?(node->win[q].lower==slot):true);
-    node->win[q].upper ++;
-    for(q=q+1; q < 256; q++){
-        node->win[q].lower++;
-        node->win[q].upper++;
-    }
-    assert(validate_search_window(node->win));
-    return 0;
-}
-
-static
-int CC KBTreeBranchEntry_sort_desc_by_offset ( const void *a, const void *b, void *data )
-{
-    const KBTreeBranchEntry *ord = ( const void* ) data;
-    int left = * ( const uint16_t* ) a;
-    int right = * ( const uint16_t* ) b;
-    return ord [ right ] . key - ord [ left ] . key;
-}
-
-static
-rc_t split_branch ( KBTree *self,
-    KBTreeBranchNode *left, KBTreeBranchNode *right,
-    const KBTreeSplit *val, KBTreeSplit *split, uint32_t slot)
-{
-    size_t off, ksize;
-    bool hoist_existing;
-    uint16_t ord [ ( sizeof left -> ord / sizeof left -> ord [ 0 ] + 1 ) / 2 ];
-
-    /* calculate median */
-    int32_t i, j, median = ( left -> count + 1 ) >> 1;
-
-    /* pointers to pages */
-    uint8_t * lpage = ( void* ) left;
-    uint8_t * rpage = ( void* ) right;
-
-    /* check to see if key being inserted would be hoisted */
-    if ( slot == median && median > ( left -> count >> 1 ) )
-    {
-        hoist_existing = false;
-        ksize = val -> ksize;
-    }
-    else
-    {
-        /* get median key size */
-        hoist_existing = true;
-        ksize = left -> ord [ median ] . ksize + left -> key_prefix_len;
-    }
-
-    /* allocate key space */
-    split -> key = split -> buff;
-    if ( ksize > ( sizeof split -> buff - sizeof ( uint32_t ) ) )
-    {
-        split -> key = malloc ( ksize + sizeof ( uint32_t ) );
-        if ( split -> key == NULL )
-            return RC ( rcDB, rcTree, rcInserting, rcMemory, rcExhausted );
-    }
-
-    /* copy out key plus value id */
-    if ( hoist_existing ){
-        split -> ksize = 0;
-        if(left -> key_prefix_len > 0){
-                memcpy ( ((uint8_t*)split -> key) + split -> ksize, lpage + left -> key_prefix, left -> key_prefix_len );
-                split -> ksize +=left -> key_prefix_len;
-        }
-        memcpy(((uint8_t*)split -> key) + split -> ksize, lpage + left -> ord [ median ] . key , left -> ord [ median ] . ksize + sizeof ( uint32_t ) );
-        split -> ksize +=  left -> ord [ median ] . ksize;
-    }
-
-
-    /* right page is empty */
-    right -> key_bytes = 0;
-
-    /* copy all of the keys to the right of the median from left to right */
-    for ( i = 0, j = median + hoist_existing; j < left -> count; ++ i, ++ j )
-    {
-        ksize = left -> ord [ j ] . ksize + sizeof ( uint32_t );
-        right -> ord [ i ] . ksize = left -> ord [ j ] . ksize;
-        right -> key_bytes += (uint16_t) ksize;
-        right -> ord [ i ] . key = ( uint16_t ) ( PGSIZE - right -> key_bytes );
-        memcpy ( & rpage [ PGSIZE - right -> key_bytes ], & lpage [ left -> ord [ j ] . key ], ksize );
-        right -> ord [ i - 1 ] . trans = left -> ord [ j - 1 ] . trans;
-        if(i == 0 && left->key_prefix_len > 0){
-                off = PGSIZE - right -> key_bytes - left -> key_prefix_len;
-                memcpy ( & rpage [ off ], lpage + left -> key_prefix, left -> key_prefix_len );
-                right -> key_bytes += left -> key_prefix_len;
-                right -> key_prefix_len = left -> key_prefix_len;
-                right -> key_prefix = (uint16_t) off;
-        }
-    }
-
-    /* copy the last trans */
-    right -> ord [ i - 1 ] . trans = left -> ord [ j - 1 ] . trans;
-
-    /* each node has half its former count */
-    right -> count = ( uint16_t ) i;
-    left -> count = median;
-
-    /* compact the keys */
-    for ( i = 0; i < median; ++ i )
-        ord [ i ] = i;
-    ksort ( ord, median, sizeof ord [ 0 ], KBTreeBranchEntry_sort_desc_by_offset, left -> ord );
-    for ( left -> key_bytes = 0, i = 0; i < median; ++ i )
-    {
-        j = ord [ i ];
-        ksize = left -> ord [ j ] . ksize + sizeof ( uint32_t );
-        off = PGSIZE - ( left -> key_bytes += (uint16_t) ksize );
-        if ( left -> ord [ j ] . key != off )
-        {
-            memmove ( & lpage [ off ], & lpage [ left -> ord [ j ] . key ], ksize );
-            left -> ord [ j ] . key = ( uint16_t ) off;
-        }
-	if(i == 0 && left->key_prefix_len > 0){ /** need to restore prefix from the right ***/
-                off = PGSIZE - left -> key_bytes - left -> key_prefix_len;
-                memcpy ( & lpage [ off ], rpage + right -> key_prefix, left -> key_prefix_len );
-                left -> key_bytes += left -> key_prefix_len;
-                left -> key_prefix = (uint16_t) off;
-        }
-    }
-    /*** maintain search windows ****/
-    /*** find the last window of left ***/
-    for(i=0;left->win[i].upper < left->count; i++){
-	assert(i<256);
-	right->win[i].lower=0;
-	right->win[i].upper=0;
-    }
-    j=right->ord[0].ksize?((uint8_t*)right)[right->ord[0].key]:0;
-    assert(i<=j);
-    for(;i<j;i++){
-	right->win[i].lower=0;
-        right->win[i].upper=0;
-        left->win[i].upper=left->count;
-	left->win[i+1].lower=left->count;
-    }
-    /*** set first window of right ***/
-    right->win[i].lower = 0;
-    assert( left->win[i].upper >= left->count + hoist_existing);
-    right->win[i].upper = left->win[i].upper - left->count - hoist_existing;
-    /*** set last window of left ***/ 
-    left->win[i].upper = left->count;
-    i++;
-    /*** set right windows from left, reset left ***/
-    for(;i<256;i++){
-	assert( left->win[i].lower >= left->count + hoist_existing );
-	assert( left->win[i].upper >= left->count + hoist_existing );
-	right->win[i].lower = left->win[i].lower - left->count  - hoist_existing;
-	right->win[i].upper = left->win[i].upper - left->count  - hoist_existing;
-	left->win[i].lower=left->count;
-	left->win[i].upper=left->count;
-    }
-    assert(right->win[255].upper == right -> count);
-    /*** reset right window ***/
-    for(;i<256;i++){
-	right->win[i].lower=right->count;
-        right->win[i].upper=right->count;
-    }
-    assert(validate_search_window(right->win));
-    assert(validate_search_window(left->win));
-    /*****************************************/
-
-    /* if insert would be hoisted, do it directly */
-    if ( ! hoist_existing )
-    {
-        /* copy key and value */
-        memcpy ( split -> key, val -> key, val -> ksize + sizeof ( uint32_t ) );
-	split ->  ksize = val -> ksize;
-
-        /* set left and right transitions */
-        assert ( left -> ord [ median - 1 ] . trans == val -> left );
-        left -> ord [ median - 1 ] . trans = val -> left;
-        right -> ltrans = val -> right;
-
-        return 0;
-    }
-
-    /* decide where to insert entry */
-    if ( slot <= (uint32_t) median )
-        return branch_insert ( self, left, val, slot );
-    return branch_insert ( self, right, val, slot - median - 1 );
-}
-#define MIN_PREFIX_TO_COMPACT 1 /*** minimum prefix delta to initiate compacting ****/
-static
-rc_t leaf_compact (KBTree *self, KPage *pg,uint16_t prefix_len)
-{
-    const KBTreeLeafNode *cnode;
-    rc_t rc = page_access_read(pg, ( const void** ) & cnode );
-    if(rc == 0  && cnode->key_prefix_len < prefix_len) {
-	assert(cnode->count   > 0); 
-	if( cnode->count   > 0 && prefix_len > cnode->key_prefix_len ){
-	    prefix_len -= cnode->key_prefix_len; /*** need only to compact the delta **/
-	    assert(memcmp(((uint8_t*)cnode)+cnode->ord[0].key,
-		          ((uint8_t*)cnode)+cnode->ord[cnode->count-1].key,
-			  prefix_len )==0);/****** To be sure ****/
-            if( prefix_len >= MIN_PREFIX_TO_COMPACT){ /*** good to compact ***/
-		KBTreeLeafNode *node;
-		rc = page_access_update ( pg, ( void** ) & node );
-		if(rc == 0){
-			uint8_t  q,last;
-			uint16_t i;
-			uint16_t ord [ ( sizeof node -> ord / sizeof node -> ord [ 0 ] + 1 ) / 2 ];
-			for ( i = 0; i < node->count; ++ i ) ord[i]=i; /*** build and sort indexing array ***/
-			ksort ( ord, node->count, sizeof ord [ 0 ], KBTreeLeafEntry_sort_desc_by_offset, node -> ord );
-			/*** deal with prefix and index 0 ***/
-			/*** prefix is cut from the last stored key on the page **/
-			if(node->key_prefix_len == 0){
-				node->key_prefix = node->ord[ord[0]].key;
-			}
-			node->key_prefix_len    += prefix_len;
-			node->ord[ord[0]].key   += prefix_len;
-			node->ord[ord[0]].ksize -= prefix_len;
-			/*** deal with index 1 (shift) ***/
-			if(node->count > 1){
-				node->ord[ord[1]].key   += prefix_len;
-				node->ord[ord[1]].ksize -= prefix_len;
-			}
-			/*** cut all other values ***/
-			for ( i = 2; i < node->count; ++ i ){
-				uint16_t j = ord[i];
-				uint8_t *src = ((uint8_t*)node) + node->ord[j].key + prefix_len;
-				uint8_t *dst = src + (i-1)*prefix_len; /*** proportional offset ***/
-				uint16_t ksize = node->ord[j].ksize + sizeof ( uint32_t ) - prefix_len;
-				memmove(dst,src,ksize);
-				node->ord[j].ksize -= prefix_len;
-				node->ord[j].key    = (uint16_t) ( dst -  ((uint8_t*)node) );
-			}
-			assert( node -> key_bytes > (node->count-1) * prefix_len);
-			node -> key_bytes -= (node->count-1) * prefix_len;
-			/*** rebuild search windows ***/
-			q=node->ord[0].ksize?((uint8_t*)node)[node->ord[0].key]:0;
-			for(i=0;i<q;i++){
-				node->win[i].lower=0;
-				node->win[i].upper=0;
-			}
-			node->win[q].lower=0;
-			for(i=0,last=q;i< node->count; ++ i ){
-				q=node->ord[i].ksize?((uint8_t*)node)[node->ord[i].key]:0;
-				assert(last<=q);
-				if(q!=last){
-					node->win[last++].upper = i;
-					for(;last<q;last++){/*** need to catch up ***/
-						node->win[last].lower=i;
-						node->win[last].upper=i;
-					}
-					node->win[q].lower=i;
-					last=q;
-				}
-			}
-			node->win[last].upper=node->count;
-			for(i=last+1;i<256;i++){
-				node->win[i].lower=node->count;
-				node->win[i].upper=node->count;
-			}
-			assert(validate_search_window(node->win));
-		}	
-	    }
-	}
-    }
-    return rc;
-}
-static
-rc_t branch_compact (KBTree *self, KPage *pg,uint16_t prefix_len)
-{
-    const KBTreeBranchNode *cnode;
-    rc_t rc = page_access_read(pg, ( const void** ) & cnode );
-    if(rc == 0 && cnode->key_prefix_len < prefix_len) {
-	assert(cnode->count   > 0); 
-	if( cnode->count   > 0 && prefix_len > cnode->key_prefix_len ){
-	    prefix_len -= cnode->key_prefix_len; /*** need only to compact the delta **/
-	    assert(memcmp(((uint8_t*)cnode)+cnode->ord[0].key,
-		          ((uint8_t*)cnode)+cnode->ord[cnode->count-1].key,
-			  prefix_len )==0);/****** To be sure ****/
-            if( prefix_len >= MIN_PREFIX_TO_COMPACT){ /*** good to compact ***/
-		KBTreeBranchNode *node;
-		rc = page_access_update ( pg, ( void** ) & node );
-		if(rc == 0){
-			uint8_t	 q,last;
-			uint16_t i;
-			uint16_t ord [ ( sizeof node -> ord / sizeof node -> ord [ 0 ] + 1 ) / 2 ];
-			for ( i = 0; i < node->count; ++ i ) ord[i]=i; /*** build and sort indexing array ***/
-			ksort ( ord, node->count, sizeof ord [ 0 ], KBTreeBranchEntry_sort_desc_by_offset, node -> ord );
-			/*** deal with prefix and index 0 ***/
-			/*** prefix is cut from the last stored key on the page **/
-			if(node->key_prefix_len == 0){
-				node->key_prefix = node->ord[ord[0]].key;
-			}
-			node->key_prefix_len    += prefix_len;
-			node->ord[ord[0]].key   += prefix_len;
-			node->ord[ord[0]].ksize -= prefix_len;
-			/*** deal with index 1 (shift) ***/
-			if(node->count > 1){
-				node->ord[ord[1]].key   += prefix_len;
-				node->ord[ord[1]].ksize -= prefix_len;
-			}
-			/*** cut all other values ***/
-			for ( i = 2; i < node->count; ++ i ){
-				uint16_t j = ord[i];
-				uint8_t *src = ((uint8_t*)node) + node->ord[j].key + prefix_len;
-				uint8_t *dst = src + (i-1)*prefix_len; /*** proportional offset ***/
-				uint16_t ksize = node->ord[j].ksize + sizeof ( uint32_t ) - prefix_len;
-				memmove(dst,src,ksize);
-				node->ord[j].ksize -= prefix_len;
-				node->ord[j].key    = (uint16_t) ( dst -  ((uint8_t*)node) );
-			}
-			assert( node -> key_bytes > (node->count-1) * prefix_len);
-			node -> key_bytes -= (node->count-1) * prefix_len;
-			/*** rebuild search windows ***/
-			 q=node->ord[0].ksize?((uint8_t*)node)[node->ord[0].key]:0;
-                        for(i=0;i<q;i++){
-                                node->win[i].lower=0;
-                                node->win[i].upper=0;
-                        }
-                        node->win[q].lower=0;
-                        for(i=0,last=q;i< node->count; ++ i ){
-                                q=node->ord[i].ksize?((uint8_t*)node)[node->ord[i].key]:0;
-                                assert(last<=q);
-                                if(q!=last){
-                                        node->win[last++].upper = i;
-                                        for(;last<q;last++){/*** need to catch up ***/
-                                                node->win[last].lower=i;
-                                                node->win[last].upper=i;
-                                        }
-                                        node->win[q].lower=i;
-                                        last=q;
-                                }
-                        }
-                        node->win[last].upper=node->count;
-                        for(i=last+1;i<256;i++){
-                                node->win[i].lower=node->count;
-                                node->win[i].upper=node->count;
-                        }
-                        assert(validate_search_window(node->win));
-		}	
-	    }
-	}
-    }
-    return rc;
-}
-
-static
-rc_t compact_page ( KBTree *self, uint32_t nid, uint16_t prefix_len)
-{
-    KPage *pg;
-    rc_t rc = KPageFileGet ( self -> pgfile, & pg, nid >> 1 );
-    if ( rc == 0 ){
-	rc = ( ( nid & 1 ) == 0 ) ?
-            leaf_compact ( self, pg, prefix_len):
-            branch_compact ( self, pg, prefix_len);
-	KPageRelease(pg);
-    }
-    return rc;
-}
-
-
-static
-rc_t branch_entry ( KBTree *self, KBTreeEntryData *pb, KPage *page, KBTreeSplit *rsplit)
-{
-    KPage *child;
-    uint32_t nid;
-    int lower, upper;
-    const uint8_t *query = pb -> key;
-    size_t qsize = pb -> key_size;
-    uint16_t q;
-
-    /* look at node in read-only mode */
-    const KBTreeBranchNode *cnode;
-    rc_t rc = page_access_read ( page, ( const void** ) & cnode );
-    if ( rc != 0 )
-        return rc;
-
-    /* perform search on branch node */
-    /* start with prefix compare */
-    if(cnode->key_prefix_len > 0){
-        const size_t key_prefix_len=cnode->key_prefix_len;
- 	/*** prefix must match ***/	
-        assert(compare_keys(self,query,key_prefix_len, ((char *)cnode )+cnode->key_prefix,key_prefix_len) == 0);
-	/*************************/
-	query += cnode->key_prefix_len;
-	qsize -= cnode->key_prefix_len;
-    }
-    q = (qsize>0)?*query:0;
-
-    for ( lower = cnode->win[q].lower, upper = cnode -> win[q].upper; lower < upper; )
-    {
-        /* determine the slot to examine */
-        int slot = ( lower + upper ) >> 1;
-
-        /* perform comparison */
-        const uint8_t *key = & ( ( const uint8_t* ) cnode ) [ cnode -> ord [ slot ] . key ];
-        int diff = compare_keys ( self, query, qsize, key, cnode -> ord [ slot ] . ksize );
-        if ( diff == 0 )
-        {
-            uint32_t val_id = * ( const uint32_t* ) & key [ cnode -> ord [ slot ] . ksize ];
-#if BTREE_KEY2ID
-            * pb -> id = val_id;
-            return 0;
-#else
-            return KPageFileStreamGet ( & self -> hdr . val_stream, self -> pgfile, pb -> val, val_id );
-#endif
-        }
-        if ( diff < 0 )
-            upper = slot;
-        else
-            lower = slot + 1;
-    }
-
-    /* should have the last slot tried ( < 0 ) or next slot to try ( > 0 ) */
-    assert ( lower == upper );
-
-    /* the node id is left-shifted by 1 and has the "branch-bit" indicator
-       in the LSB. the remaining bits should NOT be zero */
-    nid = cnode -> ord [ upper - 1 ] . trans;
-    assert ( ( nid >> 1 ) != 0 );
-
-    /* access child node */
-    rc = KPageFileGet ( self -> pgfile, & child, nid >> 1 );
-    if ( rc == 0 )
-    {
-        KBTreeSplit split;
-        KBTreeSplitInit ( & split );
-        /* recursively continue search */
-        rc = ( ( nid & 1 ) == 0 ) ?
-            leaf_entry ( self, pb, child, & split):
-            branch_entry ( self, pb, child, & split);
-        if ( rc != 0 )
-        {
-            /* detect split */
-            if ( GetRCState ( rc ) == rcInsufficient && GetRCObject ( rc ) == rcId )
-            {
-		/* splitting may replace value being inserted in to the branch ***/
-                /* access current node */
-                KBTreeBranchNode *node;
-                rc = page_access_update ( page, ( void** ) & node );
-                if ( rc == 0 )
-                {
-                    split . left = nid;
-
-                    /* if we are also full, we have to split */
-                    if ( branch_node_full ( node, split.ksize ) )
-                    {
-                        KPage *dup;
-                        /* create another branch node to right */
-                        rc = KPageFileAlloc ( self -> pgfile, & dup, & rsplit -> right );
-                        if ( rc == 0 )
-                        {
-                            void *mem;
-                            rc = page_access_update ( dup, & mem );
-                            if ( rc == 0 )
-                            {
-                                split_branch( self, node, mem, & split, rsplit, upper);
-                                rc = RC ( rcDB, rcTree, rcInserting, rcId, rcInsufficient );
-                                rsplit -> right += rsplit -> right + 1;
-                            }
-
-                            KPageRelease ( dup );
-                        }
-                    }
-                    else
-                    {
-			int pl;/**common prefix_len **/
-                        /* hoist into location */
-			/* it will increase node->count and upper will start pointing into a new key ***/
-			if(rc==0 && upper > 0 ){ /*** left side compact is possible  upper is 1 based ***/
-				uint8_t   *a = (uint8_t*)split.key;
-				uint8_t   *b = (uint8_t*)node;
-
-				a += node->key_prefix_len;
-				b += node->ord[upper-1].key;
-				assert ( node->ord[upper-1].trans == split.left );
-				for(pl=0;pl < split.ksize - node->key_prefix_len && pl < node->ord[upper-1].ksize && a[pl]==b[pl];pl++){}
-				pl+=node->key_prefix_len;
-                                if(pl >= MIN_PREFIX_TO_COMPACT){
-					rc=compact_page(self,split.left,pl);
-				}
-			}
-			if(rc==0 && upper < node->count ){ /*** right side compact is possible ***/
-				uint8_t   *a = (uint8_t*)split.key;
-				uint8_t   *b = (uint8_t*)node;
-				a += node->key_prefix_len;
-				b += node->ord[upper].key;
-				for(pl=0;pl < split.ksize - node->key_prefix_len && pl < node->ord[upper].ksize && a[pl]==b[pl];pl++){}
-				pl+=node->key_prefix_len;
-                                if(pl >= MIN_PREFIX_TO_COMPACT){
-					rc=compact_page(self,split.right,pl);
-                                }
-			} 
-			if(rc == 0 ){
-				rc=branch_insert ( self, node, & split, upper );
-				assert(rc==0);
-			}
-                    }
-                }
-            }
-        }
-
-        KBTreeSplitWhack ( & split );
-
-        KPageRelease ( child );
-    }
-
-    return rc;
-}
-
-
-#if BTREE_KEY2ID
-LIB_EXPORT rc_t CC KBTreeEntry ( KBTree *self, uint64_t *id,
-    bool *was_inserted, const void *key, size_t key_size )
-#else
-LIB_EXPORT rc_t CC KBTreeEntry ( KBTree *self,
-    KBTreeValue *val, bool *was_inserted, size_t alloc_size,
-    const void *key, size_t key_size )
-#endif
-{
-    rc_t rc;
-
-    bool dummy;
-    if ( was_inserted == NULL )
-        was_inserted = & dummy;
-
-#if BTREE_KEY2ID
-    if ( id == NULL )
-#else
-    if ( val == NULL )
-#endif
-        rc = RC ( rcDB, rcTree, rcUpdating, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcTree, rcUpdating, rcSelf, rcNull );
-        else if ( key_size == 0 )
-            rc = RC ( rcDB, rcTree, rcUpdating, rcParam, rcEmpty );
-        else if ( key == NULL )
-            rc = RC ( rcDB, rcTree, rcUpdating, rcParam, rcNull );
-        else if ( key_size < self -> hdr . key_min )
-            rc = RC ( rcDB, rcTree, rcUpdating, rcParam, rcInsufficient );
-        else if ( key_size > self -> hdr . key_max )
-            rc = RC ( rcDB, rcTree, rcUpdating, rcParam, rcExcessive );
-        else
-        {
-            bool leaf;
-            KPage *page;
-
-#if BTREE_KEY2ID && ! BTREE_KEY2ID64
-            /* TEMPORARY
-               until full 64-bit ids are supported
-            */
-            uint32_t id32 = ( uint32_t ) * id;
-#endif
-
-            /* package the entry params into a block */
-            KBTreeEntryData pb;
-            pb . self = self;
-#if BTREE_KEY2ID64
-            pb . id = id;
-#elif BTREE_KEY2ID
-            pb . id = & id32;
-#else
-            pb . val = val;
-            pb . alloc_size = alloc_size;
-#endif
-            pb . key = key;
-            pb . key_size = key_size;
-            pb . was_inserted = false;
-
-            /* get root node */
-            if ( self -> hdr . root == 0 )
-            {
-                /* allocate initial node */
-                leaf = true;
-                rc = KPageFileAlloc ( self -> pgfile, & page, & self -> hdr . root );
-                self -> hdr . root <<= 1;
-            }
-            else
-            {
-                /* fetch existing */
-                leaf = ( self -> hdr . root & 1 ) == 0;
-                rc = KPageFileGet ( self -> pgfile, & page, self -> hdr . root >> 1 );
-            }
-            if ( rc == 0 )
-            {
-                KBTreeSplit split;
-                KBTreeSplitInit ( & split );
-
-                /* perform recursive operation */
-		/* top page is always unbounded */
-                rc = leaf ?
-                    leaf_entry ( self, & pb, page, & split ):
-                    branch_entry ( self, & pb, page, & split );
-
-#if BTREE_KEY2ID && ! BTREE_KEY2ID64
-                * id = id32;
-#endif
-                if ( rc != 0 )
-                {
-                    /* detect split */
-                    if ( GetRCState ( rc ) == rcInsufficient && GetRCObject ( rc ) == rcId )
-                    {
-                        KPage *new_root;
-
-                        /* record old root */
-                        split . left = self -> hdr . root;
-                        rc = KPageFileAlloc ( self -> pgfile, & new_root, & self -> hdr . root );
-                        if ( rc == 0 )
-                        {
-                            KBTreeBranchNode *node;
-                            rc = page_access_update ( new_root, ( void** ) & node );
-                            if ( rc == 0 )
-                            {
-				uint16_t	q,i;
-                                /* install the new root */
-                                node -> key_bytes = split . ksize + sizeof ( uint32_t );
-                                node -> key_prefix_len = 0;
-                                node -> key_prefix = 0;
-                                node -> ord [ 0 ] . ksize = split . ksize;
-                                node -> ord [ 0 ] . key = ( uint16_t ) ( PGSIZE - node -> key_bytes );
-                                memcpy ( & ( ( uint8_t* ) node ) [ PGSIZE - node -> key_bytes ], split . key, node -> key_bytes );
-                                node -> ltrans = split . left;
-                                node -> ord [ 0 ] . trans = split . right;
-                                node -> count = 1;
-/* 				assert ( split . left < 10000 && split . right < 10000); */
-                                /*** init search windows ***/
-                                q=(split.ksize>0)? *(uint8_t*)split.key:0;
-				node -> win[q].lower = 0;
-				node -> win[q].upper = 1;
-				for(i=0;i<q;i++){
-					node -> win[i].lower = 0;
-					node -> win[i].upper = 0;
-				}
-				for(i=q+1;i<256;i++){
-					node -> win[i].lower = 1;
-					node -> win[i].upper = 1;
-				}
-				assert(validate_search_window(node->win));
-
-                                /* mark as branch node */
-                                self -> hdr . root += self -> hdr . root + 1;
-                            }
-
-                            KPageRelease ( new_root );
-                        }
-
-                        if ( rc != 0 )
-                            self -> hdr . root = split . left;
-                    }
-                }
-
-                KPageRelease ( page );
-
-                KBTreeSplitWhack ( & split );
-
-                if ( rc == 0 )
-                {
-                    * was_inserted = pb . was_inserted;
-                    return 0;
-                }
-            }
-        }
-
-#if BTREE_KEY2ID
-        * id = 0;
-#else
-        memset ( val, 0, sizeof * val );
-#endif
-    }
-
-    * was_inserted = false;
-    return rc;
-}
-
-
-/* ForEach
- *  executes a function on each tree element
- *
- *  "reverse" [ IN ] - if true, iterate in reverse order
- *
- *  "f" [ IN ] and "data" [ IN, OPAQUE ] - callback function
- */
-#if BTREE_KEY2ID
-static
-rc_t invoke_foreach_func ( const KBTree *self, const void *cnode, const void *ordp,
-    void ( CC * f ) ( const void *key, size_t key_size, uint64_t id, void *data ), void *data )
-#else
-static
-rc_t invoke_foreach_func ( const KBTree *self, const void *cnode, const void *ordp,
-    void ( CC * f ) ( const void *key, size_t key_size, KBTreeValue *val, void *data ), void *data )
-#endif
-{
-#if ! BTREE_KEY2ID
-    rc_t rc;
-    KBTreeValue val;
-#endif
-
-    const KBTreeLeafEntry *ord = ordp;
-    const uint8_t *page = cnode;
-    const uint8_t *key = & page [ ord -> key ];
-    size_t key_size = ord -> ksize;
-
-    uint32_t val_id;
-    memcpy ( & val_id, & key [ key_size ], sizeof val_id );
-
-#if BTREE_KEY2ID
-    ( * f ) ( key, key_size, val_id, data );
-    return 0;
-#else
-    rc = KPageFileStreamGet ( & self -> hdr . val_stream, self -> pgfile, & val, val_id );
-    if ( rc == 0 )
-    {
-        ( * f ) ( key, key_size, & val, data );
-        KBTreeValueWhack ( & val );
-    }
-    return rc;
-#endif
-}
-
-#if BTREE_KEY2ID
-static
-rc_t leaf_foreach ( const KBTree *self, bool reverse, uint64_t nid,
-    void ( CC * f ) ( const void *key, size_t key_size, uint64_t id, void *data ), void *data )
-#else
-static
-rc_t leaf_foreach ( const KBTree *self, bool reverse, uint32_t nid,
-    void ( CC * f ) ( const void *key, size_t key_size, KBTreeValue *val, void *data ), void *data )
-#endif
-{
-    rc_t rc;
-    KPage *page;
-
-    if ( nid == 0 )
-        return 0;
-
-    rc = KPageFileGet ( self -> pgfile, & page, (uint32_t) ( nid >> 1 ) );
-    if ( rc == 0 )
-    {
-        const KBTreeLeafNode *cnode;
-        rc = page_access_read ( page, ( const void** ) & cnode );
-        if ( rc == 0 )
-        {
-            uint32_t i;
-            if ( reverse ) for ( i = cnode -> count; rc == 0 && i > 0; )
-            {
-                rc = invoke_foreach_func ( self, cnode, & cnode -> ord [ i ], f, data );
-            }
-            else for ( i = 0; rc == 0 && i < cnode -> count; ++ i )
-            {
-                rc = invoke_foreach_func ( self, cnode, & cnode -> ord [ i ], f, data );
-            }
-        }
-
-        KPageRelease ( page );
-    }
-    return rc;
-}
-
-#if BTREE_KEY2ID
-static
-rc_t branch_foreach ( const KBTree *self, bool reverse, uint64_t nid,
-    void ( CC * f ) ( const void *key, size_t key_size, uint64_t id, void *data ), void *data )
-#else
-static
-rc_t branch_foreach ( const KBTree *self, bool reverse, uint32_t nid,
-    void ( CC * f ) ( const void *key, size_t key_size, KBTreeValue *val, void *data ), void *data )
-#endif
-{
-    KPage *page;
-    rc_t rc = KPageFileGet ( self -> pgfile, & page, (uint32_t) ( nid >> 1 ) );
-    if ( rc == 0 )
-    {
-        const KBTreeBranchNode *cnode;
-        rc = page_access_read ( page, ( const void** ) & cnode );
-        if ( rc == 0 )
-        {
-            uint32_t i, child;
-            if ( reverse )
-            {
-                for ( i = cnode -> count; rc == 0 && i > 0; )
-                {
-                    child = cnode -> ord [ -- i ] . trans;
-                    rc = ( ( child & 1 ) == 0 ) ?
-                        leaf_foreach ( self, reverse, child, f, data ):
-                        branch_foreach ( self, reverse, child, f, data );
-
-                    if ( rc == 0 )
-                        rc = invoke_foreach_func ( self, cnode, & cnode -> ord [ i ], f, data );
-                }
-                if ( rc == 0 && cnode -> count != 0 )
-                {
-                    child = cnode -> ltrans;
-                    rc = ( ( child & 1 ) == 0 ) ?
-                        leaf_foreach ( self, reverse, child, f, data ):
-                        branch_foreach ( self, reverse, child, f, data );
-                }
-            }
-            else
-            {
-                child = cnode -> ltrans;
-                rc = ( ( child & 1 ) == 0 ) ?
-                    leaf_foreach ( self, reverse, child, f, data ):
-                    branch_foreach ( self, reverse, child, f, data );
-
-                for ( i = 0; rc == 0 && i < cnode -> count; ++ i )
-                {
-                    rc = invoke_foreach_func ( self, cnode, & cnode -> ord [ i ], f, data );
-                    if ( rc == 0 )
-                    {
-                        child = cnode -> ord [ i ] . trans;
-                        rc = ( ( child & 1 ) == 0 ) ?
-                            leaf_foreach ( self, reverse, child, f, data ):
-                            branch_foreach ( self, reverse, child, f, data );
-                    }
-                }
-            }
-        }
-
-        KPageRelease ( page );
-    }
-    return rc;
-}
-
-#if BTREE_KEY2ID
-LIB_EXPORT rc_t CC KBTreeForEach ( const KBTree *self, bool reverse,
-    void ( CC * f ) ( const void *key, size_t key_size, uint64_t id, void *data ), void *data )
-#else
-LIB_EXPORT rc_t CC KBTreeForEach ( const KBTree *self, bool reverse,
-    void ( CC * f ) ( const void *key, size_t key_size, KBTreeValue *val, void *data ), void *data )
-#endif
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcDB, rcTree, rcVisiting, rcSelf, rcNull );
-    else if ( f == NULL )
-        rc = RC ( rcDB, rcTree, rcVisiting, rcFunction, rcNull );
-    else
-    {
-        rc = ( ( self -> hdr . root & 1 ) == 0 ) ?
-            leaf_foreach ( self, reverse, self -> hdr . root, f, data ):
-            branch_foreach ( self, reverse, self -> hdr . root, f, data );
-    }
-
-    return rc;
-}
diff --git a/libs/kdb/cc-priv.h b/libs/kdb/cc-priv.h
deleted file mode 100644
index fe25705..0000000
--- a/libs/kdb/cc-priv.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- *============================================================================
- *
- */
-
-#ifndef _h_cc_priv_
-#define _h_cc_priv_
-
-#ifndef _h_kdb_consistency_check_
-#include <kdb/consistency-check.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KDirectory;
-
-
-rc_t DirectoryCheckMD5 ( const KDirectory *dir, const char *name,
-    CCReportInfoBlock *info, CCReportFunc report, void *data );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_cc_priv_ */
diff --git a/libs/kdb/coldata-priv.h b/libs/kdb/coldata-priv.h
deleted file mode 100644
index 45e98c0..0000000
--- a/libs/kdb/coldata-priv.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_coldata_priv_
-#define _h_coldata_priv_
-
-#ifndef _h_kfs_directory_
-#include <kfs/directory.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-typedef union KColumnPageMap KColumnPageMap;
-
-
-/*--------------------------------------------------------------------------
- * KColumnData
- *  data fork
- *
- *  only handling append-mode today
- *
- *  kept 64-bit aligned
- */
-typedef struct KColumnData KColumnData;
-struct KColumnData
-{
-    /* cached end of data fork */
-    uint64_t eof;
-
-    /* data fork itself */
-    struct KFile const *f;
-
-    /* page size */
-    size_t pgsize;
-};
-
-/* DefaultPageSize
- *  static method
- */
-#define KColumnDataDefaultPageSize( reuse_pages ) \
-    ( ( reuse_pages ) ? 4096 : 1 )
-
-/* Open
- */
-rc_t KColumnDataOpenRead ( KColumnData *self,
-    const KDirectory *dir, uint64_t eof, size_t pgsize );
-
-/* Whack
- */
-rc_t KColumnDataWhack ( KColumnData *self );
-
-/* Read
- *  reads from the data fork using a blob map
- */
-rc_t KColumnDataRead ( const KColumnData *self, const KColumnPageMap *pm,
-    size_t offset, void *buffer, size_t bsize, size_t *num_read );
-
-
-/*--------------------------------------------------------------------------
- * KColumnPageMap
- *  map of pages involved in column blob
- */
-union KColumnPageMap
-{
-    /* for non-paged data forks, a single page id
-       describes the start of the blob, where the
-       remainder is sequential */
-    uint64_t pg;
-};
-
-/* Open
- *  opens a page map by raw page id and size
- *
- *  "pm" [ OUT ] - modifiable parameter for blob page map
- *
- *  "pg" [ IN ] and "sz" [ IN ] - identifies pages of data fork included
- *  within the blob.
- */
-rc_t KColumnPageMapOpen ( KColumnPageMap *pm,
-    KColumnData *cd, uint64_t pg, size_t sz );
-
-/* Whack
- *  disposes of memory in the case of a page array
- */
-void KColumnPageMapWhack ( KColumnPageMap *self, const KColumnData *cd );
-
-/* Id
- *  captures id of initial page
- */
-rc_t KColumnPageMapId ( const KColumnPageMap *self,
-    const KColumnData *cd, uint64_t *pg );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_coldata_priv_ */
diff --git a/libs/kdb/coldata.c b/libs/kdb/coldata.c
deleted file mode 100644
index 8434b7f..0000000
--- a/libs/kdb/coldata.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kdb/extern.h>
-#include "coldata-priv.h"
-#include <kfs/file.h>
-#include <kfs/buffile.h>
-#include <kfs/impl.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <errno.h>
-
-
-#define DATA_READ_FILE_BUFFER 32* 1024
-
-
-/*--------------------------------------------------------------------------
- * KColumnData
- */
-
-
-/* Init
- */
-static
-rc_t KColumnDataInit ( KColumnData *self, uint64_t pos, size_t pgsize )
-{
-    rc_t rc = KFileSize ( self -> f, & self -> eof );
-    if ( rc == 0 )
-    {
-        if ( self -> eof < pos || pgsize == 0 || ( pos % pgsize ) != 0 )
-            rc = RC ( rcDB, rcColumn, rcConstructing, rcData, rcCorrupt );
-        else
-        {
-            self -> eof = pos;
-            self -> pgsize = pgsize;
-            return 0;
-        }
-    }
-
-    KFileRelease ( self -> f );
-    self -> f = NULL;
-    return rc;
-}
-
-/* Open
- */
-rc_t KColumnDataOpenRead ( KColumnData *self,
-    const KDirectory *dir, uint64_t eof, size_t pgsize )
-{
-    rc_t rc = KDirectoryVOpenFileRead ( dir,
-        & self -> f, "data", NULL );
-#if DATA_READ_FILE_BUFFER
-    if ( rc == 0 )
-    {
-        const KFile * orig = self -> f;
-        rc = KBufFileMakeRead ( & self -> f, self -> f, DATA_READ_FILE_BUFFER );
-	if ( rc == 0 )
-        {
-            KFileRelease ( orig );
-        }
-        else
-        {
-            self -> f = orig;
-            rc = 0;
-        }
-    }
-#endif
-    if ( rc == 0 )
-        rc = KColumnDataInit ( self, eof, pgsize );
-    return rc;
-}
-
-/* Whack
- */
-rc_t KColumnDataWhack ( KColumnData *self )
-{
-    rc_t rc = KFileRelease ( self -> f );
-    if ( rc == 0 )
-        self -> f = NULL;
-    return rc;
-}
-
-/* Read
- *  reads from the data fork using a blob map
- */
-rc_t KColumnDataRead ( const KColumnData *self, const KColumnPageMap *pm,
-    size_t offset, void *buffer, size_t bsize, size_t *num_read )
-{
-    uint64_t pos;
-
-    assert ( self != NULL );
-    assert ( pm != NULL );
-
-    if ( bsize == 0 )
-    {
-        assert ( num_read != NULL );
-        * num_read = 0;
-        return 0;
-    }
-
-    pos = pm -> pg * self -> pgsize;
-    return KFileRead ( self -> f, pos + offset, buffer, bsize, num_read );
-}
-
-
-/*--------------------------------------------------------------------------
- * KColumnPageMap
- *  map of pages involved in column blob
- */
-
-/* Open
- *  opens an blob by raw page id and size
- *
- *  "pm" [ OUT ] - modifiable parameter for blob page map
- *
- *  "pg" [ IN ] and "sz" [ IN ] - identifies pages of data fork included
- *  within the blob.
- */
-rc_t KColumnPageMapOpen ( KColumnPageMap *self,
-    KColumnData *cd, uint64_t pg, size_t sz )
-{
-    uint64_t pos;
-
-    assert ( cd != NULL );
-    pos = pg * cd -> pgsize;
-    if ( pos + sz > cd -> eof )
-    {
-        if ( pos >= cd -> eof )
-            return RC ( rcDB, rcBlob, rcOpening, rcPagemap, rcExcessive );
-        return RC ( rcDB, rcBlob, rcOpening, rcRange, rcExcessive );
-    }
-
-    assert ( self != NULL );
-    self -> pg = pg;
-
-    return 0;
-}
-
-/* Whack
- *  disposes of memory in the case of a page array
- */
-void KColumnPageMapWhack ( KColumnPageMap *self, const KColumnData *cd )
-{
-    assert ( self != NULL );
-    assert ( cd != NULL );
-}
-
-/* Id
- *  captures id of initial page
- */
-rc_t KColumnPageMapId ( const KColumnPageMap *self,
-    const KColumnData *cd, uint64_t *pg )
-{
-    assert ( self != NULL );
-    assert ( cd != NULL );
-    assert ( pg != NULL );
-
-    * pg = self -> pg;
-    return 0;
-}
diff --git a/libs/kdb/colfmt-priv.h b/libs/kdb/colfmt-priv.h
deleted file mode 100644
index 0564ede..0000000
--- a/libs/kdb/colfmt-priv.h
+++ /dev/null
@@ -1,339 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_colfmt_priv_
-#define _h_colfmt_priv_
-
-#ifndef _h_kdbfmt_priv_
-#include "kdbfmt-priv.h"
-#endif
-
-#include <endian.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KColLocDesc
- *  general location descriptor
- */
-typedef struct KColLocDesc KColLocDesc;
-struct KColLocDesc
-{
-    /* the data fork page id */
-    uint64_t pg;
-
-    union
-    {
-        /* pertains to KColBlobLoc */
-        struct
-        {
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-            /* the blob size in bytes */
-            uint32_t size : 31;
-
-            /* used for level-0 journal */
-            uint32_t remove : 1;
-#else
-            uint32_t remove : 1;
-            uint32_t size : 31;
-#endif
-        } blob;
-
-        /* pertains to KColBlockLoc */
-        struct
-        {
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-            /* the block size in bytes */
-            uint32_t size : 27;
-
-            /* block type */
-            uint32_t id_type : 2;
-            uint32_t pg_type : 2;
-
-            /* block compression */
-            uint32_t compressed : 1;
-#else
-            uint32_t compressed : 1;
-            uint32_t pg_type : 2;
-            uint32_t id_type : 2;
-            uint32_t size : 27;
-#endif
-        } blk;
-
-        /* the general 32 bits */
-        uint32_t gen;
-
-    } u;
-
-    /* the id range */
-    uint32_t id_range;
-    int64_t start_id;
-};
-
-
-/*--------------------------------------------------------------------------
- * KColBlobLoc
- *  a single blob locator
- *  stored in level-0 index
- *  and in various compressed forms in level-2
- */
-typedef struct KColLocDesc KColBlobLoc;
-
-
-/*--------------------------------------------------------------------------
- * KColBlockLoc
- *  an index block locator
- *  stored in level-1 index
- *
- *  the type ids pertain to group representation of { start_id, id_range }
- *  and { pg, size } from KColBlobLoc. An individual KColBlobLoc has no
- *  context and must represent all data. a KColBlockLoc stores grouped locators
- *  and can economize on representations.
- *
- *  there are 4 types of representations applied to each index and data:
- *   0) fully specified "random" access - having { id, range } or { pg, size }
- *      this type can group together locators with no apparent relationship
- *      whatsoever. they are stored within a b-tree ordered by id.
- *
- *   1) uniformly sized discontiguous sequence - any time the range/size is a
- *      constant, then it needs only to be represented once.
- *
- *   2) predictable sequence - when id/pg [ n + 1 ] == id/pg [ n ] +
- *      range/size [ n ] they need not both be stored since the range/size
- *      is a delta of id/pg. the storage format is by magnitude while
- *      the in-core format is by id, with a 32-bit magnitude of the
- *      final entry in a header.
- *
- *   3) uniformly sized contiguous sequence - when the conditions of type #2 apply
- *      and the range/size is always the same, then all values except for the
- *      count are known and may be eliminated.
- *
- *  the specific interpretation of KColBlockLoc depends upon the combination
- *  of id and pg types:
- *
- *   a) when both are "btypePredictable"
- *      "pos"       => idx2 offset to 12 byte block
- *      "size"      => "count", i.e. number of blobs in block
- *      "start_id"  => first id in block
- *      "id_range"  => span of ids, evenly divided into "count" blob indices
- *      "block::pg" => data offset to first blob in block
- *      "block::sz" => size of each blob in block
- *
- *   b) when id type is "btypePredictable":
- *      "pos"       => idx2 offset to dynamically sized block
- *      "size"      => size of block
- *      "start_id"  => first id in block
- *      "id_range"  => span of ids, evenly divided into "count" blob indices
- *      "count"     => functionally derived from pg type and "size"
- *
- *   c) all other cases:
- *      "pos"       => idx2 offset to dynamically sized block
- *      "size"      => size of block
- *      "start_id"  => first id in block
- *      "id_range"  => span of ids
- *      "count"     => functionally derived from id/pg types and "size"
- */
-enum
-{
-    btypeRandom,       /* { pg/id, span/sz } */
-    btypeUniform,      /* { pg/id }          */
-    btypeMagnitude,    /* { span/sz }        */
-    btypePredictable   /* {}                 */
-};
-
-typedef struct KColLocDesc KColBlockLoc;
-
-
-/* KColumnHdr
- *  stored in either "idx1" ( under v1 )
- *  or in "idx" ( v2+ )
- *
- *  in ALL cases, "idx1" starts with at least
- *  a HDBHdr giving the column's current version.
- *  when this version == 1, then the entire header
- *  is in idx1.
- *
- * - ALL VERSIONS -
- *  "dad" - gives endian and version information
- *
- * - VERSION 1 -
- *  "data_eof" - official eof of last segment of data fork
- *
- *  "idx2_eof" - official eof of idx block fork
- *
- *  "num_blocks" - describes the number of idx blocks
- *  in idx2, as well as the number of block descriptors
- *  ( KColBlockLoc ) in idx1.
- *
- *  "page_size" - number of bytes in data pages.
- *  when 1 ( in practice anything less than some higher
- *  power of 2, 64 minimum, 4K typical, 64K etc. ), the
- *  data fork operates in append mode.
- *
- *  "checksum" - one of the blob-wise checksum modes:
- *  kcsNone, kcsCRC32, kcsMD5, tbd...
- *
- *  "align" - round header size out to multiples of 8 bytes
- *
- * - VERSION 3 -
- *  "idx0_count" - a committed entry count on idx0. in v1, this
- *  was always inferred from the file system. in v2, the code
- *  was never writing this value, so it's garbage.
- *
- * - VERSION 4 -
- *  idx1 needs to be written in straight-shot mode when MD5
- *  is involved. in version 3 it had been written in append mode.
- *
- * - VERSION 5 -
- *  "data_limit" - when not zero, imposes a limit for opening
- *  new blobs in append mode and an absolute file size limit
- *  in paged mode ( requiring limit to be a multiple of page_size ).
- *
- *  "data_total" - total size of all segments of data fork
- *
- *  "data_seg" - zero-based id of last data segment
- */
-#define KCOL_CURRENT_VERSION 3
-#define vCUR v3
-
-typedef struct KColumnHdr KColumnHdr;
-struct KColumnHdr
-{
-    KDBHdr dad;
-
-    union
-    {
-        /* v1 header */
-        struct
-        {
-            uint64_t data_eof;
-            uint64_t idx2_eof;
-            uint32_t num_blocks;
-            uint32_t page_size;
-            uint8_t checksum;
-
-            uint8_t align1 [ 7 ];
-
-        } v1;
-
-        /* v2 header - note one field should be ignored */
-        struct
-        {
-            uint64_t data_eof;
-            uint64_t idx2_eof;
-            uint32_t ignore;
-            uint32_t num_blocks;
-            uint32_t page_size;
-            uint8_t checksum;
-
-            uint8_t align1 [ 3 ];
-
-        } v2;
-
-        /* v3 header - same as v2, except idx2_count is
-           being populated by the implementation */
-
-        /* v4 header - same as v3 in every way
-           except that idx1 is expected to be
-           written without MD5 append-mode information */
-        struct
-        {
-            uint64_t data_eof;
-            uint64_t idx2_eof;
-            uint32_t idx0_count;
-            uint32_t num_blocks;
-            uint32_t page_size;
-            uint8_t checksum;
-
-            uint8_t align1 [ 3 ];
-
-        } v3, v4;
-
-        /* v5 header ( proposed ) - supports multi-file data fork */
-        struct
-        {
-            uint64_t data_limit;
-            uint64_t data_total;
-            uint64_t data_eof;
-            uint64_t idx2_eof;
-            uint32_t idx0_count;
-            uint32_t num_blocks;
-            uint32_t page_size;
-            uint32_t data_seg;
-            uint8_t checksum;
-
-            uint8_t align1 [ 7 ];
-
-        } v5;
-
-    } u;
-};
-
-/* NULL_HDR
- *  substitute for a variable when needed
- */
-#define NULL_HDR \
-    ( * ( const KColumnHdr* ) 0 )
-
-/* KColumnHdrOffset
- *  calculates the idx file offset to beginning of indices
- */
-#define KColumnHdrOffset( hdr, var ) \
-    ( sizeof ( hdr ) - sizeof ( hdr ) . u + sizeof ( hdr ) . u . var )
-
-/* KColumnHdrMinSize
- *  calculates the minimum size of a header
- */
-#define KColumnHdrMinSize( hdr ) \
-    sizeof ( hdr ) . dad
-
-/* KColBlockLocEntryCount - INTERNAL
- *  returns the number of entries within a block
- *  uses the original size of the uncompressed block
- *
- *  "orig" [ IN, OUT ] - taken as the original size of an
- *  uncompressed block, but may be updated in the case of
- *  all predictable types.
- */
-uint32_t KColBlockLocEntryCount ( const KColBlockLoc *self, size_t *orig );
-
-/* KColBlockLocAllocSize - INTERNAL
- *  returns a size for the block
- *  since a type 3 index ( range/size only ) is nice for storage
- *  but needs to be converted to id/pos for in-memory lookup
- */
-size_t KColBlockLocAllocSize ( const KColBlockLoc *self,
-    size_t orig, uint32_t count );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_colfmt_priv_ */
diff --git a/libs/kdb/colidx-priv.h b/libs/kdb/colidx-priv.h
deleted file mode 100644
index 0ef7849..0000000
--- a/libs/kdb/colidx-priv.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_colidx_priv_
-#define _h_colidx_priv_
-
-#ifndef _h_kfs_directory_
-#include <kfs/directory.h>
-#endif
-
-#ifndef _h_colfmt_priv_
-#include "colfmt-priv.h"
-#endif
-
-#ifndef _h_colidx0_priv_
-#include "colidx0-priv.h"
-#endif
-
-#ifndef _h_colidx1_priv_
-#include "colidx1-priv.h"
-#endif
-
-#ifndef _h_colidx2_priv_
-#include "colidx2-priv.h"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KColumnIdx
- *  the index fork
- */
-typedef struct KColumnIdx KColumnIdx;
-struct KColumnIdx
-{
-    /* first active id within db
-       and first id on upper limit
-       i.e. outside of db such that
-       id_upper - id_first == num_ids */
-    int64_t id_first;
-    int64_t id_upper;
-
-    /* level 0 index */
-    KColumnIdx0 idx0;
-
-    /* level 1 index */
-    KColumnIdx1 idx1;
-
-    /* level 2 index */
-    KColumnIdx2 idx2;
-};
-
-/* Open
- */
-rc_t KColumnIdxOpenRead ( KColumnIdx *self, const KDirectory *dir,
-    uint64_t *data_eof, size_t *pgsize, int32_t *checksum );
-
-/* Whack
- */
-rc_t KColumnIdxWhack ( KColumnIdx *self );
-
-/* Version
- */
-rc_t KColumnIdxVersion ( const KColumnIdx *self, uint32_t *version );
-#define KColumnIdxVersion( self, version ) \
-    KColumnIdx1Version ( & ( self ) -> idx1, version )
-
-/* ByteOrder
- */
-rc_t KColumnIdxByteOrder ( const KColumnIdx *self, bool *reversed );
-#define KColumnIdxByteOrder( self, reversed ) \
-    KColumnIdx1ByteOrder ( & ( self ) -> idx1, reversed )
-
-/* IdRange
- *  returns range of ids contained within
- */
-rc_t KColumnIdxIdRange ( const KColumnIdx *self,
-    int64_t *first, int64_t *last );
-
-/* LocateBlob
- *  locate an existing blob
- */
-rc_t KColumnIdxLocateBlob ( const KColumnIdx *self,
-    KColBlobLoc *loc, int64_t first, int64_t last );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_colidx_priv_ */
diff --git a/libs/kdb/colidx.c b/libs/kdb/colidx.c
deleted file mode 100644
index 6ac7941..0000000
--- a/libs/kdb/colidx.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kdb/extern.h>
-#include "colidx-priv.h"
-#include "idxblk-priv.h"
-#include <kfs/file.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <errno.h>
-
-
-/*--------------------------------------------------------------------------
- * KColumnIdx
- *  the index fork
- */
-
-
-/* EstablishIdRange
- */
-static
-void KColumnIdxEstablishIdRange ( KColumnIdx *self )
-{
-    int64_t first, upper;
-
-    if ( ! KColumnIdx0IdRange ( & self -> idx0, & self -> id_first, & self -> id_upper ) )
-    {
-        if ( ! KColumnIdx1IdRange ( & self -> idx1, & self -> id_first, & self -> id_upper ) )
-            self -> id_first = self -> id_upper = 1;
-    }
-    else if ( KColumnIdx1IdRange ( & self -> idx1, & first, & upper ) )
-    {
-        if ( self -> id_first > first )
-            self -> id_first = first;
-        if ( self -> id_upper < upper )
-            self -> id_upper = upper;
-    }
-}
-
-/* Open
- */
-rc_t KColumnIdxOpenRead ( KColumnIdx *self, const KDirectory *dir,
-    uint64_t *data_eof, size_t *pgsize, int32_t *checksum )
-{
-    rc_t rc;
-    uint64_t idx2_eof;
-    uint32_t idx0_count;
-
-    assert ( self != NULL );
-
-    rc = KColumnIdx1OpenRead ( & self -> idx1,
-        dir, data_eof, & idx0_count, & idx2_eof, pgsize, checksum );
-    if ( rc == 0 )
-    {
-        rc = ( self -> idx1 . vers < 3 ) ?
-            KColumnIdx0OpenRead_v1 ( & self -> idx0, dir, self -> idx1 . bswap ):
-            KColumnIdx0OpenRead ( & self -> idx0, dir, idx0_count, self -> idx1 . bswap );
-        if ( rc == 0 )
-        {
-            rc = KColumnIdx2OpenRead ( & self -> idx2, dir, idx2_eof );
-            if ( rc == 0 || GetRCState ( rc ) == rcNotFound )
-            {
-                KColumnIdxEstablishIdRange ( self );
-                return 0;
-            }
-
-            KColumnIdx0Whack ( & self -> idx0 );
-        }
-
-        KColumnIdx1Whack ( & self -> idx1 );
-    }
-
-    return 0;
-}
-
-/* Whack
- */
-rc_t KColumnIdxWhack ( KColumnIdx *self )
-{
-    rc_t rc;
-
-    assert ( self != NULL );
-
-    rc = KColumnIdx1Whack ( & self -> idx1 );
-    if ( rc == 0 )
-    {
-        KColumnIdx0Whack ( & self -> idx0 );
-        KColumnIdx2Whack ( & self -> idx2 );
-    }
-
-    return rc;
-}
-
-/* Version
- */
-#ifndef KColumnIdxVersion
-rc_t KColumnIdxVersion ( const KColumnIdx *self, uint32_t *version )
-{
-    return KColumnIdx1Version ( & self -> idx1, version );
-}
-#endif
-
-/* IdRange
- *  returns range of ids contained within
- */
-rc_t KColumnIdxIdRange ( const KColumnIdx *self,
-    int64_t *first, int64_t *last )
-{
-    assert ( self != NULL );
-    assert ( first != NULL );
-    assert ( last != NULL );
-
-    * first = self -> id_first;
-    * last = self -> id_upper - 1;
-
-    if ( self -> id_first == self -> id_upper )
-        return RC ( rcDB, rcColumn, rcAccessing, rcRange, rcInvalid );
-    return 0;
-}
-
-/* LocateBlob
- *  locate an existing blob
- */
-rc_t KColumnIdxLocateBlob ( const KColumnIdx *self,
-    KColBlobLoc *loc, int64_t first, int64_t upper )
-{
-    rc_t rc;
-
-    assert ( self != NULL );
-
-    /* convert "last" to "upper" */
-    if ( first >= ++ upper )
-        return RC ( rcDB, rcColumn, rcSelecting, rcRange, rcInvalid );
-
-    /* global reject */
-    if ( first < self -> id_first || upper > self -> id_upper )
-        return RC ( rcDB, rcColumn, rcSelecting, rcBlob, rcNotFound );
-
-    /* look in idx0 */
-    rc = KColumnIdx0LocateBlob ( & self -> idx0, loc, first, upper );
-    if ( GetRCState ( rc ) == rcNotFound )
-    {
-        KColBlockLoc bloc;
-
-        /* find block containing range */
-        rc = KColumnIdx1LocateBlock ( & self -> idx1, & bloc, first, upper );
-        if ( rc == 0 )
-        {
-            /* find location in idx2 */
-            rc = KColumnIdx2LocateBlob ( & self -> idx2,
-                loc, & bloc, first, upper, self -> idx1 . bswap );
-        }
-    }
-
-    return rc;
-}
diff --git a/libs/kdb/colidx0-priv.h b/libs/kdb/colidx0-priv.h
deleted file mode 100644
index ff3c421..0000000
--- a/libs/kdb/colidx0-priv.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_colidx0_priv_
-#define _h_colidx0_priv_
-
-#ifndef _h_kfs_directory_
-#include <kfs/directory.h>
-#endif
-
-#ifndef _h_colfmt_priv_
-#include "colfmt-priv.h"
-#endif
-
-#ifndef _h_klib_container_
-#include <klib/container.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KColumnIdx0
- *  level 0 index - event journaling
- */
-typedef struct KColumnIdx0 KColumnIdx0;
-struct KColumnIdx0
-{
-    /* the in-core indices */
-    BSTree bst;
-    size_t count;
-};
-
-
-/* Open
- */
-rc_t KColumnIdx0OpenRead_v1 ( KColumnIdx0 *self,
-    const KDirectory *dir, bool bswap );
-rc_t KColumnIdx0OpenRead ( KColumnIdx0 *self,
-    const KDirectory *dir, uint32_t count, bool bswap );
-
-/* Whack
- */
-void KColumnIdx0Whack ( KColumnIdx0 *self );
-
-/* IdRange
- *  returns range of ids contained within
- */
-bool KColumnIdx0IdRange ( const KColumnIdx0 *self,
-    int64_t *first, int64_t *upper );
-
-/* LocateBlob
- *  locate an existing blob
- */
-rc_t KColumnIdx0LocateBlob ( const KColumnIdx0 *self,
-    KColBlobLoc *loc, int64_t first, int64_t upper );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_colidx0_priv_ */
diff --git a/libs/kdb/colidx0.c b/libs/kdb/colidx0.c
deleted file mode 100644
index b0f2653..0000000
--- a/libs/kdb/colidx0.c
+++ /dev/null
@@ -1,368 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kdb/extern.h>
-#include "colidx0-priv.h"
-#include <kfs/file.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <byteswap.h>
-
-
-/*--------------------------------------------------------------------------
- * KColumnIdx0Node
- *  a b-tree node
- */
-typedef struct KColumnIdx0Node KColumnIdx0Node;
-struct KColumnIdx0Node
-{
-    BSTNode n;
-    KColBlobLoc loc;
-};
-
-/* Find
- */
-static
-int CC KColumnIdx0NodeFind ( const void *item, const BSTNode *n )
-{
-#define a ( * ( const int64_t* ) item )
-#define b ( ( const KColumnIdx0Node* ) n )
-
-    if ( a < b -> loc . start_id )
-        return -1;
-    return a >= ( b -> loc . start_id + b -> loc . id_range );
-
-#undef a
-#undef b
-}
-
-/* Sort
- */
-static
-int CC KColumnIdx0NodeSort ( const BSTNode *item, const BSTNode *n )
-{
-#define a ( ( const KColumnIdx0Node* ) item )
-#define b ( ( const KColumnIdx0Node* ) n )
-
-    if ( ( a -> loc . start_id + a -> loc . id_range ) <= b -> loc . start_id )
-        return -1;
-    return a -> loc . start_id >= ( b -> loc . start_id + b -> loc . id_range );
-
-#undef a
-#undef b
-}
-
-/* Whack
- */
-static
-void CC KColumnIdx0NodeWhack ( BSTNode *n, void *ignore )
-{
-    free ( n );
-}
-
-/* Next
- */
-#define KColumnIdx0NodeNext( node ) \
-    ( const KColumnIdx0Node* ) BSTNodeNext ( & ( node ) -> n )
-
-
-/*--------------------------------------------------------------------------
- * KColumnIdx0
- *  level 0 index - event journaling
- */
-
-/* Init
- */
-static
-rc_t KColumnIdx0Inflate ( KColumnIdx0 *self,
-     const KColBlobLoc *buffer, uint32_t count )
-{
-    uint32_t i;
-    KColumnIdx0Node *n;
-
-    for ( n = NULL, i = 0; i < count; ++ i )
-    {
-        KColumnIdx0Node *exist;
-
-        if ( n == NULL )
-        {
-            n = malloc ( sizeof * n );
-            if ( n == NULL )
-                return RC ( rcDB, rcColumn, rcConstructing, rcMemory, rcExhausted );
-        }
-
-        n -> loc = buffer [ i ];
-        if ( BSTreeInsertUnique ( & self -> bst,
-             & n -> n, ( BSTNode** ) & exist, KColumnIdx0NodeSort ) )
-        {
-            assert ( n -> loc . start_id == exist -> loc . start_id );
-            assert ( n -> loc . id_range == exist -> loc . id_range );
-
-            assert ( ! n -> loc . u . blob . remove );
-            exist -> loc . pg = n -> loc . pg;
-            exist -> loc . u . blob . size = n -> loc . u . blob . size;
-        }
-        else
-        {
-            ++ self -> count;
-            n = NULL;
-        }
-    }
-
-    free ( n );
-
-    return 0;
-}
-
-static
-void KColumnIdx0Swap ( KColBlobLoc *buffer, uint32_t count )
-{
-    uint32_t i;
-    for ( i = 0; i < count; ++ i )
-    {
-        buffer [ i ] . pg = bswap_64 ( buffer [ i ] . pg );
-        buffer [ i ] . u . gen = bswap_32 ( buffer [ i ] . u . gen );
-        buffer [ i ] . id_range = bswap_32 ( buffer [ i ] . id_range );
-        buffer [ i ] . start_id = bswap_64 ( buffer [ i ] . start_id );
-    }
-}
-
-static
-rc_t KColumnIdx0Init_v1 ( KColumnIdx0 *self, const KFile *f, bool bswap )
-{
-    rc_t rc;
-    KColBlobLoc *buffer = malloc ( 2048 * sizeof * buffer );
-    if ( buffer == NULL )
-        rc = RC ( rcDB, rcColumn, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        uint64_t pos;
-        size_t num_read;
-
-        for ( pos = 0;; pos += num_read )
-        {
-            uint32_t count;
-
-            rc = KFileReadAll ( f, pos,
-                buffer, 2048 * sizeof * buffer, & num_read );
-            if ( rc != 0 )
-                break;
-            if ( num_read == 0 )
-                break;
-            if ( ( num_read % sizeof * buffer ) != 0 )
-            {
-                rc = RC ( rcDB, rcColumn, rcConstructing, rcIndex, rcCorrupt );
-                break;
-            }
-
-            count = (uint32_t)( num_read / sizeof * buffer );
-
-            if ( bswap )
-                KColumnIdx0Swap ( buffer, count );
-
-            rc = KColumnIdx0Inflate ( self, buffer, count );
-            if ( rc != 0 )
-                break;
-        }
-
-        free ( buffer );
-    }
-    return rc;
-}
-
-static
-rc_t KColumnIdx0Init ( KColumnIdx0 *self, const KFile *f, uint32_t total, bool bswap )
-{
-    rc_t rc;
-    KColBlobLoc *buffer = malloc ( 2048 * sizeof * buffer );
-    if ( buffer == NULL )
-        rc = RC ( rcDB, rcIndex, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        uint32_t i, count;
-
-        for ( rc = 0, i = 0; i < total; i += count )
-        {
-            size_t num_read;
-
-            count = total - i;
-            if ( count > 2048 )
-                count = 2048;
-
-            rc = KFileReadAll ( f, i * sizeof * buffer,
-                buffer, count * sizeof * buffer, & num_read );
-            if ( rc != 0 )
-                break;
-
-            /* detect EOF */
-            if ( num_read == 0 )
-            {
-                rc = RC ( rcDB, rcIndex, rcConstructing, rcData, rcCorrupt );
-                break;
-            }
-
-            /* detect short read -
-               see comment in idx1. */
-            if ( ( num_read % sizeof * buffer ) != 0 )
-            {
-                rc = RC ( rcDB, rcIndex, rcConstructing, rcTransfer, rcIncomplete );
-                break;
-            }
-
-            count = (uint32_t)( num_read / sizeof * buffer );
-
-            if ( bswap )
-                KColumnIdx0Swap ( buffer, count );
-
-            rc = KColumnIdx0Inflate ( self, buffer, count );
-            if ( rc != 0 )
-                break;
-        }
-
-        free ( buffer );
-    }
-    return rc;
-}
-
-/* Open
- */
-rc_t KColumnIdx0OpenRead_v1 ( KColumnIdx0 *self, const KDirectory *dir, bool bswap )
-{
-    rc_t rc;
-    uint64_t eof;
-
-    BSTreeInit ( & self -> bst );
-    self -> count = 0;
-
-    rc = KDirectoryVFileSize ( dir, & eof, "idx0", NULL );
-    if ( rc == 0 )
-    {
-        if ( eof != 0 )
-        {
-            const KFile *f;
-            rc = KDirectoryVOpenFileRead ( dir, & f, "idx0", NULL );
-            if ( rc == 0 )
-            {
-                rc = KColumnIdx0Init_v1 ( self, f, bswap );
-                KFileRelease ( f );
-            }
-        }
-    }
-    else if ( GetRCState ( rc ) == rcNotFound )
-    {
-        rc = 0;
-    }
-
-    return rc;
-}
-
-rc_t KColumnIdx0OpenRead ( KColumnIdx0 *self, const KDirectory *dir, uint32_t count, bool bswap )
-{
-    BSTreeInit ( & self -> bst );
-    self -> count = 0;
-
-    if ( count != 0 )
-    {
-        const KFile *f;
-        rc_t rc = KDirectoryVOpenFileRead ( dir, & f, "idx0", NULL );
-        if ( rc == 0 )
-        {
-            rc = KColumnIdx0Init ( self, f, count, bswap );
-            KFileRelease ( f );
-        }
-        return rc;
-    }
-
-    return 0;
-}
-
-/* Whack
- */
-void KColumnIdx0Whack ( KColumnIdx0 *self )
-{
-    BSTreeWhack ( & self -> bst, KColumnIdx0NodeWhack, NULL );
-    BSTreeInit ( & self -> bst );
-}
-
-/* IdRange
- *  returns range of ids contained within
- */
-bool KColumnIdx0IdRange ( const KColumnIdx0 *self,
-    int64_t *first, int64_t *upper )
-{
-    const KColumnIdx0Node *a, *z;
-
-    assert ( self != NULL );
-    assert ( first != NULL );
-    assert ( upper != NULL );
-
-    a = ( const KColumnIdx0Node* ) BSTreeFirst ( & self -> bst );
-    if ( a == NULL )
-        return false;
-
-    z = ( const KColumnIdx0Node* ) BSTreeLast ( & self -> bst );
-    assert ( z != NULL );
-
-    * first = a -> loc . start_id;
-    * upper = z -> loc . start_id + z -> loc . id_range;
-    assert ( * first < * upper );
-
-    return true;
-}
-
-/* LocateBlob
- *  locate an existing blob
- */
-rc_t KColumnIdx0LocateBlob ( const KColumnIdx0 *self,
-    KColBlobLoc *loc, int64_t first, int64_t upper )
-{
-    const KColumnIdx0Node *n;
-
-    assert ( self != NULL );
-    assert ( loc != NULL );
-    assert ( first < upper );
-
-    n = ( const KColumnIdx0Node* )
-        BSTreeFind ( & self -> bst, & first, KColumnIdx0NodeFind );
-
-    if ( n == NULL )
-        return RC ( rcDB, rcColumn, rcSelecting, rcBlob, rcNotFound );
-
-    assert ( first >= n -> loc . start_id );
-    assert ( first < ( n -> loc . start_id + n -> loc . id_range ) );
-
-    if ( upper > ( n -> loc . start_id + n -> loc . id_range ) )
-        return RC ( rcDB, rcColumn, rcSelecting, rcRange, rcInvalid );
-
-    * loc = n -> loc;
-    assert ( ! loc -> u . blob . remove );
-    return 0;
-}
diff --git a/libs/kdb/colidx1-priv.h b/libs/kdb/colidx1-priv.h
deleted file mode 100644
index 37fe3cf..0000000
--- a/libs/kdb/colidx1-priv.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_colidx1_priv_
-#define _h_colidx1_priv_
-
-#ifndef _h_kfs_directory_
-#include <kfs/directory.h>
-#endif
-
-#ifndef _h_colfmt_priv_
-#include "colfmt-priv.h"
-#endif
-
-#ifndef _h_klib_container_
-#include <klib/container.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KColIdxBlock;
-struct KColBlockLocInfo;
-
-
-/*--------------------------------------------------------------------------
- * KColumnIdx1
- *  level 1 index
- */
-typedef struct KColumnIdx1 KColumnIdx1;
-struct KColumnIdx1
-{
-    /* tree of level-2 block locators */
-    BSTree bst;
-    struct KFile const *f;
-    struct KFile const *fidx;
-    uint32_t count;
-    uint32_t vers;
-    bool bswap;
-    uint8_t align [ sizeof ( size_t ) - 1 ];
-};
-
-/* Open
- */
-rc_t KColumnIdx1OpenRead ( KColumnIdx1 *self, const KDirectory *dir,
-    uint64_t *data_eof, uint32_t *idx0_count, uint64_t *idx2_eof,
-    size_t *pgsize, int32_t *checksum );
-
-/* Whack
- */
-rc_t KColumnIdx1Whack ( KColumnIdx1 *self );
-
-/* Version
- */
-rc_t KColumnIdx1Version ( const KColumnIdx1 *self, uint32_t *version );
-#define KColumnIdx1Version( self, version ) \
-    ( * ( version ) = ( self ) -> vers, 0 )
-
-/* ByteOrder
- */
-rc_t KColumnIdx1ByteOrder ( const KColumnIdx1 *self, bool *reversed );
-#define KColumnIdx1ByteOrder( self, reversed ) \
-    ( * ( reversed ) = ( self ) -> bswap, 0 )
-
-/* IdRange
- *  returns range of ids contained within
- */
-bool KColumnIdx1IdRange ( const KColumnIdx1 *self,
-    int64_t *first, int64_t *upper );
-
-/* LocateBlock
- *  locates an idx2 block by range
- */
-rc_t KColumnIdx1LocateBlock ( const KColumnIdx1 *self,
-    KColBlockLoc *bloc, int64_t first, int64_t upper );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_colidx1_priv_ */
diff --git a/libs/kdb/colidx1.c b/libs/kdb/colidx1.c
deleted file mode 100644
index 83439de..0000000
--- a/libs/kdb/colidx1.c
+++ /dev/null
@@ -1,423 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kdb/extern.h>
-#include "colidx1-priv.h"
-#include <kfs/file.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <byteswap.h>
-
-
-/*--------------------------------------------------------------------------
- * KColumnIdx1Node
- *  a binary search tree node
- */
-typedef struct KColumnIdx1Node KColumnIdx1Node;
-struct KColumnIdx1Node
-{
-    BSTNode n;
-    KColBlockLoc loc;
-};
-
-/* Find
- */
-static
-int CC KColumnIdx1NodeFind ( const void *item, const BSTNode *n )
-{
-#define a ( * ( const int64_t* ) item )
-#define b ( ( const KColumnIdx1Node* ) n )
-
-    if ( a < b -> loc . start_id )
-        return -1;
-    return a >= ( b -> loc . start_id + b -> loc . id_range );
-
-#undef a
-#undef b
-}
-
-/* Sort
- */
-static
-int CC KColumnIdx1NodeSort ( const BSTNode *item, const BSTNode *n )
-{
-#define a ( ( const KColumnIdx1Node* ) item )
-#define b ( ( const KColumnIdx1Node* ) n )
-
-    if ( ( a -> loc . start_id + a -> loc . id_range ) <= b -> loc . start_id )
-        return -1;
-    return a -> loc . start_id >= ( b -> loc . start_id + b -> loc . id_range );
-
-#undef a
-#undef b
-}
-
-/* Whack
- */
-static
-void CC KColumnIdx1NodeWhack ( BSTNode *n, void *ignore )
-{
-    free ( n );
-}
-
-
-/*--------------------------------------------------------------------------
- * KColumnIdx1
- *  level 1 index
- */
-
-/* Init
- */
-static
-rc_t KColumnIdx1Inflate ( KColumnIdx1 *self,
-    const KColBlockLoc *buffer, uint32_t count )
-{
-    uint32_t i;
-    for ( i = 0; i < count; ++ i )
-    {
-        KColumnIdx1Node *exist, *n = malloc ( sizeof * n );
-        if ( n == NULL )
-            return RC ( rcDB, rcColumn, rcConstructing, rcMemory, rcExhausted );
-
-        n -> loc = buffer [ i ];
-        if ( BSTreeInsertUnique ( & self -> bst,
-             & n -> n, ( BSTNode** ) & exist, KColumnIdx1NodeSort ) )
-        {
-            free ( n );
-            return RC ( rcDB, rcColumn, rcConstructing, rcIndex, rcCorrupt );
-        }
-
-        ++ self -> count;
-    }
-
-    return 0;
-}
-
-static
-void KColumnIdx1Swap ( KColBlockLoc *buffer, uint32_t count )
-{
-    uint32_t i;
-    for ( i = 0; i < count; ++ i )
-    {
-        buffer [ i ] . pg = bswap_64 ( buffer [ i ] . pg );
-        buffer [ i ] . u . gen = bswap_32 ( buffer [ i ] . u . gen );
-        buffer [ i ] . id_range = bswap_32 ( buffer [ i ] . id_range );
-        buffer [ i ] . start_id = bswap_64 ( buffer [ i ] . start_id );
-    }
-}
-
-static
-rc_t KColumnIdx1Init ( KColumnIdx1 *self, uint32_t off, uint32_t count )
-{
-    rc_t rc;
-    KColBlockLoc *buffer = malloc ( 2048 * sizeof * buffer );
-    if ( buffer == NULL )
-        rc = RC ( rcDB, rcColumn, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        size_t num_read;
-        uint32_t i, cnt;
-        for ( rc = 0, i = 0; i < count; off += ( uint32_t ) num_read, i += cnt )
-        {
-            cnt = count - i;
-            if ( cnt > 2048 )
-                cnt = 2048;
-
-            rc = KFileReadAll ( self -> f, off,
-                buffer, cnt * sizeof * buffer, & num_read );
-            if ( rc != 0 )
-                break;
-            if ( num_read == 0 )
-                break;
-            if ( ( num_read % sizeof * buffer ) != 0 )
-            {
-                rc = RC ( rcDB, rcColumn, rcConstructing, rcIndex, rcCorrupt );
-                break;
-            }
-
-            if ( self -> bswap )
-                KColumnIdx1Swap ( buffer, cnt );
-
-            rc = KColumnIdx1Inflate ( self, buffer, cnt );
-            if ( rc != 0 )
-                break;
-        }
-
-        free ( buffer );
-    }
-    return rc;
-}
-
-/* Open
- */
-rc_t KColumnIdx1OpenRead ( KColumnIdx1 *self, const KDirectory *dir,
-    uint64_t *data_eof, uint32_t *idx0_count, uint64_t *idx2_eof,
-    size_t *pgsize, int32_t *checksum )
-{
-    rc_t rc;
-
-    BSTreeInit ( & self -> bst );
-    self -> count = 0;
-    self -> vers = 0;
-    self -> bswap = false;
-    self -> fidx = NULL;
-            
-    rc = KDirectoryVOpenFileRead ( dir, & self -> f, "idx1", NULL );
-    if ( rc == 0 )
-    {
-        KColumnHdr hdr;
-        size_t num_bytes;
-        rc = KFileReadAll ( self -> f, 0, & hdr, sizeof hdr, & num_bytes );
-        if ( rc == 0 )
-        {
-            if ( num_bytes == 0 )
-                rc = RC ( rcDB, rcColumn, rcOpening, rcIndex, rcNotFound );
-            else if ( num_bytes < KColumnHdrMinSize ( hdr ) )
-                rc = RC ( rcDB, rcColumn, rcOpening, rcIndex, rcCorrupt );
-            else
-            {
-                rc = KDBHdrValidate ( & hdr . dad, num_bytes, 1, KCOL_CURRENT_VERSION );
-                if ( GetRCState ( rc ) == rcIncorrect && GetRCObject ( rc ) == rcByteOrder )
-                {
-                    self -> bswap = true;
-                    hdr . dad . endian = bswap_32 ( hdr . dad . endian );
-                    hdr . dad . version = bswap_32 ( hdr . dad . version );
-                    rc = KDBHdrValidate ( & hdr . dad, num_bytes, 1, KCOL_CURRENT_VERSION );
-                }
-                if ( rc == 0 )
-                {
-                    uint32_t off, count;
-
-                    switch ( hdr . dad . version )
-                    {
-                    case 1:
-                        if ( num_bytes < KColumnHdrOffset ( hdr, v1 ) )
-                            rc = RC ( rcDB, rcColumn, rcOpening, rcIndex, rcCorrupt );
-                        else
-                        {
-                            if ( self -> bswap )
-                            {
-                                hdr . u . v1 . data_eof = bswap_64 ( hdr . u . v1 . data_eof );
-                                hdr . u . v1 . idx2_eof = bswap_64 ( hdr . u . v1 . idx2_eof );
-                                hdr . u . v1 . num_blocks = bswap_32 ( hdr . u . v1 . num_blocks );
-                                hdr . u . v1 . page_size = bswap_32 ( hdr . u . v1 . page_size );
-                            }
-
-                            * data_eof = hdr . u . v1 . data_eof;
-                            * idx2_eof = hdr . u . v1 . idx2_eof;
-                            * pgsize = hdr . u . v1 . page_size;
-                            * checksum = hdr . u . v1 . checksum;
-                            count = hdr . u . v1 . num_blocks;
-                            off = KColumnHdrOffset ( hdr, v1 );
-
-                            /* not supported in v1 */
-                            * idx0_count = 0;
-                        }
-                        break;
-
-                    default:
-                        rc = KDirectoryVOpenFileRead ( dir, ( const KFile** ) & self -> fidx, "idx", NULL );
-                        if ( rc == 0 )
-                        {
-                            off = sizeof hdr . dad;
-                            rc = KFileReadAll ( self -> fidx, 0, & hdr, sizeof hdr, & num_bytes );
-                            if ( rc == 0 )
-                            {
-                                if ( num_bytes < KColumnHdrOffset ( hdr, v2 ) )
-                                    rc = RC ( rcDB, rcColumn, rcOpening, rcIndex, rcCorrupt );
-                                else
-                                {
-                                    rc = KDBHdrValidate ( & hdr . dad,
-                                        num_bytes, 2, KCOL_CURRENT_VERSION );
-                                    if ( GetRCState ( rc ) == rcIncorrect && GetRCObject ( rc ) == rcByteOrder )
-                                    {
-                                        if ( ! self->bswap ) /* catch mis-matched endianess */
-                                            rc = RC ( rcDB, rcColumn, rcOpening, rcIndex, rcCorrupt );
-                                        else
-                                        {
-                                            hdr . dad . endian = bswap_32 ( hdr . dad . endian );
-                                            hdr . dad . version = bswap_32 ( hdr . dad . version );
-                                            rc = KDBHdrValidate ( & hdr . dad, num_bytes, 1, KCOL_CURRENT_VERSION );
-                                        }
-                                    }
-                                    else if ( self -> bswap ) /* catch mis-matched endianess */
-                                        rc = RC ( rcDB, rcColumn, rcOpening, rcIndex, rcCorrupt );
-
-                                    if ( rc == 0 ) switch ( hdr . dad . version )
-                                    {
-                                    case 2:
-                                        if ( self -> bswap )
-                                        {
-                                            hdr. u . v2 . data_eof = bswap_64 ( hdr. u . v2 . data_eof );
-                                            hdr. u . v2 . idx2_eof = bswap_64 ( hdr. u . v2 . idx2_eof );
-                                            hdr. u . v2 . num_blocks = bswap_32 ( hdr. u . v2 . num_blocks );
-                                            hdr. u . v2 . page_size = bswap_32 ( hdr. u . v2 . page_size );
-                                        }
-
-                                        * data_eof = hdr . u . v2 . data_eof;
-                                        * idx2_eof = hdr . u . v2 . idx2_eof;
-                                        * pgsize = hdr . u . v2 . page_size;
-                                        * checksum = hdr . u . v2 . checksum;
-                                        count = hdr . u . v2 . num_blocks;
-                                        * idx0_count = 0;
-                                        break;
-
-                                    case 3:
-                                        if ( self -> bswap )
-                                        {
-                                            hdr. u . v3 . data_eof = bswap_64 ( hdr. u . v3 . data_eof );
-                                            hdr. u . v3 . idx2_eof = bswap_64 ( hdr. u . v3 . idx2_eof );
-                                            hdr. u . v3 . idx0_count = bswap_32 ( hdr. u . v3 . idx0_count );
-                                            hdr. u . v3 . num_blocks = bswap_32 ( hdr. u . v3 . num_blocks );
-                                            hdr. u . v3 . page_size = bswap_32 ( hdr. u . v3 . page_size );
-                                        }
-
-                                        * data_eof = hdr . u . v3 . data_eof;
-                                        * idx2_eof = hdr . u . v3 . idx2_eof;
-                                        * idx0_count = hdr . u . v3 . idx0_count;
-                                        * pgsize = hdr . u . v3 . page_size;
-                                        * checksum = hdr . u . v3 . checksum;
-                                        count = hdr . u . v3 . num_blocks;
-                                        break;
-
-                                    default:
-                                        rc = RC ( rcDB, rcColumn, rcOpening, rcIndex, rcBadVersion );
-                                    }
-                                }
-                            }
-                        }
-                    }
-
-                    if ( rc == 0 )
-                    {
-                        self -> vers = hdr . dad . version;
-                        rc = KColumnIdx1Init ( self, off, count );
-                        if ( rc == 0 )
-                            return rc;
-                    }
-
-                    KFileRelease ( self -> fidx );
-                    self -> fidx = NULL;
-                }
-            }
-        }
-
-        KFileRelease ( self -> f );
-        self -> f = NULL;
-    }
-
-    return rc;
-}
-
-
-/* Whack
- */
-rc_t KColumnIdx1Whack ( KColumnIdx1 *self )
-{
-    rc_t rc = KFileRelease ( self -> fidx );
-    if ( rc == 0 )
-    {
-        self -> fidx = NULL;
-        rc = KFileRelease ( self -> f );
-        if ( rc == 0 )
-        {
-            self -> f = NULL;
-            BSTreeWhack ( & self -> bst, KColumnIdx1NodeWhack, NULL );
-            BSTreeInit ( & self -> bst );
-        }
-    }
-    return rc;
-}
-
-/* Version
- */
-#ifndef KColumnIdx1Version
-rc_t KColumnIdx1Version ( const KColumnIdx1 *self, uint32_t *version )
-{
-    * version = ( uint32_t ) self -> vers;
-    return 0;
-}
-#endif
-
-/* IdRange
- *  returns range of ids contained within
- */
-bool KColumnIdx1IdRange ( const KColumnIdx1 *self,
-    int64_t *first, int64_t *upper )
-{
-    const KColumnIdx1Node *a, *z;
-
-    assert ( self != NULL );
-    assert ( first != NULL );
-    assert ( upper != NULL );
-
-    a = ( const KColumnIdx1Node* ) BSTreeFirst ( & self -> bst );
-    if ( a == NULL )
-        return false;
-
-    z = ( const KColumnIdx1Node* ) BSTreeLast ( & self -> bst );
-    assert ( z != NULL );
-
-    * first = a -> loc . start_id;
-    * upper = z -> loc . start_id + z -> loc . id_range;
-    assert ( * first < * upper );
-
-    return true;
-}
-
-/* LocateBlock
- *  locates an idx2 block by range
- *  return values:
- */
-rc_t KColumnIdx1LocateBlock ( const KColumnIdx1 *self,
-    KColBlockLoc *bloc, int64_t first, int64_t upper )
-{
-    const KColumnIdx1Node *n;
-
-    assert ( self != NULL );
-    assert ( bloc != NULL );
-    assert ( first < upper );
-
-    n = ( const KColumnIdx1Node* )
-        BSTreeFind ( & self -> bst, & first, KColumnIdx1NodeFind );
-
-    if ( n == NULL )
-        return RC ( rcDB, rcColumn, rcSelecting, rcBlob, rcNotFound );
-
-    assert ( first >= n -> loc . start_id );
-    assert ( first < ( n -> loc . start_id + n -> loc . id_range ) );
-
-    if ( upper > ( n -> loc . start_id + n -> loc . id_range ) )
-        return RC ( rcDB, rcColumn, rcSelecting, rcRange, rcInvalid );
-
-    * bloc = n -> loc;
-    return 0;
-}
diff --git a/libs/kdb/colidx2-priv.h b/libs/kdb/colidx2-priv.h
deleted file mode 100644
index 2e28a65..0000000
--- a/libs/kdb/colidx2-priv.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_colidx2_priv_
-#define _h_colidx2_priv_
-
-#ifndef _h_kfs_directory_
-#include <kfs/directory.h>
-#endif
-
-#ifndef _h_colfmt_priv_
-#include "colfmt-priv.h"
-#endif
-
-#ifndef _h_klib_container_
-#include <klib/container.h>
-#endif
-
-#include <klib/data-buffer.h>
-#include "idxblk-priv.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KColumnIdx2
- *  level 2 index
- */
-
-typedef struct KColumnIdx2BlockCache
-{
-    /* single page cache */
-    void *block;
-    int64_t start_id;
-    size_t count;
-    KColIdxBlock iblk;
-} KColumnIdx2BlockCache;
-
-typedef struct KColumnIdx2 KColumnIdx2;
-struct KColumnIdx2
-{
-    /* for adding new blocks */
-    uint64_t eof;
-
-    /* idx2 itself */
-    struct KFile const *f;
-
-    /* full caching mechanism */
-    KDataBuffer cstorage;
-    uint32_t	last;
-};
-
-/* Open
- */
-rc_t KColumnIdx2OpenRead ( KColumnIdx2 *self,
-    const KDirectory *dir, uint64_t eof );
-
-/* Whack
- */
-rc_t KColumnIdx2Whack ( KColumnIdx2 *self );
-
-/* LocateBlob
- *  locate an existing blob
- */
-rc_t KColumnIdx2LocateBlob ( const KColumnIdx2 *self,
-    KColBlobLoc *loc, const KColBlockLoc *bloc,
-    int64_t first, int64_t upper, bool bswap );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_colidx2_priv_ */
diff --git a/libs/kdb/colidx2.c b/libs/kdb/colidx2.c
deleted file mode 100644
index 59743c3..0000000
--- a/libs/kdb/colidx2.c
+++ /dev/null
@@ -1,279 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kdb/extern.h>
-#include "colidx2-priv.h"
-#include "idxblk-priv.h"
-#include <kfs/file.h>
-#include <kfs/buffile.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <byteswap.h>
-
-
-#define IDX2_READ_FILE_BUFFER 64 * 1024
-
-
-/*--------------------------------------------------------------------------
- * KColumnIdx2
- *  level 2 index
- */
-
-/* Init
- */
-static
-rc_t KColumnIdx2Init ( KColumnIdx2 *self, uint64_t idx2_eof )
-{
-    rc_t rc;
-
-#if 0
-    memset(&self->cstorage,0,sizeof(self->cstorage));
-    self->cstorage.elem_bits = sizeof(KColumnIdx2BlockCache)*8;
-    self->last = 0;
-#endif
-    rc = KFileSize ( self -> f, & self -> eof );
-    if ( rc == 0 )
-    {
-        if ( self -> eof < idx2_eof )
-            rc = RC ( rcDB, rcColumn, rcConstructing, rcIndex, rcCorrupt );
-        else
-        {
-            self -> eof = idx2_eof;
-            return 0;
-        }
-    }
-    
-    KFileRelease ( self -> f );
-
-    self -> f = NULL;
-    return rc;
-}
-
-/* Open
- */
-rc_t KColumnIdx2OpenRead ( KColumnIdx2 *self,
-    const KDirectory *dir, uint64_t eof )
-{
-    rc_t rc;
-
-    rc = KDataBufferMake ( & self -> cstorage, sizeof ( KColumnIdx2BlockCache ) * 8, 0 );
-    if ( rc != 0 )
-    {
-        memset ( self, 0, sizeof * self );
-        return rc;
-    }
-
-    self -> last = 0;
-
-    if ( eof == 0 )
-    {
-#if 0
-        KDataBufferResize(&self->cstorage,0);
-        self -> last = 0;
-#endif
-        self -> eof = 0;
-        self -> f = NULL;
-        return 0;
-    }
-
-    rc = KDirectoryVOpenFileRead ( dir,
-        & self -> f, "idx2", NULL );
-#if IDX2_READ_FILE_BUFFER
-    if ( rc == 0 )
-    {
-        const KFile * orig = self -> f;
-        rc = KBufFileMakeRead ( & self -> f, self -> f, IDX2_READ_FILE_BUFFER );
-	if ( rc == 0 )
-        {
-            KFileRelease ( orig );
-        }
-        else
-        {
-            self -> f = orig;
-            rc = 0;
-        }
-    }
-#endif
-    if ( rc == 0 )
-        rc = KColumnIdx2Init ( self, eof );
-    return rc;
-}
-
-/* Whack
- */
-rc_t KColumnIdx2Whack ( KColumnIdx2 *self )
-{
-    rc_t rc = KFileRelease ( self -> f );
-    if ( rc == 0 )
-    {
-        int i;
-        KColumnIdx2BlockCache * cache=(KColumnIdx2BlockCache *)self -> cstorage.base;
-        self -> f = NULL;
-        for(i=0;i<self->cstorage.elem_count;i++){
-            free(cache[i].block);
-        }
-        KDataBufferWhack(&self->cstorage);
-    }
-    return rc;
-}
-
-/* LocateBlob
- *  locate an existing blob
- */
-static
-rc_t KColIdxBlockLocateBlob ( const KColIdxBlock *iblk,
-    KColBlobLoc *loc, const KColBlockLoc *bloc, uint32_t count,
-    int64_t first, int64_t upper )
-{
-    uint32_t span;
-    int64_t start_id;
-    int slot = KColIdxBlockFind ( iblk,
-        bloc, count, first, & start_id, & span );
-    if ( slot < 0 )
-        return RC ( rcDB, rcColumn, rcSelecting, rcBlob, rcNotFound );
-    if ( upper > ( start_id + span ) )
-        return RC ( rcDB, rcColumn, rcSelecting, rcRange, rcInvalid );
-
-    loc -> start_id = start_id;
-    loc -> id_range = span;
-
-    KColIdxBlockGet ( iblk, bloc, count, slot, & loc -> pg, & span );
-    loc -> u . blob . size = span;
-
-    return 0;
-}
-
-rc_t KColumnIdx2LocateBlob ( const KColumnIdx2 *self,
-    KColBlobLoc *loc, const KColBlockLoc *bloc,
-    int64_t first, int64_t upper, bool bswap )
-{
-    rc_t rc;
-    uint32_t count;
-    size_t block_size, orig;
-    uint32_t slot=0;
-
-    void *block;
-
-    /* check within page cache */
-    if(self -> cstorage.elem_count > 0){
-        KColumnIdx2BlockCache * cache=(KColumnIdx2BlockCache *)self -> cstorage.base;
-        assert(self->last < self->cstorage.elem_count);
-        if(bloc -> start_id == cache[self->last].start_id){
-            rc = KColIdxBlockLocateBlob ( & cache[self->last].iblk, loc, bloc, ( uint32_t ) cache[self->last].count, first, upper );
-            if ( rc == 0) return 0;
-        } else {
-            uint32_t lower,upper,pivot;
-            if(bloc -> start_id > cache[self->last].start_id){
-                lower=self->last+1;
-                upper=self->cstorage.elem_count;
-            } else {
-                lower=0;
-                upper = self->last;
-            }
-            while(lower < upper){
-                pivot = (lower + upper) / 2;
-                if(bloc -> start_id == cache[pivot].start_id){
-                    KColumnIdx2 * nc_self=(KColumnIdx2 *)self;
-                    nc_self->last = pivot;
-                    rc = KColIdxBlockLocateBlob ( & cache[self->last].iblk, loc, bloc, ( uint32_t ) cache[self->last].count, first, upper );
-                    if ( rc == 0) return 0;
-                    goto BSEARCH_DONE;
-                } else if(bloc -> start_id < cache[pivot].start_id){
-                    upper=pivot;
-                } else {
-                    lower =pivot+1;
-                }
-            }
-            assert(lower == upper );
-            slot = upper;
-        }
-    }
-BSEARCH_DONE:
-
-    /* file may be empty or non-existent */
-    if ( self -> eof == 0 )
-        return RC ( rcDB, rcColumn, rcSelecting, rcBlob, rcNotFound );
-
-    /* TBD - compression not supported */
-    if ( bloc -> u . blk . compressed )
-        return RC ( rcDB, rcColumn, rcSelecting, rcData, rcUnsupported );
-
-    /* determine the number of entries in block */
-    orig = bloc -> u . blk . size;
-    count = KColBlockLocEntryCount ( bloc, & orig );
-
-    /* determine the size to allocate */
-    block_size = KColBlockLocAllocSize ( bloc, orig, count );
-
-    /* allocate a block */
-        block = malloc ( block_size );
-    if ( block == NULL )
-        rc = RC ( rcDB, rcColumn, rcSelecting, rcMemory, rcExhausted );
-    else
-    {
-        size_t num_read;
-        rc = KFileReadAll ( self -> f, bloc -> pg, block, orig, & num_read );
-        if ( rc == 0 )
-        {
-            if ( num_read != orig )
-                rc = RC ( rcDB, rcIndex, rcReading, rcTransfer, rcIncomplete );
-            else
-            {
-                KColIdxBlock iblk;
-                rc = KColIdxBlockInit ( & iblk, bloc, orig, block, block_size, bswap );
-                if ( rc == 0 )
-                {
-                    rc = KColIdxBlockLocateBlob ( & iblk,
-                        loc, bloc, count, first, upper );
-                    if ( rc == 0 )
-                    {
-                        KColumnIdx2BlockCache * cache;
-                        KDataBufferResize(&((KColumnIdx2 *)self)->cstorage,self->cstorage.elem_count+1);
-                        cache=(KColumnIdx2BlockCache *)self -> cstorage.base;
-                        if(slot < self->cstorage.elem_count -1){ /** not adding to the end **/
-                            memmove(cache+slot+1,cache+slot,sizeof(*cache)*(self->cstorage.elem_count - slot - 1));
-                        }
-                        cache += slot; 
-                        cache -> block = block;
-                        cache -> start_id = bloc -> start_id;
-                        cache -> count = count;
-                        cache -> iblk = iblk;
-                        return 0;
-                    }
-                }
-            }
-        }
-        
-            free ( block );
-    }
-
-    return rc;
-}
diff --git a/libs/kdb/column-cc.c b/libs/kdb/column-cc.c
deleted file mode 100644
index d52d1e7..0000000
--- a/libs/kdb/column-cc.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- *============================================================================
- *
- */
-
-#include <kdb/extern.h>
-
-#define KONST const
-#include "column-priv.h"
-#undef KONST
-
-#include "cc-priv.h"
-
-#include <klib/rc.h>
-
-#include <string.h>
-
-struct col_check_ctx {
-    CCReportFunc report;
-    void *ctx;
-    int found;
-    rc_t rc;
-    bool failed;
-};
-
-static
-rc_t CC col_check_report(const CCReportInfoBlock *nfo, void *Ctx)
-{
-    struct col_check_ctx *ctx = Ctx;
-    
-    if (nfo->type == ccrpt_MD5) {
-        const char *fname = nfo->info.MD5.file;
-        
-        if (strcmp(fname, "data") == 0)
-            ctx->found |= 1;
-        else if (strcmp(fname, "idx0") == 0)
-            ctx->found |= 2;
-        else if (strcmp(fname, "idx1") == 0)
-            ctx->found |= 4;
-        else if (strcmp(fname, "idx2") == 0)
-            ctx->found |= 8;
-        
-        if (nfo->info.MD5.rc != 0 && !ctx->failed) {
-            ctx->failed = true;
-            ctx->rc = nfo->info.MD5.rc;
-        }
-    }
-    else if (nfo->type == ccrpt_Done && nfo->info.done.rc != 0 && !ctx->failed) {
-        ctx->failed = true;
-        ctx->rc = nfo->info.done.rc;
-    }
-
-    return 0;
-}
-
-static
-rc_t CC CheckExists(const KDirectory *dir, uint32_t type, const char *name, void *Ctx)
-{
-    struct col_check_ctx *ctx = Ctx;
-    
-    if ((type & ~kptAlias) == kptFile) {
-        if (strcmp(name, "data") == 0)
-            ctx->found |= 1;
-        else if (strcmp(name, "idx0") == 0)
-            ctx->found |= 2;
-        else if (strcmp(name, "idx1") == 0)
-            ctx->found |= 4;
-        else if (strcmp(name, "idx2") == 0)
-            ctx->found |= 8;
-    }
-    return 0;
-}
-
-static
-rc_t KColumnCheckMD5(const KColumn *self,
-                     CCReportInfoBlock *nfo,
-                     CCReportFunc report, void *ctx)
-{
-    struct col_check_ctx local_ctx;
-    rc_t rc;
-    
-    local_ctx.report = report;
-    local_ctx.ctx = ctx;
-    local_ctx.found = 0;
-    local_ctx.failed = false;
-    local_ctx.rc = 0;
-    
-    rc = DirectoryCheckMD5(self->dir, "md5", nfo, col_check_report, &local_ctx);
-    if (rc == 0 && !local_ctx.failed && local_ctx.found != 0x0F) {
-        local_ctx.found = 0;
-        KDirectoryVisit(self->dir, false, CheckExists, &local_ctx, NULL);
-        nfo->type = ccrpt_Done;
-        if (local_ctx.found == 0x0F) {
-            nfo->info.done.rc = RC(rcDB, rcColumn, rcValidating, rcChecksum, rcNotFound);
-            nfo->info.done.mesg = "Some files are missing checksums";
-        }
-        else {
-            nfo->info.done.rc = RC(rcDB, rcColumn, rcValidating, rcFile, rcNotFound);
-            nfo->info.done.mesg = "Some files are missing";
-        }
-        rc = report(nfo, ctx);
-    }
-    else if (rc == 0) {
-        nfo->type = ccrpt_Done;
-        nfo->info.done.rc = 0;
-        nfo->info.done.mesg = "md5 ok";
-        rc = report(nfo, ctx);
-    }
-    else {
-        nfo->type = ccrpt_Done;
-        rc = report(nfo, ctx);
-    }
-
-    return rc;
-}
-
-static
-rc_t KColumnCheckBlobs(const KColumn *self,
-                       CCReportInfoBlock *nfo,
-                       CCReportFunc report, void *ctx)
-{
-    int64_t start;
-    uint64_t row;
-    uint64_t rows;
-    rc_t rc;
-    
-    rc = KColumnIdRange(self, &start, &rows);
-    if (rc) {
-        nfo->info.done.rc = rc;
-        nfo->info.done.mesg = "could not be read";
-        nfo->type = ccrpt_Done;
-        return report(nfo, ctx);
-    }
-    for (row = 0; row < rows && rc == 0; ) {
-        const KColumnBlob *blob;
-        int64_t first;
-        uint32_t count;
-        
-        rc = KColumnOpenBlobRead(self, &blob, row + start);
-        if (rc) {
-            nfo->info.done.rc = rc;
-            nfo->info.done.mesg = "could not be read";
-            nfo->type = ccrpt_Done;
-            return report(nfo, ctx);
-        }
-        rc = KColumnBlobIdRange(blob, &first, &count);
-        if (rc) {
-            KColumnBlobRelease(blob);
-            nfo->info.done.rc = rc;
-            nfo->info.done.mesg = "could not be read";
-            nfo->type = ccrpt_Done;
-            return report(nfo, ctx);
-        }
-        rc = KColumnBlobValidate(blob);
-        KColumnBlobRelease(blob);
-        if (rc) {
-            nfo->info.done.rc = rc;
-            nfo->info.done.mesg = "contains bad data";
-            nfo->type = ccrpt_Done;
-            return report(nfo, ctx);
-        }
-        nfo->type = ccrpt_Blob;
-        nfo->info.blob.start = first;
-        nfo->info.blob.count = count;
-        rc = report(nfo, ctx);
-
-        row += count;
-    }
-    nfo->info.done.rc = 0;
-    nfo->info.done.mesg = "checksums ok";
-    nfo->type = ccrpt_Done;
-    rc = report(nfo, ctx);
-    return rc;
-}
-
-LIB_EXPORT
-rc_t CC KColumnConsistencyCheck(const KColumn *self,
-    uint32_t level, CCReportInfoBlock *nfo, CCReportFunc report, void *ctx )
-{
-    rc_t rc = 0;
-
-    bool indexOnly = level & CC_INDEX_ONLY;
-    if (indexOnly) {
-        level &= ~CC_INDEX_ONLY;
-    }
-
-    if (KDirectoryPathType(self->dir, "md5") != kptNotFound)
-        rc = level == 0 ? KColumnCheckMD5(self, nfo, report, ctx) : 0;
-    else {
-        nfo->type = ccrpt_Done;
-        nfo->info.done.mesg = "missing md5 file";
-        nfo->info.done.rc = 0; /* RC(rcDB, rcColumn, rcValidating, rcFile, rcNotFound); */
-        
-        rc = report(nfo, ctx);
-        
-        if (level == 0)
-            level = 1;
-    }
-    
-    if (rc == 0 && level > 0)
-        rc = KColumnCheckBlobs(self, nfo, report, ctx);
-    return rc;
-}
diff --git a/libs/kdb/column-priv.h b/libs/kdb/column-priv.h
deleted file mode 100644
index dc9a84f..0000000
--- a/libs/kdb/column-priv.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_column_priv_
-#define _h_column_priv_
-
-#ifndef _h_kdb_column_
-#include <kdb/column.h>
-#endif
-
-#ifndef _h_klib_container_
-#include <klib/container.h>
-#endif
-
-#ifndef _h_klib_refcount_
-#include <klib/refcount.h>
-#endif
-
-#ifndef _h_coldata_priv_
-#include "coldata-priv.h"
-#endif
-
-#ifndef _h_colidx_priv_
-#include "colidx-priv.h"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KTable;
-struct KDBManager;
-struct KDirectory;
-
-
-/*--------------------------------------------------------------------------
- * KColumn
- */
-struct KColumn
-{
-    struct KTable const *tbl;
-    struct KDBManager const *mgr;
-    struct KDirectory const *dir;
-
-    KColumnIdx idx;
-    KColumnData df;
-
-    KRefcount refcount;
-    uint32_t csbytes;
-    int32_t checksum;
-    char path [ 1 ];
-};
-
-/* Attach
- * Sever
- *  like Release, except called internally
- *  indicates that a child object is letting go...
- */
-KColumn *KColumnAttach ( const KColumn *self );
-rc_t KColumnSever ( const KColumn *self );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_column_priv_ */
diff --git a/libs/kdb/column.c b/libs/kdb/column.c
deleted file mode 100644
index fb1ce2a..0000000
--- a/libs/kdb/column.c
+++ /dev/null
@@ -1,876 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#define KONST const
-#include <kdb/extern.h>
-#include "column-priv.h"
-#include "dbmgr-priv.h"
-#include "table-priv.h"
-#include "kdb-priv.h"
-#include <kdb/kdb-priv.h>
-#include <klib/checksum.h>
-#include <klib/rc.h>
-#include <klib/printf.h>
-#include <atomic32.h>
-#include <sysalloc.h>
-#undef KONST
-
-#include <limits.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-#include <errno.h>
-#include <byteswap.h>
-
-
-/*--------------------------------------------------------------------------
- * KColumn
- *  a collection of blobs indexed by oid
- */
-
-
-/* Whack
- */
-static
-rc_t KColumnWhack ( KColumn *self )
-{
-    rc_t rc;
-
-    KRefcountWhack ( & self -> refcount, "KColumn" );
-
-    /* shut down index */
-    rc = KColumnIdxWhack ( & self -> idx );
-    if ( rc == 0 )
-    {
-        /* shut down data fork */
-        KColumnDataWhack ( & self -> df );
-
-        /* release owning table
-           should never fail, and our recovery is flawed */
-        if ( self -> tbl != NULL )
-        {
-            rc = KTableSever ( self -> tbl );
-            if ( rc == 0 )
-                self -> tbl = NULL;
-        }
-
-        /* release manager
-           should never fail */
-        if ( rc == 0 )
-            rc = KDBManagerSever ( self -> mgr );
-
-        if ( rc == 0 )
-        {
-            KDirectoryRelease ( self -> dir );
-            free ( self );
-            return 0;
-        }
-    }
-
-    KRefcountInit ( & self -> refcount, 1, "KColumn", "whack", "kcol" );
-    return rc;
-}
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-LIB_EXPORT rc_t CC KColumnAddRef ( const KColumn *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KColumn" ) )
-        {
-        case krefLimit:
-            return RC ( rcDB, rcColumn, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KColumnRelease ( const KColumn *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KColumn" ) )
-        {
-        case krefWhack:
-            return KColumnWhack ( ( KColumn* ) self );
-        case krefNegative:
-            return RC ( rcDB, rcColumn, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-/* Attach
- * Sever
- */
-KColumn *KColumnAttach ( const KColumn *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAddDep ( & self -> refcount, "KColumn" ) )
-        {
-        case krefLimit:
-            return NULL;
-        }
-    }
-    return ( KColumn* ) self;
-}
-
-rc_t KColumnSever ( const KColumn *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDropDep ( & self -> refcount, "KColumn" ) )
-        {
-        case krefWhack:
-            return KColumnWhack ( ( KColumn* ) self );
-        case krefNegative:
-            return RC ( rcDB, rcColumn, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/* Make
- */
-static
-rc_t KColumnMake ( KColumn **colp, const KDirectory *dir, const char *path )
-{
-    KColumn *col = malloc ( sizeof * col + strlen ( path ) );
-    if ( col == NULL )
-        return RC ( rcDB, rcColumn, rcConstructing, rcMemory, rcExhausted );
-
-    memset ( col, 0, sizeof * col );
-    col -> dir = dir;
-    KRefcountInit ( & col -> refcount, 1, "KColumn", "make", path );
-    strcpy ( col -> path, path );
-
-    * colp = col;
-    return 0;
-}
-
-static
-rc_t KColumnMakeRead ( KColumn **colp, const KDirectory *dir, const char *path )
-{
-    rc_t rc = KColumnMake ( colp, dir, path );
-    if ( rc == 0 )
-    {
-        size_t pgsize;
-        uint64_t data_eof;
-        KColumn *self = * colp;
-
-        rc = KColumnIdxOpenRead ( & self -> idx,
-            dir, & data_eof, & pgsize, & self -> checksum );
-        if ( rc == 0 )
-        {
-            rc = KColumnDataOpenRead ( & self -> df,
-                dir, data_eof, pgsize );
-            if ( rc == 0 )
-            {
-                switch ( self -> checksum )
-                {
-                case kcsNone:
-                    break;
-                case kcsCRC32:
-                    self -> csbytes = 4;
-                    break;
-                case kcsMD5:
-                    self -> csbytes = 16;
-                    break;
-                }
-
-                return 0;
-            }
-
-            KColumnIdxWhack ( & self -> idx );
-        }
-
-        free ( self );
-    }
-
-    * colp = NULL;
-    return rc;
-}
-
-
-/* OpenColumnRead
- * VOpenColumnRead
- *  open a column for read
- *
- *  "col" [ OUT ] - return parameter for newly opened column
- *
- *  "path" [ IN ] - NUL terminated string in UTF-8 giving path to col
- *  where "." acts as a structure name separator, i.e. struct.member
- */
-static
-rc_t KDBManagerVOpenColumnReadInt ( const KDBManager *self,
-    const KColumn **colp, const KDirectory *wd, bool try_srapath,
-    const char *path, va_list args )
-{
-    char colpath [ 4096 ];
-    rc_t rc;
-    size_t z;
-
-/*    rc = KDirectoryVResolvePath ( wd, 1,
-        colpath, sizeof colpath, path, args ); */
-    rc = string_vprintf( colpath, sizeof colpath, &z, path, args );
-    if ( rc == 0 )
-    {
-        KColumn *col;
-        const KDirectory *dir;
-
-        /* open table directory */
-        rc = KDBOpenPathTypeRead ( self, wd, colpath, &dir, kptColumn, NULL, try_srapath );
-        if ( rc == 0 )
-        {
-            rc = KColumnMakeRead ( & col, dir, colpath );
-            if ( rc == 0 )
-            {
-                col -> mgr = KDBManagerAttach ( self );
-                * colp = col;
-                return 0;
-            }
-
-            KDirectoryRelease ( dir );
-        }
-    }
-    
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC KDBManagerOpenColumnRead ( const KDBManager *self,
-    const KColumn **col, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDBManagerVOpenColumnRead ( self, col, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC KDBManagerVOpenColumnRead ( const KDBManager *self,
-    const KColumn **col, const char *path, va_list args )
-{
-    if ( col == NULL )
-        return RC ( rcDB, rcMgr, rcOpening, rcParam, rcNull );
-
-    * col = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcMgr, rcOpening, rcSelf, rcNull );
-
-    return KDBManagerVOpenColumnReadInt
-        ( self, col, self -> wd, true, path, args );
-}
-
-
-LIB_EXPORT rc_t CC KTableOpenColumnRead ( const KTable *self,
-    const KColumn **col, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KTableVOpenColumnRead ( self, col, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KTableVOpenColumnRead ( const KTable *self,
-    const KColumn **colp, const char *name, va_list args )
-{
-    rc_t rc;
-    char path [ 256 ];
-
-    if ( colp == NULL )
-        return RC ( rcDB, rcTable, rcOpening, rcParam, rcNull );
-
-    * colp = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcTable, rcOpening, rcSelf, rcNull );
-
-    rc = KDBVMakeSubPath ( self -> dir,
-        path, sizeof path, "col", 3, name, args );
-    if ( rc == 0 )
-    {
-        rc = KDBManagerVOpenColumnReadInt ( self -> mgr,
-            colp, self -> dir, false, path, NULL );
-        if ( rc == 0 )
-        {
-            KColumn *col = ( KColumn* ) * colp;
-            col -> tbl = KTableAttach ( self );
-        }
-    }
-    return rc;
-}
-
-
-/* Locked
- *  returns non-zero if locked
- */
-LIB_EXPORT bool CC KColumnLocked ( const KColumn *self )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        return false;
-
-    rc = KDBWritable ( self -> dir, "" );
-    return GetRCState ( rc ) == rcLocked;
-}
-
-/* Version
- *  returns the column format version
- */
-LIB_EXPORT rc_t CC KColumnVersion ( const KColumn *self, uint32_t *version )
-{
-    if ( version == NULL )
-        return RC ( rcDB, rcColumn, rcAccessing, rcParam, rcNull );
-
-    if ( self == NULL )
-    {
-        * version = 0;
-        return RC ( rcDB, rcColumn, rcAccessing, rcSelf, rcNull );
-    }
-     
-    return KColumnIdxVersion ( & self -> idx, version );
-}
-
-/* ByteOrder
- *  indicates whether original byte order is reversed
- *  under current architecture.
- *
- *  the byte order of the column is established by
- *  the host architecture when created.
- *
- *  "reversed" [ OUT ] - if true, the original byte
- *  order is reversed with regard to host native byte order.
- */
-LIB_EXPORT rc_t CC KColumnByteOrder ( const KColumn *self, bool *reversed )
-{
-    if ( reversed == NULL )
-        return RC ( rcDB, rcColumn, rcAccessing, rcParam, rcNull );
-
-    if ( self == NULL )
-    {
-        * reversed = false;
-        return RC ( rcDB, rcColumn, rcAccessing, rcSelf, rcNull );
-    }
-     
-    return KColumnIdxByteOrder ( & self -> idx, reversed );
-}
-
-/* IdRange
- *  returns id range for column
- */
-LIB_EXPORT rc_t CC KColumnIdRange ( const KColumn *self, int64_t *first, uint64_t *count )
-{
-    rc_t rc;
-    int64_t dummy, last;
-
-    if ( first == NULL && count == NULL )
-        return RC ( rcDB, rcColumn, rcAccessing, rcParam, rcNull );
-
-    if ( first == NULL )
-        first = & dummy;
-    else if ( count == NULL )
-        count = ( uint64_t * ) & dummy;
-
-    if ( self == NULL )
-    {
-        * first = 0;
-        * count = 0;
-        return RC ( rcDB, rcColumn, rcAccessing, rcSelf, rcNull );
-    }
-
-    rc = KColumnIdxIdRange ( & self -> idx, first, & last );
-    if ( rc != 0 )
-        * count = 0;
-    else
-        * count = last - * first + 1;
-
-    return rc;
-}
-
-
-/* OpenManager
- *  duplicate reference to manager
- *  NB - returned reference must be released
- */
-LIB_EXPORT rc_t CC KColumnOpenManagerRead ( const KColumn *self, const KDBManager **mgr )
-{
-    rc_t rc;
-
-    if ( mgr == NULL )
-        rc = RC ( rcDB, rcColumn, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcColumn, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = KDBManagerAddRef ( self -> mgr );
-            if ( rc == 0 )
-            {
-                * mgr = self -> mgr;
-                return 0;
-            }
-        }
-
-        * mgr = NULL;
-    }
-
-    return rc;
-}
-
-
-
-/* OpenParent
- *  duplicate reference to parent table
- *  NB - returned reference must be released
- */
-LIB_EXPORT rc_t CC KColumnOpenParentRead ( const KColumn *self, const KTable **tbl )
-{
-    rc_t rc;
-
-    if ( tbl == NULL )
-        rc = RC ( rcDB, rcColumn, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcColumn, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = KTableAddRef ( self -> tbl );
-            if ( rc == 0 )
-            {
-                * tbl = self -> tbl;
-                return 0;
-            }
-        }
-
-        * tbl = NULL;
-    }
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * KColumnBlob
- *  one or more rows of column data
- */
-struct KColumnBlob
-{
-    /* holds existing blob loc */
-    KColBlobLoc loc;
-    KColumnPageMap pmorig;
-
-    /* owning column */
-    const KColumn *col;
-
-    /* refcount */
-    atomic32_t refcount;
-
-    /* captured from idx1 for CRC32 validation */
-    bool bswap;
-};
-
-
-/* Whack
- */
-static
-rc_t KColumnBlobWhack ( KColumnBlob *self )
-{
-    const KColumn *col = self -> col;
-    assert ( col != NULL );
-
-    KColumnPageMapWhack ( & self -> pmorig, & col -> df );
-
-    /* cannot recover from errors here,
-       since the page maps needed whacking first,
-       and the column is needed for that. */
-    KColumnSever ( col );
-
-    free ( self );
-    return 0;
-}
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-LIB_EXPORT rc_t CC KColumnBlobAddRef ( const KColumnBlob *cself )
-{
-    if ( cself != NULL )
-    {
-        atomic32_inc ( & ( ( KColumnBlob* ) cself ) -> refcount );
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KColumnBlobRelease ( const KColumnBlob *cself )
-{
-    KColumnBlob *self = ( KColumnBlob* ) cself;
-    if ( cself != NULL )
-    {
-        if ( atomic32_dec_and_test ( & self -> refcount ) )
-            return KColumnBlobWhack ( self );
-    }
-    return 0;
-}
-
-/* OpenRead
- * OpenUpdate
- */
-static
-rc_t KColumnBlobOpenRead ( KColumnBlob *self, const KColumn *col, int64_t id )
-{
-    /* locate blob */
-    rc_t rc = KColumnIdxLocateBlob ( & col -> idx, & self -> loc, id, id );
-    if ( rc == 0 )
-    {
-        /* open page map to blob */
-        rc = KColumnPageMapOpen ( & self -> pmorig,
-            ( KColumnData* ) & col -> df, self -> loc . pg, self -> loc . u . blob . size );
-        if ( rc == 0 )
-        {
-            /* existing blob must have proper checksum bytes */
-            if ( self -> loc . u . blob .  size >= col -> csbytes )
-            {
-                /* remove them from apparent blob size */
-                self -> loc . u . blob . size -= col -> csbytes;
-                return 0;
-            }
-
-            /* the blob is corrupt */
-            KColumnPageMapWhack ( & self -> pmorig, & col -> df );
-            rc = RC ( rcDB, rcColumn, rcOpening, rcBlob, rcCorrupt );
-        }
-    }
-
-    return rc;
-}
-
-/* Make
- */
-static
-rc_t KColumnBlobMake ( KColumnBlob **blobp, bool bswap )
-{
-    KColumnBlob *blob = malloc ( sizeof * blob );
-    if ( blob == NULL )
-        return RC ( rcDB, rcBlob, rcConstructing, rcMemory, rcExhausted );
-
-    memset ( blob, 0, sizeof * blob );
-    atomic32_set ( & blob -> refcount, 1 );
-    blob -> bswap = bswap;
-
-    * blobp = blob;
-    return 0;
-}
-
-/* OpenBlobRead
- *  opens an existing blob containing row data for id
- */
-LIB_EXPORT rc_t CC KColumnOpenBlobRead ( const KColumn *self, const KColumnBlob **blobp, int64_t id )
-{
-    rc_t rc;
-    KColumnBlob *blob;
-
-    if ( blobp == NULL )
-        return RC ( rcDB, rcColumn, rcOpening, rcParam, rcNull );
-
-    * blobp = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcColumn, rcOpening, rcSelf, rcNull );
-
-
-    rc = KColumnBlobMake ( & blob, self -> idx . idx1 . bswap );
-    if ( rc == 0 )
-    {
-        rc = KColumnBlobOpenRead ( blob, self, id );
-        if ( rc == 0 )
-        {
-            blob -> col = KColumnAttach ( self );
-            * blobp = blob;
-            return 0;
-        }
-        
-        free ( blob );
-    }
-
-    return rc;
-}
-
-/* IdRange
- *  returns id range for blob
- *
- *  "first" [ OUT ] - return parameter for first id
- *
- *  "last" [ OUT ] - return parameter for count
- */
-LIB_EXPORT rc_t CC KColumnBlobIdRange ( const KColumnBlob *self, int64_t *first, uint32_t *count )
-{
-    rc_t rc;
-
-    if ( first == NULL || count == NULL )
-        rc = RC ( rcDB, rcBlob, rcAccessing, rcParam, rcNull );
-    else if ( self == NULL )
-        rc = RC ( rcDB, rcBlob, rcAccessing, rcSelf, rcNull );
-    else if ( self -> loc . id_range == 0 )
-        rc = RC ( rcDB, rcBlob, rcAccessing, rcRange, rcEmpty );
-    else
-    {
-        * first = self -> loc . start_id;
-        * count = self -> loc . id_range;
-        return 0;
-    }
-
-    if ( first != NULL )
-        * first = 0;
-    if ( count != NULL )
-        * count = 0;
-
-    return rc;
-}
-
-/* KColumnBlobValidate
- *  runs checksum validation on unmodified blob
- */
-static
-rc_t KColumnBlobValidateCRC32 ( const KColumnBlob *self )
-{
-    rc_t rc;
-    const KColumn *col = self -> col;
-
-    uint8_t buffer [ 1024 ];
-    size_t to_read, num_read, total, size;
-
-    uint32_t cs, crc32 = 0;
-
-    /* calculate checksum */
-    for ( size = self -> loc . u . blob . size, total = 0; total < size; total += num_read )
-    {
-        to_read = size - total;
-        if ( to_read > sizeof buffer )
-            to_read = sizeof buffer;
-
-        rc = KColumnDataRead ( & col -> df,
-            & self -> pmorig, total, buffer, to_read, & num_read );
-        if ( rc != 0 )
-            return rc;
-        if ( num_read == 0 )
-            return RC ( rcDB, rcBlob, rcValidating, rcTransfer, rcIncomplete );
-
-        crc32 = CRC32 ( crc32, buffer, num_read );
-    }
-
-    /* read stored checksum */
-    rc = KColumnDataRead ( & col -> df,
-        & self -> pmorig, size, & cs, sizeof cs, & num_read );
-    if ( rc != 0 )
-        return rc;
-    if ( num_read != sizeof cs )
-        return RC ( rcDB, rcBlob, rcValidating, rcTransfer, rcIncomplete );
-
-    if ( self -> bswap )
-        cs = bswap_32 ( cs );
-
-    if ( cs != crc32 )
-        return RC ( rcDB, rcBlob, rcValidating, rcBlob, rcCorrupt );
-
-    return 0;
-}
-
-static
-rc_t KColumnBlobValidateMD5 ( const KColumnBlob *self )
-{
-    rc_t rc;
-    const KColumn *col = self -> col;
-
-    uint8_t buffer [ 1024 ];
-    size_t to_read, num_read, total, size;
-
-    MD5State md5;
-    uint8_t digest [ 16 ];
-
-    MD5StateInit ( & md5 );
-
-    /* calculate checksum */
-    for ( size = self -> loc . u . blob . size, total = 0; total < size; total += num_read )
-    {
-        to_read = size - total;
-        if ( to_read > sizeof buffer )
-            to_read = sizeof buffer;
-
-        rc = KColumnDataRead ( & col -> df,
-            & self -> pmorig, total, buffer, to_read, & num_read );
-        if ( rc != 0 )
-            return rc;
-        if ( num_read == 0 )
-            return RC ( rcDB, rcBlob, rcValidating, rcTransfer, rcIncomplete );
-
-        MD5StateAppend ( & md5, buffer, num_read );
-    }
-
-    /* read stored checksum */
-    rc = KColumnDataRead ( & col -> df,
-        & self -> pmorig, size, buffer, sizeof digest, & num_read );
-    if ( rc != 0 )
-        return rc;
-    if ( num_read != sizeof digest )
-        return RC ( rcDB, rcBlob, rcValidating, rcTransfer, rcIncomplete );
-
-    /* finish MD5 digest */
-    MD5StateFinish ( & md5, digest );
-
-    if ( memcmp ( buffer, digest, sizeof digest ) != 0 )
-        return RC ( rcDB, rcBlob, rcValidating, rcBlob, rcCorrupt );
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KColumnBlobValidate ( const KColumnBlob *self )
-{
-    if ( self == NULL )
-        return RC ( rcDB, rcBlob, rcValidating, rcSelf, rcNull );
-
-    if ( self -> loc . u . blob . size != 0 ) switch ( self -> col -> checksum )
-    {
-    case kcsCRC32:
-        return KColumnBlobValidateCRC32 ( self );
-    case kcsMD5:
-        return KColumnBlobValidateMD5 ( self );
-    }
-
-    return 0;
-}
-
-/* KColumnBlobRead
- *  read data from blob
- *
- *  "offset" [ IN ] - starting offset into blob
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT ] - number of bytes actually read
- *
- *  "remaining" [ OUT, NULL OKAY ] - optional return parameter for
- *  the number of bytes remaining to be read. specifically,
- *  "offset" + "num_read" + "remaining" == sizeof blob
- */
-LIB_EXPORT rc_t CC KColumnBlobRead ( const KColumnBlob *self,
-    size_t offset, void *buffer, size_t bsize,
-    size_t *num_read, size_t *remaining )
-{
-    rc_t rc;
-    size_t ignore;
-    if ( remaining == NULL )
-        remaining = & ignore;
-
-    if ( num_read == NULL )
-        rc = RC ( rcDB, rcBlob, rcReading, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcBlob, rcReading, rcSelf, rcNull );
-        else
-        {
-            size_t size = self -> loc . u . blob . size;
-            const KColumn *col = self -> col;
-
-            if ( offset > size )
-                offset = size;
-
-            if ( bsize == 0 )
-                rc = 0;
-            else if ( buffer == NULL )
-                rc = RC ( rcDB, rcBlob, rcReading, rcBuffer, rcNull );
-            else
-            {
-                size_t to_read = size - offset;
-                if ( to_read > bsize )
-                    to_read = bsize;
-                rc = KColumnDataRead ( & col -> df,
-                    & self -> pmorig, offset, buffer, to_read, num_read );
-                if ( rc == 0 )
-                {
-                    * remaining = size - offset - * num_read;
-                    return 0;
-                }
-            }
-
-            * remaining = size - offset;
-            * num_read = 0;
-            return rc;
-        }
-
-        * num_read = 0;
-    }
-
-    * remaining = 0;
-    return rc;
-}
-
-/* GetDirectory
- */
-LIB_EXPORT rc_t CC KColumnGetDirectoryRead ( const KColumn *self, const KDirectory **dir )
-{
-    rc_t rc;
-
-    if ( dir == NULL )
-        rc = RC ( rcDB, rcColumn, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcColumn, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            * dir = self -> dir;
-            return KDirectoryAddRef ( * dir );
-        }
-
-        * dir = NULL;
-    }
-
-    return rc;
-}
diff --git a/libs/kdb/database-cc.c b/libs/kdb/database-cc.c
deleted file mode 100644
index a0e0b1c..0000000
--- a/libs/kdb/database-cc.c
+++ /dev/null
@@ -1,338 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- *============================================================================
- *
- */
-
-#include <kdb/extern.h>
-
-#define KONST const
-#include "index-priv.h"
-#include "dbmgr-priv.h"
-#include "database-priv.h"
-#include "table-priv.h"
-#include "kdb-priv.h"
-#include "column-priv.h"
-#undef KONST
-
-#include "cc-priv.h"
-
-#include <kdb/index.h>
-
-#include <kfs/file.h>
-#include <kfs/md5.h>
-#include <klib/refcount.h>
-#include <klib/rc.h>
-#include <klib/namelist.h>
-#include <kdb/namelist.h>
-#include <os-native.h>
-#include <sysalloc.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-#include <errno.h>
-
-#undef index
-
-static void KDatabaseGetName(KDatabase const *self, char const **rslt)
-{
-    char *sep;
-    
-    *rslt = self->path;
-    sep = strrchr(self->path, '/');
-    if (sep != NULL)
-        *rslt = sep + 1;
-}
-
-static
-rc_t KDatabaseCheckMD5 (const KDatabase *self, CCReportFunc report, void *ctx)
-{
-    CCReportInfoBlock info;
-    memset (& info, 0, sizeof info);
-
-    info.objType = kptDatabase;
-    KDatabaseGetName(self, &info.objName);
-    
-    return DirectoryCheckMD5 (self -> dir, "md5", & info, report, ctx);
-}
-
-static
-rc_t KDatabaseCheckTables (const KDatabase *self, uint32_t depth, int level, CCReportFunc report, void *ctx)
-{
-    uint32_t n;
-    
-    KNamelist *list;
-    rc_t rc = KDatabaseListTbl (self, & list);
-    if (rc != 0)
-        return rc;
-    
-    rc = KNamelistCount (list, & n);
-    if (rc == 0)
-    {
-        CCReportInfoBlock nfo;
-        memset (& nfo, 0, sizeof nfo);
-        nfo.objType = kptTable;
-        
-        for (nfo.objId = 0; rc == 0 && nfo.objId != (int) n; ++ nfo.objId)
-        {
-            rc = KNamelistGet (list, nfo.objId, &nfo.objName);
-            if (rc == 0)
-            {
-                const KTable *tbl;
-                
-                nfo.type = ccrpt_Visit;
-                nfo.info.visit.depth = depth + 1;
-                rc = report(&nfo, ctx); if (rc) break;
-                
-                rc = KDatabaseOpenTableRead (self, & tbl, nfo.objName);
-                if (rc == 0)
-                {
-                    rc = KTableConsistencyCheck (tbl, depth + 1, level, report,
-                        ctx, SRA_PLATFORM_UNDEFINED);
-                    KTableRelease (tbl);
-                }
-            }
-        }
-    }
-    
-    KNamelistRelease (list);
-    return rc;
-}
-
-static
-rc_t KDatabaseCheckIndexMD5 (const KDirectory *dir,
-    CCReportInfoBlock *nfo, CCReportFunc report, void *ctx)
-{
-    char md5 [ 4100 ];
-
-    snprintf (md5, sizeof md5, "%s.md5", nfo -> objName);
-    return DirectoryCheckMD5 (dir, md5, nfo, report, ctx);
-}
-
-static
-const KDirectory *KDatabaseFindIndexDir (const KDatabase *self)
-{
-    const KDirectory *idxDir;
-    
-    rc_t rc = KDirectoryOpenDirRead (self -> dir, & idxDir, false, "idx");
-    if (rc == 0)
-        return idxDir;
-
-    return NULL;
-}
-
-static
-rc_t KDatabaseCheckIndices (const KDatabase *self, uint32_t depth, uint32_t level, CCReportFunc report, void *ctx)
-{
-    uint32_t n;
-
-    KNamelist *list;
-    rc_t rc = KDatabaseListIdx (self, & list);
-    if (rc != 0)
-    {
-        if (GetRCState (rc) == rcNotFound)
-            return 0;
-        return rc;
-    }
-
-/* TEST    assert(0); */
-    rc = KNamelistCount (list, & n);
-    if (rc == 0)
-    {
-        const KDirectory *idxDir = KDatabaseFindIndexDir (self);
-        if (idxDir == NULL)
-            rc = RC (rcDB, rcDatabase, rcValidating, rcDirectory, rcNull);
-        else
-        {
-            CCReportInfoBlock nfo;
-            memset (& nfo, 0, sizeof nfo);
-            nfo.objType = kptIndex;
-
-            for (nfo.objId = 0; rc == 0 && nfo.objId != (int) n; ++ nfo.objId)
-            {
-                rc = KNamelistGet(list, nfo.objId, &nfo.objName);
-                if (rc != 0)
-                    break;
-            
-                nfo.type = ccrpt_Visit;
-                nfo.info.visit.depth = depth + 1;
-                rc = report(&nfo, ctx); if (rc) break;
-                
-                rc = KDatabaseCheckIndexMD5 (idxDir, &nfo, report, ctx);
-                if (rc == 0 && level > 0)
-                {
-                    const KIndex *idx;
-                    rc = KDatabaseOpenIndexRead (self, &idx, nfo.objName);
-                    if (rc != 0)
-                    {
-                        nfo.type = ccrpt_Done;
-                        nfo.info.done.rc = rc;
-                        nfo.info.done.mesg = "could not be opened";
-                    }
-                    else
-                    {
-                        nfo.type = ccrpt_Index;
-                        rc = KIndexConsistencyCheck(idx, level < 3 ? 1 : 3,
-                                                    &nfo.info.index.start_id,
-                                                    &nfo.info.index.id_range,
-                                                    &nfo.info.index.num_keys,
-                                                    &nfo.info.index.num_rows,
-                                                    &nfo.info.index.num_holes);
-                        KIndexRelease(idx);
-                        if (rc != 0)
-                        {
-                            nfo.type = ccrpt_Done;
-                            nfo.info.done.rc = rc;
-                            nfo.info.done.mesg = "could not be validated";
-                        }
-                    }
-
-                    rc = report (& nfo, ctx);
-                }
-            }
-
-            KDirectoryRelease (idxDir);
-        }
-    }
-
-    KNamelistRelease (list);
-    return rc;
-}
-
-static
-rc_t KDatabaseCheckDatabases (const KDatabase *self, uint32_t depth, int level, CCReportFunc report, void *ctx)
-{
-    uint32_t n;
-
-    KNamelist *list;
-    rc_t rc = KDatabaseListDB (self, & list);
-    if (rc != 0)
-    {
-        if (GetRCState (rc) == rcNotFound)
-            return 0;
-        return rc;
-    }
-
-    rc = KNamelistCount (list, & n);
-    if (rc == 0)
-    {
-        CCReportInfoBlock nfo;
-        memset (& nfo, 0, sizeof nfo);
-        nfo.objType = kptDatabase;
-        
-        for (nfo.objId = 0; rc == 0 && nfo.objId != (int) n; ++ nfo.objId)
-        {
-            rc = KNamelistGet (list, nfo.objId, &nfo.objName);
-            if (rc == 0)
-            {
-                const KDatabase *db;
-                
-                nfo.type = ccrpt_Visit;
-                nfo.info.visit.depth = depth + 1;
-                rc = report(&nfo, ctx); if (rc) break;
-                
-                rc = KDatabaseOpenDBRead (self, & db, nfo.objName);
-                if (rc == 0)
-                {
-                    rc = KDatabaseConsistencyCheck (db, depth + 1, level, report, ctx);
-                    KDatabaseRelease (db);
-                }
-            }
-        }
-    }
-    
-    KNamelistRelease (list);
-    return rc;
-}
-
-LIB_EXPORT
-rc_t CC KDatabaseConsistencyCheck (const KDatabase *self,
-    uint32_t depth, uint32_t level, CCReportFunc report, void *ctx)
-{
-    rc_t rc = 0;
-    uint32_t type;
-
-    bool indexOnly = level & CC_INDEX_ONLY;
-    if (indexOnly) {
-        level &= ~CC_INDEX_ONLY;
-    }
-
-    if (self == NULL)
-        return RC (rcDB, rcDatabase, rcValidating, rcSelf, rcNull);
-    
-    if (depth == 0) {
-        CCReportInfoBlock info;
-        
-        KDatabaseGetName(self, &info.objName);
-        info.objId = 0;
-        info.objType = kptDatabase;
-        info.type = ccrpt_Visit;
-        info.info.visit.depth = 0;
-        
-        rc = report(&info, ctx);
-        if (rc) return rc;
-    }
-    
-    type = KDirectoryPathType(self->dir, "md5");
-    if (type == kptZombieFile) {
-        CCReportInfoBlock info;
-        
-        KDatabaseGetName(self, &info.objName);
-        info.objId = 0;
-        info.objType = kptTable;
-        info.type = ccrpt_Done;
-        info.info.done.mesg = "Database may be truncated";
-        info.info.done.rc = 0;
-        
-        rc = report(&info, ctx);
-    }
-    else if (type != kptNotFound)
-        rc = KDatabaseCheckMD5 (self, report, ctx);
-    else {
-        CCReportInfoBlock info;
-        
-        KDatabaseGetName(self, &info.objName);
-        info.objId = 0;
-        info.objType = kptDatabase;
-        info.type = ccrpt_Done;
-        info.info.done.mesg = "no md5 file";
-        info.info.done.rc = 0;
-        
-        rc = report(&info, ctx);
-    }
-    
-
-    if (rc == 0)
-        rc = KDatabaseCheckTables (self, depth, level, report, ctx);
-
-    if (rc == 0)
-        rc = KDatabaseCheckIndices (self, depth, level, report, ctx);
-
-    if (rc == 0)
-        rc = KDatabaseCheckDatabases (self, depth, level, report, ctx);
-
-    return rc;
-}
diff --git a/libs/kdb/database-cmn.c b/libs/kdb/database-cmn.c
deleted file mode 100644
index 27d4ed6..0000000
--- a/libs/kdb/database-cmn.c
+++ /dev/null
@@ -1,495 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#define KONST const
-#include "database-priv.h"
-#include "dbmgr-priv.h"
-#include "kdb-priv.h"
-#undef KONST
-
-#include <sysalloc.h>
-#include <klib/namelist.h>
-#include <klib/rc.h>
-#include <kfs/md5.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * KDatabase
- *  connection to a database within file system
- */
-
-/* Whack
- */
-static
-rc_t KDatabaseWhack ( KDatabase *self )
-{
-    rc_t rc = 0;
-
-    /* unused: const KDBManager *mgr; */
-
-    KRefcountWhack ( & self -> refcount, "KDatabase" );
-
-    /* shut down md5 fmt file */
-    if ( self -> md5 != NULL )
-    {
-        rc = KMD5SumFmtRelease ( self -> md5 );
-        if ( rc == 0 )
-            self -> md5 = NULL;
-    }
-    if ( rc == 0 )
-    {
-        /* release dad */
-        if ( self -> dad != NULL )
-        {
-            rc = KDatabaseSever ( self -> dad );
-            if ( rc == 0 )
-                self -> dad = NULL;
-        }
-        /* remove from mgr */
-        if ( rc == 0 )
-        {
-            /* rc = KDBManagerSever ( self -> mgr, & self -> sym ); */
-			rc = KDBManagerSever ( self -> mgr );
-
-            /* complete */
-            if ( rc == 0 )
-            {
-                KDirectoryRelease ( self -> dir );
-                free ( self );
-                return 0;
-            }
-        }
-    }
-
-    KRefcountInit ( & self -> refcount, 1, "KDatabase", "whack", "kdb" );
-
-    return rc;
-}
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-rc_t KDatabaseAddRef ( const KDatabase *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KDatabase" ) )
-        {
-        case krefLimit:
-            return RC ( rcDB, rcDatabase, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-rc_t KDatabaseRelease ( const KDatabase *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KDatabase" ) )
-        {
-        case krefWhack:
-            return KDatabaseWhack ( ( KDatabase* ) self );
-        case krefNegative:
-            return RC ( rcDB, rcDatabase, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-/* Sever
- *  like Release, except called internally
- *  indicates that a child object is letting go...
- */
-KDatabase *KDatabaseAttach ( const KDatabase *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAddDep ( & self -> refcount, "KDatabase" ) )
-        {
-        case krefLimit:
-            return NULL;
-        }
-    }
-    return ( KDatabase* ) self;
-}
-
-rc_t KDatabaseSever ( const KDatabase *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDropDep ( & self -> refcount, "KDatabase" ) )
-        {
-        case krefWhack:
-            return KDatabaseWhack ( ( KDatabase* ) self );
-        case krefNegative:
-            return RC ( rcDB, rcDatabase, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/* Make
- *  make an initialized structure
- */
-static
-rc_t KDatabaseMake ( KDatabase **dbp, const KDirectory *dir, const char *path )
-{
-    KDatabase *db;
-
-    assert ( dbp != NULL );
-    assert ( path != NULL );
-
-    db = malloc ( sizeof * db + strlen ( path ) );
-    if ( db == NULL )
-    {
-        * dbp = NULL;
-        return RC ( rcDB, rcDatabase, rcConstructing, rcMemory, rcExhausted );
-    }
-
-    memset ( db, 0, sizeof * db );
-    db -> dir = dir;
-    KRefcountInit ( & db -> refcount, 1, "KDatabase", "make", path );
-    strcpy ( db -> path, path );
-
-    * dbp = db;
-    return 0;
-}
-
-
-/* OpenDBRead
- * VOpenDBRead
- *  open a database for read
- *
- *  "db" [ OUT ] - return parameter for newly opened database
- *
- *  "path" [ IN ] - NUL terminated string in
- *  wd-native character set giving path to database
- */
-static
-rc_t KDBManagerVOpenDBReadInt ( const KDBManager *self,
-    const KDatabase **dbp, const KDirectory *wd,
-    const char *path, va_list args )
-{
-    /* generate absolute path to db */
-    char dbpath [ 4096 ];
-    rc_t rc = KDirectoryVResolvePath ( wd, true,
-        dbpath, sizeof dbpath, path, args );
-    if ( rc == 0 )
-    {
-        KDatabase *db;
-        const KDirectory *dir;
-
-        /* open the directory if its a database */
-        rc = KDBOpenPathTypeRead ( wd, dbpath, &dir, kptDatabase, NULL );
-        if ( rc == 0 )
-        {
-            /* allocate a new guy */
-            rc = KDatabaseMake ( & db, dir, dbpath );
-            if ( rc == 0 )
-            {
-                db -> mgr = KDBManagerAttach ( self );
-                * dbp = db;
-                return 0;
-            }
-
-            KDirectoryRelease ( dir );
-        }
-    }
-    
-    return rc;
-}
-
-rc_t KDBManagerOpenDBRead ( const KDBManager *self,
-    const KDatabase **db, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDBManagerVOpenDBRead ( self, db, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-rc_t KDatabaseOpenDBRead ( const KDatabase *self,
-    const KDatabase **db, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = KDatabaseVOpenDBRead ( self, db, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-rc_t KDBManagerVOpenDBRead ( const KDBManager *self,
-    const KDatabase **db, const char *path, va_list args )
-{
-    if ( db == NULL )
-        return RC ( rcDB, rcMgr, rcOpening, rcParam, rcNull );
-
-    * db = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcMgr, rcOpening, rcSelf, rcNull );
-
-    return KDBManagerVOpenDBReadInt ( self, db, self -> wd, path, args );
-}
-
-rc_t KDatabaseVOpenDBRead ( const KDatabase *self,
-    const KDatabase **dbp, const char *name, va_list args )
-{
-    rc_t rc;
-    char path [ 256 ];
-
-    if ( dbp == NULL )
-        return RC ( rcDB, rcDatabase, rcOpening, rcParam, rcNull );
-
-    * dbp = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcDatabase, rcOpening, rcSelf, rcNull );
-
-    rc = KDBVMakeSubPath ( self -> dir,
-        path, sizeof path, "db", 2, name, args );
-    if ( rc == 0 )
-    {
-        rc = KDBManagerVOpenDBReadInt ( self -> mgr, dbp,
-            self -> dir, path, NULL );
-        if ( rc == 0 )
-        {
-            KDatabase *db = ( KDatabase* ) * dbp;
-            db -> dad = KDatabaseAttach ( self );
-        }
-    }
-
-    return rc;
-}
-
-
-/* Locked
- *  returns non-zero if locked
- */
-bool KDatabaseLocked ( const KDatabase *self )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        return false;
-
-    rc = KDBWritable ( self -> dir, "." );
-    return GetRCState ( rc ) == rcLocked;
-}
-
-
-/* Exists
- *  returns true if requested object exists
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptIndex and kptColumn
- *
- *  "path" [ IN ] - NUL terminated path
- */
-bool KDatabaseVExists ( const KDatabase *self, uint32_t type, const char *name, va_list args )
-{
-    /* TBD */
-    return false;
-}
-
-bool KDatabaseExists ( const KDatabase *self, uint32_t type, const char *name, ... )
-{
-    bool exists;
-
-    va_list args;
-    va_start ( args, name );
-
-    exists = KDatabaseVExists ( self, type, name, args );
-
-    va_end ( args );
-
-    return exists;
-}
-
-
-/* Writable
- *  returns 0 if object is writable
- *  or a reason why if not
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptDatabase, kptTable and kptIndex
- *
- *  "path" [ IN ] - NUL terminated path
- */
-rc_t KDatabaseVWritable ( const KDatabase *self, uint32_t type, const char *name, va_list args )
-{
-    /* TBD */
-    return -1;
-}
-
-rc_t KDatabaseWritable ( const KDatabase *self, uint32_t type, const char *name, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, name );
-
-    rc = KDatabaseVWritable ( self, type, name, args );
-
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* OpenManager
- *  duplicate reference to manager
- *  NB - returned reference must be released
- */
-rc_t KDatabaseOpenManagerRead ( const KDatabase *self, const KDBManager **mgr )
-{
-    rc_t rc;
-
-    if ( mgr == NULL )
-        rc = RC ( rcDB, rcDatabase, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcDatabase, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = KDBManagerAddRef ( self -> mgr );
-            if ( rc == 0 )
-            {
-                * mgr = self -> mgr;
-                return 0;
-            }
-        }
-
-        * mgr = NULL;
-    }
-
-    return rc;
-}
-
-
-/* OpenParent
- *  duplicate reference to parent database
- *  NB - returned reference must be released
- */
-rc_t KDatabaseOpenParentRead ( const KDatabase *self, const KDatabase **par )
-{
-    rc_t rc;
-
-    if ( par == NULL )
-        rc = RC ( rcDB, rcDatabase, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcDatabase, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = KDatabaseAddRef ( self -> dad );
-            if ( rc == 0 )
-            {
-                * par = self -> dad;
-                return 0;
-            }
-        }
-
-        * par = NULL;
-    }
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * KNameList
- */
-
-/* List
- *  create database listings
- */
-static
-bool KDatabaseListFilter ( const KDirectory *dir, const char *name, void *data )
-{
-    return ( KDBOpenPathTypeRead ( dir, name, NULL, (( long int ) data ), NULL ) == 0 );
-}
-
-rc_t KDatabaseListDB ( const KDatabase *self, KNamelist **names )
-{
-    if ( self != NULL )
-    {
-        return KDirectoryVList ( self -> dir,
-            names, KDatabaseListFilter, ( void* ) kptDatabase, "db", NULL );
-    }
-
-    if ( names != NULL )
-        * names = NULL;
-
-    return RC ( rcDB, rcDatabase, rcListing, rcSelf, rcNull );
-}
-
-rc_t KDatabaseListTbl ( struct KDatabase const *self, KNamelist **names )
-{
-    if ( self != NULL )
-    {
-        return KDirectoryVList ( self -> dir,
-            names, KDatabaseListFilter, ( void* ) kptTable, "tbl", NULL );
-    }
-
-    if ( names != NULL )
-        * names = NULL;
-
-    return RC ( rcDB, rcDatabase, rcListing, rcSelf, rcNull );
-}
-
-rc_t KDatabaseListIdx ( struct KDatabase const *self, KNamelist **names )
-{
-    if ( self != NULL )
-    {
-        return KDirectoryVList ( self -> dir,
-            names, KDatabaseListFilter, ( void* ) kptIndex, "idx", NULL );
-    }
-
-    if ( names != NULL )
-        * names = NULL;
-
-    return RC ( rcDB, rcDatabase, rcListing, rcSelf, rcNull );
-}
diff --git a/libs/kdb/database-priv.h b/libs/kdb/database-priv.h
deleted file mode 100644
index fa8aee1..0000000
--- a/libs/kdb/database-priv.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_database_priv_
-#define _h_database_priv_
-
-#ifndef _h_kdb_database_
-#include <kdb/database.h>
-#endif
-
-#ifndef _h_klib_symbol_
-#include <klib/symbol.h>
-#endif
-
-#ifndef _h_klib_refcount_
-#include <klib/refcount.h>
-#endif
-
-#ifndef KONST
-#define KONST
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KDBManager;
-struct KDirectory;
-struct KMD5SumFmt;
-
-
-/*--------------------------------------------------------------------------
- * KDatabase
- *  connection to a database within file system
- */
-struct KDatabase
-{
-    /* manager reference */
-    struct KDBManager KONST *mgr;
-
-    /* if a sub-directory */
-    struct KDatabase KONST *dad;
-
-    /* database directory */
-    struct KDirectory KONST *dir;
-
-    /* MD5 format object */
-    struct KMD5SumFmt *md5;
-
-    /* open references */
-#if 1
-    KRefcount refcount;
-    uint32_t opencount;
-#else
-    KDualRef refcount;
-    uint32_t align;
-#endif
-
-    /* fits into manager symbol table */
-    KSymbol sym;
-
-    /* global md5 usage for entire db */
-    bool use_md5;
-
-    /* true if database was opened read-only */
-    bool read_only;
-
-    /* symbol text space */
-    char path [ 1 ];
-};
-
-/* Attach
- * Sever
- *  like AddRef/Release, except called internally
- *  indicates that a child object is letting go...
- */
-KDatabase *KDatabaseAttach ( const KDatabase *self );
-rc_t KDatabaseSever ( const KDatabase *self );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_database_priv_ */
diff --git a/libs/kdb/database.c b/libs/kdb/database.c
deleted file mode 100644
index 7329631..0000000
--- a/libs/kdb/database.c
+++ /dev/null
@@ -1,706 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#define KONST const
-#include <kdb/extern.h>
-#include "database-priv.h"
-#include "dbmgr-priv.h"
-#include "kdb-priv.h"
-#undef KONST
-
-#include <klib/namelist.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <klib/printf.h>
-#include <os-native.h>
-#include <sysalloc.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * KDatabase
- *  connection to a database within file system
- */
-
-/* GetPath
- *  return the absolute path to DB
- */
-LIB_EXPORT rc_t CC KDatabaseGetPath ( KDatabase const *self,
-    const char **path )
-{
-    if ( self == NULL )
-        return RC ( rcDB, rcDatabase, rcAccessing, rcSelf, rcNull );
-    if ( path == NULL )
-        return RC ( rcDB, rcDatabase, rcAccessing, rcParam, rcNull );
-
-    *path = self->path;
-
-    return 0;
-}
-
-/* Whack
- */
-static
-rc_t KDatabaseWhack ( KDatabase *self )
-{
-    rc_t rc = 0;
-
-    KRefcountWhack ( & self -> refcount, "KDatabase" );
-
-    /* release dad */
-    if ( self -> dad != NULL )
-    {
-        rc = KDatabaseSever ( self -> dad );
-        if ( rc == 0 )
-            self -> dad = NULL;
-    }
-
-    /* remove from mgr */
-    if ( rc == 0 )
-        rc = KDBManagerSever ( self -> mgr );
-
-    /* complete */
-    if ( rc == 0 )
-    {
-        KDirectoryRelease ( self -> dir );
-        free ( self );
-        return 0;
-    }
-
-    KRefcountInit ( & self -> refcount, 1, "KDatabase", "whack", "kdb" );
-
-    return rc;
-}
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-LIB_EXPORT rc_t CC KDatabaseAddRef ( const KDatabase *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KDatabase" ) )
-        {
-        case krefLimit:
-            return RC ( rcDB, rcDatabase, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KDatabaseRelease ( const KDatabase *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KDatabase" ) )
-        {
-        case krefWhack:
-            return KDatabaseWhack ( ( KDatabase* ) self );
-        case krefNegative:
-            return RC ( rcDB, rcDatabase, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-/* Sever
- *  like Release, except called internally
- *  indicates that a child object is letting go...
- */
-KDatabase *KDatabaseAttach ( const KDatabase *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAddDep ( & self -> refcount, "KDatabase" ) )
-        {
-        case krefLimit:
-            return NULL;
-        }
-    }
-    return ( KDatabase* ) self;
-}
-
-rc_t KDatabaseSever ( const KDatabase *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDropDep ( & self -> refcount, "KDatabase" ) )
-        {
-        case krefWhack:
-            return KDatabaseWhack ( ( KDatabase* ) self );
-        case krefNegative:
-            return RC ( rcDB, rcDatabase, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/* Make
- *  make an initialized structure
- */
-static
-rc_t KDatabaseMake ( KDatabase **dbp, const KDirectory *dir, const char *path )
-{
-    KDatabase *db;
-
-    assert ( dbp != NULL );
-    assert ( path != NULL );
-
-    db = malloc ( sizeof * db + strlen ( path ) );
-    if ( db == NULL )
-    {
-        * dbp = NULL;
-        return RC ( rcDB, rcDatabase, rcConstructing, rcMemory, rcExhausted );
-    }
-
-    db -> mgr = NULL;
-    db -> dad = NULL;
-    db -> dir = dir;
-    KRefcountInit ( & db -> refcount, 1, "KDatabase", "make", path );
-    strcpy ( db -> path, path );
-
-    * dbp = db;
-    return 0;
-}
-
-
-/* OpenDBRead
- * VOpenDBRead
- *  open a database for read
- *
- *  "db" [ OUT ] - return parameter for newly opened database
- *
- *  "path" [ IN ] - NUL terminated string in
- *  wd-native character set giving path to database
- */
-static
-rc_t KDBManagerVOpenDBReadInt ( const KDBManager *self, const KDatabase **dbp,
-                                const KDirectory *wd, bool try_srapath,
-                                const char *path, va_list args )
-{
-    rc_t rc;
-
-    /* MUST use vsnprintf because the documented behavior of "path"
-       is that of stdc library's printf, not vdb printf */
-    char dbpath [ 4096 ];
-    int z = ( args == NULL ) ?
-        snprintf ( dbpath, sizeof dbpath, path ):
-        vsnprintf ( dbpath, sizeof dbpath, path, args );
-    if ( z < 0 || ( size_t ) z >= sizeof dbpath )
-        rc = RC ( rcDB, rcMgr, rcOpening, rcPath, rcExcessive );
-    else
-    {
-        const KDirectory *dir;
-
-        /* open the directory if its a database */
-        rc = KDBOpenPathTypeRead ( self, wd, dbpath, &dir, kptDatabase, NULL, try_srapath );
-        if ( rc == 0 )
-        {
-            KDatabase *db;
-
-            /* allocate a new guy */
-            rc = KDatabaseMake ( & db, dir, dbpath );
-            if ( rc == 0 )
-            {
-                db -> mgr = KDBManagerAttach ( self );
-                * dbp = db;
-                return 0;
-            }
-
-            KDirectoryRelease ( dir );
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDBManagerOpenDBRead ( const KDBManager *self,
-    const KDatabase **db, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDBManagerVOpenDBRead ( self, db, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDatabaseOpenDBRead ( const KDatabase *self,
-    const KDatabase **db, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = KDatabaseVOpenDBRead ( self, db, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDBManagerVOpenDBRead ( const KDBManager *self,
-    const KDatabase **db, const char *path, va_list args )
-{
-    if ( db == NULL )
-        return RC ( rcDB, rcMgr, rcOpening, rcParam, rcNull );
-
-    * db = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcMgr, rcOpening, rcSelf, rcNull );
-
-    return KDBManagerVOpenDBReadInt ( self, db, self -> wd, true, path, args );
-}
-
-LIB_EXPORT rc_t CC KDatabaseVOpenDBRead ( const KDatabase *self,
-    const KDatabase **dbp, const char *name, va_list args )
-{
-    rc_t rc;
-    char path [ 256 ];
-
-    if ( dbp == NULL )
-        return RC ( rcDB, rcDatabase, rcOpening, rcParam, rcNull );
-
-    * dbp = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcDatabase, rcOpening, rcSelf, rcNull );
-
-    rc = KDBVMakeSubPath ( self -> dir,
-        path, sizeof path, "db", 2, name, args );
-    if ( rc == 0 )
-    {
-        rc = KDBManagerVOpenDBReadInt ( self -> mgr, dbp,
-            self -> dir, false, path, NULL );
-        if ( rc == 0 )
-        {
-            KDatabase *db = ( KDatabase* ) * dbp;
-            db -> dad = KDatabaseAttach ( self );
-        }
-    }
-
-    return rc;
-}
-
-
-/* Locked
- *  returns non-zero if locked
- */
-LIB_EXPORT bool CC KDatabaseLocked ( const KDatabase *self )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        return false;
-
-    rc = KDBWritable ( self -> dir, "." );
-    return GetRCState ( rc ) == rcLocked;
-}
-
-/* Exists
- *  returns true if requested object exists
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptIndex and kptColumn
- *
- *  "path" [ IN ] - NUL terminated path
- */
-LIB_EXPORT bool CC KDatabaseVExists ( const KDatabase *self, uint32_t type, const char *name, va_list args )
-{
-    if ( self != NULL && name != NULL && name [ 0 ] != 0 )
-    {
-        rc_t rc;
-        uint32_t len;
-        const char *ns;
-        char path [ 256 ];
-
-        switch ( type )
-        {
-        case kptDatabase:
-            ns = "db";
-            len = 2;
-            break;
-
-        case kptTable:
-            ns = "tbl";
-            len = 3;
-            break;
-
-        case kptIndex:
-            ns = "idx";
-            len = 3;
-            break;
-
-        default:
-            return false;
-        }
-
-        rc = KDBVMakeSubPath ( self -> dir, path, sizeof path, ns, len, name, args );
-        if ( rc == 0 )
-        {
-            switch ( KDirectoryPathType ( self -> dir, path ) )
-            {
-            case kptFile:
-            case kptDir:
-            case kptFile | kptAlias:
-            case kptDir | kptAlias:
-                return true;
-            }
-        }
-    }
-    return false;
-}
-
-LIB_EXPORT bool CC KDatabaseExists ( const KDatabase *self, uint32_t type, const char *name, ... )
-{
-    bool exists;
-
-    va_list args;
-    va_start ( args, name );
-
-    exists = KDatabaseVExists ( self, type, name, args );
-
-    va_end ( args );
-
-    return exists;
-}
-
-
-/* IsAlias
- *  returns true if object name is an alias
- *  returns path to fundamental name if it was aliased
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptDatabase, kptTable and kptIndex
- *
- *  "resolved" [ OUT ] and "rsize" [ IN ] - optional output buffer
- *  for fundamenta object name if "alias" is not a fundamental name, 
- *
- *  "name" [ IN ] - NUL terminated object name
- */
-LIB_EXPORT bool CC KDatabaseIsAlias ( const KDatabase *self, uint32_t type,
-    char *resolved, size_t rsize, const char *name )
-{
-    if ( self != NULL && name != NULL && name [ 0 ] != 0 )
-    {
-        rc_t rc;
-        uint32_t len;
-        const char *ns;
-        char path [ 256 ];
-
-        switch ( type )
-        {
-        case kptDatabase:
-            ns = "db";
-            len = 2;
-            break;
-
-        case kptTable:
-            ns = "tbl";
-            len = 3;
-            break;
-
-        case kptIndex:
-            ns = "idx";
-            len = 3;
-            break;
-
-        default:
-            return false;
-        }
-
-        rc = KDBMakeSubPath ( self -> dir, path, sizeof path, ns, len, name );
-        if ( rc == 0 )
-        {
-            switch ( KDirectoryPathType ( self -> dir, path ) )
-            {
-            case kptFile | kptAlias:
-            case kptDir | kptAlias:
-                if ( resolved != NULL && rsize != 0 )
-                {
-                    const KDirectory *sub;
-                    rc = KDirectoryOpenDirRead ( self -> dir, & sub, false, ns );
-                    * resolved = 0;
-                    if ( rc != 0 )
-                        PLOGERR ( klogWarn, ( klogWarn, rc, "failed to open subdirectory '$(sub)'", "sub=%s", ns ) );
-                    else
-                    {
-                        rc = KDirectoryResolveAlias ( sub, false, resolved, rsize, name );
-                        KDirectoryRelease ( sub );
-                        if ( rc != 0 )
-                            PLOGERR ( klogWarn, ( klogWarn, rc, "failed to resolve alias '$(alias)'", "alias=%s", name ) );
-                    }
-                }
-                return true;
-            }
-        }
-    }
-
-    if ( resolved != NULL && rsize != 0 )
-        * resolved = 0;
-
-    return false;
-}
-
-
-/* Writable
- *  returns 0 if object is writable
- *  or a reason why if not
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptDatabase, kptTable and kptIndex
- *
- *  "path" [ IN ] - NUL terminated path
- */
-LIB_EXPORT rc_t CC KDatabaseVWritable ( const KDatabase *self, uint32_t type, const char *name, va_list args )
-{
-    /* TBD */
-    return -1;
-}
-
-LIB_EXPORT rc_t CC KDatabaseWritable ( const KDatabase *self, uint32_t type, const char *name, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, name );
-
-    rc = KDatabaseVWritable ( self, type, name, args );
-
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* OpenManager
- *  duplicate reference to manager
- *  NB - returned reference must be released
- */
-LIB_EXPORT rc_t CC KDatabaseOpenManagerRead ( const KDatabase *self, const KDBManager **mgr )
-{
-    rc_t rc;
-
-    if ( mgr == NULL )
-        rc = RC ( rcDB, rcDatabase, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcDatabase, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = KDBManagerAddRef ( self -> mgr );
-            if ( rc == 0 )
-            {
-                * mgr = self -> mgr;
-                return 0;
-            }
-        }
-
-        * mgr = NULL;
-    }
-
-    return rc;
-}
-
-
-/* OpenParent
- *  duplicate reference to parent database
- *  NB - returned reference must be released
- */
-LIB_EXPORT rc_t CC KDatabaseOpenParentRead ( const KDatabase *self, const KDatabase **par )
-{
-    rc_t rc;
-
-    if ( par == NULL )
-        rc = RC ( rcDB, rcDatabase, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcDatabase, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = KDatabaseAddRef ( self -> dad );
-            if ( rc == 0 )
-            {
-                * par = self -> dad;
-                return 0;
-            }
-        }
-
-        * par = NULL;
-    }
-
-    return rc;
-}
-
-
-/* GetDirectory
- *  access the directory in use
- */
-LIB_EXPORT rc_t CC KDatabaseOpenDirectoryRead ( const KDatabase *self, const KDirectory **dir )
-{
-    rc_t rc;
-
-    if ( dir == NULL )
-        rc = RC ( rcDB, rcDatabase, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcDatabase, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            * dir = self -> dir;
-            return KDirectoryAddRef ( * dir );
-        }
-
-        * dir = NULL;
-    }
-
-    return rc;
-}
-
-
-/* ModDate
- *  get modification date
- */
-LIB_EXPORT rc_t CC KDatabaseModDate ( const KDatabase *self, KTime_t *mtime )
-{
-    rc_t rc;
-
-    if ( mtime == NULL )
-        rc = RC ( rcDB, rcDatabase, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcDatabase, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            /* HACK ALERT - there needs to be a proper way to record modification times */
-            const KDirectory *dir = self -> dir;
-
-            /* this only tells the last time the table was locked,
-               which may be close to the last time it was modified */
-            rc = KDirectoryDate ( dir, mtime, "lock" );
-            if ( rc == 0 )
-                return 0;
-
-            /* get directory timestamp */
-            rc = KDirectoryDate ( dir, mtime, "." );
-            if ( rc == 0 )
-                return 0;
-        }
-
-        * mtime = 0;
-    }
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * KNameList
- */
-
-/* List
- *  create database listings
- */
-struct FilterData
-{
-    const KDBManager * mgr;
-    int type;
-};
-
-static
-bool CC KDatabaseListFilter ( const KDirectory *dir, const char *name, void *data_ )
-{
-    struct FilterData * data = data_;
-    return ( KDBOpenPathTypeRead ( data->mgr, dir, name, NULL, data->type, NULL, false ) == 0 );
-}
-
-LIB_EXPORT rc_t CC KDatabaseListDB ( const KDatabase *self, KNamelist **names )
-{
-    if ( self != NULL )
-    {
-        struct FilterData data;
-        data.mgr = self->mgr;
-        data.type = kptDatabase;
-
-        return KDirectoryVList ( self -> dir,
-            names, KDatabaseListFilter, &data, "db", NULL );
-    }
-
-    if ( names != NULL )
-        * names = NULL;
-
-    return RC ( rcDB, rcDatabase, rcListing, rcSelf, rcNull );
-}
-
-LIB_EXPORT rc_t CC KDatabaseListTbl ( struct KDatabase const *self, KNamelist **names )
-{
-    if ( self != NULL )
-    {
-        struct FilterData data;
-        data.mgr = self->mgr;
-        data.type = kptTable;
-
-        return KDirectoryVList ( self -> dir,
-            names, KDatabaseListFilter, &data, "tbl", NULL );
-    }
-
-    if ( names != NULL )
-        * names = NULL;
-
-    return RC ( rcDB, rcDatabase, rcListing, rcSelf, rcNull );
-}
-
-LIB_EXPORT rc_t CC KDatabaseListIdx ( struct KDatabase const *self, KNamelist **names )
-{
-    if ( self != NULL )
-    {
-        struct FilterData data;
-        data.mgr = self->mgr;
-        data.type = kptIndex;
-
-        return KDirectoryVList ( self -> dir,
-            names, KDatabaseListFilter, &data, "idx", NULL );
-    }
-
-    if ( names != NULL )
-        * names = NULL;
-
-    return RC ( rcDB, rcDatabase, rcListing, rcSelf, rcNull );
-}
diff --git a/libs/kdb/dbcc-cmn.c b/libs/kdb/dbcc-cmn.c
deleted file mode 100644
index 09d287c..0000000
--- a/libs/kdb/dbcc-cmn.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- *============================================================================
- *
- */
-
-#include <kdb/extern.h>
-
-#include <kfs/directory.h>
-#include <kfs/file.h>
-#include <kfs/md5.h>
-
-#include "cc-priv.h"
-#include <os-native.h>
-
-#include <stdio.h> /* for sprintf */
-#include <string.h>
-
-static
-rc_t FileCheckMD5(const KDirectory *dir, const char name[], const uint8_t digest[])
-{
-    rc_t rc;
-    const KFile *fp;
-    const KFile *mds;
-    uint64_t pos;
-    size_t nr;
-    char buf[4096];
-    
-    rc = KDirectoryOpenFileRead(dir, &fp, name);
-    if (rc)
-        return rc;
-    rc = KFileMakeMD5Read(&mds, fp, digest);
-    if (rc) {
-        KFileRelease(fp);
-        return rc;
-    }
-    for (pos = 0; ; ) {
-        rc = KFileRead(mds, pos, buf, sizeof(buf), &nr);
-        if (rc || nr == 0)
-            break;
-        pos += nr;
-    }
-    KFileRelease(mds);
-
-    return rc;
-}
-
-rc_t DirectoryCheckMD5(const KDirectory *dir, const char name[],
-                       CCReportInfoBlock *nfo,
-                       CCReportFunc report, void *ctx)
-{
-    rc_t rc;
-    rc_t rc2 = 0;
-    const KFile *kf;
-    const KMD5SumFmt *sum;
-    uint32_t i;
-    uint32_t n;
-    uint8_t digest[16];
-    char pathbuf[4096];
-    char mesg[1024];
-    
-    mesg[0] = '\0';
-    
-    nfo->type = ccrpt_Done;
-    nfo->info.done.mesg = mesg;
-    
-    rc = KDirectoryOpenFileRead(dir, &kf, name);
-    if (rc) {
-        snprintf(mesg, sizeof(mesg), "MD5 file '%s' could not be opened", name);
-        nfo->info.done.rc = rc;
-        return report(nfo, ctx);
-    }
-    rc = KMD5SumFmtMakeRead(&sum, kf);
-    if (rc) {
-        KFileRelease(kf);
-        snprintf(mesg, sizeof(mesg), "MD5 file '%s' could not be read", name);
-        nfo->info.done.rc = rc;
-        return report(nfo, ctx);
-    }
-    rc = KMD5SumFmtCount(sum, &n);
-    if (rc)
-        return rc;
-    for (i = 0; i != n; ++i) {
-        char *path = pathbuf;
-        rc = KMD5SumFmtGet(sum, i, pathbuf, sizeof(pathbuf), digest, NULL);
-        if (rc)
-            break;
-
-        /* catch case where skey.md5 contains full path */
-        if ( path [ 0 ] == '/' )
-        {
-            size_t sz = strlen ( path );
-            if ( sz >= 5 && strcmp ( & path [ sz - 5 ], "/skey" ) == 0 )
-                path = "skey";
-        }
-
-        rc = FileCheckMD5(dir, path, digest);
-        if (rc2 == 0)
-            rc2 = rc;
-        nfo->type = ccrpt_MD5;
-        nfo->info.MD5.rc = rc;
-        nfo->info.MD5.file = path;
-        rc = report(nfo, ctx);
-        if ( rc != 0 )
-            break;
-    }
-    KMD5SumFmtRelease(sum);
-    if (rc)
-        return rc;
-    
-    nfo->type = ccrpt_Done;
-    if (rc2) {
-        nfo->info.done.mesg = "failed md5 validation";
-        nfo->info.done.rc = rc2;
-    }
-    else {
-        nfo->info.done.mesg = "md5 ok";
-        nfo->info.done.rc = 0;
-    }
-    return report(nfo, ctx);
-}
diff --git a/libs/kdb/dbmgr-cmn.c b/libs/kdb/dbmgr-cmn.c
deleted file mode 100644
index fd95b66..0000000
--- a/libs/kdb/dbmgr-cmn.c
+++ /dev/null
@@ -1,485 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#define TRACK_REFERENCES 0
-
-#include <kdb/extern.h>
-#include "libkdb.vers.h"
-
-#define KONST const
-#include "dbmgr-priv.h"
-#include "kdb-priv.h"
-#undef KONST
-
-#include <vfs/manager.h>
-#include <kfs/directory.h>
-#include <klib/symbol.h>
-#include <klib/checksum.h>
-#include <klib/rc.h>
-#include <kproc/lock.h>
-#include <sysalloc.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-
-/*--------------------------------------------------------------------------
- * KDBManager
- *  handle to library
- */
-
-
-/* Whack
- */
-static
-rc_t KDBManagerWhack ( KDBManager *self )
-{
-    rc_t rc;
-
-    KRefcountWhack ( & self -> refcount, "KDBManager" );
-
-    /* everything should be closed */
-    assert ( self -> open_objs . root == NULL );
-
-    rc = KRWLockRelease ( self -> open_objs_lock );
-
-    rc = VFSManagerRelease ( self -> vfsmgr );
-
-    rc = KDirectoryRelease ( self -> wd );
-    if ( rc == 0 )
-    {
-        free ( self );
-        return 0;
-    }
-
-    KRefcountInit ( & self -> refcount, 1, "KDBManager", "whack", "kmgr" );
-    return rc;
-}
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-LIB_EXPORT rc_t CC KDBManagerAddRef ( const KDBManager *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KDBManager" ) )
-        {
-        case krefLimit:
-            return RC ( rcDB, rcMgr, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KDBManagerRelease ( const KDBManager *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KDBManager" ) )
-        {
-        case krefWhack:
-            return KDBManagerWhack ( ( KDBManager* ) self );
-        case krefNegative:
-            return RC ( rcDB, rcMgr, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/* Attach
- * Sever
- */
-KDBManager* KDBManagerAttach ( const KDBManager *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAddDep ( & self -> refcount, "KDBManager" ) )
-        {
-        case krefLimit:
-            return NULL;
-        }
-    }
-    return ( KDBManager* ) self;
-}
-
-rc_t KDBManagerSever ( const KDBManager *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDropDep ( & self -> refcount, "KDBManager" ) )
-        {
-        case krefWhack:
-            return KDBManagerWhack ( ( KDBManager* ) self );
-        case krefNegative:
-            return RC ( rcDB, rcMgr, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/* Make - PRIVATE
- *
- *  "wd" [ IN, NULL OKAY ] - optional working directory for
- *  accessing the file system. mgr will attach its own reference.
- */
-rc_t KDBManagerMake ( KDBManager **mgrp, const KDirectory *wd, const char *op,
-    VFSManager *vmanager )
-{
-    rc_t rc;
-
-    if ( mgrp == NULL )
-        rc = RC ( rcDB, rcMgr, rcConstructing, rcParam, rcNull );
-    else
-    {
-        KDBManager *mgr = malloc ( sizeof * mgr );
-        if ( mgr == NULL )
-            rc = RC ( rcDB, rcMgr, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            memset ( mgr, 0, sizeof * mgr );
-            mgr -> wd = wd;
-            if ( wd != NULL )
-                rc = KDirectoryAddRef ( wd );
-            else
-                rc = KDirectoryNativeDir ( ( KDirectory** ) & mgr -> wd );
-
-            if ( rc == 0 )
-            {
-                if (vmanager == NULL) {
-                    rc = VFSManagerMake ( & mgr -> vfsmgr );
-                }
-                else {
-                    rc = VFSManagerAddRef ( vmanager );
-                    if (rc == 0) {
-                        mgr -> vfsmgr = vmanager;
-                    }
-                }
-
-                if ( rc == 0 )
-                {
-                    rc = KRWLockMake ( & mgr -> open_objs_lock );
-
-                    if ( rc == 0 )
-                    {
-                        CRC32Init ();
-                        
-                        BSTreeInit ( & mgr -> open_objs );
-                        
-                        KRefcountInit ( & mgr -> refcount, 1, "KDBManager", op, "kmgr" );
-                        
-                        * mgrp = mgr;
-                        return 0;
-                    }
-
-                    VFSManagerRelease ( mgr -> vfsmgr );
-                }
-
-                KDirectoryRelease ( mgr -> wd );
-            }
-
-            free ( mgr );
-        }
-
-        * mgrp = NULL;
-    }
-
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC KDBManagerGetVFSManager ( const KDBManager *self,
-    const struct VFSManager **vmanager )
-{
-    if (self == NULL) {
-        return RC ( rcDB, rcMgr, rcAccessing, rcSelf, rcNull );
-    }
-    else if (vmanager == NULL) {
-        return RC ( rcDB, rcMgr, rcAccessing, rcParam, rcNull );
-    }
-    else {
-        rc_t rc = VFSManagerAddRef(self -> vfsmgr);
-        if (rc == 0) {
-            * vmanager = self -> vfsmgr;
-        }
-        else {
-            * vmanager = NULL;
-        }
-        return rc;
-    }
-}
-
-
-/* Version
- *  returns the library version
- */
-LIB_EXPORT rc_t CC KDBManagerVersion ( const KDBManager *self, uint32_t *version )
-{
-    if ( version == NULL )
-        return RC ( rcDB, rcMgr, rcAccessing, rcParam, rcNull );
-    if ( self == NULL )
-        return RC ( rcDB, rcMgr, rcAccessing, rcSelf, rcNull );
-
-    * version = LIBKDB_VERS;
-    return 0;
-}
-
-
-/* Exists
- *  returns true if requested object exists
- *
- *  "requested" [ IN ] - a KDBPathType
- *
- *  "path" [ IN ] - NUL terminated path
- */
-LIB_EXPORT bool CC KDBManagerVExists ( const KDBManager *self, uint32_t requested, const char *name, va_list args )
-{
-    int type;
-
-    type = KDBManagerVPathType (self, name, args);
-    switch ( type )
-    {
-    case kptDatabase:
-    case kptTable:
-    case kptIndex:
-    case kptColumn:
-    case kptMetadata:
-        break;
-    case kptPrereleaseTbl:
-        type = kptTable;
-        break;
-    default:
-        return false;
-    }
-    return requested == ( uint32_t ) type;
-}
-
-bool KDBManagerExists ( const KDBManager *self, uint32_t type, const char *name, ... )
-{
-    bool exists;
-
-    va_list args;
-    va_start ( args, name );
-
-    exists = KDBManagerVExists ( self, type, name, args );
-
-    va_end ( args );
-
-    return exists;
-}
-
-
-/* Writable
- *  returns 0 if object is writable
- *  or a reason why if not
- *
- *  "path" [ IN ] - NUL terminated path
- */
-
-/* TBD - should be in this file */
-
-/* CheckOpen
- */
-rc_t KDBManagerCheckOpen ( const KDBManager * self, const char *path )
-{
-    /* try to find the open object by path */
-    KSymbol *sym = KDBManagerOpenObjectFind ( self, path );
-
-    /* if not open, return no error */
-    if ( sym == NULL )
-        return 0;
-
-    /* put together an appropriate response */
-    switch ( sym -> type )
-    {
-    case kptDatabase:
-        return RC ( rcDB, rcMgr, rcAccessing, rcDatabase, rcBusy );
-    case kptTable:
-        return RC ( rcDB, rcMgr, rcAccessing, rcTable, rcBusy );
-    case kptColumn:
-        return RC ( rcDB, rcMgr, rcAccessing, rcColumn, rcBusy );
-    case kptIndex:
-        return RC ( rcDB, rcMgr, rcAccessing, rcIndex, rcBusy );
-    case kptMetadata:
-        return RC ( rcDB, rcMgr, rcAccessing, rcMetadata, rcBusy );
-    case kptPrereleaseTbl:
-        return RC ( rcDB, rcMgr, rcAccessing, rcTable, rcBusy );
-    default:
-        break;
-    }
-
-    return RC ( rcDB, rcMgr, rcAccessing, rcUnknown, rcBusy );
-}
-
-
-
-/* OpenObjectFind
- *  return a pointer to the openobject with path
- */
-static
-KSymbol *KDBManagerOpenObjectFindInt ( const KDBManager * self, String *s )
-{
-    KSymbol *sym = NULL;
-    rc_t rc = KRWLockAcquireShared ( self -> open_objs_lock );
-    if ( rc == 0 )
-    {
-        sym = ( KSymbol* ) BSTreeFind ( & self -> open_objs, s, KSymbolCmp );
-        KRWLockUnlock ( self -> open_objs_lock );
-    }
-    return sym;
-}
-
-KSymbol *KDBManagerOpenObjectFind ( const KDBManager * self, const char * path )
-{
-    String s;
-    StringInitCString ( & s, path );
-    return KDBManagerOpenObjectFindInt ( self, & s );
-}
-
-
-/* OpenObjectBusy
- *  Is this path to an object in the OpenObjects list?
- */
-bool KDBManagerOpenObjectBusy ( const KDBManager *self, const char *path )
-{
-    return KDBManagerOpenObjectFind ( self, path ) != NULL;
-}
-
-
-/* OpenObjectAdd
- *  Put an object in to the open objects list
- */
-rc_t KDBManagerOpenObjectAdd ( KDBManager *self, KSymbol *obj )
-{
-    KSymbol *exists;
-    rc_t rc = KRWLockAcquireExcl ( self -> open_objs_lock );
-    if ( rc == 0 )
-    {
-        rc = BSTreeInsertUnique ( & self -> open_objs,
-            & obj -> n, ( BSTNode** ) & exists, KSymbolSort );
-
-        KRWLockUnlock ( self -> open_objs_lock );
-
-        if ( rc != 0 )
-        {
-            switch ( exists -> type )
-            {
-            case kptDatabase:
-                rc = RC ( rcDB, rcMgr, rcInserting, rcDatabase, rcBusy );
-                break;
-            case kptTable:
-            case kptPrereleaseTbl:
-                rc = RC ( rcDB, rcMgr, rcInserting, rcTable, rcBusy );
-                break;
-            case kptColumn:
-                rc = RC ( rcDB, rcMgr, rcInserting, rcColumn, rcBusy );
-                break;
-            case kptIndex:
-                rc = RC ( rcDB, rcMgr, rcInserting, rcIndex, rcBusy );
-                break;
-            case kptMetadata:
-                rc = RC ( rcDB, rcMgr, rcInserting, rcMetadata, rcBusy );
-                break;
-            default:
-                rc = RC ( rcDB, rcMgr, rcInserting, rcUnknown, rcBusy );
-            }
-        }
-    }
-    return rc;
-}
-
-
-/* OpenDelete
- *  Take an object out of the open objects list
- */
-rc_t KDBManagerOpenObjectDelete ( KDBManager *self, KSymbol *obj )
-{
-    rc_t rc = 0;
-    if ( obj != NULL )
-    {
-        rc = KRWLockAcquireExcl ( self -> open_objs_lock );
-        if ( rc == 0 )
-        {
-            /* we can expect that the only valid reason for
-               "obj" not being unlinked is that it was not in
-               the tree. other reasons would be that "obj" was
-               corrupt, but in any event, it's not in the tree */
-            if ( ! BSTreeUnlink ( & self -> open_objs, & obj -> n ) )
-
-                /* to be truly weird, we could tell what kind of node
-                   it was that we didn't find */
-                rc = RC ( rcDB, rcMgr, rcRemoving, rcNode, rcNotFound );
-
-            KRWLockUnlock ( self -> open_objs_lock );
-        }
-    }
-
-    return rc;
-}
-
-
-/* ModDate
- *  return a modification timestamp for table
- */
-LIB_EXPORT rc_t CC KDBManagerVGetTableModDate ( const KDBManager *self,
-    KTime_t *mtime, const char *path, va_list args )
-{
-    rc_t rc;
-
-    if ( mtime == NULL )
-        rc = RC ( rcDB, rcMgr, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self != NULL )
-            return KDBVGetPathModDate ( self -> wd, mtime, path, args );
-
-        rc = RC ( rcDB, rcMgr, rcAccessing, rcSelf, rcNull );
-        * mtime = 0;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDBManagerGetTableModDate ( const KDBManager *self,
-    KTime_t *mtime, const char *path, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, path );
-    rc = KDBManagerVGetTableModDate ( self, mtime, path, args );
-    va_end ( args );
-
-    return rc;
-}
diff --git a/libs/kdb/dbmgr-priv.h b/libs/kdb/dbmgr-priv.h
deleted file mode 100644
index 37c526b..0000000
--- a/libs/kdb/dbmgr-priv.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_dbmgr_priv_
-#define _h_dbmgr_priv_
-
-#ifndef _h_kdb_manager_
-#include <kdb/manager.h>
-#endif
-
-#ifndef _h_klib_container_
-#include <klib/container.h>
-#endif
-
-#ifndef _h_klib_refcount_
-#include <klib/refcount.h>
-#endif
-
-#ifndef KONST
-#define KONST
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KRWLock;
-struct KSymbol;
-struct KDirectory;
-struct VFSManager;
-
-/*--------------------------------------------------------------------------
- * KDBManager
- *  handle to library
- */
-struct KDBManager
-{
-    /* root directory */
-    struct KDirectory KONST *wd;
-
-    /* open objects */
-    struct KRWLock *open_objs_lock;
-    BSTree open_objs;
-
-    /* open references */
-    KRefcount refcount;
-
-    /* other managers needed by the KDB manager */
-    struct VFSManager * vfsmgr;
-};
-
-
-/* Make - PRIVATE
- */
-rc_t KDBManagerMake ( KDBManager **mgrp, struct KDirectory const *wd,
-    const char *op, struct VFSManager *vmanager );
-
-/* Attach
- * Sever
- */
-#if 1
-KDBManager *KDBManagerAttach ( const KDBManager *self );
-rc_t KDBManagerSever ( const KDBManager *self );
-#else
-KDBManager *KDBManagerAttach ( const KDBManager *self, struct KSymbol *sym );
-rc_t KDBManagerSever ( const KDBManager *self, struct KSymbol *sym );
-#endif
-
-/* CheckOpen
- *  tests if object is open and returns an error code
- *  of 0 if not, or <target>, rcBusy if so, where
- *  <target> is generated from object type.
- */
-rc_t KDBManagerCheckOpen ( const KDBManager *self, const char *path );
-
-/* OpenObjectBusy
- *   Does this path reference an object already open?
- */
-bool KDBManagerOpenObjectBusy ( const KDBManager *self, const char *path );
-
-/* OpenObjectFind
- *   return a reference to an object with this "symbol" - path
- */
-struct KSymbol *KDBManagerOpenObjectFind ( const KDBManager *self, const char *path );
-
-/* OpenObjectAdd
- *   Put this symbol in the list of open objects
- */
-rc_t KDBManagerOpenObjectAdd ( KDBManager *self, struct KSymbol *obj );
-
-/* OpenObjectDelete
- *   remove this symbol in the list of open objects
- */
-rc_t KDBManagerOpenObjectDelete ( KDBManager *self, struct KSymbol *obj );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_dbmgr_priv_ */
diff --git a/libs/kdb/dbmgr.c b/libs/kdb/dbmgr.c
deleted file mode 100644
index 90ac480..0000000
--- a/libs/kdb/dbmgr.c
+++ /dev/null
@@ -1,420 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#define TRACK_REFERENCES 0
-
-#include <kdb/extern.h>
-
-#include <kdb/kdb-priv.h> /* KDBManagerMakeReadWithVFSManager */
-
-#include "libkdb.vers.h"
-
-#include <vfs/manager.h>
-#include <vfs/resolver.h>
-#include <vfs/path.h>
-#include <vfs/path-priv.h>
-#include <kfs/directory.h>
-
-#define KONST const
-#include "dbmgr-priv.h"
-#include "kdb-priv.h"
-#include "kdbfmt-priv.h"
-#include <klib/checksum.h>
-#include <klib/rc.h>
-#undef KONST
-
-#include <klib/text.h>
-
-#include <sysalloc.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <assert.h>
-
-
-
-/*--------------------------------------------------------------------------
- * KDBManager
- *  handle to library
- */
-
-
-/* MakeRead
- * MakeReadWithVFSManager
- *  create library handle for specific use
- *  NB - only one of the functions will be implemented
- *
- *  "wd" [ IN, NULL OKAY ] - optional working directory for
- *  accessing the file system. mgr will attach its own reference.
- */
-LIB_EXPORT rc_t CC KDBManagerMakeRead ( const KDBManager **mgrp, const KDirectory *wd )
-{
-    return KDBManagerMakeReadWithVFSManager(mgrp, wd, NULL);
-}
-
-LIB_EXPORT rc_t CC KDBManagerMakeReadWithVFSManager ( const KDBManager **mgrp,
-    const KDirectory *wd, struct VFSManager *vmanager )
-{
-    return KDBManagerMake ( ( KDBManager** ) mgrp, wd, "make-read", vmanager );
-}
-
-/*
- * Resolve using manager, possibly against this directory, using or not uri
- * accession resolution of those dangerous formatted path thingies
- *
-
-
-
- * 1. If naked accession or uri accession resolve to local, 
-
-
- * self                         = a kdbmanager
- * disable_accession_resolution = turn off VResolver usage for accessions
- *                                read versus create/upate 
- * resolved+path                = a vpath created based on text path
- * fmt                          = our scary interface that is 'sprintf'ish
- * args                         = goes with the fmt
- *
- * NOTE: as usual a path with a '%' becomes broken at unsuspected times
- */
-rc_t KDBManagerResolveVPathInt (const KDBManager * self, 
-                                bool disable_accession_resolution,
-                                VPath ** resolved_path, 
-                                const VPath * path)
-{
-    uint32_t flags;
-
-    assert (self != NULL);
-    assert (resolved_path != NULL);
-    assert (path != NULL);
-
-    flags = disable_accession_resolution
-        ? vfsmgr_rflag_no_acc
-        : vfsmgr_rflag_kdb_acc;
-
-    return VFSManagerResolvePath (self->vfsmgr, 
-                                  flags,
-                                  path, resolved_path);
-}
-
-
-rc_t KDBManagerVResolveVPath (const KDBManager * self, 
-                                bool disable_accession_resolution,
-                                VPath ** resolved_path, 
-                                const VPath * path)
-{
-    return KDBManagerResolveVPathInt (self, disable_accession_resolution,
-                                      resolved_path, path);
-}
-
-
-rc_t KDBManagerVResolvePath (const KDBManager * self, 
-                             bool disable_accession_resolution,
-                             VPath ** resolved_path, 
-                             const char * fmt, va_list args)
-{
-    VPath * p;
-    rc_t rc;
-
-    if (resolved_path == NULL)
-        return RC (rcDB, rcMgr, rcResolving, rcParam, rcNull);
-
-    *resolved_path = NULL;
-
-    if (self == NULL)
-        return RC (rcDB, rcMgr, rcResolving, rcSelf, rcNull);
-
-    if ((fmt == NULL) || (fmt[0] == '\0'))
-        return RC (rcDB, rcMgr, rcResolving, rcParam, rcNull);
-
-    rc = VFSManagerVMakePath ( self -> vfsmgr, &p, fmt, args);
-    if (rc == 0)
-    {
-        rc = KDBManagerVResolveVPath (self, disable_accession_resolution,
-                                      resolved_path, p);
-        VPathRelease (p);
-    }
-    return rc;
-}
-
-rc_t KDBManagerVResolvePathRelativeDir (const KDBManager * self, const KDirectory * dir,
-                                        bool disable_accession_resolution,
-                                        VPath ** resolved_path, 
-                                        const char * fmt, va_list args)
-{
-    VPath * p;
-    rc_t rc;
-
-    if (resolved_path == NULL)
-        return RC (rcDB, rcMgr, rcResolving, rcParam, rcNull);
-
-    *resolved_path = NULL;
-
-    if (self == NULL)
-        return RC (rcDB, rcMgr, rcResolving, rcSelf, rcNull);
-
-    if ((fmt == NULL) || (fmt[0] == '\0'))
-        return RC (rcDB, rcMgr, rcResolving, rcParam, rcNull);
-
-    rc = VFSManagerVMakePath ( self -> vfsmgr, &p, fmt, args);
-    if (rc == 0)
-    {
-        rc = KDBManagerVResolveVPath (self, disable_accession_resolution,
-                                      resolved_path, p);
-        VPathRelease (p);
-    }
-    return rc;
-}
-
-
-rc_t KDBManagerResolvePathRelativeDir (const KDBManager * self,
-                                       const KDirectory * dir,
-                                       bool disable_accession_resolution,
-                                       VPath ** resolved_path, const char * fmt, ...)
-{
-    va_list args;
-    rc_t rc;
-
-    va_start (args, fmt);
-
-    rc = KDBManagerVResolvePathRelativeDir (self, dir, 
-                                            disable_accession_resolution,
-                                            resolved_path, fmt, args);
-    va_end (args);
-    return rc;
-}
-
-
-
-/* KDBHdrValidate
- *  validates that a header sports a supported byte order
- *  and that the version is within range
- */
-rc_t KDBHdrValidate ( const KDBHdr *hdr, size_t size,
-    uint32_t min_vers, uint32_t max_vers )
-{
-    assert ( hdr != NULL );
-
-    if ( size < sizeof * hdr )
-        return RC ( rcDB, rcHeader, rcValidating, rcData, rcCorrupt );
-
-    if ( hdr -> endian != eByteOrderTag )
-    {
-        if ( hdr -> endian == eByteOrderReverse )
-            return RC ( rcDB, rcHeader, rcValidating, rcByteOrder, rcIncorrect );
-        return RC ( rcDB, rcHeader, rcValidating, rcData, rcCorrupt );
-    }
-
-    if ( hdr -> version < min_vers || hdr -> version > max_vers )
-        return RC ( rcDB, rcHeader, rcValidating, rcHeader, rcBadVersion );
-
-    return 0;
-}
-
-
-
-/* Writable
- *  returns 0 if object is writable
- *  or a reason why if not
- *
- *  "path" [ IN ] - NUL terminated path
- */
-LIB_EXPORT rc_t CC KDBManagerVWritable ( const KDBManager *self, const char * path, va_list args )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcDB, rcMgr, rcAccessing, rcSelf, rcNull );
-    else
-    {
-        char dbpath [ 4096 ];
-
-        /* get full path to object */
-        rc = KDirectoryVResolvePath ( self -> wd, true, dbpath, sizeof dbpath, path, args );
-        if ( rc == 0 )
-        {
-            int type = KDBPathType ( self -> wd, NULL, path ) & ~ kptAlias;
-            switch ( type )
-            {
-            case kptDatabase:
-            case kptTable:
-            case kptColumn:
-            case kptIndex:
-                rc = KDBWritable ( self -> wd, path );
-                break;
-            case kptNotFound:
-                rc = RC ( rcDB, rcMgr, rcAccessing, rcPath, rcNotFound );
-                break;
-            case kptBadPath:
-                rc = RC ( rcDB, rcMgr, rcAccessing, rcPath, rcInvalid );
-                break;
-            default:
-                rc = RC ( rcDB, rcMgr, rcAccessing, rcPath, rcIncorrect );
-            }
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDBManagerWritable ( const KDBManager *self, const char * path, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, path );
-
-    rc = KDBManagerVWritable ( self, path, args );
-
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* RunPeriodicTasks
- *  executes periodic tasks, such as cache flushing
- */
-LIB_EXPORT rc_t CC KDBManagerRunPeriodicTasks ( const KDBManager *self )
-{
-    if ( self == NULL )
-        return RC ( rcDB, rcMgr, rcExecuting, rcSelf, rcNull );
-
-    return 0;
-}
-
-
-/* PathType
- *  check the path type of an object/directory path.
- *  this is an extension of the KDirectoryPathType and will return
- *  the KDirectory values if a path type is not specifically a
- *  kdb object
- */
-LIB_EXPORT int CC KDBManagerPathTypeVP ( const KDBManager * self, const VPath * path )
-{
-    VPath * rpath;
-    int path_type;
-    rc_t rc;
-
-    path_type = kptBadPath;
-    if ((self != NULL) && (path != NULL))
-    {
-        /*
-         * resolve the possible relative path or accession into
-         * a final path we can open directly
-         */
-        rc = KDBManagerResolveVPathInt (self, false, &rpath, path);
-        if (rc == 0)
-        {
-            const KDirectory * dir;
-
-            /*
-             * Most KDBPathType values are based on 'directories'
-             * so try to open the resolved path as a directory
-             */
-            rc = VFSManagerOpenDirectoryReadDecrypt (self->vfsmgr, &dir, rpath);
-            if (rc == 0)
-            {
-                path_type = KDBPathTypeDir (dir, kptDir, NULL, ".");
-                KDirectoryRelease (dir);
-            }
-            /*
-             * If we couldn't open the path as a directory we 'might'
-             * have a KDB idx but we will only try that for a limited
-             * set of uri schemes.
-             */
-            else
-            {
-#if 1
-                if ( VPathIsFSCompatible ( rpath ) )
-                {
-                    char buffer [ 4096 ];
-                    rc = VPathReadPath ( rpath, buffer, sizeof buffer, NULL );
-                    if ( rc == 0 )
-                        path_type = KDBPathType ( self -> wd, false, buffer );
-                }
-#else
-                VPUri_t t;
-
-                rc = VPathGetScheme_t (rpath, &t);
-                if (rc == 0)
-                {
-                    switch (t)
-                    {
-                    default:
-                        break;
-                    case vpuri_ncbi_vfs:
-                    case vpuri_file:
-                    case vpuri_none:
-                    {
-                        char b [4 * 1024];
-                        size_t z;
-                        rc = VPathReadPath (path, b, sizeof b, &z);
-                        if (rc == 0)
-                            path_type = KDBPathType (self->wd, false, b);
-                        break;
-                    }}
-                }
-#endif
-            }
-            VPathRelease (rpath);
-        }
-    }
-    return path_type;
-}
-
-
-LIB_EXPORT int CC KDBManagerVPathType ( const KDBManager * self, const char *path, va_list args )
-{
-    int path_type = kptBadPath;
-
-    if ((self != NULL) && (path != NULL))
-    {
-        VPath * vp;
-        rc_t rc;
-
-        rc = VFSManagerVMakePath ( self -> vfsmgr, &vp, path, args);
-        if (rc == 0)
-        {
-            path_type = KDBManagerPathTypeVP (self, vp);
-            VPathRelease (vp);
-        }
-    }
-    return path_type;
-}
-
-
-LIB_EXPORT int CC KDBManagerPathType ( const KDBManager * self, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-
-    rc = KDBManagerVPathType ( self, path, args );
-
-    va_end (args);
-    return rc;
-}
diff --git a/libs/kdb/idstats-priv.h b/libs/kdb/idstats-priv.h
deleted file mode 100644
index cae6809..0000000
--- a/libs/kdb/idstats-priv.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_idstats_priv_
-#define _h_idstats_priv_
-
-#ifndef _h_klib_container_
-#include <klib/container.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KIdStats
- *  maintains statistics about id mappings
- */
-typedef struct KIdStats KIdStats;
-struct KIdStats
-{
-    int64_t i_min_id, x_max_id;
-    uint64_t num_entries;
-    uint64_t num_ids;
-    uint64_t num_holes;
-    BSTree ids;
-};
-
-
-/* Init
- *  initialize the object
- */
-void KIdStatsInit ( KIdStats *s );
-
-/* Whack
- *  tear down the object
- */
-void KIdStatsWhack ( KIdStats *self );
-
-/* Insert
- *  add an entry representing 1 or more consecutive ids
- */
-rc_t KIdStatsInsert ( KIdStats *self, int64_t id, uint64_t count );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_idstats_priv_ */
diff --git a/libs/kdb/idstats.c b/libs/kdb/idstats.c
deleted file mode 100644
index e37b872..0000000
--- a/libs/kdb/idstats.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kdb/extern.h>
-
-#include "idstats-priv.h"
-
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * KIdStatsNode
- */
-typedef struct KIdStatsNode KIdStatsNode;
-struct KIdStatsNode
-{
-    BSTNode n;
-    int64_t i_left, x_right;
-};
-
-
-/* Init
- */
-static
-void KIdStatsNodeInit ( KIdStatsNode *node, int64_t id, uint64_t count )
-{
-    if ( node != NULL )
-    {
-        node -> i_left = id;
-        node -> x_right = id + count;
-    }
-}
-
-
-/* Make
- */
-static
-KIdStatsNode *KIdStatsNodeMake ( int64_t id, uint64_t count )
-{
-    KIdStatsNode *node = malloc ( sizeof * node );
-    KIdStatsNodeInit ( node, id, count );
-    return node;
-}
-
-/* Whack
- */
-static
-void CC KIdStatsNodeWhack ( BSTNode *n, void *ignore )
-{
-    free ( n );
-}
-
-/* Cmp
- * Sort
- */
-static
-int CC KIdStatsNodeCmp ( const void *item, const BSTNode *n )
-{
-    const KIdStatsNode *a = item;
-    const KIdStatsNode *b = ( const KIdStatsNode* ) n;
-
-    if ( a -> x_right < b -> i_left )
-        return -1;
-    if ( a -> i_left > b -> x_right )
-        return 1;
-    return 0;
-}
-
-static
-int CC KIdStatsNodeSort ( const BSTNode *item, const BSTNode *n )
-{
-    const KIdStatsNode *a = ( const KIdStatsNode* ) item;
-    const KIdStatsNode *b = ( const KIdStatsNode* ) n;
-
-    if ( a -> x_right < b -> i_left )
-        return -1;
-    if ( a -> i_left > b -> x_right )
-        return 1;
-    return 0;
-}
-
-/*--------------------------------------------------------------------------
- * KIdStats
- *  maintains statistics about text index mappings
- */
-
-/* Init
- *  initialize the object
- */
-void KIdStatsInit ( KIdStats *s )
-{
-    if ( s != NULL )
-        memset ( s, 0, sizeof * s );
-}
-
-/* Whack
- *  tear down the object
- */
-void KIdStatsWhack ( KIdStats *self )
-{
-    if ( self != NULL )
-    {
-        BSTreeWhack ( & self -> ids, KIdStatsNodeWhack, NULL );
-        BSTreeInit ( & self -> ids );
-    }
-}
-
-/* Insert
- *  add an entry representing 1 or more consecutive ids
- */
-rc_t KIdStatsInsert ( KIdStats *self, int64_t id, uint64_t count )
-{
-    rc_t rc;
-    KIdStatsNode *node, *existing;
-
-    /* could be an assert - but here we go */
-    if ( self == NULL )
-        return RC ( rcDB, rcIndex, rcValidating, rcParam, rcNull );
-
-    /* if this is not the first entry */
-    if ( self -> num_entries != 0 )
-    {
-        KIdStatsNode item;
-        KIdStatsNodeInit ( & item, id, count );
-        existing = ( KIdStatsNode* ) BSTreeFind ( & self -> ids, & item, KIdStatsNodeCmp );
-        if ( existing != NULL )
-        {
-            /* min/max the range */
-            if ( id < self -> i_min_id )
-                self -> i_min_id = id;
-            if ( id + count > self -> x_max_id )
-                self -> x_max_id = id + count;
-            ++ self -> num_entries;
-
-            /* merge this insert with the returned node */
-            if ( existing -> i_left > item . i_left )
-            {
-                self -> num_ids += existing -> i_left - item . i_left;
-                existing -> i_left = item . i_left;
-
-                /* merge node toward left */
-                for ( node = ( KIdStatsNode* ) BSTNodePrev ( & existing -> n );
-                      node != NULL;
-                      node = ( KIdStatsNode* ) BSTNodePrev ( & existing -> n ) )
-                {
-                    /* exit loop if no intersection */
-                    if ( existing -> i_left > node -> x_right )
-                        break;
-
-                    /* a hole will be closed */
-                    assert ( self -> num_holes > 0 );
-                    -- self -> num_holes;
-
-                    /* remove overlaps from count and extend "existing" */
-                    if ( existing -> i_left <= node -> i_left )
-                        self -> num_ids -= node -> x_right - node -> i_left;
-                    else
-                    {
-                        self -> num_ids -= node -> x_right - existing -> i_left;
-                        existing -> i_left = node -> i_left;
-                    }
-
-                    /* drop old node */
-                    BSTreeUnlink ( & self -> ids, & node -> n );
-                    KIdStatsNodeWhack ( & node -> n, NULL );
-                }
-            }
-
-            /* now merge right edge */
-            if ( item . x_right > existing -> x_right )
-            {
-                self -> num_ids += item . x_right - existing -> x_right;
-                existing -> x_right = item . x_right;
-
-                /* merge node toward right */
-                for ( node = ( KIdStatsNode* ) BSTNodeNext ( & existing -> n );
-                      node != NULL;
-                      node = ( KIdStatsNode* ) BSTNodeNext ( & existing -> n ) )
-                {
-                    /* exit loop if no intersection */
-                    if ( existing -> x_right < node -> i_left )
-                        break;
-
-                    /* a hole will be closed */
-                    assert ( self -> num_holes > 0 );
-                    -- self -> num_holes;
-
-                    /* remove overlaps from count and extend "existing" */
-                    if ( existing -> x_right >= node -> x_right )
-                        self -> num_ids -= node -> x_right - node -> i_left;
-                    else
-                    {
-                        self -> num_ids -= existing -> x_right - node -> i_left;
-                        existing -> x_right = node -> x_right;
-                    }
-
-                    /* drop old node */
-                    BSTreeUnlink ( & self -> ids, & node -> n );
-                    KIdStatsNodeWhack ( & node -> n, NULL );
-                }
-            }
-
-            return 0;
-        }
-    }
-
-    /* create the node */
-    node = KIdStatsNodeMake ( id, count );
-    if ( node == NULL )
-        return RC ( rcDB, rcIndex, rcValidating, rcMemory, rcExhausted );
-
-    /* insert it and be certain there are no collisions */
-    rc = BSTreeInsertUnique ( & self -> ids, & node -> n,
-        ( BSTNode** ) & existing, KIdStatsNodeSort );
-
-    if ( rc != 0 )
-        KIdStatsNodeWhack ( & node -> n, NULL );
-    else if ( self -> num_entries == 0 )
-    {
-        /* initial insert */
-        self -> i_min_id = id;
-        self -> x_max_id = id + count;
-        self -> num_entries = 1;
-        self -> num_ids = count;
-    }
-    else
-    {
-        /* min/max the range */
-        if ( id < self -> i_min_id )
-            self -> i_min_id = id;
-        if ( id + count > self -> x_max_id )
-            self -> x_max_id = id + count;
-        ++ self -> num_entries;
-        self -> num_ids += count;
-
-        /* the insert represents a hole */
-        ++ self -> num_holes;
-    }
-
-    return rc;
-}
diff --git a/libs/kdb/idxblk-priv.h b/libs/kdb/idxblk-priv.h
deleted file mode 100644
index 71fc191..0000000
--- a/libs/kdb/idxblk-priv.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_idxblk_priv_
-#define _h_idxblk_priv_
-
-#ifndef _h_colfmt_priv_
-#include "colfmt-priv.h"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KColConstBlockMap
- *  maps an index or page section of block index
- */
-typedef struct KColConstBlockMap KColConstBlockMap;
-struct KColConstBlockMap
-{
-    /* types 1-3 have a header section */
-    union
-    {
-        /* for assignment and manipulation */
-        const void *p;
-        const char *c;
-
-        /* type 1 has a constant range/size */
-        const uint32_t *span;
-
-        /* type 2 has a predictable id/pos */
-        const uint64_t *first;
-
-        /* type 3 has a starting page and constant size */
-        const struct
-        {
-            uint64_t pg;
-            uint32_t sz;
-        } *pred;
-
-        /* for rewriting columns */
-        uint32_t *last;
-
-    } h;
-
-    /* types 0 and 1 have explicit id/pos, where id is ordered */
-    const uint64_t *d;
-
-    /* types 0 and 2 have explicit range/size */
-    const uint32_t *s;
-};
-
-
-/*--------------------------------------------------------------------------
- * KColIdxBlock
- *  level 2 index reading block
- *
- *  each index block has two sections
- */
-typedef struct KColIdxBlock KColIdxBlock;
-struct KColIdxBlock
-{
-    /* function for locating index */
-    int ( * find ) ( const KColIdxBlock *self,
-        const KColBlockLoc *bloc, uint32_t count,
-        int64_t id, int64_t *first, uint32_t *span );
-
-    /* function for locating blob */
-    void ( * get ) ( const KColIdxBlock *self,
-        const KColBlockLoc *bloc, uint32_t count,
-        uint32_t idx, uint64_t *pos, uint32_t *sz );
-
-    /* index section map */
-    KColConstBlockMap id;
-
-    /* page locator section map */
-    KColConstBlockMap pg;
-};
-
-/* Init
- */
-rc_t KColIdxBlockInit ( KColIdxBlock *self,
-    const KColBlockLoc *bloc, size_t orig,
-    const void *block, size_t block_size, bool bswap );
-
-/* Find
- *  find zero-based index of entry into block
- *  that satisfies request
- *  returns -1 if not found
- */
-int KColIdxBlockFind ( const KColIdxBlock *self,
-    const KColBlockLoc *bloc, uint32_t count,
-    int64_t id, int64_t *first, uint32_t *span );
-#define KColIdxBlockFind( self, bloc, count, id, first, span ) \
-    ( * ( self ) -> find ) ( self, bloc, count, id, first, span )
-
-/* Get
- *  get blob location information
- */
-void KColIdxBlockGet ( const KColIdxBlock *self,
-    const KColBlockLoc *bloc, uint32_t count,
-    uint32_t idx, uint64_t *pg, uint32_t *sz );
-#define KColIdxBlockGet( self, bloc, count, idx, pg, sz ) \
-    ( * ( self ) -> get ) ( self, bloc, count, idx, pg, sz )
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_idxblk_priv_ */
diff --git a/libs/kdb/idxblk.c b/libs/kdb/idxblk.c
deleted file mode 100644
index e5c14cf..0000000
--- a/libs/kdb/idxblk.c
+++ /dev/null
@@ -1,695 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kdb/extern.h>
-#include "idxblk-priv.h"
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <byteswap.h>
-
-
-/*--------------------------------------------------------------------------
- * KColConstBlockMap
- *  maps an index or page section of block index
- */
-static
-void KColConstBlockMapSwap ( KColConstBlockMap *self, uint32_t count, int type )
-{
-    uint32_t i;
-
-    switch ( type )
-    {
-    case btypeUniform:
-        ( ( uint32_t* ) self -> h . span ) [ 0 ] = bswap_32 ( self -> h . span [ 0 ] );
-        break;
-    case btypeMagnitude:
-        ( ( uint64_t* ) self -> h . first ) [ 0 ] = bswap_64 ( self -> h . first [ 0 ] );
-        break;
-    case btypePredictable:
-        * ( uint64_t* ) & ( self -> h . pred -> pg ) = bswap_64 ( self -> h . pred -> pg );
-        * ( uint32_t* ) & ( self -> h . pred -> sz ) = bswap_32 ( self -> h . pred -> sz );
-        break;
-    }
-
-    switch ( type )
-    {
-    case btypeRandom:
-    case btypeUniform:
-        for ( i = 0; i < count; ++ i )
-            ( ( uint64_t* ) self -> d ) [ i ] = bswap_64 ( self -> d [ i ] );
-        break;
-    }
-
-    switch ( type )
-    {
-    case btypeRandom:
-    case btypeMagnitude:
-        for ( i = 0; i < count; ++ i )
-            ( ( uint32_t* ) self -> s ) [ i ] = bswap_32 ( self -> s [ i ] );
-        break;
-    }
-}
-
-
-/*--------------------------------------------------------------------------
- * KColIdxBlock
- *  level 2 index reading block
- *
- *  each index block has two sections
- */
-
-/* Find
- */
-static
-int KColIdxBlockFind0 ( const KColIdxBlock *self,
-    const KColBlockLoc *bloc, uint32_t count,
-    int64_t id, int64_t *first, uint32_t *span )
-{
-    unsigned int left = 0;
-    unsigned int right = count;
-
-    do
-    {
-        unsigned int i = ( left + right ) >> 1;
-        int64_t start_id = ( int64_t ) self -> id . d [ i ];
-        if ( start_id == id )
-        {
-            * first = start_id;
-            * span = self -> id . s [ i ];
-            return ( int ) i;
-        }
-        if ( start_id > id )
-            right = i;
-        else
-        {
-            if ( start_id + self -> id . s [ i ] > id )
-            {
-                * span = self -> id . s [ i ];
-                * first = start_id;
-                return ( int ) i;
-            }
-
-            left = i + 1;
-        }
-    }
-    while ( left < right );
-
-    return -1;
-}
-
-static
-int KColIdxBlockFind1 ( const KColIdxBlock *self,
-    const KColBlockLoc *bloc, uint32_t count,
-    int64_t id, int64_t *first, uint32_t *span )
-{
-    unsigned int left = 0;
-    unsigned int right = count;
-    unsigned int range = self -> id . h . span [ 0 ];
-
-    do
-    {
-        unsigned int i = ( left + right ) >> 1;
-        int64_t start_id = ( int64_t ) self -> id . d [ i ];
-        if ( start_id == id )
-        {
-            * first = start_id;
-            * span = range;
-            return ( int ) i;
-        }
-        if ( start_id > id )
-            right = i;
-        else
-        {
-            if ( start_id + range > id )
-            {
-                * first = start_id;
-                * span = range;
-                return ( int ) i;
-            }
-
-            left = i + 1;
-        }
-    }
-    while ( left < right );
-
-    return -1;
-}
-
-static
-int KColIdxBlockFind2 ( const KColIdxBlock *self,
-    const KColBlockLoc *bloc, uint32_t count,
-    int64_t id, int64_t *first, uint32_t *span )
-{
-    /* special case for in-core image
-       the length of an entry is determined
-       by looking at the start of next entry
-       with the last entry having its length
-       stored in header */
-
-    unsigned int left, right;
-
-    /* examine last entry first, since it's the special case */
-    int64_t start_id = ( int64_t ) self -> id . d [ count - 1 ];
-    if ( start_id <= id )
-    {
-        if ( start_id == id ||
-             start_id + self -> id . h . span [ 0 ] > id )
-        {
-            * span = self -> id . h . span [ 0 ];
-            * first = start_id;
-            return ( int ) ( count - 1 );
-        }
-        return -1;
-    }
-
-    /* now perform normal binary search */
-    left = 0;
-    right = count - 1;
-    while ( left < right )
-    {
-        unsigned int i = ( left + right ) >> 1;
-        start_id = ( int64_t ) self -> id . d [ i ];
-        if ( start_id == id )
-        {
-            * first = start_id;
-            * span = ( uint32_t ) ( self -> id . d [ i + 1 ] - ( uint64_t ) start_id );
-            return ( int ) i;
-        }
-        if ( start_id > id )
-            right = i;
-        else
-        {
-            if ( self -> id . d [ i + 1 ] > (uint64_t)id )
-            {
-                * span = ( uint32_t ) ( self -> id . d [ i + 1 ] - ( uint64_t ) start_id );
-                * first = start_id;
-                return ( int ) i;
-            }
-
-            left = i + 1;
-        }
-    }
-
-    return -1;
-}
-
-static
-int KColIdxBlockFind3 ( const KColIdxBlock *self,
-    const KColBlockLoc *bloc, uint32_t count,
-    int64_t id, int64_t *first, uint32_t *span )
-{
-    int i;
-    unsigned int ids_per;
-
-    assert ( id >= bloc -> start_id );
-    assert ( id < bloc -> start_id + bloc -> id_range );
-    assert ( bloc -> id_range != 0 );
-
-    if ( bloc -> id_range == ( uint32_t ) count )
-    {
-        * first = id;
-        * span = 1;
-        return ( int ) ( id - bloc -> start_id );
-    }
-
-    assert ( count != 0 );
-    ids_per = bloc -> id_range / count;
-    assert ( ids_per * count == bloc -> id_range );
-
-    i = ( int ) ( ( id - bloc -> start_id ) / ids_per );
-    * first = bloc -> start_id + ( i * ids_per );
-    * span = ids_per;
-    return i;
-}
-
-static
-void KColIdxBlockGet0 ( const KColIdxBlock *self,
-    const KColBlockLoc *bloc, uint32_t count,
-    unsigned int idx, uint64_t *pg, uint32_t *sz )
-{
-    * pg = self -> pg . d [ idx ];
-    * sz = self -> pg . s [ idx ];
-}
-
-static
-void KColIdxBlockGet1 ( const KColIdxBlock *self,
-    const KColBlockLoc *bloc, uint32_t count,
-    unsigned int idx, uint64_t *pg, uint32_t *sz )
-{
-    * pg = self -> pg . d [ idx ];
-    * sz = self -> pg . h . span [ 0 ];
-}
-
-static
-void KColIdxBlockGet2 ( const KColIdxBlock *self,
-    const KColBlockLoc *bloc, uint32_t count,
-    unsigned int idx, uint64_t *pg, uint32_t *sz )
-{
-    if ( idx + 1 == count )
-    {
-        * pg = self -> pg . d [ idx ];
-        * sz = self -> pg . h . span [ 0 ];
-    }
-    else
-    {
-        * pg = self -> pg . d [ idx ];
-        * sz = ( uint32_t )
-            ( self -> pg . d [ idx + 1 ] - self -> pg . d [ idx ] );
-    }
-}
-
-static
-void KColIdxBlockGet3 ( const KColIdxBlock *self,
-    const KColBlockLoc *bloc, uint32_t count,
-    unsigned int idx, uint64_t *pg, uint32_t *sz )
-{
-    * sz = self -> pg . h . pred [ 0 ] . sz;
-    * pg = self -> pg . h . pred [ 0 ] . pg +
-        ( (uint64_t) self -> pg . h . pred [ 0 ] . sz * idx );
-}
-
-/* RewriteColumns
- *  convert btypeMagnitude columns to id/pg
- *  for best in-core representation
- */
-static
-void KColIdxBlockRewriteColumns ( KColIdxBlock *self, size_t size,
-    char *block, size_t block_size, int count,
-    int id_ssz, int id_adj, int pg_ssz, int pg_adj )
-{
-    int i;
-    uint64_t *d;
-    uint32_t last;
-
-    /* the blob size array is last */
-    if ( pg_adj != 0 )
-    {
-        assert ( pg_ssz != 0 );
-
-        d = ( uint64_t* ) ( block + size - pg_ssz - pg_adj );
-
-        /* save the last entry in size array */
-        last = self -> pg . s [ count - 1 ];
-
-        /* transfer sizes, shifted down by 1 slot */
-        for ( i = count; -- i > 0; )
-            d [ i ] = self -> pg . s [ i - 1 ];
-
-        /* set slot zero to be first pg */
-        d [ 0 ] = self -> pg . h . first [ 0 ];
-
-        /* integrate sizes */
-        for ( i = 1; i < count; ++ i )
-            d [ i ] += d [ i - 1 ];
-
-        /* store last size in header */
-        self -> pg . h . last [ 0 ] = last;
-
-        /* update columns */
-        self -> pg . d = d;
-        self -> pg . s = ( const uint32_t* ) d;
-
-        /* now convert to id/pg values */
-    }
-    else if ( pg_ssz != 0 )
-    {
-        /* pg size array trails column needing expansion */
-        uint32_t *s = ( uint32_t* ) ( block + size - pg_ssz );
-        for ( i = count; -- i >= 0; )
-            s [ i ] = self -> pg . s [ i ];
-        
-        self -> pg . d = ( const uint64_t* ) s;
-        self -> pg . s = s;
-    }
-
-    /* the index range array is either last
-       or next to last before size array
-       which, if there, was already moved */
-    if ( id_adj != 0 )
-    {
-        assert ( id_ssz != 0 );
-
-        d = ( uint64_t* ) ( block + size - pg_ssz - pg_adj - id_ssz - id_adj );
-
-        /* save last as above */
-        last = self -> id . s [ count - 1 ];
-
-        /* transfer shifted */
-        for ( i = count; -- i > 0; )
-            d [ i ] = self -> id . s [ i - 1 ];
-
-        /* set slot zero to first id */
-        d [ 0 ] = self -> id . h . first [ 0 ];
-
-        /* integrate spans */
-        for ( i = 1; i < count; ++ i )
-            d [ i ] += d [ i - 1 ];
-
-        /* store last span in header */
-        self -> id . h . last [ 0 ] = last;
-
-        /* update columns */
-        self -> id . d = d;
-        self -> id . s = ( const uint32_t* ) d;
-    }
-}
-
-/* Init
- */
-rc_t KColIdxBlockInit ( KColIdxBlock *self,
-    const KColBlockLoc *bloc, size_t orig,
-    const void *block, size_t block_size, bool bswap )
-{
-    int id_hsz, id_dsz, id_ssz, id_adj = 0;
-    int pg_hsz, pg_dsz, pg_ssz, pg_adj = 0;
-
-    int count = ( int ) orig;
-
-    switch ( bloc -> u . blk . id_type )
-    {
-    case btypeRandom:
-        self -> find = KColIdxBlockFind0;
-        id_hsz = 0;
-        id_dsz = 8;
-        id_ssz = 4;
-        break;
-    case btypeUniform:
-        self -> find = KColIdxBlockFind1;
-        id_hsz = 4;
-        id_dsz = 8;
-        id_ssz = 0;
-        break;
-    case btypeMagnitude:
-        self -> find = KColIdxBlockFind2;
-        id_hsz = 8;
-        id_dsz = 0;
-        id_ssz = 4;
-        id_adj = 4;
-        break;
-    case btypePredictable:
-    default: /* to quiet unused variable warnings */
-        self -> find = KColIdxBlockFind3;
-        id_hsz = 0;
-        id_dsz = 0;
-        id_ssz = 0;
-        break;
-    }
-
-    switch ( bloc -> u . blk . pg_type )
-    {
-    case btypeRandom:
-        self -> get = KColIdxBlockGet0;
-        pg_hsz = 0;
-        pg_dsz = 8;
-        pg_ssz = 4;
-
-        count -= id_hsz;
-        count /= id_dsz + id_ssz + 12;
-        break;
-
-    case btypeUniform:
-        self -> get = KColIdxBlockGet1;
-        pg_hsz = 4;
-        pg_dsz = 8;
-        pg_ssz = 0;
-
-        count -= id_hsz + 4;
-        count /= id_dsz + id_ssz + 8;
-        break;
-
-    case btypeMagnitude:
-        self -> get = KColIdxBlockGet2;
-        pg_hsz = 8;
-        pg_dsz = 0;
-        pg_ssz = 4;
-        pg_adj = 4;
-
-        count -= id_hsz + 8;
-        count /= id_dsz + id_ssz + 4;
-        break;
-
-    case btypePredictable:
-    default: /* to quiet unused variable warnings */
-        self -> get = KColIdxBlockGet3;
-        pg_hsz = 12;
-
-        if ( bloc -> u . blk . id_type == btypePredictable )
-        {
-            assert ( bloc -> u . blk . compressed == 0 );
-            count = ( int ) bloc -> u . blk . size;
-        }
-        else
-        {
-            assert ( id_dsz + id_ssz != 0 );
-
-            count -= id_hsz + pg_hsz;
-            count /= id_dsz + id_ssz;
-        }
-
-        pg_dsz = 0;
-        pg_ssz = 0;
-        break;
-    }
-
-    id_dsz *= count;
-    id_ssz *= count;
-    id_adj *= count;
-    pg_dsz *= count;
-    pg_ssz *= count;
-    pg_adj *= count;
-
-    /* TBD - check the optimized output on this...
-       some compilers aren't smart enough to recognize
-       that union members are not independent objects */
-    self -> id . h . p = block;
-    self -> pg . h . c = ( const char* ) block + id_hsz;
-/*  self -> pg . h . c = self -> id . h . c + id_hsz; */
-    self -> id . d = ( const uint64_t* )
-        ( self -> pg . h . c + pg_hsz );
-    self -> pg . d = ( const uint64_t* )
-        ( ( const char* ) self -> id . d + id_dsz );
-    self -> id . s = ( const uint32_t * )
-        ( ( const char* ) self -> pg . d + pg_dsz );
-    self -> pg . s = ( const uint32_t * )
-        ( ( const char* ) self -> id . s + id_ssz );
-
-    /* sanity check against block size */
-    if ( ( const char* ) block + orig != ( const char* ) self -> pg . s + pg_ssz )
-        return RC ( rcDB, rcIndex, rcReading, rcData, rcCorrupt );
-
-    /* byte-swap contents if needed */
-    if ( bswap )
-    {
-        KColConstBlockMapSwap ( & self -> id, count, bloc -> u . blk . id_type );
-        if ( self -> pg . h . p != self -> id . h . p )
-            KColConstBlockMapSwap ( & self -> pg, count, bloc -> u . blk . pg_type );
-    }
-
-    /* check for need to rewrite columns */
-    if ( id_adj + pg_adj != 0 )
-    {
-        size_t size = id_hsz + pg_hsz +
-            id_dsz + id_ssz + id_adj +
-            pg_dsz + pg_ssz + pg_adj;
-        
-        if ( size > block_size )
-            return RC ( rcDB, rcIndex, rcReading, rcBuffer, rcInsufficient );
-
-        assert ( id_adj == 0 || id_dsz == 0 );
-        assert ( pg_adj == 0 || pg_dsz == 0 );
-
-        KColIdxBlockRewriteColumns ( self, size,
-            ( char* ) block, block_size, count,
-            id_ssz, id_adj, pg_ssz, pg_adj );
-    }
-
-    return 0;
-}
-
-/* Find
- *  find zero-based index of entry into block
- *  that satisfies request
- *  returns -1 if not found
- */
-#ifndef KColIdxBlockFind
-LIB_EXPORT int CC KColIdxBlockFind ( const KColIdxBlock *self,
-    const KColBlockLoc *bloc, uint32_t count,
-    int64_t id, int64_t *first, uint32_t *span )
-{
-    ( * self -> find ) ( self, bloc, count, id, first, span );
-}
-#endif
-
-/* Get
- *  get blob location information
- */
-#ifndef KColIdxBlockGet
-LIB_EXPORT void CC KColIdxBlockGet ( const KColIdxBlock *self,
-    const KColBlockLoc *bloc, uint32_t count,
-    unsigned int idx, uint64_t *pg, uint32_t *sz )
-{
-    ( * self -> get ) ( self, bloc, count, idx, pg, sz );
-}
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KColBlockLoc
- */
-
-/* EntryCount
- *  returns the number of entries within a block
- *  uses the original size of the uncompressed block
- */
-uint32_t KColBlockLocEntryCount ( const KColBlockLoc *self, size_t *orig )
-{
-    uint32_t count;
-
-    /* when everything is predictable, the
-       block size is 12 while the entry count
-       is contained in self -> size */
-    if ( self -> u . blk . id_type == btypePredictable &&
-         self -> u . blk . pg_type == btypePredictable )
-    {
-        count = self -> u . blk . size;
-        * orig = 12;
-    }
-    else
-    {
-        int id_hsz, id_dsz, id_ssz;
-        int pg_hsz, pg_dsz, pg_ssz;
-
-        count = ( uint32_t ) * orig;
-
-        switch ( self -> u . blk . id_type )
-        {
-        case btypeRandom:
-            id_hsz = 0;
-            id_dsz = 8;
-            id_ssz = 4;
-            break;
-        case btypeUniform:
-            id_hsz = 4;
-            id_dsz = 8;
-            id_ssz = 0;
-            break;
-        case btypeMagnitude:
-            id_hsz = 8;
-            id_dsz = 0;
-            id_ssz = 4;
-            break;
-        case btypePredictable:
-        default: /* to quiet unused variable warnings */
-            id_hsz = 0;
-            id_dsz = 0;
-            id_ssz = 0;
-            break;
-        }
-
-        switch ( self -> u . blk . pg_type )
-        {
-        case btypeRandom:
-            pg_hsz = 0;
-            pg_dsz = 8;
-            pg_ssz = 4;
-            break;
-        case btypeUniform:
-            pg_hsz = 4;
-            pg_dsz = 8;
-            pg_ssz = 0;
-            break;
-        case btypeMagnitude:
-            pg_hsz = 8;
-            pg_dsz = 0;
-            pg_ssz = 4;
-            break;
-        case btypePredictable:
-        default: /* to quiet unused variable warnings */
-            pg_hsz = 12;
-            pg_dsz = 0;
-            pg_ssz = 0;
-            break;
-        }
-
-        assert ( id_dsz + id_ssz + pg_dsz + pg_ssz != 0 );
-
-        /* decompose size into number of entries */
-        count -= id_hsz + pg_hsz;
-        count /= id_dsz + id_ssz + pg_dsz + pg_ssz;
-    }
-
-    return count;
-}
-
-/* AllocSize
- *  returns a size for the block
- *  since a type 3 index ( range/size only ) is nice for storage
- *  but needs to be converted to id/pos for in-memory lookup
- */
-size_t KColBlockLocAllocSize ( const KColBlockLoc *self,
-    size_t orig, uint32_t count )
-{
-    size_t size;
-
-    /* when everything is predictable, the
-       pg information is stored within BlocLoc */
-    if ( self -> u . blk . id_type == btypePredictable &&
-         self -> u . blk . pg_type == btypePredictable )
-        size = 12;
-    else
-    {
-        /* there is something within the idx2 block */
-        size = 0;
-
-        /* if either index or page loc are magnitude only,
-           they'll need to be converted to id/pg when resident */
-        if ( self -> u . blk . id_type == btypeMagnitude )
-            size += 4;
-        if ( self -> u . blk . pg_type == btypeMagnitude )
-            size += 4;
-
-        /* if neither are magnitude only,
-           keep the original size */
-        if ( size == 0 )
-            size = orig;
-        else
-        {
-            /* otherwise, convert the single entry
-               size adjustment to whole block adjustment */
-            size *= count;
-
-            /* add this to the original size */
-            size += orig;
-        }
-    }
-
-    return size;
-}
diff --git a/libs/kdb/index-cmn.h b/libs/kdb/index-cmn.h
deleted file mode 100644
index ff2dc6f..0000000
--- a/libs/kdb/index-cmn.h
+++ /dev/null
@@ -1,286 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_index_cmn_
-#define _h_index_cmn_
-
-#ifndef _h_kdbfmt_priv_
-#include "kdbfmt-priv.h"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define KDBINDEXVERS 4
-#define V2FIND_RETURNS_SPAN 1
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KMMap;
-struct PTrie;
-struct BSTNode;
-struct PBSTNode;
-struct KIndex;
-
-
-
-/*--------------------------------------------------------------------------
- * KIndexFileHeader
- */
-
-/* v1, v2
- *  just normal simple kdb header
- */
-typedef struct KDBHdr KIndexFileHeader_v1, KIndexFileHeader_v2, KIndexFileHeader_v1_v2;
-
-/* v3, v4
- *  indicates type
- */
-typedef struct KIndexFileHeader_v3 KIndexFileHeader_v3, KIndexFileHeader_v4, KIndexFileHeader_v3_v4;
-struct KIndexFileHeader_v3
-{
-    KIndexFileHeader_v1_v2 h;
-    uint32_t index_type;
-    uint32_t reserved1;
-};
-
-
-/*--------------------------------------------------------------------------
- * V1
- *  version 1 of the trie index was hard-coded to enforce uniqueness of
- *  both the string, and a 32-bit id. furthermore, the id was unfortunately
- *  assumed to occupy a mostly contiguous space, such that the projection
- *  was always implemented as an array of ptrie node ids where the id was
- *  used to index the array.
- *
- *  the introduction of highly sparse ids led to deprecation of this
- *  implementation. see version 2 for further information.
- */
-
-
-/*--------------------------------------------------------------------------
- * KPTrieIndex_v1
- *  persisted keymap
- */
-typedef struct KPTrieIndex_v1 KPTrieIndex_v1;
-struct KPTrieIndex_v1
-{
-    struct KMMap const *mm;
-    struct PTrie *key2id;
-    const uint32_t *id2node;
-    uint32_t first;
-    uint32_t last;
-    bool byteswap;
-};
-
-/* initialize an index from file */
-rc_t KPTrieIndexInit_v1 ( KPTrieIndex_v1 *self, struct KMMap const *mm, bool byteswap );
-
-/* whackitywhack */
-void KPTrieIndexWhack_v1 ( KPTrieIndex_v1 *self );
-
-/* consistency check */
-rc_t KPTrieIndexCheckConsistency_v1 ( const KPTrieIndex_v1 *self,
-    int64_t *start_id, uint64_t *id_range, uint64_t *num_keys,
-    uint64_t *num_rows, uint64_t *num_holes,
-    struct KIndex const *outer, bool key2id, bool id2key );
-
-
-/*--------------------------------------------------------------------------
- * KTrieIndex_v1
- */
-typedef struct KTrieIndex_v1 KTrieIndex_v1;
-
-/* initialize an index from file - can be NULL */
-rc_t KTrieIndexOpen_v1 ( KTrieIndex_v1 *self, struct KMMap const *mm, bool byteswap );
-
-/* whack whack */
-void KTrieIndexWhack_v1 ( KTrieIndex_v1 *self );
-
-/* map key to id ( was Key2Id ) */
-rc_t KTrieIndexFind_v1 ( const KTrieIndex_v1 *self,
-    const char *key, uint32_t *id,
-    int ( CC * custom_cmp ) ( const void *item, struct PBSTNode const *n, void *data ),
-    void *data );
-
-/* projection index id to key-string ( was Id2Key ) */
-rc_t KTrieIndexProject_v1 ( const KTrieIndex_v1 *self,
-    uint32_t id, char *key_buff, size_t buff_size, size_t *actsize );
-
-/* consistency check */
-rc_t KTrieIndexCheckConsistency_v1 ( const KTrieIndex_v1 *self,
-    int64_t *start_id, uint64_t *id_range, uint64_t *num_keys,
-    uint64_t *num_rows, uint64_t *num_holes,
-    struct KIndex const *outer, bool key2id, bool id2key );
-
-
-/*--------------------------------------------------------------------------
- * V2
- *  version 2 of the trie index was introduced to handle sparse ids,
- *  and to recognize that ids may be 64 bits and/or negative.
- *
- *  v2 introduces strategy identifiers to handle various cases.
- *
- *  CONSTRAINTS
- *  - both key and id are unique ( version 1 )
- *  - key is not unique, but must map to a contiguous range of ids,
- *    while ids are unique ( the main use case for SRA )
- *
- *  INSERTION
- *  - ids are observed in increasing order
- *
- *  PROJECTION
- *  - id range is contiguous or nearly so ( can use single array )
- *  - id range is sparse
- *
- *  the implementation may be extended by adding new strategies,
- *  but the moment the implementation supports 1 to many mappings,
- *  inserted with ids in increasing order, and an unique constraint
- *  on the ids themselves.
- *
- *  the general case for v2 is "key -> id range", where "id range -> key"
- *  is via contiguous array if avg ( id range ) <= 2, and via sparse
- *  array otherwise.
- *
- *  for the key -> id mappings, this means that the in-core node
- *  either retains an id range ( when not using a projection index ),
- *  or it retains a start-id only, since its range can be determined
- *  from the projection index.
- *
- *  for id -> key mappings, the id is first converted to an ordinal, and
- *  the ordinal to a node. when ids are contiguous, id -> ordinal is simply
- *  derived by subtracting the initial start id. when sparse, an id -> ord
- *  array is used in a binary search to produce the ordinal.
- *
- *  ids are assumed to be 64 bit, stored as id - start id, and packed to
- *  a minimum number of bits to represent the id. ptrie node ids are still
- *  32-bit entities.
- */
-
-
-/*--------------------------------------------------------------------------
- * KPTrieIndex_v2
- *  persisted keymap
- */
-typedef struct KPTrieIndex_v2 KPTrieIndex_v2;
-struct KPTrieIndex_v2
-{
-    int64_t first, last, maxid;
-    struct KMMap const *mm;
-    struct PTrie *key2id;
-    const uint32_t *ord2node;
-    union
-    {
-        const uint8_t *v8;
-        const uint16_t *v16;
-        const uint32_t *v32;
-        const int64_t *v64;
-    } id2ord;
-    uint32_t count;
-    uint8_t variant;
-    uint8_t id_bits;
-    uint8_t span_bits;
-    uint8_t byteswap;
-};
-
-
-/* initialize an index from file */
-rc_t KPTrieIndexInit_v2 ( KPTrieIndex_v2 *self, struct KMMap const *mm, bool byteswap );
-rc_t KPTrieIndexInit_v3_v4 ( KPTrieIndex_v2 *self, struct KMMap const *mm, bool byteswap, bool ptorig );
-
-/* whackitywhack */
-void KPTrieIndexWhack_v2 ( KPTrieIndex_v2 *self );
-
-/* map a row id to ord */
-uint32_t KPTrieIndexID2Ord_v2 ( const KPTrieIndex_v2 *self, int64_t id );
-
-/* consistency check */
-rc_t KPTrieIndexCheckConsistency_v2 ( const KPTrieIndex_v2 *self,
-    int64_t *start_id, uint64_t *id_range, uint64_t *num_keys,
-    uint64_t *num_rows, uint64_t *num_holes,
-    struct KIndex const *outer, bool key2id, bool id2key, bool all_ids, bool convertFromV1 );
-
-
-/*--------------------------------------------------------------------------
- * KTrieIndex_v2
- */
-typedef struct KTrieIndex_v2 KTrieIndex_v2;
-
-/* initialize an index from file */
-rc_t KTrieIndexOpen_v2 ( KTrieIndex_v2 *self, struct KMMap const *mm, bool byteswap );
-
-/* whack whack */
-void KTrieIndexWhack_v2 ( KTrieIndex_v2 *self );
-
-/* map key to id range */
-rc_t KTrieIndexFind_v2 ( const KTrieIndex_v2 *self,
-    const char *key, int64_t *start_id,
-#if V2FIND_RETURNS_SPAN
-    uint32_t *span,
-#endif
-    int ( CC * custom_cmp ) ( const void *item, struct PBSTNode const *n, void *data ),
-    void * data,
-    bool convertFromV1);
-
-/* projection index id to key-string */
-#if V2FIND_RETURNS_SPAN
-rc_t KTrieIndexProject_v2 ( const KTrieIndex_v2 *self,
-    int64_t id, int64_t *start_id, uint32_t *span,
-    char *key_buff, size_t buff_size, size_t *actsize );
-#else
-rc_t KTrieIndexProject_v2 ( const KTrieIndex_v2 *self,
-    int64_t id, char *key_buff, size_t buff_size, size_t *actsize );
-#endif
-
-/* consistency check */
-rc_t KTrieIndexCheckConsistency_v2 ( const KTrieIndex_v2 *self,
-    int64_t *start_id, uint64_t *id_range, uint64_t *num_keys,
-    uint64_t *num_rows, uint64_t *num_holes,
-    struct KIndex const *outer, bool key2id, bool id2key, bool all_ids, bool convertFromV1 );
-
-
-/*--------------------------------------------------------------------------
- * KU64Index_v3
- */
-typedef struct KU64Index_v3 KU64Index_v3;
-
-rc_t KU64IndexOpen_v3 ( KU64Index_v3 *self, struct KMMap const *mm, bool byteswap );
-rc_t KU64IndexWhack_v3 ( KU64Index_v3 *self );
-
-rc_t KU64IndexFind_v3 ( const KU64Index_v3 *self, uint64_t offset,
-    uint64_t *key, uint64_t *key_size, int64_t *id, uint64_t *id_qty );
-
-rc_t KU64IndexFindAll_v3 ( const KU64Index_v3 *self, uint64_t offset, 
-    rc_t ( CC * f ) ( uint64_t key, uint64_t key_size, int64_t id, uint64_t id_qty, void* data ),
-    void* data );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_index_priv_ */
diff --git a/libs/kdb/index-priv.h b/libs/kdb/index-priv.h
deleted file mode 100644
index 41e2505..0000000
--- a/libs/kdb/index-priv.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_index_priv_
-#define _h_index_priv_
-
-#ifndef _h_index_cmn_
-#include "index-cmn.h"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KMMap;
-struct PBSTree;
-
-
-/*--------------------------------------------------------------------------
- * V1
- *  version 1 of the trie index was hard-coded to enforce uniqueness of
- *  both the string, and a 32-bit id. furthermore, the id was unfortunately
- *  assumed to occupy a mostly contiguous space, such that the projection
- *  was always implemented as an array of ptrie node ids where the id was
- *  used to index the array.
- *
- *  the introduction of highly sparse ids led to deprecation of this
- *  implementation. see version 2 for further information.
- */
-
-
-/*--------------------------------------------------------------------------
- * KTrieIndex_v1
- */
-struct KTrieIndex_v1
-{
-    KPTrieIndex_v1 pt;
-};
-
-
-/*--------------------------------------------------------------------------
- * V2
- *  version 2 of the trie index was introduced to handle sparse ids,
- *  and to recognize that ids may be 64 bits and/or negative.
- *
- *  v2 introduces strategy identifiers to handle various cases.
- *
- *  CONSTRAINTS
- *  - both key and id are unique ( version 1 )
- *  - key is not unique, but must map to a contiguous range of ids,
- *    while ids are unique ( the main use case for SRA )
- *
- *  INSERTION
- *  - ids are observed in increasing order
- *
- *  PROJECTION
- *  - id range is contiguous or nearly so ( can use single array )
- *  - id range is sparse
- *
- *  the implementation may be extended by adding new strategies,
- *  but the moment the implementation supports 1 to many mappings,
- *  inserted with ids in increasing order, and an unique constraint
- *  on the ids themselves.
- *
- *  the general case for v2 is "key -> id range", where "id range -> key"
- *  is via contiguous array if avg ( id range ) <= 2, and via sparse
- *  array otherwise.
- *
- *  for the key -> id mappings, this means that the in-core node
- *  either retains an id range ( when not using a projection index ),
- *  or it retains a start-id only, since its range can be determined
- *  from the projection index.
- *
- *  for id -> key mappings, the id is first converted to an ordinal, and
- *  the ordinal to a node. when ids are contiguous, id -> ordinal is simply
- *  derived by subtracting the initial start id. when sparse, an id -> ord
- *  array is used in a binary search to produce the ordinal.
- *
- *  ids are assumed to be 64 bit, stored as id - start id, and packed to
- *  a minimum number of bits to represent the id. ptrie node ids are still
- *  32-bit entities.
- */
-
-
-/*--------------------------------------------------------------------------
- * KTrieIndex_v2
- */
-struct KTrieIndex_v2
-{
-    KPTrieIndex_v2 pt;
-};
-
-
-/*--------------------------------------------------------------------------
- * KU64Index_v3
- */
-struct KU64Index_v3
-{
-    struct PBSTree *tree;
-    struct KMMap const *mm;
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_index_priv_ */
diff --git a/libs/kdb/index.c b/libs/kdb/index.c
deleted file mode 100644
index b4cd1f6..0000000
--- a/libs/kdb/index.c
+++ /dev/null
@@ -1,1006 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kdb/extern.h>
-
-#define KONST const
-#include "index-priv.h"
-#include "dbmgr-priv.h"
-#include "database-priv.h"
-#include "table-priv.h"
-#include "kdb-priv.h"
-#undef KONST
-
-#include <kdb/index.h>
-#include <kfs/file.h>
-#include <kfs/mmap.h>
-#include <klib/refcount.h>
-#include <klib/rc.h>
-#include <os-native.h>
-#include <sysalloc.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <byteswap.h>
-#include <assert.h>
-
-/*--------------------------------------------------------------------------
- * KIndex
- *  an object capable of mapping an object to integer oid
- */
-struct KIndex
-{
-    const KDBManager *mgr;
-    const KDatabase *db;
-    const KTable *tbl;
-    KRefcount refcount;
-    uint32_t vers;
-    union
-    {
-        KTrieIndex_v1 txt1;
-        KTrieIndex_v2 txt234;
-        KU64Index_v3  u64_3;
-    } u;
-    bool converted_from_v1;
-    uint8_t type;
-    char path [ 1 ];
-};
-
-
-/* Whack
- */
-static
-rc_t KIndexWhack ( KIndex *self )
-{
-    rc_t rc = 0;
-
-    KRefcountWhack ( & self -> refcount, "KIndex" );
-
-    /* release owner */
-    if ( self -> db != NULL )
-    {
-        rc = KDatabaseSever ( self -> db );
-        if ( rc == 0 )
-            self -> db = NULL;
-    }
-    else if ( self -> tbl != NULL )
-    {
-        rc = KTableSever ( self -> tbl );
-        if ( rc == 0 )
-            self -> tbl = NULL;
-    }
-
-    /* remove from mgr */
-    if ( rc == 0 )
-        rc = KDBManagerSever ( self -> mgr );
-    if ( rc == 0 )
-    {
-        self -> mgr = NULL;
-
-        /* complete */
-        rc = SILENT_RC ( rcDB, rcIndex, rcDestroying, rcIndex, rcBadVersion );
-
-        switch ( self -> type )
-        {
-        case kitText:
-        case kitText | kitProj:
-            switch ( self -> vers )
-            {
-            case 1:
-                KTrieIndexWhack_v1 ( & self -> u . txt1 );
-                rc = 0;
-                break;
-            case 2:
-            case 3:
-            case 4:
-                KTrieIndexWhack_v2 ( & self -> u . txt234 );
-                rc = 0;
-                break;
-            }
-            break;
-
-        case kitU64:
-            switch ( self -> vers )
-            {
-            case 3:
-            case 4:
-                rc = KU64IndexWhack_v3 ( & self -> u . u64_3 );
-                break;
-            }
-            break;
-
-        }
-
-        if ( rc == 0 )
-        {
-            free ( self );
-            return 0;
-        }
-    }
-
-    KRefcountInit ( & self -> refcount, 1, "KIndex", "whack", "kidx" );
-    return rc;
-}
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-LIB_EXPORT rc_t CC KIndexAddRef ( const KIndex *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KIndex" ) )
-        {
-        case krefLimit:
-            return RC ( rcDB, rcIndex, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KIndexRelease ( const KIndex *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KIndex" ) )
-        {
-        case krefWhack:
-            return KIndexWhack ( ( KIndex* ) self );
-        case krefNegative:
-            return RC ( rcDB, rcIndex, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/* Make
- */
-static
-rc_t KIndexMake ( KIndex **idxp, const char *path )
-{
-    rc_t rc;
-
-    if ( idxp == NULL )
-        rc = RC ( rcDB, rcIndex, rcCreating, rcParam, rcNull );
-    else
-    {
-        if ( path == NULL )
-            rc = RC ( rcDB, rcIndex, rcCreating, rcPath, rcNull );
-        else if ( path [ 0 ] == 0 )
-            rc = RC ( rcDB, rcIndex, rcCreating, rcPath, rcEmpty );
-        else
-        {
-            KIndex* idx = malloc ( sizeof *idx + strlen ( path ) );
-            if ( idx == NULL )
-                rc = RC ( rcDB, rcIndex, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                memset ( idx, 0, sizeof * idx );
-                KRefcountInit ( & idx -> refcount, 1, "KIndex", "make", path );
-                strcpy ( idx -> path, path );
-                * idxp = idx;
-                return 0;
-            }
-        }
-    }
-
-    return rc;
-}
-
-static
-rc_t KIndexAttach ( KIndex *self, const KMMap *mm, bool *byteswap )
-{
-    size_t size;
-    rc_t rc = KMMapSize ( mm, & size );
-    if ( rc == 0 )
-    {
-        const void *addr;
-        rc = KMMapAddrRead ( mm, & addr );
-        if ( rc == 0 )
-        {
-            union
-            {
-                KIndexFileHeader_v1 v1;
-                KIndexFileHeader_v2 v2;
-                KIndexFileHeader_v3 v3;
-            } hdrs;
-
-            const KDBHdr *hdr = addr;
-            const KIndexFileHeader_v3 *fh = addr;
-
-            * byteswap = false;
-            rc = KDBHdrValidate ( hdr, size, 1, KDBINDEXVERS );
-            if ( GetRCState ( rc ) == rcIncorrect && GetRCObject ( rc ) == rcByteOrder )
-            {
-                hdrs . v1 . endian = bswap_32 ( hdr -> endian );
-                hdrs . v1 . version = bswap_32 ( hdr -> version );
-                rc = KDBHdrValidate ( & hdrs . v1, size, 1, KDBINDEXVERS );
-                if ( rc == 0 )
-                {
-                    * byteswap = true;
-                    switch ( hdrs . v1 . version )
-                    {
-                    case 1:
-                        hdr = & hdrs . v1;
-                        break;
-                    case 2:
-                        hdr = & hdrs . v2;
-                        break;
-                    case 3:
-                    case 4:
-                        hdrs . v3 . index_type = bswap_32 ( fh -> index_type );
-                        hdrs . v3 . reserved1 = bswap_32 ( fh -> reserved1 );
-                        hdr = & hdrs . v3 . h;
-                        fh = & hdrs . v3;
-                        break;
-                    }
-                }
-            }
-            if ( rc == 0 )
-            {
-                self -> vers = hdr -> version;
-                switch ( hdr -> version )
-                {
-                case 1:
-#if KDBINDEXVERS != 1
-                    self -> converted_from_v1 = true;
-#endif
-                case 2:
-                    self -> type = kitText;
-                    break;
-                case 3:
-                case 4:
-                {
-                    self -> type = fh -> index_type;
-                    switch ( self -> type )
-                    {
-                    case kitText:
-                    case kitU64:
-                        break;
-                    default:
-                        rc = RC(rcDB, rcIndex, rcConstructing, rcIndex, rcUnrecognized);
-                    }
-                    break;
-                }
-                default:
-                    rc = RC ( rcDB, rcIndex, rcConstructing, rcIndex, rcBadVersion );
-                }
-            }
-        }
-    }
-    return rc;
-}
-
-static
-rc_t KIndexMakeRead ( KIndex **idxp,
-    const KDirectory *dir, const char *path )
-{
-    const KFile *f;
-    rc_t rc = KDirectoryVOpenFileRead ( dir, & f, path, NULL );
-    if ( rc == 0 )
-    {
-        const KMMap *mm;
-        rc = KMMapMakeRead ( & mm, f );
-        if ( rc == 0 )
-        {
-            rc = KIndexMake ( idxp, path );
-            if ( rc == 0 )
-            {
-                bool byteswap;
-                KIndex *idx = * idxp;
-                rc = KIndexAttach ( idx, mm, & byteswap );
-                if ( rc == 0 )
-                {
-                    rc = RC ( rcDB, rcIndex, rcConstructing, rcIndex, rcBadVersion );
-
-                    switch ( idx -> vers )
-                    {
-                    case 1:
-                        /* open using v1 code only if KDBINDEXVERS is 1
-                           if 2 or later, open as a v2 index */
-#if KDBINDEXVERS == 1
-                        rc = KTrieIndexOpen_v1 ( & idx -> u . txt1, mm );
-                        if ( rc == 0 )
-                        {
-                            if ( idx -> u . txt1 . pt . id2node != NULL )
-                                idx -> type = ( uint8_t ) ( kitText | kitProj );
-                            else
-                                idx -> type = ( uint8_t ) kitText;
-                        }
-                        break;
-#else
-                    case 2:
-                        idx -> vers = 3;
-                    case 3:
-                    case 4:
-                        switch ( idx -> type )
-                        {
-                            case kitText:
-                            case kitText | kitProj:
-                                /* will guess version in open */
-                                rc = KTrieIndexOpen_v2 ( & idx -> u . txt234, mm, byteswap );
-                                if( rc == 0 && idx -> u . txt234 . pt . ord2node != NULL )
-                                    idx -> type |= kitProj;
-                                break;
-
-                            case kitU64:
-                                rc = KU64IndexOpen_v3 ( & idx -> u . u64_3, mm, byteswap );
-                                break;
-                        }
-                        break;
-#endif
-                    }
-                }
-
-                if ( rc != 0 )
-                    KIndexWhack ( idx );
-            }
-
-            KMMapRelease ( mm );
-        }
-
-        KFileRelease ( f );
-    }
-    return rc;
-}
-
-
-/* OpenIndexRead
- * VOpenIndexRead
- *  open an index for read
- *
- *  "idx" [ OUT ] - return parameter for newly opened index
- *
- *  "name" [ IN ] - NUL terminated string in UTF-8 giving simple name of idx
- */
-static
-rc_t KDBManagerOpenIndexReadInt ( const KDBManager *self,
-    KIndex **idxp, const KDirectory *wd, const char *path )
-{
-    char idxpath [ 4096 ];
-    rc_t rc = KDirectoryVResolvePath ( wd, true,
-        idxpath, sizeof idxpath, path, NULL );
-    if ( rc == 0 )
-    {
-        KIndex *idx;
-
-        switch ( KDirectoryVPathType ( wd, idxpath, NULL ) )
-        {
-        case kptNotFound:
-            return RC ( rcDB, rcMgr, rcOpening, rcIndex, rcNotFound );
-        case kptBadPath:
-            return RC ( rcDB, rcMgr, rcOpening, rcPath, rcInvalid );
-        case kptFile:
-        case kptFile | kptAlias:
-            break;
-        default:
-            return RC ( rcDB, rcMgr, rcOpening, rcPath, rcIncorrect );
-        }
-
-        rc = KIndexMakeRead ( & idx, wd, idxpath );
-        if ( rc == 0 )
-        {
-            idx -> mgr = KDBManagerAttach ( self );
-            * idxp = idx;
-            return 0;
-        }
-    }
-    
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDatabaseOpenIndexRead ( struct KDatabase const *self,
-    const KIndex **idx, const char *name, ... )
-{
-    rc_t rc = 0;
-    va_list args;
-
-    va_start ( args, name );
-    rc = KDatabaseVOpenIndexRead ( self, idx, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDatabaseVOpenIndexRead ( const KDatabase *self,
-    const KIndex **idxp, const char *name, va_list args )
-{
-    rc_t rc = 0;
-    char path [ 256 ];
-
-    if ( idxp == NULL )
-        return RC ( rcDB, rcDatabase, rcOpening, rcParam, rcNull );
-
-    * idxp = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcDatabase, rcOpening, rcSelf, rcNull );
-
-    rc = KDBVMakeSubPath ( self -> dir,
-        path, sizeof path, "idx", 3, name, args );
-    if ( rc == 0 )
-    {
-        KIndex *idx;
-        rc = KDBManagerOpenIndexReadInt ( self -> mgr,
-            & idx, self -> dir, path );
-        if ( rc == 0 )
-        {
-            idx -> db = KDatabaseAttach ( self );
-            * idxp = idx;
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KTableOpenIndexRead ( struct KTable const *self,
-    const KIndex **idx, const char *name, ... )
-{
-    rc_t rc = 0;
-    va_list args;
-
-    va_start ( args, name );
-    rc = KTableVOpenIndexRead ( self, idx, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KTableVOpenIndexRead ( const KTable *self,
-    const KIndex **idxp, const char *name, va_list args )
-{
-    rc_t rc = 0;
-    char path [ 256 ];
-
-    if ( idxp == NULL )
-        return RC ( rcDB, rcTable, rcOpening, rcParam, rcNull );
-
-    * idxp = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcTable, rcOpening, rcSelf, rcNull );
-
-    if ( self -> prerelease )
-    {
-        int len;
-        if ( args == 0 )
-            len = snprintf ( path, sizeof path, name );
-        else
-            len = vsnprintf ( path, sizeof path, name, args );
-        if ( len < 0 || ( size_t ) len >= sizeof path )
-            return RC ( rcDB, rcTable, rcOpening, rcPath, rcExcessive );
-        rc = 0;
-    }
-    else
-    {
-        rc = KDBVMakeSubPath ( self -> dir,
-            path, sizeof path, "idx", 3, name, args );
-    }
-
-    if ( rc == 0 )
-    {
-        KIndex *idx;
-        rc = KDBManagerOpenIndexReadInt ( self -> mgr,
-            & idx, self -> dir, path );
-        if ( rc == 0 )
-        {
-            idx -> tbl = KTableAttach ( self );
-            * idxp = idx;
-        }
-    }
-    return rc;
-}
-
-
-/* Locked
- *  returns non-zero if locked
- */
-LIB_EXPORT bool CC KIndexLocked ( const KIndex *self )
-{
-    rc_t rc;
-    const KDirectory *dir;
-
-    if ( self == NULL )
-        return false;
-
-    assert ( self -> db != NULL || self -> tbl != NULL );
-    dir = ( self -> db != NULL ) ?
-        self -> db -> dir : self -> tbl -> dir;
-
-    rc = KDBWritable ( dir, self -> path );
-    return GetRCState ( rc ) == rcLocked;
-}
-
-
-/* Version
- *  returns the format version
- */
-LIB_EXPORT rc_t CC KIndexVersion ( const KIndex *self, uint32_t *version )
-{
-    if ( version == NULL )
-        return RC ( rcDB, rcIndex, rcAccessing, rcParam, rcNull );
-
-    if ( self == NULL )
-    {
-        * version = 0;
-        return RC ( rcDB, rcIndex, rcAccessing, rcSelf, rcNull );
-    }
-    
-    * version = self -> vers;
-    return 0;
-}
-
-
-/* Type
- *  returns the type of index
- */
-LIB_EXPORT rc_t CC KIndexType ( const KIndex *self, KIdxType *type )
-{
-    if ( type == NULL )
-        return RC ( rcDB, rcIndex, rcAccessing, rcParam, rcNull );
-
-    if ( self == NULL )
-    {
-        * type = ( KIdxType ) 0;
-        return RC ( rcDB, rcIndex, rcAccessing, rcSelf, rcNull );
-    }
-
-    * type = ( KIdxType ) self -> type;
-    return 0;
-}
-
-
-/* CheckConsistency
- *  run a consistency check on the open index
- *
- *  "level" [ IN ] - a measure of rigor of the exercise:
- *    0 is the lightest
- *    1 will test all id mappings
- *    2 will perform key->id retrievals
- *    3 will perform id->key retrievals if a projection index exists
- *
- *  "start_id" [ OUT, NULL OKAY ] - returns the first id in index
- *
- *  "id_range" [ OUT, NULL OKAY ] - returns the range of ids from first to last
- *
- *  "num_keys" [ OUT, NULL OKAY ] - returns the number of key entries
- *
- *  "num_rows" [ OUT, NULL OKAY ] - returns the number of key->id mappings
- *
- *  "num_holes" [ OUT, NULL OKAY ] - returns the number of holes in the mapped id range
- */
-LIB_EXPORT rc_t CC KIndexConsistencyCheck ( const KIndex *self, uint32_t level,
-    int64_t *start_id, uint64_t *id_range, uint64_t *num_keys,
-    uint64_t *num_rows, uint64_t *num_holes )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcDB, rcIndex, rcValidating, rcSelf, rcNull );
-    else
-    {
-        bool key2id, id2key, all_ids;
-        switch ( level )
-        {
-        case 0:
-            key2id = id2key = all_ids = false;
-            break;
-        case 1:
-            key2id = id2key = false;
-            all_ids = true;
-            break;
-        case 2:
-            key2id = id2key = true;
-            all_ids = false;
-            break;
-        default:
-            key2id = id2key = all_ids = true;
-        }
-
-        switch ( self -> type )
-        {
-        case kitText:
-            id2key = false;
-        case kitText | kitProj:
-            switch ( self -> vers )
-            {
-            case 1:
-                rc = KTrieIndexCheckConsistency_v1 ( & self -> u . txt1,
-                    start_id, id_range, num_keys, num_rows, num_holes,
-                    self, key2id, id2key );
-                break;
-            case 2:
-            case 3:
-            case 4:
-                rc = KTrieIndexCheckConsistency_v2 ( & self -> u . txt234,
-                    start_id, id_range, num_keys, num_rows, num_holes,
-                    self, key2id, id2key, all_ids, self -> converted_from_v1 );
-                break;
-            default:
-                return RC ( rcDB, rcIndex, rcValidating, rcIndex, rcBadVersion );
-            }
-            break;
-
-        default:
-            rc = RC ( rcDB, rcIndex, rcValidating, rcFunction, rcUnsupported );
-        }
-    }
-
-    return rc;
-}
-
-
-/* Find
- *  finds a single mapping from key
- */
-LIB_EXPORT rc_t CC KIndexFindText ( const KIndex *self, const char *key, int64_t *start_id, uint64_t *id_count,
-    int ( CC * custom_cmp ) ( const void *item, struct PBSTNode const *n, void *data ),
-    void *data )
-{
-    rc_t rc = 0;
-    uint32_t id32, span;
-
-    if ( id_count != NULL )
-        * id_count = 0;
-
-    if ( start_id == NULL )
-        return RC ( rcDB, rcIndex, rcSelecting, rcParam, rcNull );
-
-    * start_id = 0;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcIndex, rcSelecting, rcSelf, rcNull );
-
-    if ( key == NULL )
-        return RC ( rcDB, rcIndex, rcSelecting, rcString, rcNull );
-    if ( key [ 0 ] == 0 )
-        return RC ( rcDB, rcIndex, rcSelecting, rcString, rcEmpty );
-
-    span = 1;
-
-    switch ( self -> type )
-    {
-    case kitText:
-    case kitText | kitProj:
-        switch ( self -> vers )
-        {
-        case 1:
-            rc = KTrieIndexFind_v1 ( & self -> u . txt1, key, & id32, custom_cmp, data );
-            if ( rc == 0 )
-                * start_id = id32;
-            break;
-        case 2:
-        case 3:
-        case 4:
-#if V2FIND_RETURNS_SPAN
-            rc = KTrieIndexFind_v2 ( & self -> u . txt234, key, start_id, & span, custom_cmp, data, self -> converted_from_v1 );
-#else
-            rc = KTrieIndexFind_v2 ( & self -> u . txt234, key, start_id, custom_cmp, data, self -> converted_from_v1 );
-#endif
-            break;
-        default:
-            return RC ( rcDB, rcIndex, rcSelecting, rcIndex, rcBadVersion );
-        }
-        break;
-    default:
-        return RC ( rcDB, rcIndex, rcSelecting, rcNoObj, rcUnknown );
-    }
-
-    if ( id_count != NULL )
-        * id_count = span;
-    
-    return rc;
-}
-
-
-/* FindAll
- *  finds all mappings from key
- */
-LIB_EXPORT rc_t CC KIndexFindAllText ( const KIndex *self, const char *key,
-    rc_t ( CC * f ) ( int64_t id, uint64_t id_count, void *data ), void *data )
-{
-    rc_t rc = 0;
-    int64_t id64;
-    uint32_t id32, span;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcIndex, rcSelecting, rcSelf, rcNull );
-
-    if ( f == NULL )
-        return RC ( rcDB, rcIndex, rcSelecting, rcFunction, rcNull );
-
-    if ( key == NULL )
-        return RC ( rcDB, rcIndex, rcSelecting, rcString, rcNull );
-    if ( key [ 0 ] == 0 )
-        return RC ( rcDB, rcIndex, rcSelecting, rcString, rcEmpty );
-
-    span = 1;
-
-    switch ( self -> type )
-    {
-    case kitText:
-    case kitText | kitProj:
-        switch ( self -> vers )
-        {
-        case 1:
-            rc = KTrieIndexFind_v1 ( & self -> u . txt1, key, & id32, NULL, NULL );
-            if ( rc == 0 )
-                rc = ( * f ) ( id32, 1, data );
-            break;
-        case 2:
-        case 3:
-        case 4:
-#if V2FIND_RETURNS_SPAN
-            rc = KTrieIndexFind_v2 ( & self -> u . txt234, key, & id64, & span, NULL, NULL, self -> converted_from_v1 );
-#else
-            rc = KTrieIndexFind_v2 ( & self -> u . txt234, key, & id64, NULL, NULL, self -> converted_from_v1 );
-#endif
-            if ( rc == 0 )
-                rc = ( * f ) ( id64, span, data );
-            break;
-        default:
-            return RC ( rcDB, rcIndex, rcSelecting, rcIndex, rcBadVersion );
-        }
-        break;
-    default:
-        return RC ( rcDB, rcIndex, rcSelecting, rcNoObj, rcUnknown );
-    }
-    
-    return rc;
-}
-
-
-/* Project
- *  finds key(s) mapping to value/id if supported
- */
-LIB_EXPORT rc_t CC KIndexProjectText ( const KIndex *self,
-    int64_t id, int64_t *start_id, uint64_t *id_count,
-    char *key, size_t kmax, size_t *actsize )
-{
-    rc_t rc = 0;
-    int64_t dummy;
-    uint32_t span;
-
-    if ( start_id == NULL )
-        start_id = & dummy;
-
-    * start_id = 0;
-
-    if ( id_count != NULL )
-        * id_count = 0;
-
-    if ( key == NULL && kmax != 0 )
-        return RC ( rcDB, rcIndex, rcProjecting, rcBuffer, rcNull );
-
-    if ( kmax != 0 )
-        key [ 0 ] = 0;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcIndex, rcProjecting, rcSelf, rcNull );
-
-    if ( ( ( KIdxType ) self -> type & kitProj ) == 0 )
-        return RC ( rcDB, rcIndex, rcProjecting, rcIndex, rcIncorrect );
-
-    if ( key == NULL )
-        return RC ( rcDB, rcIndex, rcProjecting, rcBuffer, rcNull );
-
-    span = 1;
-
-    switch ( self -> type )
-    {
-    case kitText | kitProj:
-        switch ( self -> vers )
-        {
-        case 1:
-            /* there is a limit on ids in v1 */
-            if ( id <= 0 || ( id >> 32 ) != 0 )
-                return RC ( rcDB, rcIndex, rcProjecting, rcId, rcNotFound );
-
-            rc = KTrieIndexProject_v1 ( & self -> u . txt1,
-                ( uint32_t ) id, key, kmax, actsize );
-            if ( rc == 0 )
-                * start_id = id;
-            break;
-        case 2:
-        case 3:
-        case 4:
-#if V2FIND_RETURNS_SPAN
-            rc = KTrieIndexProject_v2 ( & self -> u . txt234, id, start_id, & span, key, kmax, actsize );
-#else
-            rc = KTrieIndexProject_v2 ( & self -> u . txt234, id, key, kmax, actsize );
-            if ( rc == 0 )
-                * start_id = id;
-#endif
-            break;
-        default:
-            return RC ( rcDB, rcIndex, rcProjecting, rcIndex, rcBadVersion );
-        }
-        break;
-    default:
-        return RC ( rcDB, rcIndex, rcProjecting, rcNoObj, rcUnknown );
-    }
-
-    if ( id_count != NULL )
-        * id_count = span;
-    
-    return rc;
-}
-
-
-/* ProjectAll
- *  finds key(s) mapping to value/id if supported
- */
-LIB_EXPORT rc_t CC KIndexProjectAllText ( const KIndex *self, int64_t id,
-    rc_t ( CC * f ) ( int64_t start_id, uint64_t id_count, const char *key, void *data ),
-    void *data )
-{
-    rc_t rc = 0;
-    char key [ 256 ];
-
-    uint32_t span;
-    int64_t start_id;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcIndex, rcProjecting, rcSelf, rcNull );
-
-    if ( ( ( KIdxType ) self -> type & kitProj ) == 0 )
-        return RC ( rcDB, rcIndex, rcProjecting, rcIndex, rcIncorrect );
-
-    if ( f == NULL )
-        return RC ( rcDB, rcIndex, rcProjecting, rcFunction, rcNull );
-
-    span = 1;
-
-    switch ( self -> type )
-    {
-    case kitText | kitProj:
-        switch ( self -> vers )
-        {
-        case 1:
-            /* there is a limit on ids in v1 */
-            if ( id <= 0 || ( id >> 32 ) != 0 )
-                return RC ( rcDB, rcIndex, rcProjecting, rcId, rcNotFound );
-
-            rc = KTrieIndexProject_v1 ( & self -> u . txt1,
-                ( uint32_t ) id, key, sizeof key, NULL );
-            if ( rc == 0 )
-                rc = ( * f ) ( id, 1, key, data );
-            break;
-
-        case 2:
-        case 3:
-        case 4:
-#if V2FIND_RETURNS_SPAN
-            rc = KTrieIndexProject_v2 ( & self -> u . txt234, id, & start_id, & span, key, sizeof key, NULL );
-#else
-            rc = KTrieIndexProject_v2 ( & self -> u . txt234, start_id = id, key, sizeof key );
-#endif
-            if ( rc == 0 )
-                rc = ( * f ) ( start_id, span, key, data );
-            break;
-            
-        default:
-            return RC ( rcDB, rcIndex, rcProjecting, rcIndex, rcBadVersion );
-        }
-        break;
-    default:
-        return RC ( rcDB, rcIndex, rcProjecting, rcNoObj, rcUnknown );
-    }
-    
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KIndexFindU64( const KIndex* self, uint64_t offset, uint64_t* key, uint64_t* key_size, int64_t* id, uint64_t* id_qty )
-{
-    rc_t rc = 0;
-
-    if( key == NULL || key_size == NULL || id == NULL || id_qty == NULL ) {
-        return RC(rcDB, rcIndex, rcSelecting, rcParam, rcNull);
-    }
-    *key = *key_size = *id = *id_qty = 0;
-    if( self == NULL ) {
-        return RC(rcDB, rcIndex, rcSelecting, rcSelf, rcNull);
-    }
-
-    switch( self->type )
-    {
-    case kitU64:
-        switch( self->vers )
-        {
-        case 3:
-        case 4:
-            rc = KU64IndexFind_v3(&self->u.u64_3, offset, key, key_size, id, id_qty);
-            break;
-        default:
-            return RC(rcDB, rcIndex, rcSelecting, rcIndex, rcBadVersion);
-        }
-        break;
-    default:
-        return RC(rcDB, rcIndex, rcSelecting, rcNoObj, rcUnknown);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KIndexFindAllU64( const KIndex* self, uint64_t offset,
-    rc_t ( CC * f )(uint64_t key, uint64_t key_size, int64_t id, uint64_t id_qty, void* data ), void* data)
-{
-    rc_t rc = 0;
-
-    if ( self == NULL )
-        return RC(rcDB, rcIndex, rcSelecting, rcSelf, rcNull);
-    if ( f == NULL )
-        return RC(rcDB, rcIndex, rcSelecting, rcFunction, rcNull);
-
-    switch ( self->type )
-    {
-    case kitU64:
-        switch ( self->vers )
-        {
-        case 3:
-        case 4:
-            rc = KU64IndexFindAll_v3(&self->u.u64_3, offset, f, data);
-            break;
-        default:
-            return RC(rcDB, rcIndex, rcSelecting, rcIndex, rcBadVersion);
-        }
-        break;
-    default:
-        return RC(rcDB, rcIndex, rcSelecting, rcNoObj, rcUnknown);
-    }
-
-    return rc;
-}
-
-
-/* SetMaxId
- *  certain legacy versions of skey were built to know only the starting id
- *  of the NAME_FMT column, but were never given a maximum id. allow them
- *  to be corrected here.
- */
-LIB_EXPORT void CC KIndexSetMaxRowId ( const KIndex *cself, int64_t max_row_id )
-{
-    if ( cself != NULL ) switch ( cself -> type )
-    {
-    case kitText:
-    case kitText | kitProj:
-        switch ( cself -> vers )
-        {
-        case 2:
-        case 3:
-        case 4:
-            /* here we can repair the max row id */
-            if ( cself -> u . txt234 . pt . maxid < max_row_id )
-                ( ( KIndex* ) cself ) -> u . txt234 . pt . maxid = max_row_id;
-            break;
-        }
-        break;
-    }
-}
diff --git a/libs/kdb/kdb-priv.h b/libs/kdb/kdb-priv.h
deleted file mode 100644
index f9440f1..0000000
--- a/libs/kdb/kdb-priv.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kdb_priv_
-#define _h_kdb_priv_
-
-#ifndef _h_kdb_manager_
-#include <kdb/manager.h>
-#endif
-
-#ifndef _h_kdb_manager_
-#include <kdb/manager.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct KDirectory;
-struct KDBManager;
-
-/*
- * This symbol is inserted where the KDB is being tweaked to allow
- * VFS URI syntax in opening KDB database objects initially to support
- * krypto passwords more fully.  By specifying the password source
- * individually for opens two KDB objects with different passwords can be opened.
- */
-#define SUPPORT_VFS_URI 1
-
-/*--------------------------------------------------------------------------
- * KDB utility
- */
-
-
-/* PathType
- *  checks type of path
- */
-int KDBPathTypeDir ( const struct KDirectory *dir, int type,bool *zombies, const char *path );
-int KDBPathType ( const struct KDirectory *dir, bool *zombies, const char *path );
-
-/* OpenPathType
- * Opens a path if it is of the specified type.  Even if it is an archive file
- * instead of a directory.
- *
- * if dpdir is NULL it will not return with an open Directory but it will have
- * checked that the type requested is the type present even if in an archive.
- *
- * if realpathtype is not NULL the found type will be returned regardless
- * of a match to request path type.
- *
- * the return will be zero only if the path does point to a directory or
- * archive that is of the requested type.  An archive will have been opened
- * but reshut if dpdir is NULL.
- */ 
-rc_t KDBOpenPathTypeRead ( const struct KDBManager * mgr, const struct KDirectory * dir, const char * path, 
-    const struct KDirectory ** dpdir, int pathtype, int * realpathtype, bool try_srapath );
-
-/* Writable
- *  examines a directory structure for any "lock" files
- *  examines a file for ( any ) write permission
- */
-rc_t KDBWritable ( const struct KDirectory *dir, const char *path );
-
-/* GetObjModDate
- *  extract mod date from a path
- */
-rc_t KDBGetObjModDate ( const struct KDirectory *dir, KTime_t *mtime );
-
-/* GetPathModDate
- *  extract mod date from a path
- */
-rc_t KDBVGetPathModDate ( const struct KDirectory *dir,
-    KTime_t *mtime, const char *path, va_list args );
-
-/* KDBMakeSubPath
- *  adds a namespace to path spec
- */
-rc_t KDBMakeSubPath ( struct KDirectory const *dir,
-    char *subpath, size_t subpath_max, const char *ns,
-    uint32_t ns_size, const char *path, ... );
-/* VMakeSubPath
- *  adds a namespace to path spec
- */
-rc_t KDBVMakeSubPath ( const struct KDirectory *dir,
-    char *subpath, size_t subpath_max, const char *ns,
-    uint32_t ns_size, const char *path, va_list args );
-
-
-/* KDBIsPathUri
- * A hack to get some of VFS into KDB that is too tightly bound to KFS
- */
-bool KDBIsPathUri (const char * path);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kdb_priv_ */
diff --git a/libs/kdb/kdb.c b/libs/kdb/kdb.c
deleted file mode 100644
index 8a799c7..0000000
--- a/libs/kdb/kdb.c
+++ /dev/null
@@ -1,938 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kdb/extern.h>
-
-#include "kdb-priv.h"
-#include "kdbfmt-priv.h"
-#include "dbmgr-priv.h"
-
-#include <krypto/key.h>
-#include <krypto/encfile.h>
-#include <krypto/wgaencrypt.h>
-
-#include <vfs/manager.h>
-#include <vfs/path.h>
-#include <vfs/resolver.h>
-#include <vfs/manager-priv.h>
-#include <sra/srapath.h>
-
-#include <kfs/kfs-priv.h>
-#include <kfs/directory.h>
-#include <kfs/file.h>
-#include <kfs/arc.h>
-#include <kfs/tar.h>
-#include <kfs/sra.h>
-#include <kfs/kfs-priv.h>
-#include <klib/container.h>
-#include <klib/text.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <va_copy.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-#include <errno.h>
-
-#ifndef SUPPORT_VFS_URI
-#define SUPPORT_VFS_URI 0
-#endif
-
-/*--------------------------------------------------------------------------
- * KDB utility
- */
-
-/* KDBHdrValidate
- *  validates that a header sports a supported byte order
- *  and that the version is within range
- */
-/* this is included to make kdb.c vs. wkdb.c file comparisons easier in [x]emacs.*/
-#if NOT_USED_IN_READ_ONLY_SIDE
-rc_t KDBHdrValidate ( const KDBHdr *hdr, size_t size,
-    uint32_t min_vers, uint32_t max_vers )
-{
-    assert ( hdr != NULL );
-
-    if ( size < sizeof * hdr )
-        return RC ( rcDB, rcHeader, rcValidating, rcData, rcCorrupt );
-
-    if ( hdr -> endian != eByteOrderTag )
-    {
-        if ( hdr -> endian == eByteOrderReverse )
-            return RC ( rcDB, rcHeader, rcValidating, rcByteOrder, rcIncorrect );
-        return RC ( rcDB, rcHeader, rcValidating, rcData, rcCorrupt );
-    }
-
-    if ( hdr -> version < min_vers || hdr -> version > max_vers )
-        return RC ( rcDB, rcHeader, rcValidating, rcHeader, rcBadVersion );
-
-    return 0;
-}
-#endif
-
-/* KDBPathType
- *  checks type of path
- */
-enum ScanBits
-{
-    scan_db     = ( 1 <<  0 ),
-    scan_tbl    = ( 1 <<  1 ),
-    scan_idx    = ( 1 <<  2 ),
-    scan_col    = ( 1 <<  3 ),
-    scan_idxN   = ( 1 <<  4 ),
-    scan_data   = ( 1 <<  5 ),
-    scan_dataN  = ( 1 <<  6 ),
-    scan_md     = ( 1 <<  7 ),
-    scan_cur    = ( 1 <<  8 ),
-    scan_rNNN   = ( 1 <<  9 ),
-    scan_lock   = ( 1 << 10 ),
-    scan_odir   = ( 1 << 11 ),
-    scan_ofile  = ( 1 << 12 ),
-    scan_meta   = ( 1 << 13 ),
-    scan_skey   = ( 1 << 14 ),
-    scan_sealed = ( 1 << 15 ),
-    scan_zombie = ( 1 << 16 )
-};
-
-static
-rc_t CC scan_dbdir ( const KDirectory *dir, uint32_t type, const char *name, void *data )
-{
-    uint32_t *bits = data;
-
-    type &= kptAlias - 1;
-
-    if ( type == kptDir )
-    {
-        switch ( name [ 0 ] )
-        {
-        case 'c':
-            if ( strcmp ( name, "col" ) == 0 )
-            { * bits |= scan_col; return 0; }
-            break;
-        case 'm':
-            if ( strcmp ( name, "md" ) == 0 )
-            { * bits |= scan_md; return 0; }
-            break;
-        case 't':
-            if ( strcmp ( name, "tbl" ) == 0 )
-            { * bits |= scan_tbl; return 0; }
-            break;
-        case 'i':
-            if ( strcmp ( name, "idx" ) == 0 )
-            { * bits |= scan_idx; return 0; }
-            break;
-        case 'd':
-            if ( strcmp ( name, "db" ) == 0 )
-            { * bits |= scan_db; return 0; }
-            break;
-        }
-
-        * bits |= scan_odir;
-    }
-    else if ( type == kptFile )
-    {
-        switch ( name [ 0 ] )
-        {
-        case 'l':
-            if ( strcmp ( name, "lock" ) == 0 )
-            { * bits |= scan_lock; return 0; }
-            break;
-        case 'i':
-            if ( memcmp ( name, "idx", 3 ) == 0 )
-            {
-                if ( isdigit ( name [ 3 ] ) )
-                { * bits |= scan_idxN; return 0; }
-            }
-            break;
-        case 'd':
-            if ( memcmp ( name, "data", 4 ) == 0 )
-            {
-                if ( name [ 4 ] == 0 )
-                { * bits |= scan_data; return 0; }
-                if ( isdigit ( name [ 4 ] ) )
-                { * bits |= scan_dataN; return 0; }
-            }
-        case 'c':
-            if ( strcmp ( name, "cur" ) == 0 )
-            { * bits |= scan_cur; return 0; }
-            break;
-        case 'r':
-            if ( isdigit ( name [ 1 ] ) && isdigit ( name [ 2 ] ) &&
-                 isdigit ( name [ 3 ] ) && name [ 4 ] == 0 )
-            { * bits |= scan_rNNN; return 0; }
-            break;
-        case 'm':
-            if ( strcmp ( name, "meta" ) == 0 )
-            { * bits |= scan_meta; return 0; }
-            break;
-        case 's':
-            if ( strcmp ( name, "skey" ) == 0 )
-            { * bits |= scan_skey; return 0; }
-            if ( strcmp ( name, "sealed" ) == 0 )
-            { * bits |= scan_sealed; return 0; }
-            break;
-        }
-
-        * bits |= scan_ofile;
-    }
-    else if (type == kptZombieFile )
-    {
-        * bits |= scan_zombie;
-    }
-    
-    return 0;
-}
-
-
-int KDBPathTypeDir (const KDirectory * dir, int type, bool * pHasZombies, const char * path)
-{
-    const char * leaf, * parent;
-    uint32_t bits;
-    rc_t rc;
-
-    bits = 0;
-
-    assert ((type == kptDir) || (type == (kptDir|kptAlias)));
-
-    rc = KDirectoryVVisit ( dir, false, scan_dbdir, & bits, path, NULL );
-    if ( rc == 0 ) do
-    {
-        if ( ( bits & scan_zombie ) != 0 ) {
-            bits &= ~scan_zombie;
-            if (pHasZombies)
-                *pHasZombies = true;
-        }
-        /* look for a column */
-        if ( ( bits & scan_idxN ) != 0 &&
-             ( bits & ( scan_data | scan_dataN ) ) != 0 )
-        {
-            if ( ( bits & ( scan_db | scan_tbl | scan_idx | scan_col ) ) == 0 )
-                type += kptColumn - kptDir;
-            break;
-        }
-
-        /* look for a table */
-        if ( ( bits & scan_col ) != 0 )
-        {
-            /* can't have sub-tables or a db */
-            if ( ( bits & ( scan_db | scan_tbl ) ) == 0 )
-            {
-                /* look for an old-structure table */
-                if ( ( bits & ( scan_meta | scan_md ) ) == scan_meta ||
-                     ( bits & ( scan_skey | scan_idx ) ) == scan_skey )
-                    type += kptPrereleaseTbl - kptDir;
-                else
-                    type += kptTable - kptDir;
-            }
-            break;
-        }
-
-        /* look for metadata */
-        if ( ( bits & ( scan_cur | scan_rNNN ) ) != 0 )
-        {
-            if ( ( bits & ( scan_db | scan_tbl | scan_idx | scan_col ) ) == 0 )
-                type += kptMetadata - kptDir;
-            break;
-        }
-
-        /* look for a database */
-        if ( ( bits & scan_tbl ) != 0 )
-        {
-            if ( ( bits & scan_col ) == 0 )
-                type += kptDatabase - kptDir;
-            break;
-        }
-
-        /* look for a structured column */
-        if ( ( bits & scan_odir ) != 0 )
-        {
-            leaf = strrchr ( path, '/' );
-            if ( leaf != NULL )
-            {
-                parent = string_rchr ( path, leaf - path, '/' );
-                if ( parent ++ == NULL )
-                    parent = path;
-                if ( memcmp ( parent, "col/", 4 ) != 0 )
-                    break;
-
-                bits = 0;
-                if ( KDirectoryVVisit ( dir, 1, scan_dbdir, & bits, path, NULL ) == 0 )
-                {
-                    if ( ( bits & scan_idxN ) != 0 &&
-                         ( bits & ( scan_data | scan_dataN ) ) != 0 )
-                    {
-                        if ( ( bits & ( scan_db | scan_tbl | scan_idx | scan_col ) ) == 0 )
-                            type += kptColumn - kptDir;
-                        break;
-                    }
-                }
-            }
-        }
-    } while (0);
-
-    return type;
-}
-
-
-int KDBPathType ( const KDirectory *dir, bool *pHasZombies, const char *path )
-{
-    const char *leaf, *parent;
-
-
-    rc_t rc;
-    int type = KDirectoryVPathType ( dir, path, NULL );
-    
-    if (pHasZombies)
-        *pHasZombies = false;
-
-    switch ( type )
-    {
-    case kptDir:
-    case kptDir | kptAlias:
-        type = KDBPathTypeDir (dir, type, pHasZombies, path);
-        break;
-
-    case kptFile:
-    case kptFile | kptAlias:
-    {
-        /* if we hit a file first try it as an archive */
-        const KDirectory * ldir;
-
-        rc = KDirectoryOpenSraArchiveRead_silent ( dir, &ldir, false, path );
-        if ( rc != 0 )
-            rc = KDirectoryOpenTarArchiveRead_silent ( dir, &ldir, false, path );
-        /* it was an archive so recur */
-        if ( rc == 0 )
-        {
-            /* recheck this newly opened directory for KDB/KFS type */
-            int type2;
-
-            type2 = KDBPathType ( ldir, NULL, "." );
-            if ((type2 != kptDir) || (type != (kptDir|kptAlias)))
-                type = type2;
-
-            KDirectoryRelease (ldir);
-        }
-        /* it was not an archive so see if it it's an idx file */
-        else
-        {
-            leaf = strrchr ( path, '/' );
-            if ( leaf != NULL )
-            {
-                parent = string_rchr ( path, leaf - path, '/' );
-                if ( parent ++ == NULL )
-                    parent = path;
-                if ( memcmp ( parent, "idx/", 4 ) == 0 )
-                    type += kptIndex - kptFile;
-            }
-        }
-        break;
-    }
-    }
-    return type;
-}
-
-
-
-#if SUPPORT_VFS_URI
-#else
-/* return configured password as ASCIZ
- * opertates on vfs/kfs/kfg objects, not kdb objects */
-static
-rc_t KDBOpenFileGetPassword (char * pw, size_t pwz)
-{
-    VFSManager * mgr;
-    rc_t rc;
-
-    assert (pw);
-    assert (pwz);
-
-    pw[0] = '\0';
-
-    rc = VFSManagerMake (&mgr);
-    if (rc)
-        ;                      /* failure to make VFS manager: pass along rc */
-    else
-    {
-        size_t pwfz;
-        char pwf [4096 + 1];
-
-        rc = VFSManagerGetConfigPWFile (mgr, pwf, sizeof (pwf) - 1, &pwfz);
-        if (rc)
-            /* failure to get password file path: tweak rc */
-            rc = RC (rcDB, rcMgr, rcOpening, rcEncryptionKey, rcNotFound);
-
-        else
-        {
-            VPath * pwp;
-
-            pwf [pwfz] = '\0'; /* force to ASCIZ */
-
-#if 0
-            rc = VPathMakeSysPath (&pwp, pwf);
-#else
-            rc = VFSManagerMakePath (mgr, &pwp, pwf);
-#endif
-
-            if (rc)
-                ;       /* failure to construct a path from the string */
-            
-            else
-            {
-                const KFile * pwf;
-          
-                rc = VFSManagerOpenFileRead (mgr, &pwf, pwp);
-                if (rc)
-                    /* failure to open password file */
-                    rc = RC (rcDB, rcMgr, rcOpening, rcEncryptionKey, rcNotOpen);
-
-                else
-                {
-                    size_t z;
-                    char pwb [4098]; /* arbitrarily using 4096 as maximum
-                                        allowed length */
-
-                    /* at this point we are only getting the password from a 
-                     * file but in the future if we can get it from a pipe of
-                     * some sort we can't count on the ReadAll to really know
-                     * if we hit end of file and not just a pause in the
-                     * streaming.  VFS/KFS 2 will have to fix this somehow
-                     */
-
-                    rc = KFileReadAll (pwf, 0, pwb, sizeof pwb, &z);
-                    if (rc)
-                        ;       /* failure to read password file: pass along rc */
-                    else
-                    {
-                        /* trim off EOL if present */
-                        char * pc;
-
-                        pwb[z] = '\0';   /* force ASCIZ */
-
-                        pc = string_chr (pwb, z, '\r');
-                        if (pc)
-                        {
-                            *pc = '\0';
-                            z = 1 + pc - pwb;
-                        }
-                        pc = string_chr (pwb, z, '\n');
-                        if (pc)
-                        {
-                            *pc = '\0';
-                            z = 1 + pc - pwb;
-                        }
-                        if (z == 0)
-                            rc = RC (rcDB, rcMgr, rcOpening, rcEncryptionKey, rcTooShort);
-
-                        else if (pwz < z) /* pwz came in as 4096 */
-                            rc = RC (rcDB, rcMgr, rcOpening, rcEncryptionKey, rcTooLong);
-
-                        else
-                        {
-                            memmove (pw, pwb, z+1);
-                        }
-                    }
-                    KFileRelease (pwf);
-                }
-                VPathRelease (pwp);
-            }
-        }
-        VFSManagerRelease (mgr);
-    }
-    return rc;
-}
-
-
-/* not KDB specific - just uses vfs/krypto/kfs objects */
-static
-rc_t KDBOpenFileAsDirectory (const KDirectory * dir,
-                             const char * path, 
-                             const KDirectory ** pdir,
-                             uint32_t rcobj)
-{
-    const KFile * file;
-    const KFile * f;
-    const KDirectory * ldir;
-    bool encrypted = false;
-
-    rc_t rc;
-
-    *pdir = NULL;
-
-    rc = KDirectoryOpenFileRead (dir, &file, path);
-    if (rc == 0)
-    {
-        rc = KFileRandomAccess(file);
-        if (rc)
-            rc = RC (rcDB, rcMgr, rcOpening, rcobj, rcUnsupported);
-        else
-        {
-            size_t tz;
-            char tbuff [4096];
-            char pbuff [4096 + 1];
-
-            rc = KFileReadAll (file, 0, tbuff, sizeof tbuff, &tz);
-            if (rc == 0)
-            {
-                if (KFileIsEnc (tbuff, tz) == 0)
-                {
-                    encrypted = true;
-
-                    rc = KDBOpenFileGetPassword (pbuff, sizeof (pbuff) - 1);
-                    if (rc == 0)
-                    {
-                        KKey key;
-
-                        rc = KKeyInitRead (&key, kkeyAES128, pbuff, string_size (pbuff));
-                        if (rc == 0)
-                        {
-                            rc = KEncFileMakeRead (&f, file, &key);
-                            if (rc == 0)
-                            {
-                                /* KEncFileMakeRead adds a reference */
-                                KFileRelease (file);
-                                file = f;
-                                rc = KFileReadAll (file, 0, tbuff, sizeof tbuff, &tz);
-                            }
-                        }
-                    }
-                }
-                else if (KFileIsWGAEnc (tbuff, tz) == 0)
-                {
-                    encrypted = true;
-
-                    rc = KDBOpenFileGetPassword (pbuff, sizeof (pbuff) - 1);
-                    if (rc == 0)
-                    {
-                        rc = KFileMakeWGAEncRead (&f, file, pbuff, string_size (pbuff));
-                        if (rc == 0)
-                        {
-                            /* KFileMakeWGAEncRead adds a reference */
-                            KFileRelease (file);
-                            file = f;
-                            rc = KFileReadAll (file, 0, tbuff, sizeof tbuff, &tz);
-                        }
-                    }
-                }
-                /* else not a handled encryption or unencrypted: we can't distinguish too much */
-
-                if (rc == 0)
-                {
-                    if (KFileIsSRA (tbuff, tz) == 0)
-                    {
-                        rc = KDirectoryOpenSraArchiveReadUnbounded_silent_preopened (dir,
-                                                                                     &ldir,
-                                                                                     false,
-                                                                                     file,
-                                                                                     path);
-                    }
-                    else
-                    {
-                        rc = KDirectoryOpenTarArchiveRead_silent_preopened (dir, &ldir, false,
-                                                                            file, path);
-                    }
-
-                    /* not an archive type we handle or a bad archive */
-                    if (rc)
-                    {
-                        if (encrypted)
-                            rc = RC ( rcDB, rcMgr, rcOpening, rcEncryptionKey, rcIncorrect );
-                        else
-                            rc = RC ( rcDB, rcMgr, rcOpening, rcPath, rcIncorrect );
-                    }
-                    else
-                    {
-                        /*
-                         * release our ownership of the KFile that but archive will 
-                         * keep theirs
-                         */
-                        KFileRelease (file);
-                        *pdir = ldir;
-                        return 0;
-                    }
-                }
-            }
-        }
-        KFileRelease (file);
-    }
-    return rc;
-}
-#endif
-
-
-static rc_t KDBOpenPathTypeReadInt ( const KDBManager * mgr, const KDirectory * dir, const char * path,
-                                     const KDirectory ** pdir, int * type,
-                                     int pathtype, uint32_t rcobj, bool try_srapath )
-{
-    VFSManager * vmgr = mgr->vfsmgr;
-    const KDirectory * ldir = NULL;
-    rc_t rc = 0;
-
-    /* object relative opens can be done using KFS - we hacked in VFS after all */
-    if (! try_srapath)
-    {
-        rc = KDirectoryOpenDirUpdate ((KDirectory*)dir, (KDirectory**)pdir, false, path);
-        if ((rc) && (GetRCState(rc) != rcNotFound))
-            rc = KDirectoryOpenDirRead (dir, pdir, false, path);
-    }
-    else
-    {
-        VPath * vpath;
-
-        /*
-         * We've got to decide if the path coming in is a full or relative
-         * path and if relative make it relative to dir or possibly its a srapath
-         * accession
-         *
-         */
-        rc = VPathMakeDirectoryRelative ( &vpath, dir, path );
-        if ( rc == 0 )
-        {
-            rc = VFSManagerOpenDirectoryReadDirectoryRelativeDecrypt ( vmgr, dir, &ldir, vpath );
-
-            if ( rc == 0 )
-            {
-                *type = (~kptAlias) & KDBPathType ( ldir, NULL, "." );
-
-                /* just a directory, not a kdb type */
-                if ( *type == kptDir )
-                    rc = RC (rcDB, rcMgr, rcOpening, rcPath, rcIncorrect);
-
-                else if ( *type != pathtype )
-                {
-                    KDirectoryRelease( ldir );
-                    rc = RC ( rcDB, rcMgr, rcOpening, rcobj, rcIncorrect );
-                }
-                else
-                {
-                    if ( pdir != NULL )
-                        *pdir = ldir;
-                    else
-                        KDirectoryRelease( ldir );
-                }
-            }
-            VPathRelease ( vpath );
-        }
-    }
-    return rc;
-}
-
-rc_t KDBOpenPathTypeRead ( const KDBManager * mgr, const KDirectory * dir, const char * path, 
-    const KDirectory ** pdir, int pathtype, int * ppathtype, bool try_srapath )
-{
-    const KDirectory *ldir;
-    rc_t rc = 0;
-    uint32_t rcobj;
-    int type = kptNotFound; /* bogus? */
-
-/*     KOutMsg ("%s: %s\n", __func__, path); */
-
-    if ( pdir != NULL )
-        *pdir = NULL;
-    if ( ppathtype != NULL )
-        *ppathtype = type;
-
-    switch (pathtype & ~ kptAlias) /* tune the error message based on path type */
-    {
-        /* we'll hit this if we don't track defines in kdb/manager.h */
-    default:
-        rc = RC (rcDB, rcMgr, rcOpening, rcType, rcInvalid);
-        return rc;
-
-    case kptTable:
-    case kptPrereleaseTbl:
-        rcobj = rcTable;
-        break;
-
-    case kptColumn:
-        rcobj = rcColumn;
-        break;
-
-    case kptDatabase:
-    case kptDatabase | kptAlias:
-        rcobj = rcDatabase;
-        break;
-    }
-
-    rc = KDBOpenPathTypeReadInt( mgr, dir, path, &ldir, &type, pathtype, rcobj, try_srapath );
-
-    if (rc == 0)
-    {
-        if ( ppathtype != NULL )
-            *ppathtype = type;
-
-        if (pdir != NULL)
-            *pdir = ldir;
-        else
-            KDirectoryRelease (ldir);
-    }
-
-    return rc;
-}
-
-
-/* Writable
- *  examines a directory structure for any "lock" files
- */
-rc_t KDBWritable ( const KDirectory *dir, const char *path )
-{
-    uint32_t access;
-    rc_t rc;
-
-    /* protect us from bad parameters */
-    if (dir == NULL)
-        return RC (rcDB, rcPath, rcAccessing, rcDirectory, rcNull);
-    if (path == NULL)
-        return RC (rcDB, rcPath, rcAccessing, rcPath, rcNull);
-
-    /* we have to be able to check the access if it is to be writable */
-    rc = KDirectoryVAccess ( dir, & access, path, NULL );
-    if ( rc == 0 )
-    {
-        /* if there is a lock (or deprecated sealed) file in this directory */
-        switch ( KDirectoryPathType ( dir, "%s/lock", path ) )
-        {
-        case kptFile:
-        case kptFile | kptAlias:
-            rc = RC ( rcDB, rcPath, rcAccessing, rcLock, rcLocked );
-            break;
-        case kptNotFound:
-            /* much simpler handling for the sealed file */
-            switch ( KDirectoryPathType ( dir, "%s/sealed", path ) )
-            {
-            case kptFile:
-            case kptFile | kptAlias:
-                rc = RC ( rcDB, rcPath, rcAccessing, rcLock, rcLocked );
-                break;
-            case kptNotFound:
-                /* check if there are no write permissions */
-                if ( ( access & 0222 ) == 0 )
-                    rc = RC ( rcDB, rcPath, rcAccessing, rcPath, rcReadonly );
-                /* else rc is still 0 from VAccess */
-            }
-            break;
-        case kptBadPath:
-            /* likely to be a non-driectory or something */
-            rc = RC ( rcDB, rcPath, rcAccessing, rcPath, rcInvalid);
-            break;
-        default:
-            /* an illegal type of object named "lock" is in this directory
-             * which will block the ability to lock it
-             */
-            rc = RC ( rcDB, rcPath, rcAccessing, rcPath, rcIncorrect );
-        }
-    }
-    return rc;
-}
-
-
-bool KDBIsLocked ( const KDirectory *dir, const char *path )
-{
-    return ( KDBWritable (dir, path) != 0 );
-}
-
-
-/* GetObjModDate
- *  extract mod date from a path
- */
-rc_t KDBGetObjModDate ( const KDirectory *dir, KTime_t *mtime )
-{
-    /* HACK ALERT - there needs to be a proper way to record modification times */
-    
-    /* this only tells the last time the table was locked,
-       which may be close to the last time it was modified */
-    rc_t rc = KDirectoryDate ( dir, mtime, "lock" );
-    if ( rc == 0 )
-        return 0;
-
-    if ( GetRCState ( rc ) == rcNotFound )
-    {
-        rc = KDirectoryDate ( dir, mtime, "sealed" );
-        if ( rc == 0 )
-            return 0;
-    }
-
-    /* get directory timestamp */
-    rc = KDirectoryDate ( dir, mtime, "." );
-    if ( rc == 0 )
-        return 0;
-
-    * mtime = 0;
-    return rc;
-}
-
-/* GetPathModDate
- *  extract mod date from a path
- */
-rc_t KDBVGetPathModDate ( const KDirectory *dir,
-    KTime_t *mtime, const char *path, va_list args )
-{
-    rc_t rc;
-    uint32_t ptype;
-    const KDirectory *obj_dir;
-
-    va_list cpy;
-    va_copy ( cpy, args );
-    ptype = KDirectoryVPathType ( dir, path, cpy );
-    va_end ( cpy );
-
-    switch ( ptype )
-    {
-    case kptDir:
-    case kptDir | kptAlias:
-        break;
-
-    default:
-        return KDirectoryVDate ( dir, mtime, path, args );
-    }
-
-    * mtime = 0;
-    rc = KDirectoryVOpenDirRead ( dir, & obj_dir, true, path, args );
-    if ( rc == 0 )
-    {
-        rc = KDBGetObjModDate ( obj_dir, mtime );
-        KDirectoryRelease ( obj_dir );
-    }
-
-    return rc;
-}
-
-
-/* KDBVMakeSubPath
- *  adds a namespace to path spec
- */
-rc_t KDBVMakeSubPath ( struct KDirectory const *dir,
-    char *subpath, size_t subpath_max, const char *ns,
-    uint32_t ns_size, const char *path, va_list args )
-{
-    rc_t rc;
-
-    if ( ns_size > 0 )
-    {
-        subpath += ns_size + 1;
-        subpath_max -= ns_size + 1;
-    }
-
-#if CRUFTY_USE_OF_RESOLVE_PATH
-    /* because this call only builds a path instead of resolving anything
-     * is is okay that we are using the wrong directory */
-    rc = KDirectoryVResolvePath ( dir, false,
-        subpath, subpath_max, path, args );
-#else
-    {
-        int sz = vsnprintf ( subpath, subpath_max, path, args );
-        if ( sz < 0 || ( size_t ) sz >= subpath_max )
-            rc = RC ( rcDB, rcDirectory, rcResolving, rcBuffer, rcInsufficient );
-        else if ( sz == 0 )
-            rc = RC ( rcDB, rcDirectory, rcResolving, rcPath, rcEmpty );
-        else
-        {
-            rc = 0;
-        }
-    }
-#endif
-    switch ( GetRCState ( rc ) )
-    {
-    case 0:
-        assert ( subpath [ 0 ] != 0 );
-        if ( subpath [ 0 ] == '.' || subpath [ 1 ] == '/' )
-            return RC ( rcDB, rcDirectory, rcResolving, rcPath, rcInvalid );
-        break;
-    case rcInsufficient:
-        return RC ( rcDB, rcDirectory, rcResolving, rcPath, rcExcessive );
-    default:
-        return rc;
-    }
-
-    if ( ns_size != 0 )
-    {
-        subpath -= ns_size + 1;
-        memcpy ( subpath, ns, ns_size );
-        subpath [ ns_size ] = '/';
-    }
-    return rc;
-}
-
-/* KDBMakeSubPath
- *  adds a namespace to path spec
- */
-rc_t KDBMakeSubPath ( struct KDirectory const *dir,
-    char *subpath, size_t subpath_max, const char *ns,
-    uint32_t ns_size, const char *path, ... )
-{
-    rc_t rc = 0;
-    va_list args;
-    va_start(args, path);
-    rc = KDBVMakeSubPath(dir, subpath, subpath_max, ns, ns_size, path, args);
-    va_end(args);
-    return rc;
-}
-
-/* this is included to make kdb.c vs. wkdb.c file comparisons easier in [x]emacs.*/
-#if NOT_USED_IN_READ_ONLY_SIDE
-/* VDrop
- */
-static
-rc_t KDBDropInt ( KDirectory * dir, const KDBManager * mgr,
-                  const char * path )
-{
-}
-
-rc_t KDBMgrVDrop ( KDirectory * dir, const KDBManager * mgr, uint32_t obj_type,
-                   const char * path, va_list args )
-{
-}
-#endif
-
-/* KDBIsPathUri
- * A hack to get some of VFS into KDB that is too tightly bound to KFS
- */
-
-bool KDBIsPathUri (const char * path)
-{
-    const char * pc;
-    size_t z;
-
-    z = string_size (path);
-
-    if (NULL != (pc = string_chr (path, z, ':')))
-        return true;
-
-    if (NULL != (pc = string_chr (path, z, '?')))
-        return true;
-
-    if (NULL != (pc = string_chr (path, z, '#')))
-        return true;
-
-    return false;
-}
diff --git a/libs/kdb/kdbfmt-priv.h b/libs/kdb/kdbfmt-priv.h
deleted file mode 100644
index 1ffc30f..0000000
--- a/libs/kdb/kdbfmt-priv.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kdbfmt_priv_
-#define _h_kdbfmt_priv_
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KDBHdr
- *  the various file types used:
- *
- *  a) metadata
- *  b) key => id
- *  c) id => key
- *
- * will begin with a standard header to tag format
- */
-#define eByteOrderTag 0x05031988
-#define eByteOrderReverse 0x88190305
-
-typedef struct KDBHdr KDBHdr;
-struct KDBHdr
-{
-    uint32_t endian;
-    uint32_t version;
-};
-
-/* KDBHdrInit
- *  simple initialization
- */
-#define KDBHdrInit( hdr, vers ) \
-    ( void ) ( ( hdr ) -> endian = eByteOrderTag, ( hdr ) -> version = vers )
-
-/* KDBHdrValidate
- *  validates that a header sports a supported byte order
- *  and that the version is within range
- */
-rc_t KDBHdrValidate ( const KDBHdr *hdr, size_t size,
-    uint32_t min_vers, uint32_t max_vers );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kdbfmt_priv_ */
diff --git a/libs/kdb/libkdb.vers.h b/libs/kdb/libkdb.vers.h
deleted file mode 100644
index 6d0ed76..0000000
--- a/libs/kdb/libkdb.vers.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#define LIBKDB_VERS 0x0102000D
diff --git a/libs/kdb/libwkdb.vers.h b/libs/kdb/libwkdb.vers.h
deleted file mode 100644
index 06e1100..0000000
--- a/libs/kdb/libwkdb.vers.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#define LIBWKDB_VERS 0x0102000D
diff --git a/libs/kdb/meta.c b/libs/kdb/meta.c
deleted file mode 100644
index 046ff89..0000000
--- a/libs/kdb/meta.c
+++ /dev/null
@@ -1,2141 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#define TRACK_REFERENCES 0
-
-#include <kdb/extern.h>
-
-struct KMDataNodeNamelist;
-#define KNAMELIST_IMPL struct KMDataNodeNamelist
-
-#define KONST const
-#include "kdb-priv.h"
-#include "dbmgr-priv.h"
-#include "database-priv.h"
-#include "table-priv.h"
-#include "column-priv.h"
-#include "kdbfmt-priv.h"
-#undef KONST
-
-#include <kdb/meta.h>
-#include <kdb/namelist.h>
-#include <klib/container.h>
-#include <klib/pbstree.h>
-#include <klib/namelist.h>
-#include <klib/impl.h>
-#include <kfs/file.h>
-#include <kfs/mmap.h>
-#include <klib/refcount.h>
-#include <klib/debug.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <strtol.h>
-#include <os-native.h>
-#include <sysalloc.h>
-#include <strtol.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <byteswap.h>
-#include <assert.h>
-
-#define KMETADATAVERS 2
-#define NODE_SIZE_LIMIT ( 25 * 1024 * 1024 )
-#define NODE_CHILD_LIMIT ( 100 * 1024 )
-
-
-typedef struct KMDataNodeInflateData KMDataNodeInflateData;
-struct KMDataNodeInflateData
-{
-    const KMetadata *meta;
-    const KMDataNode *par;
-    BSTree *bst;
-    size_t node_size_limit;
-    uint32_t node_child_limit;
-    rc_t rc;
-    bool byteswap;
-};
-
-/*--------------------------------------------------------------------------
- * KMetadata
- *  a versioned, hierarchical structure
- */
-struct KMetadata
-{
-    const KDirectory *dir;
-    const KDBManager *mgr;
-
-    /* owner */
-    const KDatabase *db;
-    const KTable *tbl;
-    const KColumn *col;
-
-    /* root node */
-    KMDataNode *root;
-
-    KRefcount refcount;
-    uint32_t vers;
-    uint32_t rev;
-    bool byteswap;
-    char path [ 1 ];
-};
-
-static
-KMetadata *KMetadataAttach ( const KMetadata *self );
-
-static
-rc_t KMetadataSever ( const KMetadata *self );
-
-
-/*--------------------------------------------------------------------------
- * KMAttrNode
- */
-typedef struct KMAttrNode KMAttrNode;
-struct KMAttrNode
-{
-    BSTNode n;
-    void *value;
-    size_t vsize;
-    char name [ 1 ];
-};
-
-static
-int CC KMAttrNodeCmp ( const void *item, const BSTNode *n )
-{
-#define a ( ( const char* ) item )
-#define b ( ( const KMAttrNode* ) n )
-
-    return strcmp ( a, b -> name );
-
-#undef a
-#undef b
-}
-
-static
-int CC KMAttrNodeSort ( const BSTNode *item, const BSTNode *n )
-{
-#define a ( ( const KMAttrNode* ) item )
-#define b ( ( const KMAttrNode* ) n )
-
-    return strcmp ( a -> name, b -> name );
-
-#undef a
-#undef b
-}
-
-static
-void CC KMAttrNodeWhack ( BSTNode *n, void *data )
-{
-    free ( n );
-}
-
-static
-bool CC KMAttrNodeInflate ( PBSTNode *n, void *data )
-{
-    KMAttrNode *b;
-    KMDataNodeInflateData *pb = data;
-
-    const char *name = n -> data . addr;
-    size_t size = strlen ( name );
-    if ( size >= n -> data . size )
-    {
-        pb -> rc = RC ( rcDB, rcMetadata, rcConstructing, rcData, rcCorrupt );
-        return true;
-    }
-
-    /* v2 attributes are more easily allocated
-       as a single (name,value) block because
-       there are no other associated structures */
-    b = malloc ( sizeof * b + n -> data . size );
-    if ( b == NULL )
-    {
-        pb -> rc = RC ( rcDB, rcMetadata, rcConstructing, rcMemory, rcExhausted );
-        return true;
-    }
-
-    b -> value = & b -> name [ 1 + size ];
-    b -> vsize = n -> data . size - size - 1;
-    memcpy ( b -> name, name, n -> data . size );
-    BSTreeInsert ( pb -> bst, & b -> n, KMAttrNodeSort );
-    return false;
-}
-
-
-/*--------------------------------------------------------------------------
- * KMDataNode
- *  a node with an optional value,
- *  optional attributes, and optional children
- *
- *  nodes are identified by path, relative to a starting node,
- *  where "/" serves as a path separator.
- */
-struct KMDataNode
-{
-    BSTNode n;
-    const KMDataNode *par;
-    const KMetadata *meta;
-    void *value;
-    size_t vsize;
-    BSTree attr;
-    BSTree child;
-    KRefcount refcount;
-    char name [ 1 ];
-};
-
-static
-int CC KMDataNodeCmp ( const void *item, const BSTNode *n )
-{
-#define a ( ( const char* ) item )
-#define b ( ( const KMDataNode* ) n )
-
-    return strcmp ( a, b -> name );
-
-#undef a
-#undef b
-}
-
-static
-int CC KMDataNodeSort ( const BSTNode *item, const BSTNode *n )
-{
-#define a ( ( const KMDataNode* ) item )
-#define b ( ( const KMDataNode* ) n )
-
-    return strcmp ( a -> name, b -> name );
-
-#undef a
-#undef b
-}
-
-static
-void CC KMDataNodeWhack ( BSTNode *n, void *data )
-{
-    KMDataNode *self = ( KMDataNode* ) n;
-
-    REFMSG ( "KMDataNode", "flush", & self -> refcount );
-
-    self -> meta = NULL;
-    atomic32_inc ( & self -> refcount );
-    KMDataNodeRelease ( self );
-}
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-LIB_EXPORT rc_t CC KMDataNodeAddRef ( const KMDataNode *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KMDataNode" ) )
-        {
-        case krefLimit:
-            return RC ( rcDB, rcMetadata, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeRelease ( const KMDataNode *cself )
-{
-    KMDataNode *self = ( KMDataNode* ) cself;
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KMDataNode" ) )
-        {
-        case krefOkay:
-            return KMetadataSever ( self -> meta );
-        case krefWhack:
-
-            if ( self -> meta != NULL )
-                return KMetadataSever ( self -> meta );
-
-            KRefcountWhack ( & self -> refcount, "KMDataNode" );
-
-            BSTreeWhack ( & self -> attr, KMAttrNodeWhack, NULL );
-            BSTreeWhack ( & self -> child, KMDataNodeWhack, NULL );
-            free ( self -> value );
-            free ( self );
-            break;
-
-        case krefNegative:
-            return RC ( rcDB, rcMetadata, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-/* Inflate
- */
-static
-bool CC KMDataNodeInflate_v1 ( PBSTNode *n, void *data )
-{
-    void *value;
-    KMDataNode *b;
-    KMDataNodeInflateData *pb = data;
-
-    /* v1 metadata are flat, with the name
-       stored as a NUL terminated string
-       followed by value payload */
-    const char *name = n -> data . addr;
-    size_t size = strlen ( name );
-    if ( size >= n -> data . size )
-    {
-        pb -> rc = RC ( rcDB, rcMetadata, rcConstructing, rcData, rcCorrupt );
-        return true;
-    }
-
-    b = malloc ( sizeof * b + size );
-    if ( b == NULL )
-    {
-        pb -> rc = RC ( rcDB, rcMetadata, rcConstructing, rcMemory, rcExhausted );
-        return true;
-    }
-
-    b -> par = pb -> par;
-    b -> meta = pb -> meta;
-    b -> value = ( void* ) ( name + size + 1 );
-    b -> vsize = n -> data . size - size - 1;
-    BSTreeInit ( & b -> attr );
-    BSTreeInit ( & b -> child );
-    KRefcountInit ( & b -> refcount, 0, "KMDataNode", "inflate", name );
-    strcpy ( b -> name, name );
-     
-    /* a name with no associated value */
-    if ( b -> vsize == 0 )
-    {
-        b -> value = NULL;
-        BSTreeInsert ( pb -> bst, & b -> n, KMDataNodeSort );
-        return false;
-    }
-
-    /* allocate value because v2+ code expects this */
-    value = malloc ( b -> vsize );
-    if ( value != NULL )
-    {
-        memcpy ( value, b -> value, b -> vsize );
-        b -> value = value;
-        BSTreeInsert ( pb -> bst, & b -> n, KMDataNodeSort );
-        return false;
-    }
-
-    pb -> rc = RC ( rcDB, rcMetadata, rcConstructing, rcMemory, rcExhausted );
-    free ( b );
-    return true;
-}
-
-static
-rc_t KMDataNodeInflateAttr ( KMDataNode *n, bool byteswap )
-{
-    PBSTree *bst;
-    rc_t rc = PBSTreeMake ( & bst, n -> value, n -> vsize, byteswap );
-    if ( rc != 0 )
-        rc = RC ( rcDB, rcMetadata, rcConstructing, rcData, rcCorrupt );
-    else
-    {
-        KMDataNodeInflateData pb;
-        size_t bst_size = PBSTreeSize ( bst );
-        
-        pb . meta = n -> meta;
-        pb . par = n;
-        pb . bst = & n -> attr;
-        pb . node_size_limit = NODE_SIZE_LIMIT;
-        pb . node_child_limit = NODE_CHILD_LIMIT;
-        pb . rc = 0;
-        pb . byteswap = byteswap;
-        PBSTreeDoUntil ( bst, 0, KMAttrNodeInflate, & pb );
-        rc = pb . rc;
-        
-        PBSTreeWhack ( bst );
-        
-        n -> value = ( char* ) n -> value + bst_size;
-        n -> vsize -= bst_size;
-    }
-    return rc;
-}
-
-static
-bool CC KMDataNodeInflate ( PBSTNode *n, void *data );
-
-static
-rc_t KMDataNodeInflateChild ( KMDataNode *n,
-    size_t node_size_limit, uint32_t node_child_limit, bool byteswap )
-{
-    PBSTree *bst;
-    rc_t rc = PBSTreeMake ( & bst, n -> value, n -> vsize, byteswap );
-    if ( rc != 0 )
-        rc = RC ( rcDB, rcMetadata, rcConstructing, rcData, rcCorrupt );
-    else
-    {
-        uint32_t bst_count = PBSTreeCount ( bst );
-        size_t bst_size = PBSTreeSize ( bst );
-        if ( bst_count > node_child_limit )
-        {
-            PLOGMSG ( klogWarn, ( klogWarn,
-                                  "refusing to inflate metadata node '$(node)' within file '$(path)': "
-                                  "number of children ($(num_children)) exceeds limit ($(limit))."
-                                  , "node=%s,path=%s,num_children=%u,limit=%u"
-                                  , n -> name
-                                  , n -> meta -> path
-                                  , bst_count
-                                  , node_child_limit )
-                );
-        }
-        else if ( bst_size > node_size_limit )
-        {
-            PLOGMSG ( klogWarn, ( klogWarn,
-                                  "refusing to inflate metadata node '$(node)' within file '$(path)': "
-                                 "node size ($(node_size)) exceeds limit ($(limit))."
-                                 , "node=%s,path=%s,node_size=%zu,limit=%zu"
-                                 , n -> name
-                                 , n -> meta -> path
-                                 , bst_size
-                                 , node_size_limit )
-                );
-        }
-        else
-        {
-            KMDataNodeInflateData pb;
-            pb . meta = n -> meta;
-            pb . par = n;        
-            pb . bst = & n -> child;
-            pb . node_size_limit = node_size_limit;
-            pb . node_child_limit = node_child_limit;
-            pb . rc = 0;
-            pb . byteswap = byteswap;
-            PBSTreeDoUntil ( bst, 0, KMDataNodeInflate, & pb );
-            rc = pb . rc;
-        }
-        
-        PBSTreeWhack ( bst );
-        
-        n -> value = ( char* ) n -> value + bst_size;
-        n -> vsize -= bst_size;
-    }
-    return rc;
-}
-
-static
-bool CC KMDataNodeInflate ( PBSTNode *n, void *data )
-{
-    KMDataNode *b;
-    KMDataNodeInflateData *pb = data;
-
-    /* v2 names are preceded by a decremented length byte
-       that has its upper two bits dedicated to
-       signaling existence of attributes & children */
-    const char *name = n -> data . addr;
-    int bits = * ( ( const uint8_t* ) name ++ );
-    size_t size = ( bits >> 2 ) + 1;
-    if ( size >= n -> data . size )
-    {
-        pb -> rc = RC ( rcDB, rcMetadata, rcConstructing, rcData, rcCorrupt );
-        return true;
-    }
-
-    b = malloc ( sizeof * b + size );
-    if ( b == NULL )
-    {
-        pb -> rc = RC ( rcDB, rcMetadata, rcConstructing, rcMemory, rcExhausted );
-        return true;
-    }
-
-    b -> par = pb -> par;
-    b -> meta = pb -> meta;
-    b -> value = ( void* ) ( name + size );
-    b -> vsize = n -> data . size - size - 1;
-    BSTreeInit ( & b -> attr );
-    BSTreeInit ( & b -> child );
-    KRefcountInit ( & b -> refcount, 0, "KMDataNode", "inflate", b -> name );
-    memcpy ( b -> name, name, size );
-    b -> name [ size ] = 0;
-
-    pb -> rc = ( bits & 1 ) != 0 ? KMDataNodeInflateAttr ( b, pb -> byteswap ) : 0;
-    if ( pb -> rc == 0 )
-    {
-        pb -> rc = ( bits & 2 ) != 0 ?
-            KMDataNodeInflateChild ( b, pb -> node_size_limit, pb -> node_child_limit, pb -> byteswap ) : 0;
-        if ( pb -> rc == 0 )
-        {
-            void *value;
-
-            if ( b -> vsize == 0 )
-            {
-                b -> value = NULL;
-                BSTreeInsert ( pb -> bst, & b -> n, KMDataNodeSort );
-                return false;
-            }
-
-            value = malloc ( b -> vsize );
-            if ( value != NULL )
-            {
-                memcpy ( value, b -> value, b -> vsize );
-                b -> value = value;
-                BSTreeInsert ( pb -> bst, & b -> n, KMDataNodeSort );
-                return false;
-            }
-            pb -> rc = RC ( rcDB, rcMetadata, rcConstructing, rcMemory, rcExhausted );
-
-            BSTreeWhack ( & b -> child, KMDataNodeWhack, NULL );
-        }
-
-        BSTreeWhack ( & b -> attr, KMAttrNodeWhack, NULL );
-    }
-
-    free ( b );
-    return true;
-}
-
-
-/* Find
- */
-static
-rc_t KMDataNodeFind ( const KMDataNode *self, const KMDataNode **np, char **path )
-{
-    const KMDataNode *found;
-
-    char *end, *name = * path;
-
-    /* interpret leading '/' */
-    if ( name [ 0 ] == '/' )
-    {
-        while ( self -> par != NULL )
-            self = self -> par;
-        ++ name;
-    }
-
-    /* find node */
-    for ( found = self; name != NULL; self = found, name = end )
-    {
-        /* segment path */
-        end = strchr ( name, '/' );
-        if ( end != NULL )
-            * end ++ = 0;
-
-        /* interpret special paths */
-        switch ( name [ 0 ] )
-        {
-        case 0:
-            continue;
-        case '.':
-            switch ( name [ 1 ] )
-            {
-            case 0:
-                continue;
-            case '.':
-                if ( name [ 2 ] == 0 )
-                {
-                    /* this is a backup */
-                    if ( ( self = self -> par ) == NULL )
-                        return RC ( rcDB, rcMetadata, rcSelecting, rcPath, rcInvalid );
-                    continue;
-                }
-                break;
-            }
-            break;
-        }
-
-        /* find actual path */
-        found = ( const KMDataNode* )
-            BSTreeFind ( & self -> child, name, KMDataNodeCmp );
-        if ( found == NULL )
-        {
-            /* not found also gets partially found state */
-            if ( end != NULL )
-                end [ -1 ] = '/';
-            * path = name;
-            * np = self;
-            return RC ( rcDB, rcMetadata, rcSelecting, rcPath, rcNotFound );
-        }
-    }
-
-    /* the current self is our guy */
-    * np = self;
-    return 0;
-}
-
-
-/* OpenNodeRead
- * VOpenNodeRead
- *  opens a metadata node
- *
- *  "node" [ OUT ] - return parameter for indicated metadata node
- *
- *  "path" [ IN, NULL OKAY ] - optional path for specifying named
- *  node within metadata hierarchy. when NULL, empty, ".", or "/",
- *  return root node in "node". path separator is "/".
- */
-LIB_EXPORT rc_t CC KMDataNodeVOpenNodeRead ( const KMDataNode *self,
-    const KMDataNode **node, const char *path, va_list args )
-{
-    rc_t rc;
-    KMDataNode *found;
-    char full [ 4096 ], *p = full;
-
-    if ( node == NULL )
-        return RC ( rcDB, rcNode, rcOpening, rcParam, rcNull );
-
-    * node = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcNode, rcOpening, rcSelf, rcNull );
-
-    /* handle special NULL path */
-    if ( path == NULL )
-        full [ 0 ] = 0;
-    else
-    {
-        int len;
-
-        /* generate full path */
-        if ( args == NULL )
-            len = snprintf ( full, sizeof full, "%s", path );
-        else
-            len = vsnprintf ( full, sizeof full, path, args );
-        if ( len < 0 || len >= sizeof full )
-            return RC ( rcDB, rcNode, rcOpening, rcPath, rcExcessive );
-    }
-
-    rc = KMDataNodeFind ( self, ( const KMDataNode** ) & found, & p );
-    if ( rc == 0 )
-    {
-        KMetadataAttach ( found -> meta );
-        KMDataNodeAddRef ( found );
-        * node = found;
-    }
-
-    DBGMSG(DBG_KDB, DBG_FLAG(DBG_KDB_KDB),
-                ("KMDataNodeVOpenNodeRead(%s) = %d\n", full, rc));
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeOpenNodeRead ( const KMDataNode *self,
-    const KMDataNode **node, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KMDataNodeVOpenNodeRead ( self, node, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMetadataVOpenNodeRead ( const KMetadata *self,
-    const KMDataNode **node, const char *path, va_list args )
-{
-    rc_t rc = 0;
-
-    if ( node == NULL )
-        rc = RC ( rcDB, rcMetadata, rcOpening, rcParam, rcNull );
-    else if ( self == NULL )
-    {
-        * node = NULL;
-        rc = RC ( rcDB, rcMetadata, rcOpening, rcSelf, rcNull );
-    }
-    else
-        rc = KMDataNodeVOpenNodeRead ( self -> root, node, path, args );
-
-    DBGMSG(DBG_KDB, DBG_FLAG(DBG_KDB_KDB),
-                ("KMetadataVOpenNodeRead(%s) = %d\n", path, rc));
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMetadataOpenNodeRead ( const KMetadata *self,
-    const KMDataNode **node, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KMetadataVOpenNodeRead ( self, node, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* ByteOrder
- *  indicates whether original byte order is reversed
- *  under current architecture.
- *
- *  the byte order of the column is established by
- *  the host architecture when created.
- *
- *  "reversed" [ OUT ] - if true, the original byte
- *  order is reversed with regard to host native byte order.
- */
-LIB_EXPORT rc_t CC KMDataNodeByteOrder ( const KMDataNode *self, bool *reversed )
-{
-    if ( self != NULL )
-        return KMetadataByteOrder ( self -> meta, reversed );
-
-    if ( reversed == NULL )
-        return RC ( rcDB, rcMetadata, rcAccessing, rcParam, rcNull );
-
-    * reversed = false;
-    return RC ( rcDB, rcMetadata, rcAccessing, rcSelf, rcNull );
-}
-
-
-/* Read
- *  read a node value or attribute
- *
- *  "offset" [ IN ] - initial offset into metadata
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT ] - number of bytes actually read
- *
- *  "remaining" [ OUT, NULL OKAY ] - optional return parameter for
- *  the number of bytes remaining to be read.
- *  specifically, "offset" + "num_read" + "remaining" == sizeof node data
- */
-LIB_EXPORT rc_t CC KMDataNodeRead ( const KMDataNode *self,
-    size_t offset, void *buffer, size_t bsize,
-    size_t *num_read, size_t *remaining )
-{
-    rc_t rc;
-
-    size_t dummy;
-    if ( remaining == NULL )
-        remaining = & dummy;
-
-    if ( num_read == NULL )
-        rc = RC ( rcDB, rcNode, rcReading, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcNode, rcReading, rcSelf, rcNull );
-        else if ( buffer == NULL && bsize != 0 )
-            rc = RC ( rcDB, rcNode, rcReading, rcBuffer, rcNull );
-        else
-        {
-            size_t to_read, avail = self -> vsize;
-            if ( offset > avail )
-                offset = avail;
-
-            to_read = avail -= offset;
-            if ( to_read > bsize )
-                to_read = bsize;
-
-            if ( to_read > 0 )
-                memcpy ( buffer, ( const char* ) self -> value + offset, to_read );
-
-            * num_read = to_read;
-            * remaining = avail - to_read;
-
-            return 0;
-        }
-
-        * num_read = 0;
-    }
-
-    * remaining = 0;
-    return rc;
-}
-
-
-/* Addr - PRIVATE
- *  reach into node and get address
- *  returns raw pointer and node size
- */
-LIB_EXPORT rc_t CC KMDataNodeAddr ( const KMDataNode *self,
-    const void **addr, size_t *size )
-{
-    rc_t rc;
-
-    size_t dummy;
-    if ( size == NULL )
-        size = & dummy;
-
-    if ( addr == NULL )
-        rc = RC ( rcDB, rcMetadata, rcReading, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcMetadata, rcReading, rcSelf, rcNull );
-        else
-        {
-            * addr = self -> value;
-            * size = self -> vsize;
-
-            return 0;
-        }
-
-        * addr = NULL;
-    }
-
-    * size = 0;
-    return rc;
-}
-
-
-/* Read ( formatted )
- *  reads as integer or float value in native byte order
- *
- *  "bXX" [ OUT ] - return parameter for numeric value
- */
-LIB_EXPORT rc_t CC KMDataNodeReadB8 ( const KMDataNode *self, void *b8 )
-{
-    size_t num_read, remaining;
-    rc_t rc = KMDataNodeRead ( self, 0, b8, 1,
-        & num_read, & remaining );
-    if ( rc == 0 )
-    {
-        if ( remaining != 0 )
-            return RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-        if ( num_read < 1 )
-            return RC ( rcDB, rcMetadata, rcReading, rcTransfer, rcIncomplete );
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadB16 ( const KMDataNode *self, void *b16 )
-{
-    size_t num_read, remaining;
-    rc_t rc = KMDataNodeRead ( self, 0, b16, 2,
-        & num_read, & remaining );
-    if ( rc == 0 )
-    {
-        if ( remaining != 0 )
-            return RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-        if ( num_read < 2 )
-            return RC ( rcDB, rcMetadata, rcReading, rcTransfer, rcIncomplete );
-
-        if ( self -> meta -> byteswap )
-            * ( uint16_t* ) b16 = bswap_16 ( * ( const uint16_t* ) b16 );
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadB32 ( const KMDataNode *self, void *b32 )
-{
-    size_t num_read, remaining;
-    rc_t rc = KMDataNodeRead ( self, 0, b32, 4,
-        & num_read, & remaining );
-    if ( rc == 0 )
-    {
-        if ( remaining != 0 )
-            return RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-        if ( num_read < 4 )
-            return RC ( rcDB, rcMetadata, rcReading, rcTransfer, rcIncomplete );
-
-        if ( self -> meta -> byteswap )
-            * ( uint32_t* ) b32 = bswap_32 ( * ( const uint32_t* ) b32 );
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadB64 ( const KMDataNode *self, void *b64 )
-{
-    size_t num_read, remaining;
-    rc_t rc = KMDataNodeRead ( self, 0, b64, 8,
-        & num_read, & remaining );
-    if ( rc == 0 )
-    {
-        if ( remaining != 0 )
-            return RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-        if ( num_read < 8 )
-            return RC ( rcDB, rcMetadata, rcReading, rcTransfer, rcIncomplete );
-
-        if ( self -> meta -> byteswap )
-            * ( uint64_t* ) b64 = bswap_64 ( * ( const uint64_t* ) b64 );
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadB128 ( const KMDataNode *self, void *b128 )
-{
-    size_t num_read, remaining;
-    rc_t rc = KMDataNodeRead ( self, 0, b128, 16,
-        & num_read, & remaining );
-    if ( rc == 0 )
-    {
-        if ( remaining != 0 )
-            return RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-        if ( num_read < 16 )
-            return RC ( rcDB, rcMetadata, rcReading, rcTransfer, rcIncomplete );
-
-        if ( self -> meta -> byteswap )
-        {
-            uint64_t *b64 = b128;
-            uint64_t tmp = bswap_64 ( b64 [ 0 ] );
-            b64 [ 0 ] = bswap_64 ( b64 [ 1 ] );
-            b64 [ 1 ] = tmp;
-        }
-    }
-    return rc;
-}
-
-
-/* ReadAs ( formatted )
- *  reads as integer or float value in native byte order
- *  casts smaller-sized values to desired size, e.g.
- *    uint32_t to uint64_t
- *
- *  "i" [ OUT ] - return parameter for signed integer
- *  "u" [ OUT ] - return parameter for unsigned integer
- *  "f" [ OUT ] - return parameter for double float
- */
-LIB_EXPORT rc_t CC KMDataNodeReadAsI16 ( const KMDataNode *self, int16_t *i )
-{
-    size_t num_read, remaining;
-    rc_t rc = KMDataNodeRead ( self, 0, i, sizeof * i,
-        & num_read, & remaining );
-    if ( rc == 0 )
-    {
-        if ( remaining != 0 )
-            return RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-
-        switch ( num_read )
-        {
-        case 1:
-            * i = ( ( const int8_t* ) i ) [ 0 ];
-            break;
-        case 2:
-            if ( self -> meta -> byteswap )
-                * i = bswap_16 ( * i );
-            break;
-        default:
-            return RC ( rcDB, rcMetadata, rcReading, rcTransfer, rcIncomplete );
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadAsU16 ( const KMDataNode *self, uint16_t *u )
-{
-    size_t num_read, remaining;
-    rc_t rc = KMDataNodeRead ( self, 0, u, sizeof * u,
-        & num_read, & remaining );
-    if ( rc == 0 )
-    {
-        if ( remaining != 0 )
-            return RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-
-        switch ( num_read )
-        {
-        case 1:
-            * u = ( ( const uint8_t* ) u ) [ 0 ];
-            break;
-        case 2:
-            if ( self -> meta -> byteswap )
-                * u = bswap_16 ( * u );
-            break;
-        default:
-            return RC ( rcDB, rcMetadata, rcReading, rcTransfer, rcIncomplete );
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadAsI32 ( const KMDataNode *self, int32_t *i )
-{
-    size_t num_read, remaining;
-    rc_t rc = KMDataNodeRead ( self, 0, i, sizeof * i,
-        & num_read, & remaining );
-    if ( rc == 0 )
-    {
-        if ( remaining != 0 )
-            return RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-
-        switch ( num_read )
-        {
-        case 1:
-            * i = ( ( const int8_t* ) i ) [ 0 ];
-            break;
-        case 2:
-            if ( self -> meta -> byteswap )
-                * i = bswap_16 ( ( ( const int16_t* ) i ) [ 0 ] );
-            else
-                * i = ( ( const int16_t* ) i ) [ 0 ];
-            break;
-        case 4:
-            if ( self -> meta -> byteswap )
-                * i = bswap_32 ( * i );
-            break;
-        default:
-            return RC ( rcDB, rcMetadata, rcReading, rcTransfer, rcIncomplete );
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadAsU32 ( const KMDataNode *self, uint32_t *u )
-{
-    size_t num_read, remaining;
-    rc_t rc = KMDataNodeRead ( self, 0, u, sizeof * u,
-        & num_read, & remaining );
-    if ( rc == 0 )
-    {
-        if ( remaining != 0 )
-            return RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-
-        switch ( num_read )
-        {
-        case 1:
-            * u = ( ( const uint8_t* ) u ) [ 0 ];
-            break;
-        case 2:
-            if ( self -> meta -> byteswap )
-                * u = bswap_16 ( ( ( const uint16_t* ) u ) [ 0 ] );
-            else
-                * u = ( ( const uint16_t* ) u ) [ 0 ];
-            break;
-        case 4:
-            if ( self -> meta -> byteswap )
-                * u = bswap_32 ( * u );
-            break;
-        default:
-            return RC ( rcDB, rcMetadata, rcReading, rcTransfer, rcIncomplete );
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadAsI64 ( const KMDataNode *self, int64_t *i )
-{
-    size_t num_read, remaining;
-    rc_t rc = KMDataNodeRead ( self, 0, i, sizeof * i,
-        & num_read, & remaining );
-    if ( rc == 0 )
-    {
-        if ( remaining != 0 )
-            return RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-
-        switch ( num_read )
-        {
-        case 1:
-            * i = ( ( const int8_t* ) i ) [ 0 ];
-            break;
-        case 2:
-            if ( self -> meta -> byteswap )
-                * i = bswap_16 ( ( ( const int16_t* ) i ) [ 0 ] );
-            else
-                * i = ( ( const int16_t* ) i ) [ 0 ];
-            break;
-        case 4:
-            if ( self -> meta -> byteswap )
-                * i = bswap_32 ( ( ( const int32_t* ) i ) [ 0 ] );
-            else
-                * i = ( ( const int32_t* ) i ) [ 0 ];
-            break;
-        case 8:
-            if ( self -> meta -> byteswap )
-                * i = bswap_64 ( * i );
-            break;
-        default:
-            return RC ( rcDB, rcMetadata, rcReading, rcTransfer, rcIncomplete );
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadAsU64 ( const KMDataNode *self, uint64_t *u )
-{
-    size_t num_read, remaining;
-    rc_t rc = KMDataNodeRead ( self, 0, u, sizeof * u,
-        & num_read, & remaining );
-    if ( rc == 0 )
-    {
-        if ( remaining != 0 )
-            return RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-
-        switch ( num_read )
-        {
-        case 1:
-            * u = ( ( const uint8_t* ) u ) [ 0 ];
-            break;
-        case 2:
-            if ( self -> meta -> byteswap )
-                * u = bswap_16 ( ( ( const uint16_t* ) u ) [ 0 ] );
-            else
-                * u = ( ( const uint16_t* ) u ) [ 0 ];
-            break;
-        case 4:
-            if ( self -> meta -> byteswap )
-                * u = bswap_32 ( ( ( const uint32_t* ) u ) [ 0 ] );
-            else
-                * u = ( ( const uint32_t* ) u ) [ 0 ];
-            break;
-        case 8:
-            if ( self -> meta -> byteswap )
-                * u = bswap_64 ( * u );
-            break;
-        default:
-            return RC ( rcDB, rcMetadata, rcReading, rcTransfer, rcIncomplete );
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadAsF64 ( const KMDataNode *self, double *f )
-{
-    size_t num_read, remaining;
-    rc_t rc = KMDataNodeRead ( self, 0, f, sizeof * f,
-        & num_read, & remaining );
-    if ( rc == 0 )
-    {
-        if ( remaining != 0 )
-            return RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-
-        switch ( num_read )
-        {
-        case 4:
-            if ( self -> meta -> byteswap )
-                * ( uint32_t* ) f = bswap_32 ( * ( const uint32_t* ) f );
-            * f = ( ( const float* ) f ) [ 0 ];
-            break;
-        case 8:
-            if ( self -> meta -> byteswap )
-                * ( uint64_t* ) f = bswap_64 ( * ( const uint64_t* ) f );
-            break;
-        default:
-            return RC ( rcDB, rcMetadata, rcReading, rcTransfer, rcIncomplete );
-        }
-    }
-    return rc;
-}
-
-
-/* Read ( formatted )
- *  reads as C-string
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - output buffer for
- *  NUL terminated string.
- *
- *  "size" [ OUT ] - return parameter giving size of string
- *  not including NUL byte. the size is set both upon success
- *  and insufficient buffer space error.
- */
-LIB_EXPORT rc_t CC KMDataNodeReadCString ( const KMDataNode *self,
-    char *buffer, size_t bsize, size_t *size )
-{
-    size_t remaining;
-    rc_t rc = KMDataNodeRead ( self, 0, buffer, bsize - 1, size, & remaining );
-    if ( rc == 0 )
-    {
-        if ( remaining != 0 )
-        {
-            * size += remaining;
-            return RC ( rcDB, rcMetadata, rcReading, rcBuffer, rcInsufficient );
-        }
-
-        buffer [ * size ] = 0;
-    }
-    return rc;
-}
-
-
-/* ReadAttr
- *  reads as NUL-terminated string
- *
- *  "name" [ IN ] - NUL terminated attribute name
- *
- *  "buffer" [ OUT ] and "bsize" - return parameter for attribute value
- *
- *  "size" [ OUT ] - return parameter giving size of string
- *  not including NUL byte. the size is set both upon success
- *  and insufficient buffer space error.
- */
-LIB_EXPORT rc_t CC KMDataNodeReadAttr ( const KMDataNode *self, const char *name,
-    char *buffer, size_t bsize, size_t *size )
-{
-    rc_t rc;
-
-    if ( size == NULL )
-        rc = RC ( rcDB, rcMetadata, rcReading, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcMetadata, rcReading, rcSelf, rcNull );
-        else if ( name == NULL )
-            rc = RC ( rcDB, rcMetadata, rcReading, rcString, rcNull );
-        else if ( name [ 0 ] == 0 )
-            rc = RC ( rcDB, rcMetadata, rcReading, rcString, rcEmpty );
-        else if ( buffer == NULL && bsize != 0 )
-            rc = RC ( rcDB, rcMetadata, rcReading, rcBuffer, rcNull );
-        else
-        {
-            const KMAttrNode *n = ( const KMAttrNode* )
-                BSTreeFind ( & self -> attr, name, KMAttrNodeCmp );
-            if ( n == NULL )
-            {
-                * size = 0;
-                if ( bsize != 0 )
-                    buffer [ 0 ] = 0;
-                rc = RC ( rcDB, rcMetadata, rcReading, rcAttr, rcNotFound );
-            }
-            else
-            {
-                * size = n -> vsize;
-                if ( n -> vsize < bsize )
-                {
-                    memcpy ( buffer, n -> value, n -> vsize );
-                    buffer [ n -> vsize ] = 0;
-                    return 0;
-                }
-
-                return RC ( rcDB, rcMetadata, rcReading, rcBuffer, rcInsufficient );
-            }
-        }
-
-        * size = 0;
-    }
-
-    return rc;
-}
-
-
-/* ReadAttrAs ( formatted )
- *  reads as integer or float value in native byte order
- *  casts smaller-sized values to desired size, e.g.
- *    uint32_t to uint64_t
- *
- *  "i" [ OUT ] - return parameter for signed integer
- *  "u" [ OUT ] - return parameter for unsigned integer
- *  "f" [ OUT ] - return parameter for double float
- */
-LIB_EXPORT rc_t CC KMDataNodeReadAttrAsI16 ( const KMDataNode *self, const char *attr, int16_t *i )
-{
-    rc_t rc;
-    if ( i == NULL )
-        rc = RC ( rcDB, rcMetadata, rcReading, rcParam, rcNull );
-    else
-    {
-        size_t size;
-        char buffer [ 256 ];
-        rc = KMDataNodeReadAttr ( self, attr, buffer, sizeof buffer, & size );
-        if ( rc == 0 )
-        {
-            char *end;
-            int64_t val = strtoi64 ( buffer, & end, 0 );
-            if ( end [ 0 ] != 0 )
-                rc = RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-            else if ( val < SHRT_MIN || val > SHRT_MAX )
-                rc = RC ( rcDB, rcMetadata, rcReading, rcRange, rcExcessive );
-            else
-            {
-                * i = ( int16_t ) val;
-                return 0;
-            }
-        }
-
-        * i = 0;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadAttrAsU16 ( const KMDataNode *self, const char *attr, uint16_t *u )
-{
-    rc_t rc;
-    if ( u == NULL )
-        rc = RC ( rcDB, rcMetadata, rcReading, rcParam, rcNull );
-    else
-    {
-        size_t size;
-        char buffer [ 256 ];
-        rc = KMDataNodeReadAttr ( self, attr, buffer, sizeof buffer, & size );
-        if ( rc == 0 )
-        {
-            char *end;
-            uint64_t val = strtou64 ( buffer, & end, 0 );
-            if ( end [ 0 ] != 0 )
-                rc = RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-            else if ( val > USHRT_MAX )
-                rc = RC ( rcDB, rcMetadata, rcReading, rcRange, rcExcessive );
-            else
-            {
-                * u = ( uint16_t ) val;
-                return 0;
-            }
-        }
-
-        * u = 0;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadAttrAsI32 ( const KMDataNode *self, const char *attr, int32_t *i )
-{
-    rc_t rc;
-    if ( i == NULL )
-        rc = RC ( rcDB, rcMetadata, rcReading, rcParam, rcNull );
-    else
-    {
-        size_t size;
-        char buffer [ 256 ];
-        rc = KMDataNodeReadAttr ( self, attr, buffer, sizeof buffer, & size );
-        if ( rc == 0 )
-        {
-            char *end;
-            int64_t val = strtoi64 ( buffer, & end, 0 );
-            if ( end [ 0 ] != 0 )
-                rc = RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-            else if ( val < INT_MIN || val > INT_MAX )
-                rc = RC ( rcDB, rcMetadata, rcReading, rcRange, rcExcessive );
-            else
-            {
-                * i = ( int32_t ) val;
-                return 0;
-            }
-        }
-
-        * i = 0;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadAttrAsU32 ( const KMDataNode *self, const char *attr, uint32_t *u )
-{
-    rc_t rc;
-    if ( u == NULL )
-        rc = RC ( rcDB, rcMetadata, rcReading, rcParam, rcNull );
-    else
-    {
-        size_t size;
-        char buffer [ 256 ];
-        rc = KMDataNodeReadAttr ( self, attr, buffer, sizeof buffer, & size );
-        if ( rc == 0 )
-        {
-            char *end;
-            uint64_t val = strtou64 ( buffer, & end, 0 );
-            if ( end [ 0 ] != 0 )
-                rc = RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-            else if ( val > UINT_MAX )
-                rc = RC ( rcDB, rcMetadata, rcReading, rcRange, rcExcessive );
-            else
-            {
-                * u = ( uint32_t ) val;
-                return 0;
-            }
-        }
-
-        * u = 0;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadAttrAsI64 ( const KMDataNode *self, const char *attr, int64_t *i )
-{
-    rc_t rc;
-    if ( i == NULL )
-        rc = RC ( rcDB, rcMetadata, rcReading, rcParam, rcNull );
-    else
-    {
-        size_t size;
-        char buffer [ 256 ];
-        rc = KMDataNodeReadAttr ( self, attr, buffer, sizeof buffer, & size );
-        if ( rc == 0 )
-        {
-            char *end;
-            int64_t val =  strtoi64 ( buffer, & end, 0 );
-            if ( end [ 0 ] != 0 )
-                rc = RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-            else
-            {
-                * i = val;
-                return 0;
-            }
-        }
-
-        * i = 0;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadAttrAsU64 ( const KMDataNode *self, const char *attr, uint64_t *u )
-{
-    rc_t rc;
-    if ( u == NULL )
-        rc = RC ( rcDB, rcMetadata, rcReading, rcParam, rcNull );
-    else
-    {
-        size_t size;
-        char buffer [ 256 ];
-        rc = KMDataNodeReadAttr ( self, attr, buffer, sizeof buffer, & size );
-        if ( rc == 0 )
-        {
-            char *end;
-            uint64_t val =  strtou64 ( buffer, & end, 0 );
-            if ( end [ 0 ] != 0 )
-                rc = RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-            else
-            {
-                * u = val;
-                return 0;
-            }
-        }
-
-        * u = 0;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadAttrAsF64 ( const KMDataNode *self, const char *attr, double *f )
-{
-    rc_t rc;
-    if ( f == NULL )
-        rc = RC ( rcDB, rcMetadata, rcReading, rcParam, rcNull );
-    else
-    {
-        size_t size;
-        char buffer [ 256 ];
-        rc = KMDataNodeReadAttr ( self, attr, buffer, sizeof buffer, & size );
-        if ( rc == 0 )
-        {
-            char *end;
-            double val = strtod ( buffer, & end );
-            if ( end [ 0 ] != 0 )
-                rc = RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-            else
-            {
-                * f = val;
-                return 0;
-            }
-        }
-
-        * f = 0.0;
-    }
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * KMetadata
- *  a versioned, hierarchical structure
- */
-
-/* Whack
- */
-static
-rc_t KMetadataWhack ( KMetadata *self )
-{
-    rc_t rc = 0;
-
-    KRefcountWhack ( & self -> refcount, "KMetadata" );
-
-    if ( self -> db != NULL )
-    {
-        rc = KDatabaseSever ( self -> db );
-        if ( rc == 0 )
-            self -> db = NULL;
-    }
-    else if ( self -> tbl != NULL )
-    {
-        rc = KTableSever ( self -> tbl );
-        if ( rc == 0 )
-            self -> tbl = NULL;
-    }
-    else if ( self -> col != NULL )
-    {
-        rc = KColumnSever ( self -> col );
-        if ( rc == 0 )
-            self -> col = NULL;
-    }
-
-    if ( rc == 0 )
-        rc = KDBManagerSever ( self -> mgr );
-
-    if ( rc == 0 )
-    {
-        KDirectoryRelease ( self -> dir );
-        KMDataNodeWhack ( ( BSTNode* ) & self -> root -> n, NULL );
-        free ( self );
-        return 0;
-    }
-
-    KRefcountInit ( & self -> refcount, 1, "KMetadata", "whack", "kmeta" );
-    return rc;
-}
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-LIB_EXPORT rc_t CC KMetadataAddRef ( const KMetadata *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KMetadata" ) )
-        {
-        case krefLimit:
-            return RC ( rcDB, rcMetadata, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KMetadataRelease ( const KMetadata *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KMetadata" ) )
-        {
-        case krefWhack:
-            return KMetadataWhack ( ( KMetadata* ) self );
-        case krefNegative:
-            return RC ( rcDB, rcMetadata, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-static
-KMetadata *KMetadataAttach ( const KMetadata *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAddDep ( & self -> refcount, "KMetadata" ) )
-        {
-        case krefLimit:
-            return NULL;
-        }
-    }
-    return ( KMetadata* ) self;
-}
-
-static
-rc_t KMetadataSever ( const KMetadata *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDropDep ( & self -> refcount, "KMetadata" ) )
-        {
-        case krefWhack:
-            return KMetadataWhack ( ( KMetadata* ) self );
-        case krefNegative:
-            return RC ( rcDB, rcMetadata, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-/* Make
- */
-
-static
-rc_t KMetadataPopulate ( KMetadata *self, const KDirectory *dir, const char *path )
-{
-    const KFile *f;
-    rc_t rc = KDirectoryVOpenFileRead ( dir, & f, path, NULL );
-    if ( rc == 0 )
-    {
-        const KMMap *mm;
-        rc = KMMapMakeRead ( & mm, f );
-        if ( rc == 0 )
-        {
-            size_t size;
-            const void *addr;
-            rc = KMMapSize ( mm, & size );
-            if ( rc == 0 )
-                rc = KMMapAddrRead ( mm, & addr );
-
-            if ( rc == 0 )
-            {
-                union
-                {
-                    KDBHdr v1;
-                    KDBHdr v2;
-                } hdrs;
-
-                const KDBHdr *hdr = ( const KDBHdr* ) addr;
-                const void *pbstree_src = hdr + 1;
-
-                rc = KDBHdrValidate ( hdr, size, 1, KMETADATAVERS );
-                if ( GetRCState ( rc ) == rcIncorrect && GetRCObject ( rc ) == rcByteOrder )
-                {
-                    hdrs . v1 . endian = bswap_32 ( hdr -> endian );
-                    hdrs . v1 . version = bswap_32 ( hdr -> version );
-                    rc = KDBHdrValidate ( & hdrs . v1, size, 1, KMETADATAVERS );
-                    if ( rc == 0 )
-                    {
-                        self -> byteswap = true;
-                        switch ( hdrs . v1 . version )
-                        {
-                        case 1:
-                            hdr = & hdrs . v1;
-                            break;
-                        case 2:
-                            hdr = & hdrs . v2;
-                            break;
-                        }
-                    }
-                }
-                if ( rc == 0 )
-                {
-                    PBSTree *bst;
-                    rc = PBSTreeMake ( & bst, pbstree_src, size - sizeof * hdr, self -> byteswap );
-                    if ( rc != 0 )
-                        rc = RC ( rcDB, rcMetadata, rcConstructing, rcData, rcCorrupt );
-                    else
-                    {
-                        KMDataNodeInflateData pb;
-
-                        pb . meta = self;
-                        pb . par = self -> root;
-                        pb . bst = & self -> root -> child;
-                        pb . node_size_limit = NODE_SIZE_LIMIT;
-                        pb . node_child_limit = NODE_CHILD_LIMIT;
-                        pb . rc = 0;
-                        pb . byteswap = self -> byteswap;
-
-                        if ( hdr -> version == 1 )
-                            PBSTreeDoUntil ( bst, 0, KMDataNodeInflate_v1, & pb );
-                        else
-                            PBSTreeDoUntil ( bst, 0, KMDataNodeInflate, & pb );
-                        rc = pb . rc;
-
-                        self -> vers = hdr -> version;
-
-                        PBSTreeWhack ( bst );
-                    }
-                }
-            }
-
-            KMMapRelease ( mm );
-        }
-
-        KFileRelease ( f );
-    }
-    return rc;
-}
-
-static
-rc_t KMetadataMakeRead ( KMetadata **metap,
-    const KDirectory *dir, const char *path, uint32_t rev )
-{
-    rc_t rc;
-    KMetadata *meta = malloc ( sizeof * meta + strlen ( path ) );
-    if ( meta == NULL )
-        rc = RC ( rcDB, rcMetadata, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        memset ( meta, 0, sizeof * meta );
-        meta -> root = calloc ( 1, sizeof * meta -> root );
-        if ( meta -> root == NULL )
-            rc = RC ( rcDB, rcMetadata, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            meta -> root -> meta = meta;
-            meta -> dir = dir;
-            KRefcountInit ( & meta -> refcount, 1, "KMetadata", "make-read", path );
-            meta -> rev = rev;
-            meta -> byteswap = false;
-            strcpy ( meta -> path, path );
-
-            KRefcountInit ( & meta -> root -> refcount, 0, "KMDataNode", "make-read", "/" );
-
-            rc = KMetadataPopulate ( meta, dir, path );
-            if ( rc == 0 )
-            {
-                KDirectoryAddRef ( dir );
-                * metap = meta;
-                return 0;
-            }
-
-            free ( meta -> root );
-        }
-
-        free ( meta );
-    }
-    * metap = NULL;
-    return rc;
-}
-
-
-/* OpenMetadataRead
- *  opens metadata for read
- *
- *  "meta" [ OUT ] - return parameter for metadata
- */
-static
-rc_t KDBManagerOpenMetadataReadInt ( const KDBManager *self,
-    KMetadata **metap, const KDirectory *wd, uint32_t rev, bool prerelease )
-{
-    char metapath [ 4096 ];
-    rc_t rc = ( prerelease == 1 ) ?
-        KDirectoryVResolvePath ( wd, true, metapath, sizeof metapath, "meta", NULL ):
-        ( ( rev == 0 ) ?
-          KDirectoryVResolvePath ( wd, true, metapath, sizeof metapath, "md/cur", NULL ):
-          KDirectoryResolvePath ( wd, true, metapath, sizeof metapath, "md/r%.3u", rev ) );
-    if ( rc == 0 )
-    {
-        KMetadata *meta;
-
-        switch ( KDirectoryVPathType ( wd, metapath, NULL ) )
-        {
-        case kptNotFound:
-            return RC ( rcDB, rcMgr, rcOpening, rcMetadata, rcNotFound );
-        case kptBadPath:
-            return RC ( rcDB, rcMgr, rcOpening, rcPath, rcInvalid );
-        case kptFile:
-        case kptFile | kptAlias:
-            break;
-        default:
-            return RC ( rcDB, rcMgr, rcOpening, rcPath, rcIncorrect );
-        }
-
-        rc = KMetadataMakeRead ( & meta, wd, metapath, rev );
-        if ( rc == 0 )
-        {
-            meta -> mgr = KDBManagerAttach ( self );
-            * metap = meta;
-            return 0;
-        }
-    }
-    
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDatabaseOpenMetadataRead ( const KDatabase *self, const KMetadata **metap )
-{
-    rc_t rc;
-    KMetadata *meta;
-
-    if ( metap == NULL )
-        return RC ( rcDB, rcDatabase, rcOpening, rcParam, rcNull );
-
-    * metap = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcDatabase, rcOpening, rcSelf, rcNull );
-
-    rc = KDBManagerOpenMetadataReadInt ( self -> mgr, & meta, self -> dir, 0, false );
-    if ( rc == 0 )
-    {
-        meta -> db = KDatabaseAttach ( self );
-        * metap = meta;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KTableOpenMetadataRead ( const KTable *self, const KMetadata **metap )
-{
-    rc_t rc;
-    KMetadata *meta;
-
-    if ( metap == NULL )
-        return RC ( rcDB, rcTable, rcOpening, rcParam, rcNull );
-
-    * metap = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcTable, rcOpening, rcSelf, rcNull );
-
-    rc = KDBManagerOpenMetadataReadInt ( self -> mgr, & meta,
-        self -> dir, 0, self -> prerelease );
-    if ( rc == 0 )
-    {
-        meta -> tbl = KTableAttach ( self );
-        * metap = meta;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KColumnOpenMetadataRead ( const KColumn *self, const KMetadata **metap )
-{
-    rc_t rc;
-    KMetadata *meta;
-
-    if ( metap == NULL )
-        return RC ( rcDB, rcColumn, rcOpening, rcParam, rcNull );
-
-    * metap = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcColumn, rcOpening, rcSelf, rcNull );
-
-    rc = KDBManagerOpenMetadataReadInt ( self -> mgr, & meta, self -> dir, 0, false );
-    if ( rc == 0 )
-    {
-        meta -> col = KColumnAttach ( self );
-        * metap = meta;
-    }
-
-    return rc;
-}
-
-
-/* Version
- *  returns the metadata format version
- */
-LIB_EXPORT rc_t CC KMetadataVersion ( const KMetadata *self, uint32_t *version )
-{
-    if ( version == NULL )
-        return RC ( rcDB, rcMetadata, rcAccessing, rcParam, rcNull );
-
-    if ( self == NULL )
-    {
-        * version = 0;
-        return RC ( rcDB, rcMetadata, rcAccessing, rcSelf, rcNull );
-    }
-
-    * version = self -> vers;
-    return 0;
-}
-
-
-/* ByteOrder
- *  indicates whether original byte order is reversed
- *  under current architecture.
- *
- *  the byte order of the column is established by
- *  the host architecture when created.
- *
- *  "reversed" [ OUT ] - if true, the original byte
- *  order is reversed with regard to host native byte order.
- */
-LIB_EXPORT rc_t CC KMetadataByteOrder ( const KMetadata *self, bool *reversed )
-{
-    if ( reversed == NULL )
-        return RC ( rcDB, rcMetadata, rcAccessing, rcParam, rcNull );
-
-    if ( self == NULL )
-    {
-        * reversed = false;
-        return RC ( rcDB, rcMetadata, rcAccessing, rcSelf, rcNull );
-    }
-
-    * reversed = self -> byteswap;
-    return 0;
-}
-
-
-/* Revision
- *  returns current revision number
- *  where 0 ( zero ) means tip
- */
-LIB_EXPORT rc_t CC KMetadataRevision ( const KMetadata *self, uint32_t *revision )
-{
-    if ( revision == NULL )
-        return RC ( rcDB, rcMetadata, rcAccessing, rcParam, rcNull );
-
-    if ( self == NULL )
-    {
-        * revision = 0;
-        return RC ( rcDB, rcMetadata, rcAccessing, rcSelf, rcNull );
-    }
-
-    * revision = self -> rev;
-    return 0;
-}
-
-
-/* MaxRevision
- *  returns the maximum revision available
- */
-LIB_EXPORT rc_t CC KMetadataMaxRevision ( const KMetadata *self, uint32_t *revision )
-{
-    if ( revision == NULL )
-        return RC ( rcDB, rcMetadata, rcAccessing, rcParam, rcNull );
-
-    * revision = 0;
-
-    if ( self != NULL )
-    {
-        KNamelist *listing;
-        rc_t rc = KDirectoryVList ( self -> dir,
-            & listing, NULL, NULL, "md", NULL );
-        if ( rc == 0 )
-        {
-            uint32_t rev_max, count;
-            rc = KNamelistCount ( listing, & count );
-            if ( rc == 0 )
-            {
-                uint32_t idx;
-                for ( rev_max = idx = 0; idx < count; ++ idx )
-                {
-                    const char *name;
-                    
-                    rc = KNamelistGet ( listing, idx, & name );
-                    if ( rc != 0 )
-                        break;
-                    
-                    if ( name [ 0 ] == 'r' )
-                    {
-                        char *end;
-                        uint32_t rev = strtou32 ( name + 1, & end, 10 );
-                        if ( end [ 0 ] == 0 && rev > rev_max )
-                            rev_max = rev;
-                    }
-                }
-
-                * revision = rev_max;
-            }
-                
-            KNamelistRelease ( listing );
-        }
-        else if ( GetRCState ( rc ) == rcNotFound )
-        {
-            rc = 0;
-        }
-
-        return rc;
-    }
-
-    return RC ( rcDB, rcMetadata, rcAccessing, rcSelf, rcNull );
-}
-
-
-/* OpenRevision
- *  opens a read-only indexed revision of metadata
- */
-LIB_EXPORT rc_t CC KMetadataOpenRevision ( const KMetadata *self,
-    const KMetadata **metap, uint32_t revision )
-{
-    rc_t rc;
-    KMetadata *meta;
-
-    if ( metap == NULL )
-        return RC ( rcDB, rcMetadata, rcOpening, rcParam, rcNull );
-
-    * metap = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcMetadata, rcOpening, rcSelf, rcNull );
-
-    rc = KDBManagerOpenMetadataReadInt ( self -> mgr,
-        & meta, self -> dir, revision, false );
-    if ( rc == 0 )
-    {
-        if ( self -> db != NULL )
-            meta -> db = KDatabaseAttach ( self -> db );
-        else if ( self -> tbl != NULL )
-            meta -> tbl = KTableAttach ( self -> tbl );
-        else if ( self -> col != NULL )
-            meta -> col = KColumnAttach ( self -> col );
-
-        * metap = meta;
-    }
-
-    return rc;
-}
-
-
-/* GetSequence
- *  access a named sequence
- *
- *  "seq" [ IN ] - NUL terminated sequence name
- *
- *  "val" [ OUT ] - return parameter for sequence value
- */
-LIB_EXPORT rc_t CC KMetadataGetSequence ( const KMetadata *self,
-    const char *seq, int64_t *val )
-{
-    rc_t rc;
-    const KMDataNode *found;
-
-    if ( val == NULL )
-        return RC ( rcDB, rcMetadata, rcAccessing, rcParam, rcNull );
-
-    * val = 0;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcMetadata, rcAccessing, rcSelf, rcNull );
-
-    if ( seq == NULL )
-        return RC ( rcDB, rcMetadata, rcAccessing, rcString, rcNull );
-    if ( seq [ 0 ] == 0 )
-        return RC ( rcDB, rcMetadata, rcAccessing, rcString, rcInvalid );
-
-    rc = KMDataNodeOpenNodeRead
-        ( self -> root, & found, ".seq/%s", seq );
-    if ( rc == 0 )
-    {
-        size_t num_read, remaining;
-        rc = KMDataNodeRead ( found, 0, val, sizeof * val, & num_read, & remaining );
-        assert ( rc != 0 || ( num_read == sizeof * val && remaining == 0 ) );
-        KMDataNodeRelease ( found );
-    }
-
-    return rc;
-}
-
-
-
-/*--------------------------------------------------------------------------
- * KNamelist
- */
-typedef struct KMDataNodeNamelist KMDataNodeNamelist;
-struct KMDataNodeNamelist
-{
-    KNamelist dad;
-    const KMDataNode *node;
-    size_t count;
-    const char *namelist [ 1 ];
-};
-
-/* Whack
- */
-static
-rc_t CC KMDataNodeNamelistWhack ( KMDataNodeNamelist *self )
-{
-    rc_t rc = KMDataNodeRelease ( self -> node );
-    if ( rc == 0 )
-        free ( self );
-    return rc;
-}
-
-/* Count
- */
-static
-rc_t CC KMDataNodeNamelistCount ( const KMDataNodeNamelist *self, uint32_t *count )
-{
-    * count = ( uint32_t ) self -> count;
-    return 0;
-}
-
-/* Get
- */
-static
-rc_t CC KMDataNodeNamelistGet ( const KMDataNodeNamelist *self,
-    uint32_t idx, const char **name )
-{
-    if ( ( size_t ) idx >= self -> count )
-        return RC ( rcDB, rcNamelist, rcAccessing, rcParam, rcInvalid );
-    * name = self -> namelist [ idx ];
-    return 0;
-}
-
-/* Make
- */
-static KNamelist_vt_v1 vtKMDataNodeNamelist =
-{
-    /* version 1.0 */
-    1, 0,
-
-    /* start minor version 0 methods */
-    KMDataNodeNamelistWhack,
-    KMDataNodeNamelistCount,
-    KMDataNodeNamelistGet
-    /* end minor version 0 methods */
-};
-
-static
-rc_t KMDataNodeNamelistMake ( KNamelist **names, uint32_t count )
-{
-    rc_t rc;
-    KMDataNodeNamelist *self = calloc ( 1, sizeof * self -
-        sizeof self -> namelist + count * sizeof self -> namelist [ 0 ] );
-    if ( self == NULL )
-        rc = RC ( rcDB, rcMetadata, rcListing, rcMemory, rcExhausted );
-    else
-    {
-        rc = KNamelistInit ( & self -> dad,
-            ( const KNamelist_vt* ) & vtKMDataNodeNamelist );
-        if ( rc == 0 )
-        {
-            * names = & self -> dad;
-            return 0;
-        }
-        
-        free ( self );
-    }
-
-    return rc;
-}
-
-/* List
- *  create metadata node listings
- */
-static
-void CC KMDataNodeListCount ( BSTNode *n, void *data )
-{
-    * ( uint32_t* ) data += 1;
-}
-
-static
-void CC KMDataNodeGrabAttr ( BSTNode *n, void *data )
-{
-    KMDataNodeNamelist *list = data;
-    list -> namelist [ list -> count ++ ] = ( ( const KMAttrNode* ) n ) -> name;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeListAttr ( const KMDataNode *self, KNamelist **names )
-{
-    if ( names == NULL )
-        return RC ( rcDB, rcMetadata, rcListing, rcParam, rcNull );
-
-    * names = NULL;
-
-    if ( self != NULL )
-    {
-        rc_t rc;
-
-        uint32_t count = 0;
-        BSTreeForEach ( & self -> attr, 0, KMDataNodeListCount, & count );
-
-        rc = KMDataNodeNamelistMake ( names, count );
-        if ( rc == 0 )
-            BSTreeForEach ( & self -> attr, 0, KMDataNodeGrabAttr, * names );
-
-        return rc;
-    }
-
-    return RC ( rcDB, rcMetadata, rcListing, rcSelf, rcNull );
-}
-
-static
-void CC KMDataNodeGrabName ( BSTNode *n, void *data )
-{
-    KMDataNodeNamelist *list = data;
-    list -> namelist [ list -> count ++ ] = ( ( const KMDataNode* ) n ) -> name;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeListChildren ( const KMDataNode *self, KNamelist **names )
-{
-    if ( names == NULL )
-        return RC ( rcDB, rcMetadata, rcListing, rcParam, rcNull );
-
-    * names = NULL;
-
-    if ( self != NULL )
-    {
-        rc_t rc;
-
-        uint32_t count = 0;
-        BSTreeForEach ( & self -> child, 0, KMDataNodeListCount, & count );
-
-        rc = KMDataNodeNamelistMake ( names, count );
-        if ( rc == 0 )
-            BSTreeForEach ( & self -> child, 0, KMDataNodeGrabName, * names );
-
-        return rc;
-    }
-
-    return RC ( rcDB, rcMetadata, rcListing, rcSelf, rcNull );
-}
diff --git a/libs/kdb/ptrieval-v1.c b/libs/kdb/ptrieval-v1.c
deleted file mode 100644
index 6324288..0000000
--- a/libs/kdb/ptrieval-v1.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kdb/extern.h>
-
-#include "index-priv.h"
-#include "idstats-priv.h"
-
-#include <kdb/index.h>
-#include <klib/ptrie.h>
-#include <klib/text.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <limits.h>
-#include <stdio.h>
-#include <string.h>
-#include <endian.h>
-#include <byteswap.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * KPTrieIndexCCParms
- *  consistency check parameter block
- */
-typedef struct KPTrieIndexCCParms_v1 KPTrieIndexCCParms_v1;
-struct KPTrieIndexCCParms_v1
-{
-    KIdStats stats;
-    rc_t rc;
-    const KPTrieIndex_v1 *self;
-    const KIndex *outer;
-    bool key2id;
-    bool id2key;
-    bool failed;
-};
-
-/* Init
- */
-static
-void KPTrieIndexCCParmsInit_v1 ( KPTrieIndexCCParms_v1 *pb,
-    const KPTrieIndex_v1 *self, const KIndex *outer, bool key2id, bool id2key )
-{
-    KIdStatsInit ( & pb -> stats );
-    pb -> rc = 0;
-    pb -> self = self;
-    pb -> outer = outer;
-    pb -> key2id = key2id;
-    pb -> id2key = self -> id2node ? id2key : false;
-    pb -> failed = false;
-}
-
-/* Whack
- */
-static
-void KPTrieIndexCCParmsWhack_v1 ( KPTrieIndexCCParms_v1 *pb )
-{
-    KIdStatsWhack ( & pb -> stats );
-}
-
-/*--------------------------------------------------------------------------
- * KPTrieIndex_v1
- *  persisted keymap
- */
-
-/* CheckConsistency
- *  runs a consistency check as efficiently as possible
- *
- *  in all cases, we make use of "PTrieForEach" to visit each node
- *  using the natural storage order. each node returned is counted,
- *  read and inserted into a BSTree whose nodes merge adjacent and
- *  overlapping ids into existing nodes.
- *
- *  if running a deep "key->id" test, then the key is first regenerated
- *  from the node, and then used to retrieve the id via the KIndex.
- *
- *  if the projection index exists, the id is tested against the node
- *  to ensure that projection works. if "id->key" is true, then use
- *  the KIndex to produce a key and compare it against the node.
- */
-static
-bool CC KPTrieIndexCCVisit_v1 ( PTNode *n, void *data )
-{
-    KPTrieIndexCCParms_v1 *pb = data;
-    const KPTrieIndex_v1 *self = pb -> self;
-
-    /* payload of v1 PTNode is a 32-bit spot id */
-    uint32_t id;
-    assert ( n -> data . size == sizeof id );
-    memcpy ( & id, n -> data . addr, sizeof id );
-    if ( self -> byteswap )
-        id = bswap_32 ( id );
-
-    /* record the node, row id, and range of 1 */
-    pb -> rc = KIdStatsInsert ( & pb -> stats, id, 1 );
-    if ( pb -> rc != 0 )
-    {
-        PLOGERR ( klogSys, ( klogSys, pb -> rc, "failed when examining node id $(nid) with row id $(rid)",
-                              "nid=0x%08x,rid=%u", n -> id, id ));
-        return true;
-    }
-
-    /* if we have a projection index, test it */
-    if ( self -> id2node != NULL )
-    {
-        if ( id < self -> first || id > self -> last )
-        {
-            PLOGMSG ( klogWarn, ( klogWarn, "node id $(nid) with row id $(rid) is not within projection range of $(min_rid)..$(max_rid)",
-                                 "nid=0x%08x,rid=%u,min_rid=%u,max_rid=%u", n -> id, id, self -> first, self -> last ));
-            pb -> failed = true;
-            return false;
-        }
-        if ( self -> id2node [ id - self -> first ] != n -> id )
-        {
-            PLOGMSG ( klogWarn, ( klogWarn, "node id $(nid) with row id $(rid) does not match projection node id of $(pnid)",
-                                 "nid=0x%08x,rid=%u,pnid=0x%08x", n -> id, id, self -> id2node [ id - self -> first ] ));
-            pb -> failed = true;
-            return false;
-        }
-    }
-
-    /* if performing deeper tests */
-    if ( pb -> key2id || pb -> id2key )
-    {
-        rc_t rc;
-        int64_t start_id;
-        uint64_t id_count;
-
-        /* need to recover key from given node */
-        const String *orig;
-        pb -> rc = PTNodeMakeKey ( n, & orig );
-        if ( pb -> rc != 0 )
-        {
-            PLOGERR ( klogSys, ( klogSys, pb -> rc, "failed when retrieving text for node id $(nid) with row id $(rid)",
-                                 "nid=0x%08x,rid=%u", n -> id, id ));
-            return true;
-        }
-
-        /* key->id test */
-        if ( pb -> key2id )
-        {
-            rc = KIndexFindText ( pb -> outer, orig -> addr, & start_id, & id_count, NULL, NULL );
-            if ( rc != 0 )
-            {
-                PLOGERR ( klogWarn, ( klogWarn, rc, "failed to retrieve start id and count for key '$(key)', row id $(rid)",
-                                      "key=%S,rid=%u", orig, id ) );
-                pb -> failed = true;
-            }
-            else if ( start_id != ( int64_t ) id || id_count != 1 )
-            {
-                PLOGERR ( klogWarn, ( klogWarn, rc, "key '$(key)' maps to start id $(start_id), count $(id_count): expected id $(rid), count 1.",
-                                      "key=%S,rid=%u,start_id=%ld,id_count=%lu", orig, id, start_id, id_count ) );
-                pb -> failed = true;
-            }
-        }
-
-        /* id->key test */
-        if ( pb -> id2key )
-        {
-            char buffer [ 256 ], *key = buffer;
-            size_t key_size, bsize = sizeof buffer;
-            if ( sizeof buffer <= orig -> size )
-            {
-                key = malloc ( bsize = orig -> size + 1 );
-                if ( key == 0 )
-                {
-                    pb -> rc = RC ( rcDB, rcIndex, rcValidating, rcMemory, rcExhausted );
-                    StringWhack ( ( String* ) orig );
-                    return true;
-                }
-            }
-
-            rc = KIndexProjectText ( pb -> outer, id, & start_id, & id_count, key, bsize, & key_size );
-            if ( rc != 0 )
-            {
-                PLOGERR ( klogWarn, ( klogWarn, rc, "failed to retrieve key, start id and count for row id $(rid)",
-                                      "rid=%u", id ) );
-                pb -> failed = true;
-            }
-            else
-            {
-                if ( orig -> size != key_size || memcmp ( orig -> addr, key, key_size ) != 0 )
-                {
-                    PLOGERR ( klogWarn, ( klogWarn, rc, "row $(rid) maps to key '$(key)': expected key '$(orig)'.",
-                                          "rid=%u,key=%.*s,orig=%S", id, ( int ) key_size, key, orig ) );
-                    pb -> failed = true;
-                }
-                if ( start_id != ( int64_t ) id || id_count != 1 )
-                {
-                    PLOGERR ( klogWarn, ( klogWarn, rc, "single row $(rid) maps to start id $(start_id), count $(id_count).",
-                                          "rid=%u,id_count=%u,start_id=%ld", id, id_count, start_id ) );
-                    pb -> failed = true;
-                }
-            }
-
-            if ( key != buffer )
-                free ( key );
-        }
-
-        StringWhack ( ( String* ) orig );
-    }
-
-    return false;
-}
-
-rc_t KPTrieIndexCheckConsistency_v1 ( const KPTrieIndex_v1 *self,
-    int64_t *start_id, uint64_t *id_range, uint64_t *num_keys,
-    uint64_t *num_rows, uint64_t *num_holes,
-    const KIndex *outer, bool key2id, bool id2key )
-{
-    rc_t rc = 0;
-    KPTrieIndexCCParms_v1 pb;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcIndex, rcValidating, rcParam, rcNull );
-
-    if ( ( key2id || id2key ) && outer == NULL )
-        return RC ( rcDB, rcIndex, rcValidating, rcSelf, rcNull );
-
-    KPTrieIndexCCParmsInit_v1 ( & pb, self, outer, key2id, id2key );
-    if ( PTrieDoUntil ( self -> key2id, KPTrieIndexCCVisit_v1, & pb ) )
-        rc = pb . rc;
-    else if ( pb . failed )
-        rc = RC ( rcDB, rcIndex, rcValidating, rcSelf, rcCorrupt );
-
-    if ( start_id != NULL )
-        * start_id = pb . stats . i_min_id;
-    if ( id_range != NULL )
-        * id_range = ( uint32_t ) ( pb . stats . x_max_id - pb . stats . i_min_id );
-    if ( num_keys != NULL )
-        * num_keys = pb . stats . num_entries;
-    if ( num_rows != NULL )
-        * num_rows = pb . stats . num_ids;
-    if ( num_holes != NULL )
-        * num_holes = pb . stats . num_holes;
-
-    KPTrieIndexCCParmsWhack_v1 ( & pb );
-    return rc;
-}
diff --git a/libs/kdb/ptrieval-v2.c b/libs/kdb/ptrieval-v2.c
deleted file mode 100644
index 7a8b939..0000000
--- a/libs/kdb/ptrieval-v2.c
+++ /dev/null
@@ -1,396 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kdb/extern.h>
-
-#include "index-priv.h"
-#include "idstats-priv.h"
-
-#include <kdb/index.h>
-#include <klib/ptrie.h>
-#include <klib/pack.h>
-#include <klib/text.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <limits.h>
-#include <stdio.h>
-#include <string.h>
-#include <endian.h>
-#include <byteswap.h>
-#include <assert.h>
-
-
-
-/*--------------------------------------------------------------------------
- * KPTrieIndexCCParms
- *  consistency check parameter block
- */
-typedef struct KPTrieIndexCCParms_v2 KPTrieIndexCCParms_v2;
-struct KPTrieIndexCCParms_v2
-{
-    KIdStats stats;
-    rc_t rc;
-    const KPTrieIndex_v2 *self;
-    const KIndex *outer;
-    bool key2id;
-    bool id2key;
-    bool all_ids;
-    bool convertFromV1;
-    bool failed;
-};
-
-/* Init
- */
-static
-void KPTrieIndexCCParmsInit_v2 ( KPTrieIndexCCParms_v2 *pb,
-    const KPTrieIndex_v2 *self, const KIndex *outer, bool key2id, bool id2key, bool all_ids, bool convertFromV1 )
-{
-    KIdStatsInit ( & pb -> stats );
-    pb -> rc = 0;
-    pb -> self = self;
-    pb -> outer = outer;
-    pb -> key2id = key2id;
-    pb -> id2key = self -> ord2node ? id2key : false;
-    pb -> all_ids = all_ids;
-    pb -> convertFromV1 = convertFromV1;
-    pb -> failed = false;
-}
-
-/* Whack
- */
-static
-void KPTrieIndexCCParmsWhack_v2 ( KPTrieIndexCCParms_v2 *pb )
-{
-    KIdStatsWhack ( & pb -> stats );
-}
-
-/*--------------------------------------------------------------------------
- * KPTrieIndex_v2
- *  persisted keymap
- */
-
-/* CheckConsistency
- *  runs a consistency check as efficiently as possible
- *
- *  in all cases, we make use of "PTrieForEach" to visit each node
- *  using the natural storage order. each node returned is counted,
- *  read and inserted into a BSTree whose nodes merge adjacent and
- *  overlapping ids into existing nodes.
- *
- *  if running a deep "key->id" test, then the key is first regenerated
- *  from the node, and then used to retrieve the id via the KIndex.
- *
- *  if the projection index exists, the id is tested against the node
- *  to ensure that projection works. if "id->key" is true, then use
- *  the KIndex to produce a key and compare it against the node.
- */
-static
-bool CC KPTrieIndexCCVisit_v2 ( PTNode *n, void *data )
-{
-    KPTrieIndexCCParms_v2 *pb = (KPTrieIndexCCParms_v2 *)data;
-    const KPTrieIndex_v2 *self = pb -> self;
-
-    rc_t rc;
-    int64_t id;
-    size_t usize;
-    uint64_t span;
-    uint32_t i, ord;
-
-    /* detect conversion from v1 */
-    if ( pb -> convertFromV1 && self -> id_bits == 0 )
-    {
-        uint32_t id32;
-
-        /* payload of v1 PTNode is a 32-bit spot id */
-        assert ( n -> data . size == sizeof id32 );
-        memcpy ( & id32, n -> data . addr, sizeof id32 );
-        id = self -> byteswap ? bswap_32 ( id32 ) : id32;
-    }
-    else
-    {
-        /* native v2 */
-        /* TBD - should this pass n -> data . size * 8 ??? */
-        if ( self -> id_bits != 0 )
-        {
-            rc = Unpack ( self -> id_bits, sizeof id * 8,
-                n -> data . addr, 0, self -> id_bits, NULL,
-                & id, sizeof id, & usize );
-            if ( rc != 0 )
-            {
-                PLOGMSG ( klogWarn, ( klogWarn, "could not determine row id of v2 node $(nid)",
-                                 "nid=0x%08x", n -> id ));
-                pb -> failed = true;
-                return false;
-            }
-        }
-        else
-        {
-            id = 0;
-        }
-
-        id += self -> first;
-    }
-
-    /* convert from row-id to 1-based ordinal index */
-    ord = KPTrieIndexID2Ord_v2 ( self, id );
-    if ( ord == 0 )
-    {
-        /* 0 means not found */
-        PLOGMSG ( klogWarn, ( klogWarn, "v2 node $(nid): row id $(rid) not found in trie",
-                              "nid=0x%08x,rid=%ld", n -> id, id ));
-        pb -> failed = true;
-        return false;
-    }
-
-    if ( self -> ord2node != NULL )
-    {
-        /* to calculate span of last entry, where
-           1-based "ord" == the number of nodes,
-           just find the distance between the last row-id
-           in index ( self->maxid ) and the current row-id */
-        if ( ord == self -> count )
-            span = self -> maxid - id + 1;
-        else
-        {
-            /* from here on, we will use "ord" to be the
-               ZERO-BASED index of the slot FOLLOWING the
-               one corresponding to id. we want to find the
-               row-id AFTER the current one and calculate distance */
-            switch ( self -> variant )
-            {
-            /* linear array */
-            case 0:
-                /* starting with the FOLLOWING slot,
-                   count duplicate entries */
-                for ( i = ord; i < self -> count; ++ i )
-                {
-                    if ( n -> id != self -> ord2node [ i ] )
-                        break;
-                }
-                span = self -> first + i - id;
-                break;
-
-            /* packed ordered array of sparse row-ids from here on
-               we already have "id" for this node, so the span will
-               be the distance from NEXT id - 1-based ord is 0-based next */
-            case 1:
-                span = self -> first + self -> id2ord . v8 [ ord ] - id;
-                break;
-            case 2:
-                span = self -> first + self -> id2ord . v16 [ ord ] - id;
-                break;
-            case 3:
-                span = self -> first + self -> id2ord . v32 [ ord ] - id;
-                break;
-            case 4:
-                span = self -> first + self -> id2ord . v64 [ ord ] - id;
-                break;
-            default:
-                PLOGMSG ( klogErr, ( klogErr, "PTrie v2 index has bad variant code: $(variant)",
-                                     "variant=%u", self -> variant ));
-                pb -> rc = RC ( rcDB, rcIndex, rcValidating, rcIndex, rcCorrupt );
-                return true;
-            }
-        }
-    }
-    else if ( self -> span_bits == 0 )
-        span = 1;
-    else
-    {
-        /* TBD - this case is never used in practice.
-           it would be an skey without a projection index */
-        rc = Unpack ( self -> span_bits, sizeof span * 8,
-                      n -> data . addr, 0, self -> id_bits, NULL,
-                      & span, sizeof span, & usize );
-        if ( rc != 0 )
-        {
-            PLOGMSG ( klogWarn, ( klogWarn, "could not determine span of v2 node $(nid), row id $(rid)",
-                                  "nid=0x%08x,rid=%ld", n -> id, id ));
-            pb -> failed = true;
-            return false;
-        }
-    }
-
-    /* record the node, row id, span */
-    pb -> rc = KIdStatsInsert ( & pb -> stats, id, span );
-    if ( pb -> rc != 0 )
-    {
-        PLOGERR ( klogSys, ( klogSys, pb -> rc, "failed when examining node id $(nid) with row id $(rid), span $(span)",
-                             "nid=0x%08x,span=%u,rid=%ld", n -> id, span, id ));
-        return true;
-    }
-
-    /* if we have a projection index, test it */
-    if ( self -> ord2node != NULL )
-    {
-        if ( id < self -> first || id > self -> last )
-        {
-            PLOGMSG ( klogWarn, ( klogWarn, "node id $(nid) with row id $(rid) is not within projection range of $(min_rid)..$(max_rid)",
-                                 "nid=0x%08x,rid=%ld,min_rid=%ld,max_rid=%ld",
-                                  n -> id, id, self -> first, self -> last ));
-            pb -> failed = true;
-            return false;
-        }
-        for ( i = 0; i < span; ++ i )
-        {
-            if ( self -> ord2node [ i + ord - 1 ] != n -> id )
-            {
-                PLOGMSG ( klogWarn, ( klogWarn, "node id $(nid) with row id $(rid) does not match projection node id of $(pnid)",
-                                      "nid=0x%08x,rid=%ld,pnid=0x%08x", n -> id, id + 1, self -> ord2node [ i + ord - 1 ] ));
-                pb -> failed = true;
-                return false;
-            }
-            if ( ! pb -> all_ids || self -> variant != 0 )
-                break;
-        }
-    }
-
-    /* if performing deeper tests */
-    if ( pb -> key2id || pb -> id2key )
-    {
-        int64_t start_id;
-        uint64_t id_count;
-
-        /* need to recover key from given node */
-        const String *orig;
-        pb -> rc = PTNodeMakeKey ( n, & orig );
-        if ( pb -> rc != 0 )
-        {
-            PLOGERR ( klogSys, ( klogSys, pb -> rc, "failed when retrieving text for node id $(nid) with row id $(rid)",
-                                 "nid=0x%08x,rid=%u", n -> id, id ));
-            return true;
-        }
-
-        /* key->id test */
-        if ( pb -> key2id )
-        {
-            rc = KIndexFindText ( pb -> outer, orig -> addr, & start_id, & id_count, NULL, NULL );
-            if ( rc != 0 )
-            {
-                PLOGERR ( klogWarn, ( klogWarn, rc, "failed to retrieve start id and count for key '$(key)', row id $(rid)",
-                                      "key=%S,rid=%u", orig, id ) );
-                pb -> failed = true;
-            }
-            else if ( start_id != ( int64_t ) id || id_count != span )
-            {
-                PLOGERR ( klogWarn, ( klogWarn, rc, "key '$(key)' maps to start id $(start_id), count $(id_count): expected id $(rid), count 1.",
-                                      "key=%S,rid=%u,start_id=%ld,id_count=%lu", orig, id, start_id, id_count ) );
-                pb -> failed = true;
-            }
-        }
-
-        /* id->key test */
-        if ( pb -> id2key )
-        {
-            char buffer [ 256 ], *key = buffer;
-            size_t key_size, bsize = sizeof buffer;
-            if ( sizeof buffer <= orig -> size )
-            {
-                key = (char *)malloc ( bsize = orig -> size + 1 );
-                if ( key == 0 )
-                {
-                    pb -> rc = RC ( rcDB, rcIndex, rcValidating, rcMemory, rcExhausted );
-                    StringWhack ( ( String* ) orig );
-                    return true;
-                }
-            }
-
-            for ( i = 0; i < span; ++ i )
-            {
-                rc = KIndexProjectText ( pb -> outer, id + i, & start_id, & id_count, key, bsize, & key_size );
-                if ( rc != 0 )
-                {
-                    PLOGERR ( klogWarn, ( klogWarn, rc, "failed to retrieve key, start id and count for row id $(rid)",
-                                          "rid=%u", id + i ) );
-                    pb -> failed = true;
-                    break;
-                }
-
-                if ( orig -> size != key_size || memcmp ( orig -> addr, key, key_size ) != 0 )
-                {
-                    PLOGERR ( klogWarn, ( klogWarn, rc, "row $(rid) maps to key '$(key)': expected key '$(orig)'.",
-                                          "rid=%u,key=%.*s,orig=%S", id + i, ( int ) key_size, key, orig ) );
-                    pb -> failed = true;
-                }
-                if ( start_id != id || id_count != ( uint64_t ) span )
-                {
-                    PLOGERR ( klogWarn, ( klogWarn, rc, "row $(rid) maps to start id $(start_id), count $(id_count): expected $(row_start), $(span).",
-                                          "rid=%u,id_count=%lu,start_id=%ld,row_start=%ld,span=%u",
-                                          id, id_count, start_id, id, span ) );
-                    pb -> failed = true;
-                }
-
-                if ( ! pb -> all_ids || pb -> failed )
-                    break;
-            }
-
-            if ( key != buffer )
-                free ( key );
-        }
-
-        StringWhack ( ( String* ) orig );
-    }
-
-    return false;
-}
-
-rc_t KPTrieIndexCheckConsistency_v2 ( const KPTrieIndex_v2 *self,
-    int64_t *start_id, uint64_t *id_range, uint64_t *num_keys,
-    uint64_t *num_rows, uint64_t *num_holes,
-    const KIndex *outer, bool key2id, bool id2key, bool all_ids, bool convertFromV1 )
-{
-    rc_t rc = 0;
-    KPTrieIndexCCParms_v2 pb;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcIndex, rcValidating, rcParam, rcNull );
-
-    if ( ( key2id || id2key ) && outer == NULL )
-        return RC ( rcDB, rcIndex, rcValidating, rcSelf, rcNull );
-
-    KPTrieIndexCCParmsInit_v2 ( & pb, self, outer, key2id, id2key, all_ids, convertFromV1 );
-    if ( PTrieDoUntil ( self -> key2id, KPTrieIndexCCVisit_v2, & pb ) )
-        rc = pb . rc;
-    else if ( pb . failed )
-        rc = RC ( rcDB, rcIndex, rcValidating, rcSelf, rcCorrupt );
-
-    if ( start_id != NULL )
-        * start_id = pb . stats . i_min_id;
-    if ( id_range != NULL )
-        * id_range = pb . stats . x_max_id - pb . stats . i_min_id;
-    if ( num_keys != NULL )
-        * num_keys = pb . stats . num_entries;
-    if ( num_rows != NULL )
-        * num_rows = pb . stats . num_ids;
-    if ( num_holes != NULL )
-        * num_holes = pb . stats . num_holes;
-
-    KPTrieIndexCCParmsWhack_v2 ( & pb );
-    return rc;
-}
diff --git a/libs/kdb/table-cc.c b/libs/kdb/table-cc.c
deleted file mode 100644
index 17bcb4a..0000000
--- a/libs/kdb/table-cc.c
+++ /dev/null
@@ -1,378 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- *============================================================================
- *
- */
-
-#include <kdb/extern.h>
-
-#define KONST const
-#include "index-priv.h"
-#include "dbmgr-priv.h"
-#include "database-priv.h"
-#include "table-priv.h"
-#include "kdb-priv.h"
-#include "column-priv.h"
-#undef KONST
-
-#include "cc-priv.h"
-
-#include <kdb/index.h>
-#include <kdb/meta.h>
-#include <kdb/kdb-priv.h>
-
-#include <kfs/file.h>
-#include <kfs/md5.h>
-#include <klib/refcount.h>
-#include <klib/log.h> /* PLOGMSG */
-#include <klib/rc.h>
-#include <klib/namelist.h>
-#include <kdb/namelist.h>
-
-#include <os-native.h>
-#include <sysalloc.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-#include <errno.h>
-
-#undef index
-
-static void KTableGetName(KTable const *self, char const **rslt)
-{
-    char *sep;
-    
-    *rslt = self->path;
-    sep = strrchr(self->path, '/');
-    if (sep != NULL)
-        *rslt = sep + 1;
-}
-
-static
-rc_t KTableCheckMD5 ( const KTable *self, CCReportFunc report, void *ctx )
-{
-    CCReportInfoBlock info;
-    memset ( & info, 0, sizeof info );
-
-    info.objType = kptTable;
-    KTableGetName(self, &info.objName);
-    
-    return DirectoryCheckMD5 ( self->dir, "md5", & info, report, ctx );
-}
-
-#if 0
-static bool KTableCheckColumnsFilter(const KDirectory *dir, const char *name, void *data)
-{
-    return (KDirectoryPathType(dir, name) & ~kptAlias) == kptDir;
-}
-#endif
-
-typedef struct KTableCheckColumn_pb_s {
-    KTable const *self;
-    CCReportFunc report;
-    void *rpt_ctx;
-    unsigned n;
-    int level;
-    uint32_t depth;
-    INSDC_SRA_platform_id platform;
-} KTableCheckColumn_pb_t;
-
-static rc_t CC KTableCheckColumn(const KDirectory *dir, uint32_t type, const char *name, void *data)
-{
-    KTableCheckColumn_pb_t *pb = (KTableCheckColumn_pb_t *)data;
-    CCReportInfoBlock info;
-    
-    memset(&info, 0, sizeof(info));
-    
-    if ((type & ~kptAlias) != kptDir) {
-        char mesg[4096];
-        
-        snprintf(mesg, sizeof(mesg), "unexpected object '%s'", name);
-        KTableGetName(pb->self, &info.objName);
-        info.objId = 0;
-        info.objType = kptTable;
-        info.type = ccrpt_Done;
-        info.info.done.mesg = mesg;
-        info.info.done.rc = 0;
-        return pb->report(&info, pb->rpt_ctx);
-    }
-    else {
-        bool hasZombies;
-        INSDC_SRA_platform_id platform = pb->platform;
-        uint32_t ktype = KDBPathType(dir, &hasZombies, name);
-        rc_t rc;
-        
-        info.objType = kptColumn;
-        info.objId = pb->n++;
-        info.objName = name;
-        info.type = ccrpt_Visit;
-        info.info.visit.depth = pb->depth + 1;
-        rc = pb->report(&info, pb->rpt_ctx);
-        if (rc) return rc;
-        
-        info.type = ccrpt_Done;
-        
-        if (hasZombies) {
-#if 0
-            info.info.done.rc = RC(rcDB, rcTable, rcValidating, rcFile, rcTooShort);
-#else
-            info.info.done.rc = 0;
-#endif
-            info.info.done.mesg = "Column may be truncated";
-            rc = pb->report(&info, pb->rpt_ctx);
-            if (rc) return rc;
-        }
-        info.info.done.rc = RC(rcDB, rcTable, rcValidating, rcType, rcIncorrect);
-        if ((ktype & ~kptAlias) == kptColumn) {
-            const KColumn *col;
-            
-            info.info.done.rc = KTableOpenColumnRead(pb->self, &col, name);
-            if (info.info.done.rc == 0) {
-                info.info.done.rc = KColumnConsistencyCheck(col, pb->level, &info, pb->report, pb->rpt_ctx);
-                KColumnRelease(col);
-                return info.info.done.rc;
-            }
-        }
-        if (platform != SRA_PLATFORM_UNDEFINED && platform != SRA_PLATFORM_454
-            && name != NULL && name[0] != '\0' && strcmp(name, "SIGNAL") == 0)
-        {
-            (void)PLOGMSG(klogWarn, (klogWarn, "COLUMN '$(name)' IS INCOMPLETE",
-                "name=%s", name));
-            return 0;
-        }
-        info.info.done.mesg = "Failed to open column";
-        return pb->report(&info, pb->rpt_ctx);
-    }
-}
-
-static
-rc_t KTableCheckColumns ( const KTable *self, uint32_t depth, int level,
-    CCReportFunc report, void *ctx, INSDC_SRA_platform_id platform )
-{
-    KTableCheckColumn_pb_t pb;
-    
-    pb.self = self;
-    pb.report = report;
-    pb.rpt_ctx = ctx;
-    pb.n = 0;
-    pb.level = level;
-    pb.depth = depth;
-    pb.platform = platform;
-    return KDirectoryVVisit(self->dir, false, KTableCheckColumn, &pb, "col", NULL);
-}
-
-static
-rc_t KTableCheckIndexMD5(const KDirectory *dir,
-                         CCReportInfoBlock *nfo,
-                         CCReportFunc report, void *ctx)
-{
-    char md5[4096];
-
-    snprintf(md5, sizeof(md5), "%s.md5", nfo->objName);
-    if (KDirectoryPathType(dir, md5) != kptNotFound)
-        return DirectoryCheckMD5(dir, md5, nfo, report, ctx);
-    return 0;
-}
-
-static const KDirectory *KTableFindIndexDir(const KTable *self)
-{
-    const KDirectory *idxDir;
-    
-    rc_t rc = KDirectoryOpenDirRead ( self -> dir, & idxDir, false, "idx" );
-    if ( rc == 0 )
-        return idxDir;
-
-    /* some old tables have a single index at table level */
-    KDirectoryAddRef ( self -> dir );
-    return self -> dir;
-}
-
-static
-rc_t KTableCheckIndices(const KTable *self, uint32_t depth, int level, CCReportFunc report, void *ctx)
-{
-    uint32_t n;
-    const KMetadata *meta;
-    int64_t max_row_id = 0;
-
-    KNamelist *list;
-    rc_t rc = KTableListIdx(self, &list);
-    if ( rc != 0 )
-    {
-        if ( GetRCState ( rc ) == rcNotFound )
-            return 0;
-        return rc;
-    }
-
-    rc = KTableOpenMetadataRead ( self, & meta );
-    if ( rc == 0 )
-    {
-        const KMDataNode *seq;
-        rc = KMetadataOpenNodeRead ( meta, & seq, "/.seq/spot" );
-        if ( rc == 0 )
-        {
-            rc = KMDataNodeReadAsI64 ( seq, & max_row_id );
-            if ( rc != 0 )
-                max_row_id = 0;
-            KMDataNodeRelease ( seq );
-        }
-
-        KMetadataRelease ( meta );
-    }
-
-    rc = KNamelistCount(list, &n);
-    if ( rc == 0 )
-    {
-        const KDirectory *idxDir = KTableFindIndexDir ( self );
-        if ( idxDir == NULL )
-            rc = RC ( rcDB, rcTable, rcValidating, rcDirectory, rcNull );
-        else
-        {
-            CCReportInfoBlock nfo;
-            memset(&nfo, 0, sizeof(nfo));
-            nfo.objType = kptIndex;
-
-            for ( nfo . objId = 0; rc == 0 && nfo . objId != (int) n; ++ nfo . objId)
-            {
-                rc = KNamelistGet(list, nfo.objId, &nfo.objName);
-                if ( rc != 0 )
-                    break;
-                
-                nfo.type = ccrpt_Visit;
-                nfo.info.visit.depth = depth + 1;
-                rc = report(&nfo, ctx); if (rc) break;
-                
-                rc = KTableCheckIndexMD5(idxDir, &nfo, report, ctx);
-                if (rc == 0 && level > 0)
-                {
-                    const KIndex *idx;
-                    rc = KTableOpenIndexRead(self, &idx, nfo.objName);
-
-                    if ( rc != 0 )
-                    {
-                        nfo.type = ccrpt_Done;
-                        nfo.info.done.rc = rc;
-                        nfo.info.done.mesg = "could not be opened";
-                    }
-                    else
-                    {
-                        KIndexSetMaxRowId ( idx, max_row_id );
-
-                        nfo.type = ccrpt_Index;
-                        rc = KIndexConsistencyCheck(idx, level < 3 ? 1 : 3,
-                                                    &nfo.info.index.start_id,
-                                                    &nfo.info.index.id_range,
-                                                    &nfo.info.index.num_keys,
-                                                    &nfo.info.index.num_rows,
-                                                    &nfo.info.index.num_holes);
-                        KIndexRelease ( idx );
-                        if ( rc != 0 )
-                        {
-                            nfo.type = ccrpt_Done;
-                            nfo.info.done.rc = rc;
-                            nfo.info.done.mesg = "could not be validated";
-                        }
-                    }
-
-                    rc = report(&nfo, ctx);
-                }
-            }
-
-            KDirectoryRelease(idxDir);
-        }
-    }
-
-    KNamelistRelease(list);
-
-    return rc;
-}
-
-LIB_EXPORT
-rc_t CC KTableConsistencyCheck(const KTable *self, uint32_t depth, uint32_t level,
-    CCReportFunc report, void *ctx, INSDC_SRA_platform_id platform)
-{
-    rc_t rc = 0;
-    uint32_t type;
-    
-    bool indexOnly = level & CC_INDEX_ONLY;
-    if (indexOnly) {
-        level &= ~CC_INDEX_ONLY;
-    }
-
-    if (self == NULL)
-        return RC(rcDB, rcTable, rcValidating, rcSelf, rcNull);
-    
-    if (depth == 0) {
-        CCReportInfoBlock info;
-        
-        KTableGetName(self, &info.objName);
-        info.objId = 0;
-        info.objType = kptTable;
-        info.type = ccrpt_Visit;
-        info.info.visit.depth = 0;
-        
-        rc = report(&info, ctx);
-        if (rc) return rc;
-    }
-    
-    type = KDirectoryPathType(self->dir, "md5");
-    if (type == kptZombieFile) {
-        CCReportInfoBlock info;
-        
-        KTableGetName(self, &info.objName);
-        info.objId = 0;
-        info.objType = kptTable;
-        info.type = ccrpt_Done;
-        info.info.done.mesg = "Table may be truncated";
-        info.info.done.rc = 0;
-        
-        rc = report(&info, ctx);
-    }
-    else if (type != kptNotFound) {
-        if (!indexOnly) {
-            rc = KTableCheckMD5(self, report, ctx);
-        }
-    }
-    else {
-        CCReportInfoBlock info;
-        
-        KTableGetName(self, &info.objName);
-        info.objId = 0;
-        info.objType = kptTable;
-        info.type = ccrpt_Done;
-        info.info.done.mesg = "missing md5 file";
-        info.info.done.rc = 0;
-        
-        rc = report(&info, ctx);
-    }
-
-    if ( rc == 0 && ! indexOnly )
-        rc = KTableCheckColumns(self, depth, level, report, ctx, platform);
-
-    if ( rc == 0 )    
-        rc = KTableCheckIndices(self, depth, level, report, ctx);
-        
-    return rc;
-}
diff --git a/libs/kdb/table-priv.h b/libs/kdb/table-priv.h
deleted file mode 100644
index 7b26462..0000000
--- a/libs/kdb/table-priv.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_table_priv_
-#define _h_table_priv_
-
-#ifndef _h_kdb_table_
-#include <kdb/table.h>
-#endif
-
-#ifndef _h_klib_refcount_
-#include <klib/refcount.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KDatabase;
-struct KDBManager;
-struct KDirectory;
-
-
-/*--------------------------------------------------------------------------
- * KTable
- *  represents a table
- *  normally implemented as a directory
- *  but may be a single archive file
- *  in either executable or streamable format
- */
-struct KTable
-{
-    struct KDirectory const *dir;
-    struct KDBManager const *mgr;
-    struct KDatabase const *db;
-    KRefcount refcount;
-    uint8_t prerelease;
-    char path [ 1 ];
-};
-
-/* Attach
- * Sever
- *  like KTableRelease, except called internally
- *  indicates that a child object is letting go...
- */
-KTable *KTableAttach ( const KTable *self );
-rc_t KTableSever ( const KTable *self );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_table_priv_ */
diff --git a/libs/kdb/table.c b/libs/kdb/table.c
deleted file mode 100644
index 3072e5a..0000000
--- a/libs/kdb/table.c
+++ /dev/null
@@ -1,706 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#define TRACK_REFERENCES 0
-
-#define KONST const
-#include "table-priv.h"
-#include "dbmgr-priv.h"
-#include "database-priv.h"
-#include "kdb-priv.h"
-#undef KONST
-
-#include <kdb/extern.h>
-#include <klib/namelist.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <klib/printf.h>
-#include <os-native.h>
-#include <sysalloc.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * KTable
- *  a collection of columns indexed by row id, metadata, indices
- */
-
-/* GetPath
- *  return the absolute path to table
- */
-LIB_EXPORT rc_t CC KTableGetPath ( const KTable *self,
-    const char **path )
-{
-    if ( self == NULL )
-        return RC ( rcDB, rcTable, rcAccessing, rcSelf, rcNull );
-    if ( path == NULL )
-        return RC ( rcDB, rcTable, rcAccessing, rcParam, rcNull );
-
-    *path = self->path;
-
-    return 0;
-}
-
-/* Whack
- */
-static
-rc_t KTableWhack ( KTable *self )
-{
-    rc_t rc = 0;
-
-    KRefcountWhack ( & self -> refcount, "KTable" );
-
-    if ( self -> db != NULL )
-    {
-        rc = KDatabaseSever ( self -> db );
-        if ( rc == 0 )
-            self -> db = NULL;
-    }
-
-    if ( rc == 0 )
-        rc = KDBManagerSever ( self -> mgr );
-
-    if ( rc == 0 )
-    {
-        KDirectoryRelease ( self -> dir );
-        free ( self );
-        return 0;
-    }
-
-    KRefcountInit ( & self -> refcount, 1, "KTable", "whack", "ktbl" );
-
-    return rc;
-}
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-LIB_EXPORT rc_t CC KTableAddRef ( const KTable *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KTable" ) )
-        {
-        case krefLimit:
-            return RC ( rcDB, rcTable, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KTableRelease ( const KTable *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KTable" ) )
-        {
-        case krefWhack:
-            return KTableWhack ( ( KTable* ) self );
-        case krefNegative:
-            return RC ( rcDB, rcTable, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-/* Attach
- * Sever
- */
-KTable *KTableAttach ( const KTable *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAddDep ( & self -> refcount, "KTable" ) )
-        {
-        case krefLimit:
-            return NULL;
-        }
-    }
-    return ( KTable* ) self;
-}
-
-/* Sever
- *  like KTableRelease, except called internally
- *  indicates that a child object is letting go...
- */
-rc_t KTableSever ( const KTable *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDropDep ( & self -> refcount, "KTable" ) )
-        {
-        case krefWhack:
-            return KTableWhack ( ( KTable* ) self );
-        case krefNegative:
-            return RC ( rcDB, rcTable, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-/* Make
- *  make an initialized structure
- *  NB - does NOT attach reference to dir, but steals it
- */
-static
-rc_t KTableMake ( KTable **tblp, const KDirectory *dir, const char *path )
-{
-    KTable *tbl;
-
-    assert ( tblp != NULL );
-    assert ( path != NULL );
-
-    tbl = malloc ( sizeof * tbl + strlen ( path ) );
-    if ( tbl == NULL )
-    {
-        * tblp = NULL;
-        return RC ( rcDB, rcTable, rcConstructing, rcMemory, rcExhausted );
-    }
-
-    memset ( tbl, 0, sizeof * tbl );
-    tbl -> dir = dir;
-    KRefcountInit ( & tbl -> refcount, 1, "KTable", "make", path );
-    strcpy ( tbl -> path, path );
-
-    * tblp = tbl;
-    return 0;
-}
-
-
-/* OpenTableRead
- * VOpenTableRead
- *  open a table for read
- *
- *  "tbl" [ OUT ] - return parameter for newly opened table
- *
- *  "path" [ IN ] - NUL terminated string in
- *  wd-native character set giving path to table
- */
-static
-rc_t KDBManagerVOpenTableReadInt ( const KDBManager *self,
-    const KTable **tblp, const KDirectory *wd, bool try_srapath,
-    const char *path, va_list args )
-{
-    rc_t rc;
-
-    char tblpath [ 4096 ];
-    int z = ( args == NULL ) ?
-        snprintf ( tblpath, sizeof tblpath, path ):
-        vsnprintf ( tblpath, sizeof tblpath, path, args );
-    if ( z < 0 || ( size_t ) z >= sizeof tblpath )
-        rc = RC ( rcDB, rcMgr, rcOpening, rcPath, rcExcessive );
-    else
-    {
-        KTable *tbl;
-        const KDirectory *dir;
-        bool prerelease = false;
-
-        rc = KDBOpenPathTypeRead ( self, wd, tblpath, &dir, kptTable, NULL, try_srapath );
-        if ( rc != 0 )
-        {
-            prerelease = true;
-            rc = KDBOpenPathTypeRead ( self, wd, tblpath, &dir, kptPrereleaseTbl, NULL, try_srapath );
-        }
-
-        if ( rc == 0 )
-        {
-            rc = KTableMake ( & tbl, dir, tblpath );
-            if ( rc == 0 )
-            {
-                tbl -> mgr = KDBManagerAttach ( self );
-                tbl -> prerelease = prerelease;
-                * tblp = tbl;
-                return 0;
-            }
-            KDirectoryRelease ( dir );
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC KDBManagerOpenTableRead ( const KDBManager *self,
-    const KTable **tbl, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDBManagerVOpenTableRead ( self, tbl, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC KDBManagerVOpenTableRead ( const KDBManager *self,
-    const KTable **tbl, const char *path, va_list args )
-{
-    if ( tbl == NULL )
-        return RC ( rcDB, rcMgr, rcOpening, rcParam, rcNull );
-
-    * tbl = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcMgr, rcOpening, rcSelf, rcNull );
-
-    return KDBManagerVOpenTableReadInt ( self, tbl, self -> wd, true, path, args);
-}
-
-LIB_EXPORT rc_t CC KDatabaseOpenTableRead ( const KDatabase *self,
-    const KTable **tbl, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = KDatabaseVOpenTableRead ( self, tbl, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDatabaseVOpenTableRead ( const KDatabase *self,
-    const KTable **tblp, const char *name, va_list args )
-{
-    rc_t rc;
-    char path [ 256 ];
-
-    if ( tblp == NULL )
-        return RC ( rcDB, rcDatabase, rcOpening, rcParam, rcNull );
-
-    * tblp = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcDatabase, rcOpening, rcSelf, rcNull );
-
-    rc = KDBVMakeSubPath ( self -> dir,
-        path, sizeof path, "tbl", 3, name, args );
-    if ( rc == 0 )
-    {
-        rc = KDBManagerVOpenTableReadInt ( self -> mgr, tblp,
-            self -> dir, false, path, NULL );
-        if ( rc == 0 )
-        {
-            KTable *tbl = ( KTable* ) * tblp;
-            tbl -> db = KDatabaseAttach ( self );
-        }
-    }
-
-    return rc;
-}
-
-
-/* Locked
- *  returns non-zero if locked
- */
-LIB_EXPORT bool CC KTableLocked ( const KTable *self )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        return false;
-
-    rc = KDBWritable ( self -> dir, "." );
-    return GetRCState ( rc ) == rcLocked;
-}
-
-
-/* Exists
- *  returns true if requested object exists
- *
- *  "type" [ IN ] - a KDBPathType
- *
- *  "path" [ IN ] - NUL terminated path
- */
-LIB_EXPORT bool CC KTableVExists ( const KTable *self, uint32_t type, const char *name, va_list args )
-{
-    if ( self != NULL && name != NULL && name [ 0 ] != 0 )
-    {
-        rc_t rc;
-        const char *ns;
-        char path [ 256 ];
-
-        switch ( type )
-        {
-        case kptIndex:
-            ns = "idx";
-            break;
-
-        case kptColumn:
-            ns = "col";
-            break;
-
-        default:
-            return false;
-        }
-
-        rc = KDBVMakeSubPath ( self -> dir, path, sizeof path, ns, 3, name, args );
-        if ( rc == 0 )
-        {
-            switch ( KDirectoryPathType ( self -> dir, path ) )
-            {
-            case kptFile:
-            case kptDir:
-            case kptFile | kptAlias:
-            case kptDir | kptAlias:
-                return true;
-            }
-        }
-    }
-    return false;
-}
-
-LIB_EXPORT bool CC KTableExists ( const KTable *self, uint32_t type, const char *name, ... )
-{
-    bool exists;
-
-    va_list args;
-    va_start ( args, name );
-
-    exists = KTableVExists ( self, type, name, args );
-
-    va_end ( args );
-
-    return exists;
-}
-
-
-/* IsAlias
- *  returns true if object name is an alias
- *  returns path to fundamental name if it was aliased
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptIndex and kptColumn
- *
- *  "resolved" [ OUT ] and "rsize" [ IN ] - optional output buffer
- *  for fundamenta object name if "alias" is not a fundamental name, 
- *
- *  "name" [ IN ] - NUL terminated object name
- */
-LIB_EXPORT bool CC KTableIsAlias ( const KTable *self, uint32_t type,
-    char *resolved, size_t rsize, const char *name )
-{
-    if ( self != NULL && name != NULL && name [ 0 ] != 0 )
-    {
-        rc_t rc;
-        const char *ns;
-        char path [ 256 ];
-
-        switch ( type )
-        {
-        case kptIndex:
-            ns = "idx";
-            break;
-
-        case kptColumn:
-            ns = "col";
-            break;
-
-        default:
-            return false;
-        }
-
-        rc = KDBMakeSubPath ( self -> dir, path, sizeof path, ns, 3, name );
-        if ( rc == 0 )
-        {
-            switch ( KDirectoryPathType ( self -> dir, path ) )
-            {
-            case kptFile | kptAlias:
-            case kptDir | kptAlias:
-                if ( resolved != NULL && rsize != 0 )
-                {
-                    const KDirectory *sub;
-                    rc = KDirectoryOpenDirRead ( self -> dir, & sub, false, ns );
-                    * resolved = 0;
-                    if ( rc != 0 )
-                        PLOGERR ( klogWarn, ( klogWarn, rc, "failed to open subdirectory '$(sub)'", "sub=%s", ns ) );
-                    else
-                    {
-                        rc = KDirectoryResolveAlias ( sub, false, resolved, rsize, name );
-                        KDirectoryRelease ( sub );
-                        if ( rc != 0 )
-                            PLOGERR ( klogWarn, ( klogWarn, rc, "failed to resolve alias '$(alias)'", "alias=%s", name ) );
-                    }
-                }
-                return true;
-            }
-        }
-    }
-
-    if ( resolved != NULL && rsize != 0 )
-        * resolved = 0;
-
-    return false;
-}
-
-
-/* Writable
- *  returns 0 if object is writable
- *  or a reason why if not
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptIndex and kptColumn
- *
- *  "path" [ IN ] - NUL terminated path
- */
-LIB_EXPORT rc_t CC KTableVWritable ( const KTable *self, uint32_t type, const char *name, va_list args )
-{
-    /* TBD */
-    return -1;
-}
-
-LIB_EXPORT rc_t CC KTableWritable ( const KTable *self, uint32_t type, const char *name, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, name );
-
-    rc = KTableVWritable ( self, type, name, args );
-
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* OpenManager
- *  duplicate reference to manager
- *  NB - returned reference must be released
- */
-LIB_EXPORT rc_t CC KTableOpenManagerRead ( const KTable *self, const KDBManager **mgr )
-{
-    rc_t rc;
-
-    if ( mgr == NULL )
-        rc = RC ( rcDB, rcTable, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcTable, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = KDBManagerAddRef ( self -> mgr );
-            if ( rc == 0 )
-            {
-                * mgr = self -> mgr;
-                return 0;
-            }
-        }
-
-        * mgr = NULL;
-    }
-
-    return rc;
-}
-
-
-/* OpenParent
- *  duplicate reference to parent database
- *  NB - returned reference must be released
- */
-LIB_EXPORT rc_t CC KTableOpenParentRead ( const KTable *self, const KDatabase **db )
-{
-    rc_t rc;
-
-    if ( db == NULL )
-        rc = RC ( rcDB, rcTable, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcTable, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = KDatabaseAddRef ( self -> db );
-            if ( rc == 0 )
-            {
-                * db = self -> db;
-                return 0;
-            }
-        }
-
-        * db = NULL;
-    }
-
-    return rc;
-}
-
-
-/* GetDirectory
- *  access the directory in use
- */
-LIB_EXPORT rc_t CC KTableOpenDirectoryRead ( const KTable *self, const KDirectory **dir )
-{
-    rc_t rc;
-
-    if ( dir == NULL )
-        rc = RC ( rcDB, rcTable, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcTable, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            * dir = self -> dir;
-            return KDirectoryAddRef ( * dir );
-        }
-
-        * dir = NULL;
-    }
-
-    return rc;
-}
-
-
-/* ModDate
- *  get modification date
- */
-LIB_EXPORT rc_t CC KTableModDate ( const KTable *self, KTime_t *mtime )
-{
-    rc_t rc;
-
-    if ( mtime == NULL )
-        rc = RC ( rcDB, rcTable, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcTable, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            /* HACK ALERT - there needs to be a proper way to record modification times */
-            const KDirectory *dir = self -> dir;
-
-            /* this only tells the last time the table was locked,
-               which may be close to the last time it was modified */
-            rc = KDirectoryDate ( dir, mtime, "lock" );
-            if ( rc == 0 )
-                return 0;
-
-            if ( GetRCState ( rc ) == rcNotFound )
-            {
-                rc = KDirectoryDate ( dir, mtime, "sealed" );
-                if ( rc == 0 )
-                    return 0;
-            }
-
-            /* get directory timestamp */
-            rc = KDirectoryDate ( dir, mtime, "." );
-            if ( rc == 0 )
-                return 0;
-        }
-
-        * mtime = 0;
-    }
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * KNamelist
- */
-
-/* List
- *  create table listings
- */
-struct FilterData
-{
-    const KDBManager * mgr;
-    int type;
-};
-
-static
-bool CC KDatabaseListFilter ( const KDirectory *dir, const char *name, void *data_ )
-{
-    struct FilterData * data = data_;
-    return ( KDBOpenPathTypeRead ( data->mgr, dir, name, NULL, data->type, NULL, false ) == 0 );
-}
-
-LIB_EXPORT rc_t CC KTableListCol ( const KTable *self, KNamelist **names )
-{
-    if ( self != NULL )
-    {
-        struct FilterData data;
-
-        data.mgr = self->mgr;
-        data.type = kptColumn;
-
-        return KDirectoryVList ( self -> dir,
-            names, KDatabaseListFilter, &data, "col", NULL );
-    }
-
-    if ( names != NULL )
-        * names = NULL;
-
-    return RC ( rcDB, rcTable, rcListing, rcSelf, rcNull );
-}
-
-static
-bool CC KTableListIdxFilter ( const KDirectory *dir, const char *name, void *data )
-{
-    const size_t sz = strlen(name);
-    
-    if (sz > 4 && strcmp(&name[sz - 4], ".md5") == 0)
-        return false;
-    return true;
-}
-
-static
-bool CC KTableListSkeyFilter ( const KDirectory *dir, const char *name, void *data )
-{
-    if ( strcmp ( name, "skey" ) == 0 )
-        return true;
-    return false;
-}
-
-LIB_EXPORT rc_t CC KTableListIdx ( const KTable *self, KNamelist **names )
-{
-    if ( self != NULL )
-    {
-        if ( ! self -> prerelease )
-        {
-            return KDirectoryVList ( self -> dir,
-                names, KTableListIdxFilter, NULL, "idx", NULL );
-        }
-
-        return KDirectoryVList ( self -> dir,
-            names, KTableListSkeyFilter, NULL, ".", NULL );
-    }
-
-    if ( names != NULL )
-        * names = NULL;
-
-    return RC ( rcDB, rcTable, rcListing, rcSelf, rcNull );
-}
diff --git a/libs/kdb/trieidx-priv.h b/libs/kdb/trieidx-priv.h
deleted file mode 100644
index a4174ff..0000000
--- a/libs/kdb/trieidx-priv.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_trieidx_priv_
-#define _h_trieidx_priv_
-
-#include "index-priv.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * KPTrieIndexHdr_v1
- */
-typedef KIndexFileHeader_v1_v2 KPTrieIndexHdr_v1;
-
-/*--------------------------------------------------------------------------
- * KPTrieIndexHdr_v2
- */
-typedef struct KPTrieIndexHdr_v2 KPTrieIndexHdr_v2;
-struct KPTrieIndexHdr_v2
-{
-    KIndexFileHeader_v1_v2 dad;
-    int64_t first;
-    int64_t last;
-    uint16_t id_bits;
-    uint16_t span_bits;
-    uint16_t align [ 2 ];
-};
-
-/*--------------------------------------------------------------------------
- * KPTrieIndexHdr_v3
- */
-typedef struct KPTrieIndexHdr_v3 KPTrieIndexHdr_v3;
-struct KPTrieIndexHdr_v3
-{
-    struct KIndexFileHeader_v3 dad;
-    int64_t first;
-    int64_t last;
-    uint16_t id_bits;
-    uint16_t span_bits;
-    uint16_t align [ 2 ];
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* _h_trieidx_priv_ */
diff --git a/libs/kdb/trieidx-v1.c b/libs/kdb/trieidx-v1.c
deleted file mode 100644
index 18e7e26..0000000
--- a/libs/kdb/trieidx-v1.c
+++ /dev/null
@@ -1,222 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kdb/extern.h>
-#include "index-priv.h"
-#include "kdbfmt-priv.h"
-#include <klib/ptrie.h>
-#include <klib/text.h>
-#include <kfs/directory.h>
-#include <kfs/file.h>
-#include <kfs/mmap.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <limits.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <byteswap.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * KPTrieIndex_v1
- *  persisted keymap
- */
-
-/* KPTrieIndexInit
- *  opens and initializes persisted keymap structure
- */
-rc_t KPTrieIndexInit_v1 ( KPTrieIndex_v1 *self, const KMMap *mm, bool byteswap )
-{
-    size_t size;
-    rc_t rc = KMMapSize ( mm, & size );
-    if ( rc == 0 )
-    {
-        const KDBHdr *hdr;
-        rc = KMMapAddrRead ( mm, ( const void** ) & hdr );
-        if ( rc == 0 )
-        {
-            /* try to create the pttree */
-            rc = PTrieMakeOrig ( & self -> key2id,
-                hdr + 1, size -= sizeof * hdr, byteswap );
-            if ( rc == 0 )
-            {
-                size_t ptsize = PTrieSize ( self -> key2id );
-                if ( ptsize <= size )
-                {
-                    /* just in case */
-                    self -> mm = NULL;
-
-                    /* record for projection */
-                    self -> byteswap = byteswap;
-
-                    /* it could be stored without projection */
-                    if ( ptsize == size )
-                    {
-                        self -> id2node = NULL;
-                        self -> first = self -> last = 0;
-                        return 0;
-                    }
-                            
-                    /* assume this is projection index */
-                    self -> id2node = ( void* )
-                        ( ( char* ) ( hdr + 1 ) + ptsize );
-                    size -= ptsize;
-                            
-                    /* it must have at least 4 bytes
-                       and be 4 byte aligned */
-                    if ( size >= sizeof ( uint32_t ) && ( size & 3 ) == 0 )
-                    {
-                        /* first entry is starting key
-                           remaining entries are node ids */
-                        self -> first = * self -> id2node ++;
-                        size -= sizeof self -> id2node [ 0 ];
-                        if ( size == 0 )
-                        {
-                            /* forget if empty */
-                            self -> id2node = NULL;
-                            self -> first = self -> last = 0;
-                            return 0;
-                        }
-                        /* remaining entries */
-                        self -> last = self -> first + ( size >> 2 ) - 1;
-                        return 0;
-                    }
-                }
-
-                PTrieWhack ( self -> key2id );
-                self -> key2id = NULL;
-
-                rc = RC ( rcDB, rcIndex, rcConstructing, rcTrie, rcCorrupt );
-            }
-        }
-    }
-
-    return rc;
-}
-
-/* KPTrieIndexWhack_v1
- *  closes down keymap
- */
-void KPTrieIndexWhack_v1 ( KPTrieIndex_v1 *self )
-{
-    PTrieWhack ( self -> key2id );
-    KMMapRelease ( self -> mm );
-    memset ( self, 0, sizeof * self );
-}
-
-
-/*--------------------------------------------------------------------------
- * KTrieIndex_v1
- */
-
-/* whack whack */
-void KTrieIndexWhack_v1 ( KTrieIndex_v1 *self )
-{
-    KPTrieIndexWhack_v1 ( & self -> pt );
-}
-
-/* initialize an index from file */
-rc_t KTrieIndexOpen_v1 ( KTrieIndex_v1 *self, const KMMap *mm, bool byteswap )
-{
-    rc_t rc;
-
-    memset ( self, 0, sizeof * self );
-
-    rc = KPTrieIndexInit_v1 ( & self -> pt, mm, byteswap );
-    if ( rc == 0 )
-    {
-        rc = KMMapAddRef ( mm );
-        if ( rc == 0 )
-        {
-            self -> pt . mm = mm;
-            return 0;
-        }
-    }
-
-    KTrieIndexWhack_v1 ( self );
-    return rc;
-}
-
-/* map key to id ( was Key2Id ) */
-rc_t KTrieIndexFind_v1 ( const KTrieIndex_v1 *self, const char *str, uint32_t *id,
-    int ( CC * custom_cmp ) ( const void *item, const PBSTNode *n, void *data ), void * data )
-{
-    if ( self -> pt . key2id != NULL )
-    {
-        PTNode n;
-        String key;
-        unsigned int nid;
-
-        StringInitCString ( & key, str );
-        nid = PTrieFind ( self -> pt . key2id, & key, & n, custom_cmp, data );
-        if ( nid != 0 )
-        {
-            assert ( n . data . size == sizeof * id );
-            memcpy ( id, n . data . addr, sizeof * id );
-            return 0;
-        }
-    }
-
-    return RC ( rcDB, rcIndex, rcSelecting, rcString, rcNotFound );
-}
-
-/* projection index id to key-string ( was Id2Key ) */
-rc_t KTrieIndexProject_v1 ( const KTrieIndex_v1 *self,
-    uint32_t id, char *key_buff, size_t buff_size, size_t *actsize)
-{
-    if ( self -> pt . id2node != NULL &&
-         id >= self -> pt . first &&
-         id <= self -> pt . last )
-    {
-        PTNode n;
-        uint32_t node = self -> pt . id2node [ id - self -> pt . first ];
-        rc_t rc = PTrieGetNode ( self -> pt . key2id,
-            & n, self -> pt . byteswap ? bswap_32 ( node ) : node );
-        if ( rc == 0 )
-        {
-            const String *key;
-            rc = PTNodeMakeKey ( & n, & key );
-            if ( rc == 0 )
-            {
-                if ( actsize != NULL )
-                    * actsize = key -> size;
-                if ( key -> size >= buff_size )
-                    rc = RC ( rcDB, rcIndex, rcProjecting, rcBuffer, rcInsufficient );
-                else
-                    string_copy ( key_buff, buff_size, key -> addr, key -> size );
-
-                StringWhack ( ( String* ) key );
-            }
-            return rc;
-        }
-    }
-
-    return RC ( rcDB, rcIndex, rcProjecting, rcId, rcNotFound );
-}
diff --git a/libs/kdb/trieidx-v2.c b/libs/kdb/trieidx-v2.c
deleted file mode 100644
index 1a2811e..0000000
--- a/libs/kdb/trieidx-v2.c
+++ /dev/null
@@ -1,1047 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kdb/extern.h>
-#include "index-priv.h"
-#include "trieidx-priv.h"
-#include <klib/ptrie.h>
-#include <klib/text.h>
-#include <kfs/directory.h>
-#include <kfs/file.h>
-#include <kfs/mmap.h>
-#include <klib/pack.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <limits.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <byteswap.h>
-#include <assert.h>
-
-#define KTRIE_ZEROS_KPTRIE 1
-
-/*--------------------------------------------------------------------------
- * KPTrieIndex_v2
- *  persisted keymap
- */
-
-
-/* Init
- *  opens and initializes persisted keymap structure
- */
-static
-rc_t KPTrieIndexInitID2Ord ( KPTrieIndex_v2 *self, size_t in_size,
-    int variant, int span_bits, int elem_bits )
-{
-    rc_t rc;
-    union
-    {
-        uint8_t *v8;
-        uint16_t *v16;
-        uint32_t *v32;
-        uint64_t *v64;
-    } dst;
-    size_t elem_bytes = elem_bits >> 3;
-    uint32_t scount = self -> count - 1;
-
-    assert ( self -> count != 0 );
-
-    if ( span_bits * scount > in_size * 8 )
-        return RC ( rcDB, rcIndex, rcConstructing, rcIndex, rcCorrupt );
-
-    dst . v8 = malloc ( self -> count * elem_bytes );
-    if ( dst . v8 == NULL )
-        rc = RC ( rcDB, rcIndex, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        size_t usize;
-        rc = Unpack ( span_bits, elem_bits,
-            & self -> ord2node [ self -> count ], 0,
-            span_bits * scount, NULL, & dst . v8 [ elem_bytes ],
-            scount * elem_bytes, & usize );
-        if ( rc == 0 )
-        {
-            uint32_t i;
-
-            self -> id2ord . v8 = dst . v8;
-            self -> variant = variant;
-
-            /* integrate to simple translation */
-            switch ( variant )
-            {
-            case 1:
-                dst . v8 [ 0 ] = 0;
-                for ( i = 0; i < scount; ++ i )
-                    dst . v8 [ i + 1 ] += dst . v8 [ i ];
-                break;
-            case 2:
-                dst . v16 [ 0 ] = 0;
-                for ( i = 0; i < scount; ++ i )
-                    dst . v16 [ i + 1 ] += dst . v16 [ i ];
-                break;
-            case 3:
-                dst . v32 [ 0 ] = 0;
-                for ( i = 0; i < scount; ++ i )
-                    dst . v32 [ i + 1 ] += dst . v32 [ i ];
-                break;
-            case 4:
-                dst . v64 [ 0 ] = 0;
-                for ( i = 0; i < scount; ++ i )
-                    dst . v64 [ i + 1 ] += dst . v64 [ i ];
-                break;
-            }
-
-            return 0;
-        }
-
-        free ( dst . v8 );
-    }
-
-    return rc;
-}
-
-static
-void CC KPTrieIndexExtractV1Range_v2 ( PTNode *n, void *data )
-{
-    KPTrieIndex_v2 *self = data;
-
-    /* capture node id */
-    uint32_t id;
-    assert ( n -> data . size == sizeof id );
-    memcpy ( & id, n -> data . addr, sizeof id );
-
-    /* perform min/max */
-    if ( self -> count == 0 )
-        self -> first = self -> last = id;
-    else if ( id < self -> first )
-        self -> first = id;
-    else if ( id > self -> last )
-        self -> last = id;
-
-    ++ self -> count;
-}
-
-static
-rc_t KPTrieIndexInitFromV1_v2 ( KPTrieIndex_v2 *self, const KMMap *mm, bool byteswap )
-{
-    KPTrieIndex_v1 v1;
-    rc_t rc = KPTrieIndexInit_v1 ( & v1, mm, byteswap );
-    if ( rc == 0 )
-    {
-        uint32_t *ord2node;
-        uint32_t total_id, test_id;
-        uint32_t i, id, id_bits, num_ids;
-
-        /* assume preservation of persisted projection index */
-        self -> byteswap = byteswap;
-
-        /* hopefully we got a projection index */
-        if ( v1 . id2node == NULL )
-        {
-#if ! KTRIE_ZEROS_KPTRIE
-            self -> count = 0;
-#endif
-            /* need to derive first and last from trie */
-            PTrieForEach ( v1 . key2id, KPTrieIndexExtractV1Range_v2, self );
-            if ( self -> count == 0 )
-                KPTrieIndexWhack_v1 ( & v1 );
-            else
-            {
-                /* take trie as-is */
-                self -> key2id = v1 . key2id;
-                self -> maxid = self -> last;
-            }
-
-            /* note that this assumes a span of 1 for
-               each id. there are no known uses of v1 without
-               a projection index, so this is unlikely to be important */
-
-            return 0;
-        }
-
-        /* take id range */
-        self -> first = v1 . first;
-        self -> last = self -> maxid = v1 . last;
-
-        /* count comes from trie as always */
-        self -> count = PTrieCount ( v1 . key2id );
-
-        /* detect empty trie */
-        if ( self -> count == 0 || self -> first > self -> last )
-        {
-            self -> first = self -> last = self -> maxid = 0;
-            return 0;
-        }
-
-        /* take trie as-is */
-        self -> key2id = v1 . key2id;
-
-        /* now decide whether to use 1-1 or sparse projection
-           if the number of slots is less than twice the number of nodes,
-           it is more efficient to store the nodes as a linear array,
-           and represent missing ids as nulls.
-         */
-        if ( ( self -> last - self -> first ) < ( ( int64_t ) self -> count << 1 ) )
-        {
-            /* take the old projection array as-is,
-               treating NULL node ids as holes */
-            self -> ord2node = v1 . id2node;
-            return 0;
-        }
-
-        /* need to create a new projection index */
-        self -> byteswap = false;
-
-        /* convert to sparse
-           calculate id bits - notice that
-           test_id gets left shifted so that
-           the loop is guaranteed to exit */
-        num_ids = ( uint32_t ) ( self -> last - self -> first + 1 );
-        for ( total_id = num_ids >> 1, id_bits = 1, test_id = 1;
-            test_id <= total_id;
-            ++ id_bits, test_id <<= 1 )
-            ( void ) 0;
-
-        /* determine variant */
-        if ( id_bits <= 8 )
-        {
-            /* allocate 4 bytes for new ord2node and 1 for id2ord */
-            uint8_t *id2ord = malloc ( self -> count * 5 );
-            if ( id2ord == NULL )
-                rc = RC ( rcDB, rcIndex, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                ord2node = ( uint32_t* ) & id2ord [ self -> count ];
-                self -> ord2node = ord2node;
-                self -> id2ord . v8 = id2ord;
-                self -> variant = 1;
-
-                /* walk across v1 table, looking at each id */
-                for ( i = id = 0; id < num_ids; ++ id )
-                {
-                    /* detect non NULL node ids
-                       and pretend they represent a contiguous
-                       span with no holes in id space */
-                    if ( v1 . id2node [ id ] != 0 )
-                    {
-                        /* prevent overwriting */
-                        if ( i == self -> count )
-                        {
-                            rc = RC ( rcDB, rcIndex, rcConstructing, rcIndex, rcCorrupt );
-                            break;
-                        }
-
-                        /* record id and node for slot */
-                        id2ord [ i ] = ( uint8_t ) id;
-                        ord2node [ i ] = byteswap ? bswap_32 ( v1 . id2node [ id ] ) : v1 . id2node [ id ];
-                        ++ i;
-                    }
-                }
-            }
-        }
-        else if ( id_bits <= 16 )
-        {
-            uint16_t *id2ord = malloc ( self -> count * 6 );
-            if ( id2ord == NULL )
-                rc = RC ( rcDB, rcIndex, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                ord2node = ( uint32_t* ) & id2ord [ self -> count ];
-                self -> ord2node = ord2node;
-                self -> id2ord . v16 = id2ord;
-                self -> variant = 2;
-
-                for ( i = id = 0; id < num_ids; ++ id )
-                {
-                    if ( v1 . id2node [ id ] != 0 )
-                    {
-                        if ( i == self -> count )
-                        {
-                            rc = RC ( rcDB, rcIndex, rcConstructing, rcIndex, rcCorrupt );
-                            break;
-                        }
-
-                        id2ord [ i ] = ( uint16_t ) id;
-                        ord2node [ i ] = byteswap ? bswap_32 ( v1 . id2node [ id ] ) : v1 . id2node [ id ];
-                        ++ i;
-                    }
-                }
-            }
-        }
-        else
-        {
-            uint32_t *id2ord = malloc ( self -> count * 8 );
-            if ( id2ord == NULL )
-                rc = RC ( rcDB, rcIndex, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                ord2node = & id2ord [ self -> count ];
-                self -> ord2node = ord2node;
-                self -> id2ord . v32 = id2ord;
-                self -> variant = 3;
-
-                for ( i = id = 0; id < num_ids; ++ id )
-                {
-                    if ( v1 . id2node [ id ] != 0 )
-                    {
-                        if ( i == self -> count )
-                        {
-                            rc = RC ( rcDB, rcIndex, rcConstructing, rcIndex, rcCorrupt );
-                            break;
-                        }
-
-                        id2ord [ i ] = id;
-                        ord2node [ i ] = byteswap ? bswap_32 ( v1 . id2node [ id ] ) : v1 . id2node [ id ];
-                        ++ i;
-                    }
-                }
-            }
-        }
-        
-        if ( rc == 0 )
-        {
-            if ( i == self -> count )
-                return 0;
-
-            rc = RC ( rcDB, rcIndex, rcConstructing, rcIndex, rcCorrupt );
-        }
-
-        KPTrieIndexWhack_v1 ( & v1 );
-    }
-
-    return rc;
-}
-
-rc_t KPTrieIndexInit_v2 ( KPTrieIndex_v2 *self, const KMMap *mm, bool byteswap )
-{
-    /* get size of map, assumed to be size of file */
-    size_t size;
-    rc_t rc = KMMapSize ( mm, & size );
-    if ( rc == 0 )
-    {
-        const KPTrieIndexHdr_v2 *hdr;
-
-#if ! KTRIE_ZEROS_KPTRIE
-        self -> mm = NULL;
-        self -> ord2node = NULL;
-        self -> id2ord . v32 = NULL;
-        self -> variant = 0;
-#endif
-
-        /* ignore empty file */
-        if ( size == 0 )
-        {
-#if ! KTRIE_ZEROS_KPTRIE
-            self -> first = self -> last = self -> maxid = 0;
-            self -> key2id = NULL;
-            self -> count = 0;
-#endif
-            return 0;
-        }
-
-        /* have to have at least the base header */
-        if ( size < sizeof hdr -> dad )
-            return RC ( rcDB, rcIndex, rcConstructing, rcTrie, rcCorrupt );
-
-        rc = KMMapAddrRead ( mm, ( const void** ) & hdr );
-        if ( rc == 0 )
-        {
-            uint16_t id_bits, span_bits;
-            /* recheck header size */
-            if ( size < sizeof * hdr )
-                return RC ( rcDB, rcIndex, rcConstructing, rcTrie, rcCorrupt );
-
-            if ( self -> byteswap )
-            {
-                self -> first = bswap_64(hdr -> first);
-                self -> last = self -> maxid = bswap_64(hdr -> last);
-                id_bits = bswap_16(hdr -> id_bits);
-                span_bits = bswap_16(hdr -> span_bits);
-            }
-            else
-            {
-                self -> first = hdr -> first;
-                self -> last = self -> maxid = hdr -> last;
-                id_bits = hdr -> id_bits;
-                span_bits = hdr -> span_bits;
-            }
-            self -> id_bits = ( uint8_t ) id_bits;
-            self -> span_bits = ( uint8_t ) span_bits;
-            self -> byteswap = byteswap;
-
-            /* try to create the pttree */
-            rc = PTrieMakeOrig ( & self -> key2id,
-                hdr + 1, size -= sizeof * hdr, byteswap );
-            if ( rc == 0 )
-            {
-                size_t ptsize = PTrieSize ( self -> key2id );
-                if ( ptsize <= size )
-                {
-                    /* the count covers at least the number of trie nodes */
-                    self -> count = PTrieCount ( self -> key2id );
-
-                    /* it could be stored without projection */
-                    if ( ptsize == size )
-                        return 0;
-
-                    /* calculate remaining bytes */                     
-                    size -= ptsize;
-
-                    /* there must be enough for an array of 4-byte node ids */
-                    if ( size >= ( ( size_t ) self -> count << 2 ) )
-                    {
-                        /* take the persisted array as-is */
-                        self -> ord2node = ( const uint32_t* )
-                            ( ( const char* ) ( hdr + 1 ) + ptsize );
-
-                        /* read the count */
-                        if ( size >= 4 )
-                        {
-                            self -> count = * ( self -> ord2node ) ++;
-                            size -= 4;
-                            if ( byteswap )
-                                self -> count = bswap_32 ( self -> count );
-                        }
-
-                        /* determine strategy from id span and count */
-                        if ( ( self -> last - self -> first ) < ( ( int64_t ) self -> count << 1 ) )
-                        {
-                            /* must be contiguous */
-                            self -> count = ( uint32_t ) ( self -> last - self -> first + 1 );
-
-                            /* size should be exactly this number of slots */
-                            if ( size == ( ( size_t ) self -> count << 2 ) )
-                                return 0;
-
-                            /* fall through to error return */
-                        }
-                        else if ( ( size == 4 && self -> count == 1 ) || size > ( ( size_t ) self -> count << 2 ) )
-                        {
-                            /* sparse */
-                            size -= ( size_t ) self -> count << 2;
-
-                            /* unpack id map */
-                            if ( id_bits <= 8 )
-                                rc = KPTrieIndexInitID2Ord ( self, size, 1, span_bits, 8 );
-                            else if ( id_bits <= 16 )
-                                rc = KPTrieIndexInitID2Ord ( self, size, 2, span_bits, 16 );
-                            else if ( id_bits <= 32 )
-                                rc = KPTrieIndexInitID2Ord ( self, size, 3, span_bits, 32 );
-                            else
-                                rc = KPTrieIndexInitID2Ord ( self, size, 4, span_bits, 64 );
-
-                            /* done */
-                            if ( rc == 0 )
-                                return 0;
-
-                            PTrieWhack ( self -> key2id ), self -> key2id = NULL;
-                            return rc;
-                        }
-                    }
-                }
-
-                PTrieWhack ( self -> key2id ), self -> key2id = NULL;
-                rc = RC ( rcDB, rcIndex, rcConstructing, rcTrie, rcCorrupt );
-            }
-        }
-    }
-
-    return rc;
-}
-
-rc_t KPTrieIndexInit_v3_v4 ( KPTrieIndex_v2 *self, const KMMap *mm, bool byteswap, bool ptorig )
-{
-    /* get size of map, assumed to be size of file */
-    size_t size;
-    rc_t rc = KMMapSize ( mm, & size );
-    if ( rc == 0 )
-    {
-        const KPTrieIndexHdr_v3 *hdr;
-
-#if ! KTRIE_ZEROS_KPTRIE
-        self -> mm = NULL;
-        self -> ord2node = NULL;
-        self -> id2ord . v32 = NULL;
-        self -> variant = 0;
-#endif
-
-        /* ignore empty file */
-        if ( size == 0 )
-        {
-#if ! KTRIE_ZEROS_KPTRIE
-            self -> first = self -> last = self -> maxid = 0;
-            self -> key2id = NULL;
-            self -> count = 0;
-#endif
-            return 0;
-        }
-
-        /* have to have at least the base header */
-        if ( size < sizeof hdr -> dad )
-            return RC ( rcDB, rcIndex, rcConstructing, rcTrie, rcCorrupt );
-
-        rc = KMMapAddrRead ( mm, ( const void** ) & hdr );
-        if ( rc == 0 )
-        {
-            uint16_t id_bits, span_bits;
-            /* recheck header size */
-            if ( size < sizeof * hdr )
-                return RC ( rcDB, rcIndex, rcConstructing, rcTrie, rcCorrupt );
-
-            if ( self -> byteswap )
-            {
-                self -> first = bswap_64(hdr -> first);
-                self -> last = self -> maxid = bswap_64(hdr -> last);
-                id_bits = bswap_16(hdr -> id_bits);
-                span_bits = bswap_16(hdr -> span_bits);
-            }
-            else
-            {
-                self -> first = hdr -> first;
-                self -> last = self -> maxid = hdr -> last;
-                id_bits = hdr -> id_bits;
-                span_bits = hdr -> span_bits;
-            }
-            self -> id_bits = ( uint8_t ) id_bits;
-            self -> span_bits = ( uint8_t ) span_bits;
-            self -> byteswap = byteswap;
-
-            /* try to create the pttree */
-            rc = ( ptorig ? PTrieMakeOrig : PTrieMake )
-                ( & self -> key2id, hdr + 1, size -= sizeof * hdr, byteswap );
-            if ( rc == 0 )
-            {
-                size_t ptsize = PTrieSize ( self -> key2id );
-                if ( ptsize <= size )
-                {
-                    /* the count covers at least the number of trie nodes */
-                    self -> count = PTrieCount ( self -> key2id );
-
-                    /* it could be stored without projection */
-                    if ( ptsize == size )
-                        return 0;
-
-                    /* calculate remaining bytes */                     
-                    size -= ptsize;
-
-                    /* there must be enough for an array of 4-byte node ids */
-                    if ( size >= ( ( size_t ) self -> count << 2 ) )
-                    {
-                        /* take the persisted array as-is */
-                        self -> ord2node = ( const uint32_t* )
-                            ( ( const char* ) ( hdr + 1 ) + ptsize );
-
-                        /* read the count */
-                        if ( size >= 4 )
-                        {
-                            self -> count = * ( self -> ord2node ) ++;
-                            size -= 4;
-                            if ( byteswap )
-                                self -> count = bswap_32 ( self -> count );
-                        }
-
-                        /* determine strategy from id span and count */
-                        if ( ( self -> last - self -> first ) < ( ( int64_t ) self -> count << 1 ) )
-                        {
-                            /* must be contiguous */
-                            self -> count = ( uint32_t ) ( self -> last - self -> first + 1 );
-
-                            /* size should be exactly this number of slots */
-                            if ( size == ( ( size_t ) self -> count << 2 ) )
-                                return 0;
-
-                            /* fall through to error return */
-                        }
-                        else if ( ( size == 4 && self -> count == 1 ) || size > ( ( size_t ) self -> count << 2 ) )
-                        {
-                            /* sparse */
-                            size -= ( size_t ) self -> count << 2;
-
-                            /* unpack id map */
-                            if ( id_bits <= 8 )
-                                rc = KPTrieIndexInitID2Ord ( self, size, 1, span_bits, 8 );
-                            else if ( id_bits <= 16 )
-                                rc = KPTrieIndexInitID2Ord ( self, size, 2, span_bits, 16 );
-                            else if ( id_bits <= 32 )
-                                rc = KPTrieIndexInitID2Ord ( self, size, 3, span_bits, 32 );
-                            else
-                                rc = KPTrieIndexInitID2Ord ( self, size, 4, span_bits, 64 );
-
-                            /* done */
-                            if ( rc == 0 )
-                                return 0;
-
-                            PTrieWhack ( self -> key2id ), self -> key2id = NULL;
-                            return rc;
-                        }
-                    }
-                }
-
-                PTrieWhack ( self -> key2id ), self -> key2id = NULL;
-                rc = RC ( rcDB, rcIndex, rcConstructing, rcTrie, rcCorrupt );
-            }
-        }
-    }
-
-    return rc;
-}
-
-/* Whack
- *  closes down keymap
- */
-void KPTrieIndexWhack_v2 ( KPTrieIndex_v2 *self )
-{
-    free ( ( void* ) self -> id2ord . v8 );
-    PTrieWhack ( self -> key2id );
-    KMMapRelease ( self -> mm );
-    memset ( self, 0, sizeof * self );
-}
-
-uint32_t KPTrieIndexID2Ord_v2 ( const KPTrieIndex_v2 *self, int64_t id )
-{
-    if ( id >= self -> first && id <= self -> maxid )
-    {
-        int64_t nid;
-        uint32_t left, right, ord, count = self -> count;
-
-        /* convert id either to a zero-based ord,
-           or else the translated id in id2ord */
-        id -= self -> first;
-
-        /* handle type of projection */
-        switch ( self -> variant )
-        {
-        case 0:
-            /* return one-based ord */
-            return ( uint32_t ) ( id + 1 );
-
-        case 1:
-            for ( left = 1, right = count; left <= right; )
-            {
-                ord = ( left + right ) >> 1;
-                nid = self -> id2ord . v8 [ ord - 1 ];
-                if ( id == nid )
-                    return ord;
-
-                if ( id < nid )
-                {
-                    right = ord - 1;
-                    continue;
-                }
-                if ( ord == count )
-                    return ord;
-
-                nid = self -> id2ord . v8 [ ord ];
-                if ( id < nid )
-                    return ord;
-
-                left = ord + 1;
-            }
-            break;
-
-        case 2:
-            for ( left = 1, right = count; left <= right; )
-            {
-                ord = ( left + right ) >> 1;
-                nid = self -> id2ord . v16 [ ord - 1 ];
-                if ( id == nid )
-                    return ord;
-
-                if ( id < nid )
-                {
-                    right = ord - 1;
-                    continue;
-                }
-                if ( ord == count )
-                    return ord;
-
-                nid = self -> id2ord . v16 [ ord ];
-                if ( id < nid )
-                    return ord;
-
-                left = ord + 1;
-            }
-            break;
-
-        case 3:
-            for ( left = 1, right = count; left <= right; )
-            {
-                ord = ( left + right ) >> 1;
-                nid = self -> id2ord . v32 [ ord - 1 ];
-                if ( id == nid )
-                    return ord;
-
-                if ( id < nid )
-                {
-                    right = ord - 1;
-                    continue;
-                }
-                if ( ord == count )
-                    return ord;
-
-                nid = self -> id2ord . v32 [ ord ];
-                if ( id < nid )
-                    return ord;
-
-                left = ord + 1;
-            }
-            break;
-
-        case 4:
-            for ( left = 1, right = count; left <= right; )
-            {
-                ord = ( left + right ) >> 1;
-                nid = self -> id2ord . v64 [ ord - 1 ];
-                if ( id == nid )
-                    return ord;
-
-                if ( id < nid )
-                {
-                    right = ord - 1;
-                    continue;
-                }
-                if ( ord == count )
-                    return ord;
-
-                nid = self -> id2ord . v64 [ ord ];
-                if ( id < nid )
-                    return ord;
-
-                left = ord + 1;
-            }
-            break;
-        }
-    }
-    return 0;
-}
-
-static
-rc_t KPTrieIndexProject_v2 ( const KPTrieIndex_v2 *self,
-    int64_t id,
-#if V2FIND_RETURNS_SPAN
-    int64_t *start_id, uint32_t *span,
-#endif
-    char *key_buff, size_t buff_size, size_t *actsize )
-{
-    uint32_t nid, ord = KPTrieIndexID2Ord_v2 ( self, id );
-    if ( ord != 0 )
-    {
-        assert ( start_id != NULL );
-        assert ( span != NULL );
-
-        nid = self -> ord2node [ ord - 1 ];
-
-        switch ( self -> variant )
-        {
-        case 0:
-            * start_id = id;
-            for ( ; ord < self -> count; ++ ord )
-            {
-                if ( nid != self -> ord2node [ ord ] )
-                    break;
-            }
-            * span = ( uint32_t ) ( self -> first + ord - * start_id );
-            break;
-        case 1:
-            * start_id = self -> id2ord . v8 [ ord - 1 ];
-            * span = ( uint32_t ) ( ( ( ord == self -> count ) ?
-                ( self -> maxid - self -> first + 1 ) : self -> id2ord . v8 [ ord ] ) - * start_id );
-            *start_id += self -> first;
-            break;
-        case 2:
-            * start_id = self -> id2ord . v16 [ ord - 1 ];
-            * span = ( uint32_t ) ( ( ( ord == self -> count ) ?
-                ( self -> maxid - self -> first + 1 ) : self -> id2ord . v16 [ ord ] ) - * start_id );
-            *start_id += self -> first; 
-            break;
-        case 3:
-            * start_id = self -> id2ord . v32 [ ord - 1 ];
-            * span = ( uint32_t ) ( ( ( ord == self -> count ) ?
-                ( self -> maxid - self -> first + 1 ) : self -> id2ord . v32 [ ord ] ) - * start_id );
-            *start_id += self -> first; 
-            break;
-        case 4:
-            * start_id = self -> id2ord . v64 [ ord - 1 ];
-            * span = ( uint32_t ) ( ( ( ord == self -> count ) ?
-                ( self -> maxid - self -> first + 1 ) : self -> id2ord . v64 [ ord ] ) - * start_id );
-            *start_id += self -> first; 
-            break;
-        }
-
-        if ( nid != 0 )
-        {
-            rc_t rc;
-            PTNode node;
-
-            if ( self -> byteswap )
-                nid = bswap_32 ( nid );
-
-            rc = PTrieGetNode ( self -> key2id, & node, nid );
-            if ( rc == 0 )
-            {
-                const String *key;
-                rc = PTNodeMakeKey ( & node, & key );
-                if ( rc == 0 )
-                {
-                    if ( actsize != NULL )
-                        * actsize = key -> size;
-                    if ( key -> size >= buff_size )
-                        rc = RC ( rcDB, rcIndex, rcProjecting, rcBuffer, rcInsufficient );
-                    else
-                        string_copy ( key_buff, buff_size, key -> addr, key -> size );
-
-                    StringWhack ( ( String* ) key );
-                }
-            }
-            return rc;
-        }
-    }
-
-    return RC ( rcDB, rcIndex, rcProjecting, rcId, rcNotFound );
-}
-
-/* Find
- */
-static
-rc_t KPTrieIndexFind_v2 ( const KPTrieIndex_v2 *self,
-    const char *str, int64_t *start_id,
-#if V2FIND_RETURNS_SPAN
-    uint32_t *span,
-#endif
-    int ( CC * custom_cmp ) ( const void *item, const PBSTNode *n, void *data ), void *data, bool convertFromV1 )
-{
-    rc_t rc;
-
-    /* search within in-core index */
-    if ( self -> count == 0 )
-        rc = RC ( rcDB, rcIndex, rcSelecting, rcString, rcNotFound );
-    else
-    {
-        uint32_t nid;
-        PTNode pnode;
-
-        String key;
-        StringInitCString ( & key, str );
-
-        nid = PTrieFind ( self -> key2id, & key, & pnode, custom_cmp, data );
-        if ( nid == 0 )
-            rc = RC ( rcDB, rcIndex, rcSelecting, rcString, rcNotFound );
-        else
-        {
-            size_t usize;
-
-            /* detect conversion from v1 */
-            if ( convertFromV1 && self -> id_bits == 0 )
-            {
-                /* v1 stored tree will have just a 32-bit spot id as data */
-                uint32_t id;
-                assert ( pnode . data . size == sizeof id );
-                memcpy ( & id, pnode . data . addr, sizeof id );
-                * start_id = id;
-                rc = 0;
-            }
-            else
-            {
-                /* should be native v2 */
-                if ( self -> id_bits > 0 )
-                {
-                    rc = Unpack ( self -> id_bits, sizeof * start_id * 8,
-                        pnode . data . addr, 0, self -> id_bits, NULL,
-                        start_id, sizeof * start_id, & usize );
-                }
-                else
-                {
-                    rc = 0;
-                }
-                * start_id += self -> first;
-            }
-
-            if ( rc == 0 )
-            {
-#if V2FIND_RETURNS_SPAN
-                if ( self -> ord2node != NULL )
-                {
-                    uint32_t ord = KPTrieIndexID2Ord_v2 ( self, * start_id );
-                    if ( ord == 0 )
-                        rc = RC ( rcDB, rcIndex, rcSelecting, rcId, rcNotFound );
-                    else if ( ord == self -> count )
-                        * span = ( uint32_t ) ( self -> maxid - * start_id + 1 );
-                    else switch ( self -> variant )
-                    {
-                    case 0:
-                        for ( ; ord < self -> count; ++ ord )
-                        {
-                            if ( nid != self -> ord2node [ ord ] )
-                                break;
-                        }
-                        * span = ( uint32_t ) ( self -> first + ord - * start_id );
-                        break;
-                    case 1:
-                        * span = ( uint32_t ) ( self -> first + self -> id2ord . v8 [ ord ] - * start_id );
-                        break;
-                    case 2:
-                        * span = ( uint32_t ) ( self -> first + self -> id2ord . v16 [ ord ] - * start_id );
-                        break;
-                    case 3:
-                        * span = ( uint32_t ) ( self -> first + self -> id2ord . v32 [ ord ] - * start_id );
-                        break;
-                    case 4:
-                        * span = ( uint32_t ) ( self -> first + self -> id2ord . v64 [ ord ] - * start_id );
-                        break;
-                    }
-                }
-                else if ( self -> span_bits == 0 )
-                    * span = 1;
-                else
-                {
-                    rc = Unpack ( self -> span_bits, sizeof * span * 8,
-                        pnode . data . addr, 0, self -> id_bits, NULL,
-                        span, sizeof * span, & usize );
-                }
-#endif
-            }
-        }
-    }
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * KTrieIndex_v2
- */
-
-
-/* whack whack */
-void KTrieIndexWhack_v2 ( KTrieIndex_v2 *self )
-{
-    KPTrieIndexWhack_v2 ( & self -> pt );
-}
-
-/* initialize an index from file */
-rc_t KTrieIndexOpen_v2 ( KTrieIndex_v2 *self, const KMMap *mm, bool byteswap )
-{
-    rc_t rc;
-    uint32_t version;
-    bool ptorig = false;
-    const KDBHdr *hdr = NULL;
-
-#if ! KTRIE_ZEROS_KPTRIE
-#error "KTrie is supposed to zero KPTrie"
-#endif
-    memset ( self, 0, sizeof * self );
-
-    /* open the prior index in persisted mode, but
-       don't load it into the core-based Trie */
-    rc = KMMapAddrRead ( mm, ( const void** ) & hdr );
-    if ( rc != 0 )
-        return rc;
-
-    self -> pt . byteswap = byteswap;
-    version = byteswap ? bswap_32 ( hdr -> version ) : hdr -> version;
-
-    switch ( version )
-    {
-    case 1:
-        rc = KPTrieIndexInitFromV1_v2 ( & self -> pt, mm, byteswap );
-        break;
-    case 2:
-        rc = KPTrieIndexInit_v2 ( & self -> pt, mm, byteswap );
-        break;
-    case 3:
-        ptorig = true;
-    case 4:
-        rc = KPTrieIndexInit_v3_v4 ( & self -> pt, mm, byteswap, ptorig );
-        break;
-    default:
-        rc = RC(rcDB, rcIndex, rcConstructing, rcIndex, rcBadVersion);
-        break;
-    }
-    if ( rc == 0 )
-    {
-        /* the file existed but was empty */
-        if ( self -> pt . key2id == NULL )
-        {
-            self -> pt . mm = NULL;
-            return 0;
-        }
-
-        /* retain a reference to memory map */
-        rc = KMMapAddRef ( mm );
-        if ( rc == 0 )
-        {
-            self -> pt . mm = mm;
-            return 0;
-        }
-
-        /* self -> pt gets whacked below */
-    }
-
-    KTrieIndexWhack_v2 ( self );
-    return rc;
-}
-
-
-/* map key to id range */
-rc_t KTrieIndexFind_v2 ( const KTrieIndex_v2 *self,
-    const char *str, int64_t *start_id,
-#if V2FIND_RETURNS_SPAN
-    uint32_t *span,
-#endif
-    int ( CC * custom_cmp ) ( const void *item, const PBSTNode *n, void *data ), void *data, bool convertFromV1  )
-{
-    /* search within persisted index */
-    if ( self -> pt . key2id != NULL )
-    {
-        return KPTrieIndexFind_v2 ( & self -> pt, str, start_id,
-#if V2FIND_RETURNS_SPAN
-                                    span,
-#endif
-                                    custom_cmp, data, convertFromV1 );
-    }
-
-    return RC ( rcDB, rcIndex, rcSelecting, rcString, rcNotFound );
-}
-
-rc_t KTrieIndexProject_v2 ( const KTrieIndex_v2 *self,
-    int64_t id,
-#if V2FIND_RETURNS_SPAN
-     int64_t *start_id, uint32_t *span,
-#endif
-    char *key_buff, size_t buff_size, size_t *actsize )
-{
-    if ( self -> pt . ord2node == NULL )
-        return RC ( rcDB, rcIndex, rcProjecting, rcId, rcNotFound );
-
-    return KPTrieIndexProject_v2 ( & self -> pt, id,
-#if V2FIND_RETURNS_SPAN
-       start_id, span,
-#endif
-        key_buff, buff_size, actsize );
-}
diff --git a/libs/kdb/trieval-v1.c b/libs/kdb/trieval-v1.c
deleted file mode 100644
index fff6cff..0000000
--- a/libs/kdb/trieval-v1.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kdb/extern.h>
-
-#include "index-priv.h"
-
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <assert.h>
-
-
-rc_t KTrieIndexCheckConsistency_v1 ( const KTrieIndex_v1 *self,
-    int64_t *start_id, uint64_t *id_range, uint64_t *num_keys,
-    uint64_t *num_rows, uint64_t *num_holes,
-    struct KIndex const *outer, bool key2id, bool id2key )
-{
-    if ( self == NULL )
-        return RC ( rcDB, rcIndex, rcValidating, rcParam, rcNull );
-
-    return KPTrieIndexCheckConsistency_v1 ( & self -> pt,
-        start_id, id_range, num_keys, num_rows, num_holes,
-        outer, key2id, id2key );
-}
diff --git a/libs/kdb/trieval-v2.c b/libs/kdb/trieval-v2.c
deleted file mode 100644
index e3e095b..0000000
--- a/libs/kdb/trieval-v2.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kdb/extern.h>
-
-#include "index-priv.h"
-
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <assert.h>
-
-
-rc_t KTrieIndexCheckConsistency_v2 ( const KTrieIndex_v2 *self,
-    int64_t *start_id, uint64_t *id_range, uint64_t *num_keys,
-    uint64_t *num_rows, uint64_t *num_holes,
-    struct KIndex const *outer, bool key2id, bool id2key, bool all_ids, bool convertFromV1  )
-{
-    if ( self == NULL )
-        return RC ( rcDB, rcIndex, rcValidating, rcParam, rcNull );
-
-    return KPTrieIndexCheckConsistency_v2 ( & self -> pt,
-        start_id, id_range, num_keys, num_rows, num_holes,
-        outer, key2id, id2key, all_ids, convertFromV1 );
-}
diff --git a/libs/kdb/u64idx-v3.c b/libs/kdb/u64idx-v3.c
deleted file mode 100644
index ce5c13f..0000000
--- a/libs/kdb/u64idx-v3.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kdb/extern.h>
-
-#include "index-priv.h"
-
-#include <kfs/directory.h>
-#include <kfs/file.h>
-#include <kfs/md5.h>
-#include <kfs/mmap.h>
-#include <klib/pbstree.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <string.h>
-
-typedef struct KU64Index_PNode KU64Index_PNode;
-struct KU64Index_PNode
-{
-    uint64_t key;
-    uint64_t key_size;
-    int64_t id;
-    uint64_t id_qty;
-};
-
-rc_t KU64IndexOpen_v3( KU64Index_v3* self, const KMMap *mm, bool byteswap )
-{
-    rc_t rc;
-    const KIndexFileHeader_v3 *hdr;
-
-    /* when opened for create, there will be no existing index */
-    if( mm == NULL )
-        return 0;
-
-    /* open the prior index in persisted mode */
-    rc = KMMapAddrRead ( mm, ( const void** ) & hdr );
-    if( rc == 0 )
-    {
-        size_t msize;
-        rc = KMMapSize ( mm, & msize );
-        if ( rc == 0 )
-        {
-            if ( msize == 0 )
-                return 0;
-            if ( msize < sizeof * hdr )
-                return RC ( rcDB, rcIndex, rcConstructing, rcIndex, rcCorrupt );
-            rc = PBSTreeMake ( & self -> tree, hdr + 1, msize - sizeof * hdr, byteswap);
-            if( rc == 0 )
-            {
-                rc = KMMapAddRef(mm);
-                if ( rc == 0 )
-                {
-                    self -> mm = mm;
-                    return 0;
-                }
-            }
-        }
-    }
-
-    KU64IndexWhack_v3(self);
-    return rc;
-}
-
-rc_t KU64IndexWhack_v3(KU64Index_v3* self)
-{
-    PBSTreeWhack(self->tree);
-    KMMapRelease(self->mm);
-    self->tree = NULL;
-    return 0;
-}
-
-typedef struct KU64Index_GrepData_struct {
-    rc_t rc;
-    rc_t (CC*func)(uint64_t key, uint64_t key_size, int64_t id, uint64_t id_qty, void* data);
-    void* data;
-    KU64Index_PNode search;
-    uint64_t* key;
-    uint64_t* key_size;
-    int64_t* id;
-    uint64_t* id_qty;
-} KU64Index_GrepData;
-
-/*
- * return true: if found or break DoUntil for FindAll
- */
-static
-bool CC KU64Index_Grep(PBSTNode *node, void *data)
-{
-    const KU64Index_PNode* n = node->data.addr;
-    KU64Index_GrepData* d = data;
-
-    if( d->search.key >= n->key && (d->search.key - n->key) < n->key_size ) {
-        if( d->func ) {
-            d->rc = (*d->func)(n->key, n->key_size, n->id, n->id_qty, d->data);
-            if( d->rc != 0 ) {
-                return true;
-            }
-        } else {
-            *d->key = n->key;
-            *d->key_size = n->key_size;
-            *d->id = n->id;
-            *d->id_qty = n->id_qty;
-            return true;
-        }
-    }
-    return false;
-}
-
-rc_t KU64IndexFind_v3( const KU64Index_v3* self, uint64_t offset, uint64_t* key, 
-    uint64_t* key_size, int64_t* id, uint64_t* id_qty )
-{
-    KU64Index_GrepData d;
-
-    memset(&d, 0, sizeof(KU64Index_GrepData));
-    d.search.key = offset;
-    d.key = key;
-    d.key_size = key_size;
-    d.id = id;
-    d.id_qty = id_qty;
-    if( !PBSTreeDoUntil(self->tree, false, KU64Index_Grep, &d) ) {
-        d.rc = RC(rcDB, rcIndex, rcSelecting, rcId, rcNotFound);
-    }
-    return d.rc;
-}
-
-
-rc_t KU64IndexFindAll_v3( const KU64Index_v3* self, uint64_t offset, 
-    rc_t (CC*f)(uint64_t key, uint64_t key_size, int64_t id, uint64_t id_qty, void* data), void* data)
-{
-    KU64Index_GrepData d;
-
-    memset(&d, 0, sizeof(KU64Index_GrepData));
-    d.func = f;
-    d.data = data;
-    d.search.key = offset;
-    PBSTreeDoUntil(self->tree, false, KU64Index_Grep, &d);
-    return d.rc;
-}
diff --git a/libs/kdb/wcoldata-priv.h b/libs/kdb/wcoldata-priv.h
deleted file mode 100644
index 9d27d09..0000000
--- a/libs/kdb/wcoldata-priv.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_coldata_priv_
-#define _h_coldata_priv_
-
-#ifndef _h_kfs_directory_
-#include <kfs/directory.h>
-#endif
-
-#ifndef _h_klib_checksum_
-#include <klib/checksum.h>
-#endif
-
-#include <kfs/file.h>
-#include <kfs/md5.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KMD5SumFmt;
-typedef union KColumnPageMap KColumnPageMap;
-
-
-/*--------------------------------------------------------------------------
- * KColumnData
- *  data fork
- *
- *  only handling append-mode today
- *
- *  kept 64-bit aligned
- */
-typedef struct KColumnData KColumnData;
-struct KColumnData
-{
-    /* cached end of data fork */
-    uint64_t eof;
-
-    /* data fork itself */
-    KFile *f;
-    KMD5File *fmd5;
-
-    /* page size */
-    size_t pgsize;
-
-};
-
-/* DefaultPageSize
- *  static method
- */
-#define KColumnDataDefaultPageSize( reuse_pages ) \
-    ( ( reuse_pages ) ? 4096 : 1 )
-
-/* Create
- */
-rc_t KColumnDataCreate ( KColumnData *self, KDirectory *dir,
-    KMD5SumFmt *md5, KCreateMode mode, uint64_t eof, size_t pgsize );
-
-/* Open
- */
-rc_t KColumnDataOpenRead ( KColumnData *self,
-    const KDirectory *dir, uint64_t eof, size_t pgsize );
-rc_t KColumnDataOpenUpdate ( KColumnData *self, KDirectory *dir,
-    KMD5SumFmt *md5, uint64_t eof, size_t pgsize );
-
-/* Whack
- */
-rc_t KColumnDataWhack ( KColumnData *self );
-
-/* Read
- *  reads from the data fork using a blob map
- */
-rc_t KColumnDataRead ( const KColumnData *self, const KColumnPageMap *pm,
-    size_t offset, void *buffer, size_t bsize, size_t *num_read );
-
-/* Write
- *  writes to the data fork using a blob map
- */
-rc_t  KColumnDataWrite ( KColumnData *self, KColumnPageMap *pm,
-    size_t offset, const void *buffer, size_t bytes, size_t *num_writ );
-
-/* Commit
- *  keeps changes indicated by page map and blob size
- */
-rc_t KColumnDataCommit ( KColumnData *self,
-    const KColumnPageMap *pm, size_t bytes );
-
-/* CommitDone
- *  finalizes a commit
- */
-rc_t KColumnDataCommitDone ( KColumnData * self );
-
-/* Free
- *  frees pages from a map
- */
-rc_t KColumnDataFree ( KColumnData *self,
-    const KColumnPageMap *pm, size_t bytes );
-
-
-/*--------------------------------------------------------------------------
- * KColumnPageMap
- *  map of pages involved in column blob
- */
-union KColumnPageMap
-{
-    /* for non-paged data forks, a single page id
-       describes the start of the blob, where the
-       remainder is sequential */
-    uint64_t pg;
-};
-
-/* Create
- *  creates a new page map using the first available page id
- *  obtains first free data fork page
- */
-rc_t KColumnPageMapCreate (  KColumnPageMap *self, KColumnData *cd );
-
-/* Open
- *  opens an blob by raw page id and size
- *
- *  "pm" [ OUT ] - modifiable parameter for blob page map
- *
- *  "pg" [ IN ] and "sz" [ IN ] - identifies pages of data fork included
- *  within the blob.
- */
-rc_t KColumnPageMapOpen ( KColumnPageMap *pm,
-    KColumnData *cd, uint64_t pg, size_t sz );
-
-/* Whack
- *  disposes of memory in the case of a page array
- */
-void KColumnPageMapWhack ( KColumnPageMap *self, const KColumnData *cd );
-
-/* Id
- *  captures id of initial page
- */
-rc_t KColumnPageMapId ( const KColumnPageMap *self,
-    const KColumnData *cd, uint64_t *pg );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_coldata_priv_ */
diff --git a/libs/kdb/wcoldata.c b/libs/kdb/wcoldata.c
deleted file mode 100644
index ba55abd..0000000
--- a/libs/kdb/wcoldata.c
+++ /dev/null
@@ -1,342 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kdb/extern.h>
-#include "wcoldata-priv.h"
-#include "wcolumn-priv.h"
-#include <kfs/file.h>
-#include <kfs/buffile.h>
-#include <kfs/md5.h>
-#include <kfs/impl.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <errno.h>
-
-
-#define DATA_READ_FILE_BUFFER 32 * 1024
-
-
-/*--------------------------------------------------------------------------
- * KColumnData
- */
-
-
-/* Init
- */
-static
-rc_t KColumnDataInit ( KColumnData *self, uint64_t pos, size_t pgsize )
-{
-    rc_t rc = KFileSize ( self -> f, & self -> eof );
-    if ( rc == 0 )
-    {
-        if ( self -> eof < pos || pgsize == 0 || ( pos % pgsize ) != 0 )
-            rc = RC ( rcDB, rcColumn, rcConstructing, rcData, rcCorrupt );
-        else
-        {
-            self -> eof = pos;
-            self -> pgsize = pgsize;
-            return 0;
-        }
-    }
-
-    KFileRelease ( self -> f );
-    self -> f = NULL;
-    return rc;
-}
-
-/* Create
- */
-rc_t KColumnDataCreate ( KColumnData *self, KDirectory *dir,
-    KMD5SumFmt *md5, KCreateMode mode, uint64_t eof, size_t pgsize )
-{
-    rc_t rc = KColumnFileCreate ( & self -> f, & self -> fmd5, dir, md5, mode, true, "data" );
-    if ( rc == 0 )
-        rc = KColumnDataInit ( self, eof, pgsize );
-    return rc;
-}
-
-/* Open
- */
-rc_t KColumnDataOpenRead ( KColumnData *self,
-    const KDirectory *dir, uint64_t eof, size_t pgsize )
-{
-    rc_t rc = KDirectoryVOpenFileRead ( dir,
-        ( const KFile** ) & self -> f, "data", NULL );
-#if DATA_READ_FILE_BUFFER
-    if ( rc == 0 )
-    {
-        KFile * orig = self -> f;
-        rc = KBufFileMakeRead ( ( const KFile** ) & self -> f, self -> f, DATA_READ_FILE_BUFFER );
-        if ( rc == 0 )
-	{
-	    KFileRelease ( orig );
-	}
-	else
-        {
-            self -> f = orig;
-            rc = 0;
-        }
-    }
-#endif
-    if ( rc == 0 )
-        rc = KColumnDataInit ( self, eof, pgsize );
-    return rc;
-}
-
-rc_t KColumnDataOpenUpdate ( KColumnData *self, KDirectory *dir,
-    KMD5SumFmt *md5, uint64_t eof, size_t pgsize )
-{
-    rc_t rc = KColumnFileOpenUpdate ( & self -> f, & self -> fmd5, dir, md5, true, "data" );
-    if ( rc == 0 )
-        rc = KColumnDataInit ( self, eof, pgsize );
-    return rc;
-}
-
-/* Whack
- */
-rc_t KColumnDataWhack ( KColumnData *self )
-{
-    rc_t rc = KFileRelease ( self -> f );
-    if ( rc == 0 )
-    {
-        self -> f = NULL;
-        self -> fmd5 = NULL;
-    }
-    return rc;
-}
-
-/* Read
- *  reads from the data fork using a blob map
- */
-rc_t KColumnDataRead ( const KColumnData *self, const KColumnPageMap *pm,
-    size_t offset, void *buffer, size_t bsize, size_t *num_read )
-{
-    uint64_t pos;
-
-    assert ( self != NULL );
-    assert ( pm != NULL );
-
-    if ( bsize == 0 )
-    {
-        assert ( num_read != NULL );
-        * num_read = 0;
-        return 0;
-    }
-
-    pos = pm -> pg * self -> pgsize;
-    return KFileRead ( self -> f, pos + offset, buffer, bsize, num_read );
-}
-
-/* Write
- *  writes to the data fork using a blob map
- */
-rc_t KColumnDataWrite ( KColumnData *self, KColumnPageMap *pm,
-    size_t offset, const void *buffer, size_t bytes, size_t *num_writ )
-{
-    uint64_t pos;
-
-    assert ( self != NULL );
-    assert ( pm != NULL );
-
-    if ( bytes == 0 )
-    {
-        assert ( num_writ != NULL );
-        * num_writ = 0;
-        return 0;
-    }
-
-    pos = pm -> pg * self -> pgsize;
-    return KFileWrite ( self -> f, pos + offset, buffer, bytes, num_writ );
-}
-
-/* Commit
- *  keeps changes indicated by page map and blob size
- */
-rc_t KColumnDataCommit ( KColumnData *self,
-    const KColumnPageMap *pm, size_t bytes )
-{
-    uint64_t pos;
-    size_t remainder;
-
-    assert ( self != NULL );
-    assert ( pm != NULL );
-
-    if ( self -> pgsize == 1 )
-    {
-        /* can only commit if extending page */
-        if ( pm -> pg != self -> eof )
-            return RC ( rcDB, rcBlob, rcCommitting, rcPagemap, rcInvalid );
-
-        self -> eof += bytes;
-        return 0;
-    }
-
-    assert ( ( self -> eof % self -> pgsize ) == 0 );
-    pos = self -> eof / self -> pgsize;
-
-    /* can only commit if extending page */
-    if ( pm -> pg != pos )
-        return RC ( rcDB, rcBlob, rcCommitting, rcPagemap, rcInvalid );
-
-    /* advance eof */
-    if ( bytes == 0 )
-        return 0;
-
-    pos = self -> eof + bytes;
-
-    /* maintain page boundary */
-    remainder = bytes % self -> pgsize;
-    if ( remainder != 0 )
-    {
-        pos += self -> pgsize - remainder;
-        assert ( ( pos % self -> pgsize ) == 0 );
-    }
-
-    self -> eof = pos;
-    return 0;
-}
-
-rc_t KColumnDataCommitDone ( KColumnData * self )
-{
-    rc_t rc = 0;
-
-    assert ( self != NULL );
-    if ( self -> fmd5 != NULL )
-    {
-	assert ( self -> f == KMD5FileToKFile ( self -> fmd5 ) );
-
-	rc = KMD5FileCommit ( self -> fmd5 );
-    }
-    return rc ;
-}
-
-/* Free
- *  frees pages from a map
- */
-rc_t KColumnDataFree ( KColumnData *self,
-    const KColumnPageMap *pm, size_t bytes )
-{
-    uint64_t pos;
-    size_t remainder;
-
-    if ( self -> pgsize == 1 )
-    {
-        if ( pm -> pg + bytes != self -> eof )
-            return RC ( rcDB, rcBlob, rcReleasing, rcPagemap, rcInvalid );
-
-        self -> eof = pm -> pg;
-        return 0;
-    }
-
-    assert ( ( self -> eof % self -> pgsize ) == 0 );
-    pos = pm -> pg * self -> pgsize;
-
-    remainder = bytes % self -> pgsize;
-    if ( pos + bytes + remainder != self -> eof )
-        return RC ( rcDB, rcBlob, rcReleasing, rcPagemap, rcInvalid );
-
-    self -> eof = pos;
-    return 0;
-}
-
-
-/*--------------------------------------------------------------------------
- * KColumnPageMap
- *  map of pages involved in column blob
- */
-
-/* Create
- *  creates a new page map using the first available page id
- *  obtains first free data fork page
- */
-rc_t KColumnPageMapCreate (  KColumnPageMap *self, KColumnData *cd )
-{
-    assert ( cd != NULL );
-    if ( ! cd -> f -> write_enabled )
-        return RC ( rcDB, rcPagemap, rcConstructing, rcColumn, rcReadonly );
-
-    assert ( self != NULL );
-    assert ( ( cd -> eof % cd -> pgsize ) == 0 );
-    self -> pg = cd -> eof / cd -> pgsize;
-
-    return 0;
-}
-
-/* Open
- *  opens an blob by raw page id and size
- *
- *  "pm" [ OUT ] - modifiable parameter for blob page map
- *
- *  "pg" [ IN ] and "sz" [ IN ] - identifies pages of data fork included
- *  within the blob.
- */
-rc_t KColumnPageMapOpen ( KColumnPageMap *self,
-    KColumnData *cd, uint64_t pg, size_t sz )
-{
-    uint64_t pos;
-
-    assert ( cd != NULL );
-    pos = pg * cd -> pgsize;
-    if ( pos + sz > cd -> eof )
-    {
-        if ( pos >= cd -> eof )
-            return RC ( rcDB, rcColumn, rcOpening, rcParam, rcExcessive );
-        return RC ( rcDB, rcColumn, rcOpening, rcRange, rcExcessive );
-    }
-
-    assert ( self != NULL );
-    self -> pg = pg;
-
-    return 0;
-}
-
-/* Whack
- *  disposes of memory in the case of a page array
- */
-void KColumnPageMapWhack ( KColumnPageMap *self, const KColumnData *cd )
-{
-    assert ( self != NULL );
-    assert ( cd != NULL );
-}
-
-/* Id
- *  captures id of initial page
- */
-rc_t KColumnPageMapId ( const KColumnPageMap *self,
-    const KColumnData *cd, uint64_t *pg )
-{
-    assert ( self != NULL );
-    assert ( cd != NULL );
-    assert ( pg != NULL );
-
-    * pg = self -> pg;
-    return 0;
-}
diff --git a/libs/kdb/wcolidx-priv.h b/libs/kdb/wcolidx-priv.h
deleted file mode 100644
index 38cc2f6..0000000
--- a/libs/kdb/wcolidx-priv.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_colidx_priv_
-#define _h_colidx_priv_
-
-#ifndef _h_kfs_directory_
-#include <kfs/directory.h>
-#endif
-
-#include <kfs/md5.h>
-
-#ifndef _h_colfmt_priv_
-#include "colfmt-priv.h"
-#endif
-
-#ifndef _h_colidx0_priv_
-#include "wcolidx0-priv.h"
-#endif
-
-#ifndef _h_colidx1_priv_
-#include "wcolidx1-priv.h"
-#endif
-
-#ifndef _h_colidx2_priv_
-#include "wcolidx2-priv.h"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KMD5SumFmt;
-
-
-/*--------------------------------------------------------------------------
- * KColumnIdx
- *  the index fork
- */
-typedef struct KColumnIdx KColumnIdx;
-struct KColumnIdx
-{
-    /* first active id within db
-       and first id on upper limit
-       i.e. outside of db such that
-       id_upper - id_first == num_ids */
-    int64_t id_first;
-    int64_t id_upper;
-
-/*     struct KFile * f; */
-    uint32_t vers;
-
-    /* level 0 index */
-    KColumnIdx0 idx0;
-
-    /* level 1 index */
-    KColumnIdx1 idx1;
-
-    /* level 2 index */
-    KColumnIdx2 idx2;
-
-    /* commit counter */
-    uint32_t commit_count;
-};
-
-/* Create
- */
-rc_t KColumnIdxCreate ( KColumnIdx *self,
-    KDirectory *dir, struct KMD5SumFmt *md5, KCreateMode mode,
-    uint64_t *data_eof, size_t pgsize, int32_t checksum );
-
-/* Open
- */
-rc_t KColumnIdxOpenRead ( KColumnIdx *self, const KDirectory *dir,
-			  uint64_t *data_eof, size_t *pgsize, 
-			  int32_t *checksum );
-rc_t KColumnIdxOpenUpdate ( KColumnIdx *self, KDirectory *dir,
-    KMD5SumFmt *md5, uint64_t *data_eof, size_t *pgsize,
-    int32_t *checksum );
-
-/* Whack
- */
-rc_t KColumnIdxWhack ( KColumnIdx *self, 
-    uint64_t data_eof, size_t pgsize, int32_t checksum );
-
-/* Version
- */
-rc_t KColumnIdxVersion ( const KColumnIdx *self, uint32_t *version );
-#define KColumnIdxVersion( self, version ) \
-    KColumnIdx1Version ( & ( self ) -> idx1, version )
-
-/* ByteOrder
- */
-rc_t KColumnIdxByteOrder ( const KColumnIdx *self, bool *reversed );
-#define KColumnIdxByteOrder( self, reversed ) \
-    KColumnIdx1ByteOrder ( & ( self ) -> idx1, reversed )
-
-/* IdRange
- *  returns range of ids contained within
- */
-rc_t KColumnIdxIdRange ( const KColumnIdx *self,
-    int64_t *first, int64_t *last );
-
-/* LocateBlob
- *  locate an existing blob
- */
-rc_t KColumnIdxLocateBlob ( const KColumnIdx *self,
-    KColBlobLoc *loc, int64_t first, int64_t last );
-
-/* Commit
- *  writes a new blob location to idx0
- *  updates idx1 with header information
- *  this should be the final step in committing a write operation
- */
-rc_t KColumnIdxCommit ( KColumnIdx *self, struct KMD5SumFmt *md5,
-    const KColBlobLoc *loc, uint32_t commit_freq,
-    uint64_t data_eof, size_t pgsize, int32_t checksum );
-
-/* CommitDone
- *  finalizes a commit
- */
-rc_t KColumnIdxCommitDone ( KColumnIdx * self );
-
-/* Reindex
- */
-rc_t KColumnIdxReindex ( KColumnIdx *self, struct KMD5SumFmt *md5,
-    uint32_t commit_freq, uint64_t data_eof, size_t pgsize, int32_t checksum );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_colidx_priv_ */
diff --git a/libs/kdb/wcolidx.c b/libs/kdb/wcolidx.c
deleted file mode 100644
index dc8ce6a..0000000
--- a/libs/kdb/wcolidx.c
+++ /dev/null
@@ -1,634 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kdb/extern.h>
-#include "wcolidx-priv.h"
-#include "widxblk-priv.h"
-#include "werror-priv.h"
-#include <kfs/file.h>
-#include <kfs/md5.h>
-#include <sysalloc.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <errno.h>
-
-
-/*--------------------------------------------------------------------------
- * KColumnIdx
- *  the index fork
- */
-
-
-/* EstablishIdRange
- */
-static
-void KColumnIdxEstablishIdRange ( KColumnIdx *self )
-{
-    int64_t first, upper;
-
-    if ( ! KColumnIdx0IdRange ( & self -> idx0, & self -> id_first, & self -> id_upper ) )
-    {
-        if ( ! KColumnIdx1IdRange ( & self -> idx1, & self -> id_first, & self -> id_upper ) )
-            self -> id_first = self -> id_upper = 1;
-    }
-    else if ( KColumnIdx1IdRange ( & self -> idx1, & first, & upper ) )
-    {
-        if ( self -> id_first > first )
-            self -> id_first = first;
-        if ( self -> id_upper < upper )
-            self -> id_upper = upper;
-    }
-}
-
-
-/* Create
- */
-rc_t KColumnIdxCreate ( KColumnIdx *self, KDirectory *dir,
-    KMD5SumFmt *md5, KCreateMode mode, uint64_t *data_eof,
-    size_t pgsize, int32_t checksum )
-{
-    rc_t rc = 0;
-    uint64_t idx2_eof;
-    uint32_t idx0_count;
-
-    assert ( self != NULL );
-
-    rc = KColumnIdx1Create ( & self -> idx1, dir, md5, mode,
-        data_eof, & idx0_count, & idx2_eof, pgsize, checksum );
-    if ( rc == 0 )
-    {
-        rc = ( self -> idx1 . vers < 3 ) ?
-            KColumnIdx0Create_v1 ( & self -> idx0, dir, md5, mode, self -> idx1 . bswap ):
-            KColumnIdx0Create ( & self -> idx0, dir, idx0_count, md5, mode, self -> idx1 . bswap );
-        if ( rc == 0 )
-        {
-            rc = KColumnIdx2Create ( & self -> idx2, dir, md5, mode, idx2_eof );
-            if ( rc == 0 )
-            {
-                KColumnIdxEstablishIdRange ( self );
-
-                /* successful return */
-                return 0;
-            }
-
-            KColumnIdx0Whack ( & self -> idx0 );
-        }
-   
-        KColumnIdx1Whack ( & self -> idx1 );
-    }
-
-    /* failure return */
-    return rc;
-}
-
-/* Open
- */
-rc_t KColumnIdxOpenRead ( KColumnIdx *self, const KDirectory *dir,
-    uint64_t *data_eof, size_t *pgsize, int32_t *checksum )
-{
-    rc_t rc;
-    uint64_t idx2_eof;
-    uint32_t idx0_count;
-
-    assert ( self != NULL );
-
-    rc = KColumnIdx1OpenRead ( & self -> idx1,
-        dir, data_eof, & idx0_count, & idx2_eof, pgsize, checksum );
-    if ( rc == 0 )
-    {
-        rc = ( self -> idx1 . vers < 3 ) ?
-            KColumnIdx0OpenRead_v1 ( & self -> idx0, dir, self -> idx1 . bswap ):
-            KColumnIdx0OpenRead ( & self -> idx0, dir, idx0_count, self -> idx1 . bswap );
-        if ( rc == 0 )
-        {
-            rc = KColumnIdx2OpenRead ( & self -> idx2, dir, idx2_eof );
-            if ( rc == 0 || GetRCState ( rc ) == rcNotFound )
-            {
-                KColumnIdxEstablishIdRange ( self );
-                return 0;
-            }
-
-            KColumnIdx0Whack ( & self -> idx0 );
-        }
-
-        KColumnIdx1Whack ( & self -> idx1 );
-    }
-
-    return rc;
-}
-
-rc_t KColumnIdxOpenUpdate ( KColumnIdx *self, KDirectory *dir,
-    KMD5SumFmt *md5, uint64_t *data_eof, size_t *pgsize, int32_t *checksum )
-{
-    rc_t rc;
-    uint64_t idx2_eof;
-    uint32_t idx0_count;
-
-    assert ( self != NULL );
-
-    rc = KColumnIdx1OpenUpdate ( & self -> idx1, dir,
-        md5, data_eof, & idx0_count, & idx2_eof, pgsize, checksum );
-    if ( rc == 0 )
-    {
-        rc = ( self -> idx1 . vers < 3 ) ?
-            KColumnIdx0Create_v1 ( & self -> idx0, dir, md5, kcmOpen, self -> idx1 . bswap ):
-            KColumnIdx0Create ( & self -> idx0, dir, idx0_count, md5, kcmOpen, self -> idx1 . bswap );
-        if ( rc == 0 )
-        {
-            rc = KColumnIdx2Create ( & self -> idx2, dir, md5, kcmOpen, idx2_eof );
-            if ( rc == 0 )
-            {
-                KColumnIdxEstablishIdRange ( self );
-                return 0;
-            }
-
-            KColumnIdx0Whack ( & self -> idx0 );
-        }
-        KColumnIdx1Whack ( & self -> idx1 );
-    }
-
-    return rc;
-}
-
-/* Whack
- */
-rc_t KColumnIdxWhack ( KColumnIdx *self, 
-    uint64_t data_eof, size_t pgsize, int32_t checksum )
-{
-    rc_t rc;
-
-    assert ( self != NULL );
-
-    if ( self -> commit_count != 0 )
-    {
-        rc = KColumnIdx1WriteHeader ( & self -> idx1,
-            data_eof, self -> idx0 . count, self -> idx2 . eof,
-            pgsize, checksum );
-        if ( rc != 0 )
-            return rc;
-
-        self -> commit_count = 0;
-    }
-
-    rc = KColumnIdx1Whack ( & self -> idx1 );
-    if ( rc == 0 )
-    {
-        KColumnIdx0Whack ( & self -> idx0 );
-        KColumnIdx2Whack ( & self -> idx2 );
-    }
-
-    return rc;
-}
-
-/* Version
- */
-#ifndef KColumnIdxVersion
-rc_t KColumnIdxVersion ( const KColumnIdx *self, uint32_t *version )
-{
-    return KColumnIdx1Version ( & self -> idx1, version );
-}
-#endif
-
-/* IdRange
- *  returns range of ids contained within
- */
-rc_t KColumnIdxIdRange ( const KColumnIdx *self,
-    int64_t *first, int64_t *last )
-{
-    assert ( self != NULL );
-    assert ( first != NULL );
-    assert ( last != NULL );
-
-    * first = self -> id_first;
-    * last = self -> id_upper - 1;
-
-    if ( self -> id_first == self -> id_upper )
-        return RC ( rcDB, rcColumn, rcAccessing, rcRange, rcInvalid );
-    return 0;
-}
-
-/* LocateBlob
- *  locate an existing blob
- */
-rc_t KColumnIdxLocateBlob ( const KColumnIdx *self,
-    KColBlobLoc *loc, int64_t first, int64_t upper )
-{
-    rc_t rc;
-
-    assert ( self != NULL );
-
-    /* convert "last" to "upper" */
-    if ( first >= ++ upper )
-        return RC ( rcDB, rcColumn, rcSelecting, rcRange, rcInvalid );
-
-    /* global reject */
-    if ( first < self -> id_first || upper > self -> id_upper )
-        return RC ( rcDB, rcColumn, rcSelecting, rcBlob, rcNotFound );
-
-    /* look in idx0 */
-    rc = KColumnIdx0LocateBlob ( & self -> idx0, loc, first, upper );
-    if ( GetRCState ( rc ) == rcNotFound )
-    {
-        KColBlockLoc bloc;
-
-        /* find block containing range */
-        rc = KColumnIdx1LocateBlock ( & self -> idx1, & bloc, first, upper );
-        if ( rc == 0 )
-        {
-            /* find location in idx2 */
-            rc = KColumnIdx2LocateBlob ( & self -> idx2,
-                loc, & bloc, first, upper, self -> idx1 . bswap );
-        }
-    }
-
-    return rc;
-}
-
-/* KColumnIdxCommit
- *  writes a new blob location to idx0
- *  updates idx1 with header information
- *  this should be the final step in committing a write operation
- */
-rc_t KColumnIdxCommit ( KColumnIdx *self, KMD5SumFmt *md5,
-    const KColBlobLoc *loc, uint32_t commit_freq,
-    uint64_t data_eof, size_t pgsize, int32_t checksum )
-{
-    rc_t idx0rc, rc;
-    KColBlobLoc prior;
-
-    assert ( self != NULL );
-    assert ( loc != NULL );
-
-    /* check index range for wraparound */
-    if ( ( loc -> start_id + loc -> id_range ) <= loc -> start_id )
-        return RC ( rcDB, rcColumn, rcCommitting, rcRange, rcInvalid );
-
-    /* journal to idx0 */
-    rc = idx0rc =
-        KColumnIdx0Commit ( & self -> idx0, loc, & prior, self -> idx1 . bswap );
-    if ( rc == 0 || rc == kdbReindex )
-    {
-        rc = 0;
-
-        if ( ++ self -> commit_count >= commit_freq )
-        {
-            rc = KColumnIdx1WriteHeader ( & self -> idx1,
-                data_eof, self -> idx0 . count, self -> idx2 . eof,
-                pgsize, checksum );
-            if ( rc == 0 )
-                self -> commit_count = 0;
-        }
-
-        if ( rc == 0 )
-        {
-            int64_t upper = loc -> start_id + loc -> id_range;
-
-            /* incorporate index into range */
-            if ( self -> id_first == self -> id_upper )
-            {
-                self -> id_first = loc -> start_id;
-                self -> id_upper = upper;
-            }
-            else
-            {
-                if ( self -> id_first > loc -> start_id )
-                    self -> id_first = loc -> start_id;
-                if ( self -> id_upper < upper )
-                    self -> id_upper = upper;
-            }
-
-            assert ( self -> id_first < self -> id_upper );
-
-            return idx0rc;
-        }
-
-        /* revert idx0 commit */
-        KColumnIdx0Revert ( & self -> idx0, loc, & prior );
-    }
-
-    return rc;
-}
-
-rc_t KColumnIdxCommitDone ( KColumnIdx * self )
-{
-    rc_t rc = 0;
-
-    assert ( self != NULL );
-    rc = KColumnIdx1CommitDone ( & self -> idx1 );
-    if ( rc == 0 )
-	rc = KColumnIdx0CommitDone ( & self -> idx0 );
-    if ( rc == 0 )
-	rc = KColumnIdx2CommitDone ( & self -> idx2 );
-    return rc;
-}
-
-/* KColumnIdxRecordIdx0Edges
- *  creates tentative idx1 blocks from idx0 entries
- *  at the block type edges as identified by KColumnIdx0
- */
-typedef struct Idx0EdgeNode Idx0EdgeNode;
-struct Idx0EdgeNode
-{
-    DLNode n;
-    KColBlockLocInfo loc;
-};
-
-static
-void CC Idx0EdgeNodeWhack ( DLNode *n, void *ignore )
-{
-    free ( n );
-}
-
-static
-rc_t KColumnIdxRecordIdx0Edges ( const KColBlockLocInfo *info, void *edges )
-{
-    Idx0EdgeNode *node;
-
-    assert ( edges != NULL );
-    assert ( info != NULL );
-
-    assert ( info -> start_id < info -> end_id );
-    assert ( info -> start_pg < info -> end_pg );
-    assert ( info -> size != 0 );
-    assert ( info -> count != 0 );
-    assert ( info -> id_type < 4 );
-    assert ( info -> pg_type < 4 );
-
-    assert ( ( ( info -> end_id - info -> start_id ) >> 32 ) == 0 );
-
-    node = malloc ( sizeof * node );
-    if ( node == NULL )
-        return RC ( rcDB, rcColumn, rcReindexing, rcMemory, rcExhausted );
-
-    node -> loc = * info;
-
-    DLListPushTail ( edges, & node -> n );
-
-    return 0;
-}
-
-/* KColumnIdxCollapseBlocks
- *  scans over blocks, looking for opportunities to
- *  combine them and collapse their number
- */
-static
-rc_t KColumnIdxCollapseBlocks ( KColumnIdx *self, DLList *edges )
-{
-    uint32_t count;
-
-    do
-    {
-        Idx0EdgeNode *prior;
-
-        /* merge count */
-        count = 0;
-
-        /* apply collapse */
-        prior = ( Idx0EdgeNode* ) DLListHead ( edges );
-        if ( prior != NULL )
-        {
-            Idx0EdgeNode *next, *cur;
-            for ( cur = ( Idx0EdgeNode* ) DLNodeNext( & prior -> n );
-                  cur != NULL; cur = next )
-            {
-                int64_t cost_left, cost_right;
-                KColBlockLocInfo buffer [ 2 ], *info;
-
-                /* grab next guy right away
-                   now we have prior, current, and next */
-                next = ( Idx0EdgeNode* ) DLNodeNext ( & cur -> n );
-
-                /* calculate a cost of merging prior and current */
-                buffer [ 0 ] = prior -> loc;
-                cost_left = KColBlockLocInfoMerge ( info = & buffer [ 0 ], & cur -> loc );
-
-                /* if there would be some advantage to the merge */
-                if ( cost_left <= 0 )
-                {
-                    /* calculate cost of merging current with next if there */
-                    if ( next != NULL )
-                    {
-                        buffer [ 1 ] = cur -> loc;
-                        cost_right = KColBlockLocInfoMerge
-                            ( info = & buffer [ 1 ], & next -> loc );
-
-                        /* if prev merge beats next,
-                           set info to previous block value */
-                        if ( cost_left <= cost_right )
-                            info = & buffer [ 0 ];
-                        else
-                        {
-                            /* otherwise shift our window
-                               and keep next block value */
-                            prior = cur;
-                            cur = next;
-                            next = ( Idx0EdgeNode* ) DLNodeNext ( & next -> n );
-                        }
-                    }
-
-                    /* merge prior with cur */
-                    prior -> loc = * info;
-                    DLListUnlink ( edges, & cur -> n );
-                    Idx0EdgeNodeWhack ( & cur -> n, NULL );
-                    ++ count;
-                    continue;
-                }
-
-                /* leave block alone */
-                prior = cur;
-            }
-        }
-    }
-    while ( count != 0 );
-
-    return 0;
-}
-
-
-/* KColumnIdxWriteNewBlock
- *  writes each block into idx1 and idx2
- */
-typedef struct WriteNewBlockData WriteNewBlockData;
-struct WriteNewBlockData
-{
-    uint64_t data_eof;
-    KColumnIdx *idx;
-    size_t pgsize;
-    uint32_t commit_freq;
-    int32_t checksum;
-    rc_t rc;
-    bool bswap;
-};
-
-static
-bool CC KColumnIdxWriteNewBlock ( DLNode *n, void *data )
-{
-    WriteNewBlockData *pb = data;
-    const Idx0EdgeNode *node = ( const Idx0EdgeNode* ) n;
-    KColumnIdx *self = pb -> idx;
-
-    KColBlockLoc bloc;
-    KColWIdxBlock iblk;
-
-    /* create and map a block of memory */
-    pb -> rc = KColWIdxBlockInit ( & iblk, & node -> loc );
-    if ( pb -> rc == 0 )
-    {
-        size_t to_write;
-
-        /* tell idx0 to fill in block */
-        KColumnIdx0TranscribeBlocks ( & self -> idx0,
-            node -> loc . start_id, node -> loc . end_id, & iblk );
-        if ( iblk . idx != node -> loc . count )
-            pb -> rc = RC ( rcDB, rcColumn, rcCommitting, rcNoObj, rcUnknown );
-        else
-        {
-            /* compress block */
-            pb -> rc = KColWIdxBlockCompress ( & iblk,
-                pb -> bswap, & node -> loc, & bloc, & to_write );
-            if ( pb -> rc == 0 )
-            {
-                /* write block appropriately */
-                pb -> rc = KColumnIdx2Write ( & self -> idx2,
-                    & bloc . pg, KColWIdxBlockPersistPtr ( & iblk, & bloc ), to_write );
-            }
-        }
-
-        KColWIdxBlockWhack ( & iblk );
-
-        if ( pb -> rc == 0 )
-        {
-            /* write idx1 block location information */
-            pb -> rc = KColumnIdx1Commit ( & self -> idx1, & bloc );
-            if ( pb -> rc == 0 )
-            {
-                /* update the header */
-                if ( ++ self -> commit_count >= pb -> commit_freq )
-                {
-                    pb -> rc = KColumnIdx1WriteHeader ( & self -> idx1,
-                        pb -> data_eof, self -> idx0 . count,
-                        self -> idx2 . eof + bloc . u . blk . size,
-                        pb -> pgsize, pb -> checksum );
-
-                    if ( pb -> rc == 0 )
-                        self -> commit_count = 0;
-                }
-                if ( pb -> rc == 0 )
-                {
-                    /* done writing block */
-                    KColumnIdx2Commit ( & self -> idx2, to_write );
-                    return false;
-                }
-
-                /* revert idx1 */
-                KColumnIdx1Revert ( & self -> idx1, bloc . start_id, bloc . id_range );
-            }
-        }
-    }
-
-    return true;
-}
-
-/* KColumnIdxFixIdx1
- */
-static
-bool CC KColumnIdxFixIdx1 ( DLNode *n, void *data )
-{
-    const Idx0EdgeNode *node = ( const Idx0EdgeNode* ) n;
-    return KColumnIdx1Revert ( data, node -> loc . start_id,
-        ( uint32_t ) ( node -> loc . end_id  - node -> loc . start_id ) );
-}
-
-/* KColumnIdxReindex
- */
-rc_t KColumnIdxReindex ( KColumnIdx *self, KMD5SumFmt *md5,
-    uint32_t commit_freq, uint64_t data_eof, size_t pgsize, int32_t checksum )
-{
-    rc_t rc;
-    DLList edges;
-
-    assert ( self != NULL );
-    assert ( pgsize > 0 );
-
-    DLListInit ( & edges );
-
-    /* map the new entries */
-    rc = KColumnIdx0DefineBlocks ( & self -> idx0,
-        KColumnIdxRecordIdx0Edges, & edges, pgsize );
-    if ( rc == 0 )
-    {
-        rc = KColumnIdxCollapseBlocks ( self, & edges );
-        if ( rc == 0 )
-        {
-            /* preserve for restoration */
-            uint64_t idx2_eof = self -> idx2 . eof;
-            size_t count = self -> idx1 . count;
-
-            WriteNewBlockData pb;
-            pb . data_eof = data_eof;
-            pb . idx = self;
-            pb . pgsize = pgsize;
-            pb . commit_freq = commit_freq;
-            pb . checksum = checksum;
-            pb . rc = 0;
-            pb . bswap = self -> idx1 . bswap;
-
-            /* write new blocks */
-            DLListDoUntil ( & edges, false, KColumnIdxWriteNewBlock, & pb );
-            if ( ( rc = pb . rc ) == 0 )
-            {
-                /* idx2 is correct,
-                   idx1 has proper count and bst,
-                   idx0 needs to whack bst and file,
-                   idx1 needs to update header */
-                rc = KColumnIdx1WriteHeader ( & self -> idx1,
-                    data_eof, 0, self -> idx2 . eof,
-                    pgsize, checksum );
-                if ( rc == 0 )
-                {
-                    self -> commit_count = 0;
-                    KColumnIdx0Truncate ( & self -> idx0 );
-                    DLListWhack ( & edges, Idx0EdgeNodeWhack, NULL );
-                    return 0;
-                }
-            }
-
-            /* restore idx2 eof */
-            self -> idx2 . eof = idx2_eof;
-
-            /* restore idx1 count and fix bst */
-            DLListDoUntil ( & edges, false, KColumnIdxFixIdx1, & self -> idx1 );
-            self -> idx1 . count = count;
-        }
-    }
-
-    DLListWhack ( & edges, Idx0EdgeNodeWhack, NULL );
-
-    return rc;
-}
diff --git a/libs/kdb/wcolidx0-priv.h b/libs/kdb/wcolidx0-priv.h
deleted file mode 100644
index f9d1238..0000000
--- a/libs/kdb/wcolidx0-priv.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_colidx0_priv_
-#define _h_colidx0_priv_
-
-#ifndef _h_kfs_directory_
-#include <kfs/directory.h>
-#endif
-#ifndef _h_kfs_file_
-#include <kfs/file.h>
-#endif
-#ifndef _h_kfs_md5_
-#include <kfs/md5.h>
-#endif
-
-#ifndef _h_colfmt_priv_
-#include "colfmt-priv.h"
-#endif
-
-#ifndef _h_klib_container_
-#include <klib/container.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KColWIdxBlock;
-struct KColBlockLocInfo;
-
-
-/*--------------------------------------------------------------------------
- * KColumnIdx0
- *  level 0 index - event journaling
- */
-typedef struct KColumnIdx0 KColumnIdx0;
-struct KColumnIdx0
-{
-    /* always append */
-    uint64_t eof;
-
-    /* the in-core indices */
-    BSTree bst;
-    size_t count;
-
-    /* the on-disk indices */
-    KFile *f;
-    KMD5File *fmd5;
-};
-
-
-/* Create
- */
-rc_t KColumnIdx0Create_v1 ( KColumnIdx0 *self, KDirectory *dir,
-    struct KMD5SumFmt *md5, KCreateMode mode, bool bswap );
-rc_t KColumnIdx0Create ( KColumnIdx0 *self, KDirectory *dir,
-    uint32_t count, struct KMD5SumFmt *md5, KCreateMode mode, bool bswap );
-
-/* Open
- */
-rc_t KColumnIdx0OpenRead_v1 ( KColumnIdx0 *self,
-    const KDirectory *dir, bool bswap );
-rc_t KColumnIdx0OpenRead ( KColumnIdx0 *self,
-    const KDirectory *dir, uint32_t count, bool bswap );
-
-/* Whack
- */
-void KColumnIdx0Whack ( KColumnIdx0 *self );
-
-/* IdRange
- *  returns range of ids contained within
- */
-bool KColumnIdx0IdRange ( const KColumnIdx0 *self,
-    int64_t *first, int64_t *upper );
-
-/* LocateBlob
- *  locate an existing blob
- */
-rc_t KColumnIdx0LocateBlob ( const KColumnIdx0 *self,
-    KColBlobLoc *loc, int64_t first, int64_t upper );
-
-/* Commit
- *  records an index location for addition or removal
- *  returns any prior value for rollback
- */
-rc_t KColumnIdx0Commit ( KColumnIdx0 *self,
-    const KColBlobLoc *loc, KColBlobLoc *prior, bool bswap );
-rc_t KColumnIdx0CommitDone ( KColumnIdx0 *self );
-
-/* Revert
- *  reverses effect of commit
- */
-void KColumnIdx0Revert ( KColumnIdx0 *self,
-    const KColBlobLoc *loc, const KColBlobLoc *prior );
-
-/* DefineBlocks
- *  scans existing blob locators
- *  invokes handler with ranges of ids from similar blob entries
- */
-rc_t KColumnIdx0DefineBlocks ( const KColumnIdx0 *self,
-    rc_t ( * handle_range ) ( struct KColBlockLocInfo const *info, void *data ),
-    void *data, size_t pgsize );
-
-/* TranscribeBlocks
- *  writes all blocks within a range
- */
-void KColumnIdx0TranscribeBlocks ( const KColumnIdx0 *self,
-    int64_t first, int64_t upper, struct KColWIdxBlock *iblk );
-
-/* Truncate
- *  whacks bt contents and truncates file
- */
-void KColumnIdx0Truncate ( KColumnIdx0 *self );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_colidx0_priv_ */
diff --git a/libs/kdb/wcolidx0.c b/libs/kdb/wcolidx0.c
deleted file mode 100644
index b16973a..0000000
--- a/libs/kdb/wcolidx0.c
+++ /dev/null
@@ -1,747 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kdb/extern.h>
-#include "wcolumn-priv.h"
-#include "wcolidx0-priv.h"
-#include "widxblk-priv.h"
-#include "werror-priv.h"
-#include <kfs/file.h>
-#include <sysalloc.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <byteswap.h>
-
-
-/*--------------------------------------------------------------------------
- * KColumnIdx0Node
- *  a b-tree node
- */
-typedef struct KColumnIdx0Node KColumnIdx0Node;
-struct KColumnIdx0Node
-{
-    BSTNode n;
-    KColBlobLoc loc;
-};
-
-/* Match
- */
-static
-int CC KColumnIdx0NodeMatch ( const void *item, const BSTNode *n )
-{
-#define a ( ( const KColBlobLoc* ) item )
-#define b ( ( const KColumnIdx0Node* ) n )
-
-    if ( a -> start_id == b -> loc . start_id )
-    {
-        if ( a -> id_range < b -> loc . id_range )
-            return -1;
-        return a -> id_range > b -> loc . id_range;
-    }
-
-    if ( a -> start_id < b -> loc . start_id )
-        return -1;
-    return a -> start_id > b -> loc . start_id;
-
-#undef a
-#undef b
-}
-
-/* Find
- */
-static
-int CC KColumnIdx0NodeFind ( const void *item, const BSTNode *n )
-{
-#define a ( * ( const int64_t* ) item )
-#define b ( ( const KColumnIdx0Node* ) n )
-
-    if ( a < b -> loc . start_id )
-        return -1;
-    return a >= ( b -> loc . start_id + b -> loc . id_range );
-
-#undef a
-#undef b
-}
-
-/* Sort
- */
-static
-int CC KColumnIdx0NodeSort ( const BSTNode *item, const BSTNode *n )
-{
-#define a ( ( const KColumnIdx0Node* ) item )
-#define b ( ( const KColumnIdx0Node* ) n )
-
-    if ( ( a -> loc . start_id + a -> loc . id_range ) <= b -> loc . start_id )
-        return -1;
-    return a -> loc . start_id >= ( b -> loc . start_id + b -> loc . id_range );
-
-#undef a
-#undef b
-}
-
-/* Whack
- */
-static
-void CC KColumnIdx0NodeWhack ( BSTNode *n, void *ignore )
-{
-    free ( n );
-}
-
-/* Next
- */
-#define KColumnIdx0NodeNext( node ) \
-    ( const KColumnIdx0Node* ) BSTNodeNext ( & ( node ) -> n )
-
-
-/*--------------------------------------------------------------------------
- * KColumnIdx0
- *  level 0 index - event journaling
- */
-
-/* Init
- */
-static
-rc_t KColumnIdx0Inflate ( KColumnIdx0 *self,
-     const KColBlobLoc *buffer, uint32_t count )
-{
-    uint32_t i;
-    KColumnIdx0Node *n;
-
-    for ( n = NULL, i = 0; i < count; ++ i )
-    {
-        KColumnIdx0Node *exist;
-
-        if ( n == NULL )
-        {
-            n = malloc ( sizeof * n );
-            if ( n == NULL )
-                return RC ( rcDB, rcIndex, rcConstructing, rcMemory, rcExhausted );
-        }
-
-        n -> loc = buffer [ i ];
-        if ( BSTreeInsertUnique ( & self -> bst,
-             & n -> n, ( BSTNode** ) & exist, KColumnIdx0NodeSort ) )
-        {
-            assert ( n -> loc . start_id == exist -> loc . start_id );
-            assert ( n -> loc . id_range == exist -> loc . id_range );
-
-            assert ( ! n -> loc . u . blob . remove );
-            exist -> loc . pg = n -> loc . pg;
-            exist -> loc . u . blob . size = n -> loc . u . blob . size;
-        }
-        else
-        {
-            ++ self -> count;
-            n = NULL;
-        }
-    }
-
-    free ( n );
-
-    return 0;
-}
-
-static
-void KColumnIdx0Swap ( KColBlobLoc *buffer, uint32_t count )
-{
-    uint32_t i;
-    for ( i = 0; i < count; ++ i )
-    {
-        buffer [ i ] . pg = bswap_64 ( buffer [ i ] . pg );
-        buffer [ i ] . u . gen = bswap_32 ( buffer [ i ] . u . gen );
-        buffer [ i ] . id_range = bswap_32 ( buffer [ i ] . id_range );
-        buffer [ i ] . start_id = bswap_64 ( buffer [ i ] . start_id );
-    }
-}
-
-static
-rc_t KColumnIdx0Init_v1 ( KColumnIdx0 *self, bool bswap )
-{
-    rc_t rc;
-    KColBlobLoc *buffer = malloc ( 2048 * sizeof * buffer );
-    if ( buffer == NULL )
-        rc = RC ( rcDB, rcIndex, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        size_t num_read;
-
-        BSTreeInit ( & self -> bst );
-        self -> count = 0;
-
-        for ( self -> eof = 0;; self -> eof += num_read )
-        {
-            uint32_t count;
-
-            rc = KFileReadAll ( self -> f, self -> eof,
-                buffer, 2048 * sizeof * buffer, & num_read );
-            if ( rc != 0 )
-                break;
-            if ( num_read == 0 )
-                break;
-            if ( ( num_read % sizeof * buffer ) != 0 )
-            {
-                rc = RC ( rcDB, rcIndex, rcConstructing, rcData, rcCorrupt );
-                break;
-            }
-
-            count = num_read / sizeof * buffer;
-
-            if ( bswap )
-                KColumnIdx0Swap ( buffer, count );
-
-            rc = KColumnIdx0Inflate ( self, buffer, count );
-            if ( rc != 0 )
-                break;
-        }
-
-        free ( buffer );
-    }
-    return rc;
-}
-
-static
-rc_t KColumnIdx0Init ( KColumnIdx0 *self, uint32_t total, bool bswap )
-{
-    rc_t rc;
-    KColBlobLoc *buffer = malloc ( 2048 * sizeof * buffer );
-    if ( buffer == NULL )
-        rc = RC ( rcDB, rcIndex, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        size_t num_read;
-        uint32_t i, count;
-
-        BSTreeInit ( & self -> bst );
-        self -> count = 0;
-        self -> eof = 0;
-
-        for ( rc = 0, i = 0; i < total; self -> eof += num_read, i += count )
-        {
-            count = total - i;
-            if ( count > 2048 )
-                count = 2048;
-
-            rc = KFileReadAll ( self -> f, i * sizeof * buffer,
-                buffer, count * sizeof * buffer, & num_read );
-            if ( rc != 0 )
-                break;
-
-            /* detect EOF */
-            if ( num_read == 0 )
-            {
-                rc = RC ( rcDB, rcIndex, rcConstructing, rcData, rcCorrupt );
-                break;
-            }
-
-            /* detect short read -
-               see comment in idx1. */
-            if ( ( num_read % sizeof * buffer ) != 0 )
-            {
-                rc = RC ( rcDB, rcIndex, rcConstructing, rcTransfer, rcIncomplete );
-                break;
-            }
-
-            count = num_read / sizeof * buffer;
-
-            if ( bswap )
-                KColumnIdx0Swap ( buffer, count );
-
-            rc = KColumnIdx0Inflate ( self, buffer, count );
-            if ( rc != 0 )
-                break;
-        }
-
-        free ( buffer );
-    }
-    return rc;
-}
-
-/* Create
- */
-rc_t KColumnIdx0Create_v1 ( KColumnIdx0 *self, KDirectory *dir,
-    struct KMD5SumFmt *md5, KCreateMode mode, bool bswap )
-{
-    rc_t rc = KColumnFileCreate ( & self -> f, & self -> fmd5,
-        dir, md5, mode, true, "idx0" );
-
-    if ( rc == 0 )
-        rc = KColumnIdx0Init_v1 ( self, bswap );
-
-    return rc;
-}
-
-rc_t KColumnIdx0Create ( KColumnIdx0 *self, KDirectory *dir,
-    uint32_t count, struct KMD5SumFmt *md5, KCreateMode mode, bool bswap )
-{
-    rc_t rc = KColumnFileCreate ( & self -> f, & self -> fmd5,
-        dir, md5, mode, true, "idx0" );
-
-    if ( rc == 0 )
-        rc = KColumnIdx0Init ( self, count, bswap );
-
-    return rc;
-}
-
-/* Open
- */
-rc_t KColumnIdx0OpenRead_v1 ( KColumnIdx0 *self, const KDirectory *dir, bool bswap )
-{
-    rc_t rc = KDirectoryVOpenFileRead ( dir,
-        ( const KFile** ) & self -> f, "idx0", NULL );
-
-    if ( rc == 0 )
-        rc = KColumnIdx0Init_v1 ( self, bswap );
-    else if ( GetRCState ( rc ) == rcNotFound )
-        rc = 0;
-
-    return rc;
-}
-
-rc_t KColumnIdx0OpenRead ( KColumnIdx0 *self,
-    const KDirectory *dir, uint32_t count, bool bswap )
-{
-    rc_t rc = KDirectoryVOpenFileRead ( dir,
-        ( const KFile** ) & self -> f, "idx0", NULL );
-
-    if ( rc == 0 )
-        rc = KColumnIdx0Init ( self, count, bswap );
-
-    return rc;
-}
-
-/* Whack
- */
-void KColumnIdx0Whack ( KColumnIdx0 *self )
-{
-    KFileRelease ( self -> f );
-    self -> f = NULL;
-    self -> fmd5 = NULL;
-    BSTreeWhack ( & self -> bst, KColumnIdx0NodeWhack, NULL );
-    BSTreeInit ( & self -> bst );
-}
-
-/* IdRange
- *  returns range of ids contained within
- */
-bool KColumnIdx0IdRange ( const KColumnIdx0 *self,
-    int64_t *first, int64_t *upper )
-{
-    const KColumnIdx0Node *a, *z;
-
-    assert ( self != NULL );
-    assert ( first != NULL );
-    assert ( upper != NULL );
-
-    a = ( const KColumnIdx0Node* ) BSTreeFirst ( & self -> bst );
-    if ( a == NULL )
-        return false;
-
-    z = ( const KColumnIdx0Node* ) BSTreeLast ( & self -> bst );
-    assert ( z != NULL );
-
-    * first = a -> loc . start_id;
-    * upper = z -> loc . start_id + z -> loc . id_range;
-    assert ( * first < * upper );
-
-    return true;
-}
-
-/* LocateBlob
- *  locate an existing blob
- */
-rc_t KColumnIdx0LocateBlob ( const KColumnIdx0 *self,
-    KColBlobLoc *loc, int64_t first, int64_t upper )
-{
-    const KColumnIdx0Node *n;
-
-    assert ( self != NULL );
-    assert ( loc != NULL );
-    assert ( first < upper );
-
-    n = ( const KColumnIdx0Node* )
-        BSTreeFind ( & self -> bst, & first, KColumnIdx0NodeFind );
-
-    if ( n == NULL )
-        return RC ( rcDB, rcIndex, rcSelecting, rcBlob, rcNotFound );
-
-    assert ( first >= n -> loc . start_id );
-    assert ( first < ( n -> loc . start_id + n -> loc . id_range ) );
-
-    if ( upper > ( n -> loc . start_id + n -> loc . id_range ) )
-        return RC ( rcDB, rcIndex, rcSelecting, rcRange, rcInvalid );
-
-    * loc = n -> loc;
-    assert ( ! loc -> u . blob . remove );
-    return 0;
-}
-
-/* Commit
- *  records an index location for addition or removal
- *  returns any prior value for rollback
- */
-rc_t KColumnIdx0Commit ( KColumnIdx0 *self,
-    const KColBlobLoc *loc, KColBlobLoc *prior, bool bswap )
-{
-    rc_t rc = 0;
-    size_t num_writ;
-    KColumnIdx0Node *n;
-
-    assert ( self != NULL );
-    assert ( loc != NULL );
-    assert ( prior != NULL );
-
-    /* this assert tests two things:
-       1) that loc -> id_range != 0
-       2) that loc -> start_id + loc -> id_range does not wrap around */
-    assert ( ( loc -> start_id + loc -> id_range ) > loc -> start_id );
-
-    /* if the index already exists, it's being overwritten */
-    n = ( KColumnIdx0Node* )
-        BSTreeFind ( & self -> bst, loc, KColumnIdx0NodeMatch );
-    if ( n != NULL )
-    {
-        /* just hold onto the prior value */
-        * prior = n -> loc;
-        assert ( n -> loc . u . blob . size != 0 );
-        assert ( ! n -> loc . u . blob . remove );
-        assert ( n -> loc . start_id == loc -> start_id );
-        assert ( n -> loc . id_range == loc -> id_range );
-    }
-    else
-    {
-        /* no prior value */
-        memset ( prior, 0, sizeof * prior );
-
-        /* record an insert/overwrite */
-        if ( ! loc -> u . blob . remove )
-        {
-            n = malloc ( sizeof * n );
-            if ( n == NULL )
-                return RC ( rcDB, rcBlob, rcCommitting, rcMemory, rcExhausted );
-
-            n -> loc . u . blob . remove = 0;
-            n -> loc . start_id = loc -> start_id;
-            n -> loc . id_range = loc -> id_range;
-        }
-    }
-
-    /* journal index to idx0 */
-    if ( ! bswap )
-        rc = KFileWrite ( self -> f, self -> eof, loc, sizeof * loc, & num_writ );
-    else
-    {
-        KColBlobLoc loc_copy;
-        loc_copy . pg = bswap_64 ( loc -> pg );
-        loc_copy . u . gen = bswap_32 ( loc -> u . gen );
-        loc_copy . id_range = bswap_32 ( loc -> id_range );
-        loc_copy . start_id = bswap_64 ( loc -> start_id );
-
-        rc = KFileWrite ( self -> f, self -> eof,
-            & loc_copy, sizeof loc_copy, & num_writ );
-    }
-    if ( rc == 0 )
-    {
-        /* detect complete write */
-        if ( num_writ == sizeof * loc )
-        {
-            self -> eof += sizeof * loc;
-
-            /* detect insert/overwrite */
-            if ( n != NULL )
-            {
-                /* if deleting, "n" is prior value */
-                if ( loc -> u . blob . remove )
-                {
-                    /* perform a delete */
-                    assert ( self -> count > 0 );
-                    BSTreeUnlink ( & self -> bst, & n -> n );
-                    -- self -> count;
-                    free ( n );
-                }
-                else
-                {
-                    /* insert new or overwrite old */
-                    n -> loc . pg = loc -> pg;
-                    n -> loc . u . blob . size = loc -> u . blob . size;
-                    if ( prior -> u . blob . size == 0 )
-                    {
-                        /* complete insertion */
-                        BSTreeInsert ( & self -> bst, & n -> n, KColumnIdx0NodeSort );
-                        if ( ++ self -> count >= 64 * 1024 )
-                            return kdbReindex;
-                    }
-                }
-            }
-
-            /* done */
-            return 0;
-        }
-
-        /* got here due to incomplete write to idx0 */
-        rc = RC ( rcDB, rcBlob, rcCommitting, rcTransfer, rcIncomplete );
-    }
-
-    /* free allocated insertion block */
-    if ( prior -> u . blob . size == 0 )
-        free ( n );
-
-    return rc;
-}
-
-rc_t KColumnIdx0CommitDone ( KColumnIdx0 *self )
-{
-    assert ( self != NULL );
-
-    if ( self -> fmd5 == NULL )
-        return 0;
-
-    assert ( self -> f == KMD5FileToKFile ( self -> fmd5 ) );
-    return KMD5FileCommit ( self -> fmd5 );
-}
-
-/* Revert
- *  reverses effect of commit
- */
-void KColumnIdx0Revert ( KColumnIdx0 *self,
-    const KColBlobLoc *loc, const KColBlobLoc *prior )
-{
-    rc_t rc = 0;
-    KColumnIdx0Node *n;
-
-    assert ( self != NULL );
-    assert ( loc != NULL );
-    assert ( prior != NULL );
-
-    /* exit MD5 transaction */
-    if ( self -> fmd5 != NULL )
-        KMD5FileRevert ( self -> fmd5 );
-
-    /* remove the blip from idx0 */
-    assert ( self -> eof >= sizeof * loc );
-    rc = KFileSetSize ( self -> f, self -> eof - sizeof * loc );
-    if ( rc != 0 )
-        exit ( 99 );
-    self -> eof -= sizeof * loc;
-
-    /* next, repair the binary search tree */
-    if ( prior -> u . blob . size != 0 )
-    {
-        if ( ! loc -> u . blob . remove )
-        {
-            /* revert an update */
-            n = ( KColumnIdx0Node* )
-                BSTreeFind ( & self -> bst, prior, KColumnIdx0NodeMatch );
-            if ( n == NULL )
-                rc = RC ( rcDB, rcIndex, rcReverting, rcNoObj, rcUnknown );
-        }
-        else
-        {
-            /* revert a delete */
-            n = malloc ( sizeof * n );
-            if ( n == NULL )
-                rc = RC ( rcDB, rcIndex, rcReverting, rcMemory, rcExhausted );
-            else
-            {
-                n -> loc . u . blob . remove = 0;
-                n -> loc . start_id = prior -> start_id;
-                n -> loc . id_range = prior -> id_range;
-                BSTreeInsert ( & self -> bst, & n -> n, KColumnIdx0NodeSort );
-                ++ self -> count;
-            }
-        }
-
-        if ( n == NULL )
-            exit ( 98 );
-
-        /* put back location information */
-        n -> loc . pg = prior -> pg;
-        n -> loc . u . blob . size = prior -> u . blob . size;
-    }
-    else if ( ! loc -> u . blob . remove )
-    {
-        /* revert an insert */
-        n = ( KColumnIdx0Node* )
-            BSTreeFind ( & self -> bst, loc, KColumnIdx0NodeMatch );
-        if ( n == NULL )
-            exit ( 97 );
-
-        assert ( self -> count > 0 );
-        BSTreeUnlink ( & self -> bst, & n -> n );
-        -- self -> count;
-        free ( n );
-    }
-}
-
-/* DefineBlocks
- *  scans existing blob locators
- *  invokes handler with ranges of ids from similar blob entries
- */
-rc_t KColumnIdx0DefineBlocks ( const KColumnIdx0 *self,
-    rc_t ( * define_block ) ( struct KColBlockLocInfo const *info, void *data ),
-    void *data, size_t pgsize )
-{
-    rc_t rc;
-    const KColumnIdx0Node *start;
-
-    assert ( self != NULL );
-    assert ( pgsize > 0 );
-    assert ( define_block != NULL );
-
-    start = ( const KColumnIdx0Node* ) BSTreeFirst ( & self -> bst );
-    for ( rc = 0; start != NULL; )
-    {
-        KColBlockLocInfo info;
-
-        uint32_t count;
-        uint32_t id_type, pg_type;
-        const KColumnIdx0Node *next, *end;
-
-        id_type = pg_type = btypePredictable;
-
-        /* build a block from start to prior */
-        for ( next = KColumnIdx0NodeNext ( end = start ), count = 1;
-              next != NULL; next = KColumnIdx0NodeNext ( end = next ), ++ count )
-        {
-            size_t pgbytes;
-            int64_t end_id;
-            int id_next, pg_next;
-
-            size_t hdr_size_div4;
-            size_t entry_size_div4;
-
-            /* look at transition from end to next */
-            id_next = pg_next = btypePredictable;
-
-            if ( end -> loc . id_range != next -> loc . id_range )
-                id_next = btypeMagnitude;
-            if ( end -> loc . u . blob . size != next -> loc . u . blob . size )
-                pg_next = btypeMagnitude;
-
-            pgbytes = ( ( end -> loc . u . blob . size + pgsize - 1 ) / pgsize ) * pgsize;
-            if ( end -> loc . start_id + end -> loc . id_range != next -> loc . start_id )
-                id_next -= btypeMagnitude;
-            if ( end -> loc . pg + pgbytes != next -> loc . pg )
-                pg_next -= btypeMagnitude;
-
-            /* check for combine-ability */
-            if ( count != 1 && ( id_type != id_next || pg_type != pg_next ) )
-                break;
-
-            /* can be stopped by excessive id range */
-            end_id = next -> loc . start_id + next -> loc . id_range;
-            if ( ( ( end_id - start -> loc . start_id ) >> 32 ) != 0 )
-                break;
-
-            /* only produces change when count == 1
-               in which case we're confident that
-               block size will not be an issue */
-            id_type &= id_next;
-            pg_type &= pg_next;
-
-            /* calculate block header size based upon types:
-               id = { 0:0, 1:4, 2:8, 3:0  }
-               pg = { 0:0, 1:4, 2:8, 3:12 } */
-            hdr_size_div4 = pg_type;
-            if ( id_type != btypePredictable )
-                hdr_size_div4 += id_type;
-
-            /* calculate block entry size as inverse of types:
-               { 0:12, 1:8, 2:4, 3:0 } */
-            entry_size_div4 = ( id_type ^ 3 ) + ( pg_type ^ 3 );
-
-            /* block size ( div 4 ) cannot exceed 64 ( div 4 ) */
-            if ( ( hdr_size_div4 + entry_size_div4 * ( count + 1 ) ) > ( 0x10000 / 4 ) )
-                break;
-        }
-
-        /* we're at the end of a block */
-        info . start_id = start -> loc . start_id;
-        info . start_pg = start -> loc . pg;
-        info . end_id = end -> loc . start_id + end -> loc . id_range;
-        info . end_pg = end -> loc . pg + end -> loc . u . blob . size;
-        info . size = end -> loc . u . blob . size;
-        info . count = count;
-        info . id_type = ( uint16_t ) id_type;
-        info . pg_type = ( uint16_t ) pg_type;
-
-        /* keep page end on even page boundary */
-        if ( pgsize != 1 )
-            info . end_pg = ( ( info . end_pg + pgsize - 1 ) / pgsize ) * pgsize;
-
-        /* define a block */
-        rc = ( * define_block ) ( & info, data );
-        if ( rc != 0 )
-            break;
-
-        /* the next block becomes our start */
-        start = next;
-    }
-    
-    return rc;
-}
-
-/* TranscribeBlocks
- *  writes all blocks within a range
- */
-void KColumnIdx0TranscribeBlocks ( const KColumnIdx0 *self,
-    int64_t first, int64_t upper, struct KColWIdxBlock *iblk )
-{
-    const KColumnIdx0Node *n;
-
-    assert ( self != NULL );
-    assert ( first < upper );
-    assert ( iblk != NULL );
-
-    n = ( const KColumnIdx0Node* )
-        BSTreeFind ( & self -> bst, & first, KColumnIdx0NodeFind );
-    assert ( n != NULL );
-    assert ( n -> loc . start_id == first );
-
-    while ( n != NULL && n -> loc . start_id < upper )
-    {
-        assert ( ( n -> loc . start_id + n -> loc . id_range ) <= upper );
-
-        KColWIdxBlockSetEntry ( iblk,
-            n -> loc . start_id, n -> loc . id_range,
-            n -> loc . pg, n -> loc . u . blob . size );
-
-        n = KColumnIdx0NodeNext ( n );
-    }
-}
-
-/* Truncate
- *  whacks bst contents and truncates file
- */
-void KColumnIdx0Truncate ( KColumnIdx0 *self )
-{
-    assert ( self != NULL );
-    KFileSetSize ( self -> f, self -> eof = 0 );
-    BSTreeWhack ( & self -> bst, KColumnIdx0NodeWhack, NULL );
-    self -> count = 0;
-}
diff --git a/libs/kdb/wcolidx1-priv.h b/libs/kdb/wcolidx1-priv.h
deleted file mode 100644
index aeedf66..0000000
--- a/libs/kdb/wcolidx1-priv.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_colidx1_priv_
-#define _h_colidx1_priv_
-
-#ifndef _h_kfs_directory_
-#include <kfs/directory.h>
-#endif
-
-#include <kfs/md5.h>
-
-#ifndef _h_colfmt_priv_
-#include "colfmt-priv.h"
-#endif
-
-#ifndef _h_klib_container_
-#include <klib/container.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KColIdxBlock;
-struct KColBlockLocInfo;
-
-
-/*--------------------------------------------------------------------------
- * KColumnIdx1
- *  level 1 index
- */
-typedef struct KColumnIdx1 KColumnIdx1;
-struct KColumnIdx1
-{
-    /* tree of level-2 block locators */
-    BSTree bst;
-    struct KFile *f;
-    struct KFile *fidx;
-    struct KMD5File *fmd5;
-    struct KMD5File *fidxmd5;
-
-    uint32_t count;
-    uint32_t vers;
-    /* might have to switch to bit flags if more needed */
-    bool bswap;
-    bool use_md5;
-#define CONVERT_ON_SAVE_NONE	0
-#define CONVERT_ON_SAVE_V1	1
-    uint8_t convert;
-    uint8_t align [ sizeof ( size_t ) - 3 ];
-};
-
-/* Create
- */
-rc_t KColumnIdx1Create ( KColumnIdx1 *self,
-    KDirectory *dir, KMD5SumFmt *md5, KCreateMode mode,
-    uint64_t *data_eof, uint32_t *idx0_count, uint64_t *idx2_eof,
-    size_t pgsize, int32_t checksum );
-
-/* Open
- */
-rc_t KColumnIdx1OpenRead ( KColumnIdx1 *self, const KDirectory *dir,
-    uint64_t *data_eof, uint32_t *idx0_count, uint64_t *idx2_eof,
-    size_t *pgsize, int32_t *checksum );
-rc_t KColumnIdx1OpenUpdate ( KColumnIdx1 *self, KDirectory *dir,
-    KMD5SumFmt *md5, uint64_t *data_eof, uint32_t *idx0_count,
-    uint64_t *idx2_eof, size_t *pgsize, int32_t *checksum );
-
-/* Whack
- */
-rc_t KColumnIdx1Whack ( KColumnIdx1 *self );
-
-/* Version
- */
-rc_t KColumnIdx1Version ( const KColumnIdx1 *self, uint32_t *version );
-#define KColumnIdx1Version( self, version ) \
-    ( * ( version ) = ( uint32_t ) ( self ) -> vers, 0 )
-
-/* ByteOrder
- */
-rc_t KColumnIdx1ByteOrder ( const KColumnIdx1 *self, bool *reversed );
-#define KColumnIdx1ByteOrder( self, reversed ) \
-    ( * ( reversed ) = ( self ) -> bswap, 0 )
-
-/* IdRange
- *  returns range of ids contained within
- */
-bool KColumnIdx1IdRange ( const KColumnIdx1 *self,
-    int64_t *first, int64_t *upper );
-
-/* LocateBlock
- *  locates an idx2 block by range
- */
-rc_t KColumnIdx1LocateBlock ( const KColumnIdx1 *self,
-    KColBlockLoc *bloc, int64_t first, int64_t upper );
-
-/* WriteHeader
- */
-rc_t KColumnIdx1WriteHeader ( KColumnIdx1 *self,
-    uint64_t data_eof, uint32_t idx0_count, uint64_t idx2_eof,
-    size_t pgsize, int32_t checksum );
-
-/* Commit
- *  records a block location
- */
-rc_t KColumnIdx1Commit ( KColumnIdx1 *self, const KColBlockLoc *bloc );
-rc_t KColumnIdx1CommitDone ( KColumnIdx1 *self );
-
-/* Revert
- *  reverses effect of commit
- */
-bool KColumnIdx1Revert ( KColumnIdx1 *self, int64_t start_id, uint32_t id_range );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_colidx1_priv_ */
diff --git a/libs/kdb/wcolidx1.c b/libs/kdb/wcolidx1.c
deleted file mode 100644
index a1f897e..0000000
--- a/libs/kdb/wcolidx1.c
+++ /dev/null
@@ -1,857 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kdb/extern.h>
-#include "wcolumn-priv.h"
-#include "wcolidx1-priv.h"
-#include "werror-priv.h"
-#include <kfs/file.h>
-#include <kfs/md5.h>
-#include <sysalloc.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <byteswap.h>
-
-
-/*--------------------------------------------------------------------------
- * KColumnIdx1Node
- *  a binary search tree node
- */
-typedef struct KColumnIdx1Node KColumnIdx1Node;
-struct KColumnIdx1Node
-{
-    BSTNode n;
-    KColBlockLoc loc;
-};
-
-/* KColumnIdx1NodeFind
- */
-static
-int CC KColumnIdx1NodeFind ( const void *item, const BSTNode *n )
-{
-#define a ( * ( const int64_t* ) item )
-#define b ( ( const KColumnIdx1Node* ) n )
-
-    if ( a < b -> loc . start_id )
-        return -1;
-    return a >= ( b -> loc . start_id + b -> loc . id_range );
-
-#undef a
-#undef b
-}
-
-/* KColumnIdx1NodeSort
- */
-static
-int CC KColumnIdx1NodeSort ( const BSTNode *item, const BSTNode *n )
-{
-#define a ( ( const KColumnIdx1Node* ) item )
-#define b ( ( const KColumnIdx1Node* ) n )
-
-    if ( ( a -> loc . start_id + a -> loc . id_range ) <= b -> loc . start_id )
-        return -1;
-    return a -> loc . start_id >= ( b -> loc . start_id + b -> loc . id_range );
-
-#undef a
-#undef b
-}
-
-/* KColumnIdx1NodeWhack
- */
-static
-void CC KColumnIdx1NodeWhack ( BSTNode *n, void *ignore )
-{
-    free ( n );
-}
-
-/*--------------------------------------------------------------------------
- * KColumnIdx1
- *  level 1 index
- */
-
-/* Init
- */
-static
-rc_t KColumnIdx1Inflate ( KColumnIdx1 *self,
-    const KColBlockLoc *buffer, uint32_t count )
-{
-    uint32_t i;
-    for ( i = 0; i < count; ++ i )
-    {
-        KColumnIdx1Node *exist, *n = malloc ( sizeof * n );
-        if ( n == NULL )
-            return RC ( rcDB, rcIndex, rcConstructing, rcMemory, rcExhausted );
-
-        n -> loc = buffer [ i ];
-        if ( BSTreeInsertUnique ( & self -> bst,
-             & n -> n, ( BSTNode** ) & exist, KColumnIdx1NodeSort ) )
-        {
-            free ( n );
-            return RC ( rcDB, rcIndex, rcConstructing, rcData, rcCorrupt );
-        }
-
-        ++ self -> count;
-    }
-
-    return 0;
-}
-
-static
-void KColumnIdx1Swap ( KColBlockLoc *buffer, uint32_t count )
-{
-    uint32_t i;
-    for ( i = 0; i < count; ++ i )
-    {
-        buffer [ i ] . pg = bswap_64 ( buffer [ i ] . pg );
-        buffer [ i ] . u . gen = bswap_32 ( buffer [ i ] . u . gen );
-        buffer [ i ] . id_range = bswap_32 ( buffer [ i ] . id_range );
-        buffer [ i ] . start_id = bswap_64 ( buffer [ i ] . start_id );
-    }
-}
-
-static
-rc_t KColumnIdx1Init ( KColumnIdx1 *self, uint32_t off, uint32_t count )
-{
-    rc_t rc;
-    KColBlockLoc *buffer = malloc ( 2048 * sizeof * buffer );
-    if ( buffer == NULL )
-        rc = RC ( rcDB, rcIndex, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        size_t num_read;
-        uint32_t i, cnt;
-        for ( rc = 0, i = 0; i < count; off += num_read, i += cnt )
-        {
-            /* maximum number of blocks available
-               that will fit into buffer */
-            cnt = count - i;
-            if ( cnt > 2048 )
-                cnt = 2048;
-
-            /* read into buffer an even number of blocks */
-            rc = KFileReadAll ( self -> f, off,
-                buffer, cnt * sizeof * buffer, & num_read );
-            if ( rc != 0 )
-                break;
-
-            /* detect EOF */
-            if ( num_read == 0 )
-                break;
-
-            /* detect corrupt short read
-               it's not clear how this is intended to work...
-               we either get ALL count blocks, or the file
-               is corrupt. a short read is possible, but
-               is not an error until we hit EOF... */
-            if ( ( num_read % sizeof * buffer ) != 0 )
-            {
-                rc = RC ( rcDB, rcIndex, rcConstructing, rcData, rcCorrupt );
-                break;
-            }
-
-            /* byte-swap entire buffer */
-            if ( self -> bswap )
-                KColumnIdx1Swap ( buffer, cnt );
-
-            /* create master index blocks */
-            rc = KColumnIdx1Inflate ( self, buffer, cnt );
-            if ( rc != 0 )
-                break;
-        }
-
-        free ( buffer );
-    }
-    return rc;
-}
-
-/* Create
- */
-rc_t KColumnIdx1Create ( KColumnIdx1 *self, KDirectory *dir,
-    struct KMD5SumFmt *md5, KCreateMode mode,
-	uint64_t *data_eof, uint32_t *idx0_count, uint64_t *idx2_eof,
-	size_t pgsize, int32_t checksum )
-{
-    rc_t rc;
-
-    if ( ( mode & kcmValueMask ) == kcmOpen )
-    {
-        size_t f_pgsize;
-        int32_t f_checksum;
-	
-        /* try to open update first */
-        rc = KColumnIdx1OpenUpdate ( self, dir, md5, data_eof, 
-            idx0_count, idx2_eof, &f_pgsize, &f_checksum);
-
-        if ( rc == 0 )
-        {
-            if ( pgsize != f_pgsize || checksum != f_checksum )
-            {
-                KFileRelease ( self -> f );
-                KFileRelease ( self -> fidx );
-                rc = RC ( rcDB, rcIndex, rcConstructing, rcParam, rcIncorrect );
-            }
-            return rc;
-        }
-        if ( GetRCState ( rc ) != rcNotFound )
-            return rc;
-
-        /* if it failed on not found try to create */
-    }
-
-    BSTreeInit ( & self -> bst );
-    self -> count = 0;
-    self -> vers = 0;
-    self -> bswap = false;
-
-    rc = KColumnFileCreate ( & self -> f, & self -> fmd5, dir, md5, mode, true, "idx1" );
-    if ( rc == 0 )
-    {
-#if KCOL_CURRENT_VERSION != 1
-        rc = KColumnFileCreate ( & self -> fidx, & self -> fidxmd5, dir, md5, mode, false, "idx" );
-        if ( rc == 0 )
-        {
-#endif
-            KColumnHdr hdr;
-            size_t num_bytes;
-
-            memset ( & hdr, 0, sizeof hdr );
-            hdr . dad . endian = eByteOrderTag;
-            hdr . dad . version = KCOL_CURRENT_VERSION;
-#if KCOL_CURRENT_VERSION == 1
-            hdr . u . v1 . page_size = ( uint32_t ) pgsize;
-            hdr . u . v1 . checksum = ( uint8_t ) checksum;
-#elif KCOL_CURRENT_VERSION == 2
-            hdr . u . v2 . page_size = ( uint32_t ) pgsize;
-            hdr . u . v2 . checksum = ( uint8_t ) checksum;
-#elif KCOL_CURRENT_VERSION == 3
-            hdr . u . v3 . page_size = ( uint32_t ) pgsize;
-            hdr . u . v3 . checksum = ( uint8_t ) checksum;
-#else
-#error "lack code for current version"
-#endif
-            * data_eof = 0;
-            * idx0_count = 0;
-            * idx2_eof = 0;
-#if KCOL_CURRENT_VERSION == 1
-            rc = KFileWrite ( self -> f, 0, & hdr,
-              KColumnHdrOffset ( hdr, vCUR ),  & num_bytes );
-#else
-            rc = KFileWrite ( self -> f, 0, & hdr, sizeof hdr . dad, & num_bytes );
-            if ( rc == 0 )
-            {
-                if ( num_bytes != sizeof hdr . dad )
-                    rc = RC ( rcDB, rcIndex, rcConstructing, rcTransfer, rcIncomplete );
-                else
-                {
-                    rc = KFileWrite ( self -> fidx, 0, & hdr,
-                        KColumnHdrOffset ( hdr, vCUR ),  & num_bytes );
-#endif
-                    if ( rc == 0 )
-                    {
-                        if ( num_bytes == KColumnHdrOffset ( hdr, vCUR ) )
-                        {
-                            self -> vers = KCOL_CURRENT_VERSION;
-                            /* Here is the exit with two new files */
-                            return 0;
-                        }
-                    }
-#if KCOL_CURRENT_VERSION != 1
-                }
-
-                KFileRelease ( self -> fidx );
-            }
-#endif
-
-            KFileRelease ( self -> f );
-        }
-    }
-
-    return rc;
-}
-
-/* Open
- */
-rc_t KColumnIdx1OpenRead ( KColumnIdx1 *self, const KDirectory *dir,
-    uint64_t *data_eof, uint32_t *idx0_count, uint64_t *idx2_eof,
-    size_t *pgsize, int32_t *checksum )
-{
-    rc_t rc;
-
-    BSTreeInit ( & self -> bst );
-    self -> count = 0;
-    self -> vers = 0;
-    self -> bswap = false;
-
-    rc = KDirectoryVOpenFileRead ( dir,
-        ( const KFile** ) & self -> f, "idx1", NULL );
-    if ( rc == 0 )
-    {
-        KColumnHdr hdr;
-        size_t num_bytes;
-        rc = KFileReadAll ( self -> f, 0, & hdr, sizeof hdr, & num_bytes );
-        if ( rc == 0 )
-        {
-            if ( num_bytes == 0 )
-                rc = RC ( rcDB, rcColumn, rcOpening, rcIndex, rcEmpty );
-            else if ( num_bytes < KColumnHdrMinSize ( hdr ) )
-                rc = RC ( rcDB, rcColumn, rcOpening, rcIndex, rcCorrupt );
-            else
-            {
-                rc = KDBHdrValidate ( & hdr . dad,
-                    num_bytes, 1, KCOL_CURRENT_VERSION );
-                if ( GetRCState ( rc ) == rcIncorrect && GetRCObject ( rc ) == rcByteOrder )
-                {
-                    self -> bswap = true;
-                    hdr . dad . endian = bswap_32 ( hdr . dad . endian );
-                    hdr . dad . version = bswap_32 ( hdr . dad . version );
-                    rc = KDBHdrValidate ( & hdr . dad, num_bytes, 1, KCOL_CURRENT_VERSION );
-                }
-                if ( rc == 0 )
-                {
-                    uint32_t off, count;
-
-                    switch ( hdr . dad . version )
-                    {
-                    case 1:
-                        if ( num_bytes < KColumnHdrOffset ( hdr, v1 ) )
-                            rc = RC ( rcDB, rcColumn, rcOpening, rcIndex, rcCorrupt );
-                        else
-                        {
-                            if ( self -> bswap )
-                            {
-                                hdr . u . v1 . data_eof = bswap_64 ( hdr . u . v1 . data_eof );
-                                hdr . u . v1 . idx2_eof = bswap_64 ( hdr . u . v1 . idx2_eof );
-                                hdr . u . v1 . num_blocks = bswap_32 ( hdr . u . v1 . num_blocks );
-                                hdr . u . v1 . page_size = bswap_32 ( hdr . u . v1 . page_size );
-                            }
-
-                            * data_eof = hdr . u . v1 . data_eof;
-                            * idx2_eof = hdr . u . v1 . idx2_eof;
-                            * pgsize = hdr . u . v1 . page_size;
-                            * checksum = hdr . u . v1 . checksum;
-                            count = hdr . u . v1 . num_blocks;
-                            off = KColumnHdrOffset ( hdr, v1 );
-
-                            * idx0_count = 0;
-                        }
-                        break;
-
-                    default:
-                        rc = KDirectoryVOpenFileRead ( dir, ( const KFile** ) & self -> fidx, "idx", NULL );
-                        if ( rc == 0 )
-                        {
-                            off = sizeof hdr . dad;
-                            rc = KFileReadAll ( self -> fidx, 0, & hdr, sizeof hdr, & num_bytes );
-                            if ( rc == 0 )
-                            {
-                                if ( num_bytes < KColumnHdrOffset ( hdr, v2 ) )
-                                    rc = RC ( rcDB, rcColumn, rcOpening, rcIndex, rcCorrupt );
-                                else
-                                {
-                                    rc = KDBHdrValidate ( & hdr . dad,
-                                        num_bytes, 2, KCOL_CURRENT_VERSION );
-                                    if ( GetRCState ( rc ) == rcIncorrect && GetRCObject ( rc ) == rcByteOrder )
-                                    {
-                                        if ( ! self->bswap ) /* catch mis-matched endianess */
-                                            rc = RC ( rcDB, rcColumn, rcOpening, rcIndex, rcCorrupt );
-                                        else
-                                        {
-                                            hdr . dad . endian = bswap_32 ( hdr . dad . endian );
-                                            hdr . dad . version = bswap_32 ( hdr . dad . version );
-                                            rc = KDBHdrValidate ( & hdr . dad, num_bytes, 1, KCOL_CURRENT_VERSION );
-                                        }
-                                    }
-                                    else if ( self -> bswap ) /* catch mis-matched endianess */
-                                        rc = RC ( rcDB, rcColumn, rcOpening, rcIndex, rcCorrupt );
-
-                                    if ( rc == 0 ) switch ( hdr . dad . version )
-                                    {
-                                    case 2:
-                                        if ( self -> bswap )
-                                        {
-                                            hdr. u . v2 . data_eof = bswap_64 ( hdr. u . v2 . data_eof );
-                                            hdr. u . v2 . idx2_eof = bswap_64 ( hdr. u . v2 . idx2_eof );
-                                            hdr. u . v2 . num_blocks = bswap_32 ( hdr. u . v2 . num_blocks );
-                                            hdr. u . v2 . page_size = bswap_32 ( hdr. u . v2 . page_size );
-                                        }
-
-                                        * data_eof = hdr . u . v2 . data_eof;
-                                        * idx2_eof = hdr . u . v2 . idx2_eof;
-                                        * pgsize = hdr . u . v2 . page_size;
-                                        * checksum = hdr . u . v2 . checksum;
-                                        count = hdr . u . v2 . num_blocks;
-                                        * idx0_count = 0;
-                                        break;
-
-                                    case 3:
-                                        if ( self -> bswap )
-                                        {
-                                            hdr. u . v3 . data_eof = bswap_64 ( hdr. u . v3 . data_eof );
-                                            hdr. u . v3 . idx2_eof = bswap_64 ( hdr. u . v3 . idx2_eof );
-                                            hdr. u . v3 . idx0_count = bswap_32 ( hdr. u . v3 . idx0_count );
-                                            hdr. u . v3 . num_blocks = bswap_32 ( hdr. u . v3 . num_blocks );
-                                            hdr. u . v3 . page_size = bswap_32 ( hdr. u . v3 . page_size );
-                                        }
-
-                                        * data_eof = hdr . u . v3 . data_eof;
-                                        * idx2_eof = hdr . u . v3 . idx2_eof;
-                                        * idx0_count = hdr . u . v3 . idx0_count;
-                                        * pgsize = hdr . u . v3 . page_size;
-                                        * checksum = hdr . u . v3 . checksum;
-                                        count = hdr . u . v3 . num_blocks;
-                                        break;
-
-                                    default:
-                                        rc = RC ( rcDB, rcColumn, rcOpening, rcColumn, rcBadVersion );
-                                    }
-                                }
-                            }
-                        }
-                    }
-
-                    if ( rc == 0 )
-                    {
-                        self -> vers = hdr . dad . version;
-                        rc = KColumnIdx1Init ( self, off, count );
-                        if ( rc == 0 )
-                            return rc;
-                    }
-
-                    KFileRelease ( self -> fidx );
-                    self -> fidx = NULL;
-                }
-            }
-        }
-
-        KFileRelease ( self -> f );
-        self -> f = NULL;
-    }
-
-    return rc;
-}
-
-rc_t KColumnIdx1OpenUpdate ( KColumnIdx1 *self, KDirectory *dir,
-    struct KMD5SumFmt *md5, uint64_t *data_eof, uint32_t *idx0_count,
-    uint64_t *idx2_eof, size_t *pgsize, int32_t *checksum )
-{
-    rc_t rc;
-
-    BSTreeInit ( & self -> bst );
-    self -> count = 0;
-    self -> vers = 0;
-    self -> bswap = false;
-
-    rc = KColumnFileOpenUpdate ( & self -> f, & self -> fmd5, dir, md5, true, "idx1" );
-#if 0
-    /* why open a transaction? */
-    if ( rc == 0 && md5 != NULL )
-        rc = KMD5FileBeginTransaction ( self -> fmd5 );
-#endif
-    if ( rc == 0 )
-    {
-        KColumnHdr hdr;
-        size_t num_bytes;
-        rc = KFileReadAll ( self -> f, 0, & hdr, sizeof hdr, & num_bytes );
-        if ( rc == 0 )
-        {
-            /* if file was there, open will pass but if empty should be
-               treated as if it were not there at all */
-            if ( num_bytes == 0 )
-                rc = RC ( rcDB, rcColumn, rcOpening, rcIndex, rcNotFound );
-            else if ( num_bytes < KColumnHdrMinSize ( hdr ) )
-                rc = RC ( rcDB, rcColumn, rcOpening, rcIndex, rcCorrupt );
-            else
-            {
-                /* allow open for update only on compatible architecture and version */
-                rc = KDBHdrValidate ( & hdr . dad,
-                    num_bytes, 1, KCOL_CURRENT_VERSION );
-                if ( rc == 0 )
-                {
-                    uint32_t off, count;
-
-                    switch ( hdr . dad . version )
-                    {
-                    case 1:
-                        /* ensure hdr is minimally v1 size */
-                        if ( num_bytes < KColumnHdrOffset ( hdr, v1 ) )
-                            rc = RC ( rcDB, rcColumn, rcOpening, rcIndex, rcCorrupt );
-                        else
-                        {
-#if KCOL_CURRENT_VERSION != 1
-                            /* convert to current version */
-                            rc = KColumnFileCreate ( & self -> fidx, & self -> fidxmd5,
-                                dir, md5, kcmOpen, false, "idx" );
-                            if ( rc == 0 )
-                            {
-#endif
-                                * idx0_count = 0;
-                                * data_eof = hdr . u . v1 . data_eof;
-                                * idx2_eof = hdr . u . v1 . idx2_eof;
-                                * pgsize = hdr . u . v1 . page_size;
-                                * checksum = hdr . u . v1 . checksum;
-                                count = hdr . u . v1 . num_blocks;
-                                off = KColumnHdrOffset ( hdr, v1 );
-#if KCOL_CURRENT_VERSION == 1
-                                self -> convert = CONVERT_ON_SAVE_NONE;
-#else
-                                self -> convert = CONVERT_ON_SAVE_V1;
-                            }
-#endif
-                        }
-                        break;
-
-                    default:
-                        /* hdr should be incomplete - instead open "idx" */
-                        rc = KColumnFileOpenUpdate ( & self -> fidx, & self -> fidxmd5, dir, md5, false, "idx" );
-                        if ( rc == 0 )
-                        {
-                            self -> convert = CONVERT_ON_SAVE_NONE;
-                            off = sizeof hdr . dad; /* where to read in idx1 */
-                            rc = KFileReadAll ( self -> fidx, 0, & hdr, sizeof hdr, & num_bytes );
-                            if ( rc == 0 )
-                            {
-                                if ( num_bytes < KColumnHdrOffset ( hdr, v2 ) )
-                                    rc = RC ( rcDB, rcColumn, rcOpening, rcIndex, rcCorrupt );
-                                else
-                                {
-                                    rc = KDBHdrValidate ( & hdr . dad,
-                                        num_bytes, 2, KCOL_CURRENT_VERSION );
-                                    if ( rc == 0 ) switch ( hdr . dad . version )
-                                    {
-                                    case 2:
-                                        * data_eof = hdr . u . v2 . data_eof;
-                                        * idx2_eof = hdr . u . v2 . idx2_eof;
-                                        * pgsize = hdr . u . v2 . page_size;
-                                        * checksum = hdr . u . v2 . checksum;
-                                        count = hdr . u . v2 . num_blocks;
-                                        * idx0_count = 0;
-                                        break; /* skip to initialize and return */
-
-                                    case 3:
-                                        * data_eof = hdr . u . v3 . data_eof;
-                                        * idx2_eof = hdr . u . v3 . idx2_eof;
-                                        * idx0_count = hdr . u . v3 . idx0_count;
-                                        * pgsize = hdr . u . v3 . page_size;
-                                        * checksum = hdr . u . v3 . checksum;
-                                        count = hdr . u . v3 . num_blocks;
-                                        break; /* skip to initialize and return */
-
-                                    default:
-                                        rc = RC ( rcDB, rcColumn, rcOpening, rcColumn, rcBadVersion );
-                                    }
-                                }
-                            }
-                        }
-                    }
-
-                    if ( rc == 0 ) /* initialize and return */
-                    {
-                        self -> vers = hdr . dad . version;
-                        rc = KColumnIdx1Init ( self, off, count );
-                        if ( rc == 0 )
-                            return rc;
-                    }
-
-                    KFileRelease ( self -> fidx );
-                    self -> fidx = NULL;
-                }
-            }
-        }
-        
-        KFileRelease ( self -> f );
-        self -> f = NULL;
-    }
-
-    return rc;
-}
-
-
-/* Whack
- */
-rc_t KColumnIdx1Whack ( KColumnIdx1 *self )
-{
-    rc_t rc = KFileRelease ( self -> fidx );
-    if ( rc == 0 )
-    {
-        self -> fidx = NULL;
-        self -> fidxmd5 = NULL;
-        rc = KFileRelease ( self -> f );
-        if ( rc == 0 )
-        {
-            self -> f = NULL;
-            self -> fmd5 = NULL;
-            BSTreeWhack ( & self -> bst, KColumnIdx1NodeWhack, NULL );
-            BSTreeInit ( & self -> bst );
-        }
-    }
-    return rc;
-}
-
-/* Version
- */
-#ifndef KColumnIdx1Version
-rc_t KColumnIdx1Version ( const KColumnIdx1 *self, uint32_t *version )
-{
-    * version = ( uint32_t ) self -> vers;
-    return 0;
-}
-#endif
-
-/* IdRange
- *  returns range of ids contained within
- */
-bool KColumnIdx1IdRange ( const KColumnIdx1 *self,
-    int64_t *first, int64_t *upper )
-{
-    const KColumnIdx1Node *a, *z;
-
-    assert ( self != NULL );
-    assert ( first != NULL );
-    assert ( upper != NULL );
-
-    a = ( const KColumnIdx1Node* ) BSTreeFirst ( & self -> bst );
-    if ( a == NULL )
-        return false;
-
-    z = ( const KColumnIdx1Node* ) BSTreeLast ( & self -> bst );
-    assert ( z != NULL );
-
-    * first = a -> loc . start_id;
-    * upper = z -> loc . start_id + z -> loc . id_range;
-    assert ( * first < * upper );
-
-    return true;
-}
-
-/* LocateBlock
- *  locates an idx2 block by range
- *  return values:
- */
-rc_t KColumnIdx1LocateBlock ( const KColumnIdx1 *self,
-    KColBlockLoc *bloc, int64_t first, int64_t upper )
-{
-    const KColumnIdx1Node *n;
-
-    assert ( self != NULL );
-    assert ( bloc != NULL );
-    assert ( first < upper );
-
-    n = ( const KColumnIdx1Node* )
-        BSTreeFind ( & self -> bst, & first, KColumnIdx1NodeFind );
-
-    if ( n == NULL )
-        return RC ( rcDB, rcIndex, rcSelecting, rcRange, rcNotFound );
-
-    assert ( first >= n -> loc . start_id );
-    assert ( first < ( n -> loc . start_id + n -> loc . id_range ) );
-
-    if ( upper > ( n -> loc . start_id + n -> loc . id_range ) )
-        return RC ( rcDB, rcIndex, rcSelecting, rcRange, rcInvalid );
-
-    * bloc = n -> loc;
-    return 0;
-}
-
-/* WriteHeader
- */
-rc_t KColumnIdx1WriteHeader ( KColumnIdx1 *self,
-    uint64_t data_eof, uint32_t idx0_count, uint64_t idx2_eof,
-    size_t pgsize, int32_t checksum )
-{
-    rc_t rc = 0;
-    KColumnHdr hdr;
-    bool write_idx1 = false;
-    size_t off, off1, num_writ, num_writ1;
-
-    off1 = sizeof hdr . dad;
-
-    hdr . dad . endian = eByteOrderTag;
-    hdr . dad . version = ( uint32_t ) self -> vers;
-
-    switch ( self -> vers )
-    {
-    case 1:
-        hdr . u . v1 . data_eof = data_eof;
-        hdr . u . v1 . idx2_eof = idx2_eof;
-        hdr . u . v1 . num_blocks = ( uint32_t ) self -> count;
-        hdr . u . v1 . page_size = ( uint32_t ) pgsize;
-        hdr . u . v1 . checksum = ( uint8_t ) checksum;
-        memset ( hdr . u . v1 . align1, 0, sizeof hdr . u . v1 . align1 );
-        off = off1 = KColumnHdrOffset ( hdr, v1 );
-        write_idx1 = true;
-        break;
-    case 2:
-        hdr . u . v2 . data_eof = data_eof;
-        hdr . u . v2 . idx2_eof = idx2_eof;
-        hdr . u . v2 . ignore = 0;
-        hdr . u . v2 . num_blocks = ( uint32_t ) self -> count;
-        hdr . u . v2 . page_size = ( uint32_t ) pgsize;
-        hdr . u . v2 . checksum = ( uint8_t ) checksum;
-        memset ( hdr . u . v2 . align1, 0, sizeof hdr . u . v2 . align1 );
-        off = KColumnHdrOffset ( hdr, v2 );
-        break;
-    case 3:
-        hdr . u . v3 . data_eof = data_eof;
-        hdr . u . v3 . idx2_eof = idx2_eof;
-        hdr . u . v3 . idx0_count = idx0_count;
-        hdr . u . v3 . num_blocks = ( uint32_t ) self -> count;
-        hdr . u . v3 . page_size = ( uint32_t ) pgsize;
-        hdr . u . v3 . checksum = ( uint8_t ) checksum;
-        memset ( hdr . u . v3 . align1, 0, sizeof hdr . u . v2 . align1 );
-        off = KColumnHdrOffset ( hdr, v3 );
-        break;
-    default:
-        return RC ( rcDB, rcIndex, rcWriting, rcColumn, rcBadVersion );
-    }
-
-#if KCOL_CURRENT_VERSION != 1
-    if ( self -> fidxmd5 != NULL )
-        rc = KMD5FileReset ( self -> fidxmd5 );
-    if ( rc == 0 )
-    {
-        rc = KFileWrite ( self -> fidx, 0, & hdr, off, & num_writ );
-        if ( rc == 0 )
-        {
-            /* don't have a failsafe recover here - no undoing write to idx figured out */
-            if ( write_idx1 )
-            {
-#endif
-                if ( self -> fmd5 != NULL )
-                    rc = KMD5FileReset ( self -> fmd5 );
-                if ( rc == 0 )
-                    rc = KFileWrite ( self -> f, 0, & hdr, off1, & num_writ1 );
-#if KCOL_CURRENT_VERSION != 1
-            }
-        }
-    }
-#endif
-    if ( rc == 0 )
-    {
-#if KCOL_CURRENT_VERSION != 1
-        if ( num_writ != off )
-            rc = RC ( rcDB, rcIndex, rcWriting, rcTransfer, rcIncomplete );
-        else
-#endif
-        if ( write_idx1 && num_writ1 != off1 )
-            rc = RC ( rcDB, rcIndex, rcWriting, rcTransfer, rcIncomplete );
-    }
-
-    return rc;
-}
-
-/* Commit
- *  records a block location
- */
-rc_t KColumnIdx1Commit ( KColumnIdx1 *self, const KColBlockLoc *bloc )
-{
-    rc_t rc;
-    uint64_t pos;
-    size_t num_writ;
-
-    switch ( self -> vers )
-    {
-    case 1:
-        pos = KColumnHdrOffset ( NULL_HDR, v1 );
-        break;
-    default:
-        pos = KColumnHdrMinSize ( NULL_HDR );
-    }
-
-    pos += self -> count * sizeof * bloc;
-    rc = KFileWrite ( self -> f, pos, bloc, sizeof * bloc, & num_writ );
-    if ( rc == 0 )
-    {
-        if ( num_writ != sizeof * bloc )
-            rc = RC ( rcDB, rcIndex, rcCommitting, rcTransfer, rcIncomplete );
-        else
-        {
-            KColumnIdx1Node *n, *exist;
-            n = malloc ( sizeof * n );
-            if ( n == NULL )
-                rc = RC ( rcDB, rcIndex, rcCommitting, rcMemory, rcExhausted );
-            else
-            {
-                n -> loc = * bloc;
-                if ( BSTreeInsertUnique ( & self -> bst,
-                     & n -> n, ( BSTNode** ) & exist, KColumnIdx1NodeSort ) )
-                {
-                    free ( n );
-                    rc = RC ( rcDB, rcIndex, rcCommitting, rcRange, rcExists );
-                }
-                else
-                {
-                    ++ self -> count;
-                }
-            }
-        }
-    }
-
-    return rc;
-}
-
-rc_t KColumnIdx1CommitDone ( KColumnIdx1 *self )
-{
-    rc_t rc = 0;
-    if ( self -> fmd5 != NULL )
-    {
-        rc = KMD5FileCommit ( self -> fmd5 );
-        if ( rc == 0 )
-            rc = KMD5FileCommit ( self -> fidxmd5 );
-    }
-    return rc;
-}
-
-/* Revert
- *  reverses effect of commit
- *  return value is used to trigger DLListDoUntil exit
- */
-bool KColumnIdx1Revert ( KColumnIdx1 *self, int64_t start_id, uint32_t id_range )
-{
-    KColumnIdx1Node *n = ( KColumnIdx1Node* )
-        BSTreeFind ( & self -> bst, & start_id, KColumnIdx1NodeFind );
-    if ( n == NULL )
-        return true;
-
-    assert ( n -> loc . start_id == start_id );
-    assert ( n -> loc . id_range == id_range );
-
-    BSTreeUnlink ( & self -> bst, & n -> n );
-    free ( n );
-    -- self -> count;
-
-    if ( self -> fmd5 != NULL )
-    {
-        assert ( self -> f == (KFile*) self -> fmd5 );
-        assert ( self -> fidx == (KFile*) self -> fidxmd5 );
-
-        KMD5FileRevert ( self -> fmd5 );
-    }
-    
-    return false;
-}
diff --git a/libs/kdb/wcolidx2-priv.h b/libs/kdb/wcolidx2-priv.h
deleted file mode 100644
index ee45610..0000000
--- a/libs/kdb/wcolidx2-priv.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_colidx2_priv_
-#define _h_colidx2_priv_
-
-#ifndef _h_kfs_directory_
-#include <kfs/directory.h>
-#endif
-
-#ifndef _h_colfmt_priv_
-#include "colfmt-priv.h"
-#endif
-
-#ifndef _h_klib_container_
-#include <klib/container.h>
-#endif
-
-#include <kfs/md5.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KColIdxBlock;
-
-
-/*--------------------------------------------------------------------------
- * KColumnIdx2
- *  level 2 index
- */
-typedef struct KColumnIdx2 KColumnIdx2;
-struct KColumnIdx2
-{
-    /* for adding new blocks */
-    uint64_t eof;
-
-    /* idx2 itself */
-    struct KFile *f;
-    struct KMD5File *fmd5;
-};
-
-/* Create
- */
-rc_t KColumnIdx2Create ( KColumnIdx2 *self,
-    KDirectory *dir, struct KMD5SumFmt *md5, KCreateMode mode, uint64_t eof );
-
-/* Open
- */
-rc_t KColumnIdx2OpenRead ( KColumnIdx2 *self,
-    const KDirectory *dir, uint64_t eof );
-
-/* Whack
- */
-rc_t KColumnIdx2Whack ( KColumnIdx2 *self );
-
-/* LocateBlob
- *  locate an existing blob
- */
-rc_t KColumnIdx2LocateBlob ( const KColumnIdx2 *self,
-    KColBlobLoc *loc, const KColBlockLoc *bloc,
-    int64_t first, int64_t upper, bool bswap );
-
-/* Write
- *  writes block to idx2 at end of file
- *
- *  "pos" [ OUT ] - location at which block was written
- *
- *  "buffer" [ IN ] and "bytes" [ IN ] - describes data buffer
- *
- *  return values:
- */
-rc_t KColumnIdx2Write ( KColumnIdx2 *self,
-    uint64_t *pos, const void *buffer, size_t bytes );
-
-/* Commit
- *  keeps changes indicated by block size
- */
-rc_t KColumnIdx2Commit ( KColumnIdx2 *self, size_t bytes );
-rc_t KColumnIdx2CommitDone ( KColumnIdx2 *self );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_colidx2_priv_ */
diff --git a/libs/kdb/wcolidx2.c b/libs/kdb/wcolidx2.c
deleted file mode 100644
index 563aa44..0000000
--- a/libs/kdb/wcolidx2.c
+++ /dev/null
@@ -1,241 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kdb/extern.h>
-#include "wcolumn-priv.h"
-#include "wcolidx2-priv.h"
-#include "idxblk-priv.h"
-#include "werror-priv.h"
-#include <kfs/file.h>
-#include <kfs/buffile.h>
-#include <kfs/md5.h>
-#include <sysalloc.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-#define IDX2_READ_FILE_BUFFER 1024 * 1024
-
-
-/*--------------------------------------------------------------------------
- * KColumnIdx2
- *  level 2 index
- */
-
-/* Init
- */
-static
-rc_t KColumnIdx2Init ( KColumnIdx2 *self, uint64_t idx2_eof )
-{
-    rc_t rc = KFileSize ( self -> f, & self -> eof );
-    if ( rc == 0 )
-    {
-        if ( self -> eof < idx2_eof )
-            rc = RC ( rcDB, rcIndex, rcConstructing, rcIndex, rcCorrupt );
-        else
-        {
-            self -> eof = idx2_eof;
-            return 0;
-        }
-    }
-
-    KFileRelease ( self -> f );
-    self -> f = NULL;
-    return rc;
-}
-
-/* Create
- */
-rc_t KColumnIdx2Create ( KColumnIdx2 *self,
-    KDirectory *dir, KMD5SumFmt *md5, KCreateMode mode, uint64_t eof )
-{
-    rc_t rc = KColumnFileCreate (&self->f, &self->fmd5, dir, md5, mode, true, "idx2");
-    if ( rc == 0 )
-        rc = KColumnIdx2Init ( self, eof );
-    return rc;
-}
-
-/* Open
- */
-rc_t KColumnIdx2OpenRead ( KColumnIdx2 *self,
-    const KDirectory *dir, uint64_t eof )
-{
-    rc_t rc = KDirectoryVOpenFileRead ( dir,
-        ( const KFile** ) & self -> f, "idx2", NULL );
-#if IDX2_READ_FILE_BUFFER
-    if ( rc == 0 )
-    {
-        KFile * orig = self -> f;
-        rc = KBufFileMakeRead ( ( const KFile** ) & self -> f, self -> f, IDX2_READ_FILE_BUFFER );
-	if ( rc == 0 )
-        {
-            KFileRelease ( orig );
-        }
-        else
-        {
-            self -> f = orig;
-            rc = 0;
-        }
-    }
-#endif
-    if ( rc == 0 )
-        rc = KColumnIdx2Init ( self, eof );
-    return rc;
-}
-
-/* Whack
- */
-rc_t KColumnIdx2Whack ( KColumnIdx2 *self )
-{
-    rc_t rc = KFileRelease ( self -> f );
-    if ( rc == 0 )
-    {
-        self -> f = NULL;
-        self -> fmd5 = NULL;
-    }
-    return rc;
-}
-
-/* LocateBlob
- *  locate an existing blob
- */
-rc_t KColumnIdx2LocateBlob ( const KColumnIdx2 *self,
-    KColBlobLoc *loc, const KColBlockLoc *bloc,
-    int64_t first, int64_t upper, bool bswap )
-{
-    rc_t rc;
-
-    /* compression not supported */
-    if ( bloc -> u . blk . compressed )
-        rc = RC ( rcDB, rcIndex, rcSelecting, rcNoObj, rcUnsupported );
-    else
-    {
-        uint64_t buffer [ 1024 / 8 ]; /* make sure is uint64_t aligned */
-        void *block = buffer;
-
-        /* determine the number of entries in block */
-        size_t orig = bloc -> u . blk . size;
-        uint32_t count = KColBlockLocEntryCount ( bloc, & orig );
-
-        /* determine the size to allocate */
-        size_t block_size = KColBlockLocAllocSize ( bloc, orig, count );
-
-        /* allocate a block */
-        if ( block_size > sizeof buffer )
-            block = malloc ( block_size );
-        if ( block == NULL )
-            rc = RC ( rcDB, rcIndex, rcSelecting, rcMemory, rcExhausted );
-        else
-        {
-            size_t num_read;
-            rc = KFileReadAll ( self -> f, bloc -> pg, block, orig, & num_read );
-            if ( rc == 0 )
-            {
-                if ( num_read != orig )
-                    rc = RC ( rcDB, rcIndex, rcSelecting, rcTransfer, rcIncomplete );
-                else
-                {
-                    KColIdxBlock iblk;
-                    rc = KColIdxBlockInit ( & iblk, bloc, orig, block, block_size, bswap );
-                    if ( rc == 0 )
-                    {
-                        uint32_t span;
-                        int64_t start_id;
-                        int slot = KColIdxBlockFind ( & iblk,
-                            bloc, count, first, & start_id, & span );
-                        if ( slot < 0 )
-                            rc = RC ( rcDB, rcIndex, rcSelecting, rcRange, rcNotFound );
-                        else if ( upper > ( start_id + span ) )
-                            rc = RC ( rcDB, rcIndex, rcSelecting, rcRange, rcInvalid );
-                        else
-                        {
-                            loc -> start_id = start_id;
-                            loc -> id_range = span;
-
-                            KColIdxBlockGet ( & iblk,
-                                bloc, count, slot, & loc -> pg, & span );
-                            loc -> u . blob . size = span;
-                        }
-                    }
-                }
-            }
-
-            if ( block != buffer )
-                free ( block );
-        }
-    }
-
-    return rc;
-}
-
-/* Write
- *  writes block to idx2 at end of file
- *
- *  "pos" [ OUT ] - location at which block was written
- *
- *  "buffer" [ IN ] and "bytes" [ IN ] - describes data buffer
- *
- *  return values:
- */
-rc_t KColumnIdx2Write ( KColumnIdx2 *self,
-    uint64_t *pos, const void *buffer, size_t bytes )
-{
-    rc_t rc;
-    size_t num_writ;
-
-    * pos = self -> eof;
-
-    rc = KFileWrite ( self -> f,
-        self -> eof, buffer, bytes, & num_writ );
-    if ( rc == 0 )
-    {
-        if ( num_writ != bytes )
-            rc = RC ( rcDB, rcIndex, rcWriting, rcTransfer, rcIncomplete );
-    }
-
-    return rc;
-}
-
-/* Commit
- *  keeps changes indicated by block size
- */
-rc_t KColumnIdx2Commit ( KColumnIdx2 *self, size_t bytes )
-{
-    self -> eof += bytes;
-    return 0;
-}
-
-rc_t KColumnIdx2CommitDone ( KColumnIdx2 *self )
-{
-    assert ( self != NULL );
-
-    if ( self -> fmd5 != NULL )
-        return KMD5FileCommit ( self -> fmd5 );
-
-    return 0;
-}
diff --git a/libs/kdb/wcolumn-priv.h b/libs/kdb/wcolumn-priv.h
deleted file mode 100644
index 3360b78..0000000
--- a/libs/kdb/wcolumn-priv.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_column_priv_
-#define _h_column_priv_
-
-#ifndef _h_kdb_column_
-#include <kdb/column.h>
-#endif
-
-#ifndef _h_klib_container_
-#include <klib/container.h>
-#endif
-
-#ifndef _h_klib_refcount_
-#include <klib/refcount.h>
-#endif
-
-#ifndef _h_coldata_priv_
-#include "wcoldata-priv.h"
-#endif
-
-#ifndef _h_colidx_priv_
-#include "wcolidx-priv.h"
-#endif
-
-#include <klib/symbol.h>
-#include <kfs/file.h>
-#include <kfs/md5.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KTable;
-struct KDBManager;
-struct KDirectory;
-struct KMD5SumFmt;
-
-
-/*--------------------------------------------------------------------------
- * KColumn
- */
-struct KColumn
-{
-    struct KTable *tbl;
-    struct KDBManager *mgr;
-    struct KDirectory *dir;
-
-    KMD5SumFmt *md5;
-
-    KColumnIdx idx;
-    KColumnData df;
-
-    KRefcount refcount;
-    uint32_t opencount;
-    uint32_t commit_freq;
-    uint32_t csbytes;
-    int32_t checksum;
-    bool read_only;
-
-    KSymbol sym;
-
-    char path [ 1 ];
-};
-
-/* Attach
- * Sever
- *  like Release, except called internally
- *  indicates that a child object is letting go...
- */
-KColumn *KColumnAttach ( const KColumn *self );
-rc_t KColumnSever ( const KColumn *self );
-
-/* Cmp
- * Sort
- */
-int KColumnCmp ( const void *item, struct BSTNode const *n );
-int KColumnSort ( struct BSTNode const *item, struct BSTNode const *n );
-
-
-rc_t KColumnFileCreate ( KFile ** ppf, KMD5File ** ppfmd5, KDirectory * dir, 
-			 KMD5SumFmt * md5, KCreateMode mode,
-			 bool append, const char * name);
-rc_t KColumnFileOpenUpdate ( KFile ** ppf, KMD5File ** ppfmd5, KDirectory * dir, 
-			     KMD5SumFmt * md5, bool append,
-			     const char * name);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_column_priv_ */
diff --git a/libs/kdb/wcolumn.c b/libs/kdb/wcolumn.c
deleted file mode 100644
index 650fe07..0000000
--- a/libs/kdb/wcolumn.c
+++ /dev/null
@@ -1,2437 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kdb/extern.h>
-#include "wcolumn-priv.h"
-#include "dbmgr-priv.h"
-#include "wtable-priv.h"
-#include "wkdb-priv.h"
-#include "werror-priv.h"
-#include <kdb/kdb-priv.h>
-#include <klib/symbol.h>
-#include <kfs/directory.h>
-#include <kfs/file.h>
-#include <kfs/md5.h>
-#include <kfs/impl.h>
-#include <klib/checksum.h>
-#include <klib/printf.h>
-#include <klib/log.h>
-#include <sysalloc.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-#include <errno.h>
-#include <byteswap.h>
-
-
-/*--------------------------------------------------------------------------
- * KColumn
- *  a collection of blobs indexed by oid
- */
-
-/* Whack
- */
-static
-rc_t KColumnWhack ( KColumn *self )
-{
-    rc_t rc;
-    KDBManager *mgr = self -> mgr;
-    KSymbol * symb;
-    assert ( mgr != NULL );
-
-    KRefcountWhack ( & self -> refcount, "KColumn" );
-
-    /* shut down and checkpoint index */
-    rc = KColumnIdxWhack ( & self -> idx, 
-        self -> df . eof, self -> df . pgsize, self -> checksum );
-    if ( rc )
-        return rc;
-
-    /* shut down data fork */
-    KColumnDataWhack ( & self -> df );
-
-    /* shut down md5 sum file if it is open */
-    KMD5SumFmtRelease ( self -> md5 ), self -> md5 = NULL;
-
-    /* release owning table
-       should never fail, and our recovery is flawed */
-    if ( self -> tbl != NULL )
-    {
-        rc = KTableSever ( self -> tbl );
-        if ( rc != 0 )
-            return rc;
-        self -> tbl = NULL;
-    }
-
-    symb = KDBManagerOpenObjectFind (mgr, self->path);
-    if (symb != NULL)
-    {
-        rc = KDBManagerOpenObjectDelete (mgr, symb);
-        if (rc == 0)
-        {
-            /* release manager
-               should never fail */
-            rc = KDBManagerSever ( mgr );
-            if ( rc != 0 )
-                rc = KDBManagerOpenObjectAdd (mgr, symb);
-            else
-            {
-                /* complete */
-                KDirectoryRelease ( self -> dir );
-                free ( self );
-                return 0;
-            }
-        }
-    }
-
-    KRefcountInit ( & self -> refcount, 1, "KColumn", "whack", "kcol" );
-    return rc;
-}
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-LIB_EXPORT rc_t CC KColumnAddRef ( const KColumn *cself )
-{
-    KColumn *self = ( KColumn* ) cself;
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KColumn" ) )
-        {
-        case krefLimit:
-            return RC ( rcDB, rcColumn, rcAttaching, rcRange, rcExcessive );
-        }
-        ++ self -> opencount;
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KColumnRelease ( const KColumn *cself )
-{
-    KColumn *self = ( KColumn* ) cself;
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KColumn" ) )
-        {
-        case krefWhack:
-            return KColumnWhack ( ( KColumn* ) self );
-        case krefLimit:
-            return RC ( rcDB, rcColumn, rcReleasing, rcRange, rcExcessive );
-        }
-        -- self -> opencount;
-    }
-    return 0;
-}
-
-
-/* Attach
- */
-KColumn *KColumnAttach ( const KColumn *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAddDep ( & self -> refcount, "KColumn" ) )
-        {
-        case krefLimit:
-            return NULL;
-        }
-    }
-    return ( KColumn* ) self;
-}
-
-/* Sever
- *  like Release, except called internally
- *  indicates that a child object is letting go...
- */
-rc_t KColumnSever ( const KColumn *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDropDep ( & self -> refcount, "KColumn" ) )
-        {
-        case krefWhack:
-            return KColumnWhack ( ( KColumn* ) self );
-        case krefLimit:
-            return RC ( rcDB, rcColumn, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/* Make
- *  make an initialized structure
- *  NB - does NOT attach reference to dir, but steals it
- */
-static
-rc_t KColumnMake ( KColumn **colp, const KDirectory *dir, const char *path,
-		   KMD5SumFmt * md5, bool read_only )
-{
-    rc_t rc;
-    KColumn *col = malloc ( sizeof * col + strlen ( path ) );
-    if ( col == NULL )
-    {
-	* colp = NULL;
-        return RC ( rcDB, rcColumn, rcConstructing, rcMemory, rcExhausted );
-    }
-
-    memset ( col, 0, sizeof * col );
-    col -> dir = ( KDirectory* ) dir;
-    col -> md5 = md5;
-    rc = KMD5SumFmtAddRef ( md5 );
-    KRefcountInit ( & col -> refcount, 1, "KColumn", "make", path );
-    col -> opencount = 1;
-    col -> commit_freq = 1;
-    col -> read_only = read_only;
-
-    strcpy ( col -> path, path );
-
-    col->sym.u.obj = col;
-    StringInitCString (&col->sym.name, col->path);
-    col->sym.type = kptColumn;
-
-    * colp = col;
-    return rc;
-}
-
-
-static
-rc_t KDBManagerInsertColumn ( KDBManager * self, KColumn * col )
-{
-    rc_t rc;
-    rc = KDBManagerOpenObjectAdd (self, &col->sym);
-    if ( rc == 0 )
-        col -> mgr = KDBManagerAttach ( self );
-    return rc;
-}
-
-
-static
-rc_t KColumnMakeRead ( KColumn **colp, const KDirectory *dir, const char *path,
-		       KMD5SumFmt * md5 )
-{
-    rc_t rc = KColumnMake ( colp, dir, path, md5, true );
-    if ( rc == 0 )
-    {
-        size_t pgsize;
-        uint64_t data_eof;
-        KColumn *self = * colp;
-
-        rc = KColumnIdxOpenRead ( & self -> idx,
-            dir, & data_eof, & pgsize, & self -> checksum );
-        if ( rc == 0 )
-        {
-            rc = KColumnDataOpenRead ( & self -> df,
-				       dir, data_eof, pgsize );
-            if ( rc == 0 )
-            {
-                switch ( self -> checksum )
-                {
-                case kcsNone:
-                    break;
-                case kcsCRC32:
-                    self -> csbytes = 4;
-                    break;
-                case kcsMD5:
-                    self -> csbytes = 16;
-                    break;
-                }
-
-                self -> commit_freq = 0;
-                return 0;
-            }
-
-            KColumnIdxWhack ( & self -> idx,
-                data_eof, pgsize, self -> checksum );
-        }
-
-        free ( self );
-    }
-
-    * colp = NULL;
-    return rc;
-}
-
-static
-rc_t KColumnMakeUpdate ( KColumn **colp,
-    KDirectory *dir, const char *path, KMD5SumFmt *md5 )
-{
-    rc_t rc = KColumnMake ( colp, dir, path, md5, false );
-    if ( rc == 0 )
-    {
-        size_t pgsize;
-        uint64_t data_eof;
-        KColumn *self = * colp;
-
-        rc = KColumnIdxOpenUpdate ( & self -> idx, dir,
-            md5, & data_eof, & pgsize, & self -> checksum );
-        if ( rc == 0 )
-        {
-            rc = KColumnDataOpenUpdate ( & self -> df, dir,
-                md5, data_eof, pgsize );
-            if ( rc == 0 )
-            {
-                switch ( self -> checksum )
-                {
-                case kcsNone:
-                    break;
-                case kcsCRC32:
-                    self -> csbytes = 4;
-                    break;
-                case kcsMD5:
-                    self -> csbytes = 16;
-                    break;
-                }
-
-                return 0;
-            }
-
-            /* why is this here? */
-            KColumnDataWhack ( & self -> df );
-
-            KColumnIdxWhack ( & self -> idx,
-                data_eof, pgsize, self -> checksum );
-        }
-
-        free ( self );
-    }
-
-    * colp = NULL;
-    return rc;
-}
-
-
-/* Create
- * VCreate
- *  create a new or open an existing column
- *
- *  "colp" [ OUT ] - return parameter for newly opened database
- *
- *  "cmode" [ IN ] - creation mode
- *
- *  "path" [ IN ] - NUL terminated string in
- *  wd-native character set giving path to database
- */
-static
-rc_t KColumnCreate ( KColumn **colp, KDirectory *dir,
-    KCreateMode cmode, KChecksum checksum,
-	size_t pgsize, const char *path, KMD5SumFmt *md5 )
-{
-    rc_t rc;
-
-    /* only supporting pgsize of 1 */
-    if ( pgsize == 0 )
-        pgsize = 1;
-    else if ( pgsize != 1 )
-        return RC ( rcDB, rcColumn, rcConstructing, rcParam, rcInvalid );
-
-    rc = KColumnMake ( colp, dir, path, md5, false );
-
-    if ( rc == 0 )
-    {
-        uint64_t data_eof;
-        KColumn *self = * colp;
-
-        self -> checksum = ( int32_t ) checksum;
-
-        rc = KColumnIdxCreate ( & self -> idx,
-            dir, md5, cmode, & data_eof, pgsize, ( int32_t ) checksum );
-        if ( rc == 0 )
-        {
-            rc = KColumnDataCreate ( & self -> df,
-                dir, md5, cmode, data_eof, pgsize );
-            if ( rc == 0 )
-            {
-                switch ( self -> checksum )
-                {
-                case kcsNone:
-                    break;
-                case kcsCRC32:
-                    self -> csbytes = 4;
-                    break;
-                case kcsMD5:
-                    self -> csbytes = 16;
-                    break;
-                }
-
-                /* successful exit */
-                return 0;
-            }
-
-            /* close data ? redundant? my thoughts exactly */
-            KColumnDataWhack ( & self -> df );
-
-            KColumnIdxWhack ( & self -> idx,
-                data_eof, pgsize, self -> checksum );
-        }
-
-        free ( self );
-    }
-
-    * colp = NULL;
-    return rc;
-}
-
-rc_t KColumnFileCreate ( KFile **ppf,
-    KMD5File **ppfmd5, KDirectory *dir, KMD5SumFmt *md5,
-    KCreateMode mode, bool append, const char *name )
-{
-#if 1
-    rc_t rc;
-
-    KFile *pf = NULL;
-    * ppfmd5 = NULL;
-
-    rc = KDirectoryVCreateFile ( dir, & pf, true, 0664, mode, name, NULL );
-    if ( rc == 0 && md5 != NULL )
-    {
-        /* if the file was opened in "open" mode, leave its entry alone
-           if the file was opened in "init" mode, delete any existing entry
-           if the file was opened in "create" mode, it will fail if there
-           was an existing file, but still delete any digest entry */
-        if ( ( mode & kcmValueMask ) != kcmOpen )
-            rc = KMD5SumFmtDelete ( md5, name );
-        if ( rc == 0 || GetRCState ( rc ) == rcNotFound )
-        {
-            KMD5File *md5file;
-            rc = ( append ? KMD5FileMakeAppend : KMD5FileMakeWrite ) ( & md5file, pf, md5, name );
-            if ( rc == 0 )
-            {
-                * ppfmd5 = md5file;
-                pf = KMD5FileToKFile ( md5file );
-            }
-        }
-
-        if ( rc != 0 )
-        {
-            KFileRelease ( pf );
-            pf = NULL;
-        }
-    }
-
-    * ppf = pf;
-
-    return rc;
-#else
-
-    /* this looks like it needs some rethinking */
-    rc_t rc = 0;
-    KFile * pf;
-
-    *ppfmd5 = NULL;
-    *ppf = NULL;
-    /* -----
-     * This is used even when opening for update on some files
-     * so we have extra work
-     *
-     * If mode is kcmOpen try to open with normal open functions
-     * so the MD5 part gets handled correctly
-     */
-    rc = KColumnFileOpenUpdate (ppf, ppfmd5, dir, md5, append, name);
-    if (rc == 0)
-        return 0;
-
-    else if (GetRCState (rc) == rcNotFound)
-        rc = 0; /* this is not a true failure here so go on to create it */
-    if (rc == 0)
-    {
-        rc = KDirectoryVCreateFile (dir, &pf, true, 0664, mode, name, NULL);
-        if ((rc == 0) && (md5 != NULL))
-        {
-            rc = KMD5SumFmtDelete (md5, name);
-            if ((rc == 0) || (GetRCState (rc) == rcNotFound))
-            {
-                KMD5File * md5file;
-
-                rc = (append ? KMD5FileMakeAppend : KMD5FileMakeWrite)
-                    (&md5file, pf, md5, name);
-                if (rc == 0)
-                {
-                    *ppfmd5 = md5file;
-                    pf = KMD5FileToKFile (md5file);
-                }
-                else
-                {
-                    KFileRelease (pf);
-                    pf = NULL;
-                }
-            }
-        }
-    }
-    *ppf = pf;
-    return rc;
-#endif
-}
-
-rc_t KColumnFileOpenUpdate ( KFile **ppf, KMD5File **ppfmd5,
-    KDirectory *dir, KMD5SumFmt *md5, bool append, const char *name )
-{
-    rc_t rc;
-
-    KFile *pf = NULL;
-    * ppfmd5 = NULL;
-
-    rc = KDirectoryVOpenFileWrite ( dir, & pf, true, name, NULL );
-    if ( rc == 0 && md5 != NULL )
-    {
-        KMD5File *md5file;
-        rc = ( append ? KMD5FileMakeAppend : KMD5FileMakeWrite ) ( & md5file, pf, md5, name );
-        if ( rc != 0 )
-        {
-            KFileRelease ( pf );
-            pf = NULL;
-        }
-        else
-        {
-            * ppfmd5 = md5file;
-            pf = KMD5FileToKFile ( md5file );
-        }
-    }
-
-    * ppf = pf;
-
-    return rc;
-}
-
-
-/* CreateColumn
- * VCreateColumn
- *  create a new or open an existing column
- *
- *  "col" [ OUT ] - return parameter for newly opened column
- *
- *  "cmode" [ IN ] - creation mode
- *
- *  "checksum" [ IN ] - checksum mode
- *
- *  "pgsize" [ IN ] - size of internal column pages
- *
- *  "path" [ IN ] - NUL terminated string in UTF-8 giving path to col
- *  where "." acts as a structure name separator, i.e. struct.member
- */
-static
-rc_t KDBManagerVCreateColumnInt ( KDBManager *self,
-    KColumn **colp, KDirectory *wd, KCreateMode cmode,
-    KChecksum checksum, size_t pgsize, const char *path, va_list args )
-{
-    char colpath [ 4096 ];
-    rc_t rc = KDirectoryVResolvePath ( wd, true,
-        colpath, sizeof colpath, path, args );
-    if ( rc == 0 )
-    {
-        KDirectory *dir;
-
-        switch ( KDBPathType ( /*NULL,*/ wd, NULL, colpath ) )
-        {
-        case kptNotFound:
-            /* first good path */
-            break;
-
-        case kptBadPath:
-            return RC ( rcDB, rcMgr, rcCreating, rcPath, rcInvalid );
-        case kptColumn:
-        case kptColumn | kptAlias:
-            /* found so is not good if we want to create new and not
-             * clear/init or open old
-             */
-            if ( ( cmode & kcmValueMask ) == kcmCreate )
-                return RC ( rcDB, rcMgr, rcCreating, rcColumn, rcExists );
-            if (KDBManagerOpenObjectBusy (self, colpath))
-                return RC ( rcDB, rcMgr, rcCreating, rcColumn, rcBusy );
-            /* test now for locked directory */
-            rc = KDBWritable (wd, colpath);
-            if (rc)
-            {
-                switch (GetRCState(rc))
-                {
-                default:
-                    return rc;
-                case rcLocked:
-                    return RC ( rcDB, rcMgr, rcCreating, rcColumn, rcLocked );
-                case rcReadonly:
-                    return RC ( rcDB, rcMgr, rcCreating, rcColumn, rcReadonly );
-                case rcNotFound:
-                    /* not found is good but probably unreachable */
-                    break;
-                case 0:
-                    rc = 0;
-                    break;
-                }
-            }
-            /* second good path */
-            break;
-
-        case kptDatabase:
-        case kptDatabase | kptAlias:
-            return RC (rcDB, rcMgr, rcCreating, rcDatabase, rcExists);
-
-        case kptTable:
-        case kptTable | kptAlias:
-            return RC (rcDB, rcMgr, rcCreating, rcTable, rcExists);
-
-        case kptIndex:
-        case kptIndex | kptAlias:
-            return RC (rcDB, rcMgr, rcCreating, rcIndex, rcExists);
-
-        case kptMetadata:
-        case kptMetadata | kptAlias:
-            return RC (rcDB, rcMgr, rcCreating, rcMetadata, rcExists);
-
-	case kptFile:
-	case kptFile | kptAlias:
-	    /* if we find a file, vary the failure if it is an archive that is a column
-	     * or a non related file */
-	    if ( KDBOpenPathTypeRead ( self, wd, colpath, NULL, kptColumn, NULL, false ) == 0 )
-		return RC ( rcDB, rcMgr, rcCreating, rcDirectory, rcUnauthorized );
-	    /* fall through */
-        default:
-            return RC ( rcDB, rcMgr, rcCreating, rcPath, rcIncorrect );
-        }
-
-        /* [re]create directory */
-        rc = KDirectoryVCreateDir ( wd, 0775, cmode, colpath, NULL );
-        if ( rc != 0 )
-            return rc;
-
-        /* create column as a directory */
-        rc = KDirectoryVOpenDirUpdate ( wd, & dir, false, colpath, NULL );
-        if ( rc == 0 )
-        {
-            KColumn *col;
-            KMD5SumFmt *md5 = NULL;
-
-            /* create an MD5 digest file for column */
-            if ( KCOL_CURRENT_VERSION >= 3 && ( cmode & kcmMD5 ) != 0 )
-            {
-                KFile * f;
-                
-                /* create or open the md5 digest file */
-                rc = KDirectoryCreateFile ( wd, &f, true, 0664, kcmOpen, "%s/md5", colpath );
-                if ( rc == 0 )
-                {
-                    /* create a formatter around file
-                       formatter will own "f" afterward */
-                    rc = KMD5SumFmtMakeUpdate ( & md5, f );
-
-                    /* if failed to create formatter, release "f" */
-                    if ( rc != 0 )
-                        KFileRelease ( f );
-                }
-
-            }
-            
-            /* create column - will attach several references to "md5" */
-            if ( rc == 0 )
-                rc = KColumnCreate ( & col, dir, cmode, checksum, pgsize, colpath, md5 );
-
-            /* release our reference to "md5" if NULL then no problem */
-            if (md5)
-                KMD5SumFmtRelease ( md5 );
-
-            if ( rc == 0 )
-            {
-                rc = KDBManagerInsertColumn ( self, col );
-                if (rc == 0 )
-                {
-                    * colp = col;
-                    return 0;
-                }
-                
-                KColumnRelease ( col );                
-            }
-            KDirectoryRelease ( dir );
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC KDBManagerVCreateColumn ( KDBManager *self, KColumn **col,
-    KCreateMode cmode, KChecksum checksum, size_t pgsize,
-    const char *path, va_list args )
-{
-    if ( col == NULL )
-        return RC ( rcDB, rcMgr, rcCreating, rcParam, rcNull );
-
-    * col = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcMgr, rcCreating, rcSelf, rcNull );
-
-    return KDBManagerVCreateColumnInt
-        ( self, col, self -> wd, cmode, checksum, pgsize, path, args );
-}
-
-LIB_EXPORT rc_t CC KDBManagerCreateColumn ( KDBManager *self, KColumn **col,
-    KCreateMode cmode, KChecksum checksum, size_t pgsize, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDBManagerVCreateColumn ( self, col, cmode, checksum, pgsize, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC KTableCreateColumn ( KTable *self, KColumn **col,
-    KCreateMode cmode, KChecksum checksum, size_t pgsize, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KTableVCreateColumn ( self, col, cmode, checksum, pgsize, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KTableVCreateColumn ( KTable *self, KColumn **colp,
-    KCreateMode cmode, KChecksum checksum, size_t pgsize,
-    const char *name, va_list args )
-{
-    rc_t rc;
-    char path [ 256 ];
-
-    if ( colp == NULL )
-        return RC ( rcDB, rcTable, rcCreating, rcParam, rcNull );
-
-    * colp = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcTable, rcCreating, rcSelf, rcNull );
-
-    if ( self -> read_only )
-        return RC ( rcDB, rcTable, rcCreating, rcColumn, rcReadonly );
-
-    rc = KDBVMakeSubPath ( self -> dir,
-        path, sizeof path, "col", 3, name, args );
-    if ( rc == 0 )
-    {
-        /* set MD5 mode according to table */
-        if ( self -> use_md5 )
-            cmode |= kcmMD5;
-        else
-            cmode &= ~ kcmMD5;
-
-        rc = KDBManagerVCreateColumnInt ( self -> mgr, colp,
-            self -> dir, cmode | kcmParents, checksum, pgsize, path, NULL );
-        if ( rc == 0 )
-        {
-            KColumn *col = * colp;
-            col -> tbl = KTableAttach ( self );
-        }
-    }
-    return rc;
-}
-
-
-/* OpenColumnRead
- * VOpenColumnRead
- *  open a column for read
- *
- *  "col" [ OUT ] - return parameter for newly opened column
- *
- *  "path" [ IN ] - NUL terminated string in UTF-8 giving path to col
- *  where "." acts as a structure name separator, i.e. struct.member
- */
-static
-rc_t KDBManagerVOpenColumnReadInt ( const KDBManager *cself,
-    const KColumn **colp, const KDirectory *wd,
-    const char *path, va_list args, bool *cached, bool try_srapath )
-{
-    char colpath [ 4096 ];
-    rc_t rc = KDirectoryVResolvePath ( wd, true,
-        colpath, sizeof colpath, path, args );
-    if ( rc == 0 )
-    {
-        KSymbol *sym;
-
-        /* if already open */
-        sym = KDBManagerOpenObjectFind (cself, colpath);
-        if (sym != NULL)
-        {
-            const KColumn *ccol;
-            rc_t obj;
-
-            if(cached != NULL ) *cached = true;
-
-            switch (sym->type)
-            {
-            case kptColumn:
-                ccol = (const KColumn*)sym->u.obj;
-                /* if open for update, refuse */
-                if ( ccol -> read_only )
-                {
-                    /* attach a new reference and we're gone */
-                    rc = KColumnAddRef ( ccol );
-                    if ( rc == 0 )
-                        * colp = ccol;
-                    return rc;
-                }
-                obj = rcColumn;
-                break;
-            default:
-                obj = rcPath;
-                break;
-            case kptTable:
-                obj = rcTable;
-                break;
-            case kptDatabase:
-                obj = rcDatabase;
-                break;
-            case kptIndex:
-                obj = rcIndex;
-                break;
-            case kptMetadata:
-                obj = rcMetadata;
-                break;
-            }
-            rc = RC (rcDB, rcMgr, rcOpening, obj, rcBusy);
-        }
-        else
-        {
-            const KDirectory *dir;
-
-            if ( cached != NULL )
-                *cached = false;
-
-            rc = KDBOpenPathTypeRead ( cself, wd, path, &dir, kptColumn, NULL, try_srapath );
-
-            if ( rc == 0 )
-            { 
-                KColumn *col;
-
-                rc = KColumnMakeRead ( & col, dir, colpath, NULL );
-
-                if ( rc == 0 )
-                {
-                    rc = KDBManagerInsertColumn ( (KDBManager*)cself, col );
-                    if ( rc == 0 )
-                    {
-                        * colp = col;
-                        return 0;
-                    }
-
-                    KColumnRelease ( col );
-                }
-
-                KDirectoryRelease ( dir );
-            }
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDBManagerOpenColumnRead ( const KDBManager *self,
-    const KColumn **col, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDBManagerVOpenColumnRead ( self, col, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDBManagerVOpenColumnRead ( const KDBManager *self,
-    const KColumn **col, const char *path, va_list args )
-{
-    if ( col == NULL )
-        return RC ( rcDB, rcMgr, rcOpening, rcParam, rcNull );
-
-    * col = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcMgr, rcOpening, rcSelf, rcNull );
-
-    return KDBManagerVOpenColumnReadInt ( self, col, self -> wd, path, args , NULL, true);
-}
-
-LIB_EXPORT rc_t CC KTableOpenColumnRead ( const KTable *self,
-    const KColumn **col, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KTableVOpenColumnRead ( self, col, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KTableVOpenColumnRead ( const KTable *self,
-    const KColumn **colp, const char *name, va_list args )
-{
-    rc_t rc;
-    char path [ 256 ];
-
-    if ( colp == NULL )
-        return RC ( rcDB, rcTable, rcOpening, rcParam, rcNull );
-
-    * colp = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcTable, rcOpening, rcSelf, rcNull );
-
-    rc = KDBVMakeSubPath ( self -> dir,
-        path, sizeof path, "col", 3, name, args );
-    if ( rc == 0 )
-    {
-	bool col_is_cached;
-        rc = KDBManagerVOpenColumnReadInt ( self -> mgr,
-            colp, self -> dir, path, NULL, &col_is_cached, false );
-        if ( rc == 0 )
-        {
-            KColumn *col = ( KColumn* ) * colp;
-            if(!col_is_cached) col -> tbl = KTableAttach ( self );
-        }
-    }
-    return rc;
-}
-
-
-/* OpenColumnUpdate
- * VOpenColumnUpdate
- *  open a column for read/write
- *
- *  "col" [ OUT ] - return parameter for newly opened column
- *
- *  "path" [ IN ] - NUL terminated string in UTF-8 giving path to col
- *  where "." acts as a structure name separator, i.e. struct.member
- */
-static
-rc_t KDBManagerVOpenColumnUpdateInt ( KDBManager *self,
-    KColumn **colp, KDirectory *wd, bool try_srapath,
-    const char *path, va_list args )
-{
-    char colpath [ 4096 ];
-    rc_t rc;
-    size_t z;
-
-/*    rc = KDirectoryVResolvePath ( wd, 1,
-        colpath, sizeof colpath, path, args ); */
-    rc = string_vprintf( colpath, sizeof colpath, &z, path, args );
-    if ( rc == 0 )
-    {
-        KSymbol * sym;
-/*         KFile *f; */
-/*         KMD5SumFmt * md5 = NULL; */
-        KDirectory *dir;
-
-        /* if already open, refuse */
-        sym = KDBManagerOpenObjectFind (self, colpath);
-        if (sym != NULL)
-        {
-            rc_t obj;
-            switch (sym->type)
-            {
-            default:
-                obj = rcPath;
-                break;
-            case kptDatabase:
-                obj = rcDatabase;
-                break;
-            case kptTable:
-                obj = rcTable;
-                break;
-            case kptColumn:
-                obj = rcColumn;
-                break;
-            case kptIndex:
-                obj = rcIndex;
-                break;
-            case kptMetadata:
-                obj = rcMetadata;
-                break;
-            }
-            return RC ( rcDB, rcMgr, rcOpening, obj, rcBusy );
-        }
-        /* only open existing dbs */
-        switch (KDBPathType ( /*NULL,*/ wd, NULL, colpath ) )
-        {
-        case kptNotFound:
-            return RC ( rcDB, rcMgr, rcOpening, rcColumn, rcNotFound );
-        case kptBadPath:
-            return RC ( rcDB, rcMgr, rcOpening, rcPath, rcInvalid );
-	case kptFile:
-	case kptFile | kptAlias:
-	    /* if we find a file, vary the failure if it is an archive that is a table
-	     * or a non related file
-	     * this should be changed to a readonly as it is not possible not 
-	     * disallowed.  rcReadonly not rcUnauthorized
-	     */
-	    if ( KDBOpenPathTypeRead ( self, wd, colpath, NULL, kptColumn, NULL, try_srapath ) == 0 )
-		return RC ( rcDB, rcMgr, rcOpening, rcDirectory, rcUnauthorized );
-	    /* fall through */
-        default:
-            return RC ( rcDB, rcMgr, rcOpening, rcPath, rcIncorrect );
-        case kptColumn:
-        case kptColumn | kptAlias:
-            break;
-        }
-
-        /* test now for locked directory */
-        rc = KDBWritable (wd, colpath);
-        switch (GetRCState(rc))
-        {
-        default:
-            return RC ( rcDB, rcMgr, rcOpening, rcColumn, rcUnexpected );
-        case rcLocked:
-            return RC ( rcDB, rcMgr, rcOpening, rcColumn, rcLocked );
-        case rcReadonly:
-            return RC ( rcDB, rcMgr, rcOpening, rcColumn, rcReadonly );
-        case 0:
-            rc = 0;
-            break;
-        }
-
-
-        rc = KDirectoryVOpenDirUpdate ( wd, & dir, 0, colpath, NULL );
-        if ( rc == 0 )
-        {
-            KColumn *col;
-            KMD5SumFmt *md5 = NULL;
-            /* open existing md5 digest file */
-            KFile * f;
-            rc = KDirectoryVOpenFileWrite ( dir, & f, true, "md5", NULL );
-            if ( rc == 0 )
-            {
-                rc = KMD5SumFmtMakeUpdate ( &md5, f );
-                if ( rc != 0 )
-                    KFileRelease ( f );
-            }
-            else if ( GetRCState ( rc ) == rcNotFound )
-                rc = 0;
-
-            /* make column - will attach several references to "md5" */
-            if ( rc == 0 )
-                rc = KColumnMakeUpdate ( & col, dir, colpath, md5 );
-
-            /* release our reference to "md5" */
-            KMD5SumFmtRelease ( md5 );
-
-            if ( rc == 0 )
-            {
-                rc = KDBManagerInsertColumn ( self, col );
-                if ( rc == 0 )
-                {
-                    * colp = col;
-                    return 0;
-                }
-                
-                KColumnRelease ( col );                
-            }
-            KDirectoryRelease ( dir );
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDBManagerOpenColumnUpdate ( KDBManager *self,
-    KColumn **col, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDBManagerVOpenColumnUpdate ( self, col, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDBManagerVOpenColumnUpdate ( KDBManager *self,
-    KColumn **col, const char *path, va_list args )
-{
-    if ( col == NULL )
-        return RC ( rcDB, rcMgr, rcOpening, rcParam, rcNull );
-
-    * col = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcMgr, rcOpening, rcSelf, rcNull );
-
-    return KDBManagerVOpenColumnUpdateInt
-        ( self, col, self -> wd, true, path, args );
-}
-
-LIB_EXPORT rc_t CC KTableOpenColumnUpdate ( KTable *self,
-    KColumn **col, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KTableVOpenColumnUpdate ( self, col, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KTableVOpenColumnUpdate ( KTable *self,
-    KColumn **colp, const char *name, va_list args )
-{
-    rc_t rc;
-    char path [ 256 ];
-
-    if ( colp == NULL )
-        return RC ( rcDB, rcTable, rcOpening, rcParam, rcNull );
-
-    * colp = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcTable, rcOpening, rcSelf, rcNull );
-
-    if ( self -> read_only )
-        return RC ( rcDB, rcTable, rcOpening, rcColumn, rcReadonly );
-
-    rc = KDBVMakeSubPath ( self -> dir,
-        path, sizeof path, "col", 3, name, args );
-    if ( rc == 0 )
-    {
-        rc = KDBManagerVOpenColumnUpdateInt ( self -> mgr,
-            colp, self -> dir, false, path, NULL );
-        if ( rc == 0 )
-        {
-            KColumn *col = * colp;
-            col -> tbl = KTableAttach ( self );
-        }
-    }
-    return rc;
-}
-
-bool KTableColumnNeedsReindex ( KTable *self, const char *colname )
-{
-    if ( self != NULL )
-    {
-        char path [ 256 ];
-        rc_t rc = KDBMakeSubPath ( self -> dir,
-            path, sizeof path, "col", 3, colname );
-        if ( rc == 0 )
-        {
-            uint64_t idx0_size;
-            rc = KDirectoryFileSize ( self -> dir, & idx0_size, "%s/idx0", path );
-            if ( rc == 0 && idx0_size > 0 )
-                return true;
-        }
-    }
-
-    return false;
-}
-
-
-/* Locked
- *  returns non-zero if locked
- */
-LIB_EXPORT bool CC KColumnLocked ( const KColumn *self )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        return false;
-
-    rc = KDBWritable ( self -> dir, "." );
-    return GetRCState ( rc ) == rcLocked;
-}
-
-
-/* Writable
- *  returns 0 if object is writable
- *  or a reason why if not
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptMetadata and kptIndex
- *
- *  "path" [ IN ] - NUL terminated path
- */
-static
-rc_t KColumnLockInt (const KColumn  * self, char * path, size_t path_size,
-                        int type, const char * name, va_list args )
-{
-    rc_t rc;
-
-    if (self == NULL)
-        rc = RC ( rcDB, rcMgr, rcAccessing, rcSelf, rcNull );
-
-    else if (name == NULL)
-        rc =  RC (rcDB, rcMgr, rcAccessing, rcPath, rcNull);
-
-    else
-    {
-        const char * ns;
-        char path [ 256 ];
-
-        ns = KDBGetNamespaceString (type);
-
-        switch (type)
-        {
-        default:
-            rc = RC (rcDB, rcMgr, rcAccessing, rcParam, rcInvalid);
-            break;
-        case kptIndex:
-        case kptMetadata:
-/*         case kptIndex: */
-            rc = KDBVMakeSubPath (self->dir, path, sizeof path, ns, strlen (ns),
-                                  name, args);
-            break;
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KColumnVWritable ( const KColumn *self, uint32_t type, const char *name, va_list args )
-{
-    rc_t rc;
-    char path [ 256 ];
-
-    rc = KColumnLockInt (self, path, sizeof path, type, name, args);
-    if (rc == 0)
-        rc = KDBWritable (self->dir, path);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KColumnWritable ( const KColumn *self, uint32_t type, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = KColumnVWritable ( self, type, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* Lock
- *  apply lock
- *
- *  if object is already locked, the operation is idempotent
- *  and returns an rc state of rcLocked
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptMetadata and kptIndex
- *
- *  "path" [ IN ] - NUL terminated path
- */
-LIB_EXPORT rc_t CC KColumnVLock ( KColumn *self, uint32_t type, const char *name, va_list args )
-{
-    rc_t rc = 0;
-    char path [ 256 ];
-
-    rc = KColumnLockInt (self, path, sizeof path, type, name, args);
-    if (rc == 0)
-        rc = KDBLockDir (self->dir, path);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KColumnLock ( KColumn *self, uint32_t type, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = KColumnVLock (self, type, name, args);
-    va_end (args);
-    return rc;
-}
-
-
-/* Unlock
- *  remove lock
- *
- *  if object is already unlocked, the operation is idempotent
- *  and returns an rc state of rcUnlocked
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptMetadata and kptIndex
- *
- *  "path" [ IN ] - NUL terminated path
- */
-LIB_EXPORT rc_t CC KColumnVUnlock ( KColumn *self, uint32_t type, const char *name, va_list args )
-{
-    rc_t rc = 0;
-    char path [ 256 ];
-
-    rc = KColumnLockInt (self, path, sizeof path, type, name, args);
-    if (rc == 0)
-        rc = KDBUnlockDir (self->dir, path);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KColumnUnlock ( KColumn *self, uint32_t type, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-    va_start ( args, name );
-    rc = KColumnVUnlock (self, type, name, args);
-    va_end (args);
-    return rc;
-}
-
-
-/* Version
- *  returns the column format version
- */
-LIB_EXPORT rc_t CC KColumnVersion ( const KColumn *self, uint32_t *version )
-{
-    if ( version == NULL )
-        return RC ( rcDB, rcColumn, rcAccessing, rcParam, rcNull );
-    if ( self == NULL )
-        return RC ( rcDB, rcColumn, rcAccessing, rcSelf, rcNull );
-    return KColumnIdxVersion ( & self -> idx, version );
-}
-
-/* ByteOrder
- *  indicates whether original byte order is reversed
- *  under current architecture.
- *
- *  the byte order of the column is established by
- *  the host architecture when created.
- *
- *  "reversed" [ OUT ] - if true, the original byte
- *  order is reversed with regard to host native byte order.
- */
-LIB_EXPORT rc_t CC KColumnByteOrder ( const KColumn *self, bool *reversed )
-{
-    if ( reversed == NULL )
-        return RC ( rcDB, rcColumn, rcAccessing, rcParam, rcNull );
-
-    if ( self == NULL )
-    {
-        * reversed = false;
-        return RC ( rcDB, rcColumn, rcAccessing, rcSelf, rcNull );
-    }
-     
-    return KColumnIdxByteOrder ( & self -> idx, reversed );
-}
-
-/* IdRange
- *  returns id range for column
- */
-LIB_EXPORT rc_t CC KColumnIdRange ( const KColumn *self, int64_t *first, uint64_t *count )
-{
-    rc_t rc;
-    int64_t dummy, last;
-
-    if ( first == NULL && count == NULL )
-        return RC ( rcDB, rcColumn, rcAccessing, rcParam, rcNull );
-
-    if ( first == NULL )
-        first = & dummy;
-    else if ( count == NULL )
-        count = ( uint64_t * ) & dummy;
-
-    if ( self == NULL )
-    {
-        * first = 0;
-        * count = 0;
-        return RC ( rcDB, rcColumn, rcAccessing, rcSelf, rcNull );
-    }
-
-    rc = KColumnIdxIdRange ( & self -> idx, first, & last );
-    if ( rc != 0 )
-        * count = 0;
-    else
-        * count = last - * first + 1;
-
-    return rc;
-}
-
-
-/* Reindex
- *  optimize indices
- */
-LIB_EXPORT rc_t CC KColumnReindex ( KColumn *self )
-{
-    if ( self == NULL )
-        return RC ( rcDB, rcColumn, rcReindexing, rcSelf, rcNull );
-    if ( self -> read_only )
-        return RC ( rcDB, rcColumn, rcReindexing, rcColumn, rcReadonly );
-    return KColumnIdxReindex ( & self -> idx, self -> md5, self -> commit_freq,
-        self -> df . eof, self -> df . pgsize, self -> checksum );
-}
-
-
-/* CommitFreq
- * SetCommitFreq
- *  manage frequency of commits
- */
-LIB_EXPORT rc_t CC KColumnCommitFreq ( KColumn *self, uint32_t *freq )
-{
-    if ( freq == NULL )
-        return RC ( rcDB, rcColumn, rcAccessing, rcParam, rcNull );
-
-    if ( self == NULL )
-    {
-        * freq = 0;
-        return RC ( rcDB, rcColumn, rcAccessing, rcSelf, rcNull );
-    }
-
-    * freq = self -> commit_freq;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KColumnSetCommitFreq ( KColumn *self, uint32_t freq )
-{
-    if ( self == NULL )
-        return RC ( rcDB, rcColumn, rcUpdating, rcSelf, rcNull );
-
-    if ( self -> read_only )
-        return RC ( rcDB, rcColumn, rcUpdating, rcColumn, rcReadonly );
-
-    self -> commit_freq = freq;
-    return 0;
-}
-
-
-/* OpenManager
- *  duplicate reference to manager
- *  NB - returned reference must be released
- */
-LIB_EXPORT rc_t CC KColumnOpenManagerRead ( const KColumn *self, const KDBManager **mgr )
-{
-    rc_t rc;
-
-    if ( mgr == NULL )
-        rc = RC ( rcDB, rcColumn, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcColumn, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = KDBManagerAddRef ( self -> mgr );
-            if ( rc == 0 )
-            {
-                * mgr = self -> mgr;
-                return 0;
-            }
-        }
-
-        * mgr = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KColumnOpenManagerUpdate ( KColumn *self, KDBManager **mgr )
-{
-    rc_t rc;
-
-    if ( mgr == NULL )
-        rc = RC ( rcDB, rcColumn, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcColumn, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = KDBManagerAddRef ( self -> mgr );
-            if ( rc == 0 )
-            {
-                * mgr = self -> mgr;
-                return 0;
-            }
-        }
-
-        * mgr = NULL;
-    }
-
-    return rc;
-}
-
-
-/* OpenParent
- *  duplicate reference to parent table
- *  NB - returned reference must be released
- */
-LIB_EXPORT rc_t CC KColumnOpenParentRead ( const KColumn *self, const KTable **tbl )
-{
-    rc_t rc;
-
-    if ( tbl == NULL )
-        rc = RC ( rcDB, rcColumn, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcColumn, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = KTableAddRef ( self -> tbl );
-            if ( rc == 0 )
-            {
-                * tbl = self -> tbl;
-                return 0;
-            }
-        }
-
-        * tbl = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KColumnOpenParentUpdate ( KColumn *self, KTable **tbl )
-{
-    rc_t rc;
-
-    if ( tbl == NULL )
-        rc = RC ( rcDB, rcColumn, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcColumn, rcAccessing, rcSelf, rcNull );
-        else if ( self -> tbl != NULL && self -> tbl -> read_only )
-            rc = RC ( rcDB, rcColumn, rcAccessing, rcTable, rcReadonly );
-        else
-        {
-            rc = KTableAddRef ( self -> tbl );
-            if ( rc == 0 )
-            {
-                * tbl = self -> tbl;
-                return 0;
-            }
-        }
-
-        * tbl = NULL;
-    }
-
-    return rc;
-}
-
-/* OpenDirectory
- *  duplicate reference to the directory in use
- *  NB - returned reference must be released
- */
-LIB_EXPORT rc_t CC KColumnOpenDirectoryRead ( const KColumn *self, const KDirectory **dir )
-{
-    rc_t rc;
-
-    if ( dir == NULL )
-        rc = RC ( rcDB, rcColumn, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcColumn, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = KDirectoryAddRef ( self -> dir );
-            if ( rc == 0 )
-            {
-                * dir = self -> dir;
-                return 0;
-            }
-        }
-
-        * dir = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KColumnOpenDirectoryUpdate ( KColumn *self, KDirectory **dir )
-{
-    rc_t rc;
-
-    if ( dir == NULL )
-        rc = RC ( rcDB, rcColumn, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcColumn, rcAccessing, rcSelf, rcNull );
-        else if ( self -> dir != NULL && self -> dir -> read_only )
-            rc = RC ( rcDB, rcColumn, rcAccessing, rcDirectory, rcReadonly );
-        else
-        {
-            rc = KDirectoryAddRef ( self -> dir );
-            if ( rc == 0 )
-            {
-                * dir = self -> dir;
-                return 0;
-            }
-        }
-
-        * dir = NULL;
-    }
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * KColumnBlob
- *  one or more rows of column data
- */
-struct KColumnBlob
-{
-    /* holds either an existing blob loc
-       or new blob index range */
-    KColBlobLoc loc;
-
-    /* holds old and new page maps */
-    KColumnPageMap pmorig;
-    KColumnPageMap pmnew;
-
-    /* owning column */
-    KColumn *col;
-
-    /* refcount */
-    atomic32_t refcount;
-
-    /* number of bytes written to blob */
-    uint32_t num_writ;
-
-    /* checksums */
-    uint32_t crc32;
-    MD5State md5;
-
-    /* open mode */
-    uint8_t read_only;
-
-    /* for validation */
-    bool bswap;
-};
-
-
-/* Whack
- */
-static
-rc_t KColumnBlobWhack ( KColumnBlob *self )
-{
-    KColumn *col = self -> col;
-    assert ( col != NULL );
-
-    KColumnPageMapWhack ( & self -> pmorig, & col -> df );
-    if ( ! self -> read_only )
-        KColumnPageMapWhack ( & self -> pmnew, & col -> df );
-
-    /* cannot recover from errors here,
-       since the page maps needed whacking first,
-       and the column is needed for that. */
-    KColumnSever ( col );
-
-    free ( self );
-    return 0;
-}
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-LIB_EXPORT rc_t CC KColumnBlobAddRef ( const KColumnBlob *cself )
-{
-    if ( cself != NULL )
-    {
-        atomic32_inc ( & ( ( KColumnBlob* ) cself ) -> refcount );
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KColumnBlobRelease ( const KColumnBlob *cself )
-{
-    KColumnBlob *self = ( KColumnBlob* ) cself;
-    if ( cself != NULL )
-    {
-        if ( atomic32_dec_and_test ( & self -> refcount ) )
-            return KColumnBlobWhack ( self );
-    }
-    return 0;
-}
-
-/* OpenRead
- * OpenUpdate
- */
-static
-rc_t KColumnBlobOpenRead ( KColumnBlob *self, const KColumn *col, int64_t id )
-{
-    /* locate blob */
-    rc_t rc = KColumnIdxLocateBlob ( & col -> idx, & self -> loc, id, id );
-    if ( rc == 0 )
-    {
-        /* indicates not written */
-        /*assert ( self -> num_writ == 0 );*/
-
-        /* open page map to blob */
-        rc = KColumnPageMapOpen ( & self -> pmorig,
-            ( KColumnData* ) & col -> df, self -> loc . pg, self -> loc . u . blob . size );
-        if ( rc == 0 )
-        {
-            /* existing blob must have proper checksum bytes */
-            if ( self -> loc . u . blob . size >= col -> csbytes )
-            {
-                /* remove them from apparent blob size */
-                self -> loc . u . blob . size -= col -> csbytes;
-                return 0;
-            }
-
-            /* the blob is corrupt */
-            KColumnPageMapWhack ( & self -> pmorig, & col -> df );
-            rc = RC ( rcDB, rcBlob, rcOpening, rcBlob, rcCorrupt );
-        }
-    }
-
-    return rc;
-}
-
-static
-rc_t KColumnBlobOpenUpdate ( KColumnBlob *self, KColumn *col, int64_t id )
-{
-    /* open existing blob */
-    rc_t rc = KColumnBlobOpenRead ( self, col, id );
-    if ( rc == 0 )
-    {
-        /* create a new page map for replacement */
-        rc = KColumnPageMapCreate ( & self -> pmnew, & col -> df );
-        if ( rc == 0 )
-        {
-            /* initialize for writing checksums */
-            switch ( col -> checksum )
-            {
-            case kcsCRC32:
-                self -> crc32 = 0;
-                break;
-            case kcsMD5:
-                MD5StateInit ( & self -> md5 );
-                break;
-            }
-        }
-
-        /* tear down results of opening for read */
-        KColumnPageMapWhack ( & self -> pmorig, & col -> df );
-    }
-
-    return rc;
-}
-
-/* Create
- */
-static
-rc_t KColumnBlobCreate ( KColumnBlob *self, KColumn *col )
-{
-    rc_t rc;
-
-    if ( col -> md5 != NULL )
-    {
-	/* this perhaps should be split into wcoldat.c and wcolidx.c */
-	rc = KMD5FileBeginTransaction ( col -> df . fmd5 );
-	if ( rc == 0 )
-	{
-	    rc = KMD5FileBeginTransaction ( col -> idx . idx2 . fmd5 );
-	    if ( rc == 0 )
-	    {
-		rc = KMD5FileBeginTransaction ( col -> idx . idx0 . fmd5 );
-		if ( rc == 0 )
-		{
-		    rc = KMD5FileBeginTransaction ( col -> idx . idx1 . fmd5 );
-		    if ( rc == 0 )
-		    {
-			rc = KMD5FileBeginTransaction ( col -> idx . idx1 . fidxmd5 );
-			if ( rc != 0 )
-			    KMD5FileCommit ( col -> idx . idx1 .  fmd5 );
-		    }
-		    if ( rc != 0 )
-			KMD5FileCommit ( col -> idx . idx0 .  fmd5 );
-		}
-		if ( rc != 0 )
-		    KMD5FileCommit ( col -> idx . idx2 .  fmd5 );
-	    }
-	    if ( rc != 0 )
-		KMD5FileCommit ( col -> df . fmd5 );
-	}
-	if ( rc != 0 )
-	    return rc;
-    }
-
-    /* no location yet */
-    memset ( & self -> loc, 0, sizeof self -> loc );
-
-    /* invalid existing page map */
-    memset ( & self -> pmorig, 0, sizeof self -> pmorig );
-
-    /* create a new page map */
-    rc = KColumnPageMapCreate ( & self -> pmnew, & col -> df );
-    if ( rc == 0 )
-    {
-        /* initialize for writing checksums */
-        switch ( col -> checksum )
-        {
-        case kcsCRC32:
-            self -> crc32 = 0;
-            break;
-        case kcsMD5:
-            MD5StateInit ( & self -> md5 );
-            break;
-        }
-    }
-
-    return rc;
-}
-
-/* Make
- */
-static
-rc_t KColumnBlobMake ( KColumnBlob **blobp, bool bswap )
-{
-    KColumnBlob *blob = malloc ( sizeof * blob );
-    if ( blob == NULL )
-        return RC ( rcDB, rcBlob, rcConstructing, rcMemory, rcExhausted );
-
-    memset ( blob, 0, sizeof * blob );
-    atomic32_set ( & blob -> refcount, 1 );
-    blob -> bswap = bswap;
-
-    * blobp = blob;
-    return 0;
-}
-
-/* OpenBlobRead
- * OpenBlobUpdate
- *  opens an existing blob containing row data for id
- */
-LIB_EXPORT rc_t CC KColumnOpenBlobRead ( const KColumn *self, const KColumnBlob **blobp, int64_t id )
-{
-    rc_t rc;
-    KColumnBlob *blob;
-
-    if ( blobp == NULL )
-        return RC ( rcDB, rcColumn, rcOpening, rcParam, rcNull );
-    * blobp = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcColumn, rcOpening, rcSelf, rcNull );
-
-    rc = KColumnBlobMake ( & blob, self -> idx . idx1 . bswap );
-    if ( rc == 0 )
-    {
-        rc = KColumnBlobOpenRead ( blob, self, id );
-        if ( rc == 0 )
-        {
-            blob -> col = KColumnAttach ( self );
-            blob -> read_only = true;
-            * blobp = blob;
-            return 0;
-        }
-        
-        free ( blob );
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KColumnOpenBlobUpdate ( KColumn *self, KColumnBlob **blobp, int64_t id )
-{
-    rc_t rc;
-
-    if ( blobp == NULL )
-        return RC ( rcDB, rcColumn, rcOpening, rcParam, rcNull );
-    * blobp = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcColumn, rcOpening, rcSelf, rcNull );
-    if ( self -> read_only )
-        return RC ( rcDB, rcColumn, rcOpening, rcColumn, rcReadonly );
-
-    rc = KColumnBlobMake ( blobp, self -> idx . idx1 . bswap );
-    if ( rc == 0 )
-    {
-        KColumnBlob *blob = * blobp;
-        rc = KColumnBlobOpenUpdate ( blob, self, id );
-        if ( rc == 0 )
-        {
-            blob -> col = KColumnAttach ( self );
-            * blobp = blob;
-            return 0;
-        }
-                    
-        free ( blob );
-    }
-
-    return rc;
-}
-
-/* CreateBlob
- *  creates a new, unassigned blob
- */
-LIB_EXPORT rc_t CC KColumnCreateBlob ( KColumn *self, KColumnBlob **blobp )
-{
-    rc_t rc;
-
-    if ( blobp == NULL )
-        return RC ( rcDB, rcColumn, rcOpening, rcParam, rcNull );
-    * blobp = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcColumn, rcOpening, rcSelf, rcNull );
-    if ( self -> read_only )
-        return RC ( rcDB, rcColumn, rcOpening, rcColumn, rcReadonly );
-
-    rc = KColumnBlobMake ( blobp, self -> idx . idx1 . bswap );
-    if ( rc == 0 )
-    {
-        KColumnBlob *blob = * blobp;
-        rc = KColumnBlobCreate ( blob, self );
-        if ( rc == 0 )
-        {
-            blob -> col = KColumnAttach ( self );
-            * blobp = blob;
-            return 0;
-        }
-                    
-        free ( blob );
-    }
-
-    return rc;
-}
-
-/* IdRange
- *  returns id range for blob
- *
- *  "first" [ OUT, NULL OKAY ] - optional return parameter for first id
- *
- *  "last" [ OUT, NULL OKAY ] - optional return parameter for last id
- */
-LIB_EXPORT rc_t CC KColumnBlobIdRange ( const KColumnBlob *self, int64_t *first, uint32_t *count )
-{
-    rc_t rc;
-
-    if ( first == NULL || count == NULL )
-        rc = RC ( rcDB, rcBlob, rcAccessing, rcParam, rcNull );
-    else if ( self == NULL )
-        rc = RC ( rcDB, rcBlob, rcAccessing, rcSelf, rcNull );
-    else if ( self -> loc . id_range == 0 )
-        rc = RC ( rcDB, rcBlob, rcAccessing, rcRange, rcEmpty );
-    else
-    {
-        * first = self -> loc . start_id;
-        * count = self -> loc . id_range;
-        return 0;
-    }
-
-    if ( first != NULL )
-        * first = 0;
-    if ( count != NULL )
-        * count = 0;
-
-    return rc;
-}
-
-/* KColumnBlobValidate
- *  runs checksum validation on unmodified blob
- */
-static
-rc_t KColumnBlobValidateCRC32 ( const KColumnBlob *self )
-{
-    rc_t rc;
-    const KColumn *col = self -> col;
-
-    uint8_t buffer [ 1024 ];
-    size_t to_read, num_read, total, size;
-
-    uint32_t cs, crc32 = 0;
-
-    /* calculate checksum */
-    for ( size = self -> loc . u . blob. size, total = 0; total < size; total += num_read )
-    {
-        to_read = size - total;
-        if ( to_read > sizeof buffer )
-            to_read = sizeof buffer;
-
-        rc = KColumnDataRead ( & col -> df,
-            & self -> pmorig, total, buffer, to_read, & num_read );
-        if ( rc != 0 )
-            return rc;
-        if ( num_read == 0 )
-            return RC ( rcDB, rcBlob, rcValidating, rcTransfer, rcIncomplete );
-
-        crc32 = CRC32 ( crc32, buffer, num_read );
-    }
-
-    /* read stored checksum */
-    rc = KColumnDataRead ( & col -> df,
-        & self -> pmorig, size, & cs, sizeof cs, & num_read );
-    if ( rc != 0 )
-        return rc;
-    if ( num_read != sizeof cs )
-        return RC ( rcDB, rcBlob, rcValidating, rcTransfer, rcIncomplete );
-
-    if ( self -> bswap )
-        cs = bswap_32 ( cs );
-
-    if ( cs != crc32 )
-        return RC ( rcDB, rcBlob, rcValidating, rcBlob, rcCorrupt );
-
-    return 0;
-}
-
-static
-rc_t KColumnBlobValidateMD5 ( const KColumnBlob *self )
-{
-    rc_t rc;
-    const KColumn *col = self -> col;
-
-    uint8_t buffer [ 1024 ];
-    size_t to_read, num_read, total, size;
-
-    MD5State md5;
-    uint8_t digest [ 16 ];
-
-    MD5StateInit ( & md5 );
-
-    /* calculate checksum */
-    for ( size = self -> loc . u . blob . size, total = 0; total < size; total += num_read )
-    {
-        to_read = size - total;
-        if ( to_read > sizeof buffer )
-            to_read = sizeof buffer;
-
-        rc = KColumnDataRead ( & col -> df,
-            & self -> pmorig, total, buffer, to_read, & num_read );
-        if ( rc != 0 )
-            return rc;
-        if ( num_read == 0 )
-            return RC ( rcDB, rcBlob, rcValidating, rcTransfer, rcIncomplete );
-
-        MD5StateAppend ( & md5, buffer, num_read );
-    }
-
-    /* read stored checksum */
-    rc = KColumnDataRead ( & col -> df,
-        & self -> pmorig, size, buffer, sizeof digest, & num_read );
-    if ( rc != 0 )
-        return rc;
-    if ( num_read != sizeof digest )
-        return RC ( rcDB, rcBlob, rcValidating, rcTransfer, rcIncomplete );
-
-    /* finish MD5 digest */
-    MD5StateFinish ( & md5, digest );
-
-    if ( memcmp ( buffer, digest, sizeof digest ) != 0 )
-        return RC ( rcDB, rcBlob, rcValidating, rcBlob, rcCorrupt );
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KColumnBlobValidate ( const KColumnBlob *self )
-{
-    if ( self == NULL )
-        return RC ( rcDB, rcBlob, rcValidating, rcSelf, rcNull );
-
-    if ( self -> num_writ != 0 )
-        return RC ( rcDB, rcBlob, rcValidating, rcBlob, rcBusy );
-
-    if ( self -> loc . u . blob . size != 0 ) switch ( self -> col -> checksum )
-    {
-    case kcsCRC32:
-        return KColumnBlobValidateCRC32 ( self );
-    case kcsMD5:
-        return KColumnBlobValidateMD5 ( self );
-    }
-
-    return 0;
-}
-
-/* KColumnBlobRead
- *  read data from blob
- *
- *  "offset" [ IN ] - starting offset into blob
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT ] - number of bytes actually read
- *
- *  "remaining" [ OUT, NULL OKAY ] - optional return parameter for
- *  the number of bytes remaining to be read. specifically,
- *  "offset" + "num_read" + "remaining" == sizeof blob
- */
-LIB_EXPORT rc_t CC KColumnBlobRead ( const KColumnBlob *self,
-    size_t offset, void *buffer, size_t bsize,
-    size_t *num_read, size_t *remaining )
-{
-    rc_t rc;
-    const KColumnPageMap *pm;
-
-    size_t ignore;
-    if ( remaining == NULL )
-        remaining = & ignore;
-
-    if ( num_read == NULL )
-        rc = RC ( rcDB, rcBlob, rcReading, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcBlob, rcReading, rcSelf, rcNull );
-        else
-        {
-            size_t size = self -> num_writ;
-            const KColumn *col = self -> col;
-
-            if ( size != 0 )
-                pm = & self -> pmnew;
-            else
-            {
-                pm = & self -> pmorig;
-                size = self -> loc . u . blob . size;
-            }
-
-            if ( offset > size )
-                offset = size;
-
-            if ( bsize == 0 )
-                rc = 0;
-            else if ( buffer == NULL )
-                rc = RC ( rcDB, rcBlob, rcReading, rcBuffer, rcNull );
-            else
-            {
-                size_t to_read = size - offset;
-                if ( to_read > bsize )
-                    to_read = bsize;
-                rc = KColumnDataRead ( & col -> df,
-                    pm, offset, buffer, to_read, num_read );
-                if ( rc == 0 )
-                {
-                    * remaining = size - offset - * num_read;
-                    return 0;
-                }
-            }
-
-            * remaining = size - offset;
-            * num_read = 0;
-            return rc;
-        }
-
-        * num_read = 0;
-    }
-
-    * remaining = 0;
-    return rc;
-}
-
-/* KColumnBlobAppend
- *  append data to open blob
- *
- *  "buffer" [ IN ] and "size" [ IN ] - blob data
- */
-LIB_EXPORT rc_t CC KColumnBlobAppend ( KColumnBlob *self, const void *buffer, size_t size )
-{
-    KColumn *col;
-    size_t total, num_writ;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcBlob, rcWriting, rcSelf, rcNull );
-
-    /* data fork will refuse write anyway, but... */
-    if ( self -> read_only )
-        return RC ( rcDB, rcBlob, rcWriting, rcBlob, rcReadonly );
-
-    col = self -> col;
-
-    for ( total = 0; total < size; total += num_writ )
-    {
-        rc_t rc = KColumnDataWrite ( & col -> df,
-            & self -> pmnew, self -> num_writ + total,
-            ( const char* ) buffer + total, size - total, & num_writ );
-        if ( rc != 0 )
-            return rc;
-        if ( num_writ == 0 )
-            return RC ( rcDB, rcBlob, rcWriting, rcTransfer, rcIncomplete );
-    }
-
-    self -> num_writ += size;
-
-    switch ( col -> checksum )
-    {
-    case kcsCRC32:
-        self -> crc32 = CRC32 ( self -> crc32, buffer, size );
-        break;
-    case kcsMD5:
-        MD5StateAppend ( & self -> md5, buffer, size );
-        break;
-    }
-    
-    return 0;
-}
-
-/* KColumnBlobAssignRange
- *  assign a total id range to blob at any time before commit
- *
- *  "first" [ IN ] and "count" [ IN ] - range parameters for assign
- */
-LIB_EXPORT rc_t CC KColumnBlobAssignRange ( KColumnBlob *self, int64_t first, uint32_t count )
-{
-    rc_t rc;
-    const KColumn *col;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcBlob, rcUpdating, rcSelf, rcNull );
-
-    if ( count == 0 )
-        return RC ( rcDB, rcBlob, rcUpdating, rcRange, rcEmpty );
-
-    if ( self -> read_only )
-        return RC ( rcDB, rcBlob, rcUpdating, rcBlob, rcReadonly );
-
-    if ( self -> loc . id_range != 0 )
-    {
-        /* allow benign reassignment */
-        if ( self -> loc . start_id == first &&
-             self -> loc . id_range == count )
-            return 0;
-
-        /* can't be reset */
-        return RC ( rcDB, rcBlob, rcUpdating, rcBlob, rcBusy );
-    }
-
-    col = self -> col;
-
-    /* try to open read map */
-    rc = KColumnBlobOpenRead ( self, col, first );
-    if ( rc == 0 )
-    {
-        /* blob already exists
-           again, allow benign reassignment */                    
-        if ( self -> loc . start_id == first &&
-             self -> loc . id_range == count )
-            return 0;
-
-        /* conflicting assignment */
-        KColumnPageMapWhack ( & self -> pmorig, & col -> df );
-        memset ( & self -> loc, 0, sizeof self -> loc );
-        memset ( & self -> pmorig, 0, sizeof self -> pmorig );
-        return RC ( rcDB, rcBlob, rcUpdating, rcRange, rcIncorrect );
-    }
-
-    /* expect status of not found */
-    if ( GetRCState ( rc ) != rcNotFound )
-        return rc;
-
-    /* assign the range */
-    self -> loc . pg = 0;
-    self -> loc . u . blob . remove = 0;
-    self -> loc . start_id = first;
-    self -> loc . id_range = count;
-    return 0;
-}
-
-/* KColumnBlobCommit
- *  commit changes to blob
- *  close to further updates
- */
-static
-char zero [ 4096 ];
-
-static
-rc_t KColumnBlobZeroPad ( KColumnBlob *self )
-{
-    KColumn *col = self -> col;
-    size_t pad_bytes = self -> num_writ % col -> df . pgsize;
-    if ( pad_bytes != 0 )
-    {
-        size_t total, num_writ;
-
-        pad_bytes = col -> df . pgsize - pad_bytes;
-        for ( total = 0; total < pad_bytes; total += num_writ )
-        {
-            rc_t rc;
-
-            size_t to_write = pad_bytes - total;
-            if ( to_write > sizeof zero )
-                to_write = sizeof zero;
-
-            rc = KColumnDataWrite ( & col -> df,
-                & self -> pmnew, self -> num_writ + total,
-                zero, to_write, & num_writ );
-            if ( rc != 0 )
-                return rc;
-            if ( num_writ == 0 )
-                return RC ( rcDB, rcBlob, rcCommitting, rcTransfer, rcIncomplete );
-        }
-    }
-    return 0;
-}
-
-static
-rc_t KColumnBlobDoCommit ( KColumnBlob *self )
-{
-    rc_t rc;
-    KColBlobLoc loc;
-    KColumn *col = self -> col;
-
-    /* finish checksum */
-    if ( col -> csbytes != 0 )
-    {
-        MD5State md5;
-        uint32_t crc32;
-        uint8_t digest [ 16 ];
-
-        void *cs;
-        size_t num_writ;
-
-        switch ( col -> checksum )
-        {
-        case kcsCRC32:
-            crc32 = self -> crc32;
-            if ( self -> bswap )
-                crc32 = bswap_32 ( crc32 );
-            cs = & crc32;
-            break;
-        case kcsMD5:
-        default: /* to quiet compiler warnings */
-            /* work on copy in case of failure */
-            md5 = self -> md5;
-            MD5StateFinish ( & md5, digest );
-            cs = digest;
-            break;
-        }
-
-        rc = KColumnDataWrite ( & col -> df,
-            & self -> pmnew, self -> num_writ,
-            cs, col -> csbytes, & num_writ );
-        if ( rc != 0 )
-            return rc;
-        if ( num_writ != col -> csbytes )
-            return RC ( rcDB, rcBlob, rcCommitting, rcTransfer, rcIncomplete );
-
-        self -> num_writ += num_writ;
-    }
-
-    /* extract index information */
-    rc = KColumnPageMapId ( & self -> pmnew, & col -> df, & loc . pg );
-    if ( rc == 0 )
-    {
-        loc . u . blob . size = ( uint32_t ) self -> num_writ;
-        loc . u . blob . remove = 0;
-        loc . start_id = self -> loc . start_id;
-        loc . id_range = self -> loc . id_range;
-
-        /* pad out rest of page */
-        if ( col -> df . pgsize > 1 )
-            rc = KColumnBlobZeroPad ( self );
-        if ( rc == 0 )
-        {
-            /* commit data fork */
-            rc = KColumnDataCommit ( & col -> df,
-                & self -> pmnew, self -> num_writ );
-            if ( rc == 0 )
-            {
-                /* commit index fork */
-                rc = KColumnIdxCommit ( & col -> idx, col -> md5,
-                    & loc, col -> commit_freq, col -> df . eof,
-                    col -> df . pgsize, col -> checksum );
-                if ( rc == 0 || rc == kdbReindex )
-                {
-                    rc_t status = rc;
-
-                    /* release old pages */
-                    if ( self -> loc . u . blob . size == 0 )
-                        rc = 0;
-                    else
-                    {
-                        rc = KColumnDataFree ( & col -> df,
-                            & self -> pmorig, self -> loc . u . blob . size + col -> csbytes );
-                        if ( GetRCState ( rc ) == rcInvalid )
-                            rc = 0;
-                    }
-
-                    if ( rc == 0 )
-                    {
-                        /* transfer new map */
-                        self -> pmorig = self -> pmnew;
-                        memset ( & self -> pmnew, 0, sizeof self -> pmnew );
-
-                        /* fill out location */
-                        loc . u . blob . size -= col -> csbytes;
-                        self -> loc = loc;
-
-                        /* HACK - should open new pm on demand
-                           but since the code does not yet support it,
-                           disallow further writes */
-                        self -> read_only = true;
-                        
-                        /* mark blob as clean */
-                        self -> num_writ = 0;
-
-			/* these must not be a point of failure 
-			   The only failure from the KMD5FileCommit
-			   behind these is on NULL parameter */
-			rc = KColumnDataCommitDone ( & col -> df );
-			if ( rc == 0 )
-			    rc = KColumnIdxCommitDone ( & col -> idx );
-
-                        return status;
-                    }
-                }
-
-                /* revert data fork */
-                KColumnDataFree ( & col -> df,
-                    & self -> pmnew, self -> num_writ );
-		KMD5FileRevert ( self -> col -> df . fmd5 );
-            }
-        }
-    }
-
-    /* remove checksum bytes */
-    self -> num_writ -= col -> csbytes;
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KColumnBlobCommit ( KColumnBlob *self )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcBlob, rcCommitting, rcSelf, rcNull );
-
-    if ( self -> loc . id_range == 0 )
-        return RC ( rcDB, rcBlob, rcCommitting, rcRange, rcInvalid );
-
-    if ( self -> num_writ == 0 && self -> loc . u . blob . size != 0 )
-        return 0;
-
-    assert ( self -> read_only == false );
-
-    rc = KColumnBlobDoCommit ( self );
-
-    if ( rc == kdbReindex )
-        rc = KColumnReindex ( self -> col );
-
-    return rc;
-}
diff --git a/libs/kdb/wdatabase-priv.h b/libs/kdb/wdatabase-priv.h
deleted file mode 100644
index 958089e..0000000
--- a/libs/kdb/wdatabase-priv.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_database_priv_
-#define _h_database_priv_
-
-#ifndef _h_kdb_manager_
-#include <kdb/manager.h>
-#endif
-
-#ifndef _h_kdb_database_
-#include <kdb/database.h>
-#endif
-
-#ifndef _h_klib_container_
-#include <klib/container.h>
-#endif
-
-#ifndef _h_klib_refcount_
-#include <klib/refcount.h>
-#endif
-
-#include <klib/symbol.h>
-#include <kfs/md5.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KDatabase
- *  connection to a database within file system
- */
-struct KDatabase
-{
-    /* manager reference */
-    KDBManager *mgr;
-
-    /* if a sub-directory */
-    KDatabase *dad;
-
-    /* database directory */
-    KDirectory *dir;
-
-    KMD5SumFmt *md5;
-
-    /* open references */
-    KRefcount refcount;
-    uint32_t opencount;
-    bool use_md5;
-    bool read_only;
-
-    KSymbol sym;
-
-    char path [1];
-};
-
-/* Attach
- * Sever
- *  like AddRef/Release, except called internally
- *  indicates that a child object is letting go...
- */
-KDatabase *KDatabaseAttach ( const KDatabase *self );
-rc_t KDatabaseSever ( const KDatabase *self );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_database_priv_ */
diff --git a/libs/kdb/wdatabase.c b/libs/kdb/wdatabase.c
deleted file mode 100644
index 0d29f89..0000000
--- a/libs/kdb/wdatabase.c
+++ /dev/null
@@ -1,1503 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kdb/extern.h>
-#include "database-priv.h"
-#include "dbmgr-priv.h"
-#include "wtable-priv.h"
-#include "windex-priv.h"
-#include "wkdb-priv.h"
-#include <klib/namelist.h>
-#include <klib/symbol.h>
-#include <klib/log.h>
-#include <klib/printf.h>
-#include <klib/rc.h>
-#include <kfs/directory.h>
-#include <kfs/file.h>
-#include <kfs/impl.h>
-#include <kfs/md5.h>
-#include <sysalloc.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * KDatabase
- *  connection to a database within file system
- */
-
-/* GetPath
- *  return the absolute path to DB
- */
-LIB_EXPORT rc_t CC KDatabaseGetPath ( struct KDatabase const *self,
-    const char **path )
-{
-    if ( self == NULL )
-        return RC ( rcDB, rcDatabase, rcAccessing, rcSelf, rcNull );
-    if ( path == NULL )
-        return RC ( rcDB, rcDatabase, rcAccessing, rcParam, rcNull );
-    *path = self->path;
-    return 0;
-}
-
-/* Whack
- */
-static
-rc_t KDatabaseWhack ( KDatabase *self )
-{
-    rc_t rc = 0;
-    KDBManager *mgr = self -> mgr;
-    KSymbol * symb;
-    assert ( mgr != NULL );
-
-    KRefcountWhack ( & self -> refcount, "KDatabase" );
-
-    /* release dad */
-    if ( self -> dad != NULL )
-    {
-        rc = KDatabaseSever ( self -> dad );
-        if ( rc != 0 )
-            return rc;
-        self -> dad = NULL;
-    }
-
-    /* shut down md5 sum file if it is open */
-    KMD5SumFmtRelease ( self -> md5 ), self -> md5 = NULL;
-
-    /* remove from mgr */
-    symb = KDBManagerOpenObjectFind (mgr, self->path);
-    if (symb != NULL)
-    {
-        rc = KDBManagerOpenObjectDelete (mgr, symb);
-        if (rc == 0)
-        {
-            /* release manager
-               should never fail */
-            rc = KDBManagerSever ( mgr );
-            if ( rc != 0 )
-                rc = KDBManagerOpenObjectAdd (mgr, symb);
-            else
-            {
-                /* complete */
-                KDirectoryRelease ( self -> dir );
-                free ( self );
-                return 0;
-            }
-        }
-    }
-
-    KRefcountInit ( & self -> refcount, 1, "KDatabase", "whack", "kdb" );
-
-    return rc;
-}
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-LIB_EXPORT rc_t CC KDatabaseAddRef ( const KDatabase *cself )
-{
-    KDatabase *self = ( KDatabase* ) cself;
-    if ( cself != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KDatabase" ) )
-        {
-        case krefLimit:
-            return RC ( rcDB, rcDatabase, rcAttaching, rcRange, rcExcessive );
-        }
-        ++ self -> opencount;
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KDatabaseRelease ( const KDatabase *cself )
-{
-    KDatabase *self = ( KDatabase* ) cself;
-    if ( cself != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KDatabase" ) )
-        {
-        case krefWhack:
-            return KDatabaseWhack ( ( KDatabase* ) self );
-        case krefLimit:
-            return RC ( rcDB, rcDatabase, rcReleasing, rcRange, rcExcessive );
-        }
-        -- self -> opencount;
-    }
-    return 0;
-}
-
-
-/* Attach
- */
-KDatabase *KDatabaseAttach ( const KDatabase *cself )
-{
-    KDatabase *self = ( KDatabase* ) cself;
-    if ( cself != NULL )
-    {
-        switch ( KRefcountAddDep ( & self -> refcount, "KDatabase" ) )
-        {
-        case krefLimit:
-            return NULL;
-        }
-    }
-    return self;
-}
-
-/* Sever
- *  like Release, except called internally
- *  indicates that a child object is letting go...
- */
-rc_t KDatabaseSever ( const KDatabase *cself )
-{
-    KDatabase *self = ( KDatabase* ) cself;
-    if ( cself != NULL )
-    {
-        switch ( KRefcountDropDep ( & self -> refcount, "KDatabase" ) )
-        {
-        case krefWhack:
-            return KDatabaseWhack ( ( KDatabase* ) self );
-        case krefLimit:
-            return RC ( rcDB, rcDatabase, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/* Make
- *  make an initialized structure
- *  NB - does NOT attach reference to dir, but steals it
- */
-static
-rc_t KDatabaseMake ( KDatabase **dbp, const KDirectory *dir,
-    const char *path, KMD5SumFmt *md5, bool read_only )
-{
-    KDatabase *db;
-    rc_t rc = 0;
-
-    assert ( dbp != NULL );
-    assert ( path != NULL );
-
-    db = malloc ( sizeof * db + strlen ( path ) );
-    if ( db == NULL )
-    {
-        * dbp = NULL;
-        return RC ( rcDB, rcDatabase, rcConstructing, rcMemory, rcExhausted );
-    }
-
-    memset ( db, 0, sizeof * db );
-    db -> dir = ( KDirectory* ) dir;
-    db -> md5 = md5;
-    rc = KMD5SumFmtAddRef ( md5 );
-    db -> use_md5 = ( md5 == NULL ) ? false : true;
-    KRefcountInit ( & db -> refcount, 1, "KDatabase", "make", path );
-    db -> opencount = 1;
-    db -> read_only = read_only;
-
-    strcpy ( db -> path, path );
-
-    db->sym.u.obj = db;
-    StringInitCString (&db->sym.name, db->path);
-    db->sym.type = kptDatabase;
-
-    * dbp = db;
-    return rc;
-}
-
-
-static
-rc_t KDBManagerInsertDatabase ( KDBManager * self, KDatabase * db )
-{
-    rc_t rc;
-    rc = KDBManagerOpenObjectAdd (self, &db->sym);
-    if ( rc == 0 )
-        db -> mgr = KDBManagerAttach ( self );
-    return rc;
-}
-
-
-static
-rc_t KDBManagerMakeDBUpdate ( KDBManager *self,
-    KDatabase **dbp, KDirectory *wd, const char *path, KMD5SumFmt *md5 )
-{
-    rc_t rc;
-    KDirectory *dir;
-
-    rc = KDirectoryVOpenDirUpdate ( wd, & dir, false, path, NULL );
-    if ( rc == 0 )
-    {
-        KDatabase *db;
-	    
-        /* Make the base object */
-        rc = KDatabaseMake ( & db, dir, path, md5, false );
-        if ( rc == 0 )
-        {
-            rc = KDBManagerInsertDatabase ( self, db );
-
-            if ( rc == 0 )
-            {
-                * dbp = db;
-                return 0;   /* successful exit */
-            }
-
-            rc = RC ( rcDB, rcMgr, rcOpening, rcDatabase, rcBusy );
-                
-            free ( db );
-        }
-        KDirectoryRelease ( dir );
-    }
-    return rc;
-}
-
-
-/* CreateDB
- * VCreateDB
- *  create a new or open an existing database
- *
- *  "db" [ OUT ] - return parameter for newly opened database
- *
- *  "cmode" [ IN ] - creation mode
- *
- *  "path" [ IN ] - NUL terminated string in
- *  wd-native character set giving path to database
- */
-static
-rc_t KDBManagerVCreateDBInt ( KDBManager *self,
-    KDatabase **db, KDirectory *wd, KCreateMode cmode,
-    const char *path, va_list args )
-{
-    char dbpath [ 4096 ];
-    rc_t rc = KDirectoryVResolvePath ( wd, true,
-        dbpath, sizeof dbpath, path, args );
-    if ( rc == 0 )
-    {
-        /* we won't try accession resolution here */
-        int type = KDBPathType ( /*NULL,*/ wd, NULL, dbpath );
-        switch ( type )
-        {
-        case kptNotFound:
-            /* first good path */
-            break;
-
-        case kptBadPath:
-            return RC ( rcDB, rcMgr, rcCreating, rcPath, rcInvalid );
-
-        case kptDatabase:
-        case kptDatabase | kptAlias:
-            /* found so is not good if we want to create new and not
-             * clear/init or open old
-             */
-            if ((cmode & kcmValueMask) == kcmCreate)
-                return RC ( rcDB, rcMgr, rcCreating, rcDatabase, rcExists );
-            if (KDBManagerOpenObjectBusy (self, dbpath))
-                return RC ( rcDB, rcMgr, rcCreating, rcDatabase, rcBusy );
-            /* test now for locked directory */
-            rc = KDBWritable ( wd, dbpath );
-            if (rc)
-            {
-                switch (GetRCState(rc))
-                {
-                default:
-                    return rc;
-                case rcLocked:
-                    return RC ( rcDB, rcMgr, rcCreating, rcDatabase, rcLocked );
-                case rcReadonly:
-                    return RC ( rcDB, rcMgr, rcCreating, rcDatabase, rcReadonly );
-                case rcNotFound:
-                    /* not found is good but probably unreachable */
-                    break;
-                case 0:
-                    rc = 0;
-                    break;
-                }
-            }
-            /* second good path */
-            break;
-
-        case kptTable:
-        case kptTable | kptAlias:
-            return RC (rcDB, rcMgr, rcCreating, rcTable, rcExists);
-
-        case kptColumn:
-        case kptColumn | kptAlias:
-            return RC (rcDB, rcMgr, rcCreating, rcColumn, rcExists);
-
-        case kptIndex:
-        case kptIndex | kptAlias:
-            return RC (rcDB, rcMgr, rcCreating, rcIndex, rcExists);
-
-        case kptMetadata:
-        case kptMetadata | kptAlias:
-            return RC (rcDB, rcMgr, rcCreating, rcMetadata, rcExists);
-
-	case kptFile:
-	case kptFile | kptAlias:
-	    /* if we find a file, vary the failure if it is an archive that is a database
-	     * or a non related file */
-	    if ( KDBOpenPathTypeRead ( self, wd, dbpath, NULL, kptDatabase, NULL, false ) == 0 )
-		return RC ( rcDB, rcMgr, rcCreating, rcDirectory, rcUnauthorized );
-	    /* fall through */
-        default:
-            return RC ( rcDB, rcMgr, rcCreating, rcPath, rcIncorrect );
-        }
-
-        /* [re]create directory */
-        rc = KDirectoryVCreateDir ( wd, 0775, cmode, dbpath, NULL );
-        if (rc == 0)
-            /* create tbl subdirectory as required for db */
-            rc = KDirectoryCreateDir ( wd, 0775, kcmOpen, "%s/tbl", dbpath );
-
-        if ( rc == 0 )
-        {
-            KMD5SumFmt *md5 = NULL;
-
-            if ( ( cmode & kcmMD5 ) != 0 )
-            {
-                KFile * f;
-
-                /* if needed create the md5 digest file */
-                rc = KDirectoryCreateFile ( wd, &f, true, 0664, kcmOpen, "%s/md5", dbpath );
-                if ( rc == 0 )
-                {
-                    /* create a formatter around file
-                       formatter will own "f" afterward */
-                    rc = KMD5SumFmtMakeUpdate ( & md5, f );
-
-                    /* if failed to create formatter, release "f" */
-                    if ( rc != 0 )
-                        KFileRelease ( f );
-                }
-            }
-
-            if ( rc == 0 )
-                rc = KDBManagerMakeDBUpdate ( self, db, wd, dbpath, md5 );
-
-            KMD5SumFmtRelease ( md5 );
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDBManagerVCreateDB ( KDBManager *self,
-    KDatabase **db, KCreateMode cmode, const char *path, va_list args )
-{
-    if ( db == NULL )
-        return RC ( rcDB, rcMgr, rcCreating, rcParam, rcNull );
-
-    * db = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcMgr, rcCreating, rcSelf, rcNull );
-
-    return KDBManagerVCreateDBInt ( self, db, self -> wd, cmode, path, args );
-}
-
-
-LIB_EXPORT rc_t CC KDBManagerCreateDB ( KDBManager *self,
-    KDatabase **db, KCreateMode cmode, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDBManagerVCreateDB ( self, db, cmode, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* =====
- * create a KDatabase as a sub of another KDatabase
- */
-LIB_EXPORT rc_t CC KDatabaseCreateDB ( KDatabase *self,
-    KDatabase **db, KCreateMode cmode, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = KDatabaseVCreateDB ( self, db, cmode, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDatabaseVCreateDB ( KDatabase *self,
-    KDatabase **dbp, KCreateMode cmode, const char *name, va_list args )
-{
-    rc_t rc;
-    char path [ 256 ];
-
-    if ( dbp == NULL )
-        return RC ( rcDB, rcDatabase, rcCreating, rcParam, rcNull );
-
-    * dbp = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcDatabase, rcCreating, rcSelf, rcNull );
-
-    if ( self -> read_only )
-        return RC ( rcDB, rcDatabase, rcCreating, rcDatabase, rcReadonly );
-
-    rc = KDBVMakeSubPath ( self -> dir,
-        path, sizeof path, "db", 2, name, args );
-    if ( rc == 0 )
-    {
-        /* ensure that the "db" namespace directory is there */
-        rc = KDirectoryVCreateDir ( self -> dir,
-            0775, kcmOpen, "db", NULL );
-        if ( rc == 0 )
-        {
-            rc = KDBManagerVCreateDBInt ( self -> mgr, dbp,
-                self -> dir, cmode, path, NULL );
-            if ( rc == 0 )
-            {
-                KDatabase *db = ( KDatabase* ) * dbp;
-                db -> dad = self;
-                atomic32_inc ( & self -> refcount );
-            }
-        }
-    }
-
-    return rc;
-}
-
-
-/* OpenDBRead
- * VOpenDBRead
- *  open a database for read
- *
- *  "db" [ OUT ] - return parameter for newly opened database
- *
- *  "path" [ IN ] - NUL terminated string in
- *  wd-native character set giving path to database
- */
-static
-rc_t KDBManagerVOpenDBReadInt ( const KDBManager *cself,
-    const KDatabase **dbp, KDirectory *wd,
-    const char *path, va_list args, bool *cached, bool try_srapath )
-{
-    rc_t rc;
-    char dbpath [4096];
-    size_t z;
-
-    rc = string_vprintf (dbpath, sizeof dbpath, &z, path, args);
-    if ( rc == 0 )
-    {
-        KSymbol *sym;
-
-        /* if already open */
-        sym = KDBManagerOpenObjectFind (cself, dbpath);
-        if (sym != NULL)
-        {
-            const KDatabase *cdb;
-            rc_t obj;
-
-            if ( cached != NULL )
-                * cached = true;
-
-            switch (sym->type)
-            {
-            case kptDatabase:
-                cdb = (KDatabase*)sym->u.obj;
-                /* if open for update, refuse */
-                if ( cdb -> read_only )
-                {
-                    /* attach a new reference and we're gone */
-                    rc = KDatabaseAddRef ( cdb );
-                    if ( rc == 0 )
-                        * dbp = cdb;
-                    return rc;
-                }
-                obj = rcDatabase;
-                break;
-
-            default:
-                obj = rcPath;
-                break;
-            case kptTable:
-                obj = rcTable;
-                break;
-            case kptColumn:
-                obj = rcColumn;
-                break;
-            case kptIndex:
-                obj = rcIndex;
-                break;
-            case kptMetadata:
-                obj = rcMetadata;
-                break;
-            }
-            rc = RC (rcDB, rcMgr, rcOpening, obj, rcBusy);
-        }
-        else
-        {
-            const KDirectory *dir;
-
-            if ( cached != NULL )
-                * cached = false;
-
-            /* open the directory if its a database */
-            rc = KDBOpenPathTypeRead ( cself, wd, dbpath, &dir, kptDatabase, NULL, try_srapath );
-            if ( rc == 0 )
-            {
-                KDatabase *db;
-
-                rc = KDatabaseMake ( &db, dir, dbpath, NULL, true );
-                if ( rc == 0 )
-                {
-                    KDBManager *self = ( KDBManager* ) cself;
-
-                    rc = KDBManagerInsertDatabase ( self, db );
-                    if ( rc == 0 )
-                    {
-                        * dbp = db;
-                        return 0;
-                    }
-                    free (db);
-                }
-                KDirectoryRelease (dir);
-            }
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC KDBManagerOpenDBRead ( const KDBManager *self,
-    const KDatabase **db, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDBManagerVOpenDBRead ( self, db, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDBManagerVOpenDBRead ( const KDBManager *self,
-    const KDatabase **db, const char *path, va_list args )
-{
-    if ( db == NULL )
-        return RC ( rcDB, rcMgr, rcOpening, rcParam, rcNull );
-
-    * db = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcMgr, rcOpening, rcSelf, rcNull );
-
-    return KDBManagerVOpenDBReadInt ( self, db, self -> wd, path, args, NULL, true );
-}
-
-LIB_EXPORT rc_t CC KDatabaseOpenDBRead ( const KDatabase *self,
-    const KDatabase **db, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = KDatabaseVOpenDBRead ( self, db, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDatabaseVOpenDBRead ( const KDatabase *self,
-    const KDatabase **dbp, const char *name, va_list args )
-{
-    rc_t rc;
-    char path [ 256 ];
-
-    if ( dbp == NULL )
-        return RC ( rcDB, rcDatabase, rcOpening, rcParam, rcNull );
-
-    * dbp = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcDatabase, rcOpening, rcSelf, rcNull );
-
-    rc = KDBVMakeSubPath ( self -> dir,
-        path, sizeof path, "db", 2, name, args );
-    if ( rc == 0 )
-    {
-        bool is_cached;
-        rc = KDBManagerVOpenDBReadInt ( self -> mgr, dbp,
-                                        self -> dir, path, NULL, & is_cached, false );
-        if ( rc == 0 && ! is_cached )
-        {
-            KDatabase *db = ( KDatabase* ) * dbp;
-            db -> dad = KDatabaseAttach ( self );
-        }
-    }
-
-    return rc;
-}
-
-
-/* OpenDBUpdate
- * VOpenDBUpdate
- *  open a database for read/write
- *
- *  "db" [ OUT ] - return parameter for newly opened database
- *
- *  "path" [ IN ] - NUL terminated string in
- *  wd-native character set giving path to database
- */
-static
-rc_t KDBManagerVOpenDBUpdateInt ( KDBManager *self,
-    KDatabase **db, KDirectory *wd, const char *path, va_list args )
-{
-    char dbpath [ 4096 ];
-    rc_t rc = KDirectoryVResolvePath ( wd, true,
-        dbpath, sizeof dbpath, path, args );
-    if ( rc == 0 )
-    {
-        KSymbol * sym;
-        KFile *f;
-        KMD5SumFmt * md5 = NULL;
-
-        /* if already open, refuse */
-        sym = KDBManagerOpenObjectFind (self, dbpath);
-        if (sym != NULL)
-        {
-            rc_t obj;
-            switch (sym->type)
-            {
-            default:
-                obj = rcPath;
-                break;
-            case kptDatabase:
-                obj = rcDatabase;
-                break;
-            case kptTable:
-                obj = rcTable;
-                break;
-            case kptColumn:
-                obj = rcColumn;
-                break;
-            case kptIndex:
-                obj = rcIndex;
-                break;
-            case kptMetadata:
-                obj = rcMetadata;
-                break;
-            }
-            return RC ( rcDB, rcMgr, rcOpening, obj, rcBusy );
-        }
-        /* only open existing dbs */
-        switch (KDBPathType ( /*self,*/ wd, NULL, dbpath ) )
-        {
-        case kptNotFound:
-            return RC ( rcDB, rcMgr, rcOpening, rcDatabase, rcNotFound );
-        case kptBadPath:
-            return RC ( rcDB, rcMgr, rcOpening, rcPath, rcInvalid );
-	case kptFile:
-	case kptFile | kptAlias:
-	    /* if we find a file, vary the failure if it is an archive that is a database
-	     * or a non related file */
-	    if ( KDBOpenPathTypeRead ( self, wd, dbpath, NULL, kptDatabase, NULL, false ) == 0 )
-		return RC ( rcDB, rcMgr, rcOpening, rcDirectory, rcUnauthorized );
-	    /* fall through */
-        default:
-            return RC ( rcDB, rcMgr, rcOpening, rcPath, rcIncorrect );
-        case kptDatabase:
-        case kptDatabase | kptAlias:
-            break;
-        }
-
-        /* test now for locked directory */
-        rc = KDBWritable (wd, dbpath);
-        switch (GetRCState (rc))
-        {
-        default:
-#if 0
-            return RC ( rcDB, rcMgr, rcOpening, rcDatabase, rcNoPerm ); /* TBD: better state? */
-#endif
-
-        case rcLocked:
-            return RC ( rcDB, rcMgr, rcOpening, rcDatabase, rcLocked );
-
-        case rcReadonly:
-            return RC ( rcDB, rcMgr, rcOpening, rcDatabase, rcReadonly );
-
-
-        case 0:
-            rc = 0;
-            break;
-        }
-
-        rc = KDirectoryOpenFileWrite ( wd, &f, true, "%s/md5", dbpath );
-        if ( rc == 0 )
-        {
-            rc = KMD5SumFmtMakeUpdate ( & md5, f );
-            if ( rc != 0 )
-                KFileRelease ( f );
-        }
-        else if ( GetRCState ( rc ) == rcNotFound )
-            rc = 0;
-
-        if ( rc == 0 )
-            rc = KDBManagerMakeDBUpdate ( self, db, wd, dbpath, md5 );
-
-        KMD5SumFmtRelease ( md5 );
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDBManagerOpenDBUpdate ( KDBManager *self,
-    KDatabase **db, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDBManagerVOpenDBUpdate ( self, db, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDBManagerVOpenDBUpdate ( KDBManager *self,
-    KDatabase **db, const char *path, va_list args )
-{
-    if ( db == NULL )
-        return RC ( rcDB, rcMgr, rcOpening, rcParam, rcNull );
-
-    * db = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcMgr, rcOpening, rcSelf, rcNull );
-
-    return KDBManagerVOpenDBUpdateInt ( self, db, self -> wd, path, args );
-}
-
-LIB_EXPORT rc_t CC KDatabaseOpenDBUpdate ( KDatabase *self,
-    KDatabase **db, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = KDatabaseVOpenDBUpdate ( self, db, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDatabaseVOpenDBUpdate ( KDatabase *self,
-    KDatabase **dbp, const char *name, va_list args )
-{
-    rc_t rc;
-    char path [ 256 ];
-
-    if ( dbp == NULL )
-        return RC ( rcDB, rcDatabase, rcOpening, rcParam, rcNull );
-
-    * dbp = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcDatabase, rcOpening, rcSelf, rcNull );
-
-    if ( self -> read_only )
-        return RC ( rcDB, rcDatabase, rcOpening, rcDatabase, rcReadonly );
-
-    rc = KDBVMakeSubPath ( self -> dir,
-        path, sizeof path, "db", 2, name, args );
-    if ( rc == 0 )
-    {
-        rc = KDBManagerVOpenDBUpdateInt ( self -> mgr, dbp,
-            self -> dir, path, NULL );
-        if ( rc == 0 )
-        {
-            KDatabase *db = ( KDatabase* ) * dbp;
-            db -> dad = self;
-            atomic32_inc ( & self -> refcount );
-        }
-    }
-
-    return rc;
-}
-
-
-/* Locked
- *  returns non-zero if locked
- */
-LIB_EXPORT bool CC KDatabaseLocked ( const KDatabase *self )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        return false;
-
-    rc = KDBWritable ( self -> dir, "." );
-    return GetRCState ( rc ) == rcLocked;
-}
-
-/* Exists
- *  returns true if requested object exists
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptTable
- *
- *  "path" [ IN ] - NUL terminated path
- */
-LIB_EXPORT bool CC KDatabaseVExists ( const KDatabase *self, uint32_t type, const char *name, va_list args )
-{
-    if ( self != NULL && name != NULL && name [ 0 ] != 0 )
-    {
-        rc_t rc;
-        size_t len;
-        const char *ns;
-        char path [ 256 ];
-
-        switch ( type )
-        {
-        case kptDatabase:
-            ns = "db";
-            len = 2;
-            break;
-
-        case kptTable:
-            ns = "tbl";
-            len = 3;
-            break;
-
-        case kptIndex:
-            ns = "idx";
-            len = 3;
-            break;
-
-        default:
-            return false;
-        }
-
-        rc = KDBVMakeSubPath ( self -> dir, path, sizeof path, ns, len, name, args );
-        if ( rc == 0 )
-        {
-            switch ( KDirectoryPathType ( self -> dir, path ) )
-            {
-            case kptFile:
-            case kptDir:
-            case kptFile | kptAlias:
-            case kptDir | kptAlias:
-                return true;
-            }
-        }
-    }
-    return false;
-}
-
-LIB_EXPORT bool CC KDatabaseExists ( const KDatabase *self, uint32_t type, const char *name, ... )
-{
-    bool exists;
-
-    va_list args;
-    va_start ( args, name );
-
-    exists = KDatabaseVExists ( self, type, name, args );
-
-    va_end ( args );
-
-    return exists;
-}
-
-
-/* IsAlias
- *  returns true if object name is an alias
- *  returns path to fundamental name if it was aliased
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptDatabase, kptTable and kptIndex
- *
- *  "resolved" [ OUT ] and "rsize" [ IN ] - optional output buffer
- *  for fundamenta object name if "alias" is not a fundamental name, 
- *
- *  "name" [ IN ] - NUL terminated object name
- */
-LIB_EXPORT bool CC KDatabaseIsAlias ( const KDatabase *self, uint32_t type,
-    char *resolved, size_t rsize, const char *name )
-{
-    if ( self != NULL && name != NULL && name [ 0 ] != 0 )
-    {
-        rc_t rc;
-        size_t len;
-        const char *ns;
-        char path [ 256 ];
-
-        switch ( type )
-        {
-        case kptDatabase:
-            ns = "db";
-            len = 2;
-            break;
-
-        case kptTable:
-            ns = "tbl";
-            len = 3;
-            break;
-
-        case kptIndex:
-            ns = "idx";
-            len = 3;
-            break;
-
-        default:
-            return false;
-        }
-
-        rc = KDBMakeSubPath ( self -> dir, path, sizeof path, ns, len, name );
-        if ( rc == 0 )
-        {
-            switch ( KDirectoryPathType ( self -> dir, path ) )
-            {
-            case kptFile | kptAlias:
-            case kptDir | kptAlias:
-                if ( resolved != NULL && rsize != 0 )
-                {
-                    const KDirectory *sub;
-                    rc = KDirectoryOpenDirRead ( self -> dir, & sub, false, ns );
-                    * resolved = 0;
-                    if ( rc != 0 )
-                        PLOGERR ( klogWarn, ( klogWarn, rc, "failed to open subdirectory '$(sub)'", "sub=%s", ns ) );
-                    else
-                    {
-                        rc = KDirectoryResolveAlias ( sub, false, resolved, rsize, name );
-                        KDirectoryRelease ( sub );
-                        if ( rc != 0 )
-                            PLOGERR ( klogWarn, ( klogWarn, rc, "failed to resolve alias '$(alias)'", "alias=%s", name ) );
-                    }
-                }
-                return true;
-            }
-        }
-    }
-
-    if ( resolved != NULL && rsize != 0 )
-        * resolved = 0;
-
-    return false;
-}
-
-
-/* Writable
- *  returns 0 if object is writable
- *  or a reason why if not
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptDatabase, kptTable and kptIndex
- *
- *  "path" [ IN ] - NUL terminated path
- */
-static
-rc_t KDatabaseLockInt (const KDatabase  * self, char * path, size_t path_size,
-                        int type, const char * name, va_list args )
-{
-    rc_t rc;
-
-    if (self == NULL)
-        rc = RC ( rcDB, rcMgr, rcAccessing, rcSelf, rcNull );
-
-    else if (name == NULL)
-        rc =  RC (rcDB, rcMgr, rcAccessing, rcPath, rcNull);
-
-    else
-    {
-        const char * ns;
-        char path [ 256 ];
-
-        ns = KDBGetNamespaceString (type);
-
-        switch (type)
-        {
-        default:
-            rc = RC (rcDB, rcMgr, rcAccessing, rcParam, rcInvalid);
-            break;
-        case kptDatabase:
-        case kptTable:
-/*         case kptIndex: */
-            rc = KDBVMakeSubPath (self->dir, path, sizeof path, ns, strlen (ns),
-                                  name, args);
-            break;
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDatabaseVWritable ( const KDatabase *self, uint32_t type, const char *name, va_list args )
-{
-    rc_t rc;
-    char path [ 256 ];
-
-    rc = KDatabaseLockInt (self, path, sizeof path, type, name, args);
-    if (rc == 0)
-        rc = KDBWritable (self->dir, path);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDatabaseWritable ( const KDatabase *self, uint32_t type, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = KDatabaseVWritable ( self, type, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* Lock
- *  apply lock
- *
- *  if object is already locked, the operation is idempotent
- *  and returns an rc state of rcLocked
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptDatabase, kptTable and kptIndex
- *
- *  "path" [ IN ] - NUL terminated path
- */
-LIB_EXPORT rc_t CC KDatabaseVLock ( KDatabase *self, uint32_t type, const char *name, va_list args )
-{
-    rc_t rc = 0;
-    char path [ 256 ];
-
-    rc = KDatabaseLockInt (self, path, sizeof path, type, name, args);
-    if (rc == 0)
-        rc = KDBLockDir (self->dir, path);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDatabaseLock ( KDatabase *self, uint32_t type, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = KDatabaseVLock (self, type, name, args);
-    va_end (args);
-    return rc;
-}
-
-
-/* Unlock
- *  remove lock
- *
- *  if object is already unlocked, the operation is idempotent
- *  and returns an rc state of rcUnlocked
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptDatabase, kptTable and kptIndex
- *
- *  "path" [ IN ] - NUL terminated path
- */
-LIB_EXPORT rc_t CC KDatabaseVUnlock ( KDatabase *self, uint32_t type, const char *name, va_list args )
-{
-    rc_t rc = 0;
-    char path [ 256 ];
-
-    rc = KDatabaseLockInt (self, path, sizeof path, type, name, args);
-    if (rc == 0)
-        rc = KDBUnlockDir (self->dir, path);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDatabaseUnlock ( KDatabase *self, uint32_t type, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-    va_start ( args, name );
-    rc = KDatabaseVUnlock (self, type, name, args);
-    va_end (args);
-    return rc;
-}
-
-
-/* Rename
- */
-LIB_EXPORT rc_t CC KDatabaseRenameDB ( KDatabase *self, bool force, const char *from, const char *to )
-{
-    return KDBRename ( self -> dir, self -> mgr, kptDatabase, force, from, to );
-}
-
-LIB_EXPORT rc_t CC KDatabaseRenameTable ( KDatabase *self, bool force, const char *from, const char *to )
-{
-    return KDBRename ( self -> dir, self -> mgr, kptTable, force, from, to );
-}
-
-#if 1
-LIB_EXPORT rc_t CC KDatabaseRenameIndex ( KDatabase *self, bool force, const char *from, const char *to )
-{
-    return KDBRename ( self -> dir, self -> mgr, kptIndex, force, from, to );
-}
-#endif
-
-/* Alias
- */
-LIB_EXPORT rc_t CC KDatabaseAliasDB ( KDatabase *self, const char *db, const char *alias )
-{
-    return KDBAlias ( self -> dir, kptDatabase, db, alias );
-}
-
-LIB_EXPORT rc_t CC KDatabaseAliasTable ( KDatabase *self, const char *tbl, const char *alias )
-{
-    return KDBAlias ( self -> dir, kptTable, tbl, alias );
-}
-
-LIB_EXPORT rc_t CC KDatabaseAliasIndex ( KDatabase *self, const char *idx, const char *alias )
-{
-    return KDBAlias ( self -> dir, kptIndex, idx, alias );
-}
-
-/* Drop
- */
-
-LIB_EXPORT rc_t CC KDatabaseDropDB ( KDatabase *self, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = KDatabaseVDropDB ( self, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDatabaseVDropDB ( KDatabase *self, const char *name, va_list args )
-{
-    return KDBVDrop ( self -> dir, self -> mgr, kptDatabase, name, args );
-}
-
-LIB_EXPORT rc_t CC KDatabaseDropTable ( KDatabase *self, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = KDatabaseVDropTable ( self, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDatabaseVDropTable ( KDatabase *self, const char *name, va_list args )
-{
-    return KDBVDrop ( self -> dir, self -> mgr, kptTable, name, args );
-}
-
-#if 1
-LIB_EXPORT rc_t CC KDatabaseDropIndex ( KDatabase *self, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = KDatabaseVDropIndex ( self, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDatabaseVDropIndex ( KDatabase *self, const char *name, va_list args )
-{
-    return KDBVDrop ( self -> dir, self -> mgr, kptIndex, name, args );
-}
-#endif
-
-/* OpenManager
- *  duplicate reference to manager
- *  NB - returned reference must be released
- */
-LIB_EXPORT rc_t CC KDatabaseOpenManagerRead ( const KDatabase *self, const KDBManager **mgr )
-{
-    rc_t rc;
-
-    if ( mgr == NULL )
-        rc = RC ( rcDB, rcDatabase, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcDatabase, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = KDBManagerAddRef ( self -> mgr );
-            if ( rc == 0 )
-            {
-                * mgr = self -> mgr;
-                return 0;
-            }
-        }
-
-        * mgr = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDatabaseOpenManagerUpdate ( KDatabase *self, KDBManager **mgr )
-{
-    rc_t rc;
-
-    if ( mgr == NULL )
-        rc = RC ( rcDB, rcDatabase, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcDatabase, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = KDBManagerAddRef ( self -> mgr );
-            if ( rc == 0 )
-            {
-                * mgr = self -> mgr;
-                return 0;
-            }
-        }
-
-        * mgr = NULL;
-    }
-
-    return rc;
-}
-
-
-/* OpenParent
- *  duplicate reference to parent database
- *  NB - returned reference must be released
- */
-LIB_EXPORT rc_t CC KDatabaseOpenParentRead ( const KDatabase *self, const KDatabase **par )
-{
-    rc_t rc;
-
-    if ( par == NULL )
-        rc = RC ( rcDB, rcDatabase, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcDatabase, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = KDatabaseAddRef ( self -> dad );
-            if ( rc == 0 )
-            {
-                * par = self -> dad;
-                return 0;
-            }
-        }
-
-        * par = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDatabaseOpenParentUpdate ( KDatabase *self, KDatabase **par )
-{
-    rc_t rc;
-
-    if ( par == NULL )
-        rc = RC ( rcDB, rcDatabase, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcDatabase, rcAccessing, rcSelf, rcNull );
-        else if ( self -> dad != NULL && self -> dad -> read_only )
-            rc = RC ( rcDB, rcDatabase, rcAccessing, rcDatabase, rcReadonly );
-        else
-        {
-            rc = KDatabaseAddRef ( self -> dad );
-            if ( rc == 0 )
-            {
-                * par = self -> dad;
-                return 0;
-            }
-        }
-
-        * par = NULL;
-    }
-
-    return rc;
-}
-
-
-/* OpenDirectory
- *  access the directory in use
- */
-LIB_EXPORT rc_t CC KDatabaseOpenDirectoryRead ( const KDatabase *self, const KDirectory **dir )
-{
-    rc_t rc;
-
-    if ( dir == NULL )
-        rc = RC ( rcDB, rcDatabase, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcDatabase, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            * dir = self -> dir;
-            return KDirectoryAddRef ( * dir );
-        }
-
-        * dir = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDatabaseOpenDirectoryUpdate ( KDatabase *self, KDirectory **dir )
-{
-    rc_t rc;
-
-    if ( dir == NULL )
-        rc = RC ( rcDB, rcDatabase, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcDatabase, rcAccessing, rcSelf, rcNull );
-         else if ( self -> dir != NULL && self -> dir -> read_only )
-             rc = RC ( rcDB, rcDatabase, rcAccessing, rcDirectory, rcReadonly );
-        else
-        {
-            * dir = self -> dir;
-            return KDirectoryAddRef ( * dir );
-        }
-
-        * dir = NULL;
-    }
-
-    return rc;
-}
-
-
-/* ModDate
- *  get modification date
- */
-LIB_EXPORT rc_t CC KDatabaseModDate ( const KDatabase *self, KTime_t *mtime )
-{
-    rc_t rc;
-
-    if ( mtime == NULL )
-        rc = RC ( rcDB, rcDatabase, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self != NULL )
-            return KDBGetObjModDate ( self -> dir, mtime );
-
-        rc = RC ( rcDB, rcDatabase, rcAccessing, rcSelf, rcNull );
-        * mtime = 0;
-    }
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * KNamelist
- */
-
-/* List
- *  create database listings
- */
-struct FilterData
-{
-    const KDBManager * mgr;
-    int type;
-};
-
-static
-bool CC KDatabaseListFilter ( const KDirectory *dir, const char *name, void *data_ )
-{
-    struct FilterData * data = data_;
-    return ( KDBOpenPathTypeRead ( data->mgr, dir, name, NULL, data->type, NULL, false ) == 0 );
-}
-
-LIB_EXPORT rc_t CC KDatabaseListDB ( const KDatabase *self, KNamelist **names )
-{
-    if ( self != NULL )
-    {
-        struct FilterData data;
-        data.mgr = self->mgr;
-        data.type = kptDatabase;
-
-        return KDirectoryVList ( self -> dir,
-            names, KDatabaseListFilter, &data, "db", NULL );
-    }
-
-    if ( names != NULL )
-        * names = NULL;
-
-    return RC ( rcDB, rcDatabase, rcListing, rcSelf, rcNull );
-}
-
-LIB_EXPORT rc_t CC KDatabaseListTbl ( struct KDatabase const *self, KNamelist **names )
-{
-    if ( self != NULL )
-    {
-        struct FilterData data;
-        data.mgr = self->mgr;
-        data.type = kptTable;
-
-        return KDirectoryVList ( self -> dir,
-            names, KDatabaseListFilter, &data, "tbl", NULL );
-    }
-
-    if ( names != NULL )
-        * names = NULL;
-
-    return RC ( rcDB, rcDatabase, rcListing, rcSelf, rcNull );
-}
-
-LIB_EXPORT rc_t CC KDatabaseListIdx ( struct KDatabase const *self, KNamelist **names )
-{
-    if ( self != NULL )
-    {
-        struct FilterData data;
-        data.mgr = self->mgr;
-        data.type = kptIndex;
-
-        return KDirectoryVList ( self -> dir,
-            names, KDatabaseListFilter, &data, "idx", NULL );
-    }
-
-    if ( names != NULL )
-        * names = NULL;
-
-    return RC ( rcDB, rcDatabase, rcListing, rcSelf, rcNull );
-}
-
diff --git a/libs/kdb/wdbmgr.c b/libs/kdb/wdbmgr.c
deleted file mode 100644
index 59289c7..0000000
--- a/libs/kdb/wdbmgr.c
+++ /dev/null
@@ -1,349 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#define TRACK_REFERENCES 0
-
-#include <kdb/extern.h>
-#include "libwkdb.vers.h"
-#include "dbmgr-priv.h"
-#include "wkdb-priv.h"
-#include <kfs/impl.h>
-#include <klib/symbol.h>
-#include <klib/checksum.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <limits.h>
-#include <string.h>
-#include <stdlib.h>
-#include <assert.h>
-
-
-
-/*--------------------------------------------------------------------------
- * KDBManager
- *  handle to library
- */
-
-
-/* MakeUpdate
- *  create library handle
- */
-LIB_EXPORT rc_t CC KDBManagerMakeUpdate ( KDBManager **mgrp, KDirectory *wd )
-{
-    if ( wd == NULL || ! wd -> read_only )
-        return KDBManagerMake ( mgrp, wd, "make-update", NULL );
-
-    if ( mgrp != NULL )
-        * mgrp = NULL;
-
-    return RC ( rcDB, rcMgr, rcConstructing, rcDirectory, rcReadonly );
-}
-
-
-/* Writable
- *  returns 0 if object is writable
- *  or a reason why if not
- *
- *  "path" [ IN ] - NUL terminated path
- *
- * TBD: Better reasons for non local paths
- */
-static
-rc_t KDBManagerWritableInt ( const KDirectory * dir, const char * path )
-{
-    rc_t rc;
-
-    int type = KDBPathType ( /*NULL,*/ dir, NULL, path ) & ~ kptAlias;
-    switch ( type )
-    {
-    case kptDatabase:
-    case kptTable:
-    case kptPrereleaseTbl:
-    case kptColumn:
-        rc = KDBWritable ( dir, path );
-        break;
-
-    case kptIndex:
-    case kptMetadata:
-        /* a wrong database type */
-        rc = RC ( rcDB, rcMgr, rcAccessing, rcPath, rcIncorrect );
-        break;
-#if 0
-        /*TBD - eventually we need to check for an archive here */
-    case kptFile: 
-        /* check if this is an archive .tar or .sra and return rcReadonly if it is */
-#endif
-    case kptNotFound:
-        rc = RC ( rcDB, rcMgr, rcAccessing, rcPath, rcNotFound );
-        break;
-    case kptBadPath:
-        rc = RC ( rcDB, rcMgr, rcAccessing, rcPath, rcInvalid );
-        break;
-    default:
-        rc = RC ( rcDB, rcMgr, rcAccessing, rcPath, rcIncorrect );
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDBManagerVWritable ( const KDBManager *self, const char * path, va_list args )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcDB, rcMgr, rcAccessing, rcSelf, rcNull );
-    else
-    {
-        char dbpath [ 4096 ];
-
-        /* get full path to object */
-        rc = KDirectoryVResolvePath ( self -> wd, true, dbpath, sizeof dbpath, path, args );
-        if ( rc == 0 )
-            rc = KDBManagerWritableInt ( self -> wd, dbpath );
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDBManagerWritable ( const KDBManager *self, const char * path, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, path );
-
-    rc = KDBManagerVWritable ( self, path, args );
-
-    va_end ( args );
-
-    return rc;
-}
-
-/* Lock
- *  apply lock
- *
- *  if object is already locked, the operation is idempotent
- *  and returns an rc state of rcLocked
- *
- *  "path" [ IN ] - NUL terminated path
- */
-LIB_EXPORT rc_t CC KDBManagerVLock ( KDBManager *self, const char *path, va_list args )
-{
-    rc_t rc;
-    char full [ 4096 ];
-
-    if ( self == NULL )
-        rc =  RC ( rcDB, rcMgr, rcLocking, rcSelf, rcNull );
-    else
-    {
-        /* TBD:
-           Add code to validate that this path is not in a container
-           object's control.  That is the last facet in the path
-           is the name of the object.  To be valid the facet before
-           must not be "col", "tbl", or "db" as in those cases
-           the KDBManager should not be called for this object but 
-           its containing object
-        */
-
-        /* get full path to object */
-        rc = KDirectoryVResolvePath ( self -> wd, true,
-            full, sizeof full, path, args );
-        if ( rc == 0 )
-        {
-            /* if the path is not writable because it is already locked
-             * the return from this will contain "rcLocked" and the 
-             * caller will be forced to check for zero or RCState(rcLocked)
-             *
-             * a side effect is that if the call does not return 0 it will
-             * be a wrong type to lock with the DBManager
-             */
-            rc = KDBManagerWritableInt ( self -> wd, full );
-            if ( rc == 0 )
-            {
-                rc = KDBManagerCheckOpen ( self, full );
-                if ( rc == 0 )
-                    rc = KDBLockDir ( self -> wd, full );
-            }
-        }
-
-        /* return dbmgr context */
-        if ( rc != 0 )
-            rc = ResetRCContext ( rc, rcDB, rcMgr, rcLocking );
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDBManagerLock ( KDBManager *self, const char *path, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, path );
-
-    rc = KDBManagerVLock ( self, path, args );
-
-    va_end ( args );
-
-    return rc;
-}
-
-/* Unlock
- *  remove lock
- *
- *  if object is already unlocked, the operation is idempotent
- *  and returns an rc state of rcUnlocked
- *
- *  "path" [ IN ] - NUL terminated path
- */
-LIB_EXPORT rc_t CC KDBManagerVUnlock ( KDBManager *self, const char *path, va_list args )
-{
-    rc_t rc;
-    char full [ 4096 ];
-
-    if ( self == NULL )
-        rc =  RC ( rcDB, rcMgr, rcUnlocking, rcSelf, rcNull );
-    else
-    {
-        /* get full path to object */
-        rc = KDirectoryVResolvePath ( self -> wd, true,
-            full, sizeof full, path, args );
-        if ( rc == 0 )
-        {
-            /* TBD:
-               Add code to validate that this path is not in a container
-               object's control.  That is the last facet in the path
-               is the name of the object.  To be valid the facet before
-               must not be "col", "tbl", or "db" as in those cases
-               the KDBManager should not be called for this object but 
-               its containing object
-            */
-
-            /* if the path is not writable because it is already locked
-             * we attempt to unlock it.
-             *
-             * if the return is 0 from Writable than it was already 
-             * unlocked so we say so and thus again the
-             * the return from this will contain "rcLocked" and the 
-             * caller will be forced to check for zero or RCState(rcUnlocked)
-             *
-             * a side effect is that if the call does not return 0 it will
-             * be a wrong type to lock with the DBManager
-             */
-            rc = KDBManagerWritableInt ( self -> wd, path );
-            if ( rc == 0 )
-                rc = RC ( rcDB, rcMgr, rcUnlocking, rcLock, rcUnlocked );
-            else if ( GetRCState ( rc ) == rcLocked )
-            {
-                rc = KDBManagerCheckOpen ( self, path );
-                if ( rc == 0 )
-                    rc = KDBUnlockDir ( self -> wd, path );
-            }
-        }
-
-        if ( rc != 0 )
-            rc = ResetRCContext ( rc, rcDB, rcMgr, rcUnlocking );
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDBManagerUnlock ( KDBManager *self, const char *path, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, path );
-
-    rc = KDBManagerVUnlock ( self, path, args );
-
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDBManagerVDrop ( KDBManager *self, uint32_t obj_type, const char *path, va_list args )
-{
-    return KDBMgrVDrop ( self -> wd, self, obj_type, path, args );
-}
-
-LIB_EXPORT rc_t CC KDBManagerDrop ( KDBManager *self, uint32_t obj_type, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDBManagerVDrop ( self, obj_type, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-
-/* RunPeriodicTasks
- *  executes periodic tasks, such as cache flushing
- */
-LIB_EXPORT rc_t CC KDBManagerRunPeriodicTasks ( const KDBManager *self )
-{
-    if ( self == NULL )
-        return RC ( rcDB, rcMgr, rcExecuting, rcSelf, rcNull );
-
-    return 0;
-}
-
-/* PathType
- * check the path type of an object/directory path.
- * this is an extension of the KDirectoryPathType and will return
- * the KDirectory values if a path type is not specifically a
- * kdb object
- */
-
-LIB_EXPORT int CC KDBManagerVPathType ( const KDBManager * self, const char *path, va_list args )
-{
-    if ( self != NULL )
-    {
-        char full [ 4096 ];
-        rc_t rc = KDirectoryVResolvePath ( self -> wd, false, full, sizeof full, path, args );
-        if ( rc == 0 )
-            return KDBPathType ( /*self,*/ self -> wd, NULL, full );
-    }
-    return kptBadPath;
-}
-
-
-LIB_EXPORT int CC KDBManagerPathType ( const KDBManager * self, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-
-    rc = KDBManagerVPathType ( self, path, args );
-
-    va_end (args);
-    return rc;
-}
-
diff --git a/libs/kdb/werror-priv.h b/libs/kdb/werror-priv.h
deleted file mode 100644
index a9ae5b0..0000000
--- a/libs/kdb/werror-priv.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_werror_priv_
-#define _h_werror_priv_
-
-#ifndef _h_klib_rc_
-#include <klib/rc.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * RC
- */
-
-/*
-AK: TODO check the fix is correct
-#define kdbReindex RC ( rcDB, rcNoObj, rcCommitting, rcIndex, rcExcessive )
-*/
-
-#define kdbReindex RC ( rcDB, rcNoTarg, rcCommitting, rcIndex, rcExcessive )
-
-#if 0
-    kdbBadBlockSize,
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_werror_priv_ */
diff --git a/libs/kdb/widxblk-priv.h b/libs/kdb/widxblk-priv.h
deleted file mode 100644
index 2187210..0000000
--- a/libs/kdb/widxblk-priv.h
+++ /dev/null
@@ -1,195 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_widxblk_priv_
-#define _h_widxblk_priv_
-
-#ifndef _h_kfs_directory_
-#include <kfs/directory.h>
-#endif
-
-#ifndef _h_colfmt_priv_
-#include "colfmt-priv.h"
-#endif
-
-#ifndef _h_klib_container_
-#include <klib/container.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KColIdxBlock;
-
-
-/*--------------------------------------------------------------------------
- * KColBlockMap
- *  maps an index or page section of block index
- */
-typedef struct KColBlockMap KColBlockMap;
-struct KColBlockMap
-{
-    void ( * trans ) ( KColBlockMap *self, uint32_t idx,
-        uint64_t first, uint32_t span );
-
-    union
-    {
-        /* for assignment and manipulation */
-        void *p;
-        char *c;
-
-        /* type 1 has a constant range/size */
-        uint32_t *span;
-
-        /* type 2 has a predictable id/pos */
-        uint64_t *first;
-
-        /* type 3 has a predictable id/pos and constant range/size */
-        struct
-        {
-            uint64_t pg;
-            uint32_t sz;
-        } *pred;
-
-    } h;
-
-    /* types 0 and 1 have explicit id/pos, where id is ordered */
-    uint64_t *d;
-
-    /* type 2 has explicit range/size */
-    uint32_t *s;
-};
-
-/* SetEntry
- *  sets an entry
- */
-void KColBlockMapSetEntry ( KColBlockMap *self,
-    uint32_t slot, uint64_t first, uint32_t span );
-#define KColBlockMapSetEntry( self, slot, first, span ) \
-    ( * ( self ) -> trans ) ( self, slot, first, span )
-
-
-/*--------------------------------------------------------------------------
- * KColBlockLocInfo
- *  extensions for defining prospective idx2 blocks
- */
-typedef struct KColBlockLocInfo KColBlockLocInfo;
-struct KColBlockLocInfo
-{
-    /* the range of ids in a block */
-    int64_t start_id;
-    int64_t end_id;
-
-    /* the range of data pages */
-    uint64_t start_pg;
-    uint64_t end_pg;
-
-    /* the size of the last blob in block
-       which is the size of them all in the
-       case of pg_type == 2 or 3 */
-    uint32_t size;
-
-    /* the number of entries in block */
-    uint32_t count;
-
-    /* the types */
-    uint16_t id_type;
-    uint16_t pg_type;
-};
-
-/* Merge
- *  calculates the cost of merging two blocks
- *  returns the cost in bytes where a benefit is negative
- *  merges right into left
- */
-int64_t KColBlockLocInfoMerge ( KColBlockLocInfo *left,
-    const KColBlockLocInfo *right );
-
-
-/*--------------------------------------------------------------------------
- * KColWIdxBlock
- *  level 2 index building block
- *
- *  each index block has two sections
- */
-typedef struct KColWIdxBlock KColWIdxBlock;
-struct KColWIdxBlock
-{
-    KColBlockMap id;
-    KColBlockMap pg;
-
-    uint32_t count;
-    uint32_t size;
-
-    /* for assigning */
-    uint32_t idx;
-};
-
-/* Init
- */
-rc_t KColWIdxBlockInit ( KColWIdxBlock *iblk, const KColBlockLocInfo *info );
-
-/* Whack
- */
-void KColWIdxBlockWhack ( KColWIdxBlock *self );
-
-/* SetEntry
- *  sets index and page location information
- */
-void KColWIdxBlockSetEntry ( KColWIdxBlock *self,
-    int64_t start_id, uint32_t span,
-    uint64_t pg, uint32_t sz );
-#if 0
-#define KColWIdxBlockSetEntry( self, start_id, span, pos, sz ) \
-    ( KColBlockMapSetEntry ( & ( self ) -> id, ( self ) -> idx, start_id, span ), \
-      KColBlockMapSetEntry ( & ( self ) -> pg, ( self ) -> idx, pos, sz ), \
-      ( void ) ++ ( self ) -> idx )
-#endif
-
-/* Compress
- *  compress the block
- *  update the BlockLoc
- */
-rc_t KColWIdxBlockCompress ( KColWIdxBlock *self, bool bswap,
-    const KColBlockLocInfo *info, KColBlockLoc *bloc, size_t *to_write );
-
-/* PersistPtr
- *  access the pointer for persisting to disk
- */
-const void *KColWIdxBlockPersistPtr ( const KColWIdxBlock *self,
-    const KColBlockLoc *bloc );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_colidx2_priv_ */
diff --git a/libs/kdb/widxblk.c b/libs/kdb/widxblk.c
deleted file mode 100644
index edac6de..0000000
--- a/libs/kdb/widxblk.c
+++ /dev/null
@@ -1,546 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kdb/extern.h>
-#include "widxblk-priv.h"
-#include "werror-priv.h"
-#include <sysalloc.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <byteswap.h>
-
-
-/*--------------------------------------------------------------------------
- * KColBlockMap
- *  maps an index or page section of block index
- */
-
-/* KColBlockMapSetEntry
- *  sets an entry
- */
-#ifndef KColBlockMapSetEntry
-LIB_EXPORT void CC KColBlockMapSetEntry ( KColBlockMap *self,
-    uint32_t slot, uint64_t first, uint32_t span )
-{
-    ( * self -> trans ) ( self, slot, first, span );
-}
-#endif
-
-static
-void KColBlockMapTrans0 ( KColBlockMap *self, uint32_t idx,
-    uint64_t first, uint32_t span )
-{
-    self -> d [ idx ] = first;
-    self -> s [ idx ] = span;
-}
-
-static
-void KColBlockMapTrans1 ( KColBlockMap *self, uint32_t idx,
-    uint64_t first, uint32_t span )
-{
-    self -> d [ idx ] = first;
-    assert ( idx == 0 || self -> h . span [ 0 ] == span );
-    if ( idx == 0 )
-        self -> h . span [ 0 ] = span;
-}
-
-static
-void KColBlockMapTrans2 ( KColBlockMap *self, uint32_t idx,
-    uint64_t first, uint32_t span )
-{
-    self -> s [ idx ] = span;
-    if ( idx == 0 )
-        self -> h . first [ 0 ] = first;
-}
-
-static
-void KColBlockMapTrans3 ( KColBlockMap *self, uint32_t idx,
-    uint64_t first, uint32_t span )
-{
-    assert ( idx == 0 || self -> h . pred -> sz == span );
-    if ( idx == 0 )
-    {
-        self -> h . pred -> pg = first;
-        self -> h . pred -> sz = span;
-    }
-}
-
-static
-void KColBlockMapTransNull ( KColBlockMap *self, uint32_t idx,
-    uint64_t first, uint32_t span )
-{
-}
-
-static
-void KColBlockMapSwap ( KColBlockMap *self, uint32_t count, int type )
-{
-    uint32_t i;
-
-    switch ( type )
-    {
-    case btypeUniform:
-        self -> h . span [ 0 ] = bswap_32 ( self -> h . span [ 0 ] );
-        break;
-    case btypeMagnitude:
-        self -> h . first [ 0 ] = bswap_64 ( self -> h . first [ 0 ] );
-        break;
-    case btypePredictable:
-        self -> h . pred -> pg = bswap_64 ( self -> h . pred -> pg );
-        self -> h . pred -> sz = bswap_32 ( self -> h . pred -> sz );
-        break;
-    }
-
-    switch ( type )
-    {
-    case btypeRandom:
-    case btypeUniform:
-        for ( i = 0; i < count; ++ i )
-            self -> d [ i ] = bswap_64 ( self -> d [ i ] );
-        break;
-    }
-
-    switch ( type )
-    {
-    case btypeRandom:
-    case btypeMagnitude:
-        for ( i = 0; i < count; ++ i )
-            self -> s [ i ] = bswap_32 ( self -> s [ i ] );
-        break;
-    }
-}
-
-
-/*--------------------------------------------------------------------------
- * KColBlockLocInfo
- *  extensions for defining prospective idx2 blocks
- */
-
-/* MergeIDTest
- *  tests viability of merging two blocks with same id type
- *  returns the required type for merge
- */
-static
-uint32_t KColBlockLocInfoMergeIDTest ( uint32_t id_type,
-    const KColBlockLocInfo *left, const KColBlockLocInfo *right )
-{
-    switch ( id_type )
-    {
-    case btypeRandom:
-        break;
-
-    case btypeUniform:
-        assert ( left -> count != 0 );
-        assert ( right -> count != 0 );
-        if ( ( left -> end_id - left -> start_id ) / left -> count ==
-             ( right -> end_id - right -> start_id ) / right -> count )
-            return btypeUniform;
-        break;
-
-    case btypeMagnitude:
-        if ( left -> end_id == right -> start_id )
-            return btypeMagnitude;
-        break;
-
-    case btypePredictable:
-        assert ( left -> count != 0 );
-        assert ( right -> count != 0 );
-
-        if ( ( left -> end_id - left -> start_id ) / left -> count ==
-             ( right -> end_id - right -> start_id ) / right -> count )
-        {
-            if ( left -> end_id == right -> start_id )
-                return btypePredictable;
-            return btypeUniform;
-        }
-
-        if ( left -> end_id == right -> start_id )
-            return btypeMagnitude;
-        break;
-    }
-
-    return btypeRandom;
-}
-
-/* MergePGTest
- *  tests viability of merging two blocks with same id type
- */
-static
-uint32_t KColBlockLocInfoMergePGTest ( uint32_t pg_type,
-    const KColBlockLocInfo *left, const KColBlockLocInfo *right )
-{
-    switch ( pg_type )
-    {
-    case btypeRandom:
-        break;
-
-    case btypeUniform:
-        if ( left -> size == right -> size )
-            return btypeUniform;
-        break;
-
-    case btypeMagnitude:
-        if ( left -> end_pg == right -> start_pg )
-            return btypeMagnitude;
-        break;
-
-    case btypePredictable:
-        if ( left -> size == right -> size )
-        {
-            if ( left -> end_pg == right -> start_pg )
-                return btypePredictable;
-            return btypeUniform;
-        }
-        if ( left -> end_pg == right -> start_pg )
-            return btypeMagnitude;
-        break;
-    }
-
-    return btypeRandom;
-}
-
-/* ConvertIDCost
- *  measures cost of converting an id type
- */
-static
-int64_t KColBlockLocInfoConvertIDCost ( const KColBlockLocInfo *bloc, uint32_t id_type )
-{
-    size_t cost;
-
-    if ( bloc -> id_type == ( uint16_t ) id_type )
-        return 0;
-
-    switch ( ( id_type << 2 ) | bloc -> id_type )
-    {
-        /* conversions to most expensive type */
-    case ( ( btypeRandom << 2 ) | btypeUniform ):
-        cost = ( ( size_t ) bloc -> count << 2 ) - 4;
-        break;
-    case ( ( btypeRandom << 2 ) | btypeMagnitude ):
-        cost = ( ( size_t ) bloc -> count << 3 ) - 8;
-        break;
-    case ( ( btypeRandom << 2 ) | btypePredictable ):
-        cost = ( size_t ) bloc -> count * 12;
-        break;
-
-        /* other supported conversions */
-    case ( ( btypeUniform << 2 ) | btypePredictable ):
-        cost = ( size_t ) bloc -> count << 3;
-        break;
-    case ( ( btypeMagnitude << 2 ) | btypePredictable ):
-        cost = ( size_t ) bloc -> count << 2;
-        break;
-
-        /* no other conversions are supported */
-    default:
-        return 0xFFFFFFFF;
-    }
-
-    /* consider the conversion done */
-    return cost;
-}
-
-/* ConvertPGCost
- *  measures cost of converting a pg type
- */
-static
-int64_t KColBlockLocInfoConvertPGCost ( const KColBlockLocInfo *bloc, uint32_t pg_type )
-{
-    int64_t cost;
-
-    if ( bloc -> pg_type == ( uint16_t ) pg_type )
-        return 0;
-
-    switch ( ( pg_type << 2 ) | bloc -> pg_type )
-    {
-        /* conversion to most expensive type */
-    case ( ( btypeRandom << 2 ) | btypeUniform ):
-        cost = ( ( uint32_t ) bloc -> count << 2 ) - 4;
-        break;
-    case ( ( btypeRandom << 2 ) | btypeMagnitude ):
-        cost = ( ( uint32_t ) bloc -> count << 3 ) - 8;
-        break;
-    case ( ( btypeRandom << 2 ) | btypePredictable ):
-        cost = ( uint32_t ) ( bloc -> count - 1 ) * 12;
-        break;
-
-        /* other supported conversions */
-    case ( ( btypeUniform << 2 ) | btypePredictable ):
-        cost = ( ( int64_t ) bloc -> count << 3 ) - 12;
-        break;
-    case ( ( btypeMagnitude << 2 ) | btypePredictable ):
-        cost = ( ( int64_t ) bloc -> count << 2 ) - 12;
-        break;
-
-        /* no other conversions are supported */
-    default:
-        return 0xFFFFFFFF;
-    }
-
-    /* consider the conversion done */
-    return cost;
-}
-
-/* Merge
- *  calculates the cost of merging two blocks
- *  returns the cost in bytes where a benefit is negative
- *  merges right into left
- */
-int64_t KColBlockLocInfoMerge ( KColBlockLocInfo *a, const KColBlockLocInfo *b )
-{
-    int64_t cost;
-    uint32_t id_type, pg_type;
-
-    /* calculate optimistic lowest-common types */
-    id_type = ( uint32_t ) a -> id_type & ( uint32_t ) b -> id_type;
-    pg_type = ( uint32_t ) a -> pg_type & ( uint32_t ) b -> pg_type;
-
-    /* test merge of b into a */
-    id_type = KColBlockLocInfoMergeIDTest ( id_type, a, b );
-    pg_type = KColBlockLocInfoMergePGTest ( pg_type, a, b );
-
-    /* calculate cost of type conversion */
-    cost = KColBlockLocInfoConvertIDCost ( a, id_type );
-    cost += KColBlockLocInfoConvertPGCost ( a, pg_type );
-    cost += KColBlockLocInfoConvertIDCost ( b, id_type );
-    cost += KColBlockLocInfoConvertPGCost ( b, pg_type );
-
-    /* perform the merge */
-    a -> end_id = b -> end_id;
-    a -> end_pg = b -> end_pg;
-    a -> count += b -> count;
-    a -> id_type = id_type;
-    a -> pg_type = pg_type;
-
-    /* the resultant block cannot be too large */
-    if ( ( ( a -> end_id - a -> start_id ) >> 32 ) == 0 )
-    {
-        size_t hdr_size_div4 = pg_type;
-        size_t entry_size_div4 = ( id_type ^ 3 ) + ( pg_type ^ 3 );
-        if ( id_type != 3 )
-            hdr_size_div4 += id_type;
-
-        if ( ( hdr_size_div4 + entry_size_div4 * a -> count ) <= ( 0x10000 / 4 ) )
-            return cost - sizeof ( KColBlockLoc );
-    }
-
-    /* too big */
-    return 0xFFFFFFFF;
-}
-
-
-/*--------------------------------------------------------------------------
- * KColWIdxBlock
- *  level 2 index building block
- *
- *  each index block has two sections
- */
-
-/* Init
- */
-rc_t KColWIdxBlockInit ( KColWIdxBlock *iblk, const KColBlockLocInfo *info )
-{
-    /* start out with entry count */
-    int block_size = ( int ) info -> count;
-
-    /* determine block size and write funcs */
-    int id_hsz, id_dsz, id_ssz;
-    int pg_hsz, pg_dsz, pg_ssz;
-    switch ( info -> id_type )
-    {
-    case btypeRandom:
-        iblk -> id . trans = KColBlockMapTrans0;
-        id_hsz = 0;
-        id_dsz = 8;
-        id_ssz = 4;
-        break;
-    case btypeUniform:
-        iblk -> id . trans = KColBlockMapTrans1;
-        id_hsz = 4;
-        id_dsz = 8;
-        id_ssz = 0;
-        break;
-    case btypeMagnitude:
-        iblk -> id . trans = KColBlockMapTrans2;
-        id_hsz = 8;
-        id_dsz = 0;
-        id_ssz = 4;
-        break;
-    case btypePredictable:
-    default: /* to quiet compiler warnings */
-        iblk -> id . trans = KColBlockMapTransNull;
-        id_hsz = 0;
-        id_dsz = 0;
-        id_ssz = 0;
-        break;
-    }
-
-    switch ( info -> pg_type )
-    {
-    case btypeRandom:
-        iblk -> pg . trans = KColBlockMapTrans0;
-        pg_hsz = 0;
-        pg_dsz = 8;
-        pg_ssz = 4;
-        break;
-    case btypeUniform:
-        iblk -> pg . trans = KColBlockMapTrans1;
-        pg_hsz = 4;
-        pg_dsz = 8;
-        pg_ssz = 0;
-        break;
-    case btypeMagnitude:
-        iblk -> pg . trans = KColBlockMapTrans2;
-        pg_hsz = 8;
-        pg_dsz = 0;
-        pg_ssz = 4;
-        break;
-    case btypePredictable:
-    default: /* to quiet compiler warnings */
-        iblk -> pg . trans = KColBlockMapTrans3;
-        pg_hsz = 12;
-        pg_dsz = 0;
-        pg_ssz = 0;
-        break;
-    }
-
-    /* record count */
-    iblk -> count = block_size;
-
-    /* account for the number of entries */
-    id_dsz *= block_size;
-    id_ssz *= block_size;
-    pg_dsz *= block_size;
-    pg_ssz *= block_size;
-
-    /* allocate a block with compression buffer */
-    block_size = id_hsz + id_dsz + id_ssz +
-        pg_hsz + pg_dsz + pg_ssz;
-    iblk -> id . h . p = malloc ( block_size + block_size );
-    if ( iblk -> id . h . p == NULL )
-        return RC ( rcDB, rcIndex, rcConstructing, rcMemory, rcExhausted );
-
-    /* record uncompressed block size */
-    iblk -> size = block_size;
-
-    /* map the block */
-    iblk -> pg . h . c = iblk -> id . h . c + id_hsz;
-    iblk -> id . d = ( uint64_t* ) ( iblk -> pg . h . c + pg_hsz );
-    iblk -> pg . d = ( uint64_t* ) ( ( char* ) iblk -> id . d + id_dsz );
-    iblk -> id . s = ( uint32_t * ) ( ( char* ) iblk -> pg . d + pg_dsz );
-    iblk -> pg . s = ( uint32_t * ) ( ( char* ) iblk -> id . s + id_ssz );
-
-    /* prepare index */
-    iblk -> idx = 0;
-
-    return 0;
-}
-
-/* Whack
- */
-void KColWIdxBlockWhack ( KColWIdxBlock *self )
-{
-    if ( self != NULL )
-        free ( self -> id . h . p );
-}
-
-/* SetEntry
- *  sets index and page location information
- */
-#ifndef KColWIdxBlockSetEntry
-void KColWIdxBlockSetEntry ( KColWIdxBlock *self,
-    int64_t start_id, uint32_t span,
-    uint64_t pg, uint32_t sz )
-{
-    KColBlockMapSetEntry ( & self -> id, self -> idx, start_id, span );
-    KColBlockMapSetEntry ( & self -> pg, self -> idx, pg, sz );
-    ++ self -> idx;
-}
-#endif
-
-/* Compress
- *  compress the block
- *  update the KColBlockLoc
- */
-rc_t KColWIdxBlockCompress ( KColWIdxBlock *self, bool bswap,
-    const KColBlockLocInfo *info, KColBlockLoc *bloc, size_t *to_write )
-{
-    assert ( info -> id_type < 4 );
-    bloc -> u . blk . id_type = ( uint32_t ) info -> id_type;
-
-    assert ( info -> pg_type < 4 );
-    bloc -> u . blk . pg_type = ( uint32_t ) info -> pg_type;
-
-    assert ( ( ( info -> end_id - info -> start_id ) >> 32 ) == 0 );
-    bloc -> id_range = ( uint32_t ) ( info -> end_id - info -> start_id );
-
-    bloc -> start_id = info -> start_id;
-
-    bloc -> pg = 0;
-
-    if ( info -> id_type == btypePredictable &&
-         info -> pg_type == btypePredictable )
-    {
-        assert ( ( self -> count >> 27 ) == 0 );
-        bloc -> u . blk . size = self -> count;
-        bloc -> u . blk . compressed = 0;
-        * to_write = 12;
-
-        if ( bswap )
-        {
-            KColBlockMapSwap ( & self -> id, self -> count, info -> id_type );
-            KColBlockMapSwap ( & self -> pg, self -> count, info -> pg_type );
-        }
-
-        return 0;
-    }
-
-    assert ( ( self -> size >> 27 ) == 0 );
-    bloc -> u . blk . size = self -> size;
-    * to_write = self -> size;
-
-    if ( bswap )
-    {
-        KColBlockMapSwap ( & self -> id, self -> count, info -> id_type );
-        KColBlockMapSwap ( & self -> pg, self -> count, info -> pg_type );
-    }
-
-    /* not compressing today */
-    bloc -> u . blk . compressed = 0;
-    return 0;
-}
-
-/* PersistPtr
- *  access the pointer for persisting to disk
- */
-const void *KColWIdxBlockPersistPtr ( const KColWIdxBlock *self,
-    const KColBlockLoc *bloc )
-{
-    assert ( bloc -> u . blk . compressed == 0 );
-    return self -> id . h . p;
-}
diff --git a/libs/kdb/windex-priv.h b/libs/kdb/windex-priv.h
deleted file mode 100644
index 5b9847d..0000000
--- a/libs/kdb/windex-priv.h
+++ /dev/null
@@ -1,230 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_index_priv_
-#define _h_index_priv_
-
-#ifndef _h_index_cmn_
-#include "index-cmn.h"
-#endif
-
-#ifndef _h_klib_trie_
-#include <klib/trie.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct BSTNode;
-struct KDirectory;
-
-
-/*--------------------------------------------------------------------------
- * V1
- *  version 1 of the trie index was hard-coded to enforce uniqueness of
- *  both the string, and a 32-bit id. furthermore, the id was unfortunately
- *  assumed to occupy a mostly contiguous space, such that the projection
- *  was always implemented as an array of ptrie node ids where the id was
- *  used to index the array.
- *
- *  the introduction of highly sparse ids led to deprecation of this
- *  implementation. see version 2 for further information.
- */
-
-
-/*--------------------------------------------------------------------------
- * KTrieIdxNode_v1
- */
-typedef struct KTrieIdxNode_v1 KTrieIdxNode_v1;
-struct KTrieIdxNode_v1
-{
-    TNode n;
-    uint32_t id;
-    char key [ 1 ];
-};
-
-/*--------------------------------------------------------------------------
- * KTrieIndex_v1
- */
-struct KTrieIndex_v1
-{
-    KPTrieIndex_v1 pt;
-    Trie key2id;
-    KTrieIdxNode_v1 **id2node;
-    uint32_t first;
-    uint32_t last;
-    uint32_t len;
-};
-
-/* insert string into trie, mapping to 32 bit id */
-rc_t KTrieIndexInsert_v1 ( KTrieIndex_v1 *self,
-    bool proj, const char *key, uint32_t id );
-
-/* drop string from trie and all mappings */
-rc_t KTrieIndexDelete_v1 ( KTrieIndex_v1 *self,
-    bool proj, const char *key );
-
-/* persist index to file */
-rc_t KTrieIndexPersist_v1 ( const KTrieIndex_v1 *self,
-    bool proj, struct KDirectory *dir, const char *path, bool use_md5 );
-
-
-/*--------------------------------------------------------------------------
- * V2
- *  version 2 of the trie index was introduced to handle sparse ids,
- *  and to recognize that ids may be 64 bits and/or negative.
- *
- *  v2 introduces strategy identifiers to handle various cases.
- *
- *  CONSTRAINTS
- *  - both key and id are unique ( version 1 )
- *  - key is not unique, but must map to a contiguous range of ids,
- *    while ids are unique ( the main use case for SRA )
- *
- *  INSERTION
- *  - ids are observed in increasing order
- *
- *  PROJECTION
- *  - id range is contiguous or nearly so ( can use single array )
- *  - id range is sparse
- *
- *  the implementation may be extended by adding new strategies,
- *  but the moment the implementation supports 1 to many mappings,
- *  inserted with ids in increasing order, and an unique constraint
- *  on the ids themselves.
- *
- *  the general case for v2 is "key -> id range", where "id range -> key"
- *  is via contiguous array if avg ( id range ) <= 2, and via sparse
- *  array otherwise.
- *
- *  for the key -> id mappings, this means that the in-core node
- *  either retains an id range ( when not using a projection index ),
- *  or it retains a start-id only, since its range can be determined
- *  from the projection index.
- *
- *  for id -> key mappings, the id is first converted to an ordinal, and
- *  the ordinal to a node. when ids are contiguous, id -> ordinal is simply
- *  derived by subtracting the initial start id. when sparse, an id -> ord
- *  array is used in a binary search to produce the ordinal.
- *
- *  ids are assumed to be 64 bit, stored as id - start id, and packed to
- *  a minimum number of bits to represent the id. ptrie node ids are still
- *  32-bit entities.
- */
-
-
-/*--------------------------------------------------------------------------
- * KTrieIdxNode_v2_s1
- *  strategy 1 - store only start id, derive range from proj index
- */
-typedef struct KTrieIdxNode_v2_s1 KTrieIdxNode_v2_s1;
-struct KTrieIdxNode_v2_s1
-{
-    TNode n;
-    int64_t start_id;
-    char key [ 1 ];
-};
-
-/*--------------------------------------------------------------------------
- * KTrieIdxNode_v2_s2
- *  strategy 2 - store complete range when not using proj index
- */
-typedef struct KTrieIdxNode_v2_s2 KTrieIdxNode_v2_s2;
-struct KTrieIdxNode_v2_s2
-{
-    TNode n;
-    int64_t start_id;
-    uint32_t span;
-    char key [ 1 ];
-};
-
-/*--------------------------------------------------------------------------
- * KTrieIndex_v2
- */
-struct KTrieIndex_v2
-{
-    int64_t first, last;
-    KPTrieIndex_v2 pt;
-    Trie key2id;
-    KTrieIdxNode_v2_s1 **ord2node;
-    uint32_t count;
-    uint32_t max_span;
-};
-
-/* cause persisted tree to be loaded into trie */
-rc_t KTrieIndexAttach_v2 ( KTrieIndex_v2 *self, bool proj );
-
-/* insert string into trie, mapping to 64 bit id */
-rc_t KTrieIndexInsert_v2 ( KTrieIndex_v2 *self,
-    bool proj, const char *key, int64_t id );
-
-/* drop string from trie and all mappings */
-rc_t KTrieIndexDelete_v2 ( KTrieIndex_v2 *self,
-    bool proj, const char *key );
-
-/* persist index to file */
-rc_t KTrieIndexPersist_v2 ( const KTrieIndex_v2 *self,
-    bool proj, struct KDirectory *dir, const char *path, bool use_md5 );
-
-
-/*--------------------------------------------------------------------------
- * KU64Index_v3
- */
-struct KU64Index_v3
-{
-    BSTree tree;
-    rc_t rc;
-};
-
-rc_t KU64IndexInsert_v3(KU64Index_v3* self, bool unique, uint64_t key, uint64_t key_size, int64_t id, uint64_t id_qty);
-rc_t KU64IndexDelete_v3(KU64Index_v3* self, uint64_t key);
-
-rc_t KU64IndexPersist_v3(KU64Index_v3* self, bool proj, struct KDirectory *dir, const char *path, bool use_md5);
-
-
-
-/*--------------------------------------------------------------------------
- * KIndex
- *  represents an index
- */
-
-/* Cmp
- * Sort
- */
-int KIndexCmp ( const void *item, struct BSTNode const *n );
-int KIndexSort ( struct BSTNode const *item, struct BSTNode const *n );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_index_priv_ */
diff --git a/libs/kdb/windex.c b/libs/kdb/windex.c
deleted file mode 100644
index 7a3b317..0000000
--- a/libs/kdb/windex.c
+++ /dev/null
@@ -1,1889 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kdb/extern.h>
-
-#include "windex-priv.h"
-#include "dbmgr-priv.h"
-#include "database-priv.h"
-#include "wtable-priv.h"
-#include "wkdb-priv.h"
-#include "kdbfmt-priv.h"
-
-#include <kdb/kdb-priv.h>
-#include <kdb/index.h>
-#include <klib/symbol.h>
-#include <kfs/file.h>
-#include <kfs/mmap.h>
-#include <klib/refcount.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <byteswap.h>
-#include <assert.h>
-
-/*--------------------------------------------------------------------------
- * KIndex
- *  an object capable of mapping an object to integer oid
- */
-
-struct KIndex
-{
-    BSTNode n;
-
-    KDBManager *mgr;
-    KDatabase *db;
-    KTable *tbl;
-    KDirectory *dir;
-
-    KRefcount refcount;
-    uint32_t opencount;
-    uint32_t vers;
-    union
-    {
-        KTrieIndex_v1 txt1;
-        KTrieIndex_v2 txt2;
-        KU64Index_v3  u64_3;
-    } u;
-    bool converted_from_v1;
-    uint8_t type;
-    uint8_t read_only;
-    uint8_t dirty;
-    bool use_md5;
-
-    KSymbol sym;
-
-    char path [ 1 ];
-};
-
-
-/* Whack
- */
-static
-rc_t KIndexWhack ( KIndex *self )
-{
-    rc_t rc;
-    KDBManager *mgr = self -> mgr;
-    KSymbol * symb;
-
-    KRefcountWhack ( & self -> refcount, "KIndex" );
-
-    rc = KIndexCommit( self );
-    if ( rc == 0 )
-    {
-        /* release owner */
-        if ( self -> db != NULL )
-        {
-            rc = KDatabaseSever ( self -> db );
-            if ( rc != 0 )
-                return rc;
-            self -> db = NULL;
-        }
-        else if ( self -> tbl != NULL )
-        {
-            rc = KTableSever ( self -> tbl );
-            if ( rc != 0 )
-                return rc;
-            self -> tbl = NULL;
-        }
-    }
-
-    /* remove from mgr */
-    symb = KDBManagerOpenObjectFind (mgr, self->path);
-    if (symb != NULL)
-    {
-        rc = KDBManagerOpenObjectDelete (mgr, symb);
-        if (rc == 0)
-        {
-            /* release manager
-               should never fail */
-            rc = KDBManagerSever ( mgr );
-            if ( rc != 0 )
-                rc = KDBManagerOpenObjectAdd (mgr, symb);
-            else
-            {
-                self -> mgr = NULL;
-
-                rc = SILENT_RC ( rcDB, rcIndex, rcDestroying, rcIndex, rcBadVersion );
-
-                /* complete */
-                switch ( self -> type )
-                {
-                case kitText:
-                case kitText | kitProj:
-                    switch ( self -> vers )
-                    {
-                    case 1:
-                        KTrieIndexWhack_v1 ( & self -> u . txt1 );
-                        rc = 0;
-                        break;
-                    case 2:
-                    case 3:
-                    case 4:
-                        KTrieIndexWhack_v2 ( & self -> u . txt2 );
-                        rc = 0;
-                        break;
-                    }
-                    break;
-
-                case kitU64:
-                    switch ( self -> vers )
-                    {
-                    case 3:
-                    case 4:
-                        rc = KU64IndexWhack_v3 ( & self -> u . u64_3 );
-                        break;
-                    }
-                    break;
-                }
-            }
-        }
-    }
-    if ( rc == 0 )
-    {
-        KDirectoryRelease ( self -> dir );
-        free ( self );
-    }
-    else
-        KRefcountInit ( & self -> refcount, 1, "KIndex", "whack", "kidx" );
-    return rc;
-}
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-LIB_EXPORT rc_t CC KIndexAddRef ( const KIndex *cself )
-{
-    KIndex *self = ( KIndex* ) cself;
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KIndex" ) )
-        {
-        case krefLimit:
-            return RC ( rcDB, rcIndex, rcAttaching, rcRange, rcExcessive );
-        }
-        ++ self -> opencount;
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KIndexRelease ( const KIndex *cself )
-{
-    KIndex *self = ( KIndex* ) cself;
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KIndex" ) )
-        {
-        case krefWhack:
-            return KIndexWhack ( ( KIndex* ) self );
-        case krefLimit:
-            return RC ( rcDB, rcIndex, rcReleasing, rcRange, rcExcessive );
-        }
-        -- self -> opencount;
-    }
-    return 0;
-}
-
-
-/* Attach
- */
-static
-rc_t KIndexAttach ( KIndex *self, const KMMap *mm, bool *byteswap )
-{
-    size_t size;
-    rc_t rc = KMMapSize ( mm, & size );
-    if ( rc == 0 )
-    {
-        const void *addr;
-        rc = KMMapAddrRead ( mm, & addr );
-        if ( rc == 0 )
-        {
-            union
-            {
-                KIndexFileHeader_v1 v1;
-                KIndexFileHeader_v2 v2;
-                KIndexFileHeader_v3 v3;
-            } hdrs;
-
-            const KDBHdr *hdr = addr;
-            const KIndexFileHeader_v3 *fh = addr;
-
-            * byteswap = false;
-            rc = KDBHdrValidate ( hdr, size, 1, KDBINDEXVERS );
-            if ( GetRCState ( rc ) == rcIncorrect && GetRCObject ( rc ) == rcByteOrder )
-            {
-                hdrs . v1 . endian = bswap_32 ( hdr -> endian );
-                hdrs . v1 . version = bswap_32 ( hdr -> version );
-                rc = KDBHdrValidate ( & hdrs . v1, size, 1, KDBINDEXVERS );
-                if ( rc == 0 )
-                {
-                    * byteswap = true;
-                    switch ( hdrs . v1 . version )
-                    {
-                    case 1:
-                        hdr = & hdrs . v1;
-                        break;
-                    case 2:
-                        hdr = & hdrs . v2;
-                        break;
-                    case 3:
-                    case 4:
-                        hdrs . v3 . index_type = bswap_32 ( fh -> index_type );
-                        hdrs . v3 . reserved1 = bswap_32 ( fh -> reserved1 );
-                        hdr = & hdrs . v3 . h;
-                        fh = & hdrs . v3;
-                        break;
-                    }
-                }
-            }
-            if ( rc == 0 )
-            {
-                self -> vers = hdr -> version;
-                switch ( hdr -> version )
-                {
-                case 1:
-#if KDBINDEXVERS != 1
-                    self -> converted_from_v1 = true;
-#endif
-                case 2:
-                    self -> type = kitText;
-                    break;
-                case 3:
-                case 4:
-                {
-                    self -> type = fh -> index_type;
-                    switch( self->type )
-                    {
-                    case kitText:
-                    case kitU64:
-                        break;
-                    default:
-                        rc = RC(rcDB, rcIndex, rcConstructing, rcIndex, rcUnrecognized);
-                    }
-                    break;
-                }
-                default:
-                    rc = RC(rcDB, rcIndex, rcConstructing, rcIndex, rcBadVersion);
-                }
-            }
-        }
-    }
-    return rc;
-}
-
-/* Sever
- * there is no KIndexSever()
- */
-
-/* Make
- *  make an initialized structure
- *  NB - does NOT attach reference to dir, but steals it
- */
-static
-rc_t KIndexMake ( KIndex **idxp, KDirectory *dir, const char *path )
-{
-    rc_t rc;
-    char fullpath[4096];
-
-    if ( idxp == NULL )
-        rc = RC ( rcDB, rcIndex, rcCreating, rcParam, rcNull );
-    else
-    {
-        if ( dir == NULL )
-            rc = RC ( rcDB, rcIndex, rcCreating, rcDirectory, rcNull );
-        else if ( path == NULL )
-            rc = RC ( rcDB, rcIndex, rcCreating, rcPath, rcNull );
-        else if ( path [ 0 ] == 0 )
-            rc = RC ( rcDB, rcIndex, rcCreating, rcPath, rcEmpty );
-        else
-        {
-            rc = KDirectoryResolvePath(dir, true, fullpath, sizeof(fullpath), path);
-            if (rc == 0)
-            {
-                KIndex* idx = malloc ( sizeof *idx + strlen ( fullpath ) );
-                if ( idx == NULL )
-                    rc = RC ( rcDB, rcIndex, rcConstructing, rcMemory, rcExhausted );
-                else
-                {
-                    memset ( idx, 0, sizeof * idx );
-                    rc = KDirectoryAddRef ( dir );
-                    if ( rc == 0 )
-                    {
-                        idx -> dir = dir;
-                        KRefcountInit ( & idx -> refcount, 1, "KIndex", "make", fullpath );
-                        idx -> opencount = 1;
-
-                        strcpy ( idx -> path, fullpath );
-
-                        idx->sym.u.obj = idx;
-                        idx->sym.dad = NULL;   /* not strictly needed */
-                        StringInitCString (&idx->sym.name, idx->path);
-                        idx->sym.type = kptIndex;
-
-                        * idxp = idx;
-                        return 0;
-                    }
-
-                    free ( idx );
-                }
-            }
-        }
-
-        * idxp = NULL;
-    }
-
-    return rc;
-}
-
-static
-rc_t KDBManagerInsertIndex ( KDBManager * self, KIndex * idx)
-{
-    rc_t rc;
-    rc = KDBManagerOpenObjectAdd (self, &idx->sym);
-    if (rc == 0)
-        idx->mgr = KDBManagerAttach (self);
-    return rc;
-}
-
-static
-rc_t KIndexMakeRead ( KIndex **idxp, const KDirectory *dir, const char *path )
-{
-    const KFile *f;
-    rc_t rc = KDirectoryVOpenFileRead ( dir, & f, path, NULL );
-    if ( rc == 0 )
-    {
-        const KMMap *mm;
-        rc = KMMapMakeRead ( & mm, f );
-        if ( rc == 0 )
-        {
-            rc = KIndexMake ( idxp, ( KDirectory* ) dir, path );
-            if ( rc == 0 )
-            {
-                bool byteswap;
-                KIndex *idx = * idxp;
-                rc = KIndexAttach ( idx, mm, & byteswap );
-                if ( rc == 0 )
-                {
-                    rc = RC ( rcDB, rcIndex, rcConstructing, rcIndex, rcBadVersion );
-                    idx -> read_only = true;
-                    switch ( idx -> vers )
-                    {
-                    case 1:
-                        /* open using v1 code only if KDBINDEXVERS is 1
-                           if 2 or later, open as a v2 index */
-#if KDBINDEXVERS == 1
-                        rc = KTrieIndexOpen_v1 ( & idx -> u . txt1, mm );
-                        if ( rc == 0 )
-                        {
-                            if ( idx -> u . txt1 . pt . id2node != NULL )
-                                idx -> type = ( uint8_t ) ( kitText | kitProj );
-                            else
-                                idx -> type = ( uint8_t ) kitText;
-                        }
-                        break;
-#else
-                    case 2:
-                    case 3:
-                    case 4:
-                        switch(idx->type) {
-                            case kitText:
-                            case kitText | kitProj:
-                                /* will guess version in open */
-                                rc = KTrieIndexOpen_v2 ( & idx -> u . txt2, mm, byteswap );
-                                if( rc == 0 && idx -> u.txt2.pt.ord2node != NULL ) {
-                                    idx -> type |= kitProj;
-                                }
-                                idx -> vers = 3;
-                                break;
-
-                            case kitU64:
-                                rc = KU64IndexOpen_v3(&idx->u.u64_3, mm, byteswap);
-                                break;
-                        }
-                        break;
-#endif
-                    }
-                }
-
-                if ( rc != 0 )
-                    KIndexWhack ( idx );
-            }
-
-            KMMapRelease ( mm );
-        }
-
-        KFileRelease ( f );
-    }
-    return rc;
-}
-
-static
-rc_t KIndexMakeUpdate ( KIndex **idxp, KDirectory *dir, const char *path )
-{
-    const KFile *f;
-    rc_t rc = KDirectoryVOpenFileRead ( dir, & f, path, NULL );
-
-    if ( rc == 0 )
-    {
-        const KMMap *mm;
-        rc = KMMapMakeRead ( & mm, f );
-        if ( rc == 0 )
-        {
-            rc = KIndexMake ( idxp, dir, path );
-            if ( rc == 0 )
-            {
-                bool byteswap;
-                KIndex *idx = * idxp;
-                rc = KIndexAttach ( idx, mm, & byteswap );
-                if ( rc == 0 )
-                {
-                    switch ( idx -> vers )
-                    {
-                    case 1:
-                        /* open using v1 code only if KDBINDEXVERS is 1
-                           if 2 or later, open as a v2 index */
-#if KDBINDEXVERS == 1
-                        rc = KTrieIndexOpen_v1 ( & idx -> u . txt1, mm, byteswap );
-                        if ( rc == 0 )
-                        {
-                            if ( idx -> u . txt1 . pt . id2node != NULL )
-                                idx -> type = ( uint8_t ) ( kitText | kitProj );
-                            else
-                                idx -> type = ( uint8_t ) kitText;
-                        }
-                        break;
-#else
-                    case 2:
-                    case 3:
-                    case 4:
-                        switch(idx->type) {
-                            case kitText:
-                            case kitText | kitProj:
-                                /* will guess version in open */
-                                rc = KTrieIndexOpen_v2 ( & idx -> u . txt2, mm, byteswap );
-                                if ( rc == 0 )
-                                {
-                                    if( idx -> u . txt2 . pt . ord2node != NULL ) {
-                                        idx -> type |= kitProj;
-                                    }
-                                    /* v3 takes over v1 and v2 */
-                                    if( idx->vers < 3 ) {
-                                        idx -> vers = 3;
-                                        /* check for a sparse id space */
-                                        if( idx -> u . txt2 . pt . variant != 0 ) {
-                                            /* try to load existing guy */
-                                            rc = KTrieIndexAttach_v2 ( & idx -> u . txt2,
-                                                          idx -> type != ( uint8_t ) kitText );
-                                            if ( rc == 0 )
-                                                idx -> dirty = true;
-                                        }
-                                    }
-                                }
-                                break;
-
-                            case kitU64:
-                                rc = KU64IndexOpen_v3(&idx->u.u64_3, mm, byteswap);
-                                break;
-                        }
-                        break;
-#endif
-                    default:
-                        rc = RC ( rcDB, rcIndex, rcConstructing, rcIndex, rcBadVersion );
-                    }
-                }
-
-                if ( rc != 0 )
-                    KIndexWhack ( idx );
-            }
-
-            KMMapRelease ( mm );
-        }
-
-        KFileRelease ( f );
-    }
-    return rc;
-}
-
-/* MarkModified
- *  make the index think it has been modified, such that it may be committed
- *  useful when forcing conversion from an older version
- */
-#if KDBINDEXVERS > 1
-LIB_EXPORT rc_t CC KIndexMarkModified ( KIndex *self )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcDB, rcIndex, rcUpdating, rcSelf, rcNull );
-    else if ( self -> read_only )
-        rc = RC ( rcDB, rcIndex, rcUpdating, rcIndex, rcReadonly );
-    else if ( self -> dirty )
-        rc = 0;
-    else switch ( self -> type )
-    {
-    case kitText:
-    case kitText | kitProj:
-        switch ( self -> vers )
-        {
-        default:
-            rc = RC ( rcDB, rcIndex, rcUpdating, rcIndex, rcBadVersion );
-            break;
-        case 1:
-        case 2:
-        case 3:
-        case 4:
-            rc = KTrieIndexAttach_v2 ( & self -> u . txt2,
-                self -> type != ( uint8_t ) kitText );
-            if ( rc == 0 )
-                self -> dirty = true;
-        }
-        break;
-    default:
-        rc = RC ( rcDB, rcIndex, rcUpdating, rcIndex, rcInvalid );
-    }
-
-    return rc;
-}
-#endif
-
-static
-rc_t KIndexCreate ( KIndex **idxp, KDirectory *dir,
-    KIdxType type, KCreateMode cmode, const char *path, int ptype )
-{
-    rc_t rc = 0;
-    KIndex *idx;
-
-    if ( ptype != kptNotFound )
-    {
-        switch ( cmode & kcmValueMask )
-        {
-        case kcmOpen:
-            rc = KIndexMakeUpdate ( idxp, dir, path );
-            if ( rc == 0 )
-            {
-                idx = * idxp;
-                if ( ( KIdxType ) idx -> type != type )
-                {
-                    * idxp = NULL;
-                    KIndexWhack ( idx );
-                    rc = RC ( rcDB, rcIndex, rcConstructing, rcType, rcIncorrect );
-                }
-            }
-            return rc;
-
-        case kcmInit:
-            break;
-
-        case kcmCreate:
-            return RC ( rcDB, rcIndex, rcConstructing, rcIndex, rcExists );
-        }
-    }
-#if KDBINDEXVERS == 1 || KDBIDXVERS == 2
-    else if ( type != kitText && type != ( kitText | kitProj ) )
-    {
-        * idxp = NULL;
-        return RC ( rcDB, rcIndex, rcConstructing, rcType, rcUnsupported );
-    }
-#endif
-
-    rc = KIndexMake ( idxp, dir, path );
-    if ( rc == 0 )
-    {
-        idx = * idxp;
-
-        switch ( type )
-        {
-        case kitText:
-        case kitText | kitProj:
-#if KDBINDEXVERS == 1
-            rc = KTrieIndexOpen_v1 ( & idx -> u . txt1, NULL, false );
-#else
-            rc = KTrieIndexOpen_v2 ( & idx -> u . txt2, NULL, false );
-#endif
-            break;
-
-        case kitU64:
-            rc = KU64IndexOpen_v3 ( & idx->u.u64_3, NULL, false );
-            break;
-
-        default:
-            rc = RC ( rcDB, rcIndex, rcConstructing, rcType, rcUnsupported );
-        }
-
-        if ( rc != 0 )
-        {
-            * idxp = NULL;
-            KIndexWhack ( idx );
-        }
-        else
-        {
-            idx -> vers = KDBINDEXVERS;
-            idx -> type = ( uint8_t ) type;
-        }
-    }
-
-    return rc;
-}
-
-/* CreateIndex
- * VCreateIndex
- *  create a new or open an existing index
- *
- *  "idx" [ OUT ] - return parameter for newly opened index
- *
- *  "cmode" [ IN ] - creation mode
- *
- *  "name" [ IN ] - NUL terminated string in UTF-8 giving simple name of idx
- */
-static
-rc_t KDBManagerCreateIndexInt ( KDBManager *self, KIndex **idxp,
-    KDirectory *wd, KIdxType type, KCreateMode cmode, const char *path, bool use_md5 )
-{
-    rc_t rc;
-    int ptype;
-    char idxpath [ 4096 ];
-
-    rc = KDirectoryVResolvePath ( wd, true,
-        idxpath, sizeof idxpath, path, NULL );
-    if ( rc == 0 )
-    {
-        KIndex *idx;
-        switch ( ptype = KDBPathType ( wd, NULL, idxpath ) )
-        {
-        case kptNotFound:
-            /* first good path */
-            break;
-
-        case kptBadPath:
-            return RC ( rcDB, rcMgr, rcCreating, rcPath, rcInvalid );
-
-        case kptIndex:
-        case kptIndex | kptAlias:
-            /* found so is not good if we want to create new and not
-             * clear/init or open old
-             */
-            if ((cmode & kcmValueMask) == kcmCreate)
-                return RC ( rcDB, rcMgr, rcCreating, rcIndex, rcExists );
-            if (KDBManagerOpenObjectBusy (self, idxpath))
-                return RC ( rcDB, rcMgr, rcCreating, rcIndex, rcBusy );
-
-            /* test now for locked file */
-            rc = KDBWritable ( wd, idxpath );
-            if (rc)
-            {
-                switch (GetRCState(rc))
-                {
-                default:
-                    return rc;
-                case rcLocked:
-                    return RC ( rcDB, rcMgr, rcCreating, rcDatabase, rcLocked );
-                case rcReadonly:
-                    return RC ( rcDB, rcMgr, rcCreating, rcDatabase, rcReadonly );
-                case rcNotFound:
-                    /* not found is good but probably unreachable */
-                    break;
-                case 0:
-                    rc = 0;
-                    break;
-                }
-            }
-            /* second good path */
-            break;
-
-        case kptTable:
-        case kptTable | kptAlias:
-            return RC (rcDB, rcMgr, rcCreating, rcTable, rcExists);
-
-        case kptColumn:
-        case kptColumn | kptAlias:
-            return RC (rcDB, rcMgr, rcCreating, rcColumn, rcExists);
-
-        case kptDatabase:
-        case kptDatabase | kptAlias:
-            return RC (rcDB, rcMgr, rcCreating, rcDatabase, rcExists);
-
-        case kptMetadata:
-        case kptMetadata | kptAlias:
-            return RC (rcDB, rcMgr, rcCreating, rcMetadata, rcExists);
-
-        default:
-            return RC ( rcDB, rcMgr, rcCreating, rcPath, rcIncorrect );
-        }
-
-        rc = KIndexCreate ( & idx, wd, type, cmode, path, ptype );
-        if ( rc == 0 )
-        {
-            rc = KDBManagerInsertIndex (self, idx);
-            if ( rc == 0 )
-            {
-                idx -> use_md5 = use_md5;
-                * idxp = idx;
-                return 0;
-            }
-            
-            KIndexRelease ( idx );
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDatabaseCreateIndex ( struct KDatabase *self, KIndex **idx,
-    KIdxType type, KCreateMode cmode, const char *name, ... )
-{
-    rc_t rc = 0;
-    va_list args;
-
-    va_start ( args, name );
-    rc = KDatabaseVCreateIndex ( self, idx, type, cmode, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDatabaseVCreateIndex ( KDatabase *self, KIndex **idxp,
-    KIdxType type, KCreateMode cmode, const char *name, va_list args )
-{
-    rc_t rc = 0;
-    KDirectory *dir;
-
-    if ( idxp == NULL )
-        return RC ( rcDB, rcDatabase, rcCreating, rcParam, rcNull );
-
-    * idxp = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcDatabase, rcCreating, rcSelf, rcNull );
-
-    if ( self -> read_only )
-        return RC ( rcDB, rcDatabase, rcCreating, rcDatabase, rcReadonly );
-
-    rc = KDirectoryVCreateDir ( self -> dir, 0777, kcmOpen, "idx", NULL );
-    if ( rc == 0 )
-        rc = KDirectoryVOpenDirUpdate ( self -> dir, & dir, false, "idx", NULL );
-    if ( rc == 0 )
-    {
-        char path [ 256 ];
-        rc = KDirectoryVResolvePath ( dir, false, path, sizeof path, name, args );
-        if ( rc == 0 )
-        {
-            rc = KDBManagerCreateIndexInt ( self -> mgr, idxp, dir,
-                type, cmode | kcmParents, path, self -> use_md5 );
-            if ( rc == 0 )
-            {
-                KIndex *idx = * idxp;
-                idx -> db = KDatabaseAttach ( self );
-            }
-        }
-
-        KDirectoryRelease ( dir );
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KTableCreateIndex ( struct KTable *self, KIndex **idx,
-    KIdxType type, KCreateMode cmode, const char *name, ... )
-{
-    rc_t rc = 0;
-    va_list args;
-
-    va_start ( args, name );
-    rc = KTableVCreateIndex ( self, idx, type, cmode, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KTableVCreateIndex ( KTable *self, KIndex **idxp,
-    KIdxType type, KCreateMode cmode, const char *name, va_list args )
-{
-    rc_t rc = 0;
-    KDirectory *dir;
-
-    if ( idxp == NULL )
-        return RC ( rcDB, rcTable, rcCreating, rcParam, rcNull );
-
-    * idxp = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcTable, rcCreating, rcSelf, rcNull );
-
-    if ( self -> read_only )
-        return RC ( rcDB, rcTable, rcCreating, rcTable, rcReadonly );
-
-    rc = KDirectoryVCreateDir ( self -> dir, 0777, kcmOpen, "idx", NULL );
-    if ( rc == 0 )
-        rc = KDirectoryVOpenDirUpdate ( self -> dir, & dir, false, "idx", NULL );
-    if ( rc == 0 )
-    {
-        char path [ 256 ];
-        rc = KDirectoryVResolvePath ( dir, false, path, sizeof path, name, args );
-        if ( rc == 0 )
-        {
-            rc = KDBManagerCreateIndexInt ( self -> mgr, idxp, dir,
-                type, cmode | kcmParents, path, self -> use_md5 );
-            if ( rc == 0 )
-            {
-                KIndex *idx = * idxp;
-                idx -> tbl = KTableAttach ( self );
-            }
-        }
-
-        KDirectoryRelease ( dir );
-    }
-
-    return rc;
-}
-
-
-/* OpenIndexRead
- * VOpenIndexRead
- *  open an index for read
- *
- *  "idx" [ OUT ] - return parameter for newly opened index
- *
- *  "name" [ IN ] - NUL terminated string in UTF-8 giving simple name of idx
- */
-static
-rc_t KDBManagerOpenIndexReadInt ( KDBManager *self,
-    const KIndex **idxp, const KDirectory *wd, const char *path )
-{
-    char idxpath [ 4096 ];
-    rc_t rc = KDirectoryVResolvePath ( wd, true,
-        idxpath, sizeof idxpath, path, NULL );
-    if ( rc == 0 )
-    {
-        KIndex *idx;
-        KSymbol * sym;
-
-        /* if already open */
-        sym = KDBManagerOpenObjectFind (self, idxpath);
-        if (sym != NULL)
-        {
-            const KIndex * cidx;
-            rc_t obj;
-            
-            switch (sym->type)
-            {
-            case kptIndex:
-                cidx = (const KIndex *)sym->u.obj;
-#if 0
-                /* if open for update, refuse */
-                if ( cidx -> read_only )
-#endif
-#if 0
-                if (cidx is coherent)
-#endif
-                {
-                    /* attach a new reference and we're gone */
-                    rc = KIndexAddRef ( cidx );
-                    if ( rc == 0 )
-                        * idxp = cidx;
-                    return rc;
-                }
-                obj = rcDatabase;
-                break;
-                
-            default:
-                obj = rcPath;
-                break;
-            case kptTable:
-                obj = rcTable;
-                break;
-            case kptColumn:
-                obj = rcColumn;
-                break;
-            case kptDatabase:
-                obj = rcDatabase;
-                break;
-            case kptMetadata:
-                obj = rcMetadata;
-                break;
-            }
-            return  RC (rcDB, rcMgr, rcOpening, obj, rcBusy);
-        }
-        
-        switch ( KDirectoryVPathType ( wd, idxpath, NULL ) )
-        {
-        case kptNotFound:
-            return RC ( rcDB, rcMgr, rcOpening, rcIndex, rcNotFound );
-        case kptBadPath:
-            return RC ( rcDB, rcMgr, rcOpening, rcPath, rcInvalid );
-        case kptFile:
-        case kptFile | kptAlias:
-            break;
-        default:
-            return RC ( rcDB, rcMgr, rcOpening, rcPath, rcIncorrect );
-        }
-
-        rc = KIndexMakeRead ( & idx, wd, idxpath );
-        if ( rc == 0 )
-        {
-            idx -> read_only = true;
-            rc = KDBManagerInsertIndex (self, idx);
-            if ( rc == 0 )
-            {
-                * idxp = idx;
-                return 0;
-            }
-
-            KIndexRelease ( idx );
-        }
-    }
-    
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDatabaseOpenIndexRead ( struct KDatabase const *self,
-    const KIndex **idx, const char *name, ... )
-{
-    rc_t rc = 0;
-    va_list args;
-
-    va_start ( args, name );
-    rc = KDatabaseVOpenIndexRead ( self, idx, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDatabaseVOpenIndexRead ( const KDatabase *cself,
-    const KIndex **idxp, const char *name, va_list args )
-{
-    rc_t rc = 0;
-    char path [ 256 ];
-
-    if ( idxp == NULL )
-        return RC ( rcDB, rcDatabase, rcOpening, rcParam, rcNull );
-
-    * idxp = NULL;
-
-    if ( cself == NULL )
-        return RC ( rcDB, rcDatabase, rcOpening, rcSelf, rcNull );
-
-    rc = KDBVMakeSubPath ( cself -> dir,
-        path, sizeof path, "idx", 3, name, args );
-    if ( rc == 0 )
-    {
-        KIndex *idx;
-        rc = KDBManagerOpenIndexReadInt ( cself -> mgr, (const KIndex **)& idx,
-                                          cself -> dir, path );
-        if ( rc == 0 )
-        {
-            KDatabase *self = ( KDatabase* ) cself;
-            idx -> db = KDatabaseAttach ( self );
-            * idxp = idx;
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KTableOpenIndexRead ( struct KTable const *self,
-    const KIndex **idx, const char *name, ... )
-{
-    rc_t rc = 0;
-    va_list args;
-
-    va_start ( args, name );
-    rc = KTableVOpenIndexRead ( self, idx, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KTableVOpenIndexRead ( const KTable *self,
-    const KIndex **idxp, const char *name, va_list args )
-{
-    rc_t rc = 0;
-    char path [ 256 ];
-
-    const char *ns = "idx";
-    uint32_t ns_size = 3;
-
-    if ( idxp == NULL )
-        return RC ( rcDB, rcTable, rcOpening, rcParam, rcNull );
-
-    * idxp = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcTable, rcOpening, rcSelf, rcNull );
-
-    if ( self -> prerelease )
-    {
-        ns = "";
-        ns_size = 0;
-    }
-
-    rc = KDBVMakeSubPath ( self -> dir,
-        path, sizeof path, ns, ns_size, name, args );
-    if ( rc == 0 )
-    {
-        KIndex *idx;
-        rc = KDBManagerOpenIndexReadInt ( self -> mgr, (const KIndex**)& idx,
-                                          self -> dir, path );
-        if ( rc == 0 )
-        {
-            if (idx->tbl != self)
-                idx -> tbl = KTableAttach ( self );
-            * idxp = idx;
-        }
-    }
-    return rc;
-}
-
-
-/* OpenIndexUpdate
- * VOpenIndexUpdate
- *  open an index for read/write
- *
- *  "idx" [ OUT ] - return parameter for newly opened index
- *
- *  "name" [ IN ] - NUL terminated string in UTF-8 giving simple name of idx
- */
-static
-rc_t KDBManagerOpenIndexUpdate ( KDBManager *self,
-    KIndex **idxp, KDirectory *wd, const char *path )
-{
-    char idxpath [ 4096 ];
-    rc_t rc = KDirectoryVResolvePath ( wd, true,
-        idxpath, sizeof idxpath, path, NULL );
-    if ( rc == 0 )
-    {
-        KSymbol * sym;
-        KIndex *idx;
-
-        sym =  KDBManagerOpenObjectFind (self, idxpath);
-        if (sym != NULL)
-        {
-            rc_t obj;
-            switch (sym->type)
-            {
-            default:
-                obj = rcPath;
-                break;
-            case kptDatabase:
-                obj = rcDatabase;
-                break;
-            case kptTable:
-                obj = rcTable;
-                break;
-            case kptColumn:
-                obj = rcColumn;
-                break;
-            case kptIndex:
-                obj = rcIndex;
-                break;
-            case kptMetadata:
-                obj = rcMetadata;
-                break;
-            }
-            return RC ( rcDB, rcMgr, rcOpening, obj, rcBusy );
-        }
-        /* only open existing indices
-         * this seems wrong but its because the KDBPathType seems wrong
-         */
-        switch ( KDirectoryVPathType ( wd, idxpath, NULL ) )
-        {
-        case kptNotFound:
-            return RC ( rcDB, rcMgr, rcOpening, rcIndex, rcNotFound );
-        case kptBadPath:
-            return RC ( rcDB, rcMgr, rcOpening, rcPath, rcInvalid );
-        case kptFile:
-        case kptFile | kptAlias:
-            break;
-        default:
-            return RC ( rcDB, rcMgr, rcOpening, rcPath, rcIncorrect );
-        }
-
-        rc = KIndexMakeUpdate ( & idx, wd, path );
-        if ( rc == 0 )
-        {
-            rc = KDBManagerInsertIndex (self, idx);
-            if ( rc == 0 )
-            {
-                * idxp = idx;
-                return 0;
-            }
-            
-            KIndexRelease ( idx );
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDatabaseOpenIndexUpdate ( struct KDatabase *self,
-    KIndex **idx, const char *name, ... )
-{
-    rc_t rc = 0;
-    va_list args;
-
-    va_start ( args, name );
-    rc = KDatabaseVOpenIndexUpdate ( self, idx, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDatabaseVOpenIndexUpdate ( KDatabase *self,
-    KIndex **idxp, const char *name, va_list args )
-{
-    rc_t rc = 0;
-    KDirectory *dir;
-
-    if ( idxp == NULL )
-        return RC ( rcDB, rcDatabase, rcOpening, rcParam, rcNull );
-
-    * idxp = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcDatabase, rcOpening, rcSelf, rcNull );
-
-    if ( self -> read_only )
-        return RC ( rcDB, rcDatabase, rcOpening, rcDatabase, rcReadonly );
-
-    rc = KDirectoryVOpenDirUpdate ( self -> dir, & dir, false, "idx", NULL );
-    if ( rc == 0 )
-    {
-        char path [ 256 ];
-        rc = KDirectoryVResolvePath ( dir, false, path, sizeof path, name, args );
-        if ( rc == 0 )
-        {
-            rc = KDBManagerOpenIndexUpdate ( self -> mgr, idxp, dir, path );
-            if ( rc == 0 )
-            {
-                KIndex *idx = * idxp;
-                idx -> db = KDatabaseAttach ( self );
-            }
-        }
-
-        KDirectoryRelease ( dir );
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KTableOpenIndexUpdate ( struct KTable *self,
-    KIndex **idx, const char *name, ... )
-{
-    rc_t rc = 0;
-    va_list args;
-
-    va_start ( args, name );
-    rc = KTableVOpenIndexUpdate ( self, idx, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KTableVOpenIndexUpdate ( KTable *self,
-    KIndex **idxp, const char *name, va_list args )
-{
-    rc_t rc = 0;
-    KDirectory *dir;
-
-    if ( idxp == NULL )
-        return RC ( rcDB, rcTable, rcOpening, rcParam, rcNull );
-
-    * idxp = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcTable, rcOpening, rcSelf, rcNull );
-
-    if ( self -> read_only )
-        return RC ( rcDB, rcTable, rcOpening, rcTable, rcReadonly );
-
-    rc = KDirectoryVOpenDirUpdate ( self -> dir, & dir, false, "idx", NULL );
-    if ( rc == 0 )
-    {
-        char path [ 256 ];
-        rc = KDirectoryVResolvePath ( dir, false, path, sizeof path, name, args );
-        if ( rc == 0 )
-        {
-            rc = KDBManagerOpenIndexUpdate ( self -> mgr, idxp, dir, path );
-            if ( rc == 0 )
-            {
-                KIndex *idx = * idxp;
-                idx -> tbl = KTableAttach ( self );
-            }
-        }
-
-        KDirectoryRelease ( dir );
-    }
-    return rc;
-}
-
-
-/* Locked
- *  returns non-zero if locked
- */
-LIB_EXPORT bool CC KIndexLocked ( const KIndex *self )
-{
-    if ( self != NULL )
-    {
-        rc_t rc = KDBWritable ( self -> dir, "" );
-        if (GetRCState ( rc ) == rcLocked)
-            return true;
-    }
-    return false;
-}
-
-
-/* Version
- *  returns the format version
- */
-LIB_EXPORT rc_t CC KIndexVersion ( const KIndex *self, uint32_t *version )
-{
-    if ( version == NULL )
-        return RC ( rcDB, rcIndex, rcAccessing, rcParam, rcNull );
-
-    if ( self == NULL )
-    {
-        * version = 0;
-        return RC ( rcDB, rcIndex, rcAccessing, rcSelf, rcNull );
-    }
-
-    * version = self -> vers;
-    return 0;
-}
-
-
-/* Type
- *  returns the type of index
- */
-LIB_EXPORT rc_t CC KIndexType ( const KIndex *self, KIdxType *type )
-{
-    if ( type == NULL )
-        return RC ( rcDB, rcIndex, rcAccessing, rcParam, rcNull );
-
-    if ( self == NULL )
-    {
-        * type = ( KIdxType ) 0;
-        return RC ( rcDB, rcIndex, rcAccessing, rcSelf, rcNull );
-    }
-
-    * type = ( KIdxType ) self -> type;
-    return 0;
-}
-
-/* Commit
- *  ensure any changes are committed to disk
- */
-LIB_EXPORT rc_t CC KIndexCommit ( KIndex *self )
-{
-    rc_t rc = 0;
-    bool proj;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcIndex, rcCommitting, rcSelf, rcNull );
-
-    if ( ! self -> dirty )
-        return 0;
-
-    rc = RC ( rcDB, rcIndex, rcCommitting, rcType, rcUnsupported );
-
-    proj = ( self -> type & kitProj ) != 0;
-
-    switch ( self -> type )
-    {
-        case kitText:
-        case kitText | kitProj:
-            switch ( self -> vers )
-            {
-            case 1:
-                rc = KTrieIndexPersist_v1 ( & self -> u . txt1,
-                    proj, self -> dir, self -> path, self -> use_md5 );
-                break;
-            case 2:
-            case 3:
-            case 4:
-                rc = KTrieIndexPersist_v2 ( & self -> u . txt2,
-                    proj, self -> dir, self -> path, self -> use_md5 );
-                break;
-            }
-            break;
-
-        case kitU64:
-            switch(self -> vers) {
-            case 3:
-            case 4:
-                rc = KU64IndexPersist_v3(&self->u.u64_3, proj, self->dir,
-                                         self->path, self->use_md5);
-                break;
-            }
-            break;
-    }
-
-    if ( rc == 0 )
-        self -> dirty = false;
-
-    return rc;
-}
-
-/* Insert
- *  creates a mapping from key to id
- *  and potentially from id to key if supported
- *
- *  "unique" [ IN ] - if non zero, key must be unique
- *
- *  "key" [ IN ] - NUL terminated string for text
- *
- *  "id" [ IN ] - id
- */
-LIB_EXPORT rc_t CC KIndexInsertText ( KIndex *self, bool unique,
-    const char *key, int64_t id )
-{
-    rc_t rc = 0;
-    bool proj;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcIndex, rcInserting, rcSelf, rcNull );
-    if ( key == NULL )
-        return RC ( rcDB, rcIndex, rcInserting, rcString, rcNull );
-    if ( key [ 0 ] == 0 )
-        return RC ( rcDB, rcIndex, rcInserting, rcString, rcInvalid );
-    if ( self -> read_only )
-        return RC ( rcDB, rcIndex, rcInserting, rcIndex, rcReadonly );
-
-    proj = false;
-    switch ( self -> type )
-    {
-    case kitText | kitProj:
-        proj = true;
-    case kitText:
-        switch ( self -> vers )
-        {
-        case 1:
-            /* there is a limit on ids in v1 */
-            if ( id <= 0 || ( id >> 32 ) != 0 )
-                return RC ( rcDB, rcIndex, rcInserting, rcId, rcExcessive );
-
-            rc = KTrieIndexInsert_v1 ( & self -> u . txt1,
-                proj, key, ( uint32_t ) id );
-            break;
-        case 2:
-        case 3:
-        case 4:
-            rc = KTrieIndexInsert_v2 ( & self -> u . txt2,
-                proj, key, id );
-            break;
-        default:
-            return RC ( rcDB, rcIndex, rcInserting, rcIndex, rcBadVersion );
-        }
-        break;
-    default:
-        return RC ( rcDB, rcIndex, rcInserting, rcType, rcUnsupported );
-    }
-
-    switch ( GetRCState ( rc ) )
-    {
-    case 0:
-        self -> dirty = true;
-        break;
-    case rcExists:
-        if ( ! unique )
-            rc = RC ( rcDB, rcIndex, rcInserting, rcConstraint, rcViolated );
-    default:
-        break;
-    }
-
-    return rc;
-}
-
-
-/* Delete
- *  deletes all mappings from key
- */
-LIB_EXPORT rc_t CC KIndexDeleteText ( KIndex *self, const char *key )
-{
-    rc_t rc;
-    bool proj;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcIndex, rcRemoving, rcSelf, rcNull );
-    if ( key == NULL )
-        return RC ( rcDB, rcIndex, rcRemoving, rcString, rcNull );
-    if ( key [ 0 ] == 0 )
-        return RC ( rcDB, rcIndex, rcRemoving, rcString, rcInvalid );
-    if ( self -> read_only )
-        return RC ( rcDB, rcIndex, rcRemoving, rcIndex, rcReadonly );
-
-    proj = false;
-    switch ( self -> type )
-    {
-    case kitText | kitProj:
-        proj = true;
-    case kitText:
-        switch ( self -> vers )
-        {
-        case 1:
-            rc = KTrieIndexDelete_v1 ( & self -> u . txt1, proj, key );
-            break;
-        case 2:
-        case 3:
-        case 4:
-            rc = KTrieIndexDelete_v2 ( & self -> u . txt2, proj, key );
-            break;
-        default:
-            return RC ( rcDB, rcIndex, rcRemoving, rcIndex, rcBadVersion );
-        }
-        break;
-    default:
-        return RC ( rcDB, rcIndex, rcRemoving, rcType, rcUnsupported );
-    }
-
-    if ( rc == 0 )
-        self -> dirty = true;
-
-    return rc;
-}
-
-
-/* Find
- *  finds a single mapping from key
- */
-LIB_EXPORT rc_t CC KIndexFindText ( const KIndex *self, const char *key, int64_t *start_id, uint64_t *id_count,
-    int ( CC * custom_cmp ) ( const void *item, struct PBSTNode const *n, void *data ),
-    void *data )
-{
-    rc_t rc = 0;
-    uint32_t id32, span;
-
-    if ( id_count != NULL )
-        * id_count = 0;
-
-    if ( start_id == NULL )
-        return RC ( rcDB, rcIndex, rcSelecting, rcParam, rcNull );
-
-    * start_id = 0;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcIndex, rcSelecting, rcSelf, rcNull );
-    if ( key == NULL )
-        return RC ( rcDB, rcIndex, rcSelecting, rcString, rcNull );
-    if ( key[ 0 ] == 0 )
-        return RC ( rcDB, rcIndex, rcSelecting, rcString, rcInvalid );
-
-    span = 1;
-
-    switch ( self -> type )
-    {
-    case kitText:
-    case kitText | kitProj:
-        switch ( self -> vers )
-        {
-        case 1:
-            rc = KTrieIndexFind_v1 ( & self -> u . txt1, key, & id32, custom_cmp, data );
-            if ( rc == 0 )
-                * start_id = id32;
-            break;
-        case 2:
-        case 3:
-        case 4:
-#if V2FIND_RETURNS_SPAN
-            rc = KTrieIndexFind_v2 ( & self -> u . txt2, key, start_id, & span, custom_cmp, data, self -> converted_from_v1 );
-#else
-            ( void ) ( span = 0 );
-            rc = KTrieIndexFind_v2 ( & self -> u . txt2, key, start_id, custom_cmp, data, self -> converted_from_v1  );
-#endif
-            break;
-        default:
-            return RC ( rcDB, rcIndex, rcSelecting, rcIndex, rcBadVersion );
-        }
-        break;
-    default:
-        return RC ( rcDB, rcIndex, rcSelecting, rcType, rcUnsupported );
-    }
-
-    if ( id_count != NULL )
-        * id_count = span;
-    
-    return rc;
-}
-
-
-/* FindAll
- *  finds all mappings from key
- */
-LIB_EXPORT rc_t CC KIndexFindAllText ( const KIndex *self, const char *key,
-    rc_t ( CC * f ) ( int64_t id, uint64_t id_count, void *data ), void *data )
-{
-    rc_t rc = 0;
-    int64_t id64;
-    uint32_t id32, span;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcIndex, rcSelecting, rcSelf, rcNull );
-    if ( f == NULL )
-        return RC ( rcDB, rcIndex, rcSelecting, rcFunction, rcNull );
-    if ( key == NULL )
-        return RC ( rcDB, rcIndex, rcSelecting, rcString, rcNull );
-    if ( key[ 0 ] == 0 )
-        return RC ( rcDB, rcIndex, rcSelecting, rcString, rcInvalid );
-
-    span = 1;
-
-    switch ( self -> type )
-    {
-    case kitText:
-    case kitText | kitProj:
-        switch ( self -> vers )
-        {
-        case 1:
-            rc = KTrieIndexFind_v1 ( & self -> u . txt1, key, & id32, NULL, NULL );
-            if ( rc == 0 )
-                rc = ( * f ) ( id32, 1, data );
-            break;
-        case 2:
-        case 3:
-        case 4:
-#if V2FIND_RETURNS_SPAN
-            rc = KTrieIndexFind_v2 ( & self -> u . txt2, key, & id64, & span, NULL, NULL, self -> converted_from_v1 );
-#else
-            rc = KTrieIndexFind_v2 ( & self -> u . txt2, key, & id64, NULL, NULL, self -> converted_from_v1 );
-#endif
-            if ( rc == 0 )
-                rc = ( * f ) ( id64, span, data );
-            break;
-        default:
-            return RC ( rcDB, rcIndex, rcSelecting, rcIndex, rcBadVersion );
-        }
-        break;
-    default:
-        return RC ( rcDB, rcIndex, rcSelecting, rcType, rcUnsupported );
-    }
-    
-    return rc;
-}
-
-
-/* Project
- *  finds key(s) mapping to value/id if supported
- */
-LIB_EXPORT rc_t CC KIndexProjectText ( const KIndex *self,
-    int64_t id, int64_t *start_id, uint64_t *id_count,
-    char *key, size_t kmax, size_t *actsize )
-{
-    rc_t rc = 0;
-    int64_t dummy;
-    uint32_t span;
-
-    if ( start_id == NULL )
-        start_id = & dummy;
-
-    * start_id = 0;
-
-    if ( id_count != NULL )
-        * id_count = 0;
-
-    if ( key == NULL && kmax != 0 )
-        return RC ( rcDB, rcIndex, rcProjecting, rcBuffer, rcNull );
-
-    if ( kmax != 0 )
-        key [ 0 ] = 0;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcIndex, rcProjecting, rcSelf, rcNull );
-        
-    if ( ( ( KIdxType ) self -> type & kitProj ) == 0 )
-        return RC ( rcDB, rcIndex, rcProjecting, rcFunction, rcInvalid );
-
-    span = 1;
-
-    switch ( self -> type )
-    {
-    case kitText:
-    case kitText | kitProj:
-        switch ( self -> vers )
-        {
-        case 1:
-            /* there is a limit on ids in v1 */
-            if ( id <= 0 || ( id >> 32 ) != 0 )
-                return RC ( rcDB, rcIndex, rcProjecting, rcId, rcNotFound );
-
-            rc = KTrieIndexProject_v1 ( & self -> u . txt1,
-                    ( uint32_t ) id, key, kmax, actsize );
-            if ( rc == 0 )
-                * start_id = id;
-            break;
-        case 2:
-        case 3:
-        case 4:
-#if V2FIND_RETURNS_SPAN
-            rc = KTrieIndexProject_v2 ( & self -> u . txt2, id, start_id, & span, key, kmax, actsize );
-#else
-            rc = KTrieIndexProject_v2 ( & self -> u . txt2, id, key, kmax, actsize );
-            if ( rc == 0 )
-                * start_id = id;
-#endif
-            break;
-        default:
-            return RC ( rcDB, rcIndex, rcProjecting, rcIndex, rcBadVersion );
-        }
-        break;
-    default:
-        return RC ( rcDB, rcIndex, rcProjecting, rcType, rcUnsupported );
-    }
-
-    if ( id_count != NULL )
-        * id_count = span;
-        
-    return rc;
-}
-
-
-/* ProjectAll
- *  finds key(s) mapping to value/id if supported
- */
-LIB_EXPORT rc_t CC KIndexProjectAllText ( const KIndex *self, int64_t id,
-    rc_t ( CC * f ) ( int64_t start_id, uint64_t id_count, const char *key, void *data ),
-    void *data )
-{
-    rc_t rc = 0;
-    char key [ 256 ];
-
-    uint32_t span;
-    int64_t start_id;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcIndex, rcProjecting, rcSelf, rcNull );
-    if ( f == NULL )
-        return RC ( rcDB, rcIndex, rcProjecting, rcFunction, rcNull );
-    if ( ( ( KIdxType ) self -> type & kitProj ) == 0 )
-        return RC ( rcDB, rcIndex, rcProjecting, rcFunction, rcInvalid );
-        
-    span = 1;
-
-    switch ( self -> type )
-    {
-    case kitText:
-    case kitText | kitProj:
-        switch ( self -> vers )
-        {
-        case 1:
-            /* there is a limit on ids in v1 */
-            if ( id <= 0 || ( id >> 32 ) != 0 )
-                return RC ( rcDB, rcIndex, rcProjecting, rcId, rcNotFound );
-
-            rc = KTrieIndexProject_v1 ( & self -> u . txt1,
-                ( uint32_t ) id, key, sizeof key, NULL );
-            if ( rc == 0 )
-                rc = ( * f ) ( id, 1, key, data );
-            break;
-            
-        case 2:
-        case 3:
-        case 4:
-#if V2FIND_RETURNS_SPAN
-            rc = KTrieIndexProject_v2 ( & self -> u . txt2, id, & start_id, & span, key, sizeof key, NULL );
-#else
-            rc = KTrieIndexProject_v2 ( & self -> u . txt2, id, key, sizeof key, NULL );
-#endif
-            if ( rc == 0 )
-                rc = ( * f ) ( start_id, span, key, data );
-            break;
-            
-        default:
-            return RC ( rcDB, rcIndex, rcProjecting, rcIndex, rcBadVersion );
-        }
-        break;
-    default:
-        return RC ( rcDB, rcIndex, rcProjecting, rcType, rcUnsupported );
-    }
-        
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KIndexInsertU64( KIndex *self, bool unique, uint64_t key, 
-    uint64_t key_size, int64_t id, uint64_t id_qty )
-{
-    rc_t rc = 0;
-
-    if( self == NULL ) {
-        return RC(rcDB, rcIndex, rcInserting, rcSelf, rcNull);
-    }
-    if( self->read_only ) {
-        return RC(rcDB, rcIndex, rcInserting, rcIndex, rcReadonly);
-    }
-
-    switch( self->type )
-    {
-    case kitU64:
-        switch( self->vers )
-        {
-        case 3:
-        case 4:
-            rc = KU64IndexInsert_v3(&self->u.u64_3, unique, key, key_size, id, id_qty );
-            break;
-        default:
-            return RC(rcDB, rcIndex, rcInserting, rcIndex, rcBadVersion);
-        }
-        break;
-        
-    default:
-        return RC(rcDB, rcIndex, rcInserting, rcType, rcUnsupported);
-    }
-
-    switch( GetRCState(rc) ) {
-        case 0:
-            self->dirty = true;
-            break;
-        case rcExists:
-            if( !unique ) {
-                rc = RC(rcDB, rcIndex, rcInserting, rcConstraint, rcViolated);
-            }
-        default:
-            break;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KIndexDeleteU64( KIndex *self, uint64_t key )
-{
-    rc_t rc = 0;
-
-    if( self == NULL ) {
-        return RC(rcDB, rcIndex, rcRemoving, rcSelf, rcNull);
-    }
-    if( self->read_only ) {
-        return RC(rcDB, rcIndex, rcRemoving, rcIndex, rcReadonly);
-    }
-
-    switch( self->type )
-    {
-    case kitU64:
-        switch( self->vers )
-        {
-        case 3:
-        case 4:
-            rc = KU64IndexDelete_v3(&self->u.u64_3, key);
-            break;
-        default:
-            return RC(rcDB, rcIndex, rcRemoving, rcIndex, rcBadVersion);
-        }
-        break;
-    default:
-        return RC(rcDB, rcIndex, rcRemoving, rcType, rcUnsupported);
-    }
-
-    if( rc == 0 ) {
-        self -> dirty = true;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KIndexFindU64( const KIndex* self, uint64_t offset, uint64_t* key, 
-    uint64_t* key_size, int64_t* id, uint64_t* id_qty )
-{
-    rc_t rc = 0;
-
-    if( key == NULL || key_size == NULL || id == NULL || id_qty == NULL ) {
-        return RC(rcDB, rcIndex, rcSelecting, rcParam, rcNull);
-    }
-    *key = *key_size = *id = *id_qty = 0;
-    if( self == NULL ) {
-        return RC(rcDB, rcIndex, rcSelecting, rcSelf, rcNull);
-    }
-
-    switch( self->type )
-    {
-    case kitU64:
-        switch( self->vers )
-        {
-        case 3:
-        case 4:
-            rc = KU64IndexFind_v3(&self->u.u64_3, offset, key, key_size, id, id_qty);
-            break;
-        default:
-            return RC(rcDB, rcIndex, rcSelecting, rcIndex, rcBadVersion);
-        }
-        break;
-    default:
-        return RC(rcDB, rcIndex, rcSelecting, rcType, rcUnsupported);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KIndexFindAllU64( const KIndex* self, uint64_t offset,
-    rc_t ( CC * f )(uint64_t key, uint64_t key_size, int64_t id, uint64_t id_qty, void* data ), void* data)
-{
-    rc_t rc = 0;
-
-    if( self == NULL ) {
-        return RC(rcDB, rcIndex, rcSelecting, rcSelf, rcNull);
-    }
-    if( f == NULL ) {
-        return RC(rcDB, rcIndex, rcSelecting, rcFunction, rcNull);
-    }
-
-    switch( self->type )
-    {
-    case kitU64:
-        switch( self->vers )
-        {
-        case 3:
-        case 4:
-            rc = KU64IndexFindAll_v3(&self->u.u64_3, offset, f, data);
-            break;
-        default:
-            return RC(rcDB, rcIndex, rcSelecting, rcIndex, rcBadVersion);
-        }
-        break;
-    default:
-        return RC(rcDB, rcIndex, rcSelecting, rcType, rcUnsupported);
-    }
-    return rc;
-}
-
-
-/* SetMaxId
- *  certain legacy versions of skey were built to know only the starting id
- *  of the NAME_FMT column, but were never given a maximum id. allow them
- *  to be corrected here.
- */
-LIB_EXPORT void CC KIndexSetMaxRowId ( const KIndex *cself, int64_t max_row_id )
-{
-    if ( cself != NULL ) switch ( cself -> type )
-    {
-    case kitText:
-    case kitText | kitProj:
-        switch ( cself -> vers )
-        {
-        case 2:
-        case 3:
-        case 4:
-            /* here we can repair the max row id */
-            if ( cself -> u . txt2 . pt . maxid < max_row_id )
-                ( ( KIndex* ) cself ) -> u . txt2 . pt . maxid = max_row_id;
-            break;
-        }
-        break;
-    }
-}
diff --git a/libs/kdb/wkdb-priv.h b/libs/kdb/wkdb-priv.h
deleted file mode 100644
index 5f18aba..0000000
--- a/libs/kdb/wkdb-priv.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kdb_priv_
-#define _h_kdb_priv_
-
-#ifndef _h_kdb_manager_
-#include <kdb/manager.h>
-#endif
-
-#ifndef _h_kdb_manager_
-#include <kdb/manager.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * This symbol is inserted where the KDB is being tweaked to allow
- * VFS URI syntax in opening KDB database objects initially to support
- * krypto passwords more fully.  By specifying the password source
- * individually for opens two KDB objects with different passwords can be opened.
- */
-#define SUPPORT_VFS_URI 1
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct BSTree;
-struct BSTNode;
-struct KDirectory;
-struct KDBManager;
-
-/*--------------------------------------------------------------------------
- * KDB utility
- */
-
-
-/* PathType
- *  checks type of path
- *
- * if mgr != NULL we will try accession and uri resolution on path
- */
-int KDBPathTypeDir ( const struct KDirectory *dir, int type,bool *zombies, const char *path );
-int KDBPathType ( const struct KDirectory *dir, bool *zombies, const char *path );
-
-/* OpenPathType
- * Opens a path if it is of the specified type.  Even if it is an archive file
- * instead of a directory.
- *
- * if dpdir is NULL it will not return with an open Directory but it will have
- * checked that the type requested is the type present even if in an archive.
- *
- * if realpathtype is not NULL the found type will be returned regardless
- * of a match to request path type.
- *
- * the return will be zero only if the path does point to a directory or
- * archive that is of the requested type.  An archive will have been opened
- * but reshut if dpdir is NULL.
- */ 
-rc_t KDBOpenPathTypeRead ( const struct KDBManager * mgr, const struct KDirectory * dir, const char * path, 
-    const struct KDirectory ** dpdir, int pathtype, int * realpathtype, bool try_srapath );
-
-/* Writable
- *  examines a directory structure for any "lock" files
- *  examines a file for ( any ) write permission
- */
-bool KDBIsLocked ( const struct KDirectory *dir, const char *path );
-rc_t KDBWritable ( const struct KDirectory *dir, const char *path );
-
-/* Lock
- *  performs directory locking
- */
-rc_t KDBLockDir ( struct KDirectory *dir, const char *path );
-rc_t KDBLockFile ( struct KDirectory *dir, const char *path );
-
-/* Unlock
- *  performs directory unlocking
- */
-rc_t KDBUnlockDir ( struct KDirectory *dir, const char *path );
-rc_t KDBUnlockFile ( struct KDirectory *dir, const char *path );
-
-/* GetObjModDate
- *  extract mod date from a path
- */
-rc_t KDBGetObjModDate ( const struct KDirectory *dir, KTime_t *mtime );
-
-/* GetPathModDate
- *  extract mod date from a path
- */
-rc_t KDBVGetPathModDate ( const struct KDirectory *dir,
-    KTime_t *mtime, const char *path, va_list args );
-
-/* GetNamespaceString
- *  return a static const reference to a string representing 
- *  a namespace for the given kpt<database> type in namespace
- */
-const char * KDBGetNamespaceString ( int namespace );
-
-/* KDBMakeSubPath
- *  adds a namespace to path spec
- */
-rc_t KDBMakeSubPath ( struct KDirectory const *dir,
-    char *subpath, size_t subpath_max, const char *ns,
-    uint32_t ns_size, const char *path, ... );
-/* VMakeSubPath
- *  adds a namespace to path spec
- */
-rc_t KDBVMakeSubPath ( const struct KDirectory *dir,
-    char *subpath, size_t subpath_max, const char *ns,
-    uint32_t ns_size, const char *path, va_list args );
-
-/* VDrop
- */
-rc_t KDBMgrVDrop ( struct KDirectory * dir, const struct KDBManager * mgr, uint32_t obj_type,
-                   const char * path, va_list args );
-rc_t KDBVDrop ( struct KDirectory *dir, const struct KDBManager * mgr,
-    uint32_t type, const char *name, va_list args );
-
-/* Rename
- */
-rc_t KDBRename ( struct KDirectory *dir, struct KDBManager *mgr,
-                 uint32_t type, bool force, const char *from, const char *to );
-
-/* Alias
- */
-rc_t KDBAlias ( struct KDirectory *dir, uint32_t type,
-    const char *targ, const char *alias );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kdb_priv_ */
diff --git a/libs/kdb/wkdb.c b/libs/kdb/wkdb.c
deleted file mode 100644
index 301ec32..0000000
--- a/libs/kdb/wkdb.c
+++ /dev/null
@@ -1,1417 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kdb/extern.h>
-
-#include "wkdb-priv.h"
-#include "kdbfmt-priv.h"
-#include "dbmgr-priv.h"
-
-#include <krypto/key.h>
-#include <krypto/encfile.h>
-#include <krypto/wgaencrypt.h>
-
-#include <vfs/manager.h>
-#include <vfs/path.h>
-#include <vfs/resolver.h>
-#include <vfs/manager-priv.h>
-#include <sra/srapath.h>
-
-#include <kfs/kfs-priv.h>
-#include <kfs/directory.h>
-#include <kfs/file.h>
-#include <kfs/arc.h>
-#include <kfs/tar.h>
-#include <kfs/sra.h>
-#include <kfs/kfs-priv.h>
-#include <klib/container.h>
-#include <klib/text.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <va_copy.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-#include <errno.h>
-
-#ifndef SUPPORT_VFS_URI
-#define SUPPORT_VFS_URI 0
-#endif
-
-/*--------------------------------------------------------------------------
- * (W)KDB utility
- */
-
-/* KDBHdrValidate
- *  validates that a header sports a supported byte order
- *  and that the version is within range
- */
-rc_t KDBHdrValidate ( const KDBHdr *hdr, size_t size,
-    uint32_t min_vers, uint32_t max_vers )
-{
-    assert ( hdr != NULL );
-
-    if ( size < sizeof * hdr )
-        return RC ( rcDB, rcHeader, rcValidating, rcData, rcCorrupt );
-
-    if ( hdr -> endian != eByteOrderTag )
-    {
-        if ( hdr -> endian == eByteOrderReverse )
-            return RC ( rcDB, rcHeader, rcValidating, rcByteOrder, rcIncorrect );
-        return RC ( rcDB, rcHeader, rcValidating, rcData, rcCorrupt );
-    }
-
-    if ( hdr -> version < min_vers || hdr -> version > max_vers )
-        return RC ( rcDB, rcHeader, rcValidating, rcHeader, rcBadVersion );
-
-    return 0;
-}
-
-/* KDBPathType
- *  checks type of path
- */
-enum ScanBits
-{
-    scan_db     = ( 1 <<  0 ),
-    scan_tbl    = ( 1 <<  1 ),
-    scan_idx    = ( 1 <<  2 ),
-    scan_col    = ( 1 <<  3 ),
-    scan_idxN   = ( 1 <<  4 ),
-    scan_data   = ( 1 <<  5 ),
-    scan_dataN  = ( 1 <<  6 ),
-    scan_md     = ( 1 <<  7 ),
-    scan_cur    = ( 1 <<  8 ),
-    scan_rNNN   = ( 1 <<  9 ),
-    scan_lock   = ( 1 << 10 ),
-    scan_odir   = ( 1 << 11 ),
-    scan_ofile  = ( 1 << 12 ),
-    scan_meta   = ( 1 << 13 ),
-    scan_skey   = ( 1 << 14 ),
-    scan_sealed = ( 1 << 15 ),
-    scan_zombie = ( 1 << 16 )
-};
-
-static
-rc_t CC scan_dbdir ( const KDirectory *dir, uint32_t type, const char *name, void *data )
-{
-    uint32_t *bits = data;
-
-    type &= kptAlias - 1;
-
-    if ( type == kptDir )
-    {
-        switch ( name [ 0 ] )
-        {
-        case 'c':
-            if ( strcmp ( name, "col" ) == 0 )
-            { * bits |= scan_col; return 0; }
-            break;
-        case 'm':
-            if ( strcmp ( name, "md" ) == 0 )
-            { * bits |= scan_md; return 0; }
-            break;
-        case 't':
-            if ( strcmp ( name, "tbl" ) == 0 )
-            { * bits |= scan_tbl; return 0; }
-            break;
-        case 'i':
-            if ( strcmp ( name, "idx" ) == 0 )
-            { * bits |= scan_idx; return 0; }
-            break;
-        case 'd':
-            if ( strcmp ( name, "db" ) == 0 )
-            { * bits |= scan_db; return 0; }
-            break;
-        }
-
-        * bits |= scan_odir;
-    }
-    else if ( type == kptFile )
-    {
-        switch ( name [ 0 ] )
-        {
-        case 'l':
-            if ( strcmp ( name, "lock" ) == 0 )
-            { * bits |= scan_lock; return 0; }
-            break;
-        case 'i':
-            if ( memcmp ( name, "idx", 3 ) == 0 )
-            {
-                if ( isdigit ( name [ 3 ] ) )
-                { * bits |= scan_idxN; return 0; }
-            }
-            break;
-        case 'd':
-            if ( memcmp ( name, "data", 4 ) == 0 )
-            {
-                if ( name [ 4 ] == 0 )
-                { * bits |= scan_data; return 0; }
-                if ( isdigit ( name [ 4 ] ) )
-                { * bits |= scan_dataN; return 0; }
-            }
-        case 'c':
-            if ( strcmp ( name, "cur" ) == 0 )
-            { * bits |= scan_cur; return 0; }
-            break;
-        case 'r':
-            if ( isdigit ( name [ 1 ] ) && isdigit ( name [ 2 ] ) &&
-                 isdigit ( name [ 3 ] ) && name [ 4 ] == 0 )
-            { * bits |= scan_rNNN; return 0; }
-            break;
-        case 'm':
-            if ( strcmp ( name, "meta" ) == 0 )
-            { * bits |= scan_meta; return 0; }
-            break;
-        case 's':
-            if ( strcmp ( name, "skey" ) == 0 )
-            { * bits |= scan_skey; return 0; }
-            if ( strcmp ( name, "sealed" ) == 0 )
-            { * bits |= scan_sealed; return 0; }
-            break;
-        }
-
-        * bits |= scan_ofile;
-    }
-    else if (type == kptZombieFile )
-    {
-        * bits |= scan_zombie;
-    }
-    
-    return 0;
-}
-
-const char *KDBGetNamespaceString ( int namespace )
-{
-    static const char * ns_array [] = { NULL, "db", "tbl", "col", "idx", "md" };
-
-    switch (namespace)
-    {
-    default:
-        return ns_array [0];
-    case kptDatabase:
-        return ns_array [1];
-    case kptTable:
-        return ns_array [2];
-    case kptColumn:
-        return ns_array [3];
-    case kptIndex:
-        return ns_array [4];
-    case kptMetadata:
-        return ns_array [5];
-    }
-}
-
-
-int KDBPathTypeDir (const KDirectory * dir, int type, bool * pHasZombies, const char * path)
-{
-    const char * leaf, * parent;
-    uint32_t bits;
-    rc_t rc;
-
-    bits = 0;
-
-    assert ((type == kptDir) || (type == (kptDir|kptAlias)));
-
-    rc = KDirectoryVVisit ( dir, false, scan_dbdir, & bits, path, NULL );
-    if ( rc == 0 ) do
-    {
-        if ( ( bits & scan_zombie ) != 0 ) {
-            bits &= ~scan_zombie;
-            if (pHasZombies)
-                *pHasZombies = true;
-        }
-        /* look for a column */
-        if ( ( bits & scan_idxN ) != 0 &&
-             ( bits & ( scan_data | scan_dataN ) ) != 0 )
-        {
-            if ( ( bits & ( scan_db | scan_tbl | scan_idx | scan_col ) ) == 0 )
-                type += kptColumn - kptDir;
-            break;
-        }
-
-        /* look for a table */
-        if ( ( bits & scan_col ) != 0 )
-        {
-            /* can't have sub-tables or a db */
-            if ( ( bits & ( scan_db | scan_tbl ) ) == 0 )
-            {
-                /* look for an old-structure table */
-                if ( ( bits & ( scan_meta | scan_md ) ) == scan_meta ||
-                     ( bits & ( scan_skey | scan_idx ) ) == scan_skey )
-                    type += kptPrereleaseTbl - kptDir;
-                else
-                    type += kptTable - kptDir;
-            }
-            break;
-        }
-
-        /* look for metadata */
-        if ( ( bits & ( scan_cur | scan_rNNN ) ) != 0 )
-        {
-            if ( ( bits & ( scan_db | scan_tbl | scan_idx | scan_col ) ) == 0 )
-                type += kptMetadata - kptDir;
-            break;
-        }
-
-        /* look for a database */
-        if ( ( bits & scan_tbl ) != 0 )
-        {
-            if ( ( bits & scan_col ) == 0 )
-                type += kptDatabase - kptDir;
-            break;
-        }
-
-        /* look for a structured column */
-        if ( ( bits & scan_odir ) != 0 )
-        {
-            leaf = strrchr ( path, '/' );
-            if ( leaf != NULL )
-            {
-                parent = string_rchr ( path, leaf - path, '/' );
-                if ( parent ++ == NULL )
-                    parent = path;
-                if ( memcmp ( parent, "col/", 4 ) != 0 )
-                    break;
-
-                bits = 0;
-                if ( KDirectoryVVisit ( dir, 1, scan_dbdir, & bits, path, NULL ) == 0 )
-                {
-                    if ( ( bits & scan_idxN ) != 0 &&
-                         ( bits & ( scan_data | scan_dataN ) ) != 0 )
-                    {
-                        if ( ( bits & ( scan_db | scan_tbl | scan_idx | scan_col ) ) == 0 )
-                            type += kptColumn - kptDir;
-                        break;
-                    }
-                }
-            }
-        }
-    } while (0);
-
-    return type;
-}
-
-
-int KDBPathType ( const KDirectory *dir, bool *pHasZombies, const char *path )
-{
-    const char *leaf, *parent;
-
-
-    rc_t rc;
-    int type = KDirectoryVPathType ( dir, path, NULL );
-    
-    if (pHasZombies)
-        *pHasZombies = false;
-
-    switch ( type )
-    {
-    case kptDir:
-    case kptDir | kptAlias:
-        type = KDBPathTypeDir (dir, type, pHasZombies, path);
-        break;
-
-    case kptFile:
-    case kptFile | kptAlias:
-    {
-        /* if we hit a file first try it as an archive */
-        const KDirectory * ldir;
-
-        rc = KDirectoryOpenSraArchiveRead_silent ( dir, &ldir, false, path );
-        if ( rc != 0 )
-            rc = KDirectoryOpenTarArchiveRead_silent ( dir, &ldir, false, path );
-        /* it was an archive so recur */
-        if ( rc == 0 )
-        {
-            /* recheck this newly opened directory for KDB/KFS type */
-            int type2;
-
-            type2 = KDBPathType ( ldir, NULL, "." );
-            if ((type2 != kptDir) || (type != (kptDir|kptAlias)))
-                type = type2;
-
-            KDirectoryRelease (ldir);
-        }
-        /* it was not an archive so see if it it's an idx file */
-        else
-        {
-            leaf = strrchr ( path, '/' );
-            if ( leaf != NULL )
-            {
-                parent = string_rchr ( path, leaf - path, '/' );
-                if ( parent ++ == NULL )
-                    parent = path;
-                if ( memcmp ( parent, "idx/", 4 ) == 0 )
-                    type += kptIndex - kptFile;
-            }
-        }
-        break;
-    }
-    }
-    return type;
-}
-
-
-
-#if SUPPORT_VFS_URI
-#else
-/* return configured password as ASCIZ
- * opertates on vfs/kfs/kfg objects, not kdb objects */
-static
-rc_t KDBOpenFileGetPassword (char * pw, size_t pwz)
-{
-    VFSManager * mgr;
-    rc_t rc;
-
-    assert (pw);
-    assert (pwz);
-
-    pw[0] = '\0';
-
-    rc = VFSManagerMake (&mgr);
-    if (rc)
-        ;                      /* failure to make VFS manager: pass along rc */
-    else
-    {
-        size_t pwfz;
-        char pwf [4096 + 1];
-
-        rc = VFSManagerGetConfigPWFile (mgr, pwf, sizeof (pwf) - 1, &pwfz);
-        if (rc)
-            /* failure to get password file path: tweak rc */
-            rc = RC (rcDB, rcMgr, rcOpening, rcEncryptionKey, rcNotFound);
-
-        else
-        {
-            VPath * pwp;
-
-            pwf [pwfz] = '\0'; /* force to ASCIZ */
-
-#if 0
-            rc = VPathMakeSysPath (&pwp, pwf);
-#else
-            rc = VFSManagerMakePath (mgr, &pwp, pwf);
-#endif
-
-            if (rc)
-                ;       /* failure to construct a path from the string */
-            
-            else
-            {
-                const KFile * pwf;
-          
-                rc = VFSManagerOpenFileRead (mgr, &pwf, pwp);
-                if (rc)
-                    /* failure to open password file */
-                    rc = RC (rcDB, rcMgr, rcOpening, rcEncryptionKey, rcNotOpen);
-
-                else
-                {
-                    size_t z;
-                    char pwb [4098]; /* arbitrarily using 4096 as maximum
-                                        allowed length */
-
-                    /* at this point we are only getting the password from a 
-                     * file but in the future if we can get it from a pipe of
-                     * some sort we can't count on the ReadAll to really know
-                     * if we hit end of file and not just a pause in the
-                     * streaming.  VFS/KFS 2 will have to fix this somehow
-                     */
-
-                    rc = KFileReadAll (pwf, 0, pwb, sizeof pwb, &z);
-                    if (rc)
-                        ;       /* failure to read password file: pass along rc */
-                    else
-                    {
-                        /* trim off EOL if present */
-                        char * pc;
-
-                        pwb[z] = '\0';   /* force ASCIZ */
-
-                        pc = string_chr (pwb, z, '\r');
-                        if (pc)
-                        {
-                            *pc = '\0';
-                            z = 1 + pc - pwb;
-                        }
-                        pc = string_chr (pwb, z, '\n');
-                        if (pc)
-                        {
-                            *pc = '\0';
-                            z = 1 + pc - pwb;
-                        }
-                        if (z == 0)
-                            rc = RC (rcDB, rcMgr, rcOpening, rcEncryptionKey, rcTooShort);
-
-                        else if (pwz < z) /* pwz came in as 4096 */
-                            rc = RC (rcDB, rcMgr, rcOpening, rcEncryptionKey, rcTooLong);
-
-                        else
-                        {
-                            memmove (pw, pwb, z+1);
-                        }
-                    }
-                    KFileRelease (pwf);
-                }
-                VPathRelease (pwp);
-            }
-        }
-        VFSManagerRelease (mgr);
-    }
-    return rc;
-}
-
-
-/* not KDB specific - just uses vfs/krypto/kfs objects */
-static
-rc_t KDBOpenFileAsDirectory (const KDirectory * dir,
-                             const char * path, 
-                             const KDirectory ** pdir,
-                             uint32_t rcobj)
-{
-    const KFile * file;
-    const KFile * f;
-    const KDirectory * ldir;
-    bool encrypted = false;
-
-    rc_t rc;
-
-    *pdir = NULL;
-
-    rc = KDirectoryOpenFileRead (dir, &file, path);
-    if (rc == 0)
-    {
-        rc = KFileRandomAccess(file);
-        if (rc)
-            rc = RC (rcDB, rcMgr, rcOpening, rcobj, rcUnsupported);
-        else
-        {
-            size_t tz;
-            char tbuff [4096];
-            char pbuff [4096 + 1];
-
-            rc = KFileReadAll (file, 0, tbuff, sizeof tbuff, &tz);
-            if (rc == 0)
-            {
-                if (KFileIsEnc (tbuff, tz) == 0)
-                {
-                    encrypted = true;
-
-                    rc = KDBOpenFileGetPassword (pbuff, sizeof (pbuff) - 1);
-                    if (rc == 0)
-                    {
-                        KKey key;
-
-                        rc = KKeyInitRead (&key, kkeyAES128, pbuff, string_size (pbuff));
-                        if (rc == 0)
-                        {
-                            rc = KEncFileMakeRead (&f, file, &key);
-                            if (rc == 0)
-                            {
-                                /* KEncFileMakeRead adds a reference */
-                                KFileRelease (file);
-                                file = f;
-                                rc = KFileReadAll (file, 0, tbuff, sizeof tbuff, &tz);
-                            }
-                        }
-                    }
-                }
-                else if (KFileIsWGAEnc (tbuff, tz) == 0)
-                {
-                    encrypted = true;
-
-                    rc = KDBOpenFileGetPassword (pbuff, sizeof (pbuff) - 1);
-                    if (rc == 0)
-                    {
-                        rc = KFileMakeWGAEncRead (&f, file, pbuff, string_size (pbuff));
-                        if (rc == 0)
-                        {
-                            /* KFileMakeWGAEncRead adds a reference */
-                            KFileRelease (file);
-                            file = f;
-                            rc = KFileReadAll (file, 0, tbuff, sizeof tbuff, &tz);
-                        }
-                    }
-                }
-                /* else not a handled encryption or unencrypted: we can't distinguish too much */
-
-                if (rc == 0)
-                {
-                    if (KFileIsSRA (tbuff, tz) == 0)
-                    {
-                        rc = KDirectoryOpenSraArchiveReadUnbounded_silent_preopened (dir,
-                                                                                     &ldir,
-                                                                                     false,
-                                                                                     file,
-                                                                                     path);
-                    }
-                    else
-                    {
-                        rc = KDirectoryOpenTarArchiveRead_silent_preopened (dir, &ldir, false,
-                                                                            file, path);
-                        if (rc == 0)
-                            KFileRelease (file);
-                    }
-
-                    /* not an archive type we handle or a bad archive */
-                    if (rc)
-                    {
-                        if (encrypted)
-                            rc = RC ( rcDB, rcMgr, rcOpening, rcEncryptionKey, rcIncorrect );
-                        else
-                            rc = RC ( rcDB, rcMgr, rcOpening, rcPath, rcIncorrect );
-                    }
-                    else
-                    {
-                        /*
-                         * release our ownership of the KFile that but archive will 
-                         * keep theirs
-                         */
-                        KFileRelease (file);
-                        *pdir = ldir;
-                        return 0;
-                    }
-                }
-            }
-        }
-        KFileRelease (file);
-    }
-    return rc;
-}
-#endif
-
-
-static rc_t KDBOpenPathTypeReadInt ( const KDBManager * mgr, const KDirectory * dir, const char * path,
-                                     const KDirectory ** pdir, int * type,
-                                     int pathtype, uint32_t rcobj, bool try_srapath )
-{
-    VFSManager * vmgr = mgr->vfsmgr;
-    const KDirectory * ldir = NULL;
-    rc_t rc = 0;
-
-    /* object relative opens can be done using KFS - we hacked in VFS after all */
-    if (! try_srapath)
-    {
-        rc = KDirectoryOpenDirUpdate ((KDirectory*)dir, (KDirectory**)pdir, false, path);
-        if ((rc) && (GetRCState(rc) != rcNotFound))
-            rc = KDirectoryOpenDirRead (dir, pdir, false, path);
-    }
-    else
-    {
-        VPath * vpath;
-
-        /*
-         * We've got to decide if the path coming in is a full or relative
-         * path and if relative make it relative to dir or possibly its a srapath
-         * accession
-         *
-         */
-        rc = VPathMakeDirectoryRelative ( &vpath, dir, path );
-        if ( rc == 0 )
-        {
-            rc = VFSManagerOpenDirectoryReadDirectoryRelativeDecrypt ( vmgr, dir, &ldir, vpath );
-
-            if ( rc == 0 )
-            {
-                *type = (~kptAlias) & KDBPathType ( ldir, NULL, "." );
-
-                /* just a directory, not a kdb type */
-                if ( *type == kptDir )
-                    rc = RC (rcDB, rcMgr, rcOpening, rcPath, rcIncorrect);
-
-                else if ( *type != pathtype )
-                {
-                    KDirectoryRelease( ldir );
-                    rc = RC ( rcDB, rcMgr, rcOpening, rcobj, rcIncorrect );
-                }
-                else
-                {
-                    if ( pdir != NULL )
-                        *pdir = ldir;
-                    else
-                        KDirectoryRelease( ldir );
-                }
-            }
-            VPathRelease ( vpath );
-        }
-    }
-    return rc;
-}
-
-rc_t KDBOpenPathTypeRead ( const KDBManager * mgr, const KDirectory * dir, const char * path, 
-    const KDirectory ** pdir, int pathtype, int * ppathtype, bool try_srapath )
-{
-    const KDirectory *ldir;
-    rc_t rc = 0;
-    uint32_t rcobj;
-    int type = kptNotFound; /* bogus? */
-
-/*     KOutMsg ("%s: %s\n", __func__, path); */
-
-    if ( pdir != NULL )
-        *pdir = NULL;
-    if ( ppathtype != NULL )
-        *ppathtype = type;
-
-    switch (pathtype & ~ kptAlias) /* tune the error message based on path type */
-    {
-        /* we'll hit this if we don't track defines in kdb/manager.h */
-    default:
-        rc = RC (rcDB, rcMgr, rcOpening, rcType, rcInvalid);
-        return rc;
-
-    case kptTable:
-    case kptPrereleaseTbl:
-        rcobj = rcTable;
-        break;
-
-    case kptColumn:
-        rcobj = rcColumn;
-        break;
-
-    case kptDatabase:
-    case kptDatabase | kptAlias:
-        rcobj = rcDatabase;
-        break;
-    }
-
-    rc = KDBOpenPathTypeReadInt( mgr, dir, path, &ldir, &type, pathtype, rcobj, try_srapath );
-
-    if (rc == 0)
-    {
-        if ( ppathtype != NULL )
-            *ppathtype = type;
-
-        if (pdir != NULL)
-            *pdir = ldir;
-        else
-            KDirectoryRelease (ldir);
-    }
-
-    return rc;
-}
-
-
-/* Writable
- *  examines a directory structure for any reason it can't be opened for update
- *  NOTE: will not currently check for archive
- */
-rc_t KDBWritable ( const KDirectory *dir, const char *path )
-{
-    uint32_t access;
-    rc_t rc;
-
-    /* protect us from bad parameters */
-    if (dir == NULL)
-        return RC (rcDB, rcPath, rcAccessing, rcDirectory, rcNull);
-    if (path == NULL)
-        return RC (rcDB, rcPath, rcAccessing, rcPath, rcNull);
-
-    /* we have to be able to check the access if it is to be writable */
-    rc = KDirectoryVAccess ( dir, & access, path, NULL );
-    if ( rc == 0 )
-    {
-        int kpt;
-
-        /* we could use KDBPathType with some modifications */
-        kpt = KDirectoryPathType (dir, path) & ~kptAlias;
-        switch (kpt)
-        {
-        case kptDir:
-            /* if there is a lock (or deprecated sealed) file in this directory */
-            switch ( KDirectoryPathType ( dir, "%s/lock", path ) )
-            {
-            case kptFile:
-            case kptFile | kptAlias:
-                rc = RC (rcDB, rcPath, rcAccessing, rcLock, rcLocked );
-                break;
-            case kptNotFound:
-                /* much simpler handling for the sealed file */
-                switch ( KDirectoryPathType ( dir, "%s/sealed", path ) )
-                {
-                case kptFile:
-                case kptFile | kptAlias:
-                    rc = RC (rcDB, rcPath, rcAccessing, rcLock, rcLocked );
-                    break;
-                case kptNotFound:
-                    if ( ( access & 0222 ) == 0 )
-                        rc = RC (rcDB, rcPath, rcAccessing, rcPath, rcReadonly );
-                    /* else rc is still 0 from VAccess */
-                }
-                break;
-            case kptBadPath:
-                /* likely to be a non-directory or something */
-                rc = RC (rcDB, rcPath, rcAccessing, rcPath, rcInvalid);
-                break;
-            default:
-                /* an illegal type of object named "lock" is in this directory
-                 * which will block the ability to lock it
-                 */
-                rc = RC (rcDB, rcPath, rcAccessing, rcPath, rcUnexpected);
-            }
-            break;
-        case kptFile:
-            /* if there is a lock (or deprecated sealed) file in this directory */
-            switch ( KDirectoryPathType ( dir, "%s.lock", path ) )
-            {
-            case kptFile:
-            case kptFile | kptAlias:
-                rc = RC ( rcDB, rcPath, rcAccessing, rcLock, rcLocked );
-                break;
-            case kptNotFound:
-                break;
-            case kptBadPath:
-                /* unlikely */
-                rc = RC (rcDB, rcPath, rcAccessing, rcPath, rcInvalid);
-                break;
-            default:
-                /* an illegal type of object named "lock" is in this directory
-                 * which will block the ability to lock it
-                 */
-                rc = RC (rcDB, rcPath, rcAccessing, rcPath, rcUnexpected);
-            }
-            break;
-        case kptBadPath:
-            /* likely to be a non-driectory or something */
-            rc = RC ( rcDB, rcPath, rcAccessing, rcPath, rcInvalid);
-            break;
-        default:
-            /* an illegal type of object named "lock" is in this directory
-             * which will block the ability to lock it
-             */
-            rc = RC (rcDB, rcPath, rcAccessing, rcPath, rcUnexpected);
-        }
-    }
-    return rc;
-}
-
-
-bool KDBIsLocked ( const KDirectory *dir, const char *path )
-{
-
-    rc_t rc = KDBWritable (dir, path);
-    if (GetRCState (rc) == rcLocked)
-        return true;
-    return false;
-}
-
-
-/* Lock
- *  performs directory locking
- */
-rc_t KDBLockDir ( KDirectory *dir, const char *path )
-{
-    KFile *f;
-    rc_t rc;
-
-    if (dir == NULL)
-        return RC (rcDB, rcLock, rcLocking, rcDirectory, rcNull);
-    if (path == NULL)
-        return RC (rcDB, rcLock, rcLocking, rcPath, rcNull);
-
-    rc = KDirectoryCreateFile ( dir, & f, 0, 0444, kcmOpen, "%s/lock", path );
-    if ( rc == 0 )
-    {
-        KFileRelease ( f );
-        rc = KDirectoryVSetAccess ( dir, 1, 0, 0222, path, NULL );
-    }
-    return rc;
-}
-
-rc_t KDBLockFile ( KDirectory *dir, const char *path )
-{
-    KFile *f;
-    rc_t rc;
-
-    if (dir == NULL)
-        return RC (rcDB, rcLock, rcLocking, rcDirectory, rcNull);
-    if (path == NULL)
-        return RC (rcDB, rcLock, rcLocking, rcPath, rcNull);
-
-    rc = KDirectoryCreateFile ( dir, & f, false, 0444, kcmOpen, "%s.lock", path );
-    if ( rc == 0 )
-    {
-        KFileRelease ( f );
-        rc = KDirectoryVSetAccess ( dir, 0, 0, 0222, path, NULL );
-    }
-    return rc;
-}
-
-/* Unlock
- *  performs directory unlocking
- */
-static
-rc_t CC KDBUnlockVisitor ( KDirectory *dir, uint32_t type, const char *name, void *data )
-{
-    switch ( type )
-    {
-    case kptFile:
-    case kptFile | kptAlias:
-
-        /* don't ever unlock frozen metadata revisions */
-        if ( name [ 0 ] == 'r' )
-        {
-            char *end;
-            strtoul ( name + 1, & end, 10 );
-            if ( end [ 0 ] == 0 )
-                return 0;
-        }
-
-        return KDirectoryVSetAccess ( dir, false, 0220, 0222, name, NULL );
-
-    case kptDir:
-    case kptDir | kptAlias:
-        if ( KDirectoryPathType ( dir, "%s/lock", name ) == kptNotFound )
-        {
-            rc_t rc = KDirectoryVSetAccess ( dir, 0, 0220, 0222, name, NULL );
-            if ( rc == 0 )
-            {
-                rc = KDirectoryVVisitUpdate ( dir, false,
-                    KDBUnlockVisitor, NULL, name, NULL );
-            }
-            return rc;
-        }
-        break;
-    }
-
-    return 0;
-}
-
-rc_t KDBUnlockDir ( KDirectory *dir, const char *path )
-{
-    /* change directory access bits */
-    rc_t rc;
-
-    if (dir == NULL)
-        return RC (rcDB, rcLock, rcLocking, rcDirectory, rcNull);
-    if (path == NULL)
-        return RC (rcDB, rcLock, rcLocking, rcPath, rcNull);
-
-    rc = KDirectoryVSetAccess ( dir, false, 0220, 0222, path, NULL );
-    if ( rc == 0 )
-    {
-        /* remove lock file */
-        rc = KDirectoryRemove ( dir, false, "%s/lock", path );
-        if ( rc == 0 || GetRCState ( rc ) == rcNotFound )
-            rc = KDirectoryRemove ( dir, false, "%s/sealed", path );
-
-        /* recursively unlock everything underneath
-           that is not itself explicitly locked */
-        if ( rc == 0 || GetRCState ( rc ) == rcNotFound )
-            rc = KDirectoryVVisitUpdate ( dir, false, KDBUnlockVisitor, NULL, path, NULL );
-    }
-    return rc;
-
-}
-
-rc_t KDBUnlockFile ( KDirectory *dir, const char *path )
-{
-    rc_t rc;
-
-    if (dir == NULL)
-        return RC (rcDB, rcLock, rcLocking, rcDirectory, rcNull);
-    if (path == NULL)
-        return RC (rcDB, rcLock, rcLocking, rcPath, rcNull);
-
-    rc = KDirectoryRemove ( dir, true, "%s.lock", path );
-    if ( rc == 0 )
-    {
-        rc = KDirectoryVSetAccess ( dir, false, 0220, 0222, path, NULL );
-    }
-    return rc;
-}
-
-
-/* GetObjModDate
- *  extract mod date from a path
- */
-rc_t KDBGetObjModDate ( const KDirectory *dir, KTime_t *mtime )
-{
-    /* HACK ALERT - there needs to be a proper way to record modification times */
-    
-    /* this only tells the last time the table was locked,
-       which may be close to the last time it was modified */
-    rc_t rc = KDirectoryDate ( dir, mtime, "lock" );
-    if ( rc == 0 )
-        return 0;
-
-    if ( GetRCState ( rc ) == rcNotFound )
-    {
-        rc = KDirectoryDate ( dir, mtime, "sealed" );
-        if ( rc == 0 )
-            return 0;
-    }
-
-    /* get directory timestamp */
-    rc = KDirectoryDate ( dir, mtime, "." );
-    if ( rc == 0 )
-        return 0;
-
-    * mtime = 0;
-    return rc;
-}
-
-/* GetPathModDate
- *  extract mod date from a path
- */
-rc_t KDBVGetPathModDate ( const KDirectory *dir,
-    KTime_t *mtime, const char *path, va_list args )
-{
-    rc_t rc;
-    uint32_t ptype;
-    const KDirectory *obj_dir;
-
-    va_list cpy;
-    va_copy ( cpy, args );
-    ptype = KDirectoryVPathType ( dir, path, cpy );
-    va_end ( cpy );
-
-    switch ( ptype )
-    {
-    case kptDir:
-    case kptDir | kptAlias:
-        break;
-
-    default:
-        return KDirectoryVDate ( dir, mtime, path, args );
-    }
-
-    * mtime = 0;
-    rc = KDirectoryVOpenDirRead ( dir, & obj_dir, true, path, args );
-    if ( rc == 0 )
-    {
-        rc = KDBGetObjModDate ( obj_dir, mtime );
-        KDirectoryRelease ( obj_dir );
-    }
-
-    return rc;
-}
-
-
-/* KDBVMakeSubPath
- *  adds a namespace to path spec
- */
-rc_t KDBVMakeSubPath ( struct KDirectory const *dir,
-    char *subpath, size_t subpath_max, const char *ns,
-    uint32_t ns_size, const char *path, va_list args )
-{
-    rc_t rc;
-
-    if ( ns_size > 0 )
-    {
-        subpath += ns_size + 1;
-        subpath_max -= ns_size + 1;
-    }
-
-#if CRUFTY_USE_OF_RESOLVE_PATH
-    /* because this call only builds a path instead of resolving anything
-     * is is okay that we are using the wrong directory */
-    rc = KDirectoryVResolvePath ( dir, false,
-        subpath, subpath_max, path, args );
-#else
-    {
-        int sz = vsnprintf ( subpath, subpath_max, path, args );
-        if ( sz < 0 || ( size_t ) sz >= subpath_max )
-            rc = RC ( rcDB, rcDirectory, rcResolving, rcBuffer, rcInsufficient );
-        else if ( sz == 0 )
-            rc = RC ( rcDB, rcDirectory, rcResolving, rcPath, rcEmpty );
-        else
-        {
-            rc = 0;
-        }
-    }
-#endif
-    switch ( GetRCState ( rc ) )
-    {
-    case 0:
-        assert ( subpath [ 0 ] != 0 );
-        if ( subpath [ 0 ] == '.' || subpath [ 1 ] == '/' )
-            return RC ( rcDB, rcDirectory, rcResolving, rcPath, rcInvalid );
-        break;
-    case rcInsufficient:
-        return RC ( rcDB, rcDirectory, rcResolving, rcPath, rcExcessive );
-    default:
-        return rc;
-    }
-
-    if ( ns_size != 0 )
-    {
-        subpath -= ns_size + 1;
-        memcpy ( subpath, ns, ns_size );
-        subpath [ ns_size ] = '/';
-    }
-    return 0;
-}
-
-/* KDBMakeSubPath
- *  adds a namespace to path spec
- */
-rc_t KDBMakeSubPath ( struct KDirectory const *dir,
-    char *subpath, size_t subpath_max, const char *ns,
-    uint32_t ns_size, const char *path, ... )
-{
-    rc_t rc = 0;
-    va_list args;
-    va_start(args, path);
-    rc = KDBVMakeSubPath(dir, subpath, subpath_max, ns, ns_size, path, args);
-    va_end(args);
-    return rc;
-}
-
-/* VDrop
- */
-static
-rc_t KDBDropInt ( KDirectory * dir, const KDBManager * mgr,
-                  const char * path )
-{
-    if (KDBManagerOpenObjectBusy (mgr, path))
-        return RC ( rcDB, rcDirectory, rcRemoving, rcPath, rcBusy );
-
-    return KDirectoryVRemove ( dir, 1, path, NULL );
-}
-
-rc_t KDBMgrVDrop ( KDirectory * dir, const KDBManager * mgr, uint32_t obj_type,
-                   const char * path, va_list args )
-{
-    rc_t rc;
-    char full_path [ 4096 ];
-
-    rc = KDirectoryVResolvePath ( dir, true, full_path, sizeof (full_path),
-                                  path, args );
-    if (rc == 0)
-    {
-        int pt = KDBPathType ( /*mgr,*/ dir, NULL, full_path );
-        switch ( pt )
-        {
-        case kptNotFound:
-            return RC ( rcDB, rcDirectory, rcRemoving, rcPath, rcNotFound );
-        case kptBadPath:
-            return RC ( rcDB, rcDirectory, rcRemoving, rcPath, rcInvalid );
-
-        case kptDatabase | kptAlias:
-        case kptTable | kptAlias:
-        case kptIndex | kptAlias:
-        case kptColumn | kptAlias:
-        case kptDatabase:
-        case kptTable:
-        case kptIndex:
-        case kptColumn:
-            /* this really needs a new rcWrongType or similar RCState */
-            if ((obj_type != kptAny) && (obj_type != (pt & ~kptAlias)))
-                return RC ( rcDB, rcDirectory, rcRemoving, rcPath, rcIncorrect );
-            break;
-
-        case kptFile | kptAlias:
-        case kptFile:
-	    /* can we get here?  Will we have needed to open for update to get here? */
-/* 	    rc = KDBOpenPathTypeRead ( dir, path, NULL, type, NULL ); */
-/* 	    if ( rc == 0 ) */
-/*                 return RC ( rcDB, rcDirectory, rcRemoving, rcPath, rcReadonly ); */
-            /* fall through */
-        default:
-            return RC ( rcDB, rcDirectory, rcRemoving, rcPath, rcIncorrect );
-        }
-        if (rc == 0)
-        {
-            rc = KDBDropInt ( dir, mgr, full_path );
-        }
-    }
-    return rc;
-}
-
-
-rc_t KDBVDrop ( KDirectory *dir, const KDBManager * mgr,
-    uint32_t type, const char *name, va_list args )
-{
-    rc_t rc;
-    char path [ 4096 ];
-
-    int ns_size;
-    const char *ns;
-
-    switch ( type )
-    {
-    case kptDatabase:
-        ns = "db"; ns_size = 2; break;
-    case kptTable:
-        ns = "tbl"; ns_size = 3; break;
-    case kptIndex:
-        ns = "idx"; ns_size = 3; break;
-    case kptColumn:
-        ns = "col"; ns_size = 3; break;
-    default:
-        return RC ( rcDB, rcDirectory, rcRemoving, rcType, rcIncorrect );
-    }
-
-    rc = KDBVMakeSubPath ( dir,
-        path, sizeof path, ns, ns_size, name, args );
-    if ( rc == 0 )
-    {
-        int pt = KDBPathType ( /*mgr,*/ dir, NULL, path );
-        switch ( pt )
-        {
-        case kptNotFound:
-            return RC ( rcDB, rcDirectory, rcRemoving, rcPath, rcNotFound );
-        case kptBadPath:
-            return RC ( rcDB, rcDirectory, rcRemoving, rcPath, rcInvalid );
-
-        case kptDatabase | kptAlias:
-        case kptTable | kptAlias:
-        case kptIndex | kptAlias:
-        case kptColumn | kptAlias:
-            pt -= kptAlias;
-
-        case kptDatabase:
-        case kptTable:
-        case kptIndex:
-        case kptColumn:
-            if ( pt == type )
-                break;
-
-        case kptFile | kptAlias:
-        case kptFile:
-	    /* can we get here?  Will we have needed to open for update to get here? */
-	    rc = KDBOpenPathTypeRead ( mgr, dir, path, NULL, type, NULL, false );
-	    if ( rc == 0 )
-                return RC ( rcDB, rcDirectory, rcRemoving, rcPath, rcReadonly );
-            /* fall through */
-        default:
-            return RC ( rcDB, rcDirectory, rcRemoving, rcPath, rcIncorrect );
-        }
-
-        rc = KDirectoryVResolvePath ( dir, true, path, sizeof path, path, NULL );
-        if ( rc == 0 )
-        {
-            rc = KDBWritable ( dir, "." );
-            switch (GetRCState(rc))
-            {
-            default:
-                rc = RC ( rcDB, rcDirectory, rcRemoving, rcTable, rcUnexpected );
-                break;
-            case rcLocked:
-                rc = RC ( rcDB, rcDirectory, rcRemoving, rcTable, rcLocked );
-                break;
-            case rcReadonly:
-                rc = RC ( rcDB, rcDirectory, rcRemoving, rcTable, rcReadonly );
-                break;
-            case 0:
-                rc = KDBDropInt ( dir, mgr, path );                
-                break;
-            }
-        }
-    }
-
-    return rc;
-}
-
-/* Rename
- */
-rc_t KDBRename ( KDirectory *dir, KDBManager *mgr, uint32_t type, bool force,
-    const char *from, const char *to )
-{
-    rc_t rc;
-    char src [ 4096 ];
-
-    int ns_size;
-    const char *ns;
-
-    switch ( type )
-    {
-    case kptDatabase:
-        ns = "db"; ns_size = 2; break;
-    case kptTable:
-        ns = "tbl"; ns_size = 3; break;
-    case kptIndex:
-        ns = "idx"; ns_size = 3; break;
-    case kptColumn:
-        ns = "col"; ns_size = 3; break;
-    default:
-        return RC ( rcDB, rcDirectory, rcRenaming, rcType, rcIncorrect );
-    }
-
-    rc = KDBMakeSubPath ( dir,
-        src, sizeof src, ns, ns_size, from);
-    if ( rc == 0 )
-    {
-        char dst [ 256 ];
-        int pt = KDBPathType ( /*mgr,*/ dir, NULL, src );
-        switch ( pt )
-        {
-        case kptNotFound:
-            return RC ( rcDB, rcDirectory, rcRenaming, rcPath, rcNotFound );
-        case kptBadPath:
-            return RC ( rcDB, rcDirectory, rcRenaming, rcPath, rcInvalid );
-
-        case kptDatabase | kptAlias:
-        case kptTable | kptAlias:
-        case kptIndex | kptAlias:
-        case kptColumn | kptAlias:
-            pt -= kptAlias;
-
-        case kptDatabase:
-        case kptTable:
-        case kptIndex:
-        case kptColumn:
-            if ( pt == type )
-                break;
-
-        default:
-            return RC ( rcDB, rcDirectory, rcRenaming, rcPath, rcIncorrect );
-        }
-
-        rc = KDBMakeSubPath ( dir,
-            dst, sizeof dst, ns, ns_size, to );
-        if ( rc == 0 )
-        {
-            if ( KDirectoryVPathType ( dir, dst, NULL ) != kptNotFound )
-                return RC ( rcDB, rcDirectory, rcRenaming, rcPath, rcIncorrect );
-
-            rc = KDirectoryVResolvePath ( dir, 1, src, sizeof src, src, NULL );
-            if ( rc == 0 )
-            {
-                if (KDBManagerOpenObjectBusy (mgr, src))
-                    return RC ( rcDB, rcDirectory, rcRenaming, rcPath, rcBusy );
-                if (KDBManagerOpenObjectBusy (mgr, dst))
-                    return RC ( rcDB, rcDirectory, rcRenaming, rcPath, rcBusy );
-
-                rc = KDBWritable ( dir, "." );
-                switch (GetRCState(rc))
-                {
-                default:
-                    rc = RC ( rcDB, rcDirectory, rcRenaming, rcTable, rcUnexpected );
-                    break;
-                case rcLocked:
-                    rc = RC ( rcDB, rcDirectory, rcRenaming, rcTable, rcLocked );
-                    break;
-                case rcReadonly:
-                    rc = RC ( rcDB, rcDirectory, rcRenaming, rcTable, rcReadonly );
-                    break;
-                case 0:
-                    rc = KDirectoryRename ( dir, force, src, dst );
-                    break;
-                }
-            }
-        }
-    }
-
-    return rc;
-}
-
-/* Alias
- */
-rc_t KDBAlias ( KDirectory *dir, uint32_t type,
-    const char *targ, const char *alias )
-{
-    rc_t rc;
-    char src [ 256 ];
-
-    int ns_size;
-    const char *ns;
-
-    switch ( type )
-    {
-    case kptDatabase:
-        ns = "db"; ns_size = 2; break;
-    case kptTable:
-        ns = "tbl"; ns_size = 3; break;
-    case kptIndex:
-        ns = "idx"; ns_size = 3; break;
-    case kptColumn:
-        ns = "col"; ns_size = 3; break;
-    default:
-        return RC ( rcDB, rcDirectory, rcAliasing, rcType, rcIncorrect );
-    }
-
-    rc = KDBMakeSubPath ( dir,
-        src, sizeof src, ns, ns_size, targ );
-    if ( rc == 0 )
-    {
-        char dst [ 256 ];
-        int pt = KDBPathType ( /*NULL,*/ dir, NULL, src );
-        switch ( pt )
-        {
-        case kptNotFound:
-            return RC ( rcDB, rcDirectory, rcAliasing, rcPath, rcNotFound );
-        case kptBadPath:
-            return RC ( rcDB, rcDirectory, rcAliasing, rcPath, rcInvalid );
-
-        case kptDatabase | kptAlias:
-        case kptTable | kptAlias:
-        case kptIndex | kptAlias:
-        case kptColumn | kptAlias:
-            pt &= ~ kptAlias;
-
-        case kptDatabase:
-        case kptTable:
-        case kptIndex:
-        case kptColumn:
-            if ( pt == type )
-                break;
-
-        default:
-            return RC ( rcDB, rcDirectory, rcAliasing, rcPath, rcIncorrect );
-        }
-
-        rc = KDBMakeSubPath ( dir,
-            dst, sizeof dst, ns, ns_size, alias );
-        if ( rc == 0 )
-        {
-            rc = KDirectoryCreateAlias ( dir,
-                0775, kcmCreate, src, dst );
-        }
-    }
-
-    return rc;
-}
-
-
-/* KDBIsPathUri
- * A hack to get some of VFS into KDB that is too tightly bound to KFS
- */
-
-bool KDBIsPathUri (const char * path)
-{
-    const char * pc;
-    size_t z;
-
-    z = string_size (path);
-
-    if (NULL != (pc = string_chr (path, z, ':')))
-        return true;
-
-    if (NULL != (pc = string_chr (path, z, '?')))
-        return true;
-
-    if (NULL != (pc = string_chr (path, z, '#')))
-        return true;
-
-    return false;
-}
diff --git a/libs/kdb/wmeta.c b/libs/kdb/wmeta.c
deleted file mode 100644
index dd094c4..0000000
--- a/libs/kdb/wmeta.c
+++ /dev/null
@@ -1,3526 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#define TRACK_REFERENCES 0
-
-struct KMDataNodeNamelist;
-#define KNAMELIST_IMPL struct KMDataNodeNamelist
-
-#include <kdb/extern.h>
-#include "wkdb-priv.h"
-#include "dbmgr-priv.h"
-#include "database-priv.h"
-#include "wtable-priv.h"
-#include "wcolumn-priv.h"
-#include "kdbfmt-priv.h"
-
-#include <kdb/meta.h>
-#include <kdb/namelist.h>
-#include <klib/container.h>
-#include <klib/pbstree.h>
-#include <klib/namelist.h>
-#include <klib/impl.h>
-#include <kfs/file.h>
-#include <kfs/mmap.h>
-#include <kfs/md5.h>
-#include <klib/symbol.h>
-#include <klib/refcount.h>
-#include <klib/debug.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <atomic.h>
-#include <os-native.h>
-#include <sysalloc.h>
-#include <strtol.h>
-
-#ifndef TRACK_REFERENCES
-#define TRACK_REFERENCES 0
-#endif
-
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <byteswap.h>
-#include <assert.h>
-
-#define KMETADATAVERS 2
-#define NODE_SIZE_LIMIT ( 25 * 1024 * 1024 )
-#define NODE_CHILD_LIMIT ( 100 * 1024 )
-
-
-typedef struct KMDataNodeInflateData KMDataNodeInflateData;
-struct KMDataNodeInflateData
-{
-    KMetadata *meta;
-    KMDataNode *par;
-    BSTree *bst;
-    size_t node_size_limit;
-    uint32_t node_child_limit;
-    rc_t rc;
-    bool byteswap;
-};
-
-/*--------------------------------------------------------------------------
- * KMetadata
- *  a versioned, hierarchical structure
- */
-struct KMetadata
-{
-    BSTNode n;
-
-    KDirectory *dir;
-    KDBManager *mgr;
-
-    /* owner */
-    KDatabase *db;
-    KTable *tbl;
-    KColumn *col;
-
-    KMD5SumFmt * md5;
-
-    /* root node */
-    KMDataNode *root;
-
-    KSymbol sym;
-
-    KRefcount refcount;
-    uint32_t opencount;
-    uint32_t vers;
-    uint32_t rev;
-    uint8_t read_only;
-    uint8_t dirty;
-    bool byteswap;
-
-    char path [ 1 ];
-};
-
-static
-KMetadata *KMetadataAttach ( const KMetadata *self );
-
-static
-rc_t KMetadataSever ( const KMetadata *self );
-
-
-/*--------------------------------------------------------------------------
- * KMAttrNode
- */
-typedef struct KMAttrNode KMAttrNode;
-struct KMAttrNode
-{
-    BSTNode n;
-    void *value;
-    size_t vsize;
-    char name [ 1 ];
-};
-
-static
-int CC KMAttrNodeCmp ( const void *item, const BSTNode *n )
-{
-#define a ( ( const char* ) item )
-#define b ( ( const KMAttrNode* ) n )
-
-    return strcmp ( a, b -> name );
-
-#undef a
-#undef b
-}
-
-static
-int CC KMAttrNodeSort ( const BSTNode *item, const BSTNode *n )
-{
-#define a ( ( const KMAttrNode* ) item )
-#define b ( ( const KMAttrNode* ) n )
-
-    return strcmp ( a -> name, b -> name );
-
-#undef a
-#undef b
-}
-
-static
-void CC KMAttrNodeWhack ( BSTNode *n, void *data )
-{
-    free ( n );
-}
-
-static
-bool CC KMAttrNodeInflate ( PBSTNode *n, void *data )
-{
-    KMAttrNode *b;
-    KMDataNodeInflateData *pb = data;
-
-    const char *name = n -> data . addr;
-    size_t size = strlen ( name );
-    if ( size >= n -> data . size )
-    {
-        pb -> rc = RC ( rcDB, rcMetadata, rcConstructing, rcData, rcCorrupt );
-        return true;
-    }
-
-    /* v2 attributes are more easily allocated
-       as a single (name,value) block because
-       there are no other associated structures */
-    b = malloc ( sizeof * b + n -> data . size );
-    if ( b == NULL )
-    {
-        pb -> rc = RC ( rcDB, rcMetadata, rcConstructing, rcMemory, rcExhausted );
-        return true;
-    }
-
-    b -> value = & b -> name [ 1 + size ];
-    b -> vsize = n -> data . size - size - 1;
-    memcpy ( b -> name, name, n -> data . size );
-    BSTreeInsert ( pb -> bst, & b -> n, KMAttrNodeSort );
-    return false;
-}
-
-static
-rc_t KMAttrNodeRename ( const KMAttrNode *self,
-    KMAttrNode **renamed, const char *name )
-{
-    size_t size = strlen ( name );
-    KMAttrNode *b = malloc ( sizeof * b + self -> vsize + size );
-    if ( b == NULL )
-        return RC ( rcDB, rcNode, rcRenaming, rcMemory, rcExhausted );
-
-    b -> value = & b -> name [ 1 + size ];
-    b -> vsize = self -> vsize;
-    strcpy ( b -> name, name );
-    memcpy ( b -> value, self -> value, self -> vsize );
-    * renamed = b;
-    return 0;
-}
-
-static
-rc_t KMAttrNodeMake ( KMAttrNode **np,
-    const char *name, const void *value, size_t vsize )
-{
-    size_t size = strlen ( name );
-    KMAttrNode *n = malloc ( sizeof * n + vsize + size );
-    if ( n == NULL )
-        return RC ( rcDB, rcNode, rcConstructing, rcMemory, rcExhausted );
-
-    n -> value = & n -> name [ 1 + size ];
-    n -> vsize = vsize;
-    strcpy ( n -> name, name );
-    if ( vsize != 0 )
-        memcpy ( n -> value, value, vsize );
-    * np = n;
-    return 0;
-}
-
-
-/*--------------------------------------------------------------------------
- * KMDataNode
- *  a node with an optional value,
- *  optional attributes, and optional children
- *
- *  nodes are identified by path, relative to a starting node,
- *  where "/" serves as a path separator.
- */
-struct KMDataNode
-{
-    BSTNode n;
-    KMDataNode *par;
-    KMetadata *meta;
-    void *value;
-    size_t vsize;
-    BSTree attr;
-    BSTree child;
-    KRefcount refcount;
-    uint8_t read_only;
-    char name [ 1 ];
-};
-
-static
-int CC KMDataNodeCmp ( const void *item, const BSTNode *n )
-{
-#define a ( ( const char* ) item )
-#define b ( ( const KMDataNode* ) n )
-
-    return strcmp ( a, b -> name );
-
-#undef a
-#undef b
-}
-
-static
-int CC KMDataNodeSort ( const BSTNode *item, const BSTNode *n )
-{
-#define a ( ( const KMDataNode* ) item )
-#define b ( ( const KMDataNode* ) n )
-
-    return strcmp ( a -> name, b -> name );
-
-#undef a
-#undef b
-}
-
-static
-void CC KMDataNodeWhack ( BSTNode *n, void *data )
-{
-    KMDataNode *self = ( KMDataNode* ) n;
-
-    REFMSG ( "KMDataNode", "flush", & self -> refcount );
-
-    self -> meta = NULL;
-    atomic32_inc ( & self -> refcount );
-    KMDataNodeRelease ( self );
-}
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-LIB_EXPORT rc_t CC KMDataNodeAddRef ( const KMDataNode *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KMDataNode" ) )
-        {
-        case krefLimit:
-            return RC ( rcDB, rcMetadata, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeRelease ( const KMDataNode *cself )
-{
-    KMDataNode *self = ( KMDataNode* ) cself;
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KMDataNode" ) )
-        {
-        case krefOkay:
-            return KMetadataSever ( self -> meta );
-        case krefWhack:
-
-            if ( self -> meta != NULL )
-            {
-                self -> read_only = 0;
-                return KMetadataSever ( self -> meta );
-            }
-
-            KRefcountWhack ( & self -> refcount, "KMDataNode" );
-
-            BSTreeWhack ( & self -> attr, KMAttrNodeWhack, NULL );
-            BSTreeWhack ( & self -> child, KMDataNodeWhack, NULL );
-            free ( self -> value );
-            free ( self );
-            break;
-
-        case krefLimit:
-            return RC ( rcDB, rcMetadata, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-/* Inflate
- */
-static
-bool CC KMDataNodeInflate_v1 ( PBSTNode *n, void *data )
-{
-    void *value;
-    KMDataNode *b;
-    KMDataNodeInflateData *pb = data;
-
-    /* v1 metadata are flat, with the name
-       stored as a NUL terminated string
-       followed by value payload */
-    const char *name = n -> data . addr;
-    size_t size = strlen ( name );
-    if ( size >= n -> data . size )
-    {
-        pb -> rc = RC ( rcDB, rcMetadata, rcConstructing, rcData, rcCorrupt );
-        return true;
-    }
-
-    b = malloc ( sizeof * b + size );
-    if ( b == NULL )
-    {
-        pb -> rc = RC ( rcDB, rcMetadata, rcConstructing, rcMemory, rcExhausted );
-        return true;
-    }
-     
-    b -> par = pb -> par;
-    b -> meta = pb -> meta;
-    b -> value = ( void* ) ( name + size + 1 );
-    b -> vsize = n -> data . size - size - 1;
-    BSTreeInit ( & b -> attr );
-    BSTreeInit ( & b -> child );
-    KRefcountInit ( & b -> refcount, 0, "KMDataNode", "inflate", name );
-    b -> read_only = 0;
-    strcpy ( b -> name, name );
-     
-    /* a name with no associated value */
-    if ( b -> vsize == 0 )
-    {
-        b -> value = NULL;
-        BSTreeInsert ( pb -> bst, & b -> n, KMDataNodeSort );
-        return false;
-    }
-
-    /* allocate value because v2+ code expects this */
-    value = malloc ( b -> vsize );
-    if ( value != NULL )
-    {
-        memcpy ( value, b -> value, b -> vsize );
-        b -> value = value;
-        BSTreeInsert ( pb -> bst, & b -> n, KMDataNodeSort );
-        return false;
-    }
-
-    pb -> rc = RC ( rcDB, rcMetadata, rcConstructing, rcMemory, rcExhausted );
-    free ( b );
-    return true;
-}
-
-static
-rc_t KMDataNodeInflateAttr ( KMDataNode *n, bool byteswap )
-{
-    PBSTree *bst;
-    rc_t rc = PBSTreeMake ( & bst, n -> value, n -> vsize, byteswap );
-    if ( rc != 0 )
-        rc = RC ( rcDB, rcMetadata, rcConstructing, rcData, rcCorrupt );
-    else
-    {
-        KMDataNodeInflateData pb;
-        size_t bst_size = PBSTreeSize ( bst );
-        
-        pb . meta = n -> meta;
-        pb . par = n;
-        pb . bst = & n -> attr;
-        pb . node_size_limit = 0;
-        pb . node_child_limit = 0;
-        pb . rc = 0;
-        pb . byteswap = byteswap;
-        PBSTreeDoUntil ( bst, 0, KMAttrNodeInflate, & pb );
-        rc = pb . rc;
-        
-        PBSTreeWhack ( bst );
-        
-        n -> value = ( char* ) n -> value + bst_size;
-        n -> vsize -= bst_size;
-    }
-    return rc;
-}
-
-static
-bool CC KMDataNodeInflate ( PBSTNode *n, void *data );
-
-static
-rc_t KMDataNodeInflateChild ( KMDataNode *n,
-    size_t node_size_limit, uint32_t node_child_limit, bool byteswap )
-{
-    PBSTree *bst;
-    rc_t rc = PBSTreeMake ( & bst, n -> value, n -> vsize, byteswap );
-    if ( rc != 0 )
-        rc = RC ( rcDB, rcMetadata, rcConstructing, rcData, rcCorrupt );
-    else
-    {
-        uint32_t bst_count = PBSTreeCount ( bst );
-        size_t bst_size = PBSTreeSize ( bst );
-        bool inflate = node_child_limit == 0;
-        if ( ! inflate ) {
-            if ( bst_count > node_child_limit )
-            {
-                PLOGMSG ( klogWarn, ( klogWarn,
-                                      "refusing to inflate metadata node '$(node)' "
-                                      "within file '$(path)': "
-                                      "number of children ($(num_children)) "
-                                      "exceeds limit ($(limit))."
-                                      , "node=%s,path=%s,num_children=%u,limit=%u"
-                                      , n -> name
-                                      , n -> meta -> path
-                                      , bst_count
-                                      , node_child_limit )
-                    );
-            }
-            else if ( bst_size > node_size_limit )
-            {
-                PLOGMSG ( klogWarn, ( klogWarn,
-                                      "refusing to inflate metadata node '$(node)' "
-                                      "within file '$(path)': "
-                                      "node size ($(node_size)) exceeds limit ($(limit))."
-                                     , "node=%s,path=%s,node_size=%zu,limit=%zu"
-                                     , n -> name
-                                     , n -> meta -> path
-                                     , bst_size
-                                     , node_size_limit )
-                    );
-            }
-            else {
-                inflate = true;
-            }
-        }
-
-        if ( inflate ) {
-            KMDataNodeInflateData pb;
-
-            pb . meta = n -> meta;
-            pb . par = n;        
-            pb . bst = & n -> child;
-            pb . node_size_limit = node_size_limit;
-            pb . node_child_limit = node_child_limit;
-            pb . rc = 0;
-            pb . byteswap = byteswap;
-            PBSTreeDoUntil ( bst, 0, KMDataNodeInflate, & pb );
-            rc = pb . rc;
-        }
-        
-        PBSTreeWhack ( bst );
-        
-        n -> value = ( char* ) n -> value + bst_size;
-        n -> vsize -= bst_size;
-    }
-    return rc;
-}
-
-static
-bool CC KMDataNodeInflate ( PBSTNode *n, void *data )
-{
-    KMDataNode *b;
-    KMDataNodeInflateData *pb = data;
-
-    /* v2 names are preceded by a decremented length byte
-       that has its upper two bits dedicated to
-       signaling existence of attributes & children */
-    const char *name = n -> data . addr;
-    int bits = * ( ( const uint8_t* ) name ++ );
-    size_t size = ( bits >> 2 ) + 1;
-    if ( size >= n -> data . size )
-    {
-        pb -> rc = RC ( rcDB, rcMetadata, rcConstructing, rcData, rcCorrupt );
-        return true;
-    }
-
-    b = malloc ( sizeof * b + size );
-    if ( b == NULL )
-    {
-        pb -> rc = RC ( rcDB, rcMetadata, rcConstructing, rcMemory, rcExhausted );
-        return true;
-    }
-
-    b -> par = pb -> par;
-    b -> meta = pb -> meta;
-    b -> value = ( void* ) ( name + size );
-    b -> vsize = n -> data . size - size - 1;
-    BSTreeInit ( & b -> attr );
-    BSTreeInit ( & b -> child );
-    memcpy ( b -> name, name, size );
-    b -> name [ size ] = 0;
-    KRefcountInit ( & b -> refcount, 0, "KMDataNode", "inflate", b -> name );
-    b -> read_only = 0;
-
-    pb -> rc = ( bits & 1 ) != 0 ? KMDataNodeInflateAttr ( b, pb -> byteswap ) : 0;
-    if ( pb -> rc == 0 )
-    {
-        pb -> rc = ( bits & 2 ) != 0 ?
-            KMDataNodeInflateChild ( b, pb -> node_size_limit, pb -> node_child_limit, pb -> byteswap ) : 0;
-        if ( pb -> rc == 0 )
-        {
-            void *value;
-
-            if ( b -> vsize == 0 )
-            {
-                b -> value = NULL;
-                BSTreeInsert ( pb -> bst, & b -> n, KMDataNodeSort );
-                return false;
-            }
-
-            value = malloc ( b -> vsize );
-            if ( value != NULL )
-            {
-                memcpy ( value, b -> value, b -> vsize );
-                b -> value = value;
-                BSTreeInsert ( pb -> bst, & b -> n, KMDataNodeSort );
-                return false;
-            }
-            pb -> rc = RC ( rcDB, rcMetadata, rcConstructing, rcMemory, rcExhausted );
-
-            BSTreeWhack ( & b -> child, KMDataNodeWhack, NULL );
-        }
-
-        BSTreeWhack ( & b -> attr, KMAttrNodeWhack, NULL );
-    }
-
-    free ( b );
-    return true;
-}
-
-
-/* Find
- */
-static
-rc_t KMDataNodeFind ( const KMDataNode *cself, KMDataNode **np, char **path )
-{
-    KMDataNode *found, *self= ( KMDataNode* ) cself;
-
-    char *end, *name = * path;
-
-    /* interpret leading '/' */
-    if ( name [ 0 ] == '/' )
-    {
-        while ( self -> par != NULL )
-            self = self -> par;
-        ++ name;
-    }
-
-    /* find node */
-    for ( found = self; name != NULL; self = found, name = end )
-    {
-        /* segment path */
-        end = strchr ( name, '/' );
-        if ( end != NULL )
-            * end ++ = 0;
-
-        /* interpret special paths */
-        switch ( name [ 0 ] )
-        {
-        case 0:
-            continue;
-        case '.':
-            switch ( name [ 1 ] )
-            {
-            case 0:
-                continue;
-            case '.':
-                if ( name [ 2 ] == 0 )
-                {
-                    /* this is a backup */
-                    if ( ( self = self -> par ) == NULL )
-                    {
-                        * np = NULL;
-                        return RC ( rcDB, rcMetadata, rcSelecting, rcPath, rcInvalid );
-                    }
-                    continue;
-                }
-                break;
-            }
-            break;
-        }
-
-        /* find actual path */
-        found = ( KMDataNode* ) BSTreeFind ( & self -> child, name, KMDataNodeCmp );
-        if ( found == NULL )
-        {
-            /* not found also gets partially found state */
-            if ( end != NULL )
-                end [ -1 ] = '/';
-            * path = name;
-            * np = self;
-            return RC ( rcDB, rcMetadata, rcSelecting, rcPath, rcNotFound );
-        }
-    }
-
-    /* the current self is our guy */
-    * np = self;
-    return 0;
-}
-
-/* Make
- */
-static
-rc_t KMDataNodeMake ( KMDataNode *self, KMDataNode **np, char *name )
-{
-    rc_t rc;
-    char *end;
-
-    /* create nodes */
-    for ( ; name != NULL; name = end )
-    {
-        BSTNode *x;
-        size_t size;
-        KMDataNode *n;
-
-        /* segment path */
-        end = strchr ( name, '/' );
-        if ( end != NULL )
-            * end ++ = 0;
-
-        /* interpret special paths */
-        switch ( name [ 0 ] )
-        {
-        case 0:
-            continue;
-        case '.':
-            switch ( name [ 1 ] )
-            {
-            case 0:
-                continue;
-            case '.':
-                if ( name [ 2 ] == 0 )
-                {
-                    /* this is a backup */
-                    if ( ( self = self -> par ) == NULL )
-                        return RC ( rcDB, rcMetadata, rcInserting, rcPath, rcInvalid );
-                    continue;
-                }
-                break;
-            }
-            break;
-        case '*':
-            if ( name [ 1 ] == 0 )
-                return RC ( rcDB, rcMetadata, rcInserting, rcPath, rcInvalid );
-        }
-
-        /* we use 2 bits of a size byte to indicate
-           whether a node has attributes and/or children,
-           so limit the node leaf name size to 6 bits.
-           since empty names are not allowed, subtract
-           one from length to give range 0..64 => 1..64 */
-        size = strlen ( name );
-        if ( size > ( 0x3F + 1 ) )
-            return RC ( rcDB, rcMetadata, rcInserting, rcPath, rcExcessive );
-
-        n = malloc ( sizeof * n + size );
-        if ( n == NULL )
-            return RC ( rcDB, rcMetadata, rcInserting, rcMemory, rcExhausted );
-        n -> par = self;
-        n -> meta = self -> meta;
-        n -> value = NULL;
-        n -> vsize = 0;
-        BSTreeInit ( & n -> attr );
-        BSTreeInit ( & n -> child );
-        strcpy ( n -> name, name );
-        KRefcountInit ( & n -> refcount, 0, "KMDataNode", "make", n -> name );
-        n -> read_only = 0;
-
-        /* insert */
-        rc = BSTreeInsertUnique ( & self -> child,
-            & n -> n, & x, KMDataNodeSort );
-        if ( rc != 0 )
-        {
-            free ( n );
-            n = ( KMDataNode* ) x;
-        }
-
-        /* transition */
-        self = n;
-    }
-
-    /* the current self is our guy */
-    * np = self;
-    return 0;
-}
-
-
-/* OpenNodeRead
- * VOpenNodeRead
- *  opens a metadata node
- *
- *  "node" [ OUT ] - return parameter for indicated metadata node
- *
- *  "path" [ IN, NULL OKAY ] - optional path for specifying named
- *  node within metadata hierarchy. when NULL, empty, ".", or "/",
- *  return root node in "node". path separator is "/".
- */
-LIB_EXPORT rc_t CC KMetadataOpenNodeRead ( const KMetadata *self,
-    const KMDataNode **node, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KMetadataVOpenNodeRead ( self, node, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMetadataVOpenNodeRead ( const KMetadata *self,
-    const KMDataNode **node, const char *path, va_list args )
-{
-    rc_t rc = 0;
-
-    if ( node == NULL )
-        rc = RC ( rcDB, rcMetadata, rcOpening, rcParam, rcNull );
-    else if ( self == NULL )
-    {
-        * node = NULL;
-        rc = RC ( rcDB, rcMetadata, rcOpening, rcSelf, rcNull );
-    }
-    else
-        rc = KMDataNodeVOpenNodeRead ( self -> root, node, path, args );
-
-    DBGMSG(DBG_KDB, DBG_FLAG(DBG_KDB_KDB),
-            ("KMetadataVOpenNodeRead(%s) = %d\n", path, rc));
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeOpenNodeRead ( const KMDataNode *self,
-    const KMDataNode **node, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KMDataNodeVOpenNodeRead ( self, node, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeVOpenNodeRead ( const KMDataNode *self,
-    const KMDataNode **node, const char *path, va_list args )
-{
-    rc_t rc;
-    KMDataNode *found;
-    char full [ 4096 ], *p = full;
-
-    if ( node == NULL )
-        return RC ( rcDB, rcNode, rcOpening, rcParam, rcNull );
-
-    * node = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcNode, rcOpening, rcSelf, rcNull );
-
-    /* handle special NULL path */
-    if ( path == NULL )
-        full [ 0 ] = 0;
-    else
-    {
-        int len;
-
-        /* generate full path */
-        if ( args == NULL )
-            len = snprintf ( full, sizeof full, "%s", path );
-        else
-            len = vsnprintf ( full, sizeof full, path, args );
-        if ( len < 0 || len >= sizeof full )
-            return RC ( rcDB, rcNode, rcOpening, rcPath, rcExcessive );
-    }
-    
-    rc = KMDataNodeFind ( self, & found, & p );
-    if ( rc == 0 )
-    {
-        /* check if the node is not open */
-        if ( atomic32_read ( & found -> refcount ) == 0 )
-        {
-            /* mark as read-only, since we're the first to open */
-            found -> read_only = 1;
-        }
-        /* disallow open if already open for write */
-        else if ( ! found -> read_only )
-        {
-            return RC ( rcDB, rcNode, rcOpening, rcNode, rcBusy );
-        }
-
-        KMetadataAttach ( found -> meta );
-        KMDataNodeAddRef ( found );
-        * node = found;
-    }
-
-    DBGMSG(DBG_KDB, DBG_FLAG(DBG_KDB_KDB),
-            ("KMDataNodeVOpenNodeRead(%s) = %d\n", full, rc));
-
-    return rc;
-}
-
-
-/* OpenNodeUpdate
- * VOpenNodeUpdate
- *  opens a metadata node
- *
- *  "node" [ OUT ] - return parameter for indicated metadata node
- *
- *  "path" [ IN, NULL OKAY ] - optional path for specifying named
- *  node within metadata hierarchy. when NULL, empty, ".", or "/",
- *  return root node in "node". path separator is "/".
- */
-LIB_EXPORT rc_t CC KMetadataOpenNodeUpdate ( KMetadata *self,
-    KMDataNode **node, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KMetadataVOpenNodeUpdate ( self, node, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMetadataVOpenNodeUpdate ( KMetadata *self,
-    KMDataNode **node, const char *path, va_list args )
-{
-    rc_t rc;
-
-    if ( node == NULL )
-        rc = RC ( rcDB, rcMetadata, rcOpening, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcMetadata, rcOpening, rcSelf, rcNull );
-        else if ( self -> read_only )
-            rc = RC ( rcDB, rcMetadata, rcOpening, rcNode, rcReadonly );
-        else {
-            rc = KMDataNodeVOpenNodeUpdate ( self -> root, node, path, args );
-            DBGMSG(DBG_KDB, DBG_FLAG(DBG_KDB_KDB),
-                        ("KMetadataVOpenNodeUpdate(%s) = %d\n", path, rc));
-            return rc;
-        }
-
-        * node = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeOpenNodeUpdate ( KMDataNode *self,
-    KMDataNode **node, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KMDataNodeVOpenNodeUpdate ( self, node, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeVOpenNodeUpdate ( KMDataNode *self,
-    KMDataNode **node, const char *path, va_list args )
-{
-    rc_t rc = 0;
-    KMDataNode *found;
-    char full [ 4096 ], *p = full;
-
-    if ( node == NULL )
-        return RC ( rcDB, rcNode, rcOpening, rcParam, rcNull );
-
-    * node = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcNode, rcOpening, rcSelf, rcNull );
-
-    /* handle special NULL path */
-    if ( path == NULL )
-        full [ 0 ] = 0;
-    else
-    {
-        int len;
-
-        /* generate full path */
-        if ( args == NULL )
-            len = snprintf ( full, sizeof full, "%s", path );
-        else
-            len = vsnprintf ( full, sizeof full, path, args );
-        if ( len < 0 || len >= sizeof full )
-            return RC ( rcDB, rcNode, rcOpening, rcPath, rcExcessive );
-    }
-
-    /* don't allow update when open for read */
-    if ( self -> read_only ) {
-        rc = RC ( rcDB, rcNode, rcOpening, rcNode, rcReadonly );
-        DBGMSG(DBG_KDB, DBG_FLAG(DBG_KDB_KDB),
-                    ("KMDataNodeVOpenNodeUpdate(%s) = %d\n", full, rc));
-        return rc;
-    }
-
-    /* find an existing one */
-    rc = KMDataNodeFind ( self, & found, & p );
-    if ( rc == 0 )
-    {
-        if ( atomic32_read ( & found -> refcount ) != 0 )
-            return RC ( rcDB, rcNode, rcOpening, rcNode, rcBusy );
-    }
-    else if ( GetRCState ( rc ) == rcNotFound )
-    {
-        rc = KMDataNodeMake ( found, & found, p );
-        if ( rc != 0 )
-            return rc;
-    }
-    else
-    {
-        return rc;
-    }
-
-    KMetadataAttach ( found -> meta );
-    KMDataNodeAddRef ( found );
-    found -> read_only = false;
-    * node = found;
-
-    DBGMSG(DBG_KDB, DBG_FLAG(DBG_KDB_KDB),
-                ("KMDataNodeVOpenNodeUpdate(%s) = %d\n", full, rc));
-
-    return rc;
-}
-
-
-/* ByteOrder
- *  indicates whether original byte order is reversed
- *  under current architecture.
- *
- *  the byte order of the column is established by
- *  the host architecture when created.
- *
- *  "reversed" [ OUT ] - if true, the original byte
- *  order is reversed with regard to host native byte order.
- */
-LIB_EXPORT rc_t CC KMDataNodeByteOrder ( const KMDataNode *self, bool *reversed )
-{
-    if ( self != NULL )
-        return KMetadataByteOrder ( self -> meta, reversed );
-
-    if ( reversed == NULL )
-        return RC ( rcDB, rcMetadata, rcAccessing, rcParam, rcNull );
-
-    * reversed = false;
-    return RC ( rcDB, rcMetadata, rcAccessing, rcSelf, rcNull );
-}
-
-
-/* Read
- *  read a node value or attribute
- *
- *  "offset" [ IN ] - initial offset into metadata
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT ] - number of bytes actually read
- *
- *  "remaining" [ OUT, NULL OKAY ] - optional return parameter for
- *  the number of bytes remaining to be read.
- *  specifically, "offset" + "num_read" + "remaining" == sizeof node data
- */
-LIB_EXPORT rc_t CC KMDataNodeRead ( const KMDataNode *self,
-    size_t offset, void *buffer, size_t bsize,
-    size_t *num_read, size_t *remaining )
-{
-    rc_t rc;
-
-    size_t dummy;
-    if ( remaining == NULL )
-        remaining = & dummy;
-
-    if ( num_read == NULL )
-        rc = RC ( rcDB, rcNode, rcReading, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcNode, rcReading, rcSelf, rcNull );
-        else if ( buffer == NULL && bsize != 0 )
-            rc = RC ( rcDB, rcNode, rcReading, rcBuffer, rcNull );
-        else
-        {
-            size_t to_read, avail = self -> vsize;
-            if ( offset > avail )
-                offset = avail;
-
-            to_read = avail -= offset;
-            if ( to_read > bsize )
-                to_read = bsize;
-
-            if ( to_read > 0 )
-                memcpy ( buffer, ( const char* ) self -> value + offset, to_read );
-
-            * num_read = to_read;
-            * remaining = avail - to_read;
-
-            return 0;
-        }
-
-        * num_read = 0;
-    }
-
-    * remaining = 0;
-    return rc;
-}
-
-
-/* Addr - PRIVATE
- *  reach into node and get address
- *  returns raw pointer and node size
- */
-LIB_EXPORT rc_t CC KMDataNodeAddr ( const KMDataNode *self,
-    const void **addr, size_t *size )
-{
-    rc_t rc;
-
-    size_t dummy;
-    if ( size == NULL )
-        size = & dummy;
-
-    if ( addr == NULL )
-        rc = RC ( rcDB, rcMetadata, rcReading, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcMetadata, rcReading, rcSelf, rcNull );
-        else
-        {
-            * addr = self -> value;
-            * size = self -> vsize;
-
-            return 0;
-        }
-
-        * addr = NULL;
-    }
-
-    * size = 0;
-    return rc;
-}
-
-
-/* Write
- *  write a node value or attribute
- *  overwrites anything already there
- *
- *  "buffer" [ IN ] and "size" [ IN ] - new value data
- */
-LIB_EXPORT rc_t CC KMDataNodeWrite ( KMDataNode *self, const void *buffer, size_t size )
-{
-    if ( self == NULL )
-        return RC ( rcDB, rcNode, rcWriting, rcSelf, rcNull );
-    if ( self -> meta == NULL )
-        return RC ( rcDB, rcNode, rcWriting, rcMetadata, rcNull );
-    if ( buffer == NULL && size != 0 )
-        return RC ( rcDB, rcNode, rcWriting, rcBuffer, rcNull );
-
-    /* don't allow update when open for read or root node */
-    if ( self -> read_only || self -> par == NULL )
-        return RC ( rcDB, rcNode, rcWriting, rcNode, rcReadonly );
-
-    if ( size == self -> vsize )
-    {
-        if ( size == 0 )
-            return 0;
-
-        memcpy ( self -> value, buffer, size );
-    }
-    else
-    {
-        void *value;
-
-        if ( buffer == NULL || size == 0 )
-        {
-            value = NULL;
-            size = 0;
-        }
-        else
-        {
-            value = malloc ( size );
-            if ( value == NULL )
-                return RC ( rcDB, rcNode, rcWriting, rcMemory, rcExhausted );
-            memcpy ( value, buffer, size );
-        }
-            
-        if ( self -> value != NULL )
-            free ( self -> value );
-
-        self -> value = value;
-        self -> vsize = size;
-    }
-    
-    self -> meta -> dirty = true;
-
-    return 0;
-}
-
-
-/* Append
- *  append data to value
- *
- *  "buffer" [ IN ] and "size" [ IN ] - value data to be appended
- */
-LIB_EXPORT rc_t CC KMDataNodeAppend ( KMDataNode *self, const void *buffer, size_t size )
-{
-    if ( self == NULL )
-        return RC ( rcDB, rcNode, rcWriting, rcSelf, rcNull );
-    if ( self -> meta == NULL )
-        return RC ( rcDB, rcNode, rcWriting, rcMetadata, rcNull );
-    if ( buffer == NULL && size != 0 )
-        return RC ( rcDB, rcNode, rcWriting, rcBuffer, rcNull );
-
-    /* don't allow update when open for read or root node */
-    if ( self -> read_only || self -> par == NULL )
-        return RC ( rcDB, rcNode, rcWriting, rcNode, rcReadonly );
-
-    if ( size != 0 )
-    {
-        void *value = realloc ( self -> value, self -> vsize + size );
-        if ( value == NULL )
-            return RC ( rcDB, rcNode, rcWriting, rcMemory, rcExhausted );
-        memcpy ( ( char* ) value + self -> vsize, buffer, size );
-        self -> value = value;
-        self -> vsize += size;
-        self -> meta -> dirty = true;
-    }
-    return 0;
-}
-
-
-/* Read ( formatted )
- *  reads as integer or float value in native byte order
- *
- *  "bXX" [ OUT ] - return parameter for numeric value
- */
-LIB_EXPORT rc_t CC KMDataNodeReadB8 ( const KMDataNode *self, void *b8 )
-{
-    size_t num_read, remaining;
-    rc_t rc = KMDataNodeRead ( self, 0, b8, 1,
-        & num_read, & remaining );
-    if ( rc == 0 )
-    {
-        if ( remaining != 0 )
-            return RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-        if ( num_read < 1 )
-            return RC ( rcDB, rcMetadata, rcReading, rcTransfer, rcIncomplete );
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadB16 ( const KMDataNode *self, void *b16 )
-{
-    size_t num_read, remaining;
-    rc_t rc = KMDataNodeRead ( self, 0, b16, 2,
-        & num_read, & remaining );
-    if ( rc == 0 )
-    {
-        if ( remaining != 0 )
-            return RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-        if ( num_read < 2 )
-            return RC ( rcDB, rcMetadata, rcReading, rcTransfer, rcIncomplete );
-
-        if ( self -> meta -> byteswap )
-            * ( uint16_t* ) b16 = bswap_16 ( * ( const uint16_t* ) b16 );
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadB32 ( const KMDataNode *self, void *b32 )
-{
-    size_t num_read, remaining;
-    rc_t rc = KMDataNodeRead ( self, 0, b32, 4,
-        & num_read, & remaining );
-    if ( rc == 0 )
-    {
-        if ( remaining != 0 )
-            return RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-        if ( num_read < 4 )
-            return RC ( rcDB, rcMetadata, rcReading, rcTransfer, rcIncomplete );
-
-        if ( self -> meta -> byteswap )
-            * ( uint32_t* ) b32 = bswap_32 ( * ( const uint32_t* ) b32 );
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadB64 ( const KMDataNode *self, void *b64 )
-{
-    size_t num_read, remaining;
-    rc_t rc = KMDataNodeRead ( self, 0, b64, 8,
-        & num_read, & remaining );
-    if ( rc == 0 )
-    {
-        if ( remaining != 0 )
-            return RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-        if ( num_read < 8 )
-            return RC ( rcDB, rcMetadata, rcReading, rcTransfer, rcIncomplete );
-
-        if ( self -> meta -> byteswap )
-            * ( uint64_t* ) b64 = bswap_64 ( * ( const uint64_t* ) b64 );
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadB128 ( const KMDataNode *self, void *b128 )
-{
-    size_t num_read, remaining;
-    rc_t rc = KMDataNodeRead ( self, 0, b128, 16,
-        & num_read, & remaining );
-    if ( rc == 0 )
-    {
-        if ( remaining != 0 )
-            return RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-        if ( num_read < 16 )
-            return RC ( rcDB, rcMetadata, rcReading, rcTransfer, rcIncomplete );
-
-        if ( self -> meta -> byteswap )
-        {
-            uint64_t *b64 = b128;
-            uint64_t tmp = bswap_64 ( b64 [ 0 ] );
-            b64 [ 0 ] = bswap_64 ( b64 [ 1 ] );
-            b64 [ 1 ] = tmp;
-        }
-    }
-    return rc;
-}
-
-
-/* ReadAs ( formatted )
- *  reads as integer or float value in native byte order
- *  casts smaller-sized values to desired size, e.g.
- *    uint32_t to uint64_t
- *
- *  "i" [ OUT ] - return parameter for signed integer
- *  "u" [ OUT ] - return parameter for unsigned integer
- *  "f" [ OUT ] - return parameter for double float
- */
-LIB_EXPORT rc_t CC KMDataNodeReadAsI16 ( const KMDataNode *self, int16_t *i )
-{
-    size_t num_read, remaining;
-    rc_t rc = KMDataNodeRead ( self, 0, i, sizeof * i,
-        & num_read, & remaining );
-    if ( rc == 0 )
-    {
-        if ( remaining != 0 )
-            return RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-
-        switch ( num_read )
-        {
-        case 1:
-            * i = ( ( const int8_t* ) i ) [ 0 ];
-            break;
-        case 2:
-            if ( self -> meta -> byteswap )
-                * i = bswap_16 ( * i );
-            break;
-        default:
-            return RC ( rcDB, rcMetadata, rcReading, rcTransfer, rcIncomplete );
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadAsU16 ( const KMDataNode *self, uint16_t *u )
-{
-    size_t num_read, remaining;
-    rc_t rc = KMDataNodeRead ( self, 0, u, sizeof * u,
-        & num_read, & remaining );
-    if ( rc == 0 )
-    {
-        if ( remaining != 0 )
-            return RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-
-        switch ( num_read )
-        {
-        case 1:
-            * u = ( ( const uint8_t* ) u ) [ 0 ];
-            break;
-        case 2:
-            if ( self -> meta -> byteswap )
-                * u = bswap_16 ( * u );
-            break;
-        default:
-            return RC ( rcDB, rcMetadata, rcReading, rcTransfer, rcIncomplete );
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadAsI32 ( const KMDataNode *self, int32_t *i )
-{
-    size_t num_read, remaining;
-    rc_t rc = KMDataNodeRead ( self, 0, i, sizeof * i,
-        & num_read, & remaining );
-    if ( rc == 0 )
-    {
-        if ( remaining != 0 )
-            return RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-
-        switch ( num_read )
-        {
-        case 1:
-            * i = ( ( const int8_t* ) i ) [ 0 ];
-            break;
-        case 2:
-            if ( self -> meta -> byteswap )
-                * i = bswap_16 ( ( ( const int16_t* ) i ) [ 0 ] );
-            else
-                * i = ( ( const int16_t* ) i ) [ 0 ];
-            break;
-        case 4:
-            if ( self -> meta -> byteswap )
-                * i = bswap_32 ( * i );
-            break;
-        default:
-            return RC ( rcDB, rcMetadata, rcReading, rcTransfer, rcIncomplete );
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadAsU32 ( const KMDataNode *self, uint32_t *u )
-{
-    size_t num_read, remaining;
-    rc_t rc = KMDataNodeRead ( self, 0, u, sizeof * u,
-        & num_read, & remaining );
-    if ( rc == 0 )
-    {
-        if ( remaining != 0 )
-            return RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-
-        switch ( num_read )
-        {
-        case 1:
-            * u = ( ( const uint8_t* ) u ) [ 0 ];
-            break;
-        case 2:
-            if ( self -> meta -> byteswap )
-                * u = bswap_16 ( ( ( const uint16_t* ) u ) [ 0 ] );
-            else
-                * u = ( ( const uint16_t* ) u ) [ 0 ];
-            break;
-        case 4:
-            if ( self -> meta -> byteswap )
-                * u = bswap_32 ( * u );
-            break;
-        default:
-            return RC ( rcDB, rcMetadata, rcReading, rcTransfer, rcIncomplete );
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadAsI64 ( const KMDataNode *self, int64_t *i )
-{
-    size_t num_read, remaining;
-    rc_t rc = KMDataNodeRead ( self, 0, i, sizeof * i,
-        & num_read, & remaining );
-    if ( rc == 0 )
-    {
-        if ( remaining != 0 )
-            return RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-
-        switch ( num_read )
-        {
-        case 1:
-            * i = ( ( const int8_t* ) i ) [ 0 ];
-            break;
-        case 2:
-            if ( self -> meta -> byteswap )
-                * i = bswap_16 ( ( ( const int16_t* ) i ) [ 0 ] );
-            else
-                * i = ( ( const int16_t* ) i ) [ 0 ];
-            break;
-        case 4:
-            if ( self -> meta -> byteswap )
-                * i = bswap_32 ( ( ( const int32_t* ) i ) [ 0 ] );
-            else
-                * i = ( ( const int32_t* ) i ) [ 0 ];
-            break;
-        case 8:
-            if ( self -> meta -> byteswap )
-                * i = bswap_64 ( * i );
-            break;
-        default:
-            return RC ( rcDB, rcMetadata, rcReading, rcTransfer, rcIncomplete );
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadAsU64 ( const KMDataNode *self, uint64_t *u )
-{
-    size_t num_read, remaining;
-    rc_t rc = KMDataNodeRead ( self, 0, u, sizeof * u,
-        & num_read, & remaining );
-    if ( rc == 0 )
-    {
-        if ( remaining != 0 )
-            return RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-
-        switch ( num_read )
-        {
-        case 1:
-            * u = ( ( const uint8_t* ) u ) [ 0 ];
-            break;
-        case 2:
-            if ( self -> meta -> byteswap )
-                * u = bswap_16 ( ( ( const uint16_t* ) u ) [ 0 ] );
-            else
-                * u = ( ( const uint16_t* ) u ) [ 0 ];
-            break;
-        case 4:
-            if ( self -> meta -> byteswap )
-                * u = bswap_32 ( ( ( const uint32_t* ) u ) [ 0 ] );
-            else
-                * u = ( ( const uint32_t* ) u ) [ 0 ];
-            break;
-        case 8:
-            if ( self -> meta -> byteswap )
-                * u = bswap_64 ( * u );
-            break;
-        default:
-            return RC ( rcDB, rcMetadata, rcReading, rcTransfer, rcIncomplete );
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadAsF64 ( const KMDataNode *self, double *f )
-{
-    size_t num_read, remaining;
-    rc_t rc = KMDataNodeRead ( self, 0, f, sizeof * f,
-        & num_read, & remaining );
-    if ( rc == 0 )
-    {
-        if ( remaining != 0 )
-            return RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-
-        switch ( num_read )
-        {
-        case 4:
-            if ( self -> meta -> byteswap )
-                * ( uint32_t* ) f = bswap_32 ( * ( const uint32_t* ) f );
-            * f = ( ( const float* ) f ) [ 0 ];
-            break;
-        case 8:
-            if ( self -> meta -> byteswap )
-                * ( uint64_t* ) f = bswap_64 ( * ( const uint64_t* ) f );
-            break;
-        default:
-            return RC ( rcDB, rcMetadata, rcReading, rcTransfer, rcIncomplete );
-        }
-    }
-    return rc;
-}
-
-
-/* Read ( formatted )
- *  reads as C-string
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - output buffer for
- *  NUL terminated string.
- *
- *  "size" [ OUT ] - return parameter giving size of string
- *  not including NUL byte. the size is set both upon success
- *  and insufficient buffer space error.
- */
-LIB_EXPORT rc_t CC KMDataNodeReadCString ( const KMDataNode *self,
-    char *buffer, size_t bsize, size_t *size )
-{
-    size_t remaining;
-    rc_t rc = KMDataNodeRead ( self, 0, buffer, bsize - 1, size, & remaining );
-    if ( rc == 0 )
-    {
-        if ( remaining != 0 )
-        {
-            * size += remaining;
-            return RC ( rcDB, rcMetadata, rcReading, rcBuffer, rcInsufficient );
-        }
-
-        buffer [ * size ] = 0;
-    }
-    return rc;
-}
-
-
-/* Write ( formatted )
- *  writes integer or float value in metadata byte order
- *
- *  "bXX" [ IN ] - numeric value
- *
- * NB - we do not currently ( and maybe never ) support
- *  writing in non-native byte-order.
- */
-LIB_EXPORT rc_t CC KMDataNodeWriteB8 ( KMDataNode *self, const void *b8 )
-{
-    return KMDataNodeWrite ( self, b8, 1 );
-}
-
-LIB_EXPORT rc_t CC KMDataNodeWriteB16 ( KMDataNode *self, const void *b16 )
-{
-    return KMDataNodeWrite ( self, b16, 2 );
-}
-
-LIB_EXPORT rc_t CC KMDataNodeWriteB32 ( KMDataNode *self, const void *b32 )
-{
-    return KMDataNodeWrite ( self, b32, 4 );
-}
-
-LIB_EXPORT rc_t CC KMDataNodeWriteB64 ( KMDataNode *self, const void *b64 )
-{
-    return KMDataNodeWrite ( self, b64, 8 );
-}
-
-LIB_EXPORT rc_t CC KMDataNodeWriteB128 ( KMDataNode *self, const void *b128 )
-{
-    return KMDataNodeWrite ( self, b128, 16 );
-}
-
-
-/* Write ( formatted )
- *  writes C-string
- *
- *  "str" [ IN ] - NUL terminated string.
- */
-LIB_EXPORT rc_t CC KMDataNodeWriteCString ( KMDataNode *self, const char *str )
-{
-    if ( str != NULL )
-        return KMDataNodeWrite ( self, str, strlen ( str ) );
-
-    if ( self == NULL )
-        return RC ( rcDB, rcNode, rcWriting, rcSelf, rcNull );
-
-    return RC ( rcDB, rcNode, rcWriting, rcString, rcNull );
-}
-
-
-/* ReadAttr
- *  reads as NUL-terminated string
- *
- *  "name" [ IN ] - NUL terminated attribute name
- *
- *  "buffer" [ OUT ] and "bsize" - return parameter for attribute value
- *
- *  "size" [ OUT ] - return parameter giving size of string
- *  not including NUL byte. the size is set both upon success
- *  and insufficient buffer space error.
- */
-LIB_EXPORT rc_t CC KMDataNodeReadAttr ( const KMDataNode *self, const char *name,
-    char *buffer, size_t bsize, size_t *size )
-{
-    rc_t rc;
-
-    if ( size == NULL )
-        rc = RC ( rcDB, rcMetadata, rcReading, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcMetadata, rcReading, rcSelf, rcNull );
-        else if ( name == NULL )
-            rc = RC ( rcDB, rcMetadata, rcReading, rcString, rcNull );
-        else if ( name [ 0 ] == 0 )
-            rc = RC ( rcDB, rcMetadata, rcReading, rcString, rcEmpty );
-        else if ( buffer == NULL && bsize != 0 )
-            rc = RC ( rcDB, rcMetadata, rcReading, rcBuffer, rcNull );
-        else
-        {
-            const KMAttrNode *n = ( const KMAttrNode* )
-                BSTreeFind ( & self -> attr, name, KMAttrNodeCmp );
-            if ( n == NULL )
-            {
-                * size = 0;
-                if ( bsize != 0 )
-                    buffer [ 0 ] = 0;
-                rc = RC ( rcDB, rcMetadata, rcReading, rcAttr, rcNotFound );
-            }
-            else
-            {
-                * size = n -> vsize;
-                if ( n -> vsize < bsize )
-                {
-                    memcpy ( buffer, n -> value, n -> vsize );
-                    buffer [ n -> vsize ] = 0;
-                    return 0;
-                }
-
-                return RC ( rcDB, rcMetadata, rcReading, rcBuffer, rcInsufficient );
-            }
-        }
-
-        * size = 0;
-    }
-
-    return rc;
-}
-
-
-/* WriteAttr
- *  writes NUL-terminated string
- *
- *  "name" [ IN ] - NUL terminated attribute name
- *
- *  "value" [ IN ] - NUL terminated attribute value
- */
-LIB_EXPORT rc_t CC KMDataNodeWriteAttr ( KMDataNode *self,
-    const char *name, const char *value )
-{
-    rc_t rc;
-    size_t size;
-    KMAttrNode *n;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcNode, rcWriting, rcSelf, rcNull );
-    if ( self -> meta == NULL )
-        return RC ( rcDB, rcNode, rcWriting, rcMetadata, rcNull );
-    if ( name == NULL )
-        return RC ( rcDB, rcNode, rcWriting, rcPath, rcNull );
-    if ( name [ 0 ] == 0 )
-        return RC ( rcDB, rcNode, rcWriting, rcPath, rcInvalid );
-
-    /* don't allow update when open for read or root node */
-    if ( self -> read_only || self -> par == NULL )
-        return RC ( rcDB, rcNode, rcWriting, rcNode, rcReadonly );
-
-    size = ( value == NULL ) ? 0 : strlen ( value );
-    rc = KMAttrNodeMake ( & n, name, value, size );
-    if ( rc == 0 )
-    {
-        BSTNode *x;
-        if ( BSTreeInsertUnique ( & self -> attr,
-             & n -> n, & x, KMAttrNodeSort ) != 0 )
-        {
-            BSTreeUnlink ( & self -> attr, x );
-            KMAttrNodeWhack ( x, NULL );
-            BSTreeInsert ( & self -> attr, & n -> n, KMAttrNodeSort );
-        }
-
-        self -> meta -> dirty = true;
-    }
-    return rc;
-}
-
-
-/* ReadAttrAs ( formatted )
- *  reads as integer or float value in native byte order
- *  casts smaller-sized values to desired size, e.g.
- *    uint32_t to uint64_t
- *
- *  "i" [ OUT ] - return parameter for signed integer
- *  "u" [ OUT ] - return parameter for unsigned integer
- *  "f" [ OUT ] - return parameter for double float
- */
-LIB_EXPORT rc_t CC KMDataNodeReadAttrAsI16 ( const KMDataNode *self, const char *attr, int16_t *i )
-{
-    rc_t rc;
-    if ( i == NULL )
-        rc = RC ( rcDB, rcMetadata, rcReading, rcParam, rcNull );
-    else
-    {
-        size_t size;
-        char buffer [ 256 ];
-        rc = KMDataNodeReadAttr ( self, attr, buffer, sizeof buffer, & size );
-        if ( rc == 0 )
-        {
-            char *end;
-            long val = strtol ( buffer, & end, 0 );
-            if ( end [ 0 ] != 0 )
-                rc = RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-            else if ( val < -32768 || val > 32767 )
-                rc = RC ( rcDB, rcMetadata, rcReading, rcRange, rcExcessive );
-            else
-            {
-                * i = ( int16_t ) val;
-                return 0;
-            }
-        }
-
-        * i = 0;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadAttrAsU16 ( const KMDataNode *self, const char *attr, uint16_t *u )
-{
-    rc_t rc;
-    if ( u == NULL )
-        rc = RC ( rcDB, rcMetadata, rcReading, rcParam, rcNull );
-    else
-    {
-        size_t size;
-        char buffer [ 256 ];
-        rc = KMDataNodeReadAttr ( self, attr, buffer, sizeof buffer, & size );
-        if ( rc == 0 )
-        {
-            char *end;
-            unsigned long val = strtoul ( buffer, & end, 0 );
-            if ( end [ 0 ] != 0 )
-                rc = RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-            else if ( val > 0xFFFF )
-                rc = RC ( rcDB, rcMetadata, rcReading, rcRange, rcExcessive );
-            else
-            {
-                * u = ( uint16_t ) val;
-                return 0;
-            }
-        }
-
-        * u = 0;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadAttrAsI32 ( const KMDataNode *self, const char *attr, int32_t *i )
-{
-    rc_t rc;
-    if ( i == NULL )
-        rc = RC ( rcDB, rcMetadata, rcReading, rcParam, rcNull );
-    else
-    {
-        size_t size;
-        char buffer [ 256 ];
-        rc = KMDataNodeReadAttr ( self, attr, buffer, sizeof buffer, & size );
-        if ( rc == 0 )
-        {
-            char *end;
-            long val = strtol ( buffer, & end, 0 );
-            if ( end [ 0 ] != 0 )
-                rc = RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-            else if ( val < (-2147483647 - 1) || val > 2147483647 )
-                rc = RC ( rcDB, rcMetadata, rcReading, rcRange, rcExcessive );
-            else
-            {
-                * i = ( int32_t ) val;
-                return 0;
-            }
-        }
-
-        * i = 0;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadAttrAsU32 ( const KMDataNode *self, const char *attr, uint32_t *u )
-{
-    rc_t rc;
-    if ( u == NULL )
-        rc = RC ( rcDB, rcMetadata, rcReading, rcParam, rcNull );
-    else
-    {
-        size_t size;
-        char buffer [ 256 ];
-        rc = KMDataNodeReadAttr ( self, attr, buffer, sizeof buffer, & size );
-        if ( rc == 0 )
-        {
-            char *end;
-            unsigned long val = strtoul ( buffer, & end, 0 );
-            if ( end [ 0 ] != 0 )
-                rc = RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-            else if ( val > 0xFFFFFFFF )
-                rc = RC ( rcDB, rcMetadata, rcReading, rcRange, rcExcessive );
-            else
-            {
-                * u = ( uint32_t ) val;
-                return 0;
-            }
-        }
-
-        * u = 0;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadAttrAsI64 ( const KMDataNode *self, const char *attr, int64_t *i )
-{
-    rc_t rc;
-    if ( i == NULL )
-        rc = RC ( rcDB, rcMetadata, rcReading, rcParam, rcNull );
-    else
-    {
-        size_t size;
-        char buffer [ 256 ];
-        rc = KMDataNodeReadAttr ( self, attr, buffer, sizeof buffer, & size );
-        if ( rc == 0 )
-        {
-            char *end;
-            int64_t val =  strtoi64 ( buffer, & end, 0 );
-            if ( end [ 0 ] != 0 )
-                rc = RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-            else
-            {
-                * i = val;
-                return 0;
-            }
-        }
-
-        * i = 0;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadAttrAsU64 ( const KMDataNode *self, const char *attr, uint64_t *u )
-{
-    rc_t rc;
-    if ( u == NULL )
-        rc = RC ( rcDB, rcMetadata, rcReading, rcParam, rcNull );
-    else
-    {
-        size_t size;
-        char buffer [ 256 ];
-        rc = KMDataNodeReadAttr ( self, attr, buffer, sizeof buffer, & size );
-        if ( rc == 0 )
-        {
-            char *end;
-            uint64_t val =  strtou64 ( buffer, & end, 0 );
-            if ( end [ 0 ] != 0 )
-                rc = RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-            else
-            {
-                * u = val;
-                return 0;
-            }
-        }
-
-        * u = 0;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeReadAttrAsF64 ( const KMDataNode *self, const char *attr, double *f )
-{
-    rc_t rc;
-    if ( f == NULL )
-        rc = RC ( rcDB, rcMetadata, rcReading, rcParam, rcNull );
-    else
-    {
-        size_t size;
-        char buffer [ 256 ];
-        rc = KMDataNodeReadAttr ( self, attr, buffer, sizeof buffer, & size );
-        if ( rc == 0 )
-        {
-            char *end;
-            double val = strtod ( buffer, & end );
-            if ( end [ 0 ] != 0 )
-                rc = RC ( rcDB, rcMetadata, rcReading, rcNode, rcIncorrect );
-            else
-            {
-                * f = val;
-                return 0;
-            }
-        }
-
-        * f = 0.0;
-    }
-    return rc;
-}
-
-
-/* Drop
- * VDrop
- *  drop some or all node content
- */
-LIB_EXPORT rc_t CC KMDataNodeDropAll ( KMDataNode *self )
-{
-    if ( self == NULL )
-        return RC ( rcDB, rcNode, rcClearing, rcSelf, rcNull );
-    if ( self -> meta == NULL )
-        return RC ( rcDB, rcNode, rcClearing, rcMetadata, rcNull );
-    if ( self -> read_only )
-        return RC ( rcDB, rcNode, rcClearing, rcNode, rcReadonly );
-
-    BSTreeWhack ( & self -> attr, KMAttrNodeWhack, NULL );
-    BSTreeInit ( & self -> attr );
-
-    BSTreeWhack ( & self -> child, KMDataNodeWhack, NULL );
-    BSTreeInit ( & self -> child );
-
-    free ( self -> value );
-    self -> value = NULL;
-    self -> vsize = 0;
-    self -> meta -> dirty = true;
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeDropAttr ( KMDataNode *self, const char *attr )
-{
-    if ( self == NULL )
-        return RC ( rcDB, rcNode, rcUpdating, rcSelf, rcNull );
-    if ( self -> meta == NULL )
-        return RC ( rcDB, rcNode, rcUpdating, rcMetadata, rcNull );
-    if ( attr == NULL )
-        return RC ( rcDB, rcNode, rcUpdating, rcPath, rcNull );
-    if ( attr [ 0 ] == 0 )
-        return RC ( rcDB, rcNode, rcUpdating, rcPath, rcInvalid );
-    if ( self -> read_only )
-        return RC ( rcDB, rcNode, rcUpdating, rcNode, rcReadonly );
-
-    /* recognize wildcard */
-    if ( attr [ 0 ] == '*' && attr [ 1 ] == 0 )
-    {
-        BSTreeWhack ( & self -> attr, KMAttrNodeWhack, NULL );
-        BSTreeInit ( & self -> attr );
-    }
-    else
-    {
-        KMAttrNode *found = ( KMAttrNode* )
-            BSTreeFind ( & self -> attr, attr, KMAttrNodeCmp );
-        if ( found == NULL )
-            return RC ( rcDB, rcNode, rcUpdating, rcAttr, rcNotFound );
-
-        BSTreeUnlink ( & self -> attr, & found -> n );
-        KMAttrNodeWhack ( & found -> n, NULL );
-    }
-
-    self -> meta -> dirty = true;
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeDropChild ( KMDataNode *self, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KMDataNodeVDropChild ( self, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeVDropChild ( KMDataNode *self, const char *path, va_list args )
-{
-    int len;
-    rc_t rc;
-    KMDataNode *found;
-    char full [ 4096 ], *p = full;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcNode, rcUpdating, rcSelf, rcNull );
-    if ( self -> meta == NULL )
-        return RC ( rcDB, rcNode, rcUpdating, rcMetadata, rcNull );
-    if ( path == NULL )
-        return RC ( rcDB, rcNode, rcUpdating, rcPath, rcNull );
-    if ( path [ 0 ] == 0 )
-        return RC ( rcDB, rcNode, rcUpdating, rcPath, rcInvalid );
-
-    /* generate full path */
-    if ( args == NULL )
-        len = snprintf ( full, sizeof full, "%s", path );
-    else
-        len = vsnprintf ( full, sizeof full, path, args );
-    if ( len < 0 || len >= sizeof full )
-        return RC ( rcDB, rcNode, rcUpdating, rcPath, rcExcessive );
-
-    /* don't allow update when open for read */
-    if ( self -> read_only )
-        return RC ( rcDB, rcNode, rcUpdating, rcNode, rcReadonly );
-
-    rc = KMDataNodeFind ( self, & found, & p );
-    if ( GetRCState ( rc ) == rcNotFound )
-    {
-        if ( p [ 0 ] != '*' || p [ 1 ] != 0 )
-            return rc;
-
-        BSTreeWhack ( & found -> child, KMDataNodeWhack, NULL );
-        BSTreeInit ( & found -> child );
-    }
-    else
-    {
-        BSTreeUnlink ( & self -> child, & found -> n );
-        KMDataNodeWhack ( & found -> n, NULL );
-    }
-
-    self -> meta -> dirty = true;
-
-    return 0;
-}
-
-
-/* Rename
- *  renames a contained object
- *
- *  "from" [ IN ] - NUL terminated string in UTF-8
- *  giving simple name of existing attr
- *
- *  "to" [ IN ] - NUL terminated string in UTF-8
- *  giving new simple attr name
- */
-LIB_EXPORT rc_t CC KMDataNodeRenameAttr ( KMDataNode *self, const char *from, const char *to )
-{
-    rc_t rc;
-    KMAttrNode *found, *renamed;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcNode, rcRenaming, rcSelf, rcNull );
-    if ( self -> meta == NULL )
-        return RC ( rcDB, rcNode, rcRenaming, rcMetadata, rcNull );
-    if ( from == NULL || to == NULL )
-        return RC ( rcDB, rcNode, rcRenaming, rcPath, rcNull );
-    if ( from [ 0 ] == 0 || to [ 0 ] == 0 )
-        return RC ( rcDB, rcNode, rcRenaming, rcPath, rcInvalid );
-    if ( self -> read_only )
-        return RC ( rcDB, rcNode, rcRenaming, rcNode, rcReadonly );
-
-    found = ( KMAttrNode* )
-        BSTreeFind ( & self -> attr, from, KMAttrNodeCmp );
-    if ( found == NULL )
-        return RC ( rcDB, rcNode, rcRenaming, rcAttr, rcNotFound );
-
-    rc = KMAttrNodeRename ( found, & renamed, to );
-    if ( rc == 0 )
-    {
-        BSTNode *x;
-        rc = BSTreeInsertUnique ( & self -> attr,
-            & renamed -> n, & x, KMAttrNodeSort );
-        if ( rc != 0 )
-        {
-            KMAttrNodeWhack ( & renamed -> n, NULL );
-            if ( x == & found -> n )
-                return 0;
-            return RC ( rcDB, rcNode, rcRenaming, rcAttr, rcExists );
-        }
-
-        BSTreeUnlink ( & self -> attr, & found -> n );
-        KMAttrNodeWhack ( & found -> n, NULL );
-        self -> meta -> dirty = true;
-    }
-
-    return rc;
-}
-
-static
-void CC KMDataNodeRelinkParent ( BSTNode *n, void *data )
-{
-    ( ( KMDataNode* ) n ) -> par = data;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeRenameChild ( KMDataNode *self, const char *from, const char *to )
-{
-    int len;
-    rc_t rc;
-    KMDataNode *found;
-    char full [ 4096 ], *p = full;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcNode, rcRenaming, rcSelf, rcNull );
-    if ( self -> meta == NULL )
-        return RC ( rcDB, rcNode, rcRenaming, rcMetadata, rcNull );
-    if ( from == NULL || to == NULL )
-        return RC ( rcDB, rcNode, rcRenaming, rcPath, rcNull );
-    if ( from [ 0 ] == 0 || to [ 0 ] == 0 )
-        return RC ( rcDB, rcNode, rcRenaming, rcPath, rcInvalid );
-    if ( self -> read_only )
-        return RC ( rcDB, rcNode, rcRenaming, rcNode, rcReadonly );
-
-    /* generate full path */
-    len = snprintf ( full, sizeof full, "%s", from );
-    if ( len < 0 || len >= sizeof full )
-        return RC ( rcDB, rcNode, rcRenaming, rcPath, rcExcessive );
-
-    rc = KMDataNodeFind ( self, & found, & p );
-    if ( rc == 0 )
-    {
-        KMDataNode *renamed;
-
-        if ( atomic32_read ( & found -> refcount ) != 0 )
-            return RC ( rcDB, rcNode, rcRenaming, rcNode, rcBusy );
-
-        len = snprintf ( p = full, sizeof full, "%s", to );
-        if ( len < 0 || len >= sizeof full )
-            return RC ( rcDB, rcNode, rcRenaming, rcPath, rcExcessive );
-
-        rc = KMDataNodeFind ( self, & renamed, & p );
-        if ( GetRCState ( rc ) == rcNotFound )
-        {
-            rc = KMDataNodeMake ( renamed, & renamed, p );
-            if ( rc == 0 )
-            {
-                BSTreeUnlink ( & found -> par -> child, & found -> n );
-
-                renamed -> attr = found -> attr;
-                BSTreeInit ( & found -> attr );
-
-                renamed -> child = found -> child;
-                BSTreeInit ( & found -> child );
-                BSTreeForEach ( & renamed -> child,
-                    false, KMDataNodeRelinkParent, renamed );
-
-                renamed -> value = found -> value;
-                renamed -> vsize = found -> vsize;
-                found -> value = NULL;
-                found -> vsize = 0;
-
-                KMDataNodeWhack ( & found -> n, NULL );
-                self -> meta -> dirty = true;
-            }
-        }
-        else if ( rc == 0 )
-            rc = RC ( rcDB, rcNode, rcRenaming, rcNode, rcExists );
-    }
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * KMetadata
- *  a versioned, hierarchical structure
- */
-
-/* Flush
- */
-typedef struct KMDFlushData KMDFlushData;
-struct KMDFlushData
-{
-    uint64_t pos;
-    KFile *f;
-    KMD5File *fmd5;
-    uint8_t *buffer;
-    size_t bsize;
-    size_t marker;
-    rc_t rc;
-};
-
-static
-rc_t CC KMDWriteFunc ( void *param, const void *buffer, size_t size, size_t *num_writ )
-{
-    KMDFlushData *pb = param;
-    size_t total, to_write;
-
-    for ( total = 0; total < size; total += to_write )
-    {
-        to_write = size - total;
-        if ( pb -> marker + to_write > pb -> bsize )
-            to_write = pb -> bsize - pb -> marker;
-
-        if ( to_write > 0 )
-        {
-            memcpy ( pb -> buffer + pb -> marker,
-                ( const uint8_t* ) buffer + total, to_write );
-            pb -> marker += to_write;
-        }
-
-        if ( pb -> marker == pb -> bsize )
-        {
-            size_t num_flushed;
-            pb -> rc = KFileWrite ( pb -> f, pb -> pos,
-                pb -> buffer, pb -> bsize, & num_flushed );
-            if ( pb -> rc != 0 )
-            {
-                * num_writ = 0;
-                return pb -> rc;
-            }
-
-            if ( num_flushed == 0 )
-            {
-                * num_writ = total + to_write;
-                return pb -> rc = RC ( rcDB, rcMetadata, rcPersisting, rcTransfer, rcIncomplete );
-            }
-
-            pb -> marker -= num_flushed;
-            pb -> pos += num_flushed;
-
-            if ( pb -> marker != 0 )
-                memcpy ( pb -> buffer, pb -> buffer + num_flushed, pb -> marker );
-        }
-    }
-
-    * num_writ = total;
-    return 0;
-}
-
-static
-rc_t CC KMAttrNodeAuxFunc ( void *param, const void *node, size_t *num_writ,
-    PTWriteFunc write, void *write_param )
-{
-    const KMAttrNode *n = node;
-    size_t nsize = strlen ( n -> name );
-
-    if ( write != NULL )
-        return ( * write ) ( write_param, n -> name, nsize + n -> vsize + 1, num_writ );
-
-    * num_writ = nsize + n -> vsize + 1;
-    return 0;
-}
-
-static
-rc_t CC KMDataNodeAuxFunc ( void *param, const void *node, size_t *num_writ,
-    PTWriteFunc write, void *write_param )
-{
-    rc_t rc;
-    const KMDataNode *n = node;
-    size_t nsize = strlen ( n -> name );
-    size_t auxsize = 0;
-
-    /* first write node name */
-    if ( write != NULL )
-    {
-        uint8_t bits = ( uint8_t ) ( nsize - 1 ) << 2;
-        if ( n -> attr . root != NULL )
-            bits |= 1;
-        if ( n -> child . root != NULL )
-            bits |= 2;
-        rc = ( * write ) ( write_param, & bits, 1, num_writ );
-        if ( rc == 0 )
-            rc = ( * write ) ( write_param, n -> name, nsize, num_writ );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    /* if there are any attributes */
-    if ( n -> attr . root != NULL )
-    {
-        rc = BSTreePersist ( & n -> attr, num_writ,
-            write, write_param, KMAttrNodeAuxFunc, NULL );
-        if ( rc != 0 )
-            return rc;
-        auxsize += * num_writ;
-    }
-
-    /* if there are any children */
-    if ( n -> child . root != NULL )
-    {
-        rc = BSTreePersist ( & n -> child, num_writ,
-            write, write_param, KMDataNodeAuxFunc, NULL );
-        if ( rc != 0 )
-            return rc;
-        auxsize += * num_writ;
-    }
-
-    /* finally write value */
-    if ( write == NULL )
-    {
-        * num_writ = nsize + 1 + auxsize + n -> vsize;
-        return 0;
-    }
-
-    rc = ( * write ) ( write_param, n -> value, n -> vsize, num_writ );
-    * num_writ += nsize + 1 + auxsize;
-    return rc;
-}
-
-static
-rc_t KMetadataFlush ( KMetadata *self )
-{
-    rc_t rc;
-    KMDFlushData pb;
-    memset ( & pb, 0, sizeof pb );
-
-    /* allocate buffer */
-    pb . buffer = malloc ( pb . bsize = 32 * 1024 );
-    if ( pb . buffer == NULL )
-        rc = RC ( rcDB, rcMetadata, rcPersisting, rcMemory, rcExhausted );
-    else
-    {
-        /* open output file */
-        rc = KColumnFileCreate ( & pb . f, & pb . fmd5, self -> dir, self -> md5,
-                                 kcmInit | kcmParents, false, "md/cur.tmp" );
-        /* ZZZZ do we need a "KMD5FileReset ( pb -> fmd5 )" ? I don't think so */
-        if ( rc == 0 )
-        {
-            /* write header */
-            KDBHdr *hdr = ( KDBHdr* ) pb . buffer;
-            hdr -> endian = eByteOrderTag;
-            hdr -> version = KMETADATAVERS;
-            pb . marker = sizeof * hdr;
-
-            /* persist root node */
-            rc = BSTreePersist ( & self -> root -> child, NULL,
-                KMDWriteFunc, & pb, KMDataNodeAuxFunc, NULL );
-            if ( rc == 0 && pb . marker != 0 )
-            {
-                size_t num_flushed;
-                rc = KFileWrite ( pb . f, pb . pos,
-                                  pb . buffer, pb . marker, & num_flushed );
-                if ( rc == 0 && num_flushed != pb . marker )
-                    rc = RC ( rcDB, rcMetadata, rcPersisting, rcTransfer, rcIncomplete );
-            }
-            pb . rc = KFileRelease ( pb . f );
-            if ( pb . rc  ==  0 )
-                pb . fmd5 = NULL;
-            if ( rc == 0 && ( rc = pb . rc ) == 0 )
-            {
-                /* rename file */
-                rc = KDirectoryRename ( self -> dir, true, "md/cur.tmp", "md/cur" );
-
-                if ( self->md5 != NULL && rc == 0 )
-                    rc = KMD5SumFmtRename ( self -> md5, "md/cur.tmp", "md/cur" );
-
-                if ( rc == 0 )
-                    self -> dirty = false;
-            }
-        }
-
-        free ( pb . buffer );
-    }
-    return rc;
-}
-
-/* Whack
- */
-static
-rc_t KMetadataWhack ( KMetadata *self )
-{
-    rc_t rc = 0;
-    KSymbol * symb;
-    KDBManager *mgr = self -> mgr;
-    assert ( mgr != NULL );
-
-    KRefcountWhack ( & self -> refcount, "KMetadata" );
-
-    if ( self -> dirty )
-    {
-        /* if this was a version 1 file,
-           first freeze it */
-        if ( self -> vers == 1 )
-        {
-            rc = KMetadataFreeze ( self );
-            if ( rc != 0 )
-                return rc;
-        }
-
-        /* flush it */
-        rc = KMetadataFlush ( self );
-        if ( rc != 0 )
-            return rc;
-        self -> dirty = false;
-    }
-
-    if ( self -> db != NULL )
-    {
-        rc = KDatabaseSever ( self -> db );
-        if ( rc != 0 )
-            return rc;
-        self -> db = NULL;
-    }
-    else if ( self -> tbl != NULL )
-    {
-        rc = KTableSever ( self -> tbl );
-        if ( rc != 0 )
-            return rc;
-        self -> tbl = NULL;
-    }
-    else if ( self -> col != NULL )
-    {
-        rc = KColumnSever ( self -> col );
-        if ( rc != 0 )
-            return rc;
-        self -> col = NULL;
-    }
-
-    if ( self -> md5 != NULL )
-    {
-	rc = KMD5SumFmtRelease ( self -> md5 );
-	if ( rc != 0 )
-	    return rc;
-	self -> md5 = NULL;
-    }
-
-    /* remove from mgr */
-    symb = KDBManagerOpenObjectFind (mgr, self->path);
-    if (symb != NULL)
-    {
-        rc = KDBManagerOpenObjectDelete (mgr, symb);
-        if (rc == 0)
-        {
-            /* release manager
-               should never fail */
-            rc = KDBManagerSever ( mgr );
-            if ( rc != 0 )
-                KDBManagerOpenObjectAdd (mgr, symb);
-            else
-            {
-                /* complete */
-                KDirectoryRelease ( self -> dir );
-                atomic32_set ( & self -> refcount, 0 );
-                KMDataNodeWhack ( & self -> root -> n, NULL );
-                free ( self );
-                return 0;
-            }
-        }
-    }
-
-    KRefcountInit ( & self -> refcount, 1, "KMetadata", "whack", "kmeta" );
-    return rc;
-}
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-LIB_EXPORT rc_t CC KMetadataAddRef ( const KMetadata *cself )
-{
-    KMetadata *self = ( KMetadata* ) cself;
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KMetadata" ) )
-        {
-        case krefLimit:
-            return RC ( rcDB, rcMetadata, rcAttaching, rcRange, rcExcessive );
-        }
-        ++ self -> opencount;
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KMetadataRelease ( const KMetadata *cself )
-{
-    KMetadata *self = ( KMetadata* ) cself;
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KMetadata" ) )
-        {
-        case krefWhack:
-            return KMetadataWhack ( ( KMetadata* ) self );
-        case krefLimit:
-            return RC ( rcDB, rcMetadata, rcReleasing, rcRange, rcExcessive );
-        }
-        -- self -> opencount;
-    }
-    return 0;
-}
-
-static
-KMetadata *KMetadataAttach ( const KMetadata *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAddDep ( & self -> refcount, "KMetadata" ) )
-        {
-        case krefLimit:
-            return NULL;
-        }
-    }
-    return ( KMetadata* ) self;
-}
-
-static
-rc_t KMetadataSever ( const KMetadata *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDropDep ( & self -> refcount, "KMetadata" ) )
-        {
-        case krefWhack:
-            return KMetadataWhack ( ( KMetadata* ) self );
-        case krefLimit:
-            return RC ( rcDB, rcMetadata, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-/* Make
- */
-
-static
-rc_t KMetadataPopulate ( KMetadata *self, const KDirectory *dir, const char *path, bool read_only )
-{
-    const KFile *f;
-    rc_t rc = KDirectoryVOpenFileRead ( dir, & f, path, NULL );
-    if ( rc == 0 )
-    {
-        const KMMap *mm;
-        rc = KMMapMakeRead ( & mm, f );
-        if ( rc == 0 )
-        {
-            size_t size;
-            const void *addr;
-            rc = KMMapSize ( mm, & size );
-            if ( rc == 0 )
-                rc = KMMapAddrRead ( mm, & addr );
-
-            if ( rc == 0 )
-            {
-                union
-                {
-                    KDBHdr v1;
-                    KDBHdr v2;
-                } hdrs;
-
-                const KDBHdr *hdr = ( const KDBHdr* ) addr;
-                const void *pbstree_src = hdr + 1;
-
-                rc = KDBHdrValidate ( hdr, size, 1, KMETADATAVERS );
-                if ( self -> read_only && GetRCState ( rc ) == rcIncorrect && GetRCObject ( rc ) == rcByteOrder )
-                {
-                    hdrs . v1 . endian = bswap_32 ( hdr -> endian );
-                    hdrs . v1 . version = bswap_32 ( hdr -> version );
-                    rc = KDBHdrValidate ( & hdrs . v1, size, 1, KMETADATAVERS );
-                    if ( rc == 0 )
-                    {
-                        self -> byteswap = true;
-                        switch ( hdrs . v1 . version )
-                        {
-                        case 1:
-                            hdr = & hdrs . v1;
-                            break;
-                        case 2:
-                            hdr = & hdrs . v2;
-                            break;
-                        }
-                    }
-                }
-                if ( rc == 0 )
-                {
-                    PBSTree *bst;
-                    rc = PBSTreeMake ( & bst, pbstree_src, size - sizeof * hdr, self -> byteswap );
-                    if ( rc != 0 )
-                        rc = RC ( rcDB, rcMetadata, rcConstructing, rcData, rcCorrupt );
-                    else
-                    {
-                        KMDataNodeInflateData pb;
-
-                        pb . meta = self;
-                        pb . par = self -> root;
-                        pb . bst = & self -> root -> child;
-                        pb . node_size_limit = read_only ? NODE_SIZE_LIMIT : 0;
-                        pb . node_child_limit = read_only ? NODE_CHILD_LIMIT : 0;
-                        pb . rc = 0;
-                        pb . byteswap = self -> byteswap;
-
-                        if ( hdr -> version == 1 )
-                            PBSTreeDoUntil ( bst, false, KMDataNodeInflate_v1, & pb );
-                        else
-                            PBSTreeDoUntil ( bst, false, KMDataNodeInflate, & pb );
-                        rc = pb . rc;
-
-                        self -> vers = hdr -> version;
-
-                        PBSTreeWhack ( bst );
-                    }
-                }
-            }
-
-            KMMapRelease ( mm );
-        }
-
-        KFileRelease ( f );
-    }
-    return rc;
-}
-
-
-static
-rc_t KDBManagerInsertMetadata ( KDBManager * self, KMetadata * meta )
-{
-    rc_t rc;
-    rc = KDBManagerOpenObjectAdd (self, &meta->sym);
-    if ( rc == 0 )
-        meta -> mgr = KDBManagerAttach ( self );
-    return rc;
-}
-
-
-static
-rc_t KMetadataMake ( KMetadata **metap,
-    KDirectory *dir, const char *path, uint32_t rev,
-    bool populate, bool read_only )
-{
-    rc_t rc;
-    KMetadata *meta = malloc ( sizeof * meta + strlen ( path ) );
-    if ( meta == NULL )
-        rc = RC ( rcDB, rcMetadata, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        memset ( meta, 0, sizeof * meta );
-        meta -> root = calloc ( 1, sizeof * meta -> root );
-        if ( meta -> root == NULL )
-            rc = RC ( rcDB, rcMetadata, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            meta -> root -> meta = meta;
-            meta -> dir = dir;
-            KRefcountInit ( & meta -> refcount, 1, "KMetadata", "make-update", path );
-            meta -> opencount = 1;
-            meta -> rev = rev;
-            meta -> read_only = read_only;
-
-            strcpy ( meta -> path, path );
-
-            meta->sym.u.obj = meta;
-            StringInitCString (&meta->sym.name, meta->path);
-            meta->sym.type = kptMetadata;
-
-            KRefcountInit ( & meta -> root -> refcount, 0, "KMDataNode", "make-read", "/" );
-
-            if ( ! populate )
-            {
-                meta -> vers = KMETADATAVERS;
-                KDirectoryAddRef ( dir );
-                * metap = meta;
-                return 0;
-            }
-            
-            rc = KMetadataPopulate ( meta, dir, path, read_only );
-            if ( rc == 0 )
-            {
-                KDirectoryAddRef ( dir );
-                * metap = meta;
-                return 0;
-            }
-
-            free ( meta -> root );
-        }
-
-        free ( meta );
-    }
-    * metap = NULL;
-    return rc;
-}
-
-#if 0
-static
-rc_t KMetadataMakeRead ( KMetadata **meta,
-    const KDirectory *dir, const char *path, uint32_t rev )
-{
-    rc_t rc = KMetadataMakeUpdate ( meta,
-        ( KDirectory* ) dir, path, rev, true );
-    if ( rc == 0 )
-        ( * meta ) -> read_only = true;
-    return rc;
-}
-#endif
-
-
-/* OpenMetadataRead
- *  opens metadata for read
- *
- *  "meta" [ OUT ] - return parameter for metadata
- */
-static
-rc_t KDBManagerOpenMetadataReadInt ( KDBManager *self,
-    const KMetadata **metap, const KDirectory *wd, uint32_t rev, bool prerelease,bool *cached )
-{
-    char metapath [ 4096 ];
-    rc_t rc = ( prerelease == 1 ) ?
-        KDirectoryVResolvePath ( wd, true, metapath, sizeof metapath, "meta", NULL ):
-        ( ( rev == 0 ) ?
-          KDirectoryVResolvePath ( wd, true, metapath, sizeof metapath, "md/cur", NULL ):
-          KDirectoryResolvePath ( wd, true, metapath, sizeof metapath, "md/r%.3u", rev ) );
-    if(cached != NULL ) *cached = false;
-    if ( rc == 0 )
-    {
-        KMetadata * meta;
-        KSymbol * sym;
-
-        /* if already open */
-        sym = KDBManagerOpenObjectFind (self, metapath);
-        if (sym != NULL)
-        {
-            const KMetadata * cmeta;
-            rc_t obj;
-
-	    if(cached != NULL ) *cached = true;
-            switch (sym->type)
-            {
-            case kptMetadata:
-                cmeta = (KMetadata*)sym->u.obj;
-                /* if open for update, refuse */
-                if ( cmeta -> read_only )
-                {
-                    /* attach a new reference and we're gone */
-                    rc = KMetadataAddRef ( cmeta );
-                    if ( rc == 0 )
-                        * metap = cmeta;
-                    return rc;
-                }
-                obj = rcMetadata;
-                break;
-
-            default:
-                obj = rcPath;
-                break;
-            case kptTable:
-                obj = rcTable;
-                break;
-            case kptColumn:
-                obj = rcColumn;
-                break;
-            case kptIndex:
-                obj = rcIndex;
-                break;
-            case kptDatabase:
-                obj = rcDatabase;
-                break;
-            }
-            return  RC (rcDB, rcMgr, rcOpening, obj, rcBusy);
-	}
-
-
-        switch ( KDirectoryVPathType ( wd, metapath, NULL ) )
-        {
-        case kptNotFound:
-            rc = RC ( rcDB, rcMgr, rcOpening, rcMetadata, rcNotFound );
-            break;
-        case kptBadPath:
-            rc = RC ( rcDB, rcMgr, rcOpening, rcPath, rcInvalid );
-            break;
-        case kptFile:
-        case kptFile | kptAlias:
-            break;
-        default:
-            rc = RC ( rcDB, rcMgr, rcOpening, rcPath, rcIncorrect );
-            break;
-        }
-
-        if ( rc == 0 )
-        {
-            rc = KMetadataMake ( & meta, ( KDirectory* ) wd, metapath, rev, true, true );
-            
-            if ( rc == 0 )
-            {
-                rc = KDBManagerInsertMetadata (self, meta );
-                if ( rc == 0 )
-                {
-                    * metap = meta;
-                    return 0;
-                }
-
-                KMetadataRelease ( meta );
-            }
-
-/*             rc = RC ( rcDB, rcMgr, rcOpening, rcMetadata, rcExists ); */
-        }
-    }
-    
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDatabaseOpenMetadataRead ( const KDatabase *self, const KMetadata **metap )
-{
-    rc_t rc;
-    const KMetadata *meta;
-    bool  meta_is_cached;
-
-    if ( metap == NULL )
-        return RC ( rcDB, rcDatabase, rcOpening, rcParam, rcNull );
-
-    * metap = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcDatabase, rcOpening, rcSelf, rcNull );
-
-    rc = KDBManagerOpenMetadataReadInt ( self -> mgr, & meta, self -> dir, 0, false, &meta_is_cached );
-    if ( rc == 0 )
-    {
-        if(!meta_is_cached) ((KMetadata*)meta) -> db = KDatabaseAttach ( self );
-        * metap = meta;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KTableOpenMetadataRead ( const KTable *self, const KMetadata **metap )
-{
-    rc_t rc;
-    const KMetadata *meta;
-    bool  meta_is_cached;
-
-    if ( metap == NULL )
-        return RC ( rcDB, rcTable, rcOpening, rcParam, rcNull );
-
-    * metap = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcTable, rcOpening, rcSelf, rcNull );
-
-    rc = KDBManagerOpenMetadataReadInt ( self -> mgr, & meta, self -> dir, 0, self -> prerelease, &meta_is_cached );
-    if ( rc == 0 )
-    {
-        if(!meta_is_cached) ((KMetadata*)meta) -> tbl = KTableAttach ( self );
-        * metap = meta;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KColumnOpenMetadataRead ( const KColumn *self, const KMetadata **metap )
-{
-    rc_t rc;
-    const KMetadata *meta;
-    bool  meta_is_cached;
-
-    if ( metap == NULL )
-        return RC ( rcDB, rcColumn, rcOpening, rcParam, rcNull );
-
-    * metap = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcColumn, rcOpening, rcSelf, rcNull );
-
-    rc = KDBManagerOpenMetadataReadInt ( self -> mgr, & meta, self -> dir, 0, false, &meta_is_cached );
-    if ( rc == 0 )
-    {
-        if(!meta_is_cached) ((KMetadata*)meta) -> col = KColumnAttach ( self );
-        * metap = meta;
-    }
-
-    return rc;
-}
-
-/* OpenMetadataUpdate
- *  open metadata for read/write
- *
- *  "meta" [ OUT ] - return parameter for metadata
- */
-static
-rc_t KDBManagerOpenMetadataUpdateInt ( KDBManager *self,
-    KMetadata **metap, KDirectory *wd, KMD5SumFmt * md5 )
-{
-/* WAK
- * NEEDS MD5 UPDATE???
- */
-    char metapath [ 4096 ];
-    rc_t rc = KDirectoryVResolvePath ( wd, true,
-        metapath, sizeof metapath, "md/cur", NULL );
-    if ( rc == 0 )
-    {
-        KSymbol * sym;
-        KMetadata *meta;
-        bool populate = true;
-
-        switch ( KDirectoryVPathType ( wd, metapath, NULL ) )
-        {
-        case kptNotFound:
-            populate = false;
-            break;
-        case kptBadPath:
-            return RC ( rcDB, rcMgr, rcOpening, rcPath, rcInvalid );
-        case kptFile:
-        case kptFile | kptAlias:
-            break;
-        default:
-            return RC ( rcDB, rcMgr, rcOpening, rcPath, rcIncorrect );
-        }
-
-        /* if already open */
-        sym = KDBManagerOpenObjectFind (self, metapath);
-        if (sym != NULL)
-        {
-            rc_t obj;
-            switch (sym->type)
-            {
-            default:
-                obj = rcPath;
-                break;
-            case kptDatabase:
-                obj = rcDatabase;
-                break;
-            case kptTable:
-                obj = rcTable;
-                break;
-            case kptColumn:
-                obj = rcColumn;
-                break;
-            case kptIndex:
-                obj = rcIndex;
-                break;
-            case kptMetadata:
-                obj = rcMetadata;
-                break;
-            }
-            return RC ( rcDB, rcMgr, rcOpening, obj, rcBusy );
-        }
-
-        rc = KMetadataMake ( & meta, wd, metapath, 0, populate, false );
-        if ( rc == 0 )
-        {
-            rc = KDBManagerInsertMetadata (self, meta);
-            if (rc == 0)
-            {
-                if ( md5 != NULL )
-                {
-                    meta -> md5 = md5;
-                    rc = KMD5SumFmtAddRef ( md5 );
-                }
-
-                if ( rc == 0 )
-                {
-                    * metap = meta;
-                    return 0;
-                }
-            }
-
-            KMetadataRelease ( meta );
-        }
-    }
-    
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDatabaseOpenMetadataUpdate ( KDatabase *self, KMetadata **metap )
-{
-    rc_t rc;
-    KMetadata *meta;
-
-    if ( metap == NULL )
-        return RC ( rcDB, rcDatabase, rcOpening, rcParam, rcNull );
-
-    * metap = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcDatabase, rcOpening, rcSelf, rcNull );
-
-    if ( self -> read_only )
-        return RC ( rcDB, rcDatabase, rcOpening, rcDatabase, rcReadonly );
-
-    rc = KDBManagerOpenMetadataUpdateInt ( self -> mgr, & meta, self -> dir, self -> md5 );
-    if ( rc == 0 )
-    {
-        meta -> db = KDatabaseAttach ( self );
-        * metap = meta;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KTableOpenMetadataUpdate ( KTable *self, KMetadata **metap )
-{
-    rc_t rc;
-    KMetadata *meta;
-
-    if ( metap == NULL )
-        return RC ( rcDB, rcTable, rcOpening, rcParam, rcNull );
-
-    * metap = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcTable, rcOpening, rcSelf, rcNull );
-
-    if ( self -> read_only )
-        return RC ( rcDB, rcTable, rcOpening, rcTable, rcReadonly );
-
-    rc = KDBManagerOpenMetadataUpdateInt ( self -> mgr, & meta, self -> dir, self -> md5 );
-    if ( rc == 0 )
-    {
-        meta -> tbl = KTableAttach ( self );
-        * metap = meta;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KColumnOpenMetadataUpdate ( KColumn *self, KMetadata **metap )
-{
-    rc_t rc;
-    KMetadata *meta;
-
-    if ( metap == NULL )
-        return RC ( rcDB, rcColumn, rcOpening, rcParam, rcNull );
-
-    * metap = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcColumn, rcOpening, rcSelf, rcNull );
-
-    if ( self -> read_only )
-        return RC ( rcDB, rcColumn, rcOpening, rcColumn, rcReadonly );
-
-    rc = KDBManagerOpenMetadataUpdateInt ( self -> mgr, & meta, self -> dir, self -> md5 );
-    if ( rc == 0 )
-    {
-        meta -> col = KColumnAttach ( self );
-        * metap = meta;
-    }
-
-    return rc;
-}
-
-
-/* Version
- *  returns the metadata format version
- */
-LIB_EXPORT rc_t CC KMetadataVersion ( const KMetadata *self, uint32_t *version )
-{
-    if ( version == NULL )
-        return RC ( rcDB, rcMetadata, rcAccessing, rcParam, rcNull );
-
-    if ( self == NULL )
-    {
-        * version = 0;
-        return RC ( rcDB, rcMetadata, rcAccessing, rcSelf, rcNull );
-    }
-
-    * version = self -> vers;
-    return 0;
-}
-
-
-/* ByteOrder
- *  indicates whether original byte order is reversed
- *  under current architecture.
- *
- *  the byte order of the column is established by
- *  the host architecture when created.
- *
- *  "reversed" [ OUT ] - if true, the original byte
- *  order is reversed with regard to host native byte order.
- */
-LIB_EXPORT rc_t CC KMetadataByteOrder ( const KMetadata *self, bool *reversed )
-{
-    if ( reversed == NULL )
-        return RC ( rcDB, rcMetadata, rcAccessing, rcParam, rcNull );
-
-    if ( self == NULL )
-    {
-        * reversed = false;
-        return RC ( rcDB, rcMetadata, rcAccessing, rcSelf, rcNull );
-    }
-
-    * reversed = self -> byteswap;
-    return 0;
-}
-
-
-/* Revision
- *  returns current revision number
- *  where 0 ( zero ) means tip
- */
-LIB_EXPORT rc_t CC KMetadataRevision ( const KMetadata *self, uint32_t *revision )
-{
-    if ( revision == NULL )
-        return RC ( rcDB, rcMetadata, rcAccessing, rcParam, rcNull );
-
-    if ( self == NULL )
-    {
-        * revision = 0;
-        return RC ( rcDB, rcMetadata, rcAccessing, rcSelf, rcNull );
-    }
-
-    * revision = self -> rev;
-    return 0;
-}
-
-
-/* MaxRevision
- *  returns the maximum revision available
- */
-LIB_EXPORT rc_t CC KMetadataMaxRevision ( const KMetadata *self, uint32_t *revision )
-{
-    rc_t rc;
-    KNamelist *listing;
-
-    if ( revision == NULL )
-        return RC ( rcDB, rcMetadata, rcAccessing, rcParam, rcNull );
-
-    * revision = 0;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcMetadata, rcAccessing, rcSelf, rcNull );
-
-    rc = KDirectoryVList ( self -> dir,
-        & listing, NULL, NULL, "md", NULL );
-    if ( rc == 0 )
-    {
-        uint32_t rev_max, count;
-        rc = KNamelistCount ( listing, & count );
-        if ( rc == 0 )
-        {
-            uint32_t idx;
-            for ( rev_max = idx = 0; idx < count; ++ idx )
-            {
-                const char *name;
-                    
-                rc = KNamelistGet ( listing, idx, & name );
-                if ( rc != 0 )
-                    break;
-                    
-                if ( name [ 0 ] == 'r' )
-                {
-                    char *end;
-                    uint32_t rev = strtou32 ( name + 1, & end, 10 );
-                    if ( end [ 0 ] == 0 && rev > rev_max )
-                        rev_max = rev;
-                }
-            }
-
-            * revision = rev_max;
-        }
-                
-        KNamelistRelease ( listing );
-    }
-    else if ( GetRCState ( rc ) == rcNotFound )
-    {
-        rc = 0;
-    }
-
-    return rc;
-}
-
-
-/* Commit
- *  ensure any changes are committed to disk
- */
-LIB_EXPORT rc_t CC KMetadataCommit ( KMetadata *self )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcMetadata, rcCommitting, rcSelf, rcNull );
-
-    /* only flush if dirty */
-    if ( ! self -> dirty )
-        return 0;
-
-    /* if this was a version 1 file,
-       first freeze it */
-    if ( self -> vers == 1 )
-    {
-        rc = KMetadataFreeze ( self );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    /* flush it */
-    rc = KMetadataFlush ( self );
-    if ( rc == 0 )
-        self -> dirty = false;
-
-    return rc;
-}
-
-
-/* Freeze
- *  freezes current metadata revision
- *  further modification will begin on a copy
- */
-LIB_EXPORT rc_t CC KMetadataFreeze ( KMetadata *self )
-{
-    rc_t rc;
-    uint32_t rev_max;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcMetadata, rcFreezing, rcSelf, rcNull );
-
-    if ( self -> read_only )
-        return RC ( rcDB, rcMetadata, rcFreezing, rcMetadata, rcReadonly );
-
-    switch ( KDirectoryVPathType ( self -> dir, "md/cur", NULL ) )
-    {
-    case kptFile:
-        break;
-    case kptFile | kptAlias:
-        return 0;
-    default:
-        return RC ( rcDB, rcMetadata, rcFreezing, rcPath, rcInvalid );
-    }
-
-    /* find max revision */
-    rc = KMetadataMaxRevision ( self, & rev_max );
-    if ( rc == 0 )
-    {
-        int len;
-        char revision [ 16 ];	/* nice even stack (could have been 8) */
-
-        /* rename tip to new version */
-        len = snprintf ( revision, sizeof revision, "md/r%.3u", rev_max + 1 );
-        if ( len < 0 || len >= sizeof revision )
-            return RC ( rcDB, rcMetadata, rcFreezing, rcPath, rcInvalid );
-
-        rc = KDirectoryRename ( self -> dir, false, "md/cur", revision );
-        if ( rc == 0 )
-        {
-            /* now create link to this guy */
-            rc = KDirectoryCreateAlias ( self -> dir,
-                0777, kcmCreate, revision, "md/cur" );
-
-            if ( rc == 0 )
-            {
-                if ( self -> md5 != NULL )
-                {
-                    rc = KMD5SumFmtRename ( self -> md5, "md/cur", revision );
-                    if ( rc != 0 )	/* attempt to recover */
-                        KDirectoryRemove ( self -> dir, false, "md/cur" );
-                }
-            }
-            if ( rc != 0 )                /* attempt to recover */
-                KDirectoryRename ( self -> dir, false, revision, "md/cur" );
-        }
-    }
-        
-    return rc;
-}
-
-
-/* OpenRevision
- *  opens a read-only indexed revision of metadata
- */
-LIB_EXPORT rc_t CC KMetadataOpenRevision ( const KMetadata *self,
-    const KMetadata **metap, uint32_t revision )
-{
-    rc_t rc;
-    const KMetadata *meta;
-    bool  meta_is_cached;
-
-    if ( metap == NULL )
-        return RC ( rcDB, rcMetadata, rcOpening, rcParam, rcNull );
-
-    * metap = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcMetadata, rcOpening, rcSelf, rcNull );
-
-    rc = KDBManagerOpenMetadataReadInt ( self -> mgr,
-        & meta, self -> dir, revision, false, &meta_is_cached  );
-    if ( rc == 0 )
-    {
-        if(!meta_is_cached)
-	{
-	    if ( self -> db != NULL )
-                ((KMetadata*)meta) -> db = KDatabaseAttach ( self -> db );
-            else if ( self -> tbl != NULL )
-                ((KMetadata*)meta) -> tbl = KTableAttach ( self -> tbl );
-            else if ( self -> col != NULL )
-                ((KMetadata*)meta) -> col = KColumnAttach ( self -> col );
-	}
-
-        * metap = meta;
-    }
-
-    return rc;
-}
-
-
-/* GetSequence
- * SetSequence
- * NextSequence
- *  access a named sequence
- *
- *  "seq" [ IN ] - NUL terminated sequence name
- *
- *  "val" [ OUT ] - return parameter for sequence value
- *  "val" [ IN ] - new sequence value
- */
-LIB_EXPORT rc_t CC KMetadataGetSequence ( const KMetadata *self,
-    const char *seq, int64_t *val )
-{
-    rc_t rc;
-    const KMDataNode *found;
-
-    if ( val == NULL )
-        return RC ( rcDB, rcMetadata, rcAccessing, rcParam, rcNull );
-    * val = 0;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcMetadata, rcAccessing, rcSelf, rcNull );
-    if ( seq == NULL )
-        return RC ( rcDB, rcMetadata, rcAccessing, rcPath, rcNull );
-    if ( seq [ 0 ] == 0 )
-        return RC ( rcDB, rcMetadata, rcAccessing, rcPath, rcInvalid );
-
-    rc = KMDataNodeOpenNodeRead ( self -> root, & found, ".seq/%s", seq );
-    if ( rc == 0 )
-    {
-        rc = KMDataNodeReadB64 ( found, val );
-        KMDataNodeRelease ( found );
-    }
-    
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMetadataSetSequence ( KMetadata *self,
-    const char *seq, int64_t val )
-{
-    rc_t rc;
-    KMDataNode *found;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcMetadata, rcUpdating, rcSelf, rcNull );
-    if ( seq == NULL )
-        return RC ( rcDB, rcMetadata, rcUpdating, rcPath, rcNull );
-    if ( seq [ 0 ] == 0 )
-        return RC ( rcDB, rcMetadata, rcUpdating, rcPath, rcInvalid );
-
-    rc = KMDataNodeOpenNodeUpdate ( self -> root, & found, ".seq/%s", seq );
-    if ( rc == 0 )
-    {
-        rc = KMDataNodeWriteB64 ( found, & val );
-        KMDataNodeRelease ( found );
-    }
-        
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMetadataNextSequence ( KMetadata *self,
-    const char *seq, int64_t *val )
-{
-    rc_t rc;
-    KMDataNode *found;
-
-    if ( val == NULL )
-        return RC ( rcDB, rcMetadata, rcUpdating, rcParam, rcNull );
-    * val = 0;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcMetadata, rcUpdating, rcSelf, rcNull );
-    if ( seq == NULL )
-        return RC ( rcDB, rcMetadata, rcUpdating, rcPath, rcNull );
-    if ( seq [ 0 ] == 0 )
-        return RC ( rcDB, rcMetadata, rcUpdating, rcPath, rcInvalid );
-
-    rc = KMDataNodeOpenNodeUpdate ( self -> root, & found, ".seq/%s", seq );
-    if ( rc == 0 )
-    {
-        rc = KMDataNodeReadB64 ( found, val );
-        if ( rc == 0 || GetRCState ( rc ) == rcIncomplete )
-        {
-            * val += 1;
-            rc = KMDataNodeWriteB64 ( found, val );
-        }
-
-        KMDataNodeRelease ( found );
-    }
-
-    return rc;
-}
-
-
-
-/*--------------------------------------------------------------------------
- * KNamelist
- */
-typedef struct KMDataNodeNamelist KMDataNodeNamelist;
-struct KMDataNodeNamelist
-{
-    KNamelist dad;
-    const KMDataNode *node;
-    size_t count;
-    const char *namelist [ 1 ];
-};
-
-/* Whack
- */
-static
-rc_t CC KMDataNodeNamelistWhack ( KMDataNodeNamelist *self )
-{
-    rc_t rc = KMDataNodeRelease ( self -> node );
-    if ( rc == 0 )
-        free ( self );
-    return rc;
-}
-
-/* Count
- */
-static
-rc_t CC KMDataNodeNamelistCount ( const KMDataNodeNamelist *self, uint32_t *count )
-{
-    * count = ( uint32_t ) self -> count;
-    return 0;
-}
-
-/* Get
- */
-static
-rc_t CC KMDataNodeNamelistGet ( const KMDataNodeNamelist *self,
-    uint32_t idx, const char **name )
-{
-    if ( ( size_t ) idx >= self -> count )
-        return RC ( rcDB, rcNamelist, rcAccessing, rcParam, rcExcessive );
-    * name = self -> namelist [ idx ];
-    return 0;
-}
-
-/* Make
- */
-static KNamelist_vt_v1 vtKMDataNodeNamelist =
-{
-    /* version 1.0 */
-    1, 0,
-
-    /* start minor version 0 methods */
-    KMDataNodeNamelistWhack,
-    KMDataNodeNamelistCount,
-    KMDataNodeNamelistGet
-    /* end minor version 0 methods */
-};
-
-static
-rc_t KMDataNodeNamelistMake ( KNamelist **names, unsigned int count )
-{
-    rc_t rc;
-    KMDataNodeNamelist *self = calloc ( 1, sizeof * self -
-        sizeof self -> namelist + count * sizeof self -> namelist [ 0 ] );
-    if ( self == NULL )
-        rc = RC ( rcDB, rcNamelist, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        rc = KNamelistInit ( & self -> dad,
-            ( const KNamelist_vt* ) & vtKMDataNodeNamelist );
-        if ( rc == 0 )
-        {
-            * names = & self -> dad;
-            return 0;
-        }
-        
-        free ( self );
-    }
-
-    return rc;
-}
-
-/* List
- *  create metadata node listings
- */
-static
-void CC KMDataNodeListCount ( BSTNode *n, void *data )
-{
-    * ( unsigned int* ) data += 1;
-}
-
-static
-void CC KMDataNodeGrabAttr ( BSTNode *n, void *data )
-{
-    KMDataNodeNamelist *list = data;
-    list -> namelist [ list -> count ++ ] = ( ( const KMAttrNode* ) n ) -> name;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeListAttr ( const KMDataNode *self, KNamelist **names )
-{
-    rc_t rc;
-    unsigned int count;
-
-    if ( names == NULL )
-        return RC ( rcDB, rcNode, rcListing, rcParam, rcNull );
-    * names = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcNode, rcListing, rcSelf, rcNull );
-
-    count = 0;
-    BSTreeForEach ( & self -> attr, 0, KMDataNodeListCount, & count );
-
-    rc = KMDataNodeNamelistMake ( names, count );
-    if ( rc == 0 )
-        BSTreeForEach ( & self -> attr, false, KMDataNodeGrabAttr, * names );
-
-    return rc;
-}
-
-static
-void CC KMDataNodeGrabName ( BSTNode *n, void *data )
-{
-    KMDataNodeNamelist *list = data;
-    list -> namelist [ list -> count ++ ] = ( ( const KMDataNode* ) n ) -> name;
-}
-
-LIB_EXPORT rc_t CC KMDataNodeListChildren ( const KMDataNode *self, KNamelist **names )
-{
-    rc_t rc;
-    unsigned int count;
-
-    if ( names == NULL )
-        return RC ( rcDB, rcNode, rcListing, rcParam, rcNull );
-    * names = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcNode, rcListing, rcSelf, rcNull );
-
-    count = 0;
-    BSTreeForEach ( & self -> child, 0, KMDataNodeListCount, & count );
-
-    rc = KMDataNodeNamelistMake ( names, count );
-    if ( rc == 0 )
-        BSTreeForEach ( & self -> child, false, KMDataNodeGrabName, * names );
-
-    return rc;
-}
diff --git a/libs/kdb/wtable-priv.h b/libs/kdb/wtable-priv.h
deleted file mode 100644
index cda3fa5..0000000
--- a/libs/kdb/wtable-priv.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_table_priv_
-#define _h_table_priv_
-
-#ifndef _h_kdb_table_
-#include <kdb/table.h>
-#endif
-
-#ifndef _h_klib_container_
-#include <klib/container.h>
-#endif
-
-#ifndef _h_klib_refcount_
-#include <klib/refcount.h>
-#endif
-
-#include <klib/symbol.h>
-#include <kfs/md5.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KDatabase;
-struct KDBManager;
-struct KDirectory;
-
-
-/*--------------------------------------------------------------------------
- * KTable
- *  represents a table
- *  normally implemented as a directory
- *  but may be a single archive file
- *  in either executable or streamable format
- */
-struct KTable
-{
-    struct KDirectory *dir;
-    struct KDBManager *mgr;
-    struct KDatabase *db;
-    struct KMD5SumFmt *md5;
-
-    KRefcount refcount;
-    uint32_t opencount;
-    bool use_md5;
-    bool read_only;
-    bool prerelease;
-    uint8_t align [ 5 ];
-
-    KSymbol sym;
-
-    char path [ 1 ];
-};
-
-/* Attach
- * Sever
- *  like KTableRelease, except called internally
- *  indicates that a child object is letting go...
- */
-KTable *KTableAttach ( const KTable *self );
-rc_t KTableSever ( const KTable *self );
-
-/* Cmp
- * Sort
- */
-int KTableCmp ( const void *item, const BSTNode *n );
-int KTableSort ( const BSTNode *item, const BSTNode *n );
-
-/* check a disk-resident column for needing re-indexing */
-bool KTableColumnNeedsReindex ( KTable *self, const char *colname );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_table_priv_ */
diff --git a/libs/kdb/wtable.c b/libs/kdb/wtable.c
deleted file mode 100644
index 8ce9885..0000000
--- a/libs/kdb/wtable.c
+++ /dev/null
@@ -1,1590 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#define TRACK_REFERENCES 0
-
-#include <kdb/extern.h>
-#include "wtable-priv.h"
-#include "dbmgr-priv.h"
-#include "database-priv.h"
-#include "wcolumn-priv.h"
-#include "windex-priv.h"
-#include "wkdb-priv.h"
-
-#include <klib/namelist.h>
-#include <klib/symbol.h>
-#include <kdb/namelist.h>
-#include <klib/log.h>
-#include <klib/printf.h>
-#include <klib/rc.h>
-#include <kfs/directory.h>
-#include <kfs/file.h>
-#include <kfs/md5.h>
-#include <kfs/impl.h>
-#include <sysalloc.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-/* keep file system structure compatible with v0 code */
-#define V0_BACKWARD_COMPAT 0
-
-/*--------------------------------------------------------------------------
- * KTable
- *  a collection of columns indexed by row id, metadata, indices
- */
-
-/* GetPath
- *  return the absolute path to table
- */
-LIB_EXPORT rc_t CC KTableGetPath ( const KTable *self,
-    const char **path )
-{
-    if ( self == NULL )
-        return RC ( rcDB, rcTable, rcAccessing, rcSelf, rcNull );
-    if ( path == NULL )
-        return RC ( rcDB, rcTable, rcAccessing, rcParam, rcNull );
-
-    *path = self->path;
-
-    return 0;
-}
-
-/* Whack
- */
-static
-rc_t KTableWhack ( KTable *self )
-{
-    rc_t rc = 0;
-    KDBManager *mgr = self -> mgr;
-    KSymbol * symb;
-    assert ( mgr != NULL );
-
-    KRefcountWhack ( & self -> refcount, "KTable" );
-
-    if ( self -> db != NULL )
-    {
-        rc = KDatabaseSever ( self -> db );
-        if ( rc != 0 )
-            return rc;
-        self -> db = NULL;
-    }
-
-    /* shut down md5 sum file if it is open */
-    KMD5SumFmtRelease ( self -> md5 ), self -> md5 = NULL;
-
-    /* remove from mgr */
-    symb = KDBManagerOpenObjectFind (mgr, self->path);
-    if (symb != NULL)
-    {
-        rc = KDBManagerOpenObjectDelete (mgr, symb);
-        if (rc == 0)
-        {
-            rc = KDBManagerSever ( mgr );
-            if ( rc != 0 )
-                rc = KDBManagerOpenObjectAdd (mgr, symb);
-            else
-            {
-                /* complete */
-                KDirectoryRelease ( self -> dir );
-                free ( self );
-                return 0;
-            }
-        }
-    }
-
-    KRefcountInit ( & self -> refcount, 1, "KTable", "whack", "ktbl" );
-
-    return rc;
-}
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-LIB_EXPORT rc_t CC KTableAddRef ( const KTable *cself )
-{
-    KTable *self = ( KTable* ) cself;
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KTable" ) )
-        {
-        case krefLimit:
-            return RC ( rcDB, rcTable, rcAttaching, rcRange, rcExcessive );
-        }
-        ++ self -> opencount;
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KTableRelease ( const KTable *cself )
-{
-    KTable *self = ( KTable* ) cself;
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KTable" ) )
-        {
-        case krefWhack:
-            return KTableWhack ( ( KTable* ) self );
-        case krefLimit:
-            return RC ( rcDB, rcTable, rcReleasing, rcRange, rcExcessive );
-        }
-        -- self -> opencount;
-    }
-    return 0;
-}
-
-
-/* Attach
- * Sever
- */
-KTable *KTableAttach ( const KTable *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAddDep ( & self -> refcount, "KTable" ) )
-        {
-        case krefLimit:
-            return NULL;
-        }
-    }
-    return ( KTable* ) self;
-}
-
-/* Sever
- *  like KTableRelease, except called internally
- *  indicates that a child object is letting go...
- */
-rc_t KTableSever ( const KTable *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDropDep ( & self -> refcount, "KTable" ) )
-        {
-        case krefWhack:
-            assert ( self -> opencount == 0 );
-            return KTableWhack ( ( KTable* ) self );
-        case krefLimit:
-            return RC ( rcDB, rcTable, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/* Make
- *  make an initialized structure
- *  NB - does NOT attach reference to dir, but steals it
- */
-static
-rc_t KTableMake ( KTable **tblp, const KDirectory *dir, const char *path,
-		  KMD5SumFmt * md5, bool read_only )
-{
-    KTable *tbl;
-
-    assert ( tblp != NULL );
-    assert ( path != NULL );
-
-    tbl = malloc ( sizeof * tbl + strlen ( path ) );
-    if ( tbl == NULL )
-    {
-        * tblp = NULL;
-        return RC ( rcDB, rcTable, rcConstructing, rcMemory, rcExhausted );
-    }
-
-    memset ( tbl, 0, sizeof * tbl );
-    tbl -> dir = ( KDirectory* ) dir;
-    KRefcountInit ( & tbl -> refcount, 1, "KTable", "make", path );
-    tbl -> opencount = 1;
-    tbl -> md5 = md5;
-    KMD5SumFmtAddRef ( md5 );
-    tbl -> use_md5 = ( md5 == NULL ) ? false : true;
-    tbl -> read_only = read_only;
-    strcpy ( tbl -> path, path );
-
-    tbl->sym.u.obj = tbl;
-    StringInitCString (&tbl->sym.name, tbl->path);
-    tbl->sym.type = kptTable;
-
-    * tblp = tbl;
-    return 0;
-}
-
-static
-rc_t KDBManagerInsertTable ( KDBManager * self, KTable * tbl )
-{
-    rc_t rc;
-    rc = KDBManagerOpenObjectAdd (self, &tbl->sym);
-    if ( rc == 0 )
-        tbl -> mgr = KDBManagerAttach ( self );
-    return rc;
-}
-
-
-static
-rc_t KDBManagerMakeTableUpdate ( KDBManager *self,
-    KTable **tblp, KDirectory *wd, const char *path, bool convert, KMD5SumFmt * md5 )
-{
-    rc_t rc;
-    KDirectory *dir;
-
-    rc = KDirectoryVOpenDirUpdate ( wd, & dir, false, path, NULL );
-    if ( rc == 0 )
-    {
-        KTable * tbl;
-
-        if ( convert )
-        {
-            /* the old table layout:
-               <tbl>/
-               col/...
-               meta
-               sealed
-               skey
-            */
-            rc = KDirectoryVSetAccess ( dir, true, 0220, 0222, ".", NULL );
-            if ( rc == 0 )
-                rc = KDirectoryVCreateDir ( dir, 0775, kcmCreate, "md", NULL );
-            if ( rc == 0 )
-            {
-                rc = KDirectoryRename ( dir, false, "meta", "md/r001" );
-                if ( GetRCState ( rc ) == rcNotFound )
-                    rc = 0;
-                else if ( rc == 0 )
-                {
-                    rc = KDirectoryCreateAlias ( dir, 0777, kcmCreate, "md/r001", "md/cur" );
-#if V0_BACKWARD_COMPAT
-                    if ( rc == 0 )
-                        rc = KDirectoryCreateAlias ( dir, 0777, kcmCreate, "md/r001", "meta" );
-#endif
-                    if( rc == 0 ) {
-                        KFile* md5_file = NULL;
-                        if( (rc = KDirectoryOpenFileWrite(dir, &md5_file, true, "md5")) == 0 ) {
-                            KMD5SumFmt* fmd5 = NULL;
-                            if( (rc = KMD5SumFmtMakeUpdate(&fmd5, md5_file)) == 0 ) {
-                                if( (rc = KMD5SumFmtRename(fmd5, "meta", "md/r001")) == 0 ) {
-                                    rc = KMD5SumFmtFlush(fmd5);
-                                }
-                                KMD5SumFmtRelease(fmd5);
-                            } else {
-                                KFileRelease(md5_file);
-                            }
-                        }
-                    }
-                }
-            }
-            if ( rc == 0 )
-                rc = KDirectoryVCreateDir ( dir, 0775, kcmCreate, "idx", NULL );
-            if ( rc == 0 )
-            {
-                rc = KDirectoryRename ( dir, false, "skey", "idx/skey" );
-                if ( GetRCState ( rc ) == rcNotFound )
-                    rc = 0;
-                else if ( rc == 0 )
-                {
-                    KDirectoryRename ( dir, false, "skey.md5", "idx/skey.md5" );
-#if V0_BACKWARD_COMPAT
-                    rc = KDirectoryCreateAlias ( dir, 0777, kcmCreate, "idx/skey", "skey" );
-#endif
-                }
-            }
-            if ( rc == 0 )
-            {
-                if ( KDirectoryVPathType ( dir, "sealed", NULL ) == kptFile )
-                {
-                    rc = KDBLockDir ( dir, "." );
-#if ! V0_BACKWARD_COMPAT
-                    if ( rc == 0 )
-                        KDirectoryVRemove ( dir, true, "sealed", NULL );
-#endif
-                }
-            }
-            
-            if ( rc != 0 )
-                return rc;
-        }
-
-        /* Make the base object */
-        rc = KTableMake ( & tbl, dir, path, md5, false );
-        if ( rc == 0 )
-        {
-            rc = KDBManagerInsertTable ( self, tbl );
-
-            if ( rc == 0 )
-            {
-                * tblp = tbl;
-                return 0;
-            }
-
-            rc = RC ( rcDB, rcMgr, rcOpening, rcTable, rcBusy );
-                
-            free ( tbl );
-        }
-            
-        KDirectoryRelease ( dir );
-    }
-
-    return rc;
-}
-
-
-/* CreateTable
- * VCreateTable
- *  create a new or open an existing table
- *
- *  "tbl" [ OUT ] - return parameter for newly opened table
- *
- *  "cmode" [ IN ] - creation mode
- *
- *  "path" [ IN ] - NUL terminated string in
- *  wd-native character set giving path to table
- */
-static
-rc_t KDBManagerVCreateTableInt ( KDBManager *self,
-    KTable **tbl, KDirectory *wd, KCreateMode cmode, 
-    const char *path, va_list args )
-{
-    char tblpath [ 4096 ];
-    rc_t rc = KDirectoryVResolvePath ( wd, true,
-        tblpath, sizeof tblpath, path, args );
-    if ( rc == 0 )
-    {
-        bool convert = false;
-        bool not_found = false;
-
-        switch ( KDBPathType ( /*NULL,*/ wd, NULL, tblpath ) )
-        {
-        case kptNotFound:
-            not_found = true;
-            /* first good path */
-            break;
-
-        case kptBadPath:
-            return RC ( rcDB, rcMgr, rcCreating, rcPath, rcInvalid );
-
-        case kptTable:
-        case kptTable | kptAlias:
-            break;
-
-        case kptPrereleaseTbl:
-        case kptPrereleaseTbl | kptAlias:
-            convert = true;
-            break;
-
-        case kptDatabase:
-        case kptDatabase | kptAlias:
-            return RC (rcDB, rcMgr, rcCreating, rcDatabase, rcExists);
-
-        case kptColumn:
-        case kptColumn | kptAlias:
-            return RC (rcDB, rcMgr, rcCreating, rcColumn, rcExists);
-
-        case kptIndex:
-        case kptIndex | kptAlias:
-            return RC (rcDB, rcMgr, rcCreating, rcIndex, rcExists);
-
-        case kptMetadata:
-        case kptMetadata | kptAlias:
-            return RC (rcDB, rcMgr, rcCreating, rcMetadata, rcExists);
-
-        case kptFile:
-        case kptFile | kptAlias:
-            /* if we find a file, vary the failure if it is an archive that is a table
-             * or a non related file */
-            if (( KDBOpenPathTypeRead ( self, wd, tblpath, NULL, kptTable, NULL, false ) == 0 ) ||
-                ( KDBOpenPathTypeRead ( self, wd, tblpath, NULL, kptPrereleaseTbl, NULL, false ) == 0 ) )
-                return RC ( rcDB, rcMgr, rcCreating, rcTable, rcReadonly );
-            /* fall through */
-        default:
-            return RC ( rcDB, rcMgr, rcCreating, rcPath, rcIncorrect );
-        }
-
-        if (not_found == false)
-        {
-            /* found so is not good if we want to create new and not
-             * clear/init or open old
-             */
-            if ((cmode & kcmValueMask) == kcmCreate)
-                return RC ( rcDB, rcMgr, rcCreating, rcTable, rcExists );
-            if (KDBManagerOpenObjectBusy (self, tblpath))
-                return RC ( rcDB, rcMgr, rcCreating, rcTable, rcBusy );
-            /* test now for locked directory */
-            rc = KDBWritable ( wd, tblpath );
-            switch (GetRCState(rc))
-            {
-            default:
-                return rc;
-            case rcLocked:
-                return RC ( rcDB, rcMgr, rcCreating, rcTable, rcLocked );
-            case rcReadonly:
-                return RC ( rcDB, rcMgr, rcCreating, rcTable, rcReadonly );
-            case rcNotFound:
-                /* not found is good but probably unreachable */
-                break;
-            case 0:
-                break;
-            }
-        }
-
-        /* [re]create directory */
-        rc = KDirectoryVCreateDir ( wd, 0775, cmode, tblpath, NULL );
-        if ( rc == 0 )
-        {
-            KMD5SumFmt *md5 = NULL;
-
-            /* create column sub-directory */
-            rc = KDirectoryCreateDir ( wd, 0775, kcmOpen, "%s/col", tblpath );
-            if ( rc == 0 && ( cmode & kcmMD5 ) != 0 )
-            {
-                KFile * f;
-
-                /* create the md5 digest file */
-                rc = KDirectoryCreateFile ( wd, &f, true, 0664, kcmOpen, "%s/md5", tblpath );
-                if ( rc == 0 )
-                {
-                    rc = KMD5SumFmtMakeUpdate ( & md5, f );
-                    if ( rc != 0 )
-                        KFileRelease ( f );
-                }
-            }
-            
-            if ( rc == 0 )
-                rc = KDBManagerMakeTableUpdate ( self, tbl, wd, tblpath, convert, md5 );
-
-            KMD5SumFmtRelease ( md5 );
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDBManagerCreateTable ( KDBManager *self,
-    KTable **tbl, KCreateMode cmode, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDBManagerVCreateTable ( self, tbl, cmode, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDBManagerVCreateTable ( KDBManager *self,
-    KTable **tbl, KCreateMode cmode, const char *path, va_list args )
-{
-    if ( tbl == NULL )
-        return RC ( rcDB, rcMgr, rcCreating, rcParam, rcNull );
-
-    * tbl = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcMgr, rcCreating, rcSelf, rcNull );
-
-    return KDBManagerVCreateTableInt ( self, tbl, self -> wd, cmode, path, args );
-}
-
-LIB_EXPORT rc_t CC KDatabaseCreateTable ( KDatabase *self,
-    KTable **tbl, KCreateMode cmode, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = KDatabaseVCreateTable ( self, tbl, cmode, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDatabaseVCreateTable ( KDatabase *self,
-    KTable **tblp, KCreateMode cmode, const char *name, va_list args )
-{
-    rc_t rc;
-    char path [ 256 ];
-
-    if ( tblp == NULL )
-        return RC ( rcDB, rcDatabase, rcCreating, rcParam, rcNull );
-
-    * tblp = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcDatabase, rcCreating, rcSelf, rcNull );
-
-    if ( self -> read_only )
-        return RC ( rcDB, rcDatabase, rcCreating, rcDatabase, rcReadonly );
-
-    rc = KDBVMakeSubPath ( self -> dir,
-        path, sizeof path, "tbl", 3, name, args );
-    if ( rc == 0 )
-    {
-        /* ensure that the "tbl" namespace directory is there */
-        rc = KDirectoryVCreateDir ( self -> dir,
-            0775, kcmOpen, "tbl", NULL );
-        if ( rc == 0 )
-        {
-            rc = KDBManagerVCreateTableInt ( self -> mgr, tblp,
-                self -> dir, cmode, path, NULL );
-            if ( rc == 0 )
-            {
-                KTable *tbl = ( KTable* ) * tblp;
-                tbl -> db = KDatabaseAttach ( self );
-            }
-        }
-    }
-
-    return rc;
-}
-
-
-/* OpenTableRead
- * VOpenTableRead
- *  open a table for read
- *
- *  "tbl" [ OUT ] - return parameter for newly opened table
- *
- *  "path" [ IN ] - NUL terminated string in
- *  wd-native character set giving path to table
- */
-static
-rc_t KDBManagerVOpenTableReadInt ( const KDBManager *cself,
-    const KTable **tblp, const KDirectory *wd, bool try_srapath,
-    const char *path, va_list args )
-{
-    rc_t rc;
-    char tblpath [ 4096 ];
-    size_t z;
-
-/*    rc = KDirectoryVResolvePath ( wd, 1,
-        tblpath, sizeof tblpath, path, args ); */
-    rc = string_vprintf( tblpath, sizeof tblpath, &z, path, args );
-    if ( rc == 0 )
-    {
-        KSymbol *sym;
-        
-        /* if already open */
-        sym = KDBManagerOpenObjectFind (cself, tblpath);
-        if (sym != NULL)
-        {
-            const KTable * ctbl;
-            rc_t obj;
-
-            switch (sym->type)
-            {
-            case kptTable:
-                ctbl = (KTable*)sym->u.obj;
-                /* if open for update, refuse */
-                if ( ctbl -> read_only )
-                {
-                    /* attach a new reference and we're gone */
-                    rc = KTableAddRef ( ctbl );
-                    if ( rc == 0 )
-                        * tblp = ctbl;
-                    return rc;
-                }
-                obj = rcTable;
-                break;
-                
-            default:
-                obj = rcPath;
-                break;
-            case kptDatabase:
-                obj = rcDatabase;
-                break;
-            case kptColumn:
-                obj = rcColumn;
-                break;
-            case kptIndex:
-                obj = rcIndex;
-                break;
-            case kptMetadata:
-                obj = rcMetadata;
-                break;
-            }
-            rc = RC (rcDB, rcMgr, rcOpening, obj, rcBusy);
-        }
-        else
-        {
-            KTable * tbl;
-            const KDirectory *dir;
-            bool prerelease = false;
-
-            rc = KDBOpenPathTypeRead ( cself, wd, tblpath, &dir, kptTable, NULL, try_srapath );
-            if ( rc != 0 )
-            {
-                prerelease = true;
-                rc = KDBOpenPathTypeRead ( cself, wd, tblpath, &dir, kptPrereleaseTbl, NULL, try_srapath );
-            }        
-            if ( rc == 0 )
-            {
-                rc = KTableMake ( & tbl, dir, tblpath, NULL, true );
-                if ( rc == 0 )
-                {
-                    KDBManager * self = (KDBManager *)cself;
-
-                    rc = KDBManagerInsertTable (self, tbl );
-
-                    if (rc == 0)
-                    {
-                        tbl -> prerelease = prerelease;
-                        * tblp = tbl;
-                        return 0;
-                    }
-                    free ( tbl );
-                }
-                KDirectoryRelease ( dir );
-            }
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDBManagerOpenTableRead ( const KDBManager *self,
-    const KTable **tbl, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDBManagerVOpenTableRead ( self, tbl, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDBManagerVOpenTableRead ( const KDBManager *self,
-    const KTable **tbl, const char *path, va_list args )
-{
-    if ( tbl == NULL )
-        return RC ( rcDB, rcMgr, rcOpening, rcParam, rcNull );
-
-    * tbl = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcMgr, rcOpening, rcSelf, rcNull );
-
-    return KDBManagerVOpenTableReadInt ( self, tbl, self -> wd, true, path, args );
-}
-
-LIB_EXPORT rc_t CC KDatabaseOpenTableRead ( const KDatabase *self,
-    const KTable **tbl, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = KDatabaseVOpenTableRead ( self, tbl, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDatabaseVOpenTableRead ( const KDatabase *self,
-    const KTable **tblp, const char *name, va_list args )
-{
-    rc_t rc;
-    char path [ 256 ];
-
-    if ( tblp == NULL )
-        return RC ( rcDB, rcDatabase, rcOpening, rcParam, rcNull );
-
-    * tblp = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcDatabase, rcOpening, rcSelf, rcNull );
-
-    rc = KDBVMakeSubPath ( self -> dir,
-        path, sizeof path, "tbl", 3, name, args );
-    if ( rc == 0 )
-    {
-        rc = KDBManagerVOpenTableReadInt ( self -> mgr, tblp,
-                                           self -> dir, false, path, NULL );
-        if ( rc == 0 )
-        {
-            KTable *tbl = ( KTable* ) * tblp;
-            tbl -> db = KDatabaseAttach ( self );
-        }
-    }
-
-    return rc;
-}
-
-
-/* OpenTableUpdate
- * VOpenTableUpdate
- *  open a table for read/write
- *
- *  "tbl" [ OUT ] - return parameter for newly opened table
- *
- *  "name" [ IN ] - NUL terminated string in UTF-8 giving name of table
- */
-static
-rc_t KDBManagerVOpenTableUpdateInt ( KDBManager *self,
-    KTable **tbl, KDirectory *wd, const char *path, va_list args )
-{
-    char tblpath [ 4096 ];
-    rc_t rc = KDirectoryVResolvePath ( wd, true,
-        tblpath, sizeof tblpath, path, args );
-    if ( rc == 0 )
-    {
-        KSymbol * sym;
-        KFile *f;
-        KMD5SumFmt * md5 = NULL;
-        bool convert = false;
-
-        /* if already open, refuse */
-        sym = KDBManagerOpenObjectFind (self, tblpath);
-        if (sym != NULL)
-        {
-            rc_t obj;
-            switch (sym->type)
-            {
-            default:
-                obj = rcPath;
-                break;
-            case kptDatabase:
-                obj = rcDatabase;
-                break;
-            case kptTable:
-                obj = rcTable;
-                break;
-            case kptColumn:
-                obj = rcColumn;
-                break;
-            case kptIndex:
-                obj = rcIndex;
-                break;
-            case kptMetadata:
-                obj = rcMetadata;
-                break;
-            }
-            return RC ( rcDB, rcMgr, rcOpening, obj, rcBusy );
-        }
-        /* only open existing tbls */
-        switch ( KDBPathType ( /*NULL,*/ wd, NULL, tblpath ) )
-        {
-        case kptNotFound:
-            return RC ( rcDB, rcMgr, rcOpening, rcTable, rcNotFound );
-
-        case kptBadPath:
-            return RC ( rcDB, rcMgr, rcOpening, rcPath, rcInvalid );
-
-        case kptFile:
-        case kptFile | kptAlias:
-            /* if we find a file, vary the failure if it is an archive that is a table
-             * or a non related file */
-            if (( KDBOpenPathTypeRead ( self, wd, tblpath, NULL, kptTable, NULL, false ) == 0 ) ||
-                ( KDBOpenPathTypeRead ( self, wd, tblpath, NULL, kptPrereleaseTbl, NULL, false ) == 0 ) )
-                return RC ( rcDB, rcMgr, rcCreating, rcTable, rcUnauthorized );
-            /* fall through */
-        default:
-            return RC ( rcDB, rcMgr, rcOpening, rcPath, rcIncorrect );
-        case kptTable:
-        case kptTable | kptAlias:
-            break;
-
-        case kptPrereleaseTbl:
-        case kptPrereleaseTbl | kptAlias:
-            convert = true;
-            break;
-        }
-
-        /* test now for locked directory */
-        rc = KDBWritable ( wd, tblpath );
-        switch (GetRCState(rc))
-        {
-        default:
-            return RC ( rcDB, rcMgr, rcOpening, rcTable, rcNoPerm );
-
-        case rcLocked:
-            return RC ( rcDB, rcMgr, rcOpening, rcTable, rcLocked );
-
-        case rcReadonly:
-            return RC ( rcDB, rcMgr, rcOpening, rcTable, rcReadonly );
-
-        case 0:
-            rc = 0;
-            break;
-        }
-
-        rc = KDirectoryOpenFileWrite ( wd, &f, true, "%s/md5", tblpath );
-        if ( rc == 0 )
-        {
-            rc = KMD5SumFmtMakeUpdate ( & md5, f );
-            if ( rc != 0 )
-                KFileRelease ( f );
-        }
-        else if ( GetRCState ( rc ) == rcNotFound )
-            rc = 0;
-#if 0
-        else if ( GetRCState ( rc ) == rcUnauthorized )
-            return RC ( rcDB, rcMgr, rcCreating, rcTable, rUnauthorized );
-#endif
-
-        if ( rc == 0 )
-            rc = KDBManagerMakeTableUpdate ( self, tbl, wd, tblpath, convert, md5 );
-
-        KMD5SumFmtRelease ( md5 );
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDBManagerOpenTableUpdate ( KDBManager *self,
-    KTable **tbl, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDBManagerVOpenTableUpdate ( self, tbl, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDBManagerVOpenTableUpdate ( KDBManager *self,
-    KTable **tbl, const char *path, va_list args )
-{
-    if ( tbl == NULL )
-        return RC ( rcDB, rcMgr, rcOpening, rcParam, rcNull );
-
-    * tbl = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcMgr, rcOpening, rcSelf, rcNull );
-
-    return KDBManagerVOpenTableUpdateInt ( self, tbl, self -> wd, path, args );
-}
-
-LIB_EXPORT rc_t CC KDatabaseOpenTableUpdate ( KDatabase *self,
-    KTable **tbl, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = KDatabaseVOpenTableUpdate ( self, tbl, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDatabaseVOpenTableUpdate ( KDatabase *self,
-    KTable **tblp, const char *name, va_list args )
-{
-    rc_t rc;
-    char path [ 256 ];
-
-    if ( tblp == NULL )
-        return RC ( rcDB, rcDatabase, rcOpening, rcParam, rcNull );
-
-    * tblp = NULL;
-
-    if ( self == NULL )
-        return RC ( rcDB, rcDatabase, rcOpening, rcSelf, rcNull );
-
-    if ( self -> read_only )
-        return RC ( rcDB, rcDatabase, rcOpening, rcDatabase, rcReadonly );
-
-    rc = KDBVMakeSubPath ( self -> dir,
-        path, sizeof path, "tbl", 3, name, args );
-    if ( rc == 0 )
-    {
-        rc = KDBManagerVOpenTableUpdateInt ( self -> mgr, tblp,
-            self -> dir, path, NULL );
-        if ( rc == 0 )
-        {
-            KTable *tbl = ( KTable* ) * tblp;
-            tbl -> db = KDatabaseAttach ( self );
-        }
-    }
-
-    return rc;
-}
-
-
-/* Locked
- *  returns non-zero if locked
- */
-LIB_EXPORT bool CC KTableLocked ( const KTable *self )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        return false;
-
-    rc = KDBWritable ( self -> dir, "." );
-    return GetRCState ( rc ) == rcLocked;
-}
-
-
-/* Exists
- *  returns true if requested object exists
- *
- *  "type" [ IN ] - a KDBPathType
- *
- *  "path" [ IN ] - NUL terminated path
- */
-LIB_EXPORT bool CC KTableVExists ( const KTable *self, uint32_t type, const char *name, va_list args )
-{
-    if ( self != NULL && name != NULL && name [ 0 ] != 0 )
-    {
-        rc_t rc;
-        const char *ns;
-        char path [ 256 ];
-
-        switch ( type )
-        {
-        case kptIndex:
-            ns = "idx";
-            break;
-
-        case kptColumn:
-            ns = "col";
-            break;
-
-        default:
-            return false;
-        }
-
-        rc = KDBVMakeSubPath ( self -> dir, path, sizeof path, ns, 3, name, args );
-        if ( rc == 0 )
-        {
-            switch ( KDirectoryPathType ( self -> dir, path ) )
-            {
-            case kptFile:
-            case kptDir:
-            case kptFile | kptAlias:
-            case kptDir | kptAlias:
-                return true;
-            }
-        }
-    }
-    return false;
-}
-
-LIB_EXPORT bool CC KTableExists ( const KTable *self, uint32_t type, const char *name, ... )
-{
-    bool exists;
-
-    va_list args;
-    va_start ( args, name );
-
-    exists = KTableVExists ( self, type, name, args );
-
-    va_end ( args );
-
-    return exists;
-}
-
-
-/* IsAlias
- *  returns true if object name is an alias
- *  returns path to fundamental name if it was aliased
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptIndex and kptColumn
- *
- *  "resolved" [ OUT ] and "rsize" [ IN ] - optional output buffer
- *  for fundamenta object name if "alias" is not a fundamental name, 
- *
- *  "name" [ IN ] - NUL terminated object name
- */
-LIB_EXPORT bool CC KTableIsAlias ( const KTable *self, uint32_t type,
-    char *resolved, size_t rsize, const char *name )
-{
-    if ( self != NULL && name != NULL && name [ 0 ] != 0 )
-    {
-        rc_t rc;
-        const char *ns;
-        char path [ 256 ];
-
-        switch ( type )
-        {
-        case kptIndex:
-            ns = "idx";
-            break;
-
-        case kptColumn:
-            ns = "col";
-            break;
-
-        default:
-            return false;
-        }
-
-        rc = KDBMakeSubPath ( self -> dir, path, sizeof path, ns, 3, name );
-        if ( rc == 0 )
-        {
-            switch ( KDirectoryPathType ( self -> dir, path ) )
-            {
-            case kptFile | kptAlias:
-            case kptDir | kptAlias:
-                if ( resolved != NULL && rsize != 0 )
-                {
-                    const KDirectory *sub;
-                    rc = KDirectoryOpenDirRead ( self -> dir, & sub, false, ns );
-                    * resolved = 0;
-                    if ( rc != 0 )
-                        PLOGERR ( klogWarn, ( klogWarn, rc, "failed to open subdirectory '$(sub)'", "sub=%s", ns ) );
-                    else
-                    {
-                        rc = KDirectoryResolveAlias ( sub, false, resolved, rsize, name );
-                        KDirectoryRelease ( sub );
-                        if ( rc != 0 )
-                            PLOGERR ( klogWarn, ( klogWarn, rc, "failed to resolve alias '$(alias)'", "alias=%s", name ) );
-                    }
-                }
-                return true;
-            }
-        }
-    }
-
-    if ( resolved != NULL && rsize != 0 )
-        * resolved = 0;
-
-    return false;
-}
-
-
-/* Writable
- *  returns 0 if object is writable
- *  or a reason why if not
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptIndex and kptColumn
- *
- *  "path" [ IN ] - NUL terminated path
- */
-static
-rc_t KTableLockInt (const KTable  * self, char * path, size_t path_size,
-                        int type, const char * name, va_list args )
-{
-    rc_t rc;
-
-    if (self == NULL)
-        rc = RC ( rcDB, rcMgr, rcAccessing, rcSelf, rcNull );
-
-    else if (name == NULL)
-        rc =  RC (rcDB, rcMgr, rcAccessing, rcPath, rcNull);
-
-    else
-    {
-        const char * ns;
-
-        ns = KDBGetNamespaceString (type);
-
-        switch (type)
-        {
-        default:
-            rc = RC (rcDB, rcMgr, rcAccessing, rcParam, rcInvalid);
-            break;
-        case kptColumn:
-        case kptIndex:
-            rc = KDBVMakeSubPath (self->dir, path, path_size, ns, strlen (ns),
-                                  name, args);
-            break;
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KTableVWritable (const KTable *self, uint32_t type, const char * name, va_list args )
-{
-    rc_t rc;
-    char path [ 256 ];
-
-    rc = KTableLockInt (self, path, sizeof path, type, name, args);
-    if (rc == 0)
-        rc = KDBWritable (self->dir, path);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KTableWritable ( const KTable *self, uint32_t type, const char * name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = KTableVWritable ( self, type, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* Lock
- *  apply lock
- *
- *  if object is already locked, the operation is idempotent
- *  and returns an rc state of rcLocked
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptIndex and kptColumn
- *
- *  "path" [ IN ] - NUL terminated path
- */
-LIB_EXPORT rc_t CC KTableVLock ( KTable *self, uint32_t type, const char * name, va_list args )
-{
-    rc_t rc = 0;
-    char path [ 256 ];
-
-    rc = KTableLockInt (self, path, sizeof path, type, name, args);
-    if (rc == 0)
-        rc = KDBLockDir (self->dir, path);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KTableLock ( KTable *self, uint32_t type, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = KTableVLock (self, type, name, args);
-    va_end (args);
-    return rc;
-}
-
-
-/* Unlock
- *  remove lock
- *
- *  if object is already unlocked, the operation is idempotent
- *  and returns an rc state of rcUnlocked
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptIndex and kptColumn
- *
- *  "path" [ IN ] - NUL terminated path
- */
-LIB_EXPORT rc_t CC KTableVUnlock ( KTable *self, uint32_t type, const char * name, va_list args )
-{
-    rc_t rc = 0;
-    char path [ 256 ];
-
-    rc = KTableLockInt (self, path, sizeof path, type, name, args);
-    if (rc == 0)
-        rc = KDBUnlockDir (self->dir, path);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KTableUnlock ( KTable *self, uint32_t type, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-    va_start ( args, name );
-    rc = KTableVUnlock ( self, type, name, args );
-    va_end ( args );
-    return rc;
-}
-
-
-/* Rename
- */
-LIB_EXPORT rc_t CC KTableRenameColumn ( KTable *self, bool force, const char *from, const char *to )
-{
-    return KDBRename ( self -> dir, self -> mgr, kptColumn, force, from, to );
-}
-
-LIB_EXPORT rc_t CC KTableRenameIndex ( KTable *self, bool force, const char *from, const char *to )
-{
-    return KDBRename ( self -> dir, self -> mgr, kptIndex, force, from, to );
-}
-
-/* Alias
- */
-LIB_EXPORT rc_t CC KTableAliasColumn ( KTable *self, const char *col, const char *alias )
-{
-    return KDBAlias ( self -> dir, kptColumn, col, alias );
-}
-
-LIB_EXPORT rc_t CC KTableAliasIndex ( KTable *self, const char *idx, const char *alias )
-{
-    return KDBAlias ( self -> dir, kptIndex, idx, alias );
-}
-
-/* Drop
- */
-LIB_EXPORT rc_t CC KTableDropColumn ( KTable *self, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KTableVDropColumn ( self, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KTableVDropColumn ( KTable *self, const char *name, va_list args )
-{
-    return KDBVDrop ( self -> dir, self -> mgr, kptColumn, name, args );
-}
-
-LIB_EXPORT rc_t CC KTableDropIndex ( KTable *self, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = KTableVDropIndex ( self, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KTableVDropIndex ( KTable *self, const char *name, va_list args )
-{
-    return KDBVDrop ( self -> dir, self -> mgr, kptIndex, name, args );
-}
-
-
-/* Reindex
- *  optimize column indices
- */
-LIB_EXPORT rc_t CC KTableReindex ( KTable *self )
-{
-    if ( self != NULL )
-    {
-        KNamelist *names;
-        rc_t rc = KTableListCol ( self, & names );
-        if ( rc == 0 )
-        {
-            uint32_t count;
-            rc = KNamelistCount ( names, & count );
-            if ( rc == 0 )
-            {
-                uint32_t i;
-                for ( i = 0; i < count; ++ i )
-                {
-                    KColumn *col;
-
-                    const char *name;
-                    rc = KNamelistGet ( names, i, & name );
-                    if ( rc != 0 )
-                        break;
-
-                    /* check it the column has idx0 data
-                       TBD - this whole operation goes away when
-                       idx0 is used for cursor sessions */
-                    if ( KTableColumnNeedsReindex ( self, name ) )
-                    {
-                        rc = KTableOpenColumnUpdate ( self, & col, name );
-                        if ( rc != 0 )
-                        {
-                            if ( GetRCState ( rc ) == rcBusy )
-                                continue;
-                            break;
-                        }
-
-                        rc = KColumnReindex ( col );
-                        KColumnRelease ( col );
-                        if ( rc != 0 )
-                            break;
-                    }
-                }
-            }
-
-            KNamelistRelease ( names );
-        }
-        return rc;
-    }
-    return RC ( rcDB, rcTable, rcReindexing, rcSelf, rcNull );
-}
-
-
-/* OpenManager
- *  duplicate reference to manager
- *  NB - returned reference must be released
- */
-LIB_EXPORT rc_t CC KTableOpenManagerRead ( const KTable *self, const KDBManager **mgr )
-{
-    rc_t rc;
-
-    if ( mgr == NULL )
-        rc = RC ( rcDB, rcTable, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcTable, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = KDBManagerAddRef ( self -> mgr );
-            if ( rc == 0 )
-            {
-                * mgr = self -> mgr;
-                return 0;
-            }
-        }
-
-        * mgr = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KTableOpenManagerUpdate ( KTable *self, KDBManager **mgr )
-{
-    rc_t rc;
-
-    if ( mgr == NULL )
-        rc = RC ( rcDB, rcTable, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcTable, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = KDBManagerAddRef ( self -> mgr );
-            if ( rc == 0 )
-            {
-                * mgr = self -> mgr;
-                return 0;
-            }
-        }
-
-        * mgr = NULL;
-    }
-
-    return rc;
-}
-
-
-/* OpenParent
- *  duplicate reference to parent database
- *  NB - returned reference must be released
- */
-LIB_EXPORT rc_t CC KTableOpenParentRead ( const KTable *self, const KDatabase **db )
-{
-    rc_t rc;
-
-    if ( db == NULL )
-        rc = RC ( rcDB, rcTable, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcTable, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = KDatabaseAddRef ( self -> db );
-            if ( rc == 0 )
-            {
-                * db = self -> db;
-                return 0;
-            }
-        }
-
-        * db = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KTableOpenParentUpdate ( KTable *self, KDatabase **db )
-{
-    rc_t rc;
-
-    if ( db == NULL )
-        rc = RC ( rcDB, rcTable, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcTable, rcAccessing, rcSelf, rcNull );
-        else if ( self -> db != NULL && self -> db -> read_only )
-            rc = RC ( rcVDB, rcTable, rcAccessing, rcDatabase, rcReadonly );
-        else
-        {
-            rc = KDatabaseAddRef ( self -> db );
-            if ( rc == 0 )
-            {
-                * db = self -> db;
-                return 0;
-            }
-        }
-
-        * db = NULL;
-    }
-
-    return rc;
-}
-
-
-/* OpenDirectory
- *  access the directory in use
- */
-LIB_EXPORT rc_t CC KTableOpenDirectoryRead ( const KTable *self, const KDirectory **dir )
-{
-    rc_t rc;
-
-    if ( dir == NULL )
-        rc = RC ( rcDB, rcTable, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcTable, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            * dir = self -> dir;
-            return KDirectoryAddRef ( * dir );
-        }
-
-        * dir = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KTableOpenDirectoryUpdate ( KTable *self, KDirectory **dir )
-{
-    rc_t rc;
-
-    if ( dir == NULL )
-        rc = RC ( rcDB, rcTable, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcDB, rcTable, rcAccessing, rcSelf, rcNull );
-         else if ( self -> dir != NULL && self -> dir -> read_only )
-             rc = RC ( rcDB, rcTable, rcAccessing, rcDirectory, rcReadonly );
-        else
-        {
-            * dir = self -> dir;
-            return KDirectoryAddRef ( * dir );
-        }
-
-        * dir = NULL;
-    }
-
-    return rc;
-}
-
-
-/* ModDate
- *  get modification date
- */
-LIB_EXPORT rc_t CC KTableModDate ( const KTable *self, KTime_t *mtime )
-{
-    rc_t rc;
-
-    if ( mtime == NULL )
-        rc = RC ( rcDB, rcTable, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self != NULL )
-            return KDBGetObjModDate ( self -> dir, mtime );
-
-        rc = RC ( rcDB, rcTable, rcAccessing, rcSelf, rcNull );
-        * mtime = 0;
-    }
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * KNamelist
- */
-
-/* List
- *  create table listings
- */
-struct FilterData
-{
-    const KDBManager * mgr;
-    int type;
-};
-
-static
-bool CC KDatabaseListFilter ( const KDirectory *dir, const char *name, void *data_ )
-{
-    struct FilterData * data = data_;
-
-    return KDBOpenPathTypeRead(data->mgr, dir, name, NULL, data->type, NULL, false) == 0;
-}
-
-LIB_EXPORT rc_t CC KTableListCol ( const KTable *self, KNamelist **names )
-{
-    if ( self != NULL )
-    {
-        struct FilterData data;
-        data.mgr = self->mgr;
-        data.type = kptColumn;
-
-        return KDirectoryVList ( self -> dir,
-            names, KDatabaseListFilter, &data, "col", NULL );
-    }
-    
-    if ( names != NULL )
-        * names = NULL;
-    
-    return RC ( rcDB, rcTable, rcListing, rcSelf, rcNull );
-}
-
-static
-bool CC KTableListIdxFilter ( const KDirectory *dir, const char *name, void *data )
-{
-    const size_t sz = strlen(name);
-    
-    if (sz > 4 && strcmp(&name[sz - 4], ".md5") == 0)
-        return false;
-    return true;
-}
-
-static
-bool CC KTableListSkeyFilter ( const KDirectory *dir, const char *name, void *data )
-{
-    if ( strcmp ( name, "skey" ) == 0 )
-        return true;
-    return false;
-}
-
-LIB_EXPORT rc_t CC KTableListIdx ( const KTable *self, KNamelist **names )
-{
-    if ( self != NULL )
-    {
-        if ( ! self -> prerelease )
-        {
-            return KDirectoryVList ( self -> dir,
-                                    names, KTableListIdxFilter, NULL, "idx", NULL );
-        }
-        
-        return KDirectoryVList ( self -> dir,
-                                names, KTableListSkeyFilter, NULL, ".", NULL );
-    }
-    
-    if ( names != NULL )
-        * names = NULL;
-    
-    return RC ( rcDB, rcTable, rcListing, rcSelf, rcNull );
-}
diff --git a/libs/kdb/wtrieidx-v1.c b/libs/kdb/wtrieidx-v1.c
deleted file mode 100644
index b5073c3..0000000
--- a/libs/kdb/wtrieidx-v1.c
+++ /dev/null
@@ -1,1100 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kdb/extern.h>
-#include "windex-priv.h"
-#include "kdbfmt-priv.h"
-#include <klib/ptrie.h>
-#include <klib/text.h>
-#include <kfs/directory.h>
-#include <kfs/file.h>
-#include <kfs/md5.h>
-#include <kfs/mmap.h>
-#include <klib/rc.h>
-#include <os-native.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <limits.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <byteswap.h>
-#include <assert.h>
-
-#define DISABLE_PROJ 0
-#define LIMIT_INSERTS 0
-
-#if LIMIT_INSERTS
-#define INSERT_LIMIT 100000000
-#endif
-
-/*--------------------------------------------------------------------------
- * KPTrieIndex_v1
- *  persisted keymap
- */
-
-/* KPTrieIndexInit
- *  opens and initializes persisted keymap structure
- */
-rc_t KPTrieIndexInit_v1 ( KPTrieIndex_v1 *self, const KMMap *mm, bool byteswap )
-{
-    size_t size;
-    rc_t rc = KMMapSize ( mm, & size );
-    if ( rc == 0 )
-    {
-        const KDBHdr *hdr;
-        rc = KMMapAddrRead ( mm, ( const void** ) & hdr );
-        if ( rc == 0 )
-        {
-            /* try to create the pttree */
-            rc = PTrieMakeOrig ( & self -> key2id,
-                hdr + 1, size -= sizeof * hdr, byteswap );
-            if ( rc == 0 )
-            {
-                size_t ptsize = PTrieSize ( self -> key2id );
-                if ( ptsize <= size )
-                {
-                    /* just in case */
-                    self -> mm = NULL;
-
-                    /* record for projection */
-                    self -> byteswap = byteswap;
-
-                    /* it could be stored without projection */
-                    if ( ptsize == size )
-                    {
-                        self -> id2node = NULL;
-                        self -> first = self -> last = 0;
-                        return 0;
-                    }
-                            
-                    /* assume this is projection index */
-                    self -> id2node = ( void* )
-                        ( ( char* ) ( hdr + 1 ) + ptsize );
-                    size -= ptsize;
-                            
-                    /* it must have at least 4 bytes
-                       and be 4 byte aligned */
-                    if ( size >= sizeof ( uint32_t ) && ( size & 3 ) == 0 )
-                    {
-                        /* first entry is starting key
-                           remaining entries are node ids */
-                        self -> first = * self -> id2node ++;
-                        size -= sizeof self -> id2node [ 0 ];
-                        if ( size == 0 )
-                        {
-                            /* forget if empty */
-                            self -> id2node = NULL;
-                            self -> first = self -> last = 0;
-                            return 0;
-                        }
-                        /* remaining entries */
-                        self -> last = self -> first + ( size >> 2 ) - 1;
-                        return 0;
-                    }
-                }
-
-                PTrieWhack ( self -> key2id );
-                self -> key2id = NULL;
-
-                rc = RC ( rcDB, rcIndex, rcConstructing, rcTrie, rcCorrupt );
-            }
-        }
-    }
-
-    return rc;
-}
-
-/* KPTrieIndexWhack_v1
- *  closes down keymap
- */
-void KPTrieIndexWhack_v1 ( KPTrieIndex_v1 *self )
-{
-    PTrieWhack ( self -> key2id );
-    KMMapRelease ( self -> mm );
-    memset ( self, 0, sizeof * self );
-}
-
-
-/*--------------------------------------------------------------------------
- * KTrieIdxNode_v1
- */
-
-static
-void CC KTrieIdxNodeWhack_v1 ( TNode *n, void *data )
-{
-    TNodeWhack ( n );
-}
-
-static
-void CC KTrieIdxNodeUnlink_v1 ( TNode *n, void *data )
-{
-    if ( TrieUnlink ( data, n ) )
-        TNodeWhack ( n );
-}
-
-static
-void CC KTrieIdxNodeCaptureID_v1 ( TNode *n, void *data )
-{
-    KTrieIndex_v1 *self = data;
-    KTrieIdxNode_v1 *node = ( KTrieIdxNode_v1* ) n;
-    self -> id2node [ node -> id - self -> first ] = node;
-}
-
-
-/*--------------------------------------------------------------------------
- * KTrieIndex_v1
- */
-
-/* KTrieIndexWrite_v1
- */
-typedef struct PersistTrieData PersistTrieData;
-struct PersistTrieData
-{
-    uint64_t pos;
-    KFile *f;
-    uint8_t *buffer;
-    size_t bsize;
-    size_t marker;
-
-    size_t ptt_size;
-    uint32_t first;
-    uint32_t last;
-    rc_t rc;
-};
-
-static
-rc_t CC KTrieIndexWrite_v1 ( void *param,
-    const void *buffer, size_t size, size_t *num_writ )
-{
-    PersistTrieData *pb = param;
-    size_t total, to_write;
-
-    for ( total = 0; total < size; total += to_write )
-    {
-        to_write = size - total;
-        if ( pb -> marker + to_write > pb -> bsize )
-            to_write = pb -> bsize - pb -> marker;
-
-        if ( to_write > 0 )
-        {
-            memcpy ( pb -> buffer + pb -> marker,
-                ( const uint8_t* ) buffer + total, to_write );
-            pb -> marker += to_write;
-        }
-
-        if ( pb -> marker == pb -> bsize )
-        {
-            size_t num_flushed;
-            pb -> rc = KFileWrite ( pb -> f, pb -> pos,
-                pb -> buffer, pb -> bsize, & num_flushed );
-            if ( pb -> rc != 0 )
-            {
-                * num_writ = 0;
-                return pb -> rc;
-            }
-
-            if ( num_flushed == 0 )
-            {
-                * num_writ = total + to_write;
-                return pb -> rc = RC ( rcDB, rcIndex, rcPersisting, rcTransfer, rcIncomplete );
-            }
-
-            pb -> marker -= num_flushed;
-            pb -> pos += num_flushed;
-
-            if ( pb -> marker != 0 )
-                memcpy ( pb -> buffer, pb -> buffer + num_flushed, pb -> marker );
-        }
-    }
-
-    * num_writ = total;
-    return 0;
-}
-
-/* KTrieIndexAux_v1
- */
-static
-rc_t CC KTrieIndexAux_v1 ( void *param, const void *node, size_t *num_writ,
-    PTWriteFunc write, void *write_param )
-{
-    const KTrieIdxNode_v1 *n = node;
-
-    if ( write != NULL )
-    {
-        PersistTrieData *pb = param;
-        if ( n -> id < pb -> first )
-            pb -> first = n -> id;
-        if ( n -> id > pb -> last )
-            pb -> last = n -> id;
-
-        return ( * write ) ( write_param, & n -> id, sizeof n -> id, num_writ );
-    }
-
-    * num_writ = sizeof n -> id;
-    return 0;
-}
-
-/* KTrieIndexPersist_v1
- *  write keymap to indicated location
- */
-static
-rc_t KTrieIndexPersistTrie_v1 ( const KTrieIndex_v1 *self, PersistTrieData *pb )
-{
-    rc_t rc;
-    KDBHdr *hdr;
-
-    pb -> pos = 0;
-
-    hdr = ( KDBHdr* ) pb -> buffer;
-    KDBHdrInit ( hdr, 1 );
-    pb -> marker = sizeof * hdr;
-
-    /* persist the trie to file,
-       using tree-internal key storage,
-       capture the image size in pb */
-    rc = TriePersist ( & self -> key2id, & pb -> ptt_size,
-        false, KTrieIndexWrite_v1, pb, KTrieIndexAux_v1, pb );
-    if ( rc == 0 && pb -> marker != 0 )
-    {
-        size_t num_writ;
-        rc = KFileWrite ( pb -> f, pb -> pos,
-            pb -> buffer, pb -> marker, & num_writ );
-        if ( rc == 0 && num_writ != pb -> marker )
-            rc = RC ( rcDB, rcIndex, rcPersisting, rcTransfer, rcIncomplete );
-    }
-
-    return rc;
-}
-
-
-typedef struct PersistReverseData PersistReverseData;
-struct PersistReverseData
-{
-    PTrie *tt;
-    uint32_t *a;
-    uint32_t first;
-    uint32_t count;
-    uint32_t notfound;
-};
-
-static
-void CC KTrieIndexRecordNodeId_v1 ( TNode *node, void *data )
-{
-    PTNode pn;
-    PersistReverseData *pb = data;
-    const KTrieIdxNode_v1 *n = ( const KTrieIdxNode_v1* ) node;
-
-    /* lookup up the persisted node within image */
-    uint32_t id = PTrieFind ( pb -> tt, & n -> n . key, & pn, NULL, NULL );
-
-    /* write it into array */
-    pb -> a [ n -> id - pb -> first ] = ( uint32_t ) id;
-
-    if ( id == 0 )
-        ++ pb -> notfound;
-    else
-        ++ pb -> count;
-}
-
-static
-rc_t KTrieIndexPersistProj_v1 ( const KTrieIndex_v1 *self, PersistTrieData *pb )
-{
-#if 0
-    rc_t rc;
-    KMMap *mmr;
-    size_t map_size;
-
-    /* there must be something to do */
-    if ( pb -> first > pb -> last )
-        return 0;
-
-
-    /* open a read-write map onto file
-       start at offset 0, which is the header,
-       followed by pb -> ptt_size bytes which is the tree,
-       and add on a slot for first id,
-       followed by last - first + 1 slots for id to node id map */
-    map_size = pb -> ptt_size + ( ( pb -> last - pb -> first + 2 ) << 2 );
-
-    rc = KMMapMakeRgnUpdate ( & mmr, pb -> f, sizeof ( KDBHdr ), map_size );
-    if ( rc == 0 )
-    {
-        void *addr;
-        PersistReverseData pb2;
-
-        rc = KMMapAddrUpdate ( mmr, & addr );
-        if ( rc == 0 )
-        {
-            rc = PTrieMakeOrig ( & pb2 . tt, addr, pb -> ptt_size );
-            if ( rc == 0 )
-            {
-                assert ( pb -> ptt_size == PTrieSize ( pb2 . tt ) );
-                pb2 . a = ( void* ) ( ( char* ) addr + pb -> ptt_size );
-                assert ( ( ( size_t ) pb2 . a & 3 ) == 0 );
-
-                /* record first id */
-                * pb2 . a ++ = pb -> first;
-                pb2 . first = pb -> first;
-                pb2 . count = pb2 . notfound = 0;
-
-                /* record all id to node mappings */
-                TrieForEach ( & self -> key2id, KTrieIndexRecordNodeId_v1, & pb2 );
-
-                /* check for having written ids */
-                assert ( pb2 . count == PTrieCount ( pb2 . tt ) );
-
-                /* done with pttree */
-                PTrieWhack ( pb2 . tt );
-
-                /* if there were nodes not found,
-                   the initial persist was bad */
-                if ( pb2 . notfound != 0 )
-                    rc = RC ( rcDB, rcIndex, rcPersisting, rcTransfer, rcIncomplete );
-            }
-        }
-
-        /* done with map - commits changes to disk */
-        KMMapRelease ( mmr );
-
-        /* truncate file to desired size */
-        KFileSetSize ( pb -> f, map_size + sizeof ( KDBHdr ) );
-    }
-
-    return rc;
-#else
-    rc_t rc;
-    void * addr;
-    uint64_t file_size;
-    size_t num_to_read;
-    size_t map_size;
-
-    /* there must be something to do */
-    if ( pb -> first > pb -> last )
-        return 0;
-
-    /* open a read-write map onto file
-       start at offset 0, which is the header,
-       followed by pb -> ptt_size bytes which is the tree,
-       and add on a slot for first id,
-       followed by last - first + 1 slots for id to node id map */
-    map_size = pb -> ptt_size + ( ( pb -> last - pb -> first + 2 ) << 2 );
-
-    rc = KFileSize ( pb -> f, & file_size );
-    if ( rc == 0 )
-    {
-        addr = malloc ( map_size );
-        if ( addr == NULL )
-            rc = RC ( rcDB, rcIndex, rcPersisting, rcMemory, rcExhausted );
-        else
-        {
-            size_t num_read;
-            num_to_read = file_size - sizeof ( KDBHdr );
-            rc = KFileReadAll ( pb -> f, sizeof ( KDBHdr ),
-                addr, num_to_read, & num_read );
-            if ( rc != 0 )
-                free ( addr );
-            else if ( num_read != num_to_read )
-            {
-                free ( addr );
-                rc = RC ( rcDB, rcIndex, rcPersisting, rcHeader, rcInsufficient );
-            }
-        }
-    }
-
-    if ( rc == 0 )
-    {
-        size_t num_writ;
-        PersistReverseData pb2;
-
-        rc = PTrieMakeOrig ( & pb2 . tt, addr, pb -> ptt_size, false );
-        if ( rc == 0 )
-        {
-            assert ( pb -> ptt_size == PTrieSize ( pb2 . tt ) );
-            pb2 . a = ( void* ) ( ( char* ) addr + pb -> ptt_size );
-            assert ( ( ( size_t ) pb2 . a & 3 ) == 0 );
-
-            /* record first id */
-            * pb2 . a ++ = pb -> first;
-            pb2 . first = pb -> first;
-            pb2 . count = pb2 . notfound = 0;
-
-            /* record all id to node mappings */
-            TrieForEach ( & self -> key2id, KTrieIndexRecordNodeId_v1, & pb2 );
-
-            /* check for having written ids */
-            assert ( pb2 . count == PTrieCount ( pb2 . tt ) );
-
-            /* done with pttree */
-            PTrieWhack ( pb2 . tt );
-
-            /* if there were nodes not found,
-               the initial persist was bad */
-            if ( pb2 . notfound != 0 )
-                rc = RC ( rcDB, rcIndex, rcPersisting, rcTransfer, rcIncomplete );
-            else
-            {
-                rc = KFileWrite ( pb -> f, file_size, ( uint8_t* ) addr + num_to_read,
-                    map_size - num_to_read, & num_writ );
-                if ( rc == 0  && num_writ != map_size - num_to_read )
-                    rc = RC ( rcDB, rcIndex, rcPersisting, rcHeader, rcInsufficient );
-            }
-        }
-
-        /* done with map - commits changes to disk */
-        free ( addr );
-
-        /* truncate file to desired size */
-        KFileSetSize ( pb -> f, map_size + sizeof ( KDBHdr ) );
-    }
-
-    return rc;
-#endif
-}
-
-rc_t KTrieIndexPersist_v1 ( const KTrieIndex_v1 *self,
-    bool proj, KDirectory *dir, const char *path, bool use_md5 )
-{
-    rc_t rc;
-    PersistTrieData pb;
-
-    assert ( self != NULL );
-
-    pb . buffer = malloc ( pb . bsize = 32 * 1024 );
-    if ( pb . buffer == NULL )
-        rc = RC ( rcDB, rcIndex, rcPersisting, rcMemory, rcExhausted );
-    else
-    {
-        char tmpname [ 256 ];
-        char tmpmd5name [ 256 ];
-        char md5path [ 256 ];
-        rc = KDirectoryResolvePath ( dir, false,
-            tmpname, sizeof tmpname, "%s.tmp", path );
-        if ( rc == 0 )
-        {
-            rc = KDirectoryVCreateFile ( dir, & pb . f,
-                true, 0664, kcmInit, tmpname, NULL );
-
-	    if (use_md5 && rc == 0 )
-	    {
-		size_t tmplen = snprintf ( tmpmd5name, sizeof tmpmd5name, "%s.md5", tmpname );
-		KFile * kf;
-		KMD5SumFmt *km;
-		if ( tmplen >= sizeof ( tmpmd5name ) ) /* can't be == or no NUL */
-		{
-		    rc = RC ( rcDB, rcIndex, rcPersisting, rcName, rcExcessive );
-		}
-		else
-		{
-		    tmplen = snprintf ( md5path, sizeof md5path, "%s.md5", path );
-		    
-		    if ( tmplen >= sizeof ( md5path ) ) /* can't be == or no NUL */
-		    {
-			rc = RC ( rcDB, rcIndex, rcPersisting, rcName, rcExcessive );
-		    }
-		    else
-		    {
-			rc = KDirectoryVCreateFile ( dir, &kf, true, 0664, 
-						     kcmInit, tmpmd5name, NULL );
-			if ( rc == 0 )
-			{
-			    rc = KMD5SumFmtMakeUpdate ( &km, kf );
-			    if ( rc == 0 )
-			    {
-				KMD5File * k5f;
-				kf = NULL;
-				rc = KMD5FileMakeWrite ( &k5f, pb . f, km, path );
-				if ( rc == 0 )
-				{
-				    pb . f = KMD5FileToKFile ( k5f );
-				}
-				/* release pass or fail */
-				KMD5SumFmtRelease ( km );
-			    }
-			    else
-				KFileRelease ( kf );
-			}
-			else
-			    KFileRelease ( kf );
-		    }
-		}
-		if ( rc != 0 )
-		    KFileRelease ( pb . f );
-	    }
-
-            if ( rc == 0 )
-            {
-                pb . ptt_size = 0;
-                pb . first = ~ 0;
-                pb . last = 0;
-
-                rc = KTrieIndexPersistTrie_v1 ( self, & pb );
-                if ( rc == 0 )
-                {
-                    if ( proj )
-                        rc = KTrieIndexPersistProj_v1 ( self, & pb );
-                }
-                
-                KFileRelease ( pb . f );
-                pb . f = NULL;
-            }
-        }
-        
-        free ( pb . buffer );
-        pb . buffer = NULL;
-        
-        if ( rc == 0 )
-        {
-            rc = KDirectoryRename ( dir, false, tmpname, path );                        
-            if ( rc == 0 )
-            {
-		if ( use_md5 )
-		    rc = KDirectoryRename ( dir, false, tmpmd5name, md5path );                        
-		if ( rc == 0 )
-		{
-		    /* done */
-		    return 0;
-		}
-            }
-        }
-        
-        /* whack temporary file */
-        KDirectoryVRemove ( dir, false, tmpname, NULL );
-	if ( use_md5 )
-	    KDirectoryVRemove ( dir, false, tmpmd5name, NULL );
-    }
-    
-    return rc;
-}
-
-
-/* whack whack */
-void KTrieIndexWhack_v1 ( KTrieIndex_v1 *self )
-{
-    KPTrieIndexWhack_v1 ( & self -> pt );
-    TrieWhack ( & self -> key2id, KTrieIdxNodeWhack_v1, NULL );
-}
-
-/* initialize an index from file - can be NULL */
-rc_t KTrieIndexOpen_v1 ( KTrieIndex_v1 *self, const KMMap *mm, bool byteswap )
-{
-    rc_t rc;
-
-    memset ( self, 0, sizeof * self );
-    rc = TrieInit ( & self -> key2id, "0-9", 512, true );
-    if ( rc != 0 )
-        return rc;
-
-    self -> first = ~ 0;
-
-    if ( mm == NULL )
-        return 0;
-
-    rc = KPTrieIndexInit_v1 ( & self -> pt, mm, byteswap );
-    if ( rc == 0 )
-    {
-        rc = KMMapAddRef ( mm );
-        if ( rc == 0 )
-        {
-            self -> pt . mm = mm;
-            return 0;
-        }
-    }
-
-    KTrieIndexWhack_v1 ( self );
-    return rc;
-}
-
-/* KTrieIndexPopulate_v1
- */
-typedef struct KTrieIndexPopulateData_v1 KTrieIndexPopulateData_v1;
-struct KTrieIndexPopulateData_v1
-{
-    KTrieIndex_v1 *idx;
-    uint32_t id;
-    rc_t rc;
-};
-
-static
-bool CC KTrieIndexPopulate_v1 ( PTNode *n, void *data )
-{
-    const String *key;
-    KTrieIndexPopulateData_v1 *pb = data;
-
-    /* capture node id */
-    uint32_t id;
-    assert ( n -> data . size == sizeof id );
-    memcpy ( & id, n -> data . addr, sizeof id );
-
-    /* reject already mapped */
-    if ( id == pb -> id )
-    {
-        pb -> rc = RC ( rcDB, rcIndex, rcConstructing, rcNode, rcExists );
-        return true;
-    }
-
-    pb -> rc = PTNodeMakeKey ( n, & key );
-    if ( pb -> rc == 0 )
-    {
-        KTrieIdxNode_v1 *node;
-        pb -> rc = TNodeMake ( ( TNode** ) & node,
-            sizeof * node + key -> size );
-        if ( pb -> rc == 0 )
-        {
-            KTrieIndex_v1 *self = pb -> idx;
-
-            StringInit ( & node -> n . key, node -> key, key -> size, key -> len );
-            node -> id = id;
-            string_copy ( node -> key, key -> size + 1,
-                key -> addr, key -> size );
-
-            pb -> rc = TrieInsert ( & self -> key2id, & node -> n );
-            if ( pb -> rc == 0 )
-            {
-                free ( ( void* ) key );
-    
-                /* if copying projection index */
-                if ( self -> id2node != NULL )
-                {
-                    if ( self -> pt . id2node != NULL )
-                        self -> id2node [ node -> id - self -> pt . first ] = node;
-                    else
-                    {
-                        if ( node -> id < self -> first )
-                            self -> first = node -> id;
-                        if ( node -> id > self -> last )
-                            self -> last = node -> id;
-                    }
-                }
-                return 0;
-            }
-
-            TNodeWhack ( & node -> n );
-        }
-
-        StringWhack ( ( String* ) key );
-    }
-
-    return true;
-}
-
-/* KTrieIndexAttach_v1
- *  attach a keymap to an existing table
- *
- *  "pkm" [ IN ] - a persisted keymap
- */
-static
-rc_t KTrieIndexAttach_v1 ( KTrieIndex_v1 *self, bool proj, uint32_t id )
-{
-    uint32_t proj_len;
-    KTrieIndexPopulateData_v1 pb;
-
-#if LIMIT_INSERTS
-    proj_len = self -> pt . last - self -> pt . first + 1;
-#endif
-
-    /* see if we can use existing projection index */
-    if ( proj && self -> pt . id2node != NULL )
-    {
-        /* reject if already mapped */
-        if ( id != 0 &&
-             id >= self -> pt . first &&
-             id <= self -> pt . last &&
-             self -> pt . id2node [ id - self -> pt . first ] != 0 )
-        {
-            return RC ( rcDB, rcIndex, rcUpdating, rcId, rcExists );
-        }
-
-        /* allocate index array */
-#if LIMIT_INSERTS
-        if ( proj_len > INSERT_LIMIT )
-            return RC ( rcDB, rcIndex, rcUpdating, rcRange, rcExcessive );
-#else
-        proj_len = self -> pt . last - self -> pt . first + 1;
-#endif
-        proj_len = ( proj_len + 4095 ) & - 4096;
-        self -> id2node = calloc ( proj_len, sizeof self -> id2node [ 0 ] );
-        if ( self -> id2node == NULL )
-            return RC ( rcDB, rcIndex, rcUpdating, rcMemory, rcExhausted );
-
-        /* record known dimensions */
-        self -> first = self -> pt . first;
-        self -> last = self -> pt . last;
-        self -> len = proj_len;
-    }
-
-#if LIMIT_INSERTS
-    else if ( proj_len > INSERT_LIMIT )
-        return RC ( rcDB, rcIndex, rcUpdating, rcRange, rcExcessive );
-#endif
-
-    /* inflate persisted trie */
-    pb . idx = self;
-    pb . id = id;
-    pb . rc = 0;
-    PTrieDoUntil ( self -> pt . key2id, KTrieIndexPopulate_v1, & pb );
-
-    /* if successful but needing to add projection index */
-    if ( pb . rc == 0 && proj && self -> id2node == NULL )
-    {
-        proj_len = self -> last - self -> first + 1;
-        proj_len = ( proj_len + 4095 ) & - 4096;
-        self -> id2node = calloc ( proj_len, sizeof self -> id2node [ 0 ] );
-        if ( self -> id2node == NULL )
-            pb . rc = RC ( rcDB, rcIndex, rcUpdating, rcMemory, rcExhausted );
-        else
-        {
-            self -> len = proj_len;
-            TrieForEach ( & self -> key2id, KTrieIdxNodeCaptureID_v1, self );
-        }
-    }
-
-    if ( pb . rc == 0 )
-        KPTrieIndexWhack_v1 ( & self -> pt );
-    else if ( self -> id2node != NULL )
-    {
-        TrieForEach ( & self -> key2id,
-            KTrieIdxNodeUnlink_v1, & self -> key2id );
-        free ( self -> id2node );
-        self -> id2node = NULL;
-        self -> first = ~0;
-        self -> last = 0;
-        self -> len = 0;
-    }
-    return pb . rc;
-}
-
-/* insert string into trie, mapping to 32 bit id */
-static
-rc_t KTrieIndexExpandId2Node_v1 ( KTrieIndex_v1 *self, uint32_t range )
-{
-    KTrieIdxNode_v1 **id2node;
-    range = ( range + 4095 ) & - 4096;
-    id2node = realloc ( self -> id2node, range * sizeof id2node [ 0 ] );
-    if ( id2node == NULL )
-        return RC ( rcDB, rcIndex, rcInserting, rcMemory, rcExhausted );
-
-    self -> id2node = id2node;
-
-#if ZERO_ID2NODE
-    /* why zero this when it is known to be invalid? */
-    memset ( id2node + self -> len, 0,
-        ( range - self -> len ) * sizeof id2node [ 0 ] );
-#endif
-
-    self -> len = range;
-
-    return 0;
-}
-
-rc_t KTrieIndexInsert_v1 ( KTrieIndex_v1 *self,
-    bool proj, const char *str, uint32_t id )
-{
-    rc_t rc;
-
-    String key;
-    KTrieIdxNode_v1 *node;
-
-#if DISABLE_PROJ
-    proj = false;
-#endif
-
-    /* detect first modification */
-    if ( self -> last < self -> first )
-    {
-        /* detect persisted data */
-        if ( self -> pt . key2id != NULL )
-        {
-            rc = KTrieIndexAttach_v1 ( self, proj, id );
-            if ( rc != 0 )
-                return rc;
-        }
-
-        /* create empty projection array */
-        else if ( proj )
-        {
-            self -> id2node = malloc ( 4096 * sizeof self -> id2node [ 0 ] );
-            if ( self -> id2node == NULL )
-                return RC ( rcDB, rcIndex, rcInserting, rcMemory, rcExhausted );
-            self -> first = self -> last = id;
-            self -> len = 4096;
-        }
-    }
-
-    /* reject if already mapped */
-    else if ( self -> id2node != NULL &&
-              id >= self -> first &&
-              id <= self -> last &&
-              self -> id2node [ id - self -> first ] != NULL )
-    {
-        return RC ( rcDB, rcIndex, rcInserting, rcId, rcExists );
-    }
-#if LIMIT_INSERTS && INSERT_LIMIT > 0
-    else if ( ( self -> last - self -> first ) >= ( INSERT_LIMIT - 1 ) )
-    {
-        return RC ( rcDB, rcIndex, rcUpdating, rcRange, rcExcessive );
-    }
-#endif
-
-    StringInitCString ( & key, str );
-    rc = TNodeMake ( ( TNode** ) & node, sizeof * node + key . size );
-    if ( rc != 0 )
-        rc = RC ( rcDB, rcIndex, rcInserting, rcMemory, rcExhausted );
-    else
-    {
-        StringInit ( & node -> n . key, node -> key, key . size, key . len );
-        node -> id = id;
-        strcpy ( node -> key, str );
-
-        rc = TrieInsertUnique ( & self -> key2id, & node -> n, NULL );
-        if ( rc != 0 )
-            TNodeWhack ( & node -> n );
-        else if ( proj )
-        {
-            uint32_t range, offset;
-
-            if ( id < self -> first )
-            {
-                range = self -> last - id + 1;
-                if ( range > self -> len )
-                {
-                    rc = KTrieIndexExpandId2Node_v1 ( self, range );
-                    if ( rc != 0 )
-                    {
-                        TrieUnlink ( & self -> key2id, & node -> n );
-                        KTrieIdxNodeWhack_v1 ( & node -> n, NULL );
-                        return rc;
-                    }
-                }
-
-                offset = self -> first - id;
-                memmove ( & self -> id2node [ offset ], self -> id2node,
-                    ( self -> last - self -> first + 1 ) * sizeof self -> id2node [ 0 ] );
-                memset ( & self -> id2node [ 1 ], 0,
-                    ( offset - 1 ) * sizeof self -> id2node [ 0 ] );
-
-                self -> first = id;
-            }
-            else if ( id > self -> last )
-            {
-                range = id - self -> first + 1;
-                if ( range > self -> len )
-                {
-                    rc = KTrieIndexExpandId2Node_v1 ( self, range );
-                    if ( rc != 0 )
-                    {
-                        TrieUnlink ( & self -> key2id, & node -> n );
-                        KTrieIdxNodeWhack_v1 ( & node -> n, NULL );
-                        return rc;
-                    }
-                }
-
-                offset = id - 1 - self -> last;
-                if ( offset > 0 )
-                {
-                    memset ( & self -> id2node [ self -> last - self -> first + 1 ],
-                        0, offset * sizeof self -> id2node [ 0 ] );
-                }
-
-                self -> last = id;
-            }
-
-            assert ( self -> id2node != NULL );
-            self -> id2node [ id - self -> first ] = node;
-        }
-    }
-
-    return rc;
-}
-
-/* drop string from trie and all mappings */
-rc_t KTrieIndexDelete_v1 ( KTrieIndex_v1 *self, bool proj, const char *str )
-{
-    rc_t rc;
-
-    String key;
-    KTrieIdxNode_v1 *node;
-
-#if DISABLE_PROJ
-    proj = 0;
-#endif
-
-    /* detect first modification */
-    if ( self -> last < self -> first )
-    {
-        /* detect persisted data */
-        if ( self -> pt . key2id != NULL )
-        {
-            rc = KTrieIndexAttach_v1 ( self, proj, 0 );
-            if ( rc != 0 )
-                return rc;
-        }
-
-        /* create empty projection array */
-        else if ( proj )
-        {
-            self -> id2node = malloc ( 4096 * sizeof self -> id2node [ 0 ] );
-            if ( self -> id2node == NULL )
-                return RC ( rcDB, rcIndex, rcRemoving, rcMemory, rcExhausted );
-            self -> first = self -> last = 0;
-            self -> len = 4096;
-        }
-    }
-
-    /* interface states that all objects are dropped.
-       however, this implementation only allows unique
-       mappings, so a simple find is sufficient */
-    StringInitCString ( & key, str );
-    node = ( KTrieIdxNode_v1* ) TrieFind ( & self -> key2id, & key );
-    if ( node == NULL )
-        return RC ( rcDB, rcIndex, rcRemoving, rcString, rcNotFound );
-
-    /* drop from projection index */
-    if ( self -> id2node != NULL &&
-         node -> id >= self -> first &&
-         node -> id <= self -> last )
-    {
-        assert ( self -> id2node [ node -> id - self -> first ] == node );
-        if ( node -> id == self -> last )
-        {
-            if ( -- self -> last < self -> first )
-            {
-                free ( self -> id2node );
-                self -> id2node = NULL;
-                self -> len = 0;
-            }
-        }
-        else if ( node -> id == self -> first )
-        {
-            memcpy ( self -> id2node, self -> id2node + 1,
-                ( self -> last - self -> first ) * sizeof self -> id2node [ 0 ] );
-            ++ self -> first;
-        }
-        else
-        {
-            self -> id2node [ node -> id - self -> first ] = NULL;
-        }
-    }
-
-    TrieUnlink ( & self -> key2id, & node -> n );
-    KTrieIdxNodeWhack_v1 ( & node -> n, NULL );
-
-    return 0;
-}
-
-/* map key to id ( was Key2Id ) */
-rc_t KTrieIndexFind_v1 ( const KTrieIndex_v1 *self, const char *str, uint32_t *id,
-    int ( CC * custom_cmp ) ( const void *item, const PBSTNode *n, void *data ), void * data )
-{
-    String key;
-
-    if ( self -> last < self -> first )
-    {
-        if ( self -> pt . key2id != NULL )
-        {
-            PTNode n;
-            uint32_t nid;
-            StringInitCString ( & key, str );
-            nid = PTrieFind ( self -> pt . key2id, & key, & n, custom_cmp ,data);
-            if ( nid != 0 )
-            {
-                assert ( n . data . size == sizeof * id );
-                memcpy ( id, n . data . addr, sizeof * id );
-                return 0;
-            }
-        }
-    }
-    else
-    {
-        const KTrieIdxNode_v1 *n;
-
-        StringInitCString ( & key, str );
-        n = ( const KTrieIdxNode_v1* ) TrieFind ( & self -> key2id, & key );
-        if ( n != NULL )
-        {
-            * id = n -> id;
-            return 0;
-        }
-    }
-
-    return RC ( rcDB, rcIndex, rcSelecting, rcString, rcNotFound );
-}
-
-/* projection index id to key-string ( was Id2Key ) */
-rc_t KTrieIndexProject_v1 ( const KTrieIndex_v1 *self,
-    uint32_t id, char *key_buff, size_t buff_size, size_t *actsize )
-{
-    if ( self -> last < self -> first )
-    {
-        if ( self -> pt . id2node != NULL &&
-             id >= self -> pt . first &&
-             id <= self -> pt . last )
-        {
-            PTNode n;
-            uint32_t node = self -> pt . id2node [ id - self -> pt . first ];
-            rc_t rc = PTrieGetNode ( self -> pt . key2id,
-                & n, self -> pt . byteswap ? bswap_32 ( node ) : node );
-            if ( rc == 0 )
-            {
-                const String *key;
-                rc = PTNodeMakeKey ( & n, & key );
-                if ( rc == 0 )
-                {
-                    if (actsize)
-                        *actsize = key -> size;
-                    
-                    if ( key -> size >= buff_size )
-                        rc = RC ( rcDB, rcIndex, rcProjecting, rcBuffer, rcInsufficient );
-                    else
-                        string_copy ( key_buff, buff_size, key -> addr, key -> size );
-
-                    StringWhack ( ( String* ) key );
-                    return rc;
-                }
-            }
-        }
-    }
-    else
-    {
-        if ( self -> id2node != NULL &&
-             id >= self -> first &&
-             id <= self -> last )
-        {
-            const KTrieIdxNode_v1 *n = self -> id2node [ id - self -> first ];
-            if ( n != NULL )
-            {
-                if ( n -> n . key . size >= buff_size )
-                    return RC ( rcDB, rcIndex, rcProjecting, rcBuffer, rcInsufficient );
-                string_copy ( key_buff, buff_size,
-                    n -> n . key . addr, n -> n . key . size );
-                return 0;
-            }
-        }
-    }
-
-    return RC ( rcDB, rcIndex, rcProjecting, rcId, rcNotFound );
-}
diff --git a/libs/kdb/wtrieidx-v2.c b/libs/kdb/wtrieidx-v2.c
deleted file mode 100644
index b3dd8ab..0000000
--- a/libs/kdb/wtrieidx-v2.c
+++ /dev/null
@@ -1,2560 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kdb/extern.h>
-
-#include "windex-priv.h"
-#include "trieidx-priv.h"
-
-#include <kdb/index.h>
-#include <kfs/directory.h>
-#include <kfs/file.h>
-#include <kfs/md5.h>
-#include <kfs/mmap.h>
-#include <klib/ptrie.h>
-#include <klib/text.h>
-#include <klib/pack.h>
-#include <klib/rc.h>
-#include <os-native.h>
-#include <sysalloc.h>
-
-#include <byteswap.h>
-
-#include <stdlib.h>
-#include <limits.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <assert.h>
-
-#define KTRIE_ZEROS_KPTRIE 1
-
-/*--------------------------------------------------------------------------
- * KPTrieIndex_v2
- *  persisted keymap
- */
-
-
-/* Init
- *  opens and initializes persisted keymap structure
- */
-static
-rc_t KPTrieIndexInitID2Ord ( KPTrieIndex_v2 *self, size_t in_size,
-    int variant, int span_bits, int elem_bits )
-{
-    rc_t rc;
-    union
-    {
-        uint8_t *v8;
-        uint16_t *v16;
-        uint32_t *v32;
-        uint64_t *v64;
-    } dst;
-    size_t elem_bytes = elem_bits >> 3;
-    uint32_t scount = self -> count - 1;
-
-    assert ( self -> count != 0 );
-
-    if ( span_bits * scount > in_size * 8 )
-        return RC ( rcDB, rcIndex, rcConstructing, rcIndex, rcCorrupt );
-
-    dst . v8 = malloc ( self -> count * elem_bytes );
-    if ( dst . v8 == NULL )
-        rc = RC ( rcDB, rcIndex, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        size_t usize;
-        rc = Unpack ( span_bits, elem_bits,
-            & self -> ord2node [ self -> count ], 0,
-            span_bits * scount, NULL, & dst . v8 [ elem_bytes ],
-            scount * elem_bytes, & usize );
-        if ( rc == 0 )
-        {
-            uint32_t i;
-
-            self -> id2ord . v8 = dst . v8;
-            self -> variant = variant;
-
-            /* integrate to simple translation */
-            switch ( variant )
-            {
-            case 1:
-                dst . v8 [ 0 ] = 0;
-                for ( i = 0; i < scount; ++ i )
-                    dst . v8 [ i + 1 ] += dst . v8 [ i ];
-                break;
-            case 2:
-                dst . v16 [ 0 ] = 0;
-                for ( i = 0; i < scount; ++ i )
-                    dst . v16 [ i + 1 ] += dst . v16 [ i ];
-                break;
-            case 3:
-                dst . v32 [ 0 ] = 0;
-                for ( i = 0; i < scount; ++ i )
-                    dst . v32 [ i + 1 ] += dst . v32 [ i ];
-                break;
-            case 4:
-                dst . v64 [ 0 ] = 0;
-                for ( i = 0; i < scount; ++ i )
-                    dst . v64 [ i + 1 ] += dst . v64 [ i ];
-                break;
-            }
-
-            return 0;
-        }
-
-        free ( dst . v8 );
-    }
-
-    return rc;
-}
-
-static
-void CC KPTrieIndexExtractV1Range_v2 ( PTNode *n, void *data )
-{
-    KPTrieIndex_v2 *self = data;
-
-    /* capture node id */
-    uint32_t id;
-    assert ( n -> data . size == sizeof id );
-    memcpy ( & id, n -> data . addr, sizeof id );
-
-    /* perform min/max */
-    if ( self -> count == 0 )
-        self -> first = self -> last = id;
-    else if ( id < self -> first )
-        self -> first = id;
-    else if ( id > self -> last )
-        self -> last = id;
-
-    ++ self -> count;
-}
-
-static
-rc_t KPTrieIndexInitFromV1_v2 ( KPTrieIndex_v2 *self, const KMMap *mm, bool byteswap )
-{
-    KPTrieIndex_v1 v1;
-    rc_t rc = KPTrieIndexInit_v1 ( & v1, mm, byteswap );
-    if ( rc == 0 )
-    {
-        uint32_t *ord2node;
-        uint32_t total_id, test_id;
-        uint32_t i, id, id_bits, num_ids;
-
-        /* hopefully we got a projection index */
-        if ( v1 . id2node == NULL )
-        {
-#if ! KTRIE_ZEROS_KPTRIE
-            self -> count = 0;
-#endif
-            /* need to derive first and last from trie */
-            PTrieForEach ( v1 . key2id, KPTrieIndexExtractV1Range_v2, self );
-            if ( self -> count == 0 )
-                KPTrieIndexWhack_v1 ( & v1 );
-            else
-            {
-                /* take trie as-is */
-                self -> key2id = v1 . key2id;
-                self -> maxid = self -> last;
-            }
-
-            /* note that this assumes a span of 1 for
-               each id. there are no known uses of v1 without
-               a projection index, so this is unlikely to be important */
-
-            return 0;
-        }
-
-        /* take id range */
-        self -> first = v1 . first;
-        self -> last = self -> maxid = v1 . last;
-
-        /* count comes from trie as always */
-        self -> count = PTrieCount ( v1 . key2id );
-
-        /* detect empty trie */
-        if ( self -> count == 0 || self -> first > self -> last )
-        {
-            self -> first = self -> last = self -> maxid = 0;
-            return 0;
-        }
-
-        /* take trie as-is */
-        self -> key2id = v1 . key2id;
-
-        /* now decide whether to use 1-1 or sparse projection */
-        if ( ( self -> last - self -> first ) < ( ( int64_t ) self -> count << 1 ) )
-        {
-            /* take the old projection array as-is,
-               treating NULL node ids as holes */
-            self -> ord2node = v1 . id2node;
-            return 0;
-        }
-
-        /* convert to sparse
-           calculate id bits - notice that
-           total_id gets right shifted so that
-           the loop is guaranteed to exit */
-        num_ids = ( uint32_t ) ( self -> last - self -> first + 1 );
-        for ( total_id = num_ids >> 1, id_bits = 1, test_id = 1;
-            test_id <= total_id;
-            ++ id_bits, test_id <<= 1 )
-            ( void ) 0;
-
-        /* determine variant */
-        if ( id_bits <= 8 )
-        {
-            /* allocate 4 bytes for new ord2node and 1 for id2ord */
-            uint8_t *id2ord = malloc ( self -> count * 5 );
-            if ( id2ord == NULL )
-                rc = RC ( rcDB, rcIndex, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                ord2node = ( uint32_t* ) & id2ord [ self -> count ];
-                self -> ord2node = ord2node;
-                self -> id2ord . v8 = id2ord;
-                self -> variant = 1;
-
-                /* walk across v1 table, looking at each id */
-                for ( i = id = 0; id < num_ids; ++ id )
-                {
-                    /* detect non NULL node ids
-                       and pretend they represent a contiguous
-                       span with no holes in id space */
-                    if ( v1 . id2node [ id ] != 0 )
-                    {
-                        /* prevent overwriting */
-                        if ( i == self -> count )
-                        {
-                            rc = RC ( rcDB, rcIndex, rcConstructing, rcIndex, rcCorrupt );
-                            break;
-                        }
-
-                        /* record id and node for slot */
-                        id2ord [ i ] = ( uint8_t ) id;
-                        ord2node [ i ] = v1 . id2node [ id ];
-                        ++ i;
-                    }
-                }
-            }
-        }
-        else if ( id_bits <= 16 )
-        {
-            uint16_t *id2ord = malloc ( self -> count * 6 );
-            if ( id2ord == NULL )
-                rc = RC ( rcDB, rcIndex, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                ord2node = ( uint32_t* ) & id2ord [ self -> count ];
-                self -> ord2node = ord2node;
-                self -> id2ord . v16 = id2ord;
-                self -> variant = 2;
-
-                for ( i = id = 0; id < num_ids; ++ id )
-                {
-                    if ( v1 . id2node [ id ] != 0 )
-                    {
-                        if ( i == self -> count )
-                        {
-                            rc = RC ( rcDB, rcIndex, rcConstructing, rcIndex, rcCorrupt );
-                            break;
-                        }
-
-                        id2ord [ i ] = ( uint16_t ) id;
-                        ord2node [ i ] = v1 . id2node [ id ];
-                        ++ i;
-                    }
-                }
-            }
-        }
-        else
-        {
-            uint32_t *id2ord = malloc ( self -> count * 8 );
-            if ( id2ord == NULL )
-                rc = RC ( rcDB, rcIndex, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                ord2node = & id2ord [ self -> count ];
-                self -> ord2node = ord2node;
-                self -> id2ord . v32 = id2ord;
-                self -> variant = 3;
-
-                for ( i = id = 0; id < num_ids; ++ id )
-                {
-                    if ( v1 . id2node [ id ] != 0 )
-                    {
-                        if ( i == self -> count )
-                        {
-                            rc = RC ( rcDB, rcIndex, rcConstructing, rcIndex, rcCorrupt );
-                            break;
-                        }
-
-                        id2ord [ i ] = id;
-                        ord2node [ i ] = v1 . id2node [ id ];
-                        ++ i;
-                    }
-                }
-            }
-        }
-
-        if ( rc == 0 )
-        {        
-            if ( i == self -> count )
-                return 0;
-            rc = RC ( rcDB, rcIndex, rcConstructing, rcIndex, rcCorrupt );
-        }
-
-        KPTrieIndexWhack_v1 ( & v1 );
-    }
-
-    return rc;
-}
-
-rc_t KPTrieIndexInit_v2 ( KPTrieIndex_v2 *self, const KMMap *mm, bool byteswap )
-{
-    /* get size of map, assumed to be size of file */
-    size_t size;
-    rc_t rc = KMMapSize ( mm, & size );
-    if ( rc == 0 )
-    {
-        const KPTrieIndexHdr_v2 *hdr;
-
-#if ! KTRIE_ZEROS_KPTRIE
-        self -> mm = NULL;
-        self -> ord2node = NULL;
-        self -> id2ord . v32 = NULL;
-        self -> variant = 0;
-#endif
-
-        /* ignore empty file */
-        if ( size == 0 )
-        {
-#if ! KTRIE_ZEROS_KPTRIE
-            self -> first = self -> last = self -> maxid = 0;
-            self -> key2id = NULL;
-            self -> count = 0;
-#endif
-            return 0;
-        }
-
-        /* have to have at least the base header */
-        if ( size < sizeof hdr -> dad )
-            return RC ( rcDB, rcIndex, rcConstructing, rcTrie, rcCorrupt );
-
-        rc = KMMapAddrRead ( mm, ( const void** ) & hdr );
-        if ( rc == 0 )
-        {
-            /* recheck header size */
-            if ( size < sizeof * hdr )
-                return RC ( rcDB, rcIndex, rcConstructing, rcTrie, rcCorrupt );
-
-            self -> first = hdr -> first;
-            self -> last = self -> maxid = hdr -> last;
-            self -> id_bits = ( uint8_t ) hdr -> id_bits;
-            self -> span_bits = ( uint8_t ) hdr -> span_bits;
-            self -> byteswap = byteswap;
-
-            /* try to create the pttree */
-            rc = PTrieMakeOrig ( & self -> key2id,
-                hdr + 1, size -= sizeof * hdr, byteswap );
-            if ( rc == 0 )
-            {
-                size_t ptsize = PTrieSize ( self -> key2id );
-                if ( ptsize <= size )
-                {
-                    /* the count covers at least the number of trie nodes */
-                    self -> count = PTrieCount ( self -> key2id );
-
-                    /* it could be stored without projection */
-                    if ( ptsize == size )
-                        return 0;
-
-                    /* calculate remaining bytes */                     
-                    size -= ptsize;
-
-                    /* there must be enough for an array of 4-byte node ids */
-                    if ( size >= ( ( size_t ) self -> count << 2 ) )
-                    {
-                        /* take the persisted array as-is */
-                        self -> ord2node = ( const uint32_t* )
-                            ( ( const char* ) ( hdr + 1 ) + ptsize );
-
-                        /* read the count */
-                        if ( size >= 4 )
-                        {
-                            self -> count = * ( self -> ord2node ) ++;
-                            size -= 4;
-                        }
-
-                        /* determine strategy from id span and count */
-                        if ( ( self -> last - self -> first ) < ( ( int64_t ) self -> count << 1 ) )
-                        {
-                            /* must be contiguous */
-                            self -> count = ( uint32_t ) ( self -> last - self -> first + 1 );
-
-                            /* size should be exactly this number of slots */
-                            if ( size == ( ( size_t ) self -> count << 2 ) )
-                                return 0;
-
-                            /* fall through to error return */
-                        }
-                        else if ( ( size == 4 && self -> count == 1 ) || size > ( ( size_t ) self -> count << 2 ) )
-                        {
-                            /* sparse */
-                            size -= ( size_t ) self -> count << 2;
-
-                            /* unpack id map */
-                            if ( hdr -> id_bits <= 8 )
-                                rc = KPTrieIndexInitID2Ord ( self, size, 1, hdr -> span_bits, 8 );
-                            else if ( hdr -> id_bits <= 16 )
-                                rc = KPTrieIndexInitID2Ord ( self, size, 2, hdr -> span_bits, 16 );
-                            else if ( hdr -> id_bits <= 32 )
-                                rc = KPTrieIndexInitID2Ord ( self, size, 3, hdr -> span_bits, 32 );
-                            else
-                                rc = KPTrieIndexInitID2Ord ( self, size, 4, hdr -> span_bits, 64 );
-
-                            /* done */
-                            if ( rc == 0 )
-                                return 0;
-
-                            PTrieWhack ( self -> key2id ), self -> key2id = NULL;
-                            return rc;
-                        }
-                    }
-                }
-
-                PTrieWhack ( self -> key2id ), self -> key2id = NULL;
-                rc = RC ( rcDB, rcIndex, rcConstructing, rcTrie, rcCorrupt );
-            }
-        }
-    }
-
-    return rc;
-}
-
-rc_t KPTrieIndexInit_v3_v4 ( KPTrieIndex_v2 *self, const KMMap *mm, bool byteswap, bool ptorig )
-{
-    /* get size of map, assumed to be size of file */
-    size_t size;
-    rc_t rc = KMMapSize ( mm, & size );
-    if ( rc == 0 )
-    {
-        const KPTrieIndexHdr_v3 *hdr;
-
-#if ! KTRIE_ZEROS_KPTRIE
-        self -> mm = NULL;
-        self -> ord2node = NULL;
-        self -> id2ord . v32 = NULL;
-        self -> variant = 0;
-#endif
-
-        /* ignore empty file */
-        if ( size == 0 )
-        {
-#if ! KTRIE_ZEROS_KPTRIE
-            self -> first = self -> last = self -> maxid = 0;
-            self -> key2id = NULL;
-            self -> count = 0;
-#endif
-            return 0;
-        }
-
-        /* have to have at least the base header */
-        if ( size < sizeof hdr -> dad )
-            return RC ( rcDB, rcIndex, rcConstructing, rcTrie, rcCorrupt );
-
-        rc = KMMapAddrRead ( mm, ( const void** ) & hdr );
-        if ( rc == 0 )
-        {
-            /* recheck header size */
-            if ( size < sizeof * hdr )
-                return RC ( rcDB, rcIndex, rcConstructing, rcTrie, rcCorrupt );
-
-            self -> first = hdr -> first;
-            self -> last = self -> maxid = hdr -> last;
-            self -> id_bits = ( uint8_t ) hdr -> id_bits;
-            self -> span_bits = ( uint8_t ) hdr -> span_bits;
-            self -> byteswap = byteswap;
-
-            /* try to create the pttree */
-            rc = ( ptorig ? PTrieMakeOrig : PTrieMake )
-                ( & self -> key2id, hdr + 1, size -= sizeof * hdr, byteswap );
-            if ( rc == 0 )
-            {
-                size_t ptsize = PTrieSize ( self -> key2id );
-                if ( ptsize <= size )
-                {
-                    /* the count covers at least the number of trie nodes */
-                    self -> count = PTrieCount ( self -> key2id );
-
-                    /* it could be stored without projection */
-                    if ( ptsize == size )
-                        return 0;
-
-                    /* calculate remaining bytes */                     
-                    size -= ptsize;
-
-                    /* there must be enough for an array of 4-byte node ids */
-                    if ( size >= ( ( size_t ) self -> count << 2 ) )
-                    {
-                        /* take the persisted array as-is */
-                        self -> ord2node = ( const uint32_t* )
-                            ( ( const char* ) ( hdr + 1 ) + ptsize );
-
-                        /* read the count */
-                        if ( size >= 4 )
-                        {
-                            self -> count = * ( self -> ord2node ) ++;
-                            size -= 4;
-                        }
-
-                        /* determine strategy from id span and count */
-                        if ( ( self -> last - self -> first ) < ( ( int64_t ) self -> count << 1 ) )
-                        {
-                            /* must be contiguous */
-                            self -> count = ( uint32_t ) ( self -> last - self -> first + 1 );
-
-                            /* size should be exactly this number of slots */
-                            if ( size == ( ( size_t ) self -> count << 2 ) )
-                                return 0;
-
-                            /* fall through to error return */
-                        }
-                        else if ( ( size == 4 && self -> count == 1 ) || size > ( ( size_t ) self -> count << 2 ) )
-                        {
-                            /* sparse */
-                            size -= ( size_t ) self -> count << 2;
-
-                            /* unpack id map */
-                            if ( hdr -> id_bits <= 8 )
-                                rc = KPTrieIndexInitID2Ord ( self, size, 1, hdr -> span_bits, 8 );
-                            else if ( hdr -> id_bits <= 16 )
-                                rc = KPTrieIndexInitID2Ord ( self, size, 2, hdr -> span_bits, 16 );
-                            else if ( hdr -> id_bits <= 32 )
-                                rc = KPTrieIndexInitID2Ord ( self, size, 3, hdr -> span_bits, 32 );
-                            else
-                                rc = KPTrieIndexInitID2Ord ( self, size, 4, hdr -> span_bits, 64 );
-
-                            /* done */
-                            if ( rc == 0 )
-                                return 0;
-
-                            PTrieWhack ( self -> key2id ), self -> key2id = NULL;
-                            return rc;
-                        }
-                    }
-                }
-
-                PTrieWhack ( self -> key2id ), self -> key2id = NULL;
-                rc = RC ( rcDB, rcIndex, rcConstructing, rcTrie, rcCorrupt );
-            }
-        }
-    }
-
-    return rc;
-}
-
-/* Whack
- *  closes down keymap
- */
-void KPTrieIndexWhack_v2 ( KPTrieIndex_v2 *self )
-{
-    free ( ( void* ) self -> id2ord . v8 );
-    PTrieWhack ( self -> key2id );
-    KMMapRelease ( self -> mm );
-    memset ( self, 0, sizeof * self );
-}
-
-uint32_t KPTrieIndexID2Ord_v2 ( const KPTrieIndex_v2 *self, int64_t id )
-{
-    if ( id >= self -> first && id <= self -> maxid )
-    {
-        int64_t nid;
-        uint32_t left, right, ord, count = self -> count;
-
-        /* convert id either to a zero-based ord,
-           or else the translated id in id2ord */
-        id -= self -> first;
-
-        /* handle type of projection */
-        switch ( self -> variant )
-        {
-        case 0:
-            /* return one-based ord */
-            return ( uint32_t ) ( id + 1 );
-
-        case 1:
-            for ( left = 1, right = count; left <= right; )
-            {
-                ord = ( left + right ) >> 1;
-                nid = self -> id2ord . v8 [ ord - 1 ];
-                if ( id == nid )
-                    return ord;
-
-                if ( id < nid )
-                {
-                    right = ord - 1;
-                    continue;
-                }
-                if ( ord == count )
-                    return ord;
-
-                nid = self -> id2ord . v8 [ ord ];
-                if ( id < nid )
-                    return ord;
-
-                left = ord + 1;
-            }
-            break;
-
-        case 2:
-            for ( left = 1, right = count; left <= right; )
-            {
-                ord = ( left + right ) >> 1;
-                nid = self -> id2ord . v16 [ ord - 1 ];
-                if ( id == nid )
-                    return ord;
-
-                if ( id < nid )
-                {
-                    right = ord - 1;
-                    continue;
-                }
-                if ( ord == count )
-                    return ord;
-
-                nid = self -> id2ord . v16 [ ord ];
-                if ( id < nid )
-                    return ord;
-
-                left = ord + 1;
-            }
-            break;
-
-        case 3:
-            for ( left = 1, right = count; left <= right; )
-            {
-                ord = ( left + right ) >> 1;
-                nid = self -> id2ord . v32 [ ord - 1 ];
-                if ( id == nid )
-                    return ord;
-
-                if ( id < nid )
-                {
-                    right = ord - 1;
-                    continue;
-                }
-                if ( ord == count )
-                    return ord;
-
-                nid = self -> id2ord . v32 [ ord ];
-                if ( id < nid )
-                    return ord;
-
-                left = ord + 1;
-            }
-            break;
-
-        case 4:
-            for ( left = 1, right = count; left <= right; )
-            {
-                ord = ( left + right ) >> 1;
-                nid = self -> id2ord . v64 [ ord - 1 ];
-                if ( id == nid )
-                    return ord;
-
-                if ( id < nid )
-                {
-                    right = ord - 1;
-                    continue;
-                }
-                if ( ord == count )
-                    return ord;
-
-                nid = self -> id2ord . v64 [ ord ];
-                if ( id < nid )
-                    return ord;
-
-                left = ord + 1;
-            }
-            break;
-        }
-    }
-    return 0;
-}
-
-static
-rc_t KPTrieIndexProject_v2 ( const KPTrieIndex_v2 *self,
-    int64_t id,
-#if V2FIND_RETURNS_SPAN
-    int64_t *start_id, uint32_t *span,
-#endif
-    char *key_buff, size_t buff_size, size_t *actsize )
-{
-    uint32_t nid, ord = KPTrieIndexID2Ord_v2 ( self, id );
-    if ( ord != 0 )
-    {
-        assert ( start_id != NULL );
-        assert ( span != NULL );
-
-        nid = self -> ord2node [ ord - 1 ];
-
-        switch ( self -> variant )
-        {
-        case 0:
-            * start_id = id;
-            for ( ; ord < self -> count; ++ ord )
-            {
-                if ( nid != self -> ord2node [ ord ] )
-                    break;
-            }
-            * span = self -> first + ord - * start_id;
-            break;
-        case 1:
-            * start_id = self -> id2ord . v8 [ ord - 1 ];
-            * span = ( uint32_t ) ( ( ( ord == self -> count ) ?
-                ( self -> maxid  - self -> first + 1 ) : self -> id2ord . v8 [ ord ] ) - * start_id );
-            *start_id += self->first; 
-            break;
-        case 2:
-            * start_id = self -> id2ord . v16 [ ord - 1 ];
-            * span = ( uint32_t ) ( ( ( ord == self -> count ) ?
-                ( self -> maxid  - self -> first + 1 ) : self -> id2ord . v16 [ ord ] ) - * start_id );
-            *start_id += self->first; 
-            break;
-        case 3:
-            * start_id = self -> id2ord . v32 [ ord - 1 ];
-            * span = ( uint32_t ) ( ( ( ord == self -> count ) ?
-                ( self -> maxid  - self -> first + 1 ) : self -> id2ord . v32 [ ord ] ) - * start_id );
-            *start_id += self->first; 
-            break;
-        case 4:
-            * start_id = self -> id2ord . v64 [ ord - 1 ];
-            * span = ( uint32_t ) ( ( ( ord == self -> count ) ?
-                ( self -> maxid  - self -> first + 1 ) : self -> id2ord . v64 [ ord ] ) - * start_id );
-            *start_id += self->first; 
-            break;
-        }
-
-        if ( nid != 0 )
-        {
-            rc_t rc;
-            PTNode node;
-
-            if ( self -> byteswap )
-                nid = bswap_32 ( nid );
-
-            rc = PTrieGetNode ( self -> key2id, & node, nid );
-            if ( rc == 0 )
-            {
-                const String *key;
-                rc = PTNodeMakeKey ( & node, & key );
-                if ( rc == 0 )
-                {
-                    if (actsize)
-                        *actsize = key -> size;
-                    if ( key -> size >= buff_size )
-                        rc = RC ( rcDB, rcIndex, rcProjecting, rcBuffer, rcInsufficient );
-                    else
-                        string_copy ( key_buff, buff_size, key -> addr, key -> size );
-
-                    StringWhack ( ( String* ) key );
-                }
-            }
-            return rc;
-        }
-    }
-
-    return RC ( rcDB, rcIndex, rcProjecting, rcId, rcNotFound );
-}
-
-/* Find
- */
-static
-rc_t KPTrieIndexFind_v2 ( const KPTrieIndex_v2 *self,
-    const char *str, int64_t *start_id,
-#if V2FIND_RETURNS_SPAN
-    uint32_t *span,
-#endif
-    int ( CC * custom_cmp ) ( const void *item, const PBSTNode *n, void *data ), void *data, bool convertFromV1 )
-{
-    rc_t rc;
-
-    /* detect empty index */
-    if ( self -> count == 0 )
-        rc = RC ( rcDB, rcIndex, rcSelecting, rcString, rcNotFound );
-    else
-    {
-        uint32_t nid;
-        PTNode pnode;
-
-        String key;
-        StringInitCString ( & key, str );
-
-        /* try to find string */
-        nid = PTrieFind ( self -> key2id, & key, & pnode, custom_cmp, data );
-        if ( nid == 0 )
-            rc = RC ( rcDB, rcIndex, rcSelecting, rcString, rcNotFound );
-        else
-        {
-            size_t usize;
-
-            /* detect conversion from v1 */
-            if ( convertFromV1 && self -> id_bits == 0 )
-            {
-                /* v1 stored tree will have just a 32-bit spot id as data */
-                uint32_t id;
-                assert ( pnode . data . size == sizeof id );
-                memcpy ( & id, pnode . data . addr, sizeof id );
-                * start_id = id;
-                rc = 0;
-            }
-            else
-            {
-                /* should be native v2 */
-                rc = Unpack ( self -> id_bits, sizeof * start_id * 8,
-                    pnode . data . addr, 0, self -> id_bits, NULL,
-                    start_id, sizeof * start_id, & usize );
-                * start_id += self -> first;
-            }
-
-            if ( rc == 0 )
-            {
-#if V2FIND_RETURNS_SPAN
-                if ( self -> ord2node != NULL )
-                {
-                    uint32_t ord = KPTrieIndexID2Ord_v2 ( self, * start_id );
-                    if ( ord == 0 )
-                        rc = RC ( rcDB, rcIndex, rcSelecting, rcId, rcNotFound );
-                    else if ( ord == self -> count )
-                        * span = self -> maxid - * start_id + 1;
-                    else switch ( self -> variant )
-                    {
-                    case 0:
-                        for ( ; ord < self -> count; ++ ord )
-                        {
-                            if ( nid != self -> ord2node [ ord ] )
-                                break;
-                        }
-                        * span = self -> first + ord - * start_id;
-                        break;
-                    case 1:
-                        * span = self -> first + self -> id2ord . v8 [ ord ] - * start_id;
-                        break;
-                    case 2:
-                        * span = self -> first + self -> id2ord . v16 [ ord ] - * start_id;
-                        break;
-                    case 3:
-                        * span = self -> first + self -> id2ord . v32 [ ord ] - * start_id;
-                        break;
-                    case 4:
-                        * span = self -> first + self -> id2ord . v64 [ ord ] - * start_id;
-                        break;
-                    }
-                }
-                else if ( self -> span_bits == 0 )
-                    * span = 1;
-                else
-                {
-                    rc = Unpack ( self -> span_bits, sizeof * span * 8,
-                        pnode . data . addr, 0, self -> id_bits, NULL,
-                        span, sizeof * span, & usize );
-                }
-#endif
-            }
-        }
-    }
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * KTrieIdxNode_v2
- */
-
-static
-rc_t KTrieIdxNodeMake_v2_s1 ( KTrieIdxNode_v2_s1 **n, const String *key, int64_t id )
-{
-    rc_t rc = TNodeMake ( ( TNode** ) n, sizeof ** n + key -> size );
-    if ( rc != 0 )
-        rc = ResetRCContext ( rc, rcDB, rcIndex, rcInserting );
-    else
-    {
-        KTrieIdxNode_v2_s1 *node = * n;
-        string_copy ( node -> key, key -> size + 1, key -> addr, key -> size);
-        StringInit ( & node -> n . key, node -> key, key -> size, key -> len );
-        node -> start_id = id;
-    }
-
-    return rc;
-}
-
-static
-rc_t KTrieIdxNodeMakeHole_v2_s1 ( KTrieIdxNode_v2_s1 **n, int64_t id )
-{
-    rc_t rc = TNodeMake ( ( TNode** ) n, sizeof ** n );
-    if ( rc != 0 )
-        rc = ResetRCContext ( rc, rcDB, rcIndex, rcInserting );
-    else
-    {
-        KTrieIdxNode_v2_s1 *node = * n;
-        node -> key [ 0 ] = 0;
-        StringInit ( & node -> n . key, node -> key, 0, 0 );
-        node -> start_id = id;
-    }
-
-    return rc;
-}
-
-static
-rc_t KTrieIdxNodeMake_v2_s2 ( KTrieIdxNode_v2_s2 **n, const String *key, int64_t id )
-{
-    rc_t rc = TNodeMake ( ( TNode** ) n, sizeof ** n + key -> size );
-    if ( rc != 0 )
-        rc = ResetRCContext ( rc, rcDB, rcIndex, rcInserting );
-    else
-    {
-        KTrieIdxNode_v2_s2 *node = * n;
-        string_copy ( node -> key, key -> size + 1, key -> addr, key -> size);
-        StringInit ( & node -> n . key, node -> key, key -> size, key -> len );
-        node -> start_id = id;
-        node -> span = 1;
-    }
-    return rc;
-}
-
-static
-void CC KTrieIdxNodeWhack_v2 ( TNode *n, void *data )
-{
-    TNodeWhack ( n );
-}
-
-#if 0
-static
-void CC KTrieIdxNodeUnlink_v2 ( TNode *n, void *data )
-{
-    if ( TrieUnlink ( data, n ) )
-        TNodeWhack ( n );
-}
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KTrieIndex_v2
- */
-
-static
-uint32_t KTrieIndexID2Ord_v2 ( const KTrieIndex_v2 *self, int64_t id )
-{
-    if ( id >= self -> first && id <= self -> last )
-    {
-        uint32_t left, right, count = self -> count;
-        for ( left = 1, right = count; left <= right; )
-        {
-            uint32_t ord = ( left + right ) >> 1;
-            const KTrieIdxNode_v2_s1 *node = self -> ord2node [ ord - 1 ];
-            if ( id == node -> start_id )
-                return ord;
-
-            if ( id < node -> start_id )
-            {
-                right = ord - 1;
-                continue;
-            }
-
-            if ( ord == count )
-                return ord;
-
-            node = self -> ord2node [ ord ];
-            if ( id < node -> start_id )
-                return ord;
-
-            left = ord + 1;
-        }
-    }
-    return 0;
-}
-
-static
-uint32_t KTrieIndexNode2Ord_v2 ( const KTrieIndex_v2 *self, const KTrieIdxNode_v2_s1 *node )
-{
-    if ( self -> ord2node != NULL )
-        return KTrieIndexID2Ord_v2 ( self, node -> start_id );
-    return 0;
-}
-
-/* KTrieIndexWrite_v2
- */
-typedef struct PersistTrieData PersistTrieData;
-struct PersistTrieData
-{
-    uint64_t pos;
-    KFile *f;
-    KMD5File *fmd5;
-    uint8_t *buffer;
-    size_t bsize;
-    size_t marker;
-
-    int64_t first;
-    size_t ptt_size;
-    size_t node_data_size;
-    uint16_t id_bits;
-    uint16_t span_bits;
-    rc_t rc;
-};
-
-static
-rc_t CC KTrieIndexWrite_v2 ( void *param,
-    const void *buffer, size_t size, size_t *num_writ )
-{
-    PersistTrieData *pb = param;
-    size_t total, to_write;
-
-    for ( total = 0; total < size; total += to_write )
-    {
-        to_write = size - total;
-        if ( pb -> marker + to_write > pb -> bsize )
-            to_write = pb -> bsize - pb -> marker;
-
-        if ( to_write > 0 )
-        {
-            memcpy ( pb -> buffer + pb -> marker,
-                ( const uint8_t* ) buffer + total, to_write );
-            pb -> marker += to_write;
-        }
-
-        if ( pb -> marker == pb -> bsize )
-        {
-            size_t num_flushed;
-            pb -> rc = KFileWrite ( pb -> f, pb -> pos,
-                pb -> buffer, pb -> bsize, & num_flushed );
-            if ( pb -> rc != 0 )
-            {
-                * num_writ = 0;
-                return pb -> rc;
-            }
-
-            if ( num_flushed == 0 )
-            {
-                * num_writ = total + to_write;
-                return pb -> rc = RC ( rcDB, rcIndex, rcPersisting, rcTransfer, rcIncomplete );
-            }
-
-            pb -> marker -= num_flushed;
-            pb -> pos += num_flushed;
-
-            if ( pb -> marker != 0 )
-                memcpy ( pb -> buffer, pb -> buffer + num_flushed, pb -> marker );
-        }
-    }
-
-    * num_writ = total;
-    return 0;
-}
-
-/* KTrieIndexAux_v2
- */
-static
-rc_t CC KTrieIndexAux_v2_s1 ( void *param, const void *node, size_t *num_writ,
-    PTWriteFunc write, void *write_param )
-{
-    PersistTrieData *pb = param;
-
-    if ( write != NULL && pb -> node_data_size != 0 )
-    {
-        char buffer [ 8 ];
-        const KTrieIdxNode_v2_s1 *n = node;
-
-        /* pack from 64 possible bits down to total id span */
-        if ( pb -> id_bits != 0 )
-        {
-            /* store name->id mapping as a simple translation
-               from first, because we don't have easy access to
-               neighboring nodes for storage as 1st derivative. */
-            uint64_t idd = n -> start_id - pb -> first;
-
-            bitsz_t psize;
-            rc_t rc = Pack ( 64, pb -> id_bits, & idd,
-                sizeof idd, NULL, buffer, 0, sizeof buffer * 8, & psize );
-            if ( rc != 0 )
-                return rc;
-
-            /* the packing should produce a single unit */
-            if ( psize != pb -> id_bits )
-                return RC ( rcDB, rcIndex, rcPacking, rcData, rcCorrupt );
-        }
-
-        /* write out the node */
-        return ( * write ) ( write_param, buffer, pb -> node_data_size, num_writ );
-    }
-
-    /* will always store an integral number of bytes */
-    * num_writ = pb -> node_data_size;
-    return 0;
-}
-
-static
-rc_t CC KTrieIndexAux_v2_s2 ( void *param, const void *node, size_t *num_writ,
-    PTWriteFunc write, void *write_param )
-{
-    PersistTrieData *pb = param;
-
-    if ( write != NULL && pb -> node_data_size != 0 )
-    {
-        const KTrieIdxNode_v2_s2 *n = node;
-
-        rc_t rc;
-        char buffer [ 12 ];
-        bitsz_t psize, offset;
-
-        if ( pb -> id_bits == 0 )
-            offset = 0;
-        else
-        {
-            /* again store name->id mapping as a simple translation
-               from first, but pack bits tightly */
-            uint64_t idd = n -> start_id - pb -> first;
-            rc = Pack ( 64, pb -> id_bits, & idd,
-                sizeof idd, NULL, buffer, 0, sizeof buffer * 8, & offset );
-            if ( rc != 0 )
-                return rc;
-            if ( offset != pb -> id_bits )
-                return RC ( rcDB, rcIndex, rcPacking, rcData, rcCorrupt );
-        }
-
-        /* now pack id span down to a minimal number of bits
-           6/8/09 - this is known to fail because Pack hasn't been
-           updated to start on a non-0 bit offset */
-        if ( pb -> span_bits != 0 )
-        {
-            rc = Pack ( 32, pb -> span_bits, & n -> span, sizeof n -> span,
-                NULL, buffer, offset, sizeof buffer * 8 - offset, & psize );
-            if ( rc != 0 )
-                return rc;
-            if ( psize != pb -> span_bits )
-                return RC ( rcDB, rcIndex, rcPacking, rcData, rcCorrupt );
-        }
-
-        /* write out packed combination */
-        return ( * write ) ( write_param, buffer, pb -> node_data_size, num_writ );
-    }
-
-    * num_writ = pb -> node_data_size;
-    return 0;
-}
-
-/* KTrieIndexPersist_v*
- *  write keymap to indicated location
- */
-#if KDBINDEXVERS == 2
-
-static
-void KTrieIndexPersistHdr_v2 ( KTrieIndex_v2 *self, PersistTrieData *pb )
-{
-    KPTrieIndexHdr_v2 *hdr;
-
-    uint64_t total_id, test_id;
-    uint32_t total_span, test_span;
-
-    pb -> pos = 0;
-
-    hdr = ( KPTrieIndexHdr_v2* ) pb -> buffer;
-    pb -> marker = sizeof * hdr;
-
-    /* stamp version header */
-    KDBHdrInit(&hdr->dad, 2);
-
-    /* store first and last ids */
-    pb -> first = self -> first;
-    hdr -> first = self -> first;
-    hdr -> last = self -> last;
-
-    /* calculate id bits - notice that
-       total_id gets right shifted so that
-       the loop is guaranteed to exit */
-    total_id = self -> last - self -> first;
-    if ( total_id == 0 )
-        pb -> id_bits = 0;
-    else for ( total_id >>= 1, pb -> id_bits = 1, test_id = 1;
-          test_id <= total_id;
-          ++ pb -> id_bits, test_id <<= 1 )
-        ( void ) 0;
-
-    /* if we have maintained a projection index,
-       calculate max span now */
-    if ( self -> ord2node != NULL )
-    {
-        uint32_t i, span, max_span;
-        int64_t cur, prev = self -> first;
-        for ( i = max_span = 1; i < self -> count; prev = cur, ++ i )
-        {
-            cur = self -> ord2node [ i ] -> start_id;
-            span = ( uint32_t ) ( cur - prev );
-            if ( span > max_span )
-                max_span = span;
-        }
-        
-        span = ( uint32_t ) ( self -> last - prev );
-        if ( span > max_span )
-            max_span = span;
-
-        self -> max_span = max_span;
-    }
-
-    /* calculate span bits */
-    total_span = self -> max_span;
-    if ( total_span == 0 )
-        pb -> span_bits = 0;
-    else for ( total_span >>= 1, pb -> span_bits = 1, test_span = 1;
-          test_span <= total_span;
-          ++ pb -> span_bits, test_span <<= 1 )
-        ( void ) 0;
-
-    /* record these as header data */
-    hdr -> id_bits = pb -> id_bits;
-    hdr -> span_bits = pb -> span_bits;
-
-    /* zero trailing junk */
-    hdr -> align [ 0 ] = hdr -> align [ 1 ] = 0;
-}
-
-#else
-
-static
-void KTrieIndexPersistHdr_v3_v4 ( KTrieIndex_v2 *self, PersistTrieData *pb )
-{
-    KPTrieIndexHdr_v3 *hdr;
-
-    uint64_t total_id, test_id;
-    uint32_t total_span, test_span;
-
-    pb -> pos = 0;
-
-    hdr = ( KPTrieIndexHdr_v3* ) pb -> buffer;
-    pb -> marker = sizeof * hdr;
-
-    /* stamp version header */
-    KDBHdrInit(&hdr->dad.h, KDBINDEXVERS);
-    hdr->dad.index_type = kitText;
-
-    /* store first and last ids */
-    pb -> first = self -> first;
-    hdr -> first = self -> first;
-    hdr -> last = self -> last;
-
-    /* calculate id bits - notice that
-       total_id gets right shifted so that
-       the loop is guaranteed to exit */
-    total_id = self -> last - self -> first;
-    if ( total_id == 0 )
-        pb -> id_bits = 0;
-    else for ( total_id >>= 1, pb -> id_bits = 1, test_id = 1;
-          test_id <= total_id;
-          ++ pb -> id_bits, test_id <<= 1 )
-        ( void ) 0;
-
-    /* if we have maintained a projection index,
-       calculate max span now */
-    if ( self -> ord2node != NULL )
-    {
-        uint32_t i, span, max_span;
-        int64_t cur, prev = self -> first;
-        for ( i = max_span = 1; i < self -> count; prev = cur, ++ i )
-        {
-            cur = self -> ord2node [ i ] -> start_id;
-            span = ( uint32_t ) ( cur - prev );
-            if ( span > max_span )
-                max_span = span;
-        }
-        
-        span = ( uint32_t ) ( self -> last - prev );
-        if ( span > max_span )
-            max_span = span;
-
-        self -> max_span = max_span;
-    }
-
-    /* calculate span bits */
-    total_span = self -> max_span;
-    if ( total_span == 0 )
-        pb -> span_bits = 0;
-    else for ( total_span >>= 1, pb -> span_bits = 1, test_span = 1;
-          test_span <= total_span;
-          ++ pb -> span_bits, test_span <<= 1 )
-        ( void ) 0;
-
-    /* record these as header data */
-    hdr -> id_bits = pb -> id_bits;
-    hdr -> span_bits = pb -> span_bits;
-
-    /* zero trailing junk */
-    hdr -> align [ 0 ] = hdr -> align [ 1 ] = 0;
-}
-
-#endif 
-
-static
-rc_t KTrieIndexPersistTrie_v2 ( const KTrieIndex_v2 *self, PersistTrieData *pb )
-{
-    rc_t rc;
-
-    /* persist the trie to file,
-       using tree-internal key storage,
-       capture the image size in pb */
-    if ( self -> ord2node != NULL )
-    {
-        pb -> node_data_size = ( pb -> id_bits + 7 ) >> 3;
-        rc = TriePersist ( & self -> key2id, & pb -> ptt_size,
-            false, KTrieIndexWrite_v2, pb, KTrieIndexAux_v2_s1, pb );
-    }
-    else
-    {
-        pb -> node_data_size = ( pb -> id_bits + pb -> span_bits + 7 ) >> 3;
-        rc = TriePersist ( & self -> key2id, & pb -> ptt_size,
-            false, KTrieIndexWrite_v2, pb, KTrieIndexAux_v2_s2, pb );
-    }
-
-    if ( rc == 0 && pb -> marker != 0 )
-    {
-        size_t num_writ;
-        rc = KFileWrite ( pb -> f, pb -> pos,
-            pb -> buffer, pb -> marker, & num_writ );
-        if ( rc == 0 && num_writ != pb -> marker )
-            rc = RC ( rcDB, rcIndex, rcPersisting, rcTransfer, rcIncomplete );
-    }
-
-    return rc;
-}
-
-
-static
-rc_t KTrieIndexPersistProjContig_v2 ( const KTrieIndex_v2 *self,
-    PersistTrieData *pb, PTrie *tt, uint32_t *ord2node )
-{
-    uint32_t i, j, nid;
-    int64_t id = self -> first;
-    for ( i = j = nid = 0; i < self -> count; ++ id, ++ j, ++ i )
-    {
-        const KTrieIdxNode_v2_s1 *node = self -> ord2node [ i ];
-
-        /* back fill repeats */
-        for ( ; id < node -> start_id; ++ id )
-            ord2node [ j ++ ] = nid;
-
-        /* check for a hole in id space */
-        if ( node -> n . key . size == 0 )
-            nid = 0;
-        else
-        {
-            PTNode pn;
-            nid = PTrieFind ( tt, & node -> n . key, & pn, NULL, NULL );
-            if ( nid == 0 )
-                return RC ( rcDB, rcIndex, rcPersisting, rcTransfer, rcIncomplete );
-        }
-
-        /* record nid for i at j */
-        ord2node [ j ] = nid;
-    }
-
-    /* finish off trailing span */
-    for ( ; id <= self -> last; ++ id )
-        ord2node [ j ++ ] = nid;
-
-    return 0;
-}
-
-static
-rc_t KTrieIndexPersistProjSparse_v2 ( const KTrieIndex_v2 *self,
-    PersistTrieData *pb, PTrie *tt, uint32_t *ord2node, bitsz_t *psize )
-{
-    uint32_t i, nid;
-    int64_t *id2ord = ( void* ) & ord2node [ self -> count ];
-    for ( i = 0; i < self -> count; ++ i )
-    {
-        const KTrieIdxNode_v2_s1 *node = self -> ord2node [ i ];
-
-        /* record negated id for i - see 1st derivative below */
-        id2ord [ i ] = - node -> start_id;
-
-        /* check for a hole in id space */
-        if ( node -> n . key . size == 0 )
-            nid = 0;
-        else
-        {
-            PTNode pn;
-            nid = PTrieFind ( tt, & node -> n . key, & pn, NULL, NULL );
-            if ( nid == 0 )
-                return RC ( rcDB, rcIndex, rcPersisting, rcTransfer, rcIncomplete );
-        }
-
-        /* record nid for i */
-        ord2node [ i ] = nid;
-    }
-
-    /* produce first derivative of ids
-       for any given pair, the 1st derivative is generally
-       right - left, which is usually stored right, such that
-       we start at the end and move left toward the start, i.e.
-
-       right -= left and move left
-
-       in this case, we want to eliminate the leading 0
-       and shift everything down, so we produce the result
-       to the left side and move right toward end, but this
-       requires more complicated arithmetic in order to preserve
-       right - left, i.e.
-
-       left = right - left and move right
-
-       to avoid this arithmetic, the ids were stored negated above
-       which converts the operation into
-
-       left -= right and move right
-    */
-    for ( i = 1; i < self -> count; ++ i )
-        id2ord [ i - 1 ] -= id2ord [ i ];
-
-    /* pack from 64 to span-bits */
-    return Pack ( 64, pb -> span_bits, id2ord, ( size_t ) ( self -> count - 1 ) << 3,
-                NULL, id2ord, 0, ( bitsz_t ) self -> count << 6, psize );
-}
-
-#if KDBINDEXVERS == 2
-
-static
-rc_t KTrieIndexPersistProj_v2 ( const KTrieIndex_v2 *self, PersistTrieData *pb )
-{
-    rc_t rc = 0;
-    void * addr;
-    size_t map_size;
-    uint64_t file_size;
-    size_t num_to_read;
-    uint64_t num_ids;
-    bool is_sparse;
-
-    /* there must be something to do */
-    if ( self -> count == 0 || self -> ord2node == NULL )
-        return 0;
-
-    /* calculate what kind of projection strategy to use:
-       when avg ( id span ) <= 2.0, just use a straight array.
-       otherwise, use two arrays: first for node ids and last
-       being 1st derivative of positional start_ids.
-
-       the calculation of the ratio would be
-         num_ids = self -> last - self -> first + 1;
-         ratio = num_ids / self -> count;
-         if ( ratio <= 2.0 )
-             use 1-1
-         else
-             use sparse
-
-       by reorganizing the comparison, we get
-         if ( num_ids <= 2 * self -> count )...
-    */
-    num_ids = self -> last - self -> first + 1;
-    if ( num_ids <= ( ( uint64_t ) self -> count << 1 ) )
-    {
-        /* store 1-1 projection index */
-        is_sparse = false;
-
-        /* map size is 4 bytes per id */
-        map_size = pb -> ptt_size + ( ( size_t ) num_ids << 2 );
-    }
-    else
-    {
-        /* store sparse projection index */
-        is_sparse = true;
-
-        /* map size for node ids is 4 bytes per slot */
-        map_size = pb -> ptt_size + ( ( size_t ) self -> count << 2 );
-
-        /* map size for 1st derivative ids is initially 8 bytes per slot
-           used initially to store full ids and then reduced 1st deriv. */
-        map_size += ( size_t ) self -> count << 3;
-    }
-
-    /* add in 4 bytes for count */
-    map_size += 4;
-
-    /* create an updatable region spanning from end of header,
-       starting from PTrie and extending to end of projection index */
-    addr = malloc ( map_size );
-    if ( addr == NULL )
-        rc = RC ( rcDB, rcIndex, rcPersisting, rcMemory, rcExhausted );
-    else
-    {
-        size_t num_read;
-
-        rc = KFileSize ( pb -> f, & file_size );
-        num_to_read = file_size - sizeof ( KPTrieIndexHdr_v2 );
-        if ( rc == 0 )
-        {
-            rc = KFileReadAll ( pb -> f, sizeof ( KPTrieIndexHdr_v2 ), addr,
-			     num_to_read, & num_read );
-            if ( rc == 0 )
-            {
-                if ( num_read != num_to_read )
-                {
-                    rc = RC ( rcDB, rcIndex, rcPersisting, rcHeader, rcInsufficient );
-                }
-            }
-        }
-        if ( rc != 0 )
-            free ( addr );
-    }
-
-    if ( rc == 0 )
-    {
-        size_t num_writ;
-        /* inflate the PTrie */
-        PTrie *tt;
-        rc = PTrieMakeOrig ( & tt, addr, pb -> ptt_size );
-        if ( rc == 0 )
-        {
-            uint32_t *ord2node;
-            assert ( pb -> ptt_size == PTrieSize ( tt ) );
-            assert ( self -> count >= PTrieCount ( tt ) );
-            ord2node = ( void* ) ( ( char* ) addr + pb -> ptt_size );
-            assert ( ( ( size_t ) ord2node & 3 ) == 0 );
-            
-            /* set count */
-            * ord2node ++ = self -> count;
-
-            if ( ! is_sparse )
-                rc = KTrieIndexPersistProjContig_v2 ( self, pb, tt, ord2node );
-            else
-            {
-                bitsz_t psize;
-                rc = KTrieIndexPersistProjSparse_v2 ( self, pb, tt, ord2node, & psize );
-                if ( rc == 0 )
-                {
-                    map_size -= ( size_t ) self -> count << 3;
-                    map_size += ( psize + 7 ) >> 3;
-                }
-            }
-
-            /* done with pttree */
-            PTrieWhack ( tt );
-        }
-        rc = KFileWrite ( pb -> f, file_size, 
-			  (uint8_t*)addr + num_to_read,  map_size - num_to_read, & num_writ );
-        if ( rc == 0  &&  num_writ != map_size - num_to_read )
-            rc = RC ( rcDB, rcIndex, rcPersisting, rcHeader, rcInsufficient );
-        free ( addr );
-    }
-
-    return rc;
-}
-
-#else
-
-static
-rc_t KTrieIndexPersistProj_v3 ( const KTrieIndex_v2 *self, PersistTrieData *pb )
-{
-    rc_t rc = 0;
-    void * addr;
-    size_t map_size;
-    uint64_t file_size;
-    size_t num_to_read;
-    uint64_t num_ids;
-    bool is_sparse;
-
-    /* there must be something to do */
-    if ( self -> count == 0 || self -> ord2node == NULL )
-        return 0;
-
-    /* calculate what kind of projection strategy to use:
-       when avg ( id span ) <= 2.0, just use a straight array.
-       otherwise, use two arrays: first for node ids and last
-       being 1st derivative of positional start_ids.
-
-       the calculation of the ratio would be
-         num_ids = self -> last - self -> first + 1;
-         ratio = num_ids / self -> count;
-         if ( ratio <= 2.0 )
-             use 1-1
-         else
-             use sparse
-
-       by reorganizing the comparison, we get
-         if ( num_ids <= 2 * self -> count )...
-    */
-    num_ids = self -> last - self -> first + 1;
-    if ( num_ids <= ( ( uint64_t ) self -> count << 1 ) )
-    {
-        /* store 1-1 projection index */
-        is_sparse = false;
-
-        /* map size is 4 bytes per id */
-        map_size = pb -> ptt_size + ( ( size_t ) num_ids << 2 );
-    }
-    else
-    {
-        /* store sparse projection index */
-        is_sparse = true;
-
-        /* map size for node ids is 4 bytes per slot */
-        map_size = pb -> ptt_size + ( ( size_t ) self -> count << 2 );
-
-        /* map size for 1st derivative ids is initially 8 bytes per slot
-           used initially to store full ids and then reduced 1st deriv. */
-        map_size += ( size_t ) self -> count << 3;
-    }
-
-    /* add in 4 bytes for count */
-    map_size += 4;
-
-    rc = KFileSize ( pb -> f, & file_size );
-    if ( rc == 0 )
-    {
-        /* create an updatable region spanning from end of header,
-           starting from PTrie and extending to end of projection index */
-        addr = malloc ( map_size );
-        if ( addr == NULL )
-            rc = RC ( rcDB, rcIndex, rcPersisting, rcMemory, rcExhausted );
-        else
-        {
-            size_t num_read;
-            num_to_read = file_size - sizeof ( KPTrieIndexHdr_v3 );
-            rc = KFileReadAll ( pb -> f, sizeof ( KPTrieIndexHdr_v3 ),
-                addr, num_to_read, & num_read );
-            if ( rc != 0 )
-                free ( addr );
-            else if ( num_read != num_to_read )
-            {
-                free ( addr );
-                rc = RC ( rcDB, rcIndex, rcPersisting, rcHeader, rcInsufficient );
-            }
-        }
-    }
-
-    if ( rc == 0 )
-    {
-        size_t num_writ;
-        /* inflate the PTrie */
-        PTrie *tt;
-#if KDBINDEXVERS > 3
-        rc = PTrieMake ( & tt, addr, pb -> ptt_size, self -> pt . byteswap );
-#else
-        rc = PTrieMakeOrig ( & tt, addr, pb -> ptt_size, self -> pt . byteswap );
-#endif
-        if ( rc == 0 )
-        {
-            uint32_t *ord2node;
-            assert ( pb -> ptt_size == PTrieSize ( tt ) );
-            assert ( self -> count >= PTrieCount ( tt ) );
-            ord2node = ( void* ) ( ( char* ) addr + pb -> ptt_size );
-            assert ( ( ( size_t ) ord2node & 3 ) == 0 );
-            
-            /* set count */
-            * ord2node ++ = self -> count;
-
-            if ( ! is_sparse )
-                rc = KTrieIndexPersistProjContig_v2 ( self, pb, tt, ord2node );
-            else
-            {
-                bitsz_t psize;
-                rc = KTrieIndexPersistProjSparse_v2 ( self, pb, tt, ord2node, & psize );
-                if ( rc == 0 )
-                {
-                    map_size -= ( size_t ) self -> count << 3;
-                    map_size += ( psize + 7 ) >> 3;
-                }
-            }
-
-            /* done with pttree */
-            PTrieWhack ( tt );
-
-            if ( rc == 0 )
-            {
-                rc = KFileWrite ( pb -> f, file_size, 
-                     ( uint8_t* ) addr + num_to_read,  map_size - num_to_read, & num_writ );
-
-                if ( rc == 0  &&  num_writ != map_size - num_to_read )
-                    rc = RC ( rcDB, rcIndex, rcPersisting, rcHeader, rcInsufficient );
-            }
-        }
-
-        free ( addr );
-    }
-
-    return rc;
-}
-
-#endif
-
-static
-rc_t KTrieIndexCreateMD5Wrapper ( KDirectory *dir, KFile ** fp, KMD5File ** wrapper,
-    char relpath [ 256 ], const char md5_relpath [ 260 ] )
-{
-    /* create the md5 file for read/write */
-    KFile *f;
-    rc_t rc = KDirectoryVCreateFile ( dir, & f, true,
-        0664, kcmInit, md5_relpath, NULL );
-    if ( rc == 0 )
-    {
-        /* create an md5sum formatter */
-        KMD5SumFmt *fmt;
-        rc = KMD5SumFmtMakeUpdate ( & fmt, f );
-        if ( rc == 0 )
-        {
-            int dot_pos;
-
-            /* convert relative path to a leaf */
-            char *leaf = strrchr ( relpath, '/' );
-            if ( leaf ++ == NULL )
-                leaf = relpath;
-
-            /* trim off ".tmp" from "leaf"
-               so that the format string reflects final name
-               without the need to rename later */
-            dot_pos = strlen ( leaf ) - 4;
-            assert ( dot_pos > 0 );
-            assert ( strcmp ( & leaf [ dot_pos ], ".tmp" ) == 0 );
-            leaf [ dot_pos ] = 0;
-
-            /* "fmt" now owns "f" */
-            f = NULL;
-
-            /* create a file wrapper that calculates and prints md5 */
-            rc = KMD5FileMakeWrite ( wrapper, * fp, fmt, leaf );
-
-            /* "wrapper" attaches a reference to "fmt", so we have to
-               dump our reference regardless of "rc" */
-            KMD5SumFmtRelease ( fmt );
-
-            /* restore dot */
-            leaf [ dot_pos ] = '.';
-
-            /* if we succeeded, swap the "wrapper" for input file */
-            if ( rc == 0 )
-            {
-                * fp = KMD5FileToKFile ( * wrapper );
-                return 0;
-            }
-        }
-
-        /* failed */
-        KFileRelease ( f );
-    }
-
-    return rc;
-}
-
-rc_t KTrieIndexPersist_v2 ( const KTrieIndex_v2 *self,
-    bool proj, KDirectory *dir, const char *path, bool use_md5 )
-{
-    rc_t rc;
-    PersistTrieData pb;
-
-    assert ( self != NULL );
-    if ( self -> count == 0 )
-        return 0;
-
-    pb . fmd5 = NULL;
-
-    /** Trie may have holes in serialization due to memory alignments ***/
-    pb . buffer = calloc ( pb . bsize = 32 * 1024, 1 );
-    if ( pb . buffer == NULL )
-        rc = RC ( rcDB, rcIndex, rcPersisting, rcMemory, rcExhausted );
-    else
-    {
-        /* determine the name of the file:
-           it is created under a temporary name
-           relative to the directory provided */
-        char tmpname [ 256 ];
-        rc = KDirectoryResolvePath ( dir, false,
-            tmpname, sizeof tmpname, "%s.tmp", path );
-        if ( rc == 0 )
-        {
-            /* create the name of temporary md5 file */
-            char tmpmd5name [ 260 ];
-            sprintf ( tmpmd5name, "%s.md5", tmpname );
-
-            /* create the output file under temporary name
-               ? why does it need read/write capabilities? */
-            rc = KDirectoryVCreateFile ( dir, & pb . f,
-                true, 0664, kcmInit, tmpname, NULL );
-            if ( rc == 0 )
-            {
-                /* if using md5, wrap output file */
-                if ( use_md5 )
-                    rc = KTrieIndexCreateMD5Wrapper ( dir, & pb . f, & pb . fmd5, tmpname, tmpmd5name );
-                if ( rc == 0 )
-                {
-                    /* initial size */
-                    pb . ptt_size = 0;
-#if KDBINDEXVERS == 2
-                    KTrieIndexPersistHdr_v2 ( ( KTrieIndex_v2* ) self, & pb );
-#else
-                    KTrieIndexPersistHdr_v3_v4 ( ( KTrieIndex_v2* ) self, & pb );
-#endif
-
-                    /* persist tree */
-                    rc = KTrieIndexPersistTrie_v2 ( self, & pb );
-                    if ( rc == 0 )
-                    {
-                        /* persist projection table */
-                        if ( proj )
-                        {
-#if KDBINDEXVERS == 2
-                            rc = KTrieIndexPersistProj_v2 ( self, & pb );
-#else
-                            rc = KTrieIndexPersistProj_v3 ( self, & pb );
-#endif
-                        }
-                    }
-                }
-                    
-                /* close down the file now, success or not */
-                KFileRelease ( pb . f );
-                pb . f = NULL;
-
-                /* douse buffer and mark NULL in case of later attempt */
-                free ( pb . buffer );
-                pb . buffer = NULL;
-
-                /* rename the files on success */
-                if ( rc == 0 )
-                {
-                    /* works even if "path" is absolute */
-                    rc = KDirectoryRename ( dir, false, tmpname, path );                        
-                    if ( rc == 0 )
-                    {
-                        int tmplen;
-
-                        /* done if this was the only file to rename */
-                        if ( ! use_md5 )
-                            return 0;
-
-                        /* use "tmpname" as a real "md5" name */
-                        tmplen = strlen ( tmpname );
-                        assert ( strcmp ( & tmpname [ tmplen - 4 ], ".tmp" ) == 0 );
-                        strcpy ( & tmpname [ tmplen - 3 ], "md5" );
-
-                        /* rename md5 file and be done on success */
-                        rc = KDirectoryRename ( dir, false, tmpmd5name, tmpname );
-                        if ( rc == 0 )
-                            return 0;
-
-                        /* failure here means we have a good index file,
-                           but a bad md5 file, so convert "tmpname" to the
-                           actual name of the index file */
-                        tmpname [ tmplen - 4 ] = 0;
-                    }
-                }
-
-                /* failed, remove the output files here */
-                KDirectoryVRemove ( dir, false, tmpname, NULL );
-                if ( use_md5 )
-                    KDirectoryVRemove ( dir, false, tmpmd5name, NULL );
-            }
-        }
-
-        /* douse buffer */
-        free ( pb . buffer );
-    }
-    
-    return rc;
-}
-
-
-/* whack whack */
-void KTrieIndexWhack_v2 ( KTrieIndex_v2 *self )
-{
-    KPTrieIndexWhack_v2 ( & self -> pt );
-    TrieWhack ( & self -> key2id, KTrieIdxNodeWhack_v2, NULL );
-    free ( self -> ord2node );
-}
-
-/* initialize an index from file - can be NULL */
-rc_t KTrieIndexOpen_v2 ( KTrieIndex_v2 *self, const KMMap *mm, bool byteswap )
-{
-    rc_t rc;
-    bool ptorig = false;
-    const KDBHdr *hdr = NULL;
-
-#if ! KTRIE_ZEROS_KPTRIE
-#error "KTrie is supposed to zero KPTrie"
-#endif
-    memset ( self, 0, sizeof * self );
-    self -> pt . byteswap = byteswap;
-
-    /* create an empty Trie index,
-       with numeric but auto-expand character set,
-       and a bucket size of 512, beyond which the
-       tree will branch.
-    */
-    rc = TrieInit ( & self -> key2id, "0-9", 512, true );
-    if ( rc != 0 )
-        return rc;
-
-    /* when opened for create, there will be no existing index */
-    if ( mm == NULL )
-        return 0;
-
-    rc = KMMapAddrRead ( mm, (const void**) & hdr );
-    if ( rc != 0 )
-        return rc;
-
-    switch ( hdr -> version )
-    {
-    case 1:
-        rc = KPTrieIndexInitFromV1_v2 ( & self -> pt, mm, byteswap );
-        break;
-    case 2:
-        rc = KPTrieIndexInit_v2 ( & self -> pt, mm, byteswap );
-        break;
-    case 3:
-        ptorig = true;
-    case 4:
-        rc = KPTrieIndexInit_v3_v4 ( & self -> pt, mm, byteswap, ptorig );
-        break;
-    default:
-        rc = RC(rcDB, rcIndex, rcConstructing, rcIndex, rcBadVersion);
-    }
-    /* open the prior index in persisted mode, but
-       don't load it into the core-based Trie */
-    if ( rc == 0 )
-    {
-        /* the file existed but was empty */
-        if ( self -> pt . key2id == NULL )
-        {
-            self -> pt . mm = NULL;
-            return 0;
-        }
-
-        /* retain a reference to memory map */
-        rc = KMMapAddRef ( mm );
-        if ( rc == 0 )
-        {
-            self -> pt . mm = mm;
-            return 0;
-        }
-
-        /* self -> pt gets whacked below */
-    }
-
-    KTrieIndexWhack_v2 ( self );
-    return rc;
-}
-
-/* KTrieIndexPopulate_v2
- */
-typedef struct KTrieIndexPopulateData_v2_s2 KTrieIndexPopulateData_v2_s2;
-struct KTrieIndexPopulateData_v2_s2
-{
-    int64_t first;
-
-    KTrieIndex_v2 *self;
-    uint32_t count;
-    rc_t rc;
-
-    uint8_t id_bits;
-    uint8_t span_bits;
-};
-
-static
-bool CC KTrieIndexPopulate_v2_s2 ( PTNode *n, void *data )
-{
-    const String *key;
-    KTrieIndexPopulateData_v2_s2 *pb = data;
-
-    int64_t id;
-    size_t usize;
-    uint32_t span;
-
-    /* capture node data */
-    assert ( n -> data . size == sizeof id );
-    pb -> rc = Unpack ( pb -> id_bits, sizeof id * 8,
-        n -> data . addr, 0, pb -> id_bits, NULL, & id, sizeof id, & usize );
-    if ( pb -> rc == 0 )
-    {
-        pb -> rc = Unpack ( pb -> span_bits, sizeof span * 8,
-            n -> data . addr, pb -> id_bits, pb -> span_bits, NULL, & span, sizeof span, & usize );
-    }
-    if ( pb -> rc != 0 )
-        return true;
-
-    pb -> rc = PTNodeMakeKey ( n, & key );
-    if ( pb -> rc == 0 )
-    {
-        KTrieIdxNode_v2_s2 *node;
-        pb -> rc = KTrieIdxNodeMake_v2_s2 ( & node, key, id + pb -> first );
-        StringWhack ( ( String* ) key );
-        if ( pb -> rc == 0 )
-        {
-            node -> span = span;
-
-            pb -> rc = TrieInsert ( & pb -> self -> key2id, & node -> n );
-            if ( pb -> rc == 0 )
-            {
-                ++ pb -> count;
-                return false;
-            }
-
-            KTrieIdxNodeWhack_v2 ( & node -> n, NULL );
-        }
-    }
-
-    return true;
-}
-
-/* KTrieIndexAttach_v2
- *  attach a keymap to an existing table
- */
-static
-rc_t KTrieIndexPopulate_v2_s1 ( KTrieIndex_v2 *self, uint32_t i, int64_t idd )
-{
-    rc_t rc;
-    uint32_t nid = self -> pt . ord2node [ i ];
-
-    if ( i != 0 && self -> pt . ord2node [ i - 1 ] == nid )
-        return 0;
-
-    i = self -> count;
-
-    if ( nid == 0 )
-    {
-        rc = KTrieIdxNodeMakeHole_v2_s1 ( & self -> ord2node [ i ], self -> pt . first + idd );
-        if ( rc == 0 )
-            self -> count = i + 1;
-    }
-    else
-    {
-        PTNode pnode;
-        rc = PTrieGetNode ( self -> pt . key2id, & pnode, nid );
-        if ( rc == 0 )
-        {
-            const String *key;
-            rc = PTNodeMakeKey ( & pnode, & key );
-            if ( rc == 0 )
-            {
-                rc = KTrieIdxNodeMake_v2_s1 ( & self -> ord2node [ i ],
-                    key, self -> pt . first + idd );
-                StringWhack ( ( String* ) key );
-                if ( rc == 0 )
-                {
-                    rc = TrieInsert ( & self -> key2id, & self -> ord2node [ i ] -> n );
-                    if ( rc != 0 )
-                        KTrieIdxNodeWhack_v2 ( & self -> ord2node [ i ] -> n, NULL );
-                    else
-                        self -> count = i + 1;
-                }
-            }
-        }
-    }
-
-    return rc;
-}
-
-rc_t KTrieIndexAttach_v2 ( KTrieIndex_v2 *self, bool proj )
-{
-    rc_t rc = 0;
-
-    /* if persisted index is empty, bail */
-    if ( self -> count != 0 || self -> pt . count == 0 )
-        return 0;
-
-    /* see if we can use existing projection index */
-    if ( proj && self -> pt . ord2node != NULL )
-    {
-        uint32_t i;
-
-        self -> ord2node =
-            malloc ( ( ( self -> pt . count + 4095 ) & ~ 4095 ) * sizeof self -> ord2node [ 0 ] );
-        if ( self -> ord2node == NULL )
-            return RC ( rcDB, rcIndex, rcUpdating, rcMemory, rcExhausted );
-
-        /* we were called because our count is 0 */
-        assert ( self -> count == 0 );
-
-        /* handle variant */
-        assert ( self -> pt . variant == 0 || self -> pt . id2ord . v8 != NULL );
-        switch ( self -> pt . variant )
-        {
-        case 0:  /* 1-1 id to name */
-            for ( rc = 0, i = 0; i < self -> pt . count && rc == 0; ++ i )
-                rc = KTrieIndexPopulate_v2_s1 ( self, i, i );
-            break;
-        case 1:  /* sparse 8-bit   */
-            for ( rc = 0, i = 0; i < self -> pt . count && rc == 0; ++ i )
-                rc = KTrieIndexPopulate_v2_s1 ( self, i, self -> pt . id2ord . v8 [ i ] );
-            break;
-        case 2:  /* sparse 16-bit  */
-            for ( rc = 0, i = 0; i < self -> pt . count && rc == 0; ++ i )
-                rc = KTrieIndexPopulate_v2_s1 ( self, i, self -> pt . id2ord . v16 [ i ] );
-            break;
-        case 3:  /* sparse 32-bit  */
-            for ( rc = 0, i = 0; i < self -> pt . count && rc == 0; ++ i )
-                rc = KTrieIndexPopulate_v2_s1 ( self, i, self -> pt . id2ord . v32 [ i ] );
-            break;
-        case 4:  /* sparse 64-bit  */
-            for ( rc = 0, i = 0; i < self -> pt . count && rc == 0; ++ i )
-                rc = KTrieIndexPopulate_v2_s1 ( self, i, self -> pt . id2ord . v64 [ i ] );
-            break;
-        }
-
-        if ( rc != 0 )
-        {
-            for ( i = self -> count; i > 0; )
-                KTrieIdxNodeWhack_v2 ( & self -> ord2node [ -- i ] -> n, NULL );
-            free ( self -> ord2node ), self -> ord2node = NULL;
-            return rc;
-        }
-    }
-    else
-    {
-        KTrieIndexPopulateData_v2_s2 pb;
-        pb . first = self -> pt . first;
-        pb . self = self;
-        pb . count = 0;
-        pb . rc = 0;
-        PTrieDoUntil ( self -> pt . key2id, KTrieIndexPopulate_v2_s2, & pb );
-        if ( pb . rc == 0 && pb . count != self -> pt . count )
-            return RC ( rcDB, rcIndex, rcUpdating, rcIndex, rcCorrupt );
-        self -> count = pb . count;
-    }
-
-    /* record known dimensions */
-    self -> first = self -> pt . first;
-    self -> last = self -> pt . last;
-
-    /* should be able to drop persisted copy now */
-    KPTrieIndexWhack_v2 ( & self -> pt );
-
-    return 0;
-}
-
-rc_t KTrieIndexInsert_v2 ( KTrieIndex_v2 *self,
-    bool proj, const char *str, int64_t id )
-{
-    rc_t rc;
-    String key;
-    void *ord2node;
-    uint32_t count;
-
-#if DISABLE_PROJ
-    proj = false;
-#endif
-
-    /* get the number of nodes in proj index or Trie.
-       the persisted tree is only loaded into the in-core
-       tree for edits ( insert/delete ), so the counts
-       may differ. also, when in projection mode, the
-       count refers to the number of array slots, which
-       can be > the number of Trie nodes if there are
-       holes in the id space. when not projecting, count
-       is exactly the number of nodes in the Trie.
-    */
-    count = self -> count;
-
-    /* detect first modification */
-    if ( self -> count == 0 )
-    {
-        /* detect persisted data */
-        if ( self -> pt . key2id != NULL )
-        {
-            /* load persisted data into core */
-            rc = KTrieIndexAttach_v2 ( self, proj );
-            if ( rc != 0 )
-                return rc;
-
-            /* should have loaded everything */
-            assert ( self -> count != 0 );
-            count = self -> count;
-        }
-    }
-
-    /* v2 only allows increasing ids
-       they don't have to be contiguous,
-       but they cannot repeat and cannot decrease */
-    else if ( id <= self -> last )
-        return RC ( rcDB, rcIndex, rcInserting, rcConstraint, rcViolated );
-
-    /* convert key to String */
-    StringInitCString ( & key, str );
-
-    /* insertion strategy depends upon projection index */
-    if ( proj )
-    {
-        KTrieIdxNode_v2_s1 *node;
-
-        /* check for extension of last node */
-        if ( count != 0 )
-        {
-            /* a non-zero count implies nodes in projection array */
-            assert ( self -> ord2node != NULL );
-
-            /* get last node */
-            node = self -> ord2node [ count - 1 ];
-            assert ( node != NULL );
-
-            /* if the keys match, this is an update to the node */
-            if ( StringEqual ( & key, & node -> n . key ) )
-            {
-                /* this must be an extension of range */
-                if ( id != self -> last + 1 )
-                    return RC ( rcDB, rcIndex, rcInserting, rcConstraint, rcViolated );
-
-                /* extend and done */
-                self -> last = id;
-                return 0;
-            }
-
-            /* not last node - create a hole if needed */
-            if ( id != self -> last + 1 )
-            {
-                /* extend array if needed
-                   should never have to handle initial insert,
-                   but would be happy to do so if asked */
-                if ( ( count & 4095 ) == 0 )
-                {
-                    ord2node = realloc ( self -> ord2node,
-                        ( count + 4096 ) * sizeof self -> ord2node [ 0 ] );
-                    if ( ord2node == NULL )
-                        return RC ( rcDB, rcIndex, rcInserting, rcMemory, rcExhausted );
-                    self -> ord2node = ord2node;
-                }
-
-                /* create NULL mapping */
-                rc = KTrieIdxNodeMakeHole_v2_s1 ( & node, self -> last + 1 );
-                if ( rc != 0 )
-                    return rc;
-
-                /* NB - this will cause count to be > num_nodes in Trie */
-                self -> ord2node [ count ++ ] = node;
-            }
-        }
-
-        /* make a new mapping starting with id */
-        rc = KTrieIdxNodeMake_v2_s1 ( & node, & key, id );
-        if ( rc == 0 )
-        {
-            /* attempt insertion */
-            rc = TrieInsertUnique ( & self -> key2id, & node -> n, NULL );
-            if ( rc == 0 )
-            {
-                /* create or extend projection array */
-                if ( ( count & 4095 ) == 0 )
-                {
-                    ord2node = realloc ( self -> ord2node,
-                        ( count + 4096 ) * sizeof self -> ord2node [ 0 ] );
-                    if ( ord2node == NULL )
-                        rc = RC ( rcDB, rcIndex, rcInserting, rcMemory, rcExhausted );
-                    else
-                        self -> ord2node = ord2node;
-                }
-
-                if ( rc == 0 )
-                {
-                    /* set/extend range, detecting first insertion */
-                    self -> last = id;
-                    if ( count == 0 )
-                        self -> first = id;
-
-                    /* project */
-                    self -> ord2node [ count ] = node;
-                    self -> count = count + 1;
-
-                    /* insertion complete */
-                    return 0;
-                }
-
-                /* remove failed insertion */
-                TrieUnlink ( & self -> key2id, & node -> n );
-            }
-
-            /* clean up new node */
-            KTrieIdxNodeWhack_v2 ( & node -> n, NULL );
-        }
-
-        /* clean up insertion of hole */
-        if ( count != self -> count )
-        {
-            assert ( count - 1 == self -> count );
-            KTrieIdxNodeWhack_v2 ( & self -> ord2node [ count - 1 ] -> n, NULL );
-        }
-    }
-    else
-    {
-        KTrieIdxNode_v2_s2 *node;
-
-        /* make a new mapping starting with id and a span of 1 */
-        rc = KTrieIdxNodeMake_v2_s2 ( & node, & key, id );
-        if ( rc == 0 )
-        {
-            /* attempt insertion */
-            KTrieIdxNode_v2_s2 *exist;
-            rc = TrieInsertUnique ( & self -> key2id, & node -> n, ( TNode** ) & exist );
-            if ( rc == 0 )
-            {
-                /* set/extend range, detecting first insertion */
-                if ( count == 0 )
-                {
-                    self -> max_span = 1;
-                    self -> first = id;
-                }
-                self -> last = id;
-
-                /* insertion complete */
-                self -> count = count + 1;
-                return 0;
-            }
-
-            /* clean up new node */
-            KTrieIdxNodeWhack_v2 ( & node -> n, NULL );
-
-            /* check existing for proper extension */
-            if ( exist != NULL )
-            {
-                if ( id == exist -> start_id + exist -> span )
-                {
-                    assert ( count != 0 );
-
-                    /* we already know id > last
-                       and that it boarders the range of "exist"
-                       so it must be last + 1 */
-                    assert ( id - 1 == self -> last );
-                    self -> last = id;
-
-                    /* extend the span of "exist" */
-                    ++ exist -> span;
-                    if ( exist -> span > self -> max_span )
-                        self -> max_span = exist -> span;
-
-                    return 0;
-                }
-            }
-        }
-    }
-
-    return rc;
-}
-
-/* drop string from trie and all mappings */
-rc_t KTrieIndexDelete_v2 ( KTrieIndex_v2 *self, bool proj, const char *str )
-{
-    rc_t rc;
-    String key;
-    TNode *tnode;
-    uint32_t count;
-
-#if DISABLE_PROJ
-    proj = false;
-#endif
-
-    /* detect first modification */
-    count = self -> count;
-    if ( self -> count != 0 )
-    {
-        /* detect persisted data */
-        if ( self -> pt . key2id != NULL )
-        {
-            rc = KTrieIndexAttach_v2 ( self, proj );
-            if ( rc != 0 )
-                return rc;
-        }
-    }
-
-    StringInitCString ( & key, str );
-
-    /* interface states that all objects are dropped.
-       however, this implementation only allows unique
-       mappings to a contig range, so a simple find is sufficient */
-    tnode = TrieFind ( & self -> key2id, & key );
-    if ( tnode == NULL )
-        return RC ( rcDB, rcIndex, rcRemoving, rcString, rcNotFound );
-
-    /* remove from trie */
-    TrieUnlink ( & self -> key2id, tnode );
-
-    /* neutralize node in projection index */
-    if ( proj )
-    {
-        KTrieIdxNode_v2_s1 *node = ( KTrieIdxNode_v2_s1* ) tnode;
-        uint32_t ord = KTrieIndexNode2Ord_v2 ( self, node );
-        if ( ord != 0 )
-        {
-            self -> ord2node [ ord - 1 ] -> n . key . size = 0;
-            self -> ord2node [ ord - 1 ] -> n . key . len = 0;
-            self -> ord2node [ ord - 1 ] -> key [ 0 ] = 0;
-            return 0;
-        }
-    }
-
-    /* whack node */
-    KTrieIdxNodeWhack_v2 ( tnode, NULL );
-
-    return 0;
-}
-
-/* map key to id range */
-rc_t KTrieIndexFind_v2 ( const KTrieIndex_v2 *self,
-    const char *str, int64_t *start_id,
-#if V2FIND_RETURNS_SPAN
-    uint32_t *span,
-#endif
-    int ( CC * custom_cmp ) ( const void *item, const PBSTNode *n, void *data ), void *data, bool convertFromV1 )
-{
-    /* search within in-core index */
-    if ( self -> count != 0 )
-    {
-        const TNode *tnode;
-
-        String key;
-        StringInitCString ( & key, str );
-
-        tnode = TrieFind ( & self -> key2id, & key );
-        if ( tnode != NULL )
-        {
-            if ( self -> ord2node != NULL )
-            {
-                const KTrieIdxNode_v2_s1 *node = ( const KTrieIdxNode_v2_s1* ) tnode;
-                uint32_t ord = KTrieIndexNode2Ord_v2 ( self, node );
-                if ( ord == 0 )
-                    return RC ( rcDB, rcIndex, rcSelecting, rcIndex, rcCorrupt );
-
-                * start_id = node -> start_id;
-#if V2FIND_RETURNS_SPAN
-                if ( ord == self -> count )
-                    * span = ( uint32_t ) ( self -> last - node -> start_id + 1 );
-                else
-                    * span = ( uint32_t ) ( self -> ord2node [ ord ] -> start_id - node -> start_id );
-#endif
-            }
-            else
-            {
-                const KTrieIdxNode_v2_s2 *node = ( const KTrieIdxNode_v2_s2* ) tnode;
-                * start_id = node -> start_id;
-#if V2FIND_RETURNS_SPAN
-                * span = node -> span;
-#endif
-            }
-
-            return 0;
-        }
-    }
-
-    /* search within persisted index */
-    else if ( self -> pt . key2id != NULL )
-    {
-        return KPTrieIndexFind_v2 ( & self -> pt, str, start_id,
-#if V2FIND_RETURNS_SPAN
-                                    span,
-#endif
-                                    custom_cmp, data, convertFromV1 );
-    }
-
-    return RC ( rcDB, rcIndex, rcSelecting, rcString, rcNotFound );
-}
-
-/* projection index id to key-string */
-typedef struct KTrieIndexProjectData_v2 KTrieIndexProjectData_v2;
-struct KTrieIndexProjectData_v2
-{
-    int64_t id;
-    const KTrieIdxNode_v2_s2 *node;
-};
-
-static
-bool CC KTrieIndexProjectScan_v2 ( TNode *n, void *data )
-{
-    KTrieIndexProjectData_v2 *pb = (KTrieIndexProjectData_v2 *)data;
-    const KTrieIdxNode_v2_s2 *node = ( const KTrieIdxNode_v2_s2* ) n;
-
-    if ( pb -> id >= node -> start_id &&
-         pb -> id < node -> start_id + node -> span )
-    {
-        pb -> node = node;
-        return true;
-    }
-
-    return false;
-}
-
-rc_t KTrieIndexProject_v2 ( const KTrieIndex_v2 *self,
-    int64_t id,
-#if V2FIND_RETURNS_SPAN
-     int64_t *start_id, uint32_t *span,
-#endif
-    char *key_buff, size_t buff_size, size_t *actsize )
-{
-    if ( self -> count != 0 )
-    {
-        if ( self -> ord2node != NULL )
-        {
-            uint32_t ord = KTrieIndexID2Ord_v2 ( self, id );
-            if ( ord != 0 )
-            {
-                const KTrieIdxNode_v2_s1 *node = self -> ord2node [ ord - 1 ];
-                
-                if (actsize)
-                    *actsize = node -> n . key . size;
-                if ( node -> n . key . size >= buff_size )
-                    return RC ( rcDB, rcIndex, rcProjecting, rcBuffer, rcInsufficient );
-                string_copy ( key_buff, buff_size,
-                    node -> n . key . addr, node -> n . key . size );
-                * start_id = node -> start_id;
-                * span = ( ( ord == self -> count ) ?
-                    ( self -> last + 1 ) : ( self -> ord2node [ ord ] -> start_id ) ) - node -> start_id;
-                return 0;
-            }
-        }
-        else
-        {
-            KTrieIndexProjectData_v2 pb;
-            pb . id = id;
-            if ( TrieDoUntil ( & self -> key2id, KTrieIndexProjectScan_v2, & pb ) )
-            {
-                const KTrieIdxNode_v2_s2 *node = pb . node;
-                
-                if (actsize)
-                    *actsize = node -> n . key . size;
-                if ( node -> n . key . size >= buff_size )
-                    return RC ( rcDB, rcIndex, rcProjecting, rcBuffer, rcInsufficient );
-                string_copy ( key_buff, buff_size,
-                    node -> n . key . addr, node -> n . key . size );
-                * start_id = node -> start_id;
-                * span = node -> span;
-                return 0;
-            }
-        }
-    }
-
-    else if ( self -> pt . ord2node != NULL )
-    {
-        return KPTrieIndexProject_v2 ( & self -> pt, id,
-#if V2FIND_RETURNS_SPAN
-            start_id, span,
-#endif
-            key_buff, buff_size, actsize );
-    }
-
-    return RC ( rcDB, rcIndex, rcProjecting, rcId, rcNotFound );
-}
diff --git a/libs/kdb/wu64idx-v3.c b/libs/kdb/wu64idx-v3.c
deleted file mode 100644
index dd39415..0000000
--- a/libs/kdb/wu64idx-v3.c
+++ /dev/null
@@ -1,416 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kdb/extern.h>
-
-#include "windex-priv.h"
-
-#include <kdb/index.h>
-#include <kfs/directory.h>
-#include <kfs/file.h>
-#include <kfs/md5.h>
-#include <kfs/mmap.h>
-#include <klib/pbstree.h>
-#include <klib/rc.h>
-#include <os-native.h>
-#include <sysalloc.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-typedef struct KU64Index_PNode_struct {
-    uint64_t key;
-    uint64_t key_size;
-    int64_t id;
-    uint64_t id_qty;
-} KU64Index_PNode;
-
-typedef struct KU64Index_Node_struct {
-    BSTNode node;
-    uint64_t key;
-    uint64_t key_size;
-    int64_t id;
-    uint64_t id_qty;
-} KU64Index_Node;
-
-static
-int CC KU64Index_NodeSort( const BSTNode *item, const BSTNode *node )
-{
-    const KU64Index_Node* i = (const KU64Index_Node*)item;
-    const KU64Index_Node* n = (const KU64Index_Node*)node;
-
-    if( i->key < n->key ) {
-        return -1;
-    } else if( i->key > n->key ) {
-        return 1;
-    }
-    return 0;
-}
-
-static
-int CC KU64Index_NodeSortUnique( const BSTNode *item, const BSTNode *node )
-{
-    const KU64Index_Node* i = (const KU64Index_Node*)item;
-    const KU64Index_Node* n = (const KU64Index_Node*)node;
-
-    if( (i->key + i->key_size - 1) < n->key ) {
-        return -1;
-    } else if( i->key > (n->key + n->key_size - 1) ) {
-        return 1;
-    }
-    return 0;
-}
-
-static
-bool CC KU64Index_UnrollPersisted( PBSTNode *n, void *data )
-{
-    KU64Index_v3* self = data;
-    const KU64Index_PNode* pn = n->data.addr;
-
-    KU64Index_Node* node = calloc(1, sizeof(KU64Index_Node));
-    if( node == NULL ) {
-        self->rc = RC(rcExe, rcNode, rcConstructing, rcMemory, rcInsufficient);
-    } else {
-        node->key = pn->key;
-        node->key_size = pn->key_size;
-        node->id = pn->id;
-        node->id_qty = pn->id_qty;
-        self->rc = BSTreeInsert(&self->tree, &node->node, KU64Index_NodeSort);
-    }
-    if( self->rc != 0 ) {
-        free(node);
-    }
-    return self->rc == 0 ? false : true;
-}
-
-rc_t KU64IndexOpen_v3(KU64Index_v3* self, struct KMMap const *mm, bool byteswap)
-{
-    rc_t rc = 0;
-    const char* maddr;
-    size_t msize;
-    PBSTree* ptree = NULL;
-
-    self->rc = 0;
-    BSTreeInit(&self->tree);
-
-    /* when opened for create, there will be no existing index */
-    if( mm == NULL ) {
-        return 0;
-    }
-
-    /* open the prior index in persisted mode */
-    rc = KMMapAddrRead(mm, (const void**)&maddr);
-    if( rc != 0 ) {
-        return rc;
-    }
-    rc = KMMapSize(mm, &msize);
-    if( rc != 0 ) {
-        return rc;
-    }
-    if( msize <= sizeof(struct KIndexFileHeader_v3) ) {
-        return 0;
-    }
-
-    rc = PBSTreeMake(&ptree, (const void**)(maddr + sizeof(struct KIndexFileHeader_v3)),
-                     msize - sizeof(struct KIndexFileHeader_v3), byteswap);
-    if( rc != 0 ) {
-        return rc;
-    }
-
-    PBSTreeDoUntil(ptree, false, KU64Index_UnrollPersisted, self);
-    rc = self->rc;
-
-    PBSTreeWhack(ptree);
-
-    if( rc != 0 ) {
-        KU64IndexWhack_v3(self);
-    }
-    return rc;
-}
-
-static
-void CC KU64Index_WhackBSTree( BSTNode *n, void *data )
-{
-    free((KU64Index_Node*)n);
-}
-
-rc_t KU64IndexWhack_v3(KU64Index_v3* self)
-{
-    self->rc = 0;
-    BSTreeWhack(&self->tree, KU64Index_WhackBSTree, NULL);
-    return 0;
-}
-
-rc_t KU64IndexInsert_v3(KU64Index_v3* self, bool unique, uint64_t key, uint64_t key_size, int64_t id, uint64_t id_qty)
-{
-    KU64Index_Node* node = calloc(1, sizeof(KU64Index_Node));
-    self->rc = 0;
-
-    if( node == NULL ) {
-        self->rc = RC(rcExe, rcNode, rcConstructing, rcMemory, rcInsufficient);
-    } else {
-        node->key = key;
-        node->key_size = key_size;
-        node->id = id;
-        node->id_qty = id_qty;
-        if( unique ) {
-            self->rc = BSTreeInsertUnique(&self->tree, &node->node, NULL, KU64Index_NodeSortUnique);
-        } else {
-            self->rc = BSTreeInsert(&self->tree, &node->node, KU64Index_NodeSort);
-        }
-    }
-    if( self->rc != 0 ) {
-        free(node);
-    }
-    return self->rc;
-}
-
-static
-int CC KU64Index_Cmp4Delete( const void *item, const BSTNode *node )
-{
-    const KU64Index_Node* i = (const KU64Index_Node*)item;
-    const KU64Index_Node* n = (const KU64Index_Node*)node;
-
-    if( i->key < n->key ) {
-        return -1;
-    } else if( i->key > n->key ) {
-        return 1;
-    }
-    return 0;
-}
-
-rc_t KU64IndexDelete_v3(KU64Index_v3* self, uint64_t key)
-{
-    KU64Index_Node node;
-    BSTNode* n = NULL;
-
-    self->rc = 0;
-    node.key = key;
-    n = BSTreeFind(&self->tree, &node, KU64Index_Cmp4Delete);
-    if( n != NULL ) {
-        if( !BSTreeUnlink(&self->tree, n) ) {
-            self->rc = RC(rcDB, rcIndex, rcDestroying, rcId, rcCorrupt);
-        }
-    } else {
-        self->rc = RC(rcDB, rcIndex, rcDestroying, rcId, rcNotFound);
-    }
-    return self->rc;
-}
-
-typedef struct KU64Index_PersistData_struct
-{
-    uint64_t pos;
-    KFile *file;
-    KMD5File *file_md5;
-} KU64Index_PersistData;
-
-static
-rc_t CC KU64Index_WriteFunc( void *param, const void *buffer, size_t size, size_t *num_writ )
-{
-    KU64Index_PersistData* pd = param;
-    rc_t rc = KFileWrite(pd->file, pd->pos, buffer, size, num_writ);
-    pd->pos += *num_writ;
-    return rc;
-}
-
-static
-rc_t CC KU64Index_AuxFunc(void *param, const void *node, size_t *num_writ, PTWriteFunc write, void *write_param )
-{
-    rc_t rc = 0;
-    const KU64Index_Node* n = (const KU64Index_Node*)node;
-    int sz = sizeof(KU64Index_Node) - sizeof(BSTNode);
-
-    if( write != NULL ) {
-        rc = (*write)(write_param, &n->key, sz, num_writ);
-    } else {
-        *num_writ = sz;
-    }
-    return rc;
-}
-
-rc_t KU64IndexPersist_v3(KU64Index_v3* self, bool proj, KDirectory *dir, const char *path, bool use_md5)
-{
-    KU64Index_PersistData pd;
-    char tmpname[256];
-    char tmpmd5name[256];
-    char md5path[256];
-
-    self->rc = 0;
-    memset(&pd, 0, sizeof(KU64Index_PersistData));
-
-    self->rc = KDirectoryResolvePath(dir, false, tmpname, sizeof(tmpname), "%s.tmp", path);
-
-    if( self->rc == 0 ) {
-        self->rc = KDirectoryVCreateFile(dir, &pd.file, true, 0664, kcmInit, tmpname, NULL);
-
-        if(use_md5 && self->rc == 0 ) {
-
-            KMD5SumFmt *km = NULL;
-            size_t tmplen = snprintf(tmpmd5name, sizeof(tmpmd5name), "%s.md5", tmpname);
-            KFile* kf = NULL;
-
-            if( tmplen >= sizeof(tmpmd5name) ) {
-                self->rc = RC(rcDB, rcIndex, rcPersisting, rcName, rcExcessive);
-            } else {
-
-                tmplen = snprintf(md5path, sizeof(md5path), "%s.md5", path);
-                if( tmplen >= sizeof(md5path) ) {
-                    self->rc = RC(rcDB, rcIndex, rcPersisting, rcName, rcExcessive);
-                } else {
-
-                    self->rc = KDirectoryVCreateFile(dir, &kf, true, 0664, kcmInit, tmpmd5name, NULL);
-                    if( self->rc == 0 ) {
-                        self->rc = KMD5SumFmtMakeUpdate(&km, kf);
-                        if( self->rc == 0 ) {
-                            KMD5File * k5f;
-                            kf = NULL;
-                            self->rc = KMD5FileMakeWrite(&k5f, pd.file, km, path);
-                            if( self->rc == 0 ) {
-                                pd.file_md5 = k5f;
-                                pd.file = KMD5FileToKFile(k5f);
-                            }
-                            /* release pass or fail */
-                            KMD5SumFmtRelease(km);
-                        } else {
-                            KFileRelease ( kf );
-                        }
-                    } else {
-                        KFileRelease ( kf );
-                    }
-                }
-            }
-            if( self->rc != 0 ) {
-                KFileRelease(pd.file);
-            }
-        }
-
-        if( self->rc == 0 ) {
-            struct KIndexFileHeader_v3 head;
-            size_t writ = 0;
-
-            KDBHdrInit(&head.h, 3);
-            head.index_type = kitU64;
-            self->rc = KFileWrite(pd.file, pd.pos, &head, sizeof(struct KIndexFileHeader_v3), &writ);
-            if( self->rc == 0 ) {
-                pd.pos += writ;
-                if( use_md5 ) {
-                    KMD5FileBeginTransaction(pd.file_md5);
-                }
-                self->rc = BSTreePersist(&self->tree, NULL, KU64Index_WriteFunc, &pd, KU64Index_AuxFunc, &pd);
-            }
-            KFileRelease(pd.file);
-            pd.file = NULL;
-        }
-    }
-
-    if( self->rc == 0 ) {
-        self->rc = KDirectoryRename(dir, false, tmpname, path);
-        if( self->rc == 0 ) {
-            if ( use_md5 ) {
-                self->rc = KDirectoryRename(dir, false, tmpmd5name, md5path);
-            }
-            if( self->rc == 0 ) {
-                /* done */
-                return 0;
-            }
-        }
-    }
-
-    /* whack temporary file */
-    KDirectoryVRemove(dir, false, tmpname, NULL);
-    if( use_md5 ) {
-        KDirectoryVRemove(dir, false, tmpmd5name, NULL);
-    }
-    return self->rc;
-}
-
-typedef struct KU64Index_GrepData_struct {
-    rc_t rc;
-    rc_t (CC*func)(uint64_t key, uint64_t key_size, int64_t id, uint64_t id_qty, void* data);
-    void* data;
-    KU64Index_Node search;
-    uint64_t* key;
-    uint64_t* key_size;
-    int64_t* id;
-    uint64_t* id_qty;
-} KU64Index_GrepData;
-
-/*
- * return true: if found or break DoUntil for FindAll
- */
-static
-bool CC KU64Index_Grep(BSTNode *node, void *data)
-{
-    KU64Index_Node* n = (KU64Index_Node*)node;
-    KU64Index_GrepData* d = data;
-
-    if( d->search.key >= n->key && (d->search.key - n->key) < n->key_size ) {
-        if( d->func ) {
-            d->rc = (*d->func)(n->key, n->key_size, n->id, n->id_qty, d->data);
-            if( d->rc != 0 ) {
-                return true;
-            }
-        } else {
-            *d->key = n->key;
-            *d->key_size = n->key_size;
-            *d->id = n->id;
-            *d->id_qty = n->id_qty;
-            return true;
-        }
-    }
-    return false;
-}
-
-rc_t KU64IndexFind_v3( const KU64Index_v3* self, uint64_t offset, uint64_t* key, uint64_t* key_size, int64_t* id, uint64_t* id_qty )
-{
-    KU64Index_GrepData d;
-
-    memset(&d, 0, sizeof(KU64Index_GrepData));
-    d.search.key = offset;
-    d.key = key;
-    d.key_size = key_size;
-    d.id = id;
-    d.id_qty = id_qty;
-    if( !BSTreeDoUntil(&self->tree, false, KU64Index_Grep, &d) ) {
-        d.rc = RC(rcDB, rcIndex, rcSelecting, rcId, rcNotFound);
-    }
-    return d.rc;
-}
-
-
-rc_t KU64IndexFindAll_v3( const KU64Index_v3* self, uint64_t offset, 
-    rc_t (CC*f)(uint64_t key, uint64_t key_size, int64_t id, uint64_t id_qty, void* data), void* data)
-{
-    KU64Index_GrepData d;
-
-    memset(&d, 0, sizeof(KU64Index_GrepData));
-    d.func = f;
-    d.data = data;
-    d.search.key = offset;
-    BSTreeDoUntil(&self->tree, false, KU64Index_Grep, &d);
-    return d.rc;
-}
diff --git a/libs/kfg/Makefile b/libs/kfg/Makefile
deleted file mode 100644
index f53b060..0000000
--- a/libs/kfg/Makefile
+++ /dev/null
@@ -1,99 +0,0 @@
-# ===========================================================================
-#
-#                            PUBLIC DOMAIN NOTICE
-#               National Center for Biotechnology Information
-#
-#  This software/database is a "United States Government Work" under the
-#  terms of the United States Copyright Act.  It was written as part of
-#  the author's official duties as a United States Government employee and
-#  thus cannot be copyrighted.  This software/database is freely available
-#  to the public for use. The National Library of Medicine and the U.S.
-#  Government have not placed any restriction on its use or reproduction.
-#
-#  Although all reasonable efforts have been taken to ensure the accuracy
-#  and reliability of the software and data, the NLM and the U.S.
-#  Government do not and cannot warrant the performance or results that
-#  may be obtained by using this software or data. The NLM and the U.S.
-#  Government disclaim all warranties, express or implied, including
-#  warranties of performance, merchantability or fitness for any particular
-#  purpose.
-#
-#  Please cite the author in any work or product based on this material.
-#
-# ===========================================================================
-
-default: all
-
-TOP ?= $(shell ../../build/abspath.sh ../..)
-MODULE = libs/kfg
-
-INT_LIBS = \
-	libkfg
-
-ALL_LIBS = \
-	$(INT_LIBS)
-
-include $(TOP)/build/Makefile.env
-
-#-------------------------------------------------------------------------------
-# outer targets
-#
-all std: makedirs
-	@ $(MAKE_CMD) $(TARGDIR)/std
-
-$(INT_LIBS): makedirs
-	@ $(MAKE_CMD) $(ILIBDIR)/$@
-
-.PHONY: all std $(ALL_LIBS)
-
-#-------------------------------------------------------------------------------
-# std
-#
-$(TARGDIR)/std: \
-	$(addprefix $(ILIBDIR)/,$(INT_LIBS))
-
-.PHONY: $(TARGDIR)/std
-
-#-------------------------------------------------------------------------------
-# clean
-#
-clean: stdclean
-
-.PHONY: clean
-
-#-------------------------------------------------------------------------------
-# kfg
-#
-$(ILIBDIR)/libkfg: $(TARGDIR)/default.kfg $(addprefix $(ILIBDIR)/libkfg.,$(ILIBEXT))
-
-$(TARGDIR)/default.kfg: $(NCBIDIR)/default.kfg $(TEST_BINDIR)/ncbi/default.kfg
-
-$(NCBIDIR)/default.kfg: $(SRCDIR)/default.kfg
-	rm -f $(NCBIDIR)/config.kfg
-	cp $^ $@
-
-ifneq ($(NCBIDIR),$(TEST_BINDIR)/ncbi)
-$(TEST_BINDIR)/ncbi/default.kfg: $(SRCDIR)/default.kfg
-	mkdir -p $(TEST_BINDIR)/ncbi
-	cp $^ $@
-endif
-
-KFG_SRC = \
-	config-grammar \
-	config-lex \
-	config \
-	kart \
-	repository \
-	report-kfg \
-    keystore 
-
-KFG_OBJ = \
-	$(addsuffix .$(LOBX),$(KFG_SRC))
-
-KFG_LIB = \
-	-dkfs \
-	-dklib
-
-$(ILIBDIR)/libkfg.$(LIBX): $(INTERM_SRC) $(KFG_OBJ)
-	$(LD) --slib -o $@ $^ $(KFG_LIB)
-
diff --git a/libs/kfg/config-grammar.c b/libs/kfg/config-grammar.c
deleted file mode 100644
index 9f18035..0000000
--- a/libs/kfg/config-grammar.c
+++ /dev/null
@@ -1,1724 +0,0 @@
-/* A Bison parser, made by GNU Bison 2.5.  */
-
-/* Bison implementation for Yacc-like parsers in C
-   
-      Copyright (C) 1984, 1989-1990, 2000-2011 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 3 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, see <http://www.gnu.org/licenses/>.  */
-
-/* As a special exception, you may create a larger work that contains
-   part or all of the Bison parser skeleton and distribute that work
-   under terms of your choice, so long as that work isn't itself a
-   parser generator using the skeleton or a modified version thereof
-   as a parser skeleton.  Alternatively, if you modify or redistribute
-   the parser skeleton itself, you may (at your option) remove this
-   special exception, which will cause the skeleton and the resulting
-   Bison output files to be licensed under the GNU General Public
-   License without this special exception.
-   
-   This special exception was added by the Free Software Foundation in
-   version 2.2 of Bison.  */
-
-/* C LALR(1) parser skeleton written by Richard Stallman, by
-   simplifying the original so-called "semantic" parser.  */
-
-/* All symbols defined below should begin with yy or YY, to avoid
-   infringing on user name space.  This should be done even for local
-   variables, as they might otherwise be expanded by user macros.
-   There are some unavoidable exceptions within include files to
-   define necessary library symbols; they are noted "INFRINGES ON
-   USER NAME SPACE" below.  */
-
-/* Identify Bison output.  */
-#define YYBISON 1
-
-/* Bison version.  */
-#define YYBISON_VERSION "2.5"
-
-/* Skeleton name.  */
-#define YYSKELETON_NAME "yacc.c"
-
-/* Pure parsers.  */
-#define YYPURE 1
-
-/* Push parsers.  */
-#define YYPUSH 0
-
-/* Pull parsers.  */
-#define YYPULL 1
-
-/* Using locations.  */
-#define YYLSP_NEEDED 0
-
-/* Substitute the variable and function names.  */
-#define yyparse         KFG_parse
-#define yylex           KFG_lex
-#define yyerror         KFG_error
-#define yylval          KFG_lval
-#define yychar          KFG_char
-#define yydebug         KFG_debug
-#define yynerrs         KFG_nerrs
-
-
-/* Copy the first part of user declarations.  */
-
-  
-    #include "kfg-parse.h"
-    #include <sysalloc.h>
-    
-    #define YYSTYPE KFGSymbol
-    #include "config-tokens.h"
-        
-    #define KFG_lex KFGScan_yylex
-    
-    /* required parameter to VNamelistMake */
-    #define NAMELIST_ALLOC_BLKSIZE 10
-    
-    static void ReportRc(KFGParseBlock* pb, KFGScanBlock* sb, rc_t rc);
-    static void AppendName(KFGScanBlock* sb, VNamelist*, const KFGParseBlock*);
-
-
-
-/* Enabling traces.  */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
-
-/* Enabling verbose error messages.  */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 0
-#endif
-
-/* Enabling the token table.  */
-#ifndef YYTOKEN_TABLE
-# define YYTOKEN_TABLE 0
-#endif
-
-
-/* Tokens.  */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
-   /* Put the tokens into the symbol table, so that GDB and other debuggers
-      know about them.  */
-   enum yytokentype {
-     kfgEND_INPUT = 0,
-     kfgEND_LINE = 258,
-     kfgUNTERM_STRING = 259,
-     kfgUNTERM_ESCAPED_STRING = 260,
-     kfgUNRECOGNIZED = 261,
-     kfgVAR_REF = 262,
-     kfgUNTERM_VAR_REF = 263,
-     kfgASSIGN = 264,
-     kfgSTRING = 265,
-     kfgESCAPED_STRING = 266,
-     kfgABS_PATH = 267,
-     kfgREL_PATH = 268
-   };
-#endif
-
-
-
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE
-{
-
-
-    KFGParseBlock       pb;
-    const VNamelist*    namelist;
-
-
-
-} YYSTYPE;
-# define YYSTYPE_IS_TRIVIAL 1
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
-# define YYSTYPE_IS_DECLARED 1
-#endif
-
-
-/* Copy the second part of user declarations.  */
-
-
-
-#ifdef short
-# undef short
-#endif
-
-#ifdef YYTYPE_UINT8
-typedef YYTYPE_UINT8 yytype_uint8;
-#else
-typedef unsigned char yytype_uint8;
-#endif
-
-#ifdef YYTYPE_INT8
-typedef YYTYPE_INT8 yytype_int8;
-#elif (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-typedef signed char yytype_int8;
-#else
-typedef short int yytype_int8;
-#endif
-
-#ifdef YYTYPE_UINT16
-typedef YYTYPE_UINT16 yytype_uint16;
-#else
-typedef unsigned short int yytype_uint16;
-#endif
-
-#ifdef YYTYPE_INT16
-typedef YYTYPE_INT16 yytype_int16;
-#else
-typedef short int yytype_int16;
-#endif
-
-#ifndef YYSIZE_T
-# ifdef __SIZE_TYPE__
-#  define YYSIZE_T __SIZE_TYPE__
-# elif defined size_t
-#  define YYSIZE_T size_t
-# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
-#  define YYSIZE_T size_t
-# else
-#  define YYSIZE_T unsigned int
-# endif
-#endif
-
-#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
-
-#ifndef YY_
-# if defined YYENABLE_NLS && YYENABLE_NLS
-#  if ENABLE_NLS
-#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
-#   define YY_(msgid) dgettext ("bison-runtime", msgid)
-#  endif
-# endif
-# ifndef YY_
-#  define YY_(msgid) msgid
-# endif
-#endif
-
-/* Suppress unused-variable warnings by "using" E.  */
-#if ! defined lint || defined __GNUC__
-# define YYUSE(e) ((void) (e))
-#else
-# define YYUSE(e) /* empty */
-#endif
-
-/* Identity function, used to suppress warnings about constant conditions.  */
-#ifndef lint
-# define YYID(n) (n)
-#else
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-static int
-YYID (int yyi)
-#else
-static int
-YYID (yyi)
-    int yyi;
-#endif
-{
-  return yyi;
-}
-#endif
-
-#if ! defined yyoverflow || YYERROR_VERBOSE
-
-/* The parser invokes alloca or malloc; define the necessary symbols.  */
-
-# ifdef YYSTACK_USE_ALLOCA
-#  if YYSTACK_USE_ALLOCA
-#   ifdef __GNUC__
-#    define YYSTACK_ALLOC __builtin_alloca
-#   elif defined __BUILTIN_VA_ARG_INCR
-#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
-#   elif defined _AIX
-#    define YYSTACK_ALLOC __alloca
-#   elif defined _MSC_VER
-#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
-#    define alloca _alloca
-#   else
-#    define YYSTACK_ALLOC alloca
-#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-#     ifndef EXIT_SUCCESS
-#      define EXIT_SUCCESS 0
-#     endif
-#    endif
-#   endif
-#  endif
-# endif
-
-# ifdef YYSTACK_ALLOC
-   /* Pacify GCC's `empty if-body' warning.  */
-#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
-#  ifndef YYSTACK_ALLOC_MAXIMUM
-    /* The OS might guarantee only one guard page at the bottom of the stack,
-       and a page size can be as small as 4096 bytes.  So we cannot safely
-       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
-       to allow for a few compiler-allocated temporary stack slots.  */
-#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
-#  endif
-# else
-#  define YYSTACK_ALLOC YYMALLOC
-#  define YYSTACK_FREE YYFREE
-#  ifndef YYSTACK_ALLOC_MAXIMUM
-#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
-#  endif
-#  if (defined __cplusplus && ! defined EXIT_SUCCESS \
-       && ! ((defined YYMALLOC || defined malloc) \
-	     && (defined YYFREE || defined free)))
-#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-#   ifndef EXIT_SUCCESS
-#    define EXIT_SUCCESS 0
-#   endif
-#  endif
-#  ifndef YYMALLOC
-#   define YYMALLOC malloc
-#   if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
-#   endif
-#  endif
-#  ifndef YYFREE
-#   define YYFREE free
-#   if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-void free (void *); /* INFRINGES ON USER NAME SPACE */
-#   endif
-#  endif
-# endif
-#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
-
-
-#if (! defined yyoverflow \
-     && (! defined __cplusplus \
-	 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
-
-/* A type that is properly aligned for any stack member.  */
-union yyalloc
-{
-  yytype_int16 yyss_alloc;
-  YYSTYPE yyvs_alloc;
-};
-
-/* The size of the maximum gap between one aligned stack and the next.  */
-# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
-
-/* The size of an array large to enough to hold all stacks, each with
-   N elements.  */
-# define YYSTACK_BYTES(N) \
-     ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
-      + YYSTACK_GAP_MAXIMUM)
-
-# define YYCOPY_NEEDED 1
-
-/* Relocate STACK from its old location to the new one.  The
-   local variables YYSIZE and YYSTACKSIZE give the old and new number of
-   elements in the stack, and YYPTR gives the new location of the
-   stack.  Advance YYPTR to a properly aligned location for the next
-   stack.  */
-# define YYSTACK_RELOCATE(Stack_alloc, Stack)				\
-    do									\
-      {									\
-	YYSIZE_T yynewbytes;						\
-	YYCOPY (&yyptr->Stack_alloc, Stack, yysize);			\
-	Stack = &yyptr->Stack_alloc;					\
-	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
-	yyptr += yynewbytes / sizeof (*yyptr);				\
-      }									\
-    while (YYID (0))
-
-#endif
-
-#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
-/* Copy COUNT objects from FROM to TO.  The source and destination do
-   not overlap.  */
-# ifndef YYCOPY
-#  if defined __GNUC__ && 1 < __GNUC__
-#   define YYCOPY(To, From, Count) \
-      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
-#  else
-#   define YYCOPY(To, From, Count)		\
-      do					\
-	{					\
-	  YYSIZE_T yyi;				\
-	  for (yyi = 0; yyi < (Count); yyi++)	\
-	    (To)[yyi] = (From)[yyi];		\
-	}					\
-      while (YYID (0))
-#  endif
-# endif
-#endif /* !YYCOPY_NEEDED */
-
-/* YYFINAL -- State number of the termination state.  */
-#define YYFINAL  13
-/* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   21
-
-/* YYNTOKENS -- Number of terminals.  */
-#define YYNTOKENS  14
-/* YYNNTS -- Number of nonterminals.  */
-#define YYNNTS  8
-/* YYNRULES -- Number of rules.  */
-#define YYNRULES  17
-/* YYNRULES -- Number of states.  */
-#define YYNSTATES  23
-
-/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
-#define YYUNDEFTOK  2
-#define YYMAXUTOK   268
-
-#define YYTRANSLATE(YYX)						\
-  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-
-/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
-static const yytype_uint8 yytranslate[] =
-{
-       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
-       5,     6,     7,     8,     9,    10,    11,    12,    13
-};
-
-#if YYDEBUG
-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
-   YYRHS.  */
-static const yytype_uint8 yyprhs[] =
-{
-       0,     0,     3,     5,     7,     9,    12,    17,    19,    22,
-      24,    26,    28,    30,    32,    35,    38,    40
-};
-
-/* YYRHS -- A `-1'-separated list of the rules' RHS.  */
-static const yytype_int8 yyrhs[] =
-{
-      15,     0,    -1,    16,    -1,     0,    -1,    17,    -1,    16,
-      17,    -1,    18,    19,    20,    21,    -1,     3,    -1,     1,
-      21,    -1,    12,    -1,    13,    -1,     9,    -1,    10,    -1,
-      11,    -1,    20,    10,    -1,    20,    11,    -1,     3,    -1,
-       0,    -1
-};
-
-/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
-static const yytype_uint8 yyrline[] =
-{
-       0,    81,    81,    82,    86,    87,    91,   100,   101,   105,
-     106,   110,   114,   115,   116,   117,   121,   122
-};
-#endif
-
-#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
-/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
-   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
-static const char *const yytname[] =
-{
-  "kfgEND_INPUT", "error", "$undefined", "kfgEND_LINE",
-  "kfgUNTERM_STRING", "kfgUNTERM_ESCAPED_STRING", "kfgUNRECOGNIZED",
-  "kfgVAR_REF", "kfgUNTERM_VAR_REF", "kfgASSIGN", "kfgSTRING",
-  "kfgESCAPED_STRING", "kfgABS_PATH", "kfgREL_PATH", "$accept", "config",
-  "name_value_pairs", "name_value_pair", "pathname", "assign_op", "value",
-  "line_end", 0
-};
-#endif
-
-# ifdef YYPRINT
-/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
-   token YYLEX-NUM.  */
-static const yytype_uint16 yytoknum[] =
-{
-       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
-     265,   266,   267,   268
-};
-# endif
-
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
-static const yytype_uint8 yyr1[] =
-{
-       0,    14,    15,    15,    16,    16,    17,    17,    17,    18,
-      18,    19,    20,    20,    20,    20,    21,    21
-};
-
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
-static const yytype_uint8 yyr2[] =
-{
-       0,     2,     1,     1,     1,     2,     4,     1,     2,     1,
-       1,     1,     1,     1,     2,     2,     1,     1
-};
-
-/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
-   Performed when YYTABLE doesn't specify something else to do.  Zero
-   means the default is an error.  */
-static const yytype_uint8 yydefact[] =
-{
-       0,     3,     0,     7,     9,    10,     0,     0,     4,     0,
-      17,    16,     8,     1,     5,    11,     0,    12,    13,     0,
-      14,    15,     6
-};
-
-/* YYDEFGOTO[NTERM-NUM].  */
-static const yytype_int8 yydefgoto[] =
-{
-      -1,     6,     7,     8,     9,    16,    19,    12
-};
-
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
-   STATE-NUM.  */
-#define YYPACT_NINF -5
-static const yytype_int8 yypact[] =
-{
-       0,    -5,     6,    -5,    -5,    -5,     2,     4,    -5,     1,
-      -5,    -5,    -5,    -5,    -5,    -5,    10,    -5,    -5,     8,
-      -5,    -5,    -5
-};
-
-/* YYPGOTO[NTERM-NUM].  */
-static const yytype_int8 yypgoto[] =
-{
-      -5,    -5,    -5,     7,    -5,    -5,    -5,    -4
-};
-
-/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
-   positive, shift that token.  If negative, reduce the rule which
-   number is the opposite.  If YYTABLE_NINF, syntax error.  */
-#define YYTABLE_NINF -3
-static const yytype_int8 yytable[] =
-{
-       1,     2,    13,     3,    -2,     2,    10,     3,    10,    11,
-      15,    11,     4,     5,    14,    22,     4,     5,    20,    21,
-      17,    18
-};
-
-#define yypact_value_is_default(yystate) \
-  ((yystate) == (-5))
-
-#define yytable_value_is_error(yytable_value) \
-  YYID (0)
-
-static const yytype_uint8 yycheck[] =
-{
-       0,     1,     0,     3,     0,     1,     0,     3,     0,     3,
-       9,     3,    12,    13,     7,    19,    12,    13,    10,    11,
-      10,    11
-};
-
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
-   symbol of state STATE-NUM.  */
-static const yytype_uint8 yystos[] =
-{
-       0,     0,     1,     3,    12,    13,    15,    16,    17,    18,
-       0,     3,    21,     0,    17,     9,    19,    10,    11,    20,
-      10,    11,    21
-};
-
-#define yyerrok		(yyerrstatus = 0)
-#define yyclearin	(yychar = YYEMPTY)
-#define YYEMPTY		(-2)
-#define YYEOF		0
-
-#define YYACCEPT	goto yyacceptlab
-#define YYABORT		goto yyabortlab
-#define YYERROR		goto yyerrorlab
-
-
-/* Like YYERROR except do call yyerror.  This remains here temporarily
-   to ease the transition to the new meaning of YYERROR, for GCC.
-   Once GCC version 2 has supplanted version 1, this can go.  However,
-   YYFAIL appears to be in use.  Nevertheless, it is formally deprecated
-   in Bison 2.4.2's NEWS entry, where a plan to phase it out is
-   discussed.  */
-
-#define YYFAIL		goto yyerrlab
-#if defined YYFAIL
-  /* This is here to suppress warnings from the GCC cpp's
-     -Wunused-macros.  Normally we don't worry about that warning, but
-     some users do, and we want to make it easy for users to remove
-     YYFAIL uses, which will produce warnings from Bison 2.5.  */
-#endif
-
-#define YYRECOVERING()  (!!yyerrstatus)
-
-#define YYBACKUP(Token, Value)					\
-do								\
-  if (yychar == YYEMPTY && yylen == 1)				\
-    {								\
-      yychar = (Token);						\
-      yylval = (Value);						\
-      YYPOPSTACK (1);						\
-      goto yybackup;						\
-    }								\
-  else								\
-    {								\
-      yyerror (pb, sb, YY_("syntax error: cannot back up")); \
-      YYERROR;							\
-    }								\
-while (YYID (0))
-
-
-#define YYTERROR	1
-#define YYERRCODE	256
-
-
-/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
-   If N is 0, then set CURRENT to the empty location which ends
-   the previous symbol: RHS[0] (always defined).  */
-
-#define YYRHSLOC(Rhs, K) ((Rhs)[K])
-#ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N)				\
-    do									\
-      if (YYID (N))                                                    \
-	{								\
-	  (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;	\
-	  (Current).first_column = YYRHSLOC (Rhs, 1).first_column;	\
-	  (Current).last_line    = YYRHSLOC (Rhs, N).last_line;		\
-	  (Current).last_column  = YYRHSLOC (Rhs, N).last_column;	\
-	}								\
-      else								\
-	{								\
-	  (Current).first_line   = (Current).last_line   =		\
-	    YYRHSLOC (Rhs, 0).last_line;				\
-	  (Current).first_column = (Current).last_column =		\
-	    YYRHSLOC (Rhs, 0).last_column;				\
-	}								\
-    while (YYID (0))
-#endif
-
-
-/* This macro is provided for backward compatibility. */
-
-#ifndef YY_LOCATION_PRINT
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-#endif
-
-
-/* YYLEX -- calling `yylex' with the right arguments.  */
-
-#ifdef YYLEX_PARAM
-# define YYLEX yylex (&yylval, YYLEX_PARAM)
-#else
-# define YYLEX yylex (&yylval, sb)
-#endif
-
-/* Enable debugging if requested.  */
-#if YYDEBUG
-
-# ifndef YYFPRINTF
-#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
-#  define YYFPRINTF fprintf
-# endif
-
-# define YYDPRINTF(Args)			\
-do {						\
-  if (yydebug)					\
-    YYFPRINTF Args;				\
-} while (YYID (0))
-
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)			  \
-do {									  \
-  if (yydebug)								  \
-    {									  \
-      YYFPRINTF (stderr, "%s ", Title);					  \
-      yy_symbol_print (stderr,						  \
-		  Type, Value, pb, sb); \
-      YYFPRINTF (stderr, "\n");						  \
-    }									  \
-} while (YYID (0))
-
-
-/*--------------------------------.
-| Print this symbol on YYOUTPUT.  |
-`--------------------------------*/
-
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, KFGParseBlock* pb, KFGScanBlock* sb)
-#else
-static void
-yy_symbol_value_print (yyoutput, yytype, yyvaluep, pb, sb)
-    FILE *yyoutput;
-    int yytype;
-    YYSTYPE const * const yyvaluep;
-    KFGParseBlock* pb;
-    KFGScanBlock* sb;
-#endif
-{
-  if (!yyvaluep)
-    return;
-  YYUSE (pb);
-  YYUSE (sb);
-# ifdef YYPRINT
-  if (yytype < YYNTOKENS)
-    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# else
-  YYUSE (yyoutput);
-# endif
-  switch (yytype)
-    {
-      default:
-	break;
-    }
-}
-
-
-/*--------------------------------.
-| Print this symbol on YYOUTPUT.  |
-`--------------------------------*/
-
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-static void
-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, KFGParseBlock* pb, KFGScanBlock* sb)
-#else
-static void
-yy_symbol_print (yyoutput, yytype, yyvaluep, pb, sb)
-    FILE *yyoutput;
-    int yytype;
-    YYSTYPE const * const yyvaluep;
-    KFGParseBlock* pb;
-    KFGScanBlock* sb;
-#endif
-{
-  if (yytype < YYNTOKENS)
-    YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
-  else
-    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
-
-  yy_symbol_value_print (yyoutput, yytype, yyvaluep, pb, sb);
-  YYFPRINTF (yyoutput, ")");
-}
-
-/*------------------------------------------------------------------.
-| yy_stack_print -- Print the state stack from its BOTTOM up to its |
-| TOP (included).                                                   |
-`------------------------------------------------------------------*/
-
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-static void
-yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
-#else
-static void
-yy_stack_print (yybottom, yytop)
-    yytype_int16 *yybottom;
-    yytype_int16 *yytop;
-#endif
-{
-  YYFPRINTF (stderr, "Stack now");
-  for (; yybottom <= yytop; yybottom++)
-    {
-      int yybot = *yybottom;
-      YYFPRINTF (stderr, " %d", yybot);
-    }
-  YYFPRINTF (stderr, "\n");
-}
-
-# define YY_STACK_PRINT(Bottom, Top)				\
-do {								\
-  if (yydebug)							\
-    yy_stack_print ((Bottom), (Top));				\
-} while (YYID (0))
-
-
-/*------------------------------------------------.
-| Report that the YYRULE is going to be reduced.  |
-`------------------------------------------------*/
-
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-static void
-yy_reduce_print (YYSTYPE *yyvsp, int yyrule, KFGParseBlock* pb, KFGScanBlock* sb)
-#else
-static void
-yy_reduce_print (yyvsp, yyrule, pb, sb)
-    YYSTYPE *yyvsp;
-    int yyrule;
-    KFGParseBlock* pb;
-    KFGScanBlock* sb;
-#endif
-{
-  int yynrhs = yyr2[yyrule];
-  int yyi;
-  unsigned long int yylno = yyrline[yyrule];
-  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
-	     yyrule - 1, yylno);
-  /* The symbols being reduced.  */
-  for (yyi = 0; yyi < yynrhs; yyi++)
-    {
-      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
-      yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
-		       &(yyvsp[(yyi + 1) - (yynrhs)])
-		       		       , pb, sb);
-      YYFPRINTF (stderr, "\n");
-    }
-}
-
-# define YY_REDUCE_PRINT(Rule)		\
-do {					\
-  if (yydebug)				\
-    yy_reduce_print (yyvsp, Rule, pb, sb); \
-} while (YYID (0))
-
-/* Nonzero means print parse trace.  It is left uninitialized so that
-   multiple parsers can coexist.  */
-int yydebug;
-#else /* !YYDEBUG */
-# define YYDPRINTF(Args)
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
-# define YY_STACK_PRINT(Bottom, Top)
-# define YY_REDUCE_PRINT(Rule)
-#endif /* !YYDEBUG */
-
-
-/* YYINITDEPTH -- initial size of the parser's stacks.  */
-#ifndef	YYINITDEPTH
-# define YYINITDEPTH 200
-#endif
-
-/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
-   if the built-in stack extension method is used).
-
-   Do not make this value too large; the results are undefined if
-   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
-   evaluated with infinite-precision integer arithmetic.  */
-
-#ifndef YYMAXDEPTH
-# define YYMAXDEPTH 10000
-#endif
-
-
-#if YYERROR_VERBOSE
-
-# ifndef yystrlen
-#  if defined __GLIBC__ && defined _STRING_H
-#   define yystrlen strlen
-#  else
-/* Return the length of YYSTR.  */
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-static YYSIZE_T
-yystrlen (const char *yystr)
-#else
-static YYSIZE_T
-yystrlen (yystr)
-    const char *yystr;
-#endif
-{
-  YYSIZE_T yylen;
-  for (yylen = 0; yystr[yylen]; yylen++)
-    continue;
-  return yylen;
-}
-#  endif
-# endif
-
-# ifndef yystpcpy
-#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
-#   define yystpcpy stpcpy
-#  else
-/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
-   YYDEST.  */
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-static char *
-yystpcpy (char *yydest, const char *yysrc)
-#else
-static char *
-yystpcpy (yydest, yysrc)
-    char *yydest;
-    const char *yysrc;
-#endif
-{
-  char *yyd = yydest;
-  const char *yys = yysrc;
-
-  while ((*yyd++ = *yys++) != '\0')
-    continue;
-
-  return yyd - 1;
-}
-#  endif
-# endif
-
-# ifndef yytnamerr
-/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
-   quotes and backslashes, so that it's suitable for yyerror.  The
-   heuristic is that double-quoting is unnecessary unless the string
-   contains an apostrophe, a comma, or backslash (other than
-   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
-   null, do not copy; instead, return the length of what the result
-   would have been.  */
-static YYSIZE_T
-yytnamerr (char *yyres, const char *yystr)
-{
-  if (*yystr == '"')
-    {
-      YYSIZE_T yyn = 0;
-      char const *yyp = yystr;
-
-      for (;;)
-	switch (*++yyp)
-	  {
-	  case '\'':
-	  case ',':
-	    goto do_not_strip_quotes;
-
-	  case '\\':
-	    if (*++yyp != '\\')
-	      goto do_not_strip_quotes;
-	    /* Fall through.  */
-	  default:
-	    if (yyres)
-	      yyres[yyn] = *yyp;
-	    yyn++;
-	    break;
-
-	  case '"':
-	    if (yyres)
-	      yyres[yyn] = '\0';
-	    return yyn;
-	  }
-    do_not_strip_quotes: ;
-    }
-
-  if (! yyres)
-    return yystrlen (yystr);
-
-  return yystpcpy (yyres, yystr) - yyres;
-}
-# endif
-
-/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
-   about the unexpected token YYTOKEN for the state stack whose top is
-   YYSSP.
-
-   Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
-   not large enough to hold the message.  In that case, also set
-   *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
-   required number of bytes is too large to store.  */
-static int
-yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
-                yytype_int16 *yyssp, int yytoken)
-{
-  YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
-  YYSIZE_T yysize = yysize0;
-  YYSIZE_T yysize1;
-  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
-  /* Internationalized format string. */
-  const char *yyformat = 0;
-  /* Arguments of yyformat. */
-  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
-  /* Number of reported tokens (one for the "unexpected", one per
-     "expected"). */
-  int yycount = 0;
-
-  /* There are many possibilities here to consider:
-     - Assume YYFAIL is not used.  It's too flawed to consider.  See
-       <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
-       for details.  YYERROR is fine as it does not invoke this
-       function.
-     - If this state is a consistent state with a default action, then
-       the only way this function was invoked is if the default action
-       is an error action.  In that case, don't check for expected
-       tokens because there are none.
-     - The only way there can be no lookahead present (in yychar) is if
-       this state is a consistent state with a default action.  Thus,
-       detecting the absence of a lookahead is sufficient to determine
-       that there is no unexpected or expected token to report.  In that
-       case, just report a simple "syntax error".
-     - Don't assume there isn't a lookahead just because this state is a
-       consistent state with a default action.  There might have been a
-       previous inconsistent state, consistent state with a non-default
-       action, or user semantic action that manipulated yychar.
-     - Of course, the expected token list depends on states to have
-       correct lookahead information, and it depends on the parser not
-       to perform extra reductions after fetching a lookahead from the
-       scanner and before detecting a syntax error.  Thus, state merging
-       (from LALR or IELR) and default reductions corrupt the expected
-       token list.  However, the list is correct for canonical LR with
-       one exception: it will still contain any token that will not be
-       accepted due to an error action in a later state.
-  */
-  if (yytoken != YYEMPTY)
-    {
-      int yyn = yypact[*yyssp];
-      yyarg[yycount++] = yytname[yytoken];
-      if (!yypact_value_is_default (yyn))
-        {
-          /* Start YYX at -YYN if negative to avoid negative indexes in
-             YYCHECK.  In other words, skip the first -YYN actions for
-             this state because they are default actions.  */
-          int yyxbegin = yyn < 0 ? -yyn : 0;
-          /* Stay within bounds of both yycheck and yytname.  */
-          int yychecklim = YYLAST - yyn + 1;
-          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
-          int yyx;
-
-          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
-            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
-                && !yytable_value_is_error (yytable[yyx + yyn]))
-              {
-                if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
-                  {
-                    yycount = 1;
-                    yysize = yysize0;
-                    break;
-                  }
-                yyarg[yycount++] = yytname[yyx];
-                yysize1 = yysize + yytnamerr (0, yytname[yyx]);
-                if (! (yysize <= yysize1
-                       && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
-                  return 2;
-                yysize = yysize1;
-              }
-        }
-    }
-
-  switch (yycount)
-    {
-# define YYCASE_(N, S)                      \
-      case N:                               \
-        yyformat = S;                       \
-      break
-      YYCASE_(0, YY_("syntax error"));
-      YYCASE_(1, YY_("syntax error, unexpected %s"));
-      YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
-      YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
-      YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
-      YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
-# undef YYCASE_
-    }
-
-  yysize1 = yysize + yystrlen (yyformat);
-  if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
-    return 2;
-  yysize = yysize1;
-
-  if (*yymsg_alloc < yysize)
-    {
-      *yymsg_alloc = 2 * yysize;
-      if (! (yysize <= *yymsg_alloc
-             && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
-        *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
-      return 1;
-    }
-
-  /* Avoid sprintf, as that infringes on the user's name space.
-     Don't have undefined behavior even if the translation
-     produced a string with the wrong number of "%s"s.  */
-  {
-    char *yyp = *yymsg;
-    int yyi = 0;
-    while ((*yyp = *yyformat) != '\0')
-      if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
-        {
-          yyp += yytnamerr (yyp, yyarg[yyi++]);
-          yyformat += 2;
-        }
-      else
-        {
-          yyp++;
-          yyformat++;
-        }
-  }
-  return 0;
-}
-#endif /* YYERROR_VERBOSE */
-
-/*-----------------------------------------------.
-| Release the memory associated to this symbol.  |
-`-----------------------------------------------*/
-
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-static void
-yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, KFGParseBlock* pb, KFGScanBlock* sb)
-#else
-static void
-yydestruct (yymsg, yytype, yyvaluep, pb, sb)
-    const char *yymsg;
-    int yytype;
-    YYSTYPE *yyvaluep;
-    KFGParseBlock* pb;
-    KFGScanBlock* sb;
-#endif
-{
-  YYUSE (yyvaluep);
-  YYUSE (pb);
-  YYUSE (sb);
-
-  if (!yymsg)
-    yymsg = "Deleting";
-  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
-
-  switch (yytype)
-    {
-      case 20: /* "value" */
-
-	{
-    VNamelistRelease((yyvaluep->namelist));
-};
-
-	break;
-
-      default:
-	break;
-    }
-}
-
-
-/* Prevent warnings from -Wmissing-prototypes.  */
-#ifdef YYPARSE_PARAM
-#if defined __STDC__ || defined __cplusplus
-int yyparse (void *YYPARSE_PARAM);
-#else
-int yyparse ();
-#endif
-#else /* ! YYPARSE_PARAM */
-#if defined __STDC__ || defined __cplusplus
-int yyparse (KFGParseBlock* pb, KFGScanBlock* sb);
-#else
-int yyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
-
-
-/*----------.
-| yyparse.  |
-`----------*/
-
-#ifdef YYPARSE_PARAM
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-int
-yyparse (void *YYPARSE_PARAM)
-#else
-int
-yyparse (YYPARSE_PARAM)
-    void *YYPARSE_PARAM;
-#endif
-#else /* ! YYPARSE_PARAM */
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-int
-yyparse (KFGParseBlock* pb, KFGScanBlock* sb)
-#else
-int
-yyparse (pb, sb)
-    KFGParseBlock* pb;
-    KFGScanBlock* sb;
-#endif
-#endif
-{
-/* The lookahead symbol.  */
-int yychar;
-
-/* The semantic value of the lookahead symbol.  */
-YYSTYPE yylval;
-
-    /* Number of syntax errors so far.  */
-    int yynerrs;
-
-    int yystate;
-    /* Number of tokens to shift before error messages enabled.  */
-    int yyerrstatus;
-
-    /* The stacks and their tools:
-       `yyss': related to states.
-       `yyvs': related to semantic values.
-
-       Refer to the stacks thru separate pointers, to allow yyoverflow
-       to reallocate them elsewhere.  */
-
-    /* The state stack.  */
-    yytype_int16 yyssa[YYINITDEPTH];
-    yytype_int16 *yyss;
-    yytype_int16 *yyssp;
-
-    /* The semantic value stack.  */
-    YYSTYPE yyvsa[YYINITDEPTH];
-    YYSTYPE *yyvs;
-    YYSTYPE *yyvsp;
-
-    YYSIZE_T yystacksize;
-
-  int yyn;
-  int yyresult;
-  /* Lookahead token as an internal (translated) token number.  */
-  int yytoken;
-  /* The variables used to return semantic value and location from the
-     action routines.  */
-  YYSTYPE yyval;
-
-#if YYERROR_VERBOSE
-  /* Buffer for error messages, and its allocated size.  */
-  char yymsgbuf[128];
-  char *yymsg = yymsgbuf;
-  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
-#endif
-
-#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
-
-  /* The number of symbols on the RHS of the reduced rule.
-     Keep to zero when no symbol should be popped.  */
-  int yylen = 0;
-
-  yytoken = 0;
-  yyss = yyssa;
-  yyvs = yyvsa;
-  yystacksize = YYINITDEPTH;
-
-  YYDPRINTF ((stderr, "Starting parse\n"));
-
-  yystate = 0;
-  yyerrstatus = 0;
-  yynerrs = 0;
-  yychar = YYEMPTY; /* Cause a token to be read.  */
-
-  /* Initialize stack pointers.
-     Waste one element of value and location stack
-     so that they stay on the same level as the state stack.
-     The wasted elements are never initialized.  */
-  yyssp = yyss;
-  yyvsp = yyvs;
-
-  goto yysetstate;
-
-/*------------------------------------------------------------.
-| yynewstate -- Push a new state, which is found in yystate.  |
-`------------------------------------------------------------*/
- yynewstate:
-  /* In all cases, when you get here, the value and location stacks
-     have just been pushed.  So pushing a state here evens the stacks.  */
-  yyssp++;
-
- yysetstate:
-  *yyssp = yystate;
-
-  if (yyss + yystacksize - 1 <= yyssp)
-    {
-      /* Get the current used size of the three stacks, in elements.  */
-      YYSIZE_T yysize = yyssp - yyss + 1;
-
-#ifdef yyoverflow
-      {
-	/* Give user a chance to reallocate the stack.  Use copies of
-	   these so that the &'s don't force the real ones into
-	   memory.  */
-	YYSTYPE *yyvs1 = yyvs;
-	yytype_int16 *yyss1 = yyss;
-
-	/* Each stack pointer address is followed by the size of the
-	   data in use in that stack, in bytes.  This used to be a
-	   conditional around just the two extra args, but that might
-	   be undefined if yyoverflow is a macro.  */
-	yyoverflow (YY_("memory exhausted"),
-		    &yyss1, yysize * sizeof (*yyssp),
-		    &yyvs1, yysize * sizeof (*yyvsp),
-		    &yystacksize);
-
-	yyss = yyss1;
-	yyvs = yyvs1;
-      }
-#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
-      goto yyexhaustedlab;
-# else
-      /* Extend the stack our own way.  */
-      if (YYMAXDEPTH <= yystacksize)
-	goto yyexhaustedlab;
-      yystacksize *= 2;
-      if (YYMAXDEPTH < yystacksize)
-	yystacksize = YYMAXDEPTH;
-
-      {
-	yytype_int16 *yyss1 = yyss;
-	union yyalloc *yyptr =
-	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
-	if (! yyptr)
-	  goto yyexhaustedlab;
-	YYSTACK_RELOCATE (yyss_alloc, yyss);
-	YYSTACK_RELOCATE (yyvs_alloc, yyvs);
-#  undef YYSTACK_RELOCATE
-	if (yyss1 != yyssa)
-	  YYSTACK_FREE (yyss1);
-      }
-# endif
-#endif /* no yyoverflow */
-
-      yyssp = yyss + yysize - 1;
-      yyvsp = yyvs + yysize - 1;
-
-      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
-		  (unsigned long int) yystacksize));
-
-      if (yyss + yystacksize - 1 <= yyssp)
-	YYABORT;
-    }
-
-  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
-
-  if (yystate == YYFINAL)
-    YYACCEPT;
-
-  goto yybackup;
-
-/*-----------.
-| yybackup.  |
-`-----------*/
-yybackup:
-
-  /* Do appropriate processing given the current state.  Read a
-     lookahead token if we need one and don't already have one.  */
-
-  /* First try to decide what to do without reference to lookahead token.  */
-  yyn = yypact[yystate];
-  if (yypact_value_is_default (yyn))
-    goto yydefault;
-
-  /* Not known => get a lookahead token if don't already have one.  */
-
-  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
-  if (yychar == YYEMPTY)
-    {
-      YYDPRINTF ((stderr, "Reading a token: "));
-      yychar = YYLEX;
-    }
-
-  if (yychar <= YYEOF)
-    {
-      yychar = yytoken = YYEOF;
-      YYDPRINTF ((stderr, "Now at end of input.\n"));
-    }
-  else
-    {
-      yytoken = YYTRANSLATE (yychar);
-      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
-    }
-
-  /* If the proper action on seeing token YYTOKEN is to reduce or to
-     detect an error, take that action.  */
-  yyn += yytoken;
-  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
-    goto yydefault;
-  yyn = yytable[yyn];
-  if (yyn <= 0)
-    {
-      if (yytable_value_is_error (yyn))
-        goto yyerrlab;
-      yyn = -yyn;
-      goto yyreduce;
-    }
-
-  /* Count tokens shifted since error; after three, turn off error
-     status.  */
-  if (yyerrstatus)
-    yyerrstatus--;
-
-  /* Shift the lookahead token.  */
-  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
-
-  /* Discard the shifted token.  */
-  yychar = YYEMPTY;
-
-  yystate = yyn;
-  *++yyvsp = yylval;
-
-  goto yynewstate;
-
-
-/*-----------------------------------------------------------.
-| yydefault -- do the default action for the current state.  |
-`-----------------------------------------------------------*/
-yydefault:
-  yyn = yydefact[yystate];
-  if (yyn == 0)
-    goto yyerrlab;
-  goto yyreduce;
-
-
-/*-----------------------------.
-| yyreduce -- Do a reduction.  |
-`-----------------------------*/
-yyreduce:
-  /* yyn is the number of a rule to reduce with.  */
-  yylen = yyr2[yyn];
-
-  /* If YYLEN is nonzero, implement the default value of the action:
-     `$$ = $1'.
-
-     Otherwise, the following line sets YYVAL to garbage.
-     This behavior is undocumented and Bison
-     users should not rely upon it.  Assigning to YYVAL
-     unconditionally makes the parser a bit smaller, and it avoids a
-     GCC warning that YYVAL may be used uninitialized.  */
-  yyval = yyvsp[1-yylen];
-
-
-  YY_REDUCE_PRINT (yyn);
-  switch (yyn)
-    {
-        case 6:
-
-    { 
-            rc_t rc=sb->write_nvp(sb->self, (yyvsp[(1) - (4)].pb).tokenText, (yyvsp[(1) - (4)].pb).tokenLength, (yyvsp[(3) - (4)].namelist));
-            if (rc != 0)
-            {
-                ReportRc(pb, sb, rc);
-            }
-            VNamelistRelease((yyvsp[(3) - (4)].namelist));
-        }
-    break;
-
-  case 12:
-
-    { VNamelistMake(&(yyval.namelist), NAMELIST_ALLOC_BLKSIZE); AppendName(sb, (yyval.namelist), &(yyvsp[(1) - (1)].pb)); }
-    break;
-
-  case 13:
-
-    { VNamelistMake(&(yyval.namelist), NAMELIST_ALLOC_BLKSIZE); AppendName(sb, (yyval.namelist), &(yyvsp[(1) - (1)].pb)); }
-    break;
-
-  case 14:
-
-    { AppendName(sb, (yyvsp[(1) - (2)].namelist), &(yyvsp[(2) - (2)].pb)); (yyval.namelist)=(yyvsp[(1) - (2)].namelist); }
-    break;
-
-  case 15:
-
-    { AppendName(sb, (yyvsp[(1) - (2)].namelist), &(yyvsp[(2) - (2)].pb)); (yyval.namelist)=(yyvsp[(1) - (2)].namelist); }
-    break;
-
-
-
-      default: break;
-    }
-  /* User semantic actions sometimes alter yychar, and that requires
-     that yytoken be updated with the new translation.  We take the
-     approach of translating immediately before every use of yytoken.
-     One alternative is translating here after every semantic action,
-     but that translation would be missed if the semantic action invokes
-     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
-     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
-     incorrect destructor might then be invoked immediately.  In the
-     case of YYERROR or YYBACKUP, subsequent parser actions might lead
-     to an incorrect destructor call or verbose syntax error message
-     before the lookahead is translated.  */
-  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
-
-  YYPOPSTACK (yylen);
-  yylen = 0;
-  YY_STACK_PRINT (yyss, yyssp);
-
-  *++yyvsp = yyval;
-
-  /* Now `shift' the result of the reduction.  Determine what state
-     that goes to, based on the state we popped back to and the rule
-     number reduced by.  */
-
-  yyn = yyr1[yyn];
-
-  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
-  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
-    yystate = yytable[yystate];
-  else
-    yystate = yydefgoto[yyn - YYNTOKENS];
-
-  goto yynewstate;
-
-
-/*------------------------------------.
-| yyerrlab -- here on detecting error |
-`------------------------------------*/
-yyerrlab:
-  /* Make sure we have latest lookahead translation.  See comments at
-     user semantic actions for why this is necessary.  */
-  yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
-
-  /* If not already recovering from an error, report this error.  */
-  if (!yyerrstatus)
-    {
-      ++yynerrs;
-#if ! YYERROR_VERBOSE
-      yyerror (pb, sb, YY_("syntax error"));
-#else
-# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
-                                        yyssp, yytoken)
-      {
-        char const *yymsgp = YY_("syntax error");
-        int yysyntax_error_status;
-        yysyntax_error_status = YYSYNTAX_ERROR;
-        if (yysyntax_error_status == 0)
-          yymsgp = yymsg;
-        else if (yysyntax_error_status == 1)
-          {
-            if (yymsg != yymsgbuf)
-              YYSTACK_FREE (yymsg);
-            yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
-            if (!yymsg)
-              {
-                yymsg = yymsgbuf;
-                yymsg_alloc = sizeof yymsgbuf;
-                yysyntax_error_status = 2;
-              }
-            else
-              {
-                yysyntax_error_status = YYSYNTAX_ERROR;
-                yymsgp = yymsg;
-              }
-          }
-        yyerror (pb, sb, yymsgp);
-        if (yysyntax_error_status == 2)
-          goto yyexhaustedlab;
-      }
-# undef YYSYNTAX_ERROR
-#endif
-    }
-
-
-
-  if (yyerrstatus == 3)
-    {
-      /* If just tried and failed to reuse lookahead token after an
-	 error, discard it.  */
-
-      if (yychar <= YYEOF)
-	{
-	  /* Return failure if at end of input.  */
-	  if (yychar == YYEOF)
-	    YYABORT;
-	}
-      else
-	{
-	  yydestruct ("Error: discarding",
-		      yytoken, &yylval, pb, sb);
-	  yychar = YYEMPTY;
-	}
-    }
-
-  /* Else will try to reuse lookahead token after shifting the error
-     token.  */
-  goto yyerrlab1;
-
-
-/*---------------------------------------------------.
-| yyerrorlab -- error raised explicitly by YYERROR.  |
-`---------------------------------------------------*/
-yyerrorlab:
-
-  /* Pacify compilers like GCC when the user code never invokes
-     YYERROR and the label yyerrorlab therefore never appears in user
-     code.  */
-  if (/*CONSTCOND*/ 0)
-     goto yyerrorlab;
-
-  /* Do not reclaim the symbols of the rule which action triggered
-     this YYERROR.  */
-  YYPOPSTACK (yylen);
-  yylen = 0;
-  YY_STACK_PRINT (yyss, yyssp);
-  yystate = *yyssp;
-  goto yyerrlab1;
-
-
-/*-------------------------------------------------------------.
-| yyerrlab1 -- common code for both syntax error and YYERROR.  |
-`-------------------------------------------------------------*/
-yyerrlab1:
-  yyerrstatus = 3;	/* Each real token shifted decrements this.  */
-
-  for (;;)
-    {
-      yyn = yypact[yystate];
-      if (!yypact_value_is_default (yyn))
-	{
-	  yyn += YYTERROR;
-	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
-	    {
-	      yyn = yytable[yyn];
-	      if (0 < yyn)
-		break;
-	    }
-	}
-
-      /* Pop the current state because it cannot handle the error token.  */
-      if (yyssp == yyss)
-	YYABORT;
-
-
-      yydestruct ("Error: popping",
-		  yystos[yystate], yyvsp, pb, sb);
-      YYPOPSTACK (1);
-      yystate = *yyssp;
-      YY_STACK_PRINT (yyss, yyssp);
-    }
-
-  *++yyvsp = yylval;
-
-
-  /* Shift the error token.  */
-  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
-
-  yystate = yyn;
-  goto yynewstate;
-
-
-/*-------------------------------------.
-| yyacceptlab -- YYACCEPT comes here.  |
-`-------------------------------------*/
-yyacceptlab:
-  yyresult = 0;
-  goto yyreturn;
-
-/*-----------------------------------.
-| yyabortlab -- YYABORT comes here.  |
-`-----------------------------------*/
-yyabortlab:
-  yyresult = 1;
-  goto yyreturn;
-
-#if !defined(yyoverflow) || YYERROR_VERBOSE
-/*-------------------------------------------------.
-| yyexhaustedlab -- memory exhaustion comes here.  |
-`-------------------------------------------------*/
-yyexhaustedlab:
-  yyerror (pb, sb, YY_("memory exhausted"));
-  yyresult = 2;
-  /* Fall through.  */
-#endif
-
-yyreturn:
-  if (yychar != YYEMPTY)
-    {
-      /* Make sure we have latest lookahead translation.  See comments at
-         user semantic actions for why this is necessary.  */
-      yytoken = YYTRANSLATE (yychar);
-      yydestruct ("Cleanup: discarding lookahead",
-                  yytoken, &yylval, pb, sb);
-    }
-  /* Do not reclaim the symbols of the rule which action triggered
-     this YYABORT or YYACCEPT.  */
-  YYPOPSTACK (yylen);
-  YY_STACK_PRINT (yyss, yyssp);
-  while (yyssp != yyss)
-    {
-      yydestruct ("Cleanup: popping",
-		  yystos[*yyssp], yyvsp, pb, sb);
-      YYPOPSTACK (1);
-    }
-#ifndef yyoverflow
-  if (yyss != yyssa)
-    YYSTACK_FREE (yyss);
-#endif
-#if YYERROR_VERBOSE
-  if (yymsg != yymsgbuf)
-    YYSTACK_FREE (yymsg);
-#endif
-  /* Make sure YYID is used.  */
-  return YYID (yyresult);
-}
-
-
-
-
-
-#include <assert.h>
-#include <klib/token.h>
-#include <klib/log.h>
-#include <klib/writer.h>
-
-void KFG_error(KFGParseBlock* pb, KFGScanBlock* sb, const char* msg)
-{
-    sb->report_error(sb, msg);
-}
-
-void ReportRc(KFGParseBlock* pb, KFGScanBlock* sb, rc_t rc)
-{
-    char buf[1025];
-    size_t num_writ;
-    RCExplain(rc, buf, 1024, &num_writ);
-    buf[1024]=0;
-    yyerror(0, sb, buf);
-}
-
-void AppendName(KFGScanBlock* sb, VNamelist* nl, const KFGParseBlock* pb)
-{   /* pb represents either a kfgSTRING or a kfgESCAPED_STRING with opening and closed quotes clipped */
-    rc_t rc;
-    KToken t;
-    size_t value_size;
-    char* buf;
-
-    if (pb->tokenLength == 0)
-    {
-        return;
-    }
-            
-    t.id= pb->tokenId == kfgESCAPED_STRING ? eEscapedString : eString;
-    StringInit(&t.str, pb->tokenText-1, pb->tokenLength+2, (uint32_t) (pb->tokenLength + 2) ); /* compensate for clipped quotes in order to use KTokenToString */
-    buf=(char*)malloc(t.str.size);
-
-    /* KTokenToString removes opening and closing quotes and handles escapes if present */
-    rc = KTokenToString (&t, buf, t.str.size, &value_size);
-    if (rc != 0)
-    {
-        ReportRc(0, sb, rc);
-    }
-    else
-    {   
-        assert(value_size < t.str.size);
-        buf[value_size]=0;
-        rc = VNamelistAppend(nl, buf);
-        if (rc != 0)
-        {
-            ReportRc(0, sb, rc);
-        }
-    }       
-    free(buf);
-}
-
-
-    
-
diff --git a/libs/kfg/config-lex.c b/libs/kfg/config-lex.c
deleted file mode 100644
index 38daf51..0000000
--- a/libs/kfg/config-lex.c
+++ /dev/null
@@ -1,2511 +0,0 @@
-
-
-#define YY_BUF_SIZE 16777216
-#define  YY_INT_ALIGNED short int
-
-/* A lexical scanner generated by flex */
-
-#define FLEX_SCANNER
-#define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 35
-#if YY_FLEX_SUBMINOR_VERSION > 0
-#define FLEX_BETA
-#endif
-
-/* First, we deal with  platform-specific or compiler-specific issues. */
-
-/* begin standard C headers. */
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-
-/* end standard C headers. */
-
-/* flex integer type definitions */
-
-#ifndef FLEXINT_H
-#define FLEXINT_H
-
-/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
-
-#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-
-/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
- * if you want the limit (max/min) macros for int types. 
- */
-#ifndef __STDC_LIMIT_MACROS
-#define __STDC_LIMIT_MACROS 1
-#endif
-
-#include <inttypes.h>
-typedef int8_t flex_int8_t;
-typedef uint8_t flex_uint8_t;
-typedef int16_t flex_int16_t;
-typedef uint16_t flex_uint16_t;
-typedef int32_t flex_int32_t;
-typedef uint32_t flex_uint32_t;
-#else
-typedef signed char flex_int8_t;
-typedef short int flex_int16_t;
-typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t; 
-typedef unsigned short int flex_uint16_t;
-typedef unsigned int flex_uint32_t;
-#endif /* ! C99 */
-
-/* Limits of integral types. */
-#ifndef INT8_MIN
-#define INT8_MIN               (-128)
-#endif
-#ifndef INT16_MIN
-#define INT16_MIN              (-32767-1)
-#endif
-#ifndef INT32_MIN
-#define INT32_MIN              (-2147483647-1)
-#endif
-#ifndef INT8_MAX
-#define INT8_MAX               (127)
-#endif
-#ifndef INT16_MAX
-#define INT16_MAX              (32767)
-#endif
-#ifndef INT32_MAX
-#define INT32_MAX              (2147483647)
-#endif
-#ifndef UINT8_MAX
-#define UINT8_MAX              (255U)
-#endif
-#ifndef UINT16_MAX
-#define UINT16_MAX             (65535U)
-#endif
-#ifndef UINT32_MAX
-#define UINT32_MAX             (4294967295U)
-#endif
-
-#endif /* ! FLEXINT_H */
-
-#ifdef __cplusplus
-
-/* The "const" storage-class-modifier is valid. */
-#define YY_USE_CONST
-
-#else	/* ! __cplusplus */
-
-/* C99 requires __STDC__ to be defined as 1. */
-#if defined (__STDC__)
-
-#define YY_USE_CONST
-
-#endif	/* defined (__STDC__) */
-#endif	/* ! __cplusplus */
-
-#ifdef YY_USE_CONST
-#define yyconst const
-#else
-#define yyconst
-#endif
-
-/* Returned upon end-of-file. */
-#define YY_NULL 0
-
-/* Promotes a possibly negative, possibly signed char to an unsigned
- * integer for use as an array index.  If the signed char is negative,
- * we want to instead treat it as an 8-bit unsigned char, hence the
- * double cast.
- */
-#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
-
-/* An opaque pointer. */
-#ifndef YY_TYPEDEF_YY_SCANNER_T
-#define YY_TYPEDEF_YY_SCANNER_T
-typedef void* yyscan_t;
-#endif
-
-/* For convenience, these vars (plus the bison vars far below)
-   are macros in the reentrant scanner. */
-#define yyin yyg->yyin_r
-#define yyout yyg->yyout_r
-#define yyextra yyg->yyextra_r
-#define yyleng yyg->yyleng_r
-#define yytext yyg->yytext_r
-#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
-#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
-#define yy_flex_debug yyg->yy_flex_debug_r
-
-/* Enter a start condition.  This macro really ought to take a parameter,
- * but we do it the disgusting crufty way forced on us by the ()-less
- * definition of BEGIN.
- */
-#define BEGIN yyg->yy_start = 1 + 2 *
-
-/* Translate the current start state into a value that can be later handed
- * to BEGIN to return to the state.  The YYSTATE alias is for lex
- * compatibility.
- */
-#define YY_START ((yyg->yy_start - 1) / 2)
-#define YYSTATE YY_START
-
-/* Action number for EOF rule of a given start state. */
-#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
-
-/* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE vdb_kfg_yyrestart(yyin ,yyscanner )
-
-#define YY_END_OF_BUFFER_CHAR 0
-
-/* Size of default input buffer. */
-#ifndef YY_BUF_SIZE
-#define YY_BUF_SIZE 16384
-#endif
-
-/* The state buf must be large enough to hold one state per character in the main buffer.
- */
-#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
-
-#ifndef YY_TYPEDEF_YY_BUFFER_STATE
-#define YY_TYPEDEF_YY_BUFFER_STATE
-typedef struct yy_buffer_state *YY_BUFFER_STATE;
-#endif
-
-#define EOB_ACT_CONTINUE_SCAN 0
-#define EOB_ACT_END_OF_FILE 1
-#define EOB_ACT_LAST_MATCH 2
-
-    /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
-     *       access to the local variable yy_act. Since yyless() is a macro, it would break
-     *       existing scanners that call yyless() from OUTSIDE vdb_kfg_yylex. 
-     *       One obvious solution it to make yy_act a global. I tried that, and saw
-     *       a 5% performance hit in a non-yylineno scanner, because yy_act is
-     *       normally declared as a register variable-- so it is not worth it.
-     */
-    #define  YY_LESS_LINENO(n) \
-            do { \
-                int yyl;\
-                for ( yyl = n; yyl < yyleng; ++yyl )\
-                    if ( yytext[yyl] == '\n' )\
-                        --yylineno;\
-            }while(0)
-    
-/* Return all but the first "n" matched characters back to the input stream. */
-#define yyless(n) \
-	do \
-		{ \
-		/* Undo effects of setting up yytext. */ \
-        int yyless_macro_arg = (n); \
-        YY_LESS_LINENO(yyless_macro_arg);\
-		*yy_cp = yyg->yy_hold_char; \
-		YY_RESTORE_YY_MORE_OFFSET \
-		yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
-		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
-		} \
-	while ( 0 )
-
-#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
-
-#ifndef YY_TYPEDEF_YY_SIZE_T
-#define YY_TYPEDEF_YY_SIZE_T
-typedef size_t yy_size_t;
-#endif
-
-#ifndef YY_STRUCT_YY_BUFFER_STATE
-#define YY_STRUCT_YY_BUFFER_STATE
-struct yy_buffer_state
-	{
-	FILE *yy_input_file;
-
-	char *yy_ch_buf;		/* input buffer */
-	char *yy_buf_pos;		/* current position in input buffer */
-
-	/* Size of input buffer in bytes, not including room for EOB
-	 * characters.
-	 */
-	yy_size_t yy_buf_size;
-
-	/* Number of characters read into yy_ch_buf, not including EOB
-	 * characters.
-	 */
-	int yy_n_chars;
-
-	/* Whether we "own" the buffer - i.e., we know we created it,
-	 * and can realloc() it to grow it, and should free() it to
-	 * delete it.
-	 */
-	int yy_is_our_buffer;
-
-	/* Whether this is an "interactive" input source; if so, and
-	 * if we're using stdio for input, then we want to use getc()
-	 * instead of fread(), to make sure we stop fetching input after
-	 * each newline.
-	 */
-	int yy_is_interactive;
-
-	/* Whether we're considered to be at the beginning of a line.
-	 * If so, '^' rules will be active on the next match, otherwise
-	 * not.
-	 */
-	int yy_at_bol;
-
-    int yy_bs_lineno; /**< The line count. */
-    int yy_bs_column; /**< The column count. */
-    
-	/* Whether to try to fill the input buffer when we reach the
-	 * end of it.
-	 */
-	int yy_fill_buffer;
-
-	int yy_buffer_status;
-
-#define YY_BUFFER_NEW 0
-#define YY_BUFFER_NORMAL 1
-	/* When an EOF's been seen but there's still some text to process
-	 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
-	 * shouldn't try reading from the input source any more.  We might
-	 * still have a bunch of tokens to match, though, because of
-	 * possible backing-up.
-	 *
-	 * When we actually see the EOF, we change the status to "new"
-	 * (via vdb_kfg_yyrestart()), so that the user can continue scanning by
-	 * just pointing yyin at a new input file.
-	 */
-#define YY_BUFFER_EOF_PENDING 2
-
-	};
-#endif /* !YY_STRUCT_YY_BUFFER_STATE */
-
-/* We provide macros for accessing buffer states in case in the
- * future we want to put the buffer states in a more general
- * "scanner state".
- *
- * Returns the top of the stack, or NULL.
- */
-#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
-                          ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
-                          : NULL)
-
-/* Same as previous macro, but useful when we know that the buffer stack is not
- * NULL or when we need an lvalue. For internal use only.
- */
-#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
-
-void vdb_kfg_yyrestart (FILE *input_file ,yyscan_t yyscanner );
-void vdb_kfg_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
-YY_BUFFER_STATE vdb_kfg_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
-void vdb_kfg_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
-void vdb_kfg_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
-void vdb_kfg_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
-void vdb_kfg_yypop_buffer_state (yyscan_t yyscanner );
-
-static void vdb_kfg_yyensure_buffer_stack (yyscan_t yyscanner );
-static void vdb_kfg_yy_load_buffer_state (yyscan_t yyscanner );
-static void vdb_kfg_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
-
-#define YY_FLUSH_BUFFER vdb_kfg_yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
-
-YY_BUFFER_STATE vdb_kfg_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
-YY_BUFFER_STATE vdb_kfg_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
-YY_BUFFER_STATE vdb_kfg_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
-
-void *vdb_kfg_yyalloc (yy_size_t ,yyscan_t yyscanner );
-void *vdb_kfg_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
-void vdb_kfg_yyfree (void * ,yyscan_t yyscanner );
-
-#define yy_new_buffer vdb_kfg_yy_create_buffer
-
-#define yy_set_interactive(is_interactive) \
-	{ \
-	if ( ! YY_CURRENT_BUFFER ){ \
-        vdb_kfg_yyensure_buffer_stack (yyscanner); \
-		YY_CURRENT_BUFFER_LVALUE =    \
-            vdb_kfg_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
-	} \
-	YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
-	}
-
-#define yy_set_bol(at_bol) \
-	{ \
-	if ( ! YY_CURRENT_BUFFER ){\
-        vdb_kfg_yyensure_buffer_stack (yyscanner); \
-		YY_CURRENT_BUFFER_LVALUE =    \
-            vdb_kfg_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
-	} \
-	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
-	}
-
-#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
-
-/* Begin user sect3 */
-
-#define vdb_kfg_yywrap(n) 1
-#define YY_SKIP_YYWRAP
-
-typedef unsigned char YY_CHAR;
-
-typedef int yy_state_type;
-
-#define yytext_ptr yytext_r
-
-static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
-static yy_state_type yy_try_NUL_trans (yy_state_type current_state  ,yyscan_t yyscanner);
-static int yy_get_next_buffer (yyscan_t yyscanner );
-static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
-
-/* Done after the current pattern has been matched and before the
- * corresponding action - sets up yytext.
- */
-#define YY_DO_BEFORE_ACTION \
-	yyg->yytext_ptr = yy_bp; \
-	yyleng = (size_t) (yy_cp - yy_bp); \
-	yyg->yy_hold_char = *yy_cp; \
-	*yy_cp = '\0'; \
-	yyg->yy_c_buf_p = yy_cp;
-
-#define YY_NUM_RULES 35
-#define YY_END_OF_BUFFER 36
-/* This struct is not used in this scanner,
-   but its presence is necessary. */
-struct yy_trans_info
-	{
-	flex_int32_t yy_verify;
-	flex_int32_t yy_nxt;
-	};
-static yyconst flex_int16_t yy_accept[135] =
-    {   0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-       13,   13,   36,   34,    8,    9,   24,    7,   34,   15,
-       34,   11,   32,    2,    4,   35,   35,   35,   35,   31,
-       35,   35,   35,   22,   13,   13,   24,   23,    0,    0,
-        7,    0,   15,    0,   14,    0,    1,   10,   11,    0,
-        2,    3,    4,    0,    5,    0,    6,    0,   31,    0,
-       29,    0,    0,   22,   20,   13,   13,   23,    0,   27,
-       26,   26,    0,    0,   14,   18,   17,   17,   10,    0,
-       11,   30,   21,   13,   27,   26,   25,   26,    0,   26,
-        0,   33,    0,    0,   18,   17,   17,   16,    0,   17,
-
-        0,   10,   11,   12,   13,   13,    0,   26,   25,   26,
-       26,   26,   28,    0,    0,   17,   17,   16,   17,   17,
-       19,   10,   13,   26,   25,   26,   26,    0,   17,   17,
-       16,   17,   13,    0
-    } ;
-
-static yyconst flex_int32_t yy_ec[256] =
-    {   0,
-        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
-        2,    4,    4,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    2,    1,    5,    6,    7,    1,    1,    8,    9,
-       10,   11,    1,    1,   12,   12,   13,   14,   14,   14,
-       14,   14,   14,   14,   14,   14,   14,    1,    1,    1,
-       15,    1,    1,    1,   14,   14,   14,   14,   14,   14,
-       14,   14,   14,   14,   14,   14,   14,   14,   14,   14,
-       14,   14,   14,   14,   14,   14,   14,   14,   14,   14,
-        1,   16,    1,    1,   14,    1,   14,   14,   14,   14,
-
-       14,   14,   14,   14,   14,   14,   14,   14,   14,   14,
-       14,   14,   14,   14,   14,   14,   14,   14,   14,   14,
-       14,   14,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1
-    } ;
-
-static yyconst flex_int32_t yy_meta[17] =
-    {   0,
-        1,    1,    2,    3,    1,    1,    1,    1,    1,    4,
-        5,    6,    6,    6,    1,    7
-    } ;
-
-static yyconst flex_int16_t yy_base[163] =
-    {   0,
-        0,    0,   14,   15,   16,   17,   26,   40,   54,   68,
-       82,   90,   86,  670,  670,  670,   96,    0,   74,  106,
-       10,   69,  670,    0,  670,  120,  131,   27,  670,  670,
-      142,   15,  149,  670,    0,   72,  154,  670,  168,    0,
-        0,   66,  178,  192,  670,    0,  670,   66,   65,   63,
-        0,  206,  670,  217,  670,  228,  670,   30,  670,   65,
-      670,   31,   64,  670,  670,    0,   55,  670,   59,  670,
-      237,  249,  256,   58,  670,  670,  264,  274,   53,   51,
-       51,  670,  670,  281,  670,  291,  670,  305,    0,  317,
-      331,  670,    0,   49,  670,  341,  355,  670,    0,  365,
-
-      379,   47,   46,  670,    0,   41,  393,    0,    0,  407,
-      420,    0,  670,   34,  434,    0,  448,    0,  461,    0,
-      670,   41,   37,    0,    0,    0,  474,    0,    0,    0,
-        0,  487,   38,  670,  503,  510,  517,  524,  531,  538,
-      545,   47,  552,  559,  566,  572,  578,  585,  592,   35,
-      599,  606,  613,  620,   34,  627,  634,  641,  648,   30,
-      655,  662
-    } ;
-
-static yyconst flex_int16_t yy_def[163] =
-    {   0,
-      134,    1,  135,  135,  135,  135,  136,  136,  137,  137,
-      138,  138,  134,  134,  134,  134,  139,  140,  134,  141,
-      134,  142,  134,  143,  134,  144,  144,  145,  134,  134,
-      145,  146,  146,  134,  147,  147,  139,  134,  139,  148,
-      140,  134,  141,  141,  134,  149,  134,  150,  142,  134,
-      143,  144,  134,  144,  134,  144,  134,  145,  134,   31,
-      134,  146,   33,  134,  134,  147,  147,  134,   39,  134,
-      151,  152,  134,   44,  134,  134,  153,  154,  150,  134,
-      155,  134,  134,  147,  134,  151,  134,  156,  157,  152,
-      152,  134,   73,  134,  134,  153,  158,  134,  159,  154,
-
-      154,  160,  155,  134,   84,  147,  151,   86,   86,  156,
-      161,   86,  134,   73,  153,   96,  158,   96,  162,   96,
-      134,  160,   84,   86,   86,  110,  161,  114,   96,  117,
-       96,  162,   84,    0,  134,  134,  134,  134,  134,  134,
-      134,  134,  134,  134,  134,  134,  134,  134,  134,  134,
-      134,  134,  134,  134,  134,  134,  134,  134,  134,  134,
-      134,  134
-    } ;
-
-static yyconst flex_int16_t yy_nxt[687] =
-    {   0,
-       14,   15,   16,   15,   17,   18,   19,   20,   14,   14,
-       14,   14,   21,   22,   23,   14,   25,   25,   25,   25,
-       47,   63,   64,   48,   26,   26,   27,   27,   29,   29,
-       30,   59,   31,   60,   59,  122,   60,   63,   64,  103,
-       79,   29,   29,   29,   30,  128,   31,  128,  133,  133,
-      133,  133,   49,   80,  123,   29,   29,   29,   50,   80,
-       33,   34,  114,   50,  102,   80,   95,   85,   84,   29,
-       29,   29,   83,   82,   33,   34,   81,   50,   80,   73,
-       67,   50,   42,   29,   29,  134,  134,  134,   36,  134,
-      134,   29,   29,  134,  134,  134,   36,  134,  134,   29,
-
-       38,  134,   39,  134,  134,  134,  134,  134,  134,  134,
-      134,   40,   44,   45,  134,  134,  134,  134,  134,  134,
-      134,   46,   53,  134,  134,  134,  134,  134,  134,  134,
-       54,  134,   55,   53,  134,  134,  134,  134,  134,  134,
-      134,   56,  134,   57,   58,   58,  134,  134,  134,  134,
-       61,   62,   62,  134,  134,  134,  134,   65,   68,  134,
-       69,  134,  134,  134,  134,  134,  134,  134,  134,   40,
-       37,   37,  134,  134,  134,  134,   70,  134,  134,  134,
-      134,  134,  134,   71,   74,   75,  134,  134,  134,  134,
-      134,  134,  134,   46,   43,   43,  134,  134,  134,  134,
-
-       76,  134,  134,  134,  134,  134,  134,   77,  134,  134,
-      134,  134,  134,  134,  134,  134,  134,  134,  134,   53,
-      134,  134,  134,  134,  134,  134,  134,   54,  134,   55,
-       53,  134,  134,  134,  134,  134,  134,  134,   56,  134,
-       57,   87,  134,   88,  134,  134,  134,  134,  134,  134,
-      134,  134,   89,   87,  134,   91,  134,  134,  134,  134,
-      134,  134,  134,  134,   40,   92,  134,   93,   94,   93,
-       97,   98,  134,  134,  134,  134,  134,  134,  134,   99,
-      101,   98,  134,  134,  134,  134,  134,  134,  134,   46,
-      104,  134,  105,  106,  105,   87,  134,  107,  134,  134,
-
-      134,  134,  134,  134,  134,  134,   89,   86,   86,  109,
-      134,  110,  134,   86,  134,  134,  134,  134,  134,  134,
-      111,   87,  134,   91,  134,  134,  134,  134,  134,  134,
-      134,  134,   40,   90,   90,  134,  134,  134,  134,  113,
-      134,  134,  134,  134,  134,  134,   71,  115,   98,  134,
-      134,  134,  134,  134,  134,  134,   99,   96,   96,  134,
-      134,  117,  118,   96,  134,  134,  134,  134,  134,  134,
-      119,  101,   98,  134,  134,  134,  134,  134,  134,  134,
-       46,  100,  100,  134,  134,  134,  134,  121,  134,  134,
-      134,  134,  134,  134,   77,   86,   86,  134,  134,  134,
-
-      134,  134,  134,  134,  134,  134,  134,  134,   71,   86,
-       86,  109,  134,  110,  134,   86,  134,  134,  134,  134,
-      134,  134,  111,  112,  125,  134,  126,  134,  134,  134,
-      134,  134,  134,  134,  134,  127,   96,   96,  134,  134,
-      134,  134,  134,  134,  134,  134,  134,  134,  134,   77,
-       96,   96,  134,  134,  117,  118,   96,  134,  134,  134,
-      134,  134,  134,  119,  120,  134,  134,  130,  131,  134,
-      134,  134,  134,  134,  134,  134,  132,  112,  125,  134,
-       88,  134,  134,  134,  134,  134,  134,  134,  134,  127,
-      120,  134,  134,   97,  131,  134,  134,  134,  134,  134,
-
-      134,  134,  132,   24,   24,   24,   24,   24,   24,   24,
-       28,   28,   28,   28,   28,   28,   28,   32,   32,   32,
-       32,   32,   32,   32,   35,   35,   35,   35,   35,   35,
-       35,   37,  134,  134,   37,   37,   37,   37,   41,  134,
-       41,   41,   41,   41,   41,   43,  134,  134,   43,   43,
-       43,   43,   51,  134,   51,   51,  134,   51,   51,   52,
-       52,   52,   52,   52,   52,   52,   58,  134,  134,   58,
-       58,   58,   62,  134,  134,   62,   62,   62,   66,  134,
-       66,  134,   66,   66,   66,   72,  134,   72,   72,   72,
-       72,   72,   78,  134,   78,   78,   78,   78,   78,   86,
-
-      134,  134,   86,   86,   86,   86,   90,  134,  134,   90,
-       90,   90,   90,   96,  134,  134,   96,   96,   96,   96,
-      100,  134,  134,  100,  100,  100,  100,  108,  108,  108,
-      108,  108,  108,  108,  112,  134,  112,  112,  112,  112,
-      112,  116,  116,  116,  116,  116,  116,  116,  120,  134,
-      120,  120,  120,  120,  120,  124,  134,  124,  124,  124,
-      124,  124,  129,  134,  129,  129,  129,  129,  129,   13,
-      134,  134,  134,  134,  134,  134,  134,  134,  134,  134,
-      134,  134,  134,  134,  134,  134
-    } ;
-
-static yyconst flex_int16_t yy_chk[687] =
-    {   0,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    3,    4,    5,    6,
-       21,   32,   32,   21,    3,    4,    5,    6,    7,    7,
-        7,   28,    7,   28,   58,  160,   58,   62,   62,  155,
-      150,    7,    8,    8,    8,  114,    8,  114,  123,  133,
-      123,  133,  142,  122,  106,    8,    9,    9,  103,  102,
-        9,    9,   94,   81,   80,   79,   74,   69,   67,    9,
-       10,   10,   63,   60,   10,   10,   50,   49,   48,   42,
-       36,   22,   19,   10,   11,   13,    0,    0,   11,    0,
-        0,   11,   12,    0,    0,    0,   12,    0,    0,   12,
-
-       17,    0,   17,    0,    0,    0,    0,    0,    0,    0,
-        0,   17,   20,   20,    0,    0,    0,    0,    0,    0,
-        0,   20,   26,    0,    0,    0,    0,    0,    0,    0,
-       26,    0,   26,   27,    0,    0,    0,    0,    0,    0,
-        0,   27,    0,   27,   31,   31,    0,    0,    0,    0,
-       31,   33,   33,    0,    0,    0,    0,   33,   37,    0,
-       37,    0,    0,    0,    0,    0,    0,    0,    0,   37,
-       39,   39,    0,    0,    0,    0,   39,    0,    0,    0,
-        0,    0,    0,   39,   43,   43,    0,    0,    0,    0,
-        0,    0,    0,   43,   44,   44,    0,    0,    0,    0,
-
-       44,    0,    0,    0,    0,    0,    0,   44,   52,    0,
-        0,    0,    0,    0,    0,    0,   52,    0,   52,   54,
-        0,    0,    0,    0,    0,    0,    0,   54,    0,   54,
-       56,    0,    0,    0,    0,    0,    0,    0,   56,    0,
-       56,   71,    0,   71,    0,    0,    0,    0,    0,    0,
-        0,    0,   71,   72,    0,   72,    0,    0,    0,    0,
-        0,    0,    0,    0,   72,   73,    0,   73,   73,   73,
-       77,   77,    0,    0,    0,    0,    0,    0,    0,   77,
-       78,   78,    0,    0,    0,    0,    0,    0,    0,   78,
-       84,    0,   84,   84,   84,   86,    0,   86,    0,    0,
-
-        0,    0,    0,    0,    0,    0,   86,   88,   88,   88,
-        0,   88,    0,   88,    0,    0,    0,    0,    0,    0,
-       88,   90,    0,   90,    0,    0,    0,    0,    0,    0,
-        0,    0,   90,   91,   91,    0,    0,    0,    0,   91,
-        0,    0,    0,    0,    0,    0,   91,   96,   96,    0,
-        0,    0,    0,    0,    0,    0,   96,   97,   97,    0,
-        0,   97,   97,   97,    0,    0,    0,    0,    0,    0,
-       97,  100,  100,    0,    0,    0,    0,    0,    0,    0,
-      100,  101,  101,    0,    0,    0,    0,  101,    0,    0,
-        0,    0,    0,    0,  101,  107,  107,    0,    0,    0,
-
-        0,  107,    0,    0,    0,    0,    0,    0,  107,  110,
-      110,  110,    0,  110,    0,  110,    0,    0,    0,    0,
-        0,    0,  110,  111,  111,    0,  111,    0,    0,    0,
-        0,    0,    0,    0,    0,  111,  115,  115,    0,    0,
-        0,    0,  115,    0,    0,    0,    0,    0,    0,  115,
-      117,  117,    0,    0,  117,  117,  117,    0,    0,    0,
-        0,    0,    0,  117,  119,    0,    0,  119,  119,    0,
-        0,    0,    0,    0,    0,    0,  119,  127,  127,    0,
-      127,    0,    0,    0,    0,    0,    0,    0,    0,  127,
-      132,    0,    0,  132,  132,    0,    0,    0,    0,    0,
-
-        0,    0,  132,  135,  135,  135,  135,  135,  135,  135,
-      136,  136,  136,  136,  136,  136,  136,  137,  137,  137,
-      137,  137,  137,  137,  138,  138,  138,  138,  138,  138,
-      138,  139,    0,    0,  139,  139,  139,  139,  140,    0,
-      140,  140,  140,  140,  140,  141,    0,    0,  141,  141,
-      141,  141,  143,    0,  143,  143,    0,  143,  143,  144,
-      144,  144,  144,  144,  144,  144,  145,    0,    0,  145,
-      145,  145,  146,    0,    0,  146,  146,  146,  147,    0,
-      147,    0,  147,  147,  147,  148,    0,  148,  148,  148,
-      148,  148,  149,    0,  149,  149,  149,  149,  149,  151,
-
-        0,    0,  151,  151,  151,  151,  152,    0,    0,  152,
-      152,  152,  152,  153,    0,    0,  153,  153,  153,  153,
-      154,    0,    0,  154,  154,  154,  154,  156,  156,  156,
-      156,  156,  156,  156,  157,    0,  157,  157,  157,  157,
-      157,  158,  158,  158,  158,  158,  158,  158,  159,    0,
-      159,  159,  159,  159,  159,  161,    0,  161,  161,  161,
-      161,  161,  162,    0,  162,  162,  162,  162,  162,  134,
-      134,  134,  134,  134,  134,  134,  134,  134,  134,  134,
-      134,  134,  134,  134,  134,  134
-    } ;
-
-/* Table of booleans, true if rule could match eol. */
-static yyconst flex_int32_t yy_rule_can_match_eol[36] =
-    {   0,
-0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 
-    0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0,     };
-
-/* The intent behind this definition is that it'll catch
- * any uses of REJECT which flex missed.
- */
-#define REJECT reject_used_but_not_detected
-#define yymore() yymore_used_but_not_detected
-#define YY_MORE_ADJ 0
-#define YY_RESTORE_YY_MORE_OFFSET
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-    #include "kfg-parse.h"
-    #include <sysalloc.h>
-    #include "config-tokens.h"    
-    
-    #define YYSTYPE KFGParseBlock
-    
-    /* code to populate token with internal values */
-    #define YY_USER_ACTION              \
-        yylval -> tokenText     = yytext;   \
-        yylval -> tokenLength   = yyleng;   \
-        yylval -> line_no       = yylineno; \
-        yylval -> column_no     = yycolumn; \
-        yycolumn += yyleng; 
-        
-    #define REM_LQUOTE \
-        ++ yylval -> tokenText; \
-        -- yylval -> tokenLength; \
-        ++ yylval -> column_no;
-        
-    #define REM_RQUOTE \
-        -- yylval -> tokenLength; 
-#define YY_NO_UNISTD_H 1
-/* re-entrant scanner */
-/* bison options */
-/* maintain state stack */
-/* let parser handle EOF */
-/* start-state for slash-star comments */
-
-/* states for strings */
-
-/* in-string variable reference */
-
-/* node/name in a path */
-
-#define INITIAL 0
-#define CMT_SLASH_STAR 1
-#define CMT_MULTI_LINE 2
-#define IN_DBL_STRING 3
-#define IN_SNG_STRING 4
-#define IN_VAR_REF 5
-
-#ifndef YY_NO_UNISTD_H
-/* Special case for "unistd.h", since it is non-ANSI. We include it way
- * down here because we want the user's section 1 to have been scanned first.
- * The user has a chance to override it with an option.
- */
-#include <unistd.h>
-#endif
-
-#ifndef YY_EXTRA_TYPE
-#define YY_EXTRA_TYPE void *
-#endif
-
-/* Holds the entire state of the reentrant scanner. */
-struct yyguts_t
-    {
-
-    /* User-defined. Not touched by flex. */
-    YY_EXTRA_TYPE yyextra_r;
-
-    /* The rest are the same as the globals declared in the non-reentrant scanner. */
-    FILE *yyin_r, *yyout_r;
-    size_t yy_buffer_stack_top; /**< index of top of stack. */
-    size_t yy_buffer_stack_max; /**< capacity of stack. */
-    YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
-    char yy_hold_char;
-    int yy_n_chars;
-    int yyleng_r;
-    char *yy_c_buf_p;
-    int yy_init;
-    int yy_start;
-    int yy_did_buffer_switch_on_eof;
-    int yy_start_stack_ptr;
-    int yy_start_stack_depth;
-    int *yy_start_stack;
-    yy_state_type yy_last_accepting_state;
-    char* yy_last_accepting_cpos;
-
-    int yylineno_r;
-    int yy_flex_debug_r;
-
-    char *yytext_r;
-    int yy_more_flag;
-    int yy_more_len;
-
-    YYSTYPE * yylval_r;
-
-    }; /* end struct yyguts_t */
-
-static int yy_init_globals (yyscan_t yyscanner );
-
-    /* This must go here because YYSTYPE and YYLTYPE are included
-     * from bison output in section 1.*/
-    #    define yylval yyg->yylval_r
-    
-int vdb_kfg_yylex_init (yyscan_t* scanner);
-
-int vdb_kfg_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
-
-/* Accessor methods to globals.
-   These are made visible to non-reentrant scanners for convenience. */
-
-int vdb_kfg_yylex_destroy (yyscan_t yyscanner );
-
-int vdb_kfg_yyget_debug (yyscan_t yyscanner );
-
-void vdb_kfg_yyset_debug (int debug_flag ,yyscan_t yyscanner );
-
-YY_EXTRA_TYPE vdb_kfg_yyget_extra (yyscan_t yyscanner );
-
-void vdb_kfg_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
-
-FILE *vdb_kfg_yyget_in (yyscan_t yyscanner );
-
-void vdb_kfg_yyset_in  (FILE * in_str ,yyscan_t yyscanner );
-
-FILE *vdb_kfg_yyget_out (yyscan_t yyscanner );
-
-void vdb_kfg_yyset_out  (FILE * out_str ,yyscan_t yyscanner );
-
-int vdb_kfg_yyget_leng (yyscan_t yyscanner );
-
-char *vdb_kfg_yyget_text (yyscan_t yyscanner );
-
-int vdb_kfg_yyget_lineno (yyscan_t yyscanner );
-
-void vdb_kfg_yyset_lineno (int line_number ,yyscan_t yyscanner );
-
-YYSTYPE * vdb_kfg_yyget_lval (yyscan_t yyscanner );
-
-void vdb_kfg_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
-
-/* Macros after this point can all be overridden by user definitions in
- * section 1.
- */
-
-#ifndef YY_SKIP_YYWRAP
-#ifdef __cplusplus
-extern "C" int vdb_kfg_yywrap (yyscan_t yyscanner );
-#else
-extern int vdb_kfg_yywrap (yyscan_t yyscanner );
-#endif
-#endif
-
-    static void yyunput (int c,char *buf_ptr  ,yyscan_t yyscanner);
-    
-#ifndef yytext_ptr
-static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
-#endif
-
-#ifndef YY_NO_INPUT
-
-#ifdef __cplusplus
-static int yyinput (yyscan_t yyscanner );
-#else
-static int input (yyscan_t yyscanner );
-#endif
-
-#endif
-
-    static void yy_push_state (int new_state ,yyscan_t yyscanner);
-    
-    static void yy_pop_state (yyscan_t yyscanner );
-    
-    static int yy_top_state (yyscan_t yyscanner );
-    
-/* Amount of stuff to slurp up with each read. */
-#ifndef YY_READ_BUF_SIZE
-#define YY_READ_BUF_SIZE 8192
-#endif
-
-/* Copy whatever the last rule matched to the standard output. */
-#ifndef ECHO
-/* This used to be an fputs(), but since the string might contain NUL's,
- * we now use fwrite().
- */
-#define ECHO fwrite( yytext, yyleng, 1, yyout )
-#endif
-
-/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
- * is returned in "result".
- */
-#ifndef YY_INPUT
-#define YY_INPUT(buf,result,max_size) \
-	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
-		{ \
-		int c = '*'; \
-		int n; \
-		for ( n = 0; n < max_size && \
-			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
-			buf[n] = (char) c; \
-		if ( c == '\n' ) \
-			buf[n++] = (char) c; \
-		if ( c == EOF && ferror( yyin ) ) \
-			YY_FATAL_ERROR( "input in flex scanner failed" ); \
-		result = n; \
-		} \
-	else \
-		{ \
-		errno=0; \
-		while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
-			{ \
-			if( errno != EINTR) \
-				{ \
-				YY_FATAL_ERROR( "input in flex scanner failed" ); \
-				break; \
-				} \
-			errno=0; \
-			clearerr(yyin); \
-			} \
-		}\
-\
-
-#endif
-
-/* No semi-colon after return; correct usage is to write "yyterminate();" -
- * we don't want an extra ';' after the "return" because that will cause
- * some compilers to complain about unreachable statements.
- */
-#ifndef yyterminate
-#define yyterminate() return YY_NULL
-#endif
-
-/* Number of entries by which start-condition stack grows. */
-#ifndef YY_START_STACK_INCR
-#define YY_START_STACK_INCR 25
-#endif
-
-/* Report a fatal error. */
-#ifndef YY_FATAL_ERROR
-#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
-#endif
-
-/* end tables serialization structures and prototypes */
-
-/* Default declaration of generated scanner - a define so the user can
- * easily add parameters.
- */
-#ifndef YY_DECL
-#define YY_DECL_IS_OURS 1
-
-extern int vdb_kfg_yylex \
-               (YYSTYPE * yylval_param ,yyscan_t yyscanner);
-
-#define YY_DECL int vdb_kfg_yylex \
-               (YYSTYPE * yylval_param , yyscan_t yyscanner)
-#endif /* !YY_DECL */
-
-/* Code executed at the beginning of each rule, after yytext and yyleng
- * have been set up.
- */
-#ifndef YY_USER_ACTION
-#define YY_USER_ACTION
-#endif
-
-/* Code executed at the end of each rule. */
-#ifndef YY_BREAK
-#define YY_BREAK break;
-#endif
-
-#define YY_RULE_SETUP \
-	YY_USER_ACTION
-
-/** The main scanner function which does all the work.
- */
-YY_DECL
-{
-	register yy_state_type yy_current_state;
-	register char *yy_cp, *yy_bp;
-	register int yy_act;
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- /* multi-line comments */
-
-    yylval = yylval_param;
-
-	if ( !yyg->yy_init )
-		{
-		yyg->yy_init = 1;
-
-#ifdef YY_USER_INIT
-		YY_USER_INIT;
-#endif
-
-		if ( ! yyg->yy_start )
-			yyg->yy_start = 1;	/* first start state */
-
-		if ( ! yyin )
-			yyin = stdin;
-
-		if ( ! yyout )
-			yyout = stdout;
-
-		if ( ! YY_CURRENT_BUFFER ) {
-			vdb_kfg_yyensure_buffer_stack (yyscanner);
-			YY_CURRENT_BUFFER_LVALUE =
-				vdb_kfg_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
-		}
-
-		vdb_kfg_yy_load_buffer_state(yyscanner );
-		}
-
-	while ( 1 )		/* loops until end-of-file is reached */
-		{
-		yy_cp = yyg->yy_c_buf_p;
-
-		/* Support of yytext. */
-		*yy_cp = yyg->yy_hold_char;
-
-		/* yy_bp points to the position in yy_ch_buf of the start of
-		 * the current run.
-		 */
-		yy_bp = yy_cp;
-
-		yy_current_state = yyg->yy_start;
-yy_match:
-		do
-			{
-			register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
-			if ( yy_accept[yy_current_state] )
-				{
-				yyg->yy_last_accepting_state = yy_current_state;
-				yyg->yy_last_accepting_cpos = yy_cp;
-				}
-			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
-				{
-				yy_current_state = (int) yy_def[yy_current_state];
-				if ( yy_current_state >= 135 )
-					yy_c = yy_meta[(unsigned int) yy_c];
-				}
-			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-			++yy_cp;
-			}
-		while ( yy_current_state != 134 );
-		yy_cp = yyg->yy_last_accepting_cpos;
-		yy_current_state = yyg->yy_last_accepting_state;
-
-yy_find_action:
-		yy_act = yy_accept[yy_current_state];
-
-		YY_DO_BEFORE_ACTION;
-
-		if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
-			{
-			int yyl;
-			for ( yyl = 0; yyl < yyleng; ++yyl )
-				if ( yytext[yyl] == '\n' )
-					   
-    do{ yylineno++;
-        yycolumn=0;
-    }while(0)
-;
-			}
-
-do_action:	/* This label is used only to access EOF actions. */
-
-		switch ( yy_act )
-	{ /* beginning of action switch */
-			case 0: /* must back up */
-			/* undo the effects of YY_DO_BEFORE_ACTION */
-			*yy_cp = yyg->yy_hold_char;
-			yy_cp = yyg->yy_last_accepting_cpos;
-			yy_current_state = yyg->yy_last_accepting_state;
-			goto yy_find_action;
-
-case 1:
-YY_RULE_SETUP
-{ yy_push_state ( CMT_SLASH_STAR, yyscanner ); }
-	YY_BREAK
-case 2:
-YY_RULE_SETUP
-/* ignore */
-	YY_BREAK
-case 3:
-YY_RULE_SETUP
-/* ignore */
-	YY_BREAK
-case 4:
-/* rule 4 can match eol */
-YY_RULE_SETUP
-{ BEGIN CMT_MULTI_LINE; }
-	YY_BREAK
-case 5:
-YY_RULE_SETUP
-{ yy_pop_state ( yyscanner ); }
-	YY_BREAK
-case 6:
-YY_RULE_SETUP
-{ yy_pop_state ( yyscanner ); return kfgEND_LINE; }
-	YY_BREAK
-/* line comments */
-case 7:
-YY_RULE_SETUP
-/* ignore */
-	YY_BREAK
-/* ignored tokens */
-case 8:
-YY_RULE_SETUP
-/* ignore */
-	YY_BREAK
-/* end of line is significant */
-case 9:
-/* rule 9 can match eol */
-YY_RULE_SETUP
-{ return kfgEND_LINE; }
-	YY_BREAK
-/* normal, POSIX-style paths */
-case 10:
-YY_RULE_SETUP
-{ return kfgABS_PATH; }
-	YY_BREAK
-case 11:
-YY_RULE_SETUP
-{ return kfgREL_PATH; }
-	YY_BREAK
-/* variable references inside strings */
-case 12:
-YY_RULE_SETUP
-{ yy_pop_state ( yyscanner ); return kfgVAR_REF; }
-	YY_BREAK
-case 13:
-YY_RULE_SETUP
-{ yy_pop_state ( yyscanner ); return kfgUNTERM_VAR_REF; }
-	YY_BREAK
-case YY_STATE_EOF(IN_VAR_REF):
-{ yy_pop_state ( yyscanner ); return kfgUNTERM_VAR_REF; } 
-	YY_BREAK
-/* single quoted strings */
-case 14:
-/* rule 14 can match eol */
-YY_RULE_SETUP
-{ REM_LQUOTE; REM_RQUOTE; return kfgSTRING; }
-	YY_BREAK
-case 15:
-/* rule 15 can match eol */
-YY_RULE_SETUP
-{ REM_LQUOTE; return kfgUNTERM_STRING; }
-	YY_BREAK
-case 16:
-/* rule 16 can match eol */
-YY_RULE_SETUP
-{ REM_LQUOTE; REM_RQUOTE; return kfgESCAPED_STRING; }
-	YY_BREAK
-case 17:
-/* rule 17 can match eol */
-YY_RULE_SETUP
-{ REM_LQUOTE; return kfgUNTERM_ESCAPED_STRING; }
-	YY_BREAK
-/* single quoted strings with variable references*/
-case 18:
-/* rule 18 can match eol */
-*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
-yyg->yy_c_buf_p = yy_cp -= 2;
-YY_DO_BEFORE_ACTION; /* set up yytext again */
-YY_RULE_SETUP
-{ REM_LQUOTE; yy_push_state ( IN_SNG_STRING, yyscanner ); yy_push_state ( IN_VAR_REF, yyscanner ); return kfgSTRING; }
-	YY_BREAK
-case 19:
-/* rule 19 can match eol */
-*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
-yyg->yy_c_buf_p = yy_cp -= 2;
-YY_DO_BEFORE_ACTION; /* set up yytext again */
-YY_RULE_SETUP
-{ REM_LQUOTE; yy_push_state ( IN_SNG_STRING, yyscanner ); yy_push_state ( IN_VAR_REF, yyscanner ); return kfgESCAPED_STRING; }
-	YY_BREAK
-case 20:
-YY_RULE_SETUP
-{ yy_push_state ( IN_VAR_REF, yyscanner ); yyless(0); }
-	YY_BREAK
-case 21:
-/* rule 21 can match eol */
-*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
-yyg->yy_c_buf_p = yy_cp -= 2;
-YY_DO_BEFORE_ACTION; /* set up yytext again */
-YY_RULE_SETUP
-{ yy_push_state ( IN_VAR_REF, yyscanner ); return kfgSTRING; }
-	YY_BREAK
-case 22:
-/* rule 22 can match eol */
-YY_RULE_SETUP
-{ REM_RQUOTE; yy_pop_state ( yyscanner ); return kfgSTRING; } 
-	YY_BREAK
-/* double quoted strings */
-case 23:
-/* rule 23 can match eol */
-YY_RULE_SETUP
-{ REM_LQUOTE; REM_RQUOTE; return kfgSTRING; }
-	YY_BREAK
-case 24:
-/* rule 24 can match eol */
-YY_RULE_SETUP
-{ REM_LQUOTE; return kfgUNTERM_STRING; }
-	YY_BREAK
-case 25:
-/* rule 25 can match eol */
-YY_RULE_SETUP
-{ REM_LQUOTE; REM_RQUOTE; return kfgESCAPED_STRING; }
-	YY_BREAK
-case 26:
-/* rule 26 can match eol */
-YY_RULE_SETUP
-{ REM_LQUOTE; return kfgUNTERM_ESCAPED_STRING; }
-	YY_BREAK
-/* double quoted strings with variable references*/
-case 27:
-/* rule 27 can match eol */
-*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
-yyg->yy_c_buf_p = yy_cp -= 2;
-YY_DO_BEFORE_ACTION; /* set up yytext again */
-YY_RULE_SETUP
-{ REM_LQUOTE; yy_push_state ( IN_DBL_STRING, yyscanner ); yy_push_state ( IN_VAR_REF, yyscanner ); return kfgSTRING; }
-	YY_BREAK
-case 28:
-/* rule 28 can match eol */
-*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
-yyg->yy_c_buf_p = yy_cp -= 2;
-YY_DO_BEFORE_ACTION; /* set up yytext again */
-YY_RULE_SETUP
-{ REM_LQUOTE; yy_push_state ( IN_DBL_STRING, yyscanner ); yy_push_state ( IN_VAR_REF, yyscanner ); return kfgESCAPED_STRING; }
-	YY_BREAK
-case 29:
-YY_RULE_SETUP
-{ yy_push_state ( IN_VAR_REF, yyscanner ); yyless(0); }
-	YY_BREAK
-case 30:
-/* rule 30 can match eol */
-*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
-yyg->yy_c_buf_p = yy_cp -= 2;
-YY_DO_BEFORE_ACTION; /* set up yytext again */
-YY_RULE_SETUP
-{ yy_push_state ( IN_VAR_REF, yyscanner ); return kfgSTRING; }
-	YY_BREAK
-case 31:
-/* rule 31 can match eol */
-YY_RULE_SETUP
-{ REM_RQUOTE; yy_pop_state ( yyscanner ); return kfgSTRING; } 
-	YY_BREAK
-/* literals */
-case 32:
-YY_RULE_SETUP
-{ return kfgASSIGN; }
-	YY_BREAK
-case 33:
-YY_RULE_SETUP
-{ return kfgVAR_REF; }
-	YY_BREAK
-/* unrecognized input */
-case 34:
-YY_RULE_SETUP
-{ return kfgUNRECOGNIZED; }
-	YY_BREAK
-case 35:
-YY_RULE_SETUP
-ECHO;
-	YY_BREAK
-case YY_STATE_EOF(INITIAL):
-case YY_STATE_EOF(CMT_SLASH_STAR):
-case YY_STATE_EOF(CMT_MULTI_LINE):
-case YY_STATE_EOF(IN_DBL_STRING):
-case YY_STATE_EOF(IN_SNG_STRING):
-	yyterminate();
-
-	case YY_END_OF_BUFFER:
-		{
-		/* Amount of text matched not including the EOB char. */
-		int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
-
-		/* Undo the effects of YY_DO_BEFORE_ACTION. */
-		*yy_cp = yyg->yy_hold_char;
-		YY_RESTORE_YY_MORE_OFFSET
-
-		if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
-			{
-			/* We're scanning a new file or input source.  It's
-			 * possible that this happened because the user
-			 * just pointed yyin at a new source and called
-			 * vdb_kfg_yylex().  If so, then we have to assure
-			 * consistency between YY_CURRENT_BUFFER and our
-			 * globals.  Here is the right place to do so, because
-			 * this is the first action (other than possibly a
-			 * back-up) that will match for the new input source.
-			 */
-			yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
-			YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
-			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
-			}
-
-		/* Note that here we test for yy_c_buf_p "<=" to the position
-		 * of the first EOB in the buffer, since yy_c_buf_p will
-		 * already have been incremented past the NUL character
-		 * (since all states make transitions on EOB to the
-		 * end-of-buffer state).  Contrast this with the test
-		 * in input().
-		 */
-		if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
-			{ /* This was really a NUL. */
-			yy_state_type yy_next_state;
-
-			yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
-
-			yy_current_state = yy_get_previous_state( yyscanner );
-
-			/* Okay, we're now positioned to make the NUL
-			 * transition.  We couldn't have
-			 * yy_get_previous_state() go ahead and do it
-			 * for us because it doesn't know how to deal
-			 * with the possibility of jamming (and we don't
-			 * want to build jamming into it because then it
-			 * will run more slowly).
-			 */
-
-			yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
-
-			yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
-
-			if ( yy_next_state )
-				{
-				/* Consume the NUL. */
-				yy_cp = ++yyg->yy_c_buf_p;
-				yy_current_state = yy_next_state;
-				goto yy_match;
-				}
-
-			else
-				{
-				yy_cp = yyg->yy_last_accepting_cpos;
-				yy_current_state = yyg->yy_last_accepting_state;
-				goto yy_find_action;
-				}
-			}
-
-		else switch ( yy_get_next_buffer( yyscanner ) )
-			{
-			case EOB_ACT_END_OF_FILE:
-				{
-				yyg->yy_did_buffer_switch_on_eof = 0;
-
-				if ( vdb_kfg_yywrap(yyscanner ) )
-					{
-					/* Note: because we've taken care in
-					 * yy_get_next_buffer() to have set up
-					 * yytext, we can now set up
-					 * yy_c_buf_p so that if some total
-					 * hoser (like flex itself) wants to
-					 * call the scanner after we return the
-					 * YY_NULL, it'll still work - another
-					 * YY_NULL will get returned.
-					 */
-					yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
-
-					yy_act = YY_STATE_EOF(YY_START);
-					goto do_action;
-					}
-
-				else
-					{
-					if ( ! yyg->yy_did_buffer_switch_on_eof )
-						YY_NEW_FILE;
-					}
-				break;
-				}
-
-			case EOB_ACT_CONTINUE_SCAN:
-				yyg->yy_c_buf_p =
-					yyg->yytext_ptr + yy_amount_of_matched_text;
-
-				yy_current_state = yy_get_previous_state( yyscanner );
-
-				yy_cp = yyg->yy_c_buf_p;
-				yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
-				goto yy_match;
-
-			case EOB_ACT_LAST_MATCH:
-				yyg->yy_c_buf_p =
-				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
-
-				yy_current_state = yy_get_previous_state( yyscanner );
-
-				yy_cp = yyg->yy_c_buf_p;
-				yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
-				goto yy_find_action;
-			}
-		break;
-		}
-
-	default:
-		YY_FATAL_ERROR(
-			"fatal flex scanner internal error--no action found" );
-	} /* end of action switch */
-		} /* end of scanning one token */
-} /* end of vdb_kfg_yylex */
-
-/* yy_get_next_buffer - try to read in a new buffer
- *
- * Returns a code representing an action:
- *	EOB_ACT_LAST_MATCH -
- *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
- *	EOB_ACT_END_OF_FILE - end of file
- */
-static int yy_get_next_buffer (yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-	register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
-	register char *source = yyg->yytext_ptr;
-	register int number_to_move, i;
-	int ret_val;
-
-	if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
-		YY_FATAL_ERROR(
-		"fatal flex scanner internal error--end of buffer missed" );
-
-	if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
-		{ /* Don't try to fill the buffer, so this is an EOF. */
-		if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
-			{
-			/* We matched a single character, the EOB, so
-			 * treat this as a final EOF.
-			 */
-			return EOB_ACT_END_OF_FILE;
-			}
-
-		else
-			{
-			/* We matched some text prior to the EOB, first
-			 * process it.
-			 */
-			return EOB_ACT_LAST_MATCH;
-			}
-		}
-
-	/* Try to read more data. */
-
-	/* First move last chars to start of buffer. */
-	number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
-
-	for ( i = 0; i < number_to_move; ++i )
-		*(dest++) = *(source++);
-
-	if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
-		/* don't do the read, it's not guaranteed to return an EOF,
-		 * just force an EOF
-		 */
-		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
-
-	else
-		{
-			int num_to_read =
-			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
-
-		while ( num_to_read <= 0 )
-			{ /* Not enough room in the buffer - grow it. */
-
-			/* just a shorter name for the current buffer */
-			YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
-
-			int yy_c_buf_p_offset =
-				(int) (yyg->yy_c_buf_p - b->yy_ch_buf);
-
-			if ( b->yy_is_our_buffer )
-				{
-				int new_size = b->yy_buf_size * 2;
-
-				if ( new_size <= 0 )
-					b->yy_buf_size += b->yy_buf_size / 8;
-				else
-					b->yy_buf_size *= 2;
-
-				b->yy_ch_buf = (char *)
-					/* Include room in for 2 EOB chars. */
-					vdb_kfg_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
-				}
-			else
-				/* Can't grow it, we don't own it. */
-				b->yy_ch_buf = 0;
-
-			if ( ! b->yy_ch_buf )
-				YY_FATAL_ERROR(
-				"fatal error - scanner input buffer overflow" );
-
-			yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
-
-			num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
-						number_to_move - 1;
-
-			}
-
-		if ( num_to_read > YY_READ_BUF_SIZE )
-			num_to_read = YY_READ_BUF_SIZE;
-
-		/* Read in more data. */
-		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
-			yyg->yy_n_chars, (size_t) num_to_read );
-
-		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
-		}
-
-	if ( yyg->yy_n_chars == 0 )
-		{
-		if ( number_to_move == YY_MORE_ADJ )
-			{
-			ret_val = EOB_ACT_END_OF_FILE;
-			vdb_kfg_yyrestart(yyin  ,yyscanner);
-			}
-
-		else
-			{
-			ret_val = EOB_ACT_LAST_MATCH;
-			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
-				YY_BUFFER_EOF_PENDING;
-			}
-		}
-
-	else
-		ret_val = EOB_ACT_CONTINUE_SCAN;
-
-	if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
-		/* Extend the array by 50%, plus the number we really need. */
-		yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
-		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) vdb_kfg_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
-		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
-			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
-	}
-
-	yyg->yy_n_chars += number_to_move;
-	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
-	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
-
-	yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
-
-	return ret_val;
-}
-
-/* yy_get_previous_state - get the state just before the EOB char was reached */
-
-    static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
-{
-	register yy_state_type yy_current_state;
-	register char *yy_cp;
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
-	yy_current_state = yyg->yy_start;
-
-	for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
-		{
-		register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
-		if ( yy_accept[yy_current_state] )
-			{
-			yyg->yy_last_accepting_state = yy_current_state;
-			yyg->yy_last_accepting_cpos = yy_cp;
-			}
-		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
-			{
-			yy_current_state = (int) yy_def[yy_current_state];
-			if ( yy_current_state >= 135 )
-				yy_c = yy_meta[(unsigned int) yy_c];
-			}
-		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-		}
-
-	return yy_current_state;
-}
-
-/* yy_try_NUL_trans - try to make a transition on the NUL character
- *
- * synopsis
- *	next_state = yy_try_NUL_trans( current_state );
- */
-    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state , yyscan_t yyscanner)
-{
-	register int yy_is_jam;
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
-	register char *yy_cp = yyg->yy_c_buf_p;
-
-	register YY_CHAR yy_c = 1;
-	if ( yy_accept[yy_current_state] )
-		{
-		yyg->yy_last_accepting_state = yy_current_state;
-		yyg->yy_last_accepting_cpos = yy_cp;
-		}
-	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
-		{
-		yy_current_state = (int) yy_def[yy_current_state];
-		if ( yy_current_state >= 135 )
-			yy_c = yy_meta[(unsigned int) yy_c];
-		}
-	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-	yy_is_jam = (yy_current_state == 134);
-
-	return yy_is_jam ? 0 : yy_current_state;
-}
-
-    static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner)
-{
-	register char *yy_cp;
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
-    yy_cp = yyg->yy_c_buf_p;
-
-	/* undo effects of setting up yytext */
-	*yy_cp = yyg->yy_hold_char;
-
-	if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
-		{ /* need to shift things up to make room */
-		/* +2 for EOB chars. */
-		register int number_to_move = yyg->yy_n_chars + 2;
-		register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
-					YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
-		register char *source =
-				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
-
-		while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
-			*--dest = *--source;
-
-		yy_cp += (int) (dest - source);
-		yy_bp += (int) (dest - source);
-		YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
-			yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
-
-		if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
-			YY_FATAL_ERROR( "flex scanner push-back overflow" );
-		}
-
-	*--yy_cp = (char) c;
-
-    if ( c == '\n' ){
-        --yylineno;
-    }
-
-	yyg->yytext_ptr = yy_bp;
-	yyg->yy_hold_char = *yy_cp;
-	yyg->yy_c_buf_p = yy_cp;
-}
-
-#ifndef YY_NO_INPUT
-#ifdef __cplusplus
-    static int yyinput (yyscan_t yyscanner)
-#else
-    static int input  (yyscan_t yyscanner)
-#endif
-
-{
-	int c;
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
-	*yyg->yy_c_buf_p = yyg->yy_hold_char;
-
-	if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
-		{
-		/* yy_c_buf_p now points to the character we want to return.
-		 * If this occurs *before* the EOB characters, then it's a
-		 * valid NUL; if not, then we've hit the end of the buffer.
-		 */
-		if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
-			/* This was really a NUL. */
-			*yyg->yy_c_buf_p = '\0';
-
-		else
-			{ /* need more input */
-			int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
-			++yyg->yy_c_buf_p;
-
-			switch ( yy_get_next_buffer( yyscanner ) )
-				{
-				case EOB_ACT_LAST_MATCH:
-					/* This happens because yy_g_n_b()
-					 * sees that we've accumulated a
-					 * token and flags that we need to
-					 * try matching the token before
-					 * proceeding.  But for input(),
-					 * there's no matching to consider.
-					 * So convert the EOB_ACT_LAST_MATCH
-					 * to EOB_ACT_END_OF_FILE.
-					 */
-
-					/* Reset buffer status. */
-					vdb_kfg_yyrestart(yyin ,yyscanner);
-
-					/*FALLTHROUGH*/
-
-				case EOB_ACT_END_OF_FILE:
-					{
-					if ( vdb_kfg_yywrap(yyscanner ) )
-						return EOF;
-
-					if ( ! yyg->yy_did_buffer_switch_on_eof )
-						YY_NEW_FILE;
-#ifdef __cplusplus
-					return yyinput(yyscanner);
-#else
-					return input(yyscanner);
-#endif
-					}
-
-				case EOB_ACT_CONTINUE_SCAN:
-					yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
-					break;
-				}
-			}
-		}
-
-	c = *(unsigned char *) yyg->yy_c_buf_p;	/* cast for 8-bit char's */
-	*yyg->yy_c_buf_p = '\0';	/* preserve yytext */
-	yyg->yy_hold_char = *++yyg->yy_c_buf_p;
-
-	if ( c == '\n' )
-		   
-    do{ yylineno++;
-        yycolumn=0;
-    }while(0)
-;
-
-	return c;
-}
-#endif	/* ifndef YY_NO_INPUT */
-
-/** Immediately switch to a different input stream.
- * @param input_file A readable stream.
- * @param yyscanner The scanner object.
- * @note This function does not reset the start condition to @c INITIAL .
- */
-    void vdb_kfg_yyrestart  (FILE * input_file , yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
-	if ( ! YY_CURRENT_BUFFER ){
-        vdb_kfg_yyensure_buffer_stack (yyscanner);
-		YY_CURRENT_BUFFER_LVALUE =
-            vdb_kfg_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
-	}
-
-	vdb_kfg_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
-	vdb_kfg_yy_load_buffer_state(yyscanner );
-}
-
-/** Switch to a different input buffer.
- * @param new_buffer The new input buffer.
- * @param yyscanner The scanner object.
- */
-    void vdb_kfg_yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer , yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
-	/* TODO. We should be able to replace this entire function body
-	 * with
-	 *		vdb_kfg_yypop_buffer_state();
-	 *		vdb_kfg_yypush_buffer_state(new_buffer);
-     */
-	vdb_kfg_yyensure_buffer_stack (yyscanner);
-	if ( YY_CURRENT_BUFFER == new_buffer )
-		return;
-
-	if ( YY_CURRENT_BUFFER )
-		{
-		/* Flush out information for old buffer. */
-		*yyg->yy_c_buf_p = yyg->yy_hold_char;
-		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
-		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
-		}
-
-	YY_CURRENT_BUFFER_LVALUE = new_buffer;
-	vdb_kfg_yy_load_buffer_state(yyscanner );
-
-	/* We don't actually know whether we did this switch during
-	 * EOF (vdb_kfg_yywrap()) processing, but the only time this flag
-	 * is looked at is after vdb_kfg_yywrap() is called, so it's safe
-	 * to go ahead and always set it.
-	 */
-	yyg->yy_did_buffer_switch_on_eof = 1;
-}
-
-static void vdb_kfg_yy_load_buffer_state  (yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-	yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
-	yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
-	yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
-	yyg->yy_hold_char = *yyg->yy_c_buf_p;
-}
-
-/** Allocate and initialize an input buffer state.
- * @param file A readable stream.
- * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
- * @param yyscanner The scanner object.
- * @return the allocated buffer state.
- */
-    YY_BUFFER_STATE vdb_kfg_yy_create_buffer  (FILE * file, int  size , yyscan_t yyscanner)
-{
-	YY_BUFFER_STATE b;
-    
-	b = (YY_BUFFER_STATE) vdb_kfg_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
-	if ( ! b )
-		YY_FATAL_ERROR( "out of dynamic memory in vdb_kfg_yy_create_buffer()" );
-
-	b->yy_buf_size = size;
-
-	/* yy_ch_buf has to be 2 characters longer than the size given because
-	 * we need to put in 2 end-of-buffer characters.
-	 */
-	b->yy_ch_buf = (char *) vdb_kfg_yyalloc(b->yy_buf_size + 2 ,yyscanner );
-	if ( ! b->yy_ch_buf )
-		YY_FATAL_ERROR( "out of dynamic memory in vdb_kfg_yy_create_buffer()" );
-
-	b->yy_is_our_buffer = 1;
-
-	vdb_kfg_yy_init_buffer(b,file ,yyscanner);
-
-	return b;
-}
-
-/** Destroy the buffer.
- * @param b a buffer created with vdb_kfg_yy_create_buffer()
- * @param yyscanner The scanner object.
- */
-    void vdb_kfg_yy_delete_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
-	if ( ! b )
-		return;
-
-	if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
-		YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
-
-	if ( b->yy_is_our_buffer )
-		vdb_kfg_yyfree((void *) b->yy_ch_buf ,yyscanner );
-
-	vdb_kfg_yyfree((void *) b ,yyscanner );
-}
-
-/* Initializes or reinitializes a buffer.
- * This function is sometimes called more than once on the same buffer,
- * such as during a vdb_kfg_yyrestart() or at EOF.
- */
-    static void vdb_kfg_yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file , yyscan_t yyscanner)
-
-{
-	int oerrno = errno;
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
-	vdb_kfg_yy_flush_buffer(b ,yyscanner);
-
-	b->yy_input_file = file;
-	b->yy_fill_buffer = 1;
-
-    /* If b is the current buffer, then vdb_kfg_yy_init_buffer was _probably_
-     * called from vdb_kfg_yyrestart() or through yy_get_next_buffer.
-     * In that case, we don't want to reset the lineno or column.
-     */
-    if (b != YY_CURRENT_BUFFER){
-        b->yy_bs_lineno = 1;
-        b->yy_bs_column = 0;
-    }
-
-        b->yy_is_interactive = 0;
-    
-	errno = oerrno;
-}
-
-/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
- * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
- * @param yyscanner The scanner object.
- */
-    void vdb_kfg_yy_flush_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-	if ( ! b )
-		return;
-
-	b->yy_n_chars = 0;
-
-	/* We always need two end-of-buffer characters.  The first causes
-	 * a transition to the end-of-buffer state.  The second causes
-	 * a jam in that state.
-	 */
-	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
-	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
-
-	b->yy_buf_pos = &b->yy_ch_buf[0];
-
-	b->yy_at_bol = 1;
-	b->yy_buffer_status = YY_BUFFER_NEW;
-
-	if ( b == YY_CURRENT_BUFFER )
-		vdb_kfg_yy_load_buffer_state(yyscanner );
-}
-
-/** Pushes the new state onto the stack. The new state becomes
- *  the current state. This function will allocate the stack
- *  if necessary.
- *  @param new_buffer The new state.
- *  @param yyscanner The scanner object.
- */
-void vdb_kfg_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-	if (new_buffer == NULL)
-		return;
-
-	vdb_kfg_yyensure_buffer_stack(yyscanner);
-
-	/* This block is copied from vdb_kfg_yy_switch_to_buffer. */
-	if ( YY_CURRENT_BUFFER )
-		{
-		/* Flush out information for old buffer. */
-		*yyg->yy_c_buf_p = yyg->yy_hold_char;
-		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
-		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
-		}
-
-	/* Only push if top exists. Otherwise, replace top. */
-	if (YY_CURRENT_BUFFER)
-		yyg->yy_buffer_stack_top++;
-	YY_CURRENT_BUFFER_LVALUE = new_buffer;
-
-	/* copied from vdb_kfg_yy_switch_to_buffer. */
-	vdb_kfg_yy_load_buffer_state(yyscanner );
-	yyg->yy_did_buffer_switch_on_eof = 1;
-}
-
-/** Removes and deletes the top of the stack, if present.
- *  The next element becomes the new top.
- *  @param yyscanner The scanner object.
- */
-void vdb_kfg_yypop_buffer_state (yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-	if (!YY_CURRENT_BUFFER)
-		return;
-
-	vdb_kfg_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
-	YY_CURRENT_BUFFER_LVALUE = NULL;
-	if (yyg->yy_buffer_stack_top > 0)
-		--yyg->yy_buffer_stack_top;
-
-	if (YY_CURRENT_BUFFER) {
-		vdb_kfg_yy_load_buffer_state(yyscanner );
-		yyg->yy_did_buffer_switch_on_eof = 1;
-	}
-}
-
-/* Allocates the stack if it does not exist.
- *  Guarantees space for at least one push.
- */
-static void vdb_kfg_yyensure_buffer_stack (yyscan_t yyscanner)
-{
-	int num_to_alloc;
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
-	if (!yyg->yy_buffer_stack) {
-
-		/* First allocation is just for 2 elements, since we don't know if this
-		 * scanner will even need a stack. We use 2 instead of 1 to avoid an
-		 * immediate realloc on the next call.
-         */
-		num_to_alloc = 1;
-		yyg->yy_buffer_stack = (struct yy_buffer_state**)vdb_kfg_yyalloc
-								(num_to_alloc * sizeof(struct yy_buffer_state*)
-								, yyscanner);
-		if ( ! yyg->yy_buffer_stack )
-			YY_FATAL_ERROR( "out of dynamic memory in vdb_kfg_yyensure_buffer_stack()" );
-								  
-		memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
-				
-		yyg->yy_buffer_stack_max = num_to_alloc;
-		yyg->yy_buffer_stack_top = 0;
-		return;
-	}
-
-	if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
-
-		/* Increase the buffer to prepare for a possible push. */
-		int grow_size = 8 /* arbitrary grow size */;
-
-		num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
-		yyg->yy_buffer_stack = (struct yy_buffer_state**)vdb_kfg_yyrealloc
-								(yyg->yy_buffer_stack,
-								num_to_alloc * sizeof(struct yy_buffer_state*)
-								, yyscanner);
-		if ( ! yyg->yy_buffer_stack )
-			YY_FATAL_ERROR( "out of dynamic memory in vdb_kfg_yyensure_buffer_stack()" );
-
-		/* zero only the new slots.*/
-		memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
-		yyg->yy_buffer_stack_max = num_to_alloc;
-	}
-}
-
-/** Setup the input buffer state to scan directly from a user-specified character buffer.
- * @param base the character buffer
- * @param size the size in bytes of the character buffer
- * @param yyscanner The scanner object.
- * @return the newly allocated buffer state object. 
- */
-YY_BUFFER_STATE vdb_kfg_yy_scan_buffer  (char * base, yy_size_t  size , yyscan_t yyscanner)
-{
-	YY_BUFFER_STATE b;
-    
-	if ( size < 2 ||
-	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
-	     base[size-1] != YY_END_OF_BUFFER_CHAR )
-		/* They forgot to leave room for the EOB's. */
-		return 0;
-
-	b = (YY_BUFFER_STATE) vdb_kfg_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
-	if ( ! b )
-		YY_FATAL_ERROR( "out of dynamic memory in vdb_kfg_yy_scan_buffer()" );
-
-	b->yy_buf_size = size - 2;	/* "- 2" to take care of EOB's */
-	b->yy_buf_pos = b->yy_ch_buf = base;
-	b->yy_is_our_buffer = 0;
-	b->yy_input_file = 0;
-	b->yy_n_chars = b->yy_buf_size;
-	b->yy_is_interactive = 0;
-	b->yy_at_bol = 1;
-	b->yy_fill_buffer = 0;
-	b->yy_buffer_status = YY_BUFFER_NEW;
-
-	vdb_kfg_yy_switch_to_buffer(b ,yyscanner );
-
-	return b;
-}
-
-/** Setup the input buffer state to scan a string. The next call to vdb_kfg_yylex() will
- * scan from a @e copy of @a str.
- * @param yystr a NUL-terminated string to scan
- * @param yyscanner The scanner object.
- * @return the newly allocated buffer state object.
- * @note If you want to scan bytes that may contain NUL values, then use
- *       vdb_kfg_yy_scan_bytes() instead.
- */
-YY_BUFFER_STATE vdb_kfg_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
-{
-    
-	return vdb_kfg_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
-}
-
-/** Setup the input buffer state to scan the given bytes. The next call to vdb_kfg_yylex() will
- * scan from a @e copy of @a bytes.
- * @param bytes the byte buffer to scan
- * @param len the number of bytes in the buffer pointed to by @a bytes.
- * @param yyscanner The scanner object.
- * @return the newly allocated buffer state object.
- */
-YY_BUFFER_STATE vdb_kfg_yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len , yyscan_t yyscanner)
-{
-	YY_BUFFER_STATE b;
-	char *buf;
-	yy_size_t n;
-	int i;
-    
-	/* Get memory for full buffer, including space for trailing EOB's. */
-	n = _yybytes_len + 2;
-	buf = (char *) vdb_kfg_yyalloc(n ,yyscanner );
-	if ( ! buf )
-		YY_FATAL_ERROR( "out of dynamic memory in vdb_kfg_yy_scan_bytes()" );
-
-	for ( i = 0; i < _yybytes_len; ++i )
-		buf[i] = yybytes[i];
-
-	buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
-
-	b = vdb_kfg_yy_scan_buffer(buf,n ,yyscanner);
-	if ( ! b )
-		YY_FATAL_ERROR( "bad buffer in vdb_kfg_yy_scan_bytes()" );
-
-	/* It's okay to grow etc. this buffer, and we should throw it
-	 * away when we're done.
-	 */
-	b->yy_is_our_buffer = 1;
-
-	return b;
-}
-
-    static void yy_push_state (int  new_state , yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-	if ( yyg->yy_start_stack_ptr >= yyg->yy_start_stack_depth )
-		{
-		yy_size_t new_size;
-
-		yyg->yy_start_stack_depth += YY_START_STACK_INCR;
-		new_size = yyg->yy_start_stack_depth * sizeof( int );
-
-		if ( ! yyg->yy_start_stack )
-			yyg->yy_start_stack = (int *) vdb_kfg_yyalloc(new_size ,yyscanner );
-
-		else
-			yyg->yy_start_stack = (int *) vdb_kfg_yyrealloc((void *) yyg->yy_start_stack,new_size ,yyscanner );
-
-		if ( ! yyg->yy_start_stack )
-			YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
-		}
-
-	yyg->yy_start_stack[yyg->yy_start_stack_ptr++] = YY_START;
-
-	BEGIN(new_state);
-}
-
-    static void yy_pop_state  (yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-	if ( --yyg->yy_start_stack_ptr < 0 )
-		YY_FATAL_ERROR( "start-condition stack underflow" );
-
-	BEGIN(yyg->yy_start_stack[yyg->yy_start_stack_ptr]);
-}
-
-    static int yy_top_state  (yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-	return yyg->yy_start_stack[yyg->yy_start_stack_ptr - 1];
-}
-
-#ifndef YY_EXIT_FAILURE
-#define YY_EXIT_FAILURE 2
-#endif
-
-static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
-{
-    	(void) fprintf( stderr, "%s\n", msg );
-	exit( YY_EXIT_FAILURE );
-}
-
-/* Redefine yyless() so it works in section 3 code. */
-
-#undef yyless
-#define yyless(n) \
-	do \
-		{ \
-		/* Undo effects of setting up yytext. */ \
-        int yyless_macro_arg = (n); \
-        YY_LESS_LINENO(yyless_macro_arg);\
-		yytext[yyleng] = yyg->yy_hold_char; \
-		yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
-		yyg->yy_hold_char = *yyg->yy_c_buf_p; \
-		*yyg->yy_c_buf_p = '\0'; \
-		yyleng = yyless_macro_arg; \
-		} \
-	while ( 0 )
-
-/* Accessor  methods (get/set functions) to struct members. */
-
-/** Get the user-defined data for this scanner.
- * @param yyscanner The scanner object.
- */
-YY_EXTRA_TYPE vdb_kfg_yyget_extra  (yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-    return yyextra;
-}
-
-/** Get the current line number.
- * @param yyscanner The scanner object.
- */
-int vdb_kfg_yyget_lineno  (yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-    
-        if (! YY_CURRENT_BUFFER)
-            return 0;
-    
-    return yylineno;
-}
-
-/** Get the current column number.
- * @param yyscanner The scanner object.
- */
-int vdb_kfg_yyget_column  (yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-    
-        if (! YY_CURRENT_BUFFER)
-            return 0;
-    
-    return yycolumn;
-}
-
-/** Get the input stream.
- * @param yyscanner The scanner object.
- */
-FILE *vdb_kfg_yyget_in  (yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-    return yyin;
-}
-
-/** Get the output stream.
- * @param yyscanner The scanner object.
- */
-FILE *vdb_kfg_yyget_out  (yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-    return yyout;
-}
-
-/** Get the length of the current token.
- * @param yyscanner The scanner object.
- */
-int vdb_kfg_yyget_leng  (yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-    return yyleng;
-}
-
-/** Get the current token.
- * @param yyscanner The scanner object.
- */
-
-char *vdb_kfg_yyget_text  (yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-    return yytext;
-}
-
-/** Set the user-defined data. This data is never touched by the scanner.
- * @param user_defined The data to be associated with this scanner.
- * @param yyscanner The scanner object.
- */
-void vdb_kfg_yyset_extra (YY_EXTRA_TYPE  user_defined , yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-    yyextra = user_defined ;
-}
-
-/** Set the current line number.
- * @param line_number
- * @param yyscanner The scanner object.
- */
-void vdb_kfg_yyset_lineno (int  line_number , yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
-        /* lineno is only valid if an input buffer exists. */
-        if (! YY_CURRENT_BUFFER )
-           yy_fatal_error( "vdb_kfg_yyset_lineno called with no buffer" , yyscanner); 
-    
-    yylineno = line_number;
-}
-
-/** Set the current column.
- * @param line_number
- * @param yyscanner The scanner object.
- */
-void vdb_kfg_yyset_column (int  column_no , yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
-        /* column is only valid if an input buffer exists. */
-        if (! YY_CURRENT_BUFFER )
-           yy_fatal_error( "vdb_kfg_yyset_column called with no buffer" , yyscanner); 
-    
-    yycolumn = column_no;
-}
-
-/** Set the input stream. This does not discard the current
- * input buffer.
- * @param in_str A readable stream.
- * @param yyscanner The scanner object.
- * @see vdb_kfg_yy_switch_to_buffer
- */
-void vdb_kfg_yyset_in (FILE *  in_str , yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-    yyin = in_str ;
-}
-
-void vdb_kfg_yyset_out (FILE *  out_str , yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-    yyout = out_str ;
-}
-
-int vdb_kfg_yyget_debug  (yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-    return yy_flex_debug;
-}
-
-void vdb_kfg_yyset_debug (int  bdebug , yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-    yy_flex_debug = bdebug ;
-}
-
-/* Accessor methods for yylval and yylloc */
-
-YYSTYPE * vdb_kfg_yyget_lval  (yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-    return yylval;
-}
-
-void vdb_kfg_yyset_lval (YYSTYPE *  yylval_param , yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-    yylval = yylval_param;
-}
-
-/* User-visible API */
-
-/* vdb_kfg_yylex_init is special because it creates the scanner itself, so it is
- * the ONLY reentrant function that doesn't take the scanner as the last argument.
- * That's why we explicitly handle the declaration, instead of using our macros.
- */
-
-int vdb_kfg_yylex_init(yyscan_t* ptr_yy_globals)
-
-{
-    if (ptr_yy_globals == NULL){
-        errno = EINVAL;
-        return 1;
-    }
-
-    *ptr_yy_globals = (yyscan_t) vdb_kfg_yyalloc ( sizeof( struct yyguts_t ), NULL );
-
-    if (*ptr_yy_globals == NULL){
-        errno = ENOMEM;
-        return 1;
-    }
-
-    /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
-    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
-
-    return yy_init_globals ( *ptr_yy_globals );
-}
-
-/* vdb_kfg_yylex_init_extra has the same functionality as vdb_kfg_yylex_init, but follows the
- * convention of taking the scanner as the last argument. Note however, that
- * this is a *pointer* to a scanner, as it will be allocated by this call (and
- * is the reason, too, why this function also must handle its own declaration).
- * The user defined value in the first argument will be available to vdb_kfg_yyalloc in
- * the yyextra field.
- */
-
-int vdb_kfg_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
-
-{
-    struct yyguts_t dummy_yyguts;
-
-    vdb_kfg_yyset_extra (yy_user_defined, &dummy_yyguts);
-
-    if (ptr_yy_globals == NULL){
-        errno = EINVAL;
-        return 1;
-    }
-	
-    *ptr_yy_globals = (yyscan_t) vdb_kfg_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
-	
-    if (*ptr_yy_globals == NULL){
-        errno = ENOMEM;
-        return 1;
-    }
-    
-    /* By setting to 0xAA, we expose bugs in
-    yy_init_globals. Leave at 0x00 for releases. */
-    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
-    
-    vdb_kfg_yyset_extra (yy_user_defined, *ptr_yy_globals);
-    
-    return yy_init_globals ( *ptr_yy_globals );
-}
-
-static int yy_init_globals (yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-    /* Initialization is the same as for the non-reentrant scanner.
-     * This function is called from vdb_kfg_yylex_destroy(), so don't allocate here.
-     */
-
-    yyg->yy_buffer_stack = 0;
-    yyg->yy_buffer_stack_top = 0;
-    yyg->yy_buffer_stack_max = 0;
-    yyg->yy_c_buf_p = (char *) 0;
-    yyg->yy_init = 0;
-    yyg->yy_start = 0;
-
-    yyg->yy_start_stack_ptr = 0;
-    yyg->yy_start_stack_depth = 0;
-    yyg->yy_start_stack =  NULL;
-
-/* Defined in main.c */
-#ifdef YY_STDINIT
-    yyin = stdin;
-    yyout = stdout;
-#else
-    yyin = (FILE *) 0;
-    yyout = (FILE *) 0;
-#endif
-
-    /* For future reference: Set errno on error, since we are called by
-     * vdb_kfg_yylex_init()
-     */
-    return 0;
-}
-
-/* vdb_kfg_yylex_destroy is for both reentrant and non-reentrant scanners. */
-int vdb_kfg_yylex_destroy  (yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
-    /* Pop the buffer stack, destroying each element. */
-	while(YY_CURRENT_BUFFER){
-		vdb_kfg_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
-		YY_CURRENT_BUFFER_LVALUE = NULL;
-		vdb_kfg_yypop_buffer_state(yyscanner);
-	}
-
-	/* Destroy the stack itself. */
-	vdb_kfg_yyfree(yyg->yy_buffer_stack ,yyscanner);
-	yyg->yy_buffer_stack = NULL;
-
-    /* Destroy the start condition stack. */
-        vdb_kfg_yyfree(yyg->yy_start_stack ,yyscanner );
-        yyg->yy_start_stack = NULL;
-
-    /* Reset the globals. This is important in a non-reentrant scanner so the next time
-     * vdb_kfg_yylex() is called, initialization will occur. */
-    yy_init_globals( yyscanner);
-
-    /* Destroy the main struct (reentrant only). */
-    vdb_kfg_yyfree ( yyscanner , yyscanner );
-    yyscanner = NULL;
-    return 0;
-}
-
-/*
- * Internal utility routines.
- */
-
-#ifndef yytext_ptr
-static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
-{
-	register int i;
-	for ( i = 0; i < n; ++i )
-		s1[i] = s2[i];
-}
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
-{
-	register int n;
-	for ( n = 0; s[n]; ++n )
-		;
-
-	return n;
-}
-#endif
-
-void *vdb_kfg_yyalloc (yy_size_t  size , yyscan_t yyscanner)
-{
-	return (void *) malloc( size );
-}
-
-void *vdb_kfg_yyrealloc  (void * ptr, yy_size_t  size , yyscan_t yyscanner)
-{
-	/* The cast to (char *) in the following accommodates both
-	 * implementations that use char* generic pointers, and those
-	 * that use void* generic pointers.  It works with the latter
-	 * because both ANSI C and C++ allow castless assignment from
-	 * any pointer type to void*, and deal with argument conversions
-	 * as though doing an assignment.
-	 */
-	return (void *) realloc( (char *) ptr, size );
-}
-
-void vdb_kfg_yyfree (void * ptr , yyscan_t yyscanner)
-{
-	free( (char *) ptr );	/* see vdb_kfg_yyrealloc() for (char *) cast */
-}
-
-#define YYTABLES_NAME "yytables"
-
-rc_t CC KFGScan_yylex_init(KFGScanBlock* sb, const char *str)
-{
-    if (vdb_kfg_yylex_init(&sb->scanner) != 0)
-    {
-        return RC ( rcKFG, rcMgr, rcParsing, rcMemory, rcExhausted );
-    }       
-    sb->buffer=vdb_kfg_yy_scan_string((yyconst char*)str,sb->scanner); 
-    
-    {   /* initialize line/col counters */
-        /* yylineno and yycolumn are macros using variable yyg, so we have to prepare it for them */
-        struct yyguts_t * yyg = (struct yyguts_t*)sb->scanner;
-        yylineno=1;
-        yycolumn=1;
-    }
-    
-    return 0;
-}
-
-void CC KFGScan_yylex_destroy(KFGScanBlock* sb)
-{
-    vdb_kfg_yy_delete_buffer(sb->buffer,sb->scanner); 
-    if (sb->scanner)
-    {
-        vdb_kfg_yylex_destroy(sb->scanner);
-    }       
-    sb->scanner=0;
-    sb->buffer=0;
-}
-
-void CC KFGScan_set_debug(bool on, KFGScanBlock* sb)
-{
-    vdb_kfg_yyset_debug(on ? 1 : 0,sb->scanner);
-}
-
-int CC KFGScan_yylex(KFGSymbol* sym, KFGScanBlock* sb) 
-{ 
-    sym->pb.tokenId=vdb_kfg_yylex(&sym->pb,sb->scanner); 
-    sb->lastToken= &sym->pb;
-    
-    switch (sym->pb.tokenId)
-    {
-    case kfgVAR_REF:
-        if (!sb->look_up_var(sb->self, &sym->pb)) 
-        {
-            /* undefined variable reference is handled silently, to behave like a shell script */
-            /* KFG_error(&sym->pb, sb, "variable not found");*/
-            sym->pb.tokenLength = 0; 
-        }
-        sym->pb.tokenId = kfgSTRING;
-        break;
-    case kfgUNTERM_VAR_REF: /* convert bad var ref into a string */ 
-        KFG_error(&sym->pb, sb, "unterminated variable reference inside a string (use '\\$(' to avoid this message)");
-        sym->pb.tokenId = kfgSTRING; 
-        break;
-    case kfgUNTERM_STRING:
-    case kfgUNTERM_ESCAPED_STRING:
-        KFG_error(&sym->pb, sb, "unterminated string");
-        break;
-    default:
-        break;
-    }
-    
-    return sym->pb.tokenId; 
-}
-
diff --git a/libs/kfg/config-tokens.h b/libs/kfg/config-tokens.h
deleted file mode 100644
index 81fa170..0000000
--- a/libs/kfg/config-tokens.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* A Bison parser, made by GNU Bison 2.5.  */
-
-/* Bison interface for Yacc-like parsers in C
-   
-      Copyright (C) 1984, 1989-1990, 2000-2011 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 3 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, see <http://www.gnu.org/licenses/>.  */
-
-/* As a special exception, you may create a larger work that contains
-   part or all of the Bison parser skeleton and distribute that work
-   under terms of your choice, so long as that work isn't itself a
-   parser generator using the skeleton or a modified version thereof
-   as a parser skeleton.  Alternatively, if you modify or redistribute
-   the parser skeleton itself, you may (at your option) remove this
-   special exception, which will cause the skeleton and the resulting
-   Bison output files to be licensed under the GNU General Public
-   License without this special exception.
-   
-   This special exception was added by the Free Software Foundation in
-   version 2.2 of Bison.  */
-
-
-/* Tokens.  */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
-   /* Put the tokens into the symbol table, so that GDB and other debuggers
-      know about them.  */
-   enum yytokentype {
-     kfgEND_INPUT = 0,
-     kfgEND_LINE = 258,
-     kfgUNTERM_STRING = 259,
-     kfgUNTERM_ESCAPED_STRING = 260,
-     kfgUNRECOGNIZED = 261,
-     kfgVAR_REF = 262,
-     kfgUNTERM_VAR_REF = 263,
-     kfgASSIGN = 264,
-     kfgSTRING = 265,
-     kfgESCAPED_STRING = 266,
-     kfgABS_PATH = 267,
-     kfgREL_PATH = 268
-   };
-#endif
-
-
-
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE
-{
-
-
-    KFGParseBlock       pb;
-    const VNamelist*    namelist;
-
-
-
-} YYSTYPE;
-# define YYSTYPE_IS_TRIVIAL 1
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
-# define YYSTYPE_IS_DECLARED 1
-#endif
-
-
-
-
diff --git a/libs/kfg/config.c b/libs/kfg/config.c
deleted file mode 100644
index 29ebab9..0000000
--- a/libs/kfg/config.c
+++ /dev/null
@@ -1,3592 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <kfg/kfg-priv.h>
-
-struct KfgConfigNamelist;
-#define KNAMELIST_IMPL struct KfgConfigNamelist
-#include <klib/namelist.h>
-#include <klib/impl.h>
-
-#include <klib/token.h>
-#include <klib/container.h>
-#include <klib/data-buffer.h> /* KDataBuffer */
-#include <klib/refcount.h>
-#include <klib/text.h>
-#include <klib/printf.h>
-#include <klib/rc.h>
-#include <klib/debug.h>
-#include <klib/log.h> 
-#include <klib/out.h> /* OUTMSG */
-#include <klib/klib-priv.h>
-#include <kfs/directory.h>
-#include <kfs/gzip.h> /* KFileMakeGzipForRead */
-#include <kfs/subfile.h> /* KFileMakeSubRead */
-#include <kfs/file.h>
-#include <kfs/dyload.h>
-#include <kfs/mmap.h>
-#include <os-native.h>
-#include <vfs/path.h>
-#include <strtol.h>
-#include <sysalloc.h>
-#include <os-native.h>
-
-#include <string.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <va_copy.h>
-
-#if !WINDOWS
-    #include <sys/utsname.h>
-#endif
-
-#include "kfg-parse.h"
-#include "config-tokens.h"
-
-#ifndef PATH_MAX
-#define PATH_MAX 4096
-#endif
-
-/* the leaf name of the user's modifiable settings,
-   must reside in the user's $HOME/.ncbi directory */
-#define MAGIC_LEAF_NAME "user-settings.mkfg"
-
-static bool s_disable_user_settings = false;
-
-
-/*--------------------------------------------------------------------------
- * KConfig
- */
-static
-rc_t KConfigSever ( const KConfig *self );
-
-
-/*--------------------------------------------------------------------------
- * KConfigIncluded
- *  node within configuration tree
- */
-
-typedef struct KConfigIncluded KConfigIncluded;
-struct KConfigIncluded
-{
-    BSTNode n;
-    bool is_magic_file;
-    char path [ 1 ];
-};
-
-
-static
-void CC KConfigIncludedWhack ( BSTNode *n, void *ignore )
-{
-    free ( n );
-}
-
-static
-int CC KConfigIncludedSort ( const BSTNode *item, const BSTNode *n )
-{
-    const KConfigIncluded *a = ( const KConfigIncluded* ) item;
-    const KConfigIncluded *b = ( const KConfigIncluded* ) n;
-    return strcmp ( a -> path, b -> path );
-}
-
-enum {
-    eInternalFalse = false, /* internal = false: non internal nodes */
-    eInternalTrue  = true,  /* internal = true ; internal nodes: read-only */
-    eInternalTrueUpdatable
-                       /* internal = true ; internal nodes, but can be updated :
-                                            "kfg/dir", "kfg/name" */
-} EInternal;
-typedef uint32_t TInternal;
-
-/*--------------------------------------------------------------------------
- * KConfigNode
- *  node within configuration tree
- */
-struct KConfigNode
-{
-    BSTNode n;
-
-    /* needs to hold a dependency reference to mgr */
-    KConfig *mgr;
-
-    /* uncounted reference to parent node */
-    KConfigNode *dad;
-
-    /* File node came from; null if created during runtime*/
-    KConfigIncluded *came_from;
-
-    /* named children - always unique */
-    BSTree children;
-
-    /* named attributes */
-    BSTree attr;
-
-    /* node value */
-    char * val_buffer;
-    String value;
-
-    /* node name */
-    String name;
-
-    KRefcount refcount;
-
-    TInternal internal; /* EInternal */
-    bool read_only;
-    bool dirty;
-};
-
-/* replace this once we introduce attributes */
-#define KConfigAttrWhack NULL
-
-
-/* Whack
- */
-static
-void CC KConfigNodeWhack ( BSTNode *n, void * data )
-{
-    KConfigNode *self = ( KConfigNode* ) n;
-    KConfig *mgr = data;
-
-    if ( mgr == NULL )
-    {
-        /* just releasing reference */
-        KConfigSever ( self -> mgr );
-        self -> mgr = NULL;
-        self -> read_only = false;
-    }
-    else
-    {
-        /* tearing down structure */
-        BSTreeWhack ( & self -> children, KConfigNodeWhack, mgr );
-        BSTreeWhack ( & self -> attr, KConfigAttrWhack, mgr );
-        free ( self -> val_buffer );
-        free ( self );
-    }
-}
-
-/* Init
- */
-static
-void KConfigNodeInit ( KConfigNode *self, const String *name )
-{
-    /* clear out here, ignoring the string space */
-    memset ( self, 0, sizeof * self );
-
-    /* initialize name early for the sake of KRefcountInit */
-    string_copy ( ( char* ) ( self + 1 ), name -> size + 1, name -> addr, name -> size );
-    StringInit ( & self -> name, ( char* ) ( self + 1 ), name -> size, name -> len );
-    StringInit ( & self -> value, "", 0, 0 );
-    KRefcountInit ( & self -> refcount, 0, "KConfigNode", "init", self -> name . addr );
-}
-
-/* Make
- */
-static
-rc_t KConfigNodeMake ( KConfigNode **n, const String *name )
-{
-    /* don't use calloc, because of string space */
-    KConfigNode *cn = malloc ( sizeof * cn + name -> size + 1 );
-    if ( cn == NULL )
-    {
-        rc_t rc = RC ( rcKFG, rcNode, rcCreating, rcMemory, rcExhausted );
-        PLOGERR (klogErr, (klogErr, rc, "Unable to create a config item for $(i)", "i=%S", name));
-        return rc;
-    }
-    KConfigNodeInit ( cn, name );
-    * n = cn;
-
-    return 0;
-}
-
-
-/* Cmp
- * Sort
- */
-static
-int CC KConfigNodeCmp ( const void *item, const BSTNode *n )
-{
-    const String *a = ( const String* ) item;
-    const KConfigNode *b = ( const KConfigNode* ) n;
-    return StringCompare ( a, & b -> name );
-}
-
-static
-int CC KConfigNodeSort ( const BSTNode *item, const BSTNode *n )
-{
-    const KConfigNode *a = ( const KConfigNode* ) item;
-    const KConfigNode *b = ( const KConfigNode* ) n;
-    return StringCompare ( & a -> name, & b -> name );
-}
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-LIB_EXPORT rc_t CC KConfigNodeAddRef ( const KConfigNode *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KConfigNode" ) )
-        {
-        case krefLimit:
-            return RC ( rcKFG, rcNode, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KConfigNodeRelease ( const KConfigNode *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KConfigNode" ) )
-        {
-        case krefWhack:
-            KConfigNodeWhack ( & ( ( KConfigNode* ) self ) -> n, NULL );
-        break;
-        case krefNegative:
-            return RC ( rcKFG, rcNode, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/*--------------------------------------------------------------------------
- * KConfig
- *  configuration parameter manager
- */
-struct KConfig
-{
-    BSTree tree;
-    BSTree included;
-    KDualRef refcount;
-    KConfigIncluded *current_file;
-
-    char * load_path;
-    size_t load_path_sz_tmp;
-
-    const char *magic_file_path;
-    size_t magic_file_path_size;
-
-    bool dirty;
-    bool initialized;
-};
-
-
-rc_t KConfigAppendToLoadPath(KConfig *self, const char* chunk)
-{
-    rc_t rc = 0;
-    size_t new_sz = 0;
-
-    assert(self);
-
-    if (chunk == NULL || chunk[0] == '\0') {
-        return rc;
-    }
-
-    if (self->load_path == NULL) {
-        self->load_path_sz_tmp = PATH_MAX;
-        self->load_path = malloc(self->load_path_sz_tmp);
-        if (self->load_path == NULL) {
-            return RC ( rcKFG, rcMgr, rcCreating, rcMemory, rcExhausted );
-        }
-        self->load_path[0] = '\0';
-    }
-
-    new_sz = string_size(self->load_path) + 1 + string_size(chunk) + 1;
-    if (self->load_path_sz_tmp < new_sz) {
-        self->load_path_sz_tmp = 2 * new_sz;
-        self->load_path = realloc(self->load_path, self->load_path_sz_tmp);
-        if (self->load_path == NULL) {
-            return RC ( rcKFG, rcMgr, rcCreating, rcMemory, rcExhausted );
-        }
-    }
-
-    if (self->load_path[0] != '\0') {
-        strcat(self->load_path, ":");
-    }
-    strcat(self->load_path, chunk);
-
-    return rc;
-}
-
-
-/* Whack
- */
-static
-rc_t KConfigEmpty ( KConfig * self)
-{
-    if (self)
-    {
-        BSTreeWhack ( & self -> tree, KConfigNodeWhack, self );
-        BSTreeWhack ( & self -> included, KConfigIncludedWhack, NULL );
-
-        self -> magic_file_path_size = 0;
-        free ( ( void* ) self -> magic_file_path );
-        self -> magic_file_path = NULL;
-
-        self->load_path_sz_tmp = 0;
-        free ( self->load_path );
-        self->load_path = NULL;
-    }
-    return 0;
-}
-
-static
-rc_t KConfigWhack ( KConfig *self )
-{
-    KConfigEmpty (self);
-
-    free ( self );
-
-    return 0;
-}
-
-/* Init
- */
-static
-void KConfigInit ( KConfig *self, KConfigNode * root )
-{
-    KDualRefInit ( & self -> refcount, 1, 0, "KConfig", "init", "kfg" );
-    BSTreeInit ( & self -> tree );
-    self -> dirty = false;
-    self -> initialized = false;
-    BSTreeInit ( & self -> included );
-    BSTreeInsert ( & self -> tree, & root -> n, KConfigNodeSort );
-    self -> magic_file_path = NULL;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KConfigAddRef ( const KConfig *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KDualRefAdd ( & self -> refcount, "KConfig" ) )
-        {
-        case krefLimit:
-            return RC ( rcKFG, rcMgr, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KConfigRelease ( const KConfig *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KDualRefDrop ( & self -> refcount, "KConfig" ) )
-        {
-        case krefWhack:
-            return KConfigWhack ( ( KConfig* ) self );
-        case krefLimit:
-            return RC ( rcKFG, rcMgr, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-static
-KConfig *KConfigAttach ( const KConfig *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KDualRefAddDep ( & self -> refcount, "KConfig" ) )
-        {
-        case krefLimit:
-            return NULL;
-        }
-    }
-    return ( KConfig* ) self;
-}
-
-static
-rc_t KConfigSever ( const KConfig *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KDualRefDropDep ( & self -> refcount, "KConfig" ) )
-        {
-        case krefWhack:
-            return KConfigWhack ( ( KConfig* ) self );
-        case krefLimit:
-            return RC ( rcKFG, rcMgr, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/* init_token_source
- */
-static
-rc_t init_token_source ( KTokenText *tt, KTokenSource *src,
-                         char *full, size_t fsize, const char *srcpath, const char *path, va_list args )
-{
-    size_t num_writ;
-    rc_t rc = 0;
-
-    if (args == NULL)
-        num_writ = string_copy ( full, fsize, path, string_size ( path ));
-    else
-        rc = string_vprintf ( full, fsize, & num_writ, path, args );
-    if ( rc == 0 )
-    {
-        String text, fpath;
-        StringInit ( & text, full, num_writ, string_len ( full, num_writ ) );
-        StringInitCString ( & fpath, srcpath );
-        KTokenTextInit ( tt, & text, & fpath );
-        KTokenSourceInit ( src, tt );
-    }
-    return rc;
-}
-
-/* Find
- */
-static
-KToken *KConfigNodeFind ( const KConfigNode *self, const KConfigNode **n, KTokenSource *src, KToken *t )
-{
-    * n = NULL;
-
-    while ( t -> id != eEndOfInput )
-    {
-        switch ( t -> id )
-        {
-        case ePeriod:
-            break;
-        case eDblPeriod:
-            if ( self -> dad == NULL )
-                return NULL;
-            self = self -> dad;
-            break;
-        case eDecimal:
-        case eHex:
-        case eOctal:
-        case eIdent:
-        case eName:
-            self = ( const KConfigNode* ) BSTreeFind
-                ( & self -> children, &t -> str, KConfigNodeCmp );
-            if ( self == NULL )
-                return t;
-            break;
-        default:
-            * n = self;
-            return t;
-        }
-
-        if ( KTokenizerNext ( kPOSIXPathTokenizer, src, t ) -> id != eFwdSlash )
-            break;
-
-        KTokenizerNext ( kPOSIXPathTokenizer, src, t );
-    }
-
-    * n = self;
-    return t;
-}
-
-/* Create
- */
-static
-KToken *KConfigNodeCreate ( KConfigNode *self, KConfigNode **n, KTokenSource *src, KToken *t, 
-                            KConfigIncluded *current_file )
-{
-    bool created = false;
-    KConfigNode * nself;
-    * n = NULL;
-
-    while ( t -> id != eEndOfInput )
-    {
-        switch ( t -> id )
-        {
-        case ePeriod:
-            break;
-        case eDblPeriod:
-            if ( self -> dad == NULL )
-                return NULL;
-            self = self -> dad;
-            break;
-        case eDecimal:
-        case eHex:
-        case eOctal:
-        case eName:
-        case eIdent:
-            nself = ( KConfigNode* ) BSTreeFind
-                ( & self -> children, & t -> str, KConfigNodeCmp );
-            if ( nself == NULL )
-            {
-                KConfigNode *child;
-                rc_t rc = KConfigNodeMake ( & child, & t -> str );
-                if ( rc != 0 )
-                    return t;
-                BSTreeInsert ( & self -> children, & child -> n, KConfigNodeSort );  
-                child -> dad = self;
-                self = child;
-                created = true;
-            }
-            else
-            {
-                self = nself;
-            }
-            break;
-        default:
-            * n = self;
-            return t;
-        }
-
-        if ( KTokenizerNext ( kPOSIXPathTokenizer, src, t ) -> id != eFwdSlash )
-            break;
-
-        KTokenizerNext ( kPOSIXPathTokenizer, src, t );
-    }
-
-    if ( created )
-        self -> came_from = current_file;
-
-    * n = self;
-    return t;
-}
-
-
-/* OpenNodeRead
- * VOpenNodeRead
- *  opens a configuration node
- *
- *  "node" [ OUT ] - return parameter for indicated configuration node
- *
- *  "path" [ IN, NULL OKAY ] - optional path for specifying named
- *  node within configuration hierarchy. paths will be interpreted as
- *  if they were file system paths, using '/' as separator. the
- *  special values NULL and "" are interpreted as "."
- */
-static
-rc_t KConfigNodeVOpenNodeReadInt ( const KConfigNode *self, const KConfig *mgr,
-                                   const KConfigNode **node, const char *path, va_list args )
-{
-    rc_t rc;
-
-    if ( node == NULL )
-    {
-        rc = RC ( rcKFG, rcNode, rcOpening, rcParam, rcNull );
-        PLOGERR (klogErr, (klogErr, rc, "faile to provide node to open $(n)", "n=%s", path));
-    }
-    else
-    {
-        if ( self == NULL )
-        {
-            rc = RC ( rcKFG, rcNode, rcOpening, rcSelf, rcNull );
-            PLOGERR (klogErr, (klogErr, rc, "failed to provide node reference for opening $(n)", "n=%s", path));
-        }
-        else
-        {
-            if ( path == NULL || path [ 0 ] == 0 )
-            {
-                * node = self;
-                rc = 0;
-            }
-            else
-            {
-                KTokenText tt;
-                KTokenSource src;
-                char full [ 4096 ];
-        
-                rc = init_token_source ( & tt, & src, full, sizeof full, "", path, args );
-                if ( rc == 0 )
-                {
-                    /* look ahead */
-                    KToken t;
-
-                    /* skip over fwd slashes */
-                    do
-                        KTokenizerNext ( kPOSIXPathTokenizer, & src, & t );
-                    while ( t.id == eFwdSlash );
-
-                    /* follow path */
-                    if ( KConfigNodeFind ( self, node, & src, & t ) == NULL )
-                    {
-                        rc = RC ( rcKFG, rcNode, rcOpening, rcPath, rcInvalid );
-                        PLOGERR (klogErr, (klogErr, rc, "bad path $(p)", "p=%s", path));
-                    }
-                    if ( ( self = * node ) == NULL )
-                    {
-                        rc = RC ( rcKFG, rcNode, rcOpening, rcPath, rcNotFound );
-                        /* don't complain about this
-                           PLOGERR (klogErr, (klogErr, rc, "can't find symbol $(p)", "p=%s", path));
-                        */
-                    }
-                    else if ( t . id != eEndOfInput )
-                    {
-                        rc = RC ( rcKFG, rcNode, rcOpening, rcPath, rcInvalid );
-                        PLOGERR (klogErr, (klogErr, rc, "bad path $(p)", "p=%s", path));
-                    }
-                }
-            }
-
-            if ( rc == 0 )
-            {
-                /* open node for read */
-                if ( self -> read_only )
-                {
-                    assert ( self -> mgr == mgr );
-                    return KConfigNodeAddRef ( self );
-                }
-
-                /* check to see if already open */
-                if ( atomic32_read ( & self -> refcount ) == 0 )
-                {
-                    ( ( KConfigNode* ) self ) -> mgr = KConfigAttach ( mgr );
-                    ( ( KConfigNode* ) self ) -> read_only = true;
-                    return KConfigNodeAddRef ( self );
-                }
-
-                rc = RC ( rcKFG, rcNode, rcOpening, rcNode, rcBusy );
-            }
-        }
-
-        * node = NULL;
-    }
-
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC KConfigNodeGetMgr( const KConfigNode * self, KConfig ** mgr )
-{
-    if ( self == NULL )
-        return RC ( rcKFG, rcNode, rcOpening, rcSelf, rcNull );
-    if ( mgr == NULL )
-        return RC ( rcKFG, rcNode, rcOpening, rcParam, rcNull );
-    *mgr = self->mgr;
-    return KConfigAddRef ( *mgr );
-}
-
-
-LIB_EXPORT rc_t CC KConfigNodeVOpenNodeRead ( const KConfigNode *self,
-                                              const KConfigNode **node, const char *path, va_list args )
-{
-    if ( self != NULL )
-        return KConfigNodeVOpenNodeReadInt ( self, self -> mgr, node, path, args );
-
-    if ( node == NULL )
-        return RC ( rcKFG, rcNode, rcOpening, rcParam, rcNull );
-
-    * node = NULL;
-    return RC ( rcKFG, rcNode, rcOpening, rcSelf, rcNull );
-}
-
-LIB_EXPORT rc_t CC KConfigNodeOpenNodeRead ( const KConfigNode *self,
-                                             const KConfigNode **node, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KConfigNodeVOpenNodeRead ( self, node, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KConfigVOpenNodeRead ( const KConfig *self,
-                                          const KConfigNode **node, const char *path, va_list args )
-{
-    rc_t rc;
-
-    if ( node == NULL )
-        rc = RC ( rcKFG, rcMgr, rcOpening, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcKFG, rcMgr, rcOpening, rcSelf, rcNull );
-        else if (self->tree.root == NULL)
-            rc = RC ( rcKFG, rcMgr, rcOpening, rcPath, rcNotFound );
-        else
-        {
-            return KConfigNodeVOpenNodeReadInt
-                ( (const KConfigNode *) self -> tree . root, self, node, path, args );
-        }
-
-        * node = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KConfigOpenNodeRead ( const KConfig *self,
-                                         const KConfigNode **node, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KConfigVOpenNodeRead ( self, node, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* OpenNodeUpdate
- * VOpenNodeUpdate
- *  opens a configuration node
- *
- *  "node" [ OUT ] - return parameter for indicated configuration node
- *
- *  "path" [ IN, NULL OKAY ] - optional path for specifying named
- *  node within configuration hierarchy. paths will be interpreted as
- *  if they were file system paths, using '/' as separator. the
- *  special values NULL and "" are interpreted as "."
- */
-static
-rc_t KConfigNodeVOpenNodeUpdateInt ( KConfigNode *self, KConfig *mgr,
-                                     KConfigNode **node, const char *path, va_list args )
-{
-    rc_t rc;
-
-    if ( node == NULL )
-        rc = RC ( rcKFG, rcNode, rcOpening, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcKFG, rcNode, rcOpening, rcSelf, rcNull );
-        else
-        {
-            if ( path == NULL || path [ 0 ] == 0 )
-            {
-                * node = self;
-                rc = 0;
-            }
-            else
-            {
-                KTokenText tt;
-                KTokenSource src;
-                char full [ 4096 ];
-        
-                rc = init_token_source ( & tt, & src, full, sizeof full, "", path, args );
-                if ( rc == 0 )
-                {
-                    /* look ahead */
-                    KToken t;
-
-                    do
-                        KTokenizerNext ( kPOSIXPathTokenizer, & src, & t );
-                    while ( t.id == eFwdSlash);
-
-                    /* follow path */
-                    assert ( mgr != NULL );
-                    if ( KConfigNodeCreate ( self, node, & src, & t, mgr -> current_file ) == NULL )
-                        return RC ( rcKFG, rcNode, rcOpening, rcPath, rcInvalid );
-                    if ( ( self = * node ) == NULL )
-                        rc = RC ( rcKFG, rcNode, rcOpening, rcMemory, rcExhausted );
-                    else if ( t . id != eEndOfInput )
-                        rc = RC ( rcKFG, rcNode, rcOpening, rcPath, rcInvalid );
-                }
-            }
-
-            if ( rc == 0 )
-            {
-                /* check to see if internal */
-                if ( self -> internal == eInternalTrue )
-                    rc = RC ( rcKFG, rcNode, rcOpening, rcNode, rcReadonly );
-                else
-                {
-                    /* check to see if open */
-                    if ( atomic32_read ( & self -> refcount ) == 0 )
-                    {
-                        self -> mgr = KConfigAttach ( mgr );
-                        assert ( ! self -> read_only );
-                        return KConfigNodeAddRef ( self );
-                    }
-
-                    rc = RC ( rcKFG, rcNode, rcOpening, rcNode, rcBusy );
-                }
-            }
-        }
-
-        * node = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KConfigNodeVOpenNodeUpdate ( KConfigNode *self,
-                                                KConfigNode **node, const char *path, va_list args )
-{
-    if ( self != NULL )
-        return KConfigNodeVOpenNodeUpdateInt ( self, self -> mgr, node, path, args );
-
-    if ( node == NULL )
-        return RC ( rcKFG, rcNode, rcOpening, rcParam, rcNull );
-
-    * node = NULL;
-    return RC ( rcKFG, rcNode, rcOpening, rcSelf, rcNull );
-}
-
-LIB_EXPORT rc_t CC KConfigNodeOpenNodeUpdate ( KConfigNode *self,
-                                               KConfigNode **node, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KConfigNodeVOpenNodeUpdate ( self, node, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KConfigVOpenNodeUpdate ( KConfig *self,
-                                            KConfigNode **node, const char *path, va_list args )
-{
-    rc_t rc;
-
-    if ( node == NULL )
-        rc = RC ( rcKFG, rcMgr, rcOpening, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcKFG, rcMgr, rcOpening, rcSelf, rcNull );
-        else if (self->tree.root == NULL)
-            rc = RC ( rcKFG, rcMgr, rcOpening, rcSelf, rcCorrupt );
-        else
-        {
-            return KConfigNodeVOpenNodeUpdateInt
-                ( ( KConfigNode* ) self -> tree . root, self, node, path, args );
-        }
-
-        * node = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KConfigOpenNodeUpdate ( KConfig *self,
-                                           KConfigNode **node, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KConfigVOpenNodeUpdate ( self, node, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* Read
- *  read a node value
- *
- *  "offset" [ IN ] - initial offset into configuration
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT ] - number of bytes actually read
- *
- *  "remaining" [ OUT, NULL OKAY ] - optional return parameter for
- *  the number of bytes remaining to be read.
- *  specifically, "offset" + "num_read" + "remaining" == sizeof node data
- */
-LIB_EXPORT rc_t CC KConfigNodeRead ( const KConfigNode *self,
-                                     size_t offset, char *buffer, size_t bsize,
-                                     size_t *num_read, size_t *remaining )
-{
-    rc_t rc;
-    size_t dummy;
-
-    if ( remaining == NULL )
-        remaining = & dummy;
-
-    if ( num_read == NULL )
-        rc = RC ( rcKFG, rcNode, rcReading, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcKFG, rcNode, rcReading, rcSelf, rcNull );
-        else if ( buffer == NULL && bsize != 0 )
-            rc = RC ( rcKFG, rcNode, rcReading, rcBuffer, rcNull );
-        else if ( offset >= self -> value . size )
-            rc = 0;
-        else
-        {
-            size_t avail = * remaining = self -> value . size - offset;
-            if ( avail > bsize )
-                avail = bsize;
-            if ( avail > 0 )
-                memcpy ( buffer, & self -> value . addr [ offset ], avail );
-            * num_read = avail;
-            * remaining -= avail;
-            return 0;
-        }
-
-        * num_read = 0;
-    }
-
-    * remaining = 0;
-
-    return rc;
-}
-
-static
-void KConfigNodeSetDirty ( KConfigNode *self )
-{
-    KConfig *mgr = self -> mgr;
-
-    if ( mgr == NULL )
-        self -> dirty = true;
-    else if ( mgr -> initialized )
-        self -> dirty = mgr -> dirty = true;
-}
-
-/* Write
- *  write a node value or attribute
- *  replaces anything already there
- *
- *  "buffer" [ IN ] and "size" [ IN ] - new value data
- */
-LIB_EXPORT rc_t CC KConfigNodeWrite ( KConfigNode *self, const char *buffer, size_t size )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcKFG, rcNode, rcWriting, rcSelf, rcNull );
-    else if ( self -> read_only || self -> internal == eInternalTrue )
-        rc = RC ( rcKFG, rcNode, rcWriting, rcSelf, rcReadonly );
-    else if ( size == 0 )
-    {
-        free ( self -> val_buffer ), self -> val_buffer = NULL;
-        StringInit ( & self -> value, "", 0, 0 );
-        rc = 0;
-    }
-    else if ( buffer == NULL )
-        rc = RC ( rcKFG, rcNode, rcWriting, rcBuffer, rcNull );
-    else
-    {
-        if ( size != self -> value . size )
-        {
-            void *new_buffer = realloc ( self -> val_buffer, size + 1 );
-            if ( new_buffer == NULL )
-                return RC ( rcKFG, rcNode, rcWriting, rcMemory, rcExhausted );
-            self -> val_buffer = new_buffer;
-            self -> value . size = size;
-            self -> value . addr = new_buffer;
-        }
-
-        assert ( self -> val_buffer != NULL );
-        string_copy ( self -> val_buffer, self -> value . size + 1, buffer, size );
-        self -> value . len = string_len ( self -> val_buffer, size );
-        
-        KConfigNodeSetDirty ( self );
-        
-        rc = 0;
-    }
-
-    return rc;
-}
-
-
-/* Append
- *  append data to value
- *
- *  "buffer" [ IN ] and "size" [ IN ] - value data to be appended
- */
-LIB_EXPORT rc_t CC KConfigNodeAppend ( KConfigNode *self, const char *buffer, size_t size )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcKFG, rcNode, rcWriting, rcSelf, rcNull );
-    else if ( self -> read_only || self -> internal )
-        rc = RC ( rcKFG, rcNode, rcWriting, rcSelf, rcReadonly );
-    else if ( size == 0 )
-        rc = 0;
-    else if ( buffer == NULL )
-        rc = RC ( rcKFG, rcNode, rcWriting, rcBuffer, rcNull );
-    else
-    {
-        void *new_buffer = realloc ( self -> val_buffer, self -> value . size + size + 1 );
-        if ( new_buffer == NULL )
-            return RC ( rcKFG, rcNode, rcWriting, rcMemory, rcExhausted );
-        self -> val_buffer = new_buffer;
-        string_copy ( & self -> val_buffer [ self -> value . size ], self -> value . size + size + 1, buffer, size );
-        self -> value . size += size;
-        self -> value . len = string_len ( self -> val_buffer, self -> value . size );
-        
-        KConfigNodeSetDirty ( self );
-
-        rc = 0;
-    }
-
-    return rc;
-}
-
-
-/* ReadAttr
- *  reads as NUL-terminated string
- *
- *  "name" [ IN ] - NUL terminated attribute name
- *
- *  "buffer" [ OUT ] and "bsize" - return parameter for attribute value
- *
- *  "size" [ OUT ] - return parameter giving size of string
- *  not including NUL byte. the size is set both upon success
- *  and insufficient buffer space error.
- */
-LIB_EXPORT rc_t CC KConfigNodeReadAttr ( const KConfigNode *self, const char *name,
-                                         char *buffer, size_t bsize, size_t *size )
-{
-    PLOGMSG (klogFatal, (klogFatal, "$(F) unimplemented", "F=%s", __func__));
-    return -1;
-}
-
-
-/* WriteAttr
- *  writes NUL-terminated string
- *
- *  "name" [ IN ] - NUL terminated attribute name
- *
- *  "value" [ IN ] - NUL terminated attribute value
- */
-LIB_EXPORT rc_t CC KConfigNodeWriteAttr ( KConfigNode *self,
-                                          const char *name, const char *value )
-{
-    PLOGMSG (klogFatal, (klogFatal, "$(F) unimplemented", "F=%s", __func__));
-    return -1;
-}
-
-
-/* Drop
- * VDrop
- *  drop some or all node content
- */
-LIB_EXPORT rc_t CC KConfigNodeDropAll ( KConfigNode *self )
-{
-    if ( self == NULL )
-        return RC ( rcKFG, rcNode, rcClearing, rcSelf, rcNull );
-    BSTreeWhack ( & self->children, KConfigNodeWhack, self->mgr); 
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KConfigNodeDropAttr ( KConfigNode *self, const char *attr )
-{
-    PLOGMSG (klogFatal, (klogFatal, "$(F) unimplemented", "F=%s", __func__));
-    return -1;
-}
-
-LIB_EXPORT rc_t CC KConfigNodeVDropChild ( KConfigNode *self, const char *path, va_list args )
-{
-    PLOGMSG (klogFatal, (klogFatal, "$(F) unimplemented", "F=%s", __func__));
-    return -1;
-}
-
-LIB_EXPORT rc_t CC KConfigNodeDropChild ( KConfigNode *self, const char *path, ... )
-{
-    PLOGMSG (klogFatal, (klogFatal, "$(F) unimplemented", "F=%s", __func__));
-    return -1;
-}
-
-
-/* Rename
- *  renames a contained object
- *
- *  "from" [ IN ] - NUL terminated string in UTF-8
- *  giving simple name of existing attr
- *
- *  "to" [ IN ] - NUL terminated string in UTF-8
- *  giving new simple attr name
- */
-LIB_EXPORT rc_t CC KConfigNodeRenameAttr ( KConfigNode *self, const char *from, const char *to )
-{
-    PLOGMSG (klogFatal, (klogFatal, "$(F) unimplemented", "F=%s", __func__));
-    return -1;
-}
-
-LIB_EXPORT rc_t CC KConfigNodeRenameChild ( KConfigNode *self, const char *from, const char *to )
-{
-    PLOGMSG (klogFatal, (klogFatal, "$(F) unimplemented", "F=%s", __func__));
-    return -1;
-}
-
-
-/*--------------------------------------------------------------------------
- * KConfig
- */
-
-static
-rc_t
-update_node ( KConfig* self, const char* key, const char* value,
-    TInternal internal )
-{
-    KConfigNode * node;
-    rc_t rc = KConfigVOpenNodeUpdate ( self, &node, key, NULL);
-    if (rc == 0)
-    {
-/*        pLogMsg(klogInfo, "updating config key $(KEY) with '$(VALUE)'", 
-                          "KEY=%s,VALUE=%s", 
-                          key, value);*/
-        rc = KConfigNodeWrite (node, value, string_size(value));
-        node -> internal = internal;
-        if (self->current_file != NULL && self->current_file->is_magic_file) {
-            if (node->came_from == NULL || !node->came_from->is_magic_file) {
-                node->came_from = self->current_file;
-            }
-        }
-        KConfigNodeRelease ( node );
-    }
-    return rc;
-}
-
-static
-rc_t write_nvp(void* pself, const char* name, size_t nameLen, VNamelist* values)
-{   /* concatenate all values from the namelist and put the result into config under the given name */
-    uint32_t count;
-    size_t size=0;
-    size_t concatTo=0;
-    uint32_t i;
-
-    char* buf;
-    KConfig *self = (KConfig *)pself;
-    rc_t rc=VNameListCount(values, &count);
-    if (rc != 0)
-    {
-        return rc;
-    }
-    for (i=0; i < count; ++i)
-    {
-        const char* val;
-        rc=VNameListGet(values, i, &val);
-        if (rc != 0)
-        {
-            return rc;
-        }
-        size+=string_size(val);
-    }
-
-    buf=(char*)malloc(size+1);
-    if (buf == 0)
-    {
-        return RC ( rcKFG, rcMgr, rcLoading, rcMemory, rcExhausted );
-    }
-
-    concatTo=0;
-    for (i=0; i < count; ++i)
-    {
-        const char* val;
-        rc=VNameListGet(values, i, &val);
-        if (rc != 0)
-        {
-            free(buf);
-            return rc;
-        }
-        string_copy(buf+concatTo, size+1-concatTo, val, string_size(val));
-        concatTo+=string_size(val);
-    }
-    buf[size]=0;
-
-    {   /* create the node */
-        String* nameStr;
-    
-        /* some old config files may have "dbGaP" in their repository keys misspelled as "dbGap" - fix if seen */
-        const char* oldGaPprefix = "/repository/user/protected/dbGap-";
-        size_t size = sizeof("/repository/user/protected/dbGap-") - 1;
-        bool needsFix = string_cmp(name, string_measure(name, NULL), oldGaPprefix, size, (uint32_t)size) == 0;
-
-        String tmp;
-        StringInit(&tmp, name, nameLen, (uint32_t)nameLen);
-        StringCopy((const String**)&nameStr, &tmp);
-        if (needsFix)
-            ((char*)(nameStr->addr)) [ size - 2 ] = 'P';
-    
-        rc = update_node(self, nameStr->addr, buf, false);
-        if (needsFix)
-        {
-            KConfigNode * node;
-            rc = KConfigVOpenNodeUpdate ( self, &node, nameStr->addr, NULL);
-            if (rc == 0)
-            {   /* we are likely to be initializing, so have to set the dirty flags directly, not through KConfigNodeSetDirty() */
-                self -> dirty = true;
-                node -> dirty = true;
-                KConfigNodeRelease ( node );
-            }
-        }
-        StringWhack(nameStr);
-    }
-    
-    free(buf);
-    return rc;
-}
-
-static
-bool look_up_var(void * self, struct KFGParseBlock* pb)
-{
-    const KConfigNode* node;
-    rc_t rc = KConfigOpenNodeRead((KConfig*)self, &node, "%.*s", pb->tokenLength-3, pb->tokenText+2);
-    if (rc == 0)
-    {
-        pb->tokenText   = node->value.addr; 
-        pb->tokenLength = node->value.len;
-        pb->tokenId     = kfgVAR_REF;
-    }
-    KConfigNodeRelease(node);
-    return rc == 0;
-}
-
-static
-void CC report_error(KFGScanBlock* sb, const char* msg)
-{
-    pLogMsg(klogErr, "$(file):$(line):$(column): error: token='$(token)', msg='$(msg)'", 
-                     "file=%s,line=%d,column=%d,token=%.*s,msg=%s", 
-                     sb->file, 
-                     sb->lastToken->line_no, 
-                     sb->lastToken->column_no, 
-                     sb->lastToken->tokenLength, 
-                     sb->lastToken->tokenText, 
-                     msg);
-}
-
-#define DISP_RC2(rc, name, msg) (void)((rc == 0) ? 0 : \
-    PLOGERR(klogInt, (klogInt, rc, \
-        "$(name): $(msg)", "name=%s,msg=%s", name, msg)))
-
-static rc_t printIndent(int indent) {
-    rc_t rc = 0;
-
-    int i = 0;
-    for (i = 0; i < indent * 2; ++i) {
-        rc_t rc2 = OUTMSG((" "));
-        if (rc == 0 && rc2 != 0) {
-            rc = rc2;
-        }
-    }
-
-    return rc;
-}
-
-static rc_t KConfigNodeReadData(const KConfigNode* self,
-    char* buf, size_t blen, size_t* num_read)
-{
-    rc_t rc = 0;
-    size_t remaining = 0;
-
-    assert(buf && blen && num_read);
-
-    rc = KConfigNodeRead(self, 0, buf, blen, num_read, &remaining);
-
-    assert(remaining == 0); /* TODO overflow check */
-    assert(*num_read <= blen);
-
-    return rc;
-}
-
-static rc_t _printNodeData(const char *name, const char *data, uint32_t dlen) {
-    const char ticket[] = "download-ticket";
-    size_t l = sizeof ticket - 1;
-    if (string_cmp(name, string_measure(name, NULL),
-        ticket, l, (uint32_t)l) == 0)
-    {
-        const char *ellipsis = "";
-        const char replace[] =
-"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
-        if (dlen > 70) {
-            dlen = 70;
-            ellipsis = "...";
-        }
-        return OUTMSG(("%.*s%s", dlen, replace, ellipsis));
-    }
-    else {
-        return OUTMSG(("%.*s", dlen, data));
-    }
-}
-
-static
-rc_t KConfigNodePrint(const KConfigNode* self,
-    int indent, const char* root, bool debug)
-{
-    rc_t rc = 0;
-    KNamelist* names = NULL;
-    uint32_t count = 0;
-    uint32_t i = 0;
-    char data[4097] = "";
-    size_t num_data = 0;
-    assert(self);
-
-    printIndent(indent);
-    OUTMSG(("<%s>", root));
-
-    if (rc == 0) {
-        rc_t rc = KConfigNodeReadData(self, data, sizeof data, &num_data);
-        DISP_RC2(rc, "KConfigNodeReadData()", root);
-        if (rc == 0 && num_data > 0) {
-            _printNodeData(root, data, num_data);
-        }
-        if (debug && self->came_from) {
-            OUTMSG(("<came_from is_magic_file=\"%s\"/>",
-                self->came_from->is_magic_file ? "true" : "false"));
-        }
-    }
-
-    if (rc == 0) {
-        rc = KConfigNodeListChild(self, &names);
-        DISP_RC2(rc, "KConfigNodeListChild()", root);
-    }
-    if (rc == 0) {
-        rc = KNamelistCount(names, &count);
-        DISP_RC2(rc, "KNamelistCount()", root);
-    }
-
-    if (rc == 0) {
-        if (count > 0) {
-            OUTMSG(("\n"));
-        }
-        for (i = 0; i < count; ++i) {
-            const char* name = NULL;
-            const KConfigNode* node = NULL;
-            if (rc == 0) {
-                rc = KNamelistGet(names, i, &name);
-                DISP_RC2(rc, "KNamelistGet()", root);
-            }
-            if (rc == 0) {
-                rc = KConfigNodeOpenNodeRead(self, &node, name);
-                DISP_RC2(rc, "KConfigNodeOpenNodeRead()", name);
-            }
-            if (rc == 0) {
-                KConfigNodePrint(node, indent + 1, name, debug);
-            }
-            KConfigNodeRelease(node);
-        }
-    }
-
-    if (count > 0) {
-        printIndent(indent);
-    }
-    OUTMSG(("</%s>\n", root));
-
-    KNamelistRelease(names);
-
-    return rc;
-}
-
-static rc_t CC KConfigPrintImpl(const KConfig* self, int indent,
-    const char *root, bool debug)
-{
-    rc_t rc = 0;
-
-    if (root == NULL) {
-        root = "Config";
-    }
-
-    if (self == NULL) {
-        OUTMSG(("<%s>", root));
-        OUTMSG(("KConfigPrint(const KConfig* self = NULL)\n"));
-        OUTMSG(("</%s>\n", root));
-    }
-    else {
-        const KConfigNode* node = NULL;
-        if (rc == 0) {
-            rc = KConfigOpenNodeRead(self, &node, "/");
-            DISP_RC2(rc, "KConfigOpenNodeRead()", "/");
-        }
-        if (rc == 0) {
-            KConfigNodePrint(node, indent, root, debug);
-        }
-        KConfigNodeRelease(node);
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KConfigPrintDebug(const KConfig* self, const char *path) {
-    return KConfigPrintImpl(self, 0, path, true);
-}
-
-/*
- * Set up the parameter block and start parsing lines
- */
-static
-rc_t parse_file ( KConfig * self, const char* path, const char * src )
-{
-    KFGParseBlock pb;
-    KFGScanBlock sb;
-    rc_t rc;
-
-/*  KConfigPrintDebug(self, NULL); */
-
-    pb.tokenLength  = 0;
-    pb.line_no      = 0;
-    pb.column_no    = 0;
-
-    sb.self         = self;
-    sb.file         = path;
-    sb.write_nvp    = write_nvp;
-    sb.look_up_var  = look_up_var;
-    sb.report_error = report_error;
-
-    rc = KFGScan_yylex_init(&sb, src);
-    if (rc == 0)
-    {
-        KFG_parse(&pb, &sb); /* may have reported parse errors into log, but we should have been able to extract enough data to proceed regardless */
-        KFGScan_yylex_destroy(&sb);
-    }
-
-/*  KConfigPrintDebug(self, path); */
-
-    return rc;
-}
-
-/* LoadFile
- * loads a configuration file
- */
-LIB_EXPORT rc_t CC KConfigLoadFile ( KConfig * self, const char * path, const KFile * file )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcKFG, rcMgr, rcLoading, rcSelf, rcNull );
-    else if ( file == NULL )
-        rc = RC ( rcKFG, rcMgr, rcLoading, rcFile, rcNull );
-    else
-    {
-        const KMMap * mm;
-        bool entry_initialized = self -> initialized;
-        self -> initialized = false;
-
-        /* populate file-specific predefined nodes */
-#define UPDATE_NODES(dir, file)                             \
-        rc = update_node(self, "kfg/dir", dir, eInternalTrueUpdatable );     \
-        if (rc == 0)                                        \
-            rc = update_node(self, "kfg/name", file, eInternalTrueUpdatable )
-
-        if ( path == NULL || path [ 0 ] == 0)
-        {
-            path = "UNSPECIFIED";
-            UPDATE_NODES ( "", "" );
-        }
-        else
-        {
-            KDirectory* dir;
-            rc = KDirectoryNativeDir(&dir);
-            if (rc == 0 )
-            {
-                char buff [ 4096 ];
-                rc = KDirectoryResolvePath ( dir, true, buff, sizeof buff,
-                    "%.*s", string_size(path), path );
-                if ( rc == 0 )
-                {
-                    char* name = strrchr (buff, '/');
-                    if (name == NULL)
-                    {   /* no dir name */
-                        UPDATE_NODES("", buff);
-                    }
-                    else
-                    {
-                        *name=0; /* nul-terminate dir name; file name follows the 0 */
-                        UPDATE_NODES(buff, name+1);
-                    }
-                }
-                KDirectoryRelease ( dir );
-            }
-            else
-            {
-                update_node(self, "kfg/dir", "", eInternalTrueUpdatable);
-                update_node(self, "kfg/name", "", eInternalTrueUpdatable);
-            }
-        }
-#undef UPDATE_NODES
-
-
-        rc = KMMapMakeRead ( & mm, file );
-        if ( rc == 0 )
-        {
-            size_t size;
-            const void * ptr;
-            rc = KMMapAddrRead ( mm, & ptr );
-            if ( rc == 0 )
-                rc = KMMapSize ( mm, & size );
-            if ( rc == 0 )
-            {
-                /* make a 0-terminated copy for parsing */
-                char* buf=malloc(size+1);
-                if (buf == 0)
-                {
-                    rc = RC ( rcKFG, rcMgr, rcLoading, rcMemory, rcExhausted );
-                }
-                else
-                {
-                    string_copy(buf, size+1, ptr, size);
-                    buf[size]=0;
-
-                    /* Parse the path to populate: */
-                 /* update_node(self, "kfg/dir", dir, eInternalTrueUpdatable);*/
-               /* update_node(self, "kfg/name", name, eInternalTrueUpdatable);*/
-
-                    /* parse config file */
-                    rc = parse_file ( self, path, buf );
-                    free(buf);
-                }
-            }
-
-            KMMapRelease ( mm );
-        }
-        self -> initialized = entry_initialized;
-    }
-
-    return rc;
-}
-
-
-typedef struct PrintBuff PrintBuff;
-struct PrintBuff
-{
-    KFile *f;
-    /* total bytes flushed to the file*/
-    size_t flushed;
-    /* total bytes in buffer */
-    size_t buffered;
-    
-    rc_t rc;
-    
-    /* buffer */
-    char buffer [ 32 * 1024 ];
-    
-};
-
-/* Init
- *  initialize your structure    
- */
-static
-void PrintBuffInit ( PrintBuff *pb, KFile *f )
-{
-    assert ( pb != NULL );
-    pb -> f = f;
-    pb -> flushed = 0;
-    pb -> buffered = 0;
-    pb -> rc = 0;
-}
-
-/* Flush
- * Write buffer out to file
- */
-static rc_t PrintBuffFlush ( PrintBuff *self )
-{
-    rc_t rc = 0;
-
-    assert ( self != NULL );
-    if ( self -> buffered != 0 )
-    {
-        size_t num_writ;
-        rc = KFileWriteAll ( self -> f, self -> flushed, self -> buffer, self -> buffered, & num_writ );
-        
-        if ( rc == 0 )
-        {
-            if ( num_writ != self -> buffered )
-                rc = RC ( rcKFG, rcBuffer, rcFlushing, rcTransfer, rcIncomplete );
-            else
-            {
-                self -> flushed += num_writ;
-                self -> buffered = 0;
-            }
-        }
-    }
-    return self -> rc = rc;
-}
-
-/* Print
- *  printf style writing to the buffer
- */
-static
-rc_t PrintBuffPrint ( PrintBuff *self, const char *fmt, ... )
-{
-    rc_t rc;
-    size_t num_writ;
-    va_list args1, args2;
-
-    assert ( self != NULL );
-    assert ( fmt != NULL );
-    assert ( fmt [ 0 ] != 0 );
-
-    va_start ( args1, fmt );
-    va_copy ( args2, args1 );
-
-    rc = string_vprintf ( & self -> buffer [ self -> buffered ], 
-                          sizeof self -> buffer - self -> buffered, & num_writ, fmt, args1 );
-    if ( rc == 0 )
-        self -> buffered += num_writ;
-    else if ( GetRCObject ( rc ) == rcBuffer && GetRCState ( rc ) == rcInsufficient )
-    {
-        rc = PrintBuffFlush ( self );
-        if ( rc == 0 )
-        {
-            rc = string_vprintf ( & self -> buffer [ self -> buffered ],
-                                  sizeof self -> buffer - self -> buffered, & num_writ, fmt, args2 );
-            if ( rc == 0 )
-                self -> buffered += num_writ;
-        }
-    }
-
-    va_end ( args2 );
-    va_end ( args1 );
-
-    return self -> rc = rc;
-    
-}
-
-char ToHex(uint32_t i)
-{
-    if (i <= 9)
-        return '0' + i;
-    return 'A' + (i - 10);
-}
-
-static
-rc_t CC PrintBuffPrintQuoted ( PrintBuff *self, const String* data )
-{
-    rc_t rc = PrintBuffPrint(self, "\"");
-    const char* str = (const char*)(data->addr);
-    uint32_t i;
-    for ( i = 0; i < StringLength(data); ++i )
-    {
-        if (rc != 0)
-            break;
-        if (str[i] < ' ')
-        {
-            rc = PrintBuffPrint(self, "\\x%c%c", ToHex(str[i]/16), ToHex(str[i]%16) );
-        }
-        else
-        {
-            switch (str[i])
-            {
-            case '"':
-                rc = PrintBuffPrint(self, "\\\"");
-                break;
-            default:
-                rc = PrintBuffPrint(self, "%c", str[i]);
-            }
-        }
-    }
-    if (rc == 0)
-        rc = PrintBuffPrint(self, "\"");
-    return rc;
-}
-
-static
-bool KConfigNodePrintPath ( KConfigNode *self, PrintBuff *pb )
-{
-    if ( self -> dad == NULL )
-        PrintBuffPrint ( pb, "%S", & self -> name );
-    else
-    {
-        if ( KConfigNodePrintPath ( self -> dad, pb ) )
-            return true;
-
-        PrintBuffPrint ( pb, "/%S", & self -> name );
-    }
-    return pb -> rc != 0;
-}
-
-static
-bool CC WriteDirtyNode ( BSTNode *n, void *data )
-{
-    KConfigNode *self = ( KConfigNode * ) n;
-    PrintBuff *pb = data;
-
-    if ( self -> dirty
-        || ( self -> came_from != NULL && self -> came_from -> is_magic_file 
-             && ! self -> internal ) )
-    {
-        if ( KConfigNodePrintPath ( self, pb ) )
-            return true;
-
-        if ( PrintBuffPrint ( pb, " = " ) != 0 )
-            return true;
-            
-        if ( PrintBuffPrintQuoted ( pb, &self->value ) != 0 )
-            return true;
-            
-        if ( PrintBuffPrint ( pb, "\n" ) != 0 )
-            return true;
-    }
-
-    return BSTreeDoUntil ( & self -> children, false, WriteDirtyNode, pb );
-}
-
-static
-void CC UnsetDirtyNode ( BSTNode *n, void *data )
-{
-    KConfigNode *self = ( KConfigNode * ) n;
-
-    if ( self -> dirty )
-        self -> dirty = false;
-
-    BSTreeForEach ( & self -> children, false, UnsetDirtyNode, data );
-}
-
-static
-rc_t path_to_magic_file ( const KConfig *self, char *path, size_t buffer_size, size_t *path_size )
-{
-    const KConfigNode *node;
-    rc_t rc = KConfigOpenNodeRead ( self, & node, "NCBI_SETTINGS" );
-
-    if ( rc == 0 )
-    {
-        size_t num_read, remaining;
-        rc = KConfigNodeRead ( node, 0, path, buffer_size - 1, & num_read, & remaining );
-
-        if ( rc == 0 && remaining != 0 )
-           rc = RC ( rcKFG, rcNode, rcReading, rcBuffer, rcInsufficient );
-
-        path[num_read] = '\0';
-        
-        KConfigNodeRelease ( node );
-    }
-    return rc;
-}
-
-/* Commit
- *  commits changes to user's private configuration file
- */
-LIB_EXPORT rc_t CC KConfigCommit ( KConfig *self )
-{
-    rc_t rc;
-    size_t path_size;
-    char magic_file_path [ 4096 ];
-
-    if ( self == NULL )
-        return RC ( rcKFG, rcData, rcCommitting, rcSelf, rcNull );
-
-    /* Must only commit dirty nodes*/
-    if ( ! self -> dirty )
-        return 0;
-
-    rc = path_to_magic_file ( self, magic_file_path, sizeof magic_file_path, & path_size );
-    if ( rc == 0 )
-    {
-        char tmp_file_path [ 4096 ];
-        rc = string_printf ( tmp_file_path, sizeof tmp_file_path, NULL, "%s.tmp", magic_file_path );
-        if ( rc == 0 )
-        {
-            KDirectory *dir;        
-            
-            /* get current directory */
-            rc = KDirectoryNativeDir ( & dir );
-            if ( rc == 0 )
-            {
-                KFile *tmp;
-
-                /* create temp magic file */
-                rc = KDirectoryCreateFile ( dir, & tmp, false, 0600, kcmInit | kcmParents, tmp_file_path );
-
-                if ( rc == 0 )
-                {
-                    PrintBuff pb;
-                    PrintBuffInit ( & pb, tmp );
-
-                    /* issue warning */
-                    rc = PrintBuffPrint ( & pb, "## auto-generated configuration file - DO NOT EDIT ##\n\n" );
-                    if ( rc == 0 )
-                    {
-                        /* flush nodes to file */
-                        if ( BSTreeDoUntil ( & self -> tree, false, WriteDirtyNode, & pb ) )
-                            /* failure */
-                            rc = pb . rc;
-                        else 
-                            rc = PrintBuffFlush ( & pb );
-                    }
-                        
-                    KFileRelease ( tmp );
-                        
-                    if ( rc == 0 )
-                    {
-                        /* Rename file */
-                        rc = KDirectoryRename ( dir, true, tmp_file_path, magic_file_path  );
-                        if ( rc == 0 )
-                        {
-                            /* clear dirty flags */
-                            BSTreeForEach (  & self -> tree, false, UnsetDirtyNode, & pb);
-                                
-                            self -> dirty = false;
-                        }
-                    }
-                        
-                    if ( rc != 0 )
-                        KDirectoryRemove ( dir, true, tmp_file_path );
-                }
-            
-                /* release dir */
-                KDirectoryRelease ( dir );
-            }
-        }
-    }
-    return rc;
-}
-
-
-static
-rc_t record_magic_path ( KConfig *self, const KDirectory *dir, const char *path, size_t sz )
-{
-    char buff [ 4096 ];
-    rc_t rc = KDirectoryResolvePath ( dir, true, buff, sizeof buff, "%.*s", ( int ) sz, path );
-    if ( rc == 0 )
-    {
-        char *magic_file_path;
-        sz = string_size ( buff );
-        magic_file_path = malloc ( sz + 1 );
-        if ( magic_file_path == NULL )
-            rc = RC ( rcKFG, rcMgr, rcLoading, rcMemory, rcExhausted );
-        else
-        {
-            free ( (void*) self -> magic_file_path );
-            self -> magic_file_path = magic_file_path;
-            self -> magic_file_path_size = sz;
-            memcpy ( magic_file_path, buff, sz + 1 );
-        }
-    }
-
-    return rc;
-}
-
-
-static
-rc_t make_include_path ( KConfigIncluded **p, const KDirectory *dir, const char *path, size_t sz, bool is_magic )
-{
-    char buff [ 4096 ];
-    rc_t rc = KDirectoryResolvePath ( dir, true, buff, sizeof buff, "%.*s", ( int ) sz, path );
-    if ( rc == 0 )
-    {
-        KConfigIncluded *include;
-        sz = string_size ( buff );
-        include = malloc ( sizeof * include + sz );
-        if ( include == NULL )
-            rc = RC ( rcKFG, rcMgr, rcLoading, rcMemory, rcExhausted );
-        else
-        {
-            include -> is_magic_file = is_magic;
-            string_copy ( include -> path, sz + sizeof include -> path, buff, sz );
-            * p = include;
-            return 0;
-        }
-    }
-    * p = NULL;
-    return rc;
-}
-
-
-static
-bool load_from_file_path ( KConfig *self, const KDirectory *dir, const char *path, size_t sz, bool is_magic )
-{
-    rc_t rc;
-    const KFile *cfg_file;
-
-    /* record magic file path, regardless of whether it exists as a file */
-    if ( is_magic )
-        record_magic_path ( self, dir, path, sz );
-    
-    DBGMSG( DBG_KFG, DBG_FLAG(DBG_KFG), ( "KFG: try to load from file '%.*s'\n", (int)sz, path ) );
-    rc = KDirectoryOpenFileRead ( dir, & cfg_file, "%.*s", ( int ) sz, path );
-    if ( rc == 0 )
-    {
-        KConfigIncluded *include;
-        rc = make_include_path ( & include, dir, path, sz, is_magic );
-        if ( rc == 0 )
-        {
-            BSTNode *existing;
-            if ( BSTreeInsertUnique ( & self -> included, & include -> n, & existing, KConfigIncludedSort ) != 0 )
-                free ( include );
-            else
-            {
-                self -> current_file = include;
-                rc = KConfigLoadFile ( self, include -> path, cfg_file );
-                self -> current_file = NULL;
-                if ( rc != 0 )
-                {
-                    BSTreeUnlink ( & self -> included, & include -> n );
-                    free ( include );
-                }
-            }
-        }
-
-        KFileRelease ( cfg_file );
-    }
-    return ( rc == 0 ) ? true : false;
-}
-
-typedef struct scan_config_path_data scan_config_path_data;
-struct scan_config_path_data
-{
-    KConfig *self;
-    bool loaded;
-};
-
-static
-rc_t CC scan_config_path ( const KDirectory *dir, uint32_t type, const char *name, void *data )
-{
-    scan_config_path_data * pb = data;
-    switch ( type )
-    {
-    case kptFile:
-    case kptFile | kptAlias:
-    {
-        size_t sz = string_size ( name );
-        if ( sz >= 5 && strcase_cmp ( & name [ sz - 4 ], 4, ".kfg", 4, 4 ) == 0 )
-            pb -> loaded |= load_from_file_path ( pb -> self, dir, name, sz, false );
-
-        break;
-    }}
-
-    return 0;
-}
-
-static
-bool scan_config_dir ( KConfig *self, const KDirectory *dir )
-{
-    scan_config_path_data pb;
-
-    pb . self = self;
-    pb . loaded = false;
-
-    KDirectoryVVisit ( dir, false, scan_config_path, & pb, ".", NULL );
-
-    return pb . loaded;
-}
-
-static
-bool load_from_dir_path ( KConfig *self, const KDirectory *dir, const char *path, size_t sz )
-{
-    bool loaded = false;
-    const KDirectory *cfg_dir;
-    rc_t rc = KDirectoryOpenDirRead ( dir, & cfg_dir, false, "%.*s", ( uint32_t ) sz, path );
-    if ( rc == 0 )
-    {
-        DBGMSG( DBG_KFG, DBG_FLAG(DBG_KFG), ( "KFG: try to load from directory '%.*s'\n", (int)sz, path ) );
-        loaded = scan_config_dir ( self, cfg_dir );
-        KDirectoryRelease ( cfg_dir );
-    }
-    return loaded;
-}
-
-static
-bool load_from_path ( KConfig *self, const KDirectory * dir, const char *path, size_t sz )
-{
-    bool loaded = false;
-    const char *naughty = string_chr ( path, sz, '%' );
-    if ( naughty == NULL && sz != 0 )
-    {
-        DBGMSG( DBG_KFG, DBG_FLAG(DBG_KFG), ( "KFG: try to load from path '%.*s'\n", (int)sz, path ) );
-        switch ( KDirectoryPathType ( dir, "%.*s", ( int ) sz, path ) & ~ kptAlias )
-        {
-        case kptFile:
-            loaded = load_from_file_path ( self, dir, path, sz, false );
-            break;
-        case kptDir:
-            loaded = load_from_dir_path ( self, dir, path, sz );
-            break;
-        }
-    }
-    return loaded;
-}
-
-static
-bool load_from_path_list ( KConfig *self, const KDirectory *dir, const char *path )
-{
-    bool loaded = false;
-    const char *end = path + string_size ( path );
-    while ( path < end )
-    {
-        const char *sep = string_chr ( path, end - path, ':' );
-        if ( sep == NULL )
-            sep = end;
-        if ( load_from_path ( self, dir, path, sep - path ) )
-            loaded = true;
-        path = sep + 1;
-    }
-    return loaded;
-}
-
-static
-bool load_from_env_variable ( KConfig *self, const KDirectory *dir )
-{
-    const char * env_list [] =
-    {
-        "KLIB_CONFIG",
-        "VDB_CONFIG",
-        "VDBCONFIG"
-    };
-    
-    int i;
-    bool loaded = false;
-    for ( i = 0; ! loaded && i < sizeof env_list / sizeof env_list [ 0 ]; ++ i )
-    {
-        const char *eval = getenv ( env_list [ i ] );
-        DBGMSG( DBG_KFG, DBG_FLAG(DBG_KFG), ( "KFG: try to load from env. var '%s'\n", env_list[ i ] ) );
-        if ( eval != NULL && eval [ 0 ] != 0 )
-        {
-            rc_t rc = 0;
-            DBGMSG( DBG_KFG, DBG_FLAG(DBG_KFG), ( "KFG: try to load from env. var '%s'\n", eval ) );
-            rc = KConfigAppendToLoadPath(self, eval);
-            loaded = load_from_path_list ( self, dir, eval );
-            if ( loaded )
-                DBGMSG( DBG_KFG, DBG_FLAG(DBG_KFG), ( "KFG: found from env. var '%s'\n", eval ) );
-        }
-    }
-
-    return loaded;
-}
-
-static
-bool load_from_std_location ( KConfig *self, const KDirectory *dir )
-{
-    const char * std_locs [] =
-    {
-#if ! WINDOWS
-        "/etc/ncbi",
-#else
-        "/c/ncbi",
-#endif
-    };
-
-    rc_t rc = 0;
-
-    int i;
-    bool loaded = false;
-    for ( i = 0; ! loaded && i < sizeof std_locs / sizeof std_locs [ 0 ]; ++ i )
-    {
-        DBGMSG( DBG_KFG, DBG_FLAG(DBG_KFG), ( "KFG: try to load from std. location '%s'\n", std_locs[ i ] ) );
-        rc = KConfigAppendToLoadPath(self, std_locs [ i ]);
-        loaded = load_from_path ( self, dir,
-            std_locs [ i ], string_size ( std_locs [ i ] ));
-    }
-    if ( loaded )
-        DBGMSG( DBG_KFG, DBG_FLAG(DBG_KFG), ( "KFG: found from std. location\n" ) );
-    return loaded;
-}
-
-static
-rc_t find_home_directory ( KDyld *dyld, const KDirectory **dir )
-{
-    static const KDirectory * cached_dir = NULL;
-    static rc_t cached_rc = 0;
-    rc_t rc;
-
-    if ( cached_dir != NULL )
-    {
-        rc = KDirectoryAddRef ( cached_dir );
-        if ( rc == 0 ) {
-            * dir = cached_dir;
-        }
-        return rc;
-    }
-    else if ( cached_rc != 0 )
-    {
-        return cached_rc;
-    }
-
-    rc = KDyldHomeDirectory ( dyld, dir, ( fptr_t ) KConfigMake );
-
-    if ( rc != 0
-        ||  (KDirectoryPathType ( * dir, "ncbi" ) & ~kptAlias) != kptDir )
-    {
-        KDylib * lib;
-        if ( rc == 0 )
-        {
-            /* Nominally succeeded, but got a useless directory
-             * (for a statically linked executable?); try again. */
-            KDirectoryRelease ( * dir );
-        }
-        rc = KDyldLoadLib ( dyld, & lib, LPFX "kfg-beacon" SHLX );
-        if ( rc == 0 )
-        {
-            KSymAddr * sym;
-            if ( ( rc = KDylibSymbol ( lib, & sym, "KConfigBeacon" ) ) == 0 )
-            {
-                fptr_t fp;
-                KSymAddrAsFunc ( sym, & fp );
-                rc = KDyldHomeDirectory ( dyld, dir, fp );
-                KSymAddrRelease ( sym );
-            }
-            KDylibRelease ( lib );
-        }
-    }
-
-    if ( rc == 0  &&  KDirectoryAddRef ( * dir ) == 0 )
-    {
-        cached_dir = * dir;
-    }
-    else
-    {
-        cached_rc = rc;
-    }
-
-    return rc;
-}
-
-static
-rc_t load_from_fs_location ( KConfig *self )
-{
-    KDyld *dyld;
-    rc_t rc = KDyldMake ( & dyld );
-    if ( rc == 0 )
-    {
-        const KDirectory *dir;
-        rc = find_home_directory ( dyld, & dir );
-        if ( rc == 0 )
-        {
-            char resolved[PATH_MAX + 1];
-            DBGMSG( DBG_KFG, DBG_FLAG(DBG_KFG), ( "KFG: try to load from dyn. loader\n" ) );
-
-/* N.B. Duplication of ResolvePath here and in load_from_dir_path ? */
-            if (KDirectoryResolvePath
-                    (dir, true, resolved, sizeof resolved, "ncbi") == 0)
-            {
-                rc = KConfigAppendToLoadPath(self, resolved);
-            }
-            if ( load_from_dir_path ( self, dir, "ncbi", 4 ) )
-                DBGMSG( DBG_KFG, DBG_FLAG(DBG_KFG), ( "KFG: found from dyn. loader\n" ) );
-            KDirectoryRelease ( dir );
-        }
-        KDyldRelease ( dyld );
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KConfigGetLoadPath ( const KConfig *self,
-    const char **path )
-{
-    if (self == NULL) {
-        return RC ( rcKFG, rcPath, rcListing, rcSelf, rcNull );
-    }
-
-    if (path == NULL) {
-        return RC ( rcKFG, rcPath, rcListing, rcParam, rcNull );
-    }
-
-    *path = self->load_path;
-    return 0;
-}
-
-static
-bool load_user_settings(KConfig *self, const KDirectory *dir, const char* dir_path)
-{
-    size_t num_writ;
-    char path[PATH_MAX];
-    rc_t rc = string_printf ( path, sizeof(path), & num_writ, "%s/%s", dir_path, MAGIC_LEAF_NAME );
-    if ( rc == 0 )
-        return load_from_file_path ( self, dir, path, string_measure(path, NULL), true );
-
-    return false;
-}
-
-static
-bool load_from_home(KConfig *self, const KDirectory *dir)
-{
-    const char *home = getenv("HOME");
-    DBGMSG( DBG_KFG, DBG_FLAG(DBG_KFG), ( "KFG: checking HOME\n" ) );
-
-    if (home == NULL) {
-        home = getenv("USERPROFILE");
-    }
-
-    if (home != NULL)
-    {
-        bool loaded;
-        size_t num_writ;
-        char path[PATH_MAX];
-        rc_t rc = string_printf(path, sizeof path, &num_writ, "%s/.ncbi", home);
-        if (rc != 0)
-            return false;
-
-        assert(num_writ < sizeof path);
-        
-        loaded = load_from_path ( self, dir, path, num_writ );
-        if ( loaded )
-        {
-            DBGMSG( DBG_KFG, DBG_FLAG(DBG_KFG),
-                ( "KFG: found from '%s'\n", path ) );
-        }
-
-        if ( load_user_settings ( self, dir, path ) )
-            loaded = true;
-            
-        return loaded;
-    }
-    else {
-        DBGMSG( DBG_KFG, DBG_FLAG(DBG_KFG),
-            ( "KFG: none of env{HOME}, env{USERPROFILE} is defined\n" ) );
-    }
-
-    return false;
-}
-
-static
-void load_config_files ( KConfig *self, const KDirectory *dir )
-{
-    rc_t rc;
-    bool loaded;
-    KDirectory *wd;
-
-    /* if user supplied a starting point, try that */
-    if ( dir != NULL )
-    {
-        DBGMSG( DBG_KFG, DBG_FLAG(DBG_KFG), ( "KFG: try load from supplied directory\n" ) );
-
-        loaded = scan_config_dir ( self, dir );
-        if ( loaded )
-            DBGMSG( DBG_KFG, DBG_FLAG(DBG_KFG), ( "KFG: found from supplied directory\n" ) );
-
-        if ( load_user_settings ( self, dir, "." ) )
-            loaded = true;
-
-        if ( loaded )
-            return;
-    }
-
-    /* open up the native directory */
-    rc = KDirectoryNativeDir ( & wd );
-    if ( rc != 0 )
-        return;
-
-    /* try to load from environment variable */
-    loaded = load_from_env_variable ( self, wd );
-
-    /* try to load from standard locations */
-    if ( ! loaded )
-        loaded = load_from_std_location ( self, wd );
-
-    /* check for config as the result of a user install
-       i.e. not an admin installation */
-    if ( ! loaded )
-        load_from_fs_location ( self );
-
-    if ( ! s_disable_user_settings )
-        loaded |= load_from_home ( self, wd );
-
-    KDirectoryRelease ( wd );
-
-    if (self->load_path) {
-        char* tmp = NULL;
-        self->load_path_sz_tmp = string_size(self->load_path) + 1;
-        tmp = realloc(self->load_path, self->load_path_sz_tmp);
-        if (tmp) {
-            self->load_path = tmp;
-        }
-    }
-}
-
-static
-void add_predefined_nodes ( KConfig * self, const char *appname )
-{
-    size_t bytes;
-    char buf [ 4096 ];
-    const char *value;
-
-    KDirectory *cwd;
-    const KDirectory *dir;
-
-#if ! WINDOWS
-    struct utsname name;
-#endif
-
-    /* Path to libkfg.so */
-    KDyld *dyld;
-    rc_t rc = KDyldMake ( & dyld );
-    if ( rc == 0 )
-    {
-        rc = find_home_directory ( dyld, & dir );
-        if ( rc == 0 )
-        {
-            KDirectoryResolvePath ( dir, true, buf, sizeof buf, "." );
-            KDirectoryRelease ( dir );
-        }
-        KDyldRelease ( dyld );
-    }
-    update_node ( self, "vdb/lib/paths/kfg", rc == 0 ? buf : "", true );
-
-    /* Architecture */ 
-#if ! WINDOWS
-    if (uname(&name) >= 0)
-        update_node(self, "kfg/arch/name", name.nodename, true);
-    else
-#endif
-        update_node ( self, "kfg/arch/name", "", true);
-
-    string_printf(buf, sizeof(buf), &bytes, "%u", _ARCH_BITS);
-    update_node ( self, "kfg/arch/bits", buf, true );
-
-    /* *OS */
-#if LINUX
-    #define OS "linux"
-#elif MAC 
-    #define OS "mac"
-#elif WINDOWS
-    #define OS "win"
-#elif SUN
-    #define OS "sun"
-#else
-    #error unrecognized OS
-#endif
-    update_node ( self, "OS", OS, true );
-#undef OS
-
-    /* BUILD_LINKAGE */
-#if _STATIC
-    #define BUILD_LINKAGE "STATIC"
-#else
-    #define BUILD_LINKAGE "DYNAMIC"
-#endif
-    update_node ( self, "BUILD_LINKAGE", BUILD_LINKAGE, true );
-#undef BUILD_LINKAGE
-
-    /* BUILD */
-#if _PROFILING
-    #define BUILD "PROFILE"
-#elif _DEBUGGING
-    #define BUILD "DEBUG"
-#else 
-    #define BUILD "RELEASE"
-#endif
-    update_node(self, "BUILD", BUILD, true );
-#undef BUILD
-
-    cwd = NULL;
-
-    /* PWD */
-    rc = KDirectoryNativeDir ( & cwd );
-    if ( rc == 0 )
-        rc = KDirectoryResolvePath ( cwd, true, buf, sizeof buf, "." );
-    update_node(self, "PWD", rc == 0 ? buf : "", true );
-
-    /* APPPATH */
-    if ( appname != NULL && rc == 0 )
-    {
-        bytes = string_size ( appname );
-        value = string_rchr ( appname, bytes, '/' );
-        if ( value == NULL )
-            value = string_rchr ( appname, bytes, '\\' );
-        if ( value != NULL )
-            bytes = appname + bytes - value;
-        rc = KDirectoryResolvePath ( cwd, true, buf, sizeof buf, "%s", appname);
-        if ( rc == 0 && bytes != 0 )
-            buf [ string_size(buf) - bytes ] = 0;    
-        update_node(self, "APPPATH", rc == 0 ? buf : "", true );
-    }
-
-    /* APPNAME */
-    rc = LogAppName(buf, sizeof(buf), &bytes);
-    if ( rc == 0 )
-        buf [ bytes ] = 0;
-    update_node(self, "APPNAME", rc == 0 ? buf : "", true );
-
-    /* Environment variables */
-    /* some of the variables may be undefined, create nodes with empty values for them */
-#define DEFINE_ENV(name)                                         \
-    value=getenv(name);                                          \
-    update_node(self, name, value == NULL ? "" : value, true )
-
-    DEFINE_ENV("HOST");
-    DEFINE_ENV("USER");
-    value = getenv("HOME");
-    if (value == NULL) 
-    {   /* apparently on Windows, use USERPROFILE */
-        value = getenv("USERPROFILE");
-    }
-    if (value == NULL)
-    {
-        update_node(self, "HOME", "", true );
-        update_node(self, "NCBI_HOME", "", false );
-        update_node(self, "NCBI_SETTINGS", "", false );
-    }
-    else
-    {
-        rc = KDirectoryResolvePath(cwd, true, buf, sizeof(buf), value);
-        if (rc == 0)
-        {
-            size_t bytes2;
-            char buf2 [ 4096 ];
-        
-            update_node(self, "HOME", buf, true );
-            
-            string_printf(buf2, sizeof(buf2), &bytes2, "%s/.ncbi", buf);
-            update_node(self, "NCBI_HOME", buf2, false );    /* can be overridden by the user */ 
-            
-            string_printf(buf2, sizeof(buf2), &bytes2, "%s/.ncbi/%s", buf, MAGIC_LEAF_NAME);
-            update_node(self, "NCBI_SETTINGS", buf2, false );    /* can be overridden by the user */ 
-        }
-        else
-            LOGERR (klogErr, rc, "Unable to create a config item for $HOME");
-    }
-
-    DEFINE_ENV("VDB_ROOT");
-    DEFINE_ENV("VDB_CONFIG");
-#undef DEFINE_ENV
-
-    KDirectoryRelease ( cwd );
-}
-
-static
-rc_t KConfigFill ( KConfig * self, const KDirectory * cfgdir, const char *appname, bool local)
-{
-    KConfigNode * root;
-    String empty;
-    rc_t rc;
-
-    CONST_STRING ( & empty, "" );
-
-    rc = KConfigNodeMake ( & root, & empty );
-    if (rc == 0)
-    {
-        KConfigInit ( self, root );
-        add_predefined_nodes ( self, appname );
-        load_config_files ( self, cfgdir );
-        KConfigCommit ( self ); /* commit changes made to magic file nodes duting parsing (e.g. fixed spelling of dbGaP names) */
-    }
-    return rc;
-}
-
-
-extern rc_t ReportKfg ( const ReportFuncs *f, uint32_t indent );
-
-/* "cfg" [ OUT ] - return parameter for mgr
-   if ("local" == true) do not initialize G_kfg */
-static
-rc_t KConfigMakeImpl ( KConfig **cfg, const KDirectory * cfgdir, bool local )
-{
-    rc_t rc;
-    const char *appname = NULL;
-
-    static bool latch;
-    if ( ! latch )
-    {
-        appname = ReportInitConfig ( ReportKfg );
-        latch = true;
-    }
-
-    if ( cfg == NULL )
-        rc = RC ( rcKFG, rcMgr, rcCreating, rcParam, rcNull );
-    else
-    {
-        KConfig *mgr = calloc ( 1, sizeof * mgr );
-        if ( mgr == NULL )
-            rc = RC ( rcKFG, rcMgr, rcCreating, rcMemory, rcExhausted );
-        else
-        {
-            rc = KConfigFill (mgr, cfgdir, appname, local);
-
-            mgr -> initialized = true;
-            if ( rc == 0 )
-            {
-                * cfg = mgr;
-                return 0;
-            }
-
-            KConfigWhack ( mgr );
-        }
-
-        * cfg = NULL;
-    }
-
-    return rc;
-}
-
-/* call KConfigMake; do not initialize G_kfg */
-LIB_EXPORT rc_t CC KConfigMakeLocal ( KConfig **cfg, const KDirectory * cfgdir )
-{   return KConfigMakeImpl(cfg, cfgdir, true); }
-
-/* Make
- *  create a process-global configuration manager
- *
- *  "cfg" [ OUT ] - return parameter for mgr
- */
-LIB_EXPORT rc_t CC KConfigMake ( KConfig **cfg, const KDirectory * cfgdir )
-{   return KConfigMakeImpl(cfg, cfgdir, false); }
-
-/*--------------------------------------------------------------------------
- * KNamelist
- */
-typedef struct KfgConfigNamelist KfgConfigNamelist;
-struct KfgConfigNamelist
-{
-    KNamelist dad;
-    size_t count;
-    const char *namelist [ 1 ];
-};
- 
-/* Whack
- */
-static
-rc_t CC KfgConfigNamelistWhack ( KfgConfigNamelist *self )
-{
-    free ( self );
-    return 0;
-}
- 
-/* Count
- */
-static
-rc_t CC KfgConfigNamelistCount ( const KfgConfigNamelist *self,
-uint32_t *count )
-{
-    * count = ( uint32_t ) self -> count;
-    return 0;
-}
- 
-/* Get
- */
-static
-rc_t CC KfgConfigNamelistGet ( const KfgConfigNamelist *self,
-    uint32_t idx, const char **name )
-{
-    if ( ( size_t ) idx >= self -> count )
-        return RC ( rcDB, rcNamelist, rcAccessing, rcParam, rcInvalid );
-    * name = self -> namelist [ idx ];
-    return 0;
-}
- 
-/* Make
- */
-static KNamelist_vt_v1 vtKfgConfigNamelist =
-{
-    /* version 1.0 */
-    1, 0,
-
-    /* start minor version 0 methods */
-    KfgConfigNamelistWhack,
-    KfgConfigNamelistCount,
-    KfgConfigNamelistGet
-    /* end minor version 0 methods */
-};
- 
- static
- rc_t KfgConfigNamelistMake ( KNamelist **names, uint32_t count )
- {
-     rc_t rc;
-     KfgConfigNamelist *self = malloc ( sizeof * self -
-         sizeof self -> namelist + count * sizeof self -> namelist [ 0 ] );
-     if ( self == NULL )
-         rc = RC ( rcKFG, rcMetadata, rcListing, rcMemory, rcExhausted );
-     else
-     {
-         self -> count = 0;
-         
-         rc = KNamelistInit ( & self -> dad,
-             ( const KNamelist_vt* ) & vtKfgConfigNamelist );
-         if ( rc == 0 )
-         {
-             * names = & self -> dad;
-             return 0;
-         }
-         
-         free ( self );
-     }
- 
-     return rc;
- }
- 
-/* List
- *  create metadata node listings
- */
-static
-void CC BSTNodeCount ( BSTNode *n, void *data )
-{
-    * ( uint32_t* ) data += 1;
-}
-
-static
-void CC KConfigNodeGrabName ( BSTNode *n, void *data )
-{
-    KfgConfigNamelist *list = data;
-    list -> namelist [ list -> count ++ ]
-        = ( ( const KConfigNode* ) n ) -> name . addr;
-}
-
-/* ListChildren
- *  list all named children
- */
-LIB_EXPORT rc_t CC KConfigNodeListChildren ( const KConfigNode *self,
-    KNamelist **names )
-{
-    if ( names == NULL )
-        return RC ( rcKFG, rcNode, rcListing, rcParam, rcNull );
-
-    * names = NULL;
-
-    if ( self != NULL )
-    {
-        rc_t rc;
-
-        uint32_t count = 0;
-        BSTreeForEach ( & self -> children, 0, BSTNodeCount, & count );
-
-        rc = KfgConfigNamelistMake ( names, count );
-        if ( rc == 0 )
-            BSTreeForEach
-                ( & self -> children, 0, KConfigNodeGrabName, * names );
-
-        return rc;
-    }
-
-    return RC ( rcKFG, rcNode, rcListing, rcSelf, rcNull );
-}
-
-static
-void CC KConfigGrabName ( BSTNode *n, void *data )
-{
-    KfgConfigNamelist *list = data;
-    list -> namelist [ list -> count ++ ]
-        = ( ( const KConfigIncluded* ) n ) -> path;
-}
-
-/* ListIncluded
- *  list all included files
- */
-LIB_EXPORT rc_t CC KConfigListIncluded ( const KConfig *self,
-    KNamelist **names )
-{
-    if ( names == NULL )
-        return RC ( rcKFG, rcMgr, rcListing, rcParam, rcNull );
-
-    * names = NULL;
-
-    if ( self != NULL )
-    {
-        rc_t rc;
-
-        uint32_t count = 0;
-        BSTreeForEach ( & self -> included, 0, BSTNodeCount, & count );
-
-        rc = KfgConfigNamelistMake ( names, count );
-        if ( rc == 0 )
-            BSTreeForEach
-                ( & self -> included, 0, KConfigGrabName, * names );
-
-        return rc;
-    }
-
-    return RC ( rcKFG, rcMgr, rcListing, rcSelf, rcNull );
-}
-
-/************** Internal node-reading helpers *************/
-
-/* ReadNodeValueFixed
- * copy the node's value into the caller's fixed size buffer and 0-terminate
- */
-static rc_t ReadNodeValueFixed ( const KConfigNode* self, char *buf, size_t bsize )
-{
-    size_t num_read, remaining;
-    rc_t rc = KConfigNodeRead ( self, 0, buf, bsize - 1, &num_read, &remaining);
-    if (rc == 0)
-    {
-        if (remaining != 0)
-            rc = RC ( rcKFG, rcNode, rcReading, rcBuffer, rcInsufficient );
-        else
-            buf[num_read] = '\0';
-    }        
-    return rc;
-}
-
-/**********************************************************/
- 
-/* ReadBool
- *  read a boolean node value
- *
- * self [ IN ] - KConfigNode object
- * result [ OUT ] - return value (true if "TRUE", false if "FALSE"; rc != 0 if neither)
- *
- */
-LIB_EXPORT rc_t CC KConfigNodeReadBool ( const KConfigNode *self, bool *result )
-{
-    rc_t rc;
-
-    if ( result == NULL )
-        rc = RC ( rcKFG, rcNode, rcReading, rcParam, rcNull );
-    else
-    {
-        * result = false;
-
-        if ( self == NULL )
-            rc = RC ( rcKFG, rcNode, rcReading, rcSelf, rcNull );
-        else
-        {
-            char buf [ 6 ];
-            rc = ReadNodeValueFixed ( self, buf, sizeof buf );
-            if ( rc == 0 )
-            {
-                switch ( tolower ( buf [ 0 ] ) )
-                {
-                case 'f':
-                    if ( buf [ 1 ] == 0 )
-                        return 0;
-                    if ( strncasecmp ( buf, "false", sizeof buf ) == 0 )
-                        return 0;
-                    break;
-
-                case 'n':
-                    if ( buf [ 1 ] == 0 )
-                        return 0;
-                    if ( strncasecmp ( buf, "no", sizeof buf ) == 0 )
-                        return 0;
-                    break;
-
-                case 't':
-                    * result = true;
-                    if ( buf [ 1 ] == 0 )
-                        return 0;
-                    if ( strncasecmp ( buf, "true", sizeof buf ) == 0 )
-                        return 0;
-                    break;
-
-                case 'y':
-                    * result = true;
-                    if ( buf [ 1 ] == 0 )
-                        return 0;
-                    if ( strncasecmp ( buf, "yes", sizeof buf ) == 0 )
-                        return 0;
-                    break;
-                }
-
-                * result = false;
-                rc = RC ( rcKFG, rcNode, rcReading, rcFormat, rcIncorrect );
-            }
-        }
-    }
-
-    return rc;
-}
-
-/* ReadI64
- *  read an integer node value
- *
- * self [ IN ] - KConfigNode object
- * result [ OUT ] - return value (rc != 0 if cannot be converted)
- *
- */
-LIB_EXPORT rc_t CC KConfigNodeReadI64 ( const KConfigNode *self, int64_t *result )
-{
-    rc_t rc;
-
-    if ( result == NULL )
-        rc = RC ( rcKFG, rcNode, rcReading, rcParam, rcNull );
-    else
-    {
-        * result = 0;
-
-        if ( self == NULL )
-            rc = RC ( rcKFG, rcNode, rcReading, rcSelf, rcNull );
-        else
-        {
-            /* allow for leading zeros */
-            char buf [ 256 ];
-    
-            rc = ReadNodeValueFixed(self, buf, sizeof(buf));
-            if (rc == 0)
-            {
-                char* endptr;
-                int64_t res = strtoi64(buf, &endptr, 0);
-                if ( *endptr == '\0' )
-                    *result = res;
-                else
-                    rc = RC(rcKFG, rcNode, rcReading, rcFormat, rcIncorrect);
-            }
-        }
-    }
-    return rc;
-}
-
-/* ReadU64
- *  read an unsiged node value
- *
- * self [ IN ] - KConfigNode object
- * result [ OUT ] - return value (rc != 0 if cannot be converted)
- *
- */
-LIB_EXPORT rc_t CC KConfigNodeReadU64 ( const KConfigNode *self, uint64_t* result )
-{
-    rc_t rc;
-
-    if ( result == NULL )
-        rc = RC ( rcKFG, rcNode, rcReading, rcParam, rcNull );
-    else
-    {
-        * result = 0;
-
-        if ( self == NULL )
-            rc = RC ( rcKFG, rcNode, rcReading, rcSelf, rcNull );
-        else
-        {
-            /* allow for leading zeros */
-            char buf [ 256 ];
-    
-            rc = ReadNodeValueFixed(self, buf, sizeof(buf));
-            if (rc == 0)
-            {
-                char* endptr;
-                int64_t res = strtou64(buf, &endptr, 0);
-                if ( *endptr == '\0' )
-                    *result = res;
-                else
-                    rc = RC(rcKFG, rcNode, rcReading, rcFormat, rcIncorrect);
-            }
-        }
-    }
-    return rc;
-}
-
-/* ReadF64
- *  read a floating point node value
- *
- * self [ IN ] - KConfigNode object
- * result [ OUT ] - return value (rc != 0 if cannot be converted)
- *
- */
-LIB_EXPORT rc_t CC KConfigNodeReadF64( const KConfigNode *self, double* result )
-{
-    rc_t rc;
-
-    if ( result == NULL )
-        rc = RC ( rcKFG, rcNode, rcReading, rcParam, rcNull );
-    else
-    {
-        * result = 0.0;
-
-        if ( self == NULL )
-            rc = RC ( rcKFG, rcNode, rcReading, rcSelf, rcNull );
-        else
-        {
-            /* allow for leading zeros, trailing digits */
-            char buf [ 256 ];
-
-            rc = ReadNodeValueFixed(self, buf, sizeof(buf));
-            if (rc == 0)
-            {
-                char* endptr;
-                double res = strtod(buf, &endptr);
-                if ( *endptr == '\0' )
-                    *result = res;
-                else
-                    rc = RC(rcKFG, rcNode, rcReading, rcFormat, rcIncorrect);
-            }
-        }
-    }
-    return rc;
-}
-
-#if 0
-/*** NB - code needs to be located in VFS ***/
-/* ReadNodeValueFixed
- * Allocate a character buffer of sufficient size, copy the node's value into it, 0-terminate. Caller deallocates.
- */
-static rc_t ReadNodeValueVariable( const KConfigNode* self, char** buf )
-{
-    size_t num_read, to_read;
-    /* first we ask about the size to be read */
-    rc_t rc = KConfigNodeRead ( self, 0, NULL, 0, &num_read, &to_read );
-    if ( rc == 0 )
-    {
-        char* value = malloc( to_read + 1 );
-        if ( value )
-        {
-            rc = ReadNodeValueFixed( self, value, to_read + 1 );
-            if ( rc == 0 )
-                *buf = value;
-            else
-                free (value);
-        }
-        else
-            rc = RC( rcKFG, rcNode, rcReading, rcMemory, rcExhausted );
-    }   
-    return rc;
-}
-
-/* ReadFloat
- *  read a VPath node value
- *
- * self [ IN ] - KConfigNode object
- * result [ OUT ] - return value (rc != 0 if cannot be converted)
- *
- */
-LIB_EXPORT rc_t CC KConfigNodeReadVPath ( const KConfigNode *self, struct VPath** result )
-{
-    rc_t rc;
-
-    if ( result == NULL )
-        rc = RC ( rcKFG, rcNode, rcReading, rcParam, rcNull );
-    else
-    {
-        * result = NULL;
-
-        if ( self == NULL )
-            rc = RC ( rcKFG, rcNode, rcReading, rcSelf, rcNull );
-        else
-        {
-            char* buf;
-            rc = ReadNodeValueVariable ( self, &buf );
-            if ( rc == 0)
-            {
-                rc = VPathMake(result, buf);
-                free(buf);
-            }
-        }
-    }
-    return rc;
-}
-#endif
-
-/* ReadString
- *  read a String node value
- *
- * self [ IN ] - KConfigNode object
- * result [ OUT ] - return value (rc != 0 if cannot be converted)
- *
- */
-LIB_EXPORT rc_t CC KConfigNodeReadString ( const KConfigNode *self, String** result )
-{
-    rc_t rc;
-
-    if ( result == NULL )
-        rc = RC ( rcKFG, rcNode, rcReading, rcParam, rcNull );
-    else
-    {
-        * result = NULL;
-
-        if ( self == NULL )
-            rc = RC ( rcKFG, rcNode, rcReading, rcSelf, rcNull );
-        else
-        {
-            size_t num_read, to_read;
-
-            /* first we ask about the size to be read */
-            rc = KConfigNodeRead ( self, 0, NULL, 0, &num_read, &to_read );
-            if ( rc == 0 )
-            {
-                String *value = malloc ( sizeof * value + to_read + 1 );
-                if ( value == NULL )
-                    rc = RC( rcKFG, rcNode, rcReading, rcMemory, rcExhausted );
-                else
-                {
-                    /* TBD - this is broken for non-ascii strings
-                       much better to be WITHIN the config.c implementation
-                       and reach into the node value directly! */
-                    StringInit ( value, (char*)( value + 1 ), to_read, (uint32_t)to_read + 1 );
-                    rc = ReadNodeValueFixed(self, (char*)value->addr, to_read + 1);
-                    if ( rc == 0 )
-                        *result = value;
-                    else
-                    {
-                        rc = RC(rcKFG, rcNode, rcReading, rcFormat, rcIncorrect);
-                        free ( value );
-                    }
-                }
-            }
-        }
-    }    
-    return rc;
-}
-
-/* this macro wraps a call to KConfigNodeGetXXX in a node-accessing
-   code to implement the corresponding KConfigGetXXX function */
-#define NODE_TO_CONFIG_ACCESSOR(fn) \
-    const KConfigNode* node;                                \
-    rc_t rc = KConfigOpenNodeRead ( self, &node, path );    \
-    if ( rc == 0)                                           \
-    {                                                       \
-        rc_t rc2;                                           \
-        rc = fn(node, result);                              \
-        rc2 = KConfigNodeRelease(node);                     \
-        if (rc == 0)                                        \
-            rc = rc2;                                       \
-    }                                                       \
-    return rc;                                              
-    
-/* THESE FUNCTIONS ARE PROTECTED AGAINST BAD "self" AND "path"
-   BY KConfigOpenNodeRead, BUT THE CONVERSION FUNCTIONS ARE NOT */
-LIB_EXPORT rc_t CC KConfigReadBool ( const KConfig* self, const char* path, bool* result )
-{
-    NODE_TO_CONFIG_ACCESSOR(KConfigNodeReadBool);
-}    
-LIB_EXPORT rc_t CC KConfigReadI64 ( const KConfig* self, const char* path, int64_t* result )
-{
-    NODE_TO_CONFIG_ACCESSOR(KConfigNodeReadI64);
-}
-LIB_EXPORT rc_t CC KConfigReadU64 ( const KConfig* self, const char* path, uint64_t* result )
-{
-    NODE_TO_CONFIG_ACCESSOR(KConfigNodeReadU64);
-}
-LIB_EXPORT rc_t CC KConfigReadF64 ( const KConfig* self, const char* path, double* result )
-{
-    NODE_TO_CONFIG_ACCESSOR(KConfigNodeReadF64);
-}
-#if 0
-LIB_EXPORT rc_t CC KConfigReadVPath ( const KConfig* self, const char* path, struct VPath** result )
-{
-    NODE_TO_CONFIG_ACCESSOR(KConfigNodeReadVPath);
-}
-#endif
-LIB_EXPORT rc_t CC KConfigReadString ( const KConfig* self, const char* path, struct String** result )
-{
-    NODE_TO_CONFIG_ACCESSOR(KConfigNodeReadString);
-}
-
-#define DISP_RC(rc, msg) (void)((rc == 0) ? 0 : LOGERR(klogInt, rc, msg))
-
-LIB_EXPORT rc_t CC KConfigPrint(const KConfig* self, int indent) {
-    return KConfigPrintImpl(self, indent, NULL, false);
-}
-
-LIB_EXPORT void CC KConfigDisableUserSettings ( void )
-{
-    s_disable_user_settings = true;
-}
-
-static
-rc_t open_file ( const KFile **f, const char *path )
-{
-    /* get current directory */
-    KDirectory *wd;
-    rc_t rc = KDirectoryNativeDir ( & wd );
-    if ( rc == 0 )
-    {
-        rc = KDirectoryOpenFileRead ( wd, f, path );
-        KDirectoryRelease ( wd );
-    }
-
-    return rc;
-}
-
-/* KFS_EXTERN rc_t CC KFileMakeGzip2ForRead ( struct KFile const **gz, struct KFile const *src );
-#include <stdio.h> aprintf */
-static void aprintf(const char *a, int b) {}
-static
-rc_t decode_ncbi_gap ( KDataBuffer *mem, const KFile *orig )
-{
-    char hdr [ 8 ];
-    size_t num_read;
-    rc_t rc = KFileReadAll ( orig, 0, hdr, sizeof hdr, & num_read );
-aprintf("decode_ncbi_gap %d\n", __LINE__);
-    if ( rc == 0 && num_read == sizeof hdr )
-    {
-        if (memcmp(hdr, "ncbi_gap", sizeof hdr) != 0) {
-            rc = RC(rcKFG, rcFile, rcReading, rcFile, rcWrongType);
-        }
-        else {
-            uint64_t eof;
-aprintf("decode_ncbi_gap %d\n", __LINE__);
-            rc = KFileSize ( orig, & eof );
-aprintf("decode_ncbi_gap %d\n", __LINE__);
-            if ( rc == 0 )
-            {
-                const KFile *sub;
-aprintf("decode_ncbi_gap %d\n", __LINE__);
-                rc = KFileMakeSubRead ( & sub, orig, sizeof hdr,
-                    eof - sizeof hdr );
-aprintf("decode_ncbi_gap %d\n", __LINE__);
-                if ( rc == 0 )
-                {
-                    const KFile *gzip;
-aprintf("decode_ncbi_gap %d\n", __LINE__);
-
-/* aprintf          rc = KFileMakeGzip2ForRead ( & gzip, sub ); */
-                    rc = KFileMakeGzipForRead ( & gzip, sub );
-aprintf("decode_ncbi_gap %d\n", __LINE__);
-                    if ( rc == 0 )
-                    {
-aprintf("decode_ncbi_gap %d\n", __LINE__);
-                        rc = KDataBufferMakeBytes ( mem, 0 );
-aprintf("decode_ncbi_gap %d\n", __LINE__);
-                        if ( rc == 0 )
-                        {
-                            size_t total, to_read;
-
-                            /* after all of that, we're ready to decompress */
-                            for ( total = 0; ; )
-                            {
-                                char *buff;
-
-aprintf("decode_ncbi_gap %d\n", __LINE__);
-                                rc = KDataBufferResize ( mem,
-                                    total + 32 * 1024 );
-aprintf("decode_ncbi_gap %d\n", __LINE__);
-                                if ( rc != 0 )
-                                    break;
-
-                                buff = mem -> base;
-aprintf("decode_ncbi_gap %d\n", __LINE__);
-                                to_read = ( size_t ) mem -> elem_count - total;
-aprintf("decode_ncbi_gap %d\n", __LINE__);
-
-                                rc = KFileReadAll ( gzip, total,
-                                    & buff [ total ], to_read, & num_read );
-aprintf("decode_ncbi_gap %d\n", __LINE__);
-                                if ( rc != 0 )
-                                    break;
-
-                                total += num_read;
-                                
-                                if ( num_read < to_read )
-                                {
-aprintf("decode_ncbi_gap %d\n", __LINE__);
-                                    buff [ total ] = 0;
-aprintf("decode_ncbi_gap %d\n", __LINE__);
-                                    mem -> elem_count = total;
-                                    break;
-                                }
-                            }
-                        }
-
-aprintf("decode_ncbi_gap %d\n", __LINE__);
-                        KFileRelease ( gzip );
-aprintf("decode_ncbi_gap %d\n", __LINE__);
-                    }
-
-aprintf("decode_ncbi_gap %d\n", __LINE__);
-                    KFileRelease ( sub );
-aprintf("decode_ncbi_gap %d\n", __LINE__);
-                }
-            }
-        }
-    }
-
-aprintf("decode_ncbi_gap %d\n", __LINE__);
-    return rc;
-}
-
-typedef struct {
-    const char *projectId;
-    const char *encryptionKey;
-    const char *downloadTicket;
-    const char *description;
-} KGapConfig;
-
-static
-rc_t _KConfigNncToKGapConfig(const KConfig *self, char *text, KGapConfig *kgc)
-{
-    size_t len = 0;
-    int i = 0;
-
-    assert(self && text && kgc);
-
-    memset(kgc, 0, sizeof *kgc);
-    len = string_size(text);
-
-    {
-        const char version[] = "version ";
-        size_t l = sizeof version - 1;
-        if (string_cmp(version, l, text, len, (uint32_t)l) != 0) {
-            return RC(rcKFG, rcMgr, rcUpdating, rcFormat, rcUnrecognized);
-        }
-        text += l;
-        len -= l;
-    }
-
-    {
-        const char version[] = "1.0";
-        size_t l = sizeof version - 1;
-        if (string_cmp(version, l, text, l, (uint32_t)l) != 0) {
-            return RC(rcKFG, rcMgr, rcUpdating, rcFormat, rcUnsupported);
-        }
-        text += l;
-        len -= l;
-    }
-
-    while (len > 0 && (text[0] == '\r' || text[0] == '\n')) {
-        ++text;
-        --len;
-    }
-
-    for (i = 0; ; ++i) {
-        const char *p = NULL;
-        if (i == 0) {
-            p = strtok(text, "|");
-        }
-        else {
-            p = strtok (NULL, "|");
-        }
-        if (p == NULL) {
-            break;
-        }
-        switch (i) {
-            case 0:
-                kgc->projectId = p;
-                break;
-            case 1:
-                kgc->encryptionKey = p;
-                break;
-            case 2:
-                kgc->downloadTicket = p;
-                break;
-            case 3:
-                kgc->description = p;
-                break;
-        }
-    }
-
-    if (!kgc->projectId || !kgc->encryptionKey || !kgc->downloadTicket ||
-        !kgc->description)
-    {
-        return RC(rcKFG, rcMgr, rcUpdating, rcFile, rcInvalid);
-    }
-
-    return 0;
-}
-
-static rc_t _KConfigFixResolverCgiNode(KConfig *self) {
-    rc_t rc = 0;
-
-    KConfigNode *node = NULL;
-    struct String *result = NULL;
-
-    assert(self);
-
-    if (rc == 0) {
-        rc = KConfigOpenNodeUpdate(self, &node,
-            "/repository/remote/protected/CGI/resolver-cgi");
-    }
-
-    if (rc == 0) {
-        rc = KConfigNodeReadString(node, &result);
-    }
-
-    if (rc == 0) {
-        assert(result);
-        if (result->size == 0) {
-            const char buffer[]
-                = "http://www.ncbi.nlm.nih.gov/Traces/names/names.cgi";
-            rc = KConfigNodeWrite(node, buffer, sizeof buffer);
-        }
-    }
-
-    free(result);
-
-    KConfigNodeRelease(node);
-
-    return rc;
-}
-
-static rc_t _KConfigNodeUpdateChild(KConfigNode *self,
-    const char *name, const char *val)
-{
-    rc_t rc = 0;
-
-    KConfigNode *node = NULL;
-
-    assert(self && name && val);
-
-    if (rc == 0) {
-        rc = KConfigNodeOpenNodeUpdate(self, &node, name);
-    }
-
-    if (rc == 0) {
-        rc = KConfigNodeWrite(node, val, string_size(val));
-    }
-
-    {
-        rc_t rc2 = KConfigNodeRelease(node);
-        if (rc2 != 0 && rc == 0) {
-            rc = rc2;
-        }
-    }
-
-    return rc;
-}
-
-static rc_t _KConfigMkPwdFileAndNode(KConfig *self,
-    KConfigNode *rep, const KGapConfig *kgc)
-{
-    rc_t rc = 0;
-    const KConfigNode *ncbiHome = NULL;
-    KConfigNode *node = NULL;
-    struct String *result = NULL;
-    char encryptionKeyPath[PATH_MAX];
-    KDirectory *dir = NULL;
-    KFile *encryptionKeyFile = NULL;
-    size_t num_writ = 0;
-
-    assert(self && kgc && rep);
-
-    if (rc == 0) {
-        rc = KConfigOpenNodeRead(self, &ncbiHome, "NCBI_HOME");
-    }
-    if (rc == 0) {
-        rc = KConfigNodeReadString(ncbiHome, &result);
-    }
-    KConfigNodeRelease(ncbiHome);
-    ncbiHome = NULL;
-
-    if (rc == 0) {
-        size_t num_writ = 0;
-        assert(result && result->addr);
-        rc = string_printf(encryptionKeyPath, sizeof encryptionKeyPath,
-            &num_writ, "%s/dbGaP-%s.enc_key", result->addr, kgc->projectId);
-        if (rc == 0) {
-            assert(num_writ < sizeof encryptionKeyPath);
-        }
-    }
-    free(result);
-    result = NULL;
-
-    if (rc == 0) {
-        rc = KDirectoryNativeDir(&dir);
-    }
-
-    if (rc == 0) {
-        rc = KDirectoryCreateFile(dir, &encryptionKeyFile,
-            false, 0600, kcmInit | kcmParents, encryptionKeyPath);
-    }
-
-    KDirectoryRelease(dir);
-
-    if (rc == 0) {
-        assert(kgc->encryptionKey);
-        rc = KFileWrite(encryptionKeyFile, 0,
-            kgc->encryptionKey, string_size(kgc->encryptionKey), &num_writ);
-        if (rc == 0) {
-            assert(num_writ == string_size(kgc->encryptionKey));
-        }
-    }
-
-    if (rc == 0) {
-        rc = KFileWrite(encryptionKeyFile, string_size(kgc->encryptionKey),
-            "\n", 1, &num_writ);
-        if (rc == 0) {
-            assert(num_writ == 1);
-        }
-    }
-
-    {
-        rc_t rc2 = KFileRelease(encryptionKeyFile);
-        if (rc2 != 0 && rc == 0) {
-            rc = rc2;
-        }
-    }
-
-    if (rc == 0) {
-        rc = _KConfigNodeUpdateChild(rep,
-            "encryption-key-path", encryptionKeyPath);
-    }
-
-    KConfigNodeRelease(node);
-
-    return rc;
-}
-
-static rc_t _mkNotFoundDir(const char *repoParentPath) {
-    rc_t rc = 0;
-
-    KPathType type = kptNotFound;
-
-    KDirectory *wd = NULL;
-    rc = KDirectoryNativeDir(&wd);
-
-    if (rc == 0) {
-        type = KDirectoryPathType(wd, repoParentPath);
-        if (type == kptNotFound) {
-            rc = KDirectoryCreateDir(wd,
-                0777, kcmCreate|kcmParents, repoParentPath);
-        }
-    }
-
-    KDirectoryRelease(wd);
-
-    return rc;
-}
-
-static rc_t _KConfigDBGapRepositoryNodes(KConfig *self,
-    KConfigNode *rep, const KGapConfig *kgc, const char *repoParentPath,
-    const char **newRepoParentPath)
-{
-    rc_t rc = 0;
-
-    assert(self && rep && kgc);
-
-    if (rc == 0) {
-        rc = _KConfigMkPwdFileAndNode(self, rep, kgc);
-    }
-
-    if (rc == 0) {
-        assert(kgc->downloadTicket);
-        rc = _KConfigNodeUpdateChild(rep,
-            "download-ticket", kgc->downloadTicket);
-    }
-
-    if (rc == 0) {
-        rc = _KConfigNodeUpdateChild(rep, "description", kgc->description);
-    }
-
-    if (rc == 0) {
-        rc = _KConfigNodeUpdateChild(rep, "apps/file/volumes/flat", "files");
-    }
-    if (rc == 0) {
-        rc = _KConfigNodeUpdateChild(rep, "apps/sra/volumes/sraFlat", "sra");
-    }
-
-    if (rc == 0) {
-        rc = _KConfigNodeUpdateChild(rep, "cache-enabled", "true");
-    }
-
-    if (rc == 0) {
-        static char rootPath[PATH_MAX] = "";
-        if (repoParentPath == NULL) {
-            size_t num_writ = 0;
-            const KConfigNode *home = NULL;
-            String *result = NULL;
-
-            if (rc == 0) {
-                rc = KConfigOpenNodeRead(self, &home, "HOME");
-            }
-
-            if (rc == 0) {
-                rc = KConfigNodeReadString(home, &result);
-            }
-
-            if (rc == 0) {
-                assert(result && result->addr);
-                rc = string_printf(rootPath, sizeof rootPath, &num_writ,
-                    "%s/ncbi/dbGaP-%s", result->addr, kgc->projectId);
-            }
-
-            if (rc == 0) {
-                repoParentPath = rootPath;
-            }
-
-            free(result);
-            KConfigNodeRelease(home);
-        }
-
-        if (rc == 0) {
-            rc = _KConfigNodeUpdateChild(rep, "root", repoParentPath);
-        }
-        if (rc == 0) {
-            rc = _mkNotFoundDir(repoParentPath);
-        }
-        if (rc == 0 && newRepoParentPath != NULL) {
-            *newRepoParentPath = repoParentPath;
-        }
-    }
-
-    return rc;
-}
-
-static rc_t _KConfigAddDBGapRepository(KConfig *self,
-    const KGapConfig *kgc, const char *repoParentPath,
-    const char **newRepoParentPath)
-{
-    rc_t rc = 0;
-
-    KConfigNode *rep = NULL;
-
-    char repNodeName[512] = "";
-
-    assert(self && kgc);
-
-    if (rc == 0) {
-        size_t num_writ = 0;
-        rc = string_printf(repNodeName, sizeof repNodeName, &num_writ,
-            "/repository/user/protected/dbGaP-%s", kgc->projectId);
-        if (rc == 0) {
-            assert(num_writ < sizeof repNodeName);
-        }
-    }
-
-    if (rc == 0) {
-        rc = KConfigOpenNodeUpdate(self, &rep, repNodeName);
-    }
-
-    if (rc == 0) {
-        rc = _KConfigDBGapRepositoryNodes(self, rep, kgc, repoParentPath,
-            newRepoParentPath);
-    }
-
-    KConfigNodeRelease(rep);
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KConfigImportNgc(KConfig *self,
-    const char *ngcPath, const char *repoParentPath,
-    const char **newRepoParentPath)
-{
-    if (self == NULL) {
-        return RC(rcKFG, rcMgr, rcUpdating, rcSelf, rcNull);
-    }
-
-    if (ngcPath == NULL) {
-        return RC(rcKFG, rcMgr, rcUpdating, rcParam, rcNull);
-    }
-    else {
-        const KFile *orig = NULL;
-        rc_t rc = open_file ( & orig, ngcPath );
-/*    DBGMSG(DBG_KFG, DBG_FLAG(DBG_KFG), ("KConfigImportNgc %d\n", __LINE__));*/
-        if (rc != 0) {
-            return rc;
-        }
-        else {
-            KGapConfig kgc;
-
-            KDataBuffer mem;
-            memset ( & mem, 0, sizeof mem );
-
-/*DBGMSG(DBG_KFG, DBG_FLAG(DBG_KFG), ("KConfigImportNgc %d\n", __LINE__));
-aprintf("KConfigImportNgc %d\n", __LINE__); */
-            rc = decode_ncbi_gap ( & mem, orig );
-/*DBGMSG(DBG_KFG, DBG_FLAG(DBG_KFG), ("KConfigImportNgc %d\n", __LINE__));
-aprintf("KConfigImportNgc %d\n", __LINE__);*/
-            KFileRelease ( orig );
-            orig = NULL;
-
-            if (rc == 0) {
-/*DBGMSG(DBG_KFG, DBG_FLAG(DBG_KFG), ("KConfigImportNgc %d\n", __LINE__));
-aprintf("KConfigImportNgc %d\n", __LINE__);*/
-                rc = _KConfigNncToKGapConfig(self, mem.base, &kgc);
-/*DBGMSG(DBG_KFG, DBG_FLAG(DBG_KFG), ("KConfigImportNgc %d\n", __LINE__));
-aprintf("KConfigImportNgc %d\n", __LINE__);*/
-            }
-
-            if (rc == 0) {
-/*DBGMSG(DBG_KFG, DBG_FLAG(DBG_KFG), ("KConfigImportNgc %d\n", __LINE__));
-aprintf("KConfigImportNgc %d\n", __LINE__);*/
-                rc = _KConfigFixResolverCgiNode(self);
-/*DBGMSG(DBG_KFG, DBG_FLAG(DBG_KFG), ("KConfigImportNgc %d\n", __LINE__));
-aprintf("KConfigImportNgc %d\n", __LINE__);*/
-            }
-
-            if (rc == 0) {
-/*DBGMSG(DBG_KFG, DBG_FLAG(DBG_KFG), ("KConfigImportNgc %d\n", __LINE__));
-aprintf("KConfigImportNgc %d\n", __LINE__);*/
-                rc = _KConfigAddDBGapRepository(self, &kgc, repoParentPath,
-                    newRepoParentPath);
-/*DBGMSG(DBG_KFG, DBG_FLAG(DBG_KFG), ("KConfigImportNgc %d\n", __LINE__));
-aprintf("KConfigImportNgc %d\n", __LINE__);*/
-            }
-
-/*DBGMSG(DBG_KFG, DBG_FLAG(DBG_KFG), ("KConfigImportNgc %d\n", __LINE__));
-aprintf("KConfigImportNgc %d\n", __LINE__);*/
-            KDataBufferWhack ( & mem );
-        }
-
-        return rc;
-    }
-}
diff --git a/libs/kfg/default.kfg b/libs/kfg/default.kfg
deleted file mode 100644
index aa5a7a7..0000000
--- a/libs/kfg/default.kfg
+++ /dev/null
@@ -1,56 +0,0 @@
-# ===========================================================================
-#
-#                            PUBLIC DOMAIN NOTICE
-#               National Center for Biotechnology Information
-#
-#  This software/database is a "United States Government Work" under the
-#  terms of the United States Copyright Act.  It was written as part of
-#  the author's official duties as a United States Government employee and
-#  thus cannot be copyrighted.  This software/database is freely available
-#  to the public for use. The National Library of Medicine and the U.S.
-#  Government have not placed any restriction on its use or reproduction.
-#
-#  Although all reasonable efforts have been taken to ensure the accuracy
-#  and reliability of the software and data, the NLM and the U.S.
-#  Government do not and cannot warrant the performance or results that
-#  may be obtained by using this software or data. The NLM and the U.S.
-#  Government disclaim all warranties, express or implied, including
-#  warranties of performance, merchantability or fitness for any particular
-#  purpose.
-#
-#  Please cite the author in any work or product based on this material.
-#
-# ===========================================================================
-
-## DEFAULT CONFIGURATION FOR SRA-TOOLKIT
-# 
-#  These settings are intended to allow the tools to work under conditions
-#  when the user has not yet performed any configuration.
-/config/default = "true"
-
-# The user's default public repository
-/repository/user/main/public/apps/file/volumes/flat = "files"
-/repository/user/main/public/apps/nakmer/volumes/nakmerFlat = "nannot"
-/repository/user/main/public/apps/nannot/volumes/nannotFlat = "nannot"
-/repository/user/main/public/apps/refseq/volumes/refseq = "refseq"
-/repository/user/main/public/apps/sra/volumes/sraFlat = "sra"
-/repository/user/main/public/apps/wgs/volumes/wgsFlat = "wgs"
-/repository/user/main/public/cache-enabled = "true"
-/repository/user/main/public/root = "$(HOME)/ncbi/public"
-
-# Remote access to NCBI's public repository
-/repository/remote/main/CGI/resolver-cgi = "http://www.ncbi.nlm.nih.gov/Traces/names/names.cgi"
-/repository/remote/aux/NCBI/apps/nakmer/volumes/fuseNAKMER = "sadb"
-/repository/remote/aux/NCBI/apps/nannot/volumes/fuseNANNOT = "sadb"
-/repository/remote/aux/NCBI/apps/refseq/volumes/refseq = "refseq"
-/repository/remote/aux/NCBI/apps/sra/volumes/fuse1000 = "sra-instant/reads/ByRun/sra"
-/repository/remote/aux/NCBI/apps/wgs/volumes/fuseWGS = "wgs"
-/repository/remote/aux/NCBI/root = "http://ftp-trace.ncbi.nlm.nih.gov/sra"
-
-# Remote access to NCBI's protected repository
-/repository/remote/protected/CGI/resolver-cgi = "http://www.ncbi.nlm.nih.gov/Traces/names/names.cgi"
-
-/krypto/pwfile = "$(NCBI_HOME)/vdb-passwd"
-
-# Aspera configuration
-/tools/ascp/max_rate = "300m"
diff --git a/libs/kfg/kart.c b/libs/kfg/kart.c
deleted file mode 100644
index 4bffe17..0000000
--- a/libs/kfg/kart.c
+++ /dev/null
@@ -1,715 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <kfg/kart.h>
-
-#include <kfs/directory.h> /* KDirectoryOpenFileRead */
-#include <kfs/file.h> /* KFile */
-#include <kfs/gzip.h> /* KFileMakeGzipForRead */
-#include <kfs/subfile.h> /* KFileMakeSubRead */
-
-#include <klib/data-buffer.h> /* KDataBuffer */
-#include <klib/rc.h>
-#include <klib/refcount.h> /* KRefcount */
-#include <klib/out.h> /* OUTMSG */
-
-#include <strtol.h> /* strtou64 */
-#include <sysalloc.h>
-
-#include <assert.h>
-#include <stdlib.h> /* free */
-#include <string.h> /* memcmp */
-
-#define RELEASE(type, obj) do { rc_t rc2 = type##Release(obj); \
-    if (rc2 != 0 && rc == 0) { rc = rc2; } obj = NULL; } while (false)
-
-struct KartItem {
-    KRefcount refcount;
-
-    const Kart *dad;
-
-/*  String typeId; */
-    String projId;
-    String itemId;
-    String accession;
-    String name;
-    String itemDesc;
-};
-
-static void KartItemWhack(KartItem *self) {
-    assert(self);
-
-    KartRelease(self->dad);
-
-    memset(self, 0, sizeof *self);
-
-    free(self);
-}
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-LIB_EXPORT rc_t CC KartItemAddRef(const KartItem *self) {
-    if (self != NULL) {
-        switch (KRefcountAdd(&self->refcount, "KartItem")) {
-            case krefLimit:
-                return RC(rcKFG, rcFile, rcAttaching, rcRange, rcExcessive);
-        }
-    }
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KartItemRelease(const KartItem *self) {
-    if (self != NULL) {
-        switch (KRefcountDrop(&self -> refcount, "KartItem")) {
-            case krefWhack:
-                KartItemWhack((KartItem*)self);
-                break;
-            case krefLimit:
-                return RC(rcKFG, rcFile, rcReleasing, rcRange, rcExcessive);
-        }
-    }
-
-    return 0;
-}
-
-static rc_t StringAsUint64(const String *self, uint64_t *pid) {
-    uint64_t id = 0;
-
-    char buffer[21] = "";
-    size_t bytes = 0;
-    char *end = NULL;
-
-    assert(self);
-
-    if (pid == NULL) {
-        return RC(rcKFG, rcFile, rcAccessing, rcParam, rcNull);
-    }
-
-    *pid = 0;
-
-    if (sizeof buffer - 1 < self->len) {
-        return RC(rcKFG, rcFile, rcAccessing, rcBuffer, rcInsufficient);
-    }
-
-    bytes = string_copy(buffer, sizeof buffer, self->addr, self->len);
-    if (bytes != self->len) {
-        return RC(rcKFG, rcFile, rcAccessing, rcBuffer, rcInsufficient);
-    }
-
-    id = strtou64(buffer, &end, 0);
-    if (end[0] != 0) {
-        return RC(rcKFG, rcFile, rcAccessing, rcParam, rcInvalid);
-    }
-
-    *pid = id;
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KartItemProjIdNumber(const KartItem *self, uint64_t *pid) {
-    if (self == NULL) {
-        return RC(rcKFG, rcFile, rcAccessing, rcSelf, rcNull);
-    }
-    return StringAsUint64(&self->projId, pid);
-}
-
-LIB_EXPORT rc_t CC KartItemItemIdNumber(const KartItem *self, uint64_t *pid) {
-    if (self == NULL) {
-        return RC(rcKFG, rcFile, rcAccessing, rcSelf, rcNull);
-    }
-    return StringAsUint64(&self->itemId, pid);
-}
-
-static rc_t KartItemCheck(const KartItem *self, const String **elem) {
-    if (elem == NULL) {
-        return RC(rcKFG, rcFile, rcAccessing, rcParam, rcNull);
-    }
-
-    *elem = NULL;
-
-    if (self == NULL) {
-        return RC(rcKFG, rcFile, rcAccessing, rcSelf, rcNull);
-    }
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KartItemProjId(const KartItem *self, const String **elem)
-{
-    rc_t rc = KartItemCheck(self, elem);
-    if (rc == 0) {
-        *elem = &self->projId;
-    }
-    return rc;
-}
-LIB_EXPORT rc_t CC KartItemItemId(const KartItem *self, const String **elem)
-{
-    rc_t rc = KartItemCheck(self, elem);
-    if (rc == 0) {
-        *elem = &self->itemId;
-    }
-    return rc;
-}
-LIB_EXPORT rc_t CC KartItemAccession(const KartItem *self, const String **elem)
-{
-    rc_t rc = KartItemCheck(self, elem);
-    if (rc == 0) {
-        *elem = &self->accession;
-    }
-    return rc;
-}
-LIB_EXPORT rc_t CC KartItemName(const KartItem *self, const String **elem)
-{
-    rc_t rc = KartItemCheck(self, elem);
-    if (rc == 0) {
-        *elem = &self->name;
-    }
-    return rc;
-}
-LIB_EXPORT rc_t CC KartItemItemDesc(const KartItem *self, const String **elem)
-{
-    rc_t rc = KartItemCheck(self, elem);
-    if (rc == 0) {
-        *elem = &self->itemDesc;
-    }
-    return rc;
-}
-/*LIB_EXPORT rc_t CC KartItemTypeId(const KartItem *self, const String **elem)
-{
-    rc_t rc = KartItemCheck(self, elem);
-    if (rc == 0) {
-        *elem = &self->typeId;
-    }
-    return rc;
-}*/
-
-/** Print KartItem using OUTMSG; if (self == NULL) then print the header */
-LIB_EXPORT rc_t CC KartItemPrint(const KartItem *self) { /* AA-833 */
-    if (self != NULL) {
-        return OUTMSG(("'%S'\t'%S'\t'%S'\t'%S'\t'%S'\n", &self->projId,
-            &self->itemId, &self->accession, &self->name, &self->itemDesc));
-    }
-    return 0;
-}
-
-struct Kart {
-    KRefcount refcount;
-
-    KDataBuffer mem;
-
-    const char *text;
-    uint64_t len;
-
-    uint16_t itemsProcessed;
-};
-
-static void KartWhack(Kart *self) {
-    assert(self);
-
-    KDataBufferWhack(&self->mem);
-
-    memset(self, 0, sizeof *self);
-
-    free(self);
-}
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-LIB_EXPORT rc_t CC KartAddRef(const Kart *self) {
-    if (self != NULL) {
-        switch (KRefcountAdd(&self->refcount, "Kart")) {
-            case krefLimit:
-                return RC(rcKFG, rcFile, rcAttaching, rcRange, rcExcessive);
-        }
-    }
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KartRelease(const Kart *self) {
-    if (self != NULL) {
-        switch (KRefcountDrop(&self -> refcount, "Kart")) {
-            case krefWhack:
-                KartWhack((Kart*)self);
-                break;
-            case krefLimit:
-                return RC(rcKFG, rcFile, rcReleasing, rcRange, rcExcessive);
-        }
-    }
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KartItemsProcessed(const Kart *self, uint16_t *number) {
-    if (number == NULL) {
-        return RC(rcKFG, rcFile, rcLoading, rcParam, rcNull);
-    }
-
-    *number = 0;
-
-    if (self == NULL) {
-        return RC(rcKFG, rcFile, rcLoading, rcSelf, rcNull);
-    }
-
-    *number = self->itemsProcessed;
-
-    return 0;
-}
-
-static rc_t KartItemInitFromKartRow(const Kart *self, const KartItem **item,
-    const char *line, size_t len)
-{
-    rc_t rc = 0;
-    int i = 0;
-    KartItem *obj = NULL;
-    assert(self && item && line && len);
-    obj = calloc(1, sizeof *obj);
-    if (obj == NULL) {
-        return RC(rcKFG, rcData, rcAllocating, rcMemory, rcExhausted);
-    }
-    for (i = 0; ; ++i) {
-        size_t l = 0;
-        String *next = NULL;
-        const char *p = string_chr(line, len, '|');
-        if (p == NULL) {
-            if (i != 4) {
-                rc = RC(rcKFG, rcFile, rcParsing, rcFile, rcInsufficient);
-                break;
-            }
-            l = len;
-        }
-        else {
-            l = p - line;
-        }
-        switch (i) { /* AA-833 */
-            case 0:
-                next = &obj->projId;
-                break;
-            case 1:
-                next = &obj->itemId;
-                break;
-            case 2:
-                next = &obj->accession;
-                break;
-            case 3:
-                next = &obj->name;
-                break;
-            case 4:
-                next = &obj->itemDesc;
-                break;
-            default:
-                rc = RC(rcKFG, rcFile, rcParsing, rcFile, rcExcessive);
-                break;
-        }
-        assert(next);
-        StringInit(next, line, l, (uint32_t)l);
-        if (l > len) {
-            rc = RC(rcKFG, rcFile, rcParsing, rcFile, rcInvalid);
-        }
-        if (len == l) {
-            break;
-        }
-        ++l;
-        line += l;
-        len -= l;
-    }
-    if (rc == 0) {
-        rc = KartAddRef(self);
-    }
-    if (rc == 0) {
-        ++((Kart*)self)->itemsProcessed;
-        obj->dad = self;
-        *item = obj;
-    }
-    else {
-        free(obj);
-        obj = NULL;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KartPrint(const Kart *self) {
-    uint32_t len = 0;
-
-    if (self == NULL) {
-        return RC(rcKFG, rcFile, rcLoading, rcSelf, rcNull);
-    }
-
-    len = (uint32_t)self->mem.elem_count;;
-    return OUTMSG(("%.*s", len, self->mem.base));
-}
-
-LIB_EXPORT rc_t CC KartPrintNumbered(const Kart *self) {
-    rc_t rc = 0;
-    rc_t rc2 = 0;
-    const char *start = NULL;
-    int32_t remaining = 0;
-    int32_t len = 0;
-    uint32_t i = 0;
-    const char *next = NULL;
-    bool done = false;
-
-    if (self == NULL) {
-        return RC(rcKFG, rcFile, rcLoading, rcSelf, rcNull);
-    }
-
-    remaining = (uint32_t)self->mem.elem_count;
-    start = self->mem.base;
-
-    {
-        const char version[] = "version ";
-        size_t l = sizeof version - 1;
-        if (string_cmp(version, l, start, remaining, (uint32_t)l) != 0) {
-            return RC(rcKFG, rcMgr, rcAccessing, rcFormat, rcUnrecognized);
-        }
-    }
-
-    next = string_chr(start, remaining, '\n');
-    if (next == NULL) {
-        len = remaining;
-    }
-    else {
-        ++next;
-        len = next - start;
-    }
-    remaining -= len;
-    rc2 = OUTMSG(("%.*s", len, start));
-    if (rc2 != 0 && rc == 0) {
-        rc = rc2;
-    }
-    start = next;
-
-    rc2 = OUTMSG(("row\tproj-id|item-id|accession|name|item-desc\n"));
-    if (rc2 != 0 && rc == 0) {
-        rc = rc2;
-    }
-
-    for (i = 1; remaining > 0; ++i) {
-        if (*start == '$') {
-            const char end[] = "$end";
-            size_t l = sizeof end - 1;
-            if (string_cmp(end, l, start, remaining, (uint32_t)l) != 0) {
-                return RC(rcKFG, rcMgr, rcAccessing, rcFormat, rcUnrecognized);
-            }
-            else {
-                done = true;
-            }
-        }
-        next = string_chr(start, remaining, '\n');
-        if (next == NULL) {
-            len = remaining;
-        }
-        else {
-            ++next;
-            len = next - start;
-        }
-        remaining -= len;
-        if (done) {
-            rc2 = OUTMSG(("%.*s", len, start));
-        }
-        else {
-            rc2 = OUTMSG(("%d\t%.*s", i, len, start));
-        }
-        if (rc2 != 0 && rc == 0) {
-            rc = rc2;
-        }
-        start = next;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KartMakeNextItem(Kart *self, const KartItem **item) {
-    size_t len = 0;
-    const char *line = NULL;
-    const char *next = NULL;
-
-    if (item == NULL) {
-        return RC(rcKFG, rcFile, rcLoading, rcParam, rcNull);
-    }
-    *item = NULL;
-    if (self == NULL) {
-        return RC(rcKFG, rcFile, rcLoading, rcSelf, rcNull);
-    }
-
-    while (self->len > 0
-        && (self->text[0] == '\r' || self->text[0] == '\n'))
-    {
-        ++self->text;
-        --self->len;
-    }
-
-    line = self->text;
-    next = string_chr(self->text, self->len, '\n');
-    if (next == NULL) {
-        return RC(rcKFG, rcFile, rcLoading, rcFile, rcInsufficient);
-    }
-
-    len = next - self->text;
-    if (*(next - 1) == '\r') {
-        --len;
-    }
-
-    if (self->len >= (uint64_t) (next - self->text + 1) ){
-        self->len -= next - self->text + 1;
-    }
-    else {
-        OUTMSG(("WARNING: STRING OVERFLOW DURING KART ROW PARSING"));
-        self->len = 0;
-    }
-
-    self->text = next + 1;
-
-    {
-        const char end[] = "$end";
-        if (string_cmp(line, len, end, sizeof end - 1, sizeof end - 1) == 0) {
-            return 0;
-        }
-    }
-
-    return KartItemInitFromKartRow(self, item, line, len);
-}
-
-static rc_t decode_kart(KDataBuffer *mem, const KFile *orig, size_t hdr_sz) {
-    rc_t rc = 0;
-    size_t num_read;
-    uint64_t eof;
-    assert(mem && orig && hdr_sz);
-    rc = KFileSize ( orig, & eof );
-    if ( rc == 0 )
-    {
-        const KFile *sub;
-        rc = KFileMakeSubRead(&sub, orig, hdr_sz, eof - hdr_sz);
-        if ( rc == 0 )
-        {
-            const KFile *gzip;
-            rc = KFileMakeGzipForRead ( & gzip, sub );
-            if ( rc == 0 )
-            {
-                rc = KDataBufferMakeBytes ( mem, 0 );
-                if ( rc == 0 )
-                {
-                    size_t total, to_read;
-
-                    /* after all of that, we're ready to decompress */
-                    for ( total = 0; ; )
-                    {
-                        char *buff;
-
-                        rc = KDataBufferResize ( mem,
-                            total + 32 * 1024 );
-                        if ( rc != 0 )
-                            break;
-
-                        buff = mem -> base;
-                        to_read = ( size_t ) mem -> elem_count - total;
-
-                        rc = KFileReadAll ( gzip, total,
-                            & buff [ total ], to_read, & num_read );
-                        if ( rc != 0 )
-                            break;
-
-                        total += num_read;
-                        
-                        if ( num_read < to_read )
-                        {
-                            buff [ total ] = 0;
-                            mem -> elem_count = total;
-                            break;
-                        }
-                    }
-                }
-
-                KFileRelease ( gzip );
-            }
-
-            KFileRelease ( sub );
-        }
-    }
-
-    return rc;
-}
-
-static rc_t KartProcessHeader(Kart *self) {
-    assert(self);
-
-    self->text = self->mem.base;
-    self->len = self->mem.elem_count;
-
-    {
-        const char version[] = "version ";
-        size_t l = sizeof version - 1;
-        if (string_cmp(version, l, self->text, self->len, (uint32_t)l) != 0) {
-            return RC(rcKFG, rcMgr, rcUpdating, rcFormat, rcUnrecognized);
-        }
-
-        self->text += l;
-        self->len -= l;
-    }
-
-    {
-        const char version[] = "1.0";
-        size_t l = sizeof version - 1;
-        if (string_cmp(version, l, self->text, l, (uint32_t)l) != 0) {
-            return RC(rcKFG, rcMgr, rcUpdating, rcFormat, rcUnsupported);
-        }
-
-        self->text += l;
-        self->len -= l;
-    }
-
-    while (self->len > 0 && (self->text[0] == '\r' || self->text[0] == '\n')) {
-        ++self->text;
-        --self->len;
-    }
-
-    return 0;
-}
-
-#ifdef _DEBUGGING
-static rc_t read_textkart(KDataBuffer *mem, const KFile *orig) {
-    rc_t rc = 0;
-    size_t num_read;
-    uint64_t eof;
-    assert(mem && orig);
-    rc = KFileSize ( orig, & eof );
-    if ( rc == 0 )
-    {
-        rc = KDataBufferMakeBytes ( mem, 0 );
-        if ( rc == 0 ) {
-            /* after all of that, we're ready to read */
-            rc = KDataBufferResize(mem, eof);
-            if ( rc != 0 )
-                return rc;
-            rc = KFileReadAll ( orig, 0, mem -> base, eof, & num_read );
-            if ( rc != 0 )
-                return rc;
-        }
-    }
-    return rc;
-}
-KFG_EXTERN rc_t CC KartMakeText(const struct KDirectory *dir, const char *path,
-    Kart **kart, bool *isKart)
-{
-    rc_t rc = 0;
-    const KFile *f = NULL;
-
-    if (dir == NULL || path == NULL || kart == NULL || isKart == NULL) {
-        return RC(rcKFG, rcFile, rcReading, rcParam, rcNull);
-    }
-
-    *isKart = false;
-    *kart = NULL;
-
-    rc = KDirectoryOpenFileRead(dir, &f, path);
-    if (rc != 0) {
-        return rc;
-    }
-
-    {
-        Kart *obj = NULL;
-
-        *isKart = true;
-
-        obj = calloc(1, sizeof *obj);
-        if (obj == NULL) {
-            return RC(rcKFG, rcData, rcAllocating, rcMemory, rcExhausted);
-        }
-
-        rc = read_textkart(&obj->mem, f);
-        if (rc == 0) {
-            rc = KartProcessHeader(obj);
-        }
-        if (rc == 0) {
-            KRefcountInit(&obj->refcount, 0, "Kart", "MakeText", "kart");
-            *kart = obj;
-        }
-        else {
-            KartWhack(obj);
-        }
-    }
-
-    RELEASE(KFile, f);
-    return rc;
-}
-#endif
-
-LIB_EXPORT rc_t KartMake(const KDirectory *dir, const char *path,
-    Kart **kart, bool *isKart)
-{
-    rc_t rc = 0;
-    const KFile *f = NULL;
-    char hdr[8] = "";
-    size_t num_read = 0;
-
-    if (dir == NULL || path == NULL || kart == NULL || isKart == NULL) {
-        return RC(rcKFG, rcFile, rcReading, rcParam, rcNull);
-    }
-
-    *isKart = false;
-    *kart = NULL;
-
-    rc = KDirectoryOpenFileRead(dir, &f, path);
-    if (rc != 0) {
-        return rc;
-    }
-
-    rc = KFileReadAll(f, 0, hdr, sizeof hdr, &num_read);
-    if (rc == 0 && num_read == sizeof hdr &&
-        memcmp(hdr, "ncbikart", sizeof hdr) == 0)
-    {
-        Kart *obj = NULL;
-
-        *isKart = true;
-
-        obj = calloc(1, sizeof *obj);
-        if (obj == NULL) {
-            return RC(rcKFG, rcData, rcAllocating, rcMemory, rcExhausted);
-        }
-
-        rc = decode_kart(&obj->mem, f, sizeof hdr);
-        if (rc == 0) {
-            rc = KartProcessHeader(obj);
-        }
-        if (rc == 0) {
-            KRefcountInit(&obj->refcount, 0, "Kart", "Make", "kart");
-            *kart = obj;
-        }
-        else {
-            KartWhack(obj);
-        }
-    }
-
-    RELEASE(KFile, f);
-    return rc;
-}
diff --git a/libs/kfg/keystore.c b/libs/kfg/keystore.c
deleted file mode 100644
index fe67b90..0000000
--- a/libs/kfg/keystore.c
+++ /dev/null
@@ -1,836 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kfg/extern.h>
-
-#include <kfg/keystore-priv.h>
-
-#include <klib/refcount.h>
-#include <klib/rc.h>
-#include <klib/text.h>
-#include <klib/printf.h>
-
-#include <kfg/config.h>
-#include <kfg/repository.h>
-#include <kfg/kfg-priv.h>
-
-#include <kfs/directory.h>
-#include <kfs/file.h>
-#include <kfs/lockfile.h>
-#include <kfs/nullfile.h>
-
-#include <strtol.h>
-
-#include <sysalloc.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define PASSWORD_MAX_SIZE 4096
-#define MAX_PATH_SIZE 4096
-
-static char defaultBindingsFile[MAX_PATH_SIZE];
-
-static rc_t KEncryptionKeyMakeFromFile(const char* path, KEncryptionKey** self);
-
-/* 
- * Non-keyring implementation, using a combination of location-based and global keys
- */
-
-struct KKeyStore
-{
-    KKeyStore_vt vt;
-    KRefcount refcount;
-    
-    KEncryptionKey* temp_key; /* temp key provided by the client code*/
-    
-    const KConfig* kfg;
-    char* bindingsFile;
-};
-
-static rc_t KKeyStoreWhack(KKeyStore* self);
-
-static KKeyStore_vt_v1 v1 = {
-    1, 0,
-    KKeyStoreWhack,
-    KKeyStoreGetKey
-};
-
-rc_t KKeyStoreWhack(KKeyStore* self)
-{
-    rc_t rc = KConfigRelease(self->kfg);
-    rc_t rc2 = KEncryptionKeyRelease(self->temp_key);
-    if (rc == 0)
-        rc = rc2;
-    if (self->bindingsFile != defaultBindingsFile)
-        free(self->bindingsFile);
-    free(self);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KKeyStoreMake(KKeyStore** self, KConfig* kfg)
-{
-    rc_t rc = 0;
-    KKeyStore* ret;
-    
-    if ( self == NULL )
-        return RC ( rcKFG, rcStorage, rcCreating, rcSelf, rcNull );
-
-    *self = NULL;
-    
-    ret = malloc(sizeof(*ret));
-    if (ret == NULL)
-        return RC ( rcKFG, rcStorage, rcCreating, rcMemory, rcExhausted );
-    
-    ret -> vt . v1 =  &v1;
-    
-    KRefcountInit ( & ret -> refcount, 1, "KKeyStore", "init", "" );
-    
-    ret->temp_key = NULL;
-    ret->bindingsFile = NULL;
-    ret->kfg = kfg;
-    if (kfg != NULL)
-    {
-        rc = KConfigAddRef(kfg);
-        if (rc == 0)
-            ret->kfg = kfg;
-    }
-    else
-        ret->kfg = NULL;
-    
-    if (rc == 0)
-        *self = ret;
-    else
-        KKeyStoreWhack(ret);
-    
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KKeyStoreAddRef ( const KKeyStore *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KKeyStore" ) )
-        {
-        case krefLimit:
-            return RC ( rcKFG, rcStorage, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KKeyStoreRelease ( const KKeyStore *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KKeyStore" ) )
-        {
-        case krefWhack:
-            self -> vt . v1 -> destroy ( ( KKeyStore* ) self );
-        break;
-        case krefLimit:
-            return RC ( rcKFG, rcStorage, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-/*
- * the result is always 0-terminated
- */
-static
-rc_t ReadEncKey(const KFile* file, char* buf, size_t bufsize)
-{
-    /* at this point we are only getting the password from a 
-     * file but in the future if we can get it from a pipe of
-     * some sort we can't count on the ReadAll to really know
-     * if we hit end of file and not just a pause in the
-     * streaming.  VDB 3 / VFS/KFS 2 will have to fix this somehow
-     */
-    size_t readNum;
-    rc_t rc = KFileReadAll (file, 0, buf, bufsize - 1, &readNum);
-
-    if (rc == 0)
-    {
-        /* -----
-         * trim back the contents of the file to
-         * a single ASCII/UTF-8 text line
-         * We actually only check for the two normal
-         * end of line characters so it could have other
-         * control characters...
-         */
-        char* pc = string_chr (buf, readNum, '\r');
-        if (pc == NULL)
-            pc = string_chr (buf, readNum, '\n');
-
-        if (pc != NULL)
-            *pc = 0;
-        else
-            buf[readNum]=0;
-            
-        if (string_measure(buf, NULL) == 0)
-            rc = RC (rcKFG, rcEncryptionKey, rcRetrieving, rcSize, rcTooShort);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KKeyStoreSetTemporaryKeyFromFile(KKeyStore* self, const struct KFile* file)
-{
-    rc_t rc;
-    char key[PASSWORD_MAX_SIZE + 1];
-    
-    if ( self == NULL )
-        return RC ( rcKFG, rcEncryptionKey, rcRetrieving, rcSelf, rcNull );
-        
-    if ( file == NULL )
-    {
-        rc = KEncryptionKeyRelease(self->temp_key);
-        self->temp_key = NULL;
-    }
-    else
-    {    
-        rc = ReadEncKey(file, key, PASSWORD_MAX_SIZE);
-        if (rc == 0)
-        {
-            rc = KEncryptionKeyRelease(self->temp_key);
-            if ( rc == 0)
-                rc = KEncryptionKeyMake(key, &self->temp_key);
-            memset(key, 0, PASSWORD_MAX_SIZE); /* is this enough security? */
-        }
-    }
-    
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KKeyStoreGetKey(const KKeyStore* self, const char* obj_key, KEncryptionKey** enc_key)
-{
-    rc_t rc = 0;
-    
-    if ( self == NULL )
-        return RC ( rcKFG, rcEncryptionKey, rcRetrieving, rcSelf, rcNull );
-    if ( enc_key == NULL )
-        return RC ( rcKFG, rcEncryptionKey, rcRetrieving, rcParam, rcNull );
-    
-    if (self->temp_key != NULL)
-    {
-        rc = KEncryptionKeyAddRef(self->temp_key);
-        if (rc == 0)
-            *enc_key = self->temp_key;
-    }
-    else
-    {
-        const char * env = getenv (ENV_KRYPTO_PWFILE);
-        if (env != NULL)
-            rc = KEncryptionKeyMakeFromFile(env, enc_key);
-        else 
-        {   /* try protected repository */
-            if ( self -> kfg == NULL )
-                rc = KConfigMake( (KConfig**) &(self -> kfg), NULL );
-            if ( rc == 0 )
-            {
-                rc_t rc2;
-                const KRepositoryMgr *rmgr;
-                rc = KConfigMakeRepositoryMgrRead ( self -> kfg, & rmgr );
-                if ( rc == 0 )
-                {
-                    const KRepository *protected;
-                    rc = KRepositoryMgrCurrentProtectedRepository ( rmgr, & protected );
-                    if ( rc == 0 )
-                    {   /* in a protected area */
-                        char path [ MAX_PATH_SIZE ];
-                        rc = KRepositoryEncryptionKeyFile ( protected, path, sizeof(path), NULL );
-                        if ( rc == 0 && path [ 0 ] != 0 )
-                            rc = KEncryptionKeyMakeFromFile(path, enc_key);
-                            
-                        rc2 = KRepositoryRelease ( protected );
-                        if (rc == 0)
-                            rc = rc2;
-                    }
-                    else /* use global password file */
-                    {
-                        String* path;
-                        rc = KConfigReadString ( self -> kfg, KFG_KRYPTO_PWFILE, &path );        
-                        if (rc == 0)
-                        {
-                            rc = KEncryptionKeyMakeFromFile(path->addr, enc_key);
-                            StringWhack(path);
-                        }
-                        else 
-                            rc = RC(rcKFG, rcEncryptionKey, rcRetrieving, rcItem, rcNotFound); 
-                    }
-                    rc2 = KRepositoryMgrRelease ( rmgr );
-                    if (rc == 0)
-                        rc = rc2;
-                }
-            }
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KKeyStoreSetConfig(struct KKeyStore* self, const struct KConfig* kfg)
-{
-    rc_t rc = 0;
-    if ( self == NULL )
-        return RC ( rcKFG, rcEncryptionKey, rcRetrieving, rcSelf, rcNull );
-        
-    if ( kfg != NULL )
-        rc = KConfigAddRef(kfg);
-        
-    if ( rc == 0 )
-    {
-        if ( self->kfg != NULL )
-            KConfigRelease(self->kfg);
-        self->kfg = kfg;
-    }
-        
-    return rc;
-}
-
-/* 
- * KEncryptionKey
- */
-
-LIB_EXPORT rc_t CC KEncryptionKeyAddRef ( KEncryptionKey *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KEncryptionKey" ) )
-        {
-        case krefLimit:
-            return RC ( rcKFG, rcEncryptionKey, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KEncryptionKeyRelease ( KEncryptionKey *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KEncryptionKey" ) )
-        {
-        case krefWhack:
-            free((char*)self->value.addr); /*TODO: unlock memory? */
-            free(self);
-            break;
-        case krefLimit:
-            return RC ( rcKFG, rcEncryptionKey, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-static rc_t KEncryptionKeyMakeInt(const char* value, KEncryptionKey** self)
-{
-    KEncryptionKey* ret;
-    
-    *self = NULL;
-    
-    ret = malloc(sizeof(KEncryptionKey));
-    if (ret == NULL)
-        return RC ( rcKFG, rcEncryptionKey, rcCreating, rcMemory, rcExhausted );
-    else
-    {
-        size_t size = string_measure(value, NULL);
-        char* data = malloc(size+1);/*TODO: place in protected memory*/
-        if (data == NULL)
-        {
-            free(ret);
-            return RC ( rcKFG, rcEncryptionKey, rcCreating, rcMemory, rcExhausted );
-        }
-
-        string_copy(data, size + 1, value, size);    
-        StringInit( & ret -> value, data, size, (uint32_t)size ); /* do not include the 0-terminator */
-        
-        KRefcountInit ( & ret -> refcount, 1, "KEncryptionKey", "init", "" );
-        
-        *self = ret;
-        return 0;
-    }
-}
-
-LIB_EXPORT rc_t CC KEncryptionKeyMake(const char* value, KEncryptionKey** self)
-{
-    if ( value == NULL )
-        return RC ( rcKFG, rcEncryptionKey, rcCreating, rcParam, rcNull );
-    if ( self == NULL )
-        return RC ( rcKFG, rcEncryptionKey, rcCreating, rcSelf, rcNull );
-
-    return KEncryptionKeyMakeInt(value, self);
-}
-
-static rc_t KEncryptionKeyMakeFromFile(const char* path, KEncryptionKey** self)
-{
-    rc_t rc;
-    KDirectory* wd;
-    
-    if ( path == NULL )
-        return RC ( rcKFG, rcEncryptionKey, rcCreating, rcParam, rcNull );
-    if ( self == NULL )
-        return RC ( rcKFG, rcEncryptionKey, rcCreating, rcSelf, rcNull );
-    
-    rc = KDirectoryNativeDir(&wd);
-    if (rc == 0)
-    {
-        rc_t rc2;
-        const KFile* file;
-        const char dev_stdin [] = "/dev/stdin";
-        const char dev_null [] = "/dev/null";        
-        
-        if (strcmp (dev_stdin, path) == 0)
-            rc = KFileMakeStdIn (&file);
-        else if (strcmp (dev_null, path) == 0)
-            rc = KFileMakeNullRead (&file);
-        else 
-            rc = KDirectoryOpenFileRead(wd, &file, path);
-        if (rc == 0)
-        {
-            char key[PASSWORD_MAX_SIZE + 1];
-            rc = ReadEncKey(file, key, PASSWORD_MAX_SIZE);
-            if (rc == 0)
-                rc = KEncryptionKeyMakeInt(key, self);
-                
-            rc2 = KFileRelease(file);
-            if (rc == 0)
-                rc = rc2;
-        }
-        rc2 = KDirectoryRelease(wd);
-        if (rc == 0)
-            rc = rc2;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KKeyStoreSetBindingsFile(struct KKeyStore* self, const char* path)
-{
-    if ( self == NULL )
-        return RC ( rcKFG, rcStorage, rcInitializing, rcSelf, rcNull );
-        
-    if (self->bindingsFile != defaultBindingsFile)
-        free(self->bindingsFile);
-    if (path == NULL)
-        self->bindingsFile = NULL;
-    else
-    {
-        self->bindingsFile = string_dup(path, string_size(path));
-        if (self->bindingsFile == NULL)
-            return RC ( rcKFG, rcStorage, rcInitializing, rcMemory, rcExhausted );
-    }
-    return 0;
-}
-
-LIB_EXPORT const char* KKeyStoreGetBindingsFile(const struct KKeyStore* self)
-{
-    if ( self == NULL )
-        return NULL;
-        
-    return self->bindingsFile;
-}
-
-
-#define MAX_OBJID_SIZE 20
-#define MAX_NAME_SIZE 4096
-
-static rc_t LocateObjectId(const KFile* file, const char* key, char* value, size_t value_size, size_t* value_read)
-{
-    char buf[MAX_OBJID_SIZE + 1 + MAX_NAME_SIZE + 1];
-    size_t num_read;
-    uint64_t pos = 0;
-    size_t key_size = string_size(key);
-    bool eof = false;
-    do
-    {
-        rc_t rc = KFileReadAll(file, pos, buf, sizeof(buf), &num_read);
-        if (rc != 0)
-            return rc;
-        else
-        {
-            size_t start;
-            if (num_read == sizeof(buf))
-            {   /* locate the last incomplete line and ignore it; will be considered after the next read() */
-                while (num_read > 0)
-                {
-                    --num_read;
-                    if (buf[num_read] == '\r' || buf[num_read] == '\n')
-                        break;
-                }
-                if (num_read == 0)
-                    return RC ( rcVFS, rcMgr, rcReading, rcRow, rcTooLong);
-            }
-            else
-                eof = true;
-            
-            start = 0;
-            while (start + key_size < num_read)
-            {   
-                /* find the beginning of a line */
-                while (buf[start] == '\r' || buf[start] == '\n') 
-                {
-                    ++start;
-                    if (start >= num_read)
-                        break;
-                }
-                /* check the key */
-                if (string_cmp(key, key_size, buf + start, key_size, (uint32_t) ( num_read - start )) == 0)
-                {
-                    if (buf [ start + key_size ] == '=')
-                    {
-                        int32_t i = 0;
-                        size_t sourceIdx = start + key_size + 1; /* 1st character after '=' */
-                        while (sourceIdx < num_read)
-                        {
-                            if (i >= value_size)
-                                return RC ( rcVFS, rcMgr, rcReading, rcName, rcTooLong);
-                                
-                            if (buf[sourceIdx] == '\r' || buf[sourceIdx] == '\n') 
-                                break;
-                                
-                            value[i] = buf[sourceIdx];
-                            
-                            ++i;
-                            ++sourceIdx;
-                        }
-                        *value_read = i;
-                        return 0;
-                    }
-                }
-                
-                /* skip until the next end of line */
-                while (buf[start] != '\r' && buf[start] != '\n') 
-                {
-                    ++start;
-                    if (start >= num_read)
-                        break;
-                }
-            }
-            
-            pos += num_read;
-        }
-    }
-    while (!eof);
-    
-    return RC ( rcVFS, rcMgr, rcReading, rcId, rcNotFound );
-}
-
-/*
- * Reverse lookup
- */
-static rc_t LocateObject(const KFile* file, const char* value, const size_t value_size, char* key, size_t key_size, size_t* key_read)
-{
-    char buf[MAX_OBJID_SIZE + 1 + MAX_NAME_SIZE + 1];
-    size_t num_read;
-    uint64_t pos = 0;
-    bool eof = false;
-    do
-    {
-        rc_t rc = KFileReadAll(file, pos, buf, sizeof(buf), &num_read);
-        if (rc != 0)
-            return rc;
-        else
-        {
-            size_t start;
-            if (num_read == sizeof(buf))
-            {   /* locate the last incomplete line and ignore it; will be considered after the next read() */
-                while (num_read > 0)
-                {
-                    --num_read;
-                    if (buf[num_read] == '\r' || buf[num_read] == '\n')
-                        break;
-                }
-                if (num_read == 0)
-                    return RC ( rcVFS, rcMgr, rcReading, rcRow, rcTooLong);
-            }
-            else
-                eof = true;
-            
-            start = 0; 
-            while (start + value_size < num_read)
-            {   
-                size_t key_start, key_end;
-                size_t value_start;
-                
-                /* find the beginning of a line */
-                while (buf[start] == '\r' || buf[start] == '\n') 
-                {
-                    ++start;
-                    if (start >= num_read)
-                        break;
-                }
-                if (start >= num_read)
-                    continue;
-                    
-                key_start = start;
-                
-                /* find the separator */
-                while (buf[start] != '=') 
-                {
-                    if (buf[start] == '\r' || buf[start] == '\n') /* separator not found, ignore the line*/
-                        break;
-                        
-                    ++start;
-                    if (start >= num_read)
-                        break;
-                }
-                if (start >= num_read || buf[start] != '=')
-                    continue;
-                
-                key_end = start;
-                
-                ++start; /* skip the separator */
-
-                value_start = start;
-                /* find the next end of line */
-                while (buf[start] != '\r' && buf[start] != '\n') 
-                {
-                    ++start;
-                    if (start >= num_read)
-                        break;
-                }
-
-                /* compare the value */
-                if (string_cmp(value, value_size, buf + value_start, start - value_start, (uint32_t) ( start - value_start )) == 0)
-                {
-                    *key_read = key_end - key_start;
-                    if (string_copy(key, key_size, buf + key_start, *key_read) != *key_read)
-                        return RC ( rcVFS, rcMgr, rcReading, rcId, rcTooLong);
-                    return 0;
-                }
-            }
-            
-            pos += num_read;
-        }
-    }
-    while (!eof);
-    
-    return RC ( rcVFS, rcMgr, rcReading, rcId, rcNotFound );
-}
-
-static rc_t AppendObject(KFile* file, const char* name, const String* value)
-{
-    uint64_t size;
-    rc_t rc = KFileSize ( file, &size );
-    if (rc == 0)
-    {
-        char buf[MAX_OBJID_SIZE + 1 + MAX_NAME_SIZE + 1];
-        size_t num_writ;
-        rc = string_printf(buf, sizeof(buf), &num_writ, "%s=%S\n", name, value);
-        if (rc == 0)
-            rc = KFileWrite ( file, size, buf, num_writ, &num_writ );
-    }
-    return rc;
-}
-
-static rc_t OpenBindingsFile(KKeyStore* self, const KFile** ret)
-{
-    rc_t rc = 0;
-    if (self->bindingsFile == NULL)
-    {
-        String* home;
-        if ( self->kfg == NULL )
-            rc = KConfigMake( (KConfig**) &(self -> kfg), NULL );
-        if (rc == 0)
-        {
-            if (KConfigReadString(self->kfg, "NCBI_HOME", &home) == 0 ||
-                KConfigReadString(self->kfg, "HOME", &home) == 0 ||
-                KConfigReadString(self->kfg, "USERPROFILE", &home) == 0 )
-            {
-                size_t num_writ;
-                rc = string_printf(defaultBindingsFile, sizeof(defaultBindingsFile), &num_writ, "%S/objid.mapping", home);
-                if (rc == 0)
-                    self->bindingsFile = defaultBindingsFile;
-                StringWhack(home);
-            }
-            else
-                rc = RC ( rcVFS, rcMgr, rcOpening, rcEnvironment, rcNull );
-        }
-    }
-    
-    if (rc == 0)
-    {
-        rc_t rc2;
-        KDirectory* wd;
-        rc = KDirectoryNativeDir (&wd);
-        if (rc == 0)
-            rc = KDirectoryOpenFileRead(wd, ret, self->bindingsFile);
-        else
-            *ret = NULL;
-            
-        rc2 = KDirectoryRelease(wd);
-        if (rc == 0)
-            rc = rc2;
-    }
-    return rc;
-}
- 
-LIB_EXPORT rc_t CC KKeyStoreRegisterObject(struct KKeyStore* self, uint32_t oid, const struct String* newName)
-{
-    rc_t rc = 0;
-    if ( self == NULL )
-        return RC ( rcKFG, rcStorage, rcInitializing, rcSelf, rcNull );
-    else if ( newName == NULL )
-        rc = RC ( rcKFG, rcStorage, rcInitializing, rcParam, rcNull );
-    else
-    {
-        char oidString[MAX_OBJID_SIZE];
-        size_t num_writ;
-        rc = string_printf(oidString, sizeof(oidString), &num_writ, "%d", oid);
-        if (rc == 0)
-        {
-            rc_t rc2;
-            const KFile* file;
-            char oldName[MAX_NAME_SIZE];
-            size_t num_read;
-            
-            rc = OpenBindingsFile(self, &file);
-            if (rc == 0)
-            {   /* see if already registered */
-                if (LocateObjectId(file, oidString, oldName, sizeof(oldName), &num_read) == 0 &&
-                    string_cmp(oldName, num_read, newName->addr, newName->size, (uint32_t)newName->size) != 0)
-                    rc = RC ( rcVFS, rcMgr, rcRegistering, rcId, rcExists );
-                rc2 = KFileRelease(file);
-                if (rc == 0)
-                    rc = rc2;
-            }
-            else /* no bindings file; will create */
-                rc = 0;
-            
-            if (rc == 0)
-            {   /* not registered; lock the bindings file and append the binding */
-                KDirectory* wd;
-                rc = KDirectoryNativeDir (&wd);
-                if (rc == 0)
-                {
-                    KFile* lockedFile;
-                    /*TODO: loop until locking succeeds or times out */
-                    rc = KDirectoryCreateExclusiveAccessFile(wd, &lockedFile, true, 0600, kcmOpen, self->bindingsFile);
-                    if (rc == 0)
-                    {
-                        if (LocateObjectId(lockedFile, oidString, oldName, sizeof(oldName), &num_read) == 0)
-                        {   /* somebody inserted the binding before we locked - make sure their binding was the same */
-                            if (string_cmp(oldName, num_read, newName->addr, newName->size, (uint32_t)newName->size) != 0)
-                                rc = RC ( rcVFS, rcMgr, rcRegistering, rcId, rcExists );
-                        }
-                        else
-                            rc = AppendObject(lockedFile, oidString, newName);
-                            
-                        rc2 = KFileRelease(lockedFile);
-                        if (rc == 0)
-                            rc = rc2;
-                    }
-                    rc2 = KDirectoryRelease(wd);
-                    if (rc == 0)
-                        rc = rc2;
-                }
-            }
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VKKeyStoreGetObjectId(const struct KKeyStore* self, const struct String* name, uint32_t* oid)
-{
-    rc_t rc = 0;
-    if ( self == NULL )
-        return RC ( rcKFG, rcStorage, rcRetrieving, rcSelf, rcNull );
-    else if ( oid == NULL )
-        rc = RC ( rcKFG, rcStorage, rcRetrieving, rcParam, rcNull );
-    else
-    {
-        const KFile* file;
-        rc = OpenBindingsFile((KKeyStore*)self, &file);
-        if (rc == 0)
-        {
-            rc_t rc2;
-            char id_buf[MAX_OBJID_SIZE+1];
-            size_t id_read;
-            if (LocateObject(file, name->addr, name->size, id_buf, MAX_OBJID_SIZE, &id_read) == 0)
-            {
-                char* endptr;
-                unsigned long int res;
-                id_buf[id_read] = 0;
-                res = strtou32(id_buf, &endptr, 10);
-                if (*endptr != 0)
-                    rc = RC ( rcKFG, rcStorage, rcRetrieving, rcId, rcCorrupt);
-                else
-                    *oid = (uint32_t)res;
-            }
-            else
-                rc = RC ( rcKFG, rcStorage, rcRetrieving, rcName, rcNotFound);
-            
-            rc2 = KFileRelease(file);
-            if (rc == 0)
-                rc = rc2;
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KKeyStoreGetObjectName(const struct KKeyStore* self, uint32_t oid, const struct String** result)
-{
-    rc_t rc = 0;
-    if ( self == NULL )
-        return RC ( rcKFG, rcStorage, rcRetrieving, rcSelf, rcNull );
-    else if ( result == NULL )
-        rc = RC ( rcKFG, rcStorage, rcRetrieving, rcParam, rcNull );
-    else
-    {
-        char oidString[MAX_OBJID_SIZE];
-        size_t num_writ;
-        rc = string_printf(oidString, sizeof(oidString), &num_writ, "%d", oid);
-        if (rc == 0)
-        {
-            const KFile* file;
-            
-            rc = OpenBindingsFile((KKeyStore*)self, &file);
-            if (rc == 0)
-            {   
-                rc_t rc2;
-                char name[MAX_NAME_SIZE];
-                size_t num_read;
-                if (LocateObjectId(file, oidString, name, sizeof(name), &num_read) == 0)
-                {
-                    String* res = (String*)malloc(sizeof(String) + num_read);
-                    if (res != NULL)
-                    {
-                        string_copy((char*)res + sizeof(String), num_read, name, num_read);
-                        StringInit(res, (char*)res + sizeof(String), num_read, (uint32_t)num_read);
-                        *result = res;
-                    }
-                    else
-                        rc = RC ( rcKFG, rcStorage, rcRetrieving, rcMemory, rcExhausted );
-                }
-                else
-                    rc = RC ( rcKFG, rcStorage, rcRetrieving, rcId, rcNotFound);
-                    
-                rc2 = KFileRelease(file);
-                if (rc == 0)
-                    rc = rc2;
-            }
-        }
-    }
-    return rc;
-}
-
diff --git a/libs/kfg/kfg-parse.h b/libs/kfg/kfg-parse.h
deleted file mode 100644
index c271b98..0000000
--- a/libs/kfg/kfg-parse.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#ifndef _h_kfg_scan_
-#define _h_kfg_scan_
-
-#include <kfg/extern.h>
-#include <klib/rc.h>
-#include <klib/namelist.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct KFGParseBlock
-{
-    const char* tokenText;
-    size_t tokenLength;
-    int tokenId;
-    size_t line_no;
-    size_t column_no;
-} KFGParseBlock;
-
-typedef struct KFGScanBlock
-{
-    void* scanner;
-    void* buffer;
-    void* self; 
-    const char* file;
-    KFGParseBlock* lastToken; /* used for error reporting */
-    rc_t (*write_nvp)(void * self, const char* name, size_t nameLen, VNamelist*);
-    bool (*look_up_var)(void * self, struct KFGParseBlock*);
-    void (*report_error)(struct KFGScanBlock* sb, const char* msg);
-} KFGScanBlock;
-
-#define YYSTYPE_IS_DECLARED
-typedef union 
-{
-	KFGParseBlock   pb;
-	VNamelist*	    namelist;
-} KFGSymbol;
-
-/* Exposed for the sake of wb-test-kfg. */
-KFG_EXTERN rc_t CC KFGScan_yylex_init(KFGScanBlock* sb, const char *str);
-KFG_EXTERN void CC KFGScan_yylex_destroy(KFGScanBlock* sb);
-
-KFG_EXTERN void CC KFGScan_set_debug(bool on, KFGScanBlock* scannerContext);
-
-KFG_EXTERN int CC KFGScan_yylex(KFGSymbol* pb, KFGScanBlock* scannerContext);
-
-KFG_EXTERN int CC KFG_parse(KFGParseBlock* pb, KFGScanBlock* scannerContext);
-void CC KFG_error(KFGParseBlock* pb, KFGScanBlock* sb, const char* msg);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfg_scan_ */
diff --git a/libs/kfg/report-kfg.c b/libs/kfg/report-kfg.c
deleted file mode 100644
index 5febcc6..0000000
--- a/libs/kfg/report-kfg.c
+++ /dev/null
@@ -1,506 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kfg/extern.h>
-
-#include <kfg/config.h>
-#include <kfg/repository.h> /* KRepositoryMgr */
-#include <kfg/kfg-priv.h>
-
-#include <klib/namelist.h> /* KNamelistRelease */
-#include <klib/out.h> /* OUTMSG */
-#include <klib/klib-priv.h>
-#include <klib/rc.h>
-
-#include <kfs/directory.h>
-#include <kfs/dyload.h> /* KDyld */
-#include <kfs/file.h> /* KFileRead */
-#include <kfs/nullfile.h> /* KFileMakeNullUpdate */
-#include <kfs/md5.h> /* KMD5SumFmt */
-
-#include <sysalloc.h>
-
-#include <stdarg.h> /* va_start */
-#include <stdio.h> /* sprintf */
-#include <stdlib.h> /* malloc */
-#include <string.h> /* memset */
-#include <limits.h> /* PATH_MAX */
-#include <assert.h>
-
-#ifndef PATH_MAX
-#define PATH_MAX 4096
-#endif
-
-#define RELEASE(type, obj) do { rc_t rc2 = type##Release(obj); \
-    if (rc2 && !rc) { rc = rc2; } obj = NULL; } while (false)
-
-/*
- * An unrecoverable error happened.
- * We can help to solve it
- * by reporting information about known application execution environment.
- */
-
-#define report ( * f -> report )
-#define reportData ( * f -> reportData )
-#define reportData1 ( * f -> reportData1 )
-#define reportOpen ( * f -> reportOpen )
-#define reportOpen1 ( * f -> reportOpen1 )
-#define reportClose ( * f -> reportClose )
-#define reportClose1 ( * f -> reportClose1 )
-#define reportError ( * f -> reportError )
-#define reportErrorStr ( * f -> reportErrorStr )
-#define reportErrorStrImpl ( * f -> reportErrorStrImpl )
-#define reportErrorStrInt ( * f -> reportErrorStrInt )
-#define reportError3Str ( * f -> reportError3Str )
-
-static rc_t ReportKfgFiles(const ReportFuncs *f,
-    int indent, const KConfig* cfg)
-{
-    rc_t rc = 0;
-
-    uint32_t count = 0;
-    KNamelist* names = NULL;
-
-    rc = KConfigListIncluded(cfg, &names);
-
-    if (rc != 0) {
-        reportOpen(indent, "Files", 0);
-        reportError(indent + 1, rc, "KConfigListIncluded");
-    }
-    else {
-        rc = KNamelistCount(names, &count);
-        if (rc != 0) {
-            reportOpen(indent, "Files", 0);
-            reportErrorStr(indent + 1,
-                rc, "KNamelistCount", "origin", "KConfigListIncluded");
-        }
-        else {
-            uint32_t i = 0;
-            reportOpen(indent, "Files", 1, "count", 'd', count);
-            for (i = 0; i < count && rc == 0; ++i) {
-                const char* name = NULL;
-                rc = KNamelistGet(names, i, &name);
-                if (rc != 0) {
-                    reportErrorStrInt(indent + 1, rc, "KNamelistGet",
-                        "origin", "KConfigListIncluded", "idx", i);
-                }
-                else
-                {   report(indent + 1, "File", 1, "name", 's', name); }
-            }
-        }
-    }
-    reportClose(indent, "Files");
-
-    RELEASE(KNamelist, names);
-
-    return rc;
-}
-
-static
-rc_t sKConfigNode_Read(const KConfigNode* node, char* buffer, size_t buf_sz,
-    char** overflow_buf, bool* cant_allocate)
-{
-    rc_t rc = 0;
-    size_t num_read = 0;
-    size_t remaining = 0;
-    assert(overflow_buf && cant_allocate);
-    *cant_allocate = false;
-    *overflow_buf = NULL;
-    rc = KConfigNodeRead(node, 0, buffer, buf_sz, &num_read, &remaining);
-    if (rc != 0)
-    {   return rc; }
-    if (num_read < buf_sz)
-    {   buffer[num_read] = '\0'; }
-    else {
-        size_t new_buf_sz = num_read + remaining + 1;
-        char* overflow = malloc(new_buf_sz);
-        if (overflow == NULL) {
-            int i = 0;
-            for (i = 2; i < 5 && buf_sz - i > 0; ++i)
-            {   buffer[buf_sz - i] = '.'; }
-            buffer[buf_sz - 1] = '\0';
-            *cant_allocate = true;
-        }
-        else {
-            buffer = *overflow_buf = overflow;
-            buf_sz = 
-            rc = KConfigNodeRead
-                (node, 0, buffer, new_buf_sz, &num_read, &remaining);
-            if (rc != 0)
-            {   return rc; }
-            assert(num_read < new_buf_sz && remaining == 0);
-            buffer[num_read] = '\0';
-        }
-    }
-    return rc;
-}
-
-static rc_t ReportChildNode(const ReportFuncs *f, int indent,
-    const KNamelist* names, const KConfigNode* node, const char* root, uint32_t idx);
-
-static
-rc_t ReportConfigNodeChildren(const ReportFuncs *f, int indent,
-    const KConfigNode* node, const char* nodeName)
-{
-    KNamelist* names = NULL;
-    rc_t rc = KConfigNodeListChild(node, &names);
-    if (rc != 0) {
-        reportErrorStrImpl(indent,
-            rc, "KConfigNodeListChild", "node", nodeName, false);
-    }
-    else {
-        uint32_t count = 0;
-        rc = KNamelistCount(names, &count);
-        if (rc != 0) {
-            reportErrorStrImpl
-                (indent, rc, "KNamelistCount", "node", nodeName, false);
-        }
-        else {
-            if (count) {
-                uint32_t i = 0;
-                int j;
-                OUTMSG(("\n"));
-                for (i = 0; i < count && rc == 0; ++i) {
-                    rc = ReportChildNode
-                        (f, indent + 1, names, node, nodeName, i);
-                }
-                for (j = 0; j < indent; ++j)
-                {   OUTMSG((" ")); }
-            }
-        }
-    }
-    RELEASE(KNamelist, names);
-    return rc;
-}
-
-static rc_t ReportConfigNode(const ReportFuncs *f, int indent, const char* root,
-    const char* name, const KConfigNode* node, const char* node_name)
-{
-    rc_t rc = 0;
-
-    char local[PATH_MAX + 1] = "";
-    const char* nodeName = node_name ? node_name : name;
-    char* overflow = NULL;
-    bool cantallocate = false;
-
-    reportOpen1(indent, nodeName);
-    rc = sKConfigNode_Read(node, local, sizeof local, &overflow, &cantallocate);
-    if (rc == 0) {
-        char* buf = overflow ? overflow : local;
-        rc = reportData1(buf);
-        free(overflow);
-        overflow = NULL;
-        if (rc == 0)
-        {   rc = ReportConfigNodeChildren(f, indent, node, nodeName); }
-    }
-    else {
-        reportError3Str
-            (indent + 1, rc, "KConfigNodeRead", "node", root, "/", name, false);
-    }
-    reportClose1(nodeName);
-
-    return rc;
-}
-
-static rc_t ReportConfigNode_File(const ReportFuncs *f, int indent,
-    const char* root,
-    const char* name, const KConfigNode* node, const char* node_name)
-{
-    rc_t rc = 0;
-    char local[PATH_MAX + 1] = "";
-    const char* nodeName = node_name ? node_name : name;
-    char* overflow = NULL;
-    bool cantallocate = false;
-    rc = sKConfigNode_Read(node, local, sizeof local, &overflow, &cantallocate);
-    if (rc) {
-        reportError3Str
-            (indent, rc, "KConfigNodeRead", "node", root, "/", name, false);
-    }
-    else {
-        const char* buf = overflow ? overflow : local;
-        KPathType file_type = kptNotFound;
-        const char* type = NULL;
-        if (!cantallocate) {
-            KDirectory* dir = NULL;
-            rc = KDirectoryNativeDir(&dir);
-            if (rc == 0) {
-                file_type = KDirectoryPathType(dir, buf);
-                file_type &= ~kptAlias;
-                type = file_type == kptFile ? "exists" :
-                          file_type == kptNotFound ? "not found" : "unexpected";
-            }
-            RELEASE(KDirectory, dir);
-        }
-        else
-        {   type = "noo long"; }
-        if (rc == 0)
-        {   reportData(indent, nodeName, buf, 1, "file", 's', type); }
-    }
-    free(overflow);
-    overflow = NULL;
-    return rc;
-}
-
-static rc_t ReportChildNode(const ReportFuncs *f, int indent,
-    const KNamelist* names,
-    const KConfigNode* node, const char* root, uint32_t idx)
-{
-    rc_t rc = 0;
-
-    const char* name = NULL;
-    rc = KNamelistGet(names, idx, &name);
-    if (rc != 0) {
-        reportErrorStrInt
-            (indent + 1, rc, "KNamelistGet", "node", root, "idx", idx);
-    }
-    else {
-        const KConfigNode* child = NULL;
-        rc = KConfigNodeOpenNodeRead(node, &child, name);
-        if (rc != 0) {
-            reportOpen(indent, name, 0);
-            reportError3Str(indent + 1, rc, "KConfigNodeOpenNodeRead",
-                "node", root, "/", name, true);
-            reportClose(indent, name);
-        }
-        else
-        {   rc = ReportConfigNode(f, indent, root, name, child, NULL); }
-    }
-
-    return rc;
-}
-
-static
-rc_t ReportRefseq(const ReportFuncs *f, int indent, const KConfig* cfg)
-{
-    rc_t rc = 0;
-
-    const char root[] = "refseq";
-
-    const KConfigNode* node = NULL;
-    rc = KConfigOpenNodeRead(cfg, &node, root);
-    if (rc != 0) {
-        if (GetRCState(rc) == rcNotFound) {
-            report(indent, root, 1, "state", 's', "not found");
-            rc = 0;
-        }
-        else
-        {   reportErrorStr(indent, rc, "KConfigOpenNodeRead", "node", root); }
-    }
-    else {
-        KNamelist* names = NULL;
-        rc = KConfigNodeListChild(node, &names);
-        if (rc != 0)
-        {   reportErrorStr(indent, rc, "KConfigNodeListChild", "node", root); }
-        else {
-            uint32_t count = 0;
-            rc = KNamelistCount(names, &count);
-            if (rc != 0)
-            {   reportErrorStr(indent, rc, "KNamelistCount", "node", root); }
-            else {
-                uint32_t i = 0;
-                reportOpen(indent, root, 0);
-                for (i = 0; i < count && rc == 0; ++i)
-                {   rc = ReportChildNode(f, indent + 1, names, node, root, i); }
-                reportClose(indent, root);
-            }
-        }
-        RELEASE(KNamelist, names);
-    }
-
-    RELEASE(KConfigNode, node);
-
-    return rc;
-}
-
-static
-rc_t ReportSra(const ReportFuncs *f, int indent, const KConfig* cfg)
-{
-    rc_t rc = 0;
-    const char root[] = "sra";
-    const KConfigNode* node = NULL;
-    assert(cfg);
-    rc = KConfigOpenNodeRead(cfg, &node, root);
-    if (rc != 0) {
-        if (GetRCState(rc) == rcNotFound) {
-            report(indent, root, 1, "state", 's', "not found");
-            rc = 0;
-        }
-        else
-        {   reportErrorStr(indent, rc, "KConfigOpenNodeRead", "node", root); }
-    }
-    else {
-        KNamelist* names = NULL;
-        rc = KConfigNodeListChild(node, &names);
-        if (rc != 0)
-        {   reportErrorStr(indent, rc, "KConfigNodeListChild", "node", root); }
-        else {
-            uint32_t count = 0;
-            rc = KNamelistCount(names, &count);
-            if (rc != 0)
-            {   reportErrorStr(indent, rc, "KNamelistCount", "node", root); }
-            else {
-                uint32_t i = 0;
-                reportOpen(indent, root, 0);
-                for (i = 0; i < count && rc == 0; ++i)
-                {   rc = ReportChildNode(f, indent + 1, names, node, root, i); }
-                reportClose(indent, root);
-            }
-        }
-        RELEASE(KNamelist, names);
-    }
-    RELEASE(KConfigNode, node);
-    return rc;
-}
-
-static
-rc_t ReportKrypto(const ReportFuncs *f, int indent, const KConfig* cfg)
-{
-    rc_t rc = 0;
-
-    const char root[] = KFG_KRYPTO_PWFILE;
-    const char name[] = "krypto";
-
-    const KConfigNode* node = NULL;
-    rc = KConfigOpenNodeRead(cfg, &node, root);
-    if (rc != 0) {
-        if (GetRCState(rc) == rcNotFound) {
-            report(indent, name, 1, "state", 's', "pwfile: not found");
-            rc = 0;
-        }
-        else
-        {   reportErrorStr(indent, rc, "KConfigOpenNodeRead", "node", root); }
-    }
-    else {
-        rc = ReportConfigNode_File(f, indent, "krypto", "pwfile", node, "krypto");
-    }
-
-    RELEASE(KConfigNode, node);
-
-    return rc;
-}
-
-static
-rc_t ReportCrntRepository(const ReportFuncs *f, int indent, const KConfig *cfg)
-{
-    rc_t rc = 0;
-    const KRepositoryMgr *mgr = NULL;
-    const KRepository *protectd = NULL;
-    const char root[] = "CurrentProtectedRepository";
-    bool open = false;
-    rc = KConfigMakeRepositoryMgrRead(cfg, &mgr);
-    if (rc != 0) {
-        reportError(indent, rc, "KConfigMakeRepositoryMgrRead");
-    }
-    if (rc == 0) {
-        rc = KRepositoryMgrCurrentProtectedRepository(mgr, &protectd);
-        if (rc != 0) {
-            if (rc == SILENT_RC(
-                rcKFG, rcMgr, rcAccessing, rcNode, rcNotFound))
-            {
-                report(indent, root, 1, "found", 's', "false");
-            }
-            else {
-                reportOpen(indent, root, 0);
-                open = true;
-                reportErrorStr(indent + 1, rc,
-                    "KRepositoryMgrCurrentProtectedRepository", NULL, NULL);
-            }
-        }
-    }
-    if (rc == 0) {
-        char buffer[256];
-        size_t name_size = 0;
-        reportOpen(indent, root, 1, "found", 's', "true");
-        open = true;
-        rc = KRepositoryName(protectd, buffer, sizeof buffer, &name_size);
-        if (rc != 0) {
-            reportErrorStr(indent + 1, rc, "KRepositoryName",
-                "origin", "KRepositoryMgrCurrentProtectedRepository");
-        }
-        else {
-            reportData(indent + 1, "name", buffer, 0);
-        }
-    }
-    RELEASE(KRepository, protectd);
-    RELEASE(KRepositoryMgr, mgr);
-    if (open) {
-        reportClose(indent, root);
-    }
-    return rc;
-}
-
-rc_t ReportKfg ( const ReportFuncs *f, uint32_t indent )
-{
-    rc_t rc = 0;
-
-    KConfig* cfg = NULL;
-
-    const char tag[] = "Configuration";
-    reportOpen(indent, tag, 0);
-
-    rc = KConfigMake(&cfg, NULL);
-    if (rc != 0) {
-        reportError(indent + 1, rc, "KConfigMake");
-    }
-    else {
-        {
-            rc_t rc2 = ReportKfgFiles(f, indent + 1, cfg);
-            if (rc == 0 && rc2 != 0)
-            {   rc = rc2; }
-        }
-        {
-            rc_t rc2 = ReportRefseq(f, indent + 1, cfg);
-            if (rc == 0 && rc2 != 0)
-            {   rc = rc2; }
-        }
-        {
-            rc_t rc2 = ReportKrypto(f, indent + 1, cfg);
-            if (rc == 0 && rc2 != 0)
-            {   rc = rc2; }
-        }
-        {
-            rc_t rc2 = ReportSra(f, indent + 1, cfg);
-            if (rc == 0 && rc2 != 0)
-            {   rc = rc2; }
-        }
-        {
-            rc_t rc2 = KConfigPrint(cfg, indent);
-            if (rc == 0 && rc2 != 0)
-            {   rc = rc2; }
-        }
-        {
-            rc_t rc2 = ReportCrntRepository(f, indent + 1, cfg);
-            if (rc == 0 && rc2 != 0)
-            {   rc = rc2; }
-        }
-    }
-
-    reportClose(indent, tag);
-
-    RELEASE(KConfig, cfg);
-
-    return rc;
-}
diff --git a/libs/kfg/repository.c b/libs/kfg/repository.c
deleted file mode 100644
index cc2fedf..0000000
--- a/libs/kfg/repository.c
+++ /dev/null
@@ -1,1190 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <kfg/extern.h>
-
-#include <kfg/repository.h>
-#include <kfg/config.h>
-#include <kfs/file.h>
-#include <kfs/directory.h>
-#include <kfs/impl.h>
-#include <klib/refcount.h>
-#include <klib/text.h>
-#include <klib/printf.h>
-#include <klib/vector.h>
-#include <klib/namelist.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-/*--------------------------------------------------------------------------
- * KRepository
- *  presents structured access to a storage repository
- *  as modeled in KConfig.
- *
- *  all objects are obtained via KRepositoryMgr ( see below )
- */
-struct KRepository
-{
-    const KConfigNode *node;
-    String name;
-    KRefcount refcount;
-    KRepCategory category;
-    KRepSubCategory subcategory;
-};
-
-
-/* Whack
- */
-static
-rc_t KRepositoryWhack ( KRepository *self )
-{
-    KConfigNodeRelease ( self -> node );
-    free ( self );
-    return 0;
-}
-
-/* Sort
- */
-static
-int CC KRepositorySort ( const void **a, const void **b, void *ignore )
-{
-    const KRepository *left = * a;
-    const KRepository *right = * b;
-
-    if ( left -> category < right -> category )
-        return -1;
-    if ( left -> category > right -> category )
-        return 1;
-    if ( left -> subcategory < right -> subcategory )
-        return -1;
-    if ( left -> subcategory > right -> subcategory )
-        return 1;
-    return StringCompare ( & left -> name, & right -> name );
-}
-
-/* Make
- */
-static
-rc_t KRepositoryMake ( KRepository **rp, const KConfigNode *node,
-    const char *name, KRepCategory category, KRepSubCategory subcategory )
-{
-    rc_t rc;
-    KRepository *r;
-    String name_str;
-
-    /* measure string */
-    StringInitCString ( & name_str, name );
-
-    /* create object */
-    r = malloc ( sizeof * r + name_str . size + 1 );
-    if ( r == NULL )
-        return RC ( rcKFG, rcNode, rcConstructing, rcMemory, rcExhausted );
-
-    rc = KConfigNodeAddRef ( node );
-    if ( rc != 0 )
-    {
-        free ( r );
-        return rc;
-    }
-
-    r -> node = node;
-    r -> name = name_str;
-    r -> name . addr = ( char* ) ( r + 1 );
-    KRefcountInit ( & r -> refcount, 1, "KRepository", "make", name );
-    r -> category = category;
-    r -> subcategory = subcategory;
-    memcpy ( r + 1, name, name_str . size );
-    ( ( char* ) ( r + 1 ) ) [ name_str . size ] = 0;
-
-    * rp = r;
-
-    return 0;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KRepositoryAddRef ( const KRepository *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KRepository" ) )
-        {
-        case krefLimit:
-            return RC ( rcKFG, rcNode, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KRepositoryRelease ( const KRepository *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KRepository" ) )
-        {
-        case krefWhack:
-            return KRepositoryWhack ( ( KRepository* ) self );
-        case krefNegative:
-            return RC ( rcKFG, rcNode, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/* WhackEntry
- *  for cleaning up these vectors
- */
-static
-void CC KRepositoryWhackEntry ( void *item, void *ignore )
-{
-    KRepository *self = item;
-    KRepositoryRelease ( self );
-}
-
-
-/* Category
- * SubCategory
- *  tells what the repository category or sub-category are
- *  or returns "bad" if the repository object is not usable.
- */
-LIB_EXPORT KRepCategory CC KRepositoryCategory ( const KRepository *self )
-{
-    if ( self != NULL )
-        return self -> category;
-    return krepBadCategory;
-}
-
-LIB_EXPORT KRepSubCategory CC KRepositorySubCategory ( const KRepository *self )
-{
-    if ( self != NULL )
-        return self -> subcategory;
-    return krepBadSubCategory;
-}
-
-
-/* Name
- *  get the repository name
- *  attempts to copy NUL-terminated name into provided buffer
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - name output parameter
- *
- *  "name_size" [ OUT, NULL OKAY ] - returns the name size in
- *  bytes, excluding any NUL termination.
- */
-LIB_EXPORT rc_t CC KRepositoryName ( const KRepository *self,
-    char *buffer, size_t bsize, size_t *name_size )
-{
-    if ( self == NULL )
-        return RC ( rcKFG, rcNode, rcAccessing, rcSelf, rcNull );
-
-    if ( name_size != NULL )
-        * name_size = self -> name . size;
-
-    if ( bsize < self -> name . size )
-        return RC ( rcKFG, rcNode, rcAccessing, rcBuffer, rcInsufficient );
-
-    if ( buffer == NULL )
-        return RC ( rcKFG, rcNode, rcAccessing, rcBuffer, rcNull );
-
-    memcpy ( buffer, self -> name . addr, self -> name . size );
-
-    if ( bsize > self -> name . size )
-        buffer [ self -> name . size ] = 0;
-
-    return 0;
-}
-
-
-/* DisplayName
- *  get the repository display name,
- *  if different from its actual name
- *
- *  attempts to copy NUL-terminated name into provided buffer
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - name output parameter
- *
- *  "name_size" [ OUT, NULL OKAY ] - returns the name size in
- *  bytes, excluding any NUL termination.
- */
-LIB_EXPORT rc_t CC KRepositoryDisplayName ( const KRepository *self,
-    char *buffer, size_t bsize, size_t *name_size )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcKFG, rcNode, rcAccessing, rcSelf, rcNull );
-    else
-    {
-        const KConfigNode *node;
-
-        if ( name_size != NULL )
-            * name_size = 0;
-
-        rc = KConfigNodeOpenNodeRead ( self -> node, & node, "display-name" );
-        if ( rc != 0 )
-            rc = KRepositoryName ( self, buffer, bsize, name_size );
-        else
-        {
-            size_t num_read, remaining;
-            rc = KConfigNodeRead ( node, 0, buffer, bsize, & num_read, & remaining );
-            KConfigNodeRelease ( node );
-
-            if ( rc == 0 )
-            {
-                if ( name_size != NULL )
-                    * name_size = num_read + remaining;
-
-                if ( remaining != 0 )
-                    rc = RC ( rcKFG, rcNode, rcAccessing, rcBuffer, rcInsufficient );
-                else if ( num_read < bsize )
-                    buffer [ num_read ] = 0;
-            }
-        }
-    }
-
-    return rc;
-}
-
-
-/* Root
- *  read the root path as a POSIX path or URL
- *
- *  attempts to copy NUL-terminated path into provided buffer
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - path output parameter
- *
- *  "root_size" [ OUT, NULL OKAY ] - returns the path size in
- *  bytes, excluding any NUL termination.
- */
-LIB_EXPORT rc_t CC KRepositoryRoot ( const KRepository *self,
-    char *buffer, size_t bsize, size_t *root_size )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcKFG, rcNode, rcAccessing, rcSelf, rcNull );
-    else
-    {
-        const KConfigNode *node;
-
-        if ( root_size != NULL )
-            * root_size = 0;
-
-        rc = KConfigNodeOpenNodeRead ( self -> node, & node, "root" );
-        if ( rc == 0 )
-        {
-            size_t num_read, remaining;
-            rc = KConfigNodeRead ( node, 0, buffer, bsize, & num_read, & remaining );
-            KConfigNodeRelease ( node );
-
-            if ( rc == 0 )
-            {
-                if ( root_size != NULL )
-                    * root_size = num_read + remaining;
-
-                if ( remaining != 0 )
-                    rc = RC ( rcKFG, rcNode, rcAccessing, rcBuffer, rcInsufficient );
-                else if ( num_read < bsize )
-                    buffer [ num_read ] = 0;
-            }
-        }
-    }
-
-    return rc;
-}
-
-
-/* Disabled
- *  discover whether the repository is enabled
- */
-LIB_EXPORT bool CC KRepositoryDisabled ( const KRepository *self )
-{
-    if ( self != NULL )
-    {
-        const KConfigNode *node;
-        rc_t rc = KConfigNodeOpenNodeRead ( self -> node, & node, "disabled" );
-        if ( rc == 0 )
-        {
-            bool disabled = false;
-            rc = KConfigNodeReadBool ( node, & disabled );
-            KConfigNodeRelease ( node );
-            if ( rc == 0 )
-                return disabled;
-        }
-    }
-
-    return false;
-}
-
-
-static const char * STR_TRUE  = "true";
-static const char * STR_FALSE = "false";
-
-LIB_EXPORT rc_t CC KRepositorySetDisabled ( const KRepository *self, bool disabled )
-{
-    rc_t rc = RC ( rcKFG, rcNode, rcAccessing, rcSelf, rcNull );
-    if ( self != NULL )
-    {
-        KConfigNode * self_node = ( KConfigNode * )self->node;  /* casting away const-ness */
-        KConfigNode * node;
-        rc = KConfigNodeOpenNodeUpdate ( self_node, &node, "disabled" );
-        if ( rc == 0 )
-        {
-            const char * value = disabled ? STR_TRUE : STR_FALSE;
-            rc = KConfigNodeWrite ( node, value, string_size( value ) );
-            if ( rc == 0 )
-            {
-                KConfig * cfg;
-                rc = KConfigNodeGetMgr( self->node, &cfg );
-                if ( rc == 0 )
-                {
-                    rc = KConfigCommit ( cfg );
-                    KConfigRelease ( cfg );
-                }
-            }
-            KConfigNodeRelease ( node );
-        }
-    }
-    return rc;
-}
-
-
-/* CacheEnabled
- *  discover whether the repository supports caching
- */
-LIB_EXPORT bool CC KRepositoryCacheEnabled ( const KRepository *self )
-{
-    if ( self != NULL )
-    {
-        const KConfigNode *node;
-        rc_t rc = KConfigNodeOpenNodeRead ( self -> node, & node, "cache-enabled" );
-        if ( rc == 0 )
-        {
-            bool enabled = false;
-            rc = KConfigNodeReadBool ( node, & enabled );
-            KConfigNodeRelease ( node );
-            if ( rc == 0 )
-                return enabled;
-        }
-    }
-
-    return false;
-}
-
-
-/* DownloadTicket
- *  return any associated download ticket
- *
- *  attempts to copy NUL-terminated ticket into provided buffer
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - ticket output parameter
- *
- *  "ticket_size" [ OUT, NULL OKAY ] - returns the ticket size in
- *  bytes, excluding any NUL termination.
- */
-LIB_EXPORT rc_t CC KRepositoryDownloadTicket ( const KRepository *self,
-    char *buffer, size_t bsize, size_t *ticket_size )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcKFG, rcNode, rcAccessing, rcSelf, rcNull );
-    else
-    {
-        const KConfigNode *node;
-
-        if ( ticket_size != NULL )
-            * ticket_size = 0;
-
-        rc = KConfigNodeOpenNodeRead ( self -> node, & node, "download-ticket" );
-        if ( rc == 0 )
-        {
-            size_t num_read, remaining;
-            rc = KConfigNodeRead ( node, 0, buffer, bsize, & num_read, & remaining );
-            KConfigNodeRelease ( node );
-
-            if ( rc == 0 )
-            {
-                if ( ticket_size != NULL )
-                    * ticket_size = num_read + remaining;
-
-                if ( remaining != 0 )
-                    rc = RC ( rcKFG, rcNode, rcAccessing, rcBuffer, rcInsufficient );
-                else if ( num_read < bsize )
-                    buffer [ num_read ] = 0;
-            }
-        }
-    }
-
-    return rc;
-}
-
-
-/* EncryptionKey
- *  return any associated encryption key
- *
- *  attempts to copy NUL-terminated key into provided buffer
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - encryption key output parameter
- *
- *  "key_size" [ OUT, NULL OKAY ] - returns the key size in
- *  bytes, excluding any NUL termination.
- */
-LIB_EXPORT rc_t CC KRepositoryEncryptionKey ( const KRepository *self,
-    char *buffer, size_t bsize, size_t *key_size )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcKFG, rcNode, rcAccessing, rcSelf, rcNull );
-    else
-    {
-        const KConfigNode *node;
-
-        if ( key_size != NULL )
-            * key_size = 0;
-
-        rc = KConfigNodeOpenNodeRead ( self -> node, & node, "encryption-key" );
-        if ( rc == 0 )
-        {
-            size_t num_read, remaining;
-            rc = KConfigNodeRead ( node, 0, buffer, bsize, & num_read, & remaining );
-            KConfigNodeRelease ( node );
-
-            if ( rc == 0 )
-            {
-                if ( key_size != NULL )
-                    * key_size = num_read + remaining;
-
-                if ( remaining != 0 )
-                    rc = RC ( rcKFG, rcNode, rcAccessing, rcBuffer, rcInsufficient );
-                else if ( num_read < bsize )
-                    memset ( & buffer [ num_read ], 0, bsize - num_read );
-            }
-        }
-        else if ( GetRCState ( rc ) == rcNotFound )
-        {
-            char path [ 4096 ];
-            rc_t rc2 = KRepositoryEncryptionKeyFile ( self, path, sizeof path, NULL );
-            if ( rc2 == 0 )
-            {
-                KDirectory *wd;
-                rc2 = KDirectoryNativeDir ( & wd );
-                if ( rc2 == 0 )
-                {
-                    const KFile *keyFile;
-                    rc2 = KDirectoryOpenFileRead ( wd, & keyFile, path );
-                    KDirectoryRelease ( wd );
-                    if ( rc2 == 0 )
-                    {
-                        size_t num_read;
-                        rc = KFileReadAll ( keyFile, 0, buffer, bsize, & num_read );
-                        if ( rc == 0 )
-                        {
-                            if ( num_read == bsize )
-                            {
-                                uint64_t eof;
-                                rc = KFileSize ( keyFile, & eof );
-                                if ( rc == 0 )
-                                    num_read = ( size_t ) eof;
-                                else
-                                    num_read = 0;
-
-                                rc = RC ( rcKFG, rcFile, rcReading, rcBuffer, rcInsufficient );
-                                memset ( buffer, 0, bsize );
-                            }
-                            else if ( num_read == 0 )
-                            {
-                                rc = RC ( rcKFG, rcFile, rcReading, rcFile, rcEmpty );
-                                memset ( buffer, 0, bsize );
-                            }
-                            else
-                            {
-                                char *eoln = string_chr ( buffer, num_read, '\n' );
-                                if ( eoln != NULL )
-                                {
-                                    if ( eoln == buffer )
-                                        num_read = 0;
-                                    else if ( eoln [ -1 ] == '\r' )
-                                        num_read = eoln - buffer - 1;
-                                    else
-                                        num_read = eoln - buffer;
-                                }
-
-                                if ( key_size != NULL )
-                                    * key_size = num_read;
-
-                                memset ( & buffer [ num_read ], 0, bsize - num_read );
-                            }
-                        }
-
-                        KFileRelease ( keyFile );
-                    }
-                }
-            }
-        }
-    }
-
-    return rc;
-}
-
-
-/* EncryptionKeyFile
- *  return path to any associated encryption key file
- *
- *  attempts to copy NUL-terminated path into provided buffer
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - key file path output parameter
- *
- *  "path_size" [ OUT, NULL OKAY ] - returns the path size in
- *  bytes, excluding any NUL termination.
- */
-LIB_EXPORT rc_t CC KRepositoryEncryptionKeyFile ( const KRepository *self,
-    char *buffer, size_t bsize, size_t *path_size )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcKFG, rcNode, rcAccessing, rcSelf, rcNull );
-    else
-    {
-        const KConfigNode *node;
-
-        if ( path_size != NULL )
-            * path_size = 0;
-
-        rc = KConfigNodeOpenNodeRead ( self -> node, & node, "encryption-key-path" );
-        if ( rc == 0 )
-        {
-            size_t num_read, remaining;
-            rc = KConfigNodeRead ( node, 0, buffer, bsize, & num_read, & remaining );
-            KConfigNodeRelease ( node );
-
-            if ( rc == 0 )
-            {
-                if ( path_size != NULL )
-                    * path_size = num_read + remaining;
-
-                if ( remaining != 0 )
-                    rc = RC ( rcKFG, rcNode, rcAccessing, rcBuffer, rcInsufficient );
-                else if ( num_read < bsize )
-                    buffer [ num_read ] = 0;
-            }
-        }
-    }
-
-    return rc;
-}
-
-
-/* Description
- *  return any associated descriptive text
- *
- *  attempts to copy NUL-terminated description into provided buffer
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - description text output parameter
- *
- *  "desc_size" [ OUT, NULL OKAY ] - returns the text size in
- *  bytes, excluding any NUL termination.
- */
-LIB_EXPORT rc_t CC KRepositoryDescription ( const KRepository *self,
-    char *buffer, size_t bsize, size_t *desc_size )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcKFG, rcNode, rcAccessing, rcSelf, rcNull );
-    else
-    {
-        const KConfigNode *node;
-
-        if ( desc_size != NULL )
-            * desc_size = 0;
-
-        rc = KConfigNodeOpenNodeRead ( self -> node, & node, "description" );
-        if ( rc == 0 )
-        {
-            size_t num_read, remaining;
-            rc = KConfigNodeRead ( node, 0, buffer, bsize, & num_read, & remaining );
-            KConfigNodeRelease ( node );
-
-            if ( rc == 0 )
-            {
-                if ( desc_size != NULL )
-                    * desc_size = num_read + remaining;
-
-                if ( remaining != 0 )
-                    rc = RC ( rcKFG, rcNode, rcAccessing, rcBuffer, rcInsufficient );
-                else if ( num_read < bsize )
-                    buffer [ num_read ] = 0;
-            }
-        }
-    }
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * KRepositoryVector
- *  uses Vector API
- *  holds zero or more KRepository objects
- */
-
-
-/* Whack
- *  destroy your vector
- */
-LIB_EXPORT rc_t CC KRepositoryVectorWhack ( KRepositoryVector *self )
-{
-    if ( self == NULL )
-        return RC ( rcKFG, rcVector, rcDestroying, rcSelf, rcNull );
-
-    VectorWhack ( self, KRepositoryWhackEntry, NULL );
-    return 0;
-}
-
-
-/*--------------------------------------------------------------------------
- * KRepositoryMgr
- *  manages structured access to repositories
- */
-struct KRepositoryMgr
-{
-    const KConfig *ro_cfg;
-    KConfig *rw_cfg;
-    KRefcount refcount;
-};
-
-
-/* Whack
- */
-static
-rc_t KRepositoryMgrWhack ( KRepositoryMgr *self )
-{
-    if ( self -> ro_cfg )
-        KConfigRelease ( self -> ro_cfg );
-    if ( self -> rw_cfg )
-        KConfigRelease ( self -> rw_cfg );
-    free ( self );
-    return 0;
-}
-
-
-/* Make
- *  create a repository manager
- *  uses values from "self"
- */
-LIB_EXPORT rc_t CC KConfigMakeRepositoryMgrRead ( const KConfig *self, const KRepositoryMgr **mgrp )
-{
-    rc_t rc;
-
-    if ( mgrp == NULL )
-        rc = RC ( rcKFG, rcMgr, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcKFG, rcMgr, rcConstructing, rcSelf, rcNull );
-        else
-        {
-            KRepositoryMgr *mgr = calloc ( 1, sizeof * mgr );
-            if ( mgr == NULL )
-                rc = RC ( rcKFG, rcMgr, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                rc = KConfigAddRef ( self );
-                if ( rc == 0 )
-                {
-                    mgr -> ro_cfg = self;
-                    KRefcountInit ( & mgr -> refcount, 1, "KRepositoryMgr", "make-read", "mgr" );
-                    * mgrp = mgr;
-                    return 0;
-                }
-
-                free ( mgr );
-            }
-        }
-
-        * mgrp = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KConfigMakeRepositoryMgrUpdate ( KConfig *self, KRepositoryMgr **mgrp )
-{
-    rc_t rc;
-
-    if ( mgrp == NULL )
-        rc = RC ( rcKFG, rcMgr, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcKFG, rcMgr, rcConstructing, rcSelf, rcNull );
-        else
-        {
-            KRepositoryMgr *mgr = calloc ( 1, sizeof * mgr );
-            if ( mgr == NULL )
-                rc = RC ( rcKFG, rcMgr, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                rc = KConfigAddRef ( self );
-                if ( rc == 0 )
-                {
-                    mgr -> rw_cfg = self;
-                    KRefcountInit ( & mgr -> refcount, 1, "KRepositoryMgr", "make-update", "mgr" );
-                    * mgrp = mgr;
-                    return 0;
-                }
-
-                free ( mgr );
-            }
-        }
-
-        * mgrp = NULL;
-    }
-
-    return rc;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KRepositoryMgrAddRef ( const KRepositoryMgr *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KRepositoryMgr" ) )
-        {
-        case krefLimit:
-            return RC ( rcKFG, rcMgr, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KRepositoryMgrRelease ( const KRepositoryMgr *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KRepositoryMgr" ) )
-        {
-        case krefWhack:
-            return KRepositoryMgrWhack ( ( KRepositoryMgr* ) self );
-        case krefNegative:
-            return RC ( rcKFG, rcMgr, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-static
-const KConfig *KRepositoryMgrGetROKConfig ( const KRepositoryMgr *self )
-{
-    return self -> ro_cfg ? self -> ro_cfg : self -> rw_cfg;
-}
-
-static
-rc_t KRepositoryMgrSubCategoryRepositories ( const KConfigNode *sub,
-    KRepCategory category, KRepSubCategory subcategory, KRepositoryVector *repositories )
-{
-    KNamelist *repo_names;
-    rc_t rc = KConfigNodeListChildren ( sub, & repo_names );
-    if ( rc == 0 )
-    {
-        uint32_t i, count;
-        rc = KNamelistCount ( repo_names, & count );
-        for ( i = 0; i < count && rc == 0; ++ i )
-        {
-            const char *repo_name;
-            rc = KNamelistGet ( repo_names, i, & repo_name );
-            if ( rc == 0 )
-            {
-                const KConfigNode *node;
-                rc = KConfigNodeOpenNodeRead ( sub, & node, repo_name );
-                if ( rc == 0 )
-                {
-                    KRepository *repo;
-                    rc = KRepositoryMake ( & repo, node, repo_name, category, subcategory );
-                    if ( rc == 0 )
-                    {
-                        rc = VectorAppend ( repositories, NULL, repo );
-                        if ( rc != 0 )
-                            KRepositoryWhack ( repo );
-                    }
-
-                    KConfigNodeRelease ( node );
-                }
-            }
-        }
-
-        KNamelistRelease ( repo_names );
-    }
-
-    return rc;
-}
-
-static
-rc_t KRepositoryMgrCategoryRepositories ( const KConfigNode *cat,
-    KRepCategory category, KRepositoryVector *repositories )
-{
-    KNamelist *sub_names;
-    rc_t rc = KConfigNodeListChildren ( cat, & sub_names );
-    if ( rc == 0 )
-    {
-        uint32_t i, count;
-        rc = KNamelistCount ( sub_names, & count );
-        for ( i = 0; i < count && rc == 0; ++ i )
-        {
-            const char *sub_name;
-            rc = KNamelistGet ( sub_names, i, & sub_name );
-            if ( rc == 0 )
-            {
-                KRepSubCategory subcategory = krepBadSubCategory;
-                if ( strcmp ( "main", sub_name ) == 0 )
-                    subcategory = krepMainSubCategory;
-                else if ( strcmp ( "aux", sub_name ) == 0 )
-                    subcategory = krepAuxSubCategory;
-                else if ( strcmp ( "protected", sub_name ) == 0 )
-                    subcategory = krepProtectedSubCategory;
-
-                if ( subcategory != krepBadSubCategory )
-                {
-                    const KConfigNode *sub;
-                    rc = KConfigNodeOpenNodeRead ( cat, & sub, sub_name );
-                    if ( rc == 0 )
-                    {
-                        rc = KRepositoryMgrSubCategoryRepositories ( sub, category, subcategory, repositories );
-                        KConfigNodeRelease ( sub );
-                    }
-                }
-            }
-        }
-
-        KNamelistRelease ( sub_names );
-    }
-
-    return rc;
-}
-
-
-/* UserRepositories
- *  retrieve all user repositories in a Vector
- */
-LIB_EXPORT rc_t CC KRepositoryMgrUserRepositories ( const KRepositoryMgr *self,
-    KRepositoryVector *user_repositories )
-{
-    rc_t rc;
-
-    if ( user_repositories == NULL )
-        rc = RC ( rcKFG, rcMgr, rcAccessing, rcParam, rcNull );
-    else
-    {
-        VectorInit ( user_repositories, 0, 8 );
-
-        if ( self == NULL )
-            rc = RC ( rcKFG, rcMgr, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            const KConfig *kfg = KRepositoryMgrGetROKConfig ( self );
-
-            const KConfigNode *user;
-            rc = KConfigOpenNodeRead ( kfg, & user, "/repository/user" );
-            if ( rc == 0 )
-            {
-                rc = KRepositoryMgrCategoryRepositories ( user, krepUserCategory, user_repositories );
-                KConfigNodeRelease ( user );
-                if ( rc == 0 )
-                    VectorReorder ( user_repositories, KRepositorySort, NULL );
-            }
-
-            if ( rc != 0 )
-                KRepositoryVectorWhack ( user_repositories );
-        }
-    }
-
-    return rc;
-}
-
-
-/* SiteRepositories
- *  retrieve all site repositories in a Vector
- */
-LIB_EXPORT rc_t CC KRepositoryMgrSiteRepositories ( const KRepositoryMgr *self,
-    KRepositoryVector *site_repositories )
-{
-    rc_t rc;
-
-    if ( site_repositories == NULL )
-        rc = RC ( rcKFG, rcMgr, rcAccessing, rcParam, rcNull );
-    else
-    {
-        VectorInit ( site_repositories, 0, 8 );
-
-        if ( self == NULL )
-            rc = RC ( rcKFG, rcMgr, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            const KConfig *kfg = KRepositoryMgrGetROKConfig ( self );
-
-            const KConfigNode *site;
-            rc = KConfigOpenNodeRead ( kfg, & site, "/repository/site" );
-            if ( rc == 0 )
-            {
-                rc = KRepositoryMgrCategoryRepositories ( site, krepSiteCategory, site_repositories );
-                KConfigNodeRelease ( site );
-                if ( rc == 0 )
-                    VectorReorder ( site_repositories, KRepositorySort, NULL );
-            }
-
-            if ( rc != 0 )
-                KRepositoryVectorWhack ( site_repositories );
-        }
-    }
-
-    return rc;
-}
-
-
-/* RemoteRepositories
- *  retrieve all remote repositories in a Vector
- */
-LIB_EXPORT rc_t CC KRepositoryMgrRemoteRepositories ( const KRepositoryMgr *self,
-    KRepositoryVector *remote_repositories )
-{
-    rc_t rc;
-
-    if ( remote_repositories == NULL )
-        rc = RC ( rcKFG, rcMgr, rcAccessing, rcParam, rcNull );
-    else
-    {
-        VectorInit ( remote_repositories, 0, 8 );
-
-        if ( self == NULL )
-            rc = RC ( rcKFG, rcMgr, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            const KConfig *kfg = KRepositoryMgrGetROKConfig ( self );
-
-            const KConfigNode *remote;
-            rc = KConfigOpenNodeRead ( kfg, & remote, "/repository/remote" );
-            if ( rc == 0 )
-            {
-                rc = KRepositoryMgrCategoryRepositories ( remote, krepRemoteCategory, remote_repositories );
-                KConfigNodeRelease ( remote );
-                if ( rc == 0 )
-                    VectorReorder ( remote_repositories, KRepositorySort, NULL );
-            }
-
-            if ( rc != 0 )
-                KRepositoryVectorWhack ( remote_repositories );
-        }
-    }
-
-    return rc;
-}
-
-
-/* CurrentProtectedRepository
- *  returns the currently active user protected repository
- */
-LIB_EXPORT rc_t CC KRepositoryMgrCurrentProtectedRepository ( const KRepositoryMgr *self, const KRepository **protected )
-{
-    rc_t rc;
-
-    if ( protected == NULL )
-        rc = RC ( rcKFG, rcMgr, rcAccessing, rcParam, rcNull );
-    else
-    {
-        * protected = NULL;
-
-        if ( self == NULL )
-            rc = RC ( rcKFG, rcMgr, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            KRepositoryVector v;
-            rc = KRepositoryMgrUserRepositories ( self, & v );
-            if ( rc == 0 )
-            {
-                KDirectory *wd;
-                rc = KDirectoryNativeDir ( & wd );
-                if ( rc == 0 )
-                {
-                    /* we need services of system directory */
-                    struct KSysDir *sysDir = KDirectoryGetSysDir ( wd );
-
-                    /* allocate buffer space for 3 paths */
-                    const size_t path_size = 4096;
-                    char *wd_path = malloc ( path_size * 3 );
-                    if ( wd_path == NULL )
-                        rc = RC ( rcKFG, rcMgr, rcAccessing, rcMemory, rcExhausted );
-                    else
-                    {
-                        /* the working directory already has a canonical path */
-                        rc = KDirectoryResolvePath ( wd, true, wd_path, path_size, "." );
-                        if ( rc == 0 )
-                        {
-                            size_t wd_size = string_size ( wd_path );
-
-                            /* look for all protected user repositories */
-                            uint32_t i, count = VectorLength ( & v );
-                            for ( i = 0; i < count; ++ i )
-                            {
-                                const KRepository *r = ( const void* ) VectorGet ( & v, i );
-                                if ( r -> subcategory == krepProtectedSubCategory )
-                                {
-                                    rc_t rc2 = 0;
-                                    size_t resolved_size;
-                                    char *resolved = wd_path + path_size;
-
-                                    /* get stated root path to repository */
-                                    char *root = resolved + path_size;
-                                    rc2 = KRepositoryRoot ( r,
-                                        root, path_size, NULL );
-                                    if ( rc2 != 0 ) {
-                                        /* VDB-1096:
-                                        We cannot get repository root:
-                                        is it a bad repository configuration?
-                                        Then ignore this repository node
-                                        and try another repository */
-                                        continue;
-                                    }
-
-                                    /* get its canonical path */
-                                    rc2 = KSysDirRealPath ( sysDir,
-                                        resolved, path_size, root );
-                                    if ( rc2 != 0 ) {
-                                        /* VDB-1096:
-                      Invalid cannot get repository root? Ignore and continue */
-                                        continue;
-                                    }
-
-                                    /* we know the current directory's canonical path size
-                                       and we know the repository's canonical path size.
-                                       to be "within" the repository, the current directory's
-                                       size must be >= repository path size, and must match
-                                       exactly the repository path itself over those bytes. */
-                                    resolved_size = string_size ( resolved );
-                                    if ( resolved_size <= wd_size && memcmp ( wd_path, resolved, resolved_size ) == 0 )
-                                    {
-                                        /* still have a little more to check */
-                                        if ( resolved_size == wd_size ||
-                                             wd_path [ resolved_size ] == '/' )
-                                        {
-                                            /* we are in the repository */
-                                            rc = KRepositoryAddRef ( r );
-                                            if ( rc == 0 )
-                                                * protected = r;
-                                            break;
-                                        }
-                                    }
-                                }
-                            }
-                        }
-
-                        free ( wd_path );
-                    }
-
-                    KDirectoryRelease ( wd );
-                }
-
-                KRepositoryVectorWhack ( & v );
-            }
-
-            if ( rc == 0 && * protected == NULL )
-                rc = RC ( rcKFG, rcMgr, rcAccessing, rcNode, rcNotFound );
-        }
-    }
-
-    return rc;
-}
-
-/* GetProtectedRepository
- *  retrieves a user protected repository by its associated project-id
- */
-KFG_EXTERN rc_t CC KRepositoryMgrGetProtectedRepository ( const KRepositoryMgr *self, 
-    uint32_t projectId, 
-    const KRepository **protected )
-{
-    rc_t rc;
-
-    if ( protected == NULL )
-        rc = RC ( rcKFG, rcMgr, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcKFG, rcMgr, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            char repNodeName[512] = "";
-            size_t numWrit = 0;
-            KRepositoryVector v;
-            rc = string_printf(repNodeName, sizeof repNodeName, &numWrit, "dbgap-%u", projectId); /* go case-insensitive */
-            assert(numWrit < sizeof(repNodeName));
-            
-            rc = KRepositoryMgrUserRepositories ( self, & v );
-            if ( rc == 0 )
-            {  /* look for all protected user repositories */
-                uint32_t i, count = VectorLength ( & v );
-                for ( i = 0; i < count; ++ i )
-                {
-                    const KRepository *r = ( const void* ) VectorGet ( & v, i );
-                    if ( r -> subcategory == krepProtectedSubCategory )
-                    {
-                        char localName[512] = "";
-                        size_t localNumWrit = 0;
-                        KRepositoryName(r, localName, sizeof(localName), &localNumWrit);
-                        assert(localNumWrit < sizeof(localName));
-                        if (strcase_cmp(repNodeName, numWrit, localName, localNumWrit, sizeof(localName)) == 0)
-                        {
-                            rc = KRepositoryAddRef ( r );
-                            if ( rc == 0 )
-                            {
-                                * protected = r;
-                                KRepositoryVectorWhack(&v);
-                                return 0;
-                            }
-                        }
-                    }
-                }
-                KRepositoryVectorWhack(&v);
-                rc = RC ( rcKFG, rcMgr, rcAccessing, rcNode, rcNotFound );
-            }
-        }
-    }
-
-    return rc;
-}    
diff --git a/libs/kfs/Makefile b/libs/kfs/Makefile
deleted file mode 100644
index a50a95b..0000000
--- a/libs/kfs/Makefile
+++ /dev/null
@@ -1,179 +0,0 @@
-# ===========================================================================
-#
-#                            PUBLIC DOMAIN NOTICE
-#               National Center for Biotechnology Information
-#
-#  This software/database is a "United States Government Work" under the
-#  terms of the United States Copyright Act.  It was written as part of
-#  the author's official duties as a United States Government employee and
-#  thus cannot be copyrighted.  This software/database is freely available
-#  to the public for use. The National Library of Medicine and the U.S.
-#  Government have not placed any restriction on its use or reproduction.
-#
-#  Although all reasonable efforts have been taken to ensure the accuracy
-#  and reliability of the software and data, the NLM and the U.S.
-#  Government do not and cannot warrant the performance or results that
-#  may be obtained by using this software or data. The NLM and the U.S.
-#  Government disclaim all warranties, express or implied, including
-#  warranties of performance, merchantability or fitness for any particular
-#  purpose.
-#
-#  Please cite the author in any work or product based on this material.
-#
-# ===========================================================================
-
-default: all
-
-TOP ?= $(shell ../../build/abspath.sh ../..)
-MODULE = libs/kfs
-
-INT_LIBS = \
-	libkfs \
-	libkfs-nommap
-
-ALL_LIBS = \
-	$(INT_LIBS)
-
-include $(TOP)/build/Makefile.env
-
-#-------------------------------------------------------------------------------
-# outer targets
-#
-all std: makedirs
-	@ $(MAKE_CMD) $(TARGDIR)/std
-
-$(INT_LIBS): makedirs
-	@ $(MAKE_CMD) $(ILIBDIR)/$@
-
-.PHONY: all std $(ALL_LIBS)
-
-#-------------------------------------------------------------------------------
-# std
-#
-$(TARGDIR)/std: \
-	$(addprefix $(ILIBDIR)/,$(INT_LIBS))
-
-.PHONY: $(TARGDIR)/std
-
-#-------------------------------------------------------------------------------
-# clean
-#
-clean: stdclean
-
-.PHONY: clean
-
-#-------------------------------------------------------------------------------
-# mmap.c
-#  special rule to generate a disabled mmap
-#
-%.nommap.$(LOBX): %.c
-	$(CC) -o $@ -fPIC $(OPT) -DFORCE_MALLOC_MMAP -D_LIBRARY $<
-
-
-#-------------------------------------------------------------------------------
-# kfs
-#
-$(ILIBDIR)/libkfs: $(addprefix $(ILIBDIR)/libkfs.,$(ILIBEXT))
-
-$(ILIBDIR)/libkfs-nommap: $(addprefix $(ILIBDIR)/libkfs-nommap.,$(LIBX))
-
-KFS_CMN = \
-	directory \
-	arrayfile \
-	file \
-	sysdir \
-	sysfile \
-	sysmmap \
-	syslockfile \
-	sysdll \
-	gzip \
-	bzip \
-	md5 \
-	crc32 \
-	arc \
-	toc \
-	tocentry \
-	tocdir \
-	tocfile \
-	sra \
-	tar \
-	teefile \
-	buffile \
-	buffile-read \
-	buffile-write \
-	subfile \
-	nullfile \
-	countfile \
-	dir_test \
-	pagefile \
-	pmem \
-	readheadfile \
-	ramfile \
-	quickmount \
-	report \
-	lockfile \
-	syslockfile \
-	cacheteefile \
-	from_to_namelist \
-
-KFS_SRC = \
-	mmap \
-	$(KFS_CMN)
-
-ifeq (win,$(OS))
-	KFS_SRC += directory-path
-endif
-
-KFS_NOMMAP_SRC = \
-	mmap.nommap \
-	$(KFS_CMN)
-
-KFS_OBJ = \
-	$(addsuffix .$(LOBX),$(KFS_SRC))
-
-KFS_NOMMAP_OBJ = \
-	$(addsuffix .$(LOBX),$(KFS_NOMMAP_SRC))
-
-KFS_LIB = \
-	-dkproc \
-	-dklib \
-	-ddl \
-	-dz \
-	-dbz2
-
-$(ILIBDIR)/libkfs.$(LIBX): $(KFS_OBJ)
-	$(LD) --slib -o $@ $^ $(KFS_LIB)
-
-$(ILIBDIR)/libkfs-nommap.$(LIBX): $(KFS_NOMMAP_OBJ)
-	$(LD) --slib -o $@ $^ $(KFS_LIB)
-
-
-#-------------------------------------------------------------------------------
-# kff
-#
-ifeq (linux,$(OS))
-$(ILIBDIR)/libkff: $(addprefix $(ILIBDIR)/libkff.,$(ILIBEXT))
-else
-$(ILIBDIR)/libkff:
-	@ echo "not building libkff on "$(OS)
-endif
-
-KFF_SRC = \
-	fileformat \
-	ffext \
-	ffkey \
-	ffmagic
-
-KFF_OBJ = \
-	$(addsuffix .$(LOBX),$(KFF_SRC))
-
-KFF_LIB = \
-	-dkfg \
-	-dklib
-
-ifneq (win,$(OS))
-	KFF_LIB += -lmagic
-endif
-
-$(ILIBDIR)/libkff.$(LIBX): $(KFF_OBJ)
-	$(LD) --slib -o $@ $^ $(KFF_LIB)
diff --git a/libs/kfs/arc.c b/libs/kfs/arc.c
deleted file mode 100644
index 1779673..0000000
--- a/libs/kfs/arc.c
+++ /dev/null
@@ -1,4019 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-#include <kfs/extern.h>
-#include "karc-priv.h"
-#include "toc-priv.h"
-
-#include <kfs/arc.h>
-
-#include <klib/debug.h>
-#include <klib/log.h>
-#include <klib/status.h>
-#include <klib/out.h>
-#include <klib/rc.h>
-#include <klib/container.h>
-#include <klib/vector.h>
-#include <klib/pbstree.h>
-#include <klib/text.h>
-#include <klib/sort.h>
-#include <klib/printf.h>
-#include <klib/klib-priv.h> /* ReportRecordZombieFile */
-
-#include <kfs/directory.h>
-#include <kfs/file.h>
-#include <kfs/toc.h>
-#include <kfs/sra.h>
-
-#include <sysalloc.h>
-
-#include <atomic32.h>
-#include <os-native.h>
-
-#include <assert.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-/* SHOULD NOT INCLUDE THESE DIRECTLY */
-#include <fcntl.h>
-#include <sys/stat.h>
-
-const char * get_mode_string (KCreateMode mode);
-/* defined in dir_test.c */
-
-extern const char *gRCModule_str[];
-extern const char *gRCTarget_str[];
-extern const char *gRCContext_str[];
-extern const char *gRCObject_str[];
-extern const char *gRCState_str[];
-#define _LOG_RC(level,rc)	PLOGMSG(( level,			\
-					  "Return Code:: $(M):$(T):$(C):$(O):$(S)", \
-					  PLOG_5(PLOG_U32(M),PLOG_U32(T),PLOG_U32(C),PLOG_U32(O),PLOG_U32(S)), \
-					  GetRCModule(rc),		\
-					  GetRCTarget(rc),		\
-					  GetRCContext(rc),		\
-					  GetRCObject(rc),		\
-					  GetRCState(rc)))
-#define LOG_RC(level,rc)	PLOGMSG(( level,			\
-					  "Return Code:: $(M):$(T):$(C):$(O):$(S)", \
-					  PLOG_5(PLOG_S(M),PLOG_S(T),PLOG_S(C),PLOG_S(O),PLOG_S(S)), \
-					  gRCModule_str[GetRCModule(rc)], \
-					  gRCTarget_str[GetRCTarget(rc)], \
-					  gRCContext_str[GetRCContext(rc)], \
-					  (GetRCObject(rc)<rcLastTarget_v1_0)? \
-					  gRCTarget_str[GetRCObject(rc)]: \
-					  gRCObject_str[1+GetRCObject(rc)-rcLastTarget_v1_0], \
-					  gRCState_str[GetRCState(rc)]))
-/* #define LOG_RC(level,rc)	\ */
-/*     PLOGMSG(( level, "m $(R)",PLOG_S(R),gRCModule_str[GetRCModule(rc)])),	\ */
-/* 	PLOGMSG(( level, "t $(R)",PLOG_S(R),gRCTarget_str[GetRCTarget(rc)])), \ */
-/* 	PLOGMSG(( level, "c $(R)",PLOG_S(R),gRCContext_str[GetRCContext(rc)])), \ */
-/* 	PLOGMSG(( level, "o $(R)",PLOG_S(R),(GetRCObject(rc)<rcLastTarget_v1_0)? \ */
-/* 		  gRCTarget_str[GetRCObject(rc)]:			\ */
-/* 		  gRCObject_str[1+GetRCObject(rc)-rcLastTarget_v1_0])), \ */
-/* 	PLOGMSG(( level, "s $(R)",PLOG_S(R),gRCState_str[GetRCState(rc)])) */
-
-
-#ifdef _DEBUGGING
-#define FUNC_ENTRY() DBGMSG (DBG_KFS, DBG_FLAG(DBG_KFS_ARCENTRY), ("Enter: %s\n", __func__))
-#define KFF_DEBUG(msg) DBGMSG (DBG_KFS, DBG_FLAG(DBG_KFS_ARC), msg)
-#else
-#define FUNC_ENTRY()
-#define KFF_DEBUG(msg)
-#endif
-
-
-/* ----------------------------------------------------------------------
- * 
- */
-
-/* -----
- * define the specific types to be used in the templatish/inheritancish
- * definition of vtables and their elements
- */
-#define KDIR_IMPL struct KArcDir
-#define KFILE_IMPL struct KArcFile
-#include <kfs/impl.h>
-
-static rc_t KArcDirResolvePathNode (const KArcDir *self,
-                                    enum RCContext ctx,
-                                    const char *path,
-                                    bool follow_sym_link,
-                                    const KTocEntry ** pnode,
-                                    KTocEntryType * ptype);
-
-
-
-/* ======================================================================
- * Defines relevant to the whole compilation unit.
- */
-/* arbitrary number that was originially set much much higher than expected needs. */
-#define	KARC_LINK_RESOLVE_LOOPMAX		(16)
-
-/* -----
- * We use MAX_PATH if it is available but not religiously.  We handle most
- * buffer over-runs with in the module only truncating paths at the border
- * of the module where KDirectory doesn't handle path's longer than MAX_PATH
- */
-#ifdef MAX_PATH
-#define	KARC_DEFAULT_PATH_ALLOC			(MAX_PATH)
-#else
-#define	KARC_DEFAULT_PATH_ALLOC			(4096)
-#endif
-
-
-
-
-
-/* ======================================================================
- * KArcDirIterator
- *
- * This very simple iterator steps in order through the nodes of the binary
- * search tree that is a "directory" in a KToc and thus steps through the
- * list of elements in a directory.  Only the name is made available at each
- * step.  That worked better for sysdir than arcdir from where this was 
- * borrowed (it was called SysDirEnum there)
- *
- * It is primarily used to build a directory listing.
- *
- * This iterator is a once through iterator.  Whack must be called after Init
- * or a dangling reference is left open.  Init can be called again but only if 
- * Whack was indeed called.
- *
- * NOTE:
- * This class unlike most in the KFS system is built in place and is not
- * constructed by default allocating memory in the constructor.
- * This means it can not be truly opaque as the structure of the base struct
- * has to be exposed so it can be created.
- */
-
-
-/*--------------------------------------------------------------------------
- * KArcDirIterator
- *
- * a ArcDir directory enumerator/iterator getting the names of elements in
- * the TOC.
- *
- * const KToc *	  toc		a keep alive so the BSTree won't go
- *					away in the middle
- * union                  u		A union to allow pointers to base and
- *					derivative class
- *					without casting
- *   const BSTNode * 	  bnp		point to a node as a BSTNode
- *   const KTocEntry *  tnp		point to a node as a KTocEntry
- * bool                   isFirst;	upon creation this flag is set to true;
- *					set to false the first next call
- */
-typedef struct KArcDirIterator 	
-{
-    const KToc *		toc;	/* a keep alive so the BSTree won't go away in the middle */
-    union
-    {
-	const BSTNode * 	bnp;	/* point to a node as a BSTNode */
-	const KTocEntry *	tnp;	/* point to a node as a KTocEntry */
-    }			u;
-    bool isFirst;	/* upon creation this flag is set to true; set to false the first next call */
-} KArcDirIterator;
-
-
-/* ----------------------------------------------------------------------
- * KArcDirIteratorWhack
- * 	The Object destructor
- * [INOUT] KArcDirIterator *self	Iterator self reference: object oriented in C
- */
-static
-void KArcDirIteratorWhack (KArcDirIterator *self)
-{
-    KTocRelease (self->toc);
-}
-
-
-/* ----------------------------------------------------------------------
- * KArcDirIteratorInit
- * 
- * The object constructor
- *
- * [OUT] KArcDirIterator *	self		Iterator self reference: object oriented in C
- * [IN]  const KArcDir * 	arcdir		A directory that contains beneath it (or as it)
- *						the directory to be iterated.
- * [IN]	 const char * 		path		The directory to be iterated as referenced from
- *						arcdir.
- *
- * To iterate arcdir use a path of ".".
- */
-static
-rc_t KArcDirIteratorInit (KArcDirIterator *self, const KArcDir * arcdir, 
-                          const char * path)
-{
-    const BSTree * 	tree;
-    const KTocEntry * node;
-    const KToc *	toc;
-    KTocEntryType	type;
-    rc_t		rc;
-
-    /* is self parameter possibly bad? */
-    if (self == NULL)
-    {
-        return RC (rcFS, rcDirectory, rcConstructing, rcSelf, rcNull);
-    }
-
-    self->toc = NULL;
-    self->isFirst = true;	/* warning squelcher ? that breaks type opacity */
-    self->u.bnp = NULL;
-
-    /* is another parameter possibly bad? */
-    if ((path == NULL)||(arcdir == NULL))
-    {
-	return RC (rcFS, rcDirectory, rcConstructing, rcParam, rcNull);
-    }
-    if (KArcDirGetTOC(arcdir,&toc) != 0)
-    {
-	return RC (rcFS, rcDirectory, rcConstructing, rcParam, rcNotFound);
-    }
-    self->toc = toc;
-    KTocAddRef(toc);
-    /* get the KTocEntry from which all things are possible */
-    rc = KArcDirResolvePathNode (arcdir, rcConstructing, path, true, &node, &type);
-    if (rc != 0)
-    {
-    }
-    else if ((type == ktocentrytype_dir) || (type == ktocentrytype_hardlink))
-    {
-	rc = KTocEntryGetBSTree (node, &tree);
-	if (rc == 0)
-	{
-	    /* success */
-	    self->u.bnp = BSTreeFirst(tree);
-	    return 0;
-	}
-    }
-    else
-    {
-	rc = RC (rcFS, rcDirectory, rcConstructing, rcParam, rcInvalid);
-    }
-    /* failure */
-    KTocRelease (self->toc);
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * KArcDirIteratorNext
- *
- * Go to the next node (or the first node if the iterator has not been used.
- *
- * [RET]   const char * 			The return is the name of the next element
- * [INOUT] KArcDirIterator *	self		Iterator self reference: object oriented in C
- */
-static const char * KArcDirIteratorNext (KArcDirIterator *self)
-{
-    const char * name;
-
-    assert (self != NULL);
-
-    /* -----
-     * The initialization put the first node's address into the pointer
-     * so do do nothing about the pointer before using it except say we
-     * need to update it next time.
-     */
-    if (self->isFirst)
-    {
-	self->isFirst = false;
-    }
-    /* -----
-     * After the first time we need to bump the pointer until it can't be bumped.
-     */
-    else	
-    {
-	/* -----
-	 * It's not specified in klib/container.h but BSTNodeNext
-	 * returns NULL at end of tree
-	 */
-	self->u.bnp = BSTNodeNext (self->u.bnp);
-    }
-
-    /* -----
-     * The first test isn't necesary so letting KTocEntryGetName return NULL
-     * could be used instead of the extra check.
-     * Checking against NULL adds a little to each call while not checking
-     * adds more but only to the last call.
-     * Pick your poison.
-     */
-    if ((self->u.bnp == NULL) || (KTocEntryGetName (self->u.tnp, &name) != 0))
-    {
-	return NULL;
-    }
-    return name;
-}
-
-
-/* ======================================================================
- */
-typedef struct KArcListing KArcListing;
-
-#define KNAMELIST_IMPL struct KArcListing
-#include <klib/impl.h>
-
-/*--------------------------------------------------------------------------
- * KArcListing
- *  a directory listing
- *
- * NOTE:
- * This is nearly identical to KSysDirListing but both are currently private to
- * their compilation units.
- */
-struct KArcListing
-{
-    KNamelist     dad;      /* base class */
-    const char ** namelist; /* pointer to a malloced array of pointers to names */
-    int           cnt;      /* specific size chosen by compiler for efficiency */
-};
-
-
-/* ----------------------------------------------------------------------
- * KArcListingWhack
- *
- * Class destructor
- *
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [INOUT] const KArcListing* self		Listing self reference: object oriented in C
- */
-static
-rc_t CC KArcListingWhack (const KArcListing *self)
-{
-    int ix;
-    for ( ix = 0; ix < self->cnt; ++ix )
-    {
-        free ( (void*)self->namelist[ix] );
-    }
-    free ( (void*)self->namelist );
-    return 0;
-}
-
-/* ----------------------------------------------------------------------
- * KArcListingDestroy
- * Class destructor
- *
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [INOUT] KArcListing *	self		Listing self reference: object oriented in C
- */
-static
-rc_t CC KArcListingDestroy (KArcListing *self)
-{
-    rc_t rc = KArcListingWhack (self);
-    if (rc == 0)
-        free (self);
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * KArcListingCount
- *
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [IN]  const KArcListing *	self		Listing self reference: object oriented in C
- * [OUT] uint32_t *		count		Where to put the count of names
- */
-static rc_t CC KArcListingCount (const KArcListing *self, uint32_t *count)
-{
-    *count = self->cnt;
-    return 0;
-}
-
-
-/* ----------------------------------------------------------------------
- * KArcListingGet
- *
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [IN]  const KArcListing *	self		Listing self reference: object oriented in C
- * [IN]  uint32_t		idx		?
- * [OUT] const char **		name		Where to put the name
- */
-static rc_t CC KArcListingGet (const KArcListing *self, uint32_t idx, const char **name)
-{
-    if (idx >= (uint32_t)self->cnt)
-	return RC (rcFS, rcNamelist, rcAccessing, rcParam, rcExcessive);
-    * name = self -> namelist [ idx ];
-    return 0;
-}
-
-
-/* ----------------------------------------------------------------------
- * KArcListingSort
- *
- * This function has the signature needed to use with the NameList base class for
- * KArcListings to determine the order of two names.  Matches the signature of
- * strcmp() and other functions suitable for use by qsort() and others
- *
- * [RET] int					0:  if a == b 
- *						<0: if a < b
- *						>0: if a > b
- * [IN] const void *		a
- * [IN] const void *		b
- *
- * Elements are typed as const void * to match the signature needed for 
- * a call to qsort() but they should be pointers to namelist elements
- */
-static int CC KArcListingSort (const void *a, const void *b, void * ignored)
-{
-    return strcmp (*(const char**)a, *(const char**)b);
-}
-
-static KNamelist_vt_v1 vtKArcListing =
-{
-    /* version 1.0 */
-    1, 0,
-
-    /* start minor version 0 methods */
-    KArcListingDestroy,
-    KArcListingCount,
-    KArcListingGet
-    /* end minor version 0 methods */
-};
-
-
-/* ----------------------------------------------------------------------
- * KArcListingInit
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [INOUT] KArcListing *	self		Listing self reference: object oriented in C
- * [IN]    const char *		path		?
- * [IN]    const KDirectory *	dir		?
- * [IN]    bool (* 		f	)(const KDirectory*, const char*, void*),
- *						This is a filter function - any listing element
- *						passed to this function will generate a true ot
- *						a false.  If flase that listing element is dropped.
- *						If this parameter is NULL all elements are kept.
- * [IN]	   void *		data		Ignored.  May use NULL if permitted
- *						by 'f'.
- */
-static rc_t KArcListingInit (KArcListing *self,
-                             const char *path,
-                             const KDirectory *dir,
-                             bool (CC* f) (const KDirectory*, const char*, void*),
-                             void *data)
-{
-    rc_t rc;
-
-    /* is self parameter possibly NULL? */
-    if (self == NULL)
-    {
-	return  RC (rcFS, rcDirectory, rcConstructing, rcSelf, rcNull);
-    }
-
-    /* start with an empty name list */
-    self->namelist = NULL;
-    self->cnt = 0;
-
-    /* initialize the Namelist base class */
-    if ((rc = KNamelistInit (& self -> dad,
-			     (const KNamelist_vt*)&vtKArcListing)) == 0)
-    {
-	/* -----
-	 * so we'll build a list iterator
-	 */
-	KArcDirIterator listitr;
-
-	if ((rc = KArcDirIteratorInit (& listitr, (const KArcDir*)dir, path)) == 0)
-	{
-
-#define	LEN_INCREMENT	(512)
-
-	    uint32_t len = LEN_INCREMENT;
-
-	    /* allocate heap for the default start size of a namelist */
-
-	    self->namelist = malloc (len * sizeof (self->namelist[0]));
-	    if (self->namelist == NULL)
-	    {
-		rc = RC (rcFS, rcDirectory, rcListing, rcMemory, rcExhausted);
-	    }
-	    else
-	    {
-		void *r;
-		const char *name;
-
-		/* -----
-		 * loop through the directory (the BSTree for a Archive TOC)
-		 */
-		while ((name = KArcDirIteratorNext (&listitr)) != NULL)
-		{
-		    /* if there is a filter function, run it */
-		    if (f != NULL)
-		    {
-			/* skip if the filter doesn't say use it */
-			if (! (*f) (dir, name, data))
-			    continue;
-		    }
-		    
-		    /* if the buffer is full, reallocate it larger */
-		    if (self->cnt == len)
-		    {
-			len += LEN_INCREMENT;
-			if ( NULL == ( r = realloc ( (void*)self -> namelist,
-						   len * sizeof self -> namelist [ 0 ] ) ) )
-			{
-			    /* -----
-			     * malloc failure so we fail too  - break not return so we can 
-			     * free allocated memory
-			     */
-			    rc = RC (rcFS, rcDirectory, rcListing, rcMemory, rcExhausted);
-			    break;
-			}
-			self->namelist = r;
-		    }
-		    
-		    /* get ourselves memory for the name */
-		    self->namelist[self->cnt] = malloc (strlen (name) + 1);
-		    if (self->namelist[self->cnt] == NULL)
-		    {
-			/* oops a failure so we fail */
-			rc = RC (rcFS, rcDirectory, rcListing, rcMemory, rcExhausted);
-			break;
-		    }
-		    strcpy ((char*)self->namelist[self->cnt], name);
-		    ++self->cnt;
-		}
-		
-		if (rc == 0)
-		{
-		    /* -----
-		     * now that we have our list and know how big it should have been we'll shrink it
-		     * if the count was zero this a effectively just a free()
-		     */
-		    r = realloc ( ( void* )self->namelist,
-				          self->cnt * sizeof ( self->namelist[0] ) );
-		    /* -----
-		     * if we have a new non-NULL pointer we know we have a list of non-zero length
-		     * store the pointer and sort the list
-		     */
-		    if (r != NULL)
-		    {
-			self -> namelist = r;
-			ksort ((void*)r, self -> cnt, sizeof self -> namelist [ 0 ], KArcListingSort, NULL);
-		    }
-		    /* -----
-		     * If we have a NULL pointer but have a non-zero count, we have a malloc() heap
-		     * space failure
-		     */
-		    else if (self -> cnt != 0)
-		    {
-			rc = RC (rcFS, rcDirectory, rcListing, rcMemory, rcExhausted);
-		    }
-		    /* -----
-		     * Or we have a NULL pointer and a count of zero so stow the NULL so its not
-		     * a dangling bad pointer
-		     */
-		    else
-		    {
-			self->namelist = r;
-		    }
-		}
-		/* if we got here because of a problem, kill the listing */
-		if (rc != 0)
-		{
-		    KArcListingWhack (self);
-		    self->namelist = NULL;
-		    self->cnt = 0;
-		}
-	    }
-	    /* we're done with the iterator so kill it */
-	    KArcDirIteratorWhack (&listitr);
-	}
-    }
-    return rc;
-}
-
-
-/* ======================================================================
- */
-
-/*--------------------------------------------------------------------------
- * KArcDir
- *  a directory inside an archive (tar or SRA for example)
- *
- * This type is being engineered to mimic KSysDir.
- */
-struct KArcDir
-{
-    KDirectory		dad;					/* parent class as in inheritance */
-
-    const KDirectory *  parent;					/* parent object */
-    const KToc *	toc;					/* table of contents class */
-    const KTocEntry *	node;					/* table of contents entry NULL for top level */
-    KArcFSType	arctype;
-    union
-    {
-	const void *		v;
-	const KFile *		f;
-	const KDirectory * 	d;
-    } archive;
-
-    uint32_t	  	root;					/* offset of / in path to treat as root */
-    uint32_t 	  	size;					/* length of path */		
-    char 	  	path	 [KARC_DEFAULT_PATH_ALLOC];	/* name of archive = mount point */
-   
-/* actual allocation is based on actual string length */
-};
-
-static rc_t KArcDirMake (KArcDir ** self,
-                         enum RCContext ctx,
-                         const KDirectory * parent,
-                         const KToc * toc,
-                         const KTocEntry * node,
-                         const void * archive,
-                         KArcFSType baseType,
-                         uint32_t dad_root,
-                         const char *path,
-                         uint32_t path_size,
-                         bool update, /* ignored */
-                         bool chroot);
-
-
-/* ----------------------------------------------------------------------
- * KArcDirDestroy
- */
-static rc_t CC KArcDirDestroy (KArcDir *self)
-{
-    if (self->toc != NULL)
-	KTocRelease (self->toc);
-    if (self->archive.v != NULL)
-	switch (self->arctype)
-	{
-	default:
-	    free ((void*)self->archive.v);
-	    break;
-	case tocKFile:
-	    KFileRelease (self->archive.f);
-	    break;
-	case tocKDirectory:
-	    KDirectoryRelease (self->archive.d);
-	    break;
-	}
-    free (self);
-
-    return 0;
-}
-
-
-
-/* ----------------------------------------------------------------------
- * KArcDirCanonPath
- *
- * In this context CanonPath means to make the path a pure /x/y/z with no back tracking 
- * by using ~/../~ or redundant ~/./~ or ~//~ here notations.  Not exactly the usage of 
- * canonical in describing a path in other places but consistent within KFS.  It matches
- * the common meaning of canonical path as the one true path except that processing out
- * of sym links isn't done here but would normally have been.  Not processing the 
- * links means potentially more than one canonical path can reach the same target 
- * violating the usual meaning of canonical path as the one true shortest path to any
- * element.
- *
- * const KArcDir *		self		Object oriented C; KArcDir object for this method
- * enum RCContext 		ctx
- * char * 			path
- * size_t			psize
- */
-static
-rc_t		KArcDirCanonPath	(const KArcDir *self,
-					 enum RCContext ctx,
-					 char *path,
-					 size_t psize)
-{
-    char *	low;	/* a pointer to the root location in path; not changed after initialization */
-    char *	dst;	/* a target reference for compressing a path to remove . and .. references */
-    char *	last;	/* the end of the last processed facet of the path */
-    char *	end;	/* absolute end of the incoming path */
-    char * 	src;	/* the start of the current facet to be processed */
-
-    /* end is the character after the end of the incoming path */
-    end = path + psize;
-
-    /* point all other temp pointers at the root point in the incoming path */
-    last = path + self->root;
-
-    /* handle windows / / network path starter */
-    if ((last == path) && (last[0] == '/') && (last[1] == '/'))
-      last ++;
-
-    low = dst = last;
-
-    for (;;)
-    {
-
-	/* point at the first / after the most recent processed facet */
-	src = strchr (last + 1, '/');
-	if (src == NULL)	/* if no '/' point to the end */
-	    src = end;
-
-	/* detect special sequences */
-	switch (src - last)
-	{
-	case 1: /* / / (with nothing between) is a superflouous / hurting us to parse later;
-		 * /. is a here reference to the same directory as the previous */
-	    if ((last[1] == '/')||(last[1] == '.'))
-	    {
-		/* skip over */
-		last = src;
-		if (src != end)
-		    continue;
-	    }
-	    break;
-	case 2: /* /./ is a "here" reference point and is omitted by not copying it over */
-	    if (last[1] == '.')
-	    {
-		/* skip over */
-		last = src;
-		if (src != end)
-		    continue;
-	    }
-	    break;
-
-	case 3: /* /../ is a up one directory and is processed by deleting the last facet copied */
-	    if (last [1] == '.' && last [2] == '.')
-	    {
-		/* remove previous leaf in path */
-		dst [ 0 ] = 0;
-		dst = strrchr (path, '/');
-		/* can't up a directory past the root */
-		if (dst == NULL || dst < low)
-		{
-		    return RC (rcFS, rcDirectory, ctx, rcPath, rcInvalid);
-		}
-
-		last = src;
-		if (src != end)
-		    continue;
-	    }
-	    break;
-	}
-
-	/* if rewriting, copy leaf */
-	if (dst != last)
-	{
-	    memmove (dst, last, src - last);
-	}
-
-	/* move destination ahead */
-	dst += src - last;
-        
-	/* if we're done, go */
-	if (src == end)
-	    break;
-
-	/* find next separator */
-	last = src;
-    }
-
-    /* NUL terminate if modified */
-    if (dst != end)
-	* dst = 0;
-
-    /* say we did did it with no problems */
-    return 0;
-}
-
-
-/* ----------------------------------------------------------------------
- * KArcDirMakePath
- *
- *  creates a full path from partial
- *
- * [IN]  const KArcDir *	self	object oriented self
- * [IN]  enum RCContext		ctx	a hint for context in building
- *					an error return rc_t
- * [IN]  bool			canon	Should the output be made 
- *					canonical per KDirectory's
- *					definition of canonical
- * [OUT] char **		pbuffer The output path
- * [IN]  const char *		path	The input path
- * [IN]  va_list		args	Possible additions to path
- */
-static
-rc_t KArcDirMakePath (const KArcDir *self,
-		      enum RCContext ctx,
-		      bool canon,
-		      char ** pbuffer,
-		      const char *path,
-		      va_list args)
-{
-    int    psize;	/* 'printed' size - output from vsnprintf */
-    size_t asize;	/* allocated buffer size */
-    size_t bsize;	/* base size */
-    char * buffer;
-
-    /* -----
-     * Validate parameters and fail if unusable
-     */
-    assert (path != NULL);
-    assert (pbuffer != NULL);
-
-    if (path == NULL)
-    {
-	return RC (rcFS, rcDirectory, ctx, rcPath, rcNull);
-    }
-    if (path[0] == 0)
-    {
-	return RC (rcFS, rcDirectory, ctx, rcPath, rcInvalid);
-    }
-
-    buffer = NULL;
-    asize = KARC_DEFAULT_PATH_ALLOC;
-    for (;;)
-    {
-	/* -----
-	 * allocate a buffer of the default size or a better size determined below
-	 */
-	buffer = realloc (buffer, asize);
-	*pbuffer = buffer;
-	if (buffer == NULL)
-	{
-	    return RC (rcFS, rcDirectory, rcAllocating, rcPath, rcExhausted);
-	}
-	/* -----
-	 * inherited from linux/sysdir.c
-	 *
-	 * if path starts with % we build something out of va_list?
-	 *
-	 * use vsnprintf (printf to string with size limit and argument list
-	 *	pointer instead of a list of arguments:
-	 * build path to buffer using a path that is a printf format string
-	 * with a requirement that the first thing in the format be a format inducing %
-	 */
-	if ((args != NULL) && (path[0] == '%'))
-	{
-	    psize = vsnprintf (buffer, asize, path, args);
-
-	    /* -----
-	     * decoding of path failed due a failure of printf
-	     * <0 is an unspecified failure unspecified (check errno?)
-	     */
-	    if (psize < 0)
-		return RC (rcFS, rcDirectory, ctx, rcPath, rcUnknown);
-
-	    /* -----
-	     * decoding of path failed due to length truncation
-	     * try to realloc using a larger size
-	     */
-	    if ( (size_t)psize >= asize )
-	    {
-		asize = psize;
-		continue;
-	    }
-
-	    /* -----
-	     * maybe the decoded path is a relative partial path
-	     */
-	    if (buffer[0] != '/')
-	    {
-		/* -----
-		 * if our KArcDir self has a mount point self->path of length more than 0
-		 * but that length isn't too long to prepend it to the derived path than
-		 * move the derived path over making room for the KArcDir base path and 
-		 * then insert that base at the beginning
-		 */
-		bsize = self->size;
-		if (bsize + psize >= asize)
-		{
-		    asize = bsize + psize;
-		    continue;
-		}
-		/* make room */
-		memmove (buffer + self->size, buffer, psize+1);
-		/* fail if the kDirectory path doesn't end in /? (inherited) */
-		assert (self->path[bsize-1] == '/');
-		/* prepend self's path */
-		memcpy (buffer, self->path, bsize);
-	    }
-
-	    /* -----
-	     * or maybe we have a path base for the KArcDir
-	     */
-	    else if ((bsize = self->root) != 0)
-	    {
-		/* -----
-		 * if we got a full path from the decoding do the same thing but only the
-		 * amount of the self's path that is up to an effective "chroot" point
-		 */
-		if (bsize + psize >= asize)
-		{
-		    asize = bsize + psize;
-		    continue;
-		}
-		memmove (buffer + self->size, buffer, psize+1);
-		assert (self->path [bsize-1] != '/');
-		memcpy (buffer, self -> path, bsize);
-	    }
-	    /* -----
-	     * or maybe the new path is cool as is.  unlikely?
-	     */
-	}
-	else
-	{
-	    /* -----
-	     * copy a partial/relative  path parameter into the buffer leaving room for the
-	     * self's base path
-	     */
-	    if (path[0] != '/')
-	    {
-		assert (self->path[self->size - 1] == '/');
-		memcpy (buffer, self->path, bsize = self->size);
-	    }
-	    /* -----
-	     * copy the pre-root portion of the self's path into the buffer
-	     */
-	    else if ((bsize = self->root) != 0)
-	    {
-		assert (self->path[bsize-1] != '/');
-		memcpy (buffer, self->path, bsize);
-	    }
-
-	    /* -----
-	     * okay use snprintf to append the incoming path into the buffer after the
-	     * self's base or root either using a simple string format or again assuming
-	     * that the path has printf format symbols if there are arguments in the
-	     * va_list
-	     */
-	    if (args == NULL)
-		psize = snprintf (buffer+bsize, asize-bsize, "%s", path);
-	    else
-		psize = vsnprintf (buffer+bsize, asize-bsize, path, args);
-
-	    /* -----
-	     * decoding of path failed due a failure of printf
-	     * <0 is an unspecified failure unspecified (check errno?)
-	     */
-	    if (psize < 0)
-		return RC (rcFS, rcDirectory, ctx, rcPath, rcUnknown);
-
-	    /* -----
-	     * decoding of path failed due to length truncation
-	     * try to realloc using a larger size
-	     */
-	    if (bsize+psize >= asize)
-	    {
-		asize = bsize+psize;
-		continue;
-	    }
-	}
-	break;
-    }
-    /* -----
-     * if the last character is a '/' get rid of it?
-     */
-    if (buffer[bsize+psize] == '/')
-	buffer[bsize+(--psize)] = 0;
-
-    /* -----
-     * if the incoming path turns out to be a single character (I think) AND
-     * we either have the canon flag set or if the the KArcDir root is not empty
-     * "canonize" it.
-     */
-    if (canon || (self->root != 0))
-    {
-	return KArcDirCanonPath (self, ctx, *pbuffer, bsize+psize);
-    }
-    return 0;
-}
-
-
-/* ----------------------------------------------------------------------
- * KArcDirList
- *  create a directory listing
- *
- *  "list" [ OUT ] - return parameter for list object
- *
- *  "path" [ IN, NULL OKAY ] - optional parameter for target
- *  directory. if NULL, interpreted to mean "."
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [IN]	 const KArcDir *	self		Object oriented C; KArcDir object for this method
- * [OUT] KNamelist **		listp,
- * [IN]  bool (* 		f	)(const KDirectory*,const char *, void *)
- * [IN]  void *			data
- * [IN]  const char *		path
- * [IN]  va_list		args
- */
-static
-rc_t CC KArcDirList (const KArcDir *self,
-                     KNamelist **listp,
-                     bool (CC* f) (const KDirectory *dir, const char *name, void *data),
-                     void *data,
-                     const char *path,
-                     va_list args)
-{
-    char * full_path;
-    rc_t rc;
-
-    rc = KArcDirMakePath (self, rcListing, true,
-			  &full_path, path, args);
-    if (rc == 0)
-    {
-	const KTocEntry * pnode;
-	KTocEntryType	type;
-	KArcDir * full_dir;
-
-	rc = KArcDirResolvePathNode(self, rcListing, full_path, true, &pnode, &type);
-	if (rc == 0)
-	{
-	    rc = KArcDirMake (&full_dir,
-			      rcListing,
-			      self->parent,
-			      self->toc,
-			      pnode,
-			      self->archive.v,
-			      self->arctype,
-			      self->root,
-			      full_path,
-			      (uint32_t)strlen(full_path),
-			      false, 
-			      0);
-	    if (rc == 0)
-	    {
-		KArcListing *list = malloc (sizeof *list);
-
-		if (list == NULL)
-		{
-		    rc = RC (rcFS, rcDirectory, rcListing, rcMemory, rcExhausted);
-		}
-		else
-		{
-		    rc = KArcListingInit (list,
-					  full_dir->path,
-					  &full_dir->dad,
-					  f,
-					  data);
-
-		    if (rc != 0)
-		    {
-			free (list);
-		    }
-		    else
-		    {
-			*listp = &list->dad;
-		    }
-		}
-		KArcDirDestroy (full_dir);
-	    }
-	}
-	free (full_path);
-    }
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * KArcDirFullPathType
- *
- * Get the KDirectory defined KPathType for whatever is referred to 
- * by path that is accessible through the KArcDir self.  The path's
- * root is based on self's root (?) and a relative path is relative to 
- * self.
- *
- * [RET] uint32_t			actually this is enum KPathType
- * [IN]  const KArcDir *	self	base KDirectory for the call to
- *					find the type of path
- * [IN]  const char * 		path	what path of which to type the
- *					last facet
- */
-static
-uint32_t KArcDirFullPathType (const KArcDir *self, const char * path)
-{
-    const KTocEntry * node;
-    const char *	local_path = path;
-    KTocEntryType	type;
-    uint32_t		tt = 0;
-    int			loopcount;
-    rc_t		rc;
-
-    assert (self != NULL);
-    assert (path != NULL);
-
-    for (loopcount = 0; loopcount < KARC_LINK_RESOLVE_LOOPMAX; ++loopcount)
-    {
-        rc = KArcDirResolvePathNode (self,
-            rcConstructing, local_path, false, &node, &type); 
-        if (rc != 0)
-        {
-            /* TODO: filter rc into kptBadPath or kptNotFound... */
-            return (tt | kptNotFound);
-        }
-        switch (type)
-        {
-        default:
-            return kptBadPath;
-
-        case ktocentrytype_unknown:
-            return kptBadPath;
-
-        case ktocentrytype_hardlink:
-            return kptDir;
-
-        case ktocentrytype_dir:
-            return tt | kptDir;
-
-        case ktocentrytype_file:
-        case ktocentrytype_emptyfile:
-            return tt | kptFile;
-
-        case ktocentrytype_chunked:
-            return tt | kptFile;
-
-        case ktocentrytype_softlink:
-            tt = kptAlias;
-            if (KTocEntryGetSoftTarget(node,&local_path) != 0)
-                return kptAlias|kptNotFound;
-            break;
-
-        case ktocentrytype_zombiefile:
-            PLOGMSG (klogWarn, (klogWarn,
-                "zombie file detected: '$(P)'", "P=%s", path));
-            ReportRecordZombieFile();
-            return tt | kptZombieFile;
-
-        }
-    }
-    return kptBadPath;
-}
-
-
-/* ----------------------------------------------------------------------
- * KArcDirPathType
- *  returns a KPathType
- *
- *  "path" [ IN ] - NUL terminated string in directory-native character set
- * NOTE: Does not meet a design target of on stack (localized variable) allocation of single 4kb path
- *
- * [RET] uint32_t
- * [IN]  const KArcDir *	self		Object oriented C; KArcDir object for this method
- * [IN]  const char *		path
- * [IN]  va_list		args
- */
-static uint32_t CC KArcDirPathType (const KArcDir *self, const char *path, va_list args)
-{
-    rc_t	rc;
-    uint32_t 	type;
-    char * 	full;
-
-    rc = KArcDirMakePath (self, rcAccessing, false, &full, path, args);
-
-    if (rc == 0)
-    {
-	type = KArcDirFullPathType (self, full);
-	free (full);
-    }
-    else
-    {
-	type = kptBadPath;
-    }
-    return type;
-}
-
-
-/* ----------------------------------------------------------------------
- * KArcDirVisitDir
- *
- * [IN] KArcDirVisitData *	pb
- */
-typedef struct KArcDirVisitData		
-{
-    rc_t   (CC* f )(const KDirectory*, uint32_t, const char*, void*);
-    void *      data;
-    KArcDir *   dir;
-    bool        recurse;
-} KArcDirVisitData;
-
-
-static
-rc_t KArcDirVisitDir(KArcDirVisitData *pb)
-{
-    /* get a directory listing */
-    KArcDirIterator 	listing;
-    rc_t		rc; 
-
-    assert (pb != NULL);
-
-    rc = KArcDirIteratorInit (&listing, pb->dir, pb->dir->path);
-    if (rc == 0)
-    {
-        const char * base;
-        const char * name;
-        char * full_name = NULL;
-        uint32_t 	size;
-
-        size = pb->dir->size;
-        base = pb->dir->path;
-
-        for(pb->dir->size = size, name = KArcDirIteratorNext (&listing);
-            name != NULL; name = KArcDirIteratorNext (&listing))
-        {
-            uint32_t len = (uint32_t)strlen (name);
-            free(full_name);
-            full_name = malloc(size + len + 1);
-
-            if(full_name == NULL) {
-                rc = RC (rcFS, rcDirectory, rcVisiting, rcMemory, rcExhausted);
-                break;
-            } else {
-                const KTocEntry *	pnode;
-                KTocEntryType		type;
-                /* -----
-                * build up the path from the base and the name
-                */
-                memcpy(full_name, base, size);
-                memcpy(full_name+size, name, len);
-                full_name[size+len] = 0;
-
-                rc = KArcDirResolvePathNode(pb->dir, rcVisiting, full_name,
-                                            true, &pnode, &type);
-                if(rc != 0) {
-                    break;
-                }
-                /* -----
-                * call the function per visit
-                */
-                /* type is wrong "type"  needs to be a kpt not karctoctype */
-                {
-                    uint32_t kptype;
-                    kptype = KArcDirFullPathType(pb->dir, full_name);
-                    rc = pb->f(&pb->dir->dad, kptype, name, pb->data);
-                }
-                if(rc != 0) {
-                    break;
-                }
-                if(pb->recurse && ((type == ktocentrytype_dir)||(type == ktocentrytype_hardlink))) {
-                    KArcDir * rdir;
-                    KArcDirVisitData rpb;
-
-                    rc = KArcDirMake(&rdir, rcVisiting, pb->dir->parent, pb->dir->toc,
-                                     pnode, pb->dir->archive.v, pb->dir->arctype, pb->dir->root,
-                                     full_name, (uint32_t)strlen ( full_name ), false, false);
-                    if(rc != 0) {
-                        break;
-                    }
-                    rpb.f = pb->f;
-                    rpb.data = pb->data;
-                    rpb.dir = rdir;
-                    rpb.recurse = pb->recurse;
-                    rc = KArcDirVisitDir(&rpb);
-                    KArcDirDestroy(rdir);
-                    if(rc != 0) {
-                        break;
-                    }
-                }
-            }
-        }
-        free(full_name);
-        KArcDirIteratorWhack (& listing);
-    }
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * KArcDirRelativePath
- *
- * KArcDirRelativePath
- *  makes "path" relative to "root"
- *  both "root" and "path" MUST be absolute
- *  both "root" and "path" MUST be canonical, i.e. have no "//", "/./" or "/../" sequences
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [IN] const KArcDir *		self		Object oriented C; KArcDir object for this method
- * [IN] enum RCContext 		ctx
- * [IN] const char *		root
- * [IN] char *			path
- * [IN] size_t			path_max
- */
-static
-rc_t KArcDirRelativePath (const KArcDir *self, enum RCContext ctx,
-			  const char *root, char *path, size_t path_max)
-{
-    int backup;
-    size_t bsize, psize;
-
-    const char *r = root + self -> root;
-    const char *p = path + self -> root;
-
-    assert (r != NULL && r [ 0 ] == '/');
-    assert (p != NULL && p [ 0 ] == '/');
-
-    for (; * r == * p; ++ r, ++ p)
-    {
-	/* disallow identical paths */
-	if (* r == 0)
-	    return RC (rcFS, rcDirectory, ctx, rcPath, rcInvalid);
-    }
-
-    /* paths are identical up to "r","p"
-       if "r" is within a leaf name, then no backup is needed
-       by counting every '/' from "r" to end, obtain backup count */
-     for (backup = 0; * r != 0; ++ r)
-    {
-	if (* r == '/')
-	    ++ backup;
-    }
-
-    /* the number of bytes to be inserted */
-    bsize = backup * 3;
-
-    /* align "p" to last directory separator */
-    while (p [ -1 ] != '/') -- p;
-
-    /* the size of the remaining relative path */
-    psize = strlen (p);
-
-    /* open up space if needed */
-    if ( (size_t)(p - path) < bsize )
-    {
-	/* prevent overflow */
-	if (bsize + psize >= path_max)
-	    return RC (rcFS, rcDirectory, ctx, rcPath, rcExcessive);
-	memmove (path + bsize, p, psize);
-    }
-
-    /* insert backup sequences */
-    for (bsize = 0; backup > 0; bsize += 3, -- backup)
-	memcpy (& path [ bsize ], "../", 3);
-
-    /* close gap */
-    if ( (size_t)( p - path ) > bsize )
-	{
-		strcpy (& path [ bsize ], p);
-	}
-
-	return 0;
-}
-
-
-/* ----------------------------------------------------------------------
- * KArcDirResolvePathNode
- *
- * Resolve a path to a KToc Node with a triple return type of
- * success/failure, KTocEntry to use to access the leaf of the path,
- * and the type of the node that could have been easily obtained from 
- * that node
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [IN]  const KArcDir *      self	OOP in C self/this pointer
- * [IN]  const char *         path	the path to resolve
- * [IN]  bool		      follow	Follow any links
- * [OUT] const KTocEntry ** pnode	a pointer that will point to the 
- *					ArcTOCNode for the path
- * [OUT] KTocEntryType *    ptype	Archive specific type for the
- *					entry matching path
- * TODO: Make this prettier for human readabilty by breaking out into sub-functions?
- */
-static
-rc_t	KArcDirResolvePathNode	(const KArcDir *	self,
-				 enum RCContext 	ctx,
-				 const char *		path,
-				 bool			follow,
-				 const KTocEntry ** 	pnode,
-				 KTocEntryType * ptype)
-{
-    rc_t		rc = 0;
-
-    assert (self != NULL);
-    assert (path != NULL);
-    assert (pnode != NULL);
-    assert (ptype != NULL);
-
-    *pnode = NULL;
-    *ptype = ktocentrytype_unknown;
-
-    if (path[0] == 0)
-    {
-	rc = RC (rcFS, rcDirectory, ctx, rcPath, rcInvalid);
-    }
-    else
-    {
-	/* -----
-	 * This loop is to replace recursive approaches to resolving sym links in 
-	 * the path.before the last facet.
-	 *
-	 * we used temp_path as an alias for path because we can "recur" by 
-	 * going through the loop iteratively instead of recursively changing
-	 * temp_path each time where we would have called this function again
-	 */
-	const char *	temp_path = path;	/* no alloc */
-	const KToc *	toc = self->toc;	/* no alloc */
-	char *		allocated_path = NULL;	/* alloc; must free{} */
-	char * 		abpath = NULL;		/* alloc; must free{} */
-
-	while(rc == 0) /* loop as long as no failures or until break */
-	{
-	    /* -----
-	     * clean up the path to its KFS canonical form
-	     */
-	    if (abpath != NULL)
-		free (abpath);
-	    rc = KArcDirMakePath (self, ctx, /* canon*/true, &abpath,
-				  temp_path, NULL);
-	    if (rc != 0)
-	    {
-		/* -----
-		 * If we couldn't "make the path" we'll just fail passing along
-		 * the fail reason from MakePath.
-		 */
-		break;	/* TODO fix rc context? Object? */
-	    }
-	    else
-	    {
-		const String * pathstring;
-
-		rc = KTocGetPath (toc, &pathstring);
-		/* -----
-		 * validate that this canonical path is in the TOC
-		 */
-		if (strncmp(abpath, pathstring->addr, pathstring->size) != 0)
-		{
-		    /* -----
-		     * This is a key return as it could be used to trigger a call to 
-		     * a containing "parent" KDirectory to try again outside of this KArcDir
-		     * be it another KArcDir, KSysDir, or other KDirectory interface 
-		     * implementation.
-		     */
-		    rc = RC (rcFS, rcDirectory, ctx, rcPath, rcOutOfKDirectory);
-		    break;
-		}
-		else
-		{
-		    const KTocEntry *	node;		/* no alloc */
-		    const String *	toc_path_string;	/* no alloc */
-		    const char *	toc_path;		/* no alloc */
-		    const char *	left;		/* no alloc */
-		    KTocEntryType	type  = ktocentrytype_unknown;
-		    /* -----
-		     * now get the path that is just that which is inside the TOC by pointing
-		     * past the path of the TOC and get the relevant TOC.  Since the incoming path
-		     * and the "makepath" path have all been ASCIZ so is this abbreviated path.
-		     */
-
-
-		    rc = KTocGetPath (toc, &toc_path_string);
-		    toc_path = abpath + toc_path_string->size; /* point past toc's path to either NUL or '/' */
-		    if (toc_path[0] == '/')		/* if '/' move forward one char */
-			toc_path++;
-		    else if (toc_path[0] != 0x00)	/* if not NUL we are not in this TOC */
-		    {
-			rc = RC (rcFS, rcDirectory, ctx, rcPath, rcOutOfKDirectory);
-			break;
-		    }
-
-		    /* if the called resolve failed then this resolve fails too */
-		    rc = KTocResolvePathTocEntry (toc, &node, toc_path, strlen(toc_path), &type, &left);
-		    if (rc != 0)
-		    {
-			/* nothing? or fix ret? */
-		    }
-		    else if (type != ktocentrytype_softlink)
-		    {
-			/* -----
-			 * This is the non soft link successful result
-			 */
-			*ptype = type;
-			*pnode = node;
-			/* rc is 0 at this point */
-			break; /* out of for (;;) */
-		    }
-		    else
-		    {
-			size_t	lsize;
-			
-			/* -----
-			 * successful so far but there might still be some path left if we hit a soft link
-			 */
-			lsize = strlen(left);	/* points to NUL for empty string if we got to the end */
-
-			if ((lsize == 0) && (! follow))
-			{
-			    /* -----
-			     * This is a soft link successful result
-			     */
-			    *ptype = type;
-			    *pnode = node;
-			    /* rc is 0 at this point */
-			    break; /* out of for (;;) */
-			}
-			/* -----
-			 * If we did hit a soft link with path remaining we have work to do resolving the
-			 * facets in the path before the end.
-			 *
-			 * the remaining path could be as little as a single "/".
-			 */
-			else
-			{
-			    const char *	symlink_path;		/* no alloc */
-			    rc = KTocEntryGetSoftTarget(node, &symlink_path);
-			    if (rc != 0)
-			    {
-				/* fix rc_t? */
-				break;
-			    }
-			    else
-			    {
-				/* -----
-				 * If the symbolic link's path starts with '/' it is an absolute path
-				 */
-				if (symlink_path[0] == '/')
-				{
-				    free (abpath); /* abandon the last presumed absolute path */
-				    temp_path = symlink_path;
-				    continue; /* back to for(;;) */
-				}
-				else
-				{
-				    /* -----
-				     * if the first character isn't '/' it is relative to the current
-				     * directory within the TOC
-				     */
-				    size_t		asize;		/* allocated size */
-				    size_t		fsize;		/* first - before symlink - size */
-				    size_t  	ssize;		/* symlink value size */
-				    const char * 	backtrack;
-				    /* -----
-				     * Backtrack across the last facet - which was the link name
-				     */
-				    for (backtrack = left - 1; *backtrack != '/'; --backtrack)
-					;
-				    backtrack++; /* get back the '/' */
-
-				    /* -----
-				     * we need enough space for the 
-				     */
-				    fsize = backtrack - abpath;	/* current path through start of link */
-				    ssize = strlen(symlink_path);/* length of the link's replacement value */
-				    asize = fsize+ssize+lsize+1;/* total of the three pieces and NUL */
-				    allocated_path		/* get a temp buffer to build this new path */
-					= realloc (allocated_path, asize);
-				    if (allocated_path == NULL)
-				    {
-					rc = RC (rcFS, rcDirectory, ctx, rcMemory, rcExhausted);
-					break; /* end for(;;) */
-				    }
-				    else
-				    {
-					char * pc;
-					/* -----
-					 * TODO verify that there is or is not a problem
-					 * with  "~//~" showing up from these memcopies
-					 * and that a final NUL is added add extra buffer
-					 * space as needed to asize
-					 */
-					memcpy (allocated_path, abpath, fsize);
-					pc = allocated_path + fsize;
-					memcpy (pc, symlink_path, ssize);
-					pc += ssize;
-					if (*(pc-1) == '/')
-					    --pc;
-					memcpy (pc, left, lsize+1);
-					temp_path = allocated_path;
-					continue;
-
-				    } /* if (allocated_path == NULL) {} else { */
-				} /* if (symlink_path[0] == '/') {} else { */
-			    } /* if (rc != 0) {} else { */
-			} /* if ((lsize == 0) && (! follow)) {} else { */
-		    } /* if (rc != 0) {} else if (type != ktocentrytype_softlink) {} else { */
-		} /* if (strncmp(abpath, self->path, self->size) != 0) {} else { */
-	    } /* if (rc != 0) {} else { */
-	} /* while(rc == 0) */
-	if (abpath != NULL)
-	    free (abpath);
-	if (allocated_path != NULL)
-	    free (allocated_path);
-    } /* if (path[0] == 0) {} else { */
-    return rc;
-}
-
-
-/* ======================================================================
- * KArcFile
- *  a file inside an archive
- */
-
-/*-----------------------------------------------------------------------
- * KArcFile
- *  an archive file including tar and sra
- */
-struct KArcFile
-{
-    KFile		dad;
-    const KToc *	toc;	/* not accessed directly but it owns the node so need a ref to it */
-    const KTocEntry *	node;
-    const KFile *	archive;
-};
-
-/*-----------------------------------------------------------------------
- * KArcFileDestroy
- *
- * Destructor for objects of class KArcFile.  Usually not called directly but instead called
- * when the reference count for the object drops to 0.
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [IN] KArcFile *		self		OOP self pointer - the object to be destroyed
- */
-static
-rc_t CC KArcFileDestroy (KArcFile *self)
-{
-    rc_t ret1, ret2;
-
-    assert (self != NULL);
-
-    ret1 = KFileRelease (self->archive);
-    ret2 = KTocRelease (self->toc);
-    free (self);
-
-    /* -----
-     * this seems a tad silly but pass along one or the other failure
-     * We chose to call the second release even of the first failed
-     * erring on the side of releasing as much as possible
-     */
-    return (ret1 != 0) ? ret1 : ret2;
-}
-
-
-/*-----------------------------------------------------------------------
- * KArcFileGetSysFile
- *
- *  returns an underlying system file object
- *  and starting offset to contiguous region
- *  suitable for memory mapping, or NULL if
- *  no such file is available.
- * Returns the KSysFile/KFile associated with a KArcFile.  NULL if not appropriate.
- *
- * [RET] struct KSysFile *
- * [IN]  const KArcFile *	self		Object oriented C; KArcFile object for this method
- * [OUT] uint64_t *		offset		An offset into the KSysfile where the KArcFile's
- *						data starts.
- */
-static
-struct KSysFile *CC KArcFileGetSysFile (const KArcFile *self, uint64_t *offset)
-{
-    rc_t rc;
-    KTocEntryType type;
-    struct KSysFile * fp;
-    uint64_t fo;
-    uint64_t ao;
-
-    /* parameters must be non-NULL */
-    assert (self != NULL);
-    assert (offset != NULL);
-
-    /* check the type which must be a contiguous file */
-    rc = KTocEntryGetType (self->node, &type);
-    if (rc == 0)
-    {
-	if (type == ktocentrytype_file)
-	{
-	    /* recur into the KFile to see if it allows this */
-	    fp = KFileGetSysFile (self->archive, &ao);
-
-	    /* -----
-	     * if all this is true get the offset from the TOC entry and
-	     * return it
-	     */
-	    if (fp != NULL)
-	    {
-		if (KTocEntryGetFileOffset (self->node, &fo) == 0)
-		{
-		    *offset = ao + fo;
-		    return fp;
-		}
-	    }
-	}
-    }
-    /* any failure alng the way leads to returning NULL */
-    *offset = 0;
-    return NULL;
-}
-
-
-/*-----------------------------------------------------------------------
- * KArcFileRandomAccess
- *
- * Returns zero if Random access is allowed for this KFile
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details		
- * [IN] const KArcFile *	self		Object oriented C; KArcFile object for this method
- */
-static
-rc_t CC KArcFileRandomAccess (const KArcFile *self)
-{
-    assert (self != NULL);
-    return 0;
-}
-
-
-/*-----------------------------------------------------------------------
- * KArcFileType
- *  returns a KFileDesc
- *  not intended to be a content type,
- *  but rather an implementation class
- */
-static
-uint32_t CC KArcFileType ( const KArcFile *self )
-{
-    return KFileType ( self -> archive );
-}
-
-
-/*-----------------------------------------------------------------------
- * KArcFileSize
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [IN]  const KArcFile *	self		Object oriented C; KArcFile object for this method
- * [OUT] uint64_t *		size		Where to put the virtual size of the file
- */
-static
-rc_t CC KArcFileSize (const KArcFile *self, uint64_t *size)
-{
-    rc_t	rc;
-    uint64_t	fsize;
-
-    assert (self != NULL);
-    assert (size != NULL);
-
-    rc = KTocEntryGetFileSize(self->node, &fsize);
-    if (rc == 0)
-    {
-	/* success */
-	*size = fsize;
-    }
-    /* pass along RC value */
-    return rc;
-}
-
-
-/*-----------------------------------------------------------------------
- * KArcFileSetSize
- *
- * Change the size of the KFile.  Not supported for files inside archives.
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [IN] KArcFile *		self		Object oriented C; KArcFile object for this method
- * [IN] uint64_t		size
- */
-static
-rc_t CC KArcFileSetSize (KArcFile *self, uint64_t size)
-{
-    return RC (rcFS, rcFile, rcUpdating, rcArc, rcUnsupported);
-}
-
-
-
-/*-----------------------------------------------------------------------
- * KArcFileRead
- *
- * Read bytes from a file represented by this KArcFile
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [IN]  const KArcFile *	self		Object oriented C; KArcFile object for this method
- * [IN]  uint64_t		pos		Offset with in the file from where to start reading
- * [OUT] void *			buffer		buffer to which to write the read bytes 
- * [IN]  size_t			bsize		how many bytes to read
- * [OUT] size_t *		num_read	how many bytes actually read. Will get written even
- *						in failure
- */
-/* ----------------------------------------------------------------------
- * KArcFileReadContiguous
- *
- * Read data from a contiguously stored file at a specified position
- *
- * The parameters are the same as KArcFileRead.  This private function could be
- * inlined.  It is broken out for human readabilty.
- *
- * We just fix the offset by adding the offset to the file within the archive
- * (we fixed the number to read before we got here) and pass the read to the
- * archive.
- */
-static
-rc_t KArcFileReadContiguous (const KArcFile *self, uint64_t pos,
-			     void *buffer, size_t bsize, size_t *num_read)
-{
-    rc_t	rc;
-    uint64_t	offset;
-
-    assert (self != NULL);
-    assert (buffer != NULL);
-    assert (num_read != NULL);
-    assert (bsize != 0);
-
-    rc = KTocEntryGetFileOffset (self->node, &offset);
-    if (rc == 0)
-    {
-	rc = KFileRead (self->archive, pos + offset, buffer, bsize, num_read);
-    }
-    return rc;
-}
-
-/* ----------------------------------------------------------------------
- * KArcFileReadEmpty
- *
- * Read data from a file with no content.
- *
- * The parameters are the same as KArcFileRead.  This private function could be
- * inlined.  It is broken out for human readabilty.
- *
- * We just fix the offset by adding the offset to the file within the archive
- * (we fixed the number to read before we got here) and pass the read to the
- * archive.
- */
-static
-rc_t KArcFileReadEmpty (const KArcFile *self, uint64_t pos,
-                        void *buffer, size_t bsize, size_t *num_read)
-{
-    assert (self != NULL);
-    assert (buffer != NULL);
-    assert (num_read != NULL);
-    assert (bsize != 0);
-
-    *num_read = 0;
-    return 0;
-}
-
-/* ----------------------------------------------------------------------
- * KArcFileReadChunked
- *
- * Read data from a  chunked file at a specified position
- *
- * The parameters are the same as KArcFileRead.  This private function could be
- * inlined.  It is broken out for human readabilty.
- */
-static
-rc_t KArcFileReadChunked (const KArcFile *self,
-			  uint64_t pos,
-			  void *buffer,
-			  size_t bsize,
-			  size_t *num_read)
-{
-    const KTocChunk *	pchunk;		/* pointer to the chunk table */
-    size_t		count;		/* how many to read/write in an action */
-    uint32_t		num_chunks;	/* how many chunks in the array */
-    rc_t		rc;		/* general purpose return from calls and pass along */
-
-    assert (self != NULL);
-    assert (buffer != NULL);
-    assert (num_read != NULL);
-    assert (bsize != 0);
-
-    /* -----
-     * assume no read/write will happen or rather start with having read none;
-     * this write could be superfluous but we need to prepare *num_read for += operations
-     */
-    *num_read = 0;
-
-    /* -----
-     * Get the count of chunks and a pointer to the array of chunks for this file
-     */
-    rc = KTocEntryGetChunks (self->node, &num_chunks, &pchunk);
-    if (rc == 0)
-    {
-	uint8_t *	pbuff;		/* access the buffer as an array of bytes */
-	uint64_t	end;		/* this will be set to the end offset */
-
-	pbuff = buffer;
-	end = pos + bsize;	
-
-	/* -----
-	 * step through the chunks
-	 */
-	for (; (num_chunks) && (pos < end); --num_chunks, ++pchunk)
-	{
-	    uint64_t 	cend;		/* end offset of this chunk */
-
-	    /* -----
-	     * determine the end of this chunk
-	     */
-	    cend = pchunk->logical_position + pchunk->size;
-
-	    /* -----
-	     * if this chunk is entirely before the current position
-	     * we are looking for
-	     * skip to the next (if any) chunk
-	     */
-	    if (pos > cend)
-		continue;
-
-	    /* -----
-	     * handle any needed zero fill section before the next chunk
-	     */
-	    if (pos < pchunk->logical_position)
-	    {
-		/* -----
-		 * try to fake-read as many bytes of zero as possible
-		 * so start assuming you need enough zeros to reach the next chunk
-		 * but cut it back to the remaining requested if that was too many
-		 */
-		count = (size_t)( pchunk->logical_position - pos );
-		if (count > bsize)
-		    count = bsize;
-
-		/* fake read the zeros */
-		memset (pbuff, 0, count);
-
-		/* update tracking variables */
-		pbuff += count;
-		pos += count;
-		*num_read += count;
-	    }
-
-	    /* -----
-	     * handle a chunk section
-	     *
-	     * if we are here, then we still have bytes to get and
-	     * pos >= pchunk_logical_position
-	     *
-	     * Get the most we can from this chunk.
-	     * If there are enough bytes in this chunk to finish the read: do so.
-	     * Else read through the end of the chunk
-	     */
-	    count = (size_t)( (end <= cend) ? end - pos : cend - pos );
-
-	    /* -----
-	     * a little tricky is we call by value the wanted count and the function
-	     * called will over write that with the actual read count
-	     */
-	    rc = KFileRead (self->archive, 
-			    pchunk->source_position + (pchunk->logical_position - pos), 
-			    pbuff, count, &count);
-
-	    *num_read += count;
-	    if (rc != 0)
-	    {
-		/* failure so abort */
-		break;
-	    }
-	    pbuff += count;
-	    pos += count;
-	    *num_read += count;
-	}
-	/* -----
-	 * If eveything so far is okay but we have more bytes to read
-	 * yet no more chunks; then fill to the end with zeroes
-	 */
-	if ((rc == 0) && (pos < end))
-	{
-	    count = (size_t)( end - pos );
-	    memset (pbuff, 0, count);
-	    *num_read += count;
-	}
-    }
-    return rc;
-}
-/* ----------------------------------------------------------------------
- * Read
- *  read file from known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually read
- */
-static
-rc_t CC KArcFileRead	(const KArcFile *self,
-			 uint64_t pos,
-			 void *buffer,
-			 size_t bsize,
-			 size_t *num_read)
-{
-    KTocEntryType	type;
-    rc_t		rc;
-
-    /* -----
-     * self and buffer were validated as not NULL before calling here
-     *
-     * So get the KTocEntry type: chunked files and contiguous files 
-     * are read differently.
-     */
-    assert (self != NULL);
-    assert (buffer != NULL);
-    assert (num_read != NULL);
-    assert (bsize != 0);
-
-    rc = KTocEntryGetType(self->node, &type);
-
-    assert ((type == ktocentrytype_file) || 
-            (type == ktocentrytype_chunked) ||
-            (type == ktocentrytype_emptyfile));
-
-    if (rc == 0)
-    {
-	uint64_t	size;
-
-	/* -----
-	 * We have to validate the size to be read and will modify the number
-	 * down if necessary
-	 */
-	rc = KTocEntryGetFileSize (self->node, &size);
-	if (rc == 0)
-	{
-	    /* ----- 
-	     * if we are seeking beyond the end match sysfile.c's use of pread
-	     * and return number read as 0 to mark EOF
-	     */
-	    if (pos >= size)
-	    {
-		*num_read = 0;
-	    }
-	    else
-	    {
-		uint64_t	limit;
-
-		limit = 
-		    (pos + bsize > size)	/* if attempt to read beyond end of file */
-		    ? size - pos		/* then force smaller read */
-		    : bsize;			/* else allow full read */
-
-		switch (type)
-		{
-		default:
-		case ktocentrytype_unknown:
-		case ktocentrytype_dir:
-		case ktocentrytype_softlink:
-		case ktocentrytype_hardlink:
-		    /* -----
-		     * We should not have been able to open these as a KArcFile
-		     * so this is probably superfluous
-		     */
-		    rc = RC (rcFS, rcFile, rcReading, rcArc, rcUnexpected);
-		    break;
-		case ktocentrytype_file:
-		    rc = KArcFileReadContiguous (self, pos, buffer, (size_t)limit, num_read);
-		    break;
-		case ktocentrytype_chunked:
-		    rc = KArcFileReadChunked (self, pos, buffer, (size_t)limit, num_read);
-		    break;
-		case ktocentrytype_emptyfile:
-		    rc = KArcFileReadEmpty (self, pos, buffer, (size_t)limit, num_read);
-		    break;
-		}
-	    }
-	}
-    }
-    return rc;
-}
-
-
-
-/*-----------------------------------------------------------------------
- * KArcFileWrite
- *
- * Write bytes to a file represented by this KArcFile.
- * Fails as unsupported for files inside archives.
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [IN]  KArcFile *		self		Object oriented C; KArcFile object for this method
- * [IN]  uint64_t 		pos		Offset within file to start writing (ignored)
- * [IN]  const void *		buffer		pointer to data to write (ignored)
- * [IN]  size_t 		size		how many bytes to write (ignored)
- * [OUT] size_t *		num_writ	how many bytes written - always set to 0
- */
-static
-rc_t CC KArcFileWrite (KArcFile *self, uint64_t pos,
-		       const void *buffer, size_t size,
-		       size_t *num_writ)
-{
-    assert (num_writ != NULL);
-
-    /* duplicates write in KFileWrite() so this can be deleted */
-    *num_writ = 0;
-
-    return RC (rcFS, rcArc, rcWriting, rcSelf, rcUnsupported);
-}
-
-
-
-static	KFile_vt_v1	vtKArcFile =
-{
-    /* version */
-    1, 1,
-
-    /* 1.0 */
-    KArcFileDestroy,
-    KArcFileGetSysFile,
-    KArcFileRandomAccess,
-    KArcFileSize,
-    KArcFileSetSize,
-    KArcFileRead,
-    KArcFileWrite,
-
-    /* 1.1 */
-    KArcFileType
-};
-
-/*-----------------------------------------------------------------------
- * KArcFileMake
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [OUT] KArcFile ** 		self		were to put a reference to the newly allocated
- *						KArcFile structure
- * [IN]  const KFile *		archive		The KFile for the archive containing this archive
- * [IN]  const KArcToc *	toc		The controlling TOC for the Archive File
- * [IN]  const KTocEntry *	node		The specific node somewhere in that TOC for this file
- */
-static
-rc_t KArcFileMake (KArcFile ** self,
-		   const KFile * archive,
-		   const KToc * toc,
-		   const KTocEntry * node)
-{
-    rc_t	rc;
-    KArcFile *	pF;
-    uint64_t    size;
-
-    /* -----
-     * we can not accept any of the four parameters as NULL
-     */
-    assert (self != NULL);
-    assert (archive != NULL);
-    assert (toc != NULL);
-    assert (node != NULL);
-
-    /* -----
-     * Proceed with non-NULL parameters
-     */
-    rc = KFileSize (archive, &size);
-    if (GetRCState(rc) == rcUnsupported)
-    {
-        size = ~(uint64_t)0;
-        rc = 0;
-    }
-
-    if (rc == 0)
-    {
-        /* we need to check chunked files here as well */
-        if (((node->type == ktocentrytype_file) &&
-             (node->u.contiguous_file.file_size > 0) &&
-             (size < (node->u.contiguous_file.file_size +
-                      node->u.contiguous_file.archive_offset))) ||
-            ((node->type == ktocentrytype_chunked) &&
-             (node->u.chunked_file.file_size > 0) &&
-             (size < (node->u.chunked_file.chunks[node->u.chunked_file.num_chunks-1].source_position +
-                      node->u.chunked_file.chunks[node->u.chunked_file.num_chunks-1].size))))
-            rc = RC (rcFS, rcFile, rcConstructing, rcArc, rcIncomplete);
-        else
-        {
-            /* get space for the object */
-            pF = malloc (sizeof * pF);
-            if (pF == NULL)	/* allocation failed */
-            {
-                /* fail */
-                rc = RC (rcFS, rcFile, rcConstructing, rcMemory, rcExhausted);
-            }
-            else
-            {
-                rc = KFileInit (&pF->dad,				/* initialize base class */
-                                (const KFile_vt*)&vtKArcFile,	/* VTable for KArcFile */
-                                "KArcFile", "no-name",
-                                true,				/* read allowed */
-                                false);				/* write disallowed */
-                if (rc == 0)
-                {
-                    /* succeed */
-                    pF->toc = toc;					/* shared TOC */
-                    KTocAddRef(toc);				/* keep alive reference */
-                    pF->node = node;				/* file specific TOC entry */
-                    pF->archive = archive;				/* shared archive file */
-                    KFileAddRef(archive);				/* keep alive reference */
-                    *self = pF;					/* and to the output */
-                }
-                if (rc != 0)
-                    /* fail */
-                    free (pF);
-            }
-	}
-    }
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * KArcDirVisit
- *  visit each path under designated directory,
- *  recursively if so indicated
- *
- *  "recurse" [ IN ] - if non-zero, recursively visit sub-directories
- *
- *  "f" [ IN ] and "data" [ IN, OPAQUE ] - function to execute
- *  on each path. receives a base directory and relative path
- *  for each entry, where each path is also given the leaf name
- *  for convenience. if "f" returns non-zero, the iteration will
- *  terminate and that value will be returned. NB - "dir" will not
- *  be the same as "self".
- *
- *  "path" [ IN ] - NUL terminated string in directory-native character set
- */
-static 
-rc_t CC KArcDirVisit (const KArcDir *self, 
-                      bool recurse,
-                      rc_t (CC* f) (const KDirectory *, uint32_t, const char *, void *), 
-                      void *data,
-                      const char *path,
-                      va_list args)
-{
-    char * full_path;
-    rc_t   rc;
-
-
-    /* -----
-     * First fix the path to make it useable
-     */
-    rc = KArcDirMakePath (self, rcVisiting, true, &full_path, path, args);
-    if (rc != 0)
-    {
-	LOGERR (klogInt, rc, "failed to make path in Visit");
-    }
-    else
-    {
-	const KTocEntry * pnode;
-	KTocEntryType	type;
-
-	/* -----
-	 * Now find that path as a node and validate it is a directory
-	 */
-	rc = KArcDirResolvePathNode(self, rcListing, full_path, true, &pnode, &type);
-	if (rc != 0)
-	{
-	    PLOGERR (klogInt, (klogInt, rc, "failed to resolve path $(P) in Visit", "P=%s", full_path));
-	}
-	else
-	{
-	    if ((type == ktocentrytype_dir) || (type == ktocentrytype_hardlink))
-	    {
-		KArcDir * full_dir;
-		uint32_t path_size;
-
-		/* -----
-		 * make a locally accessible private KDirectory/KArcDir
-		 */
-		for ( path_size = (uint32_t)strlen ( full_path );
-		      ( path_size > self->root ) && ( full_path[ path_size - 1 ] == '/' );
-		      -- path_size )
-		{}
-		rc = KArcDirMake (&full_dir, 
-				  rcVisiting,
-				  self->parent,
-				  self->toc,
-				  pnode,
-				  self->archive.v,
-				  self->arctype,
-				  self->root,
-				  full_path,
-				  path_size, 
-				  true,
-				  false);
-		if (rc == 0)
-		{
-		    KArcDirVisitData pb;
-
-		    pb.f = f;
-		    pb.data = data;
-		    pb.dir = full_dir;
-		    pb.recurse = recurse;
-/*		    pb.dir.path[--pb.dir.size] = 0; */
-
-		    rc = KArcDirVisitDir (&pb);
-
-		    KArcDirDestroy (full_dir);
-		}
-	    }
-	    else
-	    {
-		rc = RC (rcFS, rcDirectory, rcVisiting, rcPath, rcIncorrect);
-		LOGERR (klogInt, rc, "Type is not a directory");
-	    }
-	}
-	free (full_path);
-    }
-    return rc;
-}
-
-/* ----------------------------------------------------------------------
- * KArcDirVisitUpdate
- */
-static rc_t CC KArcDirVisitUpdate (KArcDir *self,
-                                   bool recurse,
-                                   rc_t (CC*f) (KDirectory *,uint32_t,const char *,void *),
-                                   void *data,
-                                   const char *path,
-                                   va_list args)
-{
-    return RC (rcFS, rcDirectory, rcUpdating, rcSelf, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * KArcDirResolvePath
- *
- *  resolves path to an absolute or directory-relative path
- *
- * [IN]  const KArcDir *self		Objected oriented self
- * [IN]	 bool 		absolute	if non-zero, always give a path starting
- *  					with '/'. NB - if the directory is 
- *					chroot'd, the absolute path
- *					will still be relative to directory root.
- * [OUT] char *		resolved	buffer for NUL terminated result path in 
- *					directory-native character set
- * [IN]	 size_t		rsize		limiting size of resolved buffer
- * [IN]  const char *	path		NUL terminated string in directory-native
- *					character set denoting target path. 
- *					NB - need not exist.
- *
- * NOTE: Does not meet a design target of on stack (localized variable) allocation of single 4kb path
- */
-static rc_t CC KArcDirResolvePath (const KArcDir *self,
-                                   bool absolute,
-                                   char *resolved,
-                                   size_t rsize,
-                                   const char *path,
-                                   va_list args)
-{
-    char * full;
-    rc_t   rc; 
-
-    assert (self != NULL);
-    assert (resolved != NULL);
-    assert (path != NULL);
-
-    rc = KArcDirMakePath (self, rcResolving, true, &full, path, args);
-
-    if (rc == 0)
-    {
-	uint32_t path_size = (uint32_t)strlen ( full );
-
-	if (absolute)
-	{
-	    /* test buffer capacity -  this is a limitation of KDirectory not in KArcDir */
-	    if ((path_size - self->root) >= rsize)
-	    {
-		rc =  RC (rcFS, rcDirectory, rcResolving, rcBuffer, rcInsufficient);
-	    }
-	    else
-	    {
-		/* ready to go */
-		strcpy (resolved, & full[self->root]);
-		assert (resolved[0] == '/');
-	    }
-	}
-	else
-	{
-	    rc = KArcDirRelativePath (self, rcResolving, self->path, full, path_size);
-	    if (rc == 0)
-	    {
-		path_size = (uint32_t)strlen ( full );
-		/* test buffer capacity -  this is a limitation of KDirectory not in KArcDir */
-		if (path_size >= rsize)
-		{
-		    rc = RC (rcFS, rcDirectory, rcResolving, rcBuffer, rcInsufficient);
-		}
-		else
-		{
-		    strcpy (resolved, full);
-		}
-	    }
-	}
-    }
-    if (full != NULL)
-	free (full);
-
-    return rc;
-}
-
-/* ----------------------------------------------------------------------
- * KArcDirResolveAlias
- *  resolves an alias path to its immediate target
- *  NB - the resolved path may be yet another alias
- *
- *  "alias" [ IN ] - NUL terminated string in directory-native
- *  character set denoting an object presumed to be an alias.
- *
- *  "resolved" [ OUT ] and "rsize" [ IN ] - buffer for
- *  NUL terminated result path in directory-native character set
- *
- * NOTE: Does not meet a design target of on stack (localized variable) allocation of single 4kb path
- */
-static rc_t CC KArcDirResolveAlias (const KArcDir * self, 
-				 bool absolute,
-				 char * resolved,
-				 size_t rsize,
-				 const char *alias,
-				 va_list args)
-{
-    char *		full_path;
-    const char *	link_path;
-    const KTocEntry * pnode;
-    KTocEntryType	type;
-    rc_t		rc;
-    size_t		ssize;
-
-    assert (self != NULL);
-    assert (resolved != NULL);
-    assert (alias != NULL);
-
-    rc = KArcDirMakePath (self, rcResolving, true,
-			  &full_path, alias, args);
-
-    if (rc != 0)
-    {
-	/* can't "fix" path */
-	/*rc = RC (rcFS, rcDirectory, rcResolving, rcPath, rcInvalid); ? or tweak it? */
-    }
-    else
-    {
-	/* first find the node and it has to be an alias */
-	rc = KArcDirResolvePathNode (self, rcResolving, alias, false, &pnode, &type);
-
-	if (rc != 0)
-	{
-	    /*rc = RC (rcFS, rcDirectory, rcResolving, rcPath, rcInvalid); ? or tweak it? */
-	}
-	else if (type != ktocentrytype_softlink)
-	{
-	    rc = RC (rcFS, rcDirectory, rcResolving, rcLink, rcInvalid);
-	}
-	else
-	{
-	    rc = KTocEntryGetSoftTarget(pnode, &link_path);
-	    if (rc != 0)
-	    {
-		/* can't "fix" path */
-		/*rc = RC (rcFS, rcDirectory, rcResolving, rcPath, rcInvalid); ? or tweak it? */
-	    }
-	    else
-	    {
-		ssize = strlen(link_path);
-		if (ssize > rsize)
-		{
-		    rc = RC (rcFS, rcDirectory,rcResolving, rcParam, rcInsufficient);
-		}
-		else
-		{
-		    strcpy (resolved, link_path);
-		}
-	    }
-	}
-    }
-    return rc;
-}
-
-/* ----------------------------------------------------------------------
- * KArcDirRename
- *  rename an object accessible from directory, replacing
- *  any existing target object of the same type
- *
- *  "from" [ IN ] - NUL terminated string in directory-native
- *  character set denoting existing object
- *
- *  "to" [ IN ] - NUL terminated string in directory-native
- *  character set denoting existing object
- */
-static
-rc_t CC KArcDirRename (KArcDir *self, bool force, const char *from, const char *to)
-{
-    assert (self != NULL);
-    assert (from != NULL);
-    assert (to != NULL);
-
-    return RC (rcFS, rcArc, rcUpdating, rcSelf, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * KArcDirRemove
- *  remove an accessible object from its directory
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- *
- *  "force" [ IN ] - if non-zero and target is a directory,
- *  remove recursively
- */
-static
-rc_t CC KArcDirRemove (KArcDir *self, bool force, const char *path, va_list args)
-{
-    assert (self != NULL);
-    assert (path != NULL);
-
-    return RC (rcFS, rcArc, rcUpdating, rcSelf, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * KArcDirClearDir
- *  remove all directory contents
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target directory
- *
- *  "force" [ IN ] - if non-zero and directory entry is a
- *  sub-directory, remove recursively
- */
-static
-rc_t CC KArcDirClearDir (KArcDir *self, bool force, const char *path, va_list args)
-{
-    assert (self != NULL);
-    assert (path != NULL);
-
-    return RC (rcFS, rcArc, rcUpdating, rcSelf, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * KArcDirAccess
- *  get access to object
- *
- *  "access" [ OUT ] - return parameter for Unix access mode
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- * NOTE: Does not meet a design target of on stack (localized variable) allocation of single 4kb path
- */
-static rc_t CC KArcDirVAccess (const KArcDir *self,
-			    uint32_t *access,
-			    const char *path,
-			    va_list args)
-{
-    const KTocEntry *	entry;
-    rc_t 		rc;
-    uint32_t		acc;
-    KTocEntryType	type;
-    char * 		full;
-
-    assert (self != NULL);
-    assert (access != NULL);
-    assert (path != NULL);
-
-    /* -----
-     * by C standard the nested ifs (if A { if B { if C ... could have been if A && B && C
-     */
-    if ((rc = KArcDirMakePath (self, rcAccessing, false, &full, path, args)) == 0)
-    {
-	if ((rc = KArcDirResolvePathNode (self, rcAccessing, path, true, &entry, &type)) == 0)
-	{
-	    if ((rc = KTocEntryGetAccess (entry, &acc)) == 0)
-	    {
-                /*
-                 * We want to filter the access because within an Archive
-                 * a file is unwritable
-                 */
-		*access = acc & ~(S_IWRITE|S_IWGRP|S_IWOTH);
-		rc = 0;
-	    }
-	}
-    }
-    if (full != NULL)
-	free (full);
-    return rc;
-}
-
-/* ----------------------------------------------------------------------
- * KArcDirSetAccess
- *  set access to object a la Unix "chmod"
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- *
- *  "access" [ IN ] and "mask" [ IN ] - definition of change
- *  where "access" contains new bit values and "mask defines
- *  which bits should be changed.
- *
- *  "recurse" [ IN ] - if non zero and "path" is a directory,
- *  apply changes recursively.
- */
-static rc_t CC KArcDirSetAccess (KArcDir *self,
-			      bool recurse,
-			      uint32_t access,
-			      uint32_t mask,
-			      const char *path,
-			      va_list args)
-{
-    assert (self != NULL);
-    assert (path != NULL);
-
-    return RC (rcFS, rcArc, rcUpdating, rcSelf, rcUnsupported);
-}
-
-
-static	rc_t CC KArcDirVDate		(const KArcDir *self,
-					 KTime_t *date,
-					 const char *path,
-					 va_list args)
-{
-/*     const KToc *	toc; */
-    const KTocEntry * node;
-    rc_t 		rc;
-    KTime_t		ldate;
-    KTocEntryType	type;
-    char * 		full;
-
-    assert (self != NULL);
-    assert (date != NULL);
-    assert (path != NULL);
-
-    /* -----
-     * by C standard the nested ifs (if A { if B { if C ... could have been if A && B && C
-     */
-    if ((rc = KArcDirMakePath (self, rcAccessing, false, &full, path, args)) == 0)
-    {
-/* 	if ((rc = KArcDirGetTOC (self, &toc)) == 0) */
-/* 	{ */
-	if ((rc = KArcDirResolvePathNode (self, rcAccessing, path, true, &node, &type)) == 0)
-	{
-	    if ((rc = KTocEntryGetTime (node, &ldate)) == 0)
-	    {
-		*date =  ldate;
-		rc = 0;
-	    }
-	}
-/* 	} */
-    }
-    if (full != NULL)
-	free (full);
-    return rc;
-}
-static	rc_t CC KArcDirSetDate		(KArcDir *self,
-					 bool recurse,
-					 KTime_t date,
-					 const char *path,
-					 va_list args)
-{
-    assert (self != NULL);
-    assert (path != NULL);
-
-    return RC (rcFS, rcArc, rcUpdating, rcSelf, rcUnsupported);
-}
-
-static
-struct KSysDir *CC KArcDirGetSysDir ( const KArcDir *self )
-{
-    return NULL;
-}
-
-/* ----------------------------------------------------------------------
- * KArcDirCreateAlias
- *  creates a path alias according to create mode
- *
- *  "targ" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- *
- *  "alias" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target alias
- *
- *  "access" [ IN ] - standard Unix directory access mode
- *  used when "mode" has kcmParents set and alias path does
- *  not exist.
- *
- *  "mode" [ IN ] - a creation mode (see explanation above).
- */
-static
-rc_t CC KArcDirCreateAlias (KArcDir *self,
-			 uint32_t access,
-			 KCreateMode mode,
-			 const char *targ,
-			 const char *alias)
-{
-    assert (self != NULL);
-    assert (targ != NULL);
-    assert (alias != NULL);
-
-    return RC (rcFS, rcArc, rcCreating, rcSelf, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * KArcDirOpenFileRead
- *  opens an existing file with read-only access
- *
- *  "f" [ OUT ] - return parameter for newly opened file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- * NOTE: Does not meet a design target of on stack (localized variable) allocation of single 4kb path
- */
-static
-rc_t CC KArcDirOpenFileRead	(const KArcDir *self,
-					 const KFile **f,
-					 const char *path,
-					 va_list args)
-{
-    char *	full_path = NULL;
-    rc_t	rc;
-
-    assert (self != NULL);
-    assert (f != NULL);
-    assert (path != NULL);
-
-    rc = KArcDirMakePath (self, rcOpening, true, &full_path, path, args);
-
-    if (rc == 0)
-    {
-	const KTocEntry * pnode;
-	KTocEntryType     type;
-
-	rc = KArcDirResolvePathNode (self, rcOpening, full_path, true, &pnode, &type);
-
-	if (rc == 0)
-	{
-
-	    switch (type)
-	    {
-	    case ktocentrytype_unknown:
-	    case ktocentrytype_dir:
-	    case ktocentrytype_softlink:
-	    case ktocentrytype_hardlink:
-	    default:
-		rc = RC (rcFS, rcDirectory, rcOpening, rcFile, rcInvalid);
-		break;
-	    case ktocentrytype_emptyfile:
-	    case ktocentrytype_file:
-	    case ktocentrytype_chunked:
-		rc = KArcFileMake ((KArcFile**)f, self->archive.v, self->toc, pnode);
-		break;
-	    }
-	}
-	free (full_path);
-    }    
-    return rc;
-}
-
-/* ----------------------------------------------------------------------
- * KArcDirOpenFileWrite
- *  opens an existing file with write access
- *
- *  "f" [ OUT ] - return parameter for newly opened file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- *
- *  "update" [ IN ] - if non-zero, open in read/write mode
- *  otherwise, open in write-only mode
- */
-static
-rc_t CC KArcDirOpenFileWrite	(KArcDir *self,
-					 KFile **f,
-					 bool update,
-					 const char *path,
-					 va_list args)
-{
-    assert (self != NULL);
-    assert (f != NULL);
-    assert (path != NULL);
-
-    return RC (rcFS, rcArc, rcCreating, rcSelf, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * KArcDirCreateFile
- *  opens a file with write access
- *
- *  "f" [ OUT ] - return parameter for newly opened file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- *
- *  "access" [ IN ] - standard Unix access mode, e.g. 0664
- *
- *  "update" [ IN ] - if non-zero, open in read/write mode
- *  otherwise, open in write-only mode
- *
- *  "mode" [ IN ] - a creation mode (see explanation above).
- */
-static
-rc_t CC KArcDirCreateFile	(KArcDir *self,
-					 KFile **f,
-					 bool update,
-					 uint32_t access,
-					 KCreateMode cmode,
-					 const char *path,
-					 va_list args)
-{
-    assert (self != NULL);
-    assert (f != NULL);
-    assert (path != NULL);
-
-    return RC (rcFS, rcArc, rcCreating, rcSelf, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * KArcDirFileLocator
- *  returns locator in bytes of target file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- *
- *  "locator" [ OUT ] - return parameter for file locator
- * NOTE: Does not meet a design target of on stack (localized variable) allocation of single 4kb path
- */
-static
-rc_t CC KArcDirFileLocator		(const KArcDir *self,
-					 uint64_t *locator,
-					 const char *path,
-					 va_list args)
-{
-    char *		full_path;
-    rc_t		rc;
-
-    assert (self != NULL);
-    assert (locator != NULL);
-    assert (path != NULL);
-
-    rc = KArcDirMakePath (self, rcResolving, true,
-			  &full_path, path, args);
-
-    if (rc != 0)
-    {
-	/* can't "fix" path */
-	/*rc = RC (rcFS, rcDirectory, rcResolving, rcPath, rcInvalid); ? or tweak it? */
-    }
-    else
-    {
-	const KTocEntry * pnode;
-	KTocEntryType     type;
-
-	rc = KArcDirResolvePathNode (self, rcResolving, full_path, /*follow links*/true, &pnode, &type);
-
-	if (rc != 0)
-	{
-	    /* can't resolve path */
-	    /*rc = RC (rcFS, rcDirectory, rcResolving, rcPath, rcInvalid); ? or tweak it? */
-	}
-	else
-	{
-	    uint64_t	flocator;
-
-	    rc = KTocEntryGetFileLocator(pnode, &flocator);
-	    if (rc != 0)
-	    {
-		/* can't "fix" path */
-		/*rc = RC (rcFS, rcDirectory, rcResolving, rcPath, rcInvalid); ? or tweak it? */
-	    }
-	    else
-	    {
-		*locator = flocator;
-	    }
-	}
-	free (full_path);
-    }
-    return rc;
-}
-
-/* ----------------------------------------------------------------------
- * KArcDirFileSize
- *  returns size in bytes of target file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- *
- *  "size" [ OUT ] - return parameter for file size
- * NOTE: Does not meet a design target of on stack (localized variable) allocation of single 4kb path
- */
-static
-rc_t CC KArcDirFileSize		(const KArcDir *self,
-					 uint64_t *size,
-					 const char *path,
-					 va_list args)
-{
-    char *		full_path;
-    rc_t		rc;
-
-    assert (self != NULL);
-    assert (size != NULL);
-    assert (path != NULL);
-
-    rc = KArcDirMakePath (self, rcResolving, true,
-			  &full_path, path, args);
-
-    if (rc != 0)
-    {
-	/* can't "fix" path */
-	/*rc = RC (rcFS, rcDirectory, rcResolving, rcPath, rcInvalid); ? or tweak it? */
-    }
-    else
-    {
-	const KTocEntry * pnode;
-	KTocEntryType     type;
-
-	rc = KArcDirResolvePathNode (self, rcResolving, full_path, /*follow links*/true, &pnode, &type);
-
-	if (rc != 0)
-	{
-	    /* can't resolve path */
-	    /*rc = RC (rcFS, rcDirectory, rcResolving, rcPath, rcInvalid); ? or tweak it? */
-	}
-	else
-	{
-	    uint64_t	fsize;
-
-	    rc = KTocEntryGetFileSize(pnode, &fsize);
-	    if (rc != 0)
-	    {
-		/* can't "fix" path */
-		/*rc = RC (rcFS, rcDirectory, rcResolving, rcPath, rcInvalid); ? or tweak it? */
-	    }
-	    else
-	    {
-		*size = fsize;
-	    }
-	}
-	free (full_path);
-    }
-    return rc;
-}
-
-/* ----------------------------------------------------------------------
- * KArcDirFileSize
- *  returns size in bytes of target file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- *
- *  "size" [ OUT ] - return parameter for file size
- * NOTE: Does not meet a design target of on stack (localized variable) allocation of single 4kb path
- */
-static
-rc_t CC KArcDirFilePhysicalSize		(const KArcDir *self,
-					 uint64_t *size,
-					 const char *path,
-					 va_list args)
-{
-    char *		full_path;
-    rc_t		rc;
-
-    assert (self != NULL);
-    assert (size != NULL);
-    assert (path != NULL);
-
-    rc = KArcDirMakePath (self, rcResolving, true,
-			  &full_path, path, args);
-
-    if (rc != 0)
-    {
-	/* can't "fix" path */
-	/*rc = RC (rcFS, rcDirectory, rcResolving, rcPath, rcInvalid); ? or tweak it? */
-    }
-    else
-    {
-	const KTocEntry * pnode;
-	KTocEntryType     type;
-
-	rc = KArcDirResolvePathNode (self, rcResolving, full_path, /*follow links*/true, &pnode, &type);
-
-	if (rc != 0)
-	{
-	    /* can't resolve path */
-	    /*rc = RC (rcFS, rcDirectory, rcResolving, rcPath, rcInvalid); ? or tweak it? */
-	}
-	else
-	{
-	    uint64_t	fsize;
-
-	    rc = KTocEntryGetFilePhysicalSize(pnode, &fsize);
-	    if (rc != 0)
-	    {
-		/* can't "fix" path */
-		/*rc = RC (rcFS, rcDirectory, rcResolving, rcPath, rcInvalid); ? or tweak it? */
-	    }
-	    else
-	    {
-		*size = fsize;
-	    }
-	}
-	free (full_path);
-    }
-    return rc;
-}
-
-/* ----------------------------------------------------------------------
- * KArcDirSetFileSize
- *  sets size in bytes of target file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- *
- *  "size" [ IN ] - new file size
- */
-static
-rc_t CC KArcDirSetFileSize	(KArcDir *self,
-					 uint64_t size,
-					 const char *path,
-					 va_list args)
-{
-    assert (self != NULL);
-    assert (path != NULL);
-
-    return RC (rcFS, rcArc, rcWriting, rcSelf, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * KArcDirOpenDirRead
- *
- *  opens a sub-directory
- *
- * [IN]  const KArcDir *	self	Object Oriented C KArcDir self
- * [OUT] const KDirectory **	subp	Where to put the new KDirectory/KArcDir
- * [IN]  bool			chroot	Create a chroot cage for this new subdirectory
- * [IN]  const char *		path	Path to the directory to open
- * [IN]  va_list		args	So far the only use of args is possible additions to path
- */
-static 
-rc_t CC KArcDirOpenDirRead	(const KArcDir *self,
-					 const KDirectory **subp,
-					 bool chroot,
-					 const char *path,
-					 va_list args)
-{
-    char * full;
-    rc_t rc;
-
-    assert (self != NULL);
-    assert (subp != NULL);
-    assert (path != NULL);
-
-    rc = KArcDirMakePath (self, rcOpening, true, &full, path, args);
-    if (rc == 0)
-    {
-	const KTocEntry *	pnode;
-	KTocEntryType		type;
-	size_t path_size = strlen (full);
-
-	/* -----
-	 * get rid of any extra '/' characters at the end of path
-	 */
-	while (path_size > 0 && full [ path_size - 1 ] == '/')
-	    full [ -- path_size ] = 0;
-
-	/* -----
-	 * get the node for this path 
-	 */
-	rc = KArcDirResolvePathNode (self, rcOpening, full, true, &pnode, &type);
-	if (rc == 0)
-	{
-            switch (type)
-            {
-            default:
-		/* fail */
-		rc = RC (rcFS, rcDirectory, rcOpening, rcPath, rcIncorrect);
-                break;
-            case ktocentrytype_dir:
-            case ktocentrytype_hardlink:
-	    {
-		KArcDir *	sub;
-
-		rc = KArcDirMake (&sub,
-				  rcOpening,
-				  self->parent,
-				  self->toc,
-				  pnode,
-				  self->archive.v,
-				  self->arctype,
-				  self->root,
-				  full,
-				  (uint32_t)path_size,
-				  false,
-				  chroot);
-		if (rc == 0)
-		{
-		    /* succeed */
-		    *subp = &sub->dad;
-		}
-	    }
-            }
-	}
-	free (full);
-    }
-    return rc;
-}
-
-/* ----------------------------------------------------------------------
- * KArcDirOpenDirUpdate
- *  opens a sub-directory
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target directory
- *
- *  "chroot" [ IN ] - if non-zero, the new directory becomes
- *  chroot'd and will interpret paths beginning with '/'
- *  relative to itself.
- */
-static
-rc_t CC KArcDirOpenDirUpdate	(KArcDir *self,
-					 KDirectory ** subp, 
-					 bool chroot, 
-					 const char *path, 
-					 va_list args)
-{
-    assert (self != NULL);
-    assert (subp != NULL);
-    assert (path != NULL);
-
-    return RC (rcFS, rcArc, rcUpdating, rcSelf, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * KArcDirCreateDir
- *  create a sub-directory
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target directory
- *
- *  "access" [ IN ] - standard Unix directory permissions
- *
- *  "mode" [ IN ] - a creation mode (see explanation above).
- */
-static
-rc_t CC KArcDirCreateDir	(KArcDir *self,
-					 uint32_t access,
-					 KCreateMode mode,
-					 const char *path,
-					 va_list args)
-{
-    assert (self != NULL);
-    assert (path != NULL);
-
-    return RC (rcFS, rcArc, rcCreating, rcSelf, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * KArcDirDestroyFile
- */
-static
-rc_t CC KArcDirDestroyFile	(KArcDir *self,
-					 KFile * f)
-{
-    assert (self != NULL);
-    assert (f != NULL);
-
-    return RC (rcFS, rcArc, rcDestroying, rcSelf, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * KArcDirFileContiguous
- *  
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- *
- *  "contiguous" [ OUT ] - return parameter for file status
- * NOTE: Does not meet a design target of on stack (localized variable) allocation of single 4kb path
- */
-static
-rc_t CC KArcDirFileContiguous		(const KArcDir *self,
-                                         bool * contiguous,
-					 const char *path,
-					 va_list args)
-{
-    char *		full_path;
-    rc_t		rc;
-
-    assert (self != NULL);
-    assert (contiguous != NULL);
-    assert (path != NULL);
-
-    rc = KArcDirMakePath (self, rcResolving, true,
-			  &full_path, path, args);
-
-    if (rc != 0)
-    {
-	/* can't "fix" path */
-	/*rc = RC (rcFS, rcDirectory, rcResolving, rcPath, rcInvalid); ? or tweak it? */
-    }
-    else
-    {
-	const KTocEntry * pnode;
-	KTocEntryType     type;
-
-	rc = KArcDirResolvePathNode (self, rcResolving, full_path, /*follow links*/true, &pnode, &type);
-
-	if (rc != 0)
-	{
-	    /* can't resolve path */
-	    /*rc = RC (rcFS, rcDirectory, rcResolving, rcPath, rcInvalid); ? or tweak it? */
-	}
-	else
-	{
-	    switch (type)
-	    {
-	    default:
-                *contiguous = false;
-		break;
-	    case ktocentrytype_emptyfile:
-	    case ktocentrytype_file:
-                *contiguous = true;
-		break;
-	    }
-	}
-	free (full_path);
-    }
-    return rc;
-}
-
-/* ----------------------------------------------------------------------
- *
- */
-static KDirectory_vt_v1 vtKArcDir =
-{
-    /* version 1.0 */
-    1, 3,
-
-    /* start minor version 0 methods*/
-    KArcDirDestroy,
-    KArcDirList,
-    KArcDirVisit,
-    KArcDirVisitUpdate,
-    KArcDirPathType,
-    KArcDirResolvePath,
-    KArcDirResolveAlias,
-    KArcDirRename,
-    KArcDirRemove,
-    KArcDirClearDir,
-    KArcDirVAccess,
-    KArcDirSetAccess,
-    KArcDirCreateAlias,
-    KArcDirOpenFileRead,
-    KArcDirOpenFileWrite,
-    KArcDirCreateFile,
-    KArcDirFileSize,
-    KArcDirSetFileSize,
-    KArcDirOpenDirRead,
-    KArcDirOpenDirUpdate,
-    KArcDirCreateDir,
-    KArcDirDestroyFile,
-    /* end minor version 0 methods*/
-    /* start minor version 1 methods*/
-    KArcDirVDate,
-    KArcDirSetDate,
-    KArcDirGetSysDir,
-    /* end minor version 2 methods*/
-    KArcDirFileLocator,
-    /* end minor version 2 methods*/
-    /* end minor version 3 methods*/
-    KArcDirFilePhysicalSize,
-    KArcDirFileContiguous
-    /* end minor version 3 methods*/
-};
-
-/* ----------------------------------------------------------------------
- * KArcDirMake
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [IN] KArcDir **		self		objected oriented c "self"
- * [IN] enum RCContext 		ctx		context to use when passing along rc_t
- * [IN] const KDirectory * 	parent		KDirectory type for path before the archive
- * [IN] const KToc * 	toc		table of contents for the archive
- * [IN] const KTocEntry * 	node		this directory's node within the TOC
- * [IN] const KFile * 		archive		open archive file as KFile
- * [IN] uint32_t 		dad_root	offset of end of "root" within the path
- * [IN] const char *		path		path all the way back to file system root not
- *						effective but real root
- * [IN] uint32_t		path_size	length of path
- * [IN] bool			update		!read_only -- ignored for now and forced read_only
- * [IN] bool			chroot		make this a chroot to dad root?
- */
-static
-rc_t	KArcDirMake	(KArcDir ** self,
-                         enum RCContext ctx,
-                         const KDirectory * parent,
-                         const KToc * toc,
-                         const KTocEntry * node,
-                         const void * archive,
-                         KArcFSType baseType,
-                         uint32_t dad_root,
-                         const char *path,
-                         uint32_t path_size,
-                         bool update, /* ignored */
-                         bool chroot)
-{
-    KArcDir * dir;
-    rc_t rc;
-
-    assert (self != NULL);
-    assert (parent != NULL);
-    assert (toc != NULL);
-    /* node will be NULL at base archive file */
-    assert (archive != NULL);
-    assert (path != NULL);
-
-    dir = malloc ((sizeof(KArcDir) - sizeof dir->path) + path_size + 2);
-
-    if (dir == NULL)
-    {
-        *self = NULL;
-	return RC (rcFS, rcArc, rcCreating, rcMemory, rcExhausted);
-    }
-
-    dir->toc = NULL;
-    dir->archive.v = NULL;
-
-    rc = KDirectoryInit (&dir->dad, (const KDirectory_vt*) &vtKArcDir,
-                         "KArcDir", path,
-			 /* update*/ false); /* force KDirectory to read_only here */
-    if (rc != 0)
-    {
-        free (dir);
-        return ResetRCContext (rc, rcFS, rcDirectory, ctx);
-    }
-
-    dir->parent = parent;
-    dir->toc = toc;
-    KTocAddRef(toc);
-    dir->node = node;
-    dir->arctype = baseType;
-    dir->archive.v = archive;
-
-    switch (baseType)
-    {
-    default:
-        free (dir);
-        return RC (rcFS, rcArc, rcConstructing, rcParam, rcInvalid);
-    case tocKFile:
-        KFileAddRef (archive);
-        break;
-    case tocKDirectory:
-        KDirectoryAddRef (archive);
-        break;
-    }
-    memcpy (dir->path, path, path_size);
-    dir->root = chroot ? path_size : dad_root;
-    dir->size = path_size+1; /* make space for the next two operations */
-    dir->path [path_size] = '/';
-    dir->path [path_size+1] = 0;
-    *self = dir;
-    return 0;
-}
-
-
-/* ----------------------------------------------------------------------
- * KArcDirGetTOC
- *
- * [IN]  const KArcDir * 	self	Object oriented C
- * [OUT] const KToc ** 	toc	Where to put a pointer to the TOC for the KArcDir
- *
- * Set a pointer to point the TOC for this KArcDir(KDirectory)
- */
-rc_t KArcDirGetTOC (const KArcDir * self,
-                    const struct KToc ** toc)
-{
-    assert (self != NULL);
-    assert (toc != NULL);
-
-    *toc = self->toc;
-    return 0;
-}
-
-
-/* ----------------------------------------------------------------------
- * KDirectoryToKArcDir
- *
- * [IN]  const KDirectory * 	self	Object oriented C
- * [OUT] const KArcDir * 	cast	Object oriented C
- *
- *
- * Get a reference to a KArcDir from a KDirectory as a cast.  It is a new reference.
- */
-
-LIB_EXPORT rc_t CC KDirectoryToKArcDir (const KDirectory * self, const KArcDir ** cast)
-{
-    rc_t rc;
-    if ( cast == NULL )
-        rc = RC ( rcFS, rcArc, rcCasting, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcFS, rcArc, rcCasting, rcSelf, rcNull );
-        else
-        {
-            if (self->vt != (const KDirectory_vt*)&vtKArcDir)
-                rc = RC ( rcFS, rcArc, rcCasting, rcSelf, rcIncorrect );
-            else
-            {
-                rc = KDirectoryAddRef ( self );
-                if ( rc == 0 )
-                {
-                    * cast = (const KArcDir*)self;
-                    return 0;
-                }
-            }
-        }
-
-        * cast = NULL;
-    }
-
-    return rc;
-}
-
-
-static
-rc_t KDirectoryOpenArcDirRead_intern( const KDirectory * self,
-                                      const KDirectory ** pdir,
-                                      bool chroot,
-                                      bool silent,
-                                      const char * path,
-                                      KArcFSType baseType,
-                                      void * _archive,
-                                      rc_t ( CC * parse )( KToc *, const void *,
-                                                           bool( CC* )( const KDirectory*,
-                                                                        const char *, void*),
-                                                           void * ),
-                                      bool( CC* filter )( const KDirectory*, const char *, void * ),
-                                      void * filterparam )
-{
-    union
-    {
-        const void * v;
-        const KFile * f;
-        const KDirectory * d;
-    } archive;
-    KArcDir * arcdir = NULL;
-    KToc   * toc = NULL;
-    String   spath;
-    size_t   pathlen;
-    rc_t     rc = 0;
-    rc_t     rcaux = 0;
-    char     cpath [ 4096 ];
-    uint32_t type;
-
-    archive.v = _archive;
-    /* -----
-     * sanity check parameters  The first bunch is from the base class KDirectory.
-     */
-    if ( pdir == NULL )
-    {
-        if ( !silent )
-            PLOGMSG ( klogErr, ( klogErr,
-                      "NULL parameter for the root KArcDir for $(file)",
-                       PLOG_S ( file ),
-                       path ) );
-        return RC ( rcFS, rcDirectory, rcOpening, rcDirectory, rcNull );
-    }
-    *pdir = NULL;
-
-    if ( self == NULL )
-    {
-        if ( !silent )
-            PLOGMSG ( klogErr, ( klogErr,
-                      "NULL parameter for self for $(file)",
-                      PLOG_S ( file ),
-                      path ) );
-        return RC ( rcFS, rcDirectory, rcOpening, rcSelf, rcNull );
-    }
-
-    if ( path == NULL )
-    {
-        if ( !silent )
-            PLOGMSG ( klogErr,( klogErr,
-                      "NULL parameter for the root KArcDir for $(file)",
-                      PLOG_S ( file ),
-                      path ) );
-        return RC ( rcFS, rcDirectory, rcAccessing, rcPath, rcNull );
-    }
-
-    if ( path[0] == 0x00 )
-    {
-        if ( !silent )
-            PLOGMSG ( klogErr,( klogErr,
-                      "NULL string for the root KArcDir for $(file)",
-                      PLOG_S ( file ),
-                      path ) );
-        return RC ( rcFS, rcDirectory, rcAccessing, rcPath, rcInvalid );
-    }
-
-    if (_archive == NULL)
-    {
-        /* -----
-         * we got a local String type mixed in along with ASCIZ cstrings
-         */
-        rc = KDirectoryResolvePath ( self, true, cpath, sizeof (cpath), path );
-        if ( rc == 0 )
-        {
-            size_t ln;
-            ln = strlen (cpath);
-            if ((cpath[ln-1] == '.')&&(cpath[ln-2] == '/'))
-                cpath[ln-2] = '\0';
-        }
-        else
-            return rc;
-    }
-    else
-    {
-        size_t ln;
-
-        rc = string_printf (cpath, sizeof cpath, &ln, path);
-        if ((rc == 0) && (ln > sizeof cpath))
-            rc = RC (rcFS, rcArc, rcOpening, rcBuffer, rcInsufficient);
-    }
-
-    StringInitCString ( &spath, cpath );
-    pathlen = strlen ( cpath );
-
-    if (_archive != NULL)
-    {
-        switch (baseType)
-        {
-        case tocKFile:
-            rc = KFileAddRef (_archive);
-            break;
-        case tocKDirectory:
-            rc = KDirectoryAddRef (_archive);
-            break;
-        default:
-            /* i dunno */
-            break;
-        }
-        if (rc)
-            return rc;
-    }
-    else
-    {
-        type = KDirectoryVPathType ( self, cpath, NULL );
-        switch ( type & ~kptAlias )
-        {
-        default:
-            rc = RC ( rcFS, rcArc, rcOpening, rcFile, rcUnexpected );
-            if ( !silent )
-                LOGERR (klogErr, rc, "Unusable file type" );
-            break;
-        case kptNotFound:
-        case kptBadPath:
-            rc = RC ( rcFS, rcArc, rcOpening, rcFile, rcNotFound );
-            break;
-
-        case kptFile:
-            /* -----
-             * Open the archive file as a KFILE for internal use
-             *
-             * Fail / quit if we couldn't
-             */
-            if ( baseType != tocKFile )
-            {
-                rc = RC ( rcFS, rcArc, rcOpening, rcFile, rcIncorrect );
-                if ( !silent )
-                    LOGERR ( klogErr, rc, "Mismatch of file type and expected type" );
-                return rc;
-            }
-
-            rc = KDirectoryVOpenFileRead ( self, &archive.f, cpath, NULL );
-            if ( rc != 0 && !silent )
-            {
-                PLOGERR ( klogErr, ( klogErr, rc,
-                                     "Failed to open archive file $(file)",
-                                     PLOG_S (file),
-                                     path ) );
-            }
-        
-            break;
-
-        case kptDir:
-            if ( baseType != tocKDirectory )
-            {
-                rc = RC ( rcFS, rcArc, rcOpening, rcFile, rcInconsistent );
-                if ( !silent )
-                    LOGERR ( klogErr, rc, "Mismatch of file type and expected type" );
-                return rc;
-            }
-
-            rc = KDirectoryVOpenDirRead ( self, &archive.d, false, cpath, NULL );
-            if ( rc != 0 && !silent )
-            {
-                PLOGMSG ( klogErr,
-                          ( klogErr, "Failed to open archive directory $(file)",
-                            PLOG_S ( file ), path ) );
-            }
-            break;
-        } /* switch ( type & ~kptAlias ) */
-    }
-    if ( rc == 0 )
-    {
-        /* -----
-         * Build the TOC necessary to get to all internal files and subdirectories
-         * Any sub KArcDir or KFile created will also need to reference the same TOC
-         */
-        rc = KTocInit ( &toc, &spath, baseType, archive.v, sraAlign4Byte );
-        if ( rc != 0 )
-        {
-            if ( !silent )
-                PLOGERR ( klogErr, 
-                     ( klogErr, rc, "Failed to initialize Table of Contents for $(path)", 
-                     PLOG_S ( path ), cpath ) );
-        }
-        else
-        {
-            const KTocEntry * node;
-
-            node = KTocGetRoot( toc );
-
-            rc = KArcDirMake (&arcdir,      /* where to build the KArcDir */
-                              rcAccessing,  /* funky RC replacement thingie */
-                              self,         /* parent KDirectory - for previous path */
-                              toc,          /* table of contents structure for this archive */
-                              node,         /* archive "root" has no node */
-                              archive.v,    /* KFile for the archive */
-                              baseType,     /* base type o archive */
-                              0,            /* dad_root */
-                              cpath,        /* path to archive will be the path of the directory */
-                              (uint32_t)pathlen, /* length of path (the Init will append "/") */
-                              true,         /* readonly */
-                              false);       /* not chroot */
-            if ( rc != 0 )
-            {
-                if ( !silent )
-                PLOGERR ( klogErr, 
-                          ( klogErr, rc, "Failed to allocate for the root KArcDir for $(file)",
-                          PLOG_S ( file ), path ) );
-            }
-            else
-            {
-                rc = parse( toc,archive.v, filter, filterparam );
-                if ( rc == RC ( rcFS, rcArc, rcParsing, rcToc, rcIncomplete ) )
-                {
-                    rcaux = rc;
-                    rc = 0;
-                }
-                if ( rc != 0 )
-                {
-                    if ( !silent )
-                        PLOGERR ( klogErr, 
-                             ( klogErr, rc, "Failed to parse $(file)",
-                             PLOG_S ( file ), cpath ) );
-                }
-                else
-                {
-                    *pdir = &arcdir->dad;
-                }
-            }
-        }
-    }
-    /* -----
-     * if rc is non-zero we failed somewhere above.
-     * Release allocated memory and exit with that error code.
-     */
-    if ( archive.v != NULL )
-    {
-        switch ( baseType )
-        {
-        default:
-            free ( (void*)archive.v );
-            break;
-        case tocKFile:
-            KFileRelease ( archive.f );
-            break;
-        case tocKDirectory:
-            KDirectoryRelease ( archive.d );
-            break;
-        }
-    }
-
-    rc = rc | rcaux;
-
-    if ( rc != 0 )
-    {
-        if ( arcdir != NULL )
-            KDirectoryRelease ( &arcdir->dad );
-        *pdir = NULL;
-    }
-
-    if ( toc != NULL )
-        KTocRelease ( toc );
-
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * KDirectoryOpenArcDirRead
- *  Open an archive file as a KDirectory derived type: made to match 
- *  KDirectoryOpenDirRead() where parse could be the first element of arg
- *
- * Much of the code in this function is copied directly from KDirectoryVOpenDirRead
- *
- * [IN]  dir   A KDirectory (of any derived type) to reach the archive file
- * [OUT] pdir  The KDirectory (of type KArcDir)
- * [IN]  chroot if non-zero, the new directory becomes chroot'd and interprets paths
- *       stating with '/'
- * [IN]  path   The path to the archive - this will decome the directory path
- * [IN]  parse  A pointer to the function needed to build a TOC by parsing the file
- *
- * This function is made difficult because a path is not a global type.  Where we
- * would like to be able to take path and args and have them parsed nicely as they
- * are for KSysDir or KArcDir with nearly identical functions those functions are
- * not available here as self is a KDirectory but we do not know and should not know
- * whether it is a KSysDir or KArcDir.  Unfortunately KSysDir was made overly opaque.
- * [this is a result of providing full encapsulation, i.e. KDirectory is ONLY an
- *  interface and there is no implementation provided.][well very little]
- * If we could take path and args (path and ...) and pass them to a function
- * equivalent to KSysDirMakePath we would be able to do this right.  Or if we could
- * ask the self what it's path was and what it considered size and root we could do
- * the path build here and tidy up properly what we got.  .As is, we have  to be more
- * limited.
- *
- * We will have to wait and fix this right in directory.c where we can instead have
- * an attempt to open using KDirectory[V]OpenDirRead() check if when it tries to
- * open a directory but instead finds it has been given a path it will try to parse 
- * the file using a known set of parse functions to see if the file can be treated
- * as a directory. Then this function can be called from KDirectoryOpenDirRead.
- */
-LIB_EXPORT rc_t CC KDirectoryOpenArcDirRead( const KDirectory * self,
-    const KDirectory ** pdir,
-    bool chroot,
-    const char * path,
-    KArcFSType baseType,
-    rc_t ( CC * parse )( KToc *, const void *,
-        bool( CC * )( const KDirectory *, const char *, void * ), void * ),
-    bool ( CC * filter )( const KDirectory*, const char *, void *),
-    void * filterparam )
-{
-    return KDirectoryOpenArcDirRead_intern( self,
-        pdir,
-        chroot, 
-        false,
-        path,
-        baseType,
-        NULL,
-        parse,
-        filter,
-        filterparam );
-}
-
-
-LIB_EXPORT rc_t CC KDirectoryOpenArcDirRead_silent( const KDirectory * self,
-    const KDirectory ** pdir,
-    bool chroot,
-    const char * path,
-    KArcFSType baseType,
-    rc_t ( CC * parse )( KToc *, const void *,
-        bool( CC * )( const KDirectory *, const char *, void * ), void * ),
-    bool ( CC * filter )( const KDirectory*, const char *, void *),
-    void * filterparam )
-{
-    return KDirectoryOpenArcDirRead_intern( self,
-        pdir,
-        chroot, 
-        true,
-        path, 
-        baseType,
-        NULL,
-        parse,
-        filter,
-        filterparam );
-}
-LIB_EXPORT rc_t CC KDirectoryOpenArcDirRead_silent_preopened( const KDirectory * self,
-    const KDirectory ** pdir,
-    bool chroot,
-    const char * path,
-    KArcFSType baseType,
-    void * archive,
-    rc_t ( CC * parse )( KToc *, const void *,
-        bool( CC * )( const KDirectory *, const char *, void * ), void * ),
-    bool ( CC * filter )( const KDirectory*, const char *, void *),
-    void * filterparam )
-{
-    return KDirectoryOpenArcDirRead_intern( self,
-        pdir,
-        chroot, 
-        true,
-        path, 
-        baseType,
-        archive,
-        parse,
-        filter,
-        filterparam );
-}
-
-
-/* ======================================================================
- * 
- */
-typedef struct KArcDirPersistVisitFuncData
-{
-    Vector * vector;
-    KArcDir * dir;
-    char path[4096];
-} KArcDirPersistVisitFuncData;
-
-
-static
-rc_t CC KArcDirPersistVisitFunc (const KDirectory * dir, uint32_t unused_type, const char * name, void * data)
-{
-    KPathType type;
-    KArcDirPersistVisitFuncData * vdata;
-    char * path;
-    size_t len = 0;
-    rc_t rc;
-
-    rc = 0;
-    vdata = data;
-
-    type = (KPathType)KDirectoryPathType (dir, name, NULL);
-    switch (type)
-    {
-    default:
-	return 0;
-    case kptDir:
-	len = strlen (vdata->path);
-	if (len > 0)
-	{
-	    vdata->path[len] = '/';
-	    strcpy (vdata->path+len+1, name);
-	}
-	else
-	    strcpy (vdata->path, name);
-
-
-/* this needs cleaning up - dir moved along but path did not.  path handling is weak through out */
-/* 	rc = KArcDirVisit ((const KArcDir*)dir, false, KArcDirPersistVisitFunc, data, vdata->path, NULL); */
-	rc = KArcDirVisit ((const KArcDir*)dir, false, KArcDirPersistVisitFunc, data, name, NULL);
-	if (rc != 0)
-	{
-	    LOGERR (klogInt, rc, "KArcDirPersist Visit failed");
-	}
-	vdata->path[len] = '\0';
-	return rc;
-    case kptFile:
-    case kptFile|kptAlias:
-	len = strlen (vdata->path);
-	if (len > 0)
-	{
-	    vdata->path[len] = '/';
-	    strcpy (vdata->path+len+1, name);
-	}
-	else
-	    strcpy (vdata->path, name);
-	path = malloc (strlen(vdata->path)+1);
-	if (path == NULL)
-	{
-	    rc = RC (rcFS, rcArc, rcReindexing, rcMemory, rcExhausted);
-	}
-	else
-	{
-	    strcpy (path, vdata->path);
-	    rc = VectorAppend (vdata->vector, NULL, path);
-	}
-	vdata->path[len] = '\0';
-
-	return rc;
-    }
-}
-
-static
-void CC whack ( void *item, void *data )
-{
-    free (item);
-}
-
-/* ========================================
- * Build a Persisted version of a TOC in a buffer
- * return the allocated buffer
- */
-#ifdef _DEBUGGING
-static
-void CC write_entry( void * item, void *data)
-{
-    const char * path = item;
-    uint32_t * count = data;
-
-    TOC_SORT(("%3u: %s\n", *count, path));
-
-    (*count)++;
-}
-#endif
-rc_t KArcDirPersistHeader (const KArcDir * self,
-                           void ** buffer,
-                           size_t * buffer_size,
-                           uint64_t * file_size,
-                           KSRAFileAlignment align,
-                           rc_t (CC*usort)(const KDirectory*, Vector*))
-{
-    rc_t         rc;
-    const KToc * toc;
-
-    FUNC_ENTRY();
-
-    if (self == NULL)
-    {
-	rc = RC (rcFS, rcDirectory, rcPersisting, rcSelf, rcNull);
-	LOGERR (klogInt, rc, "KArcDirPersist Self is NULL");
-	return rc;
-    }
-    if (buffer == NULL)
-    {
-	rc = RC (rcFS, rcDirectory, rcPersisting, rcParam, rcNull);
-	LOGERR (klogInt, rc, "KArcDirPersist buffer is NULL");
-	return rc;
-    }
-    rc = KArcDirGetTOC (self, &toc);
-    if (rc != 0)
-        LOGERR (klogInt, rc, "KArcDirPersist TOC retrieval failed");
-    else
-    {
-        /* mutable field as it only applies to this specific operation */
-        rc = KTocAlignmentSet ((KToc*)toc, align);
-        if (rc != 0)
-            LOGERR (klogInt, rc, "KArcDirPersist TOC alignment failed");
-        else
-        {
-            Vector filevector;
-            KArcDirPersistVisitFuncData	data;
-
-            VectorInit (&filevector, 0, 0);
-
-            data.path[0] = '\0'; /* looks like "" */
-            data.vector = &filevector;
-
-
-            rc = KArcDirVisit (self, false, KArcDirPersistVisitFunc, &data, ".", NULL);
-            if (rc != 0)
-            {
-                LOGERR (klogInt, rc, "KArcDirPersist Visit failed");
-            }
-            else
-            {
-
-#ifdef _DEBUGGING
-/* this loop and the next just can be used in a debug build to verify the sorting function used */
-                {
-                    uint32_t ix;
-                    TOC_SORT (("Pre-sort order:\n"));
-
-                    ix = 1;
-                    VectorForEach ( &filevector, false, write_entry, &ix);
-                }
-#endif
-
-                if (usort)
-                    rc = usort(&self->dad, &filevector);
-
-#ifdef _DEBUGGING
-                {
-                    uint32_t ix;
-                    TOC_SORT (("Post-sort order:\n"));
-
-                    ix = 1;
-                    VectorForEach ( &filevector, false, write_entry, &ix);
-                }
-#endif
-
-
-                if (rc != 0)
-                {
-                    LOGERR (klogInt, rc, "KArcDirPersist user sort failed failed");
-                }
-                else
-                {
-                    rc = KTocPersist (toc, buffer, buffer_size, file_size, &filevector);
-                    if (rc != 0)
-                        LOGERR (klogInt, rc, "KArcDirPersist TOC retrieval failed");
-                }
-            }
-/*     free (data.path); */
-            VectorWhack (&filevector, whack, NULL);
-	}
-    }
- 
-    return rc;
-}
-
-
-/* end of file arc.c */
-
diff --git a/libs/kfs/arrayfile.c b/libs/kfs/arrayfile.c
deleted file mode 100644
index 0f19006..0000000
--- a/libs/kfs/arrayfile.c
+++ /dev/null
@@ -1,423 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kfs/extern.h>
-#include <kfs/impl.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-
-/*--------------------------------------------------------------------------
- * KArrayFile
- */
-
-
-/* Destroy
- *  destroy array-file
- */
-LIB_EXPORT rc_t CC KArrayFileDestroy ( KArrayFile *self )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcDestroying, rcSelf, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . destroy ) ( self );
-    }
-
-    return RC ( rcFS, rcFile, rcDestroying, rcInterface, rcBadVersion );
-}
-
-
-/* AddRef
- *  creates a new reference
- *  ignores NULL references
- */
-LIB_EXPORT rc_t CC KArrayFileAddRef ( const KArrayFile *self )
-{
-    if ( self != NULL )
-        atomic32_inc ( & ( ( KArrayFile* ) self ) -> refcount );
-    return 0;
-}
-
-/* Release
- *  discard reference to file
- *  ignores NULL references
- */
-LIB_EXPORT rc_t CC KArrayFileRelease ( const KArrayFile *cself )
-{
-    KArrayFile *self = ( KArrayFile* ) cself;
-    if ( cself != NULL )
-    {
-        if ( atomic32_dec_and_test ( & self -> refcount ) )
-        {
-            rc_t rc = KArrayFileDestroy ( self );
-            if ( rc != 0 )
-                atomic32_set ( & self -> refcount, 1 );
-            return rc;
-        }
-    }
-    return 0;
-}
-
-/* Dimensionality
- *  returns the number of dimensions in the ArrayFile
- *
- *  "dim" [ OUT ] - return parameter for number of dimensions
- */
-LIB_EXPORT rc_t CC KArrayFileDimensionality ( const KArrayFile *self, uint8_t *dim )
-{
-    if ( dim == NULL )
-        return RC ( rcFS, rcFile, rcAccessing, rcParam, rcNull );
-
-    * dim = 0;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcAccessing, rcSelf, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . dimensionality ) ( self, dim );
-    }
-
-    return RC ( rcFS, rcFile, rcAccessing, rcInterface, rcBadVersion );
-}
-
-
-/* SetDimensionality
- *  sets the number of dimensions in the ArrayFile
- *
- *  "dim" [ IN ] - new number of dimensions; must be > 0
- */
-LIB_EXPORT rc_t CC KArrayFileSetDimensionality ( KArrayFile *self, uint8_t dim )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcResizing, rcSelf, rcNull );
-
-    if ( dim == 0 )
-        return RC ( rcFS, rcFile, rcAccessing, rcParam, rcNull );
-
-    if ( ! self -> write_enabled )
-        return RC ( rcFS, rcFile, rcResizing, rcFile, rcNoPerm );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . set_dimensionality ) ( self, dim );
-    }
-
-    return RC ( rcFS, rcFile, rcResizing, rcInterface, rcBadVersion );
-}
-
-
-/* DimExtents
- *  returns the extent of every dimension
- *
- *  "dim" [ IN ] - the dimensionality of "extents"
- *
- *  "extents" [ OUT ] - returns the extent for every dimension
- */
-LIB_EXPORT rc_t CC KArrayFileDimExtents ( const KArrayFile *self, uint8_t dim, uint64_t *extents )
-{
-    uint8_t i;
-    if ( extents == NULL || dim == 0 )
-        return RC ( rcFS, rcFile, rcAccessing, rcParam, rcNull );
-
-    for ( i = 0; i < dim; ++i )
-        extents[ i ] = 0;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcAccessing, rcSelf, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . dim_extents ) ( self, dim, extents );
-    }
-
-    return RC ( rcFS, rcFile, rcAccessing, rcInterface, rcBadVersion );
-}
-
-
-/* SetDimExtents
- *  sets the new extents for every dimension
- *
- *  "dim" [ IN ] - the dimensionality of "extents"
- *
- *  "extents" [ IN ] - new extents for every dimension
- */
-LIB_EXPORT rc_t CC KArrayFileSetDimExtents ( KArrayFile *self, uint8_t dim, uint64_t *extents )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcResizing, rcSelf, rcNull );
-
-    if ( ! self -> write_enabled )
-        return RC ( rcFS, rcFile, rcResizing, rcFile, rcNoPerm );
-
-    if ( extents == NULL || dim == 0 )
-        return RC ( rcFS, rcFile, rcResizing, rcParam, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . set_dim_extents ) ( self, dim, extents );
-    }
-
-    return RC ( rcFS, rcFile, rcResizing, rcInterface, rcBadVersion );
-}
-
-
-/* ElementSize
- *  returns the element size in bits
- *
- *  "elem_bits" [ OUT ] - size of each element in bits
- */
-LIB_EXPORT rc_t CC KArrayFileElementSize ( const KArrayFile *self, uint64_t *elem_bits )
-{
-    if ( elem_bits == NULL )
-        return RC ( rcFS, rcFile, rcAccessing, rcParam, rcNull );
-
-    *elem_bits = 0;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcAccessing, rcSelf, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . element_size ) ( self, elem_bits );
-    }
-
-    return RC ( rcFS, rcFile, rcAccessing, rcInterface, rcBadVersion );
-}
-
-
-/* Read
- *  read from n-dimensional position
- *
- *  "dim" [ IN ] - the dimensionality of all vectors
- *
- *  "pos"  [ IN ] - n-dimensional starting position in elements
- *
- *  "buffer" [ OUT ] and "elem_count" [ IN ] - return buffer for read
- *  where "elem_count" is n-dimensional in elements
- *
- *  "num_read" [ OUT ] - n-dimensional return parameter giving back
- *      the number of read elements in every dimension
- */
-LIB_EXPORT rc_t CC KArrayFileRead ( const KArrayFile *self, uint8_t dim,
-    const uint64_t *pos, void *buffer, const uint64_t *elem_count,
-    uint64_t *num_read )
-{
-    uint8_t i;
-    if ( num_read == NULL || pos == NULL || elem_count == NULL || dim == 0 )
-        return RC ( rcFS, rcFile, rcReading, rcParam, rcNull );
-
-    for ( i = 0; i < dim; ++i )
-        num_read[ i ] = 0;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcReading, rcSelf, rcNull );
-
-    if ( ! self -> read_enabled )
-        return RC ( rcFS, rcFile, rcReading, rcFile, rcNoPerm );
-
-    if ( buffer == NULL )
-        return RC ( rcFS, rcFile, rcReading, rcBuffer, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . read ) ( self, dim, pos, buffer, elem_count, num_read );
-    }
-
-    return RC ( rcFS, rcFile, rcReading, rcInterface, rcBadVersion );
-}
-
-
-/* Read_v
- *  read one element of variable length from n-dimensional position
- *
- *  "dim" [ IN ] - the dimensionality of all vectors
- *
- *  "pos"  [ IN ] - n-dimensional starting position in elements
- *
- *  "buffer" [ OUT ] and "elem_count" [ IN ] - return buffer for read
- *  where "elem_count" is length of buffer in elements
- *
- *  "num_read" [ OUT ] - return parameter giving back
- *      the number of read elements in every dimension
- */
-LIB_EXPORT rc_t CC KArrayFileRead_v ( const KArrayFile *self, uint8_t dim,
-    const uint64_t *pos, void *buffer, const uint64_t elem_count,
-    uint64_t *num_read )
-{
-    if ( num_read == NULL || pos == NULL || elem_count == 0 || dim == 0 )
-        return RC ( rcFS, rcFile, rcReading, rcParam, rcNull );
-
-    *num_read = 0;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcReading, rcSelf, rcNull );
-
-    if ( ! self -> read_enabled )
-        return RC ( rcFS, rcFile, rcReading, rcFile, rcNoPerm );
-
-    if ( buffer == NULL )
-        return RC ( rcFS, rcFile, rcReading, rcBuffer, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . read_v ) ( self, dim, pos, buffer, elem_count, num_read );
-    }
-
-    return RC ( rcFS, rcFile, rcReading, rcInterface, rcBadVersion );
-}
-
-
-/* Write
- *  write into n-dimensional position
- *
- *  "dim" [ IN ] - the dimensionality of all vectors
- *
- *  "pos"  [ IN ] - n-dimensional offset where to write to
- *                   in elements
- *
- *  "buffer" [ IN ] and "elem_count" [ IN ] - data to be written
- *  where "elem_count" is n-dimensional in elements
- *
- *  "num_writ" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of elements actually written per dimension
- */
-LIB_EXPORT rc_t CC KArrayFileWrite ( KArrayFile *self, uint8_t dim,
-    const uint64_t *pos, const void *buffer, const uint64_t *elem_count,
-    uint64_t *num_writ )
-{
-    uint8_t i;
-    if ( num_writ == NULL || pos == NULL || elem_count == NULL || dim == 0 )
-        return RC ( rcFS, rcFile, rcWriting, rcParam, rcNull );
-
-    for ( i = 0; i < dim; ++i )
-        num_writ[ i ] = 0;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcWriting, rcSelf, rcNull );
-
-    if ( ! self -> write_enabled )
-        return RC ( rcFS, rcFile, rcWriting, rcFile, rcNoPerm );
-
-    if ( buffer == NULL )
-        return RC ( rcFS, rcFile, rcWriting, rcBuffer, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . write ) ( self, dim, pos, buffer, elem_count, num_writ );
-    }
-
-    return RC ( rcFS, rcFile, rcWriting, rcInterface, rcBadVersion );
-}
-
-
-/* GetMeta
- *  extracts metadata into a string-vector
- *
- *  "key"   [ IN ]  - the key which part of the metadata to retrieve
- *
- *  "list"  [ OUT ] - pointer to a KNamelist-pointer
- *
- */
-LIB_EXPORT rc_t CC KArrayFileGetMeta ( struct KArrayFile const *self, const char *key,
-    const struct KNamelist **list )
-{
-    if ( key == NULL || list == NULL )
-        return RC ( rcFS, rcFile, rcReading, rcParam, rcNull );
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcReading, rcSelf, rcNull );
-
-    *list = NULL;
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . get_meta ) ( self, key, list );
-    }
-
-    return RC ( rcFS, rcFile, rcWriting, rcInterface, rcBadVersion );
-}
-
-
-/* Init
- *  initialize a newly allocated file object
- */
-LIB_EXPORT rc_t CC KArrayFileInit ( KArrayFile *self, const KArrayFile_vt *vt,
-    bool read_enabled, bool write_enabled )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcConstructing, rcSelf, rcNull );
-    if ( vt == NULL )
-        return RC ( rcFS, rcFile, rcConstructing, rcInterface, rcNull );
-    switch ( vt -> v1 . maj )
-    {
-    case 0:
-        return RC ( rcFS, rcFile, rcConstructing, rcInterface, rcInvalid );
-
-    case 1:
-        switch ( vt -> v1 . min )
-        {
-            /* ADD NEW MINOR VERSION CASES HERE */
-        case 0:
-#if _DEBUGGING
-        if ( vt -> v1 . write == NULL              ||
-             vt -> v1 . read == NULL               ||
-             vt -> v1 . element_size == NULL       ||
-             vt -> v1 . set_dim_extents == NULL    ||
-             vt -> v1 . dim_extents == NULL        ||
-             vt -> v1 . set_dimensionality == NULL ||
-             vt -> v1 . dimensionality == NULL     ||
-             vt -> v1 . get_meta == NULL           ||
-             vt -> v1 . destroy == NULL )
-        return RC ( rcFS, rcFile, rcConstructing, rcInterface, rcNull );
-#endif
-            break;
-        default:
-            return RC ( rcFS, rcFile, rcConstructing, rcInterface, rcBadVersion );
-        }
-        break;
-
-    default:
-        return RC ( rcFS, rcFile, rcConstructing, rcInterface, rcBadVersion );
-    }
-
-    self -> vt = vt;
-    KRefcountInit ( & self -> refcount, 1, "KArrayFile", "Creating", "-" );
-    self -> read_enabled = ( uint8_t ) ( read_enabled != 0 );
-    self -> write_enabled = ( uint8_t ) ( write_enabled != 0 );
-
-    return 0;
-}
diff --git a/libs/kfs/buffile-read.c b/libs/kfs/buffile-read.c
deleted file mode 100644
index 7635568..0000000
--- a/libs/kfs/buffile-read.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-typedef struct KBufReadFile KBufReadFile;
-#define KFILE_IMPL KBufReadFile
-
-#include <kfs/extern.h>
-
-#include <kfs/file.h>
-#include <kfs/impl.h>
-#include <klib/debug.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-
-/*-----------------------------------------------------------------------
- * KBufReadFile
- */
-struct KBufReadFile
-{
-    KFile dad;
-
-    uint64_t pos;       /* position of buff within the original file */
-
-    const KFile *f;           /* original file being buffered */
-
-    size_t bsize;       /* size of the buffer */
-    size_t num_valid;   /* how much of the buffer is actually valid */
-
-    uint8_t buff [ 1 ];
-};
-
-static
-rc_t CC KBufReadFileDestroy ( KBufReadFile *self )
-{
-    rc_t rc = KFileRelease ( self -> f );
-    if ( rc == 0 )
-        free ( self );
-    return rc;
-}
-
-static
-struct KSysFile* CC KBufReadFileSysFile ( const KBufReadFile *self, uint64_t *offset )
-{
-    /* does not support SysFile */
-    * offset = 0;
-    return NULL;
-}
-
-static
-rc_t CC KBufReadFileRandomAccess ( const KBufReadFile *self )
-{
-    return KFileRandomAccess ( self -> f );
-}
-
-static
-rc_t CC KBufReadFileSize ( const KBufReadFile *self, uint64_t *size )
-{
-    return KFileSize ( self -> f, size );
-}
-
-static
-rc_t CC KBufReadFileSetSize ( KBufReadFile *self, uint64_t size )
-{
-    return RC ( rcFS, rcFile, rcAccessing, rcFunction, rcUnsupported );
-}
-
-static
-rc_t CC KBufReadFileRead ( const KBufReadFile *cself, uint64_t pos,
-    void *buffer, size_t bsize, size_t *num_read )
-{
-    rc_t rc = 0;
-
-    assert (cself);
-    assert (buffer);
-    assert (num_read);
-
-    /* start assuming nothing will be read */
-    *num_read = 0;
-
-    if (bsize != 0)
-    {
-        KBufReadFile * self = (KBufReadFile *)cself;
-        uint64_t new_pos; 
-        size_t new_offset;
-
-        /* cast might be a no-op */
-        new_offset = (size_t)(pos % cself->bsize);
-        new_pos = pos - new_offset;
-
-        /* we need to read if we are on the wrong 'sector page'
-         * or the current 'sector page' isn't long enough.
-         *
-         * If on the wrong page just kill the contents
-         */
-        if (new_pos != cself->pos)
-        {
-            self->num_valid = 0;
-            self->pos = new_pos;
-        }
-
-        /* new we agree on the 'sector page' even if we have nothing
-         * valid in it */
-        if ((self->num_valid == 0) || (self->num_valid <= (size_t)new_offset))
-        {
-            size_t new_num_read;
-            rc = KFileReadAll (self->f, self->pos + self->num_valid,
-                               self->buff + self->num_valid, 
-                               self->bsize - self->num_valid,
-                               &new_num_read);
-            if (rc == 0)
-                self->num_valid += new_num_read;
-        }
-
-        /* now we have all we're gonna get this time */
-        if (new_offset < self->num_valid)
-        {
-            size_t to_copy;
-
-            to_copy = self->num_valid - new_offset;
-            if (to_copy > bsize)
-                to_copy = bsize;
-            
-            memmove (buffer, self->buff + new_offset, to_copy);
-            *num_read = to_copy;
-        }
-    }
-    return rc;
-}
-
-static
-rc_t CC KBufReadFileWrite ( KBufReadFile *self, uint64_t pos,
-    const void *buffer, size_t size, size_t *num_writ )
-{
-    return RC ( rcFS, rcFile, rcWriting, rcFunction, rcUnsupported );
-}
-
-static
-uint32_t CC KBufReadFileType ( const KBufReadFile * self )
-{
-    return KFileType ( self -> f );
-}
-
-static
-rc_t KBufReadFileMake ( KBufReadFile ** bp, const KFile *f, size_t bsize,
-    const KFile_vt *vt, bool read_enabled, bool write_enabled )
-{
-    rc_t rc;
-
-    KBufReadFile *buf = calloc ( sizeof * buf - 1 + bsize, 1 );
-    if ( buf == NULL )
-        rc = RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        rc = KFileInit ( & buf -> dad, vt, "KBufReadFile", "no-name", read_enabled, write_enabled );
-        if ( rc == 0 )
-        {
-            rc = KFileAddRef ( f );
-            if ( rc == 0 )
-            {
-                buf -> f = ( KFile* ) f;
-                buf -> bsize = bsize;
-                * bp = buf;
-                return 0;
-            }
-        }
-
-        free ( buf );
-    }
-
-    return rc;
-}
-
-/* MakeBufferedWrite
- *  make a writable file buffer
- *
- *  "buf" [ OUT ] - return parameter for new buffered file
- *
- *  "original" [ IN ] - source file to be buffered. must have read access
- *
- *  "bsize" [ IN ] - buffer size
- */
-
-static
-const KFile_vt_v1 vtKBufReadFileRandWR_v1 =
-{
-    /* version */
-    1, 1,
-
-    /* 1.0 */
-    KBufReadFileDestroy,
-    KBufReadFileSysFile,
-    KBufReadFileRandomAccess,
-    KBufReadFileSize,
-    KBufReadFileSetSize,
-    KBufReadFileRead,
-    KBufReadFileWrite,
-
-    /* 1.1 */
-    KBufReadFileType
-};
-
-LIB_EXPORT 
-rc_t CC KBufReadFileMakeRead ( const KFile ** bp, const KFile * original, size_t bsize )
-{
-    rc_t rc;
-
-    if ( bp == NULL )
-        rc = RC ( rcFS, rcFile, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( original == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNull );
-        else if ( ! original -> read_enabled )
-        {
-            if ( original -> write_enabled )
-                rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcWriteonly );
-            else
-                rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNoPerm );
-        }
-        else
-        {
-            KBufReadFile *buf;
-            rc = KBufReadFileMake ( & buf, original, bsize,
-                ( const KFile_vt* ) & vtKBufReadFileRandWR_v1, true, false );
-            if ( rc == 0 )
-            {
-                * bp = & buf -> dad;
-                return 0;
-            }
-        }
-
-        * bp = NULL;
-    }
-
-    return rc;
-}
diff --git a/libs/kfs/buffile-write.c b/libs/kfs/buffile-write.c
deleted file mode 100644
index 1d46ce9..0000000
--- a/libs/kfs/buffile-write.c
+++ /dev/null
@@ -1,368 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-typedef struct KBufWriteFile KBufWriteFile;
-#define KFILE_IMPL KBufWriteFile
-
-#include <kfs/extern.h>
-
-#include <kfs/file.h>
-#include <kfs/impl.h>
-#include <klib/debug.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-
-/*-----------------------------------------------------------------------
- * KBufWriteFile
- */
-struct KBufWriteFile
-{
-    KFile dad;
-
-    uint64_t pos;
-
-    KFile *f;
-
-    size_t bsize;
-    size_t num_valid;
-
-    uint8_t buff [ 1 ];
-};
-
-static
-rc_t CC KBufWriteFileDestroy ( KBufWriteFile *self )
-{
-    rc_t rc = KFileRelease ( self -> f );
-    if ( rc == 0 )
-        free ( self );
-    return rc;
-}
-
-static
-rc_t KBufWriteFileFlush ( KBufWriteFile *self, uint64_t dpos )
-{
-    rc_t rc;
-    size_t total_writ, partial;
-
-    /* flush buffer */
-    for ( rc = 0, total_writ = 0; total_writ < self -> num_valid; total_writ += partial )
-    {
-        rc = KFileWrite ( self -> f, dpos + total_writ,
-            & self -> buff [ total_writ ],
-            self -> num_valid - total_writ, & partial );
-        if ( rc != 0 )
-            break;
-        if ( partial == 0 )
-        {
-            rc = RC ( rcFS, rcFile, rcWriting, rcTransfer, rcIncomplete );
-            break;
-        }
-    }
-
-    if ( rc == 0 )
-        self -> num_valid = 0;
-
-    return rc;
-}
-
-static
-rc_t CC KBufWriteFileFlushDestroy ( KBufWriteFile *self )
-{
-    rc_t rc = KBufWriteFileFlush ( self, self -> pos );
-    if ( rc == 0 )
-        rc = KFileRelease ( self -> f );
-    if ( rc == 0 )
-        free ( self );
-    return rc;
-}
-
-static
-struct KSysFile* CC KBufWriteFileNoSysFile ( const KBufWriteFile *self, uint64_t *offset )
-{
-    * offset = 0;
-    return NULL;
-}
-
-static
-rc_t CC KBufWriteFileRandomAccess ( const KBufWriteFile *self )
-{
-    return KFileRandomAccess ( self -> f );
-}
-
-static
-rc_t CC KBufWriteFileSize ( const KBufWriteFile *self, uint64_t *size )
-{
-    return KFileSize ( self -> f, size );
-}
-
-static
-rc_t CC KBufWriteFileSetSize ( KBufWriteFile *self, uint64_t size )
-{
-    if ( self -> pos + self -> num_valid > size )
-    {
-        if ( self -> pos < size )
-        {
-            size_t total, num_writ, to_write = ( size_t ) ( size - self -> pos );
-            for ( total = 0; total < to_write; total += num_writ )
-            {
-                rc_t rc = KFileWrite ( self -> f, self -> pos + total,
-                    & self -> buff [ total ], to_write - total, & num_writ );
-                if ( rc != 0 )
-                    return rc;
-                if ( num_writ == 0 )
-                    return RC ( rcFS, rcFile, rcReading, rcTransfer, rcIncomplete );
-            }
-        }
-
-        self -> pos = 0;
-        self -> num_valid = 0;
-    }
-
-    return KFileSetSize ( self -> f, size );
-}
-
-static
-rc_t CC KBufWriteFileNoRead ( const KBufWriteFile *cself, uint64_t pos,
-    void *buffer, size_t bsize, size_t *num_read )
-{
-    return RC ( rcFS, rcFile, rcReading, rcFunction, rcUnsupported );
-}
-
-static
-rc_t CC KBufWriteFileWrite ( KBufWriteFile *self, uint64_t pos,
-    const void *buffer, size_t size, size_t *num_writ )
-{
-    rc_t rc;
-    size_t total, partial, trailing;
-
-    const uint8_t *bbuff = buffer;
-    uint64_t send = pos + size;
-
-    /* case 1: empty write */
-    if ( size == 0 )
-    {
-        * num_writ = 0;
-        return 0;
-    }
-
-    /* perform write */
-    for ( rc = 0, total = trailing = 0; total < size; total += partial )
-    {
-        size_t boff = total - trailing;
-        uint64_t dpos = self -> pos;
-        uint64_t dend = self -> pos + self -> num_valid;
-        uint64_t dlim = self -> pos + self -> bsize;
-        uint64_t spos = pos + boff;
-
-        /* case 2: left within buffer */
-        if ( dpos <= spos && spos <= dend && spos < dlim )
-        {
-            partial = ( size_t ) ( ( dlim < send ? dlim : send ) - spos );
-            memcpy ( & self -> buff [ spos - dpos ], & bbuff [ boff ], partial );
-            if ( spos + partial > dend )
-            {
-                dend = spos + partial;
-                self -> num_valid = ( size_t ) ( dend - dpos );
-            }
-        }
-
-        /* case 3: right within buffer */
-        else if ( spos < dpos && dpos < send && send <= dlim )
-        {
-            partial = ( size_t ) ( send - dpos );
-            memcpy ( & self -> buff [ spos - dpos ], & bbuff [ boff ], partial );
-            if ( send > dend )
-            {
-                dend = send;
-                self -> num_valid = ( size_t ) ( dend - dpos );
-            }
-
-            /* adjust other components for trailing copy */
-            assert ( trailing == 0 );
-            trailing = partial;
-            send = dpos;
-        }
-
-        /* case 4: no intersection */
-        else if ( send <= dpos || dend <= spos )
-        {
-            /* flush buffer as-is */
-            rc = KBufWriteFileFlush ( self, dpos );
-            if ( rc != 0 )
-                break;
-
-            /* empty buffer centered on this write */
-            self -> pos = spos;
-
-            /* if write is >= buffer size, just write it directy */
-            partial = size - total;
-            if ( partial < self -> bsize )
-            {
-                memcpy ( self -> buff, & bbuff [ boff ], partial );
-                self -> num_valid = partial;
-            }
-            else
-            {
-                rc = KFileWrite ( self -> f, spos, & bbuff [ boff ], partial, & partial );
-                if ( rc != 0 )
-                    break;
-                if ( partial == 0 )
-                {
-                    rc = RC ( rcFS, rcFile, rcWriting, rcTransfer, rcIncomplete );
-                    break;
-                }
-            }
-        }
-
-        /* case 5: completely engulfs */
-        else
-        {
-            assert ( spos < dpos && dlim < send );
-            rc = KFileWrite ( self -> f, spos, & bbuff [ boff ], ( size_t ) ( send - spos ), & partial );
-            if ( rc != 0 )
-                break;
-            if ( partial == 0 )
-            {
-                rc = RC ( rcFS, rcFile, rcWriting, rcTransfer, rcIncomplete );
-                break;
-            }
-
-            /* anything in the buffer is invalid now */
-            self -> num_valid = 0;
-        }
-    }
-
-    * num_writ = total;
-
-    return rc;
-}
-
-static
-uint32_t CC KBufWriteFileType ( const KBufWriteFile * self )
-{
-    return KFileType ( self -> f );
-}
-
-static
-rc_t KBufWriteFileMake ( KBufWriteFile ** bp, const KFile *f, size_t bsize,
-    const KFile_vt *vt, bool read_enabled, bool write_enabled )
-{
-    rc_t rc;
-
-    KBufWriteFile *buf = malloc ( sizeof * buf - 1 + bsize );
-    if ( buf == NULL )
-        rc = RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        memset ( buf, 0, sizeof * buf );
-        rc = KFileInit ( & buf -> dad, vt, "KBufWriteFile", "no-name", read_enabled, write_enabled );
-        if ( rc == 0 )
-        {
-            rc = KFileAddRef ( f );
-            if ( rc == 0 )
-            {
-                buf -> f = ( KFile* ) f;
-                buf -> bsize = bsize;
-                * bp = buf;
-                return 0;
-            }
-        }
-
-        free ( buf );
-    }
-
-    return rc;
-}
-
-/* MakeBufferedWrite
- *  make a writable file buffer
- *
- *  "buf" [ OUT ] - return parameter for new buffered file
- *
- *  "original" [ IN ] - source file to be buffered. must have read access
- *
- *  "bsize" [ IN ] - buffer size
- */
-
-static
-const KFile_vt_v1 vtKBufWriteFileRandWR_v1 =
-{
-    /* version */
-    1, 1,
-
-    /* 1.0 */
-    KBufWriteFileFlushDestroy,
-    KBufWriteFileNoSysFile,
-    KBufWriteFileRandomAccess,
-    KBufWriteFileSize,
-    KBufWriteFileSetSize,
-    KBufWriteFileNoRead,
-    KBufWriteFileWrite,
-
-    /* 1.1 */
-    KBufWriteFileType
-};
-
-LIB_EXPORT rc_t KBufWriteFileMakeWrite ( KFile ** bp, KFile * original, size_t bsize )
-{
-    rc_t rc;
-
-    if ( bp == NULL )
-        rc = RC ( rcFS, rcFile, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( original == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNull );
-        else if ( ! original -> write_enabled )
-        {
-            if ( original -> read_enabled )
-                rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcReadonly );
-            else
-                rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNoPerm );
-        }
-        else
-        {
-            KBufWriteFile *buf;
-            rc = KBufWriteFileMake ( & buf, original, bsize,
-                ( const KFile_vt* ) & vtKBufWriteFileRandWR_v1, false, true );
-            if ( rc == 0 )
-            {
-                * bp = & buf -> dad;
-                return 0;
-            }
-        }
-
-        * bp = NULL;
-    }
-
-    return rc;
-}
diff --git a/libs/kfs/buffile.c b/libs/kfs/buffile.c
deleted file mode 100644
index ecff70c..0000000
--- a/libs/kfs/buffile.c
+++ /dev/null
@@ -1,573 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-#define KFILE_IMPL struct KBufFile
-
-#include <kfs/extern.h>
-#include <kfs/buffile.h>
-
-#include <kfs/file.h>
-#include <kfs/impl.h>
-#include <kfs/pagefile.h>
-#include <klib/debug.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-rc_t KBufWriteFileMakeWrite ( KFile ** bp, KFile * original, size_t bsize );
-
-
-/*-----------------------------------------------------------------------
- * KBufFile
- */
-typedef struct KBufFile KBufFile;
-struct KBufFile
-{
-    KFile dad;
-
-    uint64_t max_write;
-
-    KFile *f;
-    KPageFile *pf;
-
-    KPage *pg;
-    size_t pgsize;
-    uint32_t pgid;
-};
-
-
-#define KBufFileSerialAccess( self ) \
-    ( ( const KFile* ) & ( self ) -> dad ) -> align [ 0 ]
-
-#define KBufFileSetSerialAccess( self, val ) \
-    ( self ) -> dad . align [ 0 ] = ( val )
-    
-
-static
-rc_t CC KBufFileDestroy ( KBufFile *self )
-{
-    rc_t rc = KPageRelease ( self -> pg );
-    if ( rc == 0 )
-    {
-        self -> pg = NULL;
-        self -> pgid = 0;
-
-        rc = KPageFileRelease ( self -> pf );
-        if ( rc == 0 )
-        {
-            KFileRelease ( self -> f );
-            free ( self );
-        }
-    }
-
-    return rc;
-}
-
-static
-rc_t CC KBufFileDestroyTrunc ( KBufFile *self )
-{
-    /* grab some information */
-    KFile *f = self -> f;
-    rc_t rc = KFileAddRef ( self -> f );
-    uint64_t max_write = self -> max_write;
-
-    if ( rc == 0 )
-    {
-        /* destroy self and write all pages */
-        rc = KBufFileDestroy ( self );
-        if ( rc == 0 )
-            rc = KFileSetSize ( f, max_write );
-
-        KFileRelease ( f );
-    }
-    return rc;
-}
-
-static
-struct KSysFile* CC KBufFileGetSysFile ( const KBufFile *self, uint64_t *offset )
-{
-    * offset = 0;
-    return NULL;
-}
-
-static
-rc_t CC KBufFileRandomAccess ( const KBufFile *self )
-{
-    return KFileRandomAccess ( self -> f );
-}
-
-static
-rc_t CC KBufFileSizeRead ( const KBufFile *self, uint64_t *size )
-{
-    uint64_t lsize, fsize;
-    rc_t rc = KPageFileSize ( self -> pf, & lsize, & fsize, NULL );
-
-    if ( rc != 0 )
-        * size = 0;
-    else
-        * size = fsize;
-
-    return rc;
-}
-
-static
-rc_t CC KBufFileSize ( const KBufFile *self, uint64_t *size )
-{
-    uint64_t lsize, fsize;
-    rc_t rc = KPageFileSize ( self -> pf, & lsize, & fsize, NULL );
-
-    if ( rc != 0 )
-        * size = 0;
-    else if ( lsize < fsize )
-        * size = fsize;
-    else
-        * size = lsize;
-
-    return rc;
-}
-
-static
-rc_t CC KBufFileSetSize ( KBufFile *self, uint64_t size )
-{
-    KPageRelease ( self -> pg );
-    self -> pg = NULL;
-    self -> pgid = 0;
-
-    return KPageFileSetSize ( self -> pf, size );
-}
-
-static
-rc_t CC KBufFileNoSetSize ( KBufFile *self, uint64_t size )
-{
-    return RC ( rcFS, rcFile, rcResizing, rcFunction, rcUnsupported );
-}
-
-static
-rc_t CC KBufFileRead ( const KBufFile *cself, uint64_t pos,
-    void *buffer, size_t bsize, size_t *num_read )
-{
-    KBufFile *self = ( KBufFile* ) cself;
-
-    rc_t rc;
-    uint8_t *dst = buffer;
-    size_t total, partial;
-
-    for ( rc = 0, total = 0; total < bsize; pos += partial, total += partial )
-    {
-        const uint8_t *src;
-        size_t bytes, offset;
-
-        /* bytes remaining to be read */
-        size_t remain = bsize - total;
-
-        /* user wants to access this page */
-        uint32_t pgid = ( uint32_t ) ( pos / self -> pgsize ) + 1;
-
-        /* check against cached page */
-        if ( self -> pgid != pgid )
-        {
-            /* release previous page */
-            KPageRelease ( self -> pg );
-
-            /* get requested page */
-            rc = KPageFilePosGet ( self -> pf, & self -> pg, pos );
-            if ( rc != 0 )
-            {
-                if ( GetRCState ( rc ) == rcNotFound )
-                    rc = 0;
-
-                self -> pg = NULL;
-                self -> pgid = 0;
-                break;
-            }
-            self -> pgid = pgid;
-        }
-
-        /* access page memory */
-        rc = KPageAccessRead ( self -> pg, ( const void** ) & src, & bytes );
-        if ( rc != 0 )
-            break;
-
-        /* going to copy from page at the given offset */
-        offset = ( size_t ) ( pos % bytes );
-        assert ( bytes == self -> pgsize );
-
-        /* limit to end of file if serial access */
-        if ( KBufFileSerialAccess ( self ) )
-        {
-            uint64_t fsize;
-            rc = KPageFileSize ( self -> pf, NULL, & fsize, NULL );
-            if ( rc != 0 )
-                break;
-            if ( pgid * bytes > fsize )
-            {
-                bytes = ( size_t ) ( fsize % bytes ); 
-                if ( bytes <= offset )
-                    break;
-            }
-        }
-        /* limit to eof if read-only */
-        else if ( ! self -> dad . write_enabled )
-        {
-            if ( pgid * bytes > self -> max_write )
-            {
-                bytes = ( size_t ) ( self -> max_write % bytes ); 
-                if ( bytes <= offset )
-                    break;
-            }
-        }
-
-        /* limit bytes to request */
-        partial = bytes - offset;
-        if ( partial > remain )
-            partial = remain;
-
-        /* copy bytes */
-        memcpy ( & dst [ total ], & src [ offset ], partial );
-    }
-
-    if ( total != 0 )
-    {
-        * num_read = total;
-        return 0;
-    }
-
-    * num_read = 0;
-    return rc;
-}
-
-static
-rc_t CC KBufFileWrite ( KBufFile *self, uint64_t pos,
-    const void *buffer, size_t size, size_t *num_writ )
-{
-    rc_t rc;
-    size_t total, partial;
-    const uint8_t *src = buffer;
-
-    /* record start marker */
-    uint64_t start = pos;
-
-    for ( rc = 0, total = 0; total < size; pos += partial, total += partial )
-    {
-        uint8_t *dst;
-        size_t bytes, offset;
-
-        /* bytes remaining to be writ */
-        size_t remain = size - total;
-
-        /* user wants to access this page */
-        uint32_t pgid = ( uint32_t ) ( pos / self -> pgsize ) + 1;
-
-        /* check against cached page */
-        if ( self -> pgid != pgid )
-        {
-            /* release previous page */
-            KPageRelease ( self -> pg );
-
-            /* get requested page */
-            rc = KPageFilePosGet ( self -> pf, & self -> pg, pos );
-            if ( rc != 0 )
-            {
-                self -> pg = NULL;
-                self -> pgid = 0;
-                break;
-            }
-            self -> pgid = pgid;
-        }
-
-        /* access page memory */
-        rc = KPageAccessUpdate ( self -> pg, ( void** ) & dst, & bytes );
-        if ( rc != 0 )
-            break;
-
-        /* going to copy to page at the given offset */
-        offset = ( size_t ) ( pos % bytes );
-        partial = bytes - offset;
-        assert ( bytes == self -> pgsize );
-
-        /* limit bytes to request */
-        if ( partial > remain )
-            partial = remain;
-
-        /* copy bytes */
-        memcpy ( & dst [ offset ], & src [ total ], partial );
-    }
-
-    if ( total != 0 )
-    {
-        if ( start + total > self -> max_write )
-            self -> max_write = start + total;
-        * num_writ = total;
-        return 0;
-    }
-
-    * num_writ = 0;
-    return rc;
-}
-
-
-static
-rc_t CC KBufFileNoWrite ( KBufFile *self, uint64_t pos,
-    const void *buffer, size_t size, size_t *num_writ )
-{
-    return RC ( rcFS, rcFile, rcWriting, rcFunction, rcUnsupported );
-}
-
-static
-uint32_t CC KBufFileType ( const KBufFile * self )
-{
-    return KFileType ( self -> f );
-}
-
-static
-const KFile_vt_v1 vtKBufFileRD_v1 =
-{
-    /* version */
-    1, 1,
-
-    /* 1.0 */
-    KBufFileDestroy,
-    KBufFileGetSysFile,
-    KBufFileRandomAccess,
-    KBufFileSizeRead,
-    KBufFileNoSetSize,
-    KBufFileRead,
-    KBufFileNoWrite,
-
-    /* 1.1 */
-    KBufFileType
-};
-
-static
-const KFile_vt_v1 vtKBufFileRW_v1 =
-{
-    /* version */
-    1, 1,
-
-    /* 1.0 */
-    KBufFileDestroyTrunc,
-    KBufFileGetSysFile,
-    KBufFileRandomAccess,
-    KBufFileSize,
-    KBufFileSetSize,
-    KBufFileRead,
-    KBufFileWrite,
-
-    /* 1.1 */
-    KBufFileType
-};
-
-static
-rc_t KBufFileMake ( KBufFile ** bp, const KFile_vt *vt,
-    const KFile *f, uint64_t eof, const KPageFile *pf,
-    bool read_enabled, bool write_enabled, bool serial )
-{
-    rc_t rc;
-
-    KBufFile *buf = malloc ( sizeof * buf );
-    if ( buf == NULL )
-        rc = RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        rc = KFileInit ( & buf -> dad, vt, "KBufFile", "no-name", read_enabled, write_enabled );
-        if ( rc == 0 )
-        {
-            rc = KFileAddRef ( f );
-            if ( rc == 0 )
-            {
-                buf -> max_write = serial ? 0 : eof;
-
-                buf -> f = ( KFile* ) f;
-                buf -> pf = ( KPageFile* ) pf;
-
-                buf -> pg = NULL;
-                buf -> pgsize = KPageConstSize ();
-                buf -> pgid = 0;
-
-                KBufFileSetSerialAccess ( buf, serial );
-
-                * bp = buf;
-                return 0;
-            }
-        }
-
-        free ( buf );
-    }
-
-    return rc;
-}
-
-/* MakeBufferedRead
- *  make a read-only file buffer
- *
- *  "buf" [ OUT ] - return parameter for new buffered file
- *
- *  "original" [ IN ] - source file to be buffered. must have read access
- *
- *  "bsize" [ IN ] - buffer size
- */
-LIB_EXPORT rc_t CC KBufFileMakeRead ( const KFile ** bp,
-    const KFile * original, size_t bsize )
-{
-    rc_t rc;
-
-    if ( bp == NULL )
-        rc = RC ( rcFS, rcFile, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( original == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNull );
-        else
-        {
-            uint64_t eof;
-            bool serial = false;
-            const KPageFile *pf;
-
-            /* round bsize to next higher page */
-            size_t pgmask = KPageConstSize () - 1;
-            assert ( ( pgmask & ( pgmask + 1 ) ) == 0 );
-            bsize = ( bsize + pgmask ) & ~ pgmask;
-
-            /* check for serial access */
-            if ( KFileRandomAccess ( original ) != 0 )
-                serial = true;
-
-            /* try to get end of file */
-            rc = KFileSize ( original, & eof );
-            if ( rc != 0 )
-                serial = true;
-
-            /* create page file for read */
-            rc = KPageFileMakeRead ( & pf, original, bsize );
-            if ( rc == 0 )
-            {
-                /* create buffered file */
-                KBufFile *buf;
-                rc = KBufFileMake ( & buf, ( const KFile_vt* ) & vtKBufFileRD_v1,
-                    original, eof, pf, true, false, serial );
-                if ( rc == 0 )
-                {
-                    * bp = & buf -> dad;
-                    return 0;
-                }
-
-                KPageFileRelease ( pf );
-            }
-        }
-
-        * bp = NULL;
-    }
-
-    return rc;
-}
-
-
-/* MakeBufferedWrite
- *  make a writable file buffer
- *
- *  "buf" [ OUT ] - return parameter for new buffered file
- *
- *  "original" [ IN ] - source file to be buffered. must have read access
- *
- *  "update" [ IN ] - if true, make a read/write buffer
- *
- *  "bsize" [ IN ] - buffer size
- */
-LIB_EXPORT rc_t CC KBufFileMakeWrite ( KFile ** bp,
-    KFile * original, bool update, size_t bsize )
-{
-    rc_t rc;
-
-    if ( bp == NULL )
-        rc = RC ( rcFS, rcFile, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( original == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNull );
-        else if ( ! original -> write_enabled )
-        {
-            if ( original -> read_enabled )
-                rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcReadonly );
-            else
-                rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNoPerm );
-        }
-        else
-        {
-            /* check for serial access */
-            bool serial = false;
-            if ( KFileRandomAccess ( original ) != 0 )
-                serial = true;
-
-            /* if read-write is not required */
-            if ( ! update )
-                return KBufWriteFileMakeWrite ( bp, original, bsize );
-
-            /* can only use page file if backing is r/w */
-            if ( ! original -> read_enabled )
-                rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcWriteonly );
-            else
-            {
-                uint64_t eof;
-                KPageFile *pf;
-
-                /* round bsize to next higher page */
-                size_t pgmask = KPageConstSize () - 1;
-                assert ( ( pgmask & ( pgmask + 1 ) ) == 0 );
-                bsize = ( bsize + pgmask ) & ~ pgmask;
-
-                /* try to get end of file */
-                rc = KFileSize ( original, & eof );
-                if ( rc != 0 )
-                    serial = true;
-
-                /* create page file for update */
-                rc = KPageFileMakeUpdate ( & pf, original, bsize, serial );
-                if ( rc == 0 )
-                {
-                    /* create buffered file */
-                    KBufFile *buf;
-                    rc = KBufFileMake ( & buf, ( const KFile_vt* ) & vtKBufFileRW_v1,
-                        original, eof, pf, update, true, serial );
-                    if ( rc == 0 )
-                    {
-                        * bp = & buf -> dad;
-                        return 0;
-                    }
-
-                    KPageFileRelease ( pf );
-                }
-            }
-        }
-
-        * bp = NULL;
-    }
-
-    return rc;
-}
diff --git a/libs/kfs/bzip.c b/libs/kfs/bzip.c
deleted file mode 100644
index dcfc4be..0000000
--- a/libs/kfs/bzip.c
+++ /dev/null
@@ -1,838 +0,0 @@
-/*=======================================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-struct KBZipFile;
-#define KFILE_IMPL struct KBZipFile
-
-#include <kfs/extern.h>
-#include <kfs/impl.h>
-#include <kfs/bzip.h>
-#include <klib/debug.h>
-#include <klib/rc.h>
-#include <klib/out.h>
-#include <klib/log.h>
-#include <sysalloc.h>
-
-#include <bzlib.h>      /* bz_stream */
-#include <assert.h>
-#include <stdlib.h>    /* malloc */
-#include <string.h>
-
-#ifdef _DEBUGGING
-#define BZIP_DEBUG(msg) DBGMSG(DBG_KFS,DBG_FLAG(DBG_KFS_BZIP), msg)
-#else
-#define BZIP_DEBUG(msg)
-#endif
-
-#define BZIP_DBGSTREAM(strm,msg)                                 \
-    BZIP_DEBUG(("%s: bz_stream (%p) %.35s\nnext_in %p "          \
-                "avail_in %6u total_in %10lu next_out %p "       \
-                "avail_out %6u total_out %10lu\n",               \
-                __func__, strm, msg,                             \
-                strm->next_in, strm->avail_in,                   \
-                (uint64_t)strm->total_in_lo32 +                  \
-                (((uint64_t)strm->total_in_hi32)<<32),           \
-                strm->next_out, strm->avail_out,                 \
-                (uint64_t)strm->total_out_lo32 +                 \
-                (((uint64_t)strm->total_out_hi32)<<32)))
-
-
-/***************************************************************************************/
-/* bzip2 File                                                                    */
-/***************************************************************************************/
-
-#define BZ2CHUNK 0x20000    /* 128K */
-
-/* ======================================================================
- * bzip2 KFile structure
- */
-typedef struct KBZipFile KBZipFile;
-struct KBZipFile
-{
-    KFile dad;
-    KFile *file; /* underlying KFile */
-    uint64_t filePosition;
-    uint64_t myPosition;
-    int BZ2_bzDecompressResult;
-    bz_stream strm;
-    char buff[BZ2CHUNK]; /* buffer to cache KFile data */
-    bool completed;
-};
-
-
-/* ======================================================================
- * subroutine functions for KBZipFile methods
- */
-static
-rc_t KBZipFileWriteInt (KBZipFile *self,
-                          int action,
-                          size_t *pnumwrit)
-{
-    bz_stream *strm;
-    unsigned avail_in;
-    int ret;
-    rc_t rc = 0;
-
-    assert (self);
-    assert (pnumwrit);
-
-    *pnumwrit = 0;
-
-    strm = &self->strm;
-    avail_in = strm->avail_in;
-    ret = 0;
-    /* run deflate() on input until output buffer not full, finish
-       compression if all of source has been read in */
-    do
-    {
-        uint32_t num_comp;
-        size_t written;
-        int zret;
-
-        /* compress one internal buffers worth */
-        strm->next_out = self->buff;
-        strm->avail_out = sizeof (self->buff);
-
-        zret = BZ2_bzCompress (strm, action);    /* no bad return value */
-
-        /* state not clobbered */
-        assert(zret == BZ_OK || zret == BZ_RUN_OK
-               || zret == BZ_FINISH_OK || zret == BZ_STREAM_END);
-
-        /* compression used the sizeof of the outbuffer - the amount
-         * it says it didn't use */
-        num_comp = sizeof(self->buff) - strm->avail_out;
-
-        rc = KFileWrite (self->file, self->filePosition, self->buff, num_comp, &written);
-
-        self->filePosition += written;
-
-        *pnumwrit = avail_in - strm->avail_in;
-
-    } while (strm->avail_out == 0);
-
-    assert (strm->avail_in == 0);     /* all input will be used */
-    return rc;
-}
-
-
-#if 0 /* obsolete */
-static
-int s_read(KBZipFile *self,
-           char *buffer,
-           size_t bsize,
-           size_t *num_read,
-           rc_t *rc)
-{
-    bz_stream* strm;
-    int ret;
-
-    assert(self && buffer && bsize && num_read);
-
-    strm = &self->strm;
-
-    ret = 0;
-    while (!*num_read) {
-        strm->next_out  = buffer;
-        strm->avail_out = bsize;
-        ret = BZ2_bzDecompress(strm);
-        assert(ret == BZ_OK || ret == BZ_STREAM_END);  /* state not clobbered */
-        *num_read = bsize - strm->avail_out;
-        if (strm->avail_out > 0) {
-            size_t src_read;
-            * rc = KFileRead
-                (self->file, self->filePosition, self->buff, sizeof(self->buff), &src_read);
-            if (*rc != 0)
-            {   return -70; }
-            strm->avail_in = src_read;
-            self->filePosition += src_read;
-            strm->next_in = self->buff;
-        }
-        if (!strm->avail_in)
-        {   break; }
-    }
-    return ret;
-}
-
-static rc_t old_KBZipFileReadInt ( KBZipFile * self, void * buffer, size_t bsize, size_t * num_read )
-{
-    rc_t rc = 0;
-    size_t numRead = 0;
-
-    do
-    {
-        int ret;
-        size_t have = 0;
-
-        if (self->BZ2_bzDecompressResult == BZ_STREAM_END)
-            break;
-        ret = s_read(self, (char*)buffer + numRead, bsize - numRead, &have, &rc);
-        if ( ret == -70 ) /* rc hack - known to not collide with bzlib errors */
-            return rc;
-        self->BZ2_bzDecompressResult = ret;
-        if (!have)
-            break;
-        numRead += have;
-    } while (numRead != bsize);
-
-    *num_read = numRead;
-    return rc;
-}
-#endif
-
-static
-rc_t KBZipFileReadInt (KBZipFile * self, void * buffer, size_t bsize, size_t * pnumread)
-{
-    bz_stream temp;     /* store some values here during a reinit after stream end */
-    bz_stream * strm;   /* alias for the object's bzip stream object */
-    size_t bleft = bsize;
-    size_t num_read;
-    size_t tot_read = 0;
-    rc_t rc = 0;
-
-    BZIP_DEBUG (("---------------\n%s: Enter requesting bsize %lu\n", __func__, bsize));
-
-    strm = &self->strm;
-
-    for (tot_read = 0; tot_read < bsize ; )
-    {
-        char * this_out;
-        size_t src_read;
-        int zret;
-        bool bin;
-        bool bout;
-        bool end;
-
-        bin = (strm->avail_in != 0);
-
-        BZIP_DEBUG (("%s: loop start tot_read %zu\n", __func__, tot_read));
-
-        strm->next_out = this_out = (char*)buffer + tot_read;
-        strm->avail_out = (unsigned int) (bsize - tot_read);
-
-        BZIP_DEBUG(("%s: call Decompress\n", __func__));
-
-        BZIP_DBGSTREAM (strm, "before BZ2_bzDecompress");
-
-        zret = BZ2_bzDecompress(strm);
-
-        BZIP_DBGSTREAM (strm, "after BZ2_bzDecompress");
-
-        switch (zret)
-        {
-            /* unexpected error returns from zlib */
-        default:
-            BZIP_DEBUG (("%s: undocumented error return in bzip Decompress\n", __func__));
-            rc = RC (rcFS, rcFile, rcReading, rcFile, rcUnknown);
-            PLOGERR (klogErr,
-                     (klogErr, rc, "unknown error decompressing BZip2 file "
-                      "error code '$(EC)'", "EC=%d", zret));
-            return rc;
-
-            /* known unfixable errors */
-        case BZ_PARAM_ERROR:
-            BZIP_DEBUG (("%s: internal programming error - bad parameters\n", __func__));
-            rc = RC (rcFS, rcFile, rcReading, rcSelf, rcInvalid);
-            if (strm == NULL)
-                BZIP_DEBUG (("%s: strm is NULL\n", __func__));
-            else
-            {
-                if (strm->state == NULL)
-                    BZIP_DEBUG (("%s: strm->state is NULL\n", __func__));
-                if (strm->avail_out < 1)
-                    BZIP_DEBUG (("%s: strm->avail_out < 1\n", __func__));
-            }
-            LOGERR (klogInt, rc, "bzip strm structure bad");
-            return rc;
-
-        case BZ_DATA_ERROR:
-            BZIP_DEBUG (("%s: data integrity error in bzip stream\n", __func__));
-            rc = RC (rcFS, rcFile, rcReading, rcData, rcCorrupt);
-            LOGERR (klogErr, rc, "bzip stream data error");
-            return rc;
-
-        case BZ_DATA_ERROR_MAGIC:
-            BZIP_DEBUG (("%s: data magic bytes error in bzip stream\n", __func__));
-            rc = RC (rcFS, rcFile, rcReading, rcData, rcIncorrect);
-            LOGERR (klogErr, rc, "bzip stream not a bzip stream");
-            return rc;
-
-        case BZ_MEM_ERROR:
-            BZIP_DEBUG (("%s: memory exhausted during BZip decompress\n", __func__));
-            rc = RC (rcFS, rcFile, rcReading, rcMemory, rcExhausted);
-            LOGERR (klogErr, rc, "not enough memory available during bzip decompress");
-            return rc;
-
-        case BZ_STREAM_END:
-            BZIP_DEBUG (("%s: BZ_STREAM_END\n", __func__));
-            end = true;
-            num_read = strm->next_out - this_out;
-            bout = (num_read != 0);
-            BZIP_DEBUG (("%s: num_read %zu\n", __func__, num_read));
-            self->completed = true;
-            BZIP_DBGSTREAM (strm, "before BZ2_bzDecompressEnd");
-            zret = BZ2_bzDecompressEnd(strm);
-            BZIP_DBGSTREAM (strm, "after BZ2_bzDecompressEnd");
-            if (zret == BZ_OK)
-            {
-                temp = *strm;
-                memset (strm, 0, sizeof *strm);
-                zret = BZ2_bzDecompressInit (strm, 1, 0);
-                BZIP_DBGSTREAM (strm, "after BZ2_bzDecompressInit");
-                strm->next_in = temp.next_in;
-                strm->avail_in = temp.avail_in;
-/*                 strm->next_out = temp.next_out; */
-/*                 strm->avail_out = temp.avail_out; */
-                strm->total_in_lo32 = temp.total_in_lo32;
-                strm->total_in_hi32 = temp.total_in_hi32;
-                strm->total_out_lo32 = temp.total_out_lo32;
-                strm->total_out_hi32 = temp.total_out_hi32;
-                BZIP_DBGSTREAM (strm, "after restore");
-            }
-            switch (zret)
-            {
-            case BZ_OK:
-                break;
-            default:
-                return RC (rcFS, rcFile, rcReading, rcFile, rcUnknown);
-            }
-            goto read_more;
-
-        case BZ_OK:
-            BZIP_DEBUG (("%s: BZ_OK\n", __func__));
-            end = false;
-            num_read = strm->next_out - this_out;
-            bout = (num_read != 0);
-            BZIP_DEBUG (("%s: num_read %zu\n", __func__, num_read));
-
-        read_more:
-            /* if we wanted more on this read, read some more compressed */
-            tot_read += num_read;
-            if (strm->avail_in == 0)
-            {
-                rc = KFileRead (self->file, self->filePosition, self->buff, 
-                                sizeof self->buff, &src_read);
-                if (rc)
-                    return rc;
-
-                BZIP_DEBUG (("%s: KFileRead read %u\n", __func__, src_read));
-
-                if (src_read == 0)
-                {
-                    BZIP_DEBUG (("%s: end %u in %u out %u\n", __func__, end, bin, bout));
-                
-                    if (!end && bin && !bout)
-                        rc = RC (rcFS, rcFile, rcReading, rcData, rcInsufficient);
-                    goto done;
-                }
-                strm->avail_in = (unsigned int) src_read;
-                self->filePosition += src_read;
-                strm->next_in = self->buff;
-
-                /* if src_read == 0 but we are not at BZ_STREAM_END
-                 * we have an error
-                 */
-                if (src_read == 0)
-                    bleft = 0;
-            }
-            break;
-        }
-        if (rc)
-            break;
-        BZIP_DEBUG (("%s: loop end tot_read %zu\n", __func__, tot_read));
-    }
-done:
-    BZIP_DEBUG (("%s: returning tot_read %zu\n\n\n", __func__, tot_read));
-    *pnumread = tot_read;
-    return rc;
-}
-
-
-static rc_t KBZipFileReadSeek (KBZipFile *self, uint64_t pos)
-{
-    rc_t rc = 0;
-    size_t num_read = 0;
-    size_t to_read;
-    uint8_t buff [ 32 * 1024 ];
-
-    for ( to_read = sizeof buff; self -> myPosition < pos; self -> myPosition += num_read )
-    {
-	if (self->myPosition + sizeof buff > pos)
-	    to_read = pos - self->myPosition;
-
-        BZIP_DEBUG(("%s: call KBZipFileReadInt to_read %zu \n",__func__));
-
-	rc = KBZipFileReadInt ( self, buff, to_read, &num_read);
-
-        BZIP_DEBUG(("%s: return KBZipFileReadInt num_read %zu \n",__func__));
-
-	if ( rc )
-	    break;
-
-	if (num_read == 0)
-	    break;
-    }
-    return rc;
-}
-
-
-/* ======================================================================
- * virtual table methods for KBZipFile object
- */
-
-/* Destroy
- *  destroy file
- */
-static rc_t CC KBZipFileDestroy (KBZipFile *self)
-{
-    rc_t rc = 0, orc = 0;
-
-    if (self)
-    {
-        if (self->file != NULL)
-        {
-            int zret = BZ_OK;
-
-            if (self->dad.write_enabled)
-            {
-                /* flush out end of compressed data */
-/*                 if (self->completed == false) */
-/*                 { */
-                    size_t ignored;
-                    bz_stream* strm = &self->strm;
-
-                    strm->avail_in = 0;
-                    strm->next_in = NULL;
-                    rc = KBZipFileWriteInt(self, BZ_FINISH, &ignored);
-/*                     assert (zret == BZ_STREAM_END); */        /* stream will be complete */
-/*                 } */
-
-                zret = BZ2_bzCompressEnd(&self->strm);   /* clean up */
-
-                self->completed = true;
-            }
-            else if (self->dad.read_enabled)
-            {
-                zret = BZ2_bzDecompressEnd (&self->strm);
-            }
-            else
-            {
-                rc = RC (rcFS, rcFile, rcDestroying, rcSelf, rcInvalid);
-                LOGERR (klogInt, orc, "corrupt object "
-                        "closing bzip file object");
-            }
-            if (zret != BZ_OK)
-            {
-                orc = RC (rcFS, rcFile, rcDestroying, rcParam, rcInvalid);
-                LOGERR (klogInt, orc, "bad parameters - coding error on "
-                        "closing bzip file object");
-                if (rc == 0)
-                    rc = orc;
-            }
-
-            orc = KFileRelease (self->file);
-            if (rc == 0)
-                rc = orc;
-        }
-        free (self);
-    }
-    return rc;
-}
-
-
-/* GetSysFile
- *  returns an underlying system file object
- *  and starting offset to contiguous region
- *  suitable for memory mapping, or NULL if
- *  no such file is available.
- */
-static struct KSysFile *CC KBZipFileGetSysFile (const KBZipFile *self,
-                                                uint64_t *offset)
-{
-    return NULL;
-}
-
-
-/* RandomAccess
- *  ALMOST by definition, the file is random access
- *
- *  certain file types will refuse random access
- *  these include FIFO and socket based files, but also
- *  wrappers that require serial access ( e.g. compression )
- *
- *  returns 0 if random access, error code otherwise
- */
-static
-rc_t CC KBZipFileRandomAccess (const KBZipFile *self)
-{
-    return RC ( rcFS, rcFile, rcAccessing, rcFunction, rcUnsupported );
-}
-
-
-/* Size
- *  returns size in bytes of file
- *
- *  "size" [ OUT ] - return parameter for file size
- */
-static
-rc_t CC KBZipFileSize (const KBZipFile *self, uint64_t *size)
-{
-    return RC ( rcFS, rcFile, rcAccessing, rcFunction, rcUnsupported );
-}
-
-
-/* SetSize
- *  sets size in bytes of file
- *
- *  "size" [ IN ] - new file size
- */
-static
-rc_t CC KBZipFileSetSize(KBZipFile *self,
-                                uint64_t size)
-{
-    return RC ( rcFS, rcFile, rcUpdating, rcFunction, rcUnsupported );
-}
-
-
-/* Read
- *  read file from known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT ] - return parameter giving number of bytes
- *  actually read. when returned value is zero and return code is
- *  also zero, interpreted as end of file.
- */
-static
-rc_t CC KBZipFileRead (const KBZipFile *cself,
-                              uint64_t pos,
-                              void *buffer,
-                              size_t bsize,
-                              size_t *num_read)
-{
-    KBZipFile *self = (KBZipFile*) cself;
-    rc_t rc = 0;
-
-    size_t numRead = 0, ignore;
-
-    if (self->dad.read_enabled == false)
-        return RC (rcFS, rcFile, rcReading, rcFunction, rcUnsupported);
-
-    if (!num_read)
-    {   num_read = &ignore; }
-
-    *num_read = 0;
-
-    if (!cself || !buffer)
-        return RC ( rcFS, rcFile, rcReading, rcParam, rcNull );
-
-    if (!bsize)
-    {   return 0; }
-
-    if (pos < self->myPosition)
-    {
-        return RC ( rcFS, rcFile, rcReading, rcParam, rcInvalid );
-    }
-
-    BZIP_DEBUG(("%s: pos %lu bsize %zu\n", __func__, pos, bsize));
-    BZIP_DEBUG(("%s: myPosition %lu numRead '%zu'\n", __func__, self->myPosition, numRead));
-
-    if (pos > self->myPosition)
-    {
-        rc =  KBZipFileReadSeek (self, pos);
-        if (rc)
-            return rc;
-        if (pos != self->myPosition)
-            return 0;
-    }
-
-    rc = KBZipFileReadInt ( self, buffer, bsize, &numRead );
-    if (rc)
-        return rc;
-
-    *num_read = numRead;
-
-    self->myPosition += numRead;
-
-    BZIP_DEBUG(("%s: myPosition %lu numRead '%zu'\n", __func__, self->myPosition, numRead));
-
-    return 0;
-}
-
-
-/* Write
- *  write file at known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ IN ] and "size" [ IN ] - data to be written
- *
- *  "num_writ" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually written
- */
-static
-rc_t CC KBZipFileWrite (struct KBZipFile *self,
-                        uint64_t pos,
-                        const void *buffer,
-                        size_t bsize,
-                        size_t *pnum_writ)
-{
-    rc_t rc = 0;
-
-    if (self->dad.write_enabled == false)
-        rc = RC (rcFS, rcFile, rcWriting, rcFunction, rcUnsupported);
-    else
-    {
-        *pnum_writ = 0;
-
-        if (pos != self->myPosition)
-            rc = RC (rcFS, rcFile, rcWriting, rcParam, rcIncorrect);
-
-        else
-        {
-            bz_stream * strm;
-            size_t num_writ;
-
-            strm = &self->strm;
-            strm->next_in  = (char*) buffer;
-            strm->avail_in = (unsigned int) bsize;
-
-            rc =  KBZipFileWriteInt (self, BZ_RUN, &num_writ);
-            if (rc == 0)
-            {
-                self->myPosition += num_writ;
-                *pnum_writ = num_writ;
-            }
-        }
-    }
-    return rc;
-}
-
-
-/* Type
- *  returns a KFileDesc
- *  not intended to be a content type,
- *  but rather an implementation class
- */
-static
-uint32_t CC KBZipFileType (const KBZipFile *self)
-{
-    return KFileType (self->file);
-}
-
-
-/* ======================================================================
- * virtual table for KBZipFile object
- */
-static
-KFile_vt_v1 KBZipFile_vt_v1 =
-{
-    /* version */
-    1, 1,
-
-    /* 1.0 */
-    KBZipFileDestroy,
-    KBZipFileGetSysFile,
-    KBZipFileRandomAccess,
-    KBZipFileSize,
-    KBZipFileSetSize,
-    KBZipFileRead,
-    KBZipFileWrite,
-
-    /* 1.1 */
-    KBZipFileType
-};
-
-
-/* ======================================================================
- * Factory functions
- */
-
-LIB_EXPORT rc_t CC KFileMakeBzip2ForRead (const struct KFile **pnew_obj,
-                                          const struct KFile *compfile)
-{
-    rc_t rc;
-
-    if ( pnew_obj == NULL || compfile == NULL )
-        return RC ( rcFS, rcFile, rcConstructing, rcParam, rcNull );
-
-    else
-    {
-        KBZipFile *obj;
-
-        *pnew_obj = NULL;
-
-        obj = (KBZipFile*) calloc(1,sizeof(KBZipFile));
-        if (!obj)
-        {
-            rc = RC (rcFS, rcFile, rcConstructing, rcMemory, rcExhausted);
-            LOGERR (klogErr, rc, "memory exhausted building bzip2 "
-                    "file object");
-        }
-        else
-        {
-            rc = KFileInit(&obj->dad, (const KFile_vt*) &KBZipFile_vt_v1,
-                           "KBZipFile", "no-name", true, false);
-            if (rc == 0)
-            {
-                bz_stream * strm;
-                int zret;
-
-                strm = &obj->strm;
-                zret = BZ2_bzDecompressInit (strm, 1, /* verbosity */
-                                             0); /* small */
-
-                switch (zret)
-                {
-                case BZ_OK:
-                    obj->completed = true;
-                    rc = KFileAddRef (compfile);
-                    if (rc == 0)
-                    {
-                        obj->file = (KFile *)compfile;
-                        *pnew_obj = &obj->dad;
-                        return 0;
-                    }
-                    break;
-
-                case BZ_CONFIG_ERROR:
-                    rc = RC (rcFS, rcFile, rcConstructing, rcLibrary,
-                             rcCorrupt);
-                    LOGERR (klogFatal, rc, "bzip2 library miscompiled");
-                    break;
-
-                case BZ_PARAM_ERROR:
-                    rc = RC (rcFS, rcFile, rcConstructing, rcParam, rcInvalid);
-                    LOGERR (klogInt, rc, "coding error bzip2 file object");
-                    break;
-
-                case BZ_MEM_ERROR:
-                    rc = RC (rcFS, rcFile, rcConstructing, rcMemory,
-                             rcExhausted);
-                    LOGERR (klogErr, rc, "memory exhausted building bzip2 "
-                            "file object");
-                    break;
-
-                default:
-                    rc = RC (rcFS, rcFile, rcConstructing, rcLibrary,
-                             rcUnexpected);
-                    LOGERR (klogFatal, rc, "bzip2 library return unexpected "
-                            "error");
-                    break;
-
-                }
-            }
-        }
-        KBZipFileDestroy (obj);
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC KFileMakeBzip2ForWrite (struct KFile **pnew_obj,
-                                           struct KFile *compfile)
-{
-    rc_t rc;
-
-    if ( pnew_obj == NULL || compfile == NULL )
-        rc= RC ( rcFS, rcFile, rcConstructing, rcParam, rcNull );
-
-    else
-    {
-        KBZipFile *obj;
-
-        *pnew_obj = NULL;
-
-        obj = (KBZipFile*)calloc(1,sizeof(KBZipFile));
-        if (obj == NULL)
-        {
-            rc = RC (rcFS, rcFile, rcConstructing, rcMemory, rcExhausted);
-            LOGERR (klogErr, rc, "memory exhausted building bzip2 "
-                    "file object");
-        }
-        else
-        {
-            rc = KFileInit(&obj->dad, (const KFile_vt*)&KBZipFile_vt_v1,
-                           "KBZipFile", "no-name", false, true);
-            if (rc == 0)
-            {
-                bz_stream* strm;
-                int zret;
-
-                strm = &obj->strm;
-                zret = BZ2_bzCompressInit(strm, 9, /* blockSize100k */
-                                          1, /* verbosity */
-                                          30); /* workFactor */
-                switch (zret)
-                {
-                case BZ_OK:
-                    obj->completed = true;
-                    rc = KFileAddRef (compfile);
-                    if (rc == 0)
-                    {
-                        obj->file = compfile;
-                        *pnew_obj = &obj->dad;
-                        return 0;
-                    }
-                    break;
-
-                case BZ_CONFIG_ERROR:
-                    rc = RC (rcFS, rcFile, rcConstructing, rcLibrary,
-                             rcCorrupt);
-                    LOGERR (klogFatal, rc, "bzip2 library miscompiled");
-                    break;
-
-                case BZ_PARAM_ERROR:
-                    rc = RC (rcFS, rcFile, rcConstructing, rcParam, rcInvalid);
-                    LOGERR (klogInt, rc, "coding error bzip2 file object");
-                    break;
-
-                case BZ_MEM_ERROR:
-                    rc = RC (rcFS, rcFile, rcConstructing, rcMemory,
-                             rcExhausted);
-                    LOGERR (klogErr, rc, "memory exhausted building bzip2 "
-                            "file object");
-                    break;
-
-                default:
-                    rc = RC (rcFS, rcFile, rcConstructing, rcLibrary,
-                             rcUnexpected);
-                    LOGERR (klogFatal, rc, "bzip2 library return unexpected "
-                            "error");
-                    break;
-
-                }
-            }
-        }
-        KBZipFileDestroy (obj);
-    }
-    return rc;
-}
-
-
-/* EOF */
diff --git a/libs/kfs/cacheteefile.c b/libs/kfs/cacheteefile.c
deleted file mode 100644
index 0139940..0000000
--- a/libs/kfs/cacheteefile.c
+++ /dev/null
@@ -1,1689 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-#include <kfs/extern.h>
-
-struct KCacheTeeFile;
-#define KFILE_IMPL struct KCacheTeeFile
-#include <kfs/impl.h>
-#include <kfs/lockfile.h>
-
-#include <klib/rc.h>
-#include <klib/log.h>
-#include <klib/out.h>
-#include <klib/text.h>
-#include <klib/printf.h>
-#include <klib/checksum.h>
-
-#include <kfs/cacheteefile.h>
-
-#include <sysalloc.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- layout of local file:
- 
- CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC MMMMMMMMMMMMMM SS BB
-
- C ... file content in valid/invalid blocks
- M ... bitmap of blocks bytes = ( ( ( content-size / block-size ) + 1 ) / 8 ) + 1 )
- S ... size of content ( uint64_t ) 8 bytes
- B ... used blocksize  ( uint32_t ) 4 bytes
- */
-
-
-/*--------------------------------------------------------------------------
- * KCacheTeeFile
- */
-
-#define CACHE_TEE_DEFAULT_BLOCKSIZE ( 32 * 1024 )
-#define CACHE_TEE_REPORT 0
-
-typedef struct KCacheTeeFile
-{
-    KFile dad;
-    const KFile * remote;
-    KFile * local;
-    KFile * logger;
-    KDirectory * dir;
-    KLockFile * lock;
-
-    uint8_t * bitmap;
-    uint8_t * scratch_buffer;
-
-    uint64_t remote_size;
-    uint64_t local_size;
-    uint64_t block_count;
-    uint64_t log_file_pos;
-    uint64_t first_block_in_scratch;
-
-    /* size_t */ uint64_t bitmap_bytes;
-    /* size_t */ uint64_t scratch_size;
-    /* size_t */ uint64_t valid_scratch_bytes;
-    uint32_t block_size;
-    uint32_t cluster_factor;
-    bool fully_in_cache;
-    bool report;
-    bool local_read_only;
-    char local_path [ 1 ];
-} KCacheTeeFile;
-
-
-const uint8_t BitNr2Mask[ 8 ] =
-{
-         /* 0  1  2  3   4   5   6    7  */
-            1, 2, 4, 8, 16, 32, 64, 128
-};
-
-#define IS_CACHE_BIT( CacheFile, Block_Nr ) ( CacheFile->bitmap[ (Block_Nr) >> 3 ] & BitNr2Mask[ (Block_Nr) & 7 ] ) > 0
-
-#define IS_BITMAP_BIT( BitMap, Block_Nr ) ( BitMap[ (Block_Nr) >> 3 ] & BitNr2Mask[ (Block_Nr) & 7 ] ) > 0
-
-#define BITS_2_BYTES( BitCount ) ( ( ( BitCount ) + 7 ) >> 3 )
-
-#define SIZE_2_BLOCK_COUNT( Number_Of_Bytes, Block_Size ) ( ( ( Number_Of_Bytes ) + ( Block_Size ) - 1 ) / ( Block_Size ) )
-
-
-static rc_t calculate_local_size_from_remote_size( KCacheTeeFile *self )
-{
-    rc_t rc = 0;
-    if ( self->block_size > 0 )
-    {
-        self->block_count = SIZE_2_BLOCK_COUNT( self->remote_size, self->block_size );
-        self->bitmap_bytes = BITS_2_BYTES( self->block_count );
-        self->local_size = ( self->remote_size +
-                             self->bitmap_bytes + 
-                             sizeof self->remote_size + 
-                             sizeof self->block_size );
-    }
-    else
-    {
-        rc = RC ( rcFS, rcFile, rcConstructing, rcParam, rcInvalid );
-        LOGERR( klogErr, rc, "div by zero attempt in calculating local size" );
-    }
-    return rc;
-}
-
-
-static rc_t create_bitmap_buffer( uint8_t ** bitmap, /* size_t */ uint64_t bitmap_bytes )
-{
-    rc_t rc = 0;
-    *bitmap = calloc ( sizeof **bitmap, bitmap_bytes );
-    if ( *bitmap == NULL )
-    {
-        rc = RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-        LOGERR( klogErr, rc, "init local bitmap-area" );
-    }
-    return rc;
-}
-
-static rc_t create_bitmap( KCacheTeeFile *self )
-{
-    return create_bitmap_buffer( &self->bitmap, self->bitmap_bytes );
-}
-
-
-static bool is_bitmap_full( const uint8_t * bitmap, /* size_t */ uint64_t bitmap_bytes, uint64_t block_count )
-{
-    /* size_t */ uint64_t bitmap_byte = 0;
-    while( bitmap_byte < ( bitmap_bytes - 1 ) )
-    {
-        if ( bitmap[ bitmap_byte++ ] != 0xFF )
-            return false;
-    }
-    {
-        uint64_t block_id = ( bitmap_byte << 3 );
-        while ( block_id < block_count )
-        {
-            bool block_cached = IS_BITMAP_BIT( bitmap, block_id );
-            if ( !block_cached )
-                return false;
-            ++block_id;
-        }
-    }
-    return true;
-}
-
-
-static void report( const KCacheTeeFile * cf )
-{
-    OUTMSG(( "log  : %s\n", cf -> logger != NULL ? "YES" : "NO" ));
-    OUTMSG(( "size : local=%,lu remote=%,lu\n", cf -> local_size, cf -> remote_size ));
-    OUTMSG(( "block: size=%,u count=%,u\n", cf -> block_size, cf -> block_count ));
-    OUTMSG(( "bitmp: bytes=%,u\n", cf -> bitmap_bytes ));
-    OUTMSG(( "fully: %s\n", cf -> fully_in_cache ? "YES" : "NO" ));
-}
-
-
-static rc_t init_new_local_file( KCacheTeeFile * cf )
-{
-    rc_t rc = create_bitmap( cf );
-    cf->fully_in_cache = false;
-    if ( rc == 0 )
-    {
-        size_t written;
-        uint64_t pos = cf -> remote_size;
-        /* write the bitmap ( zero'd out ) into the local file */
-        rc = KFileWriteAll ( cf -> local, pos, 
-                             cf -> bitmap, cf -> bitmap_bytes, &written );
-        if ( rc == 0 && written != cf -> bitmap_bytes )
-        {
-            rc = RC ( rcFS, rcFile, rcConstructing, rcParam, rcInvalid );
-            LOGERR( klogErr, rc, "no full initialization of local file bitmap" );
-        }
-        if ( rc == 0 && cf->report )
-        {
-            OUTMSG(( "init new cachefile: %u bytes of bitmaps written at pos %lu\n", written, pos ));
-        }
-
-        /* write the remote-file-size into the local file ( uint64_t = 8 bytes )*/
-        if ( rc == 0 )
-        {
-            pos += cf -> bitmap_bytes;
-            rc = KFileWriteAll ( cf -> local, pos,
-                                 &cf -> remote_size, sizeof( cf -> remote_size ), &written );
-            if ( rc == 0 && written != sizeof( cf -> remote_size ) )
-            {
-                rc = RC ( rcFS, rcFile, rcConstructing, rcParam, rcInvalid );
-                LOGERR( klogErr, rc, "cannot write remote-filesize into local file" );
-            }
-        }
-        if ( rc == 0 && cf->report )
-        {
-            OUTMSG(( "init new cachefile: %u bytes of remote size written at pos %lu ( remote-size = %lu )\n", written, pos, cf->remote_size ));
-        }
-
-        /* write the block-size into the local file ( size_t = 4 bytes )*/
-        if ( rc == 0 )
-        {
-            pos += sizeof( cf -> remote_size );
-            rc = KFileWriteAll ( cf -> local, pos,
-                                 &cf -> block_size, sizeof( cf -> block_size ), &written );
-            if ( rc == 0 && written != sizeof( cf -> block_size ) )
-            {
-                rc = RC ( rcFS, rcFile, rcConstructing, rcParam, rcInvalid );
-                LOGERR( klogErr, rc, "cannot write block-size into local file" );
-            }
-        }
-        if ( rc == 0 && cf->report )
-        {
-            OUTMSG(( "init new cachefile: %u bytes of block_size written at pos %lu ( block-size = %lu )\n", written, pos, cf->block_size ));
-        }
-
-    }
-    if ( rc == 0 && cf -> report )
-        report( cf );
-    return rc;
-}
-
-
-static rc_t read_block_size( const struct KFile * self, uint64_t local_size, uint32_t *block_size, bool silent )
-{
-    size_t num_read;
-    uint64_t pos = local_size - ( sizeof *block_size );
-    /* read the block-size, compare to the requested block-size */
-    rc_t rc =  KFileRead( self, pos, block_size, sizeof *block_size, &num_read );
-    if ( rc != 0 )
-    {
-        if ( !silent )
-        {
-            LOGERR( klogErr, rc, "cannot read block-size from local file" );
-        }
-    }
-    else if ( num_read != sizeof *block_size )
-    {
-        rc = RC ( rcFS, rcFile, rcValidating, rcParam, rcInvalid );
-        if ( !silent )
-        {
-            LOGERR( klogErr, rc, "cannot read block-size from local file" );
-        }
-    }
-    if ( rc == 0 && *block_size == 0 )
-    {
-        rc = RC ( rcFS, rcFile, rcValidating, rcParam, rcInvalid );
-        if ( !silent )
-        {
-            LOGERR( klogErr, rc, "block-size read from local file is zero" );
-        }
-    }
-    return rc;
-}
-
-
-static rc_t read_content_size( const struct KFile * self, uint64_t local_size, uint64_t *content_size, bool silent )
-{
-    size_t num_read;
-    uint64_t pos = ( local_size - 4 ) - sizeof( *content_size );
-    rc_t rc =  KFileRead ( self, pos, content_size, sizeof *content_size, &num_read );
-    if ( rc != 0 )
-    {
-        if ( !silent )
-        {
-            LOGERR( klogErr, rc, "cannot read content-size from local file" );
-        }
-    }
-    else if ( num_read != sizeof *content_size )
-    {
-        rc = RC ( rcFS, rcFile, rcValidating, rcParam, rcInvalid );
-        if ( !silent )
-        {
-            LOGERR( klogErr, rc, "cannot read content-size from local file" );
-        }
-    }
-    if ( rc == 0 && *content_size == 0 )
-    {
-        rc = RC ( rcFS, rcFile, rcValidating, rcParam, rcInvalid );
-        if ( !silent )
-        {
-            LOGERR( klogErr, rc, "content-size read from local file is zero" );
-        }
-    }
-    if ( rc == 0 && *content_size >= local_size )
-    {
-        rc = RC ( rcFS, rcFile, rcValidating, rcParam, rcInvalid );
-        if ( !silent )
-        {
-            LOGERR( klogErr, rc, "content-size read from local file is invalid" );
-        }
-    }
-    return rc;
-}
-
-
-static rc_t verify_file_structure( const uint64_t local_size, const uint32_t block_size, const uint64_t content_size,
-                                   uint64_t * block_count, /* size_t */ uint64_t * bitmap_bytes, bool silent )
-{
-    rc_t rc = 0;
-    uint64_t expected_size;
-
-    *block_count = SIZE_2_BLOCK_COUNT( content_size, block_size );
-    *bitmap_bytes = BITS_2_BYTES( *block_count );
-
-    /* check if the values 'content-size' and 'block_size' result in the currect real file size */
-    expected_size = content_size + *bitmap_bytes + sizeof ( local_size ) + sizeof ( block_size );
-    if ( expected_size != local_size )
-    {
-        rc = RC ( rcFS, rcFile, rcValidating, rcParam, rcInvalid );
-        if ( !silent )
-        {
-            LOGERR( klogErr, rc, "content-size/blocksize do not make sense for this file" );
-        }
-    }
-    return rc;
-}
-
-
-static rc_t verify_existing_local_file( KCacheTeeFile * cf, bool silent )
-{
-    /* size_t */ uint64_t bitmap_bytes;
-    uint32_t block_size;
-    uint64_t content_size, block_count;
-
-    rc_t rc = read_block_size ( cf -> local, cf -> local_size, &block_size, silent );
-    /* read content-size, compare to the content-size of the remote file */
-    if ( rc == 0 )
-        rc = read_content_size ( cf -> local, cf -> local_size, &content_size, silent );
-
-    if ( rc == 0 && content_size != cf -> remote_size )
-    {
-        rc = RC ( rcFS, rcFile, rcConstructing, rcParam, rcInvalid );
-        PLOGERR( klogErr, ( klogErr, rc, "content-size in local file $(ls) does not match size of remote file $(rs)", 
-                           "ls=%lu,rs=%lu", content_size, cf -> remote_size ) );
-    }
-
-    /* check if the local file has the right size ( content + bitmap + content_size + block_size )*/
-    if ( rc == 0 )
-        rc = verify_file_structure ( cf -> local_size, block_size, content_size, &block_count, &bitmap_bytes, silent );
-
-    /* check if the requested block-size equals the stored block-size */
-    if ( rc == 0 )
-    {
-        if ( cf -> block_size == 0 )
-            cf -> block_size = CACHE_TEE_DEFAULT_BLOCKSIZE;
-        if ( cf -> block_size != block_size )
-        {
-            PLOGMSG( klogWarn, ( klogWarn, "block-size in local file $(ls) does not match requested value $(rv)",
-                                "ls=%u,rv=%u", block_size, cf -> block_size ) );
-        }
-        /* use the block-size as stored in the file */
-        cf -> block_size = block_size;
-        cf -> block_count = block_count;
-        cf -> bitmap_bytes = bitmap_bytes;
-        rc = create_bitmap( cf );
-    }
-
-    /* read the bitmap into the memory ... */
-    if ( rc == 0 )
-    {
-        size_t num_read;
-        /* read the bitmap from the local file */
-        rc = KFileReadAll ( cf -> local, content_size,
-                            cf -> bitmap, cf -> bitmap_bytes, &num_read );
-        if ( rc != 0 )
-        {
-            LOGERR( klogErr, rc, "cannot read bitmap from local file" );
-        }
-        else if ( num_read != cf -> bitmap_bytes )
-        {
-            rc = RC ( rcFS, rcFile, rcConstructing, rcParam, rcInvalid );
-            PLOGERR( klogErr, ( klogErr, rc, "cannot read $(ls) bitmap-bytes from local file, read $(rs) instead", 
-                           "ls=%lu,rs=%lu", cf -> bitmap_bytes, num_read ));
-        }
-    }
-
-    /* check if we have the whole remote file in cache */
-    if ( rc == 0 )
-        cf -> fully_in_cache = is_bitmap_full( cf -> bitmap, cf -> bitmap_bytes, cf -> block_count ); 
-
-    if ( rc == 0 && cf -> report )
-        report( cf );
-
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC IsCacheFileComplete( const struct KFile * self, bool * is_complete, bool silent )
-{
-    rc_t rc;
-    if ( self == NULL )
-        rc = RC( rcFS, rcFile, rcValidating, rcSelf, rcNull );
-    else if ( is_complete == NULL )
-        rc = RC( rcFS, rcFile, rcValidating, rcParam, rcNull );
-    else
-    {
-        uint64_t local_size;
-        *is_complete = false;
-        rc = KFileSize( self, &local_size );
-        if ( rc != 0 )
-        {
-            if ( !silent )
-            {
-                LOGERR( klogErr, rc, "cannot detect filesize when checking if cached file is complete" );
-            }
-        }
-        /* TODO: need to do a better constant tha a magic number */
-        else if (local_size < 13)
-        {
-            rc = RC ( rcFS, rcFile, rcValidating, rcSize, rcInsufficient );
-            if ( !silent )
-            {
-                LOGERR( klogErr, rc, "cannot use filesize of zero when checking if cached file is complete" );
-            }
-        }
-        else
-        {
-            uint32_t block_size;
-            rc = read_block_size( self, local_size, &block_size, silent );
-            if ( rc == 0 )
-            {
-                uint64_t content_size;
-
-                rc = read_content_size( self, local_size, &content_size, silent );
-                /* create bitmap buffer */
-                if ( rc == 0 )
-                {
-                    uint64_t block_count;
-                    /* size_t */ uint64_t bitmap_bytes;
-                    rc = verify_file_structure( local_size, block_size, content_size, &block_count, &bitmap_bytes, silent );
-                    if ( rc == 0 )
-                    {
-                        uint8_t * bitmap = NULL;
-                        rc = create_bitmap_buffer( &bitmap, bitmap_bytes );
-                        if ( rc == 0 )
-                        {
-                            size_t num_read;
-                            /* read the bitmap into the memory ... */
-                            rc = KFileReadAll ( self, content_size, bitmap, bitmap_bytes, &num_read );
-                            if ( rc != 0 )
-                            {
-                                if ( !silent )
-                                    LOGERR( klogErr, rc, "cannot read bitmap from local file" );
-                            }
-                            else if ( num_read != bitmap_bytes )
-                            {
-                                rc = RC ( rcFS, rcFile, rcConstructing, rcParam, rcInvalid );
-                                if ( !silent )
-                                {
-                                    PLOGERR( klogErr, ( klogErr, rc, "cannot read $(ls) bitmap-bytes from local file, read $(rs) instead", 
-                                                        "ls=%lu,rs=%lu", bitmap_bytes, num_read ));
-                                }
-                            }
-                        }
-                        if ( rc == 0 )
-                            *is_complete = is_bitmap_full( bitmap, bitmap_bytes, block_count );
-
-                        if ( bitmap != NULL )
-                            free( bitmap );
-                    }
-                }
-            }
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC TruncateCacheFile( struct KFile * self )
-{
-    rc_t rc;
-    if ( self == NULL )
-        rc = RC( rcFS, rcFile, rcResizing, rcSelf, rcNull );
-    else
-    {
-        uint64_t local_size;
-        rc = KFileSize( self, &local_size );
-        if ( rc != 0 )
-        {
-            LOGERR( klogErr, rc, "cannot detect filesize when truncating cached file" );
-        }
-        else
-        {
-            uint32_t block_size;
-            rc = read_block_size( self, local_size, &block_size, false );
-            if ( rc == 0 )
-            {
-                uint64_t content_size;
-                rc = read_content_size( self, local_size, &content_size, false );
-                if ( rc == 0 )
-                {
-                    uint64_t block_count;
-                    /* size_t */ uint64_t bitmap_bytes;
-                    rc = verify_file_structure( local_size, block_size, content_size, &block_count, &bitmap_bytes, false );
-
-                    /* truncate the file by setting the new (shorter) filesize */
-                    if ( rc == 0 )
-                        rc = KFileSetSize( self, content_size );
-                }
-            }
-        }
-    }
-    return rc;
-}
-
-
-static rc_t promote_cache( KCacheTeeFile * cf )
-{
-    char cache_file_name [ 4096 ];
-    char temp_file_name [ 4096 ];
-    size_t num_writ;
-    rc_t rc = string_printf ( cache_file_name, sizeof cache_file_name, &num_writ, "%s.cache", cf -> local_path );
-    if ( rc == 0 )
-        rc = string_printf ( temp_file_name, sizeof temp_file_name, &num_writ, "%s.cache.temp", cf -> local_path );
-
-    /* (1) releaes open cache file ( windows cannot rename open files ) */
-    if ( rc == 0 )
-        rc = KFileRelease( cf -> local );
-
-    /* (2) rename to temporary name */
-    if ( rc == 0 )
-    {
-        cf -> local = NULL;
-        rc = KDirectoryRename ( cf -> dir, true, cache_file_name, temp_file_name );
-    }
-
-    /* (3) open from temporary name */
-    if ( rc == 0 )
-        rc = KDirectoryOpenFileWrite( cf -> dir, &cf -> local, true, "%s", temp_file_name );
-
-    /* (4) perform truncation */
-    if ( rc == 0 )
-        rc = TruncateCacheFile( cf -> local );
-    
-    /* (5) releaes open temp. cache file ( windows cannot rename open files ) */
-    if ( rc == 0 )
-        rc = KFileRelease( cf -> local );
-
-    /* (6) rename to final filename ( windows cannot rename open files ) */
-    if ( rc == 0 )
-    {
-        cf -> local = NULL;
-        rc = KDirectoryRename ( cf -> dir, true, temp_file_name, cf -> local_path );
-    }
-
-    /* (6) open from final filename */
-    if ( rc == 0 )
-        rc = KDirectoryOpenFileWrite( cf -> dir, &cf -> local, true, "%s", cf -> local_path );
-
-    return rc;
-}
-
-
-/* Destroy
- */
-static rc_t CC KCacheTeeFileDestroy( KCacheTeeFile *self )
-{
-    if ( self->report )
-    {
-        OUTMSG(( "\nDESTROY cacheteefile '%s'\n\n", self -> local_path ));
-    }
-
-    if ( !self -> local_read_only && self -> lock != NULL )
-    {
-        rc_t rc = IsCacheFileComplete ( self -> local, &self -> fully_in_cache, false );
-        if ( rc == 0 && self -> fully_in_cache )
-        {
-            if ( self->report )
-            {
-                OUTMSG(( "\nPROMOTING cacheteefile '%s'\n\n", self -> local_path ));
-            }
-            promote_cache( self );
-        }
-    }
-
-    if ( self->bitmap != NULL )
-        free( self->bitmap );
-    if ( self->scratch_buffer != NULL )
-        free( self->scratch_buffer );
-
-    KDirectoryRelease ( self->dir );
-    KFileRelease ( self -> remote );
-    KFileRelease ( self -> local );
-    KLockFileRelease ( self -> lock );
-    KFileRelease ( self -> logger );
-
-    free ( self );
-    return 0;
-}
-
-
-
-static rc_t log_to_file( KFile *log, uint64_t *log_file_pos,
-                         uint64_t pos, size_t bsize, size_t num_read )
-{
-    char buffer[ 1024 ];
-    size_t printf_written;
-    rc_t rc = string_printf( buffer, sizeof buffer, &printf_written, 
-                             "READ at %lu.%u read = %u\n",
-                             pos, bsize, num_read );
-    if ( rc == 0 )
-    {
-        size_t log_written;
-        rc = KFileWriteAll ( log, *log_file_pos, buffer, printf_written, &log_written );
-        if ( rc == 0 )
-            *log_file_pos += log_written;
-    }
-    return rc;
-}
-
-
-static void set_bitmap( const KCacheTeeFile *cself, uint64_t start_block, uint64_t block_count )
-{
-    uint64_t block_idx, block_nr;
-    for ( block_idx = 0, block_nr = start_block; 
-          block_idx < block_count; 
-          ++block_idx, ++block_nr )
-    {
-        cself->bitmap[ block_nr >> 3 ] |= BitNr2Mask[ block_nr & 0x07 ];
-    }
-}
-
-
-static rc_t write_bitmap( const KCacheTeeFile *cself, uint64_t start_block, uint64_t block_count )
-{
-    size_t written;
-    uint32_t start_block_byte = ( start_block >> 3 );
-    uint32_t end_block_byte = ( ( start_block + block_count - 1 ) >> 3 );
-    uint64_t pos = cself->remote_size + start_block_byte;
-    size_t to_write = ( end_block_byte - start_block_byte ) + 1;
-    rc_t rc = KFileWriteAll( cself->local, pos, &cself->bitmap[ start_block_byte ], to_write, &written );
-    if ( rc != 0 )
-    {
-        PLOGERR( klogErr, ( klogErr, rc, "cannot write local-file-bitmap block $(sb).$(cn)", 
-                           "sb=%lu,cn=%lu", start_block, block_count ) );
-    }
-    if ( rc == 0 && cself->report )
-    {
-        OUTMSG(( "writing bitmap: %u bytes written at pos %lu\n", written, pos ));
-    }
-
-    return rc;
-}
-
-
-static rc_t resize_scratch_buffer( const KCacheTeeFile *cself, /* size_t */ uint64_t new_size )
-{
-    rc_t rc = 0;
-    KCacheTeeFile *self = ( KCacheTeeFile * )cself;
-
-    /* create scratch-buffer or resize it if needed */
-    if ( self->scratch_size == 0 )
-    {
-        self->scratch_buffer = malloc( new_size );
-        if ( self->scratch_buffer == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-        else
-            self->scratch_size = new_size;
-    }
-    else if ( self->scratch_size < new_size )
-    {
-        uint8_t * tmp = realloc( self->scratch_buffer, new_size );
-        if ( tmp == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            self->scratch_buffer = tmp;
-            self->scratch_size = new_size;
-        }
-    }
-    return rc;
-}
-
-
-size_t check_rd_len( const KCacheTeeFile *cself, uint64_t pos, size_t bsize )
-{
-    size_t res = bsize;
-    uint64_t last_pos = pos;
-    last_pos += bsize;
-    if ( last_pos >= cself->remote_size )
-    {
-        if ( pos >= cself->remote_size )
-            res = 0;
-        else
-            res = ( cself->remote_size - pos );
-    }
-    return res;
-}
-
-
-static rc_t rd_remote_wr_local( const KCacheTeeFile *cself, uint64_t pos,
-                                void *buffer, size_t bsize, size_t *num_read )
-{
-    rc_t rc = 0;
-    if ( bsize > 0 )
-    {
-        size_t bytes_read;
-        *num_read = 0;
-        rc = KFileReadAll( cself->remote, pos, buffer, bsize, &bytes_read );
-        if ( rc == 0 )
-        {
-            if ( cself->report )
-            {
-                OUTMSG(( "reading remote data: %u bytes read at pos %lu\n", bytes_read, pos ));
-            }
-
-            if ( cself->local_read_only )
-            {
-                *num_read = bytes_read;
-            }
-            else
-            {
-                rc = KFileWriteAll( cself->local, pos, buffer, bytes_read, num_read );
-                if ( rc == 0 && cself->report )
-                {
-                    OUTMSG(( "writing local data: %u bytes written at pos %lu\n", *num_read, pos ));
-                }
-            }
-        }
-    }
-    return rc;
-}
-
-#if 0
-static rc_t KCacheTeeFileRead_Starting_with_Cache_Hit( const KCacheTeeFile *cself, uint64_t pos,
-                               void *buffer, size_t bsize, size_t *num_read, uint64_t first_requested_block )
-{
-    rc_t rc = 0;
-    uint64_t t_pos, end_block, last_block = first_requested_block;
-    size_t to_read = check_rd_len( cself, pos, bsize );
-
-    if ( to_read == 0 )
-        return rc;
-
-    t_pos = pos + to_read - 1;
-    end_block = ( t_pos / cself->block_size );
-
-    /* the requested range starts with a cache-hit : 
-        - detect the last block after this first hit, that is still in cache */
-    if ( end_block > first_requested_block )
-    {
-        while( ( last_block <= end_block ) && ( IS_CACHE_BIT( cself, last_block + 1 ) ) )
-            ++last_block;
-    }
-
-    /* if not the whole requested range is a cache-hit: reduce to_read */
-    if ( last_block < end_block )
-/*        to_read = ( ( ( ( last_block + 1 ) * cself->block_size ) - 1 ) - pos ); */
-        to_read = ( ( ( last_block + 1 ) * cself->block_size ) - pos );
-    assert( to_read <= bsize );
-
-    if ( cself->report )
-        OUTMSG(( "RD LOCAL: %,lu.%,lu\n", pos, to_read ));
-
-    /* now read it from the local file into the user-supplied buffer */
-    if ( to_read > 0 )
-        rc = KFileReadAll( cself->local, pos, buffer, to_read, num_read );
-
-    return rc;
-}
-#endif
-
-#if 0
-static rc_t KCacheTeeFileRead_Block_Aligned_Cache_Miss( const KCacheTeeFile *cself, uint64_t pos,
-                               void *buffer, size_t bsize, size_t *num_read, uint64_t first_requested_block )
-{
-    rc_t rc;
-    /* we are block-aligned ! */
-    uint64_t block_count = ( bsize / cself->block_size );
-    if ( cself->report )
-        OUTMSG(( "RD REMOTE (block aligned): %,lu.%,lu (%,lu blocks)\n", pos, bsize, block_count ));
-    rc = rd_remote_wr_local( cself, pos, buffer, bsize, num_read );
-    if ( rc == 0 && !cself->local_read_only )
-    {
-        set_bitmap( cself, first_requested_block, block_count );
-        rc = write_bitmap( cself, first_requested_block, block_count );
-    }
-    if ( rc == 0 && cself->cluster_factor > 1 )
-    {
-        size_t over_read_size = cself->cluster_factor * cself->block_size;
-        rc = resize_scratch_buffer( cself, over_read_size );
-        if ( rc == 0 )
-        {
-            size_t tmp_read;
-            uint64_t r_pos = pos + bsize;
-            rc = rd_remote_wr_local( cself, r_pos, cself->scratch_buffer, over_read_size, &tmp_read );
-            if ( rc == 0 && !cself->local_read_only )
-            {
-                set_bitmap( cself, first_requested_block + block_count, cself->cluster_factor );
-                rc = write_bitmap( cself, first_requested_block + block_count, cself->cluster_factor );
-            }
-        }
-    }
-    return rc;
-}
-#endif
-
-#if 0
-static rc_t KCacheTeeFileRead_Starting_with_Cache_Miss_small( const KCacheTeeFile *cself, uint64_t pos,
-                               void *buffer, size_t bsize, size_t to_read, size_t *num_read,
-                               uint64_t first_requested_block, uint64_t last_cache_miss_block )
-{
-    rc_t rc = 0;
-    uint64_t t_pos, block_count;
-    size_t t_len, processed;
-
-    /* we are not block-aligned, and the request is smaller than 1 block in size ! */
-    if ( cself->report )
-        OUTMSG(( "RD REMOTE (small) : %,lu.%,lu\n", pos, to_read ));
-
-    /* that means we request 1 or 2 blocks of memory from our scratch-buffer ... */
-    t_pos = ( first_requested_block * cself->block_size );
-    block_count = ( ( last_cache_miss_block - first_requested_block ) + 1 );
-    t_len = ( block_count * cself->block_size );
-    rc = resize_scratch_buffer( cself, t_len );
-
-    if ( cself->report )
-        OUTMSG(( "RD REMOTE (small) : from <%,lu> %,lu blocks\n", t_pos, block_count ));
-
-    assert( to_read <= t_len );
-
-    /* we read that from remote, write it local and set the bitmap */
-    if ( rc == 0 )
-    {
-        rc = rd_remote_wr_local( cself, t_pos, cself->scratch_buffer, t_len, &processed );
-        if ( rc == 0 && !cself->local_read_only )
-        {
-            set_bitmap( cself, first_requested_block, block_count );
-            rc = write_bitmap( cself, first_requested_block, block_count );
-        }
-    }
-
-    /* then we copy the requested amount out of the scratch-buffer */
-    if ( rc == 0 )
-    {
-        memcpy( buffer, &( cself->scratch_buffer[ pos - t_pos ] ), to_read );
-        *num_read = to_read;
-    }
-    return rc;
-}
-#endif
-
-#if 0
-static rc_t KCacheTeeFileRead_Starting_with_Cache_Miss_large( const KCacheTeeFile *cself, uint64_t pos,
-                               void *buffer, size_t bsize, size_t to_read, size_t *num_read,
-                               uint64_t first_requested_block, uint64_t last_cache_miss_block )
-{
-    rc_t rc = 0;
-    uint64_t t_pos;
-    int64_t t_len;
-    size_t processed;
-
-    /* we are not block-aligned ! */
-    if ( cself->report )
-        OUTMSG(( "RD REMOTE (large) : %,lu.%,lu\n", pos, to_read ));
-
-    /* THERE IS AN EVENTUAL PRE-READ if pos is not block-aligned, using the user-supplied buffer */
-    t_pos = ( first_requested_block * cself->block_size );
-    if ( t_pos < pos )
-    {
-        t_len = ( pos - t_pos );
-        if ( cself->report )
-            OUTMSG(( "PRE : %,lu.%,lu\n", t_pos, t_len ));
-
-        assert( t_len < bsize );
-        rc = rd_remote_wr_local( cself, t_pos, buffer, t_len, &processed );
-    }
-
-    if ( rc == 0 )
-    {
-        /* THERE IS AN EVENTUAL POST-READ if pos + to_read is not block-aligned */
-        uint64_t last_pos = ( last_cache_miss_block + 1 ) * cself->block_size;
-        t_pos = pos + processed;
-        if ( last_pos > t_pos )
-        {
-            t_len = ( last_pos - t_pos );
-            if ( cself->report )
-                OUTMSG(( "POST: %,lu.%,lu\n", t_pos, t_len ));
-            if ( t_len <= bsize )
-                rc = rd_remote_wr_local( cself, t_pos, buffer, t_len, &processed );
-        }
-
-        if ( rc == 0 )
-        {
-            /* finally we read what was requested, into the user-supplied buffer */
-            if ( cself->report )
-                OUTMSG(( "MAIN: %,lu.%,lu\n", pos, to_read ));
-
-            rc = rd_remote_wr_local( cself, pos, buffer, to_read, num_read );
-            if ( rc == 0 && !cself->local_read_only )
-            {
-                uint64_t block_count = ( last_cache_miss_block - first_requested_block ) + 1;
-                set_bitmap( cself, first_requested_block, block_count );
-                rc = write_bitmap( cself, first_requested_block, block_count );
-            }
-        }
-    }
-    return rc;
-}
-#endif
-
-#if 0
-static rc_t KCacheTeeFileRead_Starting_with_Cache_Miss( const KCacheTeeFile *cself, uint64_t pos,
-                               void *buffer, size_t bsize, size_t *num_read, uint64_t first_requested_block )
-{
-    rc_t rc = 0;
-    size_t to_read = check_rd_len( cself, pos, bsize );
-    uint64_t end_pos = pos + to_read;
-    uint64_t last_requested_block = ( end_pos / cself->block_size );
-    uint64_t last_cache_miss_block = first_requested_block;
-
-    if ( to_read == 0 )
-        return rc;
-
-    assert( to_read <= bsize );
-
-    /* detect the last block after this first miss, that is still not in cache */
-    while( last_cache_miss_block <= last_requested_block && 
-           !( IS_CACHE_BIT( cself, last_cache_miss_block ) ) )
-    {
-        ++last_cache_miss_block;
-    }
-
-    if ( cself->report )
-        OUTMSG(( "CACHE-MISS from block #%,lu to #%,lu (end-block #%,lu)\n",
-                  first_requested_block, last_cache_miss_block, last_requested_block ));
-
-    /* check if the request is aligned to our block */
-    if ( ( pos == ( first_requested_block * cself->block_size ) ) &&
-         ( ( to_read % cself->block_size ) == 0 ) )
-    {
-        /* we are block-aligned ! */
-        rc = KCacheTeeFileRead_Block_Aligned_Cache_Miss( cself, pos, buffer, to_read, num_read, first_requested_block );
-    }
-    else
-    {
-        if ( to_read < cself->block_size )
-        {
-            rc = KCacheTeeFileRead_Starting_with_Cache_Miss_small( cself, pos, buffer, bsize, to_read, num_read,
-                                                first_requested_block, last_cache_miss_block );
-        }
-        else
-        {
-            rc = KCacheTeeFileRead_Starting_with_Cache_Miss_large( cself, pos, buffer, bsize, to_read, num_read,
-                                                first_requested_block, last_cache_miss_block );
-        }
-    }
-    return rc;
-}
-#endif
-
-#if 0
-static rc_t KCacheTeeFileRead_clustered( const KCacheTeeFile *cself, uint64_t pos,
-                                         void *buffer, size_t bsize, size_t *num_read )
-{
-    rc_t rc;
-    size_t l_num_read = 0;
-    uint64_t first_requested_block = ( pos / cself->block_size );
-    
-    if ( num_read != NULL )
-        *num_read = 0;
-
-    if ( cself->report )
-        OUTMSG(( "\nREQUEST: %,lu .[ %,lu ] ( first_requested_block=%,lu )\n", pos, bsize, first_requested_block ));
-
-     if ( IS_CACHE_BIT( cself, first_requested_block ) )
-    {
-        rc = KCacheTeeFileRead_Starting_with_Cache_Hit( cself, pos, buffer, bsize, &l_num_read, first_requested_block );
-    }
-    else
-    {
-        rc = KCacheTeeFileRead_Starting_with_Cache_Miss( cself, pos, buffer, bsize, &l_num_read, first_requested_block );
-    }
-
-    if ( rc == 0 && num_read != NULL )
-        *num_read = l_num_read;
-
-    if ( cself->logger != NULL )
-    {
-        KCacheTeeFile * self = ( KCacheTeeFile * ) cself;
-        log_to_file( self->logger, &self->log_file_pos, pos, bsize, l_num_read );
-    }
-    return rc;
-}
-#endif
-
-static uint64_t calc_req_blocks( uint64_t pos, uint64_t first_req_block, size_t bsize, uint32_t block_size )
-{
-    uint64_t res, temp;
-
-    res = pos;
-    res += bsize;
-    temp = first_req_block;
-    temp *= block_size;
-    res -= temp;
-    res += block_size;
-    res--;
-    res /= block_size;
-
-/*    res = ( ( ( pos + bsize ) - ( first_req_block * block_size ) + ( block_size - 1 ) ) / block_size ); */
-/*    uint64_t req_blocks = ( ( ( pos + bsize - 1 ) / block_size ) - first_req_block ) + 1; */
-    return res;
-}
-
-static rc_t KCacheTeeFileRead_simple_cached( const KCacheTeeFile *cself, uint64_t pos,
-                                             void *buffer, size_t bsize, size_t *num_read, uint64_t first_req_block )
-{
-    rc_t rc = 0;
-    bool found_in_scratch = false;
-    size_t to_read;
-    size_t block_count = 1;
-    uint64_t req_blocks = calc_req_blocks( pos, first_req_block, bsize, cself->block_size );
-
-    /* we read as much as we have from the local cache, forcing the caller
-       to eventually make another request ( the non-cached part of it ) afterwards */
-    if ( req_blocks > 1 )
-    {
-        /* detect how many blocks are in cache after the first_req_block */
-        uint64_t block = first_req_block;
-        block_count = 0;
-        do
-        {
-            block++;
-            block_count++;
-        }
-        while ( ( block_count < req_blocks ) && ( IS_CACHE_BIT( cself, block ) ) );
-    }
-
-    /* check if we eventually have the requested bytes in the scratch-buffer */
-    if ( cself -> first_block_in_scratch == first_req_block )
-    {
-        uint64_t first_pos_in_scratch = first_req_block;
-        first_pos_in_scratch *= cself->block_size;
-        if ( pos >= first_pos_in_scratch )
-        {
-            uint64_t last_pos_in_scratch = first_pos_in_scratch;
-            last_pos_in_scratch += cself -> valid_scratch_bytes;
-            found_in_scratch = ( pos < last_pos_in_scratch );
-            if ( found_in_scratch )
-            {
-                uint64_t available_in_scratch = ( last_pos_in_scratch - pos );
-                if ( bsize > available_in_scratch )
-                    to_read = available_in_scratch;
-                else
-                    to_read = bsize;
-
-                memmove ( buffer, &( cself->scratch_buffer[ pos - first_pos_in_scratch ] ), to_read );
-                *num_read = to_read;
-            }
-        }
-    }
-
-    if ( !found_in_scratch )
-    {
-        /* now we have to check how much of the request can be satisfied from the local file */
-        uint64_t reachable = first_req_block;
-        reachable += block_count;
-        reachable *= cself->block_size;
-        reachable -= pos;
-
-        /* are we requesting beyond the end of file? */
-        if ( reachable >= bsize )
-            to_read = check_rd_len( cself, pos, bsize );
-        else
-            to_read = check_rd_len( cself, pos, reachable );
-
-        rc = KFileReadAll( cself->local, pos, buffer, to_read, num_read );
-    }
-
-    return rc;
-}
-
-
-static rc_t KCacheTeeFileRead_simple_not_cached( const KCacheTeeFile *cself, uint64_t pos,
-                                                 void *buffer, size_t bsize, size_t *num_read, uint64_t first_req_block )
-{
-    rc_t rc;
-    size_t to_read_remote;
-    size_t block_count = 1;
-    uint64_t req_blocks = calc_req_blocks( pos, first_req_block, bsize, cself->block_size );
-
-    if ( req_blocks >  1 )
-    {
-        uint64_t block = first_req_block;
-        block_count = 0;
-        do
-        {
-            block++;
-            block_count++;
-        }
-        while ( ( block_count < req_blocks ) && ( !( IS_CACHE_BIT( cself, block ) ) ) );
-    }
-
-    to_read_remote = ( block_count * cself->block_size );
-    rc = resize_scratch_buffer( cself, to_read_remote );
-    if ( rc == 0 )
-    {
-        size_t l_num_read;
-        uint64_t block_start = first_req_block;
-        block_start *= cself->block_size;
-        to_read_remote = check_rd_len( cself, block_start, to_read_remote );
-        rc = rd_remote_wr_local( cself, block_start, cself->scratch_buffer, to_read_remote, &l_num_read );
-        if ( rc == 0 )
-        {
-            ( ( KCacheTeeFile * )cself ) -> first_block_in_scratch = first_req_block;
-            ( ( KCacheTeeFile * )cself ) -> valid_scratch_bytes = l_num_read;
-            if ( !cself->local_read_only )
-            {
-                set_bitmap( cself, first_req_block, block_count );
-                rc = write_bitmap( cself, first_req_block, block_count );
-            }
-        }
-        if ( rc == 0 )
-        {
-            /* what we have to return to the caller is somewhere in the scratch_buffer */
-            uint64_t offset = pos;
-            offset -= block_start;
-
-            /* how much we can copy depends on how much was not in cache,
-               and how much was requested in the first place... */
-            if ( l_num_read >= offset )
-            {
-                l_num_read -= offset;
-                if ( l_num_read > bsize )
-                    l_num_read = bsize;
-                memmove ( buffer, &( cself->scratch_buffer[ offset ] ), l_num_read );
-            }
-            else
-            {
-                l_num_read = 0;
-            }
-            *num_read = l_num_read;
-        }
-    }
-    return rc;
-}
-
-
-static rc_t KCacheTeeFileRead_simple( const KCacheTeeFile *cself, uint64_t pos,
-                                      void *buffer, size_t bsize, size_t *num_read )
-{
-    rc_t rc;
-    uint64_t first_req_block = pos;
-    first_req_block /= cself->block_size;
-
-    *num_read = 0;
-    if ( cself->report )
-        OUTMSG(( "\nREQUEST '%s': %,lu .[%,lu] ( first_req_block=%,lu )\n",
-                 cself->local_path, pos, bsize, first_req_block ));
-
-    /* "simple" strategy, read only that much as requested... */
-    if ( IS_CACHE_BIT( cself, first_req_block ) )
-    {
-        rc = KCacheTeeFileRead_simple_cached( cself, pos, buffer, bsize, num_read, first_req_block );
-    }
-    else
-    {
-        rc = KCacheTeeFileRead_simple_not_cached( cself, pos, buffer, bsize, num_read, first_req_block );
-    }
-
-    if ( cself->logger != NULL )
-    {
-        KCacheTeeFile * self = ( KCacheTeeFile * ) cself;
-        log_to_file( self->logger, &self->log_file_pos, pos, bsize, *num_read );
-    }
-
-    return rc;
-}
-
-
-/**********************************************************************************************
-    START vt-functions
-**********************************************************************************************/
-
-static struct KSysFile* KCacheTeeFileGetSysFile( const KCacheTeeFile *self, uint64_t *offset )
-{
-    * offset = 0;
-    return NULL;
-}
-
-
-static rc_t KCacheTeeFileRandomAccess( const KCacheTeeFile *self )
-{
-    return 0;
-}
-
-
-static rc_t KCacheTeeFileSize( const KCacheTeeFile *self, uint64_t *size )
-{
-    *size = self->remote_size;
-    return 0;
-}
-
-
-static rc_t KCacheTeeFileSetSize( KCacheTeeFile *self, uint64_t size )
-{
-    return RC ( rcFS, rcFile, rcUpdating, rcFile, rcReadonly );
-}
-
-static rc_t KCacheTeeFileRead( const KCacheTeeFile *cself, uint64_t pos,
-                               void *buffer, size_t bsize, size_t *num_read )
-{
-    /*
-    if ( cself -> cluster_factor != 0 )
-        return KCacheTeeFileRead_clustered( cself, pos, buffer, bsize, num_read );
-    else
-        return KCacheTeeFileRead_simple( cself, pos, buffer, bsize, num_read );
-    */
-
-    return KCacheTeeFileRead_simple( cself, pos, buffer, bsize, num_read );
-}
-
-
-static rc_t KCacheTeeFileWrite( KCacheTeeFile *self, uint64_t pos,
-                                const void *buffer, size_t size, size_t *num_writ )
-{
-    return RC ( rcFS, rcFile, rcUpdating, rcInterface, rcUnsupported );
-}
-
-/**********************************************************************************************
-    END vt-functions
-**********************************************************************************************/
-
-
-static KFile_vt_v1 vtKCacheTeeFile =
-{
-    /* version 1.0 */
-    1, 0,
-
-    /* start minor version 0 methods */
-    KCacheTeeFileDestroy,
-    KCacheTeeFileGetSysFile,
-    KCacheTeeFileRandomAccess,
-    KCacheTeeFileSize,
-    KCacheTeeFileSetSize,
-    KCacheTeeFileRead,
-    KCacheTeeFileWrite
-    /* end minor version 0 methods */
-};
-
-
-static rc_t make_cache_tee( struct KDirectory *self, struct KFile const **tee,
-    struct KFile const *remote, struct KFile *local, struct KFile *logger, KLockFile *lock,
-    uint32_t blocksize, uint32_t cluster, bool report, const char *path )
-{
-    rc_t rc;
-    size_t path_size = string_size ( path );
-    KCacheTeeFile * cf = malloc ( sizeof * cf + path_size + 1 );
-    if ( cf == NULL )
-        rc = RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        cf -> dir = self;
-        string_copy( cf -> local_path, path_size + 1, path, path_size );
-        cf -> remote = remote;     /* store the file-objects but no AddRef()'s yet! */
-        cf -> local  = local;
-        cf -> logger = logger;
-        cf -> lock = lock;
-        cf -> report = report;
-        cf -> cluster_factor = cluster;
-        cf -> local_read_only = !( local -> write_enabled );
-        cf -> block_size = ( blocksize > 0 ) ? blocksize : CACHE_TEE_DEFAULT_BLOCKSIZE;
-        cf -> bitmap = NULL;
-        cf -> scratch_buffer = NULL;
-        cf -> scratch_size = 0;
-        cf -> first_block_in_scratch = 0;
-        cf -> valid_scratch_bytes = 0;
-
-        rc = KFileSize( local, &cf -> local_size );
-        if ( rc != 0 )
-        {
-            LOGERR( klogErr, rc, "cannot detect size of local file" );
-        }
-        else
-        {
-            rc = KFileSize( cf -> remote, &cf -> remote_size );
-            if ( rc != 0 )
-            {
-                LOGERR( klogErr, rc, "cannot detect size of remote file" );
-            }
-            else
-            {
-                if ( cf -> local_size == 0 )
-                {
-                    /* the local file was just created... */
-                    if ( cf -> remote_size == 0 )
-                    {
-                        rc = RC ( rcFS, rcFile, rcConstructing, rcParam, rcInvalid );
-                        LOGERR( klogErr, rc, "size of remote file is zero" );
-                    }
-                    else
-                    {
-                        rc = calculate_local_size_from_remote_size( cf );
-                        if ( rc == 0 )
-                        {
-                            rc = KFileSetSize ( cf -> local, cf -> local_size );
-                            if ( rc == 0 )
-                            {
-                                rc = init_new_local_file( cf );
-                            }
-                            else
-                            {
-                                PLOGERR( klogInt, ( klogInt, rc, "cannot size local file to $(l) bytes", "l=%lu", cf->local_size ) );
-                            }
-                        }
-                    }
-                }
-                else
-                    rc = verify_existing_local_file( cf, false );
-            }
-
-            if ( rc == 0 && cf -> fully_in_cache && ! cf -> local_read_only && cf -> lock != NULL )
-            {
-                /* here is the up-front-test: the cache is complete and we have write access! */
-                rc = promote_cache( cf );
-                /*
-                if ( rc == 0 )
-                    rc = KFileAddRef( cf -> local );
-                */
-                if ( rc == 0 )
-                {
-                    *tee = cf -> local;
-                    KLockFileRelease ( cf -> lock );
-                    free ( cf );
-                    return rc;  /* here we return the truncated, promoted cache as tee-file ! */
-                }
-            }
-
-            if ( rc == 0 )
-            {
-                if ( cf -> remote_size == 0 )
-                    cf -> remote_size = cf -> local_size;
-
-                /* now we have to AddRef() everything we hang on until the final release! */
-                rc = KDirectoryAddRef ( cf -> dir );
-                if ( rc == 0 )
-                {
-                    rc = KFileAddRef( cf -> remote );
-                    if ( rc == 0 )
-                    {
-                        /* rc = KFileAddRef( cf -> local ); */
-                        if ( rc == 0 )
-                        {
-                            if ( cf -> logger != NULL )
-                                rc = KFileAddRef( cf -> logger );
-                            if ( rc == 0 )
-                            {
-                                rc = KFileInit( &cf -> dad, (const union KFile_vt *)&vtKCacheTeeFile, "KCacheTeeFile", path, true, false );
-                                if ( rc == 0 )
-                                {
-                                    /* the wrapper is ready to use now! */
-                                    *tee = ( const KFile * ) &cf -> dad;
-                                    return 0;
-                                }
-                                else
-                                {
-                                    LOGERR( klogErr, rc, "cannot initialize KFile-structure" );
-                                    KFileRelease( cf -> logger );
-                                    KFileRelease( cf -> local );
-                                    KFileRelease( cf -> remote );
-                                    KDirectoryRelease ( cf -> dir );
-                                }
-                            }
-                            else
-                            {
-                                KFileRelease( cf -> local );
-                                KFileRelease( cf -> remote );
-                                KDirectoryRelease ( cf -> dir );
-                            }
-                        }
-                        else
-                        {
-                            KFileRelease( cf -> remote );
-                            KDirectoryRelease ( cf -> dir );
-                        }
-                    }
-                    else
-                        KDirectoryRelease ( cf -> dir );
-                }
-            }
-        }
-        free ( cf );
-    }
-    return rc;
-}
-
-
-static rc_t make_read_only_cache_tee( struct KDirectory *self,
-    struct KFile const **tee, struct KFile const *remote, struct KFile *logger,
-    uint32_t blocksize, uint32_t cluster, bool report, const char *path )
-{
-    const struct KFile * local;
-    rc_t rc = KDirectoryOpenFileRead( self, &local, "%s.cache", path );
-    if ( rc == 0 )
-    {
-        if ( report )
-            KOutMsg( "successfuly opened cache file '%s.cache' in read/only-mode\n",
-                      path );
-        rc = make_cache_tee( self, tee, remote, ( struct KFile * )local, logger, NULL,
-                             blocksize, cluster, report, path );
-    }
-    else
-    {
-        /* we cannot even open the local cache in read-only mode,
-           we give up - and return a reference to the remote file... */
-        rc = KFileAddRef( remote );
-        if ( rc == 0 )
-        {
-            if ( report )
-                KOutMsg( "cannot open cache file '%s.cache' in read/only-mode ( returning remote-file )\n",
-                          path );
-            *tee = remote;
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC KDirectoryVMakeCacheTee ( struct KDirectory *self,
-    struct KFile const **tee, struct KFile const *remote, struct KFile *logger,
-    uint32_t blocksize, uint32_t cluster, bool report, const char *path, va_list args )
-{
-    rc_t rc;
-    if ( tee == NULL || remote == NULL )
-        rc = RC ( rcFS, rcFile, rcAllocating, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcFS, rcFile, rcAllocating, rcSelf, rcNull );
-        else if ( path == NULL )
-            rc = RC ( rcFS, rcFile, rcAllocating, rcPath, rcNull );
-        else if ( path [ 0 ] == 0 )
-            rc = RC ( rcFS, rcFile, rcAllocating, rcPath, rcEmpty );
-        else
-        {
-            char full [ 4096 ];
-
-#if CACHE_TEE_REPORT == 1
-            report = true;
-#endif
-
-            rc = KDirectoryVResolvePath ( self, false, full, sizeof full, path, args );
-            if ( rc != 0 )
-            {
-                PLOGERR( klogErr, ( klogErr, rc, "cannot resolve path of cache file '$(path)'", 
-                        "path=%s", full ) );
-            }
-            else
-            {
-                KLockFile *lock = NULL;
-
-                if ( report )
-                    KOutMsg( "CREATE CacheTeeFile for '%s'\n", full );
-
-                rc = KDirectoryCreateLockFile ( self, &lock, "%s.cache.lock", full );
-                if ( rc == 0 )
-                {
-                    /* it was possible to aquire the lock on the cache-file */
-                    struct KFile * local;
-
-                    if ( report )
-                        KOutMsg( "successfuly aquired lockfile '%s.cache.lock'\n", full );
-
-
-                    rc = KDirectoryOpenFileWrite( self, &local, true, "%s.cache", full );
-                    if ( rc == 0 )
-                    {
-                        if ( report )
-                            KOutMsg( "successfuly opened '%s.cache'\n", full );
-
-                        /* we have the exclusive rd/wr access to the cache file !*/
-                        rc = make_cache_tee( self, tee, remote, local, logger, lock,
-                                             blocksize, cluster, report, full );
-                    }
-                    else if ( GetRCState( rc ) == rcNotFound )
-                    {
-                        rc = KDirectoryCreateFile( self, &local, true, 0664, kcmOpen, "%s.cache", full );
-                        if ( rc == 0 )
-                        {
-                            if ( report )
-                                KOutMsg( "cache-file '%s.cache' created with rd/wr-access\n", full );
-                            /* we have the exclusive rd/wr access to the cache file !*/
-                            rc = make_cache_tee( self, tee, remote, local, logger, lock,
-                                                 blocksize, cluster, report, full );
-                        }
-                    }
-                    else
-                    {
-                        if ( report )
-                            KOutMsg( "no rd/wr access to cache-file '%s.cache' rc=%R\n", full, rc );
-
-                        /* we do not have the exclusive rd/wr access to the cache file !*/
-                        rc = KLockFileRelease ( lock );
-                        if ( rc == 0 )
-                            rc = make_read_only_cache_tee( self, tee, remote, logger,
-                                    blocksize, cluster, report, full );
-                    }
-                }
-                else if ( GetRCState ( rc ) == rcBusy )
-                {
-                    if ( report )
-                        KOutMsg( "failed to aquired lockfile '%s.cache.lock'\n", full );
-
-                    /* it was NOT possible to aquire the lock on the cache-file */
-                    rc = make_read_only_cache_tee( self, tee, remote, logger,
-                            blocksize, cluster, report, full );
-                }
-                else
-                {
-                    PLOGERR( klogErr, ( klogErr, rc, "cannot create lock-file '$(path).cache.lock'", 
-                            "path=%s", full ) );
-                }
-            }
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC KDirectoryMakeCacheTee ( struct KDirectory *self,
-    struct KFile const **tee, struct KFile const *remote, struct KFile *logger,
-    uint32_t blocksize, uint32_t cluster, bool report, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-    va_start ( args, path );
-
-    rc = KDirectoryVMakeCacheTee ( self, tee, remote, logger, blocksize, cluster, report, path, args );
-
-    va_end ( args );
-
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC GetCacheCompleteness( const struct KFile * self, float * percent )
-{
-    rc_t rc;
-    if ( self == NULL )
-        rc = RC( rcFS, rcFile, rcValidating, rcSelf, rcNull );
-    else if ( percent == NULL )
-        rc = RC( rcFS, rcFile, rcValidating, rcParam, rcNull );
-    else
-    {
-        uint64_t local_size;
-        *percent = 0;
-        rc = KFileSize( self, &local_size );
-        if ( rc != 0 )
-        {
-            LOGERR( klogErr, rc, "cannot detect filesize when checking if cached file is complete" );
-        }
-        else
-        {
-            uint32_t block_size;
-            rc = read_block_size( self, local_size, &block_size, false );
-            if ( rc == 0 )
-            {
-                uint64_t content_size;
-                rc = read_content_size( self, local_size, &content_size, false );
-                /* create bitmap buffer */
-                if ( rc == 0 )
-                {
-                    uint64_t block_count;
-                    /* size_t */ uint64_t bitmap_bytes;
-                    rc = verify_file_structure( local_size, block_size, content_size, &block_count, &bitmap_bytes, false );
-                    if ( rc == 0 )
-                    {
-                        uint8_t * bitmap = NULL;
-                        rc = create_bitmap_buffer( &bitmap, bitmap_bytes );
-                        if ( rc == 0 )
-                        {
-                            size_t num_read;
-                            /* read the bitmap into the memory ... */
-                            rc = KFileReadAll ( self, content_size, bitmap, bitmap_bytes, &num_read );
-                            if ( rc != 0 )
-                            {
-                                LOGERR( klogErr, rc, "cannot read bitmap from local file" );
-                            }
-                            else if ( num_read != bitmap_bytes )
-                            {
-                                rc = RC ( rcFS, rcFile, rcConstructing, rcParam, rcInvalid );
-                                PLOGERR( klogErr, ( klogErr, rc, "cannot read $(ls) bitmap-bytes from local file, read $(rs) instead", 
-                                               "ls=%lu,rs=%lu", bitmap_bytes, num_read ));
-                            }
-                        }
-                        if ( rc == 0 )
-                        {
-                            uint64_t idx, in_cache = 0;
-                            for ( idx = 0; idx < block_count; ++idx )
-                            {
-                                if ( IS_BITMAP_BIT( bitmap, idx ) )
-                                    in_cache++;
-                            }
-                            if ( in_cache > 0 && block_count > 0 )
-                            {
-                                float res = (float) in_cache;
-                                res *= 100;
-                                res /= block_count;
-                                * percent = res;
-                            }
-                        }
-                        if ( bitmap != NULL )
-                            free( bitmap );
-                    }
-                }
-            }
-        }
-    }
-    return rc;
-}
-
-
-/* -----
- * examens the file, and reports the size of the original file ( without the cachefile-footer )
- *
- */
-LIB_EXPORT rc_t CC GetCacheTruncatedSize( const struct KFile * self, uint64_t * truncated_size, bool silent )
-{
-    rc_t rc;
-    if ( self == NULL )
-        rc = RC( rcFS, rcFile, rcValidating, rcSelf, rcNull );
-    else if ( truncated_size == NULL )
-        rc = RC( rcFS, rcFile, rcValidating, rcParam, rcNull );
-    else
-    {
-        uint64_t local_size;
-        *truncated_size = 0;
-        rc = KFileSize( self, &local_size );
-        if ( rc != 0 )
-        {
-            if ( !silent )
-            {
-                LOGERR( klogErr, rc, "cannot detect filesize when checking if cached file is complete" );
-            }
-        }
-        /* TODO: need to do a better constant tha a magic number */
-        else if (local_size < 13)
-        {
-            rc = RC ( rcFS, rcFile, rcValidating, rcSize, rcInsufficient );
-            if ( !silent )
-            {
-                LOGERR( klogErr, rc, "cannot use filesize of zero when checking if cached file is complete" );
-            }
-        }
-        else
-        {
-            uint32_t block_size;
-            rc = read_block_size( self, local_size, &block_size, true );
-            if ( rc == 0 )
-            {
-                uint64_t content_size;
-                rc = read_content_size( self, local_size, &content_size, true );
-                if ( rc == 0 )
-                {
-                    uint64_t block_count;
-                    /* size_t */ uint64_t bitmap_bytes;
-                    rc = verify_file_structure( local_size, block_size, content_size, &block_count, &bitmap_bytes, true );
-                    if ( rc == 0 )
-                    {
-                        *truncated_size = content_size;
-                    }
-                }
-            }
-        }
-    }
-    return rc;
-}
diff --git a/libs/kfs/countfile.c b/libs/kfs/countfile.c
deleted file mode 100644
index d34c5e9..0000000
--- a/libs/kfs/countfile.c
+++ /dev/null
@@ -1,652 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-#include <kfs/extern.h>
-#include <klib/log.h>
-#include <klib/debug.h>
-#include <klib/rc.h>
-#include <kfs/file.h>
-#include <kfs/countfile.h>
-#include <sysalloc.h>
-
-#include <assert.h>
-#include <stdlib.h>
-
-/* ======================================================================
- * KCounterFile
- */
-
-/* -----
- * define the specific types to be used in the templatish/inheritancish
- * definition of vtables and their elements
- */
-#define KFILE_IMPL struct KCounterFile
-#include <kfs/impl.h>
-
-/* clear out possible macro definitions of FS and GS,
- * which show up on Solaris/x86 when building with GCC (per sys/ucontext.h)
- */
-#ifdef FS
-#  undef FS
-#endif
-#ifdef GS
-#  undef GS
-#endif
-
-static rc_t CC KCounterFileDestroy (KCounterFile *self);
-static struct KSysFile *CC KCounterFileGetSysFile (const KCounterFile *self,
-					    uint64_t *offset);
-static rc_t CC KCounterFileRandomAccess (const KCounterFile *self);
-static uint32_t CC KCounterFileType (const KCounterFile *self);
-static rc_t CC KCounterFileSize (const KCounterFile *self, uint64_t *size);
-static rc_t CC KCounterFileSetSize (KCounterFile *self, uint64_t size);
-static rc_t CC KCounterFileRead (const KCounterFile *self, uint64_t pos,
-                                 void *buffer, size_t bsize, size_t *num_read);
-static rc_t CC KCounterFileWrite (KCounterFile *self, uint64_t pos, const void *buffer,
-			       size_t size, size_t *num_writ);
-
-
-static const KFile_vt_v1 vtKCounterFile =
-{
-    /* version */
-    1, 1,
-
-    /* 1.0 */
-    KCounterFileDestroy,
-    KCounterFileGetSysFile,
-    KCounterFileRandomAccess,
-    KCounterFileSize,
-    KCounterFileSetSize,
-    KCounterFileRead,
-    KCounterFileWrite,
-
-    /* 1.1 */
-    KCounterFileType
-};
-
-/*-----------------------------------------------------------------------
- * KCounterFile
- */
-typedef uint8_t lstate;
-enum elstate
-{
-    ENOTHING,
-    EASCII,
-    ECR,
-    ELF,
-    ECRLF,
-    ELFCR,
-    EBINARY
-};
-struct KCounterFile
-{
-    KFile	dad;
-    uint64_t	max_position;
-    KFile *	original;
-    uint64_t *	bytecounter; /* we do not trust reads from bytecounter */
-    uint64_t *	linecounter; /* we do not trust reads from linecounter */
-    lstate      line_state;
-    bool	size_allowed;
-    bool	force;
-};
-
-/* ----------------------------------------------------------------------
- * KCounterFileMake
- *  create a new file object
- */
-
-static
-rc_t KCounterFileMake (KCounterFile ** pself,
-		       KFile * original,
-		       uint64_t * bytecounter,
-		       uint64_t * linecounter,
-                       bool force)
-{
-    uint64_t		fsize;
-    rc_t		rc;
-    KCounterFile *	self;
-
-    /* -----
-     * we can not accept any of the three pointer parameters as NULL
-     */
-    assert (pself != NULL);
-    assert (original != NULL);
-    assert (bytecounter != NULL);
-
-    /* -----
-     * get space for the object
-     */
-    self = malloc (sizeof (KCounterFile));
-    if (self == NULL)	/* allocation failed */
-    {
-	/* fail */
-	rc = RC (rcFS, rcFile, rcConstructing, rcMemory, rcExhausted);
-    }
-    else
-    {
-	rc = KFileInit (&self->dad,			/* initialize base class */
-			(const KFile_vt*)&vtKCounterFile,/* VTable for KCounterFile */
-            "KCounterFile", "no-name",
-			original->read_enabled,
-			original->write_enabled);
-	if (rc == 0)
-	{
-            for (;;)
-            {
-                if (force) /* all sizes come from actual reads */
-                {
-                    fsize = 0;
-                    self->force = true;
-                    self->size_allowed = false;
-                }
-                else
-                {
-                    rc = KFileSize(original,&fsize);
-                    if (GetRCState(rc) == rcUnsupported)
-                    {
-                        force = true;
-                        continue;
-                    }
-                    else if (rc)
-                        break;
-                    self->force = false;
-                    self->size_allowed = true;
-                }
-                self->max_position = fsize;
-                self->original = original;
-                self->bytecounter = bytecounter;
-                self->linecounter = linecounter;
-                if (linecounter)
-                {
-                    self->line_state = ENOTHING;
-                    *linecounter = 0;
-                }
-                else
-                {
-                    self->line_state = EBINARY;
-                }
-                *bytecounter = fsize;
-                *pself = self;
-                return 0;
-            }
-	}
-	/* fail */
-	free (self);
-    }
-    *pself = NULL;
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KFileMakeCounterRead (const KFile ** self, const KFile * original,
-                                         uint64_t * bytecounter, uint64_t * linecounter,
-                                         bool force_reads)
-{
-    return KCounterFileMake ((KCounterFile **)self, (KFile*)original, bytecounter, linecounter, force_reads);
-}
-LIB_EXPORT rc_t CC KFileMakeCounterUpdate (KFile ** self, KFile * original,
-                                           uint64_t * bytecounter, uint64_t * linecounter,
-                                           bool force_reads)
-{
-    return KCounterFileMake ((KCounterFile **)self, original, bytecounter, linecounter, force_reads);
-}
-LIB_EXPORT rc_t CC KFileMakeCounterWrite (KFile ** self, KFile * original,
-                                          uint64_t * bytecounter, uint64_t * linecounter,
-                                          bool force_reads)
-{
-    return KCounterFileMake ((KCounterFile **)self, original, bytecounter, linecounter, force_reads);
-}
-
-enum ecc
-{
-    NUL,
-    SOH,
-    STX,
-    ETX,
-    EOT,
-    ENQ,
-    ACK,
-    BEL,
-    BS,
-    TAB,
-    LF,
-    VT,
-    FF,
-    CR,
-    SO,
-    SI,
-    DLE,
-    DC1,
-    DC2,
-    DC3,
-    DC4,
-    NAK,
-    SYN,
-    ETB,
-    CAN,
-    EM,
-    SUB,
-    ESC,
-    FS,
-    GS,
-    RS,
-    US,
-    DEL = 127
-};
-
-static
-void check_state (KCounterFile * self, void * _buffer, size_t size)
-{
-    uint8_t * buffer = _buffer;
-    size_t idx;
-
-    if (self->linecounter == NULL)
-        return;
-
-    if (self->line_state == EBINARY)
-        return;
-
-    for (idx = 0; idx < size; ++idx)
-    {
-        if (buffer[idx] >= DEL)
-        {
-            self->line_state = EBINARY;
-        }
-        else
-        {
-            switch (buffer[idx])
-            {
-            case NUL:
-            case SOH:
-            case STX:
-            case ETX:
-            case EOT:
-            case ENQ:
-            case ACK:
-            case BEL:
-            case BS:
-            case SO:
-            case SI:
-            case DLE:
-            case DC1:
-            case DC2:
-            case DC3:
-            case DC4:
-            case NAK:
-            case SYN:
-            case ETB:
-            case CAN:
-            case EM:
-            case SUB:
-            case ESC:
-            case FS:
-            case GS:
-            case RS:
-            case US:
-            case DEL:
-                /* leave line count mode */
-                self->line_state = EBINARY;
-                *self->linecounter = 0;
-                return;
-
-            case 128: /* not in use yet - a pseudo-EOL */
-                /* FF might go here? */
-                ++*self->linecounter;
-                self->line_state = EASCII;
-                break;
-                
-
-            case LF:
-                switch (self->line_state)
-                {
-                case ENOTHING:
-                case ELF:
-                case ECRLF:
-                case ELFCR:
-                    ++*self->linecounter;
-                case EASCII:
-                    self->line_state = ELF;
-                    break;
-                case ECR:
-                    self->line_state = ECRLF;
-                    break;
-                }
-                break;
-            case CR:
-                switch (self->line_state)
-                {
-                case ENOTHING:
-                case ECR:
-                case ECRLF:
-                case ELFCR:
-                    ++*self->linecounter;
-                case EASCII:
-                    self->line_state = ECR;
-                    break;
-                case ELF:
-                    self->line_state = ELFCR;
-                    break;
-                }
-                break;
-
-            case TAB:
-            case VT:
-            case FF:
-            default:
-                if (self->line_state != EASCII)
-                {
-                    ++*self->linecounter;
-                }
-                self->line_state = EASCII;
-                break;
-            }
-        }       
-    }
-}
-
-static
-rc_t KCounterFileSeek (KCounterFile * self, uint64_t pos)
-{
-    uint64_t	max_position;
-    rc_t	rc = 0;
-    size_t	num_read = 0;
-    size_t	to_read;
-    uint8_t	ignored[64*1024];
-
-    assert (self->max_position < pos);
-    for (max_position = self->max_position; max_position < pos; max_position += num_read)
-    {
-            to_read = (size_t)( pos - max_position );
-            if (to_read > sizeof ignored)
-                to_read = sizeof ignored;
-            rc = KFileRead (self->original, max_position, ignored, to_read, &num_read);
-            if (rc || (num_read == 0))
-                break;
-            check_state (self, ignored, num_read);
-    }
-    self->max_position = max_position;
-    *self->bytecounter = max_position;
-    return rc;
-}
-
-/* ----------------------------------------------------------------------
- * Destroy
- *
- */
-static
-rc_t CC KCounterFileDestroy (KCounterFile *self)
-{
-    rc_t rc = 0;
-    uint64_t size;
-
-    assert (self != NULL);
-    assert (self->bytecounter != NULL);
-
-    if (self->force || ! self->size_allowed)
-    {
-        size_t	num_read = 0;
-        uint8_t	ignored[64*1024];
-        
-        size = self->max_position;
-        if (self->dad.read_enabled)
-            do
-            {
-                rc = KFileRead (self->original, size,
-                                ignored, sizeof ignored, &num_read);
-                size += num_read;
-                DBGMSG(DBG_KFS,DBG_FLAG(DBG_KFS_COUNTER),
-                       ("%s: size '%lu' num_read '%lu'\n", __func__, size, num_read));
-                if (rc != 0)
-                    break;
-                check_state (self, ignored, num_read);
-            } while (num_read != 0);
-    }
-    else
-    {
-        rc = KFileSize (self->original, &size);
-        DBGMSG(DBG_KFS,DBG_FLAG(DBG_KFS_COUNTER),
-               ("%s: lazy way size '%lu'\n", __func__, size));
-    }
-    *self->bytecounter = size;
-    if (rc == 0)
-    {
-        rc = KFileRelease (self->original);
-        free (self);
-    }
-    return rc;
-}
-
-/* ----------------------------------------------------------------------
- * GetSysFile
- *  returns an underlying system file object
- *  and starting offset to contiguous region
- *  suitable for memory mapping, or NULL if
- *  no such file is available.
- *
- * bytes could not be counted if memory mapped so this is disallowed
- */
-
-static
-struct KSysFile *CC KCounterFileGetSysFile (const KCounterFile *self, uint64_t *offset)
-{
-    /* parameters must be non-NULL */
-    assert (self != NULL);
-    assert (offset != NULL);
-
-    return NULL;
-}
-
-/* ----------------------------------------------------------------------
- * RandomAccess
- *
- *  returns 0 if random access, error code otherwise
- */
-static
-rc_t CC KCounterFileRandomAccess (const KCounterFile *self)
-{
-    assert (self != NULL);
-    assert (self->original != NULL);
-    return KFileRandomAccess (self->original);
-}
-
-/* ----------------------------------------------------------------------
- * Type
- *  returns a KFileDesc
- *  not intended to be a content type,
- *  but rather an implementation class
- */
-static
-uint32_t CC KCounterFileType (const KCounterFile *self)
-{
-    assert (self != NULL);
-    assert (self->original != NULL);
-
-    return KFileType (self->original);
-}
-
-/* ----------------------------------------------------------------------
- * Size
- *  returns size in bytes of file
- *
- *  "size" [ OUT ] - return parameter for file size
- */
-static
-rc_t CC KCounterFileSize (const KCounterFile *self, uint64_t *size)
-{
-    rc_t	rc;
-    uint64_t	fsize;
-
-    assert (self != NULL);
-    assert (self->original != NULL);
-    assert (size != NULL);
-
-    rc = KFileSize (self->original, &fsize);
-
-    if (rc == 0)
-    {
-	/* success: refreshing the value */
-	*size = ((KCounterFile *)self)->max_position = fsize;
-    }
-    /* pass along RC value */
-    return rc;
-}
-
-/* ----------------------------------------------------------------------
- * SetSize
- *  sets size in bytes of file
- *
- *  "size" [ IN ] - new file size
- */
-static
-rc_t CC KCounterFileSetSize (KCounterFile *self, uint64_t size)
-{
-    rc_t rc;
-
-    rc = KFileSetSize (self->original, size);
-    if (rc == 0)
-	self->max_position = size;
-    return rc;
-}
-
-/* ----------------------------------------------------------------------
- * Read
- *  read file from known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually read
- */
-static
-rc_t CC KCounterFileRead	(const KCounterFile *cself,
-				 uint64_t pos,
-				 void *buffer,
-				 size_t bsize,
-				 size_t *num_read)
-{
-    KCounterFile * 	self;
-    uint64_t	max_position;
-    uint64_t	temp_max_position;
-    rc_t	rc;
-
-
-    /* -----
-     * self and buffer were validated as not NULL before calling here
-     *
-     * So get the KTTOCNode type: chunked files and contiguous files 
-     * are read differently.
-     */
-    assert (cself != NULL);
-    assert (cself->original != NULL);
-    assert (buffer != NULL);
-    assert (num_read != NULL);
-    assert (bsize != 0);
-
-    self = (KCounterFile*)cself;
-    max_position = cself->max_position;
-
-    if ((pos > max_position) && (! self->size_allowed))
-    {
-	rc = KCounterFileSeek (self, pos);
-	if (rc != 0)
-	    return rc;
-        /* if seek failed */
-        if (pos > self->max_position)
-        {
-            *num_read = 0;
-            return 0;
-        }
-    }
-    rc = KFileRead (self->original, pos, buffer, bsize, num_read);
-    temp_max_position = pos + *num_read;
-    if (temp_max_position > max_position)
-    {
-        uint32_t new_bytes = (uint32_t)(temp_max_position - max_position);
-
-        check_state (self, ((char *)buffer) + (*num_read) - new_bytes, new_bytes);
-
-	*self->bytecounter = self->max_position = temp_max_position;
-    }
-    return rc;
-}
-
-/* ----------------------------------------------------------------------
- * Write
- *  write file at known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ IN ] and "size" [ IN ] - data to be written
- *
- *  "num_writ" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually written
- *
- * Unsupported as we now treat archives as READ ONLY
- */
-static
-rc_t CC KCounterFileWrite (KCounterFile *self, uint64_t pos,
-			   const void *buffer, size_t bsize,
-			   size_t *num_writ)
-{
-    uint64_t	max_position;
-    uint64_t	temp_max_position;
-    rc_t	rc;
-
-
-    /* -----
-     * self and buffer were validated as not NULL before calling here
-     *
-     * So get the KTTOCNode type: chunked files and contiguous files 
-     * are read differently.
-     */
-    assert (self != NULL);
-    assert (self->original != NULL);
-    assert (buffer != NULL);
-    assert (num_writ != NULL);
-    assert (bsize != 0);
-
-    max_position = self->max_position;
-
-    if ((self->dad.read_enabled) && (pos > max_position) && (! self->size_allowed))
-    {
-	rc = KCounterFileSeek (self, pos);
-	if (rc != 0)
-	    return rc;
-    }
-
-    rc = KFileWrite (self->original, pos, buffer, bsize, num_writ);
-    temp_max_position = pos + *num_writ;
-
-    if (temp_max_position > max_position)
-    {
-	*self->bytecounter = self->max_position = temp_max_position;
-    }
-    return rc;
-}
-
-
-/* end of file countfile.c */
-
diff --git a/libs/kfs/crc32.c b/libs/kfs/crc32.c
deleted file mode 100644
index a2a38a0..0000000
--- a/libs/kfs/crc32.c
+++ /dev/null
@@ -1,1771 +0,0 @@
-/*=======================================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kfs/extern.h>
-
-#define CRC_DBG_REF(msg) DBGMSG(DBG_LEGREF,DBG_FLAG(DBG_LEGREF_CRC), msg)
-
-struct KCRC32File;
-#define KFILE_IMPL struct KCRC32File
-
-#include <kfs/crc.h>
-#include <kfs/impl.h>
-#include <klib/checksum.h>
-#include <klib/container.h>
-#include <klib/text.h>
-#include <klib/log.h>
-#include <klib/debug.h>
-#include <klib/rc.h>
-#include <os-native.h>
-#include <sysalloc.h>
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <endian.h>
-#include <byteswap.h>
-
-
-/*--------------------------------------------------------------------------
- * KCRC32SumEntry
- *  describes an entry into a CRC32 checksum file
- */
-typedef struct KCRC32SumEntry KCRC32SumEntry;
-struct KCRC32SumEntry
-{
-    SLNode n;
-    uint32_t crc32;
-    bool bin;
-    char path [ 1 ];
-};
-
-static
-void CC KCRC32SumEntryWhack ( SLNode *n, void *ignore )
-{
-    free ( n );
-}
-
-typedef struct KCRC32SumEntryFlushData KCRC32SumEntryFlushData;
-struct KCRC32SumEntryFlushData
-{
-    uint64_t pos;
-    KFile *f;
-    rc_t rc;
-};
-
-static
-bool CC KCRC32SumEntryFlush ( SLNode *n, void *data )
-{
-    KCRC32SumEntryFlushData *pb = data;
-    const KCRC32SumEntry *self = ( const KCRC32SumEntry* ) n;
-
-    int len;
-    size_t num_writ;
-    char line [ 4096 + 16 ];
-
-    len = snprintf ( line, sizeof line, "%08x %c%s\n",
-        self -> crc32, self -> bin ? '*' : ' ', self -> path );
-    if ( len < 0 || len >= sizeof line )
-    {
-        pb -> rc = RC ( rcFS, rcFile, rcFormatting, rcString, rcExcessive );
-        return true;
-    }
-
-    pb -> rc = KFileWrite ( pb -> f, pb -> pos, line, len, & num_writ );
-    if ( pb -> rc != 0 )
-        return true;
-
-    pb -> pos += num_writ;
-
-    if ( num_writ == ( size_t ) len )
-        return false;
-
-    pb -> rc = RC ( rcFS, rcFile, rcFormatting, rcTransfer, rcIncomplete );
-    return true;
-}
-
-static
-rc_t KCRC32SumEntryMake ( KCRC32SumEntry **ep,
-    const char *path, uint32_t crc32, bool bin )
-{
-    KCRC32SumEntry *entry = malloc ( sizeof * entry + strlen ( path ) );
-    if ( entry == NULL )
-        return RC ( rcFS, rcFile, rcUpdating, rcMemory, rcExhausted );
-
-    entry -> crc32 = crc32;
-    entry -> bin = bin;
-    strcpy ( entry -> path, path );
-
-    * ep = entry;
-    return 0;
-}
-
-
-/*--------------------------------------------------------------------------
- * KCRC32SumFmt
- *  a formatter for reading or writing an crc32sum-style checksum file
- */
-struct KCRC32SumFmt
-{
-    SLList entries;
-    KFile *f;
-    atomic32_t refcount;
-    uint32_t count;
-    bool read_only;
-    bool dirty;
-};
-
-/* Flush
- */
-LIB_EXPORT rc_t CC KCRC32SumFmtFlush ( KCRC32SumFmt *self )
-{
-    if ( self != NULL && self -> dirty )
-    {
-        KCRC32SumEntryFlushData pb;
-        pb . pos = 0;
-        pb . f = self -> f;
-        pb . rc = 0;
-
-        SLListDoUntil ( & self -> entries, KCRC32SumEntryFlush, & pb );
-
-        if ( pb . rc != 0 )
-            return pb . rc;
-
-        self -> dirty = false;
-    }
-    return 0;
-}
-
-
-/* Whack
- */
-static
-rc_t KCRC32SumFmtWhack ( KCRC32SumFmt *self )
-{
-    rc_t rc;
-
-    atomic32_set ( & self -> refcount, 1 );
-
-    rc = KCRC32SumFmtFlush ( self );
-    if ( rc == 0 )
-        rc = KFileRelease ( self -> f );
-    if ( rc != 0 )
-        return rc;
-
-    SLListWhack ( & self -> entries, KCRC32SumEntryWhack, NULL );
-    free ( self );
-    return 0;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KCRC32SumFmtAddRef ( const KCRC32SumFmt *cself )
-{
-    if ( cself != NULL )
-    {
-        CRC_DBG_REF (("%s self %p prior count %u\n", __func__, cself, atomic32_read ( & cself -> refcount ) ));
-        atomic32_inc ( & ( ( KCRC32SumFmt* ) cself ) -> refcount );
-    }
-    else
-    {
-        CRC_DBG_REF(("%s self %p\n", __func__, cself));
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KCRC32SumFmtRelease ( const KCRC32SumFmt *cself )
-{
-    KCRC32SumFmt *self = ( KCRC32SumFmt* ) cself;
-    if ( cself != NULL )
-    {
-        CRC_DBG_REF (("%s self %p prior count %u\n", __func__, cself, atomic32_read ( & cself -> refcount ) ));
-        if ( atomic32_dec_and_test ( & self -> refcount ) )
-            return KCRC32SumFmtWhack ( self );
-    }
-    else
-    {
-        CRC_DBG_REF(("%s self %p\n", __func__, cself));
-    }
-    return 0;
-}
-
-
-/* Extract
- *  extract a single line
- */
-static
-rc_t KCRC32SumFmtExtract ( KCRC32SumFmt *self, const char *line, size_t size )
-{
-    rc_t rc = 0;
-    KCRC32SumEntry *entry;
-
-    /* check for a DOS condition not caught by parse */
-    if ( line [ size - 1 ] == '\r' )
-    {
-        /* drop CR from line */
-        size -= 1;
-    }
-
-    /* quick validity check */
-    if ( size < 11 || line [ 8 ] != ' ' )
-        return RC ( rcFS, rcFile, rcConverting, rcFormat, rcInvalid );
-
-    /* create entry */
-    entry = malloc ( sizeof * entry + size - ( 8 /* cs */ + 2 /* sp + mode */ ) );
-    if ( entry == NULL )
-        rc = RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        /* read checksum */
-        char *p;
-        entry -> crc32 = strtoul ( line, & p, 16 );
-        if ( ( ( const char* ) p - line ) != 8 )
-            rc = RC ( rcFS, rcFile, rcConverting, rcFormat, rcInvalid );
-
-        /* parse mode */
-        else if ( line [ 9 ] == ' ' )
-            entry -> bin = false;
-        else if ( line [ 9 ] == '*' )
-            entry -> bin = true;
-        else
-            rc = RC ( rcFS, rcFile, rcConverting, rcFormat, rcInvalid );
-
-        /* the rest is path */
-        if ( rc == 0 )
-        {
-            string_copy ( entry -> path, size, & line [ 10 ], size - 10 );
-            SLListPushTail ( & self -> entries, & entry -> n );
-            ++ self -> count;
-            return 0;
-        }
-
-        free ( entry );
-    }
-
-    return rc;
-}
-
-
-/* Parse
- *  parse *.crc32 file
- */
-static
-rc_t KCRC32SumFmtParse ( KCRC32SumFmt *self, const char *start, const char *stop )
-{
-    rc_t rc;
-    const char *end;
-
-    for ( rc = 0; start < stop; start = end + 1 )
-    {
-        end = string_chr ( start, stop - start, '\n' );
-        if ( end == NULL )
-            end = stop;
-
-        /* allow '#' comments and blank lines */
-        if ( ( end - start ) == 0 )
-            continue;
-        if ( start [ 0 ] == '#' )
-            continue;
-
-        /* line must have minimum length */
-        if ( ( end - start ) < ( 8 /* cs */ + 2 /* sp + mode */ + 1 /* path */ ) )
-        {
-            /* check for empty line ending in CR-LF */
-            if ( end [ -1 ] == '\r' && ( end - start ) == 1 )
-                continue;
-
-            /* other stuff is garbage */
-            rc = RC ( rcFS, rcFile, rcParsing, rcData, rcInsufficient );
-            break;
-        }
-
-        /* extract entry */
-        rc = KCRC32SumFmtExtract ( self, start, end - start );
-        if ( rc != 0 )
-            break;
-    }
-
-    return rc;
-}
-
-
-/* Populate
- *  reads all lines of input from *.crc32 file
- */
-static
-rc_t KCRC32SumFmtPopulate ( KCRC32SumFmt *self, const KFile *in )
-{
-    uint64_t eof;
-    rc_t rc = KFileSize ( in, & eof );
-    if ( rc == 0 )
-    {
-        char *buff = malloc ( ( size_t ) eof );
-        if ( buff == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            size_t num_read, total;
-            for ( total = 0; total < ( size_t ) eof; total += num_read )
-            {
-                rc = KFileRead ( in, total,
-                    & buff [ total ], ( size_t ) eof - total, & num_read );
-                if ( rc != 0 )
-                    break;
-                if ( num_read == 0 )
-                {
-                    rc = RC ( rcFS, rcFile, rcReading, rcTransfer, rcIncomplete );
-                    break;
-                }
-            }
-
-            if ( rc == 0 )
-                rc = KCRC32SumFmtParse ( self, buff, buff + total );
-
-            free ( buff );
-        }
-    }
-
-    return rc;
-}
-
-
-/* Make
- *  creates a formatted accessor to textual checksum file
- */
-LIB_EXPORT rc_t CC KCRC32SumFmtMakeRead ( const KCRC32SumFmt **fp, const KFile *in )
-{
-    rc_t rc;
-    if ( fp == NULL )
-        rc = RC ( rcFS, rcFile, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( in == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNull );
-        else if ( ! in -> read_enabled )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNoPerm );
-        else
-        {
-            KCRC32SumFmt *f = malloc ( sizeof * f );
-            if ( f == NULL )
-                rc = RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                SLListInit ( & f -> entries );
-                atomic32_set ( & f -> refcount, 1 );
-                f -> f = NULL;
-                f -> count = 0;
-                f -> read_only = true;
-                f -> dirty = false;
-
-                rc = KCRC32SumFmtPopulate ( f, in );
-                if ( rc == 0 )
-                {
-                    f -> f = ( KFile* ) in;
-                    * fp = f;
-                    return 0;
-                }
-                
-                KCRC32SumFmtWhack ( f );
-            }
-        }
-
-        * fp = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KCRC32SumFmtMakeUpdate ( KCRC32SumFmt **fp, KFile *out )
-{
-    rc_t rc;
-    if ( fp == NULL )
-        rc = RC ( rcFS, rcFile, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( out == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNull );
-        else if ( ! out -> write_enabled )
-        {
-            if ( out -> read_enabled )
-                rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcReadonly );
-            else
-                rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNoPerm );
-        }
-        else
-        {
-            KCRC32SumFmt *f = malloc ( sizeof * f );
-            if ( f == NULL )
-                rc = RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                SLListInit ( & f -> entries );
-                atomic32_set ( & f -> refcount, 1 );
-                f -> f = NULL;
-                f -> count = 0;
-                f -> read_only = false;
-                f -> dirty = false;
-
-                rc = 0;
-                if ( out -> read_enabled )
-                    rc = KCRC32SumFmtPopulate ( f, out );
-                if ( rc == 0 )
-                {
-                    f -> f = out;
-                    * fp = f;
-                    return 0;
-                }
-                
-                KCRC32SumFmtWhack ( f );
-            }
-        }
-
-        * fp = NULL;
-    }
-
-    return rc;
-}
-
-
-/* Count
- *  return the number of checksums in file
- */
-LIB_EXPORT rc_t CC KCRC32SumFmtCount ( const KCRC32SumFmt *self, uint32_t *count )
-{
-    rc_t rc;
-    if ( count == NULL )
-        rc = RC ( rcFS, rcFile, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcFS, rcFile, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            * count = self -> count;
-            return 0;
-        }
-
-        * count = 0;
-    }
-    return rc;
-}
-
-
-/* Get
- *  retrieve an indexed checksum line
- *
- *  "idx" [ IN ] - zero-based index of checksum to access
- *
- *  "path" [ OUT ] and "size" [ IN ] - return buffer for file path
- *
- *  "crc32" [ OUT ] - return parameter for the checksum
- *
- *  "bin" [ OUT, NULL OKAY ] - true if fopen mode used to
- *  calculate "digest" was binary, false if text. pertinent if
- *  digest was calculated using DOS text mode.
- */
-LIB_EXPORT rc_t CC KCRC32SumFmtGet ( const KCRC32SumFmt *self, uint32_t idx,
-    char *path, size_t size, uint32_t *crc32, bool *bin )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcFS, rcFile, rcAccessing, rcSelf, rcNull );
-    else if ( idx >= self -> count )
-        rc = RC ( rcFS, rcFile, rcAccessing, rcId, rcNotFound );
-    else
-    {
-        uint32_t i;
-        const KCRC32SumEntry *entry = ( const KCRC32SumEntry* )
-            SLListHead ( & self -> entries );
-        for ( i = 0; entry != NULL && i < idx; ++ i )
-        {
-            entry = ( const KCRC32SumEntry* )
-                SLNodeNext ( & entry -> n );
-        }
-
-        if ( entry == NULL )
-            rc = RC ( rcFS, rcFile, rcAccessing, rcId, rcNotFound );
-        else if ( path == NULL )
-            rc = RC ( rcFS, rcFile, rcAccessing, rcBuffer, rcNull );
-        else if ( crc32 == NULL )
-            rc = RC ( rcFS, rcFile, rcAccessing, rcParam, rcNull );
-        else
-        {
-            /* copy everything out */
-            * crc32 = entry -> crc32;
-            if ( bin != NULL )
-                * bin = entry -> bin;
-
-            /* return success if buffer large enough */
-            if ( string_copy_measure ( path, size, entry -> path ) < size )
-                return 0;
-
-            rc = RC ( rcFS, rcFile, rcAccessing, rcBuffer, rcInsufficient );
-        }
-    }
-
-    if ( path != NULL && size != 0 )
-        path [ 0 ] = 0;
-
-    if ( crc32 != NULL )
-        * crc32 = 0;
-
-    if ( bin != NULL )
-        * bin = false;
-
-    return rc;
-}
-
-
-/* Find
- *  retrieve checksum line by path
- *
- *  "path" [ IN ] - NUL terminated string in OS-native char set
- *  denoting path to file
- *
- *  "crc32" [ OUT ] - return parameter for the checksum
- *
- *  "bin" [ OUT, NULL OKAY ] - true if fopen mode used to
- *  calculate "digest" was binary, false if text. pertinent if
- *  digest was calculated using DOS text mode.
- */
-LIB_EXPORT rc_t CC KCRC32SumFmtFind ( const KCRC32SumFmt *self,
-    const char *path, uint32_t *crc32, bool *bin )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcFS, rcFile, rcAccessing, rcSelf, rcNull );
-    else if ( path == NULL )
-        rc = RC ( rcFS, rcFile, rcAccessing, rcPath, rcNull );
-    else if ( path [ 0 ] == 0 )
-        rc = RC ( rcFS, rcFile, rcAccessing, rcPath, rcEmpty );
-    else
-    {
-        const KCRC32SumEntry *entry = ( const KCRC32SumEntry* )
-            SLListHead ( & self -> entries );
-        while ( entry != NULL )
-        {
-            if ( strcmp ( path, entry -> path ) == 0 )
-                break;
-
-            entry = ( const KCRC32SumEntry* )
-                SLNodeNext ( & entry -> n );
-        }
-
-        if ( entry == NULL )
-            rc = RC ( rcFS, rcFile, rcAccessing, rcPath, rcNotFound );
-        else if ( crc32 == NULL )
-            rc = RC ( rcFS, rcFile, rcAccessing, rcParam, rcNull );
-        else
-        {
-            /* copy everything out */
-            *crc32 = entry -> crc32;
-            if ( bin != NULL )
-                * bin = entry -> bin;
-
-            return 0;
-        }
-    }
-
-    if ( crc32 != NULL )
-        * crc32 = 0;
-
-    if ( bin != NULL )
-        * bin = false;
-
-    return rc;
-}
-
-
-/* Delete
- *  remove an existing line
- *
- *  "path" [ IN ] - NUL terminated string in OS-native char set
- *  denoting path to file
- *
- *  returns rcNotFound if not present
- */
-LIB_EXPORT rc_t CC KCRC32SumFmtDelete ( KCRC32SumFmt *self, const char *path )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcFS, rcFile, rcRemoving, rcSelf, rcNull );
-    else if ( path == NULL )
-        rc = RC ( rcFS, rcFile, rcRemoving, rcPath, rcNull );
-    else if ( path [ 0 ] == 0 )
-        rc = RC ( rcFS, rcFile, rcRemoving, rcPath, rcEmpty );
-    else
-    {
-        KCRC32SumEntry *entry = ( KCRC32SumEntry* )
-            SLListHead ( & self -> entries );
-        while ( entry != NULL )
-        {
-            if ( strcmp ( path, entry -> path ) == 0 )
-                break;
-
-            entry = ( KCRC32SumEntry* )
-                SLNodeNext ( & entry -> n );
-        }
-
-        if ( entry == NULL )
-            rc = RC ( rcFS, rcFile, rcRemoving, rcPath, rcNotFound );
-        else
-        {
-            /* pop entry from list */
-            SLListUnlink ( & self -> entries, & entry -> n );
-
-            /* delete entry */
-            KCRC32SumEntryWhack ( & entry -> n, NULL );
-
-            /* mark the modification */
-            self -> dirty = true;
-            assert ( self -> count > 0 );
-            -- self -> count;
-
-            return 0;
-        }
-    }
-
-    return rc;
-}
-
-
-/* Update
- *  add a checksum line to file or update an existing line
- *
- *  "path" [ IN ] - NUL terminated string in OS-native char set
- *  denoting path to file
- *
- *  "crc32" [ IN ] - calculated checksum
- *
- *  "bin" [ IN ] - true if checksum was calculated on all bytes
- *  in file, false if fopen mode used to read file was text.
- */
-LIB_EXPORT rc_t CC KCRC32SumFmtUpdate ( KCRC32SumFmt *self, const char *path, uint32_t crc32, bool bin )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcFS, rcFile, rcUpdating, rcSelf, rcNull );
-    else if ( path == NULL )
-        rc = RC ( rcFS, rcFile, rcUpdating, rcString, rcNull );
-    else if ( path [ 0 ] == 0 )
-        rc = RC ( rcFS, rcFile, rcUpdating, rcString, rcEmpty );
-    else
-    {
-        /* create an entry */
-        KCRC32SumEntry *entry;
-        rc = KCRC32SumEntryMake ( & entry, path, crc32, bin );
-        if ( rc == 0 )
-        {
-            /* scan for existing entry */
-            KCRC32SumEntry *exist = ( KCRC32SumEntry* )
-                SLListHead ( & self -> entries );
-            while ( exist != NULL )
-            {
-                if ( strcmp ( exist -> path, entry -> path ) == 0 )
-                    break;
-                exist = ( KCRC32SumEntry* )
-                    SLNodeNext ( & exist -> n );
-            }
-
-            /* if new entry, insert */
-            if ( exist == NULL )
-            {
-                SLListPushTail ( & self -> entries, & entry -> n );
-                self -> dirty = true;
-                ++ self -> count;
-            }
-
-            /* if existing, perform update */
-            else
-            {
-                if ( exist -> crc32 != entry -> crc32 || exist -> bin != entry -> bin )
-                {
-                    exist -> crc32 = entry -> crc32;
-                    exist -> bin = entry -> bin;
-                    self -> dirty = true;
-                }
-                KCRC32SumEntryWhack ( & entry -> n, NULL );
-            }
-        }
-    }
-
-    return rc;
-}
-
-/* Rename
- * Rename the checksum line to reflect a file name change but no content change.
- *
- *  "newpath" [ IN ] - NUL terminated string in OS-native char set
- *  denoting path to file's new name
- *
- *  "oldpath" [ IN ] - NUL terminated string in OS-native char set
- *  denoting path to file's old name
- *
- */
-LIB_EXPORT rc_t CC KCRC32SumFmtRename ( KCRC32SumFmt *self, const char *oldpath, const char *newpath )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcFS, rcFile, rcUpdating, rcSelf, rcNull );
-    else if ( newpath == NULL )
-        rc = RC ( rcFS, rcFile, rcUpdating, rcString, rcNull );
-    else if ( newpath [ 0 ] == 0 )
-        rc = RC ( rcFS, rcFile, rcUpdating, rcString, rcEmpty );
-    else if ( oldpath == NULL )
-        rc = RC ( rcFS, rcFile, rcUpdating, rcString, rcNull );
-    else if ( oldpath [ 0 ] == 0 )
-        rc = RC ( rcFS, rcFile, rcUpdating, rcString, rcEmpty );
-    else
-    {
-        bool bin;
-        uint32_t crc32;
-
-        rc = KCRC32SumFmtFind ( self, oldpath, & crc32, & bin );
-        if ( rc == 0 )
-            rc = KCRC32SumFmtUpdate ( self, newpath, crc32, bin );
-        if ( rc == 0 )
-            rc = KCRC32SumFmtDelete ( self, oldpath );
-    }
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * CRC32 KFile extensions
- */
-typedef enum KCRC32FileUnionType
-{
-    KCRC32FileTypeRead,
-    KCRC32FileTypeWrite
-} KCRC32FileUnionType;
-
-struct KCRC32File
-{
-    KFile dad;
-
-    /* this is position of next byte to read or write
-       relative to the CRC not actual read/write */
-    uint64_t position;
-    KFile *file;
-    KCRC32SumFmt *fmt;
-    uint32_t crc32;
-    KCRC32FileUnionType type;
-    union
-    {
-        struct
-        {
-            rc_t rc;
-            uint32_t crc32;
-            bool eof;
-        } rd;
-
-        struct
-        {
-            /* maximum position written to "file" */
-            uint64_t max_position;
-
-            /* saved information for a transaction */
-            uint64_t tposition;
-            uint32_t crc32;
-
-            /* is transaction open */
-            bool topen;
-
-            /* path to file for crc32 fmt */
-            char path [ 1 ];
-        } wr;
-
-    } u;
-};
-
-/* Whack
- */
-static
-rc_t CC KCRC32FileWhackRead ( KCRC32File *self )
-{
-    rc_t rc;
-
-    atomic32_set ( & self -> dad . refcount, 1 );
-
-    rc = KFileRelease ( self -> file );
-    if ( rc == 0 )
-        free ( self );
-
-    return rc;
-}
-
-static
-rc_t CC KCRC32FileWhackWrite ( KCRC32File *self )
-{
-    rc_t rc;
-
-    atomic32_set ( & self -> dad . refcount, 1 );
-
-    /* if destination file has been written farther
-       than our concept of eof, truncate */
-    if ( self -> u . wr . max_position > self -> position )
-    {
-        rc = KFileSetSize ( self -> file, self -> position );
-        if ( rc != 0 )
-            return rc;
-        self -> u . wr . max_position = self -> position;
-    }
-
-    rc = KFileRelease ( self -> file );
-    if ( rc == 0 )
-    {
-        KCRC32SumFmtUpdate ( self -> fmt, self -> u . wr . path, self -> crc32, true );
-        KCRC32SumFmtRelease ( self -> fmt );
-        free ( self );
-    }
-
-    return rc;
-}
-
-static const char CRCTAG [8] = "CRC32CTX";
-static const char ENDIANTAG [4] =
-{ 
-    '0' + (char)((__BYTE_ORDER/1000)%10),
-    '0' + (char)((__BYTE_ORDER/100)%10),
-    '0' + (char)((__BYTE_ORDER/10)%10),
-    '0' + (char)((__BYTE_ORDER/1)%10)
-};
-static const char ENDIANSWAPTAG [4] =
-{ 
-    '0' + (char)((__BYTE_ORDER/1)%10),
-    '0' + (char)((__BYTE_ORDER/10)%10),
-    '0' + (char)((__BYTE_ORDER/100)%10),
-    '0' + (char)((__BYTE_ORDER/1000)%10)
-};
-
-static
-rc_t CC KCRC32FileWrite ( KCRC32File *self, uint64_t pos,
-    const void *buffer, size_t size, size_t *num_writ );
-
-static
-rc_t CC KCRC32FileWhackAppend ( KCRC32File *self )
-{
-    rc_t rc;
-
-    /* if the file is empty, just whack it */
-    if ( self -> position == 0 )
-        return KCRC32FileWhackWrite ( self );
-
-    /* begin transaction will save current state */
-    rc = KCRC32FileBeginTransaction ( self );
-    if ( rc == 0 )
-    {
-        size_t num_writ;
-
-        /* create a closing tag with current checksum */
-        uint8_t closer [ sizeof CRCTAG + sizeof ENDIANTAG + sizeof self -> crc32 ];
-        memcpy ( closer, CRCTAG, sizeof CRCTAG );
-        memcpy ( & closer [ sizeof CRCTAG ], ENDIANTAG, sizeof ENDIANTAG );
-        memcpy ( & closer [ sizeof CRCTAG + sizeof ENDIANTAG ], & self -> crc32, sizeof self -> crc32 );
-            
-        /* append this to the file */
-        rc = KCRC32FileWrite ( self, self -> position, closer, sizeof closer, & num_writ );
-        if ( rc == 0 )
-        {
-            /* test transfer */
-            if ( num_writ != sizeof closer )
-                rc = RC ( rcFS, rcFile, rcDestroying, rcTransfer, rcIncomplete );
-            else
-            {
-                /* complete operation */
-                rc = KCRC32FileWhackWrite ( self );
-                if ( rc == 0 )
-                    return rc;
-            }
-        }
-
-        /* restore entry state */
-        KCRC32FileRevert ( self );
-    }
-
-    /* bail on errors */
-    atomic32_set ( & self -> dad . refcount, 1 );
-    return rc;
-}
-
-
-/* GetSysFile
- */
-static
-struct KSysFile *CC KCRC32FileGetSysFile ( const KCRC32File *self, uint64_t *offset )
-{
-    if ( offset != NULL )
-        * offset = 0;
-    return NULL;
-}
-
-
-/* RandomAccess
- */
-static
-rc_t CC KCRC32FileRandomAccessRead ( const KCRC32File *self )
-{
-    return KFileRandomAccess ( self -> file );
-}
-
-static
-rc_t CC KCRC32FileRandomAccessWrite ( const KCRC32File *self )
-{
-    return RC ( rcFS, rcFile, rcAccessing, rcFunction, rcUnsupported );
-}
-
-
-/* Type
- */
-static
-uint32_t CC KCRC32FileType ( const KCRC32File *self )
-{
-    return KFileType ( self -> file );
-}
-
-
-/* Size
- */
-static
-rc_t CC KCRC32FileSize ( const KCRC32File *self, uint64_t *size )
-{
-    return KFileSize ( self -> file, size );
-}
-
-static
-rc_t CC KCRC32FileSizeAppend ( const KCRC32File *self, uint64_t *size )
-{
-    *size = self -> position;
-    return 0;
-}
-
-
-/* SetSize
- *  the read-only version should never be called, because
- *  the message dispatch checks for write enable
- *
- *  the writable version disallows all but a total reset
- *  and setting size to current size
- */
-static
-rc_t CC KCRC32FileSetSizeRead ( KCRC32File *self, uint64_t size )
-{
-    return RC ( rcFS, rcFile, rcUpdating, rcFunction, rcUnsupported );
-}
-
-static
-rc_t CC KCRC32FileSetSizeWrite ( KCRC32File *self, uint64_t size )
-{
-    rc_t rc;
-
-    /* allow a noop */
-    if ( size == self -> position )
-        return 0;
-
-    /* disallow if not a reset */
-    if ( size != 0 )
-        return RC ( rcFS, rcFile, rcUpdating, rcFunction, rcUnsupported );
-
-    /* ensure we're not in a transaction */
-    if ( self -> u . wr . topen )
-        return RC ( rcFS, rcFile, rcUpdating, rcFile, rcBusy );
-
-    /* go ahead and try to truncate destination */
-    rc = KFileSetSize ( self -> file, 0 );
-    if ( rc == 0 )
-    {
-        /* reset our internal state */
-        self -> position = self -> u . wr . max_position = 0;
-        self -> crc32 = 0;
-    }
-
-    return rc;
-}
-
-
-/* Finish
- *  returns the results of crc comparison
- */
-static
-rc_t KCRC32FileFinish ( KCRC32File *self )
-{
-    if ( ! self -> u . rd . eof )
-    {
-        if ( self -> crc32 != self -> u. rd . crc32 )
-            self -> u . rd . rc = RC ( rcFS, rcFile, rcReading, rcFile, rcCorrupt );
-        self -> u . rd . eof = true;
-    }
-
-    return self -> u . rd . rc;
-}
-
-
-/* Seek
- *  used to scan ahead in a read-only file
- *  "self" is modifiable, but file is read-only
- */
-static
-rc_t KCRC32FileSeek ( KCRC32File *self, uint64_t pos )
-{
-    rc_t rc;
-    size_t num_read;
-    uint8_t buff [ 32 * 1024 ];
-
-    /* should never be called by writable file */
-    assert ( ! self -> dad . write_enabled );
-
-    /* seek to "pos" */
-    for ( rc = 0; self -> position < pos; self -> position += num_read )
-    {
-        /* maximum to read in this buffer */
-        size_t to_read = sizeof buff;
-        if ( self -> position + sizeof buff > pos )
-            to_read = ( size_t ) ( pos - self -> position );
-
-        /* read bytes */
-        rc = KFileRead ( self -> file, self -> position, buff, to_read, & num_read );
-        if ( rc != 0 )
-            break;
-
-        /* detect EOF */
-        if ( num_read == 0 )
-        {
-            switch (self->type)
-            {
-            case KCRC32FileTypeRead:
-                rc = KCRC32FileFinish ( self );
-                break;
-            case KCRC32FileTypeWrite:
-                if ( self -> fmt != NULL)
-                {
-                    KCRC32SumFmtUpdate ( self -> fmt, self -> u . wr . path, self -> crc32, true );
-                    KCRC32SumFmtRelease ( self -> fmt );
-                    self -> fmt = NULL;
-                }
-                break;
-            }
-            break;
-        }
-        
-        /* append bytes */
-        self -> crc32 = CRC32 ( self -> crc32, buff, num_read );
-    }
-    
-    return rc;
-}
-
-/* Read
- *  read-only version allows random access reads
- */
-static
-rc_t CC KCRC32FileRead ( const KCRC32File *cself,
-    uint64_t pos, void *buffer, size_t bsize, size_t *num_read )
-{
-    rc_t rc;
-    size_t total = 0;
-    uint64_t end = pos + bsize;
-    KCRC32File *self = ( KCRC32File* ) cself;
-
-    * num_read = 0;
-
-    /* no buffer means no bytes */
-    if ( bsize == 0 )
-        return 0;
-
-    /* test for starting a read before the current marker
-       meaning that it does not figure in to the checksum */
-    if ( self -> position > pos )
-    {
-        /* test for entire buffer being before marker */
-        if ( end <= self -> position )
-            return KFileRead ( self -> file, pos, buffer, bsize, num_read );
-
-        /* perform a partial read without affecting checksum */
-        rc = KFileRead ( self -> file, pos, buffer, ( size_t )( self -> position - pos ), num_read );
-        if ( rc != 0 )
-            return rc;
-
-        /* adjust as if a new read request, remembering number read so far */
-        pos += * num_read;
-        total = * num_read;
-        buffer = & ( ( uint8_t* ) buffer ) [ * num_read ];
-
-        /* in case num_read != all bytes up to marker */
-        if ( pos != self -> position )
-            return 0;
-    }
-
-    /* test for hole between current marker and desired start */
-    else if ( self -> position < pos )
-    {
-        /* scan ahead, discarding */
-        rc = KCRC32FileSeek ( self, pos );
-        if ( rc != 0 || self -> position < pos )
-            return rc;
-    }
-
-    /* no hole - and still some space in buffer */
-    assert ( self -> position == pos );
-    assert ( pos < end );
-
-    /* read bytes */
-    rc = KFileRead ( self -> file, pos, buffer, ( size_t ) ( end - pos ), num_read );
-    if ( rc == 0 )
-    {
-        /* detect bytes read */
-        if ( * num_read != 0 )
-        {
-            /* accumulate into checksum */
-            self -> position += * num_read;
-            self -> crc32 = CRC32 ( self -> crc32, buffer, * num_read );
-
-            /* add in any previously read bytes and return success */
-            * num_read += total;
-            return 0;
-        }
-
-        switch (self->type)
-        {
-        case KCRC32FileTypeRead:
-            /* EOF - get results */
-            rc = KCRC32FileFinish ( self );
-            break;
-        case KCRC32FileTypeWrite:
-            if ( self -> fmt != NULL)
-            {
-                KCRC32SumFmtUpdate ( self -> fmt, self -> u . wr . path, self -> crc32, true );
-                KCRC32SumFmtRelease ( self -> fmt );
-                self -> fmt = NULL;
-            }
-            break;
-        }
-
-    }
-
-    /* always return 0 if some bytes were read */
-    if ( total != 0 )
-    {
-        * num_read = total;
-        return 0;
-    }
-    
-    return rc;
-}
-
-/* Read
- *  writeable version isn't keeping track of checksum on read,
- *  so just forward to destination file
- */
-static
-rc_t CC KCRC32FileFwdRead ( const KCRC32File *self,
-    uint64_t pos, void *buffer, size_t bsize, size_t *num_read )
-{
-    return KFileRead ( self -> file, pos, buffer, bsize, num_read );
-}
-
-
-/* Write
- */
-static
-rc_t CC KCRC32FileBadWrite ( KCRC32File *self, uint64_t pos,
-    const void *buffer, size_t size, size_t *num_writ )
-{
-    * num_writ = 0;
-    if ( size == 0 )
-        return 0;
-    if ( buffer == NULL )
-        return RC ( rcFS, rcFile, rcWriting, rcBuffer, rcNull );
-
-    return RC ( rcFS, rcFile, rcReading, rcFile, rcReadonly );
-}
-
-static
-rc_t CC KCRC32FileWrite ( KCRC32File *self, uint64_t pos,
-    const void *buffer, size_t size, size_t *num_writ )
-{
-    rc_t rc;
-
-    if ( pos != self -> position )
-        return RC ( rcFS, rcFile, rcWriting, rcParam, rcInvalid );
-
-    rc = KFileWrite ( self -> file, pos, buffer, size, num_writ );
-    if ( rc == 0 && * num_writ != 0 )
-    {
-        self -> position += * num_writ;
-        if ( self -> position > self -> u . wr . max_position )
-            self -> u . wr . max_position = self -> position;
-        self -> crc32 = CRC32 ( self -> crc32, buffer, * num_writ );
-    }
-
-    return rc;
-}
-
-
-/* ToKFile
- *  a CRC file is a subclass of KFile
- *  this is an explicit cast operator
- */
-LIB_EXPORT KFile* CC KCRC32FileToKFile ( KCRC32File *self )
-{
-    if ( self != NULL )
-        return & self -> dad;
-    return NULL;
-}
-
-LIB_EXPORT const KFile* CC KCRC32FileToKFileConst ( const KCRC32File *self )
-{
-    if ( self != NULL )
-        return & self -> dad;
-    return NULL;
-}
-
-
-/* BeginTransaction
- *  preserve current state and file marker
- *  in preparation for rollback
- */
-LIB_EXPORT rc_t CC KCRC32FileBeginTransaction ( KCRC32File *self )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcFreezing, rcSelf, rcNull );
-    if ( ! self -> dad . write_enabled )
-        return RC ( rcFS, rcFile, rcFreezing, rcFile, rcReadonly );
-    if ( self -> u . wr . topen )
-        return RC ( rcFS, rcFile, rcFreezing, rcFile, rcBusy );
-
-    self -> u . wr . topen = true;
-    self -> u . wr . tposition = self -> position;
-    self -> u . wr . crc32 = self -> crc32;
-
-    return 0;
-}
-
-
-/* Commit
- *  accept current state as correct
- */
-LIB_EXPORT rc_t CC KCRC32FileCommit ( KCRC32File *self )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcCommitting, rcSelf, rcNull );
-    if ( ! self -> dad . write_enabled )
-        return RC ( rcFS, rcFile, rcCommitting, rcFile, rcReadonly );
-
-    self -> u . wr . topen = false;
-
-    return 0;
-}
-
-
-/* Revert
- *  revert state to previous transaction boundary conditions
- */
-LIB_EXPORT rc_t CC KCRC32FileRevert ( KCRC32File *self )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcReverting, rcSelf, rcNull );
-    if ( ! self -> dad . write_enabled )
-        return RC ( rcFS, rcFile, rcReverting, rcFile, rcReadonly );
-    if ( ! self -> u . wr . topen )
-        return RC ( rcFS, rcFile, rcReverting, rcFile, rcInconsistent );
-
-    self -> position = self -> u . wr . tposition;
-    self -> crc32 = self -> u . wr . crc32;
-    self -> u . wr . topen = false;
-
-    return 0;
-}
-
-/* Reset
- *  reset state to that of an empty file
- *  aborts any open transaction
- */
-LIB_EXPORT rc_t CC KCRC32FileReset ( KCRC32File *self )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcResetting, rcSelf, rcNull );
-    if ( ! self -> dad . write_enabled )
-        return RC ( rcFS, rcFile, rcResetting, rcFile, rcReadonly );
-#if 1
-    self -> u . wr . topen = false;
-#else
-    if ( self -> u . wr . topen )
-        return RC ( rcFS, rcFile, rcResetting, rcFile, rcBusy );
-#endif
-
-    self -> position = 0;
-    self -> crc32 = 0;
-
-    return 0;
-}
-
-/*--------------------------------------------------------------------------
- * CRC32File factories
- */
-
-
-/* MakeCRC32Read
- *  creates an adapter to check CRC32 checksum for a source file
- *
- *  "f" [ OUT ] - return parameter for file with crc32 check
- *
- *  "src" [ IN ] - source file with read permission
- *
- *  "crc32" [ IN ] - checksum to match
- *
- * NB - creates a read-only file that does NOT support random access
- *  i.e. must be consumed serially starting from offset 0
- */
-static KFile_vt_v1 KCRC32FileRead_vt =
-{
-    1, 1,
-
-    /* 1.0 */
-    KCRC32FileWhackRead,
-    KCRC32FileGetSysFile,
-    KCRC32FileRandomAccessRead,
-    KCRC32FileSize,
-    KCRC32FileSetSizeRead,
-    KCRC32FileRead,
-    KCRC32FileBadWrite,
-
-    /* 1.1 */
-    KCRC32FileType
-};
-
-LIB_EXPORT rc_t CC KFileMakeCRC32Read ( const KFile **fp,
-    const KFile *src, uint32_t crc32 )
-{
-    rc_t rc;
-
-    if ( fp == NULL )
-        rc = RC ( rcFS, rcFile, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( src == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNull );
-        else if ( ! src -> read_enabled )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNoPerm );
-        else
-        {
-            KCRC32File *f = malloc ( sizeof * f - sizeof f -> u + sizeof f -> u . rd );
-            if ( f == NULL )
-                rc = RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                rc = KFileInit ( & f -> dad,
-				     ( const KFile_vt* ) & KCRC32FileRead_vt, "KCRC32File", "no-name", true, false );
-                if ( rc == 0 )
-                {
-                    f -> position = 0;
-                    f -> crc32 = 0;
-                    f -> file = ( KFile* ) src;
-                    f -> fmt = NULL;
-                    f -> type = KCRC32FileTypeRead;
-                    f -> u . rd . rc = 0;
-                    f -> u . rd . eof = 0;
-                    f -> u . rd . crc32 = crc32;
-
-                    * fp = & f -> dad;
-                    return 0;
-                }
-            }
-
-            free ( f );
-        }
-
-        * fp = NULL;
-    }
-
-    return rc;
-}
-
-
-/* MakeWrite
- *  creates an adapter to create checksum for a file
- *
- *  "f" [ OUT ] - return parameter for file with crc32 check
- *
- *  "out" [ IN ] - output file with write permission
- *  since this file is being wrapped by "f", ownership of
- *  the provided reference is transferred to "f"
- *
- *  "fmt" [ IN ] - checksum output formatter.
- *  since this may be used for multiple checksums, "f" will
- *  attach its own reference to "fmt".
- *
- *  "path" [ IN ] - checksum output file path, used to
- *  create standard crc32sum file entry.
- *
- * NB - creates a write-only file that does NOT suppport random access
- *  i.e. must be written serially from offset 0
- */
-static KFile_vt_v1 sKCRC32FileWrite_vt =
-{
-    1, 0,
-
-    KCRC32FileWhackWrite,
-    KCRC32FileGetSysFile,
-    KCRC32FileRandomAccessWrite,
-    KCRC32FileSize,
-    KCRC32FileSetSizeWrite,
-    KCRC32FileFwdRead,
-    KCRC32FileWrite
-};
-
-LIB_EXPORT rc_t CC KCRC32FileMakeWrite ( KCRC32File **fp,
-    KFile *out, KCRC32SumFmt *fmt, const char *path )
-{
-    rc_t rc;
-
-    if ( fp == NULL )
-        rc = RC ( rcFS, rcFile, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( out == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNull );
-        else if ( ! out -> write_enabled )
-        {
-            if ( out -> read_enabled )
-                rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcReadonly );
-            else
-                rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNoPerm );
-        }
-        else if ( fmt == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNull );
-        else if ( fmt -> read_only )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcReadonly );
-        else if ( path == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcPath, rcNull );
-        else if ( path [ 0 ] == 0 )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcPath, rcEmpty );
-        else
-        {
-            KCRC32File *f = malloc ( sizeof * f - sizeof f -> u +
-                sizeof f -> u . wr + strlen ( path ) );
-            if ( f == NULL )
-                rc = RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                rc = KFileInit ( & f -> dad,
-                    ( const KFile_vt* ) & sKCRC32FileWrite_vt, "KCRC32File", path, out -> read_enabled, true );
-                if ( rc == 0 )
-                {
-                    f -> position = 0;
-                    f -> crc32 = 0;
-                    f -> file = out;
-                    f -> fmt = fmt;
-                    f -> type = KCRC32FileTypeWrite;
-
-                    memset ( & f -> u . wr, 0, sizeof f -> u . wr );
-                    strcpy ( f -> u . wr . path, path );
-
-                    rc = KFileSize ( out, & f -> u . wr . max_position );
-                    if (rc)
-                    {
-                        if (GetRCState (rc) == rcUnsupported)
-                        {
-                            f -> u . wr . max_position  = 0;
-                            rc = 0;
-                        }
-                    }    
-                    if ( rc == 0 )
-                        rc = KCRC32SumFmtAddRef ( fmt );
-                    if ( rc == 0 )
-                    {
-                        * fp = f;
-                        return 0;
-                    }
-                }
-
-                free ( f );
-            }
-        }
-
-        * fp = NULL;
-    }
-
-    return rc;
-}
-
-/* MakeAppend
- *  creates an adapter to create CRC32 checksum for a file
- *
- *  "f" [ OUT ] - return parameter for file with crc32 check
- *
- *  "out" [ IN ] - output file with write permission
- *  since this file is being wrapped by "f", ownership of
- *  the provided reference is transferred to "f"
- *
- *  "fmt" [ IN ] - checksum output formatter.
- *  since this may be used for multiple checksums, "f" will
- *  attach its own reference to "fmt".
- *
- *  "path" [ IN ] - checksum output file path, used to
- *  create standard crc32sum file entry.
- *
- * NB - creates a write-only file that does NOT suppport random access
- *  i.e. must be written serially from current EOF (minus the stored crc context)
- */
-static KFile_vt_v1 sKCRC32FileAppend_vt =
-{
-    1, 0,
-
-    KCRC32FileWhackAppend,
-    KCRC32FileGetSysFile,
-    KCRC32FileRandomAccessWrite,
-    KCRC32FileSizeAppend,
-    KCRC32FileSetSizeWrite,
-    KCRC32FileFwdRead,
-    KCRC32FileWrite
-};
-
-LIB_EXPORT rc_t CC KCRC32FileMakeAppend ( KCRC32File **fp, KFile *out, KCRC32SumFmt *fmt, const char *path )
-{
-    rc_t rc;
-    KLogLevel lvl = klogInt;
-    
-    if ( fp == NULL )
-        rc = RC ( rcFS, rcFile, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( out == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNull );
-        else if ( ! out -> write_enabled )
-        {
-            if ( out -> read_enabled )
-                rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcReadonly );
-            else
-                rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNoPerm );
-        }
-        else if ( fmt == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNull );
-        else if ( fmt -> read_only )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcReadonly );
-        else if ( path == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcPath, rcNull );
-        else if ( path [ 0 ] == 0 )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcPath, rcEmpty );
-        else
-        {
-            KCRC32File *f = malloc ( sizeof * f - sizeof f -> u +
-                sizeof f -> u . wr + strlen ( path ) );
-            if ( f == NULL )
-            {
-                rc = RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-                lvl = klogSys;
-            }
-            else
-            {
-                rc = KFileInit ( & f -> dad,
-                    ( const KFile_vt* ) & sKCRC32FileAppend_vt, "KCRC32File", path, out -> read_enabled, true );
-                if ( rc == 0 )
-                {
-                    f -> crc32 = 0;
-                    f -> file = out;
-                    f -> fmt = fmt;
-                    f -> type = KCRC32FileTypeWrite;
-
-                    rc = KCRC32SumFmtAddRef ( fmt );
-                    if ( rc != 0 )
-                    {
-                        free ( f );
-                        * fp = NULL;
-                        return rc;
-                    }
-
-                    memset ( & f -> u . wr, 0, sizeof f -> u . wr );
-                    strcpy ( f -> u . wr . path, path );
-
-                    lvl = klogSys;
-                    rc = KFileSize ( out, & f -> position );
-                    if ( rc == 0 )
-                    {
-                        uint8_t buffer [ sizeof CRCTAG + sizeof ENDIANTAG + sizeof f -> crc32 ];
-
-                        /* an empty file is fine */
-                        if ( f -> position == 0 )
-                        {
-                            * fp = f;
-                            return 0;
-                        }
-
-                        /* set max */
-                        f -> u . wr . max_position = f -> position;
-
-                        /* a file without a trailing crc state is incorrect or corrupt */
-                        if ( f -> position < sizeof buffer )
-                        {
-                            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcIncorrect );
-                            lvl = klogErr;
-                        }
-                        else
-                        {
-                            /* try to read crc state */
-                            size_t num_read;
-                            rc = KFileRead ( out, f -> position - sizeof buffer, buffer, sizeof buffer, & num_read );
-                            if ( rc == 0 )
-                            {
-                                if ( num_read != sizeof buffer )
-                                    rc = RC ( rcFS, rcFile, rcConstructing, rcTransfer, rcIncomplete );
-                                else
-                                {
-                                    /* errors from here are usage errors */
-                                    lvl = klogErr;
-                                    
-                                    if ( memcmp ( buffer, CRCTAG, sizeof CRCTAG ) != 0 )
-                                        rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcIncorrect );
-                                    else
-                                    {
-                                        /* forget about the CRC state */
-                                        f -> position -= sizeof buffer;
-                                        memcpy ( & f -> crc32, & buffer [ sizeof CRCTAG + sizeof ENDIANTAG ], sizeof f -> crc32 );
-                                        
-                                        /* check for proper byte order */
-                                        if ( memcmp ( & buffer [ sizeof CRCTAG ], ENDIANTAG, sizeof ENDIANTAG ) == 0 )
-                                        {
-                                            * fp = f;
-                                            return 0;
-                                        }
-
-                                        /* probably swapped, but confirm */
-                                        if ( memcmp ( & buffer [ sizeof CRCTAG ], ENDIANSWAPTAG, sizeof ENDIANSWAPTAG ) == 0 )
-                                        {
-                                            f -> crc32 = bswap_32 ( f -> crc32 );
-                                            * fp = f;
-                                            return 0;
-                                        }
-                                        
-                                        /* garbage */
-                                        rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcCorrupt );
-                                    }
-                                }
-                            }
-                        }
-                    }
-                    
-                    KCRC32SumFmtRelease ( fmt );
-                }
-                
-                free ( f );
-            }
-        }
-        
-        * fp = NULL;
-    }
-    
-    LOGERR ( lvl, rc, "append-mode CRC32 file" );
-    
-    return rc;
-}
-
-static KFile_vt_v1 sKCRC32FileReadCreate_vt =
-{
-    1, 1,
-
-    KCRC32FileWhackRead,
-    KCRC32FileGetSysFile,
-    KCRC32FileRandomAccessRead,
-    KCRC32FileSize,
-    KCRC32FileSetSizeRead,
-    KCRC32FileRead,
-    KCRC32FileBadWrite,
-
-    /* 1.1 */
-    KCRC32FileType
-};
-
-LIB_EXPORT rc_t CC KFileMakeNewCRC32Read ( const KFile **fp,
-    const KFile *in, KCRC32SumFmt *fmt, const char *path )
-{
-    rc_t rc;
-
-    if ( fp == NULL )
-        rc = RC ( rcFS, rcFile, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( in == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNull );
-        else if ( ! in -> read_enabled )
-	    rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNoPerm );
-        else if ( fmt == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNull );
-        else if ( fmt -> read_only )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcReadonly );
-        else if ( path == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcPath, rcNull );
-        else if ( path [ 0 ] == 0 )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcPath, rcEmpty );
-        else
-        {
-            KCRC32File *f = malloc ( sizeof * f - sizeof f -> u +
-                sizeof f -> u . wr + strlen ( path ) );
-            if ( f == NULL )
-                rc = RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                rc = KFileInit ( & f -> dad,
-                    ( const KFile_vt* ) & sKCRC32FileReadCreate_vt, "KCRC32File", path, in -> read_enabled, false );
-                if ( rc == 0 )
-                {
-                    f -> position = 0;
-                    f -> crc32 = 0;
-                    f -> file = ( KFile* ) in;
-                    f -> fmt = fmt;
-                    f -> type = KCRC32FileTypeWrite;
-                    memset ( & f -> u . wr, 0, sizeof f -> u . wr );
-                    strcpy ( f -> u . wr . path, path );
-#if 0
-                    /* KFileSize can't always be used */
-                    rc = KFileSize ( in, & f -> u . wr . max_position );
-#endif
-                    if ( rc == 0 )
-                        rc = KCRC32SumFmtAddRef ( fmt );
-                    if ( rc == 0 )
-                    {
-                        * fp = & f -> dad;
-                        return 0;
-                    }
-                }
-
-                free ( f );
-            }
-        }
-
-        * fp = NULL;
-    }
-
-    return rc;
-}
diff --git a/libs/kfs/dir_test.c b/libs/kfs/dir_test.c
deleted file mode 100644
index 9be919e..0000000
--- a/libs/kfs/dir_test.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kfs/extern.h>
-#include <kfs/directory.h>
-#include <sysalloc.h>
-
-/* ======================================================================
- */
-const char *get_mode_string ( KCreateMode mode )
-{
-    switch (mode)
-    {
-    default:
-	return "BAD MODE";
-    case kcmOpen:
-	return "kcmOpen";
-    case kcmInit:
-	return "kcmInit";
-    case kcmCreate:
-	return "kcmCreate";
-    case kcmOpen|kcmParents:
-	return "kcmOpen|kcmParents";
-    case kcmInit|kcmParents:
-	return "kcmInit|kcmParents";
-    case kcmCreate|kcmParents:
-	return "kcmCreate|kcmParents";
-    }
-}
-
-/* end of file */
diff --git a/libs/kfs/directory.c b/libs/kfs/directory.c
deleted file mode 100644
index bf6d969..0000000
--- a/libs/kfs/directory.c
+++ /dev/null
@@ -1,1538 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#define TRACK_REFERENCES 0
-
-#include <kfs/extern.h>
-#include <kfs/impl.h>
-#include <klib/refcount.h>
-#include <klib/rc.h>
-#include <klib/text.h>
-#include <klib/printf.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-
-/*--------------------------------------------------------------------------
- * KDirectory
- *  a directory
- */
-
-static const char classname[] = "KDirectory";
-
-/* AddRef
- *  creates a new reference
- *  ignores NULL references
- */
-LIB_EXPORT rc_t CC KDirectoryAddRef ( const KDirectory *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, classname ) )
-        {
-        case krefLimit:
-            return RC ( rcFS, rcDirectory, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-/* Release
- *  discard reference to directory
- *  ignores NULL references
- */
-LIB_EXPORT rc_t CC KDirectoryRelease ( const KDirectory *cself )
-{
-    KDirectory *self = ( KDirectory* ) cself;
-    if ( cself != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, classname ) )
-        {
-        case krefWhack:
-        {
-            rc_t rc;
-
-            switch ( self -> vt -> v1 . maj )
-            {
-            case 1:
-                rc = ( * self -> vt -> v1 . destroy ) ( self );
-                break;
-
-            default:
-                rc = RC ( rcFS, rcDirectory, rcReleasing, rcInterface, rcBadVersion );
-            }
-
-            if ( rc != 0 )
-                KRefcountInit ( & self -> refcount, 1, classname, "failed-release", "orphan" );
-            return rc;
-        }
-        case krefNegative:
-            return RC ( rcDB, rcTable, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-/* List
- *  create a directory listing
- *
- *  "list" [ OUT ] - return parameter for list object
- *
- *  "path" [ IN, NULL OKAY ] - optional parameter for target
- *  directory. if NULL, interpreted to mean "." will be
- *  interpreted as format string if arguments follow
- */
-LIB_EXPORT rc_t CC KDirectoryList ( const KDirectory *self, struct KNamelist **list,
-    bool ( CC * f ) ( const KDirectory *dir, const char *name, void *data ),
-    void *data, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDirectoryVList ( self, list, f, data, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDirectoryVList ( const KDirectory *self, struct KNamelist **list,
-    bool ( CC * f ) ( const KDirectory *dir, const char *name, void *data ),
-    void *data, const char *path, va_list args )
-{
-    if ( list == NULL )
-        return RC ( rcFS, rcDirectory, rcListing, rcParam, rcNull );
-
-    * list = NULL;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcDirectory, rcListing, rcSelf, rcNull );
-
-    if ( path == NULL || path [ 0 ] == 0 )
-        path = ".";
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . list_dir ) ( self, list, f, data, path, args );
-    }
-
-    return RC ( rcFS, rcDirectory, rcListing, rcInterface, rcBadVersion );
-}
-
-/* Visit
- *  visit each path under designated directory,
- *  recursively if so indicated
- *
- *  "recurse" [ IN ] - if non-zero, recursively visit sub-directories
- *
- *  "f" [ IN ] and "data" [ IN, OPAQUE ] - function to execute
- *  on each path. receives a base directory and relative path
- *  for each entry. if "f" returns non-zero, the iteration will
- *  terminate and that value will be returned. NB - "dir" will not
- *  be the same as "self".
- *
- *  "path" [ IN ] - NUL terminated string in directory-native character set
- */
-LIB_EXPORT rc_t CC KDirectoryVisit ( const KDirectory *self, bool recurse,
-    rc_t ( CC * f ) ( const KDirectory *dir, uint32_t type, const char *name, void *data ),
-    void *data, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDirectoryVVisit ( self, recurse, f, data, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDirectoryVVisit ( const KDirectory *self, bool recurse,
-    rc_t ( CC * f ) ( const KDirectory *dir, uint32_t type, const char *name, void *data ),
-    void *data, const char *path, va_list args )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcDirectory, rcVisiting, rcSelf, rcNull );
-    if ( f == NULL )
-        return RC ( rcFS, rcDirectory, rcVisiting, rcFunction, rcNull );
-
-    if ( path == NULL || path [ 0 ] == 0 )
-        path = ".";
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . visit ) ( self, recurse, f, data, path, args );
-    }
-
-    return RC ( rcFS, rcDirectory, rcVisiting, rcInterface, rcBadVersion );
-}
-
-/* VisitUpdate
- *  
- */
-LIB_EXPORT rc_t CC KDirectoryVisitUpdate ( KDirectory *self, bool recurse,
-    rc_t ( CC * f ) ( KDirectory *dir, uint32_t type, const char *name, void *data ),
-    void *data, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDirectoryVVisitUpdate ( self, recurse, f, data, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDirectoryVVisitUpdate ( KDirectory *self, bool recurse,
-    rc_t ( CC * f ) ( KDirectory *dir, uint32_t type, const char *name, void *data ),
-    void *data, const char *path, va_list args )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcDirectory, rcVisiting, rcSelf, rcNull );
-    if ( f == NULL )
-        return RC ( rcFS, rcDirectory, rcVisiting, rcFunction, rcNull );
-
-    if ( path == NULL || path [ 0 ] == 0 )
-        path = ".";
-
-    if ( self -> read_only )
-        return RC ( rcFS, rcDirectory, rcVisiting, rcDirectory, rcReadonly );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . visit_update )
-            ( self, recurse, f, data, path, args );
-    }
-
-    return RC ( rcFS, rcDirectory, rcVisiting, rcInterface, rcBadVersion );
-}
-
-/* PathType
- *  returns a KPathType
- *
- *  "path" [ IN ] - NUL terminated string in directory-native character set
- */
-LIB_EXPORT uint32_t CC KDirectoryPathType ( const KDirectory *self, const char *path, ... )
-{
-    uint32_t type;
-    va_list args;
-
-    va_start ( args, path );
-    type = KDirectoryVPathType ( self, path, args );
-    va_end ( args );
-
-    return type;
-}
-
-LIB_EXPORT uint32_t CC KDirectoryVPathType ( const KDirectory *self, const char *path, va_list args )
-{
-    if ( self == NULL || path == NULL || path [ 0 ] == 0 )
-        return kptBadPath;
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . path_type ) ( self, path, args );
-    }
-
-    return kptBadPath;
-}
-
-/* ResolvePath
- *  resolves path to an absolute or directory-relative path
- *
- *  "absolute" [ IN ] - if non-zero, always give a path starting
- *  with '/'. NB - if the directory is chroot'd, the absolute path
- *  will still be relative to directory root.
- *
- *  "resolved" [ OUT ] and "rsize" [ IN ] - buffer for
- *  NUL terminated result path in directory-native character set
- *  the resolved path will be directory relative
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target path. NB - need not exist.
- */
-LIB_EXPORT rc_t CC KDirectoryResolvePath ( const KDirectory *self, bool absolute,
-    char *resolved, size_t rsize, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDirectoryVResolvePath ( self, absolute,
-        resolved, rsize, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDirectoryVResolvePath ( const KDirectory *self, bool absolute,
-    char *resolved, size_t rsize, const char *path, va_list args )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcDirectory, rcResolving, rcSelf, rcNull );
-
-    /* allow NULL buffers of 0 size */
-    if ( resolved == NULL && rsize != 0 )
-        return RC ( rcFS, rcDirectory, rcResolving, rcBuffer, rcNull );
-
-    if ( path == NULL )
-        return RC ( rcFS, rcDirectory, rcResolving, rcPath, rcNull );
-    if ( path [ 0 ] == 0 )
-        return RC ( rcFS, rcDirectory, rcResolving, rcPath, rcInvalid );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . resolve_path )
-            ( self, absolute, resolved, rsize, path, args );
-    }
-
-    return RC ( rcFS, rcDirectory, rcResolving, rcInterface, rcBadVersion );
-}
-
-/* ResolveAlias
- *  resolves an alias path to its immediate target
- *  NB - the resolved path may be yet another alias
- *
- *  "absolute" [ IN ] - if non-zero, always give a path starting
- *  with '/'. NB - if the directory is chroot'd, the absolute path
- *  will still be relative to directory root.
- *
- *  "resolved" [ OUT ] and "rsize" [ IN ] - buffer for
- *  NUL terminated result path in directory-native character set
- *  the resolved path will be directory relative
- *
- *  "alias" [ IN ] - NUL terminated string in directory-native
- *  character set denoting an object presumed to be an alias.
- */
-LIB_EXPORT rc_t CC KDirectoryResolveAlias ( const KDirectory *self, bool absolute,
-    char *resolved, size_t rsize, const char *alias, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, alias );
-    rc = KDirectoryVResolveAlias ( self, absolute,
-        resolved, rsize, alias, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDirectoryVResolveAlias ( const KDirectory *self, bool absolute,
-    char *resolved, size_t rsize, const char *alias, va_list args )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcDirectory, rcResolving, rcSelf, rcNull );
-
-    /* allow NULL buffers of 0 size */
-    if ( resolved == NULL && rsize != 0 )
-        return RC ( rcFS, rcDirectory, rcResolving, rcBuffer, rcNull );
-
-    if ( alias == NULL )
-        return RC ( rcFS, rcDirectory, rcResolving, rcPath, rcNull );
-    if ( alias [ 0 ] == 0 )
-        return RC ( rcFS, rcDirectory, rcResolving, rcPath, rcInvalid );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . resolve_alias )
-            ( self, absolute, resolved, rsize, alias, args );
-    }
-
-    return RC ( rcFS, rcDirectory, rcResolving, rcInterface, rcBadVersion );
-}
-
-/* Rename
- *  rename an object accessible from directory, replacing
- *  any existing target object of the same type
- *
- *  "from" [ IN ] - NUL terminated string in directory-native
- *  character set denoting existing object
- *
- *  "to" [ IN ] - NUL terminated string in directory-native
- *  character set denoting existing object
- */
-LIB_EXPORT rc_t CC KDirectoryRename ( KDirectory *self, bool force, const char *from, const char *to )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcDirectory, rcRenaming, rcSelf, rcNull );
-
-    if ( from == NULL || to == NULL )
-        return RC ( rcFS, rcDirectory, rcRenaming, rcPath, rcNull );
-    if ( from [ 0 ] == 0 || to [ 0 ] == 0 )
-        return RC ( rcFS, rcDirectory, rcRenaming, rcPath, rcInvalid );
-
-    if ( self -> read_only )
-        return RC ( rcFS, rcDirectory, rcRenaming, rcDirectory, rcReadonly );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . rename ) ( self, force, from, to );
-    }
-
-    return RC ( rcFS, rcDirectory, rcRenaming, rcInterface, rcBadVersion );
-}
-
-/* Remove
- *  remove an accessible object from its directory
- *
- *  "force" [ IN ] - if non-zero and target is a directory,
- *  remove recursively
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- */
-LIB_EXPORT rc_t CC KDirectoryRemove ( KDirectory *self, bool force, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDirectoryVRemove ( self, force, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDirectoryVRemove ( KDirectory *self, bool force, const char *path, va_list args )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcDirectory, rcRemoving, rcSelf, rcNull );
-
-    if ( path == NULL )
-        return RC ( rcFS, rcDirectory, rcRemoving, rcPath, rcNull );
-    if ( path [ 0 ] == 0 )
-        return RC ( rcFS, rcDirectory, rcRemoving, rcPath, rcInvalid );
-
-    if ( self -> read_only )
-        return RC ( rcFS, rcDirectory, rcRemoving, rcDirectory, rcReadonly );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . remove ) ( self, force, path, args );
-    }
-
-    return RC ( rcFS, rcDirectory, rcRemoving, rcInterface, rcBadVersion );
-}
-
-/* ClearDir
- *  remove all directory contents
- *
- *  "force" [ IN ] - if non-zero and directory entry is a
- *  sub-directory, remove recursively
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target directory
- */
-LIB_EXPORT rc_t CC KDirectoryClearDir ( KDirectory *self, bool force, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDirectoryVClearDir ( self, force, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDirectoryVClearDir ( KDirectory *self, bool force, const char *path, va_list args )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcDirectory, rcRemoving, rcSelf, rcNull );
-
-    if ( path == NULL )
-        return RC ( rcFS, rcDirectory, rcRemoving, rcPath, rcNull );
-    if ( path [ 0 ] == 0 )
-        return RC ( rcFS, rcDirectory, rcRemoving, rcPath, rcInvalid );
-
-    if ( self -> read_only )
-        return RC ( rcFS, rcDirectory, rcRemoving, rcDirectory, rcReadonly );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . clear_dir ) ( self, force, path, args );
-    }
-
-    return RC ( rcFS, rcDirectory, rcRemoving, rcInterface, rcBadVersion );
-}
-
-/* Access
- *  get access to object
- *
- *  "access" [ OUT ] - return parameter for Unix access mode
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- */
-LIB_EXPORT rc_t CC KDirectoryAccess ( const KDirectory *self,
-    uint32_t *access, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDirectoryVAccess ( self, access, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDirectoryVAccess ( const KDirectory *self,
-    uint32_t *access, const char *path, va_list args )
-{
-    if ( access == NULL )
-        return RC ( rcFS, rcDirectory, rcAccessing, rcParam, rcNull );
-
-    * access = 0;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcDirectory, rcAccessing, rcSelf, rcNull );
-
-    if ( path == NULL )
-        return RC ( rcFS, rcDirectory, rcAccessing, rcPath, rcNull );
-    if ( path [ 0 ] == 0 )
-        return RC ( rcFS, rcDirectory, rcAccessing, rcPath, rcInvalid );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . access ) ( self, access, path, args );
-    }
-
-    return RC ( rcFS, rcDirectory, rcAccessing, rcInterface, rcBadVersion );
-}
-
-/* SetAccess
- *  set access to object a la Unix "chmod"
- *
- *  "recurse" [ IN ] - if non zero and "path" is a directory,
- *  apply changes recursively.
- *
- *  "access" [ IN ] and "mask" [ IN ] - definition of change
- *  where "access" contains new bit values and "mask defines
- *  which bits should be changed.
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- */
-LIB_EXPORT rc_t CC KDirectorySetAccess ( KDirectory *self, bool recurse,
-    uint32_t access, uint32_t mask, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDirectoryVSetAccess ( self, recurse,
-        access, mask, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDirectoryVSetAccess ( KDirectory *self, bool recurse,
-    uint32_t access, uint32_t mask, const char *path, va_list args )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcDirectory, rcUpdating, rcSelf, rcNull );
-
-    if ( path == NULL )
-        return RC ( rcFS, rcDirectory, rcUpdating, rcPath, rcNull );
-    if ( path [ 0 ] == 0 )
-        return RC ( rcFS, rcDirectory, rcUpdating, rcPath, rcInvalid );
-
-    if ( self -> read_only )
-        return RC ( rcFS, rcDirectory, rcUpdating, rcDirectory, rcReadonly );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        /* TBD - perhaps limit bits to lower 9 */
-        return ( * self -> vt -> v1 . set_access )
-            ( self, recurse, access, mask, path, args );
-    }
-
-    return RC ( rcFS, rcDirectory, rcUpdating, rcInterface, rcBadVersion );
-}
-
-/* Date
- *  get date/time to object
- *
- *  "date" [ OUT ] - return parameter
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- */
-LIB_EXPORT rc_t CC KDirectoryDate ( const KDirectory *self,
-    KTime_t *date, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDirectoryVDate ( self, date, path, args );
-    va_end ( args );
-
-    return rc;
-}
-LIB_EXPORT rc_t CC KDirectoryVDate ( const KDirectory *self,
-    KTime_t *date, const char *path, va_list args )
-{
-    if ( date == NULL )
-        return RC ( rcFS, rcDirectory, rcAccessing, rcParam, rcNull );
-
-    * date = 0;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcDirectory, rcAccessing, rcSelf, rcNull );
-
-    if ( path == NULL )
-        return RC ( rcFS, rcDirectory, rcAccessing, rcPath, rcNull );
-    if ( path [ 0 ] == 0 )
-        return RC ( rcFS, rcDirectory, rcAccessing, rcPath, rcInvalid );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        if ( self -> vt -> v1 . min >= 1 )
-            return ( * self -> vt -> v1 . date ) ( self, date, path, args );
-        break;
-    }
-
-    return RC ( rcFS, rcDirectory, rcAccessing, rcInterface, rcBadVersion );
-}
-
-
-/* SetDate
- *  set date to object
- *
- *  "recurse" [ IN ] - if non zero and "path" is a directory,
- *  apply changes recursively.
- *
- *  "date" [ IN ] - new time and date for the object
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- */
-LIB_EXPORT rc_t CC KDirectorySetDate ( KDirectory *self, bool recurse,
-    KTime_t date, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDirectoryVSetDate ( self, recurse,
-			      date, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDirectoryVSetDate ( KDirectory *self, bool recurse,
-    KTime_t date, const char *path, va_list args )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcDirectory, rcUpdating, rcSelf, rcNull );
-
-    if ( path == NULL )
-        return RC ( rcFS, rcDirectory, rcUpdating, rcPath, rcNull );
-    if ( path [ 0 ] == 0 )
-        return RC ( rcFS, rcDirectory, rcUpdating, rcPath, rcInvalid );
-
-    if ( self -> read_only )
-        return RC ( rcFS, rcDirectory, rcUpdating, rcDirectory, rcReadonly );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        /* TBD - perhaps limit bits to lower 9 */
-        if ( self -> vt -> v1 . min >= 1 )
-            return ( * self -> vt -> v1 . setdate ) ( self, recurse, date, path, args );
-        break;
-    }
-
-    return RC ( rcFS, rcDirectory, rcUpdating, rcInterface, rcBadVersion );
-}
-
-
-/* CreateAlias
- *  creates a path alias according to create mode
- *
- *  "access" [ IN ] - standard Unix directory access mode
- *  used when "mode" has kcmParents set and alias path does
- *  not exist.
- *
- *  "mode" [ IN ] - a creation mode ( see explanation above ).
- *
- *  "targ" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- *
- *  "alias" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target alias
- */
-LIB_EXPORT rc_t CC KDirectoryCreateAlias ( KDirectory *self,
-    uint32_t access, KCreateMode mode,
-    const char *targ, const char *alias )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcDirectory, rcUpdating, rcSelf, rcNull );
-
-    if ( targ == NULL || alias == NULL )
-        return RC ( rcFS, rcDirectory, rcCreating, rcPath, rcNull );
-    if ( targ [ 0 ] == 0 || alias [ 0 ] == 0 )
-        return RC ( rcFS, rcDirectory, rcCreating, rcPath, rcInvalid );
-
-    if ( self -> read_only )
-        return RC ( rcFS, rcDirectory, rcUpdating, rcDirectory, rcReadonly );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . create_alias )
-            ( self, access, mode, targ, alias );
-    }
-
-    return RC ( rcFS, rcDirectory, rcUpdating, rcInterface, rcBadVersion );
-}
-
-/* OpenFileRead
- *  opens an existing file with read-only access
- *
- *  "f" [ OUT ] - return parameter for newly opened file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- */
-LIB_EXPORT rc_t CC KDirectoryOpenFileRead ( const KDirectory *self,
-    struct KFile const **f, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDirectoryVOpenFileRead ( self, f, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDirectoryVOpenFileRead ( const KDirectory *self,
-    struct KFile const **f, const char *path, va_list args )
-{
-    if ( f == NULL )
-        return RC ( rcFS, rcDirectory, rcOpening, rcFile, rcNull );
-
-    * f = NULL;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcDirectory, rcOpening, rcSelf, rcNull );
-
-    if ( path == NULL )
-        return RC ( rcFS, rcDirectory, rcOpening, rcPath, rcNull );
-    if ( path [ 0 ] == 0 )
-        return RC ( rcFS, rcDirectory, rcOpening, rcPath, rcInvalid );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . open_file_read ) ( self, f, path, args );
-    }
-
-    return RC ( rcFS, rcDirectory, rcOpening, rcInterface, rcBadVersion );
-}
-
-/* OpenFileWrite
- *  opens an existing file with write access
- *
- *  "f" [ OUT ] - return parameter for newly opened file
- *
- *  "update" [ IN ] - if non-zero, open in read/write mode
- *  otherwise, open in write-only mode
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- */
-LIB_EXPORT rc_t CC KDirectoryOpenFileWrite ( KDirectory *self,
-    struct KFile **f, bool update, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDirectoryVOpenFileWrite ( self, f, update, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDirectoryVOpenFileWrite ( KDirectory *self,
-    struct KFile **f, bool update, const char *path, va_list args )
-{
-    if ( f == NULL )
-        return RC ( rcFS, rcDirectory, rcOpening, rcFile, rcNull );
-
-    * f = NULL;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcDirectory, rcOpening, rcSelf, rcNull );
-
-    if ( path == NULL )
-        return RC ( rcFS, rcDirectory, rcOpening, rcPath, rcNull );
-    if ( path [ 0 ] == 0 )
-        return RC ( rcFS, rcDirectory, rcOpening, rcPath, rcInvalid );
-
-
-    if ( self -> read_only )
-        return RC ( rcFS, rcDirectory, rcOpening, rcDirectory, rcReadonly );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . open_file_write )
-            ( self, f, update, path, args );
-    }
-
-    return RC ( rcFS, rcDirectory, rcOpening, rcInterface, rcBadVersion );
-}
-
-/* CreateFile
- *  opens a file with write access
- *
- *  "f" [ OUT ] - return parameter for newly opened file
- *
- *  "update" [ IN ] - if non-zero, open in read/write mode
- *  otherwise, open in write-only mode
- *
- *  "access" [ IN ] - standard Unix access mode, e.g. 0664
- *
- *  "mode" [ IN ] - a creation mode ( see explanation above ).
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- */
-LIB_EXPORT rc_t CC KDirectoryCreateFile ( KDirectory *self, struct KFile **f,
-    bool update, uint32_t access, KCreateMode mode, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDirectoryVCreateFile ( self, f, update,
-        access, mode, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDirectoryVCreateFile ( KDirectory *self, struct KFile **f,
-    bool update, uint32_t access, KCreateMode mode, const char *path, va_list args )
-{
-    if ( f == NULL )
-        return RC ( rcFS, rcDirectory, rcCreating, rcFile, rcNull );
-
-    * f = NULL;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcDirectory, rcCreating, rcSelf, rcNull );
-
-    if ( path == NULL )
-        return RC ( rcFS, rcDirectory, rcCreating, rcPath, rcNull );
-    if ( path [ 0 ] == 0 )
-        return RC ( rcFS, rcDirectory, rcCreating, rcPath, rcInvalid );
-
-
-    if ( self -> read_only )
-        return RC ( rcFS, rcDirectory, rcCreating, rcDirectory, rcReadonly );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . create_file )
-            ( self, f, update, access, mode, path, args );
-    }
-
-    return RC ( rcFS, rcDirectory, rcCreating, rcInterface, rcBadVersion );
-}
-
-/* FileLocator
- *  returns locator in bytes of target file
- *
- *  "locator" [ OUT ] - return parameter for file locator
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- */
-LIB_EXPORT rc_t CC KDirectoryFileLocator ( const KDirectory *self,
-    uint64_t *locator, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDirectoryVFileLocator ( self, locator, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDirectoryVFileLocator ( const KDirectory *self,
-    uint64_t *locator, const char *path, va_list args )
-{
-    if ( locator == NULL )
-        return RC ( rcFS, rcDirectory, rcAccessing, rcParam, rcNull );
-
-    * locator = 0;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcDirectory, rcAccessing, rcSelf, rcNull );
-    if ( path == NULL )
-        return RC ( rcFS, rcDirectory, rcAccessing, rcPath, rcNull );
-    if ( path [ 0 ] == 0 )
-        return RC ( rcFS, rcDirectory, rcAccessing, rcPath, rcInvalid );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        if ( self -> vt -> v1 . min >= 2 )
-            return ( * self -> vt -> v1 . file_locator ) ( self, locator, path, args );
-        break;
-    }
-
-    return RC ( rcFS, rcDirectory, rcAccessing, rcInterface, rcBadVersion );
-}
-
-/* FileSize
- *  returns size in bytes of target file
- *
- *  "size" [ OUT ] - return parameter for file size
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- */
-LIB_EXPORT rc_t CC KDirectoryFileSize ( const KDirectory *self,
-    uint64_t *size, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDirectoryVFileSize ( self, size, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDirectoryVFileSize ( const KDirectory *self,
-    uint64_t *size, const char *path, va_list args )
-{
-    if ( size == NULL )
-        return RC ( rcFS, rcDirectory, rcAccessing, rcParam, rcNull );
-
-    * size = 0;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcDirectory, rcAccessing, rcSelf, rcNull );
-    if ( path == NULL )
-        return RC ( rcFS, rcDirectory, rcAccessing, rcPath, rcNull );
-    if ( path [ 0 ] == 0 )
-        return RC ( rcFS, rcDirectory, rcAccessing, rcPath, rcInvalid );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . file_size ) ( self, size, path, args );
-    }
-
-    return RC ( rcFS, rcDirectory, rcAccessing, rcInterface, rcBadVersion );
-}
-
-/* FilePhysicalSize
- *  returns size in bytes of target file
- *
- *  "size" [ OUT ] - return parameter for file size
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- */
-LIB_EXPORT rc_t CC KDirectoryFilePhysicalSize ( const KDirectory *self,
-    uint64_t *size, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDirectoryVFilePhysicalSize ( self, size, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDirectoryVFilePhysicalSize ( const KDirectory *self,
-    uint64_t *size, const char *path, va_list args )
-{
-    if ( size == NULL )
-        return RC ( rcFS, rcDirectory, rcAccessing, rcParam, rcNull );
-
-    * size = 0;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcDirectory, rcAccessing, rcSelf, rcNull );
-    if ( path == NULL )
-        return RC ( rcFS, rcDirectory, rcAccessing, rcPath, rcNull );
-    if ( path [ 0 ] == 0 )
-        return RC ( rcFS, rcDirectory, rcAccessing, rcPath, rcInvalid );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        if ( self -> vt -> v1 . min >= 3 )
-            return ( * self -> vt -> v1 . file_phys_size ) ( self, size, path, args );
-        break;
-    }
-
-    return RC ( rcFS, rcDirectory, rcAccessing, rcInterface, rcBadVersion );
-}
-
-/* SetFileSize
- *  sets size in bytes of target file
- *
- *  "size" [ IN ] - new file size
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- */
-LIB_EXPORT rc_t CC KDirectorySetFileSize ( KDirectory *self,
-    uint64_t size, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDirectoryVSetFileSize ( self, size, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDirectoryVSetFileSize ( KDirectory *self,
-    uint64_t size, const char *path, va_list args )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcDirectory, rcUpdating, rcSelf, rcNull );
-
-    if ( path == NULL )
-        return RC ( rcFS, rcDirectory, rcUpdating, rcPath, rcNull );
-    if ( path [ 0 ] == 0 )
-        return RC ( rcFS, rcDirectory, rcUpdating, rcPath, rcInvalid );
-
-    if ( self -> read_only )
-        return RC ( rcFS, rcDirectory, rcUpdating, rcDirectory, rcReadonly );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . set_size ) ( self, size, path, args );
-    }
-
-    return RC ( rcFS, rcDirectory, rcAccessing, rcInterface, rcBadVersion );
-}
-
-/* FileContiguous
- *  returns true if the file is "contiguous".  Chunked or sparse files are not
- *  contiguous while most data files are.  Virtual generated files would likely
- *  not be contiguous.  
- *
- *  "contiguous" [ OUT ] - return parameter for file contiguous
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- */
-LIB_EXPORT rc_t CC KDirectoryFileContiguous ( const KDirectory *self,
-    bool *contiguous, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDirectoryVFileContiguous ( self, contiguous, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDirectoryVFileContiguous ( const KDirectory *self,
-    bool *contiguous, const char *path, va_list args )
-{
-    if ( contiguous == NULL )
-        return RC ( rcFS, rcDirectory, rcAccessing, rcParam, rcNull );
-
-    * contiguous = 0;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcDirectory, rcAccessing, rcSelf, rcNull );
-    if ( path == NULL )
-        return RC ( rcFS, rcDirectory, rcAccessing, rcPath, rcNull );
-    if ( path [ 0 ] == 0 )
-        return RC ( rcFS, rcDirectory, rcAccessing, rcPath, rcInvalid );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        if ( self -> vt -> v1 . min >= 3 )
-            return ( * self -> vt -> v1 . file_contiguous ) ( self, contiguous, path, args );
-        break;
-    }
-
-    return RC ( rcFS, rcDirectory, rcAccessing, rcInterface, rcBadVersion );
-}
-
-/* OpenDirRead
- * KDirectoryOpenDirUpdate
- *  opens a sub-directory
- *
- *  "chroot" [ IN ] - if non-zero, the new directory becomes
- *  chroot'd and will interpret paths beginning with '/'
- *  relative to itself.
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target directory
- */
-LIB_EXPORT rc_t CC KDirectoryOpenDirRead ( const KDirectory *self,
-    const KDirectory **sub, bool chroot, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDirectoryVOpenDirRead ( self, sub, chroot, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDirectoryVOpenDirRead ( const KDirectory *self,
-    const KDirectory **sub, bool chroot, const char *path, va_list args )
-{
-    if ( sub == NULL )
-        return RC ( rcFS, rcDirectory, rcOpening, rcDirectory, rcNull );
-
-    * sub = NULL;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcDirectory, rcOpening, rcSelf, rcNull );
-
-    if ( path == NULL || path [ 0 ] == 0 )
-        path = ".";
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . open_dir_read )
-            ( self, sub, chroot, path, args );
-    }
-
-    return RC ( rcFS, rcDirectory, rcOpening, rcInterface, rcBadVersion );
-}
-
-LIB_EXPORT rc_t CC KDirectoryOpenDirUpdate ( KDirectory *self,
-    KDirectory **sub, bool chroot, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDirectoryVOpenDirUpdate ( self, sub, chroot, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDirectoryVOpenDirUpdate ( KDirectory *self,
-    KDirectory **sub, bool chroot, const char *path, va_list args )
-{
-    if ( sub == NULL )
-        return RC ( rcFS, rcDirectory, rcOpening, rcDirectory, rcNull );
-
-    * sub = NULL;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcDirectory, rcOpening, rcSelf, rcNull );
-
-    if ( self -> read_only )
-        return RC ( rcFS, rcDirectory, rcOpening, rcDirectory, rcReadonly );
-
-    if ( path == NULL || path [ 0 ] == 0 )
-        path = ".";
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . open_dir_update )
-            ( self, sub, chroot, path, args );
-    }
-
-    return RC ( rcFS, rcDirectory, rcOpening, rcInterface, rcBadVersion );
-}
-
-/* CreateDir
- *  create a sub-directory
- *
- *  "access" [ IN ] - standard Unix directory mode, e.g.0775
- *
- *  "mode" [ IN ] - a creation mode ( see explanation above ).
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target directory
- */
-LIB_EXPORT rc_t CC KDirectoryCreateDir ( KDirectory *self,
-    uint32_t access, KCreateMode mode, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDirectoryVCreateDir ( self, access, mode, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDirectoryVCreateDir ( KDirectory *self,
-    uint32_t access, KCreateMode mode, const char *path, va_list args )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcDirectory, rcCreating, rcSelf, rcNull );
-
-    if ( path == NULL )
-        return RC ( rcFS, rcDirectory, rcCreating, rcPath, rcNull );
-    if ( path [ 0 ] == 0 )
-        return RC ( rcFS, rcDirectory, rcCreating, rcPath, rcInvalid );
-
-    if ( self -> read_only )
-        return RC ( rcFS, rcDirectory, rcCreating, rcDirectory, rcReadonly );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . create_dir ) ( self, access, mode, path, args );
-    }
-
-    return RC ( rcFS, rcDirectory, rcCreating, rcInterface, rcBadVersion );
-}
-
-/* Init
- *  initialize a newly allocated directory object
- */
-LIB_EXPORT rc_t CC KDirectoryInit ( KDirectory *self, const KDirectory_vt *vt,
-    const char * class_name, const char * path, bool update )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcDirectory, rcConstructing, rcSelf, rcNull );
-    if ( vt == NULL )
-        return RC ( rcFS, rcDirectory, rcConstructing, rcInterface, rcNull );
-    switch ( vt -> v1 . maj )
-    {
-    case 0:
-        return RC ( rcFS, rcDirectory, rcConstructing, rcInterface, rcInvalid );
-    case 1:
-        switch ( vt -> v1 . min )
-        {
-            /* ADD NEW MINOR VERSION CASES HERE */
-        case 3:
-#if _DEBUGGING
-            if ( vt -> v1 . file_phys_size == NULL )
-                return RC ( rcFS, rcFile, rcConstructing, rcInterface, rcNull );
-#endif
-            /* no break */
-        case 2:
-#if _DEBUGGING
-            if ( vt -> v1 . file_locator == NULL )
-                return RC ( rcFS, rcFile, rcConstructing, rcInterface, rcNull );
-#endif
-            /* no break */
-        case 1:
-#if _DEBUGGING
-            if ( vt -> v1 . get_sysdir == NULL      ||
-                 vt -> v1 . setdate == NULL         ||
-                 vt -> v1 . date == NULL )
-                return RC ( rcFS, rcFile, rcConstructing, rcInterface, rcNull );
-#endif
-            /* no break */
-        case 0:
-#if _DEBUGGING
-            /* vt -> v1 . destroy_file CAN be NULL */
-            if ( vt -> v1 . create_dir == NULL      ||
-                 vt -> v1 . open_dir_update == NULL ||
-                 vt -> v1 . open_dir_read == NULL   ||
-                 vt -> v1 . set_size == NULL        ||
-                 vt -> v1 . file_size == NULL       ||
-                 vt -> v1 . create_file == NULL     ||
-                 vt -> v1 . open_file_write == NULL ||
-                 vt -> v1 . open_file_read == NULL  ||
-                 vt -> v1 . create_alias == NULL    ||
-                 vt -> v1 . set_access == NULL      ||
-                 vt -> v1 . access == NULL          ||
-                 vt -> v1 . clear_dir == NULL       ||
-                 vt -> v1 . remove == NULL          ||
-                 vt -> v1 . rename == NULL          ||
-                 vt -> v1 . resolve_alias == NULL   ||
-                 vt -> v1 . resolve_path == NULL    ||
-                 vt -> v1 . path_type == NULL       ||
-                 vt -> v1 . visit_update == NULL    ||
-                 vt -> v1 . visit == NULL           ||
-                 vt -> v1 . list_dir == NULL        ||
-                 vt -> v1 . destroy == NULL )
-                return RC ( rcFS, rcFile, rcConstructing, rcInterface, rcNull );
-#endif
-            break;
-        default:
-            return RC ( rcFS, rcDirectory, rcConstructing, rcInterface, rcBadVersion );
-        }
-        break;
-    default:
-        return RC ( rcFS, rcDirectory, rcConstructing, rcInterface, rcBadVersion );
-    }
-
-    self -> vt = vt;
-    self -> read_only = ( uint8_t ) ( update == 0 );
-
-
-    KRefcountInit ( &self->refcount, 1, class_name, "init", path );
-
-    return 0;
-}
-
-/* DestroyFile
- *  does whatever is necessary with an unreferenced file
- */
-LIB_EXPORT rc_t CC KDirectoryDestroyFile ( const KDirectory *self, KFile *f )
-{
-    const KDirectory_vt *vt = self -> vt;
-    switch ( vt -> v1 . maj )
-    {
-    case 1:
-        if ( vt -> v1 . destroy_file != NULL )
-            return ( * vt -> v1 . destroy_file ) ( ( KDirectory* ) self, f );
-        return KFileDestroy ( f );
-    }
-
-    return RC ( rcFS, rcDirectory, rcDestroying, rcInterface, rcBadVersion );
-}
-
-/* GetSysDir
- *  returns an underlying system file object
- */
-LIB_EXPORT struct KSysDir* CC KDirectoryGetSysDir ( const KDirectory *self )
-{
-    if ( self != NULL )
-    {
-        switch ( self -> vt -> v1 . maj )
-        {
-        case 1:
-            if ( self -> vt -> v1 . min > 0 )
-                return ( * self -> vt -> v1 . get_sysdir ) ( self );
-            break;
-        }
-    }
-    return NULL;
-}
-
-
-static rc_t copy_loop( const KFile *src, KFile *dst, size_t bsize )
-{
-    rc_t rc = 0;
-    uint64_t pos = 0;
-    size_t num_read = 1;
-
-    char * buffer = malloc( bsize );
-    if ( buffer == NULL )
-        return RC( rcFS, rcDirectory, rcCopying, rcMemory, rcExhausted );
-
-    while ( rc == 0 && num_read > 0 )
-    {
-        rc = KFileRead ( src, pos, buffer, bsize, &num_read );
-        if ( rc == 0 && num_read > 0 )
-        {
-            size_t num_writ;
-            rc = KFileWrite ( dst, pos, buffer, num_read, &num_writ );
-            pos += num_read;
-        }
-    }
-    free( buffer );
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC KDirectoryCopyPath ( const KDirectory *src_dir,
-    KDirectory *dst_dir, const char *src_path, const char * dst_path )
-{
-    rc_t rc;
-    struct KFile const *f_src;
-
-    if ( src_dir == NULL || dst_dir == NULL )
-        return RC ( rcFS, rcDirectory, rcCopying, rcSelf, rcNull );
-    if ( src_path == NULL || dst_path == NULL )
-        return RC ( rcFS, rcDirectory, rcCopying, rcParam, rcNull );
-
-    rc = KDirectoryOpenFileRead ( src_dir, &f_src, "%s", src_path );
-    if ( rc == 0 )
-    {
-        uint32_t pt = KDirectoryPathType ( dst_dir, "%s", dst_path );
-        switch( pt )
-        {
-            case kptFile : ; /* intentional fall through! */
-            case kptDir  : rc = KDirectoryRemove ( dst_dir, true, "%s", dst_path ); break;
-        }
-        if ( rc == 0 )
-        {
-            struct KFile *f_dst;
-            uint32_t access = 0664;
-            rc = KDirectoryCreateFile ( dst_dir, &f_dst, false, access, kcmCreate, "%s", dst_path );
-            if ( rc == 0 )
-            {
-                rc = copy_loop( f_src, f_dst, 1024 * 16 );
-            }
-        }
-    }
-    return rc;
-}
-
-
-static rc_t build_obj_path( char **s, const char *path, const char * objname )
-{
-    rc_t rc;
-    size_t lp = string_size( path );
-    size_t l = lp + string_size( objname ) + 2;
-    *s = malloc( l );
-    if ( *s == NULL )
-        rc = RC( rcFS, rcDirectory, rcCopying, rcMemory, rcExhausted );
-    else
-    {
-        size_t written;
-        const char * concat = ( ( path[ lp - 1 ] == '/' ) ? "%s%s" : "%s/%s" );
-        rc = string_printf( *s, l, &written, concat, path, objname );
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC KDirectoryCopyPaths( const KDirectory * src_dir,
-    KDirectory * dst_dir, bool recursive, const char *src, const char *dst )
-{
-    rc_t rc;
-    struct KNamelist *list;
-
-    if ( src_dir == NULL || dst_dir == NULL )
-        return RC ( rcFS, rcDirectory, rcCopying, rcSelf, rcNull );
-    if ( src == NULL || dst == NULL )
-        return RC ( rcFS, rcDirectory, rcCopying, rcParam, rcNull );
-
-    rc = KDirectoryList ( src_dir, &list, NULL, NULL, "%s", src );
-    if ( rc == 0 )
-    {
-        uint32_t pt = KDirectoryPathType ( dst_dir, "%s", dst );
-        /* if the output-directory does not exist: create it! */
-        switch( pt )
-        {
-            case kptFile : rc = KDirectoryRemove ( dst_dir, true, "%s", dst );
-                            /* intentially no break ! */
-
-            case kptNotFound : if ( rc == 0 )
-                                    rc = KDirectoryCreateDir ( dst_dir, 0775, kcmCreate | kcmParents, "%s", dst );
-                               break;
-        }
-        if ( rc == 0 )
-        {
-            uint32_t i, n;
-            rc = KNamelistCount ( list, &n );
-            for ( i = 0; i < n && rc == 0; ++i )
-            {
-                const char *name;
-                rc = KNamelistGet ( list, i, &name );
-                if ( rc == 0 )
-                {
-                    char *src_obj;
-                    rc = build_obj_path( &src_obj, src, name );
-                    if ( rc == 0 )
-                    {
-                        char *dst_obj;
-                        rc = build_obj_path( &dst_obj, dst, name );
-                        if ( rc == 0 )
-                        {
-                            pt = KDirectoryPathType ( src_dir, "%s", src_obj );
-                            switch( pt )
-                            {
-                                case kptFile : rc = KDirectoryCopyPath ( src_dir, dst_dir, src_obj, dst_obj );
-                                               break;
-
-                                case kptDir  : if ( recursive )
-                                                    rc = KDirectoryCopyPaths( src_dir, dst_dir, true, src_obj, dst_obj );
-                                               break;
-                            }
-                            free( dst_obj );
-                        }
-                        free( src_obj );
-                    }
-                }
-            }
-        }
-        KNamelistRelease ( list );
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC KDirectoryCopy( const KDirectory * src_dir,
-    KDirectory * dst_dir, bool recursive, const char *src, const char *dst )
-{
-    rc_t rc = 0;
-    uint32_t pt;
-
-    if ( src_dir == NULL || dst_dir == NULL )
-        return RC ( rcFS, rcDirectory, rcCopying, rcSelf, rcNull );
-    if ( src == NULL || dst == NULL )
-        return RC ( rcFS, rcDirectory, rcCopying, rcParam, rcNull );
-
-    pt = KDirectoryPathType ( src_dir, "%s", src );
-    switch( pt )
-    {
-        case kptFile : rc = KDirectoryCopyPath ( src_dir, dst_dir, src, dst );
-                        break;
-        case kptDir  : rc = KDirectoryCopyPaths ( src_dir, dst_dir, recursive, src, dst );
-                        break;
-    }
-    return rc;
-}
diff --git a/libs/kfs/ffext.c b/libs/kfs/ffext.c
deleted file mode 100644
index 390fa28..0000000
--- a/libs/kfs/ffext.c
+++ /dev/null
@@ -1,805 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kfs/extern.h>
-#include <klib/rc.h>
-#include <kfs/file.h>
-#include <klib/text.h>
-#include <klib/log.h>
-#include <klib/container.h>
-#include <kfs/fileformat.h>
-#include "fileformat-priv.h"
-struct KExtFileFormat;
-#define KFILEFORMAT_IMPL struct KExtFileFormat
-#include "impl.h"
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdio.h>
-
-struct KDirectory;
-
-typedef
-struct KExtNode
-{
-    BSTNode		node;
-    atomic32_t 		refcount;
-    KFileFormatType	typeid;
-    size_t		kfflen;
-    size_t		extlen;
-    char *		extdescr;
-    char		kffdescr [1];
-} KExtNode;
-
-static
-rc_t KExtNodeDestroy (const KExtNode * cself)
-{
-    rc_t rc = 0;
-    KExtNode * self = (KExtNode*)cself;
-
-    FUNC_ENTRY();
-
-    if (self == NULL)
-    {
-	rc = RC (rcFF, rcIndex, rcDestroying, rcSelf, rcNull);
-	LOGERR (klogErr, rc, "KExtNodeDestroy: self == NULL");
-    }
-    else
-    {
-
-        /* memory leak?  do we need to release KFFTables? */
-
-
-	free (self);
-    }
-    return rc;
-}
-
-static
-rc_t KExtNodeRelease (const KExtNode * cself)
-{
-    rc_t rc = 0;
-    FUNC_ENTRY();
-
-    if (cself != NULL)
-    {
-	KFileFormat *self = (KFileFormat*)cself;
-        if (atomic32_dec_and_test (&self->refcount))
-	    return  KExtNodeDestroy (cself);
-    }
-    return rc;
-}
-/* not used at this time */
-#if 0
-static
-rc_t KExtNodeAddRef (const KExtNode * self)
-{
-    rc_t rc = 0;
-    FUNC_ENTRY();
-
-    if (self != NULL)
-        atomic32_inc (&((KFileFormat*)self)->refcount);
-    return rc;
-}
-#endif
-static
-rc_t KExtNodeMake (KExtNode ** kmmp, const KFFTables * tables,
-		     const char * extdescr, size_t extlen,
-		     const char * kffdescr, size_t kfflen)
-
-{
-    KExtNode * self;
-    rc_t rc = 0;
-
-    FUNC_ENTRY();
-
-
-    if (extdescr == NULL)
-    {
-	rc = RC (rcFF, rcIndex, rcConstructing, rcParam, rcNull);
-	LOGERR (klogErr, rc, "KExtNodeMake: extdescr == NULL");
-    }
-    else if (kffdescr == NULL)
-    {
-	rc = RC (rcFF, rcIndex, rcConstructing, rcParam, rcNull);
-	LOGERR (klogErr, rc, "KKffNodeMake: kffdescr == NULL");
-    }
-    else
-    {
-	if (extlen > DESCRLEN_MAX)
-	{
-	    rc = RC (rcFF, rcIndex, rcConstructing, rcParam, rcInvalid);
-	    LOGERR (klogErr, rc, "KExtNodeMake: extdescr too long");
-	}
-	else if (extlen == 0)
-	{
-	    rc = RC (rcFF, rcIndex, rcConstructing, rcParam, rcEmpty);
-	    LOGERR (klogErr, rc, "KExtNodeMake: extdescr too short");
-	}
-	else if (kfflen > DESCRLEN_MAX)
-	{
-	    rc = RC (rcFF, rcIndex, rcConstructing, rcParam, rcInvalid);
-	    LOGERR (klogErr, rc, "KKffNodeMake: kffdescr too long");
-	}
-	else if (kfflen == 0)
-	{
-	    rc = RC (rcFF, rcIndex, rcConstructing, rcParam, rcEmpty);
-	    LOGERR (klogErr, rc, "KKffNodeMake: kffdescr too short");
-	}
-	else
-	{
-	    KFileFormatType typeid;
-	    rc = KFFTablesGetTypeId (tables, kffdescr, &typeid, NULL);
-	    if (rc == 0)
-	    {
-		self = malloc (sizeof (*self) + extlen + kfflen + 1);
-		if (self == NULL)
-		{
-		    rc = RC (rcFF,  rcIndex, rcConstructing, rcMemory, rcExhausted);
-		    LOGERR (klogErr, rc, "KExtNodeMake: self could not be allocated");
-		}
-		else
-		{
-		    atomic32_set (&self->refcount,1);
-		    self->typeid = typeid;
-		    self->kfflen = kfflen;
-		    self->extlen = extlen;
-		    self->extdescr = self->kffdescr + kfflen + 1;
-		    memcpy (self->kffdescr, kffdescr, kfflen);
-		    memcpy (self->extdescr, extdescr, extlen);
-		    self->kffdescr[self->kfflen] = '\0';
-		    self->extdescr[self->extlen] = '\0';
-		    *kmmp = self;
-		    return 0;
-		}
-	    }
-	}
-    }
-    return rc;
-}
-
-
-/* -------------------------
- *
- */
-typedef
-struct KExtTable
-{
-    atomic32_t 	refcount;
-    BSTree	tree;
-} KExtTable;
-
-static
-void KExtNodeWhack (BSTNode * n, void * ignored)
-{
-    FUNC_ENTRY();
-
-    (void)KExtNodeRelease((KExtNode*)n);
-}
-static
-rc_t KExtTableDestroy (KExtTable * cself)
-{
-    rc_t rc;
-    KExtTable * self;
-
-    FUNC_ENTRY();
-
-    rc = 0;
-    self = (KExtTable*)cself;
-    if (self == NULL)
-    {
-	rc = RC (rcFF, rcTable, rcDestroying, rcSelf, rcNull);
-	LOGERR (klogErr, rc, "KExtTableDestroy: self == NULL");
-    }
-    else
-    {
-	BSTreeWhack (&self->tree, KExtNodeWhack, NULL);
-	free (self);
-    }
-    return rc;
-}
-static
-rc_t KExtTableRelease (const KExtTable * cself)
-{
-    rc_t rc = 0;
-    FUNC_ENTRY();
-
-    if (cself != NULL)
-    {
-	KExtTable *self = (KExtTable*)cself;
-        if (atomic32_dec_and_test (&self->refcount))
-	    return  KExtTableDestroy (self);
-    }
-    return rc;
-}
-#if 0
-static /* not used at this time */
-rc_t KExtTableAddRef (const KExtTable * self)
-{
-    rc_t rc = 0;
-    FUNC_ENTRY();
-
-    if (self != NULL)
-        atomic32_inc (& ((KFileFormat*) self)->refcount);
-    return rc;
-}
-#endif
-static
-rc_t KExtTableMake (KExtTable ** kmmtp)
-{
-    KExtTable * self;
-    rc_t rc = 0;
-
-    FUNC_ENTRY();
-
-    self = malloc (sizeof *self);
-    if (self == NULL)
-    {
-	rc = RC (rcFF, rcTable, rcConstructing, rcParam, rcNull);
-	LOGERR (klogErr, rc, "KExtTableMake: self could not be allocated");
-    }
-    else
-    {
-	BSTreeInit (&self->tree);
-	*kmmtp = self;
-    }
-    return rc;
-}
-
-static
-int KExtNodeCmp (const void* item, const BSTNode * n)
-{
-    size_t len;
-    KExtNode * mn = (KExtNode *)n;
-
-    FUNC_ENTRY();
-
-    /* -----
-     * we only check this many characters of the comparison item
-     * we need only this part to match and ignore characters after
-     * this in the comparison string
-     */
-    len = mn->extlen;
-    return strncmp (item, mn->extdescr, len);
-}
-
-static
-rc_t KExtTableFind (KExtTable * self, KExtNode ** node, const char * str)
-{
-    rc_t rc = 0;
-
-    FUNC_ENTRY();
-
-    *node = (KExtNode*)BSTreeFind (&self->tree, str, KExtNodeCmp);
-    if (*node == NULL)
-    {
-/* 	rc = RC (rcFF, rcTable, rcSearching, rcNode, rcNotFound); */
-        KFF_DEBUG (("%s: Could not find %s\n", __func__, str));
-    }
-    return rc;
-}
-/* maxlen includes the terminating NUL */
-#if 0 /* not in use at this time */
-static
-rc_t KExtTableFindKFFDescr (KExtTable * self, const char * str, char * kff, size_t maxlen)
-{
-    rc_t rc;
-    KExtNode * np;
-
-    FUNC_ENTRY();
-
-
-    if (self == NULL)
-    {
-	rc = RC (rcFF, rcFileFormat, rcSearching, rcSelf, rcNull);
-	LOGERR (klogErr, rc, "KExtTableFindKFFDecr:self == NULL");
-	return rc;
-    }
-    if (str == NULL)
-    {
-	rc = RC (rcFF, rcFileFormat, rcSearching, rcParam, rcNull);
-	LOGERR (klogErr, rc, "KExtTableFindKFFDecr: searchstring is NULL");
-	return rc;
-    }
-    if (kff == NULL)
-    {
-	rc = RC (rcFF, rcFileFormat, rcSearching, rcParam, rcNull);
-	LOGERR (klogErr, rc, "KExtTableFindKFFDecr: found storage is NULL");
-	return rc;
-    }
-    rc = KExtTableFind (self, &np, str);
-    if (maxlen <= np->kfflen) /* kfflen does not include NUL */
-    {
-	rc = RC (rcFF, rcFileFormat, rcSearching, rcParam, rcTooLong);
-	LOGERR (klogErr, rc, "KExtTableFindKFFDecr: found storage is NULL");
-	return rc;
-    }
-    memcpy (kff, np->kffdescr, np->kfflen);
-    kff[np->kfflen] = '\0';
-    return rc;
-}
-#endif
-static
-int KExtNodeSort (const BSTNode* item, const BSTNode * n)
-{
-    const char * str1;
-    const char * str2;
-
-    FUNC_ENTRY();
-
-    str1 = ((KExtNode *)item)->extdescr;
-    str2 = ((KExtNode *)n)->extdescr;
-    return strcmp (str1, str2);
-}
-static
-rc_t KExtTableInsert (KExtTable * self, KExtNode *node)
-{
-
-    FUNC_ENTRY();
-
-    return (BSTreeInsert (&self->tree, &node->node, KExtNodeSort));
-}
-/* not is use at this time */
-#if 0
-static
-rc_t KExtTableBufferRead (KExtTable * self, KFFTables * tables,
-			    const char * buff, size_t bufflen)
-{
-    rc_t rc = 0;
-    const char * kff;
-    const char * ext;
-    const char * nl;
-    size_t kfflen;
-    size_t extlen;
-
-
-    FUNC_ENTRY();
-
-
-    /* -----
-     * until we get all the way through the buffer
-     * which by this coding could actually be all blank
-     */
-    while (bufflen)
-    {
-	ext = buff;
-	/* -----
-	 * allow leading white space including blank lines
-	 */
-	if (isspace (*ext))	
-	{
-	    buff++;
-	    bufflen --;
-	    continue;
-	}
-	/* -----
-	 * not a comment line so find the tab splitting the sections
-	 */
-	kff = memchr (ext, '\t', bufflen);
-	if (kff == NULL)
-	{
-	    /* couldn't find it so blae the document and quit */
-	bad_line:
-	    rc = RC (rcFF, rcBuffer, rcParsing, rcFormat, rcCorrupt);
-	    /* log error */
-	    bufflen = 0;
-	    continue;
-	}
-	/* -----
-	 * the ext portion of the line is from the first non-white space
-	 * through the character before the tab.
-	 */
-	extlen = kff - ext;
-	bufflen -= extlen + 1;
-	kff++; /* point past the tab */
-	while (bufflen) /* skip white space */
-	{
-	    if (*kff == '\n') /* end of line now is a format error */
-	    {
-		goto bad_line;
-	    }
-	    if (!isspace (*kff)) /* break at non shite space character */
-		break;
-	    bufflen --;
-	    kff ++;
-	}
-	if (bufflen == 0) /* no kff descr */
-	    goto bad_line;
-	nl = memchr (kff, '\n', bufflen);
-	if (nl == NULL) /* no EOL but last line in buffer */
-	{
-	    kfflen = bufflen;
-	    bufflen = 0;
-	}
-	else /* not last unfinished line */
-	{
-	    kfflen = nl - ext;
-	    bufflen -= kfflen + 1;
-	    buff = nl + 1;
-	}
-	{
-	    KExtNode * np;
-	    rc = KExtNodeMake (&np, tables, ext, extlen,
-				 kff, kfflen);
-	    if (rc != 0)
-	    {
-		/* LOG ERR */
-		break;
-	    }
-	}
-    }
-    ( break;
-	    }
-	}
-    }
-    return rc;
-}
-#endif
-/* not used at this time */
-#if 0
-LIB_EXPORT rc_t CC KExtTableRead (KExtTable * self, const KFile * file))
-{
-    rc_t rc = 0;
-    /* setup KMMap */
-    /* call KExtTableBufferRead */
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KExtTableWrite (const KExtTable * self, KFile * file)
-{
-    rc_t rc = 0;
-
-    return rc;
-}
-#endif
-/* -----
- * format is
- * whitechar := {' '|'\f'|'\t'|'\v'}
- * whitespace := whitechar*
- * ext-str = !whitespace!{'\t'|'\n'}*
- * kff-str = !whitespace!{'\t'|'\n'}*
- *
- * A line is 
- * [<whitespace>]#<comment line skipped>\n
- * Or 
- * [<whitespace>]<ext-str>\t[<whitespace>]<kff-str>\n
- * Or
- * [<whitespace>]\n
- *
- * NOTE: whitespace at the right end of the two strings is included in the strings
- * NOTE: We do not look for '\v'|'\f' within the strings though we maybe should
- * NOTE: the ext string definitely allows white space and punctuation
- */
-static
-rc_t KExtTableInit (KExtTable * self, const KFFTables * tables, const char * buffer, size_t len)
-{
-    rc_t rc;
-    const char * ext;
-    const char * kff;
-    const char * tab;
-    const char * newline;
-    const char * line;
-    const char * limit;
-    KExtNode * node;
-
-    FUNC_ENTRY();
-
-
-    rc = 0;
-
-    /* -----
-     * we try to go all the way through the buffer line by line
-     * which by this coding could actually be all blank
-     */
-    limit = buffer + len;
-    for (line = buffer; line < limit; line = newline+1)
-    {
-	for (ext = line; isspace (*ext); ext++, len--)
-	{
-	    if (len == 0) /* last of the file was all whitespace so quit */
-		break;
-	}
-	newline = memchr (ext, '\n', len);
-	if (newline == NULL)
-	    newline = ext + len;
-	/* -----
-	 * If the first character on the line is #
-	 * we treat it as a comment (matches sh/bash/libext/etc.
-	 */
-	if (*ext == '#')
-	{
-	    /* -----
-	     * skip this line
-	     */
-	    len -= newline+1 - ext;
-	    continue;
-	}
-	
-	tab = memchr (ext, '\t', len);
-	if (tab == NULL)
-	{
-	    rc = RC (rcFF, rcFileFormat, rcConstructing, rcFile, rcInvalid);
-	    LOGERR (klogFatal, rc, "No <TAB> between ext and kff");
-	    break;
-	}
-	kff = tab + 1;
-	for (len -= kff - ext;
-	     isspace (*kff);
-	     len--, kff++)
-	{
-	    if (len == 0)
-	    {
-		rc = RC (rcFF, rcFileFormat, rcConstructing, rcFile, rcInvalid);
-		LOGERR (klogFatal, rc, "No kff after <TAB>");
-		break;
-	    }
-	}
-	if (newline == kff)
-	{
-	    rc = RC (rcFF, rcFileFormat, rcConstructing, rcFile, rcInvalid);
-	    LOGERR (klogFatal, rc, "No kff after whitespace");
-	    break;
-	}
-	len -= newline+1 - kff;
- 	rc = KExtNodeMake (&node, tables, ext, tab-ext, kff, newline-kff);
-	if (rc != 0)
-	{
-	    LOGERR (klogFatal, rc, "Failure to make node");
-	    break;
-	}
-	rc = KExtTableInsert(self, node);
-	if (rc != 0)
-	{
-	    LOGERR (klogFatal, rc, "Failure to insert node");
-	    break;
-	}
-    }
-    if (rc == 0)
-    {
-	char unknown[] = "Unknown";
-
-	rc = KExtNodeMake (&node, tables, unknown, sizeof (unknown) - 1, unknown, sizeof (unknown) - 1);
-	if (rc != 0)
-	{
-	    LOGERR (klogFatal, rc, "Failure to make node");
-	}
-	else
-	{
-	    rc = KExtTableInsert(self, node);
-	    if (rc != 0)
-	    {
-		LOGERR (klogFatal, rc, "Failure to insert node");
-	    }
-	}
-    }
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * KExtFileFormat
- *  a file content (format) categorizer
- */
-
-typedef
-struct KExtFileFormat
-{
-    KFileFormat	  dad;
-    KExtTable * table;
-} KExtFileFormat;
-
-static rc_t KExtFileFormatDestroy (KExtFileFormat *self);
-static rc_t KExtFileFormatGetTypeBuff (const KExtFileFormat *self,
-				       const void * buff, size_t buff_len,
-				       KFileFormatType * type,
-				       KFileFormatClass * class,
-				       char * description,
-				       size_t descriptionmax,
-				       size_t * descriptionlength);
-static rc_t KExtFileFormatGetTypePath (const KExtFileFormat *self,
-				       const struct  KDirectory * dir, const char * path,
-				       KFileFormatType * type,
-				       KFileFormatClass * class,
-				       char * description,
-				       size_t descriptionmax,
-				       size_t * descriptionlength);
-static
-KFileFormat_vt_v1 vt_v1 =
-{
-    1, 1, /* maj, min */
-    KExtFileFormatDestroy,
-    KExtFileFormatGetTypeBuff,
-    KExtFileFormatGetTypePath
-};
-
-
-
-/* Destroy
- *  destroy FileFormat
- */
-static
-rc_t KExtFileFormatDestroy (KExtFileFormat *self)
-{
-
-    FUNC_ENTRY();
-
-    return 0;
-}
-
-/* Type
- *  returns a KExtFileFormatDesc
- *  [OUT] rc_t               return
- *  [IN]  const KExtFileFormat *  self         
- *  [IN]  void **            buffer       buffer to hold returned description
- *  [IN]  size_t             buffer_size  size of the buffer
- *  [OUT] char **            descr        text description of file type
- *  [IN]  size_t             descr_max    maximum size of string descr can hold
- *  [OUT] size_t *           descr_len    length of returned descr (not including NUL
- */
-static
-rc_t CC KExtFileFormatGetTypeBuff (const KExtFileFormat *self, const void * buff, size_t buff_len,
-				KFileFormatType * type, KFileFormatClass * class,
-				char * descr, size_t descr_max, size_t *descr_len)
-{
-
-    FUNC_ENTRY();
-
-    return RC (rcFF, rcFileFormat, rcSearching, rcFormat, rcUnsupported);
-}
-
-
-static
-rc_t CC KExtFileFormatGetTypePath (const KExtFileFormat *self,
-                                const struct KDirectory * dir_ignored, const char * path,
-                                KFileFormatType * type, KFileFormatClass * class,
-                                char * descr, size_t descr_max, size_t *descr_len)
-{
-    rc_t rc = 0;
-    const char * b;
-    const char * s;
-    size_t size;
-
-
-    FUNC_ENTRY();
-
-
-    if (type != NULL)
-	*type = kfftError;
-    if (class != NULL)
-	*class = kffcError;
-
-    s = strrchr (path, '/');
-    if (s == NULL)
-	s = path;
-
-
-    b = strrchr (s, '.');
-    if (b == NULL)
-	b = path + string_measure(path, &size) - 1; /* will be an empty string when calls KExtTableFind */
-    {
-	KExtNode * node;
-	size_t c;
-
-        KFF_DEBUG (("%s: extension is %s\n", __func__, b+1));
-#if 1
- 	rc = KExtTableFind (self->table, &node, ++b);
-	if (rc == 0)
-	{
-	    KFileFormatClass cid;
-	    KFileFormatType tid;
-	    if (node == NULL)
-		rc = KExtTableFind (self->table, &node, "Unknown");
-	    if (rc == 0)
-		rc = KFFTablesGetTypeId (self->dad.tables, node->kffdescr, &tid, &cid);
-	    if (rc == 0)
-	    {
-		c = node->kfflen;
-		if (c > descr_max)
-		    c = descr_max-1;
-		if (descr)
-		    string_copy (descr, descr_max, node->kffdescr, c);
-		descr[c] = '\0';
-		if (descr_len)
-		    *descr_len = c;
-		if (type)
-		    *type = tid;
-		if (class)
-		    *class = cid;
-	    }
-	}
-	if (rc != 0)
-	{
-	    if (descr_len != NULL)
-		*descr_len = 0;
-	    if (type != NULL)
-		*type = kfftNotFound;
-	    if (class != NULL)
-		*class = kffcNotFound;
-	}	
-
-
-#else
-	size_t l = string_measure (b, &size);
-	if (desc != NULL)
-	{
-	    string_copy (desc, desc_max, b, l);
-	    if (desc_max < l)
-		desc[desc_max-1] = 0;
-	}
-	if (descr_len != NULL)
-	    *descr_len = l;
-	if (type != NULL)
-	    *type = kfftUnknown;
-	if (class != NULL)
-	    *class = kffcUnknown;
-#endif
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC KExtFileFormatMake (KFileFormat ** pft,
-			 const char* ext, size_t extlen,
-			 const char * typeAndClass, size_t tclen)
-{
-    rc_t rc = 0;
-    KExtFileFormat * self;
-
-
-    FUNC_ENTRY();
-
-    self = malloc (sizeof * self);
-    if (self == NULL)
-    {
-	rc = RC (rcFF, rcFileFormat, rcAllocating, rcMemory, rcExhausted);
-	LOGERR (klogFatal, rc, "Failed to allocate for KExtFileFormat");
-    }
-    else
-    {
-	rc = KFileFormatInit (&self->dad, (const KFileFormat_vt *)&vt_v1, typeAndClass, tclen);
-	if (rc == 0)
-	{
-	    rc = KExtTableMake (&self->table);
-	    if (rc == 0)
-	    {
-		rc = KExtTableInit (self->table, self->dad.tables, ext, extlen);
-		{
-		    if (rc == 0)
-		    {
-			*pft = &self->dad;
-			return 0;
-		    }
-		}
-		KExtTableRelease (self->table);
-	    }
-	}
-	free (self);
-    }
-    return rc;
-}
-
diff --git a/libs/kfs/ffkey.c b/libs/kfs/ffkey.c
deleted file mode 100644
index a7d844a..0000000
--- a/libs/kfs/ffkey.c
+++ /dev/null
@@ -1,833 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kfs/extern.h>
-#include <klib/rc.h>
-#include <klib/log.h>
-#include <klib/debug.h>
-#include <klib/container.h>
-#include <kfs/fileformat.h>
-#include <sysalloc.h>
-#include "fileformat-priv.h"
-
-#include <atomic.h>
-#include <stdlib.h>
-#include <string.h>
-
-/* ----------------------------------------------------------------------
- * Private type used only with in this compilation unit.
- */
-typedef
-struct KFFClass
-{
-    BSTNode	node;
-    atomic32_t	refcount;
-    KFileFormatClass	class;		/* scalar ID of the class */
-    size_t	len;		/* length of the descriptor */
-    char 	descr	[1];	/* ASCIZ text description of the class */
-} KFFClass;
-
-static
-rc_t KFFClassDestroy (const KFFClass * cself)
-{
-    rc_t rc;
-    KFFClass * self;
-
-    FUNC_ENTRY();
-
-    rc = 0;
-    self = (KFFClass*)cself;
-    if (cself == NULL)
-    {
-	rc = RC (rcFF, rcIndex, rcDestroying, rcSelf, rcNull);
-	LOGERR (klogErr, rc, "KFFClassDestroy: self == NULL");
-    }
-    else
-    {
-	free (self);
-    }
-    return rc;
-}
-
-static
-rc_t KFFClassRelease (const KFFClass * cself)
-{
-    rc_t rc = 0;
-
-    FUNC_ENTRY();
-
-    if (cself != NULL)
-    {
-	KFFClass *self = (KFFClass*)cself;
-        if (atomic32_dec_and_test (&self->refcount))
-	    return  KFFClassDestroy (cself);
-    }
-    return rc;
-}
-/* not used at this time */
-#if 0
-static
-rc_t KFFClassAddRef (const KFFClass * self)
-{
-    rc_t rc = 0; 
-
-    FUNC_ENTRY();
-
-    if (self != NULL)
-        atomic32_inc (&((KFFClass*)self)->refcount);
-    return rc;
-}
-#endif
-static
-rc_t KFFClassMake (KFFClass ** kffcp,	/* pointer to new object */
-		   KFileFormatClass class, /* ID of new class */
-		   const char * descr,	/* description of new class */
-		   size_t len)		/* length of description */
-{
-    rc_t rc = 0;
-
-    FUNC_ENTRY();
-
-    if (kffcp == NULL)
-    {
-	rc = RC (rcFF, rcIndex, rcConstructing, rcSelf, rcNull);
-	LOGERR (klogErr, rc, "KFFClassMake: kffkmp == NULL");
-    }
-    else if (descr == NULL)
-    {
-	rc = RC (rcFF, rcIndex, rcConstructing, rcParam, rcNull);
-	LOGERR (klogErr, rc, "KFFClassMake: descr == NULL");
-    }
-    else
-    {
-	if (len > DESCRLEN_MAX)
-	{
-/* 	    printf("len %u DESCRLEN_MAX %u\n", len, DESCRLEN_MAX); */
-	    rc = RC (rcFF, rcIndex, rcConstructing, rcParam, rcInvalid);
-	    LOGERR (klogErr, rc, "KFFClassMake: descr too long");
-	}
-	else if (len == 0)
-	{
-	    rc = RC (rcFF, rcIndex, rcConstructing, rcParam, rcEmpty);
-	    LOGERR (klogErr, rc, "KFFClassMake: descr too short");
-	}
-	else
-	{
-	    KFFClass * self = malloc (sizeof (*self) + len);
-	    if (self == NULL)
-	    {
-		rc = RC (rcFF,  rcIndex, rcConstructing, rcMemory, rcExhausted);
-		LOGERR (klogErr, rc, "KFFClassMake: object could not be allocated");
-	    }
-	    else
-	    {
-		/* self->node needs not be initialized  */
-		atomic32_set (&self->refcount,1);
-		self->class = class;
-		self->len = len;
-		memcpy (self->descr, descr, len);
-		self->descr[self->len] = '\0';
-		*kffcp = self;
-		return 0;
-	    }
-	}
-    }
-    *kffcp = NULL;
-    return rc;
-}
-
-/* -----
- * Private type used only with in this compilation unit.
- */
-typedef
-struct KFFType
-{
-    BSTNode	node;
-    atomic32_t 	refcount;	/* how many open references to this object */
-    KFileFormatType	type;		/* scalar ID of the type */
-    KFileFormatClass	class;		/* scalar ID of the class the type belongs in */
-    size_t	len;		/* length of the descriptor */
-    char 	descr	[1];	/* ASCIZ text description of the type */
-} KFFType;
-
-static
-rc_t KFFTypeDestroy (const KFFType * cself)
-{
-    rc_t rc = 0;
-    KFFType * self = (KFFType*)cself;
-
-    FUNC_ENTRY();
-
-    if (self == NULL)
-    {
-	rc = RC (rcFF, rcIndex, rcDestroying, rcSelf, rcNull);
-	LOGERR (klogErr, rc, "KFFTypeDestroy: self == NULL");
-    }
-    else
-    {
-	free (self);
-    }
-    return rc;
-}
-
-static
-rc_t KFFTypeRelease (const KFFType * cself)
-{
-    rc_t rc = 0;
-
-    FUNC_ENTRY();
-
-    if (cself != NULL)
-    {
-	KFFType *self = (KFFType*)cself;
-        if (atomic32_dec_and_test (&self->refcount))
-	    return  KFFTypeDestroy (cself);
-    }
-    return rc;
-}
-/* not used at this time */
-#if 0
-static
-rc_t KFFTypeAddRef (const KFFType * self)
-{
-    rc_t rc = 0;
-
-    FUNC_ENTRY();
-
-    if (self != NULL)
-        atomic32_inc (&((KFFType*)self)->refcount);
-    return rc;
-}
-#endif
-static
-rc_t KFFTypeMake (KFFType ** kfftp,
-		  KFileFormatType  type,
-		  KFileFormatClass class,
-		  const char * descr,
-		  size_t len)
-{
-    rc_t rc = 0;
-
-    FUNC_ENTRY();
-
-    if (kfftp == NULL)
-    {
-	rc = RC (rcFF, rcIndex, rcConstructing, rcSelf, rcNull);
-	LOGERR (klogErr, rc, "KFFTypeMake: kffkmp == NULL");
-    }
-    else if (descr == NULL)
-    {
-	rc = RC (rcFF, rcIndex, rcConstructing, rcParam, rcNull);
-	LOGERR (klogErr, rc, "KFFTypeMake: descr == NULL");
-    }
-    else
-    {
-	if (len > DESCRLEN_MAX)
-	{
-	    rc = RC (rcFF, rcIndex, rcConstructing, rcParam, rcInvalid);
-	    LOGERR (klogErr, rc, "KFFTypeMake: descr too long");
-	}
-	else if (len == 0)
-	{
-	    rc = RC (rcFF, rcIndex, rcConstructing, rcParam, rcEmpty);
-	    LOGERR (klogErr, rc, "KFFTypeMake: descr too short");
-	}
-	else
-	{
-	    KFFType * self = malloc (sizeof (*self) + len);
-	    if (self == NULL)
-	    {
-		rc = RC (rcFF,  rcIndex, rcConstructing, rcMemory, rcExhausted);
-		LOGERR (klogErr, rc, "KFFTypeMake: object could not be allocated");
-	    }
-	    else
-	    {
-		/* self->node needs not be initialized  */
-		atomic32_set (&self->refcount,1);
-		self->len = len;
-		memcpy (self->descr, descr, len);
-		self->descr[self->len] = '\0';
-		self->type = type;
-		self->class = class;
-		*kfftp = self;
-		return 0;
-	    }
-	}
-    }
-    *kfftp = NULL;
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- *
- * A table will have a descr based bstree for type, a descr based bstree
- * for class,
- *
- * A type indexed and class indexed set of indexes into the same stuff.
- *
- * All table are thus the "node" and pointer to a node.  the same nodes
- * are referred to by the descr based bstree and the linear tables.
- *
- * Linear tables are pre allocated arrays that are increased by chunks.
-*/
-
-struct KFFTables
-{
-    atomic32_t 	refcount;
-    BSTree	classtree;
-    BSTree	typetree;
-    KFFClass **	classindex;
-    KFFType **	typeindex;
-    uint32_t	typecount;
-    uint32_t	classcount;
-    uint32_t	typesize;
-    uint32_t	classsize;
-
-};
-
-static
-void KFFTypeNodeWhack (BSTNode * n, void * ignored)
-{
-    FUNC_ENTRY();
-
-    KFFTypeDestroy ((KFFType*)n);
-}
-static
-void KFFClassNodeWhack (BSTNode * n, void * ignored)
-{
-    FUNC_ENTRY();
-    KFFClassDestroy ((KFFClass*)n);
-}
-static 
-rc_t KFFTablesDestroy (const KFFTables * cself)
-{
-    KFFTables * self = (KFFTables*)cself;
-    rc_t rc = 0;
-/*     uint32_t ix; */
-    FUNC_ENTRY();
-
-    BSTreeWhack (&self->typetree, KFFTypeNodeWhack, NULL);
-    BSTreeWhack (&self->classtree, KFFClassNodeWhack, NULL);
-    if (self->classindex != NULL)
-	free (self->classindex);
-    if (self->typeindex != NULL)
-	free (self->typeindex);
-    free (self);
-    return rc;
-}
-
-rc_t CC KFFTablesRelease (const KFFTables * cself)
-{
-    rc_t rc = 0;
-
-    FUNC_ENTRY();
-
-    if (cself != NULL)
-    {
-	KFFTables *self = (KFFTables*)cself;
-        if (atomic32_dec_and_test (&self->refcount))
-	    return  KFFTablesDestroy (self);
-    }
-    return rc;
-}
-
-rc_t CC KFFTablesAddRef (const KFFTables * self)
-{
-    rc_t rc = 0;
-
-    FUNC_ENTRY();
-
-    if (self != NULL)
-        atomic32_inc (& ((KFFTables*) self)->refcount);
-    return rc;
-}
-
-/* -----
- * if descr is too short, not NUL terminated, and at the edge of legal memory
- * there is a chance the next two functions could have a segmentation fault
- */
-static
-int classcmp (const void * descr, const BSTNode * n)
-{
-    KFFClass * nn = (KFFClass*)n;
-    return strncmp ((const char *)descr, nn->descr, nn->len);
-}
-static
-int typecmp (const void * descr, const BSTNode * n)
-{
-    KFFType * nn = (KFFType *)n;
-
-    return strncmp ((const char *)descr, nn->descr, nn->len);
-}
-static
-int classsort (const BSTNode * i ,const BSTNode * n)
-{
-    KFFClass * ii = (KFFClass *)i;
-    KFFClass * nn = (KFFClass *)n;
-    return strncmp (ii->descr, nn->descr, nn->len);
-}
-static
-int typesort (const BSTNode * i, const BSTNode * n)
-{
-    KFFType * ii = (KFFType *)i;
-    KFFType * nn = (KFFType *)n;
-    return strncmp (ii->descr, nn->descr, nn->len);
-}
-
-static
-KFFClass * KFFTablesFindKFFClass (KFFTables * self,
-				  const char * descr )
-{
-    BSTNode * pbn;
-    if ((self == NULL) || (descr == NULL))
-	return NULL;
-    pbn = BSTreeFind (&self->classtree, descr, classcmp);
-    return (KFFClass*)pbn;
-}
-static
-KFFType * KFFTablesFindKFFType (KFFTables * self,
-				const char * descr )
-{
-    BSTNode * pbn;
-    FUNC_ENTRY ();
-    if ((self == NULL) || (descr == NULL))
-	return NULL;
-    pbn = BSTreeFind (&self->typetree, descr, typecmp);
-    return (KFFType*)pbn;
-}
-/* Not currently used
-static
-KFileFormatClass KFFTablesFindKFileFormatClass (KFFTables * self,
-						const char * descr )
-{
-    BSTNode * pbn;
-    LOGENTRY (10, "(10, "KFFTablesFindKFileFormatClass"));
-    if ((self == NULL) || (descr == NULL))
-	return kffcError;
-    pbn = BSTreeFind (&self->classtree, descr, classcmp);
-    if (pbn == NULL)
-	return kffcUnknown;
-    return ((KFFClass*)pbn)->class;
-}
-*/
-static
-KFileFormatType KFFTablesFindKFileFormatType (const KFFTables * self,
-					      const char * descr )
-{
-    union
-    {
-	BSTNode * bn;
-	KFFType * kt;
-    } node;
-
-    FUNC_ENTRY();
- 
-    if ((self == NULL) || (descr == NULL))
-    {
-	LOGMSG(klogWarn,"Not Found");
-	return kfftError;
-    }
-    node.bn = BSTreeFind (&self->typetree, descr, typecmp);
-    if (node.bn == NULL)
-    {
-        PLOGMSG(klogWarn,(klogWarn,"Unknown $(D)", PLOG_S(D),descr));
-	return kfftUnknown;
-    }
-
-/*     printf("KFFTablesFindKFileFormatType:\n" */
-/* 	   "\trefcount\t%u\n" */
-/* 	   "\ttype\t\t%u\n" */
-/* 	   "\tclass\t\t%u\n" */
-/* 	   "\tlen\t\t%lu\n" */
-/* 	   "\tdescr\t\t%s\n", */
-/* 	   node.kt->refcount,  */
-/* 	   node.kt->type, */
-/* 	   node.kt->class, */
-/* 	   node.kt->len, */
-/* 	   node.kt->descr); */
-
-    return (node.kt->type);
-}
-
-rc_t CC KFFTablesAddClass (KFFTables * self,
-                           KFileFormatClass * pclassid, /* returned ID: NULL okay */
-                           const char * descr,
-                           size_t len)
-{
-    rc_t rc;
-
-    FUNC_ENTRY();
-
-/*     PLOGMSG ((klogDebug10, "Descr is $(L) $(D)", PLOG_2(PLOG_U32(L),PLOG_S(D)), len,descr)); */
-    rc = 0;
-    if (self == NULL)
-    {
-	rc = -1;
-	LOGERR (klogErr, rc, "Error making type: NULL pointer");
-    }
-    else if (descr == NULL)
-    {
-	rc = -1;
-	LOGERR (klogErr, rc, "Error making type: NULL descr");
-    }
-    else
-    {
-	KFFClass * pclass;
-
-	pclass = KFFTablesFindKFFClass (self, descr);
-	if (pclass != NULL)
-	{
-	    rc = -1;
-	    PLOGERR (klogErr, (klogErr, rc, "Class already inserted <$(d)>", PLOG_S(d),  descr));
-	}
-	else
-	{
-	    /* not thread safe if multiple "creators" */
-	    if (self->classcount * sizeof(KFFClass*) == self->classsize)
-	    {
-		void * vp;
-		self->classsize += 32 * sizeof(KFFClass*);
-		/* realloc will not be undone if anything fails */
-		vp = realloc (self->classindex,self->classsize);
-		if (vp == NULL)
-		{
-		    rc = -1;
-		    LOGERR (klogErr, rc, "Error allocating class table");
-		}
-		self->classindex = vp;
-	    }
-	}
-	if (rc == 0)
-	{
-	    KFileFormatClass cid;
-	    KFFClass * kc;
-	    cid = self->classcount++;
-	    rc = KFFClassMake (&kc, cid, descr, len);
-	    if (rc != 0)
-	    {
-		PLOGERR (klogErr, (klogErr, rc, "Error making class: $(c) $(d)",
-			  PLOG_2(PLOG_U32(c),PLOG_S(d)),
-			  cid, descr));
-	    }
-	    else
-	    {
-		rc = BSTreeInsert (&self->classtree, &kc->node,
-				   classsort);
-		if (rc == 0)
-		{
-		    self->classindex[cid] = kc;
-		    if (pclassid)
-			*pclassid = cid;
-		    return 0;
-		}
-		PLOGERR (klogErr, (klogErr, rc, "Error inserting class $(c) $(d)",
-                                   PLOG_2(PLOG_U32(c),PLOG_S(d)),
-                                   cid, descr));
-		KFFClassRelease (kc);
-	    }
-	    self->classcount--;
-	}
-    }
-    if (pclassid)
-	*pclassid = 0;
-    return rc;
-}
-
-rc_t CC KFFTablesAddType (KFFTables * self,
-                          KFileFormatType * ptype, /* returned new ID */
-                          const char * class,
-                          const char * type,
-                          size_t clen,
-                          size_t tlen)
-{
-    rc_t rc;
-    KFFType * ptn;
-    KFFClass * pcn;
-    KFileFormatClass classid;
-    KFileFormatType pid;
-
-    FUNC_ENTRY();
-
-    rc = 0;
-
-    if (self == NULL)
-    {
-	rc = RC (rcFF, rcFileFormat, rcConstructing, rcSelf, rcNull);
-	LOGERR (klogErr, rc, "Error making type: NULL pointer");
-	goto quickout;
-    }
-    if ((class == NULL)||(type == NULL))
-    {
- 	rc = -1;
-	LOGERR (klogErr, rc, "Error making type: NULL parameter");
-	goto quickout;
-    }
-    ptn = KFFTablesFindKFFType (self, type);
-    pcn = KFFTablesFindKFFClass (self, class);
-    if (ptn != NULL)
-    {
-	rc = -1;
-	PLOGERR (klogErr, (klogErr, rc, "Type already inserted <$(d)>", PLOG_S(d), type));
-	goto quickout;
-    }
-
-    if (pcn == NULL)
-    {
-	rc = KFFTablesAddClass (self, &classid, class, clen);
-	if (rc != 0)
-	{
-	    PLOGERR (klogErr, (klogErr, rc, "unable to insert new class <$(d)>", PLOG_S(d), class));
-	    goto quickout;
-	}
-    }
-    else
-    {
-	classid = pcn->class;
-    }
-
-    /* not thread safe if multiple "creators" */
-    if (self->typecount * sizeof(KFFType*) == self->typesize)
-    {
-	void * vp;
-	self->typesize += 32 * sizeof(KFFType*);
-	/* realloc will not be undone of anything fails */
-	vp = realloc (self->typeindex,self->typesize);
-	if (vp == NULL)
-	{
-	    rc = -1;
-	    LOGERR (klogErr, rc, "Error allocating type table");
-	    goto quickout;
-	}
-	self->typeindex = vp;
-
-    }
-    pid = self->typecount++;
-    rc = KFFTypeMake (&ptn, pid, classid, type, tlen);
-    if (rc != 0)
-    {
-	PLOGERR (klogErr, (klogErr, rc, "Error making type: $(c) $(d)",
-                           PLOG_2(PLOG_I32(c),PLOG_S(d)),
-                           pid, type));
-    }
-    else
-    {
-	rc = BSTreeInsert (&self->typetree, &ptn->node, typesort);
-	if (rc == 0)
-	{
-	    self->typeindex[pid] = ptn;
-	    if (ptype)
-		*ptype = pid;
-	    return 0;
-	}
-	KFFTypeRelease (ptn);
-    }
-    self->typecount--;
-
-quickout:
-    if (ptype)
-	*ptype = 0;
-    return rc;
-}
-
-rc_t CC KFFTablesMake (KFFTables ** kmmtp)
-{
-    KFFTables * self;
-    rc_t rc = 0;
-
-    FUNC_ENTRY();
-
-    self = calloc (1,sizeof *self); /* we need it zeroed */
-    if (self == NULL)
-    {
-	rc = RC (rcFF, rcTable, rcConstructing, rcParam, rcNull);
-	LOGERR (klogErr, rc, "KFFTablesMake: self could not be allocated");
-    }
-    else
-    {
-/* 	uint32_t unknown; */
-/* calloc does all this
-	self->typecount = self->typesize = self->classcount = 
-	    self->classsize = 0;
-	KFFClass = NULL;
-	KFFType = NULL;
-*/
-/* might not want to count on BSTreeInit to set to zero and nothing else */
-	BSTreeInit (&self->typetree);
-	BSTreeInit (&self->classtree);
-	atomic32_set (&self->refcount,1);
-	/* initialize the tables to have an unknown class and unknown type */
-#if 1
-/* is this wise? */
-	rc = KFFTablesAddType (self, NULL, "Unknown", "Unknown", 7, 7);
-	if (rc == 0)
-	{
-	    *kmmtp = self;
-	    return 0;
-	}
-#else
-	rc = KFFTablesAddClass (self, &unknown,
-				"Unknown", 7);
-	if (rc == 0)
-	{
-	    uint32_t u;
-	    rc = KFFTablesAddType (self, &u, unknown,
-				   "Unknown", 7);
-	    if (rc == 0)
-	    {
-		*kmmtp = self;
-		return 0;
-	    }
-	}
-#endif
-	KFFTablesRelease (self);
-    }
-    return rc;
-}
-
-rc_t CC KFFTablesGetClassDescr (const KFFTables * self,
-                                KFileFormatClass tid,
-                                size_t * len,
-                                char ** pd)
-{
-    rc_t rc = 0;
-
-    FUNC_ENTRY();
-
-    *pd = NULL;
-    *len = 0;
-    if (self == NULL)
-    {
-	rc = RC (rcFF, rcTable, rcAccessing, rcSelf, rcNull);
-	LOGERR (klogErr, rc, "KFFTablesGetClassDescr: self is Null");
-    }
-    else
-    {
-	if ( ( tid < 0 )||( (uint32_t)tid > self->classcount ) )
-	{
-	    rc = RC (rcFF, rcTable, rcAccessing, rcParam, rcNotFound);
-	    LOGERR (klogErr, rc, "KFFTablesGetClassDescr: class ID out of range");
-	}
-	else
-	{
-	    *pd = self->classindex[tid]->descr;
-	    *len = self->classindex[tid]->len;
-	}
-    }
-    return rc;
-}
-
-rc_t CC KFFTablesGetTypeDescr (const KFFTables * self,
-                               KFileFormatType tid,
-                               size_t * len,
-                               char ** pd)
-{
-    rc_t rc = 0;
-
-    FUNC_ENTRY();
-
-    *pd = NULL;
-    *len = 0;
-    if (self == NULL)
-    {
-	rc = RC (rcFF, rcTable, rcAccessing, rcSelf, rcNull);
-	LOGERR (klogErr, rc, "KFFTablesGetTypeDescr: self is Null");
-    }
-    else
-    {
-	if ( (uint32_t)tid > self->typecount )
-	{
-	    rc = RC (rcFF, rcTable, rcAccessing, rcParam, rcNotFound);
-	    LOGERR (klogErr, rc, "KFFTablesGetTypeDescr: type ID out of range");
-	}
-	else
-	{
-	    *pd = self->typeindex[tid]->descr;
-	    *len = self->typeindex[tid]->len;
-	}
-    }
-    return rc;
-}
-
-/* not currently used and incomplete
-rc_t KFFTablesGetClassId (const KFFTables * self,
-			  const char ** pd,
-			  KFileFormatClass * cid)
-{
-    rc_t rc;
-
-    FUNC_ENTRY();
-
-    rc = 0;
-    *cid = 0;
-    if (self == NULL)
-    {
-	rc = RC (rcFF, rcTable, rcAccessing, rcSelf, rcNull);
-	LOGERR (klogErr, rc, "KFFTablesGetClassId: self is Null");
-    }
-    else
-    {
-    }
-    return rc;
-}
-*/
-rc_t CC KFFTablesGetTypeId (const KFFTables * self,
-                            const char * pd,
-                            KFileFormatType * tid,
-                            KFileFormatClass * cid)
-{
-    rc_t rc;
-
-    FUNC_ENTRY();
-
-    rc = 0;
-    *tid = 0;
-    if (self == NULL)
-    {
-	rc = RC (rcFF, rcTable, rcAccessing, rcSelf, rcNull);
-	LOGERR (klogErr, rc, "KFFTablesGetTypeId: self is Null");
-    }
-    else
-    {
-	KFileFormatType tt;
-	tt = KFFTablesFindKFileFormatType (self, pd);
-	if (tt > 0)
-	{
-	    if (tid)
-		*tid = tt;
-	    if (cid)
-		*cid = self->typeindex[tt]->class;
-	}
-	else
-	{
-	    if (tid)
-		*tid = tt;
-	    if (cid)
-		*cid = tt; /* same fail values */
-	}
-    }
-    return rc;
-}
diff --git a/libs/kfs/ffmagic.c b/libs/kfs/ffmagic.c
deleted file mode 100644
index f572a04..0000000
--- a/libs/kfs/ffmagic.c
+++ /dev/null
@@ -1,942 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kfs/extern.h>
-#include <magic.h>
-#include <klib/rc.h>
-#include <kfs/file.h>
-#include <klib/text.h>
-#include <klib/log.h>
-#include <klib/debug.h>
-#include <klib/container.h>
-#include <kfs/directory.h>
-#include <kfs/fileformat.h>
-#include <kfg/config.h>
-#include <sysalloc.h>
-#include "fileformat-priv.h"
-struct KMagicFileFormat;
-#define KFILEFORMAT_IMPL struct KMagicFileFormat
-#include "impl.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdio.h>
-
-typedef
-struct KMagicNode
-{
-    BSTNode		node;
-    atomic32_t 		refcount;
-    KFileFormatType	typeid;
-    size_t		kfflen;
-    size_t		magiclen;
-    char *		magicdescr;
-    char		kffdescr [1];
-} KMagicNode;
-
-static
-rc_t KMagicNodeDestroy (const KMagicNode * cself)
-{
-    rc_t rc;
-    KMagicNode * self;
-
-    FUNC_ENTRY();
-
-    rc = 0;
-    self = (KMagicNode*)cself;
-
-    if (self == NULL)
-    {
-	rc = RC (rcFF, rcIndex, rcDestroying, rcSelf, rcNull);
-	LOGERR (klogErr, rc, "KMagicNodeDestroy: self == NULL");
-    }
-    else
-    {
-	free (self);
-    }
-    return rc;
-}
-
-static
-rc_t KMagicNodeRelease (const KMagicNode * cself)
-{
-    rc_t rc = 0;
-
-    FUNC_ENTRY();
-
-    if (cself != NULL)
-    {
-	KFileFormat *self = (KFileFormat*)cself;
-        if (atomic32_dec_and_test (&self->refcount))
-	    return  KMagicNodeDestroy (cself);
-    }
-    return rc;
-}
-/* not used at this time */
-#if 0
-static
-rc_t KMagicNodeAddRef (const KMagicNode * self)
-{
-    rc_t rc = 0;
-
-    FUNC_ENTRY();
-
-    if (self != NULL)
-        atomic32_inc (&((KFileFormat*)self)->refcount);
-    return rc;
-}
-#endif
-static
-rc_t KMagicNodeMake (KMagicNode ** kmmp, const KFFTables * tables,
-		     const char * magicdescr, size_t magiclen,
-		     const char * kffdescr, size_t kfflen)
-
-{
-    KMagicNode * self;
-    rc_t rc = 0;
-
-    FUNC_ENTRY();
-
-    if (magicdescr == NULL)
-    {
-	rc = RC (rcFF, rcIndex, rcConstructing, rcParam, rcNull);
-	LOGERR (klogErr, rc, "KMagicNodeMake: magicdescr == NULL");
-    }
-    else if (kffdescr == NULL)
-    {
-	rc = RC (rcFF, rcIndex, rcConstructing, rcParam, rcNull);
-	LOGERR (klogErr, rc, "KKffNodeMake: kffdescr == NULL");
-    }
-    else
-    {
-	if (magiclen > DESCRLEN_MAX)
-	{
-	    rc = RC (rcFF, rcIndex, rcConstructing, rcParam, rcInvalid);
-	    LOGERR (klogErr, rc, "KMagicNodeMake: magicdescr too long");
-	}
-	else if (magiclen == 0)
-	{
-	    rc = RC (rcFF, rcIndex, rcConstructing, rcParam, rcEmpty);
-	    LOGERR (klogErr, rc, "KMagicNodeMake: magicdescr too short");
-	}
-	else if (kfflen > DESCRLEN_MAX)
-	{
-	    rc = RC (rcFF, rcIndex, rcConstructing, rcParam, rcInvalid);
-	    LOGERR (klogErr, rc, "KKffNodeMake: kffdescr too long");
-	}
-	else if (kfflen == 0)
-	{
-	    rc = RC (rcFF, rcIndex, rcConstructing, rcParam, rcEmpty);
-	    LOGERR (klogErr, rc, "KKffNodeMake: kffdescr too short");
-	}
-	else
-	{
-	    KFileFormatType typeid;
-	    rc = KFFTablesGetTypeId (tables, kffdescr, &typeid, NULL);
-	    if (rc == 0)
-	    {
-		self = malloc (sizeof (*self) + magiclen + kfflen + 1);
-		if (self == NULL)
-		{
-		    rc = RC (rcFF,  rcIndex, rcConstructing, rcMemory, rcExhausted);
-		    LOGERR (klogErr, rc, "KMagicNodeMake: self could not be allocated");
-		}
-		else
-		{
-		    atomic32_set (&self->refcount,1);
-		    self->typeid = typeid;
-		    self->kfflen = kfflen;
-		    self->magiclen = magiclen;
-		    self->magicdescr = self->kffdescr + kfflen + 1;
-		    memcpy (self->kffdescr, kffdescr, kfflen);
-		    memcpy (self->magicdescr, magicdescr, magiclen);
-		    self->kffdescr[self->kfflen] = '\0';
-		    self->magicdescr[self->magiclen] = '\0';
-		    *kmmp = self;
-		    return 0;
-		}
-	    }
-	}
-    }
-    return rc;
-}
-
-
-/* -------------------------
- *
- */
-typedef
-struct KMagicTable
-{
-    atomic32_t 	refcount;
-    BSTree	tree;
-} KMagicTable;
-
-static
-void KMagicNodeWhack (BSTNode * n, void * ignored)
-{
-    FUNC_ENTRY();
-
-    (void)KMagicNodeRelease((KMagicNode*)n);
-}
-static
-rc_t KMagicTableDestroy (KMagicTable * cself)
-{
-    rc_t rc;
-    KMagicTable * self;
-
-    FUNC_ENTRY();
-
-    rc = 0;
-    self = (KMagicTable*)cself;
-    if (self == NULL)
-    {
-	rc = RC (rcFF, rcTable, rcDestroying, rcSelf, rcNull);
-	LOGERR (klogErr, rc, "KMagicTableDestroy: self == NULL");
-    }
-    else
-    {
-	BSTreeWhack (&self->tree, KMagicNodeWhack, NULL);
-	free (self);
-    }
-    return rc;
-}
-static
-rc_t KMagicTableRelease (const KMagicTable * cself)
-{
-    rc_t rc = 0;
-
-    FUNC_ENTRY();
-
-    if (cself != NULL)
-    {
-	KMagicTable *self = (KMagicTable*)cself;
-        if (atomic32_dec_and_test (&self->refcount))
-	    return  KMagicTableDestroy (self);
-    }
-    return rc;
-}
-#if 0
-static /* not used at this time */
-rc_t KMagicTableAddRef (const KMagicTable * self)
-{
-    rc_t rc = 0;
-
-    FUNC_ENTRY();
-
-    if (self != NULL)
-        atomic32_inc (& ((KFileFormat*) self)->refcount);
-    return rc;
-}
-#endif
-static
-rc_t KMagicTableMake (KMagicTable ** kmmtp)
-{
-    KMagicTable * self;
-    rc_t rc = 0;
-
-    FUNC_ENTRY();
-
-    self = malloc (sizeof *self);
-    if (self == NULL)
-    {
-	rc = RC (rcFF, rcTable, rcConstructing, rcParam, rcNull);
-	LOGERR (klogErr, rc, "KMagicTableMake: self could not be allocated");
-    }
-    else
-    {
-	BSTreeInit (&self->tree);
-	*kmmtp = self;
-    }
-    return rc;
-}
-
-static
-int KMagicNodeCmp (const void* item, const BSTNode * n)
-{
-    size_t len;
-    KMagicNode * mn = (KMagicNode *)n;
-
-    FUNC_ENTRY();
-
-    /* -----
-     * we only check this many characters of the comparison item
-     * we need only this part to match and ignore characters after
-     * this in the comparison string
-     */
-    len = mn->magiclen;
-    return strncmp (item, mn->magicdescr, len);
-}
-
-static
-rc_t KMagicTableFind (KMagicTable * self, KMagicNode ** node, const char * str)
-{
-    rc_t rc = 0;
-
-    FUNC_ENTRY();
-
-    *node = (KMagicNode*)BSTreeFind (&self->tree, str, KMagicNodeCmp);
-    if (*node == NULL)
-    {
-/* 	rc = RC (rcFF, rcTable, rcSearching, rcNode, rcNotFound); */
-        KFF_DEBUG (("%s: Could not find %s\n", __func__, str));
-    }
-    return rc;
-}
-/* maxlen includes the terminating NUL */
-#if 0 /* not in use at this time */
-static
-rc_t KMagicTableFindKFFDescr (KMagicTable * self, const char * str, char * kff, size_t maxlen)
-{
-    rc_t rc;
-    KMagicNode * np;
-
-    FUNC_ENTRY();
-
-    if (self == NULL)
-    {
-	rc = RC (rcFF, rcFileFormat, rcSearching, rcSelf, rcNull);
-	LOGERR (klogErr, rc, "KMagicTableFindKFFDecr:self == NULL");
-	return rc;
-    }
-    if (str == NULL)
-    {
-	rc = RC (rcFF, rcFileFormat, rcSearching, rcParam, rcNull);
-	LOGERR (klogErr, rc, "KMagicTableFindKFFDecr: searchstring is NULL");
-	return rc;
-    }
-    if (kff == NULL)
-    {
-	rc = RC (rcFF, rcFileFormat, rcSearching, rcParam, rcNull);
-	LOGERR (klogErr, rc, "KMagicTableFindKFFDecr: found storage is NULL");
-	return rc;
-    }
-    rc = KMagicTableFind (self, &np, str);
-    if (maxlen <= np->kfflen) /* kfflen does not include NUL */
-    {
-	rc = RC (rcFF, rcFileFormat, rcSearching, rcParam, rcTooLong);
-	LOGERR (klogErr, rc, "KMagicTableFindKFFDecr: found storage is NULL");
-	return rc;
-    }
-    memcpy (kff, np->kffdescr, np->kfflen);
-    kff[np->kfflen] = '\0';
-    return rc;
-}
-#endif
-static
-int KMagicNodeSort (const BSTNode* item, const BSTNode * n)
-{
-    const char * str1;
-    const char * str2;
-
-    FUNC_ENTRY();
-
-    str1 = ((KMagicNode *)item)->magicdescr;
-    str2 = ((KMagicNode *)n)->magicdescr;
-    return strcmp (str1, str2);
-}
-static
-rc_t KMagicTableInsert (KMagicTable * self, KMagicNode *node)
-{
-    FUNC_ENTRY();
-
-    return (BSTreeInsert (&self->tree, &node->node, KMagicNodeSort));
-}
-/* not is use at this time */
-#if 0
-
-static
-rc_t KMagicTableBufferRead (KMagicTable * self, KFFTables * tables,
-			    const char * buff, size_t bufflen)
-{
-    rc_t rc = 0;
-    const char * kff;
-    const char * magic;
-    const char * nl;
-    size_t kfflen;
-    size_t magiclen;
-
-    FUNC_ENTRY();
-
-
-    /* -----
-     * until we get all the way through the buffer
-     * which by this coding could actually be all blank
-     */
-    while (bufflen)
-    {
-	magic = buff;
-	/* -----
-	 * allow leading white space including blank lines
-	 */
-	if (isspace (*magic))	
-	{
-	    buff++;
-	    bufflen --;
-	    continue;
-	}
-	/* -----
-	 * not a comment line so find the tab splitting the sections
-	 */
-	kff = memchr (magic, '\t', bufflen);
-	if (kff == NULL)
-	{
-	    /* couldn't find it so blae the document and quit */
-	bad_line:
-	    rc = RC (rcFF, rcBuffer, rcParsing, rcFormat, rcCorrupt);
-	    /* log error */
-	    bufflen = 0;
-	    continue;
-	}
-	/* -----
-	 * the magic portion of the line is from the first non-white space
-	 * through the character before the tab.
-	 */
-	magiclen = kff - magic;
-	bufflen -= magiclen + 1;
-	kff++; /* point past the tab */
-	while (bufflen) /* skip white space */
-	{
-	    if (*kff == '\n') /* end of line now is a format error */
-	    {
-		goto bad_line;
-	    }
-	    if (!isspace (*kff)) /* break at non shite space character */
-		break;
-	    bufflen --;
-	    kff ++;
-	}
-	if (bufflen == 0) /* no kff descr */
-	    goto bad_line;
-	nl = memchr (kff, '\n', bufflen);
-	if (nl == NULL) /* no EOL but last line in buffer */
-	{
-	    kfflen = bufflen;
-	    bufflen = 0;
-	}
-	else /* not last unfinished line */
-	{
-	    kfflen = nl - magic;
-	    bufflen -= kfflen + 1;
-	    buff = nl + 1;
-	}
-	{
-	    KMagicNode * np;
-	    rc = KMagicNodeMake (&np, tables, magic, magiclen,
-				 kff, kfflen);
-	    if (rc != 0)
-	    {
-		/* LOG ERR */
-		break;
-	    }
-	}
-    }
-    ( break;
-	    }
-	}
-    }
-    return rc;
-}
-#endif
-
-/* not used at this time */
-#if 0
-LIB_EXPORT rc_t CC KMagicTableRead (KMagicTable * self, const KFile * file))
-{
-    rc_t rc = 0;
-    /* setup KMMap */
-    /* call KMagicTableBufferRead */
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMagicTableWrite (const KMagicTable * self, KFile * file)
-{
-    rc_t rc = 0;
-
-    return rc;
-}
-#endif
-
-/* -----
- * format is
- * whitechar := {' '|'\f'|'\t'|'\v'}
- * whitespace := whitechar*
- * magic-str = !whitespace!{'\t'|'\n'}*
- * kff-str = !whitespace!{'\t'|'\n'}*
- *
- * A line is 
- * [<whitespace>]#<comment line skipped>\n
- * Or 
- * [<whitespace>]<magic-str>\t[<whitespace>]<kff-str>\n
- * Or
- * [<whitespace>]\n
- *
- * NOTE: whitespace at the right end of the two strings is included in the strings
- * NOTE: We do not look for '\v'|'\f' within the strings though we maybe should
- * NOTE: the magic string definitely allows white space and punctuation
- */
-static
-rc_t KMagicTableInit (KMagicTable * self, const KFFTables * tables, const char * buffer, size_t len)
-{
-    rc_t rc;
-    const char * magic;
-    const char * kff;
-    const char * tab;
-    const char * newline;
-    const char * line;
-    const char * limit;
-    KMagicNode * node;
-
-    FUNC_ENTRY();
-
-    rc = 0;
-
-    /* -----
-     * we try to go all the way through the buffer line by line
-     * which by this coding could actually be all blank
-     */
-    limit = buffer + len;
-    for (line = buffer; line < limit; line = newline+1)
-    {
-	for (magic = line; isspace (*magic); magic++, len--)
-	{
-	    if (len == 0) /* last of the file was all whitespace so quit */
-		break;
-	}
-	newline = memchr (magic, '\n', len);
-	if (newline == NULL)
-	    newline = magic + len;
-	/* -----
-	 * If the first character on the line is #
-	 * we treat it as a comment (matches sh/bash/libmagic/etc.
-	 */
-	if (*magic == '#')
-	{
-	    /* -----
-	     * skip this line
-	     */
-	    len -= newline+1 - magic;
-	    continue;
-	}
-	
-	tab = memchr (magic, '\t', len);
-	if (tab == NULL)
-	{
-	    rc = RC (rcFF, rcFileFormat, rcConstructing, rcFile, rcInvalid);
-	    LOGERR (klogFatal, rc, "No <TAB> between magic and kff");
-	    break;
-	}
-	kff = tab + 1;
-	for (len -= kff - magic;
-	     isspace (*kff);
-	     len--, kff++)
-	{
-	    if (len == 0)
-	    {
-		rc = RC (rcFF, rcFileFormat, rcConstructing, rcFile, rcInvalid);
-		LOGERR (klogFatal, rc, "No kff after <TAB>");
-		break;
-	    }
-	}
-	if (newline == kff)
-	{
-	    rc = RC (rcFF, rcFileFormat, rcConstructing, rcFile, rcInvalid);
-	    LOGERR (klogFatal, rc, "No kff after whitespace");
-	    break;
-	}
-	len -= newline+1 - kff;
- 	rc = KMagicNodeMake (&node, tables, magic, tab-magic, kff, newline-kff);
-	if (rc != 0)
-	{
-	    LOGERR (klogFatal, rc, "Failure to make node");
-	    break;
-	}
-	rc = KMagicTableInsert(self, node);
-	if (rc != 0)
-	{
-	    LOGERR (klogFatal, rc, "Failure to insert node");
-	    break;
-	}
-    }
-    if (rc == 0)
-    {
-	char unknown[] = "Unknown";
-
-	rc = KMagicNodeMake (&node, tables, unknown, sizeof (unknown) - 1, unknown, sizeof (unknown) - 1);
-	if (rc != 0)
-	{
-	    LOGERR (klogFatal, rc, "Failure to make node");
-	}
-	else
-	{
-	    rc = KMagicTableInsert(self, node);
-	    if (rc != 0)
-	    {
-		LOGERR (klogFatal, rc, "Failure to insert node");
-	    }
-	}
-    }
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * KMagicFileFormat
- *  a file content (format) categorizer
- */
-
-typedef
-struct KMagicFileFormat
-{
-    KFileFormat	  dad;
-    magic_t 	  cookie;
-    KMagicTable * table;
-} KMagicFileFormat;
-
-static rc_t KMagicFileFormatDestroy (KMagicFileFormat *self);
-static rc_t KMagicFileFormatGetTypeBuff (const KMagicFileFormat *self,
-					 const void * buff, size_t buff_len,
-					 KFileFormatType * type,
-					 KFileFormatClass * class,
-					 char * description,
-					 size_t descriptionmax,
-					 size_t * descriptionlength);
-static rc_t KMagicFileFormatGetTypePath (const KMagicFileFormat *self,
-					 const KDirectory * dir,
-					 const char * path,
-					 KFileFormatType * type,
-					 KFileFormatClass * class,
-					 char * description,
-					 size_t descriptionmax,
-					 size_t * descriptionlength);
-static
-KFileFormat_vt_v1 vt_v1 =
-{
-    1, 1, /* maj, min */
-    KMagicFileFormatDestroy,
-    KMagicFileFormatGetTypeBuff,
-    KMagicFileFormatGetTypePath
-};
-
-
-
-/* Destroy
- *  destroy FileFormat
- */
-static
-rc_t KMagicFileFormatDestroy (KMagicFileFormat *self)
-{
-    FUNC_ENTRY();
-
-    magic_close (self->cookie);
-    return 0;
-}
-
-/* Type
- *  returns a KMagicFileFormatDesc
- *  [OUT] rc_t               return
- *  [IN]  const KMagicFileFormat *  self         
- *  [IN]  void **            buffer       buffer to hold returned description
- *  [IN]  size_t             buffer_size  size of the buffer
- *  [OUT] char **            descr        text description of file type
- *  [IN]  size_t             descr_max    maximum size of string descr can hold
- *  [OUT] size_t *           descr_len    length of returned descr (not including NUL
- */
-static
-rc_t KMagicFileFormatGetTypePath (const KMagicFileFormat *self, const KDirectory * dir, const char * path,
-				  KFileFormatType * type, KFileFormatClass * class,
-				  char * descr, size_t descr_max, size_t *descr_len)
-{
-    rc_t rc = 0;
-    uint8_t	buff	[8192];
-    size_t	bytes_read;
-
-    rc = KDirectoryAddRef (dir);
-    if (rc == 0)
-    {
-	const KFile * file;
-	rc = KDirectoryVOpenFileRead (dir, &file, path, NULL);
-	if (rc == 0)
-	{
-	    rc = KFileRead (file, 0, buff, sizeof buff, &bytes_read);
-	    {
-		rc = KMagicFileFormatGetTypeBuff (self,buff, bytes_read,
-						  type, class, descr,
-						  descr_max, descr_len);
-	    }
-	    KFileRelease (file);
-	}
-	KDirectoryRelease (dir);
-    }
-    return rc;
-}
-static
-rc_t KMagicFileFormatGetTypeBuff (const KMagicFileFormat *self, const void * buff, size_t buff_len,
-				  KFileFormatType * type, KFileFormatClass * class,
-				  char * descr, size_t descr_max, size_t *descr_len)
-{
-    rc_t rc = 0;
-    const char * b;
-
-    FUNC_ENTRY();
-
-    if (type != NULL)
-	*type = kfftError;
-    if (class != NULL)
-	*class = kffcError;
-    b = magic_buffer (self->cookie, buff, buff_len);
-    if (b == NULL)
-	rc = RC (rcFF, rcFileFormat, rcParsing, rcFormat, rcUnrecognized);
-    else
-    {
-	KMagicNode * node;
-	size_t c;
-
-        KFF_DEBUG (("magic_buffer returned %s\n", b));
-#if 1
- 	rc = KMagicTableFind (self->table, &node, b);
-	if (rc == 0)
-	{
-	    KFileFormatClass cid;
-	    KFileFormatType tid;
-#define TABLES self->dad.tables
-	    if (node == NULL)
-		rc = KMagicTableFind (self->table, &node, "Unknown");
-	    if (rc == 0)
-		rc = KFFTablesGetTypeId (TABLES, node->kffdescr, &tid, &cid);
-	    if (rc == 0)
-	    {
-		c = node->kfflen;
-		if (c > descr_max)
-		    c = descr_max-1;
-		if (descr)
-		    string_copy(descr, descr_max, node->kffdescr, c);
-		descr[c] = '\0';
-		if (descr_len)
-		    *descr_len = c;
-		if (type)
-		    *type = tid;
-		if (class)
-		    *class = cid;
-	    }
-	}
-	if (rc != 0)
-	{
-	    if (descr_len != NULL)
-		*descr_len = 0;
-	    if (type != NULL)
-		*type = kfftNotFound;
-	    if (class != NULL)
-		*class = kffcNotFound;
-	}	
-
-
-#else
-    size_t size;
-	size_t l = string_measure(b, &size);
-	if (descr != NULL)
-	{
-	    string_copy (descr, descr_max, b, l);
-	    if (descr_max < l)
-		descr[descr_max-1] = 0;
-	}
-	if (descr_len != NULL)
-	    *descr_len = strlen (b);
-	if (type != NULL)
-	    *type = kfftUnknown;
-	if (class != NULL)
-	    *class = kffcUnknown;
-#endif
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC KMagicFileFormatMake (KFileFormat ** pft, const char * magic_path,
-			   const char* magic, size_t magiclen,
-			   const char * typeAndClass, size_t tclen)
-{
-    rc_t rc = 0;
-    KMagicFileFormat * self;
-
-    FUNC_ENTRY();
-
-    DBGMSG (DBG_KFS, DBG_FLAG(DBG_KFS_KFF),
-            ("%s: load path as called %s\n", __func__, magic_path));
-
-    self = malloc (sizeof * self);
-    if (self == NULL)
-    {
-	rc = RC (rcFF, rcFileFormat, rcAllocating, rcMemory, rcExhausted);
-	LOGERR (klogFatal, rc, "Failed to allocate for KMagicFileFormat");
-    }
-    else
-
-
-    {
-	rc = KFileFormatInit (&self->dad, (const KFileFormat_vt *)&vt_v1, typeAndClass, tclen);
-	if (rc == 0)
-	{
-	    rc = KMagicTableMake (&self->table);
-	    if (rc == 0)
-	    {
-		rc = KMagicTableInit (self->table, self->dad.tables, magic, magiclen);
-		if (rc == 0)
-		{
- 		    self->cookie = magic_open (MAGIC_PRESERVE_ATIME);
-/* 		    self->cookie = magic_open (MAGIC_PRESERVE_ATIME|MAGIC_DEBUG|MAGIC_CHECK); */
-		    if (self->cookie == NULL)
-		    {
-			rc = RC (rcFF, rcFileFormat, rcConstructing, rcResources, rcNull);
-			LOGERR (klogFatal, rc, "Unable to obtain libmagic cookie");
-		    }
-		    else
-		    {
-                        KDirectory * pwd;
-                        KConfig * kfg;
-                        static const char unix_magic_path[] = "/usr/share/file/magic";
-                        static const char kfg_magic_path[] = "kfs/kff/magic";
-                        char * magic_path_cursor;
-                        char kfg_magic_path_buff [1024];
-                        char magic_path_buff [4096];
-                        size_t z;
-			int load_code;
-
-
-                        magic_path_cursor = magic_path_buff;
-
-                        if (magic_path)
-                        {
-                            z = strlen (magic_path);
-                            if (magic_path_cursor != magic_path_buff)
-                                *magic_path_cursor++ = ':';
-                            memcpy (magic_path_cursor, magic_path, z);
-                            magic_path_cursor += z;
-                            *magic_path_cursor = '\0';
-                            DBGMSG (DBG_KFS, DBG_FLAG(DBG_KFS_KFF),
-                                    ("%s: 1 magic_path_buff %s\n", __func__, magic_path_buff));
-                        }
-
-                        /* see if we have a configured alternate magic path */
-                        rc = KConfigMake (&kfg, NULL);
-                        if (rc == 0)
-                        {
-                            const KConfigNode * node;
-                            rc = KConfigOpenNodeRead (kfg, &node, kfg_magic_path);
-                            if (rc == 0)
-                            {
-                                size_t remaining;
-                                rc = KConfigNodeRead (node, 0, kfg_magic_path_buff,
-                                                      sizeof kfg_magic_path_buff-1,
-                                                      &z, &remaining);
-                                if (rc == 0)
-                                {
-                                    if (remaining != 0)
-                                    {
-                                        rc = RC (rcFF, rcFileFormat, rcLoading, 
-                                                 rcString, rcExcessive);
-                                        DBGMSG (DBG_KFS, DBG_FLAG(DBG_KFS_KFF),
-                                                ("%s: failed KConfigOpenNodeRead remaining %zu %R\n",
-                                                 __func__, remaining, rc));
-                                    }
-                                    else if (z)
-                                    {
-                                        kfg_magic_path_buff[z] = '\0';
-                                        if (magic_path_cursor != magic_path_buff)
-                                            *magic_path_cursor++ = ':';
-                                        memcpy (magic_path_cursor,kfg_magic_path_buff, z);
-                                        magic_path_cursor += z;
-                                        *magic_path_cursor = '\0';
-                                        DBGMSG (DBG_KFS, DBG_FLAG(DBG_KFS_KFF),
-                                                ("%s: 3 magic_path_buff %s\n", __func__, magic_path_buff));
-                                    }
-                                }
-                                else
-                                    DBGMSG (DBG_KFS, DBG_FLAG(DBG_KFS_KFF),
-                                            ("%s: failed KConfigNodeRead %R\n", __func__, rc));
-                            }
-                            else
-                                DBGMSG (DBG_KFS, DBG_FLAG(DBG_KFS_KFF),
-                                        ("%s: failed KConfigOpenNodeRead %R\n", __func__, rc));
-                        }
-                        else
-                            DBGMSG (DBG_KFS, DBG_FLAG(DBG_KFS_KFF),
-                                    ("%s: failed KConfigMake %R\n", __func__, rc));
-			
-                        rc = KDirectoryNativeDir (&pwd);
-                        if (rc == 0)
-                        {
-                            KPathType kpt = KDirectoryPathType (pwd, unix_magic_path);
-                            DBGMSG (DBG_KFS, DBG_FLAG(DBG_KFS_KFF),
-                                    ("%s: %s %x\n", __func__, unix_magic_path, kpt));
-                            if ((kpt & ~ kptAlias) == kptFile)
-                            {
-                                z = strlen (unix_magic_path);
-                                if (magic_path_cursor != magic_path_buff)
-                                    *magic_path_cursor++ = ':';
-                                memcpy (magic_path_cursor, unix_magic_path, z);
-                                magic_path_cursor += z;
-                                *magic_path_cursor = '\0';
-                                DBGMSG (DBG_KFS, DBG_FLAG(DBG_KFS_KFF),
-                                        ("%s: 2 magic_path_buff %s\n", __func__, magic_path_buff));
-                            }
-                        }
-                        else
-                            LOGERR (klogErr, rc, "Failed to open NativeDir for Magic");
-
-                        DBGMSG (DBG_KFS, DBG_FLAG(DBG_KFS_KFF),
-                                ("%s: loading path %s\n", __func__, magic_path_buff));
-
-			load_code = magic_load (self->cookie, magic_path_buff);
-			if (load_code != 0) /* defined as 0 success and -1 as fail */
-			{
-                            KFF_DEBUG (("%s: magic_load() failed with load code %d\n", __func__, load_code));
-			    rc = RC (rcFF, rcFileFormat, rcLoading, rcLibrary, rcUnexpected);
-			}
-			else
-			{
-			    *pft = &self->dad;
-                            KFF_DEBUG (("%s Success\n", __func__));
-			    return 0;
-			}
-			magic_close (self->cookie);
-		    }
-		}
-		else
-		    LOGERR (klogErr, rc, "Fail from KMagicTableInit");
-		KMagicTableRelease (self->table);
-	    }
-	    else
-		LOGERR (klogErr, rc, "Fail from KMagicTableMake");
-	}
-	else
-	    LOGERR (klogErr, rc, "Fail from KFileFormatInit");
-	free (self);
-    }
-    return rc;
-}
-
diff --git a/libs/kfs/file.c b/libs/kfs/file.c
deleted file mode 100644
index 22582db..0000000
--- a/libs/kfs/file.c
+++ /dev/null
@@ -1,865 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kfs/extern.h>
-#include <kfs/impl.h>
-#include <klib/rc.h>
-#include <kproc/timeout.h>
-#include <os-native.h>
-#include <sysalloc.h>
-
-#include <assert.h>
-
-/*--------------------------------------------------------------------------
- * KFile
- *  a file
- */
-
-/* Destroy
- *  destroy file
- */
-LIB_EXPORT rc_t CC KFileDestroy ( KFile *self )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcDestroying, rcSelf, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . destroy ) ( self );
-    }
-
-    return RC ( rcFS, rcFile, rcDestroying, rcInterface, rcBadVersion );
-}
-
-/* GetSysFile
- *  returns an underlying system file object
- *  and starting offset to contiguous region
- *  suitable for memory mapping, or NULL if
- *  no such file is available.
- */
-LIB_EXPORT struct KSysFile* CC KFileGetSysFile ( const KFile *self, uint64_t *offset )
-{
-    if ( offset != NULL )
-    {
-        * offset = 0;
-        if ( self != NULL )
-        {
-            switch ( self -> vt -> v1 . maj )
-            {
-            case 1:
-                return ( * self -> vt -> v1 . get_sysfile ) ( self, offset );
-            }
-        }
-    }
-    return NULL;
-}
-
-/* AddRef
- *  creates a new reference
- *  ignores NULL references
- */
-LIB_EXPORT rc_t CC KFileAddRef ( const KFile *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KFile" ) )
-        {
-        case krefLimit:
-            return RC ( rcFS, rcFile, rcAttaching, rcRange, rcExcessive );
-        case krefNegative:
-            return RC ( rcFS, rcFile, rcAttaching, rcSelf, rcInvalid );
-        default:
-            break;
-        }
-    }
-    return 0;
-}
-
-/* Release
- *  discard reference to file
- *  ignores NULL references
- */
-LIB_EXPORT rc_t CC KFileRelease ( const KFile *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KFile" ) )
-        {
-        case krefWhack:
-            if ( self -> dir != NULL )
-                return KDirectoryDestroyFile ( self -> dir, ( KFile* ) self );
-            return KFileDestroy ( ( KFile* ) self );
-        case krefNegative:
-            return RC ( rcFS, rcFile, rcReleasing, rcRange, rcExcessive );
-        default:
-            break;
-        }
-    }
-
-    return 0;
-}
-
-/* RandomAccess
- *  ALMOST by definition, the file is random access
- *  certain file types ( notably compressors ) will refuse random access
- *
- *  returns 0 if random access, error code otherwise
- */
-LIB_EXPORT rc_t CC KFileRandomAccess ( const KFile *self )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcAccessing, rcSelf, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . random_access ) ( self );
-    }
-
-    return RC ( rcFS, rcFile, rcAccessing, rcInterface, rcBadVersion );
-}
-
-/* Type
- *  returns a KFileDesc
- *  not intended to be a content type,
- *  but rather an implementation class
- */
-LIB_EXPORT uint32_t CC KFileType ( const KFile *self )
-{
-    if ( self == NULL )
-        return kfdNull;
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        if ( self -> vt -> v1 . min >= 1 )
-            return ( * self -> vt -> v1 . get_type ) ( self );
-        break;
-    }
-
-    return kfdInvalid;
-}
-
-/* Size
- *  returns size in bytes of file
- *
- *  "size" [ OUT ] - return parameter for file size
- */
-LIB_EXPORT rc_t CC KFileSize ( const KFile *self, uint64_t *size )
-{
-    if ( size == NULL )
-        return RC ( rcFS, rcFile, rcAccessing, rcParam, rcNull );
-
-    * size = 0;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcAccessing, rcSelf, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . get_size ) ( self, size );
-    }
-
-    return RC ( rcFS, rcFile, rcAccessing, rcInterface, rcBadVersion );
-}
-
-/* SetSize
- *  sets size in bytes of file
- *
- *  "size" [ IN ] - new file size
- */
-LIB_EXPORT rc_t CC KFileSetSize ( KFile *self, uint64_t size )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcResizing, rcSelf, rcNull );
-
-    if ( ! self -> write_enabled )
-        return RC ( rcFS, rcFile, rcResizing, rcFile, rcNoPerm );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . set_size ) ( self, size );
-    }
-
-    return RC ( rcFS, rcFile, rcResizing, rcInterface, rcBadVersion );
-}
-
-/* Read
- *  read file from known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT ] - number of bytes actually read
- */
-LIB_EXPORT rc_t CC KFileRead ( const KFile *self, uint64_t pos,
-    void *buffer, size_t bsize, size_t *num_read )
-{
-    if ( num_read == NULL )
-        return RC ( rcFS, rcFile, rcReading, rcParam, rcNull );
-
-    * num_read = 0;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcReading, rcSelf, rcNull );
-
-    if ( ! self -> read_enabled )
-        return RC ( rcFS, rcFile, rcReading, rcFile, rcNoPerm );
-
-    if ( buffer == NULL )
-        return RC ( rcFS, rcFile, rcReading, rcBuffer, rcNull );
-    if ( bsize == 0 )
-        return RC ( rcFS, rcFile, rcReading, rcBuffer, rcInsufficient );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . read ) ( self, pos, buffer, bsize, num_read );
-    }
-
-    return RC ( rcFS, rcFile, rcReading, rcInterface, rcBadVersion );
-}
-
-LIB_EXPORT rc_t CC KFileTimedRead ( const KFile *self, uint64_t pos,
-    void *buffer, size_t bsize, size_t *num_read, struct timeout_t *tm )
-{
-    if ( num_read == NULL )
-        return RC ( rcFS, rcFile, rcReading, rcParam, rcNull );
-
-    * num_read = 0;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcReading, rcSelf, rcNull );
-
-    if ( ! self -> read_enabled )
-        return RC ( rcFS, rcFile, rcReading, rcFile, rcNoPerm );
-
-    if ( buffer == NULL )
-        return RC ( rcFS, rcFile, rcReading, rcBuffer, rcNull );
-    if ( bsize == 0 )
-        return RC ( rcFS, rcFile, rcReading, rcBuffer, rcInsufficient );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        if ( self -> vt -> v1 . min >= 2 )
-            return ( * self -> vt -> v1 . timed_read ) ( self, pos, buffer, bsize, num_read, tm );
-        if ( tm == NULL )
-            return ( * self -> vt -> v1 . read ) ( self, pos, buffer, bsize, num_read );
-        break;
-    }
-
-    return RC ( rcFS, rcFile, rcReading, rcInterface, rcBadVersion );
-}
-
-/* ReadAll
- *  read from file until "bsize" bytes have been retrieved
- *  or until end-of-input
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT ] - return parameter giving number of bytes
- *  actually read. when returned value is zero and return code is
- *  also zero, interpreted as end of file.
- */
-LIB_EXPORT rc_t CC KFileReadAll ( const KFile *self, uint64_t pos,
-    void *buffer, size_t bsize, size_t *num_read )
-{
-    rc_t rc;
-    uint8_t *b;
-    size_t total, count;
-
-    if ( num_read == NULL )
-        return RC ( rcFS, rcFile, rcReading, rcParam, rcNull );
-
-    * num_read = 0;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcReading, rcSelf, rcNull );
-
-    if ( ! self -> read_enabled )
-        return RC ( rcFS, rcFile, rcReading, rcFile, rcNoPerm );
-
-    if ( buffer == NULL )
-        return RC ( rcFS, rcFile, rcReading, rcBuffer, rcNull );
-    if ( bsize == 0 )
-        return RC ( rcFS, rcFile, rcReading, rcBuffer, rcInsufficient );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        count = 0;
-        rc = ( * self -> vt -> v1 . read ) ( self, pos, buffer, bsize, & count );
-        total = count;
-
-        if ( rc == 0 && count != 0 && count < bsize )
-        {
-            if ( self -> vt -> v1 . min >= 2 )
-            {
-                timeout_t no_block;
-                TimeoutInit ( & no_block, 0 );
-
-                for ( b = buffer; total < bsize; total += count )
-                {
-                    count = 0;
-                    rc = ( * self -> vt -> v1 . timed_read ) ( self, pos + total, b + total, bsize - total, & count, & no_block );
-                    if ( rc != 0 )
-                        break;
-                    if ( count == 0 )
-                        break;
-                }
-            }
-            else
-            {
-                for ( b = buffer; total < bsize; total += count )
-                {
-                    count = 0;
-                    rc = ( * self -> vt -> v1 . read ) ( self, pos + total, b + total, bsize - total, & count );
-                    if ( rc != 0 )
-                        break;
-                    if ( count == 0 )
-                        break;
-                }
-            }
-        }
-        break;
-    default:
-        return RC ( rcFS, rcFile, rcReading, rcInterface, rcBadVersion );
-    }
-
-    if ( total != 0 )
-    {
-        * num_read = total;
-        return 0;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KFileTimedReadAll ( const KFile *self, uint64_t pos,
-    void *buffer, size_t bsize, size_t *num_read, struct timeout_t *tm )
-{
-    rc_t rc;
-    uint8_t *b;
-    size_t total, count;
-
-    if ( num_read == NULL )
-        return RC ( rcFS, rcFile, rcReading, rcParam, rcNull );
-
-    * num_read = 0;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcReading, rcSelf, rcNull );
-
-    if ( ! self -> read_enabled )
-        return RC ( rcFS, rcFile, rcReading, rcFile, rcNoPerm );
-
-    if ( buffer == NULL )
-        return RC ( rcFS, rcFile, rcReading, rcBuffer, rcNull );
-    if ( bsize == 0 )
-        return RC ( rcFS, rcFile, rcReading, rcBuffer, rcInsufficient );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        if ( self -> vt -> v1 . min >= 2 )
-        {
-            count = 0;
-            rc = ( * self -> vt -> v1 . timed_read ) ( self, pos, buffer, bsize, & count, tm );
-            total = count;
-
-            if ( rc == 0 && count != 0 && count < bsize )
-            {
-                timeout_t no_block;
-                TimeoutInit ( & no_block, 0 );
-
-                for ( b = buffer; total < bsize; total += count )
-                {
-                    count = 0;
-                    rc = ( * self -> vt -> v1 . timed_read ) ( self, pos + total, b + total, bsize - total, & count, & no_block );
-                    if ( rc != 0 )
-                        break;
-                    if ( count == 0 )
-                        break;
-                }
-            }
-            break;
-        }
-
-        if ( tm == NULL )
-        {
-            for ( rc = 0, b = buffer, total = 0; total < bsize; total += count )
-            {
-                count = 0;
-                rc = ( * self -> vt -> v1 . read ) ( self, pos + total, b + total, bsize - total, & count );
-                if ( rc != 0 )
-                    break;
-                if ( count == 0 )
-                    break;
-            }
-            break;
-        }
-
-        /* no break */
-    default:
-        return RC ( rcFS, rcFile, rcReading, rcInterface, rcBadVersion );
-    }
-
-    if ( total != 0 )
-    {
-        * num_read = total;
-        return 0;
-    }
-
-    return rc;
-}
-
-/* ReadExactly
- * TimedReadExactly
- *  read from file until "bytes" have been retrieved
- *  or return incomplete transfer error
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ OUT ] and "bytes" [ IN ] - return buffer for read
- *
- *  "tm" [ IN/OUT, NULL OKAY ] - an optional indicator of
- *  blocking behavior. not all implementations will support
- *  timed reads. a NULL timeout will block indefinitely,
- *  a value of "tm->mS == 0" will have non-blocking behavior
- *  if supported by implementation, and "tm->mS > 0" will indicate
- *  a maximum wait timeout.
- */
-LIB_EXPORT rc_t CC KFileReadExactly ( const KFile *self,
-    uint64_t pos, void *buffer, size_t bytes )
-{
-    rc_t rc;
-    uint8_t *b;
-    size_t total, count;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcReading, rcSelf, rcNull );
-
-    if ( ! self -> read_enabled )
-        return RC ( rcFS, rcFile, rcReading, rcFile, rcNoPerm );
-
-    if ( bytes == 0 )
-        return 0;
-    if ( buffer == NULL )
-        return RC ( rcFS, rcFile, rcReading, rcBuffer, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        assert ( bytes != 0 );
-        for ( b = buffer, total = 0; total < bytes; total += count )
-        {
-            count = 0;
-            rc = ( * self -> vt -> v1 . read ) ( self, pos + total, b + total, bytes - total, & count );
-            if ( rc != 0 )
-            {
-                if ( GetRCObject ( rc ) != rcTimeout || GetRCState ( rc ) != rcExhausted )
-                    break;
-            }
-            else if ( count == 0 )
-            {
-                rc = RC ( rcFS, rcFile, rcReading, rcTransfer, rcIncomplete );
-                break;
-            }
-        }
-        break;
-    default:
-        rc = RC ( rcFS, rcFile, rcReading, rcInterface, rcBadVersion );
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KFileTimedReadExactly ( const KFile *self,
-    uint64_t pos, void *buffer, size_t bytes, struct timeout_t *tm )
-{
-    rc_t rc;
-    uint8_t *b;
-    size_t total, count;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcReading, rcSelf, rcNull );
-
-    if ( ! self -> read_enabled )
-        return RC ( rcFS, rcFile, rcReading, rcFile, rcNoPerm );
-
-    if ( bytes == 0 )
-        return 0;
-    if ( buffer == NULL )
-        return RC ( rcFS, rcFile, rcReading, rcBuffer, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        if ( self -> vt -> v1 . min >= 2 )
-        {
-            assert ( bytes != 0 );
-            for ( b = buffer, total = 0; total < bytes; total += count )
-            {
-                count = 0;
-                rc = ( * self -> vt -> v1 . timed_read ) ( self, pos + total, b + total, bytes - total, & count, tm );
-                if ( rc != 0 )
-                {
-                    if ( tm != NULL )
-                        break;
-                    if ( GetRCObject ( rc ) != rcTimeout || GetRCState ( rc ) != rcExhausted )
-                        break;
-                }
-                else if ( count == 0 )
-                {
-                    rc = RC ( rcFS, rcFile, rcReading, rcTransfer, rcIncomplete );
-                    break;
-                }
-            }
-            break;
-        }
-
-        if ( tm == NULL )
-        {
-            assert ( bytes != 0 );
-            for ( b = buffer, total = 0; total < bytes; total += count )
-            {
-                count = 0;
-                rc = ( * self -> vt -> v1 . read ) ( self, pos + total, b + total, bytes - total, & count );
-                if ( rc != 0 )
-                {
-                    if ( GetRCObject ( rc ) != rcTimeout || GetRCState ( rc ) != rcExhausted )
-                        break;
-                }
-                else if ( count == 0 )
-                {
-                    rc = RC ( rcFS, rcFile, rcReading, rcTransfer, rcIncomplete );
-                    break;
-                }
-            }
-            break;
-        }
-
-        /* no break */
-    default:
-        return RC ( rcFS, rcFile, rcReading, rcInterface, rcBadVersion );
-    }
-
-    return rc;
-}
-
-/* Write
- *  write file at known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ IN ] and "size" [ IN ] - data to be written
- *
- *  "num_writ" [ OUT ] - number of bytes actually written
- */
-LIB_EXPORT rc_t CC KFileWrite ( KFile *self, uint64_t pos,
-    const void *buffer, size_t size, size_t *num_writ )
-{
-    size_t ignore;
-    if ( num_writ == NULL )
-        num_writ = & ignore;
-
-    * num_writ = 0;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcWriting, rcSelf, rcNull );
-
-    if ( ! self -> write_enabled )
-        return RC ( rcFS, rcFile, rcWriting, rcFile, rcNoPerm );
-
-    if ( size == 0 )
-        return 0;
-    if ( buffer == NULL )
-        return RC ( rcFS, rcFile, rcWriting, rcBuffer, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . write ) ( self, pos, buffer, size, num_writ );
-    }
-
-    return RC ( rcFS, rcFile, rcWriting, rcInterface, rcBadVersion );
-}
-
-LIB_EXPORT rc_t CC KFileTimedWrite ( KFile *self, uint64_t pos,
-    const void *buffer, size_t size, size_t *num_writ, struct timeout_t *tm )
-{
-    size_t ignore;
-    if ( num_writ == NULL )
-        num_writ = & ignore;
-
-    * num_writ = 0;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcWriting, rcSelf, rcNull );
-
-    if ( ! self -> write_enabled )
-        return RC ( rcFS, rcFile, rcWriting, rcFile, rcNoPerm );
-
-    if ( size == 0 )
-        return 0;
-    if ( buffer == NULL )
-        return RC ( rcFS, rcFile, rcWriting, rcBuffer, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        if ( self -> vt -> v1 . min >= 2 )
-            return ( * self -> vt -> v1 . timed_write ) ( self, pos, buffer, size, num_writ, tm );
-        if ( tm == NULL )
-            return ( * self -> vt -> v1 . write ) ( self, pos, buffer, size, num_writ );
-        break;
-    }
-
-    return RC ( rcFS, rcFile, rcWriting, rcInterface, rcBadVersion );
-}
-
-/* WriteAll
- *  write from file until "size" bytes have been transferred
- *  or until no further progress can be made
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ IN ] and "size" [ IN ] - data to be written
- *
- *  "num_writ" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually written
- */
-LIB_EXPORT rc_t CC KFileWriteAll ( KFile *self, uint64_t pos,
-    const void *buffer, size_t size, size_t *num_writ )
-{
-    rc_t rc;
-    const uint8_t *b;
-    size_t total, count;
-
-    size_t ignore;
-    if ( num_writ == NULL )
-        num_writ = & ignore;
-
-    * num_writ = 0;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcWriting, rcSelf, rcNull );
-
-    if ( ! self -> write_enabled )
-        return RC ( rcFS, rcFile, rcWriting, rcFile, rcNoPerm );
-
-    if ( size == 0 )
-        return 0;
-    if ( buffer == NULL )
-        return RC ( rcFS, rcFile, rcWriting, rcBuffer, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        count = 0;
-        rc = ( * self -> vt -> v1 . write ) ( self, pos, buffer, size, & count );
-        total = count;
-
-        if ( rc == 0 && count != 0 && count < size )
-        {
-            if ( self -> vt -> v1 . min >= 2 )
-            {
-                timeout_t no_block;
-                TimeoutInit ( & no_block, 0 );
-
-                for ( b = buffer; total < size; total += count )
-                {
-                    count = 0;
-                    rc = ( * self -> vt -> v1 . timed_write ) ( self, pos + total, b + total, size - total, & count, & no_block );
-                    if ( rc != 0 )
-                        break;
-                    if ( count == 0 )
-                        break;
-                }
-            }
-            else
-            {
-                for ( b = buffer; total < size; total += count )
-                {
-                    count = 0;
-                    rc = ( * self -> vt -> v1 . write ) ( self, pos + total, b + total, size - total, & count );
-                    if ( rc != 0 )
-                        break;
-                    if ( count == 0 )
-                        break;
-                }
-            }
-        }
-        break;
-    default:
-        return RC ( rcFS, rcFile, rcWriting, rcInterface, rcBadVersion );
-    }
-
-    * num_writ = total;
-    if ( total == size )
-        return 0;
-    if ( rc == 0 )
-        return RC ( rcFS, rcFile, rcWriting, rcTransfer, rcIncomplete );
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KFileTimedWriteAll ( KFile *self, uint64_t pos,
-    const void *buffer, size_t size, size_t *num_writ, struct timeout_t *tm )
-{
-    rc_t rc;
-    const uint8_t *b;
-    size_t total, count;
-
-    size_t ignore;
-    if ( num_writ == NULL )
-        num_writ = & ignore;
-
-    * num_writ = 0;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcWriting, rcSelf, rcNull );
-
-    if ( ! self -> write_enabled )
-        return RC ( rcFS, rcFile, rcWriting, rcFile, rcNoPerm );
-
-    if ( size == 0 )
-        return 0;
-    if ( buffer == NULL )
-        return RC ( rcFS, rcFile, rcWriting, rcBuffer, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        if ( self -> vt -> v1 . min >= 2 )
-        {
-            for ( rc = 0, b = buffer, total = 0; total < size; total += count )
-            {
-                count = 0;
-                rc = ( * self -> vt -> v1 . timed_write ) ( self, pos + total, b + total, size - total, & count, tm );
-                if ( rc != 0 )
-                    break;
-                if ( count == 0 )
-                    break;
-            }
-            break;
-        }
-
-        if ( tm == NULL )
-        {
-            for ( rc = 0, b = buffer, total = 0; total < size; total += count )
-            {
-                count = 0;
-                rc = ( * self -> vt -> v1 . write ) ( self, pos + total, b + total, size - total, & count );
-                if ( rc != 0 )
-                    break;
-                if ( count == 0 )
-                    break;
-            }
-            break;
-        }
-
-        /* no break */
-
-    default:
-        return RC ( rcFS, rcFile, rcWriting, rcInterface, rcBadVersion );
-    }
-
-    * num_writ = total;
-    if ( total == size )
-        return 0;
-    if ( rc == 0 )
-        return RC ( rcFS, rcFile, rcWriting, rcTransfer, rcIncomplete );
-    return rc;
-}
-
-/* Init
- *  initialize a newly allocated file object
- */
-LIB_EXPORT rc_t CC KFileInit ( KFile *self, const KFile_vt *vt,
-    const char *classname, const char *fname,
-    bool read_enabled, bool write_enabled )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcConstructing, rcSelf, rcNull );
-    if ( vt == NULL )
-        return RC ( rcFS, rcFile, rcConstructing, rcInterface, rcNull );
-    switch ( vt -> v1 . maj )
-    {
-    case 0:
-        return RC ( rcFS, rcFile, rcConstructing, rcInterface, rcInvalid );
-
-    case 1:
-        switch ( vt -> v1 . min )
-        {
-            /* ADD NEW MINOR VERSION CASES HERE */
-        case 2:
-#if _DEBUGGING
-            if ( vt -> v1 . timed_write == NULL ||
-                 vt -> v1 . timed_read == NULL )
-                return RC ( rcFS, rcFile, rcConstructing, rcInterface, rcNull );
-#endif
-        case 1:
-#if _DEBUGGING
-            if ( vt -> v1 . get_type == NULL )
-                return RC ( rcFS, rcFile, rcConstructing, rcInterface, rcNull );
-#endif
-            /* no break */
-        case 0:
-#if _DEBUGGING
-        if ( vt -> v1 . write == NULL         ||
-             vt -> v1 . read == NULL          ||
-             vt -> v1 . set_size == NULL      ||
-             vt -> v1 . get_size == NULL      ||
-             vt -> v1 . random_access == NULL ||
-             vt -> v1 . get_sysfile == NULL   ||
-             vt -> v1 . destroy == NULL )
-        return RC ( rcFS, rcFile, rcConstructing, rcInterface, rcNull );
-#endif
-            break;
-        default:
-            return RC ( rcFS, rcFile, rcConstructing, rcInterface, rcBadVersion );
-        }
-        break;
-
-    default:
-        return RC ( rcFS, rcFile, rcConstructing, rcInterface, rcBadVersion );
-    }
-
-    self -> vt = vt;
-    self -> dir = NULL;
-    KRefcountInit ( & self -> refcount, 1, classname, "init", fname );
-    self -> read_enabled = ( uint8_t ) ( read_enabled != 0 );
-    self -> write_enabled = ( uint8_t ) ( write_enabled != 0 );
-
-    return 0;
-}
diff --git a/libs/kfs/fileformat-priv.h b/libs/kfs/fileformat-priv.h
deleted file mode 100644
index 4f19e62..0000000
--- a/libs/kfs/fileformat-priv.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_fileformat_priv_
-#define _h_fileformat_priv_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-#if 0
-}
-#endif
-
-#include <klib/debug.h>
-
-#define	DEBUG_KFF	1
-
-#ifndef	DEBUG_KFF
-#define	DEBUG_KFF	0
-#endif
-
-#ifdef _DEBUGGING
-#define FUNC_ENTRY() /* DBGMSG (DBG_KFS, DBG_FLAG(DBG_KFS_KFFENTRY), ("Enter: %s\n", __func__)) */
-#define KFF_DEBUG(msg) DBGMSG (DBG_KFS, DBG_FLAG(DBG_KFS_KFF), msg)
-#else
-#define FUNC_ENTRY()
-#define KFF_DEBUG(msg)
-#endif
-
-#define KFILEFORMAT_LATEST 1
-
-#define DESCRLEN_MAX	(256)
-
-typedef struct KFFTables KFFTables;
-/* -----
- * KFFTablesMake
- *	Build the tables that contain classes and types.
- *
- * This make installs only a default "unknown" description which
- * will end up with class id and file id of 0.  This FileId 0 will
- * be in class with id of 0.
- */
-rc_t KFFTablesMake (KFFTables ** kmmtp);
-
-/* -----
- * KFFTablesAddClass
- *	Add class with description (descr) to the tables
- *	new class id is returned to where pclass points.
- *	if pclass is NULL the new ID is not returned
- */
-rc_t KFFTablesAddClass (KFFTables * self,
-			KFileFormatClass * pclass, /* returned new ID */
-			const char * descr,
-			size_t descrlen);
-
-/* -----
- * KFFTablesAddType
- *	Add type with description (descr) to the tables
- *	new type id is returned to where ptype points.
- *	if ptype is NULL the new ID is not returned
- *	the new type will be in the refered class
- */
-rc_t KFFTablesAddType (KFFTables * self,
-		       KFileFormatType * ptype, /* returned new ID */
-		       const char * class,
-		       const char * type,
-		       size_t clen,
-		       size_t tlen);
-
-rc_t KFFTablesAddRef (const KFFTables * self);
-rc_t KFFTablesRelease (const KFFTables * cself);
-
-rc_t KFFTablesGetClassDescr (const KFFTables * self,
-			     KFileFormatClass tid,
-			     size_t * len,
-			     char ** pd);
-rc_t KFFTablesGetTypeDescr (const KFFTables * self,
-			    KFileFormatType tid,
-			    size_t * len,
-			    char ** pd);
-rc_t KFFTablesGetClassId (const KFFTables * self,
-			  const char ** pd,
-			  KFileFormatClass * cid);
-rc_t KFFTablesGetTypeId (const KFFTables * self,
-			 const char * pd,
-			 KFileFormatType * tid,
-			 KFileFormatClass * cid);
-
-
-
-
-
-
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_fileformat_priv_ */
diff --git a/libs/kfs/fileformat.c b/libs/kfs/fileformat.c
deleted file mode 100644
index 5c334c8..0000000
--- a/libs/kfs/fileformat.c
+++ /dev/null
@@ -1,290 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kfs/extern.h>
-#include <klib/rc.h>
-#include <kfs/fileformat.h>
-#include <klib/log.h>
-#include <klib/debug.h>
-#include <sysalloc.h>
-
-
-/* #include <kfs/directory.h> */
-
-#include "impl.h"
-
-#include <stdio.h> /* remove after debugging */
-#include <ctype.h>
-#include <string.h>
-
-struct KDirectory;
-
-
-/*--------------------------------------------------------------------------
- * KFileFormat
- *  
- */
-
-
-/* Destroy
- *  destroy file
- */
-rc_t CC KFileFormatDestroy ( KFileFormat *self )
-{
-    FUNC_ENTRY();
-
-    if (self == NULL)
-        return RC (rcFS, rcFile, rcDestroying, rcSelf, rcNull);
-
-    switch (self->vt->v1 . maj)
-    {
-    case 1:
-        return (* self->vt->v1 . destroy) (self);
-    }
-
-    return RC (rcFS, rcFile, rcDestroying, rcInterface, rcBadVersion);
-}
-
-/* AddRef
- *  creates a new reference
- *  ignores NULL references
- */
-LIB_EXPORT rc_t CC KFileFormatAddRef ( const KFileFormat *self )
-{
-    FUNC_ENTRY();
-    if (self != NULL)
-        atomic32_inc (& ((KFileFormat*) self)->refcount);
-    return 0;
-}
-
-/* Release
- *  discard reference to file
- *  ignores NULL references
- */
-LIB_EXPORT rc_t CC KFileFormatRelease ( const KFileFormat *cself )
-{
-    FUNC_ENTRY();
-    if (cself != NULL)
-    {
-	KFileFormat *self = (KFileFormat*)cself;
-        if (atomic32_dec_and_test (&self->refcount))
-	    return  KFileFormatDestroy (self);
-    }
-    return 0;
-}
-
-
-/* Type
- *  returns a KFileFormatDesc
- *  [OUT] rc_t               return
- *  [IN]  const KFileFormat *  self         
- *  [IN]  void **            buffer       buffer to hold returned description
- *  [IN]  size_t             buffer_size  size of the buffer
- *  [OUT] char **            descr        text description of file type
- *  [IN]  size_t             descr_max    maximum size of string descr can hold
- *  [OUT] size_t *           descr_len    length of returned descr (not including NUL
- */
-LIB_EXPORT rc_t CC KFileFormatGetTypePath ( const KFileFormat *self, 
-			     const struct KDirectory * dir, const char * path,
-			     KFileFormatType * type, KFileFormatClass * class,
-			     char * description, size_t descriptionmax,
-			     size_t * descriptionlength )
-{
-    FUNC_ENTRY();
-
-    if (self == NULL)
-        return RC (rcFF, rcFileFormat, rcClassifying, rcSelf, rcNull);
-
-    switch (self->vt->v1.maj)
-    {
-    case 1:
-        if (self->vt->v1.min >= 1)
-	    return (* self->vt->v1 . gettypepath) (self, dir, path, type, class,
-						   description, descriptionmax,
-						   descriptionlength);
-        break;
-    }
-    return RC (rcFF, rcFileFormat, rcClassifying, rcInterface, rcBadVersion);
-}
-
-LIB_EXPORT rc_t CC KFileFormatGetTypeBuff ( const KFileFormat *self, const void * buff, size_t buff_len,
-			     KFileFormatType * type, KFileFormatClass * class,
-			     char * description, size_t descriptionmax,
-			     size_t * descriptionlength )
-{
-    FUNC_ENTRY();
-
-    if (self == NULL)
-        return RC (rcFF, rcFileFormat, rcClassifying, rcSelf, rcNull);
-
-    switch (self->vt->v1.maj)
-    {
-    case 1:
-        if (self->vt->v1.min >= 1)
-	    return (* self->vt->v1 . gettypebuff) (self, buff, buff_len, type, class,
-						   description, descriptionmax,
-						   descriptionlength);
-        break;
-    }
-    return RC (rcFF, rcFileFormat, rcClassifying, rcInterface, rcBadVersion);
-}
-
-LIB_EXPORT rc_t CC KFileFormatGetClassDescr ( const KFileFormat *self, KFileFormatClass c,
-			       char * description, size_t descriptionmax )
-{
-    rc_t rc;
-    size_t max;
-
-#undef ERROR
-#define ERROR "ERROR"
-#undef NOT_FOUND
-#define NOT_FOUND "NOT FOUND"
-
-    FUNC_ENTRY();
-
-    if (c < kffcError)
-    {
-    error:
-	max = (sizeof (ERROR) > descriptionmax-1) ? descriptionmax-1 : sizeof (ERROR)-1;
-	memcpy (description, ERROR, max);
-	description[max] = '\0';
-	return 0;
-    }
-    else if (c == kffcNotFound)
-    {
-	max = (sizeof (NOT_FOUND) > descriptionmax-1) ? descriptionmax-1 : sizeof (NOT_FOUND)-1;
-	memcpy (description, NOT_FOUND, max);
-	description[max] = '\0';
-	return 0;
-    }
-    else
-    {
-	char * cp;
-	size_t z;
-
-	rc = KFFTablesGetClassDescr(self->tables, c, &z, &cp);
-	if (rc)
-	    goto error;
-	max = (z > descriptionmax-1) ? descriptionmax-1 : z;
-	memcpy (description, cp, max);
-	description[max] = '\0';
-	return 0;
-    }
-
-#undef ERROR
-#undef NOT_FOUND
-}
-static
-rc_t KFileFormatInitTypeAndClass (KFileFormat *self, const char * typeAndClass,
-			    size_t len)
-{
-    rc_t rc;
-    const char * type;
-    const char * class;
-    const char * tab;
-    const char * newline;
-    const char * line;
-    const char * limit;
-
-    FUNC_ENTRY();
-
-    rc = 0;
-    limit = typeAndClass + len;
-    for (line = typeAndClass; line < limit; line = newline+1)
-    {
-	for (type = line; isspace (*type) && len; len--, type++)
-	{
-	    if (len == 0)
-		break;
-	}
-	newline = memchr (type, '\n', len);
-	if (newline == NULL)
-	    newline = type + len;
-	if (*type == '#')
-	{
-	    /* -----
-	     * skip this line
-	     */
-	    len -= newline+1 - type;
-	    continue;
-	}
-	tab = memchr (type, '\t', len);
-	if (tab == NULL)
-	{
-	    rc = RC (rcFF, rcFileFormat, rcConstructing, rcFile, rcInvalid);
-	    LOGERR (klogFatal, rc, "No <TAB> between type and class");
-	    break;
-	}
-	class = tab + 1;
-	for ( len -= class - line;
-	      isspace (*class); len--, class++)
-	{
-	    if (len == 0)
-	    {
-		rc = RC (rcFF, rcFileFormat, rcConstructing, rcFile, rcInvalid);
-		LOGERR (klogFatal, rc, "No class after <TAB>");
-		break;
-	    }
-	}
-	if (newline == class)
-	{
-	    rc = RC (rcFF, rcFileFormat, rcConstructing, rcFile, rcInvalid);
-	    LOGERR (klogFatal, rc, "No class after whitespace");
-	    break;
-	}
-	rc = KFFTablesAddType (self->tables, NULL, class, type, newline-class, tab-type);
-	if (rc != 0)
-	    break;
-    }
-
-    return rc;
-}
-
-rc_t CC KFileFormatInit ( KFileFormat *self, const KFileFormat_vt *vt,
-		      const char * typeAndClass, size_t len )
-{
-    rc_t rc = 0;
-
-    FUNC_ENTRY();
-
-    self->vt = vt;
-    atomic32_set (&self->refcount,1);
-
-    rc = KFFTablesMake(&self->tables);
-    if (rc == 0)
-    {
-	rc = KFileFormatInitTypeAndClass (self, typeAndClass, len);
-
-
-        /* memory leak?  If Tables Make succeeds and InitType and Class fails do we leak? */
-
-    }
-    return rc;
-}
-
-
-
-
diff --git a/libs/kfs/from_to_namelist.c b/libs/kfs/from_to_namelist.c
deleted file mode 100644
index a3c8390..0000000
--- a/libs/kfs/from_to_namelist.c
+++ /dev/null
@@ -1,307 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-#include <kfs/extern.h>
-
-#include <klib/rc.h>
-#include <klib/log.h>
-#include <klib/text.h>
-#include <klib/printf.h>
-#include <klib/namelist.h>
-
-#include <kfs/file.h>
-#include <kfs/directory.h>
-
-#include <sysalloc.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-/* ****************************************************************************************** */
-
-
-#define STATE_ALPHA 0
-#define STATE_LF 1
-#define STATE_NL 2
-
-
-typedef struct buffer_range
-{
-    const char * start;
-    uint32_t processed, count, state;
-} buffer_range;
-
-
-static const char empty_str[ 2 ] = { ' ', 0 };
-
-
-static void LoadFromBuffer( VNamelist * nl, buffer_range * range )
-{
-    uint32_t idx;
-    const char * p = range->start;
-    String S;
-
-    S.addr = p;
-    S.len = S.size = range->processed;
-    for ( idx = range->processed; idx < range->count; ++idx )
-    {
-        switch( p[ idx ] )
-        {
-            case 0x0A : switch( range->state )
-                        {
-                            case STATE_ALPHA : /* ALPHA --> LF */
-                                                VNamelistAppendString ( nl, &S );
-                                                range->state = STATE_LF;
-                                                break;
-
-                            case STATE_LF : /* LF --> LF */
-                                             VNamelistAppend ( nl, empty_str );
-                                             break;
-
-                            case STATE_NL : /* NL --> LF */
-                                             VNamelistAppend ( nl, empty_str );
-                                             range->state = STATE_LF;
-                                             break;
-                        }
-                        break;
-
-            case 0x0D : switch( range->state )
-                        {
-                            case STATE_ALPHA : /* ALPHA --> NL */
-                                                VNamelistAppendString ( nl, &S );
-                                                range->state = STATE_NL;
-                                                break;
-
-                            case STATE_LF : /* LF --> NL */
-                                             range->state = STATE_NL;
-                                             break;
-
-                            case STATE_NL : /* NL --> NL */
-                                             VNamelistAppend ( nl, empty_str );
-                                             break;
-                        }
-                        break;
-
-            default   : switch( range->state )
-                        {
-                            case STATE_ALPHA : /* ALPHA --> ALPHA */
-                                                S.len++; S.size++;
-                                                break;
-
-                            case STATE_LF : /* LF --> ALPHA */
-                                             S.addr = &p[ idx ]; S.len = S.size = 1;
-                                             range->state = STATE_ALPHA;
-                                             break;
-
-                            case STATE_NL : /* NL --> ALPHA */
-                                             S.addr = &p[ idx ]; S.len = S.size = 1;
-                                             range->state = STATE_ALPHA;
-                                             break;
-                        }
-                        break;
-        }
-    }
-    if ( range->state == STATE_ALPHA )
-    {
-        range->start = S.addr;
-        range->count = S.len;
-    }
-    else
-        range->count = 0;
-}
-
-
-static rc_t LoadFromFile( struct KFile const * f, VNamelist * nl )
-{
-    rc_t rc = 0;
-    uint64_t pos = 0;
-    char buffer[ 4096 ];
-    buffer_range range;
-    bool done = false;
-
-    range.start = buffer;
-    range.count = 0;
-    range.processed = 0;
-    range.state = STATE_ALPHA;
-
-    do
-    {
-        size_t num_read;
-        rc = KFileRead ( f, pos, ( char * )( range.start + range.processed ),
-                        ( sizeof buffer ) - range.processed, &num_read );
-        if ( rc == 0 )
-        {
-            done = ( num_read == 0 );
-            if ( !done )
-            {
-                range.start = buffer;
-                range.count = range.processed + num_read;
-
-                LoadFromBuffer( nl, &range );
-                if ( range.count > 0 )
-                {
-                    memmove ( buffer, range.start, range.count );
-                }
-                range.start = buffer;
-                range.processed = range.count;
-
-                pos += num_read;
-            }
-            else if ( range.state == STATE_ALPHA )
-            {
-                String S;
-                S.addr = range.start;
-                S.len = S.size = range.count;
-                VNamelistAppendString ( nl, &S );
-            }
-        }
-    } while ( rc == 0 && !done );
-
-    return rc;
-}
-
-
-/* -----
-
- * loads the content of a KFile into a Namelist
- *
- */
-LIB_EXPORT rc_t CC LoadKFileToNameList( struct KFile const * self, VNamelist * namelist )
-{
-    rc_t rc;
-    if ( self == NULL )
-        rc = RC( rcFS, rcFile, rcValidating, rcSelf, rcNull );
-    else if ( namelist == NULL )
-        rc = RC( rcFS, rcFile, rcValidating, rcParam, rcNull );
-    else
-        rc = LoadFromFile( self, namelist );
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC LoadFileByNameToNameList( VNamelist * namelist, const char * filename )
-{
-    rc_t rc;
-    if ( namelist == NULL || filename == NULL )
-        rc = RC( rcFS, rcFile, rcValidating, rcParam, rcNull );
-    else
-    {
-        KDirectory * dir;
-        rc = KDirectoryNativeDir ( &dir );
-        if ( rc == 0 )
-        {
-            KFile const * f;
-            rc = KDirectoryOpenFileRead ( dir, &f, "%s", filename );
-            if ( rc == 0 )
-            {
-                if ( rc == 0 )
-                    rc = LoadFromFile( f, namelist );
-                KFileRelease ( f );
-            }
-            KDirectoryRelease ( dir );
-        }
-    }
-    return rc;
-
-}
-
-
-static rc_t SaveToFile( struct KFile * f, const VNamelist * nl, const char * delim )
-{
-    uint32_t count;
-    rc_t rc = VNameListCount ( nl, &count );
-    if ( rc == 0 && count > 0 )
-    {
-        uint32_t idx;
-        uint64_t pos = 0;
-        for ( idx = 0; idx < count && rc == 0; ++idx )
-        {
-            const char * s;
-            rc = VNameListGet ( nl, idx, &s );
-            if ( rc == 0 && s != NULL )
-            {
-                size_t num_writ;
-                rc = KFileWriteAll ( f, pos, s, string_size ( s ), &num_writ );
-                if ( rc == 0 )
-                {
-                    pos += num_writ;
-                    rc = KFileWriteAll ( f, pos, delim, string_size ( delim ), &num_writ );
-                    if ( rc == 0 )
-                        pos += num_writ;
-                }
-            }
-        }
-        if ( rc == 0 )
-            rc = KFileSetSize ( f, pos );
-    }
-    return rc;
-}
-
-/* -----
-
- * writes content of a Namelist into a KFile
- *
- */
-
-LIB_EXPORT rc_t CC WriteNameListToKFile( struct KFile * self, const VNamelist * namelist, 
-                                         const char * delim )
-{
-    rc_t rc;
-    if ( self == NULL )
-        rc = RC( rcFS, rcFile, rcValidating, rcSelf, rcNull );
-    else if ( namelist == NULL )
-        rc = RC( rcFS, rcFile, rcValidating, rcParam, rcNull );
-    else
-        rc = SaveToFile( self, namelist, delim );
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC WriteNamelistToFileByName( const VNamelist * namelist, const char * filename,
-                                              const char * delim )
-{
-    rc_t rc;
-    if ( namelist == NULL || filename == NULL || delim == NULL )
-        rc = RC( rcFS, rcFile, rcValidating, rcParam, rcNull );
-    else
-    {
-        KDirectory * dir;
-        rc = KDirectoryNativeDir ( &dir );
-        if ( rc == 0 )
-        {
-            KFile * f;
-            rc = KDirectoryCreateFile ( dir, &f, true, 0664, kcmCreate, filename );
-            if ( rc == 0 )
-            {
-                if ( rc == 0 )
-                    rc = SaveToFile( f, namelist, delim );
-                KFileRelease ( f );
-            }
-            KDirectoryRelease ( dir );
-        }
-    }
-    return rc;
-}
\ No newline at end of file
diff --git a/libs/kfs/gzip.c b/libs/kfs/gzip.c
deleted file mode 100644
index beb22fb..0000000
--- a/libs/kfs/gzip.c
+++ /dev/null
@@ -1,646 +0,0 @@
-/*==============================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-struct KGZipFile;
-#define KFILE_IMPL struct KGZipFile
-
-#include <kfs/extern.h>
-#include <kfs/impl.h>  /* KFile_vt_v1 */
-#include <kfs/gzip.h>  /* KFileMakeGzipFor... */
-#include <klib/debug.h>
-#include <klib/rc.h>
-#include <klib/out.h>
-#include <sysalloc.h>
-
-#include <zlib.h>      /* z_stream */
-#include <assert.h>
-#include <stdlib.h>    /* malloc */
-#include <string.h> /* memset */
-
-#ifdef _DEBUGGING
-#define GZIP_DEBUG(msg) DBGMSG(DBG_KFS,DBG_FLAG(DBG_KFS_GZIP), msg)
-#else
-#define GZIP_DEBUG(msg)
-#endif
-
-/***************************************************************************************/
-/* Gzip File                                                                     */
-/***************************************************************************************/
-
-#define GZFCHUNK 0x20000    /* 128K */
-/** Gzip KFile structure */
-struct KGZipFile {
-    KFile dad;
-    KFile *file; /* inderlying KFile */
-    uint64_t filePosition;
-    uint64_t myPosition;
-    z_stream strm;
-    unsigned char buff[GZFCHUNK]; /* buffer to cache KFile data */
-    bool completed;
-};
-typedef struct KGZipFile KGZipFile;
-
-/* virtual functions declarations (definitions for unsupported ) ***********************/
-
-static struct KSysFile *CC s_GetSysFile(const KGZipFile *self,
-    uint64_t *offset)
-{ return NULL; }
-
-static rc_t CC s_FileRandomAccess(const KGZipFile *self)
-{ return RC ( rcFS, rcFile, rcAccessing, rcFunction, rcUnsupported ); }
-
-static uint32_t CC s_FileType ( const KGZipFile *self )
-{ return KFileType ( self -> file ); }
-
-static rc_t CC s_FileSize(const KGZipFile *self, uint64_t *size)
-{ return RC ( rcFS, rcFile, rcAccessing, rcFunction, rcUnsupported ); }
-
-static rc_t CC s_FileSetSize(KGZipFile *self,
-    uint64_t size)
-{ return RC ( rcFS, rcFile, rcUpdating, rcFunction, rcUnsupported ); }
-
-/* read-only methods *******************************************************************/
-
-static rc_t CC KGZipFile_InDestroy(KGZipFile *self);
-
-static rc_t CC KGZipFile_InRead(const KGZipFile *cself,
-    uint64_t pos,
-    void *buffer,
-    size_t bsize,
-    size_t *num_read);
-
-static rc_t CC KGZipFile_InWrite(KGZipFile *self,
-    uint64_t pos,
-    const void *buffer,
-    size_t size,
-    size_t *num_writ)
-{ return RC ( rcFS, rcFile, rcWriting, rcFunction, rcUnsupported ); }
-
-/** virtual table **********************************************************************/
-static KFile_vt_v1 s_vtKFile_InGz = {
-    /* version */
-    1, 1,
-
-    /* 1.0 */
-    KGZipFile_InDestroy,
-    s_GetSysFile,
-    s_FileRandomAccess,
-    s_FileSize,
-    s_FileSetSize,
-    KGZipFile_InRead,
-    KGZipFile_InWrite,
-
-    /* 1.1 */
-    s_FileType
-};
-
-#define WINDOW_BITS (15 + 16)
-
-/** Factory method definition **********************************************************/
-
-LIB_EXPORT rc_t CC KFileMakeGzipForRead( const struct KFile **result,
-    const struct KFile *file )
-{
-    rc_t rc;
-    z_stream* strm;
-    KGZipFile *obj;
-
-    if ( result == NULL || file == NULL )
-        return RC ( rcFS, rcFile, rcConstructing, rcParam, rcNull );
-
-    obj = (KGZipFile*) malloc(sizeof(KGZipFile));
-    if (!obj)
-        return RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-
-    rc = KFileInit(&obj->dad, (const KFile_vt*) &s_vtKFile_InGz, "KGZipFile", "no-name", true, false);
-    if (rc != 0) {
-        free(obj);
-        return rc;
-    }
-
-    strm = &obj->strm;
-    strm->zalloc   = Z_NULL;
-    strm->zfree    = Z_NULL;
-    strm->opaque   = Z_NULL;
-    strm->avail_in = 0;
-    strm->next_in  = Z_NULL;
-
-    /* TBD - this should check gzlib error codes */
-    if (inflateInit2(strm, WINDOW_BITS) != Z_OK) {
-        free(obj);
-        return RC ( rcFS, rcFile, rcConstructing, rcNoObj, rcUnknown );
-    }
-
-        obj->myPosition   = 0;
-        obj->filePosition = 0;
-
-    rc = KFileAddRef(file);
-    if ( rc != 0 )
-    {
-        obj->file = NULL;
-        KGZipFile_InDestroy ( obj );
-    }
-    else
-    {
-        obj->file = (KFile*) file;
-        obj->completed = true; /* we could have an empty file and this would be okay */
-        *result = &obj->dad;
-    }
-
-    return rc;
-}
-
-/* private functions declarations ******************************************************/
-
-static rc_t z_read ( KGZipFile * self, void * buffer, size_t bsize, size_t * num_read );
-static rc_t z_skip (KGZipFile *self, uint64_t pos);
-
-/* virtual functions definitions *******************************************************/
-
-static rc_t CC KGZipFile_InDestroy(KGZipFile *self) {
-    rc_t rc = KFileRelease(self->file);
-    if (rc == 0) {
-        inflateEnd(&self->strm);
-        free(self);
-    }
-
-    return rc;
-}
-
-static rc_t CC KGZipFile_InRead(const KGZipFile *cself,
-    uint64_t pos,
-    void *buffer,
-    size_t bsize,
-    size_t *num_read)
-{
-    KGZipFile *self = (KGZipFile*) cself;
-    rc_t rc = 0;
-
-    size_t numRead = 0, ignore;
-    if (!num_read)
-    {   num_read = &ignore; }
-
-    *num_read = 0;
-
-    if (!cself || !buffer)
-        return RC ( rcFS, rcFile, rcReading, rcParam, rcNull );
-
-    if (!bsize)
-    {   return 0; }
-
-    if (pos < self->myPosition)
-    {
-	return RC ( rcFS, rcFile, rcReading, rcParam, rcInvalid );
-    }
-
-    GZIP_DEBUG(("%s: pos %lu bsize %zu\n", __func__, pos, bsize));
-
-    if (pos > self->myPosition)
-    {
-	rc =  z_skip (self, pos);
-	if (rc)
-	    return rc;
-	if (pos != self->myPosition)
-	    return 0;
-    }
-
-    rc = z_read ( self, buffer, bsize, &numRead );
-    if (rc)
-	return rc;
-
-    *num_read = numRead;
-
-    self->myPosition += numRead;
-
-    return 0;
-}
-
-/* private functions definitions *******************************************************/
-
-static rc_t z_read ( KGZipFile * self, void * buffer, size_t bsize, size_t * _num_read )
-{
-    rc_t rc = 0;
-    size_t num_read, bleft ;
-
-    GZIP_DEBUG(("%s: Enter\n",__func__));
-
-
-    for (num_read = 0, bleft=bsize; bleft  > 0; )
-    {
-        z_stream * strm = &self->strm;
-        size_t src_read;
-        int zret;
-        
-        strm->next_out  = (uint8_t*)buffer + num_read;
-        strm->avail_out = (uInt) bleft;
-
-        GZIP_DEBUG(("%s: call inflate\n",__func__));
-
-
-        GZIP_DEBUG(("%s: before inflate next_in %14p avail_in %6u total_in %10lu next_out %14p avail_out %6u total_out %10lu\n",
-                    __func__, strm->next_in, strm->avail_in, strm->total_in,
-                    strm->next_out, strm->avail_out, strm->total_out));
-
-        zret = inflate (strm, Z_NO_FLUSH);
-
-        GZIP_DEBUG(("%s: after inflate  next_in %14p avail_in %6u total_in %10lu next_out %14p avail_out %6u total_out %10lu\n",
-                    __func__, strm->next_in, strm->avail_in, strm->total_in,
-                    strm->next_out, strm->avail_out, strm->total_out));
-
-	bleft = strm->avail_out;
-	num_read = bsize - bleft;
-
-        switch (zret)
-        {
-            /* unexpected error returns from zlib */
-        default:
-        case Z_ERRNO:
-            GZIP_DEBUG(("%s: unknown error %d\n",__func__, zret));
-            return RC (rcFS, rcFile, rcReading, rcFile, rcUnknown);
-
-            /* known unfixable errors */
-        case Z_STREAM_ERROR:
-            GZIP_DEBUG(("%s: stream error %d\n",__func__, zret));
-            return RC (rcFS, rcFile, rcReading, rcSelf, rcCorrupt);
-
-        case Z_DATA_ERROR:
-            GZIP_DEBUG(("%s: data error %d\n",__func__, zret));
-            return RC (rcFS, rcFile, rcReading, rcData, rcCorrupt);
-
-        case Z_STREAM_END:
-            GZIP_DEBUG(("%s: stream end %d\n",__func__, zret));
-            self->completed = true;
-            zret = inflateReset (strm);
-            GZIP_DEBUG (("%s: recall inflateReset zret = %d\n",__func__,zret));
-            switch (zret)
-            {
-            case Z_OK:
-                break;
-            default:
-                rc = RC (rcFS, rcFile, rcReading, rcData, rcInvalid);
-                break;
-            }
-            break;
-
-        case Z_BUF_ERROR:
-            GZIP_DEBUG(("%s: buf error %d\n",__func__, zret));
-            if (strm->avail_out > 0)
-            {
-                rc = KFileRead (self->file, self->filePosition, 
-                                self->buff, sizeof (self->buff), &src_read);
-                if (rc)
-                    break;
-
-                strm->avail_in = (uInt) src_read;
-                self->filePosition += src_read;
-                strm->next_in = self->buff;
-                if (src_read)
-                    self->completed = false;
-                else if (self->completed)
-                    goto done;
-                else if (zret == Z_BUF_ERROR)
-                {                
-                    /* this is either a truncated file or a blocked stream
-                     * code outside of here has to handle it */
-                    GZIP_DEBUG(("%s: truncated input\n",__func__));
-                    rc = RC (rcFS, rcFile, rcReading, rcData, rcInsufficient);
-                    break;
-                }
-            }
-            break;
-        case Z_OK:
-            break;
-        }
-        if (rc)
-            break;
-    }
-done:
-    *_num_read = num_read;
-    return rc;
-}
-
-static rc_t z_skip (KGZipFile *self, uint64_t pos)
-{
-    rc_t rc = 0;
-    size_t num_read = 0; /* superfluous to quiet compiler */
-    size_t to_read;
-    uint8_t buff [ 32 * 1024 ];
-
-    GZIP_DEBUG(("%s: enter pos %lu\n",__func__, pos));
-
-    for ( to_read = sizeof buff; self -> myPosition < pos; self -> myPosition += num_read )
-    {
-	if (self->myPosition + sizeof buff > pos)
-	    to_read = pos - self->myPosition;
-
-        GZIP_DEBUG(("%s: call z_read to_read %zu \n",__func__));
-
-	rc = z_read ( self, buff, to_read, &num_read );
-
-        GZIP_DEBUG(("%s: return z_read num_read %zu \n",__func__));
-
-	if ( rc )
-	    break;
-
-	if (num_read == 0)
-	    break;
-
-    }
-    return rc;
-}
-
-/***************************************************************************************/
-/* Gzip Output File                                                                    */
-/***************************************************************************************/
-
-/* write-only methods ******************************************************************/
-
-static rc_t CC KGZipFile_OutDestroy(KGZipFile *self);
-
-static rc_t CC KGZipFile_OutRead(const KGZipFile *cself,
-    uint64_t pos,
-    void *buffer,
-    size_t bsize,
-    size_t *num_read)
-{ return RC ( rcFS, rcFile, rcReading, rcFunction, rcUnsupported ); }
-
-static rc_t CC KGZipFile_OutWrite(KGZipFile *self,
-    uint64_t pos,
-    const void *buffer,
-    size_t bsize,
-    size_t *num_writ);
-
-/** virtual table **********************************************************************/
-static KFile_vt_v1 s_vtKFile_OutGz = {
-    /* version */
-    1, 1,
-
-    /* 1.0 */
-    KGZipFile_OutDestroy,
-    s_GetSysFile,
-    s_FileRandomAccess,
-    s_FileSize,
-    s_FileSetSize,
-    KGZipFile_OutRead,
-    KGZipFile_OutWrite,
-
-    /* 1.1 */
-    s_FileType
-};
-
-/** Factory method definition **********************************************************/
-LIB_EXPORT rc_t CC KFileMakeGzipForWrite( struct KFile **result,
-    struct KFile *file )
-{
-    rc_t rc;
-    z_stream* strm;
-    KGZipFile *obj;
-
-    if ( result == NULL || file == NULL )
-        return RC ( rcFS, rcFile, rcConstructing, rcParam, rcNull );
-
-    obj = (KGZipFile*) malloc(sizeof(KGZipFile));
-    if (!obj)
-        return RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-
-    rc = KFileInit(&obj->dad, (const KFile_vt*) &s_vtKFile_OutGz, "KGZipFile", "no-name", false, true);
-    if (rc != 0) {
-        free(obj);
-        return rc;
-    }
-
-    strm = &obj->strm;
-    strm->zalloc   = Z_NULL;
-    strm->zfree    = Z_NULL;
-    strm->opaque   = Z_NULL;
-    strm->avail_in = 0;
-    strm->next_in  = Z_NULL;
-
-    /* TBD - this should check gzlib error codes */
-    if (deflateInit2(strm, Z_DEFAULT_COMPRESSION, Z_DEFLATED, WINDOW_BITS,
-        8, /* The default value for the memLevel parameter is 8 */
-        Z_DEFAULT_STRATEGY) != Z_OK)
-    {
-        free(obj);
-        return RC ( rcFS, rcFile, rcConstructing, rcNoObj, rcUnknown );
-    }
-
-    obj->myPosition   = 0;
-    obj->filePosition = 0;
-    obj->completed    = false;
-
-    rc = KFileAddRef(file);
-    if ( rc != 0 )
-    {
-        obj->file = NULL;
-        KGZipFile_OutDestroy ( obj );
-    }
-    else
-    {
-        obj->file = file;
-        *result = &obj->dad;
-    }
-
-    return rc;
-}
-
-/* private functions declarations ******************************************************/
-
-static int s_GzipAndWrite(KGZipFile *self,
-    int flush,
-    size_t *num_writ,
-    rc_t *rc);
-
-/* virtual functions definitions *******************************************************/
-
-static rc_t CC KGZipFile_OutDestroy( KGZipFile *self)
-{
-    rc_t rc;
-    if ( !self->completed )
-    {
-        int ret;
-        size_t wrtn;
-        z_stream* strm = &self->strm;
-        strm->avail_in = 0;
-        strm->next_in = Z_NULL;
-
-        ret = s_GzipAndWrite( self, Z_FINISH, &wrtn, &rc );
-        if ( rc != 0 )
-            return rc;
-
-        assert( ret == Z_STREAM_END ); /* stream will be complete */
-        
-        deflateEnd( strm ); /* clean up */
-        self->completed = true;
-    }
-
-    rc = KFileRelease( self->file );
-    if ( rc == 0 )
-        free( self );
-
-    return rc;
-}
-
-static rc_t CC KGZipFile_OutWrite( struct KGZipFile *self,
-    uint64_t pos,
-    const void *buffer,
-    size_t bsize,
-    size_t *num_writ )
-{
-    int ret;
-    rc_t rc;
-    z_stream* strm;
-    size_t ignore;
-    if (!num_writ)
-    {   num_writ = &ignore; }
-
-    *num_writ = 0;
-
-    if ( pos != self->myPosition )
-        return RC ( rcFS, rcFile, rcWriting, rcParam, rcInvalid );
-
-    strm = &self->strm;
-    strm->next_in  = (Bytef*) buffer;
-    strm->avail_in = (uInt) bsize;
-
-    rc = 0;
-    ret = s_GzipAndWrite( self, Z_NO_FLUSH, num_writ, &rc );
-    if ( rc != 0 )
-        return rc;
-    assert( ret != Z_STREAM_END );  /* stream will be complete */
-
-    self->myPosition += * num_writ;
-
-    return 0;
-}
-
-/* private functions definitions *******************************************************/
-
-static int s_GzipAndWrite ( KGZipFile *self,
-    int flush,
-    size_t *num_writ,
-    rc_t *rc )
-{
-    z_stream *strm;
-    uInt avail_in;
-    int ret;
-
-    assert( self && num_writ && rc );
-
-    *num_writ = 0;
-    strm = &self->strm;
-    avail_in = strm->avail_in;
-    ret = 0;
-    /* run deflate() on input until output buffer not full, finish
-       compression if all of source has been read in */
-    do {
-        uint32_t have;
-        size_t written;
-        strm->avail_out = sizeof( self->buff );
-        strm->next_out = self->buff;
-        ret = deflate( strm, flush );    /* no bad return value */
-/*
-        OUTMSG (( "deflate: ret=%u | avail-out+%u\n", ret, strm->avail_out ));
-*/
-        assert( ret != Z_STREAM_ERROR );  /* state not clobbered */
-        have = sizeof( self->buff ) - strm->avail_out;
-        written = 0;
-        *rc = KFileWrite( self->file, self->filePosition, self->buff, have, &written );
-        /* this is wrong - Z_ERRNO would tell us to check errno for error
-           but the error is in *rc */
-        if ( *rc != 0 )
-            return Z_ERRNO;
-        self->filePosition += written;
-        *num_writ = avail_in - strm->avail_in;
-    } while ( strm->avail_out == 0 );
-
-    assert( strm->avail_in == 0 );     /* all input will be used */
-    return ret;
-}
-
-/* EOF */
-
-#include <stdio.h> /* printf */
-LIB_EXPORT rc_t CC KFileMakeGzip2ForRead( const struct KFile **result,
-    const struct KFile *file )
-{
-    rc_t rc;
-    z_stream* strm;
-    KGZipFile *obj;
-
-    if ( result == NULL || file == NULL )
-        return RC ( rcFS, rcFile, rcConstructing, rcParam, rcNull );
-
-    obj = (KGZipFile*) malloc(sizeof(KGZipFile));
-    if (!obj)
-        return RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-
-printf("KFileMakeGzip2ForRead %d\n", __LINE__);
-    rc = KFileInit(&obj->dad, (const KFile_vt*) &s_vtKFile_InGz, "KGZipFile", "no-name", true, false);
-printf("KFileMakeGzip2ForRead %d\n", __LINE__);
-    if (rc != 0) {
-        free(obj);
-        return rc;
-    }
-
-    strm = &obj->strm;
-    memset(strm, 0, sizeof *strm);
-    strm->zalloc   = Z_NULL;
-    strm->zfree    = Z_NULL;
-    strm->opaque   = Z_NULL;
-    strm->avail_in = 0;
-    strm->next_in  = Z_NULL;
-
-    /* TBD - this should check gzlib error codes */
-printf("KFileMakeGzip2ForRead %d\n", __LINE__);
-    if (inflateInit2(strm, WINDOW_BITS) != Z_OK) {
-        free(obj);
-        return RC ( rcFS, rcFile, rcConstructing, rcNoObj, rcUnknown );
-    }
-
-printf("KFileMakeGzip2ForRead %d\n", __LINE__);
-        obj->myPosition   = 0;
-        obj->filePosition = 0;
-
-printf("KFileMakeGzip2ForRead %d\n", __LINE__);
-    rc = KFileAddRef(file);
-    if ( rc != 0 )
-    {
-printf("KFileMakeGzip2ForRead %d\n", __LINE__);
-        obj->file = NULL;
-        KGZipFile_InDestroy ( obj );
-    }
-    else
-    {
-printf("KFileMakeGzip2ForRead %d\n", __LINE__);
-        obj->file = (KFile*) file;
-        obj->completed = true; /* we could have an empty file and this would be okay */
-        *result = &obj->dad;
-    }
-
-printf("KFileMakeGzip2ForRead %d\n", __LINE__);
-    return rc;
-}
diff --git a/libs/kfs/impl.h b/libs/kfs/impl.h
deleted file mode 100644
index ae37b37..0000000
--- a/libs/kfs/impl.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_impl_
-#define _h_kfs_impl_
-
-#include <klib/rc.h>
-#include <atomic.h>
-#include <kfs/fileformat.h>
-#include "fileformat-priv.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-#if 0
-}
-#endif
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KDirectory;
-
-typedef union KFileFormat_vt KFileFormat_vt;
-
-
-/*--------------------------------------------------------------------------
- * KFileFormat
- *  a virtual file
- */
-struct KFileFormat
-{
-    const KFileFormat_vt *vt;
-    atomic32_t refcount;
-    KFFTables * tables;
-};
-
-#ifndef KFILEFORMAT_IMPL
-#define KFILEFORMAT_IMPL KFileFormat
-#endif
-
-typedef struct KFileFormat_vt_v1 KFileFormat_vt_v1;
-struct KFileFormat_vt_v1
-{
-    /* version == 1.x */
-    uint32_t maj;
-    uint32_t min;
-
-    /* start minor version == 0 */
-    rc_t (*destroy) (KFILEFORMAT_IMPL * self);
-    rc_t (*gettypebuff) (const KFILEFORMAT_IMPL *self, const void * buff, size_t buff_len,
-			 KFileFormatType * type, KFileFormatClass * class,
-			 char * description, size_t descriptionmax,
-			 size_t * descriptionlength);
-    rc_t (*gettypepath) (const KFILEFORMAT_IMPL *self, const struct KDirectory * dir, const char * path,
-			 KFileFormatType * type, KFileFormatClass * class,
-			 char * description, size_t descriptionmax,
-			 size_t * descriptionlength);
-
-    /* end minor version == 0 */
-    /* start minor version == 1 */
-    /* end minor version == 1 */
-    /* end version == 1.x */
-};
-
-union KFileFormat_vt
-{
-    KFileFormat_vt_v1 v1;
-};
-
-/* Init
- *  initialize a newly allocated file object
- */
-rc_t KFileFormatInit (KFileFormat *self, const KFileFormat_vt *vt,
-		      const char * typeAndClass, size_t len);
-
-/* Destroy
- *  destroy file
- */
-rc_t KFileFormatDestroy ( KFileFormat *self );
-
-/* GetSysFile
- *  returns an underlying system file object
- *  and starting offset to contiguous region
- *  suitable for memory mapping, or NULL if
- *  no such file is available.
- */
-struct KSysFile *KFileFormatGetSysFile ( const KFileFormat *self, uint64_t *offset );
-
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_impl_ */
diff --git a/libs/kfs/karc-priv.h b/libs/kfs/karc-priv.h
deleted file mode 100644
index bd96614..0000000
--- a/libs/kfs/karc-priv.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_arc_priv_h_
-#define _h_kfs_arc_priv_h_
-
-typedef struct KArcTOCNode KArcTOCNode;
-
-#ifdef _DEBUGGING
-#define FUNC_ENTRY() DBGMSG (DBG_KFS, DBG_FLAG(DBG_KFS_ARCENTRY), ("Enter: %s\n", __func__))
-#define ARC_DEBUG(msg) DBGMSG (DBG_KFS, DBG_FLAG(DBG_KFS_ARC), msg)
-#else
-#define FUNC_ENTRY()
-#define ARC_DEBUG(msg)
-#endif
-
-
-
-#endif /* #ifndef _h_kfs_arc_priv_h_ */
-/* end of file */
diff --git a/libs/kfs/kfs-priv.h b/libs/kfs/kfs-priv.h
deleted file mode 100644
index f994f3f..0000000
--- a/libs/kfs/kfs-priv.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_priv_
-#define _h_kfs_priv_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct KFile;
-struct KMD5File;
-
-/* exported private functions
- */
-struct KFile *KMD5FileToKFile ( struct KMD5File *self );
-struct KFile const *KMD5FileToKFileConst ( struct KMD5File const *self );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kfs_priv_ */
diff --git a/libs/kfs/lockfile.c b/libs/kfs/lockfile.c
deleted file mode 100644
index 2533cc3..0000000
--- a/libs/kfs/lockfile.c
+++ /dev/null
@@ -1,350 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-struct KRemoveLockFileTask;
-#define KTASK_IMPL struct KRemoveLockFileTask
-
-#include <kfs/extern.h>
-#include <kfs/lockfile.h>
-#include <kfs/impl.h>
-#include <kfs/file.h>
-#include <kfs/directory.h>
-#include <kproc/task.h>
-#include <kproc/impl.h>
-#include <kproc/procmgr.h>
-#include <klib/text.h>
-#include <klib/refcount.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-#if _DEBUGGING
-#define CRIPPLE_CLEANUP 0
-#define DISABLE_CLEANUP 0
-#endif
-
-/*--------------------------------------------------------------------------
- * KRemoveLockFileTask
- */
-typedef struct KRemoveLockFileTask KRemoveLockFileTask;
-struct KRemoveLockFileTask
-{
-    KTask dad;
-    KDirectory *dir;
-    char path [ 1 ];
-};
-
-static
-rc_t CC KRemoveLockFileTaskWhack ( KRemoveLockFileTask *self )
-{
-    rc_t rc = KDirectoryRelease ( self -> dir );
-    KTaskDestroy ( & self -> dad, "KRemoveLockFileTask" );
-    free ( self );
-    return rc;
-}
-
-static
-rc_t CC KRemoveLockFileTaskExecute ( KRemoveLockFileTask *self )
-{
-    return KDirectoryRemove ( self -> dir, true, self -> path );
-}
-
-static
-KTask_vt_v1 KRemoveLockFileTask_vt =
-{
-    1, 0,
-    KRemoveLockFileTaskWhack,
-    KRemoveLockFileTaskExecute
-};
-
-static
-rc_t KRemoveLockFileTaskMake ( KTask **task, KDirectory *dir, const char *path )
-{
-    rc_t rc;
-    size_t path_size = string_size ( path );
-    KRemoveLockFileTask *t = malloc ( sizeof * t + path_size );
-    if ( t == NULL )
-        rc = RC ( rcFS, rcLock, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        rc = KTaskInit ( & t -> dad, ( const KTask_vt* ) & KRemoveLockFileTask_vt, "KRemoveLockFileTask", path );
-        if ( rc == 0 )
-        {
-            rc = KDirectoryAddRef ( t -> dir = dir );
-            if ( rc == 0 )
-            {
-                strcpy ( t -> path, path );
-                * task = & t -> dad;
-                return 0;
-            }
-        }
-
-        free ( t );
-    }
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * KLockFile
- *  a mutual exclusion lock on a file
- *  the lock is acquired upon creation
- *  and released upon destruction
- *
- * NB - only guaranteed to work when used from a single host
- */
-struct KLockFile
-{
-    KProcMgr *pmgr;
-    KTask *cleanup;
-    KTaskTicket ticket;
-    KRefcount refcount;
-};
-
-static
-rc_t KLockFileWhack ( KLockFile *self )
-{
-    rc_t rc;
-
-    /* remove task from cleanup queue */
-    if ( self -> pmgr != NULL )
-    {
-        rc = KProcMgrRemoveCleanupTask ( self -> pmgr, & self -> ticket );
-        KProcMgrRelease ( self -> pmgr );
-    }
-
-#if ! CRIPPLE_CLEANUP && ! DISABLE_CLEANUP
-    /* remove the lock file from file system */
-    rc = KTaskExecute ( self -> cleanup );
-#endif
-    KTaskRelease ( self -> cleanup );
-
-    free ( self );
-    return 0;
-}
-
-
-/* AddRef
- */
-LIB_EXPORT rc_t CC KLockFileAddRef ( const KLockFile *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KLockFile" ) )
-        {
-        case krefLimit:
-            return RC ( rcFS, rcLock, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-/* Release
- */
-LIB_EXPORT rc_t CC KLockFileRelease ( const KLockFile *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KLockFile" ) )
-        {
-        case krefWhack:
-            return KLockFileWhack ( ( KLockFile* ) self );
-        case krefNegative:
-            return RC ( rcFS, rcLock, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-/* Make
- */
-static
-rc_t KLockFileMake ( KLockFile **lock, KDirectory *dir, const char *path )
-{
-    rc_t rc;
-    KLockFile *f = malloc ( sizeof * f );
-    if ( f == NULL )
-        rc = RC ( rcFS, rcLock, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        rc = KRemoveLockFileTaskMake ( & f -> cleanup, dir, path );
-        if ( rc == 0 )
-        {
-#if ! DISABLE_CLEANUP
-            /* register cleanup task with proc mgr */
-            rc = KProcMgrMakeSingleton ( & f -> pmgr );
-            if ( rc == 0 )
-                rc = KProcMgrAddCleanupTask ( f -> pmgr, & f -> ticket, f -> cleanup );
-            else
-#else
-            f -> pmgr = NULL;
-#endif
-            {
-                /* this is allowed to fail if mgr has not been initialized */
-                memset ( & f -> ticket, 0, sizeof f -> ticket );
-                rc = 0;
-            }
-
-            if ( rc == 0 )
-            {
-                KRefcountInit ( & f -> refcount, 1, "KLockFile", "make", path );
-                * lock = f;
-                return 0;
-            }
-
-            if ( f -> pmgr != NULL )
-                KProcMgrRelease ( f -> pmgr );
-        }
-
-        free ( f );
-    }
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * KDirectory
- *  interface extensions
- */
-
-
-/* CreateLockFile
- *  attempts to create a KLockFile
- *
- *  "lock" [ OUT ] - return parameter for newly created lock file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting lock file
- */
-LIB_EXPORT rc_t CC KDirectoryVCreateLockFile ( KDirectory *self,
-    KLockFile **lock, const char *path, va_list args )
-{
-    rc_t rc;
-
-    if ( lock == NULL )
-        rc = RC ( rcFS, rcFile, rcLocking, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcFS, rcFile, rcLocking, rcSelf, rcNull );
-        else if ( path == NULL )
-            rc = RC ( rcFS, rcFile, rcLocking, rcPath, rcNull );
-        else if ( path [ 0 ] == 0 )
-            rc = RC ( rcFS, rcFile, rcLocking, rcPath, rcEmpty );
-        else
-        {
-            char full [ 4096 ];
-            rc = KDirectoryVResolvePath ( self, false, full, sizeof full, path, args );
-            if ( rc == 0 )
-            {
-                KFile *lock_file;
-                rc = KDirectoryCreateFile ( self, & lock_file, false, 0600, kcmCreate | kcmParents, full );
-                if ( rc == 0 )
-                {
-                    rc_t rc2;
-
-                    /* no longer need the file - not going to write to it anyway */
-                    KFileRelease ( lock_file );
-
-                    /* we have the lock */
-                    rc = KLockFileMake ( lock, self, full );
-                    if ( rc == 0 )
-                        return 0;
-
-                    /* must unlink lockfile */
-                    rc2 = KDirectoryRemove ( self, true, full );
-                    if ( rc2 != 0 )
-                        /* issue a report */;
-                }
-                else if ( GetRCState ( rc ) == rcExists )
-                {
-                    /* map the rc to kproc type values */
-                    rc = RC ( rcFS, rcFile, rcLocking, rcLocking, rcBusy );
-                }
-                else
-                {
-                    rc = ResetRCContext ( rc, rcFS, rcFile, rcLocking );
-                }
-            }
-        }
-
-        * lock = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDirectoryCreateLockFile ( KDirectory *self,
-    KLockFile **lock, const char *path, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, path );
-
-    rc = KDirectoryVCreateLockFile ( self, lock, path, args );
-
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* CreateExclusiveAccessFile
- *  opens a file with exclusive write access
- *
- *  "f" [ OUT ] - return parameter for newly opened file
- *
- *  "update" [ IN ] - if true, open in read/write mode
- *  otherwise, open in write-only mode
- *
- *  "access" [ IN ] - standard Unix access mode, e.g. 0664
- *
- *  "mode" [ IN ] - a creation mode ( see explanation above ).
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- */
-
-LIB_EXPORT rc_t CC KDirectoryCreateExclusiveAccessFile ( KDirectory *self, KFile **f,
-    bool update, uint32_t access, KCreateMode mode, const char *path, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, path );
-
-    rc = KDirectoryVCreateExclusiveAccessFile ( self, f, update, access, mode, path, args );
-
-    va_end ( args );
-
-    return rc;
-}
diff --git a/libs/kfs/md5.c b/libs/kfs/md5.c
deleted file mode 100644
index e172b0c..0000000
--- a/libs/kfs/md5.c
+++ /dev/null
@@ -1,1901 +0,0 @@
-/*=======================================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-struct KMD5File;
-#define KFILE_IMPL struct KMD5File
-
-#include <kfs/extern.h>
-#include <kfs/md5.h>
-#include <kfs/impl.h>
-#include <klib/checksum.h>
-#include <klib/container.h>
-#include <klib/text.h>
-#include <klib/debug.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <os-native.h>
-#include <sysalloc.h>
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <endian.h>
-#include <byteswap.h>
-
-#define MD5_DBG_REF(msg) DBGMSG(DBG_LEGREF,DBG_FLAG(DBG_LEGREF_MD5), msg)
-
-
-/*--------------------------------------------------------------------------
- * KMD5SumEntry
- *  describes an entry into an MD5 checksum file
- */
-typedef struct KMD5SumEntry KMD5SumEntry;
-struct KMD5SumEntry
-{
-    SLNode n;
-    uint8_t digest [ 16 ];
-    bool bin;
-    char path [ 1 ];
-};
-
-static
-void CC KMD5SumEntryWhack ( SLNode *n, void *ignore )
-{
-    free ( n );
-}
-
-typedef struct KMD5SumEntryFlushData KMD5SumEntryFlushData;
-struct KMD5SumEntryFlushData
-{
-    uint64_t pos;
-    KFile *f;
-    rc_t rc;
-};
-
-static
-bool CC KMD5SumEntryFlush ( SLNode *n, void *data )
-{
-    KMD5SumEntryFlushData *pb = data;
-    const KMD5SumEntry *self = ( const KMD5SumEntry* ) n;
-    int i, len;
-    size_t num_writ, total;
-    char line [ 4096 + 40 ];
-
-    for ( total = 0, i = 0; i < 16; ++ i )
-    {
-        len = snprintf ( & line [ total ], sizeof line - total,
-            "%02x", self -> digest [ i ] );
-        assert ( len == 2 );
-        total += len;
-    }
-
-    len = snprintf ( & line [ total ], sizeof line - total,
-        " %c%s\n", self -> bin ? '*' : ' ', self -> path );
-
-    if ( len < 0 )
-    {
-        pb -> rc = RC ( rcFS, rcFile, rcFormatting, rcString, rcExcessive );
-        return true;
-    }
-
-    total += len;
-    if ( total >= sizeof line )
-    {
-        pb -> rc = RC ( rcFS, rcFile, rcFormatting, rcString, rcExcessive );
-        return true;
-    }
-
-    pb -> rc = KFileWrite ( pb -> f, pb -> pos, line, total, & num_writ );
-    if ( pb -> rc != 0 )
-        return true;
-
-    pb -> pos += num_writ;
-
-    if ( num_writ == total )
-        return false;
-
-    pb -> rc = RC ( rcFS, rcFile, rcFormatting, rcTransfer, rcIncomplete );
-    return true;
-}
-
-static
-rc_t KMD5SumEntryMake ( KMD5SumEntry **ep,
-    const char *path, const uint8_t digest [ 16 ], bool bin )
-{
-    KMD5SumEntry *entry = malloc ( sizeof * entry + strlen ( path ) );
-    if ( entry == NULL )
-        return RC ( rcFS, rcFile, rcUpdating, rcMemory, rcExhausted );
-
-    memcpy ( entry -> digest, digest, sizeof entry -> digest );
-    entry -> bin = bin;
-    strcpy ( entry -> path, path );
-
-    * ep = entry;
-    return 0;
-}
-
-
-/*--------------------------------------------------------------------------
- * KMD5SumFmt
- *  a formatter for reading or writing an md5sum-style checksum file
- */
-struct KMD5SumFmt
-{
-    SLList entries;
-    KFile *f;
-    atomic32_t refcount;
-    uint32_t count;
-    bool read_only;
-    bool dirty;
-};
-
-/* Flush
- */
-LIB_EXPORT rc_t CC KMD5SumFmtFlush ( KMD5SumFmt *self )
-{
-    if ( self != NULL && self -> dirty )
-    {
-        KMD5SumEntryFlushData pb;
-        pb . pos = 0;
-        pb . f = self -> f;
-        pb . rc = 0;
-
-        SLListDoUntil ( & self -> entries, KMD5SumEntryFlush, & pb );
-
-        if ( pb . rc != 0 )
-            return pb . rc;
-
-        self -> dirty = false;
-    }
-    return 0;
-}
-
-
-/* Whack
- */
-static
-rc_t KMD5SumFmtWhack ( KMD5SumFmt *self )
-{
-    rc_t rc;
-
-    atomic32_set ( & self -> refcount, 1 );
-
-    rc = KMD5SumFmtFlush ( self );
-    if ( rc == 0 )
-        rc = KFileRelease ( self -> f );
-    if ( rc != 0 )
-        return rc;
-
-    SLListWhack ( & self -> entries, KMD5SumEntryWhack, NULL );
-    free ( self );
-    return 0;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KMD5SumFmtAddRef ( const KMD5SumFmt *cself )
-{
-    if ( cself != NULL )
-    {
-        MD5_DBG_REF (("%s self %p prior count %u\n", __func__, cself, atomic32_read ( & cself -> refcount ) ));
-        atomic32_inc ( & ( ( KMD5SumFmt* ) cself ) -> refcount );
-    }
-    else
-    {
-        MD5_DBG_REF(("%s self %p\n", __func__, cself));
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KMD5SumFmtRelease ( const KMD5SumFmt *cself )
-{
-    KMD5SumFmt *self = ( KMD5SumFmt* ) cself;
-    if ( cself != NULL )
-    {
-        MD5_DBG_REF (("%s self %p prior count %u\n", __func__, cself, atomic32_read ( & cself -> refcount ) ));
-        if ( atomic32_dec_and_test ( & self -> refcount ) )
-            return KMD5SumFmtWhack ( self );
-    }
-    else
-    {
-        MD5_DBG_REF(("%s self %p\n", __func__, cself));
-    }
-    return 0;
-}
-
-
-/* Extract
- *  extract a single line
- */
-static
-int hex_to_int ( char hex )
-{
-    int i = hex - '0';
-    if ( hex > '9' )
-    {
-        if ( hex < 'a' )
-            i = hex - 'A' + 10;
-        else
-            i = hex - 'a' + 10;
-
-        if ( i > 15 )
-            return -1;
-    }
-    return i;
-}
-
-static
-rc_t KMD5SumFmtExtract ( KMD5SumFmt *self, const char *line, size_t size )
-{
-    rc_t rc;
-    KMD5SumEntry *entry;
-
-    /* check for a DOS condition not caught by parse */
-    if ( line [ size - 1 ] == '\r' )
-    {
-        /* drop CR from line */
-        size -= 1;
-    }
-
-    /* create entry */
-    entry = malloc ( sizeof * entry + size - ( 32 /* cs */ + 2 /* sp + mode */ ) );
-    if ( entry == NULL )
-        rc = RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        int i;
-
-        /* parse checksum */
-        for ( rc = 0, i = 0; i < 16; ++ i )
-        {
-            int l, u = hex_to_int ( line [ i + i + 0 ] );
-            l = hex_to_int ( line [ i + i + 1 ] );
-            if ( u < 0 || l < 0 )
-            {
-                rc = RC ( rcFS, rcFile, rcConverting, rcFormat, rcInvalid );
-                break;
-            }
-
-            entry -> digest [ i ] = ( uint8_t ) ( ( u << 4 ) | l );
-        }
-
-        /* parse mode */
-        if ( rc == 0 )
-        {
-            if ( line [ 32 ] != ' ' )
-                rc = RC ( rcFS, rcFile, rcConverting, rcFormat, rcInvalid );
-            else if ( line [ 33 ] == ' ' )
-                entry -> bin = false;
-            else if ( line [ 33 ] == '*' )
-                entry -> bin = true;
-            else
-                rc = RC ( rcFS, rcFile, rcConverting, rcFormat, rcInvalid );
-        }
-
-        /* the rest is path */
-        if ( rc == 0 )
-        {
-            string_copy ( entry -> path, size, & line [ 32 + 2 ], size - ( 32 + 2 ) );
-            SLListPushTail ( & self -> entries, & entry -> n );
-            ++ self -> count;
-            return 0;
-        }
-
-        free ( entry );
-    }
-
-    return rc;
-}
-
-
-/* Parse
- *  parse *.md5 file
- */
-static
-rc_t KMD5SumFmtParse ( KMD5SumFmt *self, const char *start, const char *stop )
-{
-    rc_t rc;
-    const char *end;
-
-    for ( rc = 0; start < stop; start = end + 1 )
-    {
-        end = string_chr ( start, stop - start, '\n' );
-        if ( end == NULL )
-            end = stop;
-
-        /* allow '#' comments and blank lines */
-        if ( ( end - start ) == 0 )
-            continue;
-        if ( start [ 0 ] == '#' )
-            continue;
-
-        /* line must have minimum length */
-        if ( ( end - start ) < ( 32 /* cs */ + 2 /* sp + mode */ + 1 /* path */ ) )
-        {
-            /* check for empty line ending in CR-LF */
-            if ( end [ -1 ] == '\r' && ( end - start ) == 1 )
-                continue;
-
-            /* other stuff is garbage */
-            rc = RC ( rcFS, rcFile, rcParsing, rcData, rcInsufficient );
-            break;
-        }
-
-        /* extract entry */
-        rc = KMD5SumFmtExtract ( self, start, end - start );
-        if ( rc != 0 )
-            break;
-    }
-
-    return rc;
-}
-
-
-/* Populate
- *  reads all lines of input from *.md5 file
- */
-static
-rc_t KMD5SumFmtPopulate ( KMD5SumFmt *self, const KFile *in )
-{
-    uint64_t eof;
-    rc_t rc = KFileSize ( in, & eof );
-    if ( rc == 0 )
-    {
-        char *buff = malloc ( ( size_t ) eof );
-        if ( buff == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            size_t num_read, total;
-            for ( total = 0; total < ( size_t ) eof; total += num_read )
-            {
-                rc = KFileRead ( in, total,
-                    & buff [ total ], ( size_t ) eof - total, & num_read );
-                if ( rc != 0 )
-                    break;
-                if ( num_read == 0 )
-                {
-                    rc = RC ( rcFS, rcFile, rcReading, rcTransfer, rcIncomplete );
-                    break;
-                }
-            }
-
-            if ( rc == 0 )
-                rc = KMD5SumFmtParse ( self, buff, buff + total );
-
-            free ( buff );
-        }
-    }
-
-    return rc;
-}
-
-
-/* Make
- *  creates a formatted accessor to textual checksum file
- *  takes over ownership of "in"/"out" file reference
- */
-LIB_EXPORT rc_t CC KMD5SumFmtMakeRead ( const KMD5SumFmt **fp, const KFile *in )
-{
-    rc_t rc;
-    if ( fp == NULL )
-        rc = RC ( rcFS, rcFile, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( in == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNull );
-        else if ( ! in -> read_enabled )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNoPerm );
-        else
-        {
-            KMD5SumFmt *f = malloc ( sizeof * f );
-            if ( f == NULL )
-                rc = RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                SLListInit ( & f -> entries );
-                atomic32_set ( & f -> refcount, 1 );
-                f -> f = NULL;
-                f -> count = 0;
-                f -> read_only = true;
-                f -> dirty = false;
-
-                rc = KMD5SumFmtPopulate ( f, in );
-                if ( rc == 0 )
-                {
-                    f -> f = ( KFile* ) in;
-                    * fp = f;
-                    return 0;
-                }
-                
-                KMD5SumFmtWhack ( f );
-            }
-        }
-
-        * fp = NULL;
-    }
-
-    return rc;
-}
-
-/* Make
- *  creates a formatted accessor to textual checksum file
- *  takes over ownership of "in"/"out" file reference
- */
-LIB_EXPORT rc_t CC KMD5SumFmtMakeUpdate ( KMD5SumFmt **fp, KFile *out )
-{
-    rc_t rc;
-    if ( fp == NULL )
-        rc = RC ( rcFS, rcFile, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( out == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNull );
-        else if ( ! out -> write_enabled )
-        {
-            if ( out -> read_enabled )
-                rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcReadonly );
-            else
-                rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNoPerm );
-        }
-        else
-        {
-            KMD5SumFmt *f = malloc ( sizeof * f );
-            if ( f == NULL )
-                rc = RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                SLListInit ( & f -> entries );
-                atomic32_set ( & f -> refcount, 1 );
-                f -> f = NULL;
-                f -> count = 0;
-                f -> read_only = false;
-                f -> dirty = false;
-
-                rc = 0;
-                if ( out -> read_enabled )
-                    rc = KMD5SumFmtPopulate ( f, out );
-                if ( rc == 0 )
-                {
-                    f -> f = out;
-                    * fp = f;
-                    return 0;
-                }
-                
-                KMD5SumFmtWhack ( f );
-            }
-        }
-
-        * fp = NULL;
-    }
-
-    return rc;
-}
-
-
-/* Count
- *  return the number of checksums in file
- */
-LIB_EXPORT rc_t CC KMD5SumFmtCount ( const KMD5SumFmt *self, uint32_t *count )
-{
-    rc_t rc;
-    if ( count == NULL )
-        rc = RC ( rcFS, rcFile, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcFS, rcFile, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            * count = self -> count;
-            return 0;
-        }
-
-        * count = 0;
-    }
-    return rc;
-}
-
-
-/* Get
- *  retrieve an indexed checksum line
- *
- *  "idx" [ IN ] - zero-based index of checksum to access
- *
- *  "path" [ OUT ] and "size" [ IN ] - return buffer for file path
- *
- *  "digest" [ OUT ] - return parameter for the MD5 checksum
- *
- *  "bin" [ OUT, NULL OKAY ] - true if fopen mode used to
- *  calculate "digest" was binary, false if text. pertinent if
- *  digest was calculated using DOS text mode.
- */
-LIB_EXPORT rc_t CC KMD5SumFmtGet ( const KMD5SumFmt *self, uint32_t idx,
-    char *path, size_t size, uint8_t digest [ 16 ], bool *bin )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcFS, rcFile, rcAccessing, rcSelf, rcNull );
-    else if ( idx >= self -> count )
-        rc = RC ( rcFS, rcFile, rcAccessing, rcId, rcNotFound );
-    else
-    {
-        uint32_t i;
-        const KMD5SumEntry *entry = ( const KMD5SumEntry* )
-            SLListHead ( & self -> entries );
-        for ( i = 0; entry != NULL && i < idx; ++ i )
-        {
-            entry = ( const KMD5SumEntry* )
-                SLNodeNext ( & entry -> n );
-        }
-
-        if ( entry == NULL )
-            rc = RC ( rcFS, rcFile, rcAccessing, rcId, rcNotFound );
-        else if ( path == NULL )
-            rc = RC ( rcFS, rcFile, rcAccessing, rcBuffer, rcNull );
-        else if ( digest == NULL )
-            rc = RC ( rcFS, rcFile, rcAccessing, rcParam, rcNull );
-        else
-        {
-            /* copy everything out */
-            memcpy ( digest, entry -> digest, sizeof entry -> digest );
-            if ( bin != NULL )
-                * bin = entry -> bin;
-
-            /* return success if buffer large enough */
-            if ( string_copy_measure ( path, size, entry -> path ) < size )
-                return 0;
-
-            rc = RC ( rcFS, rcFile, rcAccessing, rcBuffer, rcInsufficient );
-        }
-    }
-
-    if ( path != NULL && size != 0 )
-        path [ 0 ] = 0;
-
-    if ( bin != NULL )
-        * bin = false;
-
-    return rc;
-}
-
-
-/* Find
- *  retrieve checksum line by path
- *
- *  "path" [ IN ] - NUL terminated string in OS-native char set
- *  denoting path to file
- *
- *  "digest" [ OUT ] - return parameter for the MD5 checksum
- *
- *  "bin" [ OUT, NULL OKAY ] - true if fopen mode used to
- *  calculate "digest" was binary, false if text. pertinent if
- *  digest was calculated using DOS text mode.
- */
-LIB_EXPORT rc_t CC KMD5SumFmtFind ( const KMD5SumFmt *self,
-    const char *path, uint8_t digest [ 16 ], bool *bin )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcFS, rcFile, rcAccessing, rcSelf, rcNull );
-    else if ( path == NULL )
-        rc = RC ( rcFS, rcFile, rcAccessing, rcPath, rcNull );
-    else if ( path [ 0 ] == 0 )
-        rc = RC ( rcFS, rcFile, rcAccessing, rcPath, rcEmpty );
-    else
-    {
-        const KMD5SumEntry *entry = ( const KMD5SumEntry* )
-            SLListHead ( & self -> entries );
-        while ( entry != NULL )
-        {
-            if ( strcmp ( path, entry -> path ) == 0 )
-                break;
-
-            entry = ( const KMD5SumEntry* )
-                SLNodeNext ( & entry -> n );
-        }
-
-        if ( entry == NULL )
-            rc = RC ( rcFS, rcFile, rcAccessing, rcPath, rcNotFound );
-        else if ( digest == NULL )
-            rc = RC ( rcFS, rcFile, rcAccessing, rcParam, rcNull );
-        else
-        {
-            /* copy everything out */
-            memcpy ( digest, entry -> digest, sizeof entry -> digest );
-            if ( bin != NULL )
-                * bin = entry -> bin;
-
-            return 0;
-        }
-    }
-
-    if ( bin != NULL )
-        * bin = false;
-
-    return rc;
-}
-
-
-/* Delete
- *  remove an existing line
- *
- *  "path" [ IN ] - NUL terminated string in OS-native char set
- *  denoting path to file
- *
- *  returns rcNotFound if not present
- */
-LIB_EXPORT rc_t CC KMD5SumFmtDelete ( KMD5SumFmt *self, const char *path )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcFS, rcFile, rcRemoving, rcSelf, rcNull );
-    else if ( path == NULL )
-        rc = RC ( rcFS, rcFile, rcRemoving, rcPath, rcNull );
-    else if ( path [ 0 ] == 0 )
-        rc = RC ( rcFS, rcFile, rcRemoving, rcPath, rcEmpty );
-    else
-    {
-        KMD5SumEntry *entry = ( KMD5SumEntry* )
-            SLListHead ( & self -> entries );
-        while ( entry != NULL )
-        {
-            if ( strcmp ( path, entry -> path ) == 0 )
-                break;
-
-            entry = ( KMD5SumEntry* )
-                SLNodeNext ( & entry -> n );
-        }
-
-        if ( entry == NULL )
-            rc = RC ( rcFS, rcFile, rcRemoving, rcPath, rcNotFound );
-        else
-        {
-            /* pop entry from list */
-            SLListUnlink ( & self -> entries, & entry -> n );
-
-            /* delete entry */
-            KMD5SumEntryWhack ( & entry -> n, NULL );
-
-            /* mark the modification */
-            self -> dirty = true;
-            assert ( self -> count > 0 );
-            -- self -> count;
-
-            return 0;
-        }
-    }
-
-    return rc;
-}
-
-
-/* Update
- *  add a checksum line to file or update an existing line
- *
- *  "path" [ IN ] - NUL terminated string in OS-native char set
- *  denoting path to file
- *
- *  "digest" [ IN ] - calculated MD5 checksum
- *
- *  "bin" [ IN ] - true if checksum was calculated on all bytes
- *  in file, false if fopen mode used to read file was text.
- *
- * NB - the md5sum tool operates with the assumption that files
- *  are opened using "fopen". it records the mode used by prepending
- *  '*' to indicate binary and ' ' to indicate text mode within the
- *  checksum line.
- *
- *  unfortunately, this creates a situation where text-mode files
- *  checksummed on DOS cannot be properly checked on any other
- *  platform without the aid of some filter to drop out '\r' from
- *  a '\r\n' sequence.
- *
- *  fortunately, most users are unaware of the binary/text mode
- *  switches available with md5sum and use the default mode, which
- *  is binary on DOS and text on Unix, which happens to be equivalent
- *  to binary ( making one wonder why binary is not instead the
- *  universal default ).
- *
- *  the end result is that we need to indicate whether CR stripping
- *  was performed while at the same time behaving like md5sum.
- */
-LIB_EXPORT rc_t CC KMD5SumFmtUpdate ( KMD5SumFmt *self, const char *path,
-    const uint8_t digest [ 16 ], bool bin )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcFS, rcFile, rcUpdating, rcSelf, rcNull );
-    else if ( path == NULL )
-        rc = RC ( rcFS, rcFile, rcUpdating, rcString, rcNull );
-    else if ( path [ 0 ] == 0 )
-        rc = RC ( rcFS, rcFile, rcUpdating, rcString, rcEmpty );
-    else if ( digest == NULL )
-        rc = RC ( rcFS, rcFile, rcUpdating, rcParam, rcNull );
-    else
-    {
-        /* create an entry */
-        KMD5SumEntry *entry;
-        rc = KMD5SumEntryMake ( & entry, path, digest, bin );
-        if ( rc == 0 )
-        {
-            /* scan for existing entry */
-            KMD5SumEntry *exist = ( KMD5SumEntry* )
-                SLListHead ( & self -> entries );
-            while ( exist != NULL )
-            {
-                if ( strcmp ( exist -> path, entry -> path ) == 0 )
-                    break;
-                exist = ( KMD5SumEntry* )
-                    SLNodeNext ( & exist -> n );
-            }
-
-            /* if new entry, insert */
-            if ( exist == NULL )
-            {
-                SLListPushTail ( & self -> entries, & entry -> n );
-                self -> dirty = true;
-                ++ self -> count;
-            }
-            else
-            {
-                /* if existing, perform update */
-                if ( memcmp ( exist -> digest, entry -> digest, sizeof exist -> digest ) != 0 ||
-                     exist -> bin != entry -> bin )
-                {
-                    memcpy ( exist -> digest, entry -> digest, sizeof exist -> digest );
-                    exist -> bin = entry -> bin;
-                    self -> dirty = true;
-                }
-                KMD5SumEntryWhack ( & entry -> n, NULL );
-            }
-        }
-    }
-
-    return rc;
-}
-
-/* Rename
- * Rename the checksum line to reflect a file name change but no content change.
- *
- *  "newpath" [ IN ] - NUL terminated string in OS-native char set
- *  denoting path to file's new name
- *
- *  "oldpath" [ IN ] - NUL terminated string in OS-native char set
- *  denoting path to file's old name
- *
- */
-LIB_EXPORT rc_t CC KMD5SumFmtRename ( KMD5SumFmt *self, const char *oldpath, const char *newpath )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcFS, rcFile, rcUpdating, rcSelf, rcNull );
-    else if ( newpath == NULL )
-        rc = RC ( rcFS, rcFile, rcUpdating, rcString, rcNull );
-    else if ( newpath [ 0 ] == 0 )
-        rc = RC ( rcFS, rcFile, rcUpdating, rcString, rcEmpty );
-    else if ( oldpath == NULL )
-        rc = RC ( rcFS, rcFile, rcUpdating, rcString, rcNull );
-    else if ( oldpath [ 0 ] == 0 )
-        rc = RC ( rcFS, rcFile, rcUpdating, rcString, rcEmpty );
-    else
-    {
-	uint8_t	digest [16];
-	bool    bin;
-
-	rc = KMD5SumFmtFind (self, oldpath, digest, &bin);
-
-	if (rc == 0)
-	    rc = KMD5SumFmtUpdate (self, newpath, digest, bin);
-
-	if (rc == 0)
-	    rc = KMD5SumFmtDelete (self, oldpath);
-;
-    }
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * MD5 KFile extensions
- */
-typedef enum KMD5FileUnionType
-{
-    KMD5FileTypeRead,
-    KMD5FileTypeWrite
-} KMD5FileUnionType;
-struct KMD5File
-{
-    KFile dad;
-
-    /* this is position of next byte to read or write
-       relative to the MD5 not actual read/write */
-    uint64_t position;
-    MD5State md5;
-
-    KFile *file;
-    KMD5SumFmt *fmt;
-    KMD5FileUnionType type;
-    union
-    {
-        struct
-        {
-            rc_t rc;
-            uint8_t digest [ 16 ];
-            bool eof;
-        } rd;
-
-        struct
-        {
-            /* maximum position written to "file" */
-            uint64_t max_position;
-
-            /* saved information for a transaction */
-            uint64_t tposition;
-            MD5State tmd5;
-
-            /* is transaction open */
-            bool topen;
-
-            /* path to file for md5 fmt */
-            char path [ 1 ];
-        } wr;
-
-    } u;
-};
-
-/* Whack
- */
-static
-rc_t CC KMD5FileWhackRead ( KMD5File *self )
-{
-    rc_t rc;
-
-    atomic32_set ( & self -> dad . refcount, 1 );
-
-    rc = KFileRelease ( self -> file );
-    if ( rc == 0 )
-        free ( self );
-
-    return rc;
-}
-static
-rc_t CC KMD5FileWhackCreate ( KMD5File *self )
-{
-    uint64_t	position;
-    size_t	num_read;
-    rc_t	rc;
-    uint8_t	ignored [64 * 1024];
-
-    atomic32_set ( & self -> dad . refcount, 1 );
-
-    position = self->position;
-    for (;;)
-    {
-	rc = KFileRead (&self->dad, position, ignored, sizeof ignored, &num_read);
-	if (rc != 0)
-	    break;
-
-	if (num_read == 0)
-	    break;
-
-	position += num_read;
-    }
-    if (rc == 0)
-    {
-	rc = KFileRelease ( self -> file );
-	if ( rc == 0 )
-	    free ( self );
-    }
-    return rc;
-}
-
-static
-rc_t CC KMD5FileWhackWrite ( KMD5File *self )
-{
-    rc_t rc;
-    uint8_t digest [ 16 ];
-
-    atomic32_set ( & self -> dad . refcount, 1 );
-
-    /* if destination file has been written farther
-       than our concept of eof, truncate */
-    if ( self -> u . wr . max_position > self -> position )
-    {
-        rc = KFileSetSize ( self -> file, self -> position );
-        if ( rc != 0 )
-            return rc;
-        self -> u . wr . max_position = self -> position;
-    }
-
-    rc = KFileRelease ( self -> file );
-    if ( rc == 0 )
-    {
-        MD5StateFinish ( & self -> md5, digest );
-        KMD5SumFmtUpdate ( self -> fmt, self -> u . wr . path, digest, true );
-        KMD5SumFmtRelease ( self -> fmt );
-        free ( self );
-    }
-
-    return rc;
-}
-
-static const char MD5TAG [8] = "MD5CNTXT";
-static const char ENDIANTAG [4] =
-{ 
-    '0' + (char)((__BYTE_ORDER/1000)%10),
-    '0' + (char)((__BYTE_ORDER/100)%10),
-    '0' + (char)((__BYTE_ORDER/10)%10),
-    '0' + (char)((__BYTE_ORDER/1)%10)
-};
-static const char ENDIANSWAPTAG [4] =
-{ 
-    '0' + (char)((__BYTE_ORDER/1)%10),
-    '0' + (char)((__BYTE_ORDER/10)%10),
-    '0' + (char)((__BYTE_ORDER/100)%10),
-    '0' + (char)((__BYTE_ORDER/1000)%10)
-};
-
-static
-rc_t CC KMD5FileWrite ( KMD5File *self, uint64_t pos,
-    const void *buffer, size_t size, size_t *num_writ );
-
-static
-rc_t CC KMD5FileWhackAppend ( KMD5File *self )
-{
-    rc_t rc;
-
-    /* if the file is empty, just whack it */
-    if ( self -> position == 0 )
-        return KMD5FileWhackWrite ( self );
-
-    /* begin transaction will save current state */
-    rc = KMD5FileBeginTransaction ( self );
-    if ( rc == 0 )
-    {
-        size_t num_writ;
-
-        /* create a closing tag with current MD5State */
-        uint8_t closer [ sizeof MD5TAG + sizeof ENDIANTAG + sizeof self -> md5 ];
-        memcpy ( closer, MD5TAG, sizeof MD5TAG );
-        memcpy ( & closer [ sizeof MD5TAG ], ENDIANTAG, sizeof ENDIANTAG );
-        memcpy ( & closer [ sizeof MD5TAG + sizeof ENDIANTAG ], & self -> md5, sizeof self -> md5 );
-            
-        /* append this to the file */
-        rc = KMD5FileWrite ( self, self -> position, closer, sizeof closer, & num_writ );
-        if ( rc == 0 )
-        {
-            /* test transfer */
-            if ( num_writ != sizeof closer )
-                rc = RC ( rcFS, rcFile, rcDestroying, rcTransfer, rcIncomplete );
-            else
-            {
-                /* complete operation */
-                rc = KMD5FileWhackWrite ( self );
-                if ( rc == 0 )
-                    return rc;
-            }
-        }
-
-        /* restore entry state */
-        KMD5FileRevert ( self );
-    }
-
-    /* bail on errors */
-    atomic32_set ( & self -> dad . refcount, 1 );
-    return rc;
-}
-
-
-/* GetSysFile
- */
-static
-struct KSysFile *CC KMD5FileGetSysFile ( const KMD5File *self, uint64_t *offset )
-{
-    if ( offset != NULL )
-        * offset = 0;
-    return NULL;
-}
-
-
-/* RandomAccess
- */
-static
-rc_t CC KMD5FileRandomAccessRead ( const KMD5File *self )
-{
-    return KFileRandomAccess ( self -> file );
-}
-
-static
-rc_t CC KMD5FileRandomAccessWrite ( const KMD5File *self )
-{
-    return RC ( rcFS, rcFile, rcAccessing, rcFunction, rcUnsupported );
-}
-
-
-/* Type
- */
-static
-uint32_t CC KMD5FileType ( const KMD5File *self )
-{
-    return KFileType ( self -> file );
-}
-
-
-/* Size
- */
-static
-rc_t CC KMD5FileSize ( const KMD5File *self, uint64_t *size )
-{
-    return KFileSize ( self -> file, size );
-}
-
-static
-rc_t CC KMD5FileSizeAppend ( const KMD5File *self, uint64_t *size )
-{
-    assert (self);
-    assert (size);
-    *size = self->position;
-    return 0;
-}
-
-
-/* SetSize
- *  the read-only version should never be called, because
- *  the message dispatch checks for write enable
- *
- *  the writable version disallows all but a total reset
- *  and setting size to current size
- */
-static
-rc_t CC KMD5FileSetSizeRead ( KMD5File *self, uint64_t size )
-{
-    return RC ( rcFS, rcFile, rcUpdating, rcFunction, rcUnsupported );
-}
-
-static
-rc_t CC KMD5FileSetSizeWrite ( KMD5File *self, uint64_t size )
-{
-    rc_t rc;
-
-    /* allow a noop */
-    if ( size == self -> position )
-        return 0;
-
-    /* disallow if not a reset */
-    if ( size != 0 )
-        return RC ( rcFS, rcFile, rcUpdating, rcFunction, rcUnsupported );
-
-    /* ensure we're not in a transaction */
-    if ( self -> u . wr . topen )
-        return RC ( rcFS, rcFile, rcUpdating, rcFile, rcBusy );
-
-    /* go ahead and try to truncate destination */
-    rc = KFileSetSize ( self -> file, 0 );
-    if ( rc == 0 )
-    {
-        /* reset our internal state */
-        self -> position = self -> u . wr . max_position = 0;
-        MD5StateInit ( & self -> md5 );
-    }
-
-    return rc;
-}
-
-
-/* Finish
- *  finishes an MD5State if necessary
- *  returns the results of digest comparison
- */
-static
-rc_t KMD5FileFinish ( KMD5File *self )
-{
-    /* finish MD5State on first time */
-    if ( ! self -> u . rd . eof )
-    {
-        uint8_t digest [ 16 ];
-        MD5StateFinish ( & self -> md5, digest );
-
-        if ( memcmp ( digest, self -> u . rd . digest, sizeof digest ) != 0 )
-            self -> u . rd . rc = RC ( rcFS, rcFile, rcReading, rcFile, rcCorrupt );
-
-        self -> u . rd . eof = true;
-    }
-
-    return self -> u . rd . rc;
-}
-
-
-/* Seek
- *  used to scan ahead in a read-only file
- *  "self" is modifiable, but file is read-only
- */
-static
-rc_t KMD5FileSeek ( KMD5File *self, uint64_t pos )
-{
-    rc_t rc;
-    size_t num_read;
-    uint8_t buff [ 32 * 1024 ];
-
-    /* should never be called by writable file */
-    assert ( ! self -> dad . write_enabled );
-
-    /* seek to "pos" */
-    for ( rc = 0; self -> position < pos; self -> position += num_read )
-    {
-        /* maximum to read in this buffer */
-        size_t to_read = sizeof buff;
-        if ( self -> position + sizeof buff > pos )
-            to_read = ( size_t ) ( pos - self -> position );
-
-        /* read bytes */
-        rc = KFileRead ( self -> file, self -> position, buff, to_read, & num_read );
-        if ( rc != 0 )
-            break;
-
-        /* detect EOF */
-        if ( num_read == 0 )
-        {
-	    switch (self->type)
-	    {
-	    case KMD5FileTypeRead:
-		rc = KMD5FileFinish ( self );
-		break;
-	    case KMD5FileTypeWrite:
-		if ( self -> fmt != NULL)
-		{
-		    uint8_t digest [ 16 ];
-
-		    MD5StateFinish ( & self -> md5, digest );
-		    KMD5SumFmtUpdate ( self -> fmt, self -> u . wr . path, digest, true );
-		    KMD5SumFmtRelease ( self -> fmt );
-		    self -> fmt = NULL;
-		}
-		break;
-	    }
-	    break;
-        }
-
-        /* append bytes */
-        MD5StateAppend ( & self -> md5, buff, num_read );
-    }
-
-    return rc;
-}
-
-/* Read
- *  read-only version allows random access reads
- */
-static
-rc_t CC KMD5FileRead ( const KMD5File *cself,
-    uint64_t pos, void *buffer, size_t bsize, size_t *num_read )
-{
-    rc_t rc;
-    size_t total = 0;
-    uint64_t end = pos + bsize;
-    KMD5File *self = ( KMD5File* ) cself;
-
-    * num_read = 0;
-
-    /* no buffer means no bytes */
-    if ( bsize == 0 )
-        return 0;
-
-    /* test for starting a read before the current marker
-       meaning that it does not figure in to the md5sum */
-    if ( self -> position  > pos )
-    {
-        /* test for entire buffer being before marker */
-        if ( end <= self -> position )
-            return KFileRead ( self -> file, pos, buffer, bsize, num_read );
-
-        /* perform a partial read without affecting md5 */
-        rc = KFileRead ( self -> file, pos, buffer, ( size_t ) ( self -> position - pos ), num_read );
-        if ( rc != 0 )
-            return rc;
-
-        /* adjust as if a new read request, remembering number read so far */
-        pos += * num_read;
-        total = * num_read;
-        buffer = & ( ( uint8_t* ) buffer ) [ * num_read ];
-
-        /* in case num_read != all bytes up to marker */
-        if ( pos != self -> position )
-            return 0;
-    }
-
-    /* test for hole between current marker and desired start */
-    else if ( self -> position < pos )
-    {
-        /* scan ahead, discarding */
-        rc = KMD5FileSeek ( self, pos );
-        if ( rc != 0 || self -> position < pos )
-            return rc;
-    }
-
-    /* no hole - and still some space in buffer */
-    assert ( self -> position == pos );
-    assert ( pos < end );
-
-    /* read bytes */
-    rc = KFileRead ( self -> file, pos, buffer, ( size_t ) ( end - pos ), num_read );
-    if ( rc == 0 )
-    {
-        /* detect bytes read */
-        if ( * num_read != 0 )
-        {
-            /* accumulate into MD5 */
-            self -> position += * num_read;
-            MD5StateAppend ( & self -> md5, buffer, * num_read );
-
-            /* add in any previously read bytes and return success */
-            * num_read += total;
-            return 0;
-        }
-	switch (self->type)
-	{
-	case KMD5FileTypeRead:
-	    /* EOF - get MD5 digest results */
-	    rc = KMD5FileFinish ( self );
-	    break;
-	case KMD5FileTypeWrite:
-	    if ( self -> fmt != NULL)
-	    {
-		uint8_t digest [ 16 ];
-
-		MD5StateFinish ( & self -> md5, digest );
-		KMD5SumFmtUpdate ( self -> fmt, self -> u . wr . path, digest, true );
-		KMD5SumFmtRelease ( self -> fmt );
-		self -> fmt = NULL;
-	    }
-	    break;
-	}
-
-    }
-
-    /* always return 0 if some bytes were read */
-    if ( total != 0 )
-    {
-        * num_read = total;
-        return 0;
-    }
-
-    return rc;
-}
-
-/* Read
- *  writeable version isn't keeping track of MD5 on read,
- *  so just forward to destination file
- */
-static
-rc_t CC KMD5FileFwdRead ( const KMD5File *self,
-    uint64_t pos, void *buffer, size_t bsize, size_t *num_read )
-{
-    return KFileRead ( self -> file, pos, buffer, bsize, num_read );
-}
-
-
-/* Write
- */
-static
-rc_t CC KMD5FileBadWrite ( KMD5File *self, uint64_t pos,
-    const void *buffer, size_t size, size_t *num_writ )
-{
-    * num_writ = 0;
-    if ( size == 0 )
-        return 0;
-    if ( buffer == NULL )
-        return RC ( rcFS, rcFile, rcWriting, rcBuffer, rcNull );
-
-    return RC ( rcFS, rcFile, rcReading, rcFile, rcReadonly );
-}
-
-static
-rc_t CC KMD5FileWrite ( KMD5File *self, uint64_t pos,
-    const void *buffer, size_t size, size_t *num_writ )
-{
-    rc_t rc;
-
-    if ( pos != self -> position )
-        return RC ( rcFS, rcFile, rcWriting, rcParam, rcInvalid );
-
-    rc = KFileWrite ( self -> file, pos, buffer, size, num_writ );
-    if ( rc == 0 && * num_writ != 0 )
-    {
-        self -> position += * num_writ;
-        if ( self -> position > self -> u . wr . max_position )
-            self -> u . wr . max_position = self -> position;
-        MD5StateAppend ( & self -> md5, buffer, * num_writ );
-    }
-
-    return rc;
-}
-
-
-/* ToKFile
- *  an MD5 file is a subclass of KFile
- *  this is an explicit cast operator
- */
-LIB_EXPORT KFile* CC KMD5FileToKFile ( KMD5File *self )
-{
-    if ( self != NULL )
-        return & self -> dad;
-    return NULL;
-}
-
-LIB_EXPORT const KFile* CC KMD5FileToKFileConst ( const KMD5File *self )
-{
-    if ( self != NULL )
-        return & self -> dad;
-    return NULL;
-}
-
-
-/* BeginTransaction
- *  preserve current MD5 state and file marker
- *  in preparation for rollback
- */
-LIB_EXPORT rc_t CC KMD5FileBeginTransaction ( KMD5File *self )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcFreezing, rcSelf, rcNull );
-    if ( ! self -> dad . write_enabled )
-        return RC ( rcFS, rcFile, rcFreezing, rcFile, rcReadonly );
-    if ( self -> u . wr . topen )
-        return RC ( rcFS, rcFile, rcFreezing, rcFile, rcBusy );
-
-    self -> u . wr . topen = true;
-    self -> u . wr . tposition = self -> position;
-    self -> u . wr . tmd5 = self -> md5;
-
-    return 0;
-}
-
-
-/* Commit
- *  accept current MD5 state as correct
- */
-LIB_EXPORT rc_t CC KMD5FileCommit ( KMD5File *self )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcCommitting, rcSelf, rcNull );
-    if ( ! self -> dad . write_enabled )
-        return RC ( rcFS, rcFile, rcCommitting, rcFile, rcReadonly );
-
-    self -> u . wr . topen = false;
-
-    return 0;
-}
-
-
-/* Revert
- *  revert state to previous transaction boundary conditions
- */
-LIB_EXPORT rc_t CC KMD5FileRevert ( KMD5File *self )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcReverting, rcSelf, rcNull );
-    if ( ! self -> dad . write_enabled )
-        return RC ( rcFS, rcFile, rcReverting, rcFile, rcReadonly );
-    if ( ! self -> u . wr . topen )
-        return RC ( rcFS, rcFile, rcReverting, rcFile, rcInconsistent );
-
-    self -> position = self -> u . wr . tposition;
-    self -> md5 = self -> u . wr . tmd5;
-    self -> u . wr . topen = false;
-
-    return 0;
-}
-
-/* Reset
- *  reset state to that of an empty file
- *  aborts any open transaction
- */
-LIB_EXPORT rc_t CC KMD5FileReset ( KMD5File *self )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcResetting, rcSelf, rcNull );
-    if ( ! self -> dad . write_enabled )
-        return RC ( rcFS, rcFile, rcResetting, rcFile, rcReadonly );
-#if 1
-    self -> u . wr . topen = false;
-#else
-    if ( self -> u . wr . topen )
-        return RC ( rcFS, rcFile, rcResetting, rcFile, rcBusy );
-#endif
-
-    self -> position = 0;
-    MD5StateInit ( & self -> md5 );
-
-    return 0;
-}
-
-/*--------------------------------------------------------------------------
- * MD5File factories
- */
-
-
-/* MakeMD5Read
- *  creates an adapter to check MD5 checksum for a source file
- *
- *  "f" [ OUT ] - return parameter for file with md5 check
- *
- *  "src" [ IN ] - source file with read permission
- *
- *  "digest" [ IN ] - MD5 checksum to match
- *
- * NB - creates a read-only file that does NOT support random access
- *  i.e. must be consumed serially starting from offset 0
- */
-static KFile_vt_v1 KMD5FileRead_vt =
-{
-    1, 1,
-
-    /* 1.0 */
-    KMD5FileWhackRead,
-    KMD5FileGetSysFile,
-    KMD5FileRandomAccessRead,
-    KMD5FileSize,
-    KMD5FileSetSizeRead,
-    KMD5FileRead,
-    KMD5FileBadWrite,
-
-    /* 1.1 */
-    KMD5FileType
-};
-
-LIB_EXPORT rc_t CC KFileMakeMD5Read ( const KFile **fp,
-    const KFile *src, const uint8_t digest [ 16 ] )
-{
-    rc_t rc;
-
-    if ( fp == NULL )
-        rc = RC ( rcFS, rcFile, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( src == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNull );
-        else if ( ! src -> read_enabled )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNoPerm );
-        else if ( digest == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcParam, rcNull );
-        else
-        {
-            KMD5File *f = malloc ( sizeof * f - sizeof f -> u + sizeof f -> u . rd );
-            if ( f == NULL )
-                rc = RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                rc = KFileInit ( & f -> dad,
-				     ( const KFile_vt* ) & KMD5FileRead_vt, "KMD5File", "no-name", true, false );
-                if ( rc == 0 )
-                {
-                    f -> position = 0;
-                    MD5StateInit ( & f -> md5 );
-                    f -> file = ( KFile* ) src;
-                    f -> fmt = NULL;
-                    f -> type = KMD5FileTypeRead;
-                    f -> u . rd . rc = 0;
-                    f -> u . rd . eof = 0;
-                    memcpy ( f -> u . rd . digest, digest, sizeof f -> u . rd . digest );
-
-                    * fp = & f -> dad;
-                    return 0;
-                }
-            }
-
-            free ( f );
-        }
-
-        * fp = NULL;
-    }
-
-    return rc;
-}
-
-
-/* MakeWrite
- *  creates an adapter to create MD5 checksum for a file
- *
- *  "f" [ OUT ] - return parameter for file with md5 check
- *
- *  "out" [ IN ] - output file with write permission
- *  since this file is being wrapped by "f", ownership of
- *  the provided reference is transferred to "f"
- *
- *  "md5" [ IN ] - md5 checksum output formatter.
- *  since this may be used for multiple checksums, "f" will
- *  attach its own reference to "md5".
- *
- *  "path" [ IN ] - md5 checksum output file path, used to
- *  create standard md5sum file entry.
- *
- * NB - creates a write-only file that does NOT suppport random access
- *  i.e. must be written serially from offset 0
- */
-static KFile_vt_v1 sKMD5FileWrite_vt =
-{
-    1, 0,
-
-    KMD5FileWhackWrite,
-    KMD5FileGetSysFile,
-    KMD5FileRandomAccessWrite,
-    KMD5FileSize,
-    KMD5FileSetSizeWrite,
-    KMD5FileFwdRead,
-    KMD5FileWrite
-};
-
-LIB_EXPORT rc_t CC KMD5FileMakeWrite ( KMD5File **fp,
-    KFile *out, KMD5SumFmt *md5, const char *path )
-{
-    rc_t rc;
-
-    if ( fp == NULL )
-        rc = RC ( rcFS, rcFile, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( out == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNull );
-        else if ( ! out -> write_enabled )
-        {
-            if ( out -> read_enabled )
-                rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcReadonly );
-            else
-                rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNoPerm );
-        }
-        else if ( md5 == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNull );
-        else if ( md5 -> read_only )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcReadonly );
-        else if ( path == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcPath, rcNull );
-        else if ( path [ 0 ] == 0 )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcPath, rcEmpty );
-        else
-        {
-            KMD5File *f = malloc ( sizeof * f - sizeof f -> u +
-                sizeof f -> u . wr + strlen ( path ) );
-            if ( f == NULL )
-                rc = RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                rc = KFileInit ( & f -> dad,
-                    ( const KFile_vt* ) & sKMD5FileWrite_vt, "KMD5File", path, out -> read_enabled, true );
-                if ( rc == 0 )
-                {
-                    f -> position = 0;
-                    MD5StateInit ( & f -> md5 );
-                    f -> file = out;
-                    f -> fmt = md5;
-		    f -> type = KMD5FileTypeWrite;
-
-                    memset ( & f -> u . wr, 0, sizeof f -> u . wr );
-                    strcpy ( f -> u . wr . path, path );
-
-                    rc = KFileSize ( out, & f -> u . wr . max_position );
-                    if (rc)
-                    {
-                        if (GetRCState (rc) == rcUnsupported)
-                        {
-                            f -> u . wr . max_position  = 0;
-                            rc = 0;
-                        }
-                    }    
-                    if ( rc == 0 )
-                        rc = KMD5SumFmtAddRef ( md5 );
-                    if ( rc == 0 )
-                    {
-                        * fp = f;
-                        return 0;
-                    }
-                }
-
-                free ( f );
-            }
-        }
-
-        * fp = NULL;
-    }
-
-    return rc;
-}
-
-/* MakeAppend
- *  creates an adapter to create MD5 checksum for a file
- *
- *  "f" [ OUT ] - return parameter for file with md5 check
- *
- *  "out" [ IN ] - output file with write permission
- *  since this file is being wrapped by "f", ownership of
- *  the provided reference is transferred to "f"
- *
- *  "md5" [ IN ] - md5 checksum output formatter.
- *  since this may be used for multiple checksums, "f" will
- *  attach its own reference to "md5".
- *
- *  "path" [ IN ] - md5 checksum output file path, used to
- *  create standard md5sum file entry.
- *
- * NB - creates a write-only file that does NOT suppport random access
- *  i.e. must be written serially from current EOF (minus the stored MD5 context)
- */
-static KFile_vt_v1 sKMD5FileAppend_vt =
-{
-    1, 0,
-
-    KMD5FileWhackAppend,
-    KMD5FileGetSysFile,
-    KMD5FileRandomAccessWrite,
-    KMD5FileSizeAppend,
-    KMD5FileSetSizeWrite,
-    KMD5FileFwdRead,
-    KMD5FileWrite
-};
-
-LIB_EXPORT rc_t CC KMD5FileMakeAppend ( KMD5File **fp, KFile *out, KMD5SumFmt *md5, const char *path )
-{
-    rc_t rc;
-    KLogLevel lvl = klogInt;
-    
-    if ( fp == NULL )
-        rc = RC ( rcFS, rcFile, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( out == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNull );
-        else if ( ! out -> write_enabled )
-        {
-            if ( out -> read_enabled )
-                rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcReadonly );
-            else
-                rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNoPerm );
-        }
-        else if ( md5 == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNull );
-        else if ( md5 -> read_only )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcReadonly );
-        else if ( path == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcPath, rcNull );
-        else if ( path [ 0 ] == 0 )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcPath, rcEmpty );
-        else
-        {
-            KMD5File *f = malloc ( sizeof * f - sizeof f -> u +
-                sizeof f -> u . wr + strlen ( path ) );
-            if ( f == NULL )
-            {
-                rc = RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-                lvl = klogSys;
-            }
-            else
-            {
-                rc = KFileInit ( & f -> dad,
-                    ( const KFile_vt* ) & sKMD5FileAppend_vt, "KMD5File", path, out -> read_enabled, true );
-                if ( rc == 0 )
-                {
-                    MD5StateInit ( & f -> md5 );
-                    f -> file = out;
-                    f -> fmt = md5;
-		    f -> type = KMD5FileTypeWrite;
-
-                    rc = KMD5SumFmtAddRef ( md5 );
-                    if ( rc != 0 )
-                    {
-                        free ( f );
-                        * fp = NULL;
-                        return rc;
-                    }
-
-                    memset ( & f -> u . wr, 0, sizeof f -> u . wr );
-                    strcpy ( f -> u . wr . path, path );
-
-                    lvl = klogSys;
-                    rc = KFileSize ( out, & f -> position );
-                    if ( rc == 0 )
-                    {
-                        uint8_t buffer [ sizeof MD5TAG + sizeof ENDIANTAG + sizeof f -> md5 ];
-
-                        /* an empty file is fine */
-                        if ( f -> position == 0 )
-                        {
-                            * fp = f;
-                            return 0;
-                        }
-
-                        /* set max */
-                        f -> u . wr . max_position = f -> position;
-
-                        /* a file without a trailing MD5 state is incorrect or corrupt */
-                        if ( f -> position < sizeof buffer )
-                        {
-                            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcIncorrect );
-                            lvl = klogErr;
-                        }
-                        else
-                        {
-                            /* try to read MD5 state */
-                            size_t num_read;
-                            rc = KFileRead ( out, f -> position - sizeof buffer, buffer, sizeof buffer, & num_read );
-                            if ( rc == 0 )
-                            {
-                                if ( num_read != sizeof buffer )
-                                    rc = RC ( rcFS, rcFile, rcConstructing, rcTransfer, rcIncomplete );
-                                else
-                                {
-                                    /* errors from here are usage errors */
-                                    lvl = klogErr;
-                                    
-                                    if ( memcmp ( buffer, MD5TAG, sizeof MD5TAG ) != 0 )
-                                        rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcIncorrect );
-                                    else
-                                    {
-                                        /* forget about the MD5 state */
-                                        f -> position -= sizeof buffer;
-                                        memcpy ( & f -> md5, & buffer [ sizeof MD5TAG + sizeof ENDIANTAG ], sizeof f -> md5 );
-                                        
-                                        /* check for proper byte order */
-                                        if ( memcmp ( & buffer [ sizeof MD5TAG ], ENDIANTAG, sizeof ENDIANTAG ) == 0 )
-                                        {
-                                            * fp = f;
-                                            return 0;
-                                        }
-
-                                        /* probably swapped, but confirm */
-                                        if ( memcmp ( & buffer [ sizeof MD5TAG ], ENDIANSWAPTAG, sizeof ENDIANSWAPTAG ) == 0 )
-                                        {
-                                            int i;
-
-                                            for ( i = 0; i < sizeof f -> md5 . count / sizeof f -> md5 . count [ 0 ]; ++ i )
-                                                f -> md5 . count [ i ] = bswap_32 ( f -> md5 . count [ i ] );
-                                            for ( i = 0; i < sizeof f -> md5 . abcd / sizeof f -> md5 . abcd [ 0 ]; ++ i )
-                                                f -> md5 . abcd [ i ] = bswap_32 ( f -> md5 . abcd [ i ] );
-
-                                            * fp = f;
-                                            return 0;
-                                        }
-                                        
-                                        /* garbage */
-                                        rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcCorrupt );
-                                    }
-                                }
-                            }
-                        }
-                    }
-                    
-                    KMD5SumFmtRelease ( md5 );
-                }
-                
-                free ( f );
-            }
-        }
-        
-        * fp = NULL;
-    }
-    
-    LOGERR ( lvl, rc, "append-mode MD5 file" );
-    
-    return rc;
-}
-
-static KFile_vt_v1 sKMD5FileReadCreate_vt =
-{
-    1, 1,
-
-    KMD5FileWhackCreate,
-    KMD5FileGetSysFile,
-    KMD5FileRandomAccessRead,
-    KMD5FileSize,
-    KMD5FileSetSizeRead,
-    KMD5FileRead,
-    KMD5FileBadWrite,
-
-    /* 1.1 */
-    KMD5FileType
-};
-
-/* MakeReadNew
- *  creates an adapter to create MD5 checksum for a file
- *
- *  "in" [ IN ] - input file 
- *  since this file is being wrapped by "f", ownership of
- *  the provided reference is transferred to "f"
- */
-LIB_EXPORT rc_t CC KFileMakeNewMD5Read ( const KFile **fp,
-    const struct KFile *in, KMD5SumFmt *md5, const char *path )
-{
-    rc_t rc;
-
-    if ( fp == NULL )
-        rc = RC ( rcFS, rcFile, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( in == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNull );
-        else if ( ! in -> read_enabled )
-	    rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNoPerm );
-        else if ( md5 == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNull );
-        else if ( md5 -> read_only )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcReadonly );
-        else if ( path == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcPath, rcNull );
-        else if ( path [ 0 ] == 0 )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcPath, rcEmpty );
-        else
-        {
-            size_t path_size = string_size ( path );
-            KMD5File *f = malloc ( sizeof * f + path_size );
-            if ( f == NULL )
-                rc = RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                rc = KFileInit ( & f -> dad,
-                    ( const KFile_vt* ) & sKMD5FileReadCreate_vt, "KMD5File", path, in -> read_enabled, false );
-                if ( rc == 0 )
-                {
-                    f -> position = 0;
-                    MD5StateInit ( & f -> md5 );
-                    f -> file = (KFile*)in;
-                    f -> fmt = md5;
-		    f -> type = KMD5FileTypeWrite;
-                    memset ( & f -> u . wr, 0, sizeof f -> u . wr );
-                    string_copy ( f -> u . wr . path, path_size + 1, path, path_size );
-#if 0
-/* KFileSize can't always be used */
-                    rc = KFileSize ( in, & f -> u . wr . max_position );
-#else
-		    f->u.wr.max_position = 0;
-#endif
-                    if ( rc == 0 )
-                        rc = KMD5SumFmtAddRef ( md5 );
-                    if ( rc == 0 )
-                    {
-                        * fp = &f->dad;
-                        return 0;
-                    }
-                }
-
-                free ( f );
-            }
-        }
-
-        * fp = NULL;
-    }
-
-    return rc;
-}
-
-
-/* end of file */
diff --git a/libs/kfs/mmap-priv.h b/libs/kfs/mmap-priv.h
deleted file mode 100644
index e9a44b7..0000000
--- a/libs/kfs/mmap-priv.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_mmap_priv_
-#define _h_mmap_priv_
-
-#ifndef _h_kfs_mmap_
-#include <kfs/mmap.h>
-#endif
-
-#ifndef _h_klib_refcount_
-#include <klib/refcount.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * KMMap
- *  a memory mapped region
- */
-#if 0
-/* minimal structure */
-struct KMMap
-{
-    uint64_t off;
-    uint64_t pos;
-    size_t size;
-    char *addr;
-
-    struct KFile *f;
-    size_t pg_size;
-
-    uint32_t addr_adj;
-    uint32_t size_adj;
-
-    KRefcount refcount;
-
-    bool read_only;
-    bool sys_mmap;
-    bool dirty;
-};
-#endif
-
-
-/* Make
- *  make an open OS-specific KMMap structure
- *  common code will initialize common parts such as KFile*
- */
-rc_t KMMapMake ( KMMap **mmp );
-
-
-/* RWSys
- *  map the region of mapped file into memory for read & write
- *  using system memory mapping function
- *
- *  the values for "pos" and "size" can be trusted
- *  as correct for page alignment
- */
-rc_t KMMapRWSys ( KMMap *self, uint64_t pos, size_t size );
-
-
-/* ROSys
- *  map the region of mapped file into memory for read only
- *  using system memory mapping function
- *
- *  the values for "pos" and "size" can be trusted
- *  as correct for page alignment
- */
-rc_t KMMapROSys ( KMMap *self, uint64_t pos, size_t size );
-
-
-/* Unmap
- *  removes a memory map
- */
-rc_t KMMapUnmap ( KMMap *self );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_mmap_priv_ */
diff --git a/libs/kfs/mmap.c b/libs/kfs/mmap.c
deleted file mode 100644
index 69391d7..0000000
--- a/libs/kfs/mmap.c
+++ /dev/null
@@ -1,754 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kfs/extern.h>
-#include "mmap-priv.h"
-#include "sysmmap-priv.h"
-#include "sysfile-priv.h"
-#include <klib/refcount.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-
-
-#define USE_MALLOC_MMAP 1
-
-#if USE_MALLOC_MMAP
-
-#ifndef FORCE_MALLOC_MMAP
-#define FORCE_MALLOC_MMAP 0
-#endif
-
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KMMap
- *  a memory mapped region
- */
-
-
-/* Unmap
- */
-static
-rc_t KMMapUnmapRgn ( KMMap *self )
-{
-    rc_t rc;
-
-    if ( self -> sys_mmap )
-        rc = KMMapUnmap ( self );
-    else
-    {
-        rc = 0;
-
-        if ( self -> dirty )
-        {
-            size_t num_writ, total;
-            for (  total = 0; total < self -> size; total += num_writ )
-            {
-                rc = KFileWrite ( self -> f, self -> pos + total,
-                    & self -> addr [ total ], self -> size - total, & num_writ );
-                if ( rc != 0 || num_writ == 0 )
-                    break;
-            }
-
-            if ( rc == 0 && total < self -> size )
-                rc = RC ( rcFS, rcMemMap, rcDestroying, rcTransfer, rcIncomplete );
-        }
-
-        if ( rc == 0 )
-            free ( self -> addr );
-    }
-
-    if ( rc == 0 )
-    {
-        self -> off = self -> pos = 0;
-        self -> addr = NULL;
-        self -> size = 0;
-        self -> sys_mmap = self -> dirty = false;
-    }
-
-    return rc;
-}
-
-/* Whack
- */
-static
-rc_t KMMapWhack ( KMMap *self )
-{
-    rc_t rc = KMMapUnmapRgn ( self );
-    if ( rc != 0 )
-    {
-        KRefcountAdd ( & self -> refcount, "KMMap" );
-        return rc;
-    }
-
-    /* now goes the file */
-    KFileRelease ( self -> f );
-    free ( self );
-
-    return 0;
-}
-
-
-/* AddRef
- * Release
- *  ignores NULL references
- */
-LIB_EXPORT rc_t CC KMMapAddRef ( const KMMap *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KMMap" ) )
-        {
-        case krefLimit:
-            return RC ( rcFS, rcMemMap, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KMMapRelease ( const KMMap *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KMMap" ) )
-        {
-        case krefWhack:
-            return KMMapWhack ( ( KMMap* ) self );
-        case krefNegative:
-            return RC ( rcFS, rcMemMap, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-/* Size
- *  returns size of memory region
- *
- *  "size" [ OUT ] - return parameter for region size
- */
-LIB_EXPORT rc_t CC KMMapSize ( const KMMap *self, size_t *size )
-{
-    if ( size == NULL )
-        return RC ( rcFS, rcMemMap, rcAccessing, rcParam, rcNull );
-
-    if ( self != NULL )
-    {
-        * size = self -> size;
-        return 0;
-    }
-
-    * size = 0;
-    return RC ( rcFS, rcMemMap, rcAccessing, rcSelf, rcNull );
-}
-
-
-/* Position
- *  returns region starting offset into mapped file
- *
- *  "pos" [ OUT ] - return parameter for file offset
- */
-LIB_EXPORT rc_t CC KMMapPosition ( const KMMap *self, uint64_t *pos )
-{
-    if ( pos == NULL )
-        return RC ( rcFS, rcMemMap, rcAccessing, rcParam, rcNull );
-
-    if ( self != NULL )
-    {
-        * pos = self -> pos;
-        return 0;
-    }
-
-    * pos = 0;
-    return RC ( rcFS, rcMemMap, rcAccessing, rcSelf, rcNull );
-}
-
-
-/* Addr
- *  returns starting address of memory region
- *
- *  "addr" [ OUT ] - return parameter for memory address
- */
-LIB_EXPORT rc_t CC KMMapAddrRead ( const KMMap *self, const void **addr )
-{
-    if ( addr == NULL )
-        return RC ( rcFS, rcMemMap, rcAccessing, rcParam, rcNull );
-
-    if ( self != NULL )
-    {
-        if ( self -> addr == NULL )
-            return RC ( rcFS, rcMemMap, rcAccessing, rcMemMap, rcInvalid );
-
-        * addr = ( const void* ) self -> addr;
-        return 0;
-    }
-
-    * addr = NULL;
-    return RC ( rcFS, rcMemMap, rcAccessing, rcSelf, rcNull );
-}
-
-LIB_EXPORT rc_t CC KMMapAddrUpdate ( KMMap *self, void **addr )
-{
-    if ( addr == NULL )
-        return RC ( rcFS, rcMemMap, rcAccessing, rcParam, rcNull );
-
-    * addr = NULL;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcMemMap, rcAccessing, rcSelf, rcNull );
-
-    if ( self -> read_only )
-        return RC ( rcFS, rcMemMap, rcAccessing, rcMemMap, rcReadonly );
-
-    if (  self -> addr == NULL )
-        return RC ( rcFS, rcMemMap, rcAccessing, rcMemMap, rcInvalid );
-
-    if ( ! self -> sys_mmap )
-        self -> dirty = true;
-
-    * addr = self -> addr;
-    return 0;
-}
-
-
-/* MallocRgn
- */
-#if USE_MALLOC_MMAP
-static
-rc_t KMMapMallocRgn ( KMMap *self, uint64_t pos, size_t size, bool read_only )
-{
-    rc_t rc;
-    uint64_t eof;
-
-    self -> off = 0;
-    self -> read_only = read_only;
-    self -> sys_mmap = self -> dirty = false;
-
-    /* try to crop size to actual file size */
-    rc = KFileSize ( self -> f, & eof );
-    if ( rc == 0 )
-    {
-        /* mapping beyond end of file */
-        if ( pos >= eof )
-        {
-            if ( read_only )
-            {
-                self -> pos = pos;
-                self -> addr = NULL;
-                self -> size = 0;
-                return 0;
-            }
-
-            /* allocate real memory */
-            self -> addr = calloc ( 1, size );
-            if ( self -> addr == NULL )
-                return RC ( rcFS, rcMemMap, rcConstructing, rcMemory, rcExhausted );
-
-            self -> pos = pos;
-            self -> size = size;
-            self -> dirty = true;
-            return 0;
-        }
-
-        /* crop for readonly case */
-        if ( read_only && (( size == 0 ) || ( pos + size > eof )))
-            size = ( size_t ) ( eof - pos );
-    }
-
-    /* now allocate memory */
-    self -> addr = malloc ( size );
-    if ( self -> addr == NULL )
-        rc = RC ( rcFS, rcMemMap, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        size_t num_read, total;
-        for ( rc = 0, total = 0; total < size; total += num_read )
-        {
-            rc = KFileRead ( self -> f, pos + total,
-                & self -> addr [ total ], size - total, & num_read );
-            if ( rc != 0 || num_read == 0 )
-                break;
-        }
-
-        if ( total != 0 )
-            rc = 0;
-
-        if ( total != size )
-            memset ( & self -> addr [ total ], 0, size - total );
-
-        self -> pos = pos;
-        self -> size = total;
-    }
-
-    return rc;
-}
-#endif
-
-
-/* RWRgn
- */
-static
-rc_t KMMapRWRgn ( KMMap *self, uint64_t pos, size_t size )
-{
-    rc_t rc;
-    KSysFile *sf = KFileGetSysFile ( self -> f, & self -> off );
-
-    if ( ! self -> f -> read_enabled || ! self -> f -> write_enabled )
-        rc = RC ( rcFS, rcMemMap, rcConstructing, rcFile, rcNoPerm );
-
-    else if ( sf == NULL )
-    {
-#if USE_MALLOC_MMAP
-        rc = KMMapMallocRgn ( self, pos, size, false );
-#else
-        rc = RC ( rcFS, rcMemMap, rcConstructing, rcFile, rcIncorrect );
-#endif
-    }
-
-    else if ( self -> off != 0 )
-        rc = RC ( rcFS, rcMemMap, rcConstructing, rcFile, rcNoPerm );
-
-    else
-    {
-        uint64_t eof;
-        rc = KFileSize ( self -> f, & eof );
-        if ( rc == 0 )
-        {
-            size_t bytes;
-            uint64_t pg_mask, left, right, range;
-
-            if ( size == 0 )
-            {
-                size = ( size_t ) eof;
-                if ( ( uint64_t ) size != eof )
-                    return RC ( rcFS, rcMemMap, rcConstructing, rcParam, rcExcessive );
-            }
-
-            pg_mask = self -> pg_size - 1;
-            left = pos & ~ pg_mask;
-            right = ( pos + size + pg_mask ) & ~ pg_mask;
-            range = right - left;
-
-            bytes = ( size_t ) range;
-            if ( ( uint64_t ) bytes != range )
-                return RC ( rcFS, rcMemMap, rcConstructing, rcParam, rcExcessive );
-
-            /* extend right edge if necessary */
-            if ( eof < right )
-            {
-                rc = KFileSetSize ( self -> f, right );
-                if ( rc != 0 )
-                    return ResetRCContext ( rc, rcFS, rcMemMap, rcConstructing );
-            }
-
-            if ( bytes == 0 )
-            {
-                self -> addr = NULL;
-                self -> addr_adj = 0;
-                self -> size_adj = 0;
-                self -> size = 0;
-            }
-            else
-            {
-#if FORCE_MALLOC_MMAP
-                rc = -1;
-#else
-                rc = KMMapRWSys ( self, left, bytes );
-#endif
-                if ( rc != 0 )
-                {
-                    self -> addr_adj = self -> size_adj = 0;
-                    self -> size = 0;
-
-                    if ( eof < right )
-                        KFileSetSize ( self -> f, eof );
-#if USE_MALLOC_MMAP
-                    rc = KMMapMallocRgn ( self, pos, size, false );
-#endif
-                    return rc;
-                }
-
-                self -> addr += pos - left;
-                self -> addr_adj = ( uint32_t ) ( pos - left );
-                self -> size_adj = ( uint32_t ) ( bytes - size );
-                self -> size = size;
-                self -> sys_mmap = true;
-            }
-
-            self -> pos = pos;
-            self -> read_only = false;
-        }
-    }
-
-    return rc;
-}
-
-
-/* RORgn
- */
-static
-rc_t KMMapRORgn ( KMMap *self, uint64_t pos, size_t size )
-{
-    rc_t rc;
-
-    if ( ! self -> f -> read_enabled )
-        rc = RC ( rcFS, rcMemMap, rcConstructing, rcFile, rcNoPerm );
-    else
-    {
-        uint64_t eof;
-
-        /* pos is relative to a virtual file; s_pos is relative to a system file */
-        uint64_t s_pos = pos;
-
-        KSysFile *sf = KFileGetSysFile ( self -> f, & self -> off );
-        if ( sf == NULL )
-        {
-#if USE_MALLOC_MMAP
-            return KMMapMallocRgn ( self, pos, size, true );
-#else
-            return RC ( rcFS, rcMemMap, rcConstructing, rcFile, rcIncorrect );
-#endif
-        }
-
-        rc = KFileSize ( self -> f, & eof );
-
-        /* if file has known size */
-        if ( rc == 0 )
-        {
-            size_t bytes;
-            uint64_t pg_mask, left, right, range;
-
-            if ( size == 0 )
-            {
-                size = ( size_t ) eof;
-                if ( ( uint64_t ) size != eof )
-                    return RC ( rcFS, rcMemMap, rcConstructing, rcParam, rcExcessive );
-            }
-
-            if ( pos + size > eof )
-            {
-                if ( pos >= eof )
-                    return RC ( rcFS, rcMemMap, rcConstructing, rcParam, rcInvalid );
-                size = ( size_t ) ( eof - pos );
-            }
-
-            if ( self -> off != 0 )
-            {
-                s_pos = pos + self -> off;
-                rc = KFileSize ( & sf -> dad, & eof ); /* eof is now for the sysfile */
-                if ( rc != 0 )
-                    return ResetRCContext ( rc, rcFS, rcMemMap, rcConstructing );
-            }
-
-            pg_mask = self -> pg_size - 1;
-            left = s_pos & ~ pg_mask;
-            right = ( s_pos + size + pg_mask ) & ~ pg_mask;
-
-            if ( eof < right )
-                right = eof;
-
-            range = right - left;
-            bytes = ( size_t ) range;
-            if ( ( uint64_t ) bytes != range )
-                return RC ( rcFS, rcMemMap, rcConstructing, rcParam, rcExcessive );
-
-            if ( bytes == 0 )
-            {
-                size = 0;
-                self -> addr = NULL;
-                self -> addr_adj = 0;
-                self -> size_adj = 0;
-            }
-            else
-            {
-#if FORCE_MALLOC_MMAP
-                rc = -1;
-#else
-                rc = KMMapROSys ( self, left, bytes );
-#endif
-                if ( rc != 0 )
-                {
-                    self -> addr_adj = self -> size_adj = 0;
-                    self -> size = 0;
-#if USE_MALLOC_MMAP
-                    rc = KMMapMallocRgn ( self, pos, size, true );
-#endif
-                    return rc;
-                }
-            
-                self -> addr += s_pos - left;
-                self -> addr_adj = ( uint32_t ) ( s_pos - left );
-                self -> size_adj = ( uint32_t ) ( bytes - size );
-                self -> sys_mmap = true;
-            }
-        }
-
-        self -> pos = pos;
-        self -> size = size;
-        self -> read_only = true;
-    }
-
-    return rc;
-}
-
-
-/* MakeRgn
- *  maps a portion of a file
- *
- *  "f" [ IN ] - file to map
- *  a new reference will be attached
- *
- *  "pos" [ IN ] - starting offset into file
- *
- *  "size" [ IN, DEFAULT ZERO ] - size of resulting region. if 0,
- *  the size will be interpreted as meaning size of "f" - "pos".
- */
-static
-rc_t KMMapMakeRgn ( KMMap **mmp, const KFile *f )
-{
-    KMMap *mm;
-    rc_t rc = KMMapMake ( & mm );
-    if ( rc == 0 )
-    {
-        rc = KFileAddRef ( f );
-        if ( rc == 0 )
-        {
-            mm -> f = ( KFile* ) f;
-            mm -> off = mm -> pos = 0;
-            mm -> size = 0;
-            mm -> addr = NULL;
-            mm -> addr_adj = mm -> size_adj = 0;
-            KRefcountInit ( & mm -> refcount, 1, "KMMap", "make", "mmap" );
-            mm -> sys_mmap = false;
-            mm -> read_only = false;
-            mm -> dirty = false;
-    
-            * mmp = mm;
-            return 0;
-        }
-
-        KMMapWhack ( mm );
-    }
-
-    * mmp = NULL;
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMMapMakeRgnRead ( const KMMap **mmp,
-    const KFile *f, uint64_t pos, size_t size )
-{
-    rc_t rc;
-    if ( mmp == NULL )
-        rc = RC ( rcFS, rcMemMap, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( f == NULL )
-            rc = RC ( rcFS, rcMemMap, rcConstructing, rcFile, rcNull );
-        else if ( ! f -> read_enabled )
-            rc = RC ( rcFS, rcMemMap, rcConstructing, rcFile, rcNoPerm );
-        else
-        {
-            KMMap *mm;
-            rc = KMMapMakeRgn ( & mm, f );
-            if ( rc == 0 )
-            {
-                rc = KMMapRORgn ( mm, pos, size );
-                if ( rc == 0 )
-                {
-                    * mmp = mm;
-                    return 0;
-                }
-
-                KMMapWhack ( mm );
-            }
-        }
-
-        * mmp = NULL;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KMMapMakeRgnUpdate ( KMMap **mmp,
-    KFile *f, uint64_t pos, size_t size )
-{
-    rc_t rc;
-    if ( mmp == NULL )
-        rc = RC ( rcFS, rcMemMap, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( f == NULL )
-            rc = RC ( rcFS, rcMemMap, rcConstructing, rcFile, rcNull );
-        else if ( ! f -> read_enabled || ! f -> write_enabled )
-            rc = RC ( rcFS, rcMemMap, rcConstructing, rcFile, rcNoPerm );
-        else
-        {
-            KMMap *mm;
-            rc = KMMapMakeRgn ( & mm, f );
-            if ( rc == 0 )
-            {
-                rc = KMMapRWRgn ( mm, pos, size );
-                if ( rc == 0 )
-                {
-                    * mmp = mm;
-                    return 0;
-                }
-
-                KMMapWhack ( mm );
-            }
-        }
-
-        * mmp = NULL;
-    }
-    return rc;
-}
-
-/* Make
- *  maps entire file
- *
- *  "f" [ IN ] - file to map.
- *  a new reference will be attached
- */
-LIB_EXPORT rc_t CC KMMapMakeRead ( const KMMap **mm, const KFile *f )
-{
-    return KMMapMakeRgnRead ( mm, f, 0, 0 );
-}
-
-LIB_EXPORT rc_t CC KMMapMakeUpdate ( KMMap **mm, KFile *f )
-{
-    return KMMapMakeRgnUpdate ( mm, f, 0, 0 );
-}
-
-
-/* MakeMax
- *  maps as much of a file as possible
- *
- *  "f" [ IN ] - file to map.
- *  a new reference will be added
- */
-LIB_EXPORT rc_t CC KMMapMakeMaxRead ( const KMMap **mm, const KFile *f )
-{
-    /* 32-bit architecture */
-    if ( sizeof mm == 4 )
-        return KMMapMakeRgnRead ( mm, f, 0, 1500 * 1024 * 1024 );
-
-    /* 64-bit or beyond */
-    return KMMapMakeRgnRead ( mm, f, 0,  ( ( size_t ) 48 ) * 1024 * 1024 * 1024 );
-}
-
-LIB_EXPORT rc_t CC KMMapMakeMaxUpdate ( KMMap **mm, KFile *f )
-{
-    uint64_t eof;
-    rc_t rc = KFileSize ( f, & eof );
-    if ( rc == 0 )
-    {
-        /* 32-bit architecture */
-        if ( sizeof mm == 4 && eof > 1500 * 1024 * 1024 )
-            eof = 1500 * 1024 * 1024;
-
-        /* 64-bit or beyond */
-        if ( sizeof mm == 8 && eof > ( ( size_t ) 48 ) * 1024 * 1024 * 1024 )
-            eof = ( ( size_t ) 48 ) * 1024 * 1024 * 1024;
-
-        rc = KMMapMakeRgnUpdate ( mm, f, 0, ( size_t ) eof );
-    }
-    return rc;
-}
-
-
-/* Reposition
- *  shift region to a new position
- *  may change region size
- *
- *  "pos" [ IN ] - new starting position for region
- *
- *  "size" [ OUT, NULL OKAY ] - optional return parameter
- *  for resultant region size
- */
-LIB_EXPORT rc_t CC KMMapReposition ( const KMMap *cself, uint64_t pos, size_t *size )
-{
-    KMMap *self;
-    size_t ignore;
-    if ( size == NULL )
-        size = & ignore;
-
-    * size = 0;
-
-    self = ( KMMap* ) cself;
-    if ( cself != NULL )
-    {
-        rc_t rc;
-        size_t rgn_size = self -> size;
-        uint64_t pg_mask, left, right;
-
-        /* regardless of condition, if no change
-           in position is requested, we're done */
-        if ( pos == self -> pos )
-        {
-            * size = rgn_size;
-            return 0;
-        }
-
-        /* detect multiple owners */
-        if ( atomic32_read ( & self -> refcount ) > 1 )
-            return RC ( rcFS, rcMemMap, rcPositioning, rcMemMap, rcBusy );
-
-        pg_mask = self -> pg_size - 1;
-        left = self -> pos & ~ pg_mask;
-        right = left + rgn_size + self -> size_adj;
-
-        /* we're modifiable, so see if position
-           is within first page of current map */
-        if ( ( pos & ~ pg_mask ) == left )
-        {
-            self -> addr -= self -> addr_adj;
-            self -> addr_adj = self -> size_adj = ( uint32_t ) ( pos - left );
-            self -> addr += pos - left;
-            self -> pos = pos;
-            * size = self -> size = ( size_t ) ( right - pos );
-            return 0;
-        }
-
-        if ( rgn_size != 0 || self -> size_adj != 0 )
-        {
-            rc = KMMapUnmapRgn ( self );
-            if ( rc != 0 )
-                return rc;
-        }
-
-        self -> addr_adj = self -> size_adj = 0;
-
-        rc = ( self -> read_only ? KMMapRORgn : KMMapRWRgn ) ( self, pos, rgn_size );
-
-        if ( rc == 0 )
-            * size = self -> size;
-        return rc;
-    }
-
-    return RC ( rcFS, rcMemMap, rcPositioning, rcSelf, rcNull );
-}
diff --git a/libs/kfs/nullfile.c b/libs/kfs/nullfile.c
deleted file mode 100644
index 22eab36..0000000
--- a/libs/kfs/nullfile.c
+++ /dev/null
@@ -1,273 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-#include <kfs/extern.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <kfs/file.h>
-#include <sysalloc.h>
-#include <kfs/nullfile.h>
-
-#include <assert.h>
-#include <stdlib.h>
-
-/* ======================================================================
- * KNullFile
- */
-
-/* -----
- * define the specific types to be used in the templatish/inheritancish
- * definition of vtables and their elements
- */
-#define KFILE_IMPL struct KNullFile
-#include <kfs/impl.h>
-
-static rc_t CC KNullFileDestroy (KNullFile *self);
-static struct KSysFile *CC KNullFileGetSysFile (const KNullFile *self,
-					     uint64_t *offset);
-static rc_t CC KNullFileRandomAccess (const KNullFile *self);
-static uint32_t CC KNullFileType (const KNullFile *self);
-static rc_t CC KNullFileSize (const KNullFile *self, uint64_t *size);
-static rc_t CC KNullFileSetSize (KNullFile *self, uint64_t size);
-static rc_t CC KNullFileRead (const KNullFile *self, uint64_t pos,
-			   void *buffer, size_t bsize, size_t *num_read);
-static rc_t CC KNullFileWrite (KNullFile *self, uint64_t pos, const void *buffer,
-			    size_t size, size_t *num_writ);
-
-
-static const KFile_vt_v1 vtKNullFile =
-{
-    /* version */
-    1, 1,
-
-    /* 1.0 */
-    KNullFileDestroy,
-    KNullFileGetSysFile,
-    KNullFileRandomAccess,
-    KNullFileSize,
-    KNullFileSetSize,
-    KNullFileRead,
-    KNullFileWrite,
-
-    /* 1.1 */
-    KNullFileType
-};
-
-/*-----------------------------------------------------------------------
- * KNullFile
- *  an archive file including tar and sra
- */
-struct KNullFile
-{
-    KFile	dad;
-};
-
-/* ----------------------------------------------------------------------
- * KNullFileMake
- *  create a new file object
- */
-static
-rc_t KNullFileMake (KNullFile ** self, bool write_allowed)
-{
-    rc_t	rc;
-    KNullFile *	pF;
-
-    /* -----
-     */
-    assert (self != NULL);
-
-    /* -----
-     * get space for the object
-     */
-    pF = malloc (sizeof (KNullFile));
-    if (pF == NULL)	/* allocation failed */
-    {
-	/* fail */
-	rc = RC (rcFS, rcFile, rcConstructing, rcMemory, rcExhausted);
-    }
-    else
-    {
-	rc = KFileInit (&pF->dad,			/* initialize base class */
-			(const KFile_vt*)&vtKNullFile, 	/* VTable for KNullFile */
-            "KNullFile", "no-name",
-			true,				/* read allowed */
-			write_allowed);
-	if (rc == 0)
-	{
-	    *self = pF;
-	    return 0;
-	}
-	/* fail */
-	free (pF);
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC KFileMakeNullRead ( const KFile ** self )
-{
-    return KNullFileMake ((KNullFile **)self, false);
-}
-
-LIB_EXPORT rc_t CC KFileMakeNullUpdate ( KFile ** self )
-{
-    return KNullFileMake ((KNullFile **)self, true);
-}
-
-/* ----------------------------------------------------------------------
- * Destroy
- *
- */
-static
-rc_t CC KNullFileDestroy (KNullFile *self)
-{
-    free (self);
-    return 0;
-}
-
-/* ----------------------------------------------------------------------
- * GetSysFile
- *  returns an underlying system file object
- *  and starting offset to contiguous region
- *  suitable for memory mapping, or NULL if
- *  no such file is available.
- *
- * We cant allow memory mapping a tee file as the read?writes ar needed
- * to trigger the writes to the copy KFile
- */
-
-static
-struct KSysFile *CC KNullFileGetSysFile (const KNullFile *self, uint64_t *offset)
-{
-    /* parameters must be non-NULL */
-    assert (self != NULL);
-    assert (offset != NULL);
-
-    /* not implmenting at this time */
-    return NULL;
-}
-
-/* ----------------------------------------------------------------------
- * RandomAccess
- *
- *  returns 0 if random access, error code otherwise
- *
- * Update needs to be able to seek both original and copy while read
- * only needs to be able to seek the original.
- */
-static
-rc_t CC KNullFileRandomAccess (const KNullFile *self)
-{
-    assert (self != NULL);
-    return 0;
-}
-
-/* ----------------------------------------------------------------------
- * Type
- *  returns a KFileDesc
- *  not intended to be a content type,
- *  but rather an implementation class
- */
-static
-uint32_t CC KNullFileType (const KNullFile *self)
-{
-    return kfdNull;
-}
-
-
-/* ----------------------------------------------------------------------
- * Size
- *  returns size in bytes of file
- *
- *  "size" [ OUT ] - return parameter for file size
- */
-static
-rc_t CC KNullFileSize (const KNullFile *self, uint64_t *size)
-{
-    assert (self != NULL);
-    assert (size != NULL);
-
-    *size = 0;
-    return 0;;
-}
-
-/* ----------------------------------------------------------------------
- * SetSize
- *  sets size in bytes of file
- *
- *  "size" [ IN ] - new file size
- */
-static
-rc_t CC KNullFileSetSize (KNullFile *self, uint64_t size)
-{
-    return RC (rcFS, rcFile, rcUpdating, rcSelf, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * Read
- *  read file from known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually read
- */
-static
-rc_t CC KNullFileRead	(const KNullFile *self,
-			 uint64_t pos,
-			 void *buffer,
-			 size_t bsize,
-			 size_t *num_read)
-{
-    *num_read = 0;
-    return 0;
-}
-
-/* ----------------------------------------------------------------------
- * Write
- *  write file at known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ IN ] and "size" [ IN ] - data to be written
- *
- *  "num_writ" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually written
- *
- * Unsupported as we now treat archives as READ ONLY
- */
-static
-rc_t CC KNullFileWrite (KNullFile *self, uint64_t pos,
-		       const void *buffer, size_t bsize,
-		       size_t *num_writ)
-{
-    *num_writ = bsize;
-    return 0;
-}
-
-/* end of file nullfile.c */
-
diff --git a/libs/kfs/pagefile.c b/libs/kfs/pagefile.c
deleted file mode 100644
index bf0f05f..0000000
--- a/libs/kfs/pagefile.c
+++ /dev/null
@@ -1,1283 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kfs/extern.h>
-#include <kfs/pagefile.h>
-#include <kfs/impl.h>
-#include <klib/container.h>
-#include <klib/rc.h>
-#include <atomic.h>
-#include <sysalloc.h>
-
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-#define REQUIRE_RANDOM_ACCESS 0
-
-/*--------------------------------------------------------------------------
- * KPageMem
- *  the raw page memory
- */
-
-/* must be kept in sync with kdb/btree.c */
-#define PGBITS 15
-#define PGSIZE ( 1U << PGBITS )
-
-static
-rc_t KPageMemNew ( void **ppage )
-{
-    void *page = calloc ( PGSIZE, 1 );
-    if ( page == NULL )
-        return RC ( rcFS, rcBlob, rcAllocating, rcMemory, rcExhausted );
-
-    * ppage = page;
-    return 0;
-}
-
-static
-rc_t KPageMemMake ( void **ppage )
-{
-    void *page = malloc ( PGSIZE );
-    if ( page == NULL )
-        return RC ( rcFS, rcBlob, rcAllocating, rcMemory, rcExhausted );
-
-    * ppage = page;
-    return 0;
-}
-
-static
-void KPageMemWhack ( void *page )
-{
-    free ( page );
-}
-
-
-/*--------------------------------------------------------------------------
- * KPageBacking
- *  a reference KFile wrapper
- */
-typedef struct KPageBacking KPageBacking;
-struct KPageBacking
-{
-    uint64_t eof;
-    KFile *backing;
-    KRefcount refcount;
-    bool write_through;
-    bool have_eof;
-};
-
-/* Whack
- */
-static
-void KPageBackingWhack ( KPageBacking *self )
-{
-    if(self -> backing) KFileRelease ( self -> backing );
-    free ( self );
-}
-
-/* Attach
- */
-static
-KPageBacking *KPageBackingAttach ( const KPageBacking *self )
-{
-    if ( self != NULL ) switch ( KRefcountAddDep ( & self -> refcount, "KPageBacking" ) )
-    {
-    case krefOkay:
-        return ( KPageBacking* ) self;
-    }
-
-    return NULL;
-}
-
-/* Sever
- */
-static
-void KPageBackingSever ( const KPageBacking *self )
-{
-    if ( self != NULL ) switch ( KRefcountDropDep ( & self -> refcount, "KPageBacking" ) )
-    {
-    case krefWhack:
-        KPageBackingWhack ( ( KPageBacking* ) self );
-        break;
-    }
-}
-
-/* Release
- */
-static
-void KPageBackingRelease ( const KPageBacking *self )
-{
-    if ( self != NULL ) switch ( KRefcountDrop ( & self -> refcount, "KPageBacking" ) )
-    {
-    case krefWhack:
-        KPageBackingWhack ( ( KPageBacking* ) self );
-        break;
-    }
-}
-
-/* Drop
- *  drop backing file
- */
-static
-rc_t KPageBackingDrop ( KPageBacking *self )
-{
-    KFile *backing;
-
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcDetaching, rcSelf, rcNull );
-
-    backing = self -> backing;
-    if ( backing != NULL && atomic_test_and_set_ptr ( ( void* volatile* ) & self -> backing, NULL, backing ) == backing )
-        KFileRelease ( backing );
-
-    self -> write_through = false;
-
-    return 0;
-}
-
-/* SetSize
- *  sets size of backing store
- */
-#define BACKING_FILE_GROWTH 1024 /** number of pages to grow at a time**/
-#define BACKING_FILE_MASK ( BACKING_FILE_GROWTH - 1 )
-static
-rc_t KPageBackingSetSize ( KPageBacking *self, uint32_t pg_count )
-{
-    uint64_t new_eof;
-
-    if ( pg_count > BACKING_FILE_GROWTH )
-		pg_count = ( pg_count + BACKING_FILE_MASK ) & ~ BACKING_FILE_MASK;
-
-    new_eof =  ( uint64_t ) pg_count << PGBITS;
-    if ( new_eof == self -> eof )
-        return 0;
-
-    self -> eof = new_eof;
-    return KFileSetSize ( self -> backing, self -> eof );
-}
-
-/* Read
- *  read a page from backing
- */
-#if 0
-static
-rc_t KFileReadAll ( const KFile *self, uint64_t pos, uint8_t *buff, size_t bsize, size_t *num_read )
-{
-    rc_t rc;
-    size_t total, partial;
-
-    for ( rc = 0, total = 0; total < bsize; total += partial )
-    {
-        rc = KFileRead ( self, pos + total, & buff [ total ], bsize - total, & partial );
-        if ( rc != 0 )
-            break;
-        if ( partial == 0 )
-            break;
-    }
-
-    if ( total != 0 )
-    {
-        * num_read = total;
-        return 0;
-    }
-
-    * num_read = 0;
-    return rc;
-}
-#endif
-
-static
-rc_t KPageBackingRead ( const KPageBacking *self, void **ppage, uint32_t pg_id )
-{
-    rc_t rc;
-    uint64_t pos;
-
-    /* can't read if backing isn't there */
-    if ( self -> backing == NULL )
-    {
-        * ppage = NULL;
-        return RC ( rcFS, rcFile, rcReading, rcBlob, rcNotFound );
-    }
-
-    /* the offset to the first byte after requested page */
-    pos = ( uint64_t ) pg_id << PGBITS;
-
-    /* allocate a page */
-    rc = KPageMemMake ( ppage );
-    if ( rc == 0 )
-    {
-        /* retrieve memory */
-        void *page = * ppage;
-
-        /* read page from file */
-        size_t num_read;
-        rc = KFileReadAll ( self -> backing, pos -= PGSIZE, page, PGSIZE, & num_read );
-        if ( rc == 0 )
-        {
-            if ( num_read != 0 )
-            {
-                /* keep track of eof */
-                pos += num_read;
-                if ( self -> eof < pos )
-                    ( ( KPageBacking* ) self ) -> eof = pos;
-
-                /* detect a partial page */
-                if ( num_read < PGSIZE )
-                    memset ( & ( ( uint8_t* ) page ) [ num_read ], 0, PGSIZE - num_read );
-
-                /* return page */
-                * ppage = page;
-                return 0;
-            }
-
-            rc = RC ( rcFS, rcFile, rcReading, rcBlob, rcNotFound );
-        }
-
-        KPageMemWhack ( page );
-    }
-
-    * ppage = NULL;
-    return rc;
-}
-
-
-/* Write
- *  write a page to backing store
- */
-#if 0
-static
-rc_t KFileWriteAll ( KFile *self, uint64_t pos, const uint8_t *buff, size_t size, size_t *num_writ )
-{
-    rc_t rc;
-    size_t total, partial;
-
-    for ( rc = 0, total = 0; total < size; total += partial )
-    {
-        rc = KFileWrite ( self, pos + total, & buff [ total ], size - total, & partial );
-        if ( rc != 0 )
-            break;
-        if ( partial == 0 )
-        {
-            rc = RC ( rcFS, rcBlob, rcWriting, rcTransfer, rcIncomplete );
-            break;
-        }
-    }
-
-    if ( total != 0 )
-    {
-        * num_writ = total;
-        return 0;
-    }
-
-    * num_writ = 0;
-    return rc;
-}
-#endif
-
-static
-rc_t KPageBackingWrite ( KPageBacking *self, const void *page, uint32_t pg_id )
-{
-    rc_t rc;
-    uint64_t pos;
-    size_t num_writ;
-
-    /* allow backing to be removed */
-    if ( self -> backing == NULL )
-    {
-        self -> write_through = false;
-        return 0;
-    }
-
-    /* the offset to the first byte after requested page */
-    pos = ( uint64_t ) pg_id << PGBITS;
-
-    /* write the page */
-    rc = KFileWriteAll ( self -> backing, pos -= PGSIZE, page, PGSIZE, & num_writ );
-    if ( rc == 0 )
-    {
-        pos += num_writ;
-        if ( self -> eof < pos )
-            self -> eof = pos;
-
-        if ( num_writ == PGSIZE )
-            return 0;
-
-        /* technically it is permissible for the file to deny us a complete page
-           but for this test, the file should accept whole pages.
-        */
-        rc = RC ( rcFS, rcBlob, rcWriting, rcTransfer, rcIncomplete );
-    }
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * KPage
- *  a reference counted page
- *  meant to be held within a BSTree and DLList
- */
-struct KPage
-{
-    /* head for LRU cache */
-    DLNode ln;
-
-    /* backing file */
-    KPageBacking *backing;
-
-    /* raw memory */
-    void *page;
-
-    KRefcount refcount;
-
-    uint32_t page_id;
-    bool read_only;
-    bool dirty;
-};
-
-
-
-/* Whack
- */
-static
-rc_t KPageWhack ( KPage *self )
-{
-    if ( self -> backing ) {
-	if ( self -> dirty )
-	    KPageBackingWrite ( self -> backing, self -> page, self -> page_id );
-	KPageBackingSever ( self -> backing );
-    }
-    KPageMemWhack ( self -> page );
-    free ( self );
-    return 0;
-}
-
-
-/* New
- *  make a new page
- */
-static
-rc_t KPageNew ( KPage **ppage, KPageBacking *backing, uint32_t page_id )
-{
-    rc_t rc;
-    KPage *page = malloc ( sizeof * page );
-    if ( page == NULL )
-        rc = RC ( rcFS, rcBlob, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        rc = KPageMemNew ( & page -> page );
-        if ( rc == 0 )
-        {
-            if(backing)page -> backing = KPageBackingAttach ( backing );
-	    else page -> backing=NULL;
-            KRefcountInit ( & page -> refcount, 1, "KPage", "new", "page" );
-            page -> page_id = page_id;
-            page -> read_only = false;
-            page -> dirty = false;
-
-            * ppage = page;
-            return 0;
-        }
-
-        free ( page );
-    }
-
-    * ppage = NULL;
-    return rc;
-}
-
-
-/* Make
- *  make a page from backing
- */
-static
-rc_t KPageMake ( KPage **ppage, KPageBacking *backing, uint32_t page_id )
-{
-    rc_t rc;
-    KPage *page = malloc ( sizeof * page );
-    if ( page == NULL )
-        rc = RC ( rcFS, rcBlob, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        rc = KPageBackingRead ( backing, & page -> page, page_id );
-        if ( rc == 0 )
-        {
-            page -> backing = KPageBackingAttach ( backing );
-            KRefcountInit ( & page -> refcount, 1, "KPage", "make", "page" );
-            page -> page_id = page_id;
-            page -> read_only = false;
-            page -> dirty = false;
-
-            * ppage = page;
-            return 0;
-        }
-
-        free ( page );
-    }
-
-    * ppage = NULL;
-    return rc;
-}
-
-
-/* AddRef
- * Release
- *  ignores NULL references
- */
-LIB_EXPORT rc_t CC KPageAddRef ( const KPage *self )
-{
-    if ( self != NULL ) switch ( KRefcountAdd ( & self -> refcount, "KPage" ) )
-    {
-    case krefOkay:
-        break;
-    default:
-        return RC ( rcFS, rcBlob, rcAttaching, rcConstraint, rcViolated );
-    }
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KPageRelease ( const KPage *self )
-{
-    if ( self != NULL ) switch ( KRefcountDrop ( & self -> refcount, "KPage" ) )
-    {
-    case krefOkay:
-        if ( self -> dirty && self -> backing && self -> backing -> write_through )
-        {
-            rc_t rc = KPageBackingWrite ( self -> backing, self -> page, self -> page_id );
-            if ( rc != 0 )
-                return rc;
-
-            ( ( KPage* ) self ) -> dirty = false;
-        }
-        break;
-    case krefWhack:
-        return KPageWhack ( ( KPage* ) self );
-    default:
-        return RC ( rcFS, rcBlob, rcReleasing, rcConstraint, rcViolated );
-    }
-
-    return 0;
-}
-
-
-/* Attach
- * Sever
- *  ignores NULL references
- */
-static
-void KPageAttach ( const KPage *self )
-{
-    if ( self != NULL )
-        KRefcountAddDep ( & self -> refcount, "KPage" );
-}
-
-static
-rc_t KPageSever ( const KPage *self )
-{
-    if ( self != NULL ) switch ( KRefcountDropDep ( & self -> refcount, "KPage" ) )
-    {
-    case krefOkay:
-        break;
-    case krefWhack:
-        return KPageWhack ( ( KPage* ) self );
-    default:
-        return RC ( rcFS, rcBlob, rcReleasing, rcConstraint, rcViolated );
-    }
-
-    return 0;
-}
-
-
-
-/* Id
- *  returns page id
- *
- *  "page_id" [ OUT ] - return parameter for page id
- */
-LIB_EXPORT rc_t CC KPageId ( const KPage *self, uint32_t *page_id )
-{
-    rc_t rc;
-
-    if ( page_id == NULL )
-        rc = RC ( rcFS, rcBlob, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcFS, rcBlob, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            * page_id = self -> page_id;
-            return 0;
-        }
-
-        * page_id = 0;
-    }
-
-    return rc;
-}
-
-
-/* ConstSize
- *  returns constant page size
- */
-LIB_EXPORT size_t CC KPageConstSize ( void )
-{
-    return PGSIZE;
-}
-
-
-/* AccessRead
- * AccessUpdate
- *  gain access to page memory
- *  update access marks page as modified
- */
-LIB_EXPORT rc_t CC KPageAccessRead ( const KPage *self, const void **mem, size_t *bytes )
-{
-    rc_t rc;
-
-    size_t dummy;
-    if ( bytes == NULL )
-        bytes = & dummy;
-
-    if ( mem == NULL )
-        rc = RC ( rcFS, rcBlob, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcFS, rcBlob, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            assert ( self -> page != NULL );
-            * mem = self -> page;
-            * bytes = PGSIZE;
-            return 0;
-        }
-
-        * mem = NULL;
-    }
-
-    * bytes = 0;
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KPageAccessUpdate ( KPage *self, void **mem, size_t *bytes )
-{
-    rc_t rc;
-
-    size_t dummy;
-    if ( bytes == NULL )
-        bytes = & dummy;
-
-    if ( mem == NULL )
-        rc = RC ( rcFS, rcBlob, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcFS, rcBlob, rcAccessing, rcSelf, rcNull );
-        else if ( self -> read_only )
-            rc = RC ( rcFS, rcBlob, rcAccessing, rcBlob, rcReadonly );
-        else
-        {
-            assert ( self -> page != NULL );
-            self -> dirty = true;
-            * mem = self -> page;
-            * bytes = PGSIZE;
-            return 0;
-        }
-
-        * mem = NULL;
-    }
-
-    * bytes = 0;
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * KPageFile
- *  presents some level of page management on top of a random-access KFile
- */
-struct KPageFile
-{
-    void   **page_idx;
-    uint8_t  page_idx_depth;
-    DLList by_access;
-    KPageBacking *backing;
-    KRefcount refcount;
-    uint32_t count;
-    uint32_t ccount;
-    uint32_t climit;
-    bool read_only;
-};
-
-
-static
-void* KPageFile_whack_recursive(void **idx,uint8_t depth,uint32_t count,DLList *mru,uint32_t *ccount)
-{
-	if(idx){
-		if(depth == 0){
-			rc_t rc;
-			KPage *page=(KPage*)idx;
-			DLListUnlink(mru,&page->ln);
-			rc=KPageSever(page);
-			if(ccount) ccount[0]--;
-			assert(rc==0);
-		} else {
-			int i;
-			uint8_t offset;
-			depth--;
-			offset=(count >>(8*depth))&0xff;
-			idx[offset]=KPageFile_whack_recursive((void**)idx[offset],depth,count,mru,ccount);
-			for(i=(int)offset+1;i<256;i++){
-				if(idx[i]){
-					idx[i]=KPageFile_whack_recursive((void**)idx[i],depth,0,mru,ccount);
-				}
-			}	
-			if(depth == 0){
-				if(offset == 0){
-					free(idx);
-					return NULL;
-				} else {
-					return idx;
-				}
-			} else if(offset == 0 || (offset == 1 && idx[1]==NULL)){
-				void *tmp=idx[0];
-				free(idx);
-				return tmp;
-			} else {
-				return idx;
-			}
-		}
-	}
-	return NULL;
-}
-#define PAGE_IDX_DEPTH(A) ((A)>(1<<24)?4:((A)>(1<<16)?3:((A)>256?2:((A)>0?1:0))))
-static
-rc_t KPageFileSetPageCount(KPageFile *self,uint32_t count)
-{
-	void **tmp;	
-	uint8_t new_depth=PAGE_IDX_DEPTH(count);
-/******* Adjust depth and change structure of the index if needed ****/
-	if(new_depth > self->page_idx_depth){
-		if(self->page_idx == NULL){
-			self->page_idx_depth = new_depth;
-		} else while(self->page_idx_depth < new_depth){
-			tmp=malloc(256*sizeof(*tmp));
-			memset(tmp,0,256*sizeof(*tmp));
-			tmp[0]=self->page_idx;
-			self->page_idx=tmp;
-			self->page_idx_depth++;
-		}
-	}
-	if(count < self->count){
-		self->page_idx=KPageFile_whack_recursive(self->page_idx,self->page_idx_depth,count,&self->by_access,&self->ccount);
-		self->page_idx_depth = new_depth;
-	}
-	self->count=count;
-	if( self -> read_only) return 0;
-	if( self -> backing ) return KPageBackingSetSize ( self -> backing, count );
-	else if ( self->count > self->climit ){
-                return RC ( rcFS, rcFile, rcProcessing, rcBuffer, rcExhausted );
-	}
-	return 0;
-}
-/* Whack
- */
-
-static
-rc_t KPageFileWhack ( KPageFile *self )
-{
-    /* first, visit each cached page in flush order */
-    self->page_idx=KPageFile_whack_recursive(self->page_idx,self->page_idx_depth,0,&self->by_access,&self->ccount);
-    /* release the backing file */
-    if(self -> backing) KPageBackingRelease ( self -> backing );
-    /* delete the object */
-    free ( self );
-    return 0;
-}
-
-/* Make
- *  creates a page file
- *
- *  "pf" [ OUT ] - return parameter for page file
- *
- *  "backing" [ IN ] - backing file
- *   NB - attaches a new reference to file
- *        does not take ownership
- *
- *  "climit" [ IN ] - cache size limit
- */
-#define MIN_CACHE_PAGE 2
-LIB_EXPORT rc_t CC KPageFileMakeRead ( const KPageFile **pf,
-    const KFile *backing, size_t climit )
-{
-    rc_t rc;
-
-    if ( pf == NULL )
-        rc = RC ( rcFS, rcFile, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( backing == NULL )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNull );
-        else if ( ! backing -> read_enabled )
-            rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNoPerm );
-        else
-        {
-            KPageBacking *bf = calloc ( 1, sizeof * bf );
-            if ( bf == NULL )
-                rc = RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                KPageFile *f = malloc ( sizeof * f );
-                if ( f == NULL )
-                    rc = RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-                else
-                {
-                    rc = KFileAddRef ( backing );
-                    if ( rc == 0 )
-                    {
-			f->page_idx=NULL;
-			f->page_idx_depth=0;
-                        DLListInit ( & f -> by_access );
-                        KRefcountInit ( & f -> refcount, 1, "KPageFile", "make", "pgfile" );
-                        f -> count = 0;
-                        f -> ccount = 0;
-                        f -> climit = ( uint32_t ) ( climit >>  PGBITS );
-			if(f -> climit < MIN_CACHE_PAGE) f -> climit = MIN_CACHE_PAGE;
-                        f -> read_only = true;
-
-                        /* finish the backing file */
-                        KRefcountInit ( & bf -> refcount, 1, "KPageBacking", "make", "backing" );
-                        f -> backing = bf;
-                        bf -> write_through = false;
-
-                        /* attached reference */
-                        bf -> backing = ( KFile* ) backing;
-
-                        /* if backing is random access, get its size */
-                        rc = KFileSize ( backing, & bf -> eof );
-                        if ( rc == 0 )
-                        {
-                            bf -> have_eof = true;
-			    rc=KPageFileSetPageCount(f,( uint32_t ) ( ( bf -> eof + PGSIZE - 1 ) >> PGBITS ));
-			    if(rc!=0) return rc;
-                        }
-
-                        * pf = f;
-                        return 0;
-                    }
-
-                    free ( f );
-                }
-
-                free ( bf );
-            }
-        }
-
-        * pf = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KPageFileMakeUpdate ( KPageFile **pf,
-    KFile *backing, size_t climit, bool write_through )
-{
-    rc_t rc=0;
-
-    if ( pf == NULL )
-        rc = RC ( rcFS, rcFile, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( backing != NULL ){
-        	if ( ! backing -> read_enabled )
-		{
-		    if ( backing -> write_enabled )
-			rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcWriteonly );
-		    else
-			rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcNoPerm );
-		}
-		else if ( ! backing -> write_enabled )
-		    rc = RC ( rcFS, rcFile, rcConstructing, rcFile, rcReadonly );
-	}
-        if(rc == 0)
-        {
-	    KPageFile *f = malloc ( sizeof * f );
-	    if ( f == NULL )
-                    rc = RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-            else 
-	    {
-		f->page_idx=NULL;
-		f->page_idx_depth=0;
-		DLListInit ( & f -> by_access );
-		KRefcountInit ( & f -> refcount, 1, "KPageFile", "make", "pgfile" );
-		f -> count = 0;
-		f -> ccount = 0;
-		f -> climit = ( uint32_t ) ( climit >>  PGBITS );
-		if(f -> climit < MIN_CACHE_PAGE) f -> climit = MIN_CACHE_PAGE;
-		f -> read_only = false;
-		f -> backing = NULL; /** for now **/
-	    }
-	    if(rc == 0 && backing)
-            {
-		KPageBacking *bf = calloc ( 1, sizeof * bf );
-		if ( bf == NULL )
-			rc = RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-                else
-                {
-                    rc = KFileAddRef ( backing );
-		    if(rc == 0)
-		     {
-                        /* finish the backing file */
-                        KRefcountInit ( & bf -> refcount, 1, "KPageBacking", "make", "backing" );
-                        bf -> write_through = write_through;
-                        /* attached reference */
-                        bf -> backing = backing;
-
-                        /* see if file is random access */
-                        rc = KFileSize ( backing, & bf -> eof );
-                        if ( rc == 0 )
-                        {
-                            bf -> have_eof = true;
-                        }
-                    }
-                }
-		if (rc == 0){
-			f -> backing = bf;
-			rc=KPageFileSetPageCount(f,( uint32_t ) ( ( bf -> eof + PGSIZE - 1 ) >> PGBITS ));
-		} else if ( bf ){
-			free ( bf );
-		}
-            }
-	    if(rc == 0){
-		* pf = f;
-	    } else if (f) {
-		free(f);
-	    }
-        }
-	if(rc != 0) *pf = NULL;
-    }
-    return rc;
-}
-
-
-/* AddRef
- * Release
- *  ignores NULL references
- */
-LIB_EXPORT rc_t CC KPageFileAddRef ( const KPageFile *self )
-{
-    if ( self != NULL ) switch ( KRefcountAdd ( & self -> refcount, "KPageFile" ) )
-    {
-    case krefOkay:
-        break;
-    default:
-        return RC ( rcFS, rcFile, rcAttaching, rcConstraint, rcViolated );
-    }
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KPageFileRelease ( const KPageFile *self )
-{
-    if ( self != NULL ) switch ( KRefcountDrop ( & self -> refcount, "KPageFile" ) )
-    {
-    case krefOkay:
-        break;
-    case krefWhack:
-        return KPageFileWhack ( ( KPageFile* ) self );
-    default:
-        return RC ( rcFS, rcFile, rcReleasing, rcConstraint, rcViolated );
-    }
-
-    return 0;
-}
-
-
-/* Size
- *  returns size in bytes of file and cache
- *
- *  "lsize" [ OUT, NULL OKAY ] - return parameter for logical size
- *
- *  "fsize" [ OUT, NULL OKAY ] - return parameter for file size
- *
- *  "csize" [ OUT, NULL OKAY ] - return parameter for cache size
- */
-LIB_EXPORT rc_t CC KPageFileSize ( const KPageFile *self,
-    uint64_t *lsize, uint64_t *fsize, size_t *csize )
-{
-    rc_t rc = 0;
-
-    size_t dummysz;
-    uint64_t dummy64;
-
-    if ( lsize == NULL )
-        lsize = & dummy64;
-    if ( fsize == NULL )
-        fsize = & dummy64;
-    if ( csize == NULL )
-        csize = & dummysz;
-
-    if ( self == NULL )
-        rc = RC ( rcFS, rcFile, rcAccessing, rcSelf, rcNull );
-    else
-    {
-        if ( self -> backing == NULL || self -> backing -> backing == NULL )
-            * fsize = 0;
-        else if ( ! self -> backing -> have_eof )
-            * fsize = self -> backing -> eof;
-        else
-            rc = KFileSize ( self -> backing -> backing, fsize );
-
-        if ( rc == 0 )
-        {
-            * lsize = ( uint64_t ) self -> count << PGBITS;
-            * csize = ( uint64_t ) self -> ccount << PGBITS;
-            return 0;
-        }
-    }
-
-    * lsize = 0;
-    * fsize = 0;
-    * csize = 0;
-
-    return rc;
-}
-
-/* SetSize
- *  extends or truncates underlying file
- *  may affect cache contents
- *
- *  "size" [ IN ] - logical size
- */
-LIB_EXPORT rc_t CC KPageFileSetSize ( KPageFile *self, uint64_t size )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcFS, rcFile, rcUpdating, rcSelf, rcNull );
-    else
-    {
-        uint32_t new_count = ( uint32_t ) ( ( size + PGSIZE - 1 ) >> PGBITS );
-	rc=KPageFileSetPageCount(self,new_count);
-	if(rc) return rc;
-	assert(self->count == new_count);
-    }
-    return rc;
-}
-static
-rc_t KPageFileIndexInsert(KPageFile *self, KPage *page)
-{
-	void    	**tmp;
-	uint8_t		depth;
-	uint32_t	page_id=page->page_id;
-	uint8_t		offset;
-
-	assert(page->page_id > 0);
-	if(page->page_id > self->count){/**** This is an autogrowth ***/
-		rc_t rc= KPageFileSetPageCount(self,page->page_id);
-		if(rc) return rc;
-	}
-	if(self->page_idx == NULL){
-		self->page_idx = malloc(256*sizeof(*tmp));
-		if(self->page_idx==0)
-			return RC(rcFS, rcIndex, rcInserting, rcMemory, rcInsufficient);
-		memset(self->page_idx,0,256*sizeof(void*));
-	}
-	tmp=self->page_idx;
-	depth=self->page_idx_depth;
-	assert(PAGE_IDX_DEPTH(page_id) <= depth);
-	while(depth > 1){
-		offset = ((page_id-1) >> (depth-1)*8)&0xff;
-		if(tmp[offset]==0){
-			tmp[offset]=malloc(256*sizeof(*tmp));
-			if(tmp[offset]==0)
-				return RC(rcFS, rcIndex, rcInserting, rcMemory, rcInsufficient);
-			memset(tmp[offset],0,256*sizeof(void*));
-		}
-		assert(tmp[offset]);
-		tmp=(void**)tmp[offset];
-		depth--;
-	}
-	assert(depth==1);
-	offset=(page_id-1) & 0xff;
-	if(tmp[offset] && tmp[offset]!=page) return RC(rcFS, rcIndex, rcInserting,rcId,rcDuplicate);
-	tmp[offset]=page;
-	return 0;
-}
-static
-rc_t KPageFileIndexDelete(KPageFile *self, uint32_t page_id)
-{
-	void            **tmp=self->page_idx;
-	uint8_t         depth=self->page_idx_depth;
-        uint8_t         offset;
-	assert(page_id > 0);
-        assert(PAGE_IDX_DEPTH(page_id) <= depth);
-	while(depth > 1){
-                offset = ((page_id-1) >> (depth-1)*8)&0xff;
-		if(tmp[offset]==0){
-			return RC(rcFS, rcIndex, rcRemoving,rcId,rcInconsistent);
-		}
-		assert(tmp[offset]);
-		tmp=(void**)tmp[offset];
-		depth--;
-	}
-	offset=(page_id-1) & 0xff;
-	if(tmp[offset]==0){
-		return RC(rcFS, rcIndex, rcRemoving,rcId,rcInconsistent);
-	}
-	tmp[offset]=0;
-	return 0;
-}
-static
-KPage* KPageFileIndexFind(KPageFile *self, uint32_t page_id)
-{
-        void            **tmp=self->page_idx;
-        uint8_t         depth=self->page_idx_depth;
-        uint8_t         offset;
-	assert(page_id > 0);
-        if(PAGE_IDX_DEPTH(page_id) > depth) return NULL;
-
-	if(tmp==NULL) return NULL;
-	while(depth > 1){
-                offset = ((page_id-1) >> (depth-1)*8)&0xff;
-                if(tmp[offset]==0){
-                        return NULL;
-                }
-                assert(tmp[offset]);
-                tmp=(void**)tmp[offset];
-                depth--;
-        }
-	offset=(page_id-1) & 0xff;
-	assert(tmp[offset]==0 || ((KPage*)tmp[offset])->page_id == page_id);
-	return (KPage*)tmp[offset];
-}
-
-	
-/* CachePage
- *  insert a page into cache
- */
-static
-rc_t KPageFileCachePage ( KPageFile *self, KPage *page )
-{
-    rc_t rc;
-
-    /* perform insert */
-    rc=KPageFileIndexInsert(self,page);
-    if(rc != 0) return rc;	
-    DLListPushHead ( & self -> by_access, & page -> ln );
-
-    /* attach reference to page */
-    KPageAttach ( page );
-
-    /* check limit */
-    if ( ++ self -> ccount <= self -> climit )
-        return 0;
-
-    do
-    {
-        DLNode *last = DLListPopTail ( & self -> by_access );
-        KPage *doomed = ( KPage* ) last;
-	rc=KPageFileIndexDelete(self,doomed->page_id);
-	if(rc==0) rc = KPageSever ( doomed );
-    }
-    while ( -- self -> ccount > self -> climit && rc == 0 );
-
-    return rc;
-}
-
-
-/* Alloc
- *  allocates a new page
- *  the page will be zeroed and initially unmodified
- *
- *  "page" [ OUT ] - return parameter for page object
- *
- *  "page_id" [ OUT, NULL OKAY ] - optional return parameter for page id
- */
-LIB_EXPORT rc_t CC KPageFileAlloc ( KPageFile *self, KPage **ppage, uint32_t *page_id )
-{
-    rc_t rc;
-
-    uint32_t dummy;
-    if ( page_id == NULL )
-        page_id = & dummy;
-
-    if ( ppage == NULL )
-        rc = RC ( rcFS, rcFile, rcAllocating, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcFS, rcFile, rcAllocating, rcSelf, rcNull );
-        else if ( self -> read_only )
-            rc = RC ( rcFS, rcBlob, rcAllocating, rcFile, rcReadonly );
-        else
-        {
-            /* create new page */
-            rc = KPageNew ( ppage, self -> backing, self -> count + 1 );
-            if ( rc == 0 )
-            {
-                /* insert into cache */
-                rc = KPageFileCachePage ( self, * ppage );
-                if ( rc == 0 )
-                {
-                    * page_id = self -> count;
-                    return 0;
-                }
-
-                KPageRelease ( * ppage );
-            }
-        }
-
-        * ppage = NULL;
-    }
-
-    * page_id = 0;
-
-    return rc;
-}
-
-
-/* Get
- *  returns an existing page
- *
- *  "page" [ OUT ] - return parameter for page object
- *
- *  "page_id" [ IN ] - id of page to retrieve
- */
-LIB_EXPORT rc_t CC KPageFileGet ( KPageFile *self, KPage **ppage, uint32_t page_id )
-{
-    rc_t rc;
-
-    if ( ppage == NULL )
-        rc = RC ( rcFS, rcFile, rcReading, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcFS, rcFile, rcReading, rcSelf, rcNull );
-        else if ( page_id == 0 )
-            rc = RC ( rcFS, rcFile, rcReading, rcId, rcNull );
-        else
-        {
-	    KPage *page = KPageFileIndexFind(self,page_id);/** try to see if MRU pages work **/
-            if ( page != NULL )
-            {
-                rc = KPageAddRef ( * ppage = page );
-                if ( rc == 0 )
-                {
-                    /* put page at head of list if not already there */
-                    if ( DLListHead ( & self -> by_access ) != & page -> ln )
-                    {
-                        DLListUnlink ( & self -> by_access, & page -> ln );
-                        DLListPushHead ( & self -> by_access, & page -> ln );
-                    }
-                    return 0;
-                }
-
-                * ppage = NULL;
-                return rc;
-            }
-
-            rc = KPageMake ( ppage, self -> backing, page_id );
-            if ( rc == 0 )
-            {
-                /* insert into cache */
-                rc = KPageFileCachePage ( self, * ppage );
-                if ( rc == 0 )
-                    return 0;
-
-                KPageRelease ( * ppage );
-            }
-        }
-
-        * ppage = NULL;
-    }
-
-    return rc;
-}
-
-
-/* PosGet
- *  returns a page corresponding to position
- *
- *  "page" [ OUT ] - return parameter for page object
- *
- *  "offset" [ IN ] - offset to a byte within file
- */
-LIB_EXPORT rc_t CC KPageFilePosGet ( KPageFile *self, KPage **page, uint64_t offset )
-{
-    rc_t rc;
-
-    if ( page == NULL )
-        rc = RC ( rcFS, rcFile, rcReading, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcFS, rcFile, rcReading, rcSelf, rcNull );
-        else
-        {
-            uint32_t aid, count = self -> count;
-            uint32_t zpgid = ( uint32_t ) ( offset >> PGBITS );
-
-            if ( self -> read_only || zpgid < count )
-                return KPageFileGet ( self, page, zpgid + 1 );
-
-            /* potentially extend count so that
-               the oid assigned will be zpgid + 1 */
-            self -> count = zpgid;
-            rc = KPageFileAlloc ( self, page, & aid );
-            if ( rc == 0 )
-            {
-                assert ( zpgid + 1 == aid );
-                return 0;
-            }
-
-            self -> count = count;
-        }
-
-        * page = NULL;
-    }
-
-    return rc;
-}
-
-
-/* DropBacking
- *  used immediately prior to releasing
- *  prevents modified pages from being flushed to disk
- */
-LIB_EXPORT rc_t CC KPageFileDropBacking ( KPageFile *self )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcFile, rcDetaching, rcSelf, rcNull );
-
-    return self -> backing?KPageBackingDrop ( self -> backing ):0;
-}
diff --git a/libs/kfs/pmem.c b/libs/kfs/pmem.c
deleted file mode 100644
index c78cba9..0000000
--- a/libs/kfs/pmem.c
+++ /dev/null
@@ -1,1047 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kfs/extern.h>
-#include <kfs/pmem.h>
-#include <kfs/pagefile.h>
-#include <klib/refcount.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * KMemBlock
- * KExtMemBlock
- *  bad for random access, but reasonable for the application
- *  blocks are stored as linked lists
- */
-typedef struct KMemBlock KMemBlock;
-struct KMemBlock
-{
-    uint64_t next;
-    uint64_t size;
-    uint8_t data [ 48 ];
-};
-
-typedef struct KExtMemBlock KExtMemBlock;
-struct KExtMemBlock
-{
-    uint64_t next;
-    uint8_t data [ 56 ];
-};
-
-#define MEMBLOCK_DATASIZE( block, block_size ) \
-    ( ( block_size ) - sizeof * ( block ) + sizeof ( block ) -> data )
-
-#define MEMBLOCK_RDATA( block, block_size, offset ) \
-    & ( block ) -> data [ MEMBLOCK_DATASIZE ( block, block_size ) - ( offset ) ]
-
-#define eByteOrderTag 0x05031988
-#define eByteOrderReverse 0x88190305
-
-typedef struct KHdrMemBlock KHdrMemBlock;
-struct KHdrMemBlock
-{
-    /* standard header */
-    uint32_t endian;
-    uint32_t version;
-    union
-    {
-        /* v1 layout */
-        struct
-        {
-            /* number of bytes allocated */
-            uint64_t used;
-
-            /* head of free list */
-            uint64_t free_list;
-
-            /* size of each block: <= page size */
-            uint32_t block_size;
-
-            /* free-list fragentation information */
-            uint16_t free_count;
-            uint16_t frag_count;
-
-        } v1;
-
-    } u;
-};
-
-
-/*--------------------------------------------------------------------------
- * KMemPage
- *  local cache for page during access
- *  remembers KPage and the pgid to avoid having to call to get it
- *  allows for accessing by block
- */
-typedef struct KMemPage KMemPage;
-struct KMemPage
-{
-    KPage *pg;
-    uint32_t pgid;
-};
-
-static
-rc_t KMemPageWhack ( KMemPage *self )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        return 0;
-
-    rc = KPageRelease ( self -> pg );
-    if ( rc == 0 )
-        memset ( self, 0, sizeof * self );
-
-    return rc;
-}
-
-static
-rc_t KMemPageInit ( KMemPage *mp, KPage *pg0 )
-{
-    rc_t rc = KPageAddRef ( pg0 );
-    if ( rc != 0 )
-    {
-        memset ( mp, 0, sizeof * mp );
-        return rc;
-    }
-
-    mp -> pg = pg0;
-    mp -> pgid = 1;
-    return 0;
-}
-
-static
-rc_t KMemPageAlloc ( KMemPage *self, KPageFile *pf )
-{
-    rc_t rc = KPageRelease ( self -> pg );
-    if ( rc == 0 )
-    {
-        rc = KPageFileAlloc ( pf, & self -> pg, & self -> pgid );
-        if ( rc != 0 )
-            memset ( self, 0, sizeof * self );
-    }
-    return rc;
-}
-
-static
-rc_t KMemPageGet ( KMemPage *self, KPageFile *pf, uint32_t pgid )
-{
-    rc_t rc = KPageRelease ( self -> pg );
-    if ( rc == 0 )
-    {
-        rc = KPageFileGet ( pf, & self -> pg, self -> pgid = pgid );
-        if ( rc != 0 )
-            memset ( self, 0, sizeof * self );
-    }
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * KMemBank
- *  manages simple blocks of memory
- *  optionally backed by a persistent page file
- *
- *  stores accounting information in block 0
- *
- *  accounting information includes block size and linkage
- *
- *  block links are maintained in a table
- */
-struct KMemBank
-{
-    uint64_t limit;
-
-    KPageFile *pf;
-
-    KPage *pg0;
-    KHdrMemBlock *hdr;
-
-    /* the difference between page bits and block bits
-       used to go between page id and block id */
-    uint32_t pb_bits;
-
-    /* for converting a block id to byte offset */
-    uint32_t blk_bits;
-
-    /* for masking off block index within page */
-    uint32_t blk_mask;
-
-    KRefcount refcount;
-    bool read_only;
-};
-
-
-/* Whack
- */
-static
-rc_t KMemBankWhack ( KMemBank *self )
-{
-    rc_t rc = KPageRelease ( self -> pg0 );
-    if ( rc != 0 )
-        return rc;
-
-    rc = KPageFileDropBacking ( self -> pf );
-    /* TBD - can report errors */
-
-    rc  = KPageFileRelease ( self -> pf );
-    /* TBD - can report errors */
-
-    free ( self );
-
-    return 0;
-}
-
-
-/* Make
- *  make a memory bank with a fixed block size
- *  the total amount of memory may be limited
- *  the memory may be drawn from an externally supplied page file
- *
- *  "block_size" [ IN ] - must be an even multiple of 2, minimum 64
- *
- *  "limit" [ IN, DFLT ZERO ] - the maximum number of bytes
- *  to be allocated zero for unlimited
- *
- *  "backing" [ IN, NULL OKAY ] - a page source for allocator.
- *  a new reference will be added if not null.
- */
-LIB_EXPORT rc_t CC KMemBankMake ( KMemBank **bankp,
-    size_t block_size, uint64_t limit, KPageFile *backing )
-{
-    rc_t rc;
-
-    if ( bankp == NULL )
-        rc = RC ( rcFS, rcMemory, rcConstructing, rcParam, rcNull );
-    else
-    {
-        size_t page_size = KPageConstSize ();
-
-        if ( page_size < sizeof ( KHdrMemBlock ) )
-            rc = RC ( rcFS, rcMemory, rcConstructing, rcBlob, rcInsufficient );
-        else if ( ( block_size & ( block_size - 1 ) ) != 0 )
-            rc = RC ( rcFS, rcMemory, rcConstructing, rcParam, rcInvalid );
-        else if ( block_size < 64 )
-            rc = RC ( rcFS, rcMemory, rcConstructing, rcParam, rcInsufficient );
-        else if ( block_size > page_size )
-            rc = RC ( rcFS, rcMemory, rcConstructing, rcParam, rcExcessive );
-        else
-        {
-            if ( backing != NULL )
-                rc = KPageFileAddRef ( backing );
-            else
-            {
-                size_t climit = ( size_t ) limit;
-                if ( ( uint64_t ) climit != limit )
-                    rc = RC ( rcFS, rcMemory, rcConstructing, rcParam, rcExcessive );
-                else
-                {
-                    if ( climit == 0 )
-                        climit = 256 * 1024 * 1024;
-                    rc = KPageFileMakeUpdate ( & backing, NULL, climit, false );
-                }
-            }
-
-            if ( rc == 0 )
-            {
-                KMemBank *bank = malloc ( sizeof * bank );
-                if ( bank == NULL )
-                    rc = RC ( rcFS, rcMemory, rcConstructing, rcMemory, rcExhausted );
-                else
-                {
-                    bank -> pf = backing;
-                    rc = KPageFilePosGet ( backing, & bank -> pg0, 0 );
-                    if ( rc == 0 )
-                    {
-                        rc = KPageAccessUpdate ( bank -> pg0, ( void** ) & bank -> hdr, & page_size );
-                        if ( rc == 0 )
-                            bank -> read_only = false;
-                        else
-                        {
-                            rc_t rc2 = KPageAccessRead ( bank -> pg0, ( const void** ) & bank -> hdr, & page_size );
-                            if ( rc2 == 0 )
-                            {
-                                bank -> read_only = true;
-                                rc = 0;
-                            }
-                        }
-                        if ( rc == 0 )
-                        {
-                            KHdrMemBlock *hdr = bank -> hdr;
-
-                            /* turn block size into shift bits */
-                            for ( bank -> blk_bits = 6; block_size > ( 1U << bank -> blk_bits ); ++ bank -> blk_bits )
-                                ( void ) 0;
-
-                            /* turn page size into shift bits */
-                            for ( bank -> pb_bits = 6; page_size > ( 1U << bank -> pb_bits ); ++ bank -> pb_bits )
-                                ( void ) 0;
-
-                            /* conversion bits between page and block */
-                            assert ( bank -> pb_bits >= bank -> blk_bits );
-                            bank -> pb_bits -= bank -> blk_bits;
-                            bank -> blk_mask = ( 1U << bank -> pb_bits ) - 1;
-
-                            /* initialize the header if new */
-                            if ( hdr -> endian == 0 )
-                            {
-                                if ( bank -> read_only )
-                                    rc = RC ( rcFS, rcMemory, rcConstructing, rcFile, rcCorrupt );
-                                else
-                                {
-                                    size_t offset;
-                                    uint8_t *pgmem = ( uint8_t* ) hdr;
-
-                                    hdr -> endian = eByteOrderTag;
-                                    hdr -> version = 1;
-                                    hdr -> u . v1 . used = 0;
-                                    hdr -> u . v1 . free_list = 0;
-                                    hdr -> u . v1 . block_size = ( uint32_t ) block_size;
-                                    hdr -> u . v1 . free_count = 0;
-                                    hdr -> u . v1 . frag_count = 0;
-
-                                    /* place remainder of page 0 on free list */
-                                    for ( offset = block_size; offset < sizeof * hdr; offset += block_size )
-                                        ( void ) 0;
-                                    if ( offset < page_size )
-                                    {
-                                        KExtMemBlock *blk;
-                                        uint64_t next = hdr -> u . v1 . free_list = offset / block_size + 1;
-                                        do
-                                        {
-                                            blk = ( KExtMemBlock* ) & pgmem [ offset ];
-                                            blk -> next = ++ next;
-                                            ++ hdr -> u . v1 . free_count;
-                                        }
-                                        while ( ( offset += block_size ) < page_size );
-                                        assert ( offset == page_size );
-                                        blk -> next = 0;
-                                    }
-                                }
-                            }
-                            else if ( hdr -> endian != eByteOrderTag )
-                            {
-                                if ( hdr -> endian == eByteOrderReverse )
-                                    rc = RC ( rcFS, rcMemory, rcConstructing, rcByteOrder, rcIncorrect );
-                                else
-                                    rc = RC ( rcFS, rcMemory, rcConstructing, rcFile, rcCorrupt );
-                            }
-                            else if ( hdr -> version != 1 )
-                            {
-                                rc = RC ( rcFS, rcMemory, rcConstructing, rcFile, rcBadVersion );
-                            }
-
-                            if ( rc == 0 )
-                            {
-                                /* record our happy limit */
-                                bank -> limit = limit;
-
-                                /* initialize the reference counter */
-                                KRefcountInit ( & bank -> refcount, 1, "KMemBank", "make", "bank" );
-
-                                * bankp = bank;
-                                return 0;
-                            }
-                        }
-
-                        KPageRelease ( bank -> pg0 );
-                    }
-
-                    free ( bank );
-                }
-
-                KPageFileRelease ( backing );
-            }
-        }
-
-        * bankp = NULL;
-    }
-
-    return rc;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KMemBankAddRef ( const KMemBank *self )
-{
-    if ( self != NULL ) switch ( KRefcountAdd ( & self -> refcount, "KMemBank" ) )
-    {
-    case krefOkay:
-        break;
-    default:
-        return RC ( rcFS, rcMemory, rcAttaching, rcConstraint, rcViolated );
-    }
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KMemBankRelease ( const KMemBank *self )
-{
-    if ( self != NULL ) switch ( KRefcountDrop ( & self -> refcount, "KMemBank" ) )
-    {
-    case krefOkay:
-        break;
-    case krefWhack:
-        return KMemBankWhack ( ( KMemBank* ) self );
-    default:
-        return RC ( rcFS, rcMemory, rcReleasing, rcConstraint, rcViolated );
-    }
-
-    return 0;
-}
-
-
-/* AccessBlock
- */
-static
-rc_t KMemBankAccessBlockRead ( const KMemBank *self,
-    uint64_t id, KMemPage *mp, const KExtMemBlock **blkp )
-{
-    rc_t rc;
-    size_t bytes;
-    const uint8_t *pgmem;
-
-    /* get the proper page */
-    uint32_t pgid = ( uint32_t ) ( ( id - 1 ) >> self -> pb_bits ) + 1;
-    if ( pgid != mp -> pgid )
-    {
-        rc = KMemPageGet ( mp, self -> pf, pgid );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    /* get pointer to page */
-    rc = KPageAccessRead ( mp -> pg, ( const void** ) & pgmem, & bytes );
-    if ( rc == 0 )
-        * blkp = ( const KExtMemBlock* ) & pgmem [ ( ( id - 1 ) & self -> blk_mask ) << self -> blk_bits ];
-
-    return rc;
-}
-
-static
-rc_t KMemBankAccessBlockUpdate ( const KMemBank *self,
-    uint64_t id, KMemPage *mp, KExtMemBlock **blkp )
-{
-    rc_t rc;
-    size_t bytes;
-    uint8_t *pgmem;
-
-    /* get the proper page */
-    uint32_t pgid = ( uint32_t ) ( ( id - 1 ) >> self -> pb_bits ) + 1;
-    if ( pgid != mp -> pgid )
-    {
-        rc = KMemPageGet ( mp, self -> pf, pgid );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    /* get pointer to page */
-    rc = KPageAccessUpdate ( mp -> pg, ( void** ) & pgmem, & bytes );
-    if ( rc == 0 )
-        * blkp = ( KExtMemBlock* ) & pgmem [ ( ( id - 1 ) & self -> blk_mask ) << self -> blk_bits ];
-
-    return rc;
-}
-
-
-/* AllocBlock
- */
-static
-rc_t KMemBankAllocBlock ( KMemBank *self, uint64_t *id,
-    KMemPage *mp, KExtMemBlock **blkp, bool clear )
-{
-    rc_t rc;
-    uint8_t *pgmem;
-    KExtMemBlock *blk = NULL;
-
-    KHdrMemBlock *hdr = self -> hdr;
-
-    /* look for free block */
-    if ( hdr -> u . v1 . free_list == 0 )
-    {
-        uint64_t next;
-        size_t bsz, total, bytes;
-
-        /* allocate a page-worth of blocks */
-        rc = KMemPageAlloc ( mp, self -> pf );
-        if ( rc != 0 )
-            return rc;
-
-        /* access the page in update mode */
-        rc = KPageAccessUpdate ( mp -> pg, ( void** ) & pgmem, & bytes );
-        if ( rc != 0 )
-            return rc;
-
-        /* stitch the blocks together into linked list of free blocks */
-        bsz = hdr -> u . v1 . block_size;
-        next = ( uint64_t ) ( mp -> pgid - 1 ) << self -> pb_bits;
-        hdr -> u . v1 . free_list = ++ next;
-
-        for ( total = 0; total < bytes; total += bsz )
-        {
-            blk = ( KExtMemBlock* ) & pgmem [ total ];
-            blk -> next = ++ next;
-            ++ hdr -> u . v1 . free_count;
-        }
-        blk -> next = 0;
-    }
-
-    rc = KMemBankAccessBlockUpdate ( self, * id = hdr -> u . v1 . free_list, mp, blkp );
-    if ( rc == 0 )
-    {
-        blk = * blkp;
-        hdr -> u . v1 . free_list = blk -> next;
-        -- hdr -> u . v1 . free_count;
-        blk -> next = 0;
-
-        if ( clear )
-            memset ( blk, 0, hdr -> u . v1 . block_size );
-    }
-
-    return rc;
-}
-
-
-/* Alloc
- *  allocate memory
- *
- *  "id" [ OUT ] - return parameter for memory allocation id
- *
- *  "bytes" [ IN ] - the number of bytes to allocate
- *
- *  "clear" [ IN ] - if true, initialize the memory to zero
- */
-LIB_EXPORT rc_t CC KMemBankAlloc ( KMemBank *self,
-    uint64_t *id, uint64_t bytes, bool clear )
-{
-    rc_t rc;
-
-    if ( id == NULL )
-        rc = RC ( rcFS, rcMemory, rcAllocating, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcFS, rcMemory, rcAllocating, rcSelf, rcNull );
-        else if ( bytes == 0 )
-            rc = 0;
-        else
-        {
-            KExtMemBlock *block;
-
-            KMemPage mp;
-            KMemPageInit ( & mp, self -> pg0 );
-
-            rc = KMemBankAllocBlock ( self, id, & mp, & block, clear );
-            if ( rc == 0 )
-            {
-                KMemBlock *head = ( KMemBlock* ) block;
-                uint64_t total, block_size = self -> hdr -> u . v1 . block_size;
-
-                /* record size in first block */
-                head -> size = bytes;
-
-                for ( total = MEMBLOCK_DATASIZE ( head, block_size );
-                      total < bytes;
-                      total += MEMBLOCK_DATASIZE ( block, block_size ) )
-                {
-                    rc = KMemBankAllocBlock ( self, & block -> next, & mp, & block, clear );
-                    if ( rc != 0 )
-                        break;
-                }
-
-                if ( rc == 0 )
-                {
-                    KMemPageWhack ( & mp );
-                    return 0;
-                }
-
-                KMemBankFree ( self, * id );
-            }
-
-            KMemPageWhack ( & mp );
-        }
-
-        * id = 0;
-    }
-
-    return rc;
-}
-
-
-/* Free
- *  free memory
- *
- *  "id" [ IN, ZERO OKAY ] - id of the allocation to be freed
- */
-LIB_EXPORT rc_t CC KMemBankFree ( KMemBank *self, uint64_t id )
-{
-    rc_t rc;
-
-    if ( id == 0 )
-        return 0;
-
-    if ( self == NULL )
-        rc = RC ( rcFS, rcMemory, rcReleasing, rcSelf, rcNull );
-    else
-    {
-        uint32_t count;
-        uint64_t free_list;
-        const KExtMemBlock *cblock;
-
-        KMemPage mp;
-        KMemPageInit ( & mp, self -> pg0 );
-
-        /* find tail of allocation and count blocks to be freed */
-        rc = KMemBankAccessBlockRead ( self, free_list = id, & mp, & cblock );
-        for ( count = 1; rc == 0 && cblock -> next != 0; ++ count )
-            rc = KMemBankAccessBlockRead ( self, free_list = cblock -> next, & mp, & cblock );
-        if ( rc == 0 )
-        {
-            KExtMemBlock *block;
-            rc = KMemBankAccessBlockUpdate ( self, free_list, & mp, & block );
-            if ( rc == 0 )
-            {
-                block -> next = self -> hdr -> u . v1 . free_list;
-                self -> hdr -> u . v1 . free_list = id;
-                self -> hdr -> u . v1 . free_count += ( uint16_t ) count;
-            }
-        }
-
-        KMemPageWhack ( & mp );
-    }
-
-    return rc;
-}
-
-
-/* Size
- *  returns the allocated capacity of the memory object
- *
- *  "id" [ IN ] - id of the allocation
- *
- *  "size" [ OUT ] - return parameter
- */
-LIB_EXPORT rc_t CC KMemBankSize ( const KMemBank *self, uint64_t id, uint64_t *size )
-{
-    rc_t rc;
-
-    if ( size == NULL )
-        rc = RC ( rcFS, rcMemory, rcAccessing, rcParam, rcNull );
-    else
-    {
-        * size = 0;
-
-        if ( id == 0 )
-            rc = 0;
-        else if ( self == NULL )
-            rc = RC ( rcFS, rcMemory, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            const KMemBlock *block;
-            
-            KMemPage mp;
-            KMemPageInit ( & mp, self -> pg0 );
-
-            rc = KMemBankAccessBlockRead ( self, id, & mp, ( const KExtMemBlock** ) & block );
-            if ( rc == 0 )
-                * size = block -> size;
-
-            KMemPageWhack ( & mp );
-        }
-    }
-
-    return rc;
-}
-
-
-/* SetSize
- *  performs a reallocation of memory object
- *
- *  "id" [ IN ] - id of the allocation being resized
- *
- *  "bytes" [ IN ] - new capacity
- */
-LIB_EXPORT rc_t CC KMemBankSetSize ( KMemBank *self, uint64_t id, uint64_t bytes )
-{
-    rc_t rc;
-
-    if ( id == 0 )
-        rc = RC ( rcFS, rcMemory, rcResizing, rcId, rcNull );
-    else if ( self == NULL )
-        rc = RC ( rcFS, rcMemory, rcResizing, rcSelf, rcNull );
-    else
-    {
-        const KMemBlock *chead;
-            
-        KMemPage mp;
-        KMemPageInit ( & mp, self -> pg0 );
-
-        /* get head block */
-        rc = KMemBankAccessBlockRead ( self, id, & mp, ( const KExtMemBlock** ) & chead );
-        if ( rc == 0 && chead -> size != bytes )
-        {
-            uint64_t cur = id;
-            uint64_t total, size = chead -> size;
-            uint64_t block_size = self -> hdr -> u . v1 . block_size;
-            const KExtMemBlock *cblock = ( const KExtMemBlock* ) chead;
-
-            /* while total < new size && more blocks, walk forward */
-            for ( total = MEMBLOCK_DATASIZE ( chead, block_size );
-                  total < size && total < bytes;
-                  total += MEMBLOCK_DATASIZE ( cblock, block_size ) )
-            {
-                rc = KMemBankAccessBlockRead ( self, cur = cblock -> next, & mp, & cblock );
-                if ( rc != 0 )
-                    break;
-            }
-            if ( rc == 0 )
-            {
-                KExtMemBlock *block;
-                rc = KMemBankAccessBlockUpdate ( self, cur, & mp, & block );
-                if ( rc == 0 )
-                {
-                    KMemBlock *head = ( KMemBlock* ) block;
-
-                    /* truncation */
-                    if ( bytes < size )
-                    {
-                        /* free any remaining blocks */
-                        rc = KMemBankFree ( self, block -> next );
-                        if ( rc == 0 )
-                        {
-                            block -> next = 0;
-                            if ( bytes < total )
-                            {
-                                if ( size > total )
-                                    size = total;
-                                if ( cur == id )
-                                    memset ( MEMBLOCK_RDATA ( head, block_size, total - bytes ), 0, size - bytes );
-                                else
-                                    memset ( MEMBLOCK_RDATA ( block, block_size, total - bytes ), 0, size - bytes );
-                            }
-                        }
-                    }
-                    /* extension */
-                    else
-                    {
-                        /* zero out to either new size or end of block */
-                        if ( size < total )
-                        {
-                            uint64_t end = bytes;
-                            if ( bytes > total )
-                                end = total;
-                            if ( cur == id )
-                                memset ( MEMBLOCK_RDATA ( head, block_size, total - size ), 0, end - size );
-                            else
-                                memset ( MEMBLOCK_RDATA ( block, block_size, total - size ), 0, end - size );
-                        }
-
-                        /* allocate more blocks as necessary */
-                        for ( ; total < bytes; total += MEMBLOCK_DATASIZE ( block, block_size ) )
-                        {
-                            rc = KMemBankAllocBlock ( self, & block -> next, & mp, & block, true );
-                            if ( rc != 0 )
-                                break;
-                        }
-                    }
-                    if ( rc == 0 )
-                    {
-                        /* set the new size */
-                        rc = KMemBankAccessBlockUpdate ( self, id, & mp, ( KExtMemBlock** ) & head );
-                        if ( rc == 0 )
-                            head -> size = bytes;
-                    }
-                }
-            }
-        }
-
-        KMemPageWhack ( & mp );
-    }
-
-    return rc;
-}
-
-
-/* Read
- *  linearly access memory
- *
- *  "id" [ IN ] - id of the allocation being read
- *
- *  "pos" [ IN ] - starting offset into allocation
- *
- *  "buffer" [ IN ] and "bsize" [ IN ] - buffer for returned data
- *
- *  "num_read" [ OUT ] - return parameter for the number of bytes read
- */
-LIB_EXPORT rc_t CC KMemBankRead ( const KMemBank *self, uint64_t id,
-   uint64_t pos, void *buffer, size_t bsize, size_t *num_read )
-{
-    rc_t rc;
-
-    if ( num_read == NULL )
-        rc = RC ( rcFS, rcMemory, rcReading, rcParam, rcNull );
-    else
-    {
-        if ( id == 0 )
-            rc = RC ( rcFS, rcMemory, rcReading, rcId, rcNull );
-        else if ( self == NULL )
-            rc = RC ( rcFS, rcMemory, rcReading, rcSelf, rcNull );
-        else
-        {
-            const KMemBlock *head;
-            
-            KMemPage mp;
-            KMemPageInit ( & mp, self -> pg0 );
-
-            /* get head block */
-            rc = KMemBankAccessBlockRead ( self, id, & mp, ( const KExtMemBlock** ) & head );
-            if ( rc == 0 && bsize != 0 && pos < head -> size )
-            {
-                if ( buffer == NULL )
-                    rc = RC ( rcFS, rcMemory, rcReading, rcBuffer, rcNull );
-                else
-                {
-                    const KExtMemBlock *block = ( const KExtMemBlock* ) head;
-                    uint64_t end, block_size = self -> hdr -> u . v1 . block_size;
-
-                    size_t to_read = bsize;
-                    if ( pos + bsize > head -> size )
-                        to_read = ( size_t ) ( head -> size - pos );
-
-                    /* scan ahead to pos */
-                    for ( end = MEMBLOCK_DATASIZE ( head, block_size );
-                          end < pos;
-                          end += MEMBLOCK_DATASIZE ( block, block_size ) )
-                    {
-                        rc = KMemBankAccessBlockRead ( self, block -> next, & mp, & block );
-                        if ( rc != 0 )
-                            break;
-                    }
-                    if ( rc == 0 )
-                    {
-                        uint8_t *dst = buffer;
-
-                        /* the number of bytes from pos to end of block */
-                        size_t remaining = ( size_t ) ( end - pos );
-
-                        /* the number to copy will be <= the remaining bytes */
-                        size_t to_copy, total = ( remaining > to_read ) ? to_read : remaining;
-
-                        /* initial copy may be partial or complete */
-                        memcpy ( dst, MEMBLOCK_RDATA ( block, block_size, remaining ), total );
-
-                        for ( ; total < to_read; total += to_copy )
-                        {
-                            rc = KMemBankAccessBlockRead ( self, block -> next, & mp, & block );
-                            if ( rc != 0 )
-                                break;
-
-                            to_copy = MEMBLOCK_DATASIZE ( block, block_size );
-                            if ( total + to_copy > to_read )
-                                to_copy = to_read - total;
-
-                            memcpy ( & dst [ total ], block -> data, to_copy );
-                        }
-
-                        if ( total != 0 )
-                        {
-                            * num_read = total;
-                            KMemPageWhack ( & mp );
-                            return 0;
-                        }
-                    }
-                }
-            }
-
-            KMemPageWhack ( & mp );
-        }
-
-        * num_read = 0;
-    }
-
-    return rc;
-}
-
-
-/* Write
- *  linearly update memory
- *  will resize as required
- *
- *  "id" [ IN ] - id of the allocation being writ
- *
- *  "pos" [ IN ] - starting offset into allocation
- *
- *  "buffer" [ IN ] and "size" [ IN ] - data to write
- *
- *  "num_writ" [ OUT ] - return parameter for the number of bytes written
- */
-LIB_EXPORT rc_t CC KMemBankWrite ( KMemBank *self, uint64_t id,
-    uint64_t pos, const void *buffer, size_t size, size_t *num_writ )
-{
-    rc_t rc;
-
-    if ( num_writ == NULL )
-        rc = RC ( rcFS, rcMemory, rcWriting, rcParam, rcNull );
-    else
-    {
-        if ( id == 0 )
-            rc = RC ( rcFS, rcMemory, rcWriting, rcId, rcNull );
-        else if ( self == NULL )
-            rc = RC ( rcFS, rcMemory, rcWriting, rcSelf, rcNull );
-        else
-        {
-            const KMemBlock *chead;
-            
-            KMemPage mp;
-            KMemPageInit ( & mp, self -> pg0 );
-
-            /* get head block */
-            rc = KMemBankAccessBlockRead ( self, id, & mp, ( const KExtMemBlock** ) & chead );
-            if ( rc == 0 && size != 0 )
-            {
-                if ( buffer == NULL )
-                    rc = RC ( rcFS, rcMemory, rcWriting, rcBuffer, rcNull );
-                else
-                {
-                    uint64_t cur = id;
-                    uint64_t eof = chead -> size;
-                    const KExtMemBlock *cblock = ( const KExtMemBlock* ) chead;
-                    uint64_t end, block_size = self -> hdr -> u . v1 . block_size;
-
-                    /* scan ahead to pos */
-                    for ( end = MEMBLOCK_DATASIZE ( chead, block_size );
-                          end < eof && end < pos;
-                          end += MEMBLOCK_DATASIZE ( cblock, block_size ) )
-                    {
-                        rc = KMemBankAccessBlockRead ( self, cur = cblock -> next, & mp, & cblock );
-                        if ( rc != 0 )
-                            break;
-                    }
-                    if ( rc == 0 )
-                    {
-                        KExtMemBlock *block;
-                        rc = KMemBankAccessBlockUpdate ( self, cur, & mp, & block );
-                        if ( rc == 0 )
-                        {
-                            size_t to_copy;
-                            KMemBlock *head = ( KMemBlock* ) block;
-
-                            /* detect write position beyond eof */
-                            if ( eof < pos )
-                            {
-                                /* need to zero ahead to either pos or end of block */
-                                uint64_t stop = pos;
-                                if ( pos > end )
-                                    stop = end;
-
-                                /* bytes to zero */
-                                to_copy = ( size_t ) ( stop - eof );
-
-                                /* zero from starting offset */
-                                if ( cur == id )
-                                    memset ( MEMBLOCK_RDATA ( head, block_size, end - eof ), 0, to_copy );
-                                else
-                                    memset ( MEMBLOCK_RDATA ( block, block_size, end - eof ), 0, to_copy );
-
-                                /* allocate more blocks as necessary */
-                                for ( ; end < pos; end += MEMBLOCK_DATASIZE ( block, block_size ) )
-                                {
-                                    rc = KMemBankAllocBlock ( self, & block -> next, & mp, & block, true );
-                                    if ( rc != 0 )
-                                        break;
-                                    cur = block -> next;
-                                }
-                            }
-                            if ( rc == 0 )
-                            {
-                                size_t total;
-                                const uint8_t *src = buffer;
-
-                                /* copy in bytes - alloc as needed */
-                                for ( total = 0; ; end += MEMBLOCK_DATASIZE ( block, block_size ) )
-                                {
-                                    to_copy = ( size_t ) ( end - pos );
-                                    if ( total + to_copy > size )
-                                        to_copy = size - total;
-
-                                    if ( cur == id )
-                                        memcpy ( MEMBLOCK_RDATA ( head, block_size, end - pos ), & src [ total ], to_copy );
-                                    else
-                                        memcpy ( MEMBLOCK_RDATA ( block, block_size, end - pos ), & src [ total ], to_copy );
-
-                                    pos += to_copy;
-                                    if ( ( total += to_copy ) == size )
-                                        break;
-
-                                    if ( block -> next == 0 )
-                                        rc = KMemBankAllocBlock ( self, & block -> next, & mp, & block, false );
-                                    else
-                                        rc = KMemBankAccessBlockUpdate ( self, block -> next, & mp, & block );
-                                    if ( rc != 0 )
-                                        break;
-
-                                    cur = block -> next;
-                                }
-
-                                /* update head -> size */
-                                if ( total != 0 )
-                                {
-                                    rc = 0;
-                                    if ( pos > eof )
-                                    {
-                                        rc = KMemBankAccessBlockUpdate ( self, block -> next, & mp, ( KExtMemBlock** ) & head );
-                                        if ( rc == 0 )
-                                            head -> size = pos;
-                                    }
-                                    if ( rc == 0 )
-                                    {
-                                        KMemPageWhack ( & mp );
-                                        * num_writ = total;
-                                        return 0;
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-
-            KMemPageWhack ( & mp );
-        }
-
-        * num_writ = 0;
-    }
-
-    return rc;
-}
diff --git a/libs/kfs/quickmount.c b/libs/kfs/quickmount.c
deleted file mode 100644
index 4a27909..0000000
--- a/libs/kfs/quickmount.c
+++ /dev/null
@@ -1,967 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-#include <kfs/extern.h>
-#include <kfs/quickmount.h>
-#include <kfs/directory.h>
-
-#include <klib/rc.h>
-#include <klib/printf.h>
-
-#include <sysalloc.h>
-
-#include <string.h>
-#include <stdlib.h>
-#include <assert.h>
-
-/* ----------------------------------------------------------------------
- * 
- */
-
-/* -----
- * define the specific types to be used in the templatish/inheritancish
- * definition of vtables and their elements
- */
-#define KDIR_IMPL struct KQuickMountDir
-#define KNAMELIST_IMPL   struct KQuickMountListing
-#include <kfs/impl.h>
-
-/* ======================================================================
- */
-/*--------------------------------------------------------------------------
- * KQuickMountDir
- *  a directory inside an archive (tar or SRA for example)
- *
- * This type is being engineered to mimic KQuickMountDir.
- */
-struct KQuickMountDir
-{
-    KDirectory   dad;
-    int          root;
-    const KFile* file;
-    char *       mount;
-    char         path[1];
-    /* actual allocation is based on actual string length */
-};
-
-
-
-/* KQuickMountDirCanonPath
- */
-static
-rc_t KQuickMountDirCanonPath ( const KQuickMountDir *self, enum RCContext ctx, char *path, size_t psize )
-{
-    char *low, *dst, *last, *end = path + psize;
-    low = dst = last = path + self -> root;
-
-    while ( 1 )
-    {
-        char *src = strchr ( last + 1, '/' );
-        if ( src == NULL )
-            src = end;
-
-        /* detect special sequences */
-        switch ( src - last )
-        {
-        case 2:
-            if ( last [ 1 ] == '.' )
-            {
-                /* skip over */
-                last = src;
-                if ( src != end )
-                    continue;
-            }
-            break;
-
-        case 3:
-            if ( last [ 1 ] == '.' && last [ 2 ] == '.' )
-            {
-                /* remove previous leaf in path */
-                dst [ 0 ] = 0;
-                dst = strrchr ( path, '/' );
-                if ( dst == NULL || dst < low )
-                    return RC ( rcFS, rcDirectory, ctx, rcPath, rcInvalid );
-
-                last = src;
-                if ( src != end )
-                    continue;
-            }
-            break;
-        }
-
-        /* if rewriting, copy leaf */
-        assert ( src >= last );
-
-        if ( dst != last )
-            memmove ( dst, last, src - last );
-
-        /* move destination ahead */
-        dst += src - last;
-        
-        /* if we're done, go */
-        if ( src == end )
-                break;
-
-        /* find next separator */
-        last = src;
-    }
-
-    /* NUL terminate if modified */
-    if ( dst != end )
-        * dst = 0;
-
-    return 0;
-}
-
-/* KQuickMountDirRelativePath
- *  makes "path" relative to "root"
- *  both "root" and "path" MUST be absolute
- *  both "root" and "path" MUST be canonical, i.e. have no "./" or "../" sequences
- */
-static
-rc_t KQuickMountDirRelativePath (const KQuickMountDir *self, enum RCContext ctx,
-                                 const char *root, char *path, size_t path_max)
-{
-    int backup;
-    size_t bsize, psize;
-
-    const char *r = root + self -> root;
-    const char *p = path + self -> root;
-
-    assert ( r != NULL && r [ 0 ] == '/' );
-    assert ( p != NULL && p [ 0 ] == '/' );
-
-    for ( ; * r == * p; ++ r, ++ p )
-    {
-        /* disallow identical paths */
-        if ( * r == 0 )
-            return RC ( rcFS, rcDirectory, ctx, rcPath, rcInvalid );
-    }
-
-    /* paths are identical up to "r","p"
-       if "r" is within a leaf name, then no backup is needed
-       by counting every '/' from "r" to end, obtain backup count */
-    for ( backup = 0; * r != 0; ++ r )
-    {
-        if ( * r == '/' )
-            ++ backup;
-    }
-
-    /* the number of bytes to be inserted */
-    bsize = backup * 3;
-
-    /* align "p" to last directory separator */
-    while ( p [ -1 ] != '/' ) -- p;
-
-    /* the size of the remaining relative path */
-    psize = strlen ( p );
-
-    /* open up space if needed */
-    if ( (size_t) (p - path) < bsize )
-    {
-        /* prevent overflow */
-        if ( bsize + psize >= path_max )
-            return RC ( rcFS, rcDirectory, ctx, rcPath, rcExcessive );
-        memmove ( path + bsize, p, psize + 1 /* 1 for '\0'*/ );
-    }
-
-    /* insert backup sequences */
-    for ( bsize = 0; backup > 0; bsize += 3, -- backup )
-        memcpy ( & path [ bsize ], "../", 3 );
-
-    /* close gap */
-    if ( (size_t) (p - path) > bsize )
-        memmove ( & path [ bsize ], p, strlen ( p ) + 1 );
-
-    return 0;
-}
-
-
-
-static __inline__
-rc_t KQuickMountDirVMakePath (const KQuickMountDir * self, enum RCContext ctx, 
-                              bool canon, char * buffer, size_t path_max,
-                              const char * path, va_list args)
-{
-    size_t psize;
-    size_t bsize;
-    rc_t rc;
-
-    if ( path == NULL )
-        return RC ( rcFS, rcDirectory, ctx, rcPath, rcNull );
-    if ( path [ 0 ] == 0 )
-        return RC ( rcFS, rcDirectory, ctx, rcPath, rcInvalid );
-
-    if ( args != NULL && path [ 0 ] == '%' )
-    {
-        rc = string_vprintf (buffer, path_max, &psize, path, args);
-
-        if (psize > path_max)
-            return RC ( rcFS, rcDirectory, ctx, rcPath, rcExcessive );
-        if (rc)
-            return rc;
-        if ( buffer [ 0 ] != '/' )
-        {
-            bsize = (self->mount - self->path) - 1;
-            if ( bsize + psize >= path_max )
-                return RC ( rcFS, rcDirectory, ctx, rcPath, rcExcessive );
-            memmove ( buffer + bsize, buffer, psize + 1 );
-            assert ( self -> path [ bsize - 1 ] == '/' );
-            memcpy ( buffer, self -> path, bsize );
-        }
-        else if ( ( bsize = self -> root ) != 0 )
-        {
-            if ( bsize + psize >= path_max )
-                return RC ( rcFS, rcDirectory, ctx, rcPath, rcExcessive );
-            memmove ( buffer + bsize, buffer, psize + 1 );
-            assert ( self -> path [ bsize - 1 ] != '/' );
-            memcpy ( buffer, self -> path, bsize );
-        }
-    }
-    else
-    {
-        if ( path [ 0 ] != '/' )
-        {
-/*             assert ( self -> path [ self -> size - 1 ] == '/' ); */
-            memcpy ( buffer, self -> path, bsize = (self->mount - self->path) - 1 );
-        }
-        else if ( ( bsize = self -> root ) != 0 )
-        {
-            assert ( self -> path [ bsize - 1 ] != '/' );
-            memcpy ( buffer, self -> path, bsize );
-        }
-
-
-        rc = string_vprintf ( buffer + bsize, path_max - bsize, &psize, path, args );
-        if (bsize + psize >= path_max)
-            return RC ( rcFS, rcDirectory, ctx, rcPath, rcExcessive );
-        if (rc)
-            return rc;
-    }
-
-    if ( buffer [ bsize + psize ] == '/' )
-        buffer [ bsize + -- psize ] = 0;
-
-    if ( psize > 0 && ( canon || self -> root != 0 ) )
-        return KQuickMountDirCanonPath ( self, ctx, buffer, bsize + psize );
-
-    return 0;
-}
-
-
-static __inline__
-rc_t KQuickMountDirMakePath (const KQuickMountDir * self, enum RCContext ctx, 
-                             bool canon, char * buffer, size_t path_max,
-                             const char * path, ...)
-{
-    va_list args;
-    rc_t rc;
-
-    va_start (args, path);
-    rc = KQuickMountDirVMakePath (self, ctx, canon, buffer,
-                                  path_max, path, args);
-    va_end (args);
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * KQuickMountDirDestroy
- */
-static rc_t CC KQuickMountDirDestroy (KQuickMountDir *self)
-{
-    rc_t rc;
-
-    rc = KFileRelease (self->file);
-
-    free (self);
-
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * KQuickMountDirList
- *  create a directory listing
- *
- *  "list" [ OUT ] - return parameter for list object
- *
- *  "path" [ IN, NULL OKAY ] - optional parameter for target
- *  directory. if NULL, interpreted to mean "."
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [IN]	 const KQuickMountDir *	self		Object oriented C; KQuickMountDir object for this method
- * [OUT] KNamelist **		listp,
- * [IN]  bool (* 		f	)(const KDirectory*,const char *, void *)
- * [IN]  void *			data
- * [IN]  const char *		path
- * [IN]  va_list		args
- */
-static
-rc_t CC KQuickMountDirList (const KQuickMountDir *self,
-                       KNamelist **listp,
-                       bool (CC* f) (const KDirectory *dir, const char *name, void *data),
-                       void *data,
-                       const char *path,
-                       va_list args)
-{
-    return RC (rcFS, rcDirectory, rcAccessing, rcFunction, rcUnsupported);
-}
-
-
-/* ----------------------------------------------------------------------
- * KQuickMountDirVisit
- *  visit each path under designated directory,
- *  recursively if so indicated
- *
- *  "recurse" [ IN ] - if non-zero, recursively visit sub-directories
- *
- *  "f" [ IN ] and "data" [ IN, OPAQUE ] - function to execute
- *  on each path. receives a base directory and relative path
- *  for each entry, where each path is also given the leaf name
- *  for convenience. if "f" returns non-zero, the iteration will
- *  terminate and that value will be returned. NB - "dir" will not
- *  be the same as "self".
- *
- *  "path" [ IN ] - NUL terminated string in directory-native character set
- */
-static 
-rc_t CC KQuickMountDirVisit (const KQuickMountDir *self, 
-                      bool recurse,
-                      rc_t (CC* f) (const KDirectory *, uint32_t, const char *, void *), 
-                      void *data,
-                      const char *path,
-                      va_list args)
-{
-    return RC (rcFS, rcDirectory, rcAccessing, rcFunction, rcUnsupported);
-}
-
-
-/* ----------------------------------------------------------------------
- * KQuickMountDirVisitUpdate
- */
-static rc_t CC KQuickMountDirVisitUpdate (KQuickMountDir *self,
-                                   bool recurse,
-                                   rc_t (CC*f) (KDirectory *,uint32_t,const char *,void *),
-                                   void *data,
-                                   const char *path,
-                                   va_list args)
-{
-    return RC (rcFS, rcDirectory, rcUpdating, rcFunction, rcUnsupported);
-}
-
-
-/* ----------------------------------------------------------------------
- * KQuickMountDirPathType
- *  returns a KPathType
- *
- *  "path" [ IN ] - NUL terminated string in directory-native character set
- * NOTE: Does not meet a design target of on stack (localized variable) allocation of single 4kb path
- *
- * [RET] uint32_t
- * [IN]  const KQuickMountDir *	self		Object oriented C; KQuickMountDir object for this method
- * [IN]  const char *		path
- * [IN]  va_list		args
- */
-static uint32_t CC KQuickMountDirPathType (const KQuickMountDir *self, const char *path, va_list args)
-{
-    char buff [8192];
-    rc_t rc;
-
-    rc = KQuickMountDirVMakePath (self, rcAccessing, true, buff, sizeof buff, path, args);
-    if (rc)
-        return kptBadPath;
-
-    if (strcmp (buff, self->path) == 0)
-        return kptFile;
-
-    return kptNotFound;
-}
-
-
-/* ----------------------------------------------------------------------
- * KQuickMountDirResolvePath
- *
- *  resolves path to an absolute or directory-relative path
- *
- * [IN]  const KQuickMountDir *self		Objected oriented self
- * [IN]	 bool 		absolute	if non-zero, always give a path starting
- *  					with '/'. NB - if the directory is 
- *					chroot'd, the absolute path
- *					will still be relative to directory root.
- * [OUT] char *		resolved	buffer for NUL terminated result path in 
- *					directory-native character set
- * [IN]	 size_t		rsize		limiting size of resolved buffer
- * [IN]  const char *	path		NUL terminated string in directory-native
- *					character set denoting target path. 
- *					NB - need not exist.
- *
- * NOTE: Does not meet a design target of on stack (localized variable) allocation of single 4kb path
- */
-static rc_t CC KQuickMountDirResolvePath (const KQuickMountDir *self,
-                                          bool absolute,
-                                          char *resolved,
-                                          size_t rsize,
-                                          const char *path,
-                                          va_list args)
-{
-    char full [ 8192 ];
-    rc_t rc = KQuickMountDirVMakePath ( self, rcResolving, true, full, sizeof full, path, args );
-    if ( rc == 0 )
-    {
-        size_t path_size = strlen ( full );
-
-        if ( absolute )
-        {
-            /* test buffer capacity */
-            if ( path_size - self -> root >= rsize )
-                return RC ( rcFS, rcDirectory, rcResolving, rcBuffer, rcInsufficient );
-
-            /* ready to go */
-            strcpy ( resolved, & full [ self -> root ] );
-/*             assert ( resolved [ 0 ] == '/' ); */
-        }
-        else
-        {
-            rc = KQuickMountDirRelativePath ( self, rcResolving, self -> path, full, sizeof full /*path_size*/ );
-            if ( rc == 0 )
-            {
-                path_size = strlen ( full );
-                if ( path_size >= rsize )
-                    return RC ( rcFS, rcDirectory, rcResolving, rcBuffer, rcInsufficient );
-                strcpy ( resolved, full );
-            }
-        }
-    }
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * KQuickMountDirResolveAlias
- *  resolves an alias path to its immediate target
- *  NB - the resolved path may be yet another alias
- *
- *  "alias" [ IN ] - NUL terminated string in directory-native
- *  character set denoting an object presumed to be an alias.
- *
- *  "resolved" [ OUT ] and "rsize" [ IN ] - buffer for
- *  NUL terminated result path in directory-native character set
- *
- * NOTE: Does not meet a design target of on stack (localized variable) allocation of single 4kb path
- */
-static rc_t CC KQuickMountDirResolveAlias (const KQuickMountDir * self, 
-				 bool absolute,
-				 char * resolved,
-				 size_t rsize,
-				 const char *alias,
-				 va_list args)
-{
-    return RC (rcFS, rcDirectory, rcAccessing, rcFunction, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * KQuickMountDirRename
- *  rename an object accessible from directory, replacing
- *  any existing target object of the same type
- *
- *  "from" [ IN ] - NUL terminated string in directory-native
- *  character set denoting existing object
- *
- *  "to" [ IN ] - NUL terminated string in directory-native
- *  character set denoting existing object
- */
-static
-rc_t CC KQuickMountDirRename (KQuickMountDir *self, bool force, const char *from, const char *to)
-{
-    assert (self != NULL);
-    assert (from != NULL);
-    assert (to != NULL);
-
-    return RC (rcFS, rcDirectory, rcUpdating, rcSelf, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * KQuickMountDirRemove
- *  remove an accessible object from its directory
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- *
- *  "force" [ IN ] - if non-zero and target is a directory,
- *  remove recursively
- */
-static
-rc_t CC KQuickMountDirRemove (KQuickMountDir *self, bool force, const char *path, va_list args)
-{
-    assert (self != NULL);
-    assert (path != NULL);
-
-    return RC (rcFS, rcDirectory, rcUpdating, rcSelf, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * KQuickMountDirClearDir
- *  remove all directory contents
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target directory
- *
- *  "force" [ IN ] - if non-zero and directory entry is a
- *  sub-directory, remove recursively
- */
-static
-rc_t CC KQuickMountDirClearDir (KQuickMountDir *self, bool force, const char *path, va_list args)
-{
-    assert (self != NULL);
-    assert (path != NULL);
-
-    return RC (rcFS, rcDirectory, rcUpdating, rcSelf, rcUnsupported);
-}
-
-
-/* ----------------------------------------------------------------------
- * KQuickMountDirAccess
- *  get access to object
- *
- *  "access" [ OUT ] - return parameter for Unix access mode
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- * NOTE: Does not meet a design target of on stack (localized variable) allocation of single 4kb path
- */
-static rc_t CC KQuickMountDirVAccess (const KQuickMountDir *self,
-			    uint32_t *access,
-			    const char *path,
-			    va_list args)
-{
-    return RC (rcFS, rcDirectory, rcAccessing, rcFunction, rcUnsupported);
-}
-
-
-/* ----------------------------------------------------------------------
- * KQuickMountDirSetAccess
- *  set access to object a la Unix "chmod"
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- *
- *  "access" [ IN ] and "mask" [ IN ] - definition of change
- *  where "access" contains new bit values and "mask defines
- *  which bits should be changed.
- *
- *  "recurse" [ IN ] - if non zero and "path" is a directory,
- *  apply changes recursively.
- */
-static rc_t CC KQuickMountDirSetAccess (KQuickMountDir *self,
-			      bool recurse,
-			      uint32_t access,
-			      uint32_t mask,
-			      const char *path,
-			      va_list args)
-{
-    assert (self != NULL);
-    assert (path != NULL);
-
-    return RC (rcFS, rcDirectory, rcUpdating, rcSelf, rcUnsupported);
-}
-
-
-/* ----------------------------------------------------------------------
- * KQuickMountDirCreateAlias
- *  creates a path alias according to create mode
- *
- *  "targ" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- *
- *  "alias" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target alias
- *
- *  "access" [ IN ] - standard Unix directory access mode
- *  used when "mode" has kcmParents set and alias path does
- *  not exist.
- *
- *  "mode" [ IN ] - a creation mode (see explanation above).
- */
-static
-rc_t CC KQuickMountDirCreateAlias (KQuickMountDir *self,
-			 uint32_t access,
-			 KCreateMode mode,
-			 const char *targ,
-			 const char *alias)
-{
-    assert (self != NULL);
-    assert (targ != NULL);
-    assert (alias != NULL);
-
-    return RC (rcFS, rcDirectory, rcCreating, rcSelf, rcUnsupported);
-}
-
-
-/* ----------------------------------------------------------------------
- * KQuickMountDirOpenFileRead
- *  opens an existing file with read-only access
- *
- *  "f" [ OUT ] - return parameter for newly opened file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- * NOTE: Does not meet a design target of on stack (localized variable) allocation of single 4kb path
- */
-static
-rc_t CC KQuickMountDirOpenFileRead	(const KQuickMountDir *self,
-					 const KFile **f,
-					 const char *path,
-					 va_list args)
-{
-    return RC (rcFS, rcDirectory, rcOpening, rcSelf, rcUnsupported);
-}
-
-
-/* ----------------------------------------------------------------------
- * KQuickMountDirOpenFileWrite
- *  opens an existing file with write access
- *
- *  "f" [ OUT ] - return parameter for newly opened file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- *
- *  "update" [ IN ] - if non-zero, open in read/write mode
- *  otherwise, open in write-only mode
- */
-static
-rc_t CC KQuickMountDirOpenFileWrite	(KQuickMountDir *self,
-					 KFile **f,
-					 bool update,
-					 const char *path,
-					 va_list args)
-{
-    assert (self != NULL);
-    assert (f != NULL);
-    assert (path != NULL);
-
-    return RC (rcFS, rcDirectory, rcCreating, rcSelf, rcUnsupported);
-}
-
-
-/* ----------------------------------------------------------------------
- * KQuickMountDirCreateFile
- *  opens a file with write access
- *
- *  "f" [ OUT ] - return parameter for newly opened file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- *
- *  "access" [ IN ] - standard Unix access mode, e.g. 0664
- *
- *  "update" [ IN ] - if non-zero, open in read/write mode
- *  otherwise, open in write-only mode
- *
- *  "mode" [ IN ] - a creation mode (see explanation above).
- */
-static
-rc_t CC KQuickMountDirCreateFile	(KQuickMountDir *self,
-					 KFile **f,
-					 bool update,
-					 uint32_t access,
-					 KCreateMode cmode,
-					 const char *path,
-					 va_list args)
-{
-    assert (self != NULL);
-    assert (f != NULL);
-    assert (path != NULL);
-
-    return RC (rcFS, rcDirectory, rcCreating, rcSelf, rcUnsupported);
-}
-
-
-/* ----------------------------------------------------------------------
- * KQuickMountDirFileSize
- *  returns size in bytes of target file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- *
- *  "size" [ OUT ] - return parameter for file size
- * NOTE: Does not meet a design target of on stack (localized variable) allocation of single 4kb path
- */
-static
-rc_t CC KQuickMountDirFileSize		(const KQuickMountDir *self,
-					 uint64_t *size,
-					 const char *path,
-					 va_list args)
-{
-    return RC (rcFS, rcDirectory, rcCreating, rcSelf, rcUnsupported);
-}
-
-
-/* ----------------------------------------------------------------------
- * KQuickMountDirSetFileSize
- *  sets size in bytes of target file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- *
- *  "size" [ IN ] - new file size
- */
-static
-rc_t CC KQuickMountDirSetFileSize	(KQuickMountDir *self,
-					 uint64_t size,
-					 const char *path,
-					 va_list args)
-{
-    assert (self != NULL);
-    assert (path != NULL);
-
-    return RC (rcFS, rcDirectory, rcWriting, rcSelf, rcUnsupported);
-}
-
-
-/* ----------------------------------------------------------------------
- * KQuickMountDirOpenDirRead
- *
- *  opens a sub-directory
- *
- * [IN]  const KQuickMountDir *	self	Object Oriented C KQuickMountDir self
- * [OUT] const KDirectory **	subp	Where to put the new KDirectory/KQuickMountDir
- * [IN]  bool			chroot	Create a chroot cage for this new subdirectory
- * [IN]  const char *		path	Path to the directory to open
- * [IN]  va_list		args	So far the only use of args is possible additions to path
- */
-static 
-rc_t CC KQuickMountDirOpenDirRead	(const KQuickMountDir *self,
-					 const KDirectory **subp,
-					 bool chroot,
-					 const char *path,
-					 va_list args)
-{
-    return RC (rcFS, rcDirectory, rcOpening, rcSelf, rcUnsupported);
-}
-
-
-/* ----------------------------------------------------------------------
- * KQuickMountDirOpenDirUpdate
- *  opens a sub-directory
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target directory
- *
- *  "chroot" [ IN ] - if non-zero, the new directory becomes
- *  chroot'd and will interpret paths beginning with '/'
- *  relative to itself.
- */
-static
-rc_t CC KQuickMountDirOpenDirUpdate	(KQuickMountDir *self,
-					 KDirectory ** subp, 
-					 bool chroot, 
-					 const char *path, 
-					 va_list args)
-{
-    assert (self != NULL);
-    assert (subp != NULL);
-    assert (path != NULL);
-
-    return RC (rcFS, rcDirectory, rcUpdating, rcSelf, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * KQuickMountDirCreateDir
- *  create a sub-directory
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target directory
- *
- *  "access" [ IN ] - standard Unix directory permissions
- *
- *  "mode" [ IN ] - a creation mode (see explanation above).
- */
-static
-rc_t CC KQuickMountDirCreateDir	(KQuickMountDir *self,
-					 uint32_t access,
-					 KCreateMode mode,
-					 const char *path,
-					 va_list args)
-{
-    assert (self != NULL);
-    assert (path != NULL);
-
-    return RC (rcFS, rcDirectory, rcCreating, rcSelf, rcUnsupported);
-}
-
-
-/* ----------------------------------------------------------------------
- * KQuickMountDirDestroyFile
- */
-#if 0
-static
-rc_t CC KQuickMountDirDestroyFile	(KQuickMountDir *self,
-					 KFile * f)
-{
-    assert (self != NULL);
-    assert (f != NULL);
-
-    return RC (rcFS, rcDirectory, rcDestroying, rcSelf, rcUnsupported);
-}
-
-
-static	rc_t CC KQuickMountDirDate (const KQuickMountDir *self,
-					 KTime_t *date,
-					 const char *path,
-					 va_list args)
-{
-    return RC (rcFS, rcDirectory, rcAccessing, rcSelf, rcUnsupported);
-
-}
-
-
-static	rc_t CC KQuickMountDirSetDate		(KQuickMountDir *self,
-					 bool recurse,
-					 KTime_t date,
-					 const char *path,
-					 va_list args)
-{
-    assert (self != NULL);
-    assert (path != NULL);
-
-    return RC (rcFS, rcDirectory, rcUpdating, rcSelf, rcUnsupported);
-}
-#endif
-
-/* ----------------------------------------------------------------------
- *
- */
-static KDirectory_vt_v1 vtKQuickMountDir =
-{
-    /* version 1.0 */
-    1, 0,
-
-    /* start minor version 0 methods*/
-    KQuickMountDirDestroy,
-    KQuickMountDirList,
-    KQuickMountDirVisit,
-    KQuickMountDirVisitUpdate,
-    KQuickMountDirPathType,
-    KQuickMountDirResolvePath,
-    KQuickMountDirResolveAlias,
-    KQuickMountDirRename,
-    KQuickMountDirRemove,
-    KQuickMountDirClearDir,
-    KQuickMountDirVAccess,
-    KQuickMountDirSetAccess,
-    KQuickMountDirCreateAlias,
-    KQuickMountDirOpenFileRead,
-    KQuickMountDirOpenFileWrite,
-    KQuickMountDirCreateFile,
-    KQuickMountDirFileSize,
-    KQuickMountDirSetFileSize,
-    KQuickMountDirOpenDirRead,
-    KQuickMountDirOpenDirUpdate,
-    KQuickMountDirCreateDir,
-    NULL,
-    /* end minor version 0 methods*/
-    /* start minor version 1 methods*/
-    NULL,
-    NULL,
-    NULL,
-    /* end minor version 2 methods*/
-    NULL,
-    /* end minor version 2 methods*/
-    /* end minor version 3 methods*/
-    NULL,
-    NULL
-    /* end minor version 3 methods*/
-};
-
-
-static KQuickMountDir * KQuickMountDirAlloc (size_t path_size, size_t mount_size)
-{
-    return calloc (sizeof (KQuickMountDir) + path_size + mount_size + 1, 1);
-}
-
-
-KFS_EXTERN rc_t KQuickMountDirMake (const KDirectory * self, 
-                                    const KDirectory ** pnewdir,
-                                    const KFile * file,
-                                    const char * path, size_t path_size,
-                                    const char * mount, size_t mount_size)
-{
-    KQuickMountDir * newdir;
-    char * pc;
-    rc_t rc;
-    bool endslash;
-    char tbuff [8193];
-
-    endslash = path[path_size-1] == '/';
-
-    if (sizeof tbuff - 1 < mount_size)
-        return RC (rcFS, rcDirectory, rcCreating, rcBuffer, rcInsufficient);
-
-    memcpy (tbuff, mount, mount_size);
-    tbuff[mount_size] = '\0';
-
-    while ((pc = strpbrk (tbuff, "\"\\/")) != NULL)
-        *pc = '_';
-
-    rc = KFileAddRef (file);
-    if (rc == 0)
-    {
-        newdir = KQuickMountDirAlloc (path_size, mount_size);
-        if (newdir == NULL)
-            rc = RC (rcFS, rcDirectory, rcAllocating, rcMemory, rcExhausted);
-        else
-        {
-            newdir->file = file;
-            newdir->mount = newdir->path + path_size;
-            rc = KQuickMountDirMakePath (newdir, rcCreating, true, newdir->path,
-                                         path_size + 1 + mount_size + 1,
-                                         endslash?"%s%s":"%s/%s", path, tbuff);
-            if (rc == 0)
-            {
-                rc = KDirectoryInit (&newdir->dad, (const KDirectory_vt*) &vtKQuickMountDir,
-                                     "KQuickMountDir", path?path:"(null)", false);
-                if (rc == 0)
-                {
-                    newdir->mount = newdir->path + path_size + 1;
-                    newdir->root = 0;
-                    *pnewdir = &newdir->dad;
-                    return 0;
-                }
-/*             rc = RC (rcFS, rcDirectory, rcInitializing, rcObject, rcInvalid); */
-            }
-            KQuickMountDirDestroy (newdir);
-        }
-        KFileRelease (file);
-    }
-    return rc;
-}
-                         
-
-
-/* end of file quickmount.c */
-
diff --git a/libs/kfs/ramfile.c b/libs/kfs/ramfile.c
deleted file mode 100644
index 93f6995..0000000
--- a/libs/kfs/ramfile.c
+++ /dev/null
@@ -1,424 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-#include <kfs/extern.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <kfs/file.h>
-#include <sysalloc.h>
-#include <kfs/ramfile.h>
-
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-
-/* ======================================================================
- * KRamFile
- */
-
-/* -----
- * define the specific types to be used in the templatish/inheritancish
- * definition of vtables and their elements
- */
-#define KFILE_IMPL struct KRamFile
-#include <kfs/impl.h>
-
-/*-----------------------------------------------------------------------
- * KRamFile
- *  A KFile that puts reads and writes into a buffer. The buffer is passed
- *  in so the creator will know where the buffer is.
- */
-struct KRamFile
-{
-    KFile	dad;
-
-    uint64_t pos;
-    uint64_t max_pos;
-    size_t   bsize;
-    size_t   max;
-    char *   buffer;
-};
-
-/* ----------------------------------------------------------------------
- * Destroy
- *
- */
-static
-rc_t CC KRamFileDestroy (KRamFile *self)
-{
-    free (self);
-    return 0;
-}
-
-/* ----------------------------------------------------------------------
- * GetSysFile
- *  returns an underlying system file object
- *  and starting offset to contiguous region
- *  suitable for memory mapping, or RAM if
- *  no such file is available.
- *
- * We cant allow memory mapping a tee file as the read?writes ar needed
- * to trigger the writes to the copy KFile
- */
-
-static
-struct KSysFile *CC KRamFileGetSysFile (const KRamFile *self, uint64_t *offset)
-{
-    /* parameters must be non-RAM */
-    assert (self != NULL);
-    assert (offset != NULL);
-
-    return NULL;
-}
-
-/* ----------------------------------------------------------------------
- * RandomAccess
- *
- *  returns 0 if random access, error code otherwise
- *
- * Update needs to be able to seek both original and copy while read
- * only needs to be able to seek the original.
- */
-static
-rc_t CC KRamFileRandomAccess (const KRamFile *self)
-{
-    assert (self != NULL);
-    return 0;
-}
-
-/* ----------------------------------------------------------------------
- * Type
- *  returns a KFileDesc
- *  not intended to be a content type,
- *  but rather an implementation class
- */
-static
-uint32_t CC KRamFileType (const KRamFile *self)
-{
-    return kfdNull;
-}
-
-
-/* ----------------------------------------------------------------------
- * Size
- *  returns size in bytes of file
- *
- *  "size" [ OUT ] - return parameter for file size
- */
-static
-rc_t CC KRamFileSize (const KRamFile *self, uint64_t *size)
-{
-    assert (self != NULL);
-    assert (size != NULL);
-
-/*     return RC ( rcFS, rcFile, rcAccessing, rcFunction, rcUnsupported ); */
-    *size = self->max_pos;
-    return 0;
-}
-
-/* ----------------------------------------------------------------------
- * SetSize
- *  sets size in bytes of file
- *
- *  "size" [ IN ] - new file size
- */
-static
-rc_t CC KRamFileSetSize (KRamFile *self, uint64_t size)
-{
-/*     return RC (rcFS, rcFile, rcUpdating, rcSelf, rcUnsupported); */
-    self->max_pos = size;
-    return 0;
-}
-
-/* ----------------------------------------------------------------------
- * Read
- *  read file from known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT, RAM OKAY ] - optional return parameter
- *  giving number of bytes actually read
- *
- * NOTE: Can not seek;
- *
- */
-static
-rc_t CC KRamFileRead	(const KRamFile *self,
-			 uint64_t pos,
-			 void *buffer,
-			 size_t bsize,
-			 size_t *num_read)
-{
-    assert (self);
-    assert (buffer);
-    assert (num_read);
-    /* no restrictions on pos or bsize */
-
-    if (pos >= self->max_pos)
-    {
-        *num_read = 0;
-        return 0;
-    }
-
-    if (pos + bsize > self->max_pos)
-        bsize = self->max_pos - pos;
-
-    /* if we are trying to read outside the current window */
-    if (self->pos > pos)
-    {
-        /* get some zeros */
-        size_t left_zeroes;
-
-        left_zeroes = self->pos - pos;
-
-        if (left_zeroes >= bsize)
-            left_zeroes = bsize;
-
-        memset (buffer, 0, bsize);
-    }
-    else if (self->pos + self->bsize < pos)
-        memset (buffer, 0, bsize);
-
-    /* so we are inside the current window */
-    else
-    {
-        /* are we trying to go past the window? */
-        if (pos + bsize > self->pos + self->bsize)
-            bsize = (self->pos + self->bsize) - pos;
-
-        memcpy (buffer, self->buffer + (pos - self->pos), bsize);
-    }
-    *num_read = bsize;
-    return 0;
-}
-
-
-/* ----------------------------------------------------------------------
- * Write
- *  write file at known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ IN ] and "size" [ IN ] - data to be written
- *
- *  "num_writ" [ OUT, RAM OKAY ] - optional return parameter
- *  giving number of bytes actually written
- *
- * Always accepts writes and can seek.
- */
-static
-rc_t CC KRamFileWrite (KRamFile *self, uint64_t pos,
-		       const void *buffer, size_t bsize,
-		       size_t *num_writ)
-{
-    char * to;
-
-    /* can't really fail */
-
-    assert (self);
-    assert (buffer);
-    assert (num_writ);
-
-    /* does the write fill the buffer? */
-    if (bsize >= self->max)
-    {
-        /* we can never allow a write larger than the internal buffer */
-        self->pos = pos;
-        self->bsize = bsize = self->max;
-        to = self->buffer;
-        if (self->max_pos < pos + bsize)
-            self->max_pos = pos + bsize;
-    }
-
-    /* else are we seeking forward or backward to completely new or completely
-     * over writing what is there */
-    else if ((self->bsize == 0) ||                     /* currently no buffer */
-             (pos >= (self->pos + self->max)) || /* past current */
-             (pos + self->max <= self->pos) ||   /* behind current */
-             ((pos <= self->pos) && (pos + bsize >= self->pos + self->bsize)))
-    {
-        /* reset the buffer parameters */
-        self->pos = pos;
-        self->bsize = bsize;
-        if (self->max_pos < pos + bsize)
-            self->max_pos = pos + bsize;
-
-        to = self->buffer;
-        /* clear any unused portion of the buffer */
-        if (self->max > bsize)
-            memset (self->buffer + bsize, 0, self->max - bsize);
-    }
-    else if (pos >= self->pos) 
-    {
-        /* if we are reading something at or after what we have now
-         * where the right edge was doesn't matter since we zero fill
-         * in the previous condition and at construction */
-        /* how far into the buffer will we start */
-        size_t poff = pos - self->pos;
-
-        /* do we have to slide the window? This is not optimized */
-        if ((poff != 0) && (poff + bsize > self->max))
-        {
-            size_t m = poff + bsize - self->max;
-            if (self->bsize < self->max)
-                memset (self->buffer + bsize, 0, self->max = self->bsize);
-            /* must use memmove not memcpy */
-            memmove (self->buffer, self->buffer + poff, self->max - pos);
-
-            poff -= m;
-            self->pos -= m;
-        }
-
-        /* check for a new self->bsize */
-        if (poff + bsize > self->bsize)
-            self->bsize = poff + bsize;
-
-        /* check for a new max position */
-        if (self->max_pos < self->pos + self->bsize)
-            self->max_pos = self->pos + self->bsize;
-
-        to = self->buffer + poff;
-    }
-    else
-    {
-        size_t poff = self->pos - pos;
-
-        /* non optimized slide */
-        memmove (self->buffer + poff, self->buffer, self->max - poff);
-        self->pos = pos;
-        self->bsize += poff;
-        if (self->bsize > self->max)
-            self->bsize = self->max;
-        to = self->buffer;
-    }
-    memcpy (to, buffer, bsize);
-    *num_writ = bsize;
-
-    return 0;
-}
-
-
-static const KFile_vt_v1 vtKRamFile =
-{
-    /* version */
-    1, 1,
-
-    /* 1.0 */
-    KRamFileDestroy,
-    KRamFileGetSysFile,
-    KRamFileRandomAccess,
-    KRamFileSize,
-    KRamFileSetSize,
-    KRamFileRead,
-    KRamFileWrite,
-
-    /* 1.1 */
-    KRamFileType
-};
-
-/* ----------------------------------------------------------------------
- * KRamFileMake
- *  create a new file object
- */
-static
-rc_t KRamFileMake (KRamFile ** pself, char * buffer, size_t buffer_size, bool r, bool w)
-{
-    rc_t	rc;
-    KRamFile *	self;
-
-    /* -----
-     */
-    if (pself == NULL)
-        return RC (rcFS, rcFile, rcConstructing, rcSelf, rcNull);
-
-    if (buffer == NULL)
-        return RC (rcFS, rcFile, rcConstructing, rcParam, rcNull);
-
-    /* we only deny size 0 buffer just to avoid the too weird corner cases */
-    if (buffer_size == 0)
-        return RC (rcFS, rcFile, rcConstructing, rcParam, rcTooShort);
-
-    if (((r != true) && (r != false)) || ((w != true) && (w != false)))
-        return RC (rcFS, rcFile, rcConstructing, rcParam, rcInvalid);
-
-    /* -----
-     * get space for the object
-     */
-    self = malloc (sizeof (*self));
-    if (self == NULL)	/* allocation failed */
-    {
-	/* fail */
-	rc = RC (rcFS, rcFile, rcConstructing, rcMemory, rcExhausted);
-    }
-    else
-    {
-	rc = KFileInit (&self->dad,			/* initialize base class */
-			(const KFile_vt*)&vtKRamFile, 	/* VTable for KRamFile */
-            "KRamFile", "ram",
-                        r,w);
-	if (rc == 0)
-	{
-            self->pos = self->max_pos = 0;
-            self->max = buffer_size;
-            self->bsize = 0;
-            self->buffer = buffer;
-	    *pself = self;
-	    return 0;
-	}
-	/* fail */
-	free (self);
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC KRamFileMakeRead (const KFile ** selfp,char * buffer, size_t buffer_size)
-{
-    KRamFile *self;
-    rc_t rc = KRamFileMake ( & self, buffer, buffer_size, true, false);
-    if ( rc == 0 )
-    {
-        self -> max_pos = buffer_size;
-        self -> bsize = buffer_size;
-        * selfp = & self -> dad;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KRamFileMakeWrite (KFile ** self, char * buffer, size_t buffer_size)
-{
-    return KRamFileMake ((KRamFile **)self, buffer, buffer_size, false, true);
-}
-
-LIB_EXPORT rc_t CC KRamFileMakeUpdate (KFile ** self, char * buffer, size_t buffer_size)
-{
-    return KRamFileMake ((KRamFile **)self, buffer, buffer_size, true, true);
-}
-
-
-/* end of file ramfile.c */
-
diff --git a/libs/kfs/readheadfile.c b/libs/kfs/readheadfile.c
deleted file mode 100644
index 59ab0a5..0000000
--- a/libs/kfs/readheadfile.c
+++ /dev/null
@@ -1,294 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-#include <kfs/extern.h>
-#include <klib/log.h>
-#include <klib/debug.h>
-#include <klib/rc.h>
-#include <kfs/file.h>
-#include <kfs/readheadfile.h>
-#include <sysalloc.h>
-
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-/* ======================================================================
- * KReadHeadFile
- */
-
-/* -----
- * define the specific types to be used in the templatish/inheritancish
- * definition of vtables and their elements
- */
-struct KReadHeadFile;
-#define KFILE_IMPL struct KReadHeadFile
-#include <kfs/impl.h>
-
-
-/*-----------------------------------------------------------------------
- * KReadHeadFile
- */
-typedef struct KReadHeadFile
-{
-    KFile	  dad;
-    uint64_t	  max_position;
-    const KFile * original;
-    size_t        buffer_size;
-    uint8_t       buffer [1];
-} KReadHeadFile;
-
-/* ----------------------------------------------------------------------
- * Destroy
- *
- */
-static
-rc_t CC KReadHeadFileDestroy (KReadHeadFile *self)
-{
-    rc_t rc;
-
-    rc = KFileRelease (self->original);
-
-    free (self);
-    return rc;
-}
-
-/* ----------------------------------------------------------------------
- * GetSysFile
- *  returns an underlying system file object
- *  and starting offset to contiguous region
- *  suitable for memory mapping, or NULL if
- *  no such file is available.
- *
- * bytes could not be counted if memory mapped so this is disallowed
- */
-
-static
-struct KSysFile *CC KReadHeadFileGetSysFile (const KReadHeadFile *self, uint64_t *offset)
-{
-    /* parameters must be non-NULL */
-    assert (self != NULL);
-    assert (offset != NULL);
-
-    return KFileGetSysFile (self->original, offset);
-}
-
-/* ----------------------------------------------------------------------
- * RandomAccess
- *
- *  returns 0 if random access, error code otherwise
- */
-static
-rc_t CC KReadHeadFileRandomAccess (const KReadHeadFile *self)
-{
-    return KFileRandomAccess (self->original);
-}
-
-/* ----------------------------------------------------------------------
- * Type
- *  returns a KFileDesc
- *  not intended to be a content type,
- *  but rather an implementation class
- */
-static
-uint32_t CC KReadHeadFileType (const KReadHeadFile *self)
-{
-    return KFileType (self->original);
-}
-
-/* ----------------------------------------------------------------------
- * Size
- *  returns size in bytes of file
- *
- *  "size" [ OUT ] - return parameter for file size
- */
-static
-rc_t CC KReadHeadFileSize (const KReadHeadFile *self, uint64_t *size)
-{
-    return KFileSize (self->original, size);
-}
-
-/* ----------------------------------------------------------------------
- * SetSize
- *  sets size in bytes of file
- *
- *  "size" [ IN ] - new file size
- */
-static
-rc_t CC KReadHeadFileSetSize (KReadHeadFile *self, uint64_t size)
-{
-    return RC (rcFS, rcFile, rcUpdating, rcFunction, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * Read
- *  read file from known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually read
- */
-static
-rc_t CC KReadHeadFileRead	(const KReadHeadFile *cself,
-				 uint64_t pos,
-				 void *buffer,
-				 size_t bsize,
-				 size_t *num_read)
-{
-    rc_t rc;
-    size_t valid = 0;
-    size_t this_read;
-    KReadHeadFile *self = (KReadHeadFile *)cself;
-    *num_read = 0;
-
-    /* are we re-reading? */
-    if (pos < self->max_position)
-    {
-        size_t valid = self->max_position - pos;
-
-        if (bsize <= valid)
-        {
-            memmove (buffer, self->buffer + pos, bsize);
-            return 0;
-        }
-
-        memmove (buffer, self->buffer + pos, valid);
-    }
-    rc = KFileRead (self->original, pos + valid, (char *)buffer + valid,
-                    bsize - valid, &this_read);
-
-    *num_read = (rc) ? 0 : valid + this_read;
-    return rc;
-}
-
-/* ----------------------------------------------------------------------
- * Write
- *  write file at known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ IN ] and "size" [ IN ] - data to be written
- *
- *  "num_writ" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually written
- *
- * Unsupported as we now treat archives as READ ONLY
- */
-static
-rc_t CC KReadHeadFileWrite (KReadHeadFile *self, uint64_t pos,
-			   const void *buffer, size_t bsize,
-			   size_t *num_writ)
-{
-    assert ( self != NULL );
-    return RC (rcFS, rcFile, rcWriting, rcFunction, rcUnsupported);
-}
-
-static const KFile_vt_v1 vtKReadHeadFile =
-{
-    /* version */
-    1, 1,
-
-    /* 1.0 */
-    KReadHeadFileDestroy,
-    KReadHeadFileGetSysFile,
-    KReadHeadFileRandomAccess,
-    KReadHeadFileSize,
-    KReadHeadFileSetSize,
-    KReadHeadFileRead,
-    KReadHeadFileWrite,
-
-    /* 1.1 */
-    KReadHeadFileType
-};
-
-
-
-/* ----------------------------------------------------------------------
- * KReadHeadFileMake
- *  create a new file object
- */
-
-LIB_EXPORT rc_t CC KFileMakeReadHead (const KFile ** pself,
-                                      const KFile * original,
-                                      size_t buffer_size)
-{
-    rc_t rc;
-
-    if (pself == NULL)
-        return RC (rcFS, rcFile, rcConstructing, rcSelf, rcNull);
-
-    *pself = NULL;
-
-    if (original == NULL)
-        return RC (rcFS, rcFile, rcConstructing, rcParam, rcNull);
-
-    rc = KFileAddRef (original);
-    if (rc)
-        return rc;
-
-    rc = KFileRandomAccess (original);
-
-    /* buffering not needed as existing file is random access */
-    if (rc == 0)
-    {
-        *pself = original;
-        return 0;
-    }
-
-    /* some other failure we'll have to bail on */
-    else if (GetRCState(rc) != rcUnsupported)
-        return rc;
-
-    else
-    {
-        KReadHeadFile * self;
-
-        self = malloc (sizeof (*self) + buffer_size); /* really too much but too hard to tune down accurately */
-        if (self == NULL)
-            return RC (rcFS, rcFile, rcConstructing, rcMemory, rcExhausted);
-
-	rc = KFileInit (&self->dad,			/* initialize base class */
-			(const KFile_vt*)&vtKReadHeadFile,/* VTable for KReadHeadFile */
-            "KReadHeadFile", "no-name",
-			original->read_enabled,
-			false);
-	if (rc == 0)
-	{
-            self->max_position = 0;
-            self->original = original;
-            self->buffer_size = buffer_size;
-            *pself = &self->dad;
-            return 0;
-	}
-	/* fail */
-	free (self);
-    }
-    return rc;
-}
-
-/* end of file countfile.c */
-
diff --git a/libs/kfs/report.c b/libs/kfs/report.c
deleted file mode 100644
index 94c6600..0000000
--- a/libs/kfs/report.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kfs/extern.h>
-
-#include <klib/klib-priv.h>
-#include <klib/out.h> /* KOutHandlerSet */
-#include <klib/rc.h>
-
-#include <kfs/directory.h>
-#include <kfs/file.h> /* KFileWrite */
-
-#include <sysalloc.h>
-
-#include <assert.h>
-#include <stdlib.h> /* calloc */
-#include <string.h> /* memset */
-
-#ifndef PATH_MAX
-#define PATH_MAX 4096
-#endif
-
-#define RELEASE(type, obj) do { rc_t rc2 = type##Release(obj); \
-    if (rc2 && !rc) { rc = rc2; } obj = NULL; } while (false)
-
-/*
- * An unrecoverable error happened.
- * We can help to solve it
- * by reporting information about known application execution environment.
- */
-
-#define report ( * f -> report )
-#define reportData ( * f -> reportData )
-#define reportData1 ( * f -> reportData1 )
-#define reportOpen ( * f -> reportOpen )
-#define reportOpen1 ( * f -> reportOpen1 )
-#define reportClose ( * f -> reportClose )
-#define reportClose1 ( * f -> reportClose1 )
-#define reportError ( * f -> reportError )
-#define reportErrorStr ( * f -> reportErrorStr )
-#define reportErrorStrImpl ( * f -> reportErrorStrImpl )
-#define reportErrorStrInt ( * f -> reportErrorStrInt )
-#define reportError3Str ( * f -> reportError3Str )
-
-#define MAGIC 0x6521
-
-typedef struct SFile {
-    uint64_t magic;
-    KFile* f;
-    uint64_t pos;
-} SFile;
-
-static rc_t CC fileWriter
-(void* data, const char* buffer, size_t bytes, size_t* num_writ)
-{
-    rc_t rc = 0;
-
-    SFile* self = (SFile*)data;
-    size_t dummy;
-    if (num_writ == NULL)
-    {   num_writ = &dummy; }
-    *num_writ = 0;
-
-    assert(self);
-    if (self->magic != MAGIC) {
-        return rc;
-    }
-
-    rc = KFileWrite(self->f, self->pos, buffer, bytes, num_writ);
-    self->pos += *num_writ;
-
-    return rc;
-}
-
-rc_t CC ReportRedirect
-( KWrtHandler* handler, const char* filename, bool* to_file, bool finalize )
-{
-    rc_t rc = 0;
-    if (!finalize) {
-        if (handler) {
-            handler->writer = KOutWriterGet();
-            handler->data = KOutDataGet();
-        }
-        if (filename) {
-            KDirectory* dir = NULL;
-            SFile* data = calloc(1, sizeof *data);
-            if (data == NULL) {
-                return RC(rcFS, rcMemory, rcAllocating, rcMemory, rcExhausted);
-            }
-            data->magic = MAGIC;
-            rc = KDirectoryNativeDir(&dir);
-            if (rc == 0) {
-                rc = KDirectoryCreateFile
-                    (dir, &data->f, false, 0664, kcmInit, filename);
-            }
-            if (rc == 0) {
-                rc = KOutHandlerSet(fileWriter, data);
-            }
-            RELEASE(KDirectory, dir);
-        }
-        if (rc != 0 || filename == NULL) {
-            KOutHandlerSetStdErr();
-            if (to_file)
-            {   *to_file = false; }
-        }
-        else if (to_file)
-        {   *to_file = true; }
-
-    }
-    else {
-        void* data = KOutDataGet();
-        SFile* self = (SFile*)data;
-        if (self) {
-            if (self->magic == MAGIC) {
-                RELEASE(KFile, self->f);;
-            }
-            memset(self, 0, sizeof *self);
-            free(self);
-        }
-        if (handler) {
-            KOutHandlerSet(handler->writer, handler->data);
-        }
-    }
-    return rc;
-}
-
-rc_t CC ReportCWD ( const ReportFuncs *f, uint32_t indent )
-{
-    KDirectory *wd;
-    rc_t rc = KDirectoryNativeDir ( & wd );
-    if ( rc != 0 )
-        reportError(indent, rc, "KDirectoryNativeDir");
-    else
-    {
-        char cwd [ PATH_MAX + 1 ];
-        rc = KDirectoryResolvePath ( wd, true, cwd, sizeof cwd, "." );
-        KDirectoryRelease ( wd );
-
-        if ( rc != 0 )
-            reportError(indent, rc, "KDirectoryResolvePath");
-        else
-            reportData(indent, "Cwd", cwd, 0);
-    }
-
-    return rc;
-}
diff --git a/libs/kfs/sra.c b/libs/kfs/sra.c
deleted file mode 100644
index f237505..0000000
--- a/libs/kfs/sra.c
+++ /dev/null
@@ -1,486 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <kfs/extern.h>
-
-#include <klib/defs.h>
-#include <byteswap.h>
-#include <klib/rc.h>
-#include <kfs/file.h>
-#include <kfs/sra.h>
-/* #include <kfs/toc.h> */
-#include <klib/log.h>
-#include "toc-priv.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <sysalloc.h>
-
-
-struct KToc;
-struct KDirectory;
-
-
-
-static
-const KSraHeader ksraheader_v1 =
-{
-    { 'N', 'C','B', 'I' },
-    { '.', 's','r', 'a' },
-    eSraByteOrderTag,
-    1
-};
-
-LIB_EXPORT size_t CC SraHeaderSize ( const KSraHeader * self )
-{
-    /* self can be NULL */
-    return sizeof ( KSraHeader );
-}
-
-static
-uint64_t add_filler (uint64_t z, KSRAFileAlignment a)
-{
-    if (a > 1)
-    {
-        uint64_t m = (uint64_t)a - 1;
-        return (z + m) & ~ m;
-    }
-    return z;
-}
-
-static void	SraHeaderInit (KSraHeader * self, size_t treesize, KSRAFileAlignment alignment)
-{
-    memcpy (self, &ksraheader_v1, sizeof ksraheader_v1);
-    self->u.v1.file_offset = add_filler (sizeof * self + treesize, alignment);
-}
-
-rc_t SraHeaderMake (KSraHeader ** pself, size_t treesize, KSRAFileAlignment alignment)
-{
-    KSraHeader * self = malloc (sizeof (KSraHeader));
-    if (self == NULL)
-	return RC ( rcFS, rcToc, rcConstructing, rcMemory, rcExhausted );
-    SraHeaderInit (self, treesize, alignment);
-    *pself = self;
-    return 0;
-}
-
-
-static rc_t  SraHeaderValidate ( const KSraHeader * self, bool * reverse, uint32_t * _version, size_t bytes_available )
-{
-    uint64_t offset;
-    rc_t rc;
-    uint32_t version;
-    bool rev;
-
-    if (reverse != NULL)
-	*reverse = false;
-    if (_version != NULL)
-	*_version = 0;
-
-    if (bytes_available < 8)
-        return RC (rcFS, rcArc, rcParsing, rcHeader, rcInsufficient);
-
-    if (memcmp ((void*)self, &ksraheader_v1,
-		sizeof (ksraheader_v1.ncbi) + sizeof (ksraheader_v1.sra)) != 0)
-	return RC (rcFS, rcArc, rcParsing, rcHeader, rcInvalid);
-
-    if (bytes_available < 12)
-        return 0;
-
-    switch (self->byte_order)
-    {
-    default:
-	return RC (rcFS, rcArc, rcParsing, rcHeader, rcCorrupt);
-    case eSraByteOrderTag:
-	rev = false;
-	break;
-    case eSraByteOrderReverse:
-	rev = true;
-	break;
-    }
-    rc = 0;
-
-    if (bytes_available < 16)
-        return 0;
-
-    version = rev ? bswap_32 (self->version) : self->version;
-    offset = rev ? bswap_64 (self->u.v1.file_offset) : self->u.v1.file_offset;
-
-    if (version > FS_SRA_CUR_VERSION)
-	rc =  RC (rcFS, rcArc, rcParsing, rcHeader, rcUnsupported);
-
-    /* 4 is minimum size for a TOC */
-    else if (offset < (sizeof ksraheader_v1 + 4))
-	return RC (rcFS, rcArc, rcParsing, rcHeader, rcCorrupt);
-
-    if (reverse != NULL)
-	*reverse = rev;
-    if (_version != NULL)
-	*_version = version;
-
-    return rc;
-}
-
-LIB_EXPORT uint64_t CC SraHeaderGetFileOffset ( const KSraHeader * self )
-{
-    if ( self -> byte_order == eSraByteOrderReverse )
-        return bswap_64 ( self->u.v1.file_offset );
-    return self->u.v1.file_offset;
-}
-
-static
-rc_t KTocParseRead (const KFile * f, uint64_t p, void * b, size_t z, size_t * n)
-{
-    rc_t rc;
-    size_t a;
-    size_t t;
-
-    rc = 0;
-    for (a = 0; a < z; a += t)
-    {
-	rc = KFileRead (f, p + a, (uint8_t*)b + a, z - a, &t);
-	if (rc != 0)
-	    return rc;
-	if (t == 0)
-	    break;
-    }
-    if (a < z)
-	rc = RC (rcFS, rcToc, rcParsing, rcFile, rcTooShort);
-    *n = a;
-    return rc;
-}
-
-
-static
-rc_t KTocParseReadPBSTree (struct KToc * self, const KFile * file, uint64_t endpos, void ** header)
-{
-    rc_t rc;
-    uint64_t toc_pos;
-    uint64_t end_pos;
-    size_t num_read;
-    size_t tree_size;
-
-    rc = 0;
-    toc_pos = SraHeaderSize(NULL);
-    end_pos = endpos;
-
-    if (end_pos <= toc_pos)
-    {
-        /* 	rc = RC (rcFS, rcToc, rc */
-    }
-    tree_size = (size_t)(end_pos - toc_pos);
-
-    *header = malloc (tree_size);
-    if (*header == NULL)
-    {
-        rc = RC (rcFS, rcToc, rcParsing, rcMemory, rcExhausted);
-    }
-    else
-    {
-        rc = KTocParseRead (file, toc_pos, *header, tree_size, &num_read);
-        if (rc == 0)
-        {
-            return 0;
-        }
-        free (*header);
-        *header = NULL;
-    }
-    return rc;
-}
-
-static
-rc_t CC KArcParseSRAInt ( struct KToc * self,
-                          const void * kvoid,
-                          bool ( CC * ignored ) ( const struct KDirectory *,  const char *, void * ),
-                          void * ignored_data, 
-                          bool unbounded,
-                          bool silent )
-{
-    uint64_t arcsize;
-    rc_t rc;
-    bool reverse;
-    uint32_t version;
-    KSraHeader header;
-    size_t num_read;
-    size_t all_read;
-    const KFile * file;
-    void * pbstreeBuffer;
-    /*     uint64_t toc_offset; */
-    /*     uint64_t file_offset; */
-
-    rc = 0;
-    if ( kvoid == NULL )
-    {
-        rc = RC ( rcFS, rcToc, rcParsing, rcParam, rcNull );
-        if ( !silent )
-            LOGERR ( klogErr, rc, "File parameter null for parsing .sra" );
-        return rc;
-    }
-    file = kvoid;
-
-    rc = KFileSize ( file, &arcsize );
-    if (rc)
-    {
-        if ( unbounded )
-            arcsize = ( (uint64_t)0 ) - 1;
-        else
-        {
-            rc = RC ( rcFS, rcToc, rcParsing, rcFile, rcIncorrect );
-            if ( !silent )
-                LOGERR ( klogErr, rc, "Can't determine archive file size" );
-            return rc;
-        }
-    }
-
-    for ( num_read = all_read = 0; all_read < sizeof (header); all_read += num_read )
-    {
-        rc = KTocParseRead ( file, 0, &header, sizeof (header), &num_read );
-        if ( num_read == 0 )
-        {
-            rc = RC ( rcFS, rcToc, rcParsing, rcFile, rcTooShort );
-            break;
-        }
-    }
-    if ( rc != 0 )
-    {
-        if ( !silent )
-            LOGERR ( klogErr, rc, "error reading file to parse .sra" );
-        return rc;
-    }
-
-    /* version is ignored at this point as there is only one version */
-    rc = SraHeaderValidate ( &header, &reverse, &version, sizeof header );
-    if ( rc != 0 )
-    {
-        if ( !silent )
-            LOGERR ( klogErr, rc, "File header invalid for .sra header" );
-        return rc;
-    }
-
-    switch ( version )
-    {
-    default:
-        rc = RC ( rcFS, rcToc, rcParsing, rcFileFormat, rcBadVersion );
-        if ( !silent )
-            LOGERR ( klogInt, rc, "Incompatible file version" );
-        break;
-    case 1:
-        rc = KTocParseReadPBSTree ( self, file, SraHeaderGetFileOffset (&header),
-                                   &pbstreeBuffer );
-        if ( rc != 0 )
-        {
-            if ( !silent )
-                LOGERR ( klogErr, rc, "File TOC not read for .sra header" );
-            break;
-        }
-        else
-        {
-            uint64_t offset;
-            offset = SraHeaderGetFileOffset (&header);
-            rc = KTocInflatePBSTree ( self, arcsize, pbstreeBuffer, 
-                                     (uint32_t)(offset - sizeof (header)),
-                                     offset,
-                                     reverse, "" );
-            free ( pbstreeBuffer );
-            if ( rc != 0 && !silent )
-            {
-                LOGERR (klogErr, rc, "File TOC not valid for .sra");
-            }
-            /* 	    else */
-            /* 	    { */
-            /* 		rc = KTocParseSraDirectory (self, bst, ""); */
-            /* 		if (rc == 0) */
-            /* 		    return 0; */
-            /* 	    } */
-        }
-        break;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KArcParseSRA ( struct KToc * self,
-                                  const void * kvoid,
-                                  bool (CC*ignored) (const struct KDirectory*,  const char*, void*),
-                                  void *ignored_data )
-{
-    return KArcParseSRAInt ( self, kvoid, ignored, ignored_data, false, false );
-}
-
-
-LIB_EXPORT rc_t CC KArcParseSRA_silent ( struct KToc * self,
-                                  const void * kvoid,
-                                  bool (CC*ignored) (const struct KDirectory*,  const char*, void*),
-                                  void *ignored_data )
-{
-    return KArcParseSRAInt ( self, kvoid, ignored, ignored_data, false, true );
-}
-
-LIB_EXPORT rc_t CC KArcParseSRAUnbounded ( struct KToc * self,
-                                  const void * kvoid,
-                                  bool (CC*ignored) (const struct KDirectory*,  const char*, void*),
-                                  void *ignored_data )
-{
-    return KArcParseSRAInt ( self, kvoid, ignored, ignored_data, true, false );
-}
-
-LIB_EXPORT rc_t CC KArcParseSRAUnbounded_silent ( struct KToc * self,
-                                  const void * kvoid,
-                                  bool (CC*ignored) (const struct KDirectory*,  const char*, void*),
-                                  void *ignored_data )
-{
-    return KArcParseSRAInt ( self, kvoid, ignored, ignored_data, true, false );
-}
-
-
-LIB_EXPORT rc_t CC KDirectoryVOpenSraArchiveRead ( struct KDirectory const *self,
-    struct KDirectory const **sra_dir, int chroot, const char *path, va_list args )
-{
-    /* respond properly to va_list */
-    char full [ 4096 ];
-    int len = vsnprintf ( full, sizeof full, path, args );
-    if ( len < 0 )
-        return RC ( rcFS, rcDirectory, rcOpening, rcPath, rcExcessive );
-
-    /* putting off parameter validation into this call */
-    return KDirectoryOpenArcDirRead (self, sra_dir, chroot, full, tocKFile,
-                                     KArcParseSRA, NULL, NULL);
-}
-
-
-LIB_EXPORT rc_t CC KDirectoryOpenSraArchiveRead ( struct KDirectory const *self,
-    struct KDirectory const **sra_dir, int chroot, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDirectoryVOpenSraArchiveRead ( self, sra_dir, chroot, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC KDirectoryVOpenSraArchiveRead_silent ( struct KDirectory const *self,
-    struct KDirectory const **sra_dir, int chroot, const char *path, va_list args )
-{
-    /* respond properly to va_list */
-    char full [ 4096 ];
-    int len = vsnprintf ( full, sizeof full, path, args );
-    if ( len < 0 )
-        return RC ( rcFS, rcDirectory, rcOpening, rcPath, rcExcessive );
-
-    /* putting off parameter validation into this call */
-    return KDirectoryOpenArcDirRead_silent ( self, sra_dir, false, full, tocKFile,
-                                     KArcParseSRA_silent, NULL, NULL );
-}
-
-
-LIB_EXPORT rc_t CC KDirectoryOpenSraArchiveRead_silent ( struct KDirectory const *self,
-    struct KDirectory const **sra_dir, int chroot, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDirectoryVOpenSraArchiveRead_silent ( self, sra_dir, chroot, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC KDirectoryVOpenSraArchiveReadUnbounded_silent_preopened ( struct KDirectory const *self,
-    struct KDirectory const **sra_dir, int chroot, const struct KFile * f, const char *path, va_list args )
-{
-    /* respond properly to va_list */
-    char full [ 4096 ];
-    int len = vsnprintf ( full, sizeof full, path, args );
-    if ( len < 0 || len >= sizeof full )
-        return RC ( rcFS, rcDirectory, rcOpening, rcPath, rcExcessive );
-
-    /* putting off parameter validation into this call */
-    return KDirectoryOpenArcDirRead_silent_preopened ( self, sra_dir, false, full, tocKFile,
-        ( void* ) f, KArcParseSRAUnbounded_silent, NULL, NULL );
-}
-
-
-LIB_EXPORT rc_t CC KDirectoryOpenSraArchiveReadUnbounded_silent_preopened ( struct KDirectory const *self,
-    struct KDirectory const **sra_dir, int chroot, const struct KFile * f, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDirectoryVOpenSraArchiveReadUnbounded_silent_preopened ( self, sra_dir, chroot, f, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC KDirectoryVOpenSraArchiveReadUnbounded ( struct KDirectory const *self,
-    struct KDirectory const **sra_dir, int chroot, const char *path, va_list args )
-{
-    /* respond properly to va_list */
-    char full [ 4096 ];
-    int len = vsnprintf ( full, sizeof full, path, args );
-    if ( len < 0 )
-        return RC ( rcFS, rcDirectory, rcOpening, rcPath, rcExcessive );
-
-    /* putting off parameter validation into this call */
-    return KDirectoryOpenArcDirRead (self, sra_dir, false, full, tocKFile,
-                                     KArcParseSRAUnbounded, NULL, NULL);
-}
-
-
-LIB_EXPORT rc_t CC KDirectoryOpenSraArchiveReadUnbounded ( struct KDirectory const *self,
-    struct KDirectory const **sra_dir, int chroot, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDirectoryVOpenSraArchiveReadUnbounded (self, sra_dir, chroot, path, args);
-    va_end ( args );
-
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC KFileIsSRA (const char * b, size_t z)
-{
-    const KSraHeader * h = (const KSraHeader *)b;
-
-    if (SraHeaderValidate (h, NULL, NULL, z) == 0)
-        return 0;
-    
-    return RC (rcFS, rcFile, rcIdentifying, rcBuffer, rcWrongType);
-}
-
-/* end of file */
diff --git a/libs/kfs/subfile.c b/libs/kfs/subfile.c
deleted file mode 100644
index 4a3525d..0000000
--- a/libs/kfs/subfile.c
+++ /dev/null
@@ -1,337 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-#include <kfs/extern.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <kfs/file.h>
-#include <kfs/subfile.h>
-#include <sysalloc.h>
-
-#include <assert.h>
-#include <stdlib.h>
-
-/* ======================================================================
- * KSubFile
- *  a file inside an archive
- */
-
-/* -----
- * define the specific types to be used in the templatish/inheritancish
- * definition of vtables and their elements
- */
-#define KFILE_IMPL struct KSubFile
-#include <kfs/impl.h>
-
-static rc_t CC KSubFileDestroy (KSubFile *self);
-static struct KSysFile *CC KSubFileGetSysFile (const KSubFile *self,
-					    uint64_t *offset);
-static rc_t CC KSubFileRandomAccess (const KSubFile *self);
-static uint32_t CC KSubFileType (const KSubFile *self);
-static rc_t CC KSubFileSize (const KSubFile *self, uint64_t *size);
-static rc_t CC KSubFileSetSize (KSubFile *self, uint64_t size);
-static rc_t CC KSubFileRead (const KSubFile *self, uint64_t pos,
-			  void *buffer, size_t bsize, size_t *num_read);
-static rc_t CC KSubFileWrite (KSubFile *self, uint64_t pos, const void *buffer,
-			   size_t size, size_t *num_writ);
-
-
-static const KFile_vt_v1 vtKSubFile =
-{
-    /* version */
-    1, 1,
-
-    /* 1.0 */
-    KSubFileDestroy,
-    KSubFileGetSysFile,
-    KSubFileRandomAccess,
-    KSubFileSize,
-    KSubFileSetSize,
-    KSubFileRead,
-    KSubFileWrite,
-
-    /* 1.1 */
-    KSubFileType
-};
-
-/*-----------------------------------------------------------------------
- * KSubFile
- *  an archive file including tar and sra
- */
-struct KSubFile
-{
-    KFile	dad;
-    uint64_t	start;
-    uint64_t	size;
-    KFile *	original;
-};
-
-/* ----------------------------------------------------------------------
- * KSubFileMake
- *  create a new file object
- */
-
-static
-rc_t KSubFileMake (KSubFile ** self,
-		   KFile * original,
-		   uint64_t start,
-		   uint64_t size,
-		   bool read_enabled,
-		   bool write_enabled)
-{
-    rc_t	rc;
-    KSubFile *	pF;
-
-    /* -----
-     */
-    assert (self != NULL);
-    assert (original != NULL);
-/*     assert (start >= size); */
-
-    /* -----
-     * the enables should be true or false
-     */
-    assert ((read_enabled == true)||(read_enabled == false));
-    assert ((write_enabled == true)||(write_enabled == false));
-
-    /* -----
-     * get space for the object
-     */
-    pF = malloc (sizeof (KSubFile));
-    if (pF == NULL)	/* allocation failed */
-    {
-        /* fail */
-        rc = RC (rcFS, rcFile, rcConstructing, rcMemory, rcExhausted);
-    }
-    else
-    {
-        rc = KFileInit (&pF->dad,			/* initialize base class */
-            (const KFile_vt*)&vtKSubFile, 	/* VTable for KSubFile */
-            "KSubFile", "no-name",
-                        read_enabled,		/* read allowed */
-                        write_enabled);		/* write disallowed */
-	if (rc == 0)
-	{
-	    KFileAddRef (original);
-	    /* succeed */
-	    pF->original = original;
-	    pF->start = start;
-	    pF->size = size;
-	    *self = pF;
-	    return 0;
-	}
-	/* fail */
-	free (pF);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KFileMakeSubRead (const KFile ** self, const KFile * original, uint64_t start, uint64_t size)
-{
-    return KSubFileMake ((KSubFile **)self, (KFile*)original, start, size,
-			 true, false);
-}
-
-LIB_EXPORT rc_t CC KFileMakeSubUpdate (KFile ** self, KFile * original, uint64_t start, uint64_t size)
-{
-    return KSubFileMake ((KSubFile **)self, original, start, size,
-			 true, true);
-}
-
-/* ----------------------------------------------------------------------
- * Destroy
- *
- */
-static
-rc_t CC KSubFileDestroy (KSubFile *self)
-{
-    assert (self != NULL);
-    KFileRelease (self->original);
-    free (self);
-    return 0;
-}
-
-/* ----------------------------------------------------------------------
- * GetSysFile
- *  returns an underlying system file object
- *  and starting offset to contiguous region
- *  suitable for memory mapping, or NULL if
- *  no such file is available.
- *
- * We cant allow memory mapping a tee file as the read?writes ar needed
- * to trigger the writes to the copy KFile
- */
-
-static
-struct KSysFile *CC KSubFileGetSysFile (const KSubFile *self, uint64_t *offset)
-{
-    /* parameters must be non-NULL */
-    assert (self != NULL);
-    assert (offset != NULL);
-
-    /* not implmenting at this time */
-    return NULL;
-}
-
-/* ----------------------------------------------------------------------
- * RandomAccess
- *
- *  returns 0 if random access, error code otherwise
- *
- * Update needs to be able to seek both original and copy while read
- * only needs to be able to seek the original.
- */
-static
-rc_t CC KSubFileRandomAccess (const KSubFile *self)
-{
-    assert (self != NULL);
-    return KFileRandomAccess (self->original);
-}
-
-/* ----------------------------------------------------------------------
- * Type
- *  returns a KFileDesc
- *  not intended to be a content type,
- *  but rather an implementation class
- */
-static
-uint32_t CC KSubFileType (const KSubFile *self)
-{
-    return KFileType (self->original);
-}
-
-
-/* ----------------------------------------------------------------------
- * Size
- *  returns size in bytes of file
- *
- *  "size" [ OUT ] - return parameter for file size
- */
-static
-rc_t CC KSubFileSize (const KSubFile *self, uint64_t *size)
-{
-    assert (self != NULL);
-    assert (size != NULL);
-
-    *size = self->size;
-
-    return 0;;
-}
-
-/* ----------------------------------------------------------------------
- * SetSize
- *  sets size in bytes of file
- *
- *  "size" [ IN ] - new file size
- */
-static
-rc_t CC KSubFileSetSize (KSubFile *self, uint64_t size)
-{
-    return RC (rcFS, rcFile, rcUpdating, rcSelf, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * Read
- *  read file from known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually read
- */
-static
-rc_t CC KSubFileRead	(const KSubFile *self,
-			 uint64_t pos,
-			 void *buffer,
-			 size_t bsize,
-			 size_t *num_read)
-{
-    size_t	request;
-    rc_t	rc;
-
-
-    /* -----
-     * self and buffer were validated as not NULL before calling here
-     *
-     * So get the KTTOCNode type: chunked files and contiguous files 
-     * are read differently.
-     */
-    assert (self != NULL);
-    assert (buffer != NULL);
-    assert (num_read != NULL);
-
-    *num_read = 0;
-    if (pos >= self->size)
-    {
-	return 0;
-    }
-    if ((pos + bsize) <= self->size)
-	request = bsize;
-    else
-	request = (size_t)(self->size - pos);
-
-    rc = KFileRead (self->original, self->start + pos, buffer, request, num_read);
-    return rc;
-}
-
-/* ----------------------------------------------------------------------
- * Write
- *  write file at known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ IN ] and "size" [ IN ] - data to be written
- *
- *  "num_writ" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually written
- *
- * Unsupported as we now treat archives as READ ONLY
- */
-static
-rc_t CC KSubFileWrite (KSubFile *self, uint64_t pos,
-		       const void *buffer, size_t bsize,
-		       size_t *num_writ)
-{
-    size_t to_write;
-
-    assert (self != NULL);
-    assert (buffer != NULL);
-    assert (num_writ != NULL);
-
-    *num_writ = 0;
-    if (pos >= ( uint64_t ) self->size)
-        return 0;
-
-    to_write = bsize;
-    if ((pos + bsize) > self->size)
-        to_write = ( uint64_t ) self -> size - pos;
-
-    return KFileWrite (self->original, self->start + pos, buffer, to_write, num_writ);
-}
-
-/* end of file subfile.c */
-
diff --git a/libs/kfs/tar.c b/libs/kfs/tar.c
deleted file mode 100644
index a13da1e..0000000
--- a/libs/kfs/tar.c
+++ /dev/null
@@ -1,2639 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#define HANDLING_EXTENDED_HEADERS 0
-
-#include <kfs/extern.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <kfs/file.h>
-#include <kfs/mmap.h>
-#include <kfs/arc.h>
-#include <kfs/toc.h>
-#include <kfs/tar.h>
-#include <klib/log.h>
-#include <klib/debug.h>
-
-#include "toc-priv.h"
-#include <os-native.h>
-#include <sysalloc.h>
-#include <strtol.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h> /* temporary for development */
-
-#include <limits.h>
-/* #include <sys/types.h> */
-
-#ifdef _DEBUGGING
-#define FUNC_ENTRY() DBGMSG (DBG_KFS, DBG_FLAG(DBG_KFS_TARENTRY), ("Enter: %s\n", __func__))
-#define TAR_DEBUG(msg) DBGMSG (DBG_KFS, DBG_FLAG(DBG_KFS_TAR), msg)
-#else
-#define FUNC_ENTRY()
-#define TAR_DEBUG(msg)
-#endif
-
-/* -----
- * offset of is the count of bytes between the base of a structure and 
- * a particular member of that structure
- */
-#ifndef OFFSET_OF
-#define	OFFSET_OF(structure,member) ((size_t)((&(((structure*)0)->member))-(0)))
-#endif
-
-/* -----
- * Hide any definition of sun that might have come from sun compilers
- * or the like
- */
-#undef sun
-#undef SUN
-
-
-#define PASTE_2(a,b)   a##b
-#define PASTE_3(a,b,c) a##b##c
-#define STRINGIFY(a)   #a
-
-
-/* ======================================================================
- * return an ASCII string that describes a header type
- *
- * Needs to match tar_header_type_enum.
- */
-#if _DEBUGGING
-static const char * get_bool_string (bool b)
-{
-    switch (b)
-    {
-    case true:
-	return "true";
-    case false:
-	return "false";
-    default:
-	return "not-false";
-    }
-}
-#endif
-
-
-/* ======================================================================
- * Header format structures
- *
- * Tar (tape archiver) started possibly as a unix utility in BSD rivalling
- * the cpio from the AT&T System III.  The exact derivation is unimportant
- * and some names might be slightly misleading based on historical 
- * inaccuracies but successful implmentation is not dependant on such 
- * accuracy in historical trivia but rather on accuracy in technical details.
- *
- * Posix attempted to standardize the growingly divergent variants of tar
- * but it has led to only slightly more standardized variants with vaguely
- * compatible extensions.
- *
- * For the purposes of this implmentation we will refer to the known to the
- * author versions of tar and include the tar like aspects of the posix pax 
- * replacement for tar.
- *
- * Cpio support could be added if desired with only some difficulty.
- *
- * Supported known variants for this implmentation will be:
- * 	V7 	- the oldest known common base defitions for a tar header
- *		   block ( possibly from Unix V7?)
- *    	POSIX	- Posix.1-1988 initial restandardization of a header block
- *		  This versio introduced the ustar name for a tar header
- *		  and includes that term as a "magic" constant.
- *	PAX	- Posix.1.2001 headers for pax a tar derivative that us a
- *		  peaceful attempt to unify the tar and cpio formats apparently.
- *		  It isn't different than POSIX in the ustar block but instead
- *		  is an introduction of two new values of a link field in the
- *		  tar header that defines what comes next (see headers defined
- *		  below).
- *	SUN	- an extension to the POSIX tar header format from SunOS 5
- *	STAR 85	- pre-POSIX extensions to tar from Heorg Schilling (ask him its
- *		  the bestest most greatest tar until STAR94)
- *	STAR 94	- A redo of star based on the POSIX ustar tar header.  A less
- *		  broken than most implmentation of a POSIX/ustar tar header
- *		  based tar. Schilling says its the only real implmentation of
- *		  a ustar based tar but it isn't fully compliant by design.
- *	GNU 89	- a selected variant of tar from FSF/GNU that is a broken 
- *		  implementation of a POSIX/ustar header based tar.
- *	GNU 01	- A slight redo of the FSF/GNU tar format.  There are actually
- *		  evolving variants all of which are still somewhat broken
- *		  implementations of a ustar based tar header format.
- *
- * Along with these variants of a tar/ustar semi-standard tar header there are
- * other header blocks and other significant blocks that are also tracked in
- * this implmentation of a tar reader.
- *	ZERO BLOCK - a block of 512 zero bytes that is supposed to be padding at
- *		  the end of a tar file to meet some super blocksize.  Based on
- *		  where it fits in it would be found when looking for a header
- *		  for the next file included in a tar archive.
- *	RAW	- a convention to mean a header block of a type that has not been 
- *		  determined.
- */
-#define TYPES() \
-    type_(UNDEFINED) type_(ZERO_BLOCK) type_(CPIO) type_(V7) type_(POSIX) \
-        type_(SUN) type_(STAR_85) type_(STAR_94)  type_(GNU_89) type_(SPARSE)
-
-
-#define type_(e) PASTE_2(TAR_,e),
-
-typedef enum tar_header_type
-{
-    TYPES()
-    TAR_TYPE_COUNT
-} tar_header_type;
-
-#undef type_
-#define type_(e) STRINGIFY(e),
-static const char *	get_type_string(tar_header_type t)
-{
-    static const char * type_error = "Error";
-    static const char * type_strings[] = 
-        {
-            TYPES()
-        };
-    if ((t < 0) || (t >= TAR_TYPE_COUNT))
-	return type_error;
-    return type_strings[t];
-}
-#undef type_
-#undef TYPES
-
-
-/* =============================================================================
- * Tar headers are almost ASCII based but definitely byte/octet based so all
- * elements are best defined as arrays of char and use casts to signed and unsigned
- * where appropriate in interpretation..
- * 
- * All Tar files or streams are divided into blocks of 512 bytes
- * This is significant in the file data in that the last block 
- * of a file is supposed to be padded with NUL to fill out a block
- * and then be followed by two blocks of all NUL bytes.
- * headers are also 512 bytes with various but fairly consistent 
- * interpretations of what is where with in that block
- *
- * Most tar utilities further define super blocks consisting of a number of blocks
- * typically 10 of them for a length of 5120 bytes.  This is irrelevant for this
- * implmentation.  By definition a tar file ends with two "zero blocks" and enough
- * more after that to fill one of these super blocks.  We ignore all aspects of 
- * this.
- */
-#define TAR_BLOCK_SIZE		(512)
-typedef char tar_raw_block [TAR_BLOCK_SIZE];
-#define BLOCKS_FOR_BYTES(byte_count)	((byte_count+TAR_BLOCK_SIZE-1)/TAR_BLOCK_SIZE)
-
-/* --------------------------------------------------------------------------------
- * lengths of various tar header fields
- */
-
-/* --------------------
- * Tar file names are always 100 bytes long and include preceding 
- * path names.  The utilities do not precluded paths that put the 
- * files outside of the "base" where the tar file was created.
- *
- * To handle tar files made by older tar utilities if the last 
- * character is '/' then the file should be assumed to be a directory.
- *
- * This 'type' is used for both the name of the object being archived
- * and the link target if it is a hard or soft link.
- */
-#define	TAR_NAME_LEN		(100)
-typedef char	tar_file_name	[TAR_NAME_LEN];
-
-/* --------------------
- * Tar mode strings are always 8 bytes long.
- *
- * 9 file access permissions bits and three execution mode bits.
- *
- * Zero '0' not NUL pre-fill unused bytes.  a user permision of 0644 would be stored as
- * "0000644" with a NUL terminator.
- *
- * The format is 7 octal ASCII bytes with only the last 4 being 
- * significant.  That is the first three are always '0'.  The 8th 
- * byte is NUL.
- *
- * Older utilities might put preceding ' ' characters or
- * instead of pre-fill have post fill ' ' or NUL.
- */
-#define TAR_MODE_LEN		(8)
-typedef char	tar_file_mode	[TAR_MODE_LEN];
-/* -----
- * These are the bits if the mode is in binary (octal defines for ease of interpretation)
- * they match the st_mode field from the stat()/fstat() struct stat.
- *
- * GNU tar puts the file type bits from the stat structure in the mode of the tar file.
- * Other tar implmentations might as well though no where is this dktefined as required or
- * recommended or even supported.
- */
-#define	TAR_SUID_BIT	(04000)	/* set UID on execution */
-#define	TAR_GUID_BIT	(02000)	/* set GID on execution */
-#define	TAR_STICKY_BIT	(01000)	/* save text / sticky bit */
-/* file permissions */
-#define	TAR_MODE_OREAD	(00400)	/* read by owner */
-#define	TAR_MODE_OWRITE	(00200)	/* write by owner */
-#define	TAR_MODE_OEXEC	(00100)	/* execute by owner */
-#define	TAR_MODE_GREAD	(00040)	/* read by group */
-#define	TAR_MODE_GWRITE	(00020)	/* write by group */
-#define	TAR_MODE_GEXEC	(00010)	/* execute by group */
-#define	TAR_MODE_WREAD	(00004)	/* read by other */
-#define	TAR_MODE_WWRITE	(00002)	/* write by other */
-#define	TAR_MODE_WEXEC	(00001)	/* execute by other */
-
-/* -----
- * These are the bits once converted into ASCII
- * with in an ASCII byte these bits are actually usable so no conversion needed
- * '0' = 0x30 / 060
- * '1' = 0x31 / 061
- * '2' = 0x32 / 062
- * '3' = 0x33 / 063
- * '4' = 0x34 / 064
- * '5' = 0x35 / 065
- * '6' = 0x36 / 066
- * '7' = 0x37 / 067
- */
-#define	TAR_MODE_READ		(0x01)
-#define	TAR_MODE_WRITE		(0x02)
-#define	TAR_MODE_EXEC		(0x04)
-#define TAR_MODE_STICKY		(0x01)
-#define TAR_MODE_GUID		(0x02)
-#define TAR_MODE_SUID		(0x04)
-#define	TAR_MODE_OWNER_BYTE	(6)
-#define	TAR_MODE_GROUP_BYTE	(5)
-#define	TAR_MODE_WORLD_BYTE	(4)
-#define	TAR_MODE_USER_BYTE	(3)
-#define	TAR_MODE_EXEC_BYTE	(2)
-
-/* --------------------
- * Tar user (and group) numeric IDs are put into 8 bytes.
- *
- * There is a '0' prefill and as terminating NUL.
- *
- * Older utilities might put preceding ' ' characters or
- * instead of pre-fill have post fill ' ' or NUL.
- */
-#define TAR_ID_LEN		(8)
-typedef	char	tar_id		[TAR_ID_LEN];
-
-/* --------------------
- * Tar file size elements are 12 bytes long with 11 used
- * for octal characters making the maximum size of a file
- * for pure classic or Posix tar limited to 8 GBytes.  
- * Various tar utilities handle longer files in different
- * ways if at all.
- *
- * A length of 100 bytes would be stored as "00000000144".
- *
- * Links and some other special values are archived with a
- * length of zero and thus no data blocks.
- *
- * There is a '0' prefill and as terminating NUL.
- *
- * Older utilities might put preceding ' ' characters or
- * instead of pre-fill have post fill ' ' or NUL.
- *
- * GNU tar implmentations use alternative intrpretatopms of
- * this and possibly other fields using mime base 64 or
- * base 256 (big endian nonstandard sized binary)
- */
-#define	TAR_SIZE_LEN		(12)
-typedef char	tar_size	[TAR_SIZE_LEN];
-#define MAX_TAR_FILE_SIZE	(077777777777)
-
-/* --------------------
- * Tar file modification/access/creation times are 12 bytes
- * long.  This holds 11 octal ASCII digits representing the
- * number of seconds since 01/01/1970 00:00 UTC.
- *
- * There is a '0' prefill and as terminating NUL.
- *
- * Older utilities might put preceding ' ' characters or
- * instead of pre-fill have post fill ' ' or NUL.
- */
-#define TAR_TIME_LEN		(12)
-typedef	char	tar_time	[TAR_TIME_LEN];
-
-/* --------------------
- * Tar has a weak checksum protection of part of the tar header
- * that is 8 bytes long and again uses 7 ASCII octal digits.
- *
- * There is a '0' prefill and as terminating NUL.
- *
- * Older utilities might put preceding ' ' characters or
- * instead of pre-fill have post fill ' ' or NUL.
- */
-#define TAR_CSUM_LEN		(8)
-typedef	char	tar_csum	[TAR_CSUM_LEN];
-#define	csum_blanks		("       ")
-
-/* --------------------
- * The tar link is a single byte that expresses the type of file
- * or special value represented by this entry.
- */
-typedef	char	tar_link;
-
-#define LINKS()                   \
-    link_('\0',OLDNORMAL_FILE)    \
-    link_('0',NORMAL_FILE)        \
-    link_('1',HARD_LINK)          \
-    link_('2',SYMBOLIC_LINK)      \
-    link_('3',CHARACTER_SPECIAL)  \
-    link_('4',BLOCK_SPECIAL)      \
-    link_('5',DIRECTORY)          \
-    link_('6',FIFO)               \
-    link_('7',CONTIGUOUS_FILE)    \
-    link_('A',SOLARIS_ACL)        \
-    link_('D',GNU_DUMPDIR)        \
-    link_('E',SOLARIS_ACL_FILE)   \
-    link_('I',INODE_METADATA)     \
-    link_('K',NEXT_LONG_LINK)     \
-    link_('L',NEXT_LONG_NAME)     \
-    link_('M',MULTI_VOLUME)       \
-    link_('N',GNU1989_LONG_NAMES) \
-    link_('S',SPARSE)             \
-    link_('V',VOLUME_NAME)        \
-    link_('X',SUN_XHDR)           \
-    link_('g',PAX_GLOBAL_XHDR)    \
-    link_('x',PAX_XHDR)
-
-#define link_(v,n)      PASTE_2(LINK_,n) = v,
-
-/* LINK_COUNT is a count not a mac value */
-enum e_tar_link
-{
-    LINKS()
-    LINK_COUNT
-};
-#undef link_
-
-#if _DEBUGGING
-#define link_(v,n) {STRINGIFY(n), v},
-struct nv_pair
-{
-    const char * name;
-    tar_link  link;
-};
-static const char * get_link_string(tar_link l)
-{
-    static const struct nv_pair pairs[] = 
-        {
-            LINKS()
-            {NULL, 0}
-        };
-    unsigned int ix;
-
-    for (ix = 0; pairs[ix].name != NULL; ++ix)
-        if (pairs[ix].link == l)
-            return pairs[ix].name;
-    return "UNDEFINED";
-}
-#undef link_
-#endif
-#undef LINKS
-
-
-/* --------------------
- * The tar magic string is 6 bytes long.
- */
-#define	TAR_MAGIC_LEN		(6)
-typedef char	tar_magic	[TAR_MAGIC_LEN];
-#define	POSIX_MAGIC_CONST	"ustar"		/* includes terminating NUL */
-
-/* --------------------
- * The tar version string is two bytes long and uses both bytes
- */
-#define	TAR_VERSION_LEN		(2)
-typedef	char	tar_version	[TAR_VERSION_LEN];
-#define	POSIX_VERSION_CONST	"00"		/* does not include terminating NUL */
-
-/* --------------------
- * The Posix strong user/group name is 32 bytes long
- */
-#define TAR_STRNAME_LEN		(32)
-typedef	char	tar_strname	[TAR_STRNAME_LEN];
-
-/* --------------------
- * The dev? strings are 8 bytes long
- */
-#define	TAR_DEV_LEN		(8)
-typedef	char	tar_dev		[TAR_DEV_LEN];
-
-/* --------------------
- * Posix prefix is 155 bytes that can be put before the name to give a path of
- * 255 bytes instad of the smaller limit of 99.
- */
-#define	TAR_PREFIX_LEN		(155)
-typedef	char	tar_prefix	[TAR_PREFIX_LEN];
-
-/*
- * Sun extensions
- */
-
-/* --------------------
- */
-typedef	char sun_extnum;
-#define	SUN_FULLSIZE_LEN	(10)
-typedef	char	sun_fullsize	[SUN_FULLSIZE_LEN];
-
-/* --------------------
- * star extensions
- *
- * star85 is old star from 1985
- */
-typedef	char	star85_version;
-#define	STAR85_FILETYPE_LEN	(8)
-typedef char	star85_filetype	[STAR85_FILETYPE_LEN];
-#define	STAR85_TYPE_LEN		(12)
-typedef	char	star85_type	[STAR85_TYPE_LEN];
-#define	STAR85_RDEV_LEN		(12)
-typedef	char	star85_rdev	[STAR85_RDEV_LEN];
-/* ignoring the 11 byte rdev with minor bits */
-#define	STAR85_UNAME_LEN	(16)
-typedef	char	star85_uname	[STAR85_UNAME_LEN];
-#define	STAR85_GNAME_LEN	(15)
-typedef	char	star85_gname	[STAR85_GNAME_LEN];
-#define	STAR_XMAGIC_LEN		(4)
-typedef	char	star_magic	[STAR_XMAGIC_LEN];
-#define	STAR_MAGIC_CONST	("tar")
-#define	NSTAR_PREFIX_LEN	(1)
-typedef	char	nstar_prefix	[NSTAR_PREFIX_LEN];
-
-/* --------------------
- * gnu extensions
- */
-#define	GNU89_MAGIC_LEN		(8)
-typedef	char	gnu89_magic	[GNU89_MAGIC_LEN];
-#define	GNU_89_MAGIC_CONST	"ustar  "		/* includes terminating NUL */
-#define	GNU_89_GNUMAGIC_CONST	"GNUtar "		/* includes terminating NUL */
-#define GNU89_LONGNAMES_LEN	(4)
-typedef char	gnu89_longnames	[GNU89_LONGNAMES_LEN];
-
-
-/* --------------------
- * shared between the feuding star and gnu tar
- */
-typedef	char	tar_isextended ;
-typedef struct	tar_sparse
-{
-    tar_size	offset;
-    tar_size	num_bytes;
-} tar_sparse;
-#define	GNU_SPARSES_IN_EXTRA_HEADER		(16)
-#define	GNU_SPARSES_IN_OLD_HEADER		(4)
-#define	GNU_SPARSES_IN_SPARSE_HEADER		(21)
-#define	STAR_SPARSES_IN_HEADER			(4)
-#define	STAR_SPARSES_IN_EXT_HEADER		(21)
-
-
-/* ----------------------------------------
- * The various tar header formats
- *
- * Note that in all the tar, posix and pax formats the first 257 bytes are
- * the same.  In all posix ad almost compliant formats the first
- * 345 bytes are the same (except GNU 89).  It is abuse of the 155
- * bytes of the prefix that make star and gnu truly not posix compliant
- * Sun used the 12 bytes after the prefix so is still psox compliant.
- */
-typedef	struct	tar_v7_header
-{
-    /* type		member name			 and offset */
-    tar_file_name	name;				/*   0 */
-    tar_file_mode	mode;				/* 100 */
-    tar_id		uid;				/* 108 */
-    tar_id		gid;				/* 116 */
-    tar_size		size;				/* 124 */
-    tar_time		mtime;				/* 136 */
-    tar_csum		csum;				/* 148 */
-    tar_link		link;				/* 156 */
-    tar_file_name	linkname;			/* 157 */
-    /* end of header					// 257 */
-} tar_v7_header;
-
-typedef struct tar_posix_header
-{
-    /* type		member name			 and offset */
-    tar_file_name	name;				/*   0 */
-    tar_file_mode	mode;				/* 100 */
-    tar_id		uid;				/* 108 */
-    tar_id		gid;				/* 116 */
-    tar_size		size;				/* 124 */
-    tar_time		mtime;				/* 136 */
-    tar_csum		csum;				/* 148 */
-    tar_link		link;				/* 156 */
-    tar_file_name	linkname;			/* 157 */
-    tar_magic		magic;				/* 257 */
-    tar_version		version;			/* 263 */
-    tar_strname		uname;				/* 265 */
-    tar_strname		gname;				/* 297 */
-    tar_dev		devmajor;			/* 329 */
-    tar_dev		devminor;			/* 337 */
-    tar_prefix		prefix;				/* 345 */
-    /* end of header					// 500 */
-} tar_posix_header, tar_pax_header;
-
-typedef struct tar_sun_header
-{
-    /* type		member name			 and offset */
-    tar_file_name	name;				/*   0 */
-    tar_file_mode	mode;				/* 100 */
-    tar_id		uid;				/* 108 */
-    tar_id		gid;				/* 116 */
-    tar_size		size;				/* 124 */
-    tar_time		mtime;				/* 136 */
-    tar_csum		csum;				/* 148 */
-    tar_link		link;				/* 156 */
-    tar_file_name	linkname;			/* 157 */
-    tar_magic		magic;				/* 257 */
-    tar_version		version;			/* 263 */
-    tar_strname		uname;				/* 265 */
-    tar_strname		gname;				/* 297 */
-    tar_dev		devmajor;			/* 329 */
-    tar_dev		devminor;			/* 337 */
-    tar_prefix		prefix;				/* 345 */
-    sun_extnum		extnum;				/* 500 non-conformant */
-    sun_extnum		extcount;			/* 501 non-conformant */
-    sun_fullsize	fullsize;			/* 502 non-conformant */
-    /* end of header					// 512 non-conformant */
-} tar_sun_header;
-
-typedef struct tar_star_85_header
-{
-    /* type		member name			 and offset */
-    tar_file_name	name;				/*   0 */
-    tar_file_mode	mode;				/* 100 */
-    tar_id		uid;				/* 108 */
-    tar_id		gid;				/* 116 */
-    tar_size		size;				/* 124 */
-    tar_time		mtime;				/* 136 */
-    tar_csum		csum;				/* 148 */
-    tar_link		link;				/* 156 */
-    tar_file_name	linkname;			/* 157 */
-    star85_version	starversion;			/* 257 non-conformant */
-    star85_filetype	starfiletype;			/* 258 internal type of file? non-conformant */
-    star85_type		startype;			/* 266 type of file (UNIX)? non-conformant */
-    star85_rdev		rdev;				/* 278 non-conformant */
-    tar_time		atime;				/* 290 non-conformant */
-    tar_time		ctime;				/* 302 non-conformant */
-    star85_uname	uname;				/* 314 non-conformant */
-    star85_gname	gname;				/* 330 non-conformant */
-    tar_prefix		prefix;				/* 345 non-conformant */
-    char		___fill0[8];			/* 500 non-conformant */
-    star_magic		xmagic;				/* 508 non-conformant */
-    /* end of header					// 512 non-conformant */
-} tar_star_85_header;
-typedef struct tar_star_94_header
-{
-    /* type		member name			 and offset */
-    tar_file_name	name;				/*   0 */
-    tar_file_mode	mode;				/* 100 */
-    tar_id		uid;				/* 108 */
-    tar_id		gid;				/* 116 */
-    tar_size		size;				/* 124 */
-    tar_time		mtime;				/* 136 */
-    tar_csum		csum;				/* 148 */
-    tar_link		link;				/* 156 */
-    tar_file_name	linkname;			/* 157 */
-    tar_magic		magic;				/* 257 */
-    tar_version		version;			/* 263 */
-    tar_strname		uname;				/* 265 */
-    tar_strname		gname;				/* 297 */
-    tar_dev		devmajor;			/* 329 */
-    tar_dev		devminor;			/* 337 */
-    nstar_prefix	prefix;				/* 345 */
-    char		___fill0;			/* 346 */
-    char		___fill1[8];			/* 347 */
-    tar_isextended	isextended;			/* 355 non-conformant */
-    tar_sparse 		sparse[STAR_SPARSES_IN_HEADER];	/* 356 non-conformant */
-    tar_size		realsize;			/* 452 non-conformant */
-    tar_size		offset;				/* 464 non-conformant */
-    tar_time		atime;				/* 476 non-conformant */
-    tar_time		ctime;				/* 488 non-conformant */
-    char		___fill2[8];			/* 500 */
-    star_magic		xmagic;				/* 508 non-conformant */
-    /* end of header					// 512 */
-} tar_star_94_header;
-
-typedef struct tar_gnu_89_header
-{
-    /* type		member name			 and offset */
-    tar_file_name	name;				/*   0 */
-    tar_file_mode	mode;				/* 100 */
-    tar_id		uid;				/* 108 */
-    tar_id		gid;				/* 116 */
-    tar_size		size;				/* 124 */
-    tar_time		mtime;				/* 136 */
-    tar_csum		csum;				/* 148 */
-    tar_link		link;				/* 156 */
-    tar_file_name	linkname;			/* 157 */
-    gnu89_magic		magic;				/* 257 non-conformant */
-    tar_strname		uname;				/* 265 */
-    tar_strname		gname;				/* 297 */
-    tar_dev		devmajor;			/* 329 */
-    tar_dev		devminor;			/* 337 */
-    tar_time		atime;				/* 345 non-conformant */
-    tar_time		ctime;				/* 357 non-conformant */
-    tar_size		offset;				/* 369 non-conformant */
-    gnu89_longnames	longnames;			/* 381 non-conformant */
-    char		___fill0[1];			/* 385 */
-    tar_sparse		sparse	[GNU_SPARSES_IN_OLD_HEADER];/* 386 optional sparse */
-    tar_isextended	isextended;			/* 482 non-conformant */
-    tar_size		realsize;			/* 483 non-conformant */
-    /* end of header					// 495 */
-} tar_gnu_89_header;
-
-typedef struct tar_gnu_99_header
-{
-    /* type		member name			 and offset */
-    tar_file_name	name;				/*   0 */
-    tar_file_mode	mode;				/* 100 */
-    tar_id		uid;				/* 108 */
-    tar_id		gid;				/* 116 */
-    tar_size		size;				/* 124 */
-    tar_time		mtime;				/* 136 */
-    tar_csum		csum;				/* 148 */
-    tar_link		link;				/* 156 */
-    tar_file_name	linkname;			/* 157 */
-    gnu89_magic		magic;				/* 257 non-conformant */
-    tar_strname		uname;				/* 265 */
-    tar_strname		gname;				/* 297 */
-    tar_dev		devmajor;			/* 329 */
-    tar_dev		devminor;			/* 337 */
-    tar_time		atime;				/* 345 non-conformant */
-    tar_time		ctime;				/* 357 non-conformant */
-    tar_size		offset;				/* 369 non-conformant */
-    gnu89_longnames	longnames;			/* 381 non-conformant */
-    char		___fill0[1];			/* 385 */
-    tar_sparse		sparse	[GNU_SPARSES_IN_OLD_HEADER];/* 386 non-conformant optional sparse */
-    tar_isextended	isextended;			/* 482 non-conformant */
-    tar_size		realsize;			/* 483 non-conformant */
-    /* end of header					// 495 */
-} tar_gnu_99_header;
-
-typedef struct tar_sparse_header
-{
-    /* type		member name			 and offset */
-    tar_sparse		sparse	[STAR_SPARSES_IN_EXT_HEADER];/* 0 */
-    tar_isextended	isextended;			/* 504 */
-} tar_sparse_header;					/* 505 end of header */
-
-typedef struct tar_cpio_header
-{
-    /* type		member name			 and offset */
-    char		magic		[6];		/*   0	must be "070707" */
-#define	TAR_CPIO_MAGIC_CONST ("070707")
-    char		dev		[6];		/*   6  (dev,ino) is unique for each file in archive */
-    char		ino		[6];		/*  12  see dev */
-    char		mode		[6];		/*  18 */
-    char		uid		[6];		/*  24 */
-    char		gif		[6];		/*  30 */
-    char		nlink		[6];		/*  36 */
-    char		rdev		[6];		/*  42 */
-    char		mtime		[11];		/*  48 */
-    char		namesize	[6];		/*  59 */
-    char		filesize	[6];		/*  65 */
-    char		buff		[1];		/*  71  name and file data */
-} tar_cpio_header;
-
-typedef union tar_header
-{
-    /* ----------
-     * The TAR header is to be zero filled by definition but some tar
-     * programs use ' ' instead.
-     *
-     * accept zeros ('0'), spaces (' ') or NULs (0x00) as equivalent where reasonable
-     *
-     * This name refers to the entire header as a single undifferentiated
-     * sequence of bytes.
-     */
-    tar_raw_block	raw;		/* tar block as an array of bytes: used for 0 blocks here */
-    tar_cpio_header	cpio;		/* cpio not really tar */
-    tar_v7_header	tar;		/* classic header back to the beginnings of memory */
-    tar_posix_header	posix;		/* ustar or Posix 1003.1 header */
-    tar_sun_header	suntar;		/* Sun Microsystems tar header */
-    tar_star_85_header	star_85;	/* star header from 1985 (pre-Posix) */
-    tar_star_94_header	star_94;	/* star header from 1994 (post-Posix) */
-    tar_gnu_89_header	gnu_89;		/* gnu header from circa 1989 (post-posix but broken) */
-    tar_gnu_99_header	gnu_99;         /* gnu header from ???? */
-    tar_sparse_header	sparse;		/* star / gnu extended sparses header */
-} tar_header;
-
-
-/* ======================================================================
- * local module-wide function like macros
- */
-/* -----
- * offset of is the count of bytes between the base of a structure and 
- * a particular member of that structure
- */
-#define	OFFSET_OF(structure,member) ((size_t)((&(((structure*)0)->member))-(0)))
-
-
-/* ======================================================================
- * compilation unit local functions
- */
-
-/* ======================================================================
- * return the RFC 2045 base 64 value for a byte character 
- * -1 for any out of range
- *
- * base 64 uses A-Z as 0-25, a-z as 26-51, 0-9 as 52-61, + as 62 and / as 63
- */
-static int64_t decode_base64char (uint8_t byte)
-{
-    /* 
-     * trade off of space for table versus time to upsize the return
-     * and reupsize where it is used
-     */
-    static const int8_t table[] = 
-	{
-	    /*
-	     * 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
-	     */
-	    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 00 */
-	    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 10 */
-	    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63, /* 20 */
-	    52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1, /* 30 */
-	    -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14, /* 40 */
-	    15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1, /* 50 */
-	    -1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40, /* 60 */
-	    41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1, /* 70 */
-	    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 80 */
-	    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 90 */
-	    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* A0 */
-	    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* B0 */
-	    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* C0 */
-	    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* D0 */
-	    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* E0 */
-	    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1  /* F0 */
-	};
-    return table[byte];
-}
-
-
-/* ======================================================================
- * return the RFC 2045 base 64 value of a string at <str> of length <len>
- *
- * Interpreted the specification to mean that you simply ignore any out
- * of range characters.  They are not treated as bytes of 0 as that would
- * mean a shift of earlier bytes.
- *
- * Each character is 6 bits of the final value.
- */
-static int64_t decode_base64string (const uint8_t* str, size_t len)
-{
-    int64_t 	result = 0;
-    int64_t 	temp = 0;
-    size_t 	ix;
-
-    for (ix = 0; ix < len; ++ix)
-    {
-	if ((temp = decode_base64char(str[ix])) >= 0)
-	{
-	    result <<= 6; /* result *= 64 */
-	    result += temp;
-	}
-    }
-    return result;
-}
-
-
-/* ======================================================================
- * tar_strtoll
- *
- * This function will convert a string in a tar header into a 64 signed
- * integer.
- *
- * The original tar header used just octal numbers in ascii in fixed length
- * fields.  As normal in the computer software world these "obviously plenty
- * big" fields became way too small.
- *
- * GNU tar invented two approaches to make these numeric fields "bigger" but
- * only prolonged the pain by squeezing the new numbers into the same fields.
- *
- * In the tar v7 and ustar based tar headers the fields are:
- *	Name	Size	Octal Range	Interpretation
- *	mode	8	0-2097151 	bit flags
- *	uid	8	0-2097151
- *	gid	8	0-2097151
- *	size	12	0-8589934591	up to 8 Giga-Byte files
- *	mtime	12	0-8589934591 	1970/01/01 00:00:00 GMT-2242/03/16 12:56:31 GMT
- *	
- *	atime	12	0-8589934591 	1970/01/01 00:00:00 GMT-2242/03/16 12:56:31 GMT
- *	ctime	12	0-8589934591 	1970/01/01 00:00:00 GMT-2242/03/16 12:56:31 GMT
- *
- * GNU's first and already obsolete approach was to put Mime base-64 numbers
- * With these the first byte is '+' or '-' to signal it isn't octal ASCII.
- *
- * GNU's second approach is base-256 which is a big endian binary string of lengths other
- * than the 1, 2, 4 or 8 bytes of the standard integer types.  In this approach the first
- * byte is either 0x80 for a positive number or 0xFF for a negative number.
- */
-
-static int64_t tar_strtoll (const uint8_t * str, size_t len)
-{
-    int64_t	result = 0;
-    bool negative = false;
-    uint8_t temp_buff[24];	/* long enough to hold all octal bytes for 64 bit numbers */
-
-    /* -----
-     * force a NUL in case the source doesn't have one; this is for
-     * strtoll() on ASCII Octal
-     */
-    if ( len >= sizeof temp_buff )
-        len = sizeof temp_buff - 1;
-    memcpy (temp_buff, str, len);
-    temp_buff[ len ] = 0x00;
-
-    /* -----
-     * Most are going to be simple ASCII octal using '0'-'7' with NUL terminator
-     * leading 0 is not required but of course is accepted to match tar 
-     * header specifications
-     */
-    if (((temp_buff[0] >= '0')&&(temp_buff[0] <= '7'))||(temp_buff[0] == ' '))
-    {
-        /* use stdlib strtoll - longest expected goes a few bits into the upper longword */
-        result = strtoi64((char*)temp_buff,NULL,8);
-    }
-    /* -----
-     * "base-256" well that is "binary" big endian of some length
-     *
-     * For fields longer than eight bytes upper bytes will shift out of 
-     * significance into the bit bucket.
-     */
-    else if ((temp_buff[0] == 0x80)||(temp_buff[0] == 0xFF)) /* from GNU tar */
-    {
-        unsigned int ix;
-        negative = (bool)((temp_buff[0] == 0xFF) ? true : false);
-        result = temp_buff[0] & 0x7F; /* toss first flag bit */
-        for (ix = 1; ix < len; ++ix)
-        {
-            result <<= 8; /* result *= 256; */
-            result += temp_buff[ix];
-        }
-        if (negative)
-            result = -result;
-    }
-    /* -----
-     * "base-64" an already dumped idea from GNU tar
-     */
-    else if ((temp_buff[0] == '+')||(temp_buff[0] == '-')) /* from GNU tar */
-    {
-        int64_t temp;
-        negative = (bool)((temp_buff[0] == '-') ? true : false);
-        temp = decode_base64string(temp_buff+1,len-1);
-        /* potential overflow */
-        result = negative ? -temp : temp;
-    }
-
-    /* -----
-     * look for an empty field of all NUL
-     */
-    else if (temp_buff[0] == 0x00)
-    {
-        unsigned int ix;
-        for (ix = 1; ix < len; ++ix)
-        {
-            if (temp_buff[ix] != 0x00)
-                goto fail;
-        }
-    }
-    /* -----
-     * no idea what it is then
-     */
-    else
-    {
-    fail:
-        result = 0; /* as good a guess as any */
-        TAR_DEBUG (("%s: unknown integer storage type %c%c%c%c%c%c%c%c\n",
-                    temp_buff[0],temp_buff[1],temp_buff[2],temp_buff[3],
-                    temp_buff[4],temp_buff[5],temp_buff[6],temp_buff[7]));
-        PLOGMSG (klogErr, (klogErr, "unknown integer storage type $(B0)$(B1)$(B2)$(B3)$(B4)$(B5)$(B6)$(B7)",
-                           "B0=%c,B1=%c,B2=%c,B3=%c,B4=%c,B5=%c,B6=%c,B7=%c",
-                           temp_buff[0],temp_buff[1],temp_buff[2],temp_buff[3],
-                           temp_buff[4],temp_buff[5],temp_buff[6],temp_buff[7]));
-    }
-    return result;
-}
-
-
-
-/* ======================================================================
- * tar_header_type
- * determine most probable tar header block type
- */
-static tar_header_type	what_header_type(const tar_header* header)
-{
-    /* -----
-     * we'll assume its bad until we find a better guess
-     */
-    tar_header_type type = TAR_UNDEFINED;
-
-    /* -----
-     * look for a cpio header though we aren't expecting to support it quite yet
-     */
-    if (strncmp(header->cpio.magic, TAR_CPIO_MAGIC_CONST, sizeof(header->cpio.magic)) == 0)
-    {
-	type = TAR_CPIO;
-    }
-    /* -----
-     * look for extended headers of some type
-     *
-     * look for posix based extensions as hopefully most likely
-     */
-    else if (strcmp(header->posix.magic, POSIX_MAGIC_CONST) == 0)
-    {
-	/* -----
-	 * we have a post posix standard tar header but we aren't done yet
-	 *
-	 * First we look for star extensions to the header
-	 */
-	if (strcmp(header->star_94.xmagic, STAR_MAGIC_CONST) == 0)
-	{
-
-	    /* -----
-	     * we have either an old or new star archive
-	     */
-	    if (strcmp(header->star_94.magic, POSIX_MAGIC_CONST) == 0)
-	    {
-		/* -----
-		 * we have a new star type archive
-		 */
-		type = TAR_STAR_94;
-	    }
-	    else
-	    {
-		/* -----
-		 * we have a old star type archive
-		 */
-		type = TAR_STAR_85;
-	    }
-	}
-	/* -----
-	 * Next we look for SunOS5 extensions to the header
-	 */
-	else if (header->suntar.extnum &&
-		 header->suntar.extcount &&
-		 header->suntar.fullsize)
-	{
-	    type = TAR_SUN;
-	}
-	/* -----
-	 * Else it seems to be the generic Posix tar header
-	 */
-	else
-	{
-	    type = TAR_POSIX;
-	}
-    }
-    /* -----
-     * Not a proper magic for a POSIX ustar header so look for the improper magic of GNU's tar
-     */
-    else if (strcmp(header->star_94.magic, GNU_89_MAGIC_CONST) == 0)
-    {
-	/* we have an old GNU not really posix compliant archive type */
-	type = TAR_GNU_89;
-    }
-    /* -----
-     * If there is anything else there we don't know what to do with it
-     */
-    else if (header->posix.magic[0] != 0)
-    {
-	/* -----
-	 * Log an anomaly showing what we found in the magic field
-	 */
-	char temp_str	[9];
-	memset(temp_str,0,sizeof(temp_str));
-	string_copy(temp_str, sizeof(temp_str), header->posix.magic, 8);
-        TAR_DEBUG(("%s: unknown header type magic [%s]\n",
-                   __func__, temp_str));
-	type = TAR_UNDEFINED;
-    }
-    /* -----
-     * not knowing what we have lets see if it is a block of all zeroes
-     * knowing we can ignore it
-     */
-    else
-    {
-	/* -----
-	 * If this were a legitimate V7 (well just old style)
-	 * tar header the first character would be non-NUL
-	 * and the link would be on eof the old types
-	 */
-	if ((header->raw[0]>= ' ')&&(header->raw[0] <= '~'))
-	{
-	    switch (header->tar.link)
-	    {
-	    case LINK_OLDNORMAL_FILE:
-	    case LINK_NORMAL_FILE:
-	    case LINK_HARD_LINK:
-	    case LINK_SYMBOLIC_LINK:
-	    case LINK_CHARACTER_SPECIAL:
-	    case LINK_BLOCK_SPECIAL:
-	    case LINK_DIRECTORY:
-	    case LINK_FIFO:
-	    case LINK_CONTIGUOUS_FILE:
-		/* GNU TAR will do this to us */
-	    case LINK_NEXT_LONG_LINK:
-	    case LINK_NEXT_LONG_NAME:
-	    case LINK_GNU1989_LONG_NAMES:
-		type = TAR_V7;
-		break;
-	    default:
-		break;
-	    }
-	}
-	else
-	{
-	    /* -----
-	     * look for anything not zero
-	     */
-	    unsigned int ix;
-
-	    for (ix = 0; ix < sizeof(tar_header); ++ix)
-	    {
-		if (header->raw[ix])
-		{
-		    /* -----
-		     * non-zero so quit looking
-		     */
-		    break;
-		}
-	    }
-	    /* -----
-	     * if we got to the end we know they are all zero so say so
-	     */
-	    if (ix == sizeof(tar_header))
-	    {
-		type = TAR_ZERO_BLOCK;
-	    }
-	}
-    }
-    TAR_DEBUG (("%s: %s(%d)\n", __func__, get_type_string(type), type));
-    return type;
-}
-
-
-typedef struct sparse_data
-{
-    struct sparse_data*	next;
-    uint64_t		offset;
-    uint64_t		size;
-} sparse_data;
-/* ======================================================================
- */
-
-static rc_t	sparse_data_make (sparse_data ** new_item, uint64_t offset, uint64_t size)
-{
-    sparse_data * p;
-
-    p = malloc (sizeof (sparse_data));
-    if (p != NULL)
-    {
-	p->offset = offset;
-	p->size = size;
-	p->next = NULL;
-	*new_item = p;
-	return 0;
-    }
-    else
-	return -1;
-}
-
-static rc_t	sparse_data_push(sparse_data ** q, uint64_t offset, uint64_t size)
-{
-    if (q == NULL)
-    {
-	return -1;
-    }
-    else if (*q == NULL)
-    {
-	return sparse_data_make (q, offset, size);
-    }
-    else 
-    {
-	return sparse_data_push (&((*q)->next), offset, size);
-    }
-}
-
-static rc_t	sparse_data_pop (sparse_data ** q, sparse_data **item)
-{
-    if ((q == NULL) || (item == NULL))
-    {
-	return -1;
-    }
-    else
-    {
-	*item = *q;
-	*q = (*item)->next;
-	(*item)->next = NULL;
-	return 0;
-    }
-}
-
-static rc_t	sparse_data_kill (sparse_data ** q)
-{
-    if (q == NULL)
-    {
-	return -1;
-    }
-    if (*q == NULL)
-    {
-	return 0;
-    }
-    if ((*q)->next != NULL)
-    {
-	return sparse_data_kill(&(*q)->next);
-    }
-    free (*q);
-    *q = NULL;
-    return 0;
-}
-
-/* ======================================================================
- * local module-wide variables (reduction in parameter pushing)
- *
- * Module shared variables; kinda like C++ class elements
- */
-typedef struct KTarState
-{
-    /* TODO: optimize chunk/sparse lists by counting as pushed */
-    const KFile *	kfile;		/* KFS reference to the specific file being parsed */
-    const KMMap *	kmmap;		/* KFS memory mapping for a portion of that file */
-    const void *	map;		/* where the tar file got put by mmap */
-    sparse_data * 	sparse_q;
-    KTocChunk *		chunks;		/* table of chunks: logical_position, source_position, size */
-    KToc *		toc;		/* the Table of Contents we are building */
-    size_t		tar_length;	/* how long is the tar file */
-    size_t		buffer_length;	/* how long is the window into the buffer */
-    uint64_t		buffer_start;	/* how far into the tar file is the buffer start */
-    uint64_t		buffer_limit;	/* how far into the tar file is the buffer end */
-    uint32_t		num_chunks;
-    /* -----
-     * zero blocks are only supposed to pad out the end of a tar file to
-     * match a larger block size.  If we find something after a zero block
-     * it is a file error of some type
-     */
-    bool		found_zero_block;
-    bool		found_second_zero_block;
-} KTarState;
-
-static rc_t make_chunk_list(KTarState * self, uint64_t file_offset)
-{
-    uint64_t		count = self->num_chunks;
-    uint64_t		source_position = file_offset;
-    uint64_t		ix;
-    sparse_data * 	psd;
-    rc_t		ret;
-
-    if (self->chunks)
-	free (self->chunks); /* shouldn't happen */
-    self->chunks = malloc( (size_t)( count * sizeof(KTocChunk) ) );
-    if (self->chunks == NULL)
-	return -1;
-
-
-    for (ix = 0; ix < count; ++ix)
-    {
-	ret = sparse_data_pop (&self->sparse_q, &psd);
-	if (ret != 0)
-	    return ret;
-	self->chunks[ix].logical_position = psd->offset;
-	self->chunks[ix].source_position = source_position;
-	self->chunks[ix].size = psd->size;
-	source_position += psd->size;
-	sparse_data_kill(&psd);
-    }
-    return 0;
-}
-
-static void whack_chunk_list(KTarState * self)
-{
-    free (self->chunks);
-    self->chunks = NULL;
-    self->num_chunks = 0;
-}
-
-#if HANDLING_EXTENDED_HEADERS
-/* ======================================================================
- * mini class for handling pax/posix/ustar 
- * extended headers and global extended headers
- *
- * Many of the values are included to get past range limits imposed by the ustar format
- * particular for string length and charcter set or shortish integral values.  <ekyword>
- * and <value> below are UTF-8.
- *
- * values in the header are string values written as with a 'printf' using the form
- *	printf("%d %s=%s\n",<length>,<keyword>,<value>)
- *
- * <length> is described ambiguously as 
- *	"The <length> field shall be the decimal length of the extended header record in octets,
- *	 including the trailing <newline>."
- * So does that include the length of <length>? or not?
- *
- * The field <keyword> is allowed in a pax Extended Header include but are not limited to
- *	atime		time_t but with fractional seconds maybe
- *	charset		enumeration list
- *	comment		human readable comments
- *	gid		integer gid allowing numbers greater than ustar limit of 2097151 (07777777)
- *	gname		over rides xhdr gid and ustar gname and gid
- *	linkpath
- *	mtime		time_t but with franctional seconds maybe
- *	path
- *	realtime.<ANY>
- *	security.<ANY>
- *	size
- *	uid		integer uid allowing numbers greater than ustar limit of 2097151 (07777777)
- *	uname
- * Any other keywords desired can be included but might not be meaningful to many applications.
- * Keyword can have pretty much any character in it except '='.
- *
- * <value> is a UTF-8 string that ends with the '\n'.
- * 
- *
- * charset is limited to (omit the quotation marks)
- *      <value>			  Formal Standard
- * "ISO-IR 646 1990"		ISO/IEC 646:1990
- * "ISO-IR 8859 1 1998"		ISO/IEC 8859-1:1998
- * "ISO-IR 8859 2 1999"		ISO/IEC 8859-2:1999
- * "ISO-IR 8859 3 1999"		ISO/IEC 8859-3:1999
- * "ISO-IR 8859 4 1998"		ISO/IEC 8859-4:1998
- * "ISO-IR 8859 5 1999"		ISO/IEC 8859-5:1999
- * "ISO-IR 8859 6 1999"		ISO/IEC 8859-6:1999
- * "ISO-IR 8859 7 1987"		ISO/IEC 8859-7:1987
- * "ISO-IR 8859 8 1999"		ISO/IEC 8859-8:1999
- * "ISO-IR 8859 9 1999"		ISO/IEC 8859-9:1999
- * "ISO-IR 8859 10 1998"	ISO/IEC 8859-10:1998
- * "ISO-IR 8859 13 1998"	ISO/IEC 8859-13:1998
- * "ISO-IR 8859 14 1998"	ISO/IEC 8859-14:1998
- * "ISO-IR 8859 15 1999"	ISO/IEC 8859-15:1999
- * "ISO-IR 10646 2000"		ISO/IEC 10646:2000
- * "ISO-IR 10646 2000 UTF-8"	ISO/IEC 10646, UTF-8 encoding
- * "BINARY"			None.
- */
-typedef enum pax_charset
-{
-    PAX_CS_NOT_SPECIFIED,
-    PAX_CS_ISO_IR_646_1990,
-    PAX_CS_ISO_IR_8859_1_1998,
-    PAX_CS_ISO_IR_8859_2_1999,
-    PAX_CS_ISO_IR_8859_3_1999,
-    PAX_CS_ISO_IR_8859_4_1998,
-    PAX_CS_ISO_IR_8859_5_1999,
-    PAX_CS_ISO_IR_8859_6_1999,
-    PAX_CS_PAX_CS_ISO_IR_8859_7_1997,
-    PAX_CS_ISO_IR_8859_8_1999,
-    PAX_CS_ISO_IR_8859_9_1999,
-    PAX_CS_ISO_IR_8859_10_1998,
-    PAX_CS_ISO_IR_8859_13_1998,
-    PAX_CS_ISO_IR_8859_14_1998,
-    PAX_CS_ISO_IR_8859_15_1998,
-    PAX_CS_ISO_IR_1064_2000,
-    PAX_CS_ISO_IR_1064_2000_UTF_8,
-    PAX_CS_BINARY
-} pax_charset;
-
-static const char * pax_charset_strings[] = 
-{
-    "Not Specified",
-    "ISO-IR 646 1990",
-    "ISO-IR 8859 1 1998",
-    "ISO-IR 8859 2 1999",
-    "ISO-IR 8859 3 1999",
-    "ISO-IR 8859 4 1998",
-    "ISO-IR 8859 5 1999",
-    "ISO-IR 8859 6 1999",
-    "ISO-IR 8859 7 1987",
-    "ISO-IR 8859 8 1999",
-    "ISO-IR 8859 9 1999",
-    "ISO-IR 8859 10 1998",
-    "ISO-IR 8859 13 1998",
-    "ISO-IR 8859 14 1998",
-    "ISO-IR 8859 15 1999",
-    "ISO-IR 10646 2000",
-    "ISO-IR 10646 2000 UTF-8",
-    "BINARY",
-    NULL
-};
-
-static pax_charset pax_xhdr_parse_charset_string(char*string)
-{
-    int ix;		/* index */
-    const char * ps;	/* pointer to string */
-
-    for (ps = pax_charset_strings[ix= 0]; ps; ps = pax_charset_strings[++ix])
-	if (strcmp(ps,string) == 0)
-	    return ix;
-    return PAX_CS_NOT_SPECIFIED;	/* matched none so set it to not specified */
-}
-
-typedef struct pax_xheader pax_xheader;
-struct pax_xheader
-{
-    char *	path;		/* supercedes .posix.name */
-    char *	linkpath;	/* supercedes .posix.linkname */
-    char *	uname;		/* user name supercedes .posix.uname uid and .posix.uid */
-    char *	gname;		/* group name supercedes .posix.gname gid and .posix.gid */
-    time_t	atime;		/* supercedes .posix.atime */
-    time_t	mtime;		/* supercedes .posix.mtime */
-    uid_t	uid;		/* supercedes .posix.uid */
-    uint32_t	gid;		/* supercedes .posix.gname */
-    uint64_t	size;		/* supercedes .posix.size */
-    pax_charset	charset;	/* not supported by us? */
-};
-
-static pax_xheader *	pax_xhdr_create (void)
-{
-    pax_xheader * pxv = malloc (sizeof(pax_xheader));
-    memset (pxv,0,sizeof(pax_xheader));
-    return pxv;
-}
-
-static void	pax_xhdr_delete(pax_xheader * self)
-{
-    if (self->path)
-	free (self->path);
-    if (self->linkpath)
-	free (self->linkpath);
-    if (self->uname)
-	free (self->uname);
-    if (self->gname)
-	free (self->gname);
-    free (self);
-}
-
-static rc_t  pax_xhdr_set_general_string (char ** str, const char * val)
-{
-    size_t	len;	/* how much memory */
-    char      *	nl;	/* point to any new line in source */
-    rc_t	rc = 0;	/* return code; assume success */
-
-    if (*str)		/* if already set, free the old value */
-	free (*str);
-    nl = strchr (val, '\n');
-    if (nl)
-    {
-	len = nl - val + 1; /* +1 for NUL */
-    }
-    else
-    {
-        size_t size;
-        len = string_measure(val, &size) + 1;
-    }
-    *str = malloc (len);
-    if (*str)
-    {
-        string_copy(*str, len, val, len-1);
-        (*str)[len-1] = '\0'; /* if it was a '\n' terminated value this is needed not worth the check if needed */
-    }
-    else
-    {
-	rc = RC(rcFS/*?*/,rcAllocating,0/*?*/,rcNoObj/*?*/,rcNull); /* well its not 0 */
-    }
-    return rc;
-}
-
-/* ----------
- * new_path points to a string that ends with either a '\n' or a NUL
- */
-LIB_EXPORT rc_t CC pax_xhdr_set_path(pax_xheader * self, char * new_path)
-{
-    return pax_xhdr_set_general_string(&(self->path),new_path);
-}
-
-/* ----------
- * new_path points to a string that ends with either a '\n' or a NUL
- */
-LIB_EXPORT rc_t CC pax_xhdr_set_linkpath(pax_xheader * self, char * new_path)
-{
-    return pax_xhdr_set_general_string(&(self->linkpath),new_path);
-}
-
-/* ----------
- * new_name points to a string that ends with either a '\n' or a NUL
- */
-LIB_EXPORT rc_t CC pax_xhdr_set_uname(pax_xheader * self, char * new_name)
-{
-    return pax_xhdr_set_general_string(&(self->uname),new_name);
-}
-
-/* ----------
- * new_name points to a string that ends with either a '\n' or a NUL
- */
-LIB_EXPORT rc_t CC pax_xhdr_set_gname(pax_xheader * self, char * new_name)
-{
-    return pax_xhdr_set_general_string(&(self->gname),new_name);
-}
-
-LIB_EXPORT bool CC pax_xhdr_get_general_string (char**src, char**dst, size_t max)
-{
-    size_t size;
-    if (string_measure(*src, &size) > max-1)	/* fail if too big for target */
-    {
-        return false;
-    }
-    string_copy(*dst, max, *src, size);
-    return true;
-}
-
-LIB_EXPORT rc_t CC pax_xhdr_get_path(pax_xheader * self, char ** path, size_t max)
-{
-    return (pax_xhdr_get_general_string(&self->path,path,max))? 0 : ~0;
-}
-
-LIB_EXPORT rc_t CC pax_xhdr_get_linkpath(pax_xheader * self, char ** path, size_t max)
-{
-    return (pax_xhdr_get_general_string(&self->linkpath,path,max))? 0 : ~0;
-}
-
-LIB_EXPORT rc_t CC pax_xhdr_get_uname(pax_xheader * self, char ** name, size_t max)
-{
-    return (pax_xhdr_get_general_string(&self->uname,name,max))? 0 : ~0;
-}
-
-LIB_EXPORT rc_t CC pax_xhdr_get_gname(pax_xheader * self, char ** name, size_t max)
-{
-    return (pax_xhdr_get_general_string(&self->gname,name,max))? 0 : ~0;
-}
-
-/* ----------
- * The mtime and atime <value> is defined as
- *	The pax utility shall write an mtime record for each file in write
- *	or copy modes if the file's modification time cannot be represented
- *	exactly in the ustar header logical record described in ustar
- *	Interchange Format. This can occur if the time is out of ustar range,
- *	or if the file system of the underlying implementation supports
- *	non-integer time granularities and the time is not an integer. All of
- *	these time records shall be formatted as a decimal representation of
- *	the time in seconds since the Epoch. If a period ( '.' ) decimal
- *	point character is present, the digits to the right of the point shall
- *	represent the units of a subsecond timing granularity, where the first
- *	digit is tenths of a second and each subsequent digit is a tenth of
- *	the previous digit. In read or copy mode, the pax utility shall
- *	truncate the time of a file to the greatest value that is not greater
- *	than the input header file time. In write or copy mode, the pax
- *	utility shall output a time exactly if it can be represented exactly
- *	as a decimal number, and otherwise shall generate only enough digits
- *	so that the same time shall be recovered if the file is extracted on a
- *	system whose underlying implementation supports the same time
- *	granularity.
- *
- * So...
- * Looks like for our purposes we ignore anything after a possible decimal
- * point and just use the integer part of whatever is there and just not be
- * to worried about it since we aren't creating any of this, just reading ie.
- */
-static rc_t	pax_xhdr_set_general_time (const char * ts, time_t * tt)
-{
-    uint64_t temp = strtou64(ts,NULL,10); /* tosses decimal part for us */
-
-    if (temp)
-        *tt = (time_t)temp;
-    return temp ? 0 : ~0;
-}
-
-/* ======================================================================
- * This is the data accumulated for each entry in a tar file.
- */
-static struct	tar_entry_data
-{
-    /* -----
-     * We are not using linux (or other O/S specific) type here because the ranges
-     * for the system creating the archive might have larger types than the system
-     * we are running on.  We'll leave it to the outside caller of this program to
-     * "make it fit".
-     */
-
-    
-    entry_type	type;
-
-    char *	path;
-    char *	link;
-
-    uint64_t	size;
-    uint64_t	offset;
-
-    mode_t	mode;
-
-    char *	uname;
-    uid_t	uid;
-
-    char *	gname;
-    uint32_t	gid;
-
-    time_t	mtime;
-    time_t	atime;
-    time_t	ctime;
-
-} tar_entry_data;
-#endif
-/* ======================================================================
- * Mapping a memory region
- *
- * This will have two versions:
- *	initially for development it will make raw Linux O/S calls
- *	quickly it will be ported to use KFS structures instead
- */
-/* -----
- * Use a map window size of a gigabyte
- * Life would be really bad if a single header was with in pagesize of that gigabyte
- * This assumes that a gigabyte is a multiple of system pagesize - a very safe bet.
- */
-#define	MAP_WINDOW_SIZE	(1024*1024*1024)
-
-/* ----------
- * map_tar_file
- *
- * This function uses existing members of the ktar state structure and a single parameter
- * to decide what part of a file to map.
- *
- * IN: offset: 	an uint64_t type of where the starting point with in the file the memory mapped region
- *		should start
- * SIDE:	side effects are a freeing of any existing memory mapped region of a file and
- *		if successful mappinga region it will have mapped that region and put real
- *		parameters describing that region in the private memory block
- */
-static
-rc_t map_tar_file (KTarState * self, uint64_t requested_offset)
-{
-    rc_t  ret = 0;
-
-    /* -----
-     * If we are mapping for the first time
-     */
-    if (self->kmmap == NULL)
-    {
-	ret = KMMapMakeMaxRead(&self->kmmap,self->kfile);
-	if (ret)
-	    return ret;
-	ret = KMMapSize(self->kmmap, &self->buffer_length);
-	if (ret)
-	    return ret;
-    }
-    /* -----
-     * if we are remapping the region
-     */
-    else
-    {
-	ret = KMMapReposition(self->kmmap, requested_offset, &self->buffer_length);
-	if (ret)
-	    return ret;
-    }
-    ret = KMMapAddrRead(self->kmmap, &self->map);
-    if (ret)
-	return ret;
-    ret = KMMapPosition(self->kmmap, &self->buffer_start);
-    if (ret)
-	return ret;
-    ret = KMMapSize(self->kmmap, &self->buffer_length);
-    if (ret)
-	return ret;
-    self->buffer_limit = self->buffer_start + self->buffer_length;
-
-    return ret;
-}
-
-static
-rc_t release_map (KTarState * self)
-{
-    KMMapRelease (self->kmmap);
-    self->kmmap = NULL;
-    return 0;
-}
-
-/* ======================================================================
- *
- * offset is the byte position within the tar file
- * hard_limit is the byte position with in the tar file that is not mapped
- *
- * This is the ugliest function/method in the whole module.  The extensions
- * to the tar header are not done in a consistent manner so convolutions
- * have to be made to support all manner of extensions.
- */
-static
-uint64_t process_one_entry (KTarState * self, uint64_t offset, uint64_t hard_limit, bool silent)
-{
-    /* -----
-     * full_path will store the full path of an element which can be longer than 
-     * will fit in the standard tar header.  This will also usually be an output
-     * to the consumer.
-     */
-    char		full_path	[4096];
-
-    /* -----
-     * full_path will store the full link (if any) of an element which can be longer than 
-     * will fit in the standard tar header.  This will also usually be an output
-     * to the consumer.
-     */
-    char		full_link	[4096];
-
-    /* -----
-     * data_offset will index into the tar file where the data portion for the current header
-     * lies. (Usually at the address of the header + 512)  This will also usually be an output
-     * to the consumer.
-     */
-    uint64_t data_offset = 0;
-
-    /* -----
-     * data_size will hold the size of the data portion for the current header.  This will also
-     * usually be an output to the consumer.
-     */
-    uint64_t data_size = 0;
-
-    /* -----
-     * virtual_data_size will hold the virtual size of a sparse file.  This will also
-     * usually be an output to the consumer.
-     */
-    uint64_t virtual_data_size = 0;
-    /* -----
-     * type is an enumerated type that described the format of the tar header.  Its initialized
-     * to an invalid header type.
-     */
-    tar_header_type	type = TAR_UNDEFINED;
-
-    /* -----
-     * link is an enumerated type that described the contents of this element.
-     */
-    tar_link		link = LINK_OLDNORMAL_FILE;
-#if _DEBUGGING && 0
-/* We are not using these components of the tar header block at this point 
- * but with a debug build it doesn't hurt to verify we fully understand the
- * header.
- */
-    uid_t  uid = 0;
-    uint32_t gid = 0;
-#endif
-    time_t mtime = 0;
-    mode_t mode = 0;
-
-    /* -----
-     * current_offset is the offset of the current header which might be a different header 
-     * than the one we started with.
-     */
-    uint64_t current_offset = offset;
-
-    /* -----
-     * we can access the header either as a sequence of bytes or as a
-     * header structure.  That header can further be accessed as one of
-     * several more specific types of header.
-     */
-    union
-    {
-        const uint8_t *    b;
-        const tar_header * h;
-    } current_header;
-
-    /* -----
-     * done is a flag as to when we are finished processing a tar element
-     * that might have multiple headers and other elements
-     */
-    bool done = false;
-
-    /* -----
-     * gnu_sparse is a flag that we are currently inside a sparse file
-     * with in the TAR and have more sparse header elements to parse
-     */
-    bool gnu_sparse = false;
-
-    FUNC_ENTRY();
-
-    /* -----
-     * check right away to make sure we are still in our memory mapped window
-     */
-    if (offset > self->buffer_limit)
-    {
-        /* -----
-         * if not bail and say we couldn't consume any bytes
-         */
-        return 0;
-    }
-
-    /* -----
-     * clear the full name and link name entries
-     */
-    memset (full_path, 0, sizeof(full_path));
-    memset (full_link, 0, sizeof(full_link));
-
-    /* -----
-     * set the header at the current TAR block.
-     * That is the map starts at offset buffer_start and we are at 
-     * current_offset into the file so we take the map as a pointer
-     * and add to it the difference between our current offset and the map's
-     * initial offset (first header is at map + 0 - 0)
-     */
-    current_header.b = (const uint8_t *)self->map + current_offset - self->buffer_start;
-    /* -----
-     * start processing
-     */
-    do
-    {
-        TAR_DEBUG (( "Processing one block at (%lu), it is sparse? %s\n",
-                     current_offset, get_bool_string(gnu_sparse)));
-
-	/* -----
-	 * what we will do depends upon the type of this block
-	 */
-	type = gnu_sparse ? TAR_SPARSE : what_header_type(current_header.h);
-	if (self->found_zero_block)
-	{
-	    if (self->found_second_zero_block == true)
-	    {
-		type = TAR_ZERO_BLOCK; /* skip anyway */
-	    }
-	    else if (type == TAR_ZERO_BLOCK)
-	    {
-		self->found_second_zero_block = true;
-	    }
-	    else
-	    {
-		PLOGMSG(klogErr,(klogErr,
-			 "Found Extra Header after a block of zeros $(O)",
-			 PLOG_U64(O), offset));
-		return -1;
-	    }
-	}
-	switch (type)
-	{
-	case TAR_ZERO_BLOCK:
-	{
-	    self->found_zero_block = true;
-	    done = true;
-	    break;
-	}
-	case TAR_SPARSE:
-	{
-	    /* -----
-	     * If there is an extension header we'll have different work to do
-	     */
-/* 	    if (current_header.h->sparse.isextended) */
-/* 	    { */
-/* 		LOGMSG (klogDebug3,"isextended true"); */
-/* 	    } */
-/* 	    else */
-/* 	    { */
-/* 		LOGMSG (klogDebug3,"isextended false"); */
-/* 	    } */
-	    {
-		int64_t  ix;
-		uint64_t of;
-		uint64_t sz;
-
-		for (ix = 0; ix< GNU_SPARSES_IN_EXTRA_HEADER; ++ix)
-		{
-		    rc_t ret;
-		    of = tar_strtoll((const uint8_t*)current_header.h->sparse.sparse[ix].offset,
-				     TAR_SIZE_LEN);
-		    sz = tar_strtoll((const uint8_t*)current_header.h->sparse.sparse[ix].num_bytes,
-				     TAR_SIZE_LEN);
-		    if (sz == 0)
-		    {
-			break;
-		    }
-/* 		    PLOGMSG ((klogDebug4,  */
-/* 			      "SPARSE ext: $(count): $(offset) $(size)", */
-/* 			      PLOG_3(PLOG_I64(count),PLOG_X64(offset),PLOG_X64(size)), */
-/* 			      ix, */
-/* 			      of, */
-/* 			      sz)); */
-
-		    ret = sparse_data_push (&self->sparse_q, of, sz);
-		    if (ret)
-		    {
-			sparse_data_kill(&self->sparse_q);
-			return -1;
-		    }
-		    ++self->num_chunks;
-		}
-	    }
-	}
-	break;
-
-/* Same as the default case */	    
-/* 	case TAR_CPIO: */
-/* 	    PLOGMSG ((klogErr, */
-/* 		      "unsupported header type $(type) $(string)", */
-/* 		      "type=%d,string=%s", */
-/* 		      type, get_type_string(type))); */
-/* 	    done = true; */
-/* 	    break; */
-
-	default:
-            if ( ! silent )
-                PLOGMSG (klogErr,(klogErr,
-                                  "unsupported header type $(type) $(string)",
-                                  "type=%d,string=%s",
-                                  type, get_type_string(type)));
-	    done = true;
-	    break;
-
-	case TAR_GNU_89:
-	case TAR_V7:
-	case TAR_POSIX:
-	    /* -----
-	     * almost anything we do will depend upon the size of the data for this block
-	     *
-	     * this will be wrong if we ever support cpio...
-	     */
-	    data_size = (uint64_t)(tar_strtoll((uint8_t*)current_header.h->tar.size,TAR_SIZE_LEN));
-#if _DEBUGGING && 0
-            uid =  (tar_strtoll((uint8_t*)current_header.h->tar.uid,TAR_ID_LEN));
-            gid =  (tar_strtoll((uint8_t*)current_header.h->tar.gid,TAR_ID_LEN));
-#endif
-            mtime = (tar_strtoll((uint8_t*)current_header.h->tar.mtime,TAR_TIME_LEN));
-	    mode = (uint32_t)(tar_strtoll((uint8_t*)current_header.h->tar.mode,TAR_MODE_LEN));
-	}
-	/* -----
-	 * Sometimes we are done just by identifying the header type.
-	 * If so we break the loop here.
-	 */
-	if (done)
-	{
-	    /* -----
-	     * point at the next header block
-	     * Add the size of the header itself plus enough block sizes of data to cover
-	     * any associated data.
-	     */
-	    size_t header_plus_data_block_size = (1+BLOCKS_FOR_BYTES(data_size))*TAR_BLOCK_SIZE;
-	    current_offset += (uint64_t)header_plus_data_block_size;
- 	    current_header.b += header_plus_data_block_size;
-	    break;
-	}
-
-	/* -----
-	 * several extensions to USTAR/TAR format headers involve
-	 * prepending another header type to give a name longer 
-	 * than will fit in tthe header itself.  If we had one of
-	 * those use that name.  But if the full path has not been
-	 * set use the path from this header.
-	 */
-	if (full_path[0] == 0) /* if full_path wasn't filled in by an 'L' long name */
-	{
-            size_t len, size;
-	    /* -----
-	     * if there is a prefix (POSIX style) use it
-	     * copy the prefix and then concatenate the name field
-	     */
-	    if (current_header.h->posix.prefix[0])
-	    {
-/* 		PLOGMSG ((klogDebug1, */
-/* 			  "used a posix prefix $(prefix)", */
-/* 			  "prefix=%s", */
-/* 			  current_header.h->posix.prefix)); */
-		/* -----
-		 * copy in the prefix, force a NUL just in case. then add a directory divider 
-		 */
-            string_copy(full_path, sizeof(full_path), current_header.h->posix.prefix, TAR_PREFIX_LEN);
-		full_path[TAR_PREFIX_LEN] = 0x00;
-		strcat(full_path,"/");
-	    }
-	    strncat(full_path,current_header.h->tar.name,TAR_NAME_LEN);
-            len = string_measure(full_path, &size);
-            while (len > 1)
-            {
-                if (full_path[len-1] == '/')
-                    len--;
-                else
-                    break;
-            }
-            full_path[len] = '\0';
-	}
-	link = current_header.h->tar.link;
-        TAR_DEBUG(("link = %s(%c)\n",get_link_string(link),link));
-	switch (link)
-	{
-	case LINK_SPARSE:
-	    /* -----
-	     * If there is an extension header we'll have different work to do
-	     */
-	    if (current_header.h->gnu_89.isextended)
-	    {
-		/* -----
-		 * If we have an extended header following make sure there is room
-		 */
-		if ( (uint64_t)( offset + 2 * sizeof(tar_header) ) > hard_limit )
-		    return 0;
-		done = false;
-		gnu_sparse = true;	/* next block will be part of the header and not data */
-		data_offset = offset + 2 * sizeof(tar_header);
-	    }
-	    else
-	    {
-		done = true;
-		gnu_sparse = false;
-		data_offset = offset + sizeof(tar_header);
-	    }
-
-	    done = (bool)! current_header.h->gnu_89.isextended;
-	    {
-		int32_t ix;
-		rc_t	ret;
-
-		virtual_data_size = (uint64_t)(tar_strtoll((uint8_t*)current_header.h->gnu_89.realsize,TAR_SIZE_LEN));
-
-		for (ix = 0; ix< GNU_SPARSES_IN_OLD_HEADER; ++ix)
-		{
-		    uint64_t soffset = tar_strtoll((const uint8_t*)current_header.h->gnu_89.sparse[ix].offset,
-						  TAR_SIZE_LEN);
-		    uint64_t ssize = tar_strtoll((const uint8_t*)current_header.h->gnu_89.sparse[ix].num_bytes,
-						TAR_SIZE_LEN);
-		    if (ssize == 0)
-		    {
-			break;
-		    }
-
-		    ret = sparse_data_push (&self->sparse_q, soffset, ssize);
-		    if (ret) 
-		    {
-			sparse_data_kill(&self->sparse_q);
-			return -1;
-		    }
-		    ++self->num_chunks;
-		}
-	    }
-	    data_offset = current_offset + sizeof(tar_header);
-	    break;
-
-	case LINK_OLDNORMAL_FILE:		/* deprecated normal file */
-	    /* -----
-	     * this should only happen with LINK_OLDNORMAL_FILE
-	     *
-	     * If the type is file but the last character in the path is "/"
-	     * treat it as a directory instead
-	     */
-        {
-            size_t size;
-            if (full_path[string_measure(full_path, &size)-1] == '/')
-            {
-                link = LINK_DIRECTORY;
-            }
-        }
-	    /* fall through */
-	case LINK_NORMAL_FILE:
-	case LINK_CONTIGUOUS_FILE:
-	case LINK_DIRECTORY:
-	    data_offset = current_offset + sizeof(tar_header);
-	    done = true;
-	    break;
-
-            /* since we do not extract for tar files, a symlink and a hardlink
-             * are the same to us */
-	case LINK_HARD_LINK:
-	case LINK_SYMBOLIC_LINK:
-	    if (full_link[0] == 0)
-	    {
-            string_copy(full_link, sizeof(full_link), current_header.h->tar.linkname, TAR_NAME_LEN);
-	    }
-	    done = true;
-	    break;
-
-	    /* ----------
-	     * These types we ignore and they are defined to not have a data size
-	     */
-	case LINK_CHARACTER_SPECIAL:
-	case LINK_BLOCK_SPECIAL:
-	case LINK_FIFO:
-	case LINK_INODE_METADATA:
-	    /* -----
-	     * Nothing to be done
-	     */
-            TAR_DEBUG (("%s: ignored block link type %s(%c) @ %lu\n",
-                        __func__,
-                        get_link_string(current_header.h->tar.link),
-                        get_link_string(current_header.h->tar.link),
-                        (uint64_t)(current_offset)+(uint64_t)(OFFSET_OF(tar_v7_header,link)))); 
-            data_size = 0; /* data size is specifically to be ignored */
-	    done = true;
-	    break;
-
-	    /* ----------
-	     * These types we ignore as a final block or a block unto themselves and are
-             * not part of a series of blocks and they are defined to have a data size
-	     */
-	case LINK_PAX_GLOBAL_XHDR:
-	case LINK_GNU_DUMPDIR: /* we are just gonna ignore this and not treat it like LINK_DIRECTORY */
-	case LINK_SOLARIS_ACL_FILE:
-	case LINK_VOLUME_NAME:
-	case LINK_MULTI_VOLUME:
-            TAR_DEBUG (("%s: ignored block link type %s(%c) %lu @ %lu\n",
-                        __func__,
-                        get_link_string(current_header.h->tar.link),
-                        get_link_string(current_header.h->tar.link),
-                        data_size,
-                        (uint64_t)(current_offset)+(uint64_t)(OFFSET_OF(tar_v7_header,link)))); 
-            done = true;
-            break;
-
-	    /* ----------
-	     * These types we ignore as a block with in a series of blocks
-             * and they are defined to have a data size
-             *
-	     * Nothing to be done
-	     */
-	case LINK_SOLARIS_ACL:
-	case LINK_PAX_XHDR:	/* posix extended */
-	    /* -----
-	     */
-            TAR_DEBUG (("%s: ignored block link type %s(%c) @ %lu\n",
-                        __func__,
-                        get_link_string(current_header.h->tar.link),
-                        get_link_string(current_header.h->tar.link),
-                        (uint64_t)(current_offset)+(uint64_t)(OFFSET_OF(tar_v7_header,link)))); 
-	    break;
-
-            /* some link types we ignore this block */
-	default:
-            TAR_DEBUG (("%s: Ignoring block with link %s(%c/%02.2x) @ %lu\n",
-                        __func__, 
-                        get_link_string(current_header.h->tar.link),
-                        current_header.h->tar.link,
-                        (unsigned)(current_header.h->tar.link),
-                        (uint64_t)(current_offset)+(uint64_t)(OFFSET_OF(tar_v7_header,link))));
-	    break;
-
-	case LINK_NEXT_LONG_LINK:	/* long link name */
-	    /* -----
-	     * Long link name needs access now to its full set of data blocks, request a window shift 
-	     * if it is not currently accessible
-	     */
-	    if ( (uint64_t)( offset + sizeof( tar_header ) + data_size ) > hard_limit )
-		return 0;
-
-	    string_copy(full_link, sizeof(full_link), (char*)(current_header.b + sizeof(tar_header)), data_size);
-	    break;
-	case LINK_NEXT_LONG_NAME:	/* long path name */
-	    /* -----
-	     * Long path name needs access now to its full set of data blocks, request a window shift 
-	     * if it is not currently accessible
-	     */
-	    if ( (uint64_t)( offset + sizeof( tar_header ) + data_size ) > hard_limit )
-	    {
-		return 0;
-	    }
-
-	    string_copy(full_path, sizeof(full_path), (char*)(current_header.b + sizeof(tar_header)), data_size);
-	    break;
-	}
-	
-	/* -----
-	 * move the current header offset to past the data blocks
-	 */
-	if (link == LINK_SPARSE)
-	{
-	    current_offset += sizeof (tar_header);
-	    current_header.b += sizeof(tar_header);
-	}
-	else
-	{
-	    current_offset += sizeof (tar_header)+ ((data_size+TAR_BLOCK_SIZE-1)/TAR_BLOCK_SIZE)*TAR_BLOCK_SIZE;
-	    current_header.b += sizeof(tar_header) + ((data_size+TAR_BLOCK_SIZE-1)/TAR_BLOCK_SIZE)*TAR_BLOCK_SIZE;
-	}
-	/* -----
-	 * if that is past the currently available
-	 * quit the parse of this entry asn ask for a window shift, yeah, we'll redo work
-	 * but its far simpler code to just start over than track being in the middle
-	 */
-	if ((!done) && (current_offset >= hard_limit))
-	{
-	    return 0;
-	}
-
-    } while (! done);
-
-    /* -----
-     * generate output for this entry
-     */
-    switch (type)
-    {
-    default:
-        if ( ! silent )
-        {
-            PLOGMSG (klogErr,(klogErr,"Unhandled Header Block Type $(type):$(typeint)","type=%c,typeint=%d",type ? type : '0',type));
-        }
-	return RC (rcFS, rcArc, rcParsing, rcData, rcUnsupported);
-    case TAR_ZERO_BLOCK:
-/* 	LOGMSG (klogDebug1, "Zero Block"); */
-	/* ignored */
-	break;
-
-    case TAR_CPIO:
-    case TAR_V7:
-    case TAR_POSIX:
-	/* case TAR_PAX: */
-    case TAR_SUN:
-    case TAR_STAR_85:
-    case TAR_STAR_94:
-    case TAR_GNU_89:
-	/*case TAR_GNU_01: */
-    case TAR_SPARSE:
-	/* -----
-	 * TODO:
-	 *	implement a header checksum routine call it here, and return -1 if the check sum fails
-	 */
-	if (gnu_sparse)
-	{
-/* 	    PLOGMSG ((klogDebug3, */
-/* 		      "Need to create a file but gnu_sparse is true $(l)", */
-/* 		      PLOG_U8(l), */
-/* 		      link */
-/* 			 )); */
-	    link = LINK_SPARSE;	/* faking it for the next section */
-	}
-	switch (link)
-	{
-	case LINK_OLDNORMAL_FILE:
-	case LINK_NORMAL_FILE:
-	case LINK_CONTIGUOUS_FILE:
-/* 	    LOGMSG (klogDebug3, "KTocCreateFile"); */
-            TAR_DEBUG (("%s call KTocCreateFile '%c':%hhd\n", __func__, link, link));
-	    KTocCreateFile (self->toc,
-                            data_size?data_offset:0,
-                            data_size,
-                            mtime,
-                            mode,
-                            (KCreateMode)(kcmInit|kcmParents),
-                            full_path);
-	    /* -----
-	     * TODO:
-	     *	print something if extraneous fields found
-	     */
-	    break;
-	case LINK_HARD_LINK:
-            TAR_DEBUG (("%s call KTocCreateHardLink\n", __func__));
-	    KTocCreateHardLink (self->toc, mtime, mode,
-				   (KCreateMode)(kcmInit|kcmParents),
-				   full_link, full_path);
-	    /* -----
-	     * TODO:
-	     *	print something if extraneous fields found
-	     */
-	    break;
-	case LINK_SYMBOLIC_LINK:
-            TAR_DEBUG (("%s call KTocCreateSoftLink\n", __func__));
-	    KTocCreateSoftLink (self->toc, mtime, mode,
-				   (KCreateMode)(kcmInit|kcmParents),
-				   full_link, full_path);
-	    /* -----
-	     * TODO:
-	     *	print something if extraneous fields found
-	     */
-	    break;
-
-	case LINK_SPARSE:
-            TAR_DEBUG (("%s LINK_SPARSE current_offset %jx: data_offset %jx: data_size %jx\n",
-                        __func__, current_offset, data_offset, data_size));
-	    make_chunk_list(self, data_offset);
-	    KTocCreateChunkedFile (self->toc,
-				      virtual_data_size,
-				      mtime, mode,
-				      self->num_chunks,
-				      self->chunks,
-				      (KCreateMode)(kcmInit|kcmParents), 
-				      full_path);
-	    whack_chunk_list (self);
-	    break;
-	case LINK_CHARACTER_SPECIAL:
-	case LINK_BLOCK_SPECIAL:
-	case LINK_FIFO:
-	case LINK_VOLUME_NAME:
-	case LINK_SOLARIS_ACL:
-        case LINK_GNU_DUMPDIR:
-	case LINK_SUN_XHDR:
-	case LINK_INODE_METADATA:
-            TAR_DEBUG ( ( "%s ignored entry type %s linktype name  %s\n",
-                        __func__, get_link_string( link ), full_path ) );
-	    /* ignore */
-	    break;
-	case LINK_DIRECTORY:
-            TAR_DEBUG (("%s call KTocCreateDir\n", __func__));
-	    KTocCreateDir (self->toc, mtime, mode, (KCreateMode)(kcmOpen|kcmParents), full_path);
-	    /* -----
-	     * TODO:
-	     *	print something if extraneous fields found?
-	     */
-	    break;
-	default:
-	    PLOGMSG(klogErr,(klogErr,
-		     " type ($(type)) name ($(name() link ($(link)) size ($(size)) offset ($(offset))",
-		     "type=%s,name=%s,link=%s,size=%lld,offset=%lld",
-		     get_type_string(type),
-		     full_path,
-		     full_link,
-		     data_size,
-		     data_offset));
-	    break;
-	}
-	break;
-    }
-    return current_offset - offset;
-}
-
-
-static
-rc_t KArcParseTAR_intern ( KToc * self, 
-                           const void * kvoid,
-                           bool silent )
-{
-    KTarState state;
-    /* -----
-     * offset is the running index into the file of where the first tar header
-     *          for the next element should start
-     */
-    uint64_t offset;
-    /* -----
-     * used is the count of bytes used for headers, storage and padding of the last
-     *          examined element
-     */
-    uint64_t used;
-    uint64_t filesize;
-    const KFile * kfile = kvoid;
-    rc_t rc;
-
-    FUNC_ENTRY();
-
-    /* -----
-     * save the KFS File and TOC references
-     */
-
-    if ( kfile == NULL )
-    {
-        if ( !silent )
-            LOGMSG ( klogFatal, "Called with a bad KFile parameter" );
-        return RC (rcFS, rcArc, rcParsing, rcParam, rcNull );
-    }
-    else if ( self == NULL )
-    {
-        if ( !silent )
-            LOGMSG (klogFatal, "Called with a bad KToc parameter");
-        return RC (rcFS, rcArc, rcParsing, rcSelf, rcNull );
-    }
-
-    memset (&state, 0, sizeof (state));
-    state.kfile = kfile;
-    state.toc = self;
-
-    if ( ( rc = KFileSize ( state.kfile, &filesize ) ) != 0 )
-    {
-        if ( !silent )
-            LOGERR ( klogFatal, rc, "Failed to get file size of tarfile" );
-    }
-    else if ( filesize == 0 )
-    {
-        rc = RC ( rcFS, rcArc, rcAccessing, rcArc, rcEmpty );
-        if ( !silent )
-            LOGERR( klogFatal, rc, "Empty file" );
-    }
-    else if ( ( rc = map_tar_file ( &state, 0 ) ) != 0 )
-    {
-        if ( !silent )
-            PLOGMSG( klogFatal, 
-                    ( klogFatal, "Failed to $(operation) of size $(size)",
-                      "operation=%s,size=%lu", "mmap", filesize ) );
-        return rc;
-    }
-    else
-    {
-        int stalled = 0;
-
-        for ( offset = 0; offset < filesize; )
-        {
-            /* -----
-             * evaluate the tar file header at the current offset into the file
-             *
-             * the return is a positive number of bytes used
-             * OR a negative on a file parse error
-             * OR zero for a file that would exceed the current window
-             */
-            used = process_one_entry ( &state, offset, state.buffer_limit, silent );
-
-            if ( used == 0 )
-                stalled ++;
-            else
-                stalled = 0;
-
-            /* kill any left over sparse data - safely handles an empty queue */
-            sparse_data_kill ( &state.sparse_q );
-
-            if ( state.found_second_zero_block )
-            {
-                break;
-            }
-            if ( used > 0 )
-            {
-                offset += used;
-            }
-            else if ( used == 0 )   /* if the validate returns 0 we need more buffer */
-            {
-                if ( stalled == 5 ) /* sure why not 5 tries */
-                {
-                    rc = RC ( rcFS, rcArc, rcParsing, rcArc, rcIncomplete );
-                    break;
-                }
-                map_tar_file ( &state, offset ); /* slide the window up to current location */
-                /* -----
-                 * TODO:
-                 *	Handle a repeated call from the same location as a failure in file format
-                 * (truncation) of the tar file
-                 */
-            }
-            else /*if (used < 0)*/		/* if it is negative it means abort the tar file */
-            {
-                rc = RC ( rcFS, rcArc, rcParsing, rcArc, rcUnexpected );
-                break;
-            }
-        }
-        if ( offset > filesize )
-        {
-            rc = RC ( rcFS, rcArc, rcParsing, rcToc, rcIncomplete );
-            TAR_DEBUG (( "%s %R File offset %ju exceeds filesize %ju\n",
-                         __func__, rc, offset, filesize ));
-        }
-        release_map ( &state );
-    }
-    return rc;
-}
-
-/* ======================================================================
- * validating a tar file is listing the files, links and directories
- * in that archive.
- *
- * partial results are not to be accepted in the end but it is the responsibility
- * of the caller to clear them.
- *
- * returns 0 for good archive and -1 for bad archive
- */
-LIB_EXPORT rc_t CC KArcParseTAR ( KToc * self, 
-              const void * kvoid,
-              bool ( CC * ignored )( const KDirectory *, const char *, void * ),
-              void *also_ignored )
-{
-    return KArcParseTAR_intern ( self, kvoid, false );
-}
-
-
-LIB_EXPORT rc_t CC KArcParseTAR_silent ( KToc * self, 
-              const void * kvoid,
-              bool ( CC * ignored )( const KDirectory *, const char *, void * ),
-              void *also_ignored )
-{
-    return KArcParseTAR_intern ( self, kvoid, true );
-}
-
-
-LIB_EXPORT int CC KDirectoryVOpenTarArchiveRead ( struct KDirectory const *self,
-    struct KDirectory const **tar_dir, int chroot, const char *path, va_list args )
-{
-    /* putting off parameter validation into this call */
-    return KDirectoryOpenArcDirRead ( self, tar_dir, false, path, tocKFile,
-                                      KArcParseTAR, NULL, NULL );
-}
-
-LIB_EXPORT int CC KDirectoryVOpenTarArchiveRead_silent ( struct KDirectory const *self,
-    struct KDirectory const **tar_dir, int chroot, const char *path, va_list args )
-{
-    /* putting off parameter validation into this call */
-    return KDirectoryOpenArcDirRead_silent ( self, tar_dir, false, path, tocKFile,
-                                      KArcParseTAR_silent, NULL, NULL );
-}
-
-
-LIB_EXPORT int CC KDirectoryVOpenTarArchiveRead_silent_preopened ( struct KDirectory const *self,
-    struct KDirectory const **tar_dir, int chroot, const struct KFile * f, const char *path, va_list args )
-{
-    /* putting off parameter validation into this call */
-    return KDirectoryOpenArcDirRead_silent_preopened ( self, tar_dir, false, path, tocKFile, 
-                                      (void*)f, KArcParseTAR_silent, NULL, NULL );
-}
-
-
-LIB_EXPORT int CC KDirectoryOpenTarArchiveRead ( struct KDirectory const *self,
-    struct KDirectory const **tar_dir, int chroot, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDirectoryVOpenTarArchiveRead ( self, tar_dir, chroot, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-LIB_EXPORT int CC KDirectoryOpenTarArchiveRead_silent ( struct KDirectory const *self,
-    struct KDirectory const **tar_dir, int chroot, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDirectoryVOpenTarArchiveRead_silent ( self, tar_dir, chroot, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-LIB_EXPORT int CC KDirectoryOpenTarArchiveRead_silent_preopened ( struct KDirectory const *self,
-    struct KDirectory const **tar_dir, int chroot, const KFile * f, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDirectoryVOpenTarArchiveRead_silent_preopened ( self, tar_dir, chroot, f, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* ----------
- * Validate that the compiler packed all the character arrays into the correct sizes
- * to use the header.
- *
- * a bunch of magic numbers are in the function because we are making sure that
- * they are reached by using the structure members.  They are listed in comments
- * within comments in the tar_header.h file.
- *
- * No return value
- */
-LIB_EXPORT bool CC validate_header_offsets( void )
-{
-    bool pass_fail = true; /* assume pass */
-#if _DEBUGGING
-    /* -----
-     * checking the size entails making sure the compiler made the structure
-     * the right length to match the series of octents in the file
-     */
-#define	check_size(T,V)     if( sizeof(T) != (size_t)V) { pass_fail = false; printf ("*** BAD_SIZE: %s is %u not %u\n", #T, (unsigned)sizeof(T), (unsigned)V);}
-    /* -----
-     * checking the offset entails making sure the compiler put the field at the
-     * right absolute location within a structure
-     */
-#define	check_offset(T,M,V) if( OFFSET_OF(T,M) != (size_t)V ) { pass_fail = false; printf ("*** BAD_OFFSET: %s.%s is %u not %d\n", #T, #M, (unsigned)OFFSET_OF(T,M), V);}
-
-    check_size(tar_raw_block,512);
-    check_size(tar_v7_header,257);
-    check_size(tar_posix_header,500);
-    check_size(tar_sun_header,512);
-    check_size(tar_star_85_header,512);
-    check_size(tar_star_94_header,512);
-    check_size(tar_gnu_89_header,495);
-    /*check_size(tar_new_gnu_header,512); */
-    check_size(tar_sparse_header,505);
-  
-
-    /* tar_header union */
-    check_offset(tar_header,raw,0);
-    check_offset(tar_header,tar,0);
-    check_offset(tar_header,posix,0);
-    check_offset(tar_header,suntar,0);
-    check_offset(tar_header,star_85,0);
-    check_offset(tar_header,star_94,0);
-    check_offset(tar_header,gnu_89,0);
-    /*check_offset(tar_header,new_gnu,0); */
-    check_offset(tar_header,sparse,0);
-
-    /* tar_v7_header */
-    check_offset(tar_v7_header,name,0);
-    check_offset(tar_v7_header,mode,100);
-    check_offset(tar_v7_header,uid,108);
-    check_offset(tar_v7_header,gid,116);
-    check_offset(tar_v7_header,size,124);
-    check_offset(tar_v7_header,mtime,136);
-    check_offset(tar_v7_header,csum,148);
-    check_offset(tar_v7_header,link,156);
-    check_offset(tar_v7_header,linkname,157);
-
-    /* tar_posix_header */
-    check_offset(tar_posix_header,name,0);
-    check_offset(tar_posix_header,mode,100);
-    check_offset(tar_posix_header,uid,108);
-    check_offset(tar_posix_header,gid,116);
-    check_offset(tar_posix_header,size,124);
-    check_offset(tar_posix_header,mtime,136);
-    check_offset(tar_posix_header,csum,148);
-    check_offset(tar_posix_header,link,156);
-    check_offset(tar_posix_header,linkname,157);
-    check_offset(tar_posix_header,magic,257);
-    check_offset(tar_posix_header,version,263);
-    check_offset(tar_posix_header,uname,265);
-    check_offset(tar_posix_header,gname,297);
-    check_offset(tar_posix_header,devmajor,329);
-    check_offset(tar_posix_header,devminor,337);
-    check_offset(tar_posix_header,prefix,345);
-
-    /* tar_sun_header */
-    check_offset(tar_sun_header,name,0);
-    check_offset(tar_sun_header,mode,100);
-    check_offset(tar_sun_header,uid,108);
-    check_offset(tar_sun_header,gid,116);
-    check_offset(tar_sun_header,size,124);
-    check_offset(tar_sun_header,mtime,136);
-    check_offset(tar_sun_header,csum,148);
-    check_offset(tar_sun_header,link,156);
-    check_offset(tar_sun_header,linkname,157);
-    check_offset(tar_sun_header,magic,257);
-    check_offset(tar_sun_header,version,263);
-    check_offset(tar_sun_header,uname,265);
-    check_offset(tar_sun_header,gname,297);
-    check_offset(tar_sun_header,devmajor,329);
-    check_offset(tar_sun_header,devminor,337);
-    check_offset(tar_sun_header,prefix,345);
-    check_offset(tar_sun_header,extnum,500);
-    check_offset(tar_sun_header,extcount,501);
-    check_offset(tar_sun_header,fullsize,502);
-
-    /* tar_star_85_header */
-    check_offset(tar_star_85_header,name,0);
-    check_offset(tar_star_85_header,mode,100);
-    check_offset(tar_star_85_header,uid,108);
-    check_offset(tar_star_85_header,gid,116);
-    check_offset(tar_star_85_header,size,124);
-    check_offset(tar_star_85_header,mtime,136);
-    check_offset(tar_star_85_header,csum,148);
-    check_offset(tar_star_85_header,link,156);
-    check_offset(tar_star_85_header,linkname,157);
-    check_offset(tar_star_85_header,starversion,257);
-    check_offset(tar_star_85_header,starfiletype,258);
-    check_offset(tar_star_85_header,startype,266);
-    check_offset(tar_star_85_header,rdev,278);
-    check_offset(tar_star_85_header,atime,290);
-    check_offset(tar_star_85_header,ctime,302);
-    check_offset(tar_star_85_header,uname,314);
-    check_offset(tar_star_85_header,gname,330);
-    check_offset(tar_star_85_header,prefix,345);
-    check_offset(tar_star_85_header,xmagic,508);
-
-    /* tar_star_94_header */
-    check_offset(tar_star_94_header,name,0);
-    check_offset(tar_star_94_header,mode,100);
-    check_offset(tar_star_94_header,uid,108);
-    check_offset(tar_star_94_header,gid,116);
-    check_offset(tar_star_94_header,size,124);
-    check_offset(tar_star_94_header,mtime,136);
-    check_offset(tar_star_94_header,csum,148);
-    check_offset(tar_star_94_header,link,156);
-    check_offset(tar_star_94_header,linkname,157);
-    check_offset(tar_star_94_header,magic,257);
-    check_offset(tar_star_94_header,version,263);
-    check_offset(tar_star_94_header,uname,265);
-    check_offset(tar_star_94_header,gname,297);
-    check_offset(tar_star_94_header,devmajor,329);
-    check_offset(tar_star_94_header,devminor,337);
-    check_offset(tar_star_94_header,prefix,345);
-    check_offset(tar_star_94_header,isextended,355);
-    check_offset(tar_star_94_header,sparse,356);
-    check_offset(tar_star_94_header,realsize,452);
-    check_offset(tar_star_94_header,offset,464);
-    check_offset(tar_star_94_header,atime,476);
-    check_offset(tar_star_94_header,ctime,488);
-    check_offset(tar_star_94_header,xmagic,508);
-
-    /* tar_gnu_89_header */
-    check_offset(tar_gnu_89_header,name,0);
-    check_offset(tar_gnu_89_header,mode,100);
-    check_offset(tar_gnu_89_header,uid,108);
-    check_offset(tar_gnu_89_header,gid,116);
-    check_offset(tar_gnu_89_header,size,124);
-    check_offset(tar_gnu_89_header,mtime,136);
-    check_offset(tar_gnu_89_header,csum,148);
-    check_offset(tar_gnu_89_header,link,156);
-    check_offset(tar_gnu_89_header,linkname,157);
-    check_offset(tar_gnu_89_header,magic,257);
-    check_offset(tar_gnu_89_header,uname,265);
-    check_offset(tar_gnu_89_header,gname,297);
-    check_offset(tar_gnu_89_header,atime,345);
-    check_offset(tar_gnu_89_header,ctime,357);
-    check_offset(tar_gnu_89_header,offset,369);
-    check_offset(tar_gnu_89_header,longnames,381);
-    check_offset(tar_gnu_89_header,sparse,386);
-    check_offset(tar_gnu_89_header,isextended,482);
-
-    /* tar_extended_header */
-    check_offset(tar_sparse_header,sparse,0);
-    check_offset(tar_sparse_header,isextended,504);
-#endif
-    return pass_fail;
-}
-
-/* end of file */
diff --git a/libs/kfs/teefile.c b/libs/kfs/teefile.c
deleted file mode 100644
index 17f9d2a..0000000
--- a/libs/kfs/teefile.c
+++ /dev/null
@@ -1,532 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-#include <kfs/extern.h>
-/* #include <klib/container.h> */
-/* #include <klib/vector.h> */
-/* #include <klib/pbstree.h> */
-/* #include <klib/text.h> */
-/* #include <kfs/file.h> */
-/* #include <assert.h> */
-/* #include <limits.h> */
-/* #include <stdio.h> */
-/* #include <stdlib.h> */
-/* #include <string.h> */
-
-/* #include <klib/container.h> */
-/* #include <klib/vector.h> */
-/* #include <klib/pbstree.h> */
-/* #include <klib/text.h> */
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <kfs/file.h>
-#include <kfs/teefile.h>
-#include <sysalloc.h>
-
-#include <assert.h>
-/* #include <limits.h> */
-/* #include <stdio.h> */
-#include <stdlib.h>
-/* #include <string.h> */
-
-/* ======================================================================
- * KTeeFile
- *  a file inside an archive
- */
-
-/* -----
- * define the specific types to be used in the templatish/inheritancish
- * definition of vtables and their elements
- */
-#define KFILE_IMPL struct KTeeFile
-#include <kfs/impl.h>
-
-static rc_t CC KTeeFileDestroy (KTeeFile *self);
-static struct KSysFile *CC KTeeFileGetSysFile (const KTeeFile *self,
-					    uint64_t *offset);
-static rc_t CC KTeeFileRandomAccessRead (const KTeeFile *self);
-static rc_t CC KTeeFileRandomAccessUpdate (const KTeeFile *self);
-static uint32_t CC KTeeFileType (const KTeeFile *self);
-static rc_t CC KTeeFileSize (const KTeeFile *self, uint64_t *size);
-static rc_t CC KTeeFileSetSizeRead (KTeeFile *self, uint64_t size);
-static rc_t CC KTeeFileSetSizeUpdate (KTeeFile *self, uint64_t size);
-static rc_t CC KTeeFileRead (const KTeeFile *self, uint64_t pos,
-			  void *buffer, size_t bsize, size_t *num_read);
-static rc_t CC KTeeFileWriteRead (KTeeFile *self, uint64_t pos, const void *buffer,
-			       size_t size, size_t *num_writ);
-static rc_t CC KTeeFileWriteUpdate (KTeeFile *self, uint64_t pos, const void *buffer,
-				 size_t size, size_t *num_writ);
-
-
-static const KFile_vt_v1 vtKTeeFileRead =
-{
-    /* version */
-    1, 1,
-
-    /* 1.0 */
-    KTeeFileDestroy,
-    KTeeFileGetSysFile,
-    KTeeFileRandomAccessRead,
-    KTeeFileSize,
-    KTeeFileSetSizeRead,
-    KTeeFileRead,
-    KTeeFileWriteRead,
-
-    /* 1.1 */
-    KTeeFileType
-};
-static const KFile_vt_v1 vtKTeeFileUpdate =
-{
-    /* version */
-    1, 1,
-
-    /* 1.0 */
-    KTeeFileDestroy,
-    KTeeFileGetSysFile,
-    KTeeFileRandomAccessUpdate,
-    KTeeFileSize,
-    KTeeFileSetSizeUpdate,
-    KTeeFileRead,
-    KTeeFileWriteUpdate,
-
-    /* 1.1 */
-    KTeeFileType
-};
-
-
-/*-----------------------------------------------------------------------
- * KTeeFile
- *  an archive file including tar and sra
- */
-struct KTeeFile
-{
-    KFile	dad;
-    uint64_t	maxposition;
-    KFile *	original;
-    KFile *	copy;
-};
-
-static
-rc_t KTeeFileSeek (const KTeeFile *cself, uint64_t pos)
-{
-    KTeeFile * self;
-    rc_t rc = 0;
-    size_t num_read;
-    uint8_t buff [ 32 * 1024 ];
-
-    self = (KTeeFile *)cself;
-    /* seek to "pos" */
-    while (self->maxposition < pos)
-    {
-        /* maximum to read in this buffer */
-        size_t to_read = sizeof buff;
-        if (self->maxposition + sizeof buff > pos )
-            to_read = (size_t) (pos - self->maxposition);
-
-        /* read bytes */
-        rc = KFileRead (&self->dad, self->maxposition, buff, to_read, &num_read );
-        if ( rc != 0 )
-            break;
-
-        /* detect EOF */
-        if (num_read == 0)
-        {
-            break;
-        }
-    }
-
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * KTeeFileMake
- *  create a new file object
- */
-
-static
-rc_t KTeeFileMake (KTeeFile ** self,
-		   KFile * original,
-		   KFile * copy,
-		   const KFile_vt * vt,
-		   bool read_enabled,
-		   bool write_enabled)
-{
-    rc_t	rc;
-    KTeeFile *	pF;
-
-    /* -----
-     * we can not accept any of the three pointer parameters as NULL
-     */
-    assert (self != NULL);
-    assert (original != NULL);
-    assert (copy != NULL);
-
-    /* -----
-     * the enables should be true or false
-     */
-    assert ((read_enabled == true)||(read_enabled == false));
-    assert ((write_enabled == true)||(write_enabled == false));
-
-    /* -----
-     * get space for the object
-     */
-    pF = malloc (sizeof (KTeeFile));
-    if (pF == NULL)	/* allocation failed */
-    {
-	/* fail */
-	rc = RC (rcFS, rcFile, rcConstructing, rcMemory, rcExhausted);
-    }
-    else
-    {
-	rc = KFileInit (&pF->dad,			/* initialize base class */
-			vt,			 	/* VTable for KTeeFile */
-            "KTeeFile", "no-name",
-			read_enabled,			/* read allowed */
-			write_enabled);			/* write disallowed */
-	if (rc == 0)
-	{
-/* take over the existing KFile Reference for original and copy*/
-	    /* succeed */
-	    pF->original = original;
-	    pF->copy = copy;
-	    pF->maxposition = 0;
-	    *self = pF;
-	    return 0;
-	}
-	/* fail */
-	free (pF);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KFileMakeTeeRead (const KFile ** self, const KFile * original, KFile * copy)
-{
-    return KTeeFileMake ((KTeeFile **)self, (KFile*)original, copy,
-			 (const KFile_vt*)&vtKTeeFileRead, true, false);
-}
-
-LIB_EXPORT rc_t CC KFileMakeTeeUpdate (KFile ** self, KFile * original, KFile * copy)
-{
-    return KTeeFileMake ((KTeeFile **)self, original, copy,
-			 (const KFile_vt*)&vtKTeeFileUpdate, true, true);
-}
-
-/* ----------------------------------------------------------------------
- * Destroy
- *
- */
-static
-rc_t CC KTeeFileDestroy (KTeeFile *self)
-{
-    rc_t rc;
-    uint64_t last_max;
-
-    assert (self != NULL);
-
-    do
-    {
-        last_max = self->maxposition;
-
-        /* keep seeking ahead by a Gigabyte until we read no more */
-	rc = KTeeFileSeek (self, last_max + 1024*1024*1024);
-	if (rc != 0)
-	    return rc;
-
-    } while (last_max < self->maxposition);
-
-    rc = KFileRelease (self->original);
-    if ( rc == 0 )
-    {
-        KFileRelease (self->copy);
-        free (self);
-    }
-    return rc;
-}
-
-/* ----------------------------------------------------------------------
- * GetSysFile
- *  returns an underlying system file object
- *  and starting offset to contiguous region
- *  suitable for memory mapping, or NULL if
- *  no such file is available.
- *
- * We cant allow memory mapping a tee file as the read?writes ar needed
- * to trigger the writes to the copy KFile
- */
-
-static
-struct KSysFile *CC KTeeFileGetSysFile (const KTeeFile *self, uint64_t *offset)
-{
-    /* parameters must be non-NULL */
-    assert (self != NULL);
-    assert (offset != NULL);
-
-    return NULL;
-}
-
-/* ----------------------------------------------------------------------
- * RandomAccess
- *
- *  returns 0 if random access, error code otherwise
- *
- * Update needs to be able to seek both original and copy while read
- * only needs to be able to seek the original.
- */
-static
-rc_t CC KTeeFileRandomAccessUpdate (const KTeeFile *self)
-{
-    rc_t rc;
-    assert (self != NULL);
-    rc = KFileRandomAccess (self->original);
-    if (rc == 0)
-	rc = KFileRandomAccess (self->copy);
-    return rc;
-}
-static
-rc_t CC KTeeFileRandomAccessRead (const KTeeFile *self)
-{
-    rc_t rc;
-    assert (self != NULL);
-    rc = KFileRandomAccess (self->original);
-    return rc;
-}
-
-/* ----------------------------------------------------------------------
- * Type
- *  returns a KFileDesc
- *  not intended to be a content type,
- *  but rather an implementation class
- */
-static
-uint32_t CC KTeeFileType (const KTeeFile *self)
-{
-    return KFileType (self->original);
-}
-
-
-/* ----------------------------------------------------------------------
- * Size
- *  returns size in bytes of file
- *
- *  "size" [ OUT ] - return parameter for file size
- */
-static
-rc_t CC KTeeFileSize (const KTeeFile *self, uint64_t *size)
-{
-    rc_t	rc;
-    uint64_t	fsize;
-
-    assert (self != NULL);
-    assert (size != NULL);
-
-    rc = KFileSize (self->original, &fsize);
-
-    if (rc == 0)
-    {
-	/* success */
-	*size = fsize;
-    }
-    /* pass along RC value */
-    return rc;
-}
-
-/* ----------------------------------------------------------------------
- * SetSize
- *  sets size in bytes of file
- *
- *  "size" [ IN ] - new file size
- */
-static
-rc_t CC KTeeFileSetSizeUpdate (KTeeFile *self, uint64_t size)
-{
-    rc_t rc;
-
-    rc = KFileSetSize (self->original, size);
-    if (rc == 0)
-	rc = KFileSetSize (self->copy, size);
-    return rc;
-}
-static
-rc_t CC KTeeFileSetSizeRead (KTeeFile *self, uint64_t size)
-{
-    return RC (rcFS, rcFile, rcUpdating, rcSelf, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * Read
- *  read file from known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually read
- */
-static
-rc_t CC KTeeFileRead	(const KTeeFile *cself,
-			 uint64_t pos,
-			 void *buffer,
-			 size_t bsize,
-			 size_t *num_read)
-{
-    KTeeFile * 	self;
-    uint64_t	maxposition;
-    size_t	read;
-    size_t	written;
-    size_t	sofar;
-    rc_t	rc;
-
-
-    /* -----
-     * self and buffer were validated as not NULL before calling here
-     *
-     * So get the KTTOCNode type: chunked files and contiguous files 
-     * are read differently.
-     */
-    assert (cself != NULL);
-    assert (buffer != NULL);
-    assert (num_read != NULL);
-    assert (bsize != 0);
-
-    rc = 0;
-    read = 0;
-    self = (KTeeFile*)cself;
-    maxposition = self->maxposition;
-    if (pos > maxposition)
-	rc = KTeeFileSeek (self, pos);
-    if (rc == 0)
-    {
-	rc = KFileRead (self->original, pos, buffer, bsize, &read);
-	if (rc == 0)
-	{
-	    if (pos + read > maxposition)
-	    {
-		for ( sofar = (size_t)( maxposition - pos );
-			  sofar < read;
-		      sofar += written)
-		{
-		    rc = KFileWrite (self->copy, pos + sofar, (uint8_t*)buffer + sofar,
-				     read - sofar, &written);
-		    if (rc != 0)
-			break;
-		    if (written == 0)
-		    {
-			LOGERR (klogErr, rc, "Failure to write to copy in KTeeFileRead");
-			rc = RC (rcFS, rcFile, rcReading, rcFile, rcIncomplete);
-		    break;
-		    }
-		}
-		maxposition = pos + sofar;
-		if (maxposition > self->maxposition)
-		    self->maxposition = maxposition;
-	    }
-	}
-    }
-    *num_read = read;
-    return rc;
-}
-
-/* ----------------------------------------------------------------------
- * Write
- *  write file at known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ IN ] and "size" [ IN ] - data to be written
- *
- *  "num_writ" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually written
- *
- * Unsupported as we now treat archives as READ ONLY
- */
-static
-rc_t CC KTeeFileWriteUpdate (KTeeFile *self, uint64_t pos,
-		       const void *buffer, size_t bsize,
-		       size_t *num_writ)
-{
-    uint64_t	max_position;
-    size_t	writ;
-    size_t	written;
-    size_t	sofar;
-    rc_t	rc;
-
-    assert (self != NULL);
-    assert (buffer != NULL);
-    assert (num_writ != NULL);
-    assert (bsize != 0);
-
-    writ = 0;
-    rc = 0;
-    if (pos > self->maxposition)
-	rc = KTeeFileSeek (self, pos);
-    if (rc == 0)
-    {
-	rc = KFileWrite (self->original, pos, buffer, bsize, &writ);
-	if (rc == 0)
-	{
-	    for ( sofar = written = 0; sofar < writ; sofar += written)
-	    {
-		rc = KFileWrite (self->copy, pos + sofar, (uint8_t*)buffer + sofar,
-			     writ - sofar, &written);
-		if (rc != 0)
-		    break;
-		if (written == 0)
-		{
-		    rc = RC (rcFS, rcFile, rcReading, rcFile, rcIncomplete);
-		    LOGERR (klogErr, rc, "Failure to write to copy in KTeeFileWrite");
-		    break;
-		}
-	    }
-	    max_position = pos + sofar;
-	    if (max_position > self->maxposition)
-		self->maxposition = max_position;
-	}
-    }
-    *num_writ = writ;
-    return rc;
-}
-static
-rc_t CC KTeeFileWriteRead (KTeeFile *self, uint64_t pos,
-			   const void *buffer, size_t bsize,
-			   size_t *num_writ)
-{
-    assert (self != NULL);
-    assert (buffer != NULL);
-    assert (num_writ != NULL);
-    assert (bsize != 0);
-
-    *num_writ = 0;
-    return RC (rcFS, rcFile, rcWriting, rcSelf, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * 
- */
-
-
-/* end of file teefile.c */
-
diff --git a/libs/kfs/toc-priv.h b/libs/kfs/toc-priv.h
deleted file mode 100644
index c37ca9c..0000000
--- a/libs/kfs/toc-priv.h
+++ /dev/null
@@ -1,841 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_toc_priv_h_
-#define _h_kfs_toc_priv_h_
-
-#include <klib/container.h>
-#include <klib/text.h>
-#include <kfs/arc.h>
-#include <kfs/toc.h>
-#include <atomic.h>
-
-#ifdef _DEBUGGING
-#define TOC_FUNC_ENTRY() DBGMSG (DBG_KFS, DBG_FLAG(DBG_KFS_TOCENTRY), ("Enter: %s\n", __func__))
-#define TOC_SORT(msg) DBGMSG (DBG_KFS, DBG_FLAG(DBG_KFS_SRASORT), msg)
-#define TOC_DEBUG(msg) DBGMSG (DBG_KFS, DBG_FLAG(DBG_KFS_TOC), msg)
-#else
-#define TOC_FUNC_ENTRY()
-#define TOC_SORT(msg)
-#define TOC_DEBUG(msg)
-#endif
-
-
-
-/*--------------------------------------------------------------------------
- * KTocEntry
- */
-typedef struct KTocEntry KTocEntry;
-typedef enum KTocEntryType
-{
-    ktocentrytype_unknown = -1,
-    ktocentrytype_notfound,
-    ktocentrytype_dir,
-    ktocentrytype_file,
-    ktocentrytype_chunked,
-    ktocentrytype_softlink,
-    ktocentrytype_hardlink,
-    ktocentrytype_emptyfile,
-    ktocentrytype_zombiefile /* zombie in the sense that it is somewhere between live and dead */
-} KTocEntryType;
-
-/* arbitrary number that was originially set much much higher than expected needs. */
-#define	KARC_LINK_RESOLVE_LOOPMAX		(16)
-
-typedef struct KTocPageChunk
-{
-    uint64_t file_offset;
-    uint32_t page_id;
-    uint32_t page_offset;
-} KTocPageChunk;
-
-
-
-struct KTocEntry
-{
-    /* -----
-     * In C putting this first allows a weak form of polymorphism for
-     * a entry class.  A pointer to a BSTNode can be an alias to a pointer to 
-     * this form of node.
-     */
-    BSTNode		node;
-
-    /* -----
-     * The name of the directory/file/link that this Entry represents.  It is not
-     * the full path which must be assembled going up the tree.
-     *
-     * Be careful what String functions you try as some want to reallocate memory.
-     */
-    String		name;
-
-    /* -----
-     * Unix style file modification time (same as a 64-bit time_t)
-     */
-    KTime_t		mtime;
-
-    /* -----
-     * Unix style file access
-     */
-    uint32_t		access;
-
-    /* -----
-     * what type of entry is this?
-     */
-    KTocEntryType	type;
-
-    union KTocEntryUnion
-    {
-	struct KTocEntryDir
-	{
-	    /* -----
-	     * Tree of directories, files and links below this directory
-	     */
-            BSTree      tree;
-	} dir;
-	struct KTocEntryFile
-	{
-	    /*
-	     * how long is this file?
-	     */
-	    uint64_t	file_size;
-	    /* 
-	     * location within the archive where this file's data starts
-	     */
-	    uint64_t	archive_offset;
-	} contiguous_file;
-	struct KTocEntryZombieFile
-	{
-/* KEEP the first two fields here match the first two fields above
- * file_size and archive_offset so the chunked is sort of a derived type */
-	    /*
-	     * how long is this file supposed to be?
-	     */
-	    uint64_t	file_size;
-	    /* 
-	     * location within the archive where this file's data would have started
-	     */
-	    uint64_t	archive_offset;
-	} zombie_file;
-	struct KTocEntryChunkFile
-	{
-/* KEEP the first two fields here match the first two fields above
- * file_size and archive_offset so the chunked is sort of a derived type */
-	    /*
-	     * Size of the whole file including all chunks and any zero byte holes
-	     * between chunks
-	     */
-	    uint64_t	file_size;
-	    /* 
-	     * location within the archive where this file's data starts if viewws
-	     * as a virtual "*.sra"
-	     */
-	    uint64_t	archive_offset;
-
-	    KTocChunk *	chunks;			/* this will piggy back in the same allocation */
-	    uint32_t	num_chunks;	    
-	} chunked_file;
-        struct KTocEntryPagedChunkFile
-        {
-            uint64_t file_size;
-        } paged_chunk_file;
-	struct KTocEntrySoftLink
-	{
-	    String	link_path;
-	} symbolic_link;
-	struct KTocEntryHardLink
-	{
-	    const struct KTocEntry * ref;
-	    /* -----
-	     * This approach can lead to failures if the target of the link is deleted and this
-	     * reference is left dangling.
-	     */
-	} hard_link;
-    } u;
-};
-
-typedef struct KTocEntryIndex KTocEntryIndex;
-struct KTocEntryIndex
-{
-    BSTNode	node;
-    KTocEntry *	entry;
-    String	fullpath;
-};
-
-
-/* ----------------------------------------------------------------------
- * KTocEntryParam
- *
- * An internal structure used only with in this compilation unit / module
- */
-/* ----------------------------------------------------------------------
- * NOTE: This oddness of specific to general to specific can probably be 
- * refactored into specific functions (the published API) that uses common
- * functions instead of a common target function.
- */
-typedef struct KTocEntryParam	KTocEntryParam;
-struct KTocEntryParam
-{
-    KTocEntryType	type;
-    KTime_t		mtime;
-    uint32_t		access;
-    union
-    {
-	struct
-	{
-	    uint64_t		size;
-	    uint64_t		source_position;
-	} file;
-	struct
-	{
-	    uint64_t		size;
-	    uint32_t		num_chunks;
-	    const KTocChunk *	chunks;
-	} chunked;
-	struct
-	{
-            const KTocEntry *   ref;
-	} hardlink;
-	struct
-	{
-	    const char *	targ;
-	} softlink;
-    } u;
-};
-
-/* ----------------------------------------------------------------------
- * KArcTOCNodeWhack
- * [IN] BSTNode * 		n	
- * [IN] void *    		data	
- *
- * This function matches the signature for a function pointer in a 
- * call to BSTreeWhack().  It ignores the data pointer second parameter
- * which can safely be called with NULL. 
- */
-void	CC KTocEntryWhack	(BSTNode * n, void * data);
-int	CC KTocEntryCmpVoid (const void * item, const BSTNode * node);
-rc_t	KTocEntryDelete	(KTocEntry * self);
-int	CC KTocEntryCmp2 (const BSTNode * n, const BSTNode * p);
-rc_t	KTocEntryNewDirectory	(KTocEntry ** new_entry,
-					 const char * name,
-					 size_t name_size,
-					 KTime_t mtime,
-					 uint32_t access);
-rc_t		KTocEntryNewFile	(KTocEntry ** new_entry,
-					 const char * name,
-					 size_t name_size,
-					 KTime_t mtime,
-					 uint32_t access,
-					 uint64_t offset,
-					 uint64_t size);
-rc_t		KTocEntryNewChunked	(KTocEntry ** new_entry,
-					 const char * name,
-					 size_t name_size,
-					 KTime_t mtime,
-					 uint32_t access,
-					 uint64_t size,
-					 const KTocChunk * chunks,
-					 uint32_t num_chunks);
-rc_t		KTocEntryNewSoft	(KTocEntry ** new_entry,
-					 const char * name,
-					 size_t name_size,
-					 KTime_t mtime,
-					 uint32_t access,
-					 const char * link,
-					 size_t link_size);
-rc_t		KTocEntryNewHard	(KTocEntry ** new_entry,
-					 const char * name,
-					 size_t name_size,
-					 KTime_t mtime,
-					 uint32_t access,
-                                         const KTocEntry * targ);
-rc_t		KTocEntryNewZombieFile	(KTocEntry ** new_entry,
-					 const char * name,
-					 size_t name_size,
-					 KTime_t mtime,
-					 uint32_t access,
-					 uint64_t offset,
-					 uint64_t size);
-
-
-typedef struct	KTocEntryStack 	KTocEntryStack;
-rc_t KTocEntryStackNew(KTocEntryStack ** self);
-rc_t KTocEntryStackDel(KTocEntryStack * self);
-rc_t KTocEntryStackDepth(KTocEntryStack * self, int * depth);
-rc_t KTocEntryStackPush(KTocEntryStack * self, KTocEntry * pathaddr);
-rc_t KTocEntryStackPop(KTocEntryStack * self, KTocEntry ** pathaddr);
-
-const char * KTocEntryTypeGetString(KTocEntryType t);
-const char * get_mode_string (KCreateMode mode);
-
-typedef struct KTocEntryPersistWriteFuncData
-{
-    uint8_t *	buffptr;
-    uint8_t *	limit;
-} KTocEntryPersistWriteFuncData;
-KFS_EXTERN rc_t CC KTocEntryPersistWriteFunc (void * param, const void * buffer, size_t size,
-				size_t * num_writ);
-
-rc_t KTocEntryPersistNodeDir (void *param, const KTocEntry * n,
-			      size_t * num_writ, 
-			      PTWriteFunc write, void * write_param);
-
-/* ======================================================================
- * KToc struct
- */
-struct KArcDir;
-
-struct KToc
-{
-    KArcFSType	arctype;
-    KSRAFileAlignment alignment;
-    /* -----
-     * File containing the archive: details of its type hidden behind KFile.
-     * We should be able to do an archive in an archive by having this KFile
-     * point to a KArcFile with no problems.
-     */
-    union
-    {
-	const void *		v;
-	struct KFile const *f;
-	const KDirectory * 	d;
-    } archive;
-
-    /* -----
-     * KArcDir that implements the KDirectory interface for the contents of 
-     * the file opened as archive.  This link is needed to get to the 
-     * KDirectory interface from a KFile symbolic link.
-     *
-     * This reference is not counted in refcount as it is a link back to the
-     * tracked reference from the KArcDir to the KARcTOC.
-     */
-/*     const struct KArcDir *	karchive; */
-
-    /* -----
-     * count of references to this opened archive
-     */
-    atomic32_t		refcount;
-
-    /* -----
-     * A entry outside of a tree: instantiated as a special KTocEntry that is part of
-     * no BSTree with type set to ktocentrytype_dir (directory).
-     * Does not use the base dir BSTNode but makes processing easier to have a 
-     *"entry" type...
-     */
-    KTocEntry		entry;
-
-    /* -----
-     * These next two are used only in the KFile interface on top of a KToc
-     * on a KDirectory.  This needs to be rewritten as an interface so these
-     * don't exist in all KToc implmentations.
-     *
-     * Index  The main tree in 'entry' is sorted by names with in directories.
-     * This index is a directory less tree sorted by offset with in the archive.
-     *
-     * This is not currently used in tar file versions of the TOC archive.
-     *
-     * Each entry is of type KTocEntryIndex;
-     */
-    BSTree		offset_index;
-    KSraHeader *	header;
-
-
-    /* -----
-     * This is the full path of the archive file as used to open it as a KFile.
-     */
-    String		path;
-
-};
-
-/* four fields are common to all entries.*/
-
-
-/* GetName
- *
- *  [RET] rc_t                  0 for success; anything else for a failure
- *                       see itf/klib/rc.h for general details
- *  [IN]     const KTocEntry *  self        object oriented object reference
- *  [OUT] const char **         name        where to put a reference to the name
- */
-rc_t KTocEntryGetName(const KTocEntry *self,
-                     const char ** name);
-
-/* GetTime
- *
- * [RET] rc_t                   0 for success; anything else for a failure
- *                      see itf/klib/rc.h for general details
- * [IN]  const KTocEntry *  self        object oriented object reference
- * [OUT] KTime_t *      mtime       where to put unix/posix style permission flags
- */
-rc_t KTocEntryGetTime(const KTocEntry *self,
-                     KTime_t *mtime);
-
-/* GetAccess
- *
- * [RET] rc_t                   0 for success; anything else for a failure
- *                             see itf/klib/rc.h for general details
- * [IN]  const KTocEntry *  self        object oriented object reference
- * [OUT] uint32_t       access      where to put unix/posix style permission flags
- */
-rc_t KTocEntryGetAccess(const KTocEntry * self, uint32_t * access);
-
-
-/* GetType
- *
- * [RET] rc_t                   0 for success; anything else for a failure
- *                      see itf/klib/rc.h for general details
- * [IN]  const KTocEntry *  self        object oriented object reference
- * [OUT] KTocEntryType *    type        where to put the type specific node type (differs
- *                      from KDirectory type)
- */
-rc_t KTocEntryGetType(const KTocEntry *self,
-                     KTocEntryType * type);
-/* the type retrieved by GetType will permit several more fields specialized by type */
-/* for a directory the only specialzied field is the "BSTree" */
-
-#if 0
-const char * KTocEntryGetTypeString(KTocEntryType type);
-#endif
-
-/* GetBSTree
- *
- * Get a reference to the BSTree of a TocEntry that represents a directory.
- * This will fail for all ites taht are not directories.
- *
- * [RET] rc_t                   0 for success; anything else for a failure
- *                      see itf/klib/rc.h for general details
- * [IN]  const KTocEntry *  self        object oriented object reference
- * [OUT] const BSTree **    ptree       where to put a reference to the kcont/BSTree of a
- *                      directory node
- */
-rc_t KTocEntryGetBSTree( const KTocEntry * self,
-                         struct BSTree const ** ptree);
-
-/* for a file there are two fields: a container offset and a file size */
-
-
-/* GetFileLocator (works for contiguous or chunked files)
- *
- * [RET] rc_t                   0 for success; anything else for a failure
- *                      see itf/klib/rc.h for general details
- * [IN]  const KTocEntry *  self        object oriented object reference
- * [OUT] uint64 *       locator        where to put the locator of a referenced node
- */
-rc_t KTocEntryGetFileLocator( const KTocEntry * self,
-                              uint64_t * locator);
-
-
-/* GetFileSize (works for contiguous or chunked files)
- *
- * [RET] rc_t                   0 for success; anything else for a failure
- *                      see itf/klib/rc.h for general details
- * [IN]  const KTocEntry *  self        object oriented object reference
- * [OUT] uint64 *       size        where to put the size of a referenced node
- */
-rc_t KTocEntryGetFileSize( const KTocEntry * self,
-                     uint64_t * size);
-
-
-/* GetFilePhysicalSize (works for contiguous or chunked files)
- *
- * [RET] rc_t                   0 for success; anything else for a failure
- *                      see itf/klib/rc.h for general details
- * [IN]  const KTocEntry *  self        object oriented object reference
- * [OUT] uint64 *       size        where to put the size of a referenced node
- */
-rc_t KTocEntryGetFilePhysicalSize( const KTocEntry * self,
-                                   uint64_t * size);
-
-
-/* GetFileContiguous (works for contiguous or chunked files)
- *
- * [RET] rc_t                   0 for success; anything else for a failure
- *                      see itf/klib/rc.h for general details
- * [IN]  const KTocEntry *  self        object oriented object reference
- * [OUT] uint64 *       size        where to put the size of a referenced node
- */
-rc_t KTocEntryGetFileContiguous( const KTocEntry * self,
-                                 bool * contiguous);
-
-
-/* GetFileOffset
- *
- * For normal contiguous file nodes 'offset' gets the offset to the start of the file.
- * For all other nodes, 'offset' gets 0 with an appropriate rc_t return.
- *
- *
- * [RET] rc_t                   0 for success; anything else for a failure
- *                      see itf/klib/rc.h for general details
- * [IN]  const KTocEntry *  self        object oriented object reference
- * [OUT] uint64 *       offset      where to put the offset of a referenced node
- */
-rc_t KTocEntryGetFileOffset( const KTocEntry * self,
-                     uint64_t * offset);
-
-
-/* GetHardTarget
- *
- * [RET] rc_t                   0 for success; anything else for a failure
- *                      see itf/klib/rc.h for general details
- * [IN]  const KTocEntry *  self        object oriented object reference
- * [OUT] const KTocEntry ** target      where to put a reference from a hard link node
- */
-rc_t KTocEntryGetHardTarget( const KTocEntry *self,
-                     const KTocEntry ** target);
-
-/* there are two specialzied fields for chunked files - both retrieved with the saem method */
-
-
-/* GetChunks
- *
- * [RET] rc_t                   0 for success; anything else for a failure
- *                      see itf/klib/rc.h for general details
- * [IN]  const KTocEntry *  self        object oriented object reference
- * [OUT] const KTocChunk *  chunks      where to put the size of a referenced node
- */
-rc_t KTocEntryGetChunks (const KTocEntry * self,
-                     uint32_t * num_chunks,
-                     const KTocChunk ** chunks);
-
-/* GetSoftTarget
- *
- * [RET] rc_t                   0 for success; anything else for a failure
- *                      see itf/klib/rc.h for general details
- * [IN]  const KTocEntry *  self        object oriented object reference
- * [OUT] const char **      target      where to put a reference from a hard link node
- */
-rc_t KTocEntryGetSoftTarget (const KTocEntry *self,
-                     const char ** target);
-
-
-/*--------------------------------------------------------------------------
- * KToc
- *  archive table of contents
- *
- *  the "CreateXXX" series of methodss take a KCreateMode ( see kfs/directory.h ).
- *  when mode == kcmOpen, create if needed, overwrite if exists.
- *  when mode == kcmInit, create if needed, clear if exists.
- *  when mode == kcmCreate, fail if exists, create otherwise.
- *  if mode has kcmParents set, fill in missing parents on create.
- *
- * These is the only open API into a TOC with in the archive package of classes.
- * Functions to parse archives (Tar was the first format but is not expected to 
- * be the only format) use these methods to add entries to the TOC.  New parsers
- * should fit the signature of 
- *
- *  rc_t PARSER (KToc * <TOC>, const KFile * <ARCHIVE>)
- *
- * "PARSER" [IN] is the parsing function
- *
- * "TOC" [OUT] is a opaque class that is never exposed other than to these create
- * entry methods
- *
- * "FILE" [IN] is an archive opaquely opened as a KFile and then given to a
- * KDirectory and should not be accessed from outside this parsing function.
- *
- * An Archive is opened via a call to friend function.  It has by design been
- * made to mimic the signature of KDirectoryOpenDirRead with only a change in
- * parameters after path.  No "..." or va_list is supported.  To use that
- * functionality one would have to call KDirectoryResolvePath and use the
- * new path generated by that call as the path parameter for this function.
- *
- * rc_t KDirectoryOpenArcDirRead (const KDirectory * dir, 
- *                    KDirectory ** pdir,
- *                    bool chroot,
- *                    const char * path,
- *                    rc_t (CC* parse )(KToc *,const KFile*));
- *
- * "dir" [IN] is an existing KDirectory in which to find the archive file.
- *
- * "pdir" [OUT] is a pointer which will after the function is called point to the new
- * KDirectory that is the archive opened as a directory with the same name as
- * its containing file.
- *
- * "chroot" [IN] is false(1)/true(1 [or any non zero]) as to whether the archive will
- * treat its contents as a virtual root directory ('/') or not.
- *
- * "path" [IN] is the address with in directory of the archive.
- *
- * "parse" [IN] is the function that will create TOC entries for that archive.
- *
- * No member element or function of an object of class TOC will be exposed
- * other than these create entry methods.
- */
-typedef struct KToc KToc;
-
-/* Init
- *  construct a TOC tied to a KFile with a given path
- * At this point, this method has been made private and will only be called by 
- * KDirectoryOpenArcDirRead().
- */
-
-rc_t KTocInit( KToc**self, struct String const * path, KArcFSType arctype,
-        const void * archive, KSRAFileAlignment alignment);
-
-/* AddRef
- * Release
- *  ignores NULL references
- */
-rc_t KTocAddRef( const KToc *self );
-rc_t KTocRelease( const KToc *self );
-
-
-/* AddRef
- * Release
- *  ignores NULL references
- * At this point, these methods have been made private and will only be called by 
- * with in the archive package.  References to the TOC will be handled within 
- * the constructors and destructors for KDirectorys and KFiles created by
- * KDirectory OpenArcDirRead() and then any KDirectory OpenFileRead() and 
- * KDirectory OpenDirRead() with in that initial KDirectory().  At this point
- * archives are read only so OpenFileWrite() OpenDirWrite() CreateDir() CreateFile()
- * and other such methods are not supported for archives.
- */
-rc_t KTocAddRef ( const KToc *self );
-rc_t KTocRelease ( const KToc *self );
-
-
-/* ResolvePathNode
- *
- *
- * [RET] rc_t                   0 for success; anything else for a failure
- *                      see itf/klib/rc.h for general details
- * [IN]  const KToc *   self        TOC self reference: object oriented in C
- * [IN]  const char *       path        the path to be parsed - it will start at the root 
- *                      of the TOC's address
- * [OUT] const KTocEntry **     pnode       the address of the final node traversed is put here
- * [OUT] uint32_t *         type        the type of node for the final node
- * [OUT] char **        unusedpath  This will point to any part of the path not used up
- *                      in parsing against the TOC.
- *                      NULL if the leaf node was found
- *                      the start of a node that could not be parsed
- *                      the start of the node after a softlink (or NULL)
- */
-rc_t KTocResolvePathTocEntry( const KToc *self,
-                         const KTocEntry ** pnode,
-                         const char *path,
-                         size_t path_len,
-                         KTocEntryType * ptype,
-                         const char ** unusedpath);
-
-/*--------------------------------------------------------------------------
- * Constructors/factories
- */
-
-/* CreateDir
- *  create a sub-directory
- *
- *  "mode" [ IN ] - a creation mode ( see explanation above ).
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target directory
- */
-rc_t KTocCreateDir ( KToc *self, KTime_t mtime, uint32_t access, 
-        KCreateMode mode, const char *path, ... );
-rc_t KTocVCreateDir ( KToc *self, KTime_t mtime, uint32_t access,
-        KCreateMode mode, const char *path, va_list args );
-
-/* CreateFile
- *  create an entry for a contiguous file
- *
- *  "source_position" [ IN ] and "size" [ IN ] - description of the contiguous
- *  region of the archive file occupied by the file
- *
- *  "mode" [ IN ] - a creation mode ( see explanation above ).
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- *
- * This is used also to create an empty file.  When size is zero the underlying 
- * library might create a special zero length entry type.
- */
-rc_t KTocCreateFile ( KToc *self, uint64_t source_position, uint64_t size,
-              KTime_t mtime, uint32_t access, KCreateMode mode,
-              const char *path, ... );
-rc_t KTocVCreateFile ( KToc *self, uint64_t source_position, uint64_t size,
-               KTime_t mtime, uint32_t access, KCreateMode mode,
-               const char *path, va_list args );
-rc_t KTocCreateZombieFile ( KToc *self, uint64_t source_position, uint64_t size,
-              KTime_t mtime, uint32_t access, KCreateMode mode,
-              const char *path, ... );
-rc_t KTocVCreateZombieFile ( KToc *self, uint64_t source_position, uint64_t size,
-               KTime_t mtime, uint32_t access, KCreateMode mode,
-               const char *path, va_list args );
-
-/* CreateChunkedFile
- *  create an entry for a chunked file
- *
- *  a chunked file consists of 0 or more possibly discontiguous chunks
- *  positioned within the logical file
- *
- *  "size" [ IN ] - the size of the logical file
- *
- *  "num_chunks" [ IN ] - the number of chunks in "chunks"
- *
- *  "chunks" [ IN ] - an array of chunk descriptors, where each chunk
- *  contains valid data that are mapped to form file
- *
- *  "mode" [ IN ] - a creation mode ( see explanation above ).
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- */
-rc_t KTocCreateChunkedFile ( KToc *self, uint64_t size, KTime_t mtime,
-                 uint32_t access, uint32_t num_chunks,
-                 const KTocChunk chunks [], KCreateMode mode,
-                 const char *path, ... );
-rc_t KTocVCreateChunkedFile ( KToc *self, uint64_t size, KTime_t mtime,
-                  uint32_t access, uint32_t num_chunks,
-                  const KTocChunk chunks [], KCreateMode mode,
-                  const char *path, va_list args );
-
-/* CreateHardLink
- *  creates a hard link to an existing file within TOC
- *
- *  "mode" [ IN ] - a creation mode ( see explanation above ).
- *
- *  "targ" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- *
- *  "link" [ IN ] - NUL terminated string in directory-native
- *  character set denoting alias
- */
-rc_t KTocCreateHardLink ( KToc *self, KTime_t mtime, uint32_t access,
-              KCreateMode mode, const char *targ,
-              const char *link, ... );
-rc_t KTocVCreateHardLink ( KToc *self, KTime_t mtime, uint32_t access,
-               KCreateMode mode, const char *targ,
-               const char *link, va_list args );
-
-/* CreateSoftLink
- *  creates a soft link to any file or directory
- *  that is interpreted upon acces.
- *
- *  "mode" [ IN ] - a creation mode ( see explanation above ).
- *
- *  "targ" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- *
- *  "alias" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target alias
- */
-rc_t KTocCreateSoftLink ( KToc * self, KTime_t mtime, uint32_t access,
-              KCreateMode mode, const char * targ,
-              const char * alias, ... );
-rc_t KTocVCreateSoftLink ( KToc * self, KTime_t mtime, uint32_t access,
-               KCreateMode mode, const char * targ,
-               const char * alias, va_list args );
-
-/* OpenArcDirRead
- *  Open an archive file as a KDirectory derived type: made to match 
- *  KDirectoryOpenDirRead() where parse could be the first element of arg
- *
- * [IN]  dir    A KDirectory (of any derived type) to reach the archive file
- * [OUT] pdir   The KDirectory (of type KArcDir) that will be created
- * [IN]  chroot if non-zero, the new directory becomes chroot'd and interprets paths
- *      stating with '/'
- * [IN]  path   The path to the archive - this will become the directory path
- * [IN]  parse  A pointer to the function needed to build a TOC by parsing the file
- *
- * parameters to parse
- * REQUIRED:    KToc *
- * REQUIRED:    void *  KFile* | KDirectory* | ???
- * OPTIONAL:    bool (*)(const char*)           Filter: include or skip this path
- * OPTIONAL:    rc_t (*)(???)               Sort: reorder name list
- */
-
-KFS_EXTERN
-rc_t CC KDirectoryOpenArcDirRead (const KDirectory * dir, 
-            const KDirectory ** pdir,
-            bool chroot,
-            const char * path,
-            KArcFSType baseType,
-            rc_t (CC*parse)(KToc*,const void *,
-                bool(CC*)(const KDirectory*,const char *, void*),
-                void *),
-                bool (CC* filter )(const KDirectory*, const char *, void *),
-            void * filterparam );
-
-
-#if 0
-rc_t KTocResolvePathTocEntry( const KToc *self,
-                 const KTocEntry ** pnode,
-                 const char *path,  /* must be entirely in the TOC */
-                 size_t path_len,
-                 KTocEntryType * ptype,
-                 const char ** unusedpath);
-#endif
-
-
-
-const KTocEntry* KTocGetRoot( const KToc * self );
-
-#if 0
-const char * KTocGetRootPath( const KToc * self, size_t * len );
-#endif
-
-rc_t KTocGetPath( const KToc * self, struct String const ** path );
-rc_t KTocResolvePathFromOffset( const KToc *self,
-                const char ** path,
-                uint64_t * ppos,
-                uint64_t offset );
-
-KSRAFileAlignment KTocAlignmentGet( KToc * self );
-rc_t KTocAlignmentSet( KToc * self,KSRAFileAlignment align );
-
-const void * KTocGetArchive( const KToc * self );
-
-KFS_EXTERN rc_t KTocPersist( const KToc * self,
-                             void ** buffer, size_t * buffer_size,
-                             uint64_t * virtual_file_size,
-                             struct Vector const * files );
-
-KFS_EXTERN rc_t CC KTocEntryPersist( void *param, const void * node,
-                                     size_t * num_writ, 
-                                     PTWriteFunc write, void * write_param );
-
-rc_t KTocInflatePBSTree (KToc * self, uint64_t arcsize, const void * treestart,
-                         uint32_t maxsize, uint64_t offset,
-                         bool rev, const char * path);
-
-rc_t KArcDirPersistHeader	(const KArcDir * self,
-    void ** buffer, size_t * buffer_size, uint64_t * file_sile, uint32_t align,
-    rc_t ( CC *sort )(const struct KDirectory*, struct Vector*) );
-
-
-/* ----------------------------------------------------------------------
- * KArcDirGetTOC
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [IN]  const KArcDir *	self		Object oriented C; KArcDir object for this method
- * [OUT] const KToc **		toc
- */
-rc_t  KArcDirGetTOC (const struct KArcDir * self, const struct KToc ** toc);
-
-
-
-#endif /* #ifndef _h_kfs_toc_priv_h_ */
-/* end of file */
diff --git a/libs/kfs/toc.c b/libs/kfs/toc.c
deleted file mode 100644
index aeaea37..0000000
--- a/libs/kfs/toc.c
+++ /dev/null
@@ -1,1738 +0,0 @@
-/*===========================================================================
- *
- *                            Public DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-#include <kfs/extern.h>
-#include <atomic32.h>
-#include <klib/container.h>
-#include <klib/vector.h>
-#include <klib/pbstree.h>
-#include <klib/text.h>
-#include <kfs/arc.h>
-#include <kfs/sra.h>
-#include <kfs/toc.h>
-#include <kfs/directory.h>
-#include <kfs/file.h>
-#include <klib/log.h>
-#include <klib/debug.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include "toc-priv.h"
-
-#include <assert.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-/* ======================================================================
- * Defines relevant to the whole compilation unit.
- */
-
-/* !!!!!!!! WHY ISN'T THIS IN A COMMON PRIVATE HEADER FILE? !!!!!!! */
-rc_t SraHeaderMake (KSraHeader ** pself, size_t treesize, KSRAFileAlignment alignment);
-
-/* ======================================================================
- * KTocEntryStack
- *
- * A private class used to keep track of directories passed through while adding
- * entries to the TOC.
- *
- * private little class for handling a stack of pointers to TOC entrys
- */
-struct KTocEntryStack
-{
-    unsigned		count;
-    unsigned		allocated;
-    KTocEntry **	stack;
-};
-
-/* ----------------------------------------------------------------------
- * KTocEntryStackNew
- * [OUT] KTocEntryStack ** 	pself		object oriented object reference where
- * construct a Entry Stack at where the pointer to pointer so self points
- *						to put the reference to the new object
- */
-rc_t KTocEntryStackNew( KTocEntryStack ** self )
-{
-#define ARBITRARY_STACK_SIZE	(16)
-    if (self == NULL)
-	return RC (rcFS, rcToc, rcConstructing, rcParam, rcNull);
-
-    *self = malloc (sizeof (KTocEntryStack));
-    (*self)->count = 0;
-    (*self)->allocated = ARBITRARY_STACK_SIZE;
-    (*self)->stack = malloc ((*self)->allocated * sizeof (KTocEntry*));
-    if ((*self)->stack == NULL)
-	return RC (rcFS, rcToc, rcAllocating, rcMemory, rcInsufficient);
-    return 0;
-}
-
-/* ----------------------------------------------------------------------
- * KTocEntryStackDel
- *
- * destruct a Entry Stack
- *
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [IN] KTocEntryStack *	self		object oriented object reference what to destroy
- */
-rc_t KTocEntryStackDel( KTocEntryStack * self )
-{
-
-    /* empty stack there so just return ok for now */
-    if (self == NULL)
-	return 0;
-
-    if (self->stack != NULL)
-	free (self->stack);
-
-    free (self);
-    return 0;
-}
-
-/* ----------------------------------------------------------------------
- * KTocEntryStackDepth
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [IN]  KTocEntryStack * 	self		object oriented object reference
- * [OUT] int			depth		return the current depth/length of the stack
- *						(int allows compiler flexibilty to use
- *						efficient type)
- */
-rc_t KTocEntryStackDepth( KTocEntryStack * self, int * depth )
-{
-    *depth = self->count;
-    return 0;
-}
-
-/* ----------------------------------------------------------------------
- * KTocEntryStackPush
- *
- * adds a reference to KTocEntry to the stack
- *
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [IN] KTocEntryStack *	self		object oriented object reference what to destroy
- * [IN] KTocEntry * 		pathaddr	the entry to add
- */
-rc_t KTocEntryStackPush( KTocEntryStack * self, KTocEntry * pathaddr )
-{
-#define ARBITRARY_INCREMENT_SIZE	(8)
-
-    if (self == NULL)
-	return RC (rcFS, rcToc, rcInserting, rcSelf, rcNull);
-
-    if (self->count >= self->allocated)
-    {
-	KTocEntry **	stack;
-	int	new_allocated = self->allocated + ARBITRARY_INCREMENT_SIZE;
-	stack = realloc (self->stack, self->allocated * sizeof (KTocEntry*));
-	if (stack == NULL)
-	{
-	    return RC (rcFS, rcToc, rcAllocating, rcMemory, rcInsufficient);
-	}
-	self->allocated = new_allocated;
-	self->stack = stack;
-    }
-    self->stack[self->count++] = pathaddr;
-    return 0;
-}
-
-/* ----------------------------------------------------------------------
- * KTocEntryStackPop
- *
- * removess a reference to KTocEntry to the stack (not C++STLish but more normal stack operation)
- *
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [IN]  KTocEntryStack * 	self		object oriented object reference what to destroy
- * [OUT] KTocEntry ** 	pathaddr	where to put the reference to the entry removed
- */
-rc_t KTocEntryStackPop( KTocEntryStack * self, KTocEntry ** pathaddr )
-{
-    if (self == NULL)
-	return RC (rcFS, rcToc, rcReading, rcSelf, rcNull);
-
-    if (pathaddr == NULL)
-	return RC (rcFS, rcToc, rcReading, rcParam, rcNull);
-
-    if (self->count == 0)
-    {
-	/* -----
-	 * this means empty stack and is not considered an error
-	 * though it should be looked for by the caller
-	 */
-	*pathaddr = NULL;
-    }
-    else
-    {
-	*pathaddr = self->stack[--(self->count)];
-    }
-    return 0;
-}
-
-
-static
-int CC KTocEntryIndexCmp2 (const BSTNode * n, const BSTNode * p)
-{
-    uint64_t nos;
-    uint64_t noe;
-    uint64_t pos;
-    uint64_t poe;
-
-    assert (n != NULL);
-    assert (p != NULL);
-    {
-	const KTocEntryIndex * ne = (const KTocEntryIndex*)n;
-	nos = ne->entry->u.contiguous_file.archive_offset;
-	noe = nos + ne->entry->u.contiguous_file.file_size;
-    }
-    {
-	const KTocEntryIndex * pe = (const KTocEntryIndex*)p;
-	pos = pe->entry->u.contiguous_file.archive_offset;
-	poe = pos + pe->entry->u.contiguous_file.file_size;
-    }
-    if ((nos == pos)&&(noe == poe))
-	return 0;
-    if (noe <= pos)
-	return -1;
-    return 1;
-}
-
-static
-uint64_t add_filler (uint64_t z, KSRAFileAlignment a)
-{
-    if (a > 1)
-    {
-        uint64_t m = (uint64_t)a - 1;
-        return (z + m) & ~ m;
-    }
-    return z;
-}
-
-static
-rc_t KTocCreateEntryIndex (KToc * self, const char * path, uint64_t * file_offset)
-{
-    rc_t rc;
-    size_t len;
-    union idx
-    {
-	void * v;
-	KTocEntryIndex * i;
-	char * b;
-    } idx;
-    KTocEntryType type;
-/*     const KTocEntry * entry; */
-    const char * left;
-
-    TOC_FUNC_ENTRY();
-
-    assert (self != NULL);
-    assert (path != NULL);
-
-    rc = 0;
-
-    len = strlen (path);
-    idx.v = malloc (sizeof (*idx.i) + len + 1);
-    if (idx.v == NULL)
-    {
-	rc = RC (rcFS, rcToc, rcReindexing, rcMemory, rcExhausted);
-	LOGERR( klogErr, rc, "Out of memory creating new path");
-    }
-    else
-    {
-	char * tmp;
-
-        type = ktocentrytype_unknown;
-	tmp = idx.b + sizeof (*idx.i);
-	strcpy (tmp, path);
-	StringInitCString (&idx.i->fullpath, tmp);
-	rc = KTocResolvePathTocEntry (self, (const KTocEntry**)&idx.i->entry, path, len, &type, &left);
-	if (rc != 0)
-	    LOGERR( klogErr, rc, "Unable to resolve path");
-	else
-	{
-/* 	    if (left != 0) */
-/* 		rc = RC (rcFS, rcToc, rcAccessing, rcPath, rcNotFound); */
-/* 	    else */
-	    {
-                uint64_t offset;
-                uint64_t new_offset;
-		switch (type)
-		{
-		case ktocentrytype_dir:
-		case ktocentrytype_softlink:
-		case ktocentrytype_hardlink:
-		case ktocentrytype_emptyfile:
-		    goto no_entry;
-		case ktocentrytype_file:
-                    offset = add_filler (*file_offset, self->alignment);
-                    idx.i->entry->u.contiguous_file.archive_offset = offset;
-                    new_offset = offset + idx.i->entry->u.contiguous_file.file_size;
-		    break;
-		case ktocentrytype_chunked:
-                    offset = add_filler (*file_offset, self->alignment);
-		    idx.i->entry->u.chunked_file.archive_offset = offset;
-		    new_offset = offset + idx.i->entry->u.chunked_file.file_size;
-		    break;
-		case ktocentrytype_unknown:
-		    rc = RC (rcFS, rcToc, rcReindexing, rcTocEntry, rcUnknown);
-		    break;
-		case ktocentrytype_notfound:
-		    rc = RC (rcFS, rcToc, rcReindexing, rcTocEntry, rcNotFound);
-		    break;
-		default:
-		    rc = RC (rcFS, rcToc, rcReindexing, rcTocEntry, rcInvalid);
-		    break;
-		}
-		if (rc != 0)
-		    LOGERR( klogErr, rc, "Unable to handle path");
-		else
-		{
-		    rc = BSTreeInsert (&self->offset_index, &idx.i->node, KTocEntryIndexCmp2);
-		    if (rc == 0)
-		    {
-			*file_offset = new_offset;
-			return 0;
-		    }
-		}
-	    }
-	}
-    no_entry:
-	free (idx.v);
-    }
-    return rc;
-}
-
-static
-void CC KTocEntryIndexWhack (BSTNode * n, void * data)
-{
-    free (n);
-}
-
-struct ugliness
-{
-    const KToc * toc;
-    uint64_t     offset;
-    uint64_t     foffset;
-};
-
-static
-int CC KTocEntryIndexCmpOffset (const void * item /* offset */, const BSTNode * n)
-{
-    struct ugliness * ugly;
-    uint64_t nos;
-    uint64_t noe;
-    uint64_t po;
-    assert (item != NULL);
-    assert (n != NULL);
-    ugly = (struct ugliness*)item;
-    {
-	const KTocEntryIndex * ne = (const KTocEntryIndex*)n;
-	nos = ne->entry->u.contiguous_file.archive_offset;
-	noe = add_filler (nos + ne->entry->u.contiguous_file.file_size, ugly->toc->alignment);
-    }
-    po = ugly->offset;
-
-    TOC_DEBUG (("%s: %lu %lu %lu\n", __func__, po, nos, noe));
-
-    ugly->foffset = 0;
-    if (po < nos)
-	return -1;
-    else if (po < noe)
-    {
-        ugly->foffset = po - nos;
-	return 0;
-    }
-    else
-	return 1;
-}
-
-/* -----
- * We use MAX_PATH if it is available but not religiously.  We handle most
- * buffer over-runs with in the module only truncating paths at the border
- * of the module where KDirectory doesn't handle path's longer than MAX_PATH
- */
-#ifdef MAX_PATH
-#define	KARC_DEFAULT_PATH_ALLOC			(MAX_PATH)
-#else
-#define	KARC_DEFAULT_PATH_ALLOC			(4096)
-#endif
-
-/* ======================================================================
- * KToc method prototypes and defines
- */
-
-/*--------------------------------------------------------------------------
- * KToc
- *  archive table of contents
- *
- *  the "CreateXXX" series of messages take a KCreateMode (see kfs/directory.h).
- *  when mode == kcmOpen, create if needed, overwrite if exists.
- *  when mode == kcmInit, create if needed, clear if exists.
- *  when mode == kcmCreate, fail if exists, create otherwise.
- *  if mode has kcmParents set, fill in missing parents on create.
- */
-
-
-/* ======================================================================
- * KToc method bodies
- */
-
-/* ----------------------------------------------------------------------
- * KToc
- *  archive table of contents
- *
- *  the "CreateXXX" series of messages take a KCreateMode (see kfs/directory.h).
- *  when mode == kcmOpen, create if needed, overwrite if exists.
- *  when mode == kcmInit, create if needed, clear if exists.
- *  when mode == kcmCreate, fail if exists, create otherwise.
- *  if mode has kcmParents set, fill in missing parents on create.
- */
-
-rc_t KTocInit ( KToc ** self,
-                const String * path,
-                KArcFSType arctype,
-                const void * archive,
-                KSRAFileAlignment alignment )
-{
-    char * str_data;
-    rc_t rc;
-
-    /* -----
-     * expected failure mode is NULL references for needed initializers
-     */
-    if (self == NULL)
-    {
-	return RC (rcFS, rcToc, rcConstructing, rcSelf, rcNull);
-    }
-    if ((path == NULL)||(archive == NULL))
-    {
-	return RC (rcFS, rcToc, rcConstructing, rcParam, rcNull);
-    }
-
-    /* -----
-     * get memory for the TOC and for its path
-     */
-    *self = malloc (sizeof(KToc) + StringSize(path) + 1);
-
-    /* -----
-     * expected failure mode is memory allocation failure
-     */
-    if (*self == NULL)
-    {
-	return RC (rcFS, rcToc, rcAllocating, rcMemory, rcInsufficient);
-    }
-
-    /* -----
-     * point past the KToc structure in the allocated memory for the
-     * string path of this TOC
-     */
-    str_data = (char *)*self + sizeof (KToc);
-
-    /* -----
-     * reference the existing KFile
-     */
-    switch ((*self)->arctype = arctype)
-    {
-    default:
-	free (self);
-	return RC (rcFS, rcToc, rcConstructing, rcParam, rcInvalid);
-    case tocKFile:
-	KFileAddRef ((*self)->archive.v = archive);
-	break;
-    case tocKDirectory:
-	KDirectoryAddRef ((*self)->archive.v = archive);
-	break;
-    }
-
-/* need to set back pointer karchive */
-
-    /* -----
-     * We added here by default
-     */
-    atomic32_set (&(*self)->refcount, 1);
-
-    /* -----
-     * a tad clunky
-     */
-    string_copy (str_data, 1 + StringSize(path), path->addr, StringSize(path));
-    StringInit (&((*self)->path), str_data, StringSize(path), StringLength(path));
-    rc = (KTocAlignmentSet (*self, alignment));
-    if (rc == 0)
-    /* -----
-     * Build the "root directory" structure for the TOC initialized to empty
-     */
-    {
-	KTocEntry * pentry = &(*self)->entry;
-	const char *  pchar = strrchr ((*self)->path.addr, '/') + 1;
-	size_t	      size = (*self)->path.size - (pchar - (*self)->path.addr);
-
-	if (pchar == NULL)
-	    pchar = (*self)->path.addr;
-
-	StringInit ( &pentry->name, pchar, size, (uint32_t)size );
-	pentry->type = ktocentrytype_dir;
-	BSTreeInit(&pentry->u.dir.tree);
-        BSTreeInit(&(*self)->offset_index);
-        (*self)->header = NULL;
-    }
-    return rc;
-}
-
-/* ----------------------------------------------------------------------
- * AddRef
- *  ignores NULL references
- */
-rc_t KTocAddRef ( const KToc *self )
-{
-    KToc *	mutable_self = (KToc*)self; /* strip const protection for mutable field */
-
-    if (mutable_self != NULL)
-	atomic32_inc (&mutable_self->refcount);
-
-    return 0;
-}
-/* ----------------------------------------------------------------------
- * AddRef
- * Release
- *  ignores NULL references
- */
-rc_t KTocRelease ( const KToc *self )
-{
-    KToc *	mutable_self = (KToc*)self; /* strip const protection for mutable field */
-    rc_t	rc = 0;
-
-    if (mutable_self == NULL)
-    {
-	return RC (rcFS, rcToc, rcReleasing, rcSelf, rcNull);
-    }
-
-    if (atomic32_dec_and_test (&mutable_self->refcount))
-    {
-        switch (self->arctype)
-        {
-        case tocUnknown:
-        case tocKVirtual:
-            free((void*)self->archive.v);
-            break;
-
-        case tocKFile:
-            KFileRelease (self->archive.f);
-            break;
-        case tocKDirectory:
-            KDirectoryRelease (self->archive.d);
-            break;
-        }
-	BSTreeWhack (&mutable_self->entry.u.dir.tree, KTocEntryWhack, &rc);
-	BSTreeWhack (&mutable_self->offset_index, KTocEntryIndexWhack, &rc);
-	free (mutable_self);
-    }
-/*     else */
-/*     { */
-/*     } */
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * KTocCreateSubdirs
- *
- * This is a constructor/parse helper method (the p starting the name is meant to 
- * imply a c++/Java private situation)
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [INOUT]KToc * 		self		TOC self reference: object oriented in C
- * [IN]   const char * 		_path		start of directory path
- * [IN]   const char * 		end		end of directory path
- * [IN]   KCreateMode  		mode		whether or not to document the existing?
- * [INOUT]KTocEntryStack * 	pathstack	created outside this function but this is
- *						where it is primarily filled in.  This is
- *						created for use in KTocResolveHardLink
- */
-static
-rc_t	KTocCreateSubdirs (KToc *    self,	   /* TOC self reference: object oriented in C */
-			   const char * _path,   /* start of directory path */
-			   const char * end, 	   /* end of directory path */
-			  KTime_t mtime,
-			   uint32_t access,
-			   KCreateMode  mode,    /* whether or not to document the existing? */
-			   KTocEntryStack * pathstack)
-{
-    const
-	char * 	path = _path;		/* pointer to head of remaining path to parse: starts at the beginning of course */
-    const
-	char *  slash;			/* pointer to the next '/' (or NUL) past the next facet of the path */
-    BSTree *	tree = &self->entry.u.dir.tree;	/* current directory tree we are in */
-    rc_t	rc = 0;		/* general purpose rc_t for calls and our own return */
-    BSTNode *   exists = NULL;		/* is there already a entry with our name? this will be it */
-    bool	success = true;		/*  */
-
-    /* -----
-     * special case of absolute position being turned into relative
-     * skip past initial "/" or "//" in a path
-     */
-    while (*path == '/')
-    {
-	PLOGMSG (klogWarn, (klogWarn,
-                            "skipping initial '/' in $(path)",
-                            PLOG_S(path),
-                            path));
-	++path;
-    }
-
-    /* -----
-     * Now continue on with each facet of the path one at a time
-     */
-    for (;path < end; path = slash+1)
-    {
-	KTocEntry * newentry;			/* new entry for the new name entry: might be a duplicate */
-	bool	      do_insert = false;	/* do we insert a new entry? short cut for later */
-
-	/* -----
-	 * find the next (first) '/' in the remaining path
-	 */
-	slash = strchr (path, '/');
-
-	/* -----
-	 * we've got the last directory in the path if there are no
-	 * more '/' characters or if the next '/' is the last character in the
-	 * path (we don't do white space checks!)
-	 */
-	if (slash == NULL)
-	{
-	    slash = end;
-	}
-
-	/* -----
-	 * first we'll compare our new path against the special '.' and '..'
-	 * special directory pointers
-	 */
-	if ((path[0] == '.')&&(path+1 == slash))	/* . */
-	{
-	    /* -----
-	     * just ignore "here" directory references
-	     */
-	    continue;
-	}
-	else if ((path[0] == '.')&&(path[1] == '.')&&(path+2 == slash))	/* .. */
-	{
-	    /* -----
-	     * for up to parent directory references we try to change to that directory
-	     */
-	    int depth;
-
-	    rc = KTocEntryStackDepth (pathstack, &depth);
-	    if (depth <= 0)
-	    {
-		/* FAILURE */
-		rc = RC (rcFS, rcToc, rcConstructing, rcLink, rcViolated);
-		success = false;
-		break;
-	    }
-	    else
-	    {
-		rc = KTocEntryStackPop (pathstack, &newentry);
-	    }
-	}
-	else
-	{
-	    /* -----
-	     * Create a new directory entry
-	     *
-	     * access isn't really implemented yet so make a directory
-	     * default to read + execute for anyone
-	     *
-	     * we might only be using this directory entry for comparisons <shrug>
-	     */
-	    rc = KTocEntryNewDirectory (&newentry, path, slash - path, mtime, access);
-
-	    /* -----
-	     * pass along failures - no need to change any parts at this point
-	     * but that time may come
-	     */
-	    if (rc != 0)
-	    {
-		LOGMSG (klogErr, "failed to construct a directory entry: memory allocation");
-		return rc;
-	    }
-
-	    exists = BSTreeFind (tree, newentry, KTocEntryCmpVoid);
-
-	    /* -----
-	     * the expected is to insert the entry if it wasn't there but will check
-	     * special circumstances
-	     *
-	     * so plan to insert or not based on whether it is there and expect
-	     * all to be well.
-	     *
-	     * never insert if it already exists
-	     */
-	    do_insert = (bool)((exists == NULL) ?  true : false);
-	    rc = 0;
-
-	    /* -----
-	     * Open/init/create with no make parents:
-	     */
-	    if ((exists == NULL)&& !(mode & kcmParents))
-	    {
-		/* parent did not exist so we will fail */
-		rc = RC (rcFS, rcToc, rcCreating, rcSelf, rcInconsistent);
-		do_insert = false;
-		success = false;
-	    }
-
-	    /* -----
-	     * if rc is set, we had a problem and will fail
-	     */
-	    if (rc != 0)
-	    {
-		LOGERR	(klogErr, rc,
-                                   "directory parse/creation failed");
-		(void)KTocEntryDelete(newentry);
-		break;
-	    }
-
-	    if (do_insert)
-	    {
-		rc = BSTreeInsert (tree, &newentry->node, KTocEntryCmp2);
-		if (rc)
-		{
-		    LOGMSG (klogErr, "directory parse/creation failed 2");
-		    (void)KTocEntryDelete(newentry);
-		    break;
-		}
-                TOC_DEBUG (("%s: inserted new directory into TOC %S\n", __func__, newentry->name));
-	    }
-	    else
-	    {
-		(void)KTocEntryDelete(newentry);
-		newentry = (KTocEntry*)exists;
-	    }
-
-	    /* -----
-	     * move into the subdirectory for the next directory in the path
-	     */
-	    if ((rc = KTocEntryStackPush (pathstack, newentry)) != 0)
-	    {
-		success = false;
-		break;
-	    }
-
-	    tree = &newentry->u.dir.tree;
-	}
-    }
-    return success ? 0 : rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * KTocCreate
- *
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [IN] KToc *		self		TOC self reference: object oriented in C
- * [IN] KCreateMode 		mode		KDirectory defines that define what to so with
- *						"files" that already existed or did not including
- *						missing subdirectories in the path
- * [IN] const char *		ppath		the path name for the new entry relative to the
- *						base of the TOC
- * [IN] const KTocEntryParam*	pparams		specific parameters for this type of entry - the
- *						type of entry is included in this structure
- */
-static rc_t KTocCreate (KToc *self,
-			KCreateMode mode,
-			const char *ppath,
-			const KTocEntryParam * pparams)
-{
-    rc_t		rc;
-    char *		pend;
-    size_t		name_size;
-    BSTree *		ptree;
-    KTocEntry * 	pnewentry = NULL;	/* init to kill a warning */
-    KTocEntry * 	pexistingentry;
-    KTocEntry * 	pwd = NULL;
-    KTocEntryStack *	pdirstack;
-
-    assert (self != NULL);
-    assert (ppath != NULL);
-    assert (pparams != NULL);
-
-    ptree = &self->entry.u.dir.tree;
-
-    if ((rc = KTocEntryStackNew (&pdirstack)) != 0)
-    {
-	return rc;
-    }
-    /* -----
-     * look for a '/' that isn't the last character in the path
-     */
-    pend = string_rchr (ppath, strlen(ppath)-1, '/');
-    if (pend != NULL)
-    {
-
-	rc = KTocCreateSubdirs (self, ppath, pend, pparams->mtime,
-				pparams->access, mode, pdirstack);
-
-	rc = KTocEntryStackPop (pdirstack, &pwd);
-	if (pwd)
-	{
-	    ptree = &(pwd->u.dir.tree);
-	}
-
-	ppath = pend+1;
-    }
-
-    name_size = strlen(ppath);
-    switch (pparams->type)
-    {
-    default:
-	break;
-    case ktocentrytype_dir:
-	rc = KTocEntryNewDirectory (&pnewentry,
-				    ppath,
-				    name_size,
-				    pparams->mtime,
-				    pparams->access);
-	break;
-    case ktocentrytype_file:
-	rc = KTocEntryNewFile (&pnewentry,
-			       ppath,
-			       name_size,
-			       pparams->mtime,
-			       pparams->access,
-			       pparams->u.file.source_position,
-			       pparams->u.file.size);
-	break;
-    case ktocentrytype_zombiefile:
-	rc = KTocEntryNewZombieFile (&pnewentry,
-                                     ppath,
-                                     name_size,
-                                     pparams->mtime,
-                                     pparams->access,
-                                     pparams->u.file.source_position,
-                                     pparams->u.file.size);
-	break;
-    case ktocentrytype_chunked:
-	rc = KTocEntryNewChunked (&pnewentry, 
-				  ppath,
-				  name_size,
-				  pparams->mtime,
-				  pparams->access,
-				  pparams->u.chunked.size,
-				  pparams->u.chunked.chunks,
-				  pparams->u.chunked.num_chunks);
-	break;
-    case ktocentrytype_softlink:
-	rc = KTocEntryNewSoft (&pnewentry, 
-			       ppath,
-			       name_size,
-			       pparams->mtime,
-			       pparams->access,
-			       pparams->u.softlink.targ,
-			       strlen (pparams->u.softlink.targ));
-	break;
-    case ktocentrytype_hardlink:
-	rc = KTocEntryNewHard (&pnewentry, 
-			       ppath,
-			       name_size,
-			       pparams->mtime,
-			       pparams->access,
-                               pparams->u.hardlink.ref);
-	break;
-    }
-/*     if (rc != 0) */
-/* 	; */
-
-    pexistingentry = (KTocEntry*)BSTreeFind (ptree, pnewentry, KTocEntryCmpVoid);
-
-    if (pexistingentry != NULL)
-    {
-	switch (mode & kcmValueMask)
-	{
-	default:
-            LOGMSG (klogInt, "invalis create mode flag for Toc Entry");
-        case kcmOpen:	/* use existing entry if it exists */
-	    KTocEntryDelete (pnewentry);
-	    break;
-
-	case kcmInit:
-	    BSTreeUnlink (ptree, &pexistingentry->node); /*?*/
-	    KTocEntryDelete (pexistingentry);
-            goto insert;
-	    break;
-
-	case kcmCreate:
-	    KTocEntryDelete (pnewentry);
-	    rc = RC (rcFS, rcToc, rcInserting, rcDirEntry, rcDuplicate);
-	    break;
-	}
-    }
-    else
-    {
-    insert:
-	rc = BSTreeInsert (ptree, &pnewentry->node, KTocEntryCmp2);
-        TOC_DEBUG (("%s: inserted new %s into TOC %s\n", __func__,
-		  KTocEntryTypeGetString(pparams->type),
-		  pnewentry->name.addr));
-    }
-#if 0
-    if (pparams->type == ktocentrytype_hardlink)
-    {
-
-	/* -----
-	 * Now the ugly specific part of a hard link - resolve the link
-	 */
-	rc = KTocResolveHardLink (self, pparams->u.hardlink.targ, pdirstack, pwd, &(pnewentry->u.hard_link.ref));
-	if (rc  != 0)
-	{
-	    /* kill off node */
-	    BSTreeUnlink (ptree, &pnewentry->node);
-	    rc = RC (rcFS, rcToc, rcAliasing, rcArcHardLink, rcNotFound);
-	}
-    }
-#endif
-    KTocEntryStackDel (pdirstack);
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * Constructors/factories
- */
-static
-rc_t createPath (char ** newpath, const char * path, va_list args)
-{
-    rc_t rc;
-    char * p;
-    char * pp;
-    size_t l;
-    int i;
-
-    rc = 0;
-    p = NULL;
-    l = 4096;
-    *newpath = p;
-
-    /* not trusting C99 version of vsnprintf is in place rather than SUSv2 */
-    for (;;)
-    {
-	pp = realloc (p,l);
-	if (pp == NULL)
-	{
-	    rc = RC (rcFS, rcToc, rcConstructing, rcMemory, rcExhausted);
-	    return rc;
-	}
-	if (args == NULL)
-	{
-	    i = (int)strlen ( path );
-	    if ( i < (int)l )
-		strcpy ( pp, path );
-	}
-	else
-	    i = vsnprintf (pp, l, path, args);
-	if (i < 0)
-	{
-	    rc = RC (rcFS, rcToc, rcConstructing, rcFormat, rcInvalid);
-	    free (pp);
-	    return rc;
-	}
-	p = pp;
-	if ( i < (int)l )
-	    break;
-	l = i + 1;
-    } 
-
-    *newpath = pp;
-
-    return rc;
-}
-
-
-
-/* ---------
- * CreateDir
- *  create a sub-directory
- *
- *  "mode" [ IN ] - a creation mode (see explanation in kfs/directory.h).
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target directory
- */
-rc_t KTocCreateDir ( KToc *self,KTime_t mtime, uint32_t access,
-		    KCreateMode mode, const char *path, ... )
-{
-    va_list 	args;
-    rc_t	rc;
-
-    va_start (args, path);
-    rc = KTocVCreateDir (self, mtime, access, mode, path, args);
-    va_end (args);
-    return rc;
-}
-
-rc_t KTocVCreateDir ( KToc *self,KTime_t mtime, uint32_t access,
-		     KCreateMode mode, const char *path, va_list args )
-{
-    KTocEntryParam	params;
-    char * npath;
-    rc_t rc;
-
-    TOC_DEBUG (("%s: Name: %s Mode: %s\n", __func__,
-	     path, get_mode_string(mode)));
-
-    rc = createPath (&npath, path, args);
-    if (rc)
-	return rc;
-
-    params.type = ktocentrytype_dir;
-    params.mtime = mtime;
-    params.access = access;
-
-    rc = KTocCreate (self, mode, npath, &params);
-    free (npath);
-    return rc;
-}
-
-/* ----------
- * CreateFile
- *  create an entry for a contiguous file
- *
- *  "source_position" [ IN ] and "size" [ IN ] - description of the contiguous
- *  region of the archive file occupied by the file
- *
- *  "mode" [ IN ] - a creation mode (see explanation above).
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- */
-rc_t KTocCreateFile ( KToc *self,
-		     uint64_t source_position, uint64_t size,
-		    KTime_t mtime, uint32_t access, 
-		     KCreateMode mode, const char *path, ... )
-{
-    va_list 	args;
-    rc_t	rc;
-
-    va_start (args, path);
-    rc = KTocVCreateFile (self, source_position, size,
-			  mtime, access, mode, path, args);
-    va_end (args);
-    return rc;
-}
-
-rc_t KTocVCreateFile ( KToc *self,
-                       uint64_t source_position, uint64_t size,
-                       KTime_t mtime, uint32_t access, 
-                       KCreateMode mode, const char *path, va_list args )
-{
-    KTocEntryParam	params;
-    char * npath;
-    rc_t rc;
-
-    TOC_DEBUG (("%s: Name: %s Mode: %sn Time: %lu\n", __func__,
-                path, get_mode_string(mode), mtime));
-
-
-    rc = createPath (&npath, path, args);
-    if (rc)
-	return rc;
-
-    params.type = ktocentrytype_file;
-    params.mtime = mtime;
-    params.access = access;
-    params.u.file.size = size;
-    params.u.file.source_position = source_position;
-
-    rc = KTocCreate (self, mode, npath, &params);
-    free (npath);
-    return rc;
-}
-
-rc_t KTocCreateZombieFile ( KToc *self,
-                            uint64_t source_position, uint64_t size,
-                            KTime_t mtime, uint32_t access, 
-                            KCreateMode mode, const char *path, ... )
-{
-    va_list 	args;
-    rc_t	rc;
-
-    va_start (args, path);
-    rc = KTocVCreateZombieFile (self, source_position, size,
-                                mtime, access, mode, path, args);
-    va_end (args);
-    return rc;
-}
-
-rc_t KTocVCreateZombieFile ( KToc *self,
-                             uint64_t source_position, uint64_t size,
-                             KTime_t mtime, uint32_t access, 
-                             KCreateMode mode, const char *path, va_list args )
-{
-    KTocEntryParam	params;
-    char * npath;
-    rc_t rc;
-
-    TOC_DEBUG (("%s: Name: %s Mode: %sn Time: %lu\n", __func__,
-                path, get_mode_string(mode), mtime));
-
-
-    rc = createPath (&npath, path, args);
-    if (rc)
-	return rc;
-
-    params.type = ktocentrytype_zombiefile;
-    params.mtime = mtime;
-    params.access = access;
-    params.u.file.size = size;
-    params.u.file.source_position = source_position;
-
-    rc = KTocCreate (self, mode, npath, &params);
-    free (npath);
-    return rc;
-}
-
-/* ---------
- * CreateChunkedFile
- */
-rc_t KTocCreateChunkedFile ( KToc *self, uint64_t size,KTime_t mtime,
-                             uint32_t access, uint32_t num_chunks,
-                             const KTocChunk chunks [], KCreateMode mode,
-                             const char *path, ... )
-{
-    va_list 	args;
-    rc_t	rc;
-
-    va_start (args, path);
-    rc = KTocVCreateChunkedFile (self, size, mtime, access, num_chunks,
-				 chunks, mode, path, args);
-    va_end (args);
-    return rc;
-}
-
-rc_t KTocVCreateChunkedFile ( KToc *self, uint64_t size,KTime_t mtime,
-                              uint32_t access, uint32_t num_chunks,
-                              const KTocChunk chunks [], KCreateMode mode,
-                              const char *path, va_list args )
-{
-    KTocEntryParam	params;
-    unsigned int	ix;
-    rc_t		rc;
-    char * 		npath;
-
-    TOC_DEBUG (("KToc Create Chunked File:: Name: %s Size: %ju Chunk count: %u Mode %s\n",
-                path, size, num_chunks, get_mode_string(mode)));
-
-    for (ix = 0; ix < num_chunks; ++ix)
-    {
-        TOC_DEBUG (( "KToc Create Chunk %u: 0x%jx 0x%jx %ju\n",
-                     ix,
-                     chunks[ix].logical_position,
-                     chunks[ix].source_position,
-                     chunks[ix].size));
-    }
-
-    rc = createPath (&npath, path, args);
-    if (rc)
-	return rc;
-
-    params.type = ktocentrytype_chunked;
-    params.u.chunked.size = size;
-    params.u.chunked.chunks = chunks;
-    params.u.chunked.num_chunks = num_chunks;
-
-    rc = KTocCreate (self, mode, npath, &params);
-    free (npath);
-    return rc;
-}
-
-/* ----------------------------------------------------------------------
- * CreateHardLink
- */
-rc_t KTocCreateHardLink ( KToc *self,KTime_t mtime, uint32_t access,
-                          KCreateMode mode, const char *targ,
-                          const char *link, ... )
-{
-    va_list 	args;
-    rc_t	rc;
-
-    va_start (args, link);
-    rc = KTocVCreateHardLink(self, mtime, access, mode, targ,
-			     link, args);
-    va_end (args);
-    return rc;
-}
-
-rc_t KTocVCreateHardLink ( KToc *self,KTime_t mtime, uint32_t access,
-			  KCreateMode mode, const char *targ,
-			  const char *link, va_list args )
-{
-#if 0
-    KTocEntryParam	params;
-    char * npath;
-    rc_t rc;
-
-
-
-    return rc;
-#else
-    KTocEntryParam	params;
-    char * npath;
-    const char * excess_path;
-    const KTocEntry * targ_entry;
-    KTocEntryType targ_type;
-    rc_t rc;
-
-    TOC_DEBUG (("Hard link:: Name: %s Link: %s Mode: %s\n",
-                link, targ, get_mode_string(mode)));
-
-    /* figure out where we are supposed to point */
-    rc = KTocResolvePathTocEntry (self, &targ_entry, targ, string_size (targ),
-                                  &targ_type, &excess_path);
-    if (rc == 0)
-    {
-        /* hard links to directories are kept as hard links
-         * while other types become true unix style links */
-        switch (targ_type)
-        {
-        case ktocentrytype_dir:
-            rc = createPath (&npath, link, args);
-            if (rc)
-                return rc;
-            params.type = ktocentrytype_hardlink;
-            params.mtime = mtime;
-            params.access = access;
-            params.u.hardlink.ref = targ_entry;
-            rc = KTocCreate (self, mode, npath, &params);
-            free (npath);
-            return rc;
-
-            /* resolve by one indirection */
-        case ktocentrytype_hardlink:
-            rc = createPath (&npath, link, args);
-            if (rc)
-                return rc;
-            params.type = ktocentrytype_hardlink;
-            params.mtime = mtime;
-            params.access = access;
-            params.u.hardlink.ref = targ_entry->u.hard_link.ref;
-            rc = KTocCreate (self, mode, npath, &params);
-            free (npath);
-            return rc;
-
-        case ktocentrytype_file:
-        case ktocentrytype_zombiefile:
-            return KTocCreateFile (self, targ_entry->u.contiguous_file.archive_offset,
-                                   targ_entry->u.contiguous_file.file_size,
-                                   mtime, access, mode, link);
-
-        case ktocentrytype_emptyfile:
-            return KTocCreateFile (self, 0, 0, mtime, access, mode, link);
-
-        case ktocentrytype_chunked:
-            return KTocCreateChunkedFile (self, targ_entry->u.chunked_file.file_size, mtime,
-                                          access, targ_entry->u.chunked_file.num_chunks,
-                                          targ_entry->u.chunked_file.chunks, mode, link);
-
-        case ktocentrytype_softlink:
-            return KTocCreateSoftLink (self, mtime, access, mode, link,
-                                       targ_entry->u.symbolic_link.link_path.addr);
-
-        default:
-        case ktocentrytype_notfound:
-            /* silent ignore? */
-            break;
-        }
-    }
-    return rc;
-#endif
-}
-
-/* ----------------------------------------------------------------------
- * CreateSoftLink
- */
-rc_t KTocCreateSoftLink ( KToc *self,KTime_t mtime, uint32_t access,
-			 KCreateMode mode, const char *targ,
-			 const char *alias, ... )
-{
-    va_list 	args;
-    rc_t	rc;
-
-    va_start (args, alias);
-    rc = KTocVCreateSoftLink (self, mtime, access, mode,
-			      targ, alias, args);
-    va_end (args);
-    return rc;
-}
-
-rc_t KTocVCreateSoftLink ( KToc *self,KTime_t mtime, uint32_t access,
-			  KCreateMode mode, const char *targ,
-			  const char *alias, va_list args )
-{
-    KTocEntryParam	params;
-    char * npath;
-    rc_t rc;
-
-    TOC_DEBUG (("Soft link:: Name: %s Link: %s Mode: %s\n",
-                alias, targ, get_mode_string(mode)));
-
-    rc = createPath (&npath, alias, args);
-    if (rc)
-	return rc;
-
-    params.type = ktocentrytype_softlink;
-    params.mtime = mtime;
-    params.access = access;
-    params.u.softlink.targ = targ;
-
-    rc = KTocCreate (self, mode, npath, &params);
-    free (npath);
-    return rc;
-}
-
-/* ----------------------------------------------------------------------
- *
- */
-const KTocEntry * KTocGetRoot	(const KToc * self)
-{
-    if (self == NULL)
-	return NULL;
-
-    return &self->entry;
-}
-
-rc_t KTocGetPath ( const KToc * self, const String ** ppath )
-{
-    assert (self != NULL);
-    *ppath = &self->path;
-    return 0;
-}
-
-KSRAFileAlignment KTocAlignmentGet( KToc * self )
-{
-    return self->alignment;
-}
-
-rc_t KTocAlignmentSet( KToc * self,KSRAFileAlignment align )
-{
-    if ((align != 0) && (align == ((align)&~(align-1))))
-    {
-        self->alignment = align;
-        return 0;
-    }
-    return RC (rcFS, rcToc, rcConverting, rcParam, rcInvalid);
-}
-
-
-/* const char * KTocGetRootPath (const KToc * self, size_t * len) */
-/* { */
-/*     if (self == NULL) */
-/* 	return NULL; */
-/*     *len = self->path.len; */
-/*     return &self->path.addr;; */
-/* } */
-/*****
- ***** CURRENTLY DOES NOT SUPPORT any form of crossing of
- ***** KDirectory type paths
- *****/
-rc_t KTocResolvePathTocEntry ( const KToc *self,
-                               const KTocEntry ** pentry,
-                               const char *path,	/* must be entirely in the TOC */
-                               size_t path_len,
-                               KTocEntryType * ptype,
-                               const char ** unusedpath )
-{
-    const char *  	slash;		/* points to the / following the current facet */
-    const char *  	next_facet;	/* points to the start of the current facet */
-    const char *	end;		/* points to the character after the path */
-    const KTocEntry * dentry;		/* the current entry we are at during the walk through */
-    KTocEntry * 	tentry;		/* points to a Temporary ENTRY built for comparisons */
-    union
-    {
-	const BSTNode     * b;		/* access to the BSTree Node starting the KToc entry */
-	const KTocEntry * k;		/* access to the whole of the entry */
-    }		  	fentry;		/* Found ENTRY: two ways to access to skip casts */
-    rc_t	  	rc;		/* temporary storage for the return from many calls */
-    size_t	  	facet_size;	/* length of a single facet (part of a path dir or file) */
-    size_t		path_size;	/* temporary size (shrinks as we go through the path */	
-    int		  	loopcount;	/* counter for loop limiting hardlink resolution */
-    KTocEntryType 	type = ktocentrytype_unknown;	/* type of a entry found for a facet (init to kill a warning */
-    bool		is_last_facet = false;
-    bool		is_facet_dir = false; /* if the path ends in / we know the last facet is a dir */
-    int                 outer_loopcount;
-    /* -----
-     * point to one character past the path - usually it will be a NUL but we
-     * are not making that a requirement here
-     */
-    next_facet = path;
-    path_size = path_len;
-    end = next_facet + path_size;
-    dentry = &self->entry;
-
-    /* -----
-     * look first for here references:
-     * either no path (not NULL but "") or just "."
-     */
-    if ((path_len == 0) || ((path_len == 1) && (path[0] == '.')))
-    {
-	*pentry = dentry;
-	*ptype = ktocentrytype_dir;
-	*unusedpath = end;
-	return 0;
-    }
-
-
-    /* -----
-     * now start wending our way down through subdirectories
-     */
-    for (outer_loopcount = 0; next_facet < end; ++ outer_loopcount)
-    {
-        TOC_DEBUG (("%s: stepping through subs (%d) (%s)\n", __func__, outer_loopcount, next_facet));
-
-	/* -----
-	 * look for the end of the next facet in the path
-	 */
-	slash = strchr (next_facet, '/');
-
-	/* -----
-	 * if there was no '/' found then point to the end as that is the end of the facet
-	 * but also mark that we know this is the last one (be it a directory, link or file)
-	 */
-	if (slash == NULL)			
-	{
-	    slash = end;
-	    is_last_facet = true;
-	}
-	/* -----
-	 * handle the special case of a path ending in / which also makes the last facet
-	 * known to be a directory
-	 */
-	else if (slash + 1 == end)
-	{
-	    slash = end;
-	    is_last_facet = true;
-	    is_facet_dir = true;
-	}
-	facet_size = slash - next_facet;	/* how many characters in this facet */
-
-	/* -----
-	 * build a temporary entry for comparisons
-	 */
-	rc = KTocEntryNewDirectory (&tentry, next_facet, facet_size, 0, 0555);
-	if (rc != 0)
-	{
-	    *pentry = NULL;		/* if we couldn't make then fail */
-	    return rc;
-	}
-	fentry.b = BSTreeFind (&dentry->u.dir.tree, tentry, KTocEntryCmpVoid);
-	KTocEntryDelete(tentry);	/* clean up the temporary entry */
-
-	if (fentry.b == NULL)
-	{
-	    /* -----
-	     * we failed to find this facet.
-	     */
-	    *pentry = NULL;		/* if we couldn't make it fail */
-	    *unusedpath = next_facet;	/* the name we couldn't find */
-	    *ptype = ktocentrytype_notfound;
-
-            TOC_DEBUG (("%s: couldn't find (%s)\n", __func__, next_facet));
-
-	    return RC (rcFS, rcArc, rcResolving, rcParam, rcNotFound);
-	}
-
-	loopcount = 0;
-
-	/* check the type to see if we're okay with it */
-	if ((rc = KTocEntryGetType (fentry.k, &type)) != 0)
-	{
-	    if (type == ktocentrytype_notfound)
-	    {
-		*ptype = type;
-	    }
-	    else
-	    {
-		*ptype = ktocentrytype_unknown;
-	    }
-	    *pentry = NULL;		/* if we couldn't then fail */
-	    *unusedpath = next_facet;	/* the name we couldn't find */
-	    return rc;
-	}
-	*ptype = type;
-	switch (type)
-	{
-	    /* -----
-	     * resolve a hardlink immediately 
-	     * re-resolve until we've gone too many hops or the
-	     * resolution is to something that isn't another hardlink
-	     *
-	     * re-enter this switch with the type of the resolved entry
-	     */
-	case ktocentrytype_hardlink:
-	    if (is_last_facet)
-	    {
-		*pentry = fentry.k->u.hard_link.ref;
-		*unusedpath = end;
-		/* successful arrival at the end at a directory */
-		return 0;
-	    }
-	    else
-	    {
-		/* -----
-		 * this is the only path that continues through the loop
-		 */
-		next_facet = slash + 1;	 /* point past the slash */
-		dentry = fentry.k->u.hard_link.ref; /* make the found entry our current entry */
-	    }
-	    continue;	/* back to for(;;) */
-
-	case ktocentrytype_dir:
-	    if (is_last_facet)
-	    {
-		*pentry = fentry.k;
-		*unusedpath = end;
-		/* successful arrival at the end at a directory */
-		return 0;
-	    }
-	    else
-	    {
-		/* -----
-		 * this is the only path that continues through the loop
-		 */
-		next_facet = slash + 1;	/* point past the slash */
-		dentry = fentry.k;	/* make the found entry our current entry */
-	    }
-	    continue;	/* back to for(;;) */
-
-	default:
-	    *pentry = fentry.k;
-	    *ptype = ktocentrytype_unknown;
-	    *unusedpath = next_facet;
-	    /* failure return */
-	    return RC (rcFS, rcToc, rcResolving, rcParam, rcInvalid);
-
-	case ktocentrytype_emptyfile:
-	case ktocentrytype_file:
-	case ktocentrytype_chunked:
-        case ktocentrytype_zombiefile:
-	    *pentry = fentry.k;
-
-	    /* -----
-	     * success if we are on the last facet that wasn't supposed to be a directory
-	     * failure if we are not
-	     */
-	    if (is_last_facet && (! is_facet_dir))
-	    {
-		*unusedpath = end;
-		return 0;
-	    }
-	    else
-	    {
-		*unusedpath = next_facet;
-		return RC (rcFS, rcToc, rcResolving, rcParam, rcInvalid);
-	    }
-
-	case ktocentrytype_softlink:
-	    /* -----
-	     * We got a softlink entry in the path.
-	     */
-	    *pentry = fentry.k;
-	    *unusedpath = slash;
-	    return 0;	/* This is a bit clunky but is a valid incomplete return */
-	}
-    }
-    /* should never get here */
-    return RC (rcFS, rcToc, rcResolving, rcParam, rcUnexpected);
-}
-
-/* SRA tocfile only not tar or other archives only */
-rc_t KTocResolvePathFromOffset ( const KToc *self,
-                                 const char ** path,
-                                 uint64_t * ppos,
-                                 uint64_t _offset )
-{
-    rc_t rc;
-    union u
-    {
-	const BSTNode * n;
-	const KTocEntryIndex * i;
-    } u;
-    uint64_t offset;
-    struct ugliness thisIsReallyUgly;
-
-    rc = 0;
-    offset = _offset - SraHeaderGetFileOffset (self->header);
-
-    TOC_DEBUG(("KTocResolvePathFromOffset _offset %ju offset %ju\n",
-               _offset, offset));
-
-    *path = NULL;
-    *ppos = 0;
-    thisIsReallyUgly.toc = self;
-    thisIsReallyUgly.offset = offset;
-
-    u.n =  BSTreeFind (&self->offset_index, &thisIsReallyUgly, KTocEntryIndexCmpOffset);
-    if (u.n != NULL)
-    {
-	*path = u.i->fullpath.addr;
-	*ppos = thisIsReallyUgly.foffset;
-    }
-    return rc;
-}
-
-const void * KTocGetArchive( const KToc * self )
-{
-    if (self == NULL)
-	return NULL;
-    return self->archive.v;
-}
-				
-
-
-
-typedef struct KDBHdr KDBHdr;
-
-typedef
-struct PersistFilesIndexData
-{
-    uint64_t offset;
-    const KToc * toc;
-    rc_t rc;
-} PersistFilesIndexData;
-
-LIB_EXPORT void CC PersistFilesIndex ( void * vitem, void * vdata )
-{
-    PersistFilesIndexData * data;
-    const char * path;
-
-    TOC_FUNC_ENTRY();
-
-    data = vdata;
-    if (data->rc != 0)
-    {
-        TOC_DEBUG(("PersistFilesIndex leave early %R\n", data->rc));
-	return;
-    }
-    path = (char*)vitem;
-
-    TOC_DEBUG(("PersistFilesIndex %s\n", path));
-
-    data->rc = KTocCreateEntryIndex ((KToc*)data->toc, path, &data->offset);
-}
-
-rc_t KTocPersist ( const KToc * self,
-                   void ** buffer, size_t * buffer_size,
-                   uint64_t * virtual_file_size,
-                   const Vector * files )
-{
-    rc_t rc;
-    size_t treesize;
-    KSraHeader * header;
-    uint8_t * bbuffer;
-    uint64_t filesize;
-
-    TOC_FUNC_ENTRY();
-
-    rc = 0;
-    treesize = 0;
-    bbuffer = NULL;
-    *buffer = NULL;
-    *buffer_size = 0;
-    *virtual_file_size = 0;
-
-    rc = KTocEntryPersistNodeDir (NULL, &self->entry, &treesize, NULL, NULL);
-    if (rc != 0)
-    {
-	LOGMSG (klogErr, "Failure to Persist Toc Root Entry");
-    }
-    else
-    {
-	rc = SraHeaderMake (&header, treesize, self->alignment);
-	if (header == NULL)
-	{
-	    rc = RC (rcFS, rcToc, rcPersisting, rcMemory, rcExhausted);
-	    LOGERR (klogErr, rc, "Failure to allocate buffer for header");
-	}
-	else
-	{
-            TOC_DEBUG (("KTocPersist: treesize %ju\n", treesize));
-
-	    bbuffer = realloc ( header, (size_t)SraHeaderGetFileOffset( header ) );
-	    if (bbuffer == NULL)
-	    {
-		free (header);
-		rc = RC (rcFS, rcToc, rcPersisting, rcMemory, rcExhausted);
-		LOGERR (klogErr, rc, "Failure to allocate buffer for persisted header");
-	    }
-	    else
-	    {
-		PersistFilesIndexData data; 
-
-		header = (KSraHeader*)bbuffer;
-		data.offset = 0;
-		data.toc = self;
-		data.rc = 0;
-
-		VectorForEach (files, false, PersistFilesIndex, &data);
-		filesize = SraHeaderGetFileOffset(header) + data.offset;
-		rc = data.rc;
-		if (rc == 0)
-		{
-                    KTocEntryPersistWriteFuncData wdata;
-                    wdata.buffptr = bbuffer + SraHeaderSize(NULL);
-                    wdata.limit = bbuffer + SraHeaderGetFileOffset(header);
-                    rc = KTocEntryPersistNodeDir (NULL, &self->entry, &treesize,
-                                                  KTocEntryPersistWriteFunc, 
-                                                  &wdata);
-		}
-	    }
-	}
-    }
-    if (rc == 0)
-    {
-	((KToc*)self)->header = (KSraHeader *)bbuffer;
-	*buffer = bbuffer;
-	*buffer_size = treesize + SraHeaderSize(NULL);
-	*virtual_file_size = filesize;
-	return 0;
-    }
-    else if (bbuffer != NULL)
-    {
-        TOC_DEBUG (("Free called in KTocPersist\n"));
-	free (bbuffer);
-    }
-    return rc;
-}
-
-
-/* end of file toc.c */
diff --git a/libs/kfs/tocdir.c b/libs/kfs/tocdir.c
deleted file mode 100644
index 70e2f06..0000000
--- a/libs/kfs/tocdir.c
+++ /dev/null
@@ -1,411 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
- 
-#include <kfs/extern.h>
-#include "toc-priv.h"
-#include <klib/rc.h>
-#include <klib/defs.h>
-#include <klib/namelist.h>
-#include <kfs/directory.h>
-#include <kfs/toc.h>
-#include <klib/debug.h>
-#include <klib/log.h>
-#include <klib/out.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <stdio.h>
-
-static
-rc_t KTocProcessOneNameCommonAtt (const KDirectory * dir,
-				  const char * path,
-				  KTime_t * mtime,
-				  uint32_t * access)
-{
-    rc_t rc;
-
-    *mtime = 0;
-    *access = 0;
-    rc = KDirectoryVDate (dir, mtime, path, NULL);
-    if (rc != 0)
-    {
-	PLOGERR (klogErr, (klogErr, rc, "Failure getting mtime of $(p)", PLOG_S(p), path));
-    }
-    else
-    {
-	rc = KDirectoryVAccess (dir, access, path, NULL);
-	if (rc != 0)
-	{
-	    PLOGERR (klogErr, (klogErr, rc, "Failure getting access of $(p)", PLOG_S(p), path));
-	}
-    }
-    TOC_DEBUG (("%s path %s ktime_t %lu access %o\n", __func__, path, *mtime, *access));
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * KTocParseKDirRecurOnePath
- *
- * take a single path name and add it to the TOC
- *
- * KToc *			self	read/write	the TOC being built
- * const KDirectory *		dir	read		the directory owning the path
- * bool (*)(const KDirectory*,
- *          const char *,
- *          void *)		filter	read/execute	a filtering function for path inclusion
- * void *			data	read		passed in as third parameter to filter
- * const char *			name	read		the path to be added
- *
- * filter and data can be NULL
- */
-static
-rc_t KTocParseKDirRecur	(KToc * self,
-			 const KDirectory * dir,
-			 const char * path,
-			 bool (CC* filter )(const KDirectory *,const char *, void*),
-			 void *  data);
-             
-static
-rc_t KTocParseKDirRecurOnePath (KToc * self,
-				   const KDirectory * dir,
-				   const char * path,
-				   bool (CC* filter )(const KDirectory *,const char *, void*),
-				   void *  data)
-{
-    rc_t rc;
-    KPathType type;
-    KTime_t mtime;
-    uint32_t access;
-    uint64_t size;
-
-    assert (self != NULL);
-    assert (dir != NULL);
-    assert (path != NULL);
-
-    TOC_DEBUG (("%s: recur path for %s\n", __func__, path));
-
-    type = (KPathType)KDirectoryPathType (dir, path);
-
-    if (type & kptAlias)
-    {
-	size = 0;
-	rc = KTocProcessOneNameCommonAtt (dir, path, &mtime, &access);
-	if (rc == 0)
-	{
-	    char * res;
-	    char * tres;
-	    size_t res_sz;
-
-	    res = NULL;
-	    rc = RC ( rcFS, rcDirectory, rcResolving, rcBuffer, rcInsufficient );
-	    for (res_sz = 128; 
-		 rc == RC ( rcFS, rcDirectory, rcResolving, rcBuffer, rcInsufficient );
-		 res_sz <<= 1)
-	    {
-		tres = realloc (res, res_sz);
-		if (tres == NULL)
-		{
-		    if (res != NULL)
-			free (res);
-		    return RC (rcFS, rcToc, rcParsing, rcMemory, rcExhausted);
-		}
-		res = tres;
-    		rc = KDirectoryVResolveAlias (dir, false, res, res_sz, path, NULL);
-	    }
-	    if (rc != 0)
-	    {
-		PLOGERR (klogWarn, (klogWarn, rc, "Failure getting alias target of $(p)", PLOG_S(p), path));
-	    }
-	    else
-	    {
-		rc = KTocCreateSoftLink (self, mtime, access, kcmCreate, res, path);
-	    }
-	    if (res != NULL)
-		free (res);
-	}
-    }
-    else
-    {
-	switch (type)
-	{
-	default:
-	    /* -----
-	     * fail on anything we don't understand
-	     */
-	    rc = RC (rcFS, rcToc, rcConstructing, rcToc, rcUnexpected);
-	    PLOGERR (klogInt, (klogInt, rc, "Failure getting type for $(p)", PLOG_S(p), path));
-	    break;
-	case kptCharDev:
-	case kptBlockDev:
-	case kptFIFO:
-	    /* -----
-	     * silently drop all devices and fifo/queues
-	     */
-	    rc = 0;
-	    break;
-	case kptFile:
-		/* TBD: add support here for chunked files and for hard links
-		 *
-		 * use lstat (not stat) to see if there are more than one link.  
-		 * if so then this inode will end up in a bstree of possible doubly
-		 * linked files.  first time we find it put in in the toc as a file,
-		 * while on subsequent times put it in as a hardlink
-		 *
-		 * Don't know how to detect sparse files yet (other than this from wikipedia)
-		 *
-		 * http://en.wikipedia.org/wiki/Sparse_files#Detecting_sparse_files_in_Unix
-		 * Sparse files have different apparent and actual file sizes. This can be
-		 * detected by comparing the output of:
-		 *
-		 *	du -s -B1 --apparent-size sparse-file
-		 *
-		 * and:
-		 *
-		 *	du -s -B1 sparse-file
-		 *
-		 */
-	    rc = KDirectoryVFileSize (dir, &size, path, NULL);
-	    if (rc != 0)
-	    {
-		PLOGERR (klogErr, (klogErr, rc, "Failure getting size of $(p)", PLOG_S(p), path));
-	    }
-	    else
-	    {
-		rc = KTocProcessOneNameCommonAtt (dir, path, &mtime, &access);
-		if (rc == 0)
-		{
-/* eventually we can choose to check for a compression */
-		    rc = KTocCreateFile (self, 0/*place holder*/, size, mtime, 
-                                          access, kcmCreate, path);
-		}
-	    }
-	    break;
-	case kptDir:
-	    size = 0;
-	    rc = KTocProcessOneNameCommonAtt (dir, path, &mtime, &access);
-	    if (rc == 0)
-	    {
-		rc = KTocCreateDir (self, mtime, access, kcmCreate, path);
-		if (rc == 0)
-		{
-		    rc = KTocParseKDirRecur (self, dir, path, filter, data);
-		}
-	    }
-	    break;
-	} /* switch (type) */
-    } /* if (type & kptAlias) ... else ... */
-    return rc;
-}
-
-
-static
-rc_t KTocParseKDirRecur	(KToc * self,
-			 const KDirectory * dir,
-			 const char * path,
-			 bool (CC* filter )(const KDirectory *,const char *, void*),
-			 void *  data)
-{
-    rc_t rc;
-    KNamelist * names;
-
-    assert (self != NULL);
-    assert (dir != NULL);
-    assert (path != NULL);
-
-    TOC_DEBUG (("%s: recur path for %s\n", __func__, path));
-
-    /* -----
-     * get a list of files in this directory
-     */
-    rc = KDirectoryVList (dir, &names, NULL, NULL, path, NULL);
-    if (rc != 0)
-    {
-	LOGERR (klogErr, rc, "Failure to build a name list");
-    }
-    else
-    {
-	/* -----
-	 * get the length of the list
-	 */
-	uint32_t limit;
-
-	rc = KNamelistCount (names, &limit);
-	if (rc != 0)
-	{
-	    LOGERR (klogErr, rc, "Failure to count elements of a name list");
-	}
-	else
-	{
-	    /* -----
-	     * loop through the list
-	     */
-	    uint32_t idx;
-	    size_t pathlen;
-
-            TOC_DEBUG (("%s KNamelistCount counted %u\n", __func__, limit));
-	    pathlen = strlen (path);
-
-	    for (idx = 0; idx < limit; ++idx)
-	    {
-		/* -----
-		 * get the nth path name from the list
-		 */
-		const char * name;
-
-		rc = KNamelistGet (names, idx, &name);
-		if (rc != 0)
-		{
-		    LOGERR (klogErr, rc, "Failure to pull name from name list");
-		}
-		else
-		{
-		    char * new_path;
-		    size_t namelen;
-		    size_t new_pathlen;
-
-                    TOC_DEBUG(("%s KNamelistCount  %s\n", __func__, name));
-            
-		    namelen = strlen (name);
-		    /* length of previous path + '/' + length of name */
-		    new_pathlen = pathlen + 1 + namelen;
-		    new_path = malloc (new_pathlen + 1);  /* + NUL */
-
-		    if (new_path == NULL)
-		    {
-			rc = RC (rcFS, rcToc, rcConstructing, rcMemory, rcExhausted);
-			LOGERR (klogErr, rc, "out of memory building paths for TOC");
-		    }
-		    else
-		    {
-			bool use_name;
-			char * recur_path;
-                        size_t recur_path_z;
-
-			memcpy (new_path, path, pathlen);
-			new_path[pathlen] = '/';
-			memcpy (new_path + pathlen + 1, name, namelen);
-			new_path[pathlen+1+namelen] = '\0';
-
-#if 1
-                        recur_path_z = pathlen + 1 + namelen + 1;
-#else
-                        recur_path_z = 4096;
-#endif
- 			recur_path = malloc (recur_path_z);
-			if (recur_path == NULL)
-			{
-			    rc = RC (rcFS, rcToc, rcConstructing, rcMemory, rcExhausted);
-			    LOGERR (klogErr, rc, "out of memory building paths for TOC");
-			}
-			else
-			{
-			    rc = KDirectoryResolvePath (dir, false, recur_path, recur_path_z,
-							 new_path);
-                            TOC_DEBUG (("%s: resolved path %s for %s\n", __func__, recur_path, new_path));
-                            TOC_DEBUG (("%s: filter %p\n", __func__, filter));
-			    if (rc == 0)
-			    {
-				if (filter != NULL)
-				{
-				    use_name = filter (dir, recur_path, data);
-				}
-				else
-				    use_name = true;
-
-				if (use_name)
-				{
-                                    TOC_DEBUG (("%s: use_name true for %s\n", __func__, recur_path));
-				    rc = KTocParseKDirRecurOnePath (self, dir, recur_path, filter, data);
-				    if (rc != 0)
-				    {
-					PLOGERR (klogErr, (klogErr, rc, "Failure to process name from name list $(p)",
-                                                           PLOG_S(p), name));
-				    }
-				}
-			    }
-			    free (recur_path);
-			}
-			free (new_path);
-		    }
-		}
-		if (rc != 0)
-		    break;
-	    } /* for (idx = 0; idx < limit; ++idx) */
-	}
-	KNamelistRelease (names);
-    }
-    return rc;
-}
-
-/* ======================================================================
- * KTocParseKDir
- *
- * This matches the standard signature for creating a KToc with a
- * KDirectory (any implementation including another KArcDir) as the
- * source to parse.
- *
- * Filter is a reference to a function that given a directory, a path
- * as a char ASCIZ string and a pointer to some form of data probably 
- * a struct will return 0 for do not include and 1 for include that
- * path in the TOC.
- *
- * Filter can be NULL and no filtering function will be called.
- * Data can be NULL is there is no Filter that expects it to b non-null.
- */
-LIB_EXPORT rc_t CC KArcParseKDir ( KToc * self,
-                                   const void * kvoid,
-                                   bool(CC*filter)(const KDirectory*,const char *, void*),
-                                   void * data )
-{
-    const KDirectory * kdir;
-    rc_t rc;
-
-    kdir = kvoid;
-    rc = 0;
-
-    if (self == NULL)
-    {
-	rc = RC (rcFS, rcArc, rcParsing, rcSelf, rcNull);;
-	LOGERR (klogErr, rc, "KTocParseKDir: self was NULL");
-    }
-    else if (kdir == NULL)
-    {
-	rc = RC (rcFS, rcArc, rcParsing, rcParam, rcNull);;
-	LOGERR (klogErr, rc, "KTocParseKDir: kdir was NULL");
-    }
-    else
-    {
-        TOC_DEBUG (("Start Parse\n"));
-	rc = KTocParseKDirRecur (self, kdir, ".", filter, data);
-    }
-    return rc;
-}
-
-/* end of file */
diff --git a/libs/kfs/tocentry.c b/libs/kfs/tocentry.c
deleted file mode 100644
index fed3bfb..0000000
--- a/libs/kfs/tocentry.c
+++ /dev/null
@@ -1,1748 +0,0 @@
-/*===========================================================================
- *
- *                            Public DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-#include <kfs/extern.h>
-#include <atomic32.h>
-#include <klib/container.h>
-#include <klib/vector.h>
-#include <klib/pbstree.h>
-#include <klib/text.h>
-#include <kfs/arc.h>
-#include <kfs/toc.h>
-#include <kfs/directory.h>
-#include <kfs/file.h>
-#include <klib/log.h>
-#include <klib/debug.h>
-#include <klib/rc.h>
-#include <klib/sort.h>
-#include <sysalloc.h>
-
-#include "toc-priv.h"
-
-#include <assert.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <byteswap.h>
-
-
-/* ======================================================================
- * KTocEntry
- *
- * A private class used to keep track of a single entry (
- */
-
-
-/* ======================================================================
- * KTocEntry method
- *
- * This class is not set up with a vtable at this point.  This API exposes
- * (due to the nature of using a c struct as a class) much of it's opaque 
- * elements by providing accessor functions to most of them.  Since they 
- * are static in this file they are expected to be used only by a class 
- * that is like a C++ friend class by being implemented in the same 
- * compilation unit.
- */
-
-/* NOTE data is not used but required to match the signature for a pointer to function */
-void CC KTocEntryWhack ( BSTNode * n, void * data )
-{
-    KTocEntry * p = (KTocEntry*)n;
-    /**(rc_t*)data = */ KTocEntryDelete (p);
-}
-
-/* ----------------------------------------------------------------------
- * KTocEntryDelete
- * [INOUT] self the entry to delete
- */
-rc_t KTocEntryDelete ( KTocEntry * self )
-{
-    /* defensive programming ensure minimally valid pointer */
-    if (self == NULL)
-    {
-        return 0;
-/* 	return RC (rcFS, rcToc, rcConstructing, rcSelf, rcNull); */
-    }
-
-    switch (self->type)
-    {
-    case ktocentrytype_unknown:
-    case ktocentrytype_file:
-    case ktocentrytype_chunked:
-    case ktocentrytype_softlink:
-    case ktocentrytype_hardlink:
-    case ktocentrytype_zombiefile:
-    default:
-	/* -----
-	 * at this point in the implementation there is nothing we need to
-	 * do with these entry types except free their "self" allocated memory.
-	 *
-	 * Used a switch in case we did for one or more of these.
-	 */
-	break;
-    case ktocentrytype_dir:
-	/* -----
-	 * directories have a BSTree below them that need to be 
-	 * deleted first
-	 */
-	BSTreeWhack (&self->u.dir.tree, KTocEntryWhack, NULL);
-	break;
-    }
-    free (self);
-    return 0;
-}
-
-/* ----------------------------------------------------------------------
- * KTocEntryCmp2
- *
- * [RET] int					>0: if n > p
- *						0:  if n == p
- *						<0: if n < p
- * [IN]  const BSTNode * 	n		where the pointer to a node matching the key is put
- * [IN]  const BSTNode * 	p		where the pointer to a node matching the key is put
- * This function fits the function signature needed for BSTreeInsert
- *
- * can not inline or make into a macro as it is referenced via a pointer
- */
-int CC KTocEntryCmp2 ( const BSTNode * n, const BSTNode * p )
-{
-
-    KTocEntry * nn;
-    KTocEntry * pp;
-    int		  ii;
-
-    nn = (KTocEntry *)n;
-    pp =  (KTocEntry *)p;
-    ii = StringCompare (&nn->name, &pp->name);
-    return ii;
-}
-
-/* ----------------------------------------------------------------------
- * KTocEntryCmpVoid
- *
- * [RET] int					>0: if n > p
- *						0:  if n == p
- *						<0: if n < p
- * [IN]  const void * 		item		'key' to find a matching bject in the BSTree
- * [OUT] const BSTNode *	node		where the pointer to a node matching the key is put
- * This function fits the function signature needed for BSTreeFind
- *
- * can not inline or make into a macro as it is referenced via a pointer
- */
-int CC KTocEntryCmpVoid ( const void * item, const BSTNode * node )
-{
-    const BSTNode * _item = item;
-    return KTocEntryCmp2 (_item, node);
-}
-
-/* ----------------------------------------------------------------------
- * KTocEntryNew
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [OUT] KTocEntry ** 	new_entry	where to put a pointer to the new TOC Entry
- * [IN]  const char * 		name		name of the entry (file, link, directory...)
- *						(not assumed to be ASCIZ)
- * [IN]  size_t			name_size	length of name
- * [IN]  uint32_t 		access		unix/posix style permission flags
- * [IN]  size_t 		entry_specific	specific initialyers by entry type
- */
-static
-rc_t		KTocEntryNew		(KTocEntry ** new_entry,
-					 const char * name,
-					 size_t name_size,
-					 KTime_t mtime,
-					 uint32_t access,
-					 size_t entry_specific)
-{
-    KTocEntry * entry;
-    size_t	  nsize;
-    char *	  namep;
-
-    nsize = entry_specific + name_size + 1; /* we want a NUL at end of name */
-
-    entry = malloc (nsize);
-    if (entry == NULL)
-    {
-	LOGMSG (klogErr,
-		"Failed to allocate for a TOC File entry");
-	return RC (rcFS, rcToc, rcAllocating, rcMemory, rcInsufficient);
-    }
-
-    /* entry->entry is fine left as undefined */
-    namep =(char*)entry + entry_specific;
-    string_copy (namep, name_size+1, name, name_size);
-    StringInit (&(entry->name), namep, name_size, (uint32_t)name_size);
-
-    entry->mtime = mtime;
-    entry->access = access;
-
-    *new_entry = entry;
-    return 0;
-}
-
-/* ----------------------------------------------------------------------
- * KTocEntryNewFile
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [OUT] KTocEntry **		new_entry	where to put a pointer to the new TOC Entry
- * [IN]  const char *		name		name of the file (not path) (not assumed to be ASCIZ)
- * [IN]  size_t 		name_size	length of name
- * [IN]  uint32_t 		access		unix/posix style permission flags
- * [IN]  uint64_t		offset		starting offset within the archive file of this file
- * [IN]  uint64_t 		size		number of bytes in the file
- */
-rc_t KTocEntryNewFile ( KTocEntry ** new_entry,
-                        const char * name,
-                        size_t name_size,
-                        KTime_t mtime,
-                        uint32_t access,
-                        uint64_t offset,
-                        uint64_t size )
-{
-    rc_t	rc;
-
-    TOC_SORT (("%s: %s %lu %u\n", __func__, name, mtime, access));
-
-    rc = KTocEntryNew (new_entry, name, name_size, mtime, access, 
-		       sizeof(KTocEntry) 
-		       - sizeof(union KTocEntryUnion)
-		       + sizeof(struct KTocEntryFile));
-
-    if (rc)
-	return rc;
-
-    if (size == 0)
-        (*new_entry)->type = ktocentrytype_emptyfile;
-
-    else
-    {
-        (*new_entry)->type = ktocentrytype_file;
-
-        (*new_entry)->u.contiguous_file.archive_offset = offset;
-        (*new_entry)->u.contiguous_file.file_size = size;
-    }
-
-    return 0;
-}
-
-
-/* ----------------------------------------------------------------------
- * KTocEntryNewZombieFile
- *
- * A zombie file is a file whose directory is in the archive but whose 
- * storage is not
- *
- * [RET] rc_t					0 for success; anything else
- *						for a failure
- *                                              see itf/klib/rc.h for general
- *                                              details
- * [OUT] KTocEntry **		new_entry	where to put a pointer to the
- *                                              new TOC Entry
- * [IN]  const char *		name		name of the file (not path)
- *                                              (not assumed to be ASCIZ)
- * [IN]  size_t 		name_size	length of name
- * [IN]  uint32_t 		access		unix/posix style permission
- *                                              flags
- * [IN]  uint64_t		offset		starting offset within the
- *                                              archive file of this file
- * [IN]  uint64_t 		size		number of bytes in the file
- */
-rc_t KTocEntryNewZombieFile ( KTocEntry ** new_entry,
-                              const char * name,
-                              size_t name_size,
-                              KTime_t mtime,
-                              uint32_t access,
-                              uint64_t offset,
-                              uint64_t size )
-{
-    rc_t	rc;
-    
-/*     TOC_DEBUG (("%s: %s %lu\n", __func__, name, mtime)); */
-
-    rc = KTocEntryNew (new_entry, name, name_size, mtime, access, 
-		       sizeof(KTocEntry) 
-		       - sizeof(union KTocEntryUnion)
-		       + sizeof(struct KTocEntryFile));
-
-    if (rc)
-	return rc;
-
-    if (size == 0)
-        (*new_entry)->type = ktocentrytype_emptyfile;
-
-    else
-    {
-        (*new_entry)->type = ktocentrytype_zombiefile;
-
-        (*new_entry)->u.contiguous_file.archive_offset = offset;
-        (*new_entry)->u.contiguous_file.file_size = size;
-    }
-
-    return 0;
-}
-
-/* ----------------------------------------------------------------------
- * KTocEntryNewChunked
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [OUT] KTocEntry **		new_entry	where to put a pointer to the new TOC Entry
- * [IN]  const char *		name		name of the file (not path) (not assumed to be ASCIZ)
- * [IN]  size_t			name_size	length of name
- * [IN]  uint32_t		access		unix/posix style permission flags
- * [IN]  uint64_t 		size		virtual number of bytes in the file: not actual
- *						number of stored bytes
- * [IN]  const KTocChunk * 	chunks		pointer to an array of chunk structures	
- * [IN]  uint32_t 		num_chunks	number of chunks in the array above
- */
-static
-int CC chunkcmp (const void * a, const void * b, void * ignored)
-{
-    const KTocChunk *A = a;
-    const KTocChunk *B = b;
-    /* -----
-     * We can't rely on a cast down to int not getting messed up 
-     * by overflow nor even on uint64_t - uint64_t not overflowing int64_t
-     */
-    if (A->logical_position == B->logical_position)
-	return 0;
-    else if (A->logical_position > B->logical_position)
-	return 1;
-    else
-	return -1;
-}
-
-rc_t KTocEntryNewChunked ( KTocEntry ** new_entry,
-					 const char * name,
-					 size_t name_size,
-					 KTime_t mtime,
-					 uint32_t access,
-					 uint64_t size,
-					 const KTocChunk * chunks,
-					 uint32_t num_chunks )
-{
-    rc_t	rc;
-    KTocChunk * chunkp;
-    size_t	nsize;
-    size_t	csize;
-
-    /* -----
-     * This is a bit ugly...
-     *
-     * first (Compile time optimizations does much of the heavy lifting) figure out how
-     * much is the extra malloc amount
-     *
-     * Take size of a generic entry - the size of the union part but add back the size of
-     * the chunked file part
-     *
-     * Add to that the size of a 64 bit integer.  This is 8 bytes extra from what is
-     * needed by the header alone.
-     * 
-     * Mask that against the binary bit inverse of 1 less tha the size of a 64 bit integer.
-     *
-     * Now you have the size of the header plus the number of bytes needed to get to a 8
-     * byte address 0.  This is possibly more than is needed as 8 byte quantities could be
-     * read from 4 byte boundaries in many cases.
-     *
-     * Then add to that the size in bytes of the chunked data (all 64 bit numbers).
-     */
-    nsize = ~( ( size_t ) sizeof(uint64_t)-1) & 
-	(sizeof(KTocEntry)
-	 - sizeof(union KTocEntryUnion)
-	 + sizeof(struct KTocEntryChunkFile)
-	 + sizeof(uint64_t));
-    csize = sizeof(KTocChunk) * num_chunks;
-
-    if ((rc = KTocEntryNew (new_entry, name, name_size, mtime, access, 
-			    nsize + csize))
-	!= 0)
-    {
-	return rc;
-    }
-
-    chunkp = (KTocChunk*)((char*)*new_entry + nsize);
-    (*new_entry)->type = ktocentrytype_chunked;
-    (*new_entry)->u.chunked_file.file_size = size;
-    (*new_entry)->u.chunked_file.chunks = chunkp;
-    (*new_entry)->u.chunked_file.num_chunks = num_chunks;
-    memcpy(chunkp, chunks, csize);
-    ksort (chunkp, num_chunks, sizeof(KTocChunk), chunkcmp, NULL);
-    /* -----
-     * TODO: We currently do no validation of the chunks.
-     * We accept that after the sort (which is probably superfluous)
-     * that for each chunk 
-     *
-     *	chunkp[N].logical_position + chunkp[N].size <= chunkp[N+1].logical_position
-     *
-     * We should probably verify this.
-     */
-    return 0;
-}
-
-/* ----------------------------------------------------------------------
- * KTocEntryNewSoft
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [OUT] KTocEntry **		new_entry	where to put a pointer to the new TOC Entry
- * [IN]  const char * 		name		name of the file (not path) (not assumed to be ASCIZ)
- * [IN]  size_t 		name_size	length of name
- * [IN]  uint32_t		access		unix/posix style permission flags
- * [IN]  const char * 		link		character array (string) holding the name of the
- *						links target (not assumed to be ASCIZ)
- * [IN]  size_t 		link_size	length of the target string
- * Link is run time resolved
- */
-rc_t KTocEntryNewSoft ( KTocEntry ** new_entry,
-					 const char * name,
-					 size_t name_size,
-					 KTime_t mtime,
-					 uint32_t access,
-					 const char * link,
-					 size_t link_size )
-{
-    rc_t	rc;
-    char *	linkp;
-
-    rc = KTocEntryNew (new_entry, name, name_size, mtime, access, 
-		       (sizeof(KTocEntry)
-			- sizeof(union KTocEntryUnion))
-		       + sizeof(struct KTocEntrySoftLink) + link_size + 1);
-    if (rc != 0)
-    {
-	return rc;
-    }
-    (*new_entry)->type = ktocentrytype_softlink;
-    linkp =(char*)(*new_entry) + sizeof(KTocEntry) - sizeof(union KTocEntryUnion)
-	+ sizeof(struct KTocEntrySoftLink);
-    string_copy (linkp, link_size+1, link, link_size);
-    StringInit ( &((*new_entry)->u.symbolic_link.link_path), linkp, link_size, (uint32_t)link_size );
-    return 0;
-}
-
-/* ----------------------------------------------------------------------
- * KTocEntryNewHard
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [OUT] KTocEntry ** 	new_entry	where to put a pointer to the new TOC Entry
- * [IN]  const char * 		name		name of the file (not path) (not assumed to be ASCIZ)
- * [IN]  size_t			name_size	length of name
- * [IN]  uint32_t		access		unix/posix style permission flags
- * Resolution of the link is not set up in this function
- */
-rc_t KTocEntryNewHard ( KTocEntry ** new_entry,
-                        const char * name,
-                        size_t name_size,
-                        KTime_t mtime,
-                        uint32_t access,
-                        const KTocEntry * targ )
-{
-    rc_t	rc;
-
-    if ((rc = KTocEntryNew (new_entry, name, name_size, mtime, access, 
-			    sizeof(KTocEntry)
-			    - sizeof(union KTocEntryUnion)
-			    + sizeof(struct KTocEntryHardLink)))
-	!= 0)
-    {
-	return rc;
-    }
-    (*new_entry)->type = ktocentrytype_hardlink;
-    (*new_entry)->u.hard_link.ref = targ;
-
-    return 0;
-}
-
-/* ----------------------------------------------------------------------
- * KTocEntryNewDirectory
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [OUT] KTocEntry **		new_entry	where to put a pointer to the new TOC Entry
- * [IN]  const char *		name		name of the directory (not assumed to be ASCIZ)
- * [IN]  size_t			name_size	length of name
- * [IN]  uint32_t		access		unix/posix style permission flags
- */
-rc_t KTocEntryNewDirectory ( KTocEntry ** new_entry,
-					 const char * name,
-					 size_t name_size,
-					 KTime_t mtime,
-					 uint32_t access )
-{
-    rc_t	rc;
-
-    /* -----
-     * get rid of trailing '/' characters in a file name
-     */
-    while (name[name_size-1] == '/')
-	--name_size;
-
-    if ((rc = KTocEntryNew (new_entry, name, name_size, mtime, access, 
-			    sizeof(KTocEntry)
-			    - sizeof(union KTocEntryUnion)
-			    + sizeof(struct KTocEntryDir)))
-	!= 0)
-    {
-	return rc;
-    }
-    (*new_entry)->type = ktocentrytype_dir;
-    BSTreeInit(&(*new_entry)->u.dir.tree);	/* start with an empty tree */
-    return 0;
-}
-
-/* ----------------------------------------------------------------------
- *
- */
-rc_t KTocEntryGetTime ( const KTocEntry *self, KTime_t *mtime )
-{
-    if (self == NULL)
-    {
-	return RC (rcFS, rcToc, rcAccessing, rcSelf, rcNull);
-    }
-    *mtime = self->mtime;
-    return 0;
-}
-
-/* ----------------------------------------------------------------------
- *
- */
-rc_t KTocEntryGetAccess ( const KTocEntry *self, uint32_t *access )
-{
-    if (self == NULL)
-    {
-	return RC (rcFS, rcToc, rcAccessing, rcSelf, rcNull);
-    }
-    *access = self->access;
-    return 0;
-}
-
-/* ----------------------------------------------------------------------
- *
- */
-rc_t KTocEntryGetType ( const KTocEntry *self, KTocEntryType* type )
-{
-    if (self == NULL)
-    {
-	return RC (rcFS, rcToc, rcAccessing, rcSelf, rcNull);
-    }
-    *type = self->type;
-    return 0;
-}
-
-/* ----------------------------------------------------------------------
- *
- */
-rc_t KTocEntryGetFileSize ( const KTocEntry * self, uint64_t * size )
-{
-    int	loopcount;
-    const KTocEntry * target;
-
-    assert (self != NULL);
-    assert (size != NULL);
-
-    *size = 0;
-
-    for (loopcount = 0; loopcount < KARC_LINK_RESOLVE_LOOPMAX; ++loopcount)
-    {
-	switch (self->type)
-	{
-	default:
-	case ktocentrytype_unknown:
-	case ktocentrytype_notfound:
-	    return RC (rcFS, rcFile, rcAccessing, rcFile, rcInvalid);
-
-	case ktocentrytype_dir:
-	    return RC (rcFS, rcFile, rcAccessing, rcFileDesc, rcIncorrect);
-
-	case ktocentrytype_file:
-	    *size = self->u.contiguous_file.file_size;
-	    return 0;
-
-	case ktocentrytype_chunked:
-	    *size = self->u.chunked_file.file_size;
-	    return 0;
-
-	case ktocentrytype_zombiefile:
-	    *size = self->u.zombie_file.file_size;
-	    return 0;
-
-	case ktocentrytype_softlink:
-	    /* architect called for KArcDir to handle symbolic link resolution */
-	    return RC (rcFS, rcFile, rcAliasing, rcLink, rcNoErr);
-
-	case ktocentrytype_hardlink:
-	    if (KTocEntryGetHardTarget(self, &target) != 0)
-		return RC (rcFS, rcFile, rcAccessing, rcFile, rcInvalid);
-	    /* this breaks "object oriented rules" but lets us loop instead of recur */
-	    self = target; /* catch bad returns at reiteration of switch */
-	    /* only non-terminal path within the loop */
-	    break;
-
-        case ktocentrytype_emptyfile:
-	    *size = 0;
-	    return 0;
-
-	}
-    }
-    return RC (rcFS, rcFile, rcAccessing, rcFile, rcInvalid);
-}
-
-rc_t KTocEntryGetFilePhysicalSize ( const KTocEntry * self, uint64_t * size )
-{
-    int	loopcount;
-    const KTocEntry * target;
-
-    assert (self != NULL);
-    assert (size != NULL);
-
-    *size = 0;
-
-    for (loopcount = 0; loopcount < KARC_LINK_RESOLVE_LOOPMAX; ++loopcount)
-    {
-	switch (self->type)
-	{
-	default:
-	case ktocentrytype_unknown:
-	case ktocentrytype_notfound:
-	    return RC (rcFS, rcFile, rcAccessing, rcFile, rcInvalid);
-
-	case ktocentrytype_dir:
-	    return RC (rcFS, rcFile, rcAccessing, rcFileDesc, rcIncorrect);
-
-	case ktocentrytype_file:
-	    *size = self->u.contiguous_file.file_size;
-	    return 0;
-
-	case ktocentrytype_chunked:
-        {
-            uint64_t size_;
-            uint32_t ix;
-            for (size_ = 0, ix = 0; ix < self->u.chunked_file.num_chunks; ++ix)
-                size_ += self->u.chunked_file.chunks[ix].size;
-            *size = size_;
-	    return 0;
-        }
-	case ktocentrytype_zombiefile:
-	    *size = self->u.zombie_file.file_size;
-	    return 0;
-
-	case ktocentrytype_softlink:
-	    /* architect called for KArcDir to handle symbolic link resolution */
-	    return RC (rcFS, rcFile, rcAliasing, rcLink, rcNoErr);
-
-	case ktocentrytype_hardlink:
-	    if (KTocEntryGetHardTarget(self, &target) != 0)
-		return RC (rcFS, rcFile, rcAccessing, rcFile, rcInvalid);
-	    /* this breaks "object oriented rules" but lets us loop instead of recur */
-	    self = target; /* catch bad returns at reiteration of switch */
-	    /* only non-terminal path within the loop */
-	    break;
-
-        case ktocentrytype_emptyfile:
-	    *size = 0;
-	    return 0;
-
-	}
-    }
-    return RC (rcFS, rcFile, rcAccessing, rcFile, rcInvalid);
-}
-
-/* ----------------------------------------------------------------------
- *
- */
-rc_t KTocEntryGetFileLocator ( const KTocEntry * self, uint64_t * locator )
-{
-    int	loopcount;
-    const KTocEntry * target;
-
-    assert (self != NULL);
-    assert (locator != NULL);
-
-    *locator = 0;
-
-    for (loopcount = 0; loopcount < KARC_LINK_RESOLVE_LOOPMAX; ++loopcount)
-    {
-	switch (self->type)
-	{
-	default:
-	case ktocentrytype_unknown:
-	case ktocentrytype_notfound:
-	    return RC (rcFS, rcFile, rcAccessing, rcFile, rcInvalid);
-
-	case ktocentrytype_dir:
-	    return RC (rcFS, rcFile, rcAccessing, rcFileDesc, rcIncorrect);
-
-	case ktocentrytype_file:
-	case ktocentrytype_zombiefile:
-	    *locator = self->u.contiguous_file.archive_offset;
-	    return 0;
-	case ktocentrytype_chunked:
-        {
-            /* find lowest offset chunk */
-            if (self->u.chunked_file.num_chunks > 0)
-            {
-                uint64_t loc;
-                uint32_t ix;
-
-                *locator = self->u.chunked_file.chunks[0].source_position;
-                for (ix = 1; ix < self->u.chunked_file.num_chunks; ++ix)
-                {
-                    loc = self->u.chunked_file.chunks[ix].source_position;
-                    if (loc < *locator)
-                        *locator = loc;
-                }
-            }
-            else
-                *locator = 0;
-
-	    return 0;
-        }
-	case ktocentrytype_softlink:
-	    /* architect called for KArcDir to handle symbolic link resolution */
-	    return RC (rcFS, rcFile, rcAliasing, rcLink, rcNoErr);
-
-	case ktocentrytype_hardlink:
-	    if (KTocEntryGetHardTarget(self, &target) != 0)
-		return RC (rcFS, rcFile, rcAccessing, rcFile, rcInvalid);
-	    /* this breaks "object oriented rules" but lets us loop instead of recur */
-	    self = target; /* catch bad returns at reiteration of switch */
-	    /* only non-terminal path within the loop */
-	    break;
-
-        case ktocentrytype_emptyfile:
-	    *locator = 0;
-	    return 0;
-
-	}
-    }
-    return RC (rcFS, rcFile, rcAccessing, rcFile, rcInvalid);
-}
-
-/* ----------------------------------------------------------------------
- *
- */
-rc_t KTocEntryGetChunks ( const KTocEntry * self,
-                          uint32_t * num_chunks,
-                          const KTocChunk ** chunks )
-{
-    int	loopcount;
-    const KTocEntry * target;
-
-    *chunks = NULL;
-    *num_chunks = 0;
-
-    for (loopcount = 0; loopcount < KARC_LINK_RESOLVE_LOOPMAX; ++loopcount)
-    {
-	switch (self->type)
-	{
-	default:
-	case ktocentrytype_unknown:
-	case ktocentrytype_notfound:
-	    return RC (rcFS, rcFile, rcAccessing, rcFile, rcInvalid);
-
-	case ktocentrytype_dir:
-	case ktocentrytype_file:
-	    return RC (rcFS, rcFile, rcAccessing, rcFileDesc, rcIncorrect);
-
-	case ktocentrytype_chunked:
-	    *chunks = self->u.chunked_file.chunks;
-	    *num_chunks = self->u.chunked_file.num_chunks;
-	    return 0;
-
-	case ktocentrytype_softlink:
-	    /* architect called for KArcDir to handle symbolic link resolution */
-	    return RC (rcFS, rcFile, rcAliasing, rcLink, rcNoErr);
-
-	case ktocentrytype_hardlink:
-	    if (KTocEntryGetHardTarget(self, &target) != 0)
-		return RC (rcFS, rcFile, rcAccessing, rcFile, rcInvalid);
-	    /* this breaks "object oriented rules" but lets us loop instead of recur */
-	    self = target; /* catch bad returns at reiteration of switch */
-	    /* only non-terminal path within the loop */
-	    break;
-	}
-    }
-    return RC (rcFS, rcFile, rcAccessing, rcFile, rcInvalid);
-}
-
-/* ----------------------------------------------------------------------
- *
- */
-rc_t KTocEntryGetFileOffset ( const KTocEntry * self, uint64_t * offset )
-{
-    int			loopcount;
-    const KTocEntry * target;
-
-    *offset = 0;
-
-    for (loopcount = 0; loopcount < KARC_LINK_RESOLVE_LOOPMAX; ++loopcount)
-    {
-	switch (self->type)
-	{
-	default:
-	case ktocentrytype_unknown:
-	case ktocentrytype_notfound:
-	    return RC (rcFS, rcTocEntry, rcAccessing, rcFile, rcUnknown);
-
-	case ktocentrytype_dir:
-	case ktocentrytype_chunked:
-	    return RC (rcFS, rcTocEntry, rcAccessing, rcSelf, rcUnsupported);
-
-	case ktocentrytype_file:
-	    *offset = self->u.contiguous_file.archive_offset;
-	    return 0;
-
-        case ktocentrytype_emptyfile:
-	    *offset = 0;
-	    return 0;
-
-	case ktocentrytype_softlink:
-	    /* architect called for KArcDir to handle symbolic link resolution */
-	    return RC (rcFS, rcTocEntry, rcAliasing, rcLink, rcNoErr);
-
-	case ktocentrytype_hardlink:
-	    if (KTocEntryGetHardTarget(self, &target) != 0)
-		return RC (rcFS, rcTocEntry, rcAccessing, rcSelf, rcInvalid);
-
-	    /* this breaks "object oriented rules" but lets us loop instead of recur */
-	    self = target; /* catch bad returns at reiteration of switch */
-	    /* only non-terminal path within the loop */
-	    break;
-	}
-    }
-    return RC (rcFS, rcToc, rcAccessing, rcSelf, rcInvalid);	/* loop fail - too many hard links */
-}
-
-/* ----------------------------------------------------------------------
- *
- */
-rc_t KTocEntryGetBSTree ( const KTocEntry * self,const BSTree ** ptree )
-{
-    KTocEntryType	type;
-
-    if (self == NULL)
-    {
-	return RC (rcFS, rcToc, rcAccessing, rcSelf, rcNull);
-    }
-    if (KTocEntryGetType(self,&type) != 0)
-    {
-	return RC  (rcFS, rcToc, rcAccessing, rcParam, rcInvalid);
-    }
-    if (type != ktocentrytype_dir)
-    {
-	return RC  (rcFS, rcToc, rcAccessing, rcParam, rcInvalid);
-    }
-    *ptree = &self->u.dir.tree;
-    return 0;
-}
-
-/* ----------------------------------------------------------------------
- *
- */
-rc_t KTocEntryGetHardTarget ( const KTocEntry *self, const KTocEntry ** target )
-{
-    if (self == NULL)
-    {
-	return RC (rcFS, rcToc, rcAccessing, rcSelf, rcNull);
-    }
-    if (target == NULL)
-    {
-	return RC (rcFS, rcToc, rcAccessing, rcParam, rcNull);
-    }
-    *target = (self->type == ktocentrytype_hardlink) ? self->u.hard_link.ref : NULL;
-    return 0;
-}
-
-/* ----------------------------------------------------------------------
- *
- */
-rc_t KTocEntryGetSoftTarget ( const KTocEntry *self,
-				const char ** target )
-{
-    if (self == NULL)
-    {
-	return RC (rcFS, rcToc, rcAccessing, rcSelf, rcNull);
-    }
-    if (self->type != ktocentrytype_softlink)
-    {
-	return RC  (rcFS, rcToc, rcAccessing, rcSelf, rcInvalid);
-    }
-    *target = self->u.symbolic_link.link_path.addr;
-    return 0;
-}
-
-/* ----------------------------------------------------------------------
- *
- */
-rc_t KTocEntryGetName ( const KTocEntry *self,
-			  const char ** name )
-{
-    if (self == NULL)
-    {
-	return RC (rcFS, rcToc, rcAccessing, rcSelf, rcNull);
-    }
-    *name = self->name.addr;
-    return 0;
-}
-
-/* ======================================================================
- */
-const char * KTocEntryTypeGetString(KTocEntryType t)
-{
-    static const char * entryTypeString[] = 
-	{
-	    "ktocentrytype_unknown",
-	    "ktocentrytype_notfound",
-	    "ktocentrytype_dir",
-	    "ktocentrytype_file",
-	    "ktocentrytype_chunked",
-	    "ktocentrytype_softlink",
-	    "ktocentrytype_hardlink",
-	    "ktocentrytype_emptyfile" 
-	};
-
-    switch (t)
-    {
-    case ktocentrytype_unknown:
-    case ktocentrytype_dir:
-    case ktocentrytype_file:
-    case ktocentrytype_chunked:
-    case ktocentrytype_softlink:
-    case ktocentrytype_hardlink:
-    case ktocentrytype_emptyfile:
-	return entryTypeString[t+1];
-    default:
-	return "ktocentrytype_error";
-    }
-}
-
-/*
- * preferred behavior of this needs to be determined
- */
-LIB_EXPORT rc_t CC KTocEntryPersistWriteFunc ( void * param,
-                                               const void * buffer,
-                                               size_t size,
-                                               size_t * num_writ )
-{
-    KTocEntryPersistWriteFuncData * data;
-    rc_t rc;
-    size_t to_write;
-
-    assert (param != NULL);
-    assert (buffer != NULL);
-    assert (num_writ != NULL);
-
-    rc = 0;
-    *num_writ = 0;
-    data = param;
-    if (size != 0)
-    {
-	if ((data->buffptr + size) > data->limit)
-	{
-	    to_write = data->limit - data->buffptr;
-	    rc = RC (rcFS, rcTocEntry, rcPersisting, rcBuffer, rcTooShort);
-	}
-	else
-	    to_write = size;
-	memcpy (data->buffptr, buffer, to_write);
-	data->buffptr += to_write;
-	*num_writ = to_write;
-#if 0
-	{
-	    size_t ix;
-
-	    for (ix = 0; ix < to_write; ix ++)
-	    {
-/* please do not delete commented out code */
-/* 		if ((ix & 0xF) == 0x0) */
-/* 		    printf ("%.08x : ", ix); */
-/* 		printf( "%.02x ", ((uint8_t*)buffer)[ix]); */
-
-/* 		if ((ix & 0xF) == 0xF) */
-/* 		    printf ("\n"); */
-	    }
-/*  	    printf ("\n"); */
-	}
-#endif
-    }
-    return rc;
-}
-
-
-static
-rc_t KTocEntryPersistNodeCommon (void * param, const KTocEntry * n,
-				 size_t * num_writ, PTWriteFunc write,
-				 void * write_param)
-{
-    size_t all_written;
-    size_t written;
-    uint16_t nsize;
-    const char * name;
-    rc_t rc;
-    KTocEntryType t;
-    uint8_t b;
-    KTime_t mtime;
-    uint32_t access;
-
-    rc = KTocEntryGetName (n, &name);
-    if (rc != 0)
-	return rc;
-    TOC_DEBUG (("%s %s\n", __func__, name));
-    if (write)
-    {
-
-/* please do not delete commented out code */
-/* 	printf ("----------\n"); */
-	nsize = (uint16_t)strlen(name);
-	rc = KTocEntryGetTime (n, &mtime);
-	if (rc != 0)
-	    return rc;
-	rc = KTocEntryGetAccess (n, &access);
-	if (rc != 0)
-	    return rc;
-	rc = KTocEntryGetType (n, &t);
-	if (rc != 0)
-	    return rc;
-	b = (uint8_t)t;
-/* 	printf ("name size\t"); */
-	rc = (*write) (write_param, &nsize, sizeof nsize, &all_written);
-	if (rc == 0)
-	{
-/* 	    printf("name %s\t", name); */
-	    rc = (*write) (write_param, name, nsize, &written);
-	    all_written += written;
-	    if (rc == 0)
-	    {
-/* 		printf("mtime\t"); */
-		rc = (*write) (write_param, &mtime, sizeof mtime, &written);
-		all_written += written;
-		if (rc == 0)
-		{
-/* 		    printf("access\t"); */
-		    rc = (*write) (write_param, &access, sizeof access, &written);
-		    all_written += written;
-		    if (rc == 0)
-		    {
-/* 			printf("type\t"); */
-			rc = (*write) (write_param, &b, sizeof b, &written);
-			all_written += written;
-		    }
-		}
-	    }
-	}
-	*num_writ = all_written;
-	return rc;
-    }
-    else
-    {
-	*num_writ = (sizeof (nsize) + strlen (name) + sizeof (mtime) +
-		     sizeof (access) + sizeof (b));
-	return 0;
-    }
-}
-
-rc_t KTocEntryPersistNodeDir ( void *param, const KTocEntry * n,
-			      size_t * num_writ, 
-			      PTWriteFunc write, void * write_param )
-{
-    rc_t rc;
-
-/*     size_t	start,end; */
-
-    TOC_FUNC_ENTRY();
-
-
-/*     start = *num_writ; */
-
-    rc = BSTreePersist (&n->u.dir.tree,
-			num_writ,
-			write,
-			write_param,
-			KTocEntryPersist,
-			NULL);
-    if (rc != 0)
-    {
-        TOC_DEBUG (("KTocEntryPersistNodeDir: failure return from BSTreePersist"));
-    }
-
-/*     end = *num_writ; */
-    return rc;
-}
-
-static
-rc_t KTocEntryPersistNodeFile (void *param, const KTocEntry * n,
-			       size_t * num_writ, 
-			       PTWriteFunc write, void * write_param)
-{
-    TOC_FUNC_ENTRY();
-
-    if (write)
-    {
-	rc_t rc;
-	size_t all_written;
-	size_t written;
-
-/* please do not delete commented out code */
-/* 	printf("file offset\t"); */
-	rc = (*write) (write_param, &n->u.contiguous_file.archive_offset,
-		       sizeof n->u.contiguous_file.archive_offset, &all_written);
-	if (rc == 0)
-	{
-/* 	    printf("file size\t"); */
-	    rc = (*write) (write_param, &n->u.contiguous_file.file_size,
-			   sizeof n->u.contiguous_file.file_size, &written);
-            all_written += written;
-	}
-	*num_writ = all_written;
-	return rc;
-    }
-    else
-    {
-	*num_writ = (sizeof n->u.contiguous_file.archive_offset +
-		     sizeof n->u.contiguous_file.file_size);
-	return 0;
-    }
-}
-
-static
-rc_t KTocEntryPersistNodeChunked (void *param, const KTocEntry * n,
-				  size_t * num_writ, 
-				  PTWriteFunc write, void * write_param)
-{
-    KTocChunk * chunks;
-    uint32_t count;
-
-    count = n->u.chunked_file.num_chunks; /* used with write and no write */
-    chunks = n->u.chunked_file.chunks;
-    if (write)
-    {
-	rc_t rc;
-	size_t all_written;
-	size_t written;
-
-/* please do not delete commented out code */
-/* 	printf("file size\t"); */
-	rc = (*write) (write_param, &n->u.chunked_file.file_size,
-		       sizeof n->u.chunked_file.file_size, &all_written);
-	if (rc == 0)
-	{
-/* 	    printf("chunk count\t"); */
-	    rc = (*write) (write_param, &count, sizeof count, &written);
-	    all_written += written;
-	    if (rc == 0)
-	    {
-		for ( ; count--; chunks++)
-		{
-/* 		    printf("chunk l position\t"); */
- 		    rc = (*write) (write_param, &chunks->logical_position,
- 				   sizeof chunks->logical_position, &written);
-		    all_written += written;
-		    if (rc != 0)
-			break;
-/* 		    printf("chunk s position\t"); */
-		    rc = (*write) (write_param, &chunks->source_position,
-				   sizeof chunks->source_position, &all_written);
-		    all_written += written;
-		    if (rc != 0)
-			break;
-/* 		    printf("chunk size\t"); */
-		    rc = (*write) (write_param, &chunks->size,
-				   sizeof chunks->size, &written);
-		    all_written += written;
-		    if (rc != 0)
-			break;
-		}
-	    }
-	}
-	*num_writ = all_written;
-	return rc;
-    }
-    else
-    {
-	*num_writ = (sizeof n->u.chunked_file.file_size + sizeof count +
-		     count * (sizeof chunks->logical_position +
-			      sizeof chunks->source_position +
-			      sizeof chunks->size));
-	return 0;
-    }
-}
-
-static
-rc_t KTocEntryPersistNodeSym (void *param, const KTocEntry * n,
-			      size_t * num_writ, PTWriteFunc write,
-			      void * write_param)
-{
-    uint16_t nsize;
-
-    nsize = (uint16_t)n->u.symbolic_link.link_path.size;
-    if (write)
-    {
-	rc_t rc;
-	size_t all_written;
-	size_t written;
-
-	rc = (*write) (write_param, &nsize, sizeof nsize, &all_written);
-	if (rc == 0)
-	{
-	    rc = (*write) (write_param, 
-			   n->u.symbolic_link.link_path.addr,
-			   nsize,
-			   &written);
-	    all_written += written;
-	}
-	*num_writ = all_written;
-	return rc;
-    }
-    else
-    {
-	*num_writ = (sizeof (nsize) + nsize);
-	return 0;
-    }
-}
-
-static
-rc_t KTocEntryPersistNodeLink (void *param, const KTocEntry * n,
-			       size_t * num_writ, 
-			       PTWriteFunc write, void * write_param)
-{
-    uint16_t nsize;
-
-    nsize = (uint16_t)n->u.hard_link.ref->name.size;
-    if (write)
-    {
-	rc_t rc;
-	size_t all_written;
-	size_t written;
-
-	rc = (*write) (write_param, &nsize, sizeof nsize, &all_written);
-	if (rc == 0)
-	{
-	    rc = (*write) (write_param, 
-			   n->u.hard_link.ref->name.addr,
-			   nsize,
-			   &written);
-	    all_written += written;
-	}
-	*num_writ = all_written;
-	return rc;
-    }
-    else
-    {
-	*num_writ = (sizeof (nsize) + nsize);
-	return 0;
-    }
-}
-
-LIB_EXPORT rc_t CC KTocEntryPersist ( void *param, const void * node,
-                                      size_t * num_writ, 
-                                      PTWriteFunc write, void * write_param )
-{
-    rc_t rc;
-    size_t all_written;
-    size_t written;
-    const KTocEntry * n;
-
-    TOC_FUNC_ENTRY();
-
-    all_written = 0;
-    n = (const KTocEntry *)node;
-    rc = KTocEntryPersistNodeCommon (param, n, &all_written, write, write_param);
-    if (rc == 0)
-    {
-	written = 0;
-	switch (n->type)
-	{
-	default:
-	    rc = RC (rcFS, rcTocEntry, rcPersisting, rcTocEntry, rcInvalid );
-	    LOGERR (klogInt, rc, "malformed node with bad type");
-	    break;
-
- 	case ktocentrytype_notfound:
-	    rc = RC (rcFS, rcTocEntry, rcPersisting, rcTocEntry, rcCorrupt );
-	    LOGERR (klogInt, rc, "malformed tree node not found ");
- 	    break;
-
-	case ktocentrytype_dir:
-	    /* recur */
-/* please do not delete commented out code */
-/* 	    printf("KTocEntryPersist Directory\n"); */
-	    rc = KTocEntryPersistNodeDir (param, n, &written, write, write_param);
-	    break;
-
-	case ktocentrytype_file:
-/* 	    printf("KTocEntryPersist File\n"); */
-	    rc = KTocEntryPersistNodeFile (param, n, &written, write, write_param);
-	    break;
-
-	case ktocentrytype_emptyfile:
-/* 	    printf("KTocEntryPersist Empty File\n"); */
-	    break;
-
-	case ktocentrytype_chunked:
-/* 	    printf("KTocEntryPersist chunked File\n"); */
-	    rc = KTocEntryPersistNodeChunked (param, n, &written, write, write_param);
-	    break;
-
-	case ktocentrytype_softlink:
-/* 	    printf("KTocEntryPersist soft link\n"); */
-	    rc = KTocEntryPersistNodeSym (param, n, &written, write, write_param);
-	    break;
-
-	case ktocentrytype_hardlink:
-/* 	    printf("KTocEntryPersist hard link\n"); */
-	    rc = KTocEntryPersistNodeLink (param, n, &written, write, write_param);
-	    break;
-	}
-	all_written += written;
-    }
-    *num_writ = all_written;
-    return rc;
-}
-
-typedef
-struct KTocEntryInflateData
-{
-    KToc * toc;
-    const char * path;
-    uint64_t arcsize;
-    uint64_t offset;
-    rc_t rc;
-    bool rev;
-} KTocEntryInflateData;
-
-typedef
-struct KTocEntryInflateCommon
-{
-    char * name;
-    KTime_t mtime;
-    uint32_t access;
-    KTocEntryType type;
-} KTocEntryInflateCommon;
-/* TBD: replace the list of parameters in the inflatenode functions
-typedef
-struct KTocEntryInflateNodeData
-{
-    KToc * toc;
-    const void * ptr;
-    const void * limit;
-    char * name;
-    KTime_t mtime;
-    uint32_t access;
-    KTocEntryType type;
-    bool rev;
-} KTocEntryInflateNodeData;
-*/
-
-static
-bool check_limit (const void * ptr, const void * limit, size_t size)
-{
-    const uint8_t * p = ptr;
-    const uint8_t * l = limit;
-    return ((p + size) > l);
-}
-
-#define read_scalar(N,T,S)	     \
-    static rc_t N (const void ** _ptr, const void * limit, bool rev, T * pout) \
-    {									\
-	const T * ptr;							\
-									\
-	if (check_limit (*_ptr, limit, sizeof (T)))			\
-	    return RC (rcFS, rcTocEntry, rcParsing, rcBuffer, rcTooShort); \
-	    								\
-	ptr = *_ptr;							\
-									\
-	if (rev)							\
-	{								\
-	    T t;							\
-	    memcpy (&t, ptr, sizeof (T));				\
-	    *pout = S (t);						\
-	}								\
-	else								\
-	    memcpy (pout, ptr, sizeof (T));                             \
-	*_ptr = ++ptr;							\
-	return 0;							\
-    }
-
-read_scalar (read_u16,uint16_t,bswap_16)
-read_scalar (read_u32,uint32_t,bswap_32)
-read_scalar (read_u64,uint64_t,bswap_64)
-read_scalar (read_i64,int64_t,bswap_64)
-
-static
-rc_t read_u8 (const void ** _ptr, const void * limit, uint8_t * pout)
-{
-    const uint8_t * ptr;
-
-    if (check_limit (*_ptr, limit, sizeof (uint8_t)))
-	return RC (rcFS, rcTocEntry, rcParsing, rcBuffer, rcTooShort);
-
-    ptr = *_ptr;
-    *pout = *ptr++;
-    *_ptr = ptr;
-    return 0;
-}
-
-static
-rc_t KTocEntryInflateNodeCommon (const void ** ptr,
-				 const void * limit,
-				 KTocEntryInflateCommon * common,
-				 const char * path,
-				 bool rev)
-{
-    rc_t rc;
-    uint16_t plen;
-    uint16_t nlen;
-
-    rc = read_u16 (ptr, limit, rev, &nlen);
-    if (rc)
-	return rc;
-
-    if (check_limit (*ptr, limit, nlen))
-	return RC (rcFS, rcTocEntry, rcParsing, rcBuffer, rcTooShort);;
-
-    plen = (uint16_t)strlen (path);
-    if (plen == 0)
-    {
-	common->name = malloc (nlen+1);
-	if (common->name == NULL)
-	{
-	    return RC (rcFS, rcTocEntry, rcInflating, rcMemory, rcExhausted);
-	}
-	memcpy (common->name, *ptr, nlen);
-	common->name[nlen] = '\0';
-    }
-    else
-    {
-	common->name = malloc (plen + 1 + nlen+1);
-	if (common->name == NULL)
-	{
-	    return RC (rcFS, rcTocEntry, rcInflating, rcMemory, rcExhausted);
-	}
-	memcpy (common->name, path, plen);
-	common->name[plen] = '/';
-	memcpy (common->name+plen+1, *ptr, nlen);
-	common->name[plen + nlen + 1] = '\0';
-    }
-
-    *ptr = ((uint8_t*)*ptr) + nlen;
-
-    rc = read_i64 (ptr, limit, rev, &common->mtime);
-    if (rc == 0)
-    {
-	rc =read_u32 (ptr, limit, rev, &common->access);
-	if (rc == 0)
-	{
-	    uint8_t type;
-	    rc = read_u8 (ptr, limit, &type);
-	    if (rc == 0)
-	    {
-		common->type = type;
-		return 0;
-	    }
-	}
-    }
-    free (common->name);
-    common->name = NULL;
-    common->mtime = 0;
-    common->access = 0;
-    common->type = ktocentrytype_unknown;
-    return rc;
-}
-
-
-static
-rc_t KTocEntryInflateNodeDir (KToc * toc, KTocEntryInflateCommon * common, 
-			      const void ** ptr, uint64_t offset, uint64_t arcsize, const void * limit, bool rev)
-{
-    rc_t rc;
-
-    rc = KTocCreateDir (toc,
-			common->mtime,
-			common->access,
-			(KCreateMode)(kcmInit|kcmParents),
-			common->name);
-    if (rc == 0)
-    {
-	rc = KTocInflatePBSTree (toc, arcsize, *ptr, (uint32_t)( (uint8_t*)limit - (uint8_t*)*ptr ),
-                                 offset, rev, common->name);
-    }
-    return rc;
-}
-
-static
-rc_t KTocEntryInflateNodeFile (KToc * toc, const KTocEntryInflateCommon * common, 
-			       const void ** ptr, uint64_t offset, uint64_t arcsize, const void * limit, bool rev)
-{
-    rc_t rc;
-    uint64_t size;
-    uint64_t foffset;
-
-    rc = read_u64 (ptr, limit, rev, &foffset);
-    if (rc == 0)
-    {
-	rc = read_u64 (ptr, limit, rev, &size);
-	if (rc == 0)
-	{
-/*             KOutMsg ("%s %s %lu %lu %lu\n", __func__, common->name, size, offset + foffset, arcsize); */
-            if (arcsize >= offset + foffset + size )
-
-                rc = KTocCreateFile (toc,
-                                 offset + foffset,
-                                 size,
-                                 common->mtime,
-                                 common->access,
-                                 (KCreateMode)(kcmInit|kcmParents),
-                                 common->name);
-            else
-/*                 KOutMsg ("ZOMBIE: %s\n", common->name), */
-
-                rc = KTocCreateZombieFile (toc,
-                                           offset + foffset,
-                                           size,
-                                           common->mtime,
-                                           common->access,
-                                           (KCreateMode)(kcmInit|kcmParents),
-                                           common->name);
-	}
-    }
-    return rc;
-}
-
-static
-rc_t KTocEntryInflateNodeEmptyFile (KToc * toc, const KTocEntryInflateCommon * common, 
-                                    const void ** ptr, uint64_t offset, const void * limit, bool rev)
-{
-    rc_t rc;
-
-    rc = KTocCreateFile (toc,
-                         0,
-                         0,
-                         common->mtime,
-                         common->access,
-                         (KCreateMode)(kcmInit|kcmParents),
-                         common->name);
-    return rc;
-}
-
-static
-rc_t KTocEntryInflateNodeChunked (KToc * toc, const KTocEntryInflateCommon * common, 
-				  const void ** ptr, uint64_t offset, const void * limit, bool rev)
-{
-    rc_t rc;
-    uint64_t size;
-    uint32_t count;
-    KTocChunk * chunks;
-
-    rc = read_u64 (ptr, limit, rev, &size);
-    if (rc == 0)
-    {
-	rc = read_u32 (ptr, limit, rev, &count);
-	if (rc == 0)
-	{
-	    chunks = malloc (sizeof (KTocChunk) * count);
-	    if (chunks == NULL)
-		rc = RC (rcFS, rcTocEntry, rcParsing, rcMemory, rcExhausted);
-	    else
-	    {
-		uint32_t ix;
-		for (ix = 0; (rc == 0) && (ix < count); ++ix)
-		{
-		    if (rc == 0)
-			rc = read_u64 (ptr, limit, rev, &chunks[ix].logical_position);
-		    if (rc == 0)
-		    {
-			rc = read_u64 (ptr, limit, rev, &chunks[ix].source_position);
-			chunks[ix].source_position += offset;
-		    }
-		    if (rc == 0)
-			rc = read_u64 (ptr, limit, rev, &chunks[ix].size);
-		}
-		if (rc == 0)
-		    rc = KTocCreateChunkedFile (toc,
-						size,
-						common->mtime,
-						common->access,
-						count,
-						chunks,
-						(KCreateMode)(kcmInit|kcmParents),
-						common->name);
-		free (chunks);
-	    }
-	}
-    }
-    return rc;
-}
-
-static
-rc_t KTocEntryInflateNodeHardLink (KToc * toc, const KTocEntryInflateCommon * common, 
-				   const void ** ptr, uint64_t offset, const void * limit, bool rev)
-{
-    rc_t rc;
-    uint16_t llen;
-    char * link;
-
-    rc = read_u16 (ptr, limit, rev, &llen);
-    if (rc)
-	return rc;
-
-    if (check_limit (*ptr, limit, llen))
-	return RC (rcFS, rcTocEntry, rcParsing, rcBuffer, rcTooShort);;
-
-    link = malloc (llen + 1);
-    if (link == NULL)
-	return RC (rcFS, rcTocEntry, rcParsing, rcMemory, rcExhausted);
-
-    memcpy (link, ptr, llen);
-    link[llen] = '\0';
-
-    rc = KTocCreateHardLink (toc, 
-			     common->mtime,
-			     common->access,
-			     (KCreateMode)(kcmInit|kcmParents),
-			     link,
-			     common->name);
-    
-    free (link);
-    return rc;
-}
-
-static
-rc_t KTocEntryInflateNodeSoftLink (KToc * toc, const KTocEntryInflateCommon * common, 
-				  const void ** ptr, uint64_t offset, const void * limit, bool rev)
-{
-    rc_t rc;
-    uint16_t llen;
-    char * link;
-
-    rc = read_u16 (ptr, limit, rev, &llen);
-    if (rc)
-	return rc;
-
-    if (check_limit (*ptr, limit, llen))
-	return RC (rcFS, rcTocEntry, rcParsing, rcBuffer, rcTooShort);;
-
-    link = malloc (llen + 1);
-    if (link == NULL)
-	return RC (rcFS, rcTocEntry, rcParsing, rcMemory, rcExhausted);
-
-    memcpy (link, *ptr, llen);
-    link[llen] = '\0';
-
-    rc = KTocCreateSoftLink (toc, 
-			     common->mtime,
-			     common->access,
-			     (KCreateMode)(kcmInit|kcmParents),
-			     link,
-			     common->name);
-    
-    free (link);
-    return rc;
-}
-
-static
-void CC KTocEntryInflate (PBSTNode * n, void * _data)
-{
-    KTocEntryInflateData * data;
-    const void * ptr;
-    const void * limit;
-    KTocEntryInflateCommon common;
-    rc_t rc;
-
-    data = _data;
-    if (data->rc != 0)
-	return;
-    ptr = n->data.addr;
-    limit = (uint8_t*)ptr + n->data.size;
-    rc = KTocEntryInflateNodeCommon (&ptr, limit, &common, data->path, data->rev);
-    if (rc == 0)
-    {
-	switch (common.type)
-	{
-	default:
-	case ktocentrytype_unknown:
-	case ktocentrytype_notfound:
-	    rc = RC (rcFS, rcTocEntry, rcParsing, rcFile, rcCorrupt);
-	    break;
-	case ktocentrytype_dir:
-	    rc = KTocEntryInflateNodeDir (data->toc, &common, &ptr, data->offset,
-                                          data->arcsize, limit, data->rev);
-	    break;
-	case ktocentrytype_file:
-            rc = KTocEntryInflateNodeFile (data->toc, &common, &ptr, data->offset,
-                                           data->arcsize, limit, data->rev);
-	    break;
-	case ktocentrytype_emptyfile:
-	    rc = KTocEntryInflateNodeEmptyFile (data->toc, &common, &ptr, data->offset,
-                                                limit, data->rev);
-	    break;
-	case ktocentrytype_chunked:
-	    rc = KTocEntryInflateNodeChunked (data->toc, &common, &ptr, data->offset, limit, data->rev);
-	    break;
-	case ktocentrytype_softlink:
-	    rc = KTocEntryInflateNodeSoftLink (data->toc, &common, &ptr, data->offset, limit, data->rev);
-	    break;
-	case ktocentrytype_hardlink:
-	    rc = KTocEntryInflateNodeHardLink (data->toc, &common, &ptr, data->offset, limit, data->rev);
-	    break;
-	}
-	free (common.name);
-    }    
-    data->rc = rc; /* return */
-}
-
-rc_t KTocInflatePBSTree ( KToc * self, uint64_t arcsize, const void * treestart, uint32_t maxsize,
-			 uint64_t offset, bool rev, const char * path )
-{
-    rc_t rc;
-    PBSTree * pbst;
-
-    rc = PBSTreeMake (&pbst, treestart, maxsize, rev);
-    if (rc == 0)
-    {
-        KTocEntryInflateData data;
-
-        data.toc = self;
-        data.path = path;
-        data.arcsize = arcsize;
-        data.rc = 0;
-        data.rev = rev;
-        data.offset = offset;
-        
-        PBSTreeForEach (pbst, false, KTocEntryInflate, &data);
-
-        rc = data.rc;
-
-        PBSTreeWhack (pbst);
-    }
-    return rc;
-}
-
-
-/* end of file tocentry.c */
-
diff --git a/libs/kfs/tocfile.c b/libs/kfs/tocfile.c
deleted file mode 100644
index 66cbcda..0000000
--- a/libs/kfs/tocfile.c
+++ /dev/null
@@ -1,636 +0,0 @@
-/*===========================================================================
- *
- *                            Public DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-#include <kfs/extern.h>
-#include <klib/rc.h>
-#include <kfs/file.h>
-#include <kfs/arc.h>
-#include <kfs/toc.h>
-#include <kfs/sra.h>
-#include <kfs/directory.h>
-#include <klib/defs.h>
-#include <klib/log.h>
-#include <klib/debug.h>
-#include <sysalloc.h>
-
-#include "toc-priv.h"
-
-#include <assert.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-
-struct KTocFile;
-#define KFILE_IMPL struct KTocFile
-#include <kfs/impl.h>
-
-#define OPEN_FILE_CACHE_MAX 1
-
-
-/*--------------------------------------------------------------------------
- * FileCacheNode
- */
-typedef struct FileCacheNode FileCacheNode;
-
-struct FileCacheNode
-{
-    BSTNode n;
-    const char *path;
-    const KFile *file;
-    struct FileCacheNode * newer;
-};
-
-static
-int CC FileCacheNodeCmp ( const void *item, const BSTNode *n )
-{
-    const char *a = item;
-    const FileCacheNode *b = ( const FileCacheNode* ) n;
-
-    if ( a < b -> path )
-        return -1;
-    return a > b -> path;
-}
-
-static
-int CC FileCacheNodeSort ( const BSTNode *item, const BSTNode *n )
-{
-    const FileCacheNode *a = ( const FileCacheNode* ) item;
-    const FileCacheNode *b = ( const FileCacheNode* ) n;
-
-    if ( a -> path < b -> path )
-        return -1;
-    return a -> path > b -> path;
-}
-
-static
-void CC FileCacheNodeWhack ( BSTNode *n, void *ignore )
-{
-    FileCacheNode *self = ( FileCacheNode* ) n;
-    KFileRelease ( self -> file );
-    free ( self );
-}
-
-static
-rc_t FileCacheNodeMake ( FileCacheNode **fcnp, const char *path, const KFile *file )
-{
-    FileCacheNode *fcn = malloc ( sizeof *fcn );
-    if ( fcn == NULL )
-        return RC ( rcFS, rcFile, rcReading, rcMemory, rcExhausted );
-
-    fcn -> path = path;
-    fcn -> file = file;
-
-    * fcnp = fcn;
-    return 0;
-}
-
-/*--------------------------------------------------------------------------
- * KTocFile
- */
-
-typedef struct KTocFile
-{
-    KFile dad;
-    const KToc * toc;
-    const KDirectory * dir;
-    uint8_t * header;
-/* these three below fields are mutable */
-    BSTree open_file_cache;     /* opened files by name */
-    FileCacheNode * head;       /* least recently opened */
-    FileCacheNode * tail;       /* most recently opened */
-/* these three above fields are mutable */
-    uint64_t file_size;
-    size_t header_size;
-/* the below field s mutable */
-    uint32_t cache_count;
-/* the above field is mutable */
-} KTocFile;
-
-/* Destroy
- */
-static
-rc_t CC KTocFileDestroy (KTocFile *self)
-{
-    BSTreeWhack ( & self -> open_file_cache, FileCacheNodeWhack, NULL );
-    KTocRelease (self->toc);
-    KDirectoryRelease (self->dir);
-    free (self->header);
-    free (self);
-    return 0;
-}
-
-/* GetSysFile
- *  returns an underlying system file object
- *  and starting offset to contiguous region
- *  suitable for memory mapping, or NULL if
- *  no such file is available.
- *
- * Since this file does not have a system file underlaying the header
- * nor does it have a single file underlaying the various "subfiles"
- * it must return NULL;
- */
-static struct
-KSysFile *CC KTocFileGetSysFile ( const KTocFile *self, uint64_t *offset )
-{
-    * offset = 0;
-    return NULL;
-}
-
-/* RandomAccess
- *  ALMOST by definition, the file is random access
- *  certain file types ( notably compressors ) will refuse random access
- *
- *  returns 0 if random access, error code otherwise
- */
-static
-rc_t CC KTocFileRandomAccess ( const KTocFile *self )
-{
-    assert (self != NULL);
-    return 0;
-}
-
-
-/* Type
- *  returns a KFileDesc
- *  not intended to be a content type,
- *  but rather an implementation class
- */
-static
-uint32_t CC KTocFileType ( const KTocFile *self )
-{
-    return kfdFile;
-}
-
-
-/* Size
- *  returns size in bytes of file
- *
- *  "size" [ OUT ] - return parameter for file size
- */
-static
-rc_t CC KTocFileSize ( const KTocFile *self, uint64_t *size )
-{
-    assert (self != NULL);
-    assert (size != NULL);
-
-    *size = self->file_size;
-    return 0;
-}
-
-/* SetSize
- *  sets size in bytes of file
- *
- *  "size" [ IN ] - new file size
- */
-static
-rc_t CC KTocFileSetSize ( KTocFile *self, uint64_t size )
-{
-    return RC (rcFS, rcFile, rcUpdating, rcToc, rcUnsupported);
-}
-
-/* Read
- *  read file from known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually read
- */
-static
-size_t get_filler (const KTocFile *self, size_t z)
-{
-    size_t align = KTocAlignmentGet((KToc *)self->toc); /* type convert mutable field */
-    if (align > 1)
-    {
-        size_t mask = (size_t)align - 1;    /* get significant bits */
-        return (align - (z & mask)) & mask;
-    }
-    return 0;
-}
-
-static
-rc_t CC KTocFileRead ( const KTocFile *self, uint64_t _pos,
-    void *_buffer, size_t bsize, size_t *num_read )
-{
-    rc_t rc;
-    uint64_t pos;
-    uint8_t * buffer;
-    size_t filler;
-
-    assert (self != NULL);
-    assert (_buffer != NULL);
-
-    TOC_DEBUG (("%s: off %ju siz %zu ------\n", __func__, _pos, bsize));
-    TOC_DEBUG (("%s: self->file_size %lu\n", __func__, self->file_size));
-    rc = 0;
-    pos = _pos;
-    buffer = _buffer;
-
-    *num_read = 0;
-
-    /* go ahead and trim from read attempts anything beyond EOF
-     * return as EOF if we are asked to read beyond virtual file size
-     */
-    if (pos > self->file_size)  /* fully past EOF quit now */
-    {
-        TOC_DEBUG (("KTocFileRead read 0 past EOF"));
-	return 0;
-    }
-
-    if ((pos + bsize) > self->file_size)        /* partially past EOF quit at EOF */
-    {
-	bsize = (size_t)( self->file_size - pos );
-        TOC_DEBUG (("KTocFileRead trimmed read to %zu\n",bsize));
-    }
-
-    filler = get_filler (self, self->header_size);
-
-    /* get portion of read from header */
-    if (pos < (uint64_t) (self->header_size + filler))
-    {
-	size_t to_read = 0;
-
-        TOC_DEBUG (("%s size of header %zu filler after header %zu\n",
-                    __func__, self->header_size, filler));
-
-        /* header proper */
-        if (pos < self->header_size)
-        {
-            to_read = self->header_size - (size_t)pos;
-            if (to_read > bsize)
-                to_read = bsize;
-            memcpy (buffer, self->header + pos, to_read);
-
-            pos += to_read;
-            bsize -= to_read;
-        }
-        /* filler after header */
-        if (pos != self->header_size)    /* didn't reach end of header */
-            filler = 0;
-        else
-        {
-            if (filler > bsize)
-                filler = bsize;
-            if (filler)
-            {
-                memset (buffer + to_read, 0, filler);
-            }
-        }
-
-	/* exit on partial read */
-	*num_read = to_read + filler;
-        TOC_DEBUG (("%s hdr read %zu", __func__, *num_read));
-	return 0;
-    }
-    else
-        /* start in on files */
-    {
-        uint64_t fpos;
-        uint64_t fsize;
-        const char * path;
-        const KDirectory * dir;
-        size_t to_read;
-        size_t this_read;
-        size_t all_read;
-        size_t filler;
-
-        *num_read = all_read = to_read = 0;
-
-        dir = KTocGetArchive (self->toc);
-        rc = KTocResolvePathFromOffset (self->toc, &path, &fpos, pos);
-        if (path != NULL)
-        {
-            if (rc != 0)
-            {
-                TOC_DEBUG (("%s can't resolve offset $(O) %R\n", __func__, pos, rc));
-                return rc;
-            }
-            TOC_DEBUG (("%s reading \"%s\" at offset %ju\n", __func__, path, pos));
-            rc = KDirectoryVFileSize (dir, &fsize, path, NULL);
-            if (rc != 0)
-            {
-                TOC_DEBUG (("%s can't  determine sub file size  %s %R\n", __func__, path, rc));
-                return rc;
-            }
-            TOC_DEBUG (("%s size %ju\n", __func__, fsize));
-
-            if ((fpos + bsize) <= fsize)
-            {
-                filler = 0;
-                to_read = bsize;
-            }
-            else
-            {
-                filler = get_filler ( self, (size_t)fsize );
-                if ( bsize > ( fsize + filler ) )
-                    bsize = (size_t)( fsize + filler );
-
-                if (fpos < fsize)
-                {
-                    to_read = (size_t)( fsize - fpos );
-                    if (bsize <  (to_read + filler))
-                        filler = bsize - to_read;
-                }
-                else
-                {
-                    to_read = 0;
-                    if (filler > bsize)
-                        filler = bsize;
-                }
-            }
-
-            if (to_read)
-            {
-                KTocFile *mself = (KTocFile *)self;        /* to access mutable fields within self */
-                FileCacheNode *n;
-
-                TOC_DEBUG (("%s subfile %s\n", __func__, path));
-
-                /* look in cache */
-                n = ( FileCacheNode* ) BSTreeFind ( & mself -> open_file_cache,
-                                                    path, FileCacheNodeCmp );
-                if ( n != NULL )
-                {
-                    FileCacheNode * this_one;
-                    TOC_DEBUG (("%s cache hit for subfile %s\n", __func__, path));
-
-                    for (this_one = mself->head; this_one != n; this_one = this_one->newer)
-                    {
-                        if (this_one == NULL)
-                            return RC (rcFS, rcFile, rcOpening, rcToc, rcCorrupt);
-                    }
-                    if (mself->tail != mself->head) /* nothing to do if only one in queue */
-                    {
-                        if (this_one == mself->head)
-                        {
-                            mself->head = n->newer;
-                            n->newer = NULL;
-                            this_one = mself->tail;
-                            /* race condition possible: bad if next pair of assigns is not atomic and multi-threading */
-                            mself->tail = this_one->newer = n;
-                        }
-                    }
-                }
-                else
-                {
-                    const KFile * file;
-
-                    for (;;)
-                    {
-                        /* if we don't have too many files open, try to close something in the cache */
-                        if (mself->cache_count <= OPEN_FILE_CACHE_MAX)
-                        {
-                            TOC_DEBUG (("%s open subfile %s\n", __func__, path));
-                            /* open file on demand */
-                            rc = KDirectoryVOpenFileRead (KTocGetArchive(self->toc), &file, path, NULL);
-                            if (rc == 0)
-                                break;
-                        }
-                        
-                        /* if we've run out of file descriptors try clearing the cache a bit */
-                        if ((rc == 0) ||
-                            ((GetRCObject(rc) == rcFileDesc) &&
-                             (GetRCState(rc) == rcExhausted)))
-                        {
-                            TOC_DEBUG (("%s no more file descriptors\n", __func__));
-
-                            if (mself->cache_count != 0)
-                            {
-                                FileCacheNode * pn;
-
-                                rc = 0;
-                                pn = mself->head;
-                                TOC_DEBUG (("%s cache closing %s\n", __func__, pn->path));
-                                BSTreeUnlink (&mself->open_file_cache, &pn->n);
-                                mself->cache_count--;
-                                mself->head = pn->newer;
-                                (void)FileCacheNodeWhack (&pn->n, NULL);
-                                continue;
-                            }
-                        }
-                        return rc;
-                    }
-
-                    /* create a new cache node */
-                    rc = FileCacheNodeMake ( & n, path, file );
-                    if ( rc != 0 )
-                    {
-                        TOC_DEBUG (("%s %R  can't cache sub file %s\n", __func__, rc, path));
-                        KFileRelease ( file );
-                        return rc;
-                    }
-
-                    /* insert into cache */
-                    BSTreeInsert ( & mself -> open_file_cache, & n -> n, FileCacheNodeSort );
-                    mself->cache_count++;
-                    if (mself->head == NULL)
-                        mself->head = mself->tail = n;
-                    else
-                    {
-                        mself->tail->newer = n;
-                        mself->tail = n;
-                    }
-                }
-
-                rc = KFileRead (n ->file, fpos, buffer, to_read, &this_read);
-                if ( rc != 0)
-                {
-                    TOC_DEBUG (("%s %R error reading sub file %s\n", __func__, rc, path));
-                    return rc;
-                }
-            }
-            if (filler)
-                memset (buffer+to_read, 0, filler);
-
-            *num_read = to_read + filler;
-            TOC_DEBUG (("%s file %s read %zu\n", __func__, path, *num_read));
-        }
-    }
-    return rc;
-}
-
-/* Write
- *  write file at known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ IN ] and "size" [ IN ] - data to be written
- *
- *  "num_writ" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually written
- */
-static
-rc_t CC KTocFileWrite ( KTocFile *self, uint64_t pos,
-    const void *buffer, size_t size, size_t *num_writ)
-{
-    assert ( self != NULL );
-    return RC (rcFS, rcFile, rcWriting, rcToc, rcUnsupported);
-}
-
-
-static const KFile_vt_v1 vtKTocFile =
-{
-    /* version 1.1 */
-    1, 1,
-
-    /* start minor version 0 methods */
-    KTocFileDestroy,
-    KTocFileGetSysFile,
-    KTocFileRandomAccess,
-    KTocFileSize,
-    KTocFileSetSize,
-    KTocFileRead,
-    KTocFileWrite,
-    /* end minor version 0 methods */
-
-    /* start minor version == 1 */
-    KTocFileType
-    /* end minor version == 1 */
-};
-
-LIB_EXPORT rc_t CC KTocFileMake ( const KFile ** pself,
-		   const KToc * toc,
-		   const KDirectory * dir,
-		   void * header,
-		   uint64_t file_size,
-		   size_t header_size )
-{
-    KTocFile * self;
-    rc_t rc;
-
-    rc = 0;
-    self = malloc (sizeof (*self));
-    if (self == NULL)
-    {
-	rc = RC (rcFS, rcFile, rcConstructing, rcMemory, rcExhausted);
-	LOGERR (klogErr, rc, "Out of memory in KTocFileMake");
-    }
-    else
-    {
-	rc = KFileInit (&self->dad, (const KFile_vt*)&vtKTocFile, "KTocFile", "no-name", true, false);
-	if (rc != 0)
-	{
-	    LOGERR (klogErr, rc, "Init failure in KTocFileMake");
-	}
-	else
-	{
-	    self->toc = toc;
-	    self->dir = dir;
-	    self->header = header;
-            BSTreeInit ( & self -> open_file_cache );
-            self->head = self->tail = NULL;
-            self->cache_count = 0;
-	    self->file_size = file_size;
-	    self->header_size = header_size;
-            TOC_DEBUG (("%s: file_size %lu header_size %u\n", __func__, file_size, header_size));
-	    KTocAddRef (toc);
-	    KDirectoryAddRef (dir);
-	    *pself = &self->dad;
-	    return 0;
-	}
-	free (self);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDirectoryOpenTocFileRead ( const KDirectory * self,
-				const KFile ** pfile,
-                                KSRAFileAlignment align,
-				bool ( CC * filter ) ( const KDirectory*, const char*, void* ),
-				void * filter_param,
-				rc_t ( CC * usort ) ( const KDirectory*, struct Vector* ) )
-{
-    rc_t rc;
-
-    TOC_DEBUG (("%s: enter\n",__func__));
-
-    rc = 0;
-    if (self == NULL)
-    {
-	rc = RC (rcFS, rcDirectory, rcConstructing, rcSelf, rcNull);
-	LOGERR (klogErr, rc, "Directory NULL in constructing a TocFile");
-	return rc;
-    }
-    if (pfile == NULL)
-    {
-	rc = RC (rcFS, rcDirectory, rcConstructing, rcParam, rcNull);
-	LOGERR (klogErr, rc, "file pointer parameter NULL in constructing a TocFile");
-	return rc;
-    }
-    if (rc == 0)
-    {
-	const KDirectory * dir;
-
-	rc = KDirectoryOpenArcDirRead (self, &dir, true, ".", tocKDirectory,
-				       KArcParseKDir, filter, filter_param);
-	if (rc != 0)
-	{
-	    LOGERR (klogErr, rc, "Failure to parse directory to TOC");
-	}
-	else
-	{
-	    void * header;
-	    uint64_t file_size;
-	    size_t header_size;
-
-            TOC_DEBUG (("%s: Persisting header\n", __func__));
-	    rc = KArcDirPersistHeader ((KArcDir*)dir, &header, &header_size, &file_size, align, usort);
-	    if (rc == 0)
-	    {
-		const KToc * toc;
-
-                TOC_DEBUG (("%s: Get TOC\n", __func__));
-		rc = KArcDirGetTOC ((const KArcDir*)dir, &toc); /* does not addref() */
-		if (rc != 0)
-		{
-		    LOGERR (klogErr, rc, "Failure to parse directory to TOC");
-		}
-		else
-		{
-		    const KFile * file;
-
-                    TOC_DEBUG (("%s: call KTocFileMake file_size %lu \n", __func__, file_size));
-
-		    rc = KTocFileMake (&file, toc, self, header, file_size, header_size);
-		    if (rc != 0)
-		    {
-			LOGERR (klogErr, rc, "Failure to make KTocFile");
-		    }
-		    else
-		    {
-			*pfile = file;
-		    }
-		}
-	    }
-            KDirectoryRelease (dir);
-	}
-    }
-    return rc;
-}
-						
-
-/* end of file dirfile.c */
diff --git a/libs/kfs/unix/sysdir-priv.h b/libs/kfs/unix/sysdir-priv.h
deleted file mode 100644
index ceebc8e..0000000
--- a/libs/kfs/unix/sysdir-priv.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_sysdir_priv_
-#define _h_sysdir_priv_
-
-#ifndef _h_kfs_impl_
-#include <kfs/impl.h>
-#endif
-
-#ifndef _h_klib_rc_
-#include <klib/rc.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * KSysDir
- *  a Unix directory
- */
-typedef struct KSysDir KSysDir;
-
-/* MakePath
- *  create a full path from partial
- *
- *  "ctx" [ IN ] - a prepared context for returning non-zero rc_t
- *
- *  "canon" [ IN ] - if true, rewrite path in canonical form. usually
- *  not required when passing a path to the system, as the OS performs
- *  its own processing.
- *
- *  "bufer" [ OUT ] and "path_max" [ IN ] - return buffer for processed path
- *
- *  "path" [ IN ] and "args" [ IN, NULL OKAY ] - input path to be resolved
- */
-rc_t KSysDirMakePath ( struct KSysDir const *self, enum RCContext ctx, bool canon,
-    char *buffer, size_t path_max, const char *path, va_list args );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*  _h_sysdir_priv_ */
diff --git a/libs/kfs/unix/sysdir.c b/libs/kfs/unix/sysdir.c
deleted file mode 100644
index fb450fa..0000000
--- a/libs/kfs/unix/sysdir.c
+++ /dev/null
@@ -1,2408 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#define TRACK_REFERENCES 0
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KSysDir;
-struct KSysDirListing;
-
-#define KDIR_IMPL struct KSysDir
-#define KNAMELIST_IMPL struct KSysDirListing
-
-#include <kfs/extern.h>
-#include "sysdir-priv.h"
-#include "sysfile-priv.h"
-#include <klib/sort.h>
-#include <klib/impl.h>
-#include <klib/log.h>
-#include <klib/out.h>
-#include <klib/rc.h>
-#include <klib/klib-priv.h>
-#include <sysalloc.h>
-
-#include "os-native.h"
-
-#ifndef __USE_UNIX98
-#define __USE_UNIX98 1
-#endif
-#include <unistd.h>
-
-/* old Sun includes won't define PATH_MAX */
-#ifndef __XOPEN_OR_POSIX
-#define __XOPEN_OR_POSIX 1
-#endif
-
-#include <limits.h>
-
-/* now they won't define lstat */
-#undef __XOPEN_OR_POSIX
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <utime.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * KSysDirEnum
- *  a Unix directory enumerator
- */
-typedef struct KSysDirEnum KSysDirEnum;
-struct KSysDirEnum
-{
-    DIR *dir;
-};
-
-/* Whack
- */
-static
-void KSysDirEnumWhack ( KSysDirEnum *self )
-{
-    closedir ( self -> dir );
-}
-
-/* Init
- */
-static
-rc_t KSysDirEnumInit ( KSysDirEnum *self, const char *path )
-{
-    self -> dir = opendir ( path );
-    if ( self -> dir != NULL )
-        return 0;
-
-    switch ( errno )
-    {
-    case EACCES:
-        return RC ( rcFS, rcDirectory, rcListing, rcDirectory, rcUnauthorized );
-    case EMFILE:
-    case ENFILE:
-        return RC ( rcFS, rcDirectory, rcListing, rcFileDesc, rcExhausted );
-    case ENOENT:
-        return RC ( rcFS, rcDirectory, rcListing, rcPath, rcNotFound );
-    case ENOMEM:
-        return RC ( rcFS, rcDirectory, rcListing, rcMemory, rcExhausted );
-    case ENOTDIR:
-        return RC ( rcFS, rcDirectory, rcListing, rcPath, rcIncorrect );
-    }
-
-    return RC ( rcFS, rcDirectory, rcListing, rcNoObj, rcUnknown );
-}
-
-/* Next
- */
-static
-const char *KSysDirEnumNext ( const KSysDirEnum *self )
-{
-    while ( 1 )
-    {
-        struct dirent *e = readdir ( self -> dir );
-        if ( e == NULL )
-            break;
-
-        if ( e -> d_name [ 0 ] == '.' )
-        {
-            switch ( e -> d_name [ 1 ] )
-            {
-            case 0:
-                continue;
-            case '.':
-                if ( e -> d_name [ 2 ] == 0 )
-                    continue;
-                break; 
-            }
-        }
-
-        return e -> d_name;
-    }
-
-    return NULL;
-}
-
-
-/*--------------------------------------------------------------------------
- * KSysDirListing
- *  a Unix directory listing
- */
-typedef struct KSysDirListing KSysDirListing;
-struct KSysDirListing
-{
-    KNamelist dad;
-    const char **namelist;
-    int cnt;
-};
-
-/* Whack
- */
-static
-rc_t KSysDirListingWhack ( const KSysDirListing *self )
-{
-    int i;
-    for ( i = 0; i < self -> cnt; ++ i )
-        free ( ( void* ) self -> namelist [ i ] );
-    free ( self -> namelist );
-    return 0;
-}
-
-static
-rc_t KSysDirListingDestroy ( KSysDirListing *self )
-{
-    rc_t rc = KSysDirListingWhack ( self );
-    if ( rc == 0 )
-        free ( self );
-    return rc;
-}
-
-/* Count
- */
-static
-rc_t KSysDirListingCount ( const KSysDirListing *self, uint32_t *count )
-{
-    * count = self -> cnt;
-    return 0;
-}
-
-/* Get
- */
-static
-rc_t KSysDirListingGet ( const KSysDirListing *self, uint32_t idx, const char **name )
-{
-    if ( idx >= ( uint32_t ) self -> cnt )
-        return RC ( rcFS, rcNamelist, rcAccessing, rcParam, rcExcessive );
-    * name = self -> namelist [ idx ];
-    return 0;
-}
-
-/* Init
- */
-static KNamelist_vt_v1 vtKSysDirListing =
-{
-    /* version 1.0 */
-    1, 0,
-
-    /* start minor version 0 methods */
-    KSysDirListingDestroy,
-    KSysDirListingCount,
-    KSysDirListingGet
-    /* end minor version 0 methods */
-};
-
-static
-int KSysDirListingSort ( const void *a, const void *b, void * ignored )
-{
-    return strcmp ( * ( const char** ) a, * ( const char** ) b );
-}
-
-static
-rc_t KSysDirListingInit ( KSysDirListing *self, const char *path, const KDirectory *dir,
-    bool ( * f ) ( const KDirectory*, const char*, void* ), void *data )
-{
-    rc_t rc;
-
-    self -> namelist = NULL;
-    self -> cnt = 0;
-
-    rc = KNamelistInit ( & self -> dad,
-        ( const KNamelist_vt* ) & vtKSysDirListing );
-    if ( rc == 0 )
-    {
-        KSysDirEnum list;
-        rc = KSysDirEnumInit ( & list, path );
-        if ( rc == 0 )
-        {
-            uint32_t len = 512;
-            self -> namelist = malloc ( len * sizeof self -> namelist [ 0 ] );
-            if ( self -> namelist == NULL )
-                rc = RC ( rcFS, rcDirectory, rcListing, rcMemory, rcExhausted );
-            else
-            {
-                void *r;
-                const char *name;
-                while ( ( name = KSysDirEnumNext ( & list ) ) != NULL )
-                {
-                    if ( f != NULL )
-                    {
-                        if ( ! ( * f ) ( dir, name, data ) )
-                            continue;
-                    }
-                    
-                    if ( self -> cnt == len )
-                    {
-                        len += len;
-                        r = realloc ( self -> namelist,
-                            len * sizeof self -> namelist [ 0 ] );
-                        if ( r == NULL )
-                        {
-                            rc = RC ( rcFS, rcDirectory, rcListing, rcMemory, rcExhausted );
-                            break;
-                        }
-                        self -> namelist = r;
-                    }
-
-                    self -> namelist [ self -> cnt ] = malloc ( strlen ( name ) + 1 );
-                    if ( self -> namelist [ self -> cnt ] == NULL )
-                    {
-                        rc = RC ( rcFS, rcDirectory, rcListing, rcMemory, rcExhausted );
-                        break;
-                    }
-                    strcpy ( ( char* ) self -> namelist [ self -> cnt ], name );
-                    ++ self -> cnt;
-                }
-
-                if ( rc == 0 )
-                {
-                    r = realloc ( self -> namelist,
-                        self -> cnt * sizeof self -> namelist [ 0 ] );
-                    if ( r != NULL )
-                    {
-                        self -> namelist = r;
-                        ksort ( r, self -> cnt, sizeof self -> namelist [ 0 ], KSysDirListingSort, NULL );
-                    }
-                    else if ( self -> cnt != 0 )
-                    {
-                        rc = RC ( rcFS, rcDirectory, rcListing, rcMemory, rcExhausted );
-                    }
-                    else
-                    {
-                        self -> namelist = r;
-                    }
-                }
-
-                if ( rc != 0 )
-                {
-                    KSysDirListingWhack ( self );
-                    self -> namelist = NULL;
-                    self -> cnt = 0;
-                }
-            }
-
-            KSysDirEnumWhack ( & list );
-        }
-    }
-    return rc;
-}
-
-/*--------------------------------------------------------------------------
- * KSysDir
- *  a Unix directory
- */
-struct KSysDir
-{
-    KDirectory dad;
-    uint32_t root;
-    uint32_t size;
-    char path [ PATH_MAX ];
-};
-
-/* KSysDirMake
- *  allocate an uninialized object
- */
-static
-KSysDir *KSysDirMake ( size_t path_size )
-{
-    KSysDir *dir = malloc ( ( sizeof * dir - sizeof dir -> path + 2 ) + path_size );
-    return dir;
-}
-
-/* KSysDirDestroy
- */
-static
-rc_t KSysDirDestroy ( KSysDir *self )
-{
-    free ( self );
-    return 0;
-}
-
-/* KSysDirInit
- */
-static
-rc_t KSysDirInit ( KSysDir *self, enum RCContext ctx, uint32_t dad_root,
-    const char *path, uint32_t path_size, bool update, bool chroot );
-
-
-/* KSysDirCanonPath
- */
-static
-rc_t KSysDirCanonPath ( const KSysDir *self, enum RCContext ctx, char *path, size_t psize )
-{
-    char *low, *dst, *last, *end = path + psize;
-    low = dst = last = path + self -> root;
-
-    while ( 1 )
-    {
-        char *src = strchr ( last + 1, '/' );
-        if ( src == NULL )
-            src = end;
-
-        /* detect special sequences */
-        switch ( src - last )
-        {
-        case 2:
-            if ( last [ 1 ] == '.' )
-            {
-                /* skip over */
-                last = src;
-                if ( src != end )
-                    continue;
-            }
-            break;
-
-        case 3:
-            if ( last [ 1 ] == '.' && last [ 2 ] == '.' )
-            {
-                /* remove previous leaf in path */
-                dst [ 0 ] = 0;
-                dst = strrchr ( path, '/' );
-                if ( dst == NULL || dst < low )
-                    return RC ( rcFS, rcDirectory, ctx, rcPath, rcInvalid );
-
-                last = src;
-                if ( src != end )
-                    continue;
-            }
-            break;
-        }
-
-        /* if rewriting, copy leaf */
-        assert ( src >= last );
-
-        if ( dst != last )
-            memmove ( dst, last, src - last );
-
-        /* move destination ahead */
-        dst += src - last;
-        
-        /* if we're done, go */
-        if ( src == end )
-                break;
-
-        /* find next separator */
-        last = src;
-    }
-
-    /* NUL terminate if modified */
-    if ( dst != end )
-        * dst = 0;
-
-    return 0;
-}
-
-/* KSysDirMakePath
- *  creates a full path from partial
- */
-rc_t KSysDirMakePath ( const KSysDir *self, enum RCContext ctx, bool canon,
-    char *buffer, size_t path_max, const char *path, va_list args )
-{
-    int psize;
-    size_t bsize;
-
-    if ( path == NULL )
-        return RC ( rcFS, rcDirectory, ctx, rcPath, rcNull );
-    if ( path [ 0 ] == 0 )
-        return RC ( rcFS, rcDirectory, ctx, rcPath, rcInvalid );
-
-    if ( args != NULL && path [ 0 ] == '%' )
-    {
-        psize = vsnprintf ( buffer, path_max, path, args );
-        if ( psize < 0 || psize >= path_max )
-            return RC ( rcFS, rcDirectory, ctx, rcPath, rcExcessive );
-        if ( buffer [ 0 ] != '/' )
-        {
-            bsize = self -> size;
-            if ( bsize + psize >= path_max )
-                return RC ( rcFS, rcDirectory, ctx, rcPath, rcExcessive );
-            memmove ( buffer + bsize, buffer, psize + 1 );
-            assert ( self -> path [ bsize - 1 ] == '/' );
-            memcpy ( buffer, self -> path, bsize );
-        }
-        else if ( ( bsize = self -> root ) != 0 )
-        {
-            if ( bsize + psize >= path_max )
-                return RC ( rcFS, rcDirectory, ctx, rcPath, rcExcessive );
-            memmove ( buffer + bsize, buffer, psize + 1 );
-            assert ( self -> path [ bsize - 1 ] != '/' );
-            memcpy ( buffer, self -> path, bsize );
-        }
-    }
-    else
-    {
-        if ( path [ 0 ] != '/' )
-        {
-            assert ( self -> path [ self -> size - 1 ] == '/' );
-            memcpy ( buffer, self -> path, bsize = self -> size );
-        }
-        else if ( ( bsize = self -> root ) != 0 )
-        {
-            assert ( self -> path [ bsize - 1 ] != '/' );
-            memcpy ( buffer, self -> path, bsize );
-        }
-
-        if ( args == NULL )
-            psize = snprintf ( buffer + bsize, path_max - bsize, "%s", path );
-        else
-            psize = vsnprintf ( buffer + bsize, path_max - bsize, path, args );
-
-        if ( psize < 0 || bsize + psize >= path_max )
-            return RC ( rcFS, rcDirectory, ctx, rcPath, rcExcessive );
-    }
-
-    /* remove trailing slashes; keep the leading slash */
-    while ( bsize + psize > 1 && buffer [ bsize + psize - 1] == '/' )
-        buffer [ bsize + -- psize ] = 0;
-
-    if ( psize > 0 && ( canon || self -> root != 0 ) )
-        return KSysDirCanonPath ( self, ctx, buffer, bsize + psize );
-
-    return 0;
-}
-
-
-/* RealPath
- *  returns a real OS path
- */
-rc_t KSysDirVRealPath ( const KSysDir *self,
-    char *real, size_t bsize, const char *path, va_list args )
-{
-    char full [ PATH_MAX ];
-    rc_t rc = KSysDirMakePath ( self, rcLoading, false,
-        full, sizeof full, path, args );
-    assert ( bsize >= PATH_MAX );
-    if ( rc == 0 && realpath ( full, real ) == NULL )
-    {
-        switch ( errno )
-        {
-        case EACCES:
-            return RC ( rcFS, rcDylib, rcLoading, rcDirectory, rcUnauthorized );
-        case ENOTDIR:
-        case EINVAL:
-        case ELOOP:
-            return RC ( rcFS, rcDylib, rcLoading, rcPath, rcInvalid );
-        case EIO:
-            return RC ( rcFS, rcDylib, rcLoading, rcTransfer, rcUnknown );
-        case ENAMETOOLONG:
-            return RC ( rcFS, rcDylib, rcLoading, rcPath, rcExcessive );
-        case ENOENT:
-            return RC ( rcFS, rcDylib, rcLoading, rcPath, rcNotFound );
-        default:
-            return RC ( rcFS, rcDylib, rcLoading, rcNoObj, rcUnknown );
-        }
-    }
-
-    return rc;
-}
-
-rc_t KSysDirRealPath ( const KSysDir *self,
-    char *real, size_t bsize, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KSysDirVRealPath ( self, real, bsize, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-/* KSysDirList
- *  create a directory listing
- *
- *  "list" [ OUT ] - return parameter for list object
- *
- *  "path" [ IN, NULL OKAY ] - optional parameter for target
- *  directory. if NULL, interpreted to mean "."
- */
-static
-rc_t KSysDirList ( const KSysDir *self, KNamelist **listp,
-    bool ( * f ) ( const KDirectory *dir, const char *name, void *data ), void *data,
-    const char *path, va_list args )
-{
-    KSysDir full;
-    rc_t rc = KSysDirMakePath ( self, rcListing, true,
-        full . path, sizeof full . path, path, args );
-    if ( rc == 0 )
-    {
-        rc = KSysDirInit ( & full, rcListing, self -> root,
-            NULL, strlen ( full . path ), 0, 0 );
-        if ( rc == 0 )
-        {
-            KSysDirListing *list = malloc ( sizeof * list );
-            if ( list == NULL )
-                rc = RC ( rcFS, rcDirectory, rcListing, rcMemory, rcExhausted );
-            else
-            {
-                rc = KSysDirListingInit ( list,
-                    full . path, & full . dad, f, data );
-                if ( rc != 0 )
-                    free ( list );
-                else
-                    * listp = & list -> dad;
-            }
-        }
-    }
-    return rc;
-}
-
-
-/* KSysDirPathType
- *  returns a KPathType
- *
- *  "path" [ IN ] - NUL terminated string in directory-native character set
- */
-static
-uint32_t KSysDirFullPathType ( const char *path )
-{
-    struct stat st;
-    int type, alias;
-
-    if ( lstat ( path, & st ) != 0 ) switch ( errno )
-    {
-    case ENOENT:
-        return kptNotFound;
-    default:
-        return kptBadPath;
-    }
-
-    alias = 0;
-
-    if ( S_ISLNK ( st . st_mode ) )
-    {
-        alias = kptAlias;
-
-        if ( stat ( path, & st ) != 0 ) switch ( errno )
-        {
-        case ENOENT:
-            return kptNotFound | alias;
-        default:
-            return kptBadPath | alias;
-        } 
-    }
-
-    /* not a bad assumption */
-    type = kptFile;
-
-    /* overrides */
-    if ( S_ISDIR ( st . st_mode ) )
-        type = kptDir;
-    else if ( S_ISCHR ( st . st_mode ) )
-        type = kptCharDev;
-    else if ( S_ISBLK ( st . st_mode ) )
-        type = kptBlockDev;
-    else if ( S_ISFIFO ( st . st_mode ) )
-        type = kptFIFO;
-    else if ( S_ISSOCK ( st . st_mode ) )
-        type = kptFIFO;
-
-    /* add in alias bit */
-    return type | alias;
-}
-
-static
-uint32_t KSysDirPathType ( const KSysDir *self, const char *path, va_list args )
-{
-    char full [ PATH_MAX ];
-    rc_t rc = KSysDirMakePath ( self, rcAccessing, false, full, sizeof full, path, args );
-    if ( rc == 0 )
-        return KSysDirFullPathType ( full );
-    return kptBadPath;
-}
-
-/* KSysDirVisit
- *  visit each path under designated directory,
- *  recursively if so indicated
- *
- *  "recurse" [ IN ] - if non-zero, recursively visit sub-directories
- *
- *  "f" [ IN ] and "data" [ IN, OPAQUE ] - function to execute
- *  on each path. receives a base directory and relative path
- *  for each entry, where each path is also given the leaf name
- *  for convenience. if "f" returns non-zero, the iteration will
- *  terminate and that value will be returned. NB - "dir" will not
- *  be the same as "self".
- *
- *  "path" [ IN ] - NUL terminated string in directory-native character set
- */
-typedef struct KSysDirVisitData KSysDirVisitData;
-struct KSysDirVisitData
-{
-    rc_t ( * f ) ( KDirectory*, uint32_t, const char*, void* );
-    void *data;
-    KSysDir dir;
-    bool recurse;
-};
-
-static
-rc_t KSysDirVisitDir ( KSysDirVisitData *pb )
-{
-    /* get a directory listing */
-    KSysDirEnum listing;
-    rc_t rc = KSysDirEnumInit ( & listing, pb -> dir . path );
-    if ( rc == 0 )
-    {
-        const char *name;
-        uint32_t size = pb -> dir . size;
-
-        /* complete directory path */
-        pb -> dir . path [ size ] = '/';
-        if ( ++ size >= sizeof pb -> dir . path )
-            rc = RC ( rcFS, rcDirectory, rcVisiting, rcPath, rcExcessive );
-        else for ( pb -> dir . size = size, name = KSysDirEnumNext ( & listing );
-                   name != NULL; name = KSysDirEnumNext ( & listing ) )
-        {
-            uint32_t type, len = strlen ( name );
-            if ( size + len >= sizeof pb -> dir . path )
-            {
-                rc = RC ( rcFS, rcDirectory, rcVisiting, rcPath, rcExcessive );
-                break;
-            }
-            strcpy ( & pb -> dir . path [ size ], name );
-
-            type = KSysDirFullPathType ( pb -> dir . path );
-            if ( type == kptBadPath )
-            {
-                rc = RC ( rcFS, rcDirectory, rcVisiting, rcPath, rcInvalid );
-                break;
-            }
-
-            rc = ( * pb -> f ) ( & pb -> dir . dad, type, name, pb -> data );
-            if ( rc != 0 )
-                break;
-
-            if ( pb -> recurse && ( type & ( kptAlias - 1 ) ) == kptDir )
-            {
-                pb -> dir . size += len;
-                rc = KSysDirVisitDir ( pb );
-                pb -> dir . size = size;
-                if ( rc != 0 )
-                    break;
-            }
-        }
-
-        
-        KSysDirEnumWhack ( & listing );
-    }
-    return rc;
-}
-
-static
-rc_t KSysDirVisit ( const KSysDir *self, bool recurse,
-    rc_t ( * f ) ( KDirectory *dir, uint32_t type, const char *name, void *data ), void *data,
-    const char *path, va_list args )
-{
-    KSysDirVisitData pb;
-    rc_t rc = KSysDirMakePath ( self, rcVisiting, true,
-        pb . dir . path, sizeof pb . dir . path, path, args );
-    if ( rc == 0 )
-    {
-        uint32_t path_size;
-
-        switch ( KSysDirFullPathType ( pb . dir . path ) & ( kptAlias - 1 ) )
-        {
-        case kptNotFound:
-            return RC ( rcFS, rcDirectory, rcVisiting, rcPath, rcNotFound );
-        case kptBadPath:
-            return RC ( rcFS, rcDirectory, rcVisiting, rcPath, rcInvalid );
-        case kptDir:
-            break;
-        default:
-            return RC ( rcFS, rcDirectory, rcVisiting, rcPath, rcIncorrect );
-        }
-
-        path_size = strlen ( pb . dir . path );
-        while ( path_size > 1 && path_size > self -> root && pb . dir . path [ path_size - 1 ] == '/' )
-            -- path_size;
-
-        rc = KSysDirInit ( & pb . dir, rcVisiting, self -> root,
-            NULL, path_size, self -> dad . read_only ? 0 : 1, 0 );
-        if ( rc == 0 )
-        {
-            pb . f = f;
-            pb . data = data;
-            pb . recurse = recurse;
-            pb . dir . path [ -- pb . dir . size ] = 0;
-            rc = KSysDirVisitDir ( & pb );
-        }
-    }
-    return rc;
-}
-
-/* KSysDirRelativePath
- *  makes "path" relative to "root"
- *  both "root" and "path" MUST be absolute
- *  both "root" and "path" MUST be canonical, i.e. have no "./" or "../" sequences
- */
-static
-rc_t KSysDirRelativePath ( const KSysDir *self, enum RCContext ctx,
-    const char *root, char *path, size_t path_max )
-{
-    int backup;
-    size_t bsize, psize;
-
-    const char *r = root + self -> root;
-    const char *p = path + self -> root;
-
-    assert ( r != NULL && r [ 0 ] == '/' );
-    assert ( p != NULL && p [ 0 ] == '/' );
-
-    for ( ; * r == * p; ++ r, ++ p )
-    {
-        /* disallow identical paths */
-        if ( * r == 0 )
-            return RC ( rcFS, rcDirectory, ctx, rcPath, rcInvalid );
-    }
-
-    /* paths are identical up to "r","p"
-       if "r" is within a leaf name, then no backup is needed
-       by counting every '/' from "r" to end, obtain backup count */
-    for ( backup = 0; * r != 0; ++ r )
-    {
-        if ( * r == '/' )
-            ++ backup;
-    }
-
-    /* the number of bytes to be inserted */
-    bsize = backup * 3;
-
-    /* align "p" to last directory separator */
-    while ( p [ -1 ] != '/' ) -- p;
-
-    /* the size of the remaining relative path */
-    psize = strlen ( p );
-
-    /* open up space if needed */
-    if ( p - path < bsize )
-    {
-        /* prevent overflow */
-        if ( bsize + psize >= path_max )
-            return RC ( rcFS, rcDirectory, ctx, rcPath, rcExcessive );
-        memmove ( path + bsize, p, psize + 1 /* 1 for '\0'*/ );
-    }
-
-    /* insert backup sequences */
-    for ( bsize = 0; backup > 0; bsize += 3, -- backup )
-        memcpy ( & path [ bsize ], "../", 3 );
-
-    /* close gap */
-    if ( p - path > bsize )
-        memmove ( & path [ bsize ], p, strlen ( p ) + 1 );
-
-    return 0;
-}
-
-/* KSysDirResolvePath
- *  resolves path to an absolute or directory-relative path
- *
- *  "absolute" [ IN ] - if non-zero, always give a path starting
- *  with '/'. NB - if the directory is chroot'd, the absolute path
- *  will still be relative to directory root.
- *
- *  "resolved" [ OUT ] and "rsize" [ IN ] - buffer for
- *  NUL terminated result path in directory-native character set
- *  the resolved path will be directory relative
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target path. NB - need not exist.
- */
-static
-rc_t KSysDirResolvePath ( const KSysDir *self, bool absolute,
-    char *resolved, size_t rsize, const char *path, va_list args )
-{
-    char full [ PATH_MAX ];
-    rc_t rc = KSysDirMakePath ( self, rcResolving, true, full, sizeof full, path, args );
-    if ( rc == 0 )
-    {
-        uint32_t path_size = strlen ( full );
-
-        if ( absolute )
-        {
-            /* test buffer capacity */
-            if ( path_size - self -> root >= rsize )
-                return RC ( rcFS, rcDirectory, rcResolving, rcBuffer, rcInsufficient );
-
-            /* ready to go */
-            strcpy ( resolved, & full [ self -> root ] );
-/*             assert ( resolved [ 0 ] == '/' ); */
-        }
-        else
-        {
-            rc = KSysDirRelativePath ( self, rcResolving, self -> path, full, sizeof full /*path_size*/ );
-            if ( rc == 0 )
-            {
-                path_size = strlen ( full );
-                if ( path_size >= rsize )
-                    return RC ( rcFS, rcDirectory, rcResolving, rcBuffer, rcInsufficient );
-                strcpy ( resolved, full );
-            }
-        }
-    }
-    return rc;
-}
-
-/* KSysDirResolveAlias
- *  resolves an alias path to its immediate target
- *  NB - the resolved path may be yet another alias
- *
- *  "alias" [ IN ] - NUL terminated string in directory-native
- *  character set denoting an object presumed to be an alias.
- *
- *  "resolved" [ OUT ] and "rsize" [ IN ] - buffer for
- *  NUL terminated result path in directory-native character set
- */
-static
-rc_t KSysDirResolveAlias ( const KSysDir *self, bool absolute,
-    char *resolved, size_t rsize, const char *alias, va_list args )
-{
-    KSysDir full;
-    rc_t rc = KSysDirMakePath ( self, rcResolving, true,
-        full . path, sizeof full . path, alias, args );
-    if ( rc == 0 )
-    {
-        char link [ PATH_MAX ];
-        int len = readlink ( full . path, link, sizeof link );
-        if ( len < 0 ) switch ( errno )
-        {
-        case ENOENT:
-            return RC ( rcFS, rcDirectory, rcResolving, rcPath, rcNotFound );
-        case ENOTDIR:
-            return RC ( rcFS, rcDirectory, rcResolving, rcPath, rcIncorrect );
-        case ENAMETOOLONG:
-        case ELOOP:
-            return RC ( rcFS, rcDirectory, rcResolving, rcPath, rcInvalid );
-        case EACCES:
-            return RC ( rcFS, rcDirectory, rcResolving, rcDirectory, rcUnauthorized );
-        case ENOMEM:
-            return RC ( rcFS, rcDirectory, rcResolving, rcMemory, rcExhausted );
-        case EIO:
-            return RC ( rcFS, rcDirectory, rcResolving, rcTransfer, rcUnknown );
-        default:
-            return RC ( rcFS, rcDirectory, rcResolving, rcNoObj, rcUnknown );
-        }
-
-        if ( ( size_t ) len == sizeof link )
-            return RC ( rcFS, rcDirectory, rcResolving, rcBuffer, rcInsufficient );
-        link [ len ] = 0;
-
-        if ( link [ 0 ] == '/' )
-        {
-            full . size = 1;
-            strcpy ( full . path, link );
-        }
-        else
-        {
-            char *f = strrchr ( full . path, '/' );
-            assert ( f != NULL );
-            full . size = ++f - full . path;
-            if ( full . size + len >= sizeof full . path )
-                return RC ( rcFS, rcDirectory, rcResolving, rcBuffer, rcInsufficient );
-            strcpy ( f, link );
-        }
-
-        full . root = 0;
-
-/*         rc = KSysDirCanonPath ( & full, rcResolving, full . path, len ); */
-        rc = KSysDirCanonPath ( & full, rcResolving, full . path, full . size + len);
-        if ( rc == 0 )
-        {
-            /* the path in full is an absolute path
-               if outside of chroot, it's a bad link */
-            if ( memcmp ( full . path, self -> path, self -> root + 1 ) != 0 )
-                return RC ( rcFS, rcDirectory, rcResolving, rcLink, rcInvalid );
-
-            /* this is the absolute path length */
-            len = strlen ( & full . path [ self -> root ] );
-
-            /* if not requesting absolute, make self relative */
-            if ( ! absolute )
-            {
-                rc = KSysDirRelativePath ( self, rcResolving, self -> path, full . path, sizeof full.path/*len*/ );
-                if ( rc != 0 )
-                    return rc;
-                len = strlen ( full . path );
-            }
-
-            if ( ( size_t ) len >= rsize )
-                return RC ( rcFS, rcDirectory, rcResolving, rcBuffer, rcInsufficient );
-
-            strcpy ( resolved, & full . path [ self -> root ] );
-        }
-    }
-    return rc;
-}
-
-
-/* KSysDirRename
- *  rename an object accessible from directory, replacing
- *  any existing target object of the same type
- *
- *  "from" [ IN ] - NUL terminated string in directory-native
- *  character set denoting existing object
- *
- *  "to" [ IN ] - NUL terminated string in directory-native
- *  character set denoting existing object
- */
-static rc_t KSysDirVAccess ( const KSysDir *self, uint32_t *access, const char *path,
-                             va_list args );
-static rc_t KSysDirSetAccess ( KSysDir *self, bool recurse, uint32_t access, uint32_t mask,
-                               const char *path, va_list args );
-
-static
-rc_t KSysDirRename ( KSysDir *self, bool force, const char *from, const char *to )
-{
-    char ffrom [ PATH_MAX ];
-    rc_t rc = KSysDirMakePath ( self, rcRenaming, false, ffrom, sizeof ffrom, from, NULL );
-    if ( rc == 0 )
-    {
-        char fto [ PATH_MAX ];
-        rc = KSysDirMakePath ( self, rcRenaming, false, fto, sizeof fto, to, NULL );
-        if ( rc == 0 )
-        {
-            if ( rename ( ffrom, fto ) != 0 ) switch ( errno )
-            {
-            case EISDIR:
-            case EXDEV:
-                rc = RC ( rcFS, rcDirectory, rcRenaming, rcPath, rcIncorrect );
-                break;
-            case ENOTEMPTY:
-            case EEXIST:
-            case EBUSY:
-                rc = RC ( rcFS, rcDirectory, rcRenaming, rcPath, rcBusy );
-                break;
-            case EINVAL:
-            case ENOTDIR:
-            case ENAMETOOLONG:
-            case ELOOP:
-                rc = RC ( rcFS, rcDirectory, rcRenaming, rcPath, rcInvalid );
-                break;
-            case EACCES:
-            case EPERM:
-            case EROFS:
-                rc = RC ( rcFS, rcDirectory, rcRenaming, rcDirectory, rcUnauthorized );
-                break;
-            case ENOSPC:
-                rc= RC ( rcFS, rcDirectory, rcRenaming, rcStorage, rcExhausted );
-                break;
-            case ENOMEM:
-                rc = RC ( rcFS, rcDirectory, rcRenaming, rcMemory, rcExhausted );
-                break;
-            case ENOENT:
-                rc = RC ( rcFS, rcDirectory, rcRenaming, rcPath, rcNotFound );
-                break;
-            default:
-                rc = RC ( rcFS, rcDirectory, rcRenaming, rcNoObj, rcUnknown );
-                break;
-            }
-        }
-        if (force)
-        {
-            if (GetRCState(rc) == rcUnauthorized)
-            {
-                uint32_t faccess = 0;
-                uint32_t taccess = 0;
-                bool fchanged = false;
-                bool tchanged = false;
-
-                rc = KSysDirVAccess (self, &taccess, to, NULL);
-                if (rc == 0)
-                {
-                    rc = KSysDirSetAccess (self, false, 0222, 0222, to, NULL);
-                    tchanged = true;
-                }
-                else if(GetRCState(rc) ==  rcNotFound)
-                {
-                    rc = 0;
-                }
-
-                if (rc == 0)
-                {
-                    rc = KSysDirVAccess (self, &faccess, from, NULL);
-                    if (rc == 0)
-                    {
-                        rc = KSysDirSetAccess (self, false, 0222, 0222, from, NULL);
-                        if (rc == 0)
-                        {
-                            fchanged = true;
-                            rc = KSysDirRename (self, false, from, to);
-                        }
-                    }
-                    if (rc == 0)
-                    {
-                        /* set access on the new name to the access from the old name */
-                        KSysDirSetAccess (self, false, faccess, 0222, to, NULL);
-                    }
-                    else
-                    {
-                        /* since something falied, try to restore changed access bits */
-                        if (fchanged)
-                            KSysDirSetAccess (self, false, faccess, 0222, from, NULL);
-                        if (tchanged)
-                            KSysDirSetAccess (self, false, taccess, 0222, to, NULL);
-                    }
-                        
-                }
-
-            }
-        }
-    }
-    return rc;
-}
-
-
-/* KSysDirClearDir
- *  remove all directory contents
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target directory
- *
- *  "force" [ IN ] - if non-zero and directory entry is a
- *  sub-directory, remove recursively
- */
-static
-rc_t KSysDirRemoveEntry ( char *path, size_t path_max, bool force );
-
-static
-rc_t KSysDirEmptyDir ( char *path, size_t path_max, bool force )
-{
-    KSysDirEnum list;
-    rc_t rc = KSysDirEnumInit ( & list, path );
-    if ( rc != 0 )
-        rc = ResetRCContext ( rc, rcFS, rcDirectory, rcClearing );
-    else
-    {
-        size_t path_size = strlen ( path );
-        path [ path_size ] = '/';
-        if ( ++ path_size == path_max )
-            rc = RC ( rcFS, rcDirectory, rcClearing, rcPath, rcExcessive );
-        else
-        {
-            const char *leaf;
-            while ( ( leaf = KSysDirEnumNext ( & list ) ) != NULL )
-            {
-                size_t leaf_size = strlen ( leaf );
-                if ( path_size + leaf_size >= path_max )
-                {
-                    rc = RC ( rcFS, rcDirectory, rcClearing, rcPath, rcExcessive );
-                    break;
-                }
-
-                strcpy ( & path [ path_size ], leaf );
-                rc = KSysDirRemoveEntry ( path, path_max, force );
-                if ( rc != 0 )
-                {
-                    rc = ResetRCContext ( rc, rcFS, rcDirectory, rcClearing );
-                    break;
-                }
-            }
-
-            path [ path_size - 1 ] = 0;
-        }
-
-        KSysDirEnumWhack ( & list );
-    }
-    return rc;
-}
-
-static
-rc_t KSysDirClearDir ( KSysDir *self, bool force, const char *path, va_list args )
-{
-    char full [ PATH_MAX ];
-    rc_t rc = KSysDirMakePath ( self, rcClearing, false, full, sizeof full, path, args );
-    if ( rc == 0 )
-        rc = KSysDirEmptyDir ( full, sizeof full, force );
-    return rc;
-}
-
-/* KSysDirRemove
- *  remove an accessible object from its directory
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- *
- *  "force" [ IN ] - if non-zero and target is a directory,
- *  remove recursively
- */
-static
-rc_t KSysDirRemoveEntry ( char *path, size_t path_max, bool force )
-{
-    if ( unlink ( path ) != 0 )
-    {
-        switch ( errno )
-        {
-        case ENOENT:
-            return 0;
-        case EPERM:
-        case EISDIR:
-            break;
-        case EACCES:
-        case EROFS:
-            return RC ( rcFS, rcDirectory, rcRemoving, rcDirectory, rcUnauthorized );
-        case EBUSY:
-            return RC ( rcFS, rcDirectory, rcRemoving, rcPath, rcBusy );
-        case ENAMETOOLONG:
-        case ENOTDIR:
-        case ELOOP:
-            return RC ( rcFS, rcDirectory, rcRemoving, rcPath, rcInvalid );
-        case ENOMEM:
-            return RC ( rcFS, rcDirectory, rcRemoving, rcMemory, rcExhausted );
-        case EIO:
-            return RC ( rcFS, rcDirectory, rcRemoving, rcTransfer, rcUnknown );
-        default:
-            return RC ( rcFS, rcDirectory, rcRemoving, rcNoObj, rcUnknown );
-        }
-
-        while ( rmdir ( path ) != 0 ) switch ( errno )
-        {
-        case EEXIST:
-        case ENOTEMPTY:
-            if ( force )
-            {
-                rc_t rc = KSysDirEmptyDir ( path, path_max, force );
-                if ( rc != 0 )
-                    return rc;
-                force = false;
-                break;
-            }
-        case EBUSY:
-            return RC ( rcFS, rcDirectory, rcRemoving, rcPath, rcBusy );
-        case EPERM:
-        case EACCES:
-        case EROFS:
-            return RC ( rcFS, rcDirectory, rcRemoving, rcDirectory, rcUnauthorized );
-        case ENOMEM:
-            return RC ( rcFS, rcDirectory, rcRemoving, rcMemory, rcExhausted );
-        default:
-            return RC ( rcFS, rcDirectory, rcRemoving, rcNoObj, rcUnknown );
-        }
-    }
-
-    return 0;
-}
-
-static
-rc_t KSysDirRemove ( KSysDir *self, bool force, const char *path, va_list args )
-{
-    char full [ PATH_MAX ];
-    rc_t rc = KSysDirMakePath ( self, rcRemoving, false, full, sizeof full, path, args );
-    if ( rc == 0 )
-        rc = KSysDirRemoveEntry ( full, sizeof full, force );
-    return rc;
-}
-
-/* KSysDirAccess
- *  get access to object
- *
- *  "access" [ OUT ] - return parameter for Unix access mode
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- */
-static
-rc_t KSysDirVAccess ( const KSysDir *self,
-    uint32_t *access, const char *path, va_list args )
-{
-    char full [ PATH_MAX ];
-    rc_t rc = KSysDirMakePath ( self, rcAccessing, false, full, sizeof full, path, args );
-    if ( rc == 0 )
-    {
-        struct stat st;
-        if ( stat ( full, & st ) != 0 ) switch ( errno )
-        {
-        case ENOENT:
-            return RC ( rcFS, rcDirectory, rcAccessing, rcPath, rcNotFound );
-        case ENOTDIR:
-        case ELOOP:
-        case ENAMETOOLONG:
-            return RC ( rcFS, rcDirectory, rcAccessing, rcPath, rcInvalid );
-        case EACCES:
-            return RC ( rcFS, rcDirectory, rcAccessing, rcDirectory, rcUnauthorized );
-        case ENOMEM:
-            return RC ( rcFS, rcDirectory, rcAccessing, rcMemory, rcExhausted );
-        default:
-            return RC ( rcFS, rcDirectory, rcAccessing, rcNoObj, rcUnknown );
-        }
-
-        * access = st . st_mode & 07777;
-    }
-    return rc;
-}
-
-/* KSysDirSetAccess
- *  set access to object a la Unix "chmod"
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- *
- *  "access" [ IN ] and "mask" [ IN ] - definition of change
- *  where "access" contains new bit values and "mask defines
- *  which bits should be changed.
- *
- *  "recurse" [ IN ] - if non zero and "path" is a directory,
- *  apply changes recursively.
- */
-static
-rc_t KSysDirChangeAccess ( char *path, size_t path_max,
-    uint32_t access, uint32_t mask, bool recurse );
-
-static
-rc_t KSysDirChangeDirAccess ( char *path, size_t path_max,
-    uint32_t access, uint32_t mask )
-{
-    KSysDirEnum list;
-    rc_t rc = KSysDirEnumInit ( & list, path );
-    if ( rc == 0 )
-    {
-        bool eperm = false;
-        size_t path_size = strlen ( path );
-        path [ path_size ] = '/';
-        if ( ++ path_size == path_max )
-            rc = RC ( rcFS, rcDirectory, rcUpdating, rcBuffer, rcInsufficient );
-        else
-        {
-            const char *leaf;
-            while ( ( leaf = KSysDirEnumNext ( & list ) ) != NULL )
-            {
-                size_t leaf_size = strlen ( leaf );
-                if ( path_size + leaf_size >= path_max )
-                {
-                    rc = RC ( rcFS, rcDirectory, rcUpdating, rcBuffer, rcInsufficient );
-                    break;
-                }
-
-                strcpy ( & path [ path_size ], leaf );
-                rc = KSysDirChangeAccess ( path, path_max, access, mask, 1 );
-                if ( rc != 0 )
-                {
-                    if ( GetRCState ( rc ) != rcUnauthorized )
-                        break;
-                    eperm = true;
-                    rc = 0;
-                }
-            }
-
-            path [ path_size - 1 ] = 0;
-        }
-
-        KSysDirEnumWhack ( & list );
-
-        if ( rc == 0 && eperm )
-            rc = RC ( rcFS, rcDirectory, rcUpdating, rcDirectory, rcUnauthorized );
-    }
-    return rc;
-}
-
-static
-rc_t KSysDirChangeEntryAccess ( char *path, size_t path_max,
-    uint32_t access, uint32_t mask, uint32_t st_mode )
-{
-    /* keep old bits */
-    access &= mask;
-    access |= st_mode & ~ mask;
-
-    if ( chmod ( path, access & 07777 ) != 0 ) switch ( errno )
-    {
-    case EPERM:
-    case EACCES:
-    case EROFS:
-        return RC ( rcFS, rcDirectory, rcUpdating, rcDirectory, rcUnauthorized );
-    case ENOTDIR:
-    case ELOOP:
-        return RC ( rcFS, rcDirectory, rcUpdating, rcPath, rcInvalid );
-    case ENAMETOOLONG:
-        return RC ( rcFS, rcDirectory, rcUpdating, rcPath, rcExcessive );
-    case ENOENT:
-        return RC ( rcFS, rcDirectory, rcUpdating, rcPath, rcNotFound );
-    case ENOMEM:
-        return RC ( rcFS, rcDirectory, rcUpdating, rcMemory, rcExhausted );
-    default:
-        return RC ( rcFS, rcDirectory, rcUpdating, rcNoObj, rcUnknown );
-    }
-
-    return 0;
-}
-
-static
-rc_t KSysDirChangeAccess ( char *path, size_t path_max,
-    uint32_t access, uint32_t mask, bool recurse )
-{
-    struct stat st;
-    if ( stat ( path, & st ) != 0 ) switch ( errno )
-    {
-    case ENOENT:
-        return RC ( rcFS, rcDirectory, rcUpdating, rcPath, rcNotFound );
-    case ENOTDIR:
-    case ELOOP:
-        return RC ( rcFS, rcDirectory, rcUpdating, rcPath, rcInvalid );
-    case ENAMETOOLONG:
-        return RC ( rcFS, rcDirectory, rcUpdating, rcPath, rcExcessive );
-    case EACCES:
-        return RC ( rcFS, rcDirectory, rcUpdating, rcDirectory, rcUnauthorized );
-    case ENOMEM:
-        return RC ( rcFS, rcDirectory, rcUpdating, rcMemory, rcExhausted );
-    default:
-        return RC ( rcFS, rcDirectory, rcUpdating, rcNoObj, rcUnknown );
-    }
-
-    if ( recurse && S_ISDIR ( st . st_mode ) )
-    {
-        rc_t rc;
-        uint32_t enable = access & mask;
-        if ( enable != 0 )
-        {
-            rc = KSysDirChangeEntryAccess ( path, path_max,
-                access, enable, st . st_mode );
-            if ( rc != 0 )
-                return rc;
-        }
-
-       rc = KSysDirChangeDirAccess ( path, path_max, access, mask );
-        if ( rc == 0 )
-        {
-            uint32_t disable = ~ access & mask;
-            if ( disable != 0 )
-            {
-                rc = KSysDirChangeEntryAccess ( path, path_max,
-                    access, disable, st . st_mode | enable );
-            }
-        }
-        return rc;
-    }
-
-    return KSysDirChangeEntryAccess ( path, path_max,
-         access, mask, st . st_mode );
-}
-
-static
-rc_t KSysDirSetAccess ( KSysDir *self, bool recurse,
-    uint32_t access, uint32_t mask, const char *path, va_list args )
-{
-    char full [ PATH_MAX ];
-    rc_t rc = KSysDirMakePath ( self, rcUpdating, false, full, sizeof full, path, args );
-    if ( rc == 0 )
-    {
-        if ( mask == 0 )
-            mask = 07777;
-
-        rc = KSysDirChangeAccess ( full, sizeof full,
-            access, mask & 07777, recurse );
-    }
-    return rc;
-}
-
-/* KSysDirDate
- *  get access to object
- *
- *  "date" [ OUT ] - return parameter for Unix access mode
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- */
-static
-rc_t KSysDirVDate ( const KSysDir *self,
-    KTime_t * date, const char *path, va_list args )
-{
-    char full [ PATH_MAX ];
-    rc_t rc = KSysDirMakePath ( self, rcAccessing, false, full, sizeof full, path, args );
-    if ( rc == 0 )
-    {
-        struct stat st;
-        if ( stat ( full, & st ) != 0 ) switch ( errno )
-        {
-        case ENOENT:
-            return RC ( rcFS, rcDirectory, rcAccessing, rcPath, rcNotFound );
-        case ENOTDIR:
-        case ELOOP:
-        case ENAMETOOLONG:
-            return RC ( rcFS, rcDirectory, rcAccessing, rcPath, rcInvalid );
-        case EACCES:
-            return RC ( rcFS, rcDirectory, rcAccessing, rcDirectory, rcUnauthorized );
-        case ENOMEM:
-            return RC ( rcFS, rcDirectory, rcAccessing, rcMemory, rcExhausted );
-        default:
-            return RC ( rcFS, rcDirectory, rcAccessing, rcNoObj, rcUnknown );
-        }
-
-        * date = ( KTime_t ) st . st_mtime;
-    }
-    return rc;
-}
-
-/* KSysDirSetDate
- *  set date to object a la Unix "touch"
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- *
- *  "date" [ IN ]  - new mtime
- *
- *  "recurse" [ IN ] - if non zero and "path" is a directory,
- *  apply changes recursively.
- */
-static
-rc_t KSysDirChangeDate ( char *path, size_t path_max,
-			 KTime_t date, bool recurse );
-
-static
-rc_t KSysDirChangeDirDate ( char *path, size_t path_max,
-			      KTime_t date )
-{
-    KSysDirEnum list;
-    rc_t rc = KSysDirEnumInit ( & list, path );
-    if ( rc == 0 )
-    {
-        bool eperm = false;
-        size_t path_size = strlen ( path );
-        path [ path_size ] = '/';
-        if ( ++ path_size == path_max )
-            rc = RC ( rcFS, rcDirectory, rcUpdating, rcBuffer, rcInsufficient );
-        else
-        {
-            const char *leaf;
-            while ( ( leaf = KSysDirEnumNext ( & list ) ) != NULL )
-            {
-                size_t leaf_size = strlen ( leaf );
-                if ( path_size + leaf_size >= path_max )
-                {
-                    rc = RC ( rcFS, rcDirectory, rcUpdating, rcBuffer, rcInsufficient );
-                    break;
-                }
-
-                strcpy ( & path [ path_size ], leaf );
-                rc = KSysDirChangeDate ( path, path_max, date, 1 );
-                if ( rc != 0 )
-                {
-                    if ( GetRCState ( rc ) != rcUnauthorized )
-                        break;
-                    eperm = true;
-                    rc = 0;
-                }
-            }
-
-            path [ path_size - 1 ] = 0;
-        }
-
-        KSysDirEnumWhack ( & list );
-
-        if ( rc == 0 && eperm )
-            rc = RC ( rcFS, rcDirectory, rcUpdating, rcDirectory, rcUnauthorized );
-    }
-    return rc;
-}
-
-static
-rc_t KSysDirChangeEntryDate ( char *path, size_t path_max,
-			      struct utimbuf * tb)
-{
-    if ( utime ( path, tb ) != 0 ) switch ( errno )
-    {
-    case EPERM:
-    case EACCES:
-    case EROFS:
-        return RC ( rcFS, rcDirectory, rcUpdating, rcDirectory, rcUnauthorized );
-    case ENOTDIR:
-    case ELOOP:
-        return RC ( rcFS, rcDirectory, rcUpdating, rcPath, rcInvalid );
-    case ENAMETOOLONG:
-        return RC ( rcFS, rcDirectory, rcUpdating, rcPath, rcExcessive );
-    case ENOENT:
-        return RC ( rcFS, rcDirectory, rcUpdating, rcPath, rcNotFound );
-    case ENOMEM:
-        return RC ( rcFS, rcDirectory, rcUpdating, rcMemory, rcExhausted );
-    default:
-        return RC ( rcFS, rcDirectory, rcUpdating, rcNoObj, rcUnknown );
-    }
-
-    return 0;
-}
-
-static
-rc_t KSysDirChangeDate ( char *path, size_t path_max,
-			 KTime_t date, bool recurse )
-{
-    struct stat st;
-    struct utimbuf u;
-
-    if ( stat ( path, & st ) != 0 ) switch ( errno )
-    {
-    case ENOENT:
-        return RC ( rcFS, rcDirectory, rcUpdating, rcPath, rcNotFound );
-    case ENOTDIR:
-    case ELOOP:
-        return RC ( rcFS, rcDirectory, rcUpdating, rcPath, rcInvalid );
-    case ENAMETOOLONG:
-        return RC ( rcFS, rcDirectory, rcUpdating, rcPath, rcExcessive );
-    case EACCES:
-        return RC ( rcFS, rcDirectory, rcUpdating, rcDirectory, rcUnauthorized );
-    case ENOMEM:
-        return RC ( rcFS, rcDirectory, rcUpdating, rcMemory, rcExhausted );
-    default:
-        return RC ( rcFS, rcDirectory, rcUpdating, rcNoObj, rcUnknown );
-    }
-    u . actime = u . modtime = date;
-
-    if ( recurse && S_ISDIR ( st . st_mode ) )
-    {
-        rc_t rc;
-
-	rc = KSysDirChangeEntryDate ( path, path_max, & u );
-	if ( rc != 0 )
-	    return rc;
-
-	rc = KSysDirChangeDirDate ( path, path_max, date );
-        if ( rc == 0 )
-        {
-	    rc = KSysDirChangeEntryDate ( path, path_max, & u  );
-        }
-        return rc;
-    }
-
-    return  KSysDirChangeEntryDate ( path, path_max, & u );
-}
-
-static
-rc_t KSysDirVSetDate ( KSysDir * self, bool recurse,
-	KTime_t date, const char *path, va_list args )
-{
-    char full [ PATH_MAX ];
-    rc_t rc = KSysDirMakePath ( self, rcUpdating, false, full, sizeof full, path, args );
-    if ( rc == 0 )
-    {
-        rc = KSysDirChangeDate ( full, sizeof full,
-            date, recurse );
-    }
-    return rc;
-}
-
-static
-KSysDir *KSysDirGetSysdir ( const KSysDir *cself )
-{
-    return ( KSysDir* ) cself;
-}
-
-/* KSysDirCreateParents
- *  creates missing parent directories
- */
-static
-rc_t make_dir ( const char *path, uint32_t access )
-{
-    if ( mkdir ( path, ( int ) access ) != 0 ) switch ( errno )
-    {
-    case ENOENT:
-        return RC ( rcFS, rcDirectory, rcCreating, rcPath, rcNotFound );
-    case EEXIST:
-        return RC ( rcFS, rcDirectory, rcCreating, rcPath, rcExists );
-    case EPERM:
-    case EACCES:
-    case EROFS:
-        return RC ( rcFS, rcDirectory, rcCreating, rcDirectory, rcUnauthorized );
-    case ENOTDIR:
-    case ELOOP:
-        return RC ( rcFS, rcDirectory, rcCreating, rcPath, rcInvalid );
-    case ENOMEM:
-        return RC ( rcFS, rcDirectory, rcCreating, rcMemory, rcExhausted );
-    case ENOSPC:
-        return RC ( rcFS, rcDirectory, rcCreating, rcStorage, rcExhausted );
-    default:
-        return RC ( rcFS, rcDirectory, rcCreating, rcNoObj, rcUnknown );
-    }
-    return 0;
-}
-
-static
-rc_t KSysDirCreateParents ( const KSysDir *self,
-    char *path, uint32_t access, bool strip )
-{
-    rc_t rc;
-    char *p, *par = path + self -> root + 1;
-    size_t size = strlen ( par );
-
-    if ( ! strip )
-        p = par + size;
-    else
-    {
-        p = strrchr ( par, '/' );
-        if ( p == NULL )
-            return 0;
-        size = p - par;
-    }
-
-    while ( 1 )
-    {
-        /* crop string */
-        p [ 0 ] = 0;
-
-        /* try to create directory */
-        rc = make_dir ( path, access );
-        if ( GetRCState ( rc ) != rcNotFound )
-            break;
-
-        /* back up some more */
-        p = strrchr ( par, '/' );
-        if ( p == NULL )
-        {
-            p = par + strlen ( par );
-            break;
-        }
-    }
-
-    par += size;
-    assert ( p != NULL );
-
-    /* create directories from here */
-    if ( rc == 0 ) while ( p < par )
-    {
-        p [ 0 ] = '/';
-        rc = make_dir ( path, access );
-        if ( rc != 0 || ++ p >= par )
-            break;
-        p += strlen ( p );
-    }
-
-    /* fix up remaining path */
-    while ( p < par )
-    {
-        p [ 0 ] = '/';
-        if ( ++ p >= par )
-            break;
-        p += strlen ( p );
-    }
-
-    /* repair stripped path */
-    if ( strip )
-        par [ 0 ] = '/';
-
-    return rc;
-}
-
-/* CreateAlias
- *  creates a path alias according to create mode
- *  such that "alias" => "targ"
- *
- *  "access" [ IN ] - standard Unix directory access mode
- *  used when "mode" has kcmParents set and alias path does
- *  not exist.
- *
- *  "mode" [ IN ] - a creation mode ( see explanation above ).
- *
- *  "targ" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object, i.e. the object which
- *  is designated by symlink "alias".
- *
- *  "alias" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target alias, i.e. the symlink that
- *  designates a target "targ".
- */
-static
-rc_t KSysDirCreateAlias ( KSysDir *self,
-    uint32_t access, KCreateMode mode,
-    const char *targ, const char *alias )
-{
-    /* create full path to symlink */
-    char falias [ PATH_MAX ];
-    rc_t rc = KSysDirMakePath ( self, rcCreating, true, falias, sizeof falias, alias, NULL );
-    if ( rc == 0 )
-    {
-        /* the full path to target RELATIVE TO self */
-        char ftarg [ PATH_MAX ];
-        rc = KSysDirMakePath ( self, rcCreating, true, ftarg, sizeof ftarg, targ, NULL );
-        if ( rc == 0 )
-        {
-            /* if "targ" is relative or "self" is chroot'd,
-               "ftarg" must be made relative */
-            if ( targ [ 0 ] != '/' || self -> root != 0 )
-            {
-                /* take path to alias as root.
-                   generate a path RELATIVE TO alias */
-                rc = KSysDirRelativePath ( self, rcCreating, falias,
-                    ftarg, sizeof ftarg /*strlen ( ftarg )*/ );
-                if ( rc != 0 )
-                    return rc;
-            }
-
-            if ( symlink ( ftarg, falias ) == 0 )
-                return 0;
-
-            switch ( errno )
-            {
-            case EEXIST:
-                /* alias already exists. unless mode is
-                   create-only, force creation by removing old */
-                if ( ( mode & kcmValueMask ) != kcmCreate )
-                {
-                    /* refuse to drop if not an alias */
-                    if ( ( KSysDirFullPathType ( falias ) & kptAlias ) == 0 )
-                        return RC ( rcFS, rcDirectory, rcCreating, rcPath, rcIncorrect );
-
-                    /* drop existing alias */
-                    rc = KSysDirRemoveEntry ( falias, sizeof falias, false );
-                    if ( rc == 0 )
-                        break;
-                }
-                return RC ( rcFS, rcDirectory, rcCreating, rcPath, rcExists );
-
-            case ENOENT:
-                /* a part of the alias path doesn't exist */
-                if ( ( mode & kcmParents ) != 0 )
-                {
-                    KSysDirCreateParents ( self, falias, access, true );
-                    break;
-                }
-                return RC ( rcFS, rcDirectory, rcCreating, rcPath, rcNotFound );
-
-            case EPERM:
-            case EACCES:
-            case EROFS:
-                return RC ( rcFS, rcDirectory, rcCreating, rcDirectory, rcUnauthorized );
-            case ENAMETOOLONG:
-                return RC ( rcFS, rcDirectory, rcCreating, rcPath, rcExcessive );
-            case ENOTDIR:
-            case ELOOP:
-                return RC ( rcFS, rcDirectory, rcCreating, rcPath, rcInvalid );
-            case ENOMEM:
-                return RC ( rcFS, rcDirectory, rcCreating, rcMemory, rcExhausted );
-            case ENOSPC:
-                return RC ( rcFS, rcDirectory, rcCreating, rcStorage, rcExhausted );
-            case EIO:
-                return RC ( rcFS, rcDirectory, rcCreating, rcTransfer, rcUnknown );
-            default:
-                return RC ( rcFS, rcDirectory, rcCreating, rcNoObj, rcUnknown );
-            }
-
-            /* try again either with existing guy removed
-               or missing directories created */
-            if ( symlink ( ftarg, falias ) != 0 ) switch ( errno )
-            {
-            case EEXIST:
-                return RC ( rcFS, rcDirectory, rcCreating, rcPath, rcExists );
-            case ENOENT:
-                return RC ( rcFS, rcDirectory, rcCreating, rcPath, rcNotFound );
-            default:
-                return RC ( rcFS, rcDirectory, rcCreating, rcNoObj, rcUnknown );
-            }
-
-            assert ( rc == 0 );
-        }
-    }
-    return rc;
-}
-
-/* KSysDirOpenFileRead
- *  opens an existing file with read-only access
- *
- *  "f" [ OUT ] - return parameter for newly opened file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- */
-static
-rc_t KSysDirOpenFileRead ( const KSysDir *self,
-    const KFile **f, const char *path, va_list args )
-{
-    char full [ PATH_MAX ];
-    rc_t rc = KSysDirMakePath ( self, rcOpening, false, full, sizeof full, path, args );
-    if ( rc == 0 )
-    {
-        int fd = open ( full, O_RDONLY );
-        if ( fd < 0 ) switch ( errno )
-        {
-        case ENOENT:
-            return RC ( rcFS, rcDirectory, rcOpening, rcPath, rcNotFound );
-        case EACCES:
-            return RC ( rcFS, rcDirectory, rcOpening, rcDirectory, rcUnauthorized );
-        case EISDIR:
-            return RC ( rcFS, rcDirectory, rcOpening, rcPath, rcIncorrect );
-        case ENOTDIR:
-        case ELOOP:
-            return RC ( rcFS, rcDirectory, rcOpening, rcPath, rcInvalid );
-        case ENAMETOOLONG:
-            return RC ( rcFS, rcDirectory, rcOpening, rcPath, rcExcessive );
-        case ENOMEM:
-            return RC ( rcFS, rcDirectory, rcOpening, rcMemory, rcExhausted );
-        case EMFILE:
-        case ENFILE:
-            return RC ( rcFS, rcDirectory, rcOpening, rcFileDesc, rcExhausted );
-        default:
-            return RC ( rcFS, rcDirectory, rcOpening, rcNoObj, rcUnknown );
-        }
-
-        rc = KSysFileMake ( ( KSysFile** ) f, fd, full, true, false );
-        if ( rc != 0 )
-            close ( fd );
-    }
-    return rc;
-}
-
-/* KSysDirOpenFileWrite
- *  opens an existing file with write access
- *
- *  "f" [ OUT ] - return parameter for newly opened file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- *
- *  "update" [ IN ] - if non-zero, open in read/write mode
- *  otherwise, open in write-only mode
- */
-static
-rc_t KSysDirOpenFileWrite ( KSysDir *self,
-    KFile **f, bool update, const char *path, va_list args )
-{
-    char full [ PATH_MAX ];
-    rc_t rc = KSysDirMakePath ( self, rcOpening, false, full, sizeof full, path, args );
-    if ( rc == 0 )
-    {
-        int fd = open ( full, update ? O_RDWR : O_WRONLY );
-        if ( fd < 0 ) switch ( errno )
-        {
-        case ENOENT:
-            return RC ( rcFS, rcDirectory, rcOpening, rcPath, rcNotFound );
-        case EACCES:
-        case EROFS:
-            return RC ( rcFS, rcDirectory, rcAccessing, rcDirectory, rcUnauthorized );
-        case EISDIR:
-            return RC ( rcFS, rcDirectory, rcAccessing, rcPath, rcIncorrect );
-        case ENOTDIR:
-        case ELOOP:
-            return RC ( rcFS, rcDirectory, rcAccessing, rcPath, rcInvalid );
-        case ENAMETOOLONG:
-            return RC ( rcFS, rcDirectory, rcAccessing, rcPath, rcExcessive );
-        case ENOMEM:
-            return RC ( rcFS, rcDirectory, rcOpening, rcMemory, rcExhausted );
-        case EMFILE:
-        case ENFILE:
-            return RC ( rcFS, rcDirectory, rcOpening, rcFileDesc, rcExhausted );
-        default:
-            return RC ( rcFS, rcDirectory, rcOpening, rcNoObj, rcUnknown );
-        }
-
-        rc = KSysFileMake ( ( KSysFile** ) f, fd, full, update, 1 );
-        if ( rc != 0 )
-            close ( fd );
-    }
-    return rc;
-}
-
-/* KSysDirCreateFile
- *  opens a file with write access
- *
- *  "f" [ OUT ] - return parameter for newly opened file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- *
- *  "access" [ IN ] - standard Unix access mode, e.g. 0664
- *
- *  "update" [ IN ] - if non-zero, open in read/write mode
- *  otherwise, open in write-only mode
- *
- *  "mode" [ IN ] - a creation mode ( see explanation above ).
- */
-static
-rc_t KSysDirCreateFile ( KSysDir *self, KFile **f, bool update,
-    uint32_t access, KCreateMode cmode, const char *path, va_list args )
-{
-    char full [ PATH_MAX ];
-    rc_t rc = KSysDirMakePath ( self, rcCreating, true, full, sizeof full, path, args );
-    if ( rc == 0 )
-    {
-        int fd, mode = update ? O_RDWR | O_CREAT : O_WRONLY | O_CREAT;
-        switch ( cmode & kcmValueMask )
-        {
-        case kcmOpen:
-            break;
-        case kcmInit:
-            mode |= O_TRUNC;
-            break;
-        case kcmCreate:
-            mode |= O_EXCL;
-            break;
-        }
-
-        fd = open ( full, mode, ( int ) access );
-        while ( fd < 0 )
-        {
-            /* a common creation error is missing parents */
-            if ( ( cmode & kcmParents ) != 0 && errno == ENOENT )
-            {
-                /* force directory mode to have execute
-                   wherever there is read or write on file */
-                uint32_t dir_access = access |
-                    ( ( access & 0444 ) >> 2 ) | ( ( access & 0222 ) >> 1 );
-                /* NEW 2/15/2013 - also force read */
-                dir_access |= ( dir_access & 0111 ) << 2;
-                KSysDirCreateParents ( self, full, dir_access, true );
-
-                /* try again */
-                fd = open ( full, mode, ( int ) access );
-                if ( fd >= 0 )
-                    break;
-            }
-
-            /* when simply "touching" a file, the request for
-               write access may fail if created without write access */
-            if ( ( access & 0200 ) == 0 && errno == EACCES )
-            {
-                mode = O_CREAT;
-                if ( ( access & 0400 ) != 0 )
-                    mode |= O_RDONLY;
-                fd = open ( full, mode, ( int ) access );
-                if ( fd >= 0 )
-                    break;
-            }
-
-            switch ( errno )
-            {
-            case ENOENT:
-                rc = RC ( rcFS, rcDirectory, rcCreating, rcPath, rcNotFound );
-                break;
-            case EEXIST:
-                rc = RC ( rcFS, rcDirectory, rcCreating, rcPath, rcExists );
-                break;
-            case EACCES:
-            case EROFS:
-                rc = RC ( rcFS, rcDirectory, rcCreating, rcDirectory, rcUnauthorized );
-                break;
-            case EISDIR:
-                rc = RC ( rcFS, rcDirectory, rcCreating, rcPath, rcIncorrect );
-                break;
-            case ENOTDIR:
-            case ELOOP:
-                rc = RC ( rcFS, rcDirectory, rcCreating, rcPath, rcInvalid );
-                break;
-            case ENAMETOOLONG:
-                rc = RC ( rcFS, rcDirectory, rcCreating, rcPath, rcExcessive );
-                break;
-            case ENOSPC:
-                rc = RC ( rcFS, rcDirectory, rcCreating, rcStorage, rcExhausted );
-                break;
-            case ENOMEM:
-                rc = RC ( rcFS, rcDirectory, rcCreating, rcMemory, rcExhausted );
-                break;
-            case EMFILE:
-            case ENFILE:
-                rc = RC ( rcFS, rcDirectory, rcCreating, rcFileDesc, rcExhausted );
-                break;
-            default:
-                rc = RC ( rcFS, rcDirectory, rcCreating, rcNoObj, rcUnknown );
-                break;
-            }
-            
-            /* disabled 12/12/2012 : it prints an error message, if vdb tries to open
-               the same reference-object twice via http. The lock-file for the 2nd try
-               does already exist. This is not an error, just a condition. */
-
-            /* PLOGERR (klogErr, (klogErr, rc, "failed to create '$(F)'", "F=%s", full)); */
-            return rc;
-        }
-
-        rc = KSysFileMake ( ( KSysFile** ) f, fd, full, update, true );
-        if ( rc != 0 )
-            close ( fd );
-    }
-    return rc;
-}
-
-/* KSysDirFileSize
- *  returns size in bytes of target file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- *
- *  "size" [ OUT ] - return parameter for file size
- */
-static
-rc_t KSysDirFileSize ( const KSysDir *self,
-    uint64_t *size, const char *path, va_list args )
-{
-    char full [ PATH_MAX ];
-    rc_t rc = KSysDirMakePath ( self, rcAccessing, false, full, sizeof full, path, args );
-    if ( rc == 0 )
-    {
-        struct stat st;
-        if ( stat ( full, & st ) != 0 ) switch ( errno )
-        {
-        case ENOENT:
-            return RC ( rcFS, rcDirectory, rcAccessing, rcPath, rcNotFound );
-        case ENOTDIR:
-        case ELOOP:
-            return RC ( rcFS, rcDirectory, rcAccessing, rcPath, rcInvalid );
-        case ENAMETOOLONG:
-            return RC ( rcFS, rcDirectory, rcAccessing, rcPath, rcExcessive );
-        case EACCES:
-            return RC ( rcFS, rcDirectory, rcAccessing, rcDirectory, rcUnauthorized );
-        case ENOMEM:
-            return RC ( rcFS, rcDirectory, rcAccessing, rcMemory, rcExhausted );
-        default:
-            return RC ( rcFS, rcDirectory, rcAccessing, rcNoObj, rcUnknown );
-        }
-
-        if ( S_ISDIR ( st . st_mode ) )
-            return RC ( rcFS, rcDirectory, rcAccessing, rcPath, rcIncorrect );
-
-        * size = st . st_size;
-    }
-    return rc;
-}
-
-/* KSysDirSetFileSize
- *  sets size in bytes of target file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- *
- *  "size" [ IN ] - new file size
- */
-static
-rc_t KSysDirSetFileSize ( KSysDir *self,
-    uint64_t size, const char *path, va_list args )
-{
-    char full [ PATH_MAX ];
-    rc_t rc = KSysDirMakePath ( self, rcUpdating, false, full, sizeof full, path, args );
-    if ( rc == 0 )
-    {
-        if ( truncate ( full, size ) != 0 ) switch ( errno )
-        {
-        case ENOENT:
-            return RC ( rcFS, rcDirectory, rcUpdating, rcPath, rcNotFound );
-        case EACCES:
-        case EROFS:
-            return RC ( rcFS, rcDirectory, rcUpdating, rcDirectory, rcUnauthorized );
-        case EFBIG:
-            return RC ( rcFS, rcDirectory, rcUpdating, rcParam, rcExcessive );
-        case EINTR:
-            return RC ( rcFS, rcDirectory, rcUpdating, rcFunction, rcIncomplete );
-        case EINVAL:
-            return RC ( rcFS, rcDirectory, rcUpdating, rcParam, rcInvalid );
-        case EIO:
-            return RC ( rcFS, rcDirectory, rcUpdating, rcTransfer, rcUnknown );
-        case EISDIR:
-            return RC ( rcFS, rcDirectory, rcUpdating, rcPath, rcIncorrect );
-        case ELOOP:
-            return RC ( rcFS, rcDirectory, rcUpdating, rcPath, rcInvalid );
-        case ENAMETOOLONG:
-            return RC ( rcFS, rcDirectory, rcUpdating, rcPath, rcExcessive );
-        default:
-            return RC ( rcFS, rcDirectory, rcUpdating, rcNoObj, rcUnknown );
-        }
-    }
-    return rc;
-}
-
-/* KSysDirOpenDirRead
- * KSysDirOpenDirUpdate
- *  opens a sub-directory
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target directory
- *
- *  "chroot" [ IN ] - if non-zero, the new directory becomes
- *  chroot'd and will interpret paths beginning with '/'
- *  relative to itself.
- */
-static
-rc_t KSysDirOpenDirRead ( const KSysDir *self,
-     const KDirectory **subp, bool chroot, const char *path, va_list args )
-{
-    char full [ PATH_MAX ];
-    rc_t rc; 
-
-    rc = KSysDirMakePath ( self, rcOpening, true, full, sizeof full, path, args );
-    if ( rc == 0 )
-    {
-        KSysDir *sub;
-
-        size_t path_size = strlen ( full );
-        while ( path_size > 1 && full [ path_size - 1 ] == '/' )
-            full [ -- path_size ] = 0;
-            
-        {
-            int t = KSysDirFullPathType ( full ) & ( kptAlias - 1 );
-            if ( t == kptNotFound )
-                return RC ( rcFS, rcDirectory, rcOpening, rcPath, rcNotFound );
-            if ( t != kptDir )
-                return RC ( rcFS, rcDirectory, rcOpening, rcPath, rcIncorrect );
-        }
-        
-        sub = KSysDirMake ( path_size );
-        if ( sub == NULL )
-            rc = RC ( rcFS, rcDirectory, rcOpening, rcMemory, rcExhausted );
-        else
-        {
-            rc = KSysDirInit ( sub, rcOpening, self -> root, full, path_size, false, chroot );
-            if ( rc == 0 )
-            {
-                * subp = & sub -> dad;
-                return 0;
-            }
-
-            free ( sub );
-        }
-    }
-    return rc;
-}
-
-static
-rc_t KSysDirOpenDirUpdate ( KSysDir *self,
-    KDirectory **subp, bool chroot, const char *path, va_list args )
-{
-    char full [ PATH_MAX ];
-    rc_t rc;
-
-    rc = KSysDirMakePath ( self, rcOpening, true, full, sizeof full, path, args );
-    if ( rc == 0 )
-    {
-        KSysDir *sub;
-
-        size_t path_size = strlen ( full );
-        while ( path_size > 1 && full [ path_size - 1 ] == '/' )
-            full [ -- path_size ] = 0;
-
-        switch ( KSysDirFullPathType ( full ) )
-        {
-        case kptNotFound:
-            return RC ( rcFS, rcDirectory, rcOpening, rcPath, rcNotFound );
-        case kptBadPath:
-            return RC ( rcFS, rcDirectory, rcOpening, rcPath, rcInvalid );
-        case kptDir:
-        case kptDir | kptAlias:
-            break;
-        default:
-            return RC ( rcFS, rcDirectory, rcOpening, rcPath, rcIncorrect );
-        }
-
-        sub = KSysDirMake ( path_size );
-        if ( sub == NULL )
-            rc = RC ( rcFS, rcDirectory, rcOpening, rcMemory, rcExhausted );
-        else
-        {
-            rc = KSysDirInit ( sub, rcOpening, self -> root, full, path_size, true, chroot );
-            if ( rc == 0 )
-            {
-                * subp = & sub -> dad;
-                return 0;
-            }
-
-            free ( sub );
-        }
-    }
-    return rc;
-}
-
-/* KSysDirCreateDir
- *  create a sub-directory
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target directory
- *
- *  "access" [ IN ] - standard Unix directory permissions
- *
- *  "mode" [ IN ] - a creation mode ( see explanation above ).
- */
-static
-rc_t KSysDirCreateDir ( KSysDir *self,
-    uint32_t access, KCreateMode mode, const char *path, va_list args )
-{
-    char full [ PATH_MAX ];
-    rc_t rc = KSysDirMakePath ( self, rcCreating, true, full, sizeof full, path, args );
-    if ( rc == 0 )
-    {
-        if ( ( mode & kcmValueMask ) == kcmCreate )
-        {
-            switch ( KSysDirFullPathType ( full ) )
-            {
-            case kptNotFound:
-                break;
-            case kptBadPath:
-                return RC ( rcFS, rcDirectory, rcCreating, rcPath, rcInvalid );
-            case kptDir:
-                return RC ( rcFS, rcDirectory, rcCreating, rcDirectory, rcExists );
-            default:
-                return RC ( rcFS, rcDirectory, rcCreating, rcPath, rcIncorrect );
-            }
-        }
-
-        rc = make_dir ( full, access );
-        if ( rc != 0 ) switch ( GetRCState ( rc ) )
-        {
-        case rcExists:
-            rc = 0;
-            if ( ( mode & kcmValueMask ) == kcmInit )
-                rc = KSysDirEmptyDir ( full, sizeof full, 1 );
-            break;
-        case rcNotFound:
-            if ( ( mode & kcmParents ) != 0 )
-                rc = KSysDirCreateParents ( self, full, access, false );
-            break;
-        default:
-            break;
-        }
-    }
-    return rc;
-}
-
-/* KDirectoryNativeDir
- *  returns a native file-system directory node reference
- *  the directory root will be "/" and set to the native
- *  idea of current working directory
- *
- *  NB - the returned reference will be non-const, allowing
- *  modification operations to be attempted. these operations
- *  may still fail if the underlying FS disallows them.
- *
- *  "dir" [ OUT ] - return parameter for native directory
- */
-
-static KDirectory_vt_v1 vtKSysDir =
-{
-    /* version 1.1 */
-    1, 1,
-
-    /* start minor version 0 methods*/
-    KSysDirDestroy,
-    KSysDirList,
-
-    /* the following two messages map to the same method, requiring type casting */
-    ( rc_t ( * )  ( const KSysDir*, bool,
-        rc_t ( * ) ( const KDirectory*, uint32_t, const char*, void* ), void*,
-       const char*, va_list ) ) KSysDirVisit,
-    ( rc_t ( * )  ( KSysDir*, bool,
-        rc_t ( * ) ( KDirectory*, uint32_t, const char*, void* ), void*,
-       const char*, va_list ) ) KSysDirVisit,
-
-    KSysDirPathType,
-    KSysDirResolvePath,
-    KSysDirResolveAlias,
-    KSysDirRename,
-    KSysDirRemove,
-    KSysDirClearDir,
-    KSysDirVAccess,
-    KSysDirSetAccess,
-    KSysDirCreateAlias,
-    KSysDirOpenFileRead,
-    KSysDirOpenFileWrite,
-    KSysDirCreateFile,
-    KSysDirFileSize,
-    KSysDirSetFileSize,
-    KSysDirOpenDirRead,
-    KSysDirOpenDirUpdate,
-    KSysDirCreateDir,
-    NULL, /* we don't track files*/
-    /* end minor version 0 methods*/
-
-    /* start minor version 1 methods*/
-    KSysDirVDate,
-    KSysDirVSetDate,
-    KSysDirGetSysdir
-    /* end minor version 1 methods*/
-};
-
-/* KSysDirInit
- */
-static
-rc_t KSysDirInit ( KSysDir *self, enum RCContext ctx, uint32_t dad_root,
-    const char *path, uint32_t path_size, bool update, bool chroot )
-{
-    rc_t rc;
-
-    rc = KDirectoryInit ( & self -> dad, ( const KDirectory_vt* ) & vtKSysDir,
-                          "KSysDir", path?path:"(null)", update );
-    if ( rc != 0 )
-        return ResetRCContext ( rc, rcFS, rcDirectory, ctx );
-
-    if ( path != NULL )
-        memcpy ( self -> path, path, path_size );
-    self -> root = chroot ? path_size : dad_root;
-    self -> size = path_size + 1;
-    self -> path [ path_size ] = '/';
-    self -> path [ path_size + 1 ] = 0;
-
-    return 0;
-}
-
-extern rc_t CC ReportCWD ( const ReportFuncs *f, uint32_t indent );
-extern rc_t CC ReportRedirect ( KWrtHandler* handler,
-    const char* filename, bool* to_file, bool finalize );
-
-LIB_EXPORT rc_t CC KDirectoryNativeDir ( KDirectory **dirp )
-{
-    rc_t rc;
-    KSysDir *dir;
-    uint32_t size;
-    char wd [ PATH_MAX ];
-
-    static bool latch;
-    if ( ! latch )
-    {
-        ReportInitKFS ( ReportCWD, ReportRedirect );
-        latch = true;
-    }
-
-    if ( dirp == NULL )
-        return RC ( rcFS, rcDirectory, rcAccessing, rcParam, rcNull );
-
-    * dirp = NULL;
-
-    if ( realpath ( ".", wd ) == NULL ) switch ( errno )
-    {
-    case EACCES:
-        return RC ( rcFS, rcDirectory, rcAccessing, rcDirectory, rcUnauthorized );
-    case EIO:
-        return RC ( rcFS, rcDirectory, rcAccessing, rcTransfer, rcUnknown );
-    default:
-        return RC ( rcFS, rcDirectory, rcAccessing, rcNoObj, rcUnknown );
-    }
-
-    size = strlen ( wd );
-    if ( size + 2 > sizeof wd )
-        return RC ( rcFS, rcDirectory, rcAccessing, rcBuffer, rcInsufficient );
-
-    /* trim trailing slash */
-    if ( size > 0 && wd [ size - 1 ] == '/' )
-        wd [ -- size ] = 0;
-
-    dir = KSysDirMake ( size );
-    if ( dir == NULL )
-        rc = RC ( rcFS, rcDirectory, rcAccessing, rcMemory, rcExhausted );
-    else
-    {
-        rc = KSysDirInit ( dir, rcAccessing, 0, wd, size, true, false );
-        if ( rc == 0 )
-        {
-            * dirp = & dir -> dad;
-            return 0;
-        }
-
-        free ( dir );
-    }
-
-    return rc;
-}
diff --git a/libs/kfs/unix/sysdll.c b/libs/kfs/unix/sysdll.c
deleted file mode 100644
index 4ae62bf..0000000
--- a/libs/kfs/unix/sysdll.c
+++ /dev/null
@@ -1,1422 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#define TRACK_REFERENCES 0
-
-#include "va_copy.h"
-#include "sysdir-priv.h"
-
-#include <kfs/extern.h>
-#include <kfs/dyload.h>
-#include <kfs/directory.h>
-#include <klib/refcount.h>
-#include <klib/vector.h>
-#include <klib/text.h>
-#include <klib/printf.h>
-#include <klib/out.h>
-#include <klib/log.h>
-#include <klib/status.h>
-#include <klib/debug.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include "os-native.h"
-
-/* old Sun includes won't define PATH_MAX */
-
-#ifndef __XOPEN_OR_POSIX
-#define __XOPEN_OR_POSIX 1
-#endif
-
-#include <limits.h>
-
-#undef __XOPEN_OR_POSIX
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <assert.h>
-
-#include <dlfcn.h>
-
-
-#if _DEBUGGING
-#define DLOPEN_MODE RTLD_NOW
-#else
-#define DLOPEN_MODE RTLD_LAZY
-#endif
-
-#if _STATIC
-#define ALWAYS_ADD_EXE 1
-#endif
-
-/* PATH_MAX is not really universal even on Linux/Unix */
-#ifndef PATH_MAX
-#define PATH_MAX        4096
-#endif
-
-/*--------------------------------------------------------------------------
- * KDirectory
- */
-static
-void KDirRefRelease ( void *item, void *ignore )
-{
-    KDirectoryRelease ( ( const void* ) item );
-}
-
-/*--------------------------------------------------------------------------
- * KDyld
- *  dynamic library loader
- *
- *  maintains cache of libraries it has opened while they remain open
- *  such that subsequent requests for an open library will return a
- *  new reference to the existing library.
- */
-struct KDyld
-{
-    Vector search;
-    KRefcount refcount;
-};
-
-
-/* Whack
- */
-static
-rc_t KDyldWhack ( KDyld *self )
-{
-    KRefcountWhack ( & self -> refcount, "KDyld" );
-
-    VectorWhack ( & self -> search, KDirRefRelease, NULL );
-    free ( self );
-
-    return 0;
-}
-
-
-/* Make
- *  create a dynamic loader object
- *
- *  "dl" [ OUT ] - return parameter for loader
- */
-LIB_EXPORT rc_t CC KDyldMake ( KDyld **dlp )
-{
-    rc_t rc;
-
-    if ( dlp == NULL )
-        rc = RC ( rcFS, rcDylib, rcConstructing, rcParam, rcNull );
-    else
-    {
-        KDyld *dl = malloc ( sizeof * dl );
-        if ( dl == NULL )
-            rc = RC ( rcFS, rcDylib, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            VectorInit ( & dl -> search, 1, 8 );
-            KRefcountInit ( & dl -> refcount, 1, "KDyld", "make", "dl" );
-
-            * dlp = dl;
-            return 0;
-        }
-
-        * dlp = NULL;
-    }
-
-    return rc;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KDyldAddRef ( const KDyld *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KDyld" ) )
-        {
-        case krefLimit:
-            return RC ( rcFS, rcDylib, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KDyldRelease ( const KDyld *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KDyld" ) )
-        {
-        case krefWhack:
-            return KDyldWhack ( ( KDyld* ) self );
-        case krefNegative:
-            return RC ( rcFS, rcDylib, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/* Attach
- * Sever
- */
-static
-KDyld *KDyldAttach ( const KDyld *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAddDep ( & self -> refcount, "KDyld" ) )
-        {
-        case krefLimit:
-            return NULL;
-        }
-    }
-    return ( KDyld* ) self;
-}
-
-static
-rc_t KDyldSever ( const KDyld *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDropDep ( & self -> refcount, "KDyld" ) )
-        {
-        case krefWhack:
-            return KDyldWhack ( ( KDyld* ) self );
-        case krefNegative:
-            return RC ( rcFS, rcDylib, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/* AddSearchPath
- *  add a search path to loader for locating library files
- */
-LIB_EXPORT rc_t CC KDyldVAddSearchPath ( KDyld *self, const char *path, va_list args )
-{
-    rc_t rc;
-    if ( self == NULL )
-        rc = RC ( rcFS, rcDylib, rcUpdating, rcSelf, rcNull );
-    else
-    {
-        KDirectory *wd;
-        rc = KDirectoryNativeDir ( & wd );
-        if ( rc == 0 )
-        {
-            const KDirectory *dir;
-            rc = KDirectoryVOpenDirRead ( wd, & dir, false, path, args );
-            if ( rc == 0 )
-            {
-                rc = VectorAppend ( & self -> search, NULL, dir );
-                if ( rc != 0 )
-                    KDirectoryRelease ( dir );
-            }
-
-            KDirectoryRelease ( wd );
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDyldAddSearchPath ( KDyld *self, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDyldVAddSearchPath ( self, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-static
-void KDyldForEach ( const KDyld *self,
-    void ( * f ) ( const KDirectory *dir, void *data ), void *data )
-{
-    VectorForEach ( & self -> search, false,
-        ( void ( * ) ( void*, void* ) ) f, data );
-}
-
-
-/* HomeDirectory
- *  returns a KDirectory where the binary for a given function is located
- *
- *  "dir" [ OUT ] - return parameter for home directory ( read-only ), if found
- *
- *  "func" [ IN ] - function pointer within binary to be located
- */
-LIB_EXPORT rc_t CC KDyldHomeDirectory ( const KDyld *self, const KDirectory **dir, fptr_t func )
-{
-    rc_t rc;
-
-    if ( dir == NULL )
-        rc = RC ( rcFS, rcDylib, rcSearching, rcParam, rcNull );
-    else
-    {
-        * dir = NULL;
-
-        if ( self == NULL )
-            rc = RC ( rcFS, rcDylib, rcSearching, rcSelf, rcNull );
-        else if ( func == NULL )
-            rc = RC ( rcFS, rcDylib, rcSearching, rcFunction, rcNull );
-        else
-        {
-            Dl_info info;
-            memset ( & info, 0, sizeof info );
-            if ( dladdr ( ( void* ) func, & info ) == 0 )
-                rc = RC ( rcFS, rcDylib, rcSearching, rcFunction, rcNotFound );
-            else
-            {
-                KDirectory *wd;
-                rc = KDirectoryNativeDir ( & wd );
-                if ( rc == 0 )
-                {
-                    /* turn this into a real path */
-                    const KSysDir *sdir = KDirectoryGetSysDir ( wd );
-                    if ( sdir == NULL )
-                        rc = RC ( rcFS, rcDylib, rcSearching, rcDirectory, rcIncorrect );
-                    else
-                    {
-                        /* "dladdr" will return a simple name rather than a path
-                           when the address is within the application itself and
-                           the application was found using PATH. this is brilliant
-                           design at its best. */
-                        char thanks_for_brilliant_APIs [ PATH_MAX ];
-                        const char *dli_fname = info . dli_fname;
-
-                        /* check for a path rather than a name */
-                        const char *last_slash = strrchr ( info . dli_fname, '/' );
-                        if ( last_slash == NULL )
-                        {
-                            /* simple name - get PATH */
-                            const char *PATH = getenv ( "PATH" );
-                            rc = RC ( rcFS, rcDylib, rcSearching, rcPath, rcNotFound );
-                            if ( PATH != NULL )
-                            {
-                                /* loop over PATH */
-                                const char *path_start, *path_end;
-                                for ( path_start = PATH;; path_start = path_end + 1 )
-                                {
-                                    /* look for non-empty directory */
-                                    path_end = strchr ( path_start, ':' );
-                                    if ( path_start != path_end && path_start [ 0 ] != 0 )
-                                    {
-                                        rc_t rc2;
-                                        uint32_t path_type;
-
-                                        /* handle last element in list */
-                                        if ( path_end == NULL )
-                                            last_slash = path_start + strlen ( path_start );
-                                        else for ( last_slash = path_end; last_slash > path_start; -- last_slash )
-                                        {
-                                            if ( last_slash [ -1 ] != '/' )
-                                                break;
-                                        }
-
-                                        /* create possible path, using up to ':' */
-                                        rc2 = string_printf ( thanks_for_brilliant_APIs, sizeof thanks_for_brilliant_APIs, NULL,
-                                                              "%.*s/%s", ( int ) ( last_slash - path_start ), path_start, dli_fname );
-
-                                        /* if failed to create path string */
-                                        if ( rc2 != 0 )
-                                            break;
-
-                                        /* check path against working directory */
-                                        path_type = KDirectoryPathType ( wd, thanks_for_brilliant_APIs );
-                                        if ( ( path_type & ~ kptAlias ) == kptFile )
-                                        {
-                                            uint32_t access = 0;
-                                            rc = KDirectoryAccess ( wd, & access, thanks_for_brilliant_APIs );
-                                            if ( rc != 0 )
-                                                break;
-
-                                            /* try to do a quick check that the file can be executed.
-                                               but it could fail to do the right guess. */
-                                            if ( access & 0100 || access & 0010 || access & 0001 ) {
-                                                /* this is a file, which can be assumed to be an executable */
-                                                dli_fname = thanks_for_brilliant_APIs;
-                                                last_slash
-                                                    = & thanks_for_brilliant_APIs [ last_slash - path_start ];
-                                                rc = 0;
-                                                break;
-                                            }
-                                        }
-                                    }
-
-                                    /* exit if no more paths */
-                                    if ( path_end == NULL )
-                                        break;
-                                }
-                            }
-                        }
-
-                        if ( rc == 0 )
-                        {
-                            char real [ PATH_MAX ];
-                            rc = KSysDirRealPath ( sdir, real, sizeof real, "%.*s"
-                                , ( int ) ( last_slash - dli_fname ), dli_fname );
-
-                            if ( rc == 0 )
-                                rc = KDirectoryOpenDirRead ( wd, dir, false, real );
-
-                            DBGMSG(DBG_KFS, DBG_FLAG(DBG_KFS_DIR), ("%s: %R path is '%s'\n", __func__, rc, real));
-                        }
-                    }
-
-                    KDirectoryRelease ( wd );
-                }
-            }
-        }
-    }
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * KDylib
- *  Unix dynamic library
- */
-struct KDylib
-{
-    void *handle;
-    String path;
-    KRefcount refcount;
-};
-
-
-/* Whack
- */
-static
-rc_t KDylibWhack ( KDylib *self )
-{
-    KRefcountWhack ( & self -> refcount, "KDylib" );
-
-
-/* Darwin, especially before 10.5 doesn't/didn't do this well */
-#if ! MAC
-    /* try to close library */
-    if ( dlclose ( self -> handle ) )
-    {
-        /* report error */
-        const char *msg = dlerror ();
-        rc_t rc = RC ( rcFS, rcDylib, rcClosing, rcNoObj, rcUnknown );
-        LOGERR ( klogInt, rc, msg );
-        ( void ) msg;
-
-        return rc;
-    }
-#endif
-    free ( self );
-    return 0;
-}
-
-
-/* Make
- */
-static
-rc_t KDylibMake ( KDylib **libp, const String *path )
-{
-    KDylib *lib = malloc ( sizeof * lib + path -> size + 1 );
-    if ( lib == NULL )
-        return RC ( rcFS, rcDylib, rcConstructing, rcMemory, rcExhausted );
-
-    lib -> handle = NULL;
-    string_copy ( ( char* ) ( lib + 1 ), path -> size + 1, path -> addr, path -> size );
-    StringInit ( & lib -> path, ( char* ) ( lib + 1 ), path -> size, path -> len );
-    KRefcountInit ( & lib -> refcount, 1, "KDylib", "make", lib -> path . addr );
-
-    * libp = lib;
-    return 0;
-}
-
-
-/* SetLogging
- */
-static
-rc_t KDylibSetLogging ( const KDylib *self )
-{
-    rc_t ( CC * set_formatter ) ( KFmtWriter writer, KLogFmtFlags flags, void *data );
-    rc_t ( CC * set_writer ) ( KWrtWriter writer, void *data );
-    rc_t ( CC * set_level ) ( KLogLevel lvl );
-
-    /* set the current logging level */
-    set_level = ( rc_t ( * ) ( KLogLevel ) ) dlsym ( self -> handle, "KLogLevelSet" );
-    if ( set_level != NULL )
-    {
-        KLogLevel lvl = KLogLevelGet ();
-        ( * set_level ) ( lvl );
-    }
-
-    /* determine current library logging */
-    set_writer = ( rc_t ( * ) ( KWrtWriter, void* ) ) dlsym ( self -> handle, "KOutHandlerSet" );
-    if ( set_writer != NULL ) {
-        const KWrtHandler* handler = KOutHandlerGet ();
-        ( * set_writer ) ( handler -> writer, handler -> data );
-    }
-
-    set_formatter = ( rc_t ( * ) ( KFmtWriter, KLogFmtFlags, void* ) ) dlsym ( self -> handle, "KLogLibFmtHandlerSet" );
-    if ( set_formatter != NULL ) {
-        KLogFmtFlags flags = KLogLibFmtFlagsGet ();
-        const KFmtHandler* fmt_handler = KLogFmtHandlerGet ();
-        ( * set_formatter ) ( fmt_handler -> formatter, flags, fmt_handler -> data );
-    }
-    set_writer = ( rc_t ( * ) ( KWrtWriter, void* ) ) dlsym ( self -> handle, "KLogLibHandlerSet" );
-    if ( set_writer != NULL ) {
-        const KWrtHandler* handler = KLogLibHandlerGet ();
-        ( * set_writer ) ( handler -> writer, handler -> data );
-    }
-
-    set_formatter = ( rc_t ( * ) ( KFmtWriter, KLogFmtFlags, void* ) ) dlsym ( self -> handle, "KStsLibFmtHandlerSet" );
-    if ( set_formatter != NULL ) {
-        KStsFmtFlags flags = KStsLibFmtFlagsGet ();
-        const KFmtHandler* fmt_handler = KStsFmtHandlerGet ();
-        ( * set_formatter ) ( fmt_handler -> formatter, flags, fmt_handler -> data );
-    }
-    set_writer = ( rc_t ( * ) ( KWrtWriter, void* ) ) dlsym ( self -> handle, "KStsLibHandlerSet" );
-    if ( set_writer != NULL ) {
-        const KWrtHandler* handler = KStsLibHandlerGet ();
-        ( * set_writer ) ( handler -> writer, handler -> data );
-    }
-#if _DEBUGGING
-    set_writer = ( rc_t ( * ) ( KWrtWriter, void* ) ) dlsym ( self -> handle, "KDbgHandlerSet" );
-    if ( set_writer != NULL ) {
-        const KWrtHandler* handler = KDbgHandlerGet ();
-        ( * set_writer ) ( handler -> writer, handler -> data );
-    }
-#endif
-    return 0;
-}
-
-/* LoadLib
- *  load a dynamic library
- *
- *  "lib" [ OUT ] - return parameter for loaded library
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target library
- */
-static
-rc_t KDyldLoad ( KDyld *self, KDylib *lib, const char *path )
-{
-    rc_t rc;
-    const char *msg;
-    size_t msg_len;
-
-    lib -> handle = dlopen ( path, path == NULL ? RTLD_LAZY : DLOPEN_MODE );
-    if ( lib -> handle != NULL )
-        return KDylibSetLogging ( lib );
-
-    msg = dlerror ();
-    rc = RC ( rcFS, rcDylib, rcLoading, rcNoObj, rcUnknown );
-
-    msg_len = strlen(msg);
-    if ( msg_len > lib -> path . size + 2 )
-    {
-        const char *cmp = & msg [ lib -> path . size + 2 ];
-        if ( strcmp ( cmp, "cannot open shared object file: No such file or directory" ) == 0 )
-            rc = RC ( rcFS, rcDylib, rcLoading, rcPath, rcNotFound );
-        else if ( strncmp ( cmp, "undefined symbol: ", sizeof "undefined symbol: " - 1 ) == 0 )
-            rc = RC ( rcFS, rcDylib, rcLoading, rcDylib, rcIncomplete );
-    }
-    if (GetRCState(rc) == rcUnknown) {
-        static const char imageNotFound[] = " image not found";
-        const char *cmp1 = strstr(msg, imageNotFound);
-        const char *cmp2 = msg + msg_len - (sizeof(imageNotFound) - 1);
-        if (cmp1 == cmp2)
-            rc = RC ( rcFS, rcDylib, rcLoading, rcPath, rcNotFound );
-    }
-    
-    DBGMSG (DBG_KFS, DBG_FLAG(DBG_KFS_DLL), ("%s: %R %s\n", __func__, rc, msg));
-    if (GetRCState(rc) == rcUnknown) {
-        (void)LOGMSG(klogWarn, (msg));
-    }
-    
-    return rc;
-}
-
-static
-rc_t KDyldVTryLoadLib ( KDyld *self, KDylib **lib,
-    const KDirectory *dir, const char *path, va_list args )
-{
-    rc_t rc;
-
-    const KSysDir *sdir = KDirectoryGetSysDir ( dir );
-    if ( sdir == NULL )
-        rc = RC ( rcFS, rcDylib, rcLoading, rcDirectory, rcIncorrect );
-    else
-    {
-        char real [ PATH_MAX ];
-        rc = KSysDirVRealPath ( sdir, real, sizeof real, path, args );
-        if ( rc == 0 )
-        {
-            String pstr;
-            StringInitCString ( & pstr, real );
-
-            rc = KDylibMake ( lib, & pstr );
-            if ( rc == 0 )
-            {
-                rc = KDyldLoad ( self, * lib, real );
-                if ( rc == 0 )
-                    return 0;
-
-                free ( * lib );
-            }
-        }
-    }
-
-    * lib = NULL;
-
-    return rc;
-}
-
-static
-rc_t KDyldTryLoadLib ( KDyld *self, KDylib **lib,
-    const KDirectory *dir, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-    va_start ( args, path );
-    rc = KDyldVTryLoadLib ( self, lib, dir, path, args );
-    va_end ( args );
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDyldVLoadLib ( KDyld *self,
-    KDylib **lib, const char *path, va_list args )
-{
-    rc_t rc;
-
-    if ( lib == NULL )
-        rc = RC ( rcFS, rcDylib, rcLoading, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcFS, rcDylib, rcLoading, rcSelf, rcNull );
-        else if ( path == NULL || path [ 0 ] == 0 )
-        {
-            String pstr;
-            CONST_STRING ( & pstr, "" );
-
-            rc = KDylibMake ( lib, & pstr );
-            if ( rc == 0 )
-            {
-                rc = KDyldLoad ( self, * lib, NULL );
-                if ( rc == 0 )
-                    return 0;
-            
-                free ( * lib );
-            }
-        }
-        else
-        {
-            uint32_t i = VectorStart ( & self -> search );
-            uint32_t end = i + VectorLength ( & self -> search );
-
-            if ( i == end )
-            {
-                char name [ 4096 ];
-                int len = vsnprintf ( name, sizeof name, path, args );
-                if ( len < 0 || len >= sizeof name )
-                    rc = RC ( rcFS, rcDylib, rcLoading, rcPath, rcExcessive );
-                else
-                {
-                    String pstr;
-                    StringInit ( & pstr, name, len, string_len ( name, len ) );
-
-                    rc = KDylibMake ( lib, & pstr );
-                    if ( rc == 0 )
-                    {
-                        rc = KDyldLoad ( self, * lib, name );
-                        if ( rc == 0 )
-                            return 0;
-                    
-                        free ( * lib );
-                    }
-                }
-            }
-            else
-            {
-                for ( * lib = NULL; i < end; ++ i )
-                {
-                    const KDirectory *dir;
-
-                    va_list cpy;
-                    va_copy ( cpy, args );
-
-                    dir = ( const void* ) VectorGet ( & self -> search, i );
-                    rc = KDyldVTryLoadLib ( self, lib, dir, path, cpy );
-
-                    va_end ( cpy );
-
-                    if ( rc == 0 || GetRCState ( rc ) != rcNotFound )
-                        return rc;
-                }
-
-                rc = RC ( rcFS, rcDylib, rcLoading, rcPath, rcNotFound );
-            }
-        }
-
-        * lib = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDyldLoadLib ( KDyld *self,
-    KDylib **lib, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDyldVLoadLib ( self, lib, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KDylibAddRef ( const KDylib *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KDylib" ) )
-        {
-        case krefLimit:
-            return RC ( rcFS, rcDylib, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KDylibRelease ( const KDylib *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KDylib" ) )
-        {
-        case krefWhack:
-            return KDylibWhack ( ( KDylib* ) self );
-        case krefNegative:
-            return RC ( rcFS, rcDylib, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-static
-void KDylibVectRelease ( void *item, void *ignore )
-{
-    KDylib *self = item;
-    KDylibRelease ( self );
-}
-
-
-/* Attach
- * Sever
- */
-static
-KDylib *KDylibAttach ( const KDylib *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAddDep ( & self -> refcount, "KDylib" ) )
-        {
-        case krefLimit:
-            return NULL;
-        }
-    }
-    return ( KDylib* ) self;
-}
-
-static
-rc_t KDylibSever ( const KDylib *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDropDep ( & self -> refcount, "KDylib" ) )
-        {
-        case krefWhack:
-            return KDylibWhack ( ( KDylib* ) self );
-        case krefNegative:
-            return RC ( rcFS, rcDylib, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-/* Sort
- */
-static
-int KDylibSort ( const void *item, const void *n )
-{
-    const KDylib *a = item;
-    const KDylib *b = n;
-    return StringOrderNoNullCheck ( & a -> path, & b -> path );
-}
-
-
-/* FullPath
- *  return full path to library
- */
-LIB_EXPORT rc_t CC KDylibFullPath ( const KDylib *self, char *path, size_t psize )
-{
-    rc_t rc;
-
-    if ( psize == 0 )
-        rc = RC ( rcFS, rcDylib, rcAccessing, rcBuffer, rcInsufficient );
-    else if ( path == NULL )
-        rc = RC ( rcFS, rcDylib, rcAccessing, rcBuffer, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcFS, rcDylib, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            size_t bytes = string_copy ( path, psize,
-                self -> path . addr, self -> path . size );
-            if ( bytes < psize )
-                return 0;
-
-            rc = RC ( rcFS, rcDylib, rcAccessing, rcBuffer, rcInsufficient );
-        }
-
-        path [ 0 ] = 0;
-    }
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * KDlset
- *  ordered set of dynamic libraries
- *  contained libraries remain resident until set is released
- */
-struct KDlset
-{
-    KDyld *dl;
-    Vector name, ord;
-    KRefcount refcount;
-};
-
-
-/* Whack
- */
-static
-rc_t KDlsetWhack ( KDlset *self )
-{
-    KRefcountWhack ( & self -> refcount, "KDlset" );
-
-    VectorWhack ( & self -> name, NULL, NULL );
-    VectorWhack ( & self -> ord, KDylibVectRelease, NULL );
-    KDyldSever ( self -> dl );
-    free ( self );
-
-    return 0;
-}
-
-#define STRINGIZE(s) #s
-#define LIBNAME(pref, name, suff) STRINGIZE(pref) name STRINGIZE(suff)
-/* MakeSet
- *  load a dynamic library
- *
- *  "set" [ OUT ] - return parameter for lib set
- */
-LIB_EXPORT rc_t CC KDyldMakeSet ( const KDyld *self, KDlset **setp )
-{
-    rc_t rc = 0;
-
-    if ( setp == NULL )
-        rc = RC ( rcFS, rcDylib, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcFS, rcDylib, rcConstructing, rcSelf, rcNull );
-        else
-        {
-            KDlset *set = malloc ( sizeof * set );
-            if ( set == NULL )
-                rc = RC ( rcFS, rcDylib, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                set -> dl = KDyldAttach ( self );
-                VectorInit ( & set -> name, 0, 16 );
-                VectorInit ( & set -> ord, 0, 16 );
-                KRefcountInit ( & set -> refcount, 1, "KDlset", "make", "dlset" );
-#if ! ALWAYS_ADD_EXE
-                {   
-                    KDylib *jni;
-                    const char* libname = LIBNAME(LIBPREFIX, "vdb_jni.", SHLIBEXT);
-                    if ( KDyldLoadLib ( ( KDyld* ) self, & jni, libname ) == 0 )
-                    {
-                        rc = KDlsetAddLib ( set, jni );
-                        KDylibRelease ( jni );
-                    }
-                    if (rc == 0)
-                    {
-                        * setp = set;
-                        return 0;
-                    }
-                }
-#else
-                {
-                    KDylib *exe;
-                    rc = KDyldLoadLib ( ( KDyld* ) self, & exe, NULL );
-                    if ( rc == 0 )
-                    {
-                        rc = KDlsetAddLib ( set, exe );
-                        KDylibRelease ( exe );
-                        if ( rc == 0 )
-                        {
-                            * setp = set;
-                            return 0;
-                        }
-                    }
-                }
-#endif
-                KDlsetRelease ( set );
-            }
-        }
-
-        * setp = NULL;
-    }
-
-    return rc;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KDlsetAddRef ( const KDlset *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KDlset" ) )
-        {
-        case krefLimit:
-            return RC ( rcFS, rcDylib, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KDlsetRelease ( const KDlset *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KDlset" ) )
-        {
-        case krefWhack:
-            return KDlsetWhack ( ( KDlset* ) self );
-        case krefNegative:
-            return RC ( rcFS, rcDylib, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/* AddLib
- *  adds a dynamic library to end of ordered set
- *
- *  "lib" [ IN ] - library returned from KDyldLoadLib
- */
-static
-rc_t KDlsetAddLibInt ( KDlset *self, KDylib *lib )
-{
-    uint32_t idx;
-    rc_t rc = VectorAppend ( & self -> ord, & idx, lib );
-    if ( rc == 0 )
-    {
-        void *ignore;
-
-        rc = VectorInsertUnique ( & self -> name,
-            lib, NULL, KDylibSort );
-        if ( rc == 0 )
-            return 0;
-
-        VectorSwap ( & self -> ord, idx, NULL, & ignore );
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDlsetAddLib ( KDlset *self, KDylib *lib )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcFS, rcDylib, rcInserting, rcSelf, rcNull );
-    else if ( lib == NULL )
-        rc = RC ( rcFS, rcDylib, rcInserting, rcDylib, rcNull );
-    else
-    {
-        rc = KDylibAddRef ( lib );
-        if ( rc == 0 )
-        {
-            rc = KDlsetAddLibInt ( self, lib );
-            if ( rc == 0 )
-                return 0;
-
-            KDylibRelease ( lib );
-        }
-    }
-
-    return rc;
-}
-
-
-/* AddAll
- *  adds all dynamic libraries found in dl search path
- */
-static
-rc_t KDlsetTryLib ( const KDirectory *dir,
-    uint32_t type, const char *name, void *data )
-{
-    KDlset *self = data;
-
-    if ( ( type & ~ kptAlias ) == kptFile )
-    {
-        rc_t rc;
-        KDylib *lib;
-#ifdef SHLX
-        /* force simple shared library extension */
-        if ( sizeof SHLX >= 2 )
-        {
-            /* SHLX has at least 1 character plus NUL byte */
-            uint32_t len = strlen ( name );
-            /* name must be at least 1 character larger */
-            if ( len <= ( sizeof SHLX - 1 ) )
-                return 0;
-            /* name must end with shared library extension */
-            if ( memcmp ( & name [ len - ( sizeof SHLX - 1 ) ], SHLX, sizeof SHLX - 1 ) != 0 )
-                return 0;
-        }
-#endif
-        rc = KDyldTryLoadLib ( self -> dl, & lib, dir, name );
-        if ( rc == 0 )
-        {
-            rc = KDlsetAddLibInt ( self, lib );
-            if ( rc == 0 )
-                return 0;
-
-            KDylibRelease ( lib );
-        }
-    }
-
-    return 0;
-}
-
-static
-void KDlsetVisitDir ( const KDirectory *dir, void *data )
-{
-    KDirectoryVisit ( dir, false, KDlsetTryLib, data, "." );
-}
-
-LIB_EXPORT rc_t CC KDlsetAddAll ( KDlset *self )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcDylib, rcInserting, rcSelf, rcNull );
-    KDyldForEach ( self -> dl, KDlsetVisitDir, self );
-    return 0;
-}
-
-
-/*--------------------------------------------------------------------------
- * KSymAddr
- *  symbol address within a dynamic library
- */
-struct KSymAddr
-{
-    KDylib *lib;
-    void *addr;
-    KRefcount refcount;
-};
-
-
-/* Whack
- */
-static
-rc_t KSymAddrWhack ( KSymAddr *self )
-{
-    KRefcountWhack ( & self -> refcount, "KSymAddr" );
-
-    KDylibSever ( self -> lib );
-    free ( self );
-
-    return 0;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KSymAddrAddRef ( const KSymAddr *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KSymAddr" ) )
-        {
-        case krefLimit:
-            return RC ( rcFS, rcDylib, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KSymAddrRelease ( const KSymAddr *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KSymAddr" ) )
-        {
-        case krefWhack:
-            return KSymAddrWhack ( ( KSymAddr* ) self );
-        case krefNegative:
-            return RC ( rcFS, rcDylib, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/* Make
- */
-static
-rc_t KSymAddrMake ( KSymAddr **symp,
-    const KDylib *lib, const char *name )
-{
-    void *addr = dlsym ( lib -> handle, name );
-    const char *estr = dlerror();
-    
-    if ( addr != NULL || estr == NULL )
-    {
-        KSymAddr *sym = malloc ( sizeof * sym );
-        if ( sym == NULL )
-            return RC ( rcFS, rcDylib, rcConstructing, rcMemory, rcExhausted );
-
-        sym -> lib = KDylibAttach ( lib );
-        sym -> addr = addr;
-        KRefcountInit ( & sym -> refcount, 1, "KSymAddr", "make", name );
-        * symp = sym;
-        return 0;
-    }
-
-    * symp = NULL;
-    return RC ( rcFS, rcDylib, rcSelecting, rcName, rcNotFound );
-}
-
-
-/* Symbol
- *  find a symbol within dynamic library
- *
- *  "sym" [ OUT ] - return parameter for exported symbol address
- *
- *  "name" [ IN ] - NUL terminated symbol name in
- *  library-native character set
- */
-LIB_EXPORT rc_t CC KDylibSymbol ( const KDylib *self, KSymAddr **sym, const char *name )
-{
-    rc_t rc;
-
-    if ( sym == NULL )
-        rc = RC ( rcFS, rcDylib, rcSelecting, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcFS, rcDylib, rcSelecting, rcSelf, rcNull );
-        else if ( name == NULL )
-            rc = RC ( rcFS, rcDylib, rcSelecting, rcName, rcNull );
-        else if ( name [ 0 ] == 0 )
-            rc = RC ( rcFS, rcDylib, rcSelecting, rcName, rcEmpty );
-        else
-        {
-            return KSymAddrMake ( sym, self, name );
-        }
-
-        * sym = NULL;
-    }
-
-    return rc;
-}
-
-typedef struct KDlsetTrySymData KDlsetTrySymData;
-struct KDlsetTrySymData
-{
-    const KDlset *self;
-    const char *name;
-
-    bool ( CC * test ) ( const KSymAddr *sym, void *data );
-    void *data;
-
-    KSymAddr *sym;
-    rc_t rc;
-    bool first;
-};
-
-static
-bool KDlsetTrySymbol ( void *item, void *data )
-{
-    KSymAddr *sym;
-    KDlsetTrySymData *pb = data;
-    pb -> rc = KDylibSymbol ( item, & sym, pb -> name );
-    if ( pb -> rc == 0 )
-    {
-        /* simple case */
-        if ( pb -> test == NULL )
-        {
-            pb -> sym = sym;
-            return true;
-        }
-
-        /* apply filter function */
-        if ( ( * pb -> test ) ( sym, pb -> data ) )
-        {
-            KSymAddrRelease ( pb -> sym );
-            pb -> sym = sym;
-            return pb -> first;
-        }
-
-        KSymAddrRelease ( sym );
-    }
-    return false;
-}
-
-LIB_EXPORT rc_t CC KDlsetSymbol ( const KDlset *self, KSymAddr **sym, const char *name )
-{
-    rc_t rc;
-
-    if ( sym == NULL )
-        rc = RC ( rcFS, rcDylib, rcSelecting, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcFS, rcDylib, rcSelecting, rcSelf, rcNull );
-        else if ( name == NULL )
-            rc = RC ( rcFS, rcDylib, rcSelecting, rcName, rcNull );
-        else if ( name [ 0 ] == 0 )
-            rc = RC ( rcFS, rcDylib, rcSelecting, rcName, rcEmpty );
-        else
-        {
-            KDlsetTrySymData pb;
-            memset ( & pb, 0, sizeof pb );
-            pb . self = self;
-            pb . name = name;
-            pb . rc = RC ( rcFS, rcDylib, rcSelecting, rcName, rcNotFound );
-
-            if ( VectorDoUntil ( & self -> ord, false, KDlsetTrySymbol, & pb ) )
-            {
-                * sym = pb . sym;
-                return 0;
-            }
-
-            rc = pb . rc;
-        }
-
-        * sym = NULL;
-    }
-
-    return rc;
-}
-
-
-/* FirstSymbol
- * LastSymbol
- *  find a symbol within dynamic library set matching criteria
- *
- *  "sym" [ OUT ] - return parameter for exported symbol address
- *
- *  "name" [ IN ] - NUL terminated symbol name in
- *  library-native character set
- *
- *  "test" [ IN ] and "data" [ IN, OPAQUE ] - callback filter function
- *  return true if symbol matches criteria
- */
-LIB_EXPORT rc_t CC KDlsetFirstSymbol ( const KDlset *self, KSymAddr **sym, const char *name,
-    bool ( CC * test ) ( const KSymAddr *sym, void *data ), void *data )
-{
-    rc_t rc;
-
-    if ( sym == NULL )
-        rc = RC ( rcFS, rcDylib, rcSelecting, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcFS, rcDylib, rcSelecting, rcSelf, rcNull );
-        else if ( name == NULL )
-            rc = RC ( rcFS, rcDylib, rcSelecting, rcName, rcNull );
-        else if ( name [ 0 ] == 0 )
-            rc = RC ( rcFS, rcDylib, rcSelecting, rcName, rcEmpty );
-        else if ( test == NULL )
-            rc = RC ( rcFS, rcDylib, rcSelecting, rcFunction, rcNull );
-        else
-        {
-            KDlsetTrySymData pb;
-            memset ( & pb, 0, sizeof pb );
-            pb . self = self;
-            pb . name = name;
-            pb . test = test;
-            pb . data = data;
-            pb . rc = RC ( rcFS, rcDylib, rcSelecting, rcName, rcNotFound );
-            pb . first = true;
-
-            if ( VectorDoUntil ( & self -> ord, false, KDlsetTrySymbol, & pb ) )
-            {
-                * sym = pb . sym;
-                return 0;
-            }
-
-            rc = pb . rc;
-        }
-
-        * sym = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDlsetLastSymbol ( const KDlset *self, KSymAddr **sym, const char *name,
-    bool ( CC * test ) ( const KSymAddr *sym, void *data ), void *data )
-{
-    rc_t rc;
-
-    if ( sym == NULL )
-        rc = RC ( rcFS, rcDylib, rcSelecting, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcFS, rcDylib, rcSelecting, rcSelf, rcNull );
-        else if ( name == NULL )
-            rc = RC ( rcFS, rcDylib, rcSelecting, rcName, rcNull );
-        else if ( name [ 0 ] == 0 )
-            rc = RC ( rcFS, rcDylib, rcSelecting, rcName, rcEmpty );
-        else if ( test == NULL )
-            rc = RC ( rcFS, rcDylib, rcSelecting, rcFunction, rcNull );
-        else
-        {
-            KDlsetTrySymData pb;
-            memset ( & pb, 0, sizeof pb );
-            pb . self = self;
-            pb . name = name;
-            pb . test = test;
-            pb . data = data;
-            pb . rc = RC ( rcFS, rcDylib, rcSelecting, rcName, rcNotFound );
-
-            VectorDoUntil ( & self -> ord, false, KDlsetTrySymbol, & pb );
-            if ( pb . sym != NULL )
-            {
-                * sym = pb . sym;
-                return 0;
-            }
-
-            rc = pb . rc;
-        }
-
-        * sym = NULL;
-    }
-
-    return rc;
-}
-
-
-/* List - PRIVATE
- *  list the paths to the libraries in the set
- */
-typedef struct list_dylib_param list_dylib_param;
-struct list_dylib_param
-{
-    VNamelist *list;
-    rc_t rc;
-};
-
-static
-bool CC list_dylib ( void *item, void *data )
-{
-    list_dylib_param *pb = data;
-    const KDylib *lib = ( const void* ) item;
-
-    /* "lib" was created with KDylibMake
-       which creates a NUL terminated path.
-       of course, this could seg-fault if bad... */
-    assert ( lib -> path . addr [ lib -> path . size ] == 0 );
-
-    pb -> rc = VNamelistAppend ( pb -> list, lib -> path . addr );
-    return pb -> rc != 0;
-}
-
-LIB_EXPORT rc_t CC KDlsetList ( const KDlset *self, KNamelist **listp )
-{
-    list_dylib_param pb;
-
-    assert ( listp != NULL );
-
-    if ( self == NULL )
-        pb . rc = RC ( rcFS, rcDylib, rcListing, rcSelf, rcNull );
-    else
-    {
-        pb . rc = VNamelistMake ( & pb . list, VectorLength ( & self -> name ) );
-        if ( pb . rc == 0 )
-        {
-            bool fail = VectorDoUntil ( & self -> name, false, list_dylib, & pb );
-            if ( ! fail )
-                pb . rc = VNamelistToNamelist ( pb . list, listp );
-
-            VNamelistRelease ( pb . list );
-        }
-    }
-
-    return pb . rc;
-}
-
-
-/* AsObj
- * AsFunc
- *  retrieve symbol address as pointer to object
- */
-LIB_EXPORT void * CC KSymAddrAsObj ( const KSymAddr *self )
-{
-    if ( self != NULL )
-        return self -> addr;
-    return NULL;
-}
-
-LIB_EXPORT void CC KSymAddrAsFunc ( const KSymAddr *self, fptr_t *fp )
-{
-    if ( self != NULL && fp != NULL )
-        * fp = ( fptr_t ) self -> addr;
-}
-
-
diff --git a/libs/kfs/unix/sysfile-priv.h b/libs/kfs/unix/sysfile-priv.h
deleted file mode 100644
index 34d2a40..0000000
--- a/libs/kfs/unix/sysfile-priv.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef USE_TIMEOUT
-#define USE_TIMEOUT false
-#endif
-
-#ifndef USE_NO_TIMEOUT_TTY
-#define USE_NO_TIMEOUT_TTY false
-#endif
-
-#ifndef _h_sysfile_priv_
-#define _h_sysfile_priv_
-
-#ifndef _h_kfs_impl_
-#include <kfs/impl.h>
-#endif
-
-#include <sys/select.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * KSysFile
- *  a Unix file
- */
-typedef struct KSysFile KSysFile;
-struct KSysFile
-{
-    KFile dad;
-    int fd;
-#if USE_TIMEOUT
-    fd_set fds;
-    struct timeval to;
-    bool use_to;
-#endif
-};
-
-/* KSysFileMake
- *  create a new file object
- *  from file descriptor
- */
-rc_t KSysFileMake ( KSysFile **fp, int fd, const char *path, bool read_enabled, bool write_enabled );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*  _h_sysfile_priv_ */
diff --git a/libs/kfs/unix/sysfile.c b/libs/kfs/unix/sysfile.c
deleted file mode 100644
index 5b98275..0000000
--- a/libs/kfs/unix/sysfile.c
+++ /dev/null
@@ -1,1057 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KSysFile;
-#define KFILE_IMPL struct KSysFile
-
-#include <kfs/extern.h>
-#include "sysfile-priv.h"
-#include <kfs/kfs-priv.h>
-#include <klib/rc.h>
-#include <klib/log.h>
-#include <sysalloc.h>
-
-
-#ifndef __USE_UNIX98
-#define __USE_UNIX98 1
-#endif
-#include <unistd.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <assert.h>
-#include <string.h>
-
-#ifdef _DEBUGGING
-#define SYSDEBUG(msg) DBGMSG(DBG_KFS,DBG_FLAG(DBG_KFS_SYS),msg)
-#else
-#define SYSDEBUG(msg)
-#endif
-
-/*--------------------------------------------------------------------------
- * KSysFile
- *  a Unix file
- */
-
-
-#if USE_TIMEOUT
-/* default timeout amount 3 seconds is 10,000 milliseconds */
-#define TIMEOUT_MSECS (3 * 1000)
-
-int32_t KSysFileTimeout = TIMEOUT_MSECS;
-
-enum
-{
-    select_read = 1,
-    select_write = 2,
-    select_exception = 4
-} select_operations;
-
-static
-rc_t KSysFileSelect (const KSysFile * self, uint32_t operations)
-{
-    rc_t rc = 0;
-
-    SYSDEBUG(( "%s: Enter (%p, %x)\n", __func__, self, operations));
-
-
-    if (self->use_to)
-    {
-        fd_set fdsread;
-        fd_set fdswrite;
-        fd_set fdsexcept;
-        struct timeval to;
-        int selected;
-
-        fdsread = self->fds;
-        fdswrite = self->fds;
-        fdsexcept = self->fds;
-
-        to = self->to;
-
-        for (rc = 0; rc == 0; ) 
-        {
-            SYSDEBUG(( "%s: call select\n", __func__));
-
-            selected = select (self->fd + 1, 
-                               (operations & select_read) ? &fdsread : NULL,
-                               (operations & select_write) ? &fdswrite : NULL,
-                               (operations & select_exception) ? &fdsexcept : NULL,
-                               &to);
-            SYSDEBUG(( "%s: select returned '%d' \n", __func__, selected));
-
-            if (selected == 0)
-            {
-
-                rc = RC (rcFS, rcFile, rcSelecting, rcTimeout, rcDone);
-            }
-            else if (selected < 0)
-            {
-                int lerrno = errno;
-
-                switch (lerrno)
-                {
-                case EINVAL:
-                    rc = RC (rcFS, rcFile, rcSelecting, rcTimeout, rcInvalid);
-                    LOGERR (klogInt, rc, "coding error bad timeout or negative nfds");
-                    break;
-
-                case EBADF:
-                    rc = RC ( rcFS, rcFile, rcSelecting, rcFileDesc, rcInvalid );
-                    PLOGERR (klogErr,
-                             (klogErr, rc, "system bad file descriptor error fd='$(E)'",
-                              "E=%d", self->fd));
-                    break;
-
-                case EINTR:/*  A signal was caught. */
-                    continue;
-
-                case ENOMEM:
-                    rc = RC (rcFS, rcFile, rcSelecting, rcMemory, rcExhausted);
-                    LOGERR (klogErr, rc, "out of memory setting up read timeout");
-                    break;
-                }
-                /* function documentation seems to show that unless EINTR was 
-                 * set we can now do our read
-                 */
-            }
-            else
-            {
-                assert (FD_ISSET (self->fd, &fdsread) ||
-                        FD_ISSET (self->fd, &fdswrite) ||
-                        FD_ISSET (self->fd, &fdsexcept));
-
-                return 0;
-            }
-        }
-    }
-    return rc;
-}
-#endif
-
-
-/* Destroy
- */
-static
-rc_t KSysFileDestroy ( KSysFile *self )
-{
-    rc_t rc = 0;
-    int lerrno;
-
-    if ( close ( self -> fd ) != 0 ) switch ( lerrno = errno )
-    {
-    case EBADF:
-        rc = RC ( rcFS, rcFile, rcDestroying, rcFunction, rcIncomplete );
-        PLOGERR (klogInt,
-                 (klogInt, rc, "system bad file descriptor error '$(F)'",
-                  "F=%d", self->fd));
-        break;
-
-    case EINTR:
-        rc = RC ( rcFS, rcFile, rcDestroying, rcFunction, rcIncomplete );
-        LOGERR (klogErr, rc, "system interrupted function error");
-        return rc;
-
-    default:
-        rc = RC ( rcFS, rcFile, rcDestroying, rcNoObj, rcUnknown );
-        PLOGERR (klogErr,
-                 (klogErr, rc, "unknown system error '$(S)($(E))'",
-                 "S=%!,E=%d", lerrno, lerrno));
-        return rc;
-    }
-
-    free ( self );
-    return 0;
-}
-
-/* GetSysFile
- *  returns an underlying system file object
- *  and starting offset to contiguous region
- *  suitable for memory mapping, or NULL if
- *  no such file is available.
- */
-static
-KSysFile *KSysFileGetSysFile ( const KSysFile *self, uint64_t *offset )
-{
-    * offset = 0;
-    return ( KSysFile* ) self;
-}
-
-/* RandomAccess
- *  ALMOST by definition, the file is random access
- *  certain file types ( notably compressors ) will refuse random access
- *
- *  returns 0 if random access, error code otherwise
- */
-static
-rc_t KSysFileRandomAccess ( const KSysFile *self )
-{
-    struct stat st;
-    rc_t rc = 0;
-    int lerrno;
-    if ( fstat ( self -> fd, & st ) != 0 ) switch ( lerrno = errno )
-    {
-    case EBADF:
-        rc = RC ( rcFS, rcFile, rcAccessing, rcFileDesc, rcInvalid );
-        PLOGERR (klogErr,
-                 (klogErr, rc, "system bad file descriptor error fd='$(F)'",
-                  "F=%d", self->fd));
-        return rc;
-
-    default:
-        rc = RC ( rcFS, rcFile, rcAccessing, rcNoObj, rcUnknown );
-        PLOGERR (klogErr,
-                 (klogErr, rc, "unknown system error '$(F)($(E))'",
-                  "F=%!,E=%d", lerrno, lerrno));
-        return rc;
-    }
-
-    if ( ! S_ISREG ( st . st_mode ) )
-    {
-        rc = RC ( rcFS, rcFile, rcAccessing, rcFunction, rcUnsupported );
-        /* not a deadly error so don't log now         
-        LOGERR (klogErr, (klogErr, rc, ""));
-        */
-        return rc;
-    }
-    return 0;
-}
-
-
-/* Type
- *  returns a KFileDesc
- *  not intended to be a content type,
- *  but rather an implementation class
- */
-static
-uint32_t KSysFileType ( const KSysFile *self )
-{
-    struct stat st;
-
-    if ( fstat ( self -> fd, & st ) != 0 )
-        return kfdInvalid;
-
-    if ( ! S_ISREG ( st . st_mode ) )
-    {
-        if ( S_ISCHR ( st . st_mode ) )
-            return kfdCharDev;
-        if ( S_ISBLK ( st . st_mode ) )
-            return kfdBlockDev;
-        if ( S_ISFIFO ( st . st_mode ) )
-            return kfdFIFO;
-        if ( S_ISSOCK ( st . st_mode ) )
-            return kfdSocket;
-    }
-
-    return kfdFile;
-}
-
-
-/* Size
- *  returns size in bytes of file
- *
- *  "size" [ OUT ] - return parameter for file size
- */
-static
-rc_t KSysFileSize ( const KSysFile *self, uint64_t *size )
-{
-    struct stat st;
-    rc_t rc = 0;
-    int lerrno;
-
-    if ( fstat ( self -> fd, & st ) != 0 ) switch ( lerrno = errno )
-    {
-    case EBADF:
-        rc = RC ( rcFS, rcFile, rcAccessing, rcFileDesc, rcInvalid );
-        PLOGERR (klogInt,
-                 (klogInt, rc, "system bad file descriptor error fd='$(F)'",
-                  "F=%d", self->fd));
-        return rc;
-    default:
-        rc = RC ( rcFS, rcFile, rcAccessing, rcNoObj, rcUnknown );
-        PLOGERR (klogErr,
-                 (klogErr, rc, "unknown system error '$(F)($(E))'",
-                  "F=%!,E=%d", lerrno, lerrno));
-        return rc;
-    }
-
-    if ( S_ISDIR ( st . st_mode ) )
-/*         return RC ( rcFS, rcFile, rcAccessing, rcFileDesc, rcIncorrect ); */
-        return RC ( rcFS, rcFile, rcAccessing, rcFunction, rcUnsupported );
-
-    * size = st . st_size;
-
-    return 0;
-}
-
-/* SetSize
- *  sets size in bytes of file
- *
- *  "size" [ IN ] - new file size
- */
-static
-rc_t KSysFileSetSize ( KSysFile *self, uint64_t size )
-{
-    rc_t rc;
-    int lerrno;
-
-    if ( ftruncate ( self -> fd, size ) != 0 ) switch ( lerrno = errno )
-    {
-    case EBADF:
-        rc = RC ( rcFS, rcFile, rcUpdating, rcFileDesc, rcInvalid );
-        PLOGERR (klogInt,
-                (klogInt, rc, "system bad file descriptor error fd='$(E)'",
-                 "E=%d", self->fd));
-        return rc;
-    default:
-        rc = RC ( rcFS, rcFile, rcUpdating, rcNoObj, rcUnknown );
-        PLOGERR (klogErr,
-                 (klogErr, rc, "unknown system error '$(S)($(E))'",
-                  "S=%!,E=%d", lerrno, lerrno));
-        return rc;
-    }
-
-    return 0;
-}
-
-/* Read
- *  read file from known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually read
- */
-static
-rc_t KSysFileRead ( const KSysFile *self, uint64_t pos,
-    void *buffer, size_t bsize, size_t *num_read )
-{
-    rc_t rc;
-
-    assert ( self != NULL );
-    assert (num_read != NULL);
-
-    *num_read = 0;
-
-    while ( 1 )
-    {
-        ssize_t count;
-        int lerrno;
-
-#if USE_TIMEOUT
-        rc = KSysFileSelect (self, select_read | select_exception);
-        if (rc)
-            return rc;
-#endif
-
-        count = pread ( self -> fd, buffer, bsize, pos );
-
-        if ( count < 0 ) switch ( lerrno = errno )
-        {
-        case EINTR:
-            continue;
-        case EIO:
-            rc = RC ( rcFS, rcFile, rcReading, rcTransfer, rcUnknown );
-            LOGERR (klogErr, rc, "system I/O error - likely broken pipe");
-            return rc;
-
-        case EBADF:
-            rc = RC ( rcFS, rcFile, rcReading, rcFileDesc, rcInvalid );
-            PLOGERR (klogErr,
-                     (klogErr, rc, "system bad file descriptor error fd='$(E)'",
-                      "E=%d", self->fd));
-            return rc;
-
-        case EISDIR:
-            rc = RC ( rcFS, rcFile, rcReading, rcFileDesc, rcIncorrect );
-            LOGERR (klogErr, rc, "system misuse of a directory error");
-            return rc;
-
-        case EINVAL:
-            rc = RC ( rcFS, rcFile, rcReading, rcParam, rcInvalid );
-            LOGERR (klogErr, rc, "system invalid argument error");
-            return rc;
-
-        default:
-            rc = RC ( rcFS, rcFile, rcReading, rcNoObj, rcUnknown );
-            PLOGERR (klogErr,
-                     (klogErr, rc, "unknown system error '$(S)($(E))'",
-                      "S=%!,E=%d", lerrno, lerrno));
-            return rc;
-        }
-
-        assert ( num_read != NULL );
-        * num_read = count;
-        break;
-    }
-
-    return 0;
-}
-
-/* Write
- *  write file at known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ IN ] and "size" [ IN ] - data to be written
- *
- *  "num_writ" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually written
- */
-static
-rc_t KSysFileWrite ( KSysFile *self, uint64_t pos,
-    const void *buffer, size_t size, size_t *num_writ)
-{
-    assert ( self != NULL );
-    while ( 1 )
-    {
-        rc_t rc;
-        int lerrno;
-        ssize_t count;
-
-#if USE_TIMEOUT
-        rc = KSysFileSelect (self, select_write | select_exception);
-        if (rc)
-            return rc;
-#endif
-
-        count = pwrite ( self -> fd, buffer, size, pos );
-
-        if ( count < 0 ) switch ( lerrno = errno )
-        {
-        case ENOSPC:
-            rc = RC ( rcFS, rcFile, rcWriting, rcStorage, rcExhausted );
-            PLOGERR (klogErr,
-                     (klogErr, rc, "system bad file descriptor error fd='$(E)'",
-                      "E=%d", self->fd));
-            return rc;
-
-        case EINTR:
-            continue;
-
-        case EFBIG:
-            rc = RC ( rcFS, rcFile, rcWriting, rcFile, rcExcessive );
-            LOGERR (klogErr, rc, "system file too large error");
-            return rc;
-
-        case EIO:
-            rc = RC ( rcFS, rcFile, rcWriting, rcTransfer, rcUnknown );
-            LOGERR (klogErr, rc, "system I/O error");
-            return rc;
-
-        case EBADF:
-            rc = RC ( rcFS, rcFile, rcWriting, rcFileDesc, rcInvalid );
-            PLOGERR (klogErr,
-                     (klogErr, rc, "system bad file descriptor error fd='$(E)'",
-                      "E=%d", self->fd));
-            return rc;
-
-        case EISDIR:
-            rc = RC ( rcFS, rcFile, rcWriting, rcFileDesc, rcIncorrect );
-            LOGERR (klogErr, rc, "system misuse of a directory error");
-            return rc;
-
-        case EINVAL:
-            rc = RC ( rcFS, rcFile, rcWriting, rcParam, rcInvalid );
-            LOGERR (klogErr, rc, "system invalid argument error");
-            return rc;
-
-        default:
-            rc = RC ( rcFS, rcFile, rcWriting, rcNoObj, rcUnknown );
-            PLOGERR (klogErr,
-                     (klogErr, rc, "unknown system error errno='$(S)($(E))'",
-                      "S=%!,E=%d", lerrno, lerrno));
-            return rc;
-        }
-
-        assert ( num_writ != NULL );
-        * num_writ = count;
-        break;
-    }
-
-    return 0;
-}
-
-
-/* Make
- *  create a new file object
- *  from file descriptor
- */
-static KFile_vt_v1 vtKSysFile =
-{
-    /* version 1.1 */
-    1, 1,
-
-    /* start minor version 0 methods */
-    KSysFileDestroy,
-    KSysFileGetSysFile,
-    KSysFileRandomAccess,
-    KSysFileSize,
-    KSysFileSetSize,
-    KSysFileRead,
-    KSysFileWrite,
-    /* end minor version 0 methods */
-
-    /* start minor version == 1 */
-    KSysFileType
-    /* end minor version == 1 */
-};
-
-static
-rc_t KSysFileMakeVT ( KSysFile **fp, int fd, const KFile_vt *vt,
-    const char *path, bool read_enabled, bool write_enabled )
-{
-    rc_t rc;
-    KSysFile *f;
-
-    if ( fd < 0 )
-    {
-        rc = RC ( rcFS, rcFile, rcConstructing, rcFileDesc, rcInvalid );
-        PLOGERR (klogInt,
-                 (klogInt, rc, "invalid file descriptor $(F)",
-                  "F=%d", fd));
-        return rc;
-    }
-
-    f = calloc ( sizeof * f, 1 );
-    if ( f == NULL )
-    {
-        rc = RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-        LOGERR (klogErr, rc, "out of memory");
-        return rc;
-    }
-    else
-    {
-#if USE_TIMEOUT
-        if (KSysFileTimeout >= 0)
-        {
-            f->to.tv_sec = KSysFileTimeout / 1000;
-            f->to.tv_usec = (KSysFileTimeout % 1000) * 1000;
-            f->use_to = true;
-            FD_ZERO (&f->fds);
-            FD_SET (fd, &f->fds);
-        }
-#endif
-
-        rc = KFileInit ( & f -> dad, vt, "KSysFile", path, read_enabled, write_enabled );
-        if ( rc == 0 )
-        {
-            f -> fd = fd;
-            * fp = f;
-            return 0;
-        }
-
-        free ( f );
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KSysFileMake ( KSysFile **fp, int fd, const char *path, bool read_enabled, bool write_enabled )
-{
-    return KSysFileMakeVT ( fp, fd, ( const KFile_vt* ) & vtKSysFile,
-        path, read_enabled, write_enabled );
-}
-
-/*--------------------------------------------------------------------------
- * KFile
- *  Unix-specific standard i/o interfaces
- */
-
-typedef struct KStdIOFile KStdIOFile;
-struct KStdIOFile
-{
-    KSysFile dad;
-    uint64_t pos;
-};
-
-
-/* Destroy
- *  does not close fd
- */
-static
-rc_t KStdIOFileDestroy ( KSysFile *self )
-{
-    free ( self );
-    return 0;
-}
-
-static KFile_vt_v1 vtKStdIOFile =
-{
-    /* version 1.1 */
-    1, 1,
-
-    /* start minor version 0 methods */
-    KStdIOFileDestroy,
-    KSysFileGetSysFile,
-    KSysFileRandomAccess,
-    KSysFileSize,
-    KSysFileSetSize,
-    KSysFileRead,
-    KSysFileWrite,
-    /* end minor version 0 methods */
-
-    /* start minor version == 1 */
-    KSysFileType
-    /* end minor version == 1 */
-};
-
-/* RandomAccess
- */
-static
-rc_t KStdIOFileRandomAccess ( const KSysFile *self )
-{
-/*     return RC ( rcFS, rcFile, rcAccessing, rcFileDesc, rcIncorrect ); */
-    return RC ( rcFS, rcFile, rcAccessing, rcFunction, rcUnsupported );
-}
-
-
-/* Size
- */
-static
-rc_t KStdIOFileSize ( const KSysFile *self, uint64_t *size )
-{
-    * size = 0;
-
-/*     return RC ( rcFS, rcFile, rcAccessing, rcFileDesc, rcIncorrect ); */
-    return RC ( rcFS, rcFile, rcAccessing, rcFunction, rcUnsupported );
-}
-
-/* SetSize
- */
-static
-rc_t KStdIOFileSetSize ( KSysFile *self, uint64_t size )
-{
-/*     return RC ( rcFS, rcFile, rcUpdating, rcFileDesc, rcIncorrect ); */
-    return RC ( rcFS, rcFile, rcAccessing, rcFunction, rcUnsupported );
-}
-
-/* Read
- *  read file from known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually read
- */
-static
-rc_t KStdIOFileRead ( const KSysFile *dad, uint64_t pos,
-    void *buffer, size_t bsize, size_t *num_read )
-{
-    rc_t rc;
-
-    KStdIOFile *self = ( KStdIOFile* ) dad;
-    assert ( self != NULL );
-
-    if ( self -> pos != pos )
-    {
-        rc = RC ( rcFS, rcFile, rcReading, rcParam, rcInvalid );
-        PLOGERR (klogErr,
-                 (klogErr, rc, "Bad position for STDIO read $(P) instead of $(O)",
-                  "P=%lu,O=%lu", pos, self->pos));
-        return rc;
-    }
-
-    while ( 1 )
-    {
-        ssize_t count;
-        int lerrno;
-
-#if USE_TIMEOUT
-        rc = KSysFileSelect (&self->dad, select_read | select_exception);
-        if (rc)
-            return rc;
-#endif
-
-        count = read ( self -> dad . fd, buffer, bsize );
-
-        if ( count < 0 ) switch ( lerrno = errno )
-        {
-        case EINTR:
-            continue;
-
-        case EIO:
-            rc = RC ( rcFS, rcFile, rcReading, rcTransfer, rcUnknown );
-            LOGERR (klogErr, rc, "system I/O error - broken pipe");
-            return rc;
-
-        case EBADF:
-            rc = RC ( rcFS, rcFile, rcReading, rcFileDesc, rcInvalid );
-            PLOGERR (klogInt,
-                     (klogInt, rc, "system bad file descriptor fd='$(E)'",
-                      "E=%d", self->dad.fd));
-            return rc;
-
-        case EISDIR:
-            rc = RC ( rcFS, rcFile, rcReading, rcFileDesc, rcIncorrect );
-            LOGERR (klogInt, rc, "system misuse of a directory error");
-            return rc;
-
-        case EINVAL:
-            rc = RC ( rcFS, rcFile, rcReading, rcParam, rcInvalid );
-            LOGERR (klogErr, rc, "system invalid argument error");
-            return rc;
-
-        default:
-            rc = RC ( rcFS, rcFile, rcReading, rcNoObj, rcUnknown );
-            PLOGERR (klogErr,
-                     (klogErr, rc, "unknown system error '$(S)($(E))'",
-                      "S=%!,E=%d", lerrno, lerrno));
-            return rc;
-        }
-
-        assert ( num_read != NULL );
-        * num_read = count;
-        self -> pos += count;
-        break;
-    }
-
-    return 0;
-}
-
-/* Write
- *  write file at known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ IN ] and "size" [ IN ] - data to be written
- *
- *  "num_writ" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually written
- */
-static
-rc_t KStdIOFileWrite ( KSysFile *dad, uint64_t pos,
-    const void *buffer, size_t size, size_t *num_writ)
-{
-    rc_t rc;
-    KStdIOFile *self = ( KStdIOFile* ) dad;
-    assert ( self != NULL );
-
-    if ( self -> pos != pos )
-    {
-        rc = RC ( rcFS, rcFile, rcWriting, rcParam, rcInvalid );
-        PLOGERR (klogErr,
-                 (klogErr, rc, "Bad position for STDIO write $(P) instead of $(O)",
-                  "P=%lu,O=%lu", pos, self->pos));
-        return rc;
-    }
-
-    while ( 1 )
-    {
-        int lerrno;
-        ssize_t count;
-
-#if USE_TIMEOUT
-        rc = KSysFileSelect (&self->dad, select_read | select_exception);
-        if (rc)
-            return rc;
-#endif
-
-        count = write ( self -> dad . fd, buffer, size );
-
-        if ( count < 0 ) switch ( lerrno = errno )
-        {
-        case ENOSPC:
-            rc = RC ( rcFS, rcFile, rcWriting, rcStorage, rcExhausted );
-            LOGERR (klogErr, rc, "system device full error");
-            return rc;
-
-        case EINTR:
-            continue;
-
-        case EFBIG:
-            rc = RC ( rcFS, rcFile, rcWriting, rcFile, rcExcessive );
-            LOGERR (klogErr, rc, "system file too big error");
-            return rc;
-
-        case EIO:
-            rc = RC ( rcFS, rcFile, rcWriting, rcTransfer, rcUnknown );
-            LOGERR (klogErr, rc, "system I/O error - broken pipe");
-            return rc;
-            
-        case EBADF:
-            rc = RC ( rcFS, rcFile, rcWriting, rcFileDesc, rcInvalid );
-            PLOGERR (klogInt,
-                     (klogInt, rc, "system bad file descriptor error fd=$(F)",
-                      "F=%d", lerrno, self->dad.fd));
-            return rc;
-
-        case EINVAL:
-            rc = RC ( rcFS, rcFile, rcWriting, rcParam, rcInvalid );
-            LOGERR (klogInt, rc, "system invalid argument error");
-            return rc;
-
-        default:
-            rc = RC ( rcFS, rcFile, rcWriting, rcNoObj, rcUnknown );
-            PLOGERR (klogErr,
-                     (klogErr, rc, "unknown system error '$(S)($(E))'",
-                      "S=%!,E=%d", lerrno, lerrno));
-            return rc;
-        }
-
-        assert ( num_writ != NULL );
-        * num_writ = count;
-        self -> pos += count;
-        break;
-    }
-
-    return 0;
-}
-
-static KFile_vt_v1 vtKStdIOStream =
-{
-    /* version 1.1 */
-    1, 1,
-
-    /* start minor version 0 methods */
-    KStdIOFileDestroy,
-    KSysFileGetSysFile,
-    KStdIOFileRandomAccess,
-    KStdIOFileSize,
-    KStdIOFileSetSize,
-    KStdIOFileRead,
-    KStdIOFileWrite,
-    /* end minor version 0 methods */
-
-    /* start minor version == 1 */
-    KSysFileType
-    /* end minor version == 1 */
-};
-
-static
-rc_t KStdIOFileTest ( KFile **rp, int fd, bool *seekable, bool *readable, bool *writable )
-{
-    struct stat st;
-    int lerrno;
-    rc_t rc = 0;
-
-    if ( rp == NULL )
-        return RC ( rcFS, rcFile, rcCreating, rcParam, rcNull );
-
-    * rp = NULL;
-
-    if ( fstat ( fd, & st ) == 0 )
-    {
-        int fl;
-
-        if ( S_ISREG ( st . st_mode ) )
-            * seekable = true;
-        else
-            * seekable = false;
-
-        fl = fcntl ( fd, F_GETFL ) & O_ACCMODE;
-        switch (fl)
-        {
-        case O_RDONLY:
-            *readable = true;
-            *writable = false;
-            break;
-        case O_WRONLY:
-            *readable = false;
-            *writable = true;
-            break;
-        case O_RDWR:
-            *readable = true;
-            *writable = true;
-            break;
-        }
-    }
-    else switch (lerrno = errno)
-    {
-    case EBADF:
-        rc = RC ( rcFS, rcFile, rcCreating, rcFileDesc, rcInvalid );
-        PLOGERR (klogErr,
-                 (klogErr, rc, "system error bad file descriptor '$(F)'",
-                  "F=%d", fd));
-        break;
-    default:
-        rc = RC ( rcFS, rcFile, rcCreating, rcNoObj, rcUnknown );
-        PLOGERR (klogErr,
-                 (klogErr, rc, "unknown system error '$(F) ($(E))'",
-                  "F=%!,E=%d", lerrno, lerrno));
-        break;
-    }
-
-    return rc;
-}
-
-static
-rc_t KStdIOFileMake ( KFile **fp, int fd,
-    bool seekable, bool read_enabled, bool write_enabled )
-{
-    rc_t rc;
-    KStdIOFile *f;
-
-    if ( seekable )
-    {
-        return KSysFileMakeVT ( ( KSysFile** ) fp, fd,
-            ( const KFile_vt* ) & vtKStdIOFile, "stdio-file", read_enabled, write_enabled );
-    }
-
-    if ( fd < 0 )
-    {
-        rc = RC ( rcFS, rcFile, rcConstructing, rcFileDesc, rcInvalid );
-        PLOGERR (klogInt,
-                 (klogInt, rc, "invalid file descriptor $(F)",
-                  "F=%d", fd));
-        return rc;
-    }
-    else
-    {
-        f = calloc ( sizeof *f, 1 );
-        if ( f == NULL )
-        {
-            rc = RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-            LOGERR (klogErr, rc, "out of memory");
-        }
-        else
-        {
-#if USE_TIMEOUT
-            if ((KSysFileTimeout >= 0)
-#if USE_NO_TIMEOUT_TTY
-                && (! isatty (fd)
-#endif
-                    )
-            {
-                KSysFile * ff = &f->dad;
-
-                ff->to.tv_sec = KSysFileTimeout / 1000;
-                ff->to.tv_usec = (KSysFileTimeout % 1000) * 1000;
-                ff->use_to = true;
-                FD_ZERO (&ff->fds);
-                FD_SET (fd, &ff->fds);
-            }
-#endif
-            rc = KFileInit ( &f->dad.dad, (const KFile_vt*) &vtKStdIOStream,
-                             "KStdIOFile", "fd", read_enabled, write_enabled );
-            if ( rc == 0 )
-            {
-                f -> dad . fd = fd;
-                f -> pos = 0;
-                * fp = & f -> dad . dad;
-                return 0;
-            }
-
-            free ( f );
-        }
-    }
-    return rc;
-}
-
-/* MakeStdIn
- *  creates a read-only file on stdin
- */
-LIB_EXPORT rc_t CC KFileMakeStdIn ( const KFile **std_in )
-{
-    bool seekable;
-    bool readable;
-    bool writable;
-    rc_t rc = KStdIOFileTest ( ( KFile** ) std_in, 0, & seekable, & readable, & writable );
-    if ( rc != 0 )
-        return rc;
-    if ( ! readable )
-        return RC ( rcFS, rcFile, rcConstructing, rcFileDesc, rcWriteonly );
-
-    return KStdIOFileMake ( ( KFile** ) std_in, 0, seekable, true, false );
-}
-
-/* MakeStdOut
- * MakeStdErr
- *  creates a write-only file on stdout or stderr
- */
-LIB_EXPORT rc_t CC KFileMakeStdOut ( KFile **std_out )
-{
-    bool seekable;
-    bool readable;
-    bool writable;
-    rc_t rc = KStdIOFileTest ( std_out, 1, & seekable, & readable, & writable );
-    if ( rc != 0 )
-        return rc;
-    if ( ! writable )
-        return RC ( rcFS, rcFile, rcConstructing, rcFileDesc, rcReadonly );
-
-    return KStdIOFileMake ( std_out, 1, seekable, false, true );
-}
-
-LIB_EXPORT rc_t CC KFileMakeStdErr ( KFile **std_err )
-{
-    bool seekable;
-    bool readable;
-    bool writable;
-    rc_t rc = KStdIOFileTest ( std_err, 2, & seekable, & readable, & writable );
-    if ( rc != 0 )
-        return rc;
-    if ( ! writable )
-        return RC ( rcFS, rcFile, rcConstructing, rcFileDesc, rcReadonly );
-
-    return KStdIOFileMake ( std_err, 2, seekable, false, true );
-}
-
-/* MakeFDFile
- *  creates a file from a file-descriptor
- *  not supported under Windows
- */
-LIB_EXPORT rc_t CC KFileMakeFDFileRead ( const KFile **f, int fd )
-{
-    bool seekable;
-    bool readable;
-    bool writable;
-    rc_t rc = KStdIOFileTest ( ( KFile** ) f, fd, & seekable, & readable, & writable );
-    if ( rc != 0 )
-        return rc;
-    if ( ! readable )
-    {
-        rc = RC ( rcFS, rcFile, rcConstructing, rcFileDesc, rcWriteonly );
-        LOGERR (klogErr, rc, "error constructing read file from write only file descriptor");
-        return rc;
-    }
-    return KStdIOFileMake ( ( KFile** ) f, fd, seekable, true, false );
-}
-
-LIB_EXPORT rc_t CC KFileMakeFDFileWrite ( KFile **f, bool update, int fd )
-{
-    bool seekable;
-    bool readable;
-    bool writable;
-    rc_t rc = KStdIOFileTest ( f, fd, & seekable, & readable, & writable );
-    if ( rc != 0 )
-        return rc;
-    if ( update && ! readable )
-        return RC ( rcFS, rcFile, rcConstructing, rcFileDesc, rcWriteonly );
-    if ( ! writable )
-        return RC ( rcFS, rcFile, rcConstructing, rcFileDesc, rcReadonly );
-
-    return KStdIOFileMake ( f, fd, seekable, update, true );
-}
diff --git a/libs/kfs/unix/syslockfile.c b/libs/kfs/unix/syslockfile.c
deleted file mode 100644
index 57aaa4c..0000000
--- a/libs/kfs/unix/syslockfile.c
+++ /dev/null
@@ -1,215 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-typedef struct KExclAccessFile KExclAccessFile;
-#define KFILE_IMPL KExclAccessFile
-
-#include <kfs/extern.h>
-#include <kfs/lockfile.h>
-#include <kfs/impl.h>
-#include <kfs/file.h>
-#include <kfs/directory.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <assert.h>
-
-/*--------------------------------------------------------------------------
- * KExclAccessFile
- */
-struct KExclAccessFile
-{
-    KFile dad;
-    KLockFile *lock;
-    KFile *f;
-};
-
-static
-rc_t KExclAccessFileDestroy ( KExclAccessFile *self )
-{
-    rc_t rc = KFileRelease ( self -> f );
-    if ( rc == 0 )
-    {
-        KLockFileRelease ( self -> lock );
-        free ( self );
-    }
-    return rc;
-}
-
-static
-struct KSysFile *KExclAccessFileGetSysFile ( const KExclAccessFile *self, uint64_t *offset )
-{
-    return KFileGetSysFile ( self -> f, offset );
-}
-
-static
-rc_t KExclAccessFileRandomAccess ( const KExclAccessFile *self )
-{
-    return KFileRandomAccess ( self -> f );
-}
-
-static
-rc_t KExclAccessFileSize ( const KExclAccessFile *self, uint64_t *size )
-{
-    return KFileSize ( self -> f, size );
-}
-
-static
-rc_t KExclAccessFileSetSize ( KExclAccessFile *self, uint64_t size )
-{
-    return KFileSetSize ( self -> f, size );
-}
-
-static
-rc_t KExclAccessFileRead ( const KExclAccessFile *self, uint64_t pos,
-    void *buffer, size_t bsize, size_t *num_read )
-{
-    return KFileRead ( self -> f, pos, buffer, bsize, num_read );
-}
-
-static
-rc_t KExclAccessFileWrite ( KExclAccessFile *self, uint64_t pos,
-    const void *buffer, size_t size, size_t *num_writ )
-{
-    return KFileWrite ( self -> f, pos, buffer, size, num_writ );
-}
-
-static
-uint32_t KExclAccessFileType ( const KExclAccessFile * self )
-{
-    return KFileType ( self -> f );
-}
-
-static KFile_vt_v1 KExclAccessFile_vt =
-{
-    1, 1,
-
-    KExclAccessFileDestroy,
-    KExclAccessFileGetSysFile,
-    KExclAccessFileRandomAccess,
-    KExclAccessFileSize,
-    KExclAccessFileSetSize,
-    KExclAccessFileRead,
-    KExclAccessFileWrite,
-    KExclAccessFileType
-};
-
-static
-rc_t KExclAccessFileMake ( KExclAccessFile **fp, KLockFile *lock, KFile *f )
-{
-    rc_t rc;
-    KExclAccessFile *xf = malloc ( sizeof * xf );
-    if ( xf == NULL )
-        rc = RC ( rcFS, rcFile, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        rc = KFileInit ( & xf -> dad, ( const KFile_vt* ) & KExclAccessFile_vt,
-            "KExclAccessFile", "no-name", f -> read_enabled, f -> write_enabled );
-        if ( rc == 0 )
-        {
-            xf -> lock = lock;
-            xf -> f = f;
-            * fp = xf;
-            return 0;
-        }
-
-        free ( xf );
-    }
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * KDirectory
- *  interface extensions
- */
-
-
-/* CreateExclusiveAccessFile
- *  opens a file with exclusive write access
- *
- *  "fp" [ OUT ] - return parameter for newly opened file
- *
- *  "update" [ IN ] - if true, open in read/write mode
- *  otherwise, open in write-only mode
- *
- *  "access" [ IN ] - standard Unix access mode, e.g. 0664
- *
- *  "mode" [ IN ] - a creation mode ( see explanation above ).
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- */
-LIB_EXPORT rc_t CC KDirectoryVCreateExclusiveAccessFile ( KDirectory *self, KFile **fp,
-    bool update, uint32_t access, KCreateMode mode, const char *path, va_list args )
-{
-    rc_t rc;
-
-    if ( fp == NULL )
-        rc = RC ( rcFS, rcFile, rcLocking, rcParam, rcNull );
-    else
-    {
-        /* create the path */
-        char full [ 4096 ];
-        rc = KDirectoryVResolvePath ( self, true, full, sizeof full, path, args );
-        if ( rc == 0 )
-        {
-            KLockFile *lock;
-
-            /* acquire the lock */
-            rc = KDirectoryCreateLockFile ( self, & lock, "%s.lock", full );
-            if ( rc == 0 )
-            {
-                KFile *f;
-
-                /* create the file */
-                rc = KDirectoryCreateFile ( self, & f, update, access, mode, full );
-                if ( rc == 0 )
-                {
-                    KExclAccessFile *xf;
-
-                    /* wrap the file */
-                    rc = KExclAccessFileMake ( & xf, lock, f );
-                    if ( rc == 0 )
-                    {
-                        * fp = & xf -> dad;
-                        return 0;
-                    }
-
-                    KFileRelease ( f );
-                }
-
-                KLockFileRelease ( lock );
-            }
-        }
-
-        * fp = NULL;
-    }
-
-    return rc;
-}
diff --git a/libs/kfs/unix/sysmmap-priv.h b/libs/kfs/unix/sysmmap-priv.h
deleted file mode 100644
index 6740eb1..0000000
--- a/libs/kfs/unix/sysmmap-priv.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_sysmmap_priv_
-#define _h_sysmmap_priv_
-
-#ifndef _h_mmap_priv_
-#include "../mmap-priv.h"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KMMap
- *  a memory mapped region
- */
-struct KMMap
-{
-    uint64_t off;
-    uint64_t pos;
-    size_t size;
-    char *addr;
-
-    struct KFile *f;
-    size_t pg_size;
-
-    uint32_t addr_adj;
-    uint32_t size_adj;
-
-    KRefcount refcount;
-
-    bool read_only;
-    bool sys_mmap;
-    bool dirty;
-};
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_sysmmap_priv_ */
diff --git a/libs/kfs/unix/sysmmap.c b/libs/kfs/unix/sysmmap.c
deleted file mode 100644
index 21bb985..0000000
--- a/libs/kfs/unix/sysmmap.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include "sysmmap-priv.h"
-#include "sysfile-priv.h"
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <errno.h>
-
-
-/*--------------------------------------------------------------------------
- * KMMap
- *  a memory mapped region
- */
-
-/* Make
- */
-rc_t KMMapMake ( KMMap **mmp )
-{
-    KMMap *mm = calloc ( 1, sizeof * mm );
-    if ( mm == NULL )
-        return RC ( rcFS, rcMemMap, rcConstructing, rcMemory, rcExhausted );
-    
-    mm -> pg_size = sysconf ( _SC_PAGE_SIZE );
-
-    * mmp = mm;
-
-    return 0;
-}
-
-
-/* RWSys
- */
-rc_t KMMapRWSys ( KMMap *self, uint64_t pos, size_t size )
-{
-    KSysFile *sf = KFileGetSysFile ( self -> f, & self -> off );
-    if ( sf == NULL )
-        return RC ( rcFS, rcMemMap, rcConstructing, rcFile, rcIncorrect );
-
-    self -> addr = mmap ( 0, size,
-        PROT_READ | PROT_WRITE, MAP_SHARED, sf -> fd, pos );
-    if ( self -> addr != ( char* ) MAP_FAILED )
-        return 0;
-
-    switch ( errno )
-    {
-    case EBADF:
-        return RC ( rcFS, rcMemMap, rcConstructing, rcFileDesc, rcInvalid );
-    case EACCES:
-        return RC ( rcFS, rcMemMap, rcConstructing, rcFile, rcNoPerm );
-    case ETXTBSY:
-    case ENODEV:
-        return RC ( rcFS, rcMemMap, rcConstructing, rcFile, rcInvalid );
-    case EAGAIN:
-        return RC ( rcFS, rcMemMap, rcConstructing, rcFunction, rcIncomplete );
-    case ENOMEM:
-        return RC ( rcFS, rcMemMap, rcConstructing, rcMemory, rcExhausted );
-    }
-
-    return RC ( rcFS, rcMemMap, rcConstructing, rcNoObj, rcUnknown );
-}
-
-
-/* ROSys
- */
-rc_t KMMapROSys ( KMMap *self, uint64_t pos, size_t size )
-{
-    KSysFile *sf = KFileGetSysFile ( self -> f, & self -> off );
-    if ( sf == NULL )
-        return RC ( rcFS, rcMemMap, rcConstructing, rcFile, rcIncorrect );
-
-    self -> addr = mmap ( 0, size,
-        PROT_READ, MAP_SHARED, sf -> fd, pos );
-    if ( self -> addr != ( char* ) MAP_FAILED )
-        return 0;
-
-    switch ( errno )
-    {
-    case EBADF:
-        return RC ( rcFS, rcMemMap, rcConstructing, rcFileDesc, rcInvalid );
-    case EACCES:
-        return RC ( rcFS, rcMemMap, rcConstructing, rcFile, rcNoPerm );
-    case ETXTBSY:
-    case ENODEV:
-        return RC ( rcFS, rcMemMap, rcConstructing, rcFile, rcInvalid );
-    case EAGAIN:
-        return RC ( rcFS, rcMemMap, rcConstructing, rcFunction, rcIncomplete );
-    case ENOMEM:
-        return RC ( rcFS, rcMemMap, rcConstructing, rcMemory, rcExhausted );
-    }
-
-    return RC ( rcFS, rcMemMap, rcConstructing, rcNoObj, rcUnknown );
-}
-
-
-/* Unmap
- *  removes a memory map
- */
-rc_t KMMapUnmap ( KMMap *self )
-{
-    if ( self -> size != 0 )
-    {
-        if ( munmap ( self -> addr - self -> addr_adj,
-                 self -> size + self -> size_adj ) )
-        {
-            if ( errno != EINVAL )
-                return RC ( rcFS, rcMemMap, rcDestroying, rcNoObj, rcUnknown );
-        }
-
-        self -> addr = NULL;
-        self -> size = 0;
-    }
-
-    return 0;
-}
diff --git a/libs/kfs/win/lnk_tools.c b/libs/kfs/win/lnk_tools.c
deleted file mode 100644
index 82a565f..0000000
--- a/libs/kfs/win/lnk_tools.c
+++ /dev/null
@@ -1,518 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <sysalloc.h>
-
-#include <Shlobj.h>
-
-#define LNK_RES_ERROR 0
-#define LNK_RES_FILE 1
-#define LNK_RES_DIR 2
-
-#define LNK_FLAG_HasLinkTargetIDList 0x1
-#define LNK_FLAG_HasLinkInfo 0x2
-#define LNK_FLAG_HasName 0x4
-#define LNK_FLAG_HasRelativePath 0x8
-#define LNK_FLAG_HasWorkingDir 0x10
-#define LNK_FLAG_HasArguments 0x20
-#define LNK_FLAG_HasIconLocation 0x40
-#define LNK_FLAG_IsUniCode 0x80
-#define LNK_FLAG_ForceNoLinkInfo 0x100
-#define LNK_FLAG_HasExpString 0x200
-#define LNK_FLAG_RunInSeparateProcess 0x400
-#define LNK_FLAG_Unused1 0x800
-#define LNK_FLAG_HasDarwinID 0x1000
-#define LNK_FLAG_RunAsUser 0x2000
-#define LNK_FLAG_HasExpIcon 0x4000
-#define LNK_FLAG_NoPidIAlias 0x8000
-#define LNK_FLAG_Unused2 0x10000
-#define LNK_FLAG_RunWithShimLayer 0x20000
-#define LNK_FLAG_ForceNoLinkTrack 0x40000
-#define LNK_FLAG_EnableTargetMatdata 0x80000
-#define LNK_FLAG_DisableLinkPathTracking 0x100000
-#define LNK_FLAG_DisableKnowFolderTracking 0x200000
-#define LNK_FLAG_DisableKnowFolderAlias 0x400000
-#define LNK_FLAG_AllowLinkToLink 0x800000
-#define LNK_FLAG_UnaliasOnSave 0x1000000
-
-
-#define LNK_ATTR_FILE_ATTRIBUTE_READONLY 0x1
-#define LNK_ATTR_FILE_ATTRIBUTE_HIDDEN 0x2
-#define LNK_ATTR_FILE_ATTRIBUTE_SYSTEM 0x4
-#define LNK_ATTR_Reserved1 0x8
-#define LNK_ATTR_FILE_ATTRIBUTE_DIRECTORY 0x10
-#define LNK_ATTR_FILE_ATTRIBUTE_ARCHIVE 0x20
-#define LNK_ATTR_Reserved2 0x40
-#define LNK_ATTR_FILE_ATTRIBUTE_NORMAL 0x80
-#define LNK_ATTR_FILE_ATTRIBUTE_TEMPORARY 0x100
-#define LNK_ATTR_FILE_ATTRIBUTE_SPARSE_FILE 0x200
-#define LNK_ATTR_FILE_ATTRIBUTE_REPARSE_POINT 0x400
-#define LNK_ATTR_FILE_ATTRIBUTE_COMPRESSED 0x800
-#define LNK_ATTR_FILE_ATTRIBUTE_OFFLINE 0x1000
-#define LNK_ATTR_FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x2000
-#define LNK_ATTR_FILE_ATTRIBUTE_ENCRYPTED 0x4000
-
-/* the first 20 "magic" bytes of a MS-lnk-file
-   ( 4 bytes header-size and 16 bytes LinkCLSID ) */
-const unsigned char lnk_ref[ 20 ] =
-{
-    0x4C, 0x00, 0x00, 0x00, 0x01, 0x14, 0x02, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x46
-};
-
-
-static bool has_lnk_extension( const wchar_t *path )
-{
-    size_t len = wcslen( path );
-
-    if ( len < 5 ) return false;
-    if ( path[ len - 4 ] != '.' ) return false;
-    if ( path[ len - 3 ] != 'l' && path[ len - 3 ] != 'L' ) return false;
-    if ( path[ len - 2 ] != 'n' && path[ len - 2 ] == 'N' ) return false;
-    if ( path[ len - 1 ] != 'k' && path[ len - 1 ] == 'K' ) return false;
-    return true;
-}
-
-
-static bool add_lnk_extension( wchar_t *path, const size_t path_size )
-{
-    size_t len = wcslen( path );
-    if ( len + 5 >= path_size )
-        return false;
-    path[ len + 0 ] = '.';
-    path[ len + 1 ] = 'l';
-    path[ len + 2 ] = 'n';
-    path[ len + 3 ] = 'k';
-    path[ len + 5 ] = 0;
-    return true;
-}
-
-
-static HANDLE lnk_file_open( const wchar_t *path, DWORD * filesize )
-{
-    HANDLE hfile = CreateFileW( path,           // file to open
-                         GENERIC_READ,          // open for reading
-                         FILE_SHARE_READ,       // share for reading
-                         NULL,                  // default security
-                         OPEN_EXISTING,         // existing file only
-                         FILE_ATTRIBUTE_NORMAL, // normal file
-                         NULL );                // no attr. template
-    if ( hfile != INVALID_HANDLE_VALUE )
-    {
-        if ( filesize != NULL )
-            *filesize = GetFileSize( hfile, NULL );
-    }
-    return hfile;
-}
-
-
-static bool lnk_file_exists( const wchar_t *path )
-{
-    HANDLE hFile = lnk_file_open( path, NULL );
-    if ( hFile != INVALID_HANDLE_VALUE )
-    {
-        CloseHandle( hFile );
-        return true;
-    }
-    else
-        return false;
-} 
-
-
-static unsigned char * lnk_file_read( HANDLE hfile, const size_t n_bytes, DWORD * read )
-{
-    unsigned char * res;
-
-    if ( read != NULL ) *read = 0;
-    res = (unsigned char *)malloc( n_bytes );
-    if ( res != NULL )
-    {
-        DWORD dwBytesRead;
-        if ( FALSE == ReadFile( hfile, res, ( DWORD ) n_bytes, &dwBytesRead, NULL ) )
-        {
-            free( res );
-            res = NULL;
-        }
-        else
-        {
-            if ( read != NULL )
-                *read = dwBytesRead;
-        }
-    }
-    return res;
-}
-
-
-static DWORD lnk_file_get_DWORD( const unsigned char * buffer, const int idx )
-{
-    DWORD res = 0;
-    memcpy( &res, &(buffer[ idx ]), sizeof( res ) );
-    return res;
-}
-
-static WORD lnk_file_get_WORD( const unsigned char * buffer, const int idx )
-{
-    WORD res = 0;
-    memcpy( &res, &(buffer[ idx ]), sizeof( res ) );
-    return res;
-}
-
-
-static bool lnk_file_validate_buffer( const unsigned char * buffer, const size_t buffsize )
-{
-    bool res = ( buffsize >= sizeof lnk_ref );
-    if ( res )
-        res = ( 0 == memcmp ( buffer, lnk_ref, sizeof lnk_ref ) );
-    return res;
-}
-
-
-/* the path is given in windows-native notation and wide-char */
-static bool lnk_file_validate( const wchar_t *path )
-{
-    HANDLE hfile;
-    bool res;
-
-    hfile = lnk_file_open( path, NULL );
-    res = ( hfile != INVALID_HANDLE_VALUE );
-    if ( res )
-    {
-        DWORD dwBytesRead;
-        unsigned char * buffer = lnk_file_read( hfile, 32, &dwBytesRead );
-        CloseHandle( hfile );
-        res = ( buffer != NULL );
-        if ( res )
-        {
-            res = lnk_file_validate_buffer( buffer, dwBytesRead );
-            free( buffer );
-        }
-    }
-    return res;
-}
-
-/*  resolves a lnk file, after it's content was loaded into a buffer
-    buffer   ...    IN  points to the file-content
-    buffsize ...    IN  also the size of the lnk-file
-    resolved ...    OUT resolved path as wchar_t in windows-native form
-
-    return-value    0 ... resolving failed
-                    1 ... resolved path is a file
-                    2 ... resolved path is a directory
-*/
-static int lnk_file_resolve_buffer( const unsigned char * buffer, const size_t buffsize,
-                                    wchar_t ** resolved )
-{
-    char * base_path = NULL;
-    int res = LNK_RES_ERROR;
-    if ( lnk_file_validate_buffer( buffer, buffsize ) )
-    {
-        int idx = 0x4C;
-        DWORD flags = lnk_file_get_DWORD( buffer, 0x14 );
-        DWORD attr  = lnk_file_get_DWORD( buffer, 0x18 );
-
-        /* we have to handle the TargetIDList even if it is of no relevance
-        to resolving the link, just to get the correct index for the next
-        section */
-        if ( flags & LNK_FLAG_HasLinkTargetIDList )
-            idx += ( lnk_file_get_WORD( buffer, idx ) + 2 );
-        if ( flags & LNK_FLAG_HasLinkInfo )
-        {
-            DWORD base_path_ofs = lnk_file_get_DWORD( buffer, idx + 16 );
-            if ( base_path_ofs > 0 )
-            {
-                const char * src = (const char *)&( buffer[ idx + base_path_ofs ]);
-                if ( *src != 0 )
-                {
-                    size_t required;
-                    errno_t e = mbstowcs_s( &required, NULL, 0, src, 0 );
-                    if ( required > 0 )
-                    {
-                        *resolved = (wchar_t *) malloc( ( required + 1 ) * 2 );
-                        if ( *resolved )
-                        {
-                            size_t converted;
-                            mbstowcs_s( &converted, *resolved, required + 1, src, required + 1 );
-                            if ( attr & LNK_ATTR_FILE_ATTRIBUTE_DIRECTORY )
-                                res = LNK_RES_DIR;
-                            else
-                                res = LNK_RES_FILE;
-                        }
-                    }
-                }
-            }
-        }
-    }
-    return res;
-}
-
-
-/* translate a given lnk-file (full path) 'c:\somewhere\alink.lnk' 
-   into the path the lnk-file contains: 
-   'c:\somewhere\subpath\file.txt'
-   or 
-   'c:\anotherpath\sub\sub\file.txt' 
-   */
-static int lnk_file_resolve( const wchar_t *lnk_file, wchar_t ** resolved )
-{
-    HANDLE hfile;
-    DWORD dwFileSize;
-    int res = LNK_RES_ERROR;
-
-    if ( resolved != NULL )
-    {
-        *resolved = NULL;
-        hfile = lnk_file_open( lnk_file, &dwFileSize );
-        if ( hfile != INVALID_HANDLE_VALUE )
-        {
-            unsigned char * buffer = lnk_file_read( hfile, (size_t)dwFileSize, NULL );
-            if ( buffer != NULL )
-            {
-                res = lnk_file_resolve_buffer( buffer, dwFileSize, resolved );
-                free( buffer );
-            }
-        }
-    }
-    return res;
-}
-
-
-static bool win_path_exists( const wchar_t * path )
-{
-    bool res = false;
-    if ( path != NULL )
-    {
-        HANDLE hfile = CreateFileW( path, 
-                                0, /* do not ask for RD or WR, that prevents access-denied-err */
-                                FILE_SHARE_READ, /* needed to get a handle to obj's that are shared */
-                                NULL,
-                                OPEN_EXISTING,
-                                FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS,
-                                NULL );
-        if ( hfile != INVALID_HANDLE_VALUE )
-        {
-            res = true;
-            CloseHandle( hfile );
-        }
-#if _DEBUGGING
-        else
-        {
-            DWORD status = GetLastError ();
-            switch ( status )
-            {
-            case ERROR_FILE_NOT_FOUND:
-            case ERROR_PATH_NOT_FOUND:
-                break;
-            default:
-                DBGMSG ( DBG_KFS, DBG_FLAG_ANY, ( "win_path_exists: WARNING - unrecognized error code - %u.", status ) );
-            }
-        }
-#endif
-    }
-    return res;
-}
-
-static
-wchar_t * less_brain_dead_wcsdup ( const wchar_t * path )
-{
-    if ( path != NULL )
-    {
-        size_t len = wcslen ( path ) + 3;
-        wchar_t *cpy = malloc ( len * sizeof * cpy );
-        if ( cpy != NULL )
-            return wcscpy ( cpy, path );
-    }
-    return NULL;
-}
-
-static size_t win_existing_path( const wchar_t *path )
-{
-    size_t res = 0;
-    wchar_t * temp = less_brain_dead_wcsdup( path );
-    if ( temp != NULL )
-    {
-        wchar_t * part = wcsrchr( temp, L'\\' );
-        while ( part != NULL && res == 0 )
-        {
-            *part = 0;
-            if ( win_path_exists( temp ) )
-                res = ( part - temp );
-            else
-                part = wcsrchr( temp, L'\\' );
-        }
-        free( temp );
-    }
-    return res;
-}
-
-
-static wchar_t * win_assemble_lnk( const wchar_t *path, const size_t exists, size_t * remaining )
-{
-    wchar_t * res = NULL;
-    if ( path != NULL && remaining != NULL )
-    {
-        size_t path_len, buff_len;
-
-        *remaining = 0;
-        path_len = wcslen( path );
-        #define ExtraChars 5
-        buff_len = ( path_len + ExtraChars ) * sizeof( * path );
-        res = (wchar_t *)malloc( buff_len );
-        if ( res != NULL )
-        {
-            size_t term;
-            const wchar_t * from = ( path + exists + 1 );
-            const wchar_t * next_bs = wcschr( from, L'\\' );
-            if ( next_bs == NULL )
-                term = path_len;
-            else
-            {
-                term = ( next_bs - path );
-                *remaining = term;
-            }
-            /* if the string to be copied does not fit into the buffer 
-               wcsncpy_s will terminate the application instead of returning
-               an error !!! */
-            wcsncpy_s( res, path_len + ExtraChars, path, term ); /* 2nd argument is in elements, not bytes */
-            res[ term + 0 ] = L'.';
-            res[ term + 1 ] = L'l';
-            res[ term + 2 ] = L'n';
-            res[ term + 3 ] = L'k';
-            res[ term + 4 ] = 0;
-        }
-        #undef ExtraChars
-    }
-    return res;
-}
-
-
-static wchar_t * win_assemble_path( const wchar_t *part1, const wchar_t *part2 )
-{
-    wchar_t *res = NULL;
-    if ( part1 != NULL && part2 != NULL )
-    {
-        size_t len1 = wcslen( part1 );
-        size_t len2 = wcslen( part2 );
-        res = (wchar_t *)malloc( ( len1 + len2 + 1 ) * sizeof( * part1 ) );
-        if ( res != NULL )
-        {
-            /* if the string to be copied does not fit into the buffer 
-               wcsncpy_s will terminate the application instead of returning
-               an error !!! */
-            wcsncpy_s( res, len1+1, part1, len1 );
-            wcsncpy_s( res+len1, len2+1, part2, len2 );
-            res[ len1 + len2 ] = 0;
-        }
-    }
-    return res;
-}
-
-
-static bool win_resolve_path( const wchar_t *path, wchar_t ** resolved, const int depth )
-{
-    bool res = false;
-
-    if ( depth > 10 )
-        return res;
-    if ( resolved != NULL )
-    {
-        *resolved = NULL;
-        res = win_path_exists( path );
-        if ( res )
-            /* the given path exists, no need to resolve links... */
-            *resolved = less_brain_dead_wcsdup( path );
-        else
-        {
-            /* detect the part of the path that does exist
-            exists points at the backslash behind the existing path */
-            size_t exists = win_existing_path( path );
-            if ( exists > 0 )
-            {
-                size_t remaining;
-                wchar_t * possible_lnk = win_assemble_lnk( path, exists, &remaining );
-                if ( possible_lnk != NULL )
-                {
-                    wchar_t * lnk_resolved = NULL;
-                    int status = lnk_file_resolve( possible_lnk, &lnk_resolved );
-                    if ( status != LNK_RES_ERROR )
-                    {
-                        if ( remaining > 0 )
-                        {
-                            wchar_t * new_path = win_assemble_path( lnk_resolved, path + remaining );
-                            free( lnk_resolved );
-                            if ( new_path != NULL )
-                            {
-                                res = win_resolve_path( new_path, resolved, depth + 1 );
-                                free( new_path );
-                            }
-                        }
-                        else
-                        {
-                            *resolved = lnk_resolved;
-                            res = true;
-                        }
-                    }
-                    free( possible_lnk );
-                }
-            }
-        }
-    }
-    return res;
-}
-
-
-bool win_CreateLink( const wchar_t * target, const wchar_t * lnk_file, const wchar_t * desc )
-{ 
-    bool res = false;
-    HRESULT hres;
-    IShellLink * psl; 
-
-    // Get a pointer to the IShellLink interface. 
-    hres = CoCreateInstance( &CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, 
-                             &IID_IShellLink, (LPVOID*)&psl ); 
-    if ( SUCCEEDED( hres ) ) 
-    { 
-        IPersistFile* ppf; 
- 
-        // Set the path to the shortcut target and add the description. 
-        psl -> lpVtbl -> SetPath( psl, target );
-        if ( desc != NULL )
-            psl -> lpVtbl -> SetDescription( psl, desc ); 
- 
-        // Query IShellLink for the IPersistFile interface for saving the 
-        // shortcut in persistent storage. 
-        hres = psl -> lpVtbl -> QueryInterface( psl, &IID_IPersistFile, (LPVOID*)&ppf ); 
-        if ( SUCCEEDED( hres ) ) 
-        { 
-            // Save the link by calling IPersistFile::Save. 
-            hres = ppf -> lpVtbl -> Save( ppf, lnk_file, TRUE );
-            res = SUCCEEDED( hres );
-            ppf -> lpVtbl -> Release( ppf );
-        } 
-        psl -> lpVtbl -> Release( psl );
-    } 
-    return res; 
-}
diff --git a/libs/kfs/win/sysdir-priv.h b/libs/kfs/win/sysdir-priv.h
deleted file mode 100644
index 1ae8cc7..0000000
--- a/libs/kfs/win/sysdir-priv.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_sysdir_priv_
-#define _h_sysdir_priv_
-
-#ifndef _h_kfs_impl_
-#include <kfs/impl.h>
-#endif
-
-#ifndef _h_klib_rc_
-#include <klib/rc.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * KDirectory
- *  a Windows extension
- */
-
-
-/* MakeFromRealPath
- *  creates a KDirectory from a Windows path
- */
-rc_t KDirectoryMakeFromRealPath ( KDirectory **dirp,
-    const wchar_t *real, bool update, bool chroot );
-
-
-/*--------------------------------------------------------------------------
- * KSysDir
- *  a Windows directory
- */
-typedef struct KSysDir KSysDir;
-
-
-#if 0
-/* MakePath
- *  create a full path from partial
- *
- *  "ctx" [ IN ] - a prepared context for returning non-zero rc_t
- *
- *  "canon" [ IN ] - if true, rewrite path in canonical form. usually
- *  not required when passing a path to the system, as the OS performs
- *  its own processing.
- *
- *  "bufer" [ OUT ] and "path_max" [ IN ] - return buffer for processed path
- *
- *  "path" [ IN ] and "args" [ IN, NULL OKAY ] - input path to be resolved
- */
-rc_t KSysDirMakePath ( const KSysDir* self, enum RCContext ctx, bool canon,
-	wchar_t *buffer, size_t path_max, const char *path, va_list args );
-#endif
-
-
-/* OSPath
- *  returns a real OS path
- */
-rc_t KSysDirOSPath ( const KSysDir *self,
-    wchar_t *real, size_t bsize, const char *path, va_list args );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*  _h_sysdir_priv_ */
diff --git a/libs/kfs/win/sysdir.c b/libs/kfs/win/sysdir.c
deleted file mode 100644
index f3706ef..0000000
--- a/libs/kfs/win/sysdir.c
+++ /dev/null
@@ -1,2955 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kfs/extern.h>
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KSysDir;
-
-#define UNICODE 1
-#define _UNICODE 1
-
-#define KDIR_IMPL struct KSysDir
-
-#include "sysfile-priv.h"
-#include <klib/namelist.h>
-#include <klib/text.h>
-#include <klib/rc.h>
-#include <klib/log.h>
-#include <klib/out.h>
-#include <klib/debug.h>
-#include <klib/klib-priv.h>
-
-#include <sysalloc.h>
-
-#include <stdio.h>
-#include <wchar.h>
-#include <stdarg.h>
-#include <assert.h>
-#include <WINDOWS.H>
-#include <WINNT.H>
-
-#include "lnk_tools.c"
-
-#ifndef IO_REPARSE_TAG_SYMLINK
-#define IO_REPARSE_TAG_SYMLINK 0xA000000C
-#endif
-
-
-/* Missing functions from our text library
- * size is bytes; max_chars is number of elements
- */
-
-/* utf16_utf32
- *  converts UTF16 text to a single UTF32 character
- *  returns the number of UTF16 words consumed, such that:
- *    return > 0 means success
- *    return == 0 means insufficient input
- *    return < 0 means bad input or bad argument
- */
-static
-int utf16_utf32 ( uint32_t *dst, const wchar_t *begin, const wchar_t *end )
-{
-    uint32_t ch;
-
-    if ( dst == NULL || begin == NULL || end == NULL )
-        return -1;
-
-    if ( begin == end )
-        return 0;
-
-    /* windows utf16 */
-
-    ch = (uint32_t)(begin [0]);
-
-    if ((ch < 0xD800) || (ch <= 0xE000))
-    {
-        *dst = ch;
-        return 1;
-    }
-    else
-    {
-        uint32_t ch;
-
-        /* need at least 2 words */
-        if (begin >= end)
-            return -1;
-
-        /* extreme checks */
-        if (((begin[0] & 0xFC00) != 0xD8) ||
-            ((begin[1] & 0xFC00) != 0xDC))
-            return -1;
-
-        ch = (begin[0] & 0x03FF) << 10 |
-            (begin[1] & 0x03FF);
-        return 2;
-    }
-}
-
-
-/* utf32_utf16
- *  converts a single UTF32 character to UTF16 text
- *  returns the number of UTF16 words generated, such that:
- *    return > 0 means success
- *    return == 0 means insufficient output
- *    return < 0 means bad character or bad argument
- */
-static 
-int utf32_utf16 ( wchar_t *begin, wchar_t *end, uint32_t ch )
-{
-    if (ch < 0x10000)
-    {
-        if ((ch <= 0xDFFF) && (ch >= 0xD800))
-            return -1;
-
-        begin[0] = (uint16_t)ch;
-        return 1;
-    }
-    else if ((ch >= 0x10FFFF) || (end <= begin))
-        return -1;
-    else
-    {
-        uint32_t cch;
-
-        cch = ch - 0x10000;
-        /* cch <= 0xFFFFF since ch < 0x10FFFF */
-
-        begin[0] = 0xD800 | (cch >> 10); /* upper 10 bits */
-        begin[1] = 0xDC00 | (cch & 0x3FF); /* lower 10 bita */
-        return 2;
-    }
-}
-
-
-static int wstrcase_cmp (const wchar_t * a, size_t asize,
-                         const wchar_t * b, size_t bsize,
-                         uint32_t max_chars)
-{
-    uint32_t num_chars;
-    const wchar_t *aend, *bend;
-
-    assert ( a != NULL && b != NULL );
-
-    /* set up end limit triggers */
-    aend = a + asize;
-    bend = b + bsize;
-
-    num_chars = 0;
-
-    while ( a < aend && b < bend )
-    {
-        uint32_t ach, bch;
-
-        /* read a character from a */
-        int len = utf16_utf32 ( & ach, a, aend );
-        if ( len <= 0 )
-        {
-            asize -= ( size_t ) ( aend - a );
-            break;
-        }
-        a += len;
-
-        /* read a character from b */
-        len = utf16_utf32 ( & bch, b, bend );
-        if ( len <= 0 )
-        {
-            bsize -= ( size_t ) ( bend - b );
-            break;
-        }
-        b += len;
-
-        /* compare characters with case */
-        if ( ach != bch )
-        {
-            /* only go lower case if they differ */
-            ach = towlower ( ( wint_t ) ach );
-            bch = towlower ( ( wint_t ) bch );
-
-            if ( ach != bch )
-            {
-                if ( ach < bch )
-                    return -1;
-                return 1;
-            }
-        }
-
-        /* if char count is sufficient, we're done */
-        if ( ++ num_chars == max_chars )
-            return 0;
-    }
-
-    /* one or both reached end < max_chars */
-    if (asize < bsize)
-        return -1;
-    return asize > bsize;
-}
-
-/*--------------------------------------------------------------------------
- * KSysDirEnum
- *  a Windows directory enumerator
- */
-typedef struct KSysDirEnum KSysDirEnum;
-struct KSysDirEnum
-{
-    HANDLE handle;
-    WIN32_FIND_DATAW fd;
-    int found;
-    bool first;
-};
-
-/* Whack
- */
-static
-void KSysDirEnumWhack ( KSysDirEnum *self )
-{
-    FindClose( self->handle );
-}
-
-/* Init
- */
-static
-rc_t KSysDirEnumInit ( KSysDirEnum *self, const wchar_t *path )
-{
-    uint32_t err;
-    rc_t rc;
-
-    self -> first = true;
-    self -> handle = FindFirstFileW ( path, & self -> fd );
-    if ( self -> handle != INVALID_HANDLE_VALUE )
-    {
-        self -> found = 1;
-        return 0;
-    }
-
-    self -> found = 0;
-    err = GetLastError ();
-    switch ( err )
-    {
-    case ERROR_FILE_NOT_FOUND:
-    case ERROR_PATH_NOT_FOUND:
-        rc = RC ( rcFS, rcDirectory, rcListing, rcPath, rcNotFound );
-        break;
-    default :
-        rc = RC ( rcFS, rcDirectory, rcListing, rcNoObj, rcUnknown );
-    }
-
-    PLOGERR ( klogInfo,
-             ( klogInfo, rc, "error FindFirstFileW - $(E) - $(C)",
-              "E=%!,C=%u", err, err ) ); 
-
-    return rc;
-}
-
-
-static
-rc_t KSysDirEnumInitAll ( KSysDirEnum *self, wchar_t *path, uint32_t path_length )
-{
-    /* prepare the path for KSysDirEnumInit() */
-    path [ path_length + 0 ] = '\\';
-    path [ path_length + 1 ] = '*';
-    path [ path_length + 2 ] = '.';
-    path [ path_length + 3 ] = '*';
-    path [ path_length + 4 ] = 0;
-
-    return KSysDirEnumInit ( self, path );
-}
-
-/* Next
- */
-static
-const wchar_t *KSysDirEnumNext ( const KSysDirEnum *cself )
-{
-    KSysDirEnum* self = (KSysDirEnum*)cself;
-
-    while( self->found )
-    {
-        if ( self -> first )
-            self -> first = false;
-        else
-            self->found = FindNextFileW( self->handle, &self->fd );
-
-        if ( self->found )
-        {
-            /* filter out the '.' and '..' entries */
-            if ( self ->fd.cFileName[ 0 ] == '.' )
-            {
-                switch ( self->fd.cFileName[ 1 ] )
-                {
-                case 0:
-                    continue;
-                case '.':
-                    if ( self->fd.cFileName[ 2 ] == 0 )
-                        continue;
-                    break; 
-                }
-            }
-            return self->fd.cFileName;
-        }
-    }
-
-    return NULL;
-}
-
-
-/*--------------------------------------------------------------------------
- * KSysDirListing
- *  a Windows directory listing
- */
-typedef VNamelist KSysDirListing;
-
-static
-int KSysDirListingSort ( const void *a, const void *b )
-{
-    size_t A,B,M;
-    A = wchar_string_size (a);
-    B = wchar_string_size (b);
-    /* close enough for max chars? */
-    M = (A>B) ? A : B;
-
-    return wstrcase_cmp (a, A, b, B, ( uint32_t ) M);
-}
-
-static
-rc_t KSysDirListingInit ( KSysDirListing *self, const wchar_t *path, const KDirectory *dir,
-    bool ( CC * f ) ( const KDirectory*, const char*, void* ), void *data )
-{
-    KSysDirEnum list;
-    rc_t rc = KSysDirEnumInit ( & list, path );
-    if ( rc == 0 )
-    {
-        const wchar_t *name;
-        char utf8_name[ MAX_PATH ];
-        size_t utf8_size, utf16_size;
-
-        while ( ( name = KSysDirEnumNext ( & list ) ) != NULL )
-        {
-            utf16_size = wchar_string_size ( name );
-            utf8_size = wchar_cvt_string_copy ( utf8_name, sizeof( utf8_name ), name, utf16_size );
-            if ( utf8_size >= sizeof( utf8_name ) )
-            {
-                rc = RC(rcFS, rcDirectory, rcListing, rcName, rcExcessive );
-                break;
-            }
-
-            if ( f != NULL )
-            {
-                if ( ! ( * f ) ( dir, utf8_name, data ) )
-                    continue;
-            }
-            
-            rc = VNamelistAppend( self, utf8_name );
-            if ( rc != 0 )
-            {
-                break;
-            }
-
-        }
-
-        KSysDirEnumWhack ( & list );
-    }
-    return rc;
-}
-
-/*--------------------------------------------------------------------------
- * KSysDir
- *  a Windows directory
- */
-typedef struct KSysDir KSysDir;
-struct KSysDir
-{
-    KDirectory dad;
-    uint32_t root;
-    uint32_t length;
-    wchar_t path [ MAX_PATH ];
-};
-
-
-/* helper function to translate a windows-error-code into rc-code */
-static
-rc_t translate_file_error( DWORD error, enum RCContext ctx )
-{
-    switch ( error )
-    {
-    case ERROR_FILE_NOT_FOUND :
-    case ERROR_PATH_NOT_FOUND :
-    case ERROR_INVALID_DRIVE :
-        return RC ( rcFS, rcDirectory, ctx, rcPath, rcNotFound );
-
-    case ERROR_ALREADY_EXISTS:
-    case ERROR_FILE_EXISTS :
-        return RC ( rcFS, rcDirectory, ctx, rcPath, rcExists );
-
-/*    case ERROR_PATH_NOT_FOUND : */
-    case ERROR_INVALID_NAME :
-    case ERROR_BAD_PATHNAME :
-        return RC ( rcFS, rcDirectory, ctx, rcPath, rcInvalid );
-
-    case ERROR_ACCESS_DENIED :
-    case ERROR_INVALID_ACCESS :
-    case ERROR_SHARING_VIOLATION :
-    case ERROR_LOCK_VIOLATION :
-    case ERROR_PATH_BUSY :
-    case ERROR_WRITE_PROTECT :
-    case ERROR_DELETE_PENDING :
-        return RC ( rcFS, rcDirectory, ctx, rcDirectory, rcUnauthorized );
-
-    case ERROR_NOT_ENOUGH_MEMORY :
-    case ERROR_OUTOFMEMORY :
-        return RC ( rcFS, rcDirectory, ctx, rcMemory, rcExhausted );
-
-    case ERROR_TOO_MANY_OPEN_FILES :
-        return RC ( rcFS, rcDirectory, ctx, rcFileDesc, rcExhausted );
-
-    case ERROR_HANDLE_DISK_FULL :
-        return RC ( rcFS, rcDirectory, ctx, rcStorage, rcExhausted );
-
-    case ERROR_BUFFER_OVERFLOW :
-    case ERROR_FILENAME_EXCED_RANGE :
-        return RC ( rcFS, rcDirectory, ctx, rcPath, rcExcessive );
-    }
-    return RC ( rcFS, rcDirectory, ctx, rcNoObj, rcUnknown );
-}
-
-
-/* helper */
-
-static rc_t print_error_for( const wchar_t * path, const char * function, enum RCContext ctx, KLogLevel level )
-{
-    DWORD error = GetLastError();
-    rc_t rc = translate_file_error( error, ctx );
-#if _DEBUGGING
-    char buffer[ 4096 ];
-    size_t src_size, dst_size, len;
-    wchar_cvt_string_measure ( path, &src_size, &dst_size );
-    len = wchar_cvt_string_copy ( buffer, sizeof buffer, path, src_size );
-    buffer[ len ] = 0;
-    PLOGERR ( level,
-              ( level, rc, "error $(F) - $(E) - $(C) for $(D)",
-                "F=%s,E=%!,C=%u,D=%s", function, error, error, buffer ) ); 
-#endif
-    return rc;
-}
-
-
-static void wchar_2_char( const wchar_t * path, char * buffer, size_t buflen )
-{
-    size_t src_size, dst_size, len;
-    wchar_cvt_string_measure ( path, &src_size, &dst_size );
-    len = wchar_cvt_string_copy ( buffer, buflen, path, src_size );
-    buffer[ len ] = 0;
-}
-
-
-static
-uint32_t KSysDirPathTypeFromFindData ( WIN32_FIND_DATA *find_data, 
-                                       const wchar_t * path,
-                                       const uint32_t type )
-{
-    uint32_t res = type;
-
-    if( ( find_data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) != 0 )
-    {
-        res = kptDir;
-    }
-    else if ( ( find_data->dwFileAttributes & FILE_ATTRIBUTE_DEVICE ) != 0 )
-    {
-        res = kptCharDev;
-    }
-
-    /* add in alias bit */
-    if ( ( find_data->dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT ) != 0 )
-    {
-        if ( ( find_data->dwReserved0 & IO_REPARSE_TAG_SYMLINK ) != 0 )
-            res |= kptAlias;
-    }
-    else
-    {
-        if ( has_lnk_extension( path ) ) /* lnk_tools.c */
-            if ( lnk_file_validate( path ) ) /* lnk_tools.c */
-                res |= kptAlias;
-    }
-    return res;
-}
-
-static
-uint32_t KSysDirResolvePathAndDetectPathType ( const wchar_t *path )
-{
-    uint32_t res = kptNotFound;
-    wchar_t *resolved;
-    if ( win_resolve_path( path, &resolved, 1 ) ) /* lnk_tools.c */
-    {
-        WIN32_FIND_DATA find_data;
-        HANDLE f_findfile = FindFirstFileW( resolved, &find_data );
-        if ( f_findfile != INVALID_HANDLE_VALUE )
-        {
-            FindClose( f_findfile );
-            res = KSysDirPathTypeFromFindData ( &find_data, resolved, kptFile );
-        }
-        else
-        {
-            uint32_t err = GetLastError();
-            switch( err )
-            {
-            case ERROR_BAD_NETPATH:
-            case ERROR_BAD_NET_NAME:
-                /* see if the netpath is a server
-                   NB - our special wcsdup allocated extra space for this */
-                wcscat ( resolved, L"\\*" );
-                f_findfile = FindFirstFileW( resolved, &find_data );
-                if ( f_findfile != INVALID_HANDLE_VALUE )
-                {
-                    FindClose ( f_findfile );
-                    res = kptDir;
-                    break;
-                }
-                /* no break */
-            case ERROR_FILE_NOT_FOUND:
-            case ERROR_PATH_NOT_FOUND:
-                res = kptNotFound;
-                break;
-
-            default:
-                res = kptBadPath;
-            }
-        }
-        free( resolved );
-    }
-    return res;
-}
-
-/* KSysDirPathType
- *  returns a KPathType
- *
- *  "path" [ IN ] - NUL terminated string in directory-native character set
- */
-static
-uint32_t KSysDirFullPathType ( const wchar_t *path )
-{
-    WIN32_FIND_DATA find_data;
-    HANDLE f_findfile = FindFirstFileW( path, &find_data );
-    if ( f_findfile == INVALID_HANDLE_VALUE )
-    {
-        DWORD status = GetLastError ();
-        switch( status )
-        {
-        case ERROR_FILE_NOT_FOUND:
-        case ERROR_PATH_NOT_FOUND:
-        case ERROR_BAD_NETPATH:
-        case ERROR_BAD_NET_NAME:
-            /* try to follow the path, section by section
-               if a section cannot be found try to resolve it as
-               MS-shell-link ( .lnk file ) */
-            return KSysDirResolvePathAndDetectPathType ( path );
-        default:
-            DBGMSG ( DBG_KFS, DBG_FLAG_ANY, ( "FindFirstFileW: WARNING - unrecognized return code - %u.\n", status ) );
-            print_error_for( path, "FindFirstFileW", rcResolving, klogErr );
-            return kptBadPath;
-        }
-    }
-    FindClose( f_findfile );
-    return KSysDirPathTypeFromFindData ( &find_data, path, kptFile );
-}
-
-
-/* KSysDirMake
- *  allocate an uninialized object
- */
-static
-KSysDir *KSysDirMake ( size_t path_size )
-{
-    KSysDir *dir = malloc ( sizeof *dir - sizeof dir->path +
-        4 * sizeof dir -> path [ 0 ] + path_size );
-    return dir;
-}
-
-
-/* KSysDirDestroy
- */
-static
-rc_t CC KSysDirDestroy ( KSysDir *self )
-{
-    free ( self );
-    return 0;
-}
-
-/* KSysDirCanonPath
- */
-static
-rc_t KSysDirCanonPath ( const KSysDir *self, enum RCContext ctx, wchar_t *path, uint32_t path_length )
-{
-    wchar_t *low, *dst, *last, *end = path + path_length;
-
-    if ( self -> root != 0 )
-        low = path + self -> root;
-    else if ( path [ 1 ] == ':' )
-        low = path + 2;
-    else
-        low = path;
-    dst = last = low;
-
-    while( 1 )
-    {
-        wchar_t *src = wcschr ( last + 1, '\\' );
-        if ( src == NULL )
-            src = end;
-
-        /* detect special sequences */
-        switch ( src - last )
-        {
-        case 2:
-            if ( last [ 1 ] == '.' )
-            {
-                /* skip over */
-                last = src;
-                if ( src != end )
-                    continue;
-            }
-            break;
-
-        case 3:
-            if ( last [ 1 ] == '.' && last [ 2 ] == '.' )
-            {
-                /* remove previous leaf in path */
-                dst [ 0 ] = 0;
-                dst = wcsrchr ( path, '\\' );
-                if ( dst == NULL || dst < low )
-                    return RC( rcFS, rcDirectory, ctx, rcPath, rcInvalid );
-
-                last = src;
-                if ( src != end )
-                    continue;
-            }
-            break;
-        }
-
-        /* if rewriting, copy leaf */
-        assert ( src >= last );
-
-        /* if rewriting, copy leaf */
-        if ( dst != last )
-            memmove ( dst, last, ( src - last ) * sizeof * dst );
-
-        /* move destination ahead */
-        dst += src - last;
-        
-        /* if we're done, go */
-        if ( src == end )
-            break;
-
-        /* find next separator */
-        last = src;
-    }
-
-    /* NUL terminate if modified */
-    if ( dst != end )
-        *dst = 0;
-
-    return 0;
-}
-
-/* KSysDirMakePath
- *  creates a full path from partial
-
- self ....... has the first (base) part of the path in wchar_t !!!
- canon ...... if true the assembled path will be "canonilized" as last step
- buffer ..... into this buffer the full-path will be assembled ( wchar_t !!! )
- path_max ... the size of the buffer in bytes
- path ....... the partial path in utf8, can contain string-subst-elements !!!
- args ....... arguments to construct the partial path in utf8 ( can be NULL )
- */
-static
-rc_t KSysDirMakePath ( const KSysDir* self, enum RCContext ctx, bool canon,
-    wchar_t *buffer, size_t path_max, const char *path, va_list args )
-{
-    int temp_size_in_bytes;
-    uint32_t i, temp_length_in_utf8_chars;
-    uint32_t buffer_length_in_wchars;
-    char temp_utf8_buffer [ MAX_PATH ];
-
-    /* check if the given partial path is not NULL and not empty */
-    if( path == NULL )
-        return RC( rcFS, rcDirectory, ctx, rcPath, rcNull );
-    if ( path [ 0 ] == 0 )
-        return RC( rcFS, rcDirectory, ctx, rcPath, rcInvalid );
-
-    /* We construct in temp_utf8_buffer the relative path the user has given:
-    If there are no args we copy with _snprintf else we use vsnprintf,
-    !!! the args are always utf8, the given path is in utf8 !!!
-    that is the reason for the temporary utf8-buffer */
-    temp_size_in_bytes = ( args == NULL ) ?
-        _snprintf ( temp_utf8_buffer, sizeof temp_utf8_buffer, "%s", path ):
-        vsnprintf( temp_utf8_buffer, sizeof temp_utf8_buffer, path, args );
-
-    /* we check if _snprnitf/vsnprintf was sucessful */
-    if ( temp_size_in_bytes < 0 || temp_size_in_bytes >= sizeof temp_utf8_buffer )
-        return RC( rcFS, rcDirectory, ctx, rcPath, rcExcessive );
-
-    /* we measure the number of utf8-chars we have in our temp-buffer
-        only for international chars in the temp-buffer there will be
-        path_length_in_utf8_chars != path_size_in_bytes */
-    temp_length_in_utf8_chars = string_len ( temp_utf8_buffer, temp_size_in_bytes );
-
-    if ( isalpha ( temp_utf8_buffer [ 0 ] ) && temp_utf8_buffer [ 1 ] == ':' )
-    {
-    /* in the case the path is a absolute path for windows (starting with "C:" for instance)
-        we completely ignore the path in self and use the given path only.
-        !!! except we are chrooted, in this case the given path is invalid 
-        ( no abs. path for chrooted dir's ) */
-        if ( self -> root != 0 )
-            return RC ( rcFS, rcDirectory, ctx, rcPath, rcInvalid );
-
-        buffer_length_in_wchars = 0;
-    }
-    /* decide on the number of characters to copy from self */
-    else if ( temp_utf8_buffer [ 0 ] != '/' )
-    {
-        buffer_length_in_wchars = self -> length;
-    }
-    else
-    {
-        /* get chroot'd path length */
-        buffer_length_in_wchars = self -> root;
-
-        /* if the full path includes a drive letter */
-        if ( isalpha ( temp_utf8_buffer [ 1 ] ) && temp_utf8_buffer [ 2 ] == '/' )
-        {
-            /* fail if chroot'd */
-            if ( self -> root != 0 )
-                return RC ( rcFS, rcDirectory, ctx, rcPath, rcInvalid );
-
-            /* rewrite drive letter */
-            temp_utf8_buffer [ 0 ] = tolower ( temp_utf8_buffer [ 1 ] );
-            temp_utf8_buffer [ 1 ] = ':';
-        }
-    }
-
-    /* check for buffer overrun */
-    if ( buffer_length_in_wchars + temp_length_in_utf8_chars >= path_max / sizeof * buffer )
-        return RC ( rcFS, rcDirectory, ctx, rcPath, rcExcessive );
-
-    /* prepend UTF-16 directory path */
-    if ( buffer_length_in_wchars != 0 )
-    {
-        memcpy ( buffer, self -> path, buffer_length_in_wchars * sizeof * buffer );
-
-        /* if path is relative, expect trailing '\\'
-            if path is full, expect NO trailing '\\' */
-        assert ( ( buffer_length_in_wchars == self ->length &&
-                    buffer [ buffer_length_in_wchars - 1 ] == '\\' ) ||
-                 ( buffer_length_in_wchars == self ->root &&
-                   buffer [ buffer_length_in_wchars - 1 ] != '\\' ) );
-    }
-
-    /* append the temp_utf8_buffer to the  user-supplied relative path */
-    buffer_length_in_wchars += (uint32_t)string_cvt_wchar_copy ( & buffer [ buffer_length_in_wchars ],
-        path_max - buffer_length_in_wchars * sizeof buffer [ 0 ],
-        temp_utf8_buffer, temp_size_in_bytes );
-    /* the job of the temp_utf8_buffer is done now... */
-
-    /* detect exhausted buffer */
-    if ( buffer_length_in_wchars >= path_max / sizeof * buffer )
-        return RC ( rcFS, rcDirectory, ctx, rcPath, rcExcessive );
-
-    assert ( buffer_length_in_wchars > 0 );
-    assert ( buffer[ buffer_length_in_wchars ] == 0 );
-
-    /* remove any trailing slash added by caller */
-    if ( buffer [ buffer_length_in_wchars - 1 ] == '/' )
-        buffer [ -- buffer_length_in_wchars ] = 0;
-
-    /* convert forward to backward slashes */
-    for ( i = 0; i < buffer_length_in_wchars; ++ i )
-    {
-        if ( buffer [ i ] == '/' )
-            buffer [ i ] = '\\';
-    }
-
-    /* if there are any characters to work with
-       and if caller wants canonical representation
-       or I'm chrooted, rewrite */
-    if ( buffer_length_in_wchars >= 2 && ( canon || self -> root > 2 ) )
-    {
-        return KSysDirCanonPath ( self, ctx, buffer, buffer_length_in_wchars );
-    }
-
-    return 0;
-}
-
-LIB_EXPORT rc_t KSysDirOSPath ( const KSysDir *self,
-    wchar_t *real, size_t real_size, const char *path, va_list args )
-{
-    return KSysDirMakePath ( self, rcLoading, true, real, real_size, path, args );
-}
-
-/* KSysDirInit - forward declaration
- */
-static
-rc_t KSysDirInit ( KSysDir *self, enum RCContext ctx, uint32_t dad_root,
-                   const wchar_t *path, size_t path_size, uint32_t path_length, 
-                   bool update, bool chroot );
-
-/* KSysDirList
- *  create a directory listing
- *
- *  "list" [ OUT ] - return parameter for list object
- *
- *  "path" [ IN, NULL OKAY ] - optional parameter for target
- *  directory. if NULL, interpreted to mean "."
- */
-static
-rc_t CC KSysDirList ( const KSysDir *self, KNamelist **listp,
-    bool ( CC * f ) ( const KDirectory *dir, const char *name, void *data ), void *data,
-                   const char *path, va_list args )
-{
-    KSysDir full;
-    rc_t rc = KSysDirMakePath ( self, rcListing, true, full.path, sizeof full.path, path, args );
-    if ( rc == 0 )
-    {
-        size_t size_in_bytes;
-        uint32_t len_in_chars = utf16_string_measure( full.path, &size_in_bytes );
-
-        /* require space for a '\\*.*' and NUL */
-        if ( len_in_chars + 5 > sizeof full.path / sizeof full . path [ 0 ] )
-            rc = RC ( rcFS, rcDirectory, rcListing, rcPath, rcExcessive );
-        else
-        {
-            rc = KSysDirInit( &full, rcListing, self->root, NULL, size_in_bytes, len_in_chars, 0, 0 );
-            if ( rc == 0 )
-            {
-                KSysDirListing *list;
-
-                len_in_chars = full.length;
-                full . path [ len_in_chars + 0 ] = '*';
-                full . path [ len_in_chars + 1 ] = '.';
-                full . path [ len_in_chars + 2 ] = '*';
-                full . path [ len_in_chars + 3 ] = 0;
-
-                rc = VNamelistMake ( &list, 5 ); 
-                if ( rc == 0 )
-                {
-                    rc = KSysDirListingInit( list, full.path, & full.dad, f, data );
-                    if ( rc != 0 )
-                    {
-                        VNamelistRelease ( list );
-                    }
-                    else
-                    {
-                        rc = VNamelistToNamelist ( list, listp );
-                        VNamelistRelease ( list );
-                    }
-                }
-            }
-        }
-    }
-    return rc;
-}
-
-static
-uint32_t CC KSysDirPathType ( const KSysDir *self, const char *path, va_list args )
-{
-    wchar_t full[ MAX_PATH ];
-    rc_t rc = KSysDirMakePath( self, rcAccessing, false, full, sizeof full, path, args );
-    if ( rc == 0 )
-    {
-        return KSysDirFullPathType( full );
-    }
-    return kptBadPath;
-}
-
-/* KSysDirVisit
- *  visit each path under designated directory,
- *  recursively if so indicated
- *
- *  "recurse" [ IN ] - if non-zero, recursively visit sub-directories
- *
- *  "f" [ IN ] and "data" [ IN, OPAQUE ] - function to execute
- *  on each path. receives a base directory and relative path
- *  for each entry, where each path is also given the leaf name
- *  for convenience. if "f" returns non-zero, the iteration will
- *  terminate and that value will be returned. NB - "dir" will not
- *  be the same as "self".
- *
- *  "path" [ IN ] - NUL terminated string in directory-native character set
- */
-typedef struct KSysDirVisitData KSysDirVisitData;
-struct KSysDirVisitData
-{
-    rc_t ( CC * f ) ( KDirectory*, uint32_t, const char*, void* );
-    void *data;
-    KSysDir dir;
-    bool recurse;
-};
-
-static
-rc_t KSysDirVisitDir ( KSysDirVisitData *pb )
-{
-    /* get a directory listing */
-    rc_t rc;
-    KSysDirEnum listing;
-    uint32_t path_length;
-    size_t path_size;
-
-    /* measure length and size of the given path, we will need both... */
-    path_length = wchar_string_measure ( pb->dir.path, &path_size );
-
-    /* add a trailing backslash (windows!) if it is not there... */
-    if ( pb->dir.path[ path_length - 1 ] != '\\' )
-    {
-        /* check if there is space for 4 more bytes */
-        if ( ( path_size + 4 ) >= sizeof pb->dir.path )
-        {
-            return RC( rcFS, rcDirectory, rcVisiting, rcPath, rcExcessive );
-        }
-        pb->dir.path[ path_length + 0 ] = '\\';
-        pb->dir.path[ path_length + 1 ] = 0;
-        path_length = utf16_string_measure( pb->dir.path, &path_size );
-        pb->dir.length = path_length;
-    }
-
-    /* check if there is space for 8 more bytes ( '*.*0' ) */
-    if ( ( path_size + 8 ) >= sizeof pb->dir.path )
-    {
-        return RC( rcFS, rcDirectory, rcVisiting, rcPath, rcExcessive );
-    } 
-    /* append '*.*' to make KSysDirEnumInit work under Windows! */
-    pb -> dir . path [ path_length + 0 ] = '*';
-    pb -> dir . path [ path_length + 1 ] = '.';
-    pb -> dir . path [ path_length + 2 ] = '*';
-    pb -> dir . path [ path_length + 3 ] = 0;
-
-    rc = KSysDirEnumInit ( &listing, pb->dir.path );
-    if( rc == 0 )
-    {
-        const wchar_t *name;
-
-        /* truncate the appended '*.*' to visit the entries */
-        pb -> dir . path [ path_length ] = 0;
-
-        for ( name = KSysDirEnumNext( &listing ); 
-              name != NULL; 
-              name = KSysDirEnumNext( &listing ) )
-        {
-            uint32_t type, name_length;
-            size_t name_size;
-            char temp_utf8_buffer [ MAX_PATH ];
-
-            /* measure length and size of the element-name, we will need both... */
-            name_length = wchar_string_measure ( name, &name_size );
-            /* check if we have enought space for path and element-name */
-            if ( path_size + name_size >= sizeof pb->dir.path )
-            {
-                rc = RC( rcFS, rcDirectory, rcVisiting, rcPath, rcExcessive );
-                break;
-            }
-
-            /* append the element-name to the path */
-            wcscpy ( &pb->dir.path[ path_length ], name );
-            type = KSysDirFullPathType( pb->dir.path );
-            if( type == kptBadPath )
-            {
-                rc = RC( rcFS, rcDirectory, rcVisiting, rcPath, rcInvalid );
-                break;
-            }
-
-            /* the callback-function expects the name as utf8 !!! */
-            wchar_cvt_string_copy ( temp_utf8_buffer, sizeof temp_utf8_buffer, 
-                                    name, name_size );
-            rc = (*pb->f)( &pb->dir.dad, type, temp_utf8_buffer, pb->data );
-            if ( rc != 0 )
-                break;
-
-            /* if recursive visiting is requested and the element is a directory */
-            if ( pb->recurse && ( type & ( kptAlias - 1 ) ) == kptDir )
-            {
-                /* append the element-name-length temporary to the length of the path */
-                pb->dir.length += name_length;
-                /* call this function recursive */
-                rc = KSysDirVisitDir( pb );
-                /* restore the original path-length (for the caller function) */
-                pb->dir.length = path_length;
-                if ( rc != 0 )
-                    break;
-            }
-
-        } /* for () */
-
-        KSysDirEnumWhack( &listing );
-    }
-    return rc;
-}
-
-static
-rc_t CC KSysDirVisit ( const KSysDir *self, bool recurse,
-    rc_t ( CC * f ) ( KDirectory *dir, uint32_t type, const char *name, void *data ), void *data,
-    const char *path, va_list args )
-{
-    rc_t rc;
-    KSysDirVisitData pb;
-
-    rc = KSysDirMakePath( self, rcVisiting, true, pb.dir.path, sizeof pb.dir.path, path, args );
-    if ( rc == 0 )
-    {
-        size_t path_size;
-        uint32_t path_length;
-
-        switch( KSysDirFullPathType( pb.dir.path ) & ( kptAlias - 1 ) )
-        {
-            case kptNotFound:
-                return RC( rcFS, rcDirectory, rcVisiting, rcPath, rcNotFound );
-            case kptBadPath:
-                return RC( rcFS, rcDirectory, rcVisiting, rcPath, rcInvalid );
-            case kptDir:
-                break;
-            default:
-                return RC( rcFS, rcDirectory, rcVisiting, rcPath, rcIncorrect );
-        }
-
-        path_length = utf16_string_measure( pb.dir.path, &path_size );
-        rc = KSysDirInit ( & pb . dir, rcVisiting, self -> root,
-                           NULL, path_size, path_length,
-                           self -> dad . read_only ? 0 : 1, 0 );
-        if ( rc == 0 )
-        {
-            pb . f = f;
-            pb . data = data;
-            pb . recurse = recurse;
-            rc = KSysDirVisitDir ( & pb );
-        }
-    }
-    return rc;
-}
-
-/* KSysDirRelativePath
- *  makes "path" relative to "root"
- *  both "root" and "path" MUST be absolute
- *  both "root" and "path" MUST be canonical, i.e. have no "./" or "../" sequences
- *  both root and path are in windows-native format!
- */
-static
-rc_t KSysDirRelativePath ( const KSysDir *self, enum RCContext ctx,
-    const wchar_t *root, wchar_t *path, size_t path_max )
-{
-    size_t psize;
-    uint32_t backup, blength_in_chars, dst, diff_from_here;
-
-    const wchar_t *r = root + self->root;
-    const wchar_t *p = path + self->root;
-
-    /* stop gap fix..  not actually comparing the utf16 values correctly */
-    for ( ; towlower (*r) == towlower (*p); ++ r, ++ p )
-    {
-        /* disallow identical paths */
-        if ( * r == 0 )
-            return RC( rcFS, rcDirectory, ctx, rcPath, rcInvalid );
-    }
-
-    /* paths are identical up to "r","p"
-       if "r" is within a leaf name, then no backup is needed
-       by counting every '\\' from "r" to end, obtain backup count */
-    for ( backup = 0; * r != 0; ++ r )
-    {
-        if ( * r == '\\' )
-            ++ backup;
-    }
-
-    /* the number of characters to be inserted */
-    blength_in_chars = backup * 3;
-
-    /* align "p" to last directory separator */
-    if ( p > path ) {
-        while ( p [ -1 ] != '\\' ) -- p;
-    }
-
-    /* the size of the remaining relative path */
-    psize = wcslen ( p );
-    diff_from_here = ( uint32_t )( p - path );
-
-    /* open up space if needed */
-    if ( diff_from_here < blength_in_chars )
-    {
-        /* prevent overflow */
-        if ( ( blength_in_chars + psize ) * sizeof( *path ) >= path_max )
-            return RC( rcFS, rcDirectory, ctx, rcPath, rcExcessive );
-        memmove ( & path[ blength_in_chars ], p, psize * ( sizeof *p ) );
-    }
-
-    /* insert backup sequences */
-    for ( dst = 0; backup > 0; -- backup )
-    {
-        path [ dst++ ] = '.';
-        path [ dst++ ] = '.';
-        path [ dst++ ] = '\\';
-    }
-
-    /* close gap */
-    if ( diff_from_here > blength_in_chars )
-        wcscpy ( & path [ blength_in_chars ], p );
-    path[ blength_in_chars + psize ] = 0;
-
-    return 0;
-}
-
-/* KSysDirResolvePath
- *  resolves path to an absolute or directory-relative path
- *
- *  "absolute" [ IN ] - if non-zero, always give a path starting
- *  with '/'. NB - if the directory is chroot'd, the absolute path
- *  will still be relative to directory root.
- *
- *  "resolved" [ OUT ] and "rsize" [ IN ] - buffer for
- *  NUL terminated result path in directory-native character sets
- *  the resolved path will be directory relative
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target path. NB - need not exist.
- */
-static
-rc_t CC KSysDirResolvePath ( const KSysDir *self, bool absolute,
-    char *resolved, size_t rsize, const char *path, va_list args )
-{
-    wchar_t temp [ MAX_PATH ];
-    size_t temp_size;
-    uint32_t temp_length;
-
-    /* convert the utf8-input-parameter path into wchar_t */
-    rc_t rc = KSysDirMakePath ( self, rcResolving, true, temp, sizeof temp, path, args );
-    if ( rc != 0 )
-        return rc;
-
-    temp[ 0 ] = tolower( temp[ 0 ] ); /* this is important:
-                                         otherwise the comparison for is_on_same_drive_letter fails
-                                         AND
-                                         KSysDirRelativePath() fails too! */
-
-    temp_length = wchar_string_measure ( temp, &temp_size );
-    if ( absolute )
-    {
-        /* test buffer capacity */
-        if ( temp_length - self->root >= rsize )
-            return RC ( rcFS, rcDirectory, rcResolving, rcBuffer, rcInsufficient );
-    }
-    else
-    {
-        /* we are on windows, only if the path has a drive letter and it is the same
-           one as in KSysDir itself, we should try to create a relative path */
-        wchar_t colon = ':';
-        bool is_on_same_drive_letter = ( iswascii ( temp[ 0 ] ) && iswascii ( self->path[ 0 ] ) &&
-                                         ( temp[ 1 ] == colon ) && ( self->path[ 1 ] == colon ) &&
-                                         ( towlower ( temp[ 0 ] ) == towlower ( self->path[ 0 ] ) ) );
-        if ( is_on_same_drive_letter )
-        {
-            rc = KSysDirRelativePath( self, rcResolving, self->path, temp, sizeof temp );
-            if ( rc == 0 )
-            {
-                uint32_t temp_length = wchar_string_measure ( temp, &temp_size );
-                if ( temp_length >= rsize )
-                    return RC ( rcFS, rcDirectory, rcResolving, rcBuffer, rcInsufficient );
-            }
-        }
-        else
-        {
-            /* treat it as if absolute were requested ( see above ) */
-            if ( temp_length - self->root >= rsize )
-                return RC ( rcFS, rcDirectory, rcResolving, rcBuffer, rcInsufficient );
-        }
-    }
-
-    if ( rc == 0 )
-    {
-        uint32_t i;    
-        /* convert it back to utf8 */
-        utf16_cvt_string_copy ( resolved, rsize, temp, temp_size );
-
-        /* convert it back to POSIX */
-        if ( isalpha ( resolved[ 0 ] ) && resolved[ 1 ] == ':' )
-        {
-            /* rewrite drive letter */
-            resolved[ 1 ] = tolower ( resolved [ 0 ] );
-            resolved[ 0 ] = '/';
-        }
-        
-        /* convert backward to forward slashes */
-        for ( i = 0; resolved[ i ]; ++ i )
-        {
-            if ( resolved[ i ] == '\\' )
-                resolved[ i ] = '/';
-        }
-    }
-
-    return rc;
-}
-
-/* KSysDirResolveAlias
- *  resolves an alias path to its immediate target
- *  NB - the resolved path may be yet another alias
- *
- *  "alias" [ IN ] - NUL terminated string in directory-native
- *  character set denoting an object presumed to be an alias.
- *
- *  "resolved" [ OUT ] and "rsize" [ IN ] - buffer for
- *  NUL terminated result path in directory-native character set
- */
-static
-rc_t CC KSysDirResolveAlias ( const KSysDir *self, bool absolute,
-                              char *resolved, size_t rsize,
-                              const char *alias, va_list args )
-{
-    KSysDir temp;
-    size_t temp_size;
-    uint32_t temp_length, path_type;
-    wchar_t * w_resolved;
-
-    rc_t rc = KSysDirMakePath( self, rcResolving, true, temp.path, sizeof temp.path, alias, args );
-    if ( rc != 0 )
-        return rc;
-
-    temp_length = wchar_string_measure ( temp.path, &temp_size );
-    path_type = KSysDirFullPathType ( temp.path );
-    if ( path_type == kptFile || path_type == kptDir )
-    {
-        /* if the path points to a file or a dir, then there is no alias involved at all */
-        if ( temp_size >= rsize )
-        {
-            return RC ( rcFS, rcDirectory, rcResolving, rcBuffer, rcInsufficient );
-        }
-        /* we have to convert temp.path back from wchar_t to char ! */
-        wchar_cvt_string_copy ( resolved, rsize, temp.path, temp_size );
-        return 0;
-    }
-
-
-    /* trying to attach a .lnk to the path, if it resolves it is a link... */
-    if ( temp_size + 10 >= rsize )
-    {
-        return RC( rcFS, rcDirectory, rcResolving, rcBuffer, rcInsufficient );
-    }
-    temp.path[ temp_length + 0 ] = '.';
-    temp.path[ temp_length + 1 ] = 'l';
-    temp.path[ temp_length + 2 ] = 'n';
-    temp.path[ temp_length + 3 ] = 'k';
-    temp.path[ temp_length + 4 ] = 0;
-
-    if ( lnk_file_resolve( temp.path, &w_resolved ) != LNK_RES_ERROR )
-    {
-        size_t w_size;
-        uint32_t w_len;
-
-        /* we have to copy the resolved path into temp to use KSysDirCanonPath() */
-        w_len = wchar_string_measure ( w_resolved, &w_size );
-        if ( w_size > sizeof temp.path )
-        {
-            free( w_resolved );
-            return RC( rcFS, rcDirectory, rcResolving, rcBuffer, rcInsufficient );
-        }
-        wcscpy( temp.path, w_resolved );
-        free( w_resolved );
-
-        rc = KSysDirCanonPath( &temp, rcResolving, temp.path, w_len );
-        if ( rc == 0 )
-        {
-            /* the path in full is an absolute path
-               if outside of chroot, it's a bad link */
-            if (wstrcase_cmp (temp.path, self->root + 1,
-                              self->path, self->root + 1,self->root + 1) != 0)
-                return RC( rcFS, rcDirectory, rcResolving, rcLink, rcInvalid );
-
-            /* this is the absolute path length */
-            w_len = wchar_string_measure ( temp.path, &w_size );
-
-            /* if not requesting absolute, make self relative */
-            if( !absolute )
-            {
-                rc = KSysDirRelativePath( self, rcResolving, self->path, 
-                                          temp.path, w_len );
-                if ( rc != 0 )
-                    return rc;
-                w_len = wchar_string_measure ( temp.path, &w_size );
-            }
-            if ( ( size_t ) w_len >= rsize )
-                return RC(rcFS, rcDirectory, rcResolving, rcBuffer, rcInsufficient );
-
-            w_len = wchar_string_measure ( &(temp.path[ self -> root ]), &w_size );
-            wchar_cvt_string_copy ( resolved, rsize, &(temp.path[ self -> root ]), w_size );
-        }
-    }
-
-
-#if 0
-    /* NEXT - attach ".lnk" to the path and see if it resolves
-       if not, the supplied path simply does not exist */
-        if ( ( wcslen( full.path ) + 5 ) >= rsize )
-        {
-            return RC( rcFS, rcDirectory, rcResolving, rcBuffer, rcInsufficient );
-        }
-        wcscpy( resolved, full.path );
-        wcscat( resolved, L".lnk" );
-        refnum = FindFirstFile( resolved, &info );
-        if ( refnum == INVALID_HANDLE_VALUE )
-        {
-            wcscpy( resolved, L"\0" );
-            return RC( rcFS, rcDirectory, rcResolving, rcPath, rcNotFound );
-        }
-        FindClose( refnum );
-
-        {
-
-            /* get a COM reference to the Explorer. we should be
-               able to do this in C with no problem */
-            HRESULT rslt = ERROR_INSUFFICIENT_BUFFER;
-            IShellLink *shellLink;
-            rslt = CoCreateInstance( &IID_IShellLink, 0, CLSCTX_INPROC_SERVER, &IID_IShellLink, &shellLink );
-            if( !rslt )
-            {
-                /* get a file interface that isn't attached to anything */
-                IPersistFile *persistFile;
-                rslt = shellLink->lpVtbl->QueryInterface( shellLink, &IID_IPersistFile, (void**)&persistFile );
-                if( !rslt )
-                {
-                    /* now try to do the thing
-                       the link name needs to be in Unicode */
-                    rslt = persistFile->lpVtbl->Load(persistFile, resolved, STGM_READ );
-                    if( !rslt )
-                    {
-                        /* Unicode is no longer necessary */
-                        rslt = shellLink->lpVtbl->Resolve( shellLink, 0, SLR_NO_UI + SLR_ANY_MATCH );
-                        if ( !rslt )
-                        {
-                            /* read what the path is, i.e. read the shortcut file */
-                            rslt = shellLink->lpVtbl->GetPath( shellLink, resolved, rsize, &info, 0 );
-                            if( rslt )
-                            {
-                                wcscpy( resolved, L"\0" );
-                            }
-                        }
-                    }
-                    persistFile->lpVtbl->Release( persistFile );
-                }
-                shellLink->lpVtbl->Release( shellLink );
-            }
-            if ( wcslen( resolved ) == 0 )
-            {
-                return RC( rcFS, rcDirectory, rcResolving, rcPath, rcInvalid );
-            }
-
-        }
-
-        len = wcslen( resolved );
-        if( resolved[0] == '/' )
-        {
-            full.size = 1;
-            wcscpy( full.path, resolved );
-        }
-        else
-        {
-            wchar_t *f = wcsrchr( full.path, '/' );
-            full.size = f - full.path + 1;
-            if ( full.size + len >= sizeof full.path )
-            {
-                return RC( rcFS, rcDirectory, rcResolving, rcBuffer, rcInsufficient );
-            }
-            wcscpy( f, resolved );
-        }
-        full.root = 0;
-
-        rc = KSysDirCanonPath( &full, rcResolving, full.path, len );
-        if ( rc == 0 )
-        {
-            size_t f, s;
-
-            f = wchar_string_size (full.path);
-            s = wchar_string_size (self->path);
-            /* the path in full is an absolute path
-               if outside of chroot, it's a bad link */
-            if ( wstrcase_cmp (full.path, f, self->path, s, self->root + 1 ) != 0 )
-            {
-                return RC( rcFS, rcDirectory, rcResolving, rcLink, rcInvalid );
-            }
-
-            /* this is the absolute path length */
-            len = wchar_string_size( &full.path[self->root] );
-
-            /* if not requesting absolute, make self relative */
-            if( !absolute )
-            {
-            rc = KSysDirRelativePath( self, rcResolving, self->path, full.path, sizeof full.path /*len*/ );
-                if ( rc != 0 )
-                    return rc;
-                len = wchar_string_size(full.path);
-            }
-            if ( ( size_t ) len >= rsize )
-                return RC(rcFS, rcDirectory, rcResolving, rcBuffer, rcInsufficient );
-
-            wcscpy ( resolved, & full . path [ self -> root ] );
-        }
-#endif
-    return rc;
-}
-
-/* KSysDirRename
- *  rename an object accessible from directory, replacing
- *  any existing target object of the same type
- *
- *  "from" [ IN ] - NUL terminated string in directory-native
- *  character set denoting existing object
- *
- *  "to" [ IN ] - NUL terminated string in directory-native
- *  character set denoting existing object
- */
-static
-rc_t CC KSysDirRename ( KSysDir *self, bool force, const char *from, const char *to )
-{
-    wchar_t current_name[ MAX_PATH ];
-    rc_t rc = KSysDirMakePath ( self, rcRenaming, false, current_name, sizeof current_name, from, NULL );
-    if ( rc == 0 )
-    {
-
-        wchar_t new_name[ MAX_PATH ];
-        rc = KSysDirMakePath ( self, rcRenaming, false, new_name, sizeof new_name, to, NULL );
-        if ( rc == 0 )
-        {
-            DWORD err = 0;
-            uint32_t try = 0;
-
-            do
-            {
-                BOOL success = false;
-                if ( force ) {
-                    DWORD dwFlags = MOVEFILE_REPLACE_EXISTING;
-                    success = MoveFileEx ( current_name, new_name, dwFlags );
-                }
-                else {
-                    success = MoveFileW ( current_name, new_name );
-                }
-                if ( success )
-                {
-                    rc = 0;
-                }
-                else
-                {
-                    err = GetLastError();
-                    switch( err )
-                    {
-                        case ERROR_FILE_NOT_FOUND:
-                        case ERROR_PATH_NOT_FOUND:
-                        case ERROR_INVALID_DRIVE:
-                            return RC ( rcFS, rcDirectory, rcRenaming, rcFile, rcNotFound );
-                        case ERROR_ACCESS_DENIED:
-                            try++;
-                            Sleep( 500 ); /* sleep for a half a second */
-                            rc = RC ( rcFS, rcDirectory, rcRenaming, rcFile, rcUnauthorized );
-                            break;
-                       case ERROR_SHARING_VIOLATION:
-                           return RC ( rcFS, rcDirectory, rcRenaming, rcFile, rcBusy );
-                        default:
-                            return RC ( rcFS, rcDirectory, rcRenaming, rcNoObj, rcUnknown );
-                    }
-                }
-            } while ( err == ERROR_ACCESS_DENIED && try < 30 );
-        }
-    }
-    return rc;
-}
-
-
-/* helper function for KSysDirCreateParents() */
-static
-rc_t directory_exists( const wchar_t *path, bool *exists )
-{
-    /* try it with CreateFileW() */
-    *exists = win_path_exists( path );
-    return 0;
-#if 0
-    wchar_t temp[ MAX_PATH ];
-    WIN32_FIND_DATA find_data;
-    HANDLE h_find;
-    size_t path_size;
-    uint32_t path_length = utf16_string_measure( path, &path_size );
-
-    *exists = false;
-
-    if ( ( path_size + 10 ) > sizeof temp )
-        return RC( rcFS, rcDirectory, rcCreating, rcMemory, rcExhausted );
-
-    wcscpy( temp, path );
-    if ( temp[ path_length - 1 ] != '\\' )
-        temp[ path_length++ ] = '\\';
-    temp[ path_length + 0 ] = '*';
-    temp[ path_length + 1 ] = '.';
-    temp[ path_length + 2 ] = '*';
-    temp[ path_length + 3 ] = 0;
-
-    h_find = FindFirstFileW( temp, &find_data );
-    if ( h_find != INVALID_HANDLE_VALUE )
-    {
-        *exists = true;
-        FindClose( h_find );
-    }
-
-    return 0;
-#endif
-}
-
-
-static
-rc_t KSysDirRemoveEntry ( wchar_t *path, size_t path_max, bool force );
-
-
-static
-rc_t KSysDirEmptyDir ( wchar_t *path, size_t path_max, bool force )
-{
-    rc_t rc;
-    KSysDirEnum list;
-    size_t path_size;
-    uint32_t path_length = wchar_string_measure ( path, &path_size );
-
-    if ( ( path_size + 10 ) > path_max )
-        return RC( rcFS, rcDirectory, rcListing, rcMemory, rcExhausted );
-
-    rc = KSysDirEnumInitAll ( & list, path, path_length );
-    if ( rc != 0 )
-    {
-        rc = ResetRCContext ( rc, rcFS, rcDirectory, rcClearing );
-    }
-    else
-    {
-        const wchar_t *leaf;
-
-        /* we keep only the appended '\\' for the loop... */
-        path_length++;
-        path_size += sizeof *path;
-
-        for ( leaf = KSysDirEnumNext( &list ); 
-              leaf != NULL; 
-              leaf = KSysDirEnumNext( &list ) )
-        {
-            size_t leaf_size;
-            uint32_t leaf_length = wchar_string_measure ( leaf, &leaf_size );
-            if ( path_size + leaf_size >= path_max )
-            {
-                rc = RC ( rcFS, rcDirectory, rcClearing, rcPath, rcExcessive );
-                break;
-            }
-
-            /* wcscpy adds termination, so wprintf is safe to call */
-            wcscpy ( & path [ path_length ], leaf );
-
-            rc = KSysDirRemoveEntry ( path, path_max, force );
-            if ( rc != 0 )
-            {
-                rc = ResetRCContext ( rc, rcFS, rcDirectory, rcClearing );
-                break;
-            }
-        }
-        KSysDirEnumWhack ( & list );
-        /* restore the original path... */
-        path [ path_length - 1 ] = 0;
-    }
-    return rc;
-}
-
-
-/* KSysDirClearDir
- *  remove all directory contents
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target directory
- *
- *  "force" [ IN ] - if non-zero and directory entry is a
- *  sub-directory, remove recursively
- */
-static
-rc_t CC KSysDirClearDir ( KSysDir *self, bool force, const char *path, va_list args )
-{
-    wchar_t dir_name [ MAX_PATH ];
-    rc_t rc = KSysDirMakePath ( self, rcClearing, false, dir_name, sizeof dir_name, path, args );
-    if ( rc == 0 )
-        rc = KSysDirEmptyDir ( dir_name, sizeof dir_name, force );
-    return rc;
-}
-
-
-/* KSysDirRemove
- *  remove an accessible object from its directory
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- *
- *  "force" [ IN ] - if non-zero and target is a directory,
- *  remove recursively
- */
-static
-rc_t KSysDirRemoveEntry ( wchar_t *path, size_t path_max, bool force )
-{
-    if ( !DeleteFileW( path ) )
-    {
-        DWORD error = GetLastError();
-
-        switch ( error )
-        {
-        case ERROR_PATH_NOT_FOUND :
-            return 0;
-/*
-        case ERROR_ACCESS_DENIED :
-            !!! Do not use this error code here, it occurs if path is not a file, but
-            a directory instead. Handling it here would prevent the remaining code
-            from beeing executed !!!
-            return RC( rcFS, rcDirectory, rcRemoving, rcDirectory, rcUnauthorized );
-*/
-
-        default :
-#if _DEBUGGING && 0
-    OUTMSG (( "DeleteFileW returned '%#X'\n", error ));
-#endif
-            break;
-        }
-
-        /* we have not been able to delete it as a file,
-           we try to delete it as a directory... */
-        if ( !RemoveDirectoryW( path ) )
-        {
-            rc_t rc;
-            error = GetLastError();
-
-            /* find out if the reason is that it is not empty and force = true --->
-               in this case delete all files and directories in it 
-               and then try again... */
-            switch ( error )
-            {
-            case ERROR_DIR_NOT_EMPTY :
-                if ( force )
-                {
-                    rc = KSysDirEmptyDir ( path, path_max, force );
-                    if ( rc == 0 )
-                    {
-                        if ( !RemoveDirectoryW( path ) )
-                        {
-                            rc = RC ( rcFS, rcDirectory, rcRemoving, rcDirectory, rcUnauthorized );
-                            print_error_for( path, "RemoveDirectoryW", rcRemoving, klogErr );
-                        }
-                    }
-                    return rc;
-                }
-                else
-                    rc = RC ( rcFS, rcDirectory, rcRemoving, rcDirectory, rcUnauthorized );
-                break;
-
-            case ERROR_ACCESS_DENIED :
-                rc = RC ( rcFS, rcDirectory, rcRemoving, rcDirectory, rcUnauthorized );
-                break;
-
-            default :
-                rc = RC ( rcFS, rcDirectory, rcCreating, rcNoObj, rcUnknown );
-                break;
-            }
-
-            print_error_for( path, "RemoveDirectoryW", rcRemoving, klogInfo);
-            return rc;
-        }
-    }
-    return 0;
-}
-
-
-static
-rc_t CC KSysDirRemove ( KSysDir *self, bool force, const char *path, va_list args )
-{
-    wchar_t dir_name [ MAX_PATH ];
-    rc_t rc = KSysDirMakePath ( self, rcRemoving, false, dir_name, sizeof dir_name, path, args );
-    if ( rc == 0 )
-        rc = KSysDirRemoveEntry ( dir_name, sizeof dir_name, force );
-    return rc;
-}
-
-/* KSysDirAccess
- *  get access to object
- *
- *  "access" [ OUT ] - return parameter for Unix access mode
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- */
-
-#define DEFAULT_WIN_ACCESS   0555
-#define DEFAULT_WRITE_ACCESS 0222
-
-
-/* FromMSDN */
-#define UNIX_EPOCH_IN_WIN       116444736000000000
-#define UINX_TIME_UNITS_IN_WIN  10000000
-static __inline__
-void KTimeToWinTime ( KTime_t unix, LPFILETIME win )
-{
-    uint64_t ll = ( ( unix * UINX_TIME_UNITS_IN_WIN ) + UNIX_EPOCH_IN_WIN );
-    win->dwLowDateTime = (DWORD)ll;
-    win->dwHighDateTime = ll >> 32;
-}
-
-
-static __inline__
-KTime_t WinTimeToKTime ( LPFILETIME win )
-{
-    uint64_t ll = (uint64_t)win->dwLowDateTime + ((int64_t)win->dwHighDateTime << 32);
-
-/*     DBGMSG(DBG_KFS,DBG_FLAG(DBG_KFS_DIR),("%s %x %x %lx %lx\n", */
-/*                                           __func__,win->dwLowDateTime,win->dwHighDateTime, */
-/*                                           ll,( ll - UNIX_EPOCH_IN_WIN ) / 10000000)); */
-
-    /* if its negative, so be it */
-    return ( ll - UNIX_EPOCH_IN_WIN ) / UINX_TIME_UNITS_IN_WIN;
-}
-
-
-static __inline
-rc_t get_attributes ( const wchar_t * wpath, uint32_t * access, KTime_t * date )
-{
-    WIN32_FIND_DATA fd;
-    rc_t rc;
-
-    if ( FindFirstFile ( wpath, &fd ))
-    {
-        if ( access != NULL )
-        {
-/* TBD - track user's main group and group Everyone */
-            *access = DEFAULT_WIN_ACCESS |
-                (((fd.dwFileAttributes & FILE_ATTRIBUTE_READONLY) == FILE_ATTRIBUTE_READONLY)
-                 ? 0 : DEFAULT_WRITE_ACCESS);
-        }
-        if ( date != NULL )
-        {
-            *date = WinTimeToKTime ( &fd.ftLastWriteTime );
-        }
-        return 0;
-    }
-/* TBD check values in error */
-    if ( access != NULL )
-        *access = 0;
-    if ( date != NULL )
-        *date = 0;
-
-    rc = print_error_for( wpath, "FindFirstFile", rcAccessing, klogErr );
-    return rc;
-}
-
-
-static
-rc_t CC KSysDirVAccess ( const KSysDir *self,
-    uint32_t *access, const char *path, va_list args )
-{
-    wchar_t winpath [ MAX_PATH ];
-    rc_t rc = KSysDirMakePath ( self, rcAccessing, false, winpath, sizeof winpath, path, args );
-    if ( rc == 0 )
-        rc = get_attributes ( winpath, access, NULL );
-    return rc;
-}
-
-/* KSysDirSetAccess
- *  set access to object a la Unix "chmod"
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- *
- *  "access" [ IN ] and "mask" [ IN ] - definition of change
- *  where "access" contains new bit values and "mask defines
- *  which bits should be changed.
- *
- *  "recurse" [ IN ] - if non zero and "path" is a directory,
- *  apply changes recursively.
- */
-static
-rc_t KSysDirChangeAccess ( char *path, size_t path_max,
-    uint32_t access, uint32_t mask, bool recurse );
-
-    
-static
-rc_t KSysDirChangeDirAccess ( char *path, size_t path_max,
-    uint32_t access, uint32_t mask )
-{
-    /*
-    KSysDirEnum list;
-    rc_t rc = KSysDirEnumInit ( & list, path );
-    if ( rc == 0 )
-    {
-        bool eperm = false;
-        size_t path_size = strlen ( path );
-        path [ path_size ] = '/';
-        if ( ++ path_size == path_max )
-            rc = RC(rcFS, rcDirectory, rcUpdating, rcBuffer, rcInsufficient );
-        else
-        {
-            const char *leaf;
-            while ( ( leaf = KSysDirEnumNext ( & list ) ) != NULL )
-            {
-                size_t leaf_size = strlen ( leaf );
-                if ( path_size + leaf_size >= path_max )
-                {
-                    rc = RC(rcFS, rcDirectory, rcUpdating, rcBuffer, rcInsufficient );
-                    break;
-                }
-
-                strcpy ( & path [ path_size ], leaf );
-                rc = KSysDirChangeAccess ( path, path_max, access, mask, 1 );
-                if ( rc != 0 )
-                {
-                    if ( GetRCState ( rc ) != rcUnauthorized )
-                        break;
-                    eperm = true;
-                    rc = 0;
-                }
-            }
-
-            path [ path_size - 1 ] = 0;
-        }
-
-        KSysDirEnumWhack ( & list );
-
-        if ( rc == 0 && eperm )
-            rc = RC(rcFS, rcDirectory, rcUpdating, rcDirectory, rcUnauthorized );
-    }
-    return rc;
-    */
-    return 0;
-}
-
-
-static
-rc_t KSysDirChangeEntryAccess ( char *path, size_t path_max,
-    uint32_t access, uint32_t mask, uint32_t st_mode )
-{
-#if 0
-    /* keep old bits
-       we have no chmod in Windows - leave it blank... */
-    access &= mask;
-    access |= st_mode & ~ mask;
-
-    if ( chmod ( path, access & 07777 ) != 0 )
-        switch ( errno )
-        {
-        case EPERM:
-        case EACCES:
-        case EROFS:
-            return RC(rcFS, rcDirectory, rcUpdating, rcDirectory, rcUnauthorized );
-        case ENOTDIR:
-        case ELOOP:
-            return RC(rcFS, rcDirectory, rcUpdating, rcPath, rcInvalid );
-        case ENAMETOOLONG:
-            return RC(rcFS, rcDirectory, rcUpdating, rcPath, rcExcessive );
-        case ENOENT:
-            return RC(rcFS, rcDirectory, rcUpdating, rcPath, rcNotFound );
-        case ENOMEM:
-            return RC(rcFS, rcDirectory, rcUpdating, rcMemory, rcExhausted );
-        default:
-            return RC(rcFS, rcDirectory, rcUpdating, rcNoObj, rcUnknown );
-        }
-#endif
-    return 0;
-}
-
-
-static
-rc_t KSysDirChangeAccess ( char *path, size_t path_max,
-    uint32_t access, uint32_t mask, bool recurse )
-{
-    /*
-    struct stat st;
-    if ( stat ( path, & st ) != 0 ) switch ( errno )
-    {
-    case ENOENT:
-        return RC(rcFS, rcDirectory, rcUpdating, rcPath, rcNotFound );
-    case ENOTDIR:
-    case ELOOP:
-        return RC(rcFS, rcDirectory, rcUpdating, rcPath, rcInvalid );
-    case ENAMETOOLONG:
-        return RC(rcFS, rcDirectory, rcUpdating, rcPath, rcExcessive );
-    case EACCES:
-        return RC(rcFS, rcDirectory, rcUpdating, rcDirectory, rcUnauthorized );
-    case ENOMEM:
-        return RC(rcFS, rcDirectory, rcUpdating, rcMemory, rcExhausted );
-    default:
-        return RC(rcFS, rcDirectory, rcUpdating, rcNoObj, rcUnknown );
-    }
-
-    if ( recurse && S_ISDIR ( st . st_mode ) )
-    {
-        rc_t rc;
-        uint32_t enable = access & mask;
-        if ( enable != 0 )
-        {
-            rc = KSysDirChangeEntryAccess ( path, path_max,
-                access, enable, st . st_mode );
-            if ( rc != 0 )
-                return rc;
-        }
-
-       rc = KSysDirChangeDirAccess ( path, path_max, access, mask );
-        if ( rc == 0 )
-        {
-            uint32_t disable = ~ access & mask;
-            if ( disable != 0 )
-            {
-                rc = KSysDirChangeEntryAccess ( path, path_max,
-                    access, disable, st . st_mode | enable );
-            }
-        }
-        return rc;
-    }
-
-    return KSysDirChangeEntryAccess ( path, path_max,
-         access, mask, st . st_mode );
-    */
-    return 0;
-}
-
-
-static
-rc_t CC KSysDirSetAccess ( KSysDir *self, bool recurse,
-    uint32_t access, uint32_t mask, const char *path, va_list args )
-{
-    rc_t rc = 0;
-    /*
-    char full[MAX_PATH];
-    rc_t rc = KSysDirMakePath ( self, rcUpdating, false, full, sizeof full, path, args );
-    if ( rc == 0 )
-    {
-        if ( mask == 0 )
-            mask = 07777;
-
-        rc = KSysDirChangeAccess ( full, sizeof full,
-            access, mask & 07777, recurse );
-    }
-    */
-    return rc;
-}
-
-
-/* make_dir()
- *  helper function that encapsulates the OS-specific call
- *  to create a directory - the return codes are used by the
- *  caller-functions to decide what to do in case of a error...
- *  the callers are: KSysDirCreateParents() and KSysDirCreateDir()
- *  special on windows: path is wchar_t and we ignore access !!!
- *  TBD: translate access into a windows security descriptor...
- *       find out the other possible ERROR_* 's produced 
- */
-static
-rc_t make_dir ( const wchar_t *path, uint32_t access )
-{
-    rc_t rc = 0;
-    /* try to create the directory */
-    if ( !CreateDirectoryW ( path, NULL ) )
-    {
-        DWORD error = GetLastError();
-        rc = translate_file_error( error, rcCreating );
-/*
-        Do not print an error code here, it is valid that this can happen!
-        rc = print_error_for( path, "CreateDirectoryW", rcCreating, klogErr );
-*/
-    }
-    return rc;
-}
-
-
-#if OLD_CREATE_PARENTS
-static
-rc_t check_and_make( wchar_t *path, uint32_t access )
-{
-    bool exists;
-    rc_t rc = directory_exists( path, &exists );
-    if ( rc == 0 && !exists )
-    {
-        rc = make_dir ( path, access );
-    }
-    return rc;
-}
-#endif
-
-
-/* KSysDirCreateParents
- *  creates missing parent directories
- *  Windows special: path is wide-char, separator is back-slash, 
- *  starts with drive-letter...
- */
-static
-rc_t KSysDirCreateParents ( const KSysDir *self, wchar_t *path, uint32_t access, bool strip )
-{
-#if ! OLD_CREATE_PARENTS
-    rc_t rc;
-    size_t len;
-    wchar_t *p, *par = path;
-
-    /* if directory is chroot'd, skip past root and slash */
-    if ( self -> root != 0 )
-        par += self -> root + 1;
-    else
-    {
-        /* skip drive letter */
-        if ( path [ 1 ] == ':' )
-            par += 2;
-    /* skip slashes, network or otherwise */
-        while ( par [ 0 ] == '\\' )
-            ++ par;
-    }
-
-    len = wcslen ( par );
-
-    if ( ! strip )
-        p = par + len;
-    else
-    {
-        p = wcsrchr ( par, '\\' );
-        if ( p == NULL )
-            return 0;
-        len = p - par;
-    }
-
-    while ( 1 )
-    {
-        /* crop string */
-        p [ 0 ] = 0;
-
-        /* try to create directory */
-        rc = make_dir ( path, access );
-        if ( GetRCState ( rc ) != rcNotFound )
-            break;
-
-        /* back up some more */
-        p = wcsrchr ( par, '\\' );
-        if ( p == NULL )
-        {
-            p = par + wcslen ( par );
-            break;
-        }
-    }
-
-    par += len;
-    assert ( p != NULL );
-
-    /* create directories from here */
-    if ( rc == 0 ) while ( p < par )
-    {
-        p [ 0 ] = '\\';
-        rc = make_dir ( path, access );
-        if ( rc != 0 || ++ p >= par )
-            break;
-        p += wcslen ( p );
-    }
-
-    /* repair stripped path */
-    if ( strip )
-        par [ 0 ] = '\\';
-
-    return rc;
-
-#else
-
-    rc_t rc;
-    wchar_t *separator = path;
-    bool finished;
-
-    do
-    {
-        /* find the next separator */
-        separator = wcschr( separator + 1, '\\' );
-
-        /* we are finished, if not found */
-        finished = (bool)( separator == NULL );
-        if ( !finished )
-        {
-            /* temporary terminate at the separator */
-            *separator = 0;
-            rc = check_and_make( path, access );
-            finished = (bool)( rc != 0 );
-            /* put the terminator back in place... */
-            *separator = '\\';
-        }
-    } while ( !finished );
-
-    /* finally test and make the whole path... */
-    rc = check_and_make( path, access );
-
-    return rc;
-#endif
-}
-
-/* KSysDirCreateAlias
- *  creates a path alias according to create mode
- *
- *  "targ" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- *
- *  "alias" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target alias
- *
- *  "access" [ IN ] - standard Unix directory access mode
- *  used when "mode" has kcmParents set and alias path does
- *  not exist.
- *
- *  "mode" [ IN ] - a creation mode ( see explanation above ).
- */
-static
-rc_t CC KSysDirCreateAlias ( KSysDir *self, uint32_t access, KCreateMode mode,
-                             const char *targ, const char *alias )
-{
-    wchar_t w_target[ MAX_PATH ];
-    rc_t rc = KSysDirMakePath ( self, rcCreating, true, w_target, sizeof w_target, targ, NULL );
-    if ( rc == 0 )
-    {
-        wchar_t w_alias[ MAX_PATH ];
-        rc = KSysDirMakePath ( self, rcCreating, true, w_alias, sizeof w_alias, alias, NULL );
-        if ( rc == 0 )
-        {
-            bool alias_ok = true;
-            if ( ! has_lnk_extension( w_alias ) ) /* lnk_tools.c */
-                alias_ok = add_lnk_extension( w_alias, sizeof w_alias ); /* lnk_tools.c */
-
-            if ( lnk_file_exists( w_alias ) )
-            {
-                DeleteFileW( w_alias );
-                alias_ok = ( ! lnk_file_exists( w_alias ) );
-            }
-
-            if ( alias_ok )
-            {
-                /* if "alias" is relative or "self" is chroot'd,
-                   "w_alias" must be made relative */
-                if ( alias [ 0 ] != '/' || self -> root != 0 )
-                {
-                    rc = KSysDirRelativePath ( self, rcCreating, w_alias, w_target, sizeof w_target );
-                    if ( rc != 0 )
-                        return rc;
-                }
-                if ( win_CreateLink( w_target, w_alias, NULL ) ) /* lnk_tools.c */
-                    rc = 0;
-                else
-                    rc = translate_file_error( GetLastError (), rcCreating );
-            }
-            else
-                rc = RC ( rcFS, rcDirectory, rcCreating, rcMemory, rcExhausted ); 
-        }
-    }
-    return rc;
-}
-
-
-/* KSysDirOpenFileRead
- *  opens an existing file with read-only access
- *
- *  "f" [ OUT ] - return parameter for newly opened file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- */
-static
-rc_t CC KSysDirOpenFileRead ( const KSysDir *self,
-    const KFile **f, const char *path, va_list args )
-{
-    wchar_t file_name[ MAX_PATH ];
-    rc_t rc = KSysDirMakePath( self, rcOpening, false, file_name, sizeof file_name, path, args );
-    if ( rc == 0 )
-    {
-        HANDLE file_handle = CreateFileW( file_name, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, 
-                                OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
-        if ( file_handle == INVALID_HANDLE_VALUE )
-        {
-            rc = print_error_for( file_name, "CreateFileW", rcOpening, klogInfo );
-        }
-        else
-        {
-            char buffer[ MAX_PATH ];
-            wchar_2_char( file_name, buffer, sizeof buffer );
-            rc = KSysFileMake ( ( KSysFile** ) f, file_handle, buffer, true, false );
-            if ( rc != 0 )
-                CloseHandle ( file_handle );
-        }
-    }
-    return rc;
-}
-
-/* KSysDirOpenFileWrite
- *  opens an existing file with write access
- *
- *  "f" [ OUT ] - return parameter for newly opened file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- *
- *  "update" [ IN ] - if non-zero, open in read/write mode
- *  otherwise, open in write-only mode
- */
-static
-rc_t CC KSysDirOpenFileWrite ( KSysDir *self,
-    KFile **f, bool update, const char *path, va_list args )
-{
-    wchar_t file_name[ MAX_PATH ];
-    rc_t rc = KSysDirMakePath ( self, rcOpening, false, file_name, sizeof file_name, path, args );
-    if ( rc == 0 )
-    {
-        DWORD dwDesiredAccess = update ? GENERIC_READ | GENERIC_WRITE : GENERIC_WRITE;
-        HANDLE file_handle = CreateFileW( file_name, dwDesiredAccess, FILE_SHARE_READ, NULL, 
-                                OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );
-
-        if ( file_handle == INVALID_HANDLE_VALUE )
-        {
-            rc = print_error_for( file_name, "CreateFileW", rcAccessing, klogErr );
-
-        }
-        else
-        {
-            char buffer[ MAX_PATH ];
-            wchar_2_char( file_name, buffer, sizeof buffer );
-            rc = KSysFileMake ( ( KSysFile** ) f, file_handle, buffer, update, true );
-            if ( rc != 0 )
-                CloseHandle ( file_handle );
-        }
-    }
-    return rc;
-}
-
-/* KSysDirCreateFile
- *  opens a file with write access
- *
- *  "f" [ OUT ] - return parameter for newly opened file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- *
- *  "access" [ IN ] - standard Unix access mode, e.g. 0664
- *
- *  "update" [ IN ] - if non-zero, open in read/write mode
- *  otherwise, open in write-only mode
- *
- *  "mode" [ IN ] - a creation mode ( see explanation above ).
- */
-static
-rc_t CC KSysDirCreateFile ( KSysDir *self, KFile **f, bool update,
-    uint32_t access, KCreateMode cmode, const char *path, va_list args )
-{
-    wchar_t file_name[ MAX_PATH ];
-    rc_t rc = KSysDirMakePath( self, rcCreating, true, file_name, sizeof file_name, path, args );
-    if ( rc == 0 )
-    {
-        HANDLE file_handle;
-        DWORD dwDesiredAccess = update ? GENERIC_READ | GENERIC_WRITE : GENERIC_WRITE;
-        DWORD dwCreationDisposition = CREATE_ALWAYS;
-
-        switch ( cmode & kcmValueMask )
-        {
-        case kcmOpen : /* open if it exists, create if it does not exist */
-            dwCreationDisposition = OPEN_ALWAYS;
-            break;
-
-        case kcmInit : /* always create, if it already exists truncate to zero */
-            dwCreationDisposition = CREATE_ALWAYS;
-            break;
-
-        case kcmCreate : /* create and open only if does not already exist */
-            dwCreationDisposition = CREATE_NEW;
-            break;
-        }
-
-        file_handle = CreateFileW ( file_name, dwDesiredAccess, FILE_SHARE_READ,
-            NULL, dwCreationDisposition, FILE_ATTRIBUTE_NORMAL, NULL );
-        while ( file_handle == INVALID_HANDLE_VALUE )
-        {
-            DWORD error;
-
-            if ( ( cmode & kcmParents ) != 0 )
-            {
-                /* maybe there were missing parent directories */
-                uint32_t dir_access = access |
-                    ( ( access & 0444 ) >> 2 ) | ( ( access & 0222 ) >> 1 );
-                KSysDirCreateParents ( self, file_name, dir_access, true );
-
-                /* try creating the file again */
-                file_handle = CreateFileW ( file_name, dwDesiredAccess, FILE_SHARE_READ,
-                    NULL, dwCreationDisposition, FILE_ATTRIBUTE_NORMAL, NULL );
-                if ( file_handle != INVALID_HANDLE_VALUE )
-                    break;
-            }
-
-            error = GetLastError();
-            rc = translate_file_error( error, rcCreating );
-
-            /* disabled 12/12/2012 : it prints an error message, if vdb tries to open
-               the same reference-object twice via http. The lock-file for the 2nd try
-               does already exist. This is not an error, just a condition. */
-
-            /*
-            PLOGERR ( klogErr,
-                      ( klogErr, rc, "error CreateFileW - $(E) - $(C)",
-                        "E=%!,C=%u", error, error ) ); 
-            */
-
-            /* Unix code has a special case when creating an empty file, which is
-               to say, creating a directory entry without needing to write to file */
-            return rc;
-        }
-
-        {
-            char buffer[ MAX_PATH ];
-            wchar_2_char( file_name, buffer, sizeof buffer );
-            rc = KSysFileMake ( ( KSysFile** ) f, file_handle, path, update, true );
-            if ( rc != 0 )
-                CloseHandle ( file_handle );
-        }
-    }
-    return rc;
-}
-
-/* KSysDirFileSize
- *  returns size in bytes of target file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- *
- *  "size" [ OUT ] - return parameter for file size
- */
-static
-rc_t CC KSysDirFileSize ( const KSysDir *self,
-    uint64_t *size, const char *path, va_list args )
-{
-    wchar_t file_name[ MAX_PATH ];
-    rc_t rc = KSysDirMakePath( self, rcAccessing, false, file_name, sizeof file_name, path, args );
-    if ( rc == 0 )
-    {
-        WIN32_FILE_ATTRIBUTE_DATA file_data;
-        if ( GetFileAttributesEx ( file_name, GetFileExInfoStandard, &file_data ) )
-        {
-            *size = file_data.nFileSizeHigh;
-            *size <<= 32;
-            *size |= file_data.nFileSizeLow;
-        }
-        else
-        {
-            rc = print_error_for( file_name, "GetFileAttributesEx", rcAccessing, klogErr );
-        }
-    }
-    return rc;
-}
-
-/* KSysDirSetFileSize
- *  sets size in bytes of target file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- *
- *  "size" [ IN ] - new file size
- */
-static
-rc_t CC KSysDirSetFileSize ( KSysDir *self,
-    uint64_t size, const char *path, va_list args )
-{
-    wchar_t file_name[ MAX_PATH ];
-    rc_t rc = KSysDirMakePath ( self, rcUpdating, false, file_name, sizeof file_name, path, args );
-    if ( rc == 0 )
-    {
-        HANDLE file_handle = CreateFileW( file_name, GENERIC_READ | GENERIC_WRITE, 0, NULL, 
-                                OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );
-        if ( file_handle != INVALID_HANDLE_VALUE )
-        {
-            DWORD file_pos_low, file_pos_high, file_set_res;
-
-            file_pos_low = (DWORD)( size & 0xFFFFFFFF );
-            size >>= 32;
-            file_pos_high = (DWORD)( size & 0xFFFFFFFF );
-            file_set_res = SetFilePointer ( file_handle, file_pos_low, (PLONG)&file_pos_high, FILE_BEGIN );
-            if ( file_set_res != INVALID_SET_FILE_POINTER )
-            {
-                if ( SetEndOfFile ( file_handle ) )
-                    rc = 0; /* success !!! */
-                else
-                    rc = translate_file_error( GetLastError(), rcUpdating );
-            }
-            CloseHandle ( file_handle );
-        }
-        else
-        {
-            rc = print_error_for( file_name, "CreateFileW", rcUpdating, klogErr );
-        }
-    }
-    return rc;
-}
-
-/* KSysDirOpenDirRead
- * KSysDirOpenDirUpdate
- *  opens a sub-directory
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target directory
- *
- *  "chroot" [ IN ] - if non-zero, the new directory becomes
- *  chroot'd and will interpret paths beginning with '/'
- *  relative to itself.
- */
-static
-rc_t CC KSysDirOpenDirRead ( const KSysDir *self,
-     const KDirectory **subp, bool chroot, const char *path, va_list args )
-{
-    wchar_t dir_name[ MAX_PATH ];
-    rc_t rc = KSysDirMakePath ( self, rcOpening, true, dir_name, sizeof dir_name, path, args );
-    if ( rc == 0 )
-    {
-        KSysDir *sub;
-
-        size_t dir_size;
-        uint32_t dir_length = utf16_string_measure( dir_name, &dir_size );
-        uint32_t length_org = dir_length;
-        while ( dir_length > 0 && dir_name [ dir_length - 1 ] == '/' )
-            dir_name [ -- dir_length ] = 0;
-        if ( dir_length != length_org )
-            dir_length = utf16_string_measure( dir_name, &dir_size );
-
-        if ( ( KSysDirFullPathType ( dir_name ) & ( kptAlias - 1 ) ) != kptDir )
-            return RC(rcFS, rcDirectory, rcOpening, rcPath, rcIncorrect );
-
-        sub = KSysDirMake ( dir_size );
-        if ( sub == NULL )
-            rc = RC(rcFS, rcDirectory, rcOpening, rcMemory, rcExhausted );
-        else
-        {
-            rc = KSysDirInit ( sub, rcOpening, self -> root, dir_name, 
-                               dir_size, dir_length, false, chroot );
-            if ( rc == 0 )
-            {
-                * subp = & sub -> dad;
-                return 0;
-            }
-
-            free ( sub );
-        }
-    }
-    return rc;
-}
-
-static
-rc_t CC KSysDirOpenDirUpdate ( KSysDir *self,
-    KDirectory **subp, bool chroot, const char *path, va_list args )
-{
-    wchar_t dir_name[ MAX_PATH ];
-    rc_t rc = KSysDirMakePath ( self, rcOpening, true, dir_name, sizeof dir_name, path, args );
-    if ( rc == 0 )
-    {
-        KSysDir *sub;
-
-        size_t dir_size;
-        uint32_t dir_length = utf16_string_measure( dir_name, &dir_size );
-        uint32_t length_org = dir_length;
-        while ( dir_length > 0 && dir_name [ dir_length - 1 ] == '/' )
-            dir_name [ -- dir_length ] = 0;
-        if ( dir_length != length_org )
-            dir_length = utf16_string_measure( dir_name, &dir_size );
-
-        switch ( KSysDirFullPathType ( dir_name ) )
-        {
-        case kptNotFound:
-            return RC( rcFS, rcDirectory, rcOpening, rcPath, rcNotFound );
-        case kptBadPath:
-            return RC( rcFS, rcDirectory, rcOpening, rcPath, rcInvalid );
-        case kptDir:
-        case kptDir | kptAlias:
-            break;
-        default:
-            return RC( rcFS, rcDirectory, rcOpening, rcPath, rcIncorrect );
-        }
-
-        sub = KSysDirMake ( dir_size );
-        if ( sub == NULL )
-            rc = RC( rcFS, rcDirectory, rcOpening, rcMemory, rcExhausted );
-        else
-        {
-            rc = KSysDirInit ( sub, rcOpening, self -> root, dir_name, 
-                               dir_size, dir_length, true, chroot );
-            if ( rc == 0 )
-            {
-                * subp = & sub -> dad;
-                return 0;
-            }
-
-            free ( sub );
-        }
-    }
-    return rc;
-}
-
-/* KSysDirCreateDir
- *  create a sub-directory
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target directory
- *
- *  "access" [ IN ] - standard Unix directory permissions
- *
- *  "mode" [ IN ] - a creation mode ( see explanation above ).
- */
-static
-rc_t CC KSysDirCreateDir ( KSysDir *self,
-    uint32_t access, KCreateMode mode, const char *path, va_list args )
-{
-    wchar_t dir_name[ MAX_PATH ];
-    rc_t rc = KSysDirMakePath ( self, rcCreating, true, dir_name, sizeof dir_name, path, args );
-    if ( rc == 0 )
-    {
-        if ( ( mode & kcmValueMask ) == kcmCreate )
-        {
-            switch ( KSysDirFullPathType ( dir_name ) )
-            {
-            case kptNotFound:
-                break;
-            case kptBadPath:
-                return RC(rcFS, rcDirectory, rcCreating, rcPath, rcInvalid );
-            case kptDir:
-                return RC(rcFS, rcDirectory, rcCreating, rcDirectory, rcExists );
-            default:
-                return RC(rcFS, rcDirectory, rcCreating, rcPath, rcIncorrect );
-            }
-        }
-        rc = make_dir ( dir_name, access );
-        if ( rc != 0 )
-        {
-            switch ( GetRCState ( rc ) )
-            {
-            case rcExists:
-                rc = 0;
-                if ( ( mode & kcmValueMask ) == kcmInit )
-                    rc = KSysDirEmptyDir ( dir_name, sizeof dir_name, 1 );
-                break;
-            case rcNotFound:
-                if ( ( mode & kcmParents ) != 0 )
-                    rc = KSysDirCreateParents ( self, dir_name, access, false );
-                break;
-            }
-        }
-    }
-    return rc;
-}
-
-/* KSysDirDate
- *  get access to object
- *
- *  "date" [ OUT ] - return parameter for Unix access mode
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- */
-static
-rc_t CC KSysDirVDate ( const KSysDir *self,
-    KTime_t * date, const char *path, va_list args )
-{
-    wchar_t full [ MAX_PATH ];
-    rc_t rc = KSysDirMakePath ( self, rcAccessing, false, full, sizeof full, path, args );
-    if ( rc == 0 )
-    {
-        rc = get_attributes ( full, NULL, date );
-    }
-    return rc;
-}
-
-
-static
-rc_t change_item_date( wchar_t *path, LPFILETIME win_time, bool dir_flag )
-{
-    rc_t rc;
-    HANDLE file_handle;
-
-    if ( dir_flag )
-        file_handle = CreateFileW( path, GENERIC_READ | GENERIC_WRITE, 0, NULL, 
-                                   OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL );
-    else
-        file_handle = CreateFileW( path, GENERIC_READ | GENERIC_WRITE, 0, NULL, 
-                                   OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );
-    if ( file_handle == INVALID_HANDLE_VALUE )
-    {
-        rc = print_error_for( path, "CreateFileW", rcUpdating, klogErr );
-    }
-    else
-    {
-        if ( SetFileTime ( file_handle, NULL, NULL, win_time ) )
-        {
-            rc = 0;
-        }
-        else
-        {
-            rc = print_error_for( path, "SetFileTime", rcUpdating, klogErr );
-        }
-        CloseHandle ( file_handle );
-    }
-
-    return rc;
-}
-
-
-static
-rc_t change_dir_date( wchar_t *path, size_t path_max, LPFILETIME win_time, bool recurse )
-{
-    KSysDirEnum list;
-    const wchar_t *leaf;
-    size_t path_size;
-    uint32_t path_length;
-
-    rc_t rc = change_item_date( path, win_time, true );
-    if ( rc != 0 || !recurse )
-        return rc;
-
-    path_length = wchar_string_measure ( path, &path_size );
-    if ( ( path_size + 10 ) > path_max )
-        return RC( rcFS, rcDirectory, rcListing, rcMemory, rcExhausted );
-
-    rc = KSysDirEnumInitAll ( & list, path, path_length );
-    if ( rc != 0 )
-        return ResetRCContext ( rc, rcFS, rcDirectory, rcUpdating );
-
-    /* we keep only the appended '\\' for the loop... */
-    path_length++;
-    path_size += sizeof *path;
-
-    for ( leaf = KSysDirEnumNext( &list ); 
-          leaf != NULL && rc == 0; 
-          leaf = KSysDirEnumNext( &list ) )
-    {
-        size_t leaf_size;
-        int32_t path_type;
-        uint32_t leaf_length = wchar_string_measure ( leaf, &leaf_size );
-        if ( path_size + leaf_size >= path_max )
-            rc = RC ( rcFS, rcDirectory, rcUpdating, rcPath, rcExcessive );
-        else
-        {
-
-            /* wcscpy adds termination, so wprintf is safe to call */
-            wcscpy ( & path [ path_length ], leaf );
-
-            path_type = KSysDirFullPathType ( path );
-            switch( path_type )
-            {
-            case kptFile : rc = change_item_date( path, win_time, false );
-                           break;
-            case kptDir  : rc = change_dir_date( path, path_max, win_time, true );
-                           break;
-            }
-        }
-    }
-
-    KSysDirEnumWhack ( & list );
-    /* restore the original path... */
-    path [ path_length - 1 ] = 0;
-
-    return rc;
-}
-
-
-static
-rc_t KSysDirChangeDate ( wchar_t *path, size_t path_max,
-            KTime_t date, bool recurse )
-{
-    FILETIME win_time;
-    int32_t path_type;
-    rc_t rc;
-
-    KTimeToWinTime ( date, &win_time );
-    path_type = KSysDirFullPathType ( path );
-    switch( path_type )
-    {
-    case kptFile : rc = change_item_date( path, &win_time, false );
-                   break;
-
-    case kptDir  : rc = change_dir_date( path, path_max, &win_time, recurse );
-                   break;
-
-    default      : rc = RC( rcFS, rcDirectory, rcUpdating, rcNoObj, rcUnsupported );
-                   break;
-    }
-    return rc;
-}    
-
-
-/*
-    struct stat st;
-    struct utimbuf u;
-
-    if ( stat ( path, & st ) != 0 ) switch ( errno )
-    {
-    case ENOENT:
-        return RC ( rcFS, rcDirectory, rcUpdating, rcPath, rcNotFound );
-    case ENOTDIR:
-    case ELOOP:
-        return RC ( rcFS, rcDirectory, rcUpdating, rcPath, rcInvalid );
-    case ENAMETOOLONG:
-        return RC ( rcFS, rcDirectory, rcUpdating, rcPath, rcExcessive );
-    case EACCES:
-        return RC ( rcFS, rcDirectory, rcUpdating, rcDirectory, rcUnauthorized );
-    case ENOMEM:
-        return RC ( rcFS, rcDirectory, rcUpdating, rcMemory, rcExhausted );
-    default:
-        return RC ( rcFS, rcDirectory, rcUpdating, rcNoObj, rcUnknown );
-    }
-    u . actime = u . modtime = date;
-
-    if ( recurse && S_ISDIR ( st . st_mode ) )
-    {
-        rc_t rc;
-
-    rc = KSysDirChangeEntryDate ( path, path_max, & u );
-    if ( rc != 0 )
-        return rc;
-
-    rc = KSysDirChangeDirDate ( path, path_max, date );
-        if ( rc == 0 )
-        {
-        rc = KSysDirChangeEntryDate ( path, path_max, & u  );
-        }
-        return rc;
-    }
-
-    return  KSysDirChangeEntryDate ( path, path_max, & u );
-*/
-
-static
-rc_t CC KSysDirVSetDate ( KSysDir * self, bool recurse,
-    KTime_t date, const char *path, va_list args )
-{
-    wchar_t full [ MAX_PATH ];
-    rc_t rc = KSysDirMakePath ( self, rcUpdating, false, full, sizeof full, path, args );
-    if ( rc == 0 )
-    {
-        rc = KSysDirChangeDate ( full, sizeof full, date, recurse );
-    }
-    return rc;
-}
-
-static
-KSysDir *CC KSysDirGetSysdir ( const KSysDir *cself )
-{
-    return ( KSysDir* ) cself;
-}
-
-static KDirectory_vt_v1 vtKSysDir =
-{
-    /* version 1.0 */
-    1, 1,
-
-    /* start minor version 0 methods*/
-    KSysDirDestroy,
-    KSysDirList,
-
-    /* the following two messages map to the same method, requiring type casting */
-    ( rc_t ( CC * )  ( const KSysDir*, bool,
-        rc_t ( CC * ) ( const KDirectory*, uint32_t, const char*, void* ), void*,
-        const char*, va_list ) ) KSysDirVisit,
-    ( rc_t ( CC * )  ( KSysDir*, bool,
-        rc_t ( CC * ) ( KDirectory*, uint32_t, const char*, void* ), void*,
-        const char*, va_list ) ) KSysDirVisit,
-
-    KSysDirPathType,
-    KSysDirResolvePath,
-    KSysDirResolveAlias,
-    KSysDirRename,
-    KSysDirRemove,
-    KSysDirClearDir,
-    KSysDirVAccess,
-    KSysDirSetAccess,
-    KSysDirCreateAlias,
-    KSysDirOpenFileRead,
-    KSysDirOpenFileWrite,
-    KSysDirCreateFile,
-    KSysDirFileSize,
-    KSysDirSetFileSize,
-    KSysDirOpenDirRead,
-    KSysDirOpenDirUpdate,
-    KSysDirCreateDir,
-    NULL, /* we don't track files*/
-    /* end minor version 0 methods*/
-
-    /* start minor version 1 methods*/
-    KSysDirVDate,
-    KSysDirVSetDate,
-    KSysDirGetSysdir
-    /* end minor version 1 methods*/
-};
-
-/* KSysDirInit
- */
-#if TRACK_REFERENCES
-static
-const char *convert_wide_path ( const wchar_t *path, const size_t path_size )
-{
-    /* copy wide string to static */
-    static char static_path [ MAX_PATH ];
-    wchar_cvt_string_copy ( static_path, sizeof static_path, path, path_size );
-
-    return static_path;
-}
-#else
-#define convert_wide_path( path, path_size ) "ignore"
-#endif
-
-static
-rc_t KSysDirInit ( KSysDir *self, enum RCContext ctx, uint32_t dad_root,
-                   const wchar_t *path, size_t path_size, uint32_t path_length, 
-                   bool update, bool chroot )
-{
-    rc_t rc;
-    if ( path == NULL )
-    {
-        rc = KDirectoryInit( &self->dad, (const KDirectory_vt*)&vtKSysDir, 
-                            "KSysDir", NULL, update );
-    }
-    else
-    {
-        rc = KDirectoryInit( &self->dad, (const KDirectory_vt*)&vtKSysDir, 
-                             "KSysDir", convert_wide_path ( path, path_size ), update );
-    }
-
-    if ( rc != 0 )
-    {
-        return ResetRCContext ( rc, rcFS, rcDirectory, ctx );
-    }
-
-    if ( path != NULL )
-    {
-        memcpy( self->path, path, path_size );
-    }
-
-    self->root = chroot ? path_length : dad_root;
-    self->length = path_length + 1;
-    self->path[ path_length ] = '\\';
-    self->path[ path_length + 1 ] = 0;
-    return 0;
-}
-
-
-/* MakeFromRealPath
- *  creates a KDirectory from a Windows path
- */
-rc_t KDirectoryMakeFromRealPath ( KDirectory **dirp, const wchar_t *real, bool update, bool chroot )
-{
-    rc_t rc;
-    size_t size;
-    uint32_t length = wchar_string_measure ( real, & size );
-    if ( length + 4 > MAX_PATH )
-        rc = RC ( rcFS, rcDirectory, rcCreating, rcPath, rcExcessive );
-    else
-    {
-        KSysDir *dir = KSysDirMake ( size );
-        if ( dir == NULL )
-            rc = RC ( rcFS, rcDirectory, rcAccessing, rcMemory, rcExhausted );
-        else
-        {
-            rc = KSysDirInit ( dir, rcAccessing, 0, real, size, length, update, chroot );
-            if ( rc == 0 )
-            {
-                * dirp = & dir -> dad;
-                return 0;
-            }
-            KSysDirDestroy ( dir );
-        }
-    }
-
-    * dirp = NULL;
-    return rc;
-}
-
-/* KDirectoryNativeDir
- *  returns a native file-system directory node reference
- *  the directory root will be "/" and set to the native
- *  idea of current working directory
- *
- *  NB - the returned reference will be non-const, allowing
- *  modification operations to be attempted. these operations
- *  may still fail if the underlying FS disallows them.
- *
- *  "dir" [ OUT ] - return parameter for native directory
- */
-extern rc_t CC ReportCWD ( const ReportFuncs *f, uint32_t indent );
-extern rc_t CC ReportRedirect ( KWrtHandler* handler,
-    const char* filename, bool* to_file, bool finalize );
-
-LIB_EXPORT rc_t CC KDirectoryNativeDir ( KDirectory **dirp )
-{
-    rc_t rc;
-
-    static bool latch;
-    if ( ! latch )
-    {
-        ReportInitKFS ( ReportCWD, ReportRedirect );
-        latch = true;
-    }
-
-    if ( dirp == NULL )
-        rc = RC ( rcFS, rcDirectory, rcAccessing, rcParam, rcNull );
-    else
-    {
-        wchar_t wd [ MAX_PATH ];
-        DWORD error;
-        DWORD wd_len = GetCurrentDirectoryW ( sizeof wd / sizeof wd [ 0 ], wd );
-        if ( wd_len != 0 )
-            return KDirectoryMakeFromRealPath ( dirp, wd, true, false );
-
-        error = GetLastError();
-        switch ( error )
-        {
-        case ERROR_ACCESS_DENIED:
-            rc = RC ( rcFS, rcDirectory, rcAccessing, rcDirectory, rcUnauthorized );
-            break;
-        default:
-            rc = RC ( rcFS, rcDirectory, rcAccessing, rcNoObj, rcUnknown );
-        }
-        PLOGERR ( klogErr,
-                  ( klogErr, rc, "error GetCurrentDirectoryW - $(E) - $(C)",
-                    "E=%!,C=%u", error, error ) ); 
-
-        * dirp = NULL;
-    }
-
-    return rc;
-}
-
-
-/* RealPath
- *  exposes functionality of system directory
- */
-LIB_EXPORT rc_t CC KSysDirRealPath ( struct KSysDir const *self,
-    char *real, size_t bsize, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KSysDirVRealPath ( self, real, bsize, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KSysDirVRealPath ( struct KSysDir const *self,
-    char *real, size_t bsize, const char *path, va_list args )
-{
-    /* Windows is ... challenged when it comes to answering
-       this question. What is needed is to 1) convert the path
-       to a Windows-style wchar path, then 2) resolve each of
-       its components, etc. to come up with a real path, then
-       3) rewrite the path as a UTF-8 POSIX path */
-    return KSysDirResolvePath ( self, true, real, bsize, path, args );
-}
diff --git a/libs/kfs/win/sysdll.c b/libs/kfs/win/sysdll.c
deleted file mode 100644
index b439843..0000000
--- a/libs/kfs/win/sysdll.c
+++ /dev/null
@@ -1,1410 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _WIN32_WINNT /* This file requires OS newer than Windows 2000 */
-# define _WIN32_WINNT 0x0501
-#endif
-
-#include <kfs/extern.h>
-
-#define TRACK_REFERENCES 0
-
-#include "va_copy.h"
-#include "sysdir-priv.h"
-
-#include <kfs/dyload.h>
-#include <kfs/directory.h>
-#include <kfs/kfs-priv.h>
-#include <klib/refcount.h>
-#include <klib/vector.h>
-#include <klib/text.h>
-#include <klib/out.h>
-#include <klib/log.h>
-#include <klib/status.h>
-#include <klib/debug.h>
-#include <klib/rc.h>
-#include <os-native.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <assert.h>
-
-#include <WINDOWS.H>
-
-#if _STATIC
-#define ALWAYS_ADD_EXE 1
-#endif
-
-
-
-/*--------------------------------------------------------------------------
- * WString
- */
-typedef struct WString WString;
-struct WString
-{
-    const wchar_t *addr;
-    size_t size;
-    uint32_t len;
-};
-
-#define WStringInit( s, val, sz, length ) \
-    StringInit ( s, val, sz, length )
-
-#define WStringInitCString( s, cstr ) \
-    ( void ) ( ( s ) -> len = ( uint32_t )( wcslen ( ( s ) -> addr = ( cstr ) ) ), \
-               ( s ) -> size = ( ( size_t ) ( s ) -> len * sizeof ( wchar_t ) ) )
-
-#define CONST_WSTRING( s, val ) \
-    WStringInitCString ( s, L ## val )
-
-static
-int WStringCaseCompare ( const WString *a, const WString *b )
-{
-    int diff;
-
-    uint32_t min_len = a -> len;
-    if ( a -> len > b -> len )
-        min_len = b -> len;
-
-    diff = _wcsnicmp ( a -> addr, b -> addr, min_len );
-    if ( diff == 0 )
-        diff = ( int ) a -> len - ( int ) b -> len;
-
-    return diff;
-}
-
-
-/*--------------------------------------------------------------------------
- * KDirectory
- */
-static
-void CC KDirRefRelease ( void *item, void *ignore )
-{
-    KDirectoryRelease ( ( const void* ) item );
-}
-
-/*--------------------------------------------------------------------------
- * KDyld
- *  dynamic library loader
- *
- *  maintains cache of libraries it has opened while they remain open
- *  such that subsequent requests for an open library will return a
- *  new reference to the existing library.
- */
-struct KDyld
-{
-    Vector search;
-    KRefcount refcount;
-};
-
-
-/* Whack
- */
-static
-rc_t KDyldWhack ( KDyld *self )
-{
-    KRefcountWhack ( & self -> refcount, "KDyld" );
-
-    VectorWhack ( & self -> search, KDirRefRelease, NULL );
-    free ( self );
-
-    return 0;
-}
-
-
-/* Make
- *  create a dynamic loader object
- *
- *  "dl" [ OUT ] - return parameter for loader
- */
-LIB_EXPORT rc_t CC KDyldMake ( KDyld **dlp )
-{
-    rc_t rc;
-
-    if ( dlp == NULL )
-        rc = RC ( rcFS, rcDylib, rcConstructing, rcParam, rcNull );
-    else
-    {
-        KDyld *dl = malloc ( sizeof * dl );
-        if ( dl == NULL )
-            rc = RC ( rcFS, rcDylib, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            VectorInit ( & dl -> search, 1, 8 );
-            KRefcountInit ( & dl -> refcount, 1, "KDyld", "make", "dl" );
-
-            * dlp = dl;
-            return 0;
-        }
-
-        * dlp = NULL;
-    }
-
-    return rc;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KDyldAddRef ( const KDyld *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KDyld" ) )
-        {
-        case krefLimit:
-            return RC ( rcFS, rcDylib, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KDyldRelease ( const KDyld *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KDyld" ) )
-        {
-        case krefWhack:
-            return KDyldWhack ( ( KDyld* ) self );
-        case krefNegative:
-            return RC ( rcFS, rcDylib, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/* Attach
- * Sever
- */
-static
-KDyld *KDyldAttach ( const KDyld *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAddDep ( & self -> refcount, "KDyld" ) )
-        {
-        case krefLimit:
-            return NULL;
-        }
-    }
-    return ( KDyld* ) self;
-}
-
-static
-rc_t KDyldSever ( const KDyld *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDropDep ( & self -> refcount, "KDyld" ) )
-        {
-        case krefWhack:
-            return KDyldWhack ( ( KDyld* ) self );
-        case krefNegative:
-            return RC ( rcFS, rcDylib, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/* AddSearchPath
- *  add a search path to loader for locating library files
- */
-LIB_EXPORT rc_t CC KDyldVAddSearchPath ( KDyld *self, const char *path, va_list args )
-{
-    rc_t rc;
-    if ( self == NULL )
-        rc = RC ( rcFS, rcDylib, rcUpdating, rcSelf, rcNull );
-    else
-    {
-        KDirectory *wd;
-        rc = KDirectoryNativeDir ( & wd );
-        if ( rc == 0 )
-        {
-            const KDirectory *dir;
-            rc = KDirectoryVOpenDirRead ( wd, & dir, false, path, args );
-            if ( rc == 0 )
-            {
-                rc = VectorAppend ( & self -> search, NULL, dir );
-                if ( rc != 0 )
-                    KDirectoryRelease ( dir );
-            }
-
-            KDirectoryRelease ( wd );
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDyldAddSearchPath ( KDyld *self, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDyldVAddSearchPath ( self, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-static
-void KDyldForEach ( const KDyld *self,
-    void ( CC * f ) ( const KDirectory *dir, void *data ), void *data )
-{
-    VectorForEach ( & self -> search, false,
-        ( void ( CC * ) ( void*, void* ) ) f, data );
-}
-
-
-/* HomeDirectory
- *  returns a KDirectory where the binary for a given function is located
- *
- *  "dir" [ OUT ] - return paraeter for home directory, if found
- *
- *  "func" [ IN ] - function pointer within binary to be located
- */
-LIB_EXPORT rc_t CC KDyldHomeDirectory ( const KDyld *self, const KDirectory **dir, fptr_t func )
-{
-    rc_t rc;
-
-    if ( dir == NULL )
-        rc = RC ( rcFS, rcDylib, rcSearching, rcParam, rcNull );
-    else
-    {
-        * dir = NULL;
-
-        if ( self == NULL )
-            rc = RC ( rcFS, rcDylib, rcSearching, rcSelf, rcNull );
-        else if ( func == NULL )
-            rc = RC ( rcFS, rcDylib, rcSearching, rcFunction, rcNull );
-        else
-        {
-            HMODULE h;
-            /* casting a function pointer to a string pointer because the Windows API
-             * allows a name or an address within to be passed in but doesn't provide
-             * a type safe way to do this */
-            BOOL success = GetModuleHandleEx ( GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
-                                               | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
-                                               ( const TCHAR * )func, & h );
-            if ( success )
-            {
-                wchar_t fname [ MAX_PATH ];
-                DWORD name_len = GetModuleFileNameW ( h, fname, ( DWORD ) sizeof fname / sizeof fname [ 0 ] );
-                if ( name_len >= sizeof fname / sizeof fname [ 0 ] )
-                    rc = RC ( rcFS, rcDylib, rcSearching, rcPath, rcExcessive );
-                else
-                {
-                    /* trim off module name */
-                    while ( name_len > 0 )
-                    {
-                        if ( fname [ -- name_len ] == '\\' )
-                        {
-                            fname [ name_len ] = 0;
-                            break;
-                        }
-                    }
-
-                    /* now use directory path */
-                    rc = KDirectoryMakeFromRealPath ( ( KDirectory** ) dir, fname, false, false );
-                }
-            }
-        }
-    }
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * KDylib
- *  Windows dynamic library
- */
-struct KDylib
-{
-    HMODULE handle;
-    WString path;
-    KRefcount refcount;
-};
-
-
-/* Whack
- */
-static
-rc_t KDylibWhack ( KDylib *self )
-{
-    KRefcountWhack ( & self -> refcount, "KDylib" );
-
-    /* try to close library */
-	if ( !FreeLibrary( self -> handle ) )
-    {
-        /* report error */
-/*        const char *msg = dlerror (); */
-        rc_t rc = RC ( rcFS, rcDylib, rcClosing, rcNoObj, rcUnknown );
-/*        LOGERR ( klogInt, rc, msg );
-        ( void ) msg; */
-        return rc;
-    }
-
-    free ( self );
-    return 0;
-}
-
-
-/* Make
- */
-static
-rc_t KDylibMake ( KDylib **libp, const WString *path )
-{
-    wchar_t *cpy;
-    KDylib *lib = malloc ( sizeof * lib + path -> size + 4 );
-    if ( lib == NULL )
-        return RC ( rcFS, rcDylib, rcConstructing, rcMemory, rcExhausted );
-
-    cpy = ( wchar_t* ) ( lib + 1 );
-    lib -> handle = NULL;
-
-    memcpy ( cpy, path -> addr, path -> size );
-    cpy [ path -> len ] = 0;
-
-    WStringInit ( & lib -> path, cpy, path -> size, path -> len );
-
-    KRefcountInit ( & lib -> refcount, 1, "KDylib", "make", "WinDLL" );
-
-    * libp = lib;
-    return 0;
-}
-
-/* SetLogging
- */
-static
-rc_t KDylibSetLogging ( const KDylib *self )
-{
-    rc_t ( CC * set_formatter ) ( KFmtWriter writer, KLogFmtFlags flags, void *data );
-    rc_t ( CC * set_writer ) ( KWrtWriter writer, void *data );
-
-    /* set the current logging level */
-    rc_t ( CC * set_level ) ( KLogLevel lvl ) = ( void* ) GetProcAddress ( self -> handle, "KLogLevelSet" );
-    if ( set_level != NULL )
-    {
-        KLogLevel lvl = KLogLevelGet ();
-        ( * set_level ) ( lvl );
-    }
-
-    /* determine current library logging */
-    set_writer = ( void* ) GetProcAddress ( self -> handle, "KOutHandlerSet" );
-    if ( set_writer != NULL )
-    {
-        const KWrtHandler* handler = KOutHandlerGet ();
-        ( * set_writer ) ( handler -> writer, handler -> data );
-    }
-
-    set_formatter = ( void* ) GetProcAddress ( self -> handle, "KLogLibFmtHandlerSet" );
-    if ( set_formatter != NULL )
-    {
-        KLogFmtFlags flags = KLogLibFmtFlagsGet ();
-        const KFmtHandler* fmt_handler = KLogFmtHandlerGet ();
-        ( * set_formatter ) ( fmt_handler -> formatter, flags, fmt_handler -> data );
-    }
-    set_writer = ( void* ) GetProcAddress ( self -> handle, "KLogLibHandlerSet" );
-    if ( set_writer != NULL )
-    {
-        const KWrtHandler* handler = KLogLibHandlerGet ();
-        ( * set_writer ) ( handler -> writer, handler -> data );
-    }
-
-    set_formatter = ( void* ) GetProcAddress ( self -> handle, "KStsLibFmtHandlerSet" );
-    if ( set_formatter != NULL )
-    {
-        KStsFmtFlags flags = KStsLibFmtFlagsGet ();
-        const KFmtHandler* fmt_handler = KStsFmtHandlerGet ();
-        ( * set_formatter ) ( fmt_handler -> formatter, flags, fmt_handler -> data );
-    }
-    set_writer = ( void* ) GetProcAddress ( self -> handle, "KStsLibHandlerSet" );
-    if ( set_writer != NULL )
-    {
-        const KWrtHandler* handler = KStsLibHandlerGet ();
-        ( * set_writer ) ( handler -> writer, handler -> data );
-    }
-#if _DEBUGGING
-    set_writer = ( void* ) GetProcAddress ( self -> handle, "KDbgHandlerSet" );
-    if ( set_writer != NULL )
-    {
-        const KWrtHandler* handler = KDbgHandlerGet ();
-        ( * set_writer ) ( handler -> writer, handler -> data );
-    }
-#endif
-    return 0;
-}
-
-/* LoadLib
- *  load a dynamic library
- *
- *  "lib" [ OUT ] - return parameter for loaded library
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target library
- */
-static
-rc_t KDyldLoad ( KDyld *self, KDylib *lib, const wchar_t *path )
-{
-    DWORD err;
-#if WE_WERE_BUILDING_FOR_WINDOWS_7_ALONE
-    UINT errMode = GetErrorMode();
-#endif
-
-	if ( path == NULL )
-	{
-		if ( GetModuleHandleExW( 0, NULL, &( lib -> handle ) ) )
-			return 0;
-
-        return RC ( rcFS, rcDylib, rcLoading, rcNoObj, rcUnknown );
-	}
-
-    SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); /* suppress the message box in case of an error */
-    lib -> handle = LoadLibraryW ( path );
-#if WE_WERE_BUILDING_FOR_WINDOWS_7_ALONE
-    SetErrorMode(errMode);
-#endif
-    if ( lib -> handle != NULL )
-        return KDylibSetLogging ( lib );
-
-    err = GetLastError ();
-    switch ( err )
-    {
-    case ERROR_MOD_NOT_FOUND :
-        return RC ( rcFS, rcDylib, rcLoading, rcPath, rcNotFound );
-    case ERROR_BAD_EXE_FORMAT :
-        return RC ( rcFS, rcDylib, rcLoading, rcFormat, rcInvalid );
-    }
-
-    return RC ( rcFS, rcDylib, rcLoading, rcNoObj, rcUnknown );
-}
-
-static
-rc_t KDyldVTryLoadLib ( KDyld *self, KDylib **lib,
-    const KDirectory *dir, const char *path, va_list args )
-{
-    rc_t rc;
-
-    const KSysDir *sdir = KDirectoryGetSysDir ( dir );
-    if ( sdir == NULL )
-        rc = RC ( rcFS, rcDylib, rcLoading, rcDirectory, rcIncorrect );
-    else
-    {
-        wchar_t real [ MAX_PATH ];
-
-		rc = KSysDirOSPath ( sdir, real, sizeof real, path, args );
-		if ( rc == 0 )
-		{
-			WString pstr;
-			WStringInitCString ( & pstr, real );
-
-			rc = KDylibMake ( lib, & pstr );
-			if ( rc == 0 )
-			{
-				rc = KDyldLoad ( self, * lib, real );
-				if ( rc == 0 )
-					return 0;
-				free ( * lib );
-			}
-        }
-    }
-
-    * lib = NULL;
-
-    return rc;
-}
-
-static
-rc_t KDyldTryLoadLib ( KDyld *self, KDylib **lib,
-    const KDirectory *dir, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-    va_start ( args, path );
-    rc = KDyldVTryLoadLib ( self, lib, dir, path, args );
-    va_end ( args );
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDyldVLoadLib ( KDyld *self,
-    KDylib **lib, const char *path, va_list args )
-{
-    rc_t rc;
-
-    if ( lib == NULL )
-        rc = RC ( rcFS, rcDylib, rcLoading, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcFS, rcDylib, rcLoading, rcSelf, rcNull );
-        else if ( path == NULL || path [ 0 ] == 0 )
-        {
-            WString pstr;
-            CONST_WSTRING ( & pstr, "" );
-
-            rc = KDylibMake ( lib, & pstr );
-            if ( rc == 0 )
-            {
-                rc = KDyldLoad ( self, * lib, NULL );
-                if ( rc == 0 )
-                    return 0;
-            
-                free ( * lib );
-            }
-        }
-        else
-        {
-            uint32_t i = VectorStart ( & self -> search );
-            uint32_t end = i + VectorLength ( & self -> search );
-
-            if ( i == end )
-            {
-                char name [ 4096 ];
-                int len = vsnprintf ( name, sizeof name, path, args );
-                if ( len < 0 || len >= sizeof name )
-                    rc = RC ( rcFS, rcDylib, rcLoading, rcPath, rcExcessive );
-                else
-                {
-                    WString pstr;
-                    wchar_t wname [ 4096 ];
-                    size_t wsize = string_cvt_wchar_copy ( wname, sizeof wname, name, len );
-                    WStringInit ( & pstr, wname, wsize * sizeof wname [ 0 ], string_len ( name, len ) );
-
-                    rc = KDylibMake ( lib, & pstr );
-                    if ( rc == 0 )
-                    {
-                        rc = KDyldLoad ( self, * lib, wname );
-                        if ( rc == 0 )
-                            return 0;
-                    
-                        free ( * lib );
-                    }
-                }
-            }
-            else
-            {
-                for ( * lib = NULL; i < end; ++ i )
-                {
-                    const KDirectory *dir;
-
-                    va_list cpy;
-                    va_copy ( cpy, args );
-
-                    dir = ( const void* ) VectorGet ( & self -> search, i );
-                    rc = KDyldVTryLoadLib ( self, lib, dir, path, cpy );
-
-                    va_end ( cpy );
-
-                    if ( rc == 0 || GetRCState ( rc ) != rcNotFound )
-                        return rc;
-                }
-
-                rc = RC ( rcFS, rcDylib, rcLoading, rcPath, rcNotFound );
-            }
-        }
-
-        * lib = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDyldLoadLib ( KDyld *self,
-    KDylib **lib, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = KDyldVLoadLib ( self, lib, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KDylibAddRef ( const KDylib *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KDylib" ) )
-        {
-        case krefLimit:
-            return RC ( rcFS, rcDylib, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KDylibRelease ( const KDylib *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KDylib" ) )
-        {
-        case krefWhack:
-            return KDylibWhack ( ( KDylib* ) self );
-        case krefNegative:
-            return RC ( rcFS, rcDylib, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-static
-void CC KDylibVectRelease ( void *item, void *ignore )
-{
-    KDylib *self = item;
-    KDylibRelease ( self );
-}
-
-
-/* Attach
- * Sever
- */
-static
-KDylib *KDylibAttach ( const KDylib *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAddDep ( & self -> refcount, "KDylib" ) )
-        {
-        case krefLimit:
-            return NULL;
-        }
-    }
-    return ( KDylib* ) self;
-}
-
-static
-rc_t KDylibSever ( const KDylib *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDropDep ( & self -> refcount, "KDylib" ) )
-        {
-        case krefWhack:
-            return KDylibWhack ( ( KDylib* ) self );
-        case krefNegative:
-            return RC ( rcFS, rcDylib, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-/* Sort
- */
-static
-int CC KDylibSort ( const void *item, const void *n )
-{
-    const KDylib *a = item;
-    const KDylib *b = n;
-    return WStringCaseCompare ( & a -> path, & b -> path );
-}
-
-
-/* FullPath
- *  return full path to library
- */
-LIB_EXPORT rc_t CC KDylibFullPath ( const KDylib *self, char *path, size_t psize )
-{
-    rc_t rc;
-
-    if ( psize == 0 )
-        rc = RC ( rcFS, rcDylib, rcAccessing, rcBuffer, rcInsufficient );
-    else if ( path == NULL )
-        rc = RC ( rcFS, rcDylib, rcAccessing, rcBuffer, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcFS, rcDylib, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            size_t i, bytes = wchar_cvt_string_copy ( path, psize,
-                self -> path . addr, self -> path . size );
-            if ( bytes < psize )
-            {
-                if ( isalpha ( path [ 0 ] ) && path [ 1 ] == ':' )
-                {
-                    path [ 1 ] = path [ 0 ];
-                    path [ 0 ] = '/';
-                }
-                for ( i = 0; i < bytes; ++ i )
-                {
-                    if ( path [ i ] == '\\' )
-                        path [ i ] = '/';
-                }
-
-                return 0;
-            }
-
-            rc = RC ( rcFS, rcDylib, rcAccessing, rcBuffer, rcInsufficient );
-        }
-
-        path [ 0 ] = 0;
-    }
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * KDlset
- *  ordered set of dynamic libraries
- *  contained libraries remain resident until set is released
- */
-struct KDlset
-{
-    KDyld *dl;
-    Vector name, ord;
-    KRefcount refcount;
-};
-
-
-/* Whack
- */
-static
-rc_t KDlsetWhack ( KDlset *self )
-{
-    KRefcountWhack ( & self -> refcount, "KDlset" );
-
-    VectorWhack ( & self -> name, NULL, NULL );
-    VectorWhack ( & self -> ord, KDylibVectRelease, NULL );
-    KDyldSever ( self -> dl );
-    free ( self );
-
-    return 0;
-}
-
-#define STRINGIZE(s) #s
-#define LIBNAME(pref, name, suff) STRINGIZE(pref) name STRINGIZE(suff)
-/* MakeSet
- *  load a dynamic library
- *
- *  "set" [ OUT ] - return parameter for lib set
- */
-LIB_EXPORT rc_t CC KDyldMakeSet ( const KDyld *self, KDlset **setp )
-{
-    rc_t rc = 0;
-    
-    if ( setp == NULL )
-        rc = RC ( rcFS, rcDylib, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcFS, rcDylib, rcConstructing, rcSelf, rcNull );
-        else
-        {
-            KDlset *set = malloc ( sizeof * set );
-            if ( set == NULL )
-                rc = RC ( rcFS, rcDylib, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                set -> dl = KDyldAttach ( self );
-                VectorInit ( & set -> name, 0, 16 );
-                VectorInit ( & set -> ord, 0, 16 );
-                KRefcountInit ( & set -> refcount, 1, "KDlset", "make", "dlset" );
-#if ! ALWAYS_ADD_EXE
-                {   
-                    KDylib *jni;
-                    const char* libname = "vdb_jni.dll";
-                    rc = KDyldLoadLib ( ( KDyld* ) self, & jni, libname );
-                    if ( rc == 0 )
-                    {
-                        rc = KDlsetAddLib ( set, jni );
-                        KDylibRelease ( jni );
-                    }
-                    /*if (rc == 0)*/ /* if JNI code is not there, C tools should not suffer */
-                    {
-                        * setp = set;
-                        return 0;
-                    }
-                }
-#else
-                {
-                    KDylib *exe;
-                    rc = KDyldLoadLib ( ( KDyld* ) self, & exe, NULL );
-                    if ( rc == 0 )
-                    {
-                        rc = KDlsetAddLib ( set, exe );
-                        KDylibRelease ( exe );
-                        if ( rc == 0 )
-                        {
-                            * setp = set;
-                            return 0;
-                        }
-                    }
-                }
-
-                KDlsetRelease ( set );
-#endif
-            }
-        }
-
-        * setp = NULL;
-    }
-
-    return rc;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KDlsetAddRef ( const KDlset *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KDlset" ) )
-        {
-        case krefLimit:
-            return RC ( rcFS, rcDylib, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KDlsetRelease ( const KDlset *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KDlset" ) )
-        {
-        case krefWhack:
-            return KDlsetWhack ( ( KDlset* ) self );
-        case krefNegative:
-            return RC ( rcFS, rcDylib, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/* AddLib
- *  adds a dynamic library to end of ordered set
- *
- *  "lib" [ IN ] - library returned from KDyldLoadLib
- */
-static
-rc_t KDlsetAddLibInt ( KDlset *self, KDylib *lib )
-{
-    uint32_t idx;
-    rc_t rc = VectorAppend ( & self -> ord, & idx, lib );
-    if ( rc == 0 )
-    {
-        void *ignore;
-        
-        rc = VectorInsertUnique ( & self -> name,
-            lib, NULL, KDylibSort );
-        if ( rc == 0 )
-            return 0;
-
-        VectorSwap ( & self -> ord, idx, NULL, & ignore );
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDlsetAddLib ( KDlset *self, KDylib *lib )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcFS, rcDylib, rcInserting, rcSelf, rcNull );
-    else if ( lib == NULL )
-        rc = RC ( rcFS, rcDylib, rcInserting, rcDylib, rcNull );
-    else
-    {
-        rc = KDylibAddRef ( lib );
-        if ( rc == 0 )
-        {
-            rc = KDlsetAddLibInt ( self, lib );
-            if ( rc == 0 )
-                return 0;
-
-            KDylibRelease ( lib );
-        }
-    }
-
-    return rc;
-}
-
-
-/* AddAll
- *  adds all dynamic libraries found in dl search path
- */
-static
-rc_t CC KDlsetTryLib ( const KDirectory *dir,
-    uint32_t type, const char *name, void *data )
-{
-    KDlset *self = data;
-
-    if ( ( type & ~ kptAlias ) == kptFile )
-    {
-        rc_t rc;
-        KDylib *lib;
-#ifdef SHLX
-        /* force simple shared library extension */
-        if ( sizeof SHLX >= 2 )
-        {
-            /* SHLX has at least 1 character plus NUL byte */
-            size_t len = strlen ( name );
-            /* name must be at least 1 character larger */
-            if ( len <= ( sizeof SHLX - 1 ) )
-                return 0;
-            /* name must end with shared library extension */
-            if ( memcmp ( & name [ len - ( sizeof SHLX - 1 ) ], SHLX, sizeof SHLX - 1 ) != 0 )
-                return 0;
-        }
-#endif
-        rc = KDyldTryLoadLib ( self -> dl, & lib, dir, name );
-        if ( rc == 0 )
-        {
-            rc = KDlsetAddLibInt ( self, lib );
-            if ( rc == 0 )
-                return 0;
-
-            KDylibRelease ( lib );
-        }
-    }
-
-    return 0;
-}
-
-static
-void CC KDlsetVisitDir ( const KDirectory *dir, void *data )
-{
-    KDirectoryVisit ( dir, false, KDlsetTryLib, data, "." );
-}
-
-LIB_EXPORT rc_t CC KDlsetAddAll ( KDlset *self )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcDylib, rcInserting, rcSelf, rcNull );
-    KDyldForEach ( self -> dl, KDlsetVisitDir, self );
-    return 0;
-}
-
-
-/*--------------------------------------------------------------------------
- * KSymAddr
- *  symbol address within a dynamic library
- */
-struct KSymAddr
-{
-    KDylib *lib;
-    void *addr;
-    KRefcount refcount;
-};
-
-
-/* Whack
- */
-static
-rc_t KSymAddrWhack ( KSymAddr *self )
-{
-    KRefcountWhack ( & self -> refcount, "KSymAddr" );
-
-    KDylibSever ( self -> lib );
-    free ( self );
-
-    return 0;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KSymAddrAddRef ( const KSymAddr *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KSymAddr" ) )
-        {
-        case krefLimit:
-            return RC ( rcFS, rcDylib, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KSymAddrRelease ( const KSymAddr *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KSymAddr" ) )
-        {
-        case krefWhack:
-            return KSymAddrWhack ( ( KSymAddr* ) self );
-        case krefNegative:
-            return RC ( rcFS, rcDylib, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/* Make
- */
-static
-rc_t KSymAddrMake ( KSymAddr **symp,
-    const KDylib *lib, const char *name )
-{
-    FARPROC addr = GetProcAddress ( lib -> handle, name );
-    if ( addr != NULL )
-    {
-        KSymAddr *sym = malloc ( sizeof * sym );
-        if ( sym == NULL )
-            return RC ( rcFS, rcDylib, rcConstructing, rcMemory, rcExhausted );
-
-        sym -> lib = KDylibAttach ( lib );
-        sym -> addr = (void *)addr;
-        KRefcountInit ( & sym -> refcount, 1, "KSymAddr", "make", name );
-        * symp = sym;
-        return 0;
-    }
-
-    * symp = NULL;
-    return RC ( rcFS, rcDylib, rcSelecting, rcName, rcNotFound );
-}
-
-
-/* Symbol
- *  find a symbol within dynamic library
- *
- *  "sym" [ OUT ] - return parameter for exported symbol address
- *
- *  "name" [ IN ] - NUL terminated symbol name in
- *  library-native character set
- */
-LIB_EXPORT rc_t CC KDylibSymbol ( const KDylib *self, KSymAddr **sym, const char *name )
-{
-    rc_t rc;
-
-    if ( sym == NULL )
-        rc = RC ( rcFS, rcDylib, rcSelecting, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcFS, rcDylib, rcSelecting, rcSelf, rcNull );
-        else if ( name == NULL )
-            rc = RC ( rcFS, rcDylib, rcSelecting, rcName, rcNull );
-        else if ( name [ 0 ] == 0 )
-            rc = RC ( rcFS, rcDylib, rcSelecting, rcName, rcEmpty );
-        else
-        {
-            return KSymAddrMake ( sym, self, name );
-        }
-
-        * sym = NULL;
-    }
-
-    return rc;
-}
-
-typedef struct KDlsetTrySymData KDlsetTrySymData;
-struct KDlsetTrySymData
-{
-    const KDlset *self;
-    const char *name;
-
-    bool ( CC * test ) ( const KSymAddr *sym, void *data );
-    void *data;
-
-    KSymAddr *sym;
-    rc_t rc;
-    bool first;
-};
-
-static
-bool CC KDlsetTrySymbol ( void *item, void *data )
-{
-    KSymAddr *sym;
-    KDlsetTrySymData *pb = data;
-    pb -> rc = KDylibSymbol ( item, & sym, pb -> name );
-    if ( pb -> rc == 0 )
-    {
-        /* simple case */
-        if ( pb -> test == NULL )
-        {
-            pb -> sym = sym;
-            return true;
-        }
-
-        /* apply filter function */
-        if ( ( * pb -> test ) ( sym, pb -> data ) )
-        {
-            KSymAddrRelease ( pb -> sym );
-            pb -> sym = sym;
-            return pb -> first;
-        }
-
-        KSymAddrRelease ( sym );
-    }
-    return false;
-}
-
-LIB_EXPORT rc_t CC KDlsetSymbol ( const KDlset *self, KSymAddr **sym, const char *name )
-{
-    rc_t rc;
-
-    if ( sym == NULL )
-        rc = RC ( rcFS, rcDylib, rcSelecting, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcFS, rcDylib, rcSelecting, rcSelf, rcNull );
-        else if ( name == NULL )
-            rc = RC ( rcFS, rcDylib, rcSelecting, rcName, rcNull );
-        else if ( name [ 0 ] == 0 )
-            rc = RC ( rcFS, rcDylib, rcSelecting, rcName, rcEmpty );
-        else
-        {
-            KDlsetTrySymData pb;
-            memset ( & pb, 0, sizeof pb );
-            pb . self = self;
-            pb . name = name;
-            pb . rc = RC ( rcFS, rcDylib, rcSelecting, rcName, rcNotFound );
-
-            if ( VectorDoUntil ( & self -> ord, false, KDlsetTrySymbol, & pb ) )
-            {
-                * sym = pb . sym;
-                return 0;
-            }
-
-            rc = pb . rc;
-        }
-
-        * sym = NULL;
-    }
-
-    return rc;
-}
-
-
-/* FirstSymbol
- * LastSymbol
- *  find a symbol within dynamic library set matching criteria
- *
- *  "sym" [ OUT ] - return parameter for exported symbol address
- *
- *  "name" [ IN ] - NUL terminated symbol name in
- *  library-native character set
- *
- *  "test" [ IN ] and "data" [ IN, OPAQUE ] - callback filter function
- *  return true if symbol matches criteria
- */
-LIB_EXPORT rc_t CC KDlsetFirstSymbol ( const KDlset *self, KSymAddr **sym, const char *name,
-    bool ( CC * test ) ( const KSymAddr *sym, void *data ), void *data )
-{
-    rc_t rc;
-
-    if ( sym == NULL )
-        rc = RC ( rcFS, rcDylib, rcSelecting, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcFS, rcDylib, rcSelecting, rcSelf, rcNull );
-        else if ( name == NULL )
-            rc = RC ( rcFS, rcDylib, rcSelecting, rcName, rcNull );
-        else if ( name [ 0 ] == 0 )
-            rc = RC ( rcFS, rcDylib, rcSelecting, rcName, rcEmpty );
-        else if ( test == NULL )
-            rc = RC ( rcFS, rcDylib, rcSelecting, rcFunction, rcNull );
-        else
-        {
-            KDlsetTrySymData pb;
-            memset ( & pb, 0, sizeof pb );
-            pb . self = self;
-            pb . name = name;
-            pb . test = test;
-            pb . data = data;
-            pb . rc = RC ( rcFS, rcDylib, rcSelecting, rcName, rcNotFound );
-            pb . first = true;
-
-            if ( VectorDoUntil ( & self -> ord, false, KDlsetTrySymbol, & pb ) )
-            {
-                * sym = pb . sym;
-                return 0;
-            }
-
-            rc = pb . rc;
-        }
-
-        * sym = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDlsetLastSymbol ( const KDlset *self, KSymAddr **sym, const char *name,
-    bool ( CC * test ) ( const KSymAddr *sym, void *data ), void *data )
-{
-    rc_t rc;
-    
-    if ( sym == NULL )
-        rc = RC ( rcFS, rcDylib, rcSelecting, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcFS, rcDylib, rcSelecting, rcSelf, rcNull );
-        else if ( name == NULL )
-            rc = RC ( rcFS, rcDylib, rcSelecting, rcName, rcNull );
-        else if ( name [ 0 ] == 0 )
-            rc = RC ( rcFS, rcDylib, rcSelecting, rcName, rcEmpty );
-        else if ( test == NULL )
-            rc = RC ( rcFS, rcDylib, rcSelecting, rcFunction, rcNull );
-        else
-        {
-            KDlsetTrySymData pb;
-            memset ( & pb, 0, sizeof pb );
-            pb . self = self;
-            pb . name = name;
-            pb . test = test;
-            pb . data = data;
-            pb . rc = RC ( rcFS, rcDylib, rcSelecting, rcName, rcNotFound );
-
-            VectorDoUntil ( & self -> ord, false, KDlsetTrySymbol, & pb );
-            if ( pb . sym != NULL )
-            {
-                * sym = pb . sym;
-                return 0;
-            }
-
-            rc = pb . rc;
-        }
-
-        * sym = NULL;
-    }
-
-    return rc;
-}
-
-
-/* List - PRIVATE
- *  list the paths to the libraries in the set
- */
-typedef struct list_dylib_param list_dylib_param;
-struct list_dylib_param
-{
-    VNamelist *list;
-    rc_t rc;
-};
-
-static
-bool CC list_dylib ( void *item, void *data )
-{
-    size_t bytes;
-    char utf8 [ 4096 ], *p;
-
-    list_dylib_param *pb = data;
-    const KDylib *lib = ( const void* ) item;
-
-    /* "lib" was created with KDylibMake
-       which creates a NUL terminated path.
-       of course, this could seg-fault if bad... */
-    assert ( lib -> path . addr [ lib -> path . len ] == 0 );
-
-    /* convert wide-character to UTF-8 */
-    bytes = wchar_cvt_string_copy ( utf8, sizeof utf8, lib -> path . addr, lib -> path . size );
-    if ( bytes < sizeof utf8 )
-    {
-        pb -> rc = VNamelistAppend ( pb -> list, utf8 );
-        return pb -> rc != 0;
-    }
-
-    p = malloc ( 16 * 1024 );
-    if ( p == NULL )
-    {
-        pb -> rc = RC ( rcFS, rcDylib, rcListing, rcMemory, rcExhausted );
-        return true;
-    }
-
-    bytes = wchar_cvt_string_copy ( p, 16 * 1024, lib -> path . addr, lib -> path . size );
-    if ( bytes >= 16 * 1024 )
-        pb -> rc = RC ( rcFS, rcDylib, rcListing, rcPath, rcTooLong );
-    else
-        pb -> rc = VNamelistAppend ( pb -> list, p );
-
-    free ( p );
-    return pb -> rc != 0;
-}
-
-LIB_EXPORT rc_t CC KDlsetList ( const KDlset *self, KNamelist **listp )
-{
-    list_dylib_param pb;
-
-    assert ( listp != NULL );
-
-    if ( self == NULL )
-        pb . rc = RC ( rcFS, rcDylib, rcListing, rcSelf, rcNull );
-    else
-    {
-        pb . rc = VNamelistMake ( & pb . list, VectorLength ( & self -> name ) );
-        if ( pb . rc == 0 )
-        {
-            bool fail = VectorDoUntil ( & self -> name, false, list_dylib, & pb );
-            if ( ! fail )
-                pb . rc = VNamelistToNamelist ( pb . list, listp );
-
-            VNamelistRelease ( pb . list );
-        }
-    }
-
-    return pb . rc;
-}
-
-
-/* AsObj
- * AsFunc
- *  retrieve symbol address as pointer to object
- */
-LIB_EXPORT void * CC KSymAddrAsObj ( const KSymAddr *self )
-{
-    if ( self != NULL )
-        return self -> addr;
-    return NULL;
-}
-
-LIB_EXPORT void CC KSymAddrAsFunc ( const KSymAddr *self, fptr_t *fp )
-{
-    if ( self != NULL && fp != NULL )
-        * fp = ( fptr_t ) self -> addr;
-}
-
-
diff --git a/libs/kfs/win/sysfile-priv.h b/libs/kfs/win/sysfile-priv.h
deleted file mode 100644
index f0d4ebe..0000000
--- a/libs/kfs/win/sysfile-priv.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_sysfile_priv_
-#define _h_sysfile_priv_
-
-#ifndef _h_os_native_
-#include <os-native.h>
-#endif
-
-#ifndef _h_kfs_impl_
-#include <kfs/impl.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * KSysFile
- *  a Windows file
- */
-typedef struct KSysFile KSysFile;
-struct KSysFile
-{
-    KFile dad;
-    HANDLE handle;
-    uint64_t pos;
-    bool failed_set_sparse;
-    bool is_sparse; /* throws off size dang it */
-    
-};
-
-/* KSysFileMake
- *  create a new file object
- *  from file descriptor
- */
-rc_t KSysFileMake ( KSysFile **fp, HANDLE fd, const char *path, bool read_enabled, bool write_enabled );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*  _h_sysfile_priv_ */
diff --git a/libs/kfs/win/sysfile.c b/libs/kfs/win/sysfile.c
deleted file mode 100644
index 5948bd4..0000000
--- a/libs/kfs/win/sysfile.c
+++ /dev/null
@@ -1,1023 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kfs/extern.h>
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KSysFile;
-#define KFILE_IMPL struct KSysFile
-
-#include "sysfile-priv.h"
-#include <klib/rc.h>
-#include <klib/log.h>
-#include <klib/text.h>
-#include <sysalloc.h>
-
-/* temporary */
-/* #include <klib/out.h> */
-
-
-
-#include <Windows.h>
-/* #include <WinIoCtl.h> nested include in Windows.h? */
-
-/*--------------------------------------------------------------------------
- * KSysFile
- *  a Windows file
- */
-
-/* minimum set size or write beyond size difference to trigger setting sparse */
-/* tune this if too many or too few sparse files */
-#define MIN_SET_SPARSE_DIFF   (16*1024)
-#define MIN_SPARSE_BLOCK_DIFF  (4*1024)
-
-
-/* ----------
- * Some functions to isolate the calls to Windows functions as I feel dirty
- * just using them.
- * really its to isolate some calls the very different style of parmaters
- * for the calls from the usualy project approach.
- *
- * if the compiler inlines them it's all good.
- */
-
-/*
- * Get file size 
- */
-static rc_t get_file_size (const KSysFile * self, uint64_t * size)
-{
-    LARGE_INTEGER sz;
-
-    if ( GetFileSizeEx ( self -> handle, & sz ) == 0 )
-    {
-        rc_t rc;
-        DWORD last_error;
-
-        last_error = GetLastError ();
-        switch ( last_error )
-        {
-        case ERROR_INVALID_HANDLE:
-            rc = RC ( rcFS, rcFile, rcAccessing, rcFileDesc, rcInvalid );
-            break;
-        default:
-            rc = RC ( rcFS, rcFile, rcAccessing, rcNoObj, rcUnknown );
-            break;
-        }
-        PLOGERR (klogErr,
-                 (klogErr, rc, "error accessing file system status - $(E)($(C))",
-                  "E=%!,C=%u", last_error, last_error)); 
-        return rc;
-    }
-    *size = sz.QuadPart;
-
-    return 0;
-}
-
-
-/* returns (and side effect sets in structure)
- * if the file is already a sparse file
- */
-static bool check_if_sparse (KSysFile * self)
-{
-    BY_HANDLE_FILE_INFORMATION info;
-    BOOL worked;
-
-    if (self->is_sparse)
-        return true;
-
-    /*
-     * we don't use the GetFileInformationBy HandleEx as we don't want to 
-     * exclude Win XP yet.
-     */
-    worked = GetFileInformationByHandle (self->handle, &info);
-
-    self->is_sparse = 
-        ((info.dwFileAttributes & FILE_ATTRIBUTE_SPARSE_FILE)
-         == FILE_ATTRIBUTE_SPARSE_FILE);
-
-    return self->is_sparse;
-}
-
-/*
- * make a file sparse set_it == true
- * return is like Windows funcs with true being good
- *
- * we can't set if the Windows Volume doesn't allow it
- * but we'll let the function fail rather than try to get the value at 
- * CREATE (open) time because we'd be then checking at all file CREATE
- * whether we'd ever make it sparse or not
- */
-static
-bool set_sparse (KSysFile * self)
-{
-    FILE_SET_SPARSE_BUFFER b = { true };
-    DWORD ret;
-    BOOL worked;
-    bool rreett = false;
-
-    /* don't duplicate effort */
-    if (self->is_sparse)
-        rreett =  true;
-
-    else if (self->failed_set_sparse)
-        rreett = false;
-
-    else
-    {
-        worked = DeviceIoControl (self->handle, FSCTL_SET_SPARSE, &b, sizeof b,
-                              NULL, 0, &ret, NULL);
-/*         KOutMsg ("%s: %u\n",__func__,worked); */
-
-        /* not trusting bool is BOOL cause I don't trust Microsoft */
-        self->failed_set_sparse = (worked == 0);
-        self->is_sparse = !self->failed_set_sparse;
-        rreett =  self->is_sparse;
-    }
-/*     KOutMsg ("%s: %d\n",__func__,rreett); */
-    return rreett;
-}
-
-
-static bool set_not_sparse (KSysFile * self)
-{
-    FILE_SET_SPARSE_BUFFER b = { false };
-    DWORD ret;
-    BOOL worked;
-
-    /* don't duplicate effort */
-    if (!check_if_sparse (self))
-        return true;
-
-    if (self->failed_set_sparse)
-        return false;
-
-    worked = DeviceIoControl (self->handle, FSCTL_SET_SPARSE, &b, sizeof b,
-                              NULL, 0, &ret, NULL);
-
-    /* not trusting bool is BOOL cause I don't trust Microsoft */
-    self->failed_set_sparse = (worked == 0);
-    self->is_sparse = self->failed_set_sparse;
-    return ! self->is_sparse;
-}
-
-/*
- * this one works for non-sparse files too but what evs.
- */
-static rc_t set_zero_region (KSysFile * self, uint64_t start, uint64_t size)
-{
-    FILE_ZERO_DATA_INFORMATION b = { ( DWORD ) start, ( LONG ) ( start + size ) };
-    DWORD ret;
-    BOOL worked;
-
-    worked = DeviceIoControl (self->handle, FSCTL_SET_ZERO_DATA,
-                            &b, sizeof b,
-                            NULL, 0,
-                            &ret, NULL);
-
-    /* TODO: check error codes with GetLastError and better rc values */
-    return (worked != 0) ? 0 : RC (rcFS, rcFile, rcWriting, rcBuffer, rcUnexpected);
-}
-
-
-/*
- * returns true if we can convert this file into a non-sparse file
- *
- * We went simple and fast.  We ask about zero regions.
- * if we specifically get back that there are none we say true
- * otherwise we say false.
- *
- * self can be modified so it can not be const
- */
-static bool can_be_made_not_sparse (KSysFile * self     )
-{
-#if 1
-    return false;
-#else
-    /* this is backwards - the list of os non-zero regions not zero regions */
-    LARGE_INTEGER fo;
-    LARGE_INTEGER l;
-    uint64_t size;
-    FILE_ALLOCATED_RANGE_BUFFER i;
-    FILE_ALLOCATED_RANGE_BUFFER o [16]; /* some none 0 number */
-    uint64_t count;
-    DWORD ret;
-    BOOL worked;
-    rc_t rc;
-
-    /* if is isn't sparse we can't make it not sparse */
-    /* first might be not yet set */
-    if (!check_if_sparse (self))
-        return true;
-
-    /* we can't scan for zero regions if we can't get a size */
-    rc = get_file_size (self, &size);
-    if (rc)
-        return false;
-
-    /* Microsoft APIs can be fairly odd */
-    fo.QuadPart = 0;
-    l.QuadPart = size;
-    i.FileOffset = fo;
-    i.Length = l;
-
-    worked = DeviceIoControl (self->handle, FSCTL_QUERY_ALLOCATED_RANGES,
-                              &i, sizeof i, o, sizeof o, & ret, NULL);
-    /* we can't change to non-sparse if we can't scan for zero regions */
-    if (worked == 0)
-        return false;
-
-    return (ret == 0);
-#endif
-}
-
-
-/* Destroy
- */
-static
-rc_t CC KSysFileDestroy ( KSysFile *self )
-{
-    rc_t rc = 0;
-
-    if ( CloseHandle (self -> handle ) == 0 )
-    {
-        DWORD last_error;
-
-        last_error = GetLastError();
-        switch ( last_error )
-        {
-        case ERROR_INVALID_HANDLE:
-            break;
-        default:
-            rc = RC (rcFS, rcFile, rcDestroying, rcNoObj, rcUnknown);
-            PLOGERR (klogErr,
-                     (klogErr, rc, "error closing system file - $(E)$($(C))",
-                      "E=%!,C=%u", last_error, last_error)); 
-        }
-    }
-
-    free ( self );
-    return rc;
-}
-
-
-static
-rc_t CC KSysStdIOFileDestroy ( KSysFile *self )
-{
-    free ( self );
-    return 0;
-}
-
-
-/* GetSysFile
- *  returns an underlying system file object
- *  and starting offset to contiguous region
- *  suitable for memory mapping, or NULL if
- *  no such file is available.
- */
-static
-KSysFile *CC KSysFileGetSysFile ( const KSysFile *self, uint64_t *offset )
-{
-    * offset = 0;
-    return ( KSysFile* ) self;
-}
-
-/* RandomAccess
- *  returns 0 if random access, error code otherwise
- */
-static
-rc_t CC KSysDiskFileRandomAccess ( const KSysFile *self )
-{
-    return 0;
-}
-static
-rc_t CC KSysFileRandomAccess ( const KSysFile *self )
-{
-/*     return RC ( rcFS, rcFile, rcAccessing, rcFileDesc, rcIncorrect ); */
-        return RC ( rcFS, rcFile, rcAccessing, rcFunction, rcUnsupported );
-}
-
-
-/* Type
- *  returns a KFileDesc
- *  not intended to be a content type,
- *  but rather an implementation class
- */
-static
-uint32_t CC KSysFileType ( const KSysFile *self )
-{
-    switch ( GetFileType ( self -> handle ) )
-    {
-    case FILE_TYPE_DISK:
-        return kfdFile;
-    case FILE_TYPE_CHAR:
-        return kfdCharDev;
-    case FILE_TYPE_PIPE:
-        return kfdSocket;
-    }
-
-    return kfdInvalid;
-}
-
-
-/* Size
- *  returns size in bytes of file
- *
- *  "size" [ OUT ] - return parameter for file size
- */
-static
-rc_t CC KSysDiskFileSize ( const KSysFile *self, uint64_t *size )
-{
-#if 1
-/*     KOutMsg ("%s:\n",__func__); */
-    return get_file_size (self, size);
-#else
-
-    LARGE_INTEGER sz;
-
-    if ( GetFileSizeEx ( self -> handle, & sz ) == 0 )
-    {
-        rc_t rc;
-        DWORD last_error;
-
-        last_error = GetLastError ();
-        switch ( last_error )
-        {
-        case ERROR_INVALID_HANDLE:
-            rc = RC ( rcFS, rcFile, rcAccessing, rcFileDesc, rcInvalid );
-            break;
-        default:
-            rc = RC ( rcFS, rcFile, rcAccessing, rcNoObj, rcUnknown );
-            break;
-        }
-        PLOGERR (klogErr,
-                 (klogErr, rc, "error accessing file system status - $(E)($(C))",
-                  "E=%!,C=%u", last_error, last_error)); 
-        return rc;
-    }
-
-    *size = sz . QuadPart;
-    return 0;
-#endif
-}
-
-
-static
-rc_t CC KSysFileSize ( const KSysFile *self, uint64_t *size )
-{
-    *size = 0;
-/*     return RC ( rcFS, rcFile, rcAccessing, rcFileDesc, rcIncorrect ); */
-    return RC ( rcFS, rcFile, rcAccessing, rcFunction, rcUnsupported );
-}
-
-
-/* SetSize
- *  sets size in bytes of file
- *
- *  "size" [ IN ] - new file size
- */
-static
-rc_t CC KSysDiskFileSetSize ( KSysFile *self, uint64_t size )
-{
-    rc_t rc = 1;
-    LARGE_INTEGER p;
-    uint64_t prev_size;
-
-/*     KOutMsg ("%s:\n",__func__); */
-    /* get previous size for setting or clearing sparse */
-    rc = get_file_size ( self, &prev_size);
-    if (rc)
-        return rc;
-/*     KOutMsg ("%s: %lu\n",__func__, prev_size); */
-
-    p . QuadPart = size;
-
-    if ( SetFilePointerEx ( self -> handle, p, & p, FILE_BEGIN ) )
-    {
-        self -> pos = size;
-        if ( SetEndOfFile( self -> handle ) )
-        {
-            rc = 0;
-        }
-    }
-
-    /* failure to set size*/
-    if ( rc != 0 )
-    {
-        DWORD last_error;
-
-        last_error = GetLastError ();
-        switch ( last_error  )
-        {
-        case ERROR_INVALID_HANDLE:
-            rc = RC ( rcFS, rcFile, rcUpdating, rcFileDesc, rcInvalid );
-        default:
-            rc = RC ( rcFS, rcFile, rcUpdating, rcNoObj, rcUnknown );
-        }
-        PLOGERR ( klogErr,
-                 ( klogErr, rc, "error setting filesize - $(E) - $(C) to $(D)",
-                   "E=%!,C=%u,D=%lu", last_error, last_error, size ) ); 
-    }
-
-    /* check for wanting to be sparse file */
-    if (size > prev_size)
-    {
-        uint64_t diff;
-
-/*         KOutMsg ("%s: size(%lu) larger than prev_size(%lu)\n",__func__, size, prev_size); */
-
-        diff = size - prev_size;
-
-        /* if block size if big enough we'll try to make it a sparse block */
-        if (diff >= MIN_SPARSE_BLOCK_DIFF)
-        {
-/*             KOutMsg ("%s: diff(%lu) larger than block constant(%lu)\n",__func__, diff, MIN_SPARSE_BLOCK_DIFF); */
-            /* set sparse? */
-            if (!check_if_sparse(self)) /* isn't sparse now */
-            {
-                if (diff >= MIN_SET_SPARSE_DIFF)
-                {
-/*                     KOutMsg ("%s: diff(%lu) larger than sparse constant(%lu)\n",__func__, diff, MIN_SET_SPARSE_DIFF); */
-                    (void)set_sparse (self);
-                }
-            }
-            /* ordered to try to set before looking to set the zero region */
-            if (self->is_sparse)
-            {
-                /* set sparse region at end */
-                set_zero_region (self, prev_size, diff);
-            }
-        }
-    }
-    else if (can_be_made_not_sparse (self))
-        (void)set_not_sparse (self);
-
-    return rc;
-}
-
-
-static
-rc_t CC KSysFileSetSize ( KSysFile *self, uint64_t size )
-{
-/*     return RC ( rcFS, rcFile, rcUpdating, rcFileDesc, rcIncorrect ); */
-        return RC ( rcFS, rcFile, rcUpdating, rcFunction, rcUnsupported );
-}
-
-
-/* Read
- *  read file from known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually read
- */
-static
-rc_t KSysFileReadCommon ( const KSysFile *cself,
-    void *buffer, size_t bsize, size_t *num_read )
-{
-    DWORD to_read, bytes_read;
-    KSysFile *self = ( KSysFile* ) cself;
-
-    to_read = ( DWORD ) bsize;
-    if ( sizeof bsize > sizeof to_read && ( size_t ) to_read != bsize )
-        to_read = ~ 0U;
-
-    for (;;)
-    {
-        bytes_read = 0;
-        if ( ReadFile ( self -> handle, buffer, to_read, & bytes_read, NULL ) == 0 )
-        {
-            DWORD last_error;
-
-            switch ( last_error = GetLastError () )
-            {
-            case ERROR_HANDLE_EOF:
-                break;
-            case ERROR_IO_PENDING:
-                continue; 
-            default:
-                {
-                    rc_t rc = RC ( rcFS, rcFile, rcReading, rcNoObj, rcUnknown);
-                    PLOGERR ( klogErr,
-                            ( klogErr, rc, "error reading system file - $(E)($(C))",
-                                            "E=%!,C=%u", last_error, last_error ) ); 
-                    return rc;
-                }
-           }
-        }
-        
-        self -> pos += bytes_read;
-        * num_read = bytes_read;
-        break;
-    }
-
-    return 0;
-}
-
-static
-rc_t CC KSysDiskFileRead ( const KSysFile *cself, uint64_t pos,
-    void *buffer, size_t bsize, size_t *num_read )
-{
-    KSysFile *self = ( KSysFile* ) cself;
-
-    if ( self -> pos != pos )
-    {
-        LARGE_INTEGER p;
-
-        if ( !GetFileSizeEx( self -> handle, &p ) )
-        {
-            rc_t rc;
-            DWORD last_error;
-
-            last_error = GetLastError ();
-            switch ( last_error )
-            {
-            case ERROR_INVALID_HANDLE:
-                rc = RC ( rcFS, rcFile, rcPositioning, rcFileDesc, rcInvalid );
-                break;
-            default:
-                rc = RC ( rcFS, rcFile, rcPositioning, rcNoObj, rcUnknown );
-                break;
-            }
-            PLOGERR ( klogErr,
-                     ( klogErr, rc, "error positioning system file - $(E)($(C)) to $(D)",
-                       "E=%!,C=%u,D=%u", last_error, last_error, pos ) ); 
-            return rc;
-        }
-
-        /* if we try to read beyond the end of the file... */
-        if ( ( LONGLONG ) pos >= p . QuadPart )   
-        {   /* We've defined reading beyond EOF as return RC of 0 but bytes read as 0 */
-            /*return RC ( rcFS, rcFile, rcPositioning, rcFileDesc, rcInvalid );*/
-            return 0;
-        }
-
-        p . QuadPart = pos;
-        if ( !SetFilePointerEx ( self -> handle, p, & p, FILE_BEGIN ) )
-        {
-            rc_t rc;
-            DWORD last_error;
-
-            last_error = GetLastError ();
-            switch ( last_error )
-            {
-            case ERROR_INVALID_HANDLE:
-                rc = RC ( rcFS, rcFile, rcPositioning, rcFileDesc, rcInvalid );
-                PLOGERR (klogErr,
-                         (klogErr, rc, "invalid system file handle - $(E)($(C))",
-                          "E=%!,C=%u", last_error, last_error)); 
-                return rc;
-            default:
-                rc = RC ( rcFS, rcFile, rcPositioning, rcNoObj, rcUnknown );
-                PLOGERR ( klogErr,
-                          ( klogErr, rc, "error positioning system file - $(E)($(C)) to $(D)",
-                            "E=%!,C=%u,D=%lu", last_error, last_error, pos ) ); 
-                return rc;
-            }
-        }
-
-        self -> pos = p . QuadPart;
-        if ( pos != p . QuadPart )
-        {
-            if ( pos > (uint64_t)( p . QuadPart ) )
-            {
-                * num_read = 0;
-                return 0;
-            }
-
-            return RC ( rcFS, rcFile, rcPositioning, rcNoObj, rcUnknown );
-        }
-    }
-
-    return KSysFileReadCommon ( cself, buffer, bsize, num_read );
-}
-
-static
-rc_t CC KSysFileRead ( const KSysFile *cself, uint64_t pos,
-    void *buffer, size_t bsize, size_t *num_read )
-{
-    KSysFile *self = ( KSysFile* ) cself;
-
-    if ( self -> pos != pos )
-    {
-        *num_read = 0;
-        return RC ( rcFS, rcFile, rcPositioning, rcFileDesc, rcIncorrect );
-    }
-
-    return KSysFileReadCommon ( cself, buffer, bsize, num_read );
-}
-
-
-/* Write
- *  write file at known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ IN ] and "size" [ IN ] - data to be written
- *
- *  "num_writ" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually written
- */
-
-#define WINDOWS_HEAP_LIMIT (32*1024)
-
-static
-rc_t KSysFileWriteCommon ( KSysFile *self, 
-    const void *_buffer, size_t size, size_t *num_writ)
-{
-    DWORD to_write;
-    DWORD bytes_writ;
-    DWORD iter_writ;
-    const char * buffer = _buffer;
-
-    to_write = (DWORD) size;
-
-    if (sizeof size > sizeof to_write && ( size_t ) to_write != size )
-        to_write = ~ 0U;
-
-    for ( bytes_writ = 0; to_write > 0; )
-    {
-        DWORD iter_to_write = 
-            (to_write > WINDOWS_HEAP_LIMIT)? WINDOWS_HEAP_LIMIT : to_write;
-
-        
-        for (iter_writ = 0;
-             ! WriteFile ( self -> handle, buffer, iter_to_write, &iter_writ, NULL);
-             iter_writ = 0)
-        {
-            rc_t rc;
-            DWORD last_error;
-            const char * fmt;
-
-            last_error = GetLastError ();
-            switch ( last_error )
-            {
-            case ERROR_IO_PENDING:
-                Sleep (100); /* sure let's give it a chance to settle */
-                if (iter_writ)
-                {
-                    buffer += iter_writ;
-                    iter_to_write -= iter_writ;
-                    to_write -= iter_writ;
-                    bytes_writ += iter_writ;
-                }
-                continue; /* back to while() */
- 
-            case ERROR_INVALID_HANDLE:
-                rc = RC ( rcFS, rcFile, rcWriting, rcFileDesc, rcInvalid );
-                fmt = "invalid system file handle - $(E)($(C))";
-                break;
-
-            case ERROR_NOT_ENOUGH_MEMORY:
-                rc = RC (rcFS, rcFile, rcWriting, rcMemory, rcExhausted);
-                fmt = "error out of memory for WindowsWriteFile - $(E)($(C))";
-                break;
-
-            default:
-                rc = RC ( rcFS, rcFile, rcWriting, rcNoObj, rcUnknown );
-                fmt = "error writing system file - $(E)($(C))";
-                break;
-            }
-
-            PLOGERR (klogErr,
-                     (klogErr, rc, fmt, "E=%!,C=%u", last_error, last_error)); 
-            return rc;
-        }
-        buffer += iter_writ;
-        to_write -= iter_writ;
-        bytes_writ += iter_writ;
-    }
-
-    self -> pos += bytes_writ;
-
-    if (num_writ != NULL)
-        * num_writ = (size_t)bytes_writ;
-
-    return 0;
-}
-static
-rc_t CC KSysDiskFileWrite ( KSysFile *self, uint64_t pos,
-    const void *buffer, size_t size, size_t *num_writ)
-{
-    rc_t rc;
-    if ( self -> pos != pos )
-    {
-        LARGE_INTEGER p;
-        uint64_t curr_size;
-
-        rc = get_file_size ( self, &curr_size );
-        if ( rc != 0 )
-            return rc;
-
-        if ( curr_size < pos )
-        {
-            rc = KSysDiskFileSetSize (self, pos);
-            if (rc)
-                return rc;
-        }
-
-
-        p . QuadPart = pos;
-
-        if ( SetFilePointerEx ( self -> handle, p, & p, FILE_BEGIN ) == 0 )
-        {
-            DWORD last_error;
-
-            last_error = GetLastError ();
-            switch ( last_error )
-            {
-            case ERROR_INVALID_HANDLE:
-                rc = RC ( rcFS, rcFile, rcWriting, rcFileDesc, rcInvalid );
-                PLOGERR (klogErr,
-                         (klogErr, rc, "invalid system file handle - $(E)($(C))",
-                          "E=%!,C=%u", last_error, last_error)); 
-                break;
-            default:
-                rc = RC ( rcFS, rcFile, rcWriting, rcNoObj, rcUnknown );
-                PLOGERR (klogErr,
-                         (klogErr, rc, "error writing system file - $(E)($(C))",
-                          "E=%!,C=%u", last_error, last_error)); 
-                break;
-            }
-            return rc;
-        }
-
-        self -> pos = p . QuadPart;
-        if ( pos != p . QuadPart )
-        {
-            return RC ( rcFS, rcFile, rcPositioning, rcNoObj, rcUnknown );
-        }
-    }
-
-    return KSysFileWriteCommon ( self, buffer, size, num_writ );
-}
-static
-rc_t CC KSysFileWrite ( KSysFile *self, uint64_t pos,
-    const void *buffer, size_t size, size_t *num_writ)
-{
-    if ( self -> pos != pos )
-    {
-        *num_writ = 0;
-        return RC ( rcFS, rcFile, rcPositioning, rcFileDesc, rcIncorrect );
-    }
-
-    return KSysFileWriteCommon ( self, buffer, size, num_writ );
-}
-
-
-/* Make
- *  create a new file object
- *  from file descriptor
- */
-static const KFile_vt_v1 vtKSysDiskFile =
-{
-    /* version 1.1 */
-    1, 1,
-
-    /* start minor version 0 methods */
-    KSysFileDestroy,
-    KSysFileGetSysFile,
-    KSysDiskFileRandomAccess,
-    KSysDiskFileSize,
-    KSysDiskFileSetSize,
-    KSysDiskFileRead,
-    KSysDiskFileWrite,
-    /* end minor version 0 methods */
-
-    /* start minor version == 1 */
-    KSysFileType
-    /* end minor version == 1 */
-};
-static const KFile_vt_v1 vtKSysOtherFile =
-{
-    /* version 1.1 */
-    1, 1,
-
-    /* start minor version 0 methods */
-    KSysFileDestroy,
-    KSysFileGetSysFile,
-    KSysFileRandomAccess,
-    KSysFileSize,
-    KSysFileSetSize,
-    KSysFileRead,
-    KSysFileWrite,
-    /* end minor version 0 methods */
-
-    /* start minor version == 1 */
-    KSysFileType
-    /* end minor version == 1 */
-};
-static const KFile_vt_v1 vtKSysStdIODiskFile =
-{
-    /* version 1.1 */
-    1, 1,
-
-    /* start minor version 0 methods */
-    KSysStdIOFileDestroy,
-    KSysFileGetSysFile,
-    KSysDiskFileRandomAccess,
-    KSysDiskFileSize,
-    KSysDiskFileSetSize,
-    KSysDiskFileRead,
-    KSysDiskFileWrite,
-    /* end minor version 0 methods */
-
-    /* start minor version == 1 */
-    KSysFileType
-    /* end minor version == 1 */
-};
-static const KFile_vt_v1 vtKSysStdIOOtherFile =
-{
-    /* version 1.1 */
-    1, 1,
-
-    /* start minor version 0 methods */
-    KSysStdIOFileDestroy,
-    KSysFileGetSysFile,
-    KSysFileRandomAccess,
-    KSysFileSize,
-    KSysFileSetSize,
-    KSysFileRead,
-    KSysFileWrite,
-    /* end minor version 0 methods */
-
-    /* start minor version == 1 */
-    KSysFileType
-    /* end minor version == 1 */
-};
-
-
-static
-rc_t KSysFileMakeVT ( KSysFile **fp, HANDLE fd, const KFile_vt *vt, const char *path,
-    uint64_t initial_pos, bool read_enabled, bool write_enabled )
-{
-    rc_t rc;
-    KSysFile *f;
-
-    if( fd == INVALID_HANDLE_VALUE ) /* ? */
-        return RC ( rcFS, rcFile, rcConstructing, rcFileDesc, rcInvalid );
-
-    f = malloc ( sizeof *f );
-    if ( f == NULL )
-        rc = RC(rcFS, rcFile, rcConstructing, rcMemory, rcExhausted);
-    else
-    {
-        rc = KFileInit ( & f -> dad, vt, "KSysFile", path, read_enabled, write_enabled );
-        if ( rc == 0 )
-        {
-            f -> handle = fd;
-            f -> pos = initial_pos;
-            f -> failed_set_sparse = f->is_sparse = false;
-            check_if_sparse (f);
-            *fp = f;
-            return 0;
-        }
-
-        free ( f );
-    }
-    return rc;
-}
-
-/* bit flags */
-#define ISDISK  1
-#define ISSTDIO 2
-
-static
-rc_t KSysFileMakeInt ( KSysFile **fp, HANDLE fd, const char *path, bool read_enabled, bool write_enabled, unsigned flags )
-{
-    DWORD ret;
-    const KFile_vt * vt;
-    uint64_t initial_pos;
-
-    if (fp == NULL)
-        return RC (rcFS, rcFile, rcConstructing, rcSelf, rcNull);
-
-    *fp = NULL; /* pre-fail */
-
-    ret = GetFileType (fd);
-
-    switch (ret)
-    {
-    case FILE_TYPE_DISK:
-        flags |= ISDISK;
-        initial_pos = -1;
-        break;
-
-    case FILE_TYPE_UNKNOWN:
-        ret = GetLastError();
-        switch (ret)
-        {
-        default:
-            return RC (rcFS, rcFile, rcConstructing, rcFileDesc, rcUnknown);
-
-            /* specific errors can be added here */
-
-        case NO_ERROR:
-            break;
-        }
-
-        initial_pos = 0;
-        flags &= ~ISDISK;
-        break;
-
-    default:
-        initial_pos = 0;
-        flags &= ~ISDISK;
-        break;
-    }
-
-    switch (flags & (ISDISK|ISSTDIO))
-    {
-    case 0:
-        vt = (const KFile_vt*)&vtKSysOtherFile;
-        break;
-
-    case ISDISK:
-        vt = (const KFile_vt*)&vtKSysDiskFile;
-        break;
-
-    case ISSTDIO:
-        vt = (const KFile_vt*)&vtKSysStdIOOtherFile;
-        break;
-
-    case ISDISK|ISSTDIO:
-        vt = (const KFile_vt*)&vtKSysStdIODiskFile;
-        break;
-    }
-
-    return KSysFileMakeVT ( fp, fd, vt, path, initial_pos, read_enabled, write_enabled );
-}
-
-/* extern, but internal to libkfs */
-rc_t KSysFileMake ( KSysFile **fp, HANDLE fd, const char *path, bool read_enabled, bool write_enabled )
-{
-    return KSysFileMakeInt ( fp, fd, path, read_enabled, write_enabled, 0 );
-}
-
-
-/* MakeStdIn
- *  creates a read-only file on stdin
- */
-LIB_EXPORT rc_t CC KFileMakeStdIn ( const KFile **fp )
-{
-    HANDLE fd = GetStdHandle ( STD_INPUT_HANDLE );
-    return KSysFileMakeInt ( (KSysFile**)fp, fd, "stdin", true, false, ISSTDIO );
-}
-
-/* MakeStdOut
- * MakeStdErr
- *  creates a write-only file on stdout or stderr
- */
-LIB_EXPORT rc_t CC KFileMakeStdOut ( KFile **fp )
-{
-    HANDLE fd = GetStdHandle ( STD_OUTPUT_HANDLE );
-    return KSysFileMakeInt ( (KSysFile**)fp, fd, "stdout", false, true, ISSTDIO );
-}
-
-LIB_EXPORT rc_t CC KFileMakeStdErr ( KFile **fp )
-{
-    HANDLE fd = GetStdHandle ( STD_ERROR_HANDLE );
-    return KSysFileMakeInt ( (KSysFile**)fp, fd, "stderr", false, true, ISSTDIO );
-}
-
-/* MakeFDFile
- *  creates a file from a file-descriptor
- *  not supported under Windows
- */
-LIB_EXPORT rc_t CC KFileMakeFDFileRead ( const KFile **f, int fd )
-{
-    return RC (rcFS, rcFile, rcConstructing, rcFunction, rcUnsupported);
-}
-
-LIB_EXPORT rc_t CC KFileMakeFDFileWrite ( KFile **f, bool update, int fd )
-{
-    return RC (rcFS, rcFile, rcConstructing, rcFunction, rcUnsupported);
-}
diff --git a/libs/kfs/win/syslockfile.c b/libs/kfs/win/syslockfile.c
deleted file mode 100644
index 9b09f8d..0000000
--- a/libs/kfs/win/syslockfile.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kfs/extern.h>
-#include <kfs/lockfile.h>
-#include <kfs/directory.h>
-#include <klib/rc.h>
-
-
-/*--------------------------------------------------------------------------
- * KDirectory
- *  interface extensions
- */
-
-
-/* CreateExclusiveAccessFile
- *  opens a file with exclusive write access
- *
- *  "f" [ OUT ] - return parameter for newly opened file
- *
- *  "update" [ IN ] - if true, open in read/write mode
- *  otherwise, open in write-only mode
- *
- *  "access" [ IN ] - standard Unix access mode, e.g. 0664
- *
- *  "mode" [ IN ] - a creation mode ( see explanation above ).
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- */
-LIB_EXPORT rc_t CC KDirectoryVCreateExclusiveAccessFile ( KDirectory *self, struct KFile **f,
-    bool update, uint32_t access, KCreateMode mode, const char *path, va_list args )
-{
-    /* Windows should naturally behave as we want here... */
-    rc_t rc = KDirectoryVCreateFile ( self, f, update, access, mode, path, args );
-    if ( rc != 0 )
-    {
-        if ( GetRCState ( rc ) == rcExists )
-            rc = RC ( rcFS, rcFile, rcLocking, rcLocking, rcBusy );
-        else
-            rc = ResetRCContext ( rc, rcFS, rcFile, rcLocking );
-    }
-    return rc;
-}
diff --git a/libs/kfs/win/sysmmap-priv.h b/libs/kfs/win/sysmmap-priv.h
deleted file mode 100644
index 71dbdf9..0000000
--- a/libs/kfs/win/sysmmap-priv.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_sysmmap_priv_
-#define _h_sysmmap_priv_
-
-#ifndef _h_mmap_priv_
-#include "../mmap-priv.h"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KMMap
- *  a memory mapped region
- */
-struct KMMap
-{
-    uint64_t off;
-    uint64_t pos;
-    size_t size;
-    char *addr;
-
-    struct KFile *f;
-    size_t pg_size;
-
-    /* file mapping handle */
-    HANDLE handle;
-
-    uint32_t addr_adj;
-    uint32_t size_adj;
-
-    KRefcount refcount;
-
-    bool read_only;
-    bool sys_mmap;
-    bool dirty;
-};
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_sysmmap_priv_ */
diff --git a/libs/kfs/win/sysmmap.c b/libs/kfs/win/sysmmap.c
deleted file mode 100644
index 28c9873..0000000
--- a/libs/kfs/win/sysmmap.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kfs/extern.h>
-#include "sysmmap-priv.h"
-#include "sysfile-priv.h"
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <WINDOWS.H>
-
-
-/*--------------------------------------------------------------------------
- * KMMap
- *  a memory mapped region
- */
-
-/* Make
- */
-rc_t KMMapMake ( KMMap **mmp )
-{
-    SYSTEM_INFO sinfo;
-
-    KMMap *mm = calloc ( 1, sizeof * mm );
-    if ( mm == NULL )
-        return RC ( rcFS, rcMemMap, rcConstructing, rcMemory, rcExhausted );
-
-    GetSystemInfo ( & sinfo );
-    mm -> pg_size = sinfo . dwAllocationGranularity;
-
-    * mmp = mm;
-
-    return 0;
-}
-
-
-/* RWSys
- */
-rc_t KMMapRWSys ( KMMap *self, uint64_t pos, size_t size )
-{
-    DWORD status;
-
-    KSysFile *sf = KFileGetSysFile ( self -> f, & self -> off );
-    if ( sf == NULL )
-        return RC ( rcFS, rcMemMap, rcConstructing, rcFile, rcIncorrect );
-
-    self -> handle = CreateFileMapping ( sf -> handle, NULL, PAGE_READWRITE, 0, 0, NULL );
-    if ( self -> handle != NULL )
-    {
-        self -> addr = MapViewOfFile ( self -> handle, FILE_MAP_ALL_ACCESS, 
-            ( DWORD ) ( pos >> 32 ), ( DWORD ) pos, size );
-        if ( self -> addr != NULL )
-            return 0;
-    }
-
-    switch ( status = GetLastError () )
-    {
-    /* NEED ERROR CODES - THANKS, REDMOND!! */
-    default:
-        break;
-    }
-
-    return RC ( rcFS, rcMemMap, rcConstructing, rcNoObj, rcUnknown );
-}
-
-
-/* ROSys
- */
-rc_t KMMapROSys ( KMMap *self, uint64_t pos, size_t size )
-{
-    DWORD status;
-
-    KSysFile *sf = KFileGetSysFile ( self -> f, & self -> off );
-    if ( sf == NULL )
-        return RC ( rcFS, rcMemMap, rcConstructing, rcFile, rcIncorrect );
-
-    self -> handle = CreateFileMapping ( sf -> handle, NULL, PAGE_READONLY, 0, 0, NULL );
-    if ( self -> handle != NULL )
-    {
-        self -> addr = MapViewOfFile ( self -> handle, FILE_MAP_READ, 
-            ( DWORD ) ( pos >> 32 ), ( DWORD ) pos, size );
-        if ( self -> addr != NULL )
-            return 0;
-    }
-
-    switch ( status = GetLastError () )
-    {
-    /* NEED ERROR CODES - THANKS, REDMOND!! */
-    default:
-        break;
-    }
-
-    return RC ( rcFS, rcMemMap, rcConstructing, rcNoObj, rcUnknown );
-}
-
-
-/* Unmap
- *  removes a memory map
- */
-rc_t KMMapUnmap ( KMMap *self )
-{
-    if ( self -> handle != NULL )
-    {
-        if ( ! CloseHandle ( self -> handle ) )
-            return RC ( rcFS, rcMemMap, rcDestroying, rcNoObj, rcUnknown );
-        if ( ! UnmapViewOfFile( self -> addr ) )
-            return RC ( rcFS, rcMemMap, rcDestroying, rcNoObj, rcUnknown );
-
-        self -> addr = NULL;
-        self -> size = 0;
-        self -> handle = NULL;
-    }
-
-    return 0;
-}
diff --git a/libs/klib/Judy.h b/libs/klib/Judy.h
deleted file mode 100644
index 0b2c518..0000000
--- a/libs/klib/Judy.h
+++ /dev/null
@@ -1,629 +0,0 @@
-#ifndef _JUDY_INCLUDED
-#define _JUDY_INCLUDED
-/*
-// _________________
-//
-// Copyright (C) 2000 - 2002 Hewlett-Packard Company
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the term of the GNU Lesser 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 Lesser General Public License
-// for more details.
-//
-// You should have received a copy of the GNU Lesser 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
-// _________________
-//
-// HEADER FILE FOR EXPORTED FEATURES IN JUDY LIBRARY, libJudy.*
-//
-// See the manual entries for details.
-//
-// Note:  This header file uses old-style comments on #-directive lines and
-// avoids "()" on macro names in comments for compatibility with older cc -Aa
-// and some tools on some platforms.
-
-
-// PLATFORM-SPECIFIC
-*/
-
-#if ! JUST_DEFINE_YOUR_STUFF
-
-#ifdef JU_WIN /* =============================================== */
-
-typedef __int8           int8_t;
-typedef __int16          int16_t;
-typedef __int32          int32_t;
-typedef __int64          int64_t;
-
-typedef unsigned __int8  uint8_t;
-typedef unsigned __int16 uint16_t;
-typedef unsigned __int32 uint32_t;
-typedef unsigned __int64 uint64_t;
-
-#else /* ================ ! JU_WIN ============================= */
-
-/* ISO C99: 7.8 Format conversion of integer types <inttypes.h> */
-/*#include <inttypes.h>   if this FAILS, try #include <stdint.h> */ 
-
-/* ISO C99: 7.18 Integer types uint*_t */
-#include <stdint.h> 
-
-#endif /* ================ ! JU_WIN ============================= */
-
-/* ISO C99 Standard: 7.20 General utilities */
-#include <stdlib.h>  
-
-/* ISO C99 Standard: 7.10/5.2.4.2.1 Sizes of integer types */
-#include <limits.h>
-
-#endif /* JUST_DEFINE_YOUR_STUFF */
-
-#ifdef __cplusplus      /* support use by C++ code */
-extern "C" {
-#endif
-
-
-/* ****************************************************************************
-// DECLARE SOME BASE TYPES IN CASE THEY ARE MISSING:
-//
-// These base types include "const" where appropriate, but only where of
-// interest to the caller.  For example, a caller cares that a variable passed
-// by reference will not be modified, such as, "const void * Pindex", but not
-// that the called function internally does not modify the pointer itself, such
-// as, "void * const Pindex".
-//
-// Note that its OK to pass a Pvoid_t to a Pcvoid_t; the latter is the same,
-// only constant.  Callers need to do this so they can also pass & Pvoid_t to
-// PPvoid_t (non-constant).
-*/
-
-#ifndef _PCVOID_T
-#define _PCVOID_T
-typedef const void * Pcvoid_t;
-#endif
-
-#ifndef _PVOID_T
-#define _PVOID_T
-typedef void *   Pvoid_t;
-typedef void ** PPvoid_t;
-#endif
-
-#ifndef _WORD_T
-#define _WORD_T
-    typedef  size_t  Word_t, * PWord_t;  /* expect 32-bit or 64-bit words. */
-#endif
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-
-/* ****************************************************************************
-// SUPPORT FOR ERROR HANDLING:
-//
-// Judy error numbers:
-//
-// Note:  These are an enum so theres a related typedef, but the numbers are
-// spelled out so you can map a number back to its name.
-*/
-typedef enum            /* uint8_t -- but C does not support this type of enum.
-                                   -- nor does it support // comments!!         */
-{
-
-/* Note:  JU_ERRNO_NONE and JU_ERRNO_FULL are not real errors.  They specify
-// conditions which are otherwise impossible return values from 32-bit
-// Judy1Count, which has 2^32 + 1 valid returns (0..2^32) plus one error
-// return.  These pseudo-errors support the return values that cannot otherwise
-// be unambiguously represented in a 32-bit word, and will never occur on a
-// 64-bit system. */
-
-        JU_ERRNO_NONE           = 0,
-        JU_ERRNO_FULL           = 1,
-        JU_ERRNO_NFMAX          = JU_ERRNO_FULL,
-
-/* JU_ERRNO_NOMEM comes from malloc(3C) when Judy cannot obtain needed memory.
-// The system errno value is also set to ENOMEM.  This error can be recoverable
-// if the calling application frees other memory.
-//
-// TBD:  Currently there is no guarantee the Judy array has no memory leaks
-// upon JU_ERRNO_NOMEM. */
-
-        JU_ERRNO_NOMEM          = 2,
-
-/* Problems with parameters from the calling program:
-//
-// JU_ERRNO_NULLPPARRAY means PPArray was null; perhaps PArray was passed where
-// &PArray was intended.  Similarly, JU_ERRNO_NULLPINDEX means PIndex was null;
-// perhaps &Index was intended.  Also, JU_ERRNO_NONNULLPARRAY,
-// JU_ERRNO_NULLPVALUE, and JU_ERRNO_UNSORTED, all added later (hence with
-// higher numbers), mean:  A non-null array was passed in where a null pointer
-// was required; PValue was null; and unsorted indexes were detected. */
-
-        JU_ERRNO_NULLPPARRAY    = 3,    /* see above.                       */
-        JU_ERRNO_NONNULLPARRAY  = 10,   /* see above.                       */
-        JU_ERRNO_NULLPINDEX     = 4,    /* see above.                       */
-        JU_ERRNO_NULLPVALUE     = 11,   /* see above.                       */
-        JU_ERRNO_NOTJUDY1       = 5,    /* PArray is not to a Judy1 array.  */
-        JU_ERRNO_NOTJUDYL       = 6,    /* PArray is not to a JudyL array.  */
-        JU_ERRNO_NOTJUDYSL      = 7,    /* PArray is not to a JudySL array. */
-        JU_ERRNO_UNSORTED       = 12,   /* see above.                       */
-
-/* Errors below this point are not recoverable; further tries to access the
-// Judy array might result in EFAULT and a core dump:
-//
-// JU_ERRNO_OVERRUN occurs when Judy detects, upon reallocation, that a block
-// of memory in its own freelist was modified since being freed. */
-
-        JU_ERRNO_OVERRUN        = 8,
-
-/* JU_ERRNO_CORRUPT occurs when Judy detects an impossible value in a Judy data
-// structure:
-//
-// Note:  The Judy data structure contains some redundant elements that support
-// this type of checking. */
-
-        JU_ERRNO_CORRUPT        = 9
-
-/* Warning:  At least some C or C++ compilers do not tolerate a trailing comma
-// above here.  At least we know of one case, in aCC; see JAGad58928. */
-
-} JU_Errno_t;
-
-
-/* Judy errno structure:
-//
-// WARNING:  For compatibility with possible future changes, the fields of this
-// struct should not be referenced directly.  Instead use the macros supplied
-// below.
-
-// This structure should be declared on the stack in a threaded process. */
-
-typedef struct J_UDY_ERROR_STRUCT
-{
-    JU_Errno_t je_Errno;            /* one of the enums above.               */
-    int        je_ErrID;            /* often an internal source line number. */
-    Word_t     je_reserved[4];      /* for future backward compatibility.    */
-
-} JError_t, * PJError_t;
-
-
-/* Related macros:
-//
-// Fields from error struct: */
-
-#define JU_ERRNO(PJError)  ((PJError)->je_Errno)
-#define JU_ERRID(PJError)  ((PJError)->je_ErrID)
-
-/* For checking return values from various Judy functions:
-//
-// Note:  Define JERR as -1, not as the seemingly more portable (Word_t)
-// (~0UL), to avoid a compiler "overflow in implicit constant conversion"
-// warning. */
-
-#define   JERR (-1)                     /* functions returning int or Word_t */
-#define  PJERR ((Pvoid_t)  (~0UL))      /* mainly for use here, see below    */
-#define PPJERR ((PPvoid_t) (~0UL))      /* functions that return PPvoid_t    */
-
-/* Convenience macro for when detailed error information (PJError_t) is not
-// desired by the caller; a purposely short name: */
-
-#define PJE0  ((PJError_t) NULL)
-
-
-/* ****************************************************************************
-// JUDY FUNCTIONS:
-//
-// P_JE is a shorthand for use below:
-*/
-#define P_JE  PJError_t PJError
-
-/* ****************************************************************************
-// JUDY1 FUNCTIONS:
-*/
-extern int      Judy1Test(       Pcvoid_t  PArray, Word_t   Index,   P_JE);
-extern int      Judy1Set(        PPvoid_t PPArray, Word_t   Index,   P_JE);
-extern int      Judy1SetArray(   PPvoid_t PPArray, Word_t   Count,
-                                             const Word_t * const PIndex,
-                                                                     P_JE);
-extern int      Judy1Unset(      PPvoid_t PPArray, Word_t   Index,   P_JE);
-extern Word_t   Judy1Count(      Pcvoid_t  PArray, Word_t   Index1,
-                                                   Word_t   Index2,  P_JE);
-extern int      Judy1ByCount(    Pcvoid_t  PArray, Word_t   Count,
-                                                   Word_t * PIndex,  P_JE);
-extern Word_t   Judy1FreeArray(  PPvoid_t PPArray,                   P_JE);
-extern Word_t   Judy1MemUsed(    Pcvoid_t  PArray);
-extern Word_t   Judy1MemActive(  Pcvoid_t  PArray);
-extern int      Judy1First(      Pcvoid_t  PArray, Word_t * PIndex,  P_JE);
-extern int      Judy1Next(       Pcvoid_t  PArray, Word_t * PIndex,  P_JE);
-extern int      Judy1Last(       Pcvoid_t  PArray, Word_t * PIndex,  P_JE);
-extern int      Judy1Prev(       Pcvoid_t  PArray, Word_t * PIndex,  P_JE);
-extern int      Judy1FirstEmpty( Pcvoid_t  PArray, Word_t * PIndex,  P_JE);
-extern int      Judy1NextEmpty(  Pcvoid_t  PArray, Word_t * PIndex,  P_JE);
-extern int      Judy1LastEmpty(  Pcvoid_t  PArray, Word_t * PIndex,  P_JE);
-extern int      Judy1PrevEmpty(  Pcvoid_t  PArray, Word_t * PIndex,  P_JE);
-
-/* ****************************************************************************
-// JUDYL FUNCTIONS:
-*/
-extern PPvoid_t JudyLGet(        Pcvoid_t  PArray, Word_t    Index,  P_JE);
-extern PPvoid_t JudyLIns(        PPvoid_t PPArray, Word_t    Index,  P_JE);
-extern int      JudyLInsArray(   PPvoid_t PPArray, Word_t    Count,
-                                             const Word_t * const PIndex,
-                                             const Word_t * const PValue,
-                                                                     P_JE);
-
-extern int      JudyLDel(        PPvoid_t PPArray, Word_t    Index,  P_JE);
-extern Word_t   JudyLCount(      Pcvoid_t  PArray, Word_t    Index1,
-                                                   Word_t    Index2, P_JE);
-extern PPvoid_t JudyLByCount(    Pcvoid_t  PArray, Word_t    Count,
-                                                   Word_t *  PIndex, P_JE);
-extern Word_t   JudyLFreeArray(  PPvoid_t PPArray,                   P_JE);
-extern Word_t   JudyLMemUsed(    Pcvoid_t  PArray);
-extern Word_t   JudyLMemActive(  Pcvoid_t  PArray);
-extern PPvoid_t JudyLFirst(      Pcvoid_t  PArray, Word_t * PIndex,  P_JE);
-extern PPvoid_t JudyLNext(       Pcvoid_t  PArray, Word_t * PIndex,  P_JE);
-extern PPvoid_t JudyLLast(       Pcvoid_t  PArray, Word_t * PIndex,  P_JE);
-extern PPvoid_t JudyLPrev(       Pcvoid_t  PArray, Word_t * PIndex,  P_JE);
-extern int      JudyLFirstEmpty( Pcvoid_t  PArray, Word_t * PIndex,  P_JE);
-extern int      JudyLNextEmpty(  Pcvoid_t  PArray, Word_t * PIndex,  P_JE);
-extern int      JudyLLastEmpty(  Pcvoid_t  PArray, Word_t * PIndex,  P_JE);
-extern int      JudyLPrevEmpty(  Pcvoid_t  PArray, Word_t * PIndex,  P_JE);
-
-/* ****************************************************************************
-// JUDYSL FUNCTIONS:
-*/
-extern PPvoid_t JudySLGet(       Pcvoid_t, const uint8_t * Index, P_JE);
-extern PPvoid_t JudySLIns(       PPvoid_t, const uint8_t * Index, P_JE);
-extern int      JudySLDel(       PPvoid_t, const uint8_t * Index, P_JE);
-extern Word_t   JudySLFreeArray( PPvoid_t,                        P_JE);
-extern PPvoid_t JudySLFirst(     Pcvoid_t,       uint8_t * Index, P_JE);
-extern PPvoid_t JudySLNext(      Pcvoid_t,       uint8_t * Index, P_JE);
-extern PPvoid_t JudySLLast(      Pcvoid_t,       uint8_t * Index, P_JE);
-extern PPvoid_t JudySLPrev(      Pcvoid_t,       uint8_t * Index, P_JE);
-
-/* ****************************************************************************
-// JUDYHSL FUNCTIONS:
-*/
-extern PPvoid_t JudyHSGet(       Pcvoid_t,  void *, Word_t);
-extern PPvoid_t JudyHSIns(       PPvoid_t,  void *, Word_t, P_JE);
-extern int      JudyHSDel(       PPvoid_t,  void *, Word_t, P_JE);
-extern Word_t   JudyHSFreeArray( PPvoid_t,                  P_JE);
-
-extern const char *Judy1MallocSizes;
-extern const char *JudyLMallocSizes;
-
-/* ****************************************************************************
-// JUDY memory interface to malloc() FUNCTIONS:
-*/
-extern Word_t JudyMalloc(Word_t);               /* words reqd => words allocd. */
-extern Word_t JudyMallocVirtual(Word_t);        /* words reqd => words allocd. */
-extern void   JudyFree(Pvoid_t, Word_t);        /* free, size in words.        */
-extern void   JudyFreeVirtual(Pvoid_t, Word_t); /* free, size in words.        */
-
-#define JLAP_INVALID    0x1     /* flag to mark pointer "not a Judy array" */
-
-/* ****************************************************************************
-// MACRO EQUIVALENTS FOR JUDY FUNCTIONS:
-//
-// The following macros, such as J1T, are shorthands for calling Judy functions
-// with parameter address-of and detailed error checking included.  Since they
-// are macros, the error checking code is replicated each time the macro is
-// used, but it runs fast in the normal case of no error.
-//
-// If the caller does not like the way the default JUDYERROR macro handles
-// errors (such as an exit(1) call when out of memory), they may define their
-// own before the "#include <Judy.h>".  A routine such as HandleJudyError
-// could do checking on specific error numbers and print a different message
-// dependent on the error.  The following is one example:
-//
-// Note: the back-slashes are removed because some compilers will not accept
-// them in comments.
-//
-// void HandleJudyError(uint8_t *, int, uint8_t *, int, int);
-// #define JUDYERROR(CallerFile, CallerLine, JudyFunc, JudyErrno, JudyErrID)
-// {
-//    HandleJudyError(CallerFile, CallerLine, JudyFunc, JudyErrno, JudyErrID);
-// }
-//
-// The routine HandleJudyError could do checking on specific error numbers and
-// print a different message dependent on the error.
-//
-// The macro receives five parameters that are:
-//
-// 1.  CallerFile:  Source filename where a Judy call returned a serious error.
-// 2.  CallerLine:  Line number in that source file.
-// 3.  JudyFunc:    Name of Judy function reporting the error.
-// 4.  JudyErrno:   One of the JU_ERRNO* values enumerated above.
-// 5.  JudyErrID:   The je_ErrID field described above.
-*/
-#ifndef JUDYERROR_NOTEST
-#ifndef JUDYERROR       /* supply a default error macro */
-#include <stdio.h>
-
-#define JUDYERROR(CallerFile, CallerLine, JudyFunc, JudyErrno, JudyErrID) \
-    {                                                                     \
-        (void) fprintf(stderr, "File '%s', line %d: %s(), "               \
-           "JU_ERRNO_* == %d, ID == %d\n",                                \
-           CallerFile, CallerLine,                                        \
-           JudyFunc, JudyErrno, JudyErrID);                               \
-        exit(1);                                                          \
-    }
-
-#endif /* JUDYERROR */
-#endif /* JUDYERROR_NOTEST */
-
-/* If the JUDYERROR macro is not desired at all, then the following eliminates
-// it.  However, the return code from each Judy function (that is, the first
-// parameter of each macro) must be checked by the caller to assure that an
-// error did not occur.
-//
-// Example:
-//
-//   #define JUDYERROR_NOTEST 1
-//   #include <Judy.h>
-//
-// or use this cc option at compile time:
-//
-//   cc -DJUDYERROR_NOTEST ...
-//
-// Example code:
-//
-//   J1S(Rc, PArray, Index);
-//   if (Rc == JERR) goto ...error
-//
-// or:
-//
-//   JLI(PValue, PArray, Index);
-//   if (PValue == PJERR) goto ...error
-
-
-// Internal shorthand macros for writing the J1S, etc. macros:
-*/
-#ifdef JUDYERROR_NOTEST /* ============================================ */
-
-/* "Judy Set Error": */
-
-#define J_SE(FuncName,Errno)  ((void) 0)
-
-/* Note:  In each J_*() case below, the digit is the number of key parameters
-// to the Judy*() call.  Just assign the Func result to the callers Rc value
-// without a cast because none is required, and this keeps the API simpler.
-// However, a family of different J_*() macros is needed to support the
-// different numbers of key parameters (0,1,2) and the Func return type.
-//
-// In the names below, "I" = integer result; "P" = pointer result.  Note, the
-// Funcs for J_*P() return PPvoid_t, but cast this to a Pvoid_t for flexible,
-// error-free assignment, and then compare to PJERR.
-*/
-#define J_0I(Rc,PArray,Func,FuncName) \
-        { (Rc) = Func(PArray, PJE0); }
-
-#define J_1I(Rc,PArray,Index,Func,FuncName) \
-        { (Rc) = Func(PArray, Index, PJE0); }
-
-#define J_1P(PV,PArray,Index,Func,FuncName) \
-        { (PV) = (Pvoid_t) Func(PArray, Index, PJE0); }
-
-#define J_2I(Rc,PArray,Index,Arg2,Func,FuncName) \
-        { (Rc) = Func(PArray, Index, Arg2, PJE0); }
-
-#define J_2C(Rc,PArray,Index1,Index2,Func,FuncName) \
-        { (Rc) = Func(PArray, Index1, Index2, PJE0); }
-
-#define J_2P(PV,PArray,Index,Arg2,Func,FuncName) \
-        { (PV) = (Pvoid_t) Func(PArray, Index, Arg2, PJE0); }
-
-/* Variations for Judy*Set/InsArray functions: */
-
-#define J_2AI(Rc,PArray,Count,PIndex,Func,FuncName) \
-        { (Rc) = Func(PArray, Count, PIndex, PJE0); }
-#define J_3AI(Rc,PArray,Count,PIndex,PValue,Func,FuncName) \
-        { (Rc) = Func(PArray, Count, PIndex, PValue, PJE0); }
-
-#else /* ================ ! JUDYERROR_NOTEST ============================= */
-
-#define J_E(FuncName,PJE) \
-        JUDYERROR(__FILE__, __LINE__, FuncName, JU_ERRNO(PJE), JU_ERRID(PJE))
-
-#define J_SE(FuncName,Errno)                                            \
-        {                                                               \
-            JError_t J_Error;                                           \
-            JU_ERRNO(&J_Error) = (Errno);                               \
-            JU_ERRID(&J_Error) = __LINE__;                              \
-            J_E(FuncName, &J_Error);                                    \
-        }
-
-/* Note:  In each J_*() case below, the digit is the number of key parameters
-// to the Judy*() call.  Just assign the Func result to the callers Rc value
-// without a cast because none is required, and this keeps the API simpler.
-// However, a family of different J_*() macros is needed to support the
-// different numbers of key parameters (0,1,2) and the Func return type.
-//
-// In the names below, "I" = integer result; "P" = pointer result.  Note, the
-// Funcs for J_*P() return PPvoid_t, but cast this to a Pvoid_t for flexible,
-// error-free assignment, and then compare to PJERR.
-*/
-#define J_0I(Rc,PArray,Func,FuncName)                                   \
-        {                                                               \
-            JError_t J_Error;                                           \
-            if (((Rc) = Func(PArray, &J_Error)) == JERR)                \
-                J_E(FuncName, &J_Error);                                \
-        }
-
-#define J_1I(Rc,PArray,Index,Func,FuncName)                             \
-        {                                                               \
-            JError_t J_Error;                                           \
-            if (((Rc) = Func(PArray, Index, &J_Error)) == JERR)         \
-                J_E(FuncName, &J_Error);                                \
-        }
-
-#define J_1P(Rc,PArray,Index,Func,FuncName)                             \
-        {                                                               \
-            JError_t J_Error;                                           \
-            if (((Rc) = (Pvoid_t) Func(PArray, Index, &J_Error)) == PJERR) \
-                J_E(FuncName, &J_Error);                                \
-        }
-
-#define J_2I(Rc,PArray,Index,Arg2,Func,FuncName)                        \
-        {                                                               \
-            JError_t J_Error;                                           \
-            if (((Rc) = Func(PArray, Index, Arg2, &J_Error)) == JERR)   \
-                J_E(FuncName, &J_Error);                                \
-        }
-
-/* Variation for Judy*Count functions, which return 0, not JERR, for error (and
-// also for other non-error cases):
-//
-// Note:  JU_ERRNO_NFMAX should only apply to 32-bit Judy1, but this header
-// file lacks the necessary ifdefs to make it go away otherwise, so always
-// check against it.
-*/
-#define J_2C(Rc,PArray,Index1,Index2,Func,FuncName)                     \
-        {                                                               \
-            JError_t J_Error;                                           \
-            if ((((Rc) = Func(PArray, Index1, Index2, &J_Error)) == 0)  \
-             && (JU_ERRNO(&J_Error) > JU_ERRNO_NFMAX))                  \
-            {                                                           \
-                J_E(FuncName, &J_Error);                                \
-            }                                                           \
-        }
-
-#define J_2P(PV,PArray,Index,Arg2,Func,FuncName)                        \
-        {                                                               \
-            JError_t J_Error;                                           \
-            if (((PV) = (Pvoid_t) Func(PArray, Index, Arg2, &J_Error))  \
-                == PJERR) J_E(FuncName, &J_Error);                      \
-        }
-
-/* Variations for Judy*Set/InsArray functions: */
-
-#define J_2AI(Rc,PArray,Count,PIndex,Func,FuncName)                     \
-        {                                                               \
-            JError_t J_Error;                                           \
-            if (((Rc) = Func(PArray, Count, PIndex, &J_Error)) == JERR) \
-                J_E(FuncName, &J_Error);                                \
-        }
-
-#define J_3AI(Rc,PArray,Count,PIndex,PValue,Func,FuncName)              \
-        {                                                               \
-            JError_t J_Error;                                           \
-            if (((Rc) = Func(PArray, Count, PIndex, PValue, &J_Error))  \
-                == JERR) J_E(FuncName, &J_Error);                       \
-        }
-
-#endif /* ================ ! JUDYERROR_NOTEST ============================= */
-
-/* Some of the macros are special cases that use inlined shortcuts for speed
-// with root-level leaves:
-
-// This is a slower version with current processors, but in the future...
-*/
-#define J1T(Rc,PArray,Index)                                            \
-    (Rc) = Judy1Test((Pvoid_t)(PArray), Index, PJE0)
-
-#define J1S( Rc,    PArray,   Index) \
-        J_1I(Rc, (&(PArray)), Index,  Judy1Set,   "Judy1Set")
-#define J1SA(Rc,    PArray,   Count, PIndex) \
-        J_2AI(Rc,(&(PArray)), Count, PIndex, Judy1SetArray, "Judy1SetArray")
-#define J1U( Rc,    PArray,   Index) \
-        J_1I(Rc, (&(PArray)), Index,  Judy1Unset, "Judy1Unset")
-#define J1F( Rc,    PArray,   Index) \
-        J_1I(Rc,    PArray, &(Index), Judy1First, "Judy1First")
-#define J1N( Rc,    PArray,   Index) \
-        J_1I(Rc,    PArray, &(Index), Judy1Next,  "Judy1Next")
-#define J1L( Rc,    PArray,   Index) \
-        J_1I(Rc,    PArray, &(Index), Judy1Last,  "Judy1Last")
-#define J1P( Rc,    PArray,   Index) \
-        J_1I(Rc,    PArray, &(Index), Judy1Prev,  "Judy1Prev")
-#define J1FE(Rc,    PArray,   Index) \
-        J_1I(Rc,    PArray, &(Index), Judy1FirstEmpty, "Judy1FirstEmpty")
-#define J1NE(Rc,    PArray,   Index) \
-        J_1I(Rc,    PArray, &(Index), Judy1NextEmpty,  "Judy1NextEmpty")
-#define J1LE(Rc,    PArray,   Index) \
-        J_1I(Rc,    PArray, &(Index), Judy1LastEmpty,  "Judy1LastEmpty")
-#define J1PE(Rc,    PArray,   Index) \
-        J_1I(Rc,    PArray, &(Index), Judy1PrevEmpty,  "Judy1PrevEmpty")
-#define J1C( Rc,    PArray,   Index1,  Index2) \
-        J_2C(Rc,    PArray,   Index1,  Index2, Judy1Count,   "Judy1Count")
-#define J1BC(Rc,    PArray,   Count,   Index) \
-        J_2I(Rc,    PArray,   Count, &(Index), Judy1ByCount, "Judy1ByCount")
-#define J1FA(Rc,    PArray) \
-        J_0I(Rc, (&(PArray)), Judy1FreeArray, "Judy1FreeArray")
-#define J1MU(Rc,    PArray) \
-        (Rc) = Judy1MemUsed(PArray)
-
-#define JLG(PV,PArray,Index)                                            \
-    (PV) = (Pvoid_t)JudyLGet((Pvoid_t)PArray, Index, PJE0)
-
-#define JLI( PV,    PArray,   Index)                                    \
-        J_1P(PV, (&(PArray)), Index,  JudyLIns,   "JudyLIns")
-
-#define JLIA(Rc,    PArray,   Count, PIndex, PValue)                    \
-        J_3AI(Rc,(&(PArray)), Count, PIndex, PValue, JudyLInsArray,     \
-                                                  "JudyLInsArray")
-#define JLD( Rc,    PArray,   Index)                                    \
-        J_1I(Rc, (&(PArray)), Index,  JudyLDel,   "JudyLDel")
-
-#define JLF( PV,    PArray,   Index)                                    \
-        J_1P(PV,    PArray, &(Index), JudyLFirst, "JudyLFirst")
-
-#define JLN( PV,    PArray,   Index)                                    \
-        J_1P(PV,    PArray, &(Index), JudyLNext, "JudyLNext")
-
-#define JLL( PV,    PArray,   Index)                                    \
-        J_1P(PV,    PArray, &(Index), JudyLLast,  "JudyLLast")
-#define JLP( PV,    PArray,   Index)                                    \
-        J_1P(PV,    PArray, &(Index), JudyLPrev,  "JudyLPrev")
-#define JLFE(Rc,    PArray,   Index)                                    \
-        J_1I(Rc,    PArray, &(Index), JudyLFirstEmpty, "JudyLFirstEmpty")
-#define JLNE(Rc,    PArray,   Index)                                    \
-        J_1I(Rc,    PArray, &(Index), JudyLNextEmpty,  "JudyLNextEmpty")
-#define JLLE(Rc,    PArray,   Index)                                    \
-        J_1I(Rc,    PArray, &(Index), JudyLLastEmpty,  "JudyLLastEmpty")
-#define JLPE(Rc,    PArray,   Index)                                    \
-        J_1I(Rc,    PArray, &(Index), JudyLPrevEmpty,  "JudyLPrevEmpty")
-#define JLC( Rc,    PArray,   Index1,  Index2)                          \
-        J_2C(Rc,    PArray,   Index1,  Index2, JudyLCount,   "JudyLCount")
-#define JLBC(PV,    PArray,   Count,   Index)                           \
-        J_2P(PV,    PArray,   Count, &(Index), JudyLByCount, "JudyLByCount")
-#define JLFA(Rc,    PArray)                                             \
-        J_0I(Rc, (&(PArray)), JudyLFreeArray, "JudyLFreeArray")
-#define JLMU(Rc,    PArray)                                             \
-        (Rc) = JudyLMemUsed(PArray)
-
-#define JHSI(PV,    PArray,   PIndex,   Count)                          \
-        J_2P(PV, (&(PArray)), PIndex,   Count, JudyHSIns, "JudyHSIns")
-#define JHSG(PV,    PArray,   PIndex,   Count)                          \
-        (PV) = (Pvoid_t) JudyHSGet(PArray, PIndex, Count)
-#define JHSD(Rc,    PArray,   PIndex,   Count)                          \
-        J_2I(Rc, (&(PArray)), PIndex, Count, JudyHSDel, "JudyHSDel")
-#define JHSFA(Rc,    PArray)                                            \
-        J_0I(Rc, (&(PArray)), JudyHSFreeArray, "JudyHSFreeArray")
-
-#define JSLG( PV,    PArray,   Index)                                   \
-        J_1P( PV,    PArray,   Index, JudySLGet,   "JudySLGet")
-#define JSLI( PV,    PArray,   Index)                                   \
-        J_1P( PV, (&(PArray)), Index, JudySLIns,   "JudySLIns")
-#define JSLD( Rc,    PArray,   Index)                                   \
-        J_1I( Rc, (&(PArray)), Index, JudySLDel,   "JudySLDel")
-#define JSLF( PV,    PArray,   Index)                                   \
-        J_1P( PV,    PArray,   Index, JudySLFirst, "JudySLFirst")
-#define JSLN( PV,    PArray,   Index)                                   \
-        J_1P( PV,    PArray,   Index, JudySLNext,  "JudySLNext")
-#define JSLL( PV,    PArray,   Index)                                   \
-        J_1P( PV,    PArray,   Index, JudySLLast,  "JudySLLast")
-#define JSLP( PV,    PArray,   Index)                                   \
-        J_1P( PV,    PArray,   Index, JudySLPrev,  "JudySLPrev")
-#define JSLFA(Rc,    PArray)                                            \
-        J_0I( Rc, (&(PArray)), JudySLFreeArray, "JudySLFreeArray")
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* ! _JUDY_INCLUDED */
diff --git a/libs/klib/Makefile b/libs/klib/Makefile
deleted file mode 100644
index 699815f..0000000
--- a/libs/klib/Makefile
+++ /dev/null
@@ -1,142 +0,0 @@
-# ===========================================================================
-#
-#                            PUBLIC DOMAIN NOTICE
-#               National Center for Biotechnology Information
-#
-#  This software/database is a "United States Government Work" under the
-#  terms of the United States Copyright Act.  It was written as part of
-#  the author's official duties as a United States Government employee and
-#  thus cannot be copyrighted.  This software/database is freely available
-#  to the public for use. The National Library of Medicine and the U.S.
-#  Government have not placed any restriction on its use or reproduction.
-#
-#  Although all reasonable efforts have been taken to ensure the accuracy
-#  and reliability of the software and data, the NLM and the U.S.
-#  Government do not and cannot warrant the performance or results that
-#  may be obtained by using this software or data. The NLM and the U.S.
-#  Government disclaim all warranties, express or implied, including
-#  warranties of performance, merchantability or fitness for any particular
-#  purpose.
-#
-#  Please cite the author in any work or product based on this material.
-#
-# ===========================================================================
-
-
-default: all
-
-TOP ?= $(shell ../../build/abspath.sh ../..)
-MODULE = libs/klib
-
-INT_LIBS = \
-	libklib
-
-ALL_LIBS = \
-	$(INT_LIBS)
-
-include $(TOP)/build/Makefile.env
-
-#-------------------------------------------------------------------------------
-# outer targets
-#
-all: makedirs
-	@ $(MAKE) -C $(SRCDIR)/judy all
-	@ $(MAKE_CMD) $(TARGDIR)/all
-
-std: makedirs
-	@ $(MAKE) -C $(SRCDIR)/judy std
-	@ $(MAKE_CMD) $(TARGDIR)/std
-
-$(INT_LIBS): makedirs
-	@ $(MAKE) -C $(SRCDIR)/judy std
-	@ $(MAKE_CMD) $(ILIBDIR)/$@
-
-.PHONY: all std $(ALL_LIBS)
-
-#-------------------------------------------------------------------------------
-# all, std
-#
-$(TARGDIR)/all $(TARGDIR)/std: \
-	$(addprefix $(ILIBDIR)/,$(INT_LIBS))
-
-.PHONY: $(TARGDIR)/all $(TARGDIR)/std
-
-#-------------------------------------------------------------------------------
-# clean
-#
-clean: stdclean
-	@ $(MAKE) -C $(SRCDIR)/judy clean
-
-.PHONY: clean
-
-#-------------------------------------------------------------------------------
-# klib
-#
-$(ILIBDIR)/libklib: $(addprefix $(ILIBDIR)/libklib.,$(ILIBEXT))
-
-KLIB_SRC = \
-	text \
-	utf8 \
-	iso8859 \
-	iso8859-1 \
-	cp1252 \
-	token \
-	symtab \
-	container \
-	vector \
-	namelist \
-	vector_namelist \
-	trie \
-	pbstree \
-	pbstree-impl.nopt \
-	pbstree-impl.swap.nopt \
-	bstpersist.nopt \
-	ptrie.nopt \
-	ptpersist.nopt \
-	crc32 \
-	md5 \
-	misc \
-	SHA-32bit \
-	SHA-64bit \
-	qsort \
-	ksort \
-	bsearch \
-	pack \
-	unpack \
-	vlen-encode \
-	data-buffer \
-	refcount \
-	printf \
-	status-rc-strings \
-	status-rc \
-	syserrcode \
-	syswriter \
-	out \
-	status \
-	log \
-	writer \
-	syslog \
-	systime \
-	rc-tbl \
-	rc-idx-tbl \
-	judy-vector \
-	report \
-	sra-release-version
-
-ifeq (win,$(OS))
-	KLIB_SRC += sysalloc
-endif
-
-ifeq (dbg,$(BUILD))
-	KLIB_SRC += debug
-endif
-
-KLIB_OBJ = \
-	$(addsuffix .$(LOBX),$(KLIB_SRC))
-
-KLIB_LIB = \
-	-sjudy \
-	-lm
-
-$(ILIBDIR)/libklib.$(LIBX): $(KLIB_OBJ)
-	$(LD) --slib -o $@ $^ $(KLIB_LIB)
diff --git a/libs/klib/SHA-32bit.c b/libs/klib/SHA-32bit.c
deleted file mode 100644
index 3b4bbfc..0000000
--- a/libs/klib/SHA-32bit.c
+++ /dev/null
@@ -1,307 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <klib/extern.h>
-#include <klib/checksum.h>
-
-#include <endian.h>
-#include <byteswap.h>
-
-#include <stdint.h>
-#include <string.h>
-
-static const uint32_t H0_1[5] =
-{
-    0x67452301U,
-    0xefcdab89U,
-    0x98badcfeU,
-    0x10325476U,
-    0xc3d2e1f0U,
-};
-
-static const uint32_t K_1[4] =
-{
-    0x5a827999U,
-    0x6ed9eba1U,
-    0x8f1bbcdcU,
-    0xca62c1d6U
-};
-
-static const uint32_t H0_2[8] =
-{
-    0x6a09e667U,
-    0xbb67ae85U,
-    0x3c6ef372U,
-    0xa54ff53aU,
-    0x510e527fU,
-    0x9b05688cU,
-    0x1f83d9abU,
-    0x5be0cd19U,
-};
-
-static const uint32_t K_2[] =
-{
-    0x428a2f98U, 0x71374491U, 0xb5c0fbcfU, 0xe9b5dba5U, 
-    0x3956c25bU, 0x59f111f1U, 0x923f82a4U, 0xab1c5ed5U, 
-    0xd807aa98U, 0x12835b01U, 0x243185beU, 0x550c7dc3U, 
-    0x72be5d74U, 0x80deb1feU, 0x9bdc06a7U, 0xc19bf174U, 
-    0xe49b69c1U, 0xefbe4786U, 0x0fc19dc6U, 0x240ca1ccU, 
-    0x2de92c6fU, 0x4a7484aaU, 0x5cb0a9dcU, 0x76f988daU, 
-    0x983e5152U, 0xa831c66dU, 0xb00327c8U, 0xbf597fc7U, 
-    0xc6e00bf3U, 0xd5a79147U, 0x06ca6351U, 0x14292967U, 
-    0x27b70a85U, 0x2e1b2138U, 0x4d2c6dfcU, 0x53380d13U, 
-    0x650a7354U, 0x766a0abbU, 0x81c2c92eU, 0x92722c85U, 
-    0xa2bfe8a1U, 0xa81a664bU, 0xc24b8b70U, 0xc76c51a3U, 
-    0xd192e819U, 0xd6990624U, 0xf40e3585U, 0x106aa070U, 
-    0x19a4c116U, 0x1e376c08U, 0x2748774cU, 0x34b0bcb5U, 
-    0x391c0cb3U, 0x4ed8aa4aU, 0x5b9cca4fU, 0x682e6ff3U, 
-    0x748f82eeU, 0x78a5636fU, 0x84c87814U, 0x8cc70208U, 
-    0x90befffaU, 0xa4506cebU, 0xbef9a3f7U, 0xc67178f2U, 
-};
-
-#define ROL(X, N) (((X) << (N)) | ((X) >> (32 - (N))))
-#define ROR(X, N) ROL(X, 32-N)
-#define SHR(X, N) ((X) >> (N))
-
-#define Ch(X, Y, Z) (((X) & (Y))^((~(X))&(Z)))
-#define Maj(X, Y, Z) (((X)&(Y))^((X)&(Z))^((Y)&(Z)))
-#define Parity(X, Y, Z) ((X)^(Y)^(Z))
-#define Sigma0(X) (ROR((X),  2)^ROR((X), 13)^ROR((X), 22))
-#define Sigma1(X) (ROR((X),  6)^ROR((X), 11)^ROR((X), 25))
-#define sigma0(X) (ROR((X),  7)^ROR((X), 18)^SHR((X),  3))
-#define sigma1(X) (ROR((X), 17)^ROR((X), 19)^SHR((X), 10))
-
-static void SHA1_stage(uint32_t Ho[8], const uint32_t Hi[8], uint32_t W[16])
-{
-    uint32_t a = Hi[0];
-    uint32_t b = Hi[1];
-    uint32_t c = Hi[2];
-    uint32_t d = Hi[3];
-    uint32_t e = Hi[4];
-    unsigned t;
-    
-    for (t = 0; t != 16; ++t) {
-        const uint32_t T = ROL(a, 5) + Ch(b, c, d) + e + K_1[0] + W[t];
-        
-        e = d; d = c; c = ROL(b, 30); b = a; a = T;
-    }
-    for ( ; t != 20; ++t) {
-        const uint32_t T = ROL(a, 5) + Ch(b, c, d) + e + K_1[0] +
-            (W[t%16] = ROL(W[(t-3)%16] ^ W[(t-8)%16] ^ W[(t-14)%16] ^ W[(t-16)%16], 1));
-        
-        e = d; d = c; c = ROL(b, 30); b = a; a = T;
-    }
-    for ( ; t != 40; ++t) {
-        const uint32_t T = ROL(a, 5) + Parity(b, c, d) + e + K_1[1] +
-            (W[t%16] = ROL(W[(t-3)%16] ^ W[(t-8)%16] ^ W[(t-14)%16] ^ W[(t-16)%16], 1));
-        
-        e = d; d = c; c = ROL(b, 30); b = a; a = T;
-    }
-    for ( ; t != 60; ++t) {
-        const uint32_t T = ROL(a, 5) + Maj(b, c, d) + e + K_1[2] +
-            (W[t%16] = ROL(W[(t-3)%16] ^ W[(t-8)%16] ^ W[(t-14)%16] ^ W[(t-16)%16], 1));
-        
-        e = d; d = c; c = ROL(b, 30); b = a; a = T;
-    }
-    for ( ; t != 80; ++t) {
-        const uint32_t T = ROL(a, 5) + Parity(b, c, d) + e + K_1[3] +
-            (W[t%16] = ROL(W[(t-3)%16] ^ W[(t-8)%16] ^ W[(t-14)%16] ^ W[(t-16)%16], 1));
-        
-        e = d; d = c; c = ROL(b, 30); b = a; a = T;
-    }
-    Ho[0] = Hi[0] + a;
-    Ho[1] = Hi[1] + b;
-    Ho[2] = Hi[2] + c;
-    Ho[3] = Hi[3] + d;
-    Ho[4] = Hi[4] + e;
-}
-
-static void SHA2_stage(uint32_t Ho[8], const uint32_t Hi[8], uint32_t W[16])
-{
-    uint32_t a = Hi[0];
-    uint32_t b = Hi[1];
-    uint32_t c = Hi[2];
-    uint32_t d = Hi[3];
-    uint32_t e = Hi[4];
-    uint32_t f = Hi[5];
-    uint32_t g = Hi[6];
-    uint32_t h = Hi[7];
-    unsigned t;
-    
-    for (t = 0; t != 16; ++t) {
-        const uint32_t T1 = h + Sigma1(e) + Ch(e, f, g) + K_2[t] + W[t];
-        const uint32_t T2 = Sigma0(a) + Maj(a, b, c);
-        
-        h = g; g = f; f = e; e = d + T1;
-        d = c; c = b; b = a; a = T1 + T2;
-    }
-    for ( ; t != 64; ++t) {
-        const uint32_t T1 = h + Sigma1(e) + Ch(e, f, g) + K_2[t] +
-            (W[t%16] = sigma1(W[(t-2)%16])+W[(t-7)%16]+sigma0(W[(t-15)%16])+W[(t-16)%16]);
-        const uint32_t T2 = Sigma0(a) + Maj(a, b, c);
-        
-        h = g; g = f; f = e; e = d + T1;
-        d = c; c = b; b = a; a = T1 + T2;
-    }
-    Ho[0] = Hi[0] + a;
-    Ho[1] = Hi[1] + b;
-    Ho[2] = Hi[2] + c;
-    Ho[3] = Hi[3] + d;
-    Ho[4] = Hi[4] + e;
-    Ho[5] = Hi[5] + f;
-    Ho[6] = Hi[6] + g;
-    Ho[7] = Hi[7] + h;
-}
-
-static __inline__ void SHA_32b_Init(struct SHA32bitState *ctx, int which)
-{
-    if (which == 0)
-        memcpy(ctx->H, H0_1, sizeof(H0_1));
-    else
-        memcpy(ctx->H, H0_2, sizeof(H0_2));
-    ctx->len = 0;
-    ctx->cur = 0;
-}
-
-static __inline__ void SHA_32b_Append(struct SHA32bitState *ctx, int which, const uint8_t data[], size_t length)
-{
-    unsigned i;
-    unsigned j;
-    unsigned n;
-    
-    ctx->len += length;
-    for (i = 0; i != length; i += n) {
-        n = length - i > 64 ? 64 : (unsigned)(length - i);
-        if (ctx->cur + n > 64)
-            n = 64 - ctx->cur;
-        memcpy(&ctx->W[ctx->cur], &data[i], n);
-        ctx->cur += n;
-        if (ctx->cur == 64) {
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-            uint32_t W[16];
-            
-            for (j = 0; j != 16; ++j)
-                W[j] = bswap_32(((const uint32_t *)ctx->W)[j]);
-            
-            (which ? SHA2_stage : SHA1_stage)(ctx->H, ctx->H, W);
-#else
-            (which ? SHA2_stage : SHA1_stage)(ctx->H, ctx->H, ctx->W);
-#endif
-            ctx->cur = 0;
-        }
-    }
-}
-
-static __inline__ void SHA_32b_Finish(const struct SHA32bitState *ctx, int which, uint32_t rslt[8])
-{
-    unsigned j;
-    unsigned const n = (ctx->cur + 3) >> 2;
-    uint32_t W[32];
-    
-    memset(W, 0, sizeof(W));
-    for (j = 0; j != n; ++j) {
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-        W[j] = bswap_32(((const uint32_t *)ctx->W)[j]);
-#else
-        W[j] = ((const uint32_t *)ctx->W)[j];
-#endif
-    }
-    if (ctx->cur & 3) {
-        --j;
-        W[j] &= (~((uint32_t)0)) << ((4 - (ctx->cur & 3)) * 8);
-        W[j] |= ((uint32_t)0x80U) << ((3 - (ctx->cur & 3)) * 8);
-    }
-    else
-        W[j] = ((uint32_t)0x80U) << 24;
-    if (j < 14) {
-        W[14] = (uint32_t)(ctx->len >> 29);
-        W[15] = (uint32_t)(ctx->len <<  3);
-        (which ? SHA2_stage : SHA1_stage)(rslt, ctx->H, W);
-    }
-    else {
-        W[30] = (uint32_t)(ctx->len >> 29);
-        W[31] = (uint32_t)(ctx->len <<  3);
-        (which ? SHA2_stage : SHA1_stage)(rslt, ctx->H, W);
-        (which ? SHA2_stage : SHA1_stage)(rslt, rslt, W + 16);
-    }
-}
-
-void CC SHA1StateInit(SHA1State *ctx)
-{
-    SHA_32b_Init(ctx, 0);
-}
-
-void CC SHA1StateAppend(SHA1State *ctx, const void *data, size_t length)
-{
-    SHA_32b_Append(ctx, 0, data, length);
-}
-
-void CC SHA1StateFinish(SHA1State *ctx, uint8_t hash[20])
-{
-    uint32_t H[8];
-
-    SHA_32b_Finish(ctx, 0, H);
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-    {
-        H[0] = bswap_32(H[0]);
-        H[1] = bswap_32(H[1]);
-        H[2] = bswap_32(H[2]);
-        H[3] = bswap_32(H[3]);
-        H[4] = bswap_32(H[4]);
-    }
-#endif
-    memcpy(hash, H, 20);
-}
-
-void CC SHA256StateInit(SHA256State *ctx)
-{
-    SHA_32b_Init(ctx, 1);
-}
-
-void CC SHA256StateAppend(SHA256State *ctx, const void *data, size_t length)
-{
-    SHA_32b_Append(ctx, 1, data, length);
-}
-
-void CC SHA256StateFinish(SHA256State *ctx, uint8_t hash[32])
-{
-    uint32_t H[8];
-
-    SHA_32b_Finish(ctx, 1, H);
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-    {
-        H[0] = bswap_32(H[0]);
-        H[1] = bswap_32(H[1]);
-        H[2] = bswap_32(H[2]);
-        H[3] = bswap_32(H[3]);
-        H[4] = bswap_32(H[4]);
-        H[5] = bswap_32(H[5]);
-        H[6] = bswap_32(H[6]);
-        H[7] = bswap_32(H[7]);
-    }
-#endif
-    memcpy(hash, H, 32);
-}
diff --git a/libs/klib/SHA-64bit.c b/libs/klib/SHA-64bit.c
deleted file mode 100644
index 1fc1914..0000000
--- a/libs/klib/SHA-64bit.c
+++ /dev/null
@@ -1,270 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <klib/extern.h>
-#include <klib/checksum.h>
-
-#include <endian.h>
-#include <byteswap.h>
-
-#include <stdint.h>
-#include <string.h>
-
-#if _ARCH_BITS == 32
-#define UL( x ) x ## ULL
-#else
-#define UL( x ) x ## UL
-#endif
-
-static const uint64_t H0_384[8] =
-{
-    UL(0xcbbb9d5dc1059ed8),
-    UL(0x629a292a367cd507),
-    UL(0x9159015a3070dd17),
-    UL(0x152fecd8f70e5939),
-    UL(0x67332667ffc00b31),
-    UL(0x8eb44a8768581511),
-    UL(0xdb0c2e0d64f98fa7),
-    UL(0x47b5481dbefa4fa4),
-};
-
-static const uint64_t H0_512[8] =
-{
-    UL(0x6a09e667f3bcc908),
-    UL(0xbb67ae8584caa73b),
-    UL(0x3c6ef372fe94f82b),
-    UL(0xa54ff53a5f1d36f1),
-    UL(0x510e527fade682d1),
-    UL(0x9b05688c2b3e6c1f),
-    UL(0x1f83d9abfb41bd6b),
-    UL(0x5be0cd19137e2179),
-};
-
-static const uint64_t K[] =
-{
-    UL(0x428a2f98d728ae22), UL(0x7137449123ef65cd), UL(0xb5c0fbcfec4d3b2f), UL(0xe9b5dba58189dbbc), 
-    UL(0x3956c25bf348b538), UL(0x59f111f1b605d019), UL(0x923f82a4af194f9b), UL(0xab1c5ed5da6d8118), 
-    UL(0xd807aa98a3030242), UL(0x12835b0145706fbe), UL(0x243185be4ee4b28c), UL(0x550c7dc3d5ffb4e2), 
-    UL(0x72be5d74f27b896f), UL(0x80deb1fe3b1696b1), UL(0x9bdc06a725c71235), UL(0xc19bf174cf692694), 
-    UL(0xe49b69c19ef14ad2), UL(0xefbe4786384f25e3), UL(0x0fc19dc68b8cd5b5), UL(0x240ca1cc77ac9c65), 
-    UL(0x2de92c6f592b0275), UL(0x4a7484aa6ea6e483), UL(0x5cb0a9dcbd41fbd4), UL(0x76f988da831153b5), 
-    UL(0x983e5152ee66dfab), UL(0xa831c66d2db43210), UL(0xb00327c898fb213f), UL(0xbf597fc7beef0ee4), 
-    UL(0xc6e00bf33da88fc2), UL(0xd5a79147930aa725), UL(0x06ca6351e003826f), UL(0x142929670a0e6e70), 
-    UL(0x27b70a8546d22ffc), UL(0x2e1b21385c26c926), UL(0x4d2c6dfc5ac42aed), UL(0x53380d139d95b3df), 
-    UL(0x650a73548baf63de), UL(0x766a0abb3c77b2a8), UL(0x81c2c92e47edaee6), UL(0x92722c851482353b), 
-    UL(0xa2bfe8a14cf10364), UL(0xa81a664bbc423001), UL(0xc24b8b70d0f89791), UL(0xc76c51a30654be30), 
-    UL(0xd192e819d6ef5218), UL(0xd69906245565a910), UL(0xf40e35855771202a), UL(0x106aa07032bbd1b8), 
-    UL(0x19a4c116b8d2d0c8), UL(0x1e376c085141ab53), UL(0x2748774cdf8eeb99), UL(0x34b0bcb5e19b48a8), 
-    UL(0x391c0cb3c5c95a63), UL(0x4ed8aa4ae3418acb), UL(0x5b9cca4f7763e373), UL(0x682e6ff3d6b2b8a3), 
-    UL(0x748f82ee5defb2fc), UL(0x78a5636f43172f60), UL(0x84c87814a1f0ab72), UL(0x8cc702081a6439ec), 
-    UL(0x90befffa23631e28), UL(0xa4506cebde82bde9), UL(0xbef9a3f7b2c67915), UL(0xc67178f2e372532b), 
-    UL(0xca273eceea26619c), UL(0xd186b8c721c0c207), UL(0xeada7dd6cde0eb1e), UL(0xf57d4f7fee6ed178), 
-    UL(0x06f067aa72176fba), UL(0x0a637dc5a2c898a6), UL(0x113f9804bef90dae), UL(0x1b710b35131c471b), 
-    UL(0x28db77f523047d84), UL(0x32caab7b40c72493), UL(0x3c9ebe0a15c9bebc), UL(0x431d67c49c100d4c), 
-    UL(0x4cc5d4becb3e42b6), UL(0x597f299cfc657e2a), UL(0x5fcb6fab3ad6faec), UL(0x6c44198c4a475817), 
-};
-
-#undef UL
-
-#define ROL(X, N) (((X) << (N)) | ((X) >> (64 - (N))))
-#define ROR(X, N) ROL(X, 64-N)
-#define SHR(X, N) ((X) >> (N))
-
-#define Ch(X, Y, Z) (((X) & (Y))^((~(X))&(Z)))
-#define Maj(X, Y, Z) (((X)&(Y))^((X)&(Z))^((Y)&(Z)))
-#define Parity(X, Y, Z) ((X)^(Y)^(Z))
-#define Sigma0(X) (ROR((X), 28)^ROR((X), 34)^ROR((X), 39))
-#define Sigma1(X) (ROR((X), 14)^ROR((X), 18)^ROR((X), 41))
-#define sigma0(X) (ROR((X),  1)^ROR((X),  8)^SHR((X), 7))
-#define sigma1(X) (ROR((X), 19)^ROR((X), 61)^SHR((X), 6))
-
-static void SHA_stage(uint64_t Ho[8], const uint64_t Hi[8], uint64_t W[16])
-{
-    uint64_t a = Hi[0];
-    uint64_t b = Hi[1];
-    uint64_t c = Hi[2];
-    uint64_t d = Hi[3];
-    uint64_t e = Hi[4];
-    uint64_t f = Hi[5];
-    uint64_t g = Hi[6];
-    uint64_t h = Hi[7];
-    unsigned t;
-    
-    for (t = 0; t != 16; ++t) {
-        const uint64_t T1 = h + Sigma1(e) + Ch(e, f, g) + K[t] + W[t];
-        const uint64_t T2 = Sigma0(a) + Maj(a, b, c);
-        
-        h = g; g = f; f = e; e = d + T1;
-        d = c; c = b; b = a; a = T1 + T2;
-    }
-    for ( ; t != 80; ++t) {
-        const uint64_t T1 = h + Sigma1(e) + Ch(e, f, g) + K[t] +
-            (W[t%16] = sigma1(W[(t-2)%16])+W[(t-7)%16]+sigma0(W[(t-15)%16])+W[(t-16)%16]);
-        const uint64_t T2 = Sigma0(a) + Maj(a, b, c);
-        
-        h = g; g = f; f = e; e = d + T1;
-        d = c; c = b; b = a; a = T1 + T2;
-    }
-    Ho[0] = Hi[0] + a;
-    Ho[1] = Hi[1] + b;
-    Ho[2] = Hi[2] + c;
-    Ho[3] = Hi[3] + d;
-    Ho[4] = Hi[4] + e;
-    Ho[5] = Hi[5] + f;
-    Ho[6] = Hi[6] + g;
-    Ho[7] = Hi[7] + h;
-}
-
-static __inline__ void SHA_64b_Init(struct SHA64bitState *ctx, int which)
-{
-    if (which == 0)
-        memcpy(ctx->H, H0_384, sizeof(H0_384));
-    else
-        memcpy(ctx->H, H0_512, sizeof(H0_512));
-    ctx->len = 0;
-    ctx->cur = 0;
-}
-
-static __inline__ void SHA_64b_Append(struct SHA64bitState *ctx, const uint8_t data[], size_t length)
-{
-    unsigned i;
-    unsigned j;
-    unsigned n;
-    
-    ctx->len += length;
-    for (i = 0; i != length; i += n) {
-        n = length - i > 128 ? 128 : (unsigned)(length - i);
-        if (ctx->cur + n > 128)
-            n = 128 - ctx->cur;
-        memcpy(&ctx->W[ctx->cur], &data[i], n);
-        ctx->cur += n;
-        if (ctx->cur == 128) {
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-            uint64_t W[16];
-            
-            for (j = 0; j != 16; ++j)
-                W[j] = bswap_64(((const uint64_t *)ctx->W)[j]);
-            SHA_stage(ctx->H, ctx->H, W);
-#else
-            SHA_stage(ctx->H, ctx->H, ctx->W);
-#endif
-            ctx->cur = 0;
-        }
-    }
-}
-
-
-static __inline__ void SHA_64b_Finish(const struct SHA64bitState *ctx, uint64_t rslt[8])
-{
-    unsigned j;
-    unsigned const n = (ctx->cur + 7) >> 3;
-    uint64_t W[32];
-    
-    memset(W, 0, sizeof(W));
-    for (j = 0; j != n; ++j) {
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-        W[j] = bswap_64(((const uint64_t *)ctx->W)[j]);
-#else
-        W[j] = ((const uint64_t *)ctx->W)[j];
-#endif
-    }
-    if (ctx->cur & 7) {
-        --j;
-        W[j] &= (~((uint64_t)0)) << ((8 - (ctx->cur & 7)) * 8);
-        W[j] |= ((uint64_t)0x80U) << ((7 - (ctx->cur & 7)) * 8);
-    }
-    else
-        W[j] = ((uint64_t)0x80U) << 56;
-    if (j < 14) {
-        W[14] = ctx->len >> 61;
-        W[15] = ctx->len <<  3;
-        SHA_stage(rslt, ctx->H, W);
-    }
-    else {
-        W[30] = ctx->len >> 61;
-        W[31] = ctx->len <<  3;
-        SHA_stage(rslt, ctx->H, W);
-        SHA_stage(rslt, rslt, W + 16);
-    }
-}
-
-void CC SHA384StateInit(SHA384State *ctx)
-{
-    SHA_64b_Init(ctx, 0);
-}
-
-void CC SHA384StateAppend(SHA384State *ctx, const void *data, size_t length)
-{
-    SHA_64b_Append(ctx, data, length);
-}
-
-void CC SHA384StateFinish(SHA384State *ctx, uint8_t hash[48])
-{
-    uint64_t H[8];
-
-    SHA_64b_Finish(ctx, H);
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-    {
-        H[0] = bswap_64(H[0]);
-        H[1] = bswap_64(H[1]);
-        H[2] = bswap_64(H[2]);
-        H[3] = bswap_64(H[3]);
-        H[4] = bswap_64(H[4]);
-        H[5] = bswap_64(H[5]);
-    }
-#endif
-    memcpy(hash, H, 48);
-}
-
-void CC SHA512StateInit(SHA512State *ctx)
-{
-    SHA_64b_Init(ctx, 1);
-}
-
-void CC SHA512StateAppend(SHA512State *ctx, const void *data, size_t length)
-{
-    SHA_64b_Append(ctx, data, length);
-}
-
-void CC SHA512StateFinish(SHA512State *ctx, uint8_t hash[64])
-{
-    uint64_t H[8];
-
-    SHA_64b_Finish(ctx, H);
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-    {
-        H[0] = bswap_64(H[0]);
-        H[1] = bswap_64(H[1]);
-        H[2] = bswap_64(H[2]);
-        H[3] = bswap_64(H[3]);
-        H[4] = bswap_64(H[4]);
-        H[5] = bswap_64(H[5]);
-        H[6] = bswap_64(H[6]);
-        H[7] = bswap_64(H[7]);
-    }
-#endif
-    memcpy(hash, H, 64);
-}
diff --git a/libs/klib/bsearch.c b/libs/klib/bsearch.c
deleted file mode 100644
index 69fd613..0000000
--- a/libs/klib/bsearch.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <klib/extern.h>
-#include <klib/sort.h>
-#include <sysalloc.h>
-
-/* Copyright (C) 1991,92,97,2000,02 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stdlib.h>
-
-
-/* Perform a binary search for KEY in BASE which has NMEMB elements
-   of SIZE bytes each.  The comparisons are done by (*COMPAR)().  */
-LIB_EXPORT void* CC kbsearch ( const void *key, const void *base, size_t nmemb, size_t size,
-    int ( CC * compar ) ( const void *, const void *, void *data ), void *data )
-{
-    size_t l, u, idx;
-    const void *p;
-    int comparison;
-
-    l = 0;
-    u = nmemb;
-    while (l < u)
-    {
-        idx = (l + u) / 2;
-        p = (void *) (((const char *) base) + (idx * size));
-        comparison = (*compar) (key, p, data);
-        if (comparison < 0)
-            u = idx;
-        else if (comparison > 0)
-            l = idx + 1;
-        else
-            return (void *) p;
-    }
-
-    return NULL;
-}
diff --git a/libs/klib/bstpersist.c b/libs/klib/bstpersist.c
deleted file mode 100644
index 58eeb52..0000000
--- a/libs/klib/bstpersist.c
+++ /dev/null
@@ -1,252 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include "trie-priv.h"
-#include "pbstree-priv.h"
-#include <klib/container.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * PBSTree
- * PBSTreeData
- */
-
-typedef struct PBSTreeData PBSTreeData;
-struct PBSTreeData
-{
-    PTWriteFunc write;
-    void *write_param;
-
-    PTAuxFunc aux;
-    void *aux_param;
-
-    P_BSTree *pt;
-    void ( CC * record ) ( P_BSTree*, unsigned int, size_t );
-
-    size_t num_writ;
-    size_t data_size;
-    uint32_t num_nodes;
-
-    rc_t rc;
-};
-
-static
-bool CC PBSTreeGatherInfo ( BSTNode *n, void *data )
-{
-    PBSTreeData *pb = data;
-
-    size_t node_size;
-    pb -> rc = ( * pb -> aux ) ( pb -> aux_param, n, & node_size, NULL, NULL );
-    if ( pb -> rc != 0 )
-        return true;
-
-    if ( pb -> pt != NULL )
-        ( * pb -> record ) ( pb -> pt, pb -> num_nodes, pb -> data_size );
-
-    pb -> data_size += node_size;
-    ++ pb -> num_nodes;
-
-    return false;
-}
-
-static
-void CC PBSTreeRecordU8 ( P_BSTree *pt, unsigned int idx, size_t offset )
-{
-    pt -> data_idx . v8 [ idx ] = ( uint8_t ) offset;
-}
-
-static
-void CC PBSTreeRecordU16 ( P_BSTree *pt, unsigned int idx, size_t offset )
-{
-    pt -> data_idx . v16 [ idx ] = ( uint16_t ) offset;
-}
-
-static
-void CC PBSTreeRecordU32 ( P_BSTree *pt, unsigned int idx, size_t offset )
-{
-    pt -> data_idx . v32 [ idx ] = ( uint32_t ) offset;
-}
-
-static
-bool CC PBSTreeWriteNodes ( BSTNode *n, void *data )
-{
-    PBSTreeData *pb = data;
-
-    size_t node_size;
-    pb -> rc = ( * pb -> aux ) ( pb -> aux_param,
-        n, & node_size, pb -> write, pb -> write_param );
-    if ( pb -> rc != 0 )
-        return true;
-
-    pb -> num_writ += node_size;
-    return false;
-}
-
-/*--------------------------------------------------------------------------
- * BSTree
- */
-
-/* BSTreePersist
- *  write a b-tree to some storage location
- *
- *  the b-tree is persisted by making between one and three passes
- *  over its nodes, see description of "write" parameter.
- *
- *  the first pass examines internal tree structure and invokes
- *  a user-supplied function to determine overall size.
- *
- *  the second pass persists the internal structure in a packed
- *  format, using the user-supplied generic "write" function.
- *
- *  the third pass invokes another user-supplied function to write
- *  auxiliary node data to output.
- *
- *  "num_writ" returns the number of bytes written as a result of
- *  persisting the b-tree. this will be the actual bytes written
- *  regardless of return status.
- *
- *  "write" is a generic output streaming function used for all
- *  operations. if NULL, then the function will exit after its
- *  first pass with the number of bytes required in "num_writ".
- *
- *  "aux" is a specialized function for streaming auxiliary node
- *  data to output using the supplied "write" function. it is invoked
- *  during the first pass with a NULL write function for gathering
- *  size data, and during the third pass with a non-NULL write function.
- */
-KLIB_EXTERN rc_t CC BSTreePersist ( const BSTree *bt, size_t *num_writ,
-    PTWriteFunc write, void *write_param, PTAuxFunc aux, void *aux_param )
-{
-    PBSTreeData pb;
-
-    if ( num_writ != NULL )
-        * num_writ = 0;
-
-    if ( bt == NULL )
-        return RC ( rcCont, rcTree, rcPersisting, rcSelf, rcNull );
-    if ( aux == NULL )
-        return RC ( rcCont, rcTree, rcPersisting, rcFunction, rcNull );
-
-    pb . num_writ = 0;
-
-    /* handle the trivial case */
-    if ( bt -> root == NULL )
-    {
-        P_BSTree pt;
-        if ( write == NULL )
-        {
-            pb . num_writ = sizeof pt . num_nodes;
-            pb . rc = 0;
-        }
-        else
-        {
-            pt . num_nodes = 0;
-            pb . rc = ( * write ) ( write_param,
-                & pt, sizeof pt . num_nodes, & pb . num_writ );
-        }
-    }
-    else
-    {
-        /* initialize callback param block */
-        pb . write = write;
-        pb . write_param = write_param;
-        pb . aux = aux;
-        pb . aux_param = aux_param;
-        pb . rc = 0;
-
-        /* count nodes and tally data size */
-        pb . pt = NULL;
-        pb . data_size = 0;
-        pb . num_nodes = 0;
-        BSTreeDoUntil ( bt, 0, PBSTreeGatherInfo, & pb );
-        if ( pb . rc == 0 )
-        {
-            size_t pt_size;
-
-            /* determine object size */
-            if ( pb . data_size <= 256 )
-            {
-                pt_size = 1;
-                pb . record = PBSTreeRecordU8;
-            }
-            else if ( pb . data_size <= 65536 )
-            {
-                pt_size = 2;
-                pb . record = PBSTreeRecordU16;
-            }
-            else
-            {
-                pt_size = 4;
-                pb . record = PBSTreeRecordU32;
-            }
-
-            pt_size = sizeof * pb . pt - sizeof pb . pt -> data_idx +
-                pb . num_nodes * pt_size;
-
-            if ( write == NULL )
-                pb . num_writ = pt_size + pb . data_size;
-
-            else
-            {
-                pb . pt = malloc ( pt_size );
-                if ( pb . pt != NULL )
-                {
-                    pb . pt -> num_nodes = pb . num_nodes;
-                    pb . pt -> data_size = ( uint32_t ) pb . data_size;
-                    
-                    /* record node offsets */
-                    pb . data_size = 0;
-                    pb . num_nodes = 0;
-                    BSTreeDoUntil ( bt, 0, PBSTreeGatherInfo, & pb );
-                    if ( pb . rc != 0 )
-                        free ( pb . pt );
-                    else
-                    {
-                        pb . rc = ( write ) ( write_param,
-                            pb . pt, pt_size, & pb . num_writ );
-                        free ( pb . pt );
-                        
-                        if ( pb . rc == 0 )
-                            BSTreeDoUntil ( bt, 0, PBSTreeWriteNodes, & pb );
-                    }
-                }
-            }
-        }
-    }
-
-    if ( num_writ != NULL )
-        * num_writ = pb . num_writ;
-
-    return pb . rc;
-}
diff --git a/libs/klib/container.c b/libs/klib/container.c
deleted file mode 100644
index 0840eaa..0000000
--- a/libs/klib/container.c
+++ /dev/null
@@ -1,1646 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include <klib/container.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * SLNode
- *  singly linked node
- */
-
-#if 0
-/* SLNodeFindNext
- *  find next element satisfying criteria
- */
-LIB_EXPORT SLNode* CC SLNodeFindNext ( const SLNode *p, bool ( CC * f ) ( const SLNode *n ) )
-{
-    if ( p != NULL )
-    {
-        SLNode *n = p -> next;
-        while ( n != NULL )
-        {
-            if ( ( * f ) ( n ) )
-                return n;
-            n = n -> next;
-        }
-    }
-    return NULL;
-}
-#endif
-
-
-/*--------------------------------------------------------------------------
- * SLList
- *  singly linked list
- */
-
-/* SLListPushTail
- *  push a single node onto tail of list
- */
-LIB_EXPORT void CC SLListPushTail ( SLList *sl, SLNode *n )
-{
-    if ( sl != NULL && n != NULL )
-    {
-        if ( sl -> tail == NULL )
-            sl -> head = sl -> tail = n;
-        else
-        {
-            sl -> tail -> next = n;
-            sl -> tail = n;
-        }
-        n -> next = NULL;
-    }
-}
-
-/* SLListPopHead
- *  pop a single node from head of list
- */
-LIB_EXPORT SLNode* CC SLListPopHead ( SLList *sl )
-{
-    if ( sl != NULL )
-    {
-        SLNode *n = sl -> head;
-        if ( n != NULL )
-        {
-            sl -> head = n -> next;
-            if ( n -> next == NULL )
-                sl -> tail = NULL;
-        }
-        return n;
-    }
-    return NULL;
-}
-
-/* SLListPopTail
- *  pop a single node from tail of list
- */
-LIB_EXPORT SLNode* CC SLListPopTail ( SLList *sl )
-{
-    if ( sl != NULL )
-    {
-        SLNode *n = sl -> head;
-        if ( n != NULL )
-        {
-            SLNode *tail = sl -> tail;
-            if ( n == tail )
-            {
-                sl -> head = sl -> tail = NULL;
-                return n;
-            }
-            while ( n -> next != tail )
-                n = n -> next;
-            sl -> tail = n;
-            n -> next = NULL;
-            return tail;
-        }
-    }
-    return NULL;
-}
-
-/* SLListUnlink
- *  removes a designated node from list
- */
-LIB_EXPORT void CC SLListUnlink ( SLList *sl, SLNode *n )
-{
-    if ( sl != NULL && n != NULL )
-    {
-        SLNode *p = sl -> head;
-        if ( p == n )
-        {
-            sl -> head = p -> next;
-            if ( p -> next == NULL )
-                sl -> tail = NULL;
-        }
-        else while ( p != NULL )
-        {
-            if ( p -> next == n )
-            {
-                p -> next = n -> next;
-                if ( n -> next == NULL )
-                    sl -> tail = p;
-                break;
-            }
-            p = p -> next;
-        }
-    }
-}
-
-/* SLListForEach
- *  executes a function on each list element
- */
-LIB_EXPORT void CC SLListForEach ( const SLList *sl,
-    void ( CC * f ) ( SLNode *n, void *data ), void *data )
-{
-    if ( sl != NULL )
-    {
-        SLNode *n = sl -> head;
-        while ( n != NULL )
-        {
-            SLNode *next = n -> next;
-            ( * f ) ( n, data );
-            n = next;
-        }
-    }
-}
-
-/* SLListDoUntil
- *  executes a function on each element
- *  until the function returns true
- */
-LIB_EXPORT bool CC SLListDoUntil ( const SLList *sl,
-    bool ( CC * f ) ( SLNode *n, void *data ), void *data )
-{
-    if ( sl )
-    {
-        SLNode *n = sl -> head;
-        while ( n != NULL )
-        {
-            SLNode *next = n -> next;
-            if ( ( * f ) ( n, data ) )
-                return true;
-            n = next;
-        }
-    }
-
-    return false;
-}
-
-/* SLListFindFirst
- *  find first element satisfying criteria
- */
-LIB_EXPORT SLNode* CC SLListFindFirst ( const SLList *sl,
-    bool ( CC * f ) ( const SLNode *n ) )
-{
-    if ( sl != NULL )
-    {
-        SLNode *n = sl -> head;
-        while ( n != NULL )
-        {
-            SLNode *next = n -> next;
-            if ( ( * f ) ( n ) )
-                return n;
-            n = next;
-        }
-    }
-    return NULL;
-}
-
-/* SLListWhack
- *  pops elements from list and
- *  executes a user provided destructor
- */
-LIB_EXPORT void CC SLListWhack ( SLList *sl, 
-    void ( CC * whack ) ( SLNode *n, void *data ), void *data )
-{
-    if ( sl != NULL )
-    {
-        SLNode *n = sl -> head;
-        sl -> head = sl -> tail = NULL;
-
-        if ( whack != NULL )
-        {
-            while ( n != NULL )
-            {
-                SLNode *next = n -> next;
-                ( * whack ) ( n, data );
-                n = next;
-            }
-        }
-    }
-}
-
-
-/*--------------------------------------------------------------------------
- * DLNode
- *  doubly linked node
- */
-
-#if 0
-/* DLNodeFindNext
- *  find next element satisfying criteria
- */
-LIB_EXPORT DLNode* CC DLNodeFindNext ( const DLNode *p, 
-    bool ( CC * f ) ( const DLNode *n ) )
-{
-    if ( p != NULL )
-    {
-        DLNode *n = p -> next;
-        while ( n != NULL )
-        {
-            if ( ( * f ) ( n ) )
-                return n;
-            n = n -> next;
-        }
-    }
-    return NULL;
-}
-
-/* DLNodeFindPrev
- *  find previous element satisfying criteria
- */
-LIB_EXPORT DLNode* CC DLNodeFindPrev ( const DLNode *p,
-    bool ( CC * f ) ( const DLNode *n ) )
-{
-    if ( p != NULL )
-    {
-        DLNode *n = p -> prev;
-        while ( n != NULL )
-        {
-            if ( ( * f ) ( n ) )
-                return n;
-            n = n -> prev;
-        }
-    }
-    return NULL;
-}
-#endif
-
-
-/*--------------------------------------------------------------------------
- * DLList
- *  doubly linked list
- */
-
-/* DLListPushHead
- *  push a single node onto the head of list
- */
-LIB_EXPORT void CC DLListPushHead ( DLList *dl, DLNode *n )
-{
-    if ( dl != NULL && n != NULL )
-    {
-        n -> prev = NULL;
-        n -> next = dl -> head;
-        if ( dl -> head == NULL )
-            dl -> head = dl -> tail = n;
-        else
-        {
-            dl -> head -> prev = n;
-            dl -> head = n;
-        }
-    }
-}
-
-/* DLListPushTail
- *  push a single node onto the tail of list
- */
-LIB_EXPORT void CC DLListPushTail ( DLList *dl, DLNode *n )
-{
-    if ( dl != NULL && n != NULL )
-    {
-        n -> next = NULL;
-        n -> prev = dl -> tail;
-        if ( dl -> tail == NULL )
-            dl -> tail = dl -> head = n;
-        else
-        {
-            dl -> tail -> next = n;
-            dl -> tail = n;
-        }
-    }
-}
-
-/* DLListPopHead
- *  pop a single node from head of list
- */
-LIB_EXPORT DLNode* CC DLListPopHead ( DLList *dl )
-{
-    if ( dl != NULL )
-    {
-        DLNode *n = dl -> head;
-        if ( dl -> head != NULL )
-        {
-            dl -> head = n -> next;
-            if ( n -> next == NULL )
-                dl -> tail = NULL;
-            else
-                n -> next -> prev = NULL;
-        }
-        return n;
-    }
-    return NULL;
-}
-
-/* DLListPopTail
- *  pop a single node from tail of list
- */
-LIB_EXPORT DLNode* CC DLListPopTail ( DLList *dl )
-{
-    if ( dl != NULL )
-    {
-        DLNode *n = dl -> tail;
-        if ( dl -> tail != NULL )
-        {
-            dl -> tail = n -> prev;
-            if ( n -> prev == NULL )
-                dl -> head = NULL;
-            else
-                n -> prev -> next = NULL;
-        }
-        return n;
-    }
-    return NULL;
-}
-
-/* DLListPrependList
- *  pushes list contents onto the head of target
- */
-LIB_EXPORT void CC DLListPrependList ( DLList *dl, DLList *l )
-{
-    if ( dl != NULL && l != NULL && l -> head != NULL )
-    {
-        if ( dl -> tail == NULL )
-            * dl = * l;
-        else
-        {
-            dl -> head -> prev = l -> tail;
-            l -> tail -> next = dl -> head;
-            dl -> head = l -> head;
-        }
-
-        l -> head = l -> tail = NULL;
-    }
-}
-
-/* DLListAppendList
- *  pushes list contents onto the tail of target
- */
-LIB_EXPORT void CC DLListAppendList ( DLList *dl, DLList *l )
-{
-    if ( dl != NULL && l != NULL && l -> head != NULL )
-    {
-        if ( dl -> tail == NULL )
-            * dl = * l;
-        else
-        {
-            dl -> tail -> next = l -> head;
-            l -> head -> prev = dl -> tail;
-            dl -> tail = l -> tail;
-        }
-
-        l -> head = l -> tail = NULL;
-    }
-}
-
-/* DLListInsertNodeBefore
- *  inserts node "n" before "which" within list
- */
-LIB_EXPORT void CC DLListInsertNodeBefore ( DLList *dl, DLNode *which, DLNode *n )
-{
-    if ( which != NULL && n != NULL )
-    {
-        /* take care of "n" */
-        n -> next = which;
-        n -> prev = which -> prev;
-
-        /* link "which"'s prev to "n" */
-        if ( which -> prev != NULL )
-            which -> prev -> next = n;
-
-        /* or if none, then perhaps head of list */
-        else if ( dl != NULL && dl -> head == which )
-            dl -> head = n;
-
-        /* link "which" to "n" */
-        which -> prev = n;
-    }
-}
-
-/* DLListInsertNodeAfter
- *  inserts node "n" after "which" within list
- */
-LIB_EXPORT void CC DLListInsertNodeAfter ( DLList *dl, DLNode *which, DLNode *n )
-{
-    if ( which != NULL && n != NULL )
-    {
-        /* take care of "n" */
-        n -> prev = which;
-        n -> next = which -> next;
-
-        /* link "which"'s next to "n" */
-        if ( which -> next != NULL )
-            which -> next -> prev = n;
-
-        /* or if none, then perhaps tail of list */
-        else if ( dl != NULL && dl -> tail == which )
-            dl -> tail = n;
-
-        /* link "which" to "n" */
-        which -> next = n;
-    }
-}
-
-/* DLListInsertListBefore
- *  inserts list "l" before "which" within list "dl"
- */
-LIB_EXPORT void CC DLListInsertListBefore ( DLList *dl, DLNode *which, DLList *l )
-{
-    if ( which != NULL && l != NULL && l -> head != NULL )
-    {
-        /* take care of inserting list */
-        l -> tail -> next = which;
-        l -> head -> prev = which -> prev;
-
-        /* link "which"'s prev to "l -> head" */
-        if ( which -> prev != NULL )
-            which -> prev -> next = l -> head;
-
-        /* or if none, then perhaps head of list */
-        else if ( dl != NULL && dl -> head == which )
-            dl -> head = l -> head;
-
-        /* link "which" to "l -> tail" */
-        which -> prev = l -> tail;
-
-        /* remove items from "l" */
-        l -> head = l -> tail = NULL;
-    }
-}
-
-/* DLListInsertListAfter
- *  inserts list "l" after "which" within list "dl"
- */
-LIB_EXPORT void CC DLListInsertListAfter ( DLList *dl, DLNode *which, DLList *l )
-{
-    if ( which != NULL && l != NULL && l -> head != NULL )
-    {
-        /* take care of inserting list */
-        l -> head -> prev = which;
-        l -> tail -> next = which -> next;
-
-        /* link "which"'s next to "l -> tail" */
-        if ( which -> next != NULL )
-            which -> next -> prev = l -> tail;
-
-        /* or if none, then perhaps tail of list */
-        else if ( dl != NULL && dl -> tail == which )
-            dl -> head = l -> tail;
-
-        /* link "which" to "l -> head" */
-        which -> next = l -> head;
-
-        /* remove items from "l" */
-        l -> head = l -> tail = NULL;
-    }
-}
-
-/* DLListUnlink
- *  removes a designated node from list
- */
-LIB_EXPORT void CC DLListUnlink ( DLList *dl, DLNode *n )
-{
-    if ( n != NULL )
-    {
-        if ( n -> next == NULL )
-        {
-            if ( dl != NULL && dl -> tail == n )
-            {
-                if ( n -> prev == NULL )
-                    dl -> head = dl -> tail = NULL;
-                else
-                {
-                    n -> prev -> next = NULL;
-                    dl -> tail = n -> prev;
-                }
-            }
-            else
-            {
-                if ( n -> prev != NULL )
-                    n -> prev -> next = NULL;
-            }
-        }
-        else if ( n -> prev == NULL )
-        {
-            n -> next -> prev = NULL;
-            if ( dl != NULL && dl -> head == n )
-                dl -> head = n -> next;
-        }
-        else
-        {
-            n -> next -> prev = n -> prev;
-            n -> prev -> next = n -> next;
-        }
-    }
-}
-
-/* DLListForEach
- *  executes a function on each list element
- */
-LIB_EXPORT void CC DLListForEach ( const DLList *dl, bool reverse,
-    void ( CC * f ) ( DLNode *n, void *data ), void *data )
-{
-    if ( dl != NULL )
-    {
-        DLNode *n, *next;
-        if ( reverse )
-        {
-            n = dl -> tail;
-            while ( n != NULL )
-            {
-                next = n -> prev;
-                ( * f ) ( n, data );
-                n = next;
-            }
-        }
-        else
-        {
-            n = dl -> head;
-            while ( n != NULL )
-            {
-                next = n -> next;
-                ( * f ) ( n, data );
-                n = next;
-            }
-        }
-    }
-}
-
-/* DLListDoUntil
- *  executes a function on each element
- *  until the function returns 1
- */
-LIB_EXPORT bool CC DLListDoUntil ( const DLList *dl, bool reverse,
-    bool ( CC * f ) ( DLNode *n, void *data ), void *data )
-{
-    if ( dl != NULL )
-    {
-        DLNode *n, *next;
-        if ( reverse )
-        {
-            n = dl -> tail;
-            while ( n != NULL )
-            {
-                next = n -> prev;
-                if ( ( * f ) ( n, data ) )
-                    return true;
-                n = next;
-            }
-        }
-        else
-        {
-            n = dl -> head;
-            while ( n != NULL )
-            {
-                next = n -> next;
-                if ( ( * f ) ( n, data ) )
-                    return true;
-                n = next;
-            }
-        }
-    }
-    return false;
-}
-
-/* DLListFindFirst
- *  find first element satisfying criteria
- */
-LIB_EXPORT DLNode* CC DLListFindFirst ( const DLList *dl,
-    bool ( CC * f ) ( const DLNode *n ) )
-{
-    if ( dl != NULL )
-    {
-        DLNode *n = dl -> head;
-        while ( n != NULL )
-        {
-            if ( ( * f ) ( n ) )
-                return n;
-            n = n -> next;
-        }
-    }
-    return NULL;
-}
-
-/* DLListFindLast
- *  find last element satisfying criteria
- */
-LIB_EXPORT DLNode* CC DLListFindLast ( const DLList *dl,
-    bool ( CC * f ) ( const DLNode *n ) )
-{
-    if ( dl != NULL )
-    {
-        DLNode *n = dl -> tail;
-        while ( n != NULL )
-        {
-            if ( ( * f ) ( n ) )
-                return n;
-            n = n -> prev;
-        }
-    }
-    return NULL;
-}
-
-/* DLListWhack
- *  pops elements from list and
- *  executes a user provided destructor
- */
-LIB_EXPORT void CC DLListWhack ( DLList *dl,
-    void ( CC * whack ) ( DLNode *n, void *data ), void *data )
-{
-    if ( dl != NULL )
-    {
-        DLNode *n = dl -> head;
-        dl -> head = dl -> tail = NULL;
-
-        if ( whack != NULL )
-        {
-            while ( n != NULL )
-            {
-                DLNode *next = n -> next;
-                ( * whack ) ( n, data );
-                n = next;
-            }
-        }
-    }
-}
-
-
-/*--------------------------------------------------------------------------
- * BSTNode
- *  b-tree node
- */
-
-#define LEFT 1
-#define RIGHT 2
-
-#define BALANCE( node ) \
-    ( ( size_t ) ( node ) -> par & 3 )
-#define ZERO_BALANCE( node ) \
-    ( * ( size_t* ) & ( node ) -> par &= ~ ( size_t ) 3 )
-#define CLR_BALANCE( node, bal ) \
-    ( * ( size_t* ) & ( node ) -> par ^= ( bal ) )
-#define SET_BALANCE( node, bal ) \
-    ( * ( size_t* ) & ( node ) -> par |= ( bal ) )
-#define LEFT_HEAVY( node ) \
-    ( ( ( size_t ) ( node ) -> par & LEFT ) != 0 )
-#define RIGHT_HEAVY( node ) \
-    ( ( ( size_t ) ( node ) -> par & RIGHT ) != 0 )
-
-#define PMASK 3
-#define BBITS( node, bal ) ( bal )
-
-#define PBITS( node ) \
-    ( ( size_t ) ( node ) -> par & PMASK )
-#define PARENT( node ) \
-    ( BSTNode* ) ( ( size_t ) ( node ) -> par & ~ ( size_t ) PMASK )
-#define SET_PARENT( node, p ) \
-    ( ( node ) -> par = ( BSTNode* ) ( ( size_t ) ( p ) | PBITS ( node ) ) )
-#define SET_PARBAL( node, p, bal ) \
-    ( ( node ) -> par = ( BSTNode* ) ( ( size_t ) ( p ) | BBITS ( node, bal ) ) )
-
-
-/* LeftMost
- *  returns the left-most child
- */
-static
-BSTNode* CC LeftMost ( BSTNode *q )
-{
-    if ( q != NULL )
-    {
-        BSTNode *p = q -> child [ 0 ];
-        while ( p != NULL )
-        {
-            q = p;
-            p = p -> child [ 0 ];
-        }
-    }
-    return q;
-}
-
-/* RightMost
- *  returns the right-most child
- */
-static
-BSTNode* CC RightMost ( BSTNode *q )
-{
-    if ( q != NULL )
-    {
-        BSTNode *p = q -> child [ 1 ];
-        while ( p != NULL )
-        {
-            q = p;
-            p = p -> child [ 1 ];
-        }
-    }
-    return q;
-}
-
-/* FirstNode
- *  the left-most node in tree
- */
-#define FirstNode( bt ) \
-    LeftMost ( ( bt ) -> root )
-
-/* LastNode
- *  the right-most node in tree
- */
-#define LastNode( bt ) \
-    RightMost ( ( bt ) -> root )
-
-/* BSTNodeNext
- *  returns next node
- */
-LIB_EXPORT BSTNode* CC BSTNodeNext ( const BSTNode *n )
-{
-    BSTNode *p;
-
-    if ( n == NULL )
-        return NULL;
-
-    p = n -> child [ 1 ];
-    if ( p == 0 )
-    {
-        BSTNode *q = ( BSTNode* ) n;
-        while ( 1 )
-        {
-            p = PARENT ( q );
-            if ( p == NULL )
-                return NULL;
-            if ( p -> child [ 0 ] == q )
-                return p;
-            q = p;
-        }
-    }
-    return LeftMost ( p );
-}
-
-/* BSTNodePrev
- *  returns prev node
- */
-LIB_EXPORT BSTNode* CC BSTNodePrev ( const BSTNode *n )
-{
-    BSTNode *p = n -> child [ 0 ];
-    if ( p == 0 )
-    {
-        BSTNode *q = ( BSTNode* ) n;
-        while ( 1 )
-        {
-            p = PARENT ( q );
-            if ( p == NULL )
-                return NULL;
-            if ( p -> child [ 1 ] == q )
-                return p;
-            q = p;
-        }
-    }
-    return RightMost ( p );
-}
-
-/* BSTNodeParent
- *  returns a parent node if there, NULL otherwise
- */
-LIB_EXPORT BSTNode* CC BSTNodeParent ( const BSTNode *n )
-{
-    if ( n != NULL )
-        return PARENT ( n );
-    return NULL;
-}
-
-/* BSTNodeFindNext
- *  find next element satisfying criteria
- */
-LIB_EXPORT BSTNode* CC BSTNodeFindNext ( const BSTNode *p,
-    bool ( CC * f ) ( const BSTNode *n ) )
-{
-    if ( p != NULL )
-    {
-        BSTNode *n = BSTNodeNext ( p );
-        while ( n != NULL )
-        {
-            if ( ( * f ) ( n ) )
-                return n;
-            n = BSTNodeNext ( n );
-        }
-    }
-    return NULL;
-}
-
-/* BSTNodeFindPrev
- *  find previous element satisfying criteria
- */
-LIB_EXPORT BSTNode* CC BSTNodeFindPrev ( const BSTNode *p,
-    bool ( CC * f ) ( const BSTNode *n ) )
-{
-    if ( p != NULL )
-    {
-        BSTNode *n = BSTNodePrev ( p );
-        while ( n != NULL )
-        {
-            if ( ( * f ) ( n ) )
-                return n;
-            n = BSTNodePrev ( n );
-        }
-    }
-    return NULL;
-}
-
-
-/*--------------------------------------------------------------------------
- * BSTree
- *  b-tree
- */
-
-/* BSTreeDepth
- *  returns number of layers in b-tree
- *
- *  if "exact" is 1, then the maximum
- *  depth is returned. otherwise, the depth of
- *  an arbitrary leaf node is returned
- */
-LIB_EXPORT uint32_t CC BSTreeDepth ( const BSTree *bt, bool exact )
-{
-    BSTNode *p;
-    uint32_t depth;
-
-    if ( bt == NULL || bt -> root == NULL )
-        return 0;
-
-    depth = 1;
-
-    if ( exact )
-    {
-        for ( p = FirstNode ( bt ); p != NULL; p = BSTNodeNext ( p ) )
-        {
-            BSTNode *q;
-            unsigned int ndepth;
-
-            if ( p -> child [ 0 ] != NULL || p -> child [ 1 ] != NULL )
-                continue;
-
-            for ( ndepth = 1, q = PARENT ( p ); q != NULL; q = PARENT ( q ) )
-                ++ ndepth;
-
-            if ( ndepth > depth )
-                depth = ndepth;
-        }
-    }
-    else
-    {
-        for ( p = bt -> root;; ++ depth )
-        {
-            if ( p -> child [ 0 ] != NULL )
-                p = p -> child [ 0 ];
-            else if ( p -> child [ 1 ] != NULL )
-                p = p -> child [ 1 ];
-            else
-                break;
-        }
-    }
-
-    return depth;
-}
-
-/* BSTreeFirst
- *  returns first node
- */
-LIB_EXPORT BSTNode* CC BSTreeFirst ( const BSTree *bt )
-{
-    if ( bt == NULL )
-        return NULL;
-    return FirstNode ( bt );
-}
-
-/* BSTreeLast
- *  returns last node
- */
-LIB_EXPORT BSTNode* CC BSTreeLast ( const BSTree *bt )
-{
-    if ( bt == NULL )
-        return NULL;
-    return LastNode ( bt );
-}
-
-/* BSTreeFind
- *  find an object within tree
- *  "cmp" function returns equivalent of "item" - "n"
- */
-LIB_EXPORT BSTNode* CC BSTreeFind ( const BSTree *bt, const void *item,
-    int ( CC * cmp ) ( const void *item, const BSTNode *n ) )
-{
-    if ( bt != NULL )
-    {
-        BSTNode *n = bt -> root;
-        while ( n != NULL )
-        {
-            int diff = ( * cmp ) ( item, n );
-            if ( diff == 0 )
-                return n;
-            n = n -> child [ diff > 0 ];
-        }
-    }
-    return NULL;
-}
-
-/* BSTreeInsert
- *  insert an object within tree, even if duplicate
- *  "sort" function returns equivalent of "item" - "n"
- *
- *  the treatment of order for items reported as identical
- *  i.e. sort function returns zero when they are compared,
- *  is undefined.
- *
- *  the current implementation treats '<=' as '<' such
- *  that all inserts are converted to a '<' or '>' comparison,
- *  but this should not be relied upon.
- */
-static
-BSTNode* CC RotateRightAtY ( BSTNode *y, BSTNode *x )
-{
-    BSTNode *w = x;
-    BSTNode *z = x -> child [ 1 ];
-    y -> child [ 0 ] = z;
-    x -> child [ 1 ] = y;
-    x -> par = PARENT ( y );
-    y -> par = x;
-
-    /* patch parent link */
-    if ( z != 0 )
-        SET_PARENT ( z, y );
-
-    return w;
-}
-
-static
-BSTNode* CC RotateLeftAtY ( BSTNode *y, BSTNode *x )
-{
-    BSTNode *w = x;
-    BSTNode *z = x -> child [ 0 ];
-    y -> child [ 1 ] = z;
-    x -> child [ 0 ] = y;
-    x -> par = PARENT ( y );
-    y -> par = x;
-
-    /* patch parent link */
-    if ( z != 0 )
-        SET_PARENT ( z, y );
-
-    return w;
-}
-
-static
-BSTNode* CC RotateLeftAtXRightAtY ( BSTNode *y, BSTNode *x )
-{
-    BSTNode *w = x -> child [ 1 ];
-    BSTNode *z = w -> child [ 0 ];
-    x -> child [ 1 ] = z;
-    if ( z != 0 )
-        SET_PARENT ( z, x );
-    z = w -> child [ 1 ];
-    w -> child [ 0 ] = x;
-    y -> child [ 0 ] = z;
-    w -> child [ 1 ] = y;
-        
-    switch ( BALANCE ( w ) )
-    {
-    case 0:
-        w -> par = PARENT ( y );
-        x -> par = w;
-        y -> par = w;
-        break;
-    case LEFT:
-        w -> par = PARENT ( y );
-        x -> par = w;
-        SET_PARBAL ( y, w, RIGHT );
-        break;
-    case RIGHT:
-        w -> par = PARENT ( y );
-        SET_PARBAL ( x, w, LEFT );
-        y -> par = w;
-        break;
-    }
-
-    /* patch parent link */
-    if ( z != 0 )
-        SET_PARENT ( z, y );
-
-    return w;
-}
-
-static
-BSTNode* CC RotateRightAtXLeftAtY ( BSTNode *y, BSTNode *x )
-{
-    BSTNode *w = x -> child [ 0 ];
-    BSTNode *z = w -> child [ 1 ];
-    x -> child [ 0 ] = z;
-    if ( z != 0 )
-        SET_PARENT ( z, x );
-    z = w -> child [ 0 ];
-    w -> child [ 1 ] = x;
-    y -> child [ 1 ] = z;
-    w -> child [ 0 ] = y;
-        
-    switch ( BALANCE ( w ) )
-    {
-    case 0:
-        w -> par = PARENT ( y );
-        x -> par = w;
-        y -> par = w;
-        break;
-    case LEFT:
-        w -> par = PARENT ( y );
-        SET_PARBAL ( x, w, RIGHT );
-        y -> par = w;
-        break;
-    case RIGHT:
-        w -> par = PARENT ( y );
-        x -> par = w;
-        SET_PARBAL ( y, w, LEFT );
-        break;
-    }
-
-    /* patch parent link */
-    if ( z != 0 )
-        SET_PARENT ( z, y );
-
-    return w;
-}
-
-static
-BSTNode* CC RebalanceLeft ( BSTNode *y, BSTNode *x )
-{
-    /* detect child balance */
-    if ( LEFT_HEAVY ( x ) )
-        return RotateRightAtY ( y, x );
-
-    /* child is right heavy */
-    return RotateLeftAtXRightAtY ( y, x );
-}
-
-static
-BSTNode* CC RebalanceRight ( BSTNode *y, BSTNode *x )
-{
-    /* detect child balance */
-    if ( RIGHT_HEAVY ( x ) )
-        return RotateLeftAtY ( y, x );
-
-    /* left heavy */
-    return RotateRightAtXLeftAtY ( y, x );
-}
-
-
-static
-void CC RebalanceAfterInsert ( BSTNode **root, BSTNode *y, BSTNode *x )
-{
-    BSTNode *w, *z;
-
-    /* detect left insertion */
-    if ( y -> child [ 0 ] == x )
-    {
-        /* if y was right-heavy, done */
-        if ( RIGHT_HEAVY ( y ) )
-        {
-            CLR_BALANCE ( y, RIGHT );
-            return;
-        }
-
-        /* rebalance left insertion */
-        w = RebalanceLeft ( y, x );
-    }
-
-    /* right insertion */
-    else
-    {
-        /* if y was left-heavy, done */
-        if ( LEFT_HEAVY ( y ) )
-        {
-            CLR_BALANCE ( y, LEFT );
-            return;
-        }
-
-        /* rebalance right insertion */
-        w = RebalanceRight ( y, x );
-    }
-
-    /* fix parent to child */
-    assert ( BALANCE ( w ) == 0 );
-    z = w -> par;
-    if ( z == 0 )
-        * root = w;
-    else
-        z -> child [ z -> child [ 1 ] == y ] = w;
-}
-
-LIB_EXPORT rc_t CC BSTreeInsert ( BSTree *bt, BSTNode *n,
-    int ( CC * sort ) ( const BSTNode *n, const BSTNode *p ) )
-{
-    if ( bt != NULL && n != NULL )
-    {
-        int diff;
-
-        BSTNode *p = bt -> root;
-        BSTNode *q = NULL;
-        BSTNode *y = NULL;
-
-        while ( p != NULL )
-        {
-            diff = ( * sort ) ( n, p );
-            q = p;
-            if ( BALANCE ( p ) != 0 )
-                y = p;
-            p = p -> child [ diff > 0 ];
-        }
-
-        n -> par = q;
-        n -> child [ 0 ] = n -> child [ 1 ] = NULL;
-
-        if ( q == NULL )
-            bt -> root = n;
-        else
-        {
-            q -> child [ diff > 0 ] = n;
-
-            /* run a trace-back */
-            for ( p = n; q != y; )
-            {
-                /* this is safe because q has 0 balance */
-                BSTNode *z = q -> par;
-                if ( q -> child [ 0 ] == p )
-                    SET_BALANCE ( q, LEFT );
-                else
-                    SET_BALANCE ( q, RIGHT );
-
-                p = q;
-                q = z;
-            }
-
-            /* rebalance */
-            if ( q != NULL )
-                RebalanceAfterInsert ( & bt -> root, q, p );
-        }
-    }
-
-    /* never fails in this implementation */
-    return 0;
-}
-
-/* BSTreeInsertUnique
- *  insert an object within tree, but only if unique
- *  "sort" function returns equivalent of "item" - "n"
- *  returns non-NULL "n" upon match or NULL on success
- */
-LIB_EXPORT rc_t CC BSTreeInsertUnique ( BSTree *bt, BSTNode *n, BSTNode **exist,
-    int ( CC * sort ) ( const BSTNode *n, const BSTNode *p ) )
-{
-    if ( bt != NULL && n != NULL )
-    {
-        int diff;
-
-        BSTNode *p = bt -> root;
-        BSTNode *q = NULL;
-        BSTNode *y = NULL;
-
-        while ( p != NULL )
-        {
-            diff = ( * sort ) ( n, p );
-
-            if ( diff == 0 )
-            {
-                /* fail to insert */
-                if ( exist != NULL )
-                    * exist = p;
-                return RC ( rcCont, rcTree, rcInserting, rcNode, rcExists );
-            }
-
-            q = p;
-            if ( BALANCE ( p ) != 0 )
-                y = p;
-            p = p -> child [ diff > 0 ];
-        }
-
-        n -> par = q;
-        n -> child [ 0 ] = n -> child [ 1 ] = NULL;
-
-        if ( q == NULL )
-            bt -> root = n;
-        else
-        {
-            q -> child [ diff > 0 ] = n;
-
-            /* run a trace-back */
-            for ( p = n; q != y; )
-            {
-                /* this is safe because q has 0 balance */
-                BSTNode *z = q -> par;
-                if ( q -> child [ 0 ] == p )
-                    SET_BALANCE ( q, LEFT );
-                else
-                    SET_BALANCE ( q, RIGHT );
-
-                p = q;
-                q = z;
-            }
-
-            /* rebalance */
-            if ( q != NULL )
-                RebalanceAfterInsert ( & bt -> root, q, p );
-        }
-    }
-
-    /* only fails on existing item in this implementation */
-    return 0;
-}
-
-/* BSTreeResort
- *  an optimized removal and re-insertion of
- *  all contained elements using another function
- *
- *  the treatment of order for items reported as identical
- *  i.e. sort function returns zero when they are compared,
- *  is undefined.
- *
- *  the current implementation treats '<=' as '<' such
- *  that all inserts are converted to a '<' or '>' comparison,
- *  but this should not be relied upon.
- */
-LIB_EXPORT void CC BSTreeResort ( BSTree *bt,
-    int ( CC * resort ) ( const BSTNode *item, const BSTNode *n ) )
-{
-    if ( bt != NULL )
-    {
-        BSTNode *p = bt -> root;
-        bt -> root = NULL;
-
-        while ( p != NULL )
-        {
-            BSTNode *q = p -> child [ 0 ];
-            if ( q == 0 )
-            {
-                q = p -> child [ 1 ];
-                BSTreeInsert ( bt, p, resort );
-            }
-            else
-            {
-                p -> child [ 0 ] = q -> child [ 1 ];
-                q -> child [ 1 ] = p;
-            }
-            p = q;
-        }
-    }
-}
-
-/* BSTreeUnlink
- *  removes a node from tree
- */
-static
-void CC RebalanceAfterUnlink ( BSTNode **root, BSTNode *q, int dir )
-{
-    while ( q != 0 )
-    {
-        BSTNode *w, *x, *y = q;
-        q = PARENT ( q );
-
-        if ( ! dir )
-        {
-            if ( q && q -> child [ 1 ] == y )
-                dir = 1;
-
-            /* simulate an increment of balance */
-            switch ( BALANCE ( y ) )
-            {
-            case 0:
-                SET_BALANCE ( y, RIGHT );
-                return;
-            case LEFT:
-                CLR_BALANCE ( y, LEFT );
-                break;
-            case RIGHT:
-                /* y has just become ++ */
-                x = y -> child [ 1 ];
-                if ( LEFT_HEAVY ( x ) )
-                {
-                    w = RotateRightAtXLeftAtY ( y, x );
-                    if ( q == 0 )
-                        * root = w;
-                    else
-                        q -> child [ dir ] = w;
-                }
-                else
-                {
-                    w = y -> child [ 1 ] = x -> child [ 0 ];
-                    x -> child [ 0 ] = y;
-                    SET_PARENT ( x, q );
-                    SET_PARENT ( y, x );
-                    if ( w != 0 )
-                        SET_PARENT ( w, y );
-                    if ( q == 0 )
-                        * root = x;
-                    else
-                        q -> child [ dir ] = x;
-                    if ( BALANCE ( x ) == 0 )
-                    {
-                        SET_BALANCE ( x, LEFT );
-                        SET_PARBAL ( y, x, RIGHT );
-                        return;
-                    }
-                    ZERO_BALANCE ( x );
-                    ZERO_BALANCE ( y );
-                    /* y = x; */
-                }
-                break;
-            }
-        }
-
-        /* symmetric case */
-        else
-        {
-            if ( q && q -> child [ 0 ] == y )
-                dir = 0;
-
-            switch ( BALANCE ( y ) )
-            {
-            case 0:
-                SET_BALANCE ( y, LEFT );
-                return;
-            case LEFT:
-                /* y has just become -- */
-                x = y -> child [ 0 ];
-                if ( RIGHT_HEAVY ( x ) )
-                {
-                    w = RotateLeftAtXRightAtY ( y, x );
-                    if ( q == 0 )
-                        * root = w;
-                    else
-                        q -> child [ dir ] = w;
-                }
-                else
-                {
-                    w = x -> child [ 1 ];
-                    y -> child [ 0 ] = w;
-                    x -> child [ 1 ] = y;
-                    SET_PARENT ( x, q );
-                    SET_PARENT ( y, x );
-                    if ( w != 0 )
-                        SET_PARENT ( w, y );
-                    if ( q == 0 )
-                        * root = x;
-                    else
-                        q -> child [ dir ] = x;
-                    if ( BALANCE ( x ) == 0 )
-                    {
-                        SET_BALANCE ( x, RIGHT );
-                        SET_PARBAL ( y, x, LEFT );
-                        return;
-                    }
-                    ZERO_BALANCE ( x );
-                    ZERO_BALANCE ( y );
-                    /* y = x; */
-                }
-                break;
-            case RIGHT:
-                CLR_BALANCE ( y, RIGHT );
-                break;
-            }
-        }
-    }
-}
-
-static
-void CC BTUnlink ( BSTNode **root, BSTNode *p, int dir )
-{
-    BSTNode *q = PARENT ( p );
-    BSTNode *l, *r = p -> child [ 1 ];
-    if ( r == 0 )
-    {
-      /* no right child - simple unlink */
-        l = p -> child [ 0 ];
-        if ( q == 0 )
-            * root = l;
-        else
-            q -> child [ dir ] = l;
-        if ( l != 0 )
-            SET_PARENT ( l, q );
-    }
-    else
-    {
-      /* have a right child - check its left */
-        l = r -> child [ 0 ];
-        if ( l == 0 )
-        {
-            l = p -> child [ 0 ];
-            r -> child [ 0 ] = l;
-
-            /* take not only p's parent ( q )
-            // but its balance as well */
-            r -> par = p -> par;
-
-            if ( q == 0 )
-                * root = r;
-            else
-                q -> child [ dir ] = r;
-
-            if ( l != 0 )
-                SET_PARENT ( l, r );
-
-            /* artificially reset for following */
-            q = r;
-            dir = 1;
-        }
-
-        /* involves some work */
-        else
-        {
-	  /* find smallest subsequent item */
-            r = l -> child [ 0 ];
-            while ( r != 0 )
-            {
-                l = r;
-                r = l -> child [ 0 ];
-            }
-
-            /* unlink it */
-            r = PARENT ( l );
-            r -> child [ 0 ] = l -> child [ 1 ];
-
-            /* take over doomed node */
-            l -> child [ 0 ] = p -> child [ 0 ];
-            l -> child [ 1 ] = p -> child [ 1 ];
-
-            /* take not only p's parent ( q )
-            // but its balance as well */
-            l -> par = p -> par;
-
-            /* new king pin */
-            if ( q == 0 )
-                * root = l;
-            else
-                q -> child [ dir ] = l;
-
-            /* update parent links */
-            q = l -> child [ 0 ];
-            if ( q != 0 )
-                SET_PARENT ( q, l );
-            q = l -> child [ 1 ];
-            SET_PARENT ( q, l );
-            q = r -> child [ 0 ];
-            if ( q != 0 )
-                SET_PARENT ( q, r );
-
-            q = r;
-            dir = 0;
-        }
-    }
-
-    /* now - rebalance what we've undone */
-    if ( q != 0 )
-        RebalanceAfterUnlink ( root, q, dir );
-}
-
-static
-bool CC BSTreeContains ( const BSTNode *root, const BSTNode *n )
-{
-    while ( n != NULL )
-    {
-        if ( n == root )
-            return true;
-        n = PARENT ( n );
-    }
-    return false;
-}
-
-LIB_EXPORT bool CC BSTreeUnlink ( BSTree *bt, BSTNode *n )
-{
-    if ( bt != NULL && BSTreeContains ( bt -> root, n ) )
-    {
-        int dir = 0;
-        BSTNode *q = PARENT ( n );
-        if ( q != 0 )
-        {
-            assert ( q -> child [ 0 ] == n || q -> child [ 1 ] == n );
-            dir = q -> child [ 1 ] == n;
-        }
-        BTUnlink ( & bt -> root, n, ( int ) dir );
-        return true;
-    }
-    return false;
-}
-
-/* BSTreeForEach
- *  executes a function on each tree element
- */
-LIB_EXPORT void CC BSTreeForEach ( const BSTree *bt, bool reverse,
-    void ( CC * f ) ( BSTNode *n, void *data ), void *data )
-{
-    if ( bt != NULL )
-    {
-        BSTNode *n, *next;
-        if ( reverse )
-        {
-            n = LastNode ( bt );
-            while ( n != NULL )
-            {
-                next = BSTNodePrev ( n );
-                ( * f ) ( n, data );
-                n = next;
-            }
-        }
-        else
-        {
-            n = FirstNode ( bt );
-            while ( n != NULL )
-            {
-                next = BSTNodeNext ( n );
-                ( * f ) ( n, data );
-                n = next;
-            }
-        }
-    }
-}
-
-/* BSTreeDoUntil
- *  executes a function on each element
- *  until the function returns 1
- */
-LIB_EXPORT bool CC BSTreeDoUntil ( const BSTree *bt, bool reverse,
-    bool ( CC * f ) ( BSTNode *n, void *data ), void *data )
-{
-    if ( bt != NULL )
-    {
-        BSTNode *n, *next;
-        if ( reverse )
-        {
-            n = LastNode ( bt );
-            while ( n != NULL )
-            {
-                next = BSTNodePrev ( n );
-                if ( ( * f ) ( n, data ) )
-                    return true;
-                n = next;
-            }
-        }
-        else
-        {
-            n = FirstNode ( bt );
-            while ( n != NULL )
-            {
-                next = BSTNodeNext ( n );
-                if ( ( * f ) ( n, data ) )
-                    return true;
-                n = next;
-            }
-        }
-    }
-    return false;
-}
-
-/* BSTreeWhack
- *  removes nodes from tree and
- *  executes a user provided destructor
- */
-LIB_EXPORT void CC BSTreeWhack ( BSTree *bt,
-    void ( CC * whack ) ( BSTNode *n, void *data ), void *data )
-{
-    if ( bt != NULL )
-    {
-        BSTNode *p = bt -> root;
-        bt -> root = NULL;
-
-        if ( whack != NULL )
-        {
-            while ( p != NULL )
-            {
-                BSTNode *q = p -> child [ 0 ];
-                if ( q == 0 )
-                {
-                    q = p -> child [ 1 ];
-                    ( * whack ) ( p, data );
-                }
-                else
-                {
-                    p -> child [ 0 ] = q -> child [ 1 ];
-                    q -> child [ 1 ] = p;
-                }
-                p = q;
-            }
-        }
-    }
-}
diff --git a/libs/klib/cp1252.c b/libs/klib/cp1252.c
deleted file mode 100644
index 21734d9..0000000
--- a/libs/klib/cp1252.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include <sysalloc.h>
-#include <stdint.h>
-
-LIB_EXPORT const uint32_t cp1252 [ 128 ] =
-{
-    /*0x80   0x81   0x82   0x83   0x84   0x85   0x86   0x87*/
-    0x20AC,0x0000,0x201A,0x0192,0x201E,0x201E,0x201E,0x201E,
-    /*0x88   0x89   0x8A   0x8B   0x8C   0x8D   0x8E   0x8F*/
-    0x201E,0x201E,0x201E,0x201E,0x201E,0x0000,0x201E,0x0000,
-    /*0x90   0x91   0x92   0x93   0x94   0x95   0x96   0x97*/
-    0x0000,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014,
-    /*0x98   0x99   0x9A   0x9B   0x9C   0x9D   0x9E   0x9F*/
-    0x02DC,0x2122,0x0161,0x203A,0x0153,0x0000,0x017E,0x0178,
-    /*0xA0   0xA1   0xA2   0xA3   0xA4   0xA5   0xA6   0xA7*/
-    0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,
-    /*0xA8   0xA9   0xAA   0xAB   0xAC   0xAD   0xAE   0xAF*/
-    0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,
-    /*0xB0   0xB1   0xB2   0xB3   0xB4   0xB5   0xB6   0xB7*/
-    0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,
-    /*0xB8   0xB9   0xBA   0xBB   0xBC   0xBD   0xBE   0xBF*/
-    0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF,
-    /*0xC0   0xC1   0xC2   0xC3   0xC4   0xC5   0xC6   0xC7*/
-    0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,
-    /*0xC8   0xC9   0xCA   0xCB   0xCC   0xCD   0xCE   0xCF*/
-    0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,
-    /*0xD0   0xD1   0xD2   0xD3   0xD4   0xD5   0xD6   0xD7*/
-    0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,
-    /*0xD8   0xD9   0xDA   0xDB   0xDC   0xDD   0xDE   0xDF*/
-    0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF,
-    /*0xE0   0xE1   0xE2   0xE3   0xE4   0xE5   0xE6   0xE7*/
-    0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7,
-    /*0xE8   0xE9   0xEA   0xEB   0xEC   0xED   0xEE   0xEF*/
-    0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,
-    /*0xF0   0xF1   0xF2   0xF3   0xF4   0xF5   0xF6   0xF7*/
-    0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7,
-    /*0xF8   0xF9   0xFA   0xFB   0xFC   0xFD   0xFE   0xFF*/
-    0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF
-};
diff --git a/libs/klib/crc32.c b/libs/klib/crc32.c
deleted file mode 100644
index 8a06596..0000000
--- a/libs/klib/crc32.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include <klib/checksum.h>
-#include <sysalloc.h>
-
-/*--------------------------------------------------------------------------
- * CRC32
- */
-static
-uint32_t sCRC32_tbl [ 256 ];
-
-/* CRC32Init
- *  initializes table
- *  IDEMPOTENT
- */
-LIB_EXPORT void CC CRC32Init ( void )
-{
-    static int beenHere = 0;
-    if ( ! beenHere )
-    {
-        int i, j;
-        int32_t kPoly32 = 0x04C11DB7;
-        
-        for ( i = 0; i < 256; ++ i )
-        {
-            int32_t byteCRC = i << 24;
-            for ( j = 0; j < 8; ++ j )
-            {
-                if ( byteCRC < 0 )
-                    byteCRC = ( byteCRC << 1 ) ^ kPoly32;
-                else
-                    byteCRC <<= 1;
-            }
-            sCRC32_tbl [ i ] = byteCRC;
-        }
-
-        beenHere = 1;
-    }
-}
-
-/* CRC32
- *  runs checksum on arbitrary data, returning result
- *  initial checksum to be passed in is 0
- *  subsequent checksums should be return from prior invocation
- */
-LIB_EXPORT uint32_t CC CRC32 ( uint32_t checksum, const void *data, size_t size )
-{
-    size_t j;
-
-#define str ( ( const unsigned char* ) data )
-
-    if ( sCRC32_tbl [ 0 ] == sCRC32_tbl [ 1 ] )
-        CRC32Init();
-
-    for ( j = 0; j < size; ++ j )
-    {
-        uint32_t i = ( checksum >> 24 ) ^ str [ j ];
-        checksum <<= 8;
-        checksum ^= sCRC32_tbl [ i ];
-    }
-    return checksum;
-    
-#undef str
-}
diff --git a/libs/klib/data-buffer.c b/libs/klib/data-buffer.c
deleted file mode 100644
index fb4d21d..0000000
--- a/libs/klib/data-buffer.c
+++ /dev/null
@@ -1,501 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <klib/extern.h>
-#include <klib/data-buffer.h>
-#include <klib/rc.h>
-#include <atomic32.h>
-#include <bitstr.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-#if _DEBUGGING
-#define DEBUG_MALLOC_FREE 1
-#include <stdio.h>
-#endif
-
-/*--------------------------------------------------------------------------
- * KDataBufferImpl
- */
-typedef struct buffer_impl_t buffer_impl_t;
-struct buffer_impl_t {
-    size_t allocated;
-    atomic32_t refcount;
-#if DEBUG_MALLOC_FREE
-    uint32_t foo;
-#endif
-};
-
-static size_t roundup(size_t value, unsigned bits)
-{
-    size_t const mask = (((size_t)1u) << bits) - 1;
-    return (value + mask) & (~mask);
-}
-
-static
-rc_t allocate(buffer_impl_t **target, size_t capacity) {
-    buffer_impl_t *y = malloc(capacity + sizeof(*y));
-
-    if (y == NULL)
-        return RC(rcRuntime, rcBuffer, rcAllocating, rcMemory, rcExhausted);
-
-    y->allocated = capacity;
-    atomic32_set(&y->refcount, 1);
-    
-#if DEBUG_MALLOC_FREE
-    y->foo = 0;
-#endif
-
-    *target = y;
-    return 0;
-}
-
-static buffer_impl_t *add_ref(buffer_impl_t *self) {
-    atomic32_inc(&self->refcount);
-    return self;
-}
-
-static buffer_impl_t *test_add_ref(buffer_impl_t *self) {
-    if (self) add_ref(self);
-    return self;
-}
-
-static void release(buffer_impl_t *self) {
-    int32_t refcount = atomic32_read_and_add(&self->refcount, -1);
-    
-    if (refcount == 1) {
-#if DEBUG_MALLOC_FREE
-        if (self->foo != 0) {
-            fprintf(stderr, "DIE DIE\n");
-        }
-        self->foo = 55;
-#endif
-        free(self);
-    }
-#if DEBUG_MALLOC_FREE
-    else if (refcount < 1) {
-        fprintf(stderr, "ALREADY DEAD\n");
-    }
-#endif
-}
-
-/* always returns object (new or original) with refcount == 1 */
-static rc_t reallocate(buffer_impl_t **target, size_t capacity) {
-    buffer_impl_t *temp;
-    buffer_impl_t *self = *target;
-
-    if (capacity <= self->allocated)
-        return 0;
-
-    /* check reference count for copies */
-    if (atomic32_read(&self->refcount) <= 1)
-    {
-        temp = realloc(self, capacity + sizeof(*temp));
-        if (temp == NULL)
-            return RC(rcRuntime, rcBuffer, rcResizing, rcMemory, rcExhausted);
-    }
-    else
-    {
-        temp = malloc(capacity + sizeof(*temp));
-        if (temp == NULL)
-            return RC(rcRuntime, rcBuffer, rcResizing, rcMemory, rcExhausted);
-        memcpy(temp, self, self->allocated + sizeof(*temp));
-        release(self);
-    }
-    self = temp;
-    self->allocated = capacity;
-    atomic32_set(&self->refcount, 1);
-    *target = self;
-
-    return 0;
-}
-
-static rc_t shrink(buffer_impl_t **target, size_t capacity)
-{
-    buffer_impl_t *self = *target;
-    
-    if (capacity < self->allocated && atomic32_read(&self->refcount) == 1) {
-        buffer_impl_t *temp = realloc(self, capacity + sizeof(*temp));
-        
-        if (temp == NULL)
-            return RC(rcRuntime, rcBuffer, rcResizing, rcMemory, rcExhausted);
-
-        temp->allocated = capacity;
-        *target = temp;
-    }
-    return 0;
-}
-
-/*
- either returns original with refcount == 2
- or returns new copy with refcount == 1
- */
-static buffer_impl_t* make_copy(buffer_impl_t *self) {
-    if (atomic32_read_and_add_eq(&self->refcount, 1, 1)==1)
-        return self;
-    else {
-        buffer_impl_t *copy = malloc(self->allocated + sizeof(*self));
-        if (copy) {
-            memcpy(copy, self, self->allocated + sizeof(*copy));
-            atomic32_set(&copy->refcount, 1);
-        }
-        return copy;
-    }
-}
-
-static void const *get_data(buffer_impl_t const *self)
-{
-    return &self[1];
-}
-
-static void const *get_data_endp(buffer_impl_t const *self)
-{
-    return (uint8_t const *)get_data(self) + self->allocated;
-}
-
-static
-rc_t buffer_impl_check_integrity (buffer_impl_t const *self, uint8_t const *base, size_t offset, size_t size)
-{
-    void const *const endp = &base[size+offset];
-
-    if (self == NULL)
-        return 0;
-
-    /* refcount is of major importance */
-    if (atomic32_read (& self->refcount) <= 0)
-        return RC (rcRuntime, rcBuffer, rcValidating, rcBuffer, rcDestroyed);
-
-#if DEBUG_MALLOC_FREE
-    if (self->foo != 0)
-        return RC (rcRuntime, rcBuffer, rcValidating, rcBuffer, rcDestroyed);
-#endif
-
-    if ((void const *)base < get_data(self) || get_data_endp(self) < endp)
-        return RC (rcRuntime, rcBuffer, rcValidating, rcData, rcCorrupt);
-
-    return 0;
-}
-
-/* Make
- *  create a new empty buffer
- *
- *  "buffer" [ OUT ] - pointer to structure to initialize
- *
- *  "capacity" [ IN ] - the number of bytes to be allocated
- */
-LIB_EXPORT rc_t CC KDataBufferMake(KDataBuffer *target, uint64_t elem_bits, uint64_t elem_count) {
-    rc_t rc;
-    size_t bytes;
-    buffer_impl_t **impp;
-    
-    if (target == NULL)
-    	return RC(rcRuntime, rcBuffer, rcConstructing, rcParam, rcNull);
-
-    impp = (buffer_impl_t **)&target->ignore;
-    
-    bytes = roundup((elem_bits * elem_count + 7) / 8, 12);
-    if (8 * (uint64_t)bytes < elem_bits * elem_count)
-    	return RC(rcRuntime, rcBuffer, rcConstructing, rcParam, rcTooBig);
-    
-    memset (target, 0, sizeof(*target));
-
-    rc = allocate(impp, bytes);
-    if (rc == 0) {
-        target->base = (void *)get_data(*impp);
-        target->elem_bits = elem_bits;
-        target->elem_count = elem_count;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDataBufferResize(KDataBuffer *self, uint64_t new_count) {
-    rc_t rc;
-    buffer_impl_t *imp;
-    buffer_impl_t *new_imp;
-    size_t new_size;
-    uint64_t bits;
-    const uint8_t *new_end;
-    const uint8_t *cur_end;
-    
-    if (self == NULL)
-    	return RC(rcRuntime, rcBuffer, rcResizing, rcParam, rcNull);
-
-    if (new_count == 0) {
-        self->elem_count = 0;
-        return 0; /*** no change for empty data ***/
-    }
-
-    bits = self->elem_bits * new_count;
-    if (((bits + 7) >> 35) != 0)
-    	return RC(rcRuntime, rcBuffer, rcConstructing, rcParam, rcTooBig);
-    
-    imp = (buffer_impl_t *)self->ignore;
-    if (imp == NULL) {
-        /* new buffer */
-        rc = allocate(&imp, roundup((bits + 7) / 8, 12));
-        if (rc == 0) {
-            self->ignore = imp;
-            self->base = (void *)get_data(imp);
-            self->elem_count = new_count;
-        }
-        return rc;
-    }
-
-    cur_end = &((const uint8_t *)imp)[imp->allocated + sizeof *imp];
-    new_end = &((const uint8_t *)self->base)[(bits + self->bit_offset + 7) >> 3];
-    if (cur_end >= new_end) {
-        /* requested end-of-buffer is within current allocation; realloc not required */
-        self->elem_count = new_count;
-        return 0;
-    }
-
-    if (!KDataBufferWritable(self))
-        return RC(rcRuntime, rcBuffer, rcResizing, rcSelf, rcReadonly);
-    
-    new_size = roundup((bits + 7) / 8, 12);
-    if (self->base == get_data(imp) && self->bit_offset == 0) {
-        rc = reallocate(&imp, new_size);
-        if (rc == 0) {
-            self->ignore = imp;
-            self->base = (void *)get_data(imp);
-            self->elem_count = new_count;
-        }
-        return rc;
-    }
-
-    /* is sub-buffer but is sole reference */
-    rc = allocate(&new_imp, roundup(new_size, 12));
-    if (rc == 0) {
-        memcpy((void *)get_data(new_imp), self->base, new_size);
-        release(imp);
-        self->base = (void *)get_data(new_imp);
-        self->ignore = new_imp;
-        self->elem_count = new_count;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDataBufferSub (const KDataBuffer *self,
-    KDataBuffer *target, uint64_t start, uint64_t count)
-{
-    if (self == NULL || target == NULL)
-    	return RC(rcRuntime, rcBuffer, rcConstructing, rcParam, rcNull);
-    
-    if (self->ignore == NULL) {
-        if (start > 0 || count < UINT64_MAX)
-            return RC(rcRuntime, rcBuffer, rcConstructing, rcParam, rcNull);
-        *target = *self;
-        return 0;
-    }
-    if ((const KDataBuffer *)target != self) {
-        *target = *self;
-        target->ignore = add_ref((buffer_impl_t *)self->ignore);
-    }
-    {
-        buffer_impl_t *imp = (buffer_impl_t *)self->ignore;
-        bitsz_t offset = self->bit_offset + (((bitsz_t)((uint8_t const *)self->base - (uint8_t const *)get_data(imp))) << 3);
-        
-        if (start > self->elem_count){
-            start = self->elem_count;
-            count = 0;
-        }
-        else if (count > self->elem_count) {
-            count = self->elem_count;
-        }
-        if (start + count > self->elem_count) {
-            count = self->elem_count - start;
-        }
-        target->elem_count = count;
-        offset += (bitsz_t)start * self->elem_bits;
-        target->base = &((uint8_t *)get_data(imp))[offset >> 3];
-        target->bit_offset = (uint8_t)offset & 0x07;
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KDataBufferCast(const KDataBuffer *self, KDataBuffer *target, uint64_t new_elem_bits, bool can_shrink) {
-    bitsz_t bits;
-    size_t new_elem_count;
-    bitsz_t new_bits;
-
-    if (self == NULL)
-        return RC (rcRuntime, rcBuffer, rcCasting, rcSelf, rcNull);
-    if (target == NULL)
-    	return RC (rcRuntime, rcBuffer, rcCasting, rcParam, rcNull);
-    if (new_elem_bits == 0)
-    	return RC (rcRuntime, rcBuffer, rcCasting, rcParam, rcInvalid);
-    
-    bits = KDataBufferBits(self);
-    new_elem_count = bits / new_elem_bits;
-    new_bits = new_elem_bits * new_elem_count;
-    
-    if (new_bits == bits || (can_shrink && new_bits < bits)) {
-        if ((const KDataBuffer *)target != self) {
-            *target = *self;
-            target->ignore = test_add_ref((buffer_impl_t *)self->ignore);
-        }
-        target->elem_count = new_elem_count;
-        target->elem_bits = new_elem_bits;
-        return 0;
-    }
-    return RC(rcRuntime, rcBuffer, rcCasting, rcParam, rcInvalid);
-}
-
-LIB_EXPORT rc_t CC KDataBufferMakeWritable (const KDataBuffer *cself, KDataBuffer *target)
-{
-    if (cself == NULL)
-    	return RC(rcRuntime, rcBuffer, rcConstructing, rcParam, rcNull);
-    
-    if (target == NULL)
-    	return RC(rcRuntime, rcBuffer, rcConstructing, rcParam, rcNull);
-
-    if ((KDataBuffer const *)target != cself)
-        memset(target, 0, sizeof(*target));
-    
-    if (cself->ignore == NULL)
-        return KDataBufferMake(target, cself->elem_bits, cself->elem_count);
-    else {
-        buffer_impl_t *self = (buffer_impl_t *)cself->ignore;
-        buffer_impl_t *copy;
-        
-        if (cself->base == get_data(self) && cself->bit_offset == 0) {
-            /* not a sub-buffer */
-            copy = make_copy(self);
-            if (copy) {
-                if ((KDataBuffer const *)target == cself)
-                    release(self);
-                else 
-                    *target = *cself;
-                target->ignore = copy;
-                target->base = (uint8_t *)get_data(copy);
-                
-                return 0;
-            }
-            return RC(rcRuntime, rcBuffer, rcAllocating, rcMemory, rcExhausted);
-        }
-        else if (atomic32_read(&self->refcount) == 1) {
-            /* sub-buffer but is only reference so let it be */
-            if ((KDataBuffer const *)target != cself) {
-                *target = *cself;
-                atomic32_set(&self->refcount, 2);
-            }
-            return 0;
-        }
-        else {
-            /* sub-buffer so make new and copy */
-            rc_t rc;
-            
-            rc = allocate(&copy, roundup(KDataBufferBytes(cself), 12));
-            if (rc == 0) {
-                if (cself->bit_offset == 0)
-                    memcpy((void *)get_data(copy), cself->base, KDataBufferBytes(cself));
-                else
-                    bitcpy((void *)get_data(copy), 0, cself->base, cself->bit_offset, KDataBufferBits(cself));
-
-                if ((const KDataBuffer *)target == cself)
-                    release(self);
-                else 
-                    *target = *cself;
-                target->ignore = copy;
-                target->base = (uint8_t *)get_data(copy);
-                target->bit_offset = 0;
-                return 0;
-            }
-            return rc;
-        }
-    }
-}
-
-LIB_EXPORT rc_t CC KDataBufferWhack (KDataBuffer *self)
-{
-    if (self)
-    {
-        if (self->ignore)
-            release((buffer_impl_t *)self->ignore);
-
-        memset(self, 0, sizeof(*self));
-    }
-    return 0;
-}
-
-LIB_EXPORT bool CC KDataBufferWritable(const KDataBuffer *cself)
-{
-    return (cself != NULL && cself->ignore != NULL &&
-            atomic32_read(&((buffer_impl_t *)cself->ignore)->refcount) == 1) ? true : false;
-}
-
-LIB_EXPORT rc_t CC KDataBufferShrink(KDataBuffer *self)
-{
-    if (self && self->ignore) {
-        return shrink((buffer_impl_t **)&self->ignore,
-            (self->elem_bits * self->elem_count + self->bit_offset + 7) / 8);
-    }
-    return 0;
-}
-
-LIB_EXPORT size_t CC KDataBufferMemorySize(KDataBuffer const *self)
-{
-    if (self && self->ignore) {
-        return ((buffer_impl_t const *)self->ignore)->allocated + sizeof(buffer_impl_t);
-    }
-    return 0;
-}
-
-/* CheckIntegrity
- *  performs some level of integrity checking on buffer structure
- */
-LIB_EXPORT rc_t CC KDataBufferCheckIntegrity (const KDataBuffer *self)
-{
-    /* whether NULL is allowed is determined by caller */
-    if (self == NULL)
-        return RC (rcRuntime, rcBuffer, rcValidating, rcSelf, rcNull);
-
-    /* elem-bits must not be 0, unless there is no allocation */
-    if (self->elem_bits == 0)
-    {
-        if (self->elem_count == 0 && self->bit_offset == 0 && self->ignore == NULL) {
-            /* no allocation */
-            return 0;
-        }
-	    return RC (rcRuntime, rcBuffer, rcValidating, rcSelf, rcCorrupt);
-    }
-
-    /* if there is no allocation, check self */
-    if (self->ignore == NULL)
-    {
-        if (self->elem_count != 0 || self->bit_offset != 0)
-	    return RC (rcRuntime, rcBuffer, rcValidating, rcSelf, rcCorrupt);
-    }
-
-    /* test self against allocated buffer */
-    return buffer_impl_check_integrity (self->ignore, (const void*) self->base,
-        self->bit_offset / self->elem_bits, KDataBufferBytes (self));
-}
-
-/* 0x101e9b000 */
diff --git a/libs/klib/debug.c b/libs/klib/debug.c
deleted file mode 100644
index 64ccea7..0000000
--- a/libs/klib/debug.c
+++ /dev/null
@@ -1,311 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#if _DEBUGGING
-
-#include <klib/extern.h>
-#include <klib/debug.h>
-#include "writer-priv.h"
-#include <sysalloc.h>
-
-/* PUT THIS IN A CORRECT PLACE */
-#define _module(mod) \
-    KDbgFlag DBG_PASTE_3(DBG_,mod,_ANY) = ( DBG_PASTE_2(mod,_CONDITIONS()) 0);
-#define _condition(mod,flag) \
-    (((KDbgFlag)1)<<DBG_PASTE_4(DBG_,mod,_,flag)) |
-
-MODULE_NAMES()
-
-#undef _module
-#undef _condition
-
-#define _module(mod)                            \
-    dbg_s_flag DBG_PASTE_2(dbg_s_flag_,mod) [] = \
-    {                                            \
-        DBG_PASTE_2(mod,_CONDITIONS())           \
-        { NULL, DBG_FLAG_NONE }                      \
-    };
-
-#define _condition(mod,flag)                                           \
-    { DBG_STRING(flag), ((KDbgFlag)1)<<DBG_PASTE_4(DBG_,mod,_,flag) },
-
-MODULE_NAMES()
-
-#undef _module
-#undef _condition
-
-#define _module(mod)                           \
-    {                                           \
-        DBG_STRING(mod),                         \
-        DBG_PASTE_2(dbg_s_flag_,mod),        \
-        0                                       \
-    },
-
-dbg_s_mod dbg_flag_mod [] = 
-{
-    MODULE_NAMES()
-    { NULL, NULL }
-};
-#undef _module
-
-#define _module(mod) 
-
-#include <klib/rc.h>
-#include <stdio.h>
-#include <string.h>
-
-KWrtHandler G_dbg_handler;
-
-/*
- * Init()
- * Initialize the debug messages module to a known state
- */
-LIB_EXPORT rc_t CC KDbgInit( void )
-{
-    KDbgHandlerSetStdErr();
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KDbgMsg ( const char * fmt, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, fmt );
-
-    if( (rc = vkfprintf(KDbgHandlerGet (), NULL, fmt, args)) != 0 ) {
-        kfprintf(KDbgHandlerGet(), NULL, "dbgmsg failure: %R in '%s'\n", rc, fmt);
-    }
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT KDbgFlag CC KDbgCondToFlag( KDbgCond cond )
-{
-    return (((KDbgFlag)1)<<cond);
-}
-
-/*
- * For module 'mod' turn on or off the specific flags in
- * mask flags
- *
- * bits in mask are effected.
- * return previous 
- */
-LIB_EXPORT KDbgMask CC KDbgSetModConds( KDbgMod mod, KDbgMask mask, KDbgMask flags )
-{
-    KDbgMask previous;
-
-    if ((mod < 0) || (mod >= DBG_MOD_COUNT))
-    {
-        /* unmaskable debug message */
-        KDbgMsg ("%s: Undefined module: (%u)\n", __func__, mod);
-        return DBG_FLAG_NONE;
-    }
-    previous = dbg_flag_mod[mod].flags;
-
-    dbg_flag_mod[mod].flags = (flags & mask) | (previous & ~mask);
-
-    return previous;
-}
-
-
-LIB_EXPORT bool CC KDbgTestModConds( KDbgMod mod, KDbgMask flags )
-{
-    if (mod >= DBG_MOD_COUNT)
-    {
-        /* unmaskable debug message */
-        KDbgMsg ("%s: Undefined module: (%u)\n", __func__, mod);
-        return false;
-    }
-    return DBG_FLAG_NONE != (KDbgGetModFlags (mod) & flags);
-}
-
-
-/*
- * Get the KDbgMod associated with a name.
- */
-LIB_EXPORT rc_t CC KDbgGetModId( KDbgMod * mod, 
-                   const char * mod_name, size_t mod_size )
-{
-    KDbgMod idx;
-
-    for (idx = 0; idx < DBG_MOD_COUNT; ++idx)
-    {
-        if (strncmp (dbg_flag_mod[idx].name, mod_name, mod_size) == 0)
-        {
-            *mod = idx;
-            return 0;
-        }
-    }
-    *mod = DBG_MOD_NOT_FOUND;
-    return RC (rcRuntime, rcLog, rcAccessing, rcParam, rcNotFound);
-}
-
-
-/*
- * Get the KDbgCond associated with a name.
- */
-LIB_EXPORT rc_t CC KDbgGetCndFlag( KDbgMod mod, KDbgFlag * flag,
-                      const char * cnd_name, size_t cnd_size )
-{
-    const dbg_s_flag * cnd;
-
-    for (cnd = dbg_flag_mod[mod].conds; cnd->name != NULL; ++cnd)
-    {
-        if (strncmp (cnd_name, cnd->name, cnd_size) == 0)
-            break;
-    }
-    if (cnd->name == NULL)
-        return RC (rcRuntime, rcArgv, rcAccessing, rcParam, rcUndefined);
-
-    *flag = cnd->flag;
-    return 0;
-}
-
-LIB_EXPORT KDbgMask CC KDbgGetModFlags( KDbgMod mod )
-{
-    if ((mod < 0) || (mod >= DBG_MOD_COUNT))
-    {
-        /* unmaskable debug message */
-        KDbgMsg ("%s: Undefined module: (%u)\n", __func__, mod);
-        return DBG_FLAG_NONE;
-    }
-    return dbg_flag_mod[mod].flags;
-}
-
-/* 
- * param is coming in as utf-8/ASCII with NUL terminator or we fail
- * we also assume no more than 127 significant characters
- *
- * These strings can be utf-8 or ASCII even if we are using 
- * clib strXXX functions.
- */
-LIB_EXPORT rc_t CC KDbgSetString( const char * string )
-{
-    const char * mod_s;
-    const char * flag_s;
-    size_t mod_z;
-
-    KDbgMod mod;
-
-    rc_t rc;
-
-    mod_s = string;
-
-    if (mod_s == NULL)
-        return RC (rcRuntime, rcArgv, rcAccessing, rcParam, rcNull);
-    if (*mod_s == '\0')
-        return 0;
-
-    flag_s = strchr (mod_s, '-');
-    if (flag_s)
-    {
-        mod_z = (size_t)(flag_s - mod_s);
-
-        if (*(++flag_s) == '\0')
-            flag_s = NULL;
-    }
-    else
-        mod_z = strlen (mod_s);
-
-    rc = KDbgGetModId (&mod, mod_s, mod_z);
-    if (rc)
-        return rc;
-
-    /* now we have a id for the module so we need to figure out the flag */
-
-    if (flag_s == NULL)
-    {
-        dbg_flag_mod[mod].flags = ~(KDbgMask)0;
-        rc = 0;
-    }
-    else
-    {
-        const dbg_s_flag * cnd;
-
-        for (cnd = dbg_flag_mod[mod].conds; cnd->name != NULL; ++cnd)
-        {
-            if (strcmp (flag_s, cnd->name) == 0)
-                break;
-        }
-        if (cnd->name == NULL)
-            return RC (rcRuntime, rcArgv, rcAccessing, rcParam, rcUndefined);
-
-        dbg_flag_mod[mod].flags |= cnd->flag;
-
-    }
-    return 0;
-}
-
-/* -----
- * Handlers for application and library writers.
- */
-
-#undef KDbgHandlerSetStdOut
-LIB_EXPORT rc_t CC KDbgHandlerSetStdOut( void )
-{
-    return KDbgHandlerSet( KWrt_DefaultWriter,KWrt_DefaultWriterDataStdOut );
-}
-
-
-#undef KDbgHandlerSetStdErr
-LIB_EXPORT rc_t CC KDbgHandlerSetStdErr( void )
-{
-    return KDbgHandlerSet( KWrt_DefaultWriter,KWrt_DefaultWriterDataStdErr );
-}
-
-
-#undef KDbgHandlerSet
-LIB_EXPORT rc_t CC KDbgHandlerSet( KWrtWriter writer, void * writer_data )
-{
-    G_dbg_handler.writer = writer;
-    G_dbg_handler.data = writer_data;
-    return 0;
-}
-
-#undef KDbgWriterDataGet
-LIB_EXPORT void * CC KDbgWriterDataGet( void )
-{
-    return ( KDbgHandlerGet()->data );
-}
-
-
-#undef KDbgWriterGet
-LIB_EXPORT KWrtWriter CC KDbgWriterGet( void )
-{
-    return ( KDbgHandlerGet()->writer );
-}
-
-
-#undef KDbgHandlerGet
-LIB_EXPORT KWrtHandler * CC KDbgHandlerGet( void )
-{
-    return ( &G_dbg_handler );
-}
-
-#endif /* _DEBUGGING */
diff --git a/libs/klib/iso8859-1.c b/libs/klib/iso8859-1.c
deleted file mode 100644
index e62cdc9..0000000
--- a/libs/klib/iso8859-1.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include <sysalloc.h>
-#include <stdint.h>
-
-LIB_EXPORT const uint32_t iso8859_1 [ 128 ] =
-{
-    /*  +       0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15 */
-    /* 128 */   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    /* 144 */   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    /* 160 */ 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
-    /* 176 */ 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
-    /* 192 */ 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
-    /* 208 */ 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
-    /* 224 */ 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
-    /* 240 */ 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
-};
diff --git a/libs/klib/iso8859.c b/libs/klib/iso8859.c
deleted file mode 100644
index 0973624..0000000
--- a/libs/klib/iso8859.c
+++ /dev/null
@@ -1,205 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include <klib/text.h>
-#include <sysalloc.h>
-#include <assert.h>
-
-/* iso8859_utf32
- *  converts 8-bit text to a single UTF32 character
- *  returns the number of 8-bit bytes consumed, such that:
- *    return > 0 means success
- *    return == 0 means insufficient input
- *    return < 0 means bad input
- */
-LIB_EXPORT int CC iso8859_utf32 ( const uint32_t map [ 128 ],
-    uint32_t *cp, const char *begin, const char *end )
-{
-    uint32_t ch;
-
-    if ( begin == NULL || end == NULL )
-        return -1;
-    if ( begin >= end )
-        return 0;
-
-    ch = begin [ 0 ];
-    if ( begin [ 0 ] < 0 )
-    {
-        ch = map [ ch & 0x7F ];
-        if ( ch == 0 )
-            return -1;
-    }
-
-    * cp = ch;
-    return 1;
-}
-
-/* iso8859_string_size/len/measure
- *  measures UTF-16 strings
- */
-LIB_EXPORT size_t CC iso8859_string_size ( const uint32_t map [ 128 ],
-    const char *str )
-{
-    uint32_t i, ch;
-
-    for ( ch = str [ i = 0 ]; ch != 0; ch = str [ ++ i ] )
-    {
-        if ( ( int ) ch < 0 && map [ ch & 0x7F ] == 0 )
-            break;
-    }
-
-    return ( size_t ) i;
-}
-
-LIB_EXPORT uint32_t CC iso8859_string_len ( const uint32_t map [ 128 ],
-    const char *str, size_t size )
-{
-    uint32_t i;
-
-    for ( i = 0; i < ( uint32_t ) size; ++ i )
-    {
-        uint32_t ch = str [ i ];
-        if ( str [ i ] < 0 && map [ ch & 0x7F ] == 0 )
-            break;
-    }
-
-    return i;
-}
-
-LIB_EXPORT uint32_t CC iso8859_string_measure ( const uint32_t map [ 128 ],
-    const char *str, size_t *size )
-{
-    uint32_t i, ch;
-
-    for ( ch = str [ i = 0 ]; ch != 0; ch = str [ ++ i ] )
-    {
-        if ( ( int ) ch < 0 && map [ ch & 0x7F ] == 0 )
-            break;
-    }
-
-    * size = i;
-    return i;
-}
-
-/* conversion from ISO-8859-x to internal standard */
-LIB_EXPORT uint32_t CC iso8859_cvt_string_len ( const uint32_t map [ 128 ],
-    const char *src, size_t src_size, size_t *dst_size )
-{
-    size_t size;
-    uint32_t i;
-
-    for ( i = 0, size = 0; i < ( uint32_t ) src_size; ++ i )
-    {
-        uint32_t ch = src [ i ];
-        if ( src [ i ] < 0 )
-        {
-            int ch_len;
-            char ignore [ 8 ];
-
-            ch = map [ ch & 0x7F ];
-            if ( ch == 0 )
-                break;
-
-            ch_len = utf32_utf8 ( ignore, & ignore [ sizeof ignore ], ch );
-            if ( ch_len <= 0 )
-                break;
-
-            size += ch_len;
-        }
-        else
-        {
-            ++ size;
-        }
-    }
-
-    * dst_size = size;
-
-    return i;
-}
-
-LIB_EXPORT uint32_t CC iso8859_cvt_string_measure ( const uint32_t map [ 128 ],
-    const char *src, size_t *src_size, size_t *dst_size )
-{
-    size_t size;
-    uint32_t i, ch;
-
-    for ( ch = src [ i = 0 ], size = 0; ch != 0; ch = src [ ++ i ] )
-    {
-        if ( ( int ) ch < 0 )
-        {
-            int ch_len;
-            char ignore [ 8 ];
-
-            ch = map [ ch & 0x7F ];
-            if ( ch == 0 )
-                break;
-
-            ch_len = utf32_utf8 ( ignore, & ignore [ sizeof ignore ], ch );
-            if ( ch_len <= 0 )
-                break;
-
-            size += ch_len;
-        }
-        else
-        {
-            ++ size;
-        }
-    }
-
-    * src_size = ( size_t ) i;
-    * dst_size = size;
-
-    return i;
-}
-
-LIB_EXPORT size_t CC iso8859_cvt_string_copy ( const uint32_t map [ 128 ],
-    char *dst, size_t dst_size, const char *src, size_t src_size )
-{
-    char *begin = dst;
-    char *dend = dst + dst_size;
-    const char *send = src + src_size;
-
-    while ( dst < dend && src < send )
-    {
-        int ch_len;
-        uint32_t ch = * src ++;
-        if ( ( int ) ch < 0 )
-        {
-            ch = map [ ch & 0x7F ];
-            if ( ch == 0 )
-                break;
-        }
-        ch_len = utf32_utf8 ( dst, dend, ch );
-        if ( ch_len <= 0 )
-            break;
-        dst += ch_len;
-    }
-
-    if ( dst < dend )
-        * dst = 0;
-    return ( size_t ) ( dst - begin );
-}
diff --git a/libs/klib/judy-vector.c b/libs/klib/judy-vector.c
deleted file mode 100644
index 3030d8e..0000000
--- a/libs/klib/judy-vector.c
+++ /dev/null
@@ -1,892 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include <klib/vector.h>
-#include <klib/refcount.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#define JUST_DEFINE_YOUR_STUFF 1
-#include "Judy.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * KVector
- *  encapsulated vector interface
- *
- *  a vector obeys a particular set of messages
- *  it may be implemented as an array, but not necessarily.
- *
- *  the principal property of a vector is that it acts as a map
- *  between an integer key and a value of some type. in this case,
- *  we only accept unsigned integers as keys.
- */
-struct KVector
-{
-    void *nancy;
-    KRefcount refcount;
-    uint32_t fixed_size;
-    bool nancy_bool;
-};
-
-
-/* Make
- *  create an empty vector
- */
-LIB_EXPORT rc_t CC KVectorMake ( KVector **vp )
-{
-    rc_t rc;
-
-    if ( vp == NULL )
-        rc = RC ( rcCont, rcVector, rcConstructing, rcParam, rcNull );
-    else
-    {
-        KVector *v = calloc ( 1, sizeof * v );
-        if ( v == NULL )
-            rc = RC ( rcCont, rcVector, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            KRefcountInit ( & v -> refcount, 1, "KVector", "make", "v" );
-            * vp = v;
-            return 0;
-        }
-
-        * vp = NULL;
-    }
-
-    return rc;
-}
-
-
-/* Whack
- */
-static
-rc_t KVectorWhack ( KVector *self )
-{
-    if ( self -> nancy != NULL )
-    {
-        JError_t err;
-        Word_t whee =
-            ( self -> nancy_bool ? Judy1FreeArray : JudyLFreeArray )
-            ( & self -> nancy, & err );
-        ( void ) whee;
-    }
-
-    free ( self );
-    return 0;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KVectorAddRef ( const KVector *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KVector" ) )
-        {
-        case krefOkay:
-            break;
-        case krefLimit:
-            return RC ( rcCont, rcVector, rcAttaching, rcRange, rcExcessive );
-        default:
-            return RC ( rcCont, rcVector, rcAttaching, rcRefcount, rcDestroyed );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KVectorRelease ( const KVector *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KVector" ) )
-        {
-        case krefOkay:
-            break;
-        case krefWhack:
-        case krefZero:
-            return KVectorWhack ( ( KVector* ) self );
-        default:
-            return RC ( rcCont, rcVector, rcReleasing, rcRefcount, rcDestroyed );
-        }
-    }
-    return 0;
-}
-
-
-/* NancyError
- *  translate a JError_t to an rc_t
- */
-static
-rc_t NancyError ( const JError_t *err, enum RCContext ctx )
-{
-    switch ( JU_ERRNO ( err ) )
-    {
-    case JU_ERRNO_NONE:
-        break;
-    case JU_ERRNO_FULL:
-        return RC ( rcCont, rcVector, ctx, rcRange, rcExcessive );
-    case JU_ERRNO_NOMEM:
-        return RC ( rcCont, rcVector, ctx, rcMemory, rcExhausted );
-    case JU_ERRNO_NULLPPARRAY:
-    case JU_ERRNO_NULLPINDEX:
-        return RC ( rcCont, rcVector, ctx, rcParam, rcNull );
-    case JU_ERRNO_NOTJUDY1:
-    case JU_ERRNO_NOTJUDYL:
-    case JU_ERRNO_NOTJUDYSL:
-        return RC ( rcCont, rcVector, ctx, rcType, rcIncorrect );
-    case JU_ERRNO_OVERRUN:
-    case JU_ERRNO_CORRUPT:
-        return RC ( rcCont, rcVector, ctx, rcVector, rcCorrupt );
-    case JU_ERRNO_NONNULLPARRAY:
-    case JU_ERRNO_NULLPVALUE:
-    case JU_ERRNO_UNSORTED:
-        return RC ( rcCont, rcVector, ctx, rcParam, rcInvalid );
-    }
-
-    return 0;
-}
-
-
-/* Get
- *  get an untyped value
- *  returns rc_t state of rcNull if index is not set
- *
- *  "key" [ IN ] - vector index
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for value
- *
- *  "bytes" [ OUT ] - return parameter for bytes in value
- *
- * NB - if rc_t state is rcInsufficient, "bytes" will contain
- *  the number of bytes required to access the indexed value
- */
-static
-rc_t Nancy1Test ( const void *nancy, uint64_t idx, bool *value )
-{
-    JError_t err;
-    int data = Judy1Test ( nancy, ( Word_t ) idx, & err );
-    if ( data == JERR )
-        return NancyError ( & err, rcAccessing );
-    * value = data != 0;
-    return 0;
-}
-
-static
-rc_t NancyLGet ( const void *nancy, uint64_t idx, Word_t *value )
-{
-    JError_t err;
-    PPvoid_t datap = JudyLGet ( nancy, ( Word_t ) idx, & err );
-    if ( datap == NULL )
-        return RC ( rcCont, rcVector, rcAccessing, rcItem, rcNotFound );
-    if ( datap == PPJERR )
-        return NancyError ( & err, rcAccessing );
-
-    * value = * ( const Word_t* ) datap;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KVectorGet ( const KVector *self, uint64_t key,
-    void *buffer, size_t bsize, size_t *bytes )
-{
-    rc_t rc;
-
-    if ( bytes == NULL )
-        rc = RC ( rcCont, rcVector, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcCont, rcVector, rcAccessing, rcSelf, rcNull );
-        else if ( buffer == NULL && bsize != 0 )
-            rc = RC ( rcCont, rcVector, rcAccessing, rcParam, rcNull );
-        else if ( sizeof key > sizeof ( Word_t ) && ( key >> 32 ) != 0 )
-            rc = RC ( rcCont, rcVector, rcAccessing, rcRange, rcExcessive );
-        else
-        {
-            if ( self -> nancy_bool )
-            {
-                bool data;
-                rc = Nancy1Test ( self -> nancy, key, & data );
-                if ( rc == 0 )
-                {
-                    * bytes = sizeof data;
-                    if ( bsize < sizeof data )
-                        rc = RC ( rcCont, rcVector, rcAccessing, rcBuffer, rcInsufficient );
-                    else
-                        * ( bool* ) buffer = data;
-                    return rc;
-                }
-            }
-            else
-            {
-                Word_t data;
-                rc = NancyLGet ( self -> nancy, key, & data );
-                if ( rc == 0 )
-                {
-                    if ( self -> fixed_size == 0 )
-                        rc = RC ( rcCont, rcVector, rcAccessing, rcFunction, rcUnsupported );
-                    else
-                    {
-                        * bytes = self -> fixed_size;
-                        if ( bsize < self -> fixed_size )
-                            rc = RC ( rcCont, rcVector, rcAccessing, rcBuffer, rcInsufficient );
-                        else switch ( self -> fixed_size )
-                        {
-                        case 1:
-                            if ( data >= 0x100 )
-                                rc = RC ( rcCont, rcVector, rcAccessing, rcData, rcCorrupt );
-                            * ( uint8_t* ) buffer = ( uint8_t ) data;
-                            break;
-                        case 2:
-                            if ( data >= 0x10000 )
-                                rc = RC ( rcCont, rcVector, rcAccessing, rcData, rcCorrupt );
-                            * ( uint16_t* ) buffer = ( uint16_t ) data;
-                            break;
-                        case 4:
-                            if ( sizeof data > 4 && ( data >> 32 ) != 0 )
-                                rc = RC ( rcCont, rcVector, rcAccessing, rcData, rcCorrupt );
-                            * ( uint32_t* ) buffer = ( uint32_t ) data;
-                            break;
-                        case 8:
-                            * ( uint64_t* ) buffer = ( uint64_t ) data;
-                            break;
-                        default:
-                            rc = RC ( rcCont, rcVector, rcAccessing, rcType, rcUnsupported );
-                        }
-                        return rc;
-                    }
-                }
-            }
-        }
-
-        * bytes = 0;
-    }
-
-    return rc;
-}
-
-/* Get
- *  get typed values
- *  returns rc_t state of rcNull if index is not set
- *
- *  "key" [ IN ] - vector index
- *
- *  "data" [ OUT ] - return parameter for value
- */
-LIB_EXPORT rc_t CC KVectorGetBool ( const KVector *self, uint64_t key, bool *data )
-{
-    size_t bytes;
-    return KVectorGet ( self, key, data, sizeof * data, & bytes );
-}
-
-LIB_EXPORT rc_t CC KVectorGetI8 ( const KVector *self, uint64_t key, int8_t *data )
-{
-    size_t bytes;
-    return KVectorGet ( self, key, data, sizeof * data, & bytes );
-}
-
-LIB_EXPORT rc_t CC KVectorGetI16 ( const KVector *self, uint64_t key, int16_t *data )
-{
-    size_t bytes;
-    return KVectorGet ( self, key, data, sizeof * data, & bytes );
-}
-
-LIB_EXPORT rc_t CC KVectorGetI32 ( const KVector *self, uint64_t key, int32_t *data )
-{
-    size_t bytes;
-    return KVectorGet ( self, key, data, sizeof * data, & bytes );
-}
-
-LIB_EXPORT rc_t CC KVectorGetI64 ( const KVector *self, uint64_t key, int64_t *data )
-{
-    size_t bytes;
-    return KVectorGet ( self, key, data, sizeof * data, & bytes );
-}
-
-LIB_EXPORT rc_t CC KVectorGetU8 ( const KVector *self, uint64_t key, uint8_t *data )
-{
-    size_t bytes;
-    return KVectorGet ( self, key, data, sizeof * data, & bytes );
-}
-
-LIB_EXPORT rc_t CC KVectorGetU16 ( const KVector *self, uint64_t key, uint16_t *data )
-{
-    size_t bytes;
-    return KVectorGet ( self, key, data, sizeof * data, & bytes );
-}
-
-LIB_EXPORT rc_t CC KVectorGetU32 ( const KVector *self, uint64_t key, uint32_t *data )
-{
-    size_t bytes;
-    return KVectorGet ( self, key, data, sizeof * data, & bytes );
-}
-
-LIB_EXPORT rc_t CC KVectorGetU64 ( const KVector *self, uint64_t key, uint64_t *data )
-{
-    size_t bytes;
-    return KVectorGet ( self, key, data, sizeof * data, & bytes );
-}
-
-LIB_EXPORT rc_t CC KVectorGetF32 ( const KVector *self, uint64_t key, float *data )
-{
-    size_t bytes;
-    rc_t rc = KVectorGet ( self, key, data, sizeof * data, & bytes );
-    if ( rc == 0 && bytes != sizeof * data )
-        rc = RC ( rcCont, rcVector, rcAccessing, rcType, rcUnsupported );
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KVectorGetF64 ( const KVector *self, uint64_t key, double *data )
-{
-    size_t bytes;
-    rc_t rc = KVectorGet ( self, key, data, sizeof * data, & bytes );
-    if ( rc == 0 && bytes != sizeof * data )
-        rc = RC ( rcCont, rcVector, rcAccessing, rcType, rcUnsupported );
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KVectorGetPtr ( const KVector *self, uint64_t key, void **data )
-{
-    size_t bytes;
-    rc_t rc = KVectorGet ( self, key, data, sizeof * data, & bytes );
-    if ( rc == 0 && bytes != sizeof * data )
-        rc = RC ( rcCont, rcVector, rcAccessing, rcType, rcUnsupported );
-    return rc;
-}
-
-
-/* Set
- *  set an untyped value
- *
- *  "key" [ IN ] - vector index
- *
- *  "data" [ IN ] and "bytes" [ IN ] - value buffer
- */
-static
-rc_t Nancy1Set ( void **nancy, uint64_t idx, bool value )
-{
-    JError_t err;
-    int status = ( value ? Judy1Set : Judy1Unset ) ( nancy, ( Word_t ) idx, & err );
-    if ( status == JERR )
-        return NancyError ( & err, rcWriting );
-    return 0;
-}
-
-static
-rc_t NancyLSet ( void **nancy, uint64_t idx, Word_t value )
-{
-    JError_t err;
-    PPvoid_t datap = JudyLIns ( nancy, ( Word_t ) idx, & err );
-    if ( datap == NULL )
-        return RC ( rcCont, rcVector, rcWriting, rcMemory, rcExhausted );
-    if ( datap == PPJERR )
-        return NancyError ( & err, rcWriting );
-    * ( Word_t* ) datap = value;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KVectorSet ( KVector *self, uint64_t key,
-    const void *data, size_t bytes )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcCont, rcVector, rcWriting, rcSelf, rcNull );
-    else if ( data == NULL )
-        rc = RC ( rcCont, rcVector, rcWriting, rcParam, rcNull );
-    else if ( bytes == 0 )
-        rc = RC ( rcCont, rcVector, rcWriting, rcParam, rcEmpty );
-    else
-    {
-        Word_t value;
-
-        /* detect first set */
-        if ( self -> nancy == NULL )
-        {
-            switch ( bytes )
-            {
-            case 1:
-            case 2:
-            case 4:
-                break;
-            case 8:
-                if ( sizeof value < 8 )
-                    return RC ( rcCont, rcVector, rcWriting, rcParam, rcExcessive );
-            }
-
-            self -> fixed_size = ( uint32_t ) bytes;
-        }
-        else if ( bytes != ( size_t ) self -> fixed_size )
-        {
-            return RC ( rcCont, rcVector, rcWriting, rcParam, rcInconsistent );
-        }
-        else if ( self -> nancy_bool )
-        {
-            switch ( * ( const bool* ) data )
-            {
-            case 0:
-            case 1:
-                break;
-            default:
-                return RC ( rcCont, rcVector, rcWriting, rcParam, rcInvalid );
-            }
-            return Nancy1Set ( & self -> nancy, key, * ( const bool* ) data );
-        }
-
-        switch ( bytes )
-        {
-        case 1:
-            value = * ( const uint8_t* ) data;
-            break;
-        case 2:
-            value = * ( const uint16_t* ) data;
-            break;
-        case 4:
-            value = * ( const uint32_t* ) data;
-            break;
-        case 8:
-            value = * ( const uint64_t* ) data;
-            break;
-        }
-
-        rc = NancyLSet ( & self -> nancy, key, value );
-    }
-
-    return rc;
-}
-
-/* Set
- *  set typed values
- *
- *  "key" [ IN ] - vector index
- *
- *  "data" [ IN ] - value
- */
-LIB_EXPORT rc_t CC KVectorSetBool ( KVector *self, uint64_t key, bool data )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcCont, rcVector, rcWriting, rcSelf, rcNull );
-    else
-    {
-        /* detect first set */
-        if ( self -> nancy == NULL )
-        {
-            self -> fixed_size = sizeof data;
-            self -> nancy_bool = true;
-        }
-        else if ( ! self -> nancy_bool )
-        {
-            return RC ( rcCont, rcVector, rcWriting, rcParam, rcInvalid );
-        }
-
-        rc = Nancy1Set ( & self -> nancy, key, data );
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KVectorSetI8 ( KVector *self, uint64_t key, int8_t value )
-{
-    return KVectorSet ( self, key, & value, sizeof value );
-}
-
-LIB_EXPORT rc_t CC KVectorSetI16 ( KVector *self, uint64_t key, int16_t value )
-{
-    return KVectorSet ( self, key, & value, sizeof value );
-}
-
-LIB_EXPORT rc_t CC KVectorSetI32 ( KVector *self, uint64_t key, int32_t value )
-{
-    return KVectorSet ( self, key, & value, sizeof value );
-}
-
-LIB_EXPORT rc_t CC KVectorSetI64 ( KVector *self, uint64_t key, int64_t value )
-{
-    return KVectorSet ( self, key, & value, sizeof value );
-}
-
-LIB_EXPORT rc_t CC KVectorSetU8 ( KVector *self, uint64_t key, uint8_t value )
-{
-    return KVectorSet ( self, key, & value, sizeof value );
-}
-
-LIB_EXPORT rc_t CC KVectorSetU16 ( KVector *self, uint64_t key, uint16_t value )
-{
-    return KVectorSet ( self, key, & value, sizeof value );
-}
-
-LIB_EXPORT rc_t CC KVectorSetU32 ( KVector *self, uint64_t key, uint32_t value )
-{
-    return KVectorSet ( self, key, & value, sizeof value );
-}
-
-LIB_EXPORT rc_t CC KVectorSetU64 ( KVector *self, uint64_t key, uint64_t value )
-{
-    return KVectorSet ( self, key, & value, sizeof value );
-}
-
-LIB_EXPORT rc_t CC KVectorSetF32 ( KVector *self, uint64_t key, float value )
-{
-    return KVectorSet ( self, key, & value, sizeof value );
-}
-
-LIB_EXPORT rc_t CC KVectorSetF64 ( KVector *self, uint64_t key, double value )
-{
-    return KVectorSet ( self, key, & value, sizeof value );
-}
-
-LIB_EXPORT rc_t CC KVectorSetPtr ( KVector *self, uint64_t key, const void *value )
-{
-    return KVectorSet ( self, key, & value, sizeof value );
-}
-
-
-/* Unset
- *  unset an entry
- *  returns rc_t state rcNull if index is not set
- *
- *  "key" [ IN ] - vector index
- */
-LIB_EXPORT rc_t CC KVectorUnset ( KVector *self, uint64_t key )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcCont, rcVector, rcRemoving, rcSelf, rcNull );
-    else
-    {
-        int status;
-        JError_t err;
-
-        if ( self -> nancy_bool )
-            return Nancy1Set ( & self -> nancy, key, false );
-
-        status = JudyLDel ( & self -> nancy, key, & err );
-        if ( status == JERR )
-            return NancyError ( & err, rcRemoving );
-
-        rc = 0;
-    }
-
-    return rc;
-}
-
-
-/* Visit
- *  executes a function on each key/value pair
- *  returns early if "f" returns non-zero rc_t
- *
- *  "reverse" [ IN ] - if true, execute in reverse order
- *
- *  "f" [ IN ] and "user_data" [ IN, OPAQUE ] - function to be
- *  executed on each vector element or until the function
- *  returns true.
- */
-LIB_EXPORT rc_t CC KVectorVisit ( const KVector *self, bool reverse,
-    rc_t ( CC * f ) ( uint64_t key, const void *value, size_t bytes, void *user_data ),
-    void *user_data )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcCont, rcVector, rcVisiting, rcSelf, rcNull );
-    else if ( f == NULL )
-        rc = RC ( rcCont, rcVector, rcVisiting, rcFunction, rcNull );
-    else
-    {
-        rc = 0;
-
-        if ( self -> nancy != NULL )
-        {
-            JError_t err;
-            Word_t first, last, idx;
-
-	    /** Judy1First searches for first value higher then first**/ 
-            first = 0;
-	    /** Judy1Last searches for first value lower then last **/
-            last = (Word_t)-1;
-
-            if ( self -> nancy_bool )
-            {
-                bool value = true;
-                int status = Judy1First ( self -> nancy, & first, & err );
-                if ( status != JERR )
-                    status = Judy1Last ( self -> nancy, & last, & err );
-                if ( status == JERR )
-                    rc = NancyError ( & err, rcVisiting );
-                else if ( reverse )
-                {
-                    for ( idx = last; ; )
-                    {
-                        rc = ( * f ) ( idx, & value, sizeof value, user_data );
-                        if ( rc != 0 )
-                            break;
-                        if ( idx == first )
-                            break;
-                        status = Judy1Prev ( self -> nancy, & idx, & err );
-                        if ( status == JERR )
-                        {
-                            rc = NancyError ( & err, rcVisiting );
-                            break;
-                        }
-                    }
-                }
-                else
-                {
-                    for ( idx = first; ; )
-                    {
-                        rc = ( * f ) ( idx, & value, sizeof value, user_data );
-                        if ( rc != 0 )
-                            break;
-                        if ( idx == last )
-                            break;
-                        status = Judy1Next ( self -> nancy, & idx, & err );
-                        if ( status == JERR )
-                        {
-                            rc = NancyError ( & err, rcVisiting );
-                            break;
-                        }
-                    }
-                }
-            }
-            else
-            {
-                Word_t value;
-                PPvoid_t lastp, datap = JudyLFirst ( self -> nancy, & first, & err );
-                if ( datap != PPJERR )
-                    lastp = JudyLLast ( self -> nancy, & last, & err );
-                if ( datap == PPJERR || lastp == PPJERR )
-                    rc = NancyError ( & err, rcVisiting );
-                else if ( reverse )
-                {
-                    for ( rc = 0, idx = last, datap = lastp; ; )
-                    {
-                        if ( datap == NULL )
-                            break;
-                        value = * ( const Word_t* ) datap;
-                        rc = ( * f ) ( idx, & value, sizeof value, user_data );
-                        if ( rc != 0 )
-                            break;
-                        if ( idx == first )
-                            break;
-                        datap = JudyLPrev ( self -> nancy, & idx, & err );
-                        if ( datap == PPJERR )
-                        {
-                            rc = NancyError ( & err, rcVisiting );
-                            break;
-                        }
-                    }
-                }
-                else
-                {
-                    for ( rc = 0, idx = first; ; )
-                    {
-                        if ( datap == NULL )
-                            break;
-                        value = * ( const Word_t* ) datap;
-                        rc = ( * f ) ( idx, & value, sizeof value, user_data );
-                        if ( rc != 0 )
-                            break;
-                        if ( idx == last )
-                            break;
-                        datap = JudyLNext ( self -> nancy, & idx, & err );
-                        if ( datap == PPJERR )
-                        {
-                            rc = NancyError ( & err, rcVisiting );
-                            break;
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    return rc;
-}
-
-/* Visit
- *  visit typed values
- *  returns early if "f" returns non-zero rc_t
- *
- *  "reverse" [ IN ] - if true, execute in reverse order
- *
- *  "f" [ IN ] and "user_data" [ IN, OPAQUE ] - function to be
- *  executed on each vector element or until the function
- *  returns true.
- */
-typedef struct KVectorVisitTypedData KVectorVisitTypedData;
-struct KVectorVisitTypedData
-{
-    union
-    {
-        rc_t ( CC * b ) ( uint64_t key, bool value, void *user_data );
-        rc_t ( CC * i ) ( uint64_t key, int64_t value, void *user_data );
-        rc_t ( CC * u ) ( uint64_t key, uint64_t value, void *user_data );
-        rc_t ( CC * f ) ( uint64_t key, double value, void *user_data );
-        rc_t ( CC * p ) ( uint64_t key, const void *value, void *user_data );
-    } f;
-    void *user_data;
-};
-
-static
-rc_t CC KVectorVisitBoolFunc ( uint64_t key, const void *ptr, size_t bytes, void *user_data )
-{
-    rc_t rc;
-    bool value;
-    if ( bytes != sizeof value )
-        rc = RC ( rcCont, rcVector, rcVisiting, rcType, rcInvalid );
-    else if ( * ( const uint8_t* ) ptr > 1 )
-        rc = RC ( rcCont, rcVector, rcVisiting, rcData, rcInvalid );
-    else
-    {
-        KVectorVisitTypedData *pb = user_data;
-        rc = ( * pb -> f . b ) ( key,  * ( const bool* ) ptr, pb -> user_data );
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KVectorVisitBool ( const KVector *self, bool reverse,
-    rc_t ( CC * f ) ( uint64_t key, bool value, void *user_data ),
-    void *user_data )
-{
-    KVectorVisitTypedData pb;
-    pb . f . b = f;
-    pb . user_data = user_data;
-
-    return KVectorVisit ( self, reverse, KVectorVisitBoolFunc, & pb );
-}
-
-static
-rc_t CC KVectorVisitI64Func ( uint64_t key, const void *ptr, size_t bytes, void *user_data )
-{
-    int64_t value;
-    KVectorVisitTypedData *pb = user_data;
-
-    switch ( bytes )
-    {
-    case 1:
-        value = ( int8_t ) * ( const Word_t* ) ptr;
-        break;
-    case 2:
-        value = ( int16_t ) * ( const Word_t* ) ptr;
-        break;
-    case 4:
-        value = ( int32_t ) * ( const Word_t* ) ptr;
-        break;
-    default:
-        value = ( int64_t ) * ( const Word_t* ) ptr;
-    }
-
-    return ( * pb -> f . i ) ( key, value, pb -> user_data );
-}
-
-LIB_EXPORT rc_t CC KVectorVisitI64 ( const KVector *self, bool reverse,
-    rc_t ( CC * f ) ( uint64_t key, int64_t value, void *user_data ),
-    void *user_data )
-{
-    KVectorVisitTypedData pb;
-    pb . f . i = f;
-    pb . user_data = user_data;
-
-    return KVectorVisit ( self, reverse, KVectorVisitI64Func, & pb );
-}
-
-static
-rc_t CC KVectorVisitU64Func ( uint64_t key, const void *ptr, size_t bytes, void *user_data )
-{
-    KVectorVisitTypedData *pb = user_data;
-    return ( * pb -> f . u ) ( key, * ( const Word_t* ) ptr, pb -> user_data );
-}
-
-LIB_EXPORT rc_t CC KVectorVisitU64 ( const KVector *self, bool reverse,
-    rc_t ( CC * f ) ( uint64_t key, uint64_t value, void *user_data ),
-    void *user_data )
-{
-    KVectorVisitTypedData pb;
-    pb . f . u = f;
-    pb . user_data = user_data;
-
-    return KVectorVisit ( self, reverse, KVectorVisitU64Func, & pb );
-}
-
-static
-rc_t CC KVectorVisitF64Func ( uint64_t key, const void *ptr, size_t bytes, void *user_data )
-{
-    uint32_t u32;
-    double value;
-    KVectorVisitTypedData *pb = user_data;
-
-    switch ( bytes )
-    {
-    case 4:
-        u32 = ( uint32_t ) * ( const Word_t* ) ptr;
-        value = * ( const float* ) & u32;
-        break;
-    default:
-        value = * ( const double* ) ptr;
-    }
-
-    return ( * pb -> f . f ) ( key, value, pb -> user_data );
-}
-
-LIB_EXPORT rc_t CC KVectorVisitF64 ( const KVector *self, bool reverse,
-    rc_t ( CC * f ) ( uint64_t key, double value, void *user_data ),
-    void *user_data )
-{
-    KVectorVisitTypedData pb;
-    pb . f . f = f;
-    pb . user_data = user_data;
-
-    return KVectorVisit ( self, reverse, KVectorVisitF64Func, & pb );
-}
-
-static
-rc_t CC KVectorVisitPtrFunc ( uint64_t key, const void *ptr, size_t bytes, void *user_data )
-{
-    KVectorVisitTypedData *pb = user_data;
-    return ( * pb -> f . p ) ( key, * ( const void** ) ptr, pb -> user_data );
-}
-
-LIB_EXPORT rc_t CC KVectorVisitPtr ( const KVector *self, bool reverse,
-    rc_t ( CC * f ) ( uint64_t key, const void *value, void *user_data ),
-    void *user_data )
-{
-    KVectorVisitTypedData pb;
-    pb . f . p = f;
-    pb . user_data = user_data;
-
-    return KVectorVisit ( self, reverse, KVectorVisitPtrFunc, & pb );
-}
diff --git a/libs/klib/judy/Judy1.h b/libs/klib/judy/Judy1.h
deleted file mode 100644
index 5eeb6fd..0000000
--- a/libs/klib/judy/Judy1.h
+++ /dev/null
@@ -1,549 +0,0 @@
-#ifndef _JUDY1_INCLUDED
-#define _JUDY1_INCLUDED
-// _________________
-//
-// Copyright (C) 2000 - 2002 Hewlett-Packard Company
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the term of the GNU Lesser 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 Lesser General Public License
-// for more details.
-//
-// You should have received a copy of the GNU Lesser 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
-// _________________
-
-// ****************************************************************************
-//          JUDY1 -- SMALL/LARGE AND/OR CLUSTERED/SPARSE BIT ARRAYS
-//
-//                                    -by-
-//
-//                             Douglas L. Baskins
-//                             doug at sourcejudy.com
-//
-// Judy arrays are designed to be used instead of arrays.  The performance
-// suggests the reason why Judy arrays are thought of as arrays, instead of
-// trees.  They are remarkably memory efficient at all populations.
-// Implemented as a hybrid digital tree (but really a state machine, see
-// below), Judy arrays feature fast insert/retrievals, fast near neighbor
-// searching, and contain a population tree for extremely fast ordinal related
-// retrievals.
-//
-// CONVENTIONS:
-//
-// - The comments here refer to 32-bit [64-bit] systems.
-//
-// - BranchL, LeafL refer to linear branches and leaves (small populations),
-//   except LeafL does not actually appear as such; rather, Leaf1..3 [Leaf1..7]
-//   is used to represent leaf Index sizes, and LeafW refers to a Leaf with
-//   full (long) word Indexes, which is also a type of linear leaf.  Note that
-//   root-level LeafW (Leaf4 [Leaf8]) leaves are also called LEAFW.
-//
-// - BranchB, LeafB1 refer to bitmap branches and leaves (intermediate
-//   populations).
-//
-// - BranchU refers to uncompressed branches.  An uncompressed branch has 256
-//   JPs, some of which could be null.  Note:  All leaves are compressed (and
-//   sorted), or else an expanse is full (FullPopu), so there is no LeafU
-//   equivalent to BranchU.
-//
-// - "Popu" is short for "Population".
-// - "Pop1" refers to actual population (base 1).
-// - "Pop0" refers to Pop1 - 1 (base 0), the way populations are stored in data
-//   structures.
-//
-// - Branches and Leaves are both named by the number of bytes in their Pop0
-//   field.  In the case of Leaves, the same number applies to the Index sizes.
-//
-// - The representation of many numbers as hex is a relatively safe and
-//   portable way to get desired bitpatterns as unsigned longs.
-//
-// - Some preprocessors cant handle single apostrophe characters within
-//   #ifndef code, so here, use delete all instead.
-
-#include "JudyPrivate.h"        // includes Judy.h in turn.
-#include "JudyPrivateBranch.h"
-
-
-// ****************************************************************************
-// JUDY1 ROOT POINTER (JRP) AND JUDY1 POINTER (JP) TYPE FIELDS
-// ****************************************************************************
-//
-// The following enum lists all possible JP Type fields. 
-
-typedef enum            // uint8_t -- but C does not support this type of enum.
-{
-
-// JP NULL TYPES:
-//
-// There is a series of cJ1_JPNULL* Types because each one pre-records a
-// different Index Size for when the first Index is inserted in the previously
-// null JP.  They must start >= 8 (three bits).
-//
-// Note:  These Types must be in sequential order for doing relative
-// calculations between them.
-
-        cJ1_JPNULL1 = 1,
-                                // Index Size 1[1] byte  when 1 Index inserted.
-        cJ1_JPNULL2,            // Index Size 2[2] bytes when 1 Index inserted.
-        cJ1_JPNULL3,            // Index Size 3[3] bytes when 1 Index inserted.
-
-#ifndef JU_64BIT
-#define cJ1_JPNULLMAX cJ1_JPNULL3
-#else
-        cJ1_JPNULL4,            // Index Size 4[4] bytes when 1 Index inserted.
-        cJ1_JPNULL5,            // Index Size 5[5] bytes when 1 Index inserted.
-        cJ1_JPNULL6,            // Index Size 6[6] bytes when 1 Index inserted.
-        cJ1_JPNULL7,            // Index Size 7[7] bytes when 1 Index inserted.
-#define cJ1_JPNULLMAX cJ1_JPNULL7
-#endif
-
-
-// JP BRANCH TYPES:
-//
-// Note:  There are no state-1 branches; only leaves reside at state 1.
-
-// Linear branches:
-//
-// Note:  These Types must be in sequential order for doing relative
-// calculations between them.
-
-        cJ1_JPBRANCH_L2,        // 2[2] bytes Pop0, 1[5] bytes Dcd.
-        cJ1_JPBRANCH_L3,        // 3[3] bytes Pop0, 0[4] bytes Dcd.
-
-#ifdef JU_64BIT
-        cJ1_JPBRANCH_L4,        //  [4] bytes Pop0,  [3] bytes Dcd.
-        cJ1_JPBRANCH_L5,        //  [5] bytes Pop0,  [2] bytes Dcd.
-        cJ1_JPBRANCH_L6,        //  [6] bytes Pop0,  [1] byte  Dcd.
-        cJ1_JPBRANCH_L7,        //  [7] bytes Pop0,  [0] bytes Dcd.
-#endif
-
-        cJ1_JPBRANCH_L,         // note:  DcdPopO field not used.
-
-// Bitmap branches:
-//
-// Note:  These Types must be in sequential order for doing relative
-// calculations between them.
-
-        cJ1_JPBRANCH_B2,        // 2[2] bytes Pop0, 1[5] bytes Dcd.
-        cJ1_JPBRANCH_B3,        // 3[3] bytes Pop0, 0[4] bytes Dcd.
-
-#ifdef JU_64BIT
-        cJ1_JPBRANCH_B4,        //  [4] bytes Pop0,  [3] bytes Dcd.
-        cJ1_JPBRANCH_B5,        //  [5] bytes Pop0,  [2] bytes Dcd.
-        cJ1_JPBRANCH_B6,        //  [6] bytes Pop0,  [1] byte  Dcd.
-        cJ1_JPBRANCH_B7,        //  [7] bytes Pop0,  [0] bytes Dcd.
-#endif
-
-        cJ1_JPBRANCH_B,         // note:  DcdPopO field not used.
-
-// Uncompressed branches:
-//
-// Note:  These Types must be in sequential order for doing relative
-// calculations between them.
-
-        cJ1_JPBRANCH_U2,        // 2[2] bytes Pop0, 1[5] bytes Dcd.
-        cJ1_JPBRANCH_U3,        // 3[3] bytes Pop0, 0[4] bytes Dcd.
-
-#ifdef JU_64BIT
-        cJ1_JPBRANCH_U4,        //  [4] bytes Pop0,  [3] bytes Dcd.
-        cJ1_JPBRANCH_U5,        //  [5] bytes Pop0,  [2] bytes Dcd.
-        cJ1_JPBRANCH_U6,        //  [6] bytes Pop0,  [1] byte  Dcd.
-        cJ1_JPBRANCH_U7,        //  [7] bytes Pop0,  [0] bytes Dcd.
-#endif
-
-        cJ1_JPBRANCH_U,         // note:  DcdPopO field not used.
-
-
-// JP LEAF TYPES:
-
-// Linear leaves:
-//
-// Note:  These Types must be in sequential order for doing relative
-// calculations between them.
-//
-// Note:  There is no cJ1_JPLEAF1 for 64-bit for a subtle reason.  An immediate
-// JP can hold 15 1-byte Indexes, and a bitmap leaf would be used for 17
-// Indexes, so rather than support a linear leaf for only the case of exactly
-// 16 Indexes, a bitmap leaf is used in that case.  See also below regarding
-// cJ1_LEAF1_MAXPOP1 on 64-bit systems.
-//
-// Note:  There is no full-word (4-byte [8-byte]) Index leaf under a JP because
-// non-root-state leaves only occur under branches that decode at least one
-// byte.  Full-word, root-state leaves are under a JRP, not a JP.  However, in
-// the code a "fake" JP can be created temporarily above a root-state leaf.
-
-#ifndef JU_64BIT // 32-bit only; see above.
-        cJ1_JPLEAF1,            // 1    byte  Pop0, 2    bytes Dcd.
-#endif
-
-        cJ1_JPLEAF2,            // 2[2] bytes Pop0, 1[5] bytes Dcd.
-        cJ1_JPLEAF3,            // 3[3] bytes Pop0, 0[4] bytes Dcd.
-
-#ifdef JU_64BIT
-        cJ1_JPLEAF4,            //  [4] bytes Pop0,  [3] bytes Dcd.
-        cJ1_JPLEAF5,            //  [5] bytes Pop0,  [2] bytes Dcd.
-        cJ1_JPLEAF6,            //  [6] bytes Pop0,  [1] byte  Dcd.
-        cJ1_JPLEAF7,            //  [7] bytes Pop0,  [0] bytes Dcd.
-#endif
-
-// Bitmap leaf; Index Size == 1:
-//
-// Note:  These are currently only supported at state 1.  At other states the
-// bitmap would grow from 256 to 256^2, 256^3, ... bits, which would not be
-// efficient..
-
-        cJ1_JPLEAF_B1,          // 1[1] byte Pop0, 2[6] bytes Dcd.
-
-
-// Full population; Index Size == 1 virtual leaf:
-//
-// Note:  These are currently only supported at state 1.  At other states they
-// could be used, but they would be rare and the savings are dubious.
-
-        cJ1_JPFULLPOPU1,        // 1[1] byte Pop0, 2[6] bytes Dcd.
-
-#ifdef notdef  // for future enhancements
-        cJ1_JPFULLPOPU1m1,      // Full Population - 1 
-        cJ1_JPFULLPOPU1m2,      // Full Population - 2 
-        cJ1_JPFULLPOPU1m3,      // Full Population - 3 
-        cJ1_JPFULLPOPU1m4,      // Full Population - 4 
-        cJ1_JPFULLPOPU1m5,      // Full Population - 5 
-        cJ1_JPFULLPOPU1m6,      // Full Population - 6 
-        cJ1_JPFULLPOPU1m7,      // Full Population - 7 
-
-#ifdef JU_64BIT
-        cJ1_JPFULLPOPU1m8,      // Full Population - 8 
-        cJ1_JPFULLPOPU1m9,      // Full Population - 9 
-        cJ1_JPFULLPOPU1m10,     // Full Population - 10 
-        cJ1_JPFULLPOPU1m11,     // Full Population - 11
-        cJ1_JPFULLPOPU1m12,     // Full Population - 12
-        cJ1_JPFULLPOPU1m13,     // Full Population - 13
-        cJ1_JPFULLPOPU1m14,     // Full Population - 14
-        cJ1_JPFULLPOPU1m15,     // Full Population - 15
-#endif
-#endif // notdef -- for future enhancements
-
-
-// JP IMMEDIATES; leaves (Indexes) stored inside a JP:
-//
-// The second numeric suffix is the Pop1 for each type.  As the Index Size
-// increases, the maximum possible population decreases.
-//
-// Note:  These Types must be in sequential order in each group (Index Size),
-// and the groups in correct order too, for doing relative calculations between
-// them.  For example, since these Types enumerate the Pop1 values (unlike
-// other JP Types where there is a Pop0 value in the JP), the maximum Pop1 for
-// each Index Size is computable.
-
-        cJ1_JPIMMED_1_01,       // Index Size = 1, Pop1 = 1.
-        cJ1_JPIMMED_2_01,       // Index Size = 2, Pop1 = 1.
-        cJ1_JPIMMED_3_01,       // Index Size = 3, Pop1 = 1.
-#ifdef JU_64BIT
-        cJ1_JPIMMED_4_01,       // Index Size = 4, Pop1 = 1.
-        cJ1_JPIMMED_5_01,       // Index Size = 5, Pop1 = 1.
-        cJ1_JPIMMED_6_01,       // Index Size = 6, Pop1 = 1.
-        cJ1_JPIMMED_7_01,       // Index Size = 7, Pop1 = 1.
-#endif
-
-        cJ1_JPIMMED_1_02,       // Index Size = 1, Pop1 = 2.
-        cJ1_JPIMMED_1_03,       // Index Size = 1, Pop1 = 3.
-        cJ1_JPIMMED_1_04,       // Index Size = 1, Pop1 = 4.
-        cJ1_JPIMMED_1_05,       // Index Size = 1, Pop1 = 5.
-        cJ1_JPIMMED_1_06,       // Index Size = 1, Pop1 = 6.
-        cJ1_JPIMMED_1_07,       // Index Size = 1, Pop1 = 7.
-
-#ifdef JU_64BIT
-        cJ1_JPIMMED_1_08,       // Index Size = 1, Pop1 = 8.
-        cJ1_JPIMMED_1_09,       // Index Size = 1, Pop1 = 9.
-        cJ1_JPIMMED_1_10,       // Index Size = 1, Pop1 = 10.
-        cJ1_JPIMMED_1_11,       // Index Size = 1, Pop1 = 11.
-        cJ1_JPIMMED_1_12,       // Index Size = 1, Pop1 = 12.
-        cJ1_JPIMMED_1_13,       // Index Size = 1, Pop1 = 13.
-        cJ1_JPIMMED_1_14,       // Index Size = 1, Pop1 = 14.
-        cJ1_JPIMMED_1_15,       // Index Size = 1, Pop1 = 15.
-#endif
-
-        cJ1_JPIMMED_2_02,       // Index Size = 2, Pop1 = 2.
-        cJ1_JPIMMED_2_03,       // Index Size = 2, Pop1 = 3.
-
-#ifdef JU_64BIT
-        cJ1_JPIMMED_2_04,       // Index Size = 2, Pop1 = 4.
-        cJ1_JPIMMED_2_05,       // Index Size = 2, Pop1 = 5.
-        cJ1_JPIMMED_2_06,       // Index Size = 2, Pop1 = 6.
-        cJ1_JPIMMED_2_07,       // Index Size = 2, Pop1 = 7.
-#endif
-
-        cJ1_JPIMMED_3_02,       // Index Size = 3, Pop1 = 2.
-
-#ifdef JU_64BIT
-        cJ1_JPIMMED_3_03,       // Index Size = 3, Pop1 = 3.
-        cJ1_JPIMMED_3_04,       // Index Size = 3, Pop1 = 4.
-        cJ1_JPIMMED_3_05,       // Index Size = 3, Pop1 = 5.
-
-        cJ1_JPIMMED_4_02,       // Index Size = 4, Pop1 = 2.
-        cJ1_JPIMMED_4_03,       // Index Size = 4, Pop1 = 3.
-
-        cJ1_JPIMMED_5_02,       // Index Size = 5, Pop1 = 2.
-        cJ1_JPIMMED_5_03,       // Index Size = 3, Pop1 = 3.
-
-        cJ1_JPIMMED_6_02,       // Index Size = 6, Pop1 = 2.
-
-        cJ1_JPIMMED_7_02,       // Index Size = 7, Pop1 = 2.
-#endif
-
-// This special Type is merely a sentinel for doing relative calculations.
-// This value should not be used in switch statements (to avoid allocating code
-// for it), which is also why it appears at the end of the enum list.
-
-        cJ1_JPIMMED_CAP
-
-} jp1_Type_t;
-
-
-// RELATED VALUES:
-//
-// Index Size (state) for leaf JP, and JP type based on Index Size (state):
-
-#ifndef JU_64BIT // 32-bit
-#define J1_LEAFINDEXSIZE(jpType) ((jpType)    - cJ1_JPLEAF1 + 1)
-#define J1_LEAFTYPE(IndexSize)   ((IndexSize) + cJ1_JPLEAF1 - 1)
-#else
-#define J1_LEAFINDEXSIZE(jpType) ((jpType)    - cJ1_JPLEAF2 + 2)
-#define J1_LEAFTYPE(IndexSize)   ((IndexSize) + cJ1_JPLEAF2 - 2)
-#endif
-
-
-// ****************************************************************************
-// JUDY1 POINTER (JP) -- RELATED MACROS AND CONSTANTS
-// ****************************************************************************
-
-// MAXIMUM POPULATIONS OF LINEAR LEAVES:
-//
-// Allow up to 2 cache lines per leaf, with N bytes per index.
-//
-// J_1_MAXB is the maximum number of bytes (sort of) to allocate per leaf.
-// ALLOCSIZES is defined here, not there, for single-point control of these key
-// definitions.  See JudyTables.c for "TERMINATOR".
-
-#define J_1_MAXB   (sizeof(Word_t) * 32)
-#define ALLOCSIZES { 3, 5, 7, 11, 15, 23, 32, 47, 64, TERMINATOR } // in words.
-#define cJ1_LEAF1_MAXWORDS  5           // Leaf1 max alloc size in words.
-
-// Under JRP (root-state leaves):
-//
-// Includes a count (Population) word.
-//
-// Under JP (non-root-state leaves), which have no count (Population) words:
-//
-// When a 1-byte index leaf grows above cJ1_LEAF1_MAXPOP1 Indexes (bytes),
-// the memory chunk required grows to a size where a bitmap is just as
-// efficient, so use a bitmap instead for all greater Populations, on both
-// 32-bit and 64-bit systems.  However, on a 32-bit system this occurs upon
-// going from 6 to 8 words (24 to 32 bytes) in the memory chunk, but on a
-// 64-bit system this occurs upon going from 2 to 4 words (16 to 32 bytes).  It
-// would be silly to go from a 15-Index Immediate JP to a 16-Index linear leaf
-// to a 17-Index bitmap leaf, so just use a bitmap leaf for 16+ Indexes, which
-// means set cJ1_LEAF1_MAXPOP1 to cJ1_IMMED1_MAXPOP1 (15) to cause the
-// transition at that point.
-//
-// Note:  cJ1_LEAF1_MAXPOP1 is not used on 64-bit systems.
-
-#ifndef JU_64BIT // 32-bit
-
-#define cJ1_LEAF1_MAXPOP1    (cJ1_LEAF1_MAXWORDS * cJU_BYTESPERWORD)
-#define cJ1_LEAF2_MAXPOP1    (J_1_MAXB / 2)
-#define cJ1_LEAF3_MAXPOP1    (J_1_MAXB / 3)
-#define cJ1_LEAFW_MAXPOP1    ((J_1_MAXB - cJU_BYTESPERWORD) / cJU_BYTESPERWORD)
-
-#else // 64-bit
-
-// #define cJ1_LEAF1_MAXPOP1                    // no LEAF1 in 64-bit.
-#define cJ1_LEAF2_MAXPOP1    (J_1_MAXB / 2)
-#define cJ1_LEAF3_MAXPOP1    (J_1_MAXB / 3)
-#define cJ1_LEAF4_MAXPOP1    (J_1_MAXB / 4)
-#define cJ1_LEAF5_MAXPOP1    (J_1_MAXB / 5)
-#define cJ1_LEAF6_MAXPOP1    (J_1_MAXB / 6)
-#define cJ1_LEAF7_MAXPOP1    (J_1_MAXB / 7)
-#define cJ1_LEAFW_MAXPOP1    ((J_1_MAXB - cJU_BYTESPERWORD) / cJU_BYTESPERWORD)
-
-#endif
-
-
-// MAXIMUM POPULATIONS OF IMMEDIATE JPs:
-//
-// These specify the maximum Population of immediate JPs with various Index
-// Sizes (== sizes of remaining undecoded Index bits).
-
-#define cJ1_IMMED1_MAXPOP1  ((sizeof(jp_t) - 1) / 1)    // 7 [15].
-#define cJ1_IMMED2_MAXPOP1  ((sizeof(jp_t) - 1) / 2)    // 3  [7].
-#define cJ1_IMMED3_MAXPOP1  ((sizeof(jp_t) - 1) / 3)    // 2  [5].
-
-#ifdef JU_64BIT
-#define cJ1_IMMED4_MAXPOP1  ((sizeof(jp_t) - 1) / 4)    //    [3].
-#define cJ1_IMMED5_MAXPOP1  ((sizeof(jp_t) - 1) / 5)    //    [3].
-#define cJ1_IMMED6_MAXPOP1  ((sizeof(jp_t) - 1) / 6)    //    [2].
-#define cJ1_IMMED7_MAXPOP1  ((sizeof(jp_t) - 1) / 7)    //    [2].
-#endif
-
-
-// ****************************************************************************
-// JUDY1 BITMAP LEAF (J1LB) SUPPORT
-// ****************************************************************************
-
-#define J1_JLB_BITMAP(Pjlb,Subexp)  ((Pjlb)->j1lb_Bitmap[Subexp])
-
-typedef struct J__UDY1_BITMAP_LEAF
-{
-        BITMAPL_t j1lb_Bitmap[cJU_NUMSUBEXPL];
-
-} j1lb_t, * Pj1lb_t;
-
-
-// ****************************************************************************
-// MEMORY ALLOCATION SUPPORT
-// ****************************************************************************
-
-// ARRAY-GLOBAL INFORMATION:
-//
-// At the cost of an occasional additional cache fill, this object, which is
-// pointed at by a JRP and in turn points to a JP_BRANCH*, carries array-global
-// information about a Judy1 array that has sufficient population to amortize
-// the cost.  The jpm_Pop0 field prevents having to add up the total population
-// for the array in insert, delete, and count code.  The jpm_JP field prevents
-// having to build a fake JP for entry to a state machine; however, the
-// jp_DcdPopO field in jpm_JP, being one byte too small, is not used.
-//
-// Note:  Struct fields are ordered to keep "hot" data in the first 8 words
-// (see left-margin comments) for machines with 8-word cache lines, and to keep
-// sub-word fields together for efficient packing.
-
-typedef struct J_UDY1_POPULATION_AND_MEMORY
-{
-/* 1 */ Word_t     jpm_Pop0;            // total population-1 in array.
-/* 2 */ jp_t       jpm_JP;              // JP to first branch; see above.
-/* 4 */ Word_t     jpm_LastUPop0;       // last jpm_Pop0 when convert to BranchU
-// Note:  Field names match PJError_t for convenience in macros:
-/* 7 */ char       je_Errno;            // one of the enums in Judy.h.
-/* 7/8 */ int      je_ErrID;            // often an internal source line number.
-/* 8/9 */ Word_t   jpm_TotalMemWords;   // words allocated in array.
-} j1pm_t, *Pj1pm_t;
-
-
-// TABLES FOR DETERMINING IF LEAVES HAVE ROOM TO GROW:
-//
-// These tables indicate if a given memory chunk can support growth of a given
-// object into wasted (rounded-up) memory in the chunk.  This violates the
-// hiddenness of the JudyMalloc code.
-//
-// Also define macros to hide the details in the code using these tables.
-
-#ifndef JU_64BIT
-extern const uint8_t j__1_Leaf1PopToWords[cJ1_LEAF1_MAXPOP1 + 1];
-#endif
-extern const uint8_t j__1_Leaf2PopToWords[cJ1_LEAF2_MAXPOP1 + 1];
-extern const uint8_t j__1_Leaf3PopToWords[cJ1_LEAF3_MAXPOP1 + 1];
-#ifdef JU_64BIT
-extern const uint8_t j__1_Leaf4PopToWords[cJ1_LEAF4_MAXPOP1 + 1];
-extern const uint8_t j__1_Leaf5PopToWords[cJ1_LEAF5_MAXPOP1 + 1];
-extern const uint8_t j__1_Leaf6PopToWords[cJ1_LEAF6_MAXPOP1 + 1];
-extern const uint8_t j__1_Leaf7PopToWords[cJ1_LEAF7_MAXPOP1 + 1];
-#endif
-extern const uint8_t j__1_LeafWPopToWords[cJ1_LEAFW_MAXPOP1 + 1];
-
-// Check if increase of population will fit in same leaf:
-
-#ifndef JU_64BIT
-#define J1_LEAF1GROWINPLACE(Pop1) \
-        J__U_GROWCK(Pop1, cJ1_LEAF1_MAXPOP1, j__1_Leaf1PopToWords)
-#endif
-#define J1_LEAF2GROWINPLACE(Pop1) \
-        J__U_GROWCK(Pop1, cJ1_LEAF2_MAXPOP1, j__1_Leaf2PopToWords)
-#define J1_LEAF3GROWINPLACE(Pop1) \
-        J__U_GROWCK(Pop1, cJ1_LEAF3_MAXPOP1, j__1_Leaf3PopToWords)
-#ifdef JU_64BIT
-#define J1_LEAF4GROWINPLACE(Pop1) \
-        J__U_GROWCK(Pop1, cJ1_LEAF4_MAXPOP1, j__1_Leaf4PopToWords)
-#define J1_LEAF5GROWINPLACE(Pop1) \
-        J__U_GROWCK(Pop1, cJ1_LEAF5_MAXPOP1, j__1_Leaf5PopToWords)
-#define J1_LEAF6GROWINPLACE(Pop1) \
-        J__U_GROWCK(Pop1, cJ1_LEAF6_MAXPOP1, j__1_Leaf6PopToWords)
-#define J1_LEAF7GROWINPLACE(Pop1) \
-        J__U_GROWCK(Pop1, cJ1_LEAF7_MAXPOP1, j__1_Leaf7PopToWords)
-#endif
-#define J1_LEAFWGROWINPLACE(Pop1) \
-        J__U_GROWCK(Pop1, cJ1_LEAFW_MAXPOP1, j__1_LeafWPopToWords)
-
-#ifndef JU_64BIT
-#define J1_LEAF1POPTOWORDS(Pop1)  (j__1_Leaf1PopToWords[Pop1])
-#endif
-#define J1_LEAF2POPTOWORDS(Pop1)  (j__1_Leaf2PopToWords[Pop1])
-#define J1_LEAF3POPTOWORDS(Pop1)  (j__1_Leaf3PopToWords[Pop1])
-#ifdef JU_64BIT
-#define J1_LEAF4POPTOWORDS(Pop1)  (j__1_Leaf4PopToWords[Pop1])
-#define J1_LEAF5POPTOWORDS(Pop1)  (j__1_Leaf5PopToWords[Pop1])
-#define J1_LEAF6POPTOWORDS(Pop1)  (j__1_Leaf6PopToWords[Pop1])
-#define J1_LEAF7POPTOWORDS(Pop1)  (j__1_Leaf7PopToWords[Pop1])
-#endif
-#define J1_LEAFWPOPTOWORDS(Pop1)  (j__1_LeafWPopToWords[Pop1])
-
-
-// FUNCTIONS TO ALLOCATE OBJECTS:
-
-Pj1pm_t j__udy1AllocJ1PM(void);                         // constant size.
-
-Pjbl_t  j__udy1AllocJBL(          Pj1pm_t);             // constant size.
-Pjbb_t  j__udy1AllocJBB(          Pj1pm_t);             // constant size.
-Pjp_t   j__udy1AllocJBBJP(Word_t, Pj1pm_t);
-Pjbu_t  j__udy1AllocJBU(          Pj1pm_t);             // constant size.
-
-#ifndef JU_64BIT
-Pjll_t  j__udy1AllocJLL1( Word_t, Pj1pm_t);
-#endif
-Pjll_t  j__udy1AllocJLL2( Word_t, Pj1pm_t);
-Pjll_t  j__udy1AllocJLL3( Word_t, Pj1pm_t);
-
-#ifdef JU_64BIT
-Pjll_t  j__udy1AllocJLL4( Word_t, Pj1pm_t);
-Pjll_t  j__udy1AllocJLL5( Word_t, Pj1pm_t);
-Pjll_t  j__udy1AllocJLL6( Word_t, Pj1pm_t);
-Pjll_t  j__udy1AllocJLL7( Word_t, Pj1pm_t);
-#endif
-
-Pjlw_t  j__udy1AllocJLW(  Word_t         );             // no Pj1pm needed.
-Pj1lb_t j__udy1AllocJLB1(         Pj1pm_t);             // constant size.
-
-
-// FUNCTIONS TO FREE OBJECTS:
-
-void    j__udy1FreeJ1PM( Pj1pm_t,        Pj1pm_t);      // constant size.
-
-void    j__udy1FreeJBL(  Pjbl_t,         Pj1pm_t);      // constant size.
-void    j__udy1FreeJBB(  Pjbb_t,         Pj1pm_t);      // constant size.
-void    j__udy1FreeJBBJP(Pjp_t,  Word_t, Pj1pm_t);
-void    j__udy1FreeJBU(  Pjbu_t,         Pj1pm_t);      // constant size.
-
-#ifndef JU_64BIT
-void    j__udy1FreeJLL1( Pjll_t, Word_t, Pj1pm_t);
-#endif
-void    j__udy1FreeJLL2( Pjll_t, Word_t, Pj1pm_t);
-void    j__udy1FreeJLL3( Pjll_t, Word_t, Pj1pm_t);
-
-#ifdef JU_64BIT
-void    j__udy1FreeJLL4( Pjll_t, Word_t, Pj1pm_t);
-void    j__udy1FreeJLL5( Pjll_t, Word_t, Pj1pm_t);
-void    j__udy1FreeJLL6( Pjll_t, Word_t, Pj1pm_t);
-void    j__udy1FreeJLL7( Pjll_t, Word_t, Pj1pm_t);
-#endif
-
-void    j__udy1FreeJLW(  Pjlw_t, Word_t, Pj1pm_t);
-void    j__udy1FreeJLB1( Pj1lb_t,        Pj1pm_t);      // constant size.
-void    j__udy1FreeSM(   Pjp_t,          Pj1pm_t);      // everything below Pjp.
-
-#endif // ! _JUDY1_INCLUDED
diff --git a/libs/klib/judy/JudyByCount.c b/libs/klib/judy/JudyByCount.c
deleted file mode 100644
index f6efea0..0000000
--- a/libs/klib/judy/JudyByCount.c
+++ /dev/null
@@ -1,952 +0,0 @@
-// Copyright (C) 2000 - 2002 Hewlett-Packard Company
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the term of the GNU Lesser 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 Lesser General Public License
-// for more details.
-//
-// You should have received a copy of the GNU Lesser 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
-// _________________
-
-// Judy*ByCount() function for Judy1 and JudyL.
-// Compile with one of -DJUDY1 or -DJUDYL.
-//
-// Compile with -DNOSMARTJBB, -DNOSMARTJBU, and/or -DNOSMARTJLB to build a
-// version with cache line optimizations deleted, for testing.
-//
-// Judy*ByCount() is a conceptual although not literal inverse of Judy*Count().
-// Judy*Count() takes a pair of Indexes, and allows finding the ordinal of a
-// given Index (that is, its position in the list of valid indexes from the
-// beginning) as a degenerate case, because in general the count between two
-// Indexes, inclusive, is not always just the difference in their ordinals.
-// However, it suffices for Judy*ByCount() to simply be an ordinal-to-Index
-// mapper.
-//
-// Note:  Like Judy*Count(), this code must "count sideways" in branches, which
-// can result in a lot of cache line fills.  However, unlike Judy*Count(), this
-// code does not receive a specific Index, hence digit, where to start in each
-// branch, so it cant accurately calculate cache line fills required in each
-// direction.  The best it can do is an approximation based on the total
-// population of the expanse (pop1 from Pjp) and the ordinal of the target
-// Index (see SETOFFSET()) within the expanse.
-//
-// Compile with -DSMARTMETRICS to obtain global variables containing smart
-// cache line metrics.  Note:  Dont turn this on simultaneously for this file
-// and JudyCount.c because they export the same globals.
-// ****************************************************************************
-
-#if (! (defined(JUDY1) || defined(JUDYL)))
-#error:  One of -DJUDY1 or -DJUDYL must be specified.
-#endif
-
-#ifdef JUDY1
-#include "Judy1.h"
-#else
-#include "JudyL.h"
-#endif
-
-#include "JudyPrivate1L.h"
-
-// These are imported from JudyCount.c:
-//
-// TBD:  Should this be in common code?  Exported from a header file?
-
-#ifdef JUDY1
-extern	Word_t j__udy1JPPop1(const Pjp_t Pjp);
-#define	j__udyJPPop1 j__udy1JPPop1
-#else
-extern	Word_t j__udyLJPPop1(const Pjp_t Pjp);
-#define	j__udyJPPop1 j__udyLJPPop1
-#endif
-
-// Avoid duplicate symbols since this file is multi-compiled:
-
-#ifdef SMARTMETRICS
-#ifdef JUDY1
-Word_t	jbb_upward   = 0;	// counts of directions taken:
-Word_t	jbb_downward = 0;
-Word_t	jbu_upward   = 0;
-Word_t	jbu_downward = 0;
-Word_t	jlb_upward   = 0;
-Word_t	jlb_downward = 0;
-#else
-extern Word_t jbb_upward;
-extern Word_t jbb_downward;
-extern Word_t jbu_upward;
-extern Word_t jbu_downward;
-extern Word_t jlb_upward;
-extern Word_t jlb_downward;
-#endif
-#endif
-
-
-// ****************************************************************************
-// J U D Y   1   B Y   C O U N T
-// J U D Y   L   B Y   C O U N T
-//
-// See the manual entry.
-
-#ifdef JUDY1
-FUNCTION int Judy1ByCount
-#else
-FUNCTION PPvoid_t JudyLByCount
-#endif
-        (
-	Pcvoid_t  PArray,	// root pointer to first branch/leaf in SM.
-	Word_t	  Count,	// ordinal of Index to find, 1..MAX.
-	Word_t *  PIndex,	// to return found Index.
-	PJError_t PJError	// optional, for returning error info.
-        )
-{
-	Word_t	  Count0;	// Count, base-0, to match pop0.
-	Word_t	  state;	// current state in SM.
-	Word_t	  pop1;		// of current branch or leaf, or of expanse.
-	Word_t	  pop1lower;	// pop1 of expanses (JPs) below that for Count.
-	Word_t	  digit;	// current word in branch.
-	Word_t	  jpcount;	// JPs in a BranchB subexpanse.
-	long	  jpnum;	// JP number in a branch (base 0).
-	long	  subexp;	// for stepping through layer 1 (subexpanses).
-	int	  offset;	// index ordinal within a leaf, base 0.
-
-	Pjp_t	  Pjp;		// current JP in branch.
-	Pjll_t	  Pjll;		// current Judy linear leaf.
-
-
-// CHECK FOR EMPTY ARRAY OR NULL PINDEX:
-
-	if (PArray == (Pvoid_t) NULL) JU_RET_NOTFOUND;
-
-	if (PIndex == (PWord_t) NULL)
-	{
-	    JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX);
-	    JUDY1CODE(return(JERRI );)
-	    JUDYLCODE(return(PPJERR);)
-	}
-
-// Convert Count to Count0; assume special case of Count = 0 maps to ~0, as
-// desired, to represent the last index in a full array:
-//
-// Note:  Think of Count0 as a reliable "number of Indexes below the target."
-
-	Count0 = Count - 1;
-	assert((Count || Count0 == ~0));  // ensure CPU is sane about 0 - 1.
-	pop1lower = 0;
-
-	if (JU_LEAFW_POP0(PArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW
-	{
-	    Pjlw_t Pjlw = P_JLW(PArray);		// first word of leaf.
-
-	    if (Count0 > Pjlw[0]) JU_RET_NOTFOUND;	// too high.
-
-	    *PIndex = Pjlw[Count];			// Index, base 1.
-
-	    JU_RET_FOUND_LEAFW(Pjlw, Pjlw[0] + 1, Count0);
-	}
-	else
-	{
-	    Pjpm_t Pjpm = P_JPM(PArray);
-
-	    if (Count0 > (Pjpm->jpm_Pop0)) JU_RET_NOTFOUND;	// too high.
-
-	    Pjp  = &(Pjpm->jpm_JP);
-	    pop1 =  (Pjpm->jpm_Pop0) + 1;
-
-//	    goto SMByCount;
-	}
-
-// COMMON CODE:
-//
-// Prepare to handle a root-level or lower-level branch:  Save the current
-// state, obtain the total population for the branch in a state-dependent way,
-// and then branch to common code for multiple cases.
-//
-// For root-level branches, the state is always cJU_ROOTSTATE, and the array
-// population must already be set in pop1; it is not available in jp_DcdPopO.
-//
-// Note:  The total population is only needed in cases where the common code
-// "counts down" instead of up to minimize cache line fills.  However, its
-// available cheaply, and its better to do it with a constant shift (constant
-// state value) instead of a variable shift later "when needed".
-
-#define	PREPB_ROOT(Next)	\
-	state = cJU_ROOTSTATE;	\
-	goto Next
-
-// Use PREPB_DCD() to first copy the Dcd bytes to *PIndex if there are any
-// (only if state < cJU_ROOTSTATE - 1):
-
-#define	PREPB_DCD(Pjp,cState,Next)			\
-	JU_SETDCD(*PIndex, Pjp, cState);	        \
-	PREPB((Pjp), cState, Next)
-
-#define	PREPB(Pjp,cState,Next)	\
-	state = (cState);	\
-	pop1  = JU_JPBRANCH_POP0(Pjp, (cState)) + 1; \
-	goto Next
-
-// Calculate whether the ordinal of an Index within a given expanse falls in
-// the lower or upper half of the expanses population, taking care with
-// unsigned math and boundary conditions:
-//
-// Note:  Assume the ordinal falls within the expanses population, that is,
-// 0 < (Count - Pop1lower) <= Pop1exp (assuming infinite math).
-//
-// Note:  If the ordinal is the middle element, it doesnt matter whether
-// LOWERHALF() is TRUE or FALSE.
-
-#define	LOWERHALF(Count0,Pop1lower,Pop1exp) \
-	(((Count0) - (Pop1lower)) < ((Pop1exp) / 2))
-
-// Calculate the (signed) offset within a leaf to the desired ordinal (Count -
-// Pop1lower; offset is one less), and optionally ensure its in range:
-
-#define	SETOFFSET(Offset,Count0,Pop1lower,Pjp)	\
-	(Offset) = (Count0) - (Pop1lower);	\
-	assert((Offset) >= 0);			\
-	assert((Offset) <= JU_JPLEAF_POP0(Pjp))
-
-// Variations for immediate indexes, with and without pop1-specific assertions:
-
-#define	SETOFFSET_IMM_CK(Offset,Count0,Pop1lower,cPop1)	\
-	(Offset) = (Count0) - (Pop1lower);		\
-	assert((Offset) >= 0);				\
-	assert((Offset) <  (cPop1))
-
-#define	SETOFFSET_IMM(Offset,Count0,Pop1lower) \
-	(Offset) = (Count0) - (Pop1lower)
-
-
-// STATE MACHINE -- TRAVERSE TREE:
-//
-// In branches, look for the expanse (digit), if any, where the total pop1
-// below or at that expanse would meet or exceed Count, meaning the Index must
-// be in this expanse.
-
-SMByCount:			// return here for next branch/leaf.
-
-	switch (JU_JPTYPE(Pjp))
-	{
-
-
-// ----------------------------------------------------------------------------
-// LINEAR BRANCH; count populations in JPs in the JBL upwards until finding the
-// expanse (digit) containing Count, and "recurse".
-//
-// Note:  There are no null JPs in a JBL; watch out for pop1 == 0.
-//
-// Note:  A JBL should always fit in one cache line => no need to count up
-// versus down to save cache line fills.
-//
-// TBD:  The previous is no longer true.  Consider enhancing this code to count
-// up/down, but it can wait for a later tuning phase.  In the meantime, PREPB()
-// sets pop1 for the whole array, but that value is not used here.  001215:
-// Maybe its true again?
-
-	case cJU_JPBRANCH_L2:  PREPB_DCD(Pjp, 2, BranchL);
-#ifndef JU_64BIT
-	case cJU_JPBRANCH_L3:  PREPB(	 Pjp, 3, BranchL);
-#else
-	case cJU_JPBRANCH_L3:  PREPB_DCD(Pjp, 3, BranchL);
-	case cJU_JPBRANCH_L4:  PREPB_DCD(Pjp, 4, BranchL);
-	case cJU_JPBRANCH_L5:  PREPB_DCD(Pjp, 5, BranchL);
-	case cJU_JPBRANCH_L6:  PREPB_DCD(Pjp, 6, BranchL);
-	case cJU_JPBRANCH_L7:  PREPB(	 Pjp, 7, BranchL);
-#endif
-	case cJU_JPBRANCH_L:   PREPB_ROOT(	 BranchL);
-	{
-	    Pjbl_t Pjbl;
-
-// Common code (state-independent) for all cases of linear branches:
-
-BranchL:
-	    Pjbl = P_JBL(Pjp->jp_Addr);
-
-	    for (jpnum = 0; jpnum < (Pjbl->jbl_NumJPs); ++jpnum)
-	    {
-	        if ((pop1 = j__udyJPPop1((Pjbl->jbl_jp) + jpnum))
-		 == cJU_ALLONES)
-	        {
-		    JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
-		    JUDY1CODE(return(JERRI );)
-		    JUDYLCODE(return(PPJERR);)
-	        }
-	        assert(pop1 != 0);
-
-// Warning:  pop1lower and pop1 are unsigned, so do not subtract 1 and compare
-// >=, but instead use the following expression:
-
-	        if (pop1lower + pop1 > Count0)	 // Index is in this expanse.
-	        {
-		    JU_SETDIGIT(*PIndex, Pjbl->jbl_Expanse[jpnum], state);
-		    Pjp = (Pjbl->jbl_jp) + jpnum;
-		    goto SMByCount;			// look under this expanse.
-	        }
-
-	        pop1lower += pop1;			// add this JPs pop1.
-	    }
-
-	    JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);  // should never get here.
-	    JUDY1CODE(return(JERRI );)
-	    JUDYLCODE(return(PPJERR);)
-
-	} // case cJU_JPBRANCH_L
-
-
-// ----------------------------------------------------------------------------
-// BITMAP BRANCH; count populations in JPs in the JBB upwards or downwards
-// until finding the expanse (digit) containing Count, and "recurse".
-//
-// Note:  There are no null JPs in a JBB; watch out for pop1 == 0.
-
-	case cJU_JPBRANCH_B2:  PREPB_DCD(Pjp, 2, BranchB);
-#ifndef JU_64BIT
-	case cJU_JPBRANCH_B3:  PREPB(	 Pjp, 3, BranchB);
-#else
-	case cJU_JPBRANCH_B3:  PREPB_DCD(Pjp, 3, BranchB);
-	case cJU_JPBRANCH_B4:  PREPB_DCD(Pjp, 4, BranchB);
-	case cJU_JPBRANCH_B5:  PREPB_DCD(Pjp, 5, BranchB);
-	case cJU_JPBRANCH_B6:  PREPB_DCD(Pjp, 6, BranchB);
-	case cJU_JPBRANCH_B7:  PREPB(	 Pjp, 7, BranchB);
-#endif
-	case cJU_JPBRANCH_B:   PREPB_ROOT(	 BranchB);
-	{
-	    Pjbb_t Pjbb;
-
-// Common code (state-independent) for all cases of bitmap branches:
-
-BranchB:
-	    Pjbb = P_JBB(Pjp->jp_Addr);
-
-// Shorthand for one subexpanse in a bitmap and for one JP in a bitmap branch:
-//
-// Note: BMPJP0 exists separately to support assertions.
-
-#define	BMPJP0(Subexp)	     (P_JP(JU_JBB_PJP(Pjbb, Subexp)))
-#define	BMPJP(Subexp,JPnum)  (BMPJP0(Subexp) + (JPnum))
-
-
-// Common code for descending through a JP:
-//
-// Determine the digit for the expanse and save it in *PIndex; then "recurse".
-
-#define	JBB_FOUNDEXPANSE			\
-	{					\
-	    JU_BITMAPDIGITB(digit, subexp, JU_JBB_BITMAP(Pjbb,subexp), jpnum); \
-	    JU_SETDIGIT(*PIndex, digit, state);	\
-	    Pjp = BMPJP(subexp, jpnum);		\
-	    goto SMByCount;			\
-	}
-
-
-#ifndef NOSMARTJBB  // enable to turn off smart code for comparison purposes.
-
-// FIGURE OUT WHICH DIRECTION CAUSES FEWER CACHE LINE FILLS; adding the pop1s
-// in JPs upwards, or subtracting the pop1s in JPs downwards:
-//
-// See header comments about limitations of this for Judy*ByCount().
-
-#endif
-
-// COUNT UPWARD, adding each "below" JPs pop1:
-
-#ifndef NOSMARTJBB  // enable to turn off smart code for comparison purposes.
-
-	    if (LOWERHALF(Count0, pop1lower, pop1))
-	    {
-#endif
-#ifdef SMARTMETRICS
-		++jbb_upward;
-#endif
-		for (subexp = 0; subexp < cJU_NUMSUBEXPB; ++subexp)
-		{
-		    if ((jpcount = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb,subexp)))
-		     && (BMPJP0(subexp) == (Pjp_t) NULL))
-		    {
-			JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);  // null ptr.
-			JUDY1CODE(return(JERRI );)
-			JUDYLCODE(return(PPJERR);)
-		    }
-
-// Note:  An empty subexpanse (jpcount == 0) is handled "for free":
-
-		    for (jpnum = 0; jpnum < jpcount; ++jpnum)
-		    {
-			if ((pop1 = j__udyJPPop1(BMPJP(subexp, jpnum)))
-			  == cJU_ALLONES)
-			{
-			    JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
-			    JUDY1CODE(return(JERRI );)
-			    JUDYLCODE(return(PPJERR);)
-			}
-			assert(pop1 != 0);
-
-// Warning:  pop1lower and pop1 are unsigned, see earlier comment:
-
-			if (pop1lower + pop1 > Count0)
-			    JBB_FOUNDEXPANSE;	// Index is in this expanse.
-
-			pop1lower += pop1;	// add this JPs pop1.
-		    }
-		}
-#ifndef NOSMARTJBB  // enable to turn off smart code for comparison purposes.
-	    }
-
-
-// COUNT DOWNWARD, subtracting each "above" JPs pop1 from the whole expanses
-// pop1:
-
-	    else
-	    {
-#ifdef SMARTMETRICS
-		++jbb_downward;
-#endif
-		pop1lower += pop1;		// add whole branch to start.
-
-		for (subexp = cJU_NUMSUBEXPB - 1; subexp >= 0; --subexp)
-		{
-		    if ((jpcount = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, subexp)))
-		     && (BMPJP0(subexp) == (Pjp_t) NULL))
-		    {
-			JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);  // null ptr.
-			JUDY1CODE(return(JERRI );)
-			JUDYLCODE(return(PPJERR);)
-		    }
-
-// Note:  An empty subexpanse (jpcount == 0) is handled "for free":
-
-		    for (jpnum = jpcount - 1; jpnum >= 0; --jpnum)
-		    {
-			if ((pop1 = j__udyJPPop1(BMPJP(subexp, jpnum)))
-			  == cJU_ALLONES)
-			{
-			    JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
-			    JUDY1CODE(return(JERRI );)
-			    JUDYLCODE(return(PPJERR);)
-			}
-			assert(pop1 != 0);
-
-// Warning:  pop1lower and pop1 are unsigned, see earlier comment:
-
-			pop1lower -= pop1;
-
-// Beware unsigned math problems:
-
-			if ((pop1lower == 0) || (pop1lower - 1 < Count0))
-			    JBB_FOUNDEXPANSE;	// Index is in this expanse.
-		    }
-		}
-	    }
-#endif // NOSMARTJBB
-
-	    JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);  // should never get here.
-	    JUDY1CODE(return(JERRI );)
-	    JUDYLCODE(return(PPJERR);)
-
-	} // case cJU_JPBRANCH_B
-
-
-// ----------------------------------------------------------------------------
-// UNCOMPRESSED BRANCH; count populations in JPs in the JBU upwards or
-// downwards until finding the expanse (digit) containing Count, and "recurse".
-
-	case cJU_JPBRANCH_U2:  PREPB_DCD(Pjp, 2, BranchU);
-#ifndef JU_64BIT
-	case cJU_JPBRANCH_U3:  PREPB(	 Pjp, 3, BranchU);
-#else
-	case cJU_JPBRANCH_U3:  PREPB_DCD(Pjp, 3, BranchU);
-	case cJU_JPBRANCH_U4:  PREPB_DCD(Pjp, 4, BranchU);
-	case cJU_JPBRANCH_U5:  PREPB_DCD(Pjp, 5, BranchU);
-	case cJU_JPBRANCH_U6:  PREPB_DCD(Pjp, 6, BranchU);
-	case cJU_JPBRANCH_U7:  PREPB(	 Pjp, 7, BranchU);
-#endif
-	case cJU_JPBRANCH_U:   PREPB_ROOT(	 BranchU);
-	{
-	    Pjbu_t Pjbu;
-
-// Common code (state-independent) for all cases of uncompressed branches:
-
-BranchU:
-	    Pjbu = P_JBU(Pjp->jp_Addr);
-
-// Common code for descending through a JP:
-//
-// Save the digit for the expanse in *PIndex, then "recurse".
-
-#define	JBU_FOUNDEXPANSE			\
-	{					\
-	    JU_SETDIGIT(*PIndex, jpnum, state);	\
-	    Pjp = (Pjbu->jbu_jp) + jpnum;	\
-	    goto SMByCount;			\
-	}
-
-
-#ifndef NOSMARTJBU  // enable to turn off smart code for comparison purposes.
-
-// FIGURE OUT WHICH DIRECTION CAUSES FEWER CACHE LINE FILLS; adding the pop1s
-// in JPs upwards, or subtracting the pop1s in JPs downwards:
-//
-// See header comments about limitations of this for Judy*ByCount().
-
-#endif
-
-// COUNT UPWARD, simply adding the pop1 of each JP:
-
-#ifndef NOSMARTJBU  // enable to turn off smart code for comparison purposes.
-
-	    if (LOWERHALF(Count0, pop1lower, pop1))
-	    {
-#endif
-#ifdef SMARTMETRICS
-		++jbu_upward;
-#endif
-
-		for (jpnum = 0; jpnum < cJU_BRANCHUNUMJPS; ++jpnum)
-		{
-		    // shortcut, save a function call:
-
-		    if ((Pjbu->jbu_jp[jpnum].jp_Type) <= cJU_JPNULLMAX)
-			continue;
-
-		    if ((pop1 = j__udyJPPop1((Pjbu->jbu_jp) + jpnum))
-		     == cJU_ALLONES)
-		    {
-			JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
-			JUDY1CODE(return(JERRI );)
-			JUDYLCODE(return(PPJERR);)
-		    }
-		    assert(pop1 != 0);
-
-// Warning:  pop1lower and pop1 are unsigned, see earlier comment:
-
-		    if (pop1lower + pop1 > Count0)
-			JBU_FOUNDEXPANSE;	// Index is in this expanse.
-
-		    pop1lower += pop1;		// add this JPs pop1.
-		}
-#ifndef NOSMARTJBU  // enable to turn off smart code for comparison purposes.
-	    }
-
-
-// COUNT DOWNWARD, subtracting the pop1 of each JP above from the whole
-// expanses pop1:
-
-	    else
-	    {
-#ifdef SMARTMETRICS
-		++jbu_downward;
-#endif
-		pop1lower += pop1;		// add whole branch to start.
-
-		for (jpnum = cJU_BRANCHUNUMJPS - 1; jpnum >= 0; --jpnum)
-		{
-		    // shortcut, save a function call:
-
-		    if ((Pjbu->jbu_jp[jpnum].jp_Type) <= cJU_JPNULLMAX)
-			continue;
-
-		    if ((pop1 = j__udyJPPop1(Pjbu->jbu_jp + jpnum))
-		     == cJU_ALLONES)
-		    {
-			JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
-			JUDY1CODE(return(JERRI );)
-			JUDYLCODE(return(PPJERR);)
-		    }
-		    assert(pop1 != 0);
-
-// Warning:  pop1lower and pop1 are unsigned, see earlier comment:
-
-		    pop1lower -= pop1;
-
-// Beware unsigned math problems:
-
-		    if ((pop1lower == 0) || (pop1lower - 1 < Count0))
-			JBU_FOUNDEXPANSE;	// Index is in this expanse.
-		}
-	    }
-#endif // NOSMARTJBU
-
-	    JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);  // should never get here.
-	    JUDY1CODE(return(JERRI );)
-	    JUDYLCODE(return(PPJERR);)
-
-	} // case cJU_JPBRANCH_U
-
-// ----------------------------------------------------------------------------
-// LINEAR LEAF:
-//
-// Return the Index at the proper ordinal (see SETOFFSET()) in the leaf.  First
-// copy Dcd bytes, if there are any (only if state < cJU_ROOTSTATE - 1), to
-// *PIndex.
-//
-// Note:  The preceding branch traversal code MIGHT set pop1 for this expanse
-// (linear leaf) as a side-effect, but dont depend on that (for JUDYL, which
-// is the only cases that need it anyway).
-
-#define	PREPL_DCD(cState)				\
-	JU_SETDCD(*PIndex, Pjp, cState);	        \
-	PREPL
-
-#ifdef JUDY1
-#define	PREPL_SETPOP1			// not needed in any cases.
-#else
-#define	PREPL_SETPOP1  pop1 = JU_JPLEAF_POP0(Pjp) + 1
-#endif
-
-#define	PREPL				\
-	Pjll = P_JLL(Pjp->jp_Addr);	\
-	PREPL_SETPOP1;			\
-	SETOFFSET(offset, Count0, pop1lower, Pjp)
-
-#if (defined(JUDYL) || (! defined(JU_64BIT)))
-	case cJU_JPLEAF1:
-
-	    PREPL_DCD(1);
-	    JU_SETDIGIT1(*PIndex, ((uint8_t *) Pjll)[offset]);
-	    JU_RET_FOUND_LEAF1(Pjll, pop1, offset);
-#endif
-
-	case cJU_JPLEAF2:
-
-	    PREPL_DCD(2);
-	    *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(2)))
-		    | ((uint16_t *) Pjll)[offset];
-	    JU_RET_FOUND_LEAF2(Pjll, pop1, offset);
-
-#ifndef JU_64BIT
-	case cJU_JPLEAF3:
-	{
-	    Word_t lsb;
-	    PREPL;
-	    JU_COPY3_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (3 * offset));
-	    *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(3))) | lsb;
-	    JU_RET_FOUND_LEAF3(Pjll, pop1, offset);
-	}
-
-#else
-	case cJU_JPLEAF3:
-	{
-	    Word_t lsb;
-	    PREPL_DCD(3);
-	    JU_COPY3_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (3 * offset));
-	    *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(3))) | lsb;
-	    JU_RET_FOUND_LEAF3(Pjll, pop1, offset);
-	}
-
-	case cJU_JPLEAF4:
-
-	    PREPL_DCD(4);
-	    *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(4)))
-		    | ((uint32_t *) Pjll)[offset];
-	    JU_RET_FOUND_LEAF4(Pjll, pop1, offset);
-
-	case cJU_JPLEAF5:
-	{
-	    Word_t lsb;
-	    PREPL_DCD(5);
-	    JU_COPY5_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (5 * offset));
-	    *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(5))) | lsb;
-	    JU_RET_FOUND_LEAF5(Pjll, pop1, offset);
-	}
-
-	case cJU_JPLEAF6:
-	{
-	    Word_t lsb;
-	    PREPL_DCD(6);
-	    JU_COPY6_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (6 * offset));
-	    *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(6))) | lsb;
-	    JU_RET_FOUND_LEAF6(Pjll, pop1, offset);
-	}
-
-	case cJU_JPLEAF7:
-	{
-	    Word_t lsb;
-	    PREPL;
-	    JU_COPY7_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (7 * offset));
-	    *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(7))) | lsb;
-	    JU_RET_FOUND_LEAF7(Pjll, pop1, offset);
-	}
-#endif
-
-
-// ----------------------------------------------------------------------------
-// BITMAP LEAF:
-//
-// Return the Index at the proper ordinal (see SETOFFSET()) in the leaf by
-// counting bits.  First copy Dcd bytes (always present since state 1 <
-// cJU_ROOTSTATE) to *PIndex.
-//
-// Note:  The preceding branch traversal code MIGHT set pop1 for this expanse
-// (bitmap leaf) as a side-effect, but dont depend on that.
-
-	case cJU_JPLEAF_B1:
-	{
-	    Pjlb_t Pjlb;
-
-	    JU_SETDCD(*PIndex, Pjp, 1);
-	    Pjlb = P_JLB(Pjp->jp_Addr);
-	    pop1 = JU_JPLEAF_POP0(Pjp) + 1;
-
-// COUNT UPWARD, adding the pop1 of each subexpanse:
-//
-// The entire bitmap should fit in one cache line, but still try to save some
-// CPU time by counting the fewest possible number of subexpanses from the
-// bitmap.
-//
-// See header comments about limitations of this for Judy*ByCount().
-
-#ifndef NOSMARTJLB  // enable to turn off smart code for comparison purposes.
-
-	    if (LOWERHALF(Count0, pop1lower, pop1))
-	    {
-#endif
-#ifdef SMARTMETRICS
-		++jlb_upward;
-#endif
-		for (subexp = 0; subexp < cJU_NUMSUBEXPL; ++subexp)
-		{
-		    pop1 = j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, subexp));
-
-// Warning:  pop1lower and pop1 are unsigned, see earlier comment:
-
-		    if (pop1lower + pop1 > Count0)
-			goto LeafB1;		// Index is in this subexpanse.
-
-		    pop1lower += pop1;		// add this subexpanses pop1.
-		}
-#ifndef NOSMARTJLB  // enable to turn off smart code for comparison purposes.
-	    }
-
-
-// COUNT DOWNWARD, subtracting each "above" subexpanses pop1 from the whole
-// expanses pop1:
-
-	    else
-	    {
-#ifdef SMARTMETRICS
-		++jlb_downward;
-#endif
-		pop1lower += pop1;		// add whole leaf to start.
-
-		for (subexp = cJU_NUMSUBEXPL - 1; subexp >= 0; --subexp)
-		{
-		    pop1lower -= j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, subexp));
-
-// Beware unsigned math problems:
-
-		    if ((pop1lower == 0) || (pop1lower - 1 < Count0))
-			goto LeafB1;		// Index is in this subexpanse.
-		}
-	    }
-#endif // NOSMARTJLB
-
-	    JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);  // should never get here.
-	    JUDY1CODE(return(JERRI );)
-	    JUDYLCODE(return(PPJERR);)
-
-
-// RETURN INDEX FOUND:
-//
-// Come here with subexp set to the correct subexpanse, and pop1lower set to
-// the sum for all lower expanses and subexpanses in the Judy tree.  Calculate
-// and save in *PIndex the digit corresponding to the ordinal in this
-// subexpanse.
-
-LeafB1:
-	    SETOFFSET(offset, Count0, pop1lower, Pjp);
-	    JU_BITMAPDIGITL(digit, subexp, JU_JLB_BITMAP(Pjlb, subexp), offset);
-	    JU_SETDIGIT1(*PIndex, digit);
-	    JU_RET_FOUND_LEAF_B1(Pjlb, subexp, offset);
-//	    == return((PPvoid_t) (P_JV(JL_JLB_PVALUE(Pjlb, subexp)) + offset))
-
-	} // case cJU_JPLEAF_B1
-
-
-#ifdef JUDY1
-// ----------------------------------------------------------------------------
-// FULL POPULATION:
-//
-// Copy Dcd bytes (always present since state 1 < cJU_ROOTSTATE) to *PIndex,
-// then set the appropriate digit for the ordinal (see SETOFFSET()) in the leaf
-// as the LSB in *PIndex.
-
-	case cJ1_JPFULLPOPU1:
-
-	    JU_SETDCD(*PIndex, Pjp, 1);
-	    SETOFFSET(offset, Count0, pop1lower, Pjp);
-	    assert(offset >= 0);
-	    assert(offset <= cJU_JPFULLPOPU1_POP0);
-	    JU_SETDIGIT1(*PIndex, offset);
-	    JU_RET_FOUND_FULLPOPU1;
-#endif
-
-
-// ----------------------------------------------------------------------------
-// IMMEDIATE:
-//
-// Locate the Index with the proper ordinal (see SETOFFSET()) in the Immediate,
-// depending on leaf Index Size and pop1.  Note:  There are no Dcd bytes in an
-// Immediate JP, but in a cJU_JPIMMED_*_01 JP, the field holds the least bytes
-// of the immediate Index.
-
-#define	SET_01(cState)  JU_SETDIGITS(*PIndex, JU_JPDCDPOP0(Pjp), cState)
-
-	case cJU_JPIMMED_1_01: SET_01(1); goto Imm_01;
-	case cJU_JPIMMED_2_01: SET_01(2); goto Imm_01;
-	case cJU_JPIMMED_3_01: SET_01(3); goto Imm_01;
-#ifdef JU_64BIT
-	case cJU_JPIMMED_4_01: SET_01(4); goto Imm_01;
-	case cJU_JPIMMED_5_01: SET_01(5); goto Imm_01;
-	case cJU_JPIMMED_6_01: SET_01(6); goto Imm_01;
-	case cJU_JPIMMED_7_01: SET_01(7); goto Imm_01;
-#endif
-
-Imm_01:
-
-	    DBGCODE(SETOFFSET_IMM_CK(offset, Count0, pop1lower, 1);)
-	    JU_RET_FOUND_IMM_01(Pjp);
-
-// Shorthand for where to find start of Index bytes array:
-
-#ifdef JUDY1
-#define	PJI (Pjp->jp_1Index)
-#else
-#define	PJI (Pjp->jp_LIndex)
-#endif
-
-// Optional code to check the remaining ordinal (see SETOFFSET_IMM()) against
-// the Index Size of the Immediate:
-
-#ifndef DEBUG				// simple placeholder:
-#define	IMM(cPop1,Next) \
-	goto Next
-#else					// extra pop1-specific checking:
-#define	IMM(cPop1,Next)						\
-	SETOFFSET_IMM_CK(offset, Count0, pop1lower, cPop1);	\
-	goto Next
-#endif
-
-	case cJU_JPIMMED_1_02: IMM( 2, Imm1);
-	case cJU_JPIMMED_1_03: IMM( 3, Imm1);
-#if (defined(JUDY1) || defined(JU_64BIT))
-	case cJU_JPIMMED_1_04: IMM( 4, Imm1);
-	case cJU_JPIMMED_1_05: IMM( 5, Imm1);
-	case cJU_JPIMMED_1_06: IMM( 6, Imm1);
-	case cJU_JPIMMED_1_07: IMM( 7, Imm1);
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-	case cJ1_JPIMMED_1_08: IMM( 8, Imm1);
-	case cJ1_JPIMMED_1_09: IMM( 9, Imm1);
-	case cJ1_JPIMMED_1_10: IMM(10, Imm1);
-	case cJ1_JPIMMED_1_11: IMM(11, Imm1);
-	case cJ1_JPIMMED_1_12: IMM(12, Imm1);
-	case cJ1_JPIMMED_1_13: IMM(13, Imm1);
-	case cJ1_JPIMMED_1_14: IMM(14, Imm1);
-	case cJ1_JPIMMED_1_15: IMM(15, Imm1);
-#endif
-
-Imm1:	    SETOFFSET_IMM(offset, Count0, pop1lower);
-	    JU_SETDIGIT1(*PIndex, ((uint8_t *) PJI)[offset]);
-	    JU_RET_FOUND_IMM(Pjp, offset);
-
-#if (defined(JUDY1) || defined(JU_64BIT))
-	case cJU_JPIMMED_2_02: IMM(2, Imm2);
-	case cJU_JPIMMED_2_03: IMM(3, Imm2);
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-	case cJ1_JPIMMED_2_04: IMM(4, Imm2);
-	case cJ1_JPIMMED_2_05: IMM(5, Imm2);
-	case cJ1_JPIMMED_2_06: IMM(6, Imm2);
-	case cJ1_JPIMMED_2_07: IMM(7, Imm2);
-#endif
-
-#if (defined(JUDY1) || defined(JU_64BIT))
-Imm2:	    SETOFFSET_IMM(offset, Count0, pop1lower);
-	    *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(2)))
-		    | ((uint16_t *) PJI)[offset];
-	    JU_RET_FOUND_IMM(Pjp, offset);
-#endif
-
-#if (defined(JUDY1) || defined(JU_64BIT))
-	case cJU_JPIMMED_3_02: IMM(2, Imm3);
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-	case cJ1_JPIMMED_3_03: IMM(3, Imm3);
-	case cJ1_JPIMMED_3_04: IMM(4, Imm3);
-	case cJ1_JPIMMED_3_05: IMM(5, Imm3);
-#endif
-
-#if (defined(JUDY1) || defined(JU_64BIT))
-Imm3:
-	{
-	    Word_t lsb;
-	    SETOFFSET_IMM(offset, Count0, pop1lower);
-	    JU_COPY3_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (3 * offset));
-	    *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(3))) | lsb;
-	    JU_RET_FOUND_IMM(Pjp, offset);
-	}
-#endif
-
-#if (defined(JUDY1) && defined(JU_64BIT))
-	case cJ1_JPIMMED_4_02: IMM(2, Imm4);
-	case cJ1_JPIMMED_4_03: IMM(3, Imm4);
-
-Imm4:	    SETOFFSET_IMM(offset, Count0, pop1lower);
-	    *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(4)))
-		    | ((uint32_t *) PJI)[offset];
-	    JU_RET_FOUND_IMM(Pjp, offset);
-
-	case cJ1_JPIMMED_5_02: IMM(2, Imm5);
-	case cJ1_JPIMMED_5_03: IMM(3, Imm5);
-
-Imm5:
-	{
-	    Word_t lsb;
-	    SETOFFSET_IMM(offset, Count0, pop1lower);
-	    JU_COPY5_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (5 * offset));
-	    *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(5))) | lsb;
-	    JU_RET_FOUND_IMM(Pjp, offset);
-	}
-
-	case cJ1_JPIMMED_6_02: IMM(2, Imm6);
-
-Imm6:
-	{
-	    Word_t lsb;
-	    SETOFFSET_IMM(offset, Count0, pop1lower);
-	    JU_COPY6_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (6 * offset));
-	    *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(6))) | lsb;
-	    JU_RET_FOUND_IMM(Pjp, offset);
-	}
-
-	case cJ1_JPIMMED_7_02: IMM(2, Imm7);
-
-Imm7:
-	{
-	    Word_t lsb;
-	    SETOFFSET_IMM(offset, Count0, pop1lower);
-	    JU_COPY7_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (7 * offset));
-	    *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(7))) | lsb;
-	    JU_RET_FOUND_IMM(Pjp, offset);
-	}
-#endif // (JUDY1 && JU_64BIT)
-
-
-// ----------------------------------------------------------------------------
-// UNEXPECTED JP TYPES:
-
-	default: JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
-		 JUDY1CODE(return(JERRI );)
-		 JUDYLCODE(return(PPJERR);)
-
-	} // SMByCount switch.
-
-	/*NOTREACHED*/
-
-} // Judy1ByCount() / JudyLByCount()
diff --git a/libs/klib/judy/JudyByCountWithDefs.c b/libs/klib/judy/JudyByCountWithDefs.c
deleted file mode 100644
index b4ad243..0000000
--- a/libs/klib/judy/JudyByCountWithDefs.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#define NOSMARTJBB 1
-#define NOSMARTJBU 1
-#define NOSMARTJLB 1
-#include "JudyByCount.c"
diff --git a/libs/klib/judy/JudyCascade.c b/libs/klib/judy/JudyCascade.c
deleted file mode 100644
index fccb747..0000000
--- a/libs/klib/judy/JudyCascade.c
+++ /dev/null
@@ -1,1940 +0,0 @@
-// Copyright (C) 2000 - 2002 Hewlett-Packard Company
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the term of the GNU Lesser 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 Lesser General Public License
-// for more details.
-//
-// You should have received a copy of the GNU Lesser 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
-// _________________
-
-#ifdef JUDY1
-#include "Judy1.h"
-#else
-#include "JudyL.h"
-#endif
-
-#include "JudyPrivate1L.h"
-
-extern int j__udyCreateBranchL(Pjp_t, Pjp_t, uint8_t *, Word_t, Pvoid_t);
-extern int j__udyCreateBranchB(Pjp_t, Pjp_t, uint8_t *, Word_t, Pvoid_t);
-
-DBGCODE(extern void JudyCheckSorted(Pjll_t Pjll, Word_t Pop1, long IndexSize);)
-
-static const jbb_t StageJBBZero;	// zeroed versions of namesake struct.
-
-// TBD:  There are multiple copies of (some of) these CopyWto3, Copy3toW,
-// CopyWto7 and Copy7toW functions in Judy1Cascade.c, JudyLCascade.c, and
-// JudyDecascade.c.  These static functions should probably be moved to a
-// common place, made macros, or something to avoid having four copies.
-
-
-// ****************************************************************************
-// __ J U D Y   C O P Y   X   T O   W
-
-
-FUNCTION static void j__udyCopy3toW(
-	PWord_t	  PDest,
-	uint8_t * PSrc,
-	Word_t	  LeafIndexes)
-{
-	do
-	{
-		JU_COPY3_PINDEX_TO_LONG(*PDest, PSrc);
-		PSrc	+= 3;
-		PDest	+= 1;
-
-	} while(--LeafIndexes);
-
-} //j__udyCopy3toW()
-
-
-#ifdef JU_64BIT
-
-FUNCTION static void j__udyCopy4toW(
-	PWord_t	   PDest,
-	uint32_t * PSrc,
-	Word_t	   LeafIndexes)
-{
-	do { *PDest++ = *PSrc++;
-	} while(--LeafIndexes);
-
-} // j__udyCopy4toW()
-
-
-FUNCTION static void j__udyCopy5toW(
-	PWord_t	  PDest,
-	uint8_t	* PSrc,
-	Word_t	  LeafIndexes)
-{
-	do
-	{
-		JU_COPY5_PINDEX_TO_LONG(*PDest, PSrc);
-		PSrc	+= 5;
-		PDest	+= 1;
-
-	} while(--LeafIndexes);
-
-} // j__udyCopy5toW()
-
-
-FUNCTION static void j__udyCopy6toW(
-	PWord_t	  PDest,
-	uint8_t	* PSrc,
-	Word_t	  LeafIndexes)
-{
-	do
-	{
-		JU_COPY6_PINDEX_TO_LONG(*PDest, PSrc);
-		PSrc	+= 6;
-		PDest	+= 1;
-
-	} while(--LeafIndexes);
-
-} // j__udyCopy6toW()
-
-
-FUNCTION static void j__udyCopy7toW(
-	PWord_t	  PDest,
-	uint8_t	* PSrc,
-	Word_t	  LeafIndexes)
-{
-	do
-	{
-		JU_COPY7_PINDEX_TO_LONG(*PDest, PSrc);
-		PSrc	+= 7;
-		PDest	+= 1;
-
-	} while(--LeafIndexes);
-
-} // j__udyCopy7toW()
-
-#endif // JU_64BIT
-
-
-// ****************************************************************************
-// __ J U D Y   C O P Y   W   T O   X
-
-
-FUNCTION static void j__udyCopyWto3(
-	uint8_t	* PDest,
-	PWord_t	  PSrc,
-	Word_t	  LeafIndexes)
-{
-	do
-	{
-		JU_COPY3_LONG_TO_PINDEX(PDest, *PSrc);
-		PSrc	+= 1;
-		PDest	+= 3;
-
-	} while(--LeafIndexes);
-
-} // j__udyCopyWto3()
-
-
-#ifdef JU_64BIT
-
-FUNCTION static void j__udyCopyWto4(
-	uint8_t	* PDest,
-	PWord_t	  PSrc,
-	Word_t	  LeafIndexes)
-{
-	uint32_t *PDest32 = (uint32_t *)PDest;
-
-	do
-	{
-		*PDest32 = *PSrc;
-		PSrc	+= 1;
-		PDest32	+= 1;
-	} while(--LeafIndexes);
-
-} // j__udyCopyWto4()
-
-
-FUNCTION static void j__udyCopyWto5(
-	uint8_t	* PDest,
-	PWord_t	  PSrc,
-	Word_t	  LeafIndexes)
-{
-	do
-	{
-		JU_COPY5_LONG_TO_PINDEX(PDest, *PSrc);
-		PSrc	+= 1;
-		PDest	+= 5;
-
-	} while(--LeafIndexes);
-
-} // j__udyCopyWto5()
-
-
-FUNCTION static void j__udyCopyWto6(
-	uint8_t	* PDest,
-	PWord_t	  PSrc,
-	Word_t	  LeafIndexes)
-{
-	do
-	{
-		JU_COPY6_LONG_TO_PINDEX(PDest, *PSrc);
-		PSrc	+= 1;
-		PDest	+= 6;
-
-	} while(--LeafIndexes);
-
-} // j__udyCopyWto6()
-
-
-FUNCTION static void j__udyCopyWto7(
-	uint8_t	* PDest,
-	PWord_t	  PSrc,
-	Word_t	  LeafIndexes)
-{
-	do
-	{
-		JU_COPY7_LONG_TO_PINDEX(PDest, *PSrc);
-		PSrc	+= 1;
-		PDest	+= 7;
-
-	} while(--LeafIndexes);
-
-} // j__udyCopyWto7()
-
-#endif // JU_64BIT
-
-
-// ****************************************************************************
-// COMMON CODE (MACROS):
-//
-// Free objects in an array of valid JPs, StageJP[ExpCnt] == last one may
-// include Immeds, which are ignored.
-
-#define FREEALLEXIT(ExpCnt,StageJP,Pjpm)				\
-	{								\
-	    Word_t _expct = (ExpCnt);					\
-	    while (_expct--) j__udyFreeSM(&((StageJP)[_expct]), Pjpm);  \
-	    return(-1);                                                 \
-	}
-
-// Clear the array that keeps track of the number of JPs in a subexpanse:
-
-#define ZEROJP(SubJPCount)                                              \
-	{								\
-		int ii;							\
-		for (ii = 0; ii < cJU_NUMSUBEXPB; ii++) (SubJPCount[ii]) = 0; \
-	}
-
-// ****************************************************************************
-// __ J U D Y   S T A G E   J B B   T O   J B B
-//
-// Create a mallocd BranchB (jbb_t) from a staged BranchB while "splaying" a
-// single old leaf.  Return -1 if out of memory, otherwise 1.
-
-static int j__udyStageJBBtoJBB(
-	Pjp_t     PjpLeaf,	// JP of leaf being splayed.
-	Pjbb_t    PStageJBB,	// temp jbb_t on stack.
-	Pjp_t     PjpArray,	// array of JPs to splayed new leaves.
-	uint8_t * PSubCount,	// count of JPs for each subexpanse.
-	Pjpm_t    Pjpm)		// the jpm_t for JudyAlloc*().
-{
-	Pjbb_t    PjbbRaw;	// pointer to new bitmap branch.
-	Pjbb_t    Pjbb;
-	Word_t    subexp;
-
-// Get memory for new BranchB:
-
-	if ((PjbbRaw = j__udyAllocJBB(Pjpm)) == (Pjbb_t) NULL) return(-1);
-	Pjbb = P_JBB(PjbbRaw);
-
-// Copy staged BranchB into just-allocated BranchB:
-
-	*Pjbb = *PStageJBB;
-
-// Allocate the JP subarrays (BJP) for the new BranchB:
-
-	for (subexp = 0; subexp < cJU_NUMSUBEXPB; subexp++)
-	{
-	    Pjp_t  PjpRaw;
-	    Pjp_t  Pjp;
-	    Word_t NumJP;       // number of JPs in each subexpanse.
-
-	    if ((NumJP = PSubCount[subexp]) == 0) continue;	// empty.
-
-// Out of memory, back out previous allocations:
-
-	    if ((PjpRaw = j__udyAllocJBBJP(NumJP, Pjpm)) == (Pjp_t) NULL)
-	    {
-		while(subexp--)
-		{
-		    if ((NumJP = PSubCount[subexp]) == 0) continue;
-
-		    PjpRaw = JU_JBB_PJP(Pjbb, subexp);
-		    j__udyFreeJBBJP(PjpRaw, NumJP, Pjpm);
-		}
-		j__udyFreeJBB(PjbbRaw, Pjpm);
-		return(-1);	// out of memory.
-	    }
-	    Pjp = P_JP(PjpRaw);
-
-// Place the JP subarray pointer in the new BranchB, copy subarray JPs, and
-// advance to the next subexpanse:
-
-	    JU_JBB_PJP(Pjbb, subexp) = PjpRaw;
-	    JU_COPYMEM(Pjp, PjpArray, NumJP);
-	    PjpArray += NumJP;
-
-	} // for each subexpanse.
-
-// Change the PjpLeaf from Leaf to BranchB:
-
-	PjpLeaf->jp_Addr  = (Word_t) PjbbRaw;
-	PjpLeaf->jp_Type += cJU_JPBRANCH_B2 - cJU_JPLEAF2;  // Leaf to BranchB.
-
-	return(1);
-
-} // j__udyStageJBBtoJBB()
-
-
-// ****************************************************************************
-// __ J U D Y   J L L 2   T O   J L B 1
-//
-// Create a LeafB1 (jlb_t = JLB1) from a Leaf2 (2-byte Indexes and for JudyL,
-// Word_t Values).  Return NULL if out of memory, else a pointer to the new
-// LeafB1.
-//
-// NOTE:  Caller must release the Leaf2 that was passed in.
-
-FUNCTION static Pjlb_t j__udyJLL2toJLB1(
-	uint16_t * Pjll,	// array of 16-bit indexes.
-#ifdef JUDYL
-	Pjv_t      Pjv,		// array of associated values.
-#endif
-	Word_t     LeafPop1,	// number of indexes/values.
-	Pvoid_t    Pjpm)	// jpm_t for JudyAlloc*()/JudyFree*().
-{
-	Pjlb_t     PjlbRaw;
-	Pjlb_t     Pjlb;
-	int	   offset;
-JUDYLCODE(int	   subexp;)
-
-// Allocate the LeafB1:
-
-	if ((PjlbRaw = j__udyAllocJLB1(Pjpm)) == (Pjlb_t) NULL)
-	    return((Pjlb_t) NULL);
-	Pjlb = P_JLB(PjlbRaw);
-
-// Copy Leaf2 indexes to LeafB1:
-
-	for (offset = 0; offset < LeafPop1; ++offset)
-	    JU_BITMAPSETL(Pjlb, Pjll[offset]);
-
-#ifdef JUDYL
-
-// Build LeafVs from bitmap:
-
-	for (subexp = 0; subexp < cJU_NUMSUBEXPL; ++subexp)
-	{
-	    struct _POINTER_VALUES
-	    {
-		Word_t pv_Pop1;		// size of value area.
-		Pjv_t  pv_Pjv;		// raw pointer to value area.
-	    } pv[cJU_NUMSUBEXPL];
-
-// Get the population of the subexpanse, and if any, allocate a LeafV:
-
-	    pv[subexp].pv_Pop1 = j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, subexp));
-
-	    if (pv[subexp].pv_Pop1)
-	    {
-		Pjv_t Pjvnew;
-
-// TBD:  There is an opportunity to put pop == 1 value in pointer:
-
-		pv[subexp].pv_Pjv = j__udyLAllocJV(pv[subexp].pv_Pop1, Pjpm);
-
-// Upon out of memory, free all previously allocated:
-
-		if (pv[subexp].pv_Pjv == (Pjv_t) NULL)
-		{
-		    while(subexp--)
-		    {
-			if (pv[subexp].pv_Pop1)
-			{
-			    j__udyLFreeJV(pv[subexp].pv_Pjv, pv[subexp].pv_Pop1,
-					  Pjpm);
-			}
-		    }
-		    j__udyFreeJLB1(PjlbRaw, Pjpm);
-		    return((Pjlb_t) NULL);
-		}
-
-		Pjvnew = P_JV(pv[subexp].pv_Pjv);
-		JU_COPYMEM(Pjvnew, Pjv, pv[subexp].pv_Pop1);
-		Pjv += pv[subexp].pv_Pop1;	// advance value pointer.
-
-// Place raw pointer to value array in bitmap subexpanse:
-
-		JL_JLB_PVALUE(Pjlb, subexp) = pv[subexp].pv_Pjv;
-
-	    } // populated subexpanse.
-	} // each subexpanse.
-
-#endif // JUDYL
-
-	return(PjlbRaw);	// pointer to LeafB1.
-
-} // j__udyJLL2toJLB1()
-
-
-// ****************************************************************************
-// __ J U D Y   C A S C A D E 1
-//
-// Create bitmap leaf from 1-byte Indexes and Word_t Values.
-//
-// TBD:  There must be a better way.
-//
-// Only for JudyL 32 bit:  (note, unifdef disallows comment on next line)
-
-#if (defined(JUDYL) || (! defined(JU_64BIT)))
-
-FUNCTION int j__udyCascade1(
-	Pjp_t	   Pjp,
-	Pvoid_t    Pjpm)
-{
-        Word_t     DcdP0;
-	uint8_t	 * PLeaf;
-	Pjlb_t	   PjlbRaw;
-	Pjlb_t	   Pjlb;
-	Word_t     Pop1;
-	Word_t     ii;		// temp for loop counter
-JUDYLCODE(Pjv_t	   Pjv;)
-
-	assert(JU_JPTYPE(Pjp) == cJU_JPLEAF1);
-	assert((JU_JPDCDPOP0(Pjp) & 0xFF) == (cJU_LEAF1_MAXPOP1-1));
-
-	PjlbRaw = j__udyAllocJLB1(Pjpm);
-	if (PjlbRaw == (Pjlb_t) NULL) return(-1);
-
-	Pjlb  = P_JLB(PjlbRaw);
-	PLeaf = (uint8_t *) P_JLL(Pjp->jp_Addr);
-	Pop1  = JU_JPLEAF_POP0(Pjp) + 1;
-
-	JUDYLCODE(Pjv = JL_LEAF1VALUEAREA(PLeaf, Pop1);)
-
-//	Copy 1 byte index Leaf to bitmap Leaf
-	for (ii = 0; ii < Pop1; ii++) JU_BITMAPSETL(Pjlb, PLeaf[ii]);
-
-#ifdef JUDYL
-//	Build 8 subexpanse Value leaves from bitmap
-	for (ii = 0; ii < cJU_NUMSUBEXPL; ii++)
-	{
-//	    Get number of Indexes in subexpanse
-	    if ((Pop1 = j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, ii))))
-	    {
-		Pjv_t PjvnewRaw;	// value area of new leaf.
-		Pjv_t Pjvnew;
-
-		PjvnewRaw = j__udyLAllocJV(Pop1, Pjpm);
-		if (PjvnewRaw == (Pjv_t) NULL)	// out of memory.
-		{
-//                  Free prevously allocated LeafVs:
-		    while(ii--)
-		    {
-			if ((Pop1 = j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, ii))))
-			{
-			    PjvnewRaw = JL_JLB_PVALUE(Pjlb, ii);
-			    j__udyLFreeJV(PjvnewRaw, Pop1, Pjpm);
-			}
-		    }
-//                  Free the bitmap leaf
-		    j__udyLFreeJLB1(PjlbRaw,Pjpm);
-		    return(-1);
-		}
-		Pjvnew    = P_JV(PjvnewRaw);
-		JU_COPYMEM(Pjvnew, Pjv, Pop1);
-
-		Pjv += Pop1;
-		JL_JLB_PVALUE(Pjlb, ii) = PjvnewRaw;
-	    }
-	}
-#endif // JUDYL
-
-	DcdP0 = JU_JPDCDPOP0(Pjp) | (PLeaf[0] & cJU_DCDMASK(1));
-        JU_JPSETADT(Pjp, (Word_t)PjlbRaw, DcdP0, cJU_JPLEAF_B1);
-
-	return(1);	// return success
-
-} // j__udyCascade1()
-
-#endif // (!(JUDY1 && JU_64BIT))
-
-
-// ****************************************************************************
-// __ J U D Y   C A S C A D E 2
-//
-// Entry PLeaf of size LeafPop1 is either compressed or splayed with pointer
-// returned in Pjp.  Entry Levels sizeof(Word_t) down to level 2.
-//
-// Splay or compress the 2-byte Index Leaf that Pjp point to.  Return *Pjp as a
-// (compressed) cJU_LEAFB1 or a cJU_BRANCH_*2
-
-FUNCTION int j__udyCascade2(
-	Pjp_t	   Pjp,
-	Pvoid_t	   Pjpm)
-{
-	uint16_t * PLeaf;	// pointer to leaf, explicit type.
-	Word_t	   End, Start;	// temporaries.
-	Word_t	   ExpCnt;	// count of expanses of splay.
-	Word_t     CIndex;	// current Index word.
-JUDYLCODE(Pjv_t	   Pjv;)	// value area of leaf.
-
-//	Temp staging for parts(Leaves) of newly splayed leaf
-	jp_t	   StageJP   [cJU_LEAF2_MAXPOP1];  // JPs of new leaves
-	uint8_t	   StageExp  [cJU_LEAF2_MAXPOP1];  // Expanses of new leaves
-	uint8_t	   SubJPCount[cJU_NUMSUBEXPB];     // JPs in each subexpanse
-	jbb_t      StageJBB;                       // staged bitmap branch
-
-	assert(JU_JPTYPE(Pjp) == cJU_JPLEAF2);
-	assert((JU_JPDCDPOP0(Pjp) & 0xFFFF) == (cJU_LEAF2_MAXPOP1-1));
-
-//	Get the address of the Leaf
-	PLeaf = (uint16_t *) P_JLL(Pjp->jp_Addr);
-
-//	And its Value area
-	JUDYLCODE(Pjv = JL_LEAF2VALUEAREA(PLeaf, cJU_LEAF2_MAXPOP1);)
-
-//  If Leaf is in 1 expanse -- just compress it to a Bitmap Leaf
-
-	CIndex = PLeaf[0];
-	if (!JU_DIGITATSTATE(CIndex ^ PLeaf[cJU_LEAF2_MAXPOP1-1], 2))
-	{
-//	cJU_JPLEAF_B1
-                Word_t DcdP0;
-		Pjlb_t PjlbRaw;
-		PjlbRaw = j__udyJLL2toJLB1(PLeaf,
-#ifdef JUDYL
-				     Pjv,
-#endif
-				     cJU_LEAF2_MAXPOP1, Pjpm);
-		if (PjlbRaw == (Pjlb_t)NULL) return(-1);  // out of memory
-
-//		Merge in another Dcd byte because compressing
-		DcdP0 = (CIndex & cJU_DCDMASK(1)) | JU_JPDCDPOP0(Pjp);
-                JU_JPSETADT(Pjp, (Word_t)PjlbRaw, DcdP0, cJU_JPLEAF_B1);
-
-		return(1);
-	}
-
-//  Else in 2+ expanses, splay Leaf into smaller leaves at higher compression
-
-	StageJBB = StageJBBZero;       // zero staged bitmap branch
-	ZEROJP(SubJPCount);
-
-//	Splay the 2 byte index Leaf to 1 byte Index Leaves
-	for (ExpCnt = Start = 0, End = 1; ; End++)
-	{
-//		Check if new expanse or last one
-		if (	(End == cJU_LEAF2_MAXPOP1)
-				||
-			(JU_DIGITATSTATE(CIndex ^ PLeaf[End], 2))
-		   )
-		{
-//			Build a leaf below the previous expanse
-//
-			Pjp_t  PjpJP	= StageJP + ExpCnt;
-			Word_t Pop1	= End - Start;
-			Word_t expanse = JU_DIGITATSTATE(CIndex, 2);
-			Word_t subexp  = expanse / cJU_BITSPERSUBEXPB;
-//
-//                      set the bit that is the current expanse
-			JU_JBB_BITMAP(&StageJBB, subexp) |= JU_BITPOSMASKB(expanse);
-#ifdef SUBEXPCOUNTS
-			StageJBB.jbb_subPop1[subexp] += Pop1; // pop of subexpanse
-#endif
-//                      count number of expanses in each subexpanse
-			SubJPCount[subexp]++;
-
-//			Save byte expanse of leaf
-			StageExp[ExpCnt] = JU_DIGITATSTATE(CIndex, 2);
-
-			if (Pop1 == 1)	// cJU_JPIMMED_1_01
-			{
-	                    Word_t DcdP0;
-	                    DcdP0 = (JU_JPDCDPOP0(Pjp) & cJU_DCDMASK(1)) |
-                                CIndex;
-#ifdef JUDY1
-                            JU_JPSETADT(PjpJP, 0, DcdP0, cJ1_JPIMMED_1_01);
-#else   // JUDYL
-                            JU_JPSETADT(PjpJP, Pjv[Start], DcdP0, 
-                                cJL_JPIMMED_1_01);
-#endif  // JUDYL
-			}
-			else if (Pop1 <= cJU_IMMED1_MAXPOP1) // bigger
-			{
-//		cJL_JPIMMED_1_02..3:  JudyL 32
-//		cJ1_JPIMMED_1_02..7:  Judy1 32
-//		cJL_JPIMMED_1_02..7:  JudyL 64
-//		cJ1_JPIMMED_1_02..15: Judy1 64
-#ifdef JUDYL
-				Pjv_t  PjvnewRaw;	// value area of leaf.
-				Pjv_t  Pjvnew;
-
-//				Allocate Value area for Immediate Leaf
-				PjvnewRaw = j__udyLAllocJV(Pop1, Pjpm);
-				if (PjvnewRaw == (Pjv_t) NULL)
-					FREEALLEXIT(ExpCnt, StageJP, Pjpm);
-
-				Pjvnew = P_JV(PjvnewRaw);
-
-//				Copy to Values to Value Leaf
-				JU_COPYMEM(Pjvnew, Pjv + Start, Pop1);
-				PjpJP->jp_Addr = (Word_t) PjvnewRaw;
-
-//				Copy to JP as an immediate Leaf
-				JU_COPYMEM(PjpJP->jp_LIndex, PLeaf + Start,
-					   Pop1);
-#else
-				JU_COPYMEM(PjpJP->jp_1Index, PLeaf + Start,
-					   Pop1);
-#endif
-//				Set Type, Population and Index size
-				PjpJP->jp_Type = cJU_JPIMMED_1_02 + Pop1 - 2;
-			}
-
-// 64Bit Judy1 does not have Leaf1:  (note, unifdef disallows comment on next
-// line)
-
-#if (! (defined(JUDY1) && defined(JU_64BIT)))
-			else if (Pop1 <= cJU_LEAF1_MAXPOP1) // still bigger
-			{
-//		cJU_JPLEAF1
-                                Word_t  DcdP0;
-				Pjll_t PjllRaw;	 // pointer to new leaf.
-				Pjll_t Pjll;
-		      JUDYLCODE(Pjv_t  Pjvnew;)	 // value area of new leaf.
-
-//				Get a new Leaf
-				PjllRaw = j__udyAllocJLL1(Pop1, Pjpm);
-				if (PjllRaw == (Pjll_t)NULL)
-					FREEALLEXIT(ExpCnt, StageJP, Pjpm);
-
-				Pjll = P_JLL(PjllRaw);
-#ifdef JUDYL
-//				Copy to Values to new Leaf
-				Pjvnew = JL_LEAF1VALUEAREA(Pjll, Pop1);
-				JU_COPYMEM(Pjvnew, Pjv + Start, Pop1);
-#endif
-//				Copy Indexes to new Leaf
-				JU_COPYMEM((uint8_t *)Pjll, PLeaf+Start, Pop1);
-
-				DBGCODE(JudyCheckSorted(Pjll, Pop1, 1);)
-
-                                DcdP0 = (JU_JPDCDPOP0(Pjp) & cJU_DCDMASK(2)) 
-                                                |
-                                        (CIndex & cJU_DCDMASK(2-1))
-                                                |
-                                        (Pop1 - 1);
-
-                                JU_JPSETADT(PjpJP, (Word_t)PjllRaw, DcdP0,
-                                        cJU_JPLEAF1);
-			}
-#endif //  (!(JUDY1 && JU_64BIT)) // Not 64Bit Judy1
-
-			else				// biggest
-			{
-//		cJU_JPLEAF_B1
-                                Word_t  DcdP0;
-				Pjlb_t PjlbRaw;
-				PjlbRaw = j__udyJLL2toJLB1(
-						PLeaf + Start,
-#ifdef JUDYL
-						Pjv + Start,
-#endif
-						Pop1, Pjpm);
-				if (PjlbRaw == (Pjlb_t)NULL)
-					FREEALLEXIT(ExpCnt, StageJP, Pjpm);
-
-                                DcdP0 = (JU_JPDCDPOP0(Pjp) & cJU_DCDMASK(2)) 
-                                                |
-                                        (CIndex & cJU_DCDMASK(2-1)) 
-                                                |
-                                        (Pop1 - 1);
-
-                                JU_JPSETADT(PjpJP, (Word_t)PjlbRaw, DcdP0,
-                                        cJU_JPLEAF_B1);
-			}
-			ExpCnt++;
-//                      Done?
-			if (End == cJU_LEAF2_MAXPOP1) break;
-
-//			New Expanse, Start and Count
-			CIndex = PLeaf[End];
-			Start  = End;
-		}
-	}
-
-//      Now put all the Leaves below a BranchL or BranchB:
-	if (ExpCnt <= cJU_BRANCHLMAXJPS) // put the Leaves below a BranchL
-	{
-	    if (j__udyCreateBranchL(Pjp, StageJP, StageExp, ExpCnt,
-			Pjpm) == -1) FREEALLEXIT(ExpCnt, StageJP, Pjpm);
-
-	    Pjp->jp_Type = cJU_JPBRANCH_L2;
-	}
-	else
-	{
-	    if (j__udyStageJBBtoJBB(Pjp, &StageJBB, StageJP, SubJPCount, Pjpm)
-		== -1) FREEALLEXIT(ExpCnt, StageJP, Pjpm);
-	}
-	return(1);
-
-} // j__udyCascade2()
-
-
-// ****************************************************************************
-// __ J U D Y   C A S C A D E 3
-//
-// Return *Pjp as a (compressed) cJU_LEAF2, cJU_BRANCH_L3, cJU_BRANCH_B3.
-
-FUNCTION int j__udyCascade3(
-	Pjp_t	   Pjp,
-	Pvoid_t	   Pjpm)
-{
-	uint8_t  * PLeaf;	// pointer to leaf, explicit type.
-	Word_t	   End, Start;	// temporaries.
-	Word_t	   ExpCnt;	// count of expanses of splay.
-	Word_t     CIndex;	// current Index word.
-JUDYLCODE(Pjv_t	   Pjv;)	// value area of leaf.
-
-//	Temp staging for parts(Leaves) of newly splayed leaf
-	jp_t	   StageJP   [cJU_LEAF3_MAXPOP1];  // JPs of new leaves
-	Word_t	   StageA    [cJU_LEAF3_MAXPOP1];
-	uint8_t	   StageExp  [cJU_LEAF3_MAXPOP1];  // Expanses of new leaves
-	uint8_t	   SubJPCount[cJU_NUMSUBEXPB];     // JPs in each subexpanse
-	jbb_t      StageJBB;                       // staged bitmap branch
-
-	assert(JU_JPTYPE(Pjp) == cJU_JPLEAF3);
-	assert((JU_JPDCDPOP0(Pjp) & 0xFFFFFF) == (cJU_LEAF3_MAXPOP1-1));
-
-//	Get the address of the Leaf
-	PLeaf = (uint8_t *) P_JLL(Pjp->jp_Addr);
-
-//	Extract leaf to Word_t and insert-sort Index into it
-	j__udyCopy3toW(StageA, PLeaf, cJU_LEAF3_MAXPOP1);
-
-//	Get the address of the Leaf and Value area
-	JUDYLCODE(Pjv = JL_LEAF3VALUEAREA(PLeaf, cJU_LEAF3_MAXPOP1);)
-
-//  If Leaf is in 1 expanse -- just compress it (compare 1st, last & Index)
-
-	CIndex = StageA[0];
-	if (!JU_DIGITATSTATE(CIndex ^ StageA[cJU_LEAF3_MAXPOP1-1], 3))
-	{
-                Word_t DcdP0;
-		Pjll_t PjllRaw;	 // pointer to new leaf.
-		Pjll_t Pjll;
-      JUDYLCODE(Pjv_t  Pjvnew;)	 // value area of new leaf.
-
-//		Alloc a 2 byte Index Leaf
-		PjllRaw	= j__udyAllocJLL2(cJU_LEAF3_MAXPOP1, Pjpm);
-		if (PjllRaw == (Pjlb_t)NULL) return(-1);  // out of memory
-
-		Pjll = P_JLL(PjllRaw);
-
-//		Copy just 2 bytes Indexes to new Leaf
-//		j__udyCopyWto2((uint16_t *) Pjll, StageA, cJU_LEAF3_MAXPOP1);
-		JU_COPYMEM    ((uint16_t *) Pjll, StageA, cJU_LEAF3_MAXPOP1);
-#ifdef JUDYL
-//		Copy Value area into new Leaf
-		Pjvnew = JL_LEAF2VALUEAREA(Pjll, cJU_LEAF3_MAXPOP1);
-		JU_COPYMEM(Pjvnew, Pjv, cJU_LEAF3_MAXPOP1);
-#endif
-		DBGCODE(JudyCheckSorted(Pjll, cJU_LEAF3_MAXPOP1, 2);)
-
-//		Form new JP, Pop0 field is unchanged
-//		Add in another Dcd byte because compressing
-                DcdP0 = (CIndex & cJU_DCDMASK(2)) | JU_JPDCDPOP0(Pjp);
-
-                JU_JPSETADT(Pjp, (Word_t) PjllRaw, DcdP0, cJU_JPLEAF2);
-
-		return(1); // Success
-	}
-
-//  Else in 2+ expanses, splay Leaf into smaller leaves at higher compression
-
-	StageJBB = StageJBBZero;       // zero staged bitmap branch
-	ZEROJP(SubJPCount);
-
-//	Splay the 3 byte index Leaf to 2 byte Index Leaves
-	for (ExpCnt = Start = 0, End = 1; ; End++)
-	{
-//		Check if new expanse or last one
-		if (	(End == cJU_LEAF3_MAXPOP1)
-				||
-			(JU_DIGITATSTATE(CIndex ^ StageA[End], 3))
-		   )
-		{
-//			Build a leaf below the previous expanse
-
-			Pjp_t  PjpJP	= StageJP + ExpCnt;
-			Word_t Pop1	= End - Start;
-			Word_t expanse = JU_DIGITATSTATE(CIndex, 3);
-			Word_t subexp  = expanse / cJU_BITSPERSUBEXPB;
-//
-//                      set the bit that is the current expanse
-			JU_JBB_BITMAP(&StageJBB, subexp) |= JU_BITPOSMASKB(expanse);
-#ifdef SUBEXPCOUNTS
-			StageJBB.jbb_subPop1[subexp] += Pop1; // pop of subexpanse
-#endif
-//                      count number of expanses in each subexpanse
-			SubJPCount[subexp]++;
-
-//			Save byte expanse of leaf
-			StageExp[ExpCnt] = JU_DIGITATSTATE(CIndex, 3);
-
-			if (Pop1 == 1)	// cJU_JPIMMED_2_01
-			{
-	                    Word_t DcdP0;
-	                    DcdP0 = (JU_JPDCDPOP0(Pjp) & cJU_DCDMASK(2)) |
-                                CIndex;
-#ifdef JUDY1
-                            JU_JPSETADT(PjpJP, 0, DcdP0, cJ1_JPIMMED_2_01);
-#else   // JUDYL
-                            JU_JPSETADT(PjpJP, Pjv[Start], DcdP0, 
-                                cJL_JPIMMED_2_01);
-#endif  // JUDYL
-			}
-#if (defined(JUDY1) || defined(JU_64BIT))
-			else if (Pop1 <= cJU_IMMED2_MAXPOP1)
-			{
-//		cJ1_JPIMMED_2_02..3:  Judy1 32
-//		cJL_JPIMMED_2_02..3:  JudyL 64
-//		cJ1_JPIMMED_2_02..7:  Judy1 64
-#ifdef JUDYL
-//				Alloc is 1st in case of malloc fail
-				Pjv_t PjvnewRaw;  // value area of new leaf.
-				Pjv_t Pjvnew;
-
-//				Allocate Value area for Immediate Leaf
-				PjvnewRaw = j__udyLAllocJV(Pop1, Pjpm);
-				if (PjvnewRaw == (Pjv_t) NULL)
-					FREEALLEXIT(ExpCnt, StageJP, Pjpm);
-
-				Pjvnew = P_JV(PjvnewRaw);
-
-//				Copy to Values to Value Leaf
-				JU_COPYMEM(Pjvnew, Pjv + Start, Pop1);
-
-				PjpJP->jp_Addr = (Word_t) PjvnewRaw;
-
-//				Copy to Index to JP as an immediate Leaf
-				JU_COPYMEM((uint16_t *) (PjpJP->jp_LIndex),
-					   StageA + Start, Pop1);
-#else // JUDY1
-				JU_COPYMEM((uint16_t *) (PjpJP->jp_1Index),
-					   StageA + Start, Pop1);
-#endif // JUDY1
-//				Set Type, Population and Index size
-				PjpJP->jp_Type = cJU_JPIMMED_2_02 + Pop1 - 2;
-			}
-#endif // (JUDY1 || JU_64BIT)
-
-			else	// Make a linear leaf2
-			{
-//		cJU_JPLEAF2
-                                Word_t  DcdP0;
-				Pjll_t PjllRaw;	 // pointer to new leaf.
-				Pjll_t Pjll;
-		      JUDYLCODE(Pjv_t  Pjvnew;)	 // value area of new leaf.
-
-				PjllRaw = j__udyAllocJLL2(Pop1, Pjpm);
-				if (PjllRaw == (Pjll_t) NULL)
-					FREEALLEXIT(ExpCnt, StageJP, Pjpm);
-
-				Pjll = P_JLL(PjllRaw);
-#ifdef JUDYL
-//				Copy to Values to new Leaf
-				Pjvnew = JL_LEAF2VALUEAREA(Pjll, Pop1);
-				JU_COPYMEM(Pjvnew, Pjv + Start, Pop1);
-#endif
-//				Copy least 2 bytes per Index of Leaf to new Leaf
-				JU_COPYMEM((uint16_t *) Pjll, StageA+Start,
-					   Pop1);
-
-				DBGCODE(JudyCheckSorted(Pjll, Pop1, 2);)
-
-                                DcdP0 = (JU_JPDCDPOP0(Pjp) & cJU_DCDMASK(3)) 
-                                                |
-                                        (CIndex & cJU_DCDMASK(3-1)) 
-                                                |
-                                        (Pop1 - 1);
-
-                                JU_JPSETADT(PjpJP, (Word_t)PjllRaw, DcdP0,
-                                        cJU_JPLEAF2);
-			}
-			ExpCnt++;
-//                      Done?
-			if (End == cJU_LEAF3_MAXPOP1) break;
-
-//			New Expanse, Start and Count
-			CIndex = StageA[End];
-			Start  = End;
-		}
-	}
-
-//      Now put all the Leaves below a BranchL or BranchB:
-	if (ExpCnt <= cJU_BRANCHLMAXJPS) // put the Leaves below a BranchL
-	{
-	    if (j__udyCreateBranchL(Pjp, StageJP, StageExp, ExpCnt,
-			Pjpm) == -1) FREEALLEXIT(ExpCnt, StageJP, Pjpm);
-
-	    Pjp->jp_Type = cJU_JPBRANCH_L3;
-	}
-	else
-	{
-	    if (j__udyStageJBBtoJBB(Pjp, &StageJBB, StageJP, SubJPCount, Pjpm)
-		== -1) FREEALLEXIT(ExpCnt, StageJP, Pjpm);
-	}
-	return(1);
-
-} // j__udyCascade3()
-
-
-#ifdef JU_64BIT   // JudyCascade[4567]
-
-// ****************************************************************************
-// __ J U D Y   C A S C A D E 4
-//
-// Cascade from a cJU_JPLEAF4 to one of the following:
-//  1. if leaf is in 1 expanse:
-//        compress it into a JPLEAF3
-//  2. if leaf contains multiple expanses:
-//        create linear or bitmap branch containing
-//        each new expanse is either a:
-//               JPIMMED_3_01  branch
-//               JPIMMED_3_02  branch
-//               JPLEAF3
-
-FUNCTION int j__udyCascade4(
-	Pjp_t	   Pjp,
-	Pvoid_t	   Pjpm)
-{
-	uint32_t * PLeaf;	// pointer to leaf, explicit type.
-	Word_t	   End, Start;	// temporaries.
-	Word_t	   ExpCnt;	// count of expanses of splay.
-	Word_t     CIndex;	// current Index word.
-JUDYLCODE(Pjv_t	   Pjv;)	// value area of leaf.
-
-//	Temp staging for parts(Leaves) of newly splayed leaf
-	jp_t	   StageJP   [cJU_LEAF4_MAXPOP1];  // JPs of new leaves
-	Word_t	   StageA    [cJU_LEAF4_MAXPOP1];
-	uint8_t	   StageExp  [cJU_LEAF4_MAXPOP1];  // Expanses of new leaves
-	uint8_t	   SubJPCount[cJU_NUMSUBEXPB];     // JPs in each subexpanse
-	jbb_t      StageJBB;                       // staged bitmap branch
-
-	assert(JU_JPTYPE(Pjp) == cJU_JPLEAF4);
-	assert((JU_JPDCDPOP0(Pjp) & 0xFFFFFFFF) == (cJU_LEAF4_MAXPOP1-1));
-
-//	Get the address of the Leaf
-	PLeaf = (uint32_t *) P_JLL(Pjp->jp_Addr);
-
-//	Extract 4 byte index Leaf to Word_t
-	j__udyCopy4toW(StageA, PLeaf, cJU_LEAF4_MAXPOP1);
-
-//	Get the address of the Leaf and Value area
-	JUDYLCODE(Pjv = JL_LEAF4VALUEAREA(PLeaf, cJU_LEAF4_MAXPOP1);)
-
-//  If Leaf is in 1 expanse -- just compress it (compare 1st, last & Index)
-
-	CIndex = StageA[0];
-	if (!JU_DIGITATSTATE(CIndex ^ StageA[cJU_LEAF4_MAXPOP1-1], 4))
-	{
-                Word_t DcdP0;
-		Pjll_t PjllRaw;	 // pointer to new leaf.
-		Pjll_t Pjll;
-      JUDYLCODE(Pjv_t  Pjvnew;)	 // value area of new Leaf.
-
-//		Alloc a 3 byte Index Leaf
-		PjllRaw = j__udyAllocJLL3(cJU_LEAF4_MAXPOP1, Pjpm);
-		if (PjllRaw == (Pjlb_t)NULL) return(-1);  // out of memory
-
-		Pjll = P_JLL(PjllRaw);
-
-//		Copy Index area into new Leaf
-		j__udyCopyWto3((uint8_t *) Pjll, StageA, cJU_LEAF4_MAXPOP1);
-#ifdef JUDYL
-//		Copy Value area into new Leaf
-		Pjvnew = JL_LEAF3VALUEAREA(Pjll, cJU_LEAF4_MAXPOP1);
-		JU_COPYMEM(Pjvnew, Pjv, cJU_LEAF4_MAXPOP1);
-#endif
-		DBGCODE(JudyCheckSorted(Pjll, cJU_LEAF4_MAXPOP1, 3);)
-
-	        DcdP0 = JU_JPDCDPOP0(Pjp) | (CIndex & cJU_DCDMASK(3));
-                JU_JPSETADT(Pjp, (Word_t)PjllRaw, DcdP0, cJU_JPLEAF3);
-
-		return(1);
-	}
-
-//  Else in 2+ expanses, splay Leaf into smaller leaves at higher compression
-
-	StageJBB = StageJBBZero;       // zero staged bitmap branch
-	ZEROJP(SubJPCount);
-
-//	Splay the 4 byte index Leaf to 3 byte Index Leaves
-	for (ExpCnt = Start = 0, End = 1; ; End++)
-	{
-//		Check if new expanse or last one
-		if (	(End == cJU_LEAF4_MAXPOP1)
-				||
-			(JU_DIGITATSTATE(CIndex ^ StageA[End], 4))
-		   )
-		{
-//			Build a leaf below the previous expanse
-
-			Pjp_t  PjpJP	= StageJP + ExpCnt;
-			Word_t Pop1	= End - Start;
-			Word_t expanse = JU_DIGITATSTATE(CIndex, 4);
-			Word_t subexp  = expanse / cJU_BITSPERSUBEXPB;
-//
-//                      set the bit that is the current expanse
-			JU_JBB_BITMAP(&StageJBB, subexp) |= JU_BITPOSMASKB(expanse);
-#ifdef SUBEXPCOUNTS
-			StageJBB.jbb_subPop1[subexp] += Pop1; // pop of subexpanse
-#endif
-//                      count number of expanses in each subexpanse
-			SubJPCount[subexp]++;
-
-//			Save byte expanse of leaf
-			StageExp[ExpCnt] = JU_DIGITATSTATE(CIndex, 4);
-
-			if (Pop1 == 1)	// cJU_JPIMMED_3_01
-			{
-	                    Word_t DcdP0;
-	                    DcdP0 = (JU_JPDCDPOP0(Pjp) & cJU_DCDMASK(3)) |
-                                CIndex;
-#ifdef JUDY1
-                            JU_JPSETADT(PjpJP, 0, DcdP0, cJ1_JPIMMED_3_01);
-#else   // JUDYL
-                            JU_JPSETADT(PjpJP, Pjv[Start], DcdP0,
-                                cJL_JPIMMED_3_01);
-#endif  // JUDYL
-			}
-			else if (Pop1 <= cJU_IMMED3_MAXPOP1)
-			{
-//		cJ1_JPIMMED_3_02   :  Judy1 32
-//		cJL_JPIMMED_3_02   :  JudyL 64
-//		cJ1_JPIMMED_3_02..5:  Judy1 64
-
-#ifdef JUDYL
-//				Alloc is 1st in case of malloc fail
-				Pjv_t PjvnewRaw;  // value area of new leaf.
-				Pjv_t Pjvnew;
-
-//				Allocate Value area for Immediate Leaf
-				PjvnewRaw = j__udyLAllocJV(Pop1, Pjpm);
-				if (PjvnewRaw == (Pjv_t) NULL)
-					FREEALLEXIT(ExpCnt, StageJP, Pjpm);
-
-				Pjvnew = P_JV(PjvnewRaw);
-
-//				Copy to Values to Value Leaf
-				JU_COPYMEM(Pjvnew, Pjv + Start, Pop1);
-				PjpJP->jp_Addr = (Word_t) PjvnewRaw;
-
-//				Copy to Index to JP as an immediate Leaf
-				j__udyCopyWto3(PjpJP->jp_LIndex,
-					       StageA + Start, Pop1);
-#else
-				j__udyCopyWto3(PjpJP->jp_1Index,
-					       StageA + Start, Pop1);
-#endif
-//				Set type, population and Index size
-				PjpJP->jp_Type = cJU_JPIMMED_3_02 + Pop1 - 2;
-			}
-			else
-			{
-//		cJU_JPLEAF3
-                                Word_t  DcdP0;
-				Pjll_t PjllRaw;	 // pointer to new leaf.
-				Pjll_t Pjll;
-		      JUDYLCODE(Pjv_t  Pjvnew;)	 // value area of new leaf.
-
-				PjllRaw = j__udyAllocJLL3(Pop1, Pjpm);
-				if (PjllRaw == (Pjll_t)NULL)
-					FREEALLEXIT(ExpCnt, StageJP, Pjpm);
-
-				Pjll = P_JLL(PjllRaw);
-
-//				Copy Indexes to new Leaf
-				j__udyCopyWto3((uint8_t *) Pjll, StageA + Start,
-					       Pop1);
-#ifdef JUDYL
-//				Copy to Values to new Leaf
-				Pjvnew = JL_LEAF3VALUEAREA(Pjll, Pop1);
-				JU_COPYMEM(Pjvnew, Pjv + Start, Pop1);
-#endif
-				DBGCODE(JudyCheckSorted(Pjll, Pop1, 3);)
-
-                                DcdP0 = (JU_JPDCDPOP0(Pjp) & cJU_DCDMASK(4)) 
-                                                |
-                                        (CIndex & cJU_DCDMASK(4-1)) 
-                                                |
-                                        (Pop1 - 1);
-
-                                JU_JPSETADT(PjpJP, (Word_t)PjllRaw, DcdP0,
-                                        cJU_JPLEAF3);
-			}
-			ExpCnt++;
-//                      Done?
-			if (End == cJU_LEAF4_MAXPOP1) break;
-
-//			New Expanse, Start and Count
-			CIndex = StageA[End];
-			Start  = End;
-		}
-	}
-
-//      Now put all the Leaves below a BranchL or BranchB:
-	if (ExpCnt <= cJU_BRANCHLMAXJPS) // put the Leaves below a BranchL
-	{
-	    if (j__udyCreateBranchL(Pjp, StageJP, StageExp, ExpCnt,
-			Pjpm) == -1) FREEALLEXIT(ExpCnt, StageJP, Pjpm);
-
-	    Pjp->jp_Type = cJU_JPBRANCH_L4;
-	}
-	else
-	{
-	    if (j__udyStageJBBtoJBB(Pjp, &StageJBB, StageJP, SubJPCount, Pjpm)
-		== -1) FREEALLEXIT(ExpCnt, StageJP, Pjpm);
-	}
-	return(1);
-
-}  // j__udyCascade4()
-
-
-// ****************************************************************************
-// __ J U D Y   C A S C A D E 5
-//
-// Cascade from a cJU_JPLEAF5 to one of the following:
-//  1. if leaf is in 1 expanse:
-//        compress it into a JPLEAF4
-//  2. if leaf contains multiple expanses:
-//        create linear or bitmap branch containing
-//        each new expanse is either a:
-//               JPIMMED_4_01  branch
-//               JPLEAF4
-
-FUNCTION int j__udyCascade5(
-	Pjp_t	   Pjp,
-	Pvoid_t	   Pjpm)
-{
-	uint8_t  * PLeaf;	// pointer to leaf, explicit type.
-	Word_t	   End, Start;	// temporaries.
-	Word_t	   ExpCnt;	// count of expanses of splay.
-	Word_t     CIndex;	// current Index word.
-JUDYLCODE(Pjv_t	   Pjv;)	// value area of leaf.
-
-//	Temp staging for parts(Leaves) of newly splayed leaf
-	jp_t	   StageJP   [cJU_LEAF5_MAXPOP1];  // JPs of new leaves
-	Word_t	   StageA    [cJU_LEAF5_MAXPOP1];
-	uint8_t	   StageExp  [cJU_LEAF5_MAXPOP1];  // Expanses of new leaves
-	uint8_t	   SubJPCount[cJU_NUMSUBEXPB];     // JPs in each subexpanse
-	jbb_t      StageJBB;                       // staged bitmap branch
-
-	assert(JU_JPTYPE(Pjp) == cJU_JPLEAF5);
-	assert((JU_JPDCDPOP0(Pjp) & 0xFFFFFFFFFF) == (cJU_LEAF5_MAXPOP1-1));
-
-//	Get the address of the Leaf
-	PLeaf = (uint8_t *) P_JLL(Pjp->jp_Addr);
-
-//	Extract 5 byte index Leaf to Word_t
-	j__udyCopy5toW(StageA, PLeaf, cJU_LEAF5_MAXPOP1);
-
-//	Get the address of the Leaf and Value area
-	JUDYLCODE(Pjv = JL_LEAF5VALUEAREA(PLeaf, cJU_LEAF5_MAXPOP1);)
-
-//  If Leaf is in 1 expanse -- just compress it (compare 1st, last & Index)
-
-	CIndex = StageA[0];
-	if (!JU_DIGITATSTATE(CIndex ^ StageA[cJU_LEAF5_MAXPOP1-1], 5))
-	{
-                Word_t DcdP0;
-		Pjll_t PjllRaw;	 // pointer to new leaf.
-		Pjll_t Pjll;
-      JUDYLCODE(Pjv_t  Pjvnew;)	 // value area of new leaf.
-
-//		Alloc a 4 byte Index Leaf
-		PjllRaw = j__udyAllocJLL4(cJU_LEAF5_MAXPOP1, Pjpm);
-		if (PjllRaw == (Pjlb_t)NULL) return(-1);  // out of memory
-
-		Pjll = P_JLL(PjllRaw);
-
-//		Copy Index area into new Leaf
-		j__udyCopyWto4((uint8_t *) Pjll, StageA, cJU_LEAF5_MAXPOP1);
-#ifdef JUDYL
-//		Copy Value area into new Leaf
-		Pjvnew = JL_LEAF4VALUEAREA(Pjll, cJU_LEAF5_MAXPOP1);
-		JU_COPYMEM(Pjvnew, Pjv, cJU_LEAF5_MAXPOP1);
-#endif
-		DBGCODE(JudyCheckSorted(Pjll, cJU_LEAF5_MAXPOP1, 4);)
-
-	        DcdP0 = JU_JPDCDPOP0(Pjp) | (CIndex & cJU_DCDMASK(4));
-                JU_JPSETADT(Pjp, (Word_t)PjllRaw, DcdP0, cJU_JPLEAF4);
-
-		return(1);
-	}
-
-//  Else in 2+ expanses, splay Leaf into smaller leaves at higher compression
-
-	StageJBB = StageJBBZero;       // zero staged bitmap branch
-	ZEROJP(SubJPCount);
-
-//	Splay the 5 byte index Leaf to 4 byte Index Leaves
-	for (ExpCnt = Start = 0, End = 1; ; End++)
-	{
-//		Check if new expanse or last one
-		if (	(End == cJU_LEAF5_MAXPOP1)
-				||
-			(JU_DIGITATSTATE(CIndex ^ StageA[End], 5))
-		   )
-		{
-//			Build a leaf below the previous expanse
-
-			Pjp_t  PjpJP	= StageJP + ExpCnt;
-			Word_t Pop1	= End - Start;
-			Word_t expanse = JU_DIGITATSTATE(CIndex, 5);
-			Word_t subexp  = expanse / cJU_BITSPERSUBEXPB;
-//
-//                      set the bit that is the current expanse
-			JU_JBB_BITMAP(&StageJBB, subexp) |= JU_BITPOSMASKB(expanse);
-#ifdef SUBEXPCOUNTS
-			StageJBB.jbb_subPop1[subexp] += Pop1; // pop of subexpanse
-#endif
-//                      count number of expanses in each subexpanse
-			SubJPCount[subexp]++;
-
-//			Save byte expanse of leaf
-			StageExp[ExpCnt] = JU_DIGITATSTATE(CIndex, 5);
-
-			if (Pop1 == 1)	// cJU_JPIMMED_4_01
-			{
-	                    Word_t DcdP0;
-	                    DcdP0 = (JU_JPDCDPOP0(Pjp) & cJU_DCDMASK(4)) |
-                                CIndex;
-#ifdef JUDY1
-                            JU_JPSETADT(PjpJP, 0, DcdP0, cJ1_JPIMMED_4_01);
-#else   // JUDYL
-                            JU_JPSETADT(PjpJP, Pjv[Start], DcdP0,
-                                cJL_JPIMMED_4_01);
-#endif  // JUDYL
-			}
-#ifdef JUDY1
-			else if (Pop1 <= cJ1_IMMED4_MAXPOP1)
-			{
-//		cJ1_JPIMMED_4_02..3: Judy1 64
-
-//                              Copy to Index to JP as an immediate Leaf
-				j__udyCopyWto4(PjpJP->jp_1Index,
-					       StageA + Start, Pop1);
-
-//                              Set pointer, type, population and Index size
-				PjpJP->jp_Type = cJ1_JPIMMED_4_02 + Pop1 - 2;
-			}
-#endif
-			else
-			{
-//		cJU_JPLEAF4
-                                Word_t  DcdP0;
-				Pjll_t PjllRaw;	 // pointer to new leaf.
-				Pjll_t Pjll;
-		      JUDYLCODE(Pjv_t  Pjvnew;)	 // value area of new leaf.
-
-//				Get a new Leaf
-				PjllRaw = j__udyAllocJLL4(Pop1, Pjpm);
-				if (PjllRaw == (Pjll_t)NULL)
-					FREEALLEXIT(ExpCnt, StageJP, Pjpm);
-
-				Pjll = P_JLL(PjllRaw);
-
-//				Copy Indexes to new Leaf
-				j__udyCopyWto4((uint8_t *) Pjll, StageA + Start,
-					       Pop1);
-#ifdef JUDYL
-//				Copy to Values to new Leaf
-				Pjvnew = JL_LEAF4VALUEAREA(Pjll, Pop1);
-				JU_COPYMEM(Pjvnew, Pjv + Start, Pop1);
-#endif
-				DBGCODE(JudyCheckSorted(Pjll, Pop1, 4);)
-
-                                DcdP0 = (JU_JPDCDPOP0(Pjp) & cJU_DCDMASK(5)) 
-                                                |
-                                        (CIndex & cJU_DCDMASK(5-1)) 
-                                                |
-                                        (Pop1 - 1);
-
-                                JU_JPSETADT(PjpJP, (Word_t)PjllRaw, DcdP0,
-                                        cJU_JPLEAF4);
-			}
-			ExpCnt++;
-//                      Done?
-			if (End == cJU_LEAF5_MAXPOP1) break;
-
-//			New Expanse, Start and Count
-			CIndex = StageA[End];
-			Start  = End;
-		}
-	}
-
-//      Now put all the Leaves below a BranchL or BranchB:
-	if (ExpCnt <= cJU_BRANCHLMAXJPS) // put the Leaves below a BranchL
-	{
-	    if (j__udyCreateBranchL(Pjp, StageJP, StageExp, ExpCnt,
-			Pjpm) == -1) FREEALLEXIT(ExpCnt, StageJP, Pjpm);
-
-	    Pjp->jp_Type = cJU_JPBRANCH_L5;
-	}
-	else
-	{
-	    if (j__udyStageJBBtoJBB(Pjp, &StageJBB, StageJP, SubJPCount, Pjpm)
-		== -1) FREEALLEXIT(ExpCnt, StageJP, Pjpm);
-	}
-	return(1);
-
-}  // j__udyCascade5()
-
-
-// ****************************************************************************
-// __ J U D Y   C A S C A D E 6
-//
-// Cascade from a cJU_JPLEAF6 to one of the following:
-//  1. if leaf is in 1 expanse:
-//        compress it into a JPLEAF5
-//  2. if leaf contains multiple expanses:
-//        create linear or bitmap branch containing
-//        each new expanse is either a:
-//               JPIMMED_5_01 ... JPIMMED_5_03  branch
-//               JPIMMED_5_01  branch
-//               JPLEAF5
-
-FUNCTION int j__udyCascade6(
-	Pjp_t	   Pjp,
-	Pvoid_t	   Pjpm)
-{
-	uint8_t  * PLeaf;	// pointer to leaf, explicit type.
-	Word_t	   End, Start;	// temporaries.
-	Word_t	   ExpCnt;	// count of expanses of splay.
-	Word_t     CIndex;	// current Index word.
-JUDYLCODE(Pjv_t	   Pjv;)	// value area of leaf.
-
-//	Temp staging for parts(Leaves) of newly splayed leaf
-	jp_t	   StageJP   [cJU_LEAF6_MAXPOP1];  // JPs of new leaves
-	Word_t	   StageA    [cJU_LEAF6_MAXPOP1];
-	uint8_t	   StageExp  [cJU_LEAF6_MAXPOP1];  // Expanses of new leaves
-	uint8_t	   SubJPCount[cJU_NUMSUBEXPB];     // JPs in each subexpanse
-	jbb_t      StageJBB;                       // staged bitmap branch
-
-	assert(JU_JPTYPE(Pjp) == cJU_JPLEAF6);
-	assert((JU_JPDCDPOP0(Pjp) & 0xFFFFFFFFFFFF) == (cJU_LEAF6_MAXPOP1-1));
-
-//	Get the address of the Leaf
-	PLeaf = (uint8_t *) P_JLL(Pjp->jp_Addr);
-
-//	Extract 6 byte index Leaf to Word_t
-	j__udyCopy6toW(StageA, PLeaf, cJU_LEAF6_MAXPOP1);
-
-//	Get the address of the Leaf and Value area
-	JUDYLCODE(Pjv = JL_LEAF6VALUEAREA(PLeaf, cJU_LEAF6_MAXPOP1);)
-
-//  If Leaf is in 1 expanse -- just compress it (compare 1st, last & Index)
-
-	CIndex = StageA[0];
-	if (!JU_DIGITATSTATE(CIndex ^ StageA[cJU_LEAF6_MAXPOP1-1], 6))
-	{
-                Word_t DcdP0;
-		Pjll_t PjllRaw;	 // pointer to new leaf.
-		Pjll_t Pjll;
-      JUDYLCODE(Pjv_t  Pjvnew;)	 // value area of new leaf.
-
-//		Alloc a 5 byte Index Leaf
-		PjllRaw = j__udyAllocJLL5(cJU_LEAF6_MAXPOP1, Pjpm);
-		if (PjllRaw == (Pjlb_t)NULL) return(-1);  // out of memory
-
-		Pjll = P_JLL(PjllRaw);
-
-//		Copy Index area into new Leaf
-		j__udyCopyWto5((uint8_t *) Pjll, StageA, cJU_LEAF6_MAXPOP1);
-#ifdef JUDYL
-//		Copy Value area into new Leaf
-		Pjvnew = JL_LEAF5VALUEAREA(Pjll, cJU_LEAF6_MAXPOP1);
-		JU_COPYMEM(Pjvnew, Pjv, cJU_LEAF6_MAXPOP1);
-#endif
-		DBGCODE(JudyCheckSorted(Pjll, cJU_LEAF6_MAXPOP1, 5);)
-
-	        DcdP0 = JU_JPDCDPOP0(Pjp) | (CIndex & cJU_DCDMASK(5));
-                JU_JPSETADT(Pjp, (Word_t)PjllRaw, DcdP0, cJU_JPLEAF5);
-
-		return(1);
-	}
-
-//  Else in 2+ expanses, splay Leaf into smaller leaves at higher compression
-
-	StageJBB = StageJBBZero;       // zero staged bitmap branch
-	ZEROJP(SubJPCount);
-
-//	Splay the 6 byte index Leaf to 5 byte Index Leaves
-	for (ExpCnt = Start = 0, End = 1; ; End++)
-	{
-//		Check if new expanse or last one
-		if (	(End == cJU_LEAF6_MAXPOP1)
-				||
-			(JU_DIGITATSTATE(CIndex ^ StageA[End], 6))
-		   )
-		{
-//			Build a leaf below the previous expanse
-
-			Pjp_t  PjpJP	= StageJP + ExpCnt;
-			Word_t Pop1	= End - Start;
-			Word_t expanse = JU_DIGITATSTATE(CIndex, 6);
-			Word_t subexp  = expanse / cJU_BITSPERSUBEXPB;
-//
-//                      set the bit that is the current expanse
-			JU_JBB_BITMAP(&StageJBB, subexp) |= JU_BITPOSMASKB(expanse);
-#ifdef SUBEXPCOUNTS
-			StageJBB.jbb_subPop1[subexp] += Pop1; // pop of subexpanse
-#endif
-//                      count number of expanses in each subexpanse
-			SubJPCount[subexp]++;
-
-//			Save byte expanse of leaf
-			StageExp[ExpCnt] = JU_DIGITATSTATE(CIndex, 6);
-
-			if (Pop1 == 1)	// cJU_JPIMMED_5_01
-			{
-	                    Word_t DcdP0;
-	                    DcdP0 = (JU_JPDCDPOP0(Pjp) & cJU_DCDMASK(5)) |
-                                CIndex;
-#ifdef JUDY1
-                            JU_JPSETADT(PjpJP, 0, DcdP0, cJ1_JPIMMED_5_01);
-#else   // JUDYL
-                            JU_JPSETADT(PjpJP, Pjv[Start], DcdP0,
-                                cJL_JPIMMED_5_01);
-#endif  // JUDYL
-			}
-#ifdef JUDY1
-			else if (Pop1 <= cJ1_IMMED5_MAXPOP1)
-			{
-//		cJ1_JPIMMED_5_02..3: Judy1 64
-
-//                              Copy to Index to JP as an immediate Leaf
-				j__udyCopyWto5(PjpJP->jp_1Index,
-					       StageA + Start, Pop1);
-
-//                              Set pointer, type, population and Index size
-				PjpJP->jp_Type = cJ1_JPIMMED_5_02 + Pop1 - 2;
-			}
-#endif
-			else
-			{
-//		cJU_JPLEAF5
-                                Word_t  DcdP0;
-				Pjll_t PjllRaw;	 // pointer to new leaf.
-				Pjll_t Pjll;
-		      JUDYLCODE(Pjv_t  Pjvnew;)	 // value area of new leaf.
-
-//				Get a new Leaf
-				PjllRaw = j__udyAllocJLL5(Pop1, Pjpm);
-				if (PjllRaw == (Pjll_t)NULL)
-					FREEALLEXIT(ExpCnt, StageJP, Pjpm);
-
-				Pjll = P_JLL(PjllRaw);
-
-//				Copy Indexes to new Leaf
-				j__udyCopyWto5((uint8_t *) Pjll, StageA + Start,
-					       Pop1);
-
-//				Copy to Values to new Leaf
-#ifdef JUDYL
-				Pjvnew = JL_LEAF5VALUEAREA(Pjll, Pop1);
-				JU_COPYMEM(Pjvnew, Pjv + Start, Pop1);
-#endif
-				DBGCODE(JudyCheckSorted(Pjll, Pop1, 5);)
-
-                                DcdP0 = (JU_JPDCDPOP0(Pjp) & cJU_DCDMASK(6)) 
-                                                |
-                                        (CIndex & cJU_DCDMASK(6-1)) 
-                                                |
-                                        (Pop1 - 1);
-
-                                JU_JPSETADT(PjpJP, (Word_t)PjllRaw, DcdP0,
-                                        cJU_JPLEAF5);
-			}
-			ExpCnt++;
-//                      Done?
-			if (End == cJU_LEAF6_MAXPOP1) break;
-
-//			New Expanse, Start and Count
-			CIndex = StageA[End];
-			Start  = End;
-		}
-	}
-
-//      Now put all the Leaves below a BranchL or BranchB:
-	if (ExpCnt <= cJU_BRANCHLMAXJPS) // put the Leaves below a BranchL
-	{
-	    if (j__udyCreateBranchL(Pjp, StageJP, StageExp, ExpCnt,
-			Pjpm) == -1) FREEALLEXIT(ExpCnt, StageJP, Pjpm);
-
-	    Pjp->jp_Type = cJU_JPBRANCH_L6;
-	}
-	else
-	{
-	    if (j__udyStageJBBtoJBB(Pjp, &StageJBB, StageJP, SubJPCount, Pjpm)
-		== -1) FREEALLEXIT(ExpCnt, StageJP, Pjpm);
-	}
-	return(1);
-
-}  // j__udyCascade6()
-
-
-// ****************************************************************************
-// __ J U D Y   C A S C A D E 7
-//
-// Cascade from a cJU_JPLEAF7 to one of the following:
-//  1. if leaf is in 1 expanse:
-//        compress it into a JPLEAF6
-//  2. if leaf contains multiple expanses:
-//        create linear or bitmap branch containing
-//        each new expanse is either a:
-//               JPIMMED_6_01 ... JPIMMED_6_02  branch
-//               JPIMMED_6_01  branch
-//               JPLEAF6
-
-FUNCTION int j__udyCascade7(
-	Pjp_t	   Pjp,
-	Pvoid_t	   Pjpm)
-{
-	uint8_t  * PLeaf;	// pointer to leaf, explicit type.
-	Word_t	   End, Start;	// temporaries.
-	Word_t	   ExpCnt;	// count of expanses of splay.
-	Word_t     CIndex;	// current Index word.
-JUDYLCODE(Pjv_t	   Pjv;)	// value area of leaf.
-
-//	Temp staging for parts(Leaves) of newly splayed leaf
-	jp_t	   StageJP   [cJU_LEAF7_MAXPOP1];  // JPs of new leaves
-	Word_t	   StageA    [cJU_LEAF7_MAXPOP1];
-	uint8_t	   StageExp  [cJU_LEAF7_MAXPOP1];  // Expanses of new leaves
-	uint8_t	   SubJPCount[cJU_NUMSUBEXPB];     // JPs in each subexpanse
-	jbb_t      StageJBB;                       // staged bitmap branch
-
-	assert(JU_JPTYPE(Pjp) == cJU_JPLEAF7);
-	assert(JU_JPDCDPOP0(Pjp) == (cJU_LEAF7_MAXPOP1-1));
-
-//	Get the address of the Leaf
-	PLeaf = (uint8_t *) P_JLL(Pjp->jp_Addr);
-
-//	Extract 7 byte index Leaf to Word_t
-	j__udyCopy7toW(StageA, PLeaf, cJU_LEAF7_MAXPOP1);
-
-//	Get the address of the Leaf and Value area
-	JUDYLCODE(Pjv = JL_LEAF7VALUEAREA(PLeaf, cJU_LEAF7_MAXPOP1);)
-
-//  If Leaf is in 1 expanse -- just compress it (compare 1st, last & Index)
-
-	CIndex = StageA[0];
-	if (!JU_DIGITATSTATE(CIndex ^ StageA[cJU_LEAF7_MAXPOP1-1], 7))
-	{
-                Word_t DcdP0;
-		Pjll_t PjllRaw;	 // pointer to new leaf.
-		Pjll_t Pjll;
-      JUDYLCODE(Pjv_t  Pjvnew;)	 // value area of new leaf.
-
-//		Alloc a 6 byte Index Leaf
-		PjllRaw = j__udyAllocJLL6(cJU_LEAF7_MAXPOP1, Pjpm);
-		if (PjllRaw == (Pjlb_t)NULL) return(-1);  // out of memory
-
-		Pjll = P_JLL(PjllRaw);
-
-//		Copy Index area into new Leaf
-		j__udyCopyWto6((uint8_t *) Pjll, StageA, cJU_LEAF7_MAXPOP1);
-#ifdef JUDYL
-//		Copy Value area into new Leaf
-		Pjvnew = JL_LEAF6VALUEAREA(Pjll, cJU_LEAF7_MAXPOP1);
-		JU_COPYMEM(Pjvnew, Pjv, cJU_LEAF7_MAXPOP1);
-#endif
-		DBGCODE(JudyCheckSorted(Pjll, cJU_LEAF7_MAXPOP1, 6);)
-
-	        DcdP0 = JU_JPDCDPOP0(Pjp) | (CIndex & cJU_DCDMASK(6));
-                JU_JPSETADT(Pjp, (Word_t)PjllRaw, DcdP0, cJU_JPLEAF6);
-
-		return(1);
-	}
-
-//  Else in 2+ expanses, splay Leaf into smaller leaves at higher compression
-
-	StageJBB = StageJBBZero;       // zero staged bitmap branch
-	ZEROJP(SubJPCount);
-
-//	Splay the 7 byte index Leaf to 6 byte Index Leaves
-	for (ExpCnt = Start = 0, End = 1; ; End++)
-	{
-//		Check if new expanse or last one
-		if (	(End == cJU_LEAF7_MAXPOP1)
-				||
-			(JU_DIGITATSTATE(CIndex ^ StageA[End], 7))
-		   )
-		{
-//			Build a leaf below the previous expanse
-
-			Pjp_t  PjpJP	= StageJP + ExpCnt;
-			Word_t Pop1	= End - Start;
-			Word_t expanse = JU_DIGITATSTATE(CIndex, 7);
-			Word_t subexp  = expanse / cJU_BITSPERSUBEXPB;
-//
-//                      set the bit that is the current expanse
-			JU_JBB_BITMAP(&StageJBB, subexp) |= JU_BITPOSMASKB(expanse);
-#ifdef SUBEXPCOUNTS
-			StageJBB.jbb_subPop1[subexp] += Pop1; // pop of subexpanse
-#endif
-//                      count number of expanses in each subexpanse
-			SubJPCount[subexp]++;
-
-//			Save byte expanse of leaf
-			StageExp[ExpCnt] = JU_DIGITATSTATE(CIndex, 7);
-
-			if (Pop1 == 1)	// cJU_JPIMMED_6_01
-			{
-	                    Word_t DcdP0;
-	                    DcdP0 = (JU_JPDCDPOP0(Pjp) & cJU_DCDMASK(6)) |
-                                CIndex;
-#ifdef JUDY1
-                            JU_JPSETADT(PjpJP, 0, DcdP0, cJ1_JPIMMED_6_01);
-#else   // JUDYL
-                            JU_JPSETADT(PjpJP, Pjv[Start], DcdP0,
-                                cJL_JPIMMED_6_01);
-#endif  // JUDYL
-			}
-#ifdef JUDY1
-			else if (Pop1 == cJ1_IMMED6_MAXPOP1)
-			{
-//		cJ1_JPIMMED_6_02:    Judy1 64
-
-//                              Copy to Index to JP as an immediate Leaf
-				j__udyCopyWto6(PjpJP->jp_1Index,
-					       StageA + Start, 2);
-
-//                              Set pointer, type, population and Index size
-				PjpJP->jp_Type = cJ1_JPIMMED_6_02;
-			}
-#endif
-			else
-			{
-//		cJU_JPLEAF6
-                                Word_t  DcdP0;
-				Pjll_t PjllRaw;	 // pointer to new leaf.
-				Pjll_t Pjll;
-		      JUDYLCODE(Pjv_t  Pjvnew;)	 // value area of new leaf.
-
-//				Get a new Leaf
-				PjllRaw = j__udyAllocJLL6(Pop1, Pjpm);
-				if (PjllRaw == (Pjll_t)NULL)
-					FREEALLEXIT(ExpCnt, StageJP, Pjpm);
-				Pjll = P_JLL(PjllRaw);
-
-//				Copy Indexes to new Leaf
-				j__udyCopyWto6((uint8_t *) Pjll, StageA + Start,
-					       Pop1);
-#ifdef JUDYL
-//				Copy to Values to new Leaf
-				Pjvnew = JL_LEAF6VALUEAREA(Pjll, Pop1);
-				JU_COPYMEM(Pjvnew, Pjv + Start, Pop1);
-#endif
-				DBGCODE(JudyCheckSorted(Pjll, Pop1, 6);)
-
-                                DcdP0 = (JU_JPDCDPOP0(Pjp) & cJU_DCDMASK(7)) 
-                                                |
-                                        (CIndex & cJU_DCDMASK(7-1)) 
-                                                |
-                                        (Pop1 - 1);
-
-                                JU_JPSETADT(PjpJP, (Word_t)PjllRaw, DcdP0,
-                                        cJU_JPLEAF6);
-			}
-			ExpCnt++;
-//                      Done?
-			if (End == cJU_LEAF7_MAXPOP1) break;
-
-//			New Expanse, Start and Count
-			CIndex = StageA[End];
-			Start  = End;
-		}
-	}
-
-//      Now put all the Leaves below a BranchL or BranchB:
-	if (ExpCnt <= cJU_BRANCHLMAXJPS) // put the Leaves below a BranchL
-	{
-	    if (j__udyCreateBranchL(Pjp, StageJP, StageExp, ExpCnt,
-			Pjpm) == -1) FREEALLEXIT(ExpCnt, StageJP, Pjpm);
-
-	    Pjp->jp_Type = cJU_JPBRANCH_L7;
-	}
-	else
-	{
-	    if (j__udyStageJBBtoJBB(Pjp, &StageJBB, StageJP, SubJPCount, Pjpm)
-		== -1) FREEALLEXIT(ExpCnt, StageJP, Pjpm);
-	}
-	return(1);
-
-}  // j__udyCascade7()
-
-#endif // JU_64BIT
-
-
-// ****************************************************************************
-// __ J U D Y   C A S C A D E   L
-//
-// (Compressed) cJU_LEAF3[7], cJ1_JPBRANCH_L.
-//
-// Cascade from a LEAFW (under Pjp) to one of the following:
-//  1. if LEAFW is in 1 expanse:
-//        create linear branch with a JPLEAF3[7] under it
-//  2. LEAFW contains multiple expanses:
-//        create linear or bitmap branch containing new expanses
-//        each new expanse is either a: 32   64
-//               JPIMMED_3_01  branch    Y    N
-//               JPIMMED_7_01  branch    N    Y
-//               JPLEAF3                 Y    N
-//               JPLEAF7                 N    Y
-
-FUNCTION int j__udyCascadeL(
-	Pjp_t	   Pjp,
-	Pvoid_t	   Pjpm)
-{
-	Pjlw_t	   Pjlw;	// leaf to work on.
-	Word_t	   End, Start;	// temporaries.
-	Word_t	   ExpCnt;	// count of expanses of splay.
-	Word_t	   CIndex;	// current Index word.
-JUDYLCODE(Pjv_t	   Pjv;)	// value area of leaf.
-
-//	Temp staging for parts(Leaves) of newly splayed leaf
-	jp_t	StageJP [cJU_LEAFW_MAXPOP1];
-	uint8_t	StageExp[cJU_LEAFW_MAXPOP1];
-	uint8_t	   SubJPCount[cJU_NUMSUBEXPB];     // JPs in each subexpanse
-	jbb_t      StageJBB;                       // staged bitmap branch
-
-//	Get the address of the Leaf
-	Pjlw = P_JLW(Pjp->jp_Addr);
-
-	assert(Pjlw[0] == (cJU_LEAFW_MAXPOP1 - 1));
-
-//	Get pointer to Value area of old Leaf
-	JUDYLCODE(Pjv = JL_LEAFWVALUEAREA(Pjlw, cJU_LEAFW_MAXPOP1);)
-
-	Pjlw++;		// Now point to Index area
-
-// If Leaf is in 1 expanse -- first compress it (compare 1st, last & Index):
-
-	CIndex = Pjlw[0];	// also used far below
-	if (!JU_DIGITATSTATE(CIndex ^ Pjlw[cJU_LEAFW_MAXPOP1 - 1],
-			     cJU_ROOTSTATE))
-	{
-		Pjll_t PjllRaw;		// pointer to new leaf.
-		Pjll_t Pjll;
-      JUDYLCODE(Pjv_t  Pjvnew;)		// value area of new leaf.
-
-//		Get the common expanse to all elements in Leaf
-		StageExp[0] = JU_DIGITATSTATE(CIndex, cJU_ROOTSTATE);
-
-//		Alloc a 3[7] byte Index Leaf
-#ifdef JU_64BIT
-		PjllRaw	= j__udyAllocJLL7(cJU_LEAFW_MAXPOP1, Pjpm);
-		if (PjllRaw == (Pjlb_t)NULL) return(-1);  // out of memory
-
-		Pjll = P_JLL(PjllRaw);
-
-//		Copy LEAFW to a cJU_JPLEAF7
-		j__udyCopyWto7((uint8_t *) Pjll, Pjlw, cJU_LEAFW_MAXPOP1);
-#ifdef JUDYL
-//		Get the Value area of new Leaf
-		Pjvnew = JL_LEAF7VALUEAREA(Pjll, cJU_LEAFW_MAXPOP1);
-		JU_COPYMEM(Pjvnew, Pjv, cJU_LEAFW_MAXPOP1);
-#endif
-		DBGCODE(JudyCheckSorted(Pjll, cJU_LEAFW_MAXPOP1, 7);)
-#else // 32 Bit
-		PjllRaw	= j__udyAllocJLL3(cJU_LEAFW_MAXPOP1, Pjpm);
-		if (PjllRaw == (Pjll_t) NULL) return(-1);
-
-		Pjll = P_JLL(PjllRaw);
-
-//		Copy LEAFW to a cJU_JPLEAF3
-		j__udyCopyWto3((uint8_t *) Pjll, Pjlw, cJU_LEAFW_MAXPOP1);
-#ifdef JUDYL
-//		Get the Value area of new Leaf
-		Pjvnew = JL_LEAF3VALUEAREA(Pjll, cJU_LEAFW_MAXPOP1);
-		JU_COPYMEM(Pjvnew, Pjv, cJU_LEAFW_MAXPOP1);
-#endif
-		DBGCODE(JudyCheckSorted(Pjll, cJU_LEAFW_MAXPOP1, 3);)
-#endif  // 32 Bit
-
-//		Following not needed because cJU_DCDMASK(3[7]) is == 0
-//////		StageJP[0].jp_DcdPopO	|= (CIndex & cJU_DCDMASK(3[7]));
-#ifdef JU_64BIT
-                JU_JPSETADT(&(StageJP[0]), (Word_t)PjllRaw, cJU_LEAFW_MAXPOP1-1,
-                                cJU_JPLEAF7);
-#else   // 32BIT
-                JU_JPSETADT(&(StageJP[0]), (Word_t)PjllRaw, cJU_LEAFW_MAXPOP1-1,
-                                cJU_JPLEAF3);
-#endif  // 32BIT
-//		Create a 1 element Linear branch
-		if (j__udyCreateBranchL(Pjp, StageJP, StageExp, 1, Pjpm) == -1)
-		    return(-1);
-
-//		Change the type of callers JP
-		Pjp->jp_Type = cJU_JPBRANCH_L;
-
-		return(1);
-	}
-
-//  Else in 2+ expanses, splay Leaf into smaller leaves at higher compression
-
-	StageJBB = StageJBBZero;       // zero staged bitmap branch
-	ZEROJP(SubJPCount);
-
-//	Splay the 4[8] byte Index Leaf to 3[7] byte Index Leaves
-	for (ExpCnt = Start = 0, End = 1; ; End++)
-	{
-//		Check if new expanse or last one
-		if (	(End == cJU_LEAFW_MAXPOP1)
-				||
-			(JU_DIGITATSTATE(CIndex ^ Pjlw[End], cJU_ROOTSTATE))
-		   )
-		{
-//			Build a leaf below the previous expanse
-
-			Pjp_t  PjpJP	= StageJP + ExpCnt;
-			Word_t Pop1	= End - Start;
-			Word_t expanse = JU_DIGITATSTATE(CIndex, cJU_ROOTSTATE);
-			Word_t subexp  = expanse / cJU_BITSPERSUBEXPB;
-//
-//                      set the bit that is the current expanse
-			JU_JBB_BITMAP(&StageJBB, subexp) |= JU_BITPOSMASKB(expanse);
-#ifdef SUBEXPCOUNTS
-			StageJBB.jbb_subPop1[subexp] += Pop1; // pop of subexpanse
-#endif
-//                      count number of expanses in each subexpanse
-			SubJPCount[subexp]++;
-
-//			Save byte expanse of leaf
-			StageExp[ExpCnt] = JU_DIGITATSTATE(CIndex,
-							   cJU_ROOTSTATE);
-
-			if (Pop1 == 1)	// cJU_JPIMMED_3[7]_01
-			{
-#ifdef  JU_64BIT
-#ifdef JUDY1
-                            JU_JPSETADT(PjpJP, 0, CIndex, cJ1_JPIMMED_7_01);
-#else   // JUDYL
-                            JU_JPSETADT(PjpJP, Pjv[Start], CIndex,
-                                cJL_JPIMMED_7_01);
-#endif  // JUDYL
-
-#else   // JU_32BIT
-#ifdef JUDY1
-                            JU_JPSETADT(PjpJP, 0, CIndex, cJ1_JPIMMED_3_01);
-#else   // JUDYL
-                            JU_JPSETADT(PjpJP, Pjv[Start], CIndex,
-                                cJL_JPIMMED_3_01);
-#endif  // JUDYL
-#endif  // JU_32BIT
-			}
-#ifdef JUDY1
-#ifdef  JU_64BIT
-			else if (Pop1 <= cJ1_IMMED7_MAXPOP1)
-#else
-			else if (Pop1 <= cJ1_IMMED3_MAXPOP1)
-#endif
-			{
-//		cJ1_JPIMMED_3_02   :  Judy1 32
-//		cJ1_JPIMMED_7_02   :  Judy1 64
-//                              Copy to JP as an immediate Leaf
-#ifdef  JU_64BIT
-				j__udyCopyWto7(PjpJP->jp_1Index, Pjlw+Start, 2);
-				PjpJP->jp_Type = cJ1_JPIMMED_7_02;
-#else
-				j__udyCopyWto3(PjpJP->jp_1Index, Pjlw+Start, 2);
-				PjpJP->jp_Type = cJ1_JPIMMED_3_02;
-#endif // 32 Bit
-			}
-#endif // JUDY1
-			else // Linear Leaf JPLEAF3[7]
-			{
-//		cJU_JPLEAF3[7]
-				Pjll_t PjllRaw;	 // pointer to new leaf.
-				Pjll_t Pjll;
-		      JUDYLCODE(Pjv_t  Pjvnew;)	 // value area of new leaf.
-#ifdef JU_64BIT
-				PjllRaw = j__udyAllocJLL7(Pop1, Pjpm);
-				if (PjllRaw == (Pjll_t) NULL) return(-1);
-				Pjll = P_JLL(PjllRaw);
-
-				j__udyCopyWto7((uint8_t *) Pjll, Pjlw + Start,
-					       Pop1);
-#ifdef JUDYL
-				Pjvnew = JL_LEAF7VALUEAREA(Pjll, Pop1);
-				JU_COPYMEM(Pjvnew, Pjv + Start, Pop1);
-#endif // JUDYL
-				DBGCODE(JudyCheckSorted(Pjll, Pop1, 7);)
-#else // JU_64BIT - 32 Bit
-				PjllRaw = j__udyAllocJLL3(Pop1, Pjpm);
-				if (PjllRaw == (Pjll_t) NULL) return(-1);
-				Pjll = P_JLL(PjllRaw);
-
-				j__udyCopyWto3((uint8_t *) Pjll, Pjlw + Start,
-					       Pop1);
-#ifdef JUDYL
-				Pjvnew = JL_LEAF3VALUEAREA(Pjll, Pop1);
-				JU_COPYMEM(Pjvnew, Pjv + Start, Pop1);
-#endif // JUDYL
-				DBGCODE(JudyCheckSorted(Pjll, Pop1, 3);)
-#endif // 32 Bit
-
-#ifdef JU_64BIT
-                                JU_JPSETADT(PjpJP, (Word_t)PjllRaw, Pop1 - 1,
-                                        cJU_JPLEAF7);
-#else // JU_64BIT - 32 Bit
-                                JU_JPSETADT(PjpJP, (Word_t)PjllRaw, Pop1 - 1,
-                                        cJU_JPLEAF3);
-#endif // 32 Bit
-			}
-			ExpCnt++;
-//                      Done?
-			if (End == cJU_LEAFW_MAXPOP1) break;
-
-//			New Expanse, Start and Count
-			CIndex = Pjlw[End];
-			Start  = End;
-		}
-	}
-
-// Now put all the Leaves below a BranchL or BranchB:
-	if (ExpCnt <= cJU_BRANCHLMAXJPS) // put the Leaves below a BranchL
-	{
-	    if (j__udyCreateBranchL(Pjp, StageJP, StageExp, ExpCnt,
-			Pjpm) == -1) FREEALLEXIT(ExpCnt, StageJP, Pjpm);
-
-	    Pjp->jp_Type = cJU_JPBRANCH_L;
-	}
-	else
-	{
-	    if (j__udyStageJBBtoJBB(Pjp, &StageJBB, StageJP, SubJPCount, Pjpm)
-		== -1) FREEALLEXIT(ExpCnt, StageJP, Pjpm);
-
-	    Pjp->jp_Type = cJU_JPBRANCH_B;  // cJU_LEAFW is out of sequence
-	}
-	return(1);
-
-} // j__udyCascadeL()
diff --git a/libs/klib/judy/JudyCount.c b/libs/klib/judy/JudyCount.c
deleted file mode 100644
index a8a6eb1..0000000
--- a/libs/klib/judy/JudyCount.c
+++ /dev/null
@@ -1,1193 +0,0 @@
-// Copyright (C) 2000 - 2002 Hewlett-Packard Company
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the term of the GNU Lesser 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 Lesser General Public License
-// for more details.
-//
-// You should have received a copy of the GNU Lesser 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
-// _________________
-
-// Judy*Count() function for Judy1 and JudyL.
-// Compile with one of -DJUDY1 or -DJUDYL.
-//
-// Compile with -DNOSMARTJBB, -DNOSMARTJBU, and/or -DNOSMARTJLB to build a
-// version with cache line optimizations deleted, for testing.
-//
-// Compile with -DSMARTMETRICS to obtain global variables containing smart
-// cache line metrics.  Note:  Dont turn this on simultaneously for this file
-// and JudyByCount.c because they export the same globals.
-//
-// Judy*Count() returns the "count of Indexes" (inclusive) between the two
-// specified limits (Indexes).  This code is remarkably fast.  It traverses the
-// "Judy array" data structure.
-//
-// This count code is the GENERIC untuned version (minimum code size).  It
-// might be possible to tuned to a specific architecture to be faster.
-// However, in real applications, with a modern machine, it is expected that
-// the instruction times will be swamped by cache line fills.
-// ****************************************************************************
-
-#if (! (defined(JUDY1) || defined(JUDYL)))
-#error:  One of -DJUDY1 or -DJUDYL must be specified.
-#endif
-
-#ifdef JUDY1
-#include "Judy1.h"
-#else
-#include "JudyL.h"
-#endif
-
-#include "JudyPrivate1L.h"
-
-
-// define a phoney that is for sure
-
-#define cJU_LEAFW       cJU_JPIMMED_CAP
-
-// Avoid duplicate symbols since this file is multi-compiled:
-
-#ifdef SMARTMETRICS
-#ifdef JUDY1
-Word_t jbb_upward   = 0;	// counts of directions taken:
-Word_t jbb_downward = 0;
-Word_t jbu_upward   = 0;
-Word_t jbu_downward = 0;
-Word_t jlb_upward   = 0;
-Word_t jlb_downward = 0;
-#else
-extern Word_t jbb_upward;
-extern Word_t jbb_downward;
-extern Word_t jbu_upward;
-extern Word_t jbu_downward;
-extern Word_t jlb_upward;
-extern Word_t jlb_downward;
-#endif
-#endif
-
-
-// FORWARD DECLARATIONS (prototypes):
-
-static	Word_t j__udy1LCountSM(const Pjp_t Pjp, const Word_t Index,
-			       const Pjpm_t Pjpm);
-
-// Each of Judy1 and JudyL get their own private (static) version of this
-// function:
-
-static	int j__udyCountLeafB1(const Pjll_t Pjll, const Word_t Pop1,
-			      const Word_t Index);
-
-// These functions are not static because they are exported to Judy*ByCount():
-//
-// TBD:  Should be made static for performance reasons?  And thus duplicated?
-//
-// Note:  There really are two different functions, but for convenience they
-// are referred to here with a generic name.
-
-#ifdef JUDY1
-#define	j__udyJPPop1 j__udy1JPPop1
-#else
-#define	j__udyJPPop1 j__udyLJPPop1
-#endif
-
-Word_t j__udyJPPop1(const Pjp_t Pjp);
-
-
-// LOCAL ERROR HANDLING:
-//
-// The Judy*Count() functions are unusual because they return 0 instead of JERR
-// for an error.  In this source file, define C_JERR for clarity.
-
-#define	C_JERR 0
-
-
-// ****************************************************************************
-// J U D Y   1   C O U N T
-// J U D Y   L   C O U N T
-//
-// See the manual entry for details.
-//
-// This code is written recursively, at least at first, because thats much
-// simpler; hope its fast enough.
-
-#ifdef JUDY1
-FUNCTION Word_t Judy1Count
-#else
-FUNCTION Word_t JudyLCount
-#endif
-        (
-	Pcvoid_t  PArray,	// JRP to first branch/leaf in SM.
-	Word_t	  Index1,	// starting Index.
-	Word_t	  Index2,	// ending Index.
-	PJError_t PJError	// optional, for returning error info.
-        )
-{
-	jpm_t	  fakejpm;	// local temporary for small arrays.
-	Pjpm_t	  Pjpm;		// top JPM or local temporary for error info.
-	jp_t	  fakejp;	// constructed for calling j__udy1LCountSM().
-	Pjp_t	  Pjp;		// JP to pass to j__udy1LCountSM().
-	Word_t	  pop1;		// total for the array.
-	Word_t	  pop1above1;	// indexes at or above Index1, inclusive.
-	Word_t	  pop1above2;	// indexes at or above Index2, exclusive.
-	int	  retcode;	// from Judy*First() calls.
-JUDYLCODE(PPvoid_t PPvalue);	// from JudyLFirst() calls.
-
-
-// CHECK FOR SHORTCUTS:
-//
-// As documented, return C_JERR if the Judy array is empty or Index1 > Index2.
-
-	if ((PArray == (Pvoid_t) NULL) || (Index1 > Index2))
-	{
-	    JU_SET_ERRNO(PJError, JU_ERRNO_NONE);
-	    return(C_JERR);
-	}
-
-// If Index1 == Index2, simply check if the specified Index is set; pass
-// through the return value from Judy1Test() or JudyLGet() with appropriate
-// translations.
-
-	if (Index1 == Index2)
-	{
-#ifdef JUDY1
-	    retcode = Judy1Test(PArray, Index1, PJError);
-
-	    if (retcode == JERRI) return(C_JERR);	// pass through error.
-
-	    if (retcode == 0)
-	    {
-		JU_SET_ERRNO(PJError, JU_ERRNO_NONE);
-		return(C_JERR);
-	    }
-#else
-	    PPvalue = JudyLGet(PArray, Index1, PJError);
-
-	    if (PPvalue == PPJERR) return(C_JERR);	// pass through error.
-
-	    if (PPvalue == (PPvoid_t) NULL)		// Index is not set.
-	    {
-		JU_SET_ERRNO(PJError, JU_ERRNO_NONE);
-		return(C_JERR);
-	    }
-#endif
-	    return(1);					// single index is set.
-	}
-
-
-// CHECK JRP TYPE:
-//
-// Use an if/then for speed rather than a switch, and put the most common cases
-// first.
-//
-// Note:  Since even cJU_LEAFW types require counting between two Indexes,
-// prepare them here for common code below that calls j__udy1LCountSM(), rather
-// than handling them even more specially here.
-
-	if (JU_LEAFW_POP0(PArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW
-	{
-	    Pjlw_t Pjlw	   = P_JLW(PArray);	// first word of leaf.
-	    Pjpm	   = & fakejpm;
-	    Pjp		   = & fakejp;
-	    Pjp->jp_Addr   = (Word_t) Pjlw;
-	    Pjp->jp_Type   = cJU_LEAFW;
-	    Pjpm->jpm_Pop0 = Pjlw[0];		// from first word of leaf.
-	    pop1	   = Pjpm->jpm_Pop0 + 1;
-	}
-	else
-	{
-	    Pjpm = P_JPM(PArray);
-	    Pjp	 = &(Pjpm->jpm_JP);
-	    pop1 = (Pjpm->jpm_Pop0) + 1;	// note: can roll over to 0.
-
-#if (defined(JUDY1) && (! defined(JU_64BIT)))
-	    if (pop1 == 0)		// rare special case of full array:
-	    {
-		Word_t count = Index2 - Index1 + 1;	// can roll over again.
-
-		if (count == 0)
-		{
-		    JU_SET_ERRNO(PJError, JU_ERRNO_FULL);
-		    return(C_JERR);
-		}
-		return(count);
-	    }
-#else
-	    assert(pop1);	// JudyL or 64-bit cannot create a full array!
-#endif
-	}
-
-
-// COUNT POP1 ABOVE INDEX1, INCLUSIVE:
-
-	assert(pop1);		// just to be safe.
-
-	if (Index1 == 0)	// shortcut, pop1above1 is entire population:
-	{
-	    pop1above1 = pop1;
-	}
-	else			// find first valid Index above Index1, if any:
-	{
-#ifdef JUDY1
-	    if ((retcode = Judy1First(PArray, & Index1, PJError)) == JERRI)
-		return(C_JERR);			// pass through error.
-#else
-	    if ((PPvalue = JudyLFirst(PArray, & Index1, PJError)) == PPJERR)
-		return(C_JERR);			// pass through error.
-
-	    retcode = (PPvalue != (PPvoid_t) NULL);	// found a next Index.
-#endif
-
-// If theres no Index at or above Index1, just return C_JERR (early exit):
-
-	    if (retcode == 0)
-	    {
-		JU_SET_ERRNO(PJError, JU_ERRNO_NONE);
-		return(C_JERR);
-	    }
-
-// If a first/next Index was found, call the counting motor starting with that
-// known valid Index, meaning the return should be positive, not C_JERR except
-// in case of a real error:
-
-	    if ((pop1above1 = j__udy1LCountSM(Pjp, Index1, Pjpm)) == C_JERR)
-	    {
-		JU_COPY_ERRNO(PJError, Pjpm);	// pass through error.
-		return(C_JERR);
-	    }
-	}
-
-
-// COUNT POP1 ABOVE INDEX2, EXCLUSIVE, AND RETURN THE DIFFERENCE:
-//
-// In principle, calculate the ordinal of each Index and take the difference,
-// with caution about off-by-one errors due to the specified Indexes being set
-// or unset.  In practice:
-//
-// - The ordinals computed here are inverse ordinals, that is, the populations
-//   ABOVE the specified Indexes (Index1 inclusive, Index2 exclusive), so
-//   subtract pop1above2 from pop1above1, rather than vice-versa.
-//
-// - Index1s result already includes a count for Index1 and/or Index2 if
-//   either is set, so calculate pop1above2 exclusive of Index2.
-//
-// TBD:  If Index1 and Index2 fall in the same expanse in the top-state
-// branch(es), would it be faster to walk the SM only once, to their divergence
-// point, before calling j__udy1LCountSM() or equivalent?  Possibly a non-issue
-// if a top-state pop1 becomes stored with each Judy1 array.  Also, consider
-// whether the first call of j__udy1LCountSM() fills the cache, for common tree
-// branches, for the second call.
-//
-// As for pop1above1, look for shortcuts for special cases when pop1above2 is
-// zero.  Otherwise call the counting "motor".
-
-	    assert(pop1above1);		// just to be safe.
-
-	    if (Index2++ == cJU_ALLONES) return(pop1above1); // Index2 at limit.
-
-#ifdef JUDY1
-	    if ((retcode = Judy1First(PArray, & Index2, PJError)) == JERRI)
-		return(C_JERR);
-#else
-	    if ((PPvalue = JudyLFirst(PArray, & Index2, PJError)) == PPJERR)
-		return(C_JERR);
-
-	    retcode = (PPvalue != (PPvoid_t) NULL);	// found a next Index.
-#endif
-	    if (retcode == 0) return(pop1above1);  // no Index above Index2.
-
-// Just as for Index1, j__udy1LCountSM() cannot return 0 (locally == C_JERR)
-// except in case of a real error:
-
-	    if ((pop1above2 = j__udy1LCountSM(Pjp, Index2, Pjpm)) == C_JERR)
-	    {
-		JU_COPY_ERRNO(PJError, Pjpm);		// pass through error.
-		return(C_JERR);
-	    }
-
-	    if (pop1above1 == pop1above2)
-	    {
-		JU_SET_ERRNO(PJError, JU_ERRNO_NONE);
-		return(C_JERR);
-	    }
-
-	    return(pop1above1 - pop1above2);
-
-} // Judy1Count() / JudyLCount()
-
-
-// ****************************************************************************
-// __ J U D Y 1 L   C O U N T   S M
-//
-// Given a pointer to a JP (with invalid jp_DcdPopO at cJU_ROOTSTATE), a known
-// valid Index, and a Pjpm for returning error info, recursively visit a Judy
-// array state machine (SM) and return the count of Indexes, including Index,
-// through the end of the Judy array at this state or below.  In case of error
-// or a count of 0 (should never happen), return C_JERR with appropriate
-// JU_ERRNO in the Pjpm.
-//
-// Note:  This function is not told the current state because its encoded in
-// the JP Type.
-//
-// Method:  To minimize cache line fills, while studying each branch, if Index
-// resides above the midpoint of the branch (which often consists of multiple
-// cache lines), ADD the populations at or above Index; otherwise, SUBTRACT
-// from the population of the WHOLE branch (available from the JP) the
-// populations at or above Index.  This is especially tricky for bitmap
-// branches.
-//
-// Note:  Unlike, say, the Ins and Del walk routines, this function returns the
-// same type of returns as Judy*Count(), so it can use *_SET_ERRNO*() macros
-// the same way.
-
-FUNCTION static Word_t j__udy1LCountSM(
-const	Pjp_t	Pjp,		// top of Judy (sub)SM.
-const	Word_t	Index,		// count at or above this Index.
-const	Pjpm_t	Pjpm)		// for returning error info.
-{
-	Pjbl_t	Pjbl;		// Pjp->jp_Addr masked and cast to types:
-	Pjbb_t	Pjbb;
-	Pjbu_t	Pjbu;
-	Pjll_t	Pjll;		// a Judy lower-level linear leaf.
-
-	Word_t	digit;		// next digit to decode from Index.
-	long	jpnum;		// JP number in a branch (base 0).
-	int	offset;		// index ordinal within a leaf, base 0.
-	Word_t	pop1;		// total population of an expanse.
-	Word_t	pop1above;	// to return.
-
-// Common code to check Decode bits in a JP against the equivalent portion of
-// Index; XOR together, then mask bits of interest; must be all 0:
-//
-// Note:  Why does this code only assert() compliance rather than actively
-// checking for outliers?  Its because Index is supposed to be valid, hence
-// always match any Dcd bits traversed.
-//
-// Note:  This assertion turns out to be always true for cState = 3 on 32-bit
-// and 7 on 64-bit, but its harmless, probably removed by the compiler.
-
-#define	CHECKDCD(Pjp,cState) \
-	assert(! JU_DCDNOTMATCHINDEX(Index, Pjp, cState))
-
-// Common code to prepare to handle a root-level or lower-level branch:
-// Extract a state-dependent digit from Index in a "constant" way, obtain the
-// total population for the branch in a state-dependent way, and then branch to
-// common code for multiple cases:
-//
-// For root-level branches, the state is always cJU_ROOTSTATE, and the
-// population is received in Pjpm->jpm_Pop0.
-//
-// Note:  The total population is only needed in cases where the common code
-// "counts up" instead of down to minimize cache line fills.  However, its
-// available cheaply, and its better to do it with a constant shift (constant
-// state value) instead of a variable shift later "when needed".
-
-#define	PREPB_ROOT(Pjp,Next)				\
-	digit = JU_DIGITATSTATE(Index, cJU_ROOTSTATE);	\
-	pop1  = (Pjpm->jpm_Pop0) + 1;			\
-	goto Next
-
-#define	PREPB(Pjp,cState,Next)				\
-	digit = JU_DIGITATSTATE(Index, cState);		\
-	pop1  = JU_JPBRANCH_POP0(Pjp, (cState)) + 1;    \
-	goto Next
-
-
-// SWITCH ON JP TYPE:
-//
-// WARNING:  For run-time efficiency the following cases replicate code with
-// varying constants, rather than using common code with variable values!
-
-	switch (JU_JPTYPE(Pjp))
-	{
-
-
-// ----------------------------------------------------------------------------
-// ROOT-STATE LEAF that starts with a Pop0 word; just count within the leaf:
-
-	case cJU_LEAFW:
-	{
-	    Pjlw_t Pjlw = P_JLW(Pjp->jp_Addr);		// first word of leaf.
-
-	    assert((Pjpm->jpm_Pop0) + 1 == Pjlw[0] + 1);  // sent correctly.
-	    offset = j__udySearchLeafW(Pjlw + 1, Pjpm->jpm_Pop0 + 1, Index);
-	    assert(offset >= 0);			// Index must exist.
-	    assert(offset < (Pjpm->jpm_Pop0) + 1);	// Index be in range.
-	    return((Pjpm->jpm_Pop0) + 1 - offset);	// INCLUSIVE of Index.
-	}
-
-// ----------------------------------------------------------------------------
-// LINEAR BRANCH; count populations in JPs in the JBL ABOVE the next digit in
-// Index, and recurse for the next digit in Index:
-//
-// Note:  There are no null JPs in a JBL; watch out for pop1 == 0.
-//
-// Note:  A JBL should always fit in one cache line => no need to count up
-// versus down to save cache line fills.  (PREPB() sets pop1 for no reason.)
-
-	case cJU_JPBRANCH_L2:  CHECKDCD(Pjp, 2); PREPB(Pjp, 2, BranchL);
-	case cJU_JPBRANCH_L3:  CHECKDCD(Pjp, 3); PREPB(Pjp, 3, BranchL);
-
-#ifdef JU_64BIT
-	case cJU_JPBRANCH_L4:  CHECKDCD(Pjp, 4); PREPB(Pjp, 4, BranchL);
-	case cJU_JPBRANCH_L5:  CHECKDCD(Pjp, 5); PREPB(Pjp, 5, BranchL);
-	case cJU_JPBRANCH_L6:  CHECKDCD(Pjp, 6); PREPB(Pjp, 6, BranchL);
-	case cJU_JPBRANCH_L7:  CHECKDCD(Pjp, 7); PREPB(Pjp, 7, BranchL);
-#endif
-	case cJU_JPBRANCH_L:   PREPB_ROOT(Pjp, BranchL);
-
-// Common code (state-independent) for all cases of linear branches:
-
-BranchL:
-
-	Pjbl      = P_JBL(Pjp->jp_Addr);
-	jpnum     = Pjbl->jbl_NumJPs;			// above last JP.
-	pop1above = 0;
-
-	while (digit < (Pjbl->jbl_Expanse[--jpnum]))	 // still ABOVE digit.
-	{
-	    if ((pop1 = j__udyJPPop1((Pjbl->jbl_jp) + jpnum)) == cJU_ALLONES)
-	    {
-		JU_SET_ERRNO_NONNULL(Pjpm, JU_ERRNO_CORRUPT);
-		return(C_JERR);
-	    }
-
-	    pop1above += pop1;
-	    assert(jpnum > 0);				// should find digit.
-	}
-
-	assert(digit == (Pjbl->jbl_Expanse[jpnum]));	// should find digit.
-
-	pop1 = j__udy1LCountSM((Pjbl->jbl_jp) + jpnum, Index, Pjpm);
-	if (pop1 == C_JERR) return(C_JERR);		// pass error up.
-
-	assert(pop1above + pop1);
-	return(pop1above + pop1);
-
-
-// ----------------------------------------------------------------------------
-// BITMAP BRANCH; count populations in JPs in the JBB ABOVE the next digit in
-// Index, and recurse for the next digit in Index:
-//
-// Note:  There are no null JPs in a JBB; watch out for pop1 == 0.
-
-	case cJU_JPBRANCH_B2:  CHECKDCD(Pjp, 2); PREPB(Pjp, 2, BranchB);
-	case cJU_JPBRANCH_B3:  CHECKDCD(Pjp, 3); PREPB(Pjp, 3, BranchB);
-#ifdef JU_64BIT
-	case cJU_JPBRANCH_B4:  CHECKDCD(Pjp, 4); PREPB(Pjp, 4, BranchB);
-	case cJU_JPBRANCH_B5:  CHECKDCD(Pjp, 5); PREPB(Pjp, 5, BranchB);
-	case cJU_JPBRANCH_B6:  CHECKDCD(Pjp, 6); PREPB(Pjp, 6, BranchB);
-	case cJU_JPBRANCH_B7:  CHECKDCD(Pjp, 7); PREPB(Pjp, 7, BranchB);
-#endif
-	case cJU_JPBRANCH_B:   PREPB_ROOT(Pjp, BranchB);
-
-// Common code (state-independent) for all cases of bitmap branches:
-
-BranchB:
-	{
-	    long   subexp;	// for stepping through layer 1 (subexpanses).
-	    long   findsub;	// subexpanse containing   Index (digit).
-	    Word_t findbit;	// bit	      representing Index (digit).
-	    Word_t lowermask;	// bits for indexes at or below Index.
-	    Word_t jpcount;	// JPs in a subexpanse.
-	    Word_t clbelow;	// cache lines below digits cache line.
-	    Word_t clabove;	// cache lines above digits cache line.
-
-	    Pjbb      = P_JBB(Pjp->jp_Addr);
-	    findsub   = digit / cJU_BITSPERSUBEXPB;
-	    findbit   = digit % cJU_BITSPERSUBEXPB;
-	    lowermask = JU_MASKLOWERINC(JU_BITPOSMASKB(findbit));
-	    clbelow   = clabove = 0;	// initial/default => always downward.
-
-	    assert(JU_BITMAPTESTB(Pjbb, digit)); // digit must have a JP.
-	    assert(findsub < cJU_NUMSUBEXPB);	 // falls in expected range.
-
-// Shorthand for one subexpanse in a bitmap and for one JP in a bitmap branch:
-//
-// Note: BMPJP0 exists separately to support assertions.
-
-#define	BMPJP0(Subexp)       (P_JP(JU_JBB_PJP(Pjbb, Subexp)))
-#define	BMPJP(Subexp,JPnum)  (BMPJP0(Subexp) + (JPnum))
-
-#ifndef NOSMARTJBB  // enable to turn off smart code for comparison purposes.
-
-// FIGURE OUT WHICH DIRECTION CAUSES FEWER CACHE LINE FILLS; adding the pop1s
-// in JPs above Indexs JP, or subtracting the pop1s in JPs below Indexs JP.
-//
-// This is tricky because, while each set bit in the bitmap represents a JP,
-// the JPs are scattered over cJU_NUMSUBEXPB subexpanses, each of which can
-// contain JPs packed into multiple cache lines, and this code must visit every
-// JP either BELOW or ABOVE the JP for Index.
-//
-// Number of cache lines required to hold a linear list of the given number of
-// JPs, assuming the first JP is at the start of a cache line or the JPs in
-// jpcount fit wholly within a single cache line, which is ensured by
-// JudyMalloc():
-
-#define	CLPERJPS(jpcount) \
-	((((jpcount) * cJU_WORDSPERJP) + cJU_WORDSPERCL - 1) / cJU_WORDSPERCL)
-
-// Count cache lines below/above for each subexpanse:
-
-	    for (subexp = 0; subexp < cJU_NUMSUBEXPB; ++subexp)
-	    {
-		jpcount = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, subexp));
-
-// When at the subexpanse containing Index (digit), add cache lines
-// below/above appropriately, excluding the cache line containing the JP for
-// Index itself:
-
-		if	(subexp <  findsub)  clbelow += CLPERJPS(jpcount);
-		else if (subexp >  findsub)  clabove += CLPERJPS(jpcount);
-		else // (subexp == findsub)
-		{
-		    Word_t clfind;	// cache line containing Index (digit).
-
-		    clfind = CLPERJPS(j__udyCountBitsB(
-				    JU_JBB_BITMAP(Pjbb, subexp) & lowermask));
-
-		    assert(clfind > 0);	 // digit itself should have 1 CL.
-		    clbelow += clfind - 1;
-		    clabove += CLPERJPS(jpcount) - clfind;
-		}
-	    }
-#endif // ! NOSMARTJBB
-
-// Note:  Its impossible to get through the following "if" without setting
-// jpnum -- see some of the assertions below -- but gcc -Wall doesnt know
-// this, so preset jpnum to make it happy:
-
-	    jpnum = 0;
-
-
-// COUNT POPULATION FOR A BITMAP BRANCH, in whichever direction should result
-// in fewer cache line fills:
-//
-// Note:  If the remainder of Index is zero, pop1above is the pop1 of the
-// entire expanse and theres no point in recursing to lower levels; but this
-// should be so rare that its not worth checking for;
-// Judy1Count()/JudyLCount() never even calls the motor for Index == 0 (all
-// bytes).
-
-
-// COUNT UPWARD, subtracting each "below or at" JPs pop1 from the whole
-// expanses pop1:
-//
-// Note:  If this causes clbelow + 1 cache line fills including JPs cache
-// line, thats OK; at worst this is the same as clabove.
-
-	    if (clbelow < clabove)
-	    {
-#ifdef SMARTMETRICS
-		++jbb_upward;
-#endif
-		pop1above = pop1;		// subtract JPs at/below Index.
-
-// Count JPs for which to accrue pop1s in this subexpanse:
-//
-// TBD:  If JU_JBB_BITMAP is cJU_FULLBITMAPB, dont bother counting.
-
-		for (subexp = 0; subexp <= findsub; ++subexp)
-		{
-		    jpcount = j__udyCountBitsB((subexp < findsub) ?
-				      JU_JBB_BITMAP(Pjbb, subexp) :
-				      JU_JBB_BITMAP(Pjbb, subexp) & lowermask);
-
-		    // should always find findbit:
-		    assert((subexp < findsub) || jpcount);
-
-// Subtract pop1s from JPs BELOW OR AT Index (digit):
-//
-// Note:  The pop1 for Indexs JP itself is partially added back later at a
-// lower state.
-//
-// Note:  An empty subexpanse (jpcount == 0) is handled "for free".
-//
-// Note:  Must be null JP subexp pointer in empty subexpanse and non-empty in
-// non-empty subexpanse:
-
-		    assert(   jpcount  || (BMPJP0(subexp) == (Pjp_t) NULL));
-		    assert((! jpcount) || (BMPJP0(subexp) != (Pjp_t) NULL));
-
-		    for (jpnum = 0; jpnum < jpcount; ++jpnum)
-		    {
-			if ((pop1 = j__udyJPPop1(BMPJP(subexp, jpnum)))
-			    == cJU_ALLONES)
-			{
-			    JU_SET_ERRNO_NONNULL(Pjpm, JU_ERRNO_CORRUPT);
-			    return(C_JERR);
-			}
-
-			pop1above -= pop1;
-		    }
-
-		    jpnum = jpcount - 1;	// make correct for digit.
-		}
-	    }
-
-// COUNT DOWNWARD, adding each "above" JPs pop1:
-
-	    else
-	    {
-		long jpcountbf;			// below findbit, inclusive.
-#ifdef SMARTMETRICS
-		++jbb_downward;
-#endif
-		pop1above = 0;			// add JPs above Index.
-		jpcountbf = 0;			// until subexp == findsub.
-
-// Count JPs for which to accrue pop1s in this subexpanse:
-//
-// This is more complicated than counting upward because the scan of digits
-// subexpanse must count ALL JPs, to know where to START counting down, and
-// ALSO note the offset of digits JP to know where to STOP counting down.
-
-		for (subexp = cJU_NUMSUBEXPB - 1; subexp >= findsub; --subexp)
-		{
-		    jpcount = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, subexp));
-
-		    // should always find findbit:
-		    assert((subexp > findsub) || jpcount);
-
-		    if (! jpcount) continue;	// empty subexpanse, save time.
-
-// Count JPs below digit, inclusive:
-
-		    if (subexp == findsub)
-		    {
-			jpcountbf = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, subexp)
-						  & lowermask);
-		    }
-
-		    // should always find findbit:
-		    assert((subexp > findsub) || jpcountbf);
-		    assert(jpcount >= jpcountbf);	// proper relationship.
-
-// Add pop1s from JPs ABOVE Index (digit):
-
-		    // no null JP subexp pointers:
-		    assert(BMPJP0(subexp) != (Pjp_t) NULL);
-
-		    for (jpnum = jpcount - 1; jpnum >= jpcountbf; --jpnum)
-		    {
-			if ((pop1 = j__udyJPPop1(BMPJP(subexp, jpnum)))
-			    == cJU_ALLONES)
-			{
-			    JU_SET_ERRNO_NONNULL(Pjpm, JU_ERRNO_CORRUPT);
-			    return(C_JERR);
-			}
-
-			pop1above += pop1;
-		    }
-		    // jpnum is now correct for digit.
-		}
-	    } // else.
-
-// Return the net population ABOVE the digits JP at this state (in this JBB)
-// plus the population AT OR ABOVE Index in the SM under the digits JP:
-
-	    pop1 = j__udy1LCountSM(BMPJP(findsub, jpnum), Index, Pjpm);
-	    if (pop1 == C_JERR) return(C_JERR);		// pass error up.
-
-	    assert(pop1above + pop1);
-	    return(pop1above + pop1);
-
-	} // case.
-
-
-// ----------------------------------------------------------------------------
-// UNCOMPRESSED BRANCH; count populations in JPs in the JBU ABOVE the next
-// digit in Index, and recurse for the next digit in Index:
-//
-// Note:  If the remainder of Index is zero, pop1above is the pop1 of the
-// entire expanse and theres no point in recursing to lower levels; but this
-// should be so rare that its not worth checking for;
-// Judy1Count()/JudyLCount() never even calls the motor for Index == 0 (all
-// bytes).
-
-	case cJU_JPBRANCH_U2:  CHECKDCD(Pjp, 2); PREPB(Pjp, 2, BranchU);
-	case cJU_JPBRANCH_U3:  CHECKDCD(Pjp, 3); PREPB(Pjp, 3, BranchU);
-#ifdef JU_64BIT
-	case cJU_JPBRANCH_U4:  CHECKDCD(Pjp, 4); PREPB(Pjp, 4, BranchU);
-	case cJU_JPBRANCH_U5:  CHECKDCD(Pjp, 5); PREPB(Pjp, 5, BranchU);
-	case cJU_JPBRANCH_U6:  CHECKDCD(Pjp, 6); PREPB(Pjp, 6, BranchU);
-	case cJU_JPBRANCH_U7:  CHECKDCD(Pjp, 7); PREPB(Pjp, 7, BranchU);
-#endif
-	case cJU_JPBRANCH_U:   PREPB_ROOT(Pjp, BranchU);
-
-// Common code (state-independent) for all cases of uncompressed branches:
-
-BranchU:
-	    Pjbu = P_JBU(Pjp->jp_Addr);
-
-#ifndef NOSMARTJBU  // enable to turn off smart code for comparison purposes.
-
-// FIGURE OUT WHICH WAY CAUSES FEWER CACHE LINE FILLS; adding the JPs above
-// Indexs JP, or subtracting the JPs below Indexs JP.
-//
-// COUNT UPWARD, subtracting the pop1 of each JP BELOW OR AT Index, from the
-// whole expanses pop1:
-
-	    if (digit < (cJU_BRANCHUNUMJPS / 2))
-	    {
-		pop1above = pop1;		// subtract JPs below Index.
-#ifdef SMARTMETRICS
-		++jbu_upward;
-#endif
-		for (jpnum = 0; jpnum <= digit; ++jpnum)
-		{
-		    if ((Pjbu->jbu_jp[jpnum].jp_Type) <= cJU_JPNULLMAX)
-			continue;	// shortcut, save a function call.
-
-		    if ((pop1 = j__udyJPPop1(Pjbu->jbu_jp + jpnum))
-		     == cJU_ALLONES)
-		    {
-			JU_SET_ERRNO_NONNULL(Pjpm, JU_ERRNO_CORRUPT);
-			return(C_JERR);
-		    }
-
-		    pop1above -= pop1;
-		}
-	    }
-
-// COUNT DOWNWARD, simply adding the pop1 of each JP ABOVE Index:
-
-	    else
-#endif // NOSMARTJBU
-	    {
-		assert(digit < cJU_BRANCHUNUMJPS);
-#ifdef SMARTMETRICS
-		++jbu_downward;
-#endif
-		pop1above = 0;			// add JPs above Index.
-
-		for (jpnum = cJU_BRANCHUNUMJPS - 1; jpnum > digit; --jpnum)
-		{
-		    if ((Pjbu->jbu_jp[jpnum].jp_Type) <= cJU_JPNULLMAX)
-			continue;	// shortcut, save a function call.
-
-		    if ((pop1 = j__udyJPPop1(Pjbu->jbu_jp + jpnum))
-		     == cJU_ALLONES)
-		    {
-			JU_SET_ERRNO_NONNULL(Pjpm, JU_ERRNO_CORRUPT);
-			return(C_JERR);
-		    }
-
-		    pop1above += pop1;
-		}
-	    }
-
-	    if ((pop1 = j__udy1LCountSM(Pjbu->jbu_jp + digit, Index, Pjpm))
-	     == C_JERR) return(C_JERR);		// pass error up.
-
-	    assert(pop1above + pop1);
-	    return(pop1above + pop1);
-
-
-// ----------------------------------------------------------------------------
-// LEAF COUNT MACROS:
-//
-// LEAF*ABOVE() are common code for different JP types (linear leaves, bitmap
-// leaves, and immediates) and different leaf Index Sizes, which result in
-// calling different leaf search functions.  Linear leaves get the leaf address
-// from jp_Addr and the Population from jp_DcdPopO, while immediates use Pjp
-// itself as the leaf address and get Population from jp_Type.
-
-#define	LEAFLABOVE(Func)				\
-	Pjll = P_JLL(Pjp->jp_Addr);			\
-	pop1 = JU_JPLEAF_POP0(Pjp) + 1;	                \
-	LEAFABOVE(Func, Pjll, pop1)
-
-#define	LEAFB1ABOVE(Func) LEAFLABOVE(Func)  // different Func, otherwise same.
-
-#ifdef JUDY1
-#define	IMMABOVE(Func,Pop1)	\
-	Pjll = (Pjll_t) Pjp;	\
-	LEAFABOVE(Func, Pjll, Pop1)
-#else
-// Note:  For JudyL immediates with >= 2 Indexes, the index bytes are in a
-// different place than for Judy1:
-
-#define	IMMABOVE(Func,Pop1) \
-	LEAFABOVE(Func, (Pjll_t) (Pjp->jp_LIndex), Pop1)
-#endif
-
-// For all leaf types, the population AT OR ABOVE is the total pop1 less the
-// offset of Index; and Index should always be found:
-
-#define	LEAFABOVE(Func,Pjll,Pop1)		\
-	offset = Func(Pjll, Pop1, Index);	\
-	assert(offset >= 0);			\
-	assert(offset < (Pop1));		\
-	return((Pop1) - offset)
-
-// IMMABOVE_01 handles the special case of an immediate JP with 1 index, which
-// the search functions arent used for anyway:
-//
-// The target Index should be the one in this Immediate, in which case the
-// count above (inclusive) is always 1.
-
-#define	IMMABOVE_01						\
-	assert((JU_JPDCDPOP0(Pjp)) == JU_TRIMTODCDSIZE(Index));	\
-	return(1)
-
-
-// ----------------------------------------------------------------------------
-// LINEAR LEAF; search the leaf for Index; size is computed from jp_Type:
-
-#if (defined(JUDYL) || (! defined(JU_64BIT)))
-	case cJU_JPLEAF1:  LEAFLABOVE(j__udySearchLeaf1);
-#endif
-	case cJU_JPLEAF2:  LEAFLABOVE(j__udySearchLeaf2);
-	case cJU_JPLEAF3:  LEAFLABOVE(j__udySearchLeaf3);
-
-#ifdef JU_64BIT
-	case cJU_JPLEAF4:  LEAFLABOVE(j__udySearchLeaf4);
-	case cJU_JPLEAF5:  LEAFLABOVE(j__udySearchLeaf5);
-	case cJU_JPLEAF6:  LEAFLABOVE(j__udySearchLeaf6);
-	case cJU_JPLEAF7:  LEAFLABOVE(j__udySearchLeaf7);
-#endif
-
-
-// ----------------------------------------------------------------------------
-// BITMAP LEAF; search the leaf for Index:
-//
-// Since the bitmap describes Indexes digitally rather than linearly, this is
-// not really a search, but just a count.
-
-	case cJU_JPLEAF_B1:  LEAFB1ABOVE(j__udyCountLeafB1);
-
-
-#ifdef JUDY1
-// ----------------------------------------------------------------------------
-// FULL POPULATION:
-//
-// Return the count of Indexes AT OR ABOVE Index, which is the total population
-// of the expanse (a constant) less the value of the undecoded digit remaining
-// in Index (its base-0 offset in the expanse), which yields an inclusive count
-// above.
-//
-// TBD:  This only supports a 1-byte full expanse.  Should this extract a
-// stored value for pop0 and possibly more LSBs of Index, to handle larger full
-// expanses?
-
-	case cJ1_JPFULLPOPU1:
-	    return(cJU_JPFULLPOPU1_POP0 + 1 - JU_DIGITATSTATE(Index, 1));
-#endif
-
-
-// ----------------------------------------------------------------------------
-// IMMEDIATE:
-
-	case cJU_JPIMMED_1_01:  IMMABOVE_01;
-	case cJU_JPIMMED_2_01:  IMMABOVE_01;
-	case cJU_JPIMMED_3_01:  IMMABOVE_01;
-#ifdef JU_64BIT
-	case cJU_JPIMMED_4_01:  IMMABOVE_01;
-	case cJU_JPIMMED_5_01:  IMMABOVE_01;
-	case cJU_JPIMMED_6_01:  IMMABOVE_01;
-	case cJU_JPIMMED_7_01:  IMMABOVE_01;
-#endif
-
-	case cJU_JPIMMED_1_02:  IMMABOVE(j__udySearchLeaf1,  2);
-	case cJU_JPIMMED_1_03:  IMMABOVE(j__udySearchLeaf1,  3);
-#if (defined(JUDY1) || defined(JU_64BIT))
-	case cJU_JPIMMED_1_04:  IMMABOVE(j__udySearchLeaf1,  4);
-	case cJU_JPIMMED_1_05:  IMMABOVE(j__udySearchLeaf1,  5);
-	case cJU_JPIMMED_1_06:  IMMABOVE(j__udySearchLeaf1,  6);
-	case cJU_JPIMMED_1_07:  IMMABOVE(j__udySearchLeaf1,  7);
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-	case cJ1_JPIMMED_1_08:  IMMABOVE(j__udySearchLeaf1,  8);
-	case cJ1_JPIMMED_1_09:  IMMABOVE(j__udySearchLeaf1,  9);
-	case cJ1_JPIMMED_1_10:  IMMABOVE(j__udySearchLeaf1, 10);
-	case cJ1_JPIMMED_1_11:  IMMABOVE(j__udySearchLeaf1, 11);
-	case cJ1_JPIMMED_1_12:  IMMABOVE(j__udySearchLeaf1, 12);
-	case cJ1_JPIMMED_1_13:  IMMABOVE(j__udySearchLeaf1, 13);
-	case cJ1_JPIMMED_1_14:  IMMABOVE(j__udySearchLeaf1, 14);
-	case cJ1_JPIMMED_1_15:  IMMABOVE(j__udySearchLeaf1, 15);
-#endif
-
-#if (defined(JUDY1) || defined(JU_64BIT))
-	case cJU_JPIMMED_2_02:  IMMABOVE(j__udySearchLeaf2,  2);
-	case cJU_JPIMMED_2_03:  IMMABOVE(j__udySearchLeaf2,  3);
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-	case cJ1_JPIMMED_2_04:  IMMABOVE(j__udySearchLeaf2,  4);
-	case cJ1_JPIMMED_2_05:  IMMABOVE(j__udySearchLeaf2,  5);
-	case cJ1_JPIMMED_2_06:  IMMABOVE(j__udySearchLeaf2,  6);
-	case cJ1_JPIMMED_2_07:  IMMABOVE(j__udySearchLeaf2,  7);
-#endif
-
-#if (defined(JUDY1) || defined(JU_64BIT))
-	case cJU_JPIMMED_3_02:  IMMABOVE(j__udySearchLeaf3,  2);
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-	case cJ1_JPIMMED_3_03:  IMMABOVE(j__udySearchLeaf3,  3);
-	case cJ1_JPIMMED_3_04:  IMMABOVE(j__udySearchLeaf3,  4);
-	case cJ1_JPIMMED_3_05:  IMMABOVE(j__udySearchLeaf3,  5);
-
-	case cJ1_JPIMMED_4_02:  IMMABOVE(j__udySearchLeaf4,  2);
-	case cJ1_JPIMMED_4_03:  IMMABOVE(j__udySearchLeaf4,  3);
-
-	case cJ1_JPIMMED_5_02:  IMMABOVE(j__udySearchLeaf5,  2);
-	case cJ1_JPIMMED_5_03:  IMMABOVE(j__udySearchLeaf5,  3);
-
-	case cJ1_JPIMMED_6_02:  IMMABOVE(j__udySearchLeaf6,  2);
-
-	case cJ1_JPIMMED_7_02:  IMMABOVE(j__udySearchLeaf7,  2);
-#endif
-
-
-// ----------------------------------------------------------------------------
-// OTHER CASES:
-
-	default: JU_SET_ERRNO_NONNULL(Pjpm, JU_ERRNO_CORRUPT); return(C_JERR);
-
-	} // switch on JP type
-
-	/*NOTREACHED*/
-
-} // j__udy1LCountSM()
-
-
-// ****************************************************************************
-// J U D Y   C O U N T   L E A F   B 1
-//
-// This is a private analog of the j__udySearchLeaf*() functions for counting
-// in bitmap 1-byte leaves.  Since a bitmap leaf describes Indexes digitally
-// rather than linearly, this is not really a search, but just a count of the
-// valid Indexes == set bits below or including Index, which should be valid.
-// Return the "offset" (really the ordinal), 0 .. Pop1 - 1, of Index in Pjll;
-// if Indexs bit is not set (which should never happen, so this is DEBUG-mode
-// only), return the 1s-complement equivalent (== negative offset minus 1).
-//
-// Note:  The source code for this function looks identical for both Judy1 and
-// JudyL, but the JU_JLB_BITMAP macro varies.
-//
-// Note:  For simpler calling, the first arg is of type Pjll_t but then cast to
-// Pjlb_t.
-
-FUNCTION static int j__udyCountLeafB1(
-const	Pjll_t	Pjll,		// bitmap leaf, as Pjll_t for consistency.
-const	Word_t	Pop1,		// Population of whole leaf.
-const	Word_t	Index)		// to which to count.
-{
-	Pjlb_t	Pjlb	= (Pjlb_t) Pjll;	// to proper type.
-	Word_t	digit   = Index & cJU_MASKATSTATE(1);
-	Word_t	findsub = digit / cJU_BITSPERSUBEXPL;
-	Word_t	findbit = digit % cJU_BITSPERSUBEXPL;
-	int	count;		// in leaf through Index.
-	long	subexp;		// for stepping through subexpanses.
-
-
-// COUNT UPWARD:
-//
-// The entire bitmap should fit in one cache line, but still try to save some
-// CPU time by counting the fewest possible number of subexpanses from the
-// bitmap.
-
-#ifndef NOSMARTJLB  // enable to turn off smart code for comparison purposes.
-
-	if (findsub < (cJU_NUMSUBEXPL / 2))
-	{
-#ifdef SMARTMETRICS
-	    ++jlb_upward;
-#endif
-	    count = 0;
-
-	    for (subexp = 0; subexp < findsub; ++subexp)
-	    {
-		count += ((JU_JLB_BITMAP(Pjlb, subexp) == cJU_FULLBITMAPL) ?
-			  cJU_BITSPERSUBEXPL :
-			  j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, subexp)));
-	    }
-
-// This count includes findbit, which should be set, resulting in a base-1
-// offset:
-
-	    count += j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, findsub)
-				& JU_MASKLOWERINC(JU_BITPOSMASKL(findbit)));
-
-	    DBGCODE(if (! JU_BITMAPTESTL(Pjlb, digit)) return(~count);)
-	    assert(count >= 1);
-	    return(count - 1);		// convert to base-0 offset.
-	}
-#endif // NOSMARTJLB
-
-
-// COUNT DOWNWARD:
-//
-// Count the valid Indexes above or at Index, and subtract from Pop1.
-
-#ifdef SMARTMETRICS
-	++jlb_downward;
-#endif
-	count = Pop1;			// base-1 for now.
-
-	for (subexp = cJU_NUMSUBEXPL - 1; subexp > findsub; --subexp)
-	{
-	    count -= ((JU_JLB_BITMAP(Pjlb, subexp) == cJU_FULLBITMAPL) ?
-		      cJU_BITSPERSUBEXPL :
-		      j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, subexp)));
-	}
-
-// This count includes findbit, which should be set, resulting in a base-0
-// offset:
-
-	count -= j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, findsub)
-				& JU_MASKHIGHERINC(JU_BITPOSMASKL(findbit)));
-
-	DBGCODE(if (! JU_BITMAPTESTL(Pjlb, digit)) return(~count);)
-	assert(count >= 0);		// should find Index itself.
-	return(count);			// is already a base-0 offset.
-
-} // j__udyCountLeafB1()
-
-
-// ****************************************************************************
-// J U D Y   J P   P O P 1
-//
-// This function takes any type of JP other than a root-level JP (cJU_LEAFW* or
-// cJU_JPBRANCH* with no number suffix) and extracts the Pop1 from it.  In some
-// sense this is a wrapper around the JU_JP*_POP0 macros.  Why write it as a
-// function instead of a complex macro containing a trinary?  (See version
-// Judy1.h version 4.17.)  We think its cheaper to call a function containing
-// a switch statement with "constant" cases than to do the variable
-// calculations in a trinary.
-//
-// For invalid JP Types return cJU_ALLONES.  Note that this is an impossibly
-// high Pop1 for any JP below a top level branch.
-
-FUNCTION Word_t j__udyJPPop1(
-const	Pjp_t Pjp)		// JP to count.
-{
-	switch (JU_JPTYPE(Pjp))
-	{
-#ifdef notdef // caller should shortcut and not even call with these:
-
-	case cJU_JPNULL1:
-	case cJU_JPNULL2:
-	case cJU_JPNULL3:  return(0);
-#ifdef JU_64BIT
-	case cJU_JPNULL4:
-	case cJU_JPNULL5:
-	case cJU_JPNULL6:
-	case cJU_JPNULL7:  return(0);
-#endif
-#endif // notdef
-
-	case cJU_JPBRANCH_L2:
-	case cJU_JPBRANCH_B2:
-	case cJU_JPBRANCH_U2: return(JU_JPBRANCH_POP0(Pjp,2) + 1);
-
-	case cJU_JPBRANCH_L3:
-	case cJU_JPBRANCH_B3:
-	case cJU_JPBRANCH_U3: return(JU_JPBRANCH_POP0(Pjp,3) + 1);
-
-#ifdef JU_64BIT
-	case cJU_JPBRANCH_L4:
-	case cJU_JPBRANCH_B4:
-	case cJU_JPBRANCH_U4: return(JU_JPBRANCH_POP0(Pjp,4) + 1);
-
-	case cJU_JPBRANCH_L5:
-	case cJU_JPBRANCH_B5:
-	case cJU_JPBRANCH_U5: return(JU_JPBRANCH_POP0(Pjp,5) + 1);
-
-	case cJU_JPBRANCH_L6:
-	case cJU_JPBRANCH_B6:
-	case cJU_JPBRANCH_U6: return(JU_JPBRANCH_POP0(Pjp,6) + 1);
-
-	case cJU_JPBRANCH_L7:
-	case cJU_JPBRANCH_B7:
-	case cJU_JPBRANCH_U7: return(JU_JPBRANCH_POP0(Pjp,7) + 1);
-#endif
-
-#if (defined(JUDYL) || (! defined(JU_64BIT)))
-	case cJU_JPLEAF1:
-#endif
-	case cJU_JPLEAF2:
-	case cJU_JPLEAF3:
-#ifdef JU_64BIT
-	case cJU_JPLEAF4:
-	case cJU_JPLEAF5:
-	case cJU_JPLEAF6:
-	case cJU_JPLEAF7:
-#endif
-	case cJU_JPLEAF_B1:	return(JU_JPLEAF_POP0(Pjp) + 1);
-
-#ifdef JUDY1
-	case cJ1_JPFULLPOPU1:	return(cJU_JPFULLPOPU1_POP0 + 1);
-#endif
-
-	case cJU_JPIMMED_1_01:
-	case cJU_JPIMMED_2_01:
-	case cJU_JPIMMED_3_01:	return(1);
-#ifdef JU_64BIT
-	case cJU_JPIMMED_4_01:
-	case cJU_JPIMMED_5_01:
-	case cJU_JPIMMED_6_01:
-	case cJU_JPIMMED_7_01:	return(1);
-#endif
-
-	case cJU_JPIMMED_1_02:	return(2);
-	case cJU_JPIMMED_1_03:	return(3);
-#if (defined(JUDY1) || defined(JU_64BIT))
-	case cJU_JPIMMED_1_04:	return(4);
-	case cJU_JPIMMED_1_05:	return(5);
-	case cJU_JPIMMED_1_06:	return(6);
-	case cJU_JPIMMED_1_07:	return(7);
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-	case cJ1_JPIMMED_1_08:	return(8);
-	case cJ1_JPIMMED_1_09:	return(9);
-	case cJ1_JPIMMED_1_10:	return(10);
-	case cJ1_JPIMMED_1_11:	return(11);
-	case cJ1_JPIMMED_1_12:	return(12);
-	case cJ1_JPIMMED_1_13:	return(13);
-	case cJ1_JPIMMED_1_14:	return(14);
-	case cJ1_JPIMMED_1_15:	return(15);
-#endif
-
-#if (defined(JUDY1) || defined(JU_64BIT))
-	case cJU_JPIMMED_2_02:	return(2);
-	case cJU_JPIMMED_2_03:	return(3);
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-	case cJ1_JPIMMED_2_04:	return(4);
-	case cJ1_JPIMMED_2_05:	return(5);
-	case cJ1_JPIMMED_2_06:	return(6);
-	case cJ1_JPIMMED_2_07:	return(7);
-#endif
-
-#if (defined(JUDY1) || defined(JU_64BIT))
-	case cJU_JPIMMED_3_02:	return(2);
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-	case cJ1_JPIMMED_3_03:	return(3);
-	case cJ1_JPIMMED_3_04:	return(4);
-	case cJ1_JPIMMED_3_05:	return(5);
-
-	case cJ1_JPIMMED_4_02:	return(2);
-	case cJ1_JPIMMED_4_03:	return(3);
-
-	case cJ1_JPIMMED_5_02:	return(2);
-	case cJ1_JPIMMED_5_03:	return(3);
-
-	case cJ1_JPIMMED_6_02:	return(2);
-
-	case cJ1_JPIMMED_7_02:	return(2);
-#endif
-
-	default:		return(cJU_ALLONES);
-	}
-
-	/*NOTREACHED*/
-
-} // j__udyJPPop1()
diff --git a/libs/klib/judy/JudyCreateBranch.c b/libs/klib/judy/JudyCreateBranch.c
deleted file mode 100644
index 1234c31..0000000
--- a/libs/klib/judy/JudyCreateBranch.c
+++ /dev/null
@@ -1,312 +0,0 @@
-// Copyright (C) 2000 - 2002 Hewlett-Packard Company
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the term of the GNU Lesser 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 Lesser General Public License
-// for more details.
-//
-// You should have received a copy of the GNU Lesser 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
-// _________________
-
-// Branch creation functions for Judy1 and JudyL.
-// Compile with one of -DJUDY1 or -DJUDYL.
-
-#if (! (defined(JUDY1) || defined(JUDYL)))
-#error:  One of -DJUDY1 or -DJUDYL must be specified.
-#endif
-
-#ifdef JUDY1
-#include "Judy1.h"
-#else
-#include "JudyL.h"
-#endif
-
-#include "JudyPrivate1L.h"
-
-
-// ****************************************************************************
-// J U D Y   C R E A T E   B R A N C H   L
-//
-// Build a BranchL from an array of JPs and associated 1 byte digits
-// (expanses).  Return with Pjp pointing to the BranchL.  Caller must
-// deallocate passed arrays, if necessary.
-//
-// We have no idea what kind of BranchL it is, so caller must set the jp_Type.
-//
-// Return -1 if error (details in Pjpm), otherwise return 1.
-
-FUNCTION int j__udyCreateBranchL(
-	Pjp_t	Pjp,		// Build JPs from this place
-	Pjp_t	PJPs,		// Array of JPs to put into Bitmap branch
-	uint8_t Exp[],		// Array of expanses to put into bitmap
-	Word_t  ExpCnt,		// Number of above JPs and Expanses
-	Pvoid_t	Pjpm)
-{
-	Pjbl_t	PjblRaw;	// pointer to linear branch.
-	Pjbl_t	Pjbl;
-
-	assert(ExpCnt <= cJU_BRANCHLMAXJPS);
-
-	PjblRaw	= j__udyAllocJBL(Pjpm);
-	if (PjblRaw == (Pjbl_t) NULL) return(-1);
-        Pjbl    = P_JBL(PjblRaw);
-
-//	Build a Linear Branch
-	Pjbl->jbl_NumJPs = ExpCnt;
-
-//	Copy from the Linear branch from splayed leaves
-	JU_COPYMEM(Pjbl->jbl_Expanse, Exp,  ExpCnt);
-	JU_COPYMEM(Pjbl->jbl_jp,      PJPs, ExpCnt);
-
-//	Pass back new pointer to the Linear branch in JP
-	Pjp->jp_Addr = (Word_t) PjblRaw;
-
-	return(1);
-
-} // j__udyCreateBranchL()
-
-
-// ****************************************************************************
-// J U D Y   C R E A T E   B R A N C H   B
-//
-// Build a BranchB from an array of JPs and associated 1 byte digits
-// (expanses).  Return with Pjp pointing to the BranchB.  Caller must
-// deallocate passed arrays, if necessary.
-//
-// We have no idea what kind of BranchB it is, so caller must set the jp_Type.
-//
-// Return -1 if error (details in Pjpm), otherwise return 1.
-
-FUNCTION int j__udyCreateBranchB(
-	Pjp_t	Pjp,		// Build JPs from this place
-	Pjp_t	PJPs,		// Array of JPs to put into Bitmap branch
-	uint8_t Exp[],		// Array of expanses to put into bitmap
-	Word_t  ExpCnt,		// Number of above JPs and Expanses
-	Pvoid_t	Pjpm)
-{
-	Pjbb_t	PjbbRaw;	// pointer to bitmap branch.
-	Pjbb_t	Pjbb;
-	Word_t  ii, jj;		// Temps
-	uint8_t CurrSubExp;	// Current sub expanse for BM
-
-// This assertion says the number of populated subexpanses is not too large.
-// This function is only called when a BranchL overflows to a BranchB or when a
-// cascade occurs, meaning a leaf overflows.  Either way ExpCnt cant be very
-// large, in fact a lot smaller than cJU_BRANCHBMAXJPS.  (Otherwise a BranchU
-// would be used.)  Popping this assertion means something (unspecified) has
-// gone very wrong, or else Judys design criteria have changed, although in
-// fact there should be no HARM in creating a BranchB with higher actual
-// fanout.
-
-	assert(ExpCnt <= cJU_BRANCHBMAXJPS);
-
-//	Get memory for a Bitmap branch
-	PjbbRaw	= j__udyAllocJBB(Pjpm);
-	if (PjbbRaw == (Pjbb_t) NULL) return(-1);
-	Pjbb = P_JBB(PjbbRaw);
-
-//	Get 1st "sub" expanse (0..7) of bitmap branch
-	CurrSubExp = Exp[0] / cJU_BITSPERSUBEXPB;
-
-// Index thru all 1 byte sized expanses:
-
-	for (jj = ii = 0; ii <= ExpCnt; ii++)
-	{
-		Word_t SubExp;	// Cannot be a uint8_t
-
-//		Make sure we cover the last one
-		if (ii == ExpCnt)
-		{
-			SubExp = cJU_ALLONES;	// Force last one
-		}
-		else
-		{
-//			Calculate the "sub" expanse of the byte expanse
-			SubExp = Exp[ii] / cJU_BITSPERSUBEXPB;  // Bits 5..7.
-
-//			Set the bit that represents the expanse in Exp[]
-			JU_JBB_BITMAP(Pjbb, SubExp) |= JU_BITPOSMASKB(Exp[ii]);
-		}
-//		Check if a new "sub" expanse range needed
-		if (SubExp != CurrSubExp)
-		{
-//			Get number of JPs in this sub expanse
-			Word_t NumJP = ii - jj;
-			Pjp_t  PjpRaw;
-			Pjp_t  Pjp;
-
-			PjpRaw = j__udyAllocJBBJP(NumJP, Pjpm);
-                        Pjp    = P_JP(PjpRaw);
-
-			if (PjpRaw == (Pjp_t) NULL)	// out of memory.
-			{
-
-// Free any previous allocations:
-
-			    while(CurrSubExp--)
-			    {
-				NumJP = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb,
-								  CurrSubExp));
-				if (NumJP)
-				{
-				    j__udyFreeJBBJP(JU_JBB_PJP(Pjbb,
-						    CurrSubExp), NumJP, Pjpm);
-				}
-			    }
-			    j__udyFreeJBB(PjbbRaw, Pjpm);
-			    return(-1);
-			}
-
-// Place the array of JPs in bitmap branch:
-
-			JU_JBB_PJP(Pjbb, CurrSubExp) = PjpRaw;
-
-// Copy the JPs to new leaf:
-
-			JU_COPYMEM(Pjp, PJPs + jj, NumJP);
-
-// On to the next bitmap branch "sub" expanse:
-
-			jj	   = ii;
-			CurrSubExp = SubExp;
-		}
-	} // for each 1-byte expanse
-
-// Pass back some of the JP to the new Bitmap branch:
-
-	Pjp->jp_Addr = (Word_t) PjbbRaw;
-
-	return(1);
-
-} // j__udyCreateBranchB()
-
-
-// ****************************************************************************
-// J U D Y   C R E A T E   B R A N C H   U
-//
-// Build a BranchU from a BranchB.  Return with Pjp pointing to the BranchU.
-// Free the BranchB and its JP subarrays.
-//
-// Return -1 if error (details in Pjpm), otherwise return 1.
-
-FUNCTION int j__udyCreateBranchU(
-	Pjp_t	  Pjp,
-	Pvoid_t	  Pjpm)
-{
-	jp_t	  JPNull;
-        Pjbu_t    PjbuRaw;
-        Pjbu_t    Pjbu;
-	Pjbb_t	  PjbbRaw;
-	Pjbb_t	  Pjbb;
-	Word_t	  ii, jj;
-	BITMAPB_t BitMap;
-	Pjp_t	  PDstJP;
-#ifdef JU_STAGED_EXP
-	jbu_t	  BranchU;	// Staged uncompressed branch
-#else
-
-// Allocate memory for a BranchU:
-
-	PjbuRaw = j__udyAllocJBU(Pjpm);
-	if (PjbuRaw == (Pjbu_t) NULL) return(-1);
-        Pjbu = P_JBU(PjbuRaw);
-#endif
-        JU_JPSETADT(&JPNull, 0, 0, JU_JPTYPE(Pjp) - cJU_JPBRANCH_B2 + cJU_JPNULL1);
-
-// Get the pointer to the BranchB:
-
-	PjbbRaw	= (Pjbb_t) (Pjp->jp_Addr);
-	Pjbb	= P_JBB(PjbbRaw);
-
-//	Set the pointer to the Uncompressed branch
-#ifdef JU_STAGED_EXP
-	PDstJP = BranchU.jbu_jp;
-#else
-        PDstJP = Pjbu->jbu_jp;
-#endif
-	for (ii = 0; ii < cJU_NUMSUBEXPB; ii++)
-	{
-		Pjp_t	PjpA;
-		Pjp_t	PjpB;
-
-		PjpB = PjpA = P_JP(JU_JBB_PJP(Pjbb, ii));
-
-//		Get the bitmap for this subexpanse
-		BitMap	= JU_JBB_BITMAP(Pjbb, ii);
-
-//		NULL empty subexpanses
-		if (BitMap == 0)
-		{
-//			But, fill with NULLs
-			for (jj = 0; jj < cJU_BITSPERSUBEXPB; jj++)
-			{
-				PDstJP[jj] = JPNull;
-			}
-			PDstJP += cJU_BITSPERSUBEXPB;
-			continue;
-		}
-//		Check if Uncompressed subexpanse
-		if (BitMap == cJU_FULLBITMAPB)
-		{
-//			Copy subexpanse to the Uncompressed branch intact
-			JU_COPYMEM(PDstJP, PjpA, cJU_BITSPERSUBEXPB);
-
-//			Bump to next subexpanse
-			PDstJP += cJU_BITSPERSUBEXPB;
-
-//			Set length of subexpanse
-			jj = cJU_BITSPERSUBEXPB;
-		}
-		else
-		{
-			for (jj = 0; jj < cJU_BITSPERSUBEXPB; jj++)
-			{
-//				Copy JP or NULLJP depending on bit
-				if (BitMap & 1) { *PDstJP = *PjpA++; }
-				else		{ *PDstJP = JPNull; }
-
-				PDstJP++;	// advance to next JP
-				BitMap >>= 1;
-			}
-			jj = PjpA - PjpB;
-		}
-
-// Free the subexpanse:
-
-		j__udyFreeJBBJP(JU_JBB_PJP(Pjbb, ii), jj, Pjpm);
-
-	} // for each JP in BranchU
-
-#ifdef JU_STAGED_EXP
-
-// Allocate memory for a BranchU:
-
-	PjbuRaw = j__udyAllocJBU(Pjpm);
-	if (PjbuRaw == (Pjbu_t) NULL) return(-1);
-        Pjbu = P_JBU(PjbuRaw);
-
-// Copy staged branch to newly allocated branch:
-//
-// TBD:  I think this code is broken.
-
-	*Pjbu = BranchU;
-
-#endif // JU_STAGED_EXP
-
-// Finally free the BranchB and put the BranchU in its place:
-
-	j__udyFreeJBB(PjbbRaw, Pjpm);
-
-	Pjp->jp_Addr  = (Word_t) PjbuRaw;
-	Pjp->jp_Type += cJU_JPBRANCH_U - cJU_JPBRANCH_B;
-
-	return(1);
-
-} // j__udyCreateBranchU()
diff --git a/libs/klib/judy/JudyDecascade.c b/libs/klib/judy/JudyDecascade.c
deleted file mode 100644
index da625bc..0000000
--- a/libs/klib/judy/JudyDecascade.c
+++ /dev/null
@@ -1,1204 +0,0 @@
-// Copyright (C) 2000 - 2002 Hewlett-Packard Company
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the term of the GNU Lesser 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 Lesser General Public License
-// for more details.
-//
-// You should have received a copy of the GNU Lesser 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
-// _________________
-
-// "Decascade" support functions for JudyDel.c:  These functions convert
-// smaller-index-size leaves to larger-index-size leaves, and also, bitmap
-// leaves (LeafB1s) to Leaf1s, and some types of branches to smaller branches
-// at the same index size.  Some "decascading" occurs explicitly in JudyDel.c,
-// but rare or large subroutines appear as functions here, and the overhead to
-// call them is negligible.
-//
-// Compile with one of -DJUDY1 or -DJUDYL.  Note:  Function names are converted
-// to Judy1 or JudyL specific values by external #defines.
-
-#if (! (defined(JUDY1) || defined(JUDYL)))
-#error:  One of -DJUDY1 or -DJUDYL must be specified.
-#endif
-
-#ifdef JUDY1
-#include "Judy1.h"
-#endif
-#ifdef JUDYL
-#include "JudyL.h"
-#endif
-
-#include "JudyPrivate1L.h"
-
-DBGCODE(extern void JudyCheckSorted(Pjll_t Pjll, Word_t Pop1, long IndexSize);)
-
-
-// ****************************************************************************
-// __ J U D Y   C O P Y   2   T O   3
-//
-// Copy one or more 2-byte Indexes to a series of 3-byte Indexes.
-
-FUNCTION static void j__udyCopy2to3(
-	uint8_t *  PDest,	// to where to copy 3-byte Indexes.
-	uint16_t * PSrc,	// from where to copy 2-byte indexes.
-	Word_t     Pop1,	// number of Indexes to copy.
-	Word_t     MSByte)	// most-significant byte, prefix to each Index.
-{
-	Word_t	   Temp;	// for building 3-byte Index.
-
-	assert(Pop1);
-
-        do {
-	    Temp = MSByte | *PSrc++;
-	    JU_COPY3_LONG_TO_PINDEX(PDest, Temp);
-	    PDest += 3;
-        } while (--Pop1);
-
-} // j__udyCopy2to3()
-
-
-#ifdef JU_64BIT
-
-// ****************************************************************************
-// __ J U D Y   C O P Y   3   T O   4
-//
-// Copy one or more 3-byte Indexes to a series of 4-byte Indexes.
-
-FUNCTION static void j__udyCopy3to4(
-	uint32_t * PDest,	// to where to copy 4-byte Indexes.
-	uint8_t *  PSrc,	// from where to copy 3-byte indexes.
-	Word_t     Pop1,	// number of Indexes to copy.
-	Word_t     MSByte)	// most-significant byte, prefix to each Index.
-{
-	Word_t	   Temp;	// for building 4-byte Index.
-
-	assert(Pop1);
-
-        do {
-	    JU_COPY3_PINDEX_TO_LONG(Temp, PSrc);
-	    Temp |= MSByte;
-	    PSrc += 3;
-	    *PDest++ = Temp;		// truncates to uint32_t.
-        } while (--Pop1);
-
-} // j__udyCopy3to4()
-
-
-// ****************************************************************************
-// __ J U D Y   C O P Y   4   T O   5
-//
-// Copy one or more 4-byte Indexes to a series of 5-byte Indexes.
-
-FUNCTION static void j__udyCopy4to5(
-	uint8_t *  PDest,	// to where to copy 4-byte Indexes.
-	uint32_t * PSrc,	// from where to copy 4-byte indexes.
-	Word_t     Pop1,	// number of Indexes to copy.
-	Word_t     MSByte)	// most-significant byte, prefix to each Index.
-{
-	Word_t	   Temp;	// for building 5-byte Index.
-
-	assert(Pop1);
-
-        do {
-	    Temp = MSByte | *PSrc++;
-	    JU_COPY5_LONG_TO_PINDEX(PDest, Temp);
-	    PDest += 5;
-        } while (--Pop1);
-
-} // j__udyCopy4to5()
-
-
-// ****************************************************************************
-// __ J U D Y   C O P Y   5   T O   6
-//
-// Copy one or more 5-byte Indexes to a series of 6-byte Indexes.
-
-FUNCTION static void j__udyCopy5to6(
-	uint8_t * PDest,	// to where to copy 6-byte Indexes.
-	uint8_t * PSrc,		// from where to copy 5-byte indexes.
-	Word_t    Pop1,		// number of Indexes to copy.
-	Word_t    MSByte)	// most-significant byte, prefix to each Index.
-{
-	Word_t	  Temp;		// for building 6-byte Index.
-
-	assert(Pop1);
-
-        do {
-	    JU_COPY5_PINDEX_TO_LONG(Temp, PSrc);
-	    Temp |= MSByte;
-	    JU_COPY6_LONG_TO_PINDEX(PDest, Temp);
-	    PSrc  += 5;
-	    PDest += 6;
-        } while (--Pop1);
-
-} // j__udyCopy5to6()
-
-
-// ****************************************************************************
-// __ J U D Y   C O P Y   6   T O   7
-//
-// Copy one or more 6-byte Indexes to a series of 7-byte Indexes.
-
-FUNCTION static void j__udyCopy6to7(
-	uint8_t * PDest,	// to where to copy 6-byte Indexes.
-	uint8_t * PSrc,		// from where to copy 5-byte indexes.
-	Word_t    Pop1,		// number of Indexes to copy.
-	Word_t    MSByte)	// most-significant byte, prefix to each Index.
-{
-	Word_t	  Temp;		// for building 6-byte Index.
-
-	assert(Pop1);
-
-        do {
-	    JU_COPY6_PINDEX_TO_LONG(Temp, PSrc);
-	    Temp |= MSByte;
-	    JU_COPY7_LONG_TO_PINDEX(PDest, Temp);
-	    PSrc  += 6;
-	    PDest += 7;
-        } while (--Pop1);
-
-} // j__udyCopy6to7()
-
-#endif // JU_64BIT
-
-
-#ifndef JU_64BIT // 32-bit
-
-// ****************************************************************************
-// __ J U D Y   C O P Y   3   T O   W
-//
-// Copy one or more 3-byte Indexes to a series of longs (words, always 4-byte).
-
-FUNCTION static void j__udyCopy3toW(
-	PWord_t   PDest,	// to where to copy full-word Indexes.
-	uint8_t * PSrc,		// from where to copy 3-byte indexes.
-	Word_t    Pop1,		// number of Indexes to copy.
-	Word_t    MSByte)	// most-significant byte, prefix to each Index.
-{
-	assert(Pop1);
-
-        do {
-	    JU_COPY3_PINDEX_TO_LONG(*PDest, PSrc);
-	    *PDest++ |= MSByte;
-	    PSrc     += 3;
-        } while (--Pop1);
-
-} // j__udyCopy3toW()
-
-
-#else // JU_64BIT
-
-// ****************************************************************************
-// __ J U D Y   C O P Y   7   T O   W
-//
-// Copy one or more 7-byte Indexes to a series of longs (words, always 8-byte).
-
-FUNCTION static void j__udyCopy7toW(
-	PWord_t   PDest,	// to where to copy full-word Indexes.
-	uint8_t * PSrc,		// from where to copy 7-byte indexes.
-	Word_t    Pop1,		// number of Indexes to copy.
-	Word_t    MSByte)	// most-significant byte, prefix to each Index.
-{
-	assert(Pop1);
-
-        do {
-	    JU_COPY7_PINDEX_TO_LONG(*PDest, PSrc);
-	    *PDest++ |= MSByte;
-	    PSrc     += 7;
-        } while (--Pop1);
-
-} // j__udyCopy7toW()
-
-#endif // JU_64BIT
-
-
-// ****************************************************************************
-// __ J U D Y   B R A N C H   B   T O   B R A N C H   L
-//
-// When a BranchB shrinks to have few enough JPs, call this function to convert
-// it to a BranchL.  Return 1 for success, or -1 for failure (with details in
-// Pjpm).
-
-FUNCTION int j__udyBranchBToBranchL(
-	Pjp_t	Pjp,		// points to BranchB to shrink.
-	Pvoid_t	Pjpm)		// for global accounting.
-{
-	Pjbb_t	PjbbRaw;	// old BranchB to shrink.
-	Pjbb_t	Pjbb;
-	Pjbl_t	PjblRaw;	// new BranchL to create.
-	Pjbl_t	Pjbl;
-	Word_t	Digit;		// in BranchB.
-	Word_t  NumJPs;		// non-null JPs in BranchB.
-	uint8_t Expanse[cJU_BRANCHLMAXJPS];	// for building jbl_Expanse[].
-	Pjp_t	Pjpjbl;		// current JP in BranchL.
-	Word_t  SubExp;		// in BranchB.
-
-	assert(JU_JPTYPE(Pjp) >= cJU_JPBRANCH_B2);
-	assert(JU_JPTYPE(Pjp) <= cJU_JPBRANCH_B);
-
-	PjbbRaw	= (Pjbb_t) (Pjp->jp_Addr);
-	Pjbb	= P_JBB(PjbbRaw);
-
-// Copy 1-byte subexpanse digits from BranchB to temporary buffer for BranchL,
-// for each bit set in the BranchB:
-//
-// TBD:  The following supports variable-sized linear branches, but they are no
-// longer variable; this could be simplified to save the copying.
-//
-// TBD:  Since cJU_BRANCHLMAXJP == 7 now, and cJU_BRANCHUNUMJPS == 256, the
-// following might be inefficient; is there a faster way to do it?  At least
-// skip wholly empty subexpanses?
-
-	for (NumJPs = Digit = 0; Digit < cJU_BRANCHUNUMJPS; ++Digit)
-	{
-	    if (JU_BITMAPTESTB(Pjbb, Digit))
-	    {
-		Expanse[NumJPs++] = Digit;
-		assert(NumJPs <= cJU_BRANCHLMAXJPS);	// required of caller.
-	    }
-	}
-
-// Allocate and populate the BranchL:
-
-	if ((PjblRaw = j__udyAllocJBL(Pjpm)) == (Pjbl_t) NULL) return(-1);
-	Pjbl = P_JBL(PjblRaw);
-
-	JU_COPYMEM(Pjbl->jbl_Expanse, Expanse, NumJPs);
-
-	Pjbl->jbl_NumJPs = NumJPs;
-	DBGCODE(JudyCheckSorted((Pjll_t) (Pjbl->jbl_Expanse), NumJPs, 1);)
-
-// Copy JPs from each BranchB subexpanse subarray:
-
-	Pjpjbl = P_JP(Pjbl->jbl_jp);	// start at first JP in array.
-
-	for (SubExp = 0; SubExp < cJU_NUMSUBEXPB; ++SubExp)
-	{
-	    Pjp_t PjpRaw = JU_JBB_PJP(Pjbb, SubExp);	// current Pjp.
-	    Pjp_t Pjp;
-
-	    if (PjpRaw == (Pjp_t) NULL) continue;  // skip empty subexpanse.
-	    Pjp = P_JP(PjpRaw);
-
-	    NumJPs = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, SubExp));
-	    assert(NumJPs);
-	    JU_COPYMEM(Pjpjbl, Pjp, NumJPs);	 // one subarray at a time.
-
-	    Pjpjbl += NumJPs;
-	    j__udyFreeJBBJP(PjpRaw, NumJPs, Pjpm);	// subarray.
-	}
-	j__udyFreeJBB(PjbbRaw, Pjpm);		// BranchB itself.
-
-// Finish up:  Calculate new JP type (same index size = level in new class),
-// and tie new BranchB into parent JP:
-
-	Pjp->jp_Type += cJU_JPBRANCH_L - cJU_JPBRANCH_B;
-	Pjp->jp_Addr  = (Word_t) PjblRaw;
-
-	return(1);
-
-} // j__udyBranchBToBranchL()
-
-
-#ifdef notdef
-
-// ****************************************************************************
-// __ J U D Y   B R A N C H   U   T O   B R A N C H   B
-//
-// When a BranchU shrinks to need little enough memory, call this function to
-// convert it to a BranchB to save memory (at the cost of some speed).  Return
-// 1 for success, or -1 for failure (with details in Pjpm).
-//
-// TBD:  Fill out if/when needed.  Not currently used in JudyDel.c for reasons
-// explained there.
-
-FUNCTION int j__udyBranchUToBranchB(
-	Pjp_t	Pjp,		// points to BranchU to shrink.
-	Pvoid_t	Pjpm)		// for global accounting.
-{
-	assert(FALSE);
-	return(1);
-}
-#endif // notdef
-
-
-#if (defined(JUDYL) || (! defined(JU_64BIT)))
-
-// ****************************************************************************
-// __ J U D Y   L E A F   B 1   T O   L E A F   1
-//
-// Shrink a bitmap leaf (cJU_LEAFB1) to linear leaf (cJU_JPLEAF1).
-// Return 1 for success, or -1 for failure (with details in Pjpm).
-//
-// Note:  This function is different than the other JudyLeaf*ToLeaf*()
-// functions because it receives a Pjp, not just a leaf, and handles its own
-// allocation and free, in order to allow the caller to continue with a LeafB1
-// if allocation fails.
-
-FUNCTION int j__udyLeafB1ToLeaf1(
-	Pjp_t	  Pjp,		// points to LeafB1 to shrink.
-	Pvoid_t	  Pjpm)		// for global accounting.
-{
-	Pjlb_t    PjlbRaw;	// bitmap in old leaf.
-	Pjlb_t    Pjlb;
-	Pjll_t	  PjllRaw;	// new Leaf1.
-	uint8_t	* Pleaf1;	// Leaf1 pointer type.
-	Word_t    Digit;	// in LeafB1 bitmap.
-#ifdef JUDYL
-	Pjv_t	  PjvNew;	// value area in new Leaf1.
-	Word_t    Pop1;
-	Word_t    SubExp;
-#endif
-
-	assert(JU_JPTYPE(Pjp) == cJU_JPLEAF_B1);
-	assert(((JU_JPDCDPOP0(Pjp) & 0xFF) + 1) == cJU_LEAF1_MAXPOP1);
-
-// Allocate JPLEAF1 and prepare pointers:
-
-	if ((PjllRaw = j__udyAllocJLL1(cJU_LEAF1_MAXPOP1, Pjpm)) == 0)
-	    return(-1);
-
-	Pleaf1	= (uint8_t *) P_JLL(PjllRaw);
-	PjlbRaw	= (Pjlb_t) (Pjp->jp_Addr);
-	Pjlb	= P_JLB(PjlbRaw);
-	JUDYLCODE(PjvNew = JL_LEAF1VALUEAREA(Pleaf1, cJL_LEAF1_MAXPOP1);)
-
-// Copy 1-byte indexes from old LeafB1 to new Leaf1:
-
-	for (Digit = 0; Digit < cJU_BRANCHUNUMJPS; ++Digit)
-	    if (JU_BITMAPTESTL(Pjlb, Digit))
-		*Pleaf1++ = Digit;
-
-#ifdef JUDYL
-
-// Copy all old-LeafB1 value areas from value subarrays to new Leaf1:
-
-	for (SubExp = 0; SubExp < cJU_NUMSUBEXPL; ++SubExp)
-	{
-	    Pjv_t PjvRaw = JL_JLB_PVALUE(Pjlb, SubExp);
-	    Pjv_t Pjv    = P_JV(PjvRaw);
-
-	    if (Pjv == (Pjv_t) NULL) continue;	// skip empty subarray.
-
-	    Pop1 = j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, SubExp));  // subarray.
-	    assert(Pop1);
-
-	    JU_COPYMEM(PjvNew, Pjv, Pop1);		// copy value areas.
-	    j__udyLFreeJV(PjvRaw, Pop1, Pjpm);
-	    PjvNew += Pop1;				// advance through new.
-	}
-
-	assert((((Word_t) Pleaf1) - (Word_t) P_JLL(PjllRaw))
-	    == (PjvNew - JL_LEAF1VALUEAREA(P_JLL(PjllRaw), cJL_LEAF1_MAXPOP1)));
-#endif // JUDYL
-
-	DBGCODE(JudyCheckSorted((Pjll_t) P_JLL(PjllRaw),
-			    (((Word_t) Pleaf1) - (Word_t) P_JLL(PjllRaw)), 1);)
-
-// Finish up:  Free the old LeafB1 and plug the new Leaf1 into the JP:
-//
-// Note:  jp_DcdPopO does not change here.
-
-	j__udyFreeJLB1(PjlbRaw, Pjpm);
-
-	Pjp->jp_Addr = (Word_t) PjllRaw;
-	Pjp->jp_Type = cJU_JPLEAF1;
-
-	return(1);
-
-} // j__udyLeafB1ToLeaf1()
-
-#endif // (JUDYL || (! JU_64BIT))
-
-
-// ****************************************************************************
-// __ J U D Y   L E A F   1   T O   L E A F   2
-//
-// Copy 1-byte Indexes from a LeafB1 or Leaf1 to 2-byte Indexes in a Leaf2.
-// Pjp MUST be one of:  cJU_JPLEAF_B1, cJU_JPLEAF1, or cJU_JPIMMED_1_*.
-// Return number of Indexes copied.
-//
-// TBD:  In this and all following functions, the caller should already be able
-// to compute the Pop1 return value, so why return it?
-
-FUNCTION Word_t  j__udyLeaf1ToLeaf2(
-	uint16_t * PLeaf2,	// destination uint16_t * Index portion of leaf.
-#ifdef JUDYL
-	Pjv_t	   Pjv2,	// destination value part of leaf.
-#endif
-	Pjp_t	   Pjp,		// 1-byte-index object from which to copy.
-	Word_t     MSByte,	// most-significant byte, prefix to each Index.
-	Pvoid_t	   Pjpm)	// for global accounting.
-{
-	Word_t	   Pop1;	// Indexes in leaf.
-	Word_t	   Offset;	// in linear leaf list.
-JUDYLCODE(Pjv_t	   Pjv1Raw;)	// source object value area.
-JUDYLCODE(Pjv_t	   Pjv1;)
-
-	switch (JU_JPTYPE(Pjp))
-	{
-
-
-// JPLEAF_B1:
-
-	case cJU_JPLEAF_B1:
-	{
-	    Pjlb_t Pjlb = P_JLB(Pjp->jp_Addr);
-	    Word_t Digit;	// in LeafB1 bitmap.
-  JUDYLCODE(Word_t SubExp;)	// in LeafB1.
-
-	    Pop1 = JU_JPBRANCH_POP0(Pjp, 1) + 1; assert(Pop1);
-
-// Copy 1-byte indexes from old LeafB1 to new Leaf2, including splicing in
-// the missing MSByte needed in the Leaf2:
-
-	    for (Digit = 0; Digit < cJU_BRANCHUNUMJPS; ++Digit)
-		if (JU_BITMAPTESTL(Pjlb, Digit))
-		    *PLeaf2++ = MSByte | Digit;
-
-#ifdef JUDYL
-
-// Copy all old-LeafB1 value areas from value subarrays to new Leaf2:
-
-	    for (SubExp = 0; SubExp < cJU_NUMSUBEXPL; ++SubExp)
-	    {
-		Word_t SubExpPop1;
-
-		Pjv1Raw = JL_JLB_PVALUE(Pjlb, SubExp);
-		if (Pjv1Raw == (Pjv_t) NULL) continue;	// skip empty.
-		Pjv1 = P_JV(Pjv1Raw);
-
-		SubExpPop1 = j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, SubExp));
-		assert(SubExpPop1);
-
-		JU_COPYMEM(Pjv2, Pjv1, SubExpPop1);	// copy value areas.
-		j__udyLFreeJV(Pjv1Raw, SubExpPop1, Pjpm);
-		Pjv2 += SubExpPop1;			// advance through new.
-	    }
-#endif // JUDYL
-
-	    j__udyFreeJLB1((Pjlb_t) (Pjp->jp_Addr), Pjpm);  // LeafB1 itself.
-	    return(Pop1);
-
-	} // case cJU_JPLEAF_B1
-
-
-#if (defined(JUDYL) || (! defined(JU_64BIT)))
-
-// JPLEAF1:
-
-	case cJU_JPLEAF1:
-	{
-	    uint8_t * PLeaf1 = (uint8_t *) P_JLL(Pjp->jp_Addr);
-
-	    Pop1 = JU_JPBRANCH_POP0(Pjp, 1) + 1; assert(Pop1);
-	    JUDYLCODE(Pjv1 = JL_LEAF1VALUEAREA(PLeaf1, Pop1);)
-
-// Copy all Index bytes including splicing in missing MSByte needed in Leaf2
-// (plus, for JudyL, value areas):
-
-	    for (Offset = 0; Offset < Pop1; ++Offset)
-	    {
-		PLeaf2[Offset] = MSByte | PLeaf1[Offset];
-		JUDYLCODE(Pjv2[Offset] = Pjv1[Offset];)
-	    }
-	    j__udyFreeJLL1((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
-	    return(Pop1);
-	}
-#endif // (JUDYL || (! JU_64BIT))
-
-
-// JPIMMED_1_01:
-//
-// Note:  jp_DcdPopO has 3 [7] bytes of Index (all but most significant byte),
-// so the assignment to PLeaf2[] truncates and MSByte is not needed.
-
-	case cJU_JPIMMED_1_01:
-	{
-	    PLeaf2[0] = JU_JPDCDPOP0(Pjp);	// see above.
-	    JUDYLCODE(Pjv2[0] = Pjp->jp_Addr;)
-	    return(1);
-	}
-
-
-// JPIMMED_1_0[2+]:
-
-	case cJU_JPIMMED_1_02:
-	case cJU_JPIMMED_1_03:
-#if (defined(JUDY1) || defined(JU_64BIT))
-	case cJU_JPIMMED_1_04:
-	case cJU_JPIMMED_1_05:
-	case cJU_JPIMMED_1_06:
-	case cJU_JPIMMED_1_07:
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-	case cJ1_JPIMMED_1_08:
-	case cJ1_JPIMMED_1_09:
-	case cJ1_JPIMMED_1_10:
-	case cJ1_JPIMMED_1_11:
-	case cJ1_JPIMMED_1_12:
-	case cJ1_JPIMMED_1_13:
-	case cJ1_JPIMMED_1_14:
-	case cJ1_JPIMMED_1_15:
-#endif
-	{
-	    Pop1 = JU_JPTYPE(Pjp) - cJU_JPIMMED_1_02 + 2; assert(Pop1);
-	    JUDYLCODE(Pjv1Raw = (Pjv_t) (Pjp->jp_Addr);)
-	    JUDYLCODE(Pjv1    = P_JV(Pjv1Raw);)
-
-	    for (Offset = 0; Offset < Pop1; ++Offset)
-	    {
-#ifdef JUDY1
-		PLeaf2[Offset] = MSByte | Pjp->jp_1Index[Offset];
-#else
-		PLeaf2[Offset] = MSByte | Pjp->jp_LIndex[Offset];
-		Pjv2  [Offset] = Pjv1[Offset];
-#endif
-	    }
-	    JUDYLCODE(j__udyLFreeJV(Pjv1Raw, Pop1, Pjpm);)
-	    return(Pop1);
-	}
-
-
-// UNEXPECTED CASES, including JPNULL1, should be handled by caller:
-
-	default: assert(FALSE); break;
-
-	} // switch
-
-	return(0);
-
-} // j__udyLeaf1ToLeaf2()
-
-
-// *****************************************************************************
-// __ J U D Y   L E A F   2   T O   L E A F   3
-//
-// Copy 2-byte Indexes from a Leaf2 to 3-byte Indexes in a Leaf3.
-// Pjp MUST be one of:  cJU_JPLEAF2 or cJU_JPIMMED_2_*.
-// Return number of Indexes copied.
-//
-// Note:  By the time this function is called to compress a level-3 branch to a
-// Leaf3, the branch has no narrow pointers under it, meaning only level-2
-// objects are below it and must be handled here.
-
-FUNCTION Word_t  j__udyLeaf2ToLeaf3(
-	uint8_t * PLeaf3,	// destination "uint24_t *" Index part of leaf.
-#ifdef JUDYL
-	Pjv_t	  Pjv3,		// destination value part of leaf.
-#endif
-	Pjp_t	  Pjp,		// 2-byte-index object from which to copy.
-	Word_t    MSByte,	// most-significant byte, prefix to each Index.
-	Pvoid_t	  Pjpm)		// for global accounting.
-{
-	Word_t	  Pop1;		// Indexes in leaf.
-#if (defined(JUDYL) && defined(JU_64BIT))
-	Pjv_t	  Pjv2Raw;	// source object value area.
-#endif
-JUDYLCODE(Pjv_t	  Pjv2;)
-
-	switch (JU_JPTYPE(Pjp))
-	{
-
-
-// JPLEAF2:
-
-	case cJU_JPLEAF2:
-	{
-	    uint16_t * PLeaf2 = (uint16_t *) P_JLL(Pjp->jp_Addr);
-
-	    Pop1 = JU_JPLEAF_POP0(Pjp) + 1; assert(Pop1);
-	    j__udyCopy2to3(PLeaf3, PLeaf2, Pop1, MSByte);
-#ifdef JUDYL
-	    Pjv2 = JL_LEAF2VALUEAREA(PLeaf2, Pop1);
-	    JU_COPYMEM(Pjv3, Pjv2, Pop1);
-#endif
-	    j__udyFreeJLL2((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
-	    return(Pop1);
-	}
-
-
-// JPIMMED_2_01:
-//
-// Note:  jp_DcdPopO has 3 [7] bytes of Index (all but most significant byte),
-// so the "assignment" to PLeaf3[] is exact [truncates] and MSByte is not
-// needed.
-
-	case cJU_JPIMMED_2_01:
-	{
-	    JU_COPY3_LONG_TO_PINDEX(PLeaf3, JU_JPDCDPOP0(Pjp));	// see above.
-	    JUDYLCODE(Pjv3[0] = Pjp->jp_Addr;)
-	    return(1);
-	}
-
-
-// JPIMMED_2_0[2+]:
-
-#if (defined(JUDY1) || defined(JU_64BIT))
-	case cJU_JPIMMED_2_02:
-	case cJU_JPIMMED_2_03:
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-	case cJ1_JPIMMED_2_04:
-	case cJ1_JPIMMED_2_05:
-	case cJ1_JPIMMED_2_06:
-	case cJ1_JPIMMED_2_07:
-#endif
-#if (defined(JUDY1) || defined(JU_64BIT))
-	{
-	    JUDY1CODE(uint16_t * PLeaf2 = (uint16_t *) (Pjp->jp_1Index);)
-	    JUDYLCODE(uint16_t * PLeaf2 = (uint16_t *) (Pjp->jp_LIndex);)
-
-	    Pop1 = JU_JPTYPE(Pjp) - cJU_JPIMMED_2_02 + 2; assert(Pop1);
-	    j__udyCopy2to3(PLeaf3, PLeaf2, Pop1, MSByte);
-#ifdef JUDYL
-	    Pjv2Raw = (Pjv_t) (Pjp->jp_Addr);
-	    Pjv2    = P_JV(Pjv2Raw);
-	    JU_COPYMEM(Pjv3, Pjv2, Pop1);
-	    j__udyLFreeJV(Pjv2Raw, Pop1, Pjpm);
-#endif
-	    return(Pop1);
-	}
-#endif // (JUDY1 || JU_64BIT)
-
-
-// UNEXPECTED CASES, including JPNULL2, should be handled by caller:
-
-	default: assert(FALSE); break;
-
-	} // switch
-
-	return(0);
-
-} // j__udyLeaf2ToLeaf3()
-
-
-#ifdef JU_64BIT
-
-// ****************************************************************************
-// __ J U D Y   L E A F   3   T O   L E A F   4
-//
-// Copy 3-byte Indexes from a Leaf3 to 4-byte Indexes in a Leaf4.
-// Pjp MUST be one of:  cJU_JPLEAF3 or cJU_JPIMMED_3_*.
-// Return number of Indexes copied.
-//
-// Note:  By the time this function is called to compress a level-4 branch to a
-// Leaf4, the branch has no narrow pointers under it, meaning only level-3
-// objects are below it and must be handled here.
-
-FUNCTION Word_t  j__udyLeaf3ToLeaf4(
-	uint32_t * PLeaf4,	// destination uint32_t * Index part of leaf.
-#ifdef JUDYL
-	Pjv_t	   Pjv4,	// destination value part of leaf.
-#endif
-	Pjp_t	   Pjp,		// 3-byte-index object from which to copy.
-	Word_t     MSByte,	// most-significant byte, prefix to each Index.
-	Pvoid_t	   Pjpm)	// for global accounting.
-{
-	Word_t	   Pop1;	// Indexes in leaf.
-JUDYLCODE(Pjv_t	   Pjv3Raw;)	// source object value area.
-JUDYLCODE(Pjv_t	   Pjv3;)
-
-	switch (JU_JPTYPE(Pjp))
-	{
-
-
-// JPLEAF3:
-
-	case cJU_JPLEAF3:
-	{
-	    uint8_t * PLeaf3 = (uint8_t *) P_JLL(Pjp->jp_Addr);
-
-	    Pop1 = JU_JPLEAF_POP0(Pjp) + 1; assert(Pop1);
-	    j__udyCopy3to4(PLeaf4, (uint8_t *) PLeaf3, Pop1, MSByte);
-#ifdef JUDYL
-	    Pjv3 = JL_LEAF3VALUEAREA(PLeaf3, Pop1);
-	    JU_COPYMEM(Pjv4, Pjv3, Pop1);
-#endif
-	    j__udyFreeJLL3((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
-	    return(Pop1);
-	}
-
-
-// JPIMMED_3_01:
-//
-// Note:  jp_DcdPopO has 7 bytes of Index (all but most significant byte), so
-// the assignment to PLeaf4[] truncates and MSByte is not needed.
-
-	case cJU_JPIMMED_3_01:
-	{
-	    PLeaf4[0] = JU_JPDCDPOP0(Pjp);	// see above.
-	    JUDYLCODE(Pjv4[0] = Pjp->jp_Addr;)
-	    return(1);
-	}
-
-
-// JPIMMED_3_0[2+]:
-
-	case cJU_JPIMMED_3_02:
-#ifdef JUDY1
-	case cJ1_JPIMMED_3_03:
-	case cJ1_JPIMMED_3_04:
-	case cJ1_JPIMMED_3_05:
-#endif
-	{
-	    JUDY1CODE(uint8_t * PLeaf3 = (uint8_t *) (Pjp->jp_1Index);)
-	    JUDYLCODE(uint8_t * PLeaf3 = (uint8_t *) (Pjp->jp_LIndex);)
-
-	    JUDY1CODE(Pop1 = JU_JPTYPE(Pjp) - cJU_JPIMMED_3_02 + 2;)
-	    JUDYLCODE(Pop1 = 2;)
-
-	    j__udyCopy3to4(PLeaf4, PLeaf3, Pop1, MSByte);
-#ifdef JUDYL
-	    Pjv3Raw = (Pjv_t) (Pjp->jp_Addr);
-	    Pjv3    = P_JV(Pjv3Raw);
-	    JU_COPYMEM(Pjv4, Pjv3, Pop1);
-	    j__udyLFreeJV(Pjv3Raw, Pop1, Pjpm);
-#endif
-	    return(Pop1);
-	}
-
-
-// UNEXPECTED CASES, including JPNULL3, should be handled by caller:
-
-	default: assert(FALSE); break;
-
-	} // switch
-
-	return(0);
-
-} // j__udyLeaf3ToLeaf4()
-
-
-// Note:  In all following j__udyLeaf*ToLeaf*() functions, JPIMMED_*_0[2+]
-// cases exist for Judy1 (&& 64-bit) only.  JudyL has no equivalent Immeds.
-
-
-// *****************************************************************************
-// __ J U D Y   L E A F   4   T O   L E A F   5
-//
-// Copy 4-byte Indexes from a Leaf4 to 5-byte Indexes in a Leaf5.
-// Pjp MUST be one of:  cJU_JPLEAF4 or cJU_JPIMMED_4_*.
-// Return number of Indexes copied.
-//
-// Note:  By the time this function is called to compress a level-5 branch to a
-// Leaf5, the branch has no narrow pointers under it, meaning only level-4
-// objects are below it and must be handled here.
-
-FUNCTION Word_t  j__udyLeaf4ToLeaf5(
-	uint8_t * PLeaf5,	// destination "uint40_t *" Index part of leaf.
-#ifdef JUDYL
-	Pjv_t	  Pjv5,		// destination value part of leaf.
-#endif
-	Pjp_t	  Pjp,		// 4-byte-index object from which to copy.
-	Word_t    MSByte,	// most-significant byte, prefix to each Index.
-	Pvoid_t	  Pjpm)		// for global accounting.
-{
-	Word_t	  Pop1;		// Indexes in leaf.
-JUDYLCODE(Pjv_t	  Pjv4;)	// source object value area.
-
-	switch (JU_JPTYPE(Pjp))
-	{
-
-
-// JPLEAF4:
-
-	case cJU_JPLEAF4:
-	{
-	    uint32_t * PLeaf4 = (uint32_t *) P_JLL(Pjp->jp_Addr);
-
-	    Pop1 = JU_JPLEAF_POP0(Pjp) + 1; assert(Pop1);
-	    j__udyCopy4to5(PLeaf5, PLeaf4, Pop1, MSByte);
-#ifdef JUDYL
-	    Pjv4 = JL_LEAF4VALUEAREA(PLeaf4, Pop1);
-	    JU_COPYMEM(Pjv5, Pjv4, Pop1);
-#endif
-	    j__udyFreeJLL4((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
-	    return(Pop1);
-	}
-
-
-// JPIMMED_4_01:
-//
-// Note:  jp_DcdPopO has 7 bytes of Index (all but most significant byte), so
-// the assignment to PLeaf5[] truncates and MSByte is not needed.
-
-	case cJU_JPIMMED_4_01:
-	{
-	    JU_COPY5_LONG_TO_PINDEX(PLeaf5, JU_JPDCDPOP0(Pjp));	// see above.
-	    JUDYLCODE(Pjv5[0] = Pjp->jp_Addr;)
-	    return(1);
-	}
-
-
-#ifdef JUDY1
-
-// JPIMMED_4_0[4+]:
-
-	case cJ1_JPIMMED_4_02:
-	case cJ1_JPIMMED_4_03:
-	{
-	    uint32_t * PLeaf4 = (uint32_t *) (Pjp->jp_1Index);
-
-	    Pop1 = JU_JPTYPE(Pjp) - cJ1_JPIMMED_4_02 + 2;
-	    j__udyCopy4to5(PLeaf5, PLeaf4, Pop1, MSByte);
-	    return(Pop1);
-	}
-#endif // JUDY1
-
-
-// UNEXPECTED CASES, including JPNULL4, should be handled by caller:
-
-	default: assert(FALSE); break;
-
-	} // switch
-
-	return(0);
-
-} // j__udyLeaf4ToLeaf5()
-
-
-// ****************************************************************************
-// __ J U D Y   L E A F   5   T O   L E A F   6
-//
-// Copy 5-byte Indexes from a Leaf5 to 6-byte Indexes in a Leaf6.
-// Pjp MUST be one of:  cJU_JPLEAF5 or cJU_JPIMMED_5_*.
-// Return number of Indexes copied.
-//
-// Note:  By the time this function is called to compress a level-6 branch to a
-// Leaf6, the branch has no narrow pointers under it, meaning only level-5
-// objects are below it and must be handled here.
-
-FUNCTION Word_t  j__udyLeaf5ToLeaf6(
-	uint8_t * PLeaf6,	// destination uint8_t * Index part of leaf.
-#ifdef JUDYL
-	Pjv_t	  Pjv6,		// destination value part of leaf.
-#endif
-	Pjp_t	  Pjp,		// 5-byte-index object from which to copy.
-	Word_t    MSByte,	// most-significant byte, prefix to each Index.
-	Pvoid_t	  Pjpm)		// for global accounting.
-{
-	Word_t	  Pop1;		// Indexes in leaf.
-JUDYLCODE(Pjv_t	  Pjv5;)	// source object value area.
-
-	switch (JU_JPTYPE(Pjp))
-	{
-
-
-// JPLEAF5:
-
-	case cJU_JPLEAF5:
-	{
-	    uint8_t * PLeaf5 = (uint8_t *) P_JLL(Pjp->jp_Addr);
-
-	    Pop1 = JU_JPLEAF_POP0(Pjp) + 1; assert(Pop1);
-	    j__udyCopy5to6(PLeaf6, PLeaf5, Pop1, MSByte);
-#ifdef JUDYL
-	    Pjv5 = JL_LEAF5VALUEAREA(PLeaf5, Pop1);
-	    JU_COPYMEM(Pjv6, Pjv5, Pop1);
-#endif
-	    j__udyFreeJLL5((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
-	    return(Pop1);
-	}
-
-
-// JPIMMED_5_01:
-//
-// Note:  jp_DcdPopO has 7 bytes of Index (all but most significant byte), so
-// the assignment to PLeaf6[] truncates and MSByte is not needed.
-
-	case cJU_JPIMMED_5_01:
-	{
-	    JU_COPY6_LONG_TO_PINDEX(PLeaf6, JU_JPDCDPOP0(Pjp));	// see above.
-	    JUDYLCODE(Pjv6[0] = Pjp->jp_Addr;)
-	    return(1);
-	}
-
-
-#ifdef JUDY1
-
-// JPIMMED_5_0[2+]:
-
-	case cJ1_JPIMMED_5_02:
-	case cJ1_JPIMMED_5_03:
-	{
-	    uint8_t * PLeaf5 = (uint8_t *) (Pjp->jp_1Index);
-
-	    Pop1 = JU_JPTYPE(Pjp) - cJ1_JPIMMED_5_02 + 2;
-	    j__udyCopy5to6(PLeaf6, PLeaf5, Pop1, MSByte);
-	    return(Pop1);
-	}
-#endif // JUDY1
-
-
-// UNEXPECTED CASES, including JPNULL5, should be handled by caller:
-
-	default: assert(FALSE); break;
-
-	} // switch
-
-	return(0);
-
-} // j__udyLeaf5ToLeaf6()
-
-
-// *****************************************************************************
-// __ J U D Y   L E A F   6   T O   L E A F   7
-//
-// Copy 6-byte Indexes from a Leaf2 to 7-byte Indexes in a Leaf7.
-// Pjp MUST be one of:  cJU_JPLEAF6 or cJU_JPIMMED_6_*.
-// Return number of Indexes copied.
-//
-// Note:  By the time this function is called to compress a level-7 branch to a
-// Leaf7, the branch has no narrow pointers under it, meaning only level-6
-// objects are below it and must be handled here.
-
-FUNCTION Word_t  j__udyLeaf6ToLeaf7(
-	uint8_t * PLeaf7,	// destination "uint24_t *" Index part of leaf.
-#ifdef JUDYL
-	Pjv_t	  Pjv7,		// destination value part of leaf.
-#endif
-	Pjp_t	  Pjp,		// 6-byte-index object from which to copy.
-	Word_t    MSByte,	// most-significant byte, prefix to each Index.
-	Pvoid_t	  Pjpm)		// for global accounting.
-{
-	Word_t	  Pop1;		// Indexes in leaf.
-JUDYLCODE(Pjv_t	  Pjv6;)	// source object value area.
-
-	switch (JU_JPTYPE(Pjp))
-	{
-
-
-// JPLEAF6:
-
-	case cJU_JPLEAF6:
-	{
-	    uint8_t * PLeaf6 = (uint8_t *) P_JLL(Pjp->jp_Addr);
-
-	    Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
-	    j__udyCopy6to7(PLeaf7, PLeaf6, Pop1, MSByte);
-#ifdef JUDYL
-	    Pjv6 = JL_LEAF6VALUEAREA(PLeaf6, Pop1);
-	    JU_COPYMEM(Pjv7, Pjv6, Pop1);
-#endif
-	    j__udyFreeJLL6((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
-	    return(Pop1);
-	}
-
-
-// JPIMMED_6_01:
-//
-// Note:  jp_DcdPopO has 7 bytes of Index (all but most significant byte), so
-// the "assignment" to PLeaf7[] is exact and MSByte is not needed.
-
-	case cJU_JPIMMED_6_01:
-	{
-	    JU_COPY7_LONG_TO_PINDEX(PLeaf7, JU_JPDCDPOP0(Pjp));	// see above.
-	    JUDYLCODE(Pjv7[0] = Pjp->jp_Addr;)
-	    return(1);
-	}
-
-
-#ifdef JUDY1
-
-// JPIMMED_6_02:
-
-	case cJ1_JPIMMED_6_02:
-	{
-	    uint8_t * PLeaf6 = (uint8_t *) (Pjp->jp_1Index);
-
-	    j__udyCopy6to7(PLeaf7, PLeaf6, /* Pop1 = */ 2, MSByte);
-	    return(2);
-	}
-#endif // JUDY1
-
-
-// UNEXPECTED CASES, including JPNULL6, should be handled by caller:
-
-	default: assert(FALSE); break;
-
-	} // switch
-
-	return(0);
-
-} // j__udyLeaf6ToLeaf7()
-
-#endif // JU_64BIT
-
-
-#ifndef JU_64BIT // 32-bit version first
-
-// ****************************************************************************
-// __ J U D Y   L E A F   3   T O   L E A F   W
-//
-// Copy 3-byte Indexes from a Leaf3 to 4-byte Indexes in a LeafW.  Pjp MUST be
-// one of:  cJU_JPLEAF3 or cJU_JPIMMED_3_*.  Return number of Indexes copied.
-//
-// Note:  By the time this function is called to compress a level-L branch to a
-// LeafW, the branch has no narrow pointers under it, meaning only level-3
-// objects are below it and must be handled here.
-
-FUNCTION Word_t  j__udyLeaf3ToLeafW(
-	Pjlw_t	Pjlw,		// destination Index part of leaf.
-#ifdef JUDYL
-	Pjv_t	PjvW,		// destination value part of leaf.
-#endif
-	Pjp_t	Pjp,		// 3-byte-index object from which to copy.
-	Word_t	MSByte,		// most-significant byte, prefix to each Index.
-	Pvoid_t	Pjpm)		// for global accounting.
-{
-	Word_t	Pop1;		// Indexes in leaf.
-JUDYLCODE(Pjv_t Pjv3;)		// source object value area.
-
-	switch (JU_JPTYPE(Pjp))
-	{
-
-
-// JPLEAF3:
-
-	case cJU_JPLEAF3:
-	{
-	    uint8_t * PLeaf3 = (uint8_t *) P_JLL(Pjp->jp_Addr);
-
-	    Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
-	    j__udyCopy3toW((PWord_t) Pjlw, PLeaf3, Pop1, MSByte);
-#ifdef JUDYL
-	    Pjv3 = JL_LEAF3VALUEAREA(PLeaf3, Pop1);
-	    JU_COPYMEM(PjvW, Pjv3, Pop1);
-#endif
-	    j__udyFreeJLL3((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
-	    return(Pop1);
-	}
-
-
-// JPIMMED_3_01:
-//
-// Note:  jp_DcdPopO has 3 bytes of Index (all but most significant byte), and
-// MSByte must be ord in.
-
-	case cJU_JPIMMED_3_01:
-	{
-	    Pjlw[0] = MSByte | JU_JPDCDPOP0(Pjp);		// see above.
-	    JUDYLCODE(PjvW[0] = Pjp->jp_Addr;)
-	    return(1);
-	}
-
-
-#ifdef JUDY1
-
-// JPIMMED_3_02:
-
-	case cJU_JPIMMED_3_02:
-	{
-	    uint8_t * PLeaf3 = (uint8_t *) (Pjp->jp_1Index);
-
-	    j__udyCopy3toW((PWord_t) Pjlw, PLeaf3, /* Pop1 = */ 2, MSByte);
-	    return(2);
-	}
-#endif // JUDY1
-
-
-// UNEXPECTED CASES, including JPNULL3, should be handled by caller:
-
-	default: assert(FALSE); break;
-
-	} // switch
-
-	return(0);
-
-} // j__udyLeaf3ToLeafW()
-
-
-#else // JU_64BIT
-
-
-// ****************************************************************************
-// __ J U D Y   L E A F   7   T O   L E A F   W
-//
-// Copy 7-byte Indexes from a Leaf7 to 8-byte Indexes in a LeafW.
-// Pjp MUST be one of:  cJU_JPLEAF7 or cJU_JPIMMED_7_*.
-// Return number of Indexes copied.
-//
-// Note:  By the time this function is called to compress a level-L branch to a
-// LeafW, the branch has no narrow pointers under it, meaning only level-7
-// objects are below it and must be handled here.
-
-FUNCTION Word_t  j__udyLeaf7ToLeafW(
-	Pjlw_t	Pjlw,		// destination Index part of leaf.
-#ifdef JUDYL
-	Pjv_t	PjvW,		// destination value part of leaf.
-#endif
-	Pjp_t	Pjp,		// 7-byte-index object from which to copy.
-	Word_t	MSByte,		// most-significant byte, prefix to each Index.
-	Pvoid_t	Pjpm)		// for global accounting.
-{
-	Word_t	Pop1;		// Indexes in leaf.
-JUDYLCODE(Pjv_t	Pjv7;)		// source object value area.
-
-	switch (JU_JPTYPE(Pjp))
-	{
-
-
-// JPLEAF7:
-
-	case cJU_JPLEAF7:
-	{
-	    uint8_t * PLeaf7 = (uint8_t *) P_JLL(Pjp->jp_Addr);
-
-	    Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
-	    j__udyCopy7toW((PWord_t) Pjlw, PLeaf7, Pop1, MSByte);
-#ifdef JUDYL
-	    Pjv7 = JL_LEAF7VALUEAREA(PLeaf7, Pop1);
-	    JU_COPYMEM(PjvW, Pjv7, Pop1);
-#endif
-	    j__udyFreeJLL7((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
-	    return(Pop1);
-	}
-
-
-// JPIMMED_7_01:
-//
-// Note:  jp_DcdPopO has 7 bytes of Index (all but most significant byte), and
-// MSByte must be ord in.
-
-	case cJU_JPIMMED_7_01:
-	{
-	    Pjlw[0] = MSByte | JU_JPDCDPOP0(Pjp);		// see above.
-	    JUDYLCODE(PjvW[0] = Pjp->jp_Addr;)
-	    return(1);
-	}
-
-
-#ifdef JUDY1
-
-// JPIMMED_7_02:
-
-	case cJ1_JPIMMED_7_02:
-	{
-	    uint8_t * PLeaf7 = (uint8_t *) (Pjp->jp_1Index);
-
-	    j__udyCopy7toW((PWord_t) Pjlw, PLeaf7, /* Pop1 = */ 2, MSByte);
-	    return(2);
-	}
-#endif
-
-
-// UNEXPECTED CASES, including JPNULL7, should be handled by caller:
-
-	default: assert(FALSE); break;
-
-	} // switch
-
-	return(0);
-
-} // j__udyLeaf7ToLeafW()
-
-#endif // JU_64BIT
diff --git a/libs/klib/judy/JudyDel.c b/libs/klib/judy/JudyDel.c
deleted file mode 100644
index 4291da6..0000000
--- a/libs/klib/judy/JudyDel.c
+++ /dev/null
@@ -1,2144 +0,0 @@
-// Copyright (C) 2000 - 2002 Hewlett-Packard Company
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the term of the GNU Lesser 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 Lesser General Public License
-// for more details.
-//
-// You should have received a copy of the GNU Lesser 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
-// _________________
-
-// Judy1Unset() and JudyLDel() functions for Judy1 and JudyL.
-// Compile with one of -DJUDY1 or -DJUDYL.
-//
-// About HYSTERESIS:  In the Judy code, hysteresis means leaving around a
-// nominally suboptimal (not maximally compressed) data structure after a
-// deletion.  As a result, the shape of the tree for two identical index sets
-// can differ depending on the insert/delete path taken to arrive at the index
-// sets.  The purpose is to minimize worst-case behavior (thrashing) that could
-// result from a series of intermixed insertions and deletions.  It also makes
-// for MUCH simpler code, because instead of performing, "delete and then
-// compress," it can say, "compress and then delete," where due to hysteresis,
-// compression is not even attempted until the object IS compressible.
-//
-// In some cases the code has no choice and it must "ungrow" a data structure
-// across a "phase transition" boundary without hysteresis.  In other cases the
-// amount (such as "hysteresis = 1") is indicated by the number of JP deletions
-// (in branches) or index deletions (in leaves) that can occur in succession
-// before compressing the data structure.  (It appears that hysteresis <= 1 in
-// all cases.)
-//
-// In general no hysteresis occurs when the data structure type remains the
-// same but the allocated memory chunk for the node must shrink, because the
-// relationship is hardwired and theres no way to know how much memory is
-// allocated to a given data structure.  Hysteresis = 0 in all these cases.
-//
-// TBD:  Could this code be faster if memory chunk hysteresis were supported
-// somehow along with data structure type hysteresis?
-//
-// TBD:  Should some of the assertions here be converted to product code that
-// returns JU_ERRNO_CORRUPT?
-//
-// TBD:  Dougs code had an odd mix of function-wide and limited-scope
-// variables.  Should some of the function-wide variables appear only in
-// limited scopes, or more likely, vice-versa?
-
-#if (! (defined(JUDY1) || defined(JUDYL)))
-#error:  One of -DJUDY1 or -DJUDYL must be specified.
-#endif
-
-#ifdef JUDY1
-#include "Judy1.h"
-#else
-#include "JudyL.h"
-#endif
-
-#include "JudyPrivate1L.h"
-
-DBGCODE(extern void JudyCheckPop(Pvoid_t PArray);)
-DBGCODE(extern void JudyCheckSorted(Pjll_t Pjll, Word_t Pop1, long IndexSize);)
-
-#ifdef TRACEJP
-#include "JudyPrintJP.c"
-#endif
-
-// These are defined to generic values in JudyCommon/JudyPrivateTypes.h:
-//
-// TBD:  These should be exported from a header file, but perhaps not, as they
-// are only used here, and exported from JudyDecascade.c, which is a separate
-// file for profiling reasons (to prevent inlining), but which potentially
-// could be merged with this file, either in SoftCM or at compile-time:
-
-#ifdef JUDY1
-
-extern int      j__udy1BranchBToBranchL(Pjp_t Pjp, Pvoid_t Pjpm);
-#ifndef JU_64BIT
-extern int      j__udy1LeafB1ToLeaf1(Pjp_t, Pvoid_t);
-#endif
-extern Word_t   j__udy1Leaf1ToLeaf2(uint16_t *, Pjp_t, Word_t, Pvoid_t);
-extern Word_t   j__udy1Leaf2ToLeaf3(uint8_t  *, Pjp_t, Word_t, Pvoid_t);
-#ifndef JU_64BIT
-extern Word_t   j__udy1Leaf3ToLeafW(Pjlw_t,     Pjp_t, Word_t, Pvoid_t);
-#else
-extern Word_t   j__udy1Leaf3ToLeaf4(uint32_t *, Pjp_t, Word_t, Pvoid_t);
-extern Word_t   j__udy1Leaf4ToLeaf5(uint8_t  *, Pjp_t, Word_t, Pvoid_t);
-extern Word_t   j__udy1Leaf5ToLeaf6(uint8_t  *, Pjp_t, Word_t, Pvoid_t);
-extern Word_t   j__udy1Leaf6ToLeaf7(uint8_t  *, Pjp_t, Word_t, Pvoid_t);
-extern Word_t   j__udy1Leaf7ToLeafW(Pjlw_t,     Pjp_t, Word_t, Pvoid_t);
-#endif
-
-#else // JUDYL
-
-extern int      j__udyLBranchBToBranchL(Pjp_t Pjp, Pvoid_t Pjpm);
-extern int      j__udyLLeafB1ToLeaf1(Pjp_t, Pvoid_t);
-extern Word_t   j__udyLLeaf1ToLeaf2(uint16_t *, Pjv_t, Pjp_t, Word_t, Pvoid_t);
-extern Word_t   j__udyLLeaf2ToLeaf3(uint8_t  *, Pjv_t, Pjp_t, Word_t, Pvoid_t);
-#ifndef JU_64BIT
-extern Word_t   j__udyLLeaf3ToLeafW(Pjlw_t,     Pjv_t, Pjp_t, Word_t, Pvoid_t);
-#else
-extern Word_t   j__udyLLeaf3ToLeaf4(uint32_t *, Pjv_t, Pjp_t, Word_t, Pvoid_t);
-extern Word_t   j__udyLLeaf4ToLeaf5(uint8_t  *, Pjv_t, Pjp_t, Word_t, Pvoid_t);
-extern Word_t   j__udyLLeaf5ToLeaf6(uint8_t  *, Pjv_t, Pjp_t, Word_t, Pvoid_t);
-extern Word_t   j__udyLLeaf6ToLeaf7(uint8_t  *, Pjv_t, Pjp_t, Word_t, Pvoid_t);
-extern Word_t   j__udyLLeaf7ToLeafW(Pjlw_t,     Pjv_t, Pjp_t, Word_t, Pvoid_t);
-#endif
-
-#endif // JUDYL
-
-// For convenience in the calling code; "M1" means "minus one":
-
-#ifndef JU_64BIT
-#define j__udyLeafM1ToLeafW j__udyLeaf3ToLeafW
-#else
-#define j__udyLeafM1ToLeafW j__udyLeaf7ToLeafW
-#endif
-
-
-// ****************************************************************************
-// __ J U D Y   D E L   W A L K
-//
-// Given a pointer to a JP, an Index known to be valid, the number of bytes
-// left to decode (== level in the tree), and a pointer to a global JPM, walk a
-// Judy (sub)tree to do an unset/delete of that index, and possibly modify the
-// JPM.  This function is only called internally, and recursively.  Unlike
-// Judy1Test() and JudyLGet(), the extra time required for recursion should be
-// negligible compared with the total.
-//
-// Return values:
-//
-// -1 error; details in JPM
-//
-//  0 Index already deleted (should never happen, Index is known to be valid)
-//
-//  1 previously valid Index deleted
-//
-//  2 same as 1, but in addition the JP now points to a BranchL containing a
-//    single JP, which should be compressed into the parent branch (if there
-//    is one, which is not the case for a top-level branch under a JPM)
-
-DBGCODE(uint8_t parentJPtype;)          // parent branch JP type.
-
-FUNCTION static int j__udyDelWalk(
-        Pjp_t   Pjp,            // current JP under which to delete.
-        Word_t  Index,          // to delete.
-        Word_t  ParentLevel,    // of parent branch.
-        Pjpm_t  Pjpm)           // for returning info to top level.
-{
-        Word_t  pop1;           // of a leaf.
-        Word_t  level;          // of a leaf.
-        uint8_t digit;          // from Index, in current branch.
-        Pjll_t  PjllnewRaw;     // address of newly allocated leaf.
-        Pjll_t  Pjllnew;
-        int     offset;         // within a branch.
-        int     retcode;        // return code: -1, 0, 1, 2.
-JUDYLCODE(Pjv_t PjvRaw;)        // value area.
-JUDYLCODE(Pjv_t Pjv;)
-
-        DBGCODE(level = 0;)
-
-ContinueDelWalk:                // for modifying state without recursing.
-
-#ifdef TRACEJP
-        JudyPrintJP(Pjp, "d", __LINE__);
-#endif
-
-        switch (JU_JPTYPE(Pjp)) // entry:  Pjp, Index.
-        {
-
-
-// ****************************************************************************
-// LINEAR BRANCH:
-//
-// MACROS FOR COMMON CODE:
-//
-// Check for population too high to compress a branch to a leaf, meaning just
-// descend through the branch, with a purposeful off-by-one error that
-// constitutes hysteresis = 1.  In other words, do not compress until the
-// branchs CURRENT population fits in the leaf, even BEFORE deleting one
-// index.
-//
-// Next is a label for branch-type-specific common code.  Variables pop1,
-// level, digit, and Index are in the context.
-
-#define JU_BRANCH_KEEP(cLevel,MaxPop1,Next)             \
-        if (pop1 > (MaxPop1))   /* hysteresis = 1 */    \
-        {                                               \
-            assert((cLevel) >= 2);                      \
-            level = (cLevel);                           \
-            digit = JU_DIGITATSTATE(Index, cLevel);     \
-            goto Next;                                  \
-        }
-
-// Support for generic calling of JudyLeaf*ToLeaf*() functions:
-//
-// Note:  Cannot use JUDYLCODE() because this contains a comma.
-
-#ifdef JUDY1
-#define JU_PVALUEPASS  // null.
-#else
-#define JU_PVALUEPASS  Pjv,
-#endif
-
-// During compression to a leaf, check if a JP contains nothing but a
-// cJU_JPIMMED_*_01, in which case shortcut calling j__udyLeaf*ToLeaf*():
-//
-// Copy the index bytes from the jp_DcdPopO field (with possible truncation),
-// and continue the branch-JP-walk loop.  Variables Pjp and Pleaf are in the
-// context.
-
-#define JU_BRANCH_COPY_IMMED_EVEN(cLevel,Pjp,ignore)            \
-        if (JU_JPTYPE(Pjp) == cJU_JPIMMED_1_01 + (cLevel) - 2)  \
-        {                                                       \
-            *Pleaf++ = JU_JPDCDPOP0(Pjp);                       \
-  JUDYLCODE(*Pjv++   = (Pjp)->jp_Addr;)                         \
-            continue;   /* for-loop */                          \
-        }
-
-#define JU_BRANCH_COPY_IMMED_ODD(cLevel,Pjp,CopyIndex)          \
-        if (JU_JPTYPE(Pjp) == cJU_JPIMMED_1_01 + (cLevel) - 2)  \
-        {                                                       \
-            CopyIndex(Pleaf, (Word_t) (JU_JPDCDPOP0(Pjp)));     \
-            Pleaf += (cLevel);  /* index size = level */        \
-  JUDYLCODE(*Pjv++ = (Pjp)->jp_Addr;)                           \
-            continue;   /* for-loop */                          \
-        }
-
-// Compress a BranchL into a leaf one index size larger:
-//
-// Allocate a new leaf, walk the JPs in the old BranchL and pack their contents
-// into the new leaf (of type NewJPType), free the old BranchL, and finally
-// restart the switch to delete Index from the new leaf.  (Note that all
-// BranchLs are the same size.)  Variables Pjp, Pjpm, Pleaf, digit, and pop1
-// are in the context.
-
-#define JU_BRANCHL_COMPRESS(cLevel,LeafType,MaxPop1,NewJPType,          \
-                            LeafToLeaf,Alloc,ValueArea,                 \
-                            CopyImmed,CopyIndex)                        \
-        {                                                               \
-            LeafType Pleaf;                                             \
-            Pjbl_t   PjblRaw;                                           \
-            Pjbl_t   Pjbl;                                              \
-            Word_t   numJPs;                                            \
-                                                                        \
-            if ((PjllnewRaw = Alloc(MaxPop1, Pjpm)) == 0) return(-1);   \
-            Pjllnew = P_JLL(PjllnewRaw);                                \
-            Pleaf   = (LeafType) Pjllnew;                               \
-  JUDYLCODE(Pjv     = ValueArea(Pleaf, MaxPop1);)                       \
-                                                                        \
-            PjblRaw = (Pjbl_t) (Pjp->jp_Addr);                          \
-            Pjbl    = P_JBL(PjblRaw);                                   \
-            numJPs  = Pjbl->jbl_NumJPs;                                 \
-                                                                        \
-            for (offset = 0; offset < numJPs; ++offset)                 \
-            {                                                           \
-                CopyImmed(cLevel, (Pjbl->jbl_jp) + offset, CopyIndex);  \
-                                                                        \
-                pop1 = LeafToLeaf(Pleaf, JU_PVALUEPASS                  \
-                          (Pjbl->jbl_jp) + offset,                      \
-                          JU_DIGITTOSTATE(Pjbl->jbl_Expanse[offset],    \
-                          cLevel), (Pvoid_t) Pjpm);                     \
-                Pleaf = (LeafType) (((Word_t) Pleaf) + ((cLevel) * pop1)); \
-      JUDYLCODE(Pjv  += pop1;)                                          \
-            }                                                           \
-            assert(((((Word_t) Pleaf) - ((Word_t) Pjllnew)) / (cLevel)) == (MaxPop1)); \
-  JUDYLCODE(assert((Pjv - ValueArea(Pjllnew, MaxPop1)) == (MaxPop1));)  \
-            DBGCODE(JudyCheckSorted(Pjllnew, MaxPop1, cLevel);)         \
-                                                                        \
-            j__udyFreeJBL(PjblRaw, Pjpm);                               \
-                                                                        \
-            Pjp->jp_Type = (NewJPType);                                 \
-            Pjp->jp_Addr = (Word_t) PjllnewRaw;                         \
-            goto ContinueDelWalk;       /* delete from new leaf */      \
-        }
-
-// Overall common code for initial BranchL deletion handling:
-//
-// Assert that Index is in the branch, then see if the BranchL should be kept
-// or else compressed to a leaf.  Variables Index, Pjp, and pop1 are in the
-// context.
-
-#define JU_BRANCHL(cLevel,MaxPop1,LeafType,NewJPType,                   \
-                   LeafToLeaf,Alloc,ValueArea,CopyImmed,CopyIndex)      \
-                                                                        \
-        assert(! JU_DCDNOTMATCHINDEX(Index, Pjp, cLevel));              \
-        assert(ParentLevel > (cLevel));                                 \
-                                                                        \
-        pop1 = JU_JPBRANCH_POP0(Pjp, cLevel) + 1;                       \
-        JU_BRANCH_KEEP(cLevel, MaxPop1, BranchLKeep);                   \
-        assert(pop1 == (MaxPop1));                                      \
-                                                                        \
-        JU_BRANCHL_COMPRESS(cLevel, LeafType, MaxPop1, NewJPType,       \
-                            LeafToLeaf, Alloc, ValueArea, CopyImmed, CopyIndex)
-
-
-// END OF MACROS, START OF CASES:
-
-        case cJU_JPBRANCH_L2:
-
-            JU_BRANCHL(2, cJU_LEAF2_MAXPOP1, uint16_t *, cJU_JPLEAF2,
-                       j__udyLeaf1ToLeaf2, j__udyAllocJLL2, JL_LEAF2VALUEAREA,
-                       JU_BRANCH_COPY_IMMED_EVEN, ignore);
-
-        case cJU_JPBRANCH_L3:
-
-            JU_BRANCHL(3, cJU_LEAF3_MAXPOP1, uint8_t *, cJU_JPLEAF3,
-                       j__udyLeaf2ToLeaf3, j__udyAllocJLL3, JL_LEAF3VALUEAREA,
-                       JU_BRANCH_COPY_IMMED_ODD, JU_COPY3_LONG_TO_PINDEX);
-
-#ifdef JU_64BIT
-        case cJU_JPBRANCH_L4:
-
-            JU_BRANCHL(4, cJU_LEAF4_MAXPOP1, uint32_t *, cJU_JPLEAF4,
-                       j__udyLeaf3ToLeaf4, j__udyAllocJLL4, JL_LEAF4VALUEAREA,
-                       JU_BRANCH_COPY_IMMED_EVEN, ignore);
-
-        case cJU_JPBRANCH_L5:
-
-            JU_BRANCHL(5, cJU_LEAF5_MAXPOP1, uint8_t *, cJU_JPLEAF5,
-                       j__udyLeaf4ToLeaf5, j__udyAllocJLL5, JL_LEAF5VALUEAREA,
-                       JU_BRANCH_COPY_IMMED_ODD, JU_COPY5_LONG_TO_PINDEX);
-
-        case cJU_JPBRANCH_L6:
-
-            JU_BRANCHL(6, cJU_LEAF6_MAXPOP1, uint8_t *, cJU_JPLEAF6,
-                       j__udyLeaf5ToLeaf6, j__udyAllocJLL6, JL_LEAF6VALUEAREA,
-                       JU_BRANCH_COPY_IMMED_ODD, JU_COPY6_LONG_TO_PINDEX);
-
-        case cJU_JPBRANCH_L7:
-
-            JU_BRANCHL(7, cJU_LEAF7_MAXPOP1, uint8_t *, cJU_JPLEAF7,
-                       j__udyLeaf6ToLeaf7, j__udyAllocJLL7, JL_LEAF7VALUEAREA,
-                       JU_BRANCH_COPY_IMMED_ODD, JU_COPY7_LONG_TO_PINDEX);
-#endif // JU_64BIT
-
-// A top-level BranchL is different and cannot use JU_BRANCHL():  Dont try to
-// compress to a (LEAFW) leaf yet, but leave this for a later deletion
-// (hysteresis > 0); and the next JP type depends on the system word size; so
-// dont use JU_BRANCH_KEEP():
-
-        case cJU_JPBRANCH_L:
-        {
-            Pjbl_t Pjbl;
-            Word_t numJPs;
-
-            level = cJU_ROOTSTATE;
-            digit = JU_DIGITATSTATE(Index, cJU_ROOTSTATE);
-
-            // fall through:
-
-
-// COMMON CODE FOR KEEPING AND DESCENDING THROUGH A BRANCHL:
-//
-// Come here with level and digit set.
-
-BranchLKeep:
-            Pjbl   = P_JBL(Pjp->jp_Addr);
-            numJPs = Pjbl->jbl_NumJPs;
-            assert(numJPs > 0);
-            DBGCODE(parentJPtype = JU_JPTYPE(Pjp);)
-
-// Search for a match to the digit (valid Index => must find digit):
-
-            for (offset = 0; (Pjbl->jbl_Expanse[offset]) != digit; ++offset)
-                assert(offset < numJPs - 1);
-
-            Pjp = (Pjbl->jbl_jp) + offset;
-
-// If not at a (deletable) JPIMMED_*_01, continue the walk (to descend through
-// the BranchL):
-
-            assert(level >= 2);
-            if ((JU_JPTYPE(Pjp)) != cJU_JPIMMED_1_01 + level - 2) break;
-
-// At JPIMMED_*_01:  Ensure the index is in the right expanse, then delete the
-// Immed from the BranchL:
-//
-// Note:  A BranchL has a fixed size and format regardless of numJPs.
-
-            assert(JU_JPDCDPOP0(Pjp) == JU_TRIMTODCDSIZE(Index));
-
-            JU_DELETEINPLACE(Pjbl->jbl_Expanse, numJPs, offset, ignore);
-            JU_DELETEINPLACE(Pjbl->jbl_jp,      numJPs, offset, ignore);
-
-            DBGCODE(JudyCheckSorted((Pjll_t) (Pjbl->jbl_Expanse),
-                                    numJPs - 1, 1);)
-
-// If only one index left in the BranchL, indicate this to the caller:
-
-            return ((--(Pjbl->jbl_NumJPs) <= 1) ? 2 : 1);
-
-        } // case cJU_JPBRANCH_L.
-
-
-// ****************************************************************************
-// BITMAP BRANCH:
-//
-// MACROS FOR COMMON CODE:
-//
-// Note the reuse of common macros here, defined earlier:  JU_BRANCH_KEEP(),
-// JU_PVALUE*.
-//
-// Compress a BranchB into a leaf one index size larger:
-//
-// Allocate a new leaf, walk the JPs in the old BranchB (one bitmap subexpanse
-// at a time) and pack their contents into the new leaf (of type NewJPType),
-// free the old BranchB, and finally restart the switch to delete Index from
-// the new leaf.  Variables Pjp, Pjpm, Pleaf, digit, and pop1 are in the
-// context.
-//
-// Note:  Its no accident that the interface to JU_BRANCHB_COMPRESS() is
-// identical to JU_BRANCHL_COMPRESS().  Only the details differ in how to
-// traverse the branchs JPs.
-
-#define JU_BRANCHB_COMPRESS(cLevel,LeafType,MaxPop1,NewJPType,          \
-                            LeafToLeaf,Alloc,ValueArea,                 \
-                            CopyImmed,CopyIndex)                        \
-        {                                                               \
-            LeafType  Pleaf;                                            \
-            Pjbb_t    PjbbRaw;  /* BranchB to compress */               \
-            Pjbb_t    Pjbb;                                             \
-            Word_t    subexp;   /* current subexpanse number    */      \
-            BITMAPB_t bitmap;   /* portion for this subexpanse  */      \
-            Pjp_t     Pjp2Raw;  /* one subexpanses subarray     */      \
-            Pjp_t     Pjp2;                                             \
-                                                                        \
-            if ((PjllnewRaw = Alloc(MaxPop1, Pjpm)) == 0) return(-1);   \
-            Pjllnew = P_JLL(PjllnewRaw);                                \
-            Pleaf   = (LeafType) Pjllnew;                               \
-  JUDYLCODE(Pjv     = ValueArea(Pleaf, MaxPop1);)                       \
-                                                                        \
-            PjbbRaw = (Pjbb_t) (Pjp->jp_Addr);                          \
-            Pjbb    = P_JBB(PjbbRaw);                                   \
-                                                                        \
-            for (subexp = 0; subexp < cJU_NUMSUBEXPB; ++subexp)         \
-            {                                                           \
-                if ((bitmap = JU_JBB_BITMAP(Pjbb, subexp)) == 0)        \
-                    continue;           /* empty subexpanse */          \
-                                                                        \
-                digit   = subexp * cJU_BITSPERSUBEXPB;                  \
-                Pjp2Raw = JU_JBB_PJP(Pjbb, subexp);                     \
-                Pjp2    = P_JP(Pjp2Raw);                                \
-                assert(Pjp2 != (Pjp_t) NULL);                           \
-                                                                        \
-                for (offset = 0; bitmap != 0; bitmap >>= 1, ++digit)    \
-                {                                                       \
-                    if (! (bitmap & 1))                                 \
-                        continue;       /* empty sub-subexpanse */      \
-                                                                        \
-                    ++offset;           /* before any continue */       \
-                                                                        \
-                    CopyImmed(cLevel, Pjp2 + offset - 1, CopyIndex);    \
-                                                                        \
-                    pop1 = LeafToLeaf(Pleaf, JU_PVALUEPASS              \
-                                      Pjp2 + offset - 1,                \
-                                      JU_DIGITTOSTATE(digit, cLevel),   \
-                                      (Pvoid_t) Pjpm);                  \
-                    Pleaf = (LeafType) (((Word_t) Pleaf) + ((cLevel) * pop1)); \
-          JUDYLCODE(Pjv  += pop1;)                                      \
-                }                                                       \
-                j__udyFreeJBBJP(Pjp2Raw, /* pop1 = */ offset, Pjpm);    \
-            }                                                           \
-            assert(((((Word_t) Pleaf) - ((Word_t) Pjllnew)) / (cLevel)) == (MaxPop1)); \
-  JUDYLCODE(assert((Pjv - ValueArea(Pjllnew, MaxPop1)) == (MaxPop1));)  \
-            DBGCODE(JudyCheckSorted(Pjllnew, MaxPop1, cLevel);)         \
-                                                                        \
-            j__udyFreeJBB(PjbbRaw, Pjpm);                               \
-                                                                        \
-            Pjp->jp_Type = (NewJPType);                                 \
-            Pjp->jp_Addr = (Word_t) PjllnewRaw;                         \
-            goto ContinueDelWalk;       /* delete from new leaf */      \
-        }
-
-// Overall common code for initial BranchB deletion handling:
-//
-// Assert that Index is in the branch, then see if the BranchB should be kept
-// or else compressed to a leaf.  Variables Index, Pjp, and pop1 are in the
-// context.
-
-#define JU_BRANCHB(cLevel,MaxPop1,LeafType,NewJPType,                   \
-                   LeafToLeaf,Alloc,ValueArea,CopyImmed,CopyIndex)      \
-                                                                        \
-        assert(! JU_DCDNOTMATCHINDEX(Index, Pjp, cLevel));              \
-        assert(ParentLevel > (cLevel));                                 \
-                                                                        \
-        pop1 = JU_JPBRANCH_POP0(Pjp, cLevel) + 1;                       \
-        JU_BRANCH_KEEP(cLevel, MaxPop1, BranchBKeep);                   \
-        assert(pop1 == (MaxPop1));                                      \
-                                                                        \
-        JU_BRANCHB_COMPRESS(cLevel, LeafType, MaxPop1, NewJPType,       \
-                            LeafToLeaf, Alloc, ValueArea, CopyImmed, CopyIndex)
-
-
-// END OF MACROS, START OF CASES:
-//
-// Note:  Its no accident that the macro calls for these cases is nearly
-// identical to the code for BranchLs.
-
-        case cJU_JPBRANCH_B2:
-
-            JU_BRANCHB(2, cJU_LEAF2_MAXPOP1, uint16_t *, cJU_JPLEAF2,
-                       j__udyLeaf1ToLeaf2, j__udyAllocJLL2, JL_LEAF2VALUEAREA,
-                       JU_BRANCH_COPY_IMMED_EVEN, ignore);
-
-        case cJU_JPBRANCH_B3:
-
-            JU_BRANCHB(3, cJU_LEAF3_MAXPOP1, uint8_t *, cJU_JPLEAF3,
-                       j__udyLeaf2ToLeaf3, j__udyAllocJLL3, JL_LEAF3VALUEAREA,
-                       JU_BRANCH_COPY_IMMED_ODD, JU_COPY3_LONG_TO_PINDEX);
-
-#ifdef JU_64BIT
-        case cJU_JPBRANCH_B4:
-
-            JU_BRANCHB(4, cJU_LEAF4_MAXPOP1, uint32_t *, cJU_JPLEAF4,
-                       j__udyLeaf3ToLeaf4, j__udyAllocJLL4, JL_LEAF4VALUEAREA,
-                       JU_BRANCH_COPY_IMMED_EVEN, ignore);
-
-        case cJU_JPBRANCH_B5:
-
-            JU_BRANCHB(5, cJU_LEAF5_MAXPOP1, uint8_t *, cJU_JPLEAF5,
-                       j__udyLeaf4ToLeaf5, j__udyAllocJLL5, JL_LEAF5VALUEAREA,
-                       JU_BRANCH_COPY_IMMED_ODD, JU_COPY5_LONG_TO_PINDEX);
-
-        case cJU_JPBRANCH_B6:
-
-            JU_BRANCHB(6, cJU_LEAF6_MAXPOP1, uint8_t *, cJU_JPLEAF6,
-                       j__udyLeaf5ToLeaf6, j__udyAllocJLL6, JL_LEAF6VALUEAREA,
-                       JU_BRANCH_COPY_IMMED_ODD, JU_COPY6_LONG_TO_PINDEX);
-
-        case cJU_JPBRANCH_B7:
-
-            JU_BRANCHB(7, cJU_LEAF7_MAXPOP1, uint8_t *, cJU_JPLEAF7,
-                       j__udyLeaf6ToLeaf7, j__udyAllocJLL7, JL_LEAF7VALUEAREA,
-                       JU_BRANCH_COPY_IMMED_ODD, JU_COPY7_LONG_TO_PINDEX);
-#endif // JU_64BIT
-
-// A top-level BranchB is different and cannot use JU_BRANCHB():  Dont try to
-// compress to a (LEAFW) leaf yet, but leave this for a later deletion
-// (hysteresis > 0); and the next JP type depends on the system word size; so
-// dont use JU_BRANCH_KEEP():
-
-        case cJU_JPBRANCH_B:
-        {
-            Pjbb_t    Pjbb;             // BranchB to modify.
-            Word_t    subexp;           // current subexpanse number.
-            Word_t    subexp2;          // in second-level loop.
-            BITMAPB_t bitmap;           // portion for this subexpanse.
-            BITMAPB_t bitmask;          // with digits bit set.
-            Pjp_t     Pjp2Raw;          // one subexpanses subarray.
-            Pjp_t     Pjp2;
-            Word_t    numJPs;           // in one subexpanse.
-
-            level = cJU_ROOTSTATE;
-            digit = JU_DIGITATSTATE(Index, cJU_ROOTSTATE);
-
-            // fall through:
-
-
-// COMMON CODE FOR KEEPING AND DESCENDING THROUGH A BRANCHB:
-//
-// Come here with level and digit set.
-
-BranchBKeep:
-            Pjbb    = P_JBB(Pjp->jp_Addr);
-            subexp  = digit / cJU_BITSPERSUBEXPB;
-            bitmap  = JU_JBB_BITMAP(Pjbb, subexp);
-            bitmask = JU_BITPOSMASKB(digit);
-            assert(bitmap & bitmask);   // Index valid => digits bit is set.
-            DBGCODE(parentJPtype = JU_JPTYPE(Pjp);)
-
-// Compute digits offset into the bitmap, with a fast method if all bits are
-// set:
-
-            offset = ((bitmap == (cJU_FULLBITMAPB)) ?
-                      digit % cJU_BITSPERSUBEXPB :
-                      j__udyCountBitsB(bitmap & JU_MASKLOWEREXC(bitmask)));
-
-            Pjp2Raw = JU_JBB_PJP(Pjbb, subexp);
-            Pjp2    = P_JP(Pjp2Raw);
-            assert(Pjp2 != (Pjp_t) NULL);       // valid subexpanse pointer.
-
-// If not at a (deletable) JPIMMED_*_01, continue the walk (to descend through
-// the BranchB):
-
-            if (JU_JPTYPE(Pjp2 + offset) != cJU_JPIMMED_1_01 + level - 2)
-            {
-                Pjp = Pjp2 + offset;
-                break;
-            }
-
-// At JPIMMED_*_01:  Ensure the index is in the right expanse, then delete the
-// Immed from the BranchB:
-
-            assert(JU_JPDCDPOP0(Pjp2 + offset)
-                   == JU_TRIMTODCDSIZE(Index));
-
-// If only one index is left in the subexpanse, free the JP array:
-
-            if ((numJPs = j__udyCountBitsB(bitmap)) == 1)
-            {
-                j__udyFreeJBBJP(Pjp2Raw, /* pop1 = */ 1, Pjpm);
-                JU_JBB_PJP(Pjbb, subexp) = (Pjp_t) NULL;
-            }
-
-// Shrink JP array in-place:
-
-            else if (JU_BRANCHBJPGROWINPLACE(numJPs - 1))
-            {
-                assert(numJPs > 0);
-                JU_DELETEINPLACE(Pjp2, numJPs, offset, ignore);
-            }
-
-// JP array would end up too large; compress it to a smaller one:
-
-            else
-            {
-                Pjp_t PjpnewRaw;
-                Pjp_t Pjpnew;
-
-                if ((PjpnewRaw = j__udyAllocJBBJP(numJPs - 1, Pjpm))
-                 == (Pjp_t) NULL) return(-1);
-                Pjpnew = P_JP(PjpnewRaw);
-
-                JU_DELETECOPY(Pjpnew, Pjp2, numJPs, offset, ignore);
-                j__udyFreeJBBJP(Pjp2Raw, numJPs, Pjpm);         // old.
-
-                JU_JBB_PJP(Pjbb, subexp) = PjpnewRaw;
-            }
-
-// Clear digits bit in the bitmap:
-
-            JU_JBB_BITMAP(Pjbb, subexp) ^= bitmask;
-
-// If the current subexpanse alone is still too large for a BranchL (with
-// hysteresis = 1), the delete is all done:
-
-            if (numJPs > cJU_BRANCHLMAXJPS) return(1);
-
-// Consider shrinking the current BranchB to a BranchL:
-//
-// Check the numbers of JPs in other subexpanses in the BranchL.  Upon reaching
-// the critical number of numJPs (which could be right at the start; again,
-// with hysteresis = 1), its faster to just watch for any non-empty subexpanse
-// than to count bits in each subexpanse.  Upon finding too many JPs, give up
-// on shrinking the BranchB.
-
-            for (subexp2 = 0; subexp2 < cJU_NUMSUBEXPB; ++subexp2)
-            {
-                if (subexp2 == subexp) continue;  // skip current subexpanse.
-
-                if ((numJPs == cJU_BRANCHLMAXJPS) ?
-                    JU_JBB_BITMAP(Pjbb, subexp2) :
-                    ((numJPs += j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, subexp2)))
-                     > cJU_BRANCHLMAXJPS))
-                {
-                    return(1);          // too many JPs, cannot shrink.
-                }
-            }
-
-// Shrink current BranchB to a BranchL:
-//
-// Note:  In this rare case, ignore the return value, do not pass it to the
-// caller, because the deletion is already successfully completed and the
-// caller(s) must decrement population counts.  The only errors expected from
-// this call are JU_ERRNO_NOMEM and JU_ERRNO_OVERRUN, neither of which is worth
-// forwarding from this point.  See also 4.1, 4.8, and 4.15 of this file.
-
-            (void) j__udyBranchBToBranchL(Pjp, Pjpm);
-            return(1);
-
-        } // case.
-
-
-// ****************************************************************************
-// UNCOMPRESSED BRANCH:
-//
-// MACROS FOR COMMON CODE:
-//
-// Note the reuse of common macros here, defined earlier:  JU_PVALUE*.
-//
-// Compress a BranchU into a leaf one index size larger:
-//
-// Allocate a new leaf, walk the JPs in the old BranchU and pack their contents
-// into the new leaf (of type NewJPType), free the old BranchU, and finally
-// restart the switch to delete Index from the new leaf.  Variables Pjp, Pjpm,
-// digit, and pop1 are in the context.
-//
-// Note:  Its no accident that the interface to JU_BRANCHU_COMPRESS() is
-// nearly identical to JU_BRANCHL_COMPRESS(); just NullJPType is added.  The
-// details differ in how to traverse the branchs JPs --
-//
-// -- and also, what to do upon encountering a cJU_JPIMMED_*_01 JP.  In
-// BranchLs and BranchBs the JP must be deleted, but in a BranchU its merely
-// converted to a null JP, and this is done by other switch cases, so the "keep
-// branch" situation is simpler here and JU_BRANCH_KEEP() is not used.  Also,
-// theres no code to convert a BranchU to a BranchB since counting the JPs in
-// a BranchU is (at least presently) expensive, and besides, keeping around a
-// BranchU is form of hysteresis.
-
-#define JU_BRANCHU_COMPRESS(cLevel,LeafType,MaxPop1,NullJPType,NewJPType,   \
-                            LeafToLeaf,Alloc,ValueArea,CopyImmed,CopyIndex) \
-        {                                                               \
-            LeafType Pleaf;                                             \
-            Pjbu_t PjbuRaw = (Pjbu_t) (Pjp->jp_Addr);                   \
-            Pjp_t  Pjp2    = JU_JBU_PJP0(Pjp);                          \
-            Word_t ldigit;      /* larger than uint8_t */               \
-                                                                        \
-            if ((PjllnewRaw = Alloc(MaxPop1, Pjpm)) == 0) return(-1);   \
-            Pjllnew = P_JLL(PjllnewRaw);                                \
-            Pleaf   = (LeafType) Pjllnew;                               \
-  JUDYLCODE(Pjv     = ValueArea(Pleaf, MaxPop1);)                       \
-                                                                        \
-            for (ldigit = 0; ldigit < cJU_BRANCHUNUMJPS; ++ldigit, ++Pjp2) \
-            {                                                           \
-                /* fast-process common types: */                        \
-                if (JU_JPTYPE(Pjp2) == (NullJPType)) continue;          \
-                CopyImmed(cLevel, Pjp2, CopyIndex);                     \
-                                                                        \
-                pop1 = LeafToLeaf(Pleaf, JU_PVALUEPASS Pjp2,            \
-                                  JU_DIGITTOSTATE(ldigit, cLevel),      \
-                                  (Pvoid_t) Pjpm);                      \
-                Pleaf = (LeafType) (((Word_t) Pleaf) + ((cLevel) * pop1)); \
-      JUDYLCODE(Pjv  += pop1;)                                          \
-            }                                                           \
-            assert(((((Word_t) Pleaf) - ((Word_t) Pjllnew)) / (cLevel)) == (MaxPop1)); \
-  JUDYLCODE(assert((Pjv - ValueArea(Pjllnew, MaxPop1)) == (MaxPop1));)  \
-            DBGCODE(JudyCheckSorted(Pjllnew, MaxPop1, cLevel);)         \
-                                                                        \
-            j__udyFreeJBU(PjbuRaw, Pjpm);                               \
-                                                                        \
-            Pjp->jp_Type = (NewJPType);                                 \
-            Pjp->jp_Addr = (Word_t) PjllnewRaw;                         \
-            goto ContinueDelWalk;       /* delete from new leaf */      \
-        }
-
-// Overall common code for initial BranchU deletion handling:
-//
-// Assert that Index is in the branch, then see if a BranchU should be kept or
-// else compressed to a leaf.  Variables level, Index, Pjp, and pop1 are in the
-// context.
-//
-// Note:  BranchU handling differs from BranchL and BranchB as described above.
-
-#define JU_BRANCHU(cLevel,MaxPop1,LeafType,NullJPType,NewJPType,        \
-                   LeafToLeaf,Alloc,ValueArea,CopyImmed,CopyIndex)      \
-                                                                        \
-        assert(! JU_DCDNOTMATCHINDEX(Index, Pjp, cLevel));              \
-        assert(ParentLevel > (cLevel));                                 \
-        DBGCODE(parentJPtype = JU_JPTYPE(Pjp);)                         \
-                                                                        \
-        pop1 = JU_JPBRANCH_POP0(Pjp, cLevel) + 1;                       \
-                                                                        \
-        if (pop1 > (MaxPop1))   /* hysteresis = 1 */                    \
-        {                                                               \
-            level = (cLevel);                                           \
-            Pjp   = P_JP(Pjp->jp_Addr) + JU_DIGITATSTATE(Index, cLevel);\
-            break;              /* descend to next level */             \
-        }                                                               \
-        assert(pop1 == (MaxPop1));                                      \
-                                                                        \
-        JU_BRANCHU_COMPRESS(cLevel, LeafType, MaxPop1, NullJPType, NewJPType, \
-                            LeafToLeaf, Alloc, ValueArea, CopyImmed, CopyIndex)
-
-
-// END OF MACROS, START OF CASES:
-//
-// Note:  Its no accident that the macro calls for these cases is nearly
-// identical to the code for BranchLs, with the addition of cJU_JPNULL*
-// parameters only needed for BranchUs.
-
-        case cJU_JPBRANCH_U2:
-
-            JU_BRANCHU(2, cJU_LEAF2_MAXPOP1, uint16_t *,
-                       cJU_JPNULL1, cJU_JPLEAF2,
-                       j__udyLeaf1ToLeaf2, j__udyAllocJLL2, JL_LEAF2VALUEAREA,
-                       JU_BRANCH_COPY_IMMED_EVEN, ignore);
-
-        case cJU_JPBRANCH_U3:
-
-            JU_BRANCHU(3, cJU_LEAF3_MAXPOP1, uint8_t *,
-                       cJU_JPNULL2, cJU_JPLEAF3,
-                       j__udyLeaf2ToLeaf3, j__udyAllocJLL3, JL_LEAF3VALUEAREA,
-                       JU_BRANCH_COPY_IMMED_ODD, JU_COPY3_LONG_TO_PINDEX);
-
-#ifdef JU_64BIT
-        case cJU_JPBRANCH_U4:
-
-            JU_BRANCHU(4, cJU_LEAF4_MAXPOP1, uint32_t *,
-                       cJU_JPNULL3, cJU_JPLEAF4,
-                       j__udyLeaf3ToLeaf4, j__udyAllocJLL4, JL_LEAF4VALUEAREA,
-                       JU_BRANCH_COPY_IMMED_EVEN, ignore);
-
-        case cJU_JPBRANCH_U5:
-
-            JU_BRANCHU(5, cJU_LEAF5_MAXPOP1, uint8_t *,
-                       cJU_JPNULL4, cJU_JPLEAF5,
-                       j__udyLeaf4ToLeaf5, j__udyAllocJLL5, JL_LEAF5VALUEAREA,
-                       JU_BRANCH_COPY_IMMED_ODD, JU_COPY5_LONG_TO_PINDEX);
-
-        case cJU_JPBRANCH_U6:
-
-            JU_BRANCHU(6, cJU_LEAF6_MAXPOP1, uint8_t *,
-                       cJU_JPNULL5, cJU_JPLEAF6,
-                       j__udyLeaf5ToLeaf6, j__udyAllocJLL6, JL_LEAF6VALUEAREA,
-                       JU_BRANCH_COPY_IMMED_ODD, JU_COPY6_LONG_TO_PINDEX);
-
-        case cJU_JPBRANCH_U7:
-
-            JU_BRANCHU(7, cJU_LEAF7_MAXPOP1, uint8_t *,
-                       cJU_JPNULL6, cJU_JPLEAF7,
-                       j__udyLeaf6ToLeaf7, j__udyAllocJLL7, JL_LEAF7VALUEAREA,
-                       JU_BRANCH_COPY_IMMED_ODD, JU_COPY7_LONG_TO_PINDEX);
-#endif // JU_64BIT
-
-// A top-level BranchU is different and cannot use JU_BRANCHU():  Dont try to
-// compress to a (LEAFW) leaf yet, but leave this for a later deletion
-// (hysteresis > 0); just descend through the BranchU:
-
-        case cJU_JPBRANCH_U:
-
-            DBGCODE(parentJPtype = JU_JPTYPE(Pjp);)
-
-            level = cJU_ROOTSTATE;
-            Pjp   = P_JP(Pjp->jp_Addr) + JU_DIGITATSTATE(Index, cJU_ROOTSTATE);
-            break;
-
-
-// ****************************************************************************
-// LINEAR LEAF:
-//
-// State transitions while deleting an Index, the inverse of the similar table
-// that appears in JudyIns.c:
-//
-// Note:  In JudyIns.c this table is not needed and does not appear until the
-// Immed handling code; because once a Leaf is reached upon growing the tree,
-// the situation remains simpler, but for deleting indexes, the complexity
-// arises when leaves must compress to Immeds.
-//
-// Note:  There are other transitions possible too, not shown here, such as to
-// a leaf one level higher.
-//
-// (Yes, this is very terse...  Study it and it will make sense.)
-// (Note, parts of this diagram are repeated below for quick reference.)
-//
-//                      reformat JP here for Judy1 only, from word-1 to word-2
-//                                                                     |
-//           JUDY1 && JU_64BIT   JUDY1 || JU_64BIT                     |
-//                                                                     V
-// (*) Leaf1 [[ => 1_15..08 ] => 1_07 => ... => 1_04 ] => 1_03 => 1_02 => 1_01
-//     Leaf2 [[ => 2_07..04 ] => 2_03 => 2_02        ]                 => 2_01
-//     Leaf3 [[ => 3_05..03 ] => 3_02                ]                 => 3_01
-// JU_64BIT only:
-//     Leaf4 [[ => 4_03..02 ]]                                         => 4_01
-//     Leaf5 [[ => 5_03..02 ]]                                         => 5_01
-//     Leaf6 [[ => 6_02     ]]                                         => 6_01
-//     Leaf7 [[ => 7_02     ]]                                         => 7_01
-//
-// (*) For Judy1 & 64-bit, go directly from a LeafB1 to cJU_JPIMMED_1_15; skip
-//     Leaf1, as described in Judy1.h regarding cJ1_JPLEAF1.
-//
-// MACROS FOR COMMON CODE:
-//
-// (De)compress a LeafX into a LeafY one index size (cIS) larger (X+1 = Y):
-//
-// This is only possible when the current leaf is under a narrow pointer
-// ((ParentLevel - 1) > cIS) and its population fits in a higher-level leaf.
-// Variables ParentLevel, pop1, PjllnewRaw, Pjllnew, Pjpm, and Index are in the
-// context.
-//
-// Note:  Doing an "uplevel" doesnt occur until the old leaf can be compressed
-// up one level BEFORE deleting an index; that is, hysteresis = 1.
-//
-// Note:  LeafType, MaxPop1, NewJPType, and Alloc refer to the up-level leaf,
-// not the current leaf.
-//
-// Note:  010327:  Fixed bug where the jp_DcdPopO next-uplevel digit (byte)
-// above the current Pop0 value was not being cleared.  When upleveling, one
-// digit in jp_DcdPopO "moves" from being part of the Dcd subfield to the Pop0
-// subfield, but since a leaf maxpop1 is known to be <= 1 byte in size, the new
-// Pop0 byte should always be zero.  This is easy to overlook because
-// JU_JPLEAF_POP0() "knows" to only use the LSB of Pop0 (for efficiency) and
-// ignore the other bytes...  Until someone uses cJU_POP0MASK() instead of
-// JU_JPLEAF_POP0(), such as in JudyInsertBranch.c.
-//
-// TBD:  Should JudyInsertBranch.c use JU_JPLEAF_POP0() rather than
-// cJU_POP0MASK(), for efficiency?  Does it know for sure its a narrow pointer
-// under the leaf?  Not necessarily.
-
-#define JU_LEAF_UPLEVEL(cIS,LeafType,MaxPop1,NewJPType,LeafToLeaf,      \
-                        Alloc,ValueArea)                                \
-                                                                        \
-        assert(((ParentLevel - 1) == (cIS)) || (pop1 >= (MaxPop1)));    \
-                                                                        \
-        if (((ParentLevel - 1) > (cIS))  /* under narrow pointer */     \
-         && (pop1 == (MaxPop1)))         /* hysteresis = 1       */     \
-        {                                                               \
-            Word_t D_cdP0;                                              \
-            if ((PjllnewRaw = Alloc(MaxPop1, Pjpm)) == 0) return(-1);   \
-            Pjllnew = P_JLL(PjllnewRaw);                                \
-  JUDYLCODE(Pjv     = ValueArea((LeafType) Pjllnew, MaxPop1);)          \
-                                                                        \
-            (void) LeafToLeaf((LeafType) Pjllnew, JU_PVALUEPASS Pjp,    \
-                              Index & cJU_DCDMASK(cIS), /* TBD, Doug says */ \
-                              (Pvoid_t) Pjpm);                          \
-            DBGCODE(JudyCheckSorted(Pjllnew, MaxPop1, cIS + 1);)        \
-                                                                        \
-            D_cdP0 = (~cJU_MASKATSTATE((cIS) + 1)) & JU_JPDCDPOP0(Pjp); \
-            JU_JPSETADT(Pjp, (Word_t)PjllnewRaw, D_cdP0, NewJPType);    \
-            goto ContinueDelWalk;       /* delete from new leaf */      \
-        }
-
-
-// For Leaf3, only support JU_LEAF_UPLEVEL on a 64-bit system, and for Leaf7,
-// there is no JU_LEAF_UPLEVEL:
-//
-// Note:  Theres no way here to go from Leaf3 [Leaf7] to LEAFW on a 32-bit
-// [64-bit] system.  Thats handled in the main code, because its different in
-// that a JPM is involved.
-
-#ifndef JU_64BIT // 32-bit.
-#define JU_LEAF_UPLEVEL64(cIS,LeafType,MaxPop1,NewJPType,LeafToLeaf,    \
-                          Alloc,ValueArea)              // null.
-#else
-#define JU_LEAF_UPLEVEL64(cIS,LeafType,MaxPop1,NewJPType,LeafToLeaf,    \
-                          Alloc,ValueArea)                              \
-        JU_LEAF_UPLEVEL  (cIS,LeafType,MaxPop1,NewJPType,LeafToLeaf,    \
-                          Alloc,ValueArea)
-#define JU_LEAF_UPLEVEL_NONE(cIS,LeafType,MaxPop1,NewJPType,LeafToLeaf, \
-                          Alloc,ValueArea)              // null.
-#endif
-
-// Compress a Leaf* with pop1 = 2, or a JPIMMED_*_02, into a JPIMMED_*_01:
-//
-// Copy whichever Index is NOT being deleted (and assert that the other one is
-// found; Index must be valid).  This requires special handling of the Index
-// bytes (and value area).  Variables Pjp, Index, offset, and Pleaf are in the
-// context, offset is modified to the undeleted Index, and Pjp is modified
-// including jp_Addr.
-
-
-#define JU_TOIMMED_01_EVEN(cIS,ignore1,ignore2)                         \
-{                                                                       \
-        Word_t  D_cdP0;                                                 \
-        Word_t  A_ddr = 0;                                              \
-        uint8_t T_ype = JU_JPTYPE(Pjp);                                 \
-        offset = (Pleaf[0] == JU_LEASTBYTES(Index, cIS)); /* undeleted Ind */ \
-        assert(Pleaf[offset ? 0 : 1] == JU_LEASTBYTES(Index, cIS));     \
-        D_cdP0 = (Index & cJU_DCDMASK(cIS)) | Pleaf[offset];            \
-JUDYLCODE(A_ddr = Pjv[offset];)                                         \
-        JU_JPSETADT(Pjp, A_ddr, D_cdP0, T_ype);                         \
-}
-
-#define JU_TOIMMED_01_ODD(cIS,SearchLeaf,CopyPIndex)                    \
-        {                                                               \
-            Word_t  D_cdP0;                                             \
-            Word_t  A_ddr = 0;                                          \
-            uint8_t T_ype = JU_JPTYPE(Pjp);                             \
-                                                                        \
-            offset = SearchLeaf(Pleaf, 2, Index);                       \
-            assert(offset >= 0);        /* Index must be valid */       \
-            CopyPIndex(D_cdP0, & (Pleaf[offset ? 0 : cIS]));            \
-            D_cdP0 |= Index & cJU_DCDMASK(cIS);                         \
-  JUDYLCODE(A_ddr = Pjv[offset ? 0 : 1];)                               \
-            JU_JPSETADT(Pjp, A_ddr, D_cdP0, T_ype);                     \
-        }
-
-
-// Compress a Leaf* into a JPIMMED_*_0[2+]:
-//
-// This occurs as soon as its possible, with hysteresis = 0.  Variables pop1,
-// Pleaf, offset, and Pjpm are in the context.
-//
-// TBD:  Explain why hysteresis = 0 here, rather than > 0.  Probably because
-// the insert code assumes if the population is small enough, an Immed is used,
-// not a leaf.
-//
-// The differences between Judy1 and JudyL with respect to value area handling
-// are just too large for completely common code between them...  Oh well, some
-// big ifdefs follow.
-
-#ifdef JUDY1
-
-#define JU_LEAF_TOIMMED(cIS,LeafType,MaxPop1,BaseJPType,ignore1,\
-                        ignore2,ignore3,ignore4,                \
-                        DeleteCopy,FreeLeaf)                    \
-                                                                \
-        assert(pop1 > (MaxPop1));                               \
-                                                                \
-        if ((pop1 - 1) == (MaxPop1))    /* hysteresis = 0 */    \
-        {                                                       \
-            Pjll_t PjllRaw = (Pjll_t) (Pjp->jp_Addr);           \
-            DeleteCopy((LeafType) (Pjp->jp_1Index), Pleaf, pop1, offset, cIS); \
-            DBGCODE(JudyCheckSorted((Pjll_t) (Pjp->jp_1Index),  pop1-1, cIS);) \
-            Pjp->jp_Type = (BaseJPType) - 1 + (MaxPop1) - 1;    \
-            FreeLeaf(PjllRaw, pop1, Pjpm);                      \
-            return(1);                                          \
-        }
-
-#else // JUDYL
-
-// Pjv is also in the context.
-
-#define JU_LEAF_TOIMMED(cIS,LeafType,MaxPop1,BaseJPType,ignore1,\
-                        ignore2,ignore3,ignore4,                \
-                        DeleteCopy,FreeLeaf)                    \
-                                                                \
-        assert(pop1 > (MaxPop1));                               \
-                                                                \
-        if ((pop1 - 1) == (MaxPop1))    /* hysteresis = 0 */    \
-        {                                                       \
-            Pjll_t PjllRaw = (Pjll_t) (Pjp->jp_Addr);           \
-            Pjv_t  PjvnewRaw;                                   \
-            Pjv_t  Pjvnew;                                      \
-                                                                \
-            if ((PjvnewRaw = j__udyLAllocJV(pop1 - 1, Pjpm))    \
-                == (Pjv_t) NULL) return(-1);                    \
-   JUDYLCODE(Pjvnew = P_JV(PjvnewRaw);)                         \
-                                                                \
-            DeleteCopy((LeafType) (Pjp->jp_LIndex), Pleaf, pop1, offset, cIS); \
-            JU_DELETECOPY(Pjvnew, Pjv, pop1, offset, cIS);      \
-            DBGCODE(JudyCheckSorted((Pjll_t) (Pjp->jp_LIndex),  pop1-1, cIS);) \
-            FreeLeaf(PjllRaw, pop1, Pjpm);                      \
-            Pjp->jp_Addr = (Word_t) PjvnewRaw;                  \
-            Pjp->jp_Type = (BaseJPType) - 2 + (MaxPop1);        \
-            return(1);                                          \
-        }
-
-// A complicating factor for JudyL & 32-bit is that Leaf2..3, and for JudyL &
-// 64-bit Leaf 4..7, go directly to an Immed*_01, where the value is stored in
-// jp_Addr and not in a separate LeafV.  For efficiency, use the following
-// macro in cases where it can apply; it is rigged to do the right thing.
-// Unfortunately, this requires the calling code to "know" the transition table
-// and call the right macro.
-//
-// This variant compresses a Leaf* with pop1 = 2 into a JPIMMED_*_01:
-
-#define JU_LEAF_TOIMMED_01(cIS,LeafType,MaxPop1,ignore,Immed01JPType,   \
-                           ToImmed,SearchLeaf,CopyPIndex,               \
-                           DeleteCopy,FreeLeaf)                         \
-                                                                        \
-        assert(pop1 > (MaxPop1));                                       \
-                                                                        \
-        if ((pop1 - 1) == (MaxPop1))    /* hysteresis = 0 */            \
-        {                                                               \
-            Pjll_t PjllRaw = (Pjll_t) (Pjp->jp_Addr);                   \
-            ToImmed(cIS, SearchLeaf, CopyPIndex);                       \
-            FreeLeaf(PjllRaw, pop1, Pjpm);                              \
-            Pjp->jp_Type = (Immed01JPType);                             \
-            return(1);                                                  \
-        }
-#endif // JUDYL
-
-// See comments above about these:
-//
-// Note:  Here "23" means index size 2 or 3, and "47" means 4..7.
-
-#if (defined(JUDY1) || defined(JU_64BIT))
-#define JU_LEAF_TOIMMED_23(cIS,LeafType,MaxPop1,BaseJPType,Immed01JPType, \
-                           ToImmed,SearchLeaf,CopyPIndex,               \
-                           DeleteCopy,FreeLeaf)                         \
-        JU_LEAF_TOIMMED(   cIS,LeafType,MaxPop1,BaseJPType,ignore1,     \
-                           ignore2,ignore3,ignore4,                     \
-                           DeleteCopy,FreeLeaf)
-#else // JUDYL && 32-bit
-#define JU_LEAF_TOIMMED_23(cIS,LeafType,MaxPop1,BaseJPType,Immed01JPType, \
-                           ToImmed,SearchLeaf,CopyPIndex,               \
-                           DeleteCopy,FreeLeaf)                         \
-        JU_LEAF_TOIMMED_01(cIS,LeafType,MaxPop1,ignore,Immed01JPType,   \
-                           ToImmed,SearchLeaf,CopyPIndex,               \
-                           DeleteCopy,FreeLeaf)
-#endif
-
-#ifdef JU_64BIT
-#ifdef JUDY1
-#define JU_LEAF_TOIMMED_47(cIS,LeafType,MaxPop1,BaseJPType,Immed01JPType, \
-                           ToImmed,SearchLeaf,CopyPIndex,               \
-                           DeleteCopy,FreeLeaf)                         \
-        JU_LEAF_TOIMMED(   cIS,LeafType,MaxPop1,BaseJPType,ignore1,     \
-                           ignore2,ignore3,ignore4,                     \
-                           DeleteCopy,FreeLeaf)
-#else // JUDYL && 64-bit
-#define JU_LEAF_TOIMMED_47(cIS,LeafType,MaxPop1,BaseJPType,Immed01JPType, \
-                           ToImmed,SearchLeaf,CopyPIndex,               \
-                           DeleteCopy,FreeLeaf)                         \
-        JU_LEAF_TOIMMED_01(cIS,LeafType,MaxPop1,ignore,Immed01JPType,   \
-                           ToImmed,SearchLeaf,CopyPIndex,               \
-                           DeleteCopy,FreeLeaf)
-#endif // JUDYL
-#endif // JU_64BIT
-
-// Compress a Leaf* in place:
-//
-// Here hysteresis = 0 (no memory is wasted).  Variables pop1, Pleaf, and
-// offset, and for JudyL, Pjv, are in the context.
-
-#ifdef JUDY1
-#define JU_LEAF_INPLACE(cIS,GrowInPlace,DeleteInPlace)          \
-        if (GrowInPlace(pop1 - 1))      /* hysteresis = 0 */    \
-        {                                                       \
-            DeleteInPlace(Pleaf, pop1, offset, cIS);            \
-            DBGCODE(JudyCheckSorted(Pleaf, pop1 - 1, cIS);)     \
-            return(1);                                          \
-        }
-#else
-#define JU_LEAF_INPLACE(cIS,GrowInPlace,DeleteInPlace)          \
-        if (GrowInPlace(pop1 - 1))      /* hysteresis = 0 */    \
-        {                                                       \
-            DeleteInPlace(Pleaf, pop1, offset, cIS);            \
-/**/        JU_DELETEINPLACE(Pjv, pop1, offset, ignore);        \
-            DBGCODE(JudyCheckSorted(Pleaf, pop1 - 1, cIS);)     \
-            return(1);                                          \
-        }
-#endif
-
-// Compress a Leaf* into a smaller memory object of the same JP type:
-//
-// Variables PjllnewRaw, Pjllnew, Pleafpop1, Pjpm, PleafRaw, Pleaf, and offset
-// are in the context.
-
-#ifdef JUDY1
-
-#define JU_LEAF_SHRINK(cIS,LeafType,DeleteCopy,Alloc,FreeLeaf,ValueArea) \
-        if ((PjllnewRaw = Alloc(pop1 - 1, Pjpm)) == 0) return(-1);       \
-        Pjllnew = P_JLL(PjllnewRaw);                                     \
-        DeleteCopy((LeafType) Pjllnew, Pleaf, pop1, offset, cIS);        \
-        DBGCODE(JudyCheckSorted(Pjllnew, pop1 - 1, cIS);)                \
-        FreeLeaf(PleafRaw, pop1, Pjpm);                                  \
-        Pjp->jp_Addr = (Word_t) PjllnewRaw;                              \
-        return(1)
-
-#else // JUDYL
-
-#define JU_LEAF_SHRINK(cIS,LeafType,DeleteCopy,Alloc,FreeLeaf,ValueArea) \
-        {                                                               \
-/**/        Pjv_t Pjvnew;                                               \
-                                                                        \
-            if ((PjllnewRaw = Alloc(pop1 - 1, Pjpm)) == 0) return(-1);  \
-            Pjllnew = P_JLL(PjllnewRaw);                                \
-/**/        Pjvnew  = ValueArea(Pjllnew, pop1 - 1);                     \
-            DeleteCopy((LeafType) Pjllnew, Pleaf, pop1, offset, cIS);   \
-/**/        JU_DELETECOPY(Pjvnew, Pjv, pop1, offset, cIS);              \
-            DBGCODE(JudyCheckSorted(Pjllnew, pop1 - 1, cIS);)           \
-            FreeLeaf(PleafRaw, pop1, Pjpm);                             \
-            Pjp->jp_Addr = (Word_t) PjllnewRaw;                         \
-            return(1);                                                  \
-        }
-#endif // JUDYL
-
-// Overall common code for Leaf* deletion handling:
-//
-// See if the leaf can be:
-// - (de)compressed to one a level higher (JU_LEAF_UPLEVEL()), or if not,
-// - compressed to an Immediate JP (JU_LEAF_TOIMMED()), or if not,
-// - shrunk in place (JU_LEAF_INPLACE()), or if none of those, then
-// - shrink the leaf to a smaller chunk of memory (JU_LEAF_SHRINK()).
-//
-// Variables Pjp, pop1, Index, and offset are in the context.
-// The *Up parameters refer to a leaf one level up, if there is any.
-
-#define JU_LEAF(cIS,                                                    \
-                UpLevel,                                                \
-                  LeafTypeUp,MaxPop1Up,LeafJPTypeUp,LeafToLeaf,         \
-                  AllocUp,ValueAreaUp,                                  \
-                LeafToImmed,ToImmed,CopyPIndex,                         \
-                  LeafType,ImmedMaxPop1,ImmedBaseJPType,Immed01JPType,  \
-                  SearchLeaf,GrowInPlace,DeleteInPlace,DeleteCopy,      \
-                  Alloc,FreeLeaf,ValueArea)                             \
-        {                                                               \
-            Pjll_t   PleafRaw;                                          \
-            LeafType Pleaf;                                             \
-                                                                        \
-            assert(! JU_DCDNOTMATCHINDEX(Index, Pjp, cIS));             \
-            assert(ParentLevel > (cIS));                                \
-                                                                        \
-            PleafRaw = (Pjll_t) (Pjp->jp_Addr);                         \
-            Pleaf    = (LeafType) P_JLL(PleafRaw);                      \
-            pop1     = JU_JPLEAF_POP0(Pjp) + 1;                         \
-                                                                        \
-            UpLevel(cIS, LeafTypeUp, MaxPop1Up, LeafJPTypeUp,           \
-                    LeafToLeaf, AllocUp, ValueAreaUp);                  \
-                                                                        \
-            offset = SearchLeaf(Pleaf, pop1, Index);                    \
-            assert(offset >= 0);        /* Index must be valid */       \
-  JUDYLCODE(Pjv = ValueArea(Pleaf, pop1);)                              \
-                                                                        \
-            LeafToImmed(cIS, LeafType, ImmedMaxPop1,                    \
-                        ImmedBaseJPType, Immed01JPType,                 \
-                        ToImmed, SearchLeaf, CopyPIndex,                \
-                        DeleteCopy, FreeLeaf);                          \
-                                                                        \
-            JU_LEAF_INPLACE(cIS, GrowInPlace, DeleteInPlace);           \
-                                                                        \
-            JU_LEAF_SHRINK(cIS, LeafType, DeleteCopy, Alloc, FreeLeaf,  \
-                           ValueArea);                                  \
-        }
-
-// END OF MACROS, START OF CASES:
-//
-// (*) Leaf1 [[ => 1_15..08 ] => 1_07 => ... => 1_04 ] => 1_03 => 1_02 => 1_01
-
-#if (defined(JUDYL) || (! defined(JU_64BIT)))
-        case cJU_JPLEAF1:
-
-            JU_LEAF(1,
-                    JU_LEAF_UPLEVEL, uint16_t *, cJU_LEAF2_MAXPOP1, cJU_JPLEAF2,
-                      j__udyLeaf1ToLeaf2, j__udyAllocJLL2, JL_LEAF2VALUEAREA,
-                    JU_LEAF_TOIMMED, ignore, ignore,
-                      uint8_t *, cJU_IMMED1_MAXPOP1,
-                      cJU_JPIMMED_1_02, cJU_JPIMMED_1_01, j__udySearchLeaf1,
-                      JU_LEAF1GROWINPLACE, JU_DELETEINPLACE, JU_DELETECOPY,
-                      j__udyAllocJLL1, j__udyFreeJLL1, JL_LEAF1VALUEAREA);
-#endif
-
-// A complicating factor is that for JudyL & 32-bit, a Leaf2 must go directly
-// to an Immed 2_01 and a Leaf3 must go directly to an Immed 3_01:
-//
-// Leaf2 [[ => 2_07..04 ] => 2_03 => 2_02 ] => 2_01
-// Leaf3 [[ => 3_05..03 ] => 3_02         ] => 3_01
-//
-// Hence use JU_LEAF_TOIMMED_23 instead of JU_LEAF_TOIMMED in the cases below,
-// and also the parameters ToImmed and, for odd index sizes, CopyPIndex, are
-// required.
-
-        case cJU_JPLEAF2:
-
-            JU_LEAF(2,
-                    JU_LEAF_UPLEVEL, uint8_t *, cJU_LEAF3_MAXPOP1, cJU_JPLEAF3,
-                      j__udyLeaf2ToLeaf3, j__udyAllocJLL3, JL_LEAF3VALUEAREA,
-                    JU_LEAF_TOIMMED_23, JU_TOIMMED_01_EVEN, ignore,
-                      uint16_t *, cJU_IMMED2_MAXPOP1,
-                      cJU_JPIMMED_2_02, cJU_JPIMMED_2_01, j__udySearchLeaf2,
-                      JU_LEAF2GROWINPLACE, JU_DELETEINPLACE, JU_DELETECOPY,
-                      j__udyAllocJLL2, j__udyFreeJLL2, JL_LEAF2VALUEAREA);
-
-// On 32-bit there is no transition to "uplevel" for a Leaf3, so use
-// JU_LEAF_UPLEVEL64 instead of JU_LEAF_UPLEVEL:
-
-        case cJU_JPLEAF3:
-
-            JU_LEAF(3,
-                    JU_LEAF_UPLEVEL64, uint32_t *, cJU_LEAF4_MAXPOP1,
-                      cJU_JPLEAF4,
-                      j__udyLeaf3ToLeaf4, j__udyAllocJLL4, JL_LEAF4VALUEAREA,
-                    JU_LEAF_TOIMMED_23,
-                      JU_TOIMMED_01_ODD, JU_COPY3_PINDEX_TO_LONG,
-                      uint8_t *, cJU_IMMED3_MAXPOP1,
-                      cJU_JPIMMED_3_02, cJU_JPIMMED_3_01, j__udySearchLeaf3,
-                      JU_LEAF3GROWINPLACE, JU_DELETEINPLACE_ODD,
-                                           JU_DELETECOPY_ODD,
-                      j__udyAllocJLL3, j__udyFreeJLL3, JL_LEAF3VALUEAREA);
-
-#ifdef JU_64BIT
-
-// A complicating factor is that for JudyL & 64-bit, a Leaf[4-7] must go
-// directly to an Immed [4-7]_01:
-//
-// Leaf4 [[ => 4_03..02 ]] => 4_01
-// Leaf5 [[ => 5_03..02 ]] => 5_01
-// Leaf6 [[ => 6_02     ]] => 6_01
-// Leaf7 [[ => 7_02     ]] => 7_01
-//
-// Hence use JU_LEAF_TOIMMED_47 instead of JU_LEAF_TOIMMED in the cases below.
-
-        case cJU_JPLEAF4:
-
-            JU_LEAF(4,
-                    JU_LEAF_UPLEVEL, uint8_t *, cJU_LEAF5_MAXPOP1, cJU_JPLEAF5,
-                      j__udyLeaf4ToLeaf5, j__udyAllocJLL5, JL_LEAF5VALUEAREA,
-                    JU_LEAF_TOIMMED_47, JU_TOIMMED_01_EVEN, ignore,
-                      uint32_t *, cJU_IMMED4_MAXPOP1,
-                      cJ1_JPIMMED_4_02, cJU_JPIMMED_4_01, j__udySearchLeaf4,
-                      JU_LEAF4GROWINPLACE, JU_DELETEINPLACE, JU_DELETECOPY,
-                      j__udyAllocJLL4, j__udyFreeJLL4, JL_LEAF4VALUEAREA);
-
-        case cJU_JPLEAF5:
-
-            JU_LEAF(5,
-                    JU_LEAF_UPLEVEL, uint8_t *, cJU_LEAF6_MAXPOP1, cJU_JPLEAF6,
-                      j__udyLeaf5ToLeaf6, j__udyAllocJLL6, JL_LEAF6VALUEAREA,
-                    JU_LEAF_TOIMMED_47,
-                      JU_TOIMMED_01_ODD, JU_COPY5_PINDEX_TO_LONG,
-                      uint8_t *, cJU_IMMED5_MAXPOP1,
-                      cJ1_JPIMMED_5_02, cJU_JPIMMED_5_01, j__udySearchLeaf5,
-                      JU_LEAF5GROWINPLACE, JU_DELETEINPLACE_ODD,
-                                           JU_DELETECOPY_ODD,
-                      j__udyAllocJLL5, j__udyFreeJLL5, JL_LEAF5VALUEAREA);
-
-        case cJU_JPLEAF6:
-
-            JU_LEAF(6,
-                    JU_LEAF_UPLEVEL, uint8_t *, cJU_LEAF7_MAXPOP1, cJU_JPLEAF7,
-                      j__udyLeaf6ToLeaf7, j__udyAllocJLL7, JL_LEAF7VALUEAREA,
-                    JU_LEAF_TOIMMED_47,
-                      JU_TOIMMED_01_ODD, JU_COPY6_PINDEX_TO_LONG,
-                      uint8_t *, cJU_IMMED6_MAXPOP1,
-                      cJ1_JPIMMED_6_02, cJU_JPIMMED_6_01, j__udySearchLeaf6,
-                      JU_LEAF6GROWINPLACE, JU_DELETEINPLACE_ODD,
-                                           JU_DELETECOPY_ODD,
-                      j__udyAllocJLL6, j__udyFreeJLL6, JL_LEAF6VALUEAREA);
-
-// There is no transition to "uplevel" for a Leaf7, so use JU_LEAF_UPLEVEL_NONE
-// instead of JU_LEAF_UPLEVEL, and ignore all of the parameters to that macro:
-
-        case cJU_JPLEAF7:
-
-            JU_LEAF(7,
-                    JU_LEAF_UPLEVEL_NONE, ignore1, ignore2, ignore3, ignore4,
-                      ignore5, ignore6,
-                    JU_LEAF_TOIMMED_47,
-                      JU_TOIMMED_01_ODD, JU_COPY7_PINDEX_TO_LONG,
-                      uint8_t *, cJU_IMMED7_MAXPOP1,
-                      cJ1_JPIMMED_7_02, cJU_JPIMMED_7_01, j__udySearchLeaf7,
-                      JU_LEAF7GROWINPLACE, JU_DELETEINPLACE_ODD,
-                                           JU_DELETECOPY_ODD,
-                      j__udyAllocJLL7, j__udyFreeJLL7, JL_LEAF7VALUEAREA);
-#endif // JU_64BIT
-
-
-// ****************************************************************************
-// BITMAP LEAF:
-
-        case cJU_JPLEAF_B1:
-        {
-#ifdef JUDYL
-            Pjv_t     PjvnewRaw;        // new value area.
-            Pjv_t     Pjvnew;
-            Word_t    subexp;           // 1 of 8 subexpanses in bitmap.
-            Pjlb_t    Pjlb;             // pointer to bitmap part of the leaf.
-            BITMAPL_t bitmap;           // for one subexpanse.
-            BITMAPL_t bitmask;          // bit set for Indexs digit.
-#endif
-            assert(! JU_DCDNOTMATCHINDEX(Index, Pjp, 1));
-            assert(ParentLevel > 1);
-            // valid Index:
-            assert(JU_BITMAPTESTL(P_JLB(Pjp->jp_Addr), Index));
-
-            pop1 = JU_JPLEAF_POP0(Pjp) + 1;
-
-// Like a Leaf1, see if its under a narrow pointer and can become a Leaf2
-// (hysteresis = 1):
-
-            JU_LEAF_UPLEVEL(1, uint16_t *, cJU_LEAF2_MAXPOP1, cJU_JPLEAF2,
-                            j__udyLeaf1ToLeaf2, j__udyAllocJLL2,
-                            JL_LEAF2VALUEAREA);
-
-#if (defined(JUDY1) && defined(JU_64BIT))
-
-// Handle the unusual special case, on Judy1 64-bit only, where a LeafB1 goes
-// directly to a JPIMMED_1_15; as described in comments in Judy1.h and
-// JudyIns.c.  Copy 1-byte indexes from old LeafB1 to the Immed:
-
-            if ((pop1 - 1) == cJU_IMMED1_MAXPOP1)       // hysteresis = 0.
-            {
-                Pjlb_t    PjlbRaw;      // bitmap in old leaf.
-                Pjlb_t    Pjlb;
-                uint8_t * Pleafnew;     // JPIMMED as a pointer.
-                Word_t    ldigit;       // larger than uint8_t.
-
-                PjlbRaw  = (Pjlb_t) (Pjp->jp_Addr);
-                Pjlb     = P_JLB(PjlbRaw);
-                Pleafnew = Pjp->jp_1Index;
-
-                JU_BITMAPCLEARL(Pjlb, Index);   // unset Indexs bit.
-
-// TBD:  This is very slow, there must be a better way:
-
-                for (ldigit = 0; ldigit < cJU_BRANCHUNUMJPS; ++ldigit)
-                {
-                    if (JU_BITMAPTESTL(Pjlb, ldigit))
-                    {
-                        *Pleafnew++ = ldigit;
-                        assert(Pleafnew - (Pjp->jp_1Index)
-                            <= cJU_IMMED1_MAXPOP1);
-                    }
-                }
-
-                DBGCODE(JudyCheckSorted((Pjll_t) (Pjp->jp_1Index),
-                                        cJU_IMMED1_MAXPOP1, 1);)
-                j__udyFreeJLB1(PjlbRaw, Pjpm);
-
-                Pjp->jp_Type = cJ1_JPIMMED_1_15;
-                return(1);
-            }
-
-#else // (JUDYL || (! JU_64BIT))
-
-// Compress LeafB1 to a Leaf1:
-//
-// Note:  4.37 of this file contained alternate code for Judy1 only that simply
-// cleared the bit and allowed the LeafB1 to go below cJU_LEAF1_MAXPOP1.  This
-// was the ONLY case where a malloc failure was not fatal; however, it violated
-// the critical assumption that the tree is always kept in least-compressed
-// form.
-
-            if (pop1 == cJU_LEAF1_MAXPOP1)      // hysteresis = 1.
-            {
-                if (j__udyLeafB1ToLeaf1(Pjp, Pjpm) == -1) return(-1);
-                goto ContinueDelWalk;   // delete Index in new Leaf1.
-            }
-#endif // (JUDYL || (! JU_64BIT))
-
-#ifdef JUDY1
-            // unset Indexs bit:
-
-            JU_BITMAPCLEARL(P_JLB(Pjp->jp_Addr), Index);
-#else // JUDYL
-
-// This is very different from Judy1 because of the need to manage the value
-// area:
-//
-// Get last byte to decode from Index, and pointer to bitmap leaf:
-
-            digit = JU_DIGITATSTATE(Index, 1);
-            Pjlb = P_JLB(Pjp->jp_Addr);
-
-// Prepare additional values:
-
-            subexp  = digit / cJU_BITSPERSUBEXPL;       // which subexpanse.
-            bitmap  = JU_JLB_BITMAP(Pjlb, subexp);      // subexps 32-bit map.
-            PjvRaw  = JL_JLB_PVALUE(Pjlb, subexp);      // corresponding values.
-            Pjv     = P_JV(PjvRaw);
-            bitmask = JU_BITPOSMASKL(digit);            // mask for Index.
-
-            assert(bitmap & bitmask);                   // Index must be valid.
-
-            if (bitmap == cJU_FULLBITMAPL)      // full bitmap, take shortcut:
-            {
-                pop1   = cJU_BITSPERSUBEXPL;
-                offset = digit % cJU_BITSPERSUBEXPL;
-            }
-            else        // compute subexpanse pop1 and value area offset:
-            {
-                pop1   = j__udyCountBitsL(bitmap);
-                offset = j__udyCountBitsL(bitmap & (bitmask - 1));
-            }
-
-// Handle solitary Index remaining in subexpanse:
-
-            if (pop1 == 1)
-            {
-                j__udyLFreeJV(PjvRaw, 1, Pjpm);
-
-                JL_JLB_PVALUE(Pjlb, subexp) = (Pjv_t) NULL;
-                JU_JLB_BITMAP(Pjlb, subexp) = 0;
-
-                return(1);
-            }
-
-// Shrink value area in place or move to a smaller value area:
-
-            if (JL_LEAFVGROWINPLACE(pop1 - 1))          // hysteresis = 0.
-            {
-                JU_DELETEINPLACE(Pjv, pop1, offset, ignore);
-            }
-            else
-            {
-                if ((PjvnewRaw = j__udyLAllocJV(pop1 - 1, Pjpm))
-                    == (Pjv_t) NULL) return(-1);
-                Pjvnew = P_JV(PjvnewRaw);
-
-                JU_DELETECOPY(Pjvnew, Pjv, pop1, offset, ignore);
-                j__udyLFreeJV(PjvRaw, pop1, Pjpm);
-                JL_JLB_PVALUE(Pjlb, subexp) = (Pjv_t) PjvnewRaw;
-            }
-
-            JU_JLB_BITMAP(Pjlb, subexp) ^= bitmask;     // clear Indexs bit.
-
-#endif // JUDYL
-
-            return(1);
-
-        } // case.
-
-
-#ifdef JUDY1
-
-// ****************************************************************************
-// FULL POPULATION LEAF:
-//
-// Convert to a LeafB1 and delete the index.  Hysteresis = 0; none is possible.
-//
-// Note:  Earlier the second assertion below said, "== 2", but in fact the
-// parent could be at a higher level if a fullpop is under a narrow pointer.
-
-        case cJ1_JPFULLPOPU1:
-        {
-            Pjlb_t PjlbRaw;
-            Pjlb_t Pjlb;
-            Word_t subexp;
-
-            assert(! JU_DCDNOTMATCHINDEX(Index, Pjp, 2));
-            assert(ParentLevel > 1);    // see above.
-
-            if ((PjlbRaw = j__udyAllocJLB1(Pjpm)) == (Pjlb_t) NULL)
-                return(-1);
-            Pjlb = P_JLB(PjlbRaw);
-
-// Fully populate the leaf, then unset Indexs bit:
-
-            for (subexp = 0; subexp < cJU_NUMSUBEXPL; ++subexp)
-                JU_JLB_BITMAP(Pjlb, subexp) = cJU_FULLBITMAPL;
-
-            JU_BITMAPCLEARL(Pjlb, Index);
-
-            Pjp->jp_Addr = (Word_t) PjlbRaw;
-            Pjp->jp_Type = cJU_JPLEAF_B1;
-
-            return(1);
-        }
-#endif // JUDY1
-
-
-// ****************************************************************************
-// IMMEDIATE JP:
-//
-// If theres just the one Index in the Immed, convert the JP to a JPNULL*
-// (should only happen in a BranchU); otherwise delete the Index from the
-// Immed.  See the state transitions table elsewhere in this file for a summary
-// of which Immed types must be handled.  Hysteresis = 0; none is possible with
-// Immeds.
-//
-// MACROS FOR COMMON CODE:
-//
-// Single Index remains in cJU_JPIMMED_*_01; convert JP to null:
-//
-// Variables Pjp and parentJPtype are in the context.
-//
-// Note:  cJU_JPIMMED_*_01 should only be encountered in BranchUs, not in
-// BranchLs or BranchBs (where its improper to merely modify the JP to be a
-// null JP); that is, BranchL and BranchB code should have already handled
-// any cJU_JPIMMED_*_01 by different means.
-
-#define JU_IMMED_01(NewJPType,ParentJPType)                             \
-                                                                        \
-            assert(parentJPtype == (ParentJPType));                     \
-            assert(JU_JPDCDPOP0(Pjp) == JU_TRIMTODCDSIZE(Index));       \
-            JU_JPSETADT(Pjp, 0, 0, NewJPType);                          \
-            return(1)
-
-// Convert cJ*_JPIMMED_*_02 to cJU_JPIMMED_*_01:
-//
-// Move the undeleted Index, whichever does not match the least bytes of Index,
-// from undecoded-bytes-only (in jp_1Index or jp_LIndex as appropriate) to
-// jp_DcdPopO (full-field).  Pjp, Index, and offset are in the context.
-
-#define JU_IMMED_02(cIS,LeafType,NewJPType)             \
-        {                                               \
-            LeafType Pleaf;                             \
-                                                        \
-            assert((ParentLevel - 1) == (cIS));         \
-  JUDY1CODE(Pleaf  = (LeafType) (Pjp->jp_1Index);)      \
-  JUDYLCODE(Pleaf  = (LeafType) (Pjp->jp_LIndex);)      \
-  JUDYLCODE(PjvRaw = (Pjv_t) (Pjp->jp_Addr);)           \
-  JUDYLCODE(Pjv    = P_JV(PjvRaw);)                     \
-            JU_TOIMMED_01_EVEN(cIS, ignore, ignore);    \
-  JUDYLCODE(j__udyLFreeJV(PjvRaw, 2, Pjpm);)            \
-            Pjp->jp_Type = (NewJPType);                 \
-            return(1);                                  \
-        }
-
-#if (defined(JUDY1) || defined(JU_64BIT))
-
-// Variation for "odd" cJ*_JPIMMED_*_02 JP types, which are very different from
-// "even" types because they use leaf search code and odd-copy macros:
-//
-// Note:  JudyL 32-bit has no "odd" JPIMMED_*_02 types.
-
-#define JU_IMMED_02_ODD(cIS,NewJPType,SearchLeaf,CopyPIndex)    \
-        {                                                       \
-            uint8_t * Pleaf;                                    \
-                                                                \
-            assert((ParentLevel - 1) == (cIS));                 \
-  JUDY1CODE(Pleaf  = (uint8_t *) (Pjp->jp_1Index);)             \
-  JUDYLCODE(Pleaf  = (uint8_t *) (Pjp->jp_LIndex);)             \
-  JUDYLCODE(PjvRaw = (Pjv_t) (Pjp->jp_Addr);)                   \
-  JUDYLCODE(Pjv    = P_JV(PjvRaw);)                             \
-            JU_TOIMMED_01_ODD(cIS, SearchLeaf, CopyPIndex);     \
-  JUDYLCODE(j__udyLFreeJV(PjvRaw, 2, Pjpm);)                    \
-            Pjp->jp_Type = (NewJPType);                         \
-            return(1);                                          \
-        }
-#endif // (JUDY1 || JU_64BIT)
-
-// Core code for deleting one Index (and for JudyL, its value area) from a
-// larger Immed:
-//
-// Variables Pleaf, pop1, and offset are in the context.
-
-#ifdef JUDY1
-#define JU_IMMED_DEL(cIS,DeleteInPlace)                 \
-        DeleteInPlace(Pleaf, pop1, offset, cIS);        \
-        DBGCODE(JudyCheckSorted(Pleaf, pop1 - 1, cIS);)
-
-#else // JUDYL
-
-// For JudyL the value area might need to be shrunk:
-
-#define JU_IMMED_DEL(cIS,DeleteInPlace)                         \
-                                                                \
-        if (JL_LEAFVGROWINPLACE(pop1 - 1)) /* hysteresis = 0 */ \
-        {                                                       \
-            DeleteInPlace(   Pleaf,  pop1, offset, cIS);        \
-            JU_DELETEINPLACE(Pjv, pop1, offset, ignore);        \
-            DBGCODE(JudyCheckSorted(Pleaf, pop1 - 1, cIS);)     \
-        }                                                       \
-        else                                                    \
-        {                                                       \
-            Pjv_t PjvnewRaw;                                    \
-            Pjv_t Pjvnew;                                       \
-                                                                \
-            if ((PjvnewRaw = j__udyLAllocJV(pop1 - 1, Pjpm))    \
-                == (Pjv_t) NULL) return(-1);                    \
-            Pjvnew = P_JV(PjvnewRaw);                           \
-                                                                \
-            DeleteInPlace(Pleaf, pop1, offset, cIS);            \
-            JU_DELETECOPY(Pjvnew, Pjv, pop1, offset, ignore);   \
-            DBGCODE(JudyCheckSorted(Pleaf, pop1 - 1, cIS);)     \
-            j__udyLFreeJV(PjvRaw, pop1, Pjpm);                  \
-                                                                \
-            (Pjp->jp_Addr) = (Word_t) PjvnewRaw;                \
-        }
-#endif // JUDYL
-
-// Delete one Index from a larger Immed where no restructuring is required:
-//
-// Variables pop1, Pjp, offset, and Index are in the context.
-
-#define JU_IMMED(cIS,LeafType,BaseJPType,SearchLeaf,DeleteInPlace)      \
-        {                                                               \
-            LeafType Pleaf;                                             \
-                                                                        \
-            assert((ParentLevel - 1) == (cIS));                         \
-  JUDY1CODE(Pleaf  = (LeafType) (Pjp->jp_1Index);)                      \
-  JUDYLCODE(Pleaf  = (LeafType) (Pjp->jp_LIndex);)                      \
-  JUDYLCODE(PjvRaw = (Pjv_t) (Pjp->jp_Addr);)                           \
-  JUDYLCODE(Pjv    = P_JV(PjvRaw);)                                     \
-            pop1   = (JU_JPTYPE(Pjp)) - (BaseJPType) + 2;               \
-            offset = SearchLeaf(Pleaf, pop1, Index);                    \
-            assert(offset >= 0);        /* Index must be valid */       \
-                                                                        \
-            JU_IMMED_DEL(cIS, DeleteInPlace);                           \
-            --(Pjp->jp_Type);                                           \
-            return(1);                                                  \
-        }
-
-
-// END OF MACROS, START OF CASES:
-
-// Single Index remains in Immed; convert JP to null:
-
-        case cJU_JPIMMED_1_01: JU_IMMED_01(cJU_JPNULL1, cJU_JPBRANCH_U2);
-        case cJU_JPIMMED_2_01: JU_IMMED_01(cJU_JPNULL2, cJU_JPBRANCH_U3);
-#ifndef JU_64BIT
-        case cJU_JPIMMED_3_01: JU_IMMED_01(cJU_JPNULL3, cJU_JPBRANCH_U);
-#else
-        case cJU_JPIMMED_3_01: JU_IMMED_01(cJU_JPNULL3, cJU_JPBRANCH_U4);
-        case cJU_JPIMMED_4_01: JU_IMMED_01(cJU_JPNULL4, cJU_JPBRANCH_U5);
-        case cJU_JPIMMED_5_01: JU_IMMED_01(cJU_JPNULL5, cJU_JPBRANCH_U6);
-        case cJU_JPIMMED_6_01: JU_IMMED_01(cJU_JPNULL6, cJU_JPBRANCH_U7);
-        case cJU_JPIMMED_7_01: JU_IMMED_01(cJU_JPNULL7, cJU_JPBRANCH_U);
-#endif
-
-// Multiple Indexes remain in the Immed JP; delete the specified Index:
-
-        case cJU_JPIMMED_1_02:
-
-            JU_IMMED_02(1, uint8_t *, cJU_JPIMMED_1_01);
-
-        case cJU_JPIMMED_1_03:
-#if (defined(JUDY1) || defined(JU_64BIT))
-        case cJU_JPIMMED_1_04:
-        case cJU_JPIMMED_1_05:
-        case cJU_JPIMMED_1_06:
-        case cJU_JPIMMED_1_07:
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-        case cJ1_JPIMMED_1_08:
-        case cJ1_JPIMMED_1_09:
-        case cJ1_JPIMMED_1_10:
-        case cJ1_JPIMMED_1_11:
-        case cJ1_JPIMMED_1_12:
-        case cJ1_JPIMMED_1_13:
-        case cJ1_JPIMMED_1_14:
-        case cJ1_JPIMMED_1_15:
-#endif
-            JU_IMMED(1, uint8_t *, cJU_JPIMMED_1_02,
-                     j__udySearchLeaf1, JU_DELETEINPLACE);
-
-#if (defined(JUDY1) || defined(JU_64BIT))
-        case cJU_JPIMMED_2_02:
-
-            JU_IMMED_02(2, uint16_t *, cJU_JPIMMED_2_01);
-
-        case cJU_JPIMMED_2_03:
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-        case cJ1_JPIMMED_2_04:
-        case cJ1_JPIMMED_2_05:
-        case cJ1_JPIMMED_2_06:
-        case cJ1_JPIMMED_2_07:
-#endif
-#if (defined(JUDY1) || defined(JU_64BIT))
-            JU_IMMED(2, uint16_t *, cJU_JPIMMED_2_02,
-                     j__udySearchLeaf2, JU_DELETEINPLACE);
-
-        case cJU_JPIMMED_3_02:
-
-            JU_IMMED_02_ODD(3, cJU_JPIMMED_3_01,
-                            j__udySearchLeaf3, JU_COPY3_PINDEX_TO_LONG);
-
-#endif
-
-#if (defined(JUDY1) && defined(JU_64BIT))
-        case cJ1_JPIMMED_3_03:
-        case cJ1_JPIMMED_3_04:
-        case cJ1_JPIMMED_3_05:
-
-            JU_IMMED(3, uint8_t *, cJU_JPIMMED_3_02,
-                     j__udySearchLeaf3, JU_DELETEINPLACE_ODD);
-
-        case cJ1_JPIMMED_4_02:
-
-            JU_IMMED_02(4, uint32_t *, cJU_JPIMMED_4_01);
-
-        case cJ1_JPIMMED_4_03:
-
-            JU_IMMED(4, uint32_t *, cJ1_JPIMMED_4_02,
-                     j__udySearchLeaf4, JU_DELETEINPLACE);
-
-        case cJ1_JPIMMED_5_02:
-
-            JU_IMMED_02_ODD(5, cJU_JPIMMED_5_01,
-                            j__udySearchLeaf5, JU_COPY5_PINDEX_TO_LONG);
-
-        case cJ1_JPIMMED_5_03:
-
-            JU_IMMED(5, uint8_t *, cJ1_JPIMMED_5_02,
-                     j__udySearchLeaf5, JU_DELETEINPLACE_ODD);
-
-        case cJ1_JPIMMED_6_02:
-
-            JU_IMMED_02_ODD(6, cJU_JPIMMED_6_01,
-                            j__udySearchLeaf6, JU_COPY6_PINDEX_TO_LONG);
-
-        case cJ1_JPIMMED_7_02:
-
-            JU_IMMED_02_ODD(7, cJU_JPIMMED_7_01,
-                            j__udySearchLeaf7, JU_COPY7_PINDEX_TO_LONG);
-
-#endif // (JUDY1 && JU_64BIT)
-
-
-// ****************************************************************************
-// INVALID JP TYPE:
-
-        default: JU_SET_ERRNO_NONNULL(Pjpm, JU_ERRNO_CORRUPT); return(-1);
-
-        } // switch
-
-
-// PROCESS JP -- RECURSIVELY:
-//
-// For non-Immed JP types, if successful, post-decrement the population count
-// at this level, or collapse a BranchL if necessary by copying the remaining
-// JP in the BranchL to the parent (hysteresis = 0), which implicitly creates a
-// narrow pointer if there was not already one in the hierarchy.
-
-        assert(level);
-        retcode =  j__udyDelWalk(Pjp, Index, level, Pjpm);
-        assert(retcode != 0);           // should never happen.
-
-        if ((JU_JPTYPE(Pjp)) < cJU_JPIMMED_1_01)                // not an Immed.
-        {
-            switch (retcode)
-            {
-            case 1: 
-            {
-                jp_t JP = *Pjp;
-                Word_t DcdP0;
-
-                DcdP0 = JU_JPDCDPOP0(Pjp) - 1;          // decrement count.
-                JU_JPSETADT(Pjp, JP.jp_Addr, DcdP0, JU_JPTYPE(&JP)); 
-                break;
-            }
-            case 2:     // collapse BranchL to single JP; see above:
-                {
-                    Pjbl_t PjblRaw = (Pjbl_t) (Pjp->jp_Addr);
-                    Pjbl_t Pjbl    = P_JBL(PjblRaw);
-
-                    *Pjp = Pjbl->jbl_jp[0];
-                    j__udyFreeJBL(PjblRaw, Pjpm);
-                    retcode = 1;
-                }
-            }
-        }
-
-        return(retcode);
-
-} // j__udyDelWalk()
-
-
-// ****************************************************************************
-// J U D Y   1   U N S E T
-// J U D Y   L   D E L
-//
-// Main entry point.  See the manual entry for details.
-
-#ifdef JUDY1
-FUNCTION int Judy1Unset 
-#else
-FUNCTION int JudyLDel
-#endif
-        (
-        PPvoid_t  PPArray,      // in which to delete.
-        Word_t    Index,        // to delete.
-        PJError_t PJError       // optional, for returning error info.
-        )
-{
-        Word_t    pop1;         // population of leaf.
-        int       offset;       // at which to delete Index.
-    JUDY1CODE(int retcode;)     // return code from Judy1Test().
-JUDYLCODE(PPvoid_t PPvalue;)  // pointer from JudyLGet().
-
-
-// CHECK FOR NULL ARRAY POINTER (error by caller):
-
-        if (PPArray == (PPvoid_t) NULL)
-        {
-            JU_SET_ERRNO(PJError, JU_ERRNO_NULLPPARRAY);
-            return(JERRI);
-        }
-
-
-// CHECK IF INDEX IS INVALID:
-//
-// If so, theres nothing to do.  This saves a lot of time.  Pass through
-// PJError, if any, from the "get" function.
-
-#ifdef JUDY1
-        if ((retcode = Judy1Test(*PPArray, Index, PJError)) == JERRI)
-            return (JERRI);
-
-        if (retcode == 0) return(0);
-#else
-        if ((PPvalue = JudyLGet(*PPArray, Index, PJError)) == PPJERR)
-            return (JERRI);
-
-        if (PPvalue == (PPvoid_t) NULL) return(0);
-#endif
-
-
-// ****************************************************************************
-// PROCESS TOP LEVEL (LEAFW) BRANCHES AND LEAVES:
-
-// ****************************************************************************
-// LEAFW LEAF, OTHER SIZE:
-//
-// Shrink or convert the leaf as necessary.  Hysteresis = 0; none is possible.
-
-        if (JU_LEAFW_POP0(*PPArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW
-        {
-  JUDYLCODE(Pjv_t  Pjv;)                        // current value area.
-  JUDYLCODE(Pjv_t  Pjvnew;)                     // value area in new leaf.
-            Pjlw_t Pjlw = P_JLW(*PPArray);      // first word of leaf.
-            Pjlw_t Pjlwnew;                     // replacement leaf.
-            pop1 = Pjlw[0] + 1;                 // first word of leaf is pop0.
-
-// Delete single (last) Index from array:
-
-            if (pop1 == 1)
-            {
-                j__udyFreeJLW(Pjlw, /* pop1 = */ 1, (Pjpm_t) NULL);
-                *PPArray = (Pvoid_t) NULL;
-                return(1);
-            }
-
-// Locate Index in compressible leaf:
-
-            offset = j__udySearchLeafW(Pjlw + 1, pop1, Index);
-            assert(offset >= 0);                // Index must be valid.
-
-  JUDYLCODE(Pjv = JL_LEAFWVALUEAREA(Pjlw, pop1);)
-
-// Delete Index in-place:
-//
-// Note:  "Grow in place from pop1 - 1" is the logical inverse of, "shrink in
-// place from pop1."  Also, Pjlw points to the count word, so skip that for
-// doing the deletion.
-
-            if (JU_LEAFWGROWINPLACE(pop1 - 1))
-            {
-                JU_DELETEINPLACE(Pjlw + 1, pop1, offset, ignore);
-#ifdef JUDYL // also delete from value area:
-                JU_DELETEINPLACE(Pjv,      pop1, offset, ignore);
-#endif
-                DBGCODE(JudyCheckSorted((Pjll_t) (Pjlw + 1), pop1 - 1,
-                                        cJU_ROOTSTATE);)
-                --(Pjlw[0]);                    // decrement population.
-                DBGCODE(JudyCheckPop(*PPArray);)
-                return(1);
-            }
-
-// Allocate new leaf for use in either case below:
-
-            Pjlwnew = j__udyAllocJLW(pop1 - 1);
-            JU_CHECKALLOC(Pjlw_t, Pjlwnew, JERRI);
-
-// Shrink to smaller LEAFW:
-//
-// Note:  Skip the first word = pop0 in each leaf.
-
-            Pjlwnew[0] = (pop1 - 1) - 1;
-            JU_DELETECOPY(Pjlwnew + 1, Pjlw + 1, pop1, offset, ignore);
-
-#ifdef JUDYL // also delete from value area:
-            Pjvnew = JL_LEAFWVALUEAREA(Pjlwnew, pop1 - 1);
-            JU_DELETECOPY(Pjvnew, Pjv, pop1, offset, ignore);
-#endif
-            DBGCODE(JudyCheckSorted(Pjlwnew + 1, pop1 - 1, cJU_ROOTSTATE);)
-
-            j__udyFreeJLW(Pjlw, pop1, (Pjpm_t) NULL);
-
-////        *PPArray = (Pvoid_t)  Pjlwnew | cJU_LEAFW);
-            *PPArray = (Pvoid_t)  Pjlwnew; 
-            DBGCODE(JudyCheckPop(*PPArray);)
-            return(1);
-
-        }
-        else
-
-
-// ****************************************************************************
-// JRP BRANCH:
-//
-// Traverse through the JPM to do the deletion unless the population is small
-// enough to convert immediately to a LEAFW.
-
-        {
-            Pjpm_t Pjpm;
-            Pjp_t  Pjp;         // top-level JP to process.
-            Word_t digit;       // in a branch.
-  JUDYLCODE(Pjv_t  Pjv;)        // to value area.
-            Pjlw_t Pjlwnew;                     // replacement leaf.
-    DBGCODE(Pjlw_t Pjlwnew_orig;)
-
-            Pjpm = P_JPM(*PPArray);     // top object in array (tree).
-            Pjp  = &(Pjpm->jpm_JP);     // next object (first branch or leaf).
-
-            assert(((Pjpm->jpm_JP.jp_Type) == cJU_JPBRANCH_L)
-                || ((Pjpm->jpm_JP.jp_Type) == cJU_JPBRANCH_B)
-                || ((Pjpm->jpm_JP.jp_Type) == cJU_JPBRANCH_U));
-
-// WALK THE TREE 
-//
-// Note:  Recursive code in j__udyDelWalk() knows how to collapse a lower-level
-// BranchL containing a single JP into the parent JP as a narrow pointer, but
-// the code here cant do that for a top-level BranchL.  The result can be
-// PArray -> JPM -> BranchL containing a single JP.  This situation is
-// unavoidable because a JPM cannot contain a narrow pointer; the BranchL is
-// required in order to hold the top digit decoded, and it does not collapse to
-// a LEAFW until the population is low enough.
-//
-// TBD:  Should we add a topdigit field to JPMs so they can hold narrow
-// pointers?
-
-            if (j__udyDelWalk(Pjp, Index, cJU_ROOTSTATE, Pjpm) == -1)
-            {
-                JU_COPY_ERRNO(PJError, Pjpm);
-                return(JERRI);
-            }
-
-            --(Pjpm->jpm_Pop0); // success; decrement total population.
-
-            if ((Pjpm->jpm_Pop0 + 1) != cJU_LEAFW_MAXPOP1)
-            {
-                DBGCODE(JudyCheckPop(*PPArray);)
-                return(1);
-            }
-
-// COMPRESS A BRANCH[LBU] TO A LEAFW:
-//
-            Pjlwnew = j__udyAllocJLW(cJU_LEAFW_MAXPOP1);
-            JU_CHECKALLOC(Pjlw_t, Pjlwnew, JERRI);
-
-// Plug leaf into root pointer and set population count:
-
-////        *PPArray  = (Pvoid_t) ((Word_t) Pjlwnew | cJU_LEAFW);
-            *PPArray  = (Pvoid_t) Pjlwnew;
-#ifdef JUDYL // prepare value area:
-            Pjv = JL_LEAFWVALUEAREA(Pjlwnew, cJU_LEAFW_MAXPOP1);
-#endif
-            *Pjlwnew++ = cJU_LEAFW_MAXPOP1 - 1; // set pop0.
-            DBGCODE(Pjlwnew_orig = Pjlwnew;)
-
-            switch (JU_JPTYPE(Pjp))
-            {
-
-// JPBRANCH_L:  Copy each JPs indexes to the new LEAFW and free the old
-// branch:
-
-            case cJU_JPBRANCH_L:
-            {
-                Pjbl_t PjblRaw = (Pjbl_t) (Pjp->jp_Addr);
-                Pjbl_t Pjbl    = P_JBL(PjblRaw);
-
-                for (offset = 0; offset < Pjbl->jbl_NumJPs; ++offset)
-                {
-                    pop1 = j__udyLeafM1ToLeafW(Pjlwnew, JU_PVALUEPASS
-                             (Pjbl->jbl_jp) + offset,
-                             JU_DIGITTOSTATE(Pjbl->jbl_Expanse[offset],
-                                             cJU_BYTESPERWORD),
-                             (Pvoid_t) Pjpm);
-                    Pjlwnew += pop1;            // advance through indexes.
-          JUDYLCODE(Pjv     += pop1;)           // advance through values.
-                }
-                j__udyFreeJBL(PjblRaw, Pjpm);
-
-                assert(Pjlwnew == Pjlwnew_orig + cJU_LEAFW_MAXPOP1);
-                break;                  // delete Index from new LEAFW.
-            }
-
-// JPBRANCH_B:  Copy each JPs indexes to the new LEAFW and free the old
-// branch, including each JP subarray:
-
-            case cJU_JPBRANCH_B:
-            {
-                Pjbb_t    PjbbRaw = (Pjbb_t) (Pjp->jp_Addr);
-                Pjbb_t    Pjbb    = P_JBB(PjbbRaw);
-                Word_t    subexp;       // current subexpanse number.
-                BITMAPB_t bitmap;       // portion for this subexpanse.
-                Pjp_t     Pjp2Raw;      // one subexpanses subarray.
-                Pjp_t     Pjp2;
-
-                for (subexp = 0; subexp < cJU_NUMSUBEXPB; ++subexp)
-                {
-                    if ((bitmap = JU_JBB_BITMAP(Pjbb, subexp)) == 0)
-                        continue;               // skip empty subexpanse.
-
-                    digit   = subexp * cJU_BITSPERSUBEXPB;
-                    Pjp2Raw = JU_JBB_PJP(Pjbb, subexp);
-                    Pjp2    = P_JP(Pjp2Raw);
-                    assert(Pjp2 != (Pjp_t) NULL);
-
-// Walk through bits for all possible sub-subexpanses (digits); increment
-// offset for each populated subexpanse; until no more set bits:
-
-                    for (offset = 0; bitmap != 0; bitmap >>= 1, ++digit)
-                    {
-                        if (! (bitmap & 1))     // skip empty sub-subexpanse.
-                            continue;
-
-                        pop1 = j__udyLeafM1ToLeafW(Pjlwnew, JU_PVALUEPASS
-                                 Pjp2 + offset,
-                                 JU_DIGITTOSTATE(digit, cJU_BYTESPERWORD),
-                                 (Pvoid_t) Pjpm);
-                        Pjlwnew += pop1;         // advance through indexes.
-              JUDYLCODE(Pjv     += pop1;)        // advance through values.
-                        ++offset;
-                    }
-                    j__udyFreeJBBJP(Pjp2Raw, /* pop1 = */ offset, Pjpm);
-                }
-                j__udyFreeJBB(PjbbRaw, Pjpm);
-
-                assert(Pjlwnew == Pjlwnew_orig + cJU_LEAFW_MAXPOP1);
-                break;                  // delete Index from new LEAFW.
-
-            } // case cJU_JPBRANCH_B.
-
-
-// JPBRANCH_U:  Copy each JPs indexes to the new LEAFW and free the old
-// branch:
-
-            case cJU_JPBRANCH_U:
-            {
-                Pjbu_t  PjbuRaw = (Pjbu_t) (Pjp->jp_Addr);
-                Pjbu_t  Pjbu    = P_JBU(PjbuRaw);
-                Word_t  ldigit;         // larger than uint8_t.
-
-                for (Pjp = Pjbu->jbu_jp, ldigit = 0;
-                     ldigit < cJU_BRANCHUNUMJPS;
-                     ++Pjp, ++ldigit)
-                {
-
-// Shortcuts, to save a little time for possibly big branches:
-
-                    if ((JU_JPTYPE(Pjp)) == cJU_JPNULLMAX)  // skip null JP.
-                        continue;
-
-// TBD:  Should the following shortcut also be used in BranchL and BranchB
-// code?
-
-#ifndef JU_64BIT
-                    if ((JU_JPTYPE(Pjp)) == cJU_JPIMMED_3_01)
-#else
-                    if ((JU_JPTYPE(Pjp)) == cJU_JPIMMED_7_01)
-#endif
-                    {                                   // single Immed:
-                        *Pjlwnew++ = JU_DIGITTOSTATE(ldigit, cJU_BYTESPERWORD)
-                                   | JU_JPDCDPOP0(Pjp); // rebuild Index.
-#ifdef JUDYL
-                        *Pjv++ = Pjp->jp_Addr;  // copy value area.
-#endif
-                        continue;
-                    }
-
-                    pop1 = j__udyLeafM1ToLeafW(Pjlwnew, JU_PVALUEPASS
-                             Pjp, JU_DIGITTOSTATE(ldigit, cJU_BYTESPERWORD),
-                             (Pvoid_t) Pjpm);
-                    Pjlwnew += pop1;            // advance through indexes.
-          JUDYLCODE(Pjv     += pop1;)           // advance through values.
-                }
-                j__udyFreeJBU(PjbuRaw, Pjpm);
-
-                assert(Pjlwnew == Pjlwnew_orig + cJU_LEAFW_MAXPOP1);
-                break;                  // delete Index from new LEAFW.
-
-            } // case cJU_JPBRANCH_U.
-
-
-// INVALID JP TYPE in jpm_t struct
-
-            default: JU_SET_ERRNO_NONNULL(Pjpm, JU_ERRNO_CORRUPT);
-                     return(JERRI);
-
-            } // end switch on sub-JP type.
-
-            DBGCODE(JudyCheckSorted((Pjll_t) Pjlwnew_orig, cJU_LEAFW_MAXPOP1,
-                                    cJU_ROOTSTATE);)
-
-// FREE JPM (no longer needed):
-
-            j__udyFreeJPM(Pjpm, (Pjpm_t) NULL);
-            DBGCODE(JudyCheckPop(*PPArray);)
-            return(1);
-
-        } 
-        /*NOTREACHED*/
-
-} // Judy1Unset() / JudyLDel()
diff --git a/libs/klib/judy/JudyFirst.c b/libs/klib/judy/JudyFirst.c
deleted file mode 100644
index 91533a9..0000000
--- a/libs/klib/judy/JudyFirst.c
+++ /dev/null
@@ -1,211 +0,0 @@
-// Copyright (C) 2000 - 2002 Hewlett-Packard Company
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the term of the GNU Lesser 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 Lesser General Public License
-// for more details.
-//
-// You should have received a copy of the GNU Lesser 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
-// _________________
-
-// Judy*First[Empty]() and Judy*Last[Empty]() routines for Judy1 and JudyL.
-// Compile with one of -DJUDY1 or -DJUDYL.
-//
-// These are inclusive versions of Judy*Next[Empty]() and Judy*Prev[Empty]().
-
-#if (! (defined(JUDY1) || defined(JUDYL)))
-#error:  One of -DJUDY1 or -DJUDYL must be specified.
-#endif
-
-#ifdef JUDY1
-#include "Judy1.h"
-#else
-#include "JudyL.h"
-#endif
-
-
-// ****************************************************************************
-// J U D Y   1   F I R S T
-// J U D Y   L   F I R S T
-//
-// See the manual entry for details.
-
-#ifdef JUDY1
-FUNCTION int	  Judy1First
-#else
-FUNCTION PPvoid_t JudyLFirst
-#endif
-        (
-	Pcvoid_t  PArray,	// Judy array to search.
-	Word_t *  PIndex,	// starting point and result.
-	PJError_t PJError	// optional, for returning error info.
-        )
-{
-        if (PIndex == (PWord_t) NULL)		// caller error:
-	{
-	    JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX);
-	    JUDY1CODE(return(JERRI );)
-	    JUDYLCODE(return(PPJERR);)
-	}
-
-#ifdef JUDY1
-	switch (Judy1Test(PArray, *PIndex, PJError))
-	{
-	case 1:	 return(1);			// found *PIndex itself.
-	case 0:  return(Judy1Next(PArray, PIndex, PJError));
-	default: return(JERRI);
-	}
-#else
-	{
-	    PPvoid_t PValue;
-
-	    if ((PValue = JudyLGet(PArray, *PIndex, PJError)) == PPJERR)
-		return(PPJERR);
-
-	    if (PValue != (PPvoid_t) NULL) return(PValue);  // found *PIndex.
-
-	    return(JudyLNext(PArray, PIndex, PJError));
-	}
-#endif
-
-} // Judy1First() / JudyLFirst()
-
-
-// ****************************************************************************
-// J U D Y   1   L A S T
-// J U D Y   L   L A S T
-//
-// See the manual entry for details.
-
-#ifdef JUDY1
-FUNCTION int	  Judy1Last(
-#else
-FUNCTION PPvoid_t JudyLLast(
-#endif
-	Pcvoid_t  PArray,	// Judy array to search.
-	Word_t *  PIndex,	// starting point and result.
-	PJError_t PJError)	// optional, for returning error info.
-{
-        if (PIndex == (PWord_t) NULL)
-	{
-	    JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX);	 // caller error.
-	    JUDY1CODE(return(JERRI );)
-	    JUDYLCODE(return(PPJERR);)
-	}
-
-#ifdef JUDY1
-	switch (Judy1Test(PArray, *PIndex, PJError))
-	{
-	case 1:	 return(1);			// found *PIndex itself.
-	case 0:  return(Judy1Prev(PArray, PIndex, PJError));
-	default: return(JERRI);
-	}
-#else
-	{
-	    PPvoid_t PValue;
-
-	    if ((PValue = JudyLGet(PArray, *PIndex, PJError)) == PPJERR)
-		return(PPJERR);
-
-	    if (PValue != (PPvoid_t) NULL) return(PValue);  // found *PIndex.
-
-	    return(JudyLPrev(PArray, PIndex, PJError));
-	}
-#endif
-
-} // Judy1Last() / JudyLLast()
-
-
-// ****************************************************************************
-// J U D Y   1   F I R S T   E M P T Y
-// J U D Y   L   F I R S T   E M P T Y
-//
-// See the manual entry for details.
-
-#ifdef JUDY1
-FUNCTION int Judy1FirstEmpty(
-#else
-FUNCTION int JudyLFirstEmpty(
-#endif
-	Pcvoid_t  PArray,	// Judy array to search.
-	Word_t *  PIndex,	// starting point and result.
-	PJError_t PJError)	// optional, for returning error info.
-{
-        if (PIndex == (PWord_t) NULL)		// caller error:
-	{
-	    JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX);
-	    return(JERRI);
-	}
-
-#ifdef JUDY1
-	switch (Judy1Test(PArray, *PIndex, PJError))
-	{
-	case 0:	 return(1);			// found *PIndex itself.
-	case 1:  return(Judy1NextEmpty(PArray, PIndex, PJError));
-	default: return(JERRI);
-	}
-#else
-	{
-	    PPvoid_t PValue;
-
-	    if ((PValue = JudyLGet(PArray, *PIndex, PJError)) == PPJERR)
-		return(JERRI);
-
-	    if (PValue == (PPvoid_t) NULL) return(1);	// found *PIndex.
-
-	    return(JudyLNextEmpty(PArray, PIndex, PJError));
-	}
-#endif
-
-} // Judy1FirstEmpty() / JudyLFirstEmpty()
-
-
-// ****************************************************************************
-// J U D Y   1   L A S T   E M P T Y
-// J U D Y   L   L A S T   E M P T Y
-//
-// See the manual entry for details.
-
-#ifdef JUDY1
-FUNCTION int Judy1LastEmpty(
-#else
-FUNCTION int JudyLLastEmpty(
-#endif
-	Pcvoid_t  PArray,	// Judy array to search.
-	Word_t *  PIndex,	// starting point and result.
-	PJError_t PJError)	// optional, for returning error info.
-{
-        if (PIndex == (PWord_t) NULL)
-	{
-	    JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX);	 // caller error.
-	    return(JERRI);
-	}
-
-#ifdef JUDY1
-	switch (Judy1Test(PArray, *PIndex, PJError))
-	{
-	case 0:	 return(1);			// found *PIndex itself.
-	case 1:  return(Judy1PrevEmpty(PArray, PIndex, PJError));
-	default: return(JERRI);
-	}
-#else
-	{
-	    PPvoid_t PValue;
-
-	    if ((PValue = JudyLGet(PArray, *PIndex, PJError)) == PPJERR)
-		return(JERRI);
-
-	    if (PValue == (PPvoid_t) NULL) return(1);	// found *PIndex.
-
-	    return(JudyLPrevEmpty(PArray, PIndex, PJError));
-	}
-#endif
-
-} // Judy1LastEmpty() / JudyLLastEmpty()
diff --git a/libs/klib/judy/JudyFreeArray.c b/libs/klib/judy/JudyFreeArray.c
deleted file mode 100644
index 0145479..0000000
--- a/libs/klib/judy/JudyFreeArray.c
+++ /dev/null
@@ -1,361 +0,0 @@
-// Copyright (C) 2000 - 2002 Hewlett-Packard Company
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the term of the GNU Lesser 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 Lesser General Public License
-// for more details.
-//
-// You should have received a copy of the GNU Lesser 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
-// _________________
-
-// Judy1FreeArray() and JudyLFreeArray() functions for Judy1 and JudyL.
-// Compile with one of -DJUDY1 or -DJUDYL.
-// Return the number of bytes freed from the array.
-
-#if (! (defined(JUDY1) || defined(JUDYL)))
-#error:  One of -DJUDY1 or -DJUDYL must be specified.
-#endif
-
-#ifdef JUDY1
-#include "Judy1.h"
-#else
-#include "JudyL.h"
-#endif
-
-#include "JudyPrivate1L.h"
-
-DBGCODE(extern void JudyCheckPop(Pvoid_t PArray);)
-
-
-// ****************************************************************************
-// J U D Y   1   F R E E   A R R A Y
-// J U D Y   L   F R E E   A R R A Y
-//
-// See the Judy*(3C) manual entry for details.
-//
-// This code is written recursively, at least at first, because thats much
-// simpler.  Hope its fast enough.
-
-#ifdef JUDY1
-FUNCTION Word_t Judy1FreeArray
-#else
-FUNCTION Word_t JudyLFreeArray
-#endif
-        (
-	PPvoid_t  PPArray,	// array to free.
-	PJError_t PJError	// optional, for returning error info.
-        )
-{
-	jpm_t	  jpm;		// local to accumulate free statistics.
-
-// CHECK FOR NULL POINTER (error by caller):
-
-	if (PPArray == (PPvoid_t) NULL)
-	{
-	    JU_SET_ERRNO(PJError, JU_ERRNO_NULLPPARRAY);
-	    return(JERR);
-	}
-
-	DBGCODE(JudyCheckPop(*PPArray);)
-
-// Zero jpm.jpm_Pop0 (meaning the array will be empty in a moment) for accurate
-// logging in TRACEMI2.
-
-	jpm.jpm_Pop0	      = 0;		// see above.
-	jpm.jpm_TotalMemWords = 0;		// initialize memory freed.
-
-// 	Empty array:
-
-	if (P_JLW(*PPArray) == (Pjlw_t) NULL) return(0);
-
-// PROCESS TOP LEVEL "JRP" BRANCHES AND LEAF:
-
-	if (JU_LEAFW_POP0(*PPArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW
-	{
-	    Pjlw_t Pjlw = P_JLW(*PPArray);	// first word of leaf.
-
-	    j__udyFreeJLW(Pjlw, Pjlw[0] + 1, &jpm);
-	    *PPArray = (Pvoid_t) NULL;		// make an empty array.
-	    return (-(jpm.jpm_TotalMemWords * cJU_BYTESPERWORD));  // see above.
-	}
-	else
-
-// Rootstate leaves:  just free the leaf:
-
-// Common code for returning the amount of memory freed.
-//
-// Note:  In a an ordinary LEAFW, pop0 = *PPArray[0].
-//
-// Accumulate (negative) words freed, while freeing objects.
-// Return the positive bytes freed.
-
-	{
-	    Pjpm_t Pjpm	    = P_JPM(*PPArray);
-	    Word_t TotalMem = Pjpm->jpm_TotalMemWords;
-
-	    j__udyFreeSM(&(Pjpm->jpm_JP), &jpm);  // recurse through tree.
-	    j__udyFreeJPM(Pjpm, &jpm);
-
-// Verify the array was not corrupt.  This means that amount of memory freed
-// (which is negative) is equal to the initial amount:
-
-	    if (TotalMem + jpm.jpm_TotalMemWords)
-	    {
-		JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
-		return(JERR);
-	    }
-
-	    *PPArray = (Pvoid_t) NULL;		// make an empty array.
-	    return (TotalMem * cJU_BYTESPERWORD);
-	}
-
-} // Judy1FreeArray() / JudyLFreeArray()
-
-
-// ****************************************************************************
-// __ J U D Y   F R E E   S M
-//
-// Given a pointer to a JP, recursively visit and free (depth first) all nodes
-// in a Judy array BELOW the JP, but not the JP itself.  Accumulate in *Pjpm
-// the total words freed (as a negative value).  "SM" = State Machine.
-//
-// Note:  Corruption is not detected at this level because during a FreeArray,
-// if the code hasnt already core dumped, its better to remain silent, even
-// if some memory has not been freed, than to bother the caller about the
-// corruption.  TBD:  Is this true?  If not, must list all legitimate JPNULL
-// and JPIMMED above first, and revert to returning bool_t (see 4.34).
-
-FUNCTION void j__udyFreeSM(
-	Pjp_t	Pjp,		// top of Judy (top-state).
-	Pjpm_t	Pjpm)		// to return words freed.
-{
-	Word_t	Pop1;
-
-	switch (JU_JPTYPE(Pjp))
-	{
-
-#ifdef JUDY1
-
-// FULL EXPANSE -- nothing to free  for this jp_Type.
-
-	case cJ1_JPFULLPOPU1:
-	    break;
-#endif
-
-// JUDY BRANCH -- free the sub-tree depth first:
-
-// LINEAR BRANCH -- visit each JP in the JBLs list, then free the JBL:
-//
-// Note:  There are no null JPs in a JBL.
-
-	case cJU_JPBRANCH_L:
-	case cJU_JPBRANCH_L2:
-	case cJU_JPBRANCH_L3:
-#ifdef JU_64BIT
-	case cJU_JPBRANCH_L4:
-	case cJU_JPBRANCH_L5:
-	case cJU_JPBRANCH_L6:
-	case cJU_JPBRANCH_L7:
-#endif // JU_64BIT
-	{
-	    Pjbl_t Pjbl = P_JBL(Pjp->jp_Addr);
-	    Word_t offset;
-
-	    for (offset = 0; offset < Pjbl->jbl_NumJPs; ++offset)
-	        j__udyFreeSM((Pjbl->jbl_jp) + offset, Pjpm);
-
-	    j__udyFreeJBL((Pjbl_t) (Pjp->jp_Addr), Pjpm);
-	    break;
-	}
-
-
-// BITMAP BRANCH -- visit each JP in the JBBs list based on the bitmap, also
-//
-// Note:  There are no null JPs in a JBB.
-
-	case cJU_JPBRANCH_B:
-	case cJU_JPBRANCH_B2:
-	case cJU_JPBRANCH_B3:
-#ifdef JU_64BIT
-	case cJU_JPBRANCH_B4:
-	case cJU_JPBRANCH_B5:
-	case cJU_JPBRANCH_B6:
-	case cJU_JPBRANCH_B7:
-#endif // JU_64BIT
-	{
-	    Word_t subexp;
-	    Word_t offset;
-	    Word_t jpcount;
-
-	    Pjbb_t Pjbb = P_JBB(Pjp->jp_Addr);
-
-	    for (subexp = 0; subexp < cJU_NUMSUBEXPB; ++subexp)
-	    {
-	        jpcount = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, subexp));
-
-	        if (jpcount)
-	        {
-		    for (offset = 0; offset < jpcount; ++offset)
-		    {
-		       j__udyFreeSM(P_JP(JU_JBB_PJP(Pjbb, subexp)) + offset,
-				    Pjpm);
-		    }
-		    j__udyFreeJBBJP(JU_JBB_PJP(Pjbb, subexp), jpcount, Pjpm);
-	        }
-	    }
-	    j__udyFreeJBB((Pjbb_t) (Pjp->jp_Addr), Pjpm);
-
-	    break;
-	}
-
-
-// UNCOMPRESSED BRANCH -- visit each JP in the JBU array, then free the JBU
-// itself:
-//
-// Note:  Null JPs are handled during recursion at a lower state.
-
-	case cJU_JPBRANCH_U:
-	case cJU_JPBRANCH_U2:
-	case cJU_JPBRANCH_U3:
-#ifdef JU_64BIT
-	case cJU_JPBRANCH_U4:
-	case cJU_JPBRANCH_U5:
-	case cJU_JPBRANCH_U6:
-	case cJU_JPBRANCH_U7:
-#endif // JU_64BIT
-	{
-	    Word_t offset;
-	    Pjbu_t Pjbu = P_JBU(Pjp->jp_Addr);
-
-	    for (offset = 0; offset < cJU_BRANCHUNUMJPS; ++offset)
-	        j__udyFreeSM((Pjbu->jbu_jp) + offset, Pjpm);
-
-	    j__udyFreeJBU((Pjbu_t) (Pjp->jp_Addr), Pjpm);
-	    break;
-	}
-
-
-// -- Cases below here terminate and do not recurse. --
-
-
-// LINEAR LEAF -- just free the leaf; size is computed from jp_Type:
-//
-// Note:  cJU_JPLEAF1 is a special case, see discussion in ../Judy1/Judy1.h
-
-#if (defined(JUDYL) || (! defined(JU_64BIT)))
-	case cJU_JPLEAF1:
-	    Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
-	    j__udyFreeJLL1((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
-	    break;
-#endif
-
-	case cJU_JPLEAF2:
-	    Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
-	    j__udyFreeJLL2((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
-	    break;
-
-	case cJU_JPLEAF3:
-	    Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
-	    j__udyFreeJLL3((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
-	    break;
-
-#ifdef JU_64BIT
-	case cJU_JPLEAF4:
-	    Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
-	    j__udyFreeJLL4((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
-	    break;
-
-	case cJU_JPLEAF5:
-	    Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
-	    j__udyFreeJLL5((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
-	    break;
-
-	case cJU_JPLEAF6:
-	    Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
-	    j__udyFreeJLL6((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
-	    break;
-
-	case cJU_JPLEAF7:
-	    Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
-	    j__udyFreeJLL7((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
-	    break;
-#endif // JU_64BIT
-
-
-// BITMAP LEAF -- free sub-expanse arrays of JPs, then free the JBB.
-
-	case cJU_JPLEAF_B1:
-	{
-#ifdef JUDYL
-	    Word_t subexp;
-	    Word_t jpcount;
-	    Pjlb_t Pjlb = P_JLB(Pjp->jp_Addr);
-
-// Free the value areas in the bitmap leaf:
-
-	    for (subexp = 0; subexp < cJU_NUMSUBEXPL; ++subexp)
-	    {
-	        jpcount = j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, subexp));
-
-	        if (jpcount)
-		    j__udyLFreeJV(JL_JLB_PVALUE(Pjlb, subexp), jpcount, Pjpm);
-	    }
-#endif // JUDYL
-
-	    j__udyFreeJLB1((Pjlb_t) (Pjp->jp_Addr), Pjpm);
-	    break;
-
-	} // case cJU_JPLEAF_B1
-
-#ifdef JUDYL
-
-
-// IMMED*:
-//
-// For JUDYL, all non JPIMMED_*_01s have a LeafV which must be freed:
-
-	case cJU_JPIMMED_1_02:
-	case cJU_JPIMMED_1_03:
-#ifdef JU_64BIT
-	case cJU_JPIMMED_1_04:
-	case cJU_JPIMMED_1_05:
-	case cJU_JPIMMED_1_06:
-	case cJU_JPIMMED_1_07:
-#endif
-	    Pop1 = JU_JPTYPE(Pjp) - cJU_JPIMMED_1_02 + 2;
-	    j__udyLFreeJV((Pjv_t) (Pjp->jp_Addr), Pop1, Pjpm);
-	    break;
-
-#ifdef JU_64BIT
-	case cJU_JPIMMED_2_02:
-	case cJU_JPIMMED_2_03:
-
-	    Pop1 = JU_JPTYPE(Pjp) - cJU_JPIMMED_2_02 + 2;
-	    j__udyLFreeJV((Pjv_t) (Pjp->jp_Addr), Pop1, Pjpm);
-	    break;
-
-	case cJU_JPIMMED_3_02:
-	    j__udyLFreeJV((Pjv_t) (Pjp->jp_Addr), 2, Pjpm);
-	    break;
-
-#endif // JU_64BIT
-#endif // JUDYL
-
-
-// OTHER JPNULL, JPIMMED, OR UNEXPECTED TYPE -- nothing to free for this type:
-//
-// Note:  Lump together no-op and invalid JP types; see function header
-// comments.
-
-	default: break;
-
-	} // switch (JU_JPTYPE(Pjp))
-
-} // j__udyFreeSM()
diff --git a/libs/klib/judy/JudyGet.c b/libs/klib/judy/JudyGet.c
deleted file mode 100644
index 5071a3f..0000000
--- a/libs/klib/judy/JudyGet.c
+++ /dev/null
@@ -1,1092 +0,0 @@
-// Copyright (C) 2000 - 2002 Hewlett-Packard Company
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the term of the GNU Lesser 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 Lesser General Public License
-// for more details.
-//
-// You should have received a copy of the GNU Lesser 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
-// _________________
-
-// Judy1Test() and JudyLGet() functions for Judy1 and JudyL.
-// Compile with one of -DJUDY1 or -DJUDYL.
-
-#if (! (defined(JUDY1) || defined(JUDYL)))
-#error:  One of -DJUDY1 or -DJUDYL must be specified.
-#endif
-
-#ifdef JUDY1
-#include "Judy1.h"
-#else
-#include "JudyL.h"
-#endif
-
-#include "JudyPrivate1L.h"
-
-#ifdef TRACEJPR                 // different macro name, for "retrieval" only.
-#include "JudyPrintJP.c"
-#endif
-
-
-// ****************************************************************************
-// J U D Y   1   T E S T
-// J U D Y   L   G E T
-//
-// See the manual entry for details.  Note support for "shortcut" entries to
-// trees known to start with a JPM.
-
-#ifdef JUDY1
-
-#ifdef JUDYGETINLINE
-FUNCTION int j__udy1Test
-#else
-FUNCTION int Judy1Test
-#endif
-
-#else  // JUDYL
-
-#ifdef JUDYGETINLINE
-FUNCTION PPvoid_t j__udyLGet
-#else
-FUNCTION PPvoid_t JudyLGet
-#endif
-
-#endif // JUDYL
-        (
-#ifdef JUDYGETINLINE
-        Pvoid_t   PArray,       // from which to retrieve.
-        Word_t    Index         // to retrieve.
-#else
-        Pcvoid_t  PArray,       // from which to retrieve.
-        Word_t    Index,        // to retrieve.
-        PJError_t PJError       // optional, for returning error info.
-#endif
-        )
-{
-        Pjp_t     Pjp;          // current JP while walking the tree.
-        Pjpm_t    Pjpm;         // for global accounting.
-        uint8_t   Digit;        // byte just decoded from Index.
-        Word_t    Pop1;         // leaf population (number of indexes).
-        Pjll_t    Pjll;         // pointer to LeafL.
-        DBGCODE(uint8_t ParentJPType;)
-
-#ifndef JUDYGETINLINE
-
-        if (PArray == (Pcvoid_t) NULL)  // empty array.
-        {
-  JUDY1CODE(return(0);)
-  JUDYLCODE(return((PPvoid_t) NULL);)
-        }
-
-// ****************************************************************************
-// PROCESS TOP LEVEL BRANCHES AND LEAF:
-
-        if (JU_LEAFW_POP0(PArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW
-        {
-            Pjlw_t Pjlw = P_JLW(PArray);        // first word of leaf.
-            int    posidx;                      // signed offset in leaf.
-
-            Pop1   = Pjlw[0] + 1;
-            posidx = j__udySearchLeafW(Pjlw + 1, Pop1, Index);
-
-            if (posidx >= 0)
-            {
-      JUDY1CODE(return(1);)
-      JUDYLCODE(return((PPvoid_t) (JL_LEAFWVALUEAREA(Pjlw, Pop1) + posidx));)
-            }
-  JUDY1CODE(return(0);)
-  JUDYLCODE(return((PPvoid_t) NULL);)
-        }
-
-#endif // ! JUDYGETINLINE
-
-        Pjpm = P_JPM(PArray);
-        Pjp = &(Pjpm->jpm_JP);  // top branch is below JPM.
-
-// ****************************************************************************
-// WALK THE JUDY TREE USING A STATE MACHINE:
-
-ContinueWalk:           // for going down one level; come here with Pjp set.
-
-#ifdef TRACEJPR
-        JudyPrintJP(Pjp, "g", __LINE__);
-#endif
-        switch (JU_JPTYPE(Pjp))
-        {
-
-// Ensure the switch table starts at 0 for speed; otherwise more code is
-// executed:
-
-        case 0: goto ReturnCorrupt;     // save a little code.
-
-
-// ****************************************************************************
-// JPNULL*:
-//
-// Note:  These are legitimate in a BranchU (only) and do not constitute a
-// fault.
-
-        case cJU_JPNULL1:
-        case cJU_JPNULL2:
-        case cJU_JPNULL3:
-#ifdef JU_64BIT
-        case cJU_JPNULL4:
-        case cJU_JPNULL5:
-        case cJU_JPNULL6:
-        case cJU_JPNULL7:
-#endif
-            assert(ParentJPType >= cJU_JPBRANCH_U2);
-            assert(ParentJPType <= cJU_JPBRANCH_U);
-      JUDY1CODE(return(0);)
-      JUDYLCODE(return((PPvoid_t) NULL);)
-
-
-// ****************************************************************************
-// JPBRANCH_L*:
-//
-// Note:  The use of JU_DCDNOTMATCHINDEX() in branches is not strictly
-// required,since this can be done at leaf level, but it costs nothing to do it
-// sooner, and it aborts an unnecessary traversal sooner.
-
-        case cJU_JPBRANCH_L2:
-
-            if (JU_DCDNOTMATCHINDEX(Index, Pjp, 2)) break;
-            Digit = JU_DIGITATSTATE(Index, 2);
-            goto JudyBranchL;
-
-        case cJU_JPBRANCH_L3:
-
-#ifdef JU_64BIT // otherwise its a no-op:
-            if (JU_DCDNOTMATCHINDEX(Index, Pjp, 3)) break;
-#endif
-            Digit = JU_DIGITATSTATE(Index, 3);
-            goto JudyBranchL;
-
-#ifdef JU_64BIT
-        case cJU_JPBRANCH_L4:
-
-            if (JU_DCDNOTMATCHINDEX(Index, Pjp, 4)) break;
-            Digit = JU_DIGITATSTATE(Index, 4);
-            goto JudyBranchL;
-
-        case cJU_JPBRANCH_L5:
-
-            if (JU_DCDNOTMATCHINDEX(Index, Pjp, 5)) break;
-            Digit = JU_DIGITATSTATE(Index, 5);
-            goto JudyBranchL;
-
-        case cJU_JPBRANCH_L6:
-
-            if (JU_DCDNOTMATCHINDEX(Index, Pjp, 6)) break;
-            Digit = JU_DIGITATSTATE(Index, 6);
-            goto JudyBranchL;
-
-        case cJU_JPBRANCH_L7:
-
-            // JU_DCDNOTMATCHINDEX() would be a no-op.
-            Digit = JU_DIGITATSTATE(Index, 7);
-            goto JudyBranchL;
-
-#endif // JU_64BIT
-
-        case cJU_JPBRANCH_L:
-        {
-            Pjbl_t Pjbl;
-            int    posidx;
-
-            Digit = JU_DIGITATSTATE(Index, cJU_ROOTSTATE);
-
-// Common code for all BranchLs; come here with Digit set:
-
-JudyBranchL:
-            Pjbl = P_JBL(Pjp->jp_Addr);
-
-            posidx = 0;
-
-            do {
-                if (Pjbl->jbl_Expanse[posidx] == Digit)
-                {                       // found Digit; continue traversal:
-                    DBGCODE(ParentJPType = JU_JPTYPE(Pjp);)
-                    Pjp = Pjbl->jbl_jp + posidx;
-                    goto ContinueWalk;
-                }
-            } while (++posidx != Pjbl->jbl_NumJPs);
-
-            break;
-        }
-
-
-// ****************************************************************************
-// JPBRANCH_B*:
-
-        case cJU_JPBRANCH_B2:
-
-            if (JU_DCDNOTMATCHINDEX(Index, Pjp, 2)) break;
-            Digit = JU_DIGITATSTATE(Index, 2);
-            goto JudyBranchB;
-
-        case cJU_JPBRANCH_B3:
-
-#ifdef JU_64BIT // otherwise its a no-op:
-            if (JU_DCDNOTMATCHINDEX(Index, Pjp, 3)) break;
-#endif
-            Digit = JU_DIGITATSTATE(Index, 3);
-            goto JudyBranchB;
-
-
-#ifdef JU_64BIT
-        case cJU_JPBRANCH_B4:
-
-            if (JU_DCDNOTMATCHINDEX(Index, Pjp, 4)) break;
-            Digit = JU_DIGITATSTATE(Index, 4);
-            goto JudyBranchB;
-
-        case cJU_JPBRANCH_B5:
-
-            if (JU_DCDNOTMATCHINDEX(Index, Pjp, 5)) break;
-            Digit = JU_DIGITATSTATE(Index, 5);
-            goto JudyBranchB;
-
-        case cJU_JPBRANCH_B6:
-
-            if (JU_DCDNOTMATCHINDEX(Index, Pjp, 6)) break;
-            Digit = JU_DIGITATSTATE(Index, 6);
-            goto JudyBranchB;
-
-        case cJU_JPBRANCH_B7:
-
-            // JU_DCDNOTMATCHINDEX() would be a no-op.
-            Digit = JU_DIGITATSTATE(Index, 7);
-            goto JudyBranchB;
-
-#endif // JU_64BIT
-
-        case cJU_JPBRANCH_B:
-        {
-            Pjbb_t    Pjbb;
-            Word_t    subexp;   // in bitmap, 0..7.
-            BITMAPB_t BitMap;   // for one subexpanse.
-            BITMAPB_t BitMask;  // bit in BitMap for Indexs Digit.
-
-            Digit = JU_DIGITATSTATE(Index, cJU_ROOTSTATE);
-
-// Common code for all BranchBs; come here with Digit set:
-
-JudyBranchB:
-            DBGCODE(ParentJPType = JU_JPTYPE(Pjp);)
-            Pjbb   = P_JBB(Pjp->jp_Addr);
-            subexp = Digit / cJU_BITSPERSUBEXPB;
-
-            BitMap = JU_JBB_BITMAP(Pjbb, subexp);
-            Pjp    = P_JP(JU_JBB_PJP(Pjbb, subexp));
-
-            BitMask = JU_BITPOSMASKB(Digit);
-
-// No JP in subexpanse for Index => Index not found:
-
-            if (! (BitMap & BitMask)) break;
-
-// Count JPs in the subexpanse below the one for Index:
-
-            Pjp += j__udyCountBitsB(BitMap & (BitMask - 1));
-
-            goto ContinueWalk;
-
-        } // case cJU_JPBRANCH_B*
-
-
-// ****************************************************************************
-// JPBRANCH_U*:
-//
-// Notice the reverse order of the cases, and falling through to the next case,
-// for performance.
-
-        case cJU_JPBRANCH_U:
-
-            DBGCODE(ParentJPType = JU_JPTYPE(Pjp);)
-            Pjp = JU_JBU_PJP(Pjp, Index, cJU_ROOTSTATE);
-
-// If not a BranchU, traverse; otherwise fall into the next case, which makes
-// this very fast code for a large Judy array (mainly BranchUs), especially
-// when branches are already in the cache, such as for prev/next:
-
-#ifndef JU_64BIT
-            if (JU_JPTYPE(Pjp) != cJU_JPBRANCH_U3) goto ContinueWalk;
-#else
-            if (JU_JPTYPE(Pjp) != cJU_JPBRANCH_U7) goto ContinueWalk;
-#endif
-
-#ifdef JU_64BIT
-        case cJU_JPBRANCH_U7:
-
-            // JU_DCDNOTMATCHINDEX() would be a no-op.
-            DBGCODE(ParentJPType = JU_JPTYPE(Pjp);)
-            Pjp = JU_JBU_PJP(Pjp, Index, 7);
-
-            if (JU_JPTYPE(Pjp) != cJU_JPBRANCH_U6) goto ContinueWalk;
-            // and fall through.
-
-        case cJU_JPBRANCH_U6:
-
-            if (JU_DCDNOTMATCHINDEX(Index, Pjp, 6)) break;
-            DBGCODE(ParentJPType = JU_JPTYPE(Pjp);)
-            Pjp = JU_JBU_PJP(Pjp, Index, 6);
-
-            if (JU_JPTYPE(Pjp) != cJU_JPBRANCH_U5) goto ContinueWalk;
-            // and fall through.
-
-        case cJU_JPBRANCH_U5:
-
-            if (JU_DCDNOTMATCHINDEX(Index, Pjp, 5)) break;
-            DBGCODE(ParentJPType = JU_JPTYPE(Pjp);)
-            Pjp = JU_JBU_PJP(Pjp, Index, 5);
-
-            if (JU_JPTYPE(Pjp) != cJU_JPBRANCH_U4) goto ContinueWalk;
-            // and fall through.
-
-        case cJU_JPBRANCH_U4:
-
-            if (JU_DCDNOTMATCHINDEX(Index, Pjp, 4)) break;
-            DBGCODE(ParentJPType = JU_JPTYPE(Pjp);)
-            Pjp = JU_JBU_PJP(Pjp, Index, 4);
-
-            if (JU_JPTYPE(Pjp) != cJU_JPBRANCH_U3) goto ContinueWalk;
-            // and fall through.
-
-#endif // JU_64BIT
-
-        case cJU_JPBRANCH_U3:
-
-#ifdef JU_64BIT // otherwise its a no-op:
-            if (JU_DCDNOTMATCHINDEX(Index, Pjp, 3)) break;
-#endif
-            DBGCODE(ParentJPType = JU_JPTYPE(Pjp);)
-            Pjp = JU_JBU_PJP(Pjp, Index, 3);
-
-            if (JU_JPTYPE(Pjp) != cJU_JPBRANCH_U2) goto ContinueWalk;
-            // and fall through.
-
-        case cJU_JPBRANCH_U2:
-
-            if (JU_DCDNOTMATCHINDEX(Index, Pjp, 2)) break;
-            DBGCODE(ParentJPType = JU_JPTYPE(Pjp);)
-            Pjp = JU_JBU_PJP(Pjp, Index, 2);
-
-// Note:  BranchU2 is a special case that must continue traversal to a leaf,
-// immed, full, or null type:
-
-            goto ContinueWalk;
-
-
-// ****************************************************************************
-// JPLEAF*:
-//
-// Note:  Here the calls of JU_DCDNOTMATCHINDEX() are necessary and check
-// whether Index is out of the expanse of a narrow pointer.
-
-#if (defined(JUDYL) || (! defined(JU_64BIT)))
-
-        case cJU_JPLEAF1:
-        {
-            int posidx;         // signed offset in leaf.
-
-            if (JU_DCDNOTMATCHINDEX(Index, Pjp, 1)) break;
-
-            Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
-            Pjll = P_JLL(Pjp->jp_Addr);
-
-            if ((posidx = j__udySearchLeaf1(Pjll, Pop1, Index)) < 0) break;
-
-  JUDY1CODE(return(1);)
-  JUDYLCODE(return((PPvoid_t) (JL_LEAF1VALUEAREA(Pjll, Pop1) + posidx));)
-        }
-
-#endif // (JUDYL || (! JU_64BIT))
-
-        case cJU_JPLEAF2:
-        {
-            int posidx;         // signed offset in leaf.
-
-            if (JU_DCDNOTMATCHINDEX(Index, Pjp, 2)) break;
-
-            Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
-            Pjll = P_JLL(Pjp->jp_Addr);
-
-            if ((posidx = j__udySearchLeaf2(Pjll, Pop1, Index)) < 0) break;
-
-  JUDY1CODE(return(1);)
-  JUDYLCODE(return((PPvoid_t) (JL_LEAF2VALUEAREA(Pjll, Pop1) + posidx));)
-        }
-        case cJU_JPLEAF3:
-        {
-            int posidx;         // signed offset in leaf.
-
-#ifdef JU_64BIT // otherwise its a no-op:
-            if (JU_DCDNOTMATCHINDEX(Index, Pjp, 3)) break;
-#endif
-
-            Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
-            Pjll = P_JLL(Pjp->jp_Addr);
-
-            if ((posidx = j__udySearchLeaf3(Pjll, Pop1, Index)) < 0) break;
-
-  JUDY1CODE(return(1);)
-  JUDYLCODE(return((PPvoid_t) (JL_LEAF3VALUEAREA(Pjll, Pop1) + posidx));)
-        }
-#ifdef JU_64BIT
-        case cJU_JPLEAF4:
-        {
-            int posidx;         // signed offset in leaf.
-
-            if (JU_DCDNOTMATCHINDEX(Index, Pjp, 4)) break;
-
-            Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
-            Pjll = P_JLL(Pjp->jp_Addr);
-
-            if ((posidx = j__udySearchLeaf4(Pjll, Pop1, Index)) < 0) break;
-
-  JUDY1CODE(return(1);)
-  JUDYLCODE(return((PPvoid_t) (JL_LEAF4VALUEAREA(Pjll, Pop1) + posidx));)
-        }
-        case cJU_JPLEAF5:
-        {
-            int posidx;         // signed offset in leaf.
-
-            if (JU_DCDNOTMATCHINDEX(Index, Pjp, 5)) break;
-
-            Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
-            Pjll = P_JLL(Pjp->jp_Addr);
-
-            if ((posidx = j__udySearchLeaf5(Pjll, Pop1, Index)) < 0) break;
-
-  JUDY1CODE(return(1);)
-  JUDYLCODE(return((PPvoid_t) (JL_LEAF5VALUEAREA(Pjll, Pop1) + posidx));)
-        }
-
-        case cJU_JPLEAF6:
-        {
-            int posidx;         // signed offset in leaf.
-
-            if (JU_DCDNOTMATCHINDEX(Index, Pjp, 6)) break;
-
-            Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
-            Pjll = P_JLL(Pjp->jp_Addr);
-
-            if ((posidx = j__udySearchLeaf6(Pjll, Pop1, Index)) < 0) break;
-
-  JUDY1CODE(return(1);)
-  JUDYLCODE(return((PPvoid_t) (JL_LEAF6VALUEAREA(Pjll, Pop1) + posidx));)
-        }
-        case cJU_JPLEAF7:
-        {
-            int posidx;         // signed offset in leaf.
-
-            // JU_DCDNOTMATCHINDEX() would be a no-op.
-            Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
-            Pjll = P_JLL(Pjp->jp_Addr);
-
-            if ((posidx = j__udySearchLeaf7(Pjll, Pop1, Index)) < 0) break;
-
-  JUDY1CODE(return(1);)
-  JUDYLCODE(return((PPvoid_t) (JL_LEAF7VALUEAREA(Pjll, Pop1) + posidx));)
-        }
-#endif // JU_64BIT
-
-
-// ****************************************************************************
-// JPLEAF_B1:
-
-        case cJU_JPLEAF_B1:
-        {
-            Pjlb_t    Pjlb;
-#ifdef JUDYL
-            int       posidx;
-            Word_t    subexp;   // in bitmap, 0..7.
-            BITMAPL_t BitMap;   // for one subexpanse.
-            BITMAPL_t BitMask;  // bit in BitMap for Indexs Digit.
-            Pjv_t     Pjv;
-#endif
-            if (JU_DCDNOTMATCHINDEX(Index, Pjp, 1)) break;
-
-            Pjlb = P_JLB(Pjp->jp_Addr);
-
-#ifdef JUDY1
-
-// Simply check if Indexs bit is set in the bitmap:
-
-            if (JU_BITMAPTESTL(Pjlb, Index)) return(1);
-            break;
-
-#else // JUDYL
-
-// JudyL is much more complicated because of value area subarrays:
-
-            Digit   = JU_DIGITATSTATE(Index, 1);
-            subexp  = Digit / cJU_BITSPERSUBEXPL;
-            BitMap  = JU_JLB_BITMAP(Pjlb, subexp);
-            BitMask = JU_BITPOSMASKL(Digit);
-
-// No value in subexpanse for Index => Index not found:
-
-            if (! (BitMap & BitMask)) break;
-
-// Count value areas in the subexpanse below the one for Index:
-
-            Pjv = P_JV(JL_JLB_PVALUE(Pjlb, subexp));
-            assert(Pjv != (Pjv_t) NULL);
-            posidx = j__udyCountBitsL(BitMap & (BitMask - 1));
-
-            return((PPvoid_t) (Pjv + posidx));
-
-#endif // JUDYL
-
-        } // case cJU_JPLEAF_B1
-
-#ifdef JUDY1
-
-// ****************************************************************************
-// JPFULLPOPU1:
-//
-// If the Index is in the expanse, it is necessarily valid (found).
-
-        case cJ1_JPFULLPOPU1:
-
-            if (JU_DCDNOTMATCHINDEX(Index, Pjp, 1)) break;
-            return(1);
-
-#ifdef notdef // for future enhancements
-#ifdef JU_64BIT
-
-// Note: Need ? if (JU_DCDNOTMATCHINDEX(Index, Pjp, 1)) break;
-
-        case cJ1_JPFULLPOPU1m15:
-            if (Pjp->jp_1Index[14] == (uint8_t)Index) break;
-        case cJ1_JPFULLPOPU1m14:
-            if (Pjp->jp_1Index[13] == (uint8_t)Index) break;
-        case cJ1_JPFULLPOPU1m13:
-            if (Pjp->jp_1Index[12] == (uint8_t)Index) break;
-        case cJ1_JPFULLPOPU1m12:
-            if (Pjp->jp_1Index[11] == (uint8_t)Index) break;
-        case cJ1_JPFULLPOPU1m11:
-            if (Pjp->jp_1Index[10] == (uint8_t)Index) break;
-        case cJ1_JPFULLPOPU1m10:
-            if (Pjp->jp_1Index[9] == (uint8_t)Index) break;
-        case cJ1_JPFULLPOPU1m9:
-            if (Pjp->jp_1Index[8] == (uint8_t)Index) break;
-        case cJ1_JPFULLPOPU1m8:
-            if (Pjp->jp_1Index[7] == (uint8_t)Index) break;
-#endif
-        case cJ1_JPFULLPOPU1m7:
-            if (Pjp->jp_1Index[6] == (uint8_t)Index) break;
-        case cJ1_JPFULLPOPU1m6:
-            if (Pjp->jp_1Index[5] == (uint8_t)Index) break;
-        case cJ1_JPFULLPOPU1m5:
-            if (Pjp->jp_1Index[4] == (uint8_t)Index) break;
-        case cJ1_JPFULLPOPU1m4:
-            if (Pjp->jp_1Index[3] == (uint8_t)Index) break;
-        case cJ1_JPFULLPOPU1m3:
-            if (Pjp->jp_1Index[2] == (uint8_t)Index) break;
-        case cJ1_JPFULLPOPU1m2:
-            if (Pjp->jp_1Index[1] == (uint8_t)Index) break;
-        case cJ1_JPFULLPOPU1m1:
-            if (Pjp->jp_1Index[0] == (uint8_t)Index) break;
-
-            return(1);  // found, not in exclusion list
-
-#endif // JUDY1
-#endif //  notdef
-
-// ****************************************************************************
-// JPIMMED*:
-//
-// Note that the contents of jp_DcdPopO are different for cJU_JPIMMED_*_01:
-
-        case cJU_JPIMMED_1_01:
-        case cJU_JPIMMED_2_01:
-        case cJU_JPIMMED_3_01:
-#ifdef JU_64BIT
-        case cJU_JPIMMED_4_01:
-        case cJU_JPIMMED_5_01:
-        case cJU_JPIMMED_6_01:
-        case cJU_JPIMMED_7_01:
-#endif
-            if (JU_JPDCDPOP0(Pjp) != JU_TRIMTODCDSIZE(Index)) break;
-
-  JUDY1CODE(return(1);)
-  JUDYLCODE(return((PPvoid_t) &(Pjp->jp_Addr));)  // immediate value area.
-
-
-//   Macros to make code more readable and avoid dup errors
-
-#ifdef JUDY1
-
-#define CHECKINDEXNATIVE(LEAF_T, PJP, IDX, INDEX)                       \
-if (((LEAF_T *)((PJP)->jp_1Index))[(IDX) - 1] == (LEAF_T)(INDEX))       \
-    return(1)
-
-#define CHECKLEAFNONNAT(LFBTS, PJP, INDEX, IDX, COPY)                   \
-{                                                                       \
-    Word_t   i_ndex;                                                    \
-    uint8_t *a_ddr;                                                     \
-    a_ddr  = (PJP)->jp_1Index + (((IDX) - 1) * (LFBTS));                \
-    COPY(i_ndex, a_ddr);                                                \
-    if (i_ndex == JU_LEASTBYTES((INDEX), (LFBTS)))                      \
-        return(1);                                                      \
-}
-#endif
-
-#ifdef JUDYL
-
-#define CHECKINDEXNATIVE(LEAF_T, PJP, IDX, INDEX)                       \
-if (((LEAF_T *)((PJP)->jp_LIndex))[(IDX) - 1] == (LEAF_T)(INDEX))       \
-        return((PPvoid_t)(P_JV((PJP)->jp_Addr) + (IDX) - 1))
-
-#define CHECKLEAFNONNAT(LFBTS, PJP, INDEX, IDX, COPY)                   \
-{                                                                       \
-    Word_t   i_ndex;                                                    \
-    uint8_t *a_ddr;                                                     \
-    a_ddr  = (PJP)->jp_LIndex + (((IDX) - 1) * (LFBTS));                \
-    COPY(i_ndex, a_ddr);                                                \
-    if (i_ndex == JU_LEASTBYTES((INDEX), (LFBTS)))                      \
-        return((PPvoid_t)(P_JV((PJP)->jp_Addr) + (IDX) - 1));           \
-}
-#endif
-
-#if (defined(JUDY1) && defined(JU_64BIT))
-        case cJ1_JPIMMED_1_15: CHECKINDEXNATIVE(uint8_t, Pjp, 15, Index);
-        case cJ1_JPIMMED_1_14: CHECKINDEXNATIVE(uint8_t, Pjp, 14, Index);
-        case cJ1_JPIMMED_1_13: CHECKINDEXNATIVE(uint8_t, Pjp, 13, Index);
-        case cJ1_JPIMMED_1_12: CHECKINDEXNATIVE(uint8_t, Pjp, 12, Index);
-        case cJ1_JPIMMED_1_11: CHECKINDEXNATIVE(uint8_t, Pjp, 11, Index);
-        case cJ1_JPIMMED_1_10: CHECKINDEXNATIVE(uint8_t, Pjp, 10, Index);
-        case cJ1_JPIMMED_1_09: CHECKINDEXNATIVE(uint8_t, Pjp,  9, Index);
-        case cJ1_JPIMMED_1_08: CHECKINDEXNATIVE(uint8_t, Pjp,  8, Index);
-#endif
-#if (defined(JUDY1) || defined(JU_64BIT))
-        case cJU_JPIMMED_1_07: CHECKINDEXNATIVE(uint8_t, Pjp,  7, Index);
-        case cJU_JPIMMED_1_06: CHECKINDEXNATIVE(uint8_t, Pjp,  6, Index);
-        case cJU_JPIMMED_1_05: CHECKINDEXNATIVE(uint8_t, Pjp,  5, Index);
-        case cJU_JPIMMED_1_04: CHECKINDEXNATIVE(uint8_t, Pjp,  4, Index);
-#endif
-        case cJU_JPIMMED_1_03: CHECKINDEXNATIVE(uint8_t, Pjp,  3, Index);
-        case cJU_JPIMMED_1_02: CHECKINDEXNATIVE(uint8_t, Pjp,  2, Index);
-                               CHECKINDEXNATIVE(uint8_t, Pjp,  1, Index);
-        break;
-
-#if (defined(JUDY1) && defined(JU_64BIT))
-        case cJ1_JPIMMED_2_07: CHECKINDEXNATIVE(uint16_t, Pjp, 7, Index);
-        case cJ1_JPIMMED_2_06: CHECKINDEXNATIVE(uint16_t, Pjp, 6, Index);
-        case cJ1_JPIMMED_2_05: CHECKINDEXNATIVE(uint16_t, Pjp, 5, Index);
-        case cJ1_JPIMMED_2_04: CHECKINDEXNATIVE(uint16_t, Pjp, 4, Index);
-#endif
-#if (defined(JUDY1) || defined(JU_64BIT))
-        case cJU_JPIMMED_2_03: CHECKINDEXNATIVE(uint16_t, Pjp, 3, Index);
-        case cJU_JPIMMED_2_02: CHECKINDEXNATIVE(uint16_t, Pjp, 2, Index);
-                               CHECKINDEXNATIVE(uint16_t, Pjp, 1, Index);
-        break;
-#endif
-
-#if (defined(JUDY1) && defined(JU_64BIT))
-        case cJ1_JPIMMED_3_05: 
-            CHECKLEAFNONNAT(3, Pjp, Index, 5, JU_COPY3_PINDEX_TO_LONG);
-        case cJ1_JPIMMED_3_04:
-            CHECKLEAFNONNAT(3, Pjp, Index, 4, JU_COPY3_PINDEX_TO_LONG);
-        case cJ1_JPIMMED_3_03:
-            CHECKLEAFNONNAT(3, Pjp, Index, 3, JU_COPY3_PINDEX_TO_LONG);
-#endif
-#if (defined(JUDY1) || defined(JU_64BIT))
-        case cJU_JPIMMED_3_02:
-            CHECKLEAFNONNAT(3, Pjp, Index, 2, JU_COPY3_PINDEX_TO_LONG);
-            CHECKLEAFNONNAT(3, Pjp, Index, 1, JU_COPY3_PINDEX_TO_LONG);
-            break;
-#endif
-
-#if (defined(JUDY1) && defined(JU_64BIT))
-
-        case cJ1_JPIMMED_4_03: CHECKINDEXNATIVE(uint32_t, Pjp, 3, Index);
-        case cJ1_JPIMMED_4_02: CHECKINDEXNATIVE(uint32_t, Pjp, 2, Index);
-                               CHECKINDEXNATIVE(uint32_t, Pjp, 1, Index);
-            break;
-
-        case cJ1_JPIMMED_5_03:
-            CHECKLEAFNONNAT(5, Pjp, Index, 3, JU_COPY5_PINDEX_TO_LONG);
-        case cJ1_JPIMMED_5_02:
-            CHECKLEAFNONNAT(5, Pjp, Index, 2, JU_COPY5_PINDEX_TO_LONG);
-            CHECKLEAFNONNAT(5, Pjp, Index, 1, JU_COPY5_PINDEX_TO_LONG);
-            break;
-
-        case cJ1_JPIMMED_6_02:
-            CHECKLEAFNONNAT(6, Pjp, Index, 2, JU_COPY6_PINDEX_TO_LONG);
-            CHECKLEAFNONNAT(6, Pjp, Index, 1, JU_COPY6_PINDEX_TO_LONG);
-            break;
-
-        case cJ1_JPIMMED_7_02:
-            CHECKLEAFNONNAT(7, Pjp, Index, 2, JU_COPY7_PINDEX_TO_LONG);
-            CHECKLEAFNONNAT(7, Pjp, Index, 1, JU_COPY7_PINDEX_TO_LONG);
-            break;
-
-#endif // (JUDY1 && JU_64BIT)
-
-
-// ****************************************************************************
-// INVALID JP TYPE:
-
-        default:
-
-ReturnCorrupt:
-
-#ifdef JUDYGETINLINE    // Pjpm is known to be non-null:
-            JU_SET_ERRNO_NONNULL(Pjpm, JU_ERRNO_CORRUPT);
-#else
-            JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
-#endif
-            JUDY1CODE(return(JERRI );)
-            JUDYLCODE(return(PPJERR);)
-
-        } // switch on JP type
-
-JUDY1CODE(return(0);)
-JUDYLCODE(return((PPvoid_t) NULL);)
-
-} // Judy1Test() / JudyLGet()
-
-
-#ifndef JUDYGETINLINE   // only compile the following function once:
-#ifdef DEBUG
-
-// ****************************************************************************
-// J U D Y   C H E C K   P O P
-//
-// Given a pointer to a Judy array, traverse the entire array to ensure
-// population counts add up correctly.  This can catch various coding errors.
-//
-// Since walking the entire tree is probably time-consuming, enable this
-// function by setting env parameter $CHECKPOP to first call at which to start
-// checking.  Note:  This function is called both from insert and delete code.
-//
-// Note:  Even though this function does nothing useful for LEAFW leaves, its
-// good practice to call it anyway, and cheap too.
-//
-// TBD:  This is a debug-only check function similar to JudyCheckSorted(), but
-// since it walks the tree it is Judy1/JudyL-specific and must live in a source
-// file that is built both ways.
-//
-// TBD:  As feared, enabling this code for every insert/delete makes Judy
-// deathly slow, even for a small tree (10K indexes).  Its not so bad if
-// present but disabled (<1% slowdown measured).  Still, should it be ifdefd
-// other than DEBUG and/or called less often?
-//
-// TBD:  Should this "population checker" be expanded to a comprehensive tree
-// checker?  It currently detects invalid LEAFW/JP types as well as inconsistent
-// pop1s.  Other possible checks, all based on essentially redundant data in
-// the Judy tree, include:
-//
-// - Zero LS bits in jp_Addr field.
-//
-// - Correct Dcd bits.
-//
-// - Consistent JP types (always descending down the tree).
-//
-// - Sorted linear lists in BranchLs and leaves (using JudyCheckSorted(), but
-//   ideally that function is already called wherever appropriate after any
-//   linear list is modified).
-//
-// - Any others possible?
-
-#include <stdlib.h>             // for getenv() and atol().
-
-static Word_t JudyCheckPopSM(Pjp_t Pjp, Word_t RootPop1);
-
-FUNCTION void JudyCheckPop(
-        Pvoid_t PArray)
-{
-static  bool_t  checked = FALSE;        // already checked env parameter.
-static  bool_t  enabled = FALSE;        // env parameter set.
-static  bool_t  active  = FALSE;        // calls >= callsmin.
-static  Word_t  callsmin;               // start point from $CHECKPOP.
-static  Word_t  calls = 0;              // times called so far.
-
-
-// CHECK FOR EXTERNAL ENABLING:
-
-        if (! checked)                  // only check once.
-        {
-            char * value;               // for getenv().
-
-            checked = TRUE;
-
-            if ((value = getenv("CHECKPOP")) == (char *) NULL)
-            {
-#ifdef notdef
-// Take this out because nightly tests want to be flavor-independent; its not
-// OK to emit special non-error output from the debug flavor:
-
-                (void) puts("JudyCheckPop() present but not enabled by "
-                            "$CHECKPOP env parameter; set it to the number of "
-                            "calls at which to begin checking");
-#endif
-                return;
-            }
-
-            callsmin = atol(value);     // note: non-number evaluates to 0.
-            enabled  = TRUE;
-
-            (void) printf("JudyCheckPop() present and enabled; callsmin = "
-                          "%lu\n", callsmin);
-        }
-        else if (! enabled) return;
-
-// Previously or just now enabled; check if non-active or newly active:
-
-        if (! active)
-        {
-            if (++calls < callsmin) return;
-
-            (void) printf("JudyCheckPop() activated at call %lu\n", calls);
-            active = TRUE;
-        }
-
-// IGNORE LEAFW AT TOP OF TREE:
-
-        if (JU_LEAFW_POP0(PArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW
-                return;
-
-// Check JPM pop0 against tree, recursively:
-//
-// Note:  The traversal code in JudyCheckPopSM() is simplest when the case
-// statement for each JP type compares the pop1 for that JP to its subtree (if
-// any) after traversing the subtree (thats the hard part) and adding up
-// actual pop1s.  A top branchs JP in the JPM does not have room for a
-// full-word pop1, so pass it in as a special case.
-
-        {
-            Pjpm_t Pjpm = P_JPM(PArray);
-            (void) JudyCheckPopSM(&(Pjpm->jpm_JP), Pjpm->jpm_Pop0 + 1);
-            return;
-        }
-
-} // JudyCheckPop()
-
-
-// ****************************************************************************
-// J U D Y   C H E C K   P O P   S M
-//
-// Recursive state machine (subroutine) for JudyCheckPop():  Given a Pjp (other
-// than JPNULL*; caller should shortcut) and the root population for top-level
-// branches, check the subtrees actual pop1 against its nominal value, and
-// return the total pop1 for the subtree.
-//
-// Note:  Expect RootPop1 to be ignored at lower levels, so pass down 0, which
-// should pop an assertion if this expectation is violated.
-
-FUNCTION static Word_t JudyCheckPopSM(
-        Pjp_t  Pjp,             // top of subtree.
-        Word_t RootPop1)        // whole array, for top-level branches only.
-{
-        Word_t pop1_jp;         // nominal population from the JP.
-        Word_t pop1 = 0;        // actual population at this level.
-        Word_t offset;          // in a branch.
-
-#define PREPBRANCH(cPopBytes,Next) \
-        pop1_jp = JU_JPBRANCH_POP0(Pjp, cPopBytes) + 1; goto Next
-
-assert((((Word_t) (Pjp->jp_Addr)) & 7) == 3);
-        switch (JU_JPTYPE(Pjp))
-        {
-
-        case cJU_JPBRANCH_L2: PREPBRANCH(2, BranchL);
-        case cJU_JPBRANCH_L3: PREPBRANCH(3, BranchL);
-#ifdef JU_64BIT
-        case cJU_JPBRANCH_L4: PREPBRANCH(4, BranchL);
-        case cJU_JPBRANCH_L5: PREPBRANCH(5, BranchL);
-        case cJU_JPBRANCH_L6: PREPBRANCH(6, BranchL);
-        case cJU_JPBRANCH_L7: PREPBRANCH(7, BranchL);
-#endif
-        case cJU_JPBRANCH_L:  pop1_jp = RootPop1;
-        {
-            Pjbl_t Pjbl;
-BranchL:
-            Pjbl = P_JBL(Pjp->jp_Addr);
-
-            for (offset = 0; offset < (Pjbl->jbl_NumJPs); ++offset)
-                pop1 += JudyCheckPopSM((Pjbl->jbl_jp) + offset, 0);
-
-            assert(pop1_jp == pop1);
-            return(pop1);
-        }
-
-        case cJU_JPBRANCH_B2: PREPBRANCH(2, BranchB);
-        case cJU_JPBRANCH_B3: PREPBRANCH(3, BranchB);
-#ifdef JU_64BIT
-        case cJU_JPBRANCH_B4: PREPBRANCH(4, BranchB);
-        case cJU_JPBRANCH_B5: PREPBRANCH(5, BranchB);
-        case cJU_JPBRANCH_B6: PREPBRANCH(6, BranchB);
-        case cJU_JPBRANCH_B7: PREPBRANCH(7, BranchB);
-#endif
-        case cJU_JPBRANCH_B:  pop1_jp = RootPop1;
-        {
-            Word_t subexp;
-            Word_t jpcount;
-            Pjbb_t Pjbb;
-BranchB:
-            Pjbb = P_JBB(Pjp->jp_Addr);
-
-            for (subexp = 0; subexp < cJU_NUMSUBEXPB; ++subexp)
-            {
-                jpcount = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, subexp));
-
-                for (offset = 0; offset < jpcount; ++offset)
-                {
-                    pop1 += JudyCheckPopSM(P_JP(JU_JBB_PJP(Pjbb, subexp))
-                                         + offset, 0);
-                }
-            }
-
-            assert(pop1_jp == pop1);
-            return(pop1);
-        }
-
-        case cJU_JPBRANCH_U2: PREPBRANCH(2, BranchU);
-        case cJU_JPBRANCH_U3: PREPBRANCH(3, BranchU);
-#ifdef JU_64BIT
-        case cJU_JPBRANCH_U4: PREPBRANCH(4, BranchU);
-        case cJU_JPBRANCH_U5: PREPBRANCH(5, BranchU);
-        case cJU_JPBRANCH_U6: PREPBRANCH(6, BranchU);
-        case cJU_JPBRANCH_U7: PREPBRANCH(7, BranchU);
-#endif
-        case cJU_JPBRANCH_U:  pop1_jp = RootPop1;
-        {
-            Pjbu_t Pjbu;
-BranchU:
-            Pjbu = P_JBU(Pjp->jp_Addr);
-
-            for (offset = 0; offset < cJU_BRANCHUNUMJPS; ++offset)
-            {
-                if (((Pjbu->jbu_jp[offset].jp_Type) >= cJU_JPNULL1)
-                 && ((Pjbu->jbu_jp[offset].jp_Type) <= cJU_JPNULLMAX))
-                {
-                    continue;           // skip null JP to save time.
-                }
-
-                pop1 += JudyCheckPopSM((Pjbu->jbu_jp) + offset, 0);
-            }
-
-            assert(pop1_jp == pop1);
-            return(pop1);
-        }
-
-
-// -- Cases below here terminate and do not recurse. --
-//
-// For all of these cases except JPLEAF_B1, there is no way to check the JPs
-// pop1 against the object itself; just return the pop1; but for linear leaves,
-// a bounds check is possible.
-
-#define CHECKLEAF(MaxPop1)                              \
-        pop1 = JU_JPLEAF_POP0(Pjp) + 1;                 \
-        assert(pop1 >= 1);                              \
-        assert(pop1 <= (MaxPop1));                      \
-        return(pop1)
-
-#if (defined(JUDYL) || (! defined(JU_64BIT)))
-        case cJU_JPLEAF1:  CHECKLEAF(cJU_LEAF1_MAXPOP1);
-#endif
-        case cJU_JPLEAF2:  CHECKLEAF(cJU_LEAF2_MAXPOP1);
-        case cJU_JPLEAF3:  CHECKLEAF(cJU_LEAF3_MAXPOP1);
-#ifdef JU_64BIT
-        case cJU_JPLEAF4:  CHECKLEAF(cJU_LEAF4_MAXPOP1);
-        case cJU_JPLEAF5:  CHECKLEAF(cJU_LEAF5_MAXPOP1);
-        case cJU_JPLEAF6:  CHECKLEAF(cJU_LEAF6_MAXPOP1);
-        case cJU_JPLEAF7:  CHECKLEAF(cJU_LEAF7_MAXPOP1);
-#endif
-
-        case cJU_JPLEAF_B1:
-        {
-            Word_t subexp;
-            Pjlb_t Pjlb;
-
-            pop1_jp = JU_JPLEAF_POP0(Pjp) + 1;
-
-            Pjlb = P_JLB(Pjp->jp_Addr);
-
-            for (subexp = 0; subexp < cJU_NUMSUBEXPL; ++subexp)
-                pop1 += j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, subexp));
-
-            assert(pop1_jp == pop1);
-            return(pop1);
-        }
-
-        JUDY1CODE(case cJ1_JPFULLPOPU1: return(cJU_JPFULLPOPU1_POP0);)
-
-        case cJU_JPIMMED_1_01:  return(1);
-        case cJU_JPIMMED_2_01:  return(1);
-        case cJU_JPIMMED_3_01:  return(1);
-#ifdef JU_64BIT
-        case cJU_JPIMMED_4_01:  return(1);
-        case cJU_JPIMMED_5_01:  return(1);
-        case cJU_JPIMMED_6_01:  return(1);
-        case cJU_JPIMMED_7_01:  return(1);
-#endif
-
-        case cJU_JPIMMED_1_02:  return(2);
-        case cJU_JPIMMED_1_03:  return(3);
-#if (defined(JUDY1) || defined(JU_64BIT))
-        case cJU_JPIMMED_1_04:  return(4);
-        case cJU_JPIMMED_1_05:  return(5);
-        case cJU_JPIMMED_1_06:  return(6);
-        case cJU_JPIMMED_1_07:  return(7);
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-        case cJ1_JPIMMED_1_08:  return(8);
-        case cJ1_JPIMMED_1_09:  return(9);
-        case cJ1_JPIMMED_1_10:  return(10);
-        case cJ1_JPIMMED_1_11:  return(11);
-        case cJ1_JPIMMED_1_12:  return(12);
-        case cJ1_JPIMMED_1_13:  return(13);
-        case cJ1_JPIMMED_1_14:  return(14);
-        case cJ1_JPIMMED_1_15:  return(15);
-#endif
-
-#if (defined(JUDY1) || defined(JU_64BIT))
-        case cJU_JPIMMED_2_02:  return(2);
-        case cJU_JPIMMED_2_03:  return(3);
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-        case cJ1_JPIMMED_2_04:  return(4);
-        case cJ1_JPIMMED_2_05:  return(5);
-        case cJ1_JPIMMED_2_06:  return(6);
-        case cJ1_JPIMMED_2_07:  return(7);
-#endif
-
-#if (defined(JUDY1) || defined(JU_64BIT))
-        case cJU_JPIMMED_3_02:  return(2);
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-        case cJ1_JPIMMED_3_03:  return(3);
-        case cJ1_JPIMMED_3_04:  return(4);
-        case cJ1_JPIMMED_3_05:  return(5);
-
-        case cJ1_JPIMMED_4_02:  return(2);
-        case cJ1_JPIMMED_4_03:  return(3);
-        case cJ1_JPIMMED_5_02:  return(2);
-        case cJ1_JPIMMED_5_03:  return(3);
-        case cJ1_JPIMMED_6_02:  return(2);
-        case cJ1_JPIMMED_7_02:  return(2);
-#endif
-
-        } // switch (JU_JPTYPE(Pjp))
-
-        assert(FALSE);          // unrecognized JP type => corruption.
-        return(0);              // to make some compilers happy.
-
-} // JudyCheckPopSM()
-
-#endif // DEBUG
-#endif // ! JUDYGETINLINE
diff --git a/libs/klib/judy/JudyHS.c b/libs/klib/judy/JudyHS.c
deleted file mode 100644
index aa9fbfa..0000000
--- a/libs/klib/judy/JudyHS.c
+++ /dev/null
@@ -1,770 +0,0 @@
-//=======================================================================
-//   Author Douglas L. Baskins, Dec 2003.
-//   Permission to use this code is freely granted, provided that this
-//   statement is retained.
-//   email - doug at sourcejudy.com -or- dougbaskins at yahoo.com
-//=======================================================================
-
-#include <string.h>                     // for memcmp(), memcpy()
-
-#include <Judy.h>                       // for JudyL* routines/macros
-
-/*
-   This routine is a very fast "string" version of an ADT that stores
-   (JudyHSIns()), retrieves (JudyHSGet()), deletes (JudyHSDel()) and
-   frees the entire ADT (JudyHSFreeArray()) strings.  It uses the "Judy
-   arrays" JudyL() API as the main workhorse.  The length of the string
-   is included in the calling parameters so that strings with embedded
-   \0s can be used.  The string lengths can be from 0 bytes to whatever
-   malloc() can handle (~2GB).
-
-   Compile:
-  
-      cc -O JudyHS.c -c         needs to link with -lJudy (libJudy.a)
-  
-      Note: in gcc version 3.3.1, -O2 generates faster code than -O
-      Note: in gcc version 3.3.2, -O3 generates faster code than -O2
-
-   NOTES:
-
-1) There may be some performance issues with 64 bit machines, because I
-   have not characterized that it yet.
-
-2) It appears that a modern CPU (>2Ghz) that the instruction times are
-   much faster that a RAM access, so building up a word from bytes takes
-   no longer that a whole word access.  I am taking advantage of this to
-   make this code endian neutral.  A side effect of this is strings do
-   not need to be aligned, nor tested to be on to a word boundry.  In
-   older and in slow (RISC) machines, this may be a performance issue.
-   I have given up trying to optimize for machines that have very slow
-   mpy, mod, variable shifts and call returns.
-
-3) JudyHS is very scalable from 1 string to billions (with enough RAM).
-   The memory usage is also scales with population.  I have attempted to
-   combine the best characteristics of JudyL arrays with Hashing methods
-   and well designed modern processors (such as the 1.3Ghz Intel
-   Centrino this is being written on).
-
-   HOW JudyHS WORKS: ( 4[8] means 4 bytes in 32 bit machine and 8 in 64)
-
-   A) A JudyL array is used to separate strings of equal lengths into
-   their own structures (a different hash table is used for each length
-   of string).  The additional time overhead is very near zero because
-   of the CPU cache.  The space efficiency is improved because the
-   length need not be stored with the string (ls_t).  The "JLHash" ADT
-   in the test program "StringCompare" is verification of both these
-   assumptions.
-
-   B) A 32 bit hash value is produced from the string.  Many thanks to
-   the Internet and the author (Bob Jenkins) for coming up with a very
-   good and fast universal string hash.  Next the 32 bit hash number is
-   used as an Index to another JudyL array.  Notice that one (1) JudyL
-   array is used as a hash table per each string length.  If there are
-   no hash collisions (normally) then the string is copied to a
-   structure (ls_t) along with room for storing a Value.  A flag is
-   added to the pointer to note it is pointing to a ls_t structure.
-   Since the lengths of the strings are the same, there is no need to
-   stored length of string in the ls_t structure.  This saves about a
-   word per string of memory.
-
-   C) When there is a hashing collision (very rare), a JudyL array is
-   used to decode the next 4[8] bytes of the string.  That is, the next
-   4[8] bytes of the string are used as the Index.  This process is
-   repeated until the remaining string is unique.  The remaining string
-   (if any) is stored in a (now smaller) ls_t structure.  If the
-   remaining string is less or equal to 4[8] bytes, then the ls_t
-   structure is not needed and the Value area in the JudyL array is
-   used.  A compile option -DDONOTUSEHASH is available to test this
-   structure without using hashing (only the JudyL tree is used).  This
-   is equivalent to having all strings hashed to the same bucket.  The
-   speed is still better than all other tree based ADTs I have tested.
-   An added benefit of this is a very fast "hash collision" resolving.
-   It could foil hackers that exploit the slow synonym (linked-list)
-   collision handling property used with most hashing algorithms.  If
-   this is not a necessary property, then a simpler ADT "JLHash" that is
-   documented the the test program "StringCompare.c" may be used with a
-   little loss of memory efficiency (because it includes the string
-   length with the ls_t structure).  JudyHS was written to be the
-   fastest, very scalable, memory efficient, general purpose string ADT
-   possible.  (However, I would like to eat those words someday). (dlb)
-
-*/
-
-#ifdef EXAMPLE_CODE
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <Judy.h>
-
-//#include "JudyHS.h"                   // for Judy.h without JudyHS*()
-
-// By Doug Baskins Apr 2004 - for JudyHS man page
-
-#define MAXLINE 1000000                 /* max length of line */
-char      Index[MAXLINE];               // string to check
-
-int     // Usage:  CheckDupLines < file
-main()
-{
-    Pvoid_t   PJArray = (PWord_t)NULL;  // Judy array.
-    PWord_t   PValue;                   // ^ Judy array element.
-    Word_t    Bytes;                    // size of JudyHS array.
-    Word_t    LineNumb = 0;             // current line number
-    Word_t    Dups = 0;                 // number of duplicate lines
-
-    while (fgets(Index, MAXLINE, stdin) != (char *)NULL)
-    {
-        LineNumb++;                     // line number
-
-//      store string into array
-        JHSI(PValue, PJArray, Index, strlen(Index)); 
-        if (*PValue)                    // check if duplicate
-        {
-            Dups++;                     // count duplicates
-            printf("Duplicate lines %lu:%lu:%s", *PValue, LineNumb, Index);
-        }
-        else
-        {
-            *PValue = LineNumb;         // store Line number
-        }
-    }
-    printf("%lu Duplicates, free JudyHS array of %lu Lines\n", 
-                    Dups, LineNumb - Dups);
-    JHSFA(Bytes, PJArray);              // free array
-    printf("The JudyHS array allocated %lu bytes of memory\n", Bytes);
-    return (0);
-}
-#endif // EXAMPLE_CODE
-
-// Note:  Use JLAP_INVALID, which is non-zero, to mark pointers to a ls_t
-// This makes it compatable with previous versions of JudyL()
-
-#define IS_PLS(PLS)     (((Word_t) (PLS)) & JLAP_INVALID)
-#define CLEAR_PLS(PLS)  (((Word_t) (PLS)) & (~JLAP_INVALID))
-#define SET_PLS(PLS)    (((Word_t) (PLS)) | JLAP_INVALID)
-
-#define WORDSIZE     (sizeof(Word_t))
-
-// this is the struct used for "leaf" strings.  Note that
-// the Value is followed by a "variable" length ls_String array.
-//
-typedef struct L_EAFSTRING
-{
-    Word_t    ls_Value;                 // Value area (cannot change size)
-    uint8_t   ls_String[WORDSIZE];      // to fill out to a Word_t size
-} ls_t     , *Pls_t;
-
-#define LS_STRUCTOVD     (sizeof(ls_t) - WORDSIZE)
-
-// Calculate size of ls_t including the string of length of LEN.
-//
-#define LS_WORDLEN(LEN)  (((LEN) + LS_STRUCTOVD + WORDSIZE - 1) / WORDSIZE)
-
-// Copy from 0..4[8] bytes from string to a Word_t
-// NOTE: the copy in in little-endian order to take advantage of improved 
-// memory efficiency of JudyLIns() with smaller numbers
-//
-#define        COPYSTRING4toWORD(WORD,STR,LEN)          \
-{                                                       \
-    WORD = 0;                                           \
-    switch(LEN)                                         \
-    {                                                   \
-    default:    /* four and greater */                  \
-    case 4:                                             \
-        WORD += (Word_t)(((uint8_t *)(STR))[3] << 24);  \
-    case 3:                                             \
-        WORD += (Word_t)(((uint8_t *)(STR))[2] << 16);  \
-    case 2:                                             \
-        WORD += (Word_t)(((uint8_t *)(STR))[1] <<  8);  \
-    case 1:                                             \
-        WORD += (Word_t)(((uint8_t *)(STR))[0]);        \
-    case 0: break;                                      \
-    }                                                   \
-}
-
-#ifdef JU_64BIT
-
-// copy from 0..8 bytes from string to Word_t
-//
-#define        COPYSTRING8toWORD(WORD,STR,LEN)          \
-{                                                       \
-    WORD = 0UL;                                         \
-    switch(LEN)                                         \
-    {                                                   \
-    default:    /* eight and greater */                 \
-    case 8:                                             \
-        WORD += ((Word_t)((uint8_t *)(STR))[7] << 56);  \
-    case 7:                                             \
-        WORD += ((Word_t)((uint8_t *)(STR))[6] << 48);  \
-    case 6:                                             \
-        WORD += ((Word_t)((uint8_t *)(STR))[5] << 40);  \
-    case 5:                                             \
-        WORD += ((Word_t)((uint8_t *)(STR))[4] << 32);  \
-    case 4:                                             \
-        WORD += ((Word_t)((uint8_t *)(STR))[3] << 24);  \
-    case 3:                                             \
-        WORD += ((Word_t)((uint8_t *)(STR))[2] << 16);  \
-    case 2:                                             \
-        WORD += ((Word_t)((uint8_t *)(STR))[1] <<  8);  \
-    case 1:                                             \
-        WORD += ((Word_t)((uint8_t *)(STR))[0]);        \
-    case 0: break;                                      \
-    }                                                   \
-}
-
-#define COPYSTRINGtoWORD COPYSTRING8toWORD
-
-#else  // JU_32BIT
-
-#define COPYSTRINGtoWORD COPYSTRING4toWORD
-
-#endif // JU_32BIT
-
-// set JError_t locally
-
-#define JU_SET_ERRNO(PJERROR, JERRNO)           \
-{                                               \
-    if (PJERROR != (PJError_t) NULL)            \
-    {                                           \
-        if (JERRNO)                             \
-            JU_ERRNO(PJError) = (JERRNO);       \
-        JU_ERRID(PJERROR) = __LINE__;           \
-    }                                           \
-}
-
-//=======================================================================
-// This routine must hash string to 24..32 bits.  The "goodness" of
-// the hash is not as important as its speed.
-//=======================================================================
-
-// hash to no more than 32 bits
-
-// extern Word_t gHmask; for hash bits experiments
-
-#define JUDYHASHSTR(HVALUE,STRING,LENGTH)       \
-{                                               \
-    uint8_t *p_ = (uint8_t *)(STRING);          \
-    uint8_t *q_ = p_ + (LENGTH);                \
-    uint32_t c_ = 0;                            \
-    for (; p_ != q_; ++p_)                      \
-    {                                           \
-        c_ = (c_ * 31) + *p_;                   \
-    }                                           \
-/*  c_ &= gHmask;   see above   */              \
-    (HVALUE) = c_;                              \
-}
-
-// Find String of Len in JudyHS structure, return pointer to associated Value
-
-PPvoid_t
-JudyHSGet(Pcvoid_t PArray,              // pointer (^) to structure
-           void * Str,                  // pointer to string
-           Word_t Len                   // length of string
-    )
-{
-    uint8_t  *String = (uint8_t *)Str;
-    PPvoid_t  PPValue;                  // pointer to Value
-    Word_t    Index;                    // 4[8] bytes of String
-
-    JLG(PPValue, PArray, Len);          // find hash table for strings of Len
-    if (PPValue == (PPvoid_t) NULL)
-        return ((PPvoid_t) NULL);       // no strings of this Len
-
-//  check for caller error (null pointer)
-//
-    if ((String == (void *) NULL) && (Len != 0))
-        return ((PPvoid_t) NULL);       // avoid null-pointer dereference
-
-#ifndef DONOTUSEHASH
-    if (Len > WORDSIZE)                 // Hash table not necessary with short
-    {
-        uint32_t  HValue;               // hash of input string
-        JUDYHASHSTR(HValue, String, Len);       // hash to no more than 32 bits
-        JLG(PPValue, *PPValue, (Word_t)HValue); // get ^ to hash bucket
-        if (PPValue == (PPvoid_t) NULL)
-            return ((PPvoid_t) NULL);   // no entry in Hash table
-    }
-#endif // DONOTUSEHASH
-
-/*
-  Each JudyL array decodes 4[8] bytes of the string.  Since the hash
-  collisions occur very infrequently, the performance is not important.
-  However, even if the Hash code is not used this method still is
-  significantly faster than common tree methods (AVL, Red-Black, Splay,
-  b-tree, etc..).  You can compare it yourself with #define DONOTUSEHASH
-  1 or putting -DDONOTUSEHASH in the cc line.  Use the "StringCompare.c"
-  code to compare (9Dec2003 dlb).
-*/
-    while (Len > WORDSIZE)              // traverse tree of JudyL arrays
-    {
-        if (IS_PLS(*PPValue))           // ^ to JudyL array or ls_t struct?
-        {
-            Pls_t     Pls;              // ls_t struct, termination of tree
-            Pls = (Pls_t) CLEAR_PLS(*PPValue);  // remove flag from ^
-
-//          if remaining string matches, return ^ to Value, else NULL
-
-            if (memcmp(String, Pls->ls_String, Len) == 0)
-                return ((PPvoid_t) (&(Pls->ls_Value)));
-            else
-                return ((PPvoid_t) NULL);       // string does not match
-        }
-        else
-        {
-            COPYSTRINGtoWORD(Index, String, WORDSIZE);
-
-            JLG(PPValue, *PPValue, Index);      // decode next 4[8] bytes
-            if (PPValue == (PPvoid_t) NULL)     // if NULL array, bail out
-                return ((PPvoid_t) NULL);       // string does not match
-
-            String += WORDSIZE;                 // advance
-            Len -= WORDSIZE;
-        }
-    }
-
-//  Get remaining 1..4[8] bytes left in string
-
-    COPYSTRINGtoWORD(Index, String, Len);
-    JLG(PPValue, *PPValue, Index);      // decode last 1-4[8] bytes
-    return (PPValue);
-}
-
-// Add string to a tree of JudyL arrays (all lengths must be same)
-
-static PPvoid_t
-insStrJudyLTree(uint8_t * String,      // string to add to tree of JudyL arrays
-                 Word_t Len,            // length of string
-                 PPvoid_t PPValue,      // pointer to root pointer
-                 PJError_t PJError      // for returning error info
-    )
-{
-    Word_t    Index;                    // next 4[8] bytes of String
-
-    while (Len > WORDSIZE)              // add to JudyL tree
-    {
-//      CASE 1, pointer is to a NULL, make a new ls_t leaf
-
-        if (*PPValue == (Pvoid_t)NULL)
-        {
-            Pls_t     Pls;              // memory for a ls_t
-            Pls = (Pls_t) JudyMalloc(LS_WORDLEN(Len));
-            if (Pls == NULL)
-            {
-                JU_SET_ERRNO(PJError, JU_ERRNO_NOMEM);
-                return (PPJERR);
-            }
-            Pls->ls_Value = 0;                          // clear Value word
-            memcpy(Pls->ls_String, String, Len);        // copy to new struct
-            *PPValue = (Pvoid_t)SET_PLS(Pls);           // mark pointer
-            return ((PPvoid_t) (&Pls->ls_Value));       // return ^ to Value
-        }                                               // no exit here
-//      CASE 2: is a ls_t, free (and shorten), then decode into JudyL tree
-
-        if (IS_PLS(*PPValue))                   // pointer to a ls_t? (leaf)
-        {
-            Pls_t     Pls;                      // ^ to ls_t
-            uint8_t  *String0;                  // ^ to string in ls_t
-            Word_t    Index0;                   // 4[8] bytes in string
-            Word_t    FreeLen;                  // length of ls_t
-            PPvoid_t  PPsplit;
-
-            FreeLen = LS_WORDLEN(Len);          // length of ls_t
-
-            Pls = (Pls_t) CLEAR_PLS(*PPValue);  // demangle ^ to ls_t
-            String0 = Pls->ls_String;
-            if (memcmp(String, String0, Len) == 0)      // check if match?
-            {
-                return ((PPvoid_t) (&Pls->ls_Value));   // yes, duplicate
-            }
-
-            *PPValue = NULL;            // clear ^ to ls_t and make JudyL
-
-//          This do loop is technically not required, saves multiple JudyFree()
-//          when storing already sorted strings into structure
-
-            do                          // decode next 4[8] bytes of string
-            {                           // with a JudyL array
-//              Note: string0 is always aligned
-
-                COPYSTRINGtoWORD(Index0, String0, WORDSIZE);
-                String0 += WORDSIZE;
-                COPYSTRINGtoWORD(Index, String, WORDSIZE);
-                String += WORDSIZE;
-                Len -= WORDSIZE;
-                PPsplit = PPValue;      // save for split below
-                PPValue = JudyLIns(PPValue, Index0, PJError);
-                if (PPValue == PPJERR)
-                {
-                    JU_SET_ERRNO(PJError, 0);
-                    return (PPJERR);
-                }
-
-            } while ((Index0 == Index) && (Len > WORDSIZE));
-
-//          finish storing remainder of string that was in the ls_t
-
-            PPValue = insStrJudyLTree(String0, Len, PPValue, PJError);
-            if (PPValue == PPJERR)
-            {
-                return (PPJERR);
-            }
-//          copy old Value to Value in new struct
-
-            *(PWord_t)PPValue = Pls->ls_Value;
-
-//          free the string buffer (ls_t)
-
-            JudyFree((Pvoid_t)Pls, FreeLen);
-            PPValue = JudyLIns(PPsplit, Index, PJError);
-            if (PPValue == PPJERR)
-            {
-                JU_SET_ERRNO(PJError, 0);
-                return (PPValue);
-            }
-
-//          finish remainder of newly inserted string
-
-            PPValue = insStrJudyLTree(String, Len, PPValue, PJError);
-            return (PPValue);
-        }                               // no exit here
-//      CASE 3, more JudyL arrays, decode to next tree
-
-        COPYSTRINGtoWORD(Index, String, WORDSIZE);
-        Len -= WORDSIZE;
-        String += WORDSIZE;
-
-        PPValue = JudyLIns(PPValue, Index, PJError);    // next 4[8] bytes
-        if (PPValue == PPJERR)
-        {
-            JU_SET_ERRNO(PJError, 0);
-            return (PPValue);
-        }
-    }
-//  this is done outside of loop so "Len" can be an unsigned number
-
-    COPYSTRINGtoWORD(Index, String, Len);
-    PPValue = JudyLIns(PPValue, Index, PJError);    // remaining 4[8] bytes
-
-    return (PPValue);
-}
-
-
-// Insert string to JudyHS structure, return pointer to associated Value
-
-PPvoid_t
-JudyHSIns(PPvoid_t PPArray,             // ^ to JudyHashArray name
-           void * Str,                  // pointer to string
-           Word_t Len,                  // length of string
-           PJError_t PJError            // optional, for returning error info
-    )
-{
-    uint8_t * String = (uint8_t *)Str;
-    PPvoid_t  PPValue;
-
-//  string can only be NULL if Len is 0.
-
-    if ((String == (uint8_t *) NULL) && (Len != 0UL))
-    {
-        JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX);
-        return (PPJERR);
-    }
-    JLG(PPValue, *PPArray, Len);        // JudyL hash table for strings of Len
-    if (PPValue == (PPvoid_t) NULL)     // make new if missing, (very rare)
-    {
-        PPValue = JudyLIns(PPArray, Len, PJError);
-        if (PPValue == PPJERR)
-        {
-            JU_SET_ERRNO(PJError, 0);
-            return (PPJERR);
-        }
-    }
-#ifndef DONOTUSEHASH
-    if (Len > WORDSIZE)
-    {
-        uint32_t  HValue;                       // hash of input string
-        JUDYHASHSTR(HValue, String, Len);       // hash to no more than 32 bits
-        PPValue = JudyLIns(PPValue, (Word_t)HValue, PJError);
-        if (PPValue == PPJERR)
-        {
-            JU_SET_ERRNO(PJError, 0);
-            return (PPJERR);
-        }
-    }
-#endif // DONOTUSEHASH
-
-    PPValue = insStrJudyLTree(String, Len, PPValue, PJError); // add string 
-    return (PPValue);                   //  ^  to Value
-}
-
-// Delete string from tree of JudyL arrays (all Lens must be same)
-
-static int
-delStrJudyLTree(uint8_t * String,      // delete from tree of JudyL arrays
-                 Word_t Len,            // length of string
-                 PPvoid_t PPValue,      // ^ to hash bucket
-                 PJError_t PJError      // for returning error info
-    )
-{
-    PPvoid_t  PPValueN;                 // next pointer
-    Word_t    Index;
-    int       Ret;                      // -1=failed, 1=success, 2=quit del
-
-    if (IS_PLS(*PPValue))               // is pointer to ls_t?
-    {
-        Pls_t     Pls;
-        Pls = (Pls_t) CLEAR_PLS(*PPValue);      // demangle pointer
-        JudyFree((Pvoid_t)Pls, LS_WORDLEN(Len));        // free the ls_t
-
-        *PPValue = (Pvoid_t)NULL;       // clean pointer
-        return (1);                     // successfully deleted
-    }
-
-    if (Len > WORDSIZE)                 // delete from JudyL tree, not leaf
-    {
-        COPYSTRINGtoWORD(Index, String, WORDSIZE);      // get Index
-        JLG(PPValueN, *PPValue, Index); // get pointer to next JudyL array
-
-        String += WORDSIZE;             // advance to next 4[8] bytes
-        Len -= WORDSIZE;
-
-        Ret = delStrJudyLTree(String, Len, PPValueN, PJError);
-        if (Ret != 1) return(Ret);
-
-        if (*PPValueN == (PPvoid_t) NULL)
-        {
-//          delete JudyL element from tree
-
-            Ret = JudyLDel(PPValue, Index, PJError);
-        }
-    }
-    else
-    {
-        COPYSTRINGtoWORD(Index, String, Len);   // get leaf element
-
-//      delete last 1-4[8] bytes from leaf element
-
-        Ret = JudyLDel(PPValue, Index, PJError); 
-    }
-    return (Ret);
-}
-
-// Delete string from JHS structure
-
-int
-JudyHSDel(PPvoid_t PPArray,             // ^ to JudyHashArray struct
-           void * Str,                  // pointer to string
-           Word_t Len,                  // length of string
-           PJError_t PJError            // optional, for returning error info
-    )
-{
-    uint8_t * String = (uint8_t *)Str;
-    PPvoid_t  PPBucket, PPHtble;
-    int       Ret;                      // return bool from Delete routine
-#ifndef DONOTUSEHASH
-    uint32_t  HValue = 0;               // hash value of input string
-#endif // DONOTUSEHASH
-
-    if (PPArray == NULL)
-        return (0);                     // no pointer, return not found
-
-//  This is a little slower than optimum method, but not much in new CPU
-//  Verify that string is in the structure -- simplifies future assumptions
-
-    if (JudyHSGet(*PPArray, String, Len) == (PPvoid_t) NULL)
-        return (0);                     // string not found, return
-
-//  string is in structure, so testing for absence is not necessary
-
-    JLG(PPHtble, *PPArray, Len);        // JudyL hash table for strings of Len
-
-#ifdef DONOTUSEHASH
-    PPBucket = PPHtble;                 // simulate below code
-#else  // USEHASH
-    if (Len > WORDSIZE)
-    {
-        JUDYHASHSTR(HValue, String, Len);       // hash to no more than 32 bits
-
-//  get pointer to hash bucket
-
-        JLG(PPBucket, *PPHtble, (Word_t)HValue);
-    }
-    else
-    {
-        PPBucket = PPHtble;             // no bucket to JLGet
-    }
-#endif // USEHASH
-
-// delete from JudyL tree
-//
-    Ret = delStrJudyLTree(String, Len, PPBucket, PJError);
-    if (Ret != 1)
-    {
-        JU_SET_ERRNO(PJError, 0);
-        return(-1);
-    }
-//  handle case of missing JudyL array from hash table and length table
-
-    if (*PPBucket == (Pvoid_t)NULL)     // if JudyL tree gone
-    {
-#ifndef DONOTUSEHASH
-        if (Len > WORDSIZE)
-        {
-//          delete entry in Hash table
-
-            Ret = JudyLDel(PPHtble, (Word_t)HValue, PJError); 
-            if (Ret != 1)
-            {
-                JU_SET_ERRNO(PJError, 0);
-                return(-1);
-            }
-        }
-#endif // USEHASH
-        if (*PPHtble == (PPvoid_t) NULL)        // if Hash table gone
-        {
-//          delete entry from the String length table
-
-            Ret = JudyLDel(PPArray, Len, PJError); 
-            if (Ret != 1)
-            {
-                JU_SET_ERRNO(PJError, 0);
-                return(-1);
-            }
-        }
-    }
-    return (1);                         // success
-}
-
-static Word_t
-delJudyLTree(PPvoid_t PPValue,                 // ^ to JudyL root pointer
-              Word_t Len,                       // length of string
-              PJError_t PJError)                // for returning error info
-{
-    Word_t    bytes_freed = 0;                  // bytes freed at point
-    Word_t    bytes_total = 0;                  // accumulated bytes freed
-    PPvoid_t  PPValueN;
-
-//  Pointer is to another tree of JudyL arrays or ls_t struct
-
-    if (Len > WORDSIZE)                         // more depth to tree
-    {
-        Word_t NEntry;
-
-//      Pointer is to a ls_t struct
-
-        if (IS_PLS(*PPValue)) 
-        {
-            Pls_t   Pls;
-            Word_t  freewords;
-
-            freewords = LS_WORDLEN(Len);        // calculate length
-            Pls = (Pls_t)CLEAR_PLS(*PPValue);   // demangle pointer
-
-//        *PPValue = (Pvoid_t)NULL;               // clean pointer
-           JudyFree((Pvoid_t)Pls, freewords);   // free the ls_t
-
-            return(freewords * WORDSIZE);
-        }
-//      else
-//      Walk all the entrys in the JudyL array
-
-        NEntry = 0;                             // start at beginning
-        for (PPValueN = JudyLFirst(*PPValue, &NEntry, PJError);
-            (PPValueN != (PPvoid_t) NULL) && (PPValueN != PPJERR);
-             PPValueN = JudyLNext(*PPValue, &NEntry, PJError))
-        {
-//          recurse to the next level in the tree of arrays
-
-            bytes_freed = delJudyLTree(PPValueN, Len - WORDSIZE, PJError);
-            if (bytes_freed == JERR) return(JERR);
-            bytes_total += bytes_freed;
-        }
-        if (PPValueN == PPJERR) return(JERR);
-
-//      now free this JudyL array
-
-        bytes_freed = JudyLFreeArray(PPValue, PJError);
-        if (bytes_freed == JERR) return(JERR);
-        bytes_total += bytes_freed;
-
-        return(bytes_total);  // return amount freed
-    }
-//  else
-
-//  Pointer to simple JudyL array
-
-    bytes_freed = JudyLFreeArray(PPValue, PJError);
-
-    return(bytes_freed);
-}
-
-
-Word_t                                  // bytes freed
-JudyHSFreeArray(PPvoid_t PPArray,       // ^ to JudyHashArray struct
-           PJError_t PJError            // optional, for returning error info
-    )
-{
-    Word_t    Len;                      // start at beginning
-    Word_t    bytes_freed;              // bytes freed at this level.
-    Word_t    bytes_total;              // bytes total at all levels.
-    PPvoid_t  PPHtble;
-
-    if (PPArray == NULL) 
-        return (0);                     // no pointer, return none
-
-//  Walk the string length table for subsidary hash structs
-//  NOTE: This is necessary to determine the depth of the tree
-
-    bytes_freed = 0; 
-    bytes_total = 0;
-    Len = 0;                            // walk to length table
-
-    for (PPHtble  = JudyLFirst(*PPArray, &Len, PJError);
-        (PPHtble != (PPvoid_t) NULL) && (PPHtble != PPJERR);
-         PPHtble  = JudyLNext(*PPArray, &Len, PJError))
-    {
-        PPvoid_t PPValueH;
-
-#ifndef DONOTUSEHASH
-        if (Len > WORDSIZE)
-        {
-            Word_t HEntry = 0;              // walk the hash tables
-
-            for (PPValueH  = JudyLFirst(*PPHtble, &HEntry, PJError);
-                (PPValueH != (PPvoid_t) NULL) && (PPValueH != PPJERR);
-                 PPValueH  = JudyLNext(*PPHtble, &HEntry, PJError))
-            {
-                bytes_freed = delJudyLTree(PPValueH, Len, PJError);
-                if (bytes_freed == JERR) return(JERR);
-                bytes_total += bytes_freed;
-            }
-
-            if (PPValueH == PPJERR) return(JERR);
-
-//          free the Hash table for this length of string
-
-            bytes_freed = JudyLFreeArray(PPHtble, PJError);
-            if (bytes_freed == JERR) return(JERR);
-            bytes_total += bytes_freed;
-        }
-        else
-#endif // DONOTUSEHASH
-        {
-                PPValueH = PPHtble;     // simulate hash table
-
-                bytes_freed = delJudyLTree(PPValueH, Len, PJError);
-                if (bytes_freed == JERR) return(JERR);
-                bytes_total += bytes_freed;
-        }
-    }
-    if (PPHtble == PPJERR) return(JERR);
-
-//  free the length table
-
-    bytes_freed = JudyLFreeArray(PPArray, PJError);
-    if (bytes_freed == JERR) return(JERR);
-
-    bytes_total += bytes_freed;
-
-    return(bytes_total);                // return bytes freed
-}
diff --git a/libs/klib/judy/JudyHS.h b/libs/klib/judy/JudyHS.h
deleted file mode 100644
index b403501..0000000
--- a/libs/klib/judy/JudyHS.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// ****************************************************************************
-// Quick and dirty header file for use with old Judy.h without JudyHS defs
-// May 2004 (dlb) - No copyright or license -- it is free period.
-
-#include <stdint.h>
-
-// ****************************************************************************
-// JUDYHSL MACROS:
-
-#define JHSI(PV,    PArray,   PIndex,   Count)                          \
-        J_2P(PV, (&(PArray)), PIndex,   Count, JudyHSIns, "JudyHSIns")
-#define JHSG(PV,    PArray,   PIndex,   Count)                          \
-        (PV) = (Pvoid_t) JudyHSGet(PArray, PIndex, Count)
-#define JHSD(Rc,    PArray,   PIndex,   Count)                          \
-        J_2I(Rc, (&(PArray)), PIndex, Count, JudyHSDel, "JudyHSDel")
-#define JHSFA(Rc,    PArray)                                            \
-        J_0I(Rc, (&(PArray)), JudyHSFreeArray, "JudyHSFreeArray")
-
-// ****************************************************************************
-// JUDY memory interface to malloc() FUNCTIONS:
-
-extern Word_t JudyMalloc(Word_t);               // words reqd => words allocd.
-extern Word_t JudyMallocVirtual(Word_t);        // words reqd => words allocd.
-extern void   JudyFree(Pvoid_t, Word_t);        // block to free and its size in words.
-extern void   JudyFreeVirtual(Pvoid_t, Word_t); // block to free and its size in words.
-
-// ****************************************************************************
-// JUDYHS FUNCTIONS:
-
-extern PPvoid_t JudyHSGet(       Pcvoid_t,  void *, Word_t);
-extern PPvoid_t JudyHSIns(       PPvoid_t,  void *, Word_t, P_JE);
-extern int      JudyHSDel(       PPvoid_t,  void *, Word_t, P_JE);
-extern Word_t   JudyHSFreeArray( PPvoid_t,                  P_JE);
-
-extern uint32_t JudyHashStr(                void *, Word_t);
diff --git a/libs/klib/judy/JudyIns.c b/libs/klib/judy/JudyIns.c
deleted file mode 100644
index d90820b..0000000
--- a/libs/klib/judy/JudyIns.c
+++ /dev/null
@@ -1,1871 +0,0 @@
-// Copyright (C) 2000 - 2002 Hewlett-Packard Company
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the term of the GNU Lesser 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 Lesser General Public License
-// for more details.
-//
-// You should have received a copy of the GNU Lesser 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
-// _________________
-
-// Judy1Set() and JudyLIns() functions for Judy1 and JudyL.
-// Compile with one of -DJUDY1 or -DJUDYL.
-//
-// TBD:  Should some of the assertions here be converted to product code that
-// returns JU_ERRNO_CORRUPT?
-
-#if (! (defined(JUDY1) || defined(JUDYL)))
-#error:  One of -DJUDY1 or -DJUDYL must be specified.
-#endif
-
-#ifdef JUDY1
-#include "Judy1.h"
-#else
-#include "JudyL.h"
-#endif
-
-#include "JudyPrivate1L.h"
-
-// Note:  Call JudyCheckPop() even before "already inserted" returns, to catch
-// population errors; see fix in 4.84:
-
-DBGCODE(extern void JudyCheckPop(Pvoid_t PArray);)
-DBGCODE(extern void JudyCheckSorted(Pjll_t Pjll, Word_t Pop1, long IndexSize);)
-
-#ifdef TRACEJP
-#include "JudyPrintJP.c"
-#endif
-
-
-// These are defined to generic values in JudyCommon/JudyPrivateTypes.h:
-//
-// TBD:  These should be exported from a header file, but perhaps not, as they
-// are only used here, and exported from Judy*Decascade, which is a separate
-// file for profiling reasons (to prevent inlining), but which potentially
-// could be merged with this file, either in SoftCM or at compile-time.
-
-#ifdef JUDY1
-extern int j__udy1CreateBranchB(Pjp_t, Pjp_t, uint8_t *, Word_t, Pvoid_t);
-extern int j__udy1CreateBranchU(Pjp_t, Pvoid_t);
-
-#ifndef JU_64BIT
-extern int j__udy1Cascade1(Pjp_t, Pvoid_t);
-#endif
-extern int j__udy1Cascade2(Pjp_t, Pvoid_t);
-extern int j__udy1Cascade3(Pjp_t, Pvoid_t);
-#ifdef JU_64BIT
-extern int j__udy1Cascade4(Pjp_t, Pvoid_t);
-extern int j__udy1Cascade5(Pjp_t, Pvoid_t);
-extern int j__udy1Cascade6(Pjp_t, Pvoid_t);
-extern int j__udy1Cascade7(Pjp_t, Pvoid_t);
-#endif
-extern int j__udy1CascadeL(Pjp_t, Pvoid_t);
-
-extern int j__udy1InsertBranch(Pjp_t Pjp, Word_t Index, Word_t Btype, Pjpm_t);
-
-#else // JUDYL
-
-extern int j__udyLCreateBranchB(Pjp_t, Pjp_t, uint8_t *, Word_t, Pvoid_t);
-extern int j__udyLCreateBranchU(Pjp_t, Pvoid_t);
-
-extern int j__udyLCascade1(Pjp_t, Pvoid_t);
-extern int j__udyLCascade2(Pjp_t, Pvoid_t);
-extern int j__udyLCascade3(Pjp_t, Pvoid_t);
-#ifdef JU_64BIT
-extern int j__udyLCascade4(Pjp_t, Pvoid_t);
-extern int j__udyLCascade5(Pjp_t, Pvoid_t);
-extern int j__udyLCascade6(Pjp_t, Pvoid_t);
-extern int j__udyLCascade7(Pjp_t, Pvoid_t);
-#endif
-extern int j__udyLCascadeL(Pjp_t, Pvoid_t);
-
-extern int j__udyLInsertBranch(Pjp_t Pjp, Word_t Index, Word_t Btype, Pjpm_t);
-#endif
-
-
-// ****************************************************************************
-// MACROS FOR COMMON CODE:
-//
-// Check if Index is an outlier to (that is, not a member of) this expanse:
-//
-// An outlier is an Index in-the-expanse of the slot containing the pointer,
-// but not-in-the-expanse of the "narrow" pointer in that slot.  (This means
-// the Dcd part of the Index differs from the equivalent part of jp_DcdPopO.)
-// Therefore, the remedy is to put a cJU_JPBRANCH_L* between the narrow pointer
-// and the object to which it points, and add the outlier Index as an Immediate
-// in the cJU_JPBRANCH_L*.  The "trick" is placing the cJU_JPBRANCH_L* at a
-// Level that is as low as possible.  This is determined by counting the digits
-// in the existing narrow pointer that are the same as the digits in the new
-// Index (see j__udyInsertBranch()).
-//
-// Note:  At some high Levels, cJU_DCDMASK() is all zeros => dead code; assume
-// the compiler optimizes this out.
-
-#define JU_CHECK_IF_OUTLIER(Pjp, Index, cLevel, Pjpm)                   \
-        if (JU_DCDNOTMATCHINDEX(Index, Pjp, cLevel))                    \
-            return(j__udyInsertBranch(Pjp, Index, cLevel, Pjpm))
-
-// Check if an Index is already in a leaf or immediate, after calling
-// j__udySearchLeaf*() to set Offset:
-//
-// A non-negative Offset means the Index already exists, so return 0; otherwise
-// complement Offset to proceed.
-
-#ifdef JUDY1
-#define Pjv ignore                                      // placeholder.
-#define JU_CHECK_IF_EXISTS(Offset,ignore,Pjpm)  \
-        {                                       \
-            if ((Offset) >= 0) return(0);       \
-            (Offset) = ~(Offset);               \
-        }
-#else
-// For JudyL, also set the value area pointer in the Pjpm:
-
-#define JU_CHECK_IF_EXISTS(Offset,Pjv,Pjpm)             \
-        {                                               \
-            if ((Offset) >= 0)                          \
-            {                                           \
-                (Pjpm)->jpm_PValue = (Pjv) + (Offset);  \
-                return(0);                              \
-            }                                           \
-            (Offset) = ~(Offset);                       \
-        }
-#endif
-
-
-// ****************************************************************************
-// __ J U D Y   I N S   W A L K
-//
-// Walk the Judy tree to do a set/insert.  This is only called internally, and
-// recursively.  Unlike Judy1Test() and JudyLGet(), the extra time required for
-// recursion should be negligible compared with the total.
-//
-// Return -1 for error (details in JPM), 0 for Index already inserted, 1 for
-// new Index inserted.
-
-FUNCTION static int j__udyInsWalk(
-        Pjp_t   Pjp,            // current JP to descend.
-        Word_t  Index,          // to insert.
-        Pjpm_t  Pjpm)           // for returning info to top Level.
-{
-        uint8_t digit;          // from Index, current offset into a branch.
-        jp_t    newJP;          // for creating a new Immed JP.
-        Word_t  exppop1;        // expanse (leaf) population.
-        int     retcode;        // return codes:  -1, 0, 1.
-
-#ifdef SUBEXPCOUNTS
-// Pointer to BranchB/U subexpanse counter:
-//
-// Note:  Very important for performance reasons (avoids cache fills).
-
-        PWord_t PSubExp = (PWord_t) NULL;
-#endif
-
-ContinueInsWalk:                // for modifying state without recursing.
-
-#ifdef TRACEJP
-        JudyPrintJP(Pjp, "i", __LINE__);
-#endif
-
-        switch (JU_JPTYPE(Pjp)) // entry:  Pjp, Index.
-        {
-
-
-// ****************************************************************************
-// JPNULL*:
-//
-// Convert JP in place from current null type to cJU_JPIMMED_*_01 by
-// calculating new JP type.
-
-        case cJU_JPNULL1:
-        case cJU_JPNULL2:
-        case cJU_JPNULL3:
-#ifdef JU_64BIT
-        case cJU_JPNULL4:
-        case cJU_JPNULL5:
-        case cJU_JPNULL6:
-        case cJU_JPNULL7:
-#endif
-            assert((Pjp->jp_Addr) == 0);
-            JU_JPSETADT(Pjp, 0, Index, JU_JPTYPE(Pjp) + cJU_JPIMMED_1_01 - cJU_JPNULL1);
-#ifdef JUDYL
-            // value area is first word of new Immed_01 JP:
-            Pjpm->jpm_PValue = (Pjv_t) (&(Pjp->jp_Addr));
-#endif
-            return(1);
-
-
-// ****************************************************************************
-// JPBRANCH_L*:
-//
-// If the new Index is not an outlier to the branchs expanse, and the branch
-// should not be converted to uncompressed, extract the digit and record the
-// Immediate type to create for a new Immed JP, before going to common code.
-//
-// Note:  JU_CHECK_IF_OUTLIER() is a no-op for BranchB3[7] on 32[64]-bit.
-
-#define JU_BRANCH_OUTLIER(DIGIT,POP1,cLEVEL,PJP,INDEX,PJPM)  \
-        JU_CHECK_IF_OUTLIER(PJP, INDEX, cLEVEL, PJPM);       \
-        (DIGIT) = JU_DIGITATSTATE(INDEX, cLEVEL);            \
-        (POP1)  = JU_JPBRANCH_POP0(PJP, cLEVEL)
-
-        case cJU_JPBRANCH_L2:
-            JU_BRANCH_OUTLIER(digit, exppop1, 2, Pjp, Index, Pjpm);
-            goto JudyBranchL;
-
-        case cJU_JPBRANCH_L3:
-            JU_BRANCH_OUTLIER(digit, exppop1, 3, Pjp, Index, Pjpm);
-            goto JudyBranchL;
-
-#ifdef JU_64BIT
-        case cJU_JPBRANCH_L4:
-            JU_BRANCH_OUTLIER(digit, exppop1, 4, Pjp, Index, Pjpm);
-            goto JudyBranchL;
-
-        case cJU_JPBRANCH_L5:
-            JU_BRANCH_OUTLIER(digit, exppop1, 5, Pjp, Index, Pjpm);
-            goto JudyBranchL;
-
-        case cJU_JPBRANCH_L6:
-            JU_BRANCH_OUTLIER(digit, exppop1, 6, Pjp, Index, Pjpm);
-            goto JudyBranchL;
-
-        case cJU_JPBRANCH_L7:
-            JU_BRANCH_OUTLIER(digit, exppop1, 7, Pjp, Index, Pjpm);
-            goto JudyBranchL;
-#endif
-
-// Similar to common code above, but no outlier check is needed, and the Immed
-// type depends on the word size:
-
-        case cJU_JPBRANCH_L:
-        {
-            Pjbl_t PjblRaw;     // pointer to old linear branch.
-            Pjbl_t Pjbl;
-            Pjbu_t PjbuRaw;     // pointer to new uncompressed branch.
-            Pjbu_t Pjbu;
-            Word_t numJPs;      // number of JPs = populated expanses.
-            int    offset;      // in branch.
-
-            digit = JU_DIGITATSTATE(Index, cJU_ROOTSTATE);
-            exppop1 = Pjpm->jpm_Pop0;
-
-            // fall through:
-
-// COMMON CODE FOR LINEAR BRANCHES:
-//
-// Come here with digit and exppop1 already set.
-
-JudyBranchL:
-            PjblRaw = (Pjbl_t) (Pjp->jp_Addr);
-            Pjbl    = P_JBL(PjblRaw);
-
-// If population under this branch greater than:
-
-            if (exppop1 > JU_BRANCHL_MAX_POP)
-                goto ConvertBranchLtoU;
-
-            numJPs = Pjbl->jbl_NumJPs;
-
-            if ((numJPs == 0) || (numJPs > cJU_BRANCHLMAXJPS))
-            {
-                JU_SET_ERRNO_NONNULL(Pjpm, JU_ERRNO_CORRUPT);
-                return(-1);
-            }
-
-// Search for a match to the digit:
-
-            offset = j__udySearchLeaf1((Pjll_t) (Pjbl->jbl_Expanse), numJPs,
-                                       digit);
-
-// If Index is found, offset is into an array of 1..cJU_BRANCHLMAXJPS JPs:
-
-            if (offset >= 0)
-            {
-                Pjp = (Pjbl->jbl_jp) + offset;  // address of next JP.
-                break;                          // continue walk.
-            }
-
-// Expanse is missing (not populated) for the passed Index, so insert an Immed
-// -- if theres room:
-
-            if (numJPs < cJU_BRANCHLMAXJPS)
-            {
-                offset = ~offset;       // insertion offset.
-
-                JU_JPSETADT(&newJP, 0, Index,
-                        JU_JPTYPE(Pjp) + cJU_JPIMMED_1_01-cJU_JPBRANCH_L2);
-
-                JU_INSERTINPLACE(Pjbl->jbl_Expanse, numJPs, offset, digit);
-                JU_INSERTINPLACE(Pjbl->jbl_jp,      numJPs, offset, newJP);
-
-                DBGCODE(JudyCheckSorted((Pjll_t) (Pjbl->jbl_Expanse),
-                                        numJPs + 1, /* IndexSize = */ 1);)
-                ++(Pjbl->jbl_NumJPs);
-#ifdef JUDYL
-                // value area is first word of new Immed 01 JP:
-                Pjpm->jpm_PValue = (Pjv_t) ((Pjbl->jbl_jp) + offset);
-#endif
-                return(1);
-            }
-
-
-// MAXED OUT LINEAR BRANCH, CONVERT TO A BITMAP BRANCH, THEN INSERT:
-//
-// Copy the linear branch to a bitmap branch.
-//
-// TBD:  Consider renaming j__udyCreateBranchB() to j__udyConvertBranchLtoB().
-
-            assert((numJPs) <= cJU_BRANCHLMAXJPS);
-
-            if (j__udyCreateBranchB(Pjp, Pjbl->jbl_jp, Pjbl->jbl_Expanse,
-                                    numJPs, Pjpm) == -1)
-            {
-                return(-1);
-            }
-
-// Convert jp_Type from linear branch to equivalent bitmap branch:
-
-            Pjp->jp_Type += cJU_JPBRANCH_B - cJU_JPBRANCH_L;
-
-            j__udyFreeJBL(PjblRaw, Pjpm);       // free old BranchL.
-
-// Having changed branch types, now do the insert in the new branch type:
-
-            goto ContinueInsWalk;
-
-
-// OPPORTUNISTICALLY CONVERT FROM BRANCHL TO BRANCHU:
-//
-// Memory efficiency is no object because the branchs pop1 is large enough, so
-// speed up array access.  Come here with PjblRaw set.  Note:  This is goto
-// code because the previous block used to fall through into it as well, but no
-// longer.
-
-ConvertBranchLtoU:
-
-// Allocate memory for an uncompressed branch:
-
-            if ((PjbuRaw = j__udyAllocJBU(Pjpm)) == (Pjbu_t) NULL)
-                return(-1);
-            Pjbu = P_JBU(PjbuRaw);
-
-// Set the proper NULL type for most of the uncompressed branchs JPs:
-
-            JU_JPSETADT(&newJP, 0, 0, 
-                    JU_JPTYPE(Pjp) - cJU_JPBRANCH_L2 + cJU_JPNULL1);
-
-// Initialize:  Pre-set uncompressed branch to mostly JPNULL*s:
-
-            for (numJPs = 0; numJPs < cJU_BRANCHUNUMJPS; ++numJPs)
-                Pjbu->jbu_jp[numJPs] = newJP;
-
-// Copy JPs from linear branch to uncompressed branch:
-
-            {
-#ifdef SUBEXPCOUNTS
-                Word_t popmask = cJU_POP0MASK(JU_JPTYPE(Pjp))
-                                             - cJU_JPBRANCH_L2 - 2;
-
-                for (numJPs = 0; numJPs < cJU_NUMSUBEXPU; ++numJPs)
-                    Pjbu->jbu_subPop1[numJPs] = 0;
-#endif
-                for (numJPs = 0; numJPs < Pjbl->jbl_NumJPs; ++numJPs)
-                {
-                    Pjp_t Pjp1           = &(Pjbl->jbl_jp[numJPs]);
-                    offset               = Pjbl->jbl_Expanse[numJPs];
-                    Pjbu->jbu_jp[offset] = *Pjp1;
-#ifdef SUBEXPCOUNTS
-                    Pjbu->jbu_subPop1[offset/cJU_NUMSUBEXPU] +=
-                        JU_JPDCDPOP0(Pjp1) & popmask + 1;
-#endif
-                }
-            }
-            j__udyFreeJBL(PjblRaw, Pjpm);               // free old BranchL.
-
-// Plug new values into parent JP:
-
-            Pjp->jp_Addr  = (Word_t) PjbuRaw;
-            Pjp->jp_Type += cJU_JPBRANCH_U - cJU_JPBRANCH_L;    // to BranchU.
-
-// Save global population of last BranchU conversion:
-
-            Pjpm->jpm_LastUPop0 = Pjpm->jpm_Pop0;
-            goto ContinueInsWalk;
-
-        } // case cJU_JPBRANCH_L.
-
-
-// ****************************************************************************
-// JPBRANCH_B*:
-//
-// If the new Index is not an outlier to the branchs expanse, extract the
-// digit and record the Immediate type to create for a new Immed JP, before
-// going to common code.
-//
-// Note:  JU_CHECK_IF_OUTLIER() is a no-op for BranchB3[7] on 32[64]-bit.
-
-        case cJU_JPBRANCH_B2:
-            JU_BRANCH_OUTLIER(digit, exppop1, 2, Pjp, Index, Pjpm);
-            goto JudyBranchB;
-
-        case cJU_JPBRANCH_B3:
-            JU_BRANCH_OUTLIER(digit, exppop1, 3, Pjp, Index, Pjpm);
-            goto JudyBranchB;
-
-#ifdef JU_64BIT
-        case cJU_JPBRANCH_B4:
-            JU_BRANCH_OUTLIER(digit, exppop1, 4, Pjp, Index, Pjpm);
-            goto JudyBranchB;
-
-        case cJU_JPBRANCH_B5:
-            JU_BRANCH_OUTLIER(digit, exppop1, 5, Pjp, Index, Pjpm);
-            goto JudyBranchB;
-
-        case cJU_JPBRANCH_B6:
-            JU_BRANCH_OUTLIER(digit, exppop1, 6, Pjp, Index, Pjpm);
-            goto JudyBranchB;
-
-        case cJU_JPBRANCH_B7:
-            JU_BRANCH_OUTLIER(digit, exppop1, 7, Pjp, Index, Pjpm);
-            goto JudyBranchB;
-#endif
-
-        case cJU_JPBRANCH_B:
-        {
-            Pjbb_t    Pjbb;             // pointer to bitmap branch.
-            Pjbb_t    PjbbRaw;          // pointer to bitmap branch.
-            Pjp_t     Pjp2Raw;          // 1 of N arrays of JPs.
-            Pjp_t     Pjp2;             // 1 of N arrays of JPs.
-            Word_t    subexp;           // 1 of N subexpanses in bitmap.
-            BITMAPB_t bitmap;           // for one subexpanse.
-            BITMAPB_t bitmask;          // bit set for Indexs digit.
-            Word_t    numJPs;           // number of JPs = populated expanses.
-            int       offset;           // in bitmap branch.
-
-// Similar to common code above, but no outlier check is needed, and the Immed
-// type depends on the word size:
-
-            digit   = JU_DIGITATSTATE(Index, cJU_ROOTSTATE);
-            exppop1 = Pjpm->jpm_Pop0;
-
-            // fall through:
-
-
-// COMMON CODE FOR BITMAP BRANCHES:
-//
-// Come here with digit and exppop1 already set.
-
-JudyBranchB:
-
-// If population increment is greater than..  (300):
-
-            if ((Pjpm->jpm_Pop0 - Pjpm->jpm_LastUPop0) > JU_BTOU_POP_INCREMENT)
-            {
-
-// If total population of array is greater than..  (750):
-
-                if (Pjpm->jpm_Pop0 > JU_BRANCHB_MAX_POP)
-                {
-
-// If population under the branch is greater than..  (135):
-
-                    if (exppop1 > JU_BRANCHB_MIN_POP)
-                    {
-                        if (j__udyCreateBranchU(Pjp, Pjpm) == -1) return(-1);
-
-// Save global population of last BranchU conversion:
-
-                        Pjpm->jpm_LastUPop0 = Pjpm->jpm_Pop0;
-
-                        goto ContinueInsWalk;
-                    }
-                }
-            }
-
-// CONTINUE TO USE BRANCHB:
-//
-// Get pointer to bitmap branch (JBB):
-
-            PjbbRaw = (Pjbb_t) (Pjp->jp_Addr);
-            Pjbb    = P_JBB(PjbbRaw);
-
-// Form the Int32 offset, and Bit offset values:
-//
-// 8 bit Decode | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
-//              |SubExpanse |    Bit offset     |
-//
-// Get the 1 of 8 expanses from digit, Bits 5..7 = 1 of 8, and get the 32-bit
-// word that may have a bit set:
-
-            subexp = digit / cJU_BITSPERSUBEXPB;
-            bitmap = JU_JBB_BITMAP(Pjbb, subexp);
-
-            Pjp2Raw = JU_JBB_PJP(Pjbb, subexp);
-            Pjp2    = P_JP(Pjp2Raw);
-
-// Get the bit position that represents the desired expanse, and get the offset
-// into the array of JPs for the JP that matches the bit.
-
-            bitmask = JU_BITPOSMASKB(digit);
-            offset  = j__udyCountBitsB(bitmap & (bitmask - 1));
-
-// If JP is already in this expanse, get Pjp and continue the walk:
-
-            if (bitmap & bitmask)
-            {
-#ifdef SUBEXPCOUNTS
-                PSubExp = &(Pjbb->jbb_Counts[subexp]);  // ptr to subexp counts.
-#endif
-                Pjp =  Pjp2 + offset;
-                break;                                  // continue walk.
-            }
-
-
-// ADD NEW EXPANSE FOR NEW INDEX:
-//
-// The new expanse always an cJU_JPIMMED_*_01 containing just the new Index, so
-// finish setting up an Immed JP.
-
-            JU_JPSETADT(&newJP, 0, Index, 
-                JU_JPTYPE(Pjp) + cJU_JPIMMED_1_01-cJU_JPBRANCH_B2);
-
-// Get 1 of the 8 JP arrays and calculate number of JPs in subexpanse array:
-
-            Pjp2Raw = JU_JBB_PJP(Pjbb, subexp);
-            Pjp2    = P_JP(Pjp2Raw);
-            numJPs  = j__udyCountBitsB(bitmap);
-
-// Expand branch JP subarray in-place:
-
-            if (JU_BRANCHBJPGROWINPLACE(numJPs))
-            {
-                assert(numJPs > 0);
-                JU_INSERTINPLACE(Pjp2, numJPs, offset, newJP);
-#ifdef JUDYL
-                // value area is first word of new Immed 01 JP:
-                Pjpm->jpm_PValue = (Pjv_t) (Pjp2 + offset);
-#endif
-            }
-
-// No room, allocate a bigger bitmap branch JP subarray:
-
-            else
-            {
-                Pjp_t PjpnewRaw;
-                Pjp_t Pjpnew;
-
-                if ((PjpnewRaw = j__udyAllocJBBJP(numJPs + 1, Pjpm)) == 0)
-                    return(-1);
-                Pjpnew = P_JP(PjpnewRaw);
-
-// If there was an old JP array, then copy it, insert the new Immed JP, and
-// free the old array:
-
-                if (numJPs)
-                {
-                    JU_INSERTCOPY(Pjpnew, Pjp2, numJPs, offset, newJP);
-                    j__udyFreeJBBJP(Pjp2Raw, numJPs, Pjpm);
-#ifdef JUDYL
-                    // value area is first word of new Immed 01 JP:
-                    Pjpm->jpm_PValue = (Pjv_t) (Pjpnew + offset);
-#endif
-                }
-
-// New JP subarray; point to cJU_JPIMMED_*_01 and place it:
-
-                else
-                {
-                    assert(JU_JBB_PJP(Pjbb, subexp) == (Pjp_t) NULL);
-                     Pjp = Pjpnew;
-                    *Pjp = newJP;               // copy to new memory.
-#ifdef JUDYL
-                    // value area is first word of new Immed 01 JP:
-                    Pjpm->jpm_PValue = (Pjv_t) (&(Pjp->jp_Addr));
-#endif
-                }
-
-// Place new JP subarray in BranchB:
-
-                JU_JBB_PJP(Pjbb, subexp) = PjpnewRaw;
-
-            } // else
-
-// Set the new Indexs bit:
-
-            JU_JBB_BITMAP(Pjbb, subexp) |= bitmask;
-
-            return(1);
-
-        } // case
-
-
-// ****************************************************************************
-// JPBRANCH_U*:
-//
-// Just drop through the JP for the correct digit.  If the JP turns out to be a
-// JPNULL*, thats OK, the memory is already allocated, and the next walk
-// simply places an Immed in it.
-//
-#ifdef SUBEXPCOUNTS
-#define JU_GETSUBEXP(PSubExp,Pjbu,Digit) \
-        (PSubExp) = &((Pjbu)->jbu_subPop1[(Digit) / cJU_NUMSUBEXPU])
-#else
-#define JU_GETSUBEXP(PSubExp,Pjbu,Digit)  // null.
-#endif
-
-#define JU_JBU_PJP_SUBEXP(Pjp,PSubExp,Index,Level)              \
-        {                                                       \
-            uint8_t digit = JU_DIGITATSTATE(Index, Level);      \
-            Pjbu_t  P_jbu  = P_JBU((Pjp)->jp_Addr);             \
-            (Pjp) = &(P_jbu->jbu_jp[digit]);                    \
-            JU_GETSUBEXP(PSubExp, P_jbu, digit);                \
-        }
-
-        case cJU_JPBRANCH_U2:
-            JU_CHECK_IF_OUTLIER(Pjp, Index, 2, Pjpm);
-            JU_JBU_PJP_SUBEXP(Pjp, PSubExp, Index, 2);
-            break;
-
-#ifdef JU_64BIT
-        case cJU_JPBRANCH_U3:
-            JU_CHECK_IF_OUTLIER(Pjp, Index, 3, Pjpm);
-            JU_JBU_PJP_SUBEXP(Pjp, PSubExp, Index, 3);
-            break;
-
-        case cJU_JPBRANCH_U4:
-            JU_CHECK_IF_OUTLIER(Pjp, Index, 4, Pjpm);
-            JU_JBU_PJP_SUBEXP(Pjp, PSubExp, Index, 4);
-            break;
-
-        case cJU_JPBRANCH_U5:
-            JU_CHECK_IF_OUTLIER(Pjp, Index, 5, Pjpm);
-            JU_JBU_PJP_SUBEXP(Pjp, PSubExp, Index, 5);
-            break;
-
-        case cJU_JPBRANCH_U6:
-            JU_CHECK_IF_OUTLIER(Pjp, Index, 6, Pjpm);
-            JU_JBU_PJP_SUBEXP(Pjp, PSubExp, Index, 6);
-            break;
-
-        case cJU_JPBRANCH_U7:
-            JU_JBU_PJP_SUBEXP(Pjp, PSubExp, Index, 7);
-#else
-        case cJU_JPBRANCH_U3:
-            JU_JBU_PJP_SUBEXP(Pjp, PSubExp, Index, 3);
-#endif
-            break;
-
-        case cJU_JPBRANCH_U:
-            JU_JBU_PJP_SUBEXP(Pjp, PSubExp, Index, cJU_ROOTSTATE);
-            break;
-
-
-// ****************************************************************************
-// JPLEAF*:
-//
-// COMMON CODE FRAGMENTS TO MINIMIZE REDUNDANCY BELOW:
-//
-// These are necessary to support performance by function and loop unrolling
-// while avoiding huge amounts of nearly identical code.
-//
-// Prepare to handle a linear leaf:  Check for an outlier; set pop1 and pointer
-// to leaf:
-
-#ifdef JUDY1
-#define JU_LEAFVALUE(Pjv)                       // null.
-#define JU_LEAFPREPVALUE(Pjv, ValueArea)        // null.
-#else
-#define JU_LEAFVALUE(Pjv)                Pjv_t Pjv
-#define JU_LEAFPREPVALUE(Pjv, ValueArea) (Pjv) = ValueArea(Pleaf, exppop1)
-#endif
-
-#define JU_LEAFPREP(cIS,Type,MaxPop1,ValueArea)         \
-        Pjll_t  PjllRaw;                                \
-        Type    Pleaf;  /* specific type */             \
-        int     offset;                                 \
-        JU_LEAFVALUE(Pjv);                              \
-                                                        \
-        JU_CHECK_IF_OUTLIER(Pjp, Index, cIS, Pjpm);     \
-                                                        \
-        exppop1 = JU_JPLEAF_POP0(Pjp) + 1;              \
-        assert(exppop1 <= (MaxPop1));                   \
-        PjllRaw = (Pjll_t) (Pjp->jp_Addr);              \
-        Pleaf   = (Type) P_JLL(PjllRaw);                \
-        JU_LEAFPREPVALUE(Pjv, ValueArea)
-
-// Add to, or grow, a linear leaf:  Find Index position; if the Index is
-// absent, if theres room in the leaf, insert the Index [and value of 0] in
-// place, otherwise grow the leaf:
-//
-// Note:  These insertions always take place with whole words, using
-// JU_INSERTINPLACE() or JU_INSERTCOPY().
-
-#ifdef JUDY1
-#define JU_LEAFGROWVALUEADD(Pjv,ExpPop1,Offset)  // null.
-#else
-#define JU_LEAFGROWVALUEADD(Pjv,ExpPop1,Offset)         \
-        JU_INSERTINPLACE(Pjv, ExpPop1, Offset, 0);      \
-        Pjpm->jpm_PValue = (Pjv) + (Offset)
-#endif
-
-#ifdef JUDY1
-#define JU_LEAFGROWVALUENEW(ValueArea,Pjv,ExpPop1,Offset)  // null.
-#else
-#define JU_LEAFGROWVALUENEW(ValueArea,Pjv,ExpPop1,Offset)               \
-        {                                                               \
-            Pjv_t Pjvnew = ValueArea(Pleafnew, (ExpPop1) + 1);          \
-            JU_INSERTCOPY(Pjvnew, Pjv, ExpPop1, Offset, 0);             \
-            Pjpm->jpm_PValue = (Pjvnew) + (Offset);                     \
-        }
-#endif
-
-#define JU_LEAFGROW(cIS,Type,MaxPop1,Search,ValueArea,GrowInPlace,      \
-                    InsertInPlace,InsertCopy,Alloc,Free)                \
-                                                                        \
-        offset = Search(Pleaf, exppop1, Index);                         \
-        JU_CHECK_IF_EXISTS(offset, Pjv, Pjpm);                          \
-                                                                        \
-        if (GrowInPlace(exppop1))       /* add to current leaf */       \
-        {                                                               \
-            InsertInPlace(Pleaf, exppop1, offset, Index);               \
-            JU_LEAFGROWVALUEADD(Pjv, exppop1, offset);                  \
-            DBGCODE(JudyCheckSorted((Pjll_t) Pleaf, exppop1 + 1, cIS);) \
-            return(1);                                                  \
-        }                                                               \
-                                                                        \
-        if (exppop1 < (MaxPop1))        /* grow to new leaf */          \
-        {                                                               \
-            Pjll_t PjllnewRaw;                                          \
-            Type   Pleafnew;                                            \
-            if ((PjllnewRaw = Alloc(exppop1 + 1, Pjpm)) == 0) return(-1); \
-            Pleafnew = (Type) P_JLL(PjllnewRaw);                        \
-            InsertCopy(Pleafnew, Pleaf, exppop1, offset, Index);        \
-            JU_LEAFGROWVALUENEW(ValueArea, Pjv, exppop1, offset);       \
-            DBGCODE(JudyCheckSorted((Pjll_t) Pleafnew, exppop1 + 1, cIS);) \
-            Free(PjllRaw, exppop1, Pjpm);                               \
-            (Pjp->jp_Addr) = (Word_t) PjllnewRaw;                       \
-            return(1);                                                  \
-        }                                                               \
-        assert(exppop1 == (MaxPop1))
-
-// Handle linear leaf overflow (cascade):  Splay or compress into smaller
-// leaves:
-
-#define JU_LEAFCASCADE(MaxPop1,Cascade,Free)            \
-        if (Cascade(Pjp, Pjpm) == -1) return(-1);       \
-        Free(PjllRaw, MaxPop1, Pjpm);                   \
-        goto ContinueInsWalk
-
-// Wrapper around all of the above:
-
-#define JU_LEAFSET(cIS,Type,MaxPop1,Search,GrowInPlace,InsertInPlace,   \
-                   InsertCopy,Cascade,Alloc,Free,ValueArea)             \
-        {                                                               \
-            JU_LEAFPREP(cIS,Type,MaxPop1,ValueArea);                    \
-            JU_LEAFGROW(cIS,Type,MaxPop1,Search,ValueArea,GrowInPlace,  \
-                        InsertInPlace,InsertCopy,Alloc,Free);           \
-            JU_LEAFCASCADE(MaxPop1,Cascade,Free);                       \
-        }
-
-// END OF MACROS; LEAFL CASES START HERE:
-//
-// 64-bit Judy1 does not have 1-byte leaves:
-
-#if (defined(JUDYL) || (! defined(JU_64BIT)))
-
-        case cJU_JPLEAF1:
-
-            JU_LEAFSET(1, uint8_t *, cJU_LEAF1_MAXPOP1, j__udySearchLeaf1,
-                       JU_LEAF1GROWINPLACE, JU_INSERTINPLACE, JU_INSERTCOPY,
-                       j__udyCascade1, j__udyAllocJLL1, j__udyFreeJLL1,
-                       JL_LEAF1VALUEAREA);
-
-#endif // (JUDYL || ! JU_64BIT)
-
-        case cJU_JPLEAF2:
-
-            JU_LEAFSET(2, uint16_t *, cJU_LEAF2_MAXPOP1, j__udySearchLeaf2,
-                       JU_LEAF2GROWINPLACE, JU_INSERTINPLACE, JU_INSERTCOPY,
-                       j__udyCascade2, j__udyAllocJLL2, j__udyFreeJLL2,
-                       JL_LEAF2VALUEAREA);
-
-        case cJU_JPLEAF3:
-
-            JU_LEAFSET(3, uint8_t *, cJU_LEAF3_MAXPOP1, j__udySearchLeaf3,
-                       JU_LEAF3GROWINPLACE, JU_INSERTINPLACE3, JU_INSERTCOPY3,
-                       j__udyCascade3, j__udyAllocJLL3, j__udyFreeJLL3,
-                       JL_LEAF3VALUEAREA);
-
-#ifdef JU_64BIT
-        case cJU_JPLEAF4:
-
-            JU_LEAFSET(4, uint32_t *, cJU_LEAF4_MAXPOP1, j__udySearchLeaf4,
-                       JU_LEAF4GROWINPLACE, JU_INSERTINPLACE, JU_INSERTCOPY,
-                       j__udyCascade4, j__udyAllocJLL4, j__udyFreeJLL4,
-                       JL_LEAF4VALUEAREA);
-
-        case cJU_JPLEAF5:
-
-            JU_LEAFSET(5, uint8_t *, cJU_LEAF5_MAXPOP1, j__udySearchLeaf5,
-                       JU_LEAF5GROWINPLACE, JU_INSERTINPLACE5, JU_INSERTCOPY5,
-                       j__udyCascade5, j__udyAllocJLL5, j__udyFreeJLL5,
-                       JL_LEAF5VALUEAREA);
-
-        case cJU_JPLEAF6:
-
-            JU_LEAFSET(6, uint8_t *, cJU_LEAF6_MAXPOP1, j__udySearchLeaf6,
-                       JU_LEAF6GROWINPLACE, JU_INSERTINPLACE6, JU_INSERTCOPY6,
-                       j__udyCascade6, j__udyAllocJLL6, j__udyFreeJLL6,
-                       JL_LEAF6VALUEAREA);
-
-        case cJU_JPLEAF7:
-
-            JU_LEAFSET(7, uint8_t *, cJU_LEAF7_MAXPOP1, j__udySearchLeaf7,
-                       JU_LEAF7GROWINPLACE, JU_INSERTINPLACE7, JU_INSERTCOPY7,
-                       j__udyCascade7, j__udyAllocJLL7, j__udyFreeJLL7,
-                       JL_LEAF7VALUEAREA);
-#endif // JU_64BIT
-
-
-// ****************************************************************************
-// JPLEAF_B1:
-//
-// 8 bit Decode | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
-//              |SubExpanse |    Bit offset     |
-//
-// Note:  For JudyL, values are stored in 8 subexpanses, each a linear word
-// array of up to 32 values each.
-
-        case cJU_JPLEAF_B1:
-        {
-#ifdef JUDYL
-            Pjv_t     PjvRaw;           // pointer to value part of the leaf.
-            Pjv_t     Pjv;              // pointer to value part of the leaf.
-            Pjv_t     PjvnewRaw;        // new value area.
-            Pjv_t     Pjvnew;           // new value area.
-            Word_t    subexp;           // 1 of 8 subexpanses in bitmap.
-            Pjlb_t    Pjlb;             // pointer to bitmap part of the leaf.
-            BITMAPL_t bitmap;           // for one subexpanse.
-            BITMAPL_t bitmask;          // bit set for Indexs digit.
-            int       offset;           // of index in value area.
-#endif
-
-            JU_CHECK_IF_OUTLIER(Pjp, Index, 1, Pjpm);
-
-#ifdef JUDY1
-
-// If Index (bit) is already set, return now:
-
-            if (JU_BITMAPTESTL(P_JLB(Pjp->jp_Addr), Index)) return(0);
-
-// If bitmap is not full, set the new Indexs bit; otherwise convert to a Full:
-
-            if ((exppop1 = JU_JPLEAF_POP0(Pjp) + 1)
-              < cJU_JPFULLPOPU1_POP0)
-            {
-                JU_BITMAPSETL(P_JLB(Pjp->jp_Addr), Index);
-            }
-            else
-            {
-                j__udyFreeJLB1((Pjlb_t) (Pjp->jp_Addr), Pjpm);  // free LeafB1.
-                Pjp->jp_Type = cJ1_JPFULLPOPU1;
-                Pjp->jp_Addr = 0;
-            }
-
-#else // JUDYL
-
-// This is very different from Judy1 because of the need to return a value area
-// even for an existing Index, or manage the value area for a new Index, and
-// because JudyL has no Full type:
-
-// Get last byte to decode from Index, and pointer to bitmap leaf:
-
-            digit = JU_DIGITATSTATE(Index, 1);
-            Pjlb  = P_JLB(Pjp->jp_Addr);
-
-// Prepare additional values:
-
-            subexp  = digit / cJU_BITSPERSUBEXPL;       // which subexpanse.
-            bitmap  = JU_JLB_BITMAP(Pjlb, subexp);      // subexps 32-bit map.
-            PjvRaw  = JL_JLB_PVALUE(Pjlb, subexp);      // corresponding values.
-            Pjv     = P_JV(PjvRaw);                     // corresponding values.
-            bitmask = JU_BITPOSMASKL(digit);            // mask for Index.
-            offset  = j__udyCountBitsL(bitmap & (bitmask - 1)); // of Index.
-
-// If Index already exists, get value pointer and exit:
-
-            if (bitmap & bitmask)
-            {
-                assert(Pjv);
-                Pjpm->jpm_PValue = Pjv + offset;        // existing value.
-                return(0);
-            }
-
-// Get the total bits set = expanse population of Value area:
-
-            exppop1 = j__udyCountBitsL(bitmap);
-
-// If the value area can grow in place, do it:
-
-            if (JL_LEAFVGROWINPLACE(exppop1))
-            {
-                JU_INSERTINPLACE(Pjv, exppop1, offset, 0);
-                JU_JLB_BITMAP(Pjlb, subexp) |= bitmask;  // set Indexs bit.
-                Pjpm->jpm_PValue = Pjv + offset;          // new value area.
-                return(1);
-            }
-
-// Increase size of value area:
-
-            if ((PjvnewRaw = j__udyLAllocJV(exppop1 + 1, Pjpm))
-             == (Pjv_t) NULL) return(-1);
-            Pjvnew = P_JV(PjvnewRaw);
-
-            if (exppop1)                // have existing value area.
-            {
-                assert(Pjv);
-                JU_INSERTCOPY(Pjvnew, Pjv, exppop1, offset, 0);
-                Pjpm->jpm_PValue = Pjvnew + offset;
-                j__udyLFreeJV(PjvRaw, exppop1, Pjpm);   // free old values.
-            }
-            else                        // first index, new value area:
-            {
-                 Pjpm->jpm_PValue   = Pjvnew;
-                *(Pjpm->jpm_PValue) = 0;
-            }
-
-// Set bit for new Index and place new leaf value area in bitmap:
-
-            JU_JLB_BITMAP(Pjlb, subexp) |= bitmask;
-            JL_JLB_PVALUE(Pjlb, subexp)  = PjvnewRaw;
-
-#endif // JUDYL
-
-            return(1);
-
-        } // case
-
-
-#ifdef JUDY1
-// ****************************************************************************
-// JPFULLPOPU1:
-//
-// If Index is not an outlier, then by definition its already set.
-
-        case cJ1_JPFULLPOPU1:
-
-            JU_CHECK_IF_OUTLIER(Pjp, Index, 1, Pjpm);
-            return(0);
-#endif
-
-
-// ****************************************************************************
-// JPIMMED*:
-//
-// This is some of the most complex code in Judy considering Judy1 versus JudyL
-// and 32-bit versus 64-bit variations.  The following comments attempt to make
-// this clearer.
-//
-// Of the 2 words in a JP, for immediate indexes Judy1 can use 2 words - 1 byte
-// = 7 [15] bytes, but JudyL can only use 1 word - 1 byte = 3 [7] bytes because
-// the other word is needed for a value area or a pointer to a value area.
-//
-// For both Judy1 and JudyL, cJU_JPIMMED_*_01 indexes are in word 2; otherwise
-// for Judy1 only, a list of 2 or more indexes starts in word 1.  JudyL keeps
-// the list in word 2 because word 1 is a pointer (to a LeafV, that is, a leaf
-// containing only values).  Furthermore, cJU_JPIMMED_*_01 indexes are stored
-// all-but-first-byte in jp_DcdPopO, not just the Index Sizes bytes.
-//
-// TBD:  This can be confusing because Doug didnt use data structures for it.
-// Instead he often directly accesses Pjp for the first word and jp_DcdPopO for
-// the second word.  It would be nice to use data structs, starting with
-// jp_1Index and jp_LIndex where possible.
-//
-// Maximum Immed JP types for Judy1/JudyL, depending on Index Size (cIS):
-//
-//          32-bit  64-bit
-//
-//    bytes:  7/ 3   15/ 7   (Judy1/JudyL)
-//
-//    cIS
-//    1_     07/03   15/07   (as in: cJ1_JPIMMED_1_07)
-//    2_     03/01   07/03
-//    3_     02/01   05/02
-//    4_             03/01
-//    5_             03/01
-//    6_             02/01
-//    7_             02/01
-//
-// State transitions while inserting an Index, matching the above table:
-// (Yes, this is very terse...  Study it and it will make sense.)
-// (Note, parts of this diagram are repeated below for quick reference.)
-//
-//      +-- reformat JP here for Judy1 only, from word-2 to word-1
-//      |
-//      |                  JUDY1 || JU_64BIT        JUDY1 && JU_64BIT
-//      V
-// 1_01 => 1_02 => 1_03 => [ 1_04 => ... => 1_07 => [ 1_08..15 => ]] Leaf1 (*)
-// 2_01 =>                 [ 2_02 => 2_03 =>        [ 2_04..07 => ]] Leaf2
-// 3_01 =>                 [ 3_02 =>                [ 3_03..05 => ]] Leaf3
-// JU_64BIT only:
-// 4_01 =>                                         [[ 4_02..03 => ]] Leaf4
-// 5_01 =>                                         [[ 5_02..03 => ]] Leaf5
-// 6_01 =>                                         [[ 6_02     => ]] Leaf6
-// 7_01 =>                                         [[ 7_02     => ]] Leaf7
-//
-// (*) For Judy1 & 64-bit, go directly from cJU_JPIMMED_1_15 to a LeafB1; skip
-//     Leaf1, as described in Judy1.h regarding cJ1_JPLEAF1.
-
-
-// COMMON CODE FRAGMENTS TO MINIMIZE REDUNDANCY BELOW:
-//
-// These are necessary to support performance by function and loop unrolling
-// while avoiding huge amounts of nearly identical code.
-//
-// The differences between Judy1 and JudyL with respect to value area handling
-// are just too large for completely common code between them...  Oh well, some
-// big ifdefs follow.  However, even in the following ifdefd code, use cJU_*,
-// JU_*, and Judy*() instead of cJ1_* / cJL_*, J1_* / JL_*, and
-// Judy1*()/JudyL*(), for minimum diffs.
-//
-// Handle growth of cJU_JPIMMED_*_01 to cJU_JPIMMED_*_02, for an even or odd
-// Index Size (cIS), given oldIndex, Index, and Pjll in the context:
-//
-// Put oldIndex and Index in their proper order.  For odd indexes, must copy
-// bytes.
-
-#ifdef JUDY1
-
-#define JU_IMMSET_01_COPY_EVEN(ignore1,ignore2) \
-        if (oldIndex < Index) { Pjll[0] = oldIndex; Pjll[1] = Index;    } \
-        else                  { Pjll[0] = Index;    Pjll[1] = oldIndex; }
-
-#define JU_IMMSET_01_COPY_ODD(cIS,CopyWord)     \
-        if (oldIndex < Index)                   \
-        {                                       \
-            CopyWord(Pjll + 0,     oldIndex);   \
-            CopyWord(Pjll + (cIS), Index);      \
-        }                                       \
-        else                                    \
-        {                                       \
-            CopyWord(Pjll + 0,    Index);       \
-            CopyWord(Pjll + (cIS), oldIndex);   \
-        }
-
-// The "real" *_01 Copy macro:
-//
-// Trim the high byte off Index, look for a match with the old Index, and if
-// none, insert the new Index in the leaf in the correct place, given Pjp and
-// Index in the context.
-//
-// Note:  A single immediate index lives in the jp_DcdPopO field, but two or
-// more reside starting at Pjp->jp_1Index.
-
-#define JU_IMMSET_01_COPY(cIS,LeafType,NewJPType,Copy,CopyWord) \
-        {                                                       \
-            LeafType Pjll;                                      \
-            Word_t   oldIndex = JU_JPDCDPOP0(Pjp);              \
-                                                                \
-            Index = JU_TRIMTODCDSIZE(Index);                    \
-            if (oldIndex == Index) return(0);                   \
-                                                                \
-            Pjll = (LeafType) (Pjp->jp_1Index);                 \
-            Copy(cIS,CopyWord);                                 \
-            DBGCODE(JudyCheckSorted(Pjll, 2, cIS);)             \
-                                                                \
-            Pjp->jp_Type = (NewJPType);                         \
-            return(1);                                          \
-        }
-
-#else // JUDYL
-
-// Variations to also handle value areas; see comments above:
-//
-// For JudyL, Pjv (start of value area) and oldValue are also in the context;
-// leave Pjv set to the value area for Index.
-
-#define JU_IMMSET_01_COPY_EVEN(cIS,CopyWord)    \
-        if (oldIndex < Index)                   \
-        {                                       \
-            Pjll[0] = oldIndex;                 \
-            Pjv [0] = oldValue;                 \
-            Pjll[1] = Index;                    \
-            ++Pjv;                              \
-        }                                       \
-        else                                    \
-        {                                       \
-            Pjll[0] = Index;                    \
-            Pjll[1] = oldIndex;                 \
-            Pjv [1] = oldValue;                 \
-        }
-
-#define JU_IMMSET_01_COPY_ODD(cIS,CopyWord)     \
-        if (oldIndex < Index)                   \
-        {                                       \
-            CopyWord(Pjll + 0,     oldIndex);   \
-            CopyWord(Pjll + (cIS), Index);      \
-            Pjv[0] = oldValue;                  \
-            ++Pjv;                              \
-        }                                       \
-        else                                    \
-        {                                       \
-            CopyWord(Pjll + 0,    Index);       \
-            CopyWord(Pjll + (cIS), oldIndex);   \
-            Pjv[1] = oldValue;                  \
-        }
-
-// The old value area is in the first word (*Pjp), and Pjv and Pjpm are also in
-// the context.  Also, unlike Judy1, indexes remain in word 2 (jp_LIndex),
-// meaning insert-in-place rather than copy.
-//
-// Return jpm_PValue pointing to Indexs value area.  If Index is new, allocate
-// a 2-value-leaf and attach it to the JP.
-
-#define JU_IMMSET_01_COPY(cIS,LeafType,NewJPType,Copy,CopyWord) \
-        {                                                       \
-            LeafType Pjll;                                      \
-            Word_t   oldIndex = JU_JPDCDPOP0(Pjp);              \
-            Word_t   oldValue;                                  \
-            Pjv_t    PjvRaw;                                    \
-            Pjv_t    Pjv;                                       \
-                                                                \
-            Index = JU_TRIMTODCDSIZE(Index);                    \
-                                                                \
-            if (oldIndex == Index)                              \
-            {                                                   \
-                Pjpm->jpm_PValue = (Pjv_t) Pjp;                 \
-                return(0);                                      \
-            }                                                   \
-                                                                \
-            if ((PjvRaw = j__udyLAllocJV(2, Pjpm)) == (Pjv_t) NULL) \
-                return(-1);                                     \
-            Pjv = P_JV(PjvRaw);                                 \
-                                                                \
-            oldValue       = Pjp->jp_Addr;                      \
-            (Pjp->jp_Addr) = (Word_t) PjvRaw;                   \
-            Pjll           = (LeafType) (Pjp->jp_LIndex);       \
-                                                                \
-            Copy(cIS,CopyWord);                                 \
-            DBGCODE(JudyCheckSorted(Pjll, 2, cIS);)             \
-                                                                \
-            Pjp->jp_Type   = (NewJPType);                       \
-            *Pjv             = 0;                               \
-            Pjpm->jpm_PValue = Pjv;                             \
-            return(1);                                          \
-        }
-
-// The following is a unique mix of JU_IMMSET_01() and JU_IMMSETCASCADE() for
-// going from cJU_JPIMMED_*_01 directly to a cJU_JPLEAF* for JudyL:
-//
-// If Index is not already set, allocate a leaf, copy the old and new indexes
-// into it, clear and return the new value area, and modify the current JP.
-// Note that jp_DcdPop is set to a pop0 of 0 for now, and incremented later.
-
-
-#define JU_IMMSET_01_CASCADE(cIS,LeafType,NewJPType,ValueArea,  \
-                             Copy,CopyWord,Alloc)               \
-        {                                                       \
-            Word_t   D_P0;                                      \
-            LeafType PjllRaw;                                   \
-            LeafType Pjll;                                      \
-            Word_t   oldIndex = JU_JPDCDPOP0(Pjp);              \
-            Word_t   oldValue;                                  \
-            Pjv_t    Pjv;                                       \
-                                                                \
-            Index = JU_TRIMTODCDSIZE(Index);                    \
-                                                                \
-            if (oldIndex == Index)                              \
-            {                                                   \
-                Pjpm->jpm_PValue = (Pjv_t) (&(Pjp->jp_Addr));   \
-                return(0);                                      \
-            }                                                   \
-                                                                \
-            if ((PjllRaw = (LeafType) Alloc(2, Pjpm)) == (LeafType) NULL) \
-                return(-1);                                     \
-            Pjll = (LeafType) P_JLL(PjllRaw);                   \
-            Pjv  = ValueArea(Pjll, 2);                          \
-                                                                \
-            oldValue = Pjp->jp_Addr;                            \
-                                                                \
-            Copy(cIS,CopyWord);                                 \
-            DBGCODE(JudyCheckSorted(Pjll, 2, cIS);)             \
-                                                                \
-            *Pjv = 0;                                           \
-            Pjpm->jpm_PValue  = Pjv;                            \
-            D_P0 = Index & cJU_DCDMASK(cIS); /* pop0 = 0 */     \
-            JU_JPSETADT(Pjp, (Word_t)PjllRaw, D_P0, NewJPType); \
-                                                                \
-            return(1);                                          \
-        }
-
-#endif // JUDYL
-
-// Handle growth of cJU_JPIMMED_*_[02..15]:
-
-#ifdef JUDY1
-
-// Insert an Index into an immediate JP that has room for more, if the Index is
-// not already present; given Pjp, Index, exppop1, Pjv, and Pjpm in the
-// context:
-//
-// Note:  Use this only when the JP format doesnt change, that is, going from
-// cJU_JPIMMED_X_0Y to cJU_JPIMMED_X_0Z, where X >= 2 and Y+1 = Z.
-//
-// Note:  Incrementing jp_Type is how to increase the Index population.
-
-#define JU_IMMSETINPLACE(cIS,LeafType,BaseJPType_02,Search,InsertInPlace) \
-        {                                                               \
-            LeafType Pjll;                                              \
-            int      offset;                                            \
-                                                                        \
-            exppop1 = JU_JPTYPE(Pjp) - (BaseJPType_02) + 2;             \
-            offset  = Search((Pjll_t) (Pjp->jp_1Index), exppop1, Index); \
-                                                                        \
-            JU_CHECK_IF_EXISTS(offset, ignore, Pjpm);                   \
-                                                                        \
-            Pjll = (LeafType) (Pjp->jp_1Index);                         \
-            InsertInPlace(Pjll, exppop1, offset, Index);                \
-            DBGCODE(JudyCheckSorted(Pjll, exppop1 + 1, cIS);)           \
-            ++(Pjp->jp_Type);                                           \
-            return(1);                                                  \
-        }
-
-// Insert an Index into an immediate JP that has no room for more:
-//
-// If the Index is not already present, do a cascade (to a leaf); given Pjp,
-// Index, Pjv, and Pjpm in the context.
-
-
-#define JU_IMMSETCASCADE(cIS,OldPop1,LeafType,NewJPType,                \
-                         ignore,Search,InsertCopy,Alloc)                \
-        {                                                               \
-            Word_t   D_P0;                                              \
-            Pjll_t PjllRaw;                                             \
-            Pjll_t Pjll;                                                \
-            int    offset;                                              \
-                                                                        \
-            offset = Search((Pjll_t) (Pjp->jp_1Index), (OldPop1), Index); \
-            JU_CHECK_IF_EXISTS(offset, ignore, Pjpm);                   \
-                                                                        \
-            if ((PjllRaw = Alloc((OldPop1) + 1, Pjpm)) == 0) return(-1); \
-            Pjll = P_JLL(PjllRaw);                                      \
-                                                                        \
-            InsertCopy((LeafType) Pjll, (LeafType) (Pjp->jp_1Index),    \
-                       OldPop1, offset, Index);                         \
-            DBGCODE(JudyCheckSorted(Pjll, (OldPop1) + 1, cIS);)         \
-                                                                        \
-            D_P0 = (Index & cJU_DCDMASK(cIS)) + (OldPop1) - 1;          \
-            JU_JPSETADT(Pjp, (Word_t)PjllRaw, D_P0, NewJPType);         \
-            return(1);                                                  \
-        }
-
-#else // JUDYL
-
-// Variations to also handle value areas; see comments above:
-//
-// For JudyL, Pjv (start of value area) is also in the context.
-//
-// TBD:  This code makes a true but weak assumption that a JudyL 32-bit 2-index
-// value area must be copied to a new 3-index value area.  AND it doesnt know
-// anything about JudyL 64-bit cases (cJU_JPIMMED_1_0[3-7] only) where the
-// value area can grow in place!  However, this should not break it, just slow
-// it down.
-
-#define JU_IMMSETINPLACE(cIS,LeafType,BaseJPType_02,Search,InsertInPlace) \
-        {                                                                 \
-            LeafType Pleaf;                                               \
-            int      offset;                                              \
-            Pjv_t    PjvRaw;                                              \
-            Pjv_t    Pjv;                                                 \
-            Pjv_t    PjvnewRaw;                                           \
-            Pjv_t    Pjvnew;                                              \
-                                                                          \
-            exppop1 = JU_JPTYPE(Pjp) - (BaseJPType_02) + 2;               \
-            offset  = Search((Pjll_t) (Pjp->jp_LIndex), exppop1, Index);  \
-            PjvRaw  = (Pjv_t) (Pjp->jp_Addr);                             \
-            Pjv     = P_JV(PjvRaw);                                       \
-                                                                          \
-            JU_CHECK_IF_EXISTS(offset, Pjv, Pjpm);                        \
-                                                                          \
-            if ((PjvnewRaw = j__udyLAllocJV(exppop1 + 1, Pjpm))           \
-             == (Pjv_t) NULL) return(-1);                                 \
-            Pjvnew = P_JV(PjvnewRaw);                                     \
-                                                                          \
-            Pleaf = (LeafType) (Pjp->jp_LIndex);                          \
-                                                                          \
-            InsertInPlace(Pleaf, exppop1, offset, Index);                 \
-            /* see TBD above about this: */                               \
-            JU_INSERTCOPY(Pjvnew, Pjv, exppop1, offset, 0);               \
-            DBGCODE(JudyCheckSorted(Pleaf, exppop1 + 1, cIS);)            \
-            j__udyLFreeJV(PjvRaw, exppop1, Pjpm);                         \
-            Pjp->jp_Addr     = (Word_t) PjvnewRaw;                        \
-            Pjpm->jpm_PValue = Pjvnew + offset;                           \
-                                                                          \
-            ++(Pjp->jp_Type);                                             \
-            return(1);                                                    \
-        }
-
-#define JU_IMMSETCASCADE(cIS,OldPop1,LeafType,NewJPType,                \
-                         ValueArea,Search,InsertCopy,Alloc)             \
-        {                                                               \
-            Word_t   D_P0;                                      \
-            Pjll_t PjllRaw;                                             \
-            Pjll_t Pjll;                                                \
-            int    offset;                                              \
-            Pjv_t  PjvRaw;                                              \
-            Pjv_t  Pjv;                                                 \
-            Pjv_t  Pjvnew;                                              \
-                                                                        \
-            PjvRaw = (Pjv_t) (Pjp->jp_Addr);                            \
-            Pjv    = P_JV(PjvRaw);                                      \
-            offset = Search((Pjll_t) (Pjp->jp_LIndex), (OldPop1), Index); \
-            JU_CHECK_IF_EXISTS(offset, Pjv, Pjpm);                      \
-                                                                        \
-            if ((PjllRaw = Alloc((OldPop1) + 1, Pjpm)) == 0)            \
-                return(-1);                                             \
-            Pjll = P_JLL(PjllRaw);                                      \
-            InsertCopy((LeafType) Pjll, (LeafType) (Pjp->jp_LIndex),    \
-                       OldPop1, offset, Index);                         \
-            DBGCODE(JudyCheckSorted(Pjll, (OldPop1) + 1, cIS);)         \
-                                                                        \
-            Pjvnew = ValueArea(Pjll, (OldPop1) + 1);                    \
-            JU_INSERTCOPY(Pjvnew, Pjv, OldPop1, offset, 0);             \
-            j__udyLFreeJV(PjvRaw, (OldPop1), Pjpm);                     \
-            Pjpm->jpm_PValue = Pjvnew + offset;                         \
-                                                                        \
-            D_P0 = (Index & cJU_DCDMASK(cIS)) + (OldPop1) - 1;          \
-            JU_JPSETADT(Pjp, (Word_t)PjllRaw, D_P0, NewJPType);         \
-            return(1);                                                  \
-        }
-
-#endif // JUDYL
-
-// Common convenience/shorthand wrappers around JU_IMMSET_01_COPY() for
-// even/odd index sizes:
-
-#define JU_IMMSET_01(     cIS, LeafType, NewJPType) \
-        JU_IMMSET_01_COPY(cIS, LeafType, NewJPType, JU_IMMSET_01_COPY_EVEN, \
-                          ignore)
-
-#define JU_IMMSET_01_ODD( cIS,            NewJPType, CopyWord) \
-        JU_IMMSET_01_COPY(cIS, uint8_t *, NewJPType, JU_IMMSET_01_COPY_ODD, \
-                          CopyWord)
-
-
-// END OF MACROS; IMMED CASES START HERE:
-
-// cJU_JPIMMED_*_01 cases:
-//
-// 1_01 always leads to 1_02:
-//
-// (1_01 => 1_02 => 1_03 => [ 1_04 => ... => 1_07 => [ 1_08..15 => ]] LeafL)
-
-        case cJU_JPIMMED_1_01: JU_IMMSET_01(1, uint8_t *, cJU_JPIMMED_1_02);
-
-// 2_01 leads to 2_02, and 3_01 leads to 3_02, except for JudyL 32-bit, where
-// they lead to a leaf:
-//
-// (2_01 => [ 2_02 => 2_03 => [ 2_04..07 => ]] LeafL)
-// (3_01 => [ 3_02 =>         [ 3_03..05 => ]] LeafL)
-
-#if (defined(JUDY1) || defined(JU_64BIT))
-        case cJU_JPIMMED_2_01: JU_IMMSET_01(2, uint16_t *, cJU_JPIMMED_2_02);
-        case cJU_JPIMMED_3_01: JU_IMMSET_01_ODD (3, cJU_JPIMMED_3_02,
-                                                 JU_COPY3_LONG_TO_PINDEX);
-#else
-        case cJU_JPIMMED_2_01:
-            JU_IMMSET_01_CASCADE(2, uint16_t *, cJU_JPLEAF2, JL_LEAF2VALUEAREA,
-                                 JU_IMMSET_01_COPY_EVEN, ignore,
-                                 j__udyAllocJLL2);
-        case cJU_JPIMMED_3_01:
-            JU_IMMSET_01_CASCADE(3, uint8_t *,  cJU_JPLEAF3, JL_LEAF3VALUEAREA,
-                                 JU_IMMSET_01_COPY_ODD,
-                                 JU_COPY3_LONG_TO_PINDEX, j__udyAllocJLL3);
-#endif
-
-#ifdef JU_64BIT
-
-// [4-7]_01 lead to [4-7]_02 for Judy1, and to leaves for JudyL:
-//
-// (4_01 => [[ 4_02..03 => ]] LeafL)
-// (5_01 => [[ 5_02..03 => ]] LeafL)
-// (6_01 => [[ 6_02 =>     ]] LeafL)
-// (7_01 => [[ 7_02 =>     ]] LeafL)
-
-#ifdef JUDY1
-        case cJU_JPIMMED_4_01: JU_IMMSET_01(4, uint32_t *, cJ1_JPIMMED_4_02);
-        case cJU_JPIMMED_5_01: JU_IMMSET_01_ODD(5, cJ1_JPIMMED_5_02,
-                                                JU_COPY5_LONG_TO_PINDEX);
-        case cJU_JPIMMED_6_01: JU_IMMSET_01_ODD(6, cJ1_JPIMMED_6_02,
-                                                JU_COPY6_LONG_TO_PINDEX);
-        case cJU_JPIMMED_7_01: JU_IMMSET_01_ODD(7, cJ1_JPIMMED_7_02,
-                                                JU_COPY7_LONG_TO_PINDEX);
-#else // JUDYL
-        case cJU_JPIMMED_4_01:
-            JU_IMMSET_01_CASCADE(4, uint32_t *, cJU_JPLEAF4, JL_LEAF4VALUEAREA,
-                                 JU_IMMSET_01_COPY_EVEN, ignore,
-                                 j__udyAllocJLL4);
-        case cJU_JPIMMED_5_01:
-            JU_IMMSET_01_CASCADE(5, uint8_t *, cJU_JPLEAF5, JL_LEAF5VALUEAREA,
-                                 JU_IMMSET_01_COPY_ODD,
-                                 JU_COPY5_LONG_TO_PINDEX, j__udyAllocJLL5);
-        case cJU_JPIMMED_6_01:
-            JU_IMMSET_01_CASCADE(6, uint8_t *, cJU_JPLEAF6, JL_LEAF6VALUEAREA,
-                                 JU_IMMSET_01_COPY_ODD,
-                                 JU_COPY6_LONG_TO_PINDEX, j__udyAllocJLL6);
-        case cJU_JPIMMED_7_01:
-            JU_IMMSET_01_CASCADE(7, uint8_t *, cJU_JPLEAF7, JL_LEAF7VALUEAREA,
-                                 JU_IMMSET_01_COPY_ODD,
-                                 JU_COPY7_LONG_TO_PINDEX, j__udyAllocJLL7);
-#endif // JUDYL
-#endif // JU_64BIT
-
-// cJU_JPIMMED_1_* cases that can grow in place:
-//
-// (1_01 => 1_02 => 1_03 => [ 1_04 => ... => 1_07 => [ 1_08..15 => ]] LeafL)
-
-        case cJU_JPIMMED_1_02:
-#if (defined(JUDY1) || defined(JU_64BIT))
-        case cJU_JPIMMED_1_03:
-        case cJU_JPIMMED_1_04:
-        case cJU_JPIMMED_1_05:
-        case cJU_JPIMMED_1_06:
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-        case cJU_JPIMMED_1_07:
-        case cJ1_JPIMMED_1_08:
-        case cJ1_JPIMMED_1_09:
-        case cJ1_JPIMMED_1_10:
-        case cJ1_JPIMMED_1_11:
-        case cJ1_JPIMMED_1_12:
-        case cJ1_JPIMMED_1_13:
-        case cJ1_JPIMMED_1_14:
-#endif
-            JU_IMMSETINPLACE(1, uint8_t *, cJU_JPIMMED_1_02, j__udySearchLeaf1,
-                             JU_INSERTINPLACE);
-
-// cJU_JPIMMED_1_* cases that must cascade:
-//
-// (1_01 => 1_02 => 1_03 => [ 1_04 => ... => 1_07 => [ 1_08..15 => ]] LeafL)
-
-#if (defined(JUDYL) && (! defined(JU_64BIT)))
-        case cJU_JPIMMED_1_03:
-            JU_IMMSETCASCADE(1, 3, uint8_t *, cJU_JPLEAF1, JL_LEAF1VALUEAREA,
-                             j__udySearchLeaf1, JU_INSERTCOPY,
-                             j__udyAllocJLL1);
-#endif
-#if (defined(JUDY1) && (! defined(JU_64BIT)))
-        case cJU_JPIMMED_1_07:
-            JU_IMMSETCASCADE(1, 7, uint8_t *, cJU_JPLEAF1, ignore,
-                             j__udySearchLeaf1, JU_INSERTCOPY,
-                             j__udyAllocJLL1);
-
-#endif
-#if (defined(JUDYL) && defined(JU_64BIT))
-        case cJU_JPIMMED_1_07:
-            JU_IMMSETCASCADE(1, 7, uint8_t *, cJU_JPLEAF1, JL_LEAF1VALUEAREA,
-                             j__udySearchLeaf1, JU_INSERTCOPY,
-                             j__udyAllocJLL1);
-
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-// Special case, as described above, go directly from Immed to LeafB1:
-
-        case cJ1_JPIMMED_1_15:
-        {
-            Word_t DcdP0;
-            int    offset;
-            Pjlb_t PjlbRaw;
-            Pjlb_t Pjlb;
-
-            offset = j__udySearchLeaf1((Pjll_t) Pjp->jp_1Index, 15, Index);
-
-            JU_CHECK_IF_EXISTS(offset, ignore, Pjpm);
-
-// Create a bitmap leaf (special case for Judy1 64-bit only, see usage):  Set
-// new Index in bitmap, copy an Immed1_15 to the bitmap, and set the parent JP
-// EXCEPT jp_DcdPopO, leaving any followup to the caller:
-
-            if ((PjlbRaw = j__udyAllocJLB1(Pjpm)) == (Pjlb_t) NULL)
-                return(-1);
-            Pjlb = P_JLB(PjlbRaw);
-
-            JU_BITMAPSETL(Pjlb, Index);
-
-            for (offset = 0; offset < 15; ++offset)
-                JU_BITMAPSETL(Pjlb, Pjp->jp_1Index[offset]);
-
-//          Set jp_DcdPopO including the current pop0; incremented later:
-            DcdP0 = (Index & cJU_DCDMASK(1)) + 15 - 1;
-            JU_JPSETADT(Pjp, (Word_t)PjlbRaw, DcdP0, cJU_JPLEAF_B1);
-
-            return(1);
-        }
-#endif
-
-// cJU_JPIMMED_[2..7]_[02..15] cases that grow in place or cascade:
-//
-// (2_01 => [ 2_02 => 2_03 => [ 2_04..07 => ]] LeafL)
-
-#if (defined(JUDY1) || defined(JU_64BIT))
-        case cJU_JPIMMED_2_02:
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-        case cJU_JPIMMED_2_03:
-        case cJ1_JPIMMED_2_04:
-        case cJ1_JPIMMED_2_05:
-        case cJ1_JPIMMED_2_06:
-#endif
-#if (defined(JUDY1) || defined(JU_64BIT))
-            JU_IMMSETINPLACE(2, uint16_t *, cJU_JPIMMED_2_02, j__udySearchLeaf2,
-                             JU_INSERTINPLACE);
-#endif
-
-#undef OLDPOP1
-#if ((defined(JUDY1) && (! defined(JU_64BIT))) || (defined(JUDYL) && defined(JU_64BIT)))
-        case cJU_JPIMMED_2_03:
-#define OLDPOP1 3
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-        case cJ1_JPIMMED_2_07:
-#define OLDPOP1 7
-#endif
-#if (defined(JUDY1) || defined(JU_64BIT))
-            JU_IMMSETCASCADE(2, OLDPOP1, uint16_t *, cJU_JPLEAF2,
-                             JL_LEAF2VALUEAREA, j__udySearchLeaf2,
-                             JU_INSERTCOPY, j__udyAllocJLL2);
-#endif
-
-// (3_01 => [ 3_02 => [ 3_03..05 => ]] LeafL)
-
-#if (defined(JUDY1) && defined(JU_64BIT))
-        case cJU_JPIMMED_3_02:
-        case cJ1_JPIMMED_3_03:
-        case cJ1_JPIMMED_3_04:
-
-            JU_IMMSETINPLACE(3, uint8_t *, cJU_JPIMMED_3_02, j__udySearchLeaf3,
-                             JU_INSERTINPLACE3);
-#endif
-
-#undef OLDPOP1
-#if ((defined(JUDY1) && (! defined(JU_64BIT))) || (defined(JUDYL) && defined(JU_64BIT)))
-        case cJU_JPIMMED_3_02:
-#define OLDPOP1 2
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-        case cJ1_JPIMMED_3_05:
-#define OLDPOP1 5
-#endif
-#if (defined(JUDY1) || defined(JU_64BIT))
-            JU_IMMSETCASCADE(3, OLDPOP1, uint8_t *, cJU_JPLEAF3,
-                             JL_LEAF3VALUEAREA, j__udySearchLeaf3,
-                             JU_INSERTCOPY3, j__udyAllocJLL3);
-#endif
-
-#if (defined(JUDY1) && defined(JU_64BIT))
-
-// (4_01 => [[ 4_02..03 => ]] LeafL)
-
-        case cJ1_JPIMMED_4_02:
-
-            JU_IMMSETINPLACE(4, uint32_t *, cJ1_JPIMMED_4_02, j__udySearchLeaf4,
-                             JU_INSERTINPLACE);
-
-        case cJ1_JPIMMED_4_03:
-
-            JU_IMMSETCASCADE(4, 3, uint32_t *, cJU_JPLEAF4, ignore,
-                             j__udySearchLeaf4, JU_INSERTCOPY,
-                             j__udyAllocJLL4);
-
-// (5_01 => [[ 5_02..03 => ]] LeafL)
-
-        case cJ1_JPIMMED_5_02:
-
-            JU_IMMSETINPLACE(5, uint8_t *, cJ1_JPIMMED_5_02, j__udySearchLeaf5,
-                             JU_INSERTINPLACE5);
-
-        case cJ1_JPIMMED_5_03:
-
-            JU_IMMSETCASCADE(5, 3, uint8_t *, cJU_JPLEAF5, ignore,
-                             j__udySearchLeaf5, JU_INSERTCOPY5,
-                             j__udyAllocJLL5);
-
-// (6_01 => [[ 6_02 => ]] LeafL)
-
-        case cJ1_JPIMMED_6_02:
-
-            JU_IMMSETCASCADE(6, 2, uint8_t *, cJU_JPLEAF6, ignore,
-                             j__udySearchLeaf6, JU_INSERTCOPY6,
-                             j__udyAllocJLL6);
-
-// (7_01 => [[ 7_02 => ]] LeafL)
-
-        case cJ1_JPIMMED_7_02:
-
-            JU_IMMSETCASCADE(7, 2, uint8_t *, cJU_JPLEAF7, ignore,
-                             j__udySearchLeaf7, JU_INSERTCOPY7,
-                             j__udyAllocJLL7);
-
-#endif // (JUDY1 && JU_64BIT)
-
-
-// ****************************************************************************
-// INVALID JP TYPE:
-
-        default: JU_SET_ERRNO_NONNULL(Pjpm, JU_ERRNO_CORRUPT); return(-1);
-
-        } // switch on JP type
-
-        {
-
-#ifdef SUBEXPCOUNTS
-
-// This code might seem strange here.  However it saves some memory read time
-// during insert (~70nS) because a pipelined processor does not need to "stall"
-// waiting for the memory read to complete.  Hope the compiler is not too smart
-// or dumb and moves the code down to where it looks like it belongs (below a
-// few lines).
-
-            Word_t SubExpCount = 0;     // current subexpanse counter.
-
-            if (PSubExp != (PWord_t) NULL)      // only if BranchB/U.
-                SubExpCount = PSubExp[0];
-#endif
-
-// PROCESS JP -- RECURSIVELY:
-//
-// For non-Immed JP types, if successful, post-increment the population count
-// at this Level.
-
-            retcode = j__udyInsWalk(Pjp, Index, Pjpm);
-
-// Successful insert, increment JP and subexpanse count:
-
-            if ((JU_JPTYPE(Pjp) < cJU_JPIMMED_1_01) && (retcode == 1))
-            {
-                jp_t   JP;
-                Word_t DcdP0;
-#ifdef SUBEXPCOUNTS
-
-// Note:  Pjp must be a pointer to a BranchB/U:
-
-                if (PSubExp != (PWord_t) NULL) PSubExp[0] = SubExpCount + 1;
-#endif
-
-                JP = *Pjp;
-                DcdP0 = JU_JPDCDPOP0(Pjp) + 1;
-                JU_JPSETADT(Pjp, JP.jp_Addr, DcdP0, JU_JPTYPE(&JP));
-            }
-        }
-        return(retcode);
-
-} // j__udyInsWalk()
-
-
-// ****************************************************************************
-// J U D Y   1   S E T
-// J U D Y   L   I N S
-//
-// Main entry point.  See the manual entry for details.
-
-#ifdef JUDY1
-FUNCTION int Judy1Set
-#else
-FUNCTION PPvoid_t JudyLIns
-#endif
-        (
-        PPvoid_t  PPArray,      // in which to insert.
-        Word_t    Index,        // to insert.
-        PJError_t PJError       // optional, for returning error info.
-        )
-{
-#ifdef JUDY1
-#define Pjv       ignore        // placeholders for macros.
-#define Pjvnew    ignore
-#else
-        Pjv_t     Pjv;          // value area in old leaf.
-        Pjv_t     Pjvnew;       // value area in new leaf.
-#endif
-        Pjpm_t    Pjpm;         // array-global info.
-        int       offset;       // position in which to store new Index.
-        Pjlw_t    Pjlw;
-
-
-// CHECK FOR NULL POINTER (error by caller):
-
-        if (PPArray == (PPvoid_t) NULL)
-        {
-            JU_SET_ERRNO(PJError, JU_ERRNO_NULLPPARRAY);
-            JUDY1CODE(return(JERRI );)
-            JUDYLCODE(return(PPJERR);)
-        }
-
-        Pjlw = P_JLW(*PPArray); // first word of leaf.
-
-// ****************************************************************************
-// PROCESS TOP LEVEL "JRP" BRANCHES AND LEAVES:
-
-// ****************************************************************************
-// JRPNULL (EMPTY ARRAY):  BUILD A LEAFW WITH ONE INDEX:
-
-// if a valid empty array (null pointer), so create an array of population == 1:
-
-        if (Pjlw == (Pjlw_t)NULL)
-        {
-            Pjlw_t Pjlwnew;
-
-            Pjlwnew = j__udyAllocJLW(1);
-            JUDY1CODE(JU_CHECKALLOC(Pjlw_t, Pjlwnew, JERRI );)
-            JUDYLCODE(JU_CHECKALLOC(Pjlw_t, Pjlwnew, PPJERR);)
-
-            Pjlwnew[0] = 1 - 1;         // pop0 = 0.
-            Pjlwnew[1] = Index;
-
-            *PPArray = (Pvoid_t) Pjlwnew;
-            DBGCODE(JudyCheckPop(*PPArray);)
-
-  JUDY1CODE(return(1); )
-  JUDYLCODE(Pjlwnew[2] = 0; )           // value area.
-  JUDYLCODE(return((PPvoid_t) (Pjlwnew + 2)); )
-
-        }  // NULL JRP
-
-// ****************************************************************************
-// LEAFW, OTHER SIZE:
-
-        if (JU_LEAFW_POP0(*PPArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW
-        {
-            Pjlw_t Pjlwnew;
-            Word_t pop1;
-
-            Pjlw = P_JLW(*PPArray);             // first word of leaf.
-            pop1 = Pjlw[0] + 1;
-
-#ifdef JUDYL
-            Pjv = JL_LEAFWVALUEAREA(Pjlw, pop1);
-#endif
-            offset = j__udySearchLeafW(Pjlw + 1, pop1, Index);
-
-            if (offset >= 0)            // index is already valid:
-            {
-                DBGCODE(JudyCheckPop(*PPArray);)
-                JUDY1CODE(return(0); )
-                JUDYLCODE(return((PPvoid_t) (Pjv + offset)); )
-            }
-
-            offset = ~offset;
-
-// Insert index in cases where no new memory is needed:
-
-            if (JU_LEAFWGROWINPLACE(pop1))
-            {
-                ++Pjlw[0];                      // increase population.
-
-                JU_INSERTINPLACE(Pjlw + 1, pop1, offset, Index);
-#ifdef JUDYL
-                JU_INSERTINPLACE(Pjv, pop1, offset, 0);
-#endif
-                DBGCODE(JudyCheckPop(*PPArray);)
-                DBGCODE(JudyCheckSorted(Pjlw + 1, pop1 + 1, cJU_ROOTSTATE);)
-
-      JUDY1CODE(return(1); )
-      JUDYLCODE(return((PPvoid_t) (Pjv + offset)); )
-            }
-
-// Insert index into a new, larger leaf:
-
-            if (pop1 < cJU_LEAFW_MAXPOP1)       // can grow to a larger leaf.
-            {
-                Pjlwnew = j__udyAllocJLW(pop1 + 1);
-                JUDY1CODE(JU_CHECKALLOC(Pjlw_t, Pjlwnew, JERRI );)
-                JUDYLCODE(JU_CHECKALLOC(Pjlw_t, Pjlwnew, PPJERR);)
-
-                Pjlwnew[0] = pop1;              // set pop0 in new leaf.
-
-                JU_INSERTCOPY(Pjlwnew + 1, Pjlw + 1, pop1, offset, Index);
-#ifdef JUDYL
-                Pjvnew = JL_LEAFWVALUEAREA(Pjlwnew, pop1 + 1);
-                JU_INSERTCOPY(Pjvnew, Pjv, pop1, offset, 0);
-#endif
-                DBGCODE(JudyCheckSorted(Pjlwnew + 1, pop1 + 1, cJU_ROOTSTATE);)
-
-                j__udyFreeJLW(Pjlw, pop1, NULL);
-
-                *PPArray = (Pvoid_t) Pjlwnew;
-                DBGCODE(JudyCheckPop(*PPArray);)
-
-      JUDY1CODE(return(1); )
-      JUDYLCODE(return((PPvoid_t) (Pjvnew + offset)); )
-            }
-
-            assert(pop1 == cJU_LEAFW_MAXPOP1);
-
-// Leaf at max size => cannot insert new index, so cascade instead:
-//
-// Upon cascading from a LEAFW leaf to the first branch, must allocate and
-// initialize a JPM.
-
-            Pjpm = j__udyAllocJPM();
-            JUDY1CODE(JU_CHECKALLOC(Pjpm_t, Pjpm, JERRI );)
-            JUDYLCODE(JU_CHECKALLOC(Pjpm_t, Pjpm, PPJERR);)
-
-            (Pjpm->jpm_Pop0)       = cJU_LEAFW_MAXPOP1 - 1;
-            (Pjpm->jpm_JP.jp_Addr) = (Word_t) Pjlw;
-
-            if (j__udyCascadeL(&(Pjpm->jpm_JP), Pjpm) == -1)
-            {
-                JU_COPY_ERRNO(PJError, Pjpm);
-                JUDY1CODE(return(JERRI );)
-                JUDYLCODE(return(PPJERR);)
-            }
-
-// Note:  No need to pass Pjpm for memory decrement; LEAFW memory is never
-// counted in a JPM at all:
-
-            j__udyFreeJLW(Pjlw, cJU_LEAFW_MAXPOP1, NULL);
-            *PPArray = (Pvoid_t) Pjpm;
-
-        } // JU_LEAFW
-
-// ****************************************************************************
-// BRANCH:
-
-        {
-            int retcode;  // really only needed for Judy1, but free for JudyL.
-
-            Pjpm = P_JPM(*PPArray);
-            retcode = j__udyInsWalk(&(Pjpm->jpm_JP), Index, Pjpm);
-
-            if (retcode == -1)
-            {
-                JU_COPY_ERRNO(PJError, Pjpm);
-                JUDY1CODE(return(JERRI );)
-                JUDYLCODE(return(PPJERR);)
-            }
-
-            if (retcode ==  1) ++(Pjpm->jpm_Pop0);  // incr total array popu.
-
-            assert(((Pjpm->jpm_JP.jp_Type) == cJU_JPBRANCH_L)
-                || ((Pjpm->jpm_JP.jp_Type) == cJU_JPBRANCH_B)
-                || ((Pjpm->jpm_JP.jp_Type) == cJU_JPBRANCH_U));
-            DBGCODE(JudyCheckPop(*PPArray);)
-
-#ifdef JUDY1
-            assert((retcode == 0) || (retcode == 1));
-            return(retcode);            // == JU_RET_*_JPM().
-#else
-            assert(Pjpm->jpm_PValue != (Pjv_t) NULL);
-            return((PPvoid_t) Pjpm->jpm_PValue);
-#endif
-        }
-        /*NOTREACHED*/
-
-} // Judy1Set() / JudyLIns()
diff --git a/libs/klib/judy/JudyInsArray.c b/libs/klib/judy/JudyInsArray.c
deleted file mode 100644
index c647ea5..0000000
--- a/libs/klib/judy/JudyInsArray.c
+++ /dev/null
@@ -1,1176 +0,0 @@
-// Copyright (C) 2000 - 2002 Hewlett-Packard Company
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the term of the GNU Lesser 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 Lesser General Public License
-// for more details.
-//
-// You should have received a copy of the GNU Lesser 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
-// _________________
-
-// TBD:  It would probably be faster for the caller if the JudyL version took
-// PIndex as an interleaved array of indexes and values rather than just
-// indexes with a separate values array (PValue), especially considering
-// indexes and values are copied here with for-loops anyway and not the
-// equivalent of memcpy().  All code could be revised to simply count by two
-// words for JudyL?  Supports "streaming" the data to/from disk better later?
-// In which case get rid of JU_ERRNO_NULLPVALUE, no longer needed, and simplify
-// the API to this code.
-// _________________
-
-// Judy1SetArray() and JudyLInsArray() functions for Judy1 and JudyL.
-// Compile with one of -DJUDY1 or -DJUDYL.
-
-#if (! (defined(JUDY1) || defined(JUDYL)))
-#error:  One of -DJUDY1 or -DJUDYL must be specified.
-#endif
-
-#ifdef JUDY1
-#include "Judy1.h"
-#else
-#include "JudyL.h"
-#endif
-
-#include "JudyPrivate1L.h"
-
-DBGCODE(extern void JudyCheckPop(Pvoid_t PArray);)
-
-
-// IMMED AND LEAF SIZE AND BRANCH TYPE ARRAYS:
-//
-// These support fast and easy lookup by level.
-
-static uint8_t immed_maxpop1[] = {
-    0,
-    cJU_IMMED1_MAXPOP1,
-    cJU_IMMED2_MAXPOP1,
-    cJU_IMMED3_MAXPOP1,
-#ifdef JU_64BIT
-    cJU_IMMED4_MAXPOP1,
-    cJU_IMMED5_MAXPOP1,
-    cJU_IMMED6_MAXPOP1,
-    cJU_IMMED7_MAXPOP1,
-#endif
-    // note:  There are no IMMEDs for whole words.
-};
-
-static uint8_t leaf_maxpop1[] = {
-    0,
-#if (defined(JUDYL) || (! defined(JU_64BIT)))
-    cJU_LEAF1_MAXPOP1,
-#else
-    0,                                  // 64-bit Judy1 has no Leaf1.
-#endif
-    cJU_LEAF2_MAXPOP1,
-    cJU_LEAF3_MAXPOP1,
-#ifdef JU_64BIT
-    cJU_LEAF4_MAXPOP1,
-    cJU_LEAF5_MAXPOP1,
-    cJU_LEAF6_MAXPOP1,
-    cJU_LEAF7_MAXPOP1,
-#endif
-    // note:  Root-level leaves are handled differently.
-};
-
-static uint8_t branchL_JPtype[] = {
-    0,
-    0,
-    cJU_JPBRANCH_L2,
-    cJU_JPBRANCH_L3,
-#ifdef JU_64BIT
-    cJU_JPBRANCH_L4,
-    cJU_JPBRANCH_L5,
-    cJU_JPBRANCH_L6,
-    cJU_JPBRANCH_L7,
-#endif
-    cJU_JPBRANCH_L,
-};
-
-static uint8_t branchB_JPtype[] = {
-    0,
-    0,
-    cJU_JPBRANCH_B2,
-    cJU_JPBRANCH_B3,
-#ifdef JU_64BIT
-    cJU_JPBRANCH_B4,
-    cJU_JPBRANCH_B5,
-    cJU_JPBRANCH_B6,
-    cJU_JPBRANCH_B7,
-#endif
-    cJU_JPBRANCH_B,
-};
-
-static uint8_t branchU_JPtype[] = {
-    0,
-    0,
-    cJU_JPBRANCH_U2,
-    cJU_JPBRANCH_U3,
-#ifdef JU_64BIT
-    cJU_JPBRANCH_U4,
-    cJU_JPBRANCH_U5,
-    cJU_JPBRANCH_U6,
-    cJU_JPBRANCH_U7,
-#endif
-    cJU_JPBRANCH_U,
-};
-
-// Subexpanse masks are similer to JU_DCDMASK() but without the need to clear
-// the first digits bits.  Avoid doing variable shifts by precomputing a
-// lookup array.
-
-static Word_t subexp_mask[] = {
-    0,
-    ~cJU_POP0MASK(1),
-    ~cJU_POP0MASK(2),
-    ~cJU_POP0MASK(3),
-#ifdef JU_64BIT
-    ~cJU_POP0MASK(4),
-    ~cJU_POP0MASK(5),
-    ~cJU_POP0MASK(6),
-    ~cJU_POP0MASK(7),
-#endif
-};
-
-
-// FUNCTION PROTOTYPES:
-
-static bool_t j__udyInsArray(Pjp_t PjpParent, int Level, PWord_t PPop1,
-                             PWord_t PIndex,
-#ifdef JUDYL
-                             Pjv_t   PValue,
-#endif
-                             Pjpm_t  Pjpm);
-
-
-// ****************************************************************************
-// J U D Y   1   S E T   A R R A Y
-// J U D Y   L   I N S   A R R A Y
-//
-// Main entry point.  See the manual entry for external overview.
-//
-// TBD:  Until thats written, note that the function returns 1 for success or
-// JERRI for serious error, including insufficient memory to build whole array;
-// use Judy*Count() to see how many were stored, the first N of the total
-// Count.  Also, since it takes Count == Pop1, it cannot handle a full array.
-// Also, "sorted" means ascending without duplicates, otherwise you get the
-// "unsorted" error.
-//
-// The purpose of these functions is to allow rapid construction of a large
-// Judy array given a sorted list of indexes (and for JudyL, corresponding
-// values).  At least one customer saw this as useful, and probably it would
-// also be useful as a sufficient workaround for fast(er) unload/reload to/from
-// disk.
-//
-// This code is written recursively for simplicity, until/unless someone
-// decides to make it faster and more complex.  Hopefully recursion is fast
-// enough simply because the function is so much faster than a series of
-// Set/Ins calls.
-
-#ifdef JUDY1
-FUNCTION int Judy1SetArray
-#else
-FUNCTION int JudyLInsArray
-#endif
-        (
-        PPvoid_t  PPArray,      // in which to insert, initially empty.
-        Word_t    Count,        // number of indexes (and values) to insert.
-const   Word_t *  const PIndex, // list of indexes to insert.
-#ifdef JUDYL
-const   Word_t *  const PValue, // list of corresponding values.
-#endif
-        PJError_t PJError       // optional, for returning error info.
-        )
-{
-        Pjlw_t    Pjlw;         // new root-level leaf.
-        Pjlw_t    Pjlwindex;    // first index in root-level leaf.
-        int       offset;       // in PIndex.
-
-
-// CHECK FOR NULL OR NON-NULL POINTER (error by caller):
-
-        if (PPArray == (PPvoid_t) NULL)
-        { JU_SET_ERRNO(PJError, JU_ERRNO_NULLPPARRAY);   return(JERRI); }
-
-        if (*PPArray != (Pvoid_t) NULL)
-        { JU_SET_ERRNO(PJError, JU_ERRNO_NONNULLPARRAY); return(JERRI); }
-
-        if (PIndex == (PWord_t) NULL)
-        { JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX);    return(JERRI); }
-
-#ifdef JUDYL
-        if (PValue == (PWord_t) NULL)
-        { JU_SET_ERRNO(PJError, JU_ERRNO_NULLPVALUE);    return(JERRI); }
-#endif
-
-
-// HANDLE LARGE COUNT (= POP1) (typical case):
-//
-// Allocate and initialize a JPM, set the root pointer to point to it, and then
-// build the tree underneath it.
-
-// Common code for unusual error handling when no JPM available:
-
-        if (Count > cJU_LEAFW_MAXPOP1)  // too big for root-level leaf.
-        {
-            Pjpm_t Pjpm;                        // new, to allocate.
-
-// Allocate JPM:
-
-            Pjpm = j__udyAllocJPM();
-            JU_CHECKALLOC(Pjpm_t, Pjpm, JERRI);
-            *PPArray = (Pvoid_t) Pjpm;
-
-// Set some JPM fields:
-
-            (Pjpm->jpm_Pop0) = Count - 1;
-            // note: (Pjpm->jpm_TotalMemWords) is now initialized.
-
-// Build Judy tree:
-//
-// In case of error save the final Count, possibly modified, unless modified to
-// 0, in which case free the JPM itself:
-
-            if (! j__udyInsArray(&(Pjpm->jpm_JP), cJU_ROOTSTATE, &Count,
-                                 (PWord_t) PIndex,
-#ifdef JUDYL
-                                 (Pjv_t) PValue,
-#endif
-                                 Pjpm))
-            {
-                JU_COPY_ERRNO(PJError, Pjpm);
-
-                if (Count)              // partial success, adjust pop0:
-                {
-                    (Pjpm->jpm_Pop0) = Count - 1;
-                }
-                else                    // total failure, free JPM:
-                {
-                    j__udyFreeJPM(Pjpm, (Pjpm_t) NULL);
-                    *PPArray = (Pvoid_t) NULL;
-                }
-
-                DBGCODE(JudyCheckPop(*PPArray);)
-                return(JERRI);
-            }
-
-            DBGCODE(JudyCheckPop(*PPArray);)
-            return(1);
-
-        } // large count
-
-
-// HANDLE SMALL COUNT (= POP1):
-//
-// First ensure indexes are in sorted order:
-
-        for (offset = 1; offset < Count; ++offset)
-        {
-            if (PIndex[offset - 1] >= PIndex[offset])
-            { JU_SET_ERRNO(PJError, JU_ERRNO_UNSORTED); return(JERRI); }
-        }
-
-        if (Count == 0) return(1);              // *PPArray remains null.
-
-        {
-            Pjlw      = j__udyAllocJLW(Count + 1);
-                        JU_CHECKALLOC(Pjlw_t, Pjlw, JERRI);
-            *PPArray  = (Pvoid_t) Pjlw;
-            Pjlw[0]   = Count - 1;              // set pop0.
-            Pjlwindex = Pjlw + 1;
-        }
-
-// Copy whole-word indexes (and values) to the root-level leaf:
-
-          JU_COPYMEM(Pjlwindex,                      PIndex, Count);
-JUDYLCODE(JU_COPYMEM(JL_LEAFWVALUEAREA(Pjlw, Count), PValue, Count));
-
-        DBGCODE(JudyCheckPop(*PPArray);)
-        return(1);
-
-} // Judy1SetArray() / JudyLInsArray()
-
-
-// ****************************************************************************
-// __ J U D Y   I N S   A R R A Y
-//
-// Given:
-//
-// - a pointer to a JP
-//
-// - the JPs level in the tree, that is, the number of digits left to decode
-//   in the indexes under the JP (one less than the level of the JPM or branch
-//   in which the JP resides); cJU_ROOTSTATE on first entry (when JP is the one
-//   in the JPM), down to 1 for a Leaf1, LeafB1, or FullPop
-//
-// - a pointer to the number of indexes (and corresponding values) to store in
-//   this subtree, to modify in case of partial success
-//
-// - a list of indexes (and for JudyL, corresponding values) to store in this
-//   subtree
-//
-// - a JPM for tracking memory usage and returning errors
-//
-// Recursively build a subtree (immediate indexes, leaf, or branch with
-// subtrees) and modify the JP accordingly.  On the way down, build a BranchU
-// (only) for any expanse with *PPop1 too high for a leaf; on the way out,
-// convert the BranchU to a BranchL or BranchB if appropriate.  Keep memory
-// statistics in the JPM.
-//
-// Return TRUE for success, or FALSE with error information set in the JPM in
-// case of error, in which case leave a partially constructed but healthy tree,
-// and modify parent population counts on the way out.
-//
-// Note:  Each call of this function makes all modifications to the PjpParent
-// it receives; neither the parent nor child calls do this.
-
-FUNCTION static bool_t j__udyInsArray(
-        Pjp_t   PjpParent,              // parent JP in/under which to store.
-        int     Level,                  // initial digits remaining to decode.
-        PWord_t PPop1,                  // number of indexes to store.
-        PWord_t PIndex,                 // list of indexes to store.
-#ifdef JUDYL
-        Pjv_t   PValue,                 // list of corresponding values.
-#endif
-        Pjpm_t  Pjpm)                   // for memory and errors.
-{
-        Pjp_t   Pjp;                    // lower-level JP.
-        Word_t  Pjbany;                 // any type of branch.
-        int     levelsub;               // actual, of Pjps node, <= Level.
-        Word_t  pop1 = *PPop1;          // fast local value.
-        Word_t  pop1sub;                // population of one subexpanse.
-        uint8_t JPtype;                 // current JP type.
-        uint8_t JPtype_null;            // precomputed value for new branch.
-        jp_t    JPnull;                 // precomputed for speed.
-        Pjbu_t  PjbuRaw;                // constructed BranchU.
-        Pjbu_t  Pjbu;
-        int     digit;                  // in BranchU.
-        Word_t  digitmask;              // for a digit in a BranchU.
-        Word_t  digitshifted;           // shifted to correct offset.
-        Word_t  digitshincr;            // increment for digitshifted.
-        int     offset;                 // in PIndex, or a bitmap subexpanse.
-        int     numJPs;                 // number non-null in a BranchU.
-        bool_t  retval;                 // to return from this func.
-JUDYLCODE(Pjv_t PjvRaw);                // destination value area.
-JUDYLCODE(Pjv_t Pjv);
-
-
-// MACROS FOR COMMON CODE:
-//
-// Note:  These use function and local parameters from the context.
-// Note:  Assume newly allocated memory is zeroed.
-
-// Indicate whether a sorted list of indexes in PIndex, based on the first and
-// last indexes in the list using pop1, are in the same subexpanse between
-// Level and L_evel:
-//
-// This can be confusing!  Note that SAMESUBEXP(L) == TRUE means the indexes
-// are the same through level L + 1, and it says nothing about level L and
-// lower; they might be the same or they might differ.
-//
-// Note:  In principle SAMESUBEXP needs a mask for the digits from Level,
-// inclusive, to L_evel, exclusive.  But in practice, since the indexes are all
-// known to be identical above Level, it just uses a mask for the digits
-// through L_evel + 1; see subexp_mask[].
-
-#define SAMESUBEXP(L_evel) \
-        (! ((PIndex[0] ^ PIndex[pop1 - 1]) & subexp_mask[L_evel]))
-
-// Set PjpParent to a null JP appropriate for the level of the node to which it
-// points, which is 1 less than the level of the node in which the JP resides,
-// which is by definition Level:
-//
-// Note:  This can set the JPMs JP to an invalid jp_Type, but it doesnt
-// matter because the JPM is deleted by the caller.
-
-#define SETJPNULL_PARENT \
-            JU_JPSETADT(PjpParent, 0, 0, cJU_JPNULL1 + Level - 1);
-
-// Variation to set a specified JP (in a branch being built) to a precomputed
-// null JP:
-
-#define SETJPNULL(Pjp) *(Pjp) = JPnull
-
-// Handle complete (as opposed to partial) memory allocation failure:  Set the
-// parent JP to an appropriate null type (to leave a consistent tree), zero the
-// callers population count, and return FALSE:
-//
-// Note:  At Level == cJU_ROOTSTATE this sets the JPMs JPs jp_Type to a bogus
-// value, but it doesnt matter because the JPM should be deleted by the
-// caller.
-
-#define NOMEM { SETJPNULL_PARENT; *PPop1 = 0; return(FALSE); }
-
-// Allocate a Leaf1-N and save the address in Pjll; in case of failure, NOMEM:
-
-#define ALLOCLEAF(AllocLeaf) \
-        if ((PjllRaw = AllocLeaf(pop1, Pjpm)) == (Pjll_t) NULL) NOMEM; \
-        Pjll = P_JLL(PjllRaw);
-
-// Copy indexes smaller than words (and values which are whole words) from
-// given arrays to immediate indexes or a leaf:
-//
-// TBD:  These macros overlap with some of the code in JudyCascade.c; do some
-// merging?  That file has functions while these are macros.
-
-#define COPYTOLEAF_EVEN_SUB(Pjll,LeafType)              \
-        {                                               \
-            LeafType * P_leaf  = (LeafType *) (Pjll);   \
-            Word_t     p_op1   = pop1;                  \
-            PWord_t    P_Index = PIndex;                \
-                                                        \
-            assert(pop1 > 0);                           \
-                                                        \
-            do { *P_leaf++ = *P_Index++; /* truncates */\
-            } while (--(p_op1));                        \
-        }
-
-#define COPYTOLEAF_ODD_SUB(cLevel,Pjll,Copy)            \
-        {                                               \
-            uint8_t * P_leaf  = (uint8_t *) (Pjll);     \
-            Word_t    p_op1   = pop1;                   \
-            PWord_t   P_Index = PIndex;                 \
-                                                        \
-            assert(pop1 > 0);                           \
-                                                        \
-            do {                                        \
-                Copy(P_leaf, *P_Index);                 \
-                P_leaf += (cLevel); ++P_Index;          \
-            } while (--(p_op1));                        \
-        }
-
-#ifdef JUDY1
-
-#define COPYTOLEAF_EVEN(Pjll,LeafType)   COPYTOLEAF_EVEN_SUB(Pjll,LeafType)
-#define COPYTOLEAF_ODD(cLevel,Pjll,Copy) COPYTOLEAF_ODD_SUB(cLevel,Pjll,Copy)
-
-#else // JUDYL adds copying of values:
-
-#define COPYTOLEAF_EVEN(Pjll,LeafType)                  \
-        {                                               \
-            COPYTOLEAF_EVEN_SUB(Pjll,LeafType)          \
-            JU_COPYMEM(Pjv, PValue, pop1);              \
-        }
-
-#define COPYTOLEAF_ODD(cLevel,Pjll,Copy)                \
-        {                                               \
-            COPYTOLEAF_ODD_SUB( cLevel,Pjll,Copy)       \
-            JU_COPYMEM(Pjv, PValue, pop1);              \
-        }
-
-#endif
-
-// Set the JP type for an immediate index, where BaseJPType is JPIMMED_*_02:
-
-#define SETIMMTYPE(BaseJPType)  (PjpParent->jp_Type) = (BaseJPType) + pop1 - 2
-
-// Allocate and populate a Leaf1-N:
-//
-// Build MAKELEAF_EVEN() and MAKELEAF_ODD() using macros for common code.
-
-#define MAKELEAF_SUB1(AllocLeaf,ValueArea,LeafType)                     \
-        ALLOCLEAF(AllocLeaf);                                           \
-        JUDYLCODE(Pjv = ValueArea(Pjll, pop1))
-
-
-#define MAKELEAF_SUB2(cLevel,JPType)                                    \
-{                                                                       \
-        Word_t D_cdP0;                                                  \
-        assert(pop1 - 1 <= cJU_POP0MASK(cLevel));                       \
-        D_cdP0 = (*PIndex & cJU_DCDMASK(cLevel)) | (pop1 - 1);          \
-        JU_JPSETADT(PjpParent, (Word_t)PjllRaw, D_cdP0, JPType);        \
-}
-
-
-#define MAKELEAF_EVEN(cLevel,JPType,AllocLeaf,ValueArea,LeafType)       \
-        MAKELEAF_SUB1(AllocLeaf,ValueArea,LeafType);                    \
-        COPYTOLEAF_EVEN(Pjll, LeafType);                                \
-        MAKELEAF_SUB2(cLevel, JPType)
-
-#define MAKELEAF_ODD(cLevel,JPType,AllocLeaf,ValueArea,Copy)            \
-        MAKELEAF_SUB1(AllocLeaf,ValueArea,LeafType);                    \
-        COPYTOLEAF_ODD(cLevel, Pjll, Copy);                             \
-        MAKELEAF_SUB2(cLevel, JPType)
-
-// Ensure that the indexes to be stored in immediate indexes or a leaf are
-// sorted:
-//
-// This check is pure overhead, but required in order to protect the Judy array
-// against caller error, to avoid a later corruption or core dump from a
-// seemingly valid Judy array.  Do this check piecemeal at the leaf level while
-// the indexes are already in the cache.  Higher-level order-checking occurs
-// while building branches.
-//
-// Note:  Any sorting error in the expanse of a single immediate indexes JP or
-// a leaf => save no indexes in that expanse.
-
-#define CHECKLEAFORDER                                                  \
-        {                                                               \
-            for (offset = 1; offset < pop1; ++offset)                   \
-            {                                                           \
-                if (PIndex[offset - 1] >= PIndex[offset])               \
-                {                                                       \
-                    SETJPNULL_PARENT;                                   \
-                    *PPop1 = 0;                                         \
-                    JU_SET_ERRNO_NONNULL(Pjpm, JU_ERRNO_UNSORTED);      \
-                    return(FALSE);                                      \
-                }                                                       \
-            }                                                           \
-        }
-
-
-// ------ START OF CODE ------
-
-        assert( Level >= 1);
-        assert( Level <= cJU_ROOTSTATE);
-        assert((Level <  cJU_ROOTSTATE) || (pop1 > cJU_LEAFW_MAXPOP1));
-
-
-// CHECK FOR TOP LEVEL:
-//
-// Special case:  If at the top level (PjpParent is in the JPM), a top-level
-// branch must be created, even if its a BranchL with just one JP.  (The JPM
-// cannot point to a leaf because the leaf would have to be a lower-level,
-// higher-capacity leaf under a narrow pointer (otherwise a root-level leaf
-// would suffice), and the JPMs JP cant handle a narrow pointer because the
-// jp_DcdPopO field isnt big enough.)  Otherwise continue to check for a pop1
-// small enough to support immediate indexes or a leaf before giving up and
-// making a lower-level branch.
-
-        if (Level == cJU_ROOTSTATE)
-        {
-            levelsub = cJU_ROOTSTATE;
-            goto BuildBranch2;
-        }
-        assert(Level < cJU_ROOTSTATE);
-
-
-// SKIP JPIMMED_*_01:
-//
-// Immeds with pop1 == 1 should be handled in-line during branch construction.
-
-        assert(pop1 > 1);
-
-
-// BUILD JPIMMED_*_02+:
-//
-// The starting address of the indexes depends on Judy1 or JudyL; also, JudyL
-// includes a pointer to a values-only leaf.
-
-        if (pop1 <= immed_maxpop1[Level])      // note: always < root level.
-        {
-            JUDY1CODE(uint8_t * Pjll = (uint8_t *) (PjpParent->jp_1Index);)
-            JUDYLCODE(uint8_t * Pjll = (uint8_t *) (PjpParent->jp_LIndex);)
-
-            CHECKLEAFORDER;             // indexes to be stored are sorted.
-
-#ifdef JUDYL
-            if ((PjvRaw = j__udyLAllocJV(pop1, Pjpm)) == (Pjv_t) NULL)
-                NOMEM;
-            (PjpParent->jp_Addr) = (Word_t) PjvRaw;
-            Pjv = P_JV(PjvRaw);
-#endif
-
-            switch (Level)
-            {
-            case 1: COPYTOLEAF_EVEN(Pjll, uint8_t);
-                    SETIMMTYPE(cJU_JPIMMED_1_02);
-                    break;
-#if (defined(JUDY1) || defined(JU_64BIT))
-            case 2: COPYTOLEAF_EVEN(Pjll, uint16_t);
-                    SETIMMTYPE(cJU_JPIMMED_2_02);
-                    break;
-            case 3: COPYTOLEAF_ODD(3, Pjll, JU_COPY3_LONG_TO_PINDEX);
-                    SETIMMTYPE(cJU_JPIMMED_3_02);
-                    break;
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-            case 4: COPYTOLEAF_EVEN(Pjll, uint32_t);
-                    SETIMMTYPE(cJ1_JPIMMED_4_02);
-                    break;
-            case 5: COPYTOLEAF_ODD(5, Pjll, JU_COPY5_LONG_TO_PINDEX);
-                    SETIMMTYPE(cJ1_JPIMMED_5_02);
-                    break;
-            case 6: COPYTOLEAF_ODD(6, Pjll, JU_COPY6_LONG_TO_PINDEX);
-                    SETIMMTYPE(cJ1_JPIMMED_6_02);
-                    break;
-            case 7: COPYTOLEAF_ODD(7, Pjll, JU_COPY7_LONG_TO_PINDEX);
-                    SETIMMTYPE(cJ1_JPIMMED_7_02);
-                    break;
-#endif
-            default: assert(FALSE);     // should be impossible.
-            }
-
-            return(TRUE);               // note: no children => no *PPop1 mods.
-
-        } // JPIMMED_*_02+
-
-
-// BUILD JPLEAF*:
-//
-// This code is a little tricky.  The method is:  For each level starting at
-// the present Level down through levelsub = 1, and then as a special case for
-// LeafB1 and FullPop (which are also at levelsub = 1 but have different
-// capacity, see later), check if pop1 fits in a leaf (using leaf_maxpop1[])
-// at that level.  If so, except for Level == levelsub, check if all of the
-// current indexes to be stored are in the same (narrow) subexpanse, that is,
-// the digits from Level to levelsub + 1, inclusive, are identical between the
-// first and last index in the (sorted) list (in PIndex).  If this condition is
-// satisfied at any level, build a leaf at that level (under a narrow pointer
-// if Level > levelsub).
-//
-// Note:  Doing the search in this order results in storing the indexes in
-// "least compressed form."
-
-        for (levelsub = Level; levelsub >= 1; --levelsub)
-        {
-            Pjll_t PjllRaw;
-            Pjll_t Pjll;
-
-// Check if pop1 is too large to fit in a leaf at levelsub; if so, try the next
-// lower level:
-
-            if (pop1 > leaf_maxpop1[levelsub]) continue;
-
-// If pop1 fits in a leaf at levelsub, but levelsub is lower than Level, must
-// also check whether all the indexes in the expanse to store can in fact be
-// placed under a narrow pointer; if not, a leaf cannot be used, at this or any
-// lower level (levelsub):
-
-            if ((levelsub < Level) && (! SAMESUBEXP(levelsub)))
-                goto BuildBranch;       // cant use a narrow, need a branch.
-
-// Ensure valid pop1 and all indexes are in fact common through Level:
-
-            assert(pop1 <= cJU_POP0MASK(Level) + 1);
-            assert(! ((PIndex[0] ^ PIndex[pop1 - 1]) & cJU_DCDMASK(Level)));
-
-            CHECKLEAFORDER;             // indexes to be stored are sorted.
-
-// Build correct type of leaf:
-//
-// Note:  The jp_DcdPopO and jp_Type assignments in MAKELEAF_* happen correctly
-// for the levelsub (not Level) of the new leaf, even if its under a narrow
-// pointer.
-
-            switch (levelsub)
-            {
-#if (defined(JUDYL) || (! defined(JU_64BIT)))
-            case 1: MAKELEAF_EVEN(1, cJU_JPLEAF1, j__udyAllocJLL1,
-                                  JL_LEAF1VALUEAREA, uint8_t);
-                    break;
-#endif
-            case 2: MAKELEAF_EVEN(2, cJU_JPLEAF2, j__udyAllocJLL2,
-                                  JL_LEAF2VALUEAREA, uint16_t);
-                    break;
-            case 3: MAKELEAF_ODD( 3, cJU_JPLEAF3, j__udyAllocJLL3,
-                                  JL_LEAF3VALUEAREA, JU_COPY3_LONG_TO_PINDEX);
-                    break;
-#ifdef JU_64BIT
-            case 4: MAKELEAF_EVEN(4, cJU_JPLEAF4, j__udyAllocJLL4,
-                                  JL_LEAF4VALUEAREA, uint32_t);
-                    break;
-            case 5: MAKELEAF_ODD( 5, cJU_JPLEAF5, j__udyAllocJLL5,
-                                  JL_LEAF5VALUEAREA, JU_COPY5_LONG_TO_PINDEX);
-                    break;
-            case 6: MAKELEAF_ODD( 6, cJU_JPLEAF6, j__udyAllocJLL6,
-                                  JL_LEAF6VALUEAREA, JU_COPY6_LONG_TO_PINDEX);
-                    break;
-            case 7: MAKELEAF_ODD( 7, cJU_JPLEAF7, j__udyAllocJLL7,
-                                  JL_LEAF7VALUEAREA, JU_COPY7_LONG_TO_PINDEX);
-                    break;
-#endif
-            default: assert(FALSE);     // should be impossible.
-            }
-
-            return(TRUE);               // note: no children => no *PPop1 mods.
-
-        } // JPLEAF*
-
-
-// BUILD JPLEAF_B1 OR JPFULLPOPU1:
-//
-// See above about JPLEAF*.  If pop1 doesnt fit in any level of linear leaf,
-// it might still fit in a LeafB1 or FullPop, perhaps under a narrow pointer.
-
-        if ((Level == 1) || SAMESUBEXP(1))      // same until last digit.
-        {
-            Pjlb_t PjlbRaw;                     // for bitmap leaf.
-            Pjlb_t Pjlb;
-
-            assert(pop1 <= cJU_JPFULLPOPU1_POP0 + 1);
-            CHECKLEAFORDER;             // indexes to be stored are sorted.
-
-#ifdef JUDY1
-
-// JPFULLPOPU1:
-
-            if (pop1 == cJU_JPFULLPOPU1_POP0 + 1)
-            {
-                Word_t  Addr  = PjpParent->jp_Addr;
-                Word_t  DcdP0 = (*PIndex & cJU_DCDMASK(1))
-                                        | cJU_JPFULLPOPU1_POP0;
-                JU_JPSETADT(PjpParent, Addr, DcdP0, cJ1_JPFULLPOPU1);
-
-                return(TRUE);
-            }
-#endif
-
-// JPLEAF_B1:
-
-            if ((PjlbRaw = j__udyAllocJLB1(Pjpm)) == (Pjlb_t) NULL)
-                NOMEM;
-            Pjlb = P_JLB(PjlbRaw);
-
-            for (offset = 0; offset < pop1; ++offset)
-                JU_BITMAPSETL(Pjlb, PIndex[offset]);
-
-            retval = TRUE;              // default.
-
-#ifdef JUDYL
-
-// Build subexpanse values-only leaves (LeafVs) under LeafB1:
-
-            for (offset = 0; offset < cJU_NUMSUBEXPL; ++offset)
-            {
-                if (! (pop1sub = j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, offset))))
-                    continue;           // skip empty subexpanse.
-
-// Allocate one LeafV = JP subarray; if out of memory, clear bitmaps for higher
-// subexpanses and adjust *PPop1:
-
-                if ((PjvRaw = j__udyLAllocJV(pop1sub, Pjpm))
-                 == (Pjv_t) NULL)
-                {
-                    for (/* null */; offset < cJU_NUMSUBEXPL; ++offset)
-                    {
-                        *PPop1 -= j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, offset));
-                        JU_JLB_BITMAP(Pjlb, offset) = 0;
-                    }
-
-                    retval = FALSE;
-                    break;
-                }
-
-// Populate values-only leaf and save the pointer to it:
-
-                Pjv = P_JV(PjvRaw);
-                JU_COPYMEM(Pjv, PValue, pop1sub);
-                JL_JLB_PVALUE(Pjlb, offset) = PjvRaw;   // first-tier pointer.
-                PValue += pop1sub;
-
-            } // for each subexpanse
-
-#endif // JUDYL
-
-// Attach new LeafB1 to parent JP; note use of *PPop1 possibly < pop1:
-
-            JU_JPSETADT(PjpParent, (Word_t) PjlbRaw, 
-                    (*PIndex & cJU_DCDMASK(1)) | (*PPop1 - 1), cJU_JPLEAF_B1);
-
-            return(retval);
-
-        } // JPLEAF_B1 or JPFULLPOPU1
-
-
-// BUILD JPBRANCH_U*:
-//
-// Arriving at BuildBranch means Level < top level but the pop1 is too large
-// for immediate indexes or a leaf, even under a narrow pointer, including a
-// LeafB1 or FullPop at level 1.  This implies SAMESUBEXP(1) == FALSE, that is,
-// the indexes to be stored "branch" at level 2 or higher.
-
-BuildBranch:    // come here directly if a leaf wont work.
-
-        assert(Level >= 2);
-        assert(Level < cJU_ROOTSTATE);
-        assert(! SAMESUBEXP(1));                // sanity check, see above.
-
-// Determine the appropriate level for a new branch node; see if a narrow
-// pointer can be used:
-//
-// This can be confusing.  The branch is required at the lowest level L where
-// the indexes to store are not in the same subexpanse at level L-1.  Work down
-// from Level to tree level 3, which is 1 above the lowest tree level = 2 at
-// which a branch can be used.  Theres no need to check SAMESUBEXP at level 2
-// because its known to be false at level 2-1 = 1.
-//
-// Note:  Unlike for a leaf node, a narrow pointer is always used for a branch
-// if possible, that is, maximum compression is always used, except at the top
-// level of the tree, where a JPM cannot support a narrow pointer, meaning a
-// top BranchL can have a single JP (fanout = 1); but that case jumps directly
-// to BuildBranch2.
-//
-// Note:  For 32-bit systems the only usable values for a narrow pointer are
-// Level = 3 and levelsub = 2; 64-bit systems have many more choices; but
-// hopefully this for-loop is fast enough even on a 32-bit system.
-//
-// TBD:  If not fast enough, #ifdef JU_64BIT and handle the 32-bit case faster.
-
-        for (levelsub = Level; levelsub >= 3; --levelsub)  // see above.
-            if (! SAMESUBEXP(levelsub - 1))     // at limit of narrow pointer.
-                break;                          // put branch at levelsub.
-
-BuildBranch2:   // come here directly for Level = levelsub = cJU_ROOTSTATE.
-
-        assert(levelsub >= 2);
-        assert(levelsub <= Level);
-
-// Initially build a BranchU:
-//
-// Always start with a BranchU because the number of populated subexpanses is
-// not yet known.  Use digitmask, digitshifted, and digitshincr to avoid
-// expensive variable shifts within JU_DIGITATSTATE within the loop.
-//
-// TBD:  The use of digitmask, etc. results in more increment operations per
-// loop, is there an even faster way?
-//
-// TBD:  Would it pay to pre-count the populated JPs (subexpanses) and
-// pre-compress the branch, that is, build a BranchL or BranchB immediately,
-// also taking account of opportunistic uncompression rules?  Probably not
-// because at high levels of the tree there might be huge numbers of indexes
-// (hence cache lines) to scan in the PIndex array to determine the fanout
-// (number of JPs) needed.
-
-        if ((PjbuRaw = j__udyAllocJBU(Pjpm)) == (Pjbu_t) NULL) NOMEM;
-        Pjbu = P_JBU(PjbuRaw);
-
-        JPtype_null       = cJU_JPNULL1 + levelsub - 2;  // in new BranchU.
-        JU_JPSETADT(&JPnull, 0, 0, JPtype_null);
-
-        Pjp               = Pjbu->jbu_jp;           // for convenience in loop.
-        numJPs            = 0;                      // non-null in the BranchU.
-        digitmask         = cJU_MASKATSTATE(levelsub);   // see above.
-        digitshincr       = 1UL << (cJU_BITSPERBYTE * (levelsub - 1));
-        retval            = TRUE;
-
-// Scan and populate JPs (subexpanses):
-//
-// Look for all indexes matching each digit in the BranchU (at the correct
-// levelsub), and meanwhile notice any sorting error.  Increment PIndex (and
-// PValue) and reduce pop1 for each subexpanse handled successfully.
-
-        for (digit = digitshifted = 0;
-             digit < cJU_BRANCHUNUMJPS;
-             ++digit, digitshifted += digitshincr, ++Pjp)
-        {
-            DBGCODE(Word_t pop1subprev;)
-            assert(pop1 != 0);          // end of indexes is handled elsewhere.
-
-// Count indexes in digits subexpanse:
-
-            for (pop1sub = 0; pop1sub < pop1; ++pop1sub)
-                if (digitshifted != (PIndex[pop1sub] & digitmask)) break;
-
-// Empty subexpanse (typical, performance path) or sorting error (rare):
-
-            if (pop1sub == 0)
-            {
-                if (digitshifted < (PIndex[0] & digitmask))
-                { SETJPNULL(Pjp); continue; }           // empty subexpanse.
-
-                assert(pop1 < *PPop1);  // did save >= 1 index and decr pop1.
-                JU_SET_ERRNO_NONNULL(Pjpm, JU_ERRNO_UNSORTED);
-                goto AbandonBranch;
-            }
-
-// Non-empty subexpanse:
-//
-// First shortcut by handling pop1sub == 1 (JPIMMED_*_01) inline locally.
-
-            if (pop1sub == 1)                   // note: can be at root level.
-            {
-                Word_t Addr = 0;
-      JUDYLCODE(Addr    = (Word_t) (*PValue++);)
-                JU_JPSETADT(Pjp, Addr, *PIndex, cJU_JPIMMED_1_01 + levelsub -2);
-
-                ++numJPs;
-
-                if (--pop1) { ++PIndex; continue; }  // more indexes to store.
-
-                ++digit; ++Pjp;                 // skip JP just saved.
-                goto ClearBranch;               // save time.
-            }
-
-// Recurse to populate one digits (subexpanses) JP; if successful, skip
-// indexes (and values) just stored (performance path), except when expanse is
-// completely stored:
-
-            DBGCODE(pop1subprev = pop1sub;)
-
-            if (j__udyInsArray(Pjp, levelsub - 1, &pop1sub, (PWord_t) PIndex,
-#ifdef JUDYL
-                               (Pjv_t) PValue,
-#endif
-                               Pjpm))
-            {                                   // complete success.
-                ++numJPs;
-                assert(pop1subprev == pop1sub);
-                assert(pop1 >= pop1sub);
-
-                if ((pop1 -= pop1sub) != 0)     // more indexes to store:
-                {
-                    PIndex += pop1sub;          // skip indexes just stored.
-          JUDYLCODE(PValue += pop1sub;)
-                    continue;
-                }
-                // else leave PIndex in BranchUs expanse.
-
-// No more indexes to store in BranchUs expanse:
-
-                ++digit; ++Pjp;                 // skip JP just saved.
-                goto ClearBranch;               // save time.
-            }
-
-// Handle any error at a lower level of recursion:
-//
-// In case of partial success, pop1sub != 0, but it was reduced from the value
-// passed to j__udyInsArray(); skip this JP later during ClearBranch.
-
-            assert(pop1subprev > pop1sub);      // check j__udyInsArray().
-            assert(pop1        > pop1sub);      // check j__udyInsArray().
-
-            if (pop1sub)                        // partial success.
-            { ++digit; ++Pjp; ++numJPs; }       // skip JP just saved.
-
-            pop1 -= pop1sub;                    // deduct saved indexes if any.
-
-// Same-level sorting error, or any lower-level error; abandon the rest of the
-// branch:
-//
-// Arrive here with pop1 = remaining unsaved indexes (always non-zero).  Adjust
-// the *PPop1 value to record and return, modify retval, and use ClearBranch to
-// finish up.
-
-AbandonBranch:
-            assert(pop1 != 0);                  // more to store, see above.
-            assert(pop1 <= *PPop1);             // sanity check.
-
-            *PPop1 -= pop1;                     // deduct unsaved indexes.
-            pop1    = 0;                        // to avoid error later.
-            retval  = FALSE;
-
-// Error (rare), or end of indexes while traversing new BranchU (performance
-// path); either way, mark the remaining JPs, if any, in the BranchU as nulls
-// and exit the loop:
-//
-// Arrive here with digit and Pjp set to the first JP to set to null.
-
-ClearBranch:
-            for (/* null */; digit < cJU_BRANCHUNUMJPS; ++digit, ++Pjp)
-                SETJPNULL(Pjp);
-            break;                              // saves one more compare.
-
-        } // for each digit
-
-
-// FINISH JPBRANCH_U*:
-//
-// Arrive here with a BranchU built under Pjbu, numJPs set, and either:  retval
-// == TRUE and *PPop1 unmodified, or else retval == FALSE, *PPop1 set to the
-// actual number of indexes saved (possibly 0 for complete failure at a lower
-// level upon the first call of j__udyInsArray()), and the Judy error set in
-// Pjpm.  Either way, PIndex points to an index within the expanse just
-// handled.
-
-        Pjbany = (Word_t) PjbuRaw;              // default = use this BranchU.
-        JPtype = branchU_JPtype[levelsub];
-
-// Check for complete failure above:
-
-        assert((! retval) || *PPop1);           // sanity check.
-
-        if ((! retval) && (*PPop1 == 0))        // nothing stored, full failure.
-        {
-            j__udyFreeJBU(PjbuRaw, Pjpm);
-            SETJPNULL_PARENT;
-            return(FALSE);
-        }
-
-// Complete or partial success so far; watch for sorting error after the
-// maximum digit (255) in the BranchU, which is indicated by having more
-// indexes to store in the BranchUs expanse:
-//
-// For example, if an index to store has a digit of 255 at levelsub, followed
-// by an index with a digit of 254, the for-loop above runs out of digits
-// without reducing pop1 to 0.
-
-        if (pop1 != 0)
-        {
-            JU_SET_ERRNO_NONNULL(Pjpm, JU_ERRNO_UNSORTED);
-            *PPop1 -= pop1;             // deduct unsaved indexes.
-            retval  = FALSE;
-        }
-        assert(*PPop1 != 0);            // branch (still) cannot be empty.
-
-
-// OPTIONALLY COMPRESS JPBRANCH_U*:
-//
-// See if the BranchU should be compressed to a BranchL or BranchB; if so, do
-// that and free the BranchU; otherwise just use the existing BranchU.  Follow
-// the same rules as in JudyIns.c (version 4.95):  Only check local population
-// (cJU_OPP_UNCOMP_POP0) for BranchL, and only check global memory efficiency
-// (JU_OPP_UNCOMPRESS) for BranchB.  TBD:  Have the rules changed?
-//
-// Note:  Because of differing order of operations, the latter compression
-// might not result in the same set of branch nodes as a series of sequential
-// insertions.
-//
-// Note:  Allocating a BranchU only to sometimes convert it to a BranchL or
-// BranchB is unfortunate, but attempting to work with a temporary BranchU on
-// the stack and then allocate and keep it as a BranchU in many cases is worse
-// in terms of error handling.
-
-
-// COMPRESS JPBRANCH_U* TO JPBRANCH_L*:
-
-        if (numJPs <= cJU_BRANCHLMAXJPS)        // JPs fit in a BranchL.
-        {
-            Pjbl_t PjblRaw = (Pjbl_t) NULL;     // new BranchL; init for cc.
-            Pjbl_t Pjbl;
-
-            if ((*PPop1 > JU_BRANCHL_MAX_POP)   // pop too high.
-             || ((PjblRaw = j__udyAllocJBL(Pjpm)) == (Pjbl_t) NULL))
-            {                                   // cant alloc BranchL.
-                goto SetParent;                 // just keep BranchU.
-            }
-
-            Pjbl = P_JBL(PjblRaw);
-
-// Copy BranchU JPs to BranchL:
-
-            (Pjbl->jbl_NumJPs) = numJPs;
-            offset = 0;
-
-            for (digit = 0; digit < cJU_BRANCHUNUMJPS; ++digit)
-            {
-                if ((((Pjbu->jbu_jp) + digit)->jp_Type) == JPtype_null)
-                    continue;
-
-                (Pjbl->jbl_Expanse[offset  ]) = digit;
-                (Pjbl->jbl_jp     [offset++]) = Pjbu->jbu_jp[digit];
-            }
-            assert(offset == numJPs);           // found same number.
-
-// Free the BranchU and prepare to use the new BranchL instead:
-
-            j__udyFreeJBU(PjbuRaw, Pjpm);
-
-            Pjbany = (Word_t) PjblRaw;
-            JPtype = branchL_JPtype[levelsub];
-
-        } // compress to BranchL
-
-
-// COMPRESS JPBRANCH_U* TO JPBRANCH_B*:
-//
-// If unable to allocate the BranchB or any JP subarray, free all related
-// memory and just keep the BranchU.
-//
-// Note:  This use of JU_OPP_UNCOMPRESS is a bit conservative because the
-// BranchU is already allocated while the (presumably smaller) BranchB is not,
-// the opposite of how its used in single-insert code.
-
-        else
-        {
-            Pjbb_t PjbbRaw = (Pjbb_t) NULL;     // new BranchB; init for cc.
-            Pjbb_t Pjbb;
-            Pjp_t  Pjp2;                        // in BranchU.
-
-            if ((*PPop1 > JU_BRANCHB_MAX_POP)   // pop too high.
-             || ((PjbbRaw = j__udyAllocJBB(Pjpm)) == (Pjbb_t) NULL))
-            {                                   // cant alloc BranchB.
-                goto SetParent;                 // just keep BranchU.
-            }
-
-            Pjbb = P_JBB(PjbbRaw);
-
-// Set bits in bitmap for populated subexpanses:
-
-            Pjp2 = Pjbu->jbu_jp;
-
-            for (digit = 0; digit < cJU_BRANCHUNUMJPS; ++digit)
-                if ((((Pjbu->jbu_jp) + digit)->jp_Type) != JPtype_null)
-                    JU_BITMAPSETB(Pjbb, digit);
-
-// Copy non-null JPs to BranchB JP subarrays:
-
-            for (offset = 0; offset < cJU_NUMSUBEXPB; ++offset)
-            {
-                Pjp_t PjparrayRaw;
-                Pjp_t Pjparray;
-
-                if (! (numJPs = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, offset))))
-                    continue;                   // skip empty subexpanse.
-
-// If unable to allocate a JP subarray, free all BranchB memory so far and
-// continue to use the BranchU:
-
-                if ((PjparrayRaw = j__udyAllocJBBJP(numJPs, Pjpm))
-                    == (Pjp_t) NULL)
-                {
-                    while (offset-- > 0)
-                    {
-                        if (JU_JBB_PJP(Pjbb, offset) == (Pjp_t) NULL) continue;
-
-                        j__udyFreeJBBJP(JU_JBB_PJP(Pjbb, offset),
-                                 j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, offset)),
-                                        Pjpm);
-                    }
-                    j__udyFreeJBB(PjbbRaw, Pjpm);
-                    goto SetParent;             // keep BranchU.
-                }
-
-// Set one JP subarray pointer and copy the subexpanses JPs to the subarray:
-//
-// Scan the BranchU for non-null JPs until numJPs JPs are copied.
-
-                JU_JBB_PJP(Pjbb, offset) = PjparrayRaw;
-                Pjparray = P_JP(PjparrayRaw);
-
-                while (numJPs-- > 0)
-                {
-                    while ((Pjp2->jp_Type) == JPtype_null)
-                    {
-                        ++Pjp2;
-                        assert(Pjp2 < (Pjbu->jbu_jp) + cJU_BRANCHUNUMJPS);
-                    }
-                    *Pjparray++ = *Pjp2++;
-                }
-            } // for each subexpanse
-
-// Free the BranchU and prepare to use the new BranchB instead:
-
-            j__udyFreeJBU(PjbuRaw, Pjpm);
-
-            Pjbany = (Word_t) PjbbRaw;
-            JPtype = branchB_JPtype[levelsub];
-
-        } // compress to BranchB
-
-
-// COMPLETE OR PARTIAL SUCCESS:
-//
-// Attach new branch (under Pjp, with JPtype) to parent JP; note use of *PPop1,
-// possibly reduced due to partial failure.
-
-SetParent:
-        (PjpParent->jp_Addr) = Pjbany;
-        (PjpParent->jp_Type) = JPtype;
-
-        if (Level < cJU_ROOTSTATE)              // PjpParent not in JPM:
-        {
-            Word_t DcdP0 = (*PIndex & cJU_DCDMASK(levelsub)) | (*PPop1 - 1);
-
-            JU_JPSETADT(PjpParent ,Pjbany, DcdP0, JPtype);
-        }
-
-        return(retval);
-
-} // j__udyInsArray()
diff --git a/libs/klib/judy/JudyInsertBranch.c b/libs/klib/judy/JudyInsertBranch.c
deleted file mode 100644
index 307285c..0000000
--- a/libs/klib/judy/JudyInsertBranch.c
+++ /dev/null
@@ -1,133 +0,0 @@
-// Copyright (C) 2000 - 2002 Hewlett-Packard Company
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the term of the GNU Lesser 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 Lesser General Public License
-// for more details.
-//
-// You should have received a copy of the GNU Lesser 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
-// _________________
-
-// BranchL insertion functions for Judy1 and JudyL.
-// Compile with one of -DJUDY1 or -DJUDYL.
-
-#if (! (defined(JUDY1) || defined(JUDYL)))
-#error:  One of -DJUDY1 or -DJUDYL must be specified.
-#endif
-
-#ifdef JUDY1
-#include "Judy1.h"
-#else
-#include "JudyL.h"
-#endif
-
-#include "JudyPrivate1L.h"
-
-extern int j__udyCreateBranchL(Pjp_t, Pjp_t, uint8_t *, Word_t, Pvoid_t);
-
-
-// ****************************************************************************
-// __ J U D Y   I N S E R T   B R A N C H
-//
-// Insert 2-element BranchL in between Pjp and Pjp->jp_Addr.
-//
-// Return -1 if out of memory, otherwise return 1.
-
-FUNCTION int j__udyInsertBranch(
-	Pjp_t	Pjp,		// JP containing narrow pointer.
-	Word_t	Index,		// outlier to Pjp.
-	Word_t	BranchLevel,	// of what JP points to, mapped from JP type.
-	Pjpm_t	Pjpm)		// for global accounting.
-{
-	jp_t	JP2 [2];
-	jp_t	JP;
-	Pjp_t	PjpNull;
-	Word_t	XorExp;
-	Word_t	Inew, Iold;
-	Word_t  DCDMask;	// initially for original BranchLevel.
-	int	Ret;
-	uint8_t	Exp2[2];
-	uint8_t	DecodeByteN, DecodeByteO;
-
-//	Get the current mask for the DCD digits:
-
-	DCDMask = cJU_DCDMASK(BranchLevel);
-
-//	Obtain Dcd bits that differ between Index and JP, shifted so the
-//	digit for BranchLevel is the LSB:
-
-	XorExp = ((Index ^ JU_JPDCDPOP0(Pjp)) & (cJU_ALLONES >> cJU_BITSPERBYTE))
-	       >> (BranchLevel * cJU_BITSPERBYTE);
-	assert(XorExp);		// Index must be an outlier.
-
-//	Count levels between object under narrow pointer and the level at which
-//	the outlier diverges from it, which is always at least initial
-//	BranchLevel + 1, to end up with the level (JP type) at which to insert
-//	the new intervening BranchL:
-
-	do { ++BranchLevel; } while ((XorExp >>= cJU_BITSPERBYTE));
-	assert((BranchLevel > 1) && (BranchLevel < cJU_ROOTSTATE));
-
-//	Get the MSB (highest digit) that differs between the old expanse and
-//	the new Index to insert:
-
-	DecodeByteO = JU_DIGITATSTATE(JU_JPDCDPOP0(Pjp), BranchLevel);
-	DecodeByteN = JU_DIGITATSTATE(Index,	         BranchLevel);
-
-	assert(DecodeByteO != DecodeByteN);
-
-//	Determine sorted order for old expanse and new Index digits:
-
-	if (DecodeByteN > DecodeByteO)	{ Iold = 0; Inew = 1; }
-	else				{ Iold = 1; Inew = 0; }
-
-//	Copy old JP into staging area for new Branch
-	JP2 [Iold] = *Pjp;
-	Exp2[Iold] = DecodeByteO;
-	Exp2[Inew] = DecodeByteN;
-
-//	Create a 2 Expanse Linear branch
-//
-//	Note: Pjp->jp_Addr is set by j__udyCreateBranchL()
-
-	Ret = j__udyCreateBranchL(Pjp, JP2, Exp2, 2, Pjpm);
-	if (Ret == -1) return(-1);
-
-//	Get Pjp to the NULL of where to do insert
-	PjpNull	= ((P_JBL(Pjp->jp_Addr))->jbl_jp) + Inew;
-
-//	Convert to a cJU_JPIMMED_*_01 at the correct level:
-//	Build JP and set type below to: cJU_JPIMMED_X_01
-        JU_JPSETADT(PjpNull, 0, Index, cJU_JPIMMED_1_01 - 2 + BranchLevel);
-
-//	Return pointer to Value area in cJU_JPIMMED_X_01
-	JUDYLCODE(Pjpm->jpm_PValue = (Pjv_t) PjpNull;)
-
-//	The old JP now points to a BranchL that is at higher level.  Therefore
-//	it contains excess DCD bits (in the least significant position) that
-//	must be removed (zeroed); that is, they become part of the Pop0
-//	subfield.  Note that the remaining (lower) bytes in the Pop0 field do
-//	not change.
-//
-//	Take from the old DCDMask, which went "down" to a lower BranchLevel,
-//	and zero any high bits that are still in the mask at the new, higher
-//	BranchLevel; then use this mask to zero the bits in jp_DcdPopO:
-
-//	Set old JP to a BranchL at correct level
-
-	Pjp->jp_Type = cJU_JPBRANCH_L2 - 2 + BranchLevel;
-	DCDMask		^= cJU_DCDMASK(BranchLevel);
-	DCDMask		 = ~DCDMask & JU_JPDCDPOP0(Pjp);
-        JP = *Pjp;
-        JU_JPSETADT(Pjp, JP.jp_Addr, DCDMask, JP.jp_Type);
-
-	return(1);
-
-} // j__udyInsertBranch()
diff --git a/libs/klib/judy/JudyL.h b/libs/klib/judy/JudyL.h
deleted file mode 100644
index 13c7d66..0000000
--- a/libs/klib/judy/JudyL.h
+++ /dev/null
@@ -1,503 +0,0 @@
-#ifndef _JUDYL_INCLUDED
-#define _JUDYL_INCLUDED
-// _________________
-//
-// Copyright (C) 2000 - 2002 Hewlett-Packard Company
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the term of the GNU Lesser 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 Lesser General Public License
-// for more details.
-//
-// You should have received a copy of the GNU Lesser 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
-// _________________
-
-// ****************************************************************************
-//          JUDYL -- SMALL/LARGE AND/OR CLUSTERED/SPARSE ARRAYS
-//
-//                                    -by-
-//
-//                             Douglas L. Baskins
-//                             doug at sourcejudy.com
-//
-// Judy arrays are designed to be used instead of arrays.  The performance
-// suggests the reason why Judy arrays are thought of as arrays, instead of
-// trees.  They are remarkably memory efficient at all populations.
-// Implemented as a hybrid digital tree (but really a state machine, see
-// below), Judy arrays feature fast insert/retrievals, fast near neighbor
-// searching, and contain a population tree for extremely fast ordinal related
-// retrievals.
-//
-// CONVENTIONS:
-//
-// - The comments here refer to 32-bit [64-bit] systems.
-//
-// - BranchL, LeafL refer to linear branches and leaves (small populations),
-//   except LeafL does not actually appear as such; rather, Leaf1..3 [Leaf1..7]
-//   is used to represent leaf Index sizes, and LeafW refers to a Leaf with
-//   full (Long) word Indexes, which is also a type of linear leaf.  Note that
-//   root-level LeafW (Leaf4 [Leaf8]) leaves are called LEAFW.
-//
-// - BranchB, LeafB1 refer to bitmap branches and leaves (intermediate
-//   populations).
-//
-// - BranchU refers to uncompressed branches.  An uncompressed branch has 256
-//   JPs, some of which could be null.  Note:  All leaves are compressed (and
-//   sorted), or else an expanse is full (FullPopu), so there is no LeafU
-//   equivalent to BranchU.
-//
-// - "Popu" is short for "Population".
-// - "Pop1" refers to actual population (base 1).
-// - "Pop0" refers to Pop1 - 1 (base 0), the way populations are stored in data
-//   structures.
-//
-// - Branches and Leaves are both named by the number of bytes in their Pop0
-//   field.  In the case of Leaves, the same number applies to the Index sizes.
-//
-// - The representation of many numbers as hex is a relatively safe and
-//   portable way to get desired bitpatterns as unsigned longs.
-//
-// - Some preprocessors cant handle single apostrophe characters within
-//   #ifndef code, so here, delete all instead.
-
-
-#include "JudyPrivate.h"        // includes Judy.h in turn.
-#include "JudyPrivateBranch.h"  // support for branches.
-
-
-// ****************************************************************************
-// JUDYL ROOT POINTER (JRP) AND JUDYL POINTER (JP) TYPE FIELDS
-// ****************************************************************************
-
-typedef enum            // uint8_t -- but C does not support this type of enum.
-{
-
-// JP NULL TYPES:
-//
-// There is a series of cJL_JPNULL* Types because each one pre-records a
-// different Index Size for when the first Index is inserted in the previously
-// null JP.  They must start >= 8 (three bits).
-//
-// Note:  These Types must be in sequential order for doing relative
-// calculations between them.
-
-        cJL_JPNULL1 = 1,
-                                // Index Size 1[1] byte  when 1 Index inserted.
-        cJL_JPNULL2,            // Index Size 2[2] bytes when 1 Index inserted.
-        cJL_JPNULL3,            // Index Size 3[3] bytes when 1 Index inserted.
-
-#ifndef JU_64BIT
-#define cJL_JPNULLMAX cJL_JPNULL3
-#else
-        cJL_JPNULL4,            // Index Size 4[4] bytes when 1 Index inserted.
-        cJL_JPNULL5,            // Index Size 5[5] bytes when 1 Index inserted.
-        cJL_JPNULL6,            // Index Size 6[6] bytes when 1 Index inserted.
-        cJL_JPNULL7,            // Index Size 7[7] bytes when 1 Index inserted.
-#define cJL_JPNULLMAX cJL_JPNULL7
-#endif
-
-
-// JP BRANCH TYPES:
-//
-// Note:  There are no state-1 branches; only leaves reside at state 1.
-
-// Linear branches:
-//
-// Note:  These Types must be in sequential order for doing relative
-// calculations between them.
-
-        cJL_JPBRANCH_L2,        // 2[2] bytes Pop0, 1[5] bytes Dcd.
-        cJL_JPBRANCH_L3,        // 3[3] bytes Pop0, 0[4] bytes Dcd.
-
-#ifdef JU_64BIT
-        cJL_JPBRANCH_L4,        //  [4] bytes Pop0,  [3] bytes Dcd.
-        cJL_JPBRANCH_L5,        //  [5] bytes Pop0,  [2] bytes Dcd.
-        cJL_JPBRANCH_L6,        //  [6] bytes Pop0,  [1] byte  Dcd.
-        cJL_JPBRANCH_L7,        //  [7] bytes Pop0,  [0] bytes Dcd.
-#endif
-
-        cJL_JPBRANCH_L,         // note:  DcdPopO field not used.
-
-// Bitmap branches:
-//
-// Note:  These Types must be in sequential order for doing relative
-// calculations between them.
-
-        cJL_JPBRANCH_B2,        // 2[2] bytes Pop0, 1[5] bytes Dcd.
-        cJL_JPBRANCH_B3,        // 3[3] bytes Pop0, 0[4] bytes Dcd.
-
-#ifdef JU_64BIT
-        cJL_JPBRANCH_B4,        //  [4] bytes Pop0,  [3] bytes Dcd.
-        cJL_JPBRANCH_B5,        //  [5] bytes Pop0,  [2] bytes Dcd.
-        cJL_JPBRANCH_B6,        //  [6] bytes Pop0,  [1] byte  Dcd.
-        cJL_JPBRANCH_B7,        //  [7] bytes Pop0,  [0] bytes Dcd.
-#endif
-
-        cJL_JPBRANCH_B,         // note:  DcdPopO field not used.
-
-// Uncompressed branches:
-//
-// Note:  These Types must be in sequential order for doing relative
-// calculations between them.
-
-        cJL_JPBRANCH_U2,        // 2[2] bytes Pop0, 1[5] bytes Dcd.
-        cJL_JPBRANCH_U3,        // 3[3] bytes Pop0, 0[4] bytes Dcd.
-
-#ifdef JU_64BIT
-        cJL_JPBRANCH_U4,        //  [4] bytes Pop0,  [3] bytes Dcd.
-        cJL_JPBRANCH_U5,        //  [5] bytes Pop0,  [2] bytes Dcd.
-        cJL_JPBRANCH_U6,        //  [6] bytes Pop0,  [1] byte  Dcd.
-        cJL_JPBRANCH_U7,        //  [7] bytes Pop0,  [0] bytes Dcd.
-#endif
-
-        cJL_JPBRANCH_U,         // note:  DcdPopO field not used.
-
-
-// JP LEAF TYPES:
-
-// Linear leaves:
-//
-// Note:  These Types must be in sequential order for doing relative
-// calculations between them.
-//
-// Note:  There is no full-word (4-byte [8-byte]) Index leaf under a JP because
-// non-root-state leaves only occur under branches that decode at least one
-// byte.  Full-word, root-state leaves are under a JRP, not a JP.  However, in
-// the code a "fake" JP can be created temporarily above a root-state leaf.
-
-        cJL_JPLEAF1,            // 1[1] byte  Pop0, 2    bytes Dcd.
-        cJL_JPLEAF2,            // 2[2] bytes Pop0, 1[5] bytes Dcd.
-        cJL_JPLEAF3,            // 3[3] bytes Pop0, 0[4] bytes Dcd.
-
-#ifdef JU_64BIT
-        cJL_JPLEAF4,            //  [4] bytes Pop0,  [3] bytes Dcd.
-        cJL_JPLEAF5,            //  [5] bytes Pop0,  [2] bytes Dcd.
-        cJL_JPLEAF6,            //  [6] bytes Pop0,  [1] byte  Dcd.
-        cJL_JPLEAF7,            //  [7] bytes Pop0,  [0] bytes Dcd.
-#endif
-
-// Bitmap leaf; Index Size == 1:
-//
-// Note:  These are currently only supported at state 1.  At other states the
-// bitmap would grow from 256 to 256^2, 256^3, ... bits, which would not be
-// efficient..
-
-        cJL_JPLEAF_B1,          // 1[1] byte Pop0, 2[6] bytes Dcd.
-
-// Full population; Index Size == 1 virtual leaf:
-//
-// Note:  JudyL has no cJL_JPFULLPOPU1 equivalent to cJ1_JPFULLPOPU1, because
-// in the JudyL case this could result in a values-only leaf of up to 256 words
-// (value areas) that would be slow to insert/delete.
-
-
-// JP IMMEDIATES; leaves (Indexes) stored inside a JP:
-//
-// The second numeric suffix is the Pop1 for each type.  As the Index Size
-// increases, the maximum possible population decreases.
-//
-// Note:  These Types must be in sequential order in each group (Index Size),
-// and the groups in correct order too, for doing relative calculations between
-// them.  For example, since these Types enumerate the Pop1 values (unlike
-// other JP Types where there is a Pop0 value in the JP), the maximum Pop1 for
-// each Index Size is computable.
-//
-// All enums equal or above this point are cJL_JPIMMEDs.
-
-        cJL_JPIMMED_1_01,       // Index Size = 1, Pop1 = 1.
-        cJL_JPIMMED_2_01,       // Index Size = 2, Pop1 = 1.
-        cJL_JPIMMED_3_01,       // Index Size = 3, Pop1 = 1.
-
-#ifdef JU_64BIT
-        cJL_JPIMMED_4_01,       // Index Size = 4, Pop1 = 1.
-        cJL_JPIMMED_5_01,       // Index Size = 5, Pop1 = 1.
-        cJL_JPIMMED_6_01,       // Index Size = 6, Pop1 = 1.
-        cJL_JPIMMED_7_01,       // Index Size = 7, Pop1 = 1.
-#endif
-
-        cJL_JPIMMED_1_02,       // Index Size = 1, Pop1 = 2.
-        cJL_JPIMMED_1_03,       // Index Size = 1, Pop1 = 3.
-
-#ifdef JU_64BIT
-        cJL_JPIMMED_1_04,       // Index Size = 1, Pop1 = 4.
-        cJL_JPIMMED_1_05,       // Index Size = 1, Pop1 = 5.
-        cJL_JPIMMED_1_06,       // Index Size = 1, Pop1 = 6.
-        cJL_JPIMMED_1_07,       // Index Size = 1, Pop1 = 7.
-
-        cJL_JPIMMED_2_02,       // Index Size = 2, Pop1 = 2.
-        cJL_JPIMMED_2_03,       // Index Size = 2, Pop1 = 3.
-
-        cJL_JPIMMED_3_02,       // Index Size = 3, Pop1 = 2.
-#endif
-
-// This special Type is merely a sentinel for doing relative calculations.
-// This value should not be used in switch statements (to avoid allocating code
-// for it), which is also why it appears at the end of the enum list.
-
-        cJL_JPIMMED_CAP
-
-} jpL_Type_t;
-
-
-// RELATED VALUES:
-
-// Index Size (state) for leaf JP, and JP type based on Index Size (state):
-
-#define JL_LEAFINDEXSIZE(jpType) ((jpType)    - cJL_JPLEAF1 + 1)
-#define JL_LEAFTYPE(IndexSize)   ((IndexSize) + cJL_JPLEAF1 - 1)
-
-
-// MAXIMUM POPULATIONS OF LINEAR LEAVES:
-
-#ifndef JU_64BIT // 32-bit
-
-#define J_L_MAXB                (sizeof(Word_t) * 64)
-#define ALLOCSIZES { 3, 5, 7, 11, 15, 23, 32, 47, 64, TERMINATOR } // in words.
-#define cJL_LEAF1_MAXWORDS               (32)   // max Leaf1 size in words.
-
-// Note:  cJL_LEAF1_MAXPOP1 is chosen such that the index portion is less than
-// 32 bytes -- the number of bytes the index takes in a bitmap leaf.
-
-#define cJL_LEAF1_MAXPOP1 \
-   ((cJL_LEAF1_MAXWORDS * cJU_BYTESPERWORD)/(1 + cJU_BYTESPERWORD))
-#define cJL_LEAF2_MAXPOP1       (J_L_MAXB / (2 + cJU_BYTESPERWORD))
-#define cJL_LEAF3_MAXPOP1       (J_L_MAXB / (3 + cJU_BYTESPERWORD))
-#define cJL_LEAFW_MAXPOP1 \
-           ((J_L_MAXB - cJU_BYTESPERWORD) / (2 * cJU_BYTESPERWORD))
-
-#else // 64-bit
-
-#define J_L_MAXB                (sizeof(Word_t) * 64)
-#define ALLOCSIZES { 3, 5, 7, 11, 15, 23, 32, 47, 64, TERMINATOR } // in words.
-#define cJL_LEAF1_MAXWORDS       (15)   // max Leaf1 size in words.
-
-#define cJL_LEAF1_MAXPOP1 \
-   ((cJL_LEAF1_MAXWORDS * cJU_BYTESPERWORD)/(1 + cJU_BYTESPERWORD))
-#define cJL_LEAF2_MAXPOP1       (J_L_MAXB / (2 + cJU_BYTESPERWORD))
-#define cJL_LEAF3_MAXPOP1       (J_L_MAXB / (3 + cJU_BYTESPERWORD))
-#define cJL_LEAF4_MAXPOP1       (J_L_MAXB / (4 + cJU_BYTESPERWORD))
-#define cJL_LEAF5_MAXPOP1       (J_L_MAXB / (5 + cJU_BYTESPERWORD))
-#define cJL_LEAF6_MAXPOP1       (J_L_MAXB / (6 + cJU_BYTESPERWORD))
-#define cJL_LEAF7_MAXPOP1       (J_L_MAXB / (7 + cJU_BYTESPERWORD))
-#define cJL_LEAFW_MAXPOP1 \
-           ((J_L_MAXB - cJU_BYTESPERWORD) / (2 * cJU_BYTESPERWORD))
-
-#endif // 64-bit
-
-
-// MAXIMUM POPULATIONS OF IMMEDIATE JPs:
-//
-// These specify the maximum Population of immediate JPs with various Index
-// Sizes (== sizes of remaining undecoded Index bits).  Since the JP Types enum
-// already lists all the immediates in order by state and size, calculate these
-// values from it to avoid redundancy.
-
-#define cJL_IMMED1_MAXPOP1  ((cJU_BYTESPERWORD - 1) / 1)        // 3 [7].
-#define cJL_IMMED2_MAXPOP1  ((cJU_BYTESPERWORD - 1) / 2)        // 1 [3].
-#define cJL_IMMED3_MAXPOP1  ((cJU_BYTESPERWORD - 1) / 3)        // 1 [2].
-
-#ifdef JU_64BIT
-#define cJL_IMMED4_MAXPOP1  ((cJU_BYTESPERWORD - 1) / 4)        //   [1].
-#define cJL_IMMED5_MAXPOP1  ((cJU_BYTESPERWORD - 1) / 5)        //   [1].
-#define cJL_IMMED6_MAXPOP1  ((cJU_BYTESPERWORD - 1) / 6)        //   [1].
-#define cJL_IMMED7_MAXPOP1  ((cJU_BYTESPERWORD - 1) / 7)        //   [1].
-#endif
-
-
-// ****************************************************************************
-// JUDYL LEAF BITMAP (JLLB) SUPPORT
-// ****************************************************************************
-//
-// Assemble bitmap leaves out of smaller units that put bitmap subexpanses
-// close to their associated pointers.  Why not just use a bitmap followed by a
-// series of pointers?  (See 4.27.)  Turns out this wastes a cache fill on
-// systems with smaller cache lines than the assumed value cJU_WORDSPERCL.
-
-#define JL_JLB_BITMAP(Pjlb, Subexp)  ((Pjlb)->jLlb_jLlbs[Subexp].jLlbs_Bitmap)
-#define JL_JLB_PVALUE(Pjlb, Subexp)  ((Pjlb)->jLlb_jLlbs[Subexp].jLlbs_PValue)
-
-typedef struct J__UDYL_LEAF_BITMAP_SUBEXPANSE
-{
-        BITMAPL_t jLlbs_Bitmap;
-        Pjv_t     jLlbs_PValue;
-
-} jLlbs_t;
-
-typedef struct J__UDYL_LEAF_BITMAP
-{
-        jLlbs_t jLlb_jLlbs[cJU_NUMSUBEXPL];
-
-} jLlb_t, * PjLlb_t;
-
-// Words per bitmap leaf:
-
-#define cJL_WORDSPERLEAFB1  (sizeof(jLlb_t) / cJU_BYTESPERWORD)
-
-
-// ****************************************************************************
-// MEMORY ALLOCATION SUPPORT
-// ****************************************************************************
-
-// ARRAY-GLOBAL INFORMATION:
-//
-// At the cost of an occasional additional cache fill, this object, which is
-// pointed at by a JRP and in turn points to a JP_BRANCH*, carries array-global
-// information about a JudyL array that has sufficient population to amortize
-// the cost.  The jpm_Pop0 field prevents having to add up the total population
-// for the array in insert, delete, and count code.  The jpm_JP field prevents
-// having to build a fake JP for entry to a state machine; however, the
-// jp_DcdPopO field in jpm_JP, being one byte too small, is not used.
-//
-// Note:  Struct fields are ordered to keep "hot" data in the first 8 words
-// (see left-margin comments) for machines with 8-word cache lines, and to keep
-// sub-word fields together for efficient packing.
-
-typedef struct J_UDYL_POPULATION_AND_MEMORY
-{
-/* 1 */ Word_t     jpm_Pop0;            // total population-1 in array.
-/* 2 */ jp_t       jpm_JP;              // JP to first branch; see above.
-/* 4 */ Word_t     jpm_LastUPop0;       // last jpm_Pop0 when convert to BranchU
-/* 7 */ Pjv_t      jpm_PValue;          // pointer to value to return.
-// Note:  Field names match PJError_t for convenience in macros:
-/* 8 */ char       je_Errno;            // one of the enums in Judy.h.
-/* 8/9  */ int     je_ErrID;            // often an internal source line number.
-/* 9/10 */ Word_t  jpm_TotalMemWords;   // words allocated in array.
-} jLpm_t, *PjLpm_t;
-
-
-// TABLES FOR DETERMINING IF LEAVES HAVE ROOM TO GROW:
-//
-// These tables indicate if a given memory chunk can support growth of a given
-// object into wasted (rounded-up) memory in the chunk.  Note:  This violates
-// the hiddenness of the JudyMalloc code.
-
-extern const uint8_t j__L_Leaf1PopToWords[cJL_LEAF1_MAXPOP1 + 1];
-extern const uint8_t j__L_Leaf2PopToWords[cJL_LEAF2_MAXPOP1 + 1];
-extern const uint8_t j__L_Leaf3PopToWords[cJL_LEAF3_MAXPOP1 + 1];
-#ifdef JU_64BIT
-extern const uint8_t j__L_Leaf4PopToWords[cJL_LEAF4_MAXPOP1 + 1];
-extern const uint8_t j__L_Leaf5PopToWords[cJL_LEAF5_MAXPOP1 + 1];
-extern const uint8_t j__L_Leaf6PopToWords[cJL_LEAF6_MAXPOP1 + 1];
-extern const uint8_t j__L_Leaf7PopToWords[cJL_LEAF7_MAXPOP1 + 1];
-#endif
-extern const uint8_t j__L_LeafWPopToWords[cJL_LEAFW_MAXPOP1 + 1];
-extern const uint8_t j__L_LeafVPopToWords[];
-
-// These tables indicate where value areas start:
-
-extern const uint8_t j__L_Leaf1Offset    [cJL_LEAF1_MAXPOP1 + 1];
-extern const uint8_t j__L_Leaf2Offset    [cJL_LEAF2_MAXPOP1 + 1];
-extern const uint8_t j__L_Leaf3Offset    [cJL_LEAF3_MAXPOP1 + 1];
-#ifdef JU_64BIT
-extern const uint8_t j__L_Leaf4Offset    [cJL_LEAF4_MAXPOP1 + 1];
-extern const uint8_t j__L_Leaf5Offset    [cJL_LEAF5_MAXPOP1 + 1];
-extern const uint8_t j__L_Leaf6Offset    [cJL_LEAF6_MAXPOP1 + 1];
-extern const uint8_t j__L_Leaf7Offset    [cJL_LEAF7_MAXPOP1 + 1];
-#endif
-extern const uint8_t j__L_LeafWOffset    [cJL_LEAFW_MAXPOP1 + 1];
-
-// Also define macros to hide the details in the code using these tables.
-
-#define JL_LEAF1GROWINPLACE(Pop1) \
-        J__U_GROWCK(Pop1, cJL_LEAF1_MAXPOP1, j__L_Leaf1PopToWords)
-#define JL_LEAF2GROWINPLACE(Pop1) \
-        J__U_GROWCK(Pop1, cJL_LEAF2_MAXPOP1, j__L_Leaf2PopToWords)
-#define JL_LEAF3GROWINPLACE(Pop1) \
-        J__U_GROWCK(Pop1, cJL_LEAF3_MAXPOP1, j__L_Leaf3PopToWords)
-#ifdef JU_64BIT
-#define JL_LEAF4GROWINPLACE(Pop1) \
-        J__U_GROWCK(Pop1, cJL_LEAF4_MAXPOP1, j__L_Leaf4PopToWords)
-#define JL_LEAF5GROWINPLACE(Pop1) \
-        J__U_GROWCK(Pop1, cJL_LEAF5_MAXPOP1, j__L_Leaf5PopToWords)
-#define JL_LEAF6GROWINPLACE(Pop1) \
-        J__U_GROWCK(Pop1, cJL_LEAF6_MAXPOP1, j__L_Leaf6PopToWords)
-#define JL_LEAF7GROWINPLACE(Pop1) \
-        J__U_GROWCK(Pop1, cJL_LEAF7_MAXPOP1, j__L_Leaf7PopToWords)
-#endif
-#define JL_LEAFWGROWINPLACE(Pop1) \
-        J__U_GROWCK(Pop1, cJL_LEAFW_MAXPOP1, j__L_LeafWPopToWords)
-#define JL_LEAFVGROWINPLACE(Pop1)  \
-        J__U_GROWCK(Pop1, cJU_BITSPERSUBEXPL,  j__L_LeafVPopToWords)
-
-#define JL_LEAF1VALUEAREA(Pjv,Pop1)  (((PWord_t)(Pjv)) + j__L_Leaf1Offset[Pop1])
-#define JL_LEAF2VALUEAREA(Pjv,Pop1)  (((PWord_t)(Pjv)) + j__L_Leaf2Offset[Pop1])
-#define JL_LEAF3VALUEAREA(Pjv,Pop1)  (((PWord_t)(Pjv)) + j__L_Leaf3Offset[Pop1])
-#ifdef JU_64BIT
-#define JL_LEAF4VALUEAREA(Pjv,Pop1)  (((PWord_t)(Pjv)) + j__L_Leaf4Offset[Pop1])
-#define JL_LEAF5VALUEAREA(Pjv,Pop1)  (((PWord_t)(Pjv)) + j__L_Leaf5Offset[Pop1])
-#define JL_LEAF6VALUEAREA(Pjv,Pop1)  (((PWord_t)(Pjv)) + j__L_Leaf6Offset[Pop1])
-#define JL_LEAF7VALUEAREA(Pjv,Pop1)  (((PWord_t)(Pjv)) + j__L_Leaf7Offset[Pop1])
-#endif
-#define JL_LEAFWVALUEAREA(Pjv,Pop1)  (((PWord_t)(Pjv)) + j__L_LeafWOffset[Pop1])
-
-#define JL_LEAF1POPTOWORDS(Pop1)        (j__L_Leaf1PopToWords[Pop1])
-#define JL_LEAF2POPTOWORDS(Pop1)        (j__L_Leaf2PopToWords[Pop1])
-#define JL_LEAF3POPTOWORDS(Pop1)        (j__L_Leaf3PopToWords[Pop1])
-#ifdef JU_64BIT
-#define JL_LEAF4POPTOWORDS(Pop1)        (j__L_Leaf4PopToWords[Pop1])
-#define JL_LEAF5POPTOWORDS(Pop1)        (j__L_Leaf5PopToWords[Pop1])
-#define JL_LEAF6POPTOWORDS(Pop1)        (j__L_Leaf6PopToWords[Pop1])
-#define JL_LEAF7POPTOWORDS(Pop1)        (j__L_Leaf7PopToWords[Pop1])
-#endif
-#define JL_LEAFWPOPTOWORDS(Pop1)        (j__L_LeafWPopToWords[Pop1])
-#define JL_LEAFVPOPTOWORDS(Pop1)        (j__L_LeafVPopToWords[Pop1])
-
-
-// FUNCTIONS TO ALLOCATE OBJECTS:
-
-PjLpm_t j__udyLAllocJLPM(void);                         // constant size.
-
-Pjbl_t  j__udyLAllocJBL(          PjLpm_t);             // constant size.
-Pjbb_t  j__udyLAllocJBB(          PjLpm_t);             // constant size.
-Pjp_t   j__udyLAllocJBBJP(Word_t, PjLpm_t);
-Pjbu_t  j__udyLAllocJBU(          PjLpm_t);             // constant size.
-
-Pjll_t  j__udyLAllocJLL1( Word_t, PjLpm_t);
-Pjll_t  j__udyLAllocJLL2( Word_t, PjLpm_t);
-Pjll_t  j__udyLAllocJLL3( Word_t, PjLpm_t);
-
-#ifdef JU_64BIT
-Pjll_t  j__udyLAllocJLL4( Word_t, PjLpm_t);
-Pjll_t  j__udyLAllocJLL5( Word_t, PjLpm_t);
-Pjll_t  j__udyLAllocJLL6( Word_t, PjLpm_t);
-Pjll_t  j__udyLAllocJLL7( Word_t, PjLpm_t);
-#endif
-
-Pjlw_t  j__udyLAllocJLW(  Word_t         );             // no PjLpm_t needed.
-PjLlb_t j__udyLAllocJLB1(         PjLpm_t);             // constant size.
-Pjv_t   j__udyLAllocJV(   Word_t, PjLpm_t);
-
-
-// FUNCTIONS TO FREE OBJECTS:
-
-void    j__udyLFreeJLPM( PjLpm_t,        PjLpm_t);      // constant size.
-
-void    j__udyLFreeJBL(  Pjbl_t,         PjLpm_t);      // constant size.
-void    j__udyLFreeJBB(  Pjbb_t,         PjLpm_t);      // constant size.
-void    j__udyLFreeJBBJP(Pjp_t,  Word_t, PjLpm_t);
-void    j__udyLFreeJBU(  Pjbu_t,         PjLpm_t);      // constant size.
-
-void    j__udyLFreeJLL1( Pjll_t, Word_t, PjLpm_t);
-void    j__udyLFreeJLL2( Pjll_t, Word_t, PjLpm_t);
-void    j__udyLFreeJLL3( Pjll_t, Word_t, PjLpm_t);
-
-#ifdef JU_64BIT
-void    j__udyLFreeJLL4( Pjll_t, Word_t, PjLpm_t);
-void    j__udyLFreeJLL5( Pjll_t, Word_t, PjLpm_t);
-void    j__udyLFreeJLL6( Pjll_t, Word_t, PjLpm_t);
-void    j__udyLFreeJLL7( Pjll_t, Word_t, PjLpm_t);
-#endif
-
-void    j__udyLFreeJLW(  Pjlw_t, Word_t, PjLpm_t);
-void    j__udyLFreeJLB1( PjLlb_t,        PjLpm_t);      // constant size.
-void    j__udyLFreeJV(   Pjv_t,  Word_t, PjLpm_t);
-void    j__udyLFreeSM(   Pjp_t,          PjLpm_t);      // everything below Pjp.
-
-#endif // ! _JUDYL_INCLUDED
diff --git a/libs/klib/judy/JudyMalloc.c b/libs/klib/judy/JudyMalloc.c
deleted file mode 100644
index 165521f..0000000
--- a/libs/klib/judy/JudyMalloc.c
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright (C) 2000 - 2002 Hewlett-Packard Company
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the term of the GNU Lesser 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 Lesser General Public License
-// for more details.
-//
-// You should have received a copy of the GNU Lesser 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
-// _________________
-
-// ************************************************************************ //
-//                    JUDY - Memory Allocater                             //
-//                              -by-					  //
-//		         Douglas L. Baskins				  //
-//			  Hewlett Packard				  //
-//                        Fort Collins, Co				  //
-//                         (970) 229-2027				  //
-//									  //
-// ************************************************************************ //
-
-// JUDY INCLUDE FILES
-#include "Judy.h"
-
-// ****************************************************************************
-// J U D Y   M A L L O C
-//
-// Allocate RAM.  This is the single location in Judy code that calls
-// malloc(3C).  Note:  JPM accounting occurs at a higher level.
-
-Word_t JudyMalloc(
-	Word_t Words)
-{
-	Word_t Addr;
-
-	Addr = (Word_t) malloc(Words * sizeof(Word_t));
-	return(Addr);
-
-} // JudyMalloc()
-
-
-// ****************************************************************************
-// J U D Y   F R E E
-
-void JudyFree(
-	void * PWord,
-	Word_t Words)
-{
-	(void) Words;
-	free(PWord);
-
-} // JudyFree()
-
-
-// ****************************************************************************
-// J U D Y   M A L L O C
-//
-// Higher-level "wrapper" for allocating objects that need not be in RAM,
-// although at this time they are in fact only in RAM.  Later we hope that some
-// entire subtrees (at a JPM or branch) can be "virtual", so their allocations
-// and frees should go through this level.
-
-Word_t JudyMallocVirtual(
-	Word_t Words)
-{
-	return(JudyMalloc(Words));
-
-} // JudyMallocVirtual()
-
-
-// ****************************************************************************
-// J U D Y   F R E E
-
-void JudyFreeVirtual(
-	void * PWord,
-	Word_t Words)
-{
-        JudyFree(PWord, Words);
-
-} // JudyFreeVirtual()
diff --git a/libs/klib/judy/JudyMallocIF.c b/libs/klib/judy/JudyMallocIF.c
deleted file mode 100644
index fa91d80..0000000
--- a/libs/klib/judy/JudyMallocIF.c
+++ /dev/null
@@ -1,780 +0,0 @@
-// Copyright (C) 2000 - 2002 Hewlett-Packard Company
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the term of the GNU Lesser 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 Lesser General Public License
-// for more details.
-//
-// You should have received a copy of the GNU Lesser 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
-// _________________
-
-// Judy malloc/free interface functions for Judy1 and JudyL.
-//
-// Compile with one of -DJUDY1 or -DJUDYL.
-//
-// Compile with -DTRACEMI (Malloc Interface) to turn on tracing of malloc/free
-// calls at the interface level.  (See also TRACEMF in lower-level code.)
-// Use -DTRACEMI2 for a terser format suitable for trace analysis.
-//
-// There can be malloc namespace bits in the LSBs of "raw" addresses from most,
-// but not all, of the j__udy*Alloc*() functions; see also JudyPrivate.h.  To
-// test the Judy code, compile this file with -DMALLOCBITS and use debug flavor
-// only (for assertions).  This test ensures that (a) all callers properly mask
-// the namespace bits out before dereferencing a pointer (or else a core dump
-// occurs), and (b) all callers send "raw" (unmasked) addresses to
-// j__udy*Free*() calls.
-//
-// Note:  Currently -DDEBUG turns on MALLOCBITS automatically.
-
-#if (! (defined(JUDY1) || defined(JUDYL)))
-#error:  One of -DJUDY1 or -DJUDYL must be specified.
-#endif
-
-#ifdef JUDY1
-#include "Judy1.h"
-#else
-#include "JudyL.h"
-#endif
-
-#include "JudyPrivate1L.h"
-
-// Set "hidden" global j__uMaxWords to the maximum number of words to allocate
-// to any one array (large enough to have a JPM, otherwise j__uMaxWords is
-// ignored), to trigger a fake malloc error when the number is exceeded.  Note,
-// this code is always executed, not #ifdefd, because its virtually free.
-//
-// Note:  To keep the MALLOC macro faster and simpler, set j__uMaxWords to
-// MAXINT, not zero, by default.
-
-Word_t j__uMaxWords = ~0UL;
-
-// This macro hides the faking of a malloc failure:
-//
-// Note:  To keep this fast, just compare WordsPrev to j__uMaxWords without the
-// complexity of first adding WordsNow, meaning the trigger point is not
-// exactly where you might assume, but it shouldnt matter.
-
-#define MALLOC(MallocFunc,WordsPrev,WordsNow) \
-        (((WordsPrev) > j__uMaxWords) ? 0UL : MallocFunc(WordsNow))
-
-// Clear words starting at address:
-//
-// Note:  Only use this for objects that care; in other cases, it doesnt
-// matter if the objects memory is pre-zeroed.
-
-#define ZEROWORDS(Addr,Words)                   \
-        {                                       \
-            Word_t  Words__ = (Words);          \
-            PWord_t Addr__  = (PWord_t) (Addr); \
-            while (Words__--) *Addr__++ = 0UL;  \
-        }
-
-#ifdef TRACEMI
-
-// TRACING SUPPORT:
-//
-// Note:  For TRACEMI, use a format for address printing compatible with other
-// tracing facilities; in particular, %x not %lx, to truncate the "noisy" high
-// part on 64-bit systems.
-//
-// TBD: The trace macros need fixing for alternate address types.
-//
-// Note:  TRACEMI2 supports trace analysis no matter the underlying malloc/free
-// engine used.
-
-#include <stdio.h>
-
-static Word_t j__udyMemSequence = 0L;   // event sequence number.
-
-#define TRACE_ALLOC5(a,b,c,d,e)   (void) printf(a, (b), c, d)
-#define TRACE_FREE5( a,b,c,d,e)   (void) printf(a, (b), c, d)
-#define TRACE_ALLOC6(a,b,c,d,e,f) (void) printf(a, (b), c, d, e)
-#define TRACE_FREE6( a,b,c,d,e,f) (void) printf(a, (b), c, d, e)
-
-#else
-
-#ifdef TRACEMI2
-
-#include <stdio.h>
-
-#define b_pw cJU_BYTESPERWORD
-
-#define TRACE_ALLOC5(a,b,c,d,e)   \
-            (void) printf("a %lx %lx %lx\n", (b), (d) * b_pw, e)
-#define TRACE_FREE5( a,b,c,d,e)   \
-            (void) printf("f %lx %lx %lx\n", (b), (d) * b_pw, e)
-#define TRACE_ALLOC6(a,b,c,d,e,f)         \
-            (void) printf("a %lx %lx %lx\n", (b), (e) * b_pw, f)
-#define TRACE_FREE6( a,b,c,d,e,f)         \
-            (void) printf("f %lx %lx %lx\n", (b), (e) * b_pw, f)
-
-static Word_t j__udyMemSequence = 0L;   // event sequence number.
-
-#else
-
-#define TRACE_ALLOC5(a,b,c,d,e)   // null.
-#define TRACE_FREE5( a,b,c,d,e)   // null.
-#define TRACE_ALLOC6(a,b,c,d,e,f) // null.
-#define TRACE_FREE6( a,b,c,d,e,f) // null.
-
-#endif // ! TRACEMI2
-#endif // ! TRACEMI
-
-
-// MALLOC NAMESPACE SUPPORT:
-
-#if (defined(DEBUG) && (! defined(MALLOCBITS))) // for now, DEBUG => MALLOCBITS:
-#define MALLOCBITS 1
-#endif
-
-#ifdef MALLOCBITS
-#define MALLOCBITS_VALUE 0x3    // bit pattern to use.
-#define MALLOCBITS_MASK  0x7    // note: matches mask__ in JudyPrivate.h.
-
-#define MALLOCBITS_SET( Type,Addr) \
-        ((Addr) = (Type) ((Word_t) (Addr) |  MALLOCBITS_VALUE))
-#define MALLOCBITS_TEST(Type,Addr) \
-        assert((((Word_t) (Addr)) & MALLOCBITS_MASK) == MALLOCBITS_VALUE); \
-        ((Addr) = (Type) ((Word_t) (Addr) & ~MALLOCBITS_VALUE))
-#else
-#define MALLOCBITS_SET( Type,Addr)  // null.
-#define MALLOCBITS_TEST(Type,Addr)  // null.
-#endif
-
-
-// SAVE ERROR INFORMATION IN A Pjpm:
-//
-// "Small" (invalid) Addr values are used to distinguish overrun and no-mem
-// errors.  (TBD, non-zero invalid values are no longer returned from
-// lower-level functions, that is, JU_ERRNO_OVERRUN is no longer detected.)
-
-#define J__UDYSETALLOCERROR(Addr)                                       \
-        {                                                               \
-            JU_ERRID(Pjpm) = __LINE__;                                  \
-            if ((Word_t) (Addr) > 0) JU_ERRNO(Pjpm) = JU_ERRNO_OVERRUN; \
-            else                     JU_ERRNO(Pjpm) = JU_ERRNO_NOMEM;   \
-            return(0);                                                  \
-        }
-
-
-// ****************************************************************************
-// ALLOCATION FUNCTIONS:
-//
-// To help the compiler catch coding errors, each function returns a specific
-// object type.
-//
-// Note:  Only j__udyAllocJPM() and j__udyAllocJLW() return multiple values <=
-// sizeof(Word_t) to indicate the type of memory allocation failure.  Other
-// allocation functions convert this failure to a JU_ERRNO.
-
-
-// Note:  Unlike other j__udyAlloc*() functions, Pjpms are returned non-raw,
-// that is, without malloc namespace or root pointer type bits:
-
-FUNCTION Pjpm_t j__udyAllocJPM(void)
-{
-        Word_t Words = (sizeof(jpm_t) + cJU_BYTESPERWORD - 1) / cJU_BYTESPERWORD;
-        Pjpm_t Pjpm  = (Pjpm_t) MALLOC(JudyMalloc, Words, Words);
-
-        assert((Words * cJU_BYTESPERWORD) == sizeof(jpm_t));
-
-        if ((Word_t) Pjpm > sizeof(Word_t))
-        {
-            ZEROWORDS(Pjpm, Words);
-            Pjpm->jpm_TotalMemWords = Words;
-        }
-
-        TRACE_ALLOC5("0x%x %8lu = j__udyAllocJPM(), Words = %lu\n",
-                     Pjpm, j__udyMemSequence++, Words, cJU_LEAFW_MAXPOP1 + 1);
-        // MALLOCBITS_SET(Pjpm_t, Pjpm);  // see above.
-        return(Pjpm);
-
-} // j__udyAllocJPM()
-
-
-FUNCTION Pjbl_t j__udyAllocJBL(Pjpm_t Pjpm)
-{
-        Word_t Words   = sizeof(jbl_t) / cJU_BYTESPERWORD;
-        Pjbl_t PjblRaw = (Pjbl_t) MALLOC(JudyMallocVirtual,
-                                         Pjpm->jpm_TotalMemWords, Words);
-
-        assert((Words * cJU_BYTESPERWORD) == sizeof(jbl_t));
-
-        if ((Word_t) PjblRaw > sizeof(Word_t))
-        {
-            ZEROWORDS(P_JBL(PjblRaw), Words);
-            Pjpm->jpm_TotalMemWords += Words;
-        }
-        else { J__UDYSETALLOCERROR(PjblRaw); }
-
-        TRACE_ALLOC5("0x%x %8lu = j__udyAllocJBL(), Words = %lu\n", PjblRaw,
-                     j__udyMemSequence++, Words, (Pjpm->jpm_Pop0) + 2);
-        MALLOCBITS_SET(Pjbl_t, PjblRaw);
-        return(PjblRaw);
-
-} // j__udyAllocJBL()
-
-
-FUNCTION Pjbb_t j__udyAllocJBB(Pjpm_t Pjpm)
-{
-        Word_t Words   = sizeof(jbb_t) / cJU_BYTESPERWORD;
-        Pjbb_t PjbbRaw = (Pjbb_t) MALLOC(JudyMallocVirtual,
-                                         Pjpm->jpm_TotalMemWords, Words);
-
-        assert((Words * cJU_BYTESPERWORD) == sizeof(jbb_t));
-
-        if ((Word_t) PjbbRaw > sizeof(Word_t))
-        {
-            ZEROWORDS(P_JBB(PjbbRaw), Words);
-            Pjpm->jpm_TotalMemWords += Words;
-        }
-        else { J__UDYSETALLOCERROR(PjbbRaw); }
-
-        TRACE_ALLOC5("0x%x %8lu = j__udyAllocJBB(), Words = %lu\n", PjbbRaw,
-                     j__udyMemSequence++, Words, (Pjpm->jpm_Pop0) + 2);
-        MALLOCBITS_SET(Pjbb_t, PjbbRaw);
-        return(PjbbRaw);
-
-} // j__udyAllocJBB()
-
-
-FUNCTION Pjp_t j__udyAllocJBBJP(Word_t NumJPs, Pjpm_t Pjpm)
-{
-        Word_t Words = JU_BRANCHJP_NUMJPSTOWORDS(NumJPs);
-        Pjp_t  PjpRaw;
-
-        PjpRaw = (Pjp_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
-
-        if ((Word_t) PjpRaw > sizeof(Word_t))
-        {
-            Pjpm->jpm_TotalMemWords += Words;
-        }
-        else { J__UDYSETALLOCERROR(PjpRaw); }
-
-        TRACE_ALLOC6("0x%x %8lu = j__udyAllocJBBJP(%lu), Words = %lu\n", PjpRaw,
-                     j__udyMemSequence++, NumJPs, Words, (Pjpm->jpm_Pop0) + 2);
-        MALLOCBITS_SET(Pjp_t, PjpRaw);
-        return(PjpRaw);
-
-} // j__udyAllocJBBJP()
-
-
-FUNCTION Pjbu_t j__udyAllocJBU(Pjpm_t Pjpm)
-{
-        Word_t Words   = sizeof(jbu_t) / cJU_BYTESPERWORD;
-        Pjbu_t PjbuRaw = (Pjbu_t) MALLOC(JudyMallocVirtual,
-                                         Pjpm->jpm_TotalMemWords, Words);
-
-        assert((Words * cJU_BYTESPERWORD) == sizeof(jbu_t));
-
-        if ((Word_t) PjbuRaw > sizeof(Word_t))
-        {
-            Pjpm->jpm_TotalMemWords += Words;
-        }
-        else { J__UDYSETALLOCERROR(PjbuRaw); }
-
-        TRACE_ALLOC5("0x%x %8lu = j__udyAllocJBU(), Words = %lu\n", PjbuRaw,
-                     j__udyMemSequence++, Words, (Pjpm->jpm_Pop0) + 2);
-        MALLOCBITS_SET(Pjbu_t, PjbuRaw);
-        return(PjbuRaw);
-
-} // j__udyAllocJBU()
-
-
-#if (defined(JUDYL) || (! defined(JU_64BIT)))
-
-FUNCTION Pjll_t j__udyAllocJLL1(Word_t Pop1, Pjpm_t Pjpm)
-{
-        Word_t Words = JU_LEAF1POPTOWORDS(Pop1);
-        Pjll_t PjllRaw;
-
-        PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
-
-        if ((Word_t) PjllRaw > sizeof(Word_t))
-        {
-            Pjpm->jpm_TotalMemWords += Words;
-        }
-        else { J__UDYSETALLOCERROR(PjllRaw); }
-
-        TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL1(%lu), Words = %lu\n", PjllRaw,
-                     j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
-        MALLOCBITS_SET(Pjll_t, PjllRaw);
-        return(PjllRaw);
-
-} // j__udyAllocJLL1()
-
-#endif // (JUDYL || (! JU_64BIT))
-
-
-FUNCTION Pjll_t j__udyAllocJLL2(Word_t Pop1, Pjpm_t Pjpm)
-{
-        Word_t Words = JU_LEAF2POPTOWORDS(Pop1);
-        Pjll_t PjllRaw;
-
-        PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
-
-        if ((Word_t) PjllRaw > sizeof(Word_t))
-        {
-            Pjpm->jpm_TotalMemWords += Words;
-        }
-        else { J__UDYSETALLOCERROR(PjllRaw); }
-
-        TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL2(%lu), Words = %lu\n", PjllRaw,
-                     j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
-        MALLOCBITS_SET(Pjll_t, PjllRaw);
-        return(PjllRaw);
-
-} // j__udyAllocJLL2()
-
-
-FUNCTION Pjll_t j__udyAllocJLL3(Word_t Pop1, Pjpm_t Pjpm)
-{
-        Word_t Words = JU_LEAF3POPTOWORDS(Pop1);
-        Pjll_t PjllRaw;
-
-        PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
-
-        if ((Word_t) PjllRaw > sizeof(Word_t))
-        {
-            Pjpm->jpm_TotalMemWords += Words;
-        }
-        else { J__UDYSETALLOCERROR(PjllRaw); }
-
-        TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL3(%lu), Words = %lu\n", PjllRaw,
-                     j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
-        MALLOCBITS_SET(Pjll_t, PjllRaw);
-        return(PjllRaw);
-
-} // j__udyAllocJLL3()
-
-
-#ifdef JU_64BIT
-
-FUNCTION Pjll_t j__udyAllocJLL4(Word_t Pop1, Pjpm_t Pjpm)
-{
-        Word_t Words = JU_LEAF4POPTOWORDS(Pop1);
-        Pjll_t PjllRaw;
-
-        PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
-
-        if ((Word_t) PjllRaw > sizeof(Word_t))
-        {
-            Pjpm->jpm_TotalMemWords += Words;
-        }
-        else { J__UDYSETALLOCERROR(PjllRaw); }
-
-        TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL4(%lu), Words = %lu\n", PjllRaw,
-                     j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
-        MALLOCBITS_SET(Pjll_t, PjllRaw);
-        return(PjllRaw);
-
-} // j__udyAllocJLL4()
-
-
-FUNCTION Pjll_t j__udyAllocJLL5(Word_t Pop1, Pjpm_t Pjpm)
-{
-        Word_t Words = JU_LEAF5POPTOWORDS(Pop1);
-        Pjll_t PjllRaw;
-
-        PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
-
-        if ((Word_t) PjllRaw > sizeof(Word_t))
-        {
-            Pjpm->jpm_TotalMemWords += Words;
-        }
-        else { J__UDYSETALLOCERROR(PjllRaw); }
-
-        TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL5(%lu), Words = %lu\n", PjllRaw,
-                     j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
-        MALLOCBITS_SET(Pjll_t, PjllRaw);
-        return(PjllRaw);
-
-} // j__udyAllocJLL5()
-
-
-FUNCTION Pjll_t j__udyAllocJLL6(Word_t Pop1, Pjpm_t Pjpm)
-{
-        Word_t Words = JU_LEAF6POPTOWORDS(Pop1);
-        Pjll_t PjllRaw;
-
-        PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
-
-        if ((Word_t) PjllRaw > sizeof(Word_t))
-        {
-            Pjpm->jpm_TotalMemWords += Words;
-        }
-        else { J__UDYSETALLOCERROR(PjllRaw); }
-
-        TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL6(%lu), Words = %lu\n", PjllRaw,
-                     j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
-        MALLOCBITS_SET(Pjll_t, PjllRaw);
-        return(PjllRaw);
-
-} // j__udyAllocJLL6()
-
-
-FUNCTION Pjll_t j__udyAllocJLL7(Word_t Pop1, Pjpm_t Pjpm)
-{
-        Word_t Words = JU_LEAF7POPTOWORDS(Pop1);
-        Pjll_t PjllRaw;
-
-        PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
-
-        if ((Word_t) PjllRaw > sizeof(Word_t))
-        {
-            Pjpm->jpm_TotalMemWords += Words;
-        }
-        else { J__UDYSETALLOCERROR(PjllRaw); }
-
-        TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL7(%lu), Words = %lu\n", PjllRaw,
-                     j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
-        MALLOCBITS_SET(Pjll_t, PjllRaw);
-        return(PjllRaw);
-
-} // j__udyAllocJLL7()
-
-#endif // JU_64BIT
-
-
-// Note:  Root-level leaf addresses are always whole words (Pjlw_t), and unlike
-// other j__udyAlloc*() functions, they are returned non-raw, that is, without
-// malloc namespace or root pointer type bits (the latter are added later by
-// the caller):
-
-FUNCTION Pjlw_t j__udyAllocJLW(Word_t Pop1)
-{
-        Word_t Words = JU_LEAFWPOPTOWORDS(Pop1);
-        Pjlw_t Pjlw  = (Pjlw_t) MALLOC(JudyMalloc, Words, Words);
-
-        TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLW(%lu), Words = %lu\n", Pjlw,
-                     j__udyMemSequence++, Pop1, Words, Pop1);
-        // MALLOCBITS_SET(Pjlw_t, Pjlw);  // see above.
-        return(Pjlw);
-
-} // j__udyAllocJLW()
-
-
-FUNCTION Pjlb_t j__udyAllocJLB1(Pjpm_t Pjpm)
-{
-        Word_t Words = sizeof(jlb_t) / cJU_BYTESPERWORD;
-        Pjlb_t PjlbRaw;
-
-        PjlbRaw = (Pjlb_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
-
-        assert((Words * cJU_BYTESPERWORD) == sizeof(jlb_t));
-
-        if ((Word_t) PjlbRaw > sizeof(Word_t))
-        {
-            ZEROWORDS(P_JLB(PjlbRaw), Words);
-            Pjpm->jpm_TotalMemWords += Words;
-        }
-        else { J__UDYSETALLOCERROR(PjlbRaw); }
-
-        TRACE_ALLOC5("0x%x %8lu = j__udyAllocJLB1(), Words = %lu\n", PjlbRaw,
-                     j__udyMemSequence++, Words, (Pjpm->jpm_Pop0) + 2);
-        MALLOCBITS_SET(Pjlb_t, PjlbRaw);
-        return(PjlbRaw);
-
-} // j__udyAllocJLB1()
-
-
-#ifdef JUDYL
-
-FUNCTION Pjv_t j__udyLAllocJV(Word_t Pop1, Pjpm_t Pjpm)
-{
-        Word_t Words = JL_LEAFVPOPTOWORDS(Pop1);
-        Pjv_t  PjvRaw;
-
-        PjvRaw = (Pjv_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
-
-        if ((Word_t) PjvRaw > sizeof(Word_t))
-        {
-            Pjpm->jpm_TotalMemWords += Words;
-        }
-        else { J__UDYSETALLOCERROR(PjvRaw); }
-
-        TRACE_ALLOC6("0x%x %8lu = j__udyLAllocJV(%lu), Words = %lu\n", PjvRaw,
-                     j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
-        MALLOCBITS_SET(Pjv_t, PjvRaw);
-        return(PjvRaw);
-
-} // j__udyLAllocJV()
-
-#endif // JUDYL
-
-
-// ****************************************************************************
-// FREE FUNCTIONS:
-//
-// To help the compiler catch coding errors, each function takes a specific
-// object type to free.
-
-
-// Note:  j__udyFreeJPM() receives a root pointer with NO root pointer type
-// bits present, that is, they must be stripped by the caller using P_JPM():
-
-FUNCTION void j__udyFreeJPM(Pjpm_t PjpmFree, Pjpm_t PjpmStats)
-{
-        Word_t Words = (sizeof(jpm_t) + cJU_BYTESPERWORD - 1) / cJU_BYTESPERWORD;
-
-        // MALLOCBITS_TEST(Pjpm_t, PjpmFree);   // see above.
-        JudyFree((Pvoid_t) PjpmFree, Words);
-
-        if (PjpmStats != (Pjpm_t) NULL) PjpmStats->jpm_TotalMemWords -= Words;
-
-// Note:  Log PjpmFree->jpm_Pop0, similar to other j__udyFree*() functions, not
-// an assumed value of cJU_LEAFW_MAXPOP1, for when the caller is
-// Judy*FreeArray(), jpm_Pop0 is set to 0, and the population after the free
-// really will be 0, not cJU_LEAFW_MAXPOP1.
-
-        TRACE_FREE6("0x%x %8lu =  j__udyFreeJPM(%lu), Words = %lu\n", PjpmFree,
-                    j__udyMemSequence++, Words, Words, PjpmFree->jpm_Pop0);
-
-
-} // j__udyFreeJPM()
-
-
-FUNCTION void j__udyFreeJBL(Pjbl_t Pjbl, Pjpm_t Pjpm)
-{
-        Word_t Words = sizeof(jbl_t) / cJU_BYTESPERWORD;
-
-        MALLOCBITS_TEST(Pjbl_t, Pjbl);
-        JudyFreeVirtual((Pvoid_t) Pjbl, Words);
-
-        Pjpm->jpm_TotalMemWords -= Words;
-
-        TRACE_FREE5("0x%x %8lu =  j__udyFreeJBL(), Words = %lu\n", Pjbl,
-                    j__udyMemSequence++, Words, Pjpm->jpm_Pop0);
-
-
-} // j__udyFreeJBL()
-
-
-FUNCTION void j__udyFreeJBB(Pjbb_t Pjbb, Pjpm_t Pjpm)
-{
-        Word_t Words = sizeof(jbb_t) / cJU_BYTESPERWORD;
-
-        MALLOCBITS_TEST(Pjbb_t, Pjbb);
-        JudyFreeVirtual((Pvoid_t) Pjbb, Words);
-
-        Pjpm->jpm_TotalMemWords -= Words;
-
-        TRACE_FREE5("0x%x %8lu =  j__udyFreeJBB(), Words = %lu\n", Pjbb,
-                    j__udyMemSequence++, Words, Pjpm->jpm_Pop0);
-
-
-} // j__udyFreeJBB()
-
-
-FUNCTION void j__udyFreeJBBJP(Pjp_t Pjp, Word_t NumJPs, Pjpm_t Pjpm)
-{
-        Word_t Words = JU_BRANCHJP_NUMJPSTOWORDS(NumJPs);
-
-        MALLOCBITS_TEST(Pjp_t, Pjp);
-        JudyFree((Pvoid_t) Pjp, Words);
-
-        Pjpm->jpm_TotalMemWords -= Words;
-
-        TRACE_FREE6("0x%x %8lu =  j__udyFreeJBBJP(%lu), Words = %lu\n", Pjp,
-                    j__udyMemSequence++, NumJPs, Words, Pjpm->jpm_Pop0);
-
-
-} // j__udyFreeJBBJP()
-
-
-FUNCTION void j__udyFreeJBU(Pjbu_t Pjbu, Pjpm_t Pjpm)
-{
-        Word_t Words = sizeof(jbu_t) / cJU_BYTESPERWORD;
-
-        MALLOCBITS_TEST(Pjbu_t, Pjbu);
-        JudyFreeVirtual((Pvoid_t) Pjbu, Words);
-
-        Pjpm->jpm_TotalMemWords -= Words;
-
-        TRACE_FREE5("0x%x %8lu =  j__udyFreeJBU(), Words = %lu\n", Pjbu,
-                    j__udyMemSequence++, Words, Pjpm->jpm_Pop0);
-
-
-} // j__udyFreeJBU()
-
-
-#if (defined(JUDYL) || (! defined(JU_64BIT)))
-
-FUNCTION void j__udyFreeJLL1(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm)
-{
-        Word_t Words = JU_LEAF1POPTOWORDS(Pop1);
-
-        MALLOCBITS_TEST(Pjll_t, Pjll);
-        JudyFree((Pvoid_t) Pjll, Words);
-
-        Pjpm->jpm_TotalMemWords -= Words;
-
-        TRACE_FREE6("0x%x %8lu =  j__udyFreeJLL1(%lu), Words = %lu\n", Pjll,
-                    j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
-
-
-} // j__udyFreeJLL1()
-
-#endif // (JUDYL || (! JU_64BIT))
-
-
-FUNCTION void j__udyFreeJLL2(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm)
-{
-        Word_t Words = JU_LEAF2POPTOWORDS(Pop1);
-
-        MALLOCBITS_TEST(Pjll_t, Pjll);
-        JudyFree((Pvoid_t) Pjll, Words);
-
-        Pjpm->jpm_TotalMemWords -= Words;
-
-        TRACE_FREE6("0x%x %8lu =  j__udyFreeJLL2(%lu), Words = %lu\n", Pjll,
-                    j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
-
-
-} // j__udyFreeJLL2()
-
-
-FUNCTION void j__udyFreeJLL3(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm)
-{
-        Word_t Words = JU_LEAF3POPTOWORDS(Pop1);
-
-        MALLOCBITS_TEST(Pjll_t, Pjll);
-        JudyFree((Pvoid_t) Pjll, Words);
-
-        Pjpm->jpm_TotalMemWords -= Words;
-
-        TRACE_FREE6("0x%x %8lu =  j__udyFreeJLL3(%lu), Words = %lu\n", Pjll,
-                    j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
-
-
-} // j__udyFreeJLL3()
-
-
-#ifdef JU_64BIT
-
-FUNCTION void j__udyFreeJLL4(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm)
-{
-        Word_t Words = JU_LEAF4POPTOWORDS(Pop1);
-
-        MALLOCBITS_TEST(Pjll_t, Pjll);
-        JudyFree((Pvoid_t) Pjll, Words);
-
-        Pjpm->jpm_TotalMemWords -= Words;
-
-        TRACE_FREE6("0x%x %8lu =  j__udyFreeJLL4(%lu), Words = %lu\n", Pjll,
-                    j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
-
-
-} // j__udyFreeJLL4()
-
-
-FUNCTION void j__udyFreeJLL5(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm)
-{
-        Word_t Words = JU_LEAF5POPTOWORDS(Pop1);
-
-        MALLOCBITS_TEST(Pjll_t, Pjll);
-        JudyFree((Pvoid_t) Pjll, Words);
-
-        Pjpm->jpm_TotalMemWords -= Words;
-
-        TRACE_FREE6("0x%x %8lu =  j__udyFreeJLL5(%lu), Words = %lu\n", Pjll,
-                    j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
-
-
-} // j__udyFreeJLL5()
-
-
-FUNCTION void j__udyFreeJLL6(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm)
-{
-        Word_t Words = JU_LEAF6POPTOWORDS(Pop1);
-
-        MALLOCBITS_TEST(Pjll_t, Pjll);
-        JudyFree((Pvoid_t) Pjll, Words);
-
-        Pjpm->jpm_TotalMemWords -= Words;
-
-        TRACE_FREE6("0x%x %8lu =  j__udyFreeJLL6(%lu), Words = %lu\n", Pjll,
-                    j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
-
-
-} // j__udyFreeJLL6()
-
-
-FUNCTION void j__udyFreeJLL7(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm)
-{
-        Word_t Words = JU_LEAF7POPTOWORDS(Pop1);
-
-        MALLOCBITS_TEST(Pjll_t, Pjll);
-        JudyFree((Pvoid_t) Pjll, Words);
-
-        Pjpm->jpm_TotalMemWords -= Words;
-
-        TRACE_FREE6("0x%x %8lu =  j__udyFreeJLL7(%lu), Words = %lu\n", Pjll,
-                    j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
-
-
-} // j__udyFreeJLL7()
-
-#endif // JU_64BIT
-
-
-// Note:  j__udyFreeJLW() receives a root pointer with NO root pointer type
-// bits present, that is, they are stripped by P_JLW():
-
-FUNCTION void j__udyFreeJLW(Pjlw_t Pjlw, Word_t Pop1, Pjpm_t Pjpm)
-{
-        Word_t Words = JU_LEAFWPOPTOWORDS(Pop1);
-
-        // MALLOCBITS_TEST(Pjlw_t, Pjlw);       // see above.
-        JudyFree((Pvoid_t) Pjlw, Words);
-
-        if (Pjpm) Pjpm->jpm_TotalMemWords -= Words;
-
-        TRACE_FREE6("0x%x %8lu =  j__udyFreeJLW(%lu), Words = %lu\n", Pjlw,
-                    j__udyMemSequence++, Pop1, Words, Pop1 - 1);
-
-
-} // j__udyFreeJLW()
-
-
-FUNCTION void j__udyFreeJLB1(Pjlb_t Pjlb, Pjpm_t Pjpm)
-{
-        Word_t Words = sizeof(jlb_t) / cJU_BYTESPERWORD;
-
-        MALLOCBITS_TEST(Pjlb_t, Pjlb);
-        JudyFree((Pvoid_t) Pjlb, Words);
-
-        Pjpm->jpm_TotalMemWords -= Words;
-
-        TRACE_FREE5("0x%x %8lu =  j__udyFreeJLB1(), Words = %lu\n", Pjlb,
-                    j__udyMemSequence++, Words, Pjpm->jpm_Pop0);
-
-
-} // j__udyFreeJLB1()
-
-
-#ifdef JUDYL
-
-FUNCTION void j__udyLFreeJV(Pjv_t Pjv, Word_t Pop1, Pjpm_t Pjpm)
-{
-        Word_t Words = JL_LEAFVPOPTOWORDS(Pop1);
-
-        MALLOCBITS_TEST(Pjv_t, Pjv);
-        JudyFree((Pvoid_t) Pjv, Words);
-
-        Pjpm->jpm_TotalMemWords -= Words;
-
-        TRACE_FREE6("0x%x %8lu = j__udyLFreeJV(%lu), Words = %lu\n", Pjv,
-                    j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
-
-
-} // j__udyLFreeJV()
-
-#endif // JUDYL
diff --git a/libs/klib/judy/JudyMemActive.c b/libs/klib/judy/JudyMemActive.c
deleted file mode 100644
index d95a134..0000000
--- a/libs/klib/judy/JudyMemActive.c
+++ /dev/null
@@ -1,257 +0,0 @@
-// Copyright (C) 2000 - 2002 Hewlett-Packard Company
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the term of the GNU Lesser 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 Lesser General Public License
-// for more details.
-//
-// You should have received a copy of the GNU Lesser 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
-// _________________
-
-// Return number of bytes of memory used to support a Judy1/L array.
-// Compile with one of -DJUDY1 or -DJUDYL.
-
-#if (! (defined(JUDY1) || defined(JUDYL)))
-#error:  One of -DJUDY1 or -DJUDYL must be specified.
-#endif
-
-#ifdef JUDY1
-#include "Judy1.h"
-#else
-#include "JudyL.h"
-#endif
-
-#include "JudyPrivate1L.h"
-
-FUNCTION static Word_t j__udyGetMemActive(Pjp_t);
-
-
-// ****************************************************************************
-// J U D Y   1   M E M   A C T I V E
-// J U D Y   L   M E M   A C T I V E
-
-#ifdef JUDY1
-FUNCTION Word_t Judy1MemActive
-#else
-FUNCTION Word_t JudyLMemActive
-#endif
-        (
-	Pcvoid_t PArray	        // from which to retrieve.
-        )
-{
-	if (PArray == (Pcvoid_t)NULL) return(0);
-
-	if (JU_LEAFW_POP0(PArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW
-        {
-	    Pjlw_t Pjlw = P_JLW(PArray);	// first word of leaf.
-            Word_t Words = Pjlw[0] + 1;		// population.
-#ifdef JUDY1
-            return((Words + 1) * sizeof(Word_t));
-#else
-            return(((Words * 2) + 1) * sizeof(Word_t));
-#endif
-        }
-	else
-	{
-	    Pjpm_t Pjpm = P_JPM(PArray);
-	    return(j__udyGetMemActive(&Pjpm->jpm_JP) + sizeof(jpm_t));
-	}
-
-} // JudyMemActive()
-
-
-// ****************************************************************************
-// __ J U D Y   G E T   M E M   A C T I V E
-
-FUNCTION static Word_t j__udyGetMemActive(
-	Pjp_t  Pjp)		// top of subtree.
-{
-	Word_t offset;		// in a branch.
-	Word_t Bytes = 0;	// actual bytes used at this level.
-	Word_t IdxSz;		// bytes per index in leaves
-
-	switch (JU_JPTYPE(Pjp))
-	{
-
-	case cJU_JPBRANCH_L2:
-	case cJU_JPBRANCH_L3:
-#ifdef JU_64BIT
-	case cJU_JPBRANCH_L4:
-	case cJU_JPBRANCH_L5:
-	case cJU_JPBRANCH_L6:
-	case cJU_JPBRANCH_L7:
-#endif
-	case cJU_JPBRANCH_L:
-	{
-	    Pjbl_t Pjbl = P_JBL(Pjp->jp_Addr);
-
-	    for (offset = 0; offset < (Pjbl->jbl_NumJPs); ++offset)
-	        Bytes += j__udyGetMemActive((Pjbl->jbl_jp) + offset);
-
-	    return(Bytes + sizeof(jbl_t));
-	}
-
-	case cJU_JPBRANCH_B2:
-	case cJU_JPBRANCH_B3:
-#ifdef JU_64BIT
-	case cJU_JPBRANCH_B4:
-	case cJU_JPBRANCH_B5:
-	case cJU_JPBRANCH_B6:
-	case cJU_JPBRANCH_B7:
-#endif
-	case cJU_JPBRANCH_B:
-	{
-	    Word_t subexp;
-	    Word_t jpcount;
-	    Pjbb_t Pjbb = P_JBB(Pjp->jp_Addr);
-
-	    for (subexp = 0; subexp < cJU_NUMSUBEXPB; ++subexp)
-	    {
-	        jpcount = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, subexp));
-                Bytes  += jpcount * sizeof(jp_t);
-
-		for (offset = 0; offset < jpcount; ++offset)
-		{
-		    Bytes += j__udyGetMemActive(P_JP(JU_JBB_PJP(Pjbb, subexp))
-			   + offset);
-		}
-	    }
-
-	    return(Bytes + sizeof(jbb_t));
-	}
-
-	case cJU_JPBRANCH_U2:
-	case cJU_JPBRANCH_U3:
-#ifdef JU_64BIT
-	case cJU_JPBRANCH_U4:
-	case cJU_JPBRANCH_U5:
-	case cJU_JPBRANCH_U6:
-	case cJU_JPBRANCH_U7:
-#endif
-	case cJU_JPBRANCH_U:
-        {
-	    Pjbu_t Pjbu = P_JBU(Pjp->jp_Addr);
-
-            for (offset = 0; offset < cJU_BRANCHUNUMJPS; ++offset)
-	    {
-		if (((Pjbu->jbu_jp[offset].jp_Type) >= cJU_JPNULL1)
-		 && ((Pjbu->jbu_jp[offset].jp_Type) <= cJU_JPNULLMAX))
-		{
-		    continue;		// skip null JP to save time.
-		}
-
-	        Bytes += j__udyGetMemActive(Pjbu->jbu_jp + offset);
-	    }
-
-	    return(Bytes + sizeof(jbu_t));
-        }
-
-
-// -- Cases below here terminate and do not recurse. --
-
-#if (defined(JUDYL) || (! defined(JU_64BIT)))
-        case cJU_JPLEAF1: IdxSz = 1; goto LeafWords;
-#endif
-	case cJU_JPLEAF2: IdxSz = 2; goto LeafWords;
-	case cJU_JPLEAF3: IdxSz = 3; goto LeafWords;
-#ifdef JU_64BIT
-	case cJU_JPLEAF4: IdxSz = 4; goto LeafWords;
-	case cJU_JPLEAF5: IdxSz = 5; goto LeafWords;
-	case cJU_JPLEAF6: IdxSz = 6; goto LeafWords;
-	case cJU_JPLEAF7: IdxSz = 7; goto LeafWords;
-#endif
-LeafWords:
-
-#ifdef JUDY1
-            return(IdxSz * (JU_JPLEAF_POP0(Pjp) + 1));
-#else
-            return((IdxSz + sizeof(Word_t))
-		 * (JU_JPLEAF_POP0(Pjp) + 1));
-#endif
-	case cJU_JPLEAF_B1:
-	{
-#ifdef JUDY1
-            return(sizeof(jlb_t));
-#else
-            Bytes = (JU_JPLEAF_POP0(Pjp) + 1) * sizeof(Word_t);
-
-	    return(Bytes + sizeof(jlb_t));
-#endif
-	}
-
-	JUDY1CODE(case cJ1_JPFULLPOPU1: return(0);)
-
-#ifdef JUDY1
-#define J__Mpy 0
-#else
-#define J__Mpy sizeof(Word_t)
-#endif
-
-	case cJU_JPIMMED_1_01:	return(0);
-	case cJU_JPIMMED_2_01:	return(0);
-	case cJU_JPIMMED_3_01:	return(0);
-#ifdef JU_64BIT
-	case cJU_JPIMMED_4_01:	return(0);
-	case cJU_JPIMMED_5_01:	return(0);
-	case cJU_JPIMMED_6_01:	return(0);
-	case cJU_JPIMMED_7_01:	return(0);
-#endif
-
-	case cJU_JPIMMED_1_02:	return(J__Mpy * 2);
-	case cJU_JPIMMED_1_03:	return(J__Mpy * 3);
-#if (defined(JUDY1) || defined(JU_64BIT))
-	case cJU_JPIMMED_1_04:	return(J__Mpy * 4);
-	case cJU_JPIMMED_1_05:	return(J__Mpy * 5);
-	case cJU_JPIMMED_1_06:	return(J__Mpy * 6);
-	case cJU_JPIMMED_1_07:	return(J__Mpy * 7);
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-	case cJ1_JPIMMED_1_08:	return(0);
-	case cJ1_JPIMMED_1_09:	return(0);
-	case cJ1_JPIMMED_1_10:	return(0);
-	case cJ1_JPIMMED_1_11:	return(0);
-	case cJ1_JPIMMED_1_12:	return(0);
-	case cJ1_JPIMMED_1_13:	return(0);
-	case cJ1_JPIMMED_1_14:	return(0);
-	case cJ1_JPIMMED_1_15:	return(0);
-#endif
-
-#if (defined(JUDY1) || defined(JU_64BIT))
-	case cJU_JPIMMED_2_02:	return(J__Mpy * 2);
-	case cJU_JPIMMED_2_03:	return(J__Mpy * 3);
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-	case cJ1_JPIMMED_2_04:	return(0);
-	case cJ1_JPIMMED_2_05:	return(0);
-	case cJ1_JPIMMED_2_06:	return(0);
-	case cJ1_JPIMMED_2_07:	return(0);
-#endif
-
-#if (defined(JUDY1) || defined(JU_64BIT))
-	case cJU_JPIMMED_3_02:	return(J__Mpy * 2);
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-	case cJ1_JPIMMED_3_03:	return(0);
-	case cJ1_JPIMMED_3_04:	return(0);
-	case cJ1_JPIMMED_3_05:	return(0);
-
-	case cJ1_JPIMMED_4_02:	return(0);
-	case cJ1_JPIMMED_4_03:	return(0);
-	case cJ1_JPIMMED_5_02:	return(0);
-	case cJ1_JPIMMED_5_03:	return(0);
-	case cJ1_JPIMMED_6_02:	return(0);
-	case cJ1_JPIMMED_7_02:	return(0);
-#endif
-
-	} // switch (JU_JPTYPE(Pjp))
-
-	return(0);			// to make some compilers happy.
-
-} // j__udyGetMemActive()
diff --git a/libs/klib/judy/JudyMemUsed.c b/libs/klib/judy/JudyMemUsed.c
deleted file mode 100644
index e25f65b..0000000
--- a/libs/klib/judy/JudyMemUsed.c
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright (C) 2000 - 2002 Hewlett-Packard Company
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the term of the GNU Lesser 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 Lesser General Public License
-// for more details.
-//
-// You should have received a copy of the GNU Lesser 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
-// _________________
-
-// Return number of bytes of memory used to support a Judy1/L array.
-// Compile with one of -DJUDY1 or -DJUDYL.
-
-#if (! (defined(JUDY1) || defined(JUDYL)))
-#error:  One of -DJUDY1 or -DJUDYL must be specified.
-#endif
-
-#ifdef JUDY1
-#include "Judy1.h"
-#else
-#include "JudyL.h"
-#endif
-
-#include "JudyPrivate1L.h"
-
-#ifdef JUDY1
-FUNCTION Word_t Judy1MemUsed
-#else  // JUDYL
-FUNCTION Word_t JudyLMemUsed
-#endif
-        (
-	Pcvoid_t PArray 	// from which to retrieve.
-        )
-{
-	Word_t	 Words = 0;
-
-        if (PArray == (Pcvoid_t) NULL) return(0);
-
-	if (JU_LEAFW_POP0(PArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW
-	{
-	    Pjlw_t Pjlw = P_JLW(PArray);		// first word of leaf.
-	    Words = JU_LEAFWPOPTOWORDS(Pjlw[0] + 1);	// based on pop1.
-	}
-	else
-	{
-	    Pjpm_t Pjpm = P_JPM(PArray);
-	    Words = Pjpm->jpm_TotalMemWords;
-	}
-
-	return(Words * sizeof(Word_t));		// convert to bytes.
-
-} // Judy1MemUsed() / JudyLMemUsed()
diff --git a/libs/klib/judy/JudyNext.c b/libs/klib/judy/JudyNext.c
deleted file mode 100644
index 4af06e2..0000000
--- a/libs/klib/judy/JudyNext.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define JUDYNEXT 1
-#include "JudyPrevNext.c"
diff --git a/libs/klib/judy/JudyNextEmpty.c b/libs/klib/judy/JudyNextEmpty.c
deleted file mode 100644
index 73b0926..0000000
--- a/libs/klib/judy/JudyNextEmpty.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define JUDYNEXT 1
-#include "JudyPrevNextEmpty.c"
diff --git a/libs/klib/judy/JudyPrev.c b/libs/klib/judy/JudyPrev.c
deleted file mode 100644
index 3d9f484..0000000
--- a/libs/klib/judy/JudyPrev.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define JUDYPREV 1
-#include "JudyPrevNext.c"
diff --git a/libs/klib/judy/JudyPrevEmpty.c b/libs/klib/judy/JudyPrevEmpty.c
deleted file mode 100644
index f9a182b..0000000
--- a/libs/klib/judy/JudyPrevEmpty.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define JUDYPREV 1
-#include "JudyPrevNextEmpty.c"
diff --git a/libs/klib/judy/JudyPrevNext.c b/libs/klib/judy/JudyPrevNext.c
deleted file mode 100644
index 1131eef..0000000
--- a/libs/klib/judy/JudyPrevNext.c
+++ /dev/null
@@ -1,1888 +0,0 @@
-// Copyright (C) 2000 - 2002 Hewlett-Packard Company
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the term of the GNU Lesser 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 Lesser General Public License
-// for more details.
-//
-// You should have received a copy of the GNU Lesser 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
-// _________________
-
-// Judy*Prev() and Judy*Next() functions for Judy1 and JudyL.
-// Compile with one of -DJUDY1 or -DJUDYL.
-//
-// Compile with -DJUDYNEXT for the Judy*Next() function; otherwise defaults to
-// Judy*Prev().
-
-#if (! (defined(JUDY1) || defined(JUDYL)))
-#error:  One of -DJUDY1 or -DJUDYL must be specified.
-#endif
-
-#ifndef JUDYNEXT
-#ifndef JUDYPREV
-#define	JUDYPREV 1		// neither set => use default.
-#endif
-#endif
-
-#ifdef JUDY1
-#include "Judy1.h"
-#else
-#include "JudyL.h"
-#endif
-
-#include "JudyPrivate1L.h"
-
-
-// ****************************************************************************
-// J U D Y   1   P R E V
-// J U D Y   1   N E X T
-// J U D Y   L   P R E V
-// J U D Y   L   N E X T
-//
-// See the manual entry for the API.
-//
-// OVERVIEW OF Judy*Prev():
-//
-// Use a reentrant switch statement (state machine, SM1 = "get") to decode the
-// callers *PIndex-1, starting with the (PArray), through branches, if
-// any, down to an immediate or a leaf.  Look for *PIndex-1 in that leaf, and
-// if found, return it.
-//
-// A dead end is either a branch that does not contain a JP for the appropriate
-// digit in *PIndex-1, or a leaf that does not contain the undecoded digits of
-// *PIndex-1.  Upon reaching a dead end, backtrack through the leaf/branches
-// that were just traversed, using a list (history) of parent JPs that is built
-// while going forward in SM1Get.  Start with the current leaf or branch.  In a
-// backtracked leaf, look for an Index less than *PIndex-1.  In each
-// backtracked branch, look "sideways" for the next JP, if any, lower than the
-// one for the digit (from *PIndex-1) that was previously decoded.  While
-// backtracking, if a leaf has no previous Index or a branch has no lower JP,
-// go to its parent branch in turn.  Upon reaching the JRP, return failure, "no
-// previous Index".  The backtrack process is sufficiently different from
-// SM1Get to merit its own separate reentrant switch statement (SM2 =
-// "backtrack").
-//
-// While backtracking, upon finding a lower JP in a branch, there is certain to
-// be a "prev" Index under that JP (unless the Judy array is corrupt).
-// Traverse forward again, this time taking the last (highest, right-most) JP
-// in each branch, and the last (highest) Index upon reaching an immediate or a
-// leaf.  This traversal is sufficiently different from SM1Get and SM2Backtrack
-// to merit its own separate reentrant switch statement (SM3 = "findlimit").
-//
-// "Decode" bytes in JPs complicate this process a little.  In SM1Get, when a
-// JP is a narrow pointer, that is, when states are skipped (so the skipped
-// digits are stored in jp_DcdPopO), compare the relevant digits to the same
-// digits in *PIndex-1.  If they are EQUAL, proceed in SM1Get as before.  If
-// jp_DcdPopOs digits are GREATER, treat the JP as a dead end and proceed in
-// SM2Backtrack.  If jp_DcdPopOs digits are LESS, treat the JP as if it had
-// just been found during a backtrack and proceed directly in SM3Findlimit.
-//
-// Note that Decode bytes can be ignored in SM3Findlimit; they dont matter.
-// Also note that in practice the Decode bytes are routinely compared with
-// *PIndex-1 because thats simpler and no slower than first testing for
-// narrowness.
-//
-// Decode bytes also make it unnecessary to construct the Index to return (the
-// revised *PIndex) during the search.  This step is deferred until finding an
-// Index during backtrack or findlimit, before returning it.  The first digit
-// of *PIndex is derived (saved) based on which JP is used in a JRP branch.
-// The remaining digits are obtained from the jp_DcdPopO field in the JP (if
-// any) above the immediate or leaf containing the found (prev) Index, plus the
-// remaining digit(s) in the immediate or leaf itself.  In the case of a LEAFW,
-// the Index to return is found directly in the leaf.
-//
-// Note:  Theoretically, as described above, upon reaching a dead end, SM1Get
-// passes control to SM2Backtrack to look sideways, even in a leaf.  Actually
-// its a little more efficient for the SM1Get leaf cases to shortcut this and
-// take care of the sideways searches themselves.  Hence the history list only
-// contains branch JPs, and SM2Backtrack only handles branches.  In fact, even
-// the branch handling cases in SM1Get do some shortcutting (sideways
-// searching) to avoid pushing history and calling SM2Backtrack unnecessarily.
-//
-// Upon reaching an Index to return after backtracking, *PIndex must be
-// modified to the found Index.  In principle this could be done by building
-// the Index from a saved rootdigit (in the top branch) plus the Dcd bytes from
-// the parent JP plus the appropriate Index bytes from the leaf.  However,
-// Immediates are difficult because their parent JPs lack one (last) digit.  So
-// instead just build the *PIndex to return "top down" while backtracking and
-// findlimiting.
-//
-// This function is written iteratively for speed, rather than recursively.
-//
-// CAVEATS:
-//
-// Why use a backtrack list (history stack), since it has finite size?  The
-// size is small for Judy on both 32-bit and 64-bit systems, and a list (really
-// just an array) is fast to maintain and use.  Other alternatives include
-// doing a lookahead (lookaside) in each branch while traversing forward
-// (decoding), and restarting from the top upon a dead end.
-//
-// A lookahead means noting the last branch traversed which contained a
-// non-null JP lower than the one specified by a digit in *PIndex-1, and
-// returning to that point for SM3Findlimit.  This seems like a good idea, and
-// should be pretty cheap for linear and bitmap branches, but it could result
-// in up to 31 unnecessary additional cache line fills (in extreme cases) for
-// every uncompressed branch traversed.  We have considered means of attaching
-// to or hiding within an uncompressed branch (in null JPs) a "cache line map"
-// or other structure, such as an offset to the next non-null JP, that would
-// speed this up, but it seems unnecessary merely to avoid having a
-// finite-length list (array).  (If JudySL is ever made "native", the finite
-// list length will be an issue.)
-//
-// Restarting at the top of the Judy array after a dead end requires a careful
-// modification of *PIndex-1 to decrement the digit for the parent branch and
-// set the remaining lower digits to all 1s.  This must be repeated each time a
-// parent branch contains another dead end, so even though it should all happen
-// in cache, the CPU time can be excessive.  (For JudySL or an equivalent
-// "infinitely deep" Judy array, consider a hybrid of a large, finite,
-// "circular" list and a restart-at-top when the list is backtracked to
-// exhaustion.)
-//
-// Why search for *PIndex-1 instead of *PIndex during SM1Get?  In rare
-// instances this prevents an unnecessary decode down the wrong path followed
-// by a backtrack; its pretty cheap to set up initially; and it means the
-// SM1Get machine can simply return if/when it finds that Index.
-//
-// TBD:  Wed like to enhance this function to make successive searches faster.
-// This would require saving some previous state, including the previous Index
-// returned, and in which leaf it was found.  If the next call is for the same
-// Index and the array has not been modified, start at the same leaf.  This
-// should be much easier to implement since this is iterative rather than
-// recursive code.
-//
-// VARIATIONS FOR Judy*Next():
-//
-// The Judy*Next() code is nearly a perfect mirror of the Judy*Prev() code.
-// See the Judy*Prev() overview comments, and mentally switch the following:
-//
-// - "*PIndex-1"  => "*PIndex+1"
-// - "less than"  => "greater than"
-// - "lower"      => "higher"
-// - "lowest"     => "highest"
-// - "next-left"  => "next-right"
-// - "right-most" => "left-most"
-//
-// Note:  SM3Findlimit could be called SM3Findmax/SM3Findmin, but a common name
-// for both Prev and Next means many fewer ifdefs in this code.
-//
-// TBD:  Currently this code traverses a JP whether its expanse is partially or
-// completely full (populated).  For Judy1 (only), since there is no value area
-// needed, consider shortcutting to a "success" return upon encountering a full
-// JP in SM1Get (or even SM3Findlimit?)  A full JP looks like this:
-//
-//	(((JU_JPDCDPOP0(Pjp) ^ cJU_ALLONES) & cJU_POP0MASK(cLevel)) == 0)
-
-#ifdef JUDY1
-#ifdef JUDYPREV
-FUNCTION int Judy1Prev
-#else
-FUNCTION int Judy1Next
-#endif
-#else
-#ifdef JUDYPREV
-FUNCTION PPvoid_t JudyLPrev
-#else
-FUNCTION PPvoid_t JudyLNext
-#endif
-#endif
-        (
-	Pcvoid_t  PArray,	// Judy array to search.
-	Word_t *  PIndex,	// starting point and result.
-	PJError_t PJError	// optional, for returning error info.
-        )
-{
-	Pjp_t	  Pjp, Pjp2;	// current JPs.
-	Pjbl_t	  Pjbl;		// Pjp->jp_Addr masked and cast to types:
-	Pjbb_t	  Pjbb;
-	Pjbu_t	  Pjbu;
-
-// Note:  The following initialization is not strictly required but it makes
-// gcc -Wall happy because there is an "impossible" path from Immed handling to
-// SM1LeafLImm code that looks like Pjll might be used before set:
-
-	Pjll_t	  Pjll = (Pjll_t) NULL;
-	Word_t	  state;	// current state in SM.
-	Word_t	  digit;	// next digit to decode from Index.
-
-// Note:  The following initialization is not strictly required but it makes
-// gcc -Wall happy because there is an "impossible" path from Immed handling to
-// SM1LeafLImm code (for JudyL & JudyPrev only) that looks like pop1 might be
-// used before set:
-
-#if (defined(JUDYL) && defined(JUDYPREV))
-	Word_t	  pop1 = 0;	// in a leaf.
-#else
-	Word_t	  pop1;		// in a leaf.
-#endif
-	int	  offset;	// linear branch/leaf, from j__udySearchLeaf*().
-	int	  subexp;	// subexpanse in a bitmap branch.
-	Word_t	  bitposmask;	// bit in bitmap for Index.
-
-// History for SM2Backtrack:
-//
-// For a given histnum, APjphist[histnum] is a parent JP that points to a
-// branch, and Aoffhist[histnum] is the offset of the NEXT JP in the branch to
-// which the parent JP points.  The meaning of Aoffhist[histnum] depends on the
-// type of branch to which the parent JP points:
-//
-// Linear:  Offset of the next JP in the JP list.
-//
-// Bitmap:  Which subexpanse, plus the offset of the next JP in the
-// subexpanses JP list (to avoid bit-counting again), plus for Judy*Next(),
-// hidden one byte to the left, which digit, because Judy*Next() also needs
-// this.
-//
-// Uncompressed:  Digit, which is actually the offset of the JP in the branch.
-//
-// Note:  Only branch JPs are stored in APjphist[] because, as explained
-// earlier, SM1Get shortcuts sideways searches in leaves (and even in branches
-// in some cases), so SM2Backtrack only handles branches.
-
-#define	HISTNUMMAX cJU_ROOTSTATE	// maximum branches traversable.
-	Pjp_t	APjphist[HISTNUMMAX];	// list of branch JPs traversed.
-	int	Aoffhist[HISTNUMMAX];	// list of next JP offsets; see above.
-	int	histnum = 0;		// number of JPs now in list.
-
-
-// ----------------------------------------------------------------------------
-// M A C R O S
-//
-// These are intended to make the code a bit more readable and less redundant.
-
-
-// "PUSH" AND "POP" Pjp AND offset ON HISTORY STACKS:
-//
-// Note:  Ensure a corrupt Judy array does not overflow *hist[].  Meanwhile,
-// underflowing *hist[] simply means theres no more room to backtrack =>
-// "no previous/next Index".
-
-#define	HISTPUSH(Pjp,Offset)			\
-	APjphist[histnum] = (Pjp);		\
-	Aoffhist[histnum] = (Offset);		\
-						\
-	if (++histnum >= HISTNUMMAX)		\
-	{					\
-	    JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT) \
-	    JUDY1CODE(return(JERRI );)		\
-	    JUDYLCODE(return(PPJERR);)		\
-	}
-
-#define	HISTPOP(Pjp,Offset)			\
-	if ((histnum--) < 1) JU_RET_NOTFOUND;	\
-	(Pjp)	 = APjphist[histnum];		\
-	(Offset) = Aoffhist[histnum]
-
-// How to pack/unpack Aoffhist[] values for bitmap branches:
-
-#ifdef JUDYPREV
-
-#define	HISTPUSHBOFF(Subexp,Offset,Digit)	  \
-	(((Subexp) * cJU_BITSPERSUBEXPB) | (Offset))
-
-#define	HISTPOPBOFF(Subexp,Offset,Digit)	  \
-	(Subexp)  = (Offset) / cJU_BITSPERSUBEXPB; \
-	(Offset) %= cJU_BITSPERSUBEXPB
-#else
-
-#define	HISTPUSHBOFF(Subexp,Offset,Digit)	 \
-	 (((Digit) << cJU_BITSPERBYTE)		 \
-	| ((Subexp) * cJU_BITSPERSUBEXPB) | (Offset))
-
-#define	HISTPOPBOFF(Subexp,Offset,Digit)	 \
-	(Digit)   = (Offset) >> cJU_BITSPERBYTE; \
-	(Subexp)  = ((Offset) & JU_LEASTBYTESMASK(1)) / cJU_BITSPERSUBEXPB; \
-	(Offset) %= cJU_BITSPERSUBEXPB
-#endif
-
-
-// CHECK FOR NULL JP:
-
-#define	JPNULL(Type)  (((Type) >= cJU_JPNULL1) && ((Type) <= cJU_JPNULLMAX))
-
-
-// SEARCH A BITMAP:
-//
-// This is a weak analog of j__udySearchLeaf*() for bitmaps.  Return the actual
-// or next-left position, base 0, of Digit in the single uint32_t bitmap, also
-// given a Bitposmask for Digit.
-//
-// Unlike j__udySearchLeaf*(), the offset is not returned bit-complemented if
-// Digits bit is unset, because the caller can check the bitmap themselves to
-// determine that.  Also, if Digits bit is unset, the returned offset is to
-// the next-left JP (including -1), not to the "ideal" position for the Index =
-// next-right JP.
-//
-// Shortcut and skip calling j__udyCountBits*() if the bitmap is full, in which
-// case (Digit % cJU_BITSPERSUBEXP*) itself is the base-0 offset.
-//
-// TBD for Judy*Next():  Should this return next-right instead of next-left?
-// That is, +1 from current value?  Maybe not, if Digits bit IS set, +1 would
-// be wrong.
-
-#define	SEARCHBITMAPB(Bitmap,Digit,Bitposmask)				\
-	(((Bitmap) == cJU_FULLBITMAPB) ? (Digit % cJU_BITSPERSUBEXPB) :	\
-	 j__udyCountBitsB((Bitmap) & JU_MASKLOWERINC(Bitposmask)) - 1)
-
-#define	SEARCHBITMAPL(Bitmap,Digit,Bitposmask)				\
-	(((Bitmap) == cJU_FULLBITMAPL) ? (Digit % cJU_BITSPERSUBEXPL) :	\
-	 j__udyCountBitsL((Bitmap) & JU_MASKLOWERINC(Bitposmask)) - 1)
-
-#ifdef JUDYPREV
-// Equivalent to search for the highest offset in Bitmap:
-
-#define	SEARCHBITMAPMAXB(Bitmap)				  \
-	(((Bitmap) == cJU_FULLBITMAPB) ? cJU_BITSPERSUBEXPB - 1 : \
-	 j__udyCountBitsB(Bitmap) - 1)
-
-#define	SEARCHBITMAPMAXL(Bitmap)				  \
-	(((Bitmap) == cJU_FULLBITMAPL) ? cJU_BITSPERSUBEXPL - 1 : \
-	 j__udyCountBitsL(Bitmap) - 1)
-#endif
-
-
-// CHECK DECODE BYTES:
-//
-// Check Decode bytes in a JP against the equivalent portion of *PIndex.  If
-// *PIndex is lower (for Judy*Prev()) or higher (for Judy*Next()), this JP is a
-// dead end (the same as if it had been absent in a linear or bitmap branch or
-// null in an uncompressed branch), enter SM2Backtrack; otherwise enter
-// SM3Findlimit to find the highest/lowest Index under this JP, as if the code
-// had already backtracked to this JP.
-
-#ifdef JUDYPREV
-#define	CDcmp__ <
-#else
-#define	CDcmp__ >
-#endif
-
-#define	CHECKDCD(cState)						\
-	if (JU_DCDNOTMATCHINDEX(*PIndex, Pjp, cState))	                \
-	{								\
-	    if ((*PIndex		& cJU_DCDMASK(cState))		\
-	      CDcmp__(JU_JPDCDPOP0(Pjp) & cJU_DCDMASK(cState)))		\
-	    {								\
-		goto SM2Backtrack;					\
-	    }								\
-	    goto SM3Findlimit;						\
-	}
-
-
-// PREPARE TO HANDLE A LEAFW OR JRP BRANCH IN SM1:
-//
-// Extract a state-dependent digit from Index in a "constant" way, then jump to
-// common code for multiple cases.
-
-#define	SM1PREPB(cState,Next)				\
-	state = (cState);				\
-	digit = JU_DIGITATSTATE(*PIndex, cState);	\
-	goto Next
-
-
-// PREPARE TO HANDLE A LEAFW OR JRP BRANCH IN SM3:
-//
-// Optionally save Dcd bytes into *PIndex, then save state and jump to common
-// code for multiple cases.
-
-#define	SM3PREPB_DCD(cState,Next)			\
-	JU_SETDCD(*PIndex, Pjp, cState);	        \
-	SM3PREPB(cState,Next)
-
-#define	SM3PREPB(cState,Next)  state = (cState); goto Next
-
-
-// ----------------------------------------------------------------------------
-// CHECK FOR SHORTCUTS:
-//
-// Error out if PIndex is null.  Execute JU_RET_NOTFOUND if the Judy array is
-// empty or *PIndex is already the minimum/maximum Index possible.
-//
-// Note:  As documented, in case of failure *PIndex may be modified.
-
-	if (PIndex == (PWord_t) NULL)
-	{
-	    JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX);
-	    JUDY1CODE(return(JERRI );)
-	    JUDYLCODE(return(PPJERR);)
-	}
-
-#ifdef JUDYPREV
-	if ((PArray == (Pvoid_t) NULL) || ((*PIndex)-- == 0))
-#else
-	if ((PArray == (Pvoid_t) NULL) || ((*PIndex)++ == cJU_ALLONES))
-#endif
-	    JU_RET_NOTFOUND;
-
-
-// HANDLE JRP:
-//
-// Before even entering SM1Get, check the JRP type.  For JRP branches, traverse
-// the JPM; handle LEAFW leaves directly; but look for the most common cases
-// first.
-
-// ROOT-STATE LEAF that starts with a Pop0 word; just look within the leaf:
-//
-// If *PIndex is in the leaf, return it; otherwise return the Index, if any,
-// below where it would belong.
-
-	if (JU_LEAFW_POP0(PArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW
-	{
-	    Pjlw_t Pjlw = P_JLW(PArray);	// first word of leaf.
-	    pop1 = Pjlw[0] + 1;
-
-	    if ((offset = j__udySearchLeafW(Pjlw + 1, pop1, *PIndex))
-		>= 0)				// Index is present.
-	    {
-		assert(offset < pop1);			  // in expected range.
-		JU_RET_FOUND_LEAFW(Pjlw, pop1, offset); // *PIndex is set.
-	    }
-
-#ifdef JUDYPREV
-	    if ((offset = ~offset) == 0)	// no next-left Index.
-#else
-	    if ((offset = ~offset) >= pop1)	// no next-right Index.
-#endif
-		JU_RET_NOTFOUND;
-
-	    assert(offset <= pop1);		// valid result.
-
-#ifdef JUDYPREV
-	    *PIndex = Pjlw[offset--];		// next-left Index, base 1.
-#else
-	    *PIndex = Pjlw[offset + 1];		// next-right Index, base 1.
-#endif
-	    JU_RET_FOUND_LEAFW(Pjlw, pop1, offset);	// base 0.
-
-	}
-	else	// JRP BRANCH
-	{
-	    Pjpm_t Pjpm = P_JPM(PArray);
-	    Pjp = &(Pjpm->jpm_JP);
-
-//	    goto SM1Get;
-	}
-
-// ============================================================================
-// STATE MACHINE 1 -- GET INDEX:
-//
-// Search for *PIndex (already decremented/incremented so as to be inclusive).
-// If found, return it.  Otherwise in theory hand off to SM2Backtrack or
-// SM3Findlimit, but in practice "shortcut" by first sideways searching the
-// current branch or leaf upon hitting a dead end.  During sideways search,
-// modify *PIndex to a new path taken.
-//
-// ENTRY:  Pjp points to next JP to interpret, whose Decode bytes have not yet
-// been checked.  This JP is not yet listed in history.
-//
-// Note:  Check Decode bytes at the start of each loop, not after looking up a
-// new JP, so its easy to do constant shifts/masks, although this requires
-// cautious handling of Pjp, offset, and *hist[] for correct entry to
-// SM2Backtrack.
-//
-// EXIT:  Return, or branch to SM2Backtrack or SM3Findlimit with correct
-// interface, as described elsewhere.
-//
-// WARNING:  For run-time efficiency the following cases replicate code with
-// varying constants, rather than using common code with variable values!
-
-SM1Get:				// return here for next branch/leaf.
-
-	switch (JU_JPTYPE(Pjp))
-	{
-
-
-// ----------------------------------------------------------------------------
-// LINEAR BRANCH:
-//
-// Check Decode bytes, if any, in the current JP, then search for a JP for the
-// next digit in *PIndex.
-
-	case cJU_JPBRANCH_L2: CHECKDCD(2); SM1PREPB(2, SM1BranchL);
-	case cJU_JPBRANCH_L3: CHECKDCD(3); SM1PREPB(3, SM1BranchL);
-#ifdef JU_64BIT
-	case cJU_JPBRANCH_L4: CHECKDCD(4); SM1PREPB(4, SM1BranchL);
-	case cJU_JPBRANCH_L5: CHECKDCD(5); SM1PREPB(5, SM1BranchL);
-	case cJU_JPBRANCH_L6: CHECKDCD(6); SM1PREPB(6, SM1BranchL);
-	case cJU_JPBRANCH_L7: CHECKDCD(7); SM1PREPB(7, SM1BranchL);
-#endif
-	case cJU_JPBRANCH_L:		   SM1PREPB(cJU_ROOTSTATE, SM1BranchL);
-
-// Common code (state-independent) for all cases of linear branches:
-
-SM1BranchL:
-	    Pjbl = P_JBL(Pjp->jp_Addr);
-
-// Found JP matching current digit in *PIndex; record parent JP and the next
-// JPs offset, and iterate to the next JP:
-
-	    if ((offset = j__udySearchLeaf1((Pjll_t) (Pjbl->jbl_Expanse),
-					     Pjbl->jbl_NumJPs, digit)) >= 0)
-	    {
-		HISTPUSH(Pjp, offset);
-		Pjp = (Pjbl->jbl_jp) + offset;
-		goto SM1Get;
-	    }
-
-// Dead end, no JP in BranchL for next digit in *PIndex:
-//
-// Get the ideal location of digits JP, and if theres no next-left/right JP
-// in the BranchL, shortcut and start backtracking one level up; ignore the
-// current Pjp because it points to a BranchL with no next-left/right JP.
-
-#ifdef JUDYPREV
-	    if ((offset = (~offset) - 1) < 0)	// no next-left JP in BranchL.
-#else
-	    if ((offset = (~offset)) >= Pjbl->jbl_NumJPs)  // no next-right.
-#endif
-		goto SM2Backtrack;
-
-// Theres a next-left/right JP in the current BranchL; save its digit in
-// *PIndex and shortcut to SM3Findlimit:
-
-	    JU_SETDIGIT(*PIndex, Pjbl->jbl_Expanse[offset], state);
-	    Pjp = (Pjbl->jbl_jp) + offset;
-	    goto SM3Findlimit;
-
-
-// ----------------------------------------------------------------------------
-// BITMAP BRANCH:
-//
-// Check Decode bytes, if any, in the current JP, then look for a JP for the
-// next digit in *PIndex.
-
-	case cJU_JPBRANCH_B2: CHECKDCD(2); SM1PREPB(2, SM1BranchB);
-	case cJU_JPBRANCH_B3: CHECKDCD(3); SM1PREPB(3, SM1BranchB);
-#ifdef JU_64BIT
-	case cJU_JPBRANCH_B4: CHECKDCD(4); SM1PREPB(4, SM1BranchB);
-	case cJU_JPBRANCH_B5: CHECKDCD(5); SM1PREPB(5, SM1BranchB);
-	case cJU_JPBRANCH_B6: CHECKDCD(6); SM1PREPB(6, SM1BranchB);
-	case cJU_JPBRANCH_B7: CHECKDCD(7); SM1PREPB(7, SM1BranchB);
-#endif
-	case cJU_JPBRANCH_B:		   SM1PREPB(cJU_ROOTSTATE, SM1BranchB);
-
-// Common code (state-independent) for all cases of bitmap branches:
-
-SM1BranchB:
-	    Pjbb = P_JBB(Pjp->jp_Addr);
-
-// Locate the digits JP in the subexpanse list, if present, otherwise the
-// offset of the next-left JP, if any:
-
-	    subexp     = digit / cJU_BITSPERSUBEXPB;
-	    assert(subexp < cJU_NUMSUBEXPB);	// falls in expected range.
-	    bitposmask = JU_BITPOSMASKB(digit);
-	    offset     = SEARCHBITMAPB(JU_JBB_BITMAP(Pjbb, subexp), digit,
-				       bitposmask);
-	    // right range:
-	    assert((offset >= -1) && (offset < (int) cJU_BITSPERSUBEXPB));
-
-// Found JP matching current digit in *PIndex:
-//
-// Record the parent JP and the next JPs offset; and iterate to the next JP.
-
-//	    if (JU_BITMAPTESTB(Pjbb, digit))			// slower.
-	    if (JU_JBB_BITMAP(Pjbb, subexp) & bitposmask)	// faster.
-	    {
-		// not negative since at least one bit is set:
-		assert(offset >= 0);
-
-		HISTPUSH(Pjp, HISTPUSHBOFF(subexp, offset, digit));
-
-		if ((Pjp = P_JP(JU_JBB_PJP(Pjbb, subexp))) == (Pjp_t) NULL)
-		{
-		    JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
-		    JUDY1CODE(return(JERRI );)
-		    JUDYLCODE(return(PPJERR);)
-		}
-
-		Pjp += offset;
-		goto SM1Get;		// iterate to next JP.
-	    }
-
-// Dead end, no JP in BranchB for next digit in *PIndex:
-//
-// If theres a next-left/right JP in the current BranchB, shortcut to
-// SM3Findlimit.  Note:  offset is already set to the correct value for the
-// next-left/right JP.
-
-#ifdef JUDYPREV
-	    if (offset >= 0)		// next-left JP is in this subexpanse.
-		goto SM1BranchBFindlimit;
-
-	    while (--subexp >= 0)		// search next-left subexpanses.
-#else
-	    if (JU_JBB_BITMAP(Pjbb, subexp) & JU_MASKHIGHEREXC(bitposmask))
-	    {
-		++offset;			// next-left => next-right.
-		goto SM1BranchBFindlimit;
-	    }
-
-	    while (++subexp < cJU_NUMSUBEXPB)	// search next-right subexps.
-#endif
-	    {
-		if (! JU_JBB_PJP(Pjbb, subexp)) continue;  // empty subexpanse.
-
-#ifdef JUDYPREV
-		offset = SEARCHBITMAPMAXB(JU_JBB_BITMAP(Pjbb, subexp));
-		// expected range:
-		assert((offset >= 0) && (offset < cJU_BITSPERSUBEXPB));
-#else
-		offset = 0;
-#endif
-
-// Save the next-left/right JPs digit in *PIndex:
-
-SM1BranchBFindlimit:
-		JU_BITMAPDIGITB(digit, subexp, JU_JBB_BITMAP(Pjbb, subexp),
-				offset);
-		JU_SETDIGIT(*PIndex, digit, state);
-
-		if ((Pjp = P_JP(JU_JBB_PJP(Pjbb, subexp))) == (Pjp_t) NULL)
-		{
-		    JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
-		    JUDY1CODE(return(JERRI );)
-		    JUDYLCODE(return(PPJERR);)
-		}
-
-		Pjp += offset;
-		goto SM3Findlimit;
-	    }
-
-// Theres no next-left/right JP in the BranchB:
-//
-// Shortcut and start backtracking one level up; ignore the current Pjp because
-// it points to a BranchB with no next-left/right JP.
-
-	    goto SM2Backtrack;
-
-
-// ----------------------------------------------------------------------------
-// UNCOMPRESSED BRANCH:
-//
-// Check Decode bytes, if any, in the current JP, then look for a JP for the
-// next digit in *PIndex.
-
-	case cJU_JPBRANCH_U2: CHECKDCD(2); SM1PREPB(2, SM1BranchU);
-	case cJU_JPBRANCH_U3: CHECKDCD(3); SM1PREPB(3, SM1BranchU);
-#ifdef JU_64BIT
-	case cJU_JPBRANCH_U4: CHECKDCD(4); SM1PREPB(4, SM1BranchU);
-	case cJU_JPBRANCH_U5: CHECKDCD(5); SM1PREPB(5, SM1BranchU);
-	case cJU_JPBRANCH_U6: CHECKDCD(6); SM1PREPB(6, SM1BranchU);
-	case cJU_JPBRANCH_U7: CHECKDCD(7); SM1PREPB(7, SM1BranchU);
-#endif
-	case cJU_JPBRANCH_U:		   SM1PREPB(cJU_ROOTSTATE, SM1BranchU);
-
-// Common code (state-independent) for all cases of uncompressed branches:
-
-SM1BranchU:
-	    Pjbu = P_JBU(Pjp->jp_Addr);
-	    Pjp2 = (Pjbu->jbu_jp) + digit;
-
-// Found JP matching current digit in *PIndex:
-//
-// Record the parent JP and the next JPs digit, and iterate to the next JP.
-//
-// TBD:  Instead of this, just goto SM1Get, and add cJU_JPNULL* cases to the
-// SM1Get state machine?  Then backtrack?  However, it means you cant detect
-// an inappropriate cJU_JPNULL*, when it occurs in other than a BranchU, and
-// return JU_RET_CORRUPT.
-
-	    if (! JPNULL(JU_JPTYPE(Pjp2)))	// digit has a JP.
-	    {
-		HISTPUSH(Pjp, digit);
-		Pjp = Pjp2;
-		goto SM1Get;
-	    }
-
-// Dead end, no JP in BranchU for next digit in *PIndex:
-//
-// Search for a next-left/right JP in the current BranchU, and if one is found,
-// save its digit in *PIndex and shortcut to SM3Findlimit:
-
-#ifdef JUDYPREV
-	    while (digit >= 1)
-	    {
-		Pjp = (Pjbu->jbu_jp) + (--digit);
-#else
-	    while (digit < cJU_BRANCHUNUMJPS - 1)
-	    {
-		Pjp = (Pjbu->jbu_jp) + (++digit);
-#endif
-		if (JPNULL(JU_JPTYPE(Pjp))) continue;
-
-		JU_SETDIGIT(*PIndex, digit, state);
-		goto SM3Findlimit;
-	    }
-
-// Theres no next-left/right JP in the BranchU:
-//
-// Shortcut and start backtracking one level up; ignore the current Pjp because
-// it points to a BranchU with no next-left/right JP.
-
-	    goto SM2Backtrack;
-
-
-// ----------------------------------------------------------------------------
-// LINEAR LEAF:
-//
-// Check Decode bytes, if any, in the current JP, then search the leaf for
-// *PIndex.
-
-#define	SM1LEAFL(Func)					\
-	Pjll   = P_JLL(Pjp->jp_Addr);			\
-	pop1   = JU_JPLEAF_POP0(Pjp) + 1;	        \
-	offset = Func(Pjll, pop1, *PIndex);		\
-	goto SM1LeafLImm
-
-#if (defined(JUDYL) || (! defined(JU_64BIT)))
-	case cJU_JPLEAF1:  CHECKDCD(1); SM1LEAFL(j__udySearchLeaf1);
-#endif
-	case cJU_JPLEAF2:  CHECKDCD(2); SM1LEAFL(j__udySearchLeaf2);
-	case cJU_JPLEAF3:  CHECKDCD(3); SM1LEAFL(j__udySearchLeaf3);
-
-#ifdef JU_64BIT
-	case cJU_JPLEAF4:  CHECKDCD(4); SM1LEAFL(j__udySearchLeaf4);
-	case cJU_JPLEAF5:  CHECKDCD(5); SM1LEAFL(j__udySearchLeaf5);
-	case cJU_JPLEAF6:  CHECKDCD(6); SM1LEAFL(j__udySearchLeaf6);
-	case cJU_JPLEAF7:  CHECKDCD(7); SM1LEAFL(j__udySearchLeaf7);
-#endif
-
-// Common code (state-independent) for all cases of linear leaves and
-// immediates:
-
-SM1LeafLImm:
-	    if (offset >= 0)		// *PIndex is in LeafL / Immed.
-#ifdef JUDY1
-		JU_RET_FOUND;
-#else
-	    {				// JudyL is trickier...
-		switch (JU_JPTYPE(Pjp))
-		{
-#if (defined(JUDYL) || (! defined(JU_64BIT)))
-		case cJU_JPLEAF1: JU_RET_FOUND_LEAF1(Pjll, pop1, offset);
-#endif
-		case cJU_JPLEAF2: JU_RET_FOUND_LEAF2(Pjll, pop1, offset);
-		case cJU_JPLEAF3: JU_RET_FOUND_LEAF3(Pjll, pop1, offset);
-#ifdef JU_64BIT
-		case cJU_JPLEAF4: JU_RET_FOUND_LEAF4(Pjll, pop1, offset);
-		case cJU_JPLEAF5: JU_RET_FOUND_LEAF5(Pjll, pop1, offset);
-		case cJU_JPLEAF6: JU_RET_FOUND_LEAF6(Pjll, pop1, offset);
-		case cJU_JPLEAF7: JU_RET_FOUND_LEAF7(Pjll, pop1, offset);
-#endif
-
-		case cJU_JPIMMED_1_01:
-		case cJU_JPIMMED_2_01:
-		case cJU_JPIMMED_3_01:
-#ifdef JU_64BIT
-		case cJU_JPIMMED_4_01:
-		case cJU_JPIMMED_5_01:
-		case cJU_JPIMMED_6_01:
-		case cJU_JPIMMED_7_01:
-#endif
-		    JU_RET_FOUND_IMM_01(Pjp);
-
-		case cJU_JPIMMED_1_02:
-		case cJU_JPIMMED_1_03:
-#ifdef JU_64BIT
-		case cJU_JPIMMED_1_04:
-		case cJU_JPIMMED_1_05:
-		case cJU_JPIMMED_1_06:
-		case cJU_JPIMMED_1_07:
-		case cJU_JPIMMED_2_02:
-		case cJU_JPIMMED_2_03:
-		case cJU_JPIMMED_3_02:
-#endif
-		    JU_RET_FOUND_IMM(Pjp, offset);
-		}
-
-		JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);  // impossible?
-		JUDY1CODE(return(JERRI );)
-		JUDYLCODE(return(PPJERR);)
-
-	    } // found *PIndex
-
-#endif // JUDYL
-
-// Dead end, no Index in LeafL / Immed for remaining digit(s) in *PIndex:
-//
-// Get the ideal location of Index, and if theres no next-left/right Index in
-// the LeafL / Immed, shortcut and start backtracking one level up; ignore the
-// current Pjp because it points to a LeafL / Immed with no next-left/right
-// Index.
-
-#ifdef JUDYPREV
-	    if ((offset = (~offset) - 1) < 0)	// no next-left Index.
-#else
-	    if ((offset = (~offset)) >= pop1)	// no next-right Index.
-#endif
-		goto SM2Backtrack;
-
-// Theres a next-left/right Index in the current LeafL / Immed; shortcut by
-// copying its digit(s) to *PIndex and returning it.
-//
-// Unfortunately this is pretty hairy, especially avoiding endian issues.
-//
-// The cJU_JPLEAF* cases are very similar to same-index-size cJU_JPIMMED* cases
-// for *_02 and above, but must return differently, at least for JudyL, so
-// spell them out separately here at the cost of a little redundant code for
-// Judy1.
-
-	    switch (JU_JPTYPE(Pjp))
-	    {
-#if (defined(JUDYL) || (! defined(JU_64BIT)))
-	    case cJU_JPLEAF1:
-
-		JU_SETDIGIT1(*PIndex, ((uint8_t *) Pjll)[offset]);
-		JU_RET_FOUND_LEAF1(Pjll, pop1, offset);
-#endif
-
-	    case cJU_JPLEAF2:
-
-		*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(2)))
-			| ((uint16_t *) Pjll)[offset];
-		JU_RET_FOUND_LEAF2(Pjll, pop1, offset);
-
-	    case cJU_JPLEAF3:
-	    {
-		Word_t lsb;
-		JU_COPY3_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (3 * offset));
-		*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(3))) | lsb;
-		JU_RET_FOUND_LEAF3(Pjll, pop1, offset);
-	    }
-
-#ifdef JU_64BIT
-	    case cJU_JPLEAF4:
-
-		*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(4)))
-			| ((uint32_t *) Pjll)[offset];
-		JU_RET_FOUND_LEAF4(Pjll, pop1, offset);
-
-	    case cJU_JPLEAF5:
-	    {
-		Word_t lsb;
-		JU_COPY5_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (5 * offset));
-		*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(5))) | lsb;
-		JU_RET_FOUND_LEAF5(Pjll, pop1, offset);
-	    }
-
-	    case cJU_JPLEAF6:
-	    {
-		Word_t lsb;
-		JU_COPY6_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (6 * offset));
-		*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(6))) | lsb;
-		JU_RET_FOUND_LEAF6(Pjll, pop1, offset);
-	    }
-
-	    case cJU_JPLEAF7:
-	    {
-		Word_t lsb;
-		JU_COPY7_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (7 * offset));
-		*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(7))) | lsb;
-		JU_RET_FOUND_LEAF7(Pjll, pop1, offset);
-	    }
-
-#endif // JU_64BIT
-
-#define	SET_01(cState)  JU_SETDIGITS(*PIndex, JU_JPDCDPOP0(Pjp), cState)
-
-	    case cJU_JPIMMED_1_01: SET_01(1); goto SM1Imm_01;
-	    case cJU_JPIMMED_2_01: SET_01(2); goto SM1Imm_01;
-	    case cJU_JPIMMED_3_01: SET_01(3); goto SM1Imm_01;
-#ifdef JU_64BIT
-	    case cJU_JPIMMED_4_01: SET_01(4); goto SM1Imm_01;
-	    case cJU_JPIMMED_5_01: SET_01(5); goto SM1Imm_01;
-	    case cJU_JPIMMED_6_01: SET_01(6); goto SM1Imm_01;
-	    case cJU_JPIMMED_7_01: SET_01(7); goto SM1Imm_01;
-#endif
-SM1Imm_01:	JU_RET_FOUND_IMM_01(Pjp);
-
-// Shorthand for where to find start of Index bytes array:
-
-#ifdef JUDY1
-#define	PJI (Pjp->jp_1Index)
-#else
-#define	PJI (Pjp->jp_LIndex)
-#endif
-
-	    case cJU_JPIMMED_1_02:
-	    case cJU_JPIMMED_1_03:
-#if (defined(JUDY1) || defined(JU_64BIT))
-	    case cJU_JPIMMED_1_04:
-	    case cJU_JPIMMED_1_05:
-	    case cJU_JPIMMED_1_06:
-	    case cJU_JPIMMED_1_07:
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-	    case cJ1_JPIMMED_1_08:
-	    case cJ1_JPIMMED_1_09:
-	    case cJ1_JPIMMED_1_10:
-	    case cJ1_JPIMMED_1_11:
-	    case cJ1_JPIMMED_1_12:
-	    case cJ1_JPIMMED_1_13:
-	    case cJ1_JPIMMED_1_14:
-	    case cJ1_JPIMMED_1_15:
-#endif
-		JU_SETDIGIT1(*PIndex, ((uint8_t *) PJI)[offset]);
-		JU_RET_FOUND_IMM(Pjp, offset);
-
-#if (defined(JUDY1) || defined(JU_64BIT))
-	    case cJU_JPIMMED_2_02:
-	    case cJU_JPIMMED_2_03:
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-	    case cJ1_JPIMMED_2_04:
-	    case cJ1_JPIMMED_2_05:
-	    case cJ1_JPIMMED_2_06:
-	    case cJ1_JPIMMED_2_07:
-#endif
-#if (defined(JUDY1) || defined(JU_64BIT))
-		*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(2)))
-			| ((uint16_t *) PJI)[offset];
-		JU_RET_FOUND_IMM(Pjp, offset);
-#endif
-
-#if (defined(JUDY1) || defined(JU_64BIT))
-	    case cJU_JPIMMED_3_02:
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-	    case cJ1_JPIMMED_3_03:
-	    case cJ1_JPIMMED_3_04:
-	    case cJ1_JPIMMED_3_05:
-#endif
-#if (defined(JUDY1) || defined(JU_64BIT))
-	    {
-		Word_t lsb;
-		JU_COPY3_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (3 * offset));
-		*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(3))) | lsb;
-		JU_RET_FOUND_IMM(Pjp, offset);
-	    }
-#endif
-
-#if (defined(JUDY1) && defined(JU_64BIT))
-	    case cJ1_JPIMMED_4_02:
-	    case cJ1_JPIMMED_4_03:
-
-		*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(4)))
-			| ((uint32_t *) PJI)[offset];
-		JU_RET_FOUND_IMM(Pjp, offset);
-
-	    case cJ1_JPIMMED_5_02:
-	    case cJ1_JPIMMED_5_03:
-	    {
-		Word_t lsb;
-		JU_COPY5_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (5 * offset));
-		*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(5))) | lsb;
-		JU_RET_FOUND_IMM(Pjp, offset);
-	    }
-
-	    case cJ1_JPIMMED_6_02:
-	    {
-		Word_t lsb;
-		JU_COPY6_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (6 * offset));
-		*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(6))) | lsb;
-		JU_RET_FOUND_IMM(Pjp, offset);
-	    }
-
-	    case cJ1_JPIMMED_7_02:
-	    {
-		Word_t lsb;
-		JU_COPY7_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (7 * offset));
-		*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(7))) | lsb;
-		JU_RET_FOUND_IMM(Pjp, offset);
-	    }
-
-#endif // (JUDY1 && JU_64BIT)
-
-	    } // switch for not-found *PIndex
-
-	    JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);	// impossible?
-	    JUDY1CODE(return(JERRI );)
-	    JUDYLCODE(return(PPJERR);)
-
-
-// ----------------------------------------------------------------------------
-// BITMAP LEAF:
-//
-// Check Decode bytes, if any, in the current JP, then look in the leaf for
-// *PIndex.
-
-	case cJU_JPLEAF_B1:
-	{
-	    Pjlb_t Pjlb;
-	    CHECKDCD(1);
-
-	    Pjlb	= P_JLB(Pjp->jp_Addr);
-	    digit       = JU_DIGITATSTATE(*PIndex, 1);
-	    subexp      = JU_SUBEXPL(digit);
-	    bitposmask  = JU_BITPOSMASKL(digit);
-	    assert(subexp < cJU_NUMSUBEXPL);	// falls in expected range.
-
-// *PIndex exists in LeafB1:
-
-//	    if (JU_BITMAPTESTL(Pjlb, digit))			// slower.
-	    if (JU_JLB_BITMAP(Pjlb, subexp) & bitposmask)	// faster.
-	    {
-#ifdef JUDYL				// needs offset at this point:
-		offset = SEARCHBITMAPL(JU_JLB_BITMAP(Pjlb, subexp), digit, bitposmask);
-#endif
-		JU_RET_FOUND_LEAF_B1(Pjlb, subexp, offset);
-//	== return((PPvoid_t) (P_JV(JL_JLB_PVALUE(Pjlb, subexp)) + (offset)));
-	    }
-
-// Dead end, no Index in LeafB1 for remaining digit in *PIndex:
-//
-// If theres a next-left/right Index in the current LeafB1, which for
-// Judy*Next() is true if any bits are set for higher Indexes, shortcut by
-// returning it.  Note:  For Judy*Prev(), offset is set here to the correct
-// value for the next-left JP.
-
-	    offset = SEARCHBITMAPL(JU_JLB_BITMAP(Pjlb, subexp), digit,
-				   bitposmask);
-	    // right range:
-	    assert((offset >= -1) && (offset < (int) cJU_BITSPERSUBEXPL));
-
-#ifdef JUDYPREV
-	    if (offset >= 0)		// next-left JP is in this subexpanse.
-		goto SM1LeafB1Findlimit;
-
-	    while (--subexp >= 0)		// search next-left subexpanses.
-#else
-	    if (JU_JLB_BITMAP(Pjlb, subexp) & JU_MASKHIGHEREXC(bitposmask))
-	    {
-		++offset;			// next-left => next-right.
-		goto SM1LeafB1Findlimit;
-	    }
-
-	    while (++subexp < cJU_NUMSUBEXPL)	// search next-right subexps.
-#endif
-	    {
-		if (! JU_JLB_BITMAP(Pjlb, subexp)) continue;  // empty subexp.
-
-#ifdef JUDYPREV
-		offset = SEARCHBITMAPMAXL(JU_JLB_BITMAP(Pjlb, subexp));
-		// expected range:
-		assert((offset >= 0) && (offset < (int) cJU_BITSPERSUBEXPL));
-#else
-		offset = 0;
-#endif
-
-// Save the next-left/right Indexess digit in *PIndex:
-
-SM1LeafB1Findlimit:
-		JU_BITMAPDIGITL(digit, subexp, JU_JLB_BITMAP(Pjlb, subexp), offset);
-		JU_SETDIGIT1(*PIndex, digit);
-		JU_RET_FOUND_LEAF_B1(Pjlb, subexp, offset);
-//	== return((PPvoid_t) (P_JV(JL_JLB_PVALUE(Pjlb, subexp)) + (offset)));
-	    }
-
-// Theres no next-left/right Index in the LeafB1:
-//
-// Shortcut and start backtracking one level up; ignore the current Pjp because
-// it points to a LeafB1 with no next-left/right Index.
-
-	    goto SM2Backtrack;
-
-	} // case cJU_JPLEAF_B1
-
-#ifdef JUDY1
-// ----------------------------------------------------------------------------
-// FULL POPULATION:
-//
-// If the Decode bytes match, *PIndex is found (without modification).
-
-	case cJ1_JPFULLPOPU1:
-
-	    CHECKDCD(1);
-	    JU_RET_FOUND_FULLPOPU1;
-#endif
-
-
-// ----------------------------------------------------------------------------
-// IMMEDIATE:
-
-#ifdef JUDYPREV
-#define	SM1IMM_SETPOP1(cPop1)
-#else
-#define SM1IMM_SETPOP1(cPop1)  pop1 = (cPop1)
-#endif
-
-#define	SM1IMM(Func,cPop1)				\
-	SM1IMM_SETPOP1(cPop1);				\
-	offset = Func((Pjll_t) (PJI), cPop1, *PIndex);	\
-	goto SM1LeafLImm
-
-// Special case for Pop1 = 1 Immediate JPs:
-//
-// If *PIndex is in the immediate, offset is 0, otherwise the binary NOT of the
-// offset where it belongs, 0 or 1, same as from the search functions.
-
-#ifdef JUDYPREV
-#define	SM1IMM_01_SETPOP1
-#else
-#define SM1IMM_01_SETPOP1  pop1 = 1
-#endif
-
-#define	SM1IMM_01							  \
-	SM1IMM_01_SETPOP1;						  \
-	offset = ((JU_JPDCDPOP0(Pjp) <  JU_TRIMTODCDSIZE(*PIndex)) ? ~1 : \
-		  (JU_JPDCDPOP0(Pjp) == JU_TRIMTODCDSIZE(*PIndex)) ?  0 : \
-								     ~0); \
-	goto SM1LeafLImm
-
-	case cJU_JPIMMED_1_01:
-	case cJU_JPIMMED_2_01:
-	case cJU_JPIMMED_3_01:
-#ifdef JU_64BIT
-	case cJU_JPIMMED_4_01:
-	case cJU_JPIMMED_5_01:
-	case cJU_JPIMMED_6_01:
-	case cJU_JPIMMED_7_01:
-#endif
-	    SM1IMM_01;
-
-// TBD:  Doug says it would be OK to have fewer calls and calculate arg 2, here
-// and in Judy*Count() also.
-
-	case cJU_JPIMMED_1_02:  SM1IMM(j__udySearchLeaf1,  2);
-	case cJU_JPIMMED_1_03:  SM1IMM(j__udySearchLeaf1,  3);
-#if (defined(JUDY1) || defined(JU_64BIT))
-	case cJU_JPIMMED_1_04:  SM1IMM(j__udySearchLeaf1,  4);
-	case cJU_JPIMMED_1_05:  SM1IMM(j__udySearchLeaf1,  5);
-	case cJU_JPIMMED_1_06:  SM1IMM(j__udySearchLeaf1,  6);
-	case cJU_JPIMMED_1_07:  SM1IMM(j__udySearchLeaf1,  7);
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-	case cJ1_JPIMMED_1_08:  SM1IMM(j__udySearchLeaf1,  8);
-	case cJ1_JPIMMED_1_09:  SM1IMM(j__udySearchLeaf1,  9);
-	case cJ1_JPIMMED_1_10:  SM1IMM(j__udySearchLeaf1, 10);
-	case cJ1_JPIMMED_1_11:  SM1IMM(j__udySearchLeaf1, 11);
-	case cJ1_JPIMMED_1_12:  SM1IMM(j__udySearchLeaf1, 12);
-	case cJ1_JPIMMED_1_13:  SM1IMM(j__udySearchLeaf1, 13);
-	case cJ1_JPIMMED_1_14:  SM1IMM(j__udySearchLeaf1, 14);
-	case cJ1_JPIMMED_1_15:  SM1IMM(j__udySearchLeaf1, 15);
-#endif
-
-#if (defined(JUDY1) || defined(JU_64BIT))
-	case cJU_JPIMMED_2_02:  SM1IMM(j__udySearchLeaf2,  2);
-	case cJU_JPIMMED_2_03:  SM1IMM(j__udySearchLeaf2,  3);
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-	case cJ1_JPIMMED_2_04:  SM1IMM(j__udySearchLeaf2,  4);
-	case cJ1_JPIMMED_2_05:  SM1IMM(j__udySearchLeaf2,  5);
-	case cJ1_JPIMMED_2_06:  SM1IMM(j__udySearchLeaf2,  6);
-	case cJ1_JPIMMED_2_07:  SM1IMM(j__udySearchLeaf2,  7);
-#endif
-
-#if (defined(JUDY1) || defined(JU_64BIT))
-	case cJU_JPIMMED_3_02:  SM1IMM(j__udySearchLeaf3,  2);
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-	case cJ1_JPIMMED_3_03:  SM1IMM(j__udySearchLeaf3,  3);
-	case cJ1_JPIMMED_3_04:  SM1IMM(j__udySearchLeaf3,  4);
-	case cJ1_JPIMMED_3_05:  SM1IMM(j__udySearchLeaf3,  5);
-
-	case cJ1_JPIMMED_4_02:  SM1IMM(j__udySearchLeaf4,  2);
-	case cJ1_JPIMMED_4_03:  SM1IMM(j__udySearchLeaf4,  3);
-
-	case cJ1_JPIMMED_5_02:  SM1IMM(j__udySearchLeaf5,  2);
-	case cJ1_JPIMMED_5_03:  SM1IMM(j__udySearchLeaf5,  3);
-
-	case cJ1_JPIMMED_6_02:  SM1IMM(j__udySearchLeaf6,  2);
-
-	case cJ1_JPIMMED_7_02:  SM1IMM(j__udySearchLeaf7,  2);
-#endif
-
-
-// ----------------------------------------------------------------------------
-// INVALID JP TYPE:
-
-	default: JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
-		 JUDY1CODE(return(JERRI );)
-		 JUDYLCODE(return(PPJERR);)
-
-	} // SM1Get switch.
-
-	/*NOTREACHED*/
-
-
-// ============================================================================
-// STATE MACHINE 2 -- BACKTRACK BRANCH TO PREVIOUS JP:
-//
-// Look for the next-left/right JP in a branch, backing up the history list as
-// necessary.  Upon finding a next-left/right JP, modify the corresponding
-// digit in *PIndex before passing control to SM3Findlimit.
-//
-// Note:  As described earlier, only branch JPs are expected here; other types
-// fall into the default case.
-//
-// Note:  If a found JP contains needed Dcd bytes, thats OK, theyre copied to
-// *PIndex in SM3Findlimit.
-//
-// TBD:  This code has a lot in common with similar code in the shortcut cases
-// in SM1Get.  Can combine this code somehow?
-//
-// ENTRY:  List, possibly empty, of JPs and offsets in APjphist[] and
-// Aoffhist[]; see earlier comments.
-//
-// EXIT:  Execute JU_RET_NOTFOUND if no previous/next JP; otherwise jump to
-// SM3Findlimit to resume a new but different downward search.
-
-SM2Backtrack:		// come or return here for first/next sideways search.
-
-	HISTPOP(Pjp, offset);
-
-	switch (JU_JPTYPE(Pjp))
-	{
-
-
-// ----------------------------------------------------------------------------
-// LINEAR BRANCH:
-
-	case cJU_JPBRANCH_L2: state = 2;	     goto SM2BranchL;
-	case cJU_JPBRANCH_L3: state = 3;	     goto SM2BranchL;
-#ifdef JU_64BIT
-	case cJU_JPBRANCH_L4: state = 4;	     goto SM2BranchL;
-	case cJU_JPBRANCH_L5: state = 5;	     goto SM2BranchL;
-	case cJU_JPBRANCH_L6: state = 6;	     goto SM2BranchL;
-	case cJU_JPBRANCH_L7: state = 7;	     goto SM2BranchL;
-#endif
-	case cJU_JPBRANCH_L:  state = cJU_ROOTSTATE; goto SM2BranchL;
-
-SM2BranchL:
-#ifdef JUDYPREV
-	    if (--offset < 0) goto SM2Backtrack;  // no next-left JP in BranchL.
-#endif
-	    Pjbl = P_JBL(Pjp->jp_Addr);
-#ifdef JUDYNEXT
-	    if (++offset >= (Pjbl->jbl_NumJPs)) goto SM2Backtrack;
-						// no next-right JP in BranchL.
-#endif
-
-// Theres a next-left/right JP in the current BranchL; save its digit in
-// *PIndex and continue with SM3Findlimit:
-
-	    JU_SETDIGIT(*PIndex, Pjbl->jbl_Expanse[offset], state);
-	    Pjp = (Pjbl->jbl_jp) + offset;
-	    goto SM3Findlimit;
-
-
-// ----------------------------------------------------------------------------
-// BITMAP BRANCH:
-
-	case cJU_JPBRANCH_B2: state = 2;	     goto SM2BranchB;
-	case cJU_JPBRANCH_B3: state = 3;	     goto SM2BranchB;
-#ifdef JU_64BIT
-	case cJU_JPBRANCH_B4: state = 4;	     goto SM2BranchB;
-	case cJU_JPBRANCH_B5: state = 5;	     goto SM2BranchB;
-	case cJU_JPBRANCH_B6: state = 6;	     goto SM2BranchB;
-	case cJU_JPBRANCH_B7: state = 7;	     goto SM2BranchB;
-#endif
-	case cJU_JPBRANCH_B:  state = cJU_ROOTSTATE; goto SM2BranchB;
-
-SM2BranchB:
-	    Pjbb = P_JBB(Pjp->jp_Addr);
-	    HISTPOPBOFF(subexp, offset, digit);		// unpack values.
-
-// If theres a next-left/right JP in the current BranchB, which for
-// Judy*Next() is true if any bits are set for higher Indexes, continue to
-// SM3Findlimit:
-//
-// Note:  offset is set to the JP previously traversed; go one to the
-// left/right.
-
-#ifdef JUDYPREV
-	    if (offset > 0)		// next-left JP is in this subexpanse.
-	    {
-		--offset;
-		goto SM2BranchBFindlimit;
-	    }
-
-	    while (--subexp >= 0)		// search next-left subexpanses.
-#else
-	    if (JU_JBB_BITMAP(Pjbb, subexp)
-	      & JU_MASKHIGHEREXC(JU_BITPOSMASKB(digit)))
-	    {
-		++offset;			// next-left => next-right.
-		goto SM2BranchBFindlimit;
-	    }
-
-	    while (++subexp < cJU_NUMSUBEXPB)	// search next-right subexps.
-#endif
-	    {
-		if (! JU_JBB_PJP(Pjbb, subexp)) continue;  // empty subexpanse.
-
-#ifdef JUDYPREV
-		offset = SEARCHBITMAPMAXB(JU_JBB_BITMAP(Pjbb, subexp));
-		// expected range:
-		assert((offset >= 0) && (offset < cJU_BITSPERSUBEXPB));
-#else
-		offset = 0;
-#endif
-
-// Save the next-left/right JPs digit in *PIndex:
-
-SM2BranchBFindlimit:
-		JU_BITMAPDIGITB(digit, subexp, JU_JBB_BITMAP(Pjbb, subexp),
-				offset);
-		JU_SETDIGIT(*PIndex, digit, state);
-
-		if ((Pjp = P_JP(JU_JBB_PJP(Pjbb, subexp))) == (Pjp_t) NULL)
-		{
-		    JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
-		    JUDY1CODE(return(JERRI );)
-		    JUDYLCODE(return(PPJERR);)
-		}
-
-		Pjp += offset;
-		goto SM3Findlimit;
-	    }
-
-// Theres no next-left/right JP in the BranchB:
-
-	    goto SM2Backtrack;
-
-
-// ----------------------------------------------------------------------------
-// UNCOMPRESSED BRANCH:
-
-	case cJU_JPBRANCH_U2: state = 2;	     goto SM2BranchU;
-	case cJU_JPBRANCH_U3: state = 3;	     goto SM2BranchU;
-#ifdef JU_64BIT
-	case cJU_JPBRANCH_U4: state = 4;	     goto SM2BranchU;
-	case cJU_JPBRANCH_U5: state = 5;	     goto SM2BranchU;
-	case cJU_JPBRANCH_U6: state = 6;	     goto SM2BranchU;
-	case cJU_JPBRANCH_U7: state = 7;	     goto SM2BranchU;
-#endif
-	case cJU_JPBRANCH_U:  state = cJU_ROOTSTATE; goto SM2BranchU;
-
-SM2BranchU:
-
-// Search for a next-left/right JP in the current BranchU, and if one is found,
-// save its digit in *PIndex and continue to SM3Findlimit:
-
-	    Pjbu  = P_JBU(Pjp->jp_Addr);
-	    digit = offset;
-
-#ifdef JUDYPREV
-	    while (digit >= 1)
-	    {
-		Pjp = (Pjbu->jbu_jp) + (--digit);
-#else
-	    while (digit < cJU_BRANCHUNUMJPS - 1)
-	    {
-		Pjp = (Pjbu->jbu_jp) + (++digit);
-#endif
-		if (JPNULL(JU_JPTYPE(Pjp))) continue;
-
-		JU_SETDIGIT(*PIndex, digit, state);
-		goto SM3Findlimit;
-	    }
-
-// Theres no next-left/right JP in the BranchU:
-
-	    goto SM2Backtrack;
-
-
-// ----------------------------------------------------------------------------
-// INVALID JP TYPE:
-
-	default: JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
-		 JUDY1CODE(return(JERRI );)
-		 JUDYLCODE(return(PPJERR);)
-
-	} // SM2Backtrack switch.
-
-	/*NOTREACHED*/
-
-
-// ============================================================================
-// STATE MACHINE 3 -- FIND LIMIT JP/INDEX:
-//
-// Look for the highest/lowest (right/left-most) JP in each branch and the
-// highest/lowest Index in a leaf or immediate, and return it.  While
-// traversing, modify appropriate digit(s) in *PIndex to reflect the path
-// taken, including Dcd bytes in each JP (which could hold critical missing
-// digits for skipped branches).
-//
-// ENTRY:  Pjp set to a JP under which to find max/min JPs (if a branch JP) or
-// a max/min Index and return (if a leaf or immediate JP).
-//
-// EXIT:  Execute JU_RET_FOUND* upon reaching a leaf or immediate.  Should be
-// impossible to fail, unless the Judy array is corrupt.
-
-SM3Findlimit:		// come or return here for first/next branch/leaf.
-
-	switch (JU_JPTYPE(Pjp))
-	{
-// ----------------------------------------------------------------------------
-// LINEAR BRANCH:
-//
-// Simply use the highest/lowest (right/left-most) JP in the BranchL, but first
-// copy the Dcd bytes to *PIndex if there are any (only if state <
-// cJU_ROOTSTATE - 1).
-
-	case cJU_JPBRANCH_L2:  SM3PREPB_DCD(2, SM3BranchL);
-#ifndef JU_64BIT
-	case cJU_JPBRANCH_L3:  SM3PREPB(    3, SM3BranchL);
-#else
-	case cJU_JPBRANCH_L3:  SM3PREPB_DCD(3, SM3BranchL);
-	case cJU_JPBRANCH_L4:  SM3PREPB_DCD(4, SM3BranchL);
-	case cJU_JPBRANCH_L5:  SM3PREPB_DCD(5, SM3BranchL);
-	case cJU_JPBRANCH_L6:  SM3PREPB_DCD(6, SM3BranchL);
-	case cJU_JPBRANCH_L7:  SM3PREPB(    7, SM3BranchL);
-#endif
-	case cJU_JPBRANCH_L:   SM3PREPB(    cJU_ROOTSTATE, SM3BranchL);
-
-SM3BranchL:
-	    Pjbl = P_JBL(Pjp->jp_Addr);
-
-#ifdef JUDYPREV
-	    if ((offset = (Pjbl->jbl_NumJPs) - 1) < 0)
-#else
-	    offset = 0; if ((Pjbl->jbl_NumJPs) == 0)
-#endif
-	    {
-		JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
-		JUDY1CODE(return(JERRI );)
-		JUDYLCODE(return(PPJERR);)
-	    }
-
-	    JU_SETDIGIT(*PIndex, Pjbl->jbl_Expanse[offset], state);
-	    Pjp = (Pjbl->jbl_jp) + offset;
-	    goto SM3Findlimit;
-
-
-// ----------------------------------------------------------------------------
-// BITMAP BRANCH:
-//
-// Look for the highest/lowest (right/left-most) non-null subexpanse, then use
-// the highest/lowest JP in that subexpanse, but first copy Dcd bytes, if there
-// are any (only if state < cJU_ROOTSTATE - 1), to *PIndex.
-
-	case cJU_JPBRANCH_B2:  SM3PREPB_DCD(2, SM3BranchB);
-#ifndef JU_64BIT
-	case cJU_JPBRANCH_B3:  SM3PREPB(    3, SM3BranchB);
-#else
-	case cJU_JPBRANCH_B3:  SM3PREPB_DCD(3, SM3BranchB);
-	case cJU_JPBRANCH_B4:  SM3PREPB_DCD(4, SM3BranchB);
-	case cJU_JPBRANCH_B5:  SM3PREPB_DCD(5, SM3BranchB);
-	case cJU_JPBRANCH_B6:  SM3PREPB_DCD(6, SM3BranchB);
-	case cJU_JPBRANCH_B7:  SM3PREPB(    7, SM3BranchB);
-#endif
-	case cJU_JPBRANCH_B:   SM3PREPB(    cJU_ROOTSTATE, SM3BranchB);
-
-SM3BranchB:
-	    Pjbb   = P_JBB(Pjp->jp_Addr);
-#ifdef JUDYPREV
-	    subexp = cJU_NUMSUBEXPB;
-
-	    while (! (JU_JBB_BITMAP(Pjbb, --subexp)))  // find non-empty subexp.
-	    {
-		if (subexp <= 0)		    // wholly empty bitmap.
-		{
-		    JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
-		    JUDY1CODE(return(JERRI );)
-		    JUDYLCODE(return(PPJERR);)
-		}
-	    }
-
-	    offset = SEARCHBITMAPMAXB(JU_JBB_BITMAP(Pjbb, subexp));
-	    // expected range:
-	    assert((offset >= 0) && (offset < cJU_BITSPERSUBEXPB));
-#else
-	    subexp = -1;
-
-	    while (! (JU_JBB_BITMAP(Pjbb, ++subexp)))  // find non-empty subexp.
-	    {
-		if (subexp >= cJU_NUMSUBEXPB - 1)      // didnt find one.
-		{
-		    JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
-		    JUDY1CODE(return(JERRI );)
-		    JUDYLCODE(return(PPJERR);)
-		}
-	    }
-
-	    offset = 0;
-#endif
-
-	    JU_BITMAPDIGITB(digit, subexp, JU_JBB_BITMAP(Pjbb, subexp), offset);
-	    JU_SETDIGIT(*PIndex, digit, state);
-
-	    if ((Pjp = P_JP(JU_JBB_PJP(Pjbb, subexp))) == (Pjp_t) NULL)
-	    {
-		JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
-		JUDY1CODE(return(JERRI );)
-		JUDYLCODE(return(PPJERR);)
-	    }
-
-	    Pjp += offset;
-	    goto SM3Findlimit;
-
-
-// ----------------------------------------------------------------------------
-// UNCOMPRESSED BRANCH:
-//
-// Look for the highest/lowest (right/left-most) non-null JP, and use it, but
-// first copy Dcd bytes to *PIndex if there are any (only if state <
-// cJU_ROOTSTATE - 1).
-
-	case cJU_JPBRANCH_U2:  SM3PREPB_DCD(2, SM3BranchU);
-#ifndef JU_64BIT
-	case cJU_JPBRANCH_U3:  SM3PREPB(    3, SM3BranchU);
-#else
-	case cJU_JPBRANCH_U3:  SM3PREPB_DCD(3, SM3BranchU);
-	case cJU_JPBRANCH_U4:  SM3PREPB_DCD(4, SM3BranchU);
-	case cJU_JPBRANCH_U5:  SM3PREPB_DCD(5, SM3BranchU);
-	case cJU_JPBRANCH_U6:  SM3PREPB_DCD(6, SM3BranchU);
-	case cJU_JPBRANCH_U7:  SM3PREPB(    7, SM3BranchU);
-#endif
-	case cJU_JPBRANCH_U:   SM3PREPB(    cJU_ROOTSTATE, SM3BranchU);
-
-SM3BranchU:
-	    Pjbu  = P_JBU(Pjp->jp_Addr);
-#ifdef JUDYPREV
-	    digit = cJU_BRANCHUNUMJPS;
-
-	    while (digit >= 1)
-	    {
-		Pjp = (Pjbu->jbu_jp) + (--digit);
-#else
-
-	    for (digit = 0; digit < cJU_BRANCHUNUMJPS; ++digit)
-	    {
-		Pjp = (Pjbu->jbu_jp) + digit;
-#endif
-		if (JPNULL(JU_JPTYPE(Pjp))) continue;
-
-		JU_SETDIGIT(*PIndex, digit, state);
-		goto SM3Findlimit;
-	    }
-
-// No non-null JPs in BranchU:
-
-	    JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
-	    JUDY1CODE(return(JERRI );)
-	    JUDYLCODE(return(PPJERR);)
-
-
-// ----------------------------------------------------------------------------
-// LINEAR LEAF:
-//
-// Simply use the highest/lowest (right/left-most) Index in the LeafL, but the
-// details vary depending on leaf Index Size.  First copy Dcd bytes, if there
-// are any (only if state < cJU_ROOTSTATE - 1), to *PIndex.
-
-#define	SM3LEAFLDCD(cState)				\
-	JU_SETDCD(*PIndex, Pjp, cState);	        \
-	SM3LEAFLNODCD
-
-#ifdef JUDY1
-#define	SM3LEAFL_SETPOP1		// not needed in any cases.
-#else
-#define	SM3LEAFL_SETPOP1  pop1 = JU_JPLEAF_POP0(Pjp) + 1
-#endif
-
-#ifdef JUDYPREV
-#define	SM3LEAFLNODCD			\
-	Pjll = P_JLL(Pjp->jp_Addr);	\
-	SM3LEAFL_SETPOP1;		\
-	offset = JU_JPLEAF_POP0(Pjp); assert(offset >= 0)
-#else
-#define	SM3LEAFLNODCD			\
-	Pjll = P_JLL(Pjp->jp_Addr);	\
-	SM3LEAFL_SETPOP1;		\
-	offset = 0; assert(JU_JPLEAF_POP0(Pjp) >= 0);
-#endif
-
-#if (defined(JUDYL) || (! defined(JU_64BIT)))
-	case cJU_JPLEAF1:
-
-	    SM3LEAFLDCD(1);
-	    JU_SETDIGIT1(*PIndex, ((uint8_t *) Pjll)[offset]);
-	    JU_RET_FOUND_LEAF1(Pjll, pop1, offset);
-#endif
-
-	case cJU_JPLEAF2:
-
-	    SM3LEAFLDCD(2);
-	    *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(2)))
-		    | ((uint16_t *) Pjll)[offset];
-	    JU_RET_FOUND_LEAF2(Pjll, pop1, offset);
-
-#ifndef JU_64BIT
-	case cJU_JPLEAF3:
-	{
-	    Word_t lsb;
-	    SM3LEAFLNODCD;
-	    JU_COPY3_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (3 * offset));
-	    *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(3))) | lsb;
-	    JU_RET_FOUND_LEAF3(Pjll, pop1, offset);
-	}
-
-#else
-	case cJU_JPLEAF3:
-	{
-	    Word_t lsb;
-	    SM3LEAFLDCD(3);
-	    JU_COPY3_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (3 * offset));
-	    *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(3))) | lsb;
-	    JU_RET_FOUND_LEAF3(Pjll, pop1, offset);
-	}
-
-	case cJU_JPLEAF4:
-
-	    SM3LEAFLDCD(4);
-	    *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(4)))
-		    | ((uint32_t *) Pjll)[offset];
-	    JU_RET_FOUND_LEAF4(Pjll, pop1, offset);
-
-	case cJU_JPLEAF5:
-	{
-	    Word_t lsb;
-	    SM3LEAFLDCD(5);
-	    JU_COPY5_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (5 * offset));
-	    *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(5))) | lsb;
-	    JU_RET_FOUND_LEAF5(Pjll, pop1, offset);
-	}
-
-	case cJU_JPLEAF6:
-	{
-	    Word_t lsb;
-	    SM3LEAFLDCD(6);
-	    JU_COPY6_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (6 * offset));
-	    *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(6))) | lsb;
-	    JU_RET_FOUND_LEAF6(Pjll, pop1, offset);
-	}
-
-	case cJU_JPLEAF7:
-	{
-	    Word_t lsb;
-	    SM3LEAFLNODCD;
-	    JU_COPY7_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (7 * offset));
-	    *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(7))) | lsb;
-	    JU_RET_FOUND_LEAF7(Pjll, pop1, offset);
-	}
-#endif
-
-
-// ----------------------------------------------------------------------------
-// BITMAP LEAF:
-//
-// Look for the highest/lowest (right/left-most) non-null subexpanse, then use
-// the highest/lowest Index in that subexpanse, but first copy Dcd bytes
-// (always present since state 1 < cJU_ROOTSTATE) to *PIndex.
-
-	case cJU_JPLEAF_B1:
-	{
-	    Pjlb_t Pjlb;
-
-	    JU_SETDCD(*PIndex, Pjp, 1);
-
-	    Pjlb   = P_JLB(Pjp->jp_Addr);
-#ifdef JUDYPREV
-	    subexp = cJU_NUMSUBEXPL;
-
-	    while (! JU_JLB_BITMAP(Pjlb, --subexp))  // find non-empty subexp.
-	    {
-		if (subexp <= 0)		// wholly empty bitmap.
-		{
-		    JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
-		    JUDY1CODE(return(JERRI );)
-		    JUDYLCODE(return(PPJERR);)
-		}
-	    }
-
-// TBD:  Might it be faster to just use a variant of BITMAPDIGIT*() that yields
-// the digit for the right-most Index with a bit set?
-
-	    offset = SEARCHBITMAPMAXL(JU_JLB_BITMAP(Pjlb, subexp));
-	    // expected range:
-	    assert((offset >= 0) && (offset < cJU_BITSPERSUBEXPL));
-#else
-	    subexp = -1;
-
-	    while (! JU_JLB_BITMAP(Pjlb, ++subexp))  // find non-empty subexp.
-	    {
-		if (subexp >= cJU_NUMSUBEXPL - 1)    // didnt find one.
-		{
-		    JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
-		    JUDY1CODE(return(JERRI );)
-		    JUDYLCODE(return(PPJERR);)
-		}
-	    }
-
-	    offset = 0;
-#endif
-
-	    JU_BITMAPDIGITL(digit, subexp, JU_JLB_BITMAP(Pjlb, subexp), offset);
-	    JU_SETDIGIT1(*PIndex, digit);
-	    JU_RET_FOUND_LEAF_B1(Pjlb, subexp, offset);
-//	== return((PPvoid_t) (P_JV(JL_JLB_PVALUE(Pjlb, subexp)) + (offset)));
-
-	} // case cJU_JPLEAF_B1
-
-#ifdef JUDY1
-// ----------------------------------------------------------------------------
-// FULL POPULATION:
-//
-// Copy Dcd bytes to *PIndex (always present since state 1 < cJU_ROOTSTATE),
-// then set the highest/lowest possible digit as the LSB in *PIndex.
-
-	case cJ1_JPFULLPOPU1:
-
-	    JU_SETDCD(   *PIndex, Pjp, 1);
-#ifdef JUDYPREV
-	    JU_SETDIGIT1(*PIndex, cJU_BITSPERBITMAP - 1);
-#else
-	    JU_SETDIGIT1(*PIndex, 0);
-#endif
-	    JU_RET_FOUND_FULLPOPU1;
-#endif // JUDY1
-
-
-// ----------------------------------------------------------------------------
-// IMMEDIATE:
-//
-// Simply use the highest/lowest (right/left-most) Index in the Imm, but the
-// details vary depending on leaf Index Size and pop1.  Note:  There are no Dcd
-// bytes in an Immediate JP, but in a cJU_JPIMMED_*_01 JP, the field holds the
-// least bytes of the immediate Index.
-
-	case cJU_JPIMMED_1_01: SET_01(1); goto SM3Imm_01;
-	case cJU_JPIMMED_2_01: SET_01(2); goto SM3Imm_01;
-	case cJU_JPIMMED_3_01: SET_01(3); goto SM3Imm_01;
-#ifdef JU_64BIT
-	case cJU_JPIMMED_4_01: SET_01(4); goto SM3Imm_01;
-	case cJU_JPIMMED_5_01: SET_01(5); goto SM3Imm_01;
-	case cJU_JPIMMED_6_01: SET_01(6); goto SM3Imm_01;
-	case cJU_JPIMMED_7_01: SET_01(7); goto SM3Imm_01;
-#endif
-SM3Imm_01:	JU_RET_FOUND_IMM_01(Pjp);
-
-#ifdef JUDYPREV
-#define	SM3IMM_OFFSET(cPop1)  (cPop1) - 1	// highest.
-#else
-#define	SM3IMM_OFFSET(cPop1)  0			// lowest.
-#endif
-
-#define	SM3IMM(cPop1,Next)		\
-	offset = SM3IMM_OFFSET(cPop1);	\
-	goto Next
-
-	case cJU_JPIMMED_1_02: SM3IMM( 2, SM3Imm1);
-	case cJU_JPIMMED_1_03: SM3IMM( 3, SM3Imm1);
-#if (defined(JUDY1) || defined(JU_64BIT))
-	case cJU_JPIMMED_1_04: SM3IMM( 4, SM3Imm1);
-	case cJU_JPIMMED_1_05: SM3IMM( 5, SM3Imm1);
-	case cJU_JPIMMED_1_06: SM3IMM( 6, SM3Imm1);
-	case cJU_JPIMMED_1_07: SM3IMM( 7, SM3Imm1);
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-	case cJ1_JPIMMED_1_08: SM3IMM( 8, SM3Imm1);
-	case cJ1_JPIMMED_1_09: SM3IMM( 9, SM3Imm1);
-	case cJ1_JPIMMED_1_10: SM3IMM(10, SM3Imm1);
-	case cJ1_JPIMMED_1_11: SM3IMM(11, SM3Imm1);
-	case cJ1_JPIMMED_1_12: SM3IMM(12, SM3Imm1);
-	case cJ1_JPIMMED_1_13: SM3IMM(13, SM3Imm1);
-	case cJ1_JPIMMED_1_14: SM3IMM(14, SM3Imm1);
-	case cJ1_JPIMMED_1_15: SM3IMM(15, SM3Imm1);
-#endif
-
-SM3Imm1:    JU_SETDIGIT1(*PIndex, ((uint8_t *) PJI)[offset]);
-	    JU_RET_FOUND_IMM(Pjp, offset);
-
-#if (defined(JUDY1) || defined(JU_64BIT))
-	case cJU_JPIMMED_2_02: SM3IMM(2, SM3Imm2);
-	case cJU_JPIMMED_2_03: SM3IMM(3, SM3Imm2);
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-	case cJ1_JPIMMED_2_04: SM3IMM(4, SM3Imm2);
-	case cJ1_JPIMMED_2_05: SM3IMM(5, SM3Imm2);
-	case cJ1_JPIMMED_2_06: SM3IMM(6, SM3Imm2);
-	case cJ1_JPIMMED_2_07: SM3IMM(7, SM3Imm2);
-#endif
-
-#if (defined(JUDY1) || defined(JU_64BIT))
-SM3Imm2:    *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(2)))
-		    | ((uint16_t *) PJI)[offset];
-	    JU_RET_FOUND_IMM(Pjp, offset);
-#endif
-
-#if (defined(JUDY1) || defined(JU_64BIT))
-	case cJU_JPIMMED_3_02: SM3IMM(2, SM3Imm3);
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-	case cJ1_JPIMMED_3_03: SM3IMM(3, SM3Imm3);
-	case cJ1_JPIMMED_3_04: SM3IMM(4, SM3Imm3);
-	case cJ1_JPIMMED_3_05: SM3IMM(5, SM3Imm3);
-#endif
-
-#if (defined(JUDY1) || defined(JU_64BIT))
-SM3Imm3:
-	{
-	    Word_t lsb;
-	    JU_COPY3_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (3 * offset));
-	    *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(3))) | lsb;
-	    JU_RET_FOUND_IMM(Pjp, offset);
-	}
-#endif
-
-#if (defined(JUDY1) && defined(JU_64BIT))
-	case cJ1_JPIMMED_4_02: SM3IMM(2, SM3Imm4);
-	case cJ1_JPIMMED_4_03: SM3IMM(3, SM3Imm4);
-
-SM3Imm4:    *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(4)))
-		    | ((uint32_t *) PJI)[offset];
-	    JU_RET_FOUND_IMM(Pjp, offset);
-
-	case cJ1_JPIMMED_5_02: SM3IMM(2, SM3Imm5);
-	case cJ1_JPIMMED_5_03: SM3IMM(3, SM3Imm5);
-
-SM3Imm5:
-	{
-	    Word_t lsb;
-	    JU_COPY5_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (5 * offset));
-	    *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(5))) | lsb;
-	    JU_RET_FOUND_IMM(Pjp, offset);
-	}
-
-	case cJ1_JPIMMED_6_02: SM3IMM(2, SM3Imm6);
-
-SM3Imm6:
-	{
-	    Word_t lsb;
-	    JU_COPY6_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (6 * offset));
-	    *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(6))) | lsb;
-	    JU_RET_FOUND_IMM(Pjp, offset);
-	}
-
-	case cJ1_JPIMMED_7_02: SM3IMM(2, SM3Imm7);
-
-SM3Imm7:
-	{
-	    Word_t lsb;
-	    JU_COPY7_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (7 * offset));
-	    *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(7))) | lsb;
-	    JU_RET_FOUND_IMM(Pjp, offset);
-	}
-#endif // (JUDY1 && JU_64BIT)
-
-
-// ----------------------------------------------------------------------------
-// OTHER CASES:
-
-	default: JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
-		 JUDY1CODE(return(JERRI );)
-		 JUDYLCODE(return(PPJERR);)
-
-	} // SM3Findlimit switch.
-
-	/*NOTREACHED*/
-
-} // Judy1Prev() / Judy1Next() / JudyLPrev() / JudyLNext()
diff --git a/libs/klib/judy/JudyPrevNextEmpty.c b/libs/klib/judy/JudyPrevNextEmpty.c
deleted file mode 100644
index 7eef40d..0000000
--- a/libs/klib/judy/JudyPrevNextEmpty.c
+++ /dev/null
@@ -1,1388 +0,0 @@
-// Copyright (C) 2000 - 2002 Hewlett-Packard Company
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the term of the GNU Lesser 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 Lesser General Public License
-// for more details.
-//
-// You should have received a copy of the GNU Lesser 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
-// _________________
-
-// Judy*PrevEmpty() and Judy*NextEmpty() functions for Judy1 and JudyL.
-// Compile with one of -DJUDY1 or -DJUDYL.
-//
-// Compile with -DJUDYNEXT for the Judy*NextEmpty() function; otherwise
-// defaults to Judy*PrevEmpty().
-//
-// Compile with -DTRACEJPSE to trace JP traversals.
-//
-// This file is separate from JudyPrevNext.c because it differs too greatly for
-// ifdefs.  This might be a bit surprising, but there are two reasons:
-//
-// - First, down in the details, searching for an empty index (SearchEmpty) is
-//   remarkably asymmetric with searching for a valid index (SearchValid),
-//   mainly with respect to:  No return of a value area for JudyL; partially-
-//   full versus totally-full JPs; and handling of narrow pointers.
-//
-// - Second, we chose to implement SearchEmpty without a backtrack stack or
-//   backtrack engine, partly as an experiment, and partly because we think
-//   restarting from the top of the tree is less likely for SearchEmpty than
-//   for SearchValid, because empty indexes are more likely than valid indexes.
-//
-// A word about naming:  A prior version of this feature (see 4.13) was named
-// Judy*Free(), but there were concerns about that being read as a verb rather
-// than an adjective.  After prolonged debate and based on user input, we
-// changed "Free" to "Empty".
-
-#if (! (defined(JUDY1) || defined(JUDYL)))
-#error:  One of -DJUDY1 or -DJUDYL must be specified.
-#endif
-
-#ifndef JUDYNEXT
-#ifndef JUDYPREV
-#define	JUDYPREV 1		// neither set => use default.
-#endif
-#endif
-
-#ifdef JUDY1
-#include "Judy1.h"
-#else
-#include "JudyL.h"
-#endif
-
-#include "JudyPrivate1L.h"
-
-#ifdef TRACEJPSE
-#include "JudyPrintJP.c"
-#endif
-
-
-// ****************************************************************************
-// J U D Y   1   P R E V   E M P T Y
-// J U D Y   1   N E X T   E M P T Y
-// J U D Y   L   P R E V   E M P T Y
-// J U D Y   L   N E X T   E M P T Y
-//
-// See the manual entry for the API.
-//
-// OVERVIEW OF Judy*PrevEmpty() / Judy*NextEmpty():
-//
-// See also for comparison the equivalent comments in JudyPrevNext.c.
-//
-// Take the callers *PIndex and subtract/add 1, but watch out for
-// underflow/overflow, which means "no previous/next empty index found."  Use a
-// reentrant switch statement (state machine, see SMGetRestart and
-// SMGetContinue) to decode Index, starting with the JRP (PArray), through a
-// JPM and branches, if any, down to an immediate or a leaf.  Look for Index in
-// that immediate or leaf, and if not found (invalid index), return success
-// (Index is empty).
-//
-// This search can result in a dead end where taking a different path is
-// required.  There are four kinds of dead ends:
-//
-// BRANCH PRIMARY dead end:  Encountering a fully-populated JP for the
-// appropriate digit in Index.  Search sideways in the branch for the
-// previous/next absent/null/non-full JP, and if one is found, set Index to the
-// highest/lowest index possible in that JPs expanse.  Then if the JP is an
-// absent or null JP, return success; otherwise for a non-full JP, traverse
-// through the partially populated JP.
-//
-// BRANCH SECONDARY dead end:  Reaching the end of a branch during a sideways
-// search after a branch primary dead end.  Set Index to the lowest/highest
-// index possible in the whole branchs expanse (one higher/lower than the
-// previous/next branchs expanse), then restart at the top of the tree, which
-// includes pre-decrementing/incrementing Index (again) and watching for
-// underflow/overflow (again).
-//
-// LEAF PRIMARY dead end:  Finding a valid (non-empty) index in an immediate or
-// leaf matching Index.  Search sideways in the immediate/leaf for the
-// previous/next empty index; if found, set *PIndex to match and return success.
-//
-// LEAF SECONDARY dead end:  Reaching the end of an immediate or leaf during a
-// sideways search after a leaf primary dead end.  Just as for a branch
-// secondary dead end, restart at the top of the tree with Index set to the
-// lowest/highest index possible in the whole immediate/leafs expanse.
-// TBD:  If leaf secondary dead end occurs, could shortcut and treat it as a
-// branch primary dead end; but this would require remembering the parent
-// branchs type and offset (a "one-deep stack"), and also wrestling with
-// narrow pointers, at least for leaves (but not for immediates).
-//
-// Note some ASYMMETRIES between SearchValid and SearchEmpty:
-//
-// - The SearchValid code, upon descending through a narrow pointer, if Index
-//   is outside the expanse of the subsidiary node (effectively a secondary
-//   dead end), must decide whether to backtrack or findlimit.  But the
-//   SearchEmpty code simply returns success (Index is empty).
-//
-// - Similarly, the SearchValid code, upon finding no previous/next index in
-//   the expanse of a narrow pointer (again, a secondary dead end), can simply
-//   start to backtrack at the parent JP.  But the SearchEmpty code would have
-//   to first determine whether or not the parent JPs narrow expanse contains
-//   a previous/next empty index outside the subexpanse.  Rather than keeping a
-//   parent state stack and backtracking this way, upon a secondary dead end,
-//   the SearchEmpty code simply restarts at the top of the tree, whether or
-//   not a narrow pointer is involved.  Again, see the equivalent comments in
-//   JudyPrevNext.c for comparison.
-//
-// This function is written iteratively for speed, rather than recursively.
-//
-// TBD:  Wed like to enhance this function to make successive searches faster.
-// This would require saving some previous state, including the previous Index
-// returned, and in which leaf it was found.  If the next call is for the same
-// Index and the array has not been modified, start at the same leaf.  This
-// should be much easier to implement since this is iterative rather than
-// recursive code.
-
-#ifdef JUDY1
-#ifdef JUDYPREV
-FUNCTION int Judy1PrevEmpty
-#else
-FUNCTION int Judy1NextEmpty
-#endif
-#else
-#ifdef JUDYPREV
-FUNCTION int JudyLPrevEmpty
-#else
-FUNCTION int JudyLNextEmpty
-#endif
-#endif
-        (
-	Pcvoid_t  PArray,	// Judy array to search.
-	Word_t *  PIndex,	// starting point and result.
-	PJError_t PJError	// optional, for returning error info.
-        )
-{
-	Word_t	  Index;	// fast copy, in a register.
-	Pjp_t	  Pjp;		// current JP.
-	Pjbl_t	  Pjbl;		// Pjp->jp_Addr masked and cast to types:
-	Pjbb_t	  Pjbb;
-	Pjbu_t	  Pjbu;
-	Pjlb_t	  Pjlb;
-	PWord_t	  Pword;	// alternate name for use by GET* macros.
-
-	Word_t	  digit;	// next digit to decode from Index.
-	Word_t	  digits;	// current state in SM = digits left to decode.
-	Word_t	  pop0;		// in a leaf.
-	Word_t	  pop0mask;	// precalculated to avoid variable shifts.
-	long	  offset;	// within a branch or leaf (can be large).
-	int	  subexp;	// subexpanse in a bitmap branch.
-	BITMAPB_t bitposmaskB;	// bit in bitmap for bitmap branch.
-	BITMAPL_t bitposmaskL;	// bit in bitmap for bitmap leaf.
-	Word_t	  possfullJP1;	// JP types for possibly full subexpanses:
-	Word_t	  possfullJP2;
-	Word_t	  possfullJP3;
-
-
-// ----------------------------------------------------------------------------
-// M A C R O S
-//
-// These are intended to make the code a bit more readable and less redundant.
-
-
-// CHECK FOR NULL JP:
-//
-// TBD:  In principle this can be reduced (here and in other *.c files) to just
-// the latter clause since no Type should ever be below cJU_JPNULL1, but in
-// fact some root pointer types can be lower, so for safety do both checks.
-
-#define	JPNULL(Type)  (((Type) >= cJU_JPNULL1) && ((Type) <= cJU_JPNULLMAX))
-
-
-// CHECK FOR A FULL JP:
-//
-// Given a JP, indicate if it is fully populated.  Use digits, pop0mask, and
-// possfullJP1..3 in the context.
-//
-// This is a difficult problem because it requires checking the Pop0 bits for
-// all-ones, but the number of bytes depends on the JP type, which is not
-// directly related to the parent branchs type or level -- the JPs child
-// could be under a narrow pointer (hence not full).  The simple answer
-// requires switching on or otherwise calculating the JP type, which could be
-// slow.  Instead, in SMPREPB* precalculate pop0mask and also record in
-// possfullJP1..3 the child JP (branch) types that could possibly be full (one
-// level down), and use them here.  For level-2 branches (with digits == 2),
-// the test for a full child depends on Judy1/JudyL.
-//
-// Note:  This cannot be applied to the JP in a JPM because it doesnt have
-// enough pop0 digits.
-//
-// TBD:  JPFULL_BRANCH diligently checks for BranchL or BranchB, where neither
-// of those can ever be full as it turns out.  Could just check for a BranchU
-// at the right level.  Also, pop0mask might be overkill, its not used much,
-// so perhaps just call cJU_POP0MASK(digits - 1) here?
-//
-// First, JPFULL_BRANCH checks for a full expanse for a JP whose child can be a
-// branch, that is, a JP in a branch at level 3 or higher:
-
-#define	JPFULL_BRANCH(Pjp)						\
-	  ((((JU_JPDCDPOP0(Pjp) ^ cJU_ALLONES) & pop0mask) == 0)	\
-	&& ((JU_JPTYPE(Pjp) == possfullJP1)				\
-	 || (JU_JPTYPE(Pjp) == possfullJP2)				\
-	 || (JU_JPTYPE(Pjp) == possfullJP3)))
-
-#ifdef JUDY1
-#define	JPFULL(Pjp)							\
-	((digits == 2) ?						\
-	 (JU_JPTYPE(Pjp) == cJ1_JPFULLPOPU1) : JPFULL_BRANCH(Pjp))
-#else
-#define	JPFULL(Pjp)							\
-	((digits == 2) ?						\
-	   (JU_JPTYPE(Pjp) == cJU_JPLEAF_B1)				\
-	 && (((JU_JPDCDPOP0(Pjp) & cJU_POP0MASK(1)) == cJU_POP0MASK(1))) : \
-	 JPFULL_BRANCH(Pjp))
-#endif
-
-
-// RETURN SUCCESS:
-//
-// This hides the need to set *PIndex back to the local value of Index -- use a
-// local value for faster operation.  Note that the callers *PIndex is ALWAYS
-// modified upon success, at least decremented/incremented.
-
-#define	RET_SUCCESS { *PIndex = Index; return(1); }
-
-
-// RETURN A CORRUPTION:
-
-#define	RET_CORRUPT { JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); return(JERRI); }
-
-
-// SEARCH A BITMAP BRANCH:
-//
-// This is a weak analog of j__udySearchLeaf*() for bitmap branches.  Return
-// the actual or next-left position, base 0, of Digit in a BITMAPB_t bitmap
-// (subexpanse of a full bitmap), also given a Bitposmask for Digit.  The
-// position is the offset within the set bits.
-//
-// Unlike j__udySearchLeaf*(), the offset is not returned bit-complemented if
-// Digits bit is unset, because the caller can check the bitmap themselves to
-// determine that.  Also, if Digits bit is unset, the returned offset is to
-// the next-left JP or index (including -1), not to the "ideal" position for
-// the index = next-right JP or index.
-//
-// Shortcut and skip calling j__udyCountBitsB() if the bitmap is full, in which
-// case (Digit % cJU_BITSPERSUBEXPB) itself is the base-0 offset.
-
-#define	SEARCHBITMAPB(Bitmap,Digit,Bitposmask)				\
-	(((Bitmap) == cJU_FULLBITMAPB) ? (Digit % cJU_BITSPERSUBEXPB) :	\
-	 j__udyCountBitsB((Bitmap) & JU_MASKLOWERINC(Bitposmask)) - 1)
-
-#ifdef JUDYPREV
-// Equivalent to search for the highest offset in Bitmap, that is, one less
-// than the number of bits set:
-
-#define	SEARCHBITMAPMAXB(Bitmap)					\
-	(((Bitmap) == cJU_FULLBITMAPB) ? cJU_BITSPERSUBEXPB - 1 :	\
-	 j__udyCountBitsB(Bitmap) - 1)
-#endif
-
-
-// CHECK DECODE BYTES:
-//
-// Check Decode bytes in a JP against the equivalent portion of Index.  If they
-// dont match, Index is outside the subexpanse of a narrow pointer, hence is
-// empty.
-
-#define	CHECKDCD(cDigits) \
-	if (JU_DCDNOTMATCHINDEX(Index, Pjp, cDigits)) RET_SUCCESS
-
-
-// REVISE REMAINDER OF INDEX:
-//
-// Put one digit in place in Index and clear/set the lower digits, if any, so
-// the resulting Index is at the start/end of an expanse, or just clear/set the
-// least digits.
-//
-// Actually, to make simple use of JU_LEASTBYTESMASK, first clear/set all least
-// digits of Index including the digit to be overridden, then set the value of
-// that one digit.  If Digits == 1 the first operation is redundant, but either
-// very fast or even removed by the optimizer.
-
-#define	CLEARLEASTDIGITS(Digits) Index &= ~JU_LEASTBYTESMASK(Digits)
-#define	SETLEASTDIGITS(  Digits) Index |=  JU_LEASTBYTESMASK(Digits)
-
-#define	CLEARLEASTDIGITS_D(Digit,Digits)	\
-	{					\
-	    CLEARLEASTDIGITS(Digits);		\
-	    JU_SETDIGIT(Index, Digit, Digits);	\
-	}
-
-#define	SETLEASTDIGITS_D(Digit,Digits)		\
-	{					\
-	    SETLEASTDIGITS(Digits);		\
-	    JU_SETDIGIT(Index, Digit, Digits);	\
-	}
-
-
-// SET REMAINDER OF INDEX AND THEN RETURN OR CONTINUE:
-
-#define	SET_AND_RETURN(OpLeastDigits,Digit,Digits)	\
-	{						\
-	    OpLeastDigits(Digit, Digits);		\
-	    RET_SUCCESS;				\
-	}
-
-#define	SET_AND_CONTINUE(OpLeastDigits,Digit,Digits)	\
-	{						\
-	    OpLeastDigits(Digit, Digits);		\
-	    goto SMGetContinue;				\
-	}
-
-
-// PREPARE TO HANDLE A LEAFW OR JP BRANCH IN THE STATE MACHINE:
-//
-// Extract a state-dependent digit from Index in a "constant" way, then jump to
-// common code for multiple cases.
-//
-// TBD:  Should this macro do more, such as preparing variable-shift masks for
-// use in CLEARLEASTDIGITS and SETLEASTDIGITS?
-
-#define	SMPREPB(cDigits,Next,PossFullJP1,PossFullJP2,PossFullJP3)	\
-	digits	 = (cDigits);						\
-	digit	 = JU_DIGITATSTATE(Index, cDigits);			\
-	pop0mask = cJU_POP0MASK((cDigits) - 1);	 /* for branchs JPs */	\
-	possfullJP1 = (PossFullJP1);					\
-	possfullJP2 = (PossFullJP2);					\
-	possfullJP3 = (PossFullJP3);					\
-	goto Next
-
-// Variations for specific-level branches and for shorthands:
-//
-// Note:  SMPREPB2 need not initialize possfullJP* because JPFULL does not use
-// them for digits == 2, but gcc -Wall isnt quite smart enough to see this, so
-// waste a bit of time and space to get rid of the warning:
-
-#define	SMPREPB2(Next)				\
-	digits	 = 2;				\
-	digit	 = JU_DIGITATSTATE(Index, 2);	\
-	pop0mask = cJU_POP0MASK(1);  /* for branchs JPs */ \
-	possfullJP1 = possfullJP2 = possfullJP3 = 0;	    \
-	goto Next
-
-#define	SMPREPB3(Next) SMPREPB(3,	      Next, cJU_JPBRANCH_L2, \
-						    cJU_JPBRANCH_B2, \
-						    cJU_JPBRANCH_U2)
-#ifndef JU_64BIT
-#define	SMPREPBL(Next) SMPREPB(cJU_ROOTSTATE, Next, cJU_JPBRANCH_L3, \
-						    cJU_JPBRANCH_B3, \
-						    cJU_JPBRANCH_U3)
-#else
-#define	SMPREPB4(Next) SMPREPB(4,	      Next, cJU_JPBRANCH_L3, \
-						    cJU_JPBRANCH_B3, \
-						    cJU_JPBRANCH_U3)
-#define	SMPREPB5(Next) SMPREPB(5,	      Next, cJU_JPBRANCH_L4, \
-						    cJU_JPBRANCH_B4, \
-						    cJU_JPBRANCH_U4)
-#define	SMPREPB6(Next) SMPREPB(6,	      Next, cJU_JPBRANCH_L5, \
-						    cJU_JPBRANCH_B5, \
-						    cJU_JPBRANCH_U5)
-#define	SMPREPB7(Next) SMPREPB(7,	      Next, cJU_JPBRANCH_L6, \
-						    cJU_JPBRANCH_B6, \
-						    cJU_JPBRANCH_U6)
-#define	SMPREPBL(Next) SMPREPB(cJU_ROOTSTATE, Next, cJU_JPBRANCH_L7, \
-						    cJU_JPBRANCH_B7, \
-						    cJU_JPBRANCH_U7)
-#endif
-
-
-// RESTART AFTER SECONDARY DEAD END:
-//
-// Set Index to the first/last index in the branch or leaf subexpanse and start
-// over at the top of the tree.
-
-#ifdef JUDYPREV
-#define	SMRESTART(Digits) { CLEARLEASTDIGITS(Digits); goto SMGetRestart; }
-#else
-#define	SMRESTART(Digits) { SETLEASTDIGITS(  Digits); goto SMGetRestart; }
-#endif
-
-
-// CHECK EDGE OF LEAFS EXPANSE:
-//
-// Given the LSBs of the lowest/highest valid index in a leaf (or equivalently
-// in an immediate JP), the level (index size) of the leaf, and the full index
-// to return (as Index in the context) already set to the full index matching
-// the lowest/highest one, determine if there is an empty index in the leafs
-// expanse below/above the lowest/highest index, which is true if the
-// lowest/highest index is not at the "edge" of the leafs expanse based on its
-// LSBs.  If so, return Index decremented/incremented; otherwise restart at the
-// top of the tree.
-//
-// Note:  In many cases Index is already at the right spot and calling
-// SMRESTART instead of just going directly to SMGetRestart is a bit of
-// overkill.
-//
-// Note:  Variable shift occurs if Digits is not a constant.
-
-#ifdef JUDYPREV
-#define	LEAF_EDGE(MinIndex,Digits)			\
-	{						\
-	    if (MinIndex) { --Index; RET_SUCCESS; }	\
-	    SMRESTART(Digits);				\
-	}
-#else
-#define	LEAF_EDGE(MaxIndex,Digits)			\
-	{						\
-	    if ((MaxIndex) != JU_LEASTBYTES(cJU_ALLONES, Digits)) \
-	    { ++Index; RET_SUCCESS; }			\
-	    SMRESTART(Digits);				\
-	}
-#endif
-
-// Same as above except Index is not already set to match the lowest/highest
-// index, so do that before decrementing/incrementing it:
-
-#ifdef JUDYPREV
-#define	LEAF_EDGE_SET(MinIndex,Digits)	\
-	{				\
-	    if (MinIndex)		\
-	    { JU_SETDIGITS(Index, MinIndex, Digits); --Index; RET_SUCCESS; } \
-	    SMRESTART(Digits);		\
-	}
-#else
-#define	LEAF_EDGE_SET(MaxIndex,Digits)	\
-	{				\
-	    if ((MaxIndex) != JU_LEASTBYTES(cJU_ALLONES, Digits))	    \
-	    { JU_SETDIGITS(Index, MaxIndex, Digits); ++Index; RET_SUCCESS; } \
-	    SMRESTART(Digits);		\
-	}
-#endif
-
-
-// FIND A HOLE (EMPTY INDEX) IN AN IMMEDIATE OR LEAF:
-//
-// Given an index location in a leaf (or equivalently an immediate JP) known to
-// contain a usable hole (an empty index less/greater than Index), and the LSBs
-// of a minimum/maximum index to locate, find the previous/next empty index and
-// return it.
-//
-// Note:  "Even" index sizes (1,2,4[,8] bytes) have corresponding native C
-// types; "odd" index sizes dont, but they are not represented here because
-// they are handled completely differently; see elsewhere.
-
-#ifdef JUDYPREV
-
-#define	LEAF_HOLE_EVEN(cDigits,Pjll,IndexLSB)				\
-	{								\
-	    while (*(Pjll) > (IndexLSB)) --(Pjll); /* too high */	\
-	    if (*(Pjll) < (IndexLSB)) RET_SUCCESS  /* Index is empty */	\
-	    while (*(--(Pjll)) == --(IndexLSB)) /* null, find a hole */;\
-	    JU_SETDIGITS(Index, IndexLSB, cDigits);			\
-	    RET_SUCCESS;						\
-	}
-#else
-#define	LEAF_HOLE_EVEN(cDigits,Pjll,IndexLSB)				\
-	{								\
-	    while (*(Pjll) < (IndexLSB)) ++(Pjll); /* too low */	\
-	    if (*(Pjll) > (IndexLSB)) RET_SUCCESS  /* Index is empty */	\
-	    while (*(++(Pjll)) == ++(IndexLSB)) /* null, find a hole */;\
-	    JU_SETDIGITS(Index, IndexLSB, cDigits);			\
-	    RET_SUCCESS;						\
-	}
-#endif
-
-
-// SEARCH FOR AN EMPTY INDEX IN AN IMMEDIATE OR LEAF:
-//
-// Given a pointer to the first index in a leaf (or equivalently an immediate
-// JP), the population of the leaf, and a first empty Index to find (inclusive,
-// as Index in the context), where Index is known to fall within the expanse of
-// the leaf to search, efficiently find the previous/next empty index in the
-// leaf, if any.  For simplicity the following overview is stated in terms of
-// Judy*NextEmpty() only, but the same concepts apply symmetrically for
-// Judy*PrevEmpty().  Also, in each case the comparisons are for the LSBs of
-// Index and leaf indexes, according to the leafs level.
-//
-// 1.  If Index is GREATER than the last (highest) index in the leaf
-//     (maxindex), return success, Index is empty.  (Remember, Index is known
-//     to be in the leafs expanse.)
-//
-// 2.  If Index is EQUAL to maxindex:  If maxindex is not at the edge of the
-//     leafs expanse, increment Index and return success, there is an empty
-//     Index one higher than any in the leaf; otherwise restart with Index
-//     reset to the upper edge of the leafs expanse.  Note:  This might cause
-//     an extra cache line fill, but this is OK for repeatedly-called search
-//     code, and it saves CPU time.
-//
-// 3.  If Index is LESS than maxindex, check for "dense to end of leaf":
-//     Subtract Index from maxindex, and back up that many slots in the leaf.
-//     If the resulting offset is not before the start of the leaf then compare
-//     the index at this offset (baseindex) with Index:
-//
-// 3a.  If GREATER, the leaf must be corrupt, since indexes are sorted and
-//      there are no duplicates.
-//
-// 3b.  If EQUAL, the leaf is "dense" from Index to maxindex, meaning there is
-//      no reason to search it.  "Slide right" to the high end of the leaf
-//      (modify Index to maxindex) and continue with step 2 above.
-//
-// 3c.  If LESS, continue with step 4.
-//
-// 4.  If the offset based on maxindex minus Index falls BEFORE the start of
-//     the leaf, or if, per 3c above, baseindex is LESS than Index, the leaf is
-//     guaranteed "not dense to the end" and a usable empty Index must exist.
-//     This supports a more efficient search loop.  Start at the FIRST index in
-//     the leaf, or one BEYOND baseindex, respectively, and search the leaf as
-//     follows, comparing each current index (currindex) with Index:
-//
-// 4a.  If LESS, keep going to next index.  Note:  This is certain to terminate
-//      because maxindex is known to be greater than Index, hence the loop can
-//      be small and fast.
-//
-// 4b.  If EQUAL, loop and increment Index until finding currindex greater than
-//      Index, and return success with the modified Index.
-//
-// 4c.  If GREATER, return success, Index (unmodified) is empty.
-//
-// Note:  These are macros rather than functions for speed.
-
-#ifdef JUDYPREV
-
-#define	JSLE_EVEN(Addr,Pop0,cDigits,LeafType)				\
-	{								\
-	    LeafType * PjllLSB  = (LeafType *) (Addr);			\
-	    LeafType   IndexLSB = Index;	/* auto-masking */	\
-									\
-	/* Index before or at start of leaf: */				\
-									\
-	    if (*PjllLSB >= IndexLSB)		/* no need to search */	\
-	    {								\
-		if (*PjllLSB > IndexLSB) RET_SUCCESS; /* Index empty */	\
-		LEAF_EDGE(*PjllLSB, cDigits);				\
-	    }								\
-									\
-	/* Index in or after leaf: */					\
-									\
-	    offset = IndexLSB - *PjllLSB;	/* tentative offset  */	\
-	    if (offset <= (Pop0))		/* can check density */	\
-	    {								\
-		PjllLSB += offset;		/* move to slot */	\
-									\
-		if (*PjllLSB <= IndexLSB)	/* dense or corrupt */	\
-		{							\
-		    if (*PjllLSB == IndexLSB)	/* dense, check edge */	\
-			LEAF_EDGE_SET(PjllLSB[-offset], cDigits);	\
-		    RET_CORRUPT;					\
-		}							\
-		--PjllLSB;	/* not dense, start at previous */	\
-	    }								\
-	    else PjllLSB = ((LeafType *) (Addr)) + (Pop0); /* start at max */ \
-									\
-	    LEAF_HOLE_EVEN(cDigits, PjllLSB, IndexLSB);			\
-	}
-
-// JSLE_ODD is completely different from JSLE_EVEN because its important to
-// minimize copying odd indexes to compare them (see 4.14).  Furthermore, a
-// very complex version (4.17, but abandoned before fully debugged) that
-// avoided calling j__udySearchLeaf*() ran twice as fast as 4.14, but still
-// half as fast as SearchValid.  Doug suggested that to minimize complexity and
-// share common code we should use j__udySearchLeaf*() for the initial search
-// to establish if Index is empty, which should be common.  If Index is valid
-// in a leaf or immediate indexes, odds are good that an empty Index is nearby,
-// so for simplicity just use a *COPY* function to linearly search the
-// remainder.
-//
-// TBD:  Pathological case?  Average performance should be good, but worst-case
-// might suffer.  When Search says the initial Index is valid, so a linear
-// copy-and-compare is begun, if the caller builds fairly large leaves with
-// dense clusters AND frequently does a SearchEmpty at one end of such a
-// cluster, performance wont be very good.  Might a dense-check help?  This
-// means checking offset against the index at offset, and then against the
-// first/last index in the leaf.  We doubt the pathological case will appear
-// much in real applications because they will probably alternate SearchValid
-// and SearchEmpty calls.
-
-#define	JSLE_ODD(cDigits,Pjll,Pop0,Search,Copy)				\
-	{								\
-	    Word_t IndexLSB;		/* least bytes only */		\
-	    Word_t IndexFound;		/* in leaf	    */		\
-									\
-	    if ((offset = Search(Pjll, (Pop0) + 1, Index)) < 0)		\
-		RET_SUCCESS;		/* Index is empty */		\
-									\
-	    IndexLSB = JU_LEASTBYTES(Index, cDigits);			\
-	    offset  *= (cDigits);					\
-									\
-	    while ((offset -= (cDigits)) >= 0)				\
-	    {				/* skip until empty or start */	\
-		Copy(IndexFound, ((uint8_t *) (Pjll)) + offset);	\
-		if (IndexFound != (--IndexLSB))	/* found an empty */	\
-		{ JU_SETDIGITS(Index, IndexLSB, cDigits); RET_SUCCESS; }\
-	    }								\
-	    LEAF_EDGE_SET(IndexLSB, cDigits);				\
-	}
-
-#else // JUDYNEXT
-
-#define	JSLE_EVEN(Addr,Pop0,cDigits,LeafType)				\
-	{								\
-	    LeafType * PjllLSB   = ((LeafType *) (Addr)) + (Pop0);	\
-	    LeafType   IndexLSB = Index;	/* auto-masking */	\
-									\
-	/* Index at or after end of leaf: */				\
-									\
-	    if (*PjllLSB <= IndexLSB)		/* no need to search */	\
-	    {								\
-		if (*PjllLSB < IndexLSB) RET_SUCCESS;  /* Index empty */\
-		LEAF_EDGE(*PjllLSB, cDigits);				\
-	    }								\
-									\
-	/* Index before or in leaf: */					\
-									\
-	    offset = *PjllLSB - IndexLSB;	/* tentative offset  */	\
-	    if (offset <= (Pop0))		/* can check density */	\
-	    {								\
-		PjllLSB -= offset;		/* move to slot */	\
-									\
-		if (*PjllLSB >= IndexLSB)	/* dense or corrupt */	\
-		{							\
-		    if (*PjllLSB == IndexLSB)	/* dense, check edge */	\
-			LEAF_EDGE_SET(PjllLSB[offset], cDigits);	\
-		    RET_CORRUPT;					\
-		}							\
-		++PjllLSB;		/* not dense, start at next */	\
-	    }								\
-	    else PjllLSB = (LeafType *) (Addr);	/* start at minimum */	\
-									\
-	    LEAF_HOLE_EVEN(cDigits, PjllLSB, IndexLSB);			\
-	}
-
-#define	JSLE_ODD(cDigits,Pjll,Pop0,Search,Copy)				\
-	{								\
-	    Word_t IndexLSB;		/* least bytes only */		\
-	    Word_t IndexFound;		/* in leaf	    */		\
-	    int	   offsetmax;		/* in bytes	    */		\
-									\
-	    if ((offset = Search(Pjll, (Pop0) + 1, Index)) < 0)		\
-		RET_SUCCESS;			/* Index is empty */	\
-									\
-	    IndexLSB  = JU_LEASTBYTES(Index, cDigits);			\
-	    offset   *= (cDigits);					\
-	    offsetmax = (Pop0) * (cDigits);	/* single multiply */	\
-									\
-	    while ((offset += (cDigits)) <= offsetmax)			\
-	    {				/* skip until empty or end */	\
-		Copy(IndexFound, ((uint8_t *) (Pjll)) + offset);	\
-		if (IndexFound != (++IndexLSB))	/* found an empty */	\
-		{ JU_SETDIGITS(Index, IndexLSB, cDigits); RET_SUCCESS; } \
-	    }								\
-	    LEAF_EDGE_SET(IndexLSB, cDigits);				\
-	}
-
-#endif // JUDYNEXT
-
-// Note:  Immediate indexes never fill a single index group, so for odd index
-// sizes, save time by calling JSLE_ODD_IMM instead of JSLE_ODD.
-
-#define	j__udySearchLeafEmpty1(Addr,Pop0) \
-	JSLE_EVEN(Addr, Pop0, 1, uint8_t)
-
-#define	j__udySearchLeafEmpty2(Addr,Pop0) \
-	JSLE_EVEN(Addr, Pop0, 2, uint16_t)
-
-#define	j__udySearchLeafEmpty3(Addr,Pop0) \
-	JSLE_ODD(3, Addr, Pop0, j__udySearchLeaf3, JU_COPY3_PINDEX_TO_LONG)
-
-#ifndef JU_64BIT
-
-#define	j__udySearchLeafEmptyL(Addr,Pop0) \
-	JSLE_EVEN(Addr, Pop0, 4, Word_t)
-
-#else
-
-#define	j__udySearchLeafEmpty4(Addr,Pop0) \
-	JSLE_EVEN(Addr, Pop0, 4, uint32_t)
-
-#define	j__udySearchLeafEmpty5(Addr,Pop0) \
-	JSLE_ODD(5, Addr, Pop0, j__udySearchLeaf5, JU_COPY5_PINDEX_TO_LONG)
-
-#define	j__udySearchLeafEmpty6(Addr,Pop0) \
-	JSLE_ODD(6, Addr, Pop0, j__udySearchLeaf6, JU_COPY6_PINDEX_TO_LONG)
-
-#define	j__udySearchLeafEmpty7(Addr,Pop0) \
-	JSLE_ODD(7, Addr, Pop0, j__udySearchLeaf7, JU_COPY7_PINDEX_TO_LONG)
-
-#define	j__udySearchLeafEmptyL(Addr,Pop0) \
-	JSLE_EVEN(Addr, Pop0, 8, Word_t)
-
-#endif // JU_64BIT
-
-
-// ----------------------------------------------------------------------------
-// START OF CODE:
-//
-// CHECK FOR SHORTCUTS:
-//
-// Error out if PIndex is null.
-
-	if (PIndex == (PWord_t) NULL)
-	{
-	    JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX);
-	    return(JERRI);
-	}
-
-	Index = *PIndex;			// fast local copy.
-
-// Set and pre-decrement/increment Index, watching for underflow/overflow:
-//
-// An out-of-bounds Index means failure:  No previous/next empty index.
-
-SMGetRestart:		// return here with revised Index.
-
-#ifdef JUDYPREV
-	if (Index-- == 0) return(0);
-#else
-	if (++Index == 0) return(0);
-#endif
-
-// An empty array with an in-bounds (not underflowed/overflowed) Index means
-// success:
-//
-// Note:  This check is redundant after restarting at SMGetRestart, but should
-// take insignificant time.
-
-	if (PArray == (Pvoid_t) NULL) RET_SUCCESS;
-
-// ----------------------------------------------------------------------------
-// ROOT-LEVEL LEAF that starts with a Pop0 word; just look within the leaf:
-//
-// If Index is not in the leaf, return success; otherwise return the first
-// empty Index, if any, below/above where it would belong.
-
-	if (JU_LEAFW_POP0(PArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW
-	{
-	    Pjlw_t Pjlw = P_JLW(PArray);	// first word of leaf.
-	    pop0 = Pjlw[0];
-
-#ifdef	JUDY1
-	    if (pop0 == 0)			// special case.
-	    {
-#ifdef JUDYPREV
-		if ((Index != Pjlw[1]) || (Index-- != 0)) RET_SUCCESS;
-#else
-		if ((Index != Pjlw[1]) || (++Index != 0)) RET_SUCCESS;
-#endif
-		return(0);		// no previous/next empty index.
-	    }
-#endif // JUDY1
-
-	    j__udySearchLeafEmptyL(Pjlw + 1, pop0);
-
-//  No return -- thanks ALAN
-
-	}
-	else
-
-// ----------------------------------------------------------------------------
-// HANDLE JRP Branch:
-//
-// For JRP branches, traverse the JPM; handle LEAFW
-// directly; but look for the most common cases first.
-
-	{
-	    Pjpm_t Pjpm = P_JPM(PArray);
-	    Pjp = &(Pjpm->jpm_JP);
-
-//	    goto SMGetContinue;
-	}
-
-
-// ============================================================================
-// STATE MACHINE -- GET INDEX:
-//
-// Search for Index (already decremented/incremented so as to be an inclusive
-// search).  If not found (empty index), return success.  Otherwise do a
-// previous/next search, and if successful modify Index to the empty index
-// found.  See function header comments.
-//
-// ENTRY:  Pjp points to next JP to interpret, whose Decode bytes have not yet
-// been checked.
-//
-// Note:  Check Decode bytes at the start of each loop, not after looking up a
-// new JP, so its easy to do constant shifts/masks.
-//
-// EXIT:  Return, or branch to SMGetRestart with modified Index, or branch to
-// SMGetContinue with a modified Pjp, as described elsewhere.
-//
-// WARNING:  For run-time efficiency the following cases replicate code with
-// varying constants, rather than using common code with variable values!
-
-SMGetContinue:			// return here for next branch/leaf.
-
-#ifdef TRACEJPSE
-	JudyPrintJP(Pjp, "sf", __LINE__);
-#endif
-
-	switch (JU_JPTYPE(Pjp))
-	{
-
-
-// ----------------------------------------------------------------------------
-// LINEAR BRANCH:
-//
-// Check Decode bytes, if any, in the current JP, then search for a JP for the
-// next digit in Index.
-
-	case cJU_JPBRANCH_L2: CHECKDCD(2); SMPREPB2(SMBranchL);
-	case cJU_JPBRANCH_L3: CHECKDCD(3); SMPREPB3(SMBranchL);
-#ifdef JU_64BIT
-	case cJU_JPBRANCH_L4: CHECKDCD(4); SMPREPB4(SMBranchL);
-	case cJU_JPBRANCH_L5: CHECKDCD(5); SMPREPB5(SMBranchL);
-	case cJU_JPBRANCH_L6: CHECKDCD(6); SMPREPB6(SMBranchL);
-	case cJU_JPBRANCH_L7: CHECKDCD(7); SMPREPB7(SMBranchL);
-#endif
-	case cJU_JPBRANCH_L:		   SMPREPBL(SMBranchL);
-
-// Common code (state-independent) for all cases of linear branches:
-
-SMBranchL:
-	    Pjbl = P_JBL(Pjp->jp_Addr);
-
-// First, check if Indexs expanse (digit) is below/above the first/last
-// populated expanse in the BranchL, in which case Index is empty; otherwise
-// find the offset of the lowest/highest populated expanse at or above/below
-// digit, if any:
-//
-// Note:  The for-loop is guaranteed to exit eventually because the first/last
-// expanse is known to be a terminator.
-//
-// Note:  Cannot use j__udySearchLeaf*Empty1() here because it only applies to
-// leaves and does not know about partial versus full JPs, unlike the use of
-// j__udySearchLeaf1() for BranchLs in SearchValid code.  Also, since linear
-// leaf expanse lists are small, dont waste time calling j__udySearchLeaf1(),
-// just scan the expanse list.
-
-#ifdef JUDYPREV
-	    if ((Pjbl->jbl_Expanse[0]) > digit) RET_SUCCESS;
-
-	    for (offset = (Pjbl->jbl_NumJPs) - 1; /* null */; --offset)
-#else
-	    if ((Pjbl->jbl_Expanse[(Pjbl->jbl_NumJPs) - 1]) < digit)
-		RET_SUCCESS;
-
-	    for (offset = 0; /* null */; ++offset)
-#endif
-	    {
-
-// Too low/high, keep going; or too high/low, meaning the loop passed a hole
-// and the initial Index is empty:
-
-#ifdef JUDYPREV
-		if ((Pjbl->jbl_Expanse[offset]) > digit) continue;
-		if ((Pjbl->jbl_Expanse[offset]) < digit) RET_SUCCESS;
-#else
-		if ((Pjbl->jbl_Expanse[offset]) < digit) continue;
-		if ((Pjbl->jbl_Expanse[offset]) > digit) RET_SUCCESS;
-#endif
-
-// Found expanse matching digit; if its not full, traverse through it:
-
-		if (! JPFULL((Pjbl->jbl_jp) + offset))
-		{
-		    Pjp = (Pjbl->jbl_jp) + offset;
-		    goto SMGetContinue;
-		}
-
-// Common code:  While searching for a lower/higher hole or a non-full JP, upon
-// finding a lower/higher hole, adjust Index using the revised digit and
-// return; or upon finding a consecutive lower/higher expanse, if the expanses
-// JP is non-full, modify Index and traverse through the JP:
-
-#define	BRANCHL_CHECK(OpIncDec,OpLeastDigits,Digit,Digits)	\
-	{							\
-	    if ((Pjbl->jbl_Expanse[offset]) != OpIncDec digit)	\
-		SET_AND_RETURN(OpLeastDigits, Digit, Digits);	\
-								\
-	    if (! JPFULL((Pjbl->jbl_jp) + offset))		\
-	    {							\
-		Pjp = (Pjbl->jbl_jp) + offset;			\
-		SET_AND_CONTINUE(OpLeastDigits, Digit, Digits);	\
-	    }							\
-	}
-
-// BranchL primary dead end:  Expanse matching Index/digit is full (rare except
-// for dense/sequential indexes):
-//
-// Search for a lower/higher hole, a non-full JP, or the end of the expanse
-// list, while decrementing/incrementing digit.
-
-#ifdef JUDYPREV
-		while (--offset >= 0)
-		    BRANCHL_CHECK(--, SETLEASTDIGITS_D, digit, digits)
-#else
-		while (++offset < Pjbl->jbl_NumJPs)
-		    BRANCHL_CHECK(++, CLEARLEASTDIGITS_D, digit, digits)
-#endif
-
-// Passed end of BranchL expanse list after finding a matching but full
-// expanse:
-//
-// Digit now matches the lowest/highest expanse, which is a full expanse; if
-// digit is at the end of BranchLs expanse (no hole before/after), break out
-// of the loop; otherwise modify Index to the next lower/higher digit and
-// return success:
-
-#ifdef JUDYPREV
-		if (digit == 0) break;
-		--digit; SET_AND_RETURN(SETLEASTDIGITS_D, digit, digits);
-#else
-		if (digit == JU_LEASTBYTES(cJU_ALLONES, 1)) break;
-		++digit; SET_AND_RETURN(CLEARLEASTDIGITS_D, digit, digits);
-#endif
-	    } // for-loop
-
-// BranchL secondary dead end, no non-full previous/next JP:
-
-	    SMRESTART(digits);
-
-
-// ----------------------------------------------------------------------------
-// BITMAP BRANCH:
-//
-// Check Decode bytes, if any, in the current JP, then search for a JP for the
-// next digit in Index.
-
-	case cJU_JPBRANCH_B2: CHECKDCD(2); SMPREPB2(SMBranchB);
-	case cJU_JPBRANCH_B3: CHECKDCD(3); SMPREPB3(SMBranchB);
-#ifdef JU_64BIT
-	case cJU_JPBRANCH_B4: CHECKDCD(4); SMPREPB4(SMBranchB);
-	case cJU_JPBRANCH_B5: CHECKDCD(5); SMPREPB5(SMBranchB);
-	case cJU_JPBRANCH_B6: CHECKDCD(6); SMPREPB6(SMBranchB);
-	case cJU_JPBRANCH_B7: CHECKDCD(7); SMPREPB7(SMBranchB);
-#endif
-	case cJU_JPBRANCH_B:		   SMPREPBL(SMBranchB);
-
-// Common code (state-independent) for all cases of bitmap branches:
-
-SMBranchB:
-	    Pjbb = P_JBB(Pjp->jp_Addr);
-
-// Locate the digits JP in the subexpanse list, if present:
-
-	    subexp     = digit / cJU_BITSPERSUBEXPB;
-	    assert(subexp < cJU_NUMSUBEXPB);	// falls in expected range.
-	    bitposmaskB = JU_BITPOSMASKB(digit);
-
-// Absent JP = no JP matches current digit in Index:
-
-//	    if (! JU_BITMAPTESTB(Pjbb, digit))			// slower.
-	    if (! (JU_JBB_BITMAP(Pjbb, subexp) & bitposmaskB))	// faster.
-		RET_SUCCESS;
-
-// Non-full JP matches current digit in Index:
-//
-// Iterate to the subsidiary non-full JP.
-
-	    offset = SEARCHBITMAPB(JU_JBB_BITMAP(Pjbb, subexp), digit,
-				   bitposmaskB);
-	    // not negative since at least one bit is set:
-	    assert(offset >= 0);
-	    assert(offset < (int) cJU_BITSPERSUBEXPB);
-
-// Watch for null JP subarray pointer with non-null bitmap (a corruption):
-
-	    if ((Pjp = P_JP(JU_JBB_PJP(Pjbb, subexp)))
-	     == (Pjp_t) NULL) RET_CORRUPT;
-
-	    Pjp += offset;
-	    if (! JPFULL(Pjp)) goto SMGetContinue;
-
-// BranchB primary dead end:
-//
-// Upon hitting a full JP in a BranchB for the next digit in Index, search
-// sideways for a previous/next absent JP (unset bit) or non-full JP (set bit
-// with non-full JP); first in the current bitmap subexpanse, then in
-// lower/higher subexpanses.  Upon entry, Pjp points to a known-unusable JP,
-// ready to decrement/increment.
-//
-// Note:  The preceding code is separate from this loop because Index does not
-// need revising (see SET_AND_*()) if the initial index is an empty index.
-//
-// TBD:  For speed, shift bitposmaskB instead of using JU_BITMAPTESTB or
-// JU_BITPOSMASKB, but this shift has knowledge of bit order that really should
-// be encapsulated in a header file.
-
-#define	BRANCHB_CHECKBIT(OpLeastDigits)					\
-    if (! (JU_JBB_BITMAP(Pjbb, subexp) & bitposmaskB))  /* absent JP */	\
-	SET_AND_RETURN(OpLeastDigits, digit, digits)
-
-#define	BRANCHB_CHECKJPFULL(OpLeastDigits)				\
-    if (! JPFULL(Pjp))							\
-	SET_AND_CONTINUE(OpLeastDigits, digit, digits)
-
-#define	BRANCHB_STARTSUBEXP(OpLeastDigits)				\
-    if (! JU_JBB_BITMAP(Pjbb, subexp)) /* empty subexpanse, shortcut */ \
-	SET_AND_RETURN(OpLeastDigits, digit, digits)			\
-    if ((Pjp = P_JP(JU_JBB_PJP(Pjbb, subexp))) == (Pjp_t) NULL) RET_CORRUPT
-
-#ifdef JUDYPREV
-
-	    --digit;				// skip initial digit.
-	    bitposmaskB >>= 1;			// see TBD above.
-
-BranchBNextSubexp:	// return here to check next bitmap subexpanse.
-
-	    while (bitposmaskB)			// more bits to check in subexp.
-	    {
-		BRANCHB_CHECKBIT(SETLEASTDIGITS_D);
-		--Pjp;				// previous in subarray.
-		BRANCHB_CHECKJPFULL(SETLEASTDIGITS_D);
-		assert(digit >= 0);
-		--digit;
-		bitposmaskB >>= 1;
-	    }
-
-	    if (subexp-- > 0)			// more subexpanses.
-	    {
-		BRANCHB_STARTSUBEXP(SETLEASTDIGITS_D);
-		Pjp += SEARCHBITMAPMAXB(JU_JBB_BITMAP(Pjbb, subexp)) + 1;
-		bitposmaskB = (1U << (cJU_BITSPERSUBEXPB - 1));
-		goto BranchBNextSubexp;
-	    }
-
-#else // JUDYNEXT
-
-	    ++digit;				// skip initial digit.
-	    bitposmaskB <<= 1;			// note:  BITMAPB_t.
-
-BranchBNextSubexp:	// return here to check next bitmap subexpanse.
-
-	    while (bitposmaskB)			// more bits to check in subexp.
-	    {
-		BRANCHB_CHECKBIT(CLEARLEASTDIGITS_D);
-		++Pjp;				// previous in subarray.
-		BRANCHB_CHECKJPFULL(CLEARLEASTDIGITS_D);
-		assert(digit < cJU_SUBEXPPERSTATE);
-		++digit;
-		bitposmaskB <<= 1;		// note:  BITMAPB_t.
-	    }
-
-	    if (++subexp < cJU_NUMSUBEXPB)	// more subexpanses.
-	    {
-		BRANCHB_STARTSUBEXP(CLEARLEASTDIGITS_D);
-		--Pjp;				// pre-decrement.
-		bitposmaskB = 1;
-		goto BranchBNextSubexp;
-	    }
-
-#endif // JUDYNEXT
-
-// BranchB secondary dead end, no non-full previous/next JP:
-
-	    SMRESTART(digits);
-
-
-// ----------------------------------------------------------------------------
-// UNCOMPRESSED BRANCH:
-//
-// Check Decode bytes, if any, in the current JP, then search for a JP for the
-// next digit in Index.
-
-	case cJU_JPBRANCH_U2: CHECKDCD(2); SMPREPB2(SMBranchU);
-	case cJU_JPBRANCH_U3: CHECKDCD(3); SMPREPB3(SMBranchU);
-#ifdef JU_64BIT
-	case cJU_JPBRANCH_U4: CHECKDCD(4); SMPREPB4(SMBranchU);
-	case cJU_JPBRANCH_U5: CHECKDCD(5); SMPREPB5(SMBranchU);
-	case cJU_JPBRANCH_U6: CHECKDCD(6); SMPREPB6(SMBranchU);
-	case cJU_JPBRANCH_U7: CHECKDCD(7); SMPREPB7(SMBranchU);
-#endif
-	case cJU_JPBRANCH_U:		   SMPREPBL(SMBranchU);
-
-// Common code (state-independent) for all cases of uncompressed branches:
-
-SMBranchU:
-	    Pjbu = P_JBU(Pjp->jp_Addr);
-	    Pjp	 = (Pjbu->jbu_jp) + digit;
-
-// Absent JP = null JP for current digit in Index:
-
-	    if (JPNULL(JU_JPTYPE(Pjp))) RET_SUCCESS;
-
-// Non-full JP matches current digit in Index:
-//
-// Iterate to the subsidiary JP.
-
-	    if (! JPFULL(Pjp)) goto SMGetContinue;
-
-// BranchU primary dead end:
-//
-// Upon hitting a full JP in a BranchU for the next digit in Index, search
-// sideways for a previous/next null or non-full JP.  BRANCHU_CHECKJP() is
-// shorthand for common code.
-//
-// Note:  The preceding code is separate from this loop because Index does not
-// need revising (see SET_AND_*()) if the initial index is an empty index.
-
-#define	BRANCHU_CHECKJP(OpIncDec,OpLeastDigits)			\
-	{							\
-	    OpIncDec Pjp;					\
-								\
-	    if (JPNULL(JU_JPTYPE(Pjp)))				\
-		SET_AND_RETURN(OpLeastDigits, digit, digits)	\
-								\
-	    if (! JPFULL(Pjp))					\
-		SET_AND_CONTINUE(OpLeastDigits, digit, digits)	\
-	}
-
-#ifdef JUDYPREV
-	    while (digit-- > 0)
-		BRANCHU_CHECKJP(--, SETLEASTDIGITS_D);
-#else
-	    while (++digit < cJU_BRANCHUNUMJPS)
-		BRANCHU_CHECKJP(++, CLEARLEASTDIGITS_D);
-#endif
-
-// BranchU secondary dead end, no non-full previous/next JP:
-
-	    SMRESTART(digits);
-
-
-// ----------------------------------------------------------------------------
-// LINEAR LEAF:
-//
-// Check Decode bytes, if any, in the current JP, then search the leaf for the
-// previous/next empty index starting at Index.  Primary leaf dead end is
-// hidden within j__udySearchLeaf*Empty*().  In case of secondary leaf dead
-// end, restart at the top of the tree.
-//
-// Note:  Pword is the name known to GET*; think of it as Pjlw.
-
-#define	SMLEAFL(cDigits,Func)                   \
-	Pword = (PWord_t) P_JLW(Pjp->jp_Addr);  \
-	pop0  = JU_JPLEAF_POP0(Pjp);            \
-	Func(Pword, pop0)
-
-#if (defined(JUDYL) || (! defined(JU_64BIT)))
-	case cJU_JPLEAF1:  CHECKDCD(1); SMLEAFL(1, j__udySearchLeafEmpty1);
-#endif
-	case cJU_JPLEAF2:  CHECKDCD(2); SMLEAFL(2, j__udySearchLeafEmpty2);
-	case cJU_JPLEAF3:  CHECKDCD(3); SMLEAFL(3, j__udySearchLeafEmpty3);
-
-#ifdef JU_64BIT
-	case cJU_JPLEAF4:  CHECKDCD(4); SMLEAFL(4, j__udySearchLeafEmpty4);
-	case cJU_JPLEAF5:  CHECKDCD(5); SMLEAFL(5, j__udySearchLeafEmpty5);
-	case cJU_JPLEAF6:  CHECKDCD(6); SMLEAFL(6, j__udySearchLeafEmpty6);
-	case cJU_JPLEAF7:  CHECKDCD(7); SMLEAFL(7, j__udySearchLeafEmpty7);
-#endif
-
-
-// ----------------------------------------------------------------------------
-// BITMAP LEAF:
-//
-// Check Decode bytes, if any, in the current JP, then search the leaf for the
-// previous/next empty index starting at Index.
-
-	case cJU_JPLEAF_B1:
-
-	    CHECKDCD(1);
-
-	    Pjlb	= P_JLB(Pjp->jp_Addr);
-	    digit	= JU_DIGITATSTATE(Index, 1);
-	    subexp	= digit / cJU_BITSPERSUBEXPL;
-	    bitposmaskL	= JU_BITPOSMASKL(digit);
-	    assert(subexp < cJU_NUMSUBEXPL);	// falls in expected range.
-
-// Absent index = no index matches current digit in Index:
-
-//	    if (! JU_BITMAPTESTL(Pjlb, digit))			// slower.
-	    if (! (JU_JLB_BITMAP(Pjlb, subexp) & bitposmaskL))	// faster.
-		RET_SUCCESS;
-
-// LeafB1 primary dead end:
-//
-// Upon hitting a valid (non-empty) index in a LeafB1 for the last digit in
-// Index, search sideways for a previous/next absent index, first in the
-// current bitmap subexpanse, then in lower/higher subexpanses.
-// LEAFB1_CHECKBIT() is shorthand for common code to handle one bit in one
-// bitmap subexpanse.
-//
-// Note:  The preceding code is separate from this loop because Index does not
-// need revising (see SET_AND_*()) if the initial index is an empty index.
-//
-// TBD:  For speed, shift bitposmaskL instead of using JU_BITMAPTESTL or
-// JU_BITPOSMASKL, but this shift has knowledge of bit order that really should
-// be encapsulated in a header file.
-
-#define	LEAFB1_CHECKBIT(OpLeastDigits)				\
-	if (! (JU_JLB_BITMAP(Pjlb, subexp) & bitposmaskL))	\
-	    SET_AND_RETURN(OpLeastDigits, digit, 1)
-
-#define	LEAFB1_STARTSUBEXP(OpLeastDigits)			\
-	if (! JU_JLB_BITMAP(Pjlb, subexp)) /* empty subexp */	\
-	    SET_AND_RETURN(OpLeastDigits, digit, 1)
-
-#ifdef JUDYPREV
-
-	    --digit;				// skip initial digit.
-	    bitposmaskL >>= 1;			// see TBD above.
-
-LeafB1NextSubexp:	// return here to check next bitmap subexpanse.
-
-	    while (bitposmaskL)			// more bits to check in subexp.
-	    {
-		LEAFB1_CHECKBIT(SETLEASTDIGITS_D);
-		assert(digit >= 0);
-		--digit;
-		bitposmaskL >>= 1;
-	    }
-
-	    if (subexp-- > 0)		// more subexpanses.
-	    {
-		LEAFB1_STARTSUBEXP(SETLEASTDIGITS_D);
-		bitposmaskL = ((Word_t)1U << (cJU_BITSPERSUBEXPL - 1));
-		goto LeafB1NextSubexp;
-	    }
-
-#else // JUDYNEXT
-
-	    ++digit;				// skip initial digit.
-	    bitposmaskL <<= 1;			// note:  BITMAPL_t.
-
-LeafB1NextSubexp:	// return here to check next bitmap subexpanse.
-
-	    while (bitposmaskL)			// more bits to check in subexp.
-	    {
-		LEAFB1_CHECKBIT(CLEARLEASTDIGITS_D);
-		assert(digit < cJU_SUBEXPPERSTATE);
-		++digit;
-		bitposmaskL <<= 1;		// note:  BITMAPL_t.
-	    }
-
-	    if (++subexp < cJU_NUMSUBEXPL)	// more subexpanses.
-	    {
-		LEAFB1_STARTSUBEXP(CLEARLEASTDIGITS_D);
-		bitposmaskL = 1;
-		goto LeafB1NextSubexp;
-	    }
-
-#endif // JUDYNEXT
-
-// LeafB1 secondary dead end, no empty index:
-
-	    SMRESTART(1);
-
-
-#ifdef JUDY1
-// ----------------------------------------------------------------------------
-// FULL POPULATION:
-//
-// If the Decode bytes do not match, Index is empty (without modification);
-// otherwise restart.
-
-	case cJ1_JPFULLPOPU1:
-
-	    CHECKDCD(1);
-	    SMRESTART(1);
-#endif
-
-
-// ----------------------------------------------------------------------------
-// IMMEDIATE:
-//
-// Pop1 = 1 Immediate JPs:
-//
-// If Index is not in the immediate JP, return success; otherwise check if
-// there is an empty index below/above the immediate JPs index, and if so,
-// return success with modified Index, else restart.
-//
-// Note:  Doug says its fast enough to calculate the index size (digits) in
-// the following; no need to set it separately for each case.
-
-	case cJU_JPIMMED_1_01:
-	case cJU_JPIMMED_2_01:
-	case cJU_JPIMMED_3_01:
-#ifdef JU_64BIT
-	case cJU_JPIMMED_4_01:
-	case cJU_JPIMMED_5_01:
-	case cJU_JPIMMED_6_01:
-	case cJU_JPIMMED_7_01:
-#endif
-	    if (JU_JPDCDPOP0(Pjp) != JU_TRIMTODCDSIZE(Index)) RET_SUCCESS;
-	    digits = JU_JPTYPE(Pjp) - cJU_JPIMMED_1_01 + 1;
-	    LEAF_EDGE(JU_LEASTBYTES(JU_JPDCDPOP0(Pjp), digits), digits);
-
-// Immediate JPs with Pop1 > 1:
-
-#define	IMM_MULTI(Func,BaseJPType)			\
-	JUDY1CODE(Pword = (PWord_t) (Pjp->jp_1Index);)	\
-	JUDYLCODE(Pword = (PWord_t) (Pjp->jp_LIndex);)	\
-	Func(Pword, JU_JPTYPE(Pjp) - (BaseJPType) + 1)
-
-	case cJU_JPIMMED_1_02:
-	case cJU_JPIMMED_1_03:
-#if (defined(JUDY1) || defined(JU_64BIT))
-	case cJU_JPIMMED_1_04:
-	case cJU_JPIMMED_1_05:
-	case cJU_JPIMMED_1_06:
-	case cJU_JPIMMED_1_07:
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-	case cJ1_JPIMMED_1_08:
-	case cJ1_JPIMMED_1_09:
-	case cJ1_JPIMMED_1_10:
-	case cJ1_JPIMMED_1_11:
-	case cJ1_JPIMMED_1_12:
-	case cJ1_JPIMMED_1_13:
-	case cJ1_JPIMMED_1_14:
-	case cJ1_JPIMMED_1_15:
-#endif
-	    IMM_MULTI(j__udySearchLeafEmpty1, cJU_JPIMMED_1_02);
-
-#if (defined(JUDY1) || defined(JU_64BIT))
-	case cJU_JPIMMED_2_02:
-	case cJU_JPIMMED_2_03:
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-	case cJ1_JPIMMED_2_04:
-	case cJ1_JPIMMED_2_05:
-	case cJ1_JPIMMED_2_06:
-	case cJ1_JPIMMED_2_07:
-#endif
-#if (defined(JUDY1) || defined(JU_64BIT))
-	    IMM_MULTI(j__udySearchLeafEmpty2, cJU_JPIMMED_2_02);
-#endif
-
-#if (defined(JUDY1) || defined(JU_64BIT))
-	case cJU_JPIMMED_3_02:
-#endif
-#if (defined(JUDY1) && defined(JU_64BIT))
-	case cJ1_JPIMMED_3_03:
-	case cJ1_JPIMMED_3_04:
-	case cJ1_JPIMMED_3_05:
-#endif
-#if (defined(JUDY1) || defined(JU_64BIT))
-	    IMM_MULTI(j__udySearchLeafEmpty3, cJU_JPIMMED_3_02);
-#endif
-
-#if (defined(JUDY1) && defined(JU_64BIT))
-	case cJ1_JPIMMED_4_02:
-	case cJ1_JPIMMED_4_03:
-	    IMM_MULTI(j__udySearchLeafEmpty4, cJ1_JPIMMED_4_02);
-
-	case cJ1_JPIMMED_5_02:
-	case cJ1_JPIMMED_5_03:
-	    IMM_MULTI(j__udySearchLeafEmpty5, cJ1_JPIMMED_5_02);
-
-	case cJ1_JPIMMED_6_02:
-	    IMM_MULTI(j__udySearchLeafEmpty6, cJ1_JPIMMED_6_02);
-
-	case cJ1_JPIMMED_7_02:
-	    IMM_MULTI(j__udySearchLeafEmpty7, cJ1_JPIMMED_7_02);
-#endif
-
-
-// ----------------------------------------------------------------------------
-// INVALID JP TYPE:
-
-	default: RET_CORRUPT;
-
-	} // SMGet switch.
-
-} // Judy1PrevEmpty() / Judy1NextEmpty() / JudyLPrevEmpty() / JudyLNextEmpty()
diff --git a/libs/klib/judy/JudyPrintJP.c b/libs/klib/judy/JudyPrintJP.c
deleted file mode 100644
index 3764da1..0000000
--- a/libs/klib/judy/JudyPrintJP.c
+++ /dev/null
@@ -1,399 +0,0 @@
-// Copyright (C) 2000 - 2002 Hewlett-Packard Company
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the term of the GNU Lesser 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 Lesser General Public License
-// for more details.
-//
-// You should have received a copy of the GNU Lesser 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
-// _________________
-
-// JudyPrintJP() debugging/tracing function for Judy1 or JudyL code.
-// The caller should #include this file, with its static function (replicated
-// in each compilation unit), in another *.c file, and compile with one of
-// -DJUDY1 or -DJUDYL.
-//
-// The caller can set j__udyIndex and/or j__udyPopulation non-zero to have
-// those values reported, and also to control trace-enabling (see below).
-//
-// Tracing is disabled by default unless one or both of two env parameters is
-// set (regardless of value).  If either value is set but null or evaluates to
-// zero, tracing is immediately enabled.  To disable tracing until a particular
-// j__udy*Index value is seen, set STARTINDEX=<hex-index> in the env.  To
-// disable it until a particular j__udy*Population value is seen, set
-// STARTPOP=<decimal-population> in the env.  Once either condition is met,
-// tracing "latches on".
-//
-// Example:
-//
-//      STARTPOP=0              // immediate tracing.
-//      STARTINDEX=f35430a8     // not until one of these is met.
-//      STARTPOP=1000000
-//
-// Note:  Trace-enabling does nothing unless the caller sets the appropriate
-// global variable non-zero.
-
-#if (! (defined(JUDY1) || defined(JUDYL)))
-#error:  One of -DJUDY1 or -DJUDYL must be specified.
-#endif
-
-#include <stdlib.h>             // for getenv() and strtoul().
-
-
-// GLOBALS FROM CALLER:
-//
-// Note:  This storage is declared once in each compilation unit that includes
-// this file, but the linker should merge all cases into single locations, but
-// ONLY if these are uninitialized, so ASSUME they are 0 to start.
-
-Word_t j__udyIndex;             // current Index itself, optional from caller.
-Word_t j__udyPopulation;        // Indexes in array, optional from caller.
-
-// Other globals:
-
-static Word_t startindex = 0;           // see usage below.
-static Word_t startpop   = 0;
-static bool_t enabled    = FALSE;       // by default, unless env params set.
-
-// Shorthand for announcing JP addresses, Desc (in context), and JP types:
-//
-// Note:  Width is at least one blank wider than any JP type name, and the line
-// is left unfinished.
-//
-// Note:  Use a format for address printing compatible with other tracing
-// facilities; in particular, %x not %lx, to truncate the "noisy" high part on
-// 64-bit systems.
-
-#define JPTYPE(Type)  printf("0x%lx %s %-17s", (Word_t) Pjp, Desc, Type)
-
-// Shorthands for announcing expanse populations from DcdPopO fields:
-
-#define POP0 printf("Pop1 = 0 ")
-#define POP1 printf("Pop1 = %ld ", (Word_t) ((JU_JPDCDPOP0(Pjp) &            0xff) + 1))
-#define POP2 printf("Pop1 = %ld ", (Word_t) ((JU_JPDCDPOP0(Pjp) &          0xffff) + 1))
-#define POP3 printf("Pop1 = %ld ", (Word_t) ((JU_JPDCDPOP0(Pjp) &        0xffffff) + 1))
-#ifdef JU_64BIT
-#define POP4 printf("Pop1 = %ld ", (Word_t) ((JU_JPDCDPOP0(Pjp) &       0xffffffff) + 1))
-#define POP5 printf("Pop1 = %ld ", (Word_t) ((JU_JPDCDPOP0(Pjp) &     0xffffffffff) + 1))
-#define POP6 printf("Pop1 = %ld ", (Word_t) ((JU_JPDCDPOP0(Pjp) &   0xffffffffffff) + 1))
-#define POP7 printf("Pop1 = %ld ", (Word_t) ((JU_JPDCDPOP0(Pjp) & 0xffffffffffffff) + 1))
-#endif
-
-// Shorthands for announcing populations of Immeds:
-//
-// Note:  Line up the small populations that often occur together, but beyond
-// that, dont worry about it because populations can get arbitrarily large.
-
-#define POP_1   printf("Pop1 =  1 ")
-#define POP_2   printf("Pop1 =  2 ")
-#define POP_3   printf("Pop1 =  3 ")
-#define POP_4   printf("Pop1 =  4 ")
-#define POP_5   printf("Pop1 =  5 ")
-#define POP_6   printf("Pop1 =  6 ")
-#define POP_7   printf("Pop1 =  7 ")
-#define POP_8   printf("Pop1 =  8 ")
-#define POP_9   printf("Pop1 =  8 ")
-#define POP_10  printf("Pop1 = 10 ")
-#define POP_11  printf("Pop1 = 11 ")
-#define POP_12  printf("Pop1 = 12 ")
-#define POP_13  printf("Pop1 = 13 ")
-#define POP_14  printf("Pop1 = 14 ")
-#define POP_15  printf("Pop1 = 15 ")
-
-// Shorthands for other announcements:
-
-#define NUMJPSL printf("NumJPs = %d ", P_JBL(Pjp->jp_Addr)->jbl_NumJPs)
-#define OOPS    printf("-- OOPS, invalid Type\n"); exit(1)
-
-// This is harder to compute:
-
-#define NUMJPSB                                                         \
-        {                                                               \
-            Pjbb_t Pjbb = P_JBB(Pjp->jp_Addr);                          \
-            Word_t subexp;                                              \
-            int    numJPs = 0;                                          \
-                                                                        \
-            for (subexp = 0; subexp < cJU_NUMSUBEXPB; ++subexp)         \
-                numJPs += j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, subexp));\
-                                                                        \
-            printf("NumJPs = %d ", numJPs);                             \
-        }
-
-
-// ****************************************************************************
-// J U D Y   P R I N T   J P
-//
-// Dump information about a JP, at least its address, type, population, and
-// number of JPs, as appropriate.  Error out upon any unexpected JP type.
-//
-// TBD:  Dump more detailed information about the JP?
-
-FUNCTION static void JudyPrintJP(
-        Pjp_t  Pjp,             // JP to describe.
-        char * Desc,            // brief description of caller, such as "i".
-        int    Line)            // callers source line number.
-{
-static  bool_t checked = FALSE; // set upon first entry and check for params.
-        char * value;           // for getenv().
-
-
-// CHECK FOR EXTERNAL ENABLING:
-//
-// If a parameter is set, report the value, even if it is null or otherwise
-// evaluates to zero, in which case enable tracing immediately; otherwise wait
-// for the value to be hit.
-
-#define GETENV(Name,Value,Base)                                 \
-        if ((value = getenv (Name)) != (char *) NULL)           \
-        {                                                       \
-            (Value) = strtoul (value, (char **) NULL, Base);    \
-            enabled |= ((Value) == 0);  /* see above */         \
-                                                                \
-            (void) printf ("JudyPrintJP(\"%s\"): $%s = %lu\n",  \
-                           Desc, Name, Value);                  \
-        }
-
-        if (! checked)  // only check once.
-        {
-            checked = TRUE;
-
-            GETENV ("STARTINDEX", startindex, 16);
-            GETENV ("STARTPOP",   startpop,   10);
-
-            (void) printf ("JudyPrintJP(\"%s\"): Tracing present %s\n", Desc,
-                           enabled ? "and immediately enabled" :
-                           (startindex || startpop) ?
-                           "but disabled until start condition met" :
-                           "but not enabled by env parameter");
-        }
-
-        if (! enabled)  // check repeatedly until latched enabled:
-        {
-            if (startindex && (startindex == j__udyIndex))
-            {
-                 (void) printf ("=== TRACING ENABLED (\"%s\"), "
-                                "startindex = 0x%lx\n", Desc, startindex);
-                 enabled = TRUE;
-            }
-            else if (startpop && (startpop == j__udyPopulation))
-            {
-                 (void) printf ("=== TRACING ENABLED (\"%s\"), "
-                                "startpop = %lu\n", Desc, startpop);
-                 enabled = TRUE;
-            }
-            else
-            {
-                return;         // print nothing this time.
-            }
-        }
-
-
-// SWITCH ON JP TYPE:
-
-        switch (JU_JPTYPE(Pjp))
-        {
-
-// Note:  The following COULD be merged more tightly between Judy1 and JudyL,
-// but we decided that the output should say cJ1*/cJL*, not cJU*, to be more
-// specific.
-
-#ifdef JUDY1
-        case cJ1_JPNULL1:       JPTYPE("cJ1_JPNULL1"); POP0;            break;
-        case cJ1_JPNULL2:       JPTYPE("cJ1_JPNULL2"); POP0;            break;
-        case cJ1_JPNULL3:       JPTYPE("cJ1_JPNULL3"); POP0;            break;
-#ifdef JU_64BIT
-        case cJ1_JPNULL4:       JPTYPE("cJ1_JPNULL4"); POP0;            break;
-        case cJ1_JPNULL5:       JPTYPE("cJ1_JPNULL5"); POP0;            break;
-        case cJ1_JPNULL6:       JPTYPE("cJ1_JPNULL6"); POP0;            break;
-        case cJ1_JPNULL7:       JPTYPE("cJ1_JPNULL7"); POP0;            break;
-#endif
-
-        case cJ1_JPBRANCH_L2:   JPTYPE("cJ1_JPBRANCH_L2"); POP2;NUMJPSL;break;
-        case cJ1_JPBRANCH_L3:   JPTYPE("cJ1_JPBRANCH_L3"); POP3;NUMJPSL;break;
-#ifdef JU_64BIT
-        case cJ1_JPBRANCH_L4:   JPTYPE("cJ1_JPBRANCH_L4"); POP4;NUMJPSL;break;
-        case cJ1_JPBRANCH_L5:   JPTYPE("cJ1_JPBRANCH_L5"); POP5;NUMJPSL;break;
-        case cJ1_JPBRANCH_L6:   JPTYPE("cJ1_JPBRANCH_L6"); POP6;NUMJPSL;break;
-        case cJ1_JPBRANCH_L7:   JPTYPE("cJ1_JPBRANCH_L7"); POP7;NUMJPSL;break;
-#endif
-        case cJ1_JPBRANCH_L:    JPTYPE("cJ1_JPBRANCH_L");       NUMJPSL;break;
-
-        case cJ1_JPBRANCH_B2:   JPTYPE("cJ1_JPBRANCH_B2"); POP2;NUMJPSB;break;
-        case cJ1_JPBRANCH_B3:   JPTYPE("cJ1_JPBRANCH_B3"); POP3;NUMJPSB;break;
-#ifdef JU_64BIT
-        case cJ1_JPBRANCH_B4:   JPTYPE("cJ1_JPBRANCH_B4"); POP4;NUMJPSB;break;
-        case cJ1_JPBRANCH_B5:   JPTYPE("cJ1_JPBRANCH_B5"); POP5;NUMJPSB;break;
-        case cJ1_JPBRANCH_B6:   JPTYPE("cJ1_JPBRANCH_B6"); POP6;NUMJPSB;break;
-        case cJ1_JPBRANCH_B7:   JPTYPE("cJ1_JPBRANCH_B7"); POP7;NUMJPSB;break;
-#endif
-        case cJ1_JPBRANCH_B:    JPTYPE("cJ1_JPBRANCH_B");       NUMJPSB;break;
-
-        case cJ1_JPBRANCH_U2:   JPTYPE("cJ1_JPBRANCH_U2"); POP2;        break;
-        case cJ1_JPBRANCH_U3:   JPTYPE("cJ1_JPBRANCH_U3"); POP3;        break;
-#ifdef JU_64BIT
-        case cJ1_JPBRANCH_U4:   JPTYPE("cJ1_JPBRANCH_U4"); POP4;        break;
-        case cJ1_JPBRANCH_U5:   JPTYPE("cJ1_JPBRANCH_U5"); POP5;        break;
-        case cJ1_JPBRANCH_U6:   JPTYPE("cJ1_JPBRANCH_U6"); POP6;        break;
-        case cJ1_JPBRANCH_U7:   JPTYPE("cJ1_JPBRANCH_U7"); POP7;        break;
-#endif
-        case cJ1_JPBRANCH_U:    JPTYPE("cJ1_JPBRANCH_U");               break;
-
-#ifndef JU_64BIT
-        case cJ1_JPLEAF1:       JPTYPE("cJ1_JPLEAF1"); POP1;            break;
-#endif
-        case cJ1_JPLEAF2:       JPTYPE("cJ1_JPLEAF2"); POP2;            break;
-        case cJ1_JPLEAF3:       JPTYPE("cJ1_JPLEAF3"); POP3;            break;
-#ifdef JU_64BIT
-        case cJ1_JPLEAF4:       JPTYPE("cJ1_JPLEAF4"); POP4;            break;
-        case cJ1_JPLEAF5:       JPTYPE("cJ1_JPLEAF5"); POP5;            break;
-        case cJ1_JPLEAF6:       JPTYPE("cJ1_JPLEAF6"); POP6;            break;
-        case cJ1_JPLEAF7:       JPTYPE("cJ1_JPLEAF7"); POP7;            break;
-#endif
-
-        case cJ1_JPLEAF_B1:     JPTYPE("cJ1_JPLEAF_B1");    POP1;       break;
-        case cJ1_JPFULLPOPU1:   JPTYPE("cJ1_JPFULLPOPU1");  POP1;       break;
-
-        case cJ1_JPIMMED_1_01:  JPTYPE("cJ1_JPIMMED_1_01"); POP_1;      break;
-        case cJ1_JPIMMED_2_01:  JPTYPE("cJ1_JPIMMED_2_01"); POP_1;      break;
-        case cJ1_JPIMMED_3_01:  JPTYPE("cJ1_JPIMMED_3_01"); POP_1;      break;
-#ifdef JU_64BIT
-        case cJ1_JPIMMED_4_01:  JPTYPE("cJ1_JPIMMED_4_01"); POP_1;      break;
-        case cJ1_JPIMMED_5_01:  JPTYPE("cJ1_JPIMMED_5_01"); POP_1;      break;
-        case cJ1_JPIMMED_6_01:  JPTYPE("cJ1_JPIMMED_6_01"); POP_1;      break;
-        case cJ1_JPIMMED_7_01:  JPTYPE("cJ1_JPIMMED_7_01"); POP_1;      break;
-#endif
-
-        case cJ1_JPIMMED_1_02:  JPTYPE("cJ1_JPIMMED_1_02"); POP_2;      break;
-        case cJ1_JPIMMED_1_03:  JPTYPE("cJ1_JPIMMED_1_03"); POP_3;      break;
-        case cJ1_JPIMMED_1_04:  JPTYPE("cJ1_JPIMMED_1_04"); POP_4;      break;
-        case cJ1_JPIMMED_1_05:  JPTYPE("cJ1_JPIMMED_1_05"); POP_5;      break;
-        case cJ1_JPIMMED_1_06:  JPTYPE("cJ1_JPIMMED_1_06"); POP_6;      break;
-        case cJ1_JPIMMED_1_07:  JPTYPE("cJ1_JPIMMED_1_07"); POP_7;      break;
-#ifdef JU_64BIT
-        case cJ1_JPIMMED_1_08:  JPTYPE("cJ1_JPIMMED_1_08"); POP_8;      break;
-        case cJ1_JPIMMED_1_09:  JPTYPE("cJ1_JPIMMED_1_09"); POP_9;      break;
-        case cJ1_JPIMMED_1_10:  JPTYPE("cJ1_JPIMMED_1_10"); POP_10;     break;
-        case cJ1_JPIMMED_1_11:  JPTYPE("cJ1_JPIMMED_1_11"); POP_11;     break;
-        case cJ1_JPIMMED_1_12:  JPTYPE("cJ1_JPIMMED_1_12"); POP_12;     break;
-        case cJ1_JPIMMED_1_13:  JPTYPE("cJ1_JPIMMED_1_13"); POP_13;     break;
-        case cJ1_JPIMMED_1_14:  JPTYPE("cJ1_JPIMMED_1_14"); POP_14;     break;
-        case cJ1_JPIMMED_1_15:  JPTYPE("cJ1_JPIMMED_1_15"); POP_15;     break;
-#endif
-        case cJ1_JPIMMED_2_02:  JPTYPE("cJ1_JPIMMED_2_02"); POP_2;      break;
-        case cJ1_JPIMMED_2_03:  JPTYPE("cJ1_JPIMMED_2_03"); POP_3;      break;
-#ifdef JU_64BIT
-        case cJ1_JPIMMED_2_04:  JPTYPE("cJ1_JPIMMED_2_04"); POP_4;      break;
-        case cJ1_JPIMMED_2_05:  JPTYPE("cJ1_JPIMMED_2_05"); POP_5;      break;
-        case cJ1_JPIMMED_2_06:  JPTYPE("cJ1_JPIMMED_2_06"); POP_6;      break;
-        case cJ1_JPIMMED_2_07:  JPTYPE("cJ1_JPIMMED_2_07"); POP_7;      break;
-#endif
-
-        case cJ1_JPIMMED_3_02:  JPTYPE("cJ1_JPIMMED_3_02"); POP_2;      break;
-#ifdef JU_64BIT
-        case cJ1_JPIMMED_3_03:  JPTYPE("cJ1_JPIMMED_3_03"); POP_3;      break;
-        case cJ1_JPIMMED_3_04:  JPTYPE("cJ1_JPIMMED_3_04"); POP_4;      break;
-        case cJ1_JPIMMED_3_05:  JPTYPE("cJ1_JPIMMED_3_05"); POP_5;      break;
-        case cJ1_JPIMMED_4_02:  JPTYPE("cJ1_JPIMMED_4_02"); POP_2;      break;
-        case cJ1_JPIMMED_4_03:  JPTYPE("cJ1_JPIMMED_4_03"); POP_3;      break;
-        case cJ1_JPIMMED_5_02:  JPTYPE("cJ1_JPIMMED_5_02"); POP_2;      break;
-        case cJ1_JPIMMED_5_03:  JPTYPE("cJ1_JPIMMED_5_03"); POP_3;      break;
-        case cJ1_JPIMMED_6_02:  JPTYPE("cJ1_JPIMMED_6_02"); POP_2;      break;
-        case cJ1_JPIMMED_7_02:  JPTYPE("cJ1_JPIMMED_7_02"); POP_2;      break;
-#endif
-        case cJ1_JPIMMED_CAP:   JPTYPE("cJ1_JPIMMED_CAP");              OOPS;
-
-#else // JUDYL ===============================================================
-
-        case cJL_JPNULL1:       JPTYPE("cJL_JPNULL1"); POP0;            break;
-        case cJL_JPNULL2:       JPTYPE("cJL_JPNULL2"); POP0;            break;
-        case cJL_JPNULL3:       JPTYPE("cJL_JPNULL3"); POP0;            break;
-#ifdef JU_64BIT
-        case cJL_JPNULL4:       JPTYPE("cJL_JPNULL4"); POP0;            break;
-        case cJL_JPNULL5:       JPTYPE("cJL_JPNULL5"); POP0;            break;
-        case cJL_JPNULL6:       JPTYPE("cJL_JPNULL6"); POP0;            break;
-        case cJL_JPNULL7:       JPTYPE("cJL_JPNULL7"); POP0;            break;
-#endif
-
-        case cJL_JPBRANCH_L2:   JPTYPE("cJL_JPBRANCH_L2"); POP2;NUMJPSL;break;
-        case cJL_JPBRANCH_L3:   JPTYPE("cJL_JPBRANCH_L3"); POP3;NUMJPSL;break;
-#ifdef JU_64BIT
-        case cJL_JPBRANCH_L4:   JPTYPE("cJL_JPBRANCH_L4"); POP4;NUMJPSL;break;
-        case cJL_JPBRANCH_L5:   JPTYPE("cJL_JPBRANCH_L5"); POP5;NUMJPSL;break;
-        case cJL_JPBRANCH_L6:   JPTYPE("cJL_JPBRANCH_L6"); POP6;NUMJPSL;break;
-        case cJL_JPBRANCH_L7:   JPTYPE("cJL_JPBRANCH_L7"); POP7;NUMJPSL;break;
-#endif
-        case cJL_JPBRANCH_L:    JPTYPE("cJL_JPBRANCH_L");       NUMJPSL;break;
-
-        case cJL_JPBRANCH_B2:   JPTYPE("cJL_JPBRANCH_B2"); POP2;NUMJPSB;break;
-        case cJL_JPBRANCH_B3:   JPTYPE("cJL_JPBRANCH_B3"); POP3;NUMJPSB;break;
-#ifdef JU_64BIT
-        case cJL_JPBRANCH_B4:   JPTYPE("cJL_JPBRANCH_B4"); POP4;NUMJPSB;break;
-        case cJL_JPBRANCH_B5:   JPTYPE("cJL_JPBRANCH_B5"); POP5;NUMJPSB;break;
-        case cJL_JPBRANCH_B6:   JPTYPE("cJL_JPBRANCH_B6"); POP6;NUMJPSB;break;
-        case cJL_JPBRANCH_B7:   JPTYPE("cJL_JPBRANCH_B7"); POP7;NUMJPSB;break;
-#endif
-        case cJL_JPBRANCH_B:    JPTYPE("cJL_JPBRANCH_B");       NUMJPSB;break;
-
-        case cJL_JPBRANCH_U2:   JPTYPE("cJL_JPBRANCH_U2"); POP2;        break;
-        case cJL_JPBRANCH_U3:   JPTYPE("cJL_JPBRANCH_U3"); POP3;        break;
-#ifdef JU_64BIT
-        case cJL_JPBRANCH_U4:   JPTYPE("cJL_JPBRANCH_U4"); POP4;        break;
-        case cJL_JPBRANCH_U5:   JPTYPE("cJL_JPBRANCH_U5"); POP5;        break;
-        case cJL_JPBRANCH_U6:   JPTYPE("cJL_JPBRANCH_U6"); POP6;        break;
-        case cJL_JPBRANCH_U7:   JPTYPE("cJL_JPBRANCH_U7"); POP7;        break;
-#endif
-        case cJL_JPBRANCH_U:    JPTYPE("cJL_JPBRANCH_U");               break;
-
-        case cJL_JPLEAF1:       JPTYPE("cJL_JPLEAF1"); POP1;            break;
-        case cJL_JPLEAF2:       JPTYPE("cJL_JPLEAF2"); POP2;            break;
-        case cJL_JPLEAF3:       JPTYPE("cJL_JPLEAF3"); POP3;            break;
-#ifdef JU_64BIT
-        case cJL_JPLEAF4:       JPTYPE("cJL_JPLEAF4"); POP4;            break;
-        case cJL_JPLEAF5:       JPTYPE("cJL_JPLEAF5"); POP5;            break;
-        case cJL_JPLEAF6:       JPTYPE("cJL_JPLEAF6"); POP6;            break;
-        case cJL_JPLEAF7:       JPTYPE("cJL_JPLEAF7"); POP7;            break;
-#endif
-
-        case cJL_JPLEAF_B1:     JPTYPE("cJL_JPLEAF_B1"); POP1;  break;
-
-        case cJL_JPIMMED_1_01:  JPTYPE("cJL_JPIMMED_1_01"); POP_1;      break;
-        case cJL_JPIMMED_2_01:  JPTYPE("cJL_JPIMMED_2_01"); POP_1;      break;
-        case cJL_JPIMMED_3_01:  JPTYPE("cJL_JPIMMED_3_01"); POP_1;      break;
-#ifdef JU_64BIT
-        case cJL_JPIMMED_4_01:  JPTYPE("cJL_JPIMMED_4_01"); POP_1;      break;
-        case cJL_JPIMMED_5_01:  JPTYPE("cJL_JPIMMED_5_01"); POP_1;      break;
-        case cJL_JPIMMED_6_01:  JPTYPE("cJL_JPIMMED_6_01"); POP_1;      break;
-        case cJL_JPIMMED_7_01:  JPTYPE("cJL_JPIMMED_7_01"); POP_1;      break;
-#endif
-
-        case cJL_JPIMMED_1_02:  JPTYPE("cJL_JPIMMED_1_02"); POP_2;      break;
-        case cJL_JPIMMED_1_03:  JPTYPE("cJL_JPIMMED_1_03"); POP_3;      break;
-#ifdef JU_64BIT
-        case cJL_JPIMMED_1_04:  JPTYPE("cJL_JPIMMED_1_04"); POP_4;      break;
-        case cJL_JPIMMED_1_05:  JPTYPE("cJL_JPIMMED_1_05"); POP_5;      break;
-        case cJL_JPIMMED_1_06:  JPTYPE("cJL_JPIMMED_1_06"); POP_6;      break;
-        case cJL_JPIMMED_1_07:  JPTYPE("cJL_JPIMMED_1_07"); POP_7;      break;
-        case cJL_JPIMMED_2_02:  JPTYPE("cJL_JPIMMED_2_02"); POP_2;      break;
-        case cJL_JPIMMED_2_03:  JPTYPE("cJL_JPIMMED_2_03"); POP_3;      break;
-        case cJL_JPIMMED_3_02:  JPTYPE("cJL_JPIMMED_3_02"); POP_2;      break;
-#endif
-        case cJL_JPIMMED_CAP:   JPTYPE("cJL_JPIMMED_CAP");      OOPS;
-
-#endif // JUDYL
-
-        default:  printf("Unknown Type = %d", JU_JPTYPE(Pjp));          OOPS;
-        }
-
-        if (j__udyIndex)        printf("Index = 0x%lx", j__udyIndex);
-        if (j__udyPopulation)   printf("Pop = %lu",     j__udyPopulation);
-
-        printf("line = %d\n", Line);
-
-} // JudyPrintJP()
diff --git a/libs/klib/judy/JudyPrivate.h b/libs/klib/judy/JudyPrivate.h
deleted file mode 100644
index 0d0c5f3..0000000
--- a/libs/klib/judy/JudyPrivate.h
+++ /dev/null
@@ -1,1610 +0,0 @@
-#ifndef _JUDYPRIVATE_INCLUDED
-#define _JUDYPRIVATE_INCLUDED
-// _________________
-//
-// Copyright (C) 2000 - 2002 Hewlett-Packard Company
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the term of the GNU Lesser 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 Lesser General Public License
-// for more details.
-//
-// You should have received a copy of the GNU Lesser 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
-// _________________
-
-// Header file for all Judy sources, for global but private (non-exported)
-// declarations.
-
-#include "Judy.h"
-
-// ****************************************************************************
-// A VERY BRIEF EXPLANATION OF A JUDY ARRAY
-//
-// A Judy array is, effectively, a digital tree (or Trie) with 256 element
-// branches (nodes), and with "compression tricks" applied to low-population
-// branches or leaves to save a lot of memory at the cost of relatively little
-// CPU time or cache fills.
-//
-// In the actual implementation, a Judy array is level-less, and traversing the
-// "tree" actually means following the states in a state machine (SM) as
-// directed by the Index.  A Judy array is referred to here as an "SM", rather
-// than as a "tree"; having "states", rather than "levels".
-//
-// Each branch or leaf in the SM decodes a portion ("digit") of the original
-// Index; with 256-way branches there are 8 bits per digit.  There are 3 kinds
-// of branches, called:  Linear, Bitmap and Uncompressed, of which the first 2
-// are compressed to contain no NULL entries.
-//
-// An Uncompressed branch has a 1.0 cache line fill cost to decode 8 bits of
-// (digit, part of an Index), but it might contain many NULL entries, and is
-// therefore inefficient with memory if lightly populated.
-//
-// A Linear branch has a ~1.75 cache line fill cost when at maximum population.
-// A Bitmap branch has ~2.0 cache line fills.  Linear and Bitmap branches are
-// converted to Uncompressed branches when the additional memory can be
-// amortized with larger populations.  Higher-state branches have higher
-// priority to be converted.
-//
-// Linear branches can hold 28 elements (based on detailed analysis) -- thus 28
-// expanses.  A Linear branch is converted to a Bitmap branch when the 29th
-// expanse is required.
-//
-// A Bitmap branch could hold 256 expanses, but is forced to convert to an
-// Uncompressed branch when 185 expanses are required.  Hopefully, it is
-// converted before that because of population growth (again, based on detailed
-// analysis and heuristics in the code).
-//
-// A path through the SM terminates to a leaf when the Index (or key)
-// population in the expanse below a pointer will fit into 1 or 2 cache lines
-// (~31..255 Indexes).  A maximum-population Leaf has ~1.5 cache line fill
-// cost.
-//
-// Leaves are sorted arrays of Indexes, where the Index Sizes (IS) are:  0, 1,
-// 8, 16, 24, 32, [40, 48, 56, 64] bits.  The IS depends on the "density"
-// (population/expanse) of the values in the Leaf.  Zero bits are possible if
-// population == expanse in the SM (that is, a full small expanse).
-//
-// Elements of a branches are called Judy Pointers (JPs).  Each JP object
-// points to the next object in the SM, plus, a JP can decode an additional
-// 2[6] bytes of an Index, but at the cost of "narrowing" the expanse
-// represented by the next object in the SM.  A "narrow" JP (one which has
-// decode bytes/digits) is a way of skipping states in the SM.
-//
-// Although counterintuitive, we think a Judy SM is optimal when the Leaves are
-// stored at MINIMUM compression (narrowing, or use of Decode bytes).  If more
-// aggressive compression was used, decompression of a leaf be required to
-// insert an index.  Additional compression would save a little memory but not
-// help performance significantly.
-
-
-#ifdef A_PICTURE_IS_WORTH_1000_WORDS
-*******************************************************************************
-
-JUDY 32-BIT STATE MACHINE (SM) EXAMPLE, FOR INDEX = 0x02040103
-
-The Index used in this example is purposely chosen to allow small, simple
-examples below; each 1-byte "digit" from the Index has a small numeric value
-that fits in one column.  In the drawing below:
-
-   JRP  == Judy Root Pointer;
-
-    C   == 1 byte of a 1..3 byte Population (count of Indexes) below this
-           pointer.  Since this is shared with the Decode field, the combined
-           sizes must be 3[7], that is, 1 word less 1 byte for the JP Type.
-
-   The 1-byte field jp_Type is represented as:
-
-   1..3 == Number of bytes in the population (Pop0) word of the Branch or Leaf
-           below the pointer (note:  1..7 on 64-bit); indicates:
-           - number of bytes in Decode field == 3 - this number;
-           - number of bytes remaining to decode.
-           Note:  The maximum is 3, not 4, because the 1st byte of the Index is
-           always decoded digitally in the top branch.
-   -B-  == JP points to a Branch (there are many kinds of Branches).
-   -L-  == JP points to a Leaf (there are many kinds of Leaves).
-
-   (2)  == Digit of Index decoded by position offset in branch (really
-           0..0xff).
-
-    4*  == Digit of Index necessary for decoding a "narrow" pointer, in a
-           Decode field; replaces 1 missing branch (really 0..0xff).
-
-    4+  == Digit of Index NOT necessary for decoding a "narrow" pointer, but
-           used for fast traversal of the SM by Judy1Test() and JudyLGet()
-           (see the code) (really 0..0xff).
-
-    0   == Byte in a JPs Pop0 field that is always ignored, because a leaf
-           can never contain more than 256 Indexes (Pop0 <= 255).
-
-    +-----  == A Branch or Leaf; drawn open-ended to remind you that it could
-    |          have up to 256 columns.
-    +-----
-
-    |
-    |   == Pointer to next Branch or Leaf.
-    V
-
-    |
-    O   == A state is skipped by using a "narrow" pointer.
-    |
-
-    < 1 > == Digit (Index) shown as an example is not necessarily in the
-             position shown; is sorted in order with neighbor Indexes.
-             (Really 0..0xff.)
-
-Note that this example shows every possibly topology to reach a leaf in a
-32-bit Judy SM, although this is a very subtle point!
-
-                                                                          STATE or`
-                                                                          LEVEL
-     +---+    +---+    +---+    +---+    +---+    +---+    +---+    +---+
-     |RJP|    |RJP|    |RJP|    |RJP|    |RJP|    |RJP|    |RJP|    |RJP|
-     L---+    B---+    B---+    B---+    B---+    B---+    B---+    B---+
-     |        |        |        |        |        |        |        |
-     |        |        |        |        |        |        |        |
-     V        V (2)    V (2)    V (2)    V (2)    V (2)    V (2)    V (2)
-     +------  +------  +------  +------  +------  +------  +------  +------
-Four |< 2 >   |  0     |  4*    |  C     |  4*    |  4*    |  C     |  C
-byte |< 4 >   |  0     |  0     |  C     |  1*    |  C     |  C     |  C     4
-Index|< 1 >   |  C     |  C     |  C     |  C     |  C     |  C     |  C
-Leaf |< 3 >   |  3     |  2     |  3     |  1     |  2     |  3     |  3
-     +------  +--L---  +--L---  +--B---  +--L---  +--B---  +--B---  +--B---
-                 |        |        |        |        |        |        |
-                /         |       /         |        |       /        /
-               /          |      /          |        |      /        /
-              |           |     |           |        |     |        |
-              V           |     V   (4)     |        |     V   (4)  V   (4)
-              +------     |     +------     |        |     +------  +------
-    Three     |< 4 >      |     |    4+     |        |     |    4+  |    4+
-    byte Index|< 1 >      O     |    0      O        O     |    1*  |    C   3
-    Leaf      |< 3 >      |     |    C      |        |     |    C   |    C
-              +------     |     |    2      |        |     |    1   |    2
-                         /      +----L-     |        |     +----L-  +----B-
-                        /            |      |        |          |        |
-                       |            /       |       /          /        /
-                       |           /        |      /          /        /
-                       |          /         |     |          /        /
-                       |         /          |     |         /        /
-                       |        |           |     |        |        |
-                       V        V           |     V(1)     |        V(1)
-                       +------  +------     |     +------  |        +------
-          Two byte     |< 1 >   |< 1 >      |     | 4+     |        | 4+
-          Index Leaf   |< 3 >   |< 3 >      O     | 1+     O        | 1+     2
-                       +------  +------    /      | C      |        | C
-                                          /       | 1      |        | 1
-                                         |        +-L----  |        +-L----
-                                         |          |      |          |
-                                         |         /       |         /
-                                         |        |        |        |
-                                         V        V        V        V
-                                         +------  +------  +------  +------
-                    One byte Index Leaf  |< 3 >   |< 3 >   |< 3 >   |< 3 >   1
-                                         +------  +------  +------  +------
-
-
-#endif // A_PICTURE_IS_WORTH_1000_WORDS
-
-
-// ****************************************************************************
-// MISCELLANEOUS GLOBALS:
-//
-// PLATFORM-SPECIFIC CONVENIENCE MACROS:
-//
-// These are derived from context (set by cc or in system header files) or
-// based on JU_<PLATFORM> macros from make_includes/platform.*.mk.  We decided
-// on 011018 that any macro reliably derivable from context (cc or headers) for
-// ALL platforms supported by Judy is based on that derivation, but ANY
-// exception means to stop using the external macro completely and derive from
-// JU_<PLATFORM> instead.
-
-// Other miscellaneous stuff:
-
-#ifndef _BOOL_T
-#define _BOOL_T
-typedef int bool_t;
-#endif
-
-#define FUNCTION                // null; easy to find functions.
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-#ifdef TRACE            // turn on all other tracing in the code:
-#define TRACEJP  1      // JP traversals in JudyIns.c and JudyDel.c.
-#define TRACEJPR 1      // JP traversals in retrieval code, JudyGet.c.
-#define TRACECF  1      // cache fills in JudyGet.c.
-#define TRACEMI  1      // malloc calls in JudyMallocIF.c.
-#define TRACEMF  1      // malloc calls at a lower level in JudyMalloc.c.
-#endif
-
-#ifndef inline
-    #define inline __inline__
-#endif
-
-// SUPPORT FOR DEBUG-ONLY CODE:
-//
-// By convention, use -DDEBUG to enable both debug-only code AND assertions in
-// the Judy sources.
-//
-// Invert the sense of assertions, so they are off unless explicitly requested,
-// in a uniform way.
-//
-// Note:  It is NOT appropriate to put this in Judy.h; it would mess up
-// application code.
-
-#ifndef DEBUG
-#define NDEBUG 1                // must be 1 for "#if".
-#endif
-
-// Shorthand notations to avoid #ifdefs for single-line conditional statements:
-//
-// Warning:  These cannot be used around compiler directives, such as
-// "#include", nor in the case where Code contains a comma other than nested
-// within parentheses or quotes.
-
-#define DBGCODE(Code)  /* nothing */
-
-#ifdef JUDY1
-#define JUDY1CODE(Code) Code
-#define JUDYLCODE(Code) // null.
-#endif
-
-#ifdef JUDYL
-#define JUDYLCODE(Code) Code
-#define JUDY1CODE(Code) // null.
-#endif
-
-#include <assert.h>
-
-// ****************************************************************************
-// FUNDAMENTAL CONSTANTS FOR MACHINE
-// ****************************************************************************
-
-// Machine (CPU) cache line size:
-//
-// NOTE:  A leaf size of 2 cache lines maximum is the target (optimal) for
-// Judy.  Its hard to obtain a machines cache line size at compile time, but
-// if the machine has an unexpected cache line size, its not devastating if
-// the following constants end up causing leaves that are 1 cache line in size,
-// or even 4 cache lines in size.  The assumed 32-bit system has 16-word =
-// 64-byte cache lines, and the assumed 64-bit system has 16-word = 128-byte
-// cache lines.
-
-#ifdef JU_64BIT
-#define cJU_BYTESPERCL 128              // cache line size in bytes.
-#else
-#define cJU_BYTESPERCL  64              // cache line size in bytes.
-#endif
-
-// Bits Per Byte:
-
-#define cJU_BITSPERBYTE 0x8
-
-// Bytes Per Word and Bits Per Word, latter assuming sizeof(byte) is 8 bits:
-//
-// Expect 32 [64] bits per word.
-
-#define cJU_BYTESPERWORD (sizeof(Word_t))
-#define cJU_BITSPERWORD  (sizeof(Word_t) * cJU_BITSPERBYTE)
-
-#define JU_BYTESTOWORDS(BYTES) \
-        (((BYTES) + cJU_BYTESPERWORD - 1) / cJU_BYTESPERWORD)
-
-// A word that is all-ones, normally equal to -1UL, but safer with ~0:
-
-#define cJU_ALLONES  (~ ( Word_t ) 0UL)
-
-// Note, these are forward references, but thats OK:
-
-#define cJU_FULLBITMAPB ((BITMAPB_t) cJU_ALLONES)
-#define cJU_FULLBITMAPL ((BITMAPL_t) cJU_ALLONES)
-
-
-// ****************************************************************************
-// MISCELLANEOUS JUDY-SPECIFIC DECLARATIONS
-// ****************************************************************************
-
-// ROOT STATE:
-//
-// State at the start of the Judy SM, based on 1 byte decoded per state; equal
-// to the number of bytes per Index to decode.
-
-#define cJU_ROOTSTATE (sizeof(Word_t))
-
-
-// SUBEXPANSES PER STATE:
-//
-// Number of subexpanses per state traversed, which is the number of JPs in a
-// branch (actual or theoretical) and the number of bits in a bitmap.
-
-#define cJU_SUBEXPPERSTATE  256
-
-
-// LEAF AND VALUE POINTERS:
-//
-// Some other basic object types are in declared in JudyPrivateBranch.h
-// (Pjbl_t, Pjbb_t, Pjbu_t, Pjp_t) or are Judy1/L-specific (Pjlb_t).  The
-// few remaining types are declared below.
-//
-// Note:  Leaf pointers are cast to different-sized objects depending on the
-// leafs level, but are at least addresses (not just numbers), so use void *
-// (Pvoid_t), not PWord_t or Word_t for them, except use Pjlw_t for whole-word
-// (top-level, root-level) leaves.  Value areas, however, are always whole
-// words.
-//
-// Furthermore, use Pjll_t only for generic leaf pointers (for various size
-// LeafLs).  Use Pjlw_t for LeafWs.  Use Pleaf (with type uint8_t *, uint16_t
-// *, etc) when the leaf index size is known.
-
-typedef PWord_t Pjlw_t;  // pointer to root-level leaf (whole-word indexes).
-typedef Pvoid_t Pjll_t;  // pointer to lower-level linear leaf.
-
-#ifdef JUDYL
-typedef PWord_t Pjv_t;   // pointer to JudyL value area.
-#endif
-
-
-// POINTER PREPARATION MACROS:
-//
-// These macros are used to strip malloc-namespace-type bits from a pointer +
-// malloc-type word (which references any Judy mallocd object that might be
-// obtained from other than a direct call of malloc()), prior to dereferencing
-// the pointer as an address.  The malloc-type bits allow Judy mallocd objects
-// to come from different "malloc() namespaces".
-//
-//    (root pointer)    (JRP, see above)
-//    jp.jp_Addr        generic pointer to next-level node, except when used
-//                      as a JudyL Immed01 value area
-//    JU_JBB_PJP        macro hides jbbs_Pjp (pointer to JP subarray)
-//    JL_JLB_PVALUE     macro hides jLlbs_PValue (pointer to value subarray)
-//
-// When setting one of these fields or passing an address to j__udyFree*(), the
-// "raw" memory address is used; otherwise the memory address must be passed
-// through one of the macros below before its dereferenced.
-//
-// Note:  After much study, the typecasts below appear in the macros rather
-// than at the point of use, which is both simpler and allows the compiler to
-// do type-checking.
-
-
-#define P_JLW(  ADDR) ((Pjlw_t) (ADDR))  // root leaf.
-#define P_JPM(  ADDR) ((Pjpm_t) (ADDR))  // root JPM.
-#define P_JBL(  ADDR) ((Pjbl_t) (ADDR))  // BranchL.
-#define P_JBB(  ADDR) ((Pjbb_t) (ADDR))  // BranchB.
-#define P_JBU(  ADDR) ((Pjbu_t) (ADDR))  // BranchU.
-#define P_JLL(  ADDR) ((Pjll_t) (ADDR))  // LeafL.
-#define P_JLB(  ADDR) ((Pjlb_t) (ADDR))  // LeafB1.
-#define P_JP(   ADDR) ((Pjp_t)  (ADDR))  // JP.
-
-#ifdef JUDYL
-#define P_JV(   ADDR) ((Pjv_t)  (ADDR))  // &value.
-#endif
-
-
-// LEAST BYTES:
-//
-// Mask for least bytes of a word, and a macro to perform this mask on an
-// Index.
-//
-// Note:  This macro has been problematic in the past to get right and to make
-// portable.  Its not OK on all systems to shift by the full word size.  This
-// macro should allow shifting by 1..N bytes, where N is the word size, but
-// should produce a compiler warning if the macro is called with Bytes == 0.
-//
-// Warning:  JU_LEASTBYTESMASK() is not a constant macro unless Bytes is a
-// constant; otherwise it is a variable shift, which is expensive on some
-// processors.
-
-#define JU_LEASTBYTESMASK(BYTES) \
-        (((Word_t)0x100 << (cJU_BITSPERBYTE * ((BYTES) - 1))) - 1)
-
-#define JU_LEASTBYTES(INDEX,BYTES)  ((INDEX) & JU_LEASTBYTESMASK(BYTES))
-
-
-// BITS IN EACH BITMAP SUBEXPANSE FOR BITMAP BRANCH AND LEAF:
-//
-// The bits per bitmap subexpanse times the number of subexpanses equals a
-// constant (cJU_SUBEXPPERSTATE).  You can also think of this as a compile-time
-// choice of "aspect ratio" for bitmap branches and leaves (which can be set
-// independently for each).
-//
-// A default aspect ratio is hardwired here if not overridden at compile time,
-// such as by "EXTCCOPTS=-DBITMAP_BRANCH16x16 make".
-
-#if (! (defined(BITMAP_BRANCH8x32) || defined(BITMAP_BRANCH16x16) || defined(BITMAP_BRANCH32x8)))
-#define BITMAP_BRANCH32x8 1     // 32 bits per subexpanse, 8 subexpanses.
-#endif
-
-#ifdef BITMAP_BRANCH8x32
-#define BITMAPB_t uint8_t
-#endif
-
-#ifdef BITMAP_BRANCH16x16
-#define BITMAPB_t uint16_t
-#endif
-
-#ifdef BITMAP_BRANCH32x8
-#define BITMAPB_t uint32_t
-#endif
-
-// Note:  For bitmap leaves, BITMAP_LEAF64x4 is only valid for 64 bit:
-//
-// Note:  Choice of aspect ratio mostly matters for JudyL bitmap leaves.  For
-// Judy1 the choice doesnt matter much -- the code generated for different
-// BITMAP_LEAF* values choices varies, but correctness and performance are the
-// same.
-
-#ifndef JU_64BIT
-
-#if (! (defined(BITMAP_LEAF8x32) || defined(BITMAP_LEAF16x16) || defined(BITMAP_LEAF32x8)))
-#define BITMAP_LEAF32x8         // 32 bits per subexpanse, 8 subexpanses.
-#endif
-
-#else // 32BIT
-
-#if (! (defined(BITMAP_LEAF8x32) || defined(BITMAP_LEAF16x16) || defined(BITMAP_LEAF32x8) || defined(BITMAP_LEAF64x4)))
-#define BITMAP_LEAF64x4         // 64 bits per subexpanse, 4 subexpanses.
-
-#endif
-#endif // JU_64BIT
-
-#ifdef BITMAP_LEAF8x32
-#define BITMAPL_t uint8_t
-#endif
-
-#ifdef BITMAP_LEAF16x16
-#define BITMAPL_t uint16_t
-#endif
-
-#ifdef BITMAP_LEAF32x8
-#define BITMAPL_t uint32_t
-#endif
-
-#ifdef BITMAP_LEAF64x4
-#define BITMAPL_t uint64_t
-#endif
-
-
-// EXPORTED DATA AND FUNCTIONS:
-
-#ifdef JUDY1
-extern const uint8_t j__1_BranchBJPPopToWords[];
-#endif
-
-#ifdef JUDYL
-extern const uint8_t j__L_BranchBJPPopToWords[];
-#endif
-
-// Fast LeafL search routine used for inlined code:
-
-#if (! defined(SEARCH_BINARY)) || (! defined(SEARCH_LINEAR))
-// default a binary search leaf method
-#define SEARCH_BINARY 1
-//#define SEARCH_LINEAR 1
-#endif
-
-#ifdef SEARCH_LINEAR
-
-#define SEARCHLEAFNATIVE(LEAFTYPE,ADDR,POP1,INDEX)              \
-    LEAFTYPE *P_leaf = (LEAFTYPE *)(ADDR);                      \
-    LEAFTYPE  I_ndex = (INDEX); /* with masking */              \
-    if (I_ndex > P_leaf[(POP1) - 1]) return(~(POP1));           \
-    while(I_ndex > *P_leaf) P_leaf++;                           \
-    if (I_ndex == *P_leaf) return(P_leaf - (LEAFTYPE *)(ADDR)); \
-    return(~(P_leaf - (LEAFTYPE *)(ADDR)));
-
-
-#define SEARCHLEAFNONNAT(ADDR,POP1,INDEX,LFBTS,COPYINDEX)       \
-{                                                               \
-    uint8_t *P_leaf, *P_leafEnd;                                \
-    Word_t   i_ndex;                                            \
-    Word_t   I_ndex = JU_LEASTBYTES((INDEX), (LFBTS));          \
-    Word_t   p_op1;                                             \
-                                                                \
-    P_leaf    = (uint8_t *)(ADDR);                              \
-    P_leafEnd = P_leaf + ((POP1) * (LFBTS));                    \
-                                                                \
-    do {                                                        \
-        JU_COPY3_PINDEX_TO_LONG(i_ndex, P_leaf);                \
-        if (I_ndex <= i_ndex) break;                            \
-        P_leaf += (LFBTS);                                      \
-    } while (P_leaf < P_leafEnd);                               \
-                                                                \
-    p_op1 = (P_leaf - (uint8_t *) (ADDR)) / (LFBTS);            \
-    if (I_ndex == i_ndex) return(p_op1);                        \
-    return(~p_op1);                                             \
-}
-#endif // SEARCH_LINEAR
-
-#ifdef SEARCH_BINARY
-
-#define SEARCHLEAFNATIVE(LEAFTYPE,ADDR,POP1,INDEX)              \
-    LEAFTYPE *P_leaf = (LEAFTYPE *)(ADDR);                      \
-    LEAFTYPE I_ndex = (LEAFTYPE)INDEX; /* truncate hi bits */   \
-    Word_t   l_ow   = cJU_ALLONES;                              \
-    Word_t   m_id;                                              \
-    Word_t   h_igh  = POP1;                                     \
-                                                                \
-    while ((h_igh - l_ow) > 1UL)                                \
-    {                                                           \
-        m_id = (h_igh + l_ow) / 2;                              \
-        if (P_leaf[m_id] > I_ndex)                              \
-            h_igh = m_id;                                       \
-        else                                                    \
-            l_ow = m_id;                                        \
-    }                                                           \
-    if (l_ow == cJU_ALLONES || P_leaf[l_ow] != I_ndex)          \
-        return(~h_igh);                                         \
-    return(l_ow)
-
-
-#define SEARCHLEAFNONNAT(ADDR,POP1,INDEX,LFBTS,COPYINDEX)       \
-    uint8_t *P_leaf = (uint8_t *)(ADDR);                        \
-    Word_t   l_ow   = cJU_ALLONES;                              \
-    Word_t   m_id;                                              \
-    Word_t   h_igh  = POP1;                                     \
-    Word_t   I_ndex = JU_LEASTBYTES((INDEX), (LFBTS));          \
-    Word_t   i_ndex;                                            \
-                                                                \
-    I_ndex = JU_LEASTBYTES((INDEX), (LFBTS));                   \
-                                                                \
-    while ((h_igh - l_ow) > 1UL)                                \
-    {                                                           \
-        m_id = (h_igh + l_ow) / 2;                              \
-        COPYINDEX(i_ndex, &P_leaf[m_id * (LFBTS)]);             \
-        if (i_ndex > I_ndex)                                    \
-            h_igh = m_id;                                       \
-        else                                                    \
-            l_ow = m_id;                                        \
-    }                                                           \
-    if (l_ow == cJU_ALLONES) return(~h_igh);                    \
-                                                                \
-    COPYINDEX(i_ndex, &P_leaf[l_ow * (LFBTS)]);                 \
-    if (i_ndex != I_ndex) return(~h_igh);                       \
-    return(l_ow)
-
-#endif // SEARCH_BINARY
-
-// Fast way to count bits set in 8..32[64]-bit int:
-//
-// For performance, j__udyCountBits*() are written to take advantage of
-// platform-specific features where available.
-//
-
-#ifdef JU_NOINLINE
-
-extern BITMAPB_t j__udyCountBitsB(BITMAPB_t word);
-extern BITMAPL_t j__udyCountBitsL(BITMAPL_t word);
-
-// Compiler supports inline
-
-#elif  defined(JU_HPUX_IPF)
-
-#define j__udyCountBitsB(WORD)  _Asm_popcnt(WORD)
-#define j__udyCountBitsL(WORD)  _Asm_popcnt(WORD)
-
-#elif defined(JU_LINUX_IPF)
-
-static inline BITMAPB_t j__udyCountBitsB(BITMAPB_t word)
-{
-        BITMAPB_t result;
-        __asm__ ("popcnt %0=%1" : "=r" (result) : "r" (word));
-        return(result);
-}
-
-static inline BITMAPL_t j__udyCountBitsL(BITMAPL_t word)
-{
-        BITMAPL_t result;
-        __asm__ ("popcnt %0=%1" : "=r" (result) : "r" (word));
-        return(result);
-}
-
-
-#else // No instructions available, use inline code
-
-// ****************************************************************************
-// __ J U D Y   C O U N T   B I T S   B
-//
-// Return the number of bits set in "Word", for a bitmap branch.
-//
-// Note:  Bitmap branches have maximum bitmap size = 32 bits.
-
-#ifdef JU_WIN
-static __inline BITMAPB_t j__udyCountBitsB(BITMAPB_t word)
-#else
-static inline BITMAPB_t j__udyCountBitsB(BITMAPB_t word)
-#endif 
-{
-        word = (word & 0x55555555) + ((word & 0xAAAAAAAA) >>  1);
-        word = (word & 0x33333333) + ((word & 0xCCCCCCCC) >>  2);
-        word = (word & 0x0F0F0F0F) + ((word & 0xF0F0F0F0) >>  4); // >= 8 bits.
-#if defined(BITMAP_BRANCH16x16) || defined(BITMAP_BRANCH32x8)
-        word = (word & 0x00FF00FF) + ((word & 0xFF00FF00) >>  8); // >= 16 bits.
-#endif
-
-#ifdef BITMAP_BRANCH32x8
-        word = (word & 0x0000FFFF) + ((word & 0xFFFF0000) >> 16); // >= 32 bits.
-#endif
-        return(word);
-
-} // j__udyCountBitsB()
-
-
-// ****************************************************************************
-// __ J U D Y   C O U N T   B I T S   L
-//
-// Return the number of bits set in "Word", for a bitmap leaf.
-//
-// Note:  Bitmap branches have maximum bitmap size = 32 bits.
-
-// Note:  Need both 32-bit and 64-bit versions of j__udyCountBitsL() because
-// bitmap leaves can have 64-bit bitmaps.
-
-#ifdef JU_WIN
-static __inline BITMAPL_t j__udyCountBitsL(BITMAPL_t word)
-#else
-static inline BITMAPL_t j__udyCountBitsL(BITMAPL_t word)
-#endif
-{
-#ifndef JU_64BIT
-
-        word = (word & 0x55555555) + ((word & 0xAAAAAAAA) >>  1);
-        word = (word & 0x33333333) + ((word & 0xCCCCCCCC) >>  2);
-        word = (word & 0x0F0F0F0F) + ((word & 0xF0F0F0F0) >>  4); // >= 8 bits.
-#if defined(BITMAP_LEAF16x16) || defined(BITMAP_LEAF32x8)
-        word = (word & 0x00FF00FF) + ((word & 0xFF00FF00) >>  8); // >= 16 bits.
-#endif
-#ifdef BITMAP_LEAF32x8
-        word = (word & 0x0000FFFF) + ((word & 0xFFFF0000) >> 16); // >= 32 bits.
-#endif
-
-#else // JU_64BIT
-
-        word = (word & 0x5555555555555555) + ((word & 0xAAAAAAAAAAAAAAAA) >> 1);
-        word = (word & 0x3333333333333333) + ((word & 0xCCCCCCCCCCCCCCCC) >> 2);
-        word = (word & 0x0F0F0F0F0F0F0F0F) + ((word & 0xF0F0F0F0F0F0F0F0) >> 4);
-#if defined(BITMAP_LEAF16x16) || defined(BITMAP_LEAF32x8) || defined(BITMAP_LEAF64x4)
-        word = (word & 0x00FF00FF00FF00FF) + ((word & 0xFF00FF00FF00FF00) >> 8);
-#endif
-#if defined(BITMAP_LEAF32x8) || defined(BITMAP_LEAF64x4)
-        word = (word & 0x0000FFFF0000FFFF) + ((word & 0xFFFF0000FFFF0000) >>16);
-#endif
-#ifdef BITMAP_LEAF64x4
-        word = (word & 0x00000000FFFFFFFF) + ((word & 0xFFFFFFFF00000000) >>32);
-#endif
-#endif // JU_64BIT
-
-        return(word);
-
-} // j__udyCountBitsL()
-
-#endif // Compiler supports inline
-
-// GET POP0:
-//
-// Get from jp_DcdPopO the Pop0 for various JP Types.
-//
-// Notes:
-//
-// - Different macros require different parameters...
-//
-// - There are no simple macros for cJU_BRANCH* Types because their
-//   populations must be added up and dont reside in an already-calculated
-//   place.  (TBD:  This is no longer true, now its in the JPM.)
-//
-// - cJU_JPIMM_POP0() is not defined because it would be redundant because the
-//   Pop1 is already encoded in each enum name.
-//
-// - A linear or bitmap leaf Pop0 cannot exceed cJU_SUBEXPPERSTATE - 1 (Pop0 =
-//   0..255), so use a simpler, faster macro for it than for other JP Types.
-//
-// - Avoid any complex calculations that would slow down the compiled code.
-//   Assume these macros are only called for the appropriate JP Types.
-//   Unfortunately theres no way to trigger an assertion here if the JP type
-//   is incorrect for the macro, because these are merely expressions, not
-//   statements.
-
-#define  JU_LEAFW_POP0(JRP)                  (*P_JLW(JRP))
-#define cJU_JPFULLPOPU1_POP0                 (cJU_SUBEXPPERSTATE - 1)
-
-// GET JP Type:
-// Since bit fields greater than 32 bits are not supported in some compilers
-// the jp_DcdPopO field is expanded to include the jp_Type in the high 8 bits
-// of the Word_t.
-// First the read macro:
-
-#define JU_JPTYPE(PJP)          ((PJP)->jp_Type)
-
-#define JU_JPLEAF_POP0(PJP)     ((PJP)->jp_DcdP0[sizeof(Word_t) - 2])
-
-#ifdef JU_64BIT
-
-#define JU_JPDCDPOP0(PJP)               \
-    ((Word_t)(PJP)->jp_DcdP0[0] << 48 | \
-     (Word_t)(PJP)->jp_DcdP0[1] << 40 | \
-     (Word_t)(PJP)->jp_DcdP0[2] << 32 | \
-     (Word_t)(PJP)->jp_DcdP0[3] << 24 | \
-     (Word_t)(PJP)->jp_DcdP0[4] << 16 | \
-     (Word_t)(PJP)->jp_DcdP0[5] <<  8 | \
-     (Word_t)(PJP)->jp_DcdP0[6])
-
-
-#define JU_JPSETADT(PJP,ADDR,DCDPOP0,TYPE)                      \
-{                                                               \
-    (PJP)->jp_Addr     = (ADDR);                                \
-    (PJP)->jp_DcdP0[0] = (uint8_t)((Word_t)(DCDPOP0) >> 48);    \
-    (PJP)->jp_DcdP0[1] = (uint8_t)((Word_t)(DCDPOP0) >> 40);    \
-    (PJP)->jp_DcdP0[2] = (uint8_t)((Word_t)(DCDPOP0) >> 32);    \
-    (PJP)->jp_DcdP0[3] = (uint8_t)((Word_t)(DCDPOP0) >> 24);    \
-    (PJP)->jp_DcdP0[4] = (uint8_t)((Word_t)(DCDPOP0) >> 16);    \
-    (PJP)->jp_DcdP0[5] = (uint8_t)((Word_t)(DCDPOP0) >>  8);    \
-    (PJP)->jp_DcdP0[6] = (uint8_t)((Word_t)(DCDPOP0));          \
-    (PJP)->jp_Type     = (TYPE);                                \
-}
-
-#else   // 32 Bit
-
-#define JU_JPDCDPOP0(PJP)               \
-    ((Word_t)(PJP)->jp_DcdP0[0] << 16 | \
-     (Word_t)(PJP)->jp_DcdP0[1] <<  8 | \
-     (Word_t)(PJP)->jp_DcdP0[2])
-
-
-#define JU_JPSETADT(PJP,ADDR,DCDPOP0,TYPE)                      \
-{                                                               \
-    (PJP)->jp_Addr     = (ADDR);                                \
-    (PJP)->jp_DcdP0[0] = (uint8_t)((Word_t)(DCDPOP0) >> 16);    \
-    (PJP)->jp_DcdP0[1] = (uint8_t)((Word_t)(DCDPOP0) >>  8);    \
-    (PJP)->jp_DcdP0[2] = (uint8_t)((Word_t)(DCDPOP0));          \
-    (PJP)->jp_Type     = (TYPE);                                \
-}
-
-#endif  // 32 Bit
-
-// NUMBER OF BITS IN A BRANCH OR LEAF BITMAP AND SUBEXPANSE:
-//
-// Note:  cJU_BITSPERBITMAP must be the same as the number of JPs in a branch.
-
-#define cJU_BITSPERBITMAP cJU_SUBEXPPERSTATE
-
-// Bitmaps are accessed in units of "subexpanses":
-
-#define cJU_BITSPERSUBEXPB  (sizeof(BITMAPB_t) * cJU_BITSPERBYTE)
-#define cJU_NUMSUBEXPB      (cJU_BITSPERBITMAP / cJU_BITSPERSUBEXPB)
-
-#define cJU_BITSPERSUBEXPL  (sizeof(BITMAPL_t) * cJU_BITSPERBYTE)
-#define cJU_NUMSUBEXPL      (cJU_BITSPERBITMAP / cJU_BITSPERSUBEXPL)
-
-
-// MASK FOR A SPECIFIED BIT IN A BITMAP:
-//
-// Warning:  If BitNum is a variable, this results in a variable shift that is
-// expensive, at least on some processors.  Use with caution.
-//
-// Warning:  BitNum must be less than cJU_BITSPERWORD, that is, 0 ..
-// cJU_BITSPERWORD - 1, to avoid a truncated shift on some machines.
-//
-// TBD:  Perhaps use an array[32] of masks instead of calculating them.
-
-#define JU_BITPOSMASKB(BITNUM) ((Word_t)1 << ((BITNUM) % cJU_BITSPERSUBEXPB))
-#define JU_BITPOSMASKL(BITNUM) ((Word_t)1 << ((BITNUM) % cJU_BITSPERSUBEXPL))
-
-
-// TEST/SET/CLEAR A BIT IN A BITMAP LEAF:
-//
-// Test if a byte-sized Digit (portion of Index) has a corresponding bit set in
-// a bitmap, or set a byte-sized Digits bit into a bitmap, by looking up the
-// correct subexpanse and then checking/setting the correct bit.
-//
-// Note:  Mask higher bits, if any, for the convenience of the user of this
-// macro, in case they pass a full Index, not just a digit.  If the caller has
-// a true 8-bit digit, make it of type uint8_t and the compiler should skip the
-// unnecessary mask step.
-
-#define JU_SUBEXPL(DIGIT) (((DIGIT) / cJU_BITSPERSUBEXPL) & (cJU_NUMSUBEXPL-1))
-
-#define JU_BITMAPTESTL(PJLB, INDEX)  \
-    (JU_JLB_BITMAP(PJLB, JU_SUBEXPL(INDEX)) &  JU_BITPOSMASKL(INDEX))
-
-#define JU_BITMAPSETL(PJLB, INDEX)   \
-    (JU_JLB_BITMAP(PJLB, JU_SUBEXPL(INDEX)) |= JU_BITPOSMASKL(INDEX))
-
-#define JU_BITMAPCLEARL(PJLB, INDEX) \
-    (JU_JLB_BITMAP(PJLB, JU_SUBEXPL(INDEX)) ^= JU_BITPOSMASKL(INDEX))
-
-
-// MAP BITMAP BIT OFFSET TO DIGIT:
-//
-// Given a digit variable to set, a bitmap branch or leaf subexpanse (base 0),
-// the bitmap (BITMAP*_t) for that subexpanse, and an offset (Nth set bit in
-// the bitmap, base 0), compute the digit (also base 0) corresponding to the
-// subexpanse and offset by counting all bits in the bitmap until offset+1 set
-// bits are seen.  Avoid expensive variable shifts.  Offset should be less than
-// the number of set bits in the bitmap; assert this.
-//
-// If theres a better way to do this, I dont know what it is.
-
-#define JU_BITMAPDIGITB(DIGIT,SUBEXP,BITMAP,OFFSET)             \
-        {                                                       \
-            BITMAPB_t bitmap = (BITMAP); int remain = (OFFSET); \
-            (DIGIT) = (SUBEXP) * cJU_BITSPERSUBEXPB;            \
-                                                                \
-            while ((remain -= (bitmap & 1)) >= 0)               \
-            {                                                   \
-                bitmap >>= 1; ++(DIGIT);                        \
-                assert((DIGIT) < ((SUBEXP) + 1) * cJU_BITSPERSUBEXPB); \
-            }                                                   \
-        }
-
-#define JU_BITMAPDIGITL(DIGIT,SUBEXP,BITMAP,OFFSET)             \
-        {                                                       \
-            BITMAPL_t bitmap = (BITMAP); int remain = (OFFSET); \
-            (DIGIT) = (SUBEXP) * cJU_BITSPERSUBEXPL;            \
-                                                                \
-            while ((remain -= (bitmap & 1)) >= 0)               \
-            {                                                   \
-                bitmap >>= 1; ++(DIGIT);                        \
-                assert((DIGIT) < ((SUBEXP) + 1) * cJU_BITSPERSUBEXPL); \
-            }                                                   \
-        }
-
-
-// MASKS FOR PORTIONS OF 32-BIT WORDS:
-//
-// These are useful for bitmap subexpanses.
-//
-// "LOWER"/"HIGHER" means bits representing lower/higher-valued Indexes.  The
-// exact order of bits in the word is explicit here but is hidden from the
-// caller.
-//
-// "EXC" means exclusive of the specified bit; "INC" means inclusive.
-//
-// In each case, BitPos is either "JU_BITPOSMASK*(BitNum)", or a variable saved
-// from an earlier call of that macro; either way, it must be a 32-bit word
-// with a single bit set.  In the first case, assume the compiler is smart
-// enough to optimize out common subexpressions.
-//
-// The expressions depend on unsigned decimal math that should be universal.
-
-#define JU_MASKLOWEREXC( BITPOS)  ((BITPOS) - 1)
-#define JU_MASKLOWERINC( BITPOS)  (JU_MASKLOWEREXC(BITPOS) | (BITPOS))
-#define JU_MASKHIGHERINC(BITPOS)  (-(BITPOS))
-#define JU_MASKHIGHEREXC(BITPOS)  (JU_MASKHIGHERINC(BITPOS) ^ (BITPOS))
-
-
-// ****************************************************************************
-// SUPPORT FOR NATIVE INDEX SIZES
-// ****************************************************************************
-//
-// Copy a series of generic objects (uint8_t, uint16_t, uint32_t, Word_t) from
-// one place to another.
-
-#define JU_COPYMEM(PDST,PSRC,POP1)                      \
-    {                                                   \
-        Word_t i_ndex = 0;                              \
-        assert((POP1) > 0);                             \
-        do { (PDST)[i_ndex] = (PSRC)[i_ndex]; } \
-        while (++i_ndex < (POP1));                      \
-    }
-
-
-// ****************************************************************************
-// SUPPORT FOR NON-NATIVE INDEX SIZES
-// ****************************************************************************
-//
-// Copy a 3-byte Index pointed by a uint8_t * to a Word_t:
-//
-#define JU_COPY3_PINDEX_TO_LONG(DESTLONG,PINDEX)        \
-    DESTLONG  = (Word_t)(PINDEX)[0] << 16;              \
-    DESTLONG += (Word_t)(PINDEX)[1] <<  8;              \
-    DESTLONG += (Word_t)(PINDEX)[2]
-
-// Copy a Word_t to a 3-byte Index pointed at by a uint8_t *:
-
-#define JU_COPY3_LONG_TO_PINDEX(PINDEX,SOURCELONG)      \
-    (PINDEX)[0] = (uint8_t)((SOURCELONG) >> 16);        \
-    (PINDEX)[1] = (uint8_t)((SOURCELONG) >>  8);        \
-    (PINDEX)[2] = (uint8_t)((SOURCELONG))
-
-#ifdef JU_64BIT
-
-// Copy a 5-byte Index pointed by a uint8_t * to a Word_t:
-//
-#define JU_COPY5_PINDEX_TO_LONG(DESTLONG,PINDEX)        \
-    DESTLONG  = (Word_t)(PINDEX)[0] << 32;              \
-    DESTLONG += (Word_t)(PINDEX)[1] << 24;              \
-    DESTLONG += (Word_t)(PINDEX)[2] << 16;              \
-    DESTLONG += (Word_t)(PINDEX)[3] <<  8;              \
-    DESTLONG += (Word_t)(PINDEX)[4]
-
-// Copy a Word_t to a 5-byte Index pointed at by a uint8_t *:
-
-#define JU_COPY5_LONG_TO_PINDEX(PINDEX,SOURCELONG)      \
-    (PINDEX)[0] = (uint8_t)((SOURCELONG) >> 32);        \
-    (PINDEX)[1] = (uint8_t)((SOURCELONG) >> 24);        \
-    (PINDEX)[2] = (uint8_t)((SOURCELONG) >> 16);        \
-    (PINDEX)[3] = (uint8_t)((SOURCELONG) >>  8);        \
-    (PINDEX)[4] = (uint8_t)((SOURCELONG))
-
-// Copy a 6-byte Index pointed by a uint8_t * to a Word_t:
-//
-#define JU_COPY6_PINDEX_TO_LONG(DESTLONG,PINDEX)        \
-    DESTLONG  = (Word_t)(PINDEX)[0] << 40;              \
-    DESTLONG += (Word_t)(PINDEX)[1] << 32;              \
-    DESTLONG += (Word_t)(PINDEX)[2] << 24;              \
-    DESTLONG += (Word_t)(PINDEX)[3] << 16;              \
-    DESTLONG += (Word_t)(PINDEX)[4] <<  8;              \
-    DESTLONG += (Word_t)(PINDEX)[5]
-
-// Copy a Word_t to a 6-byte Index pointed at by a uint8_t *:
-
-#define JU_COPY6_LONG_TO_PINDEX(PINDEX,SOURCELONG)      \
-    (PINDEX)[0] = (uint8_t)((SOURCELONG) >> 40);        \
-    (PINDEX)[1] = (uint8_t)((SOURCELONG) >> 32);        \
-    (PINDEX)[2] = (uint8_t)((SOURCELONG) >> 24);        \
-    (PINDEX)[3] = (uint8_t)((SOURCELONG) >> 16);        \
-    (PINDEX)[4] = (uint8_t)((SOURCELONG) >>  8);        \
-    (PINDEX)[5] = (uint8_t)((SOURCELONG))
-
-// Copy a 7-byte Index pointed by a uint8_t * to a Word_t:
-//
-#define JU_COPY7_PINDEX_TO_LONG(DESTLONG,PINDEX)        \
-    DESTLONG  = (Word_t)(PINDEX)[0] << 48;              \
-    DESTLONG += (Word_t)(PINDEX)[1] << 40;              \
-    DESTLONG += (Word_t)(PINDEX)[2] << 32;              \
-    DESTLONG += (Word_t)(PINDEX)[3] << 24;              \
-    DESTLONG += (Word_t)(PINDEX)[4] << 16;              \
-    DESTLONG += (Word_t)(PINDEX)[5] <<  8;              \
-    DESTLONG += (Word_t)(PINDEX)[6]
-
-// Copy a Word_t to a 7-byte Index pointed at by a uint8_t *:
-
-#define JU_COPY7_LONG_TO_PINDEX(PINDEX,SOURCELONG)      \
-    (PINDEX)[0] = (uint8_t)((SOURCELONG) >> 48);        \
-    (PINDEX)[1] = (uint8_t)((SOURCELONG) >> 40);        \
-    (PINDEX)[2] = (uint8_t)((SOURCELONG) >> 32);        \
-    (PINDEX)[3] = (uint8_t)((SOURCELONG) >> 24);        \
-    (PINDEX)[4] = (uint8_t)((SOURCELONG) >> 16);        \
-    (PINDEX)[5] = (uint8_t)((SOURCELONG) >>  8);        \
-    (PINDEX)[6] = (uint8_t)((SOURCELONG))
-
-#endif // JU_64BIT
-
-// ****************************************************************************
-// COMMON CODE FRAGMENTS (MACROS)
-// ****************************************************************************
-//
-// These code chunks are shared between various source files.
-
-
-// SET (REPLACE) ONE DIGIT IN AN INDEX:
-//
-// To avoid endian issues, use masking and ORing, which operates in a
-// big-endian register, rather than treating the Index as an array of bytes,
-// though that would be simpler, but would operate in endian-specific memory.
-//
-// TBD:  This contains two variable shifts, is that bad?
-
-#define JU_SETDIGIT(INDEX,DIGIT,STATE)                  \
-        (INDEX) = ((INDEX) & (~cJU_MASKATSTATE(STATE))) \
-                           | (((Word_t) (DIGIT))        \
-                              << (((STATE) - 1) * cJU_BITSPERBYTE))
-
-// Fast version for single LSB:
-
-#define JU_SETDIGIT1(INDEX,DIGIT) (INDEX) = ((INDEX) & ~0xff) | (DIGIT)
-
-
-// SET (REPLACE) "N" LEAST DIGITS IN AN INDEX:
-
-#define JU_SETDIGITS(INDEX,INDEX2,cSTATE) \
-        (INDEX) = ((INDEX ) & (~JU_LEASTBYTESMASK(cSTATE))) \
-                | ((INDEX2) & ( JU_LEASTBYTESMASK(cSTATE)))
-
-// COPY DECODE BYTES FROM JP TO INDEX:
-//
-// Modify Index digit(s) to match the bytes in jp_DcdPopO in case one or more
-// branches are skipped and the digits are significant.  Its probably faster
-// to just do this unconditionally than to check if its necessary.
-//
-// To avoid endian issues, use masking and ORing, which operates in a
-// big-endian register, rather than treating the Index as an array of bytes,
-// though that would be simpler, but would operate in endian-specific memory.
-//
-// WARNING:  Must not call JU_LEASTBYTESMASK (via cJU_DCDMASK) with Bytes =
-// cJU_ROOTSTATE or a bad mask is generated, but there are no Dcd bytes to copy
-// in this case anyway.  In fact there are no Dcd bytes unless State <
-// cJU_ROOTSTATE - 1, so dont call this macro except in those cases.
-//
-// TBD:  It would be nice to validate jp_DcdPopO against known digits to ensure
-// no corruption, but this is non-trivial.
-
-#define JU_SETDCD(INDEX,PJP,cSTATE)                             \
-    (INDEX) = ((INDEX) & ~cJU_DCDMASK(cSTATE))                  \
-                | (JU_JPDCDPOP0(PJP) & cJU_DCDMASK(cSTATE))
-
-// INSERT/DELETE AN INDEX IN-PLACE IN MEMORY:
-//
-// Given a pointer to an array of "even" (native), same-sized objects
-// (indexes), the current population of the array, an offset in the array, and
-// a new Index to insert, "shift up" the array elements (Indexes) above the
-// insertion point and insert the new Index.  Assume there is sufficient memory
-// to do this.
-//
-// In these macros, "i_offset" is an index offset, and "b_off" is a byte
-// offset for odd Index sizes.
-//
-// Note:  Endian issues only arise fro insertion, not deletion, and even for
-// insertion, they are transparent when native (even) objects are used, and
-// handled explicitly for odd (non-native) Index sizes.
-//
-// Note:  The following macros are tricky enough that there is some test code
-// for them appended to this file.
-
-#define JU_INSERTINPLACE(PARRAY,POP1,OFFSET,INDEX)              \
-        assert((long) (POP1) > 0);                              \
-        assert((Word_t) (OFFSET) <= (Word_t) (POP1));           \
-        {                                                       \
-            Word_t i_offset = (POP1);                           \
-                                                                \
-            while (i_offset-- > (OFFSET))                       \
-                (PARRAY)[i_offset + 1] = (PARRAY)[i_offset];    \
-                                                                \
-            (PARRAY)[OFFSET] = (INDEX);                         \
-        }
-
-
-// Variation for non-native Indexes, where cIS = Index Size
-// and PByte must point to a uint8_t (byte); shift byte-by-byte:
-//
-
-#define JU_INSERTINPLACE3(PBYTE,POP1,OFFSET,INDEX)              \
-{                                                               \
-    Word_t i_off = POP1;                                        \
-                                                                \
-    while (i_off-- > (OFFSET))                                  \
-    {                                                           \
-        Word_t  i_dx = i_off * 3;                               \
-        (PBYTE)[i_dx + 0 + 3] = (PBYTE)[i_dx + 0];              \
-        (PBYTE)[i_dx + 1 + 3] = (PBYTE)[i_dx + 1];              \
-        (PBYTE)[i_dx + 2 + 3] = (PBYTE)[i_dx + 2];              \
-    }                                                           \
-    JU_COPY3_LONG_TO_PINDEX(&((PBYTE)[(OFFSET) * 3]), INDEX);   \
-}
-
-#ifdef JU_64BIT
-
-#define JU_INSERTINPLACE5(PBYTE,POP1,OFFSET,INDEX)              \
-{                                                               \
-    Word_t i_off = POP1;                                        \
-                                                                \
-    while (i_off-- > (OFFSET))                                  \
-    {                                                           \
-        Word_t  i_dx = i_off * 5;                               \
-        (PBYTE)[i_dx + 0 + 5] = (PBYTE)[i_dx + 0];              \
-        (PBYTE)[i_dx + 1 + 5] = (PBYTE)[i_dx + 1];              \
-        (PBYTE)[i_dx + 2 + 5] = (PBYTE)[i_dx + 2];              \
-        (PBYTE)[i_dx + 3 + 5] = (PBYTE)[i_dx + 3];              \
-        (PBYTE)[i_dx + 4 + 5] = (PBYTE)[i_dx + 4];              \
-    }                                                           \
-    JU_COPY5_LONG_TO_PINDEX(&((PBYTE)[(OFFSET) * 5]), INDEX);   \
-}
-
-#define JU_INSERTINPLACE6(PBYTE,POP1,OFFSET,INDEX)              \
-{                                                               \
-    Word_t i_off = POP1;                                        \
-                                                                \
-    while (i_off-- > (OFFSET))                                  \
-    {                                                           \
-        Word_t  i_dx = i_off * 6;                               \
-        (PBYTE)[i_dx + 0 + 6] = (PBYTE)[i_dx + 0];              \
-        (PBYTE)[i_dx + 1 + 6] = (PBYTE)[i_dx + 1];              \
-        (PBYTE)[i_dx + 2 + 6] = (PBYTE)[i_dx + 2];              \
-        (PBYTE)[i_dx + 3 + 6] = (PBYTE)[i_dx + 3];              \
-        (PBYTE)[i_dx + 4 + 6] = (PBYTE)[i_dx + 4];              \
-        (PBYTE)[i_dx + 5 + 6] = (PBYTE)[i_dx + 5];              \
-    }                                                           \
-    JU_COPY6_LONG_TO_PINDEX(&((PBYTE)[(OFFSET) * 6]), INDEX);   \
-}
-
-#define JU_INSERTINPLACE7(PBYTE,POP1,OFFSET,INDEX)              \
-{                                                               \
-    Word_t i_off = POP1;                                        \
-                                                                \
-    while (i_off-- > (OFFSET))                                  \
-    {                                                           \
-        Word_t  i_dx = i_off * 7;                               \
-        (PBYTE)[i_dx + 0 + 7] = (PBYTE)[i_dx + 0];              \
-        (PBYTE)[i_dx + 1 + 7] = (PBYTE)[i_dx + 1];              \
-        (PBYTE)[i_dx + 2 + 7] = (PBYTE)[i_dx + 2];              \
-        (PBYTE)[i_dx + 3 + 7] = (PBYTE)[i_dx + 3];              \
-        (PBYTE)[i_dx + 4 + 7] = (PBYTE)[i_dx + 4];              \
-        (PBYTE)[i_dx + 5 + 7] = (PBYTE)[i_dx + 5];              \
-        (PBYTE)[i_dx + 6 + 7] = (PBYTE)[i_dx + 6];              \
-    }                                                           \
-    JU_COPY7_LONG_TO_PINDEX(&((PBYTE)[(OFFSET) * 7]), INDEX);   \
-}
-#endif // JU_64BIT
-
-// Counterparts to the above for deleting an Index:
-//
-// "Shift down" the array elements starting at the Index to be deleted.
-
-#define JU_DELETEINPLACE(PARRAY,POP1,OFFSET,IGNORE)             \
-        assert((long) (POP1) > 0);                              \
-        assert((Word_t) (OFFSET) < (Word_t) (POP1));            \
-        {                                                       \
-            Word_t i_offset = (OFFSET);                         \
-                                                                \
-            while (++i_offset < (POP1))                         \
-                (PARRAY)[i_offset - 1] = (PARRAY)[i_offset];    \
-        }
-
-// Variation for odd-byte-sized (non-native) Indexes, where cIS = Index Size
-// and PByte must point to a uint8_t (byte); copy byte-by-byte:
-//
-// Note:  If cIS == 1, JU_DELETEINPLACE_ODD == JU_DELETEINPLACE.
-//
-// Note:  There are no endian issues here because bytes are just shifted as-is,
-// not converted to/from an Index.
-
-#define JU_DELETEINPLACE_ODD(PBYTE,POP1,OFFSET,cIS)             \
-        assert((long) (POP1) > 0);                              \
-        assert((Word_t) (OFFSET) < (Word_t) (POP1));            \
-        {                                                       \
-            Word_t b_off = (((OFFSET) + 1) * (cIS)) - 1;        \
-                                                                \
-            while (++b_off < ((POP1) * (cIS)))                  \
-                (PBYTE)[b_off - (cIS)] = (PBYTE)[b_off];        \
-        }
-
-
-// INSERT/DELETE AN INDEX WHILE COPYING OTHERS:
-//
-// Copy PSource[] to PDest[], where PSource[] has Pop1 elements (Indexes),
-// inserting Index at PDest[Offset].  Unlike JU_*INPLACE*() above, these macros
-// are used when moving Indexes from one memory object to another.
-
-#define JU_INSERTCOPY(PDEST,PSOURCE,POP1,OFFSET,INDEX)          \
-        assert((long) (POP1) > 0);                              \
-        assert((Word_t) (OFFSET) <= (Word_t) (POP1));           \
-        {                                                       \
-            Word_t i_offset;                                    \
-                                                                \
-            for (i_offset = 0; i_offset < (OFFSET); ++i_offset) \
-                (PDEST)[i_offset] = (PSOURCE)[i_offset];        \
-                                                                \
-            (PDEST)[i_offset] = (INDEX);                        \
-                                                                \
-            for (/* null */; i_offset < (POP1); ++i_offset)     \
-                (PDEST)[i_offset + 1] = (PSOURCE)[i_offset];    \
-        }
-
-#define JU_INSERTCOPY3(PDEST,PSOURCE,POP1,OFFSET,INDEX)         \
-assert((long) (POP1) > 0);                                      \
-assert((Word_t) (OFFSET) <= (Word_t) (POP1));                   \
-{                                                               \
-    Word_t o_ff;                                                \
-                                                                \
-    for (o_ff = 0; o_ff < (OFFSET); o_ff++)                     \
-    {                                                           \
-        Word_t  i_dx = o_ff * 3;                                \
-        (PDEST)[i_dx + 0] = (PSOURCE)[i_dx + 0];                \
-        (PDEST)[i_dx + 1] = (PSOURCE)[i_dx + 1];                \
-        (PDEST)[i_dx + 2] = (PSOURCE)[i_dx + 2];                \
-    }                                                           \
-    JU_COPY3_LONG_TO_PINDEX(&((PDEST)[(OFFSET) * 3]), INDEX);   \
-                                                                \
-    for (/* null */; o_ff < (POP1); o_ff++)                     \
-    {                                                           \
-        Word_t  i_dx = o_ff * 3;                                \
-        (PDEST)[i_dx + 0 + 3] = (PSOURCE)[i_dx + 0];            \
-        (PDEST)[i_dx + 1 + 3] = (PSOURCE)[i_dx + 1];            \
-        (PDEST)[i_dx + 2 + 3] = (PSOURCE)[i_dx + 2];            \
-    }                                                           \
-}
-
-#ifdef JU_64BIT
-
-#define JU_INSERTCOPY5(PDEST,PSOURCE,POP1,OFFSET,INDEX)         \
-assert((long) (POP1) > 0);                                      \
-assert((Word_t) (OFFSET) <= (Word_t) (POP1));                   \
-{                                                               \
-    Word_t o_ff;                                                \
-                                                                \
-    for (o_ff = 0; o_ff < (OFFSET); o_ff++)                     \
-    {                                                           \
-        Word_t  i_dx = o_ff * 5;                                \
-        (PDEST)[i_dx + 0] = (PSOURCE)[i_dx + 0];                \
-        (PDEST)[i_dx + 1] = (PSOURCE)[i_dx + 1];                \
-        (PDEST)[i_dx + 2] = (PSOURCE)[i_dx + 2];                \
-        (PDEST)[i_dx + 3] = (PSOURCE)[i_dx + 3];                \
-        (PDEST)[i_dx + 4] = (PSOURCE)[i_dx + 4];                \
-    }                                                           \
-    JU_COPY5_LONG_TO_PINDEX(&((PDEST)[(OFFSET) * 5]), INDEX);   \
-                                                                \
-    for (/* null */; o_ff < (POP1); o_ff++)                     \
-    {                                                           \
-        Word_t  i_dx = o_ff * 5;                                \
-        (PDEST)[i_dx + 0 + 5] = (PSOURCE)[i_dx + 0];            \
-        (PDEST)[i_dx + 1 + 5] = (PSOURCE)[i_dx + 1];            \
-        (PDEST)[i_dx + 2 + 5] = (PSOURCE)[i_dx + 2];            \
-        (PDEST)[i_dx + 3 + 5] = (PSOURCE)[i_dx + 3];            \
-        (PDEST)[i_dx + 4 + 5] = (PSOURCE)[i_dx + 4];            \
-    }                                                           \
-}
-
-#define JU_INSERTCOPY6(PDEST,PSOURCE,POP1,OFFSET,INDEX)         \
-assert((long) (POP1) > 0);                                      \
-assert((Word_t) (OFFSET) <= (Word_t) (POP1));                   \
-{                                                               \
-    Word_t o_ff;                                                \
-                                                                \
-    for (o_ff = 0; o_ff < (OFFSET); o_ff++)                     \
-    {                                                           \
-        Word_t  i_dx = o_ff * 6;                                \
-        (PDEST)[i_dx + 0] = (PSOURCE)[i_dx + 0];                \
-        (PDEST)[i_dx + 1] = (PSOURCE)[i_dx + 1];                \
-        (PDEST)[i_dx + 2] = (PSOURCE)[i_dx + 2];                \
-        (PDEST)[i_dx + 3] = (PSOURCE)[i_dx + 3];                \
-        (PDEST)[i_dx + 4] = (PSOURCE)[i_dx + 4];                \
-        (PDEST)[i_dx + 5] = (PSOURCE)[i_dx + 5];                \
-    }                                                           \
-    JU_COPY6_LONG_TO_PINDEX(&((PDEST)[(OFFSET) * 6]), INDEX);   \
-                                                                \
-    for (/* null */; o_ff < (POP1); o_ff++)                     \
-    {                                                           \
-        Word_t  i_dx = o_ff * 6;                                \
-        (PDEST)[i_dx + 0 + 6] = (PSOURCE)[i_dx + 0];            \
-        (PDEST)[i_dx + 1 + 6] = (PSOURCE)[i_dx + 1];            \
-        (PDEST)[i_dx + 2 + 6] = (PSOURCE)[i_dx + 2];            \
-        (PDEST)[i_dx + 3 + 6] = (PSOURCE)[i_dx + 3];            \
-        (PDEST)[i_dx + 4 + 6] = (PSOURCE)[i_dx + 4];            \
-        (PDEST)[i_dx + 5 + 6] = (PSOURCE)[i_dx + 5];            \
-    }                                                           \
-}
-
-#define JU_INSERTCOPY7(PDEST,PSOURCE,POP1,OFFSET,INDEX)         \
-assert((long) (POP1) > 0);                                      \
-assert((Word_t) (OFFSET) <= (Word_t) (POP1));                   \
-{                                                               \
-    Word_t o_ff;                                                \
-                                                                \
-    for (o_ff = 0; o_ff < (OFFSET); o_ff++)                     \
-    {                                                           \
-        Word_t  i_dx = o_ff * 7;                                \
-        (PDEST)[i_dx + 0] = (PSOURCE)[i_dx + 0];                \
-        (PDEST)[i_dx + 1] = (PSOURCE)[i_dx + 1];                \
-        (PDEST)[i_dx + 2] = (PSOURCE)[i_dx + 2];                \
-        (PDEST)[i_dx + 3] = (PSOURCE)[i_dx + 3];                \
-        (PDEST)[i_dx + 4] = (PSOURCE)[i_dx + 4];                \
-        (PDEST)[i_dx + 5] = (PSOURCE)[i_dx + 5];                \
-        (PDEST)[i_dx + 6] = (PSOURCE)[i_dx + 6];                \
-    }                                                           \
-    JU_COPY7_LONG_TO_PINDEX(&((PDEST)[(OFFSET) * 7]), INDEX);   \
-                                                                \
-    for (/* null */; o_ff < (POP1); o_ff++)                     \
-    {                                                           \
-        Word_t  i_dx = o_ff * 7;                                \
-        (PDEST)[i_dx + 0 + 7] = (PSOURCE)[i_dx + 0];            \
-        (PDEST)[i_dx + 1 + 7] = (PSOURCE)[i_dx + 1];            \
-        (PDEST)[i_dx + 2 + 7] = (PSOURCE)[i_dx + 2];            \
-        (PDEST)[i_dx + 3 + 7] = (PSOURCE)[i_dx + 3];            \
-        (PDEST)[i_dx + 4 + 7] = (PSOURCE)[i_dx + 4];            \
-        (PDEST)[i_dx + 5 + 7] = (PSOURCE)[i_dx + 5];            \
-        (PDEST)[i_dx + 6 + 7] = (PSOURCE)[i_dx + 6];            \
-    }                                                           \
-}
-
-#endif // JU_64BIT
-
-// Counterparts to the above for deleting an Index:
-
-#define JU_DELETECOPY(PDEST,PSOURCE,POP1,OFFSET,IGNORE)         \
-        assert((long) (POP1) > 0);                              \
-        assert((Word_t) (OFFSET) < (Word_t) (POP1));            \
-        {                                                       \
-            Word_t i_offset;                                    \
-                                                                \
-            for (i_offset = 0; i_offset < (OFFSET); ++i_offset) \
-                (PDEST)[i_offset] = (PSOURCE)[i_offset];        \
-                                                                \
-            for (++i_offset; i_offset < (POP1); ++i_offset)     \
-                (PDEST)[i_offset - 1] = (PSOURCE)[i_offset];    \
-        }
-
-// Variation for odd-byte-sized (non-native) Indexes, where cIS = Index Size;
-// copy byte-by-byte:
-//
-// Note:  There are no endian issues here because bytes are just shifted as-is,
-// not converted to/from an Index.
-//
-// Note:  If cIS == 1, JU_DELETECOPY_ODD == JU_DELETECOPY, at least in concept.
-
-#define JU_DELETECOPY_ODD(PDEST,PSOURCE,POP1,OFFSET,cIS)                \
-        assert((long) (POP1) > 0);                                      \
-        assert((Word_t) (OFFSET) < (Word_t) (POP1));                    \
-        {                                                               \
-            uint8_t *_Pdest   = (uint8_t *) (PDEST);                    \
-            uint8_t *_Psource = (uint8_t *) (PSOURCE);                  \
-            Word_t   b_off;                                             \
-                                                                        \
-            for (b_off = 0; b_off < ((OFFSET) * (cIS)); ++b_off)        \
-                *_Pdest++ = *_Psource++;                                \
-                                                                        \
-            _Psource += (cIS);                                          \
-                                                                        \
-            for (b_off += (cIS); b_off < ((POP1) * (cIS)); ++b_off)     \
-                *_Pdest++ = *_Psource++;                                \
-        }
-
-
-// GENERIC RETURN CODE HANDLING FOR JUDY1 (NO VALUE AREAS) AND JUDYL (VALUE
-// AREAS):
-//
-// This common code hides Judy1 versus JudyL details of how to return various
-// conditions, including a pointer to a value area for JudyL.
-//
-// First, define an internal variation of JERR called JERRI (I = int) to make
-// lint happy.  We accidentally shipped to 11.11 OEUR with all functions that
-// return int or Word_t using JERR, which is type Word_t, for errors.  Lint
-// complains about this for functions that return int.  So, internally use
-// JERRI for error returns from the int functions.  Experiments show that
-// callers which compare int Foo() to (Word_t) JERR (~0UL) are OK, since JERRI
-// sign-extends to match JERR.
-
-#define JERRI ((int) ~0)                // see above.
-
-#ifdef JUDY1
-
-#define JU_RET_FOUND    return(1)
-#define JU_RET_NOTFOUND return(0)
-
-// For Judy1, these all "fall through" to simply JU_RET_FOUND, since there is no
-// value area pointer to return:
-
-#define JU_RET_FOUND_LEAFW(PJLW,POP1,OFFSET)    JU_RET_FOUND
-
-#define JU_RET_FOUND_JPM(Pjpm)                  JU_RET_FOUND
-#define JU_RET_FOUND_PVALUE(Pjv,OFFSET)         JU_RET_FOUND
-#ifndef JU_64BIT
-#define JU_RET_FOUND_LEAF1(Pjll,POP1,OFFSET)    JU_RET_FOUND
-#endif
-#define JU_RET_FOUND_LEAF2(Pjll,POP1,OFFSET)    JU_RET_FOUND
-#define JU_RET_FOUND_LEAF3(Pjll,POP1,OFFSET)    JU_RET_FOUND
-#ifdef JU_64BIT
-#define JU_RET_FOUND_LEAF4(Pjll,POP1,OFFSET)    JU_RET_FOUND
-#define JU_RET_FOUND_LEAF5(Pjll,POP1,OFFSET)    JU_RET_FOUND
-#define JU_RET_FOUND_LEAF6(Pjll,POP1,OFFSET)    JU_RET_FOUND
-#define JU_RET_FOUND_LEAF7(Pjll,POP1,OFFSET)    JU_RET_FOUND
-#endif
-#define JU_RET_FOUND_IMM_01(Pjp)                JU_RET_FOUND
-#define JU_RET_FOUND_IMM(Pjp,OFFSET)            JU_RET_FOUND
-
-// Note:  No JudyL equivalent:
-
-#define JU_RET_FOUND_FULLPOPU1                   JU_RET_FOUND
-#define JU_RET_FOUND_LEAF_B1(PJLB,SUBEXP,OFFSET) JU_RET_FOUND
-
-#else // JUDYL
-
-//      JU_RET_FOUND            // see below; must NOT be defined for JudyL.
-#define JU_RET_NOTFOUND return((PPvoid_t) NULL)
-
-// For JudyL, the location of the value area depends on the JP type and other
-// factors:
-//
-// TBD:  The value areas should be accessed via data structures, here and in
-// Dougs code, not by hard-coded address calculations.
-//
-// This is useful in insert/delete code when the value area is returned from
-// lower levels in the JPM:
-
-#define JU_RET_FOUND_JPM(Pjpm)  return((PPvoid_t) ((Pjpm)->jpm_PValue))
-
-// This is useful in insert/delete code when the value area location is already
-// computed:
-
-#define JU_RET_FOUND_PVALUE(Pjv,OFFSET) return((PPvoid_t) ((Pjv) + OFFSET))
-
-#define JU_RET_FOUND_LEAFW(PJLW,POP1,OFFSET) \
-                return((PPvoid_t) (JL_LEAFWVALUEAREA(PJLW, POP1) + (OFFSET)))
-
-#define JU_RET_FOUND_LEAF1(Pjll,POP1,OFFSET) \
-                return((PPvoid_t) (JL_LEAF1VALUEAREA(Pjll, POP1) + (OFFSET)))
-#define JU_RET_FOUND_LEAF2(Pjll,POP1,OFFSET) \
-                return((PPvoid_t) (JL_LEAF2VALUEAREA(Pjll, POP1) + (OFFSET)))
-#define JU_RET_FOUND_LEAF3(Pjll,POP1,OFFSET) \
-                return((PPvoid_t) (JL_LEAF3VALUEAREA(Pjll, POP1) + (OFFSET)))
-#ifdef JU_64BIT
-#define JU_RET_FOUND_LEAF4(Pjll,POP1,OFFSET) \
-                return((PPvoid_t) (JL_LEAF4VALUEAREA(Pjll, POP1) + (OFFSET)))
-#define JU_RET_FOUND_LEAF5(Pjll,POP1,OFFSET) \
-                return((PPvoid_t) (JL_LEAF5VALUEAREA(Pjll, POP1) + (OFFSET)))
-#define JU_RET_FOUND_LEAF6(Pjll,POP1,OFFSET) \
-                return((PPvoid_t) (JL_LEAF6VALUEAREA(Pjll, POP1) + (OFFSET)))
-#define JU_RET_FOUND_LEAF7(Pjll,POP1,OFFSET) \
-                return((PPvoid_t) (JL_LEAF7VALUEAREA(Pjll, POP1) + (OFFSET)))
-#endif
-
-// Note:  Here jp_Addr is a value area itself and not an address, so P_JV() is
-// not needed:
-
-#define JU_RET_FOUND_IMM_01(PJP)  return((PPvoid_t) (&((PJP)->jp_Addr)))
-
-// Note:  Here jp_Addr is a pointer to a separately-mallocd value area, so
-// P_JV() is required; likewise for JL_JLB_PVALUE:
-
-#define JU_RET_FOUND_IMM(PJP,OFFSET) \
-            return((PPvoid_t) (P_JV((PJP)->jp_Addr) + (OFFSET)))
-
-#define JU_RET_FOUND_LEAF_B1(PJLB,SUBEXP,OFFSET) \
-            return((PPvoid_t) (P_JV(JL_JLB_PVALUE(PJLB, SUBEXP)) + (OFFSET)))
-
-#endif // JUDYL
-
-
-// GENERIC ERROR HANDLING:
-//
-// This is complicated by variations in the needs of the callers of these
-// macros.  Only use JU_SET_ERRNO() for PJError, because it can be null; use
-// JU_SET_ERRNO_NONNULL() for Pjpm, which is never null, and also in other
-// cases where the pointer is known not to be null (to save dead branches).
-//
-// Note:  Most cases of JU_ERRNO_OVERRUN or JU_ERRNO_CORRUPT should result in
-// an assertion failure in debug code, so they are more likely to be caught, so
-// do that here in each macro.
-
-#define JU_SET_ERRNO(PJError, JErrno)                   \
-        {                                               \
-            assert((JErrno) != JU_ERRNO_OVERRUN);       \
-            assert((JErrno) != JU_ERRNO_CORRUPT);       \
-                                                        \
-            if (PJError != (PJError_t) NULL)            \
-            {                                           \
-                JU_ERRNO(PJError) = (JErrno);           \
-                JU_ERRID(PJError) = __LINE__;           \
-            }                                           \
-        }
-
-// Variation for callers who know already that PJError is non-null; and, it can
-// also be Pjpm (both PJError_t and Pjpm_t have je_* fields), so only assert it
-// for null, not cast to any specific pointer type:
-
-#define JU_SET_ERRNO_NONNULL(PJError, JErrno)           \
-        {                                               \
-            assert((JErrno) != JU_ERRNO_OVERRUN);       \
-            assert((JErrno) != JU_ERRNO_CORRUPT);       \
-            assert(PJError);                            \
-                                                        \
-            JU_ERRNO(PJError) = (JErrno);               \
-            JU_ERRID(PJError) = __LINE__;               \
-        }
-
-// Variation to copy error info from a (required) JPM to an (optional)
-// PJError_t:
-//
-// Note:  The assertions above about JU_ERRNO_OVERRUN and JU_ERRNO_CORRUPT
-// should have already popped, so they are not needed here.
-
-#define JU_COPY_ERRNO(PJError, Pjpm)                            \
-        {                                                       \
-            if (PJError)                                        \
-            {                                                   \
-                JU_ERRNO(PJError) = (uint8_t)JU_ERRNO(Pjpm);    \
-                JU_ERRID(PJError) = JU_ERRID(Pjpm);             \
-            }                                                   \
-        }
-
-// For JErrno parameter to previous macros upon return from Judy*Alloc*():
-//
-// The memory allocator returns an address of 0 for out of memory,
-// 1..sizeof(Word_t)-1 for corruption (an invalid pointer), otherwise a valid
-// pointer.
-
-#define JU_ALLOC_ERRNO(ADDR) \
-        (((void *) (ADDR) != (void *) NULL) ? JU_ERRNO_OVERRUN : JU_ERRNO_NOMEM)
-
-#define JU_CHECKALLOC(Type,Ptr,Retval)                  \
-        if ((Ptr) < (Type) sizeof(Word_t))              \
-        {                                               \
-            JU_SET_ERRNO(PJError, JU_ALLOC_ERRNO(Ptr)); \
-            return(Retval);                             \
-        }
-
-// Leaf search routines
-
-#ifdef JU_NOINLINE
-
-int j__udySearchLeaf1(Pjll_t Pjll, Word_t LeafPop1, Word_t Index);
-int j__udySearchLeaf2(Pjll_t Pjll, Word_t LeafPop1, Word_t Index);
-int j__udySearchLeaf3(Pjll_t Pjll, Word_t LeafPop1, Word_t Index);
-
-#ifdef JU_64BIT
-
-int j__udySearchLeaf4(Pjll_t Pjll, Word_t LeafPop1, Word_t Index);
-int j__udySearchLeaf5(Pjll_t Pjll, Word_t LeafPop1, Word_t Index);
-int j__udySearchLeaf6(Pjll_t Pjll, Word_t LeafPop1, Word_t Index);
-int j__udySearchLeaf7(Pjll_t Pjll, Word_t LeafPop1, Word_t Index);
-
-#endif // JU_64BIT
-
-int j__udySearchLeafW(Pjlw_t Pjlw, Word_t LeafPop1, Word_t Index);
-
-#else  // complier support for inline
-
-#ifdef JU_WIN
-static __inline int j__udySearchLeaf1(Pjll_t Pjll, Word_t LeafPop1, Word_t Index)
-#else
-static inline int j__udySearchLeaf1(Pjll_t Pjll, Word_t LeafPop1, Word_t Index)
-#endif
-{ SEARCHLEAFNATIVE(uint8_t,  Pjll, LeafPop1, Index); }
-
-#ifdef JU_WIN
-static __inline int j__udySearchLeaf2(Pjll_t Pjll, Word_t LeafPop1, Word_t Index)
-#else
-static inline int j__udySearchLeaf2(Pjll_t Pjll, Word_t LeafPop1, Word_t Index)
-#endif
-{ SEARCHLEAFNATIVE(uint16_t, Pjll, LeafPop1, Index); }
-
-#ifdef JU_WIN
-static __inline int j__udySearchLeaf3(Pjll_t Pjll, Word_t LeafPop1, Word_t Index)
-#else
-static inline int j__udySearchLeaf3(Pjll_t Pjll, Word_t LeafPop1, Word_t Index)
-#endif
-{ SEARCHLEAFNONNAT(Pjll, LeafPop1, Index, 3, JU_COPY3_PINDEX_TO_LONG); }
-
-#ifdef JU_64BIT
-
-#ifdef JU_WIN
-static __inline int j__udySearchLeaf4(Pjll_t Pjll, Word_t LeafPop1, Word_t Index)
-#else
-static inline int j__udySearchLeaf4(Pjll_t Pjll, Word_t LeafPop1, Word_t Index)
-#endif
-{ SEARCHLEAFNATIVE(uint32_t, Pjll, LeafPop1, Index); }
-
-#ifdef JU_WIN
-static __inline int j__udySearchLeaf5(Pjll_t Pjll, Word_t LeafPop1, Word_t Index)
-#else
-static inline int j__udySearchLeaf5(Pjll_t Pjll, Word_t LeafPop1, Word_t Index)
-#endif
-{ SEARCHLEAFNONNAT(Pjll, LeafPop1, Index, 5, JU_COPY5_PINDEX_TO_LONG); }
-
-#ifdef JU_WIN
-static __inline int j__udySearchLeaf6(Pjll_t Pjll, Word_t LeafPop1, Word_t Index)
-#else
-static inline int j__udySearchLeaf6(Pjll_t Pjll, Word_t LeafPop1, Word_t Index)
-#endif
-{ SEARCHLEAFNONNAT(Pjll, LeafPop1, Index, 6, JU_COPY6_PINDEX_TO_LONG); }
-
-#ifdef JU_WIN
-static __inline int j__udySearchLeaf7(Pjll_t Pjll, Word_t LeafPop1, Word_t Index)
-#else
-static inline int j__udySearchLeaf7(Pjll_t Pjll, Word_t LeafPop1, Word_t Index)
-#endif
-{ SEARCHLEAFNONNAT(Pjll, LeafPop1, Index, 7, JU_COPY7_PINDEX_TO_LONG); }
-
-#endif // JU_64BIT
-
-#ifdef JU_WIN
-static __inline int j__udySearchLeafW(Pjlw_t Pjlw, Word_t LeafPop1, Word_t Index)
-#else
-static inline int j__udySearchLeafW(Pjlw_t Pjlw, Word_t LeafPop1, Word_t Index)
-#endif
-{ SEARCHLEAFNATIVE(Word_t, Pjlw, LeafPop1, Index); }
-
-#endif // compiler support for inline
-
-#endif // ! _JUDYPRIVATE_INCLUDED
diff --git a/libs/klib/judy/JudyPrivate1L.h b/libs/klib/judy/JudyPrivate1L.h
deleted file mode 100644
index 5b9591f..0000000
--- a/libs/klib/judy/JudyPrivate1L.h
+++ /dev/null
@@ -1,483 +0,0 @@
-#ifndef _JUDYPRIVATE1L_INCLUDED
-#define	_JUDYPRIVATE1L_INCLUDED
-// _________________
-//
-// Copyright (C) 2000 - 2002 Hewlett-Packard Company
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the term of the GNU Lesser 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 Lesser General Public License
-// for more details.
-//
-// You should have received a copy of the GNU Lesser 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
-// _________________
-
-// ****************************************************************************
-// Declare common cJU_* names for JP Types that occur in both Judy1 and JudyL,
-// for use by code that ifdefs JUDY1 and JUDYL.  Only JP Types common to both
-// Judy1 and JudyL are #defined here with equivalent cJU_* names.  JP Types
-// unique to only Judy1 or JudyL are listed in comments, so the type lists
-// match the Judy1.h and JudyL.h files.
-//
-// This file also defines cJU_* for other JP-related constants and functions
-// that some shared JUDY1/JUDYL code finds handy.
-//
-// At least in principle this file should be included AFTER Judy1.h or JudyL.h.
-//
-// WARNING:  This file must be kept consistent with the enums in Judy1.h and
-// JudyL.h.
-//
-// TBD:  You might think, why not define common cJU_* enums in, say,
-// JudyPrivate.h, and then inherit them into superset enums in Judy1.h and
-// JudyL.h?  The problem is that the enum lists for each class (cJ1_* and
-// cJL_*) must be numerically "packed" into the correct order, for two reasons:
-// (1) allow the compiler to generate "tight" switch statements with no wasted
-// slots (although this is not very big), and (2) allow calculations using the
-// enum values, although this is also not an issue if the calculations are only
-// within each cJ*_JPIMMED_*_* class and the members are packed within the
-// class.
-
-#ifdef JUDY1
-
-#define	cJU_JRPNULL		cJ1_JRPNULL
-#define	cJU_JPNULL1		cJ1_JPNULL1
-#define	cJU_JPNULL2		cJ1_JPNULL2
-#define	cJU_JPNULL3		cJ1_JPNULL3
-#ifdef JU_64BIT
-#define	cJU_JPNULL4		cJ1_JPNULL4
-#define	cJU_JPNULL5		cJ1_JPNULL5
-#define	cJU_JPNULL6		cJ1_JPNULL6
-#define	cJU_JPNULL7		cJ1_JPNULL7
-#endif
-#define	cJU_JPNULLMAX		cJ1_JPNULLMAX
-#define	cJU_JPBRANCH_L2		cJ1_JPBRANCH_L2
-#define	cJU_JPBRANCH_L3		cJ1_JPBRANCH_L3
-#ifdef JU_64BIT
-#define	cJU_JPBRANCH_L4		cJ1_JPBRANCH_L4
-#define	cJU_JPBRANCH_L5		cJ1_JPBRANCH_L5
-#define	cJU_JPBRANCH_L6		cJ1_JPBRANCH_L6
-#define	cJU_JPBRANCH_L7		cJ1_JPBRANCH_L7
-#endif
-#define	cJU_JPBRANCH_L		cJ1_JPBRANCH_L
-#define	j__U_BranchBJPPopToWords j__1_BranchBJPPopToWords
-#define	cJU_JPBRANCH_B2		cJ1_JPBRANCH_B2
-#define	cJU_JPBRANCH_B3		cJ1_JPBRANCH_B3
-#ifdef JU_64BIT
-#define	cJU_JPBRANCH_B4		cJ1_JPBRANCH_B4
-#define	cJU_JPBRANCH_B5		cJ1_JPBRANCH_B5
-#define	cJU_JPBRANCH_B6		cJ1_JPBRANCH_B6
-#define	cJU_JPBRANCH_B7		cJ1_JPBRANCH_B7
-#endif
-#define	cJU_JPBRANCH_B		cJ1_JPBRANCH_B
-#define	cJU_JPBRANCH_U2		cJ1_JPBRANCH_U2
-#define	cJU_JPBRANCH_U3		cJ1_JPBRANCH_U3
-#ifdef JU_64BIT
-#define	cJU_JPBRANCH_U4		cJ1_JPBRANCH_U4
-#define	cJU_JPBRANCH_U5		cJ1_JPBRANCH_U5
-#define	cJU_JPBRANCH_U6		cJ1_JPBRANCH_U6
-#define	cJU_JPBRANCH_U7		cJ1_JPBRANCH_U7
-#endif
-#define	cJU_JPBRANCH_U		cJ1_JPBRANCH_U
-#ifndef JU_64BIT
-#define	cJU_JPLEAF1		cJ1_JPLEAF1
-#endif
-#define	cJU_JPLEAF2		cJ1_JPLEAF2
-#define	cJU_JPLEAF3		cJ1_JPLEAF3
-#ifdef JU_64BIT
-#define	cJU_JPLEAF4		cJ1_JPLEAF4
-#define	cJU_JPLEAF5		cJ1_JPLEAF5
-#define	cJU_JPLEAF6		cJ1_JPLEAF6
-#define	cJU_JPLEAF7		cJ1_JPLEAF7
-#endif
-#define	cJU_JPLEAF_B1		cJ1_JPLEAF_B1
-//				cJ1_JPFULLPOPU1
-#define	cJU_JPIMMED_1_01	cJ1_JPIMMED_1_01
-#define	cJU_JPIMMED_2_01	cJ1_JPIMMED_2_01
-#define	cJU_JPIMMED_3_01	cJ1_JPIMMED_3_01
-#ifdef JU_64BIT
-#define	cJU_JPIMMED_4_01	cJ1_JPIMMED_4_01
-#define	cJU_JPIMMED_5_01	cJ1_JPIMMED_5_01
-#define	cJU_JPIMMED_6_01	cJ1_JPIMMED_6_01
-#define	cJU_JPIMMED_7_01	cJ1_JPIMMED_7_01
-#endif
-#define	cJU_JPIMMED_1_02	cJ1_JPIMMED_1_02
-#define	cJU_JPIMMED_1_03	cJ1_JPIMMED_1_03
-#define	cJU_JPIMMED_1_04	cJ1_JPIMMED_1_04
-#define	cJU_JPIMMED_1_05	cJ1_JPIMMED_1_05
-#define	cJU_JPIMMED_1_06	cJ1_JPIMMED_1_06
-#define	cJU_JPIMMED_1_07	cJ1_JPIMMED_1_07
-#ifdef JU_64BIT
-//				cJ1_JPIMMED_1_08
-//				cJ1_JPIMMED_1_09
-//				cJ1_JPIMMED_1_10
-//				cJ1_JPIMMED_1_11
-//				cJ1_JPIMMED_1_12
-//				cJ1_JPIMMED_1_13
-//				cJ1_JPIMMED_1_14
-//				cJ1_JPIMMED_1_15
-#endif
-#define	cJU_JPIMMED_2_02	cJ1_JPIMMED_2_02
-#define	cJU_JPIMMED_2_03	cJ1_JPIMMED_2_03
-#ifdef JU_64BIT
-//				cJ1_JPIMMED_2_04
-//				cJ1_JPIMMED_2_05
-//				cJ1_JPIMMED_2_06
-//				cJ1_JPIMMED_2_07
-#endif
-#define	cJU_JPIMMED_3_02	cJ1_JPIMMED_3_02
-#ifdef JU_64BIT
-//				cJ1_JPIMMED_3_03
-//				cJ1_JPIMMED_3_04
-//				cJ1_JPIMMED_3_05
-//				cJ1_JPIMMED_4_02
-//				cJ1_JPIMMED_4_03
-//				cJ1_JPIMMED_5_02
-//				cJ1_JPIMMED_5_03
-//				cJ1_JPIMMED_6_02
-//				cJ1_JPIMMED_7_02
-#endif
-#define	cJU_JPIMMED_CAP		cJ1_JPIMMED_CAP
-
-#else // JUDYL ****************************************************************
-
-#define	cJU_JRPNULL		cJL_JRPNULL
-#define	cJU_JPNULL1		cJL_JPNULL1
-#define	cJU_JPNULL2		cJL_JPNULL2
-#define	cJU_JPNULL3		cJL_JPNULL3
-#ifdef JU_64BIT
-#define	cJU_JPNULL4		cJL_JPNULL4
-#define	cJU_JPNULL5		cJL_JPNULL5
-#define	cJU_JPNULL6		cJL_JPNULL6
-#define	cJU_JPNULL7		cJL_JPNULL7
-#endif
-#define	cJU_JPNULLMAX		cJL_JPNULLMAX
-#define	cJU_JPBRANCH_L2		cJL_JPBRANCH_L2
-#define	cJU_JPBRANCH_L3		cJL_JPBRANCH_L3
-#ifdef JU_64BIT
-#define	cJU_JPBRANCH_L4		cJL_JPBRANCH_L4
-#define	cJU_JPBRANCH_L5		cJL_JPBRANCH_L5
-#define	cJU_JPBRANCH_L6		cJL_JPBRANCH_L6
-#define	cJU_JPBRANCH_L7		cJL_JPBRANCH_L7
-#endif
-#define	cJU_JPBRANCH_L		cJL_JPBRANCH_L
-#define	j__U_BranchBJPPopToWords j__L_BranchBJPPopToWords
-#define	cJU_JPBRANCH_B2		cJL_JPBRANCH_B2
-#define	cJU_JPBRANCH_B3		cJL_JPBRANCH_B3
-#ifdef JU_64BIT
-#define	cJU_JPBRANCH_B4		cJL_JPBRANCH_B4
-#define	cJU_JPBRANCH_B5		cJL_JPBRANCH_B5
-#define	cJU_JPBRANCH_B6		cJL_JPBRANCH_B6
-#define	cJU_JPBRANCH_B7		cJL_JPBRANCH_B7
-#endif
-#define	cJU_JPBRANCH_B		cJL_JPBRANCH_B
-#define	cJU_JPBRANCH_U2		cJL_JPBRANCH_U2
-#define	cJU_JPBRANCH_U3		cJL_JPBRANCH_U3
-#ifdef JU_64BIT
-#define	cJU_JPBRANCH_U4		cJL_JPBRANCH_U4
-#define	cJU_JPBRANCH_U5		cJL_JPBRANCH_U5
-#define	cJU_JPBRANCH_U6		cJL_JPBRANCH_U6
-#define	cJU_JPBRANCH_U7		cJL_JPBRANCH_U7
-#endif
-#define	cJU_JPBRANCH_U		cJL_JPBRANCH_U
-#define	cJU_JPLEAF1		cJL_JPLEAF1
-#define	cJU_JPLEAF2		cJL_JPLEAF2
-#define	cJU_JPLEAF3		cJL_JPLEAF3
-#ifdef JU_64BIT
-#define	cJU_JPLEAF4		cJL_JPLEAF4
-#define	cJU_JPLEAF5		cJL_JPLEAF5
-#define	cJU_JPLEAF6		cJL_JPLEAF6
-#define	cJU_JPLEAF7		cJL_JPLEAF7
-#endif
-#define	cJU_JPLEAF_B1		cJL_JPLEAF_B1
-#define	cJU_JPIMMED_1_01	cJL_JPIMMED_1_01
-#define	cJU_JPIMMED_2_01	cJL_JPIMMED_2_01
-#define	cJU_JPIMMED_3_01	cJL_JPIMMED_3_01
-#ifdef JU_64BIT
-#define	cJU_JPIMMED_4_01	cJL_JPIMMED_4_01
-#define	cJU_JPIMMED_5_01	cJL_JPIMMED_5_01
-#define	cJU_JPIMMED_6_01	cJL_JPIMMED_6_01
-#define	cJU_JPIMMED_7_01	cJL_JPIMMED_7_01
-#endif
-#define	cJU_JPIMMED_1_02	cJL_JPIMMED_1_02
-#define	cJU_JPIMMED_1_03	cJL_JPIMMED_1_03
-#ifdef JU_64BIT
-#define	cJU_JPIMMED_1_04	cJL_JPIMMED_1_04
-#define	cJU_JPIMMED_1_05	cJL_JPIMMED_1_05
-#define	cJU_JPIMMED_1_06	cJL_JPIMMED_1_06
-#define	cJU_JPIMMED_1_07	cJL_JPIMMED_1_07
-#define	cJU_JPIMMED_2_02	cJL_JPIMMED_2_02
-#define	cJU_JPIMMED_2_03	cJL_JPIMMED_2_03
-#define	cJU_JPIMMED_3_02	cJL_JPIMMED_3_02
-#endif
-#define	cJU_JPIMMED_CAP		cJL_JPIMMED_CAP
-
-#endif // JUDYL
-
-
-// ****************************************************************************
-// cJU*_ other than JP types:
-
-#ifdef JUDY1
-
-#define	cJU_LEAFW_MAXPOP1	cJ1_LEAFW_MAXPOP1
-#ifndef JU_64BIT
-#define	cJU_LEAF1_MAXPOP1	cJ1_LEAF1_MAXPOP1
-#endif
-#define	cJU_LEAF2_MAXPOP1	cJ1_LEAF2_MAXPOP1
-#define	cJU_LEAF3_MAXPOP1	cJ1_LEAF3_MAXPOP1
-#ifdef JU_64BIT
-#define	cJU_LEAF4_MAXPOP1	cJ1_LEAF4_MAXPOP1
-#define	cJU_LEAF5_MAXPOP1	cJ1_LEAF5_MAXPOP1
-#define	cJU_LEAF6_MAXPOP1	cJ1_LEAF6_MAXPOP1
-#define	cJU_LEAF7_MAXPOP1	cJ1_LEAF7_MAXPOP1
-#endif
-#define	cJU_IMMED1_MAXPOP1	cJ1_IMMED1_MAXPOP1
-#define	cJU_IMMED2_MAXPOP1	cJ1_IMMED2_MAXPOP1
-#define	cJU_IMMED3_MAXPOP1	cJ1_IMMED3_MAXPOP1
-#ifdef JU_64BIT
-#define	cJU_IMMED4_MAXPOP1	cJ1_IMMED4_MAXPOP1
-#define	cJU_IMMED5_MAXPOP1	cJ1_IMMED5_MAXPOP1
-#define	cJU_IMMED6_MAXPOP1	cJ1_IMMED6_MAXPOP1
-#define	cJU_IMMED7_MAXPOP1	cJ1_IMMED7_MAXPOP1
-#endif
-
-#define	JU_LEAF1POPTOWORDS(Pop1)	J1_LEAF1POPTOWORDS(Pop1)
-#define	JU_LEAF2POPTOWORDS(Pop1)	J1_LEAF2POPTOWORDS(Pop1)
-#define	JU_LEAF3POPTOWORDS(Pop1)	J1_LEAF3POPTOWORDS(Pop1)
-#ifdef JU_64BIT
-#define	JU_LEAF4POPTOWORDS(Pop1)	J1_LEAF4POPTOWORDS(Pop1)
-#define	JU_LEAF5POPTOWORDS(Pop1)	J1_LEAF5POPTOWORDS(Pop1)
-#define	JU_LEAF6POPTOWORDS(Pop1)	J1_LEAF6POPTOWORDS(Pop1)
-#define	JU_LEAF7POPTOWORDS(Pop1)	J1_LEAF7POPTOWORDS(Pop1)
-#endif
-#define	JU_LEAFWPOPTOWORDS(Pop1)	J1_LEAFWPOPTOWORDS(Pop1)
-
-#ifndef JU_64BIT
-#define	JU_LEAF1GROWINPLACE(Pop1)	J1_LEAF1GROWINPLACE(Pop1)
-#endif
-#define	JU_LEAF2GROWINPLACE(Pop1)	J1_LEAF2GROWINPLACE(Pop1)
-#define	JU_LEAF3GROWINPLACE(Pop1)	J1_LEAF3GROWINPLACE(Pop1)
-#ifdef JU_64BIT
-#define	JU_LEAF4GROWINPLACE(Pop1)	J1_LEAF4GROWINPLACE(Pop1)
-#define	JU_LEAF5GROWINPLACE(Pop1)	J1_LEAF5GROWINPLACE(Pop1)
-#define	JU_LEAF6GROWINPLACE(Pop1)	J1_LEAF6GROWINPLACE(Pop1)
-#define	JU_LEAF7GROWINPLACE(Pop1)	J1_LEAF7GROWINPLACE(Pop1)
-#endif
-#define	JU_LEAFWGROWINPLACE(Pop1)	J1_LEAFWGROWINPLACE(Pop1)
-
-#define	j__udyCreateBranchL	j__udy1CreateBranchL
-#define	j__udyCreateBranchB	j__udy1CreateBranchB
-#define	j__udyCreateBranchU	j__udy1CreateBranchU
-#define	j__udyCascade1		j__udy1Cascade1
-#define	j__udyCascade2		j__udy1Cascade2
-#define	j__udyCascade3		j__udy1Cascade3
-#ifdef JU_64BIT
-#define	j__udyCascade4		j__udy1Cascade4
-#define	j__udyCascade5		j__udy1Cascade5
-#define	j__udyCascade6		j__udy1Cascade6
-#define	j__udyCascade7		j__udy1Cascade7
-#endif
-#define	j__udyCascadeL		j__udy1CascadeL
-#define	j__udyInsertBranch	j__udy1InsertBranch
-
-#define	j__udyBranchBToBranchL	j__udy1BranchBToBranchL
-#ifndef JU_64BIT
-#define	j__udyLeafB1ToLeaf1	j__udy1LeafB1ToLeaf1
-#endif
-#define	j__udyLeaf1ToLeaf2	j__udy1Leaf1ToLeaf2
-#define	j__udyLeaf2ToLeaf3	j__udy1Leaf2ToLeaf3
-#ifndef JU_64BIT
-#define	j__udyLeaf3ToLeafW	j__udy1Leaf3ToLeafW
-#else
-#define	j__udyLeaf3ToLeaf4	j__udy1Leaf3ToLeaf4
-#define	j__udyLeaf4ToLeaf5	j__udy1Leaf4ToLeaf5
-#define	j__udyLeaf5ToLeaf6	j__udy1Leaf5ToLeaf6
-#define	j__udyLeaf6ToLeaf7	j__udy1Leaf6ToLeaf7
-#define	j__udyLeaf7ToLeafW	j__udy1Leaf7ToLeafW
-#endif
-
-#define	jpm_t			j1pm_t
-#define	Pjpm_t			Pj1pm_t
-
-#define	jlb_t			j1lb_t
-#define	Pjlb_t			Pj1lb_t
-
-#define	JU_JLB_BITMAP		J1_JLB_BITMAP
-
-#define	j__udyAllocJPM		j__udy1AllocJ1PM
-#define	j__udyAllocJBL		j__udy1AllocJBL
-#define	j__udyAllocJBB		j__udy1AllocJBB
-#define	j__udyAllocJBBJP	j__udy1AllocJBBJP
-#define	j__udyAllocJBU		j__udy1AllocJBU
-#ifndef JU_64BIT
-#define	j__udyAllocJLL1		j__udy1AllocJLL1
-#endif
-#define	j__udyAllocJLL2		j__udy1AllocJLL2
-#define	j__udyAllocJLL3		j__udy1AllocJLL3
-#ifdef JU_64BIT
-#define	j__udyAllocJLL4		j__udy1AllocJLL4
-#define	j__udyAllocJLL5		j__udy1AllocJLL5
-#define	j__udyAllocJLL6		j__udy1AllocJLL6
-#define	j__udyAllocJLL7		j__udy1AllocJLL7
-#endif
-#define	j__udyAllocJLW		j__udy1AllocJLW
-#define	j__udyAllocJLB1		j__udy1AllocJLB1
-#define	j__udyFreeJPM		j__udy1FreeJ1PM
-#define	j__udyFreeJBL		j__udy1FreeJBL
-#define	j__udyFreeJBB		j__udy1FreeJBB
-#define	j__udyFreeJBBJP		j__udy1FreeJBBJP
-#define	j__udyFreeJBU		j__udy1FreeJBU
-#ifndef JU_64BIT
-#define	j__udyFreeJLL1		j__udy1FreeJLL1
-#endif
-#define	j__udyFreeJLL2		j__udy1FreeJLL2
-#define	j__udyFreeJLL3		j__udy1FreeJLL3
-#ifdef JU_64BIT
-#define	j__udyFreeJLL4		j__udy1FreeJLL4
-#define	j__udyFreeJLL5		j__udy1FreeJLL5
-#define	j__udyFreeJLL6		j__udy1FreeJLL6
-#define	j__udyFreeJLL7		j__udy1FreeJLL7
-#endif
-#define	j__udyFreeJLW		j__udy1FreeJLW
-#define	j__udyFreeJLB1		j__udy1FreeJLB1
-#define	j__udyFreeSM		j__udy1FreeSM
-
-#define	j__uMaxWords		j__u1MaxWords
-
-#ifdef DEBUG
-#define	JudyCheckPop		Judy1CheckPop
-#endif
-
-#else // JUDYL ****************************************************************
-
-#define	cJU_LEAFW_MAXPOP1	cJL_LEAFW_MAXPOP1
-#define	cJU_LEAF1_MAXPOP1	cJL_LEAF1_MAXPOP1
-#define	cJU_LEAF2_MAXPOP1	cJL_LEAF2_MAXPOP1
-#define	cJU_LEAF3_MAXPOP1	cJL_LEAF3_MAXPOP1
-#ifdef JU_64BIT
-#define	cJU_LEAF4_MAXPOP1	cJL_LEAF4_MAXPOP1
-#define	cJU_LEAF5_MAXPOP1	cJL_LEAF5_MAXPOP1
-#define	cJU_LEAF6_MAXPOP1	cJL_LEAF6_MAXPOP1
-#define	cJU_LEAF7_MAXPOP1	cJL_LEAF7_MAXPOP1
-#endif
-#define	cJU_IMMED1_MAXPOP1	cJL_IMMED1_MAXPOP1
-#define	cJU_IMMED2_MAXPOP1	cJL_IMMED2_MAXPOP1
-#define	cJU_IMMED3_MAXPOP1	cJL_IMMED3_MAXPOP1
-#ifdef JU_64BIT
-#define	cJU_IMMED4_MAXPOP1	cJL_IMMED4_MAXPOP1
-#define	cJU_IMMED5_MAXPOP1	cJL_IMMED5_MAXPOP1
-#define	cJU_IMMED6_MAXPOP1	cJL_IMMED6_MAXPOP1
-#define	cJU_IMMED7_MAXPOP1	cJL_IMMED7_MAXPOP1
-#endif
-
-#define	JU_LEAF1POPTOWORDS(Pop1)	JL_LEAF1POPTOWORDS(Pop1)
-#define	JU_LEAF2POPTOWORDS(Pop1)	JL_LEAF2POPTOWORDS(Pop1)
-#define	JU_LEAF3POPTOWORDS(Pop1)	JL_LEAF3POPTOWORDS(Pop1)
-#ifdef JU_64BIT
-#define	JU_LEAF4POPTOWORDS(Pop1)	JL_LEAF4POPTOWORDS(Pop1)
-#define	JU_LEAF5POPTOWORDS(Pop1)	JL_LEAF5POPTOWORDS(Pop1)
-#define	JU_LEAF6POPTOWORDS(Pop1)	JL_LEAF6POPTOWORDS(Pop1)
-#define	JU_LEAF7POPTOWORDS(Pop1)	JL_LEAF7POPTOWORDS(Pop1)
-#endif
-#define	JU_LEAFWPOPTOWORDS(Pop1)	JL_LEAFWPOPTOWORDS(Pop1)
-
-#define	JU_LEAF1GROWINPLACE(Pop1)	JL_LEAF1GROWINPLACE(Pop1)
-#define	JU_LEAF2GROWINPLACE(Pop1)	JL_LEAF2GROWINPLACE(Pop1)
-#define	JU_LEAF3GROWINPLACE(Pop1)	JL_LEAF3GROWINPLACE(Pop1)
-#ifdef JU_64BIT
-#define	JU_LEAF4GROWINPLACE(Pop1)	JL_LEAF4GROWINPLACE(Pop1)
-#define	JU_LEAF5GROWINPLACE(Pop1)	JL_LEAF5GROWINPLACE(Pop1)
-#define	JU_LEAF6GROWINPLACE(Pop1)	JL_LEAF6GROWINPLACE(Pop1)
-#define	JU_LEAF7GROWINPLACE(Pop1)	JL_LEAF7GROWINPLACE(Pop1)
-#endif
-#define	JU_LEAFWGROWINPLACE(Pop1)	JL_LEAFWGROWINPLACE(Pop1)
-
-#define	j__udyCreateBranchL	j__udyLCreateBranchL
-#define	j__udyCreateBranchB	j__udyLCreateBranchB
-#define	j__udyCreateBranchU	j__udyLCreateBranchU
-#define	j__udyCascade1		j__udyLCascade1
-#define	j__udyCascade2		j__udyLCascade2
-#define	j__udyCascade3		j__udyLCascade3
-#ifdef JU_64BIT
-#define	j__udyCascade4		j__udyLCascade4
-#define	j__udyCascade5		j__udyLCascade5
-#define	j__udyCascade6		j__udyLCascade6
-#define	j__udyCascade7		j__udyLCascade7
-#endif
-#define	j__udyCascadeL		j__udyLCascadeL
-#define	j__udyInsertBranch	j__udyLInsertBranch
-
-#define	j__udyBranchBToBranchL	j__udyLBranchBToBranchL
-#define	j__udyLeafB1ToLeaf1	j__udyLLeafB1ToLeaf1
-#define	j__udyLeaf1ToLeaf2	j__udyLLeaf1ToLeaf2
-#define	j__udyLeaf2ToLeaf3	j__udyLLeaf2ToLeaf3
-#ifndef JU_64BIT
-#define	j__udyLeaf3ToLeafW	j__udyLLeaf3ToLeafW
-#else
-#define	j__udyLeaf3ToLeaf4	j__udyLLeaf3ToLeaf4
-#define	j__udyLeaf4ToLeaf5	j__udyLLeaf4ToLeaf5
-#define	j__udyLeaf5ToLeaf6	j__udyLLeaf5ToLeaf6
-#define	j__udyLeaf6ToLeaf7	j__udyLLeaf6ToLeaf7
-#define	j__udyLeaf7ToLeafW	j__udyLLeaf7ToLeafW
-#endif
-
-#define	jpm_t			jLpm_t
-#define	Pjpm_t			PjLpm_t
-
-#define	jlb_t			jLlb_t
-#define	Pjlb_t			PjLlb_t
-
-#define	JU_JLB_BITMAP		JL_JLB_BITMAP
-
-#define	j__udyAllocJPM		j__udyLAllocJLPM
-#define	j__udyAllocJBL		j__udyLAllocJBL
-#define	j__udyAllocJBB		j__udyLAllocJBB
-#define	j__udyAllocJBBJP	j__udyLAllocJBBJP
-#define	j__udyAllocJBU		j__udyLAllocJBU
-#define	j__udyAllocJLL1		j__udyLAllocJLL1
-#define	j__udyAllocJLL2		j__udyLAllocJLL2
-#define	j__udyAllocJLL3		j__udyLAllocJLL3
-#ifdef JU_64BIT
-#define	j__udyAllocJLL4		j__udyLAllocJLL4
-#define	j__udyAllocJLL5		j__udyLAllocJLL5
-#define	j__udyAllocJLL6		j__udyLAllocJLL6
-#define	j__udyAllocJLL7		j__udyLAllocJLL7
-#endif
-#define	j__udyAllocJLW		j__udyLAllocJLW
-#define	j__udyAllocJLB1		j__udyLAllocJLB1
-//				j__udyLAllocJV
-#define	j__udyFreeJPM		j__udyLFreeJLPM
-#define	j__udyFreeJBL		j__udyLFreeJBL
-#define	j__udyFreeJBB		j__udyLFreeJBB
-#define	j__udyFreeJBBJP		j__udyLFreeJBBJP
-#define	j__udyFreeJBU		j__udyLFreeJBU
-#define	j__udyFreeJLL1		j__udyLFreeJLL1
-#define	j__udyFreeJLL2		j__udyLFreeJLL2
-#define	j__udyFreeJLL3		j__udyLFreeJLL3
-#ifdef JU_64BIT
-#define	j__udyFreeJLL4		j__udyLFreeJLL4
-#define	j__udyFreeJLL5		j__udyLFreeJLL5
-#define	j__udyFreeJLL6		j__udyLFreeJLL6
-#define	j__udyFreeJLL7		j__udyLFreeJLL7
-#endif
-#define	j__udyFreeJLW		j__udyLFreeJLW
-#define	j__udyFreeJLB1		j__udyLFreeJLB1
-#define	j__udyFreeSM		j__udyLFreeSM
-//				j__udyLFreeJV
-
-#define	j__uMaxWords		j__uLMaxWords
-
-#ifdef DEBUG
-#define	JudyCheckPop		JudyLCheckPop
-#endif
-
-#endif // JUDYL
-
-#endif // _JUDYPRIVATE1L_INCLUDED
diff --git a/libs/klib/judy/JudyPrivateBranch.h b/libs/klib/judy/JudyPrivateBranch.h
deleted file mode 100644
index 4e0dda4..0000000
--- a/libs/klib/judy/JudyPrivateBranch.h
+++ /dev/null
@@ -1,777 +0,0 @@
-#ifndef _JUDY_PRIVATE_BRANCH_INCLUDED
-#define _JUDY_PRIVATE_BRANCH_INCLUDED
-// _________________
-//
-// Copyright (C) 2000 - 2002 Hewlett-Packard Company
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the term of the GNU Lesser 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 Lesser General Public License
-// for more details.
-//
-// You should have received a copy of the GNU Lesser 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
-// _________________
-
-// Header file for all Judy sources, for global but private (non-exported)
-// declarations specific to branch support.
-//
-// See also the "Judy Shop Manual" (try judy/doc/int/JudyShopManual.*).
-
-
-// ****************************************************************************
-// JUDY POINTER (JP) SUPPORT
-// ****************************************************************************
-//
-// This "rich pointer" object is pivotal to Judy execution.
-//
-// JP CONTAINING OTHER THAN IMMEDIATE INDEXES:
-//
-// If the JP points to a linear or bitmap leaf, jp_DcdPopO contains the
-// Population-1 in LSbs and Decode (Dcd) bytes in the MSBs.  (In practice the
-// Decode bits are masked off while accessing the Pop0 bits.)
-//
-// The Decode Size, the number of Dcd bytes available, is encoded in jpo_Type.
-// It can also be thought of as the number of states "skipped" in the SM, where
-// each state decodes 8 bits = 1 byte.
-//
-// TBD:  Dont need two structures, except possibly to force jp_Type to highest
-// address!
-//
-// Note:  The jpo_u union is not required by HP-UX or Linux but Win32 because
-// the cl.exe compiler otherwise refuses to pack a bitfield (DcdPopO) with
-// anything else, even with the -Zp option.  This is pretty ugly, but
-// fortunately portable, and its all hide-able by macros (see below).
-
-typedef struct J_UDY_POINTER_OTHERS      // JPO.
-        {
-            Word_t      j_po_Addr;       // first word:  Pjp_t, Word_t, etc.
-            union {
-//              Word_t  j_po_DcdPop0:cJU_BITSPERWORD-cJU_BITSPERBYTE;
-                uint8_t j_po_DcdP0[sizeof(Word_t) - 1];
-                uint8_t j_po_Bytes[sizeof(Word_t)];     // last byte = jp_Type.
-            } jpo_u;
-        } jpo_t;
-
-
-// JP CONTAINING IMMEDIATE INDEXES:
-//
-// j_pi_1Index[] plus j_pi_LIndex[] together hold as many N-byte (1..3-byte
-// [1..7-byte]) Indexes as will fit in sizeof(jpi_t) less 1 byte for j_pi_Type
-// (that is, 7..1 [15..1] Indexes).
-//
-// For Judy1, j_pi_1Index[] is used and j_pi_LIndex[] is not used.
-// For JudyL, j_pi_LIndex[] is used and j_pi_1Index[] is not used.
-//
-// Note:  Actually when Pop1 = 1, jpi_t is not used, and the least bytes of the
-// single Index are stored in j_po_DcdPopO, for both Judy1 and JudyL, so for
-// JudyL the j_po_Addr field can hold the target value.
-//
-// TBD:  Revise this structure to not overload j_po_DcdPopO this way?  The
-// current arrangement works, its just confusing.
-
-typedef struct _JUDY_POINTER_IMMED      // JPI.
-        {
-            uint8_t j_pi_1Index[sizeof(Word_t)];        // see above.
-            uint8_t j_pi_LIndex[sizeof(Word_t) - 1];    // see above.
-            uint8_t j_pi_Type;                  // JP type, 1 of cJ*_JPIMMED*.
-        } jpi_t;
-
-
-// UNION OF JP TYPES:
-//
-// A branch is an array of cJU_BRANCHUNUMJPS (256) of this object, or an
-// alternate data type such as:  A linear branch which is a list of 2..7 JPs,
-// or a bitmap branch which contains 8 lists of 0..32 JPs.  JPs reside only in
-// branches of a Judy SM.
-
-typedef union J_UDY_POINTER             // JP.
-        {
-            jpo_t j_po;                 // other than immediate indexes.
-            jpi_t j_pi;                 // immediate indexes.
-        } jp_t, *Pjp_t;
-
-// For coding convenience:
-//
-// Note, jp_Type has the same bits in jpo_t and jpi_t.
-
-#define jp_1Index  j_pi.j_pi_1Index     // for storing Indexes in first  word.
-#define jp_LIndex  j_pi.j_pi_LIndex     // for storing Indexes in second word.
-#define jp_Addr    j_po.j_po_Addr
-//#define       jp_DcdPop0 j_po.jpo_u.j_po_DcdPop0
-#define jp_Type    j_po.jpo_u.j_po_Bytes[sizeof(Word_t) - 1]
-#define jp_DcdP0   j_po.jpo_u.j_po_DcdP0
-
-
-// ****************************************************************************
-// JUDY POINTER (JP) -- RELATED MACROS AND CONSTANTS
-// ****************************************************************************
-
-// EXTRACT VALUES FROM JP:
-//
-// Masks for the bytes in the Dcd and Pop0 parts of jp_DcdPopO:
-//
-// cJU_DCDMASK() consists of a mask that excludes the (LSb) Pop0 bytes and
-// also, just to be safe, the top byte of the word, since jp_DcdPopO is 1 byte
-// less than a full word.
-//
-// Note:  These are constant macros (cJU) because cPopBytes should be a
-// constant.  Also note cPopBytes == state in the SM.
-
-#define cJU_POP0MASK(cPopBytes) JU_LEASTBYTESMASK(cPopBytes)
-
-#define cJU_DCDMASK(cPopBytes) \
-        ((cJU_ALLONES >> cJU_BITSPERBYTE) & (~cJU_POP0MASK(cPopBytes)))
-
-// Mask off the high byte from INDEX to it can be compared to DcdPopO:
-
-#define JU_TRIMTODCDSIZE(INDEX) ((cJU_ALLONES >> cJU_BITSPERBYTE) & (INDEX))
-
-// Get from jp_DcdPopO the Pop0 for various branch JP Types:
-//
-// Note:  There are no simple macros for cJU_BRANCH* Types because their
-// populations must be added up and dont reside in an already-calculated
-// place.
-
-#define JU_JPBRANCH_POP0(PJP,cPopBytes) \
-        (JU_JPDCDPOP0(PJP) & cJU_POP0MASK(cPopBytes))
-
-// METHOD FOR DETERMINING IF OBJECTS HAVE ROOM TO GROW:
-//
-// J__U_GROWCK() is a generic method to determine if an object can grow in
-// place, based on whether the next population size (one more) would use the
-// same space.
-
-#define J__U_GROWCK(POP1,MAXPOP1,POPTOWORDS) \
-        (((POP1) != (MAXPOP1)) && (POPTOWORDS[POP1] == POPTOWORDS[(POP1) + 1]))
-
-#define JU_BRANCHBJPGROWINPLACE(NumJPs) \
-        J__U_GROWCK(NumJPs, cJU_BITSPERSUBEXPB, j__U_BranchBJPPopToWords)
-
-
-// DETERMINE IF AN INDEX IS (NOT) IN A JPS EXPANSE:
-
-#define JU_DCDNOTMATCHINDEX(INDEX,PJP,POP0BYTES) \
-        (((INDEX) ^ JU_JPDCDPOP0(PJP)) & cJU_DCDMASK(POP0BYTES))
-
-
-// NUMBER OF JPs IN AN UNCOMPRESSED BRANCH:
-//
-// An uncompressed branch is simply an array of 256 Judy Pointers (JPs).  It is
-// a minimum cacheline fill object.  Define it here before its first needed.
-
-#define cJU_BRANCHUNUMJPS  cJU_SUBEXPPERSTATE
-
-
-// ****************************************************************************
-// JUDY BRANCH LINEAR (JBL) SUPPORT
-// ****************************************************************************
-//
-// A linear branch is a way of compressing empty expanses (null JPs) out of an
-// uncompressed 256-way branch, when the number of populated expanses is so
-// small that even a bitmap branch is excessive.
-//
-// The maximum number of JPs in a Judy linear branch:
-//
-// Note:  This number results in a 1-cacheline sized structure.  Previous
-// versions had a larger struct so a linear branch didnt become a bitmap
-// branch until the memory consumed was even, but for speed, its better to
-// switch "sooner" and keep a linear branch fast.
-
-#define cJU_BRANCHLMAXJPS 7
-
-
-// LINEAR BRANCH STRUCT:
-//
-// 1-byte count, followed by array of byte-sized expanses, followed by JPs.
-
-typedef struct J__UDY_BRANCH_LINEAR
-        {
-            uint8_t jbl_NumJPs;                     // num of JPs (Pjp_t), 1..N.
-            uint8_t jbl_Expanse[cJU_BRANCHLMAXJPS]; // 1..7 MSbs of pop exps.
-            jp_t    jbl_jp     [cJU_BRANCHLMAXJPS]; // JPs for populated exps.
-        } jbl_t, * Pjbl_t;
-
-
-// ****************************************************************************
-// JUDY BRANCH BITMAP (JBB) SUPPORT
-// ****************************************************************************
-//
-// A bitmap branch is a way of compressing empty expanses (null JPs) out of
-// uncompressed 256-way branch.  This costs 1 additional cache line fill, but
-// can save a lot of memory when it matters most, near the leaves, and
-// typically there will be only one at most in the path to any Index (leaf).
-//
-// The bitmap indicates which of the cJU_BRANCHUNUMJPS (256) JPs in the branch
-// are NOT null, that is, their expanses are populated.  The jbb_t also
-// contains N pointers to "mini" Judy branches ("subexpanses") of up to M JPs
-// each (see BITMAP_BRANCHMxN, for example, BITMAP_BRANCH32x8), where M x N =
-// cJU_BRANCHUNUMJPS.  These are dynamically allocated and never contain
-// cJ*_JPNULL* jp_Types.  An empty subexpanse is represented by no bit sets in
-// the corresponding subexpanse bitmap, in which case the corresponding
-// jbbs_Pjp pointers value is unused.
-//
-// Note that the number of valid JPs in each 1-of-N subexpanses is determined
-// by POPULATION rather than by EXPANSE -- the desired outcome to save memory
-// when near the leaves.  Note that the memory required for 185 JPs is about as
-// much as an uncompressed 256-way branch, therefore 184 is set as the maximum.
-// However, it is expected that a conversion to an uncompressed 256-way branch
-// will normally take place before this limit is reached for other reasons,
-// such as improving performance when the "wasted" memory is well amortized by
-// the population under the branch, preserving an acceptable overall
-// bytes/Index in the Judy array.
-//
-// The number of pointers to arrays of JPs in the Judy bitmap branch:
-//
-// Note:  The numbers below are the same in both 32 and 64 bit systems.
-
-#define cJU_BRANCHBMAXJPS  184          // maximum JPs for bitmap branches.
-
-// Convenience wrappers for referencing BranchB bitmaps or JP subarray
-// pointers:
-//
-// Note:  JU_JBB_PJP produces a "raw" memory address that must pass through
-// P_JP before use, except when freeing memory:
-
-#define JU_JBB_BITMAP(Pjbb, SubExp)  ((Pjbb)->jbb_jbbs[SubExp].jbbs_Bitmap)
-#define JU_JBB_PJP(   Pjbb, SubExp)  ((Pjbb)->jbb_jbbs[SubExp].jbbs_Pjp)
-
-#define JU_SUBEXPB(Digit) (((Digit) / cJU_BITSPERSUBEXPB) & (cJU_NUMSUBEXPB-1))
-
-#define JU_BITMAPTESTB(Pjbb, Index) \
-        (JU_JBB_BITMAP(Pjbb, JU_SUBEXPB(Index)) &  JU_BITPOSMASKB(Index))
-
-#define JU_BITMAPSETB(Pjbb, Index)  \
-        (JU_JBB_BITMAP(Pjbb, JU_SUBEXPB(Index)) |= JU_BITPOSMASKB(Index))
-
-// Note:  JU_BITMAPCLEARB is not defined because the code does it a faster way.
-
-typedef struct J__UDY_BRANCH_BITMAP_SUBEXPANSE
-        {
-            BITMAPB_t jbbs_Bitmap;
-            Pjp_t     jbbs_Pjp;
-
-        } jbbs_t;
-
-typedef struct J__UDY_BRANCH_BITMAP
-        {
-            jbbs_t jbb_jbbs   [cJU_NUMSUBEXPB];
-#ifdef SUBEXPCOUNTS
-            Word_t jbb_subPop1[cJU_NUMSUBEXPB];
-#endif
-        } jbb_t, * Pjbb_t;
-
-#define JU_BRANCHJP_NUMJPSTOWORDS(NumJPs) (j__U_BranchBJPPopToWords[NumJPs])
-
-#ifdef SUBEXPCOUNTS
-#define cJU_NUMSUBEXPU  16      // number of subexpanse counts.
-#endif
-
-
-// ****************************************************************************
-// JUDY BRANCH UNCOMPRESSED (JBU) SUPPORT
-// ****************************************************************************
-
-// Convenience wrapper for referencing BranchU JPs:
-//
-// Note:  This produces a non-"raw" address already passed through P_JBU().
-
-#define JU_JBU_PJP(Pjp,Index,Level) \
-        (&((P_JBU((Pjp)->jp_Addr))->jbu_jp[JU_DIGITATSTATE(Index, Level)]))
-#define JU_JBU_PJP0(Pjp) \
-        (&((P_JBU((Pjp)->jp_Addr))->jbu_jp[0]))
-
-typedef struct J__UDY_BRANCH_UNCOMPRESSED
-        {
-            jp_t   jbu_jp     [cJU_BRANCHUNUMJPS];  // JPs for populated exp.
-#ifdef SUBEXPCOUNTS
-            Word_t jbu_subPop1[cJU_NUMSUBEXPU];
-#endif
-        } jbu_t, * Pjbu_t;
-
-
-// ****************************************************************************
-// OTHER SUPPORT FOR JUDY STATE MACHINES (SMs)
-// ****************************************************************************
-
-// OBJECT SIZES IN WORDS:
-//
-// Word_ts per various JudyL structures that have constant sizes.
-// cJU_WORDSPERJP should always be 2; this is fundamental to the Judy
-// structures.
-
-#define cJU_WORDSPERJP (sizeof(jp_t)   / cJU_BYTESPERWORD)
-#define cJU_WORDSPERCL (cJU_BYTESPERCL / cJU_BYTESPERWORD)
-
-
-// OPPORTUNISTIC UNCOMPRESSION:
-//
-// Define populations at which a BranchL or BranchB must convert to BranchU.
-// Earlier conversion is possible with good memory efficiency -- see below.
-
-#ifndef NO_BRANCHU
-
-// Max population below BranchL, then convert to BranchU:
-
-#define JU_BRANCHL_MAX_POP      1000
-
-// Minimum global population increment before next conversion of a BranchB to a
-// BranchU:
-//
-// This is was done to allow malloc() to coalesce memory before the next big
-// (~512 words) allocation.
-
-#define JU_BTOU_POP_INCREMENT    300
-
-// Min/max population below BranchB, then convert to BranchU:
-
-#define JU_BRANCHB_MIN_POP       135
-#define JU_BRANCHB_MAX_POP       750
-
-#else // NO_BRANCHU
-
-// These are set up to have conservative conversion schedules to BranchU:
-
-#define JU_BRANCHL_MAX_POP      (-1UL)
-#define JU_BTOU_POP_INCREMENT      300
-#define JU_BRANCHB_MIN_POP        1000
-#define JU_BRANCHB_MAX_POP      (-1UL)
-
-#endif // NO_BRANCHU
-
-
-// MISCELLANEOUS MACROS:
-
-// Get N most significant bits from the shifted Index word:
-//
-// As Index words are decoded, they are shifted left so only relevant,
-// undecoded Index bits remain.
-
-#define JU_BITSFROMSFTIDX(SFTIDX, N)  ((SFTIDX) >> (cJU_BITSPERWORD - (N)))
-
-// TBD:  I have my doubts about the necessity of these macros (dlb):
-
-// Produce 1-digit mask at specified state:
-
-#define cJU_MASKATSTATE(State)  ((Word_t)0xff << (((State) - 1) * cJU_BITSPERBYTE))
-
-// Get byte (digit) from Index at the specified state, right justified:
-//
-// Note:  State must be 1..cJU_ROOTSTATE, and Digits must be 1..(cJU_ROOTSTATE
-// - 1), but theres no way to assert these within an expression.
-
-#define JU_DIGITATSTATE(Index,cState) \
-         ((uint8_t)((Index) >> (((cState) - 1) * cJU_BITSPERBYTE)))
-
-// Similarly, place byte (digit) at correct position for the specified state:
-//
-// Note:  Cast digit to a Word_t first so there are no complaints or problems
-// about shifting it more than 32 bits on a 64-bit system, say, when it is a
-// uint8_t from jbl_Expanse[].  (Believe it or not, the C standard says to
-// promote an unsigned char to a signed int; -Ac does not do this, but -Ae
-// does.)
-//
-// Also, to make lint happy, cast the whole result again because apparently
-// shifting a Word_t does not result in a Word_t!
-
-#define JU_DIGITTOSTATE(Digit,cState) \
-        ((Word_t) (((Word_t) (Digit)) << (((cState) - 1) * cJU_BITSPERBYTE)))
-
-#endif // ! _JUDY_PRIVATE_BRANCH_INCLUDED
-
-
-#ifdef TEST_INSDEL
-
-// ****************************************************************************
-// TEST CODE FOR INSERT/DELETE MACROS
-// ****************************************************************************
-//
-// To use this, compile a temporary *.c file containing:
-//
-//      #define DEBUG
-//      #define JUDY_ASSERT
-//      #define TEST_INSDEL
-//      #include "JudyPrivate.h"
-//      #include "JudyPrivateBranch.h"
-//
-// Use a command like this:  cc -Ae +DD64 -I. -I JudyCommon -o t t.c
-// For best results, include +DD64 on a 64-bit system.
-//
-// This test code exercises some tricky macros, but the output must be studied
-// manually to verify it.  Assume that for even-index testing, whole words
-// (Word_t) suffices.
-
-#include <stdio.h>
-
-#define INDEXES 3               // in each array.
-
-
-// ****************************************************************************
-// I N I T
-//
-// Set up variables for next test.  See usage.
-
-FUNCTION void Init (
-        int       base,
-        PWord_t   PeIndex,
-        PWord_t   PoIndex,
-        PWord_t   Peleaf,       // always whole words.
-#ifndef JU_64BIT
-        uint8_t * Poleaf3)
-#else
-        uint8_t * Poleaf3,
-        uint8_t * Poleaf5,
-        uint8_t * Poleaf6,
-        uint8_t * Poleaf7)
-#endif
-{
-        int offset;
-
-        *PeIndex = 99;
-
-        for (offset = 0; offset <= INDEXES; ++offset)
-            Peleaf[offset] = base + offset;
-
-        for (offset = 0; offset < (INDEXES + 1) * 3; ++offset)
-            Poleaf3[offset] = base + offset;
-
-#ifndef JU_64BIT
-        *PoIndex = (91 << 24) | (92 << 16) | (93 << 8) | 94;
-#else
-
-        *PoIndex = (91L << 56) | (92L << 48) | (93L << 40) | (94L << 32)
-                 | (95L << 24) | (96L << 16) | (97L <<  8) |  98L;
-
-        for (offset = 0; offset < (INDEXES + 1) * 5; ++offset)
-            Poleaf5[offset] = base + offset;
-
-        for (offset = 0; offset < (INDEXES + 1) * 6; ++offset)
-            Poleaf6[offset] = base + offset;
-
-        for (offset = 0; offset < (INDEXES + 1) * 7; ++offset)
-            Poleaf7[offset] = base + offset;
-#endif
-
-} // Init()
-
-
-// ****************************************************************************
-// P R I N T   L E A F
-//
-// Print the byte values in a leaf.
-
-FUNCTION void PrintLeaf (
-        char *    Label,        // for output.
-        int       IOffset,      // insertion offset in array.
-        int       Indsize,      // index size in bytes.
-        uint8_t * PLeaf)        // array of Index bytes.
-{
-        int       offset;       // in PLeaf.
-        int       byte;         // in one word.
-
-        (void) printf("%s %u: ", Label, IOffset);
-
-        for (offset = 0; offset <= INDEXES; ++offset)
-        {
-            for (byte = 0; byte < Indsize; ++byte)
-                (void) printf("%2d", PLeaf[(offset * Indsize) + byte]);
-
-            (void) printf(" ");
-        }
-
-        (void) printf("\n");
-
-} // PrintLeaf()
-
-
-// ****************************************************************************
-// M A I N
-//
-// Test program.
-
-FUNCTION main()
-{
-        Word_t  eIndex;                         // even, to insert.
-        Word_t  oIndex;                         // odd,  to insert.
-        Word_t  eleaf [ INDEXES + 1];           // even leaf, index size 4.
-        uint8_t oleaf3[(INDEXES + 1) * 3];      // odd leaf,  index size 3.
-#ifdef JU_64BIT
-        uint8_t oleaf5[(INDEXES + 1) * 5];      // odd leaf,  index size 5.
-        uint8_t oleaf6[(INDEXES + 1) * 6];      // odd leaf,  index size 6.
-        uint8_t oleaf7[(INDEXES + 1) * 7];      // odd leaf,  index size 7.
-#endif
-        Word_t  eleaf_2 [ INDEXES + 1];         // same, but second arrays:
-        uint8_t oleaf3_2[(INDEXES + 1) * 3];
-#ifdef JU_64BIT
-        uint8_t oleaf5_2[(INDEXES + 1) * 5];
-        uint8_t oleaf6_2[(INDEXES + 1) * 6];
-        uint8_t oleaf7_2[(INDEXES + 1) * 7];
-#endif
-        int     ioffset;                // index insertion offset.
-
-#ifndef JU_64BIT
-#define INIT        Init( 0, & eIndex, & oIndex, eleaf,   oleaf3)
-#define INIT2 INIT; Init(50, & eIndex, & oIndex, eleaf_2, oleaf3_2)
-#else
-#define INIT        Init( 0, & eIndex, & oIndex, eleaf,   oleaf3, \
-                         oleaf5,   oleaf6,   oleaf7)
-#define INIT2 INIT; Init(50, & eIndex, & oIndex, eleaf_2, oleaf3_2, \
-                         oleaf5_2, oleaf6_2, oleaf7_2)
-#endif
-
-#define WSIZE sizeof (Word_t)           // shorthand.
-
-#ifdef PRINTALL                 // to turn on "noisy" printouts.
-#define PRINTLEAF(Label,IOffset,Indsize,PLeaf) \
-        PrintLeaf(Label,IOffset,Indsize,PLeaf)
-#else
-#define PRINTLEAF(Label,IOffset,Indsize,PLeaf)  \
-        if (ioffset == 0)                       \
-        PrintLeaf(Label,IOffset,Indsize,PLeaf)
-#endif
-
-        (void) printf(
-"In each case, tests operate on an initial array of %d indexes.  Even-index\n"
-"tests set index values to 0,1,2...; odd-index tests set byte values to\n"
-"0,1,2...  Inserted indexes have a value of 99 or else byte values 91,92,...\n",
-                        INDEXES);
-
-        (void) puts("\nJU_INSERTINPLACE():");
-
-        for (ioffset = 0; ioffset <= INDEXES; ++ioffset)
-        {
-            INIT;
-            PRINTLEAF("Before", ioffset, WSIZE, (uint8_t *) eleaf);
-            JU_INSERTINPLACE(eleaf, INDEXES, ioffset, eIndex);
-            PrintLeaf("After ", ioffset, WSIZE, (uint8_t *) eleaf);
-        }
-
-        (void) puts("\nJU_INSERTINPLACE3():");
-
-        for (ioffset = 0; ioffset <= INDEXES; ++ioffset)
-        {
-            INIT;
-            PRINTLEAF("Before", ioffset, 3, oleaf3);
-            JU_INSERTINPLACE3(oleaf3, INDEXES, ioffset, oIndex);
-            PrintLeaf("After ", ioffset, 3, oleaf3);
-        }
-
-#ifdef JU_64BIT
-        (void) puts("\nJU_INSERTINPLACE5():");
-
-        for (ioffset = 0; ioffset <= INDEXES; ++ioffset)
-        {
-            INIT;
-            PRINTLEAF("Before", ioffset, 5, oleaf5);
-            JU_INSERTINPLACE5(oleaf5, INDEXES, ioffset, oIndex);
-            PrintLeaf("After ", ioffset, 5, oleaf5);
-        }
-
-        (void) puts("\nJU_INSERTINPLACE6():");
-
-        for (ioffset = 0; ioffset <= INDEXES; ++ioffset)
-        {
-            INIT;
-            PRINTLEAF("Before", ioffset, 6, oleaf6);
-            JU_INSERTINPLACE6(oleaf6, INDEXES, ioffset, oIndex);
-            PrintLeaf("After ", ioffset, 6, oleaf6);
-        }
-
-        (void) puts("\nJU_INSERTINPLACE7():");
-
-        for (ioffset = 0; ioffset <= INDEXES; ++ioffset)
-        {
-            INIT;
-            PRINTLEAF("Before", ioffset, 7, oleaf7);
-            JU_INSERTINPLACE7(oleaf7, INDEXES, ioffset, oIndex);
-            PrintLeaf("After ", ioffset, 7, oleaf7);
-        }
-#endif // JU_64BIT
-
-        (void) puts("\nJU_DELETEINPLACE():");
-
-        for (ioffset = 0; ioffset < INDEXES; ++ioffset)
-        {
-            INIT;
-            PRINTLEAF("Before", ioffset, WSIZE, (uint8_t *) eleaf);
-            JU_DELETEINPLACE(eleaf, INDEXES, ioffset);
-            PrintLeaf("After ", ioffset, WSIZE, (uint8_t *) eleaf);
-        }
-
-        (void) puts("\nJU_DELETEINPLACE_ODD(3):");
-
-        for (ioffset = 0; ioffset < INDEXES; ++ioffset)
-        {
-            INIT;
-            PRINTLEAF("Before", ioffset, 3, oleaf3);
-            JU_DELETEINPLACE_ODD(oleaf3, INDEXES, ioffset, 3);
-            PrintLeaf("After ", ioffset, 3, oleaf3);
-        }
-
-#ifdef JU_64BIT
-        (void) puts("\nJU_DELETEINPLACE_ODD(5):");
-
-        for (ioffset = 0; ioffset < INDEXES; ++ioffset)
-        {
-            INIT;
-            PRINTLEAF("Before", ioffset, 5, oleaf5);
-            JU_DELETEINPLACE_ODD(oleaf5, INDEXES, ioffset, 5);
-            PrintLeaf("After ", ioffset, 5, oleaf5);
-        }
-
-        (void) puts("\nJU_DELETEINPLACE_ODD(6):");
-
-        for (ioffset = 0; ioffset < INDEXES; ++ioffset)
-        {
-            INIT;
-            PRINTLEAF("Before", ioffset, 6, oleaf6);
-            JU_DELETEINPLACE_ODD(oleaf6, INDEXES, ioffset, 6);
-            PrintLeaf("After ", ioffset, 6, oleaf6);
-        }
-
-        (void) puts("\nJU_DELETEINPLACE_ODD(7):");
-
-        for (ioffset = 0; ioffset < INDEXES; ++ioffset)
-        {
-            INIT;
-            PRINTLEAF("Before", ioffset, 7, oleaf7);
-            JU_DELETEINPLACE_ODD(oleaf7, INDEXES, ioffset, 7);
-            PrintLeaf("After ", ioffset, 7, oleaf7);
-        }
-#endif // JU_64BIT
-
-        (void) puts("\nJU_INSERTCOPY():");
-
-        for (ioffset = 0; ioffset <= INDEXES; ++ioffset)
-        {
-            INIT2;
-            PRINTLEAF("Before, src ", ioffset, WSIZE, (uint8_t *) eleaf);
-            PRINTLEAF("Before, dest", ioffset, WSIZE, (uint8_t *) eleaf_2);
-            JU_INSERTCOPY(eleaf_2, eleaf, INDEXES, ioffset, eIndex);
-            PRINTLEAF("After,  src ", ioffset, WSIZE, (uint8_t *) eleaf);
-            PrintLeaf("After,  dest", ioffset, WSIZE, (uint8_t *) eleaf_2);
-        }
-
-        (void) puts("\nJU_INSERTCOPY3():");
-
-        for (ioffset = 0; ioffset <= INDEXES; ++ioffset)
-        {
-            INIT2;
-            PRINTLEAF("Before, src ", ioffset, 3, oleaf3);
-            PRINTLEAF("Before, dest", ioffset, 3, oleaf3_2);
-            JU_INSERTCOPY3(oleaf3_2, oleaf3, INDEXES, ioffset, oIndex);
-            PRINTLEAF("After,  src ", ioffset, 3, oleaf3);
-            PrintLeaf("After,  dest", ioffset, 3, oleaf3_2);
-        }
-
-#ifdef JU_64BIT
-        (void) puts("\nJU_INSERTCOPY5():");
-
-        for (ioffset = 0; ioffset <= INDEXES; ++ioffset)
-        {
-            INIT2;
-            PRINTLEAF("Before, src ", ioffset, 5, oleaf5);
-            PRINTLEAF("Before, dest", ioffset, 5, oleaf5_2);
-            JU_INSERTCOPY5(oleaf5_2, oleaf5, INDEXES, ioffset, oIndex);
-            PRINTLEAF("After,  src ", ioffset, 5, oleaf5);
-            PrintLeaf("After,  dest", ioffset, 5, oleaf5_2);
-        }
-
-        (void) puts("\nJU_INSERTCOPY6():");
-
-        for (ioffset = 0; ioffset <= INDEXES; ++ioffset)
-        {
-            INIT2;
-            PRINTLEAF("Before, src ", ioffset, 6, oleaf6);
-            PRINTLEAF("Before, dest", ioffset, 6, oleaf6_2);
-            JU_INSERTCOPY6(oleaf6_2, oleaf6, INDEXES, ioffset, oIndex);
-            PRINTLEAF("After,  src ", ioffset, 6, oleaf6);
-            PrintLeaf("After,  dest", ioffset, 6, oleaf6_2);
-        }
-
-        (void) puts("\nJU_INSERTCOPY7():");
-
-        for (ioffset = 0; ioffset <= INDEXES; ++ioffset)
-        {
-            INIT2;
-            PRINTLEAF("Before, src ", ioffset, 7, oleaf7);
-            PRINTLEAF("Before, dest", ioffset, 7, oleaf7_2);
-            JU_INSERTCOPY7(oleaf7_2, oleaf7, INDEXES, ioffset, oIndex);
-            PRINTLEAF("After,  src ", ioffset, 7, oleaf7);
-            PrintLeaf("After,  dest", ioffset, 7, oleaf7_2);
-        }
-#endif // JU_64BIT
-
-        (void) puts("\nJU_DELETECOPY():");
-
-        for (ioffset = 0; ioffset < INDEXES; ++ioffset)
-        {
-            INIT2;
-            PRINTLEAF("Before, src ", ioffset, WSIZE, (uint8_t *) eleaf);
-            PRINTLEAF("Before, dest", ioffset, WSIZE, (uint8_t *) eleaf_2);
-            JU_DELETECOPY(eleaf_2, eleaf, INDEXES, ioffset, ignore);
-            PRINTLEAF("After,  src ", ioffset, WSIZE, (uint8_t *) eleaf);
-            PrintLeaf("After,  dest", ioffset, WSIZE, (uint8_t *) eleaf_2);
-        }
-
-        (void) puts("\nJU_DELETECOPY_ODD(3):");
-
-        for (ioffset = 0; ioffset < INDEXES; ++ioffset)
-        {
-            INIT2;
-            PRINTLEAF("Before, src ", ioffset, 3, oleaf3);
-            PRINTLEAF("Before, dest", ioffset, 3, oleaf3_2);
-            JU_DELETECOPY_ODD(oleaf3_2, oleaf3, INDEXES, ioffset, 3);
-            PRINTLEAF("After,  src ", ioffset, 3, oleaf3);
-            PrintLeaf("After,  dest", ioffset, 3, oleaf3_2);
-        }
-
-#ifdef JU_64BIT
-        (void) puts("\nJU_DELETECOPY_ODD(5):");
-
-        for (ioffset = 0; ioffset < INDEXES; ++ioffset)
-        {
-            INIT2;
-            PRINTLEAF("Before, src ", ioffset, 5, oleaf5);
-            PRINTLEAF("Before, dest", ioffset, 5, oleaf5_2);
-            JU_DELETECOPY_ODD(oleaf5_2, oleaf5, INDEXES, ioffset, 5);
-            PRINTLEAF("After,  src ", ioffset, 5, oleaf5);
-            PrintLeaf("After,  dest", ioffset, 5, oleaf5_2);
-        }
-
-        (void) puts("\nJU_DELETECOPY_ODD(6):");
-
-        for (ioffset = 0; ioffset < INDEXES; ++ioffset)
-        {
-            INIT2;
-            PRINTLEAF("Before, src ", ioffset, 6, oleaf6);
-            PRINTLEAF("Before, dest", ioffset, 6, oleaf6_2);
-            JU_DELETECOPY_ODD(oleaf6_2, oleaf6, INDEXES, ioffset, 6);
-            PRINTLEAF("After,  src ", ioffset, 6, oleaf6);
-            PrintLeaf("After,  dest", ioffset, 6, oleaf6_2);
-        }
-
-        (void) puts("\nJU_DELETECOPY_ODD(7):");
-
-        for (ioffset = 0; ioffset < INDEXES; ++ioffset)
-        {
-            INIT2;
-            PRINTLEAF("Before, src ", ioffset, 7, oleaf7);
-            PRINTLEAF("Before, dest", ioffset, 7, oleaf7_2);
-            JU_DELETECOPY_ODD(oleaf7_2, oleaf7, INDEXES, ioffset, 7);
-            PRINTLEAF("After,  src ", ioffset, 7, oleaf7);
-            PrintLeaf("After,  dest", ioffset, 7, oleaf7_2);
-        }
-#endif // JU_64BIT
-
-        return(0);
-
-} // main()
-
-#endif // TEST_INSDEL
diff --git a/libs/klib/judy/JudySL.c b/libs/klib/judy/JudySL.c
deleted file mode 100644
index 637782d..0000000
--- a/libs/klib/judy/JudySL.c
+++ /dev/null
@@ -1,1125 +0,0 @@
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the term of the GNU Lesser 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 Lesser General Public License
-// for more details.
-//
-// You should have received a copy of the GNU Lesser 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
-// _________________
-
-// JUDY FUNCTIONS FOR STRING INDEXES, where associated values are longs.  One
-// JudySL*() corresponds to each JudyL*() function (with exceptions).
-//
-// See the manual entry for details.
-//
-// METHOD:  Break up each null-terminated Index (string) into chunks of W
-// bytes, where W is the machines word size, with null-padding in the last
-// word if necessary.  Store strings as a tree of JudyL arrays, that is, array
-// of array of array...  where each level consumes W bytes (one word) as an
-// index to the JudyL array at that level.  Since strings can begin on
-// arbitrary byte boundaries, copy each chunk of W bytes from Index into a
-// word-aligned object before using it as a Judy index.
-//
-// The JudySL tree also supports "single-index shortcut leaves".  A simple
-// JudySL array (tree of JudyL arrays) would go as many levels deep as the
-// Index (string) is long, which wastes time and memory when an Index is unique
-// beyond a certain point.  When theres just one Index under a pointer, given
-// a reliable way to tell that the pointer is not a root pointer to another
-// JudyL array, it should save a lot of time to instead point to a "leaf"
-// object, similar to leaves in JudyL arrays.
-//
-// TBD:  Multi-index leaves, like those in JudyL, are also worth considering,
-// but their payback for JudySL is less certain.  Likewise, shortcut branches
-// are worth considering too.
-//
-// This code uses the Judy.h definitions and Doug Baskins convention of a "P"
-// prefix for pointers, except no "P" for the first level of char * (strings).
-
-// IMPORTS:
-
-#include <string.h>                     // for strcmp(), strlen(), strcpy()
-#include <Judy.h>
-
-#ifndef NDEDUG
-#define NDEBUG 1
-#endif
-#include <assert.h>
-
-//=======================================================================
-// Compile:
-//
-//    cc -O JudyHS.c -c
-//
-//    Notes:
-//    1) use -DJU_64BIT for 64 bit compiles (HP, Sun, IPF, Motorola/IBM? etc..)
-//    2) In gcc version 3.3.1 for a Centrino, -O2 is faster than -O
-//    3) In gcc version 3.3.2 for a Centrino, -O3 is faster than -O2
-//=======================================================================
-
-#define JU_SET_ERRNO(PJERROR, JERRNO)           \
-{                                               \
-    if (PJERROR != (PJError_t)NULL)             \
-    {                                           \
-        JU_ERRNO(PJERROR) = (JERRNO);           \
-        JU_ERRID(PJERROR) = __LINE__;           \
-    }                                           \
-}
-
-#define JU_SET_ERRNO_NONNULL(PJERROR, JERRNO)   \
-{                                               \
-    JU_ERRNO(PJERROR) = (JERRNO);               \
-    JU_ERRID(PJERROR) = __LINE__;               \
-}
-
-// SUPPORT FOR HANDLING WORDS:
-
-#define WORDSIZE     (sizeof (Word_t))  // bytes in word = JudyL index.
-#define WORDS(BYTES) (((BYTES) + WORDSIZE - 1) / WORDSIZE)      // round up.
-
-// To mark a pointer is to a "short cut leaf", set least bit
-
-#define IS_PSCL(PSCL)     (((Word_t) (PSCL)) & JLAP_INVALID)
-#define CLEAR_PSCL(PSCL)  ((Pscl_t)(((Word_t) (PSCL)) & (~JLAP_INVALID)))
-#define SET_PSCL(PSCL)    (((Word_t) (PSCL)) | JLAP_INVALID)
-
-// MISCELLANEOUS GLOBALS:
-
-// Get the Index (string) length in bytes, including the trailing \0, which
-// is an integral part of the string:
-
-// A string is "in the last word" if a previously-set byte count is at or below
-// the system word size, or in some cases if the last byte in the (null-padded)
-// word is null (assume big-endian, including in a register on a little-endian
-// machine):
-
-#define LASTWORD_BY_VALUE(WORD) (! ((WORD) & 0xffL))
-
-#ifdef JU_64BIT
-
-// copy from 1..7 bytes from string to Word_t and test if \0 bytes
-//
-#define        COPYSTRINGtoWORD(WORD,STR)               \
-{                                                       \
-    do                                                  \
-    {                                                   \
-        uint8_t chr;                                    \
-        WORD =      (Word_t)(STR)[0] << 56;             \
-        if (!(WORD)) break;                             \
-        if (!(chr  = (STR)[1])) break;                  \
-        WORD += ((Word_t)(chr) << 48);                  \
-        if (!(chr  = (STR)[2])) break;                  \
-        WORD += ((Word_t)(chr) << 40);                  \
-        if (!(chr  = (STR)[3])) break;                  \
-        WORD += ((Word_t)(chr) << 32);                  \
-        if (!(chr  = (STR)[4])) break;                  \
-        WORD += ((Word_t)(chr) << 24);                  \
-        if (!(chr  = (STR)[5])) break;                  \
-        WORD += ((Word_t)(chr) << 16);                  \
-        if (!(chr  = (STR)[6])) break;                  \
-        WORD += ((Word_t)(chr) << 8) + (STR)[7];        \
-    } while(0);                                         \
-}
-
-// copy Word_t from 1..8 bytes to string and test of \0 bytes
-//
-#define         COPYWORDtoSTRING(STR,WORD)                      \
-{                                                               \
-    do                                                          \
-    {                                                           \
-        if (!((STR)[0] = (uint8_t)((WORD) >> 56))) break;       \
-        if (!((STR)[1] = (uint8_t)((WORD) >> 48))) break;       \
-        if (!((STR)[2] = (uint8_t)((WORD) >> 40))) break;       \
-        if (!((STR)[3] = (uint8_t)((WORD) >> 32))) break;       \
-        if (!((STR)[4] = (uint8_t)((WORD) >> 24))) break;       \
-        if (!((STR)[5] = (uint8_t)((WORD) >> 16))) break;       \
-        if (!((STR)[6] = (uint8_t)((WORD) >>  8))) break;       \
-        (STR)[7]       = (uint8_t)(WORD);                       \
-    } while(0);                                                 \
-}
-
-#else  // JU_32BIT
-
-// copy from 1..4 bytes from string to Word_t and test if \0 bytes
-
-#define        COPYSTRINGtoWORD(WORD,STR)               \
-{                                                       \
-    do                                                  \
-    {                                                   \
-        uint8_t chr;                                    \
-        WORD =       (STR)[0] << 24;                    \
-        if (WORD == 0) break;                           \
-        if (!(chr  = (STR)[1])) break;                  \
-        WORD += (Word_t)(chr << 16);                    \
-        if (!(chr  = (STR)[2])) break;                  \
-        WORD += (Word_t)(chr << 8) + (STR)[3];          \
-    } while(0);                                         \
-}
-
-// copy Word_t from 1..4 bytes to string and test of \0 bytes
-
-#define        COPYWORDtoSTRING(STR,WORD)                       \
-{                                                               \
-    do                                                          \
-    {                                                           \
-        if (!((STR)[0] = (uint8_t)((WORD) >> 24))) break;       \
-        if (!((STR)[1] = (uint8_t)((WORD) >> 16))) break;       \
-        if (!((STR)[2] = (uint8_t)((WORD) >>  8))) break;       \
-        (STR)[3]       = (uint8_t)(WORD);                       \
-    } while(0);                                                 \
-}
-#endif // JU_32BIT
-
-
-// SUPPORT FOR SINGLE-INDEX SHORTCUT LEAVES:
-
-typedef struct SHORCUTLEAF
-{
-    Pvoid_t   scl_Pvalue;               // callers value area.
-    uint8_t   scl_Index[WORDSIZE];      // base Index string.
-} scl_t  , *Pscl_t;
-
-// overhead of the scl_Pvalue only, the scl_Index is calculate elsewhere
-
-#define STRUCTOVD       (sizeof(scl_t) - WORDSIZE)
-
-// How big to malloc a shortcut leaf; stringlen should already include the
-// trailing null char:
-
-#define SCLSIZE(LEN)  (((LEN) + STRUCTOVD + WORDSIZE - 1) / WORDSIZE)
-
-// string routines, may replace with your own
-//
-#define STRCMP(S1,S2)   strcmp((void *)(S1), (void *)(S2))
-#define STRCPY(S1,S2)   strcpy((void *)(S1), (void *)(S2))
-#define STRLEN(S1)      (strlen((void *)(S1)) + 1)
-
-
-// Index and value area for a shortcut leaf, depending on how it matches the
-// undecoded remainder of the Index, given a Pscl_t that includes type bits
-// that must be cleared:
-//
-// PSCLINDEX() and PSCLVALUE() are also useful when Pscl contains uncleared
-// TYPE bits.
-//
-// Note:  SCLCMP() cannot take advantage of knowing the Index length because
-// the scl_Index length is not pre-known when these macros are used.
-
-#define PSCLINDEX(PSCL)  ((CLEAR_PSCL(PSCL))->scl_Index)
-#define PSCLVALUE(PSCL)  ((CLEAR_PSCL(PSCL))->scl_Pvalue)
-
-#define SCLCMP(INDEX,PSCL) STRCMP(INDEX, PSCLINDEX(PSCL))
-
-#define PPSCLVALUE_EQ(INDEX,PSCL)                                       \
-    ((SCLCMP(INDEX, PSCL) == 0) ? &PSCLVALUE(PSCL) : (PPvoid_t)NULL)
-
-#define PPSCLVALUE_LT(INDEX,PSCL)                                       \
-    ((SCLCMP(INDEX, PSCL) < 0) ? &PSCLVALUE(PSCL) : (PPvoid_t)NULL)
-
-#define PPSCLVALUE_GT(INDEX,PSCL)                                       \
-    ((SCLCMP(INDEX, PSCL) > 0) ? &PSCLVALUE(PSCL) : (PPvoid_t)NULL)
-
-// Common in-lined code to append or free a shortcut leaf:
-//
-// See header comments about premature return().  Note that malloc() does not
-// pre-zero the memory, so ensure scl_Pvalue is zeroed, just like a value area
-// in a JudyL array.  Hope strcpy() is fast enough in this context.
-
-#define APPEND_SCL(PSCL,PPARRAY,INDEX,LEN,PJERROR)                      \
-{                                                                       \
-    if (((PSCL) = (Pscl_t) JudyMalloc(SCLSIZE(LEN))) == (Pscl_t)NULL)   \
-    {                                                                   \
-        JU_SET_ERRNO(PJERROR, JU_ERRNO_NOMEM);                          \
-        return (PPJERR);                                                \
-    }                                                                   \
-    *(PPARRAY) = (Pvoid_t)SET_PSCL(PSCL);                               \
-    ((PSCL)->scl_Pvalue) = (Pvoid_t)NULL;                               \
-    (void)STRCPY((PSCL)->scl_Index, INDEX);                             \
-}
-
-// "FORWARD" DECLARATIONS:
-
-static void JudySLModifyErrno(PJError_t PJError,
-                              Pcvoid_t PArray, Pcvoid_t PArrayOrig);
-static int JudySLDelSub(PPvoid_t PPArray, PPvoid_t PPArrayOrig,
-                        const uint8_t * Index, Word_t len, PJError_t PJError);
-static PPvoid_t JudySLPrevSub(Pcvoid_t PArray, uint8_t * Index, int orig,
-                              Word_t len, PJError_t PJError);
-static PPvoid_t JudySLNextSub(Pcvoid_t PArray, uint8_t * Index, int orig,
-                              Word_t len, PJError_t PJError);
-
-// ****************************************************************************
-// J U D Y   S L   M O D I F Y   E R R N O
-//
-// Common code for error translation:  When a caller passes an invalid JAP
-// ("not a JudyL pointer"), OR if the JudySL array is corrupted at a lower
-// level, various JudyL*() calls return JU_ERRNO_NOTJUDYL.  If the caller wants
-// detailed error info, convert this particular error to JU_ERRNO_NOTJUDYSL if
-// at the top of the tree, otherwise convert it to JU_ERRNO_CORRUPT, meaning
-// there was a corruption (the only one even detectable outside JudyL) in the
-// JudySL tree; but pass through any other errors unaltered.
-
-static void
-JudySLModifyErrno(PJError_t PJError,    // to modify if non-null.
-                  Pcvoid_t PArray,      // current JudyL array.
-                  Pcvoid_t PArrayOrig   // top-of-tree JudyL array.
-    )
-{                                       //  map this Judy errno.
-    if ((PJError != PJE0) && (JU_ERRNO(PJError) == JU_ERRNO_NOTJUDYL))
-    {
-        if (PArray == PArrayOrig)       // callers fault.
-        {
-            JU_SET_ERRNO_NONNULL(PJError, JU_ERRNO_NOTJUDYSL);
-        }
-        else                            // lower level.
-        {
-            JU_SET_ERRNO_NONNULL(PJError, JU_ERRNO_CORRUPT);
-        }
-    }
-}                                       // JudySLModifyErrno()
-
-// ****************************************************************************
-// J U D Y   S L   G E T
-//
-// See comments in file header and below.
-
-PPvoid_t
-JudySLGet(Pcvoid_t PArray, const uint8_t * Index, PJError_t PJError)
-{
-    const uint8_t *pos = Index;         // place in Index.
-    Word_t    indexword;                // buffer for aligned copy.
-    PPvoid_t  PPValue;                  // from JudyL array.
-
-// CHECK FOR CALLER ERROR (NULL POINTER):
-
-    if (Index == (uint8_t *) NULL)
-    {
-        JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX);
-        return (PPJERR);
-    }
-
-// SEARCH NEXT LEVEL JUDYL ARRAY IN TREE:
-//
-// Use or copy each word from the Index string and check for it in the next
-// level JudyL array in the array tree, but first watch for shortcut leaves.
-// Upon invalid Index or end of Index (string) in current word, return.
-
-    do                                  // until return.
-    {
-        if (IS_PSCL(PArray))            // a shortcut leaf.
-            return (PPSCLVALUE_EQ(pos, PArray));
-
-        COPYSTRINGtoWORD(indexword, pos);       // copy next 4[8] bytes.
-
-        JLG(PPValue, PArray, indexword);
-
-        if ((PPValue == (PPvoid_t) NULL) || LASTWORD_BY_VALUE(indexword))
-            return (PPValue);
-
-// CONTINUE TO NEXT LEVEL DOWN JUDYL ARRAY TREE:
-//
-// If a previous JudySLIns() ran out of memory partway down the tree, it left a
-// null *PPValue; this is automatically treated here as a dead-end (not a core
-// dump or assertion; see version 1.25).
-
-        pos += WORDSIZE;
-        PArray = *PPValue;              // each value -> next array.
-    } while(1);                         // forever
-//  NOTREACHED JudySLGet()
-}
-
-// ****************************************************************************
-// J U D Y   S L   I N S
-//
-// See also the comments in JudySLGet(), which is somewhat similar, though
-// simpler.
-//
-// Theory of operation:
-//
-// Upon encountering a null pointer in the tree of JudyL arrays, insert a
-// shortcut leaf -- including directly under a null root pointer for the first
-// Index in the JudySL array.
-//
-// Upon encountering a pre-existing shortcut leaf, if the old Index is equal to
-// the new one, return the old value area.  Otherwise, "carry down" the old
-// Index until the old and new Indexes diverge, at which point each Index
-// either terminates in the last JudyL array or a new shortcut leaf is inserted
-// under it for the Indexs remainder.
-//
-// TBD:  Running out of memory below the starting point causes a premature
-// return below (in several places) and leaves a dead-end in the JudySL tree.
-// Ideally the code here would back this out rather than wasting a little
-// memory, but in lieu of that, the get, delete, and search functions
-// understand dead-ends and handle them appropriately.
-
-PPvoid_t
-JudySLIns(PPvoid_t PPArray, const uint8_t * Index, PJError_t PJError)
-{
-    PPvoid_t  PPArrayOrig = PPArray;    // for error reporting.
-    const uint8_t *pos = Index;         // place in Index.
-    const uint8_t *pos2 = (uint8_t *) NULL;     // old Index (SCL being moved).
-    Word_t    len;                      // bytes remaining.
-
-// Note:  len2 is set when needed and only used when valid, but this is not
-// clear to gcc -Wall, so initialize it here to avoid a warning:
-
-    Word_t    len2 = 0;                 // for old Index (SCL being moved).
-    Word_t    scl2 = 0;                 // size in words of SCL
-    Word_t    indexword;                // buffer for aligned copy.
-    Word_t    indexword2;               // for old Index (SCL being moved).
-    PPvoid_t  PPValue;                  // from JudyL array.
-    PPvoid_t  PPValue2;                 // for old Index (SCL being moved).
-    Pscl_t    Pscl = (Pscl_t) NULL;     // shortcut leaf.
-    Pscl_t    Pscl2;                    // for old Index (SCL being moved).
-
-// CHECK FOR CALLER ERROR (NULL POINTERS):
-
-    if (PPArray == (PPvoid_t) NULL)
-    {
-        JU_SET_ERRNO(PJError, JU_ERRNO_NULLPPARRAY);
-        return (PPJERR);
-    }
-    if (Index == (uint8_t *) NULL)
-    {
-        JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX);
-        return (PPJERR);
-    }
-
-    len = STRLEN(Index);        // bytes remaining.
-
-// APPEND SHORTCUT LEAF:
-//
-// If PPArray, which is the root pointer to the first or next JudyL array in
-// the tree, points to null (no next JudyL array), AND there is no shortcut
-// leaf being carried down, append a shortcut leaf here for the new Index, no
-// matter how much of the Index string remains (one or more bytes, including
-// the trailing \0).
-
-    while (1)                           // until return.
-    {
-        if (*PPArray == (Pvoid_t)NULL)  // no next JudyL array.
-        {
-            if (Pscl == (Pscl_t) NULL)  // no SCL being carried down.
-            {
-                APPEND_SCL(Pscl, PPArray, pos, len, PJError);   // returns if error.
-                return (&(Pscl->scl_Pvalue));
-            }
-            // else do nothing here; see below.
-        }
-
-// CARRY DOWN PRE-EXISTING SHORTCUT LEAF:
-//
-// When PPArray points to a pre-existing shortcut leaf, if its Index is equal
-// to the Index to be inserted, meaning no insertion is required, return its
-// value area; otherwise, "move it aside" and "carry it down" -- replace it
-// (see below) with one or more levels of JudyL arrays.  Moving it aside
-// initially just means setting Pscl non-null, both as a flag and for later
-// use, and clearing the pointer to the SCL in the JudyL array.
-
-        else if (IS_PSCL(*PPArray))
-        {
-            assert(Pscl == (Pscl_t) NULL);      // no nested SCLs.
-
-            Pscl = CLEAR_PSCL(*PPArray);
-
-            pos2 = Pscl->scl_Index;     // note: pos2 is always word-aligned.
-            len2 = STRLEN(pos2);        // bytes remaining.
-
-//          first check if string is already inserted
-
-            if ((len == len2) && (STRCMP(pos, pos2) == 0))
-                return (&(Pscl->scl_Pvalue));
-
-            *PPArray = (Pvoid_t)NULL;   // disconnect SCL.
-
-            scl2 = SCLSIZE(len2);       // save for JudyFree
-
-            // continue with *PPArray now clear, and Pscl, pos2, len2 set.
-        }
-
-// CHECK IF OLD AND NEW INDEXES DIVERGE IN THE CURRENT INDEX WORD:
-//
-// If a shortcut leaf is being carried down and its remaining Index chars now
-// diverge from the remaining chars of the Index being inserted, that is, if
-// the next words of each Index differ, "plug in" the old Index here, in a new
-// JudyL array, before proceeding.
-//
-// Note:  Call JudyLIns() for the SCL Index word before calling it for the new
-// Index word, so PPValue remains correct for the latter.  (JudyLIns() return
-// values are not stable across multiple calls.)
-//
-// Note:  Although pos2 is word-aligned, and a Pscl_t is a whole number of
-// words in size, pos2 is not certain to be null-padded through a whole word,
-// so copy it first to an index word for later use.
-//
-// See header comments about premature return().
-
-        COPYSTRINGtoWORD(indexword, pos);       // copy next 4[8] bytes.
-
-        if (Pscl != (Pscl_t) NULL)
-        {
-            COPYSTRINGtoWORD(indexword2, pos2); // copy next 4[8] bytes.
-
-            if (indexword != indexword2)        // SCL and new Indexes diverge.
-            {
-                assert(*PPArray == (Pvoid_t)NULL);      // should be new JudyL array.
-
-// Note:  If JudyLIns() returns JU_ERRNO_NOTJUDYL here, *PPArray should not be
-// modified, so JudySLModifyErrno() can do the right thing.
-
-                if ((PPValue2 = JudyLIns(PPArray, indexword2, PJError))
-                    == PPJERR)
-                {
-                    JudySLModifyErrno(PJError, *PPArray, *PPArrayOrig);
-                    return (PPJERR);
-                }
-
-                assert(PPValue2 != (PPvoid_t) NULL);
-
-// If the old (SCL) Index terminates here, copy its value directly into the
-// JudyL value area; otherwise create a new shortcut leaf for it, under
-// *PPValue2 (skipping the word just inserted), and copy its value to the new
-// SCL:
-
-                if (len2 <= WORDSIZE)
-                {
-                    *((PWord_t)PPValue2) = (Word_t)(Pscl->scl_Pvalue);
-                }
-                else
-                {
-                    APPEND_SCL(Pscl2, PPValue2, pos2 + WORDSIZE,
-                               len2 - WORDSIZE, PJError);
-                    (Pscl2->scl_Pvalue) = Pscl->scl_Pvalue;
-                }
-//              old SCL no longer needed.
-
-                JudyFree((void *)Pscl, scl2);
-
-                Pscl = (Pscl_t) NULL;
-            }
-        }
-
-// APPEND NEXT LEVEL JUDYL ARRAY TO TREE:
-//
-// If a shortcut leaf was carried down and diverged at this level, the code
-// above already appended the new JudyL array, but the next word of the new
-// Index still must be inserted in it.
-//
-// See header comments about premature return().
-//
-// Note:  If JudyLIns() returns JU_ERRNO_NOTJUDYL here, *PPArray should not be
-// modified, so JudySLModifyErrno() can do the right thing.
-
-        if ((PPValue = JudyLIns(PPArray, indexword, PJError)) == PPJERR)
-        {
-            JudySLModifyErrno(PJError, *PPArray, *PPArrayOrig);
-            return (PPJERR);
-        }
-
-        assert(PPValue != (PPvoid_t) NULL);
-
-// CHECK IF NEW INDEX TERMINATES:
-//
-// Note that if it does, and an old SCL was being carried down, it must have
-// diverged by this point, and is already handled.
-
-        if (len <= WORDSIZE)
-        {
-            assert(Pscl == (Pscl_t) NULL);
-            return (PPValue);           // is value for whole Index string.
-        }
-
-        pos += WORDSIZE;
-        len -= WORDSIZE;
-        pos2 += WORDSIZE;               // useless unless Pscl is set.
-        len2 -= WORDSIZE;
-
-        PPArray = PPValue;              // each value -> next array.
-    }                                   // while.
-}                                       // NOTREACHED, JudySLIns()
-
-// ****************************************************************************
-// J U D Y   S L   D E L
-//
-// See the comments in JudySLGet(), which is somewhat similar.
-//
-// Unlike JudySLGet() and JudySLIns(), recurse downward through the tree of
-// JudyL arrays to find and delete the given Index, if present, and then on the
-// way back up, any of its parent arrays which ends up empty.
-//
-// TECHNICAL NOTES:
-//
-// Recursion seems bad, but this allows for an arbitrary-length Index.  Also, a
-// more clever iterative solution that used JudyLCount() (see below) would
-// still require a function call per tree level, so why not just recurse?
-//
-// An earlier version (1.20) used a fixed-size stack, which limited the Index
-// size.  We were going to replace this with using JudyLCount(), in order to
-// note and return to (read this carefully) the highest level JudyL array with
-// a count of 1, all of whose descendant JudyL arrays also have a count of 1,
-// and delete from that point downwards.  This solution would traverse the
-// array tree downward looking to see if the given Index is in the tree, then
-// if so, delete layers downwards starting below the last one that contains
-// other Indexes than the one being deleted.
-//
-// TBD:  To save time coding, and to very likely save time overall during
-// execution, this function does "lazy deletions", or putting it more nicely,
-// it allows "hysteresis" in the JudySL tree, when shortcut leafs are present.
-// It only removes the specified Index, and recursively any empty JudyL arrays
-// above it, without fully reversing the effects of JudySLIns().  This is
-// probably OK because any application that calls JudySLDel() is likely to call
-// JudySLIns() again with the same or a neighbor Index.
-
-int
-JudySLDel(PPvoid_t PPArray, const uint8_t * Index, PJError_t PJError)   // optional, for returning error info.
-{
-
-// Check for caller error (null pointer):
-
-    if (PPArray == (PPvoid_t) NULL)
-    {
-        JU_SET_ERRNO(PJError, JU_ERRNO_NULLPPARRAY);
-        return (JERR);
-    }
-    if (Index == (uint8_t *) NULL)
-    {
-        JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX);
-        return (JERR);
-    }
-
-// Do the deletion:
-
-    return (JudySLDelSub(PPArray, PPArray, Index, STRLEN(Index), PJError));
-
-}                                       // JudySLDel()
-
-// ****************************************************************************
-// J U D Y   S L   D E L   S U B
-//
-// This is the "engine" for JudySLDel() that expects aligned and len to already
-// be computed (only once).  See the header comments for JudySLDel().
-
-static int
-JudySLDelSub(PPvoid_t PPArray,          // in which to delete.
-             PPvoid_t PPArrayOrig,      // for error reporting.
-             const uint8_t * Index,     // to delete.
-             Word_t len,                // bytes remaining.
-             PJError_t PJError)         // optional, for returning error info.
-{
-    Word_t    indexword;                // next word to find.
-    PPvoid_t  PPValue;                  // from JudyL array.
-    int       retcode;                  // from lower-level call.
-
-    assert(PPArray != (PPvoid_t) NULL);
-    assert(Index != (uint8_t *) NULL);
-
-// DELETE SHORTCUT LEAF:
-//
-// As described above, this can leave an empty JudyL array, or one containing
-// only a single other Index word -- which could be, but is not, condensed into
-// a higher-level shortcut leaf.  More precisely, at this level it leaves a
-// temporary "dead end" in the JudySL tree, similar to when running out of
-// memory during JudySLIns(), and this is somewhat cleaned up by higher
-// recursions of the same function (see below); but remaining shortcut leaves
-// for other Indexes are not coalesced.
-
-    if (IS_PSCL(*PPArray))
-    {
-        Pscl_t    Pscll = CLEAR_PSCL(*PPArray);
-        Word_t    words;
-
-        if (STRCMP(Index, Pscll->scl_Index))
-            return (0);                 // incorrect index.
-
-        words = SCLSIZE(STRLEN(Pscll->scl_Index));
-        JudyFree((void *)Pscll, words);
-
-        *PPArray = (Pvoid_t)NULL;
-        return (1);                     // correct index deleted.
-    }
-
-// DELETE LAST INDEX WORD, FROM CURRENT JUDYL ARRAY:
-//
-// When at the end of the full Index, delete the last word, if present, from
-// the current JudyL array, and return the result all the way up.
-
-    COPYSTRINGtoWORD(indexword, Index); // copy next 4[8] bytes.
-
-    if (len <= WORDSIZE)
-    {
-        if ((retcode = JudyLDel(PPArray, indexword, PJError)) == JERR)
-        {
-            JudySLModifyErrno(PJError, *PPArray, *PPArrayOrig);
-            return (JERR);
-        }
-        return (retcode);
-    }
-
-// DELETE BELOW NON-LAST INDEX WORD IN CURRENT JUDYL ARRAY:
-//
-// If a word before the end of the full Index is present in the current JudyL
-// array, recurse through its value, which must be a pointer to another JudyL
-// array, to continue the deletion at the next level.  Return the JudyLGet()
-// return if the Indexs current word is not in the JudyL array, or if no
-// delete occurs below this level, both of which mean the whole Index is not
-// currently valid.
-//
-
-    JLG(PPValue, *PPArray, indexword);
-    if (PPValue == (PPvoid_t) NULL)
-        return (0);                     // Index not in JudySL array.
-// If a previous JudySLIns() ran out of memory partway down the tree, it left a
-// null *PPValue; this is automatically treated as a dead-end (not a core dump
-// or assertion; see version 1.25).
-    if ((retcode =
-         JudySLDelSub(PPValue, PPArrayOrig, Index + WORDSIZE,
-                      len - WORDSIZE, PJError)) != 1)
-    {
-        return (retcode);               // no lower-level delete, or error.
-    }
-
-// DELETE EMPTY JUDYL ARRAY:
-//
-// A delete occurred below in the tree.  If the child JudyL array became empty,
-// delete the current Index word from the current JudyL array, which could
-// empty the current array and null out *PPArray in turn (or pass through an
-// error).  Otherwise simply indicate that a deletion did occur.
-
-    if (*PPValue == (Pvoid_t)NULL)
-    {
-        if ((retcode = JudyLDel(PPArray, indexword, PJError)) == JERR)
-        {
-            JudySLModifyErrno(PJError, *PPArray, *PPArrayOrig);
-            return (JERR);
-        }
-
-        return (retcode);
-    }
-
-    return (1);
-}                                       // JudySLDelSub()
-
-// ****************************************************************************
-// J U D Y   S L   P R E V
-//
-// Recursively traverse the JudySL tree downward using JudyLGet() to look for
-// each successive index word from Index in the JudyL array at each level.  At
-// the last level for the Index (LASTWORD_BY_LEN()), use JudyLPrev() instead of
-// JudyLGet(), to exclude the initial Index.  If this doesnt result in finding
-// a previous Index, work back up the tree using JudyLPrev() at each higher
-// level to search for a previous index word.  Upon finding a previous index
-// word, descend again if/as necessary, this time inclusively, to find and
-// return the full previous Index.
-//
-// Also support shortcut leaves.
-//
-// Since this function is recursive and it also needs to know if its still
-// looking for the original Index (to exclude it at the LASTWORD_BY_LEN()
-// level) or for the remaining words of the previous Index (inclusive),
-// actually call a subroutine that takes an additional parameter.
-//
-// See also the technical notes in JudySLDel() regarding the use of recursion
-// rather than iteration.
-
-PPvoid_t
-JudySLPrev(Pcvoid_t PArray, uint8_t * Index, PJError_t PJError) // optional, for returning error info.
-{
-// Check for caller error (null pointer), or empty JudySL array:
-
-    if (Index == (uint8_t *) NULL)
-    {
-        JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX);
-        return (PPJERR);
-    }
-
-    if (PArray == (Pvoid_t)NULL)
-        return ((PPvoid_t) NULL);
-// Do the search:
-    return (JudySLPrevSub(PArray, Index, /* original = */ 1,
-                          STRLEN(Index), PJError));
-}                                       // JudySLPrev()
-
-// ****************************************************************************
-// J U D Y   S L   P R E V   S U B
-//
-// This is the "engine" for JudySLPrev() that knows whether its still looking
-// for the original Index (exclusive) or a neighbor index (inclusive), and that
-// expects aligned and len to already be computed (only once).  See the header
-// comments for JudySLPrev().
-
-static    PPvoid_t
-JudySLPrevSub(Pcvoid_t PArray, uint8_t * Index, int orig,
-              Word_t len,               // bytes remaining.
-              PJError_t PJError)        // optional, for returning error info.
-{
-    Word_t    indexword;                // next word to find.
-    PPvoid_t  PPValue;                  // from JudyL array.
-// ORIGINAL SEARCH:
-//
-// When at a shortcut leaf, copy its remaining Index (string) chars into Index
-// and return its value area if the current Index is after (greater than) the
-// SCLs index; otherwise return null.
-    if (orig)
-    {
-        if (IS_PSCL(PArray))
-        {
-            if ((PPValue = PPSCLVALUE_GT(Index, PArray)) != (PPvoid_t) NULL)
-                (void)STRCPY(Index, PSCLINDEX(PArray));
-            return (PPValue);
-        }
-
-// If the current Index word:
-// - is not the last word in Index (end of string),
-// - exists in the current JudyL array, and,
-// - a previous Index is found below it, return that Indexs value area.
-
-        COPYSTRINGtoWORD(indexword, Index);     // copy next 4[8] bytes.
-        if (len > WORDSIZE)             // not at end of Index.
-        {
-            JLG(PPValue, PArray, indexword);
-            if (PPValue != (PPvoid_t) NULL)
-            {
-
-// If a previous JudySLIns() ran out of memory partway down the tree, it left a
-// null *PPValue; this is automatically treated as a dead-end (not a core dump
-// or assertion; see version 1.25):
-
-                PPValue = JudySLPrevSub(*PPValue, Index + WORDSIZE,
-                                        /* original = */ 1,
-                                        len - WORDSIZE, PJError);
-                if (PPValue == PPJERR)
-                    return (PPJERR);    // propagate error.
-                if (PPValue != (PPvoid_t) NULL)
-                    return (PPValue);   // see above.
-            }
-        }
-
-// Search for previous index word:
-//
-// One of the above conditions is false.  Search the current JudyL array for
-// the Index word, if any, prior to the current index word.  If none is found,
-// return null; otherwise fall through to common later code.
-
-        if ((PPValue = JudyLPrev(PArray, &indexword, PJError)) == PPJERR)
-        {
-            JudySLModifyErrno(PJError, PArray, orig ? PArray : (Pvoid_t)NULL);
-            return (PPJERR);
-        }
-
-        if (PPValue == (PPvoid_t) NULL)
-            return ((PPvoid_t) NULL);   // no previous index word.
-    }                                   // if.
-
-// SUBSEQUENT SEARCH:
-//
-// A higher level search already excluded the initial Index, then found a
-// previous index word, and is now traversing down to determine the rest of the
-// Index and to obtain its value area.  If at a shortcut leaf, return its value
-// area.  Otherwise search the current JudyL array backward from the upper
-// limit for its last index word.  If no index word is found, return null --
-// should never happen unless the JudySL tree is corrupt; otherwise fall
-// through to common later code.
-
-    else
-    {
-        if (IS_PSCL(PArray))            // at shortcut leaf.
-        {
-            (void)STRCPY(Index, PSCLINDEX(PArray));
-            return (&PSCLVALUE(PArray));
-        }
-
-        indexword = ~0UL;
-        if ((PPValue = JudyLLast(PArray, &indexword, PJError)) == PPJERR)
-        {
-            JudySLModifyErrno(PJError, PArray, orig ? PArray : (Pvoid_t)NULL);
-            return (PPJERR);
-        }
-
-// If a previous JudySLIns() ran out of memory partway down the tree, it left a
-// null *PPValue; this is automatically treated as a dead-end (not a core dump
-// or assertion; see version 1.25):
-
-        if (PPValue == (PPvoid_t) NULL)
-            return ((PPvoid_t) NULL);   // no previous index word.
-    }
-
-// FOUND PREVIOUS INDEX WORD:
-//
-// A previous (if original) or last (if subsequent) index word was located in
-// the current JudyL array.  Store it into the callers Index (string).  Then
-// if the found (previous) Index ends here, return its value area; otherwise do
-// a subsequent search below this point, which should never fail unless the
-// JudySL tree is corrupt, but this is detected at a lower level by the above
-// assertion.
-//
-// Note:  Treat Index as unaligned, even if it is aligned, to avoid writing
-// past the end of allocated memory (in case its less than a whole number of
-// words).
-
-    COPYWORDtoSTRING(Index, indexword); // copy next 4[8] bytes.
-    if (LASTWORD_BY_VALUE(indexword))
-        return (PPValue);
-// If a previous JudySLIns() ran out of memory partway down the tree, it left a
-// null *PPValue; this is automatically treated as a dead-end (not a core dump
-// or assertion; see version 1.25):
-    return (JudySLPrevSub(*PPValue, Index + WORDSIZE, /* original = */ 0,
-                          len - WORDSIZE, PJError));
-}                                       // JudySLPrevSub()
-
-// ****************************************************************************
-// J U D Y   S L   N E X T
-//
-// See the comments in JudySLPrev(), which is very similar.
-//
-// TBD:  Could the two functions call a common engine function with various
-// subfunctions and other constants specified?
-
-PPvoid_t
-JudySLNext(Pcvoid_t PArray, uint8_t * Index, PJError_t PJError) // optional, for returning error info.
-{
-// Check for caller error (null pointer), or empty JudySL array:
-
-    if (Index == (uint8_t *) NULL)
-    {
-        JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX);
-        return (PPJERR);
-    }
-
-    if (PArray == (Pvoid_t)NULL)
-        return ((PPvoid_t) NULL);
-// Do the search:
-    return (JudySLNextSub(PArray, Index, /* original = */ 1,
-                          STRLEN(Index), PJError));
-}                                       // JudySLNext()
-
-// ****************************************************************************
-// J U D Y   S L   N E X T   S U B
-//
-// See the comments in JudySLPrevSub(), which is very similar.
-
-static    PPvoid_t
-JudySLNextSub(Pcvoid_t PArray, uint8_t * Index, int orig,
-              Word_t len,               // bytes remaining.
-              PJError_t PJError)        // optional, for returning error info.
-{
-    Word_t    indexword;                // next word to find.
-    PPvoid_t  PPValue;                  // from JudyL array.
-    if (orig)
-    {
-        if (IS_PSCL(PArray))
-        {
-            if ((PPValue = PPSCLVALUE_LT(Index, PArray)) != (PPvoid_t) NULL)
-                (void)STRCPY(Index, PSCLINDEX(PArray));
-            return (PPValue);
-        }
-
-        COPYSTRINGtoWORD(indexword, Index);     // copy next 4[8] bytes.
-
-        if (len > WORDSIZE)             // not at end of Index.
-        {
-            JLG(PPValue, PArray, indexword);
-            if (PPValue != (PPvoid_t) NULL)
-            {
-// If a previous JudySLIns() ran out of memory partway down the tree, it left a
-// null *PPValue; this is automatically treated as a dead-end (not a core dump
-// or assertion; see version 1.25):
-
-                PPValue = JudySLNextSub(*PPValue, Index + WORDSIZE,
-                                        /* original = */ 1,
-                                        len - WORDSIZE, PJError);
-                if (PPValue == PPJERR)
-                    return (PPJERR);    // propagate error.
-                if (PPValue != (PPvoid_t) NULL)
-                    return (PPValue);   // see above.
-            }
-        }
-
-        if ((PPValue = JudyLNext(PArray, &indexword, PJError)) == PPJERR)
-        {
-            JudySLModifyErrno(PJError, PArray, orig ? PArray : (Pvoid_t)NULL);
-            return (PPJERR);
-        }
-
-        if (PPValue == (PPvoid_t) NULL)
-            return ((PPvoid_t) NULL);   // no next index word.
-    }
-    else
-    {
-        if (IS_PSCL(PArray))            // at shortcut leaf.
-        {
-            (void)STRCPY(Index, PSCLINDEX(PArray));
-            return (&PSCLVALUE(PArray));
-        }
-
-        indexword = 0;
-        if ((PPValue = JudyLFirst(PArray, &indexword, PJError)) == PPJERR)
-        {
-            JudySLModifyErrno(PJError, PArray, orig ? PArray : (Pvoid_t)NULL);
-            return (PPJERR);
-        }
-
-// If a previous JudySLIns() ran out of memory partway down the tree, it left a
-// null *PPValue; this is automatically treated as a dead-end (not a core dump
-// or assertion; see version 1.25):
-
-        if (PPValue == (PPvoid_t) NULL)
-            return ((PPvoid_t) NULL);   // no next index word.
-    }
-
-    COPYWORDtoSTRING(Index, indexword); // copy next 4[8] bytes
-    if (LASTWORD_BY_VALUE(indexword))
-        return (PPValue);
-// If a previous JudySLIns() ran out of memory partway down the tree, it left a
-// null *PPValue; this is automatically treated as a dead-end (not a core dump
-// or assertion; see version 1.25):
-    return (JudySLNextSub(*PPValue, Index + WORDSIZE, /* original = */ 0,
-                          len - WORDSIZE, PJError));
-}                                       // JudySLNextSub()
-
-// ****************************************************************************
-// J U D Y   S L   F I R S T
-//
-// Like JudyLFirst(), do a JudySLGet(), then if necessary a JudySLNext().
-
-PPvoid_t
-JudySLFirst(Pcvoid_t PArray, uint8_t * Index, PJError_t PJError)        // optional, for returning error info.
-{
-    PPvoid_t  PPValue;                  // from JudyL array.
-    if (Index == (uint8_t *) NULL)
-    {
-        JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX);
-        return (PPJERR);
-    }
-
-    if ((PPValue = JudySLGet(PArray, Index, PJError)) == PPJERR)
-        return (PPJERR);                // propagate serious error.
-    if ((PPValue == (PPvoid_t) NULL)    // first try failed.
-        && ((PPValue = JudySLNext(PArray, Index, PJError)) == PPJERR))
-    {
-        return (PPJERR);                // propagate serious error.
-    }
-
-    return (PPValue);
-}                                       // JudySLFirst()
-
-// ****************************************************************************
-// J U D Y   S L   L A S T
-//
-// Like JudyLLast(), do a JudySLGet(), then if necessary a JudySLPrev().
-
-PPvoid_t
-JudySLLast(Pcvoid_t PArray, uint8_t * Index, PJError_t PJError) // optional, for returning error info.
-{
-    PPvoid_t  PPValue;                  // from JudyL array.
-    if (Index == (uint8_t *) NULL)
-    {
-        JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX);
-        return (PPJERR);
-    }
-
-    if ((PPValue = JudySLGet(PArray, Index, PJError)) == PPJERR)
-        return (PPJERR);                // propagate serious error.
-    if ((PPValue == (PPvoid_t) NULL)    // first try failed.
-        && ((PPValue = JudySLPrev(PArray, Index, PJError)) == PPJERR))
-    {
-        return (PPJERR);                // propagate serious error.
-    }
-
-    return (PPValue);
-}                                       // JudySLLast()
-
-// ****************************************************************************
-// J U D Y   S L   F R E E   A R R A Y
-//
-// Walk the JudySL tree of JudyL arrays to free each JudyL array, depth-first.
-// During the walk, ignore indexes (strings) that end in the current JudyL
-// array to be freed.  Just recurse through those indexes which do not end,
-// that is, those whose associated value areas point to subsidiary JudyL
-// arrays, except for those which point to shortcut leaves.  Return the total
-// bytes freed in all of the JudyL arrays at or below the current level.
-//
-// Like the JudyLFreeArray() and Judy1FreeArray() code, this is written
-// recursively, which is probably fast enough, to allow indexes (strings) of
-// arbitrary size.  If recursion turns out to be a problem, consider instead
-// doing some large, fixed number of iterative descents (like 100) using a
-// fixed-size "stack" (array), then recursing upon overflow (relatively
-// rarely).
-
-Word_t
-JudySLFreeArray(PPvoid_t PPArray, PJError_t PJError)    // optional, for returning error info.
-{
-    PPvoid_t  PPArrayOrig = PPArray;    // for error reporting.
-    Word_t    indexword = 0;            // word just found.
-    PPvoid_t  PPValue;                  // from Judy array.
-    Word_t    bytes_freed = 0;          // bytes freed at this level.
-    Word_t    bytes_total = 0;          // bytes freed at all levels.
-    if (PPArray == (PPvoid_t) NULL)
-    {
-        JU_SET_ERRNO(PJError, JU_ERRNO_NULLPPARRAY);
-        return (JERR);
-    }
-
-// FREE SHORTCUT LEAF:
-
-    if (IS_PSCL(*PPArray))
-    {
-        Word_t    freewords;
-        Pscl_t    Pscl;
-
-        Pscl = CLEAR_PSCL(*PPArray);
-
-        freewords = SCLSIZE(STRLEN(Pscl->scl_Index));
-
-        JudyFree((void *)Pscl, freewords);
-
-        *PPArray = (Pvoid_t)NULL;
-
-        return (freewords * WORDSIZE);
-    }
-
-// FREE EACH SUB-ARRAY (DEPTH-FIRST):
-//
-// If a previous JudySLIns() ran out of memory partway down the tree, it left a
-// null *PPValue.  This is automatically treated correctly here as a dead-end.
-//
-// An Index (string) ends in the current word iff the last byte of the
-// (null-padded) word is null.
-
-    for (PPValue = JudyLFirst(*PPArray, &indexword, PJError);
-         (PPValue != (PPvoid_t) NULL) && (PPValue != PPJERR);
-         PPValue = JudyLNext(*PPArray, &indexword, PJError))
-    {
-        if (!LASTWORD_BY_VALUE(indexword))
-        {
-            if ((bytes_freed = JudySLFreeArray(PPValue, PJError)) == JERR)
-                return (JERR);          // propagate serious error.
-            bytes_total += bytes_freed;
-        }
-    }
-
-// Check for a serious error in a JudyL*() call:
-
-    if (PPValue == PPJERR)
-    {
-        JudySLModifyErrno(PJError, *PPArray, *PPArrayOrig);
-        return (JERR);
-    }
-
-// Now free the current array, which also nulls the pointer:
-//
-// Note:  *PPArray can be null here for a totally null JudySL array =>
-// JudyLFreeArray() returns zero.
-
-    if ((bytes_freed = JudyLFreeArray(PPArray, PJError)) == JERR)
-    {
-        JudySLModifyErrno(PJError, *PPArray, *PPArrayOrig);
-        return (JERR);
-    }
-    return (bytes_total + bytes_freed);
-}                                       // JudySLFreeArray()
diff --git a/libs/klib/judy/JudyTablesGen.c b/libs/klib/judy/JudyTablesGen.c
deleted file mode 100644
index a5fcb85..0000000
--- a/libs/klib/judy/JudyTablesGen.c
+++ /dev/null
@@ -1,294 +0,0 @@
-// Copyright (C) 2000 - 2002 Hewlett-Packard Company
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the term of the GNU Lesser 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 Lesser General Public License
-// for more details.
-//
-// You should have received a copy of the GNU Lesser 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
-// _________________
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#if (! (defined(JUDY1) || defined(JUDYL)))
-#error:  One of -DJUDY1 or -DJUDYL must be specified.
-#endif
-
-#define	TERMINATOR 999		// terminator for Alloc tables
-
-#define BPW sizeof(Word_t)	// define bytes per word
-
-#ifdef JUDY1
-#include "Judy1.h"
-#else
-#include "JudyL.h"
-#endif
-    
-FILE *fd;
-
-// Definitions come from header files Judy1.h and JudyL.h:
-
-int AllocSizes[] = ALLOCSIZES;
-
-#define	ROUNDUP(BYTES,BPW,OFFSETW) \
-	((((BYTES) + (BPW) - 1) / (BPW)) + (OFFSETW))
-
-
-// ****************************************************************************
-// G E N   T A B L E
-//
-// Note:  "const" is required for newer compilers.
-
-FUNCTION void GenTable(
-    const char * TableName,	// name of table string
-    const char * TableSize,	// dimentioned size string
-    int		 IndexBytes,	// bytes per Index
-    int		 LeafSize,	// number elements in object
-    int		 ValueBytes,	// bytes per Value
-    int		 OffsetWords)	// 1 for LEAFW
-{
-    int *	 PAllocSizes = AllocSizes;
-    int		 OWord;
-    int		 CurWord;
-    int		 IWord;
-    int		 ii;
-    int		 BytesOfIndex;
-    int		 BytesOfObject;
-    int		 Index;
-    int		 LastWords;
-    int		 Words [1000] = { 0 };
-    int		 Offset[1000] = { 0 };
-    int		 MaxWords;
-
-    MaxWords  =	ROUNDUP((IndexBytes + ValueBytes) * LeafSize, BPW, OffsetWords);
-    Words[0]  = 0;
-    Offset[0] = 0;
-    CurWord   = TERMINATOR;
-
-// Walk through all number of Indexes in table:
-
-    for (Index = 1; /* null */; ++Index)
-    {
-
-// Calculate byte required for next size:
-
-	BytesOfIndex  = IndexBytes * Index;
-	BytesOfObject = (IndexBytes + ValueBytes) * Index;
-
-// Round up and calculate words required for next size:
-
-        OWord =	ROUNDUP(BytesOfObject, BPW, OffsetWords);
-        IWord =	ROUNDUP(BytesOfIndex,  BPW, OffsetWords);
-
-// Root-level leaves of population of 1 and 2 do not have the 1 word offset:
-
-// Save minimum value of offset:
-
-        Offset[Index] = IWord;
-
-// Round up to next available size of words:
-
-	while (OWord > *PAllocSizes) PAllocSizes++;
-
-        if (Index == LeafSize)
-        {
-	    CurWord = Words[Index] = OWord;
-            break;
-        }
-//      end of available sizes ?
-
-	if (*PAllocSizes == TERMINATOR)
-        {
-            fprintf(stderr, "BUG, in %sPopToWords, sizes not big enough for object\n", TableName);
-	    exit(1);
-        }
-
-// Save words required and last word:
-
-        if (*PAllocSizes < MaxWords) { CurWord = Words[Index] = *PAllocSizes; }
-        else                         { CurWord = Words[Index] = MaxWords; }
-
-    } // for each index
-
-    LastWords = TERMINATOR;
-
-// Round up to largest size in each group of malloc sizes:
-
-    for (ii = LeafSize; ii > 0; ii--)
-    {
-        if (LastWords > (Words[ii] - ii)) LastWords = Offset[ii];
-        else                              Offset[ii] = LastWords;
-    }
-
-// Print the PopToWords[] table:
-
-    fprintf(fd,"\n//\tobject uses %d words\n", CurWord);
-    fprintf(fd,"//\t%s = %d\n", TableSize, LeafSize);
-
-    fprintf(fd,"const uint8_t\n");
-    fprintf(fd,"%sPopToWords[%s + 1] =\n", TableName, TableSize);
-    fprintf(fd,"{\n\t 0,");
-
-    for (ii = 1; ii <= LeafSize; ii++)
-    {
-
-// 8 columns per line, starting with 1:
-
-	if ((ii % 8) == 1) fprintf(fd,"\n\t");
-
-	fprintf(fd,"%2d", Words[ii]);
-
-// If not last number place comma:
-
-	if (ii != LeafSize) fprintf(fd,", ");
-    }
-    fprintf(fd,"\n};\n");
-
-// Print the Offset table if needed:
-
-    if (! ValueBytes) return;
-
-    fprintf(fd,"const uint8_t\n");
-    fprintf(fd,"%sOffset[%s + 1] =\n", TableName, TableSize);
-    fprintf(fd,"{\n");
-    fprintf(fd,"\t 0,");
-
-    for (ii = 1; ii <= LeafSize; ii++)
-    {
-        if ((ii % 8) == 1) fprintf(fd,"\n\t");
-
-	fprintf(fd,"%2d", Offset[ii]);
-
-	if (ii != LeafSize) fprintf(fd,", ");
-    }
-    fprintf(fd,"\n};\n");
-
-} // GenTable()
-
-
-// ****************************************************************************
-// M A I N
-
-#ifdef JU_WMAIN
-FUNCTION int wmain()
-#else
-FUNCTION int main()
-#endif
-{
-    int ii;
-
-#ifdef JUDY1
-    char *fname = "Judy1Tables.c";
-#else
-    char *fname = "JudyLTables.c";
-#endif
-
-    if ((fd = fopen(fname, "w")) == NULL){
-	perror("FATAL ERROR: could not write to Judy[1L]Tables.c file\n");
-	return (-1);
-    }
-
-
-    fprintf(fd,"// @(#) From generation tool: JudyTablesGen.c\n");
-    fprintf(fd,"//\n\n");
-
-
-// ================================ Judy1 =================================
-#ifdef JUDY1
-
-    fprintf(fd,"#include \"Judy1.h\"\n");
-
-    fprintf(fd,"// Leave the malloc() sizes readable in the binary (via "
-	   "strings(1)):\n");
-    fprintf(fd,"const char * Judy1MallocSizes = \"Judy1MallocSizes =");
-
-    for (ii = 0; AllocSizes[ii] != TERMINATOR; ii++)
-	fprintf(fd," %d,", AllocSizes[ii]);
-
-#ifndef JU_64BIT
-    fprintf(fd," Leaf1 = %d\";\n\n", cJ1_LEAF1_MAXPOP1);
-#else
-    fprintf(fd,"\";\n\n");			// no Leaf1 in this case.
-#endif
-
-// ================================ 32 bit ================================
-#ifndef JU_64BIT
-
-    GenTable("j__1_BranchBJP","cJU_BITSPERSUBEXPB", 8, cJU_BITSPERSUBEXPB,0,0);
-
-    GenTable("j__1_Leaf1", "cJ1_LEAF1_MAXPOP1", 1, cJ1_LEAF1_MAXPOP1, 0, 0);
-    GenTable("j__1_Leaf2", "cJ1_LEAF2_MAXPOP1", 2, cJ1_LEAF2_MAXPOP1, 0, 0);
-    GenTable("j__1_Leaf3", "cJ1_LEAF3_MAXPOP1", 3, cJ1_LEAF3_MAXPOP1, 0, 0);
-    GenTable("j__1_LeafW", "cJ1_LEAFW_MAXPOP1", 4, cJ1_LEAFW_MAXPOP1, 0, 1);
-
-#endif
-
-// ================================ 64 bit ================================
-#ifdef JU_64BIT
-    GenTable("j__1_BranchBJP","cJU_BITSPERSUBEXPB",16, cJU_BITSPERSUBEXPB,0,0);
-
-    GenTable("j__1_Leaf2", "cJ1_LEAF2_MAXPOP1", 2, cJ1_LEAF2_MAXPOP1, 0, 0);
-    GenTable("j__1_Leaf3", "cJ1_LEAF3_MAXPOP1", 3, cJ1_LEAF3_MAXPOP1, 0, 0);
-    GenTable("j__1_Leaf4", "cJ1_LEAF4_MAXPOP1", 4, cJ1_LEAF4_MAXPOP1, 0, 0);
-    GenTable("j__1_Leaf5", "cJ1_LEAF5_MAXPOP1", 5, cJ1_LEAF5_MAXPOP1, 0, 0);
-    GenTable("j__1_Leaf6", "cJ1_LEAF6_MAXPOP1", 6, cJ1_LEAF6_MAXPOP1, 0, 0);
-    GenTable("j__1_Leaf7", "cJ1_LEAF7_MAXPOP1", 7, cJ1_LEAF7_MAXPOP1, 0, 0);
-    GenTable("j__1_LeafW", "cJ1_LEAFW_MAXPOP1", 8, cJ1_LEAFW_MAXPOP1, 0, 1);
-#endif
-#endif // JUDY1
-
-
-// ================================ JudyL =================================
-#ifdef JUDYL
-
-    fprintf(fd,"#include \"JudyL.h\"\n");
-
-    fprintf(fd,"// Leave the malloc() sizes readable in the binary (via "
-	   "strings(1)):\n");
-    fprintf(fd,"const char * JudyLMallocSizes = \"JudyLMallocSizes =");
-
-    for (ii = 0; AllocSizes[ii] != TERMINATOR; ii++)
-	fprintf(fd," %d,", AllocSizes[ii]);
-
-    fprintf(fd," Leaf1 = %ld\";\n\n", (Word_t)cJL_LEAF1_MAXPOP1);
-
-#ifndef JU_64BIT
-// ================================ 32 bit ================================
-    GenTable("j__L_BranchBJP","cJU_BITSPERSUBEXPB", 8, cJU_BITSPERSUBEXPB, 0,0);
-
-    GenTable("j__L_Leaf1", "cJL_LEAF1_MAXPOP1",  1, cJL_LEAF1_MAXPOP1, BPW,0);
-    GenTable("j__L_Leaf2", "cJL_LEAF2_MAXPOP1",  2, cJL_LEAF2_MAXPOP1, BPW,0);
-    GenTable("j__L_Leaf3", "cJL_LEAF3_MAXPOP1",  3, cJL_LEAF3_MAXPOP1, BPW,0);
-    GenTable("j__L_LeafW", "cJL_LEAFW_MAXPOP1",  4, cJL_LEAFW_MAXPOP1, BPW,1);
-    GenTable("j__L_LeafV", "cJU_BITSPERSUBEXPL", 4, cJU_BITSPERSUBEXPL,  0,0);
-#endif // 32 BIT
-
-#ifdef JU_64BIT
-// ================================ 64 bit ================================
-    GenTable("j__L_BranchBJP","cJU_BITSPERSUBEXPB",16, cJU_BITSPERSUBEXPB, 0,0);
-
-    GenTable("j__L_Leaf1", "cJL_LEAF1_MAXPOP1",  1, cJL_LEAF1_MAXPOP1,  BPW,0);
-    GenTable("j__L_Leaf2", "cJL_LEAF2_MAXPOP1",  2, cJL_LEAF2_MAXPOP1,  BPW,0);
-    GenTable("j__L_Leaf3", "cJL_LEAF3_MAXPOP1",  3, cJL_LEAF3_MAXPOP1,  BPW,0);
-    GenTable("j__L_Leaf4", "cJL_LEAF4_MAXPOP1",  4, cJL_LEAF4_MAXPOP1,  BPW,0);
-    GenTable("j__L_Leaf5", "cJL_LEAF5_MAXPOP1",  5, cJL_LEAF5_MAXPOP1,  BPW,0);
-    GenTable("j__L_Leaf6", "cJL_LEAF6_MAXPOP1",  6, cJL_LEAF6_MAXPOP1,  BPW,0);
-    GenTable("j__L_Leaf7", "cJL_LEAF7_MAXPOP1",  7, cJL_LEAF7_MAXPOP1,  BPW,0);
-    GenTable("j__L_LeafW", "cJL_LEAFW_MAXPOP1",  8, cJL_LEAFW_MAXPOP1,  BPW,1);
-    GenTable("j__L_LeafV", "cJU_BITSPERSUBEXPL", 8, cJU_BITSPERSUBEXPL, 0,0);
-#endif // 64 BIT
-
-#endif // JUDYL
-    fclose(fd);
-
-    return(0);
-
-} // main()
diff --git a/libs/klib/judy/Makefile b/libs/klib/judy/Makefile
deleted file mode 100644
index 91dbf9e..0000000
--- a/libs/klib/judy/Makefile
+++ /dev/null
@@ -1,190 +0,0 @@
-# ===========================================================================
-#
-#                            PUBLIC DOMAIN NOTICE
-#               National Center for Biotechnology Information
-#
-#  This software/database is a "United States Government Work" under the
-#  terms of the United States Copyright Act.  It was written as part of
-#  the author's official duties as a United States Government employee and
-#  thus cannot be copyrighted.  This software/database is freely available
-#  to the public for use. The National Library of Medicine and the U.S.
-#  Government have not placed any restriction on its use or reproduction.
-#
-#  Although all reasonable efforts have been taken to ensure the accuracy
-#  and reliability of the software and data, the NLM and the U.S.
-#  Government do not and cannot warrant the performance or results that
-#  may be obtained by using this software or data. The NLM and the U.S.
-#  Government disclaim all warranties, express or implied, including
-#  warranties of performance, merchantability or fitness for any particular
-#  purpose.
-#
-#  Please cite the author in any work or product based on this material.
-#
-# ===========================================================================
-
-
-default: all
-
-TOP ?= $(shell ../../../build/abspath.sh ../../..)
-MODULE = libs/klib/judy
-
-INT_LIBS = \
-	libjudy
-
-ALL_LIBS = \
-	$(INT_LIBS)
-
-include $(TOP)/build/Makefile.env
-
-
-#-------------------------------------------------------------------------------
-# special rules
-#  for some reason these guys use the same source and load it up with
-#  ifdefs, so we have general rules to produce two sets of object files
-#  from a single set of sources
-#
-%.n.32.$(OBJX): %.c
-	$(CC) -o $@ $(OPT) $(CFLAGS) -DJU_32BIT $<
-%.n.64.$(OBJX): %.c
-	$(CC) -o $@ $(OPT) $(CFLAGS) -DJU_64BIT $<
-%.n.32.$(LOBX): %.c
-	$(CC) -o $@ -fPIC $(OPT) $(CFLAGS) -DJU_32BIT $<
-%.n.64.$(LOBX): %.c
-	$(CC) -o $@ -fPIC $(OPT) $(CFLAGS) -DJU_64BIT $<
-
-%.b.32.$(OBJX): %.c
-	$(CC) -o $@ $(OPT) $(CFLAGS) -DJUDY1 -DJU_32BIT $<
-%.b.64.$(OBJX): %.c
-	$(CC) -o $@ $(OPT) $(CFLAGS) -DJUDY1 -DJU_64BIT $<
-%.b.32.$(LOBX): %.c
-	$(CC) -o $@ -fPIC $(OPT) $(CFLAGS) -DJUDY1 -DJU_32BIT $<
-%.b.64.$(LOBX): %.c
-	$(CC) -o $@ -fPIC $(OPT) $(CFLAGS) -DJUDY1 -DJU_64BIT $<
-
-%.w.32.$(OBJX): %.c
-	$(CC) -o $@ $(OPT) $(CFLAGS) -DJUDYL -DJU_32BIT $<
-%.w.64.$(OBJX): %.c
-	$(CC) -o $@ $(OPT) $(CFLAGS) -DJUDYL -DJU_64BIT $<
-%.w.32.$(LOBX): %.c
-	$(CC) -o $@ -fPIC $(OPT) $(CFLAGS) -DJUDYL -DJU_32BIT $<
-%.w.64.$(LOBX): %.c
-	$(CC) -o $@ -fPIC $(OPT) $(CFLAGS) -DJUDYL -DJU_64BIT $<
-
-ifeq (win,$(OS))
-#JUDY_WIN = -DJU_WIN
-JUDY_WIN = -DJU_WMAIN -I$(TOP)/interfaces/cc/vc++
-endif
-
-#ifeq (dbg, $(BUILD))
-#DEBUG := -DDEBUG
-#endif
-
-CFLAGS = $(DEBUG) $(NO_ARRAY_BOUNDS_WARNING) $(DBG) $(CARCH) $(PROF) $(JUDY_WIN) -I$(SRCDIR) -I$(SRCDIR)/..
-
-VPATH += $(OBJDIR)
-
-#-------------------------------------------------------------------------------
-# outer targets
-#
-all std: makedirs
-	@ $(MAKE_CMD) $(TARGDIR)/std
-
-$(INT_LIBS): makedirs
-	@ $(MAKE_CMD) $(ILIBDIR)/$@
-
-.PHONY: all std $(ALL_LIBS)
-
-#-------------------------------------------------------------------------------
-# std
-#
-$(TARGDIR)/std: \
-	$(addprefix $(ILIBDIR)/,$(INT_LIBS)) \
-	$(addprefix $(LIBDIR)/,$(EXT_LIBS))
-
-.PHONY: $(TARGDIR)/std
-
-#-------------------------------------------------------------------------------
-# clean
-#
-clean: stdclean
-
-.PHONY: clean
-
-
-#-------------------------------------------------------------------------------
-# judy tables - whee!
-#
-JUDY_TABLES_SRC = \
-	JudyTablesGen
-
-JUDY_TABLES_BOBJ = \
-	$(addsuffix .b.$(BITS).$(OBJX),$(JUDY_TABLES_SRC))
-
-JUDY_TABLES_WOBJ = \
-	$(addsuffix .w.$(BITS).$(OBJX),$(JUDY_TABLES_SRC))
-
-$(OBJDIR)/Judy1TablesGen: $(JUDY_TABLES_BOBJ)
-	$(LD) --exe -o $@ $^
-
-$(OBJDIR)/JudyLTablesGen: $(JUDY_TABLES_WOBJ)
-	$(LD) --exe -o $@ $^
-
-$(OBJDIR)/Judy1Tables.c: $(OBJDIR)/Judy1TablesGen
-	$(RUN_REMOTELY) $^
-
-$(OBJDIR)/JudyLTables.c: $(OBJDIR)/JudyLTablesGen
-	$(RUN_REMOTELY) $^
-
-$(ILIBDIR)/judy-tables: \
-	$(OBJDIR)/JudyLTables.c \
-	$(OBJDIR)/Judy1Tables.c
-
-#-------------------------------------------------------------------------------
-# judy whee!
-#
-
-$(ILIBDIR)/libjudy: $(addprefix $(ILIBDIR)/libjudy.,$(LIBX))
-
-JUDY_NEUTRAL = \
-	JudyMalloc \
-	JudySL \
-	JudyHS
-
-JUDY_CMN = \
-	JudyGet \
-	JudyIns \
-	JudyInsArray \
-	JudyDel \
-	JudyCascade \
-	JudyCount \
-	JudyCreateBranch \
-	JudyDecascade \
-	JudyFirst \
-	JudyFreeArray \
-	JudyInsertBranch \
-	JudyMallocIF \
-	JudyMemActive \
-	JudyMemUsed \
-	JudyNext \
-	JudyNextEmpty \
-	JudyPrev \
-	JudyPrevEmpty \
-	JudyByCountWithDefs \
-	j__udyGet
-
-JUDY_WORD = \
-	JudyLTables
-
-JUDY_BIT = \
-	Judy1Tables
-
-JUDY_SRC = \
-	$(addsuffix .n,$(JUDY_NEUTRAL)) \
-	$(addsuffix .w,$(JUDY_CMN) $(JUDY_WORD)) \
-	$(addsuffix .b,$(JUDY_CMN) $(JUDY_BIT))
-
-JUDY_OBJ = \
-	$(addsuffix .$(BITS).$(LOBX),$(JUDY_SRC))
-
-$(ILIBDIR)/libjudy.$(LIBX): $(JUDY_OBJ)
-	$(LD) --slib -o $@ $^
diff --git a/libs/klib/judy/j__udyGet.c b/libs/klib/judy/j__udyGet.c
deleted file mode 100644
index 478c0f1..0000000
--- a/libs/klib/judy/j__udyGet.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define JUDYGETINLINE 1
-#include "JudyGet.c"
diff --git a/libs/klib/ksort.c b/libs/klib/ksort.c
deleted file mode 100644
index 88ff088..0000000
--- a/libs/klib/ksort.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <klib/extern.h>
-#include <klib/sort.h>
-
-
-/*--------------------------------------------------------------------------
- * ksort
- *  qsort with a function data pointer
- */
-
-#define TSWAP( T, a, b )                                      \
-    do                                                        \
-    {                                                         \
-        T tmp = * ( const T* ) ( a );                         \
-        * ( T* ) ( a ) = * ( const T* ) ( b );                \
-        * ( T* ) ( b ) = tmp;                                 \
-    }                                                         \
-    while ( 0 )
-
-#define TCMP( T, a, b )                                       \
-    ( ( * ( const T* ) ( a ) < * ( const T* ) ( b ) ) ? -1 :  \
-      ( * ( const T* ) ( a ) > * ( const T* ) ( b ) ) )
-
-
-/* various custom ksort operations
- *  structures will generally want their own functions
- *  these fundamental types can be standardized
- */
-LIB_EXPORT void CC ksort_int32_t ( int32_t *pbase, size_t total_elems )
-{
-#define SWAP( a, b, off, size )  TSWAP ( int32_t, a, b )
-#define CMP( a, b )                                             \
-    ( * ( const int32_t* ) ( a ) - * ( const int32_t* ) ( b ) )
-
-    KSORT ( pbase, total_elems, sizeof * pbase, 0, sizeof * pbase );
-
-#undef SWAP
-#undef CMP
-}
-
-LIB_EXPORT void CC ksort_uint32_t ( uint32_t *pbase, size_t total_elems )
-{
-#define SWAP( a, b, off, size )  TSWAP ( uint32_t, a, b )
-#define CMP( a, b ) TCMP ( uint32_t, a, b )
-
-    KSORT ( pbase, total_elems, sizeof * pbase, 0, sizeof * pbase );
-
-#undef SWAP
-#undef CMP
-}
-
-LIB_EXPORT void CC ksort_int64_t ( int64_t *pbase, size_t total_elems )
-{
-#define SWAP( a, b, off, size )  TSWAP ( int64_t, a, b )
-#define CMP( a, b ) TCMP ( int64_t, a, b )
-
-    KSORT ( pbase, total_elems, sizeof * pbase, 0, sizeof * pbase );
-
-#undef SWAP
-#undef CMP
-}
-
-LIB_EXPORT void CC ksort_uint64_t ( uint64_t *pbase, size_t total_elems )
-{
-#define SWAP( a, b, off, size )  TSWAP ( uint64_t, a, b )
-#define CMP( a, b ) TCMP ( uint64_t, a, b )
-
-    KSORT ( pbase, total_elems, sizeof * pbase, 0, sizeof * pbase );
-
-#undef SWAP
-#undef CMP
-}
diff --git a/libs/klib/log-priv.h b/libs/klib/log-priv.h
deleted file mode 100644
index 042eb44..0000000
--- a/libs/klib/log-priv.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_log_priv_
-#define _h_log_priv_
-
-#ifndef _h_klib_log_
-#include <klib/log.h>
-#endif
-
-#ifndef _h_klib_rc_
-#include <klib/rc.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* some defaults */
-
-/*--------------------------------------------------------------------------
- * Log
- *  global logging
- */
-
-/* GetRCModuleText
- */
-const char *GetRCModuleText ( enum RCModule mod );
-
-/* GetRCTargetText
- */
-const char *GetRCTargetText ( enum RCTarget targ );
-
-/* GetRCContextText
- */
-const char *GetRCContextText ( enum RCContext ctx );
-
-/* GetRCObjectText
- *  obj can be RCTarget or RCObject
- */
-const char *GetRCObjectText ( int obj );
-
-/* GetRCStateText
- */
-const char *GetRCStateText ( enum RCState state );
-
-
-/* GetRCModuleIdxText
- */
-const char *GetRCModuleIdxText ( enum RCModule mod );
-
-/* GetRCTargetIdxText
- */
-const char *GetRCTargetIdxText ( enum RCTarget targ );
-
-/* GetRCContextIdxText
- */
-const char *GetRCContextIdxText ( enum RCContext ctx );
-
-/* GetRCObjectIdxText
- *  obj can be RCTarget or RCObject
- */
-const char *GetRCObjectIdxText ( int obj );
-
-/* GetRCStateIdxText
- */
-const char *GetRCStateIdxText ( enum RCState state );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_log_priv_ */
diff --git a/libs/klib/log.c b/libs/klib/log.c
deleted file mode 100644
index 1145058..0000000
--- a/libs/klib/log.c
+++ /dev/null
@@ -1,984 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <klib/extern.h>
-#include "log-priv.h"
-#include "writer-priv.h"
-#include <klib/log.h>
-#include <klib/text.h>
-#include <klib/printf.h>
-#include <klib/sort.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-#include <os-native.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * LogLevel
- * defaults to the error level which is the lowest error level filtering
- * warning and informational messages
- */
-static KLogLevel G_log_level = klogErr;
-static rc_t G_log_last_rc = 0;
-
-static KWrtHandler G_log_writer;
-static KWrtHandler G_log_lib_writer;
-
-static KFmtHandler G_log_formatter;
-static KLogFmtFlags G_log_formatter_flags;
-static KFmtHandler G_log_lib_formatter;
-static KLogFmtFlags G_log_lib_formatter_flags;
-
-/* LogLevelAdjust
- *  adjust process-global log level by an offset from current
- */
-LIB_EXPORT void CC KLogLevelAdjust( int32_t adjust )
-{
-    int32_t lvl = KLogLevelGet();
-
-    lvl += adjust;
-    if( lvl < klogLevelMin ) {
-        lvl = klogLevelMin;
-    } else if( lvl > klogLevelMax ) {
-        lvl = klogLevelMax;
-    }
-    G_log_level = lvl;
-}
-
-/* Get
- *  retrieve current process-global log level
- */
-LIB_EXPORT KLogLevel CC KLogLevelGet(void)
-{
-    return G_log_level;
-}
-
-/* Set
- *  set process-global log level
- */
-LIB_EXPORT rc_t CC KLogLevelSet(KLogLevel lvl)
-{
-    /* Don't allow an out of range set */
-    if( (lvl < klogLevelMin) || (lvl > klogLevelMax) ) {
-        return RC(rcRuntime, rcLog, rcUpdating, rcRange, rcInvalid);
-    }
-    G_log_level = lvl;
-    return 0;
-}
-
-/*
- * These need to be kept in sync with type LogLevel
- */
-static const char * logLevelParamStrings [] = 
-{
-    "fatal",
-    "sys",
-    "int",
-    "err",
-    "warn",
-    "info"
-};
-
-LIB_EXPORT const char ** CC KLogGetParamStrings ( void )
-{
-    return logLevelParamStrings;
-}
-
-
-/* LogLevelExplain
- *  inserts level description
- */
-LIB_EXPORT rc_t CC KLogLevelExplain ( KLogLevel lvl, char *buffer, size_t bsize, size_t *num_writ )
-{
-    static const char undefined[] = "undefined";
-    size_t size;
-    uint32_t len;
-    const char *t;
-
-    /* catch unaccounted for or bad changes in log.h
-     * if the asserts fail then the table above and the rest
-     * of the function will fail */
-    assert (klogLevelMin == 0);
-    assert (klogLevelMin == klogFatal);
-    assert ((klogFatal + 1) == klogSys);
-    assert ((klogSys + 1) == klogInt);
-    assert ((klogInt + 1) == klogErr);
-    assert ((klogErr + 1) == klogWarn);
-    assert ((klogWarn + 1) == klogInfo);
-    assert ((klogInfo) == klogLevelMax);
-
-    if ((lvl < klogLevelMin) || (lvl > klogLevelMax)) {
-        t = undefined;
-    } else {
-        t = logLevelParamStrings[lvl];
-    }
-
-    len = string_measure (t, &size);
-    if(len > bsize) {
-        if (num_writ) {
-            *num_writ = 0;
-        }
-        return RC ( rcRuntime, rcLog, rcLogging, rcBuffer, rcInsufficient );
-    }
-    if(num_writ) {
-        *num_writ = len;
-    }
-    string_copy (buffer, bsize, t, len);
-    return 0;
-}
-
-rc_t CC KLogDefaultFormatter( void* self, KWrtHandler* writer,
-                              size_t argc, const wrt_nvp_t args[],
-                              size_t envc, const wrt_nvp_t envs[] )
-{
-    rc_t rc = 0;
-    size_t num_writ, nsize, msize;
-    uint64_t mlen;
-    char buffer[8192], *nbuffer;
-    const char* msg, *rc_msg;
-
-    /* if writer is null than silence */
-    if( writer == NULL || writer->writer == NULL ) {
-        return rc;
-    }
-    msg = wrt_nvp_find_value(envc, envs, "message");
-    rc_msg = wrt_nvp_find_value(envc, envs, "reason");
-    if( msg != NULL ) {
-        const char* mend = msg + string_measure(msg, &msize);
-        /* strip trailing newlines */
-        while( mend != msg && (*mend == '\n' || *mend == '\r') ) {
-            --mend;
-        }
-        mlen = mend - msg;
-    } else {
-        mlen = 0;
-    }
-
-    nbuffer = buffer;
-    nsize = sizeof(buffer);
-    do {
-        rc = string_printf(nbuffer, nsize, & num_writ, "%s %s.%s %s: %s%s%.*s\n",
-                                 wrt_nvp_find_value(envc, envs, "timestamp"),
-                                 wrt_nvp_find_value(envc, envs, "app"),
-                                 wrt_nvp_find_value(envc, envs, "version"),
-                                 wrt_nvp_find_value(envc, envs, "severity"),
-                                 rc_msg ? rc_msg : "", rc_msg ? " - " : "",
-                                 ( uint32_t ) mlen, msg);
-        if( num_writ > nsize )
-        {
-            assert ( nbuffer == buffer );
-            nbuffer = malloc(nsize = num_writ + 2);
-            if( nbuffer == NULL ) {
-                rc = RC(rcRuntime, rcLog, rcLogging, rcMemory, rcExhausted);
-                break;
-            }
-            continue;
-        }
-        /* replace newlines with spaces, excluding last one */
-        for(nsize = 0; nsize < num_writ - 1; nsize++) {
-            if( nbuffer[nsize] == '\n' || nbuffer[nsize] == '\r' ) {
-                nbuffer[nsize] = ' ';
-            }
-        }
-        break;
-    } while(true);
-    if( rc == 0 ) {
-        rc = LogFlush(writer, nbuffer, num_writ);
-    }
-    if( nbuffer != buffer ) {
-        free(nbuffer);
-    }
-    return rc;
-}
-
-
-/* Init
- *  initialize the logging module with executable identity and version,
- *  plus logging level. actual behavior is determined by the logging
- *  implementation.
- *
- *  "ident" [ IN ] - identity of executable
- *
- *  "vers" [ IN ] - 4-part version code: 0xMMmmrrrr, where
- *      MM = major release
- *      mm = minor release
- *    rrrr = bug-fix release
- *
- *  "lvl" [ IN ] - a LogLevel specifying cutoff point for logs, such
- *  that any log generated with a level above "lvl" will be ignored.
- */
-LIB_EXPORT rc_t CC KLogInit ( void )
-{
-    rc_t rc;
-
-    G_log_level = klogWarn;
-    G_log_last_rc = 0;
-
-    rc = KLogHandlerSetStdErr();
-
-    if (rc == 0)
-        rc = KLogLibHandlerSet (NULL, NULL);
-
-    if (rc == 0)
-        rc = KLogFmtHandlerSetDefault();
-
-    if (rc == 0)
-        rc = KLogLibFmtHandlerSetDefault();
-
-    return rc;
-}
-
-
-/* LastErrorCode
- * LastErrorCodeReset
- *  return or clear the last reported rc_t with log level LogErr or above
- */
-LIB_EXPORT rc_t CC KLogLastErrorCode ( void )
-{
-    return G_log_last_rc;
-}
-
-LIB_EXPORT void CC KLogLastErrorCodeReset ( void )
-{
-    G_log_last_rc = 0;
-}
-
-/* LastErrorCodeSet
- *  set the last reported rc_t with log level LogErr or above
- */
-LIB_EXPORT void CC KLogLastErrorCodeSet ( KLogLevel lvl, rc_t rc )
-{
-    if ( lvl <= klogErr )
-        G_log_last_rc = rc;
-}
-
-/* pLogMsg
- *  creates an info node with parameters
- *  <info time="" message="" ... />
- *
- *  "lvl" [ IN ] - severity of message
- *
- *  "msg" [ IN ] - NUL terminated string with named parameters
- *
- *  "fmt" [ IN ] - NUL terminated format string, behaves according
- *  to standard printf-style formatting
- */
-LIB_EXPORT rc_t CC pLogMsg ( KLogLevel lvl, const char *msg, const char *fmt, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    if ( lvl > KLogLevelGet() )
-        return 0;
-
-    va_start ( args, fmt );
-    rc = vLogMsg ( lvl, msg, fmt, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC pLogLibMsg ( KLogLevel lvl, const char *msg, const char *fmt, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    if ( lvl > KLogLevelGet() )
-        return 0;
-
-    va_start ( args, fmt );
-    rc = vLogLibMsg ( lvl, msg, fmt, args );
-    va_end ( args );
-
-    return rc;
-}
-
-/* logsubstituteparams
- *  perform param substitution by name
- */
-static
-rc_t logsubstituteparams ( const char* msg, uint32_t argc, const wrt_nvp_t argv[],
-                           uint32_t envc, const wrt_nvp_t envs[],
-                           char* buffer, size_t bsize, size_t* num_writ )
-{
-    rc_t rc;
-    size_t i, sz;
-    for ( rc = 0, i = 0, sz = 0; msg [ i ] != 0; ++ sz, ++ i )
-    {
-        /* copy msg character */
-        if ( sz < bsize )
-            buffer [ sz ] = msg [ i ];
-
-        /* detect substitution param */
-        if ( msg [ i ] == '$' && msg [ i + 1 ] == '(' )
-        {
-            const char *value;
-            size_t size;
-
-            /* find param by name */
-            const wrt_nvp_t *arg = wrt_nvp_find(argc, argv, &msg[ i + 2 ]);
-            if( arg == NULL ) {
-                arg = wrt_nvp_find(envc, envs, &msg[ i + 2 ]);
-                if( arg == NULL ) {
-                    rc = RC ( rcRuntime, rcLog, rcInserting, rcParam, rcNotFound );
-                    break;
-                }
-            }
-            /* substitute param value */
-            for(value = arg->value; *value != 0; value++, sz++) {
-                if( sz < bsize ) {
-                    buffer[sz] = *value;
-                }
-            }
-            /* compensate for outer loop's increment */
-            --sz;
-            /* advance past param token */
-            i += string_measure(arg->name, &size) + 2;
-            assert( msg[i] == ')' );
-        }
-    }
-
-    * num_writ = sz;
-
-    if ( rc != 0 )
-        return rc;
-
-    if ( sz >= bsize )
-        return RC ( rcRuntime, rcLog, rcInserting, rcBuffer, rcInsufficient );
-
-    buffer [ sz ] = 0;
-    return 0;
-}
-
-
-/* logappendpmsg
- *  appends a message and parameters
- */
-static
-int logmatchname ( const char *fmt, char *pdata )
-{
-    int i;
-    for ( i = 0; fmt [ i ] == pdata [ i ]; ++ i )
-    {
-        switch ( fmt [ i ] )
-        {
-        case '=':
-            if ( i > 0 )
-            {
-                pdata [ i ] = 0;
-                return i;
-            }
-        case 0:
-        case ',':
-            return -1;
-        }
-    }
-    return 0;
-}
-
-static
-rc_t logtokenizeparams ( const char* fmt, char* pdata,
-                         uint32_t* argcp, wrt_nvp_t argv[], uint32_t arg_max )
-{
-    /* now split into parameters */
-    uint32_t argc;
-    int len = logmatchname ( fmt, pdata );
-    if ( len ++ <= 0 )
-        return RC ( rcRuntime, rcLog, rcTokenizing, rcParam, rcInvalid );
-
-    argv [ 0 ] . name = pdata;
-    argv [ 0 ] . value = & pdata [ len ];
-    for ( argc = 1, fmt += len; ; ++ argc )
-    {
-        /* find end of formal param fmt */
-        char *end = strchr ( fmt, ',' );
-        if ( end == NULL )
-            break;
-        fmt = end + 1;
-
-        /* find end of param value by
-           finding beginning of next name */
-        end = strchr ( argv [ argc - 1 ] . value, ',' );
-        while ( end != NULL )
-        {
-            len = logmatchname ( fmt, end + 1 );
-            if ( len > 0 )
-                break;
-            if ( len < 0 )
-                return RC ( rcRuntime, rcLog, rcTokenizing, rcParam, rcInvalid );
-            end = strchr ( end + 1, ',' );
-        }
-
-        /* detect badly formed parameter value or va_list */
-        if ( end ++ == NULL )
-            return RC ( rcRuntime, rcLog, rcTokenizing, rcParam, rcInvalid );
-
-        /* detect too many parameters */
-        if ( argc == arg_max )
-            return RC ( rcRuntime, rcLog, rcTokenizing, rcRange, rcExcessive );
-
-        /* account for NUL */
-        ++ len;
-
-        /* NUL terminate value */
-        end [ -1 ] = 0;
-
-        /* record param name and value addresses */
-        argv [ argc ] . name = end;
-        argv [ argc ] . value = end + len;
-
-        /* advance over formal param name */
-        fmt += len;
-    }
-
-    /* if multiple parameters, order by name */
-    wrt_nvp_sort(argc, argv);
-    * argcp = argc;
-    return 0;
-}
-
-static
-rc_t prep_v_args( uint32_t* argc, wrt_nvp_t argv[], size_t max_argc,
-                  char* pbuffer, size_t pbsize, const char* fmt, va_list args )
-{
-    rc_t rc = string_vprintf ( pbuffer, pbsize, NULL, fmt, args );
-    if ( rc == 0 )
-    {
-        /* tokenize the parameters into name/value pairs */
-        rc = logtokenizeparams(fmt, pbuffer, argc, argv, ( uint32_t ) max_argc);
-    }
-    return rc;
-}
-
-static
-rc_t log_print( KFmtHandler* formatter, const KLogFmtFlags flags, KWrtHandler* writer,
-                KLogLevel lvl, bool use_rc, rc_t status, 
-                const char* msg, const char* fmt, va_list args )
-{
-    rc_t rc = 0;
-    char* nbuffer;
-    size_t num_writ, remaining;
-
-    uint32_t envc = 0;
-    wrt_nvp_t envs[20];
-    char ebuffer[2048];
-    uint32_t argc = 0;
-    wrt_nvp_t argv[32];
-    char pbuffer[4096];
-    char abuffer[4096];
-    KFmtWriter fmtwrt;
-    
-    assert(formatter != NULL);
-    assert(writer != NULL);
-
-    fmtwrt = formatter->formatter;
-    if( fmtwrt == NULL ) {
-        fmtwrt = KLogDefaultFormatter;
-    }
-    if( fmtwrt == KLogDefaultFormatter && writer->writer == NULL ) {
-        /* default formatting with NULL writer -> silence */
-        return rc;
-    }
-    nbuffer = (char*)ebuffer;
-    remaining = sizeof(ebuffer);
-    do {
-#define FIX_UP() if(rc){break;} remaining -= num_writ; nbuffer += num_writ
-        if( flags & (klogFmtTimestamp | klogFmtLocalTimestamp) ) {
-            if( flags & klogFmtLocalTimestamp ) {
-                rc = LogSimpleTimestamp(nbuffer, remaining, &num_writ);
-            } else {
-                rc = LogTimestamp(nbuffer, remaining, &num_writ);
-            }
-            nbuffer[num_writ++] = '\0';
-            envs[envc].name = "timestamp";
-            envs[envc++].value = nbuffer;
-            FIX_UP();
-        }
-        if( flags & klogFmtSeverity ) {
-            rc = KLogLevelExplain(lvl, nbuffer, remaining, &num_writ);
-            nbuffer[num_writ++] = '\0';
-            envs[envc].name = "severity";
-            envs[envc++].value = nbuffer;
-            FIX_UP();
-        }
-        if( flags & klogFmtPid ) {
-            rc = LogPID(nbuffer, remaining, &num_writ);
-            nbuffer[num_writ++] = '\0';
-            envs[envc].name = "pid";
-            envs[envc++].value = nbuffer;
-            FIX_UP();
-        }
-        if( flags & klogFmtAppName ) {
-            rc = LogAppName(nbuffer, remaining, &num_writ);
-            nbuffer[num_writ++] = '\0';
-            envs[envc].name = "app";
-            envs[envc++].value = nbuffer;
-            FIX_UP();
-        }
-        if( flags & klogFmtAppVersion ) {
-            rc = LogAppVersion(nbuffer, remaining, &num_writ);
-            nbuffer[num_writ++] = '\0';
-            envs[envc].name = "version";
-            envs[envc++].value = nbuffer;
-            FIX_UP();
-        }
-        if( use_rc ) {
-            if( flags & klogFmtReason ) {
-                rc = RCExplain(status, nbuffer, remaining, &num_writ);
-                nbuffer[num_writ++] = '\0';
-                envs[envc].name = "reason";
-                envs[envc++].value = nbuffer;
-                FIX_UP();
-            }
-            if( flags & klogFmtReasonShort ) {
-                rc = RCExplain2(status, nbuffer, remaining, &num_writ, eRCExOpt_ObjAndStateOnlyIfError);
-                nbuffer[num_writ++] = '\0';
-                envs[envc].name = "reason_short";
-                envs[envc++].value = nbuffer;
-                FIX_UP();
-            }
-            if( flags & klogFmtRC ) {
-                rc = string_printf(nbuffer, remaining, & num_writ, "%R", status);
-                envs[envc].name = "rc";
-                envs[envc++].value = nbuffer;
-                FIX_UP();
-            }
-            if( flags & klogFmtModule ) {
-                envs[envc].name = "module";
-                envs[envc++].value = GetRCModuleIdxText(GetRCModule(status));
-            }
-            if( flags & klogFmtTarget ) {
-                envs[envc].name = "target";
-                envs[envc++].value = GetRCTargetIdxText(GetRCTarget(status));
-            }
-            if( flags & klogFmtContext ) {
-                envs[envc].name = "context";
-                envs[envc++].value = GetRCContextIdxText(GetRCContext(status));
-            }
-            if( flags & klogFmtObject ) {
-                envs[envc].name = "object";
-                envs[envc++].value = GetRCObjectIdxText(GetRCObject(status));
-            }
-            if( flags & klogFmtState ) {
-                envs[envc].name = "state";
-                envs[envc++].value = GetRCStateIdxText(GetRCState(status));
-            }
-            if( flags & klogFmtModuleText ) {
-                envs[envc].name = "module-text";
-                envs[envc++].value = GetRCModuleText(GetRCModule(status));
-            }
-            if( flags & klogFmtTargetText ) {
-                envs[envc].name = "target-text";
-                envs[envc++].value = GetRCTargetText(GetRCTarget(status));
-            }
-            if( flags & klogFmtContextText ) {
-                envs[envc].name = "context-text";
-                envs[envc++].value = GetRCContextText(GetRCContext(status));
-            }
-            if( flags & klogFmtObjectText ) {
-                envs[envc].name = "object-text";
-                envs[envc++].value = GetRCObjectText(GetRCObject(status));
-            }
-            if( flags & klogFmtStateText ) {
-                envs[envc].name = "state-text";
-                envs[envc++].value = GetRCStateText(GetRCState(status));
-            }
-        }
-#undef FIX_UP
-    } while(false);
-    /* env must have one spare element for message added text below */
-    if( rc == 0 && envc >= (sizeof(envs)/sizeof(envs[0])) ) {
-        rc = RC(rcRuntime, rcLog, rcLogging, rcTable, rcInsufficient);
-    }
-    nbuffer = (char*)abuffer;
-    remaining = sizeof(abuffer);
-    if( rc == 0 ) {
-        if( fmt != NULL ) {
-            rc = prep_v_args(&argc, argv, sizeof(argv)/sizeof(argv[0]) - 1, pbuffer, sizeof(pbuffer), fmt, args);
-        }
-        if( rc == 0 && (flags & klogFmtMessage) ) {
-            if( msg == NULL || msg[0] == '\0' ) {
-                msg = "empty log message";
-            }
-            do {
-                /* substitute parameters into message */
-                wrt_nvp_sort(envc, envs);
-                rc = logsubstituteparams(msg, argc, argv, envc, envs, nbuffer, remaining - 1, &num_writ);
-                if( GetRCState(rc) == rcInsufficient ) {
-                    if(nbuffer != abuffer) {
-                        free(nbuffer);
-                    }
-                    remaining += num_writ > remaining ? num_writ : remaining;
-                    nbuffer = malloc(remaining);
-                    if( nbuffer == NULL ) {
-                        rc = RC(rcRuntime, rcLog, rcLogging, rcMemory, rcExhausted);
-                    }
-                } else {
-                    if( rc == 0 ) {
-                        nbuffer[num_writ] = '\0';
-                        envs[envc].name = "message";
-                        envs[envc++].value = nbuffer;
-                    }
-                    break;
-                }
-            } while(rc == 0);
-        }
-    }
-    if( rc != 0 ) {
-        /* print reason for failure */
-        string_printf((char*)abuffer, sizeof(abuffer), &num_writ, "log failure: %R in '%s'", rc, msg);
-        envs[envc].name = "message";
-        envs[envc++].value = abuffer;
-    }
-
-    wrt_nvp_sort(envc, envs);
-
-    {
-        rc_t rc2 = fmtwrt(formatter->data, writer, argc, argv, envc, envs);
-        if( (rc2 == 0) && use_rc ) {
-            KLogLastErrorCodeSet(lvl, status);
-        }
-        if(nbuffer != abuffer) {
-            free(nbuffer);
-        }
-        return rc != 0 ? rc : rc2;
-    }
-}
-
-/* LogMsg
- *  makes an entry to the log file
- *
- *  "lvl" [ IN ] - severity of message
- *
- *  "msg" [ IN ] - NUL terminated string
- */
-
-LIB_EXPORT rc_t CC LogMsg ( KLogLevel lvl, const char *msg )
-{
-    if ( lvl > KLogLevelGet() )
-        return 0;
-
-    return log_print(KLogFmtHandlerGet(), G_log_formatter_flags,
-                     KLogHandlerGet(), lvl, false, 0, msg, NULL, NULL );
-}
-
-LIB_EXPORT rc_t CC LogLibMsg ( KLogLevel lvl, const char *msg )
-{
-    if ( lvl > KLogLevelGet() )
-        return 0;
-
-    return log_print(KLogLibFmtHandlerGet(), G_log_lib_formatter_flags, 
-                     KLogLibHandlerGet(), lvl, false, 0, msg, NULL, NULL );
-}
-
-
-/* LogErr
- *  reports an error to log file
- *
- *  "lvl" [ IN ] - severity of message
- *
- *  "status" [ IN ] - return code to be decoded
- *
- *  "msg" [ IN, NULL OKAY ] - optional NUL terminated message string
- */
-LIB_EXPORT rc_t CC LogErr ( KLogLevel lvl, rc_t status, const char *msg )
-{
-    if ( lvl > KLogLevelGet() )
-        return 0;
-
-    return log_print(KLogFmtHandlerGet(), G_log_formatter_flags,
-                     KLogHandlerGet(), lvl, true, status, msg, NULL, NULL );
-}
-
-LIB_EXPORT rc_t CC LogLibErr ( KLogLevel lvl, rc_t status, const char *msg )
-{
-    if ( lvl > KLogLevelGet() )
-        return 0;
-
-    return log_print(KLogLibFmtHandlerGet(), G_log_lib_formatter_flags,
-                     KLogLibHandlerGet(), lvl, true, status, msg, NULL, NULL );
-}
-
-/* vLogMsg
- *  makes a parameterized entry to the log file
- *
- *  "lvl" [ IN ] - severity of message
- *
- *  "msg" [ IN ] - NUL terminated string with named parameters
- *
- *  "fmt" [ IN ] - NUL terminated format string, behaves according
- *  to standard printf-style formatting
- */
-LIB_EXPORT rc_t CC vLogMsg ( KLogLevel lvl, const char *msg, const char *fmt, va_list args )
-{
-    if ( lvl > KLogLevelGet() )
-        return 0;
-
-    return log_print(KLogFmtHandlerGet(), G_log_formatter_flags,
-                     KLogHandlerGet(), lvl, false, 0, msg, fmt, args );
-}
-
-LIB_EXPORT rc_t CC vLogLibMsg ( KLogLevel lvl, const char *msg, const char *fmt, va_list args )
-{
-    if ( lvl > KLogLevelGet() )
-        return 0;
-
-    return log_print(KLogLibFmtHandlerGet(), G_log_lib_formatter_flags,
-                     KLogLibHandlerGet(), lvl, false, 0, msg, fmt, args );
-}
-
-/* vLogErr
- *  reports an error to log file
- *
- *  "lvl" [ IN ] - severity of message
- *
- *  "status" [ IN ] - return code to be decoded
- *
- *  "msg" [ IN ] - NUL terminated message string with named parameters
- *
- *  "fmt" [ IN ] - NUL terminated format string, behaves according
- *  to standard printf-style formatting
- */
-LIB_EXPORT rc_t CC vLogErr ( KLogLevel lvl, rc_t status, const char *msg, const char *fmt, va_list args )
-{
-    if ( lvl > KLogLevelGet() )
-        return 0;
-
-    return log_print(KLogFmtHandlerGet(), G_log_formatter_flags,
-                     KLogHandlerGet(), lvl, true, status, msg, fmt, args );
-}
-
-LIB_EXPORT rc_t CC vLogLibErr ( KLogLevel lvl, rc_t status, const char *msg, const char *fmt, va_list args )
-{
-    if ( lvl > KLogLevelGet() )
-        return 0;
-    return log_print(KLogLibFmtHandlerGet(), G_log_lib_formatter_flags,
-                     KLogLibHandlerGet(), lvl, true, status, msg, fmt, args );
-}
-
-/* pLogErr
- *  reports an error to log file
- *
- *  "lvl" [ IN ] - severity of message
- *
- *  "status" [ IN ] - return code to be decoded
- *
- *  "msg" [ IN ] - NUL terminated message string with named parameters
- *
- *  "fmt" [ IN ] - NUL terminated format string, behaves according
- *  to standard printf-style formatting
- */
-LIB_EXPORT rc_t CC pLogErr ( KLogLevel lvl, rc_t status, const char *msg, const char *fmt, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    if ( lvl > KLogLevelGet() )
-        return 0;
-
-    va_start ( args, fmt );
-    rc = vLogErr ( lvl, status, msg, fmt, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC pLogLibErr ( KLogLevel lvl, rc_t status, const char *msg, const char *fmt, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    if ( lvl > KLogLevelGet() )
-        return 0;
-
-    va_start ( args, fmt );
-    rc = vLogLibErr ( lvl, status, msg, fmt, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KLogHandlerSetStdOut ( void )
-{
-    return KLogHandlerSet(KWrt_DefaultWriter, KWrt_DefaultWriterDataStdOut);
-}
-
-LIB_EXPORT rc_t CC KLogLibHandlerSetStdOut ( void )
-{
-    return KLogLibHandlerSet(KWrt_DefaultWriter, KWrt_DefaultWriterDataStdOut);
-}
-
-LIB_EXPORT rc_t CC KLogHandlerSetStdErr ( void )
-{
-    return KLogHandlerSet(KWrt_DefaultWriter, KWrt_DefaultWriterDataStdErr);
-}
-
-LIB_EXPORT rc_t CC KLogLibHandlerSetStdErr ( void )
-{
-    return KLogLibHandlerSet(KWrt_DefaultWriter, KWrt_DefaultWriterDataStdErr);
-}
-
-LIB_EXPORT rc_t CC KLogHandlerSet ( KWrtWriter writer, void * data )
-{
-    G_log_writer.writer = writer;
-    G_log_writer.data = data;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KLogLibHandlerSet ( KWrtWriter writer, void * data )
-{
-    G_log_lib_writer.writer = writer;
-    G_log_lib_writer.data = data;
-    return 0;
-}
-
-LIB_EXPORT void * CC KLogDataGet ( void )
-{
-    return ( KLogHandlerGet()->data );
-}
-
-LIB_EXPORT void * CC KLogLibDataGet ( void )
-{
-    return ( KLogLibHandlerGet()->data );
-}
-
-LIB_EXPORT KWrtWriter CC KLogWriterGet ( void )
-{
-    return ( KLogHandlerGet()->writer );
-}
-
-LIB_EXPORT KWrtWriter CC KLogLibWriterGet ( void )
-{
-    return ( KLogLibHandlerGet()->writer );
-}
-
-LIB_EXPORT KWrtHandler * CC KLogHandlerGet ( void )
-{
-    return ( &G_log_writer );
-}
-
-LIB_EXPORT KWrtHandler * CC KLogLibHandlerGet ( void )
-{
-    return ( &G_log_lib_writer );
-}
-
-static const uint32_t log_dflt_opt = klogFmtTimestamp | klogFmtSeverity | klogFmtPid |
-                klogFmtMessage | klogFmtAppName | klogFmtAppVersion | klogFmtReason;
-
-LIB_EXPORT rc_t CC KLogFmtHandlerSetDefault ( void )
-{
-    rc_t rc = KLogFmtHandlerSet(KLogDefaultFormatter, 0, NULL);
-    if( rc == 0 ) {
-        G_log_formatter_flags = log_dflt_opt;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KLogLibFmtHandlerSetDefault ( void )
-{
-    rc_t rc = KLogLibFmtHandlerSet(KLogDefaultFormatter, 0, NULL);
-    if( rc == 0 ) {
-        G_log_lib_formatter_flags = log_dflt_opt;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KLogFmtFlagsSet ( KLogFmtFlags flags )
-{
-    G_log_formatter_flags |= flags;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KLogLibFmtFlagsSet ( KLogFmtFlags flags )
-{
-    G_log_lib_formatter_flags |= flags;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KLogFmtHandlerSet ( KFmtWriter formatter, KLogFmtFlags flags, void* data )
-{
-    if( formatter == NULL ) {
-        return RC(rcRuntime, rcLog, rcLogging, rcFunction, rcNull);
-    }
-    G_log_formatter.formatter = formatter;
-    G_log_formatter.data = data;
-    KLogFmtFlagsSet(flags);
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KLogLibFmtHandlerSet ( KFmtWriter formatter, KLogFmtFlags flags, void* data )
-{
-    if( formatter == NULL ) {
-        return RC(rcRuntime, rcLog, rcLogging, rcFunction, rcNull);
-    }
-    G_log_lib_formatter.formatter = formatter;
-    G_log_lib_formatter.data = data;
-    KLogLibFmtFlagsSet(flags);
-    return 0;
-}
-
-LIB_EXPORT void * CC KLogFmtDataGet ( void )
-{
-    return ( KLogFmtHandlerGet()->data );
-}
-
-LIB_EXPORT void * CC KLogLibFmtDataGet ( void )
-{
-    return ( KLogFmtHandlerGet()->data );
-}
-
-LIB_EXPORT KFmtWriter CC KLogFmtWriterGet ( void )
-{
-    return ( KLogFmtHandlerGet()->formatter ? KLogFmtHandlerGet()->formatter : KLogDefaultFormatter );
-}
-
-LIB_EXPORT KFmtWriter CC KLogLibFmtWriterGet ( void )
-{
-    return ( KLogLibFmtHandlerGet()->formatter ? KLogLibFmtHandlerGet()->formatter : KLogDefaultFormatter );
-}
-
-LIB_EXPORT KFmtHandler * CC KLogFmtHandlerGet ( void )
-{
-    return ( &G_log_formatter );
-}
-
-LIB_EXPORT KFmtHandler * CC KLogLibFmtHandlerGet ( void )
-{
-    return ( &G_log_lib_formatter );
-}
-
-LIB_EXPORT KLogFmtFlags CC KLogFmtFlagsGet ( void )
-{
-    return G_log_formatter_flags;
-}
-
-LIB_EXPORT KLogFmtFlags CC KLogLibFmtFlagsGet ( void )
-{
-    return G_log_lib_formatter_flags;
-}
diff --git a/libs/klib/maybeswap.h b/libs/klib/maybeswap.h
deleted file mode 100644
index 71696a0..0000000
--- a/libs/klib/maybeswap.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_maybeswap_
-#define _h_maybeswap_
-
-/* technically, a whitelist would be safer */
-#ifdef __sparc
-#  if SWAP_PERSISTED
-#    define GET_UNALIGNED( type, swap, dest, src )                  \
-        do {                                                        \
-            type tmp##__LINE__;                                     \
-            memcpy ( & tmp##__LINE__, & ( src ), sizeof ( type ) ); \
-            dest = swap ( tmp##__LINE__ );                          \
-        } while (0)
-#  else
-#    define GET_UNALIGNED( type, swap, dest, src ) \
-        memcpy ( & ( dest ), & ( src ), sizeof ( type ) )
-#  endif
-#elif SWAP_PERSISTED
-#  define GET_UNALIGNED( type, swap, dest, src ) dest = swap ( src )
-#else
-#  define GET_UNALIGNED( type, swap, dest, src ) \
-      dest = ( * ( const type* ) & ( src ) )
-#endif
-
-#include <byteswap.h>
-
-#define GET16( dest, src ) GET_UNALIGNED ( uint16_t, bswap_16, dest, src )
-#define GET32( dest, src ) GET_UNALIGNED ( uint32_t, bswap_32, dest, src )
-#define GET64( dest, src ) GET_UNALIGNED ( uint64_t, bswap_64, dest, src )
-
-#endif /* _h_maybeswap_ */
-
diff --git a/libs/klib/md5.c b/libs/klib/md5.c
deleted file mode 100644
index 4a717c6..0000000
--- a/libs/klib/md5.c
+++ /dev/null
@@ -1,421 +0,0 @@
-/*
-  Copyright (C) 1999 Aladdin Enterprises.  All rights reserved.
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  L. Peter Deutsch
-  ghost at aladdin.com
-
-*/
-/*
-  Independent implementation of MD5 (RFC 1321).
-
-  This code implements the MD5 Algorithm defined in RFC 1321.
-  It is derived directly from the text of the RFC and not from the
-  reference implementation.
-
-  The original and principal author of md5.c is L. Peter Deutsch
-  <ghost at aladdin.com>.  Other authors are noted in the change history
-  that follows (in reverse chronological order):
-
-  1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
-  1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5).
-  1999-05-03 lpd Original version.
-*/
-
-/*
-  This software is derived from original work by Peter Deutsch.
-  It has been incorporated into a body of PUBLIC DOMAIN software
-  distributed by the National Center for Biotechnology Information.
-
-  Although all reasonable efforts have been taken to ensure the accuracy
-  and reliability of the software and data, the NLM and the U.S.
-  Government do not and cannot warrant the performance or results that
-  may be obtained by using this software or data. The NLM and the U.S.
-  Government disclaim all warranties, express or implied, including
-  warranties of performance, merchantability or fitness for any particular
-  purpose.
-*/
-
-#include <klib/extern.h>
-#include <klib/checksum.h>
-#include <sysalloc.h>
-
-#include <string.h>
-#include <endian.h>
-#include <byteswap.h>
-
-#if ! defined __BYTE_ORDER || ! defined __LITTLE_ENDIAN
-#error "missing byte order definitions"
-#endif
-
-
-
-/*--------------------------------------------------------------------------
- * MD5
- *  taken from Peter Deutsch's sources due to simplicity
- */
-#define T_MASK ( ( uint32_t ) ~ 0 )
-
-/* MD5StateInit
- *  initialize the algorithm and state block
- */
-LIB_EXPORT void CC MD5StateInit ( MD5State *md5 )
-{
-    if ( md5 != NULL )
-    {
-        md5 -> count [ 0 ] = md5 -> count [ 1 ] = 0;
-        md5 -> abcd [ 0 ] = 0x67452301;
-        md5 -> abcd [ 1 ] = /*0xefcdab89*/ T_MASK ^ 0x10325476;
-        md5 -> abcd [ 2 ] = /*0x98badcfe*/ T_MASK ^ 0x67452301;
-        md5 -> abcd [ 3 ] = 0x10325476;
-        memset(md5->buf,0,sizeof(md5->buf));
-    }
-}
-
-/* MDStateProcess
- *  input is taken in blocks of little-endian 32 bit words
- *
- *  for big endian machines, this means data are copied
- *  and rearranged.
- *
- *  for little endian, data are copied if not properly aligned
- */
-#define T1 /* 0xd76aa478 */ ( T_MASK ^ 0x28955b87 )
-#define T2 /* 0xe8c7b756 */ ( T_MASK ^ 0x173848a9 )
-#define T3    0x242070db
-#define T4 /* 0xc1bdceee */ ( T_MASK ^ 0x3e423111 )
-#define T5 /* 0xf57c0faf */ ( T_MASK ^ 0x0a83f050 )
-#define T6    0x4787c62a
-#define T7 /* 0xa8304613 */ ( T_MASK ^ 0x57cfb9ec )
-#define T8 /* 0xfd469501 */ ( T_MASK ^ 0x02b96afe )
-#define T9    0x698098d8
-#define T10 /* 0x8b44f7af */ ( T_MASK ^ 0x74bb0850 )
-#define T11 /* 0xffff5bb1 */ ( T_MASK ^ 0x0000a44e )
-#define T12 /* 0x895cd7be */ ( T_MASK ^ 0x76a32841 )
-#define T13    0x6b901122
-#define T14 /* 0xfd987193 */ ( T_MASK ^ 0x02678e6c )
-#define T15 /* 0xa679438e */ ( T_MASK ^ 0x5986bc71 )
-#define T16    0x49b40821
-#define T17 /* 0xf61e2562 */ ( T_MASK ^ 0x09e1da9d )
-#define T18 /* 0xc040b340 */ ( T_MASK ^ 0x3fbf4cbf )
-#define T19    0x265e5a51
-#define T20 /* 0xe9b6c7aa */ ( T_MASK ^ 0x16493855 )
-#define T21 /* 0xd62f105d */ ( T_MASK ^ 0x29d0efa2 )
-#define T22    0x02441453
-#define T23 /* 0xd8a1e681 */ ( T_MASK ^ 0x275e197e )
-#define T24 /* 0xe7d3fbc8 */ ( T_MASK ^ 0x182c0437 )
-#define T25    0x21e1cde6
-#define T26 /* 0xc33707d6 */ ( T_MASK ^ 0x3cc8f829 )
-#define T27 /* 0xf4d50d87 */ ( T_MASK ^ 0x0b2af278 )
-#define T28    0x455a14ed
-#define T29 /* 0xa9e3e905 */ ( T_MASK ^ 0x561c16fa )
-#define T30 /* 0xfcefa3f8 */ ( T_MASK ^ 0x03105c07 )
-#define T31    0x676f02d9
-#define T32 /* 0x8d2a4c8a */ ( T_MASK ^ 0x72d5b375 )
-#define T33 /* 0xfffa3942 */ ( T_MASK ^ 0x0005c6bd )
-#define T34 /* 0x8771f681 */ ( T_MASK ^ 0x788e097e )
-#define T35    0x6d9d6122
-#define T36 /* 0xfde5380c */ ( T_MASK ^ 0x021ac7f3 )
-#define T37 /* 0xa4beea44 */ ( T_MASK ^ 0x5b4115bb )
-#define T38    0x4bdecfa9
-#define T39 /* 0xf6bb4b60 */ ( T_MASK ^ 0x0944b49f )
-#define T40 /* 0xbebfbc70 */ ( T_MASK ^ 0x4140438f )
-#define T41    0x289b7ec6
-#define T42 /* 0xeaa127fa */ ( T_MASK ^ 0x155ed805 )
-#define T43 /* 0xd4ef3085 */ ( T_MASK ^ 0x2b10cf7a )
-#define T44    0x04881d05
-#define T45 /* 0xd9d4d039 */ ( T_MASK ^ 0x262b2fc6 )
-#define T46 /* 0xe6db99e5 */ ( T_MASK ^ 0x1924661a )
-#define T47    0x1fa27cf8
-#define T48 /* 0xc4ac5665 */ ( T_MASK ^ 0x3b53a99a )
-#define T49 /* 0xf4292244 */ ( T_MASK ^ 0x0bd6ddbb )
-#define T50    0x432aff97
-#define T51 /* 0xab9423a7 */ ( T_MASK ^ 0x546bdc58 )
-#define T52 /* 0xfc93a039 */ ( T_MASK ^ 0x036c5fc6 )
-#define T53    0x655b59c3
-#define T54 /* 0x8f0ccc92 */ ( T_MASK ^ 0x70f3336d )
-#define T55 /* 0xffeff47d */ ( T_MASK ^ 0x00100b82 )
-#define T56 /* 0x85845dd1 */ ( T_MASK ^ 0x7a7ba22e )
-#define T57    0x6fa87e4f
-#define T58 /* 0xfe2ce6e0 */ ( T_MASK ^ 0x01d3191f )
-#define T59 /* 0xa3014314 */ ( T_MASK ^ 0x5cfebceb )
-#define T60    0x4e0811a1
-#define T61 /* 0xf7537e82 */ ( T_MASK ^ 0x08ac817d )
-#define T62 /* 0xbd3af235 */ ( T_MASK ^ 0x42c50dca )
-#define T63    0x2ad7d2bb
-#define T64 /* 0xeb86d391 */ ( T_MASK ^ 0x14792c6e )
-
-static
-void MD5StateProcess ( MD5State *md5, const uint8_t *data /* [ 64 ] */ ) 
-{
-    uint32_t t;
-
-    uint32_t a = md5 -> abcd [ 0 ];
-    uint32_t b = md5 -> abcd [ 1 ];
-    uint32_t c = md5 -> abcd [ 2 ];
-    uint32_t d = md5 -> abcd [ 3 ];
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-
-    uint32_t xbuf [ 16 ];
-
-    /* assume proper alignment */
-    const uint32_t *X = ( const uint32_t* ) data;
-
-    /* check alignment */
-    if ( ( ( size_t ) X & 3 ) != 0 )
-    {
-        /* use buffer instead */
-        X = xbuf;
-        memcpy ( xbuf, data, 64 );
-    }
-
-#elif __BYTE_ORDER == __BIG_ENDIAN
-
-    int i;
-    uint32_t X [ 16 ];
-    if ( ( ( size_t ) data & 3 ) == 0 )
-    {
-        const uint32_t *xp = ( const uint32_t* ) data;
-        for ( i = 0; i < 16; ++ i )
-            X [ i ] = bswap_32 ( xp [ i ] );
-    }
-
-    else
-    {
-        const uint8_t *xp = data;
-        for ( i = 0; i < 16; xp += 4, ++ i ) 
-            X [ i ] = xp [ 0 ] + ( xp [ 1 ] << 8 ) + ( xp [ 2 ] << 16 ) + ( xp [ 3 ] << 24 );
-    }
-
-#else
-#error "only big or little endian is supported"
-#endif
-
-#define ROTATE_LEFT( x, n ) \
-    ( ( ( x ) << ( n ) ) | ( ( x ) >> ( 32 - ( n ) ) ) ) 
-
-    /* Round 1. */
-    /* Let  [ abcd k s i ] denote the operation
-       a = b + ( ( a + F ( b,c,d ) + X [ k ] + T [ i ] ) <<< s ) . */
-#define F( x, y, z ) \
-    ( ( ( x ) & ( y ) ) | ( ~ ( x ) & ( z ) ) ) 
-#define SET( a, b, c, d, k, s, Ti ) \
-    t = a + F ( b,c,d ) + X [ k ] + Ti;\
-    a = ROTATE_LEFT ( t, s ) + b
-
-    /* Do the following 16 operations. */
-    SET ( a, b, c, d,  0,  7,  T1 );
-    SET ( d, a, b, c,  1, 12,  T2 );
-    SET ( c, d, a, b,  2, 17,  T3 );
-    SET ( b, c, d, a,  3, 22,  T4 );
-    SET ( a, b, c, d,  4,  7,  T5 );
-    SET ( d, a, b, c,  5, 12,  T6 );
-    SET ( c, d, a, b,  6, 17,  T7 );
-    SET ( b, c, d, a,  7, 22,  T8 );
-    SET ( a, b, c, d,  8,  7,  T9 );
-    SET ( d, a, b, c,  9, 12, T10 );
-    SET ( c, d, a, b, 10, 17, T11 );
-    SET ( b, c, d, a, 11, 22, T12 );
-    SET ( a, b, c, d, 12,  7, T13 );
-    SET ( d, a, b, c, 13, 12, T14 );
-    SET ( c, d, a, b, 14, 17, T15 );
-    SET ( b, c, d, a, 15, 22, T16 );
-#undef SET
-#undef F
-
-    /* Round 2. */
-    /* Let  [ abcd k s i ] denote the operation
-       a = b + ( ( a + G ( b,c,d ) + X [ k ] + T [ i ] ) <<< s ) . */
-#define G( x, y, z ) \
-    ( ( ( x ) & ( z ) ) | ( ( y ) & ~ ( z ) ) ) 
-#define SET( a, b, c, d, k, s, Ti ) \
-    t = a + G ( b,c,d ) + X [ k ] + Ti;\
-    a = ROTATE_LEFT ( t, s ) + b
-
-    /* Do the following 16 operations. */
-    SET ( a, b, c, d,  1,  5, T17 );
-    SET ( d, a, b, c,  6,  9, T18 );
-    SET ( c, d, a, b, 11, 14, T19 );
-    SET ( b, c, d, a,  0, 20, T20 );
-    SET ( a, b, c, d,  5,  5, T21 );
-    SET ( d, a, b, c, 10,  9, T22 );
-    SET ( c, d, a, b, 15, 14, T23 );
-    SET ( b, c, d, a,  4, 20, T24 );
-    SET ( a, b, c, d,  9,  5, T25 );
-    SET ( d, a, b, c, 14,  9, T26 );
-    SET ( c, d, a, b,  3, 14, T27 );
-    SET ( b, c, d, a,  8, 20, T28 );
-    SET ( a, b, c, d, 13,  5, T29 );
-    SET ( d, a, b, c,  2,  9, T30 );
-    SET ( c, d, a, b,  7, 14, T31 );
-    SET ( b, c, d, a, 12, 20, T32 );
-#undef SET
-#undef G
-
-    /* Round 3. */
-    /* Let  [ abcd k s t ] denote the operation
-       a = b + ( ( a + H ( b,c,d ) + X [ k ] + T [ i ] ) <<< s ) . */
-#define H( x, y, z ) \
-    ( ( x ) ^ ( y ) ^ ( z ) ) 
-#define SET( a, b, c, d, k, s, Ti ) \
-    t = a + H ( b,c,d ) + X [ k ] + Ti;\
-    a = ROTATE_LEFT ( t, s ) + b
-    
-    /* Do the following 16 operations. */
-    SET ( a, b, c, d,  5,  4, T33 );
-    SET ( d, a, b, c,  8, 11, T34 );
-    SET ( c, d, a, b, 11, 16, T35 );
-    SET ( b, c, d, a, 14, 23, T36 );
-    SET ( a, b, c, d,  1,  4, T37 );
-    SET ( d, a, b, c,  4, 11, T38 );
-    SET ( c, d, a, b,  7, 16, T39 );
-    SET ( b, c, d, a, 10, 23, T40 );
-    SET ( a, b, c, d, 13,  4, T41 );
-    SET ( d, a, b, c,  0, 11, T42 );
-    SET ( c, d, a, b,  3, 16, T43 );
-    SET ( b, c, d, a,  6, 23, T44 );
-    SET ( a, b, c, d,  9,  4, T45 );
-    SET ( d, a, b, c, 12, 11, T46 );
-    SET ( c, d, a, b, 15, 16, T47 );
-    SET ( b, c, d, a,  2, 23, T48 );
-#undef SET
-#undef H
-
-    /* Round 4. */
-    /* Let  [ abcd k s t ] denote the operation
-       a = b + ( ( a + I ( b,c,d ) + X [ k ] + T [ i ] ) <<< s ) . */
-#define I( x, y, z )                            \
-    ( ( y ) ^ ( ( x ) | ~ ( z ) ) ) 
-#define SET( a, b, c, d, k, s, Ti ) \
-    t = a + I ( b,c,d ) + X [ k ] + Ti;\
-    a = ROTATE_LEFT ( t, s ) + b
-
-    /* Do the following 16 operations. */
-    SET ( a, b, c, d,  0,  6, T49 );
-    SET ( d, a, b, c,  7, 10, T50 );
-    SET ( c, d, a, b, 14, 15, T51 );
-    SET ( b, c, d, a,  5, 21, T52 );
-    SET ( a, b, c, d, 12,  6, T53 );
-    SET ( d, a, b, c,  3, 10, T54 );
-    SET ( c, d, a, b, 10, 15, T55 );
-    SET ( b, c, d, a,  1, 21, T56 );
-    SET ( a, b, c, d,  8,  6, T57 );
-    SET ( d, a, b, c, 15, 10, T58 );
-    SET ( c, d, a, b,  6, 15, T59 );
-    SET ( b, c, d, a, 13, 21, T60 );
-    SET ( a, b, c, d,  4,  6, T61 );
-    SET ( d, a, b, c, 11, 10, T62 );
-    SET ( c, d, a, b,  2, 15, T63 );
-    SET ( b, c, d, a,  9, 21, T64 );
-#undef SET
-#undef I
-
-    /* Then perform the following additions. ( That is increment each
-       of the four registers by the value it had before this block
-       was started. ) */
-    md5 -> abcd [ 0 ] += a;
-    md5 -> abcd [ 1 ] += b;
-    md5 -> abcd [ 2 ] += c;
-    md5 -> abcd [ 3 ] += d;
-}
-
-
-/* MD5StateAppend
- *  run MD5 on data block
- *  accumulate results into "md5"
- *  processes data in chunks
- */
-LIB_EXPORT void CC MD5StateAppend ( MD5State *md5, const void *data, size_t size  ) 
-{
-    if ( md5 != NULL && data != NULL && size > 0 )
-    {
-        const uint8_t *p = data;
-        size_t left = size;
-        size_t offset = ( md5 -> count [ 0 ] >> 3 ) & 63;
-        uint32_t nbits = ( uint32_t ) ( size << 3 );
-
-        /* update the message length. */
-        md5 -> count [ 1 ] += ( uint32_t ) size >> 29;
-        md5 -> count [ 0 ] += nbits;
-
-        /* detect roll-over */
-        if ( md5 -> count [ 0 ] < nbits ) 
-            ++ md5 -> count [ 1 ];
-
-        /* process an initial partial block. */
-        if ( offset )
-        {
-            /* bytes to copy from input data are from offset up to 64 */
-            size_t copy = ( offset + size > 64 ? 64 - offset : size );
-            memcpy ( md5 -> buf + offset, p, copy );
-
-            /* don't process a tiny partial block */
-            if ( offset + copy < 64 ) 
-                return;
-
-            /* trim off initial bytes */
-            p += copy;
-            left -= copy;
-
-            /* process full state buffer */
-            MD5StateProcess ( md5, md5 -> buf );
-        }
-
-        /* continue processing blocks directly from input */
-        for ( ; left >= 64; p += 64, left -= 64 ) 
-            MD5StateProcess ( md5, p );
-
-        /* buffer any remainder */
-        if ( left ) 
-            memcpy ( md5 -> buf, p, left );
-    }
-}
-
-/* MD5StateFinish
- *  processes any remaining data in "md5"
- *  returns 16 bytes of digest
- */
-LIB_EXPORT void CC MD5StateFinish ( MD5State *md5, uint8_t digest  [ 16 ] ) 
-{
-    if ( md5 != NULL )
-    {
-        int i;
-        uint8_t data [ 8 ];
-        static const uint8_t pad [ 64 ] = {
-            0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-               0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-               0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-               0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-        };
-
-        /* save the length before padding in little-endian order */
-        for ( i = 0; i < 8; ++ i ) 
-            data [ i ] = ( uint8_t ) ( md5 -> count [ i >> 2 ] >> ( ( i & 3 ) << 3 ) );
-
-        /* Pad to 56 bytes mod 64. */
-        MD5StateAppend ( md5, pad, ( ( 55 - ( md5 -> count [ 0 ] >> 3 ) ) & 63 ) + 1 );
-
-        /* Append the length. */
-        MD5StateAppend ( md5, data, 8 );
-
-        /* create digest */
-        for ( i = 0; i < 16; ++ i ) 
-            digest [ i ] = ( uint8_t ) ( md5 -> abcd [ i >> 2 ] >> ( ( i & 3 ) << 3 ) );
-    }
-}
diff --git a/libs/klib/namelist.c b/libs/klib/namelist.c
deleted file mode 100644
index 4806d4c..0000000
--- a/libs/klib/namelist.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include <klib/rc.h>
-#include <klib/impl.h>
-#include <sysalloc.h>
-
-#define KNAMELIST_LATEST 1
-
-/*--------------------------------------------------------------------------
- * KNamelist
- *  a simple array of entry names
- */
-
-/* AddRef
- *  creates a new reference
- *  ignores NULL references
- */
-LIB_EXPORT rc_t CC KNamelistAddRef ( const KNamelist *self )
-{
-    if ( self != NULL )
-        atomic_inc ( & ( ( KNamelist* ) self ) -> refcount );
-    return 0;
-}
-
-/* Release
- *  discard reference to list
- *  ignores NULL references
- */
-LIB_EXPORT rc_t CC KNamelistRelease ( const KNamelist *cself )
-{
-    KNamelist *self = ( KNamelist* ) cself;
-    if ( cself != NULL )
-    {
-        if ( atomic_dec_and_test ( & self -> refcount ) )
-        {
-            rc_t status;
-            switch ( self -> vt -> v1 . maj )
-            {
-            case 1:
-                status = ( * self -> vt -> v1 . destroy ) ( self );
-                break;
-            default:
-                status = RC ( rcCont, rcNamelist, rcReleasing, rcInterface, rcBadVersion );
-            }
-
-            if ( status != 0 )
-                atomic_set ( & self -> refcount, 1 );
-
-            return status;
-        }
-    }
-    return 0;
-}
-
-/* Count
- *  returns the number of entries
- *
- *  "count" [ OUT ] - return parameter for entry count
- */
-LIB_EXPORT rc_t CC KNamelistCount ( const KNamelist *self, uint32_t *count )
-{
-    if ( count == NULL )
-        return RC ( rcCont, rcNamelist, rcAccessing, rcParam, rcNull );
-
-    * count = 0;
-
-    if ( self == NULL )
-        return RC ( rcCont, rcNamelist, rcAccessing, rcSelf, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . count ) ( self, count );
-    }
-
-    return RC ( rcCont, rcNamelist, rcAccessing, rcInterface, rcBadVersion );
-}
-
-/* Get
- *  get an indexed name
- *
- *  "idx" [ IN ] - a zero-based name index
- *
- *  "name" [ OUT ] - return parameter for NUL terminated name
- */
-LIB_EXPORT rc_t CC KNamelistGet ( const KNamelist *self,
-    uint32_t idx, const char **name )
-{
-    if ( name == NULL )
-        return RC ( rcCont, rcNamelist, rcAccessing, rcParam, rcNull );
-
-    * name = NULL;
-
-    if ( self == NULL )
-        return RC ( rcCont, rcNamelist, rcAccessing, rcSelf, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . get ) ( self, idx, name );
-    }
-
-    return RC ( rcCont, rcNamelist, rcAccessing, rcInterface, rcBadVersion );
-}
-
-/* Init
- *  polymorphic parent constructor
- */
-LIB_EXPORT rc_t CC KNamelistInit ( KNamelist *self, const KNamelist_vt *vt )
-{
-    if ( self == NULL || vt == NULL )
-        return RC ( rcCont, rcNamelist, rcConstructing, rcSelf, rcNull );
-
-    if ( vt -> v1 . maj == 0 )
-        return RC ( rcCont, rcNamelist, rcConstructing, rcInterface, rcInvalid );
-
-    if ( vt -> v1 . maj > KNAMELIST_LATEST )
-        return RC ( rcCont, rcNamelist, rcConstructing, rcInterface, rcBadVersion );
-
-    self -> vt = vt;
-    atomic_set ( & self -> refcount, 1 );
-
-    return 0;
-}
diff --git a/libs/klib/out.c b/libs/klib/out.c
deleted file mode 100644
index 4e1b0de..0000000
--- a/libs/klib/out.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*/
-
-#include <klib/extern.h>
-#include <klib/out.h>
-#include "writer-priv.h"
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdarg.h>
-
-LIB_EXPORT KWrtHandler G_out_handler;
-
-LIB_EXPORT rc_t CC KOutInit ( void )
-{
-    rc_t rc;
-
-    rc = KOutHandlerSetStdOut();
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KOutMsg ( const char * fmt, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, fmt );
-
-    if( (rc = vkfprintf(KOutHandlerGet(), NULL, fmt, args)) != 0 ) {
-        kfprintf(KOutHandlerGet(), NULL, "outmsg failure: %R in '%s'\n", rc, fmt);
-    }
-
-    va_end ( args );
-
-    return rc;
-}
-
-/* kprintf
- *  performs a printf to our output writer
- *  much like KOutMsg, but returns a size_t
- */
-LIB_EXPORT rc_t CC kprintf ( size_t *num_writ, const char * fmt, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, fmt );
-
-    rc = vkfprintf ( KOutHandlerGet (), num_writ, fmt, args );
-
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC vkprintf ( size_t *num_writ, const char * fmt, va_list args )
-{
-    return vkfprintf ( KOutHandlerGet (), num_writ, fmt, args );
-}
-
-
-#undef KOutHandlerSetStdOut
-LIB_EXPORT rc_t CC KOutHandlerSetStdOut ( void )
-{
-    return KOutHandlerSet( KWrt_DefaultWriter, KWrt_DefaultWriterDataStdOut );
-}
-
-
-#undef KOutHandlerSetStdErr
-LIB_EXPORT rc_t CC KOutHandlerSetStdErr ( void )
-{
-    return KOutHandlerSet( KWrt_DefaultWriter, KWrt_DefaultWriterDataStdErr );
-}
-
-
-#undef KOutHandlerSet
-LIB_EXPORT rc_t CC KOutHandlerSet ( KWrtWriter writer, void * writer_data )
-{
-    G_out_handler.writer = writer;
-    G_out_handler.data = writer_data;
-    return 0;
-}
-
-
-#undef KOutDataGet
-LIB_EXPORT void * CC KOutDataGet ( void )
-{
-    return ( KOutHandlerGet()->data );
-}
-
-
-#undef KOutWriterGet
-LIB_EXPORT KWrtWriter CC KOutWriterGet ( void )
-{
-    return ( KOutHandlerGet()->writer );
-}
-
-
-#undef KOutHandlerGet
-LIB_EXPORT KWrtHandler * CC KOutHandlerGet ( void )
-{
-    return ( &G_out_handler );
-}
diff --git a/libs/klib/pack.c b/libs/klib/pack.c
deleted file mode 100644
index 0b8285a..0000000
--- a/libs/klib/pack.c
+++ /dev/null
@@ -1,517 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include <klib/pack.h>
-#include <klib/rc.h>
-#include <arch-impl.h>
-#include <sysalloc.h>
-
-#include <endian.h>
-#include <byteswap.h>
-#include <string.h>
-#include <assert.h>
-
-#if ! defined __LITTLE_ENDIAN && ! defined __BIG_ENDIAN
-#error "only little and big endian architectures are supported"
-#endif
-
-
-/*--------------------------------------------------------------------------
- * pack
- */
-#define MASK_SRC 0
-
-/* READ_UNPACKED
- *  macro to read source elements into register
- *  casts source pointer to appropriate type
- *  performs byte swap if necessary to ensure that
- *    elements are in reverse order
- */
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define READ_UNPACKED8( src, idx ) \
-    ( ( const uint32_t* ) ( src ) ) [ idx ]
-#else
-#define READ_UNPACKED8( src, idx ) \
-    bswap_32 ( ( ( const uint32_t* ) ( src ) ) [ idx ] )
-#endif
-
-#define READ_UNPACKED16( src, idx ) \
-    ( ( const uint16_t* ) ( src ) ) [ idx ]
-
-#define READ_UNPACKED32( src, idx ) \
-    ( ( const uint32_t* ) ( src ) ) [ idx ]
-
-#define READ_UNPACKED64( src, idx ) \
-    ( ( const uint64_t* ) ( src ) ) [ idx ]
-
-/* MASK
- *  macro to mask off portion of source register
- */
-#if MASK_SRC
-
-#define MASK8( in ) \
-    ( in ) & src_mask
-#define MASK16( in ) \
-    ( in ) & src_mask
-#define MASK32( in ) \
-    ( in ) & src_mask
-#define MASK64( in ) \
-    ( in ) & src_mask
-
-#else
-
-#define MASK8( in ) \
-    ( uint8_t ) ( in )
-#define MASK16( in ) \
-    ( uint16_t ) ( in )
-#define MASK32( in ) \
-    ( uint32_t ) ( in )
-#define MASK64( in ) \
-    ( uint64_t ) ( in )
-
-#endif
-
-
-/* WRITE_PACKED
- *  macro to write dest elements from accumulator
- *  casts dest pointer to appropriate type
- *  performs byte swap if necessary to ensure that
- *    elements are in stream order
- */
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define WRITE_PACKED32( acc, dst, idx ) \
-    ( ( uint32_t* ) ( dst ) ) [ idx ] = bswap_32 ( ( uint32_t ) ( acc ) )
-#define WRITE_PACKED64( acc, dst, idx ) \
-    ( ( uint64_t* ) ( dst ) ) [ idx ] = bswap_64 ( ( uint64_t ) ( acc ) )
-#else
-#define WRITE_PACKED32( acc, dst, idx ) \
-    ( ( uint32_t* ) ( dst ) ) [ idx ] = ( uint32_t ) ( acc )
-#define WRITE_PACKED64( acc, dst, idx ) \
-    ( ( uint64_t* ) ( dst ) ) [ idx ] = ( uint64_t ) ( acc )
-#endif
-
-/* Pack8
- */
-static
-void Pack8 ( uint32_t packed, void *dst, const void *src, uint32_t count )
-{
-    /* accumulator */
-    uint64_t acc;
-    uint32_t abits;
-
-    /* loop indices */
-    uint32_t s, d, cnt;
-
-#if MASK_SRC
-    uint32_t src_mask = ( 1 << packed ) - 1;
-#endif
-
-    for ( acc = 0, abits = s = d = 0, cnt = count >> 2; s < cnt; ++ s )
-    {
-        /* get 4 bytes in reverse order, i.e.
-           bits 0-7 are src[0], bits 8-15 are src[1], etc. */
-        uint32_t in = READ_UNPACKED8 ( src, s );
-
-        /* pack the bytes into our accumulator */
-        acc <<= packed;
-        acc |= MASK8 ( in );
-
-        /* account for activity */
-        abits += packed;
-        in >>= 8;
-
-        /* detect need to dump accumulator */
-        if ( abits >= 32 )
-        {
-            abits -= 32;
-            WRITE_PACKED32 ( acc >> abits, dst, d ++ );
-        }
-
-        /* repeat for remaining 3 source bytes */
-        acc <<= packed;
-        acc |= MASK8 ( in );
-        abits += packed;
-        in >>= 8;
-        if ( abits >= 32 )
-        {
-            abits -= 32;
-            WRITE_PACKED32 ( acc >> abits, dst, d ++ );
-        }
-
-        acc <<= packed;
-        acc |= MASK8 ( in );
-        abits += packed;
-        in >>= 8;
-        if ( abits >= 32 )
-        {
-            abits -= 32;
-            WRITE_PACKED32 ( acc >> abits, dst, d ++ );
-        }
-
-        acc <<= packed;
-        acc |= MASK8 ( in );
-        abits += packed;
-        in >>= 8;
-        if ( abits >= 32 )
-        {
-            abits -= 32;
-            WRITE_PACKED32 ( acc >> abits, dst, d ++ );
-        }
-    }
-
-    /* handle remaining src bytes */
-    for ( s <<= 2; s < count; ++ s )
-    {
-        acc <<= packed;
-        acc |= MASK8 ( ( ( const uint8_t* ) src ) [ s ] );
-        abits += packed;
-        if ( abits >= 32 )
-        {
-            abits -= 32;
-            WRITE_PACKED32 ( acc >> abits, dst, d ++ );
-        }
-    }
-
-    /* handle remaining accumulator bits */
-    if ( abits != 0 )
-    {
-        uint32_t out = bswap_32 ( ( uint32_t ) ( acc << ( 32 - abits ) ) );
-        abits = ( abits + 7 ) >> 3;
-        for ( d <<= 2; abits != 0; -- abits, out >>= 8, ++ d )
-            ( ( uint8_t* ) dst ) [ d ] = ( uint8_t ) out;
-    }
-}
-
-/* Pack16
- */
-static
-void Pack16 ( uint32_t packed, void *dst, const void *src, uint32_t count )
-{
-    /* accumulator */
-    uint64_t acc;
-    uint32_t abits;
-
-    /* loop indices */
-    uint32_t s, d;
-
-#if MASK_SRC
-    uint32_t src_mask = ( 1 << packed ) - 1;
-#endif
-
-    for ( acc = 0, abits = d = s = 0; s < count; ++ s )
-    {
-        /* get 2 bytes in native order */
-        uint32_t in = READ_UNPACKED16 ( src, s );
-
-        /* pack the bytes into our accumulator */
-        acc <<= packed;
-        acc |= MASK16 ( in );
-
-        /* account for activity */
-        abits += packed;
-
-        /* detect need to dump accumulator */
-        if ( abits >= 32 )
-        {
-            abits -= 32;
-            WRITE_PACKED32 ( acc >> abits, dst, d ++ );
-        }
-    }
-
-    /* handle remaining accumulator bits */
-    if ( abits != 0 )
-    {
-        uint32_t out = bswap_32 ( ( uint32_t ) ( acc << ( 32 - abits ) ) );
-        abits = ( abits + 7 ) >> 3;
-        for ( d <<= 2; abits != 0; -- abits, out >>= 8, ++ d )
-            ( ( uint8_t* ) dst ) [ d ] = ( uint8_t ) out;
-    }
-}
-
-/* Pack32
- */
-static
-void Pack32 ( uint32_t packed, void *dst, const void *src, uint32_t count )
-{
-    /* accumulator */
-    uint64_t acc;
-    uint32_t abits;
-
-    /* loop indices */
-    uint32_t s, d;
-
-#if MASK_SRC
-    uint32_t src_mask = ( 1 << packed ) - 1;
-#endif
-
-    for ( acc = 0, abits = d = s = 0; s < count; ++ s )
-    {
-        /* get 4 bytes in native order */
-        uint32_t in = READ_UNPACKED32 ( src, s );
-
-        /* pack the bytes into our accumulator */
-        acc <<= packed;
-        acc |= MASK32 ( in );
-
-        /* account for activity */
-        abits += packed;
-
-        /* detect need to dump accumulator */
-        if ( abits >= 32 )
-        {
-            abits -= 32;
-            WRITE_PACKED32 ( acc >> abits, dst, d ++ );
-        }
-    }
-
-    /* handle remaining accumulator bits */
-    if ( abits != 0 )
-    {
-        uint32_t out = bswap_32 ( ( uint32_t ) ( acc << ( 32 - abits ) ) );
-        abits = ( abits + 7 ) >> 3;
-        for ( d <<= 2; abits != 0; -- abits, out >>= 8, ++ d )
-            ( ( uint8_t* ) dst ) [ d ] = ( uint8_t ) out;
-    }
-}
-
-/* Pack64a
- *  source is 64 bits, packed <= 32 bits
- */
-static
-void Pack64a ( uint32_t packed, void *dst, const void *src, uint32_t count )
-{
-    /* accumulator */
-    uint64_t acc;
-    uint32_t abits;
-
-    /* loop indices */
-    uint32_t s, d;
-
-#if MASK_SRC
-    uint64_t src_mask = ( 1 << packed ) - 1;
-#endif
-
-    for ( acc = 0, abits = d = s = 0; s < count; ++ s )
-    {
-        /* get 8 bytes in native order */
-        uint64_t in = READ_UNPACKED64 ( src, s );
-
-        /* pack the bytes into our accumulator */
-        acc <<= packed;
-        acc |= MASK32 ( in );
-
-        /* account for activity */
-        abits += packed;
-
-        /* detect need to dump accumulator */
-        if ( abits >= 32 )
-        {
-            abits -= 32;
-            WRITE_PACKED32 ( acc >> abits, dst, d ++ );
-        }
-    }
-
-    /* handle remaining accumulator bits */
-    if ( abits != 0 )
-    {
-        uint32_t out = bswap_32 ( ( uint32_t ) ( acc << ( 32 - abits ) ) );
-        abits = ( abits + 7 ) >> 3;
-        for ( d <<= 2; abits != 0; -- abits, out >>= 8, ++ d )
-            ( ( uint8_t* ) dst ) [ d ] = ( uint8_t ) out;
-    }
-}
-
-/* Pack64b
- *  source is 64 bits, packed > 32 bits
- */
-static
-void Pack64b ( uint32_t packed, void *dst, const void *src, uint32_t count )
-{
-    /* accumulator */
-    uint128_t acc;
-    uint32_t abits;
-
-    /* loop indices */
-    uint32_t s, d;
-
-#if MASK_SRC
-    uint64_t src_mask = ( ( uint64_t ) 1U << packed ) - 1;
-#endif
-
-    for ( abits = d = s = 0; s < count; ++ s )
-    {
-        /* get 8 bytes in native order */
-        uint64_t in = READ_UNPACKED64 ( src, s );
-
-        /* pack the bytes into our accumulator */
-        uint128_shl ( & acc, packed );
-        uint128_orlo ( & acc, MASK64 ( in ) );
-
-        /* account for activity */
-        abits += packed;
-
-        /* detect need to dump accumulator */
-        if ( abits >= 64 )
-        {
-            uint64_t save = uint128_lo ( & acc );
-            abits -= 64;
-            uint128_shr ( & acc, abits );
-            WRITE_PACKED64 ( uint128_lo ( & acc ), dst, d ++ );
-            uint128_setlo ( & acc, save );
-        }
-    }
-
-    /* handle remaining accumulator bits */
-    if ( abits != 0 )
-    {
-        uint64_t out;
-        uint128_shl ( & acc, 64 - abits );
-        out = bswap_64 ( uint128_lo ( & acc ) );
-        abits = ( abits + 7 ) & ~ 7;
-        for ( d <<= 3, out >>= 64 - abits; abits != 0; abits -= 8, out >>= 8, ++ d )
-            ( ( uint8_t* ) dst ) [ d ] = ( uint8_t ) out;
-    }
-}
-
-/* Pack
- *  accepts a series of unpacked source bits
- *  produces a series of packed destination bits by eliminating MSB
- *
- *  "unpacked" [ IN ] - original element size in bits
- *  must be in 2^^[3..6], i.e. { 8, 16, 32, 64 }
- *
- *  "packed" [ IN ] - packed element size in bits
- *  must be <= "unpacked"
- *
- *  "src" [ IN ] and "ssize" [ IN ] - source buffer
- *  with size given in bytes
- *
- *  "consumed" [ OUT, NULL OKAY ] - number of source bytes
- *  consumed. if NULL, then all source bytes MUST be consumed
- *  or an error will be generated.
- *
- *  "dst" [ OUT ] and "dst_off" [ IN ] - destination
- *  buffer bit address
- *
- *  "dsize" [ IN ] - size of "dst" in bits, not including "dst_off"
- *
- *  "psize" [ OUT ] - resultant packed size in bits
- *
- * NB - the implementation may allow packing in place
- */
-LIB_EXPORT rc_t CC Pack ( uint32_t unpacked, uint32_t packed,
-    const void *src, size_t ssize, size_t *consumed,
-    void *dst, bitsz_t dst_off, bitsz_t dsize, bitsz_t *psize )
-{
-    /* prepare for failure */
-    if ( consumed != NULL )
-        * consumed = 0;
-
-    /* validate output param */
-    if ( psize == NULL )
-        return RC ( rcXF, rcBuffer, rcPacking, rcParam, rcNull );
-    * psize = 0;
-
-    /* require power of 2 with value between 8 and 64 */
-    if ( ( ( unpacked - 1 ) & unpacked ) != 0 ||
-         unpacked < 8 || unpacked > 64 )
-        return RC ( rcXF, rcBuffer, rcPacking, rcParam, rcInvalid );
-
-    /* validate remaining params */
-    if ( unpacked < packed )
-        return RC ( rcXF, rcBuffer, rcPacking, rcParam, rcInvalid );
-
-    if ( packed == 0 )
-        return RC ( rcXF, rcBuffer, rcPacking, rcParam, rcInvalid );
-
-    if ( ssize == 0 )
-        return 0;
-
-    if ( src == NULL )
-        return RC ( rcXF, rcBuffer, rcPacking, rcParam, rcNull );
-
-    /* detect a byte size so large it can't be converted to bits */
-    if ( ( ssize & ( ( size_t ) 7 << ( sizeof ssize * 8 - 3 ) ) ) != 0 )
-        return RC ( rcXF, rcBuffer, rcPacking, rcBuffer, rcExcessive );
-
-    /* required destination buffer size */
-    * psize = ( ( ssize << 3 ) / unpacked ) * packed;
-
-    if ( dsize < * psize )
-    {
-        if ( consumed == NULL )
-            return RC ( rcXF, rcBuffer, rcPacking, rcBuffer, rcInsufficient );
-
-        ssize = ( dsize / packed ) * ( unpacked >> 3 );
-        * psize = ( ( ssize << 3 ) / unpacked ) * packed;
-    }
-
-    if ( dst == NULL )
-    {
-        * psize = 0;
-        return RC ( rcXF, rcBuffer, rcPacking, rcParam, rcNull );
-    }
-
-    /* all parameters are validated */
-    dst = & ( ( char* ) dst ) [ dst_off >> 3 ];
-    dst_off &= 7;
-
-    if ( consumed != NULL )
-        * consumed = ssize;
-
-    if ( unpacked == 8 && packed == 8 && dst_off == 0 )
-    {
-        if ( ( const void* ) dst != src )
-            memcpy ( dst, src, ssize );
-        return 0;
-    }
-
-    /* TBD - enable packing into existing buffers */
-    if ( dst_off != 0 )
-        return RC ( rcXF, rcBuffer, rcPacking, rcOffset, rcUnsupported );
-
-    switch ( unpacked )
-    {
-    case 8:
-        Pack8 ( packed, dst, src, ( uint32_t ) ssize );
-        break;
-    case 16:
-        Pack16 ( packed, dst, src, ( uint32_t ) ( ssize >> 1 ) );
-        break;
-    case 32:
-        Pack32 ( packed, dst, src, ( uint32_t ) ( ssize >> 2 ) );
-        break;
-    case 64:
-        if ( packed > 32 )
-            Pack64b ( packed, dst, src, ( uint32_t ) ( ssize >> 3 ) );
-        else
-            Pack64a ( packed, dst, src, ( uint32_t ) ( ssize >> 3 ) );
-        break;
-    }
-
-    return 0;
-}
diff --git a/libs/klib/pbstree-impl.c b/libs/klib/pbstree-impl.c
deleted file mode 100644
index 7b21db3..0000000
--- a/libs/klib/pbstree-impl.c
+++ /dev/null
@@ -1,847 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include "pbstree-priv.h"
-#include <klib/rc.h>
-#include <sysalloc.h>
-#include "maybeswap.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * PBSTreeImpl
- *  a flattened b-tree
- */
-
-/* Count
- *  returns number of elements in b-tree
- */
-static
-uint32_t CC PBSTreeImplCount ( const PBSTree *self )
-{
-    uint32_t n;
-    GET32 ( n, self -> pt -> num_nodes );
-    return n;
-}
-
-/* Depth
- *  returns number of layers in b-tree
- */
-static
-uint32_t CC PBSTreeImplDepth ( const PBSTree *self )
-{
-    uint32_t depth, num_nodes;
-
-    GET32 ( num_nodes, self -> pt -> num_nodes );
-
-    for ( depth = 0; num_nodes != 0; ++ depth )
-        num_nodes >>= 1;
-
-    return depth;
-}
-
-/* Size
- *  returns the size in bytes
- *  of the PBSTree image
- */
-static
-size_t CC PBSTreeImplSize ( const PBSTree *oself )
-{
-    size_t bytes;
-    const P_BSTree *self = oself -> pt;
-    uint32_t data_size, bytes32;
-
-    GET32 ( bytes32, self -> num_nodes );
-    if ( bytes32 == 0 ) /* empty tree */
-        return sizeof self -> num_nodes;
-    else
-        bytes = bytes32;
-
-    GET32 ( data_size, self -> data_size );
-    if ( data_size > 256 )
-    {
-        if ( data_size <= 65536 )
-            bytes += bytes;
-        else
-            bytes <<= 2;
-    }
-
-    return sizeof * self - sizeof self -> data_idx +
-        bytes + data_size;
-}
-
-/* GetNodeData
- *  finds node data boundaries
- */
-static
-rc_t CC PBSTreeImplGetNodeData8 ( const PBSTree *oself,
-    const void **addr, size_t *size, uint32_t id )
-{
-    const P_BSTree *self = oself -> pt;
-
-    uint32_t num_nodes;
-    const uint8_t *data_start;
-    uint32_t off, end;
-
-    GET32 ( num_nodes, self -> num_nodes );
-    GET32 ( end, self -> data_size );
-
-    if ( id == 0 )
-        return RC ( rcCont, rcTree, rcAccessing, rcId, rcNull );
-    if ( id > num_nodes )
-        return RC ( rcCont, rcTree, rcAccessing, rcId, rcNotFound );
-
-    data_start = ( const uint8_t* )
-      & self -> data_idx . v8 [ num_nodes ];
-    off = self -> data_idx . v8 [ id - 1 ];
-    if ( id != num_nodes )
-      end = self -> data_idx . v8 [ id ];
-
-    * addr = & data_start [ off ];
-    * size = end - off;
-    return 0;
-}
-
-static
-rc_t CC PBSTreeImplGetNodeData16 ( const PBSTree *oself,
-    const void **addr, size_t *size, uint32_t id )
-{
-    const P_BSTree *self = oself -> pt;
-
-    uint32_t num_nodes, end;
-    const uint8_t *data_start;
-    uint16_t off;
-
-    GET32 ( num_nodes, self -> num_nodes );
-    GET32 ( end, self -> data_size );
-
-    if ( id == 0 )
-        return RC ( rcCont, rcTree, rcAccessing, rcId, rcNull );
-    if ( id > num_nodes )
-        return RC ( rcCont, rcTree, rcAccessing, rcId, rcNotFound );
-
-    data_start = ( const uint8_t* )
-      & self -> data_idx . v16 [ num_nodes ];
-    GET16 ( off, self -> data_idx . v16 [ id - 1 ] );
-    if ( id != num_nodes )
-    {
-      uint16_t end16;
-      GET16 ( end16, self -> data_idx . v16 [ id ] );
-      end = end16;
-    }
-
-    * addr = & data_start [ off ];
-    * size = end - off;
-    return 0;
-}
-
-static
-rc_t CC PBSTreeImplGetNodeData32 ( const PBSTree *oself,
-    const void **addr, size_t *size, uint32_t id )
-{
-    const P_BSTree *self = oself -> pt;
-
-    uint32_t num_nodes;
-    const uint8_t *data_start;
-    uint32_t off, end;
-
-    GET32 ( num_nodes, self -> num_nodes );
-    GET32 ( end, self -> data_size );
-
-    if ( id == 0 )
-        return RC ( rcCont, rcTree, rcAccessing, rcId, rcNull );
-    if ( id > num_nodes )
-        return RC ( rcCont, rcTree, rcAccessing, rcId, rcNotFound );
-
-    data_start = ( const uint8_t* )
-      & self -> data_idx . v32 [ num_nodes ];
-    GET32 ( off, self -> data_idx . v32 [ id - 1 ] );
-    if ( id != num_nodes )
-      GET32 ( end, self -> data_idx . v32 [ id ] );
-
-    * addr = & data_start [ off ];
-    * size = end - off;
-    return 0;
-}
-
-/* Find
- *  find an object within tree
- *  "cmp" function returns equivalent of "item" - "n"
- */
-static
-uint32_t CC PBSTreeImplFind8 ( const PBSTree *self, PBSTNode *n, const void *item,
-    int ( CC * cmp ) ( const void *item, const PBSTNode *n, void * data ), void * data )
-{
-    const P_BSTree *pt = self -> pt;
-    uint32_t right;
-    GET32 ( right, pt -> num_nodes );
-    if ( right != 0 )
-    {
-        int diff;
-        const uint8_t *data_start;
-        uint32_t off, end;
-        uint32_t id, left = 1;
-        uint32_t max_right = right;
-
-        GET32 ( end, pt -> data_size );
-	data_start = & pt -> data_idx . v8 [ right ];
-	
-	do
-	  {
-	    id = ( left + right ) >> 1;
-	    off = pt -> data_idx . v8 [ id - 1 ];
-	    n -> id = id;
-	    n -> data . addr = & data_start [ off ];
-	    if ( id == max_right )
-	      n -> data . size = end - off;
-	    else
-	      n -> data . size = pt -> data_idx . v8 [ id ] - off;
-	    diff = ( * cmp ) ( item, n, data );
-	    if ( diff == 0 )
-	      return id;
-	    if ( diff < 0 )
-	      right = id - 1;
-	    else
-	      left = id + 1;
-	  }
-	while ( left <= right );
-    }
-
-    n -> data . addr = NULL;
-    n -> data . size = 0;
-    return n -> id = 0;
-}
-
-static
-uint32_t CC PBSTreeImplFind16 ( const PBSTree *self, PBSTNode *n, const void *item,
-    int ( CC * cmp ) ( const void *item, const PBSTNode *n, void * data ), void * data )
-{
-    const P_BSTree *pt = self -> pt;
-    uint32_t right;
-    GET32 ( right, pt -> num_nodes );
-    if ( right != 0 )
-    {
-        int diff;
-        const uint8_t *data_start;
-        uint32_t end;
-        uint32_t id, left = 1;
-        uint32_t max_right = right;
-        uint16_t off;
-
-        GET32 ( end, pt -> data_size );
-	data_start = ( const uint8_t* )
-	  & pt -> data_idx . v16 [ right ];
-	
-	do
-	  {
-	    id = ( left + right ) >> 1;
-	    GET16 ( off, pt -> data_idx . v16 [ id - 1 ] );
-	    n -> id = id;
-	    n -> data . addr = & data_start [ off ];
-	    if ( id == max_right )
-	      n -> data . size = end - off;
-	    else
-	    {
-	      uint16_t size;
-	      GET16 ( size, pt -> data_idx . v16 [ id ] );
-	      n -> data . size = size - off;
-	    }
-	    diff = ( * cmp ) ( item, n, data );
-	    if ( diff == 0 )
-	      return id;
-	    if ( diff < 0 )
-	      right = id - 1;
-	    else
-	      left = id + 1;
-	  }
-	while ( left <= right );
-    }
-
-    n -> data . addr = NULL;
-    n -> data . size = 0;
-    return n -> id = 0;
-}
-
-static
-uint32_t CC PBSTreeImplFind32 ( const PBSTree *self, PBSTNode *n, const void *item,
-    int ( CC * cmp ) ( const void *item, const PBSTNode *n, void * data ), void * data )
-{
-    const P_BSTree *pt = self -> pt;
-    uint32_t right;
-    GET32 ( right, pt -> num_nodes );
-    if ( right != 0 )
-    {
-        int diff;
-        const uint8_t *data_start;
-        uint32_t off, end;
-        uint32_t id, left = 1;
-        uint32_t max_right = right;
-
-        GET32 ( end, pt -> data_size );
-	data_start = ( const uint8_t* )
-	  & pt -> data_idx . v32 [ right ];
-	
-	do
-	  {
-	    id = ( left + right ) >> 1;
-	    GET32 ( off, pt -> data_idx . v32 [ id - 1 ] );
-	    n -> id = id;
-	    n -> data . addr = & data_start [ off ];
-	    if ( id == max_right )
-	      n -> data . size = end - off;
-	    else
-	    {
-	      GET32 ( n -> data . size, pt -> data_idx . v32 [ id ] );
-	      n -> data . size -= off;
-	    }
-	    diff = ( * cmp ) ( item, n, data );
-	    if ( diff == 0 )
-	      return id;
-	    if ( diff < 0 )
-	      right = id - 1;
-	    else
-	      left = id + 1;
-	  }
-	while ( left <= right );
-    }
-
-    n -> data . addr = NULL;
-    n -> data . size = 0;
-    return n -> id = 0;
-}
-
-/* ForEach
- *  executes a function on each tree element
- */
-static
-void CC PBSTreeImplForEach8 ( const PBSTree *self, bool reverse,
-    void ( CC * f ) ( PBSTNode *n, void *data ), void *data )
-{
-    const P_BSTree *pt = self -> pt;
-    uint32_t num_nodes;
-    GET32 ( num_nodes, pt -> num_nodes );
-    if ( num_nodes != 0 )
-    {
-        PBSTNode n;
-        uint32_t id;
-        uint32_t off, end;
-        const uint8_t *data_start;
-
-        GET32 ( end, pt -> data_size );
-
-	data_start = & pt -> data_idx . v8 [ num_nodes ];
-	
-	if ( ! reverse )
-	  {
-	    for ( off = pt -> data_idx . v8 [ 0 ],
-		    id = 1; id < num_nodes; off = end, ++ id )
-	      {
-		end = pt -> data_idx . v8 [ id ];
-		n . internal = pt;
-		n . id = id;
-		n . data . addr = & data_start [ off ];
-		n . data . size = end - off;
-		( * f ) ( & n, data );
-	      }
-	    
-	    GET32 ( end, pt -> data_size );
-	  }
-	
-	off = pt -> data_idx . v8 [ num_nodes - 1 ];
-	n . internal = pt;
-	n . id = num_nodes;
-	n . data . addr = & data_start [ off ];
-	n . data . size = end - off;
-	( * f ) ( & n, data );
-	
-	if ( reverse )
-	  {
-	    for ( end = off, id = num_nodes - 1; id > 0; end = off, -- id )
-	      {
-		off = pt -> data_idx . v8 [ id - 1 ];
-		n . internal = pt;
-		n . id = id;
-		n . data . addr = & data_start [ off ];
-		n . data . size = end - off;
-		( * f ) ( & n, data );
-	      }
-	  }
-    }
-}
-
-static
-void CC PBSTreeImplForEach16 ( const PBSTree *self, bool reverse,
-    void ( CC * f ) ( PBSTNode *n, void *data ), void *data )
-{
-    const P_BSTree *pt = self -> pt;
-    uint32_t num_nodes;
-    GET32 ( num_nodes, pt -> num_nodes );
-    if ( num_nodes != 0 )
-    {
-        PBSTNode n;
-        uint32_t id, end;
-        uint16_t off;
-        const uint8_t *data_start;
-
-        GET32 ( end, pt -> data_size );
-
-	data_start = ( const uint8_t* )
-	  & pt -> data_idx . v16 [ num_nodes ];
-	
-	if ( ! reverse )
-	  {
-	    GET16 ( off, pt -> data_idx . v16 [ 0 ] );
-	    for ( id = 1; id < num_nodes; off = end, ++ id )
-	      {
-		uint16_t end16;
-		GET16 ( end16, pt -> data_idx . v16 [ id ] );
-		end = end16;
-		n . internal = pt;
-		n . id = id;
-		n . data . addr = & data_start [ off ];
-		n . data . size = end - off;
-		( * f ) ( & n, data );
-	      }
-	    
-	    GET32 ( end, pt -> data_size );
-	  }
-	
-	GET16 ( off, pt -> data_idx . v16 [ num_nodes - 1 ] );
-	n . internal = pt;
-	n . id = num_nodes;
-	n . data . addr = & data_start [ off ];
-	n . data . size = end - off;
-	( * f ) ( & n, data );
-        
-	if ( reverse )
-	  {
-	    for ( end = off, id = num_nodes - 1; id > 0; end = off, -- id )
-	      {
-		GET16 ( off, pt -> data_idx . v16 [ id - 1 ] );
-		n . internal = pt;
-		n . id = id;
-		n . data . addr = & data_start [ off ];
-		n . data . size = end - off;
-		( * f ) ( & n, data );
-	      }
-	  }
-    }
-}
-
-static
-void CC PBSTreeImplForEach32 ( const PBSTree *self, bool reverse,
-    void ( CC * f ) ( PBSTNode *n, void *data ), void *data )
-{
-    const P_BSTree *pt = self -> pt;
-    uint32_t num_nodes;
-    GET32 ( num_nodes, pt -> num_nodes );
-    if ( num_nodes != 0 )
-    {
-        PBSTNode n;
-        uint32_t id;
-        uint32_t off, end;
-        const uint8_t *data_start;
-
-        GET32 ( end, pt -> data_size );
-
-	data_start = ( const uint8_t* )
-	  & pt -> data_idx . v32 [ num_nodes ];
-	
-	if ( ! reverse )
-	  {
-	    GET32 ( off, pt -> data_idx . v32 [ 0 ] );
-	    for ( id = 1; id < num_nodes; off = end, ++ id )
-	      {
-		GET32( end, pt -> data_idx . v32 [ id ] );
-		n . internal = pt;
-		n . id = id;
-		n . data . addr = & data_start [ off ];
-		n . data . size = end - off;
-		( * f ) ( & n, data );
-	      }
-                
-	    GET32 ( end, pt -> data_size );
-	  }
-
-	GET32 ( off, pt -> data_idx . v32 [ num_nodes - 1 ] );
-	n . internal = pt;
-	n . id = num_nodes;
-	n . data . addr = & data_start [ off ];
-	n . data . size = end - off;
-	( * f ) ( & n, data );
-
-	if ( reverse )
-	  {
-	    for ( end = off, id = num_nodes - 1; id > 0; end = off, -- id )
-	      {
-		GET32 ( off, pt -> data_idx . v32 [ id - 1 ] );
-		n . internal = pt;
-		n . id = id;
-		n . data . addr = & data_start [ off ];
-		n . data . size = end - off;
-		( * f ) ( & n, data );
-	      }
-	  }
-    }
-}
-
-/* DoUntil
- *  executes a function on each element
- *  until the function returns true
- */
-static
-bool CC PBSTreeImplDoUntil8 ( const PBSTree *self, bool reverse,
-    bool ( CC * f ) ( PBSTNode *n, void *data ), void *data )
-{
-    const P_BSTree *pt = self -> pt;
-    uint32_t num_nodes;
-    GET32 ( num_nodes, pt -> num_nodes );
-    if ( num_nodes != 0 )
-    {
-        PBSTNode n;
-        uint32_t id;
-        uint32_t off, end;
-        const uint8_t *data_start;
-
-        GET32 ( end, pt -> data_size );
-
-        data_start = & pt -> data_idx . v8 [ num_nodes ];
-	
-        if ( ! reverse )
-        {
-            for ( off = pt -> data_idx . v8 [ 0 ],
-                  id = 1; id < num_nodes; off = end, ++ id )
-            {
-                end = pt -> data_idx . v8 [ id ];
-                n . internal = pt;
-                n . id = id;
-                n . data . addr = & data_start [ off ];
-                n . data . size = end - off;
-                if ( ( * f ) ( & n, data ) )
-                    return true;
-            }
-	    
-            GET32 ( end, pt -> data_size );
-        }
-
-        off = pt -> data_idx . v8 [ num_nodes - 1 ];
-        n . internal = pt;
-        n . id = num_nodes;
-        n . data . addr = & data_start [ off ];
-        n . data . size = end - off;
-        if ( ( * f ) ( & n, data ) )
-            return true;
-
-        if ( reverse )
-        {
-            for ( end = off, id = num_nodes - 1; id > 0; end = off, -- id )
-            {
-                off = pt -> data_idx . v8 [ id - 1 ];
-                n . internal = pt;
-                n . id = id;
-                n . data . addr = & data_start [ off ];
-                n . data . size = end - off;
-                if ( ( * f ) ( & n, data ) )
-                    return true;
-            }
-        }
-    }
-
-    return 0;
-}
-
-static
-bool CC PBSTreeImplDoUntil16 ( const PBSTree *self, bool reverse,
-    bool ( CC * f ) ( PBSTNode *n, void *data ), void *data )
-{
-    const P_BSTree *pt = self -> pt;
-    uint32_t num_nodes;
-    GET32 ( num_nodes, pt -> num_nodes );
-    if ( num_nodes != 0 )
-    {
-        PBSTNode n;
-        uint32_t id, end;
-        uint16_t off;
-        const uint8_t *data_start;
-
-        GET32 ( end, pt -> data_size );
-
-        data_start = ( const uint8_t* )
-            & pt -> data_idx . v16 [ num_nodes ];
-            
-        if ( ! reverse )
-        {
-            GET16 ( off, pt -> data_idx . v16 [ 0 ] );
-            for ( id = 1; id < num_nodes; off = end, ++ id )
-            {
-                uint16_t end16;
-                GET16 ( end16, pt -> data_idx . v16 [ id ] );
-                end = end16;
-                n . internal = pt;
-                n . id = id;
-                n . data . addr = & data_start [ off ];
-                n . data . size = end - off;
-                if ( ( * f ) ( & n, data ) )
-                    return true;
-            }
-                
-            GET32 ( end, pt -> data_size );
-        }
-
-        GET16 ( off, pt -> data_idx . v16 [ num_nodes - 1 ] );
-        n . internal = pt;
-        n . id = num_nodes;
-        n . data . addr = & data_start [ off ];
-        n . data . size = end - off;
-        if ( ( * f ) ( & n, data ) )
-            return true;
-            
-        if ( reverse )
-        {
-            for ( end = off, id = num_nodes - 1; id > 0; end = off, -- id )
-            {
-                GET16 ( off, pt -> data_idx . v16 [ id - 1 ] );
-                n . internal = pt;
-                n . id = id;
-                n . data . addr = & data_start [ off ];
-                n . data . size = end - off;
-                if ( ( * f ) ( & n, data ) )
-                    return true;
-            }
-        }
-    }
-    return 0;
-}
-
-static
-bool CC PBSTreeImplDoUntil32 ( const PBSTree *self, bool reverse,
-    bool ( CC * f ) ( PBSTNode *n, void *data ), void *data )
-{
-    const P_BSTree *pt = self -> pt;
-    uint32_t num_nodes;
-    GET32 ( num_nodes, pt -> num_nodes );
-    if ( num_nodes != 0 )
-    {
-        PBSTNode n;
-        uint32_t id;
-        uint32_t off, end;
-        const uint8_t *data_start;
-
-        GET32 ( end, pt -> data_size );
-
-        data_start = ( const uint8_t* )
-            & pt -> data_idx . v32 [ num_nodes ];
-            
-        if ( ! reverse )
-        {
-            GET32 ( off, pt -> data_idx . v32 [ 0 ] );
-            for ( id = 1; id < num_nodes; off = end, ++ id )
-            {
-                GET32 ( end, pt -> data_idx . v32 [ id ] );
-                n . internal = pt;
-                n . id = id;
-                n . data . addr = & data_start [ off ];
-                n . data . size = end - off;
-                if ( ( * f ) ( & n, data ) )
-                    return true;
-            }
-                
-            GET32 ( end, pt -> data_size );
-        }
-            
-        GET32 ( off, pt -> data_idx . v32 [ num_nodes - 1 ] );
-        n . internal = pt;
-        n . id = num_nodes;
-        n . data . addr = & data_start [ off ];
-        n . data . size = end - off;
-        if ( ( * f ) ( & n, data ) )
-            return true;
-            
-        if ( reverse )
-        {
-            for ( end = off, id = num_nodes - 1; id > 0; end = off, -- id )
-            {
-                GET32 ( off, pt -> data_idx . v32 [ id - 1 ] );
-                n . internal = pt;
-                n . id = id;
-                n . data . addr = & data_start [ off ];
-                n . data . size = end - off;
-                if ( ( * f ) ( & n, data ) )
-                    return true;
-            }
-        }
-    }
-
-    return 0;
-}
-
-/* Whack
- *  whacks PBSTree object
- *  does not free memory reference
- */
-static
-void CC PBSTreeImplWhack ( PBSTree *self )
-{
-    free ( self );
-}
-
-
-static PBSTree_vt_v1 vtPBSTreeImpl8 =
-{
-    /* version 1.0 */
-    1, 0,
-
-    /* required methods */
-    PBSTreeImplWhack,
-    PBSTreeImplCount,
-    PBSTreeImplDepth,
-    PBSTreeImplSize,
-    PBSTreeImplGetNodeData8,
-    PBSTreeImplFind8,
-    PBSTreeImplForEach8,
-    PBSTreeImplDoUntil8
-};
-
-static PBSTree_vt_v1 vtPBSTreeImpl16 =
-{
-    /* version 1.0 */
-    1, 0,
-
-    /* required methods */
-    PBSTreeImplWhack,
-    PBSTreeImplCount,
-    PBSTreeImplDepth,
-    PBSTreeImplSize,
-    PBSTreeImplGetNodeData16,
-    PBSTreeImplFind16,
-    PBSTreeImplForEach16,
-    PBSTreeImplDoUntil16
-};
-
-static PBSTree_vt_v1 vtPBSTreeImpl32 =
-{
-    /* version 1.0 */
-    1, 0,
-
-    /* required methods */
-    PBSTreeImplWhack,
-    PBSTreeImplCount,
-    PBSTreeImplDepth,
-    PBSTreeImplSize,
-    PBSTreeImplGetNodeData32,
-    PBSTreeImplFind32,
-    PBSTreeImplForEach32,
-    PBSTreeImplDoUntil32
-};
-
-
-/* GetVTable
- */
-static
-PBSTree_vt * CC PBSTreeImplGetVTable ( const P_BSTree *pt )
-{
-    uint32_t data_size;
-    GET32 ( data_size, pt -> data_size );
-    if ( data_size <= 256 )
-      return (PBSTree_vt *) & vtPBSTreeImpl8;
-    if ( data_size <= 65536 )
-      return (PBSTree_vt *) & vtPBSTreeImpl16;
-    return (PBSTree_vt *) & vtPBSTreeImpl32;
-}
-
-
-/* CheckPersisted
- *  check persisted image for apparent correctness
- */
-static
-rc_t CC PBSTreeImplCheckPersisted ( const P_BSTree *pt, size_t size )
-{
-    uint32_t num_nodes;
-
-    if ( pt == NULL)
-        return RC ( rcCont, rcTree, rcConstructing, rcParam, rcNull );
-    if ( size == 0 )
-        return 0;
-    if ( size < sizeof pt -> num_nodes )
-        return RC ( rcCont, rcTree, rcConstructing, rcData, rcInvalid );
-
-    GET32 ( num_nodes, pt -> num_nodes );
-    if ( num_nodes > 0 )
-    {
-        uint32_t data_size;
-        const uint8_t *end, *data_start;
-
-        GET32 ( data_size, pt -> data_size );
-        if ( size < sizeof * pt || data_size == 0 )
-            return RC ( rcCont, rcTree, rcConstructing, rcData, rcIncomplete );
-
-        end = ( const uint8_t* ) pt + size;
-
-        if ( data_size <= 256 )
-            data_start = & pt -> data_idx . v8 [ num_nodes ];
-        else  if ( data_size <= 65536 )
-        {
-            data_start = ( const uint8_t* )
-                & pt -> data_idx . v16 [ num_nodes ];
-        }
-        else
-        {
-            data_start = ( const uint8_t* )
-                & pt -> data_idx . v32 [ num_nodes ];
-        }
-        
-        if ( & data_start [ data_size ] > end )
-            return RC ( rcCont, rcTree, rcConstructing, rcData, rcCorrupt );
-    }
-    
-    return 0;
-}
-
-/* PBSTreeMake
- *  make a PBSTree structure
- *  the memory reference passed in is borrowed
- */
-#if SWAP_PERSISTED
-#define PBSTREEMAKE PBSTreeMakeSwapped
-#else
-#define PBSTREEMAKE PBSTreeMakeNative
-#endif
-
-rc_t PBSTREEMAKE ( PBSTree *pt, const void *addr, size_t size )
-{
-    rc_t rc = PBSTreeImplCheckPersisted ( addr, size );
-    if ( rc == 0 )
-    {
-        PBSTree_vt *vt = PBSTreeImplGetVTable ( addr );
-        rc = PBSTreeInit ( pt, vt, addr );
-    }
-    return rc;
-}
diff --git a/libs/klib/pbstree-native.c b/libs/klib/pbstree-native.c
deleted file mode 100644
index 9eb937e..0000000
--- a/libs/klib/pbstree-native.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#undef SWAP_PERSISTED
-#define SWAP_PERSISTED 0
-#include "pbstree-impl.c"
-#undef SWAP_PERSISTED
diff --git a/libs/klib/pbstree-priv.h b/libs/klib/pbstree-priv.h
deleted file mode 100644
index e81058b..0000000
--- a/libs/klib/pbstree-priv.h
+++ /dev/null
@@ -1,664 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_pbstree_priv_
-#define _h_pbstree_priv_
-
-#ifndef _h_klib_pbstree_
-#include <klib/pbstree.h>
-#endif
-
-#ifndef _h_klib_ptrie_
-#include <klib/ptrie.h>
-#endif
-
-#include <endian.h>
-
-
-#define RECORD_HDR_IDX 1
-#define RECORD_HDR_DEPTH 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * P_BSTree
- *  persisted binary search tree
- *
- *  in memory, the tree is built from nodes with 3 pointers. this
- *  arrangement allows parent identification, left & right child
- *  identification, as well as leaf node indication.
- *
- *  when persisted, the tree nodes are identified by index integer.
- *  this integer may be 8, 16 or 32 bits as determined by the node count.
- */
-typedef struct P_BSTree P_BSTree;
-struct P_BSTree
-{
-    /* a node count - if zero, then the structure ends */
-    uint32_t num_nodes;
-
-    /* the total size of auxiliary data */
-    uint32_t data_size;
-
-    /* offsets relative to & data_idx [ num_nodes ] */
-    union
-    {
-        uint8_t v8 [ 4 ];
-        uint16_t v16 [ 2 ];
-        uint32_t v32 [ 1 ];
-    } data_idx;
-
-#if 0
-    uint8_t data [ data_size ];
-#endif
-};
-
-
-/*--------------------------------------------------------------------------
- * PBSTree_vt
- *  versioned message dispatch table
- */
-#ifndef PBSTREE_IMPL
-#define PBSTREE_IMPL PBSTree
-#endif
-
-typedef struct PBSTree_vt_v1 PBSTree_vt_v1;
-struct PBSTree_vt_v1
-{
-    /* version == 1.x */
-    uint32_t maj;
-    uint32_t min;
-
-    /* start minor version == 0 */
-    void ( CC * destroy ) ( PBSTREE_IMPL *self );
-    uint32_t ( CC * count ) ( const PBSTREE_IMPL *self );
-    uint32_t ( CC * depth ) ( const PBSTREE_IMPL *self );
-    size_t ( CC * size ) ( const PBSTREE_IMPL *self );
-    rc_t ( CC * get_node_data ) ( const PBSTREE_IMPL *self,
-        const void **addr, size_t *size, uint32_t id );
-    uint32_t ( CC * find ) (  const PBSTREE_IMPL *self, PBSTNode *rtn,
-        const void *item, int ( CC * cmp ) ( const void*, const PBSTNode* , void* ), void *data );
-    void ( CC * for_each ) ( const PBSTREE_IMPL *self, bool reverse,
-        void ( CC * f ) ( PBSTNode*, void* ), void *data );
-    bool ( CC * do_until ) ( const PBSTREE_IMPL *self, bool reverse,
-        bool ( CC * f ) ( PBSTNode*, void* ), void *data );
-    /* end minor version == 0 */
-};
-
-/* latest major version */
-#define PBSTREE_LATEST 1
-
-typedef union PBSTree_vt PBSTree_vt;
-union PBSTree_vt
-{
-    PBSTree_vt_v1 v1;
-};
-
-/*--------------------------------------------------------------------------
- * PBSTree
- *  handle to persisted binary search tree
- */
-struct PBSTree
-{
-    const PBSTree_vt *vt;
-    const P_BSTree *pt;
-};
-
-
-/* Make
- *  swapped and native versions
- *  take a pre-allocated but uninitialized PBSTree structure
- */
-rc_t PBSTreeMakeNative ( PBSTree *pt, const void *addr, size_t size );
-rc_t PBSTreeMakeSwapped ( PBSTree *pt, const void *addr, size_t size );
-
-
-/* Init
- *  initialize the parent class
- */
-rc_t PBSTreeInit ( PBSTree *self, const PBSTree_vt *vt, const P_BSTree *pt );
-
-
-/* PBSTreeGetNodeData
- *  finds node data boundaries
- */
-rc_t PBSTreeGetNodeData ( const PBSTree *self,
-    const void **addr, size_t *size, uint32_t id );
-
-/* PBSTreeDump
- *  dumps a persisted binary search tree
- *
- *  "name" [ IN, NULL OKAY ] - optional tree name
- *
- *  "stdio_file" [ IN ] - an output FILE* opaquely typed to avoid
- *  requiring an include of stdio.h
- *
- *  "indent_level" [ IN ] - the indent tabbing amount for output
- *  the implementation uses a tab setting of 2 spaces
- *
- *  "dump_node" [ IN, NULL OKAY ] and "data" [ IN ] - an optional
- *  node dumping function and associated data
- */
-void PBSTreeDump ( const PBSTree *self, const char *name,
-    void *stdio_file, uint32_t indent_level,
-    void ( CC * dump_node ) ( const void *addr, size_t size, void *stdio_file,
-        uint32_t indent_level, void *data ), void *data );
-
-/* GetIndentString
- *  returns a string of spaces for indentation
- */
-const char *GetIndentString ( uint32_t indent_level, uint32_t indent_tab );
-
-
-/*--------------------------------------------------------------------------
- * P_TTrans
- * PTTrans
- *  the index is represented as a min-sized uint32_t,
- *  the child transitions are represented by two parallel
- *  sequences described below, and data values have an in-line
- *  PTBTree.
- */
-enum
-{
-#if RECORD_HDR_IDX
-    /* transition index from parent to here */
-    pttHdrIdx,
-#endif
-#if RECORD_HDR_DEPTH
-    /* tree depth of node, i.e. transitions from root */
-    pttHdrDepth,
-#endif
-    /* tcnt from TTrans, meaning the number of non-terminals */
-    pttHdrTransCnt,
-
-    /* zero if child array was NULL, or
-       the number of indicies in "idx" array
-       beyond the header values */
-    pttHdrIdxCnt,
-
-    /* the end of "idx" if cnt is zero */
-    pttHdrNullEnd,
-
-    /* the number of sequence entries in "idx",
-       where an entry is either a single index
-       or an index range, as indicated by "child_seq_type" */
-    pttHdrSeqLen = pttHdrNullEnd,
-
-    /* the number of entries in "child" array */
-    pttHdrChildCnt,
-
-    /* index of the last header */
-    pttLastHdr = pttHdrChildCnt,
-
-    /* index of the first entry in "idx" */
-    pttFirstIdx
-};
-
-typedef struct P_TTrans P_TTrans;
-struct P_TTrans
-{
-    /* the variant selected for idx depends upon the recorded
-       character set size, and is typically 8 bit.
-
-       idx [ pttHdrIdx ]      => transition index from parent,
-                                 i.e. character code
-       idx [ pttHdrDepth ]    => node depth
-       idx [ pttHdrTransCnt ] => transition count
-       idx [ pttIdxCnt ]      => index count, meaning the
-                                 dimension of "idx".
-
-       if idx . variant [ pttIdxCnt ] is zero, then the P_TTrans
-       child transition information is skipped, i.e. there is nothing
-       corresponding to the "child" array in a TTrans.
-
-       idx [ pttHdrSeqLen ]   => sequence length
-
-       if the child array exists, the index sequence starts
-       at offset pttFirstIdx into idx, due to the header information. */
-
-    union
-    {
-        uint8_t v8 [ 4 ];
-        uint16_t v16 [ 2 ];
-        uint32_t v32 [ 1 ];
-
-    } idx;
-
-    /* from this point forward, the structure members have calculated offsets */
-#if 0
-
-    /* transition array sequence type bits
-       indexed as: bits [ i / 8 ] & ( 1 << ( i % 8 ) )
-
-       a "0" indicates a simple { idx, trans } pair, while
-       a "1" indicates an index range { lower, upper } and
-       a trans [] corresponding to the range. the index range
-       is fully closed, i.e. upper is inclusive. */
-
-    uint8_t child_seq_type [ ( idx [ pttHdrSeqLen ] + 7 ) / 8 ];
-
-    /* alignment padding - when finding the location of the
-       "child" array ( if it exists ), it is forced to be aligned
-       to the size of its variant */
-
-    if ( offsetof align1 % sizeof child [ 0 ] != 0 )
-        uint8_t align1 [ sizeof child [ 0 ] - offsetof align1 % sizeof child [ 0 ] ];
-
-    /* if keys are embedded within tree, then record a backtrace
-       link from this P_TTrans to its parent */
-    if ( tt -> ext_keys == false )
-    {
-        union
-        {
-            uint8_t v8;
-            uint16_t v16;
-            uint32_t v32;
-
-        } dad;
-    }
-
-    /* transition ids. the variant selected depends upon
-       the number of transition nodes in the tree */
-
-    if ( idx [ pttHdrIdxCnt ] != 0 )
-    {
-        union
-        {
-            uint8_t v8 [ idx [ pttHdrChildCnt ] ];
-            uint16_t v16 [ idx [ pttHdrChildCnt ] ];
-            uint32_t v32 [ idx [ pttHdrChildCnt ] ];
-            
-        } child;
-    }
-    
-    /* alignment padding */
-    if ( offsetof align2 % sizeof uint32_t != 0 )
-    {
-        /* true or false as to whether to expect vals PBSTree */
-        uint8_t has_vals;
-
-        /* padding */
-        uint8_t align2 [ sizeof uint32_t - 1 - offsetof align2 % sizeof uint32_t ];
-    }
-
-    /* a persisted tree */
-    if ( offsetof align2 % sizeof uint32_t == 0 || has_vals != false )
-        PBSTree vals;
-
-    /* final alignment */
-    if ( offsetof align3 % 4 != 0 )
-        uint8_t align3 [ 4 - offsetof align3 % 4 ];
-#endif
-};
-
-typedef struct PTTrans PTTrans;
-struct PTTrans
-{
-    const PTTrans *back;
-
-    union
-    {
-        const uint8_t *v8;
-        const uint16_t *v16;
-        const uint32_t *v32;
-    } idx;
-
-    const uint8_t *child_seq_type;
-
-    union
-    {
-        const uint8_t *v8;
-        const uint16_t *v16;
-        const uint32_t *v32;
-    } dad;
-
-    union
-    {
-        const uint8_t *v8;
-        const uint16_t *v16;
-        const uint32_t *v32;
-    } child;
-
-    PBSTree _val;
-    const PBSTree *vals;
-
-    uint32_t tid;
-#if ! RECORD_HDR_IDX
-    uint32_t tidx;
-#endif
-#if ! RECORD_HDR_DEPTH
-    uint32_t depth;
-#endif
-    uint32_t tcnt;
-    uint32_t icnt;
-    uint32_t slen;
-    int32_t refcount;
-};
-
-/* PTTransGetIdx
- */
-#define PTTransGetIdx( self, tt, zidx ) \
-    ( * ( tt ) -> get_idx ) ( self, zidx )
-
-/* PTTransGetIdxAddr
- */
-#define PTTransGetIdxAddr( self, tt, zidx ) \
-    ( * ( tt ) -> get_idx_addr ) ( self, zidx )
-
-/* PTTransGetDad
- */
-#define PTTransGetDad( self, tt ) \
-    ( * ( tt ) -> get_dad ) ( self )
-
-/* PTTransAlignDadAddr
- */
-#define PTTransAlignDadAddr( self, tt ) \
-    ( * ( tt ) -> align_dad_addr ) ( self, ( tt ) -> backtrace )
-
-/* PTTransGetChild
- */
-#define PTTransGetChild( self, tt, zidx ) \
-    ( * ( tt ) -> get_child ) ( self, zidx )
-
-/* PTTransGetChildAddr
- */
-#define PTTransGetChildAddr( self, tt, zidx ) \
-    ( * ( tt ) -> get_child_addr ) ( self, zidx )
-
-/* PTTransGetTransCharCode
- *  get char code of parent to self transition
- */
-#if RECORD_HDR_IDX
-#define PTTransGetTransCharCode( self, tt ) \
-    PTTransGetIdx ( self, tt, pttHdrIdx )
-#else
-#define PTTransGetTransCharCode( self, tt ) \
-    ( self ) -> tidx
-#endif
-
-/* PTTransGetDepth
- *  get transition depth
- */
-#if RECORD_HDR_DEPTH
-#define PTTransGetDepth( self, tt ) \
-    PTTransGetIdx ( self, tt, pttHdrDepth )
-#else
-#define PTTransGetDepth( self, tt ) \
-    ( self ) -> depth
-#endif
-
-/* PTTransForEach
- */
-void PTTransForEach ( const PTTrans *self, const PTrie *tt,
-    void ( * f ) ( const PTTrans *trans, const PTrie *tt, void *data ), void * data );
-
-/* PTTransDoUntil
- */
-bool PTTransDoUntil ( const PTTrans *self, const PTrie *tt,
-    bool ( * f ) ( const PTTrans *trans, const PTrie *tt, void *data ), void * data );
-
-/* PTTransWhack
- */
-void PTTransWhack ( PTTrans *trans );
-
-/* PTTransDump
- *  takes a FILE* as argument
- *
- *  "tt" [ IN ] - the owning PTrie
- *
- *  "stdio_file" [ IN ] - an output FILE* opaquely typed to avoid
- *  requiring an include of stdio.h
- *
- *  "indent_level" [ IN ] - the indent tabbing amount for output
- *  the implementation uses a tab setting of 2 spaces
- */
-void PTTransDump ( const PTTrans *self , const PTrie *tt,
-    void *stdio_file, uint32_t indent_level,
-    void ( CC * dump_node ) ( const void *addr, size_t size, void *stdio_file,
-        uint32_t indent_level, void *data ), void *data );
-
-
-/*--------------------------------------------------------------------------
- * P_Trie
- * PTrie
- *  persisted TTree
- */
-typedef struct P_Trie P_Trie;
-struct P_Trie
-{
-    /* the number of transition nodes */
-    uint32_t num_trans;
-
-    /* the number of value nodes */
-    uint32_t num_nodes;
-
-    /* size of all P_TTrans data */
-    uint32_t data_size;
-
-    /* storage characteristics */
-#if 0
-    /* keys are like this, built always as little-endian, first fields lowest */
-    uint16_t ext_keys  : 1;
-    uint16_t backtrace : 1;
-    uint16_t id_coding : 3;
-    uint16_t unused    : 11;
-#else
-    uint16_t keys;
-#endif  
-
-    /* character set in indexed order
-       N.B. a character value of 0 means
-       unmapped, and is unlikely but possible */
-    uint16_t width;
-    uint32_t rmap [ 1 ];
-
-#if 0
-    /* P_TTrans index - consists of 4-byte
-       offsets relative to "data" member,
-       i.e. an index of 2 means 8 byte offset */
-    union
-    {
-        uint8_t v8 [ num_trans ];
-        uint16_t v16 [ num_trans ];
-        uint32_t v32 [ num_trans ];
-
-    } trans_idx;
-
-    /* an alignment to keep "data" on 4-byte boundary */
-    if ( ( offsetof align1 & 3 ) != 0 )
-        uint8_t align1 [ 4 - ( offsetof align1 & 3 ) ];
-
-    /* P_TTrans objects */
-    uint32_t data [ ( data_size + 3 ) / 4 ];
-#endif
-};
-
-
-/* P_TrieExtKeys
- */
-#define P_TrieExtKeys( keys ) \
-    ( ( keys ) & 1 )
-
-/* P_TrieBacktrace
- */
-#define P_TrieBacktrace( keys ) \
-    ( ( keys ) & 2 )
-
-/* P_TrieIdCoding
- */
-#define P_TrieIdCoding( keys ) \
-    ( ( keys >> 2 ) & 7 )
-
-/* P_TrieSetExtKeys
- */
-#define P_TrieSetExtKeys( keys, val ) \
-    ( void ) ( ( val ) ? ( ( keys ) |= 1 ) : ( ( keys ) &= ~ 1 ) )
-
-/* P_TrieSetBacktrace
- */
-#define P_TrieSetBacktrace( keys, val ) \
-    ( void ) ( ( val ) ? ( ( keys ) |= 2 ) : ( ( keys ) &= ~ 2 ) )
-
-/* P_TrieSetIdCoding
- */
-#define P_TrieSetIdCoding( keys, val ) \
-    ( void ) ( ( keys ) = ( ( keys ) & ~ ( 7 << 2 ) ) | ( ( ( val ) & 7 ) << 2 ) )
-
-
-struct PTrie
-{
-    /* virtual functions on PTTrans */
-    uint32_t ( * get_idx ) ( const PTTrans*, uint32_t idx );
-    const void* ( * get_idx_addr ) ( const PTTrans*, uint32_t idx );
-    uint32_t ( * get_dad ) ( const PTTrans* );
-    const void* ( * align_dad_addr ) ( PTTrans*, bool backtrace );
-    uint32_t ( * get_child ) ( const PTTrans*, uint32_t idx );
-    const void* ( * get_child_addr ) ( const PTTrans*, uint32_t tcnt );
-
-    /* virtual functions on PTrie */
-    uint32_t ( * get_node_off ) ( const PTrie*, uint32_t idx );
-    uint32_t ( * encode_node_id ) ( const PTrie*,
-        uint32_t tid, uint32_t btid );
-    rc_t ( * decode_node_id ) ( const PTrie*, uint32_t id,
-        uint32_t *tid, uint32_t *btid );
-    uint32_t ( * decode_char_id ) ( const PTrie*, uint32_t id );
-
-    /* P_TTrans index to character map */
-    const uint32_t *_rmap;
-
-    /* P_TTrans offsets */
-    union
-    {
-        const uint8_t *v8;
-        const uint16_t *v16;
-        const uint32_t *v32;
-    } trans_off;
-
-    /* P_TTrans PTrans objects */
-    const uint32_t *data;
-
-    /* the number of transition nodes */
-    uint32_t num_trans;
-
-    /* the number of value nodes */
-    uint32_t num_nodes;
-
-    /* size of all P_TTrans data */
-    uint32_t data_size;
-
-    /* storage characteristics */
-    uint8_t ext_keys;
-    uint8_t backtrace;
-    uint8_t id_coding;
-    uint8_t byteswap;
-
-    /* width of character map & trans array */
-    uint16_t width;
-
-    /* range of UTF-32 input characters */
-    uint32_t first_char;
-    uint32_t last_char;
-
-    /* index of an unmapped character */
-    uint16_t unmapped_idx;
-
-    /* character to index map */
-    uint16_t map [ 1 ];
-};
-
-
-
-/* PTrieGetNodeOff
- */
-#define PTrieGetNodeOff( self, zidx ) \
-    ( * ( self ) -> get_node_off ) ( self, zidx )
-
-/* PTrieEncodeNodeId
- */
-#define PTrieEncodeNodeId( self, tid, btid ) \
-    ( * ( self ) -> encode_node_id ) ( self, tid, btid )
-
-/* PTrieDecodeNodeId
- */
-#define PTrieDecodeNodeId( self, id, tid, btid ) \
-    ( * ( self ) -> decode_node_id ) ( self, id, tid, btid )
-
-/* PTrieDecodeCharId
- */
-#define PTrieDecodeCharId( self, idx ) \
-    ( * ( self ) -> decode_char_id ) ( self, idx )
-
-
-/* PTrieInitNode
- *  takes a one-based index
- */
-rc_t PTrieInitNode ( const PTrie *self, PTTrans *trans, uint32_t idx );
-
-/* PTrieMakeNode
- *  takes a one-based index
- */
-rc_t PTrieMakeNode ( const PTrie *self, PTTrans **transp, uint32_t idx );
-
-/* PTrieDump
- *  takes a FILE* as argument
- *
- *  "name" [ IN, NULL OKAY ] - optional ttree name
- *
- *  "stdio_file" [ IN ] - an output FILE* opaquely typed to avoid
- *  requiring an include of stdio.h
- *
- *  "indent_level" [ IN ] - the indent tabbing amount for output
- *  the implementation uses a tab setting of 2 spaces
- *
- *  "dump_node" [ IN, NULL OKAY ] and "data" [ IN ] - an optional
- *  node dumping function and associated data
- */
-void PTrieDump ( const PTrie *self, const char *name,
-    void *stdio_file, uint32_t indent_level,
-    void ( * dump_node ) ( const void *addr, size_t size, void *stdio_file,
-        uint32_t indent_level, void *data ), void *data );
-
-/* PTrieDumpTrans
- *  takes a FILE* as argument
- *
- *  the indent level is used for hierarchy.
- *  2 spaces are emitted at the left margin for each level.
- */
-void PTrieDumpTrans ( const PTrie *self , uint32_t id,
-    void *stdio_file, uint32_t indent_level,
-    void ( * dump_node ) ( const void *addr, size_t size, void *stdio_file,
-        uint32_t indent_level, void *data ), void *data );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_pbstree_priv_ */
diff --git a/libs/klib/pbstree-swapped.c b/libs/klib/pbstree-swapped.c
deleted file mode 100644
index f9a9160..0000000
--- a/libs/klib/pbstree-swapped.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#undef SWAP_PERSISTED
-#define SWAP_PERSISTED 1
-#include "pbstree-impl.c"
-#undef SWAP_PERSISTED
diff --git a/libs/klib/pbstree.c b/libs/klib/pbstree.c
deleted file mode 100644
index 09f8b9c..0000000
--- a/libs/klib/pbstree.c
+++ /dev/null
@@ -1,395 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include "pbstree-priv.h"
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * PBSTree
- *  a flattened b-tree
- */
-
-/* Make
- *  make a PBSTree structure
- *  the memory reference passed in is borrowed
- */
-LIB_EXPORT rc_t CC PBSTreeMake ( PBSTree **ptp, const void *addr, size_t size, bool byteswap )
-{
-    rc_t rc;
-
-    if ( ptp == NULL )
-        rc = RC ( rcCont, rcTree, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( size == 0 )
-            rc = RC ( rcCont, rcTree, rcConstructing, rcData, rcInvalid );
-        else if ( addr == NULL )
-            rc = RC ( rcCont, rcTree, rcConstructing, rcData, rcNull );
-        else
-        {
-            PBSTree *pt = malloc ( sizeof * pt );
-            if ( pt == NULL )
-                rc = RC ( rcCont, rcTree, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                rc = byteswap ?
-                    PBSTreeMakeSwapped ( pt, addr, size ):
-                    PBSTreeMakeNative ( pt, addr, size );
-                if ( rc == 0 )
-                {
-                    * ptp = pt;
-                    return 0;
-                }
-
-                free ( pt );
-            }
-        }
-
-        * ptp = NULL;
-    }
-
-    return rc;
-}
-
-
-/* Init - PROTECTED
- *  initialize the parent class
- */
-rc_t PBSTreeInit ( PBSTree *self, const PBSTree_vt *vt, const P_BSTree *pt )
-{
-    if ( self == NULL )
-        return RC ( rcCont, rcTree, rcConstructing, rcSelf, rcNull );
-
-    if ( vt == NULL )
-        return RC ( rcCont, rcTree, rcConstructing, rcInterface, rcNull );
-    if ( vt -> v1 . maj == 0 )
-        return RC ( rcCont, rcTree, rcConstructing, rcInterface, rcInvalid );
-    if ( vt -> v1 . maj > PBSTREE_LATEST )
-        return RC ( rcFS, rcFile, rcConstructing, rcInterface, rcBadVersion );
-
-    if ( pt == NULL )
-        return RC ( rcCont, rcTree, rcConstructing, rcParam, rcNull );
-
-#if _DEBUGGING
-    if ( vt -> v1 . maj == 1 )
-    {
-        /* check v1.1 methods */
-        if ( vt -> v1 . destroy == NULL ||
-             vt -> v1 . count == NULL ||
-             vt -> v1 . depth == NULL ||
-             vt -> v1 . size == NULL ||
-             vt -> v1 . get_node_data == NULL ||
-             vt -> v1 . find == NULL ||
-             vt -> v1 . for_each == NULL ||
-             vt -> v1 . do_until == NULL )
-        return RC ( rcCont, rcTree, rcConstructing, rcInterface, rcNull );
-    }
-#endif
-
-    /* everything is okay */
-    self -> vt = vt;
-    self -> pt = pt;
-    return 0;
-}
-
-
-/* Count
- *  returns number of elements in b-tree
- */
-LIB_EXPORT uint32_t CC PBSTreeCount ( const PBSTree *self )
-{
-    if ( self != NULL )
-    {
-        switch ( self -> vt -> v1 . maj )
-        {
-        case 1:
-            return ( * self -> vt -> v1 . count ) ( self );
-        }
-    }
-    return 0;
-}
-
-/* Depth
- *  returns number of layers in b-tree
- */
-LIB_EXPORT uint32_t CC PBSTreeDepth ( const PBSTree *self )
-{
-    if ( self != NULL )
-    {
-        switch ( self -> vt -> v1 . maj )
-        {
-        case 1:
-            return ( * self -> vt -> v1 . depth ) ( self );
-        }
-    }
-
-    return 0;
-}
-
-/* Size
- *  returns the size in bytes
- *  of the PBSTree image
- */
-LIB_EXPORT size_t CC PBSTreeSize ( const PBSTree *self )
-{
-    if ( self != NULL )
-    {
-        switch ( self -> vt -> v1 . maj )
-        {
-        case 1:
-            return ( * self -> vt -> v1 . size ) ( self );
-        }
-    }
-
-    return 0;
-}
-
-
-/* GetNodeData - INTERNAL
- *  finds node data boundaries
- */
-rc_t PBSTreeGetNodeData ( const PBSTree *self,
-    const void **addr, size_t *size, uint32_t id )
-{
-    assert ( self != NULL );
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . get_node_data ) ( self, addr, size, id );
-    }
-
-    return RC ( rcCont, rcTree, rcAccessing, rcInterface, rcBadVersion );
-}
-
-
-/* GetNode
- *  gets a PBSTNode from an id
- *
- *  "node" [ OUT ] - return parameter for node
- *
- *  "id" [ IN ] - a 1-based integer node id
- *
- *  return values:
- *    EINVAL => an invalid parameter was passed
- *    ENOENT => id out of range
- */
-LIB_EXPORT rc_t CC PBSTreeGetNode ( const PBSTree *self, PBSTNode *node, uint32_t id )
-{
-    rc_t rc;
-    if ( node == NULL )
-        rc = RC ( rcCont, rcTree, rcAccessing, rcNode, rcNull );
-    else
-    {
-        if ( self == NULL)
-            rc = RC ( rcCont, rcTree, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = PBSTreeGetNodeData ( self,
-                & node -> data . addr, & node -> data . size, id );
-            if ( rc == 0 )
-            {
-                node -> internal = self;
-                node -> id = id;
-                return 0;
-            }
-        }
-
-        node -> data . addr = node -> internal = NULL;
-        node -> data . size = 0;
-        node -> id = 0;
-    }
-    return rc;
-}
-
-/* PBSTreeFind
- *  find an object within tree
- *  "cmp" function returns equivalent of "item" - "n"
- */
-LIB_EXPORT uint32_t CC PBSTreeFind ( const PBSTree *self, PBSTNode *n, const void *item,
-    int ( CC * cmp ) ( const void *item, const PBSTNode *n, void *data ), void *data )
-{
-    PBSTNode buffer;
-
-    if ( n == NULL )
-        n = & buffer;
-
-    n -> internal = self;
-    if ( self != NULL )
-    {
-        switch ( self -> vt -> v1 . maj )
-        {
-        case 1:
-            return ( * self -> vt -> v1 . find ) ( self, n, item, cmp, data );
-        }
-    }
-
-    n -> data . addr = NULL;
-    n -> data . size = 0;
-    return n -> id = 0;
-}
-
-/* PBSTreeForEach
- *  executes a function on each tree element
- */
-LIB_EXPORT void CC PBSTreeForEach ( const PBSTree *self, bool reverse,
-    void ( CC * f ) ( PBSTNode *n, void *data ), void *data )
-{
-    if ( self != NULL && f != NULL )
-    {
-        switch ( self -> vt -> v1 . maj )
-        {
-        case 1:
-            ( * self -> vt -> v1 . for_each ) ( self, reverse, f, data );
-            break;
-        }
-    }
-}
-
-/* PBSTreeDoUntil
- *  executes a function on each element
- *  until the function returns true
- */
-LIB_EXPORT bool CC PBSTreeDoUntil ( const PBSTree *self, bool reverse,
-    bool ( CC * f ) ( PBSTNode *n, void *data ), void *data )
-{
-    if ( self != NULL && f != NULL )
-    {
-        switch ( self -> vt -> v1 . maj )
-        {
-        case 1:
-            return ( * self -> vt -> v1 . do_until ) ( self, reverse, f, data );
-        }
-    }
-
-    return false;
-}
-
-/* PBSTreeWhack
- *  whacks PBSTree object
- *  does not free memory reference
- */
-LIB_EXPORT void CC PBSTreeWhack ( PBSTree *self )
-{
-    if ( self != NULL )
-    {
-        switch ( self -> vt -> v1 . maj )
-        {
-        case 1:
-            ( * self -> vt -> v1 . destroy ) ( self );
-            break;
-        }
-    }
-}
-
-
-/*--------------------------------------------------------------------------
- * PBSTNode
- *  identifies a node within persisted b-tree
- */
-
-/* Next
- *  returns next node id
- */
-LIB_EXPORT uint32_t CC PBSTNodeNext ( PBSTNode *n )
-{
-    if ( n == NULL )
-        return 0;
-
-    if ( PBSTreeGetNodeData ( n -> internal,
-             & n -> data . addr, & n -> data . size, n -> id + 1 ) )
-        return 0;
-
-    return ++ n -> id;
-}
-
-/* Prev
- *  returns prev node id
- */
-LIB_EXPORT uint32_t CC PBSTNodePrev ( PBSTNode *n )
-{
-    if ( n == NULL )
-        return 0;
-
-    if ( PBSTreeGetNodeData ( n -> internal,
-             & n -> data . addr, & n -> data . size, n -> id - 1 ) )
-        return 0;
-
-    return -- n -> id;
-}
-
-/* FindNext
- *  find next element satisfying criteria
- */
-LIB_EXPORT uint32_t CC PBSTNodeFindNext ( PBSTNode *n,
-    bool ( CC * f ) ( const PBSTNode *n ) )
-{
-    PBSTNode save;
-
-    if ( n == NULL || f == NULL )
-        return 0;
-
-    save = * n;
-
-    while ( PBSTNodeNext ( n ) )
-    {
-        if ( ( * f ) ( n ) )
-            return n -> id;
-    }
-
-    * n = save;
-    return 0;
-}
-
-/* FindPrev
- *  find previous element satisfying criteria
- */
-LIB_EXPORT uint32_t CC PBSTNodeFindPrev ( PBSTNode *n, 
-    bool ( CC * f ) ( const PBSTNode *n ) )
-{
-    PBSTNode save;
-
-    if ( n == NULL || f == NULL )
-        return 0;
-
-    save = * n;
-
-    while ( PBSTNodePrev ( n ) )
-    {
-        if ( ( * f ) ( n ) )
-            return n -> id;
-    }
-
-    * n = save;
-    return 0;
-}
diff --git a/libs/klib/printf.c b/libs/klib/printf.c
deleted file mode 100644
index 0edc914..0000000
--- a/libs/klib/printf.c
+++ /dev/null
@@ -1,3541 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include <klib/text.h>
-#include <klib/printf.h>
-#include <klib/writer.h>
-#include <klib/symbol.h>
-#include <klib/time.h>
-#include <klib/data-buffer.h>
-#include <klib/rc.h>
-
-#include "writer-priv.h"
-
-#include <os-native.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <assert.h>
-#include <va_copy.h>
-
-/* the number of PrintFmt, PrintArg and String
-   elements to allocate in function-local storage */
-#define LOCAL_FMT_COUNT 64
-
-
-/* for testing purposes - temporarily define this guy */
-#define STDC_COMPATIBILITY 1
-
-/***********************************
- * OLD PRINTF CODE IS NOW INACTIVE *
- ***********************************/
-#define USE_OLD_PRINTF 0
-
-/***********************************
- * OUR OLD BUDDY                   *
- ***********************************/
-#if WINDOWS
-#undef snprintf
-#define snprintf _snprintf
-#endif
-
-/**************************************
- * NAMING TRICKS TO HAVE BOTH ON HAND *
- **************************************/
-#if USE_OLD_PRINTF
-#define old_string_vprintf string_vprintf
-#define old_string_printf string_printf
-#define old_vkfprintf vkfprintf
-#define old_kfprintf kfprintf
-#else
-#define new_string_vprintf string_vprintf
-#define new_string_printf string_printf
-#define new_vkfprintf vkfprintf
-#define new_kfprintf kfprintf
-#endif
-
-/************************************
- * BEHAVIORS SENSITIVE TO STDC MODE *
- ************************************/
-#if STDC_COMPATIBILITY
-#define NULL_STRING_TEXT "(null)"
-#else
-#define NULL_STRING_TEXT "NULL"
-#endif
-#define DOUSE_NUM_PREFIX_IF_ZERO              STDC_COMPATIBILITY
-#define KEEP_OCT_PREFIX_IF_ZERO               STDC_COMPATIBILITY
-#define OCTAL_PREFIX_COUNTS_TOWARD_PRECISION  STDC_COMPATIBILITY
-#define HEX_PREFIX_FOLLOWS_CASE               STDC_COMPATIBILITY
-/* Present in 2.3.3 (from SLES 9.3), absent in 2.5 (from CentOS 5.6) */
-#define EMULATE_SMALLINT_EXTENSION_BUG      ( STDC_COMPATIBILITY && defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 5) ) )
-#define ZERO_PAD_ONLY_NUMBERS               ( !STDC_COMPATIBILITY || defined(__GLIBC__) )
-
-#define USE_LIB_FLOAT 1
-
-static
-size_t string_flush ( char *dst, size_t bsize, const KWrtHandler *flush, rc_t *rc, size_t *total )
-{
-    size_t num_writ, flushed;
-    for ( flushed = 0; flushed < bsize; flushed += num_writ )
-    {
-        * rc = ( * flush -> writer ) ( flush -> data, dst, bsize, & num_writ );
-        if ( * rc != 0 )
-            break;
-        if ( num_writ == 0 )
-            break;
-    }
-
-    if ( * rc == 0 )
-    {
-        * total += flushed;
-        if ( flushed < bsize )
-            memmove ( dst, dst + flushed, bsize - flushed );
-    }
-
-    return bsize - flushed;
-}
-
-static
-rc_t CC string_flush_printf ( char *dst, size_t bsize,
-    const KWrtHandler *flush, size_t *num_writ, const char *fmt, ... );
-
-static
-rc_t string_flush_vprintf ( char *dst, size_t bsize, const KWrtHandler *flush,
-    size_t *num_writ, const char *fmt, va_list args )
-{
-    rc_t rc;
-    size_t sidx, didx, total, sz;
-
-    uint32_t *np;
-    uint32_t u32;
-    int64_t i64;
-    uint64_t u64;
-    double f64;
-#if ! USE_LIB_FLOAT
-    uint64_t frac;
-    double ftmp;
-    uint32_t exponent;
-#endif
-    const char *cp, *end;
-    const String *str;
-    const KSymbol *sym;
-    const KTime *tm;
-
-    char buff [ 256 ];
-    char use_sign, padding;
-    const char *hex_digits;
-    uint32_t i, j, len, digits, min_field_width, max_field_width, precision;
-    bool left_align, comma_separate, have_precision, byte_size, half_size, long_size;
-    bool alternate, trim_trailing_zeros, date_time_zone;
-
-    if ( fmt == NULL )
-    {
-        rc = RC ( rcText, rcString, rcFormatting, rcParam, rcNull );
-        if ( num_writ != NULL )
-            * num_writ = 0;
-        return rc;
-    }
-
-    if ( fmt [ 0 ] == 0 )
-    {
-        rc = RC ( rcText, rcString, rcFormatting, rcParam, rcEmpty );
-        if ( num_writ != NULL )
-            * num_writ = 0;
-        return rc;
-    }
-
-    if ( dst == NULL )
-    {
-        flush = NULL;
-        bsize = 0;
-    }
-
-    for ( rc = 0, sidx = didx = total = 0; fmt [ sidx ] != 0 && rc == 0; ++ sidx )
-    {
-        /* flush buffer */
-        if ( didx == bsize && flush != NULL )
-        {
-            didx = string_flush ( dst, didx, flush, & rc, & total );
-            if ( rc != 0 )
-                break;
-        }
-
-        /* copy until ending NUL or '%' */
-        if ( fmt [ sidx ] != '%' )
-        {
-            if ( didx < bsize )
-                dst [ didx ] = fmt [ sidx ];
-            ++ didx;
-            continue;
-        }
-
-        /* process escaped '%' */
-        if ( fmt [ ++ sidx ] == '%' )
-        {
-            if ( didx < bsize )
-                dst [ didx ] = '%';
-            ++ didx;
-            continue;
-        }
-
-        digits = 0;
-
-        /* process flags */
-        use_sign = 0;
-        left_align = comma_separate = alternate = false;
-        padding = ' ';
-
-        while ( 1 )
-        {
-            switch ( fmt [ sidx ] )
-            {
-            case '-':
-                left_align = true;
-                padding = ' ';
-                ++ sidx;
-                continue;
-            case '+':
-                use_sign = '+';
-                ++ sidx;
-                continue;
-            case ' ':
-                if ( use_sign != '+' )
-                    use_sign = ' ';
-                ++ sidx;
-                continue;
-            case '0':
-                if ( ! left_align )
-                    padding = '0';
-                ++ sidx;
-                continue;
-            case ',':
-            case '\'':
-                comma_separate = true;
-                ++ sidx;
-                continue;
-            case '#':
-                alternate = true;
-                ++ sidx;
-                continue;
-            }
-
-            break;
-        }
-
-        /* field width */
-        min_field_width = 0;
-        if ( fmt [ sidx ] == '*' )
-        {
-            min_field_width = va_arg ( args, unsigned int );
-            ++ sidx;
-        }
-        else while ( isdigit ( fmt [ sidx ] ) )
-        {
-            min_field_width *= 10;
-            min_field_width += fmt [ sidx ++ ] - '0';
-        }
-
-        /* precision */
-        precision = 0;
-        have_precision = false;
-        if ( fmt [ sidx ] == '.' )
-        {
-            padding = ' ';
-            have_precision = true;
-            if ( fmt [ ++ sidx ] == '*' ) {
-                precision = va_arg ( args, unsigned int );
-                sidx++;
-            } else for ( ; isdigit ( fmt [ sidx ] ); ++ sidx )
-            {
-                precision *= 10;
-                precision += fmt [ sidx ] - '0';
-            }
-        }
-
-        /* storage size */
-        byte_size = half_size = long_size = date_time_zone = false;
-        switch ( fmt [ sidx ] )
-        {
-        case 't':
-            byte_size = true;
-            ++ sidx;
-            break;
-        case 'h':
-            /* this should not be necessary */
-            if ( fmt [  ++ sidx ] != 'h' )
-                half_size = true;
-            else
-            {
-                byte_size = true;
-                ++ sidx;
-            }
-            break;
-        case 'l':
-            long_size = true;
-            ++ sidx;
-            break;
-        case 'z':
-            date_time_zone = true;
-            if ( sizeof ( size_t ) == sizeof ( uint64_t ) )
-                long_size = true;
-            ++ sidx;
-            break;
-        }
-
-        /* format */
-        trim_trailing_zeros = false;
-        switch ( fmt [  sidx  ] )
-        {
-        case 'd':
-        case 'i':
-
-            /* retrieve argument as signed integer */
-            if ( byte_size )
-                i64 = ( int8_t ) va_arg ( args, int );
-            else if ( half_size )
-                i64 = ( int16_t ) va_arg ( args, int );
-            else if ( long_size )
-                i64 = va_arg ( args, int64_t );
-            else
-                i64 = va_arg ( args, int32_t );
-
-#if ! STDC_COMPATIBILITY
-            /* detect zero */
-            if ( i64 == 0 )
-                use_sign = 0;
-            else
-#endif
-            /* detect negative */
-            if ( i64 < 0 )
-            {
-                use_sign = '-';
-                i64 = - i64;
-            }
-
-            i = sizeof buff;
-
-#if ! USE_LIB_FLOAT
-        make_signed_integer:
-#endif
-            /* convert to numeral */
-            if ( comma_separate ) for ( -- i, j = 0; ; -- i, ++ j )
-            {
-                if ( j == 3 )
-                {
-                    buff [ -- i ] = ',';
-                    j = 0;
-                }
-                buff [ i ] =  ( i64 % 10 ) + '0';
-                ++ digits;
-                if ( ( i64 /= 10 ) == 0 )
-                    break;
-            }
-            else for ( -- i, digits = 0; ; -- i )
-            {
-                buff [ i ] =  ( i64 % 10 ) + '0';
-                ++ digits;
-                if ( ( i64 /= 10 ) == 0 )
-                    break;
-            }
-
-        insert_integer:
-
-            /* the actual length */
-            len = sizeof buff - i;
-
-            /* test for buffer flush */
-            if ( flush != NULL && didx < bsize )
-            {
-                max_field_width = len;
-                if ( len < precision )
-                    max_field_width = precision;
-                max_field_width += ( use_sign != 0 );
-                if ( max_field_width < min_field_width )
-                    max_field_width = min_field_width;
-                if ( didx + max_field_width > bsize )
-                {
-                    didx = string_flush ( dst, didx, flush, & rc, & total );
-                    if ( rc != 0 )
-                        break;
-                }
-            }
-
-            /* insert left-aligned */
-            if ( left_align )
-            {
-                /* sign */
-                if ( use_sign != 0 )
-                {
-                    if ( didx < bsize )
-                        dst [ didx ] = use_sign;
-                    ++ didx;
-                    ++ len;
-                }
-
-                /* precision */
-                for ( ; digits < precision; ++ didx, ++ len, ++ digits )
-                {
-                    if ( didx < bsize )
-                        dst [ didx ] = '0';
-                }
-
-                /* value */
-                for ( ; i < sizeof buff; ++ didx, ++ i )
-                {
-                    if ( didx < bsize )
-                        dst [ didx ] = buff [ i ];
-                }
-
-                /* padding */
-                for ( ; len < min_field_width; ++ didx, ++ len )
-                {
-                    if ( didx < bsize )
-                        dst [ didx ] = ' ';
-                }
-            }
-            /* insert right-aligned */
-            else
-            {
-                /* remove sign from field width */
-                if ( use_sign != 0 && min_field_width != 0 )
-                    -- min_field_width;
-
-                /* zero padding means issue sign first */
-                if ( use_sign != 0 && padding == '0' )
-                {
-                    if ( didx < bsize )
-                        dst [ didx ] = use_sign;
-                    ++ didx;
-                    use_sign = 0;
-                }
-
-                /* adjust length for precision */
-                if ( precision > digits )
-                    len += precision - digits;
-
-                /* apply padding */
-                for ( ; len < min_field_width; ++ didx, -- min_field_width )
-                {
-                    if ( didx < bsize )
-                        dst [ didx ] = padding;
-                }
-
-                /* sign */
-                if ( use_sign != 0 )
-                {
-                    if ( didx < bsize )
-                        dst [ didx ] = use_sign;
-                    ++ didx;
-                }
-
-                /* precision */
-                for ( ; digits < precision; ++ didx, ++ digits )
-                {
-                    if ( didx < bsize )
-                        dst [ didx ] = '0';
-                }
-
-                /* value */
-                for ( ; i < sizeof buff; ++ didx, ++ i )
-                {
-                    if ( didx < bsize )
-                        dst [ didx ] = buff [ i ];
-                }
-            }
-
-            break;
-
-        case 'u':
-
-            /* retrieve argument as unsigned integer */
-            if ( byte_size )
-                u64 = ( uint8_t ) va_arg ( args, int );
-            else if ( half_size )
-                u64 = ( uint16_t ) va_arg ( args, int );
-            else if ( long_size )
-                u64 = va_arg ( args, uint64_t );
-            else
-                u64 = va_arg ( args, uint32_t );
-
-            /* no sign */
-            use_sign = 0;
-
-            i = sizeof buff - 1;
-
-            /* convert to numeral */
-            if ( comma_separate ) for ( j = digits = 0; ; -- i, ++ j )
-            {
-                if ( j == 3 )
-                {
-                    buff [ -- i ] = ',';
-                    j = 0;
-                }
-                buff [ i ] =  ( u64 % 10 ) + '0';
-                ++ digits;
-                if ( ( u64 /= 10 ) == 0 )
-                    break;
-            }
-            else for ( digits = 0; ; -- i )
-            {
-                buff [ i ] =  ( u64 % 10 ) + '0';
-                ++ digits;
-                if ( ( u64 /= 10 ) == 0 )
-                    break;
-            }
-
-            goto insert_integer;
-
-        case 'p':
-
-            /* retrieve argument as unsigned integer */
-            if ( sizeof ( void* ) == sizeof ( uint32_t ) )
-                u64 = va_arg ( args, uint32_t );
-            else
-                u64 = va_arg ( args, uint64_t );
-
-            goto make_hex_integer;
-
-        case 'x':
-        case 'X':
-
-            /* retrieve argument as unsigned integer */
-            if ( byte_size )
-                u64 = ( uint8_t ) va_arg ( args, int );
-            else if ( half_size )
-                u64 = ( uint16_t ) va_arg ( args, int );
-            else if ( long_size )
-                u64 = va_arg ( args, uint64_t );
-            else
-                u64 = va_arg ( args, uint32_t );
-
-        make_hex_integer:
-
-            /* choose numeric case */
-            hex_digits = ( fmt [ sidx ] == 'x' ) ?
-                "0123456789abcdefx" : "0123456789ABCDEFX";
-
-            /* no sign */
-            use_sign = 0;
-
-            i = sizeof buff - 1;
-
-            /* convert to numeral */
-            if ( comma_separate ) for ( j = digits = 0; ; -- i, ++ j )
-            {
-                if ( j == 3 )
-                {
-                    buff [ -- i ] = ',';
-                    j = 0;
-                }
-                buff [ i ] =  hex_digits [ u64 & 15 ];
-                ++ digits;
-                if ( ( u64 >>= 4 ) == 0 )
-                    break;
-            }
-            else for ( digits = 0; ; -- i )
-            {
-                buff [ i ] =  hex_digits [ u64 & 15 ];
-                ++ digits;
-                if ( ( u64 >>= 4 ) == 0 )
-                    break;
-            }
-
-            if ( alternate )
-            {
-                buff [ -- i ] = hex_digits [ 16 ];
-                buff [ -- i ] = '0';
-            }
-
-            goto insert_integer;
-
-        case 'o':
-
-            /* retrieve argument as unsigned integer */
-            if ( byte_size )
-                u64 = ( uint8_t ) va_arg ( args, int );
-            else if ( half_size )
-                u64 = ( uint16_t ) va_arg ( args, int );
-            else if ( long_size )
-                u64 = va_arg ( args, uint64_t );
-            else
-                u64 = va_arg ( args, uint32_t );
-
-            /* no sign */
-            use_sign = 0;
-
-            i = sizeof buff - 1;
-
-            /* convert to numeral */
-            if ( comma_separate ) for ( j = digits = 0; ; -- i, ++ j )
-            {
-                if ( j == 3 )
-                {
-                    buff [ -- i ] = ',';
-                    j = 0;
-                }
-                buff [ i ] =  ( u64 & 7 ) + '0';
-                ++ digits;
-                if ( ( u64 >>= 3 ) == 0 )
-                    break;
-            }
-            else for ( digits = 0; ; -- i )
-            {
-                buff [ i ] =  ( u64 & 7 ) + '0';
-                ++ digits;
-                if ( ( u64 >>= 3 ) == 0 )
-                    break;
-            }
-
-            if ( alternate )
-            {
-                buff [ -- i ] = '0';
-#if STDC_COMPATIBILITY
-                ++ digits;
-#endif
-            }
-
-            goto insert_integer;
-
-        case 'b':
-
-            /* retrieve argument as unsigned integer */
-            if ( byte_size )
-                u64 = ( uint8_t ) va_arg ( args, int );
-            else if ( half_size )
-                u64 = ( uint16_t ) va_arg ( args, int );
-            else if ( long_size )
-                u64 = va_arg ( args, uint64_t );
-            else
-                u64 = va_arg ( args, uint32_t );
-
-            /* no sign */
-            use_sign = 0;
-
-            i = sizeof buff - 1;
-
-            /* convert to numeral */
-            if ( comma_separate ) for ( j = digits = 0; ; -- i, ++ j )
-            {
-                if ( j == 3 )
-                {
-                    buff [ -- i ] = ',';
-                    j = 0;
-                }
-                buff [ i ] =  ( u64 & 1 ) + '0';
-                ++ digits;
-                if ( ( u64 >>= 1 ) == 0 )
-                    break;
-            }
-            else for ( i = sizeof buff - 1; ; -- i )
-            {
-                buff [ i ] =  ( u64 & 1 ) + '0';
-                ++ digits;
-                if ( ( u64 >>= 1 ) == 0 )
-                    break;
-            }
-
-            if ( alternate )
-            {
-                buff [ -- i ] = 'b';
-                buff [ -- i ] = '0';
-            }
-
-            goto insert_integer;
-
-#if USE_LIB_FLOAT
-        case 'g':
-        case 'e':
-        case 'f':
-        {
-            char subfmt [ 16 ];
-            char * psubfmt = subfmt;
-
-            *psubfmt++ = '%';
-
-            if (alternate)
-                *psubfmt++ = '#';
-
-            if (use_sign)
-                *psubfmt++ = use_sign;
-
-            if (left_align)
-                *psubfmt++ = '-';
-            else if (padding == '0')
-                *psubfmt++ = '0';
-
-            *psubfmt++ = '*';
-            *psubfmt++ = '.';
-            *psubfmt++ = '*';
-            *psubfmt++ = fmt [  sidx  ];
-            *psubfmt = '\0';
-            
-            /* retrieve argument as double or long double */
-        
-            if ( long_size )
-                f64 = ( double ) va_arg ( args, long double );
-            else
-                f64 = va_arg ( args, double );
-
-            if ( ! have_precision )
-                precision = 6;
-            else if ( precision > 20 )
-                precision = 20;
-
-            i = snprintf (buff, sizeof buff, subfmt, min_field_width, precision, f64);
-
-            if ( i >= sizeof buff )
-            {
-                i = sizeof buff - 1;
-                buff [ i ] = '\0';
-            }
-            min_field_width = 0;
-            have_precision = false;
-
-            cp = buff;
-            goto make_nul_term_string;
-        }
-#else
-        case 'g':
-            trim_trailing_zeros = true;
-        case 'e':
-
-#define HANDLE_NAN() \
-            switch (fpclassify (f64))                   \
-            {                                           \
-            case FP_NAN:                                \
-                cp = "nan";                             \
-                goto make_nul_term_string;              \
-            case FP_INFINITE:                           \
-                cp = (f64 < 0) ? "-inf" : "inf";        \
-                goto make_nul_term_string;              \
-            }
-
-
-            /* retrieve argument as double or long double */
-        
-            if ( long_size )
-                f64 = ( double ) va_arg ( args, long double );
-            else
-                f64 = va_arg ( args, double );
-
-            HANDLE_NAN();
-
-            if ( f64 < 0 )
-            {
-                use_sign = '-';
-                f64 = - f64;
-            }
-
-            exponent = 0;
-            buff [ sizeof buff - 3 ] = '+';
-            buff [ sizeof buff - 4 ] = 'e';
-
-            i = len = sizeof buff;
-
-            ftmp = f64;
-
-            if ( f64 >= 10.0 )
-            {
-                for ( ftmp = f64 / 10, exponent = 1; ftmp >= 10.0; ++ exponent )
-                    ftmp /= 10;
-
-                if ( exponent < precision && fmt [ sidx ] == 'g' )
-                    goto make_normal_float;
-            }
-            else if ( f64 < 1.0 && f64 > 0.0 )
-            {
-                buff [ sizeof buff - 3 ] = '-';
-                for ( ftmp = f64 * 10, exponent = 1; ftmp < 1.0; ++ exponent )
-                    ftmp *= 10;
-
-                if ( exponent <= 4 && fmt [ sidx ] == 'g' )
-                    goto make_normal_float;
-            }
-            else if ( fmt [ sidx ] == 'g' )
-            {
-                goto make_normal_float;
-            }
-
-            /* just for safety */
-            exponent %= 100;
-
-            trim_trailing_zeros = false;
-
-            f64 = ftmp;
-
-            buff [ sizeof buff - 1 ] = ( exponent % 10 ) + '0';
-            buff [ sizeof buff - 2 ] = ( exponent / 10 ) + '0';
-
-            i = len = sizeof buff - 4;
-            goto make_normal_float;
-
-        case 'f':
-
-            /* retrieve argument as double or long double */
-            if ( long_size )
-                f64 = ( double ) va_arg ( args, long double );
-            else
-                f64 = va_arg ( args, double );
-
-            HANDLE_NAN();
-
-            if ( f64 < 0 )
-            {
-                use_sign = '-';
-                f64 = - f64;
-            }
-
-            i = len = sizeof buff;
-
-        make_normal_float:
-
-            if ( ! have_precision )
-                precision = 6;
-            else if ( precision > 20 )
-                precision = 20;
-
-            ftemp = 0.5;
-            for (j = 0; j < precision ; ++j)
-                ftemp /= 10;
-
-            f64 += ftemp;
-
-
-            /* save off integral portion */
-            i64 = ( int64_t ) f64;
-
-            /* convert to fraction */
-            f64 = f64 - i64;
-
-            /* promote by precision */
-            for ( j = 0; j < precision; ++ j )
-                f64 *= 10;
-
-            for ( frac = ( uint64_t ) f64; i + precision > len; frac /= 10 )
-                buff [ -- i ] = frac % 10 + '0';
-
-            if ( trim_trailing_zeros )
-            {
-                for ( j = len; -- j >= i; -- precision )
-                {
-                    if ( buff [ j ] != '0' )
-                        break;
-                }
-
-                memmove ( & buff [ len - precision ], & buff [ i ], precision );
-                i = len - precision;
-            }
-
-            if ( precision != 0 || alternate )
-                buff [ -- i ] = '.';
-
-            goto make_signed_integer;
-#endif
-        case 'c':
-
-            /* retrieve as an int */
-            u32 = va_arg ( args, unsigned int );
-            if ( u32 < 128 )
-                buff [ i = sizeof buff - 1 ] = ( char ) u32;
-            else
-            {
-                int dbytes = utf32_utf8 ( buff, & buff [ sizeof buff ], u32 );
-                if ( dbytes <= 0 )
-                    buff [ i = sizeof buff - 1 ] = '?';
-                else
-                    memmove ( & buff [ i = sizeof buff - dbytes ], buff, dbytes );
-            }
-
-            /* precision makes no sense, but no error */
-            precision = 0;
-
-            /* sign makes no sense */
-            use_sign = 0;
-
-#if ZERO_PAD_ONLY_NUMBERS
-            /* padding is always with spaces */
-            padding = ' ';
-#endif
-
-            /* other than that, we can treat it as an integer */
-            goto insert_integer;
-
-        case 's':
-
-            /* retrieve as a NUL terminated ( or precision limited ) string */
-            cp = va_arg ( args, const char* );
-            if ( cp == NULL )
-                cp = "NULL";
-
-        make_nul_term_string:
-
-            /* in our case, no precision field means unlimited */
-            if ( ! have_precision )
-                precision = -1;
-
-#if ZERO_PAD_ONLY_NUMBERS
-            /* padding is always with spaces */
-            padding = ' ';
-#endif
-            /* test for buffer flush */
-            if ( flush != NULL && didx < bsize )
-            {
-                max_field_width = 0;
-                if ( have_precision )
-                    max_field_width = precision;
-                if ( max_field_width < min_field_width )
-                    max_field_width = min_field_width;
-                if ( didx + max_field_width > bsize )
-                {
-                    didx = string_flush ( dst, didx, flush, & rc, & total );
-                    if ( rc != 0 )
-                        break;
-                }
-            }
-
-            /* if right aligning with a minimum field width, measure string */
-            if ( ! left_align && min_field_width != 0 )
-            {
-                for ( len = 0; cp [ len ] != 0 && len < precision; ++ len )
-                    ( void ) 0;
-
-                for ( ; len < min_field_width; ++ didx, ++ len )
-                {
-                    if ( didx < bsize )
-                        dst [ didx ] = padding;
-                }
-            }
-
-            /* copy string */
-            for ( i = 0; i < precision && cp [ i ] != 0; ++ didx, ++ i )
-            {
-                if ( flush != NULL && didx == bsize )
-                {
-                    didx = string_flush ( dst, didx, flush, & rc, & total );
-                    if ( rc != 0 )
-                        break;
-                }
-
-                if ( didx < bsize )
-                    dst [ didx ] = cp [ i ];
-            }
-
-            if ( rc != 0 )
-                break;
-
-            /* apply right padding */
-            if ( left_align ) for ( ; i < min_field_width; ++ didx, ++ i )
-            {
-                if ( flush != NULL && didx == bsize )
-                {
-                    didx = string_flush ( dst, didx, flush, & rc, & total );
-                    if ( rc != 0 )
-                        break;
-                }
-
-                if ( didx < bsize )
-                    dst [ didx ] = ' ';
-            }
-            break;
-
-            /* String object */
-        case 'S':
-
-            /* retrieve as a NUL terminated ( or precision limited ) string */
-            str = va_arg ( args, const String* );
-            if ( str == NULL )
-            {
-                cp = "NULL";
-                goto make_nul_term_string;
-            }
-
-        make_String:
-
-            /* in our case, no precision field means unlimited */
-            if ( ! have_precision )
-                precision = -1;
-
-            /* test for buffer flush */
-            if ( flush != NULL && didx < bsize )
-            {
-                /* buffer is measured in bytes, while printing
-                   widths are measured in characters... */
-                max_field_width = ( uint32_t ) str -> size;
-                if ( str -> len < min_field_width )
-                    max_field_width += min_field_width - str -> len;
-                if ( didx + max_field_width > bsize )
-                {
-                    didx = string_flush ( dst, didx, flush, & rc, & total );
-                    if ( rc != 0 )
-                        break;
-                }
-            }
-
-            /* if right aligning with a minimum field width, measure string */
-            if ( ! left_align && min_field_width != 0 )
-            {
-                len = str -> len;
-                if ( len > precision )
-                    len = precision;
-
-                for ( ; len < min_field_width; ++ didx, ++ len )
-                {
-                    if ( didx < bsize )
-                        dst [ didx ] = ' ';
-                }
-            }
-
-            cp = str -> addr;
-            end = cp + str -> size;
-
-            /* copy string */
-            for ( i = 0; i < str -> len && i < precision; ++ i )
-            {
-                uint32_t ch;
-                int sbytes = utf8_utf32 ( & ch, cp, end );
-                if ( sbytes <= 0 )
-                {
-                    if ( sbytes == 0 )
-                        rc = RC ( rcText, rcString, rcFormatting, rcData, rcInsufficient );
-                    else
-                        rc = RC ( rcText, rcString, rcFormatting, rcData, rcCorrupt );
-                    break;
-                }
-                cp += sbytes;
-
-                if ( didx < bsize )
-                {
-                    int dbytes = utf32_utf8 ( dst + didx, dst + bsize, ch );
-                    if ( dbytes > 0 )
-                    {
-                        didx += dbytes;
-                        continue;
-                    }
-                    if ( dbytes < 0 )
-                    {
-                        rc = RC ( rcText, rcString, rcFormatting, rcData, rcCorrupt );
-                        break;
-                    }
-                }
-
-                didx += sbytes;
-            }
-
-            /* apply right padding */
-            if ( left_align ) for ( ; i < min_field_width; ++ didx, ++ i )
-            {
-                if ( didx < bsize )
-                    dst [ didx ] = ' ';
-            }
-            break;
-
-            /* version number */
-        case 'V':
-
-            u32 = va_arg ( args, uint32_t );
-
-            if ( ! have_precision )
-            {
-                if ( ( u32 & 0xFFFF ) != 0 )
-                    precision = 3;
-                else if ( ( u32 & 0xFF0000 ) != 0 )
-                    precision = 2;
-                else
-                    precision = 1;
-            }
-
-            switch ( precision )
-            {
-            case 0:
-                cp = ""; break;
-            case 1:
-                cp ="%u"; break;
-            case 2:
-                cp ="%u.%u"; break;
-            default:
-                cp ="%u.%u.%u";
-            }
-
-            have_precision = false;
-            precision = 0;
-
-            rc = string_printf ( buff, sizeof buff, & sz,
-                                 cp,
-                                 VersionGetMajor ( u32 ),
-                                 VersionGetMinor ( u32 ),
-                                 VersionGetRelease ( u32 ) );
-            if ( rc != 0 )
-                break;
-
-            use_sign = 0;
-            padding = ' ';
-            memmove ( & buff [ i = ( uint32_t ) ( sizeof buff - sz ) ], buff, sz );
-            goto insert_integer;
-
-        case 'R':
-
-            rc = va_arg ( args, rc_t );
-            sz = KWrtFmt_rc_t ( buff, sizeof buff, alternate ? "#" : "", rc );
-            rc = 0; /* reset back to ok */
-            assert ( sz < sizeof buff );
-
-            use_sign = 0;
-            padding = ' ';
-            memmove ( & buff [ i = ( uint32_t ) ( sizeof buff - sz ) ], buff, sz );
-            goto insert_integer;
-
-        case 'N':
-
-            /* THIS IS WRONG - FIELD WIDTH AND FRIENDS WILL NOT BE USED */
-            sym = va_arg ( args, const KSymbol* );
-
-            if ( sym -> dad != NULL )
-            {
-                if ( flush != NULL )
-                    didx = string_flush ( dst, didx, flush, & rc, & total );
-
-                sz = 0;
-                rc = string_flush_printf ( & dst [ didx ], bsize - didx, flush, & sz, "%N:", sym -> dad );
-                if ( rc != 0 )
-                    break;
-
-                didx += ( uint32_t ) sz;
-                if ( flush != NULL )
-                    didx = 0;
-            }
-
-            str = & sym -> name;
-            goto make_String;
-
-        case 'T': /* KTime */
-
-            tm = va_arg ( args, const KTime* );
-
-            sz = 0;
-
-            /* LEGEND
-             *  modifier 'h' means do date only
-             *  modifier 'l' means date and time
-             *  modifier 'z' means date, time and timezone
-             *  no modifier means time
-             *  precision affects time
-             *  leading zero affects time
-             */
-            if ( date_time_zone || long_size || half_size )
-            {
-                static char const *months [ 12 ] =
-                    { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
-                static char const *weekdays [ 7 ] =
-                    { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
-                rc = string_printf ( buff, sizeof buff, & sz, "%s %s %u %u"
-                                     , weekdays [ tm -> weekday ]
-                                     , months [ tm -> month ]
-                                     , tm -> day + 1
-                                     , tm -> year
-                    );
-                if ( rc != 0 )
-                    break;
-            }
-
-            if ( ! half_size )
-            {
-                if ( sz != 0 )
-                    buff [ sz ++ ] = ' ';
-
-                u64 = sz;
-
-                rc = string_printf ( & buff [ sz ], sizeof buff - sz, & sz,
-                                     padding == '0' ? "%02u:%02u:%02u %cM" : "%u:%02u:%02u %cM"
-                                     , ( tm -> hour + 11 ) % 12 + 1
-                                     , tm -> minute
-                                     , tm -> second
-                                     , ( tm -> hour < 12 ) ? 'A' : 'P'
-                    );
-                if ( rc != 0 )
-                    break;
-
-                u64 += sz;
-
-                if ( date_time_zone )
-                {
-                    rc = string_printf ( & buff [ u64 ], sizeof buff - ( size_t ) u64, & sz,
-                                         " %+02d", tm -> tzoff / 60 );
-                    if ( rc != 0 )
-                        break;
-
-                    u64 += sz;
-                }
-
-                sz = ( size_t ) u64;
-            }
-
-            padding = ' ';
-            memmove ( & buff [ i = ( uint32_t ) ( sizeof buff - sz ) ], buff, sz );
-            cp = buff;
-            goto make_nul_term_string;
-
-        case '!': /* operating system error code: e.g. errno or GetLastError() */
-            u32 = va_arg ( args, uint32_t ); /* fetching it unsigned but it can be signed */
-
-            sz = KWrtFmt_error_code ( buff, sizeof buff - 1, u32 );
-            assert ( sz < sizeof buff );
-            buff [ sz ] = '\0';
-
-            padding  = ' ';
-            memmove ( & buff [ i = ( uint32_t ) ( sizeof buff - sz ) ], buff, sz );
-            cp = buff;
-            goto make_nul_term_string;
-
-        case 'n':
-
-            np = va_arg ( args, uint32_t* );
-            if ( np != NULL )
-                * np = ( uint32_t ) ( total + didx );
-            break;
-
-        case 0:
-            -- sidx;
-            break;
-
-        default:
-            rc = RC ( rcText, rcString, rcFormatting, rcFormat, rcUnrecognized );
-        }
-    }
-
-    if ( num_writ != NULL )
-        * num_writ = total + didx;
-
-    if ( flush != NULL )
-    {
-        if ( rc == 0 && didx != 0 )
-        {
-            didx = string_flush ( dst, didx, flush, & rc, & total );
-            if ( rc == 0 && didx != 0 )
-                rc = RC ( rcRuntime, rcString, rcFormatting, rcTransfer, rcIncomplete );
-        }
-    }
-    else if ( didx < bsize )
-        dst [ didx ] = 0;
-    else if ( rc == 0 )
-        rc = RC ( rcText, rcString, rcFormatting, rcBuffer, rcInsufficient );
-
-    return rc;
-}
-
-static
-rc_t CC string_flush_printf ( char *dst, size_t bsize,
-    const KWrtHandler *flush, size_t *num_writ, const char *fmt, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, fmt );
-
-    rc = string_flush_vprintf ( dst, bsize, flush, num_writ, fmt, args );
-
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC old_string_vprintf ( char *dst, size_t bsize,
-    size_t *num_writ, const char *fmt, va_list args )
-{
-    return string_flush_vprintf ( dst, bsize, NULL, num_writ, fmt, args );
-}
-
-LIB_EXPORT rc_t CC old_string_printf ( char *dst, size_t bsize, size_t *num_writ, const char *fmt, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, fmt );
-
-    rc = string_flush_vprintf ( dst, bsize, NULL, num_writ, fmt, args );
-
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC old_vkfprintf ( const KWrtHandler *out,
-    size_t *num_writ, const char * fmt, va_list args )
-{
-    rc_t rc;
-
-    if ( out == NULL )
-    {
-        rc = RC ( rcRuntime, rcString, rcFormatting, rcFile, rcNull );
-        if ( num_writ != NULL )
-            * num_writ = 0;
-    }
-    else
-    {
-        char buff [ 4096 ];
-        rc = string_flush_vprintf ( buff, sizeof buff, out, num_writ, fmt, args );
-        if ( rc != 0 )
-            rc = ResetRCContext ( rc, rcRuntime, rcString, rcFormatting );
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC old_kfprintf ( const KWrtHandler *out,
-    size_t *num_writ, const char * fmt, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, fmt );
-
-    rc = old_vkfprintf ( out, num_writ, fmt, args );
-        
-    va_end ( args );
-
-    return rc;
-}
-
-/****************************
- * NEW PRINTF IS NOW ACTIVE *
- ****************************/
-
-/* create_overflow
- *  create a buffer so large that it cannot overflow again
- *  copy in existing structures
- *  map self-referential pointers
- */
-static
-rc_t create_overflow ( KDataBuffer *overflow, const char *fmt_str,
-    String **strp, PrintFmt **fmtp, PrintArg **argp,
-    uint32_t str_idx, uint32_t fmt_idx, uint32_t arg_idx )
-{
-    /* measure the format string and infer that
-       we can never have more format items than
-       characters in the string... */
-    size_t fmt_str_size = strlen ( fmt_str );
-
-    /* our size will create a format and argument
-       for every byte. this should be a total overkill. */
-    size_t buff_size = ( sizeof ** strp + sizeof ** fmtp + sizeof **argp ) * fmt_str_size;
-
-    /* make the buffer */
-    rc_t rc = KDataBufferMakeBytes ( overflow, buff_size );
-    if ( rc == 0 )
-    {
-        /* capture pointers to stack structures */
-        const String *str = * strp;
-        const PrintFmt *fmt = * fmtp;
-        const PrintArg *args = * argp;
-
-        /* destination pointers */
-        String *dstr = overflow -> base;
-        PrintFmt *dfmt = ( void* ) ( dstr + fmt_str_size );
-        PrintArg *dargs = ( void* ) ( dfmt + fmt_str_size );
-
-        /* copy existing data */
-        memcpy ( dstr, str, str_idx * sizeof * dstr );
-        memcpy ( dfmt, fmt, fmt_idx * sizeof * dfmt );
-        memcpy ( dargs, args, arg_idx * sizeof * dargs );
-
-        /* if there are any pointers into "str", relocate them */
-        if ( str_idx != 0 )
-        {
-            uint32_t i, j;
-            for ( i = j = 0; i < fmt_idx && j < str_idx; ++ i )
-            {
-                switch ( dfmt [ i ] . type )
-                {
-                case sptString:
-                case sptUCS2String:
-                case sptUTF32String:
-                    if ( dargs [ i ] . S == & str [ j ] )
-                        dargs [ i ] . S = & dstr [ j ++ ];
-                    break;
-                }
-            }
-        }
-
-        /* replace pointers */
-        * strp = dstr;
-        * fmtp = dfmt;
-        * argp = dargs;
-   }
-
-    return rc;
-}
-
-
-/* parse_format_string
- *  parse format string and args into structured format
- */
-static
-rc_t parse_format_string ( const char *fmt_str, va_list vargs,
-    String **strp, PrintFmt **fmtp, PrintArg **argp, KDataBuffer *overflow )
-{
-    rc_t rc;
-    uint32_t i, str_idx, fmt_idx, arg_idx;
-
-    String *str = * strp;
-    PrintFmt *fmt = * fmtp;
-    PrintArg *args = * argp;
-
-    /* loop over format string */
-    for ( rc = 0, i = str_idx = fmt_idx = arg_idx = 0; fmt_str [ i ] != 0; ++ i )
-    {
-        bool alternate, numeric;
-        char size_modifier, time_modifier;
-        bool has_width, has_precision;
-        bool has_index, infinite_first;
-
-        /* loop to gather literal portions */
-        uint32_t start;
-        for ( start = i; ; ++ i )
-        {
-            /* run until we hit start of substitution token
-               or until we hit end of format string */
-            if ( fmt_str [ i ] != 0 && fmt_str [ i ] != '%' )
-                continue;
-
-            /* detect a literal string */
-            if ( i != start )
-            {
-                /* expand into overflow */
-                if ( fmt_idx == LOCAL_FMT_COUNT )
-                {
-                    rc = create_overflow ( overflow, fmt_str,
-                        strp, fmtp, argp, str_idx, fmt_idx, arg_idx );
-                    if ( rc != 0 )
-                        return rc;
-
-                    str = * strp;
-                    fmt = * fmtp;
-                    args = * argp;
-                }
-
-                /* create a text-literal format */
-                memset ( & fmt [ fmt_idx ], 0, sizeof fmt [ 0 ] );
-                fmt [ fmt_idx ] . u . l . text = & fmt_str [ start ];
-                fmt [ fmt_idx ] . u . l . size = i - start;
-                fmt [ fmt_idx ] . fmt = spfText;
-                fmt [ fmt_idx ] . type = sptLiteral;
-
-                /* increment counter */
-                ++ fmt_idx;
-            }
-
-            /* detect escape sequence */
-            if ( fmt_str [ i ] == 0 || fmt_str [ i + 1 ] != '%' )
-                break;
-
-            /* skip over escape */
-            start = ++ i;
-        }
-
-        /* done when NUL byte is seen */
-        if ( fmt_str [ i ] == 0 )
-            break;
-
-        /* detect overflow */
-        if ( fmt_idx == LOCAL_FMT_COUNT )
-        {
-            rc = create_overflow ( overflow, fmt_str,
-                strp, fmtp, argp, str_idx, fmt_idx, arg_idx );
-            if ( rc != 0 )
-                return rc;
-
-            str = * strp;
-            fmt = * fmtp;
-            args = * argp;
-        }
-
-        /* initial format
-         *  thousands_separate    = false
-         *  add_prefix            = false
-         *  force_decimal_point   = false
-         *  leave_trailing_zeros  = false
-         *  print_time            = false
-         *  print_date            = false
-         *  print_weekday         = false
-         *  print_timezone        = false
-         *  hour_24               = false
-         *  sign                  = 0
-         *  left_fill             = space
-         */
-        memset ( & fmt [ fmt_idx ], 0, sizeof fmt [ 0 ] );
-        fmt [ fmt_idx ] . left_fill = ' ';
-
-        /* scan flags */
-        alternate = false;
-        while ( 1 )
-        {
-            switch ( fmt_str [ ++ i ] )
-            {
-                /* plus and space modify application of sign
-                   to signed integer and floating point conversions.
-                   plus overrides space. */
-            case ' ':
-                if ( fmt [ fmt_idx ] . sign == 0 )
-            case '+':
-                    fmt [ fmt_idx ] . sign = fmt_str [ i ];
-                continue;
-
-                /* dash indicates left-alignment. indicate this
-                   by setting "left_fill" to NUL. */
-            case '-':
-                fmt [ fmt_idx ] . left_fill = 0;
-                continue;
-
-                /* zero indicates an alternate left-fill for
-                   numeric conversions. the zero is inserted before
-                   any sign character in { '+', '-' or ' ' }.
-                   since "left_fill" is also used to indicate
-                   alignment, only store when right aligning. */
-            case '0':
-                if ( fmt [ fmt_idx ] . left_fill != 0 )
-                    fmt [ fmt_idx ] . left_fill = '0';
-                continue;
-
-                /* hash indicates that the formatter should use an
-                   "alternate" approach. that approach is specific
-                   to the format. */
-            case '#':
-                alternate = true;
-                continue;
-
-                /* comma ( or apostrophe outside of US ) indicates
-                   that the integer portion of a numeral should use
-                   a comma as a thousands separator for legibility. */
-            case ',':
-            case '\'':
-                fmt [ fmt_idx ] . thousands_separate = 1;
-                continue;
-            }
-
-            /* we've hit a non-flag character */
-            break;
-        }
-
-        /* minimum field width */
-        has_width = false;
-        if ( isdigit ( fmt_str [ i ] ) )
-        {
-            /* literal */
-            has_width = true;
-            fmt [ fmt_idx ] . u . f . min_field_width = fmt_str [ i ] - '0';
-            while ( isdigit ( fmt_str [ ++ i ] ) )
-            {
-                fmt [ fmt_idx ] . u . f . min_field_width *= 10;
-                fmt [ fmt_idx ] . u . f . min_field_width += fmt_str [ i ] - '0';
-            }
-        }
-        else if ( fmt_str [ i ] == '*' )
-        {
-            /* external - we populate the structure directly
-               rather than marking the value as external */
-            has_width = true;
-            fmt [ fmt_idx ] . u . f . min_field_width = va_arg ( vargs, uint32_t );
-            ++ i;
-        }
-
-        /* precision */
-        has_precision = false;
-        if ( fmt_str [ i ] == '.' )
-        {
-            /* a single dot implies a precision value of 0 */
-            has_precision = true;
-
-            if ( isdigit ( fmt_str [ ++ i ] ) )
-            {
-                /* a literal precision */
-                fmt [ fmt_idx ] . u . f . precision = fmt_str [ i ] - '0';
-                while ( isdigit ( fmt_str [ ++ i ] ) )
-                {
-                    fmt [ fmt_idx ] . u . f . precision *= 10;
-                    fmt [ fmt_idx ] . u . f . precision += fmt_str [ i ] - '0';
-                }
-            }
-            else if ( fmt_str [ i ] == '*' )
-            {
-                /* external - again populate directly */
-                fmt [ fmt_idx ] . u . f . precision = va_arg ( vargs, uint32_t );
-                ++ i;
-            }
-            else if ( fmt_str [ i ] == '-' )
-            {
-                /* eat a negative precision - treat as 0 */
-                while ( isdigit ( fmt_str [ ++ i ] ) )
-                    ( void ) 0;
-            }
-        }
-
-        /* index - given when parameter is a vector */
-        has_index = infinite_first = false;
-        if ( fmt_str [ i ] == ':' )
-        {
-            bool has_start, has_len, has_end, end_is_stop;
-            has_start = has_len = has_end = end_is_stop = false;
-
-            /* parameter is taken as a vector,
-               with a default index starting at 0 */
-            has_index = true;
-
-            if ( isdigit ( fmt_str [ ++ i ] ) )
-            {
-                /* literal index */
-                fmt [ fmt_idx ] . u . f . start_idx = fmt_str [ i ] - '0';
-                while ( isdigit ( fmt_str [ ++ i ] ) )
-                {
-                    fmt [ fmt_idx ] . u . f . start_idx *= 10;
-                    fmt [ fmt_idx ] . u . f . start_idx += fmt_str [ i ] - '0';
-                }
-                has_start = true;
-            }
-            else switch ( fmt_str [ i ] )
-            {
-            case '*':
-                /* external index, captured directly */
-                fmt [ fmt_idx ] . u . f . start_idx = va_arg ( vargs, uint32_t );
-                ++ i;
-                has_start = true;
-                break;
-            case '$':
-                ++ i;
-                has_start = infinite_first = true;
-                break;
-            }
-
-            /* detect range */
-            switch ( fmt_str [ i ] )
-            {
-                /* given as start-stop */
-            case '-':
-                end_is_stop = true;
-
-                /* given as start/len */
-            case '/':
-
-                has_len = true;
-
-                if ( isdigit ( fmt_str [ ++ i ] ) )
-                {
-                    /* literal selection length or end */
-                    fmt [ fmt_idx ] . u . f . select_len = fmt_str [ i ] - '0';
-                    while ( isdigit ( fmt_str [ ++ i ] ) )
-                    {
-                        fmt [ fmt_idx ] . u . f . select_len *= 10;
-                        fmt [ fmt_idx ] . u . f . select_len += fmt_str [ i ] - '0';
-                    }
-                    has_end = true;
-                }
-                else switch ( fmt_str [ i ] )
-                {
-                case '*':
-                    /* external selection length or end */
-                    fmt [ fmt_idx ] . u . f . select_len = va_arg ( vargs, uint32_t );
-                    ++ i;
-                    has_end = true;
-                    break;
-                case '$':
-                    ++ i;
-                    end_is_stop = false;
-                    break;
-                case '-':
-                    /* negatives are garbage */
-                    while ( isdigit ( fmt_str [ ++ i ] ) )
-                        ( void ) 0;
-                    break;
-                default:
-                    end_is_stop = false;
-                }
-                break;
-            }
-
-            /* massage values */
-            if ( infinite_first )
-            {
-                /* having an infinite first forces length of 1 */
-                fmt [ fmt_idx ] . u . f . select_len = 1;
-            }
-            else if ( has_len )
-            {
-                /* if either a number or an external value was given */
-                if ( has_end && end_is_stop )
-                {
-                    /* end <= start is translated to length 1 */
-                    if ( fmt [ fmt_idx ] . u . f . select_len <= fmt [ fmt_idx ] . u . f . start_idx )
-                        fmt [ fmt_idx ] . u . f . select_len = 1;
-
-                    /* end > start is translated to stated length */
-                    else
-                        fmt [ fmt_idx ] . u . f . select_len -= fmt [ fmt_idx ] . u . f . start_idx - 1;
-                }
-            }
-            else if ( has_start )
-            {
-                /* with no end specified, selection length is 1 */
-                fmt [ fmt_idx ] . u . f . select_len = 1;
-            }
-        }
-
-        /* size - one of the greatest leg-irons in the C legacy,
-           guess at the parameter size so that va_arg can extract
-           it properly. rather than using predictable parameter sizes,
-           they are fuzzy. we have ( mostly ) kept them for tradition...
-           if no modifier is given, 32-bit is assumed for integer and
-           64-bit for floating point. */
-        size_modifier = time_modifier = 0;
-        switch ( fmt_str [ i ] )
-        {
-            /* "Tiny" modifier - like "hh" in C format */
-        case 't':
-            /* "Half" modifier - same as C format */
-        case 'h':
-            /* "Long" modifier - means 64-bit for integers, otherwise like C */
-        case 'l':
-            size_modifier = time_modifier = fmt_str [ i ++ ];
-            break;
-            /* "siZe" modifier - whatever the size of size_t is */
-        case 'z':
-            ++ i;
-            time_modifier = 'z';
-            if ( sizeof ( size_t ) == sizeof ( uint64_t ) )
-                size_modifier = 'l';
-            break;
-        }
-
-        /* output format
-           describes the formatting to apply on output
-           if precision has not been set, give it a default value */
-        numeric = false;
-        fmt [ fmt_idx ] . pointer_arg = has_index;
-        switch ( fmt_str [ i ] )
-        {
-            /* decimal signed integer */
-        case 'd':
-        case 'i':
-            fmt [ fmt_idx ] . radix = 10;
-            fmt [ fmt_idx ] . fmt = spfSignedInt;
-            numeric = true;
-            if ( ! has_precision )
-                fmt [ fmt_idx ] . u . f . precision = 1;
-            else if ( fmt [ fmt_idx ] . left_fill == '0' )
-                fmt [ fmt_idx ] . left_fill = ' ';
-            break;
-
-            /* decimal unsigned integer */
-        case 'u':
-            fmt [ fmt_idx ] . radix = 10;
-        unsigned_int:
-            fmt [ fmt_idx ] . fmt = spfUnsigned;
-            fmt [ fmt_idx ] . sign = 0;
-            numeric = true;
-            if ( ! has_precision )
-                fmt [ fmt_idx ] . u . f . precision = 1;
-            else if ( fmt [ fmt_idx ] . left_fill == '0' )
-                fmt [ fmt_idx ] . left_fill = ' ';
-            break;
-
-            /* hex unsigned integer */
-        case 'x':
-            fmt [ fmt_idx ] . add_prefix = alternate;
-            fmt [ fmt_idx ] . radix = 16;
-            goto unsigned_int;
-
-            /* upper-case hex unsigned integer or pointer value */
-        case 'X':
-        case 'p':
-            fmt [ fmt_idx ] . upper_case_num = 1;
-            fmt [ fmt_idx ] . add_prefix = alternate;
-            fmt [ fmt_idx ] . radix = 16;
-            goto unsigned_int;
-
-            /* octal unsigned integer */
-        case 'o':
-            fmt [ fmt_idx ] . add_prefix = alternate;
-            fmt [ fmt_idx ] . radix = 8;
-            goto unsigned_int;
-
-            /* binary unsigned integer */
-        case 'b':
-            fmt [ fmt_idx ] . add_prefix = alternate;
-            fmt [ fmt_idx ] . radix = 2;
-            goto unsigned_int;
-
-            /* decimal signed floating point */
-        case 'f':
-            fmt [ fmt_idx ] . fmt = spfStdFloat;
-        fmt_float:
-            fmt [ fmt_idx ] . radix = 10;
-            fmt [ fmt_idx ] . force_decimal_point = alternate;
-            numeric = true;
-            if ( ! has_precision )
-                fmt [ fmt_idx ] . u . f . precision = 6;
-            break;
-
-            /* scientific notation floating point */
-        case 'e':
-            fmt [ fmt_idx ] . fmt = spfSciFloat;
-            goto fmt_float;
-
-            /* "general" floating point */
-        case 'g':
-            fmt [ fmt_idx ] . leave_trailing_zeros = alternate;
-            fmt [ fmt_idx ] . fmt = spfGenFloat;
-            goto fmt_float;
-
-            /* character data */
-        case 's':
-        case 'S':
-            fmt [ fmt_idx ] . pointer_arg = 1;
-            if ( ! has_precision )
-            /* no break */
-        case 'c':
-                fmt [ fmt_idx ] . u . f . precision = -1;
-            fmt [ fmt_idx ] . fmt = spfText;
-            break;
-            
-            /* KSymbol* */
-        case 'N':
-            fmt [ fmt_idx ] . pointer_arg = 1;
-            fmt [ fmt_idx ] . fmt = spfSymbol;
-            break;
-
-            /* ver_t */
-        case 'V':
-            size_modifier = ( sizeof ( ver_t ) == sizeof ( uint32_t ) ) ? 0 : 'l';
-            fmt [ fmt_idx ] . min_vers_components = ! has_precision;
-            fmt [ fmt_idx ] . fmt = spfVersion;
-            break;
-
-            /* rc_t */
-        case 'R':
-            size_modifier = ( sizeof ( rc_t ) == sizeof ( uint32_t ) ) ? 0 : 'l';
-            fmt [ fmt_idx ] . explain_rc = alternate;
-            fmt [ fmt_idx ] . fmt = spfRC;
-            break;
-
-            /* KTime* */
-        case 'T':
-            fmt [ fmt_idx ] . pointer_arg = 1;
-            fmt [ fmt_idx ] . fmt = spfTime;
-            numeric = true;
-
-            /* here, the "size" modifier is interpreted
-               as a selector for the output format. perhaps
-               it could have been a precision thing, but... */
-            switch ( time_modifier )
-            {
-                /* by itself, 'T' implies print the time */
-            case 0:
-                fmt [ fmt_idx ] . print_time = 1;
-                break;
-
-                /* "half" 'T' means the date */
-            case 'h':
-                fmt [ fmt_idx ] . print_date = 1;
-                break;
-
-                /* "zone" 'T' means long date with time zone */
-            case 'z':
-                fmt [ fmt_idx ] . print_timezone = 1;
-                /* no break */
-
-                /* "long" 'T' means date and time */
-            case 'l':
-                fmt [ fmt_idx ] . print_time = 1;
-                fmt [ fmt_idx ] . print_date = 1;
-                fmt [ fmt_idx ] . print_weekday = 1;
-                break;
-            }
-            break;
-
-            /* OS-specific error code:
-               int on Unix-like systems
-               DWORD on Windows */
-        case '!':
-            size_modifier = 0;
-            fmt [ fmt_idx ] . fmt = spfOSErr;
-            break;
-
-#if SUPPORT_PERCENT_N
-            /* awful out parameter giving characters printed so far */
-        case 'n':
-            fmt [ fmt_idx ] . fmt = spfNone;
-            break;
-#endif
-        default:
-            return RC ( rcText, rcString, rcFormatting, rcFormat, rcUnrecognized );
-        }
-
-#if ZERO_PAD_ONLY_NUMBERS
-        /* handle zero padding for non-numeric cases */
-        if ( ! numeric && fmt [ fmt_idx ] . left_fill == '0' )
-            fmt [ fmt_idx ] . left_fill = ' ';
-#endif
-
-        /* argument format */
-        if ( has_index )
-        {
-            /* all arguments MUST be vectors. */
-            args [ arg_idx ] . p = va_arg ( vargs, const void* );
-
-            /* discriminate on vector type */
-            switch ( fmt_str [ i ] )
-            {
-                /* signed integer */
-            case 'd':
-            case 'i':
-            case '!':
-
-                if ( infinite_first )
-                    return RC ( rcText, rcString, rcFormatting, rcIndex, rcIncorrect );
-
-                /* select from 4 possibilities */
-                switch ( size_modifier )
-                {
-                case 0:
-                    fmt [ fmt_idx ] . type = sptSignedInt32Vect;
-                    break;
-                case 'l':
-                    fmt [ fmt_idx ] . type = sptSignedInt64Vect;
-                    break;
-                case 'h':
-                    fmt [ fmt_idx ] . type = sptSignedInt16Vect;
-                    break;
-                case 't':
-                    fmt [ fmt_idx ] . type = sptSignedInt8Vect;
-                    break;
-                }
-                break;
-
-                /* pointer value - cast to 32 or 64-bit unsigned integer */
-            case 'p':
-                size_modifier = ( sizeof ( void* ) == sizeof ( uint64_t ) ) ? 'l' : 0;
-                /* no break */
-
-                /* unsigned integer */
-            case 'u':
-            case 'x':
-            case 'X':
-            case 'o':
-            case 'b':
-            case 'V':
-            case 'R':
-
-                if ( infinite_first )
-                    return RC ( rcText, rcString, rcFormatting, rcIndex, rcIncorrect );
-
-                switch ( size_modifier )
-                {
-                case 0:
-                    fmt [ fmt_idx ] . type = sptUnsignedInt32Vect;
-                    break;
-                case 'l':
-                    fmt [ fmt_idx ] . type = sptUnsignedInt64Vect;
-                    break;
-                case 'h':
-                    fmt [ fmt_idx ] . type = sptUnsignedInt16Vect;
-                    break;
-                case 't':
-                    fmt [ fmt_idx ] . type = sptUnsignedInt8Vect;
-                    break;
-                }
-                break;
-
-                /* floating point */
-            case 'e':
-            case 'f':
-            case 'g':
-
-                if ( infinite_first )
-                    return RC ( rcText, rcString, rcFormatting, rcIndex, rcIncorrect );
-
-                switch ( size_modifier )
-                {
-                case 0:
-                    fmt [ fmt_idx ] . type = sptFloat64Vect;
-                    break;
-                case 'h':
-                    fmt [ fmt_idx ] . type = sptFloat32Vect;
-                    break;
-                case 'l':
-                    fmt [ fmt_idx ] . type = sptFloatLongVect;
-                    break;
-                }
-                break;
-
-                /* character array */
-            case 'c':
-
-                /* can't determine last */
-                if ( infinite_first )
-                    return RC ( rcText, rcString, rcFormatting, rcIndex, rcIncorrect );
-
-                /* length must be bounded */
-                if ( fmt [ fmt_idx ] . u . f . select_len == 0 )
-                    fmt [ fmt_idx ] . u . f . select_len = 1;
-
-                fmt [ fmt_idx ] . type = sptNulTermString;
-                break;
-
-            case 's':
-#if STDC_COMPATIBILITY
-                if ( args [ arg_idx ] . p == NULL ) {
-                    args [ arg_idx ] . p = NULL_STRING_TEXT;
-                }
-#endif
-                /* NUL-terminated string issues */
-                if ( args [ arg_idx ] . p != NULL && infinite_first )
-                {
-                    const char *cp = args [ arg_idx ] . p;
-
-                    /* handle selection of last element */
-                    size_t len = strlen ( cp );
-                    if ( len != 0 )
-                    {
-                        fmt [ fmt_idx ] . u . f . start_idx = len - 1;
-                        fmt [ fmt_idx ] . u . f . select_len = 1;
-                    }
-                }
-
-                fmt [ fmt_idx ] . type = sptNulTermString;
-                break;
-
-                /* character string */
-            case 'S':
-
-                /* if the index starts with last element */
-                if ( args [ arg_idx ] . p != NULL && infinite_first )
-                {
-                    const String *s = args [ arg_idx ] . p;
-                    if ( s -> size != 0 )
-                    {
-                        fmt [ fmt_idx ] . u . f . start_idx = s -> size - 1;
-                        fmt [ fmt_idx ] . u . f . select_len = 1;
-                    }
-                }
-
-                fmt [ fmt_idx ] . type = sptString;
-                break;
-
-                /* no other type supports vectors */
-            default:
-                return RC ( rcText, rcString, rcFormatting, rcFormat, rcIncorrect );
-            }
-        }
-        else
-        {
-            /* scalar or string arguments */
-            switch ( fmt_str [ i ] )
-            {
-                /* signed integer */
-            case 'd':
-            case 'i':
-            case '!':
-                fmt [ fmt_idx ] . type = sptSignedInt;
-                switch ( size_modifier )
-                {
-                case 0:
-                    args [ arg_idx ] . d = va_arg ( vargs, int32_t );
-                    break;
-                case 'l':
-                    args [ arg_idx ] . d = va_arg ( vargs, int64_t );
-                    break;
-#if EMULATE_SMALLINT_EXTENSION_BUG
-                case 'h':
-                case 't':
-                    args [ arg_idx ] . d = va_arg ( vargs, int );
-                    break;
-#else
-                case 'h':
-                    args [ arg_idx ] . d = ( int16_t ) va_arg ( vargs, int );
-                    break;
-                case 't':
-                    args [ arg_idx ] . d = ( int8_t ) va_arg ( vargs, int );
-                    break;
-#endif
-                }
-                break;
-
-                /* pointer cast to uint64_t */
-            case 'p':
-                size_modifier = ( sizeof ( void* ) == sizeof ( uint64_t ) ) ? 'l' : 0;
-                /* no break */
-
-                /* unsigned integer */
-            case 'u':
-            case 'x':
-            case 'X':
-            case 'o':
-            case 'b':
-            case 'V':
-            case 'R':
-                fmt [ fmt_idx ] . type = sptUnsignedInt;
-                switch ( size_modifier )
-                {
-                case 0:
-                    args [ arg_idx ] . u = va_arg ( vargs, uint32_t );
-                    break;
-                case 'l':
-                    args [ arg_idx ] . u = va_arg ( vargs, uint64_t );
-                    break;
-                case 'h':
-                    args [ arg_idx ] . u = ( uint16_t ) va_arg ( vargs, unsigned int );
-                    break;
-                case 't':
-                    args [ arg_idx ] . u = ( uint8_t ) va_arg ( vargs, unsigned int );
-                    break;
-                }
-                break;
-
-                /* floating point */
-            case 'e':
-            case 'f':
-            case 'g':
-                fmt [ fmt_idx ] . type = sptFloat;
-                switch ( size_modifier )
-                {
-                case 0:
-                case 'h':
-                    args [ arg_idx ] . f = va_arg ( vargs, double );
-                    break;
-                case 'l':
-                    args [ arg_idx ] . f = ( double ) va_arg ( vargs, long double );
-                    break;
-                default:
-                    return RC ( rcText, rcString, rcFormatting, rcFormat, rcIncorrect );
-                }
-                break;
-
-                /* single character */
-            case 'c':
-                fmt [ fmt_idx ] . type = sptChar;
-                args [ arg_idx ] . c = va_arg ( vargs, uint32_t );
-                break;
-
-                /* NUL-terminated string */
-            case 's':
-                fmt [ fmt_idx ] . type = sptNulTermString;
-                args [ arg_idx ] . s = va_arg ( vargs, const char* );
-                break;
-
-                /* String object */
-            case 'S':
-                fmt [ fmt_idx ] . type = sptString;
-                args [ arg_idx ] . S = va_arg ( vargs, const String* );
-                break;
-
-                /* KSymbol or KTime object */
-            case 'N':
-            case 'T':
-                fmt [ fmt_idx ] . type = sptPointer;
-                args [ arg_idx ] . p = va_arg ( vargs, const void* );
-                break;
-
-#if SUPPORT_PERCENT_N
-            case 'n':
-                fmt [ fmt_idx ] . type = sptBytesPrinted;
-                args [ arg_idx ] . n = va_arg ( vargs, uint32_t* );
-                break;
-#endif
-            }
-        }
-
-        /* account for format and argument */
-        ++ fmt_idx;
-        ++ arg_idx;
-    }
-
-    /* record final fmt */
-    if ( rc == 0 )
-    {
-        if ( fmt_idx == LOCAL_FMT_COUNT )
-        {
-            rc = create_overflow ( overflow, fmt_str,
-                strp, fmtp, argp, str_idx, fmt_idx, arg_idx );
-            if ( rc != 0 )
-                return rc;
-
-            fmt = * fmtp;
-        }
-
-        memset ( & fmt [ fmt_idx ], 0, sizeof fmt [ 0 ] );
-    }
-
-    return rc;
-}
-
-
-/* KBufferedWrtHandler
- *  combines buffer and possibly NULL handler
- *  handles flushing, counting, etc.
- */
-typedef struct KBufferedWrtHandler KBufferedWrtHandler;
-struct KBufferedWrtHandler
-{
-    const KWrtHandler *handler;
-    char *buff;
-    size_t bsize;
-    size_t cur;
-    size_t flushed;
-    bool overflow;
-};
-
-
-/* flush_buffer
- *  writes data to handler
- *  or NUL-terminates buffer
- */
-static
-rc_t flush_buffer ( KBufferedWrtHandler *out )
-{
-    const KWrtHandler *flush = out -> handler;
-    if ( flush != NULL  && flush -> writer != NULL )
-    {
-        rc_t rc = 0;
-        size_t num_writ, flushed;
-
-/*        assert ( out -> cur != 0 ); */
-
-        for ( flushed = 0; flushed < out -> cur; flushed += num_writ )
-        {
-            rc = ( * flush -> writer ) ( flush -> data,
-                & out -> buff [ flushed ], out -> cur - flushed, & num_writ );
-            if ( rc != 0 )
-                break;
-            if ( num_writ == 0 )
-                break;
-        }
-
-        if ( flushed == 0 )
-            return rc;
-
-        out -> flushed += flushed;
-        if ( flushed < out -> cur )
-            memmove ( out -> buff, & out -> buff [ flushed ], out -> cur - flushed );
-        out -> cur -= flushed;
-
-        return 0;
-    }
-
-    /* NB - header file states that space for NUL byte
-       is REQUIRED, so this test will declare overflow
-       whenever there is not space for the NUL termination */
-    if ( out -> cur >= out -> bsize )
-        out -> overflow = true;
-    else
-        out -> buff [ out -> cur ] = 0;
-
-    return 0;
-}
-
-static
-rc_t write_buffer ( KBufferedWrtHandler *out, const char *data, size_t bytes )
-{
-    size_t total, num_writ;
-    for ( total = 0; total < bytes; out -> cur += num_writ, total += num_writ )
-    {
-        if ( ! out -> overflow && out -> cur == out -> bsize )
-        {
-            rc_t rc = flush_buffer ( out );
-            if ( rc != 0 )
-                return rc;
-        }
-        if ( out -> overflow )
-            num_writ = bytes - total;
-        else
-        {
-            num_writ = out -> bsize - out -> cur;
-            if ( total + num_writ > bytes )
-                num_writ = bytes - total;
-            memcpy ( & out -> buff [ out -> cur ], & data [ total ], num_writ );
-        }
-    }
-    return 0;
-}
-
-
-/* print_padding
- *  issue padding characters
- */
-static
-rc_t print_padding ( KBufferedWrtHandler *out, size_t count, char pad_char )
-{
-    size_t total, num_writ;
-    for ( total = 0; total < count; out -> cur += num_writ, total += num_writ )
-    {
-        if ( ! out -> overflow && out -> cur == out -> bsize )
-        {
-            rc_t rc = flush_buffer ( out );
-            if ( rc != 0 )
-                return rc;
-        }
-        if ( out -> overflow )
-            num_writ = count - total;
-        else
-        {
-            size_t i = out -> cur;
-            size_t lim = out -> cur + count - total;
-            if ( lim > out -> bsize )
-                lim = out -> bsize;
-            for ( num_writ = lim - i; i < lim; ++ i )
-                out -> buff [ i ] = pad_char;
-        }
-    }
-    return 0;
-}
-
-/* print_nul_term_string
- */
-static
-rc_t print_nul_term_string ( KBufferedWrtHandler *out, String *S, size_t precision )
-{
-    size_t total, num_writ;
-    const char *s = S -> addr;
-
-    for ( S -> len = 0, total = 0; total < precision && s [ 0 ] != 0;
-          s += num_writ, out -> cur += num_writ, total += num_writ )
-    {
-        char *buff;
-        size_t lim;
-
-        if ( ! out -> overflow && out -> cur == out -> bsize )
-        {
-            rc_t rc = flush_buffer ( out );
-            if ( rc != 0 )
-                return rc;
-        }
-
-        if ( out -> overflow )
-        {
-            lim = precision - total;
-
-            for ( num_writ = 0; num_writ < lim; ++ num_writ )
-            {
-                if ( s [ num_writ ] == 0 )
-                    break;
-
-                /* count characters as well as bytes */
-                if ( ( s [ num_writ ] & 0xC0 ) != 0x80 )
-                    ++ S -> len;
-            }
-        }
-        else
-        {
-            buff = out -> buff + out -> cur;
-            lim = out -> bsize - out -> cur;
-
-            if ( total + lim > precision )
-                lim = precision - total;
-
-            for ( num_writ = 0; num_writ < lim; ++ num_writ )
-            {
-                if ( s [ num_writ ] == 0 )
-                    break;
-
-                /* count characters as well as bytes */
-                if ( ( ( buff [ num_writ ] = s [ num_writ ] ) & 0xC0 ) != 0x80 )
-                    ++ S -> len;
-            }
-        }
-    }
-
-    S -> size = total;
-
-    return 0;
-}
-
-/* print_string
- */
-static
-rc_t print_string ( KBufferedWrtHandler *out, const String *s, size_t precision )
-{
-    /* TBD - this is only correct for ASCII */
-    if ( s -> size < precision )
-        precision = s -> size;
-
-    return write_buffer ( out, s -> addr, precision );
-}
-
-static
-rc_t print_symbol ( KBufferedWrtHandler *out, const KSymbol *sym )
-{
-    if ( sym -> dad != NULL )
-    {
-        rc_t rc = print_symbol ( out, sym -> dad );
-        if ( rc == 0 )
-            rc = print_padding ( out, 1, ':' );
-        if ( rc != 0 )
-            return rc;
-    }
-    return print_string ( out, & sym -> name, sym -> name . size );
-}
-
-static
-rc_t print_literal ( KBufferedWrtHandler *out, const char *text, size_t size )
-{
-    return write_buffer ( out, text, size );
-}
-
-
-/* structured_print_engine
- *  prints into a buffer
- *  if an output handler is provided, the buffer will be flushed to it as needed
- *  returns the number of BYTES written, but not the number of characters.
- */
-static const char* alnum_set [ 2 ] [ 2 ] =
-{
-    /* "normal" alpha-numeric ordering for rendering numerals */
-    {
-        "0123456789abcdefghijklmnopqrstuvwxyz",
-        "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-    },
-    /* "abnormal" alpha-numeric ordering used by SFF format */
-    {
-        "abcdefghijklmnopqrstuvwxyz0123456789",
-        "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
-    }
-};
-
-static
-rc_t structured_print_engine ( KBufferedWrtHandler *out,
-    const PrintFmt *fmt, const PrintArg *args )
-{
-    rc_t rc;
-    uint32_t fmt_idx, arg_idx;
-
-    /* declare these here to stifle the compiler
-       they should most naturally be declared within the loop,
-       but since they are conditionally initialized by the switch,
-       the compiler warns they may be used before initialization.
-       rather than quiet the complaint within the loop, they have
-       been manually hoisted outside and initialized once. */
-    uint32_t i = 0;
-    int64_t i64 = 0;
-    uint64_t u64 = 0;
-    double f64 = 0;
-    const void *p = NULL;
-
-    /* most of the arguments are going to be pulled into "S" */
-    String S;
-    StringInit ( & S, NULL, 0, 0 );
-
-    /* mark no overflow */
-    out -> overflow = false;
-
-    /* loop across all format structures */
-    for ( rc = 0, out -> cur = out -> flushed = 0, fmt_idx = arg_idx = 0;
-          fmt [ fmt_idx ] . type != sptTerm; ++ fmt_idx )
-    {
-        /* copy entry - we're going to modify it */
-        PrintFmt f = fmt [ fmt_idx ];
-
-        /* ENGINE PARAMETERS */
-
-        /* padding to left side of field */
-        uint32_t left_pad;
-
-        /* sign character if not NUL */
-        char sign_char;
-
-        /* prefix for unsigned int */
-        char prefix [ 4 ];
-        uint32_t prefix_len;
-
-        /* true if performing comma separation */
-        bool comma_sep;
-
-        /* zero-fill, from either integer precision or min-field-width */
-        uint32_t zero_fill;
-
-        /* length of integer portion of numeral, prefix contribution */
-        uint32_t int_len = 0, prefix_contribution;
-
-        /* string index, from index and text precision */
-        bool text_index;
-        uint64_t text_start, text_lim;
-
-        /* END ENGINE PARAMETERS */
-
-        int cvt_len;
-        uint32_t c, *n;
-
-        const KTime *tm;
-        const KSymbol *N;
-
-        char text [ 1024 ];
-        uint32_t dst_len;
-
-        char ffmt [ 16 ];
-        const char *to_numeral, *cfmt;
-
-        /* detect literal */
-        if ( f . type == sptLiteral )
-        {
-            rc = print_literal ( out, f . u . l . text, f . u . l . size );
-            if ( rc != 0 )
-                break;
-
-            continue;
-        }
-
-        /* gather external parameters */
-        if ( f . ext_field_width )
-             f . u . f . min_field_width = args [ arg_idx ++ ] . u;
-        if ( f . ext_precision )
-            f . u . f . precision = args [ arg_idx ++ ] . u;
-        if ( f . ext_start_index )
-            f . u . f . start_idx = args [ arg_idx ++ ] . u;
-        if ( f . ext_select_len )
-            f . u . f . select_len = args [ arg_idx ++ ] . u;
-        else if ( f . ext_stop_index )
-        {
-            f . u . f . select_len = args [ arg_idx ++ ] . u;
-            if ( f . u . f . select_len <= f . u . f . start_idx )
-                f . u . f . select_len = 1;
-            else
-                f . u . f . select_len -= f . u . f . start_idx - 1;
-        }
-
-        /* early initialization */
-        text_index = false;
-        text_start = 0;
-        text_lim = -1;
-
-        /* vector parameters may have NULL pointers under certain
-           circumstances, e.g. pre-calculated format with out-of-bounds
-           index coordinates, when this is detectable. */
-        if ( f . pointer_arg && args [ arg_idx ] . p == NULL )
-        {
-            if ( f . fmt == spfText )
-            {
-                CONST_STRING ( & S, NULL_STRING_TEXT );
-                f . type_cast = 0;
-                f . type = sptString;
-                if ( f . u . f . precision < S . len )
-#if STDC_COMPATIBILITY  &&  !defined(__GLIBC__)
-                    S . size = f . u . f . precision;
-                    S . len = (uint32_t) f . u . f . precision;
-#else
-                    StringInit ( & S, "", 0, 0 );
-#endif                    
-            }
-            else
-            {
-                memset ( & f, 0, sizeof f );
-                f . u . f . precision = 1;
-                f . radix = 10;
-                f . fmt = spfUnsigned;
-                f . type = sptUnsignedInt;
-                u64 = 0;
-            }
-        }
-
-        /* get source */
-        else switch ( f . type )
-        {
-            /* scalar or vector signed integer */
-        case sptSignedInt:
-            i64 = args [ arg_idx ] . d;
-            break;
-        case sptSignedInt8Vect:
-            i64 = args [ arg_idx ] . d8 [ f . u . f . start_idx ];
-            break;
-        case sptSignedInt16Vect:
-            i64 = args [ arg_idx ] . d16 [ f . u . f . start_idx ];
-            break;
-        case sptSignedInt32Vect:
-            i64 = args [ arg_idx ] . d32 [ f . u . f . start_idx ];
-            break;
-        case sptSignedInt64Vect:
-            i64 = args [ arg_idx ] . d64 [ f . u . f . start_idx ];
-            break;
-
-            /* scalar or vector unsigned integer */
-        case sptUnsignedInt:
-            u64 = args [ arg_idx ] . u;
-            break;
-        case sptUnsignedInt8Vect:
-            u64 = args [ arg_idx ] . u8 [ f . u . f . start_idx ];
-            break;
-        case sptUnsignedInt16Vect:
-            u64 = args [ arg_idx ] . u16 [ f . u . f . start_idx ];
-            break;
-        case sptUnsignedInt32Vect:
-            u64 = args [ arg_idx ] . u32 [ f . u . f . start_idx ];
-            break;
-        case sptUnsignedInt64Vect:
-            u64 = args [ arg_idx ] . u64 [ f . u . f . start_idx ];
-            break;
-
-            /* scalar or vector float */
-        case sptFloat:
-            f64 = args [ arg_idx ] . f;
-            break;
-        case sptFloat32Vect:
-            f64 = args [ arg_idx ] . f32 [ f . u . f . start_idx ];
-            break;
-        case sptFloat64Vect:
-            f64 = args [ arg_idx ] . f64 [ f . u . f . start_idx ];
-            break;
-        case sptFloatLongVect:
-            f64 = ( double ) args [ arg_idx ] . flong [ f . u . f . start_idx ];
-            break;
-
-            /* utf-8 character */
-        case sptChar:
-            c = args [ arg_idx ] . c;
-            cvt_len = utf32_utf8 ( text, & text [ sizeof text ], c );
-            if ( cvt_len < 0 )
-            {
-                text [ 0 ] = '?';
-                cvt_len = 1;
-            }
-            StringInit ( & S, text, cvt_len, 1 );
-            break;
-
-            /* NUL-terminated string */
-        case sptNulTermString:
-
-            /* special initialization to flag size/length unknown */
-            StringInit ( & S, args [ arg_idx ] . s, 0, -1 );
-
-            /* IF THE STRING IS INDEXED OR MAY NEED LEFT ALIGNMENT */
-            if ( f . u . f . start_idx != 0 || f . u . f . select_len != 0 ||
-                 ( f . u . f . min_field_width != 0 && f . left_fill ) )
-            {
-                /* precision limits upper bounds
-                   if the index range is more restrictive than precision,
-                   take this as precision for text case */
-                if ( f . u . f . select_len != 0 && f . u . f . select_len < f . u . f . precision )
-                    f . u . f . precision = f . u . f . select_len;
-
-                /* scan to start location */
-                for ( S . len = 0; S . len < f . u . f . start_idx; ++ S . size )
-                {
-                    /* if end of NUL-terminated string is reached before start,
-                       then create EMPTY string */
-                    if ( S . addr [ S . size ] == 0 )
-                    {
-                        f . u . f . start_idx = 0;
-                        f . u . f . select_len = 0;
-                        f . u . f . precision = 0;
-                        break;
-                    }
-                    /* walk across utf-8 multi-byte character */
-                    if ( ( S . addr [ S . size ] & 0xC0 ) != 0x80 )
-                        ++ S . len;
-                }
-
-                /* create sub-string
-                   limit scan to required precision for efficiency */
-                for ( S . addr += S . size, S . size = 0, S . len = 0;
-                      S . len < f . u . f . precision; ++ S . size )
-                {
-                    if ( S . addr [ S . size ] == 0 )
-                        break;
-                    if ( ( S . addr [ S . size ] & 0xC0 ) != 0x80 )
-                        ++ S . len;
-                }
-            }
-
-            /* precision limits text length */
-            if ( text_lim > f . u . f . precision )
-                text_lim = f . u . f . precision;
-
-            break;
-
-            /* String object */
-        case sptString:
-
-            /* the String may be indexed */
-            if ( f . u . f . start_idx != 0 || f . u . f . select_len != 0 )
-            {
-                text_index = true;
-                text_start = f . u . f . start_idx;
-                if ( f . u . f . select_len != 0 )
-                    text_lim = f . u . f . select_len;
-            }
-
-            /* precision limits text length */
-            if ( text_lim > f . u . f . precision )
-                text_lim = f . u . f . precision;
-
-            S = * args [ arg_idx ] . S;
-            if ( S . addr == NULL && S . size == 0 && S . len == 0 )
-                S . addr = "";
-            break;
-
-            /* UCS-2 or UTF-32 String object */
-        case sptUCS2String:
-        case sptUTF32String:
-            return RC ( rcText, rcString, rcConverting, rcType, rcUnsupported );
-
-            /* an object pointer */
-        case sptPointer:
-            p = args [ arg_idx ] . p;
-            break;
-
-        case sptRowId:
-            i64 = args [ arg_idx ] . d;
-            break;
-        case sptRowLen:
-            u64 = args [ arg_idx ] . u;
-            break;
-
-#if SUPPORT_PERCENT_N
-        case sptBytesPrinted:
-            n = args [ arg_idx ] . n;
-            if ( n != NULL )
-                * n = (uint32_t) ( out -> cur + out -> flushed );
-            ++ arg_idx;
-            continue;
-#endif
-        default:
-            return RC ( rcText, rcString, rcConverting, rcType, rcUnrecognized );
-        }
-
-        if ( f . type_cast ) switch ( f . type )
-        {
-        case sptSignedInt:
-        case sptSignedInt8Vect:
-        case sptSignedInt16Vect:
-        case sptSignedInt32Vect:
-        case sptSignedInt64Vect:
-            f64 = (double) i64;
-            break;
-
-        case sptUnsignedInt:
-        case sptUnsignedInt8Vect:
-        case sptUnsignedInt16Vect:
-        case sptUnsignedInt32Vect:
-        case sptUnsignedInt64Vect:
-            f64 = (double) u64;
-            break;
-
-        case sptFloat:
-        case sptFloat32Vect:
-        case sptFloat64Vect:
-        case sptFloatLongVect:
-            i64 = (int64_t) f64;
-            break;
-
-        case sptChar:
-        case sptNulTermString:
-        case sptString:
-            break;
-
-            /* UCS-2 or UTF-32 String object */
-        case sptUCS2String:
-        case sptUTF32String:
-        case sptPointer:
-            return RC ( rcText, rcString, rcConverting, rcType, rcUnsupported );
-
-        case sptRowId:
-            f64 = (double) i64;
-            break;
-        case sptRowLen:
-            f64 = (double) u64;
-            break;
-
-#if SUPPORT_PERCENT_N
-        case sptBytesPrinted:
-            break;
-#endif
-        default:
-            return RC ( rcText, rcString, rcConverting, rcType, rcUnrecognized );
-        }
-
-        /* advance arg count */
-        ++ arg_idx;
-
-        /* initialize engine params */
-        sign_char = 0;
-        comma_sep = false;
-        left_pad = prefix_len = prefix_contribution = zero_fill = 0;
-
-        /* format */
-        switch ( f . fmt )
-        {
-        case spfNone:
-        case spfText:
-            break;
-
-        case spfSignedInt:
-            if ( i64 < 0 )
-            {
-                sign_char = '-';
-                u64 = - i64;
-            }
-            else
-            {
-                sign_char = f . sign;
-                u64 = i64;
-            }
-            f . add_prefix = 0;
-            /* no break */
-        case spfUnsigned:
-            to_numeral = alnum_set [ f . reverse_alnum ] [ f . upper_case_num ];
-
-            if ( f . radix > 36 )
-                f . radix = 10;
-
-            i = sizeof text;
-#if _DEBUGGING
-            text [ -- i ] = 0;
-#endif
-            /* record if we are comma separating below */
-            comma_sep = f . thousands_separate;
-
-#if DOUSE_NUM_PREFIX_IF_ZERO
-            if ( u64 == 0 && f . add_prefix )
-            {
-#if KEEP_OCT_PREFIX_IF_ZERO
-                if ( f . u . f . precision == 0 && f . radix == 8 )
-                    f . u . f . precision = 1;
-#endif
-                f . add_prefix = 0;
-            }
-#endif
-            /* special case for value 0 and precision 0 */
-            if ( u64 != 0 || f . u . f . precision != 0 )
-            {
-                /* convert numeral */
-                do
-                    text [ -- i ] = to_numeral [ u64 % f . radix ];
-                while ( ( u64 /= f . radix ) != 0 );
-
-                /* add prefix to unsigned numeral */
-                if ( f . add_prefix )
-                {
-                    switch ( f . radix )
-                    {
-                    case 2:
-                        memcpy ( prefix, "0b", prefix_len = 2 );
-                        break;
-                    case 8:
-                        memcpy ( prefix, "0", prefix_len = prefix_contribution = 1 );
-#if OCTAL_PREFIX_COUNTS_TOWARD_PRECISION
-                        if ( f . add_prefix && f . u . f . precision != 0 )
-                            -- f . u . f . precision;
-#endif
-                        break;
-                    case 16:
-#if HEX_PREFIX_FOLLOWS_CASE
-                        if ( to_numeral [ 10 ] == 'A' )
-                            memcpy ( prefix, "0X", prefix_len = 2 );
-                        else
-#endif
-                            memcpy ( prefix, "0x", prefix_len = 2 );
-                        break;
-                    }
-                }
-            }
-
-            /* determine length in characters, also size in bytes */
-#if _DEBUGGING
-            int_len = sizeof text - i - 1;
-#else
-            int_len = sizeof text - i;
-#endif
-            /* create text string */
-            StringInit ( & S, & text [ i ], int_len, int_len );
-
-            /* zero-fill amount */
-            if ( f . u . f . precision > ( uint64_t ) int_len )
-                zero_fill = ( uint32_t ) ( f . u . f . precision - ( uint64_t ) int_len );
-            else if ( f . left_fill == '0' )
-            {
-                /* the known characters associated with integer */
-                dst_len = int_len + prefix_len + ( sign_char != 0 );
-                if ( comma_sep && int_len != 0 )
-                    dst_len += ( int_len + prefix_contribution - 1 ) / 3;
-                if ( ( uint64_t ) dst_len < f . u . f . min_field_width )
-                {
-                    /* determine the numeric width, including zero padding */
-                    dst_len = ( uint32_t ) f . u . f . min_field_width -
-                        prefix_len + prefix_contribution - ( sign_char != 0 );
-                    if ( comma_sep && int_len != 0 )
-                    {
-                        /* desired numeric-only portion of field is "dst_len"
-                           it will be extended not only by some number of '0's,
-                           but will be sprinkled with commas.
-
-                           if "x" were our number of numerals, then:
-                             x + ( x - 1 ) / 3 = dst_len
-                           with allowances for integer math. solving for x:
-                             x = ( 3 * dst_len + 3 ) / 4
-
-                           for example: given int_len = 1, value = 0:
-                             dst_len =  1 : x =  1
-                             dst_len =  2 : x =  2
-                             dst_len =  3 : x =  3
-                             dst_len =  4 : x =  3 [ requires special compensation ]
-                             dst_len =  5 : x =  4
-                             dst_len =  6 : x =  5
-                             dst_len =  7 : x =  6
-                             dst_len =  8 : x =  6 [ requires special compensation ]
-                                . . .
-                             dst_len = 19 : x = 15
-                             dst_len = 20 : x = 15
-                             dst_len = 21 : x = 16
-                             dst_len = 22 : x = 17
-                        */
-
-                        /* apply compensation for impossible width */
-                        if ( ( dst_len & 3 ) == 0 )
-                            ++ left_pad;
-
-                        /* dst_len now becomes the number of numerals */
-                        dst_len = ( dst_len * 3 + 3 ) >> 2;
-                    }
-
-                    /* number of zeros to add */
-                    zero_fill = dst_len - int_len;
-                    prefix_len -= prefix_contribution;
-                }
-            }
-
-            break;
-
-            /* TEMPORARY - cheat by calling through to runtime sprintf
-               this needs to be implemented to handle thousands separation */
-        case spfStdFloat:
-            c = 'f';
-        fmt_float:
-            sign_char = f . sign;
-            if ( f64 < 0 )
-            {
-                sign_char = '-';
-                f64 = - f64;
-            }
-
-            ffmt [ i = 0 ] = '%';
-            if ( f . force_decimal_point )
-                ffmt [ ++ i ] = '#';
-            if ( f . u . f . precision > 20 )
-                f . u . f . precision = 20;
-            sprintf ( & ffmt [ ++ i ], ".%u%c"
-                      , ( uint32_t ) f . u . f . precision
-                      , ( char ) c );
-            cvt_len = snprintf ( text, sizeof text, ffmt, f64 );
-            assert ( cvt_len >= 0 && ( size_t ) cvt_len < sizeof text );
-            StringInit ( & S, text, cvt_len, cvt_len );
-
-            /* record if we are comma separating below and capture length of integer portion */
-            int_len = 0;
-            comma_sep = f . thousands_separate;
-            /* if ( comma_sep ) */
-            {
-                for ( ; isdigit ( text [ int_len ] ); ++ int_len )
-                    ( void ) 0;
-            }
-
-            /* zero-fill amount */
-            if ( f . left_fill == '0' )
-            {
-                /* the known characters associated with numeral */
-                dst_len = cvt_len + ( sign_char != 0 );
-                if ( comma_sep && int_len != 0 )
-                    dst_len += ( int_len - 1 ) / 3;
-                if ( ( uint64_t ) dst_len < f . u . f . min_field_width )
-                {
-                    /* determine the integer width, including zero padding */
-                    dst_len = ( uint32_t ) f . u . f . min_field_width -
-                        cvt_len + int_len - ( sign_char != 0 );
-                    if ( comma_sep && int_len != 0 )
-                    {
-                        /* SEE COMMENTS IN INTEGER SECTION */
-
-                        /* apply compensation for impossible width */
-                        if ( ( dst_len & 3 ) == 0 )
-                            ++ left_pad;
-
-                        /* dst_len now becomes the number of numerals */
-                        dst_len = ( dst_len * 3 + 3 ) >> 2;
-                    }
-
-                    /* number of zeros to add */
-                    zero_fill = dst_len - int_len;
-                }
-            }
-            break;
-
-        case spfGenFloat:
-            c = 'g';
-            goto fmt_float;
-
-        case spfSciFloat:
-            c = 'e';
-            goto fmt_float;
-
-            /* version */
-        case spfVersion:
-
-            if ( f . min_vers_components )
-            {
-                if ( ( u64 & 0xFFFF ) != 0 )
-                    f . u . f . precision = 3;
-                else if ( ( u64 & 0xFF0000 ) != 0 )
-                    f . u . f . precision = 2;
-                else
-                    f . u . f . precision = 1;
-            }
-
-            switch ( f . u . f . precision )
-            {
-            case 0:
-                cfmt = "";
-                break;
-            case 1:
-                cfmt = "%u";
-                break;
-            case 2:
-                cfmt = "%u.%u";
-                break;
-            default:
-                cfmt = "%u.%u.%u";
-            }
-
-            dst_len = sprintf ( text, cfmt
-                                , VersionGetMajor ( ( uint32_t ) u64 )
-                                , VersionGetMinor ( ( uint32_t ) u64 )
-                                , VersionGetRelease ( ( uint32_t ) u64 )
-                );
-            StringInit ( & S, text, dst_len, dst_len );
-            f . u . f . precision = dst_len;
-            break;
-
-        case spfSymbol:
-
-            /* calculate total size of symbol */
-            for ( N = p, S = N -> name, N = N -> dad; N != NULL; N = N -> dad )
-            {
-                S . len += N -> name . len + 1;
-                S . size += N -> name . size + 1;
-            }
-
-            /* mark need to recheck format */
-            S . addr = NULL;
-            break;
-
-
-        case spfTime:
-
-            tm = p;
-
-            dst_len = 0;
-            if ( f . print_date )
-            {
-                static char const *months [ 12 ] =
-                    { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
-                if ( f . print_weekday )
-                {
-                    static char const *weekdays [ 7 ] =
-                        { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
-                    dst_len = sprintf ( text, "%s %s %u %u"
-                                        , weekdays [ tm -> weekday ]
-                                        , months [ tm -> month ]
-                                        , tm -> day + 1
-                                        , tm -> year
-                        );
-                }
-                else
-                {
-                    dst_len = sprintf ( text, "%s %u %u"
-                                        , months [ tm -> month ]
-                                        , tm -> day + 1
-                                        , tm -> year
-                        );
-                }
-            }
-
-            if ( f . print_time )
-            {
-                if ( dst_len != 0 )
-                    text [ dst_len ++ ] = ' ';
-
-                if ( f . hour_24 )
-                {
-                    dst_len += sprintf ( & text [ dst_len ]
-                                         , f . left_fill == '0' ? "%02u:%02u:%02u" : "%u:%02u:%02u"
-                                         , tm -> hour
-                                         , tm -> minute
-                                         , tm -> second
-                        );
-                }
-                else
-                {
-                    dst_len += sprintf ( & text [ dst_len ]
-                                         , f . left_fill == '0' ? "%02u:%02u:%02u %cM" : "%u:%02u:%02u %cM"
-                                         , ( tm -> hour + 11 ) % 12 + 1
-                                         , tm -> minute
-                                         , tm -> second
-                                         , ( tm -> hour < 12 ) ? 'A' : 'P'
-                        );
-                }
-
-                if ( f . print_timezone )
-                {
-                    dst_len += sprintf ( & text [ dst_len ]
-                                         , " %+02d"
-                                         , tm -> tzoff / 60
-                        );
-                }
-            }
-
-            StringInit ( & S, text, dst_len, dst_len );
-            break;
-
-        case spfRC:
-            dst_len = (uint32_t) KWrtFmt_rc_t ( text, sizeof text, f . explain_rc ? "#" : "", ( rc_t ) u64 );
-            StringInit ( & S, text, dst_len, dst_len );
-            break;
-
-        case spfOSErr:
-            dst_len = (uint32_t) KWrtFmt_error_code ( text, sizeof text, ( int ) i64 );
-            StringInit ( & S, text, dst_len, dst_len );
-            break;
-
-        default:
-            return RC ( rcText, rcString, rcConverting, rcFormat, rcUnrecognized );
-        }
-
-        /* at this point, we have text in "S".
-           if the text pointer is NULL, it will need to be further processed.
-           if the text size is 0 but the length is not, then we may need to measure string.
-        */
-
-        /* apply index limitation */
-        if ( text_index )
-        {
-            assert ( S . addr != NULL );
-            assert ( S . size != 0 || S . len == 0 );
-            if ( StringSubstr ( & S, & S, ( uint32_t ) text_start, ( uint32_t ) text_lim ) == NULL )
-                StringInit ( & S, "", 0, 0 );
-        }
-
-        /* determine overall width of substitution so far */
-        dst_len = left_pad + ( sign_char != 0 ) + prefix_len + zero_fill + S . len;
-
-        /* if there are comma insertions, get those, too */
-        if ( comma_sep && ( int_len != 0 || zero_fill != 0 ) )
-            dst_len += ( int_len + zero_fill - 1 ) / 3;
-
-        /* calculate remaining left padding */
-        if ( f . left_fill != 0 && f . u . f . min_field_width > dst_len )
-        {
-            assert ( S . size != 0 || S . len == 0 );
-            left_pad += ( uint32_t ) ( f . u . f . min_field_width ) - dst_len;
-            dst_len = ( uint32_t ) f . u . f . min_field_width;
-        }
-
-        /* left padding */
-        if ( left_pad != 0 )
-        {
-            rc = print_padding ( out, left_pad, f . left_fill );
-            if ( rc != 0 )
-                return rc;
-        }
-
-        /* output sign or prefix */
-        if ( sign_char != 0 )
-        {
-            rc = print_padding ( out, 1, sign_char );
-            if ( rc != 0 )
-                return rc;
-        }
-        else if ( prefix_len != 0 )
-        {
-            rc = write_buffer ( out, prefix, prefix_len );
-            if ( rc != 0 )
-                return rc;
-        }
-
-        /* output comma-separated numeral */
-        if ( comma_sep && ( zero_fill != 0 || int_len != 0 ) )
-        {
-            uint32_t pos = zero_fill + int_len;
-            uint32_t chunk = ( pos - 1 ) % 3 + 1;
-
-            for ( i = 0, pos -= chunk; chunk > 0; -- chunk )
-            {
-                if ( zero_fill != 0 )
-                {
-                    rc = print_padding ( out, 1, '0' );
-                    -- zero_fill;
-                }
-                else
-                {
-                    rc = print_padding ( out, 1, S . addr [ i ] );
-                    ++ i;
-                }
-                if ( rc != 0 )
-                    return rc;
-            }
-
-            assert ( pos % 3 == 0 );
-            for ( pos /= 3; pos != 0; -- pos )
-            {
-                rc = print_padding ( out, 1, ',' );
-                if ( rc != 0 )
-                    return rc;
-
-                if ( zero_fill != 0 )
-                {
-                    if ( zero_fill >= 3 )
-                    {
-                        rc = print_padding ( out, 3, '0' );
-                        zero_fill -= 3;
-                    }
-                    else
-                    {
-                        rc = print_padding ( out, zero_fill, '0' );
-                        if ( rc == 0 )
-                            rc = write_buffer ( out, S . addr, 3 - zero_fill );
-                        i += 3 - zero_fill;
-                        zero_fill = 0;
-                    }
-                }
-                else
-                {
-                    rc = write_buffer ( out, & S . addr [ i ], 3 );
-                    i += 3;
-                }
-
-                if ( rc != 0 )
-                    return rc;
-            }
-
-            rc = write_buffer ( out, & S . addr [ i ], S . len - i );
-            if ( rc != 0 )
-                return rc;
-        }
-
-        /* output numeral with zero fill */
-        else if ( zero_fill != 0 )
-        {
-            rc = print_padding ( out, zero_fill, '0' );
-            if ( rc == 0 )
-                rc = print_string ( out, & S, text_lim );
-        }
-
-        /* output NUL-terminated string */
-        else if ( S . size == 0 && S . len != 0 )
-        {
-            assert ( f . left_fill == 0 || f . u . f . min_field_width == 0 );
-            rc = print_nul_term_string ( out, & S, text_lim );
-            dst_len = S . len;
-        }
-
-        /* output KSymbol */
-        else if ( S . addr == NULL )
-        {
-            rc = print_symbol ( out, p );
-        }
-
-        /* output anything else in a String */
-        else
-        {
-            rc = print_string ( out, & S, text_lim );
-        }
-
-        /* recover from error */
-        if ( rc != 0 )
-            return rc;
-
-        /* apply right padding */
-        if ( f . u . f . min_field_width > dst_len )
-        {
-            rc = print_padding ( out, f . u . f . min_field_width - dst_len, ' ' );
-            if ( rc != 0 )
-                return rc;
-        }
-    }
-
-    rc = flush_buffer ( out );
-
-    if ( rc == 0 && out -> overflow )
-        rc = RC ( rcText, rcString, rcConverting, rcBuffer, rcInsufficient );
-
-    return rc;
-}
-
-
-/* structured_printf
- *  uses constant format descriptors and argument block
- *  prints to "out" handler
- */
-LIB_EXPORT rc_t CC structured_printf ( const KWrtHandler *handler,
-    size_t *num_writ, const PrintFmt *fmt, const PrintArg *args )
-{
-    if ( handler != NULL )
-    {
-        rc_t rc;
-        char buff [ 4096 ];
-
-        KBufferedWrtHandler out;
-        out . handler = handler;
-        out . buff = buff;
-        out . bsize = sizeof buff;
-
-        rc = structured_print_engine ( & out, fmt, args );
-
-        if ( num_writ != NULL )
-            * num_writ = out . cur + out . flushed;
-
-        return rc;
-    }
-
-    if ( num_writ != NULL )
-        * num_writ = 0;
-
-    return RC ( rcRuntime, rcString, rcConverting, rcFile, rcNull );
-}
-
-
-/* structured_sprintf
- *  uses constant format descriptors and argument block
- *  prints to UTF-8 character buffer "dst"
- */
-LIB_EXPORT rc_t CC structured_sprintf ( char *dst, size_t bsize,
-    size_t *num_writ, const PrintFmt *fmt, const PrintArg *args )
-{
-    if ( dst != NULL || bsize == 0 )
-    {
-        rc_t rc;
-
-        KBufferedWrtHandler out;
-        out . handler = NULL;
-        out . buff = dst;
-        out . bsize = bsize;
-
-        rc = structured_print_engine ( & out, fmt, args );
-
-        if ( num_writ != NULL )
-            * num_writ = out . cur + out . flushed;
-
-        return rc;
-    }
-
-    if ( num_writ != NULL )
-        * num_writ = 0;
-
-    return RC ( rcRuntime, rcString, rcConverting, rcBuffer, rcNull );
-}
-
-
-/* string_printf
- *  provides a facility similar to snprintf
- *
- *  "dst" [ OUT ] and "bsize" [ IN ] - output buffer for string
- *  will be NUL-terminated if possible
- *
- *  "num_writ" [ OUT, NULL OKAY ] - returns the number of non-NUL bytes
- *  written to "dst" or the required "bsize" to complete successfully,
- *  not including the NUL termination.
- *
- *  "fmt" [ IN ] and "args" [ IN, OPTIONAL ] - data to write
- *
- *  returns 0 if all bytes were successfully written and a NUL-byte was
- *  written into the buffer.
- *
- *  returns rcBuffer, rcInsufficient if the buffer was too small. in this
- *  case, it is possible that the only missing byte would be the NUL
- *  termination, and the output string may still be usable since "num_writ"
- *  indicates the actual number of text bytes.
- */
-LIB_EXPORT rc_t CC new_string_vprintf ( char *dst, size_t bsize,
-    size_t *num_writ, const char *fmt_str, va_list vargs )
-{
-    rc_t rc;
-
-    String str [ 64 ], * strp = str;
-    PrintFmt fmt [ 64 ], * fmtp = fmt;
-    PrintArg args [ 64 ], * argp = args;
-
-    KDataBuffer overflow;
-
-    size_t dummy;
-    if ( num_writ == NULL )
-        num_writ = & dummy;
-
-    * num_writ = 0;
-
-    rc = parse_format_string ( fmt_str, vargs,
-        & strp, & fmtp, & argp, & overflow );
-
-    if ( rc == 0 )
-        rc = structured_sprintf ( dst, bsize, num_writ, fmtp, argp );
-
-    if ( strp != str )
-        KDataBufferWhack ( & overflow );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC new_string_printf ( char *dst, size_t bsize,
-    size_t *num_writ, const char *fmt, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, fmt );
-
-    rc = new_string_vprintf ( dst, bsize, num_writ, fmt, args );
-
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC new_vkfprintf ( const KWrtHandler *out,
-    size_t *num_writ, const char *fmt_str, va_list vargs )
-{
-    rc_t rc;
-
-    String str [ 64 ], * strp = str;
-    PrintFmt fmt [ 64 ], * fmtp = fmt;
-    PrintArg args [ 64 ], * argp = args;
-
-    KDataBuffer overflow;
-
-    size_t dummy;
-    if ( num_writ == NULL )
-        num_writ = & dummy;
-
-    * num_writ = 0;
-
-    rc = parse_format_string ( fmt_str, vargs,
-        & strp, & fmtp, & argp, & overflow );
-
-    if ( rc == 0 )
-        rc = structured_printf ( out, num_writ, fmtp, argp );
-
-    if ( strp != str )
-        KDataBufferWhack ( & overflow );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC new_kfprintf ( const KWrtHandler *out,
-    size_t *num_writ, const char *fmt, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, fmt );
-
-    rc = new_vkfprintf ( out, num_writ, fmt, args );
-        
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KDataBufferVPrintf ( KDataBuffer * buf, const char * fmt, va_list args )
-{
-    rc_t rc;
-
-    if ( buf == NULL )
-        rc = RC ( rcText, rcString, rcFormatting, rcBuffer, rcNull );
-    else if ( fmt == NULL )
-        rc = RC ( rcText, rcString, rcFormatting, rcParam, rcNull );
-    else if ( fmt [ 0 ] == 0 )
-        rc = RC ( rcText, rcString, rcFormatting, rcParam, rcEmpty );
-    else
-    {
-        size_t bsize;
-        char *buffer;
-        size_t content;
-        size_t num_writ;
-
-        /* the C library ruins a va_list upon use
-           in case we ever need to use it a second time,
-           make a copy first */
-        va_list args_copy;
-        va_copy ( args_copy, args );
-
-        /* begin to calculate content and bsize */
-        content = ( size_t ) buf -> elem_count;
-
-        /* check for an empty buffer */
-        if ( content == 0 )
-        {
-            /* detect buffers initialized by memset */
-            if ( buf -> elem_bits == 0 )
-                buf -> elem_bits = 8;
-
-            rc = KDataBufferResize ( buf, bsize = 4096 );
-            if ( rc != 0 )
-                return rc;
-        }
-        else
-        {
-            /* generate even multiple of 4K */
-            bsize = ( content + 4095 ) & ~ ( size_t ) 4095;
-
-            /* discount NUL byte */
-            content -= 1;
-        }
-            
-        /* convert the 2-part url into a flat string */
-        buffer = buf -> base;
-        rc = string_vprintf ( &buffer [ content ], bsize - content, & num_writ, fmt, args );
-        /* Make sure there is enough room to store data including NUL */
-        if ( rc != 0 || ( content + num_writ ) == bsize )
-        {
-            bsize = ( content + num_writ + 4095 + 1 ) & ~ ( size_t ) 4095;
-            rc = KDataBufferResize ( buf, bsize );
-            if ( rc == 0 )
-            {
-                /* try again with the newly sized buffer */
-                rc = string_vprintf ( &buffer [ content ], bsize - content, & num_writ, fmt, args_copy );
-            }
-        }
-        va_end ( args_copy );
-    
-        /* size down to bsize + NUL */
-        if ( rc == 0 )
-            KDataBufferResize ( buf, content + num_writ + 1 );
-    }
-
-    return rc;
-}
-
-/* forward to KDataBufferVPrintf */
-LIB_EXPORT rc_t CC KDataBufferPrintf ( KDataBuffer * buf, const char * fmt, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, fmt );
-    rc = KDataBufferVPrintf ( buf, fmt, args );
-    va_end ( args );
-
-    return rc;
-}
diff --git a/libs/klib/ptpersist.c b/libs/klib/ptpersist.c
deleted file mode 100644
index 927732a..0000000
--- a/libs/klib/ptpersist.c
+++ /dev/null
@@ -1,1099 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include "trie-priv.h"
-#include "pbstree-priv.h"
-#include <klib/container.h>
-#include <klib/sort.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <assert.h>
-
-#if _DEBUGGING
-#define DEBUGPRINT 0
-#endif
-
-/*--------------------------------------------------------------------------
- * private declarations
- */
-typedef struct IdxMap IdxMap;
-struct IdxMap
-{
-    uint32_t freq;
-    uint32_t idx;
-    uint32_t ch;
-};
-
-static
-int CC IdxMapSort ( const void *left, const void *right, void *ignore )
-{
-#define a ( ( const IdxMap* ) left )
-#define b ( ( const IdxMap* ) right )
-
-    if ( b -> freq != a -> freq )
-        return ( int ) b -> freq - ( int ) a -> freq;
-    return ( int ) a -> idx - ( int ) b -> idx;
-
-#undef a
-#undef b
-}
-
-typedef struct PTChildNode PTChildNode;
-struct PTChildNode
-{
-    SLNode n;
-    const TTrans *trans;
-    uint32_t dad;
-    uint16_t idx;
-};
-
-static
-void CC PTChildNodeWhack ( SLNode *n, void *ignore )
-{
-    free ( n );
-}
-
-typedef struct PTriePersistData PTriePersistData;
-struct PTriePersistData
-{
-    PTWriteFunc write;
-    void *write_param;
-
-    PTAuxFunc aux;
-    void *aux_param;
-
-    PTAuxFunc null_write;
-    PTAuxFunc live_write;
-
-    IdxMap *idx_map;
-    size_t *trans_map;
-
-    void ( CC * record_idx ) ( void*, uint32_t, uint32_t );
-    void ( CC * record_trans ) ( void*, uint32_t, uint32_t );
-
-    union
-    {
-        uint8_t *v8;
-        uint16_t *v16;
-        uint32_t *v32;
-
-    } idx_seq;
-
-    uint8_t *child_seq_type;
-
-    union
-    {
-        uint8_t *v8;
-        uint16_t *v16;
-        uint32_t *v32;
-
-    } backtrace;
-
-    union
-    {
-        uint8_t *v8;
-        uint16_t *v16;
-        uint32_t *v32;
-
-    } trans_seq;
-
-    size_t data_size;
-
-    uint32_t num_nodes;
-    uint32_t max_nodes;
-
-    uint32_t num_trans;
-    uint32_t trans_id;
-    uint32_t child_id;
-
-    uint32_t min_width;
-    uint32_t depth;
-
-    rc_t rc;
-
-    uint8_t idx_size;
-    uint8_t trans_size;
-    uint8_t off_size;
-};
-
-static
-rc_t CC PTAlign ( PTriePersistData *pb, size_t *offset,
-    uint32_t size, uint32_t first_byte )
-{
-    rc_t rc;
-
-    union
-    {
-        uint8_t u8 [ 4 ];
-        uint32_t u32;
-    } u;
-    size_t to_write, num_writ;
-
-    int align = (int)( offset [ 0 ] & ( size - 1 ) );
-    if ( align == 0 )
-        return 0;
-
-#if DEBUGPRINT
-    fprintf(stderr, "PTAlign called.\n");
-#endif
-
-
-    to_write = size - align;
-
-    u . u32 = 0;
-    u . u8 [ 0 ] = ( uint8_t ) first_byte;
-
-    num_writ = 0;
-    rc = ( * pb -> write ) ( pb -> write_param, u . u8, to_write, & num_writ );
-
-    * offset += num_writ;
-
-    if ( rc != 0 )
-        return rc;
-    if ( num_writ != to_write )
-        return RC ( rcCont, rcTrie, rcPersisting, rcTransfer, rcIncomplete );
-    return 0;
-}
-
-static
-rc_t CC TNodeDataSize ( void *param, const void *n, size_t *num_writ,
-    PTWriteFunc write, void *write_param )
-{
-    PTriePersistData *pb = param;
-    rc_t rc = ( * pb -> aux ) ( pb -> aux_param, n, num_writ, write, write_param );
-    if ( rc == 0 )
-    {
-        String str;
-        const TNode *keynode = n;
-        if ( StringSubstr ( & keynode -> key, & str, pb -> depth, 0 ) == NULL )
-            * num_writ += 1;
-        else
-            * num_writ += str . size + 1;
-    }
-    return rc;
-}
-
-static
-rc_t CC TNodeWrite ( void *param, const void *n, size_t *num_writ,
-    PTWriteFunc write, void *write_param )
-{
-    PTriePersistData *pb = param;
-    const TNode *keynode = n;
-
-    rc_t rc;
-    String str;
-
-#if DEBUGPRINT
-    fprintf(stderr, "TNodeWrite called.\n");
-#endif
-
-
-    if ( write == NULL )
-        return TNodeDataSize ( param, n, num_writ, write, write_param );
-
-    /* TBD - find out why string is written with pb->write and NUL is written with write
-       they should be the same, and so the entire NUL terminated string should be done at once */
-    if ( StringSubstr ( & keynode -> key, & str, pb -> depth, 0 ) != NULL )
-        rc = ( * pb -> write ) ( pb -> write_param, str . addr, str . size, num_writ );
-    else
-    {
-        rc = 0;
-        * num_writ = 0;
-    }
-    if ( rc == 0 )
-    {
-        size_t writ;
-        char term [ 1 ];
-
-        term [ 0 ] = 0;
-        rc = ( * write ) ( write_param, term, 1, & writ );
-        if ( rc == 0 )
-        {
-            * num_writ += writ;
-            if ( writ != 1 )
-                return -1; /*AK: TODO is it correct?*/
-
-            writ = 0;
-            rc = ( * pb -> aux ) ( pb -> aux_param, n, & writ, write, write_param );
-            * num_writ += writ;
-        }
-    }
-
-    return rc;
-}
-
-static
-rc_t CC NullWrite ( void *param, const void *buffer, size_t bytes, size_t *num_writ )
-{
-    * num_writ = bytes;
-    return 0;
-}
-
-
-/*--------------------------------------------------------------------------
- * TTrans
- */
-static
-void CC TTransCountNodes ( BSTNode *n, void *data )
-{
-    /* count node */
-    ++ ( * ( uint32_t* ) data );
-}
-
-static
-void CC TTransCountTrans ( const TTransBacktrace *bt, uint32_t width, void *data )
-{
-    PTriePersistData *pb = data;
-    const TTrans *trans = bt -> trans;
-
-    /* count transition node */
-    ++ pb -> num_trans;
-
-    /* count value nodes */
-    if ( trans -> vals . root != NULL )
-    {
-        uint32_t num_nodes = 0;
-        BSTreeForEach ( & trans -> vals, 0, TTransCountNodes, & num_nodes );
-
-        /* accumulate into overall counter */
-        pb -> num_nodes += num_nodes;
-
-        /* record max */
-        if ( num_nodes > pb -> max_nodes )
-            pb -> max_nodes = num_nodes;
-    }
-
-    /* analyze child transition array and character set */
-    if ( trans -> child != NULL )
-    {
-        uint32_t i;
-        for ( i = 0; i < width; ++ i )
-        {
-            if ( trans -> child [ i ] != NULL )
-                ++ pb -> idx_map [ i ] . freq;
-        }
-    }
-}
-
-static
-void CC TTransRecordU8 ( void *buffer, uint32_t idx, uint32_t val )
-{
-    ( ( uint8_t* ) buffer ) [ idx ] = ( uint8_t ) val;
-}
-
-static
-void CC TTransRecordU16 ( void *buffer, uint32_t idx, uint32_t val )
-{
-    ( ( uint16_t* ) buffer ) [ idx ] = ( uint16_t ) val;
-}
-
-static
-void CC TTransRecordU32 ( void *buffer, uint32_t idx, uint32_t val )
-{
-    ( ( uint32_t* ) buffer ) [ idx ] = ( uint32_t ) val;
-}
-
-static
-bool CC TTransPersist1 ( const TTrans *trans, PTriePersistData *pb,
-    uint32_t tid, uint32_t dad, uint16_t idx, SLList *sl,
-    uint32_t *icntp, uint32_t *slenp, uint32_t *tcntp )
-{
-    uint32_t icnt, slen, tcnt;
-
-    void ( CC * record_idx ) ( void*, uint32_t, uint32_t ) = pb -> record_idx;
-    void ( CC * record_trans ) ( void*, uint32_t, uint32_t ) = pb -> record_trans;
-
-#if DEBUGPRINT
-    fprintf(stderr, "TTransPersist1 called.\n");
-#endif
-
-
-    /* set up header */
-#if RECORD_HDR_IDX
-#if DEBUGPRINT
-    fprintf(stderr, "Recording header index %d, %d\n", pttHdrIdx, idx);
-#endif
-    /* zero-based character code of transition */
-    ( * record_idx ) ( pb -> idx_seq . v8, pttHdrIdx, idx );
-#endif
-#if RECORD_HDR_DEPTH
-#if DEBUGPRINT
-    fprintf(stderr, "Recording header depth %d, %d\n", pttHdrDepth, trans->depth);
-#endif
-    /* node depth */
-    ( * record_idx ) ( pb -> idx_seq . v8, pttHdrDepth, trans -> depth );
-#endif
-    /* the number of transitions; in child array or in vals btree */
-    ( * record_idx ) ( pb -> idx_seq . v8, pttHdrTransCnt, trans -> tcnt );
-
-    /* record one-based parent backtrace */
-    if ( pb -> backtrace . v8 != NULL )
-        ( * record_trans ) ( pb -> backtrace . v8, 0, dad );
-
-    /* record child transition table */
-    if ( trans -> child == NULL )
-    {
-        /* no sequence or indices beyond header */
-        icnt = slen = tcnt = 0;
-        ( * record_idx ) ( pb -> idx_seq . v8, pttHdrIdxCnt, 0 );
-    }
-    else
-    {
-        uint32_t i;
-
-        /* set all index entries to simple type
-           the working array is large enough to hold
-           one bit per character code */
-        memset ( pb -> child_seq_type, 0, ( pb -> min_width + 7 ) >> 3 );
-
-        /* walk child array:
-           i    => zero-based character code and
-                   indirect index into trans.child
-           tcnt => persisted child index and counter
-           icnt => idx index and counter
-           slen => child_seq_type index and counter */
-        for ( tcnt = icnt = slen = i = 0; i < pb -> min_width; ++ i )
-        {
-            PTChildNode *n;
-
-            /* look only at valid transitions
-               notice that i, which represents the new character code,
-               is first mapped to an old character code */
-            if ( trans -> child [ pb -> idx_map [ i ] . idx ] != NULL )
-            {
-                /* record trans into child slot and allocate id */
-                ( * record_trans ) ( pb -> trans_seq . v8, tcnt ++, ++ pb -> child_id );
-
-                /* record index, either single or lower part of pair
-                   index value is the new character code for transition */
-                ( * record_idx ) ( pb -> idx_seq . v8, ++ icnt + pttLastHdr, i );
-
-                /* create a node for next trans to visit */
-                n = malloc ( sizeof * n );
-                if ( n == NULL )
-                    return true;
-                n -> trans = trans -> child [ pb -> idx_map [ i ] . idx ];
-                n -> dad = tid;
-                n -> idx = i;
-                SLListPushTail ( sl, & n -> n );
-
-                /* determine type
-                   notice that "i" is incremented, even though it will be
-                   incremented by for loop. the effect of doing so, as well
-                   as the effect of the following compound statement, is to
-                   leave "i" such that child [ i ] is NULL, in which case
-                   we're going to skip it anyway */
-                if ( ++ i < pb -> min_width &&
-                     trans -> child [ pb -> idx_map [ i ] . idx ] != NULL )
-                {
-                    /* it's a range */
-                    pb -> child_seq_type [ slen >> 3 ] |=
-                        ( uint8_t ) ( 1U << ( slen & 7 ) );
-
-                    /* record each trans, allocating a new child id */
-                    ( * record_trans ) ( pb -> trans_seq . v8, tcnt ++, ++ pb -> child_id );
-                    n = malloc ( sizeof * n );
-                    if ( n == NULL )
-                        return true;
-                    n -> trans = trans -> child [ pb -> idx_map [ i ] . idx ];
-                    n -> dad = tid;
-                    n -> idx = i;
-                    SLListPushTail ( sl, & n -> n );
-
-                    /* continue until end */
-                    for ( ++ i; i < pb -> min_width; ++ i )
-                    {
-                        /* detect end of range */
-                        if ( trans -> child [ pb -> idx_map [ i ] . idx ] == NULL )
-                            break;
-                        ( * record_trans ) ( pb -> trans_seq . v8, tcnt ++, ++ pb -> child_id );
-                        n = malloc ( sizeof * n );
-                        if ( n == NULL )
-                            return true;
-                        n -> trans = trans -> child [ pb -> idx_map [ i ] . idx ];
-                        n -> dad = tid;
-                        n -> idx = i;
-                        SLListPushTail ( sl, & n -> n );
-                    }
-
-                    /* i is one beyond end of index range, but
-                       we store the range as fully closed */
-                    ( * record_idx ) ( pb -> idx_seq . v8, ++ icnt + pttLastHdr, i - 1 );
-                }
-
-                /* count the index sequence bit */
-                ++ slen;
-            }
-        }
-
-        /* complete the header for the case where child array was present */
-        ( * record_idx ) ( pb -> idx_seq . v8, pttHdrIdxCnt, icnt );
-        ( * record_idx ) ( pb -> idx_seq . v8, pttHdrSeqLen, slen );
-        ( * record_idx ) ( pb -> idx_seq . v8, pttHdrChildCnt, tcnt );
-    }
-
-    * icntp = icnt;
-    * slenp = slen;
-    * tcntp = tcnt;
-
-    return false;
-}
-
-static
-bool CC TTransPersist ( const TTrans *trans, PTriePersistData *pb,
-     uint32_t dad, uint16_t idx, SLList *sl )
-{
-    uint32_t ztid;
-    uint32_t icnt, slen, tcnt;
-    size_t to_write, num_writ, entry_size;
-
-#if DEBUGPRINT
-    fprintf(stderr, "TTransPersist called.\n");
-#endif
-
-
-    /* grab my zero-based trans id */
-    ztid = pb -> trans_id ++;
-    assert ( ztid < pb -> num_trans );
-
-    /* grab entry size */
-    entry_size = pb -> data_size;
-
-    /* assign initial size as zero */
-    pb -> trans_map [ ztid ] = 0;
-
-    /* populate tables and record child iteration nodes */
-    if ( TTransPersist1 ( trans, pb, ztid + 1, dad, idx, sl, & icnt, & slen, & tcnt ) )
-        return true;
-
-    /* write TTrans header data */
-    if ( icnt == 0 )
-    {
-        /* simple header for TTrans with no child array */
-        to_write = pttHdrNullEnd * pb -> idx_size;
-        pb -> rc = ( * pb -> write ) ( pb -> write_param,
-            pb -> idx_seq . v8, to_write, & num_writ );
-
-        /* write parent backtrace if needed */
-        if ( pb -> backtrace . v8 != NULL && pb -> rc == 0 && num_writ == to_write )
-        {
-            pb -> data_size += num_writ;
-            pb -> rc = PTAlign ( pb, & pb -> data_size, pb -> trans_size, 0 );
-            if ( pb -> rc == 0 )
-            {
-                to_write = pb -> trans_size;
-                pb -> rc = ( * pb -> write ) ( pb -> write_param,
-                    pb -> backtrace . v8, to_write, & num_writ );
-            }
-        }
-    }
-    else
-    {
-        /* write index array */
-        to_write = ( icnt + pttFirstIdx ) * pb -> idx_size;
-        pb -> rc = ( * pb -> write ) ( pb -> write_param,
-            pb -> idx_seq . v8, to_write, & num_writ );
-
-        /* proceed if no error and completely written
-           the incomplete write will be detected below */
-        if ( pb -> rc == 0 && num_writ == to_write )
-        {
-            pb -> data_size += num_writ;
-
-            /* write index type array */
-            assert ( slen != 0 );
-            to_write = ( slen + 7 ) >> 3;
-            pb -> rc = ( * pb -> write ) ( pb -> write_param,
-                pb -> child_seq_type, to_write, & num_writ );
-            if ( pb -> rc == 0 && num_writ == to_write )
-            {
-                /* align for transition size */
-                pb -> data_size += num_writ;
-                pb -> rc = PTAlign ( pb, & pb -> data_size, pb -> trans_size, 0 );
-                if ( pb -> rc == 0 )
-                {
-                    /* write parent backtrace if needed */
-                    if ( pb -> backtrace . v8 != NULL )
-                    {
-                        to_write = pb -> trans_size;
-                        pb -> rc = ( * pb -> write ) ( pb -> write_param,
-                            pb -> backtrace . v8, to_write, & num_writ );
-                        if ( pb -> rc != 0 )
-                            return true;
-                        if ( num_writ != to_write )
-                        {
-                            pb -> rc = RC ( rcCont, rcTrie, rcPersisting, rcTransfer, rcIncomplete );
-                            return true;
-                        }
-
-                        pb -> data_size += num_writ;
-                    }
-
-                    /* write transition array */
-                    to_write = tcnt * pb -> trans_size;
-                    pb -> rc = ( * pb -> write ) ( pb -> write_param,
-                        pb -> trans_seq . v8, to_write, & num_writ );
-                }
-            }
-        }
-    }
-
-    if ( pb -> rc != 0 )
-        return true;
-
-    pb -> data_size += num_writ;
-    if ( num_writ != to_write )
-    {
-        pb -> rc = RC ( rcCont, rcTrie, rcPersisting, rcTransfer, rcIncomplete );
-        return true;
-    }
-
-    /* record trans' depth for internal key storage */
-    pb -> depth = trans -> depth;
-
-    /* detect need to align for data */
-    if ( ( pb -> data_size & 3 ) != 0 )
-    {
-        /* may be able to bail before writing b-tree */
-        if ( trans -> vals . root == NULL )
-        {
-            pb -> rc = PTAlign ( pb, & pb -> data_size, 4, 0 );
-            if ( pb -> rc != 0 )
-                return true;
-
-            /* record the size */
-            pb -> trans_map [ ztid ] = pb -> data_size - entry_size;
-            return false;
-        }
-
-        /* perform alignment */
-        pb -> rc = PTAlign ( pb, & pb -> data_size, 4, 1 );
-        if ( pb -> rc != 0 )
-            return true;
-    }
-
-    /* detect fake pass */
-    if ( pb -> write == NullWrite )
-    {
-        /* gather sizes */
-        pb -> rc = BSTreePersist ( & trans -> vals, & num_writ,
-            NULL, NULL, pb -> null_write, pb );
-    }
-    else
-    {
-        /* write BSTree for values */
-        pb -> rc = BSTreePersist ( & trans -> vals, & num_writ,
-            pb -> write, pb -> write_param, pb -> live_write, pb );
-    }
-
-    pb -> data_size += num_writ;
-
-    /* align3 */
-    if ( pb -> rc == 0 )
-        pb -> rc = PTAlign ( pb, & pb -> data_size, 4, 0 );
-
-    if ( pb -> rc != 0 )
-        return true;
-
-    pb -> trans_map [ ztid ] = pb -> data_size - entry_size;
-    return false;
-}
-
-/* TTransPIterate
- *  walks TTrans nodes in a predictive order
- *  using a queue
- */
-static
-bool CC TTransPIterate ( const TTrans *self, PTriePersistData *pb )
-{
-    PTChildNode *n;
-
-    SLList sl;
-    SLListInit ( & sl );
-
-#if DEBUGPRINT
-    fprintf(stderr, "TTransPIterate called.\n");
-#endif
-
-
-    pb -> trans_id = pb -> child_id = 0;
-
-    /* prime list with root node */
-    n = malloc ( sizeof * n );
-    if ( n == NULL )
-        return true;
-
-    n -> trans = self;
-    n -> dad = 0;
-    n -> idx = 0;
-
-    /* now walk the list */
-    for ( ; n != NULL; n = ( PTChildNode* ) SLListPopHead ( & sl ) )
-    {
-        const TTrans *trans = n -> trans;
-        uint32_t dad = n -> dad;
-        uint16_t idx = n -> idx;
-
-        free ( n );
-
-        if ( TTransPersist ( trans, pb, dad, idx, & sl ) )
-        {
-            SLListWhack ( & sl, PTChildNodeWhack, NULL );
-            return true;
-        }
-    }
-
-    return false;
-}
-
-
-/*--------------------------------------------------------------------------
- * Trie
- */
-
-/* TriePersist
- *  much like BSTreePersist but operates on a Trie
- *
- *  "num_writ" [ OUT, NULL OKAY ] -  returns parameter for the number
- *  of bytes written as a result of persisting the b-tree. this will
- *  be the actual bytes written regardless of return status.
- *
- *  "ext_keys" [ IN ] - if true, does not store key data internally.
- *  key text gets encoded into the tree structure in all cases. when
- *  stored internally, any key text not represented by the tree will
- *  be explicitly written by this function. otherwise, the caller will
- *  be expected to store the text as desired. while internal storage
- *  will probably be more efficient, it will cause this function to
- *  fail if the Trie was built with ambiguous key transitions, i.e.
- *  if initialized with "cs_expand" false and keys were added having
- *  characters not included within the "accept" character set. this
- *  is because the tree channels all unrecognized characters through
- *  a single code, making their recovery impossible without being
- *  stored externally.
- *
- *  "write" [ IN, NULL OKAY ] and "write_param" [ IN ] -  a generic
- *  output streaming function used for all operations. if NULL, then
- *  the function will exit after its first pass with the number of
- *  bytes required in "num_writ".
- *
- *  "aux" [ IN ] and "aux_param" [ IN ] - a specialized function for
- *  streaming auxiliary node data to output using the supplied "write"
- *  function. it is invoked during the first pass with a NULL write
- *  function for gathering size data, and during the third pass with
- *  a non-NULL write function.
- */
-static
-rc_t CC TriePersist0 ( size_t *num_writ, int ext_keys,
-   PTWriteFunc write, void *write_param )
-{
-    rc_t rc;
-    P_Trie ptt;
-
-    assert ( num_writ != NULL );
-
-#if DEBUGPRINT
-    fprintf( stderr, "TriePersist0 called.\n" );
-#endif
-
-    ptt . num_trans = 0;
-    ptt . num_nodes = 0;
-    ptt . data_size = 0;
-    ptt . keys = 0;
-    ptt . width = 0;
-
-    P_TrieSetExtKeys ( ptt . keys, ext_keys );
-    P_TrieSetBacktrace ( ptt . keys, ! ext_keys );
-
-    rc = ( * write ) ( write_param, & ptt, 16, num_writ );
-    if ( rc == 0 && * num_writ != 16 )
-        return RC ( rcCont, rcTrie, rcPersisting, rcTransfer, rcIncomplete );
-    return rc;
-}
-
-static
-void CC TriePersist1 ( const Trie *tt, PTriePersistData *pb )
-{
-    uint16_t i;
-
-    assert ( tt != NULL );
-    assert ( pb != NULL );
-    assert ( tt -> root != NULL );
-    assert ( pb -> idx_map != NULL );
-
-#if DEBUGPRINT
-    fprintf(stderr, "TriePersist1 called.\n");
-#endif
-
-    /* initialize statistics */
-    for ( i = 0; i < tt -> width; ++ i )
-    {
-        pb -> idx_map [ i ] . freq = 0;
-        pb -> idx_map [ i ] . idx = i;
-        pb -> idx_map [ i ] . ch = tt -> rmap [ i ];
-    }
-
-    /* count nodes and transition frequencies */
-    pb -> num_trans = 0;
-    pb -> num_nodes = 0;
-    pb -> max_nodes = 0;
-    TTransForEach ( tt -> root, tt -> width, TTransCountTrans, pb );
-
-    /* rearrange the indices by frequency */
-    ksort ( pb -> idx_map, tt -> width, sizeof pb -> idx_map [ 0 ], IdxMapSort, NULL );
-
-    /* determine real charset width by searching for
-       the first slot with zero transitions */
-    for ( i = 0; i < tt -> width; ++ i )
-    {
-        if ( pb -> idx_map [ i ] . freq == 0 )
-            break;
-    }
-    pb -> min_width = i;
-
-    /* translate character set width and node count */
-    if ( pb -> min_width <= 256 )
-    {
-        pb -> record_idx = TTransRecordU8;
-        pb -> idx_size = 1;
-    }
-    else if ( pb -> min_width <= 65536 )
-    {
-        pb -> record_idx = TTransRecordU16;
-        pb -> idx_size = 2;
-    }
-    else
-    {
-        pb -> record_idx = TTransRecordU32;
-        pb -> idx_size = 4;
-    }
-
-    if ( pb -> num_trans <= 256 )
-    {
-        pb -> record_trans = TTransRecordU8;
-        pb -> trans_size = 1;
-    }
-    else if ( pb -> num_trans <= 65536 )
-    {
-        pb -> record_trans = TTransRecordU16;
-        pb -> trans_size = 2;
-    }
-    else
-    {
-        pb -> record_trans = TTransRecordU32;
-        pb -> trans_size = 4;
-    }
-}
-
-static
-rc_t CC TriePersist2 ( const Trie *tt, PTriePersistData *pb )
-{
-    assert ( tt != NULL );
-    assert ( pb != NULL );
-    assert ( pb -> write == NullWrite );
-
-#if DEBUGPRINT
-    fprintf(stderr, "TriePersist2 called.\n");
-#endif
-
-    pb -> trans_id = 0;
-    pb -> data_size = 0;
-    TTransPIterate ( tt -> root, pb );
-    if ( pb -> rc == 0 )
-    {
-        /* we should have visited every TTrans node */
-        assert ( pb -> trans_id == pb -> num_trans );
-
-        /* size of trans offset array slot
-           since the persisted TTrans objects
-           are 4-byte aligned, we may be able to
-           get some savings */
-        if ( pb -> data_size <= 256 * 4 )
-            pb -> off_size = 1;
-        else if ( pb -> data_size <= 65536 * 4 )
-            pb -> off_size = 2;
-        else
-            pb -> off_size = 4;
-    }
-
-    return pb -> rc;
-}
-
-static
-rc_t CC TriePersist3 ( const Trie *tt, PTriePersistData *pb, int ext_keys,
-    PTWriteFunc write, void *write_param, size_t *num_writ )
-{
-    P_Trie *pt;
-    size_t trans_offset;
-
-#if DEBUGPRINT
-    fprintf(stderr, "TriePersist3 called.\n");
-#endif
-
-    assert ( tt != NULL );
-    assert ( pb != NULL );
-    assert ( write != NULL );
-    assert ( num_writ != NULL );
-
-    /* figure trans_offset up to trans member */
-    trans_offset = sizeof * pt - sizeof pt -> rmap +
-        pb -> min_width * sizeof pt -> rmap [ 0 ];
-
-    /* create the real deal */
-    pt = malloc ( trans_offset + pb -> num_trans * pb -> off_size );
-    if ( pt == NULL )
-        pb -> rc = RC ( rcCont, rcTrie, rcPersisting, rcMemory, rcExhausted );
-    else
-    {
-        uint32_t i;
-        size_t data_offset;
-
-        /* initialize header */
-        pt -> num_trans = pb -> num_trans;
-        pt -> num_nodes = pb -> num_nodes;
-        pt -> data_size = (uint32_t)pb -> data_size;
-        pt -> keys = 0;
-        P_TrieSetExtKeys ( pt -> keys, ext_keys );
-        P_TrieSetBacktrace ( pt -> keys, ! ext_keys );
-        pt -> width = pb -> min_width;
-
-        /* decide upon id encoding type:
-           0 => 24 : 8, i.e. 24 bits for trans id, 8 bits for local btree id
-           1 => 22 : 10
-           2 => 20 : 12
-           3 => 18 : 14
-           4 => 16 : 16
-           5 => 14 : 18
-           6 => 12 : 20
-           7 => by offset into data section
-        */
-#define VALID_IDCODE( pb, trans, bt ) \
-    ( ( pb ) -> num_trans <= ( 1U << ( trans ) ) && \
-      ( pb ) -> max_nodes <= ( 1U << ( bt ) ) )
-
-        if ( VALID_IDCODE ( pb, 24, 8 ) )
-            P_TrieSetIdCoding ( pt -> keys, 0 );
-        else if ( VALID_IDCODE ( pb, 22, 10 ) )
-            P_TrieSetIdCoding ( pt -> keys, 1 );
-        else if ( VALID_IDCODE ( pb, 20, 12 ) )
-            P_TrieSetIdCoding ( pt -> keys, 2 );
-        else if ( VALID_IDCODE ( pb, 18, 14 ) )
-            P_TrieSetIdCoding ( pt -> keys, 3 );
-        else if ( VALID_IDCODE ( pb, 16, 16 ) )
-            P_TrieSetIdCoding ( pt -> keys, 4 );
-        else if ( VALID_IDCODE ( pb, 14, 18 ) )
-            P_TrieSetIdCoding ( pt -> keys, 5 );
-        else if ( VALID_IDCODE ( pb, 12, 20 ) )
-            P_TrieSetIdCoding ( pt -> keys, 6 );
-        else
-            P_TrieSetIdCoding ( pt -> keys, 7 );
-
-#undef VALID_IDCODE
-
-        /* fill out rmap */
-        for ( i = 0; i < ( uint32_t ) pb -> min_width; ++ i )
-            pt -> rmap [ i ] = pb -> idx_map [ i ] . ch;
-
-        /* fill out transition offset table */
-        if ( pb -> off_size == 1 )
-        {
-            uint8_t *trans = ( void* ) ( ( char* ) pt + trans_offset );
-            data_offset = trans_offset + pb -> num_trans;
-
-            for ( trans_offset = 0, i = 0; i < pb -> num_trans; ++ i )
-            {
-                assert ( ( trans_offset & 3 ) == 0 );
-                trans [ i ] = ( uint8_t ) ( trans_offset >> 2 );
-                trans_offset += pb -> trans_map [ i ];
-            }
-        }
-        else if ( pb -> off_size == 2 )
-        {
-            uint16_t *trans = ( void* ) ( ( char* ) pt + trans_offset );
-            data_offset = trans_offset + ( pb -> num_trans << 1 );
-
-            for ( trans_offset = 0, i = 0; i < pb -> num_trans; ++ i )
-            {
-                assert ( ( trans_offset & 3 ) == 0 );
-                trans [ i ] = ( uint16_t ) ( trans_offset >> 2 );
-                trans_offset += pb -> trans_map [ i ];
-            }
-        }
-        else
-        {
-            uint32_t *trans = ( void* ) ( ( char* ) pt + trans_offset );
-            data_offset = trans_offset + ( pb -> num_trans << 2 );
-
-            for ( trans_offset = 0, i = 0; i < pb -> num_trans; ++ i )
-            {
-                assert ( ( trans_offset & 3 ) == 0 );
-                trans [ i ] = ( uint32_t ) ( trans_offset >> 2 );
-                trans_offset += pb -> trans_map [ i ];
-            }
-        }
-
-        /* the last offset should equal total data bytes */
-        assert ( trans_offset == ( size_t ) pt -> data_size );
-
-        /* write the tree header */
-        pb -> rc = ( * write ) ( write_param, pt, data_offset, num_writ );
-        if ( pb -> rc == 0 && * num_writ != data_offset )
-            pb -> rc = RC ( rcCont, rcTrie, rcPersisting, rcTransfer, rcIncomplete );
-
-        free ( pt );
-    }
-
-    return pb -> rc;
-}
-
-LIB_EXPORT rc_t CC TriePersist ( const Trie *tt, size_t *num_writ, bool ext_keys,
-    PTWriteFunc write, void *write_param, PTAuxFunc aux, void *aux_param )
-{
-    PTriePersistData pb;
-    size_t num_writ_buffer;
-
-#if DEBUGPRINT
-    fprintf(stderr, "TriePersist called\n");
-#endif
-
-    if ( num_writ == NULL )
-        num_writ = & num_writ_buffer;
-
-    if ( write == NULL )
-    {
-        write = NullWrite;
-        write_param = NULL;
-    }
-
-    * num_writ = 0;
-
-    if ( tt == NULL )
-        return RC ( rcCont, rcTrie, rcPersisting, rcSelf, rcNull );
-    if ( aux == NULL )
-        return RC ( rcCont, rcTrie, rcPersisting, rcFunction, rcNull );
-
-    /* handle empty tree */
-    if ( tt -> root == NULL )
-        return TriePersist0 ( num_writ, ext_keys, write, write_param );
-
-    pb . write = NullWrite;
-    pb . write_param = NULL;
-    pb . aux = aux;
-    pb . aux_param = aux_param;
-    pb . rc = 0;
-
-    if ( ext_keys )
-    {
-        pb . null_write = aux;
-        pb . live_write = aux;
-    }
-    else
-    {
-        pb . null_write = TNodeDataSize;
-        pb . live_write = TNodeWrite;
-    }
-
-    /* prepare a statistical array for character transition analysis */
-    pb . idx_map = malloc ( tt -> width * sizeof pb . idx_map [ 0 ] );
-    if ( pb . idx_map == NULL )
-        pb . rc = RC ( rcCont, rcTrie, rcPersisting, rcMemory, rcExhausted );
-    else
-    {
-        /* analyze table dimensions based upon counts */
-        TriePersist1 ( tt, & pb );
-
-        /* time to allocate some memory
-           allocate trans_map based upon the number of TTrans objects
-           and idx_seq for persisting a single child array */
-        pb . trans_map = malloc (
-            /* the TTrans node size/offset array */
-            pb . num_trans * sizeof pb . trans_map [ 0 ] +
-            /* maximum space for all indices, all transitions */
-            ( pb . idx_size + pb . trans_size ) * pb . min_width +
-            /* space for parent backtrace transition */
-            pb . trans_size +
-            /* maximum space for sequence entry type bits */
-            ( ( pb . min_width + 7 ) >> 3 ) +
-            /* space for header entries in index array */
-            ( pb . idx_size * pttFirstIdx ) +
-            /* ample space for align1 */
-            pb . trans_size );
-        if ( pb . trans_map == NULL )
-            pb . rc = RC ( rcCont, rcTrie, rcPersisting, rcMemory, rcExhausted );
-        else
-        {
-            /* set up idx_seq from trans_map */
-            pb . idx_seq . v8 = ( uint8_t* ) pb . trans_map +
-                pb . num_trans * sizeof pb . trans_map [ 0 ];
-
-            /* assign pointers to parts */
-            pb . child_seq_type =
-                & pb . idx_seq . v8 [ pb . idx_size * ( pttFirstIdx + pb . min_width ) ];
-            pb . backtrace . v8 = NULL;
-            pb . trans_seq . v8 =
-                pb . child_seq_type + ( ( pb . min_width + 7 ) >> 3 );
-            if ( ! ext_keys )
-            {
-                pb . backtrace . v8 = pb . trans_seq . v8;
-                pb . trans_seq . v8 += pb . trans_size;
-            }
-
-            /* perform a dry-run to obtain overall size */
-            if ( TriePersist2 ( tt, & pb ) == 0 )
-            {
-                /* create, initialize and write the P_Trie structure */
-                if ( TriePersist3 ( tt, & pb, ext_keys, write, write_param, num_writ ) == 0 )
-                {
-                    /* use the real write function */
-                    pb . write = write;
-                    pb . write_param = write_param;
-
-                    /* align to 4 byte boundary */
-                    pb . rc = PTAlign ( & pb, num_writ, 4, 0 );
-                    if ( pb . rc == 0 )
-                    {
-                        /* write the nodes and data */
-                        pb . trans_id = 0;
-                        pb . data_size = 0;
-                        TTransPIterate ( tt -> root, & pb );
-                        * num_writ += pb . data_size;
-                    }
-                }
-            }
-
-            free ( pb . trans_map );
-        }
-
-        free ( pb . idx_map );
-    }
-
-    return pb . rc;
-}
diff --git a/libs/klib/ptrie.c b/libs/klib/ptrie.c
deleted file mode 100644
index ba97111..0000000
--- a/libs/klib/ptrie.c
+++ /dev/null
@@ -1,1956 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include "pbstree-priv.h"
-#include <klib/text.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <byteswap.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * PTNode
- *  a node within text tree
- *
- *  a TTree will contain TTNodes, which themselves are intrusive but
- *  irrelevant internal tree links plus a key string plus an externally
- *  defined data structure, representing a value, and supporting multiple
- *  nodes per key. the internal links permit navigation from node
- *  to node that is not possible with the PTNode. furthermore, they
- *  provide direct access to the key string that is not normally stored
- *  verbatim within a persisted image.
- *
- *  a PTrie does not contain structured nodes, but stores linkage
- *  and ordering information separately from the externally defined
- *  data, and rather than using pointers, assigns integer ids to the
- *  nodes themselves. navigation by pointers would require allocations,
- *  which are unnecessary and expensive when traversing a read-only
- *  persisted image. navigation is therefore intrusive on an externally
- *  allocated node structure.
- */
-
-/* PTNodeMakeKey
- *  tries to may a key string from node
- *  will fail if key text was not embedded into image when created
- *
- *  "key" [ OUT ] - return parameter for a key string allocation
- *  that must be whacked with StringWhack when no longer needed.
- *
- *  return status codes:
- *    EINVAL => invalid parameter
- *    ENOENT => no key data were written to tree image
- *    ENOMEM => memory failure
- */
-LIB_EXPORT rc_t CC PTNodeMakeKey ( const PTNode *self, const String **keyp )
-{
-    rc_t rc;
-    if ( keyp == NULL )
-        rc = RC ( rcCont, rcNode, rcAccessing, rcParam, rcNull );
-    else
-    {
-        * keyp = NULL;
-
-        if ( self == NULL )
-            rc = RC ( rcCont, rcNode, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            const PTrie *tt = self -> internal;
-            if ( tt->ext_keys || ! tt->backtrace )
-                rc = RC ( rcCont, rcNode, rcAccessing, rcString, rcNotFound );
-            else
-            {
-                uint32_t tid, btid;
-
-                /* decode the node id into trans and btnode ids */
-                rc = PTrieDecodeNodeId ( tt, self -> id, & tid, & btid );
-                if ( rc == 0 )
-                {
-                    /* recover the trans node */
-                    PTTrans trans;
-                    rc = PTrieInitNode ( tt, & trans, tid );
-                    if ( rc == 0 )
-                    {
-                        size_t size;
-                        const void *addr;
-
-                        assert ( trans . vals != NULL );
-                        assert ( PBSTreeCount ( trans . vals ) >= btid );
-
-                        /* recover the value node */
-                        rc = PBSTreeGetNodeData ( trans . vals, & addr, & size, btid );
-                        if ( rc == 0 )
-                        {
-                            /* the depth of this transition is
-                               the length of the key string up to node */
-                            uint32_t depth = PTTransGetDepth ( & trans, tt );
-
-                            /* get an adequate UTF-32 buffer */
-                            uint32_t tbbuff [ 64 ], *traceback = tbbuff;
-                            if ( depth > sizeof tbbuff / sizeof tbbuff [ 0 ] )
-                                traceback = malloc ( depth * sizeof traceback [ 0 ] );
-
-                            /* complete the work */
-                            if ( traceback != NULL )
-                            {
-                                String *key;
-                                uint32_t nlen;
-                                size_t tbsize, nsize;
-
-                                uint32_t i;
-                                for ( i = depth; i > 0; )
-                                {
-                                    uint32_t zidx = PTTransGetTransCharCode ( & trans, tt );
-                                    traceback [ -- i ] =
-                                        ( zidx + 1 == tt -> unmapped_idx ) ?
-                                        ( uint32_t ) '?' : PTrieDecodeCharId ( tt, zidx );
-                                    tid = PTTransGetDad ( & trans, tt );
-                                    assert ( tid != 0 || i == 0 );
-                                    rc = PTrieInitNode ( tt, & trans, tid );
-                                    assert ( rc == 0 );
-                                }
-
-                                /* determine the size of traceback string */
-                                i = utf32_cvt_string_len ( traceback,
-                                    depth * sizeof traceback [ 0 ], & tbsize );
-                                assert ( i == depth );
-
-                                /* determine the size and length of node string */
-                                nlen = string_measure ( addr, & nsize );
-                                assert ( nsize < size );
-
-                                /* create the string object */
-                                key = malloc ( sizeof * key + tbsize + nsize + 1 );
-                                if ( key == NULL )
-                                    rc = RC ( rcCont, rcNode, rcAccessing, rcMemory, rcExhausted );
-                                else
-                                {
-                                    /* home free */
-                                    char *text = ( char* ) ( key + 1 );
-                                    tbsize = utf32_cvt_string_copy ( text, tbsize + 1,
-                                        traceback, depth * sizeof traceback [ 0 ] );
-                                    memcpy ( & text [ tbsize ], addr, nsize + 1 );
-                                    StringInit ( key, text, tbsize + nsize, depth + nlen );
-                                    * keyp = key;
-                                }
-
-                                if ( traceback != tbbuff )
-                                    free ( traceback );
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * PTTrans
- */
-
-/* Whack
- */
-void PTTransWhack ( PTTrans *trans )
-{
-    if ( trans != NULL ) while ( 1 )
-    {
-        PTTrans *doomed = trans;
-        trans = ( PTTrans* ) trans -> back;
-        if ( doomed -> vals != & doomed -> _val )
-            PBSTreeWhack ( ( PBSTree* ) doomed -> vals );
-        free ( doomed );
-        if ( trans == NULL )
-            break;
-        if ( -- trans -> refcount > 0 )
-            break;
-    }
-}
-
-/* GetDepth
- */
-#if ! RECORD_HDR_DEPTH
-LIB_EXPORT uint32_t CC PTTransGetDepth ( const PTTrans *self, const PTrie *tt )
-{
-    PTTrans trans;
-    uint32_t dad, depth;
-
-    assert ( self != NULL );
-    if ( self -> depth != 0 )
-        return self -> depth;
-
-    for ( depth = 0, dad = PTTransGetDad ( self, tt ); dad != 0;
-          ++ depth, dad = PTTransGetDad ( & trans, tt ) )
-    {
-        int status = PTrieInitNode ( tt, & trans, dad );
-        assert ( status == 0 );
-    }
-
-    return depth;
-}
-#endif
-
-/* GetChildChildIdx
- */
-static
-uint32_t PTTransGetChildChildIdx ( const PTTrans *self,
-    const PTrie *tt, uint32_t zidx )
-{
-    const uint8_t *child_seq_type = self -> child_seq_type;
-    if ( self -> child_seq_type != NULL )
-    {
-        uint32_t i, j, k;
-
-        /* terse variable name explanation:
-           "i" will be the index into "child_seq_type" bit array
-           "j" is a 1-based index into child trans array
-           "k" is an index into the index array */
-        for ( i = 0, j = 1, k = pttFirstIdx; i < self -> slen; ++ k, ++ j, ++ i )
-        {
-            /* get the single char code or
-               the left edge of char code range */
-            uint32_t left = PTTransGetIdx ( self, tt, k );
-
-            /* detect terminal condition */
-            if ( left >= zidx )
-            {
-                /* if single or range left is too high, there's no transition */
-                if ( left > zidx )
-                    break;
-
-                /* the single or range left is an exact match
-                   "j" is the 1-based index into child array */
-                return j;
-            }
-
-            /* check entry type: if 0, then the index was a single
-               value. if 1, then it's a range */
-            if ( ( child_seq_type [ i >> 3 ] & ( 1U << ( i & 7 ) ) ) != 0 )
-            {
-                /* check for inclusion within the range
-                   N.B. ensure that the increment of "k"
-                   does not get evaluated more than once */
-                uint32_t right = PTTransGetIdx ( self, tt, ++ k );
-                if ( right >= zidx )
-                {
-                    /* found the range - calculate 1-based index */
-                    return zidx - left + j;
-                }
-
-                /* advance "j" by range width - 1 */
-                j += right - left;
-            }
-        }
-    }
-
-    return 0;
-}
-
-/* 8 bit index */
-static
-uint32_t PTTransGetIdx8 ( const PTTrans *self, uint32_t zidx )
-{
-    return self -> idx . v8 [ zidx ];
-}
-
-static
-const void * PTTransGetIdxAddr8 ( const PTTrans *self, uint32_t zidx )
-{
-    return & self -> idx . v8 [ zidx ];
-}
-
-/* 16 bit index */
-static
-uint32_t PTTransGetIdx16 ( const PTTrans *self, uint32_t zidx )
-{ 
-    return self -> idx . v16 [ zidx ];
-}
-
-static
-uint32_t PTTransSwapIdx16 ( const PTTrans *self, uint32_t zidx )
-{
-    return bswap_16 ( self -> idx . v16 [ zidx ] );
-}
-
-static
-const void * PTTransGetIdxAddr16 ( const PTTrans *self, uint32_t zidx )
-{
-    return & self -> idx . v16 [ zidx ];
-}
-
-/* NULL dad access */
-static
-uint32_t PTTransGetDadNULL ( const PTTrans *self )
-{
-    return 0; 
-}
-
-/* 8 bit trans id */
-static
-uint32_t PTTransGetDad8 ( const PTTrans *self )
-{
-    return self -> dad . v8 [ 0 ];
-}
-
-static
-const void * PTTransAlignDadAddr8 ( PTTrans *self, bool backtrace )
-{
-    return & self -> dad . v8 [ backtrace ];
-}
-
-static
-uint32_t PTTransGetChild8 ( const PTTrans *self, uint32_t zidx )
-{
-    return self -> child . v8 [ zidx ];
-}
-
-static
-const void * PTTransGetChildAddr8 ( const PTTrans *self, uint32_t zidx )
-{
-    return & self -> child . v8 [ zidx ];
-}
-
-/* 16 bit trans id */
-static
-uint32_t PTTransGetDad16 ( const PTTrans *self )
-{
-    return self -> dad . v16 [ 0 ];
-}
-
-static
-uint32_t PTTransSwapDad16 ( const PTTrans *self )
-{
-    return bswap_16 ( self -> dad . v16 [ 0 ] );
-}
-
-static
-const void * PTTransAlignDadAddr16 ( PTTrans *self, bool backtrace )
-{
-    /* align dad first */
-    size_t i = ( size_t ) self -> dad . v16;
-    i = ( i + 1 ) & ~ ( size_t ) 1;
-    self -> dad . v16 = ( const uint16_t* ) i;
-    if ( backtrace )
-        return ( const void* ) ( i + 2 );
-    return ( const void* ) i;
-}
-
-static
-uint32_t PTTransGetChild16 ( const PTTrans *self, uint32_t zidx )
-{
-    return self -> child . v16 [ zidx ];
-}
-
-static
-uint32_t PTTransSwapChild16 ( const PTTrans *self, uint32_t zidx )
-{
-    return bswap_16 ( self -> child . v16 [ zidx ] );
-}
-
-static
-const void * PTTransGetChildAddr16 ( const PTTrans *self, uint32_t zidx )
-{
-    return & self -> child . v16 [ zidx ];
-}
-
-/* 32 bit trans id */
-static
-uint32_t PTTransGetDad32 ( const PTTrans *self )
-{
-    return self -> dad . v32 [ 0 ];
-}
-
-static
-uint32_t PTTransSwapDad32 ( const PTTrans *self )
-{
-    return bswap_32 ( self -> dad . v32 [ 0 ] );
-}
-
-static
-const void * PTTransAlignDadAddr32 ( PTTrans *self, bool backtrace )
-{
-    /* align dad first */
-    size_t i = ( size_t ) self -> dad . v32;
-    i = ( i + 3 ) & ~ ( size_t ) 3;
-    self -> dad . v32 = ( const uint32_t* ) i;
-    if ( backtrace )
-        return ( const void* ) ( i + 4 );
-    return ( const void* ) i;
-}
-
-static
-uint32_t PTTransGetChild32 ( const PTTrans *self, uint32_t zidx )
-{
-    return self -> child . v32 [ zidx ];
-}
-
-static
-uint32_t PTTransSwapChild32 ( const PTTrans *self, uint32_t zidx )
-{
-    return bswap_32 ( self -> child . v32 [ zidx ] );
-}
-
-static
-const void * PTTransGetChildAddr32 ( const PTTrans *self, uint32_t zidx )
-{
-    return & self -> child . v32 [ zidx ];
-}
-
-/* ForEach
- */
-void PTTransForEach ( const PTTrans *self, const PTrie *tt,
-    void ( * f ) ( const PTTrans *trans, const PTrie *tt, void *data ), void * data )
-{
-    const uint8_t *child_seq_type;
-
-    assert ( f != NULL );
-    ( * f ) ( self, tt, data );
-
-    child_seq_type = self -> child_seq_type;
-    if ( self -> child_seq_type != NULL )
-    {
-        PTTrans *trans = malloc ( sizeof * trans );
-        if ( trans != NULL )
-        {
-            uint32_t i, j, k;
-
-            /* see explanations in PTTransGetChildChildIdx */
-            for ( i = j = 0, k = pttFirstIdx; i < self -> slen; ++ k, ++ i )
-            {
-                uint32_t left, right;
-
-                /* get the single char code or
-                   the left edge of char code range */
-                left = right = PTTransGetIdx ( self, tt, k );
-
-                /* check entry type: if 0, then the index was a single
-                   value. if 1, then it's a range */
-                if ( ( child_seq_type [ i >> 3 ] & ( 1U << ( i & 7 ) ) ) != 0 )
-                    right = PTTransGetIdx ( self, tt, ++ k );
-
-                /* get child node id */
-                for ( ; left <= right; ++ j, ++ left )
-                {
-                    uint32_t tid = PTTransGetChild ( self, tt, j ) + 1;
-                    int status = PTrieInitNode ( tt, trans, tid );
-                    if ( status == 0 )
-                    {
-                        trans -> back = self;
-#if ! RECORD_HDR_IDX
-                        trans -> tidx = left;
-#endif
-#if ! RECORD_HDR_DEPTH
-                        trans -> depth = self -> depth + 1;
-#endif
-                        PTTransForEach ( trans, tt, f, data );
-                    }
-                }
-            }
-
-            free ( trans );
-        }
-    }
-}
-
-/* DoUntil
- */
-bool PTTransDoUntil ( const PTTrans *self, const PTrie *tt,
-    bool ( * f ) ( const PTTrans *trans, const PTrie *tt, void *data ), void * data )
-{
-    const uint8_t *child_seq_type;
-
-    assert ( f != NULL );
-    if ( ( * f ) ( self, tt, data ) )
-        return true;
-
-    child_seq_type = self -> child_seq_type;
-    if ( self -> child_seq_type != NULL )
-    {
-        PTTrans *trans = malloc ( sizeof * trans );
-        if ( trans != NULL )
-        {
-            uint32_t i, j, k;
-
-            /* see explanations in PTTransGetChildChildIdx */
-            for ( i = j = 0, k = pttFirstIdx; i < self -> slen; ++ k, ++ i )
-            {
-                uint32_t left, right;
-
-                /* get the single char code or
-                   the left edge of char code range */
-                left = right = PTTransGetIdx ( self, tt, k );
-
-                /* check entry type: if 0, then the index was a single
-                   value. if 1, then it's a range */
-                if ( ( child_seq_type [ i >> 3 ] & ( 1U << ( i & 7 ) ) ) != 0 )
-                    right = PTTransGetIdx ( self, tt, ++ k );
-
-                /* get child node id */
-                for ( ; left <= right; ++ j, ++ left )
-                {
-                    uint32_t tid = PTTransGetChild ( self, tt, j ) + 1;
-                    rc_t rc = PTrieInitNode ( tt, trans, tid );
-                    if ( rc == 0 )
-                    {
-                        trans -> back = self;
-#if ! RECORD_HDR_IDX
-                        trans -> tidx = left;
-#endif
-#if ! RECORD_HDR_DEPTH
-                        trans -> depth = self -> depth + 1;
-#endif
-                        if ( PTTransDoUntil ( trans, tt, f, data ) )
-                        {
-                            free ( trans );
-                            return true;
-                        }
-                    }
-                }
-            }
-
-            free ( trans );
-        }
-    }
-    return false;
-}
-
-
-/*--------------------------------------------------------------------------
- * PTrie
- *  a persisted tree of text nodes
- *
- *  this is a collection of { key, value } pairs, where a many-value
- *  to one key paradigm is naturally supported, as in the b-tree.
- *
- *  the desired retrieval operations are:
- *   a) key -> id : value
- *   b) key -> { id : value, ... }
- *   c) RE -> id : value
- *   d) RE -> { id : value, ... }
- *   e) iteration across { id : value, ... }
- *   f) id : value -> key
- *
- *  the reverse retrieval operation is:
- *   a) id -> value
- *
- *  indexing of the id is performed externally, and should not be interpreted
- *  as a serial, integer value. it may be a byte offset or a combination of
- *  two integer values, as well as anything else.
- */
-
-/* GetNodeOff
- *  takes a 1-based index
- *  returns an offset into data array
- */
-static
-uint32_t PTrieGetNodeOff8 ( const PTrie *self, uint32_t zidx )
-{
-    return self -> trans_off . v8 [ zidx ];
-}
-
-static
-uint32_t PTrieGetNodeOff16 ( const PTrie *self, uint32_t zidx )
-{
-    return self -> trans_off . v16 [ zidx ];
-}
-
-static
-uint32_t PTrieSwapNodeOff16 ( const PTrie *self, uint32_t zidx )
-{
-    return bswap_16 ( self -> trans_off . v16 [ zidx ] );
-}
-
-static
-uint32_t PTrieGetNodeOff32 ( const PTrie *self, uint32_t zidx )
-{
-    return self -> trans_off . v32 [ zidx ];
-}
-
-static
-uint32_t PTrieSwapNodeOff32 ( const PTrie *self, uint32_t zidx )
-{
-    return bswap_32 ( self -> trans_off . v32 [ zidx ] );
-}
-
-
-/* EncodeNodeId
- * PTrieDecodeNodeId
- */
-static
-uint32_t PTrieOrigEncodeNodeId0 ( const PTrie *self,
-    uint32_t tid, uint32_t btid )
-{
-    return ( tid << 8 ) | btid; 
-}
-
-static
-uint32_t PTrieEncodeNodeId0 ( const PTrie *self,
-    uint32_t tid, uint32_t btid )
-{
-    return ( ( ( tid - 1 ) << 8 ) + ( btid - 1 ) ) + 1;
-}
-
-static
-rc_t PTrieOrigDecodeTestTrieNodeId ( const PTrie *self, uint32_t *tid, uint32_t *btid, uint32_t count )
-{
-    uint32_t which = 0;
-
-    PTTrans trans;
-    rc_t rc = PTrieInitNode ( self, & trans, * tid & ~ 1U );
-    if ( rc == 0 )
-    {
-        assert ( trans . vals != NULL );
-        if ( PBSTreeCount ( trans . vals ) == count )
-            which |= 1;
-    }
-    rc = PTrieInitNode ( self, & trans, * tid | 1U );
-    if ( rc == 0 )
-    {
-        assert ( trans . vals != NULL );
-        if ( PBSTreeCount ( trans . vals ) == count )
-            which |= 2;
-    }
-
-    switch ( which )
-    {
-    case 0:
-        return RC ( rcCont, rcTrie, rcAccessing, rcId, rcCorrupt );
-    case 1:
-        * tid &= ~ 1U;
-        * btid = count;
-        break;
-    case 2:
-        * tid |= 1U;
-        * btid = count;
-        break;
-    case 3:
-        * btid = count;
-        return RC ( rcCont, rcTrie, rcAccessing, rcId, rcAmbiguous );
-    }
-
-    return 0;
-}
-
-static
-rc_t PTrieOrigDecodeNodeId0 ( const PTrie *self, uint32_t id,
-    uint32_t *tid, uint32_t *btid )
-{
-    /* unpack 1-based ids */
-    * tid = id >> 8;
-    * btid = id & 0xFF;
-
-    /* detect no-overflow cases */
-    if ( * btid != 0 )
-        return 0;
-
-    /* handle overflow */
-    return PTrieOrigDecodeTestTrieNodeId ( self, tid, btid, 0x100 );
-}
-
-static
-rc_t PTrieDecodeNodeId0 ( const PTrie *self, uint32_t id,
-    uint32_t *tid, uint32_t *btid )
-{
-    -- id;
-    * tid = ( id >> 8 ) + 1;
-    * btid = ( id & 0xFF ) + 1;
-    return 0;
-}
-
-static
-uint32_t PTrieOrigEncodeNodeId1 ( const PTrie *self,
-    uint32_t tid, uint32_t btid )
-{
-    return ( tid << 10 ) | btid;
-}
-
-static
-uint32_t PTrieEncodeNodeId1 ( const PTrie *self,
-    uint32_t tid, uint32_t btid )
-{
-    return ( ( ( tid - 1 ) << 10 ) + ( btid - 1 ) ) + 1;
-}
-
-static
-rc_t PTrieOrigDecodeNodeId1 ( const PTrie *self, uint32_t id,
-    uint32_t *tid, uint32_t *btid )
-{
-    * tid = id >> 10;
-    * btid = id & 0x3FF;
-    if ( * btid != 0 )
-        return 0;
-    return PTrieOrigDecodeTestTrieNodeId ( self, tid, btid, 0x400 );
-}
-
-static
-rc_t PTrieDecodeNodeId1 ( const PTrie *self, uint32_t id,
-    uint32_t *tid, uint32_t *btid )
-{
-    -- id;
-    * tid = ( id >> 10 ) + 1;
-    * btid = ( id & 0x3FF ) + 1;
-    return 0;
-}
-
-static
-uint32_t PTrieOrigEncodeNodeId2 ( const PTrie *self,
-    uint32_t tid, uint32_t btid )
-{
-    return ( tid << 12 ) | btid;
-}
-
-static
-uint32_t PTrieEncodeNodeId2 ( const PTrie *self,
-    uint32_t tid, uint32_t btid )
-{
-    return ( ( ( tid - 1 ) << 12 ) + ( btid - 1 ) ) + 1;
-}
-
-static
-rc_t PTrieOrigDecodeNodeId2 ( const PTrie *self, uint32_t id,
-    uint32_t *tid, uint32_t *btid )
-{
-    * tid = id >> 12;
-    * btid = id & 0xFFF;
-    if ( * btid != 0 )
-        return 0;
-    return PTrieOrigDecodeTestTrieNodeId ( self, tid, btid, 0x1000 );
-}
-
-static
-rc_t PTrieDecodeNodeId2 ( const PTrie *self, uint32_t id,
-    uint32_t *tid, uint32_t *btid )
-{
-    -- id;
-    * tid = ( id >> 12 ) + 1;
-    * btid = ( id & 0xFFF ) + 1;
-    return 0;
-}
-
-static
-uint32_t PTrieOrigEncodeNodeId3 ( const PTrie *self,
-    uint32_t tid, uint32_t btid )
-{
-    return ( tid << 14 ) | btid;
-}
-
-static
-uint32_t PTrieEncodeNodeId3 ( const PTrie *self,
-    uint32_t tid, uint32_t btid )
-{
-    return ( ( ( tid - 1 ) << 14 ) + ( btid - 1 ) ) + 1;
-}
-
-static
-rc_t PTrieOrigDecodeNodeId3 ( const PTrie *self, uint32_t id,
-    uint32_t *tid, uint32_t *btid )
-{
-    * tid = id >> 14;
-    * btid = id & 0x3FFF;
-    if ( * btid != 0 )
-        return 0;
-    return PTrieOrigDecodeTestTrieNodeId ( self, tid, btid, 0x4000 );
-}
-
-static
-rc_t PTrieDecodeNodeId3 ( const PTrie *self, uint32_t id,
-    uint32_t *tid, uint32_t *btid )
-{
-    -- id;
-    * tid = ( id >> 14 ) + 1;
-    * btid = ( id & 0x3FFF ) + 1;
-    return 0;
-}
-
-static
-uint32_t PTrieOrigEncodeNodeId4 ( const PTrie *self,
-    uint32_t tid, uint32_t btid )
-{
-    return ( tid << 16 ) | btid;
-}
-
-static
-uint32_t PTrieEncodeNodeId4 ( const PTrie *self,
-    uint32_t tid, uint32_t btid )
-{
-    return ( ( ( tid - 1 ) << 16 ) + ( btid - 1 ) ) + 1;
-}
-
-static
-rc_t PTrieOrigDecodeNodeId4 ( const PTrie *self, uint32_t id,
-    uint32_t *tid, uint32_t *btid )
-{
-    * tid = id >> 16;
-    * btid = id & 0xFFFF;
-    if ( * btid != 0 )
-        return 0;
-    return PTrieOrigDecodeTestTrieNodeId ( self, tid, btid, 0x10000 );
-}
-
-static
-rc_t PTrieDecodeNodeId4 ( const PTrie *self, uint32_t id,
-    uint32_t *tid, uint32_t *btid )
-{
-    -- id;
-    * tid = ( id >> 16 ) + 1;
-    * btid = ( id & 0xFFFF ) + 1;
-    return 0;
-}
-
-static
-uint32_t PTrieOrigEncodeNodeId5 ( const PTrie *self,
-    uint32_t tid, uint32_t btid )
-{
-    return ( tid << 18 ) | btid;
-}
-
-static
-uint32_t PTrieEncodeNodeId5 ( const PTrie *self,
-    uint32_t tid, uint32_t btid )
-{
-    return ( ( ( tid - 1 ) << 18 ) + ( btid - 1 ) ) + 1;
-}
-
-static
-rc_t PTrieOrigDecodeNodeId5 ( const PTrie *self, uint32_t id,
-    uint32_t *tid, uint32_t *btid )
-{
-    * tid = id >> 18;
-    * btid = id & 0x3FFFF;
-    if ( * btid != 0 )
-        return 0;
-    return PTrieOrigDecodeTestTrieNodeId ( self, tid, btid, 0x40000 );
-}
-
-static
-rc_t PTrieDecodeNodeId5 ( const PTrie *self, uint32_t id,
-    uint32_t *tid, uint32_t *btid )
-{
-    -- id;
-    * tid = ( id >> 18 ) + 1;
-    * btid = ( id & 0x3FFFF ) + 1;
-    return 0;
-}
-
-static
-uint32_t PTrieOrigEncodeNodeId6 ( const PTrie *self,
-    uint32_t tid, uint32_t btid )
-{
-    return ( tid << 20 ) | btid;
-}
-
-static
-uint32_t PTrieEncodeNodeId6 ( const PTrie *self,
-    uint32_t tid, uint32_t btid )
-{
-    return ( ( ( tid - 1 ) << 20 ) + ( btid - 1 ) ) + 1;
-}
-
-static
-rc_t PTrieOrigDecodeNodeId6 ( const PTrie *self, uint32_t id,
-    uint32_t *tid, uint32_t *btid )
-{
-    * tid = id >> 20;
-    * btid = id & 0xFFFFF;
-    if ( * btid != 0 )
-        return 0;
-    return PTrieOrigDecodeTestTrieNodeId ( self, tid, btid, 0x100000 );
-}
-
-static
-rc_t PTrieDecodeNodeId6 ( const PTrie *self, uint32_t id,
-    uint32_t *tid, uint32_t *btid )
-{
-    -- id;
-    * tid = ( id >> 20 ) + 1;
-    * btid = ( id & 0xFFFFF ) + 1;
-    return 0;
-}
-
-static
-uint32_t PTrieEncodeNodeId7 ( const PTrie *self,
-    uint32_t tid, uint32_t btid )
-{
-    /* first get the byte offset to trans */
-    uint32_t id = PTrieGetNodeOff ( self, tid - 1 );
-
-    /* the trans node is supposed to have at least btid
-       nodes underneath, taking > 1 byte each, so by adding
-       the count to a trans offset, we get something that
-       can be recovered later, and we insist that this
-       offset will be somewhere within the trans */
-
-    /* NB - conversion from tid to offset gives a
-       zero-based index into an array of uint32_t,
-       which is converted to a zero-based byte offset
-       and then added to a one-based node id, resulting
-       in a one-based composite node id */
-    return ( id << 2 ) + btid;
-}
-
-static
-rc_t PTrieDecodeNodeId7 ( const PTrie *self, uint32_t id,
-    uint32_t *tid, uint32_t *btid )
-{
-    uint32_t left = 0;
-    uint32_t right = self -> num_nodes;
-    while ( left < right )
-    {
-        uint32_t i = ( left + right ) >> 1;
-        uint32_t off = PTrieGetNodeOff ( self, i ) << 2;
-        if ( off > id )
-            right = i;
-        else
-        {
-            uint32_t end;
-
-            /* should never be equal, because ids are 1-based */
-            assert ( off != id );
-
-            /* get offset of next or end of data */
-            if ( i + 1 == self -> num_nodes )
-                end = self -> data_size;
-            else
-                end = PTrieGetNodeOff ( self, i + 1 ) << 2;
-
-            if ( end > id )
-            {
-                /* found it */
-                * tid = i + 1;
-                * btid = id - off;
-                return 0;
-            }
-
-            left = i;
-        }
-    }
-
-    return RC ( rcCont, rcTrie, rcSelecting, rcId, rcNotFound );
-}
-
-
-/* DecodeCharId
- */
-static
-uint32_t PTrieGetRMap ( const PTrie *self, uint32_t idx )
-{ 
-    return self -> _rmap [ idx ];
-}
-
-static
-uint32_t PTrieSwapRMap ( const PTrie *self, uint32_t idx )
-{
-    return bswap_32 ( self -> _rmap [ idx ] );
-}
-
-
-/* MakeInt
- *  make a persisted tree structure
- *  includes code to handle original composite node encoding
- *
- *  "addr" [ IN ] and "size" [ IN ] - constant memory image of
- *  persisted text tree with a lifetime exceeding that of the
- *  PTrie itself
- *
- *  "byteswap" [ IN ] - true if persisted image must be byteswapped
- *
- *  "orig" [ IN ] - true if persisted node ids must be reprocessed
- *   for overflow. In the original implementation, the composite
- *   node ids were formed from one-based trie and bstree node ids,
- *   but the bits allotted for them were calculated from zero-based
- *   ids, causing an overflow when either node reached its maximum.
- *
- *   e.g.: tid_max <= 0x1000000, btid_max <= 0x100: 24:8 packing
- *   when ( one-based ) btid == 256, it requires 9 bits, whereas
- *   zero-based btid == 255, requiring the expected 8 bits.
- */
-static int16_t _get_16 ( uint16_t i ) { return ( int16_t ) i; }
-static int16_t _swap_16 ( uint16_t i ) { return ( int16_t ) bswap_16 ( i ); }
-static int32_t _get_32 ( uint32_t i ) { return ( int32_t ) i; }
-static int32_t _swap_32 ( uint32_t i ) { return ( int32_t ) bswap_32 ( i ); }
-
-static
-rc_t PTrieMakeInt ( PTrie **ttp, const void *addr, size_t size, bool byteswap, bool orig )
-{
-    rc_t rc;
-
-    if ( ttp == NULL )
-        rc = RC ( rcCont, rcTrie, rcAllocating, rcParam, rcNull );
-    else
-    {
-        if ( addr == NULL )
-            rc = RC ( rcCont, rcTrie, rcAllocating, rcParam, rcNull );
-        else if ( size == 0 )
-            rc = RC ( rcCont, rcTrie, rcAllocating, rcData, rcInvalid );
-        else
-        {
-            const P_Trie *ptt;
-
-            if ( size < ( sizeof * ptt - sizeof ptt -> rmap ) )
-                rc = RC ( rcCont, rcTrie, rcAllocating, rcData, rcCorrupt );
-            else
-            {
-                size_t min_size;
-
-                /* accessor functions */
-                int16_t ( * get_16 ) ( uint16_t ) = byteswap ? _swap_16 : _get_16;
-                int32_t ( * get_32 ) ( uint32_t ) = byteswap ? _swap_32 : _get_32;
-
-                /* everything looks good */
-                rc = 0;
-
-                /* structured pointer into const memory image */
-                ptt = addr;
-
-                /* minimum known size of the memory image
-                   will be adjusted as image is scanned */
-                min_size = sizeof * ptt - sizeof ptt -> rmap +
-                    get_16 ( ptt -> width ) * sizeof ptt -> rmap [ 0 ] +
-                    get_32 ( ptt -> data_size );
-                if ( size >= min_size )
-                {
-                    PTrie *tt;
-                    uint16_t i, unmapped;
-                    uint32_t ch, first, last;
-
-                    /* the accept character set is recovered from the
-                       reverse character map where the special character
-                       value NUL represents a wildcard.
-
-                       the forward map will be built using one-based
-                       character codes, where code 0 means unmapped.
-
-                       first determine the range of accept characters
-                       while at the same time capturing the one-based
-                       character code of wildcards */
-                    for ( last = 0, first = ~ 0, unmapped = i = 0;
-                          i < get_16 ( ptt -> width ); ++ i )
-                    {
-                        ch = get_32 ( ptt -> rmap [ i ] );
-                        if ( ch == 0 )
-                            unmapped = i + 1;
-                        else
-                        {
-                            if ( ch < first )
-                                first = ch;
-                            if ( ch > last )
-                                last = ch;
-                        }
-                    }
-
-                    /* this case occurs when all values are on the root node */
-                    if ( last < first )
-                        first = 1;
-                    
-                    /* allocated block with mapped sections */
-                    tt = malloc ( sizeof * tt - sizeof tt -> map +
-                        ( last - first + 1 ) * sizeof tt -> map [ 0 ] );
-                    if ( tt == NULL )
-                        rc = RC ( rcCont, rcTrie, rcAllocating, rcMemory, rcExhausted );
-                    else
-                    {
-                        uint16_t ptt_width = get_16 ( ptt -> width );
-
-                        /* fill character to index map with wildcard index
-                           usually NULL or unmapped */
-                        for ( ch = first; ch <= last; ++ ch )
-                            tt -> map [ ch - first ] = unmapped;
-
-                        /* now overwrite mapped characters with one-based char codes */
-                        for ( i = 0; i < ptt_width; ++ i )
-                        {
-                            ch = get_32 ( ptt -> rmap [ i ] );
-                            if ( ch != 0 )
-                                tt -> map [ ch - first ] = i + 1;
-                        }
-
-                        /* fill out the virtual functions */
-                        do
-                        {
-                            uint32_t trans_off_len;
-                            uint16_t ptt_keys = get_16 ( ptt -> keys );
-
-                            /* reverse character lookup */
-                            tt -> decode_char_id = byteswap ?
-                                PTrieSwapRMap : PTrieGetRMap;
-
-                            /* index encoding scheme */
-                            if ( orig ) switch ( P_TrieIdCoding ( ptt_keys ) )
-                            {
-                            case 0:
-                                tt -> encode_node_id = PTrieOrigEncodeNodeId0;
-                                tt -> decode_node_id = PTrieOrigDecodeNodeId0;
-                                break;
-                            case 1:
-                                tt -> encode_node_id = PTrieOrigEncodeNodeId1;
-                                tt -> decode_node_id = PTrieOrigDecodeNodeId1;
-                                break;
-                            case 2:
-                                tt -> encode_node_id = PTrieOrigEncodeNodeId2;
-                                tt -> decode_node_id = PTrieOrigDecodeNodeId2;
-                                break;
-                            case 3:
-                                tt -> encode_node_id = PTrieOrigEncodeNodeId3;
-                                tt -> decode_node_id = PTrieOrigDecodeNodeId3;
-                                break;
-                            case 4:
-                                tt -> encode_node_id = PTrieOrigEncodeNodeId4;
-                                tt -> decode_node_id = PTrieOrigDecodeNodeId4;
-                                break;
-                            case 5:
-                                tt -> encode_node_id = PTrieOrigEncodeNodeId5;
-                                tt -> decode_node_id = PTrieOrigDecodeNodeId5;
-                                break;
-                            case 6:
-                                tt -> encode_node_id = PTrieOrigEncodeNodeId6;
-                                tt -> decode_node_id = PTrieOrigDecodeNodeId6;
-                                break;
-                            default:
-                                tt -> encode_node_id = PTrieEncodeNodeId7;
-                                tt -> decode_node_id = PTrieDecodeNodeId7;
-                            }
-                            else switch ( P_TrieIdCoding ( ptt_keys ) )
-                            {
-                            case 0:
-                                tt -> encode_node_id = PTrieEncodeNodeId0;
-                                tt -> decode_node_id = PTrieDecodeNodeId0;
-                                break;
-                            case 1:
-                                tt -> encode_node_id = PTrieEncodeNodeId1;
-                                tt -> decode_node_id = PTrieDecodeNodeId1;
-                                break;
-                            case 2:
-                                tt -> encode_node_id = PTrieEncodeNodeId2;
-                                tt -> decode_node_id = PTrieDecodeNodeId2;
-                                break;
-                            case 3:
-                                tt -> encode_node_id = PTrieEncodeNodeId3;
-                                tt -> decode_node_id = PTrieDecodeNodeId3;
-                                break;
-                            case 4:
-                                tt -> encode_node_id = PTrieEncodeNodeId4;
-                                tt -> decode_node_id = PTrieDecodeNodeId4;
-                                break;
-                            case 5:
-                                tt -> encode_node_id = PTrieEncodeNodeId5;
-                                tt -> decode_node_id = PTrieDecodeNodeId5;
-                                break;
-                            case 6:
-                                tt -> encode_node_id = PTrieEncodeNodeId6;
-                                tt -> decode_node_id = PTrieDecodeNodeId6;
-                                break;
-                            default:
-                                tt -> encode_node_id = PTrieEncodeNodeId7;
-                                tt -> decode_node_id = PTrieDecodeNodeId7;
-                            }
-
-                            /* PTTrans index access based on the
-                               minimum allowed char code width
-                               where the 0 <= code < width */
-                            if ( ptt_width <= 256 )
-                            {
-                                tt -> get_idx = PTTransGetIdx8;
-                                tt -> get_idx_addr = PTTransGetIdxAddr8;
-                            }
-                            else
-                            {
-                                tt -> get_idx = byteswap ? PTTransSwapIdx16 : PTTransGetIdx16;
-                                tt -> get_idx_addr = PTTransGetIdxAddr16;
-                            }
-
-                            /* PTTrans child and parent access based
-                               ont the minimum allowed trans id width */
-                            if ( get_32 ( ptt -> num_trans ) <= 256 )
-                            {
-                                tt -> get_dad = PTTransGetDad8;
-                                tt -> align_dad_addr = PTTransAlignDadAddr8;
-                                tt -> get_child = PTTransGetChild8;
-                                tt -> get_child_addr = PTTransGetChildAddr8;
-                            }
-                            else if ( get_32 ( ptt -> num_trans ) <= 65536 )
-                            {
-                                if ( byteswap )
-                                {
-                                    tt -> get_dad = PTTransSwapDad16;
-                                    tt -> get_child = PTTransSwapChild16;
-                                }
-                                else
-                                {
-                                    tt -> get_dad = PTTransGetDad16;
-                                    tt -> get_child = PTTransGetChild16;
-                                }
-                                tt -> align_dad_addr = PTTransAlignDadAddr16;
-                                tt -> get_child_addr = PTTransGetChildAddr16;
-                            }
-                            else
-                            {
-                                if ( byteswap )
-                                {
-                                    tt -> get_dad = PTTransSwapDad32;
-                                    tt -> get_child = PTTransSwapChild32;
-                                }
-                                else
-                                {
-                                    tt -> get_dad = PTTransGetDad32;
-                                    tt -> get_child = PTTransGetChild32;
-                                }
-                                tt -> align_dad_addr = PTTransAlignDadAddr32;
-                                tt -> get_child_addr = PTTransGetChildAddr32;
-                            }
-
-                            /* wipe out the backtrace function */
-                            if ( ! P_TrieBacktrace ( ptt_keys ) )
-                                tt -> get_dad = PTTransGetDadNULL;
-
-                            /* the trans offset access is based upon the
-                               total data size to be represented in nodes.
-                               all entries are 4-byte aligned, making it
-                               possible to represent their offsets with
-                               the byte value / 4 */
-                            if ( get_32 ( ptt -> data_size ) <= 256 * 4 )
-                            {
-                                tt -> get_node_off = PTrieGetNodeOff8;
-                                trans_off_len = ( get_32 ( ptt -> num_trans ) + 3 ) >> 2;
-                            }
-                            else if ( get_32 ( ptt -> data_size ) <= 65536 * 4 )
-                            {
-                                tt -> get_node_off = byteswap ? PTrieSwapNodeOff16 : PTrieGetNodeOff16;
-                                trans_off_len = ( get_32 ( ptt -> num_trans ) + 1 ) >> 1;
-                            }
-                            else
-                            {
-                                tt -> get_node_off = byteswap ? PTrieSwapNodeOff32 : PTrieGetNodeOff32;
-                                trans_off_len = get_32 ( ptt -> num_trans );
-                            }
-
-                            /* the minimum size of this image */
-                            min_size += trans_off_len << 2;
-
-                            /* initialize a few members -
-                               could be here or inside following if
-                               placed here only for pipelining */
-                            tt -> _rmap = ptt -> rmap;
-                            tt -> trans_off . v32 = & ptt -> rmap [ ptt_width ];
-
-                            /* require image size to pass test */
-                            if ( min_size <= size )
-                            {
-                                tt -> data = & tt -> trans_off . v32 [ trans_off_len ];
-                                tt -> num_trans = get_32 ( ptt -> num_trans );
-                                tt -> num_nodes = get_32 ( ptt -> num_nodes );
-                                tt -> data_size = get_32 ( ptt -> data_size );
-                                tt -> ext_keys = P_TrieExtKeys ( ptt_keys ) != 0;
-                                tt -> backtrace = P_TrieBacktrace ( ptt_keys ) != 0;
-                                tt -> id_coding = P_TrieIdCoding ( ptt_keys );
-                                tt -> byteswap = byteswap;
-                                tt -> width = ptt_width;
-                                tt -> first_char = first;
-                                tt -> last_char = last;
-                                tt -> unmapped_idx = unmapped;
-
-                                * ttp = tt;
-                                return 0;
-                            }
-                        }
-                        while ( 0 );
-
-                        free ( tt );
-                    }
-                }
-            }
-        }
-
-        * ttp = NULL;
-    }
-    return rc;
-}
-
-/* Make
- *  make a persisted tree structure
- *
- *  "addr" [ IN ] and "size" [ IN ] - constant memory image of
- *  persisted text tree with a lifetime exceeding that of the
- *  PTrie itself
- *
- *  "byteswap" [ IN ] - true if persisted image must be byteswapped
- */
-LIB_EXPORT rc_t CC PTrieMake ( PTrie **tt, const void *addr, size_t size, bool byteswap )
-{
-    return PTrieMakeInt ( tt, addr, size, byteswap, false );
-}
-
-/* MakeOrig - DEPRECATED
- *  make a persisted tree structure
- *  includes code to handle original composite node encoding
- *
- *  "addr" [ IN ] and "size" [ IN ] - constant memory image of
- *  persisted text tree with a lifetime exceeding that of the
- *  PTrie itself
- *
- *  "byteswap" [ IN ] - true if persisted image must be byteswapped
- */
-LIB_EXPORT rc_t CC PTrieMakeOrig ( PTrie **tt, const void *addr, size_t size, bool byteswap )
-{
-    return PTrieMakeInt ( tt, addr, size, byteswap, true );
-}
-
-/* Count
- *  returns number of { id : value } pairs in text tree
- *  not included within the TTree interface itself, but
- *  was included here due to the fact that it is constant
- *
- *  return value:
- *    integer value >= 0
- */
-LIB_EXPORT uint32_t CC PTrieCount ( const PTrie *self )
-{
-    if ( self != NULL )
-      return self -> num_nodes;
-    return 0;
-}
-
-/* Size
- *  returns the size in bytes
- *  of the PTrie image
- */
-LIB_EXPORT size_t CC PTrieSize ( const PTrie *self )
-{
-    const P_Trie *ptt;
-
-    if ( self == NULL )
-        return 0;
-
-    /* the original image has some standard set of headers
-       plus a bunch of table data from "rmap" to "data", followed
-       by "data_size" bytes of data. */
-    return ( const char* ) self -> data - ( const char* ) self -> _rmap +
-      self -> data_size + sizeof * ptt - sizeof ptt -> rmap;
-}
-
-/* GetNode
- *  gets a PTNode from an id
- *
- *  "node" [ OUT ] - return parameter for node
- *
- *  "id" [ IN ] - a 1-based integer node id
- *
- *  return values:
- *    EINVAL => an invalid parameter was passed
- *    ENOENT => id out of range
- */
-LIB_EXPORT rc_t CC PTrieGetNode ( const PTrie *self, PTNode *node, uint32_t id )
-{
-    rc_t rc;
-    if ( node == NULL )
-        rc = RC ( rcCont, rcTrie, rcAccessing, rcNode, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcCont, rcTrie, rcAccessing, rcSelf, rcNull );
-        else if ( id == 0 )
-            rc = RC ( rcCont, rcTrie, rcAccessing, rcId, rcNull );
-        else
-        {
-            uint32_t tid, btid;
-            rc = PTrieDecodeNodeId ( self, id, & tid, & btid );
-            if ( rc == 0 )
-            {
-                PTTrans trans;
-                rc = PTrieInitNode ( self, & trans, tid );
-                if ( rc == 0 )
-                {
-                    const PBSTree *pbt = trans . vals;
-                    if ( pbt == NULL )
-                        rc = RC ( rcCont, rcTrie, rcAccessing, rcId, rcNotFound );
-                    else
-                    {
-                        rc = PBSTreeGetNodeData ( pbt,
-                            & node -> data . addr, & node -> data . size, btid );
-                        if ( rc == 0 )
-                        {
-                            node -> internal = self;
-                            node -> id = id;
-
-                            if ( ! self -> ext_keys )
-                            {
-                                size_t sz = strlen ( node -> data . addr ) + 1;
-                                assert ( sz <= node -> data . size );
-                                node -> data . addr =
-                                    ( const char* ) node -> data . addr + sz;
-                                node -> data . size -= sz;
-                            }
-
-                            return 0;
-                        }
-                    }
-                }
-            }
-        }
-
-        node -> data . addr = node -> internal = NULL;
-        node -> data . size = 0;
-        node -> id = 0;
-    }
-    return rc;
-}
-
-/* InitNode
- */
-rc_t PTrieInitNode ( const PTrie *self, PTTrans *trans, uint32_t idx )
-{
-    rc_t rc;
-    uint32_t tcnt;
-    const uint8_t *align2;
-
-    assert ( self != NULL );
-    assert ( trans != NULL );
-
-    if ( idx == 0 )
-        return RC ( rcCont, rcNode, rcConstructing, rcId, rcNull );
-    if ( idx > self -> num_trans )
-        return RC ( rcCont, rcNode, rcConstructing, rcId, rcNotFound );
-
-    /* record node id */
-    trans -> tid = idx;
-
-    /* no backtrace link yet assigned */
-    trans -> back = NULL;
-
-    /* nobody is linked to us yet */
-    trans -> refcount = 0;
-
-    /* initialize the trans' index member */
-    trans -> idx . v32 =
-        & self -> data [ PTrieGetNodeOff ( self, idx - 1 ) ];
-    assert ( ( ( size_t ) trans -> idx . v8 & 3 ) == 0 );
-
-    /* can now access header values within index */
-    trans -> tcnt = PTTransGetIdx ( trans, self, pttHdrTransCnt );
-    trans -> icnt = PTTransGetIdx ( trans, self, pttHdrIdxCnt );
-
-    /* if the icnt is zero, the original child array was NULL */
-    if ( trans -> icnt == 0 )
-    {
-        trans -> slen = tcnt = 0;
-        trans -> child_seq_type = NULL;
-
-        /* get unaligned dad pointer */
-        trans -> dad . v8 =
-            PTTransGetIdxAddr ( trans, self, pttHdrNullEnd );
-   }
-    else
-    {
-        tcnt = PTTransGetIdx ( trans, self, pttHdrChildCnt );
-        trans -> slen = PTTransGetIdx ( trans, self, pttHdrSeqLen );
-
-        /* sequence type */
-        trans -> child_seq_type =
-            PTTransGetIdxAddr ( trans, self, pttFirstIdx + trans -> icnt );
-
-        /* unaligned dad pointer */
-        trans -> dad . v8 = & trans -> child_seq_type [ ( trans -> slen + 7 ) >> 3 ];
-    }
-
-    /* align dad and get child pointer */
-    trans -> child . v8 = PTTransAlignDadAddr ( trans, self );
-
-    /* location of align2 */
-    align2 = PTTransGetChildAddr ( trans, self, tcnt );
-
-    /* NULL out dad pointer if no backtrace */
-    if ( ! self -> backtrace )
-        trans -> dad . v8 = NULL;
-
-    /* NULL out child pointer if no transitions */
-    if ( trans -> icnt == 0 )
-        trans -> child . v8 = NULL;
-
-    /* finally, look at align for boolean */
-    if ( ( ( size_t ) align2 & 3 ) != 0 )
-    {
-        if ( align2 [ 0 ] == 0 )
-        {
-            trans -> vals = NULL;
-            return 0;
-        }
-
-        * ( size_t* ) & align2 |= 3;
-        ++ align2;
-    }
-
-    /* to avoid an allocation, mimic the older behavior
-       that used persisted data directly as a PBSTree
-       and had no allocation. we introduced a wrapper
-       object in order to have a vtable for byte-swapping,
-       and this disturbs the older code. */
-    trans -> vals = & trans -> _val;
-
-    rc = self -> byteswap ?
-        PBSTreeMakeSwapped ( & trans -> _val, align2, 0 ):
-        PBSTreeMakeNative ( & trans -> _val, align2, 0 );
-    if ( rc == 0 )
-    {
-        if ( PBSTreeCount ( trans -> vals ) == 0 )
-        {
-            trans -> vals = NULL;
-        }
-    }
-    return rc;
-}
-
-/* MakeNode
- */
-rc_t PTrieMakeNode ( const PTrie *self, PTTrans **transp, uint32_t idx )
-{
-    rc_t rc;
-
-    PTTrans *trans = malloc ( sizeof * trans );
-    if ( trans == NULL )
-        return RC ( rcCont, rcNode, rcAllocating, rcMemory, rcExhausted );
-
-    assert ( transp != NULL );
-    rc = PTrieInitNode ( self, * transp = trans, idx );
-    if ( rc != 0 )
-        free ( trans );
-
-    return rc;
-}
-
-/* MapChar
- *  maps a character to a one-based character code
- */
-static
-uint32_t PTrieMapChar ( const PTrie *tt, uint32_t ch )
-{
-  if ( ch >= tt -> first_char && ch <= tt -> last_char )
-    return tt -> map [ ch - tt -> first_char ];
-    return tt -> unmapped_idx;
-}
-
-/* NextIdx
- *  pops a character from key string
- *  maps it to an index
- */
-static
-rc_t PTrieNextIdx ( const PTrie *tt, String *key, uint32_t *idx )
-{
-    uint32_t ch;
-    rc_t rc = StringPopHead ( key, & ch );
-    if ( rc == 0 )
-        * idx = PTrieMapChar ( tt, ch );
-    return rc;
-}
-
-/* FindTrans
- */
-static
-rc_t PTrieFindTrans ( const PTrie *self, String *key, PTTrans **transp )
-{
-    rc_t rc;
-
-    PTTrans *dad;
-    uint32_t tid;
-    uint32_t key_idx;
-
-    for ( dad = NULL, key_idx = 0, rc = PTrieMakeNode ( self, transp, 1 );
-          rc == 0; rc = PTrieMakeNode ( self, transp, tid ) )
-    {
-        PTTrans *trans = * transp;
-
-        /* link in dad */
-        trans -> back = dad;
-#if ! RECORD_HDR_IDX
-        trans -> tidx = key_idx;
-#endif
-        if ( dad != NULL )
-        {
-#if ! RECORD_HDR_DEPTH
-            trans -> depth = dad -> depth + 1;
-#endif
-            ++ dad -> refcount;
-        }
-#if ! RECORD_HDR_DEPTH
-        else
-        {
-            trans -> depth = 0;
-        }
-#endif
-
-        /* if there are no child transitions,
-           this must be the node */
-        if ( trans -> icnt == 0 )
-            return 0;
-
-        /* capture dad for next loop
-           or for failure cleanup */
-        dad = trans;
-
-        /* get transition index for character */
-        rc = PTrieNextIdx ( self, key, & key_idx );
-        if ( rc != 0 )
-        {
-            /* end of string */
-            if ( GetRCState ( rc ) == rcEmpty )
-                return 0;
-
-            /* invalid input */
-            break;
-        }
-
-        /* either an unrecognized character or
-           a NULL transition mean NOT FOUND */
-        rc = RC ( rcCont, rcTrie, rcSelecting, rcString, rcNotFound );
-
-        /* check for inability to take transition */
-        if ( key_idx == 0 )
-            break;
-
-        /* try to take transition */
-        tid = PTTransGetChildChildIdx ( trans, self, -- key_idx );
-        if ( tid == 0 )
-            break;
-
-        /* convert the child transition index into a trans id */
-        tid = PTTransGetChild ( trans, self, tid - 1 ) + 1;
-    }
-
-    PTTransWhack ( dad );
-    return rc;
-}
-
-/* Find
- * PTrieFindRE
- *  find a single { id, value } pair  within tree
- *
- *  "item" [ IN ] - an exact match text string
- *
- *  "re" [ IN ] - a regular expression string
- *
- *  "rtn" [ OUT ] - return parameter for node if found.
- *  its value is undefined unless the function returns success.
- *
- *  return value:
- *    0    => not found
- *    1..n => id of found pair
- */
-static
-int CC PTNodeFindExact ( const void *ignore, const PBSTNode *n , void * data)
-{
-    assert ( n -> data . addr != NULL );
-    assert ( n -> data . size > 0 );
-
-    if ( ( ( const char* ) n -> data . addr ) [ 0 ] == 0 )
-        return 0;
-    return -1;
-}
-
-static
-int CC PTNodeFindRem ( const void *item, const PBSTNode *n, void * data )
-{
-    /* compare the remainder of the key */
-    const String *rem = item;
-    int diff = string_cmp ( rem -> addr, rem -> size,
-        n -> data . addr, n -> data . size, rem -> len );
-
-    /* if they differed within the key length, it could
-       be that the node is shorter or that there was a
-       character mismatch */
-    if ( diff != 0 )
-        return diff;
-
-    /* the only thing to ascertain now
-       is that the lengths are equal */
-    if ( ( ( const char* ) n -> data . addr ) [ rem -> size ] == 0 )
-        return 0;
-
-    /* the key is shorter */
-    return -1;
-}
-
-LIB_EXPORT uint32_t CC PTrieFind ( const PTrie *self, const String *item, PTNode *rtn,
-        int ( CC * custom_cmp ) ( const void *item, const PBSTNode *n, void *data ), void *data )
-{
-
-    if ( rtn == NULL )
-        return 0;
-
-    rtn -> data . addr = rtn -> internal = NULL;
-    rtn -> data . size = 0;
-    rtn -> id = 0;
-
-    if ( self != NULL && item != NULL && self -> num_trans != 0 && item -> len != 0 )
-    {
-        String key = * item;
-
-        PTTrans *trans;
-        rc_t rc = PTrieFindTrans ( self, & key, & trans );
-
-        if ( rc == 0 )
-        {
-            /* any values in b-tree? */
-            if ( trans -> vals != NULL )
-            {
-                int ( CC * cmp ) ( const void *item, const PBSTNode *n, void *data );
-                
-                if ( custom_cmp != NULL)
-                    cmp = custom_cmp;
-                else if ( self -> ext_keys )
-                    cmp = NULL;
-                /* for exact match on node */
-                else if ( key . len == 0 )
-                    cmp = PTNodeFindExact;
-                /* for remainder */
-                else
-                    cmp = PTNodeFindRem;
-
-                /* try to find the node */
-                if ( cmp != NULL )
-                {
-                    PBSTNode btnode;
-                    uint32_t btid = PBSTreeFind ( trans -> vals, & btnode, & key, cmp, data );
-                    if ( btid != 0 )
-                    {
-                        /* grab the data */
-                        rtn -> data . addr = btnode . data . addr;
-                        rtn -> data . size = btnode . data . size;
-
-                        /* record reference to self */
-                        rtn -> internal = self;
-
-                        /* set an id */
-                        rtn -> id = PTrieEncodeNodeId ( self,
-                            trans -> tid, btid );
-
-                        /* adjust the data block for internal keys */
-                        if ( ! self -> ext_keys )
-                        {
-                            const char *ptr = ( const char* ) rtn -> data . addr;
-                            for ( ; rtn -> data . size > 1 && * ptr != '\0'; ++ ptr, -- rtn -> data . size )
-                                ( void ) 0;
-                            rtn -> data . addr = ptr + 1; /* skip terminating NUL byte */
-                            -- rtn -> data.size;
-                        }
-                    }
-                }
-            }
-
-            PTTransWhack ( trans );
-        }
-    }
-
-    return rtn -> id;
-}
-
-LIB_EXPORT uint32_t CC PTrieFindRE ( const PTrie *self, const String *re, PTNode *rtn );
-
-/* FindAll
- * PTrieFindAllRE
- *  find multiple objects within tree
- *
- *  "key" [ IN ] - an exact match text string
- *
- *  "re" [ IN ] - a regular expression string
- *
- *  "buffer" [ OUT ] and "capacity" [ IN ] - a user-supplied
- *  array of PTNode with a capacity of "capacity" elements.
- *  if successful, the entire found set will be returned unordered within.
- *
- *  "num_found" [ OUT ] - indicates the size of the found set,
- *  regardless of return value, such that if the supplied
- *  buffer were to be too small, the required size is returned.
- *
- *  returns status codes:
- *    EINVAL  => an invalid parameter
- *    ENOENT  => the found set was empty
- *    ENOBUFS => the found set was too large
- */
-LIB_EXPORT rc_t CC PTrieFindAll ( const PTrie *self, struct String const *key,
-    PTNode buffer [], uint32_t capacity, uint32_t *num_found,
-    int ( CC * custom_cmp ) ( const void *item, const PBSTNode *n, void *data ), void *data );
-
-LIB_EXPORT rc_t CC PTrieFindAllRE ( const PTrie *self, const String *re,
-    PTNode buffer [], uint32_t capacity, uint32_t *num_found );
-
-/* ForEach
- *  executes a function on each tree element
- *
- *  "f" [ IN ] and "data" [ IN ] - iteration callback function for
- *  examining each TTNode in the tree
- */
-typedef struct PTrieForEachData PTrieForEachData;
-struct PTrieForEachData
-{
-    const PTrie *tt;
-    void ( CC * f ) ( PTNode *n, void *data );
-    void *data;
-    uint32_t tid;
-};
-
-static
-void CC PTrieRunForEachVal ( PBSTNode *btn, void *data )
-{
-    PTNode ttn;
-    PTrieForEachData *pb = data;
-
-    ttn . data . addr = btn -> data . addr;
-    ttn . data . size = btn -> data . size;
-    ttn . internal = pb -> tt;
-    ttn . id = PTrieEncodeNodeId ( pb -> tt, pb -> tid, btn -> id );
-
-    if ( ! pb -> tt -> ext_keys )
-    {
-        size_t sz = strlen ( ttn . data . addr ) + 1;
-        assert ( sz <= ttn . data . size );
-        ttn . data . addr =
-            ( const char* ) ttn . data . addr + sz;
-        ttn . data . size -= sz;
-    }
-
-    ( * pb -> f ) ( & ttn, pb -> data );
-}
-
-static
-void PTrieRunForEachTrans ( const PTTrans *trans, const PTrie *tt, void *data )
-{
-    if ( trans -> vals != NULL )
-    {
-        PTrieForEachData *pb = data;
-        pb -> tid = trans -> tid;
-        PBSTreeForEach ( trans -> vals, 0, PTrieRunForEachVal, pb );
-    }
-}
-
-LIB_EXPORT void CC PTrieForEach ( const PTrie *self,
-    void ( CC * f ) ( PTNode *n, void *data ), void *data )
-{
-  if ( self != NULL && f != NULL && self -> num_trans != 0 )
-    {
-        PTTrans trans;
-        int status = PTrieInitNode ( self, & trans, 1 );
-        if ( status == 0 )
-        {
-            PTrieForEachData pb;
-            pb . tt = self;
-            pb . f = f;
-            pb . data = data;
-
-            PTTransForEach ( & trans, self, PTrieRunForEachTrans, & pb );
-        }
-    }
-}
-
-/* DoUntil
- *  executes a function on each tree element
- *  until the function returns true
- *
- *  "f" [ IN ] and "data" [ IN ] - iteration callback function for
- *  examining each TTNode in the tree. the function returns "true"
- *  to halt iteration.
- *
- *  return values:
- *    the last value returned by "f" or false if never invoked
- */
-typedef struct PTrieDoUntilData PTrieDoUntilData;
-struct PTrieDoUntilData
-{
-    const PTrie *tt;
-    bool ( CC * f ) ( PTNode *n, void *data );
-    void *data;
-    uint32_t tid;
-};
-
-static
-bool CC PTrieRunDoUntilVal ( PBSTNode *btn, void *data )
-{
-    PTNode ttn;
-    PTrieDoUntilData *pb = data;
-
-    ttn . data . addr = btn -> data . addr;
-    ttn . data . size = btn -> data . size;
-    ttn . internal = pb -> tt;
-    ttn . id = PTrieEncodeNodeId ( pb -> tt, pb -> tid, btn -> id );
-
-    if ( ! pb -> tt -> ext_keys )
-    {
-        size_t sz = strlen ( ttn . data . addr ) + 1;
-        assert ( sz <= ttn . data . size );
-        ttn . data . addr =
-            ( const char* ) ttn . data . addr + sz;
-        ttn . data . size -= sz;
-    }
-
-    return ( * pb -> f ) ( & ttn, pb -> data );
-}
-
-static
-bool PTrieRunDoUntilTrans ( const PTTrans *trans, const PTrie *tt, void *data )
-{
-    if ( trans -> vals != NULL )
-    {
-        PTrieDoUntilData *pb = data;
-        pb -> tid = trans -> tid;
-        return PBSTreeDoUntil ( trans -> vals, 0, PTrieRunDoUntilVal, pb );
-    }
-    return false;
-}
-
-LIB_EXPORT bool CC PTrieDoUntil ( const PTrie *self,
-    bool ( CC * f ) ( PTNode *n, void *data ), void *data )
-{
-  if ( self != NULL && f != NULL && self -> num_trans != 0 )
-    {
-        PTTrans trans;
-        rc_t rc = PTrieInitNode ( self, & trans, 1 );
-        if ( rc == 0 )
-        {
-            PTrieDoUntilData pb;
-            pb . tt = self;
-            pb . f = f;
-            pb . data = data;
-
-            return PTTransDoUntil ( & trans, self, PTrieRunDoUntilTrans, & pb );
-        }
-    }
-    return false;
-}
-
-/* Whack
- *  tears down internal structure
- */
-LIB_EXPORT void CC PTrieWhack ( PTrie *self )
-{
-    if ( self != NULL )
-        free ( self );
-}
diff --git a/libs/klib/qsort.c b/libs/klib/qsort.c
deleted file mode 100644
index 2945818..0000000
--- a/libs/klib/qsort.c
+++ /dev/null
@@ -1,311 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <klib/extern.h>
-#include <klib/sort.h>
-#include <sysalloc.h>
-
-/* Copyright (C) 1991,1992,1996,1997,1999,2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Written by Douglas C. Schmidt (schmidt at ics.uci.edu).
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* If you consider tuning this algorithm, you should consult first:
-   Engineering a sort function; Jon Bentley and M. Douglas McIlroy;
-   Software - Practice and Experience; Vol. 23 (11), 1249-1265, 1993.  */
-
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-
-/* Byte-wise swap two items of size SIZE. */
-#define SWAP(a, b, size)                        \
-    do                                          \
-    {                                           \
-        register size_t __size = (size);        \
-        register char *__a = (a), *__b = (b);   \
-        do                                      \
-        {                                       \
-            char __tmp = *__a;                  \
-            *__a++ = *__b;                      \
-            *__b++ = __tmp;                     \
-        } while (--__size > 0);                 \
-    } while (0)
-
-/* Discontinue quicksort algorithm when partition gets below this size.
-   This particular magic number was chosen to work best on a Sun 4/260. */
-#define MAX_THRESH 4
-
-/* Stack node declarations used to store unfulfilled partition obligations. */
-typedef struct
-{
-    char *lo;
-    char *hi;
-} stack_node;
-
-/* The next 4 #defines implement a very fast in-line stack abstraction. */
-/* The stack needs log (total_elements) entries (we could even subtract
-   log(MAX_THRESH)).  Since total_elements has type size_t, we get as
-   upper bound for log (total_elements):
-   bits per byte (CHAR_BIT) * sizeof(size_t).  */
-#define STACK_SIZE	(CHAR_BIT * sizeof(size_t))
-#define PUSH(low, high)	((void) ((top->lo = (low)), (top->hi = (high)), ++top))
-#define	POP(low, high)	((void) (--top, (low = top->lo), (high = top->hi)))
-#define	STACK_NOT_EMPTY	(stack < top)
-
-
-/* Order size using quicksort.  This implementation incorporates
-   four optimizations discussed in Sedgewick:
-
-   1. Non-recursive, using an explicit stack of pointer that store the
-   next array partition to sort.  To save time, this maximum amount
-   of space required to store an array of SIZE_MAX is allocated on the
-   stack.  Assuming a 32-bit (64 bit) integer for size_t, this needs
-   only 32 * sizeof(stack_node) == 256 bytes (for 64 bit: 1024 bytes).
-   Pretty cheap, actually.
-
-   2. Chose the pivot element using a median-of-three decision tree.
-   This reduces the probability of selecting a bad pivot value and
-   eliminates certain extraneous comparisons.
-
-   3. Only quicksorts TOTAL_ELEMS / MAX_THRESH partitions, leaving
-   insertion sort to order the MAX_THRESH items within each partition.
-   This is a big win, since insertion sort is faster for small, mostly
-   sorted array segments.
-
-   4. The larger of the two sub-partitions is always pushed onto the
-   stack first, with the algorithm then concentrating on the
-   smaller partition.  This *guarantees* no more than log (total_elems)
-   stack size is needed (actually O(1) in this case)!  */
-
-LIB_EXPORT void CC ksort ( void *pbase, size_t total_elems, size_t size,
-    int ( CC * cmp ) ( const void*, const void*, void *data ), void *data )
-{
-    register char *base_ptr = (char *) pbase;
-
-    const size_t max_thresh = MAX_THRESH * size;
-
-    /* NEW - NCBI ... avoid sorting a single element */
-    if (total_elems < 2)
-        /* Avoid lossage with unsigned arithmetic below.  */
-        return;
-
-    if (total_elems > MAX_THRESH)
-    {
-        char *lo = base_ptr;
-        char *hi = &lo[size * (total_elems - 1)];
-        stack_node stack[STACK_SIZE];
-        stack_node *top = stack;
-
-        PUSH (NULL, NULL);
-
-        while (STACK_NOT_EMPTY)
-        {
-            char *left_ptr;
-            char *right_ptr;
-
-            /* Select median value from among LO, MID, and HI. Rearrange
-               LO and HI so the three values are sorted. This lowers the
-               probability of picking a pathological pivot value and
-               skips a comparison for both the LEFT_PTR and RIGHT_PTR in
-               the while loops. */
-
-            char *mid = lo + size * ((hi - lo) / size >> 1);
-
-            if ((*cmp) ((void *) mid, (void *) lo, data) < 0)
-                SWAP (mid, lo, size);
-            if ((*cmp) ((void *) hi, (void *) mid, data) < 0)
-                SWAP (mid, hi, size);
-            else
-                goto jump_over;
-            if ((*cmp) ((void *) mid, (void *) lo, data) < 0)
-                SWAP (mid, lo, size);
-        jump_over:;
-
-            left_ptr  = lo + size;
-            right_ptr = hi - size;
-
-            /* Here's the famous ``collapse the walls'' section of quicksort.
-               Gotta like those tight inner loops!  They are the main reason
-               that this algorithm runs much faster than others. */
-            do
-            {
-                while ((*cmp) ((void *) left_ptr, (void *) mid, data) < 0)
-                    left_ptr += size;
-
-                while ((*cmp) ((void *) mid, (void *) right_ptr, data) < 0)
-                    right_ptr -= size;
-
-                if (left_ptr < right_ptr)
-                {
-                    SWAP (left_ptr, right_ptr, size);
-                    if (mid == left_ptr)
-                        mid = right_ptr;
-                    else if (mid == right_ptr)
-                        mid = left_ptr;
-                    left_ptr += size;
-                    right_ptr -= size;
-                }
-                else if (left_ptr == right_ptr)
-                {
-                    left_ptr += size;
-                    right_ptr -= size;
-                    break;
-                }
-            }
-            while (left_ptr <= right_ptr);
-
-            /* Set up pointers for next iteration.  First determine whether
-               left and right partitions are below the threshold size.  If so,
-               ignore one or both.  Otherwise, push the larger partition's
-               bounds on the stack and continue sorting the smaller one. */
-
-            if ((size_t) (right_ptr - lo) <= max_thresh)
-            {
-                if ((size_t) (hi - left_ptr) <= max_thresh)
-                    /* Ignore both small partitions. */
-                    POP (lo, hi);
-                else
-                    /* Ignore small left partition. */
-                    lo = left_ptr;
-            }
-            else if ((size_t) (hi - left_ptr) <= max_thresh)
-                /* Ignore small right partition. */
-                hi = right_ptr;
-            else if ((right_ptr - lo) > (hi - left_ptr))
-            {
-                /* Push larger left partition indices. */
-                PUSH (lo, right_ptr);
-                lo = left_ptr;
-            }
-            else
-            {
-                /* Push larger right partition indices. */
-                PUSH (left_ptr, hi);
-                hi = right_ptr;
-            }
-        }
-    }
-
-    /* Once the BASE_PTR array is partially sorted by quicksort the rest
-       is completely sorted using insertion sort, since this is efficient
-       for partitions below MAX_THRESH size. BASE_PTR points to the beginning
-       of the array to sort, and END_PTR points at the very last element in
-       the array (*not* one beyond it!). */
-
-#undef min
-#define min(x, y) ((x) < (y) ? (x) : (y))
-
-    {
-        char *const end_ptr = &base_ptr[size * (total_elems - 1)];
-        char *tmp_ptr = base_ptr;
-        char *thresh = min(end_ptr, base_ptr + max_thresh);
-        register char *run_ptr;
-
-        /* Find smallest element in first threshold and place it at the
-           array's beginning.  This is the smallest array element,
-           and the operation speeds up insertion sort's inner loop. */
-
-        for (run_ptr = tmp_ptr + size; run_ptr <= thresh; run_ptr += size)
-            if ((*cmp) ((void *) run_ptr, (void *) tmp_ptr, data) < 0)
-                tmp_ptr = run_ptr;
-
-        if (tmp_ptr != base_ptr)
-            SWAP (tmp_ptr, base_ptr, size);
-
-        /* Insertion sort, running from left-hand-side up to right-hand-side.  */
-
-#if 1
-        /* NEW - NCBI */
-        tmp_ptr = base_ptr + size;
-        for ( run_ptr = base_ptr + size + size; run_ptr <= end_ptr; tmp_ptr = run_ptr, run_ptr += size )
-        {
-            for ( ; tmp_ptr >= base_ptr; tmp_ptr -= size )
-            {
-                if ( ( * cmp ) ( run_ptr, tmp_ptr, data ) >= 0 )
-                    break;
-            }
-
-            tmp_ptr += size;
-            if ( tmp_ptr != run_ptr )
-            {
-                char *trav;
-
-                trav = run_ptr + size;
-                while (--trav >= run_ptr)
-                {
-                    char c = *trav;
-                    char *hi, *lo;
-
-                    for (hi = lo = trav; (lo -= size) >= tmp_ptr; hi = lo)
-                        *hi = *lo;
-                    *hi = c;
-                }
-            }
-        }
-
-#else
-        run_ptr = base_ptr + size;
-        while ((run_ptr += size) <= end_ptr)
-        {
-            tmp_ptr = run_ptr - size;
-            while ((*cmp) ((void *) run_ptr, (void *) tmp_ptr, data) < 0)
-                tmp_ptr -= size;
-
-            tmp_ptr += size;
-            if (tmp_ptr != run_ptr)
-            {
-                char *trav;
-
-                trav = run_ptr + size;
-                while (--trav >= run_ptr)
-                {
-                    char c = *trav;
-                    char *hi, *lo;
-
-                    for (hi = lo = trav; (lo -= size) >= tmp_ptr; hi = lo)
-                        *hi = *lo;
-                    *hi = c;
-                }
-            }
-        }
-#endif
-    }
-}
diff --git a/libs/klib/rc-idx-tbl.c b/libs/klib/rc-idx-tbl.c
deleted file mode 100644
index a851807..0000000
--- a/libs/klib/rc-idx-tbl.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*==============================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-* Is used in XML logging to generate RC-derived attributes
-*/
-
-#define RC_ENUM( type ) \
-    const char *g ## type ##Idx_str [] =
-
-#define RC_ENTRY( id, txt ) # id ,
-
-#define RC_VLAST( id )
-
-#define RC_LAST( id ) NULL
-
-#include <klib/rc.h>
-
-/* EOF */
diff --git a/libs/klib/rc-tbl.c b/libs/klib/rc-tbl.c
deleted file mode 100644
index e09543f..0000000
--- a/libs/klib/rc-tbl.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#define RC_ENUM( type ) \
-    const char *g ## type ##_str [] =
-
-#define RC_ENTRY( id, txt ) txt,
-
-#define RC_VLAST( id )
-
-#define RC_LAST( id ) NULL
-
-#include <klib/rc.h>
diff --git a/libs/klib/refcount.c b/libs/klib/refcount.c
deleted file mode 100644
index 2a94629..0000000
--- a/libs/klib/refcount.c
+++ /dev/null
@@ -1,499 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#define TRACK_REFERENCES 1
-#define INLINE_REFCOUNT 0
-
-#include <klib/extern.h>
-
-#include <klib/refcount.h>
-#include <klib/log.h>
-#include <atomic32.h>
-
-#include <sysalloc.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <assert.h>
-
-/* the simple atomic32_dec_and_test interface does not detect
-   crossing to negative. better said, it internally detects the
-   event but does not pay for setting a tri-state return value
-   on exit, opting instead to only detect the zero crossing. */
-#ifndef DETECT_ZERO_STATE
-#define DETECT_ZERO_STATE 1
-#endif
-
-/* the simple atomic32_inc interface does not detect rollover */
-#ifndef DETECT_LIMIT_VIOLATION
-#define DETECT_LIMIT_VIOLATION 1
-#endif
-
-/* this is in here to detect if the refcount is above a certain value 
-   introduced to debug heap corruption in the windows-build */
-#define MAX_REFCOUNT_VALUE 1000
-#ifndef DETECT_MAX_REFCOUNT_VIOLATION
-#define DETECT_MAX_REFCOUNT_VIOLATION 1
-#endif
-
-
-#define DUAL_OWN_BITS 16
-#define DUAL_DEP_BITS ( 32 - DUAL_OWN_BITS )
-#define DUAL_OWN_VAL ( 1 << DUAL_DEP_BITS )
-#define DUAL_DEP_VAL 1
-#define DUAL_OWN_MAX ( ( 1 << ( DUAL_OWN_BITS - 1 ) ) - 1 )
-#define DUAL_DEP_MAX ( ( 1 << ( DUAL_DEP_BITS - 1 ) ) - 1 )
-#define DUAL_OWN_LIM ( DUAL_OWN_MAX << DUAL_DEP_BITS )
-#define DUAL_DEP_LIM DUAL_DEP_MAX
-#define DUAL_OWN_MASK ( ( 1 << DUAL_OWN_BITS ) - 1 )
-#define DUAL_DEP_MASK ( ( 1 << DUAL_DEP_BITS ) - 1 )
-
-/*--------------------------------------------------------------------------
- * KRefcount
- *  signed 32-bit reference counter
- * KDualRef
- *  dual signed/unsigned 16-bit reference counter
- */
-
-
-/* Init
- *  initialize a refcount object
- *
- *  "refcount" [ IN/OUT ] - pointer to object being initialized
- *
- *  "value" [ IN ] - initial refcount value
- *    -OR-
- *  "owned" [ IN ] and "dep" [ IN ] - owned and dependent counts
- *  function will return krefLimit if counts exceed limits
- *
- *  "clsname" [ IN ] - NUL-terminated string stating classname
- *  of object instance being initialized.
- *
- *  "op" [ IN ] - NUL-terminated string stating construction operation
- *
- *  "name" [ IN ] - NUL-terminated name of instance
- */
-#if ! INLINE_REFCOUNT
-LIB_EXPORT void CC KRefcountInit ( KRefcount *refcount, int value,
-    const char *clsname, const char *op, const char *name )
-{
-    REFNEW ( clsname, op, name, refcount, value );
-    atomic32_set ( refcount, value );
-}
-#endif
-
-LIB_EXPORT int CC KDualRefInit ( KDualRef *refcount, int owned, int dep,
-    const char *clsname, const char *op, const char *name )
-{
-    int value = owned << DUAL_DEP_BITS | dep;
-
-#if DETECT_LIMIT_VIOLATION
-    if ( owned < 0 || owned > DUAL_OWN_MAX ||
-         dep < 0 || dep > DUAL_DEP_MAX )
-    {
-        DBGMSG ( DBG_REF, DBG_REF_PLACEHOLDER,
-                 ( "FAILED TO CREATE %s, operation %s, name '%s', instance $0x%p: initial refcounts 0x%x, 0x%x",
-                   clsname, op, name, refcount, owned, dep ) );
-        return krefLimit;
-    }
-#endif
-
-    REFNEW ( clsname, op, name, refcount, value );
-    atomic32_set ( refcount, value );
-    return krefOkay;
-}
-
-
-/* Whack
- *  tear down whatever was built up in object
- */
-#if ! INLINE_REFCOUNT
-LIB_EXPORT void CC KRefcountWhack ( KRefcount *self, const char *clsname )
-{
-    REFMSG ( clsname, "whack", self );
-}
-#endif
-
-LIB_EXPORT void CC KDualRefWhack ( KDualRef *self, const char *clsname )
-{
-    REFMSG ( clsname, "whack", self );
-}
-
-
-/* Add
- *  add an owned reference
- *  returns enum value indicating action to be taken
- *
- *  inline implementation always returns krefOkay.
- *
- *  linked-in implementation may return any of the following
- *  codes, depending upon how it was compiled:
- *    krefOkay     : reference was successfully added
- *    krefZero     : reference was added, but prior value was zero
- *    krefLimit    : reference was NOT added, too many references
- *    krefNegative : reference was NOT added, prior value was negative
- */
-#if ! INLINE_REFCOUNT
-LIB_EXPORT int CC KRefcountAdd ( const KRefcount *self, const char *clsname )
-{
-#if DETECT_ZERO_STATE
-    int prior = atomic32_read_and_add_ge ( ( KRefcount* ) self, 1, 0 );
-    if ( prior < 0 )
-    {
-        DBGMSG ( DBG_REF, DBG_REF_PLACEHOLDER,
-                 ( "FAILED to addref %s instance 0x%p: prior refcount = 0x%x",
-                   clsname, self, prior ) );
-        return krefNegative;
-    }
-    if ( prior == 0 )
-    {
-#if 0 /*** disabling this warning since code is noe initializing refcount to zero in several places ***/
-        DBGMSG ( DBG_REF, DBG_REF_PLACEHOLDER,
-                 ( "about to addref %s instance 0x%p: prior refcount = 0x%x",
-                   clsname, self, prior ) );
-#endif
-        return krefZero;
-    }
-
-#if DETECT_LIMIT_VIOLATION
-    if ( prior == INT_MAX )
-    {
-        atomic32_dec ( ( KRefcount* ) self );
-        DBGMSG ( DBG_REF, DBG_REF_PLACEHOLDER,
-                 ( "FAILED to addref %s instance 0x%p: prior refcount = 0x%x",
-                   clsname, self, prior ) );
-        return krefLimit;
-    }
-#endif
-
-    CNTMSG ( clsname, "addref", self, prior );
-
-#elif DETECT_LIMIT_VIOLATION
-    unsigned int prior = atomic32_read_and_add_lt ( ( KRefcount* ) self, 1, INT_MAX );
-    if ( prior >= INT_MAX )
-    {
-        DBGMSG ( DBG_REF, DBG_REF_PLACEHOLDER,
-                 ( "FAILED to addref %s instance 0x%p: prior refcount = 0x%x",
-                   clsname, self, prior ) );
-        return krefLimit;
-    }
-    CNTMSG ( clsname, "addref", self, prior );
-#else
-    REFMSG ( clsname, "addref", self );
-    atomic32_inc ( ( KRefcount* ) ( self ) );
-#endif
-
-    return krefOkay;
-}
-#endif
-
-LIB_EXPORT int CC KDualRefAdd ( const KDualRef *self, const char *clsname )
-{
-#if DETECT_LIMIT_VIOLATION
-    unsigned int prior = atomic32_read_and_add_lt ( ( KDualRef* ) self, DUAL_OWN_VAL, DUAL_OWN_LIM );
-#if DETECT_ZERO_STATE
-    unsigned int owned = prior >> DUAL_DEP_BITS;
-    if ( owned > DUAL_OWN_MAX )
-    {
-        DBGMSG ( DBG_REF, DBG_REF_PLACEHOLDER, 
-                  ( "FAILED to addref %s instance 0x%p: prior refcount = 0x%x",
-                    clsname, self, prior ));
-        return krefNegative;
-    }
-    if ( prior == 0 )
-    {
-        DBGMSG ( DBG_REF, DBG_REF_PLACEHOLDER, 
-                 ( "about to addref %s instance 0x%p: prior refcount = 0x%x",
-                    clsname, self, prior ) );
-        return krefZero;
-    }
-#endif
-    if ( prior >= DUAL_OWN_LIM )
-    {
-        DBGMSG ( DBG_REF, DBG_REF_PLACEHOLDER, 
-                  ( "FAILED to addref %s instance 0x%p: prior refcount = 0x0%x",
-                    clsname, self, prior ));
-        return krefLimit;
-    }
-    CNTMSG ( clsname, "addref", self, prior );
-#elif DETECT_ZERO_STATE
-    unsigned int prior = atomic32_read_and_add ( ( KDualRef* ) self, DUAL_OWN_VAL );
-    unsigned int owned = prior >> DUAL_DEP_BITS;
-    if ( owned > DUAL_OWN_MAX )
-    {
-        DBGMSG ( DBG_REF, DBG_REF_PLACEHOLDER,
-                  ( "FAILED to addref %s instance %0x%p: prior refcount = 0x%x",
-                    clsname, self, prior ));
-        return krefNegative;
-    }
-    if ( prior == 0 )
-    {
-        DBGMSG ( DBG_REF, DBG_REF_PLACEHOLDER,
-                  ( "about to addref %s instance %0x%p: prior refcount = 0x%x",
-                    clsname, self, prior ));
-        return krefZero;
-    }
-    CNTMSG ( clsname, "addref", self, prior );
-#else
-    REFMSG ( clsname, "addref", self );
-    atomic32_add ( ( KDualRef* ) ( self ), DUAL_OWN_VAL );
-#endif
-    return krefOkay;
-}
-
-
-/* Drop
- *  drop an owned reference
- *  returns enum value indicating action to be taken
- *
- *  inline implementation returns:
- *    krefOkay     : reference was successfully dropped
- *    krefWhack    : all references are gone and object can be collected
- *
- *  linked-in implementation may return any of the following
- *  codes, depending upon how it was compiled:
- *    krefOkay     : reference was successfully dropped
- *    krefWhack    : all references are gone and object can be collected
- *    krefZero     : reference was dropped, and no further owned refernces exist
- *    krefNegative : reference was NOT dropped, as resultant count would be negative
- */
-#if ! INLINE_REFCOUNT
-LIB_EXPORT int CC KRefcountDrop ( const KRefcount *self, const char *clsname )
-{
-#if DETECT_ZERO_STATE
-    int prior = atomic32_read_and_add ( ( KRefcount* ) self, -1 );
-    if ( prior <= 0 )
-    {
-        DBGMSG ( DBG_REF, DBG_REF_PLACEHOLDER,
-                 ( "FAILED to release %s instance 0x%p: prior refcount = 0x%x",
-                   clsname, self, prior ) );
-        return krefNegative;
-    }
-    CNTMSG ( clsname, "release", self, prior );
-    if ( prior == 1 )
-        return krefWhack;
-#else
-    REFMSG ( clsname, "release", self );
-    if ( atomic32_dec_and_test ( ( KRefcount* ) ( self ) ) )
-        return krefWhack;
-#endif
-    return krefOkay;
-}
-#endif
-
-LIB_EXPORT int CC KDualRefDrop ( const KDualRef *self, const char *clsname )
-{
-    int prior = atomic32_read_and_add_ge ( ( KDualRef* ) self, - DUAL_OWN_VAL, DUAL_OWN_VAL );
-#if DETECT_ZERO_STATE
-    if ( prior < DUAL_OWN_VAL )
-    {
-        DBGMSG ( DBG_REF, DBG_REF_PLACEHOLDER,
-                 ( "FAILED to release %s instance 0x%p: prior refcount = 0x%x",
-                   clsname, self, prior ) );
-        return krefNegative;
-    }
-#endif
-    CNTMSG ( clsname, "release", self, prior );
-    if ( prior == DUAL_OWN_VAL )
-        return krefWhack;
-    if ( ( prior >> DUAL_DEP_BITS ) == 0 )
-        return krefZero;
-    return krefOkay;
-}
-
-
-/* AddDep
- *  adds a dependency reference
- *  returns enum value indicating action to be taken
- *
- *  inline implementation always returns krefOkay.
- *
- *  linked-in implementation may return any of the following
- *  codes, depending upon how it was compiled:
- *    krefOkay     : reference was successfully added
- *    krefZero     : reference was added, but prior value was zero
- *    krefNegative : reference was NOT added, prior value was negative
- */
-#if ! INLINE_REFCOUNT
-LIB_EXPORT int CC KRefcountAddDep ( const KRefcount *self, const char *clsname )
-{
-#if DETECT_ZERO_STATE
-    int prior = atomic32_read_and_add ( ( KRefcount* ) self, 1 );
-    if ( prior < 0 )
-    {
-        DBGMSG ( DBG_REF, DBG_REF_PLACEHOLDER,
-                 ( "FAILED to attach %s instance 0x%p: prior refcount = 0x%x",
-                   clsname, self, prior ) );
-        return krefNegative;
-    }
-    if ( prior == 0 )
-    {
-        DBGMSG ( DBG_REF, DBG_REF_PLACEHOLDER,
-                 ( "about to attach %s instance 0x%p: prior refcount = 0x%x",
-                   clsname, self, prior ) );
-        return krefZero;
-    }
-#if DETECT_LIMIT_VIOLATION
-    if ( prior == INT_MAX )
-    {
-        atomic32_dec ( ( KRefcount* ) self );
-        DBGMSG ( DBG_REF, DBG_REF_PLACEHOLDER,
-                 ( "FAILED to attach %s instance 0x%p: prior refcount = 0x%x",
-                   clsname, self, prior ) );
-        return krefLimit;
-    }
-#endif
-    CNTMSG ( clsname, "attach", self, prior );
-#elif DETECT_LIMIT_VIOLATION
-    unsigned int prior = atomic32_read_and_add_lt ( ( KRefcount* ) self, 1, INT_MAX );
-    if ( prior >= INT_MAX )
-    {
-        DBGMSG ( DBG_REF, DBG_REF_PLACEHOLDER,
-                 ( "FAILED to attach %s instance 0x%p: prior refcount = 0x%x",
-                   clsname, self, prior ) );
-        return krefLimit;
-    }
-    CNTMSG ( clsname, "attach", self, prior );
-#else
-    REFMSG ( clsname, "attach", self );
-    atomic32_inc ( ( KRefcount* ) ( self ) );
-#endif
-    return krefOkay;
-}
-#endif
-
-LIB_EXPORT int CC KDualRefAddDep ( const KDualRef *self, const char *clsname )
-{
-#if DETECT_ZERO_STATE
-    int prior = atomic32_read_and_add_ge ( ( KDualRef* ) self, 1, 0 );
-    int dep = prior & DUAL_DEP_MASK;
-    if ( prior < 0 || dep > DUAL_DEP_MAX )
-    {
-        if ( prior >= 0 )
-            atomic32_dec ( ( KDualRef* ) self );
-        DBGMSG ( DBG_REF, DBG_REF_PLACEHOLDER,
-                 ( "FAILED to attach %s instance 0x%p: prior refcount = 0x%x",
-                   clsname, self, prior ) );
-        return krefNegative;
-    }
-    if ( prior == 0 )
-    {
-        DBGMSG ( DBG_REF, DBG_REF_PLACEHOLDER,
-                 ( "about to attach %s instance 0x%p: prior refcount = 0x%x",
-                   clsname, self, prior ) );
-        return krefZero;
-    }
-#if DETECT_LIMIT_VIOLATION
-    if ( dep == DUAL_DEP_MAX )
-    {
-        atomic32_dec ( ( KDualRef* ) self );
-        DBGMSG ( DBG_REF, DBG_REF_PLACEHOLDER,
-                 ( "FAILED to attach %s instance 0x%p: prior refcount = 0x%x",
-                   clsname, self, prior ) );
-        return krefLimit;
-    }
-#endif
-    CNTMSG ( clsname, "attach", self, prior );
-#elif DETECT_LIMIT_VIOLATION
-    int prior = atomic32_read_and_inc ( ( KDualRef* ) self );
-    if ( ( prior & DUAL_DEP_MASK ) >= DUAL_DEP_MAX )
-    {
-        atomic32_dec ( ( KDualRef* ) self );
-        DBGMSG ( DBG_REF, DBG_REF_PLACEHOLDER,
-                 ( "FAILED to attach %s instance 0x%p: prior refcount = 0x%x",
-                   clsname, self, prior ) );
-        return krefLimit;
-    }
-    CNTMSG ( clsname, "attach", self, prior );
-#else
-    REFMSG ( clsname, "attach", self );
-    atomic32_inc ( ( KDualRef* ) ( self ) );
-#endif
-    return krefOkay;
-}
-
-
-/* DropDep
- *  drop a dependency reference
- *  returns enum value indicating action to be taken
- *
- *  inline implementation returns:
- *    krefOkay     : reference was successfully dropped
- *    krefWhack    : all references are gone and object can be collected
- *
- *  linked-in implementation may return any of the following
- *  codes, depending upon how it was compiled:
- *    krefOkay     : reference was successfully dropped
- *    krefWhack    : all references are gone and object can be collected
- *    krefZero     : reference was dropped, and no further dependent refernces exist
- *    krefNegative : reference was NOT dropped, as resultant count would be negative
- */
-#if ! INLINE_REFCOUNT
-LIB_EXPORT int CC KRefcountDropDep ( const KRefcount *self, const char *clsname )
-{
-#if DETECT_ZERO_STATE
-    int prior = atomic32_read_and_add ( ( KRefcount* ) self, -1 );
-    if ( prior <= 0 )
-    {
-        DBGMSG ( DBG_REF, DBG_REF_PLACEHOLDER,
-                 ( "FAILED to sever %s instance 0x%p: prior refcount = 0x%x",
-                   clsname, self, prior ) );
-        return krefNegative;
-    }
-    CNTMSG ( clsname, "sever", self, prior );
-    if ( prior == 1 )
-        return krefWhack;
-#else
-    REFMSG ( clsname, "sever", self );
-    if ( atomic32_dec_and_test ( ( KRefcount* ) ( self ) ) )
-        return krefWhack;
-#endif
-    return krefOkay;
-}
-#endif
-
-LIB_EXPORT int CC KDualRefDropDep ( const KDualRef *self, const char *clsname )
-{
-    int prior = atomic32_read_and_add ( ( KDualRef* ) self, -1 );
-#if DETECT_ZERO_STATE
-    if ( prior <= 0 )
-    {
-        atomic32_inc ( ( KDualRef* ) self );
-        DBGMSG ( DBG_REF, DBG_REF_PLACEHOLDER,
-                 ( "FAILED to sever %s instance 0x%p: prior refcount = 0x%x",
-                   clsname, self, prior ) );
-        return krefNegative;
-    }
-#endif
-    CNTMSG ( clsname, "sever", self, prior );
-    if ( prior == 1 )
-        return krefWhack;
-    if ( ( prior & DUAL_DEP_MASK ) == 1 )
-        return krefZero;
-    return krefOkay;
-}
diff --git a/libs/klib/release-vers.h b/libs/klib/release-vers.h
deleted file mode 100644
index 6d1bcc8..0000000
--- a/libs/klib/release-vers.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/* THIS FILE IS NOT GENERATED AUTOMATICALLY! */
-
-/* The Version of current SRA Toolkit Release */
-#define RELEASE_VERS 0x02030005
-
-/* The Revision of Version of current SRA Toolkit Release */
-#define RELEASE_REVISION 2
-
-/* The Type of Version of current SRA Toolkit Release is one of:
- *  'a' - alpha
- *  'b' - beta
- *  'c' - release candidate
- *  'r' - final
- */
-#define RELEASE_TYPE 'r'
diff --git a/libs/klib/report.c b/libs/klib/report.c
deleted file mode 100644
index 5da2b46..0000000
--- a/libs/klib/report.c
+++ /dev/null
@@ -1,854 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h> /* MUST BE FIRST */
-
-#include <kapp/args.h> /* OPTION_REPORT */
-
-#include <kfs/directory.h> /* KDirectoryNativeDir */
-
-#include <klib/klib-priv.h>
-#include <klib/log.h> /* LOGERR */
-#include <klib/misc.h> /* is_iser_an_admin */
-#include <klib/namelist.h> /* KNamelistRelease */
-#include <klib/out.h> /* OUTMSG */
-#include <klib/printf.h> /* string_printf */
-#include <klib/rc.h>
-#include <klib/report.h> /* ReportInit */
-#include <klib/time.h> /* KTime */
-#include <klib/text.h> /* string_printf */
-
-#include <atomic.h> /* atomic_test_and_set_ptr */
-
-#include <stdarg.h> /* va_start */
-#include <stdio.h> /* sprintf */
-#include <stdlib.h> /* malloc */
-#include <string.h> /* memset */
-#include <limits.h> /* PATH_MAX */
-#include <assert.h>
-
-#ifndef PATH_MAX
-#define PATH_MAX 4096
-#endif
-
-#define RELEASE(type, obj) do { rc_t rc2 = type##Release(obj); \
-    if (rc2 && !rc) { rc = rc2; } obj = NULL; } while (false)
-
-/*
- * An unrecoverable error happened.
- * We can help to solve it
- * by reporting information about known application execution environment.
- */
-
-static
-rc_t XMLLogger_Encode(const char* src, char *dst,
-    size_t dst_sz, size_t *num_writ)
-{
-    rc_t rc = 0;
-    if( src == NULL || dst == NULL || num_writ == NULL ) {
-        rc = RC(rcApp, rcArgv, rcParsing, rcParam, rcNull);
-    } else {
-        *num_writ = 0;
-        do {
-            size_t bytes;
-            const char* p;
-            switch(*src) {
-                case '\'':
-                    bytes = 6;
-                    p = "'";
-                    break;
-                case '"':
-                    bytes = 6;
-                    p = """;
-                    break;
-                case '&':
-                    bytes = 5;
-                    p = "&";
-                    break;
-                case '<':
-                    bytes = 4;
-                    p = "<";
-                    break;
-                case '>':
-                    bytes = 4;
-                    p = ">";
-                    break;
-                default:
-                    bytes = 1;
-                    p = src;
-                    break;
-            }
-            if( (*num_writ + bytes) > dst_sz ) {
-                rc = RC(rcApp, rcLog, rcEncoding, rcBuffer, rcInsufficient);
-                break;
-            } else {
-                memcpy(dst, p, bytes);
-                *num_writ = *num_writ + bytes;
-                dst += bytes;
-            }
-        } while(*src++ != '\0');
-        *num_writ = *num_writ - 1;
-    }
-    return rc;
-}
-
-typedef rc_t (CC ReportObj)(const ReportFuncs *f, uint32_t indent,
-                              const char *path, bool *wasDbOrTableSet);
-typedef rc_t (CC ReportSoftware)(const ReportFuncs *f, uint32_t indent,
-                          const char *argv_0, const char *date, ver_t tool_ver);
-typedef rc_t (CC Whack )(void);
-typedef struct Report {
-    rc_t ( CC * report_redirect ) ( KWrtHandler* handler,
-        const char* filename, bool* to_file, bool finalize );
-    rc_t ( CC * report_cwd ) ( const ReportFuncs *f, uint32_t indent );
-    rc_t ( CC * report_config ) ( const ReportFuncs *f, uint32_t indent );
-    ReportObj *report_vdb;
-    ReportSoftware *report_software;
-    Whack *whack_vdb;
-    char* volatile object; /* path: to free */
-    const char* date;
-    char** argv;
-    int argc;
-    KTime_t start;
-    ver_t tool_ver;
-    bool hasZombies;
-    bool silence;
-} Report;
-
-static rc_t ReportReplaceObjectPtr(Report* self, const char* path) {
-    char *copy, *prev_ptr, *cur_ptr;
-
-    assert(self);
-
-    copy = string_dup_measure(path, NULL);
-    if (copy == NULL)
-        return RC(rcExe, rcMemory, rcAllocating, rcMemory, rcExhausted);
-
-    cur_ptr = self -> object;
-    do
-    {
-        prev_ptr = cur_ptr;
-        cur_ptr = atomic_test_and_set_ptr ( ( void* volatile* ) & self -> object, copy, prev_ptr );
-    }
-    while ( cur_ptr != prev_ptr );
-
-    if ( cur_ptr != NULL )
-        free ( cur_ptr );
-
-    return 0;
-}
-
-static rc_t ReportFreeObject(Report* self) {
-    rc_t rc = 0;
-    char *prev_ptr, *cur_ptr;
-
-    assert(self);
-
-    cur_ptr = self -> object;
-    do
-    {
-        prev_ptr = cur_ptr;
-        cur_ptr = atomic_test_and_set_ptr ( ( void* volatile* ) & self -> object, NULL, prev_ptr );
-    }
-    while ( cur_ptr != prev_ptr );
-
-    if ( cur_ptr != NULL )
-        free(cur_ptr);
-
-    return rc;
-}
-
-static Report * volatile report_singleton;
-
-static rc_t ReportGet(Report** self)
-{
-    if ( report_singleton == NULL )
-        return RC ( rcRuntime, rcStorage, rcAccessing, rcSelf, rcNull );
-
-    * self = ( Report* ) report_singleton;
-    return 0;
-}
-static rc_t ReportRelease(void)
-{
-    rc_t rc = 0;
-    Report *prev_report, *cur_report;
-
-    cur_report = report_singleton;
-    do
-    {
-        prev_report = cur_report;
-        cur_report = atomic_test_and_set_ptr ( ( void* volatile* ) & report_singleton, NULL, prev_report );
-    }
-    while ( cur_report != prev_report );
-
-    if ( cur_report != NULL )
-    {
-
-        /* cleanup */
-        ReportFreeObject( cur_report );
-        if ( cur_report -> whack_vdb != NULL )
-            rc = ( * cur_report -> whack_vdb ) ();
-
-        if ( cur_report -> argv != NULL )
-        {
-            int i;
-            for ( i = 0; i < cur_report -> argc; ++ i )
-                free ( cur_report -> argv [ i ] );
-            free ( cur_report -> argv );
-            cur_report -> argv = NULL;
-        }
-
-        memset ( cur_report, 0, sizeof * cur_report );
-    }
-
-    return rc;
-}
-
-static void reportOpen1(uint32_t indent, const char* name) {
-    OUTMSG(("%*c%s>", indent + 1, '<', name));
-}
-
-static rc_t reportData1(const char* data) {
-    rc_t rc = 0;
-
-    char dummy[PATH_MAX * 2 + 1] = "";
-    const char* p = data;
-
-    assert(data);
-
-    if (data[0] == 0) {
-        return rc;
-    }
-
-    if (strpbrk(data, "'\"&<>")) {
-        size_t num_writ = 0;
-        rc = XMLLogger_Encode(data, dummy, sizeof dummy, &num_writ);
-        if (rc == 0)
-        {   p = dummy; }
-    }
-
-    OUTMSG(("%s", p));
-
-    return rc;
-}
-
-static void reportClose1(const char* name) { OUTMSG(("</%s>\n", name)); }
-
-static rc_t reportImpl(int indent, bool open, bool close, bool eol,
-    const char* name, const char* data, int count, va_list args)
-{
-    rc_t rc = 0;
-    int i = 0;
-
-    if (count < 0) {
-        eol = false;
-        count = -count;
-    }
-
-    OUTMSG(("%*c", eol ? ( indent + 1 ) : 1, '<'));
-    OUTMSG(("%s%s", ( ! open && close ) ? "/" : "", name));
-
-    for (i = 0; i < count; ++i) {
-        const char* name = va_arg(args, const char*);
-        int format = va_arg(args, int);
-        union {
-            const char* s;
-            int i;
-            int64_t i64;
-            KTime* t;
-            rc_t rc;
-            const uint8_t* digest;
-            uint64_t u64;
-            ver_t vers;
-        } u;
-        OUTMSG((" %s=\"", name));
-        u.i64 = 0;
-        switch(format) {
-            case 'M':
-                u.digest = va_arg(args, const uint8_t*);
-                {
-                    int i = 0;
-                    for (i = 0; i < 16; ++i)
-                    {  OUTMSG(("%02x", *(u.digest + i))); }
-                }
-                break;
-            case 'l':
-                u.i64 = va_arg(args, int64_t);
-                OUTMSG(("%ld", u.i64));
-                break;
-            case 'u':
-                u.u64 = va_arg(args, uint64_t);
-                OUTMSG(("%lu", u.u64));
-                break;
-            case 'R':
-                u.rc = va_arg(args, rc_t);
-                OUTMSG(("%R", u.rc));
-                break;
-            case 'T':
-                u.t = va_arg(args, KTime*);
-                OUTMSG(("%lT", u.t));
-                break;
-            case 's':
-                u.s = va_arg(args, const char*);
-                OUTMSG(("%s", u.s));
-                break;
-            case 'V':
-                u.vers = va_arg(args, ver_t);
-                OUTMSG(("%V", u.vers));
-                break;
-            case 'd':
-            default:
-                u.i = va_arg(args, int);
-                OUTMSG(("%d", u.i));
-                break;
-        }
-        OUTMSG(("\""));
-    }
-
-    if (data) {
-        OUTMSG((">"));
-        rc = reportData1(data);
-        if (close)
-        {   OUTMSG(("</%s", name)); }
-    }
-    else if (open && close)
-    {   OUTMSG(("/")); }
-
-    OUTMSG((">"));
-    if (eol)
-    {   OUTMSG(("\n")); }
-
-    return rc;
-}
-
-static void CC report(uint32_t indent, const char* name, uint32_t count, ...) {
-     va_list args;
-     va_start(args, count);
-     reportImpl(indent, true, true, true, name, NULL, count, args);
-     va_end(args);
-}
-
-static
-void CC reportData(uint32_t indent, const char* name, const char* data, uint32_t count, ...)
-{
-    va_list args;
-    va_start(args, count);
-    reportImpl(indent, true, true, true, name, data, count, args);
-    va_end(args);
-}
-
-static void CC reportOpen(uint32_t indent, const char* name, uint32_t count, ...) {
-    va_list args;
-    va_start(args, count);
-    reportImpl(indent, true, false, true, name, NULL, count, args);
-    va_end(args);
-}
-
-static void CC reportClose(uint32_t indent, const char* name)
-{   reportImpl(indent, false, true, true, name, NULL, 0, NULL); }
-
-static void CC reportError(uint32_t indent, rc_t rc, const char* function) {
-    report(indent, "Error", 2,
-         "rc"      , 'R', rc,
-         "function", 's', function);
-}
-
-static void CC reportErrorStrImpl(uint32_t indent, rc_t rc,
-    const char* function, const char* name, const char* val, bool eol)
-{
-    int sign = eol ? 1 : -1;
-    if (rc || function) {
-        report(indent, "Error", sign * 3,
-            "rc", 'R', rc,
-            "function", 's', function,
-            name, 's', val);
-    }
-    else {
-        report(indent, "Error", sign,
-            name, 's', val);
-    }
-}
-
-static void CC reportErrorStr(uint32_t indent, rc_t rc, const char* function,
-    const char* name, const char* val)
-{   reportErrorStrImpl(indent, rc, function, name, val, true); }
-
-static void CC reportErrorStrInt(uint32_t indent, rc_t rc, const char* function,
-    const char* names, const char* vals, const char* namei, uint32_t vali)
-{
-    report(indent, "Error", 4,
-        "rc"      , 'd', rc,
-        "function", 's', function,
-        names     , 's', vals,
-        namei     , 'd', vali);
-}
-
-static void CC reportError3Str(uint32_t indent, rc_t rc, const char* function,
-    const char* name, const char* v1, const char* v2, const char* v3,
-    bool eol)
-{
-    char* buffer = malloc(strlen(v1) + strlen(v2) + strlen(v3) + 1);
-    if (buffer) {
-        sprintf(buffer, "%s%s%s", v1, v2, v3);
-        reportErrorStrImpl(indent, rc, function, name, buffer, eol);
-        free(buffer);
-    }
-}
-
-static ReportFuncs report_funcs =
-{
-    report,
-    reportData,
-    reportData1,
-    reportOpen,
-    reportOpen1,
-    reportClose,
-    reportClose1,
-    reportError,
-    reportErrorStr,
-    reportErrorStrImpl,
-    reportErrorStrInt,
-    reportError3Str
-};
-
-static rc_t ReportRun(int indent, rc_t rc_in) {
-    rc_t rc = 0;
-
-    const char tag[] = "Run";
-
-    Report* self = NULL;
-    ReportGet(&self);
-    if (self == NULL) {
-        return rc;
-    }
-
-    reportOpen(indent, tag, 0);
-
-    {
-        KTime kt;
-        const char tag[] = "Date";
-        reportOpen(indent + 1, tag, 0);
-        KTimeLocal(&kt, self->start);
-        report(indent + 2, "Start", 1, "value", 'T', &kt);
-        KTimeLocal(&kt, KTimeStamp());
-        report(indent + 2, "End"  , 1, "value", 'T', &kt);
-        reportClose(indent + 1, tag);
-    }
-
-    {
-        const char* name = "HOME";
-        const char* val = getenv(name);
-        if (val == NULL) {
-            name = "USERPROFILE";
-            val = getenv(name);
-        }
-        if (val == NULL)
-        {   name = val = "not found"; }
-        report(indent + 1, "Home", 2, "name", 's', name, "value", 's', val);
-    }
-
-    if ( self -> report_cwd != NULL )
-        rc = ( * self -> report_cwd ) ( & report_funcs, indent + 1 );
-
-    {
-        const char tag[] = "CommandLine";
-        int i = 0;
-        reportOpen(indent + 1, tag, 1, "argc", 'd', self->argc);
-        for (i = 0; i < self->argc; ++i) {
-            if (self->argv && self->argv[i]) {
-                report(indent + 2, "Arg", 2, "index", 'd', i,
-                    "value", 's', self->argv[i]);
-            }
-        }
-        reportClose(indent + 1, tag);
-    }
-
-    report(indent + 1, "Result", 1, "rc", 'R', rc_in);
-
-    report(indent + 1, "User", 1,
-        "admin", 's', is_iser_an_admin() ? "true" : "false");
-
-    reportClose(indent, tag);
-
-    return rc;
-}
-
-
-/* Silence
- *  tell report to be silent at exit
- *  useful especially in response to ^C
- */
-LIB_EXPORT void CC ReportSilence ( void )
-{
-    Report* self = NULL;
-    ReportGet(&self);
-    if ( self != NULL )
-        self -> silence = true;
-}
-
-static rc_t reportToFileSet(const Report* self,
-    KWrtHandler* old_handler, const char* name, bool* to_file)
-{
-    rc_t rc = 0;
-    assert(self && to_file);
-    if (self->report_redirect) {
-        rc = (*self->report_redirect)(old_handler, name, to_file, false);
-    }
-    return rc;
-}
-
-static rc_t reportToStdErrSet(const Report* self, KWrtHandler* old_handler) {
-    rc_t rc = 0;
-    assert(self);
-    if (self->report_redirect) {
-        rc = (*self->report_redirect)(old_handler, NULL, NULL, false);
-    }
-    return rc;
-}
-
-/* Finalize:
- * If (rc_in != 0) then report environment information.
- * Then clean itself.
- *
- * When "--" OPTION_REPORT "always" command line argument is passed
- * then the report [usually] goes to strerr.
- *
- * When aForce == truethen the report goes to strout:
- * it is done to insert it into test-sra output.
- */
-static rc_t _ReportFinalize(rc_t rc_in, bool aForce) {
-    rc_t rc = 0;
-
-    const char* report_arg = NULL;
-
-    bool force = rc_in != 0;
-
-    Report* self = NULL;
-    ReportGet(&self);
-
-    if (self == NULL) {
-        return rc;
-    }
-
-    if (GetRCTarget(rc_in) == rcArgv) {
-        force = false;
-    }
-    else {
-        bool wasDbOrTableSet = true;
-        if (self->report_vdb != NULL) {
-            (*self->report_vdb)(&report_funcs, 0, NULL, &wasDbOrTableSet);
-            if (!wasDbOrTableSet) {
-                force = false;
-            }
-        }
-    }
-
-    if (!force && aForce) {
-        force = true;
-        self -> silence = false;
-    }
-
-    if (self->argv) {
-        int i = 0;
-        for (i = 1; i < self->argc; ++i) {
-            if (strcmp("--" OPTION_REPORT, self->argv[i]) == 0) {
-                if (i + 1 < self->argc) {
-                    report_arg = self->argv[i + 1];
-                }
-                break;
-            }
-        }
-    }
-
-    if (report_arg && strcmp("always", report_arg) == 0) {
-        force = true;
-        self -> silence = false;
-    }
-
-    if (!self -> silence) {
-        if (force) { 
-            if (report_arg && strcmp("never", report_arg) == 0) {
-                force = false;
-            }
-        }
-/*                              PLOGERR(klogErr, (klogErr,
-                               RC(rcApp, rcArgv, rcParsing, rcRange, rcInvalid),
-                               "report type '$(type)' is unrecognized",
-                               "type=%s", self->argv[i + 1]));*/
-
-        if (force) {
-            if (self->hasZombies && !aForce) {
-                KOutHandlerSetStdErr();
-                if (self->object != NULL) {
-                    OUTMSG(("\nThe archive '%s' may be truncated: "
-                        "Please download it again.\n", self->object));
-                }
-                else {
-                    OUTMSG(("\nThe archive may be truncated: "
-                        "Please download it again.\n"));
-                }
-            }
-            else {
-                int indent = 0;
-                const char tag[] = "Report";
-
-                char path[PATH_MAX + 1] = "";
-                bool to_file = false;
-                KWrtHandler old_handler;
-                if (rc_in == 0) {
-                    if (!aForce) {
-                        reportToStdErrSet(self, &old_handler);
-                    }
-                }
-                else {
-                    rc_t rc2 = 0;
-                    const char name[] = "ncbi_error_report.xml";
-                    const char* home = getenv("HOME");
-                    if (home == NULL) {
-                        home = getenv("USERPROFILE");
-                    }
-                    if (home) {
-                        size_t num_writ = 0;
-                        rc2 = string_printf
-                            (path, sizeof path, &num_writ, "%s/%s", home, name);
-                        assert(num_writ < sizeof path);
-                    }
-                    if (rc2 != 0 || home == NULL) {
-                        size_t num_writ = 0;
-                        rc2 = string_printf
-                            (path, sizeof path, &num_writ, "%s", name);
-                        assert(num_writ < sizeof path);
-                        assert(rc2 == 0);
-                    }
-                    reportToFileSet(self, &old_handler, path, &to_file);
-                }
-                if (!to_file && rc_in) {
-                    OUTMSG((
-"\n"
-"=============================================================\n"
-"An error occurred during processing.\n"
-"If the problem persists, you may consider sending the following XML document\n"
-"to 'sra at ncbi.nlm.nih.gov' for assistance.\n"
-"=============================================================\n\n"));
-                }
-
-                reportOpen(indent, tag, 0);
-
-                {
-                    rc_t rc2 = ReportRun(indent + 1, rc_in);
-                    if (rc == 0 && rc2 != 0)
-                    {   rc = rc2; }
-                }
-
-                if ( self -> report_config != NULL )
-                {
-                    rc_t rc2 = ( * self -> report_config )
-                        ( & report_funcs, indent + 1);
-                    if (rc == 0 && rc2 != 0)
-                    {   rc = rc2; }
-                }
-
-                if (self -> report_vdb != NULL) {
-                    rc_t rc2 = (*self->report_vdb)
-                        (&report_funcs, indent + 1, self -> object, NULL);
-                    if (rc == 0 && rc2 != 0) {
-                        rc = rc2;
-                    }
-                }
-
-                if ( self -> report_software != NULL )
-                {
-                    const char *argv_0 = self -> argv ? self -> argv [ 0 ] : "";
-                    rc_t rc2 = ( * self -> report_software )
-                        ( & report_funcs, indent + 1,
-                            argv_0, self -> date, self -> tool_ver );
-                    if (rc == 0 && rc2 != 0)
-                    {   rc = rc2; }
-                }
-
-                if (self->hasZombies) {
-                    OUTMSG(("\nOne of archives may be truncated: "
-                        "It should be redownloaded.\n"));
-                }
-
-                reportClose(indent, tag);
-                reportData1("\n");
-
-                if (to_file) {
-                    KOutHandlerSetStdErr();
-                    OUTMSG((
-"\n"
-"=============================================================\n"
-"An error occurred during processing.\n"
-"A report was generated into the file '%s'.\n"
-"If the problem persists, you may consider sending the file\n"
-"to 'sra at ncbi.nlm.nih.gov' for assistance.\n"
-"=============================================================\n\n", path));
-                }
-            }
-        }
-    }
-
-    ReportRelease();
-
-    return rc;
-}
-
-/* Finalize:
- * If (rc_in != 0) then report environment information.
- * Then clean itself.
- */
-LIB_EXPORT rc_t CC ReportFinalize(rc_t rc_in) {
-    return _ReportFinalize(rc_in, false);
-}
-
-LIB_EXPORT rc_t CC ReportForceFinalize(void) {
-    return _ReportFinalize(0, true);
-}
-
-static
-char **copy_argv ( int argc, char **argv )
-{
-    char **argv2 = calloc ( argc, sizeof * argv2 );
-    if (argv2 != NULL) {
-        int i = 0;
-        for (i = 0; i < argc; ++i) {
-            argv2[i] = string_dup_measure(argv[i], NULL);
-        }
-    }
-    return argv2;
-}
-
-/* Init: initialize with common information */
-LIB_EXPORT void CC ReportInit(int argc, char* argv[], ver_t tool_version)
-{
-    static bool latch;
-    if ( ! latch )
-    {
-        /* comes pre-zeroed by runtime */
-        static Report self;
-
-        /* initialize with non-zero parameters */
-        self.start = KTimeStamp();
-        self.argc = argc;
-        self.argv = copy_argv ( argc, argv );
-        self.date = __DATE__;
-        self.tool_ver = tool_version;
-        self.silence = false;
-
-        /* export to the remainder of the source */
-        report_singleton = & self;
-
-        latch = true;
-    }
-}
-
-
-/* BuildDate
- *  set the build date of the tool
- *
- *  "date" [ IN ] - pre-processor __DATE__
- */
-LIB_EXPORT void CC ReportBuildDate ( const char *date )
-{
-    Report* self = NULL;
-    ReportGet(&self);
-    if ( self != NULL )
-        self -> date = date;
-}
-
-
-/* InitCWD
- */
-LIB_EXPORT void CC ReportInitKFS (
-    rc_t ( CC * report_cwd ) ( const ReportFuncs *f, uint32_t indent ),
-    rc_t ( CC * report_redirect ) ( KWrtHandler* handler,
-        const char* filename, bool* to_file, bool finalize ) )
-{
-    Report* self = NULL;
-    ReportGet(&self);
-    if ( self != NULL ) {
-        self -> report_redirect = report_redirect;
-        self -> report_cwd = report_cwd;
-    }
-}
-
-
-/* InitConfig
- */
-LIB_EXPORT const char* CC ReportInitConfig ( rc_t ( CC * report ) ( const ReportFuncs *f, uint32_t indent ) )
-{
-    Report* self = NULL;
-    ReportGet(&self);
-    if ( self != NULL )
-    {
-        self -> report_config = report;
-        return self -> argv [ 0 ];
-    }
-    return NULL;
-}
-
-/* InitVDB
- */
-LIB_EXPORT rc_t CC ReportInitVDB(
-    ReportObj *report_obj, ReportSoftware *report_software, Whack *whack)
-{
-    Report* self = NULL;
-    rc_t rc = ReportGet(&self);
-    if ( rc == 0 && self)
-    {
-        self -> report_vdb = report_obj;
-        self -> report_software = report_software;
-        self -> whack_vdb = whack;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC ReportResetObject(const char* path)
-{
-    Report* self = NULL;
-
-    if ( path == NULL )
-        path = "NULL";
-    else if ( path [ 0 ] == 0 )
-        path = "EMPTY";
-
-    ReportGet(&self);
-    if (self == NULL) {
-        return 0;
-    }
-
-    return ReportReplaceObjectPtr(self, path);
-}
-
-LIB_EXPORT void CC ReportRecordZombieFile(void)
-{
-    Report* self = NULL;
-    ReportGet(&self);
-    if (self == NULL)
-    {   return; }
-    self->hasZombies = true;
-}
diff --git a/libs/klib/sra-release-version.c b/libs/klib/sra-release-version.c
deleted file mode 100644
index 44dd4cb..0000000
--- a/libs/klib/sra-release-version.c
+++ /dev/null
@@ -1,328 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <klib/printf.h> /* string_printf */
-#include <klib/rc.h>
-#include <klib/sra-release-version.h>
-
-#include "release-vers.h"
-
-#include <ctype.h> /* isdigit */
-#include <string.h> /* memset */
-#include <assert.h>
-
-LIB_EXPORT rc_t CC SraReleaseVersionGet(SraReleaseVersion *version) {
-    if (version == NULL) {
-        return RC(rcRuntime, rcArgv, rcAccessing, rcParam, rcNull);
-    }
-
-    version->version = RELEASE_VERS;
-    version->revision = RELEASE_REVISION;
-
-    switch (RELEASE_TYPE) {
-        case 'a':
-            version->type = eSraReleaseVersionTypeAlpha;
-            break;
-        case 'b':
-            version->type = eSraReleaseVersionTypeBeta;
-            break;
-        case 'c':
-            version->type = eSraReleaseVersionTypeRC;
-            break;
-        default:
-            version->type = eSraReleaseVersionTypeFinal;
-    }
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC SraReleaseVersionCmp(const SraReleaseVersion *self,
-    const SraReleaseVersion *version2, int32_t *result)
-{
-    if (result == NULL) {
-        return RC(rcRuntime, rcArgv, rcAccessing, rcParam, rcNull);
-    }
-
-    *result = 0;
-
-    if (self == NULL) {
-        return RC(rcRuntime, rcArgv, rcAccessing, rcSelf, rcNull);
-    }
-
-    if (version2 == NULL) {
-        return RC(rcRuntime, rcArgv, rcAccessing, rcParam, rcNull);
-    }
-
-    if (self->version < version2->version) {
-        *result = 1;
-    }
-    else if (self->version > version2->version) {
-        *result = -1;
-    }
-    else if (self->type < version2->type) {
-        *result = 1;
-    }
-    else if (self->type > version2->type) {
-        *result = -1;
-    }
-    else if (self->revision < version2->revision) {
-        *result = 1;
-    }
-    else if (self->revision > version2->revision) {
-        *result = -1;
-    }
-    else {
-        *result = 0;
-    }
-
-    return 0;
-}
-
-static int32_t getdigit(const char **s, size_t *size, int32_t max) {
-    int32_t d = 0;
-    char c = 0;
-
-    assert(s && size);
-
-    if (*size == 0) {
-        return 0;
-    }
-
-    c = **s;
-    if (!isdigit(c)) {
-        if (c == '\n') {
-            return 0;
-        }
-        else {
-            return -1;
-        }
-    }
-
-    while (*size > 0) {
-        char c = **s;
-        if (isdigit(c)) {
-            d = d * 10 + c - '0';
-        }
-        else {
-            break;
-        }
-        ++(*s);
-        --*size;
-    }
-
-    if (max > 0 && d > max) {
-        return -2;
-    }
-
-    return d;
-}
-
-#define SET_RC(i) ( \
-    (i) == -1 ? RC(rcRuntime, rcFile, rcReading, rcFile, rcInvalid) \
-              : RC(rcRuntime, rcFile, rcReading, rcNumeral, rcExcessive) )
-
-/* Parse
- *  Initialize SraReleaseVersion from char version[size]
- */
-LIB_EXPORT rc_t CC SraReleaseVersionInit ( SraReleaseVersion *self,
-    const char *version, size_t size )
-{
-    rc_t rc = 0;
-    int32_t major = 0, minor = 0, release = 0, revision = 0, i = 0,
-        type = eSraReleaseVersionTypeFinal; 
-    const char *p = version;
-
-    if (self == NULL) {
-        return RC(rcRuntime, rcArgv, rcAccessing, rcSelf, rcNull);
-    }
-
-    assert(self);
-    memset(self, 0, sizeof *self);
-
-    self->type = eSraReleaseVersionTypeFinal;
-
-    if (size == 0) {
-        return 0;
-    }
-
-    /* major: 1. */
-    if (size > 0 && rc == 0) {
-        int32_t i = getdigit(&p, &size, 255);
-        if (i >= 0) {
-            major = i;
-        }
-        else {
-            rc = SET_RC(i);
-        }
-    }
-
-    /* minor: 1.2 */
-    if (size > 0 && rc == 0 && *p != '\n') {
-        if (*p != '.' && *p != '-') {
-            rc = RC(rcRuntime, rcFile, rcReading, rcFile, rcInvalid);
-        }
-        if (*p == '.') {
-            ++p;
-            --size;
-            i = getdigit(&p, &size, 255);
-            if (i >= 0) {
-                minor = i;
-            }
-            else {
-                rc = SET_RC(i);
-            }
-        }
-    }
-
-    /* release: 1.2.3 */
-    if (size > 0 && rc == 0 && *p != '\n') {
-        if (*p != '.' && *p != '-') {
-            rc = RC(rcRuntime, rcFile, rcReading, rcFile, rcInvalid);
-        }
-        if (*p == '.') {
-            ++p;
-            --size;
-            i = getdigit(&p, &size, 0xFFFF);
-            if (i >= 0) {
-                release = i;
-            }
-            else {
-                rc = SET_RC(i);
-            }
-        }
-    }
-
-    /* dash: 1.2.3- */
-    if (size > 0 && rc == 0 && *p != '\n') {
-        if (*p != '-') {
-            rc = RC(rcRuntime, rcFile, rcReading, rcFile, rcInvalid);
-        }
-        ++p;
-        --size;
-    }
-
-    /* type: 1.2.3-a 1.2.3-rc */
-    if (size > 0 && rc == 0 && *p != '\n') {
-        if (!isalpha(*p)) {
-            if (!isdigit(*p)) {
-                rc = RC(rcRuntime, rcFile, rcReading, rcFile, rcInvalid);
-            }
-        }
-        else {
-            switch (*p) {
-                case 'a':
-                    type = eSraReleaseVersionTypeAlpha;
-                    break;
-                case 'b':
-                    type = eSraReleaseVersionTypeBeta;
-                    break;
-                case 'r':
-                    type = eSraReleaseVersionTypeRC;
-                    ++p;
-                    --size;
-                    if (size == 0) {
-                        rc = RC(rcRuntime,
-                            rcFile, rcReading, rcFile, rcInvalid);
-                    }
-                    else if (*p != 'c') {
-                        rc = RC(rcRuntime,
-                            rcFile, rcReading, rcFile, rcInvalid);
-                    }
-                    break;
-            }
-            ++p;
-            --size;
-        }
-    }
-
-    /* revision: 1.2.3-4 1.2.3-b4 1.2.3-rc4 */
-    if (size > 0 && rc == 0 && *p != '\n') {
-        i = getdigit(&p, &size, 0);
-        if (i >= 0) {
-            revision = i;
-        }
-        else {
-            rc = SET_RC(i);
-        }
-    }
-
-    if (size > 0 && rc == 0 && *p != '\n') {
-        rc = RC(rcRuntime, rcFile, rcReading, rcFile, rcInvalid);
-    }
-
-    if (rc == 0) {
-        self->version = (major << 24) + (minor << 16) + release;
-        self->revision = revision;
-        self->type = type;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SraReleaseVersionPrint ( const SraReleaseVersion *self,
-    char *version, size_t size, size_t *num_writ )
-{
-    rc_t rc = 0;
-    const char *type = "";
-
-    if (self == NULL) {
-        return RC(rcRuntime, rcArgv, rcAccessing, rcSelf, rcNull);
-    }
-
-    switch (self->type) {
-        case eSraReleaseVersionTypeAlpha:
-            type = "-a";
-            break;
-        case eSraReleaseVersionTypeBeta:
-            type = "-b";
-            break;
-        case eSraReleaseVersionTypeRC:
-            type = "-rc";
-            break;
-        case eSraReleaseVersionTypeFinal:
-            if (self->revision == 0) {
-                type = "";
-            }
-            else {
-                type = "-";
-            }
-            break;
-        default:
-            assert(0);
-            break;
-    }
-
-    if (self->revision == 0) {
-        rc = string_printf(version, size, num_writ,
-            "%V%s", self->version, type);
-    }
-    else {
-        rc = string_printf(version, size, num_writ,
-            "%V%s%d", self->version, type, self->revision);
-    }
-
-    return rc;
-}
diff --git a/libs/klib/status-rc-strings.c b/libs/klib/status-rc-strings.c
deleted file mode 100644
index f890b0d..0000000
--- a/libs/klib/status-rc-strings.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <sysalloc.h>
-
-#define PASTE2(a,b) a##b
-#define STRINGIFY(a) #a
-#define RC_ENUM(type) const char * PASTE2(type,Strings)[] =
-#define RC_ENTRY(a,b) STRINGIFY(a),
-#define RC_VLAST(a)
-#define RC_LAST(a) "INVALID"
-
-#define RC_EMIT 0
-
-#include <klib/rc.h>
-
diff --git a/libs/klib/status-rc.c b/libs/klib/status-rc.c
deleted file mode 100644
index 73f7730..0000000
--- a/libs/klib/status-rc.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include "writer-priv.h"
-#include <klib/writer.h>
-#include <klib/text.h>
-#include <klib/printf.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-#include <os-native.h> /* for strchrnul on non-linux */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-#include <assert.h>
-
-size_t KWrtFmt_rc_t ( char * pout, size_t max, const char * fmt, rc_t rc_in )
-{
-    rc_t rc;
-    const char * str;
-    const char * mod_str;
-    const char * targ_str;
-    const char * ctx_str;
-    const char * obj_str;
-    const char * state_str;
-    size_t needed;
-    size_t mod_size;
-    size_t targ_size;
-    size_t ctx_size;
-    size_t obj_size;
-    size_t state_size;
-    enum RCModule mod;
-    enum RCTarget targ;
-    enum RCContext ctx;
-    int obj;
-    enum RCState state;
-
-    assert (pout);
-    assert (fmt);
-
-    if (*fmt == '#')
-        rc = RCExplain (rc_in, pout, max, &needed);
-
-    else if (rc_in != 0)
-    {
-        mod = GetRCModule (rc_in);
-        targ = GetRCTarget (rc_in);
-        ctx = GetRCContext (rc_in);
-        obj = GetRCObject (rc_in);
-        state = GetRCState (rc_in);
-
-        if ((mod < 0) || (mod > rcLastModule_v1_1))
-            mod = rcLastModule_v1_1;
-
-        if ((targ < 0) || (targ > rcLastTarget_v1_1))
-            targ = rcLastTarget_v1_1;
-
-        if ((ctx < 0) || (ctx > rcLastContext_v1_1))
-            ctx = rcLastContext_v1_1;
-
-        if ((obj < 0) || (obj > rcLastObject_v1_1))
-            obj = rcLastObject_v1_1;
-
-        if ((state < 0) || (state > rcLastState_v1_1))
-            state = rcLastState_v1_1;
-
-        mod_str = RCModuleStrings[mod];
-        str = strchrnul(mod_str, ' ');
-        mod_size = str - mod_str;
-
-        targ_str = RCTargetStrings[targ];
-        str = strchrnul(targ_str, ' ');
-        targ_size = str - targ_str;
-
-        ctx_str = RCContextStrings[ctx];
-        str = strchrnul(ctx_str, ' ');
-        ctx_size = str - ctx_str;
-
-/* object is tricky because it overlaps target */
-        if (obj == 0)
-        {
-            obj_str = RCObjectStrings[obj];
-            str = strchrnul(obj_str, ' ');
-            obj_size = str - obj_str;
-        }
-        else if (obj < rcLastTarget_v1_1)
-        {
-            obj_str = RCTargetStrings[obj];
-            str = strchrnul(obj_str, ' ');
-            obj_size = str - obj_str;
-        }
-        else
-        {
-            obj -= (rcLastTarget_v1_1-1);
-            obj_str = RCObjectStrings[obj];
-            str = strchrnul(obj_str, ' ');
-            obj_size = str - obj_str;
-        }
-
-        state_str = RCStateStrings[state];
-        str = strchrnul(state_str, ' ');
-        state_size = str - state_str;
-
-#if _DEBUGGING
-        rc = string_printf (pout, max, & needed, "RC(%s:%u:%s %*s,%*s,%*s,%*s,%*s)", 
-                            GetRCFilename(), GetRCLineno(), GetRCFunction(),
-                           (uint32_t)mod_size, mod_str,
-                           (uint32_t)targ_size, targ_str,
-                           (uint32_t)ctx_size, ctx_str,
-                           (uint32_t)obj_size, obj_str,
-                           (uint32_t)state_size, state_str);
-#else
-        rc = string_printf (pout, max, & needed, "RC(%*s,%*s,%*s,%*s,%*s)", 
-                           (uint32_t)mod_size, mod_str,
-                           (uint32_t)targ_size, targ_str,
-                           (uint32_t)ctx_size, ctx_str,
-                           (uint32_t)obj_size, obj_str,
-                           (uint32_t)state_size, state_str);
-#endif
-    }
-    else
-    {
-        state = GetRCState (rc_in);
-        state_str = RCStateStrings[state];
-        str = strchrnul(state_str, ' ');
-        state_size = str - state_str;
-        rc = string_printf (pout, max, & needed, "RC(%*s)",
-                           (uint32_t)state_size, state_str);
-    }
-
-    return rc != 0 ? 0 : needed;
-}
diff --git a/libs/klib/status.c b/libs/klib/status.c
deleted file mode 100644
index e54b6b9..0000000
--- a/libs/klib/status.c
+++ /dev/null
@@ -1,436 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*/
-
-#include <klib/extern.h>
-#include <klib/status.h>
-#include "writer-priv.h"
-#include <klib/text.h>
-#include <klib/printf.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-#include <va_copy.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-static KStsLevel G_sts_level = 0;
-
-static KWrtHandler G_sts_handler;
-static KWrtHandler G_sts_lib_handler;
-
-static KFmtHandler G_sts_formatter;
-static KStsFmtFlags G_sts_formatter_flags;
-static KFmtHandler G_sts_lib_formatter;
-static KStsFmtFlags G_sts_lib_formatter_flags;
-
-static
-rc_t CC KStsDefaultFormatter( void* self, KWrtHandler* writer,
-                              size_t argc, const wrt_nvp_t args[],
-                              size_t envc, const wrt_nvp_t envs[] )
-{
-    rc_t rc = 0;
-    size_t num_writ, nsize;
-    uint32_t mlen;
-    char buffer[8192], *nbuffer;
-    const char* msg, *mend;
-
-    /* if writer is null than silence */
-    if( writer == NULL || writer->writer == NULL ) {
-        return rc;
-    }
-    msg = wrt_nvp_find_value(envc, envs, "message");
-    if( msg != NULL ) {
-        mend = msg + strlen(msg);
-        /* strip trailing newlines */
-        while( mend != msg && (*mend == '\n' || *mend == '\r') ) {
-            --mend;
-        }
-        mlen = ( uint32_t ) ( mend - msg );
-    } else {
-        mlen = 0;
-    }
-
-    nbuffer = buffer;
-    nsize = sizeof(buffer);
-    do {
-        rc = string_printf(nbuffer, nsize, & num_writ, "%s %s.%s: %.*s\n",
-                                 wrt_nvp_find_value(envc, envs, "timestamp"),
-                                 wrt_nvp_find_value(envc, envs, "app"),
-                                 wrt_nvp_find_value(envc, envs, "version"),
-                                 ( uint32_t ) mlen, msg);
-        if( num_writ > nsize ) {
-            assert ( nbuffer == buffer );
-            nbuffer = malloc(nsize = num_writ + 2);
-            if( nbuffer == NULL ) {
-                rc = RC(rcRuntime, rcLog, rcLogging, rcMemory, rcExhausted);
-                break;
-            }
-            continue;
-        }
-        /* replace newlines with spaces, excluding last one */
-        for(nsize = 0; nsize < num_writ - 1; nsize++) {
-            if( nbuffer[nsize] == '\n' || nbuffer[nsize] == '\r' ) {
-                nbuffer[nsize] = ' ';
-            }
-        }
-        break;
-    } while(true);
-    if( rc == 0 ) {
-        rc = LogFlush(writer, nbuffer, num_writ);
-    }
-    if( nbuffer != buffer ) {
-        free(nbuffer);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KStsInit ( void )
-{
-    rc_t rc;
-    
-    G_sts_level = 0;
-    rc = KStsHandlerSetStdOut();
-
-    if (rc == 0)
-        rc = KStsLibHandlerSet(NULL, NULL);
-
-    if (rc == 0)
-        rc = KStsFmtHandlerSetDefault();
-
-    if (rc == 0)
-        rc = KStsLibFmtHandlerSetDefault();
-
-    return rc;
-}
-
-static
-rc_t CC sts_print(KFmtHandler* formatter, const KStsFmtFlags flags, KWrtHandler* writer, const char* msg, va_list args)
-{
-    rc_t rc = 0;
-    char* nbuffer;
-    size_t num_writ, remaining;
-
-    uint32_t envc = 0;
-    wrt_nvp_t envs[5];
-    char ebuffer[2048];
-    char mbuffer[2048];
-    KFmtWriter fmtwrt;
-
-    assert(formatter != NULL);
-    assert(writer != NULL);
-
-    fmtwrt = formatter->formatter;
-    if( fmtwrt == NULL ) {
-        fmtwrt = KStsDefaultFormatter;
-    }
-    if( fmtwrt == KStsDefaultFormatter && writer->writer == NULL ) {
-        /* default formatting with NULL writer -> silence */
-        return rc;
-    }
-    nbuffer = (char*)ebuffer;
-    remaining = sizeof(ebuffer);
-    do {
-#define FIX_UP() if(rc){break;} remaining -= num_writ; nbuffer += num_writ
-        if( flags & (kstsFmtTimestamp | kstsFmtLocalTimestamp) ) {
-            if( flags & kstsFmtLocalTimestamp ) {
-                rc = LogSimpleTimestamp(nbuffer, remaining, &num_writ);
-            } else {
-                rc = LogTimestamp(nbuffer, remaining, &num_writ);
-            }
-            nbuffer[num_writ++] = '\0';
-            envs[envc].name = "timestamp";
-            envs[envc++].value = nbuffer;
-            FIX_UP();
-        }
-        if( flags & kstsFmtPid ) {
-            rc = LogPID(nbuffer, remaining, &num_writ);
-            nbuffer[num_writ++] = '\0';
-            envs[envc].name = "pid";
-            envs[envc++].value = nbuffer;
-            FIX_UP();
-        }
-        if( flags & kstsFmtAppName ) {
-            rc = LogAppName(nbuffer, remaining, &num_writ);
-            nbuffer[num_writ++] = '\0';
-            envs[envc].name = "app";
-            envs[envc++].value = nbuffer;
-            FIX_UP();
-        }
-        if( flags & kstsFmtAppVersion ) {
-            rc = LogAppVersion(nbuffer, remaining, &num_writ);
-            nbuffer[num_writ++] = '\0';
-            envs[envc].name = "version";
-            envs[envc++].value = nbuffer;
-            FIX_UP();
-        }
-#undef FIX_UP
-    } while(false);
-    /* env must have one spare element for message added text below */
-    if( rc == 0 && envc >= (sizeof(envs)/sizeof(envs[0])) ) {
-        rc = RC(rcRuntime, rcLog, rcLogging, rcTable, rcInsufficient);
-    }
-    nbuffer = (char*)mbuffer;
-    remaining = sizeof(mbuffer);
-
-    if( rc == 0 ) {
-        if( flags & kstsFmtMessage ) {
-            if( msg == NULL || msg[0] == '\0' ) {
-                msg = "empty status message";
-            }
-            do {
-                va_list args_copy;
-                va_copy(args_copy, args);
-                rc = string_vprintf(nbuffer, remaining, &num_writ, msg, args_copy);
-                va_end(args_copy);
-                if( num_writ > remaining ) {
-                    if(nbuffer != mbuffer) {
-                        free(nbuffer);
-                    }
-                    nbuffer = malloc(remaining = num_writ);
-                    if( nbuffer == NULL ) {
-                        rc = RC(rcRuntime, rcLog, rcLogging, rcMemory, rcExhausted);
-                    }
-                } else {
-                    if( rc == 0 ) {
-                        envs[envc].name = "message";
-                        envs[envc++].value = nbuffer;
-                    }
-                    break;
-                }
-            } while( rc == 0 );
-        }
-    }
-    if( rc != 0 ) {
-        /* print reason for failure */
-        rc = string_printf((char*)mbuffer, sizeof(mbuffer), NULL, "status failure: %R in '%s'", rc, msg);
-        envs[envc].name = "message";
-        envs[envc++].value = mbuffer;
-    }
-    wrt_nvp_sort(envc, envs);
-    rc = fmtwrt(formatter->data, writer, 0, NULL, envc, envs);
-    if(nbuffer != mbuffer) {
-        free(nbuffer);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KStsMsg(const char* msg, ...)
-{
-    rc_t rc;
-    va_list args;
-
-    va_start(args, msg);
-    rc = sts_print(KStsFmtHandlerGet(), G_sts_formatter_flags, KStsHandlerGet(), msg, args);
-    va_end(args);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KStsLibMsg(const char* msg, ...)
-{
-    rc_t rc;
-    va_list args;
-
-    va_start(args, msg);
-    rc = sts_print(KStsLibFmtHandlerGet(), G_sts_lib_formatter_flags, KStsLibHandlerGet(), msg, args);
-    va_end(args);
-    return rc;
-}
-
-LIB_EXPORT KStsLevel CC KStsLevelGet(void)
-{
-    return G_sts_level;
-}
-
-LIB_EXPORT void CC KStsLevelSet(KStsLevel lvl)
-{
-    G_sts_level = lvl;
-}
-
-LIB_EXPORT void CC KStsLevelAdjust(int32_t adjust)
-{
-    int32_t l = KStsLevelGet();
-    l += adjust;
-    KStsLevelSet( l < 0 ? 0 : l);
-}
-
-LIB_EXPORT rc_t CC KStsHandlerSetStdOut ( void )
-{
-    return KStsHandlerSet( KWrt_DefaultWriter, KWrt_DefaultWriterDataStdOut );
-}
-
-LIB_EXPORT rc_t CC KStsLibHandlerSetStdOut ( void )
-{
-    return KStsLibHandlerSet( KWrt_DefaultWriter, KWrt_DefaultWriterDataStdOut );
-}
-
-LIB_EXPORT rc_t CC KStsHandlerSetStdErr ( void )
-{
-    return KStsHandlerSet( KWrt_DefaultWriter, KWrt_DefaultWriterDataStdErr );
-}
-
-LIB_EXPORT rc_t CC KStsLibHandlerSetStdErr ( void )
-{
-    return KStsLibHandlerSet( KWrt_DefaultWriter, KWrt_DefaultWriterDataStdErr );
-}
-
-LIB_EXPORT rc_t CC KStsHandlerSet ( KWrtWriter writer, void * writer_data )
-{
-    G_sts_handler.writer = writer;
-    G_sts_handler.data = writer_data;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KStsLibHandlerSet ( KWrtWriter writer, void * writer_data )
-{
-    G_sts_lib_handler.writer = writer;
-    G_sts_lib_handler.data = writer_data;
-    return 0;
-}
-
-LIB_EXPORT void * CC KStsDataGet ( void )
-{
-    return ( KStsHandlerGet()->data );
-}
-
-LIB_EXPORT void * CC KStsLibDataGet ( void )
-{
-    return ( KStsLibHandlerGet()->data );
-}
-
-LIB_EXPORT KWrtWriter CC KStsWriterGet ( void )
-{
-    return ( KStsHandlerGet()->writer );
-}
-
-LIB_EXPORT KWrtWriter CC KStsLibWriterGet ( void )
-{
-    return ( KStsLibHandlerGet()->writer );
-}
-
-LIB_EXPORT KWrtHandler * CC KStsHandlerGet ( void )
-{
-    return ( &G_sts_handler );
-}
-
-LIB_EXPORT KWrtHandler * CC KStsLibHandlerGet ( void )
-{
-    return ( &G_sts_lib_handler );
-}
-
-static const uint32_t sts_dflt_opt = kstsFmtTimestamp | kstsFmtPid |
-                                     kstsFmtMessage | kstsFmtAppName | kstsFmtAppVersion;
-
-LIB_EXPORT rc_t CC KStsFmtHandlerSetDefault ( void )
-{
-    rc_t rc = KStsFmtHandlerSet(KStsDefaultFormatter, 0, NULL);
-    if( rc == 0 ) {
-        G_sts_formatter_flags = sts_dflt_opt;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KStsLibFmtHandlerSetDefault ( void )
-{
-    rc_t rc = KStsLibFmtHandlerSet(KStsDefaultFormatter, 0, NULL);
-    if( rc == 0 ) {
-        G_sts_lib_formatter_flags = sts_dflt_opt;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KStsFmtFlagsSet ( KStsFmtFlags flags )
-{
-    G_sts_formatter_flags |= flags;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KStsLibFmtFlagsSet ( KStsFmtFlags flags )
-{
-    G_sts_lib_formatter_flags |= flags;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KStsFmtHandlerSet ( KFmtWriter formatter, KStsFmtFlags flags, void* data )
-{
-    if( formatter == NULL ) {
-        return RC(rcRuntime, rcLog, rcLogging, rcFunction, rcNull);
-    }
-    G_sts_formatter.formatter = formatter;
-    G_sts_formatter.data = data;
-    KStsFmtFlagsSet(flags);
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KStsLibFmtHandlerSet ( KFmtWriter formatter, KStsFmtFlags flags, void* data )
-{
-    if( formatter == NULL ) {
-        return RC(rcRuntime, rcLog, rcLogging, rcFunction, rcNull);
-    }
-    G_sts_lib_formatter.formatter = formatter;
-    G_sts_lib_formatter.data = data;
-    KStsLibFmtFlagsSet(flags);
-    return 0;
-}
-
-LIB_EXPORT void * CC KStsFmtDataGet ( void )
-{
-    return ( KStsFmtHandlerGet()->data );
-}
-
-LIB_EXPORT void * CC KStsLibFmtDataGet ( void )
-{
-    return ( KStsFmtHandlerGet()->data );
-}
-
-LIB_EXPORT KFmtWriter CC KStsFmtWriterGet ( void )
-{
-    return ( KStsFmtHandlerGet()->formatter ? KStsFmtHandlerGet()->formatter : KStsDefaultFormatter);
-}
-
-LIB_EXPORT KFmtWriter CC KStsLibFmtWriterGet ( void )
-{
-    return ( KStsLibFmtHandlerGet()->formatter ? KStsLibFmtHandlerGet()->formatter : KStsDefaultFormatter);
-}
-
-LIB_EXPORT KFmtHandler * CC KStsFmtHandlerGet ( void )
-{
-    return ( &G_sts_formatter );
-}
-
-LIB_EXPORT KFmtHandler * CC KStsLibFmtHandlerGet ( void )
-{
-    return ( &G_sts_lib_formatter );
-}
-
-LIB_EXPORT KStsFmtFlags CC KStsFmtFlagsGet ( void )
-{
-    return G_sts_formatter_flags;
-}
-
-LIB_EXPORT KStsFmtFlags CC KStsLibFmtFlagsGet ( void )
-{
-    return G_sts_lib_formatter_flags;
-}
diff --git a/libs/klib/symtab.c b/libs/klib/symtab.c
deleted file mode 100644
index d30df64..0000000
--- a/libs/klib/symtab.c
+++ /dev/null
@@ -1,736 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include <klib/symtab.h>
-#include <klib/symbol.h>
-#include <klib/token.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * KSymbol
- *  a name to object mapping
- */
-
-
-/* Init
- *  initialize a symbol without allocating space
- *
- *  "self" [ IN ] - where to initialize
- *
- *  "name" [ IN ] - symbol name
- *
- *  "type" [ IN ] - symbol type
- *
- *  "obj" [ IN, NULL OKAY ] - optional object mapping
- *
- */
-KLIB_EXTERN rc_t CC KSymbolInit ( KSymbol * self, 
-    const String * name, uint32_t type, const void * obj)
-{
-    rc_t rc;
-
-    if ( name == NULL )
-        rc = RC ( rcText, rcString, rcConstructing, rcName, rcNull );
-    else if ( name -> len == 0 )
-        rc = RC ( rcText, rcString, rcConstructing, rcName, rcEmpty );
-    else
-    {
-        string_copy ( ( char* ) ( self + 1 ), name -> size + 1, name -> addr, name -> size );
-        StringInit ( & self -> name, ( char* ) ( self + 1 ), name -> size, name -> len );
-        self -> u . obj = obj;
-        self -> dad = NULL;
-        self -> type = type;
-
-        return 0;
-    }
-    return rc;
-}
-
-/* Make
- *  create a symbol
- *
- *  "sym" [ OUT ] - return parameter for symbol
- *
- *  "name" [ IN ] - symbol name
- *
- *  "type" [ IN ] - symbol type
- *
- *  "obj" [ IN, NULL OKAY ] - optional object mapping
- */
-LIB_EXPORT rc_t CC KSymbolMake ( KSymbol **symp,
-    const String *name, uint32_t type, const void *obj )
-{
-    rc_t rc;
-    if ( symp == NULL )
-        rc = RC ( rcText, rcString, rcConstructing, rcParam, rcNull );
-    else
-    {
-        KSymbol *sym = malloc ( sizeof *sym + name -> size + 1 );
-        if ( sym == NULL )
-            rc = RC ( rcText, rcString, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            rc = KSymbolInit (sym, name, type, obj);
-            if (rc == 0)
-            {
-                * symp = sym;
-                return 0;
-            }
-            free (sym);
-        }
-        * symp = NULL;
-    }
-    return rc;
-}
-
-/* Whack
- */
-LIB_EXPORT void CC KSymbolWhack ( BSTNode *n, void *ignore )
-{
-    KSymbol *self = ( KSymbol* ) n;
-
-    if ( self -> type == eNamespace )
-        BSTreeWhack ( & self -> u . scope, KSymbolWhack, ignore );
-
-    free ( self );
-}
-
-/* Cmp
- */
-LIB_EXPORT int CC KSymbolCmp ( const void *item, const BSTNode *n )
-{
-    const String *a = item;
-    const KSymbol *b = ( const KSymbol* ) n;
-
-    return StringOrderNoNullCheck ( a, & b -> name );
-}
-
-/* Sort
- */
-LIB_EXPORT int CC KSymbolSort ( const BSTNode *item, const BSTNode *n )
-{
-    const KSymbol *a = ( const KSymbol* ) item;
-    const KSymbol *b = ( const KSymbol* ) n;
-
-    return StringOrderNoNullCheck ( & a -> name, & b -> name );
-}
-
-
-
-/*--------------------------------------------------------------------------
- * KSymTable
- *  scoped stack of BSTree
- */
-
-
-/* Init
- *  create an empty symbol table
- *
- *  "intrinsic" [ IN ] - intrinsic scope
- */
-LIB_EXPORT rc_t CC KSymTableInit ( KSymTable *self, const BSTree *intrinsic )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcText, rcTree, rcConstructing, rcSelf, rcNull );
-    else
-    {
-        self -> ns = NULL;
-        VectorInit ( & self -> stack, 0, 16 );
-
-        if ( intrinsic == NULL )
-        {
-            self -> intrinsic = 0;
-            return 0;
-        }
-
-        self -> intrinsic = 1;
-        rc = VectorAppend ( & self -> stack, NULL, intrinsic );
-    }
-
-    return rc;
-}
-
-/* Whack
- *  must be called to clean up stack
- */
-#ifndef KSymTableWhack
-LIB_EXPORT void CC KSymTableWhack ( KSymTable *self )
-{
-    if ( self != NULL )
-        VectorWhack ( & self -> stack, NULL, NULL );
-}
-#endif
-
-
-/* PushScope
- *  pushes a tree onto stack
- *  fails if count == depth
- *  otherwise, pushes scope into top of stack
- *
- *  "scope" [ IN ] - current top scope
- */
-LIB_EXPORT rc_t CC KSymTablePushScope ( const KSymTable *cself, BSTree *scope )
-{
-    KSymTable *self = ( KSymTable* ) cself;
-    assert ( self != NULL );
-    assert ( scope != NULL );
-    return VectorAppend ( & self -> stack, NULL, scope );
-}
-
-
-/* PopScope
- *  removes a tree from stack
- *  noop if count < self->intrinsic,
- *  because stack bottom will be intrinsic scope
- */
-LIB_EXPORT void CC KSymTablePopScope ( const KSymTable *cself )
-{
-    if ( cself != NULL && cself -> stack . len > cself -> intrinsic )
-        -- ( ( KSymTable* ) cself ) -> stack . len;
-}
-
-
-/* PushNamespace
- *  pushes a namespace scope onto stack
- */
-LIB_EXPORT rc_t CC KSymTablePushNamespace ( const KSymTable *cself, KSymbol *ns )
-{
-    rc_t rc;
-    KSymTable *self = ( KSymTable* ) cself;
-    assert ( ns != NULL && ns -> type == eNamespace );
-    rc = KSymTablePushScope ( self, & ns -> u . scope );
-    if ( rc == 0 )
-        self -> ns = ns;
-    return rc;
-}
-
-
-/* PopNamespace
- */
-LIB_EXPORT void CC KSymTablePopNamespace ( const KSymTable *cself )
-{
-    KSymTable *self = ( KSymTable* ) cself;
-    assert ( self != NULL );
-    if ( self -> ns != NULL )
-    {
-        KSymTablePopScope ( self );
-        self -> ns = self -> ns -> dad;
-    }
-}
-
-
-/* CreateNamespace
- *  given a name, make it into a namespace,
- *
- *  "name" [ IN ] - name of namespace. if being created within
- *  another namespace, it will be linked to the parent.
- */
-LIB_EXPORT rc_t CC KSymTableCreateNamespace ( KSymTable *self, KSymbol **nsp, const String *name )
-{
-    rc_t rc;
-
-    assert ( self != NULL );
-    assert ( nsp != NULL );
-    assert ( name != NULL );
-
-    if ( name -> len == 0 )
-        rc = RC ( rcText, rcTree, rcInserting, rcString, rcEmpty );
-    else if ( VectorLength ( & self -> stack ) <= self -> intrinsic )
-        rc = RC ( rcText, rcTree, rcInserting, rcTree, rcReadonly );
-    else
-    {
-        uint32_t len = VectorLength ( & self -> stack );
-        BSTree *scope = VectorGet ( & self -> stack, len - 1 );
-        KSymbol *ns = ( KSymbol* ) BSTreeFind ( scope, name, KSymbolCmp );
-        if ( ns != NULL )
-        {
-            if ( ns -> type == eNamespace )
-            {
-                * nsp = ns;
-                return 0;
-            }
-
-            rc = RC ( rcText, rcTree, rcInserting, rcName, rcExists );
-        }
-        else
-        {
-            ns = malloc ( sizeof *ns + name -> size + 1 );
-            if ( ns == NULL )
-                rc = RC ( rcText, rcTree, rcInserting, rcMemory, rcExhausted );
-            else
-            {
-                /* initialize namespace */
-                string_copy ( ( char* ) ( ns + 1 ), name -> size + 1, name -> addr, name -> size );
-                StringInit ( & ns -> name, ( char* ) ( ns + 1 ), name -> size, name -> len );
-                BSTreeInit ( & ns -> u . scope );
-                ns -> dad = self -> ns;
-                ns -> type = eNamespace;
-
-                /* now insert into parent scope */
-                assert ( scope != NULL );
-                BSTreeInsert ( scope, & ns -> n, KSymbolSort );
-
-                /* done */
-                * nsp = ns;
-                return 0;
-            }
-        }
-    }
-
-    * nsp = NULL;
-
-    return rc;
-}
-
-
-/* CreateSymbol
- *  given a name, create an object reference
- *
- *  "symp" [ OUT, NULL OKAY ] - optional return parameter for
- *  newly created symbol, which is entered into the top scope
- *  and only returned for convenience.
- *
- *  "name" [ IN ] - symbol name. if being created within a
- *  namespace, the symbol will be linked to the parent.
- *
- *  "id" [ IN ] - if the symbol type
- *
- *  "obj" [ IN, NULL OKAY ] - if the object has been created
- *  at the point of symbol definition, it may be provided.
- */
-LIB_EXPORT rc_t CC KSymTableCreateSymbol ( KSymTable *self, KSymbol **symp,
-    const String *name, uint32_t id, const void *obj )
-{
-    rc_t rc;
-    KSymbol *sym = NULL;
-
-    if ( self == NULL )
-        rc = RC ( rcText, rcTree, rcInserting, rcSelf, rcNull );
-    else if ( name == NULL )
-        rc = RC ( rcText, rcTree, rcInserting, rcString, rcNull );
-    else if ( name -> len == 0 )
-        rc = RC ( rcText, rcTree, rcInserting, rcString, rcEmpty );
-    else if ( VectorLength ( & self -> stack ) <= self -> intrinsic )
-        rc = RC ( rcText, rcTree, rcInserting, rcTree, rcReadonly );
-    else
-    {
-        sym = malloc ( sizeof *sym + name -> size + 1 );
-        if ( sym == NULL )
-            rc = RC ( rcText, rcTree, rcInserting, rcMemory, rcExhausted );
-        else
-        {
-            KSymbol *exists;
-            uint32_t len = VectorLength ( & self -> stack );
-            BSTree *scope = VectorGet ( & self -> stack, len - 1 );
-
-            /* initialize symbol */
-            string_copy ( ( char* ) ( sym + 1 ), name -> size + 1, name -> addr, name -> size );
-            StringInit ( & sym -> name, ( char* ) ( sym + 1 ), name -> size, name -> len );
-            sym -> u . obj = obj;
-            sym -> dad = self -> ns;
-            sym -> type = id;
-
-            assert ( scope != NULL );
-            rc = BSTreeInsertUnique ( scope, & sym -> n, ( BSTNode** ) & exists, KSymbolSort );
-            if ( rc != 0 )
-            {
-                free ( sym );
-                sym = NULL;
-            }
-        }
-    }
-
-    if ( symp != NULL )
-        * symp = sym;
-
-    return rc;
-}
-
-
-/* DupSymbol
- *  given a symbol, create a duplicate
- *
- *  "dup" [ OUT, NULL OKAY ] - optional return parameter for
- *  newly created symbol, which is entered into the top scope
- *  and only returned for convenience.
- *
- *  "sym" [ IN ] - symbol to copy.
- *
- *  "id" [ IN ] - if the symbol type
- *
- *  "obj" [ IN, NULL OKAY ] - if the object has been created
- *  at the point of symbol definition, it may be provided.
- */
-static
-rc_t CC KSymTableDupNamespaces ( KSymTable *self, const KSymbol *ns )
-{
-    rc_t rc;
-
-    if ( ns == NULL )
-        return 0;
-
-    rc = KSymTableDupNamespaces ( self, ns -> dad );
-    if ( rc == 0 )
-    {
-        KSymbol *dup;
-        rc = KSymTableCreateNamespace ( self, & dup, & ns -> name );
-        if ( rc == 0 )
-            rc = KSymTablePushNamespace ( self, dup );
-    }
-
-    return rc;
-}
-
-static
-void CC KSymTablePopDupNamespaces ( KSymTable *self, const KSymbol *ns )
-{
-    for ( ; ns != NULL; ns = ns -> dad )
-        KSymTablePopNamespace ( self );
-}
-
-LIB_EXPORT rc_t CC KSymTableDupSymbol ( KSymTable *self, struct KSymbol **dupp,
-    const KSymbol *sym, uint32_t id, const void *obj )
-{
-    rc_t rc;
-    KSymbol *dup = NULL;
-
-    if ( self == NULL )
-        rc = RC ( rcText, rcTree, rcInserting, rcSelf, rcNull );
-    else if ( sym == NULL )
-        rc = RC ( rcText, rcTree, rcInserting, rcString, rcNull );
-    else if ( VectorLength ( & self -> stack ) <= self -> intrinsic )
-        rc = RC ( rcText, rcTree, rcInserting, rcTree, rcReadonly );
-    else
-    {
-        KSymbol *old = self -> ns;
-        rc = KSymTableDupNamespaces ( self, sym -> dad );
-        if ( rc == 0 )
-        {
-            rc = KSymTableCreateSymbol ( self, & dup, & sym -> name, id, obj );
-            KSymTablePopDupNamespaces ( self, dup -> dad );
-        }
-        self -> ns = old;
-    }
-
-    if ( dupp != NULL )
-        * dupp = dup;
-
-    return rc;
-}
-
-
-/* RemoveSymbol
- *  removes symbol from table
- *
- *  "sym" [ IN ] - symbol to be removed
- */
-LIB_EXPORT rc_t CC KSymTableRemoveSymbol ( KSymTable *self, const KSymbol *sym )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcText, rcTree, rcRemoving, rcSelf, rcNull );
-    else if ( sym == NULL )
-        rc = RC ( rcText, rcTree, rcRemoving, rcParam, rcNull );
-    else
-    {
-        uint32_t i;
-        BSTree *scope;
-
-        /* if the symbol lives within a namespace,
-           it won't be found directly. */
-        if ( sym -> dad != NULL )
-        {
-            KSymbol *ns = sym -> dad;
-            if ( ! BSTreeUnlink ( & ns -> u . scope, ( BSTNode* ) & sym -> n ) )
-                return RC ( rcText, rcTree, rcRemoving, rcNode, rcCorrupt );
-
-            /* if the namespace is not now empty, we're done */
-            if ( ns -> u . scope . root != NULL )
-                return 0;
-
-            /* remove and delete the namespace */
-            rc = KSymTableRemoveSymbol ( self, ns );
-            if ( rc == 0 )
-                KSymbolWhack ( & ns -> n, NULL );
-            return rc;
-        }
-
-        /* walk the stack trying to find owning scope */
-        for ( i = VectorLength ( & self -> stack ); i > self -> intrinsic; )
-        {
-            scope = VectorGet ( & self -> stack, -- i );
-            if ( BSTreeUnlink ( scope, ( BSTNode* ) & sym -> n ) )
-                return 0;
-        }
-
-        /* can't remove it from intrinsic table,
-           so see if it wasn't found or if it's intrinsic */
-        scope = VectorGet ( & self -> stack, 0 );
-        if ( scope != NULL && BSTreeFind ( scope, & sym -> name, KSymbolCmp ) != NULL )
-            rc = RC ( rcText, rcTree, rcRemoving, rcTree, rcReadonly );
-        else
-            rc = RC ( rcText, rcTree, rcRemoving, rcNode, rcNotFound );
-    }
-
-    return rc;
-}
-
-
-/* Find
- *  finds a symbol within the scope stack
- */
-LIB_EXPORT KSymbol * CC KSymTableFind ( const KSymTable *self, const String *name )
-{
-    if ( self != NULL && name != NULL && name -> len != 0 )
-    {
-        uint32_t i;
-
-        /* this is a pretty bad way to do things, but
-           we're a fairly low frequency symbol table... */
-        for ( i = VectorLength ( & self -> stack ); i > 0; )
-        {
-            BSTree *scope = VectorGet ( & self -> stack, -- i );
-            KSymbol *sym = ( KSymbol* )
-                BSTreeFind ( scope, name, KSymbolCmp );
-            if ( sym != NULL )
-                return sym;
-        }
-    }
-
-    return NULL;
-}
-
-static
-KSymbol * CC KSymTableDeepFindSymbol ( const KSymTable *self, const KSymbol *sym, uint32_t *level )
-{
-    uint32_t i;
-    KSymbol *found;
-
-    if ( sym -> dad != NULL )
-    {
-        found = KSymTableDeepFindSymbol ( self, sym -> dad, level );
-        if ( found == NULL || found -> type != eNamespace )
-            return NULL;
-        return ( KSymbol* ) BSTreeFind ( & found -> u . scope,
-            & sym -> name, KSymbolCmp );
-    }
-
-    for ( i = * level; i > 0; )
-    {
-        BSTree *scope = VectorGet ( & self -> stack, -- i );
-        found = ( KSymbol* ) BSTreeFind ( scope, & sym -> name, KSymbolCmp );
-        if ( found != NULL )
-        {
-            * level = i;
-            return found;
-        }
-    }
-
-    * level = 0;
-    return NULL;
-}
-
-LIB_EXPORT KSymbol * CC KSymTableFindSymbol ( const KSymTable *self, const KSymbol *sym )
-{
-    if ( self != NULL && sym != NULL )
-    {
-        uint32_t i;
-
-        /* the simple symbols are easy */
-        if ( sym -> dad == NULL )
-            return KSymTableFind ( self, & sym -> name );
-
-        /* namespaces are harder...
-
-           we're going to use recursion to find the root namespace
-           ( although it's unlikely to go beyond a practical limit )
-           and once the root name symbol is found, we need to step
-           backwards through the symtab scopes until we find the root.
-
-           the problem is that if that root doesn't produce a hit for
-           the requested symbol, we still have to keep looking through
-           other scopes
-        */
-
-        for ( i = VectorLength ( & self -> stack ); i > 0; )
-        {
-            KSymbol *found = KSymTableDeepFindSymbol ( self, sym, & i );
-            if ( found != NULL )
-                return found;
-        }
-    }
-
-    return NULL;
-}
-
-
-/* FindIntrinsic
- *  find an intrinsic symbol
- */
-LIB_EXPORT KSymbol * CC KSymTableFindIntrinsic ( const KSymTable *self, const String *name )
-{
-    KSymbol *sym = NULL;
-
-    if ( self != NULL && name != NULL && name -> len != 0 )
-    {
-        uint32_t i;
-
-        for ( i = self -> intrinsic; i > 0; )
-        {
-            BSTree *scope = VectorGet ( & self -> stack, -- i );
-            if ( scope != NULL )
-            {
-                KSymbol *sym_ = ( KSymbol* )
-                    BSTreeFind ( scope, name, KSymbolCmp );
-                if ( sym_ != NULL )
-                    return sym_;
-            }
-        }
-    }
-
-    return sym;
-}
-
-
-/* FindGlobal
- *  find a symbol at global scope
- */
-LIB_EXPORT KSymbol * CC KSymTableFindGlobal ( const KSymTable *self, const String *name )
-{
-    KSymbol *sym = NULL;
-
-    if ( self != NULL && name != NULL && name -> len != 0 )
-    {
-        uint32_t i;
-
-        for ( i = self -> intrinsic + 1; i > 0; )
-        {
-            BSTree *scope = VectorGet ( & self -> stack, -- i );
-            if ( scope != NULL )
-            {
-                KSymbol *sym_ = ( KSymbol* )
-                    BSTreeFind ( scope, name, KSymbolCmp );
-                if ( sym_ != NULL )
-                    return sym_;
-            }
-        }
-    }
-
-    return sym;
-}
-
-
-/* FindShallow
- *  find a symbol in top scope
- */
-LIB_EXPORT KSymbol * CC KSymTableFindShallow ( const KSymTable *self, const String *name )
-{
-    KSymbol *sym = NULL;
-
-    if ( self != NULL && name != NULL && name -> len != 0 )
-    {
-        uint32_t len = VectorLength ( & self -> stack );
-        if ( len > 0 )
-        {
-            BSTree *scope = VectorGet ( & self -> stack, len - 1 );
-            if ( scope != NULL )
-            {
-                sym = ( KSymbol* )
-                    BSTreeFind ( scope, name, KSymbolCmp );
-            }
-        }
-    }
-
-    return sym;
-}
-
-
-/* FindNext
- *  given a symbol that was found in nearest scope
- *  find next symbol of the same simple name in
- *  farther scopes
- */
-LIB_EXPORT KSymbol * CC KSymTableFindNext ( const KSymTable *self, const KSymbol *sym, uint32_t *id )
-{
-    KSymbol *next = NULL;
-
-    uint32_t i = 0;
-    if ( id != NULL )
-    {
-        i = * id;
-        * id = 0;
-    }
-
-    if ( self != NULL && sym != NULL )
-    {
-        BSTree *scope;
-        uint32_t len = VectorLength ( & self -> stack );
-
-        /* if the previous scope was not given */
-        if ( i == 0 || i > len )
-        {
-            for ( i = len; i > 0; )
-            {
-                scope = VectorGet ( & self -> stack, -- i );
-                next = ( KSymbol* ) BSTreeFind ( scope, & sym -> name, KSymbolCmp );
-                if ( next == sym )
-                {
-                    ++ i;
-                    break;
-                }
-            }
-
-            /* bail if not found */
-            if ( i == 0 )
-                return NULL;
-        }
-
-        /* continue the search */
-        for ( -- i ; i > 0; )
-        {
-            scope = VectorGet ( & self -> stack, -- i );
-            next = ( KSymbol* ) BSTreeFind ( scope, & sym -> name, KSymbolCmp );
-            if ( next != NULL )
-            {
-                if ( id != NULL )
-                    * id = i + 1;
-                break;
-            }
-        }
-    }
-
-    return next;
-}
diff --git a/libs/klib/text.c b/libs/klib/text.c
deleted file mode 100644
index b811c45..0000000
--- a/libs/klib/text.c
+++ /dev/null
@@ -1,841 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include <klib/text.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-#include <va_copy.h>
-
-#include <stdlib.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <errno.h>
-#include <assert.h>
-
-/*--------------------------------------------------------------------------
- * String
- *  pseudo-intrinsic string
- */
-
-/* StringCopy
- *  allocates a copy of a string
- */
-LIB_EXPORT rc_t CC StringCopy ( const String **cpy, const String *str )
-{
-    if ( cpy != NULL )
-    {
-        if ( str != NULL )
-        {
-            size_t size = str -> size;
-            String *s = malloc ( sizeof * s + str -> size + 1 );
-            if ( s != NULL )
-            {
-                char *addr = ( char* ) ( s + 1 );
-                StringInit ( s, addr, size, str -> len );
-                memcpy ( addr, str -> addr, size );
-                addr [ size ] = 0;
-                * cpy = s;
-                return 0;
-            }
-
-            * cpy = NULL;
-            return RC ( rcText, rcString, rcCopying, rcMemory, rcInsufficient );
-        }
-
-        * cpy = NULL;
-    }
-    return RC ( rcText, rcString, rcCopying, rcParam, rcNull );
-}
-
-/* StringConcat
- *  concatenate one string onto another
- */
-LIB_EXPORT rc_t CC StringConcat ( const String **cat, const String *a, const String *b )
-{
-    if ( cat != NULL )
-    {
-        if ( a != NULL && b != NULL )
-        {
-            size_t size = a -> size + b -> size;
-            String *s = malloc ( sizeof * s + size + 1 );
-            if ( s != NULL )
-            {
-                char *addr = ( char* ) ( s + 1 );
-                StringInit ( s, addr, size, a -> len + b -> len );
-                memcpy ( addr, a -> addr, a -> size );
-                memcpy ( & addr [ a -> size ], b -> addr, b -> size );
-                addr [ size ] = 0;
-                * cat = s;
-                return 0;
-            }
-
-            * cat = NULL;
-            return RC ( rcText, rcString, rcConcatenating, rcMemory, rcInsufficient );
-        }
-
-        * cat = NULL;
-    }
-    return RC ( rcText, rcString, rcConcatenating, rcParam, rcNull );
-}
-
-/* StringSubstr
- *  creates a substring of an existing one
- *  note that the substring is always a non-allocated copy
- *  and is dependent upon the lifetime of its source
- *
- *  returns "sub" if "idx" was valid
- *  or NULL otherwise
- *
- *  "len" may be 0 to indicate infinite length
- *  or may extend beyond end of source string.
- */
-LIB_EXPORT String * CC StringSubstr ( const String *str, String *sub,
-    uint32_t idx, uint32_t len )
-{
-    if ( str != NULL && sub != NULL && idx < str -> len )
-    {
-        const char *addr = string_idx ( str -> addr, str -> size, idx );
-        if ( addr != NULL )
-        {
-            sub -> size = str -> size - ( size_t ) ( addr - str -> addr );
-            sub -> len = str -> len - idx;
-            sub -> addr = addr;
-            if ( len > 0 && len < sub -> len )
-            {
-                const char *end = string_idx ( sub -> addr, sub -> size, len );
-                if ( end != NULL )
-                {
-                    sub -> size = ( size_t ) ( end - sub -> addr );
-                    sub -> len = len;
-                }
-            }
-            return sub;
-        }
-    }
-    return NULL;
-}
-
-/* StringHead
- *  access the first character
- *
- *  this is an efficient enough function to be included.
- *  the generic functions of accessing characters by index
- *  are apt to be extremely inefficient with UTF-8, and
- *  as such are not included.
- *
- *  returns EINVAL if the character is bad,
- *  or ENODATA if the string is empty
- */
-LIB_EXPORT rc_t CC StringHead ( const String *str, uint32_t *ch )
-{
-    rc_t rc;
-    if ( ch == NULL )
-        rc = RC ( rcText, rcString, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( str == NULL )
-            rc = RC ( rcText, rcString, rcAccessing, rcParam, rcNull );
-        else
-        {
-            if ( str -> len == 0 )
-                rc = RC ( rcText, rcString, rcAccessing, rcString, rcEmpty );
-            else
-            {
-                int ch_len = utf8_utf32 ( ch, str -> addr, str -> addr + str -> size );
-                if ( ch_len > 0 )
-                    return 0;
-
-                rc = RC ( rcText, rcString, rcAccessing, rcChar, rcInvalid );
-            }
-        }
-
-        * ch = 0;
-    }
-
-    return rc;
-}
-
-/* StringPopHead
- *  remove and return the first character
- *
- *  returns EINVAL if the character is bad,
- *  or ENODATA if the string is empty
- */
-LIB_EXPORT rc_t CC StringPopHead ( String *str, uint32_t *ch )
-{
-    rc_t rc;
-    if ( ch == NULL )
-        rc = RC ( rcText, rcChar, rcRemoving, rcParam, rcNull );
-    else
-    {
-        if ( str == NULL )
-            rc = RC ( rcText, rcChar, rcRemoving, rcParam, rcNull );
-        else
-        {
-            if ( str -> len == 0 )
-                rc = RC ( rcText, rcChar, rcRemoving, rcString, rcEmpty );
-            else
-            {
-                int ch_len = utf8_utf32 ( ch, str -> addr, str -> addr + str -> size );
-                if ( ch_len > 0 )
-                {
-                    str -> addr += ch_len;
-                    str -> size -= ch_len;
-                    str -> len -= 1;
-                    return 0;
-                }
-
-                rc = RC ( rcText, rcChar, rcRemoving, rcChar, rcInvalid );
-            }
-        }
-
-        * ch = 0;
-    }
-
-    return rc;
-}
-
-/* StringCompare
- *  compare strings for relative ordering
- */
-LIB_EXPORT int CC StringCompare ( const String *a, const String *b )
-{
-    int diff;
-    uint32_t len;
-
-    if ( a == b )
-        return 0;
-    if ( a == NULL )
-        return -1;
-    if ( b == NULL )
-        return 1;
-
-    len = a -> len;
-    if ( b -> len < len )
-        len = b -> len;
-
-    diff = string_cmp ( a -> addr, a -> size, b -> addr, b -> size, len );
-    if ( diff == 0 )
-        diff = ( int ) a -> len - ( int ) b -> len;
-    return diff;
-}
-
-/* StringCaseEqual
- *  compare strings for case-insensitive equality
- */
-LIB_EXPORT bool CC StringCaseEqual ( const String *a, const String *b )
-{
-    uint32_t len;
-
-    if ( a == b )
-        return true;
-    if ( a == NULL || b == NULL )
-        return false;
-
-    len = a -> len;
-    if ( b -> len != len )
-        return false;
-
-    return strcase_cmp ( a -> addr, a -> size, b -> addr, b -> size, len ) == 0;
-}
-
-/* StringCaseCompare
- *  compare strings for relative case-insensitive ordering
- */
-LIB_EXPORT int CC StringCaseCompare ( const String *a, const String *b )
-{
-    int diff;
-    uint32_t len;
-
-    if ( a == b )
-        return 0;
-    if ( a == NULL )
-        return -1;
-    if ( b == NULL )
-        return 1;
-
-    len = a -> len;
-    if ( b -> len < len )
-        len = b -> len;
-
-    diff = strcase_cmp ( a -> addr, a -> size, b -> addr, b -> size, len );
-    if ( diff == 0 )
-        diff = ( int ) a -> len - ( int ) b -> len;
-    return diff;
-}
-
-/* StringOrder
- *  compares strings as quickly as possible for
- *  deterministic ordering: first by length, then
- *  by binary (byte-wise) content.
- *
- *  performs more quickly than StringCompare for cases
- *  where only deterministic ordering is needed ( e.g. symbol table ).
- */
-LIB_EXPORT int CC StringOrder ( const String *a, const String *b )
-{
-    if ( a == b )
-        return 0;
-    if ( a == NULL )
-        return -1;
-    if ( b == NULL )
-        return 1;
-
-    if ( a -> size < b -> size )
-        return -1;
-    if ( a -> size > b -> size )
-        return 1;
-    return memcmp ( a -> addr, b -> addr, a -> size );
-}
-
-/* StringOrderNoNullCheck
- *  avoids tests for NULL strings
- */
-LIB_EXPORT int CC StringOrderNoNullCheck ( const String *a, const String *b )
-{
-    if ( a -> size < b -> size )
-        return -1;
-    if ( a -> size > b -> size )
-        return 1;
-    return memcmp ( a -> addr, b -> addr, a -> size );
-}
-
-/* StringMatch
- *  creates a substring of "a" in "match"
- *  for all of the sequential matching characters between "a" and "b"
- *  starting from character [ 0 ].
- *
- *  returns the number of characters that match.
- */
-LIB_EXPORT uint32_t CC StringMatch ( String *match, const String *a, const String *b )
-{
-    if ( a == NULL || b == NULL )
-    {
-        CONST_STRING ( match, "" );
-        return 0;
-    }
-
-    if ( a == b )
-    {
-        * match = * a;
-        return a -> len;
-    }
-
-    if ( match == NULL )
-    {
-        return string_match ( a -> addr, a -> size,
-            b -> addr, b -> size, (uint32_t)b -> size, NULL );
-    }
-
-    match -> addr = a -> addr;
-    return match -> len = string_match ( a -> addr, a -> size,
-        b -> addr, b -> size, (uint32_t)b -> size, & match -> size );
-}
-
-/* StringMatchExtend
- *  extends a substring of "a" in "match"
- *  for all of the sequential matching characters between "a" and "b"
- *  starting from character [ match -> len ].
- *
- *  returns the number of matching characters that were extended.
- */
-LIB_EXPORT uint32_t CC StringMatchExtend ( String *match, const String *a, const String *b )
-{
-    size_t msize;
-    uint32_t len;
-
-    assert ( match != NULL );
-    if ( match -> len == 0 )
-        return StringMatch ( match, a, b );
-
-    assert ( a != NULL );
-    assert ( match -> addr == a -> addr );
-    assert ( match -> len <= a -> len );
-
-    if ( b == NULL || match -> len == a -> len || match -> len >= b -> len )
-        return 0;
-
-    msize = match -> size;
-    len = string_match ( a -> addr + msize, a -> size - msize,
-        b -> addr + msize, b -> size - msize, (uint32_t)b -> size, & msize );
-
-    match -> len += len;
-    match -> size += msize;
-    return len;
-}
-
-/* StringCopyUTF...
- *  creates a String from UTF16 or UTF32 UNICODE input
- *  wchar_t is one or the other, depending upon OS and compiler.
- */
-LIB_EXPORT rc_t CC StringCopyUTF16 ( const String **cpy, const uint16_t *text, size_t bytes )
-{
-    if ( cpy != NULL )
-    {
-        if ( text != NULL || bytes == 0 )
-        {
-            size_t size;
-            uint32_t len = utf16_cvt_string_len ( text, bytes, & size );
-            String *str = ( String* ) malloc ( sizeof * str + 1 + size );
-            if ( ( * cpy = str ) == NULL )
-                return RC ( rcText, rcString, rcCopying, rcMemory, rcInsufficient );
-            StringInit ( str, ( char* ) ( str + 1 ), size, len );
-            str -> size = utf16_cvt_string_copy ( ( char* ) str -> addr, size, text, bytes );
-            return 0;
-        }
-
-        * cpy = NULL;
-    }
-    return RC ( rcText, rcString, rcCopying, rcParam, rcNull );
-}
-
-LIB_EXPORT rc_t CC StringCopyUTF32 ( const String **cpy, const uint32_t *text, size_t bytes )
-{
-    if ( cpy != NULL )
-    {
-        if ( text != NULL || bytes == 0 )
-        {
-            size_t size;
-            uint32_t len = utf32_cvt_string_len ( text, bytes, & size );
-            String *str = ( String* ) malloc ( sizeof * str + 1 + size );
-            if ( ( * cpy = str ) == NULL )
-                return RC ( rcText, rcString, rcCopying, rcMemory, rcInsufficient );
-            StringInit ( str, ( char* ) ( str + 1 ), size, len );
-            str -> size = utf32_cvt_string_copy ( ( char* ) str -> addr, size, text, bytes );
-            return 0;
-        }
-
-        * cpy = NULL;
-    }
-    return RC ( rcText, rcString, rcCopying, rcParam, rcNull );
-}
-
-/* StringWhack
- *  deallocates a string
- *  ignores strings not allocated by this library
- */
-LIB_EXPORT void CC StringWhack ( const String* self )
-{
-    free ( ( void* ) self );
-}
-
-
-/*--------------------------------------------------------------------------
- * raw text strings
- */
-
-/* string_size
- *  length of string in bytes
- */
-LIB_EXPORT size_t CC string_size ( const char *str )
-{
-    if ( str == NULL )
-        return 0;
-    return strlen ( str );
-}
-
-/* string_dup
- *  replaces the broken C library strndup
- *  creates a NUL-terminated malloc'd string
- */
-LIB_EXPORT char * CC string_dup ( const char *str, size_t size )
-{
-    char *dst;
-    if ( str == NULL )
-        dst = NULL;
-    else
-    {
-        dst = malloc ( size + 1 );
-        if ( dst != NULL )
-            string_copy ( dst, size + 1, str, size );
-    }
-    return dst;
-}
-
-/* string_dup_measure
- *  replaces the broken C library strdup
- *  creates a NUL-terminated malloc'd string
- *  returns size of string unless "size" is NULL
- */
-LIB_EXPORT char * CC string_dup_measure ( const char *str, size_t *size )
-{
-    size_t bytes = string_size ( str );
-    if ( size != NULL )
-        * size = bytes;
-    return string_dup ( str, bytes );
-}
-
-/* string_hash
- *  hashes a string
- */
-LIB_EXPORT uint32_t CC string_hash ( const char *str, size_t size )
-{
-    size_t i;
-    uint32_t hash;
-
-    assert ( str != NULL );
-
-    if ( str == NULL )
-        return 0;
-
-    for ( hash = 0, i = 0; i < size; ++ i )
-    {
-        uint32_t ch = ( ( const unsigned char* )  str ) [ i ];
-        hash = ( ( hash << 1 ) - ( hash >> 16 ) ) ^ ch;
-    }
-    return hash ^ ( hash >> 16 );
-}
-
-/* utf8_utf32
- *  converts UTF8 text to a single UTF32 character
- *  returns the number of UTF8 bytes consumed, such that:
- *    return > 0 means success
- *    return == 0 means insufficient input
- *    return < 0 means bad input or bad argument
- */
-LIB_EXPORT int CC utf8_utf32 ( uint32_t *dst, const char *begin, const char *end )
-{
-    int c;
-    uint32_t ch;
-    const char *src, *stop;
-
-    if ( dst == NULL || begin == NULL || end == NULL )
-        return -1;
-
-    if ( begin == end )
-        return 0;
-
-    /* non-negative bytes are ASCII-7 */
-    c = begin [ 0 ];
-    if ( begin [ 0 ] >= 0 )
-    {
-        dst [ 0 ] = c;
-        return 1;
-    }
-	
-    /* the leftmost 24 bits are set
-       the rightmost 8 can look like:
-       110xxxxx == 2 byte character
-       1110xxxx == 3 byte character
-       11110xxx == 4 byte character
-       111110xx == 5 byte character
-       1111110x == 6 byte character
-    */
-	
-    src = begin;
-	
-    /* invert bits to look at range */
-    ch = c;
-    c = ~ c;
-	
-    /* illegal range */
-    if ( c >= 0x40 )
-        return -1;
-	
-    /* 2 byte */
-    else if ( c >= 0x20 )
-    {
-        ch &= 0x1F;
-        stop = src + 2;
-    }
-	
-    /* 3 byte */
-    else if ( c >= 0x10 )
-    {
-        ch &= 0xF;
-        stop = src + 3;
-    }
-	
-    /* 4 byte */
-    else if ( c >= 8 )
-    {
-        ch &= 7;
-        stop = src + 4;
-    }
-	
-    /* 5 byte */
-    else if ( c >= 4 )
-    {
-        ch &= 3;
-        stop = src + 5;
-    }
-	
-    /* illegal */
-    else if ( c < 2 )
-        return -1;
-    
-    /* 6 byte */
-    else
-    {
-        ch &= 1;
-        stop = src + 6;
-    }
-    
-    /* must have sufficient input */
-    if ( stop > end )
-        return 0;
-	
-    /* complete the character */
-    while ( ++ src != stop )
-    {
-        c = src [ 0 ] & 0x7F;
-        if ( src [ 0 ] >= 0 || c >= 0x40 )
-            return -1;
-        ch = ( ch << 6 ) | c;
-    }
-	
-    /* record the character */
-    dst [ 0 ] = ch;
-	
-    /* return the bytes consumed */
-    return ( int ) ( src - begin );
-}
-
-/* utf32_utf8
- *  converts a single UTF32 character to UTF8 text
- *  returns the number of UTF8 bytes generated, such that:
- *    return > 0 means success
- *    return == 0 means insufficient output
- *    return < 0 means bad character or bad argument
- */
-LIB_EXPORT int CC utf32_utf8 ( char *begin, char *end, uint32_t ch )
-{
-    int len;
-    char *dst;
-    uint32_t mask;
-
-    if ( begin == NULL || end == NULL )
-        return -1;
-    if ( begin >= end )
-        return 0;
-
-    if ( ch < 128 )
-    {
-        begin [ 0 ] = ( char ) ch;
-        return 1;
-    }
-
-    /* 2 byte */
-    if ( ch < 0x00000800 )
-    {
-        /* 110xxxxx */
-        mask = 0xC0U;
-        len = 2;
-    }
-	
-    /* 3 byte */
-    else if ( ch < 0x00010000 )
-    {
-        /* 1110xxxx */
-        mask = 0xE0U;
-        len = 3;
-    }
-
-    /* 4 byte */
-    else if ( ch < 0x00200000 )
-    {
-        /* 11110xxx */
-        mask = 0xF0U;
-        len = 4;
-    }
-	
-    /* 5 byte */
-    else if ( ch < 0x04000000 )
-    {
-        /* 111110xx */
-        mask = 0xF8U;
-        len = 5;
-    }
-	
-    /* 6 byte */
-    else
-    {
-        /* 1111110x */
-        mask = 0xFCU;
-        len = 6;
-    }
-	
-    dst = begin + len;
-    if ( dst > end )
-        return 0;
-    
-    while ( -- dst > begin )
-    {
-        /* 10xxxxxx */ /* too many casts to suit different compilers */
-        dst [ 0 ] = ( char ) (( char ) 0x80 | ( ( char ) ch & ( char ) 0x3F ));
-        ch >>= 6;
-    }
-    
-    dst [ 0 ] = ( char ) ( mask | ch );
-
-    return len;
-}
-
-/* utf16_string_size/len/measure
- *  measures UTF-16 strings
- */
-LIB_EXPORT size_t CC utf16_string_size ( const uint16_t *str )
-{
-    uint32_t i, ch;
-
-    for ( ch = str [ i = 0 ]; ch != 0 ; ch = str [ ++ i ] )
-    {
-        char ignore [ 8 ];
-        if ( utf32_utf8 ( ignore, & ignore [ sizeof ignore ], ch ) <= 0 )
-            break;
-    }
-
-    return i * sizeof * str;
-}
-
-LIB_EXPORT uint32_t CC utf16_string_len ( const uint16_t *str, size_t size )
-{
-    uint32_t i, str_len = ( uint32_t ) ( size >> 1 );
-
-    for ( i = 0; i < str_len; ++ i )
-    {
-        char ignore [ 8 ];
-        uint32_t ch = str [ i ];
-        if ( utf32_utf8 ( ignore, & ignore [ sizeof ignore ], ch ) <= 0 )
-            break;
-    }
-
-    return i;
-}
-
-LIB_EXPORT uint32_t CC utf16_string_measure ( const uint16_t *str, size_t *size )
-{
-    uint32_t i, ch;
-
-    for ( ch = str [ i = 0 ]; ch != 0 ; ch = str [ ++ i ] )
-    {
-        char ignore [ 8 ];
-        if ( utf32_utf8 ( ignore, & ignore [ sizeof ignore ], ch ) <= 0 )
-            break;
-    }
-
-    * size = i * sizeof * str;
-
-    return i;
-}
-
-/* utf32_string_size/len/measure
- */
-LIB_EXPORT size_t CC utf32_string_size ( const uint32_t *str )
-{
-    uint32_t i, ch;
-
-    for ( ch = str [ i = 0 ]; ch != 0 ; ch = str [ ++ i ] )
-    {
-        char ignore [ 8 ];
-        if ( utf32_utf8 ( ignore, & ignore [ sizeof ignore ], ch ) <= 0 )
-            break;
-    }
-
-    return i * sizeof * str;
-}
-
-LIB_EXPORT uint32_t CC utf32_string_len ( const uint32_t *str, size_t size )
-{
-    uint32_t i, str_len = ( uint32_t ) ( size >> 2 );
-
-    for ( i = 0; i < str_len; ++ i )
-    {
-        char ignore [ 8 ];
-        uint32_t ch = str [ i ];
-        if ( utf32_utf8 ( ignore, & ignore [ sizeof ignore ], ch ) <= 0 )
-            break;
-    }
-
-    return i;
-}
-
-LIB_EXPORT uint32_t CC utf32_string_measure ( const uint32_t *str, size_t *size )
-{
-    uint32_t i, ch;
-
-    for ( ch = str [ i = 0 ]; ch != 0 ; ch = str [ ++ i ] )
-    {
-        char ignore [ 8 ];
-        if ( utf32_utf8 ( ignore, & ignore [ sizeof ignore ], ch ) <= 0 )
-            break;
-    }
-
-    * size = i * sizeof * str;
-
-    return i;
-}
-
-/* whcar_string_size/len/measure
- *  measures whcar_t strings
- */
-LIB_EXPORT size_t CC wchar_string_size ( const wchar_t *str )
-{
-    uint32_t i, ch;
-
-    for ( ch = str [ i = 0 ]; ch != 0 ; ch = str [ ++ i ] )
-    {
-        char ignore [ 8 ];
-        if ( utf32_utf8 ( ignore, & ignore [ sizeof ignore ], ch ) <= 0 )
-            break;
-    }
-
-    return i * sizeof * str;
-}
-
-LIB_EXPORT uint32_t CC wchar_string_len ( const wchar_t *str, size_t size )
-{
-    uint32_t i, str_len = ( uint32_t ) ( size / sizeof * str );
-
-    for ( i = 0; i < str_len; ++ i )
-    {
-        char ignore [ 8 ];
-        uint32_t ch = str [ i ];
-        if ( utf32_utf8 ( ignore, & ignore [ sizeof ignore ], ch ) <= 0 )
-            break;
-    }
-
-    return i;
-}
-
-LIB_EXPORT uint32_t CC wchar_string_measure ( const wchar_t *str, size_t *size )
-{
-    uint32_t i, ch;
-
-    for ( ch = str [ i = 0 ]; ch != 0 ; ch = str [ ++ i ] )
-    {
-        char ignore [ 8 ];
-        if ( utf32_utf8 ( ignore, & ignore [ sizeof ignore ], ch ) <= 0 )
-            break;
-    }
-
-    * size = i * sizeof * str;
-
-    return i;
-}
diff --git a/libs/klib/token.c b/libs/klib/token.c
deleted file mode 100644
index 9e4f0f5..0000000
--- a/libs/klib/token.c
+++ /dev/null
@@ -1,1290 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include <klib/token.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-
-/* for parser simplicity before the days of expressions,
-   signed numerals were recognized as single tokens, i.e.
-   (+/-)NUM with no separating white space was a single token */
-#define SUPPORT_SIGNED_NUMERALS 0
-
-/*--------------------------------------------------------------------------
- * KToken
- *  a string with an id and source information
- */
-
-/* hex_to_int
- *  where 'c' is known to be hex
- */
-static
-unsigned int CC hex_to_int ( char c )
-{
-    int i = c - '0';
-    if ( c > '9' )
-    {
-        if ( c < 'a' )
-            i = c - 'A' + 10;
-        else
-            i = c - 'a' + 10;
-    }
-
-    assert ( i >= 0 && i < 16 );
-    return i;
-}
-
-static
-rc_t CC StringConvertHex ( const String *self, uint64_t *ip, int bits )
-{
-    uint32_t i;
-    uint64_t i64 = hex_to_int ( self -> addr [ 2 ] );
-    for ( i = 3; i < self -> len; ++ i )
-    {
-        i64 <<= 4;
-        i64 += hex_to_int ( self -> addr [ i ] );
-    }
-
-    if ( bits < 64 && ( i64 >> bits ) != 0 )
-        return RC ( rcVDB, rcToken, rcConverting, rcRange, rcExcessive );
-
-    * ip = i64;
-    return 0;
-}
-
-static
-rc_t CC StringConvertOctal ( const String *self, uint64_t *ip, int bits )
-{
-    uint32_t i;
-    uint64_t i64 = 0;
-    for ( i = 1; i < self -> len; ++ i )
-    {
-        i64 <<= 3;
-        i64 += self -> addr [ i ] - '0';
-    }
-
-    if ( bits < 64 && ( i64 >> bits ) != 0 )
-        return RC ( rcVDB, rcToken, rcConverting, rcRange, rcExcessive );
-
-    * ip = i64;
-    return 0;
-}
-
-static
-rc_t CC StringConvertDecimal ( const String *self, uint64_t *ip, int bits )
-{
-    uint32_t i;
-    uint64_t i64;
-
-    if ( bits > 32 )
-    {
-        i64 = self -> addr [ 0 ] - '0';
-        for ( i = 1; i < self -> len; ++ i )
-        {
-            i64 *= 10;
-            i64 += self -> addr [ i ] - '0';
-        }
-    }
-    else
-    {
-        uint32_t i32 = self -> addr [ 0 ] - '0';
-        for ( i = 1; i < self -> len; ++ i )
-        {
-            i32 *= 10;
-            i32 += self -> addr [ i ] - '0';
-        }
-        i64 = i32;
-    }
-
-    if ( bits < 64 && ( i64 >> bits ) != 0 )
-        return RC ( rcVDB, rcToken, rcConverting, rcRange, rcExcessive );
-
-    * ip = i64;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KTokenToI32 ( const KToken *self, int32_t *i )
-{
-    rc_t rc;
-    int64_t i64;
-
-    switch ( self -> id )
-    {
-    case eDecimal:
-        rc = StringConvertDecimal ( & self -> str, ( uint64_t* ) & i64, 31 );
-        break;
-    case eHex:
-        rc = StringConvertHex ( & self -> str, ( uint64_t* ) & i64, 31 );
-        break;
-    case eOctal:
-        rc = StringConvertOctal ( & self -> str, ( uint64_t* ) & i64, 31 );
-        break;
-    default:
-        return RC ( rcVDB, rcToken, rcConverting, rcType, rcIncorrect );
-    }
-
-    if ( rc == 0 )
-        * i = ( int32_t ) i64;
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KTokenToU32 ( const KToken *self, uint32_t *i )
-{
-    rc_t rc;
-    uint64_t i64;
-
-    switch ( self -> id )
-    {
-    case eDecimal:
-        rc = StringConvertDecimal ( & self -> str, & i64, 32 );
-        break;
-    case eHex:
-        rc = StringConvertHex ( & self -> str, & i64, 32 );
-        break;
-    case eOctal:
-        rc = StringConvertOctal ( & self -> str, & i64, 32 );
-        break;
-    default:
-        return RC ( rcVDB, rcToken, rcConverting, rcType, rcIncorrect );
-    }
-
-    if ( rc == 0 )
-        * i = ( uint32_t ) i64;
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KTokenToI64 ( const KToken *self, int64_t *i )
-{
-    switch ( self -> id )
-    {
-    case eDecimal:
-        return StringConvertDecimal ( & self -> str, ( uint64_t* ) i, 63 );
-    case eHex:
-        return StringConvertHex ( & self -> str, ( uint64_t* ) i, 63 );
-    case eOctal:
-        return StringConvertOctal ( & self -> str, ( uint64_t* ) i, 63 );
-    }
-
-    return RC ( rcVDB, rcToken, rcConverting, rcType, rcIncorrect );
-}
-
-LIB_EXPORT rc_t CC KTokenToU64 ( const KToken *self, uint64_t *i )
-{
-    switch ( self -> id )
-    {
-    case eDecimal:
-        return StringConvertDecimal ( & self -> str, i, 64 );
-    case eHex:
-        return StringConvertHex ( & self -> str, i, 64 );
-    case eOctal:
-        return StringConvertOctal ( & self -> str, i, 64 );
-    }
-
-    return RC ( rcVDB, rcToken, rcConverting, rcType, rcIncorrect );
-}
-
-LIB_EXPORT rc_t CC KTokenToF64 ( const KToken *self, double *d )
-{
-    char buffer [ 256 ], *end;
-
-    switch ( self -> id )
-    {
-    case eDecimal:
-    case eFloat:
-    case eExpFloat:
-        break;
-    case eOctal:
-        if ( self -> str . len == 1 )
-            break;
-    default:
-        return RC ( rcVDB, rcToken, rcConverting, rcType, rcIncorrect );
-    }
-
-    if ( string_copy ( buffer, sizeof buffer,
-             self -> str . addr, self -> str . size ) == sizeof buffer )
-    {
-        return RC ( rcVDB, rcToken, rcConverting, rcToken, rcExcessive );
-    }
-
-    * d = strtod ( buffer, & end );
-    if ( ( end - buffer ) != self -> str . size )
-        return RC ( rcVDB, rcToken, rcConverting, rcToken, rcInvalid );
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KTokenToVersion ( const KToken *self, uint32_t *vp )
-{
-    rc_t rc;
-    String str;
-    uint64_t i;
-    uint32_t v = 0;
-
-    const char *dot;
-    const char *start = self -> str . addr;
-    const char *end = start + self -> str . size;
-
-    switch ( self -> id )
-    {
-        /* three-part versions */
-    case eMajMinRel:
-        dot = string_rchr ( start, end - start, '.' ) + 1;
-        assert ( dot > start && dot < end );
-        StringInit ( & str, dot, (size_t)( end - dot ), (uint32_t)( end - dot ) );
-        rc = StringConvertDecimal ( & str, & i, 16 );
-        if ( rc != 0 )
-            break;
-
-        v = ( uint32_t ) i;
-        end = dot - 1;
-
-        /* two-part versions */
-    case eFloat:
-        dot = string_rchr ( start, end - start, '.' );
-        if ( dot == start )
-            return RC ( rcVDB, rcToken, rcConverting, rcType, rcIncorrect );
-        if ( ++ dot == end )
-            return RC ( rcVDB, rcToken, rcConverting, rcType, rcIncorrect );
-        StringInit ( & str, dot, (size_t)( end - dot ), (uint32_t)( end - dot ) );
-        rc = StringConvertDecimal ( & str, & i, 8 );
-        if ( rc != 0 )
-            break;
-
-        v |= ( uint32_t ) ( i << 16 );
-        end = dot - 1;
-
-        /* single-part versions */
-    case eOctal:
-    case eDecimal:
-        StringInit ( & str, start, (size_t)( end - start ), (uint32_t)( end - start ) );
-        rc = StringConvertDecimal ( & str, & i, 8 );
-        if ( rc != 0 )
-            break;
-
-        v |= ( uint32_t ) ( i << 24 );
-        break;
-
-    default:
-        return RC ( rcVDB, rcToken, rcConverting, rcType, rcIncorrect );
-    }
-
-    if ( rc == 0 )
-        * vp = v;
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KTokenToString ( const KToken *self, char *buffer, size_t bsize, size_t *size )
-{
-    size_t i, j, sz = self -> str . size;
-
-    switch ( self -> id )
-    {
-    case eEndOfInput:
-        * size = 0;
-        return 0;
-
-    case eString:
-        -- sz;
-    case eUntermString:
-        * size = sz - 1;
-
-        if ( sz >= bsize )
-            return RC ( rcVDB, rcToken, rcConverting, rcBuffer, rcInsufficient );
-
-        string_copy ( buffer, bsize, self -> str . addr + 1, sz - 1 );
-        return 0;
-
-    case eEscapedString:
-        -- sz;
-    case eUntermEscapedString:
-        /* leave initial quote at str[0] in count */
-        break;
-
-    default:
-        * size = sz;
-
-        if ( sz + 1 >= bsize )
-            return RC ( rcVDB, rcToken, rcConverting, rcBuffer, rcInsufficient );
-
-        string_copy ( buffer, bsize, self -> str . addr, sz );
-        return 0;
-    }
-
-    /* walk across string starting at offset 1
-       to skip initial quote that was left in "sz" */
-    for ( i = 1, j = 0, -- bsize; i < sz; ++ i )
-    {
-        if ( j == bsize )
-            return RC ( rcVDB, rcToken, rcConverting, rcBuffer, rcInsufficient );
-
-        if ( ( buffer [ j ] = self -> str . addr [ i ] ) == '\\' )
-        {
-            if ( ++ i == sz )
-                break;
-            switch ( self -> str . addr [ i ] )
-            {
-                /* control characters */
-            case 'n':
-                buffer [ j ] = '\n';
-                break;
-            case 't':
-                buffer [ j ] = '\t';
-                break;
-            case 'r':
-                buffer [ j ] = '\r';
-                break;
-            case '0':
-                buffer [ j ] = '\0';
-                break;
-
-            case 'a':
-                buffer [ j ] = '\a';
-                break;
-            case 'b':
-                buffer [ j ] = '\b';
-                break;
-            case 'v':
-                buffer [ j ] = '\v';
-                break;
-            case 'f':
-                buffer [ j ] = '\f';
-                break;
-
-            case 'x': case 'X':
-                /* expect 2 additional hex characters */
-                if ( ( i + 2 ) < sz &&
-                     isxdigit ( self -> str . addr [ i + 1 ] ) &&
-                     isxdigit ( self -> str . addr [ i + 2 ] ) )
-                {
-                    /* go ahead and convert */
-                    buffer [ j ] = ( char )
-                        ( ( hex_to_int ( self -> str . addr [ i + 1 ] ) << 4 ) |
-                          hex_to_int ( self -> str . addr [ i + 2 ] ) );
-                    i += 2;
-                    break;
-                }
-                /* no break */
-
-                /* just quote self */
-            default:
-                buffer [ j ] = self -> str . addr [ i ];
-            }
-        }
-
-        ++ j;
-    }
-
-    * size = j;
-    return 0;
-}
-
-static
-rc_t CC utf8_utf32_cvt_string_copy ( uint32_t *dst, uint32_t blen, uint32_t *dlen, const char *src, size_t ssize )
-{
-    int rslt, len;
-    const char *end = src + ssize;
-
-    for ( len = 0; src < end; ++ len, src += rslt )
-    {
-        if ( len == blen )
-            return RC ( rcVDB, rcToken, rcConverting, rcBuffer, rcInsufficient );
-
-        rslt = utf8_utf32 ( & dst [ len ], src, end );
-        if ( rslt <= 0 )
-        {
-            if ( rslt == 0 )
-                return RC ( rcVDB, rcToken, rcConverting, rcString, rcInsufficient );
-
-            return RC ( rcVDB, rcToken, rcConverting, rcString, rcCorrupt );
-        }
-    }
-
-    * dlen = len;
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KTokenToWideString ( const KToken *self, uint32_t *buffer, uint32_t blen, uint32_t *len )
-{
-    int rslt;
-    const char *start, *end;
-    size_t i, sz = self -> str . size;
-
-    switch ( self -> id )
-    {
-    case eEndOfInput:
-        * len = 0;
-        return 0;
-
-    case eString:
-        -- sz;
-    case eUntermString:
-        return utf8_utf32_cvt_string_copy ( buffer, blen, len, self -> str . addr + 1, sz - 1 );
-
-    case eEscapedString:
-        -- sz;
-    case eUntermEscapedString:
-        -- sz;
-        break;
-
-    default:
-        return utf8_utf32_cvt_string_copy ( buffer, blen, len, self -> str . addr, sz );
-    }
-
-    /* get start and end pointers for utf8 string */
-    start = self -> str . addr + 1;
-    end = start + sz;
-
-    for ( i = 0; start < end; ++ i, start += rslt )
-    {
-        if ( i == blen )
-            return RC ( rcVDB, rcToken, rcConverting, rcBuffer, rcInsufficient );
-
-        rslt = utf8_utf32 ( & buffer [ i ], start, end );
-        if ( rslt <= 0 )
-        {
-            if ( rslt == 0 )
-                return RC ( rcVDB, rcToken, rcConverting, rcString, rcInsufficient );
-
-            return RC ( rcVDB, rcToken, rcConverting, rcString, rcCorrupt );
-        }
-
-        if ( buffer [ i ] == ( uint32_t ) '\\' )
-        {
-            rslt = utf8_utf32 ( & buffer [ i ], start += rslt, end );
-            if ( rslt <= 0 )
-            {
-                if ( rslt == 0 )
-                    return RC ( rcVDB, rcToken, rcConverting, rcString, rcInsufficient );
-
-                return RC ( rcVDB, rcToken, rcConverting, rcString, rcCorrupt );
-            }
-
-            if ( rslt == 1 ) switch ( ( char ) buffer [ i ] )
-            {
-                /* control characters */
-            case 'r':
-                buffer [ i ] = '\r';
-                break;
-            case 'n':
-                buffer [ i ] = '\n';
-                break;
-            case 't':
-                buffer [ i ] = '\t';
-                break;
-            case '0':
-                buffer [ i ] = '\0';
-                break;
-
-            case 'a':
-                buffer [ i ] = '\a';
-                break;
-            case 'b':
-                buffer [ i ] = '\b';
-                break;
-            case 'v':
-                buffer [ i ] = '\v';
-                break;
-            case 'f':
-                buffer [ i ] = '\f';
-                break;
-
-            case 'x': case 'X':
-                /* expect 2 additional hex characters */
-                if ( ( start + 2 ) < end &&
-                     isxdigit ( start [ 1 ] ) &&
-                     isxdigit ( start [ 2 ] ) )
-                {
-                    /* go ahead and convert */
-                    buffer [ i ] =
-                        ( ( hex_to_int ( start [ 1 ] ) << 4 ) |
-                            hex_to_int ( start [ 2 ] ) );
-                    start += 2;
-                }
-                break;
-
-            case 'u': case 'U':
-                /* expect 4 additional hex characters */
-                if ( ( start + 4 ) < end &&
-                     isxdigit ( start [ 1 ] ) &&
-                     isxdigit ( start [ 2 ] ) &&
-                     isxdigit ( start [ 3 ] ) &&
-                     isxdigit ( start [ 4 ] ) )
-                {
-                    /* go ahead and convert */
-                    buffer [ i ] =
-                        ( ( hex_to_int ( start [ 1 ] ) << 12 ) |
-                          ( hex_to_int ( start [ 2 ] ) << 8 ) |
-                          ( hex_to_int ( start [ 3 ] ) << 4 ) |
-                            hex_to_int ( start [ 4 ] ) );
-                    start += 4;
-                }
-                break;
-            }
-        }
-    }
-
-    * len = (uint32_t)i;
-    return 0;
-}
-
-
-/*--------------------------------------------------------------------------
- * KTokenSource
- */
-
-
-/* Return
- *  returns token to source
- */
-LIB_EXPORT void CC KTokenSourceReturn ( KTokenSource *self, const KToken *t )
-{
-    if ( self != NULL && t != NULL )
-    {
-        if ( t -> str . addr + t -> str . size == self -> str . addr )
-        {
-            self -> str . addr = t -> str . addr;
-            self -> str . size += t -> str . size;
-            self -> str . len += t -> str . len;
-        }
-    }
-}
-
-
-/* Consume
- *  consumes all remaining data
- */
-LIB_EXPORT void CC KTokenSourceConsume ( KTokenSource *self )
-{
-    if ( self != NULL )
-    {
-        self -> str . addr += self -> str . size;
-        self -> str . len = 0;
-        self -> str . size = 0;
-    }
-}
-
-
-/* Extend
- *  try to make more data available
- */
-static
-rc_t CC KTokenSourceExtend ( KTokenSource *src )
-{
-    KTokenText *tt = ( KTokenText* ) src -> txt;
-    if ( tt -> read != NULL )
-    {
-        rc_t rc = ( * tt -> read ) ( tt -> data, tt, src -> str . size );
-        if ( rc != 0 )
-            return rc;
-        src -> str = tt -> str;
-    }
-    return 0;
-}
-
-
-/*--------------------------------------------------------------------------
- * KTokenizer
- *  an encapsulation of the tokenizer code
- */
-
-/* Next
- *  get next token
- */
-#if CHECK_TOKENIZER
-static KToken * CC KTokenizerNextInt
-#else
-LIB_EXPORT KToken * CC KTokenizerNext
-#endif
- ( const KTokenizer *self, KTokenSource *src, KToken *t )
-{
-    int id;
-    const unsigned char *start, *stop;
-    bool return_eoln, allow_slash_slash, allow_hash_cmt, try_extend, path_ident;
-
-#define ispathident(c) ( isalnum (c) || (c) == '.' || (c) == '-' || (c) == '_' )
-
-    if ( t == NULL || src == NULL )
-        return NULL;
-
-    start = ( const unsigned char* ) src -> str . addr;
-    stop = start + src -> str . size;
-
-    /* glue token to text */
-    t -> txt = src -> txt;
-
-    /* no symbol */
-    t -> sym = NULL;
-
-    /* detect returning eoln */
-    return_eoln = ( self == kLineTokenizer );
-
-    /* the POSIX tokenizer doesn't want // comments */
-    allow_slash_slash = ( self != kPOSIXPathTokenizer );
-    allow_hash_cmt = ( self == kPOSIXPathTokenizer );
-    path_ident =  ( self == kPOSIXPathTokenizer );
-
-restart:
-
-    /* skip over blanks */
-    while ( start < stop && isspace ( * start ) )
-    {
-        switch ( * start )
-        {
-        case '\r':
-            t -> str . addr = ( const char* ) start;
-            if ( start + 1 < stop && start [ 1 ] == '\n' )
-                ++ start;
-            if ( ! return_eoln )
-            {
-                ++ src -> lineno;
-                break;
-            }
-            else
-            {
-        case '\n':
-                t -> str . addr = ( const char* ) start;
-                if ( start + 1 < stop && start [ 1 ] == '\r' )
-                    ++ start;
-                if ( ! return_eoln )
-                {
-                    ++ src -> lineno;
-                    break;
-                }
-            }
-
-            t -> str . len = (uint32_t)( start - ( const unsigned char* ) t -> str . addr );
-            t -> str . size = t -> str . len;
-            t -> lineno = src -> lineno ++;
-            t -> id = eEndOfLine;
-
-            src -> str . size -= start - ( const unsigned char* ) src -> str . addr;
-            src -> str . len -= (uint32_t)( start - ( const unsigned char* ) src -> str . addr );
-            src -> str . addr = ( const char* ) start;
-
-            return t;
-        }
-
-        ++ start;
-    }
-
-    /* detect end */
-    if ( start == stop )
-    {
-        src -> str . addr = ( const char* ) start;
-        src -> str . size = 0;
-        src -> str . len = 0;
-
-        KTokenSourceExtend ( src );
-        start = ( const unsigned char* ) src -> str . addr;
-        stop = start + src -> str . size;
-        if ( start != stop )
-            goto restart;
-
-        t -> str = src -> str;
-        t -> lineno = src -> lineno;
-        t -> id = eEndOfInput;
-        return t;
-    }
-
-    /* record start of token */
-    t -> str . addr = ( const char* ) start;
-    t -> lineno = src -> lineno;
-
-    /* many symbols do not need extend */
-    try_extend = false;
-
-    /* tokenize */
-    if ( isdigit ( * start ) )
-    {
-        try_extend = true;
-
-        /* assume numeral */
-        if ( * start != '0' )
-        {
-            id = eDecimal;
-#if SUPPORT_SIGNED_NUMERALS
-tokenize_decimal:
-#endif
-            while ( ++ start < stop )
-            {
-                if ( ! isdigit ( * start ) )
-                {
-                    if ( isalpha ( * start ) || * start == '_' )
-                    {
-                        if ( id != eDecimal )
-                            break;
-                        id = eName;
-                        goto tokenize_name;
-                    }
-                    if ( * start == '.' )
-                        goto tokenize_float;
-                    break;
-                }
-            }
-        }
-        else
-        {
-            if ( ( stop - start ) >= 3 &&
-                 ( start [ 1 ] == 'x' || start [ 1 ] == 'X' ) &&
-                 isxdigit ( start [ 2 ] ) )
-            {
-                id = eHex;
-                for ( start += 3; start < stop; ++ start )
-                {
-                    if ( ! isxdigit ( * start ) )
-                    {
-                        if ( isalpha ( * start ) || * start == '_' )
-                        {
-                            id = eName;
-                            goto tokenize_name;
-                        }
-                        break;
-                    }
-                }
-            }
-            else
-            {
-                id = eOctal;
-                while ( ++ start < stop )
-                {
-                    if ( ! isdigit ( * start ) )
-                    {
-                        if ( isalpha ( * start ) || * start == '_' )
-                        {
-                            id = eName;
-                            goto tokenize_name;
-                        }
-                        if ( * start == '.' )
-                            goto tokenize_float;
-                        break;
-                    }
-
-                    if ( * start > '7' )
-                        id = eDecimal;
-                }
-            }
-        }
-    }
-    else if ( isalpha ( * start ) )
-    {
-tokenize_ident:
-        try_extend = true;
-
-        id = eIdent;
-
-tokenize_name:
-        while ( ++ start < stop )
-        {
-            if ( path_ident && ( *start  == '.' || *start == '-' ) )
-                continue;
-
-            if ( ! isalnum ( * start ) && * start != '_' )
-                break;
-        }
-    }
-    else switch ( * start ++ )
-    {
-    case '_':
-        -- start;
-        goto tokenize_ident;
-    case '\'':
-        try_extend = true;
-        for ( id = eUntermString; start < stop; ++ start )
-        {
-            if ( * start == '\'' )
-            {
-                ++ id;
-                start += 1;
-                break;
-            }
-
-            if ( * start == '\\' )
-            {
-                id = eUntermEscapedString;
-                if ( ++ start == stop )
-                    break;
-            }
-        }
-        break;
-
-    case '"':
-        try_extend = true;
-        for ( id = eUntermString; start < stop; ++ start )
-        {
-            if ( * start == '"' )
-            {
-                ++ id;
-                start += 1;
-                break;
-            }
-
-            if ( * start == '\\' )
-            {
-                id = eUntermEscapedString;
-                if ( ++ start == stop )
-                    break;
-            }
-        }
-        break;
-
-    case '.':
-        if ( path_ident ) /* posix path parsing enabled */
-        {
-            /* find special identifier ".." by finding two periods not followed by 
-             * another identifier character
-             */
-            if ( start [ 0 ] == '.' && ! ispathident ( start [ 1 ]))
-            {
-                id = eDblPeriod;
-                break;
-            }
-            if ( isalnum ( * start ) || * start == '.' || * start == '_' || * start == '-' )
-            {
-                id = eName;
-                goto tokenize_name;
-            }
-        }
-        if ( stop > start && isdigit ( * start ) )
-        {
-tokenize_float:
-            try_extend = true;
-            id = eFloat;
-            while ( ++ start < stop )
-            {
-                if ( ! isdigit ( * start ) )
-                {
-                    if ( id != eFloat )
-                        break;
-                    if ( ( stop - start ) < 2 || ! isdigit ( start [ 1 ] ) )
-                        break;
-                    if ( * start == '.' )
-                        id = eMajMinRel;
-                    else if ( * start == 'e' || * start == 'E' )
-                        id = eExpFloat;
-                    else
-                    {
-                        break;
-                    }
-                    ++ start;
-                }
-            }
-            break;
-        }
-
-        if ( ( stop - start ) < 2 )
-            try_extend = true;
-        else if ( start [ 0 ] == '.' && start [ 1 ] == '.'  )
-        {
-            id = eEllipsis;
-            start += 2;
-            break;
-        }
-
-        id = ePeriod;
-        break;
-
-    case ',':
-        id = eComma;
-        break;
-    case ':':
-        id = eColon;
-        if ( start == stop )
-            try_extend = true;
-        else
-        {
-            switch ( start [ 0 ] )
-            {
-            case ':':
-                id = eDblColon;
-                start += 1;
-                break;
-            case '=':
-                id = eColonAssign;
-                start += 1;
-                break;
-            }
-        }
-        break;
-    case ';':
-        id = eSemiColon;
-        break;
-    case '?':
-        id = eQuestion;
-        break;
-    case '~':
-        id = eTilde;
-        break;
-    case '!':
-        id = eExclam;
-        if ( start == stop )
-            try_extend = true;
-        else if ( start [ 0 ] == '=' )
-        {
-            id = eNotEqual;
-            start += 1;
-        }
-        break;
-    case '@':
-        id = eAtSign;
-        break;
-    case '#':
-        if ( allow_hash_cmt )
-            goto line_cmt;
-        id = eHash;
-        break;
-    case '$':
-        id = eDollar;
-        break;
-    case '%':
-        id = ePercent;
-        break;
-    case '^':
-        id = eCaret;
-        break;
-    case '&':
-        id = eAmpersand;
-        if ( start == stop )
-            try_extend = true;
-        if ( start [ 0 ] == '&' )
-        {
-            id = eLogAnd;
-            start += 1;
-        }
-        break;
-    case '*':
-        id = eAsterisk;
-        break;
-    case '+':
-#if SUPPORT_SIGNED_NUMERALS
-        if ( start == stop )
-            try_extend = true;
-        else
-        {
-            if ( isdigit ( * start ) )
-            {
-                id = eSignedDec;
-                try_extend = true;
-                goto tokenize_decimal;
-            }
-            if ( start [ 0 ] == '=' )
-            {
-                id = ePlusAssign;
-                start += 1;
-                break;
-            }
-        }
-#endif
-        id = ePlus;
-        break;
-    case '-':
-#if SUPPORT_SIGNED_NUMERALS
-        if ( start == stop )
-            try_extend = true;
-        else
-        {
-            if ( isdigit ( * start ) )
-            {
-                id = eSignedDec;
-                try_extend = true;
-                goto tokenize_decimal;
-            }
-            if ( * start == '>' )
-            {
-                id = eOverArrow;
-                start += 1;
-                break;
-            }
-        }
-#endif
-        id = eMinus;
-        break;
-    case '=':
-        id = eAssign;
-        if ( start == stop )
-            try_extend = true;
-        else if ( start [ 0 ] == '=' )
-        {
-            id = eEqual;
-            start += 1;
-        }
-        break;
-    case '/':
-        id = eFwdSlash;
-        if ( start == stop )
-            try_extend = true;
-        else switch ( start [ 0 ] )
-        {
-        case '/':
-            if ( ! allow_slash_slash )
-                break;
-            ++ start;
-line_cmt:
-            try_extend = true;
-            for ( ; start < stop; ++ start )
-            {
-                switch ( start [ 0 ] )
-                {
-                case '\r':
-                case '\n':
-                    goto comment_restart;
-                }
-            }
-comment_restart:
-            src -> str . len -= string_len ( src -> str . addr, ( const char* ) start - src -> str . addr );
-            src -> str . size -= ( const char* ) start - src -> str . addr;
-            src -> str . addr = ( const char* ) start;
-            goto restart;
-
-        case '*':
-            try_extend = true;
-            id = eUntermComment;
-            if ( ++ start < stop ) switch ( start [ 0 ] )
-            {
-            case '\r':
-                if ( start + 1 < stop && start [ 1 ] == '\n' )
-                    ++ start;
-                ++ src -> lineno;
-                break;
-            case '\n':
-                if ( start + 1 < stop && start [ 1 ] == '\r' )
-                    ++ start;
-                ++ src -> lineno;
-                break;
-            }
-            for ( ++ start; start < stop; ++ start )
-            {
-                switch ( start [ 0 ] )
-                {
-                case '/':
-                    if ( start [ -1 ] == '*' )
-                    {
-                        ++ start;
-                        goto comment_restart;
-                    }
-                    break;
-                case '\r':
-                    if ( start + 1 < stop && start [ 1 ] == '\n' )
-                        ++ start;
-                    ++ src -> lineno;
-                    break;
-                case '\n':
-                    if ( start + 1 < stop && start [ 1 ] == '\r' )
-                        ++ start;
-                    ++ src -> lineno;
-                    break;
-                }
-            }
-            break;
-        }
-        break;
-    case '\\':
-        id = eBackSlash;
-        break;
-    case '|':
-        id = ePipe;
-        if ( start == stop )
-            try_extend = true;
-        else if ( start [ 0 ] == '|' )
-        {
-            id = eLogOr;
-            start += 1;
-        }
-        break;
-    case '(':
-        id = eLeftParen;
-        break;
-    case ')':
-        id = eRightParen;
-        break;
-    case '{':
-        id = eLeftCurly;
-        break;
-    case '}':
-        id = eRightCurly;
-        break;
-    case '<':
-        id = eLeftAngle;
-        if ( start == stop )
-            try_extend = true;
-        else if ( start [ 0 ] == '<' )
-        {
-            id = eDblLeftAngle;
-            start += 1;
-        }
-        break;
-    case '>':
-        id = eRightAngle;
-        if ( start == stop )
-            try_extend = true;
-        else if ( start [ 0 ] == '>' )
-        {
-            id = eDblRightAngle;
-            start += 1;
-        }
-        break;
-    case '[':
-        id = eLeftSquare;
-        if ( start == stop )
-            try_extend = true;
-        else if ( start [ 0 ] == '[' )
-        {
-            id = eDblLeftSquare;
-            start += 1;
-        }
-        break;
-    case ']':
-        id = eRightSquare;
-        if ( start == stop )
-            try_extend = true;
-        else if ( start [ 0 ] == ']' )
-        {
-            id = eDblRightSquare;
-            start += 1;
-        }
-        break;
-    default:
-        /* skip over single UTF-8 character */
-        if ( ( ( const char* ) start ) [ -1 ] < 0 )
-        {
-            while ( start < stop )
-            {
-                if ( ( * start & 0xC0 ) != 0x80 )
-                    break;
-                ++ start;
-            }
-        }
-
-        t -> str . len = 1;
-        t -> str . size = start - ( const unsigned char* ) t -> str . addr;
-
-        src -> str . addr = ( const char* ) start;
-        src -> str . len -= 1;
-        src -> str . size -= t -> str . size;
-
-        t -> id = eUnrecognized;
-        return t;
-    }
-
-    t -> str . len = (uint32_t)( start - ( const unsigned char* ) t -> str . addr );
-    t -> str . size = t -> str . len;
-    t -> id = id;
-
-    if ( ! try_extend || start < stop )
-    {
-        src -> str . size -= start - ( const unsigned char* ) src -> str . addr;
-        src -> str . len -= (uint32_t)( start - ( const unsigned char* ) src -> str . addr );
-        src -> str . addr = ( const char* ) start;
-    }
-    else
-    {
-        /* state that the amount left in source
-           is exactly what was tokenized */
-        src -> str = t -> str;
-
-        /* try to extend, which is successful
-           only if src ends up with more data */
-        KTokenSourceExtend ( src );
-        if ( src -> str . size > t -> str . size )
-        {
-            start = ( const unsigned char* ) src -> str . addr;
-            stop = start + src -> str . size;
-            goto restart;
-        }
-
-        /* out of data on source */
-        src -> str . addr = ( const char* ) stop;
-        src -> str . size = 0;
-        src -> str . len = 0;
-    }
-
-    return t;
-}
-
-#if CHECK_TOKENIZER
-#include <stdio.h>
-static
-void CC examine_src ( const KTokenSource *src, bool before )
-{
-    const KTokenText *tt = src -> txt;
-    const char *stage = before ? "before" : "after";
-
-    /* first test - are src addr and size correct */
-    if ( src -> str . addr + src -> str . size !=
-         tt -> str . addr + tt -> str . size )
-    {
-        /* in the case of console input before tokenization, this is allowed */
-        if ( before && src -> str . size == 0 && tt -> read != NULL )
-            return;
-
-        /* check for src addr being within text */
-        if ( src -> str . addr < tt -> str . addr ||
-             src -> str . addr >= tt -> str . addr + tt -> str . size )
-        {
-            fprintf ( stderr, "KTokenizerNext: bad src address %s scan\n", stage );
-        }
-        else
-        {
-            fprintf ( stderr, "KTokenizerNext: bad src size ( %lu ) %s scan "
-                      "at file \"%.*s\" offset %lu\n"
-                      , ( long unsigned ) src -> str . size
-                      , stage
-                      , ( int ) tt -> path . size, tt -> path . addr
-                      , ( long unsigned ) ( src -> str . addr - tt -> str . addr ) );
-        }
-    }
-
-    /* test number of characters */
-    else
-    {
-        uint32_t len = string_len ( src -> str . addr, src -> str . size );
-        if ( len != src -> str . len )
-        {
-            fprintf ( stderr, "KTokenizerNext: bad src character count "
-                      "( %u measured, %u stated ) %s scan\n", len, src -> str . len, stage );
-        }
-    }
-}
-
-LIB_EXPORT KToken * CC KTokenizerNext ( const KTokenizer *self, KTokenSource *src, KToken *t )
-{
-    KToken *rt;
-    examine_src ( src, true );
-    rt = KTokenizerNextInt ( self, src, t );
-    examine_src ( src, false );
-    return rt;
-}
-#endif
diff --git a/libs/klib/trie-priv.h b/libs/klib/trie-priv.h
deleted file mode 100644
index 3796ef7..0000000
--- a/libs/klib/trie-priv.h
+++ /dev/null
@@ -1,237 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_trie_priv_
-#define _h_trie_priv_
-
-#ifndef _h_klib_trie_
-#include <klib/trie.h>
-#endif
-
-
-/*--------------------------------------------------------------------------
- * TTrans
- *  a text transition node
- */
-typedef struct TTrans TTrans;
-struct TTrans
-{
-    /* child nodes */
-    TTrans **child;
-
-    /* values associated with the node */
-    BSTree vals;
-
-    /* the depth occupied within tree */
-    uint32_t depth;
-
-    /* number of transitions in array */
-    uint16_t tcnt;
-
-    /* number of values in b-tree */
-    uint16_t vcnt;
-};
-
-/* TTransBacktrace
- *  describes a TTrans
- *  with backtrace pointer to parent and transition index from parent
- */
-typedef struct TTransBacktrace TTransBacktrace;
-struct TTransBacktrace
-{
-    const TTransBacktrace *par;
-    const TTrans *trans;
-    uint32_t idx;
-};
-
-/* TTransForEach
- * TTransForEachBT
- */
-void TTransForEach ( const TTrans *trans, uint32_t width,
-    void ( CC * f ) ( const TTransBacktrace *bt, uint32_t width, void *data ), void *data );
-void TTransForEachBT ( const TTransBacktrace *bt, uint32_t width,
-    void ( CC * f ) ( const TTransBacktrace *bt, uint32_t width, void *data ), void *data );
-
-/* TTransDoUntil
- * TTransDoUntilBT
- */
-bool TTransDoUntil ( const TTrans *trans, uint32_t width,
-    bool ( CC * f ) ( const TTransBacktrace *bt, uint32_t width, void *data ), void *data );
-bool TTransDoUntilBT ( const TTransBacktrace *bt, uint32_t width,
-    bool ( CC * f ) ( const TTransBacktrace *bt, uint32_t width, void *data ), void *data );
-
-/* TTransValidate
- *  recursively checks structure
- */
-int TTransValidate ( const TTrans *trans, const Trie *tt );
-
-
-/*--------------------------------------------------------------------------
- * TTSearchNode
- *  this is a complicated guy.
- *
- *  if the only values allowed in a TTrans were terminal values,
- *  then the natural structure would imply a TTrans node for every
- *  path and a child array to hold children. the tree would be
- *  simple to navigate; searching would return TTrans nodes.
- *
- *  however, the structure abandons child arrays when the count
- *  is low enough, and allows non-terminal values in the value
- *  tree. a string may still terminate on a TTrans, but necessarily
- *  there will be strings that terminate in space.
- *
- *  to handle this, as well as to address non-intrusive list
- *  functionality, this search node is able to do too many things.
- *
- *  1) it allows a poor version of a child array to be added
- *     to an existing TTrans.
- *
- *  2) it defines a fake TTrans object with its own depth
- *     and value list.
- *
- *  3) the fake TTrans can itself be exploded to contain
- *     further fake TTrans objects
- *
- *  4) it functions as a non-intrusive reference to a TTNode
- *     for inclusion into temporary child lists.
- */
-enum
-{
-    snTrans,
-    snKeynode,
-    snTransEx,
-    snFakeTrans,
-    snFakeTransEx
-};
-
-typedef struct TTSearchNode TTSearchNode;
-struct TTSearchNode
-{
-    union
-    {
-        /* snTrans, snTransEx */
-        struct
-        {
-            const TTrans *ref;
-            DLList vals;
-            DLList child;
-
-        } trans;
-
-        /* snKeynode */
-        struct
-        {
-            DLNode n;
-            const TNode *ref;
-
-        } keynode;
-
-        /* snFakeTrans, snFakeTransEx */
-        struct
-        {
-            DLNode n;
-            DLList vals;
-            DLList child;
-            uint32_t depth;
-            uint32_t idx;
-
-        } fake;
-
-    } u;
-
-    uint32_t refcount;
-    uint32_t variant;
-};
-
-/* TTSearchNodeMakeTrans
- *  creates a reference node
- */
-rc_t TTSearchNodeMakeTrans ( TTSearchNode **s, const TTrans *trans );
-
-/* TTSearchNodeExplodeTrans
- *  explodes a simple TTrans to split values into term and non-term
- *  may create fake trans objects within "child"
- */
-rc_t TTSearchNodeExplodeTrans ( TTSearchNode *s, const Trie *tt );
-
-/* TTSearchNodeExplodeFakeTrans
- *  explodes a fake trans to split values into term and non-term
- *  may create fake trans objects within "child"
- */
-rc_t TTSearchNodeExplodeFakeTrans ( TTSearchNode *s, const Trie *tt );
-
-/* TTSearchNodeRelease
- *  releases a reference, and potentially the object
- */
-void TTSearchNodeRelease ( TTSearchNode *s );
-
-/* TTSearchNodeReuseTrans
- *  if a node has no other references,
- *  destructs and re-initializes the node for reuse.
- *
- *  otherwise, a new node is created.
- */
-rc_t TTSearchNodeReuseTrans ( TTSearchNode **s, const TTrans *trans );
-
-
-/*--------------------------------------------------------------------------
- * TTSearchNodeRef
- */
-typedef struct TTSearchNodeRef TTSearchNodeRef;
-struct TTSearchNodeRef
-{
-    DLNode n;
-    TTSearchNode *s;
-};
-
-/* TTSearchNodeRefMake
- */
-rc_t TTSearchNodeRefMake ( TTSearchNodeRef **ref, TTSearchNode *s );
-
-/* TTSearchNodeRefWhack
- * TTSearchNodeRefWhackAll
- */
-void TTSearchNodeRefWhack ( TTSearchNodeRef *p );
-void TTSearchNodeRefWhackAll ( DLNode *n, void *ignore );
-
-
-/*--------------------------------------------------------------------------
- * Trie
- */
-
-/* TrieMapChar
- *  maps a character to an index
- */
-uint32_t TrieMapChar ( const Trie *tt, uint32_t ch );
-
-/* TrieNextIdx
- *  pops a character from key string
- *  maps it to an index
- */
-rc_t TrieNextIdx ( const Trie *tt, String *key, uint32_t *idx );
-
-
-#endif /* _h_trie_priv_ */
diff --git a/libs/klib/trie.c b/libs/klib/trie.c
deleted file mode 100644
index b98386b..0000000
--- a/libs/klib/trie.c
+++ /dev/null
@@ -1,1486 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include "trie-priv.h"
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <wctype.h>
-#include <errno.h>
-#include <assert.h>
-
-
-
-/*--------------------------------------------------------------------------
- * TNode
- *  a node within text tree
- */
-
-/* TNodeMake
- *  creates a TNode of variable size
- *
- *  "n" will contain the returned node
- *
- *  "size" must be at least the size of a TNode
- */
-LIB_EXPORT rc_t CC TNodeMake ( TNode **np, size_t size )
-{
-    TNode *n;
-
-    if ( np == NULL )
-        return RC ( rcCont, rcNode, rcAllocating, rcParam, rcNull );
-
-    if ( size < sizeof * n )
-        return RC ( rcCont, rcNode, rcAllocating, rcParam, rcInvalid );
-
-    n = malloc ( size );
-    if ( n == NULL )
-        return RC ( rcCont, rcNode, rcAllocating, rcMemory, rcExhausted );
-
-    * np = n;
-    return 0;
-}
-
-/* TNodeWhack
- *  performs final whacking of node
- */
-LIB_EXPORT void CC TNodeWhack ( TNode *n )
-{
-    free ( n );
-}
-
-/* TNodeCmp
- */
-static
-int CC TNodeCmp ( const void *item, const void *n )
-{
-#define a ( ( const String* ) item )
-#define b ( ( const TNode* ) n )
-
-    return StringCompare ( a, & b -> key );
-
-#undef a
-#undef b
-}
-
-/* TNodeSort
- */
-static
-int CC TNodeSort ( const BSTNode *item, const BSTNode *n )
-{
-#define a ( ( const TNode* ) item )
-#define b ( ( const TNode* ) n )
-
-    return StringCompare ( & a -> key, & b -> key );
-
-#undef a
-#undef b
-}
-
-/*--------------------------------------------------------------------------
- * TTrans
- *  a text transition node
- *
- *  transitions to child nodes occur only if "tcnt" != 0 ( "child" != NULL )
- *  and are taken on the query string's character [ key . len ]
- */
-
-/* TTransMake
- */
-static
-rc_t CC TTransMake ( TTrans **tp, uint32_t depth )
-{
-    TTrans *trans = malloc ( sizeof * trans );
-    if ( trans == NULL )
-        return RC ( rcCont, rcNode, rcAllocating, rcMemory, rcExhausted );
-
-    trans -> child = NULL;
-    trans -> tcnt = trans -> vcnt = 0;
-    BSTreeInit ( & trans -> vals );
-    trans -> depth = depth;
-
-    * tp = trans;
-    return 0;
-}
-
-/* TTransForEach
- */
-void TTransForEach ( const TTrans *trans, uint32_t width,
-    void ( CC * f ) ( const TTransBacktrace *bt, uint32_t width, void *data ), void *data )
-{
-    TTransBacktrace bt;
-    bt . par = NULL;
-    bt . trans = trans;
-    bt . idx = 0;
-
-    TTransForEachBT ( & bt, width, f, data );
-}
-
-void TTransForEachBT ( const TTransBacktrace *bt, uint32_t width,
-    void ( CC * f ) ( const TTransBacktrace *bt, uint32_t width, void *data ), void *data )
-{
-    const TTrans *trans = bt -> trans;
-
-    if ( f != NULL )
-        ( * f ) ( bt, width, data );
-
-    assert ( trans != NULL );
-    if ( trans -> child != NULL )
-    {
-        uint32_t i;
-        TTransBacktrace child;
-        for ( child . par = bt, i = 0; i < width; ++ i )
-        {
-            if ( ( child . trans = trans -> child [ i ] ) != NULL )
-            {
-                child . idx = ( uint32_t ) i;
-                TTransForEachBT ( & child, width, f, data );
-            }
-        }
-    }
-}
-
-/* TTransDoUntil
- */
-bool TTransDoUntil ( const TTrans *trans, uint32_t width,
-    bool ( CC * f ) ( const TTransBacktrace *bt, uint32_t width, void *data ), void *data )
-{
-    TTransBacktrace bt;
-    bt . par = NULL;
-    bt . trans = trans;
-    bt . idx = 0;
-
-    return TTransDoUntilBT ( & bt, width, f, data );
-}
-
-bool TTransDoUntilBT ( const TTransBacktrace *bt, uint32_t width,
-    bool ( CC * f ) ( const TTransBacktrace *bt, uint32_t width, void *data ), void *data )
-{
-    const TTrans *trans = bt -> trans;
-
-    if ( f != NULL )
-    {
-        if ( ( * f ) ( bt, width, data ) )
-            return true;
-    }
-
-    assert ( trans != NULL );
-    if ( trans -> child != NULL )
-    {
-        uint32_t i;
-        TTransBacktrace child;
-        for ( child . par = bt, i = 0; i < width; ++ i )
-        {
-            if ( ( child . trans = trans -> child [ i ] ) != NULL )
-            {
-                child . idx = ( uint32_t ) i;
-                if ( TTransDoUntilBT ( & child, width, f, data ) )
-                    return true;
-            }
-        }
-    }
-
-    return false;
-}
-
-/* TTransWhack
- */
-static
-void TTransWhack ( TTrans *trans, uint32_t width,
-    void ( CC * whack ) ( TNode *n, void *data ), void *data )
-{
-    if ( trans != NULL )
-    {
-        if ( trans -> child != NULL )
-        {
-            uint32_t i;
-            for ( i = 0; i < width; ++ i )
-            {
-                TTrans *child = trans -> child [ i ];
-                if ( child != NULL )
-                    TTransWhack ( child, width, whack, data );
-            }
-
-            free ( trans -> child );
-        }
-
-        BSTreeWhack ( & trans -> vals,
-            ( void ( CC * ) ( BSTNode*, void* ) ) whack, data );
-
-        free ( trans );
-    }
-}
-
-
-/*--------------------------------------------------------------------------
- * Trie
- *  a tree of text nodes
- */
-
-/* TrieInit
- *  initialize a text-tree structure
- *
- *  "accept" is a character-set string where each character
- *  represents itself. the only exception is the '-' character,
- *  which - when sandwiched between two other characters - is
- *  interpreted en tot as a range expression. an example would be
- *  "-0-9" is identical to "-0123456789"
- *
- *  "limit" sets the number of values to be accumulated in any
- *  container. if this limit would be exceeded by any insertion,
- *  the node is expanded and its values are re-distributed among
- *  its children.
- *
- *  if "cs_expand" is 1, then any valid characters observed
- *  during insertions are automatically added to the accept
- *  character set. doing so will ensure that there are no
- *  ambiguous transitions.
- *
- *  returns status codes:
- *    0      => success
- *    EINVAL => an invalid parameter
- *    ENOMEM => failed to allocate internal structures
- *    EDOM   => either the limit was too high or the accept string too wide
- */
-LIB_EXPORT rc_t CC TrieInit ( Trie *tt, const char *accept,
-    uint32_t limit, bool cs_expand )
-{
-    int ch_len;
-    const char *src, *end;
-
-    uint32_t ch, ch2;
-    uint32_t first, last, width;
-
-    uint16_t *map;
-    uint32_t *rmap;
-
-    if ( tt == NULL )
-        return RC ( rcCont, rcTrie, rcConstructing, rcSelf, rcNull );
-
-    if ( accept == NULL )
-        return RC ( rcCont, rcTrie, rcConstructing, rcString, rcNull );
-
-    if ( accept [ 0 ] == 0 )
-        return RC ( rcCont, rcTrie, rcConstructing, rcString, rcEmpty );
-
-    if ( ( limit >> 16 ) != 0 )
-        return RC ( rcCont, rcTrie, rcConstructing, rcParam, rcExcessive );
-
-    memset ( tt, 0, sizeof * tt );
-    tt -> limit = ( uint16_t ) limit;
-    tt -> cs_expand = cs_expand;
-
-    /* determine width of accept string
-       N.B. we don't detect overlaps at this point */
-    src = accept;
-    end = src + strlen ( accept );
-
-    for ( last = 0, first = ~ 0; src < end; )
-    {
-        /* get a character */
-        ch_len = utf8_utf32 ( & ch, src, end );
-        if ( ch_len <= 0 )
-            return RC ( rcCont, rcTrie, rcConstructing, rcChar, rcInvalid );
-        src += ch_len;
-
-        /* this character represents itself */
-        if ( ch < first )
-            first = ch;
-        if ( ch > last )
-            last = ch;
-
-        /* check for a range expression */
-        if ( src < end && src [ 0 ] == '-' )
-        {
-            ch_len = utf8_utf32 ( & ch2, ++ src, end );
-            if ( ch_len <= 0 )
-                return RC ( rcCont, rcTrie, rcConstructing, rcChar, rcInvalid );
-            src += ch_len;
-
-            /* this character represents
-               hopefully a reasonable range */
-            if ( ch2 < ch )
-                return RC ( rcCont, rcTrie, rcConstructing, rcChar, rcInvalid );
-            if ( ch2 > last )
-                last = ch2;
-        }
-    }
-
-    /* must have had something */
-    if ( last < first )
-        return RC ( rcCont, rcTrie, rcConstructing, rcString, rcInvalid );
-
-    tt -> first_char = first;
-    tt -> last_char = last;
-
-    /* create a character map of pure unknown index */
-    map = calloc ( last - first + 1, sizeof map [ 0 ] );
-    if ( map == NULL )
-        return RC ( rcCont, rcTrie, rcConstructing, rcMemory, rcExhausted );
-    tt -> map = map;
-
-    /* mark the character map */
-    for ( src = accept; src < end; )
-    {
-        /* get a character */
-        ch_len = utf8_utf32 ( & ch, src, end );
-        src += ch_len;
-
-        /* mark character */
-#if REJECT_ACCEPT_OVERLAP
-        if ( map [ ch - first ] != 0 )
-        {
-            free ( map );
-            return RC ( rcCont, rcTrie, rcConstructing, rcChar, rcInvalid );
-        }
-#endif
-        map [ ch - first ] = 1;
-
-        /* check for a range expression */
-        if ( src < end && src [ 0 ] == '-' )
-        {
-            ch_len = utf8_utf32 ( & ch2, ++ src, end );
-            src += ch_len;
-
-            /* mark range */
-            for ( ++ ch; ch <= ch2; ++ ch )
-            {
-#if REJECT_ACCEPT_OVERLAP
-                if ( map [ ch - first ] != 0 )
-                {
-                    free ( map );
-                    return RC ( rcCont, rcTrie, rcConstructing, rcChar, rcInvalid );
-                }
-#endif
-                map [ ch - first ] = 1;
-            }
-        }
-    }
-
-    /* fill in the character map and determine width */
-    for ( width = 0, ch = first; ch <= last; ++ ch )
-    {
-        if ( map [ ch - first ] != 0 )
-            map [ ch - first ] = ++ width;
-    }
-
-    /* enforce maximum width */
-    assert ( width > 0 );
-    if ( ( ++ width >> 16 ) != 0 )
-    {
-        free ( map );
-        return RC ( rcCont, rcTrie, rcConstructing, rcRange, rcExcessive );
-    }
-
-    /* record trans width accounting for unmapped slot */
-    tt -> width = ( uint16_t ) width;
-
-    /* now create a reverse map to produce characters
-       from an index */
-#if _DEBUGGING
-    rmap = calloc ( width, sizeof rmap [ 0 ] );
-#else
-    rmap = malloc ( width * sizeof rmap [ 0 ] );
-#endif
-    if ( rmap == NULL )
-    {
-        free ( map );
-        return RC ( rcCont, rcTrie, rcConstructing, rcMemory, rcExhausted );
-    }
-    tt -> rmap = rmap;
-
-    for ( rmap [ 0 ] = 0, ch = first; ch <= last; ++ ch )
-    {
-        uint32_t idx = map [ ch - first ];
-        if ( idx != 0 )
-            rmap [ idx ] = ch;
-    }
-
-    return 0;
-}
-
-/* TrieMapChar
- *  maps a character to an index
- */
-uint32_t TrieMapChar ( const Trie *tt, uint32_t ch )
-{
-    if ( ch >= tt -> first_char && ch <= tt -> last_char )
-        return tt -> map [ ch - tt -> first_char ];
-    return 0;
-}
-
-/* TrieNextIdx
- *  pops a character from key string
- *  maps it to an index
- */
-rc_t TrieNextIdx ( const Trie *tt, String *key, uint32_t *idx )
-{
-    uint32_t ch;
-    rc_t rc = StringPopHead ( key, & ch );
-    if ( rc == 0 )
-        * idx = TrieMapChar ( tt, ch );
-    return rc;
-}
-
-/* TrieAutoExpand
- *  incorporates a new character into the accept charset
- *
- *    1. extends all existing "child" arrays
- *    2. reallocs "map" if necessary, invalidating new space
- *    3. reallocs "rmap"
- *    4. installs character <-> index into map
- *    5. increments width
- *
- *  the order of execution is designed to be benign if
- *  failures occur, due only to memory exhaustion.
- */
-typedef struct AutoExpandData AutoExpandData;
-struct AutoExpandData
-{
-    rc_t rc;
-};
-
-static
-bool CC TTransAutoExpand ( const TTransBacktrace *bt, uint32_t width, void *data )
-{
-    TTrans **child, *trans = ( TTrans* ) bt -> trans;
-
-    assert ( trans != NULL );
-    if ( trans -> child == NULL )
-        return false;
-
-    child = realloc ( trans -> child, ( width + 1 ) * sizeof * child );
-    if ( child == NULL )
-    {
-        ( ( AutoExpandData* ) data ) -> rc =
-            RC ( rcCont, rcTrie, rcInserting, rcMemory, rcExhausted );
-        return true;
-    }
-
-    child [ width ] = NULL;
-    trans -> child = child;
-    return false;
-}
-
-static
-rc_t CC TrieAutoExpand ( Trie *tt, uint32_t ch )
-{
-    AutoExpandData pb;
-    pb . rc = 0;
-
-    /* extend node child arrays */
-    TTransDoUntil ( tt -> root, tt -> width, TTransAutoExpand, & pb );
-    if ( pb . rc == 0 )
-    {
-        uint16_t *map = ( uint16_t* ) tt -> map;
-        uint32_t *rmap = ( uint32_t* ) tt -> rmap;
-
-        /* realloc charset to index map if necessary */
-        if ( ch < tt -> first_char )
-        {
-            map = malloc ( ( tt -> last_char - ch + 1 ) * sizeof * map );
-            if ( map == NULL )
-                return RC ( rcCont, rcTrie, rcInserting, rcMemory, rcExhausted );
-            memset ( map, 0, ( tt -> first_char - ch ) * sizeof * map );
-            memcpy ( & map [ tt -> first_char - ch ], tt -> map,
-                ( tt -> last_char - tt -> first_char + 1 ) * sizeof * map );
-            free ( ( void* ) tt -> map );
-            tt -> first_char = ch;
-        }
-        else if ( ch > tt -> last_char )
-        {
-            map = realloc ( map, ( ch - tt -> first_char + 1 ) * sizeof * map );
-            if ( map == NULL )
-                return RC ( rcCont, rcTrie, rcInserting, rcMemory, rcExhausted );
-            memset ( & map [ tt -> last_char - tt -> first_char + 1 ], 0, ( ch - tt -> last_char ) * sizeof * map );
-            tt -> last_char = ch;
-        }
-
-        /* record any change */
-        tt -> map = map;
-
-        /* extend index to charset map */
-        rmap = realloc ( rmap, ( tt -> width + 1 ) * sizeof * rmap );
-        if ( rmap == NULL )
-            return RC ( rcCont, rcTrie, rcInserting, rcMemory, rcExhausted );
-
-        tt -> rmap = rmap;
-
-        /* it is done */
-        rmap [ tt -> width ] = ch;
-        map [ ch - tt -> first_char ] = tt -> width ++;
-    }
-
-    return pb . rc;
-}
-
-/* TrieValidateRemainder
- *  ensures that all characters remaining in key
- *  are valid and, in the case of expanding the char set,
- *  are in the character set.
- */
-static
-rc_t CC TrieValidateRemainder ( Trie *tt, const String *key )
-{
-    rc_t rc;
-    String rem = * key;
-
-    while ( 1 )
-    {
-        uint32_t ch;
-        rc = StringPopHead ( & rem, & ch );
-        if ( GetRCState ( rc ) == rcEmpty )
-            return 0;
-
-        if ( tt -> cs_expand )
-        {
-            uint32_t idx = TrieMapChar ( tt, ch );
-            if ( idx == 0 )
-            {
-                /* get the new width */
-                uint16_t width = tt -> width + 1;
-                
-                /* get a new value for idx */
-                idx = tt -> width;
-                
-                /* make sure the expansion would not exceed
-                   the 16 bit limit on array width */
-                if ( width == 0 )
-                {
-                    rc = RC ( rcCont, rcTrie, rcInserting, rcRange, rcExcessive );
-                    break;
-                }
-                
-                /* incorporate the character */
-                rc = TrieAutoExpand ( tt, ch );
-                if ( rc != 0 )
-                    break;
-            }
-        }
-    }
-
-    return rc;
-}
-
-/* TrieExplodeTrans
- *  a TTrans has exceeded its limit of TNode values
- */
-typedef struct ExplodeTransData ExplodeTransData;
-struct ExplodeTransData
-{
-    const Trie *tt;
-    TTrans *trans;
-    size_t tsize;
-    uint32_t tcnt;
-    uint32_t cnt;
-    rc_t rc;
-    bool over;
-};
-
-static
-bool CC CreateKids ( BSTNode *n, void *data )
-{
-    ExplodeTransData *pb = data;
-    TNode *item = ( TNode* ) n;
-    const TTrans *trans = pb -> trans;
-
-    if ( item -> key . len > trans -> depth )
-    {
-        uint32_t idx;
-        String key = item -> key;
-        const Trie *tt = pb -> tt;
-
-        /* perform a sub-string based upon
-           knowledge that the entry key matches
-           the first "trans->depth" characters */
-        key . addr += pb -> tsize;
-        key . len -= trans -> depth;
-        key . size -= pb -> tsize;
-
-        /* get the next transition index */
-        pb -> rc = TrieNextIdx ( tt, & key, & idx );
-        if ( pb -> rc != 0 )
-            return true;
-
-        /* test the transition */
-        assert ( trans -> child != NULL );
-        if ( trans -> child [ idx ] == NULL )
-        {
-            /* create the transition */
-            pb -> rc = TTransMake ( & trans -> child [ idx ], trans -> depth + 1 );
-            if ( pb -> rc != 0 )
-                return false;
-
-            ++ pb -> tcnt;
-        }
-
-#if _DEBUGGING
-        /* accounting for non-terminal key */
-        ++ pb -> cnt;
-#else
-        /* early exit */
-        if ( ++ pb -> cnt == trans -> tcnt )
-            return true;
-#endif
-    }
-
-    return false;
-}
-
-static
-bool CC WhackKids ( BSTNode *n, void *data )
-{
-    ExplodeTransData *pb = data;
-    TNode *item = ( TNode* ) n;
-    const TTrans *trans = pb -> trans;
-
-    if ( item -> key . len > trans -> depth )
-    {
-        TTrans *child;
-        uint32_t idx;
-        String key = item -> key;
-        const Trie *tt = pb -> tt;
-
-        /* perform a sub-string based upon
-           knowledge that the entry key matches
-           the first "trans->depth" characters */
-        key . addr += pb -> tsize;
-        key . len -= trans -> depth;
-        key . size -= pb -> tsize;
-
-        /* get the next transition character */
-        pb -> rc = TrieNextIdx ( tt, & key, & idx );
-        if ( pb -> rc != 0 )
-            return false;
-
-        /* test the transition - due to early
-           exit on error from child creation,
-           as well as from this function, we can
-           assert that this transition is not NULL */
-        assert ( trans -> child != NULL );
-        assert ( trans -> child [ idx ] != NULL );
-        child = trans -> child [ idx ];
-
-        /* if the child is totally empty, it was just
-           created and should be doused */
-        if ( child -> tcnt + child -> vcnt == 0 )
-        {
-            free ( child );
-            trans -> child [ idx ] = NULL;
-
-#if _DEBUGGING
-            /* not strictly required, because no changes
-               have been committed yet */
-            -- pb -> tcnt;
-#else
-            /* early exit when there could be no further work */
-            if ( -- pb -> tcnt == 0 )
-                return true;
-#endif
-        }
-
-        /* mandatory early exit when we detect limit */
-        if ( -- pb -> cnt == 0 )
-            return true;
-    }
-
-    return false;
-}
-
-static
-bool CC MoveKids ( BSTNode *n, void *data )
-{
-    ExplodeTransData *pb = data;
-    TNode *item = ( TNode* ) n;
-    TTrans *trans = pb -> trans;
-
-    if ( item -> key . len > trans -> depth )
-    {
-        TTrans *child;
-        uint32_t idx;
-        String key = item -> key;
-        const Trie *tt = pb -> tt;
-
-        /* perform a sub-string based upon
-           knowledge that the entry key matches
-           the first "trans->depth" characters */
-        key . addr += pb -> tsize;
-        key . len -= trans -> depth;
-        key . size -= pb -> tsize;
-
-        /* get the next transition character */
-        pb -> rc = TrieNextIdx ( tt, & key, & idx );
-        assert ( pb -> rc == 0 );
-
-        /* test the transition */
-        assert ( trans -> child != NULL );
-        assert ( trans -> child [ idx ] != NULL );
-        child = trans -> child [ idx ];
-
-        /* pop this guy from its current location */
-        BSTreeUnlink ( & trans -> vals, & item -> n );
-
-        /* insert into its new location */
-        pb -> rc = BSTreeInsert ( & child -> vals, & item -> n, TNodeSort );
-        assert ( pb -> rc == 0 );
-
-        if ( item -> key . len == child -> depth )
-            ++ child -> vcnt;
-        else
-            ++ child -> tcnt;
-
-        /* detect an over-limit child */
-        assert ( child -> child == NULL );
-        if ( child -> tcnt != 0 && ( child -> tcnt + child -> vcnt > tt -> limit ) )
-            pb -> over = true;
-
-#if _DEBUGGING
-        ++ pb -> cnt;
-#else
-        /* early exit */
-        if ( ++ pb -> cnt == trans -> tcnt )
-            return true;
-#endif
-    }
-
-    return false;
-}
-
-static
-rc_t CC TrieExplodeTrans ( const Trie *tt, TTrans *trans, size_t tsize )
-{
-    rc_t rc;
-    ExplodeTransData pb;
-
-    /* create a child array */
-    assert ( trans -> child == NULL );
-    trans -> child = calloc ( tt -> width, sizeof trans -> child [ 0 ] );
-    if ( trans -> child == NULL )
-        return RC ( rcCont, rcTrie, rcInserting, rcMemory, rcExhausted );
-
-    /* loop data structure */
-    pb . tt = tt;
-    pb . trans = trans;
-    pb . tsize = tsize;
-    pb . tcnt = 0;
-    pb . cnt = 0;
-    pb . rc = 0;
-
-    /* create new child nodes */
-    BSTreeDoUntil ( & trans -> vals, 0, CreateKids, & pb );
-    assert ( pb . tcnt <= tt -> width );
-    rc = pb . rc;
-
-    /* roll-back changes on error */
-    if ( rc != 0 && pb . cnt != trans -> tcnt )
-    {
-        if ( pb . tcnt != 0 )
-        {
-            BSTreeDoUntil ( & trans -> vals, 0, WhackKids, & pb );
-            assert ( pb . tcnt == 0 );
-        }
-
-        free ( trans -> child );
-        trans -> child = NULL;
-
-        return rc;
-    }
-
-    /* commit changes */
-    pb . cnt = 0;
-    pb . over = false;
-
-    BSTreeDoUntil ( & trans -> vals, 0, MoveKids, & pb );
-    assert ( pb . rc == 0 );
-    assert ( pb . cnt == trans -> tcnt );
-
-    assert ( pb . tcnt <= tt -> width );
-    trans -> tcnt = pb . tcnt;
-
-    /* handle over-limit kids */
-    if ( pb . over )
-    {
-        uint32_t i;
-        for ( i = 0; i < tt -> width; ++ i )
-        {
-            TTrans *child = trans -> child [ i ];
-            if ( trans -> child [ i ] != NULL )
-            {
-                assert ( child -> child == NULL );
-                if ( child -> tcnt != 0 && ( child -> tcnt + child -> vcnt > tt -> limit ) )
-                {
-                    /* re-calculate transition key string size */
-                    uint32_t ch;
-                    const TNode *item = ( const TNode* ) child -> vals . root;
-                    String key = item -> key;
-
-                    key . addr += tsize;
-                    key . len -= trans -> tcnt;
-                    key . size -= tsize;
-
-                    rc = StringPopHead ( & key, & ch );
-                    assert ( rc == 0 );
-
-                    rc = TrieExplodeTrans ( tt, child, item -> key . size - key . size );
-                    if ( rc != 0 )
-                        break;
-                }
-            }
-        }
-    }
-
-    return rc;
-}
-
-/* TrieInsertEngine
- *  inserts an item into tree
- *
- *  "item" is a TNode with an embedded key string.
- *
- *  "exist" is an optional return parameter for prior nodes
- *  and indicates whether to insert unique or not
- *
- *  returns status codes:
- *    0      => success
- *    EINVAL => an invalid parameter
- *    ENOMEM => failed to allocate internal structures
- */
-static
-rc_t CC TrieInsertEngine ( Trie *tt, TNode *item, TNode **exist )
-{
-    rc_t rc;
-    String key;
-    TTrans *trans;
-
-    /* quick parameter check */
-    if ( tt == NULL )
-        return RC ( rcCont, rcTrie, rcInserting, rcSelf, rcNull );
-    if ( item == NULL )
-        return RC ( rcCont, rcTrie, rcInserting, rcParam, rcNull );
-    if ( item -> key . len == 0 )
-        return RC ( rcCont, rcTrie, rcInserting, rcString, rcEmpty );
-
-    /* starting key */
-    key = item -> key;
-
-    /* get the root TTrans */
-    if ( tt -> root == NULL )
-    {
-        rc = TTransMake ( & tt -> root, 0 );
-        if ( rc != 0 )
-            return rc;
-    }
-    trans = tt -> root;
-
-    while ( 1 )
-    {
-        /* if there is a child array and the key is non-terminal */
-        if ( trans -> child != NULL && trans -> depth < item -> key . len )
-        {
-            /* get transition character and index */
-            uint32_t ch, idx;
-            rc = StringPopHead ( & key, & ch );
-            if ( rc != 0 )
-                break;
-            idx = TrieMapChar ( tt, ch );
-
-            /* check for auto-expand on unmapped character */
-            if ( idx == 0 && tt -> cs_expand )
-            {
-                /* get the new width */
-                uint16_t width = tt -> width + 1;
-
-                /* get a new value for idx */
-                idx = tt -> width;
-
-                /* make sure the expansion would not exceed
-                   the 16 bit limit on array width */
-                if ( width == 0 )
-                {
-                    rc = RC ( rcCont, rcTrie, rcInserting, rcRange, rcExcessive );
-                    break;
-                }
-                rc = TrieAutoExpand ( tt, ch );
-                if ( rc != 0 )
-                    break;
-            }
-
-            /* take transition if there */
-            if ( trans -> child [ idx ] != NULL )
-            {
-                trans = trans -> child [ idx ];
-                continue;
-            }
-
-            /* create new transition */
-            rc = TTransMake ( & trans -> child [ idx ], trans -> depth + 1 );
-            if ( rc != 0 )
-                break;
-
-            /* account for and take the new transition */
-            ++ trans -> tcnt;
-            trans = trans -> child [ idx ];
-        }
-
-        /* item should never be shorter than node */
-        assert ( trans -> depth <= item -> key . len );
-        if ( trans -> depth < item -> key . len )
-        {
-            rc = TrieValidateRemainder ( tt, & key );
-            if ( rc != 0 )
-                break;
-        }
-
-        /* going to install into value tree */
-        if ( exist == NULL )
-            rc = BSTreeInsert ( & trans -> vals, & item -> n, TNodeSort );
-        else
-        {
-            rc = BSTreeInsertUnique ( & trans -> vals,
-                & item -> n, ( BSTNode** ) exist, TNodeSort );
-        }
-        if ( rc == 0 )
-        {
-            /* account for type of insert */
-            if ( trans -> depth == item -> key . len )
-                ++ trans -> vcnt;
-            else
-                ++ trans -> tcnt;
-
-            /* now test for overflow */
-            if ( trans -> child == NULL && trans -> tcnt != 0 )
-            {
-                if ( trans -> vcnt + trans -> tcnt > tt -> limit )
-                {
-                    /* it's time to convert to a full transition node */
-                    TrieExplodeTrans ( tt, trans, item -> key . size - key . size );
-                }
-            }
-        }
-        break;
-    }
-
-#if _DEBUGGING && 0
-    if ( rc == 0 && tt -> validate )
-        rc = TTransValidate ( tt -> root, tt );
-#endif
-
-    return rc;
-}
-
-/* TrieInsert
- *  inserts an item into tree
- *
- *  "item" is a TNode with an embedded key string.
- *
- *  returns status codes:
- *    0      => success
- *    EINVAL => an invalid parameter
- *    ENOMEM => failed to allocate internal structures
- */
-LIB_EXPORT rc_t CC TrieInsert ( Trie *tt, TNode *item )
-{
-    return TrieInsertEngine ( tt, item, NULL );
-}
-
-/* TrieInsertUnique
- *  behaves like TrieInsert and returns 0 if insert succeeded
- *
- *  if insert failed with a return value of EEXIST, the existing
- *  object is returned in "exist".
- */
-LIB_EXPORT rc_t CC TrieInsertUnique ( Trie *tt, TNode *item, TNode **exist )
-{
-    TNode *dummy;
-    if ( exist == NULL )
-        exist = & dummy;
-
-    return TrieInsertEngine ( tt, item, exist );
-}
-
-/* TrieFindTrans
- */
-static
-rc_t CC TrieFindTrans ( const Trie *tt, TTrans *trans, const String *item, TTrans **buffer )
-{
-    String key = * item;
-
-    while ( trans -> child != NULL )
-    {
-        rc_t rc;
-        uint32_t idx;
-
-        assert ( trans -> tcnt != 0 );
-
-        rc = TrieNextIdx ( tt, & key, & idx );
-	/* This might actually happen if the trie has more internal
-	   nodes than one might think, and the string is short 
-	   (i.e. it terminates in an "internal" node */
-	/* This needs to know the reconstructed RC for better readability */
-	if (rc == RC( rcText, rcChar, rcRemoving, rcString, rcEmpty ) ) {
-	  *buffer = trans;
-	  return 0;
-	}
-        if ( rc != 0 )
-	  return rc;
-
-        if ( trans -> child [ idx ] == NULL )
-            break;
-
-        trans = trans -> child [ idx ];
-    }
-
-    * buffer = trans;
-    return 0;
-}
-
-/* TrieFindTransChain
- *  finds chain of TTrans objects having single transitions
- *
- *  explanation and justification:
- *
- *  - when TrieUnlink removes the last bucket from a value BSTree,
- *    the containing TTrans node may become empty and should be
- *    collected.
- *
- *  - to collect a TTrans object, a backlink to its parent or a
- *    forward list from parent(s) to node are required, in order
- *    to remove the parents' outgoing transition to the dead node.
- *
- *  - backlinks have been excluded from the design for many reasons,
- *    among them the expense of 64 bit pointers. a list of forward
- *    transitions only requires a head and tail, since the internal
- *    transitions are found with the key and may be recovered with
- *    the same key.
- *
- *  - this chain is defined as the head and tail of a list having
- *    a single line of transitions eminating from a remaining parent,
- *    such that "head" will be the deepest parent in the chain having
- *    a vcnt + tcnt > 1, or NULL if none are found. all subsequent nodes
- *    will be subject to collection.
- */
-static
-rc_t CC TrieFindTransChain ( const Trie *tt, TTrans *trans,
-    const String *item, TTrans **head, TTrans **tail )
-{
-    String key = * item;
-
-    * head = NULL;
-
-    while ( trans -> child != NULL )
-    {
-        rc_t rc;
-        uint32_t idx;
-
-        assert ( trans -> tcnt != 0 );
-
-        rc = TrieNextIdx ( tt, & key, & idx );
-        if ( rc != 0 )
-            return rc;
-
-        /* detect end of line */
-        if ( trans -> child [ idx ] == NULL )
-            break;
-
-        /* record new head */
-        if ( trans -> tcnt + trans -> vcnt > 1 )
-            * head = trans;
-
-        /* take transition */
-        trans = trans -> child [ idx ];
-    }
-
-    * tail = trans;
-    return 0;
-}
-
-/* TrieUnlink
- *  remove an object from the tree
- *
- *  returns "true" if node was actually removed from tree
- */
-LIB_EXPORT bool CC TrieUnlink ( Trie *tt, TNode *item )
-{
-    if ( tt != NULL && item != NULL && tt -> root != NULL )
-    {
-        TTrans *head, *tail;
-        rc_t rc = TrieFindTransChain ( tt, tt -> root, & item -> key, & head, & tail );
-        if ( rc == 0 && BSTreeUnlink ( & tail -> vals, & item -> n ) )
-        {
-            assert ( item -> key . len >= tail -> depth );
-            if ( item -> key . len == tail -> depth )
-            {
-                assert ( tail -> vcnt > 0 );
-                -- tail -> vcnt;
-            }
-            else
-            {
-                assert ( tail -> tcnt > 0 );
-                -- tail -> tcnt;
-            }
-
-            /* check for need to whack TTrans */
-            if ( tail -> vcnt + tail -> tcnt == 0 )
-            {
-                String key;
-                TTrans *trans;
-                uint32_t idx;
-
-                if ( head == NULL )
-                {
-                    /* going to whack everything */
-                    key = item -> key;
-                    trans = tt -> root;
-                }
-                else
-                {
-                    /* remove the leading characters of the key */
-                    StringSubstr ( & item -> key, & key, head -> depth, 0 );
-                    rc = TrieNextIdx ( tt, & key, & idx );
-                    assert ( rc == 0 );
-                    assert ( head -> child != NULL );
-                    trans = head -> child [ idx ];
-
-                    /* sever the transition */
-                    assert ( trans != NULL );
-                    head -> child [ idx ] = NULL;
-                    assert ( head -> vcnt > 0 );
-                    -- head -> vcnt;
-                }
-
-                /* whack all of the trans nodes down to tail */
-                while ( 1 )
-                {
-                    TTrans *next;
-
-                    /* get the next character index */
-                    rc = TrieNextIdx ( tt, & key, & idx );
-                    assert ( rc == 0 );
-
-                    /* get the next node */
-                    assert ( trans -> child != NULL );
-                    next = trans -> child [ idx ];
-                    assert ( next != NULL );
-
-                    /* whack the current node */
-                    assert ( trans -> vcnt + trans -> tcnt == 0 );
-                    assert ( trans -> vals . root == NULL );
-                    free ( trans -> child );
-                    free ( trans );
-
-                    /* get out if this was the tail */
-                    if ( trans == tail )
-                        break;
-
-                    /* take the next transition */
-                    trans = next;
-                }
-            }
-
-            return true;
-        }
-    }
-
-    return false;
-}
-
-/* TrieFind
- *  find a single object within tree
- *
- *  "item" is an exact match text string
- *
- *  returns an arbitrarily selected TNode* from matching set
- *  or NULL if none found.
- */
-LIB_EXPORT TNode * CC TrieFind ( const Trie *tt, const String *item )
-{
-    if ( tt != NULL && item != NULL && tt -> root != NULL && item -> len != 0 )
-    {
-        TTrans *trans;
-        rc_t rc = TrieFindTrans ( tt, tt -> root, item, & trans );
-	if (rc == 0)
-        {
-	    return ( TNode* ) BSTreeFind ( & trans -> vals, item,
-                ( int ( CC * ) ( const void*, const BSTNode* ) ) TNodeCmp );
-	}
-    }
-
-    return NULL;
-}
-
-/* TrieFindAll
- *  find multiple objects within tree
- *
- *  "item" is an exact match text string
- *
- *  "buffer" is a user-supplied array of TNode* with a
- *  capacity of "capacity" elements. if successful, the
- *  entire found set will be returned unordered within.
- *
- *  "num_found" ( out ) indicates the size of the found set,
- *  regardless of return value, such that if the supplied
- *  buffer were to be too small, the required size is returned.
- *
- *  returns status codes:
- *    0       => success
- *    EINVAL  => an invalid parameter
- *    ENOENT  => the found set was empty
- *    ENOBUFS => the found set was too large
- */
-LIB_EXPORT rc_t CC TrieFindAll ( const Trie *tt, const String *item,
-    TNode *buffer [], uint32_t capacity,
-    uint32_t *num_found )
-{
-    rc_t rc;
-    TTrans *trans;
-    uint32_t count;
-
-    if ( tt == NULL )
-        return RC ( rcCont, rcTrie, rcSelecting, rcSelf, rcNull );
-    if ( item == NULL )
-        return RC ( rcCont, rcTrie, rcSelecting, rcString, rcNull );
-    if ( item -> len == 0 )
-        return RC ( rcCont, rcTrie, rcSelecting, rcString, rcEmpty );
-
-    if ( buffer == NULL && capacity != 0 )
-        return RC ( rcCont, rcTrie, rcSelecting, rcBuffer, rcNull );
-
-    count = 0;
-
-    rc = TrieFindTrans ( tt, tt -> root, item, & trans );
-    if ( rc == 0 )
-    {
-        TNode *node = ( TNode* ) BSTreeFind ( & trans -> vals, item,
-            ( int ( CC * ) ( const void*, const BSTNode* ) ) TNodeCmp );
-        if ( node == NULL )
-            rc = RC ( rcCont, rcTrie, rcSelecting, rcString, rcNotFound );
-        else
-        {
-            TNode *nbr;
-
-            /* back up as far as we can */
-            for ( nbr = ( TNode* ) BSTNodePrev ( & node -> n );
-                  nbr != NULL && StringEqual ( & nbr -> key, item );
-                  nbr = ( TNode* ) BSTNodePrev ( & node -> n ) )
-            {
-                ++ count;
-                node = nbr;
-            }
-
-            /* recover to original point */
-            if ( count != 0 )
-            {
-                uint32_t i;
-                for ( i = 0; i < count; ++ i )
-                {
-                    if ( i < capacity )
-                        buffer [ i ] = node;
-                    node = ( TNode* ) BSTNodeNext ( & node -> n );
-                }
-            }
-
-            /* count the original */
-            if ( count < capacity )
-                buffer [ count ] = node;
-
-            /* now continue forward */
-            for ( ++ count, node = ( TNode* ) BSTNodeNext ( & node -> n );
-                  node != NULL && StringEqual ( & node -> key, item );
-                  ++ count, node = ( TNode* ) BSTNodeNext ( & node -> n ) )
-            {
-                if ( count < capacity )
-                    buffer [ count ] = node;
-            }
-
-            /* detect no buffer space */
-            if ( count > capacity )
-                rc = RC ( rcCont, rcTrie, rcSelecting, rcBuffer, rcInsufficient );
-        }
-    }
-
-    if ( num_found != NULL )
-        * num_found = count;
-
-    return rc;
-}
-
-/* TrieForEach
- *  executes a function on each tree element
- */
-typedef struct TrieForEachData TrieForEachData;
-struct TrieForEachData
-{
-    void ( CC * f ) ( TNode*, void* );
-    void *data;
-};
-
-static
-void CC TrieForEachElem ( const TTransBacktrace *bt, uint32_t width, void *data )
-{
-    const TTrans *trans = bt -> trans;
-    TrieForEachData *pb = data;
-    if ( trans -> vals . root != NULL )
-    {
-        BSTreeForEach ( & trans -> vals, 0,
-            ( void ( CC * ) ( BSTNode*, void* ) ) pb -> f, pb -> data );
-    }
-}
-
-LIB_EXPORT void CC TrieForEach ( const Trie *tt,
-    void ( CC * f ) ( TNode *n, void *data ), void *data )
-{
-    if ( tt != NULL && tt -> root != NULL )
-    {
-        TrieForEachData pb;
-        pb . f = f;
-        pb . data = data;
-        TTransForEach ( tt -> root, tt -> width, TrieForEachElem, & pb );
-    }
-}
-
-/* TrieDoUntil
- *  executes a function on each tree element
- *  until the function returns true
- */
-typedef struct TrieDoUntilData TrieDoUntilData;
-struct TrieDoUntilData
-{
-    bool ( CC * f ) ( TNode*, void* );
-    void *data;
-};
-
-static
-bool CC TrieDoUntilElem ( const TTransBacktrace *bt, uint32_t width, void *data )
-{
-    const TTrans *trans = bt -> trans;
-    TrieDoUntilData *pb = data;
-    if ( trans -> vals . root != NULL )
-    {
-        return BSTreeDoUntil ( & trans -> vals, 0,
-            ( bool ( CC * ) ( BSTNode*, void* ) ) pb -> f, pb -> data );
-    }
-    return false;
-}
-
-LIB_EXPORT bool CC TrieDoUntil ( const Trie *tt,
-    bool ( CC * f ) ( TNode *n, void *data ), void *data )
-{
-    if ( tt != NULL && tt -> root != NULL )
-    {
-        TrieDoUntilData pb;
-        pb . f = f;
-        pb . data = data;
-        return TTransDoUntil ( tt -> root, tt -> width, TrieDoUntilElem, & pb );
-    }
-    return false;
-}
-
-/* TrieExplore
- *  executes a function on each element in the path of the key
- *  from furthest node to closest node
- *  until the function returns true or end of chain
- */
-typedef struct TrieExploreData_struct {
-    bool ( CC * f ) ( TNode*, void* );
-    void *data;
-    const String* item;
-} TrieExploreData;
-
-static
-bool CC TrieExploreBSTree( BSTNode *n, void *data )
-{
-    TrieExploreData* pb = data;
-    TNode* node = (TNode*)n;
-    String sub = *pb->item;
-    sub.len = node->key.len;
-
-    if( StringCompare(&node->key, &sub) == 0 ) {
-        if( pb->f(node, pb->data) ) {
-            return true;
-        }
-    }
-    return false;
-}
-
-static
-bool CC TrieExploreTrans( const Trie *tt, TTrans *trans, String *key, TrieExploreData* data)
-{
-    /* first dive deeper if possible */
-    while( trans->child != NULL ) {
-        uint32_t idx;
-        if( TrieNextIdx(tt, key, &idx) != 0 ) {
-            break;
-        }
-        if( trans->child[idx] != NULL ) {
-            /* do not recur if current trans has no values */
-            if( trans->vcnt > 0 ) {
-                if( TrieExploreTrans(tt, trans->child[idx], key, data) ) {
-                    return true;
-                }
-                break;
-            } else {
-                trans = trans->child[idx];
-            }
-        }
-    }
-    /* than search local BSTree on the way out */
-    return BSTreeDoUntil(&trans->vals, true, TrieExploreBSTree, data);
-}
-
-LIB_EXPORT bool CC TrieExplore( const Trie *tt, const String *item, 
-    bool ( CC * f ) ( TNode *n, void *data ), void *data )
-{
-    if ( tt != NULL && item != NULL && tt->root != NULL && item->len != 0 ) {
-        TrieExploreData pb;
-        String key = *item;
-        pb.f = f;
-        pb.data = data;
-        pb.item = item;
-        return TrieExploreTrans(tt, tt->root, &key, &pb);
-    }
-    return false;
-}
-
-/* TrieWhack
- *  tears down internal structure
- *
- *  any parameter, including"tt," may be NULL
- */
-LIB_EXPORT void CC TrieWhack ( Trie *tt,
-    void ( CC * whack ) ( TNode *n, void *data ), void *data )
-{
-    if ( tt != NULL )
-    {
-        if ( tt -> root != NULL )
-            TTransWhack ( tt -> root, tt -> width, whack, data );
-
-        free ( ( void* ) tt -> map );
-        free ( ( void* ) tt -> rmap );
-    }
-}
diff --git a/libs/klib/trieval.c b/libs/klib/trieval.c
deleted file mode 100644
index 539a70d..0000000
--- a/libs/klib/trieval.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include "trie-priv.h"
-#include <klib/log.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <wctype.h>
-#include <errno.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * TTrans
- *  a text transition node
- *
- *  transitions to child nodes occur only if "tcnt" != 0 ( "child" != NULL )
- *  and are taken on the query string's character [ key . len ]
- */
-
-/* TTransValidate
- */
-typedef struct TTValNodeCntData TTValNodeCntData;
-struct TTValNodeCntData
-{
-    unsigned int depth;
-    unsigned int vcnt;
-    unsigned int tcnt;
-};
-
-static
-void CC TTransCountTNodes ( BSTNode *n, void *data )
-{
-    TTValNodeCntData *pb = data;
-    const TNode *node = ( const TNode* ) n;
-
-    if ( strlen ( node -> key . addr ) == pb -> depth )
-        ++ pb -> vcnt;
-    else
-        ++ pb -> tcnt;
-}
-
-/* TTransValidate
- *  recursively checks structure
- */
-LIB_EXPORT int CC TTransValidate ( const TTrans *trans, const Trie *tt )
-{
-    int status = 0;
-
-    TTValNodeCntData pb;
-    unsigned int i, width;
-
-    width = tt -> width;
-
-    pb . depth = trans -> depth;
-    pb . vcnt = pb . tcnt = 0;
-
-    /* count transition array */
-    if ( trans -> child != NULL )
-    {
-        for ( i = 0; i < width; ++ i )
-        {
-            if ( trans -> child [ i ] != NULL )
-                ++ pb . tcnt;
-        }
-    }
-
-    /* count value tree */
-    BSTreeForEach ( & trans -> vals, 0, TTransCountTNodes, & pb );
-
-    /* check validity */
-    if ( pb . tcnt != trans -> tcnt )
-    {
-        LOGERR ( status = EINVAL, "bad trans -> tcnt => %u, should be %u",
-                 trans -> tcnt, pb . tcnt );
-    }
-
-    /* should have a non-zero tcnt if has child array */
-    else if ( pb . tcnt == 0 && trans -> child != NULL )
-    {
-        LOGERR ( status = EINVAL, "empty trans -> child", NULL ); /* 3rd parameter is wrong so far... */
-    }
-
-    if ( pb . vcnt != trans -> vcnt )
-    {
-        LOGERR ( status = EINVAL, "bad trans -> vcnt => %u, should be %u",
-                 trans -> vcnt, pb . vcnt );
-    }
-
-    if ( trans -> child == NULL && pb . tcnt != 0 )
-    {
-        if ( pb . tcnt + pb . vcnt > tt -> limit )
-        {
-            /*
-            LOGMSG ( "WARNING: over-limit actual value count => %u, should be %u\n",
-                 pb . tcnt + pb . vcnt, tt -> limit );
-           */
-            LOGMSG ( status = EINVAL, "WARNING: over-limit actual value count => %u, should be %u\n" );
-        }
-    }
-
-    if ( status == 0 && trans -> child != NULL )
-    {
-        for ( i = 0; i < width; ++ i )
-        {
-            const TTrans *child = trans -> child [ i ];
-            if ( child != NULL )
-            {
-                if ( child -> depth != trans -> depth + 1 )
-                {
-                    LOGERR ( status = EINVAL, "bad trans -> depth => %u, should be %u",
-                             child -> depth, trans -> depth + 1 );
-                }
-                else
-                {
-                    int err = TTransValidate ( child, tt );
-                    if ( status == 0 )
-                        status = err;
-                }
-            }
-        }
-    }
-
-    return status;
-}
-
-/*--------------------------------------------------------------------------
- * Trie
- *  a tree of text nodes
- */
-
-/* TrieValidate
- *  run validation check on tree structure
- */
-LIB_EXPORT int CC TrieValidate ( const Trie *tt )
-{
-    if ( tt == NULL )
-        return EINVAL;
-    if ( tt -> root == NULL )
-        return 0;
-    return TTransValidate ( tt -> root, tt );
-}
diff --git a/libs/klib/unix/misc.c b/libs/klib/unix/misc.c
deleted file mode 100644
index e42e332..0000000
--- a/libs/klib/unix/misc.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/misc.h> /* is_iser_an_admin */
-
-#include <unistd.h> /* geteuid */
-
-LIB_EXPORT bool CC is_iser_an_admin(void) {
-    return geteuid() == 0;
-}
diff --git a/libs/klib/unix/syserrcode.c b/libs/klib/unix/syserrcode.c
deleted file mode 100644
index df2ab60..0000000
--- a/libs/klib/unix/syserrcode.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include "writer-priv.h"
-#include <klib/writer.h>
-#include <klib/text.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-#include <os-native.h> /* for strchrnul on non-linux */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-#include <assert.h>
-
-size_t KWrtFmt_error_code ( char * buffer, size_t buffer_size, uint32_t error_code )
-{
-    /* this either returns char * or int - we don't really care
-     * if it fails as slong as it put something into the buffer */
-    strerror_r ((int)error_code, buffer, buffer_size);
-    return string_size (buffer);
-}
diff --git a/libs/klib/unix/syslog.c b/libs/klib/unix/syslog.c
deleted file mode 100644
index 16aa4ad..0000000
--- a/libs/klib/unix/syslog.c
+++ /dev/null
@@ -1,209 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include "log-priv.h"
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <assert.h>
-#include <time.h>
-#include <errno.h>
-
-
-/* LogTimestamp
- *  generates a timestamp string
- */
-
-LIB_EXPORT rc_t CC LogTimestamp ( char *buffer, size_t bsize, size_t *num_writ )
-{
-    int len;
-    static time_t last_time = 0;
-    static struct tm cal;
-    
-    /* get current time */
-    time_t t = time ( 0 );
-    
-    /* initialize time on first run */
-    if ( ! last_time )
-    {
-        last_time = t;
-        gmtime_r ( & last_time, & cal );
-    }
-    
-    /* or update if time has passed */
-    else if ( t != last_time )
-    {
-        /* update every 5 minutes or so */
-        time_t dt = t - last_time;
-        last_time = t;
-        if ( dt >= 300 )
-            gmtime_r ( & last_time, & cal );
-	
-        /* otherwise, just update the struct manually */
-        else
-        {
-            /* advance seconds */
-            dt += cal . tm_sec;
-            cal . tm_sec = ( int ) ( dt % 60 );
-	    
-            /* detect a rolled-over minute */
-            if ( ( dt /= 60 ) != 0 )
-            {
-                /* advance minutes */
-                dt += cal . tm_min;
-                cal . tm_min = ( int ) ( dt % 60 );
-		
-                /* detect a rolled-over hour */
-                if ( ( dt /= 60 ) != 0 )
-                {
-                    /* roll-over of an hour - refetch */
-                    gmtime_r ( & last_time, & cal );
-                }
-            }
-        }
-    }
-    
-    /* make the timestamp */
-    len = snprintf ( buffer, bsize,
-                     "%04d-%02d-%02dT%02d:%02d:%02d"
-                     , cal . tm_year + 1900
-                     , cal . tm_mon + 1
-                     , cal . tm_mday
-                     , cal . tm_hour
-                     , cal . tm_min
-                     , cal . tm_sec
-        );
-
-    if ( num_writ != NULL )
-        * num_writ = len;
-
-    if ( len < 0 || ( size_t ) len >= bsize )
-    {
-        if ( len < 0 && num_writ != NULL )
-            * num_writ = 0;
-        return RC ( rcApp, rcLog, rcLogging, rcBuffer, rcInsufficient );
-    }
-
-    return 0;
-}
-
-/* LogSimpleTimestamp
- *  generates a local timestamp string without time zone
- */
-LIB_EXPORT rc_t CC LogSimpleTimestamp ( char *buffer, size_t bsize, size_t *num_writ )
-{
-    int len;
-    static time_t last_time = 0;
-    static struct tm cal;
-    
-    /* get current time */
-    time_t t = time ( 0 );
-    
-    /* initialize time on first run */
-    if ( ! last_time )
-    {
-        last_time = t;
-        localtime_r ( & last_time, & cal );
-    }
-    
-    /* or update if time has passed */
-    else if ( t != last_time )
-    {
-        /* update every 5 minutes or so */
-        time_t dt = t - last_time;
-        last_time = t;
-        if ( dt >= 300 )
-            localtime_r ( & last_time, & cal );
-
-        /* otherwise, just update the struct manually */
-        else
-        {
-            /* advance seconds */
-            dt += cal . tm_sec;
-            cal . tm_sec = ( int ) ( dt % 60 );
-
-            /* detect a rolled-over minute */
-            if ( ( dt /= 60 ) != 0 )
-            {
-                /* advance minutes */
-                dt += cal . tm_min;
-                cal . tm_min = ( int ) ( dt % 60 );
-
-                /* detect a rolled-over hour */
-                if ( ( dt /= 60 ) != 0 )
-                {
-                    /* roll-over of an hour - refetch */
-                    localtime_r ( & last_time, & cal );
-                }
-            }
-        }
-    }
-    
-    /* make the timestamp */
-    len = snprintf ( buffer, bsize,
-                     "%04d-%02d-%02dT%02d:%02d:%02d"
-                     , cal . tm_year + 1900
-                     , cal . tm_mon + 1
-                     , cal . tm_mday
-                     , cal . tm_hour
-                     , cal . tm_min
-                     , cal . tm_sec
-        );
-    if ( num_writ != NULL )
-        * num_writ = len;
-
-    if ( len < 0 || ( size_t ) len >= bsize )
-    {
-        if ( len < 0 && num_writ != NULL )
-            * num_writ = 0;
-        return RC ( rcApp, rcLog, rcLogging, rcBuffer, rcInsufficient );
-    }
-
-    return 0;
-}
-
-/* LogPID
- *  generates a process id
- */
-LIB_EXPORT rc_t CC LogPID ( char *buffer, size_t bsize, size_t *num_writ )
-{
-    /* pid_t is signed not unsigned int */
-    int len = snprintf ( buffer, bsize, "%d", getpid () );
-    * num_writ = len;
-    if ( len < 0 || ( size_t ) len >= bsize )
-    {
-        if ( len < 0 )
-            * num_writ = 0;
-        return RC ( rcApp, rcLog, rcLogging, rcBuffer, rcInsufficient );
-    }
-    return 0;
-}
-
diff --git a/libs/klib/unix/systime.c b/libs/klib/unix/systime.c
deleted file mode 100644
index 458abb9..0000000
--- a/libs/klib/unix/systime.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include <klib/time.h>
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <assert.h>
-#include <time.h>
-#include <errno.h>
-
-
-/*--------------------------------------------------------------------------
- * KTime_t
- *  64 bit time_t
- */
-
-
-/* Stamp
- *  current timestamp
- */
-LIB_EXPORT KTime_t CC KTimeStamp ( void )
-{
-    return time ( NULL );
-}
-
-
-/*--------------------------------------------------------------------------
- * KTime
- *  simple time structure
- */
-
-
-/* Make
- *  make KTime from struct tm
- */
-static
-void KTimeMake ( KTime *kt, struct tm const *t )
-{
-    kt -> year = t -> tm_year + 1900;
-    kt -> month = t -> tm_mon;
-    kt -> day = t -> tm_mday - 1;
-    kt -> weekday = t -> tm_wday;
-#if !defined(__SunOS)  &&  !defined(__sun__)
-    kt -> tzoff = ( int16_t ) ( t -> tm_gmtoff / 60 );
-#endif
-    kt -> hour = ( uint8_t ) t -> tm_hour;
-    kt -> minute = ( uint8_t ) t -> tm_min;
-    kt -> second = ( uint8_t ) t -> tm_sec;
-    kt -> dst = t -> tm_isdst != 0;
-}
-
-
-/* Local
- *  populate "kt" from "ts" in local time zone
- */
-LIB_EXPORT const KTime* CC KTimeLocal ( KTime *kt, KTime_t ts )
-{
-    if ( kt != NULL )
-    {
-        struct tm t;
-        time_t unix_time = ( time_t ) ts;
-        localtime_r ( & unix_time, & t );
-        KTimeMake ( kt, & t );
-    }
-    return kt;
-}
-
-
-/* Global
- *  populate "kt" from "ts" in GMT
- */
-LIB_EXPORT const KTime* CC KTimeGlobal ( KTime *kt, KTime_t ts )
-{
-    if ( kt != NULL )
-    {
-        struct tm t;
-        time_t unix_time = ( time_t ) ts;
-        gmtime_r ( & unix_time, & t );
-        KTimeMake ( kt, & t );
-    }
-    return kt;
-}
-
-
-/* MakeTime
- *  make a KTime_t from KTime
- */
-LIB_EXPORT KTime_t CC KTimeMakeTime ( const KTime *self )
-{
-    KTime_t ts = 0;
-
-    if ( self != NULL )
-    {
-        struct tm t;
-
-        assert ( self -> year >= 1900 );
-        t . tm_year = self -> year - 1900;
-        t . tm_mon = self -> month;
-        t . tm_mday = self -> day + 1;
-        t . tm_wday = self -> weekday;
-#if !defined(__SunOS)  &&  !defined(__sun__)
-        t . tm_gmtoff = self -> tzoff * 60; 
-#endif
-        t . tm_hour = self -> hour;
-        t . tm_min = self -> minute;
-        t . tm_sec = self -> second;
-        t . tm_isdst = self -> dst;
-
-        ts = mktime ( &t );
-    }
-
-    return ts;
-}
diff --git a/libs/klib/unix/syswriter.c b/libs/klib/unix/syswriter.c
deleted file mode 100644
index 93df60c..0000000
--- a/libs/klib/unix/syswriter.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-#include "writer-priv.h"
-#include <klib/text.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-
-static int unix_stdout = 1;
-static int unix_stderr = 2;
-
-rc_t KWrtSysInit(void** h_stdout, void** h_stderr)
-{
-    if( h_stdout ) {
-        *h_stdout = &unix_stdout;
-    }
-    if( h_stderr ) {
-        *h_stderr = &unix_stderr;
-    }
-    return 0;
-}
-
-/* ----
- * write 'count' bytes starting at 'buf'  to a "stream/file" identified by 'fd'
- */
-rc_t CC KWrt_DefaultWriter ( void * self, const char * buffer, size_t bufsize, size_t * num_writ )
-{
-    size_t total;
-    size_t remaining;
-    ssize_t num_written;
-    const char * pbyte;
-    int handle;
-    rc_t rc;
-
-    handle = *(int*)self;
-    pbyte = buffer;
-    rc = 0;
-
-    total = 0;
-    for (remaining = bufsize; remaining > 0; remaining -= num_written)
-    {
-        num_written = write (handle, pbyte, remaining);
-        if (num_written < 0)
-        {
-            switch (errno)
-            {
-            case ENOSPC:
-                rc = RC ( rcApp, rcLog, rcWriting, rcStorage, rcExhausted );
-                break;
-            case EINTR:
-                num_written = 0;
-                break;
-            case EFBIG:
-                rc = RC ( rcApp, rcLog, rcWriting, rcFile, rcExcessive );
-                break;
-            case EIO:
-                rc = RC ( rcApp, rcLog, rcWriting, rcTransfer, rcUnknown );
-                break;
-            case EBADF:
-                rc = RC ( rcApp, rcLog, rcWriting, rcFileDesc, rcInvalid );
-                break;
-            case EINVAL:
-                rc = RC ( rcApp, rcLog, rcWriting, rcParam, rcInvalid );
-                break;
-            default:
-                rc = RC ( rcApp, rcLog, rcWriting, rcNoObj, rcUnknown );
-                break;
-            }
-            if (rc)
-                break;
-        }
-        else
-            total += num_written;
-    }
-    *num_writ = total;
-    return rc;
-}
-
-void print_int_fixup ( char * fmt, size_t * len, size_t max )
-{
-    /* all the Unix flavors support a real printf
-     * Only Windows does it "wrong".
-     * In windows we can't just return like this but instead:
-     *    save fmt[len-1]
-     *    replace 'j' with I64
-     *    replace 'z' or 't',  with 'I'
-     *    replace 'hh' with 'h'
-     *    append saved fmt[len-1] to its new place.
-     *
-     */
-    if (*len > 3)
-    {
-        if ((fmt[*len-3] == 'l') &&
-            (fmt[*len-2] == 'l'))
-        {
-            --*len;
-            fmt[*len-2] = 'j';
-            fmt[*len-1] = fmt[*len];
-            fmt[*len] = '\0';
-        }
-    }
-    else if (*len > 2)
-    {
-        /* -----
-         * replace an 'l' with a 'j'
-         * on 32 bit l is 32 bits and j is 64 bits
-         * on 64 bit l is 64 bits and j is 64 bits
-         * so we want the one that is the same on both
-         * we are not otherwise "fixing" the format for bad specifications
-         * just this ambiguous specification.
-         */
-        if (fmt[*len-2] == 'l')
-            fmt[*len-2] = 'j';
-    }
-    return;
-}
-
-void print_float_fixup ( char * fmt, size_t * len, size_t max )
-{
-    /* all the Unix flavors support a real printf
-     * Only Windows does it "wrong".
-     */
-    return;
-}
-
-void print_char_fixup ( char * fmt, size_t * len, size_t max )
-{
-    /* all the Unix flavors support a real printf
-     * Only Windows does it "wrong".
-     */
-    return;
-}
diff --git a/libs/klib/unpack.c b/libs/klib/unpack.c
deleted file mode 100644
index 73b343b..0000000
--- a/libs/klib/unpack.c
+++ /dev/null
@@ -1,833 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include <klib/pack.h>
-#include <klib/rc.h>
-#include <arch-impl.h>
-#include <sysalloc.h>
-
-#include <endian.h>
-#include <byteswap.h>
-#include <string.h>
-#include <assert.h>
-
-#if ! defined __LITTLE_ENDIAN && ! defined __BIG_ENDIAN
-#error "only little and big endian architectures are supported"
-#endif
-
-
-/*--------------------------------------------------------------------------
- * unpack
- */
-
-/* READ_PACKED
- *  macro to read source elements into register
- *  casts source pointer to appropriate type
- *  performs byte swap if necessary to ensure that
- *    elements are in reverse order
- */
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define READ_PACKED32( src, idx ) \
-    bswap_32 ( ( ( const uint32_t* ) ( src ) ) [ idx ] )
-#define READ_PACKED64( src, idx ) \
-    bswap_64 ( ( ( const uint64_t* ) ( src ) ) [ idx ] )
-#else
-#define READ_PACKED32( src, idx ) \
-    ( ( const uint32_t* ) ( src ) ) [ idx ]
-#define READ_PACKED64( src, idx ) \
-    ( ( const uint64_t* ) ( src ) ) [ idx ]
-#endif
-
-/* WRITE_UNPACKED
- *  macro to write destination elements from register
- *  casts destination pointer to appropriate type
- *  performs byte swap if necessary to ensure that
- *    elements are in original stream order
- */
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define WRITE_UNPACKED8( out, dst, idx ) \
-    ( ( uint64_t* ) ( dst ) ) [ idx ] = ( out )
-#else
-#define WRITE_UNPACKED8( out, dst, idx ) \
-    ( ( uint64_t* ) ( dst ) ) [ idx ] = bswap_64 ( out )
-#endif
-uint8_t unpack_8_from_2_arr[256][4]={
-{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,0,3},
-{0,0,1,0},{0,0,1,1},{0,0,1,2},{0,0,1,3},
-{0,0,2,0},{0,0,2,1},{0,0,2,2},{0,0,2,3},
-{0,0,3,0},{0,0,3,1},{0,0,3,2},{0,0,3,3},
-{0,1,0,0},{0,1,0,1},{0,1,0,2},{0,1,0,3},
-{0,1,1,0},{0,1,1,1},{0,1,1,2},{0,1,1,3},
-{0,1,2,0},{0,1,2,1},{0,1,2,2},{0,1,2,3},
-{0,1,3,0},{0,1,3,1},{0,1,3,2},{0,1,3,3},
-{0,2,0,0},{0,2,0,1},{0,2,0,2},{0,2,0,3},
-{0,2,1,0},{0,2,1,1},{0,2,1,2},{0,2,1,3},
-{0,2,2,0},{0,2,2,1},{0,2,2,2},{0,2,2,3},
-{0,2,3,0},{0,2,3,1},{0,2,3,2},{0,2,3,3},
-{0,3,0,0},{0,3,0,1},{0,3,0,2},{0,3,0,3},
-{0,3,1,0},{0,3,1,1},{0,3,1,2},{0,3,1,3},
-{0,3,2,0},{0,3,2,1},{0,3,2,2},{0,3,2,3},
-{0,3,3,0},{0,3,3,1},{0,3,3,2},{0,3,3,3},
-{1,0,0,0},{1,0,0,1},{1,0,0,2},{1,0,0,3},
-{1,0,1,0},{1,0,1,1},{1,0,1,2},{1,0,1,3},
-{1,0,2,0},{1,0,2,1},{1,0,2,2},{1,0,2,3},
-{1,0,3,0},{1,0,3,1},{1,0,3,2},{1,0,3,3},
-{1,1,0,0},{1,1,0,1},{1,1,0,2},{1,1,0,3},
-{1,1,1,0},{1,1,1,1},{1,1,1,2},{1,1,1,3},
-{1,1,2,0},{1,1,2,1},{1,1,2,2},{1,1,2,3},
-{1,1,3,0},{1,1,3,1},{1,1,3,2},{1,1,3,3},
-{1,2,0,0},{1,2,0,1},{1,2,0,2},{1,2,0,3},
-{1,2,1,0},{1,2,1,1},{1,2,1,2},{1,2,1,3},
-{1,2,2,0},{1,2,2,1},{1,2,2,2},{1,2,2,3},
-{1,2,3,0},{1,2,3,1},{1,2,3,2},{1,2,3,3},
-{1,3,0,0},{1,3,0,1},{1,3,0,2},{1,3,0,3},
-{1,3,1,0},{1,3,1,1},{1,3,1,2},{1,3,1,3},
-{1,3,2,0},{1,3,2,1},{1,3,2,2},{1,3,2,3},
-{1,3,3,0},{1,3,3,1},{1,3,3,2},{1,3,3,3},
-{2,0,0,0},{2,0,0,1},{2,0,0,2},{2,0,0,3},
-{2,0,1,0},{2,0,1,1},{2,0,1,2},{2,0,1,3},
-{2,0,2,0},{2,0,2,1},{2,0,2,2},{2,0,2,3},
-{2,0,3,0},{2,0,3,1},{2,0,3,2},{2,0,3,3},
-{2,1,0,0},{2,1,0,1},{2,1,0,2},{2,1,0,3},
-{2,1,1,0},{2,1,1,1},{2,1,1,2},{2,1,1,3},
-{2,1,2,0},{2,1,2,1},{2,1,2,2},{2,1,2,3},
-{2,1,3,0},{2,1,3,1},{2,1,3,2},{2,1,3,3},
-{2,2,0,0},{2,2,0,1},{2,2,0,2},{2,2,0,3},
-{2,2,1,0},{2,2,1,1},{2,2,1,2},{2,2,1,3},
-{2,2,2,0},{2,2,2,1},{2,2,2,2},{2,2,2,3},
-{2,2,3,0},{2,2,3,1},{2,2,3,2},{2,2,3,3},
-{2,3,0,0},{2,3,0,1},{2,3,0,2},{2,3,0,3},
-{2,3,1,0},{2,3,1,1},{2,3,1,2},{2,3,1,3},
-{2,3,2,0},{2,3,2,1},{2,3,2,2},{2,3,2,3},
-{2,3,3,0},{2,3,3,1},{2,3,3,2},{2,3,3,3},
-{3,0,0,0},{3,0,0,1},{3,0,0,2},{3,0,0,3},
-{3,0,1,0},{3,0,1,1},{3,0,1,2},{3,0,1,3},
-{3,0,2,0},{3,0,2,1},{3,0,2,2},{3,0,2,3},
-{3,0,3,0},{3,0,3,1},{3,0,3,2},{3,0,3,3},
-{3,1,0,0},{3,1,0,1},{3,1,0,2},{3,1,0,3},
-{3,1,1,0},{3,1,1,1},{3,1,1,2},{3,1,1,3},
-{3,1,2,0},{3,1,2,1},{3,1,2,2},{3,1,2,3},
-{3,1,3,0},{3,1,3,1},{3,1,3,2},{3,1,3,3},
-{3,2,0,0},{3,2,0,1},{3,2,0,2},{3,2,0,3},
-{3,2,1,0},{3,2,1,1},{3,2,1,2},{3,2,1,3},
-{3,2,2,0},{3,2,2,1},{3,2,2,2},{3,2,2,3},
-{3,2,3,0},{3,2,3,1},{3,2,3,2},{3,2,3,3},
-{3,3,0,0},{3,3,0,1},{3,3,0,2},{3,3,0,3},
-{3,3,1,0},{3,3,1,1},{3,3,1,2},{3,3,1,3},
-{3,3,2,0},{3,3,2,1},{3,3,2,2},{3,3,2,3},
-{3,3,3,0},{3,3,3,1},{3,3,3,2},{3,3,3,3},
-};
-uint8_t unpack_8_from_1_arr[256][8]={
-{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,1},{0,0,0,0,0,0,1,0},{0,0,0,0,0,0,1,1},
-{0,0,0,0,0,1,0,0},{0,0,0,0,0,1,0,1},{0,0,0,0,0,1,1,0},{0,0,0,0,0,1,1,1},
-{0,0,0,0,1,0,0,0},{0,0,0,0,1,0,0,1},{0,0,0,0,1,0,1,0},{0,0,0,0,1,0,1,1},
-{0,0,0,0,1,1,0,0},{0,0,0,0,1,1,0,1},{0,0,0,0,1,1,1,0},{0,0,0,0,1,1,1,1},
-{0,0,0,1,0,0,0,0},{0,0,0,1,0,0,0,1},{0,0,0,1,0,0,1,0},{0,0,0,1,0,0,1,1},
-{0,0,0,1,0,1,0,0},{0,0,0,1,0,1,0,1},{0,0,0,1,0,1,1,0},{0,0,0,1,0,1,1,1},
-{0,0,0,1,1,0,0,0},{0,0,0,1,1,0,0,1},{0,0,0,1,1,0,1,0},{0,0,0,1,1,0,1,1},
-{0,0,0,1,1,1,0,0},{0,0,0,1,1,1,0,1},{0,0,0,1,1,1,1,0},{0,0,0,1,1,1,1,1},
-{0,0,1,0,0,0,0,0},{0,0,1,0,0,0,0,1},{0,0,1,0,0,0,1,0},{0,0,1,0,0,0,1,1},
-{0,0,1,0,0,1,0,0},{0,0,1,0,0,1,0,1},{0,0,1,0,0,1,1,0},{0,0,1,0,0,1,1,1},
-{0,0,1,0,1,0,0,0},{0,0,1,0,1,0,0,1},{0,0,1,0,1,0,1,0},{0,0,1,0,1,0,1,1},
-{0,0,1,0,1,1,0,0},{0,0,1,0,1,1,0,1},{0,0,1,0,1,1,1,0},{0,0,1,0,1,1,1,1},
-{0,0,1,1,0,0,0,0},{0,0,1,1,0,0,0,1},{0,0,1,1,0,0,1,0},{0,0,1,1,0,0,1,1},
-{0,0,1,1,0,1,0,0},{0,0,1,1,0,1,0,1},{0,0,1,1,0,1,1,0},{0,0,1,1,0,1,1,1},
-{0,0,1,1,1,0,0,0},{0,0,1,1,1,0,0,1},{0,0,1,1,1,0,1,0},{0,0,1,1,1,0,1,1},
-{0,0,1,1,1,1,0,0},{0,0,1,1,1,1,0,1},{0,0,1,1,1,1,1,0},{0,0,1,1,1,1,1,1},
-{0,1,0,0,0,0,0,0},{0,1,0,0,0,0,0,1},{0,1,0,0,0,0,1,0},{0,1,0,0,0,0,1,1},
-{0,1,0,0,0,1,0,0},{0,1,0,0,0,1,0,1},{0,1,0,0,0,1,1,0},{0,1,0,0,0,1,1,1},
-{0,1,0,0,1,0,0,0},{0,1,0,0,1,0,0,1},{0,1,0,0,1,0,1,0},{0,1,0,0,1,0,1,1},
-{0,1,0,0,1,1,0,0},{0,1,0,0,1,1,0,1},{0,1,0,0,1,1,1,0},{0,1,0,0,1,1,1,1},
-{0,1,0,1,0,0,0,0},{0,1,0,1,0,0,0,1},{0,1,0,1,0,0,1,0},{0,1,0,1,0,0,1,1},
-{0,1,0,1,0,1,0,0},{0,1,0,1,0,1,0,1},{0,1,0,1,0,1,1,0},{0,1,0,1,0,1,1,1},
-{0,1,0,1,1,0,0,0},{0,1,0,1,1,0,0,1},{0,1,0,1,1,0,1,0},{0,1,0,1,1,0,1,1},
-{0,1,0,1,1,1,0,0},{0,1,0,1,1,1,0,1},{0,1,0,1,1,1,1,0},{0,1,0,1,1,1,1,1},
-{0,1,1,0,0,0,0,0},{0,1,1,0,0,0,0,1},{0,1,1,0,0,0,1,0},{0,1,1,0,0,0,1,1},
-{0,1,1,0,0,1,0,0},{0,1,1,0,0,1,0,1},{0,1,1,0,0,1,1,0},{0,1,1,0,0,1,1,1},
-{0,1,1,0,1,0,0,0},{0,1,1,0,1,0,0,1},{0,1,1,0,1,0,1,0},{0,1,1,0,1,0,1,1},
-{0,1,1,0,1,1,0,0},{0,1,1,0,1,1,0,1},{0,1,1,0,1,1,1,0},{0,1,1,0,1,1,1,1},
-{0,1,1,1,0,0,0,0},{0,1,1,1,0,0,0,1},{0,1,1,1,0,0,1,0},{0,1,1,1,0,0,1,1},
-{0,1,1,1,0,1,0,0},{0,1,1,1,0,1,0,1},{0,1,1,1,0,1,1,0},{0,1,1,1,0,1,1,1},
-{0,1,1,1,1,0,0,0},{0,1,1,1,1,0,0,1},{0,1,1,1,1,0,1,0},{0,1,1,1,1,0,1,1},
-{0,1,1,1,1,1,0,0},{0,1,1,1,1,1,0,1},{0,1,1,1,1,1,1,0},{0,1,1,1,1,1,1,1},
-{1,0,0,0,0,0,0,0},{1,0,0,0,0,0,0,1},{1,0,0,0,0,0,1,0},{1,0,0,0,0,0,1,1},
-{1,0,0,0,0,1,0,0},{1,0,0,0,0,1,0,1},{1,0,0,0,0,1,1,0},{1,0,0,0,0,1,1,1},
-{1,0,0,0,1,0,0,0},{1,0,0,0,1,0,0,1},{1,0,0,0,1,0,1,0},{1,0,0,0,1,0,1,1},
-{1,0,0,0,1,1,0,0},{1,0,0,0,1,1,0,1},{1,0,0,0,1,1,1,0},{1,0,0,0,1,1,1,1},
-{1,0,0,1,0,0,0,0},{1,0,0,1,0,0,0,1},{1,0,0,1,0,0,1,0},{1,0,0,1,0,0,1,1},
-{1,0,0,1,0,1,0,0},{1,0,0,1,0,1,0,1},{1,0,0,1,0,1,1,0},{1,0,0,1,0,1,1,1},
-{1,0,0,1,1,0,0,0},{1,0,0,1,1,0,0,1},{1,0,0,1,1,0,1,0},{1,0,0,1,1,0,1,1},
-{1,0,0,1,1,1,0,0},{1,0,0,1,1,1,0,1},{1,0,0,1,1,1,1,0},{1,0,0,1,1,1,1,1},
-{1,0,1,0,0,0,0,0},{1,0,1,0,0,0,0,1},{1,0,1,0,0,0,1,0},{1,0,1,0,0,0,1,1},
-{1,0,1,0,0,1,0,0},{1,0,1,0,0,1,0,1},{1,0,1,0,0,1,1,0},{1,0,1,0,0,1,1,1},
-{1,0,1,0,1,0,0,0},{1,0,1,0,1,0,0,1},{1,0,1,0,1,0,1,0},{1,0,1,0,1,0,1,1},
-{1,0,1,0,1,1,0,0},{1,0,1,0,1,1,0,1},{1,0,1,0,1,1,1,0},{1,0,1,0,1,1,1,1},
-{1,0,1,1,0,0,0,0},{1,0,1,1,0,0,0,1},{1,0,1,1,0,0,1,0},{1,0,1,1,0,0,1,1},
-{1,0,1,1,0,1,0,0},{1,0,1,1,0,1,0,1},{1,0,1,1,0,1,1,0},{1,0,1,1,0,1,1,1},
-{1,0,1,1,1,0,0,0},{1,0,1,1,1,0,0,1},{1,0,1,1,1,0,1,0},{1,0,1,1,1,0,1,1},
-{1,0,1,1,1,1,0,0},{1,0,1,1,1,1,0,1},{1,0,1,1,1,1,1,0},{1,0,1,1,1,1,1,1},
-{1,1,0,0,0,0,0,0},{1,1,0,0,0,0,0,1},{1,1,0,0,0,0,1,0},{1,1,0,0,0,0,1,1},
-{1,1,0,0,0,1,0,0},{1,1,0,0,0,1,0,1},{1,1,0,0,0,1,1,0},{1,1,0,0,0,1,1,1},
-{1,1,0,0,1,0,0,0},{1,1,0,0,1,0,0,1},{1,1,0,0,1,0,1,0},{1,1,0,0,1,0,1,1},
-{1,1,0,0,1,1,0,0},{1,1,0,0,1,1,0,1},{1,1,0,0,1,1,1,0},{1,1,0,0,1,1,1,1},
-{1,1,0,1,0,0,0,0},{1,1,0,1,0,0,0,1},{1,1,0,1,0,0,1,0},{1,1,0,1,0,0,1,1},
-{1,1,0,1,0,1,0,0},{1,1,0,1,0,1,0,1},{1,1,0,1,0,1,1,0},{1,1,0,1,0,1,1,1},
-{1,1,0,1,1,0,0,0},{1,1,0,1,1,0,0,1},{1,1,0,1,1,0,1,0},{1,1,0,1,1,0,1,1},
-{1,1,0,1,1,1,0,0},{1,1,0,1,1,1,0,1},{1,1,0,1,1,1,1,0},{1,1,0,1,1,1,1,1},
-{1,1,1,0,0,0,0,0},{1,1,1,0,0,0,0,1},{1,1,1,0,0,0,1,0},{1,1,1,0,0,0,1,1},
-{1,1,1,0,0,1,0,0},{1,1,1,0,0,1,0,1},{1,1,1,0,0,1,1,0},{1,1,1,0,0,1,1,1},
-{1,1,1,0,1,0,0,0},{1,1,1,0,1,0,0,1},{1,1,1,0,1,0,1,0},{1,1,1,0,1,0,1,1},
-{1,1,1,0,1,1,0,0},{1,1,1,0,1,1,0,1},{1,1,1,0,1,1,1,0},{1,1,1,0,1,1,1,1},
-{1,1,1,1,0,0,0,0},{1,1,1,1,0,0,0,1},{1,1,1,1,0,0,1,0},{1,1,1,1,0,0,1,1},
-{1,1,1,1,0,1,0,0},{1,1,1,1,0,1,0,1},{1,1,1,1,0,1,1,0},{1,1,1,1,0,1,1,1},
-{1,1,1,1,1,0,0,0},{1,1,1,1,1,0,0,1},{1,1,1,1,1,0,1,0},{1,1,1,1,1,0,1,1},
-{1,1,1,1,1,1,0,0},{1,1,1,1,1,1,0,1},{1,1,1,1,1,1,1,0},{1,1,1,1,1,1,1,1},
-};
-
-static
-void CC Unpack8From2(uint8_t *dst,const uint8_t *src,int32_t count)
-{
-	if(count > 0){
-		int i;
-		for(i=0;i<count/4;i++,dst+=4,src++){
-			memcpy(dst,unpack_8_from_2_arr[*src],4);
-		}
-		for(i=0;i< (count&3);i++){
-			dst[i] = unpack_8_from_2_arr[*src][i];
-		}
-	}
-}
-static
-void CC Unpack8From1(uint8_t *dst,const uint8_t *src,int32_t count)
-{
-	if(count > 0){
-		int i;
-		for(i=0;i<count/8;i++,dst+=8,src++){
-			memcpy(dst,unpack_8_from_1_arr[*src],8);
-		}
-		for(i=0;i< (count&7);i++){
-			dst[i] = unpack_8_from_1_arr[*src][i];
-		}
-	}
-}
-
-
-
-
-/* Unpack8
- */
-static
-void CC Unpack8 ( uint32_t packed, uint32_t count, void *dst,
-    const void *src, bitsz_t src_off, bitsz_t ssize )
-{
-    uint64_t acc;
-    uint64_t out;
-    uint32_t abits;
-    uint64_t src_mask;
-    /* keep track of trailing bits */
-    uint32_t discard = (uint32_t)( ( 0 - ( ssize += src_off ) ) & 7 );
-
-
-    if(src_off == 0){
-	switch(packed){
-	 case 1:
-		Unpack8From1(dst,src,count);
-		return;
-	 case 2:
-		Unpack8From2(dst,src,count);
-		return;
-	}
-    }
-	
-
-
-    /* convert to bytes */
-    ssize = ( ssize + 7 ) >> 3;
-
-    /* first, get any stray source bytes */
-    for ( abits = 0, acc = 0; ( ssize & 3 ) != 0; abits += 8 )
-    {
-        acc <<= 8;
-        acc |= ( ( const uint8_t* ) src ) [ -- ssize ];
-    }
-
-    /* only reading 4 bytes at a time now */
-    ssize >>= 2;
-
-    /* if source size was even multiple of 4 bytes */
-    if ( abits == 0 )
-    {
-        assert ( ssize != 0 );
-        acc = READ_PACKED32 ( src, -- ssize );
-        abits = 32;
-    }
-    /* bytes were accumulated in backward order */
-    else if ( abits != 8 )
-    {
-        acc = bswap_32 ( ( uint32_t ) ( acc << ( 32 - abits ) ) );
-    }
-
-    /* discard alignment bits */
-    if ( discard != 0 )
-    {
-        acc >>= discard;
-        abits -= discard;
-    }
-
-    /* create source mask */
-    src_mask = ( 1 << packed ) - 1;
-
-    /* write stray output bytes */
-    for ( ; ( count & 7 ) != 0; abits -= packed, acc >>= packed )
-    {
-        /* make sure there are enough source bits */
-        if ( abits < packed )
-        {
-            assert ( ssize != 0 );
-            acc |= ( uint64_t ) READ_PACKED32 ( src, -- ssize ) << abits;
-            abits += 32;
-            assert ( abits >= packed );
-        }
-
-        /* write directly to destination */
-        ( ( uint8_t* ) dst ) [ -- count ] = ( uint8_t ) ( acc & src_mask );
-    }
-
-    /* accumulate into unpack register */
-    for ( count >>= 3; count != 0; abits -= packed, acc >>= packed )
-    {
-        /* bring in enough source bits */
-        if ( abits < packed )
-        {
-            assert ( ssize != 0 );
-            acc |= ( uint64_t ) READ_PACKED32 ( src, -- ssize ) << abits;
-            abits += 32;
-            assert ( abits >= packed );
-        }
-
-        /* get byte in reverse order */
-        out = acc & src_mask;
-
-        /* drop packed bits */
-        abits -= packed;
-        acc >>= packed;
-
-        /* same for remaining output bytes */
-        out <<= 8;
-        if ( abits < packed )
-        {
-            assert ( ssize != 0 );
-            acc |= ( uint64_t ) READ_PACKED32 ( src, -- ssize ) << abits;
-            abits += 32;
-            assert ( abits >= packed );
-        }
-        out |= acc & src_mask;
-        abits -= packed;
-        acc >>= packed;
-
-        out <<= 8;
-        if ( abits < packed )
-        {
-            assert ( ssize != 0 );
-            acc |= ( uint64_t ) READ_PACKED32 ( src, -- ssize ) << abits;
-            abits += 32;
-            assert ( abits >= packed );
-        }
-        out |= acc & src_mask;
-        abits -= packed;
-        acc >>= packed;
-
-        out <<= 8;
-        if ( abits < packed )
-        {
-            assert ( ssize != 0 );
-            acc |= ( uint64_t ) READ_PACKED32 ( src, -- ssize ) << abits;
-            abits += 32;
-            assert ( abits >= packed );
-        }
-        out |= acc & src_mask;
-        abits -= packed;
-        acc >>= packed;
-
-        out <<= 8;
-        if ( abits < packed )
-        {
-            assert ( ssize != 0 );
-            acc |= ( uint64_t ) READ_PACKED32 ( src, -- ssize ) << abits;
-            abits += 32;
-            assert ( abits >= packed );
-        }
-        out |= acc & src_mask;
-        abits -= packed;
-        acc >>= packed;
-
-        out <<= 8;
-        if ( abits < packed )
-        {
-            assert ( ssize != 0 );
-            acc |= ( uint64_t ) READ_PACKED32 ( src, -- ssize ) << abits;
-            abits += 32;
-            assert ( abits >= packed );
-        }
-        out |= acc & src_mask;
-        abits -= packed;
-        acc >>= packed;
-
-        out <<= 8;
-        if ( abits < packed )
-        {
-            assert ( ssize != 0 );
-            acc |= ( uint64_t ) READ_PACKED32 ( src, -- ssize ) << abits;
-            abits += 32;
-            assert ( abits >= packed );
-        }
-        out |= acc & src_mask;
-        abits -= packed;
-        acc >>= packed;
-
-        out <<= 8;
-        if ( abits < packed )
-        {
-            assert ( ssize != 0 );
-            acc |= ( uint64_t ) READ_PACKED32 ( src, -- ssize ) << abits;
-            abits += 32;
-            assert ( abits >= packed );
-        }
-        out |= acc & src_mask;
-
-        /* write output */
-        WRITE_UNPACKED8 ( out, dst, -- count );
-    }
-
-    /* should have written everything */
-    assert ( abits == 0 );
-    assert ( ssize == 0 );
-}
-
-
-/* Unpack16
- */
-static
-void CC Unpack16 ( uint32_t packed, uint32_t count, void *dst,
-    const void *src, bitsz_t src_off, bitsz_t ssize )
-{
-    uint64_t acc;
-    uint32_t abits;
-
-    uint64_t src_mask;
-    uint32_t discard = (uint32_t)( ( 0 - ( ssize += src_off ) ) & 7 );
-
-    /* convert to bytes */
-    ssize = ( ssize + 7 ) >> 3;
-
-    /* first, get any stray source bytes */
-    for ( abits = 0, acc = 0; ( ssize & 3 ) != 0; abits += 8 )
-    {
-        acc <<= 8;
-        acc |= ( ( const uint8_t* ) src ) [ -- ssize ];
-    }
-
-    /* only reading 4 bytes at a time now */
-    ssize >>= 2;
-
-    /* if source size was even multiple of 4 bytes */
-    if ( abits == 0 )
-    {
-        assert ( ssize != 0 );
-        acc = READ_PACKED32 ( src, -- ssize );
-        abits = 32;
-    }
-    /* bytes were accumulated in backward order */
-    else if ( abits != 8 )
-    {
-        acc = bswap_32 ( ( uint32_t ) ( acc << ( 32 - abits ) ) );
-    }
-
-
-    /* discard alignment bits */
-    if ( discard != 0 )
-    {
-        assert ( discard < 8 );
-        acc >>= discard;
-        abits -= discard;
-    }
-
-    /* create write mask */
-    src_mask = ( 1 << packed ) - 1;
-
-    /* write output */
-    for ( ; count != 0; abits -= packed, acc >>= packed )
-    {
-        if ( abits < packed )
-        {
-            assert ( ssize != 0 );
-            acc |= ( uint64_t ) READ_PACKED32 ( src, -- ssize ) << abits;
-            abits += 32;
-            assert ( abits >= packed );
-        }
-
-        ( ( uint16_t* ) dst ) [ -- count ] = ( uint16_t ) ( acc & src_mask );
-    }
-
-    /* should have written everything */
-    assert ( abits == 0 );
-    assert ( ssize == 0 );
-}
-
-
-/* Unpack32
- */
-static
-void CC Unpack32 ( uint32_t packed, uint32_t count, void *dst,
-    const void *src, bitsz_t src_off, bitsz_t ssize )
-{
-    uint64_t acc;
-    uint32_t abits;
-
-    uint64_t src_mask;
-    uint32_t discard = (uint32_t)( ( 0 - ( ssize += src_off ) ) & 7 );
-
-    /* convert to bytes */
-    ssize = ( ssize + 7 ) >> 3;
-
-    /* first, get any stray source bytes */
-    for ( abits = 0, acc = 0; ( ssize & 3 ) != 0; abits += 8 )
-    {
-        acc <<= 8;
-        acc |= ( ( const uint8_t* ) src ) [ -- ssize ];
-    }
-
-    /* only reading 4 bytes at a time now */
-    ssize >>= 2;
-
-    /* if source size was even multiple of 4 bytes */
-    if ( abits == 0 )
-    {
-        assert ( ssize != 0 );
-        acc = READ_PACKED32 ( src, -- ssize );
-        abits = 32;
-    }
-    /* bytes were accumulated in backward order */
-    else if ( abits != 8 )
-    {
-        acc = bswap_32 ( ( uint32_t ) ( acc << ( 32 - abits ) ) );
-    }
-
-    /* discard alignment bits */
-    if ( discard != 0 )
-    {
-        assert ( discard < 8 );
-        acc >>= discard;
-        abits -= discard;
-    }
-
-    /* create write mask */
-    src_mask = ( 1 << packed ) - 1;
-
-    /* write output */
-    for ( ; count != 0; abits -= packed, acc >>= packed )
-    {
-        if ( abits < packed )
-        {
-            assert ( ssize != 0 );
-            acc |= ( uint64_t ) READ_PACKED32 ( src, -- ssize ) << abits;
-            abits += 32;
-            assert ( abits >= packed );
-        }
-
-        ( ( uint32_t* ) dst ) [ -- count ] = ( uint32_t ) ( acc & src_mask );
-    }
-
-    /* should have written everything */
-    assert ( abits == 0 );
-    assert ( ssize == 0 );
-}
-
-
-/* Unpack64a
- *  packed size <= 32
- */
-static
-void CC Unpack64a ( uint32_t packed, uint32_t count, void *dst,
-    const void *src, bitsz_t src_off, bitsz_t ssize )
-{
-    uint64_t acc;
-    uint32_t abits;
-
-    uint64_t src_mask;
-    uint32_t discard = (uint32_t)( ( 0 - ( ssize += src_off ) ) & 7 );
-
-    /* convert to bytes */
-    ssize = ( ssize + 7 ) >> 3;
-
-    /* first, get any stray source bytes */
-    for ( abits = 0, acc = 0; ( ssize & 3 ) != 0; abits += 8 )
-    {
-        acc <<= 8;
-        acc |= ( ( const uint8_t* ) src ) [ -- ssize ];
-    }
-
-    /* only reading 4 bytes at a time now */
-    ssize >>= 2;
-
-    /* if source size was even multiple of 4 bytes */
-    if ( abits == 0 )
-    {
-        assert ( ssize != 0 );
-        acc = READ_PACKED32 ( src, -- ssize );
-        abits = 32;
-    }
-    /* bytes were accumulated in backward order */
-    else if ( abits != 8 )
-    {
-        acc = bswap_32 ( ( uint32_t ) ( acc << ( 32 - abits ) ) );
-    }
-
-    /* discard alignment bits */
-    if ( discard != 0 )
-    {
-        assert ( discard < 8 );
-        acc >>= discard;
-        abits -= discard;
-    }
-
-    /* create write mask */
-    src_mask = ( 1 << packed ) - 1;
-
-    /* write output */
-    for ( ; count != 0; abits -= packed, acc >>= packed )
-    {
-        if ( abits < packed )
-        {
-            assert ( ssize != 0 );
-            acc |= ( uint64_t ) READ_PACKED32 ( src, -- ssize ) << abits;
-            abits += 32;
-            assert ( abits >= packed );
-        }
-
-        ( ( uint64_t* ) dst ) [ -- count ] = acc & src_mask;
-    }
-
-    /* should have written everything */
-    assert ( abits == 0 );
-    assert ( ssize == 0 );
-}
-
-
-/* Unpack64b
- *  packed size > 32
- */
-static
-void CC Unpack64b ( uint32_t packed, uint32_t count, void *dst,
-    const void *src, bitsz_t src_off, bitsz_t ssize )
-{
-    uint128_t acc;
-    uint32_t abits;
-
-    uint64_t src_mask;
-    uint32_t discard = (uint32_t)( ( 0 - ( ssize += src_off ) ) & 7 );
-
-    /* convert to bytes */
-    ssize = ( ssize + 7 ) >> 3;
-
-    /* probably still don't support native 128 bit */
-    uint128_sethi ( & acc, 0 );
-    uint128_setlo ( & acc, 0 );
-
-    /* first, get any stray source bytes */
-    for ( abits = 0; ( ssize & 7 ) != 0; abits += 8 )
-    {
-        uint128_shl ( & acc, 8 );
-        uint128_orlo ( & acc, ( ( const uint8_t* ) src ) [ -- ssize ] );
-    }
-
-    /* only reading 8 bytes at a time now */
-    ssize >>= 3;
-
-    /* if source size was even multiple of 4 bytes */
-    if ( abits == 0 )
-    {
-        assert ( ssize != 0 );
-        uint128_setlo ( & acc, READ_PACKED64 ( src, -- ssize ) );
-        abits = 64;
-    }
-    /* bytes were accumulated in backward order */
-    else if ( abits != 8 )
-    {
-        uint128_setlo ( & acc, bswap_64 ( uint128_lo ( & acc ) << ( 64 - abits ) ) );
-    }
-
-    /* discard alignment bits */
-    if ( discard != 0 )
-    {
-        assert ( discard < 8 );
-        uint128_shr ( & acc, discard );
-        abits -= discard;
-    }
-
-    /* create write mask */
-    src_mask = ( ( uint64_t ) 1U << packed ) - 1;
-
-    /* write output */
-    for ( ; count != 0; abits -= packed, uint128_shr ( & acc, packed ) )
-    {
-        if ( abits < packed )
-        {
-            uint128_t in;
-            assert ( ssize != 0 );
-            uint128_sethi ( & in, 0 );
-            uint128_setlo ( & in, READ_PACKED64 ( src, -- ssize ) );
-            uint128_shl ( & in, abits );
-            uint128_or ( & acc, & in );
-            abits += 64;
-            assert ( abits >= packed );
-        }
-
-        ( ( uint64_t* ) dst ) [ -- count ] = uint128_lo ( & acc ) & src_mask;
-    }
-
-    /* should have written everything */
-    assert ( abits == 0 );
-    assert ( ssize == 0 );
-}
-
-
-/* Unpack
- *  accepts a series of packed source bits
- *  produces a series of unpacked destination bits by left-padding zeros
- *
- *  "packed" [ IN ] - packed element size in bits
- *
- *  "unpacked [ IN ] - original element size in bits
- *  must be >= "packed" and
- *  must be in 2^^[3..6], i.e. { 8, 16, 32, 64 }
- *
- *  "src" [ IN ] and "src_off" [ IN ] - source buffer
- *  bit address
- *
- *  "ssize" [ IN ] - number of bits in "src", not including "src_off"
- *
- *  "consumed" [ OUT, NULL OKAY ] - number of source bits
- *  consumed. if NULL, then all source bits MUST be consumed
- *  or an error will be generated.
- *
- *  "dst" [ OUT ] and "dsize" [ IN ] - destination buffer
- *  where size is given in bytes
- *
- *  "usize" [ OUT ] - resultant unpacked size in bytes
- *
- * NB - "src" and "dst" may have same address since
- *  the implementation unpacks from right to left, smaller to larger
- */
-LIB_EXPORT rc_t CC Unpack ( uint32_t packed, uint32_t unpacked,
-    const void *src, bitsz_t src_off, bitsz_t ssize, bitsz_t *consumed,
-    void *dst, size_t dsize, size_t *usize )
-{
-    uint32_t count;
-
-    /* prepare for failure */
-    if ( consumed != NULL )
-        * consumed = 0;
-
-    /* validate output param */
-    if ( usize == NULL )
-        return RC ( rcXF, rcBuffer, rcUnpacking, rcParam, rcNull );
-    * usize = 0;
-
-    /* require power of 2 with value between 8 and 64 */
-    if ( ( ( unpacked - 1 ) & unpacked ) != 0 ||
-         unpacked < 8 || unpacked > 64 )
-        return RC ( rcXF, rcBuffer, rcUnpacking, rcParam, rcInvalid );
-
-    /* validate remaining params */
-    if ( unpacked < packed || packed == 0 )
-        return RC ( rcXF, rcBuffer, rcUnpacking, rcParam, rcInvalid );
-
-    if ( ssize == 0 )
-        return 0;
-
-    if ( src == NULL )
-        return RC ( rcXF, rcBuffer, rcUnpacking, rcParam, rcNull );
-
-    src = & ( ( const char* ) src ) [ src_off >> 3 ];
-    src_off &= 7;
-
-    /* required destination buffer size */
-    count = ( uint32_t ) ( ssize / packed );
-    if ( count == 0 )
-        return 0;
-    * usize = ( (size_t)count * unpacked ) >> 3;
-
-    if ( dsize < * usize )
-    {
-        if ( consumed == NULL )
-            return RC ( rcXF, rcBuffer, rcUnpacking, rcBuffer, rcInsufficient );
-
-        count = (uint32_t)( dsize / ( unpacked >> 3 ) );
-        ssize = (size_t)count * packed;
-        * usize = ( (size_t)count * unpacked ) >> 3;
-    }
-
-    if ( dst == NULL )
-    {
-        * usize = 0;
-        return RC ( rcXF, rcBuffer, rcUnpacking, rcParam, rcNull );
-    }
-
-    /* all parameters are validated */
-    if ( unpacked == 8 && packed == 8 && src_off == 0 )
-    {
-        if ( ( const void* ) dst != src )
-            memcpy ( dst, src, ssize >> 3 );
-        return 0;
-    }
-
-    /* TBD - enable unpacking from offsets */
-    if ( src_off != 0 )
-        return RC ( rcXF, rcBuffer, rcUnpacking, rcOffset, rcUnsupported );
-
-    switch ( unpacked )
-    {
-    case 8:
-        Unpack8 ( packed, count, dst, src, src_off, ssize );
-        break;
-    case 16:
-        Unpack16 ( packed, count, dst, src, src_off, ssize );
-        break;
-    case 32:
-        Unpack32 ( packed, count, dst, src, src_off, ssize );
-        break;
-    case 64:
-        if ( packed > 32 )
-            Unpack64b ( packed, count, dst, src, src_off, ssize );
-        else
-            Unpack64a ( packed, count, dst, src, src_off, ssize );
-        break;
-    }
-
-    return 0;
-}
diff --git a/libs/klib/utf8.c b/libs/klib/utf8.c
deleted file mode 100644
index 656a50b..0000000
--- a/libs/klib/utf8.c
+++ /dev/null
@@ -1,836 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include <klib/text.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-#include <wctype.h>
-
-/*--------------------------------------------------------------------------
- * raw text strings
- */
-
-/* string_len
- *  length of string in characters
- */
-LIB_EXPORT uint32_t CC string_len ( const char *str, size_t size )
-{
-    const char *end;
-    uint32_t len = 0;
-
-    assert ( str != NULL );
-    end = str + size;
-
-    while ( str < end )
-    {
-        int c;
-
-        while ( str [ 0 ] > 0 )
-        {
-            ++ len;
-            if ( ++ str == end )
-                return len;
-        }
-
-        c = str [ 0 ];
-        if ( str [ 0 ] == 0 )
-            break;
-	
-        c = ~ c;
-        if ( c >= 0x40 )
-            break;
-	
-        if ( c >= 0x20 )
-            str += 2;
-        else if ( c >= 0x10 )
-            str += 3;
-        else if ( c >= 0x08 )
-            str += 4;
-        else if ( c >= 0x04 )
-            str += 5;
-        else if ( c >= 0x02 )
-            str += 6;
-        else
-            break;
-	
-        ++ len;
-    }
-    return len;
-}
-
-/* string_measure
- *  measures length of string in both characters and bytes
- */
-LIB_EXPORT uint32_t CC string_measure ( const char *str, size_t *size )
-{
-    const char *begin;
-    uint32_t len = 0;
-
-    assert ( str != NULL );
-
-    begin = str;
-
-    while ( 1 )
-    {
-        int c;
-
-        while ( str [ 0 ] > 0 )
-        {
-            ++ len;
-            ++ str;
-        }
-
-        c = str [ 0 ];
-        if ( str [ 0 ] == 0 )
-            break;
-	
-        c = ~ c;
-        if ( c >= 0x40 )
-            break;
-	
-        if ( c >= 0x20 )
-            str += 2;
-        else if ( c >= 0x10 )
-            str += 3;
-        else if ( c >= 0x08 )
-            str += 4;
-        else if ( c >= 0x04 )
-            str += 5;
-        else if ( c >= 0x02 )
-            str += 6;
-        else
-            break;
-	
-        ++ len;
-    }
-
-    if ( size != NULL )
-        * size = ( size_t ) ( str - begin );
-    return len;
-}
-
-/* string_copy
- *  copies whole character text into a buffer
- *  terminates with null byte if possible
- *  returns the number of bytes copied
- */
-LIB_EXPORT size_t CC string_copy ( char *dst, size_t dst_size, const char *src, size_t src_size )
-{
-    const char *send;
-    char *dend, *begin;
-
-    assert ( dst != NULL && src != NULL );
-
-    if ( dst_size < src_size )
-        src_size = dst_size;
-
-    begin = dst;
-    dend = dst + dst_size;
-    send = src + src_size;
-
-    while ( src < send )
-    {
-        uint32_t ch;
-
-        /* get a complete source character */
-        int len = utf8_utf32 ( & ch, src, send );
-        if ( len <= 0 )
-            break;
-        src += len;
-
-        /* write it to the destination */
-        len = utf32_utf8 ( dst, dend, ch );
-        if ( len <= 0 )
-            break;
-        dst += len;
-    }
-
-    if ( dst < dend )
-        * dst = 0;
-
-    return ( size_t ) ( dst - begin );
-}
-
-/* string_copy_measure
- *  copies whole character text into a buffer
- *  terminates with null byte if possible
- *  returns the number of bytes copied
- */
-LIB_EXPORT size_t CC string_copy_measure ( char *dst, size_t dst_size, const char *src )
-{
-    char *dend, *begin;
-
-    assert ( dst != NULL && src != NULL );
-
-    begin = dst;
-    dend = dst + dst_size;
-
-    while ( dst < dend && src [ 0 ] != 0 )
-    {
-        uint32_t ch;
-
-        /* get a complete source character */
-        int len = utf8_utf32 ( & ch, src, src + 6 );
-        if ( len <= 0 )
-            break;
-        src += len;
-
-        /* write it to the destination */
-        len = utf32_utf8 ( dst, dend, ch );
-        if ( len <= 0 )
-            break;
-        dst += len;
-    }
-
-    if ( dst < dend )
-        * dst = 0;
-
-    return ( size_t ) ( dst - begin );
-}
-
-/* tolower_copy
- *  copies whole character text in lower-case
- *  terminates with null byte if possible
- *  returns the number of bytes copied
- */
-LIB_EXPORT size_t CC tolower_copy ( char *dst, size_t dst_size, const char *src, size_t src_size )
-{
-    const char *send;
-    char *dend, *begin;
-
-    assert ( dst != NULL && src != NULL );
-
-    if ( dst_size < src_size )
-        src_size = dst_size;
-
-    begin = dst;
-    dend = dst + dst_size;
-    send = src + src_size;
-
-    while ( src < send )
-    {
-        uint32_t ch;
-
-        /* get a complete source character */
-        int len = utf8_utf32 ( & ch, src, send );
-        if ( len <= 0 )
-            break;
-        src += len;
-
-        /* lower case it */
-        ch = towlower ( ( wint_t ) ch );
-
-        /* write it to the destination */
-        len = utf32_utf8 ( dst, dend, ch );
-        if ( len <= 0 )
-            break;
-        dst += len;
-    }
-
-    if ( dst < dend )
-        * dst = 0;
-
-    return ( size_t ) ( dst - begin );
-}
-
-
-/* toupper_copy
- *  copies whole character text in upper-case
- *  terminates with null byte if possible
- *  returns the number of bytes copied
- */
-LIB_EXPORT size_t CC toupper_copy ( char *dst, size_t dst_size, const char *src, size_t src_size )
-{
-    const char *send;
-    char *dend, *begin;
-
-    assert ( dst != NULL && src != NULL );
-
-    if ( dst_size < src_size )
-        src_size = dst_size;
-
-    begin = dst;
-    dend = dst + dst_size;
-    send = src + src_size;
-
-    while ( src < send )
-    {
-        uint32_t ch;
-
-        /* get a complete source character */
-        int len = utf8_utf32 ( & ch, src, send );
-        if ( len <= 0 )
-            break;
-        src += len;
-
-        /* upper case it */
-        ch = towupper ( ( wint_t ) ch );
-
-        /* write it to the destination */
-        len = utf32_utf8 ( dst, dend, ch );
-        if ( len <= 0 )
-            break;
-        dst += len;
-    }
-
-    if ( dst < dend )
-        * dst = 0;
-
-    return ( size_t ) ( dst - begin );
-}
-
-/* string_cmp
- *  performs a safe strncmp
- *
- *  "max_chars" limits the extent of the comparison
- *  to not exceed supplied value, i.e. the number of
- *  characters actually compared will be the minimum
- *  of asize, bsize and max_chars.
- *
- *  if either string size ( or both ) < max_chars and
- *  all compared characters match, then the result will
- *  be a comparison of asize against bsize.
- */
-LIB_EXPORT int CC string_cmp ( const char *a, size_t asize,
-    const char *b, size_t bsize, uint32_t max_chars )
-{
-    uint32_t num_chars;
-    const char *aend, *bend;
-
-    assert ( a != NULL && b != NULL );
-
-    if ( max_chars == 0 )
-        return 0;
-
-    aend = a + asize;
-    bend = b + bsize;
-    num_chars = 0;
-
-    while ( a < aend && b < bend )
-    {
-        uint32_t ach, bch;
-
-        /* read a character from a */
-        int len = utf8_utf32 ( & ach, a, aend );
-        if ( len <= 0 )
-        {
-            asize -= ( size_t ) ( aend - a );
-            break;
-        }
-        a += len;
-
-        /* read a character from b */
-        len = utf8_utf32 ( & bch, b, bend );
-        if ( len <= 0 )
-        {
-            bsize -= ( size_t ) ( bend - b );
-            break;
-        }
-        b += len;
-
-        /* compare characters */
-        if ( ach != bch )
-        {
-            if ( ach < bch )
-                return -1;
-            return 1;
-        }
-
-        /* if char count is sufficient, we're done */
-        if ( ++ num_chars == max_chars )
-            return 0;
-    }
-
-    /* one or both reached end < max_chars */
-    if ( asize < bsize )
-        return -1;
-    return asize > bsize;
-}
-
-/* strcase_cmp
- *  like string_cmp except case insensitive
- */
-LIB_EXPORT int CC strcase_cmp ( const char *a, size_t asize,
-    const char *b, size_t bsize, uint32_t max_chars )
-{
-    uint32_t num_chars;
-    const char *aend, *bend;
-
-    assert ( a != NULL && b != NULL );
-
-    if ( max_chars == 0 )
-        return 0;
-
-    aend = a + asize;
-    bend = b + bsize;
-    num_chars = 0;
-
-    while ( a < aend && b < bend )
-    {
-        uint32_t ach, bch;
-
-        /* read a character from a */
-        int len = utf8_utf32 ( & ach, a, aend );
-        if ( len <= 0 )
-        {
-            asize -= ( size_t ) ( aend - a );
-            break;
-        }
-        a += len;
-
-        /* read a character from b */
-        len = utf8_utf32 ( & bch, b, bend );
-        if ( len <= 0 )
-        {
-            bsize -= ( size_t ) ( bend - b );
-            break;
-        }
-        b += len;
-
-        /* compare characters with case */
-        if ( ach != bch )
-        {
-            /* only go lower case if they differ */
-            ach = towlower ( ( wint_t ) ach );
-            bch = towlower ( ( wint_t ) bch );
-
-            if ( ach != bch )
-            {
-                if ( ach < bch )
-                    return -1;
-                return 1;
-            }
-        }
-
-        /* if char count is sufficient, we're done */
-        if ( ++ num_chars == max_chars )
-            return 0;
-    }
-
-    /* one or both reached end < max_chars */
-    if ( asize < bsize )
-        return -1;
-    return asize > bsize;
-}
-
-/* string_match
- *  returns the number of matching characters
- *
- *  "max_chars" limits the extent of the comparison
- *  to not exceed supplied value, i.e. the number of
- *  characters actually compared will be the minimum
- *  of asize, bsize and max_chars.
- *
- *  "msize" will be set to the size of the matched string
- *  if not NULL
- */
-LIB_EXPORT uint32_t CC string_match ( const char *a_orig, size_t asize,
-    const char *b, size_t bsize, uint32_t max_chars, size_t *msize )
-{
-    uint32_t i;
-    const char *a, *aend, *bend;
-
-    assert ( a_orig != NULL && b != NULL );
-
-    a = a_orig;
-    aend = a_orig + asize;
-    bend = b + bsize;
-
-    for ( i = 0; i < max_chars && a < aend && b < bend; ++ i )
-    {
-        int lena, lenb;
-        uint32_t ach, bch;
-
-        /* read a character from a */
-        lena = utf8_utf32 ( & ach, a, aend );
-        if ( lena <= 0 )
-            break;
-
-        /* read a character from b */
-        lenb = utf8_utf32 ( & bch, b, bend );
-        if ( lenb <= 0 )
-            break;
-
-        /* compare characters */
-        if ( ach != bch )
-            break;
-
-        a += lena;
-        b += lenb;
-    }
-
-    if ( msize != NULL )
-        * msize = ( size_t ) ( a - a_orig );
-    return i;
-}
-
-/* strcase_match
- *  like string_match except case insensitive
- */
-LIB_EXPORT uint32_t CC strcase_match ( const char *a_orig, size_t asize,
-    const char *b, size_t bsize, uint32_t max_chars, size_t *msize )
-{
-    uint32_t i;
-    const char *a, *aend, *bend;
-
-    assert ( a_orig != NULL && b != NULL );
-
-    a = a_orig;
-    aend = a_orig + asize;
-    bend = b + bsize;
-
-    for ( i = 0; i < max_chars && a < aend && b < bend; ++ i )
-    {
-        int lena, lenb;
-        uint32_t ach, bch;
-
-        /* read a character from a */
-        lena = utf8_utf32 ( & ach, a, aend );
-        if ( lena <= 0 )
-            break;
-
-        /* read a character from b */
-        lenb = utf8_utf32 ( & bch, b, bend );
-        if ( lenb <= 0 )
-            break;
-
-        /* compare characters */
-        if ( ach != bch )
-        {
-            /* only go lower case if they differ */
-            ach = towlower ( ( wint_t ) ach );
-            bch = towlower ( ( wint_t ) bch );
-
-            if ( ach != bch )
-                break;
-        }
-
-        a += lena;
-        b += lenb;
-    }
-
-    if ( msize != NULL )
-        * msize = ( size_t ) ( a - a_orig );
-    return i;
-}
-
-/* string_chr
- *  performs a safe strchr
- *  "ch" is in UTF32
- */
-LIB_EXPORT char * CC string_chr ( const char *str, size_t size, uint32_t ch )
-{
-    const char *end;
-
-    if ( str == NULL )
-        return NULL;
-
-    end = str + size;
-    while ( str < end )
-    {
-        uint32_t c;
-        int len = utf8_utf32 ( & c, str, end );
-        if ( len <= 0 )
-            break;
-        if ( c == ch )
-            return ( char* ) str;
-        str += len;
-    }
-    return NULL;
-}
-
-/* string_rchr
- *  performs a safe strrchr
- */
-LIB_EXPORT char * CC string_rchr ( const char *str, size_t size, uint32_t ch )
-{
-    const char *end;
-
-    if ( str == NULL )
-        return NULL;
-
-    end = str + size;
-    while ( end > str )
-    {
-        int len;
-        uint32_t c;
-        const char *p = end - 1;
-
-        /* back up to find beginning of character */
-        while ( p > str && ( * p & 0xC0 ) == 0x80 )
-            -- p;
-
-        len = utf8_utf32 ( & c, p, end );
-        if ( len <= 0 )
-            break;
-        if ( c == ch )
-            return ( char* ) p;
-        end = p;
-    }
-    return NULL;
-}
-
-/* string_idx
- *  seek an indexed character
- */
-LIB_EXPORT char * CC string_idx ( const char *str, size_t size, uint32_t idx )
-{
-    uint32_t i;
-    const char *end;
-
-    if ( str == NULL )
-        return NULL;
-
-    end = str + size;
-    for ( i = 0; str < end; ++ i )
-    {
-        uint32_t c;
-        int len = utf8_utf32 ( & c, str, end );
-        if ( len <= 0 )
-            break;
-        if ( i == idx )
-            return ( char* ) str;
-        str += len;
-    }
-    return NULL;
-}
-
-/* conversion from UTF-16 to internal standard */
-LIB_EXPORT uint32_t CC utf16_cvt_string_len ( const uint16_t *src,
-    size_t src_size, size_t *dst_size )
-{
-    size_t size;
-    uint32_t i, src_len = ( uint32_t ) ( src_size >> 1 );
-
-    for ( size = 0, i = 0; i < src_len; ++ i )
-    {
-        uint32_t ch = src [ i ];
-
-        char ignore [ 8 ];
-        int ch_len = utf32_utf8 ( ignore, & ignore [ sizeof ignore ], ch );
-        if ( ch_len <= 0 )
-            break;
-        size += ch_len;
-    }
-
-    * dst_size = size;
-    return i;
-}
-
-LIB_EXPORT uint32_t CC utf16_cvt_string_measure ( const uint16_t *src,
-    size_t *src_size, size_t *dst_size )
-{
-    size_t size;
-    uint32_t i, ch;
-
-    for ( size = 0, ch = src [ i = 0 ]; ch != 0; ch = src [ ++ i ] )
-    {
-        char ignore [ 8 ];
-        int ch_len = utf32_utf8 ( ignore, & ignore [ sizeof ignore ], ch );
-        if ( ch_len <= 0 )
-            break;
-        size += ch_len;
-    }
-
-    * src_size = i * sizeof * src;
-    * dst_size = size;
-    return i;
-}
-
-LIB_EXPORT size_t CC utf16_cvt_string_copy ( char *dst, size_t dst_size,
-    const uint16_t *src, size_t src_size )
-{
-    char *begin = dst;
-    char *dend = dst + dst_size;
-    const uint16_t *send = ( const uint16_t* ) ( ( const char* ) src + src_size );
-
-    while ( dst < dend && src < send )
-    {
-        uint32_t ch = * src ++;
-        int ch_len = utf32_utf8 ( dst, dend, ch );
-        if ( ch_len <= 0 )
-            break;
-        dst += ch_len;
-    }
-
-    if ( dst < dend )
-        * dst = 0;
-    return ( size_t ) ( dst - begin );
-}
-
-/* conversion from UTF-32 to internal standard */
-LIB_EXPORT uint32_t CC utf32_cvt_string_len ( const uint32_t *src,
-    size_t src_size, size_t *dst_size )
-{
-    size_t size;
-    uint32_t i, src_len = ( uint32_t ) ( src_size >> 2 );
-
-    for ( size = 0, i = 0; i < src_len; ++ i )
-    {
-        uint32_t ch = src [ i ];
-
-        char ignore [ 8 ];
-        int ch_len = utf32_utf8 ( ignore, & ignore [ sizeof ignore ], ch );
-        if ( ch_len <= 0 )
-            break;
-        size += ch_len;
-    }
-
-    * dst_size = size;
-    return i;
-}
-
-LIB_EXPORT uint32_t CC utf32_cvt_string_measure ( const uint32_t *src,
-    size_t *src_size, size_t *dst_size )
-{
-    size_t size;
-    uint32_t i, ch;
-
-    for ( size = 0, ch = src [ i = 0 ]; ch != 0; ch = src [ ++ i ] )
-    {
-        char ignore [ 8 ];
-        int ch_len = utf32_utf8 ( ignore, & ignore [ sizeof ignore ], ch );
-        if ( ch_len <= 0 )
-            break;
-        size += ch_len;
-    }
-
-    * src_size = i * sizeof * src;
-    * dst_size = size;
-    return i;
-}
-
-LIB_EXPORT size_t CC utf32_cvt_string_copy ( char *dst, size_t dst_size,
-    const uint32_t *src, size_t src_size )
-{
-    char *begin = dst;
-    char *dend = dst + dst_size;
-    const uint32_t *send = ( const uint32_t* ) ( ( const char* ) src + src_size );
-
-    while ( dst < dend && src < send )
-    {
-        uint32_t ch = * src ++;
-        int ch_len = utf32_utf8 ( dst, dend, ch );
-        if ( ch_len <= 0 )
-            break;
-        dst += ch_len;
-    }
-
-    if ( dst < dend )
-        * dst = 0;
-    return ( size_t ) ( dst - begin );
-}
-
-/* conversion from wchar_t to internal standard */
-LIB_EXPORT uint32_t CC wchar_cvt_string_len ( const wchar_t *src,
-    size_t src_size, size_t *dst_size )
-{
-    size_t size;
-    uint32_t i, src_len = ( uint32_t ) ( src_size / sizeof * src );
-
-    for ( size = 0, i = 0; i < src_len; ++ i )
-    {
-        uint32_t ch = src [ i ];
-
-        char ignore [ 8 ];
-        int ch_len = utf32_utf8 ( ignore, & ignore [ sizeof ignore ], ch );
-        if ( ch_len <= 0 )
-            break;
-        size += ch_len;
-    }
-
-    * dst_size = size;
-    return i;
-}
-
-LIB_EXPORT uint32_t CC wchar_cvt_string_measure ( const wchar_t *src,
-    size_t *src_size, size_t *dst_size )
-{
-    size_t size;
-    uint32_t i, ch;
-
-    for ( size = 0, ch = src [ i = 0 ]; ch != 0; ch = src [ ++ i ] )
-    {
-        char ignore [ 8 ];
-        int ch_len = utf32_utf8 ( ignore, & ignore [ sizeof ignore ], ch );
-        if ( ch_len <= 0 )
-            break;
-        size += ch_len;
-    }
-
-    * src_size = i * sizeof * src;
-    * dst_size = size;
-    return i;
-}
-
-LIB_EXPORT size_t CC wchar_cvt_string_copy ( char *dst, size_t dst_size,
-    const wchar_t *src, size_t src_size )
-{
-    char *begin = dst;
-    char *dend = dst + dst_size;
-    const wchar_t *send = ( const wchar_t* ) ( ( const char* ) src + src_size );
-
-    while ( dst < dend && src < send )
-    {
-        uint32_t ch = * src ++;
-        int ch_len = utf32_utf8 ( dst, dend, ch );
-        if ( ch_len <= 0 )
-            break;
-        dst += ch_len;
-    }
-
-    if ( dst < dend )
-        * dst = 0;
-
-    return ( size_t ) ( dst - begin );
-}
-
-LIB_EXPORT size_t CC string_cvt_wchar_copy ( wchar_t *dst, size_t dst_size,
-    const char *src, size_t src_size )
-{
-    uint32_t len, blen = ( uint32_t ) ( dst_size / sizeof *dst );
-    const char *send = ( const char* ) src + src_size;
-
-    for ( len = 0; len < blen && src < send; ++ len )
-    {
-        uint32_t ch;
-        int consumed = utf8_utf32 ( &ch, src, send );
-        if ( consumed <= 0 )
-            break;
-        dst [ len ] = ( wchar_t ) ch;
-        src += consumed;
-    }
-
-    if ( len < blen )
-        dst [ len ] = 0;
-
-    return ( size_t ) ( len );
-}
diff --git a/libs/klib/vector.c b/libs/klib/vector.c
deleted file mode 100644
index d60d6d5..0000000
--- a/libs/klib/vector.c
+++ /dev/null
@@ -1,626 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include <klib/vector.h>
-#include <klib/sort.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * Vector
- *  simple vector of void*
- */
-
-
-/* Init
- *  initialize vector
- *
- *  "block" [ IN ] - selects the number of elements in
- *  a vector block; used for allocating and extending
- */
-LIB_EXPORT void CC VectorInit ( Vector *self, uint32_t start, uint32_t block )
-{
-    if ( self != NULL )
-    {
-        self -> v = NULL;
-        self -> start = start;
-        self -> len = 0;
-
-        if ( block == 0 )
-            block = 64;
-
-        if ( ( ( block - 1 ) & block ) != 0 )
-        {
-            uint32_t blk;
-            for ( blk = 1; blk < block; blk <<= 1 )
-                ( void ) 0;
-            block = blk;
-        }
-
-        /* force a minimum of two */
-        self -> mask = ( block - 1 ) | 1;
-    }
-}
-
-
-/* Copy
- *  initialize a new vector from an existing one
- *  performs a shallow copy
- */
-LIB_EXPORT rc_t CC VectorCopy ( const Vector *self, Vector *copy )
-{
-    uint32_t cap;
-
-    if ( copy == NULL )
-        return RC ( rcCont, rcVector, rcCopying, rcParam, rcNull );
-    if ( self == NULL )
-        return RC ( rcCont, rcVector, rcCopying, rcSelf, rcNull );
-
-    VectorInit ( copy, self -> start, self -> mask + 1 );
-    cap = ( self -> len + self -> mask ) & ~ self -> mask;
-    copy -> v = malloc ( sizeof copy -> v [ 0 ] * cap );
-    if ( copy -> v == NULL )
-        return RC ( rcCont, rcVector, rcCopying, rcMemory, rcExhausted );
-
-    memcpy ( copy -> v, self -> v, self -> len * sizeof copy -> v [ 0 ] );
-    copy -> len = self -> len;
-
-    return 0;
-}
-
-
-/* Get
- *  retrieve an indexed element
- */
-LIB_EXPORT  void* CC VectorGet ( const Vector *self, uint32_t idx )
-{
-    if ( self != NULL && idx >= self -> start )
-    {
-        idx -= self -> start;
-        if ( idx < self -> len )
-            return self -> v [ idx ];
-    }
-    return NULL;
-}
-
-
-/* Set
- *  sets an indexed element
- *  extends vector as required
- *
- *  "idx" [ IN ] - item index
- *
- *  "item" [ IN, OPAQUE ] - item to be appended to vector
- *
- *  returns rcExists if element is not NULL
- */
-LIB_EXPORT rc_t CC VectorSet ( Vector *self, uint32_t idx, const void *item )
-{
-    uint32_t curcap, newcap;
-
-    if ( self == NULL )
-        return RC ( rcCont, rcVector, rcInserting, rcSelf, rcNull );
-    if ( idx < self -> start )
-        return RC ( rcCont, rcVector, rcInserting, rcParam, rcInvalid );
-    if ( ( idx -= self -> start ) < self -> len )
-    {
-        if ( self -> v [ idx ] != NULL )
-            return RC ( rcCont, rcVector, rcInserting, rcItem, rcExists );
-        self -> v [ idx ] = ( void* ) item;
-        return 0;
-    }
-
-    curcap = ( self -> len + self -> mask ) & ~ self -> mask;
-    newcap = ( idx + self -> mask + 1 ) & ~ self -> mask;
-    if ( newcap > curcap )
-    {
-        void **v = realloc ( self -> v, newcap * sizeof * v );
-        if ( v == NULL )
-            return RC ( rcCont, rcVector, rcInserting, rcMemory, rcExhausted );
-        self -> v = v;
-    }
-
-    if ( idx > self -> len )
-        memset ( & self -> v [ self -> len ], 0, ( idx - self -> len ) * sizeof self -> v [ 0 ] );
-
-    self -> v [ idx ] = ( void* ) item;
-    self -> len = idx + 1;
-
-    return 0;
-}
-
-
-/* Swap
- *  swaps value of an indexed element
- *  behaves like Set except that it allows overwrite
- *
- *  "idx" [ IN ] - item index
- *
- *  "item" [ IN, OPAQUE ] - new element value
- *
- *  "prior" [ OUT ] - prior element value
- */
-LIB_EXPORT rc_t CC VectorSwap ( Vector *self, uint32_t idx,
-    const void *item, void **prior )
-{
-    rc_t rc;
-
-    if ( prior == NULL )
-        rc = RC ( rcCont, rcVector, rcInserting, rcParam, rcNull );
-    else
-    {
-        rc = VectorSet ( self, idx, item );
-        if ( GetRCState ( rc ) == rcExists )
-        {
-            idx -= self -> start;
-            * prior = self -> v [ idx ];
-
-            /* if swapping NULL for the last item
-               just drop the count */
-            if ( item == NULL && ( idx + 1 ) == self -> len )
-                -- self -> len;
-            else
-                self -> v [ idx ] = ( void* ) item;
-
-            return 0;
-        }
-
-        * prior = NULL;
-    }
-    return rc;
-}
-
-
-/* Append
- *  appends item to end of vector
- *
- *  "idx" [ OUT, NULL OKAY ] - optional return parameter for item index
- *
- *  "item" [ IN, OPAQUE ] - item to be appended to vector
- */
-LIB_EXPORT rc_t CC VectorAppend ( Vector *self, uint32_t *idx, const void *item )
-{
-    if ( self == NULL )
-        return RC ( rcCont, rcVector, rcInserting, rcSelf, rcNull );
-
-    if ( ( self -> len & self -> mask ) == 0 )
-    {
-        void **v = realloc ( self -> v, ( self -> len + self -> mask + 1 ) * sizeof * v );
-        if ( v == NULL )
-            return RC ( rcCont, rcVector, rcInserting, rcMemory, rcExhausted );
-        self -> v = v;
-    }
-
-    self -> v [ self -> len ] = ( void* ) item;
-
-    if ( idx != NULL )
-        * idx = self -> len + self -> start;
-
-    ++ self -> len;
-
-    return 0;
-}
-
-
-/* First
- * Last
- *  get item at either end of vector
- */
-LIB_EXPORT void* CC VectorFirst ( const Vector *self )
-{
-    if ( self != NULL && self -> len != 0 )
-        return self -> v [ 0 ];
-    return NULL;
-}
-
-LIB_EXPORT  void* CC VectorLast ( const Vector *self )
-{
-    if ( self != NULL && self -> len != 0 )
-        return self -> v [ self -> len - 1 ];
-    return NULL;
-}
-
-
-/* Find
- *  find an object within ordered vector
- *
- *  "key" [ IN ] - find criteria
- *
- *  "idx" [ OUT, NULL OKAY ] - optional return parameter for item index
- *
- *  "cmp" [ IN ] - comparison function that returns
- *  equivalent of "key" - "n"
- */
-LIB_EXPORT void* CC VectorFind ( const Vector *self, const void *key, uint32_t *idx,
-    int ( CC * cmp ) ( const void *key, const void *n ) )
-{
-    if ( self != NULL && cmp != NULL )
-    {
-        uint32_t left, right;
-
-        for ( left = 0, right = self -> len; left < right; )
-        {
-            uint32_t i, mid = ( left + right ) >> 1;
-            void *n = self -> v [ i = mid ];
-            while ( n == NULL && i > left )
-                n = self -> v [ -- i ];
-            if ( n == NULL )
-                left = mid + 1;
-            else
-            {
-                int diff = ( * cmp ) ( key, n );
-                if ( diff == 0 )
-                {
-                    if ( idx != NULL )
-                        * idx = i + self -> start;
-                    return n;
-                }
-                if ( diff < 0 )
-                    right = mid;
-                else
-                    left = mid + 1;
-            }
-        }
-    }
-
-    return NULL;
-}
-
-
-/* Insert
- *  insert an object to vector, even if duplicate
- *
- *  "item" [ IN ] - object to insert
- *
- *  "idx" [ OUT, NULL OKAY ] - optional return parameter for item index
- *
- *  "sort" [ IN ] - comparison function that returns
- *  equivalent of "item" - "n"
- *
- *  the treatment of order for items reported as identical
- *  i.e. sort function returns zero when they are compared,
- *  is undefined.
- *
- *  the current implementation treats '<=' as '<' such
- *  that all inserts are converted to a '<' or '>' comparison,
- *  but this should not be relied upon.
- */
-LIB_EXPORT rc_t CC VectorInsert ( Vector *self, const void *item, uint32_t *idx,
-    int ( CC * sort ) ( const void *item, const void *n ) )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        return RC ( rcCont, rcVector, rcInserting, rcSelf, rcNull );
-    if ( sort == NULL )
-        return RC ( rcCont, rcVector, rcInserting, rcFunction, rcNull );
-
-    /* let append handle vector expansion */
-    rc = VectorAppend ( self, NULL, item );
-    if ( rc == 0 )
-    {
-        uint32_t left, right;
-
-        for ( left = 0, right = ( int ) self -> len - 1; left < right; )
-        {
-            uint32_t i, mid = ( left + right ) >> 1;
-            void *n = self -> v [ i = mid ];
-            while ( n == NULL && i > left )
-                n = self -> v [ -- i ];
-            if ( n == NULL )
-                left = mid + 1;
-            else
-            {
-                int diff = ( * sort ) ( item, n );
-                if ( diff <= 0 )
-                    right = mid;
-                else
-                    left = mid + 1;
-            }
-        }
-
-        if ( self -> len > ++ right )
-        {
-            memmove ( & self -> v [ right ], & self -> v [ left ],
-                ( self -> len - right ) * sizeof self -> v [ 0 ] );
-            self -> v [ left ] = ( void* ) item;
-        }
-
-        if ( idx != NULL )
-            * idx = left + self -> start;
-    }
-
-    return rc;
-}
-
-
-/* InsertUnique
- *  insert an object to vector, but only if unique.
- *
- *  "item" [ IN ] - object to insert
- *
- *  "idx" [ OUT, NULL OKAY ] - optional return parameter for
- *  item index. when return code state is rcExists, this value
- *  will be that of the existing item.
- *
- *  "sort" [ IN ] - comparison function that returns
- *  equivalent of "item" - "n"
- */
-LIB_EXPORT rc_t CC VectorInsertUnique ( Vector *self, const void *item, uint32_t *idx,
-    int ( CC * sort ) ( const void *item, const void *n ) )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        return RC ( rcCont, rcVector, rcInserting, rcSelf, rcNull );
-    if ( sort == NULL )
-        return RC ( rcCont, rcVector, rcInserting, rcFunction, rcNull );
-
-    rc = VectorAppend ( self, NULL, item );
-    if ( rc == 0 )
-    {
-        uint32_t left, right;
-
-        for ( left = 0, right = ( int ) self -> len - 1; left < right; )
-        {
-            uint32_t i, mid = ( left + right ) >> 1;
-            void *n = self -> v [ i = mid ];
-            while ( n == NULL && i > left )
-                n = self -> v [ -- i ];
-            if ( n == NULL )
-                left = mid + 1;
-            else
-            {
-                int diff = ( * sort ) ( item, n );
-                if ( diff == 0 )
-                {
-                    -- self -> len;
-                    if ( idx != NULL )
-                        * idx = i + self -> start;
-                    return RC ( rcCont, rcVector, rcInserting, rcNode, rcExists );
-                }
-                if ( diff < 0 )
-                    right = mid;
-                else
-                    left = mid + 1;
-            }
-        }
-
-        if ( self -> len > ++ right )
-        {
-            memmove ( & self -> v [ right ], & self -> v [ left ],
-                ( self -> len - right ) * sizeof self -> v [ 0 ] );
-            self -> v [ left ] = ( void* ) item;
-        }
-
-        if ( idx != NULL )
-            * idx = left + self -> start;
-    }
-
-    return rc;
-}
-
-
-/* Merge
- *  merge a sorted vector into an existing, sorted vector
- *
- *  "unique" [ IN ] - eliminate duplicates if true
- *
- *  "v" [ IN ] - sorted vector of elements to merge
- *
- *  "sort" [ IN ] - comparison function that returns
- *  equivalent of "item" - "n"
- */
-LIB_EXPORT rc_t CC VectorMerge ( Vector *self, bool unique, const Vector *v,
-    int ( CC * sort ) ( const void *item, const void *n ) )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcCont, rcVector, rcInserting, rcSelf, rcNull );
-    else if ( v == NULL )
-        rc = RC ( rcCont, rcVector, rcInserting, rcParam, rcNull );
-    else if ( sort == NULL )
-        rc = RC ( rcCont, rcVector, rcInserting, rcFunction, rcNull );
-    else
-    {
-        void **out = malloc ( ( self -> len + v -> len ) * sizeof out [ 0 ] );
-        if ( out == NULL )
-            rc = RC ( rcCont, rcVector, rcInserting, rcMemory, rcExhausted );
-        else
-        {
-            uint32_t i, a, b;
-            for ( rc = 0, i = a = b = 0; a < self -> len && b < v -> len; ++ i )
-            {
-                int diff = ( * sort ) ( self -> v [ a ], v -> v [ b ] );
-                if ( diff == 0 )
-                {
-                    out [ i ] = self -> v [ a ++ ];
-                    if ( ! unique )
-                        out [ ++ i ] = v -> v [ b ];
-                    ++ b;
-                }
-                else if ( diff < 0 )
-                    out [ i ] = self -> v [ a ++ ];
-                else
-                    out [ i ] = v -> v [ b ++ ];
-            }
-            for ( ; a < self -> len; ++ i, ++ a )
-                out [ i ] = self -> v [ a ];
-            for ( ; b < v -> len; ++ i, ++ b )
-                out [ i ] = v -> v [ b ];
-
-            self -> len = i;
-            free ( self -> v );
-            self -> v = out;
-        }
-    }
-
-    return rc;
-}
-
-
-/* Remove
- *  retrieves value at given index
- *  shifts all elements to right of index toward start,
- *  preserving order and decrements length by 1
- *  return removed item
- *
- *  "idx" [ IN ] - item index
- *
- *  "removed" [ OUT ] - removed element value
- */
-LIB_EXPORT rc_t CC VectorRemove ( Vector *self, uint32_t idx, void **removed )
-{
-    rc_t rc;
-    if ( removed == NULL )
-        rc = RC ( rcCont, rcVector, rcRemoving, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcCont, rcVector, rcRemoving, rcSelf, rcNull );
-        else if ( idx < self -> start )
-            rc = RC ( rcCont, rcVector, rcRemoving, rcParam, rcInvalid );
-        else if ( ( idx -= self -> start ) >= self -> len )
-            rc = RC ( rcCont, rcVector, rcRemoving, rcParam, rcInvalid );
-        else
-        {
-            * removed = self -> v [ idx ];
-            if ( -- self -> len > idx )
-            {
-                memmove ( & self -> v [ idx ], & self -> v [ idx + 1 ],
-                    ( self -> len - idx ) * sizeof self -> v [ 0 ] );
-            }
-            return 0;
-        }
-
-        * removed = NULL;
-    }
-    return rc;
-}
-
-
-/* Reorder
- *  execute qsort on vector with provided function
- *  not particularly well formed ( i.e. doesn't have a function param ),
- *  but works within a limited context
- */
-LIB_EXPORT void CC VectorReorder ( Vector *self,
-    int ( CC * f ) ( const void**, const void**, void* ), void *data )
-{
-    if ( self != NULL && f != NULL && self -> len != 0 )
-    {
-        assert ( self -> v != NULL );
-        ksort ( self -> v, self -> len, sizeof self -> v [ 0 ],
-            ( int ( CC * ) ( const void*, const void*, void* ) ) f, data );
-    }
-}
-
-
-/* ForEach
- *  executes a function on each vector element
- */
-LIB_EXPORT void CC VectorForEach ( const Vector *self, bool reverse,
-    void ( CC * f ) ( void *item, void *data ), void *data )
-{
-    if ( self != NULL && f != NULL )
-    {
-        uint32_t i;
-
-        assert ( self -> len == 0 || self -> v != NULL );
-
-        if ( reverse ) for ( i = self -> len; i > 0; )
-        {
-            ( * f ) ( self -> v [ -- i ], data );
-        }
-        else for ( i = 0; i < self -> len; ++ i )
-        {
-            ( * f ) ( self -> v [ i ], data );
-        }
-    }
-}
-
-
-/* DoUntil
- *  executes a function on each element
- *  until the function returns true
- *
- *  return values:
- *    false unless the function returns true
- */
-LIB_EXPORT bool CC VectorDoUntil ( const Vector *self, bool reverse,
-    bool ( CC * f ) ( void *item, void *data ), void *data )
-{
-    if ( self != NULL && f != NULL )
-    {
-        uint32_t i;
-
-        assert ( self -> len == 0 || self -> v != NULL );
-
-        if ( reverse ) for ( i = self -> len; i > 0; )
-        {
-            if ( ( * f ) ( self -> v [ -- i ], data ) )
-                return true;
-        }
-        else for ( i = 0; i < self -> len; ++ i )
-        {
-            if ( ( * f ) ( self -> v [ i ], data ) )
-                return true;
-        }
-    }
-
-    return false;
-}
-
-
-/* Whack
- *  removes entries from vector and
- *  executes a user provided destructor
- */
-LIB_EXPORT void CC VectorWhack ( Vector *self, 
-    void ( CC * whack ) ( void *item, void *data ), void *data )
-{
-    if ( self != NULL )
-    {
-        uint32_t i;
-
-        assert ( self -> len == 0 || self -> v != NULL );
-
-        if ( whack != NULL ) for ( i = 0; i < self -> len; ++ i )
-            ( * whack ) ( self -> v [ i ], data );
-
-        free ( self -> v );
-
-        self -> v = NULL;
-        self -> len = 0;
-    }
-}
diff --git a/libs/klib/vector_namelist.c b/libs/klib/vector_namelist.c
deleted file mode 100644
index 940ce57..0000000
--- a/libs/klib/vector_namelist.c
+++ /dev/null
@@ -1,357 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-
-/*typedef struct VNamelist VNamelist;*/
-#define KNAMELIST_IMPL VNamelist
-
-#include <klib/rc.h>
-#include <klib/text.h>
-#include <klib/vector.h>
-#include <klib/impl.h>
-#include <os-native.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-/*--------------------------------------------------------------------------
- * KVectorNamelist ... a generic Namelist based on a Vector
- */
-struct VNamelist
-{
-    KNamelist dad;
-    Vector name_vector;
-};
-
-
-static
-void CC VNameListDestroyNode( void* node, void* data )
-{
-    if ( node != NULL ) free( node );
-}
-
-static
-rc_t CC VNameListDestroy ( VNamelist *self )
-{
-    VectorWhack ( &(self->name_vector), VNameListDestroyNode, NULL );
-    free ( self );
-    return 0;
-}
-
-LIB_EXPORT rc_t CC VNameListCount ( const VNamelist *self, uint32_t *count )
-{
-    * count = VectorLength ( &(self->name_vector) );
-    return 0;
-}
-
-LIB_EXPORT rc_t CC VNameListGet ( const VNamelist *self, uint32_t idx, const char **name )
-{
-    if ( idx >= VectorLength ( &(self->name_vector) ) )
-        return RC ( rcCont, rcNamelist, rcAccessing, rcParam, rcExcessive );
-    * name = VectorGet ( &(self->name_vector), idx );
-    return 0;
-}
-
-static KNamelist_vt_v1 sVNameList_vt =
-{
-    1, 0,
-    VNameListDestroy,
-    VNameListCount,
-    VNameListGet
-};
-
-LIB_EXPORT rc_t CC VNamelistMake( VNamelist **names, const uint32_t alloc_blocksize  )
-{
-    rc_t rc;
-
-    if ( names == NULL )
-        rc = RC ( rcCont, rcNamelist, rcConstructing, rcParam, rcNull );
-    else
-    {
-        (*names)=malloc( sizeof(**names) );
-        if (*names != NULL )
-        {
-            rc = KNamelistInit( &(*names)->dad, (const KNamelist_vt*) &sVNameList_vt );
-            if ( rc == 0 )
-            {
-                VectorInit ( & (*names)->name_vector, 0, alloc_blocksize );
-            }
-            else
-            {
-                free( *names );
-                *names = NULL;
-            }
-        }
-        else
-        {
-            rc = RC( rcCont, rcNamelist, rcListing, rcParam, rcNull );
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VNamelistRelease( const VNamelist *self )
-{
-    rc_t rc = 0;
-    if ( self != NULL )
-    {
-        rc = KNamelistRelease( &(self->dad) );
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VNamelistToNamelist( VNamelist *self, KNamelist **cast )
-{
-    rc_t rc;
-    if ( cast == NULL )
-        rc = RC ( rcCont, rcNamelist, rcCasting, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcCont, rcNamelist, rcCasting, rcSelf, rcNull );
-        else
-        {
-            rc = KNamelistAddRef ( & self -> dad );
-            if ( rc == 0 )
-            {
-                * cast = & self -> dad;
-                return 0;
-            }
-        }
-
-        * cast = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VNamelistToConstNamelist( const VNamelist *self, const KNamelist **cast )
-{
-    return VNamelistToNamelist ( ( VNamelist* ) self, ( KNamelist** ) cast );
-}
-
-LIB_EXPORT rc_t CC VNamelistAppend( VNamelist *self, const char* src )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcCont, rcNamelist, rcInserting, rcSelf, rcNull );
-    else
-    {
-        if ( src == NULL )
-            rc = RC( rcCont, rcNamelist, rcInserting, rcString, rcNull );
-        else if ( src[0] == 0 )
-            rc = RC( rcCont, rcNamelist, rcInserting, rcString, rcEmpty );
-        else
-        {
-            char* my_copy = string_dup( src, string_size( src ) );
-            if ( my_copy == NULL )
-                rc = RC( rcCont, rcNamelist, rcInserting, rcMemory, rcExhausted );
-            else
-            {
-                rc = VectorAppend( &(self->name_vector), NULL, my_copy );
-                if ( rc != 0 )
-                    free ( my_copy );
-            }
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC VNamelistAppendString( VNamelist *self, const String * src )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcCont, rcNamelist, rcInserting, rcSelf, rcNull );
-    else
-    {
-        if ( src == NULL )
-            rc = RC( rcCont, rcNamelist, rcInserting, rcString, rcNull );
-        else if ( src->addr == NULL || src->len == 0 )
-            rc = RC( rcCont, rcNamelist, rcInserting, rcString, rcEmpty );
-        else
-        {
-            char* my_copy = string_dup ( src->addr, src->len );
-            if ( my_copy == NULL )
-                rc = RC( rcCont, rcNamelist, rcInserting, rcMemory, rcExhausted );
-            else
-            {
-                rc = VectorAppend( &(self->name_vector), NULL, my_copy );
-                if ( rc != 0 )
-                    free ( my_copy );
-            }
-        }
-    }
-    return rc;
-}
-
-
-
-LIB_EXPORT rc_t CC VNamelistIndexOf( VNamelist *self, const char* s, uint32_t *found )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcCont, rcNamelist, rcSearching, rcSelf, rcNull );
-    else
-    {
-        if ( s == NULL )
-            rc = RC( rcCont, rcNamelist, rcSearching, rcString, rcNull );
-        else if ( s[0] == 0 )
-            rc = RC( rcCont, rcNamelist, rcSearching, rcString, rcEmpty );
-        else if ( found == NULL )
-            rc = RC( rcCont, rcNamelist, rcSearching, rcParam, rcNull );
-        else
-        {
-            uint32_t count;
-            rc = VNameListCount ( self, &count );
-            if ( rc == 0 )
-            {
-                uint32_t idx;
-                size_t n1 = string_size ( s );
-                for ( idx = 0; idx < count; ++idx )
-                {
-                    const char * name;
-                    rc = VNameListGet ( self, idx, &name );
-                    if ( rc == 0 )
-                    {
-                        size_t n2 = string_size ( name );
-                        if ( string_cmp ( s, n1, name, n2, (uint32_t) ( ( n1 < n2 ) ? n2 : n1 ) ) == 0 )
-                        {
-                            *found = idx;
-                            return 0;
-                        }
-                    }
-                }
-                rc = RC( rcCont, rcNamelist, rcSearching, rcString, rcNotFound );
-            }
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC VNamelistRemoveIdx( VNamelist *self, uint32_t idx )
-{
-    rc_t rc;
-    if ( self == NULL )
-        rc = RC ( rcCont, rcNamelist, rcSearching, rcSelf, rcNull );
-    else
-    {
-        char *removed;
-        rc = VectorRemove ( &(self->name_vector), idx, (void **)&removed );
-        if ( rc == 0 )
-            free( removed );
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC VNamelistRemove( VNamelist *self, const char* s )
-{
-    uint32_t idx;
-
-    rc_t rc = VNamelistIndexOf( self, s, &idx );
-    if ( rc == 0 )
-        rc = VNamelistRemoveIdx( self, idx );
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC VNamelistRemoveAll( VNamelist *self )
-{
-    rc_t rc = 0;
-    uint32_t count = 1;
-    while ( count > 0 && rc == 0 )
-    {
-        rc = VNameListCount ( self, &count );
-        if ( rc == 0 && count > 0 )
-            rc = VNamelistRemoveIdx( self, count - 1 );
-    }
-    return rc;
-}
-
-
-/* Reorder
- *  sort the names according to case sensitivity
- *  and UNICODE character code ordering
- *
- *  "case_insensitive" [ IN ] - when true, perform "tolower" on
- *   each character before compare
- */
-static
-int CC vect_string_cmp ( const void **a, const void **b, void *ignore )
-{
-    return strcmp ( * a, * b );
-}
-
-static
-int CC vect_string_cmp_case ( const void **a, const void **b, void *ignore )
-{
-    uint32_t i;
-
-    const char *ap = * a;
-    const char *bp = * b;
-
-    if ( ap == NULL )
-        return bp != NULL;
-    if ( bp == NULL )
-        return -1;
-
-    for ( i = 0; ; ++ i )
-    {
-        if ( ap [ i ] != bp [ i ] )
-        {
-            /* TBD - this should perform UTF-8 to UNICODE conversion
-               but for that, create a function in text module */
-            int diff = tolower ( ap [ i ] ) - tolower ( bp [ i ] );
-            if ( diff == 0 )
-                continue;
-
-            return diff;
-        }
-
-        if ( ap [ i ] == 0 )
-            break;
-    }
-
-    return 0;
-}
-
-LIB_EXPORT void CC VNamelistReorder ( VNamelist *self, bool case_insensitive )
-{
-    if ( self != NULL )
-    {
-        VectorReorder ( & self -> name_vector, case_insensitive ? vect_string_cmp_case : vect_string_cmp, NULL );
-    }
-}
-
diff --git a/libs/klib/vlen-encode.c b/libs/klib/vlen-encode.c
deleted file mode 100644
index f8e4349..0000000
--- a/libs/klib/vlen-encode.c
+++ /dev/null
@@ -1,773 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <klib/extern.h>
-#include <klib/vlen-encode.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <byteswap.h>
-#include <endian.h>
-#include <string.h>
-
-LIB_EXPORT rc_t CC vlen_encode1(void *Dst, uint64_t dsize, uint64_t *psize, int64_t X) {
-    int sgn = 0;
-    uint64_t x;
-    uint8_t *dst = Dst;
-    
-    if (dst == NULL)
-        dsize = 0;
-    
-    if (X < 0) {
-        sgn = 0x40;
-        x = -X;
-    }
-    else
-        x = X;
-    /* 6 -> 8 */
-    if (x < 0x40) {
-        if (psize)
-            *psize = 1;
-        if (dsize < 1)
-            return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-        dst[0] = (uint8_t)sgn | ( (uint8_t)x & 0x3F );
-        return 0;
-    }
-    /* 13 -> 16 */
-    if (x < 0x2000) {
-        if (psize)
-            *psize = 2;
-        if (dsize < 2)
-            return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-        dst[0] = 0x80 | (uint8_t)sgn | ( (uint8_t)( x >> 7 ) & 0x3F );
-        dst[1] = ( (uint8_t)x & 0x7F );
-        return 0;
-    }
-    /* 20 -> 24 */
-    if (x < 0x100000) {
-        if (psize)
-            *psize = 3;
-        if (dsize < 3)
-            return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-        dst[0] = 0x80 | (uint8_t)sgn | ( (uint8_t)( x >> 14 ) & 0x3F );
-        dst[1] = 0x80 | ( (uint8_t)( x >> 7 ) & 0x7F );
-        dst[2] = ( (uint8_t)x & 0x7F );
-        return 0;
-    }
-    /* 27 -> 32 */
-    if (x < 0x8000000) {
-        if (psize)
-            *psize = 4;
-        if (dsize < 4)
-            return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-        dst[0] = 0x80 | (uint8_t)sgn | ( (uint8_t)( x >> 21 ) & 0x3F );
-        dst[1] = 0x80 | ( (uint8_t)( x >> 14 ) & 0x7F );
-        dst[2] = 0x80 | ( (uint8_t)( x >> 7 ) & 0x7F );
-        dst[3] = ( (uint8_t)x & 0x7F );
-        return 0;
-    }
-    /* 34 -> 40 */
-    if (x < ( ( uint64_t ) 0x4 << 32 ) ) {
-        if (psize)
-            *psize = 5;
-        if (dsize < 5)
-            return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-        dst[0] = 0x80 | (uint8_t)sgn | ( (uint8_t)( x >> 28 ) & 0x3F );
-        dst[1] = 0x80 | ( (uint8_t)( x >> 21 ) & 0x7F );
-        dst[2] = 0x80 | ( (uint8_t)( x >> 14 ) & 0x7F );
-        dst[3] = 0x80 | ( (uint8_t)( x >> 7 ) & 0x7F );
-        dst[4] = ( (uint8_t)x & 0x7F );
-        return 0;
-    }
-    /* 41 -> 48 */
-    if (x < ( ( uint64_t ) 0x200 << 32 ) ) {
-        if (psize)
-            *psize = 6;
-        if (dsize < 6)
-            return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-        dst[0] = 0x80 | (uint8_t)sgn | ( (uint8_t)( x >> 35 ) & 0x3F );
-        dst[1] = 0x80 | ( (uint8_t)( x >> 28 ) & 0x7F );
-        dst[2] = 0x80 | ( (uint8_t)( x >> 21 ) & 0x7F );
-        dst[3] = 0x80 | ( (uint8_t)( x >> 14 ) & 0x7F );
-        dst[4] = 0x80 | ( (uint8_t)( x >> 7 ) & 0x7F );
-        dst[5] = ( (uint8_t)x & 0x7F );
-        return 0;
-    }
-    /* 48 -> 56 */
-    if (x < ( ( uint64_t ) 0x10000 << 32 ) ) {
-        if (psize)
-            *psize = 7;
-        if (dsize < 7)
-            return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-        dst[0] = 0x80 | (uint8_t)sgn | ( (uint8_t)( x >> 42 ) & 0x3F );
-        dst[1] = 0x80 | ( (uint8_t)( x >> 35 ) & 0x7F );
-        dst[2] = 0x80 | ( (uint8_t)( x >> 28 ) & 0x7F );
-        dst[3] = 0x80 | ( (uint8_t)( x >> 21 ) & 0x7F );
-        dst[4] = 0x80 | ( (uint8_t)( x >> 14 ) & 0x7F );
-        dst[5] = 0x80 | ( (uint8_t)( x >> 7 ) & 0x7F );
-        dst[6] = ( (uint8_t)x & 0x7F );
-        return 0;
-    }
-    /* 55 -> 64 */
-    if (x < ( ( uint64_t ) 0x800000 << 32 ) ) {
-        if (psize)
-            *psize = 8;
-        if (dsize < 8)
-            return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-        dst[0] = 0x80 | (uint8_t)sgn | ( (uint8_t)( x >> 49 ) & 0x3F );
-        dst[1] = 0x80 | ( (uint8_t)( x >> 42 ) & 0x7F );
-        dst[2] = 0x80 | ( (uint8_t)( x >> 35 ) & 0x7F );
-        dst[3] = 0x80 | ( (uint8_t)( x >> 28 ) & 0x7F );
-        dst[4] = 0x80 | ( (uint8_t)( x >> 21 ) & 0x7F );
-        dst[5] = 0x80 | ( (uint8_t)( x >> 14 ) & 0x7F );
-        dst[6] = 0x80 | ( (uint8_t)( x >> 7 ) & 0x7F );
-        dst[7] = ( (uint8_t)x & 0x7F );
-        return 0;
-    }
-    /* 62 -> 72 */
-    if (x < ( ( uint64_t ) 0x40000000 << 32 ) ) {
-        if (psize)
-            *psize = 9;
-        if (dsize < 9)
-            return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-        dst[0] = 0x80 | (uint8_t)sgn | ( (uint8_t)( x >> 56 ) & 0x3F );
-        dst[1] = 0x80 | ( (uint8_t)( x >> 49 ) & 0x7F );
-        dst[2] = 0x80 | ( (uint8_t)( x >> 42 ) & 0x7F );
-        dst[3] = 0x80 | ( (uint8_t)( x >> 35 ) & 0x7F );
-        dst[4] = 0x80 | ( (uint8_t)( x >> 28 ) & 0x7F );
-        dst[5] = 0x80 | ( (uint8_t)( x >> 21 ) & 0x7F );
-        dst[6] = 0x80 | ( (uint8_t)( x >> 14 ) & 0x7F );
-        dst[7] = 0x80 | ( (uint8_t)( x >> 7 ) & 0x7F );
-        dst[8] = ( (uint8_t)x & 0x7F );
-        return 0;
-    }
-    /* 64 -> 80 */
-    if (psize)
-        *psize = 10;
-    if (dsize < 10)
-        return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-    dst[0] = 0x80 | (uint8_t)sgn | ( (uint8_t)( x >> 63 ) & 0x3F );
-    dst[1] = 0x80 | ( (uint8_t)( x >> 56 ) & 0x7F );
-    dst[2] = 0x80 | ( (uint8_t)( x >> 49 ) & 0x7F );
-    dst[3] = 0x80 | ( (uint8_t)( x >> 42 ) & 0x7F );
-    dst[4] = 0x80 | ( (uint8_t)( x >> 35 ) & 0x7F );
-    dst[5] = 0x80 | ( (uint8_t)( x >> 28 ) & 0x7F );
-    dst[6] = 0x80 | ( (uint8_t)( x >> 21 ) & 0x7F );
-    dst[7] = 0x80 | ( (uint8_t)( x >> 14 ) & 0x7F );
-    dst[8] = 0x80 | ( (uint8_t)( x >> 7 ) & 0x7F );
-    dst[9] = ( (uint8_t)x & 0x7F );
-    return 0;
-}
-
-LIB_EXPORT rc_t CC vlen_decode1 ( int64_t *dst, const void *Src, uint64_t ssize, uint64_t *consumed ) {
-    const uint8_t *src = Src;
-    int x;
-    int i;
-    int sgn;
-    int64_t y;
-
-    if (dst == NULL || src == NULL)
-        return RC(rcXF, rcFunction, rcExecuting, rcParam, rcNull);
-    if (ssize == 0)
-        return RC(rcXF, rcFunction, rcExecuting, rcParam, rcInvalid);
-    if (ssize > 10)
-        ssize = 10;
-    
-    x = src[0];
-    sgn = x & 0x40;
-    y = x & 0x3F;
-    i = 1;
-    if ((x & 0x80) != 0) {
-        if (i == ssize)
-            return RC(rcXF, rcFunction, rcExecuting, rcData, rcInsufficient);
-        x = src[i];
-        y = (y << 7) | (x & 0x7F);
-        ++i;
-        if ((x & 0x80) != 0) {
-            if (i == ssize)
-                return RC(rcXF, rcFunction, rcExecuting, rcData, rcInsufficient);
-            x = src[i];
-            y = (y << 7) | (x & 0x7F);
-            ++i;
-            if ((x & 0x80) != 0) {
-                if (i == ssize)
-                    return RC(rcXF, rcFunction, rcExecuting, rcData, rcInsufficient);
-                x = src[i];
-                y = (y << 7) | (x & 0x7F);
-                ++i;
-                if ((x & 0x80) != 0) {
-                    if (i == ssize)
-                        return RC(rcXF, rcFunction, rcExecuting, rcData, rcInsufficient);
-                    x = src[i];
-                    y = (y << 7) | (x & 0x7F);
-                    ++i;
-                    if ((x & 0x80) != 0) {
-                        if (i == ssize)
-                            return RC(rcXF, rcFunction, rcExecuting, rcData, rcInsufficient);
-                        x = src[i];
-                        y = (y << 7) | (x & 0x7F);
-                        ++i;
-                        if ((x & 0x80) != 0) {
-                            if (i == ssize)
-                                return RC(rcXF, rcFunction, rcExecuting, rcData, rcInsufficient);
-                            x = src[i];
-                            y = (y << 7) | (x & 0x7F);
-                            ++i;
-                            if ((x & 0x80) != 0) {
-                                if (i == ssize)
-                                    return RC(rcXF, rcFunction, rcExecuting, rcData, rcInsufficient);
-                                x = src[i];
-                                y = (y << 7) | (x & 0x7F);
-                                ++i;
-                                if ((x & 0x80) != 0) {
-                                    if (i == ssize)
-                                        return RC(rcXF, rcFunction, rcExecuting, rcData, rcInsufficient);
-                                    x = src[i];
-                                    y = (y << 7) | (x & 0x7F);
-                                    ++i;
-                                    if ((x & 0x80) != 0) {
-                                        if (i == ssize)
-                                            return RC(rcXF, rcFunction, rcExecuting, rcData, rcInsufficient);
-                                        x = src[i];
-                                        y = (y << 7) | (x & 0x7F);
-                                        ++i;
-                                        if ((x & 0x80) != 0)
-                                            return RC(rcXF, rcFunction, rcExecuting, rcData, rcInvalid);
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
-    *dst = sgn ? -y : y;
-    if (consumed)
-        *consumed = i;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC vlen_encode ( void *Dst, uint64_t dsize, uint64_t *act_size,
-    const int64_t x[], uint32_t xcount ) {
-    uint32_t i;
-    uint64_t n;
-    uint64_t m = 0;
-    rc_t rc = 0;
-    uint8_t *dst = Dst;
-    
-    if (dst != NULL) {
-        for (i = 0, rc = 0; rc == 0 && i != xcount; ++i) {
-            rc = vlen_encode1(dst, dsize, &n, x[i]);
-            dst += n;
-            dsize -= n;
-            m += n;
-        }
-        if (rc == 0)
-            goto DONE;
-    }
-    else
-        i = 0;
-    for (; i != xcount; ++i) {
-        vlen_encode1(0, 0, &n, x[i]);
-        m += n;
-    }
-DONE:
-    if (act_size)
-        *act_size = m;
-    return rc;
-}
-
-LIB_EXPORT rc_t CC vlen_decode ( int64_t *Y, uint64_t ycount, 
-    const void *Src, uint64_t ssize, uint64_t *consumed ) {
-    const uint8_t *src = Src;
-    uint64_t i, j;
-    
-    if (Y == NULL || Src == NULL)
-        return RC(rcXF, rcFunction, rcExecuting, rcParam, rcNull);
-    if (ssize == 0)
-        return RC(rcXF, rcFunction, rcExecuting, rcParam, rcInvalid);
-    if (ssize < ycount)
-        return RC(rcXF, rcFunction, rcExecuting, rcData, rcInsufficient);
-    
-    for (i = 0, j = 0; j != ycount && i + 10 < ssize; ++j) {
-        int64_t y;
-        int sgn;
-#define XTYPE_SIZE 64
-#if XTYPE_SIZE == 64
-#define XTYPE uint64_t
-#elif XTYPE_SIZE == 32
-#define XTYPE uint32_t
-#else
-#endif
-        XTYPE x;
-        
-        memcpy (& x, src + i, sizeof x); /* may be misaligned */        
-#if __BYTE_ORDER == __BIG_ENDIAN
-#if XTYPE_SIZE == 32
-        x = bswap_32(x);
-#elif XTYPE_SIZE == 64
-        x = bswap_64(x);
-#endif
-#endif
-        sgn = (int)x & 0x40;
-        y = x & 0x3F;
-        ++i;
-        if ((x & 0x80) != 0) {
-            x >>= 8;
-            y = (y << 7) | (x & 0x7F);
-            ++i;
-            if ((x & 0x80) != 0) {
-                x >>= 8;
-                y = (y << 7) | (x & 0x7F);
-                ++i;
-                if ((x & 0x80) != 0) {
-                    x >>= 8;
-                    y = (y << 7) | (x & 0x7F);
-                    ++i;
-                    if ((x & 0x80) != 0) {
-#if XTYPE_SIZE == 32
-                        x = *(const XTYPE *)(src + i);
-#if __BYTE_ORDER == __BIG_ENDIAN
-                        x = bswap_32(x);
-#endif
-#elif XTYPE_SIZE == 64
-                        x >>= 8;
-#endif
-                        y = (y << 7) | (x & 0x7F);
-                        ++i;
-                        if ((x & 0x80) != 0) {
-                            x >>= 8;
-                            y = (y << 7) | (x & 0x7F);
-                            ++i;
-                            if ((x & 0x80) != 0) {
-                                x >>= 8;
-                                y = (y << 7) | (x & 0x7F);
-                                ++i;
-                                if ((x & 0x80) != 0) {
-                                    x >>= 8;
-                                    y = (y << 7) | (x & 0x7F);
-                                    ++i;
-                                    if ((x & 0x80) != 0) {
-                                        x = src[i];
-                                        y = (y << 7) | (x & 0x7F);
-                                        ++i;
-                                        if ((x & 0x80) != 0) {
-                                            x = src[i];
-                                            y = (y << 7) | (x & 0x7F);
-                                            ++i;
-                                            if ((x & 0x80) != 0)
-                                                return RC(rcXF, rcFunction, rcExecuting, rcData, rcInvalid);
-                                        }
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        Y[j] = sgn ? -y : y;
-    }
-    for ( ; j != ycount; ++j) {
-        uint64_t n;
-        rc_t rc = vlen_decode1(Y + j, src + i, ssize - i, &n);
-        if (rc)
-            return rc;
-        i += n;
-    }
-    if (consumed)
-        *consumed = i;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC vlen_encodeU1 ( void *Dst, uint64_t dsize,
-    uint64_t *psize, uint64_t X ) {
-    uint64_t x = X;
-    uint8_t *dst = Dst;
-    
-    if (dst == NULL)
-        dsize = 0;
-    
-    /* 7 -> 8 */
-    if (x < 0x80) {
-        if (psize)
-            *psize = 1;
-        if (dsize < 1)
-            return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-        dst[0] = (uint8_t)x & 0x7F;
-        return 0;
-    }
-    /* 14 -> 16 */
-    if (x < 0x4000) {
-        if (psize)
-            *psize = 2;
-        if (dsize < 2)
-            return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-        dst[0] = 0x80 | ( (uint8_t)( x >> 7 ) & 0x7F);
-        dst[1] = (uint8_t)x & 0x7F;
-        return 0;
-    }
-    /* 21 -> 24 */
-    if (x < 0x200000) {
-        if (psize)
-            *psize = 3;
-        if (dsize < 3)
-            return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-        dst[0] = 0x80 | ( (uint8_t)( x >> 14 ) & 0x7F );
-        dst[1] = 0x80 | ( (uint8_t)( x >> 7 ) & 0x7F );
-        dst[2] = ( (uint8_t)x & 0x7F );
-        return 0;
-    }
-    /* 28 -> 32 */
-    if (x < 0x10000000) {
-        if (psize)
-            *psize = 4;
-        if (dsize < 4)
-            return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-        dst[0] = 0x80 | ( (uint8_t)( x >> 21 ) & 0x7F );
-        dst[1] = 0x80 | ( (uint8_t)( x >> 14 ) & 0x7F );
-        dst[2] = 0x80 | ( (uint8_t)( x >> 7 ) & 0x7F );
-        dst[3] = ( (uint8_t)x & 0x7F );
-        return 0;
-    }
-    /* 35 -> 40 */
-    if (x < ( ( uint64_t ) 0x8 << 32 ) ) {
-        if (psize)
-            *psize = 5;
-        if (dsize < 5)
-            return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-        dst[0] = 0x80 | ( (uint8_t)( x >> 28 ) & 0x7F );
-        dst[1] = 0x80 | ( (uint8_t)( x >> 21 ) & 0x7F );
-        dst[2] = 0x80 | ( (uint8_t)( x >> 14 ) & 0x7F );
-        dst[3] = 0x80 | ( (uint8_t)( x >> 7 ) & 0x7F );
-        dst[4] = ( (uint8_t)x & 0x7F );
-        return 0;
-    }
-    /* 42 -> 48 */
-    if (x < ( ( uint64_t ) 0x400 << 32 ) ) {
-        if (psize)
-            *psize = 6;
-        if (dsize < 6)
-            return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-        dst[0] = 0x80 | ( (uint8_t)( x >> 35 ) & 0x7F );
-        dst[1] = 0x80 | ( (uint8_t)( x >> 28 ) & 0x7F );
-        dst[2] = 0x80 | ( (uint8_t)( x >> 21 ) & 0x7F );
-        dst[3] = 0x80 | ( (uint8_t)( x >> 14 ) & 0x7F );
-        dst[4] = 0x80 | ( (uint8_t)( x >> 7 ) & 0x7F );
-        dst[5] = ( (uint8_t)x & 0x7F );
-        return 0;
-    }
-    /* 49 -> 56 */
-    if (x < ( ( uint64_t ) 0x20000 << 32 ) ) {
-        if (psize)
-            *psize = 7;
-        if (dsize < 7)
-            return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-        dst[0] = 0x80 | ( (uint8_t)( x >> 42 ) & 0x7F );
-        dst[1] = 0x80 | ( (uint8_t)( x >> 35 ) & 0x7F );
-        dst[2] = 0x80 | ( (uint8_t)( x >> 28 ) & 0x7F );
-        dst[3] = 0x80 | ( (uint8_t)( x >> 21 ) & 0x7F );
-        dst[4] = 0x80 | ( (uint8_t)( x >> 14 ) & 0x7F );
-        dst[5] = 0x80 | ( (uint8_t)( x >> 7 ) & 0x7F );
-        dst[6] = ( (uint8_t)x & 0x7F );
-        return 0;
-    }
-    /* 56 -> 64 */
-    if (x < ( ( uint64_t ) 0x1000000 << 32 ) ) {
-        if (psize)
-            *psize = 8;
-        if (dsize < 8)
-            return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-        dst[0] = 0x80 | ( (uint8_t)( x >> 49 ) & 0x7F );
-        dst[1] = 0x80 | ( (uint8_t)( x >> 42 ) & 0x7F );
-        dst[2] = 0x80 | ( (uint8_t)( x >> 35 ) & 0x7F );
-        dst[3] = 0x80 | ( (uint8_t)( x >> 28 ) & 0x7F );
-        dst[4] = 0x80 | ( (uint8_t)( x >> 21 ) & 0x7F );
-        dst[5] = 0x80 | ( (uint8_t)( x >> 14 ) & 0x7F );
-        dst[6] = 0x80 | ( (uint8_t)( x >> 7 ) & 0x7F );
-        dst[7] = ( (uint8_t)x & 0x7F );
-        return 0;
-    }
-    /* 63 -> 72 */
-    if (x < ( ( uint64_t ) 0x80000000 << 32 ) ) {
-        if (psize)
-            *psize = 9;
-        if (dsize < 9)
-            return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-        dst[0] = 0x80 | ( (uint8_t)( x >> 56 ) & 0x7F );
-        dst[1] = 0x80 | ( (uint8_t)( x >> 49 ) & 0x7F );
-        dst[2] = 0x80 | ( (uint8_t)( x >> 42 ) & 0x7F );
-        dst[3] = 0x80 | ( (uint8_t)( x >> 35 ) & 0x7F );
-        dst[4] = 0x80 | ( (uint8_t)( x >> 28 ) & 0x7F );
-        dst[5] = 0x80 | ( (uint8_t)( x >> 21 ) & 0x7F );
-        dst[6] = 0x80 | ( (uint8_t)( x >> 14 ) & 0x7F );
-        dst[7] = 0x80 | ( (uint8_t)( x >> 7 ) & 0x7F );
-        dst[8] = ( (uint8_t)x & 0x7F );
-        return 0;
-    }
-    /* 64 -> 80 */
-    if (psize)
-        *psize = 10;
-    if (dsize < 10)
-        return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-    dst[0] = 0x80 | ( (uint8_t)( x >> 63 ) & 0x7F );
-    dst[1] = 0x80 | ( (uint8_t)( x >> 56 ) & 0x7F );
-    dst[2] = 0x80 | ( (uint8_t)( x >> 49 ) & 0x7F );
-    dst[3] = 0x80 | ( (uint8_t)( x >> 42 ) & 0x7F );
-    dst[4] = 0x80 | ( (uint8_t)( x >> 35 ) & 0x7F );
-    dst[5] = 0x80 | ( (uint8_t)( x >> 28 ) & 0x7F );
-    dst[6] = 0x80 | ( (uint8_t)( x >> 21 ) & 0x7F );
-    dst[7] = 0x80 | ( (uint8_t)( x >> 14 ) & 0x7F );
-    dst[8] = 0x80 | ( (uint8_t)( x >> 7 ) & 0x7F );
-    dst[9] = ( (uint8_t)x & 0x7F );
-    return 0;
-}
-
-static
-rc_t vlen_decodeU1_imp ( uint64_t *dst, const void *Src,
-    uint64_t ssize, uint64_t *consumed ) {
-    const uint8_t *src = Src;
-    uint64_t y;
-    int c;
-    
-    if (ssize > 10)
-        ssize = 10;
-    
-	c = src[0];
-	if ((c & 0x80) == 0) {
-		*dst = c;
-		*consumed = 1;
-		return 0;
-	}
-	if (ssize != 1) {
-		y = c & 0x7F;
-        c = src[1];
-        if ((c & 0x80) == 0) {
-            *dst = (y << 7) | c;
-            *consumed = 2;
-            return 0;
-        }
-        if (ssize != 2) {
-            y = (y << 7) | (c & 0x7F);
-            c = src[2];
-            if ((c & 0x80) == 0) {
-                *dst = (y << 7) | c;
-                *consumed = 3;
-                return 0;
-            }
-            if (ssize != 3) {
-                y = (y << 7) | (c & 0x7F);
-                c = src[3];
-                if ((c & 0x80) == 0) {
-                    *dst = (y << 7) | c;
-                    *consumed = 4;
-                    return 0;
-                }
-                if (ssize != 4) {
-                    y = (y << 7) | (c & 0x7F);
-                    c = src[4];
-                    if ((c & 0x80) == 0) {
-                        *dst = (y << 7) | c;
-                        *consumed = 5;
-                        return 0;
-                    }
-                    if (ssize != 5) {
-                        y = (y << 7) | (c & 0x7F);
-                        c = src[5];
-                        if ((c & 0x80) == 0) {
-                            *dst = (y << 7) | c;
-                            *consumed = 6;
-                            return 0;
-                        }
-                        if (ssize != 6) {
-                            y = (y << 7) | (c & 0x7F);
-                            c = src[6];
-                            if ((c & 0x80) == 0) {
-                                *dst = (y << 7) | c;
-                                *consumed = 7;
-                                return 0;
-                            }
-                            if (ssize != 7) {
-                                y = (y << 7) | (c & 0x7F);
-                                c = src[7];
-                                if ((c & 0x80) == 0) {
-                                    *dst = (y << 7) | c;
-                                    *consumed = 8;
-                                    return 0;
-                                }
-                                if (ssize != 8) {
-                                    y = (y << 7) | (c & 0x7F);
-                                    c = src[8];
-                                    if ((c & 0x80) == 0) {
-                                        *dst = (y << 7) | c;
-                                        *consumed = 9;
-                                        return 0;
-                                    }
-                                    if (ssize != 9) {
-                                        y = (y << 7) | (c & 0x7F);
-                                        c = src[9];
-                                        if ((c & 0x80) == 0) {
-                                            *dst = (y << 7) | c;
-                                            *consumed = 10;
-                                            return 0;
-                                        }
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
-                                            
-    return RC(rcRuntime, rcFunction, rcExecuting, rcData, rcInvalid);
-}
-
-LIB_EXPORT rc_t CC vlen_decodeU1( uint64_t *dst, const void *Src,
-    uint64_t ssize, uint64_t *consumed ) {
-    if (dst == NULL || Src == NULL)
-        return RC(rcXF, rcFunction, rcExecuting, rcParam, rcNull);
-    if (ssize == 0)
-        return RC(rcXF, rcFunction, rcExecuting, rcParam, rcInvalid);
-    
-    return vlen_decodeU1_imp(dst, Src, ssize, consumed);
-}
-
-LIB_EXPORT rc_t CC vlen_encodeU( void *Dst, uint64_t dsize,
-    uint64_t *act_size, const uint64_t x[], uint32_t xcount ) {
-    uint32_t i;
-    uint64_t n;
-    uint64_t m = 0;
-    rc_t rc = 0;
-    uint8_t *dst = Dst;
-    
-    if (dst != NULL) {
-        for (i = 0, rc = 0; rc == 0 && i != xcount; ++i) {
-            rc = vlen_encodeU1(dst, dsize, &n, x[i]);
-            dst += n;
-            dsize -= n;
-            m += n;
-        }
-        if (rc == 0)
-            goto DONE;
-    }
-    else
-        i = 0;
-    for (; i != xcount; ++i) {
-        vlen_encodeU1(0, 0, &n, x[i]);
-        m += n;
-    }
-DONE:
-    if (act_size)
-        *act_size = m;
-    return rc;
-}
-
-LIB_EXPORT rc_t CC vlen_decodeU ( uint64_t Y[], uint64_t ycount,
-    const void *Src, uint64_t ssize, uint64_t *consumed ) {
-    const uint8_t *src = Src;
-    uint64_t i, j;
-    
-    if (Y == NULL || Src == NULL)
-        return RC(rcXF, rcFunction, rcExecuting, rcParam, rcNull);
-    if (ssize == 0)
-        return RC(rcXF, rcFunction, rcExecuting, rcParam, rcInvalid);
-    if (ssize < ycount)
-        return RC(rcXF, rcFunction, rcExecuting, rcData, rcInsufficient);
-    
-    for (j = i = 0; j != ycount; ++j) {
-        uint64_t n;
-        rc_t rc = vlen_decodeU1_imp(Y + j, src + i, ssize - i, &n);
-        if (rc)
-            return rc;
-        i += n;
-    }
-    if (consumed)
-        *consumed = i;
-    return 0;
-}
-
-#if 0
-#include <stdlib.h>
-#include <stdio.h>
-#include <assert.h>
-#include <string.h>
-
-static void print ( const unsigned char *buf, int n ) {
-    int i;
-    for (i = 0; i != n; ++i)
-        printf("%02X ", buf[i]);
-    puts("");
-}
-
-#define N 128
-void test( void ) {
-    unsigned char buf[N * 10];
-    uint32_t i;
-    uint64_t y[N], x[N];
-    unsigned s[8];
-    uint64_t bsz;
-    uint64_t temp;
-    uint32_t total;
-    uint64_t min = 640;
-    uint64_t max = 0;
-    int j;
-    
-    for (i = 0; i != 8; ++i) {
-        sranddev();
-        s[i] = random();
-    }
-    for (j = 0, total = 0; j != 1024 * 1024; ++j) {
-        for (i = 0; i != N; ++i)
-            x[i] = random();
-        vlen_encodeU(buf, 1024, &bsz, x, N);
-        total += bsz;
-        if (max < bsz)
-            max = bsz;
-        if (min > bsz)
-            min = bsz;
-        vlen_decodeU(y, N, buf, bsz, &temp);
-        assert(temp == bsz);
-        assert(memcmp(y, x, sizeof(y)) == 0);
-    }
-    for (j = 0, total = 0; j != 1024 * 1024; ++j) {
-        for (i = 0; i != N; ++i)
-            x[i] = random();
-        vlen_encode(buf, 1024, &bsz, x, N);
-        total += bsz;
-        if (max < bsz)
-            max = bsz;
-        if (min > bsz)
-            min = bsz;
-        vlen_decode(y, N, buf, bsz, &temp);
-        assert(temp == bsz);
-        assert(memcmp(y, x, sizeof(y)) == 0);
-    }
-    printf("min: %u\tmax: %u\tavg: %f\n", (int)min, (int)max, ((float)total) / j);
-}
-#endif
diff --git a/libs/klib/win/misc.c b/libs/klib/win/misc.c
deleted file mode 100644
index f204e34..0000000
--- a/libs/klib/win/misc.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/misc.h> /* is_iser_an_admin */
-
-#include <Shlobj.h> /* IsUserAnAdmin */
-
-LIB_EXPORT bool CC is_iser_an_admin(void) {
-    return IsUserAnAdmin();
-}
diff --git a/libs/klib/win/sysalloc.c b/libs/klib/win/sysalloc.c
deleted file mode 100644
index 7dfc73a..0000000
--- a/libs/klib/win/sysalloc.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#define _c_sysalloc_
-#include <sysalloc.h>
-
-#undef malloc
-#undef calloc
-#undef realloc
-#undef free
-
-#if _DEBUGGING
-#define _CRTDBG_MAP_ALLOC 1
-#include <crtdbg.h>
-#endif
-
-/* malloc
- */
-LIB_EXPORT void * CC klib_malloc ( size_t bytes )
-{
-    return malloc ( bytes );
-}
-
-/* calloc
- */
-LIB_EXPORT void * CC klib_calloc ( size_t count, size_t size )
-{
-    return calloc ( count, size );
-}
-
-/* realloc
- */
-LIB_EXPORT void * CC klib_realloc ( void *obj, size_t bytes )
-{
-    return realloc ( obj, bytes );
-}
-
-
-/* free
- */
-LIB_EXPORT void CC klib_free ( void *obj )
-{
-    free ( obj );
-}
diff --git a/libs/klib/win/syserrcode.c b/libs/klib/win/syserrcode.c
deleted file mode 100644
index 0c64db3..0000000
--- a/libs/klib/win/syserrcode.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include "writer-priv.h"
-#include <klib/writer.h>
-#include <klib/text.h>
-#include <klib/printf.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <os-native.h>
-#include <Windows.h>
-
-#include <stdio.h>
-
-size_t KWrtFmt_error_code ( char * buffer, size_t buffer_size, uint32_t error_code )
-{
-    char  * tbuffer;
-    char * pc;
-    DWORD tbuffer_size;
-    size_t z;
-
-    tbuffer_size = FormatMessageA (FORMAT_MESSAGE_ALLOCATE_BUFFER | 
-                                   FORMAT_MESSAGE_FROM_SYSTEM | 
-                                   FORMAT_MESSAGE_IGNORE_INSERTS, /* dwFlags */
-                                   NULL, /* lpSource */
-                                   error_code, /* dwMessageId */
-                                   0, /* dwLanguageId - we're lazy on language right now */
-                                   (LPSTR)&tbuffer,
-                                   0, /* nSize */
-                                   NULL);/* Arguments */
-    if (tbuffer_size == 0)
-    {
-        rc_t rc;
-
-        rc = string_printf (buffer, buffer_size, &z,
-                            "Undefined error: %u", error_code);
-        if (rc == 0)
-            return z;
-        else
-        {
-            static const char failed[] = "Failure to get Windows error string";
-            return string_copy (buffer, buffer_size, failed, sizeof failed);
-        }
-    }
-    else
-    {
-        for (pc = tbuffer; *pc ; ++pc)
-        {
-            if (*pc == '\r')
-            {
-                tbuffer_size = ( DWORD ) ( pc - tbuffer );
-                break;
-            }
-        }
-        z = string_copy (buffer, buffer_size, tbuffer, tbuffer_size);
-
-        LocalFree (tbuffer);
-    }
-    return z;
-}
diff --git a/libs/klib/win/syslog.c b/libs/klib/win/syslog.c
deleted file mode 100644
index 68d586b..0000000
--- a/libs/klib/win/syslog.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include "../log-priv.h"
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <WINDOWS.H>
-#include <stdio.h>
-#include <stdlib.h>
-#include <os-native.h>
-
-/* LogTimestamp
- *  generates a timestamp-string in GMT-format
- */
-LIB_EXPORT rc_t CC LogTimestamp ( char *buffer, size_t bsize, size_t *num_writ )
-{
-    int len;
-    SYSTEMTIME my_time;
-    
-    GetSystemTime( &my_time );
-
-    /* make the timestamp */
-    len = snprintf ( buffer, bsize,
-                     "%04d-%02d-%02dT%02d:%02d:%02d",
-                     my_time.wYear,
-                     my_time.wMonth,
-                     my_time.wDay,
-                     my_time.wHour,
-                     my_time.wMinute,
-                     my_time.wSecond );
-    if ( num_writ != NULL )
-    {
-        * num_writ = len;
-    }
-
-    if ( len < 0 || ( size_t ) len >= bsize )
-    {
-        if ( len < 0 && num_writ != NULL )
-            * num_writ = 0;
-        return RC ( rcApp, rcLog, rcLogging, rcBuffer, rcInsufficient );
-    }
-
-    return 0;
-}
-
-/* LogSimpleTimestamp
- *  generates a local timestamp string without time zone
- */
-LIB_EXPORT rc_t CC LogSimpleTimestamp ( char *buffer, size_t bsize, size_t *num_writ )
-{
-    int len;
-    SYSTEMTIME my_time;
-
-    GetLocalTime( &my_time );
-
-    /* make the timestamp */
-    len = snprintf ( buffer, bsize,
-                     "%04d-%02d-%02dT%02d:%02d:%02d",
-                     my_time.wYear,
-                     my_time.wMonth,
-                     my_time.wDay,
-                     my_time.wHour,
-                     my_time.wMinute,
-                     my_time.wSecond );
-    if ( num_writ != NULL )
-    {
-        * num_writ = len;
-    }
-
-    if ( len < 0 || ( size_t ) len >= bsize )
-    {
-        if ( len < 0 && num_writ != NULL )
-            * num_writ = 0;
-        return RC ( rcApp, rcLog, rcLogging, rcBuffer, rcInsufficient );
-    }
-
-    return 0;
-}
-
-/* LogPID
- *  generates a process id
- */
-LIB_EXPORT rc_t CC LogPID ( char *buffer, size_t bsize, size_t *num_writ )
-{
-    DWORD my_process_id = GetCurrentProcessId();
-    int len = snprintf ( buffer, bsize, "%u", my_process_id );
-    * num_writ = len;
-    if ( len < 0 || ( size_t ) len >= bsize )
-    {
-        if ( len < 0 )
-            * num_writ = 0;
-        return RC ( rcApp, rcLog, rcLogging, rcBuffer, rcInsufficient );
-    }
-    return 0;
-}
diff --git a/libs/klib/win/systime.c b/libs/klib/win/systime.c
deleted file mode 100644
index 913fbaa..0000000
--- a/libs/klib/win/systime.c
+++ /dev/null
@@ -1,278 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include <klib/time.h>
-
-#include <WINDOWS.H>
-#include <os-native.h>
-
-
-/*--------------------------------------------------------------------------
- * KTime_t
- *  64 bit time_t
- */
-
-#if _ARCH_BITS == 32
-#define UNIX_EPOCH_IN_WIN       116444736000000000ULL
-#else
-#define UNIX_EPOCH_IN_WIN       116444736000000000UL
-#endif
-#define UNIX_TIME_UNITS_IN_WIN  10000000
-
-
-/* KTime2FILETIME
- *  convert from Unix to Windows
- */
-static
-const FILETIME *KTime2FILETIME ( KTime_t ts, FILETIME *ft )
-{
-    uint64_t win_time = ( ts * UNIX_TIME_UNITS_IN_WIN ) + UNIX_EPOCH_IN_WIN;
-    ft -> dwLowDateTime = ( DWORD ) win_time;
-    ft -> dwHighDateTime = win_time >> 32;
-    return ft;
-}
-
-/* FILETIME2KTime
- */
-static
-KTime_t FILETIME2KTime ( const FILETIME *ft )
-{
-    uint64_t win_time = ft -> dwLowDateTime + ( ( int64_t ) ft -> dwHighDateTime << 32 );
-    return ( KTime_t ) ( win_time - UNIX_EPOCH_IN_WIN ) / UNIX_TIME_UNITS_IN_WIN;
-}
-
-
-/* Stamp
- *  current timestamp
- */
-LIB_EXPORT KTime_t CC KTimeStamp ( void )
-{
-    FILETIME ft;
-    GetSystemTimeAsFileTime ( & ft );
-    return FILETIME2KTime ( & ft );
-}
-
-
-/*--------------------------------------------------------------------------
- * SYSTEMTIME
- */
-
-static
-int SYSTEMTIME_compare ( const SYSTEMTIME *a, const SYSTEMTIME *b )
-{
-    int diff = a -> wMonth - b -> wMonth;
-    if ( diff == 0 )
-    {
-        diff = a -> wDay - b -> wDay;
-        if ( diff == 0 )
-        {
-            diff = a -> wHour - b -> wHour;
-            if ( diff == 0 )
-            {
-                diff = a -> wMinute - b -> wMinute;
-                if ( diff == 0 )
-                    diff = a -> wSecond - b -> wSecond;
-            }
-        }
-    }
-    return diff;
-}
-
-static
-void SYSTEMTIME_from_half_baked_SYSTEMTIME ( const SYSTEMTIME *half_baked, SYSTEMTIME *proper, WORD year )
-{
-    FILETIME ft;
-
-    * proper = * half_baked;
-
-    /* fix some stuff */
-    proper -> wYear = year;
-    proper -> wMonth = half_baked -> wMonth;
-    proper -> wDayOfWeek = 0; /* ignored */
-    proper -> wDay = 1;
-    proper -> wHour = half_baked -> wHour;
-    proper -> wMinute = 0;
-    proper -> wSecond = 0;
-    proper -> wMilliseconds = 0;
-
-    /* convert it to FILETIME and back, just to get the proper day of week
-       if there's a better way to do it, go ahead.
-       by now, my lunch is too difficult to keep down... */
-    SystemTimeToFileTime ( proper, & ft );
-    FileTimeToSystemTime ( & ft, proper );
-
-    /* now, move ahead to the day of week */
-    proper -> wDay += half_baked -> wDayOfWeek - proper -> wDayOfWeek;
-    if ( half_baked -> wDayOfWeek < proper -> wDayOfWeek )
-        proper -> wDay += 7;
-    proper -> wDayOfWeek = half_baked -> wDayOfWeek;
-
-    /* now find the occurrence of the weekday */
-    if ( half_baked -> wDay > 1 )
-        proper -> wDay += ( half_baked -> wDay - 1 ) * 7;
-}
-
-/*--------------------------------------------------------------------------
- * KTime
- *  simple time structure
- */
-
-
-/* Make
- *  make KTime from struct tm
- */
-static
-void KTimeMake ( KTime *kt, const SYSTEMTIME *st )
-{
-    kt -> year = st -> wYear;
-    kt -> month = st -> wMonth - 1;
-    kt -> day = st -> wDay - 1;
-    kt -> weekday = st -> wDayOfWeek;
-    kt -> hour = ( uint8_t ) st -> wHour;
-    kt -> minute = ( uint8_t ) st -> wMinute;
-    kt -> second = ( uint8_t ) st -> wSecond;
-}
-
-
-/* Local
- *  populate "kt" from "ts" in local time zone
- */
-LIB_EXPORT const KTime* CC KTimeLocal ( KTime *kt, KTime_t ts )
-{
-    if ( kt != NULL )
-    {
-        DWORD tz_id;
-        FILETIME ft;
-        SYSTEMTIME gst, lst;
-        TIME_ZONE_INFORMATION tz;
-
-        /* generate windows time in 100nS units */
-        KTime2FILETIME ( ts, & ft );
-
-        /* generate a system time - almost what we need,
-           except it's GMT and has no associated time zone */
-        FileTimeToSystemTime ( & ft, & gst );
-
-        /* assume we're NOT in DST */
-        kt -> dst = false;
-
-        /* get local timezone information */
-        tz_id = GetTimeZoneInformation ( & tz );
-        switch ( tz_id )
-        {
-        case TIME_ZONE_ID_STANDARD:
-        case TIME_ZONE_ID_DAYLIGHT:
-
-            /* convert GMT time to local time with tz info */
-            SystemTimeToTzSpecificLocalTime ( & tz, & gst, & lst );
-            KTimeMake ( kt, & lst );
-
-            /* our gentle brothers and sisters in Redmond never
-               cease to amaze... it's very nice - handy, even -
-               to know that the system is "currently" operating
-               in one mode or another, but that tells us nothing
-               about the timestamp we're trying to interpret.
-
-               to discover whether the timestamp we're converting
-               is within daylight savings time, we can compare against
-               the two railpost SYSTEMTIME entries, but then there's
-               no telling whether we're in or out since the calendar
-               is circular! aside from having to perform a multi-part
-               comparison, we'll come to different conclusions depending
-               upon whether the hemisphere is northern or southern!
-
-               to disambiguate, we can use tz_id to detect hemisphere,
-               and then know what's going on. Wow.
-
-               also, it's not clear to the author whether the returned
-               structures in tz will be proper or hacked, since the
-               MSDN descriptions only describe how to hack them for
-               input, but not how they will look on output. */
-
-            if ( tz . StandardDate . wMonth == 0 || tz . DaylightDate . wMonth == 0 )
-                kt -> tzoff = - ( int16_t ) tz . Bias;
-            else
-            {
-                bool south = tz_id == TIME_ZONE_ID_DAYLIGHT;
-
-                SYSTEMTIME cst, dst, std;
-                GetSystemTime ( & cst );
-
-                /* fill out proper structures, since those in tz are bad... */
-                SYSTEMTIME_from_half_baked_SYSTEMTIME ( & tz . DaylightDate, & dst, cst . wYear );
-                SYSTEMTIME_from_half_baked_SYSTEMTIME ( & tz . StandardDate, & std, cst . wYear );
-
-                /* perform northern test for DST */
-                if ( SYSTEMTIME_compare ( & lst, & dst ) >= 0 && SYSTEMTIME_compare ( & lst, & std ) < 0 )
-                    kt -> dst = true;
-
-                /* test to see which hemisphere */
-                south ^= ( SYSTEMTIME_compare ( & cst, & dst ) >= 0 && SYSTEMTIME_compare ( & cst, & std ) < 0 );
-
-                /* correct for southern hemisphere */
-                kt -> dst ^= south;
-
-                /* set the timezone offset */
-                kt -> tzoff = - ( int16_t ) ( tz . Bias +
-                    kt -> dst ? tz . DaylightBias : tz . StandardBias );
-            }
-            break;
-
-        default:
-
-            /* failed - use GMT instead */
-            KTimeMake ( kt, & gst );
-            kt -> tzoff = 0;
-        }
-    }
-    return kt;
-}
-
-
-/* Global
- *  populate "kt" from "ts" in GMT
- */
-LIB_EXPORT const KTime* CC KTimeGlobal ( KTime *kt, KTime_t ts )
-{
-    if ( kt != NULL )
-    {
-        FILETIME ft;
-        SYSTEMTIME gst;
-
-        /* generate windows time in 100nS units */
-        KTime2FILETIME ( ts, & ft );
-
-        /* generate a system time */
-        FileTimeToSystemTime ( & ft, & gst );
-
-	/* fill out GMT time structure */
-        KTimeMake ( kt, & gst );
-        kt -> tzoff = 0;
-        kt -> dst = false;
-    }
-    return kt;
-}
diff --git a/libs/klib/win/syswriter.c b/libs/klib/win/syswriter.c
deleted file mode 100644
index f365702..0000000
--- a/libs/klib/win/syswriter.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include <sysalloc.h>
-#include <windows.h>
-#include <klib/writer.h>
-#include <klib/text.h>
-#include <klib/printf.h>
-#include "writer-priv.h"
-#include <stdio.h>
-#include <errno.h>
-#include <stdarg.h>
-
-static HANDLE win_stdout;
-static HANDLE win_stderr;
-
-rc_t KWrtSysInit(void** h_stdout, void** h_stderr)
-{
-    win_stdout = GetStdHandle(STD_OUTPUT_HANDLE);
-    win_stderr = GetStdHandle(STD_ERROR_HANDLE);
-
-    if( h_stdout ) {
-        *h_stdout = &win_stdout;
-    }
-    if( h_stderr ) {
-        *h_stderr = &win_stderr;
-    }
-    return 0;
-}
-
-LIB_EXPORT int CC snprintf ( char * buffer, size_t bufsize, const char * format, ... )
-{
-    int ret;
-    size_t size;
-    rc_t rc;
-    va_list args;
-
-    va_start (args, format);
-    rc = string_vprintf ( buffer, bufsize, &size, format, args );
-    if ( rc == 0 )
-    {
-        ret = ( int ) size;
-    }
-    else
-    {
-        if ( ( GetRCState( rc ) == rcInsufficient )&&( GetRCObject( rc ) == rcBuffer ) )
-            ret = ( int ) size;
-        else
-            ret = -1;
-    }
-/*    ret = _vsnprintf (buffer, bufsize, format, args); */
-    va_end (args);
-    return ret;
-}
-
-/* ----
- * write 'count' bytes starting at 'buf'  to a "stream/file" identified by 'fd'
- */
-rc_t CC KWrt_DefaultWriter( void * self, const char * buffer, size_t bufsize, size_t * num_writ )
-{
-    size_t total;
-    DWORD remaining;
-    int num_written;
-    const char * pbyte;
-    HANDLE handle;
-    rc_t rc;
-
-    handle = *(HANDLE *)self;
-    pbyte = buffer;
-    rc = 0;
-
-    total = 0;
-    for (remaining = ( DWORD ) bufsize; remaining > 0; remaining -= num_written)
-    {
-        if (WriteFile (handle, pbyte, remaining, &num_written, NULL) == 0)
-        {       
-            rc = RC ( rcApp, rcLog, rcWriting, rcTransfer, rcUnknown );
-            break;
-        }
-        else
-            total += num_written;
-    }
-    *num_writ = total;
-    return rc;
-}
-
-void print_int_fixup ( char * fmt, size_t * len, size_t max )
-{
-    char type;
-    /* all the Unix flavors support a real printf
-     * Only Windows does it "wrong".
-     * In windows we can't just return like this but instead:
-     *    save fmt[len-1]
-     *    replace 'j' with I64
-     *    replace 'z' or 't',  with 'I'
-     *    replace 'hh' with 'h'
-     *    append saved fmt[len-1] to its new place.
-     *
-     */
-    if (*len > 2)
-    {
-        if ((fmt [*len-3] == 'l') && (fmt [*len-2] == 'l'))
-        {
-            fmt [*len-2] = fmt [*len-1];
-            fmt [*len-1] = '\0';
-            --*len;
-        }
-    }
-    if (*len > 2)
-    {
-        switch (fmt[*len-2])
-        {
-        case 'h':
-            if (fmt[*len-3] == 'h')
-            {
-                fmt [*len-2] = fmt [*len-1];
-                fmt [*len-1] = '\0';
-                *len --;
-            }
-            break;
-
-        case 'z': /* 32-bit specific */
-        case 't':
-            fmt[*len-2] = 'l';
-            break;
-        case 'j':
-        case 'l':
-            type = fmt[*len-1];
-            fmt[*len-2] = 'I';
-            fmt[*len-1] = '6';
-            fmt[*len]   = '4';
-            fmt[*len+1] = type;
-            fmt[*len+2] = '\0';
-            *len += 2;
-            break;
-        }
-    }
-    return;
-}
-
-void print_float_fixup ( char * fmt, size_t * len, size_t max )
-{
-    /* all the Unix flavors support a real printf
-     * Only Windows does it "wrong".
-     */
-    return;
-}
-
-void print_char_fixup ( char * fmt, size_t * len, size_t max )
-{
-    /* all the Unix flavors support a real printf
-     * Only Windows does it "wrong".
-     */
-    return;
-}
diff --git a/libs/klib/writer-priv.h b/libs/klib/writer-priv.h
deleted file mode 100644
index 9a1c190..0000000
--- a/libs/klib/writer-priv.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_writer_priv_
-#define _h_writer_priv_
-
-#include <klib/writer.h>
-
-#ifndef _h_klib_rc_
-#include <klib/rc.h>
-#endif
-
-#ifndef _h_klib_log_
-#include <klib/log.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-rc_t KWrtSysInit(void** h_stdout, void** h_stderr);
-
-size_t KWrtFmt_rc_t  (char * buffer, size_t bufsize, const char * fmt, rc_t rc_in);
-size_t KWrtFmt_KTime_t (char * buffer, size_t bufsize, const char * fmt_ignored, KTime_t time_in);
-
-
-/* -----
- * write into the buffer a textual string describing the system specific
- * error code represented by the third parameter.  Will be NUL terminated.
- * expected to be used within string_printf and associated functions only.
- */
-size_t KWrtFmt_error_code (char * buffer, size_t bufsize, uint32_t error_code);
-
-/* -----
- * We have a default writer is the part that will possibly vary by O/S type
- */
-rc_t CC KWrt_DefaultWriter (void* data, const char * buffer, size_t bufsize, size_t * num_writ);
-
-/* -----
- * The default writer uses this data type object.
- * The actual definition might vary to work on non-Unix operating systems.  The port to Windows
- * might well force the full definition to a system file.
- */
-typedef struct KWrt_DefaultWriterData DefaultWriterData;
-
-/*
- * Windows or other O/S port might have to move this struct definition to a system specific file
- */
-struct KWrt_DefaultWriterData
-{
-    int sysfile_handle;
-};
-
-/*
- * We will have two common default writer data objects for the C library expected stdout and stderr
- *
- * These are the normal data stream and error data stream that will have to be set up for
- * windows console I/O
- */
-extern void *KWrt_DefaultWriterDataStdOut;
-extern void *KWrt_DefaultWriterDataStdErr;
-
-/* fix up windows printf shortcomings for integer types 
- * current format is len long at fmt with max max size for the format
- * len is updated to new length if fmt is changed
- */
-void print_int_fixup   (char * fmt, size_t * len, size_t max);
-void print_float_fixup (char * fmt, size_t * len, size_t max);
-void print_char_fixup  (char * fmt, size_t * len, size_t max);
-
-extern const char *gRCModule_str [];
-extern const char *gRCTarget_str [];
-extern const char *gRCContext_str [];
-extern const char *gRCObject_str [];
-extern const char *gRCState_str [];
-
-extern const char *gRCModuleIdx_str [];
-extern const char *gRCTargetIdx_str [];
-extern const char *gRCContextIdx_str [];
-extern const char *gRCObjectIdx_str [];
-extern const char *gRCStateIdx_str [];
-
-/* GetRCModuleText
- */
-const char *GetRCModuleText ( enum RCModule mod );
-
-/* GetRCTargetText
- */
-const char *GetRCTargetText ( enum RCTarget targ );
-
-/* GetRCContextText
- */
-const char *GetRCContextText ( enum RCContext ctx );
-
-/* GetRCObjectText
- *  obj can be RCTarget or RCObject
- */
-const char *GetRCObjectText ( int obj );
-
-/* GetRCStateText
- */
-const char *GetRCStateText ( enum RCState state );
-
-
-/* GetRCModuleIdxText
- */
-const char *GetRCModuleIdxText ( enum RCModule mod );
-
-/* GetRCTargetIdxText
- */
-const char *GetRCTargetIdxText ( enum RCTarget targ );
-
-/* GetRCContextIdxText
- */
-const char *GetRCContextIdxText ( enum RCContext ctx );
-
-/* GetRCObjectIdxText
- *  obj can be RCTarget or RCObject
- */
-const char *GetRCObjectIdxText ( int obj );
-
-/* GetRCStateIdxText
- */
-const char *GetRCStateIdxText ( enum RCState state );
-
-
-extern const char * RCModuleStrings[];
-extern const char * RCTargetStrings[];
-extern const char * RCContextStrings[];
-extern const char * RCObjectStrings[];
-extern const char * RCStateStrings[];
-
-enum ERCExplain2Options
-{
-    eRCExOpt_NoMessageIfNoError,
-    eRCExOpt_ObjAndStateOnlyIfError,
-    eRCExOpt_CompleteMsg
-};
-
-KLIB_EXTERN rc_t CC RCExplain2 ( rc_t rc, char *buffer, size_t bsize, size_t *num_writ, enum ERCExplain2Options options );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_writer_priv_ */
diff --git a/libs/klib/writer.c b/libs/klib/writer.c
deleted file mode 100644
index ebd6f66..0000000
--- a/libs/klib/writer.c
+++ /dev/null
@@ -1,634 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/extern.h>
-#include <klib/out.h>
-#include <klib/status.h>
-#include <klib/log.h>
-#include <klib/debug.h>
-#include <klib/text.h>
-#include <klib/printf.h>
-#include <klib/rc.h>
-#include <klib/sort.h>
-#include <sysalloc.h>
-#include <atomic32.h>
-
-#include "writer-priv.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-#include <os-native.h>
-
-static char wrt_app[32];
-static size_t wrt_app_length;
-static char wrt_vers[16];
-static size_t wrt_vers_length;
-
-void* KWrt_DefaultWriterDataStdOut = NULL;
-void* KWrt_DefaultWriterDataStdErr = NULL;
-
-typedef struct RCCreateLoc RCCreateLoc;
-struct RCCreateLoc
-{
-    const char *filename;
-    const char *function;
-    uint32_t lineno;
-    rc_t rc;
-};
-
-static RCCreateLoc RC_loc_queue [ 4096 ];
-static atomic32_t RC_loc_reserve, RC_loc_written, RC_loc_read;
-#define RC_LOC_QUEUE_SIZE ( sizeof RC_loc_queue / sizeof RC_loc_queue [ 0 ] )
-#define RC_LOC_QUEUE_MASK ( RC_LOC_QUEUE_SIZE - 1 )
-
-/*
- *  "appname" [ IN ] - identity of executable, usually argv[0]
- *
- *  "vers" [ IN ] - 4-part version code: 0xMMmmrrrr, where
- *      MM = major release
- *      mm = minor release
- *    rrrr = bug-fix release
- */
-LIB_EXPORT rc_t CC KWrtInit( const char* appname, uint32_t vers )
-{
-    rc_t rc;
-
-    if ( appname == NULL )
-        return RC ( rcRuntime, rcLog, rcConstructing, rcString, rcNull );
-    if ( appname [ 0 ] == 0 )
-        return RC ( rcRuntime, rcLog, rcConstructing, rcString, rcEmpty );
-
-    do
-    {
-        const char* progname;
-        const char* ext;
-        size_t progname_z;
-
-        /* find whichever is last \ or / */
-        string_measure(appname, &progname_z);
-        progname = string_rchr(appname, progname_z, '/');
-        if( progname == NULL ) {
-            progname = appname;
-        } else {
-            progname++;
-            string_measure(progname, &progname_z);
-        }
-        appname = string_rchr(progname, progname_z, '\\');
-        if( appname == NULL ) {
-            appname = progname;
-        } else {
-            appname++;
-        }
-        string_measure(appname, &progname_z);
-
-        ext = string_chr(appname, progname_z, '.');
-
-        if( ext != NULL ) {
-            wrt_app_length = ext - appname;
-        } else {
-            wrt_app_length = progname_z;
-        }
-        if ( wrt_app_length >= sizeof(wrt_app) ) {
-            wrt_app_length = sizeof(wrt_app) - 1;
-        }
-        memcpy(wrt_app, appname, wrt_app_length);
-        wrt_app[wrt_app_length] = '\0';
-
-        rc = string_printf ( wrt_vers, sizeof wrt_vers, & wrt_vers_length, "%V", vers );
-        assert ( rc == 0 );
-
-        rc = KWrtSysInit(&KWrt_DefaultWriterDataStdOut, &KWrt_DefaultWriterDataStdErr);
-        if (rc) break;
-
-        rc = KOutInit();
-        if (rc) break;
-
-        rc = KLogInit();
-        if (rc) break;
-
-        rc = KStsInit();
-        if (rc) break;
-
-        rc = KDbgInit();
-    } while (0);
-
-    return rc;
-}
-
-/*--------------------------------------------------------------------------
- * nvp - name/value pair
- */
-static
-int CC wrt_nvp_cmp_func(const void *a, const void *b, void * ignored)
-{
-    int i = 0;
-    const char *key = a;
-    const char *name = ( ( const wrt_nvp_t* ) b ) -> name;
-
-    while(key[i] == name[i]) {
-        if( key[i] == '\0' || name[i] == '\0' ) {
-            break;
-        }
-        i++;
-    }
-    /* treat \0 or right-paren as key terminator */
-    if( key[i] != 0 && key[i] != ')' ) {
-        return key[i] - name[i];
-    }
-    return 0 - name[i];
-}
-
-static
-int CC wrt_nvp_sort_func(const void *a, const void *b, void * ignored)
-{
-    const wrt_nvp_t *left = a;
-    const wrt_nvp_t *right = b;
-    return strcmp ( left -> name, right -> name );
-}
-
-LIB_EXPORT void CC wrt_nvp_sort( size_t argc, wrt_nvp_t argv[])
-{
-    if( argc > 1 ) {
-        ksort(argv, argc, sizeof(argv[0]), wrt_nvp_sort_func, NULL);
-    }
-}
-
-LIB_EXPORT const wrt_nvp_t* CC wrt_nvp_find( size_t argc, const wrt_nvp_t argv[], const char* key )
-{
-    if( argc > 0 ) {
-        return kbsearch(key, argv, argc, sizeof(argv[0]), wrt_nvp_cmp_func, NULL);
-    }
-    return NULL;
-}
-
-LIB_EXPORT const char* CC wrt_nvp_find_value( size_t argc, const wrt_nvp_t argv[], const char* key )
-{
-    if( argc > 0 ) {
-        const wrt_nvp_t* n = (const wrt_nvp_t*)kbsearch(key, argv, argc, sizeof(argv[0]), wrt_nvp_cmp_func, NULL);
-        if( n != NULL ) {
-            return n->value;
-        }
-    }
-    return NULL;
-}
-
-static
-rc_t RCLiteral ( rc_t self, char *buffer, size_t bsize, size_t *num_writ )
-{
-#if ! _DEBUGGING && RECORD_RC_FILE_LINE
-    ( void ) GetRCLineno ();
-#endif
-    return string_printf ( buffer, bsize, num_writ
-#if _DEBUGGING
-        , "rc = %s:%u:$s:%u.%u.%u.%u.%u"
-        , GetRCFilename(), GetRCLineno (), GetRCFunction ()
-#else
-        , "rc = %u.%u.%u.%u.%u"
-#endif
-        , ( uint32_t ) GetRCModule ( self )
-        , ( uint32_t ) GetRCTarget ( self )
-        , ( uint32_t ) GetRCContext ( self )
-        , ( uint32_t ) GetRCObject ( self )
-        , ( uint32_t ) GetRCState ( self )
-    );
-}
-
-LIB_EXPORT rc_t CC RCExplain ( rc_t rc, char *buffer, size_t bsize, size_t *num_writ )
-{
-    return RCExplain2
-        ( rc, buffer, bsize, num_writ, eRCExOpt_CompleteMsg );
-}
-
-LIB_EXPORT rc_t CC RCExplain2 ( rc_t rc, char *buffer, size_t bsize, size_t *num_writ,
-                                enum ERCExplain2Options options )
-{
-    bool noMessageIfNoError =
-        (options == eRCExOpt_NoMessageIfNoError || 
-         options == eRCExOpt_ObjAndStateOnlyIfError);
-    int len;
-    size_t total = 0;
-
-    const char *mod = GetRCModuleText ( GetRCModule ( rc ) );
-    const char *targ = GetRCTargetText ( GetRCTarget ( rc ) );
-    const char *ctx = GetRCContextText ( GetRCContext ( rc ) );
-    const char *obj = GetRCObjectText ( GetRCObject ( rc ) );
-    const char *state = GetRCStateText ( GetRCState ( rc ) );
-
-    assert( buffer && num_writ );
-
-    *num_writ = 0;
-    if( rc == 0 && noMessageIfNoError ) {
-        buffer[0] = '\0';
-        return 0;
-    }
-
-    /* English'ish formatting */
-#if _DEBUGGING
-    {
-        const char *function = GetRCFunction ();
-        if ( function != NULL )
-        {
-            len = snprintf(buffer + total, bsize - total, "%s:%u:%s: ", GetRCFilename(), GetRCLineno (), function );
-            if( len < 0 || ( total + len ) >= bsize ) {
-                return RCLiteral ( rc, buffer, bsize, num_writ );
-            }
-            total += len;
-        }
-    }
-#elif RECORD_RC_FILE_LINE
-    ( void ) GetRCLineno ();
-#endif
-    if( obj != NULL ) {
-        len = snprintf(buffer + total, bsize - total, "%s", obj);
-        if( len < 0 || ( total + len ) >= bsize ) {
-            return RCLiteral ( rc, buffer, bsize, num_writ );
-        }
-        total += len;
-    }
-    if( state != NULL ) {
-        len = snprintf(buffer + total, bsize - total, "%s%s", total ? " " : "", state);
-        if( len < 0 || ( total + len ) >= bsize ) {
-            return RCLiteral ( rc, buffer, bsize, num_writ );
-        }
-        total += len;
-    }
-    if( rc != 0 && options == eRCExOpt_CompleteMsg ) {
-        if( ctx != NULL ) {
-            len = snprintf ( buffer + total, bsize - total, "%swhile %s", total ? " " : "", ctx );
-            if ( len < 0 || ( total + len ) >= bsize ) {
-                return RCLiteral ( rc, buffer, bsize, num_writ );
-            }
-            total += len;
-            if( targ != NULL ) {
-                len = snprintf ( buffer + total, bsize - total, "%s%s", total ? " " : "", targ );
-                if( len < 0 || ( total + len ) >= bsize ) {
-                    return RCLiteral ( rc, buffer, bsize, num_writ );
-                }
-                total += len;
-            }
-        } else if( targ != NULL ) {
-            len = snprintf ( buffer + total,
-                bsize - total, "%swhile acting upon %s", total ? " " : "", targ );
-            if( len < 0 || ( total + len ) >= bsize ) {
-                return RCLiteral ( rc, buffer, bsize, num_writ );
-            }
-            total += len;
-        }
-    }
-    if( mod != NULL && options == eRCExOpt_CompleteMsg ) {
-        len = snprintf(buffer + total, bsize - total, "%swithin %s module", total ? " " : "", mod);
-        if( len < 0 || ( total + len ) >= bsize ) {
-            return RCLiteral ( rc, buffer, bsize, num_writ );
-        }
-        total += len;
-    }
-    *num_writ = total;
-    return 0;
-}
-
-/*--------------------------------------------------------------------------
- * RC
- */
-
-
-/* GetRCModuleText
- */
-const char *GetRCModuleText ( enum RCModule mod )
-{
-    if ( ( int ) mod < 0 || ( int ) mod >= ( int ) rcLastModule_v1_1 )
-        return "<INVALID-MODULE>";
-    return gRCModule_str [ ( int ) mod ];
-}
-
-/* GetRCModuleIdxText
- */
-const char *GetRCModuleIdxText ( enum RCModule mod )
-{
-    if ( ( int ) mod < 0 || ( int ) mod >= ( int ) rcLastModule_v1_1 )
-        return "<INVALID-MODULE>";
-    return gRCModuleIdx_str [ ( int ) mod ];
-}
-
-/* GetRCTargetText
- */
-const char *GetRCTargetText ( enum RCTarget targ )
-{
-    if ( ( int ) targ < 0 || ( int ) targ >= ( int ) rcLastTarget_v1_1 )
-        return "<INVALID-TARGET>";
-    return gRCTarget_str [ ( int ) targ ];
-}
-
-/* GetRCTargetIdxText
- */
-const char *GetRCTargetIdxText ( enum RCTarget targ )
-{
-    if ( ( int ) targ < 0 || ( int ) targ >= ( int ) rcLastTarget_v1_1 )
-        return "<INVALID-TARGET>";
-    return gRCTargetIdx_str [ ( int ) targ ];
-}
-
-/* GetRCContextText
- */
-const char *GetRCContextText ( enum RCContext ctx )
-{
-    if ( ( int ) ctx < 0 || ( int ) ctx >= ( int ) rcLastContext_v1_1 )
-        return "<INVALID-CONTEXT>";
-    return gRCContext_str [ ( int ) ctx ];
-}
-
-/* GetRCContextIdxText
- */
-const char *GetRCContextIdxText ( enum RCContext ctx )
-{
-    if ( ( int ) ctx < 0 || ( int ) ctx >= ( int ) rcLastContext_v1_1 )
-        return "<INVALID-CONTEXT>";
-    return gRCContextIdx_str [ ( int ) ctx ];
-}
-
-/* GetRCObjectText
- */
-const char *GetRCObjectText ( int obj )
-{
-    if ( ( int ) obj < 0 || ( int ) obj >= ( int ) rcLastObject_v1_1 )
-        return "<INVALID-OBJECT>";
-    if ( ( int ) obj < ( int ) rcLastTarget_v1_1 )
-        return gRCTarget_str [ ( int ) obj ];
-    return gRCObject_str [ ( int ) obj - ( int ) ( rcLastTarget_v1_1 - 1 ) ];
-}
-
-/* GetRCObjectIdxText
- */
-const char *GetRCObjectIdxText ( int obj )
-{
-    if ( ( int ) obj < 0 || ( int ) obj >= ( int ) rcLastObject_v1_1 )
-        return "<INVALID-OBJECT>";
-    if ( ( int ) obj < ( int ) rcLastTarget_v1_1 )
-        return gRCTargetIdx_str [ ( int ) obj ];
-    return gRCObjectIdx_str [ ( int ) obj - ( int ) ( rcLastTarget_v1_1 - 1 ) ];
-}
-
-/* GetRCStateText
- */
-const char *GetRCStateText ( enum RCState state )
-{
-    if ( ( int ) state < 0 || ( int ) state >= ( int ) rcLastState_v1_1 )
-        return "<INVALID-STATE>";
-    return gRCState_str [ ( int ) state ];
-}
-
-/* GetRCStateIdxText
- */
-const char *GetRCStateIdxText ( enum RCState state )
-{
-    if ( ( int ) state < 0 || ( int ) state >= ( int ) rcLastState_v1_1 )
-        return "<INVALID-STATE>";
-    return gRCStateIdx_str [ ( int ) state ];
-}
-
-static
-uint32_t read_rc_loc_head ( void )
-{
-    int32_t idx = atomic32_read ( & RC_loc_written );
-    atomic32_set ( & RC_loc_read, idx );
-    return idx;
-}
-
-static
-const char *get_rc_filename ( uint32_t idx )
-{
-    const char *p = RC_loc_queue [ idx & RC_LOC_QUEUE_MASK ] . filename;
-    if( p != NULL )
-    {
-        int i;
-        const char *sep;
-        const char *RC_filename = p;
-#if WINDOWS
-        static char win_rc_filename [ 4096 ];
-        size_t w, len = string_copy_measure ( win_rc_filename, sizeof win_rc_filename - 1, p );
-        if ( len >= 2 && isalpha ( win_rc_filename [ 0 ] ) && win_rc_filename [ 1 ] == ':' )
-        {
-            win_rc_filename [ 1 ] = win_rc_filename [ 0 ];
-            win_rc_filename [ 0 ] = '/';
-        }
-        for ( w = 0; w < len; ++ w )
-        {
-            if ( win_rc_filename [ w ] == '\\' )
-                win_rc_filename [ w ] = '/';
-        }
-        p = RC_filename = win_rc_filename;
-#endif
-        if ( (p = strstr(RC_filename, "/interfaces/")) != NULL ||
-             (p = strstr(RC_filename, "/libs/")) != NULL ||
-             (p = strstr(RC_filename, "/services/")) != NULL ||
-             (p = strstr(RC_filename, "/tools/")) != NULL ||
-             (p = strstr(RC_filename, "/asm-trace/")) != NULL )
-        {
-            return p + 1;
-        }
-
-        for ( i = 0, sep = strrchr ( p = RC_filename, '/' ); sep != NULL && i < 3; ++ i )
-        {
-            p = sep + 1;
-            sep = string_rchr ( RC_filename, sep - RC_filename, '/' );
-        }
-    }
-
-    return p;
-}
-
-LIB_EXPORT const char * CC GetRCFilename ( void )
-{
-    return get_rc_filename ( read_rc_loc_head () );
-}
-
-/* InsertSpace
- *  inserts a division after current text
- *
- *  "spacer" [ IN, NULL OKAY ] - optional characters to insert
- */
-LIB_EXPORT rc_t CC LogInsertSpace(const char *spacer, char *buffer, size_t bsize, size_t *num_writ)
-{
-    int len;
-
-    if ( spacer == NULL )
-    {
-        if ( bsize < 2 )
-            return RC ( rcRuntime, rcLog, rcLogging, rcBuffer, rcInsufficient );
-        buffer [ 0 ] = ' ';
-        buffer [ 1 ] = 0;
-        * num_writ = 1;
-        return 0;
-    }
-
-    len = snprintf ( buffer, bsize, "%s", spacer );
-
-    * num_writ = len;
-
-    if ( len < 0 || (size_t)len >= bsize )
-    {
-        if ( len < 0 )
-            * num_writ = 0;
-        return RC ( rcRuntime, rcLog, rcLogging, rcBuffer, rcInsufficient );
-    }
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC LogAppName(char *buffer, size_t bsize, size_t *num_writ)
-{
-    if( wrt_app_length > bsize ) {
-        return RC(rcRuntime, rcLog, rcLogging, rcBuffer, rcInsufficient);
-    }
-    memcpy(buffer, wrt_app, wrt_app_length);
-    *num_writ = wrt_app_length;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC LogAppVersion(char *buffer, size_t bsize, size_t *num_writ)
-{
-    if( wrt_vers_length > bsize ) {
-        return RC(rcRuntime, rcLog, rcLogging, rcBuffer, rcInsufficient);
-    }
-    memcpy(buffer, wrt_vers, wrt_vers_length);
-    *num_writ = wrt_vers_length;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC LogFlush ( const KWrtHandler* handler, const char *buffer, const size_t bsize)
-{
-    rc_t rc = 0;
-    size_t num_written;
-    size_t remaining;
-
-    assert(handler != NULL);
-    assert(buffer != NULL);
-
-    for(remaining = bsize; rc == 0 && remaining > 0; remaining -= num_written, buffer += num_written) {
-        rc = handler->writer(handler->data, buffer, remaining, &num_written);
-    }
-    return rc;
-}
-
-static
-const char *get_rc_function ( uint32_t idx )
-{
-    return RC_loc_queue [ idx & RC_LOC_QUEUE_MASK ] . function;
-}
-
-LIB_EXPORT const char * CC GetRCFunction ( void )
-{
-    return get_rc_function ( read_rc_loc_head () );
-}
-
-static
-uint32_t get_rc_lineno ( uint32_t idx )
-{
-    return RC_loc_queue [ idx & RC_LOC_QUEUE_MASK ] . lineno;
-}
-
-LIB_EXPORT uint32_t CC GetRCLineno ( void )
-{
-    return get_rc_lineno ( read_rc_loc_head () );
-}
-
-static
-rc_t get_rc_code ( uint32_t idx )
-{
-    return RC_loc_queue [ idx & RC_LOC_QUEUE_MASK ] . rc;
-}
-
-LIB_EXPORT rc_t CC SetRCFileFuncLine ( rc_t rc, const char *filename, const char *funcname, uint32_t lineno )
-{
-    /* the limit based upon last guy successfully written */
-    int32_t lim = atomic32_read ( & RC_loc_written ) + RC_LOC_QUEUE_SIZE;
-
-    /* try to reserve a slot for writing */
-    int32_t rsrv = atomic32_read_and_add_lt ( & RC_loc_reserve, 1, lim ) + 1;
-
-    /* see if we got the reservation */
-    if ( rsrv <= lim )
-    {
-        uint32_t idx = rsrv & RC_LOC_QUEUE_MASK;
-        RC_loc_queue [ idx ] . filename = filename;
-        RC_loc_queue [ idx ] . function = funcname;
-        RC_loc_queue [ idx ] . lineno = lineno;
-        RC_loc_queue [ idx ] . rc = rc;
-        /* TBD - proper release sequence */
-        atomic32_set ( & RC_loc_written, rsrv );
-    }
-
-    return rc;
-}
-
-/* GetUnreadRCInfo
- *  expected to be called after all threads are quiet
- */
-LIB_EXPORT bool CC GetUnreadRCInfo ( rc_t *rc, const char **filename, const char **funcname, uint32_t *lineno )
-{
-    /* these are not atomic, but the ordering is important */
-    int32_t last_writ = atomic32_read ( & RC_loc_written );
-    if ( last_writ > 0 )
-    {
-        /* this arrangement attempts to make the access to
-           RC_loc_read dependent upon access to RC_loc_written */
-        int32_t last_read = atomic32_read ( & RC_loc_read );
-        if ( last_read < last_writ )
-        {
-            /* check reserved slots */
-            int32_t rsrv = atomic32_read ( & RC_loc_reserve );
-
-            /* adjust last read */
-            if ( last_writ - last_read > RC_LOC_QUEUE_SIZE )
-                last_read = last_writ - RC_LOC_QUEUE_SIZE;
-
-            /* any reserved rows must be considered overwritten */
-            last_read += rsrv - last_writ;
-
-            /* these are the rows we can report */
-            if ( last_read < last_writ )
-            {
-                int32_t idx = last_read + 1;
-                atomic32_set ( & RC_loc_read, idx );
-
-                if ( filename != NULL )
-                    * filename = get_rc_filename ( idx );
-                if ( funcname != NULL )
-                    * funcname = get_rc_function ( idx );
-                if ( lineno != NULL )
-                    * lineno = get_rc_lineno ( idx );
-                if ( rc != NULL )
-                    * rc = get_rc_code ( idx );
-
-                return true;
-            }
-        }
-    }
-    return false;
-}
diff --git a/libs/kns/Makefile b/libs/kns/Makefile
deleted file mode 100644
index 86869fe..0000000
--- a/libs/kns/Makefile
+++ /dev/null
@@ -1,132 +0,0 @@
-# ===========================================================================
-#
-#                            PUBLIC DOMAIN NOTICE
-#               National Center for Biotechnology Information
-#
-#  This software/database is a "United States Government Work" under the
-#  terms of the United States Copyright Act.  It was written as part of
-#  the author's official duties as a United States Government employee and
-#  thus cannot be copyrighted.  This software/database is freely available
-#  to the public for use. The National Library of Medicine and the U.S.
-#  Government have not placed any restriction on its use or reproduction.
-#
-#  Although all reasonable efforts have been taken to ensure the accuracy
-#  and reliability of the software and data, the NLM and the U.S.
-#  Government do not and cannot warrant the performance or results that
-#  may be obtained by using this software or data. The NLM and the U.S.
-#  Government disclaim all warranties, express or implied, including
-#  warranties of performance, merchantability or fitness for any particular
-#  purpose.
-#
-#  Please cite the author in any work or product based on this material.
-#
-# ===========================================================================
-
-default: all
-
-TOP ?= $(shell ../../build/abspath.sh ../..)
-MODULE = libs/kns
-
-INT_LIBS = \
-	libkns
-
-ALL_LIBS = \
-	$(INT_LIBS)
-
-TEST_TOOLS = \
-
-include $(TOP)/build/Makefile.env
-
-RWORKDIR = $(TOP)/$(MODULE)
-
-#-------------------------------------------------------------------------------
-# outer targets
-#
-
-# we are building it on all platforms now, because dependency on libcurl is removed
-all std: makedirs
-	@ $(MAKE_CMD) $(TARGDIR)/std
-
-$(INT_LIBS): makedirs
-	@ $(MAKE_CMD) $(ILIBDIR)/$@
-
-$(TEST_TOOLS): makedirs
-	@ $(MAKE_CMD) $(TEST_BINDIR)/$@
-
-.PHONY: all std $(ALL_LIBS)
-
-#-------------------------------------------------------------------------------
-# std
-#
-$(TARGDIR)/std: \
-	$(addprefix $(ILIBDIR)/,$(INT_LIBS))
-
-.PHONY: $(TARGDIR)/std
-
-#-------------------------------------------------------------------------------
-# clean
-#
-clean: stdclean
-
-.PHONY: clean
-
-#-------------------------------------------------------------------------------
-# kns
-#
-$(ILIBDIR)/libkns: $(addprefix $(ILIBDIR)/libkns.,$(ILIBEXT))
-
-KNS_NO_HTTP_SRC = \
-	kns_manager-ext \
-	manager \
-	stream \
-	stream-from-files \
-	stream-from-streams \
-	endpoint \
-	sysendpoint \
-	syssock \
-	sysstream \
-    sysmgr
-
-ifneq (win,$(OS))
-KNS_NO_HTTP_SRC += \
-	syspoll
-endif
-
-KNS_SRC = \
-	$(KNS_NO_HTTP_SRC) \
-	http \
-	undyinghttp
-
-KNS_OBJ = \
-	$(addsuffix .$(LOBX),$(KNS_SRC))
-
-KNS_LIB = \
-    -lkfs \
-	-dklib
-
-$(ILIBDIR)/libkns.$(LIBX): $(KNS_OBJ)
-	$(LD) --slib -o $@ $^ $(KNS_LIB)
-
-
-#-------------------------------------------------------------------------------
-# white-box test
-#
-
-TEST_SRC = \
-	http-test
-
-TEST_OBJ = \
-	$(addsuffix .$(OBJX),$(TEST_SRC))
-
-TEST_LIB = \
-	-skapp \
-    -skns \
-	-svfs \
-	-skrypto \
-	-skfg \
-	-skfs \
-	-skproc \
-	-sklib 
-
-$(TEST_BINDIR)/test-http: $(TEST_OBJ)
-	$(LD) --exe -o $@ $^ $(TEST_LIB)
diff --git a/libs/kns/endpoint.c b/libs/kns/endpoint.c
deleted file mode 100644
index 6cb8e12..0000000
--- a/libs/kns/endpoint.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kns/impl.h>
-#include <kns/endpoint.h>
-#include <klib/text.h>
-#include <klib/rc.h>
-
-#include "stream-priv.h"
-
-#include <string.h>
-#include <assert.h>
-
-#include <sysalloc.h>
-
-
-/* InitIPv4Endpoint
- *  initialize the endpoint with an IPv4 address and port
- *
- *  "ep" [ OUT ] - address of endpoint block to be intialized
- *
- *  "ipv4" [ IN, DEFAULT 0 ] - binary IPv4 address in native integer byte order
- *   i.e. 0x7F000001 represents 127.0.0.1. if the special address 0 is given, it
- *   represents any host-local interface address.
- *
- *  "port" [ IN, DEFAULT 0 ] - binary port number in native integer byte order.
- *   if the special port number 0 is given, it represents any available port.
- */
-LIB_EXPORT 
-rc_t CC KNSManagerInitIPv4Endpoint ( struct KNSManager const *self,
-    KEndPoint *ep, uint32_t ipv4, uint16_t port )
-{
-    rc_t rc;
-
-    if ( ep == NULL )
-        rc = RC ( rcNS, rcNoTarg, rcInitializing, rcParam, rcNull);
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcNS, rcNoTarg, rcInitializing, rcSelf, rcNull );
-        else
-        {
-            ep -> type = epIPV4;
-            ep -> u . ipv4. addr = ipv4;
-            ep -> u. ipv4 . port = port;
-            return 0;
-        }
-
-        memset ( ep, 0, sizeof * ep );
-    }
-    return rc;
-}
-
-/* InitIPCEndpoint
- *  initialize the endpoint for interprocess communication
- *
- *  "ep" [ OUT ] - address of endpoint block to be intialized
- *
- *  "name" [ IN ] - IPC channel name (a POSIX path to a Unix socket, or a name of a Windows pipe)
- */
-LIB_EXPORT 
-rc_t CC KNSManagerInitIPCEndpoint ( struct KNSManager const *self,
-    KEndPoint *ep, struct String const * name )
-{
-    rc_t rc;
-
-    if ( ep == NULL )
-        rc = RC ( rcNS, rcNoTarg, rcInitializing, rcParam, rcNull);
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcNS, rcNoTarg, rcInitializing, rcSelf, rcNull );
-        else
-        {
-            size_t copied = string_copy(ep -> u.ipc_name, IPC_NAME_MAX - 1, name->addr, name->len);
-            if (copied != name->len)
-                rc = RC ( rcNS, rcNoTarg, rcInitializing, rcSize, rcExcessive );
-            ep -> u.ipc_name[copied] = 0;
-            ep -> type = epIPC;
-            return 0;
-        }
-
-        memset ( ep, 0, sizeof * ep );
-    }
-    return rc;
-}
diff --git a/libs/kns/http-priv.h b/libs/kns/http-priv.h
deleted file mode 100644
index 0808e52..0000000
--- a/libs/kns/http-priv.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_http_priv_
-#define _h_http_priv_
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifndef _h_klib_text_
-#include <klib/text.h>
-#endif
-
-#ifndef _h_klib_data_buffer
-#include <klib/data-buffer.h>
-#endif
-
-#ifndef _h_klib_container
-#include <klib/container.h>
-#endif
-
-#ifndef MAX_HTTP_READ_LIMIT
-#define MAX_HTTP_READ_LIMIT ( 30 * 1000 )
-#endif
-
-#ifndef MAX_HTTP_WRITE_LIMIT
-#define MAX_HTTP_WRITE_LIMIT ( 15 * 1000 )
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-    
-struct KFile;
-struct KHttp;
-struct KNSManager;
-struct KStream;
-struct timeout_t;
-
-/*--------------------------------------------------------------------------
- * URLBlock
- *  RFC 3986
- */
-typedef struct URLBlock URLBlock;
-struct URLBlock
-{
-    String scheme;
-    String host;
-    String path; /* Path includes any parameter portion */
-    String query;
-    String fragment;
-
-    uint32_t port;
-};
-extern void URLBlockInit ( URLBlock *self );
-extern rc_t ParseUrl ( URLBlock * b, const char * url, size_t url_size );
-
-/*--------------------------------------------------------------------------
- * KHttpHeader
- *  node structure to place http header lines into a BSTree
- */
-typedef struct KHttpHeader KHttpHeader;
-struct KHttpHeader
-{
-    BSTNode dad;
-    String name;
-    String value;
-    KDataBuffer value_storage;
-};
-    
-extern void KHttpHeaderWhack ( BSTNode *n, void *ignore );
-extern rc_t KHttpGetHeaderLine ( struct KHttp *self, struct timeout_t *tm, BSTree *hdrs, bool *blank, bool *close_connection );
-extern rc_t KHttpGetStatusLine ( struct KHttp *self, struct timeout_t *tm, String *msg, uint32_t *status, ver_t *version );
-
-/* exported private functions
-*/
-extern rc_t HttpTest ( struct KFile const *input );
-extern void URLBlockInitTest ( void );
-extern rc_t ParseUrlTest ( void );
-extern rc_t MakeRequestTest ( void );    
-
-/* tmp fix */
-rc_t SecretKNSManagerMakeHttpFile(const struct KNSManager *self,
-    const struct KFile **file, struct KStream *conn, ver_t vers, const char *url, ...);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kttp_priv_ */
-
-
diff --git a/libs/kns/http-test.c b/libs/kns/http-test.c
deleted file mode 100644
index 3f0de53..0000000
--- a/libs/kns/http-test.c
+++ /dev/null
@@ -1,368 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kapp/args.h>
-#include <kapp/main.h>
-
-#include <kns/manager.h>
-#include <kns/endpoint.h>
-#include <kns/socket.h>
-#include <kns/stream.h>
-#include <kns/http.h>
-#include <kns/impl.h>
-#include <kns/adapt.h>
-#include <kfg/config.h>
-#include <kfs/file.h>
-#include <kfs/directory.h>
-#include <klib/text.h>
-#include <klib/out.h>
-#include <klib/rc.h>
-#include <klib/refcount.h>
-#include <klib/container.h>
-
-#include "stream-priv.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <sysalloc.h>
-
-#include "http-priv.h"
-
-
-void URLBlockInitTest ( void )
-{
-    URLBlock b;
-    URLBlockInit ( & b );
-    
-    OUTMSG ( ( "%s - URLBlockInit succeeded.\n"
-               "scheme  : '%S'\n"
-               "host    : '%S'\n"
-               "path    : '%S'\n"
-               "query   : '%S'\n"
-               "fragment: '%S'\n"
-               "port    : '%u'\n\n"
-               , __func__,  & b . scheme, & b . host
-               , & b . path, & b . query, & b . fragment, b . port ) );
-    
-}
-
-
-rc_t ParseUrlTest ( void )
-{
-    rc_t rc;
-    size_t i;
-    
-    static const char *test_urls [] =
-        {
-            /* <scheme>://<host>[:<port>]/<path>[?<query>][#<fragment>]*/
-            /*0*/ "http://www.abc.com/library/index.html?x&y=123&z=test#ignore-me",
-            /*1*/ "http://www.abc.com:123/library/index.html?x&y=123&z=test#ignore-me",
-            /*2*/ "HTTP://www.abc.com:123/library/index.html?x&y=123&z=test#ignore-me",
-            /* <scheme>://<host>[:<port>]/<path>[#<fragment>]*/
-            /*3*/ "http://www.abc.com/library/index.html#ignore-me",
-            /*4*/ "http://www.abc.com:123/library/index.html#ignore-me",
-            /* <scheme>://<host>[:<port>]/<path>[?<query>]*/
-            /*5*/ "http://www.abc.com/library/index.html?x&y=123&z=test",
-            /*6*/ "http://www.abc.com:123/library/index.html?x&y=123&z=test",
-            /* <scheme>://<host>[:<port>]/<path>*/
-            /*7*/ "http://www.abc.com/library/index.html",
-            /*8*/ "http://www.abc.com:80/library/index.html",
-            /* <scheme>://<host>[:<port>]*/
-            /*9*/ "http://www.abc.com",
-            /*10*/ "http://www.abc.com:80",
-            /* /<path>[#fragment]*/
-            /*11*/ "/library/index.html#ignore-me",
-            /* /<path>[?query]*/
-            /*12*/ "/library/index.html?x&y=123&z=test",
-            /*13*/ "///library"
-            
-            
-        };
-    const size_t num_urls = sizeof test_urls / sizeof test_urls [ 0 ];
-    
-    static const char *fail_url [] = 
-        {
-            /*<scheme>:/<path>*/
-            /*0*/ "http:/library/index.html",
-            /*1*/ "http//library/index.html",
-            /*<scheme>:/[#fragment]*/
-            /*2*/ "http:#ignore-me",
-            /*<scheme>:/[#query]*/
-            /*3*/ "http:?x&y=123&z=test",
-            /*<scheme>*/
-            /*4*/ "http",
-            /*5*/ "ftp",
-            /* <host>[:<port>]*/
-            /*6*/ "www.abc.com",
-            /*7*/ "www.abc.com:80",
-            /* <scheme>://<host>[:<port>]*/
-            /*8*/ "ftp://www.abc.com"
-            
-            
-        };
-    const size_t num_fail_urls = sizeof fail_url / sizeof fail_url [ 0 ];
-    
-    for ( i = 0; i < num_urls; ++ i )
-    {
-        URLBlock b;
-        
-        String url;
-        StringInitCString ( & url, test_urls [ i ] );
-        
-        rc  = ParseUrl ( & b, url . addr, url . size );
-        if ( rc == 0 )
-        {
-            /* same as above */
-            OUTMSG ( ( "%s - ParseUrl succeeded -- %d: %s\n"
-                       "scheme  : '%S'\n"
-                       "host    : '%S'\n"
-                       "path    : '%S'\n"
-                       "query   : '%S'\n"
-                       "fragment: '%S'\n"
-                       "port    : '%u'\n\n"
-                       , __func__, i, test_urls [ i ], & b . scheme, & b . host
-                       , & b . path, & b . query, & b . fragment, b . port ) );
-        }
-        else
-        {
-            /* same as above. analyze your code more */
-            OUTMSG (( "%s: ParseUrl failed on iteration: '%d' url: %s\n"
-                      "with rc=%R\n\n", __func__, i, test_urls [ i ], rc ));
-            return rc;
-        }
-    }
-    
-    
-    for ( i = 0; i < num_fail_urls; ++ i )
-    {
-        URLBlock b;
-        
-        String url;
-        StringInitCString ( & url, fail_url [ i ] );
-        
-        rc  = ParseUrl ( & b, url . addr, url . size );
-        if ( rc != 0 )
-        {
-            /* same as above */
-            OUTMSG ( ( "%s - ParseUrl succeeded in catching error-- %d: %s\n"
-                       "scheme  : '%S'\n"
-                       "host    : '%S'\n"
-                       "path    : '%S'\n"
-                       "query   : '%S'\n"
-                       "fragment: '%S'\n"
-                       "port    : '%u'\n\n"
-                       , __func__, i, fail_url [ i ], & b . scheme, & b . host
-                       , & b . path, & b . query, & b . fragment, b . port ) );
-        }
-        else
-        {
-            /* same as above. analyze your code more */
-            OUTMSG (( "%s: ParseUrl failed catching error on iteration: '%d' url: %s\n"
-                      "with rc=%R\n\n", __func__, i, fail_url [ i ], rc ));
-            return rc;
-        }
-    }
-    
-    return rc = 0;
-}
-
-rc_t HttpTest ( const KFile *input )
-{
-
-    KNSManager *mgr;
-
-    rc_t rc = KNSManagerMake ( & mgr );
-    if ( rc == 0 )
-    {
-        KStream *sock;
-        rc = KStreamFromKFilePair ( & sock, input, NULL );
-        if ( rc == 0 )
-        {
-            struct KHttp *http;
-
-            String host;
-            CONST_STRING ( & host, "www.ncbi.nlm.nih.gov" );
-
-            rc = KNSManagerMakeHttp ( mgr, & http, sock, 0x01010000, & host, 80 );
-            if ( rc == 0 )
-            {
-                String msg;
-                ver_t version;
-                uint32_t status;
-
-                rc = KHttpGetStatusLine ( http, NULL, &msg, &status, &version );
-                if ( rc != 0 )
-                    OUTMSG (( "%s: KHttpGetStatusLine failed with rc=%R\n", __func__, rc ));
-                else
-                {
-                    bool blank, close_connection;
-                    BSTree hdrs;
-                    OUTMSG (( "%s: KHttpGetStatusLine returned msg='%S', status=%u, version=%V\n",
-                              __func__, & msg, status, version ));
-
-                    BSTreeInit ( & hdrs );
-
-                    for ( blank = close_connection = false; ! blank && rc == 0; )
-                        rc = KHttpGetHeaderLine ( http, NULL, & hdrs, & blank, & close_connection );
-                    
-                    if ( rc != 0 )
-                        OUTMSG (( "%s: KHttpGetHeaderLine failed with rc=%R\n", __func__, rc ));
-                    else
-                    {
-                        const KHttpHeader * hdr;
-                        
-                        OUTMSG (( "%s: KHttpGetStatusLine listing:\n", __func__ ));
-                        for ( hdr = ( const KHttpHeader * ) BSTreeFirst ( & hdrs ); 
-                              hdr != NULL;
-                              hdr = ( const KHttpHeader * ) BSTNodeNext ( & hdr -> dad ) )
-                        {
-                            OUTMSG (( "    name='%S', value='%S'\n", & hdr -> name, & hdr -> value ));
-                        }
-                    }
-
-                    BSTreeWhack ( & hdrs, KHttpHeaderWhack, NULL );
-
-                }
-
-                KHttpRelease ( http );
-            }
-
-            KStreamRelease ( sock );
-        }
-
-        KNSManagerRelease ( mgr );
-    }
-
-    return rc;
-}
-
-rc_t PreHttpTest ( void )
-{
-    KDirectory *dir;
-    rc_t rc = KDirectoryNativeDir ( &dir );
-    if ( rc == 0 )
-    {
-        const KFile *f;
-        rc = KDirectoryOpenFileRead ( dir, &f, "nih_1_out.txt" );
-        if ( rc == 0 )
-        {
-            rc = HttpTest ( f );
-            KFileRelease ( f );
-        }
-
-        KDirectoryRelease ( dir );
-    }
-    return rc;
-}
-
-/* Version  EXTERN
- *  return 4-part version code: 0xMMmmrrrr, where
- *      MM = major release
- *      mm = minor release 
- *    rrrr = bug-fix release
- */
-ver_t CC KAppVersion ( void )
-{
-    return 0;
-}
-
-
-/* Usage
- *  This function is called when the command line argument
- *  handling sees -? -h or --help
- */
-rc_t CC UsageSummary ( const char *progname )
-{
-    /*    return KOutMsg (
-        "\n"
-        "Usage:\n"
-        "  %s [Options]\n"
-        "\n"
-        "Summary:\n"
-        "  Simple test of printf.\n"
-        , progname );
-    */
-    return 0;
-}
-
-const char UsageDefaultName[] = "time-test";
-
-rc_t CC Usage ( const Args *args )
-{
-    /*
-    const char * progname = UsageDefaultName;
-    const char * fullpath = UsageDefaultName;
-    rc_t rc;
-
-    if (args == NULL)
-        rc = RC (rcApp, rcArgv, rcAccessing, rcSelf, rcNull);
-    else
-        rc = ArgsProgram (args, &fullpath, &progname);
-
-    UsageSummary (progname);
-
-    KOutMsg ("Options:\n");
-
-    HelpOptionsStandard();
-
-    HelpVersion (fullpath, KAppVersion());
-
-    return rc;
-    */
-    return 0;
-}
-
-    
-static
-rc_t run ( const char *progname )
-{
-    rc_t rc = 0;
-
-    URLBlockInitTest ();
-    rc = ParseUrlTest ();
-    rc = PreHttpTest ();      
-
-    return rc;
-}
-
-/* KMain
- */
-rc_t CC KMain ( int argc, char *argv [] )
-{
-    Args *args;
-    rc_t rc = ArgsMakeAndHandle ( & args, argc, argv, 0 );
-    if ( rc == 0 )
-    {
-        KConfigDisableUserSettings();
-        rc = run ( argv [ 0 ] );
-        ArgsWhack ( args );
-    }
-
-    return rc;
-}
-
diff --git a/libs/kns/http.c b/libs/kns/http.c
deleted file mode 100644
index 44d5965..0000000
--- a/libs/kns/http.c
+++ /dev/null
@@ -1,3158 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <kns/extern.h>
-
-#define KSTREAM_IMPL KHttpStream
-typedef struct KHttpStream KHttpStream;
-
-#define KFILE_IMPL KHttpFile
-typedef struct KHttpFile KHttpFile;
-#include <kfs/impl.h>
-
-#include <kns/manager.h>
-#include <kns/http.h>
-#include <kns/adapt.h>
-#include <kns/endpoint.h>
-#include <kns/socket.h>
-#include <kns/stream.h>
-#include <kns/impl.h>
-#include <kfs/file.h>
-#include <kfs/directory.h>
-
-#include <klib/debug.h> /* DBGMSG */
-#include <klib/text.h>
-#include <klib/container.h>
-#include <klib/out.h>
-#include <klib/log.h>
-#include <klib/refcount.h>
-#include <klib/rc.h>
-#include <klib/printf.h>
-#include <klib/vector.h>
-#include <kproc/timeout.h>
-
-#include <os-native.h>
-#include <strtol.h>
-#include <va_copy.h>
-
-#include "mgr-priv.h"
-#include "stream-priv.h"
-
-#include <sysalloc.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-#include "http-priv.h"
-
-static 
-void  KDataBufferClear ( KDataBuffer *buf )
-{
-    memset ( buf, 0, sizeof *buf );
-    buf -> elem_bits = 8;
-}
-
-static
-bool KDataBufferContainsString ( const KDataBuffer *buf, const String *str )
-{
-    return str -> addr >= ( const char* ) buf -> base &&
-        & str -> addr [ str -> size ] <= & ( ( const char* ) buf -> base ) [ buf -> elem_count ];
-}
-
-/*--------------------------------------------------------------------------
- * URLBlock
- *  RFC 3986
- *
- * TBD - replace with VPath
- */
-
-/* Init
- *  Initialize to default values in case portions are missing
- */
-void URLBlockInit ( URLBlock *self )
-{
-    CONST_STRING ( & self -> scheme, "http" );
-    CONST_STRING ( & self -> host, "" );
-    CONST_STRING ( & self -> path, "/" );
-    CONST_STRING ( & self -> query, "" );
-    CONST_STRING ( & self -> fragment, "" );
-    self -> port = 0; /* 0 = DEFAULT 80 for http */
-}
-
-/* ParseUrl
- *  accept standard, full http URL:
- *    <scheme>://<host>[:<port>]/<path>[?<query>][#<fragment>]
- *
- *  scheme can be missing, i.e.:
- *    //<host>[:<port>]/<path>[?<query>][#<fragment>]
- *
- *  we can also accept missing path[query][fragment], i.e.:
- *    <scheme>://<host>[:<port>]
- *    //<host>[:<port>]
- *
- *  finally, we can accept path without host, i.e.:
- *    /<path>[?<query>][#<fragment>]
- *
- *  patterns to reject:
- *    <scheme>:/<path>...    # scheme followed by anything other than '//'
- *    <path>...              # no leading '/'
- */
-rc_t ParseUrl ( URLBlock * b, const char * url, size_t url_size ) 
-{
-    rc_t rc;
-    char * sep;
-    const char * buf = url;
-    const char * end = buf + url_size;
-
-    bool have_host, have_scheme;
-
-    URLBlockInit ( b );
-
-    /* scheme default to false because url may be a path */
-    have_scheme = false;
-
-    /* check if url is empty
-       scheme cannot start with a forward slash - detecting an absolute path */
-    if ( buf < end && buf [ 0 ] != '/' )
-    {
-        /* here we identify the scheme by finding the ':' */
-        sep = string_chr ( url, end - buf, ':' );
-        if ( sep != NULL )
-        {
-            String http;
-            CONST_STRING ( & http, "http" );
-
-            /* assign scheme to the url_block */
-            StringInit ( & b -> scheme, buf, sep - buf, ( uint32_t ) ( sep - buf ) );
-
-            /* check to make sure it is 'http' */
-            if ( ! StringCaseEqual ( & b -> scheme, & http ) )
-            {
-                rc = RC ( rcNS, rcUrl, rcEvaluating, rcName, rcIncorrect );
-                PLOGERR ( klogErr ,( klogErr, rc, "Scheme is '$(scheme)'", "scheme=%S", & b -> scheme ) );
-                return rc;
-            }
-
-            /* accept scheme - skip past */
-            buf = sep + 1;
-            have_scheme = true;
-        }
-    }
-    
-    /* discard fragment - not sending to server, but still record it */
-    sep = string_rchr ( buf, end - buf,  '#' );
-    if ( sep != NULL )
-    {
-        /* advance to first character in fragment */
-        const char *frag = sep + 1;
-
-        /* assign fragment to the url_block */
-        StringInit ( & b -> fragment, frag, end - frag, ( uint32_t ) ( end - frag ) );
-
-        /* remove fragment from URL */
-        end = sep;
-    }
-                         
-    /* detect host */
-    have_host = false;
-    
-    /* check for '//' in the first two elements 
-       will fail if no scheme was detected */
-    if ( string_match ( "//", 2, buf, end - buf, 2, NULL ) == 2 )
-    {
-        /* skip ahead to host spec */
-        buf += 2;
-
-        /* if we ran into the end of the string, we dont have a host */
-        if ( buf == end )
-        {
-            rc = RC ( rcNS, rcUrl, rcParsing, rcOffset, rcIncorrect );
-            PLOGERR ( klogErr ,( klogErr, rc, "expected hostspec in url '$(url)'", "url=%.*s", ( uint32_t ) url_size, url ) );
-            return rc;
-        }
-
-        have_host = true;
-    }
-
-    /* if there is a scheme but no host, error */
-    if ( have_scheme && ! have_host )
-    {
-        rc = RC ( rcNS, rcUrl, rcParsing, rcName, rcNotFound );
-        PLOGERR ( klogErr ,( klogErr, rc, "Host is '$(host)'", "host=%s", "NULL" ) );
-        return rc;
-    }
-        
-    /* find dividing line between host and path, which MUST start with '/' */
-    sep = string_chr ( buf, end - buf, '/' );
-
-    /* detect no path */
-    if ( sep == NULL )
-    {
-        /* no path and no host */
-        if ( ! have_host )
-        {
-            rc = RC ( rcNS, rcUrl, rcParsing, rcName, rcNotFound );
-            PLOGERR ( klogErr ,( klogErr, rc, "Path is '$(path)'", "path=%s", "/" ) );
-            return rc;
-        }
-        /* no path but have host 
-           default value for path is already '/' */
-        sep = ( char* ) end;
-    }
-
-    /* capture host ( could be empty - just given a file system path ) */
-    if ( have_host )
-    {
-        /* assign host to url_block */
-        StringInit ( & b -> host, buf, sep - buf, ( uint32_t ) ( sep - buf ) );
-
-        /* advance to path */
-        buf = sep;
-    }
-
-    /* detect relative path 
-       <hostname>/<path> - OK, handled above
-       /<path> - OK
-    */
-    if ( buf != sep )
-    {
-        rc = RC ( rcNS, rcPath, rcParsing, rcOffset, rcIncorrect );
-        PLOGERR ( klogErr ,( klogErr, rc, "Path is '$(path)'", "path=%s", "NULL" ) );
-        return rc;
-    }
-
-    /* if we dont have a host we must have a path
-       if we DO have a host and the path is not empty */
-    if ( ! have_host || buf != end )
-    {
-        /* check for query */
-        sep = string_chr ( buf, end - buf,  '?' );
-        if ( sep != NULL )
-        {
-            const char *query = sep + 1;
-            /* assign query to url_block */
-            StringInit ( & b -> query, query, end - query, ( uint32_t ) ( end - query ) ); 
-
-            /* advance end to sep */
-            end = sep;
-        }
-
-        /* assign path ( could also be empty ) */
-        StringInit ( & b -> path, buf, end - buf, ( uint32_t ) ( end - buf ) );
-    }
-
-    /* if we have a host, split on ':' to check for a port
-       OK if not found */
-    if ( have_host )
-    {
-        buf = b -> host . addr;
-        end = buf + b -> host . size;
-
-        /* check for port */
-        sep = string_chr ( buf, end - buf,  ':' );
-        if ( sep != NULL )
-        {
-            char *term;
-            const char * port = sep + 1;
-            /* assign port to url block converting to 32 bit int 
-             term should point to end */
-            b -> port = strtou32 ( port, & term, 10 );
-
-            /* error if 0 or term isnt at the end of the buffer */
-            if ( b -> port == 0 || ( const char* ) term != end )
-            {
-                rc = RC ( rcNS, rcUrl, rcParsing, rcNoObj, rcIncorrect );
-                PLOGERR ( klogErr ,( klogErr, rc, "Port is '$(port)'", "port=%u", b -> port ) );
-                return rc;
-            }
-
-            /* assign host to url_block */
-            StringInit ( & b -> host, buf, sep - buf, ( uint32_t ) ( sep - buf ) );
-        }
-    }
-    
-    return 0;
-}
-
-/*--------------------------------------------------------------------------
- * KHttpHeader
- *  node structure to place http header lines into a BSTree
- */
-
-void CC KHttpHeaderWhack ( BSTNode *n, void *ignore )
-{
-    KHttpHeader * self = ( KHttpHeader* ) n;
-    KDataBufferWhack ( & self -> value_storage );
-    free ( self );
-}
-
-static
-int CC KHttpHeaderSort ( const BSTNode *na, const BSTNode *nb )
-{
-    const KHttpHeader *a = ( const KHttpHeader* ) na;
-    const KHttpHeader *b = ( const KHttpHeader* ) nb;
-
-    return StringCaseCompare ( & a -> name, & b -> name );
-}
-
-static
-int CC KHttpHeaderCmp ( const void *item, const BSTNode *n )
-{
-    const String *a = item;
-    const KHttpHeader *b = ( const KHttpHeader * ) n;
-
-    return StringCaseCompare ( a, & b -> name );
-}
-
-/*--------------------------------------------------------------------------
- * KHttp
- *  hyper text transfer protocol 
- *  structure that will act as the 'client' for networking tasks
- */
-struct KHttp
-{
-    const KNSManager *mgr;
-    KStream * sock;
-
-    /* buffer for accumulating response data from "sock" */
-    KDataBuffer block_buffer;
-    size_t block_valid;         /* number of valid response bytes in buffer            */
-    size_t block_read;          /* number of bytes read out by line reader or stream   */
-    size_t body_start;          /* offset to first byte in body                        */
-
-    KDataBuffer line_buffer;    /* data accumulates for reading headers and chunk size */
-    size_t line_valid;
-
-    KDataBuffer hostname_buffer;
-    String hostname; 
-    uint32_t port;
-
-    ver_t vers;
-
-    KRefcount refcount;
-
-    int32_t read_timeout;
-    int32_t write_timeout;
-
-    KEndPoint ep;
-    bool ep_valid;
-};
-
-
-#define KHttpBlockBufferIsEmpty( self ) \
-    ( ( self ) -> block_read == ( self ) -> block_valid )
-
-#define KHttpBlockBufferReset( self ) \
-    ( ( void ) ( ( self ) -> block_valid = ( self ) -> block_read = 0 ) )
-
-#define KHttpLineBufferReset( self ) \
-    ( ( void ) ( ( self ) -> line_valid = 0 ) )
-    
-static
-void KHttpClose ( KHttp *self )
-{
-    KStreamRelease ( self -> sock );
-    self -> sock = NULL;
-}
-
-
-/* used to be in whack function, but we needed the ability
-   to clear out the http object for redirection */
-static
-rc_t KHttpClear ( KHttp *self )
-{
-    KHttpClose ( self );
-
-    KHttpBlockBufferReset ( self );
-    KHttpLineBufferReset ( self );
-
-    KDataBufferWhack ( & self -> hostname_buffer );
-
-    return 0;
-}
-
-static
-rc_t KHttpWhack ( KHttp * self )
-{
-    KHttpClear ( self );
-    
-    KDataBufferWhack ( & self -> block_buffer );
-    KDataBufferWhack ( & self -> line_buffer );
-    KNSManagerRelease ( self -> mgr );
-    KRefcountWhack ( & self -> refcount, "KHttp" );
-    free ( self );
-
-    return 0;
-}
-
-static
-rc_t KHttpOpen ( KHttp * self, const String * hostname, uint32_t port )
-{
-    rc_t rc;
-
-    if ( ! self -> ep_valid )
-    {
-        rc = KNSManagerInitDNSEndpoint ( self -> mgr, & self -> ep, hostname, port );
-        if ( rc != 0 )
-            return rc;
-
-        self -> ep_valid = true;
-    }
-
-    /* TBD - retries? default for now */
-    rc = KNSManagerMakeTimedConnection ( self -> mgr, & self -> sock, self -> read_timeout, self -> write_timeout, NULL, & self -> ep );
-    if ( rc == 0 )
-    {
-        self -> port = port;
-        return 0;
-    }
-
-    self -> sock = NULL;
-    return rc;
-}
-
-/* Initialize KHttp object */
-static
-rc_t KHttpInit ( KHttp * http, const KDataBuffer *hostname_buffer, KStream * conn, ver_t _vers, const String * _host, uint32_t port )
-{
-    rc_t rc;
-
-    if ( port == 0 )
-        port = 80;
-
-    /* we accept a NULL connection ( from ) */
-    if ( conn == NULL )
-        rc = KHttpOpen ( http, _host, port );
-    else
-    {
-        rc = KStreamAddRef ( conn );
-        if ( rc == 0 )
-            http -> sock = conn;
-    }
-
-    if ( rc == 0 )
-    {
-        http -> port = port;
-        http -> vers = _vers & 0xFFFF0000; /* safety measure - limit to major.minor */
-
-
-        /* YOU NEED AN assert HERE TO ENSURE _host IS WITHIN hostname_buffer */
-        assert ( KDataBufferContainsString ( hostname_buffer, _host ) );
-
-        /* initialize hostname buffer from external buffer */
-        rc = KDataBufferSub ( hostname_buffer, &http -> hostname_buffer,
-                              ( _host -> addr - ( const char* ) hostname_buffer -> base ),
-                              _host -> size );
-        if ( rc == 0 )
-            /* Its safe to assign pointer because we know
-               that the pointer is within the buffer */
-            http -> hostname = * _host;
-    }
-    
-    return rc;
-} 
-
-
-/* MakeHttp
- *  create an HTTP protocol
- *
- *  "http" [ OUT ] - return parameter for HTTP object
- *
- *  "opt_conn" [ IN ] - previously opened stream for communications.
- *
- *  "vers" [ IN ] - http version
- *   the only legal types are 1.0 ( 0x01000000 ) and 1.1 ( 0x01010000 )
- *
- *  "host" [ IN ] - parameter to give the host dns name for the connection
- *
- *  "port" [ IN, DEFAULT ZERO ] - if zero, defaults to standard for scheme
- *   if non-zero, is taken as explicit port specification
- */
-static
-rc_t KNSManagerMakeHttpInt ( const KNSManager *self, KHttp **_http,
-    const KDataBuffer *hostname_buffer,  KStream *opt_conn,
-    ver_t vers, int32_t readMillis, int32_t writeMillis,
-    const String *host, uint32_t port )
-{
-    rc_t rc;
-
-    KHttp * http = calloc ( 1, sizeof * http );
-    if ( http == NULL )
-        rc = RC ( rcNS, rcNoTarg, rcAllocating, rcMemory, rcNull );
-    else
-    {
-        rc = KNSManagerAddRef ( self );
-        if ( rc == 0 )
-        {
-            char save, *text;
-
-            http -> mgr = self;
-            http -> read_timeout = readMillis;
-            http -> write_timeout = writeMillis;
-
-            /* Dont use MakeBytes because we dont need to allocate memory
-               and we only need to know that the elem size is 8 bits */
-            KDataBufferClear ( & http -> block_buffer );
-            KDataBufferClear ( & http -> line_buffer );
-
-            /* make sure address of bost is within hostname_buffer */
-            assert ( KDataBufferContainsString ( hostname_buffer, host ) );
-
-            /* SET TEXT TO POINT TO THE HOST NAME AND NUL TERMINATE IT FOR DEBUGGING
-             Its safe to modify the const char array because we allocated the buffer*/ 
-            text = ( char* ) ( host -> addr );
-            save = text [ host -> size ];
-            text [ host -> size ] = 0;
-        
-            /* initialize reference counter on object to 1 - text is now nul-terminated */
-            KRefcountInit ( & http -> refcount, 1, "KHttp", "make", text );
-
-            text [ host -> size ] = save;
-
-            /* init the KHttp object */
-            rc = KHttpInit ( http, hostname_buffer, opt_conn, vers, host, port );
-            if ( rc == 0 )
-            {
-                /* assign to OUT http param */
-                * _http = http;
-                return 0;
-            }
-
-            KNSManagerRelease ( self );
-        }
-                
-        free ( http );
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KNSManagerMakeTimedHttp ( const KNSManager *self,
-    KHttp **_http, KStream *opt_conn, ver_t vers, int32_t readMillis, int32_t writeMillis,
-    const String *host, uint32_t port )
-{
-    rc_t rc;
-    
-    /* check return parameters */
-    if ( _http == NULL )
-        rc = RC ( rcNS, rcMgr, rcConstructing, rcParam, rcNull );
-    else
-    {
-        /* check input parameters */
-        if ( self == NULL )
-            rc = RC ( rcNS, rcMgr, rcConstructing, rcSelf, rcNull );
-        /* make sure we have one of the two versions supported - 1.0, 1.1 */
-        else if ( vers < 0x01000000 || vers > 0x01010000 )
-            rc = RC ( rcNS, rcMgr, rcConstructing, rcParam, rcBadVersion );
-        else if ( host == NULL )
-            rc = RC ( rcNS, rcMgr, rcConstructing, rcPath, rcNull );
-        /* make sure there is data in the host name */
-        else if ( host -> size == 0 )
-            rc = RC ( rcNS, rcMgr, rcConstructing, rcPath, rcEmpty );
-        else
-        {
-            KDataBuffer hostname_buffer;
-
-            /* create storage buffer for hostname */
-            rc = KDataBufferMakeBytes ( & hostname_buffer, host -> size + 1 );
-            if ( rc == 0 )
-            {
-                String _host;
-
-                /* copy hostname with nul termination */
-                string_copy ( hostname_buffer . base, ( size_t ) hostname_buffer . elem_count,
-                              host -> addr, host -> size );
-
-                /* create copy of host that points into new buffer */
-                StringInit ( &_host, hostname_buffer . base, host -> size, host -> len );
-
-                /* limit timeouts */
-                if ( readMillis < 0 )
-                    readMillis = -1;
-                else if ( readMillis > MAX_HTTP_READ_LIMIT )
-                    readMillis = MAX_HTTP_READ_LIMIT;
-                if ( writeMillis < 0 )
-                    writeMillis = -1;
-                else if ( writeMillis > MAX_HTTP_WRITE_LIMIT )
-                    writeMillis = MAX_HTTP_WRITE_LIMIT;
-
-                /* initialize http object - will create a new reference to hostname buffer */
-                rc = KNSManagerMakeHttpInt ( self, _http, & hostname_buffer,
-                    opt_conn, vers, readMillis, writeMillis, &_host, port );
-
-                /* release our reference to buffer */
-                KDataBufferWhack ( & hostname_buffer );
-
-                if ( rc == 0 )
-                    return 0;
-            }
-        }
-
-        * _http = NULL;
-    }
-    
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KNSManagerMakeHttp ( const KNSManager *self,
-    KHttp **http, KStream *opt_conn, ver_t vers, const String *host, uint32_t port )
-{
-    if ( self == NULL )
-    {
-        if ( http == NULL )
-            return RC ( rcNS, rcMgr, rcValidating, rcParam, rcNull );
-
-        * http = NULL;
-
-        return RC ( rcNS, rcMgr, rcValidating, rcSelf, rcNull );
-    }
-
-    return KNSManagerMakeTimedHttp ( self, http, opt_conn, vers,
-        self -> http_read_timeout, self -> http_write_timeout, host, port );
-}
-
-
-/* AddRef
- * Release
- *  ignores NULL references
- */
-LIB_EXPORT rc_t CC KHttpAddRef ( const KHttp *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KHttp" ) )
-        {
-        case krefLimit:
-            return RC ( rcNS, rcNoTarg, rcAttaching, rcRange, rcExcessive );
-        case krefNegative:
-            return RC ( rcNS, rcNoTarg, rcAttaching, rcSelf, rcInvalid );
-        default:
-            break;
-        }
-    }
-    
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KHttpRelease ( const KHttp *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KHttp" ) )
-        {
-        case krefWhack:
-            return KHttpWhack ( ( KHttp* ) self );
-        case krefNegative:
-            return RC ( rcNS, rcNoTarg, rcReleasing, rcRange, rcExcessive );
-        default:
-            break;
-        }
-    }
-    
-    return 0;
-}
-
-/* Communication Methods
- *  Read in the http response and return 1 char at a time
- */
-static
-rc_t KHttpGetCharFromResponse ( KHttp *self, char *ch, struct timeout_t *tm )
-{
-    rc_t rc;
-    char * buffer = self -> block_buffer . base;
-
-    /* check for data in buffer */
-    if ( KHttpBlockBufferIsEmpty ( self ) )
-    {
-        /* check to see ho many bytes are in the buffer */
-        size_t bsize = KDataBufferBytes ( & self -> block_buffer );
-
-        /* First time around, bsize will be 0 */
-        if ( bsize == 0 )
-        {
-            bsize = 64 * 1024;
-            rc = KDataBufferResize ( & self -> block_buffer, bsize );
-            if ( rc != 0 )
-                return rc;
-
-            /* re-assign new base pointer */
-            buffer = self -> block_buffer . base;
-        }
-
-        /* zero out offsets */
-        KHttpBlockBufferReset ( self );
-
-        /* read from the stream into the buffer, and record the bytes read
-           into block_valid */
-        /* NB - do NOT use KStreamReadAll or it will block with http 1.1 
-           because http/1.1 uses keep alive and the read will block until the server 
-           drops the connection */
-        rc = KStreamTimedRead ( self -> sock, buffer, bsize, & self -> block_valid, tm );
-        if ( rc != 0 )
-            return rc;
-
-        /* if nothing was read, we have reached the end of the stream */
-        if ( self -> block_valid == 0 )
-        {
-            /* return nul char */
-            * ch = 0;
-            return 0;
-        }
-    }
-
-    /* return the next char in the buffer */
-    * ch = buffer [ self -> block_read ++ ];
-    return 0;
-}
-
-/* Read and return entire lines ( until \r\n ) */
-static
-rc_t KHttpGetLine ( KHttp *self, struct timeout_t *tm )
-{
-    rc_t rc;
-
-    char * buffer = self -> line_buffer . base;
-    size_t bsize = KDataBufferBytes ( & self -> line_buffer );
-
-    /* num_valid bytes read starts at 0 */
-    self -> line_valid = 0;
-    while ( 1 )
-    {
-        char ch;
-
-        /* get char */
-        rc = KHttpGetCharFromResponse ( self, &ch, tm );
-        if ( rc != 0 )
-            break;
-
-        if ( ch == '\n' )
-        {
-            /* check that there are valid bytes read and the previous char is '\r' */
-            if ( self -> line_valid > 0 && buffer [ self -> line_valid - 1 ] == '\r' )
-            {
-                /* decrement number of valid bytes to remove '\r' */
-                -- self -> line_valid;
-            }
-            /* record end of line */
-            ch = 0;
-        }
-
-        /* check if the buffer is full */
-        if ( self -> line_valid == bsize )
-        {
-            /* I assume that the header lines will not be too large
-               so only need to increment  by small chunks */
-            bsize += 256;
-
-            /* TBD - place an upper limit on resize */
-
-            /* resize */
-            rc = KDataBufferResize ( & self -> line_buffer, bsize );
-            if ( rc != 0 )
-                return rc;
-
-            /* assign new base pointer */
-            buffer = self -> line_buffer . base;
-        }
-
-        /* buffer is not full, insert char into the buffer */
-        buffer [ self -> line_valid ] = ch;
-        
-        /* get out of loop if end of line */
-        if ( ch == 0 )
-        {
-#if _DEBUGGING
-            if ( KNSManagerIsVerbose ( self -> mgr ) ) {
-                size_t i = 0;
-                KOutMsg ( "RX:" );
-                for (i = 0; i <= self->line_valid; ++i) {
-                    if (isprint(buffer[i])) {
-                        KOutMsg("%c", buffer[i]);
-                    }
-                    else {
-                        KOutMsg("\\%02X", buffer[i]);
-                    }
-                }
-                KOutMsg ( "\n" );
-            }
-#endif
-            break;
-        }
-        /* not end of line - increase num of valid bytes read */
-        ++ self -> line_valid;
-    }
-
-    return rc;
-}
-
-/* AddHeaderString
- *  performs task of entering a header into BSTree
- *  or updating an existing node
- *
- *  Headers are always made up of a name: value pair
- */
-static
-rc_t KHttpAddHeaderString ( BSTree *hdrs, const String *name, const String *value )
-{
-    rc_t rc = 0;
-
-    /* if there is no name - error */
-    if ( name -> size == 0 )
-        rc = RC ( rcNS, rcNoTarg, rcValidating, rcParam, rcInsufficient );
-    else
-    {
-        /* test for previous existence of node by name */
-        KHttpHeader * node = ( KHttpHeader * ) BSTreeFind ( hdrs, name, KHttpHeaderCmp );
-        if ( node == NULL )
-        {
-            /* node doesnt exist - allocate memory for a new one */
-            node = calloc ( 1, sizeof * node );
-            if ( node == NULL )
-                rc = RC ( rcNS, rcNoTarg, rcAllocating, rcMemory, rcNull );
-            else
-            {
-                /* size of the KDataBuffer to store string data */
-                size_t bsize = name -> size + value ->  size + 1;
-                rc = KDataBufferMakeBytes ( & node -> value_storage, bsize );
-                if ( rc == 0 )
-                {
-                    /* copy the string data into storage */
-                    rc = string_printf ( node -> value_storage . base, bsize, NULL,
-                                         "%S%S"
-                                         , name
-                                         , value );
-                    if ( rc == 0 )
-                    {
-                        /* initialize the Strings to point into KHttpHeader node */
-                        StringInit ( & node -> name, node -> value_storage . base, name -> size, name -> len );
-                        StringInit ( & node -> value, node -> name . addr + name -> size, value -> size, value -> len );
-                        
-                        /* insert into tree, sorted by alphabetical order */
-                        BSTreeInsert ( hdrs, & node -> dad, KHttpHeaderSort );
-                        
-                        return 0;
-                    }
-                    
-                    KDataBufferWhack ( & node -> value_storage );
-                }
-                
-                free ( node );
-            }
-        }
-        
-        /* node exists
-           check that value param has data */
-        else if ( value -> size != 0 )
-        {
-            /* find the current size of the data in the node */
-            size_t cursize = node -> name . size + node -> value . size;
-            /* resize databuffer to hold the additional value data + comma + nul */
-            rc = KDataBufferResize ( & node -> value_storage, cursize + value -> size + 1 + 1 );
-            if ( rc == 0 )
-            {
-                char *buffer = node -> value_storage . base;
-
-                /* copy string data into buffer */
-                rc = string_printf ( & buffer [ cursize ], value -> size + 2, NULL,
-                                     ",%S"
-                                     , value ); 
-                if ( rc == 0 )
-                {
-                    /* update size and len of value in the node */
-                    node -> value . size += value -> size + 1;
-                    node -> value . len += value -> len + 1;
-                    return 0;
-                }
-                
-                /* In case of almost impossible error
-                   restore values to what they were */
-                KDataBufferResize ( & node -> value_storage, cursize + 1 );
-            }
-        }
-    }
-
-    return rc;
-}
-
-static
-rc_t KHttpVAddHeader ( BSTree *hdrs, const char *_name, const char *_val, va_list args )
-{
-    rc_t rc;
-
-    size_t bsize;
-    String name, value;
-    char buf [ 4096 ];
-
-    /* initialize name string from param */
-    StringInitCString ( & name, _name );
-
-    /* copy data into buf, using va_list for value format */
-    rc = string_vprintf ( buf, sizeof buf, &bsize, _val, args );
-    if ( rc == 0 )
-    {
-        /* get length of buf */
-        size_t blen = string_len ( buf, bsize );
-
-        /* init value */
-        StringInit ( & value, buf, bsize, ( uint32_t ) blen );
-
-        rc = KHttpAddHeaderString ( hdrs, & name, & value );
-    }
-
-    return rc;
-}
-
-static
-rc_t KHttpAddHeader ( BSTree *hdrs, const char *name, const char *val, ... )
-{
-    rc_t rc;
-    va_list args;
-    va_start ( args, val );
-    rc = KHttpVAddHeader ( hdrs, name, val, args );
-    va_end ( args );
-    return rc;
-}
-
-/* Capture each header line to add to BSTree */
-rc_t KHttpGetHeaderLine ( KHttp *self, timeout_t *tm, BSTree *hdrs, bool *blank, bool *close_connection )
-{
-    /* Starting from the second line of the response */
-    rc_t rc = KHttpGetLine ( self, tm );
-    if ( rc == 0 )
-    {
-        /* blank = empty line_buffer = separation between headers and body of response */
-        if ( self -> line_valid == 0 )
-            * blank = true;
-        else
-        {
-            char * sep;
-            char * buffer = self -> line_buffer . base;
-            char * end = buffer + self -> line_valid;
-
-            /* find the separation between name: value */
-            sep = string_chr ( buffer, end - buffer, ':' );
-            if ( sep == NULL )
-                rc = RC ( rcNS, rcNoTarg, rcParsing, rcNoObj, rcNotFound );
-            else
-            {
-                String name, value;
-                const char * last = sep;
-                
-                /* trim white space around name */
-                while ( buffer < last && isspace ( buffer [ 0 ] ) )
-                    ++ buffer;
-                while ( buffer < last && isspace ( last [ -1 ] ) )
-                    -- last;
-
-                /* assign the name data into the name string */
-                StringInit ( & name, buffer, last - buffer, ( uint32_t ) ( last - buffer ) );
-                
-                /* move the buffer forward to value */
-                buffer = sep + 1;
-                last = end;
-                
-                /* trim white space around value */
-                while ( buffer < last && isspace ( buffer [ 0 ] ) )
-                    ++ buffer;
-                while ( buffer < last && isspace ( last [ -1 ] ) )
-                    -- last;
-
-                /* assign the value data into the value string */
-                StringInit ( & value, buffer, last - buffer, ( uint32_t ) ( last - buffer ) );
-                
-                /* check for Connection: close header */
-                if ( name . size == sizeof "Connection" -1 && value . size == sizeof "close" - 1 )
-                {
-                    if ( tolower ( name . addr [ 0 ] ) == 'c' && tolower ( value . addr [ 0 ] ) == 'c' )
-                    {
-                        if ( strcase_cmp ( name . addr, name . size, "Connection", name . size, ( uint32_t ) name . size ) == 0 &&
-                             strcase_cmp ( value . addr, value . size, "close", value . size, ( uint32_t ) value . size ) == 0 )
-                        {
-                            DBGMSG(DBG_VFS, DBG_FLAG(DBG_VFS),
-                                ("*** seen connection close ***\n"));
-                            * close_connection = true;
-                        }
-                    }
-                }
-                
-                rc = KHttpAddHeaderString ( hdrs, & name, & value );
-            }
-        }
-    }
-
-    return rc;
-}
-
-/* Locate a KhttpHeader obj in BSTree */
-static
-rc_t KHttpFindHeader ( const BSTree *hdrs, const char *_name, char *buffer, size_t bsize, size_t *num_read )
-{
-    rc_t rc = 0;
-    String name;
-    KHttpHeader * node;
-
-    StringInitCString ( &name, _name );
-
-    /* find the header */
-    node = ( KHttpHeader * ) BSTreeFind ( hdrs, &name, KHttpHeaderCmp );
-    if ( node == NULL )
-    {
-        rc = RC ( rcNS, rcNoTarg, rcSearching, rcName, rcNull );
-    }
-    else
-    {
-        /* make sure buffer is large enough */
-        if ( bsize < node -> value . size )
-        {
-            /* return the amount needed */
-            * num_read = node -> value . size;
-            
-            return RC ( rcNS, rcNoTarg, rcParsing, rcParam, rcInsufficient );
-        }
-        
-        /* copy data and return the num_read */
-        * num_read = string_copy ( buffer, bsize, node -> value . addr, node -> value . size );
-    }
-    return rc;
-}
-
-rc_t KHttpGetStatusLine ( KHttp *self, timeout_t *tm, String *msg, uint32_t *status, ver_t *version )
-{
-    /* First time reading the response */
-    rc_t rc = KHttpGetLine ( self, tm );
-
-    if (rc == 0 && self->line_valid == 0) {
-        DBGMSG(DBG_KNS, DBG_FLAG(DBG_KNS_ERR), (
-"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@2 %s empty HttpStatusLine @@@@@@@@@@@@@@@@"
-            "\n", __FILE__));
-        rc = RC(rcNS, rcNoTarg, rcReading, rcNoObj, rcIncomplete);
-    }
-
-    if ( rc == 0 )
-    {
-        char * sep;
-        char * buffer = self -> line_buffer . base;
-        char * end = buffer + self -> line_valid;
-
-        /* Detect protocol
-           expect HTTP/1.[01]<sp><digit>+<sp><msg>\r\n */
-        sep = string_chr ( buffer, end - buffer, '/' );
-        if ( sep == NULL )
-        {
-            rc = RC ( rcNS, rcNoTarg, rcParsing, rcNoObj, rcNotFound );
-        }
-        else
-        {
-            /* make sure it is http */
-            if ( strcase_cmp ( "http", 4, buffer, sep - buffer, 4 ) != 0 )
-                rc = RC ( rcNS, rcNoTarg, rcParsing, rcNoObj, rcUnsupported );
-            else
-            {
-                /* move buffer up to version */
-                buffer = sep + 1;
-
-                /* find end of version */
-                sep = string_chr ( buffer, end - buffer, ' ' );
-                if ( sep == NULL )
-                    rc = RC ( rcNS, rcNoTarg, rcParsing, rcNoObj, rcNotFound );
-                else
-                {
-                    /* must be 1.0 or 1.1 */
-                    if ( ( string_cmp ( "1.0", 3, buffer, sep - buffer, 3 ) != 0 ) &&
-                         ( string_cmp ( "1.1", 3, buffer, sep - buffer, 3 ) != 0 ) )
-                        rc = RC ( rcNS, rcNoTarg, rcParsing, rcNoObj, rcUnsupported );
-                    else
-                    {
-                        /* which version was returned? */
-                        * version = string_cmp ( "1.0", 3, buffer, sep - buffer, -1 ) == 0 ? 0x01000000 : 0x01010000;
-                        
-                        /* move up to status code */
-                        buffer = sep + 1;
-
-                        /* record status as uint32 
-                         sep should point to 1 byte after end of status text */
-                        * status = strtou32 ( buffer, & sep, 10 );
-
-                        /* if at the end of buffer or sep didnt land on a space - error */
-                        if ( sep == buffer || * sep != ' ' )
-                            rc = RC ( rcNS, rcNoTarg, rcParsing, rcNoObj, rcNotFound );
-                        else
-                        {
-                            /* move up to status msg */
-                            buffer = sep + 1;
-
-                            /* initialize the msg String with the proper size and length */
-                            StringInit ( msg, buffer, end - buffer, ( uint32_t ) ( end - buffer ) );
-                        }
-                    }
-                }
-            }
-        }
-    }
-    return rc;
-}
-
-/*--------------------------------------------------------------------------
- * HttpStream
- *  structure that represents the body of the response
- */
-struct KHttpStream
-{
-    KStream dad;
-    
-    /* content_length is the size of the chunk
-       total_read is the number of read from the chunk */
-    uint64_t content_length;
-    uint64_t total_read;
-
-    KHttp * http;
-
-    uint8_t state; /* keeps track of state for chunked reader */
-    bool size_unknown; /* for HTTP/1.0 dynamic */
-};
-
-enum 
-{
-    end_chunk,
-    new_chunk,
-    within_chunk,
-    end_stream,
-    error_state
-};
-
-static
-rc_t CC KHttpStreamWhack ( KHttpStream *self )
-{
-    KHttpRelease ( self -> http );
-    free ( self );
-    return 0;
-}
-
-/* Read from stream - not chunked or within a chunk */
-static
-rc_t CC KHttpStreamTimedRead ( const KHttpStream *cself,
-    void *buffer, size_t bsize, size_t *num_read, struct timeout_t *tm )
-{
-    rc_t rc;
-    KHttpStream *self = ( KHttpStream * ) cself;
-    KHttp *http = self -> http;
-
-    /* minimum of bytes requested and bytes available in stream */
-    uint64_t num_to_read = self -> content_length - self -> total_read;
-
-    /* take the minimum of bytes avail or bytes requested */
-    if ( self -> size_unknown || bsize < num_to_read )
-        num_to_read = bsize;
-
-    /* Should be 0 because nothing has been read. Caller
-       sets its to 0 */
-    assert ( * num_read == 0 );
-    /* exit if there is nothing to read */
-    if ( num_to_read == 0 )
-        return 0;
-
-    /* read directly from stream 
-       check if the buffer is empty */
-    if ( KHttpBlockBufferIsEmpty ( http ) )
-    {
-        /* ReadAll blocks for 1.1. Server will drop the connection */
-        rc =  KStreamTimedRead ( http -> sock, buffer, num_to_read, num_read, tm );
-        if ( rc != 0 )
-        {
-            /* TBD - handle dropped connection - may want to reestablish */
-
-            /* LOOK FOR DROPPED CONNECTION && SIZE UNKNOWN - HTTP/1.0 DYNAMIC CASE */
-            if ( self -> size_unknown )
-                rc = 0;
-        }
-
-        /* if nothing was read - incomplete transfer */
-        else if ( ! self -> size_unknown && * num_read == 0 )
-        {
-            rc = RC ( rcNS, rcNoTarg, rcTransfer, rcNoObj, rcIncomplete);
-        }
-
-    }
-    else
-    {
-        char *buf;
-
-        /* bytes available in buffer */
-        uint64_t bytes_in_buffer = http -> block_valid - http -> block_read;
-
-        /* take the minimum of bytes avail or bytes requested */
-        if ( num_to_read > bytes_in_buffer )
-            num_to_read = bytes_in_buffer;
-
-        /* capture base pointer */
-        buf = http -> block_buffer . base;
-
-        /* copy data into the user buffer from the offset of bytes not yet read */
-        memcpy ( buffer, & buf [ http -> block_read ], num_to_read );
-
-        /* update the amount read */
-        http -> block_read += num_to_read;
-
-        /* return how much was read */
-        * num_read = num_to_read;
-
-        rc = 0;
-    }
-
-    /* update the total from the stream
-       keep track of total bytes read within the chunk */
-    self -> total_read += * num_read;
-
-    return rc;
-}
-
-static
-rc_t CC KHttpStreamRead ( const KHttpStream *self,
-    void *buffer, size_t bsize, size_t *num_read )
-{
-    return KHttpStreamTimedRead ( self, buffer, bsize, num_read, NULL );
-}
-
-/* Uses a state machine*/
-static
-rc_t CC KHttpStreamTimedReadChunked ( const KHttpStream *cself,
-    void *buffer, size_t bsize, size_t *num_read, timeout_t *tm )
-{
-    rc_t rc;
-    char * sep;
-    KHttpStream *self = ( KHttpStream * ) cself;
-    KHttp * http = self -> http;
-
-    assert ( * num_read == 0 );
-
-    switch ( self -> state )
-    {
-    case end_chunk:
-        rc = KHttpGetLine ( http, tm );
-        /* this should be the CRLF following chunk */
-        if ( rc != 0 || http -> line_valid != 0 )
-        {
-            rc = RC ( rcNS, rcNoTarg, rcParsing, rcNoObj, rcIncorrect);
-            self -> state = error_state;
-            break;
-        }
-
-        self -> state = new_chunk;
-
-        /* NO BREAK */
-
-        /* start */
-    case new_chunk:
-
-        /* Get chunk size */
-        rc = KHttpGetLine ( http, tm );
-        if ( rc != 0 )
-        {
-            self -> state = error_state;
-            break;
-        }
-
-        /* convert the hex number containing chunk size to uint64 
-           sep should be pointing at nul byte */
-        self -> content_length = strtou64 ( http -> line_buffer . base, & sep, 16 );
-
-        /* TBD - eat spaces here? */
-        /* check if there was no hex number, or sep isn't pointing to nul byte */
-        if ( sep == http -> line_buffer . base || ( * sep != 0 && * sep != ';' ) )
-        {
-            rc = RC ( rcNS, rcNoTarg, rcParsing, rcNoObj, rcIncorrect);
-            self -> state = error_state;
-            break;
-        }
-
-        /* check for end of stream */
-        if ( self -> content_length == 0 )
-        {
-            self -> state = end_stream;
-            return 0;
-        }
-
-        /* havent read anything - start at 0 */
-        self -> total_read = 0;
-
-        /* now within a chunk */
-        self -> state = within_chunk;
-
-        /* NO BREAK */
-
-    case within_chunk: 
-        /* start reading */
-        rc = KHttpStreamRead ( self, buffer, bsize, num_read );
-        if ( rc != 0 ) /* TBD - handle connection errors */
-            self -> state = error_state;
-        /* incomplete if nothing to read */
-        else if ( * num_read == 0 )
-        {
-            rc = RC ( rcNS, rcNoTarg, rcTransfer, rcNoObj, rcIncomplete);
-            self -> state = error_state;
-        }
-        /* check for end of chunk */
-        else if ( self -> total_read == self -> content_length )
-            self -> state = end_chunk;
-        break;
-
-    case end_stream:
-        return 0;
-
-    case error_state:
-        rc = RC ( rcNS, rcNoTarg, rcParsing, rcNoObj, rcIncorrect );
-        break;
-
-    default:
-        /* internal error */
-        rc = RC ( rcNS, rcNoTarg, rcParsing, rcNoObj, rcError );
-    }
-
-    return rc;
-}
-
-static
-rc_t CC KHttpStreamReadChunked ( const KHttpStream *self,
-    void *buffer, size_t bsize, size_t *num_read )
-{
-    return KHttpStreamTimedReadChunked ( self, buffer, bsize, num_read, NULL );
-}
-
-/* cannot write - for now */
-static
-rc_t CC KHttpStreamTimedWrite ( KHttpStream *self,
-    const void *buffer, size_t size, size_t *num_writ, struct timeout_t *tm )
-{
-    return RC ( rcNS, rcNoTarg, rcWriting, rcFunction, rcUnsupported );
-}
-
-static
-rc_t CC KHttpStreamWrite ( KHttpStream *self,
-    const void *buffer, size_t size, size_t *num_writ )
-{
-    return RC ( rcNS, rcNoTarg, rcWriting, rcFunction, rcUnsupported );
-}
-
-static KStream_vt_v1 vtKHttpStream = 
-{
-    1, 1,
-    KHttpStreamWhack,
-    KHttpStreamRead,
-    KHttpStreamWrite,
-    KHttpStreamTimedRead,
-    KHttpStreamTimedWrite
-};
-
-static KStream_vt_v1 vtKHttpStreamChunked =
-{
-    1, 1,
-    KHttpStreamWhack,
-    KHttpStreamReadChunked,
-    KHttpStreamWrite,
-    KHttpStreamTimedReadChunked,
-    KHttpStreamTimedWrite
-};
-
-/* Make a KHttpStream object */
-static
-rc_t KHttpStreamMake ( KHttp *self, KStream **sp, const char *strname, size_t content_length, bool size_unknown )
-{
-    rc_t rc;
-    KHttpStream *s = calloc ( 1, sizeof * s );
-    if ( s == NULL )
-        rc = RC ( rcNS, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        rc = KStreamInit ( & s -> dad, ( const KStream_vt * ) & vtKHttpStream, 
-                           "KHttpStream", strname, true, false );
-        if ( rc == 0 )
-        {                                       
-            rc = KHttpAddRef ( self );
-            if ( rc == 0 )
-            {
-                s -> http = self;
-                s -> content_length = content_length;
-                s -> size_unknown = size_unknown;
-                *sp = & s -> dad;
-                return 0;
-            }
-        }
-        free ( s );
-    }
-    *sp = NULL;
-
-    return rc;
-}
-
-static
-rc_t KHttpStreamMakeChunked ( KHttp *self, KStream **sp, const char *strname )
-{
-    rc_t rc;
-    KHttpStream *s = calloc ( 1, sizeof * s );
-    if ( s == NULL )
-        rc = RC ( rcNS, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        rc = KStreamInit ( & s -> dad, ( const KStream_vt * ) & vtKHttpStreamChunked, 
-                           "KHttpStreamChunked", strname, true, false );
-        if ( rc == 0 )
-        {
-            rc = KHttpAddRef ( self );
-            if ( rc == 0 )
-            {
-                s -> http = self;
-
-                /* state should be new_chunk */
-                s -> state = new_chunk;
-
-                *sp = & s -> dad;
-                return 0;
-            }
-        }
-        free ( s );
-    }
-    *sp = NULL;
-
-    return rc;
-}
-
-/*--------------------------------------------------------------------------
- * KHttpResult
- *  hyper text transfer protocol
- *  Holds all the headers in a BSTree
- *  Records the status msg, status code and version of the response 
- */
-struct KHttpResult
-{
-    KHttp *http;
-    
-    BSTree hdrs;
-    
-    String msg;
-    uint32_t status;
-    ver_t version;
-
-    KRefcount refcount;
-    bool close_connection;
-};
-
-static
-rc_t KHttpResultWhack ( KHttpResult * self )
-{
-    BSTreeWhack ( & self -> hdrs, KHttpHeaderWhack, NULL );
-    if ( self -> close_connection )
-    {
-        DBGMSG(DBG_VFS, DBG_FLAG(DBG_VFS),
-            ("*** closing connection ***\n"));
-        KHttpClose ( self -> http );
-    }
-    KHttpRelease ( self -> http );
-    KRefcountWhack ( & self -> refcount, "KHttpResult" );
-    free ( self );
-    return 0;
-}
-
-
-/* Sends the request and receives the response into a KHttpResult obj */
-static 
-rc_t KHttpSendReceiveMsg ( KHttp *self, KHttpResult **rslt,
-    const char *buffer, size_t len, const KDataBuffer *body, const char *url )
-{
-    rc_t rc = 0;
-    size_t sent;
-    timeout_t tm;
-
-
-    /* TBD - may want to assert that there is an empty line in "buffer" */
-        DBGMSG(DBG_KNS, DBG_FLAG(DBG_KNS_HTTP), ("TX:%.*s", len, buffer));
-#if _DEBUGGING
-    if ( KNSManagerIsVerbose ( self -> mgr ) )
-        KOutMsg ( "TX:%.*s", len, buffer );
-#endif
-
-    /* reopen connection if NULL */
-    if ( self -> sock == NULL )
-        rc = KHttpOpen ( self, & self -> hostname, self -> port );
-
-    /* ALWAYS want to use write all when sending */
-    if ( rc == 0 )
-    {
-        TimeoutInit ( & tm, self -> write_timeout );
-        rc = KStreamTimedWriteAll ( self -> sock, buffer, len, & sent, & tm ); 
-    }
-    
-    /* check the data was completely sent */
-    if ( rc == 0 && sent != len )
-        rc = RC ( rcNS, rcNoTarg, rcWriting, rcTransfer, rcIncomplete );
-    if ( rc == 0 && body != NULL )
-    {
-        /* "body" contains bytes plus trailing NUL */
-        size_t to_send = ( size_t ) body -> elem_count - 1;
-        rc = KStreamTimedWriteAll ( self -> sock, body -> base, to_send, & sent, & tm );
-        if ( rc == 0 && sent != to_send )
-            rc = RC ( rcNS, rcNoTarg, rcWriting, rcTransfer, rcIncomplete );
-    }
-    if ( rc == 0 )
-    {
-        String msg;
-        ver_t version;
-        uint32_t status;
-
-        /* reinitialize the timeout for reading */
-        TimeoutInit ( & tm, self -> read_timeout );
-
-        /* we have now received a response 
-           start reading the header lines */
-        rc = KHttpGetStatusLine ( self, & tm, & msg, & status, & version );
-        if ( rc == 0 )
-        {         
-            /* create a result object with enough space for msg string + nul */
-            KHttpResult *result = malloc ( sizeof * result + msg . size + 1 );
-            if ( result == NULL )
-                rc = RC ( rcNS, rcNoTarg, rcAllocating, rcMemory, rcExhausted );
-            else
-            {
-                /* zero out */
-                memset ( result, 0, sizeof * result );
-                
-                rc = KHttpAddRef ( self );
-                if ( rc == 0 )
-                {
-                    bool blank;
-
-                    /* treat excess allocation memory as text space */
-                    char *text = ( char* ) ( result + 1 );
-
-                    /* copy in the data to the text space */
-                    string_copy ( text, msg . size + 1, msg . addr, msg . size );
-
-                    /* initialize the result members
-                       "hdrs" is initialized via "memset" above
-                     */
-                    result -> http = self;
-                    result -> status = status;
-                    result -> version = version;
-
-                    /* correlate msg string in result to the text space */
-                    StringInit ( & result -> msg, text, msg . size, msg . len );
-
-                    /* TBD - pass in URL as instance identifier */
-                    KRefcountInit ( & result -> refcount, 1, "KHttpResult", "sending-msg", url );
-
-                    /* receive and parse all header lines 
-                       blank = end of headers */
-                    for ( blank = false; ! blank && rc == 0; )
-                        rc = KHttpGetHeaderLine ( self, & tm, & result -> hdrs, & blank, & result -> close_connection );
-
-                    if ( rc == 0 )
-                    {
-                        /* assign to OUT result obj */
-                        * rslt = result;
-                        return 0; 
-                    }
-
-                    BSTreeWhack ( & result -> hdrs, KHttpHeaderWhack, NULL );
-                }
-
-                KHttpRelease ( self );
-            }
-
-            free ( result );
-        }
-    }
-    return rc;
-}
-
-/* AddRef
- * Release
- *  ignores NULL references
- */
-LIB_EXPORT rc_t CC KHttpResultAddRef ( const KHttpResult *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KHttpResult" ) )
-        {
-        case krefLimit:
-            return RC ( rcNS, rcNoTarg, rcAttaching, rcRange, rcExcessive );
-        case krefNegative:
-            return RC ( rcNS, rcNoTarg, rcAttaching, rcSelf, rcInvalid );
-        default:
-            break;
-        }
-    }
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KHttpResultRelease ( const KHttpResult *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KHttpResult" ) )
-        {
-        case krefWhack:
-            return KHttpResultWhack ( ( KHttpResult* ) self );
-        case krefNegative:
-            return RC ( rcNS, rcNoTarg, rcReleasing, rcRange, rcExcessive );
-        default:
-            break;
-        }
-    }
-
-    return 0;
-}
-
-
-/* Status
- *  access the response status code
- *  and optionally the message
- *
- *  "code" [ OUT ] - return parameter for status code
- *
- *  "msg_buff" [ IN, NULL OKAY ] and "buff_size" [ IN, ZERO OKAY ] -
- *   buffer for capturing returned message. if "msg_buff" is not
- *   NULL and "buff_size" is insufficient for copying status message,
- *   the message returns rcBuffer, rcInsufficient.
- *
- *  "msg_size" [ OUT, NULL OKAY ] - size of returned message in bytes.
- *   if not NULL, returns the size of status message. if "msg_buff" is
- *   NULL, returns rcBuffer, rcNull.
- */
-LIB_EXPORT rc_t CC KHttpResultStatus ( const KHttpResult *self, uint32_t *code,
-    char *msg_buff, size_t buff_size, size_t *msg_size )
-{
-    rc_t rc;
-
-    /* check OUT parameters */
-    if ( code == NULL )
-        rc = RC ( rcNS, rcNoTarg, rcValidating, rcParam, rcNull );
-    else
-    {
-        /* IN parameters */
-        if ( self == NULL )
-            rc = RC ( rcNS, rcNoTarg, rcValidating, rcSelf, rcNull );
-        else
-        {
-            /* capture the status code to OUT param */
-            * code = self -> status;
-            rc = 0;
-
-            /* if asking about msg size */
-            if ( msg_size != NULL )
-            {
-                /* capture the msg size */
-                * msg_size = self -> msg . size;
-
-                /* catch NULL buffer pointer */
-                if ( msg_buff == NULL )
-                    rc = RC ( rcNS, rcNoTarg, rcValidating, rcBuffer, rcNull );
-            }
-
-            /* if they apparently want the message */
-            if ( msg_buff != NULL )
-            {
-                /* check for an insufficient buffer size */
-                if ( buff_size < self -> msg . size )
-                    rc = RC ( rcNS, rcNoTarg, rcValidating, rcBuffer, rcInsufficient );
-                else
-                    /* copy out the message */
-                    string_copy ( msg_buff, buff_size, self -> msg . addr, self -> msg . size );
-            }
-
-            return rc;
-        }
-
-        * code = 0;
-    }
-
-    return rc;
-}
-
-
-/* KeepAlive
- *  retrieves keep-alive property of response
- */
-LIB_EXPORT bool CC KHttpResultKeepAlive ( const KHttpResult *self )
-{
-    rc_t rc;
-
-    if ( self != NULL )
-    {
-        /* we're requiring version 1.1 -
-           some 1.0 servers also supported it... */
-        if ( self -> version == 0x01010000 )
-        {
-            size_t num_writ;
-            char buffer [ 1024 ];
-            size_t bsize = sizeof buffer;
-
-            /* retreive the node that has the keep-alive property */
-            rc = KHttpResultGetHeader ( self, "Connection", buffer, bsize, & num_writ );
-            if ( rc == 0 )
-            {
-                String keep_alive, compare;
-
-                /* init strings */
-                StringInitCString ( & keep_alive, buffer );
-                CONST_STRING ( & compare, "keep-alive" );
-
-                /* compare strings for property value */
-                if ( StringCaseCompare ( & keep_alive, & compare ) == 0 )
-                    return true;
-            }
-        }
-    }
-    return false;
-}
-
-
-/* Range
- *  retrieves position and partial size for partial requests
- *
- *  "pos" [ OUT ] - offset to beginning portion of response
- *
- *  "bytes" [ OUT ] - size of range
- *
- *  HERE WE NEED TO HAVE PASSED THE RANGE REQUEST TO THE RESULT ON CREATION,
- *  AND WE WILL RESPOND TO THE HTTP "PARTIAL RESULT" OR WHATEVER RETURN CODE,
- *  AND BASICALLY UPDATE WHAT THE RANGE WAS.
- */
-static
-rc_t KHttpResultHandleContentRange ( const KHttpResult *self, uint64_t *pos, size_t *bytes )
-{
-    rc_t rc;
-    size_t num_read;
-    char buffer [ 1024 ];
-    const size_t bsize = sizeof buffer;
-
-    /* get Content-Range
-     *  expect: "bytes <first-position>-<last-position>/<total-size>"
-     */
-    rc = KHttpResultGetHeader ( self, "Content-Range", buffer, bsize, & num_read );
-    if ( rc == 0 )
-    {
-        char * sep;
-        char *buf = buffer;
-        const char *end = & buffer [ num_read ];
-
-        /* look for separation of 'bytes' and first position */
-        sep = string_chr ( buf, end - buf, ' ' );
-        if ( sep == NULL )
-            rc = RC ( rcNS, rcNoTarg, rcParsing, rcNoObj, rcNotFound );
-        else
-        {
-            uint64_t start_pos;
-                        
-            /* buf now points to value */
-            buf = sep + 1;
-
-            /* capture starting position 
-               sep should land on '-' */
-            start_pos = strtou64 ( buf, & sep, 10 );
-
-            /* check if we didnt read anything or sep didnt land on '-' */
-            if ( sep == buf || * sep != '-' )
-                rc =  RC ( rcNS, rcNoTarg, rcParsing, rcNoObj, rcNotFound );
-            else
-            {
-                uint64_t end_pos;
-
-                buf = sep + 1;
-                end_pos = strtou64 ( buf, & sep, 10 );
-                if ( sep == buf || * sep != '/' )
-                    rc =  RC ( rcNS, rcNoTarg, rcParsing, rcNoObj, rcNotFound );                 
-                else
-                {
-                    uint64_t total;
-
-                    buf = sep +1;
-                    total = strtou64 ( buf, &sep, 10 );
-                    if ( sep == buf || * sep != 0 )
-                        rc =  RC ( rcNS, rcNoTarg, rcParsing, rcNoObj, rcNotFound );                 
-                    else
-                    {
-                        /* check variables */
-                        if ( total == 0 ||
-                             start_pos > total ||
-                             end_pos < start_pos ||
-                             end_pos > total )
-                        {
-                            rc = RC ( rcNS, rcNoTarg, rcParsing, rcNoObj, rcNotFound );
-                        }
-                        else
-                        {
-                            uint64_t length;
-                                        
-                            /* get content-length to confirm bytes sent */
-                            rc = KHttpResultGetHeader ( self, "Content-Length", buffer, bsize, & num_read );
-                            if ( rc != 0 )
-                            {
-                                            
-                                /* remember that we can have chunked encoding,
-                                   so "Content-Length" may not exist. */
-                                * pos = start_pos;
-                                * bytes = end_pos - start_pos; 
-                                            
-                                return 0;
-                            }
-
-                            buf = buffer;
-                            end = & buffer [ num_read ];
-                                            
-                            /* capture the length */
-                            length  = strtou64 ( buf, & sep, 10 );
-                            if ( sep == buf || * sep != 0 )
-                                rc =  RC ( rcNS, rcNoTarg, rcParsing, rcNoObj, rcNotFound );
-                            else 
-                            {
-                                /* finally check all the acquired information */
-                                if ( ( length != ( ( end_pos - start_pos ) + 1 ) ) ||
-                                     ( length > total ) )
-                                    rc = RC ( rcNS, rcNoTarg, rcParsing, rcNoObj, rcNotFound );
-                                else
-                                {
-                                    /* assign to OUT params */
-                                    * pos = start_pos;
-                                    * bytes = length; 
-                                                    
-                                    return 0;
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KHttpResultRange ( const KHttpResult *self, uint64_t *pos, size_t *bytes )
-{
-    rc_t rc;
-
-    if ( pos ==  NULL || bytes == NULL )
-        rc = RC ( rcNS, rcNoTarg, rcValidating, rcParam, rcNull );
-    else if ( self == NULL )
-        rc = RC ( rcNS, rcNoTarg, rcValidating, rcSelf, rcNull );
-    else
-    {
-        switch ( self -> status )
-        {
-        case 206:
-            /* partial content */
-            rc = KHttpResultHandleContentRange ( self, pos, bytes );
-            if ( rc == 0 )
-                return 0;
-
-        case 416:
-            /* unsatisfiable range */
-            rc = RC ( rcNS, rcNoTarg, rcValidating, rcError, rcIncorrect );
-            break;
-
-        default:
-            /* codes not handling right now */
-            rc = RC ( rcNS, rcNoTarg, rcValidating, rcError, rcUnsupported );
-        }
-    }
-
-    if ( pos != NULL )
-        * pos = 0;
-    if ( bytes != NULL )
-        * bytes = 0;
-
-    return rc;
-}
-
-
-/* Size
- *  retrieves overall size of entity, if known
- *
- *  "size" [ OUT ] - size in bytes of response
- *   this is the number of bytes that may be expected from the input stream
- *
- */
-LIB_EXPORT bool CC KHttpResultSize ( const KHttpResult *self, uint64_t *size )
-{
-    if ( size != NULL && self != NULL )
-    {
-        rc_t rc;
-        size_t num_read;
-        char buffer [ 1024 ];
-        const size_t bsize = sizeof buffer;
-        
-        /* check for content-length */
-        rc = KHttpResultGetHeader ( self, "Content-Length", buffer, bsize, & num_read );
-        if ( rc == 0 )
-        {
-            char * sep;
-            
-            /* capture length as uint64 */
-            uint64_t length = strtou64 ( buffer, & sep, 10 );
-            if ( sep == buffer || * sep != 0 )
-                rc =  RC ( rcNS, rcNoTarg, rcParsing, rcNoObj, rcNotFound );
-            else
-            {
-                /* assign to OUT param */
-                * size = length;
-                return true;
-            }
-        }
-    }
-    return false;
-}
-
-/* AddHeader
- *  allow addition of an arbitrary HTTP header to RESPONSE
- *  this can be used to repair or normalize odd server behavior
- *
- */
-LIB_EXPORT rc_t CC KHttpResultAddHeader ( KHttpResult *self,
-    const char *name, const char *val, ... )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcNS, rcNoTarg, rcValidating, rcSelf, rcNull );
-    else if ( name == NULL )
-        rc = RC ( rcNS, rcNoTarg, rcValidating, rcParam, rcNull );
-    /* have to test for empty name */
-    else if ( name [ 0 ] == 0 )
-        rc = RC ( rcNS, rcNoTarg, rcValidating, rcParam, rcInsufficient );
-    else if ( val == NULL )
-        rc = RC ( rcNS, rcNoTarg, rcValidating, rcParam, rcNull );
-    /* same for empty value fmt string */
-    else if ( val [ 0 ] == 0 )
-        rc = RC ( rcNS, rcNoTarg, rcValidating, rcParam, rcInsufficient );
-    else
-    {
-        va_list args;
-        va_start ( args, val );
-        
-        rc = KHttpVAddHeader ( & self -> hdrs, name, val, args );
-        
-        va_end ( args );
-    }
-    return rc;
-}
-
-
-/* GetHeader
- *  retrieve named header if present
- *  this cand potentially return a comma separated value list
- */
-LIB_EXPORT rc_t CC KHttpResultGetHeader ( const KHttpResult *self, const char *name,
-    char *buffer, size_t bsize, size_t *num_read )
-{
-    rc_t rc = 0;
-
-    if ( num_read == NULL )
-        rc = RC ( rcNS, rcNoTarg, rcValidating, rcParam, rcNull );
-    else
-    {
-        * num_read = 0;
-
-        if ( self == NULL )
-            rc = RC ( rcNS, rcNoTarg, rcValidating, rcSelf, rcNull );
-        else if ( name == NULL )
-            rc = RC ( rcNS, rcNoTarg, rcValidating, rcParam, rcNull );
-        else if ( buffer == NULL && bsize != 0 )
-            rc = RC ( rcNS, rcNoTarg, rcValidating, rcParam, rcNull );
-        else
-        {
-            rc = KHttpFindHeader ( & self -> hdrs, name, buffer, bsize, num_read );
-        }
-    }
-
-    return rc;
-}
-
-#if _DEBUGGING
-static
-void PrintHeaders ( BSTNode *n, void *ignore )
-{
-    KHttpHeader *node = ( KHttpHeader * ) n;
-
-    KOutMsg ( "%S: %S\n",
-              & node -> name,
-              & node -> value );
-}
-#endif
-
-/* GetInputStream
- *  access the body of response as a stream
- *  only reads are supported
- *
- *  "s" [ OUT ] - return parameter for input stream reference
- *   must be released via KStreamRelease
- */
-LIB_EXPORT rc_t CC KHttpResultGetInputStream ( KHttpResult *self, KStream ** s )
-{
-    rc_t rc;
-    
-    if ( s == NULL )
-        rc = RC ( rcNS, rcNoTarg, rcValidating, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcNS, rcNoTarg, rcValidating, rcSelf, rcNull );
-        else
-        {
-            char buffer [ 512 ];
-            size_t num_read = 0;
-            uint64_t content_length = 0;
-
-            /* find header to check for type of data being received 
-               assign bytes read from value to num_read */
-            rc = KHttpResultGetHeader ( self, "Transfer-Encoding", buffer, sizeof buffer, & num_read );
-            if ( rc == 0 && num_read > 0 )
-            {
-                /* check if chunked encoding */
-                if ( strcase_cmp ( "chunked", sizeof "chunked" - 1,
-                    buffer, num_read, sizeof "chunked" - 1 ) == 0 )
-                {
-                    return KHttpStreamMakeChunked ( self -> http, s, "KHttpStreamChunked" );
-                }
-                /* TBD - print actual value */
-                LOGERR ( klogSys, rc, "Transfer-Encoding does not provide a value" );
-
-            }
-            /* get the content length of the entire stream if known */
-            if ( KHttpResultSize ( self, & content_length ) )
-                return KHttpStreamMake ( self -> http, s, "KHttpStream", content_length, false );
-
-            /* detect connection: close or pre-HTTP/1.1 dynamic content */
-            if ( self -> close_connection || self -> version < 0x01010000 )
-                return KHttpStreamMake ( self -> http, s, "KHttpStream", 0, true );
-
-#if _DEBUGGING
-            KOutMsg ( "HTTP/%.2V %03u %S\n", self -> version, self -> status, & self -> msg );
-            BSTreeForEach ( & self -> hdrs, false, PrintHeaders, NULL );
-#endif            
-
-            rc = RC ( rcNS, rcNoTarg, rcValidating, rcMessage, rcUnsupported );
-            LOGERR ( klogInt, rc, "HTTP response does not give content length" ); 
-
-        }
-    }
-    
-    * s = NULL;
-    
-    return rc;
-}
-
-
-
-/*--------------------------------------------------------------------------
- * KHttpRequest
- *  hyper text transfer protocol
- */
-
-struct KHttpRequest
-{
-    KHttp * http;
-
-    URLBlock url_block;
-    KDataBuffer url_buffer;
-
-    KDataBuffer body;
-    
-    BSTree hdrs;
-
-    KRefcount refcount;
-};
-
-static
-rc_t KHttpRequestClear ( KHttpRequest *self )
-{
-    KDataBufferWhack ( & self -> url_buffer );
-
-    return 0;
-}
-
-static
-rc_t KHttpRequestWhack ( KHttpRequest * self )
-{
-    KHttpRequestClear ( self );
-
-    KHttpRelease ( self -> http );
-    KDataBufferWhack ( & self -> body );
-    
-    BSTreeWhack  ( & self -> hdrs, KHttpHeaderWhack, NULL );
-    KRefcountWhack ( & self -> refcount, "KHttpRequest" );
-    free ( self );
-    return 0;
-}
-
-static 
-rc_t KHttpRequestInit ( KHttpRequest * req,
-    const URLBlock *b, const KDataBuffer *buf )
-{
-    rc_t rc = KDataBufferSub ( buf, & req -> url_buffer, 0, UINT64_MAX );
-    if ( rc == 0 )
-    {
-        /* assign url_block */
-        req -> url_block = * b;
-    }
-    return rc;
-}
-        
-
-/* MakeRequestInt[ernal]
- */
-static
-rc_t KHttpMakeRequestInt ( const KHttp *self,
-    KHttpRequest **_req, const URLBlock *block, const KDataBuffer *buf )
-{
-    rc_t rc;
-
-    /* create the object with empty buffer */
-    KHttpRequest * req = calloc ( 1, sizeof * req );
-    if ( req == NULL )
-        rc = RC ( rcNS, rcNoTarg, rcAllocating, rcMemory, rcNull );
-    else
-    {
-        rc = KHttpAddRef ( self );
-        if ( rc == 0 )
-        {
-            /* assign http */
-            req -> http = ( KHttp* ) self; 
-
-            /* initialize body to zero size */
-            KDataBufferClear ( & req -> body );
-                
-            KRefcountInit ( & req -> refcount, 1, "KHttpRequest", "make", buf -> base ); 
-
-            /* fill out url_buffer with URL */
-            rc = KHttpRequestInit ( req, block, buf );
-            if ( rc == 0 )
-            {
-                * _req = req;
-                return 0;
-            }
-
-            KHttpRelease ( self );
-        }
-    }
-    
-    free ( req );
-
-    return rc;
-}
-
-/* MakeRequest
- *  create a request that can be used to contact HTTP server
- *
- *  "req" [ OUT ] - return parameter for HTTP request object
- *
- *  "vers" [ IN ] - http version
- *
- *  "conn" [ IN, NULL OKAY ] - previously opened stream for communications.
- *
- *  "url" [ IN ] - full resource identifier. if "conn" is NULL,
- *   the url is parsed for remote endpoint and is opened by mgr.
- */
-LIB_EXPORT rc_t CC KHttpVMakeRequest ( const KHttp *self,
-    KHttpRequest **_req, const char *url, va_list args )
-{
-    rc_t rc;
-    
-    if ( _req == NULL )
-        rc = RC ( rcNS, rcNoTarg, rcValidating, rcParam, rcNull );
-    else
-    {
-        * _req = NULL;
-
-        if ( self == NULL )
-            rc = RC ( rcNS, rcNoTarg, rcValidating, rcSelf, rcNull );
-        else if ( url ==  NULL )
-            rc = RC ( rcNS, rcNoTarg, rcValidating, rcParam, rcNull );
-        else if ( url [ 0 ] == 0 )
-            rc = RC ( rcNS, rcNoTarg, rcValidating, rcParam, rcInsufficient );
-        else
-        {
-            KDataBuffer buf;
-
-            /* make a KDataBuffer and copy in url with the va_lis */
-            /* rc = KDataBufferMakeBytes ( & buf, 4096 );*/
-            KDataBufferClear ( &buf );
-            
-            rc = KDataBufferVPrintf ( &buf, url, args );
-            if ( rc == 0 )
-            {
-                /* parse the URL */
-                URLBlock block;
-                rc = ParseUrl ( & block, buf . base, buf . elem_count - 1 );
-                if ( rc == 0 )
-                    rc = KHttpMakeRequestInt ( self, _req, & block, & buf );
-            }
-
-            KDataBufferWhack ( & buf );
-        }
-    }
-
-    return rc;
-}
-
-/* MakeRequest
- *  create a request that can be used to contact HTTP server
- *
- *  "req" [ OUT ] - return parameter for HTTP request object
- *
- *  "url" [ IN ] - full resource identifier. if "conn" is NULL,
- *   the url is parsed for remote endpoint and is opened by mgr.
- */
-LIB_EXPORT rc_t CC KHttpMakeRequest ( const KHttp *self,
-    KHttpRequest **_req, const char *url, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, url );
-    rc = KHttpVMakeRequest ( self, _req, url, args );
-    va_end ( args );
-
-    return rc;
-}
-
-/* MakeRequest
- *  create a request that can be used to contact HTTP server
- *
- *  "req" [ OUT ] - return parameter for HTTP request object
- *
- *  "vers" [ IN ] - http version
- *
- *  "conn" [ IN, NULL OKAY ] - previously opened stream for communications.
- *
- *  "url" [ IN ] - full resource identifier. if "conn" is NULL,
- *   the url is parsed for remote endpoint and is opened by mgr.
- */
-LIB_EXPORT rc_t CC KNSManagerMakeRequest ( const KNSManager *self,
-    KHttpRequest **req, ver_t vers, KStream *conn, const char *url, ... )
-{
-    rc_t rc;
-
-    if ( req == NULL )
-        rc = RC ( rcNS, rcNoTarg, rcValidating, rcParam, rcNull );
-    else
-    {
-        * req = NULL;
-
-        if ( self == NULL )
-            rc = RC ( rcNS, rcNoTarg, rcValidating, rcSelf, rcNull );
-        else if ( vers < 0x01000000 || vers > 0x01010000 )
-            rc = RC ( rcNS, rcNoTarg, rcValidating, rcParam, rcIncorrect );
-        else if ( url == NULL )
-            rc = RC ( rcNS, rcNoTarg, rcValidating, rcString, rcNull );
-        else if ( url [ 0 ] == 0 )
-            rc = RC ( rcNS, rcNoTarg, rcValidating, rcString, rcEmpty );
-        else
-        {
-            va_list args;
-            KDataBuffer buf;
-            
-            KDataBufferClear ( &buf );
-                /* convert var-arg "url" to a full string */
-            va_start ( args, url );
-            rc = KDataBufferVPrintf ( & buf, url, args );
-            va_end ( args );
-            if ( rc == 0 )
-            {
-                /* parse the URL */
-                URLBlock block;
-                rc = ParseUrl ( & block, buf . base, buf . elem_count - 1 );
-                if ( rc == 0 )
-                {
-                    KHttp * http;
-                    
-                    rc = KNSManagerMakeHttpInt ( self, & http, & buf, conn, vers,
-                        self -> http_read_timeout, self -> http_write_timeout, & block . host, block . port );
-                    if ( rc == 0 )
-                    {
-                        rc = KHttpMakeRequestInt ( http, req, & block, & buf );
-                        KHttpRelease ( http );
-                    }
-                }
-            }
-            KDataBufferWhack ( & buf );
-        }
-    }
-    return rc;
-}
-
-
-/* AddRef
- * Release
- *  ignores NULL references
- */
-LIB_EXPORT rc_t CC KHttpRequestAddRef ( const KHttpRequest *self )
-{
-        if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KHttpRequest" ) )
-        {
-        case krefLimit:
-            return RC ( rcNS, rcNoTarg, rcAttaching, rcRange, rcExcessive );
-        case krefNegative:
-            return RC ( rcNS, rcNoTarg, rcAttaching, rcSelf, rcInvalid );
-        default:
-            break;
-        }
-    }
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KHttpRequestRelease ( const KHttpRequest *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KHttpRequest" ) )
-        {
-        case krefWhack:
-            return KHttpRequestWhack ( ( KHttpRequest* ) self );
-        case krefNegative:
-            return RC ( rcNS, rcNoTarg, rcReleasing, rcRange, rcExcessive );
-        default:
-            break;
-        }
-    }
-
-    return 0;
-}
-
-
-/* Connection
- *  sets connection management headers
- *
- *  "close" [ IN ] - if "true", inform the server to close the connection
- *   after its response ( default for version 1.0 ). when "false" ( default
- *   for version 1.1 ), ask the server to keep the connection open.
- *
- * NB - the server is not required to honor the request
- */
-LIB_EXPORT rc_t CC KHttpRequestConnection ( KHttpRequest *self, bool close )
-{
-    rc_t rc = 0;
-
-    if ( self == NULL )
-        rc = RC ( rcNS, rcNoTarg, rcValidating, rcSelf, rcNull );
-    else
-    {
-        String name, value;
-        
-        CONST_STRING ( & name, "Connection" );
-        /* if version is 1.1 and close is true, add 'close' to Connection header value. */
-        /* if version if 1.1 default is false - no action needed */
-        if ( self -> http -> vers == 0x01010000 && close == true )
-            CONST_STRING ( & value, "close" );
-        else if ( self -> http -> vers == 0x01000000 && close == false )
-            CONST_STRING ( & value, "keep-alive" );
-        else
-            return 0;
-
-        rc = KHttpRequestAddHeader ( self,  name . addr, value . addr );
-            
-    }
-    return rc;
-}
-
-
-/* ByteRange
- *  set requested byte range of response
- *
- *  "pos" [ IN ] - beginning offset within remote entity
- *
- *  "bytes" [ IN ] - the number of bytes being requested
- */
-LIB_EXPORT rc_t CC KHttpRequestByteRange ( KHttpRequest *self, uint64_t pos, size_t bytes )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcNS, rcNoTarg, rcValidating, rcSelf, rcNull);
-    else
-    {
-        char  range [ 256 ];
-        size_t num_writ;
-        String name, value;
-        
-        CONST_STRING ( & name, "Range" );
-        rc = string_printf ( range, sizeof range, & num_writ, "bytes=%lu-%lu"
-                             , pos
-                             , pos + bytes - 1);
-        if ( rc == 0 )
-        {
-            StringInitCString ( & value, range );
-
-            rc = KHttpRequestAddHeader ( self, name . addr, value . addr );
-        }
-    }
-    return rc;
-}
-
-
-/* AddHeader
- *  allow addition of an arbitrary HTTP header to message
- */
-LIB_EXPORT rc_t CC KHttpRequestAddHeader ( KHttpRequest *self,
-                                           const char *name, const char *val, ... )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcNS, rcNoTarg, rcValidating, rcSelf, rcNull);
-    else
-    {
-        if ( name == NULL )
-            rc = RC ( rcNS, rcNoTarg, rcValidating, rcParam, rcNull );
-        /* have to test for empty name, too */
-        else if ( name [ 0 ] == 0 )
-            rc = RC ( rcNS, rcNoTarg, rcValidating, rcParam, rcInsufficient );
-        else if ( val == NULL )
-            rc = RC ( rcNS, rcNoTarg, rcValidating, rcParam, rcNull );
-        /* same for empty value fmt string */
-        else if ( val [ 0 ] == 0 )
-            rc = RC ( rcNS, rcNoTarg, rcValidating, rcParam, rcInsufficient );
-        else
-        {
-            size_t name_size;
-
-            va_list args;
-            va_start ( args, val );
-
-            /* disallow setting of "Host" and other headers */
-            name_size = string_size ( name );
-
-            if ( strcase_cmp ( name, name_size, "Host", sizeof "Host", sizeof "Host" - 1 ) == 0 )
-                rc = RC ( rcNS, rcNoTarg, rcComparing, rcParam, rcUnsupported );
-            if ( strcase_cmp ( name, name_size, "Content-Length", sizeof "Content-Length", sizeof "Content-Length" - 1 ) == 0 )
-                rc = RC ( rcNS, rcNoTarg, rcComparing, rcParam, rcUnsupported );
-            else
-                rc = KHttpVAddHeader ( & self -> hdrs, name, val, args );
-
-            va_end ( args );
-        }
-    }
-    return rc;
-}
-
-/* AddPostParam
- *  adds a parameter for POST
- */
-LIB_EXPORT rc_t CC KHttpRequestVAddPostParam ( KHttpRequest *self, const char *fmt, va_list args )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcNS, rcNoTarg, rcValidating, rcSelf, rcNull );
-    else if ( fmt == NULL )
-        rc = RC ( rcNS, rcNoTarg, rcValidating, rcParam, rcNull );
-    else if ( fmt [ 0 ] == 0 )
-        rc = RC ( rcNS, rcNoTarg, rcValidating, rcParam, rcNull );
-    else
-    {
-
-        /* TBD - reject embedded newlines */
-        /* TBD - URL-encoding or at least detect need for it */
-
-        /* first param */
-        if ( self -> body . elem_count == 0 )
-            rc = KDataBufferVPrintf ( & self -> body, fmt, args );
-        else
-        {
-            /* additional param - add separator */
-            rc = KDataBufferPrintf ( & self -> body, "&" );
-            if ( rc == 0 )
-                rc = KDataBufferVPrintf ( & self -> body, fmt, args );
-        }
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KHttpRequestAddPostParam ( KHttpRequest *self, const char *fmt, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, fmt );
-    rc = KHttpRequestVAddPostParam ( self, fmt, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-static
-rc_t KHttpRequestFormatMsg ( const KHttpRequest *self,
-    char *buffer, size_t bsize, const char *method, size_t *len )
-{
-    rc_t rc;
-    size_t total;
-    const KHttpHeader *node;
-    
-    KHttp *http = self -> http;
-
-    /* determine if there is a query */
-    const char *has_query = ( self -> url_block . query . size == 0 ) ? "" : "?";
-
-    /* there are 2 places where the can be a host name stored
-       we give preference to the one attached to the url_block, because
-       it is the most recently determined.
-       If that one is empty, we look at the http object for its
-       host name.
-       Error if both are empty */
-    String hostname = self -> url_block . host;
-    if ( hostname . size == 0 )
-    {
-        hostname = http -> hostname;
-        if ( hostname . size == 0 )
-            return RC ( rcNS, rcNoTarg, rcValidating, rcName, rcEmpty );
-    }
-
-    /* start building the buffer that will be sent 
-       We are inlining the host:port, instead of
-       sending it in its own header */
-
-    /* TBD - should we include the port with the host name? */
-    #if 0
-    rc = string_printf ( buffer, bsize, len, 
-                         "%s %S://%S%S%s%S HTTP/%.2V\r\n"
-                         , method
-                         , & self -> url_block . scheme
-                         , & hostname
-                         , & self -> url_block . path
-                         , has_query
-                         , & self -> url_block . query
-                         , http -> vers );
-     #else
-    rc = string_printf ( buffer, bsize, len, 
-                         "%s %S%s%S HTTP/%.2V\r\nHost: %S\r\nAccept: */*\r\n"
-                         , method
-                         , & self -> url_block . path
-                         , has_query
-                         , & self -> url_block . query
-                         , http -> vers
-                         , & hostname );
-     #endif
-    
-
-    /* print all headers remaining into buffer */
-    total = * len;
-    for ( node = ( const KHttpHeader* ) BSTreeFirst ( & self -> hdrs );
-          rc == 0 && node != NULL;
-          node = ( const KHttpHeader* ) BSTNodeNext ( & node -> dad ) )
-    {
-        /* add header line */
-        rc = string_printf ( & buffer [ total ], bsize - total, len,
-                             "%S: %S\r\n"
-                             , & node -> name
-                             , & node -> value );
-        total += * len;
-    }
-
-    /* add terminating empty header line */
-    if ( rc == 0 )
-    {
-        rc = string_printf ( & buffer [ total ], bsize - total, len, "\r\n" );
-        * len += total;
-    }
-    
-    return rc;
-}
-
-static
-rc_t KHttpRequestHandleRedirection ( KHttpRequest *self, KHttpResult *rslt )
-{
-    rc_t rc = 0;
-    String Location;
-    KHttpHeader *loc;
-
-    /* find relocation URI */
-    CONST_STRING ( & Location, "Location" );
-    loc = ( KHttpHeader* ) BSTreeFind ( & rslt -> hdrs, & Location, KHttpHeaderCmp );
-    if ( loc == NULL )
-    {
-        LOGERR ( klogSys, rc, "Location header not found on relocate msg" );
-        return RC ( rcNS, rcNoTarg, rcValidating, rcNode, rcNull );
-    }
-
-    /* capture the new URI in loc -> value_storage */
-    if ( loc -> value . size == 0 )
-    {
-        LOGERR ( klogSys, rc, "Location does not provide a value" );
-        rc = RC ( rcNS, rcNoTarg, rcValidating, rcNode, rcIncorrect );
-    }
-    else
-    {
-        URLBlock b;
-        KDataBuffer uri;
-        /* pull out uri */
-        rc = KDataBufferSub ( &loc -> value_storage, &uri, loc -> name . size, loc -> value . size + 1 );
-        if ( rc == 0 )
-        {
-            /* parse the URI into local url_block */
-            rc = ParseUrl ( &b, uri . base, uri . elem_count - 1 );
-            if ( rc == 0 )
-            {
-                KHttp *http = self -> http;
-
-                /* close the open http connection and clear out all data except for the manager */
-                KHttpClear ( http );
-
-                /* clear the previous endpoint */
-                http -> ep_valid = false;
-
-                /* reinitialize the http from uri */
-                rc = KHttpInit ( http, &uri, NULL, http -> vers , &b . host, b . port );
-                if ( rc == 0 )
-                {
-                    KHttpRequestClear ( self );
-                    rc = KHttpRequestInit ( self, &b, &uri );
-                    if ( rc == 0 )
-                        KHttpResultRelease ( rslt );
-                }
-            }
-
-            KDataBufferWhack ( & uri );
-        }
-        
-    } 
-
-    return rc;
-}
-
-static
-rc_t KHttpRequestSendReceiveNoBody ( KHttpRequest *self, KHttpResult **_rslt, const char *method )
-{
-    rc_t rc = 0;
-
-    KHttpResult *rslt;
-
-    uint32_t i;
-    const uint32_t max_redirect = 5;
-
-    /* TBD - may want to prevent a Content-Type or other headers here */
-
-    if ( self -> body . elem_count != 0 )
-        return RC ( rcNS, rcNoTarg, rcValidating, rcNoObj, rcIncorrect );
-
-    for ( i = 0; i < max_redirect; ++ i )
-    {
-        size_t len;
-        char buffer [ 4096 ];
-
-        /* create message */
-        rc = KHttpRequestFormatMsg ( self, buffer, sizeof buffer, method, & len );
-        if ( rc != 0 )
-            break;
-
-        /* send the message and create a response */
-        rc = KHttpSendReceiveMsg ( self -> http, _rslt, buffer, len, NULL, self -> url_buffer . base );
-        if ( rc != 0 )
-            break;
-
-        /* look at status code */
-        rslt = * _rslt;
-        switch ( rslt -> status )
-        {
-        case 100:
-            /* Continue
-               The client SHOULD continue with its request. This interim response is used
-               to inform the client that the initial part of the request has been received
-               and has not yet been rejected by the server. The client SHOULD continue by
-               sending the remainder of the request or, if the request has already been completed,
-               ignore this response. The server MUST send a final response after the request
-               has been completed. See section 8.2.3 for detailed discussion of the use and
-               handling of this status code. */
-
-            /* TBD - should not see this, but needs to be handled */
-            return 0;
-
-            /* TBD - need to include RFC rule for handling codes for HEAD and GET */
-        case 301: /* "moved permanently" */
-        case 302: /* "found" - okay to reissue for HEAD and GET, but not for POST */
-        case 307: /* "moved temporarily" */
-            break;
-
-        case 505: /* HTTP Version Not Supported */
-            if ( self -> http -> vers > 0x01000000 )
-            {
-                /* downgrade version requested */
-                self -> http -> vers -= 0x00010000;
-                /* TBD - remove any HTTP/1.1 specific headers */
-                continue;
-            }
-
-            /* NO BREAK */
-
-        default:
-
-            /* TBD - should all status codes be interpreted as rc ? */
-            return 0;
-        }
-
-        /* reset connection, reset request */
-        KOutMsg ( "\nRedirected!!!\n\n" );
-        rc = KHttpRequestHandleRedirection ( self, rslt );
-        if ( rc != 0 )
-            break;
-    }
-    return rc;
-}
-
-/* HEAD
- *  send HEAD message
- */
-LIB_EXPORT rc_t CC KHttpRequestHEAD ( KHttpRequest *self, KHttpResult **rslt )
-{
-    return KHttpRequestSendReceiveNoBody ( self, rslt, "HEAD" );
-} 
-
-/* GET
- *  send GET message
- *  all query AND post parameters are combined in URL
- */
-LIB_EXPORT rc_t CC KHttpRequestGET ( KHttpRequest *self, KHttpResult **rslt )
-{
-    return KHttpRequestSendReceiveNoBody ( self, rslt, "GET" );
-}
-
-/* POST
- *  send POST message
- *  query parameters are sent in URL
- *  post parameters are sent in body
- */
-LIB_EXPORT rc_t CC KHttpRequestPOST ( KHttpRequest *self, KHttpResult **_rslt )
-{
-    rc_t rc = 0;
-
-    KHttpResult *rslt;
-
-    uint32_t i;
-    const uint32_t max_redirect = 5;
-
-    /* TBD comment - add debugging test to ensure "Content-Length" header not present */
-
-    /* fix headers for POST params */
-    if ( self -> body . elem_count > 1 )
-    {
-        /* "body" contains data plus NUL byte */
-        rc = KHttpAddHeader ( & self -> hdrs, "Content-Length", "%lu", self -> body . elem_count - 1 );
-        if ( rc == 0 )
-        {
-            String Content_Type;
-            const KHttpHeader *node;
-
-            CONST_STRING ( & Content_Type, "Content-Type" );
-
-            node = ( const KHttpHeader* ) BSTreeFind ( & self -> hdrs, & Content_Type, KHttpHeaderCmp );
-            if ( node == NULL )
-            {
-                /* add content type for form parameters */
-                /* TBD - before general application, need to perform URL-encoding! */
-                rc = KHttpAddHeader ( & self -> hdrs, "Content-Type", "application/x-www-form-urlencoded" );
-            }
-        }
-    }
-
-    for ( i = 0; i < max_redirect; ++ i )
-    {
-        size_t len;
-        char buffer [ 4096 ];
-
-        /* create message */
-        rc = KHttpRequestFormatMsg ( self, buffer, sizeof buffer, "POST", & len );
-        if ( rc != 0 )
-            break;
-
-        /* send the message and create a response */
-        rc = KHttpSendReceiveMsg ( self -> http, _rslt, buffer, len, & self -> body, self -> url_buffer . base );
-        if ( rc != 0 )
-            break;
-
-        /* look at status code */
-        rslt = * _rslt;
-        switch ( rslt -> status )
-        {
-        case 100:
-            /* Continue
-               The client SHOULD continue with its request. This interim response is used
-               to inform the client that the initial part of the request has been received
-               and has not yet been rejected by the server. The client SHOULD continue by
-               sending the remainder of the request or, if the request has already been completed,
-               ignore this response. The server MUST send a final response after the request
-               has been completed. See section 8.2.3 for detailed discussion of the use and
-               handling of this status code. */
-
-            /* TBD - should not see this, but needs to be handled */
-            return 0;
-
-            /* TBD - Add RFC rules about POST */
-        case 301: /* "moved permanently" */
-        case 307: /* "moved temporarily" */
-            break;
-
-        case 505: /* HTTP Version Not Supported */
-            if ( self -> http -> vers > 0x01000000 )
-            {
-                /* downgrade version requested */
-                self -> http -> vers -= 0x00010000;
-                /* TBD - remove any HTTP/1.1 specific headers */
-                continue;
-            }
-
-            /* NO BREAK */
-
-        default:
-
-            /* TBD - should all status codes be interpreted as rc ? */
-            return 0;
-        }
-
-        /* reset connection, reset request */
-        rc = KHttpRequestHandleRedirection ( self, rslt );
-        if ( rc != 0 )
-            break;
-    }
-    return rc;
-}
-
-/*******************************************************************************************
- * KHttpFile
- */
-
-
-struct KHttpFile
-{
-    KFile dad;
-    
-    uint64_t file_size;
-
-    KHttp *http;
-
-    String url;
-    KDataBuffer url_buffer;
-};
-
-static
-rc_t CC KHttpFileDestroy ( KHttpFile *self )
-{
-    KHttpRelease ( self -> http );
-    KDataBufferWhack ( & self -> url_buffer );
-    free ( self );
-
-    return 0;
-}
-
-static
-struct KSysFile* CC KHttpFileGetSysFile ( const KHttpFile *self, uint64_t *offset )
-{
-    *offset = 0;
-    return NULL;
-}
-
-static
-rc_t CC KHttpFileRandomAccess ( const KHttpFile *self )
-{
-    /* TBD - not all HTTP servers will support this
-       detect if the server does not, and alter the vTable */
-    return 0;
-}
-
-/* KHttpFile must have a file size to be created
-   impossible for this funciton to fail */
-static
-rc_t CC KHttpFileSize ( const KHttpFile *self, uint64_t *size )
-{
-    *size = self -> file_size;
-    return 0;
-}
-
-static
-rc_t CC KHttpFileSetSize ( KHttpFile *self, uint64_t size )
-{
-    return RC ( rcNS, rcFile, rcUpdating, rcFile, rcReadonly );
-}
-
-static
-rc_t CC KHttpFileTimedRead ( const KHttpFile *cself, uint64_t pos,
-    void *buffer, size_t bsize, size_t *num_read, struct timeout_t *tm )
-{
-    rc_t rc;
-    KHttpFile *self = ( KHttpFile * ) cself;
-    KHttp *http = self -> http;
-
-    /* starting position was beyond EOF */
-    if ( pos >= self -> file_size )
-    {
-        *num_read = 0;
-        return 0;
-    }
-#if 0
-    /* position is within http header buffer */
-    else if ( KHttpBlockBufferContainsPos ( http, pos ) )
-    {
-
-    }
-#endif
-    /* starting position was within file but the range fell beyond EOF */
-    else 
-    {
-        KHttpRequest *req;
-
-        /* limit request to file size */
-        if ( pos + bsize > self -> file_size )
-            bsize = self -> file_size - pos;
-        
-        rc = KHttpMakeRequest ( http, &req, self -> url_buffer . base );
-        if ( rc == 0 )
-        {
-            /* request min ( bsize, file_size ) bytes */
-            rc = KHttpRequestByteRange ( req, pos, bsize );
-            if ( rc == 0 )
-            {
-                KHttpResult *rslt;
-                
-                rc = KHttpRequestGET ( req, &rslt );
-                if ( rc == 0 )
-                {
-                    uint32_t code;
-                    
-                    /* dont need to know what the response message was */
-                    rc = KHttpResultStatus ( rslt, &code, NULL, 0, NULL );
-                    if ( rc == 0 )
-                    {
-                        switch ( code )
-                        {
-                        case 206:
-                        {
-                            uint64_t start_pos;
-                            size_t result_size;
-
-                            /* extract actual amount being returned by server */
-                            rc = KHttpResultRange ( rslt, &start_pos, &result_size );
-                            if ( rc == 0 && 
-                                 start_pos == pos &&
-                                 result_size == bsize )
-                            {
-                                KStream *response;
-                                
-                                rc = KHttpResultGetInputStream ( rslt, &response );
-                                if ( rc == 0 )
-                                {
-                                    rc = KStreamTimedReadExactly ( response, buffer, result_size, tm );
-                                    if ( rc != 0 )
-                                    {
-                                        KHttpClose ( http );
-                                        return ResetRCContext ( rc, rcNS, rcFile, rcReading );
-                                    }
-
-                                    * num_read = result_size;
-
-                                    KStreamRelease ( response );
-                                }
-                            }
-                            break;
-                        }
-                        case 416:
-                        default:
-                            rc = RC ( rcNS, rcFile, rcReading, rcFileDesc, rcInvalid );
-                        }
-                    }
-                    KHttpResultRelease ( rslt );
-                }
-            }
-            KHttpRequestRelease ( req );
-        }
-    }
-
-    return rc;
-}
-
-static
-rc_t CC KHttpFileRead ( const KHttpFile *self, uint64_t pos,
-     void *buffer, size_t bsize, size_t *num_read )
-{
-    return KHttpFileTimedRead ( self, pos, buffer, bsize, num_read, NULL );
-}
-
-static
-rc_t CC KHttpFileWrite ( KHttpFile *self, uint64_t pos, 
-    const void *buffer, size_t size, size_t *num_writ )
-{
-    return RC ( rcNS, rcFile, rcUpdating, rcInterface, rcUnsupported );
-}
-
-static
-rc_t CC KHttpFileTimedWrite ( KHttpFile *self, uint64_t pos, 
-    const void *buffer, size_t size, size_t *num_writ, struct timeout_t *tm )
-{
-    return RC ( rcNS, rcFile, rcUpdating, rcInterface, rcUnsupported );
-}
-
-static
-uint32_t CC KHttpFileGetType ( const KHttpFile *self )
-{
-    assert ( self != NULL );
-
-    /* the HTTP file behaves like a read-only file
-       returning kfdSocket would be imply absence of
-       random access: the HTTP protocol adds that. */
-
-    return kfdFile;
-}
-
-static KFile_vt_v1 vtKHttpFile = 
-{
-    1, 2,
-
-    KHttpFileDestroy,
-    KHttpFileGetSysFile,
-    KHttpFileRandomAccess,
-    KHttpFileSize,
-    KHttpFileSetSize,
-    KHttpFileRead,
-    KHttpFileWrite,
-    KHttpFileGetType,
-    KHttpFileTimedRead,
-    KHttpFileTimedWrite
-};
-
-/* LIB_EXPORT */
-rc_t SecretKNSManagerVMakeHttpFile ( const KNSManager *self,
-    const KFile **file, KStream *conn, ver_t vers, const char *url, va_list args )
-{
-    rc_t rc;
-
-    if ( file == NULL )
-        rc = RC ( rcNS, rcFile, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC( rcNS, rcNoTarg, rcConstructing, rcParam, rcNull );
-        else if ( url == NULL )
-            rc = RC ( rcNS, rcFile, rcConstructing, rcPath, rcNull );
-        else if ( url [ 0 ] == 0 )
-            rc = RC ( rcNS, rcFile, rcConstructing, rcPath, rcInvalid );
-        else
-        {
-            KHttpFile *f;
-
-            f = calloc ( 1, sizeof *f );
-            if ( f == NULL )
-                rc = RC ( rcNS, rcFile, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                rc = KFileInit ( &f -> dad, ( const KFile_vt * ) &vtKHttpFile, "KHttpFile", url, true, false );
-                if ( rc == 0 )
-                {
-                    KDataBuffer *buf = & f -> url_buffer;
-                    buf -> elem_bits = 8;
-                    rc = KDataBufferVPrintf ( buf, url, args );
-                    if ( rc == 0 )
-                    {
-                        URLBlock block;
-                        rc = ParseUrl ( &block, buf -> base, buf -> elem_count - 1 );
-                        if ( rc == 0 )
-                        {
-                            KHttp *http;
-                          
-                            rc = KNSManagerMakeHttpInt ( self, & http, buf, conn, vers,
-                                self -> http_read_timeout, self -> http_write_timeout, &block . host, block . port );
-                            if ( rc == 0 )
-                            {
-                                KHttpRequest *req;
-
-                                rc = KHttpMakeRequestInt ( http, &req, &block, buf );
-                                if ( rc == 0 )
-                                {
-                                    KHttpResult *rslt;
-                                  
-                                    rc = KHttpRequestHEAD ( req, &rslt );
-                                    KHttpRequestRelease ( req );
-
-                                    if ( rc == 0 )
-                                    {
-                                        uint64_t size;
-
-                                        bool have_size = KHttpResultSize ( rslt, &size );
-                                        KHttpResultRelease ( rslt );
-
-                                        if ( ! have_size )
-                                            rc = RC ( rcNS, rcFile, rcValidating, rcNoObj, rcError );
-                                        else
-                                        {
-                                            f -> file_size = size;
-                                            f -> http = http;
-
-                                            * file = & f -> dad;
-
-                                            return 0;
-                                        }
-                                    }
-                                }
-
-                                KHttpRelease ( http );
-                            }
-                        }
-                    }
-                    KDataBufferWhack ( buf );
-                }
-                free ( f );
-            }
-        }
-
-        * file = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KNSManagerMakeHttpFile(const KNSManager *self,
-    const KFile **file, struct KStream *conn, ver_t vers, const char *url, ...)
-{
-    rc_t rc = 0;
-    va_list args;
-    va_start(args, url);
-    rc = KNSManagerVMakeHttpFile(self, file, conn, vers, url, args);
-    va_end(args);
-    return rc;
-}
-
-rc_t SecretKNSManagerMakeHttpFile(const KNSManager *self,
-    const KFile **file, struct KStream *conn, ver_t vers, const char *url, ...)
-{
-    rc_t rc = 0;
-    va_list args;
-    va_start(args, url);
-    rc = SecretKNSManagerVMakeHttpFile(self, file, conn, vers, url, args);
-    va_end(args);
-    return rc;
-}
diff --git a/libs/kns/kns_manager-ext.c b/libs/kns/kns_manager-ext.c
deleted file mode 100644
index 83ac39c..0000000
--- a/libs/kns/kns_manager-ext.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kns/extern.h>
-
-#include <kns/manager-ext.h>
-#include <kns/http.h>
-#include <kns/stream.h>
-
-#include <klib/sra-release-version.h>
-#include <klib/data-buffer.h>
-#include <klib/debug.h>
-#include <klib/rc.h>
-
-#include <ctype.h>
-#include <string.h>
-#include <assert.h>
-
-
-/** These functions belong to Extended KNSManager **/
-
-
-#define RELEASE(type, obj) do { rc_t rc2 = type##Release(obj); \
-    if (rc2 != 0 && rc == 0) { rc = rc2; } obj = NULL; } while (false)
-
-static rc_t CC KNSManagerNewReleaseVersionImpl(const struct KNSManager *self,
-    SraReleaseVersion *newVersion)
-{
-    rc_t rc = 0;
-    KDataBuffer result;
-    KHttpRequest *req = NULL;
-    KHttpResult *rslt = NULL;
-    if (newVersion == NULL) {
-        return RC(rcNS, rcArgv, rcAccessing, rcParam, rcNull);
-    }
-    memset(newVersion, 0, sizeof *newVersion);
-    if (self == NULL) {
-        return RC(rcNS, rcArgv, rcAccessing, rcSelf, rcNull);
-    }
-    memset(&result, 0, sizeof result);
-    if (rc == 0) {
-        rc = KNSManagerMakeRequest(self, &req, 0x01010000, NULL,
-  "http://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/current/sratoolkit.current.version"
-        );
-    }
-    if (rc == 0) {
-        rc = KHttpRequestGET(req, &rslt);
-    }
-    if (rc == 0) {
-        uint32_t code = 0;
-        rc = KHttpResultStatus(rslt, &code, NULL, 0, NULL);
-        if (rc == 0) {
-            if (code != 200) {
-                rc = RC(rcNS, rcFile, rcReading, rcFile, rcInvalid);
-            }
-        }
-    }
-    if (rc == 0) {
-        size_t total = 0;
-        KStream *response = NULL;
-        rc = KHttpResultGetInputStream(rslt, &response);
-        if (rc == 0) {
-            rc = KDataBufferMakeBytes(&result, 1024);
-        }
-        while (rc == 0) {
-            size_t num_read = 0;
-            uint8_t *base = NULL;
-            uint64_t avail = result.elem_count - total;
-            if (avail < 256) {
-                rc = KDataBufferResize(&result, result.elem_count + 1024);
-                if (rc != 0) {
-                    break;
-                }
-            }
-            base = result.base;
-            rc = KStreamRead(response, &base[total], result.elem_count - total,
-                &num_read);
-            if (num_read > 0 || rc != 0) {
-                DBGMSG(DBG_VFS, DBG_FLAG(DBG_VFS), ("KStreamRead"
-                    "(sratoolkit.current.version, %zu) = %R\n", num_read, rc));
-            }
-            if (rc != 0) {
-                /* TBD - look more closely at rc */
-                if (num_read > 0) {
-                    rc = 0;
-                }
-                else {
-                    break;
-                }
-            }
-            if (num_read == 0) {
-                break;
-            }
-            total += num_read;
-        }
-        RELEASE(KStream, response);
-        if (rc == 0) {
-            DBGMSG(DBG_VFS, DBG_FLAG(DBG_VFS),
-                ("sratoolkit.current.version (%zu)\n", total));
-            result.elem_count = total;
-        }
-    }
-
-    if (rc == 0) {
-        const char *start = (const void*)(result.base);
-        size_t size = KDataBufferBytes(&result);
-        DBGMSG(DBG_VFS, DBG_FLAG(DBG_VFS),
-            ("sratoolkit.current.version = '%.*s'\n", (uint32_t)size, start));
-        rc = SraReleaseVersionInit(newVersion, start, size);
-    }
-
-    KDataBufferWhack(&result);
-    RELEASE(KHttpResult, rslt);
-    RELEASE(KHttpRequest, req);
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KNSManagerNewReleaseVersion(const struct KNSManager *self,
-    SraReleaseVersion *newVersion)
-{
-    rc_t rc = 0;
-    int i = 0, retryOnFailure = 2;
-    for (i = 0; i < retryOnFailure; ++i) {
-        rc = KNSManagerNewReleaseVersionImpl(self, newVersion);
-        if (rc == 0) {
-            break;
-        }
-        DBGMSG(DBG_KNS, DBG_FLAG(DBG_KNS_ERR), (
-            "@@@@@@@@2: KNSManagerNewReleaseVersion %d/%d = %R"
-            "\n", i + 1, retryOnFailure, rc));
-    }
-    return rc;
-}
diff --git a/libs/kns/kns_manager.c b/libs/kns/kns_manager.c
deleted file mode 100644
index 944a85c..0000000
--- a/libs/kns/kns_manager.c
+++ /dev/null
@@ -1,345 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kns/extern.h>
-
-#include <klib/refcount.h>
-#include <klib/rc.h>
-#include <kfs/dyload.h>
-#include <kfs/directory.h>
-#include <kfs/impl.h>
-
-#include "kns_mgr_priv.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-#include <sysalloc.h>
-
-static const char knsmanager_classname [] = "KNSManager";
-static struct KNSManager * kns_mgr_singleton = NULL;
-static KDylib *lib_curl_handle = NULL;
-
-
-LIB_EXPORT rc_t CC KNSManagerAddRef ( const struct KNSManager *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd( &self->refcount, knsmanager_classname ) )
-        {
-        case krefOkay:
-            break;
-        case krefZero:
-            return RC( rcNS, rcMgr, rcAttaching, rcRefcount, rcIncorrect);
-        case krefLimit:
-            return RC( rcNS, rcMgr, rcAttaching, rcRefcount, rcExhausted);
-        case krefNegative:
-            return RC( rcNS, rcMgr, rcAttaching, rcRefcount, rcInvalid);
-        default:
-            return RC( rcNS, rcMgr, rcAttaching, rcRefcount, rcUnknown);
-        }
-    }
-    return 0;
-}
-
-
-static rc_t KNSManager_Make_DlCurl( KDyld ** dl )
-{
-    rc_t rc = KDyldMake ( dl );
-#if ! WINDOWS
-    if ( rc == 0 )
-    {
-        const KDirectory * dir;
-        rc = KDyldHomeDirectory ( *dl, &dir, ( fptr_t ) KNSManager_Make_DlCurl );
-        if ( rc == 0 )
-        {
-            struct KSysDir const *sysdir = KDirectoryGetSysDir ( dir );
-            if ( sysdir != NULL )
-            {
-                char int_path[ 4096 ];
-                rc = KSysDirRealPath ( sysdir, int_path, sizeof int_path, "." );
-                if ( rc == 0 )
-                {
-                    KDyldAddSearchPath ( *dl, int_path );
-                }
-            }
-            KDirectoryRelease( dir );
-        }
-        rc = 0;
-    }
-#endif
-    return rc;
-}
-
-static rc_t KNSManagerLoadLib( struct KNSManager *self )
-{
-#ifdef HAVE_LIBCURL /* just link directly */
-    self->curl_easy_init_fkt      = &curl_easy_init;
-    self->curl_easy_cleanup_fkt   = &curl_easy_cleanup;
-    self->curl_easy_setopt_fkt    = &curl_easy_setopt;
-    self->curl_easy_perform_fkt   = &curl_easy_perform;
-    self->curl_easy_getinfo_fkt   = &curl_easy_getinfo;
-    self->curl_slist_append_fkt   = &curl_slist_append;
-    self->curl_slist_free_all_fkt = &curl_slist_free_all;
-
-    return 0;
-#else
-    KDyld *dl;
-    /* make a dynamic-library loader */
-    rc_t rc = KDyldMake ( &dl );
-    if ( rc == 0 )
-    {
-        /* load the curl-library */
-        rc = KDyldLoadLib( dl, &lib_curl_handle, LPFX "curl" SHLX );
-        if ( rc != 0 )
-        {
-            KDyldRelease ( dl );
-            rc = KNSManager_Make_DlCurl( &dl );
-            if ( rc == 0 )
-            {
-                rc = KDyldLoadLib( dl, &lib_curl_handle, LPFX "curl" SHLX );
-            }
-        }
-        if ( rc == 0 )
-        {
-            KSymAddr *sym;
-
-            /* resolve symbols */
-
-            /* curl_easy_init() */
-            rc = KDylibSymbol( lib_curl_handle, &sym, "curl_easy_init" );
-            if ( rc == 0 )
-            {
-                KSymAddrAsFunc( sym, ( fptr_t* ) &(self->curl_easy_init_fkt) );
-                KSymAddrRelease( sym );
-            }
-
-            /* curl_easy_cleanup() */
-            if ( rc == 0 )
-            {
-                rc = KDylibSymbol( lib_curl_handle, &sym, "curl_easy_cleanup" );
-                KSymAddrAsFunc( sym, ( fptr_t* ) &(self->curl_easy_cleanup_fkt) );
-                KSymAddrRelease( sym );
-            }
-
-            /* curl_easy_setopt() */
-            if ( rc == 0 )
-            {
-                rc = KDylibSymbol( lib_curl_handle, &sym, "curl_easy_setopt" );
-                KSymAddrAsFunc( sym, ( fptr_t* ) &(self->curl_easy_setopt_fkt) );
-                KSymAddrRelease( sym );
-            }
-
-            /* curl_easy_perform() */
-            if ( rc == 0 )
-            {
-                rc = KDylibSymbol( lib_curl_handle, &sym, "curl_easy_perform" );
-                KSymAddrAsFunc( sym, ( fptr_t* ) &(self->curl_easy_perform_fkt) );
-                KSymAddrRelease( sym );
-            }
-
-            /* curl_easy_getinfo() */
-            if ( rc == 0 )
-            {
-                rc = KDylibSymbol( lib_curl_handle, &sym, "curl_easy_getinfo" );
-                KSymAddrAsFunc( sym, ( fptr_t* ) &(self->curl_easy_getinfo_fkt) );
-                KSymAddrRelease( sym );
-            }
-
-            /* curl_slist_append() */
-            if ( rc == 0 )
-            {
-                rc = KDylibSymbol( lib_curl_handle, &sym, "curl_slist_append" );
-                KSymAddrAsFunc( sym, ( fptr_t* ) &(self->curl_slist_append_fkt) );
-                KSymAddrRelease( sym );
-            }
-
-            /* curl_version() */
-            if ( rc == 0 )
-            {
-                rc = KDylibSymbol( lib_curl_handle, &sym, "curl_version" );
-                KSymAddrAsFunc( sym, ( fptr_t* ) &(self->curl_version_fkt) );
-                KSymAddrRelease( sym );
-            }
-
-            /* curl_slist_free_all() */
-            if ( rc == 0 )
-            {
-                rc = KDylibSymbol( lib_curl_handle, &sym, "curl_slist_free_all" );
-                KSymAddrAsFunc( sym, ( fptr_t* ) &(self->curl_slist_free_all_fkt) );
-                KSymAddrRelease( sym );
-            }
-
-            /* bail on error */
-            if ( rc != 0 )
-            {
-                KDylibRelease ( lib_curl_handle );
-                lib_curl_handle = NULL;
-                self->curl_easy_init_fkt = NULL;
-                self->curl_easy_cleanup_fkt = NULL;
-                self->curl_easy_setopt_fkt = NULL;
-                self->curl_easy_perform_fkt = NULL;
-                self->curl_slist_append_fkt = NULL;
-                self->curl_version_fkt = NULL;
-                self->curl_easy_getinfo_fkt = NULL;
-            }
-        }
-        KDyldRelease ( dl );
-    }
-
-    return rc;
-#endif
-}
-
-
-LIB_EXPORT rc_t CC KNSManagerMake( struct KNSManager **self )
-{
-    rc_t rc = 0;
-
-    if ( self == NULL )
-        return RC( rcNS, rcMgr, rcConstructing, rcSelf, rcNull );
-
-    *self = kns_mgr_singleton;
-    if ( kns_mgr_singleton != NULL )
-    {
-/*      fprintf(stderr, "%p KNSManagerMake(KNSManagerAddRef)\n", *self); */
-        rc = KNSManagerAddRef( kns_mgr_singleton );
-        if ( rc != 0 )
-            *self = NULL;
-    }
-    else
-    {
-        struct KNSManager *tmp;
-        tmp = calloc( 1, sizeof * tmp );
-        if ( tmp == NULL )
-            rc = RC( rcNS, rcMgr, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            rc = KNSManagerInit ( tmp );
-            if ( rc != 0 )
-            {
-                free ( tmp );
-                tmp = NULL;
-            }
-            else
-            {
-                tmp->create_rc = KNSManagerLoadLib( tmp );
-                KRefcountInit( &tmp->refcount, 1, "KNS", "make", knsmanager_classname );
-/*              fprintf(stderr,
-                    "%p KNSManagerLoadLib = %d\n", tmp, tmp->create_rc); */
-            }
-        }
-        *self = tmp;
-        kns_mgr_singleton = tmp;
-    }
-
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC KNSManagerAvail( const struct KNSManager *self )
-{
-    if ( self == NULL )
-        return RC( rcNS, rcMgr, rcReading, rcSelf, rcNull );
-    return self->create_rc;
-}
-
-
-LIB_EXPORT rc_t CC KNSManagerCurlVersion( const struct KNSManager *self, const char ** version_string )
-{
-    if ( self == NULL )
-        return RC( rcNS, rcMgr, rcReading, rcSelf, rcNull );
-    if ( version_string == NULL )
-        return RC( rcNS, rcMgr, rcReading, rcParam, rcNull );
-    if ( self->create_rc != 0 )
-        return self->create_rc;
-    *version_string = self->curl_version_fkt();
-    return 0;
-}
-
-
-LIB_EXPORT void KNSManagerSetVerbose ( struct KNSManager *self, bool verbosity )
-{
-    if ( self != NULL )
-        self->verbose = verbosity;
-}
-
-
-LIB_EXPORT bool KNSManagerIsVerbose ( struct KNSManager *self )
-{
-    if ( self != NULL )
-        return self->verbose;
-    else
-        return false;
-}
-
-
-static rc_t KNSManagerDestroy( struct KNSManager *self )
-{
-    if ( self == NULL )
-        return RC( rcNS, rcFile, rcDestroying, rcSelf, rcNull );
-
-/*  fprintf(stderr, "%p KNSManagerDestroy\n", self); */
-
-    KDylibRelease ( lib_curl_handle );
-    lib_curl_handle = NULL;
-
-    KNSManagerCleanup ( self );
-
-    KRefcountWhack( &self->refcount, knsmanager_classname );
-
-    memset(self, 0, sizeof *self);
-    free( self );
-    kns_mgr_singleton = NULL;
-    
-    return 0;
-}
-
-
-LIB_EXPORT rc_t CC KNSManagerRelease( const struct KNSManager *self )
-{
-    rc_t rc = 0;
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop( &self->refcount, knsmanager_classname ) )
-        {
-        case krefOkay:
-        case krefZero:
-/*        fprintf(stderr, "%p KNSManagerRelease(!KNSManagerDestroy)\n", self);*/
-            break;
-        case krefWhack:
-            rc = KNSManagerDestroy( ( struct KNSManager * )self );
-            break;
-        case krefNegative:
-            return RC( rcNS, rcMgr, rcAttaching, rcRefcount, rcInvalid );
-        default:
-            rc = RC( rcNS, rcMgr, rcAttaching, rcRefcount, rcUnknown );
-            break;            
-        }
-    }
-    return rc;
-}
diff --git a/libs/kns/linux/sysendpoint.c b/libs/kns/linux/sysendpoint.c
deleted file mode 100644
index c1daba0..0000000
--- a/libs/kns/linux/sysendpoint.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kns/impl.h>
-#include <kns/endpoint.h>
-#include <klib/text.h>
-#include <klib/printf.h>
-#include <klib/rc.h>
-#include <klib/data-buffer.h>
-
-#include "stream-priv.h"
-
-#include <string.h>
-#include <netdb.h>
-#include <arpa/inet.h>
-#include <assert.h>
-
-#include <errno.h>  /* ERANGE definition */
-
-#include <sysalloc.h>
-
-extern int h_errno;
-
-/* InitDNSEndpoint
- *  initialize the endpoint with a DNS name and a port number
- *
- *  "ep" [ OUT ] - address of endpoint block to be intialized
- *
- *  "dns" [ IN ] - textual DNS address.
- *
- *  "port" [ IN, DEFAULT 0 ] - binary port number in native integer byte order.
- *   if the special port number 0 is given, it represents any available port.
- */
-LIB_EXPORT
-rc_t CC KNSManagerInitDNSEndpoint ( struct KNSManager const *self,
-    KEndPoint *ep, struct String const *dns, uint16_t port )
-{
-    rc_t rc = 0;
-
-    if ( ep == NULL )
-        rc = RC (rcNS, rcNoTarg, rcInitializing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcNS, rcNoTarg, rcInitializing, rcSelf, rcNull );
-        else if ( dns == NULL )
-            rc = RC ( rcNS, rcNoTarg, rcInitializing, rcParam, rcNull );
-        else if ( dns -> size == 0 )
-            rc = RC ( rcNS, rcNoTarg, rcInitializing, rcSelf, rcInsufficient );
-        else
-        {
-            KDataBuffer b;
-            char buffer [ 4096 ], * hostname = buffer;
-            size_t buff_size = sizeof buffer;
-
-            if ( dns -> size >= sizeof buffer )
-            {
-                rc = KDataBufferMakeBytes ( & b, dns -> size + 1 );
-                if ( rc == 0 )
-                {
-                    hostname = b . base;
-                    buff_size = ( size_t ) b . elem_count;
-                }
-            }
-
-            if ( rc == 0 )
-            {
-                size_t size;
-                rc = string_printf ( hostname, buff_size, & size, "%S", dns );
-
-                assert ( rc == 0 );
-                assert ( size < buff_size );
-                assert ( hostname [ size ] == 0 );
-
-                if ( rc ==  0 )
-                {
-                    char BB [ 1024 ];
-                    struct hostent ret;
-                    struct hostent * remote = NULL;
-                    int h_errnop = 0;
-                    int ghbnr = 0;
-
-                    ghbnr = gethostbyname_r (
-                                        hostname,
-                                        & ret,
-                                        BB,
-                                        sizeof ( BB ),
-                                        & remote,
-                                        & h_errnop
-                                        );
-                    if ( ghbnr == 0 && remote != NULL )
-                    { 
-                        ep -> type = epIPV4;
-                        memcpy ( & ep -> u . ipv4 . addr, remote -> h_addr_list [ 0 ], sizeof ep -> u . ipv4 . addr );
-                        ep -> u . ipv4 . addr = htonl ( ep -> u . ipv4 . addr );
-                        ep -> u . ipv4 . port = ( uint16_t ) port;
-                    }
-                    else switch ( h_errnop )
-                    {
-                    case HOST_NOT_FOUND: /* The specified host is unknown */
-                        rc = RC ( rcNS, rcNoTarg, rcValidating, rcConnection, rcNotFound );
-                        break;
-                    case NO_ADDRESS: /* The requested names valid but does not have an IP address */
-                        rc = RC ( rcNS, rcNoTarg, rcValidating, rcConnection, rcInconsistent );
-                        break;
-#if ! defined NO_ADDRESS || ! defined NO_DATA || NO_ADDRESS != NO_DATA
-                    case NO_DATA: /* The requested name s valid but does not have an IP address */
-                        rc = RC ( rcNS, rcNoTarg, rcValidating, rcConnection, rcEmpty );
-                        break;
-#endif
-                    case NO_RECOVERY: /* A nonrecoverable name server error occured */
-                        rc = RC ( rcNS, rcNoTarg, rcValidating, rcConnection, rcError );
-                        break;
-                    case TRY_AGAIN: /* A temporary error occured on an authoritative name server. Try again later */
-                        rc = RC ( rcNS, rcNoTarg, rcValidating, rcConnection, rcBusy );
-                        break;
-                    case ERANGE:
-                        rc = RC ( rcNS, rcNoTarg, rcValidating, rcConnection, rcExhausted );
-                        break;
-                    default :
-                        rc = RC ( rcNS, rcNoTarg, rcValidating, rcConnection, rcError );
-                    }
-                }
-            }
-
-            if ( hostname != buffer )
-                KDataBufferWhack ( & b );
-        }
-
-        if ( rc != 0 )
-            memset ( ep, 0, sizeof * ep );        
-    }
-
-    return rc;
-}
diff --git a/libs/kns/linux/syspoll.c b/libs/kns/linux/syspoll.c
deleted file mode 100644
index 6e3014f..0000000
--- a/libs/kns/linux/syspoll.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-
-#include <kns/extern.h>
-#include <klib/log.h>
-#include <klib/out.h>
-#include <kproc/timeout.h>
-#include <os-native.h>
-
-#include "poll-priv.h"
-
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-#include <os-native.h>
-
-#include <poll.h>
-#include <unistd.h>
-#include <errno.h>
-
-
-/* socket_wait
- *  wait for an event or a timeout
- */
-int socket_wait ( int fd, int events, timeout_t *tm )
-{
-    int i, status;
-    struct pollfd fds [ 1 ];
-        
-    /* poll for data with no delay */
-    for ( i = 0; i < 2; ++ i )
-    {
-        fds [ 0 ] . fd = fd;
-        fds [ 0 ] . events = events;
-        fds [ 0 ] . revents = 0;
-        
-        status = poll ( fds, sizeof fds / sizeof fds [ 0 ], 0 );
-        if ( status > 0 )
-            return fds [ 0 ] . revents;
-        if ( status < 0 )
-            return -1;
-    }
-
-    /* test for infinite timeout */
-    while ( tm == NULL )
-    {
-        status = poll ( fds, sizeof fds / sizeof fds [ 0 ], 1000 );
-        if ( status > 0 )
-            return fds [ 0 ] . revents;
-        if ( status < 0 )
-            return -1;
-
-        /* TBD - check for quitting event
-           this may want to be a callback on the manager
-           or on the socket */
-    }
-
-    /* no blocking */
-    if ( tm -> mS == 0 )
-        return 0;
-
-#if PPOLL_USED_A_PROPER_TIMEOUT_INSTEAD_OF_BEING_CLOWNS
-
-    /* convert to absolute time */
-    if ( ! tm -> prepared )
-        TimeoutPrepare ( tm );
-
-    /* wait until final guy */
-    status = ppoll ( fds, sizeof fds / sizeof fds [ 0 ], & tm -> ts, NULL );
-
-#elif WHY_BOTHER_WITH_PPOLL_WHEN_POLL_TAKES_A_RELATIVE_TIMEOUT_ALREADY || 1
-
-    /* wait until final guy */
-    status = poll ( fds, sizeof fds / sizeof fds [ 0 ], tm -> mS );
-
-#endif
-
-    if ( status > 0 )
-        return fds [ 0 ] . revents;
-
-    return status;
-}
diff --git a/libs/kns/mac/sysendpoint.c b/libs/kns/mac/sysendpoint.c
deleted file mode 100644
index 456f336..0000000
--- a/libs/kns/mac/sysendpoint.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kns/impl.h>
-#include <kns/endpoint.h>
-#include <klib/text.h>
-#include <klib/printf.h>
-#include <klib/rc.h>
-#include <klib/data-buffer.h>
-
-#include "stream-priv.h"
-
-#include <string.h>
-#include <netdb.h>
-#include <arpa/inet.h>
-#include <assert.h>
-
-#include <sysalloc.h>
-
-extern int h_errno;
-
-/* InitDNSEndpoint
- *  initialize the endpoint with a DNS name and a port number
- *
- *  "ep" [ OUT ] - address of endpoint block to be intialized
- *
- *  "dns" [ IN ] - textual DNS address.
- *
- *  "port" [ IN, DEFAULT 0 ] - binary port number in native integer byte order.
- *   if the special port number 0 is given, it represents any available port.
- */
-LIB_EXPORT
-rc_t CC KNSManagerInitDNSEndpoint ( struct KNSManager const *self,
-    KEndPoint *ep, struct String const *dns, uint16_t port )
-{
-    rc_t rc = 0;
-
-    if ( ep == NULL )
-        rc = RC (rcNS, rcNoTarg, rcInitializing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcNS, rcNoTarg, rcInitializing, rcSelf, rcNull );
-        else if ( dns == NULL )
-            rc = RC ( rcNS, rcNoTarg, rcInitializing, rcParam, rcNull );
-        else if ( dns -> size == 0 )
-            rc = RC ( rcNS, rcNoTarg, rcInitializing, rcSelf, rcInsufficient );
-        else
-        {
-            KDataBuffer b;
-            char buffer [ 4096 ], * hostname = buffer;
-            size_t buff_size = sizeof buffer;
-
-            if ( dns -> size >= sizeof buffer )
-            {
-                rc = KDataBufferMakeBytes ( & b, dns -> size + 1 );
-                if ( rc == 0 )
-                {
-                    hostname = b . base;
-                    buff_size = ( size_t ) b . elem_count;
-                }
-            }
-
-            if ( rc == 0 )
-            {
-                size_t size;
-                rc = string_printf ( hostname, buff_size, & size, "%S", dns );
-
-                assert ( rc == 0 );
-                assert ( size < buff_size );
-                assert ( hostname [ size ] == 0 );
-
-                if ( rc ==  0 )
-                {
-                    struct hostent *remote = gethostbyname ( hostname );
-                    if ( remote != NULL )
-                    { 
-                        ep -> type = epIPV4;
-                        memcpy ( & ep -> u . ipv4 . addr, remote -> h_addr_list [ 0 ], sizeof ep -> u . ipv4 . addr );
-                        ep -> u . ipv4 . addr = htonl ( ep -> u . ipv4 . addr );
-                        ep -> u . ipv4 . port = ( uint16_t ) port;
-                    }
-                    else switch ( h_errno )
-                    {
-                    case HOST_NOT_FOUND: /* The specified host is unknown */
-                        rc = RC ( rcNS, rcNoTarg, rcValidating, rcConnection, rcNotFound );
-                        break;
-                    case NO_ADDRESS: /* The requested names valid but does not have an IP address */
-                        rc = RC ( rcNS, rcNoTarg, rcValidating, rcConnection, rcInconsistent );
-                        break;
-#if ! defined NO_ADDRESS || ! defined NO_DATA || NO_ADDRESS != NO_DATA
-                    case NO_DATA: /* The requested name s valid but does not have an IP address */
-                        rc = RC ( rcNS, rcNoTarg, rcValidating, rcConnection, rcEmpty );
-                        break;
-#endif
-                    case NO_RECOVERY: /* A nonrecoverable name server error occured */
-                        rc = RC ( rcNS, rcNoTarg, rcValidating, rcConnection, rcError );
-                        break;
-                    case TRY_AGAIN: /* A temporary error occured on an authoritative name server. Try again later */
-                        rc = RC ( rcNS, rcNoTarg, rcValidating, rcConnection, rcBusy );
-                        break;
-                    default :
-                        rc = RC ( rcNS, rcNoTarg, rcValidating, rcConnection, rcError );
-                    }
-                }
-            }
-
-            if ( hostname != buffer )
-                KDataBufferWhack ( & b );
-        }
-
-        if ( rc != 0 )
-            memset ( ep, 0, sizeof * ep );        
-    }
-
-    return rc;
-}
diff --git a/libs/kns/mac/syspoll.c b/libs/kns/mac/syspoll.c
deleted file mode 100644
index 4c41f48..0000000
--- a/libs/kns/mac/syspoll.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-
-#include <kns/extern.h>
-#include <klib/log.h>
-#include <klib/out.h>
-#include <kproc/timeout.h>
-
-#include "poll-priv.h"
-
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-#include <os-native.h>
-
-#include <poll.h>
-#include <unistd.h>
-#include <errno.h>
-
-
-/* socket_wait
- *  wait for an event or a timeout
- */
-int socket_wait ( int fd, int events, timeout_t *tm )
-{
-    int i, status;
-    struct pollfd fds [ 1 ];
-        
-    /* poll for data with no delay */
-    for ( i = 0; i < 2; ++ i )
-    {
-        fds [ 0 ] . fd = fd;
-        fds [ 0 ] . events = events;
-        fds [ 0 ] . revents = 0;
-        
-        status = poll ( fds, sizeof fds / sizeof fds [ 0 ], 0 );
-        if ( status > 0 )
-            return fds [ 0 ] . revents;
-        if ( status < 0 )
-            return -1;
-    }
-
-    /* test for infinite timeout */
-    while ( tm == NULL )
-    {
-        status = poll ( fds, sizeof fds / sizeof fds [ 0 ], 1000 );
-        if ( status > 0 )
-            return fds [ 0 ] . revents;
-        if ( status < 0 )
-            return -1;
-
-        /* TBD - check for quitting event
-           this may want to be a callback on the manager
-           or on the socket */
-    }
-
-    /* no blocking */
-    if ( tm -> mS == 0 )
-        return 0;
-
-    /* Darwin doesn't appear to support ppoll,
-       so we just wait for the specified mS,
-       regardless of how long we may have waited before */
-
-    /* wait until final guy */
-    status = poll ( fds, sizeof fds / sizeof fds [ 0 ], tm -> mS );
-    if ( status > 0 )
-        return fds [ 0 ] . revents;
-
-    return status;
-}
diff --git a/libs/kns/manager.c b/libs/kns/manager.c
deleted file mode 100644
index 821ee61..0000000
--- a/libs/kns/manager.c
+++ /dev/null
@@ -1,307 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kns/extern.h>
-
-#include <kns/manager.h>
-#include <kns/socket.h>
-#include <klib/refcount.h>
-#include <klib/rc.h>
-
-#include "mgr-priv.h"
-#include "http-priv.h"
-#include "stream-priv.h"
-#include "sysmgr.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-#include <sysalloc.h>
-
-#ifndef MAX_CONN_LIMIT
-#define MAX_CONN_LIMIT ( 10 * 60 )
-#endif
-
-#ifndef MAX_CONN_READ_LIMIT
-#define MAX_CONN_READ_LIMIT ( 10 * 60 * 1000 )
-#endif
-
-#ifndef MAX_CONN_WRITE_LIMIT
-#define MAX_CONN_WRITE_LIMIT ( 10 * 60 * 1000 )
-#endif
-
-static
-rc_t KNSManagerWhack ( KNSManager * self )
-{
-    free ( self );
-    KNSManagerCleanup ();
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KNSManagerAddRef ( const KNSManager *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd( &self->refcount, "KNSManager" ) )
-        {
-        case krefLimit:
-            return RC ( rcNS, rcMgr, rcAttaching, rcRefcount, rcExcessive );
-        case krefNegative:
-            return RC ( rcNS, rcMgr, rcAttaching, rcRefcount, rcInvalid );
-        }
-    }
-    return 0;
-}
-
-
-LIB_EXPORT rc_t CC KNSManagerRelease ( const KNSManager *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KNSManager" ) )
-        {
-        case krefWhack:
-            return KNSManagerWhack ( ( KNSManager * ) self );
-        case krefNegative:
-            return RC ( rcNS, rcMgr, rcAttaching, rcRefcount, rcInvalid );
-        }
-    }
-    return 0;
-}
-
-
-LIB_EXPORT rc_t CC KNSManagerMake ( KNSManager **mgrp )
-{
-    rc_t rc;
-
-    if ( mgrp == NULL )
-        rc = RC ( rcNS, rcMgr, rcAllocating, rcParam, rcNull );
-    else
-    {
-        KNSManager * mgr = calloc ( 1, sizeof * mgr );
-        if ( mgr == NULL )
-            rc = RC ( rcNS, rcMgr, rcAllocating, rcMemory, rcExhausted );
-        else
-        {
-            KRefcountInit ( & mgr -> refcount, 1, "KNSManager", "init", "kns" );
-            mgr -> conn_timeout = MAX_CONN_LIMIT;
-            mgr -> conn_read_timeout = MAX_CONN_READ_LIMIT;
-            mgr -> conn_write_timeout = MAX_CONN_WRITE_LIMIT;
-            mgr -> http_read_timeout = MAX_HTTP_READ_LIMIT;
-            mgr -> http_write_timeout = MAX_HTTP_WRITE_LIMIT;
-            mgr -> verbose = false;
-
-            rc = KNSManagerInit ();
-            if ( rc == 0 )
-            {
-                * mgrp = mgr;
-                return 0;
-            }
-
-            free ( mgr );
-        }
-
-        * mgrp = NULL;
-    }
-
-    return rc;
-}
-
-
-LIB_EXPORT void KNSManagerSetVerbose ( KNSManager *self, bool verbosity )
-{
-    if ( self != NULL )
-        self -> verbose = verbosity;
-}
-
-
-LIB_EXPORT bool KNSManagerIsVerbose ( const KNSManager *self )
-{
-    return ( self != NULL ) ? self -> verbose : false;
-}
-
-
-/* MakeConnection
- *  create a connection-oriented stream
- *
- *  "conn" [ OUT ] - a stream for communication with the server
- *
- *  "from" [ IN ] - client endpoint
- *
- *  "to" [ IN ] - server endpoint 
- *
- *  both endpoints have to be of type epIP; creates a TCP connection
- */
-LIB_EXPORT rc_t CC KNSManagerMakeConnection ( const KNSManager * self,
-    struct KStream **conn, struct KEndPoint const *from, struct KEndPoint const *to )
-{
-    if ( self == NULL )
-    {
-        if ( conn == NULL )
-            return RC ( rcNS, rcStream, rcConstructing, rcParam, rcNull );
-
-        * conn = NULL;
-
-        return RC ( rcNS, rcStream, rcConstructing, rcSelf, rcNull );
-    }
-
-    return KNSManagerMakeRetryTimedConnection ( self, conn, 
-        self -> conn_timeout, self -> conn_read_timeout, self -> conn_write_timeout, from, to );
-}
-/* MakeTimedConnection
- *  create a connection-oriented stream
- *
- *  "conn" [ OUT ] - a stream for communication with the server
- *
- *  "retryTimeout" [ IN ] - if connection is refused, retry with 1ms intervals: when negative, retry infinitely,
- *   when 0, do not retry, positive gives maximum wait time in seconds 
- *
- *  "readMillis" [ IN ] and "writeMillis" - when negative, infinite timeout
- *   when 0, return immediately, positive gives maximum wait time in mS
- *   for reads and writes respectively.
- *
- *  "from" [ IN ] - client endpoint
- *
- *  "to" [ IN ] - server endpoint 
- *
- *  both endpoints have to be of type epIP; creates a TCP connection
- */
-KNS_EXTERN rc_t CC KNSManagerMakeTimedConnection ( struct KNSManager const * self,
-    struct KStream **conn, int32_t readMillis, int32_t writeMillis,
-    struct KEndPoint const *from, struct KEndPoint const *to )
-{
-    if ( self == NULL )
-    {
-        if ( conn == NULL )
-            return RC ( rcNS, rcStream, rcConstructing, rcParam, rcNull );
-
-        * conn = NULL;
-
-        return RC ( rcNS, rcStream, rcConstructing, rcSelf, rcNull );
-    }
-
-    return KNSManagerMakeRetryTimedConnection ( self, conn, 
-        self -> conn_timeout, readMillis, writeMillis, from, to );
-}    
-    
-/* MakeRetryConnection
- *  create a connection-oriented stream
- *
- *  "conn" [ OUT ] - a stream for communication with the server
- *
- *  "retryTimeout" [ IN ] - if connection is refused, retry with 1ms intervals: when negative, retry infinitely,
- *   when 0, do not retry, positive gives maximum wait time in seconds 
- *
- *  "from" [ IN ] - client endpoint
- *
- *  "to" [ IN ] - server endpoint 
- *
- *  both endpoints have to be of type epIP; creates a TCP connection
- */    
-KNS_EXTERN rc_t CC KNSManagerMakeRetryConnection ( struct KNSManager const * self,
-    struct KStream **conn, int32_t retryTimeout, struct KEndPoint const *from, struct KEndPoint const *to )
-{
-    if ( self == NULL )
-    {
-        if ( conn == NULL )
-            return RC ( rcNS, rcStream, rcConstructing, rcParam, rcNull );
-
-        * conn = NULL;
-
-        return RC ( rcNS, rcStream, rcConstructing, rcSelf, rcNull );
-    }
-
-    return KNSManagerMakeRetryTimedConnection ( self, conn, 
-        retryTimeout, self -> conn_read_timeout, self -> conn_write_timeout, from, to );
-}    
-
-/* SetConnectionTimeouts
- *  sets default connect/read/write timeouts to supply to sockets
- *
- *  "connectMillis", "readMillis", "writeMillis" [ IN ] - when negative, infinite timeout
- *  when 0, return immediately, positive gives maximum wait time in sec/mS
- *  for connects, reads and writes respectively.
- */
-LIB_EXPORT rc_t CC KNSManagerSetConnectionTimeouts ( KNSManager *self,
-    int32_t connectSecs, int32_t readMillis, int32_t writeMillis )
-{
-    if ( self == NULL )
-        return RC ( rcNS, rcMgr, rcUpdating, rcSelf, rcNull );
-
-    /* limit values */
-    if ( connectSecs < 0 )
-        connectSecs = -1;
-    else if ( connectSecs > MAX_CONN_LIMIT )
-        connectSecs = MAX_CONN_LIMIT;
-        
-    if ( readMillis < 0 )
-        readMillis = -1;
-    else if ( readMillis > MAX_CONN_READ_LIMIT )
-        readMillis = MAX_CONN_READ_LIMIT;
-
-    if ( writeMillis < 0 )
-        writeMillis = -1;
-    else if ( writeMillis > MAX_CONN_WRITE_LIMIT )
-        writeMillis = MAX_CONN_WRITE_LIMIT;
-
-    self -> conn_timeout = connectSecs;
-    self -> conn_read_timeout = readMillis;
-    self -> conn_write_timeout = writeMillis;
-
-    return 0;
-}
-
-
-/* SetHTTPTimeouts
- *  sets default read/write timeouts to supply to HTTP connections
- *
- *  "readMillis" [ IN ] and "writeMillis" - when negative, infinite timeout
- *  when 0, return immediately, positive gives maximum wait time in mS
- *  for reads and writes respectively.
- */
-LIB_EXPORT rc_t CC KNSManagerSetHTTPTimeouts ( KNSManager *self,
-    int32_t readMillis, int32_t writeMillis )
-{
-    if ( self == NULL )
-        return RC ( rcNS, rcMgr, rcUpdating, rcSelf, rcNull );
-
-    /* limit values */
-    if ( readMillis < 0 )
-        readMillis = -1;
-    else if ( readMillis > MAX_HTTP_READ_LIMIT )
-        readMillis = MAX_HTTP_READ_LIMIT;
-
-    if ( writeMillis < 0 )
-        writeMillis = -1;
-    else if ( writeMillis > MAX_HTTP_WRITE_LIMIT )
-        writeMillis = MAX_HTTP_WRITE_LIMIT;
-
-    self -> http_read_timeout = readMillis;
-    self -> http_write_timeout = writeMillis;
-
-    return 0;
-}
diff --git a/libs/kns/mgr-priv.h b/libs/kns/mgr-priv.h
deleted file mode 100644
index 627bbb1..0000000
--- a/libs/kns/mgr-priv.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kns_mgr_priv_
-#define _h_kns_mgr_priv_
-
-#ifndef _h_kns_extern_
-#include <kns/extern.h>
-#endif
-
-#ifndef _h_klib_refcount_
-#include <klib/refcount.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct KNSManager
-{
-    KRefcount refcount;
-    int32_t conn_timeout;
-    int32_t conn_read_timeout;
-    int32_t conn_write_timeout;
-    int32_t http_read_timeout;
-    int32_t http_write_timeout;
-    bool verbose;
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kns_mgr_priv_ */
diff --git a/libs/kns/poll-priv.h b/libs/kns/poll-priv.h
deleted file mode 100644
index b0cbbe2..0000000
--- a/libs/kns/poll-priv.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_poll_priv_
-#define _h_poll_priv_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct timeout_t;
-
-
-/* socket_wait
- *  wait for an event or a timeout
- */
-int socket_wait ( int fd, int events, struct timeout_t *tm );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_poll_priv_ */
diff --git a/libs/kns/stream-from-files.c b/libs/kns/stream-from-files.c
deleted file mode 100644
index 2ac4e0b..0000000
--- a/libs/kns/stream-from-files.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-
-typedef struct KStreamFromFiles KStreamFromFiles;
-#define KSTREAM_IMPL KStreamFromFiles
-
-#include <kns/extern.h>
-#include <kns/stream.h>
-#include <kns/impl.h>
-#include <kfs/file.h>
-#include <kfs/impl.h>
-#include <klib/rc.h>
-
-#include <sysalloc.h>
-
-#include <assert.h>
-#include <stdlib.h>
-
-#include "stream-priv.h"
-
-
-/* the object structure for THIS implementation */
-struct  KStreamFromFiles
-{
-    /* THIS MUST COME FIRST */
-    KStream dad;
-
-    uint64_t in_pos;
-    uint64_t out_pos;
-
-    const KFile *in;
-    KFile *out;
-};
-
-
-/* the required methods */
-
-static
-rc_t CC KStreamFromFilesWhack ( KStreamFromFiles *self )
-{
-    KFileRelease ( self -> in );
-    KFileRelease ( self -> out );
-    free ( self );
-    return 0;
-}
-
-static
-rc_t CC KStreamFromFilesRead ( const KStreamFromFiles *cself,
-    void *buffer, size_t bsize, size_t *num_read )
-{
-    rc_t rc = KFileRead ( cself -> in, cself -> in_pos, buffer, bsize, num_read );
-    if ( rc == 0 )
-    {
-        KStreamFromFiles *self = ( KStreamFromFiles* ) cself;
-        self -> in_pos += * num_read;
-    }
-
-    return rc;
-}
-
-static
-rc_t CC KStreamFromFilesWrite ( KStreamFromFiles *self,
-    const void *buffer, size_t size, size_t *num_writ )
-{
-    rc_t rc = KFileWrite ( self -> out, self -> out_pos, buffer, size, num_writ );
-    if ( rc == 0 )
-        self -> out_pos += * num_writ;
-
-    return rc;
-}
-
-/* the vtable */
-static KStream_vt_v1 vtKStreamFromFiles =
-{
-    1, 0,
-    KStreamFromFilesWhack,
-    KStreamFromFilesRead,
-    KStreamFromFilesWrite
-};
-
-
-/* FromKFilePair
- *  create a KStream from a pair of KFiles
- *  maintains a "pos" marker for input and output files
- *
- *  "strm" [ OUT ] - resultant KStream
- *
- *  "read" [ IN, NULL OKAY ] - file to use for stream reading
- *
- *  "write" [ IN, NULL OKAY ] - file to use for stream writing
- *
- * NB - EITHER "read" or "write" may be NULL, but not both.
- */
-LIB_EXPORT rc_t CC KStreamFromKFilePair ( KStream **strm,
-    const KFile *read, KFile *write )
-{
-    rc_t rc;
-
-    if ( strm == NULL )
-        rc = RC ( rcNS, rcStream, rcConstructing, rcParam, rcNull );
-    else
-    {
-        bool can_read = ( read == NULL ) ? false : read -> read_enabled;
-        bool can_write = ( write == NULL ) ? false : write -> write_enabled;
-
-        if ( ! can_read && ! can_write )
-            rc = RC ( rcNS, rcStream, rcConstructing, rcFile, rcNoPerm );
-        else
-        {
-            KStreamFromFiles *sff = calloc ( 1, sizeof *sff );
-            if ( sff == NULL )
-                rc = RC ( rcNS, rcStream, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                rc = KStreamInit ( & sff -> dad, ( const KStream_vt* ) & vtKStreamFromFiles, 
-                                   "KStreamFromFilePair", "adapter", can_read, can_write );
-                if ( rc == 0 )
-                {
-                    rc = KFileAddRef ( read );
-                    if ( rc == 0 )
-                    {
-                        rc = KFileAddRef ( write );
-                        if ( rc ==  0 )
-                        {
-                            sff -> in = read;
-                            sff -> out = write;
-                            *strm = & sff -> dad;
-
-                            return 0;
-                        }
-
-                        KFileRelease ( read );
-                    }
-                }
-
-                free ( sff );
-            }
-        }
-
-        *strm = NULL;
-    }
-
-    return rc;
-}
diff --git a/libs/kns/stream-from-streams.c b/libs/kns/stream-from-streams.c
deleted file mode 100644
index a788403..0000000
--- a/libs/kns/stream-from-streams.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-
-typedef struct KStreamFromStreams KStreamFromStreams;
-#define KSTREAM_IMPL KStreamFromStreams
-
-#include <kns/extern.h>
-#include <kns/stream.h>
-#include <kns/impl.h>
-#include <klib/rc.h>
-
-#include <sysalloc.h>
-
-#include <assert.h>
-#include <stdlib.h>
-
-#include "stream-priv.h"
-
-/* the object structure for THIS implementation */
-struct  KStreamFromStreams
-{
-    /* THIS MUST COME FIRST */
-    KStream dad;
-
-    const KStream *in;
-    KStream *out;
-};
-
-
-/* the required methods */
-
-static
-rc_t CC KStreamFromStreamsWhack ( KStreamFromStreams *self )
-{
-    KStreamRelease ( self -> in );
-    KStreamRelease ( self -> out );
-    free ( self );
-    return 0;
-}
-
-static
-rc_t CC KStreamFromStreamsRead ( const KStreamFromStreams *self,
-    void *buffer, size_t bsize, size_t *num_read )
-{
-    return KStreamRead ( self -> in, buffer, bsize, num_read );
-}
-
-static
-rc_t CC KStreamFromStreamsWrite ( KStreamFromStreams *self,
-    const void *buffer, size_t size, size_t *num_writ )
-{
-    return KStreamWrite ( self -> out, buffer, size, num_writ );
-}
-
-/* the vtable */
-static KStream_vt_v1 vtKStreamFromStreams =
-{
-    1, 0,
-    KStreamFromStreamsWhack,
-    KStreamFromStreamsRead,
-    KStreamFromStreamsWrite
-};
-
-
-/* FromKStreamPair
- *  create a KStream from a pair of KStreams
- *
- *  "strm" [ OUT ] - resultant KStream
- *
- *  "read" [ IN, NULL OKAY ] - stream to use for input
- *
- *  "write" [ IN, NULL OKAY ] - stream to use for output
- *
- * NB - EITHER "read" or "write" may be NULL, but not both.
- */
-LIB_EXPORT rc_t CC KStreamFromKStreamPair ( KStream **strm,
-    const KStream *read, KStream *write )
-{
-    rc_t rc;
-
-    if ( strm == NULL )
-        rc = RC ( rcNS, rcStream, rcConstructing, rcParam, rcNull );
-    else
-    {
-        bool can_read = ( read == NULL ) ? false : read -> read_enabled;
-        bool can_write = ( write == NULL ) ? false : write -> write_enabled;
-
-        if ( ! can_read && ! can_write )
-            rc = RC ( rcNS, rcStream, rcConstructing, rcStream, rcNoPerm );
-        else
-        {
-            KStreamFromStreams *sfs = calloc ( 1, sizeof *sfs );
-            if ( sfs == NULL )
-                rc = RC ( rcNS, rcStream, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                rc = KStreamInit ( & sfs -> dad, ( const KStream_vt* ) & vtKStreamFromStreams, 
-                                   "KStreamFromStreamPair", "adapter", can_read, can_write );
-                if ( rc == 0 )
-                {
-                    rc = KStreamAddRef ( read );
-                    if ( rc == 0 )
-                    {
-                        rc = KStreamAddRef ( write );
-                        if ( rc ==  0 )
-                        {
-                            sfs -> in = read;
-                            sfs -> out = write;
-                            *strm = & sfs -> dad;
-
-                            return 0;
-                        }
-
-                        KStreamRelease ( read );
-                    }
-                }
-
-                free ( sfs );
-            }
-        }
-
-        *strm = NULL;
-    }
-
-    return rc;
-}
diff --git a/libs/kns/stream-priv.h b/libs/kns/stream-priv.h
deleted file mode 100644
index 12575f8..0000000
--- a/libs/kns/stream-priv.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-
-/* VDB.v2 is end of life, and introducing new object types is
-   dangerous. For our purposes, just call a stream a file */
-#ifndef rcStream
-#define rcStream rcFile
-#endif
-
-#ifndef rcSocket
-#define rcSocket rcFile
-#endif
-
-#ifndef rcUrl
-#define rcUrl rcPath
-#endif
diff --git a/libs/kns/stream.c b/libs/kns/stream.c
deleted file mode 100644
index 4b25d71..0000000
--- a/libs/kns/stream.c
+++ /dev/null
@@ -1,780 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kns/extern.h>
-#include <kns/impl.h>
-#include <klib/rc.h>
-#include <kproc/timeout.h>
-#include <os-native.h>
-#include <sysalloc.h>
-
-#include "stream-priv.h"
-
-#include <assert.h>
-
-/*--------------------------------------------------------------------------
- * KStream
- *  a file
- */
-
-/* Destroy
- *  destroy stream
- */
-static
-rc_t KStreamDestroy ( KStream *self )
-{
-    if ( self == NULL )
-        return RC ( rcNS, rcStream, rcDestroying, rcSelf, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . destroy ) ( self );
-    }
-
-    return RC ( rcNS, rcStream, rcDestroying, rcInterface, rcBadVersion );
-}
-
-/* AddRef
- *  creates a new reference
- *  ignores NULL references
- */
-LIB_EXPORT rc_t CC KStreamAddRef ( const KStream *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KStream" ) )
-        {
-        case krefLimit:
-            return RC ( rcNS, rcStream, rcAttaching, rcRange, rcExcessive );
-        case krefNegative:
-            return RC ( rcNS, rcStream, rcAttaching, rcSelf, rcInvalid );
-        default:
-            break;
-        }
-    }
-    return 0;
-}
-
-/* Release
- *  discard reference to file
- *  ignores NULL references
- */
-LIB_EXPORT rc_t CC KStreamRelease ( const KStream *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KStream" ) )
-        {
-        case krefWhack:
-            return KStreamDestroy ( ( KStream* ) self );
-        case krefNegative:
-            return RC ( rcNS, rcStream, rcReleasing, rcRange, rcExcessive );
-        default:
-            break;
-        }
-    }
-
-    return 0;
-}
-
-/* Read
- * TimedRead
- *  read data from stream
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT ] - return parameter giving number of bytes
- *  actually read. when returned value is zero and return code is
- *  also zero, interpreted as end of stream.
- *
- *  "tm" [ IN/OUT, NULL OKAY ] - an optional indicator of
- *  blocking behavior. not all implementations will support
- *  timed reads. a NULL timeout will block indefinitely,
- *  a value of "tm->mS == 0" will have non-blocking behavior
- *  if supported by implementation, and "tm->mS > 0" will indicate
- *  a maximum wait timeout.
- */
-LIB_EXPORT rc_t CC KStreamRead ( const KStream *self,
-    void *buffer, size_t bsize, size_t *num_read )
-{
-    if ( num_read == NULL )
-        return RC ( rcNS, rcStream, rcReading, rcParam, rcNull );
-
-    * num_read = 0;
-
-    if ( self == NULL )
-        return RC ( rcNS, rcStream, rcReading, rcSelf, rcNull );
-
-    if ( ! self -> read_enabled )
-        return RC ( rcNS, rcStream, rcReading, rcStream, rcNoPerm );
-
-    if ( buffer == NULL )
-        return RC ( rcNS, rcStream, rcReading, rcBuffer, rcNull );
-    if ( bsize == 0 )
-        return RC ( rcNS, rcStream, rcReading, rcBuffer, rcInsufficient );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . read ) ( self, buffer, bsize, num_read );
-    }
-
-    return RC ( rcNS, rcStream, rcReading, rcInterface, rcBadVersion );
-}
-
-LIB_EXPORT rc_t CC KStreamTimedRead ( const KStream *self,
-    void *buffer, size_t bsize, size_t *num_read, struct timeout_t *tm )
-{
-    if ( num_read == NULL )
-        return RC ( rcNS, rcStream, rcReading, rcParam, rcNull );
-
-    * num_read = 0;
-
-    if ( self == NULL )
-        return RC ( rcNS, rcStream, rcReading, rcSelf, rcNull );
-
-    if ( ! self -> read_enabled )
-        return RC ( rcNS, rcStream, rcReading, rcStream, rcNoPerm );
-
-    if ( buffer == NULL )
-        return RC ( rcNS, rcStream, rcReading, rcBuffer, rcNull );
-    if ( bsize == 0 )
-        return RC ( rcNS, rcStream, rcReading, rcBuffer, rcInsufficient );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        if ( self -> vt -> v1 . min >= 1 )
-            return ( * self -> vt -> v1 . timed_read ) ( self, buffer, bsize, num_read, tm );
-        if ( tm == NULL )
-            return ( * self -> vt -> v1 . read ) ( self, buffer, bsize, num_read );
-        break;
-    }
-
-
-    return RC ( rcNS, rcStream, rcReading, rcInterface, rcBadVersion );
-}
-
-
-/* ReadAll
- * TimedReadAll
- *  read from stream until "bsize" bytes have been retrieved
- *  or until end-of-input
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT ] - return parameter giving number of bytes
- *  actually read. when returned value is zero and return code is
- *  also zero, interpreted as end of stream.
- *
- *  "tm" [ IN/OUT, NULL OKAY ] - an optional indicator of
- *  blocking behavior. not all implementations will support
- *  timed reads. a NULL timeout will block indefinitely,
- *  a value of "tm->mS == 0" will have non-blocking behavior
- *  if supported by implementation, and "tm->mS > 0" will indicate
- *  a maximum wait timeout.
- */
-LIB_EXPORT rc_t CC KStreamReadAll ( const KStream *self,
-    void *buffer, size_t bsize, size_t *num_read )
-{
-    rc_t rc;
-    uint8_t *b;
-    size_t total, count;
-
-    if ( num_read == NULL )
-        return RC ( rcNS, rcStream, rcReading, rcParam, rcNull );
-
-    * num_read = 0;
-
-    if ( self == NULL )
-        return RC ( rcNS, rcStream, rcReading, rcSelf, rcNull );
-
-    if ( ! self -> read_enabled )
-        return RC ( rcNS, rcStream, rcReading, rcStream, rcNoPerm );
-
-    if ( buffer == NULL )
-        return RC ( rcNS, rcStream, rcReading, rcBuffer, rcNull );
-    if ( bsize == 0 )
-        return RC ( rcNS, rcStream, rcReading, rcBuffer, rcInsufficient );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        count = 0;
-        rc = ( * self -> vt -> v1 . read ) ( self, buffer, bsize, & count );
-        total = count;
-
-        if ( rc == 0 && count != 0 && count < bsize )
-        {
-            if ( self -> vt -> v1 . min >= 1 )
-            {
-                timeout_t no_block;
-                TimeoutInit ( & no_block, 0 );
-
-                for ( rc = 0, b = buffer; total < bsize; total += count )
-                {
-                    count = 0;
-                    rc = ( * self -> vt -> v1 . timed_read ) ( self, b + total, bsize - total, & count, & no_block );
-                    if ( rc != 0 )
-                        break;
-                    if ( count == 0 )
-                        break;
-                }
-            }
-            else
-            {
-                for ( rc = 0, b = buffer; total < bsize; total += count )
-                {
-                    count = 0;
-                    rc = ( * self -> vt -> v1 . read ) ( self, b + total, bsize - total, & count );
-                    if ( rc != 0 )
-                        break;
-                    if ( count == 0 )
-                        break;
-                }
-            }
-        }
-        break;
-
-    default:
-        return RC ( rcNS, rcStream, rcReading, rcInterface, rcBadVersion );
-    }
-
-    if ( total != 0 )
-    {
-        * num_read = total;
-        return 0;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KStreamTimedReadAll ( const KStream *self,
-    void *buffer, size_t bsize, size_t *num_read, struct timeout_t *tm )
-{
-    rc_t rc;
-    uint8_t *b;
-    size_t total, count;
-
-    if ( num_read == NULL )
-        return RC ( rcNS, rcStream, rcReading, rcParam, rcNull );
-
-    * num_read = 0;
-
-    if ( self == NULL )
-        return RC ( rcNS, rcStream, rcReading, rcSelf, rcNull );
-
-    if ( ! self -> read_enabled )
-        return RC ( rcNS, rcStream, rcReading, rcStream, rcNoPerm );
-
-    if ( buffer == NULL )
-        return RC ( rcNS, rcStream, rcReading, rcBuffer, rcNull );
-    if ( bsize == 0 )
-        return RC ( rcNS, rcStream, rcReading, rcBuffer, rcInsufficient );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        if ( self -> vt -> v1 . min >= 1 )
-        {
-            count = 0;
-            rc = ( * self -> vt -> v1 . timed_read ) ( self, buffer, bsize, & count, tm );
-            total = count;
-
-            if ( rc == 0 && count != 0 && count < bsize )
-            {
-                timeout_t no_block;
-                TimeoutInit ( & no_block, 0 );
-                
-                for ( b = buffer; total < bsize; total += count )
-                {
-                    count = 0;
-                    rc = ( * self -> vt -> v1 . timed_read ) ( self, b + total, bsize - total, & count, & no_block );
-                    if ( rc != 0 )
-                        break;
-                    if ( count == 0 )
-                        break;
-                }
-            }
-            break;
-        }
-
-        if ( tm == NULL )
-        {
-            for ( rc = 0, b = buffer, total = 0; total < bsize; total += count )
-            {
-                count = 0;
-                rc = ( * self -> vt -> v1 . read ) ( self, b + total, bsize - total, & count );
-                if ( rc != 0 )
-                    break;
-                if ( count == 0 )
-                    break;
-            }
-            break;
-        }
-
-        /* no break */
-
-    default:
-        return RC ( rcNS, rcStream, rcReading, rcInterface, rcBadVersion );
-    }
-
-    if ( total != 0 )
-    {
-        * num_read = total;
-        return 0;
-    }
-
-    return rc;
-}
-
-
-/* ReadExactly
- * TimedReadExactly
- *  read from stream until "bytes" have been retrieved
- *  or return incomplete transfer
- *
- *  "buffer" [ OUT ] and "bytes" [ IN ] - return buffer for read
- *
- *  "tm" [ IN/OUT, NULL OKAY ] - an optional indicator of
- *  blocking behavior. not all implementations will support
- *  timed reads. a NULL timeout will block indefinitely,
- *  a value of "tm->mS == 0" will have non-blocking behavior
- *  if supported by implementation, and "tm->mS > 0" will indicate
- *  a maximum wait timeout.
- */
-LIB_EXPORT rc_t CC KStreamReadExactly ( const KStream *self,
-    void *buffer, size_t bytes )
-{
-    rc_t rc;
-    uint8_t *b;
-    size_t total, count;
-
-    if ( self == NULL )
-        return RC ( rcNS, rcStream, rcReading, rcSelf, rcNull );
-
-    if ( ! self -> read_enabled )
-        return RC ( rcNS, rcStream, rcReading, rcStream, rcNoPerm );
-
-    if ( bytes == 0 )
-        return 0;
-    if ( buffer == NULL )
-        return RC ( rcNS, rcStream, rcReading, rcBuffer, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        assert ( bytes != 0 );
-        for ( b = buffer, total = 0; total < bytes; total += count )
-        {
-            count = 0;
-            rc = ( * self -> vt -> v1 . read ) ( self, b + total, bytes - total, & count );
-            if ( rc != 0 )
-            {
-                if ( GetRCObject ( rc ) != rcTimeout || GetRCState ( rc ) != rcExhausted )
-                    break;
-            }
-            else if ( count == 0 )
-            {
-                rc = RC ( rcNS, rcStream, rcReading, rcTransfer, rcIncomplete );
-                break;
-            }
-        }
-        break;
-
-    default:
-        return RC ( rcNS, rcStream, rcReading, rcInterface, rcBadVersion );
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KStreamTimedReadExactly ( const KStream *self,
-    void *buffer, size_t bytes, struct timeout_t *tm )
-{
-    rc_t rc;
-    uint8_t *b;
-    size_t total, count;
-
-    if ( self == NULL )
-        return RC ( rcNS, rcStream, rcReading, rcSelf, rcNull );
-
-    if ( ! self -> read_enabled )
-        return RC ( rcNS, rcStream, rcReading, rcStream, rcNoPerm );
-
-    if ( bytes == 0 )
-        return RC ( rcNS, rcStream, rcReading, rcBuffer, rcInsufficient );
-    if ( buffer == NULL )
-        return RC ( rcNS, rcStream, rcReading, rcBuffer, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        if ( self -> vt -> v1 . min >= 1 )
-        {
-            assert ( bytes != 0 );
-            for ( b = buffer, total = 0; total < bytes; total += count )
-            {
-                count = 0;
-                rc = ( * self -> vt -> v1 . timed_read ) ( self, b + total, bytes - total, & count, tm );
-                if ( rc != 0 )
-                {
-                    if ( tm != NULL )
-                        break;
-                    if ( GetRCObject ( rc ) != rcTimeout || GetRCState ( rc ) != rcExhausted )
-                        break;
-                }
-                else if ( count == 0 )
-                {
-                    rc = RC ( rcNS, rcStream, rcReading, rcTransfer, rcIncomplete );
-                    break;
-                }
-            }
-
-            break;
-        }
-
-        if ( tm == NULL )
-        {
-            assert ( bytes != 0 );
-            for ( b = buffer, total = 0; total < bytes; total += count )
-            {
-                count = 0;
-                rc = ( * self -> vt -> v1 . read ) ( self, b + total, bytes - total, & count );
-                if ( rc != 0 )
-                {
-                    if ( GetRCObject ( rc ) != rcTimeout || GetRCState ( rc ) != rcExhausted )
-                        break;
-                }
-                else if ( count == 0 )
-                {
-                    rc = RC ( rcNS, rcStream, rcReading, rcTransfer, rcIncomplete );
-                    break;
-                }
-            }
-            break;
-        }
-
-        /* no break */
-
-    default:
-        return RC ( rcNS, rcStream, rcReading, rcInterface, rcBadVersion );
-    }
-
-    return rc;
-}
-
-/* Write
- * TimedWrite
- *  send data to stream
- *
- *  "buffer" [ IN ] and "size" [ IN ] - data to be written
- *
- *  "num_writ" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually written
- *
- *  "tm" [ IN/OUT, NULL OKAY ] - an optional indicator of
- *  blocking behavior. not all implementations will support
- *  timed writes. a NULL timeout will block indefinitely,
- *  a value of "tm->mS == 0" will have non-blocking behavior
- *  if supported by implementation, and "tm->mS > 0" will indicate
- *  a maximum wait timeout.
- */
-LIB_EXPORT rc_t CC KStreamWrite ( KStream *self,
-    const void *buffer, size_t size, size_t *num_writ )
-{
-    size_t ignore;
-    if ( num_writ == NULL )
-        num_writ = & ignore;
-
-    * num_writ = 0;
-
-    if ( self == NULL )
-        return RC ( rcNS, rcStream, rcWriting, rcSelf, rcNull );
-
-    if ( ! self -> write_enabled )
-        return RC ( rcNS, rcStream, rcWriting, rcStream, rcNoPerm );
-
-    if ( size == 0 )
-        return 0;
-    if ( buffer == NULL )
-        return RC ( rcNS, rcStream, rcWriting, rcBuffer, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . write ) ( self, buffer, size, num_writ );
-    }
-
-    return RC ( rcNS, rcStream, rcWriting, rcInterface, rcBadVersion );
-}
-
-LIB_EXPORT rc_t CC KStreamTimedWrite ( KStream *self,
-    const void *buffer, size_t size, size_t *num_writ, struct timeout_t *tm )
-{
-    size_t ignore;
-    if ( num_writ == NULL )
-        num_writ = & ignore;
-
-    * num_writ = 0;
-
-    if ( self == NULL )
-        return RC ( rcNS, rcStream, rcWriting, rcSelf, rcNull );
-
-    if ( ! self -> write_enabled )
-        return RC ( rcNS, rcStream, rcWriting, rcStream, rcNoPerm );
-
-    if ( size == 0 )
-        return 0;
-    if ( buffer == NULL )
-        return RC ( rcNS, rcStream, rcWriting, rcBuffer, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        if ( self -> vt -> v1 . min >= 1 )
-            return ( * self -> vt -> v1 . timed_write ) ( self, buffer, size, num_writ, tm );
-        if ( tm == NULL )
-            return ( * self -> vt -> v1 . write ) ( self, buffer, size, num_writ );
-        break;
-    }
-
-    return RC ( rcNS, rcStream, rcWriting, rcInterface, rcBadVersion );
-}
-
-/* WriteAll
- * TimedWriteAll
- *  write to stream until "size" bytes have been transferred
- *  or until no further progress can be made
- *
- *  "buffer" [ IN ] and "size" [ IN ] - data to be written
- *
- *  "num_writ" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually written
- *
- *  "tm" [ IN/OUT, NULL OKAY ] - an optional indicator of
- *  blocking behavior. not all implementations will support
- *  timed writes. a NULL timeout will block indefinitely,
- *  a value of "tm->mS == 0" will have non-blocking behavior
- *  if supported by implementation, and "tm->mS > 0" will indicate
- *  a maximum wait timeout.
- */
-LIB_EXPORT rc_t CC KStreamWriteAll ( KStream *self,
-    const void *buffer, size_t size, size_t *num_writ )
-{
-    rc_t rc;
-    const uint8_t *b;
-    size_t total, count;
-
-    size_t ignore;
-    if ( num_writ == NULL )
-        num_writ = & ignore;
-
-    * num_writ = 0;
-
-    if ( self == NULL )
-        return RC ( rcNS, rcStream, rcWriting, rcSelf, rcNull );
-
-    if ( ! self -> write_enabled )
-        return RC ( rcNS, rcStream, rcWriting, rcStream, rcNoPerm );
-
-    if ( size == 0 )
-        return 0;
-    if ( buffer == NULL )
-        return RC ( rcNS, rcStream, rcWriting, rcBuffer, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        count = 0;
-        rc = ( * self -> vt -> v1 . write ) ( self, buffer, size, & count );
-        total = count;
-
-        if ( rc == 0 && count != 0 && count < size )
-        {
-            if ( self -> vt -> v1 . min >= 1 )
-            {
-                timeout_t no_block;
-                TimeoutInit ( & no_block, 0 );
-
-                for ( b = buffer; total < size; total += count )
-                {
-                    count = 0;
-                    rc = ( * self -> vt -> v1 . timed_write ) ( self, b + total, size - total, & count, & no_block );
-                    if ( rc != 0 )
-                        break;
-                    if ( count == 0 )
-                        break;
-                }
-            }
-            else
-            {
-                for ( b = buffer; total < size; total += count )
-                {
-                    count = 0;
-                    rc = ( * self -> vt -> v1 . write ) ( self, b + total, size - total, & count );
-                    if ( rc != 0 )
-                        break;
-                    if ( count == 0 )
-                        break;
-                }
-            }
-        }
-        break;
-
-    default:
-        return RC ( rcNS, rcStream, rcWriting, rcInterface, rcBadVersion );
-    }
-
-    * num_writ = total;
-    if ( total == size )
-        return 0;
-    if ( rc == 0 )
-        return RC ( rcNS, rcStream, rcWriting, rcTransfer, rcIncomplete );
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KStreamTimedWriteAll ( KStream *self,
-    const void *buffer, size_t size, size_t *num_writ, struct timeout_t *tm )
-{
-    rc_t rc;
-    const uint8_t *b;
-    size_t total, count;
-
-    size_t ignore;
-    if ( num_writ == NULL )
-        num_writ = & ignore;
-
-    * num_writ = 0;
-
-    if ( self == NULL )
-        return RC ( rcNS, rcStream, rcWriting, rcSelf, rcNull );
-
-    if ( ! self -> write_enabled )
-        return RC ( rcNS, rcStream, rcWriting, rcStream, rcNoPerm );
-
-    if ( size == 0 )
-        return 0;
-    if ( buffer == NULL )
-        return RC ( rcNS, rcStream, rcWriting, rcBuffer, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        if ( self -> vt -> v1 . min >= 1 )
-        {
-            for ( rc = 0, b = buffer, total = 0; total < size; total += count )
-            {
-                count = 0;
-                rc = ( * self -> vt -> v1 . timed_write ) ( self, b + total, size - total, & count, tm );
-                if ( rc != 0 )
-                    break;
-                if ( count == 0 )
-                    break;
-            }
-            break;
-        }
-
-        if ( tm == NULL )
-        {
-            for ( rc = 0, b = buffer, total = 0; total < size; total += count )
-            {
-                count = 0;
-                rc = ( * self -> vt -> v1 . write ) ( self, b + total, size - total, & count );
-                if ( rc != 0 )
-                    break;
-                if ( count == 0 )
-                    break;
-            }
-            break;
-        }
-
-        /* no break */
-
-    default:
-        return RC ( rcNS, rcStream, rcWriting, rcInterface, rcBadVersion );
-    }
-
-    * num_writ = total;
-    if ( total == size )
-        return 0;
-    if ( rc == 0 )
-        return RC ( rcNS, rcStream, rcWriting, rcTransfer, rcIncomplete );
-    return rc;
-}
-
-
-/* Init
- *  initialize a newly allocated stream object
- */
-LIB_EXPORT rc_t CC KStreamInit ( KStream *self, const KStream_vt *vt,
-    const char *classname, const char *strname,
-    bool read_enabled, bool write_enabled )
-{
-    if ( self == NULL )
-        return RC ( rcNS, rcStream, rcConstructing, rcSelf, rcNull );
-    if ( vt == NULL )
-        return RC ( rcNS, rcStream, rcConstructing, rcInterface, rcNull );
-    switch ( vt -> v1 . maj )
-    {
-    case 0:
-        return RC ( rcNS, rcStream, rcConstructing, rcInterface, rcInvalid );
-
-    case 1:
-        switch ( vt -> v1 . min )
-        {
-            /* ADD NEW MINOR VERSION CASES HERE */
-        case 1:
-#if _DEBUGGING
-            if ( vt -> v1 . timed_write == NULL ||
-                 vt -> v1 . timed_read == NULL )
-                return RC ( rcNS, rcStream, rcConstructing, rcInterface, rcNull );
-#endif
-        case 0:
-#if _DEBUGGING
-        if ( vt -> v1 . write == NULL         ||
-             vt -> v1 . read == NULL          ||
-             vt -> v1 . destroy == NULL )
-        return RC ( rcNS, rcStream, rcConstructing, rcInterface, rcNull );
-#endif
-            break;
-        default:
-            return RC ( rcNS, rcStream, rcConstructing, rcInterface, rcBadVersion );
-        }
-        break;
-
-    default:
-        return RC ( rcNS, rcStream, rcConstructing, rcInterface, rcBadVersion );
-    }
-
-    self -> vt = vt;
-    KRefcountInit ( & self -> refcount, 1, classname, "init", strname );
-    self -> read_enabled = ( uint8_t ) ( read_enabled != 0 );
-    self -> write_enabled = ( uint8_t ) ( write_enabled != 0 );
-
-    return 0;
-}
diff --git a/libs/kns/sysmgr.h b/libs/kns/sysmgr.h
deleted file mode 100644
index 03928c4..0000000
--- a/libs/kns/sysmgr.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_sysmgr_
-#define _h_sysmgr_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-rc_t KNSManagerInit();
-void KNSManagerCleanup();
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
\ No newline at end of file
diff --git a/libs/kns/undyinghttp.c b/libs/kns/undyinghttp.c
deleted file mode 100644
index 228c163..0000000
--- a/libs/kns/undyinghttp.c
+++ /dev/null
@@ -1,362 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ==============================================================================
-*
-*/
-
-#include <kns/extern.h>
-
-#define KSTREAM_IMPL KHttpStream
-typedef struct KHttpStream KHttpStream;
-
-#define KFILE_IMPL KHttpUndyingFile
-typedef struct KHttpUndyingFile KHttpUndyingFile;
-
-#include <kfs/impl.h>
-
-#include "http-priv.h"
-
-#include <kns/http.h> /* KNSManagerMakeHttpFile */
-#include <kns/manager.h> /* KNSManager */
-
-#include <klib/debug.h> /* DBGMSG */
-#include <klib/printf.h> /* string_vprintf */
-#include <klib/rc.h>
-
-#include <sysalloc.h> /* for malloc/calloc */
-
-#include <assert.h>
-#include <string.h> /* memset */
-
-#include <limits.h> /* PATH_MAX */
-#ifndef PATH_MAX
-#define PATH_MAX 4096
-#endif
-
-/*******************************************************************************
- * KHttpUndyingFile
- */
-
-struct KHttpUndyingFile
-{
-    KFile dad;
-
-    uint64_t size; /* file's size */
-
-    const KFile *file; /* this struct is a wrapper around this file */
-
-    const KNSManager *mgr; /* mgr to construct the file */
-    const char *url; /* url to construct the file */
-    ver_t vers; /* vers to construct the file */
-};
-
-static rc_t CC KHttpUndyingFileDestroy(KHttpUndyingFile *self) {
-    rc_t rc = 0;
-
-    if (self == NULL) {
-        return 0;
-    }
-
-    free((void*)self->url);
-
-    rc = KFileRelease(self->file);
-
-    {
-        rc_t rc2 = KNSManagerRelease(self->mgr);
-        if (rc == 0) {
-            rc = rc2;
-        }
-    }
-
-    memset(self, 0, sizeof *self);
-
-    free(self);
-
-    return rc;
-}
-
-static KFile* GetUnderlyingFile(const KHttpUndyingFile *self) {
-    if (self == NULL) {
-        return NULL;
-    }
-    else {
-        return (KFile*)self->file;
-    }
-}
-
-static struct KSysFile* CC KHttpUndyingFileGetSysFile(
-    const KHttpUndyingFile *self, uint64_t *offset)
-{
-    return KFileGetSysFile(GetUnderlyingFile(self), offset);
-}
-
-static
-rc_t CC KHttpUndyingFileRandomAccess(const KHttpUndyingFile *self)
-{
-    return KFileRandomAccess(GetUnderlyingFile(self));
-}
-
-static rc_t CC KHttpUndyingFileSize(const KHttpUndyingFile *self,
-    uint64_t *size)
-{
-    return KFileSize(GetUnderlyingFile(self), size);
-}
-
-static
-rc_t CC KHttpUndyingFileSetSize(KHttpUndyingFile *self, uint64_t size)
-{
-    return KFileSetSize(GetUnderlyingFile(self), size);
-}
-
-static rc_t Revive(const KHttpUndyingFile *cself) {
-    KHttpUndyingFile *self = (KHttpUndyingFile*)cself;
-
-    rc_t rc = 0;
-
-    assert(self);
-
-    rc = KFileRelease(self->file);
-    self->file = NULL;
-
-    if (rc == 0) {
-        rc = SecretKNSManagerMakeHttpFile(self->mgr,
-            &self->file, NULL, self->vers, self->url);
-    }
-
-    return rc;
-}
-
-#define RETRY_REVIVE 2
-#define RETRY_READ 2
-static rc_t CC KHttpUndyingFileRead(const KHttpUndyingFile *self,
-    uint64_t pos, void *buffer, size_t bsize, size_t *num_read)
-{
-    if (self == NULL || self->file == NULL) {
-        return KFileRead(NULL, pos, buffer, bsize, num_read);
-    }
-    else {
-        rc_t rc = 0, prev_rc = 0;
-        int i = 0;
-        for (i = 0; i < RETRY_REVIVE; ++i) {
-            int r = 0;
-            for (r = 0; r < RETRY_READ; ++r) {
-                rc = KFileRead(self->file, pos, buffer, bsize, num_read);
-                if (rc == 0) {
-                    return rc;
-                }
-                else {
-                    DBGMSG(DBG_KNS, DBG_FLAG(DBG_KNS_ERR), (
-"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@3 %s KFileRead(%s, %d)(%d/%d) = %R @@@@@@@"
-                        "\n", __FUNCTION__,
-                        self->url, pos, r + 1, RETRY_READ, rc));
-                    if (prev_rc == 0) {
-                        prev_rc = rc;
-                    }
-                    else if (rc == prev_rc) {
-                        break;
-                    }
-                }
-            }
-
-            if (i < RETRY_REVIVE - 1) {
-                DBGMSG(DBG_KNS, DBG_FLAG(DBG_KNS_ERR), (
-"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@5 %s %d/%d KFileRead: Reviving... @@@@@@@@"
-                        "\n", __FUNCTION__, i + 1, RETRY_REVIVE));
-                rc = Revive(self);
-                if (rc != 0) {
-                    DBGMSG(DBG_KNS, DBG_FLAG(DBG_KNS_ERR), (
-"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@5 %s KFileRead(%s, %d): Revive = %R @@@@@@"
-                        "\n", __FUNCTION__, self->url, pos, rc));
-                    return rc;
-                }
-            }
-            else {
-                DBGMSG(DBG_KNS, DBG_FLAG(DBG_KNS_ERR), (
-"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@5 %s %d/%d KFileRead: Not Reviving @@@@@@@@"
-                        "\n", __FUNCTION__, i + 1, RETRY_REVIVE));
-            }
-        }
-
-        return rc;
-    }
-}
-
-static rc_t CC KHttpUndyingFileWrite ( KHttpUndyingFile *self, uint64_t pos, 
-    const void *buffer, size_t size, size_t *num_writ )
-{
-    return KFileWrite(GetUnderlyingFile(self), pos, buffer, size, num_writ);
-}
-
-static
-uint32_t CC KHttpUndyingFileGetType(const KHttpUndyingFile *self)
-{
-    return KFileType(GetUnderlyingFile(self));
-}
-
-static rc_t CC KHttpUndyingFileTimedRead(const KHttpUndyingFile *self,
-    uint64_t pos, void *buffer, size_t bsize, size_t *num_read,
-    struct timeout_t *tm)
-{
-    if (self == NULL || self->file == NULL) {
-        return KFileTimedRead(NULL, pos, buffer, bsize, num_read, tm);
-    }
-    else {
-        rc_t rc = 0, prev_rc = 0;
-        int i = 0;
-        for (i = 0; i < RETRY_REVIVE; ++i) {
-            int r = 0;
-            for (r = 0; r < RETRY_READ; ++r) {
-                rc = KFileTimedRead(self->file, pos, buffer, bsize, num_read,
-                    tm);
-                if (rc == 0) {
-                    return rc;
-                }
-                else {
-                    DBGMSG(DBG_KNS, DBG_FLAG(DBG_KNS_ERR), (
-"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@3 %s KFileTimedRead(%s, %d)(%d/%d) = %R @@"
-                        "\n", __FUNCTION__,
-                        self->url, pos, r + 1, RETRY_READ, rc));
-                    if (prev_rc == 0) {
-                        prev_rc = rc;
-                    }
-                    else if (rc == prev_rc) {
-                        break;
-                    }
-                }
-            }
-
-            if (i < RETRY_REVIVE - 1) {
-                DBGMSG(DBG_KNS, DBG_FLAG(DBG_KNS_ERR), (
-"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@5 %s %d/%d KFileTimedRead: Reviving... @@@"
-                        "\n", __FUNCTION__, i + 1, RETRY_REVIVE));
-                rc = Revive(self);
-                if (rc != 0) {
-                    DBGMSG(DBG_KNS, DBG_FLAG(DBG_KNS_ERR), (
-"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@5 %s KFileTimedRead(%s, %d): Revive = %R @"
-                        "\n", __FUNCTION__, self->url, pos, rc));
-                    return rc;
-                }
-            }
-            else {
-                DBGMSG(DBG_KNS, DBG_FLAG(DBG_KNS_ERR), (
-"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@5 %s %d/%d KFileTimedRead: Not Reviving @@"
-                        "\n", __FUNCTION__, i + 1, RETRY_REVIVE));
-            }
-        }
-        return rc;
-    }
-}
-
-static rc_t CC KHttpUndyingFileTimedWrite(KHttpUndyingFile *self, uint64_t pos, 
-    const void *buffer, size_t size, size_t *num_writ,
-    struct timeout_t *tm)
-{
-    return KFileTimedWrite(GetUnderlyingFile(self),
-        pos, buffer, size, num_writ, tm);
-}
-
-static KFile_vt_v1 vtKHttpFile =  {
-    1, 2,
-
-    KHttpUndyingFileDestroy,
-    KHttpUndyingFileGetSysFile,
-    KHttpUndyingFileRandomAccess,
-    KHttpUndyingFileSize,
-    KHttpUndyingFileSetSize,
-    KHttpUndyingFileRead,
-    KHttpUndyingFileWrite,
-    KHttpUndyingFileGetType,
-    KHttpUndyingFileTimedRead,
-    KHttpUndyingFileTimedWrite
-};
-
-static rc_t KNSManagerVMakeUndyingHttpFile(const KNSManager *self, const KFile **file,
-    struct KStream *conn, ver_t vers, const char *url, va_list args)
-{
-    char buffer[PATH_MAX] = "";
-    size_t num_writ = 0;
-    rc_t rc = 0;
-    KHttpUndyingFile *f = NULL;
-    if (file == NULL) {
-        return RC(rcNS, rcFile, rcConstructing, rcParam, rcNull);
-    }
-    *file = NULL;
-    f = calloc(1, sizeof *f);
-    if (f == NULL) {
-        return RC(rcNS, rcFile, rcConstructing, rcMemory, rcExhausted);
-    }
-    rc = string_vprintf(buffer, sizeof buffer, &num_writ, url, args);
-    if (rc == 0) {
-        f->url = string_dup_measure(url, NULL);
-    }
-    if (f->url == NULL) {
-        rc = RC(rcNS, rcFile, rcConstructing, rcMemory, rcExhausted);
-    }
-    f->vers = vers;
-    if (rc == 0) {
-        rc = KNSManagerAddRef(self);
-        if (rc == 0) {
-            f->mgr = self;
-        }
-    }
-    if (rc == 0) {
-        assert(conn == NULL);
-        rc = Revive(f);
-    }
-    if (rc == 0) {
-        KHttpUndyingFileSize(f, &f->size);
-        DBGMSG(DBG_KNS, DBG_FLAG(DBG_KNS_MGR), (
-"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@4 %s KNSManagerMakeUndyingHttpFile: size = %ld"
-            "\n", __FUNCTION__, f->size));
-    }
-    if (rc == 0) {
-        rc = KFileInit(&f->dad, (const KFile_vt*)&vtKHttpFile,
-            "KHttpUndyingFile", url, true, false);
-    }
-    if (rc == 0) {
-        *file = &f->dad;
-    }
-    else {
-        KHttpUndyingFileDestroy(f);
-    }
-
-    return rc;
-}
-
-/*LIB_EXPORT rc_t CC KNSManagerMakeUndyingHttpFile(const KNSManager *self,
-    const KFile **file, struct KStream *conn, ver_t vers, const char *url, ...)
-{
-    rc_t rc = 0;
-    va_list args;
-    va_start(args, url);
-    rc = KNSManagerVMakeHttpFile(self, file, conn, vers, url, args);
-    va_end(args);
-    return rc;
-}*/
-
-LIB_EXPORT rc_t CC KNSManagerVMakeHttpFile(const KNSManager *self,
-    const KFile **file, struct KStream *conn, ver_t vers, const char *url,
-    va_list args)
-{
-    return KNSManagerVMakeUndyingHttpFile(self, file, conn, vers, url, args);
-}
diff --git a/libs/kns/unix/sysmgr.c b/libs/kns/unix/sysmgr.c
deleted file mode 100644
index ac031a9..0000000
--- a/libs/kns/unix/sysmgr.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/rc.h>
-#include "sysmgr.h"
-
-rc_t KNSManagerInit ( void )
-{
-    return 0;
-} 
-
-void KNSManagerCleanup ( void )
-{
-}
diff --git a/libs/kns/unix/syssock.c b/libs/kns/unix/syssock.c
deleted file mode 100644
index 5139c9a..0000000
--- a/libs/kns/unix/syssock.c
+++ /dev/null
@@ -1,875 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-#define KSTREAM_IMPL KSocket
-
-#include <kns/extern.h>
-#include <kns/manager.h>
-#include <kns/socket.h>
-#include <kns/impl.h>
-#include <kns/endpoint.h>
-
-#include <klib/debug.h> /* DBGMSG */
-#include <klib/log.h>
-#include <klib/out.h>
-#include <klib/printf.h>
-#include <klib/rc.h>
-#include <klib/text.h>
-
-#include <kproc/timeout.h>
-
-#include "mgr-priv.h"
-#include "stream-priv.h"
-#include "poll-priv.h"
-
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-#include <os-native.h>
-
-#include <arpa/inet.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <netinet/tcp.h>
-#include <poll.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <pwd.h>
-
-#ifndef POLLRDHUP
-#define POLLRDHUP 0
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KSocket
- *  a socket IS a stream
- *
- *  in Berkeley socket terminology, a STREAM implies a CONTINUOUS stream,
- *  which is implemented by the TCP connection. A "chunked" or discontiguous
- *  stream would be a datagram stream, implemented usually by UDP.
- *
- *  in VDB terminology, a STREAM is a fluid, moving target that is observed
- *  from a stationary point, whereas a FILE or OBJECT is a static stationary
- *  target observed from a movable window. This means that a STREAM cannot be
- *  addressed randomly, whereas a FILE or OBJECT can.
- */
-struct KSocket
-{
-    KStream dad;
-    const char * path;
-    uint32_t type;
-    int32_t read_timeout;
-    int32_t write_timeout;
-    int fd;
-};
-
-LIB_EXPORT rc_t CC KSocketAddRef( struct KSocket *self )
-{
-    return KStreamAddRef ( & self -> dad );
-}
-
-LIB_EXPORT rc_t CC KSocketRelease ( struct KSocket *self )
-{
-    return KStreamRelease ( & self -> dad );
-}
-
-static
-rc_t CC KSocketWhack ( KSocket *self )
-{
-    assert ( self != NULL );
-
-    shutdown ( self -> fd, SHUT_WR );
-    
-    while ( 1 ) 
-    {
-        char buffer [ 1024 ];
-        ssize_t result = recv ( self -> fd, buffer, sizeof buffer, MSG_DONTWAIT );
-        if ( result <= 0 )
-            break;
-    }
-
-    shutdown ( self -> fd, SHUT_RD );
-
-    close ( self -> fd );
-
-    if ( self -> path != NULL )
-    {
-        unlink ( self -> path );
-        free ( ( void* ) self -> path );
-    }
-        
-    free ( self );
-
-    return 0;
-}
-
-static
-rc_t HandleErrno ( const char *func_name, unsigned int lineno )
-{
-    int lerrno;
-    rc_t rc = 0;
-    
-    switch ( lerrno = errno )
-    {
-    case EACCES: /* write permission denied */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcMemory, rcUnauthorized );            
-        break;
-    case EADDRINUSE: /* address is already in use */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcMemory, rcExists );
-        break;
-    case EADDRNOTAVAIL: /* requested address was not local */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcMemory, rcNotFound );
-        break;
-    case EAGAIN: /* no more free local ports or insufficient rentries in routing cache */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcNoObj, rcExhausted );            
-        break;
-    case EAFNOSUPPORT: /* address didnt have correct address family in ss_family field */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcName, rcError );            
-        break;
-    case EALREADY: /* socket is non blocking and a previous connection has not yet completed */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcId, rcUndefined );
-        break;
-    case EBADF: /* invalid sock fd */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcId, rcInvalid );
-        break;
-    case ECONNREFUSED: /* remote host refused to allow network connection */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcConnection, rcCanceled );
-        break;
-    case ECONNRESET: /* connection reset by peer */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcConnection, rcCanceled );
-        break;
-    case EDESTADDRREQ: /* socket is not connection-mode and no peer address set */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcId, rcInvalid );
-        break;
-    case EFAULT: /* buffer pointer points outside of process's adress space */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcMemory, rcOutofrange );
-        break;
-    case EINPROGRESS: /* call is in progress */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcId, rcUndefined );
-        break;
-    case EINTR: /* recv interrupted before any data available */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcConnection, rcCanceled );
-        break;
-    case EINVAL: /* invalid argument */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcParam, rcInvalid );
-        break;
-    case EISCONN: /* connected already */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcConnection, rcExists );
-        break;
-    case ELOOP: /* too many symbolic links in resolving addr */
-        rc = RC ( rcNS, rcNoTarg, rcResolving, rcLink, rcExcessive );
-        break;
-    case EMFILE: /* process file table overflow */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcNoObj, rcError );
-        break;
-    case EMSGSIZE: /* msg size too big */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcMessage, rcExcessive );
-        break;
-    case ENAMETOOLONG: /* addr name is too long */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcName, rcExcessive );
-        break;
-    case ENETUNREACH: /* network is unreachable */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcConnection, rcNotAvailable );
-        break;
-    case ENOBUFS: /* output queue for a network connection was full. 
-                     ( wont typically happen in linux. Packets are just silently dropped */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcConnection, rcInterrupted );
-        break;
-    case ENOENT: /* file does not exist */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcId, rcNotFound );
-        break;
-    case ENOMEM: /* Could not allocate memory */
-        rc = RC ( rcNS, rcNoTarg, rcAllocating, rcMemory, rcError );
-        break;
-    case ENOTCONN: /* socket has not been connected */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcConnection, rcInvalid );
-        break;
-    case ENOTDIR: /* component of path is not a directory */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcDirEntry, rcError );
-        break;
-    case ENOTSOCK: /* sock fd does not refer to socket */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcId, rcInvalid );
-        break;
-    case EOPNOTSUPP: /* bits in flags argument is inappropriate */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcParam, rcInvalid );
-        break;
-    case EPERM:
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcMemory, rcUnauthorized );            
-        break;
-    case EPIPE: /* local end has been shut down. Will also receive SIGPIPE or MSG_NOSIGNAL */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcConnection, rcCanceled );
-        break;
-    case EPROTONOSUPPORT: /* specified protocol is not supported */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcNoObj, rcError );
-        break;
-    case EROFS: /* socket inode on read only file system */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcNoObj, rcReadonly );
-        break;
-    case ETIMEDOUT: /* timeout */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcConnection, rcNotAvailable );
-        break;
-#if ! defined EAGAIN || ! defined EWOULDBLOCK || EAGAIN != EWOULDBLOCK
-    case EWOULDBLOCK:
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcId, rcError );
-        break;
-#endif
-    default:
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcNoObj, rcError );
-        PLOGERR (klogErr,
-                 (klogErr, rc, "unknown system error '$(S)($(E))'",
-                  "S=%!,E=%d", lerrno, lerrno));
-    }
-    
-#if _DEBUGGING
-    if ( rc != 0 )
-        pLogMsg ( klogInfo, "$(RC)\n", "RC=%R", rc );
-#endif
-
-    return rc;
-}
-
-static
-rc_t CC KSocketTimedRead ( const KSocket *self,
-    void *buffer, size_t bsize, size_t *num_read, timeout_t *tm )
-{
-    int revents;
-    
-    assert ( self != NULL );
-    assert ( num_read != NULL );
-
-    pLogLibMsg(klogInfo, "$(b): KSocketTimedRead($(s), $(t))...", "b=%p,s=%d,t=%d", self, bsize, tm == NULL ? -1 : tm -> mS);
-    
-    /* wait for socket to become readable */
-    revents = socket_wait ( self -> fd
-                            , POLLIN
-                            | POLLRDNORM
-                            | POLLRDBAND
-                            | POLLPRI
-                            | POLLRDHUP
-                            , tm );
-
-    /* check for error */
-    if ( revents < 0 || ( revents & ( POLLERR | POLLNVAL ) ) != 0 )
-    {
-        if ( errno != 0 )
-        {
-            rc_t rc = HandleErrno ( __func__, __LINE__ );
-            pLogLibMsg(klogInfo, "$(b): KSocketTimedRead socket_wait "
-                "returned errno $(e)", "b=%p,e=%d", self, errno);
-            return rc;
-        }
-
-        if ((revents & POLLERR) != 0) {
-            int optval = 0;
-            socklen_t optlen = sizeof optval;
-            if ((getsockopt(self->fd, SOL_SOCKET, SO_ERROR, &optval, &optlen)
-                    == 0)
-                && optval > 0)
-            {
-                errno = optval;
-                DBGMSG(DBG_KNS, DBG_FLAG(DBG_KNS_ERR), (
-"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@1 %s getsockopt = %s @@@@@@@@@@@@@@@@"
-                    "\n", __FILE__, strerror(optval)));
-                rc_t rc = HandleErrno(__func__, __LINE__);
-                pLogLibMsg(klogInfo, "$(b): KSocketTimedRead "
-                    "socket_wait/getsockopt returned errno $(e)",
-                    "b=%p,e=%d", self, errno);
-                return rc;
-            }
-        }
-
-        pLogLibMsg(klogInfo, "$(b): KSocketTimedRead socket_wait "
-            "returned POLLERR | POLLNVAL", "b=%p", self);
-        return RC ( rcNS, rcStream, rcReading, rcNoObj, rcUnknown );
-    }
-
-    /* check for read availability */
-    if ( ( revents & ( POLLRDNORM | POLLRDBAND ) ) != 0 )
-    {
-        ssize_t count = recv ( self -> fd, buffer, bsize, 0 );
-        if ( count >= 0 )
-        {
-            * num_read = count;
-            return 0;
-        }
-        rc_t rc = HandleErrno ( __func__, __LINE__ );
-        pLogLibMsg(klogInfo, "$(b): KSocketTimedRead recv returned count $(c)", "b=%p,c=%d", self, count);
-        return rc;
-    }
-
-    /* check for broken connection */
-    if ( ( revents & ( POLLHUP | POLLRDHUP ) ) != 0 )
-    {
-        pLogLibMsg(klogInfo, "$(b): KSocketTimedRead broken connection", "b=%p", self);
-        * num_read = 0;
-        return 0;
-    }
-
-    /* anything else in revents is an error */
-    if ( ( revents & ~ POLLIN ) != 0 && errno != 0 )
-    {
-        rc_t rc = HandleErrno ( __func__, __LINE__ );
-        pLogLibMsg(klogInfo, "$(b): KSocketTimedRead error=$(e)", "b=%p,e=%e", self, errno);
-        return rc;
-    }
-
-    /* finally, call this a timeout */
-    pLogLibMsg(klogInfo, "$(b): KSocketTimedRead timeout", "b=%p", self);
-    return RC ( rcNS, rcStream, rcReading, rcTimeout, rcExhausted );
-}
-
-static
-rc_t CC KSocketRead ( const KSocket *self,
-    void *buffer, size_t bsize, size_t *num_read )
-{
-    timeout_t tm;
-    assert ( self != NULL );
-
-    if ( self -> read_timeout < 0 )
-        return KSocketTimedRead ( self, buffer, bsize, num_read, NULL );
-
-    TimeoutInit ( & tm, self -> read_timeout );
-    return KSocketTimedRead ( self, buffer, bsize, num_read, & tm );
-}
-
-static
-rc_t CC KSocketTimedWrite ( KSocket *self,
-    const void *buffer, size_t bsize, size_t *num_writ, timeout_t *tm )
-{
-    int revents;
-    ssize_t count;
-
-    assert ( self != NULL );
-    assert ( num_writ != NULL );
-
-    pLogLibMsg(klogInfo, "$(b): KSocketTimedWrite($(s), $(t))...", "b=%p,s=%d,t=%d", self, bsize, tm == NULL ? -1 : tm -> mS);
-
-    /* wait for socket to become writable */
-    revents = socket_wait ( self -> fd
-                            , POLLOUT
-                            | POLLWRNORM
-                            | POLLWRBAND
-                            , tm );
-
-    /* check for error */
-    if ( revents < 0 || ( revents & ( POLLERR | POLLNVAL ) ) != 0 )
-    {
-        if ( errno != 0 )
-        {
-            rc_t rc = HandleErrno ( __func__, __LINE__ );
-            pLogLibMsg(klogInfo, "$(b): KSocketTimedWrite socket_wait returned errno $(e)", "b=%p,e=%d", self, errno);
-            return rc;
-        }
-        pLogLibMsg(klogInfo, "$(b): KSocketTimedWrite socket_wait returned POLLERR | POLLNVAL", "b=%p", self);
-        return RC ( rcNS, rcStream, rcWriting, rcNoObj, rcUnknown );
-    }
-
-    /* check for broken connection */
-    if ( ( revents & POLLHUP ) != 0 )
-    {
-        pLogLibMsg(klogInfo, "$(b): POLLHUP received", "b=%p", self);            
-        * num_writ = 0;
-        return 0;
-    }
-
-    /* check for ability to send */
-    if ( ( revents & ( POLLWRNORM | POLLWRBAND ) ) != 0 )
-    {
-        rc_t rc = 0;
-        count = send ( self -> fd, buffer, bsize, 0 );
-        if ( count >= 0 )
-        {
-            pLogLibMsg(klogInfo, "$(b): $(s) bytes written", "b=%p,s=%d", self, count);            
-            * num_writ = count;
-            return 0;
-        }
-
-        rc = HandleErrno ( __func__, __LINE__ );
-        pLogLibMsg(klogInfo, "$(b): KSocketTimedWrite recv returned count $(c)", "b=%p,c=%d", self, count);
-        return rc;
-    }
-
-    /* anything else in revents is an error */
-    if ( ( revents & ~ POLLOUT ) != 0 && errno != 0 )
-    {
-        rc_t rc = HandleErrno ( __func__, __LINE__ );
-        pLogLibMsg(klogInfo, "$(b): KSocketTimedWrite error=$(e)", "b=%p,e=%e", self, errno);
-        return rc;
-    }
-
-    /* finally, call this a timeout */
-    pLogLibMsg(klogInfo, "$(b): KSocketTimedWrite timeout", "b=%p", self);            
-    return RC ( rcNS, rcStream, rcWriting, rcTimeout, rcExhausted );
-}
-
-static
-rc_t CC KSocketWrite ( KSocket *self,
-    const void *buffer, size_t bsize, size_t *num_writ )
-{
-    timeout_t tm;
-    assert ( self != NULL );
-
-    if ( self -> write_timeout < 0 )
-        return KSocketTimedWrite ( self, buffer, bsize, num_writ, NULL );
-
-    TimeoutInit ( & tm, self -> write_timeout );
-    return KSocketTimedWrite ( self, buffer, bsize, num_writ, & tm );
-}
-
-static KStream_vt_v1 vtKSocket =
-{
-    1, 1,
-    KSocketWhack,
-    KSocketRead,
-    KSocketWrite,
-    KSocketTimedRead,
-    KSocketTimedWrite
-};
-
-static
-rc_t KSocketMakePath ( const char * name, char * buf, size_t buf_size )
-{
-    size_t num_writ;
-#if 0
-    struct passwd* pwd;
-    pwd = getpwuid ( geteuid () );
-    if ( pwd == NULL )
-        return HandleErrno ( __func__, __LINE__ );
-
-    return string_printf ( buf, buf_size, & num_writ, "%s/.ncbi/%s", pwd -> pw_dir, name );
-#else
-    const char *HOME = getenv ( "HOME" );
-    if ( HOME == NULL )
-        return RC ( rcNS, rcProcess, rcAccessing, rcPath, rcNotFound );
-
-    return string_printf ( buf, buf_size, & num_writ, "%s/.ncbi/%s", HOME, name );
-#endif
-}
-
-static
-rc_t KSocketConnectIPv4 ( KSocket *self, int32_t retryTimeout, const KEndPoint *from, const KEndPoint *to )
-{
-    rc_t rc = 0;
-    uint32_t retry_count = 0;
-    struct sockaddr_in ss_from, ss_to;
-
-    memset ( & ss_from, 0, sizeof ss_from );
-    if ( from != NULL )
-    {
-        ss_from . sin_family = AF_INET;
-        ss_from . sin_addr . s_addr = htonl ( from -> u . ipv4 . addr );
-        ss_from . sin_port = htons ( from -> u . ipv4 . port );
-    }
-
-    memset ( & ss_to, 0, sizeof ss_to );
-    ss_to . sin_family = AF_INET;
-    ss_to . sin_addr . s_addr = htonl ( to -> u . ipv4 . addr );
-    ss_to . sin_port = htons ( to -> u . ipv4 . port );
-
-    do 
-    {
-        /* create the OS socket */
-        self -> fd = socket ( AF_INET, SOCK_STREAM, 0 );
-        if ( self -> fd < 0 )
-            rc = HandleErrno ( __func__, __LINE__ );
-        else
-        {
-            /* disable nagle algorithm */
-            int flag = 1;
-            setsockopt ( self -> fd, IPPROTO_TCP, TCP_NODELAY, ( char* ) & flag, sizeof flag );
-
-            /* bind */
-            if ( from != NULL && bind ( self -> fd, ( struct sockaddr* ) & ss_from, sizeof ss_from ) != 0 )
-                rc = HandleErrno ( __func__, __LINE__ );
-                
-            if ( rc == 0 )
-            {
-                /* connect */
-                if ( connect ( self -> fd, ( struct sockaddr* ) & ss_to, sizeof ss_to ) == 0 )
-                {
-                    /* set non-blocking mode */
-                    flag = fcntl ( self -> fd, F_GETFL );
-                    fcntl ( self -> fd, F_SETFL, flag | O_NONBLOCK );
-                    return 0;
-                }
-                rc = HandleErrno ( __func__, __LINE__ );
-            }
-
-            /* dump socket */
-            close ( self -> fd );
-            self -> fd = -1;
-        }
-        
-        /* rc != 0 */
-        if (retryTimeout < 0 || retry_count < retryTimeout)
-        {   /* retry */
-            sleep ( 1 );
-            ++retry_count;
-            rc = 0;
-        }
-    }
-    while (rc == 0);
-    
-    pLogLibMsg(klogInfo, "$(b): KSocketConnectIPv4 timed out", "b=%p", self);            
-
-    return rc;
-}
-
-static
-rc_t KSocketConnectIPC ( KSocket *self, int32_t retryTimeout, const KEndPoint *to )
-{
-    rc_t rc = 0;
-    uint32_t retry_count = 0;
-    struct sockaddr_un ss_to;
-
-    memset ( & ss_to, 0, sizeof ss_to );
-    ss_to . sun_family = AF_UNIX;
-    rc = KSocketMakePath ( to -> u . ipc_name, ss_to . sun_path, sizeof ss_to . sun_path );
-
-    do 
-    {
-        /* create the OS socket */
-        self -> fd = socket ( AF_UNIX, SOCK_STREAM, 0 );
-        if ( self -> fd < 0 )
-            rc = HandleErrno ( __func__, __LINE__ );
-        else
-        {
-            /* connect */
-            if ( connect ( self -> fd, ( struct sockaddr* ) & ss_to, sizeof ss_to ) == 0 )
-            {
-                return 0;
-            }
-            rc = HandleErrno ( __func__, __LINE__ );
-
-            /* dump socket */
-            close ( self -> fd );
-            self -> fd = -1;
-        }
-        
-        /* rc != 0 */
-        if (retryTimeout < 0 || retry_count < retryTimeout)
-        {   /* retry */
-            sleep ( 1 );
-            ++retry_count;
-            rc = 0;
-        }
-    }
-    while (rc == 0);
-
-    pLogLibMsg(klogInfo, "$(b): KSocketConnectIPC timed out", "b=%p", self);            
-
-    return rc;
- }
-
-KNS_EXTERN rc_t CC KNSManagerMakeRetryTimedConnection ( struct KNSManager const * self,
-    struct KStream **out, int32_t retryTimeout, int32_t readMillis, int32_t writeMillis,
-    struct KEndPoint const *from, struct KEndPoint const *to )
-{
-    rc_t rc;
-
-    if ( out == NULL )
-        rc = RC ( rcNS, rcStream, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcNS, rcStream, rcConstructing, rcSelf, rcNull );
-        else if ( to == NULL )
-            rc = RC ( rcNS, rcStream, rcConstructing, rcParam, rcNull );
-        else if ( from != NULL && from -> type != to -> type )
-            rc = RC ( rcNS, rcStream, rcConstructing, rcParam, rcIncorrect );
-        else
-        {
-            KSocket *conn = calloc ( 1, sizeof * conn );
-            if ( conn == NULL )
-                rc = RC ( rcNS, rcStream, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                conn -> fd = -1;
-                conn -> read_timeout = readMillis;
-                conn -> write_timeout = writeMillis;
-
-                rc = KStreamInit ( & conn -> dad, ( const KStream_vt* ) & vtKSocket,
-                                   "KSocket", "", true, true );
-                if ( rc == 0 )
-                {
-                    switch ( to -> type )
-                    {
-                    case epIPV4:
-                        rc = KSocketConnectIPv4 ( conn, retryTimeout, from, to );
-                        break;
-                    case epIPC:
-                        rc = KSocketConnectIPC ( conn, retryTimeout, to );
-                        break;
-                    default:
-                        rc = RC ( rcNS, rcStream, rcConstructing, rcParam, rcIncorrect );
-                    }
-
-                    if ( rc == 0 )
-                    {
-                        * out = & conn -> dad;
-                        return 0;
-                    }
-                }
-
-                free ( conn );
-            }
-        }
-
-        * out = NULL;
-    }
-
-    return rc;
-}
-
-static
-rc_t KNSManagerMakeIPv4Listener ( KSocket *listener, const KEndPoint * ep )
-{
-    rc_t rc;
-
-    listener -> fd = socket ( AF_INET, SOCK_STREAM, 0 );
-    if ( listener -> fd < 0 )
-        rc = HandleErrno ( __func__, __LINE__ );
-    else
-    {
-        struct sockaddr_in ss;
-
-        int on = 1;
-        setsockopt ( listener -> fd, SOL_SOCKET, SO_REUSEADDR, ( char* ) & on, sizeof on );
-
-        memset ( & ss, 0, sizeof ss );
-        ss . sin_family = AF_INET;
-        ss . sin_addr . s_addr = htonl ( ep -> u . ipv4 . addr );
-        ss . sin_port = htons ( ep -> u . ipv4 . port );
-
-        if ( bind ( listener -> fd, ( struct sockaddr* ) & ss, sizeof ss ) == 0 )
-            return 0;
-        rc = HandleErrno ( __func__, __LINE__ );
-
-        close ( listener -> fd );
-        listener -> fd = -1;
-    }
-
-    return rc;
-}
-
-static
-rc_t KNSManagerMakeIPCListener ( KSocket *listener, const KEndPoint * ep )
-{
-    rc_t rc;
-
-    listener -> fd = socket ( AF_UNIX, SOCK_STREAM, 0 );
-    if ( listener -> fd < 0 )
-        rc = HandleErrno ( __func__, __LINE__ );
-    else
-    {
-        struct sockaddr_un ss;
-        memset ( & ss, 0, sizeof ss );
-        ss.sun_family = AF_UNIX;
-        rc = KSocketMakePath ( ep -> u. ipc_name, ss . sun_path, sizeof ss . sun_path );
-        if ( rc == 0 )
-        {
-            char * path = string_dup ( ss . sun_path, string_measure ( ss . sun_path, NULL ) );
-            if ( path == NULL )
-                rc = RC ( rcNS, rcSocket, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                unlink ( ss . sun_path );
-                if ( bind ( listener -> fd, ( struct sockaddr* ) & ss, sizeof ss ) != 0 )
-                    rc = HandleErrno ( __func__, __LINE__ );
-                else
-                {
-                    listener -> path = path;
-                    return 0;
-                }
-
-                free ( path );
-            }
-        }
-
-        close ( listener -> fd );
-        listener -> fd = -1;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KNSManagerMakeListener ( const KNSManager *self,
-    KSocket ** out, const KEndPoint * ep )
-{   
-    rc_t rc;
-
-    if ( out == NULL )
-        rc = RC ( rcNS, rcSocket, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcNS, rcSocket, rcConstructing, rcSelf, rcNull );
-        else if ( ep == NULL )
-            rc = RC ( rcNS, rcSocket, rcConstructing, rcParam, rcNull );
-        else
-        {
-            KSocket *listener = calloc ( 1, sizeof * listener );
-            if ( listener == NULL )
-                rc = RC ( rcNS, rcSocket, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                listener -> fd = -1;
-
-                /* pass these along to accepted sockets */
-                listener -> read_timeout = self -> conn_read_timeout;
-                listener -> write_timeout = self -> conn_write_timeout;
-
-                rc = KStreamInit ( & listener -> dad, ( const KStream_vt* ) & vtKSocket,
-                                   "KSocket", "", true, true );
-                if ( rc == 0 )
-                {
-                    switch ( ep -> type )
-                    {
-                    case epIPV4:
-                        rc = KNSManagerMakeIPv4Listener ( listener, ep );
-                        break;
-                    case epIPC:
-                        rc = KNSManagerMakeIPCListener ( listener, ep );
-                        break;
-                    default:
-                        rc = RC ( rcNS, rcSocket, rcConstructing, rcParam, rcIncorrect );
-                    }
-
-                    if ( rc == 0 )
-                    {
-                        /* the classic 5 connection queue... ? */
-                        if ( listen ( listener -> fd, 5 ) == 0 )
-                        {
-                            * out = listener;
-                            return 0;
-                        }
-
-                        rc = HandleErrno ( __func__, __LINE__ );
-
-                        if ( listener -> path != NULL )
-                            free ( ( void* ) listener -> path );
-                    }
-                }
-
-                free ( listener );
-            }
-        }
-
-        * out = NULL;
-    }
-
-    return rc;
-}
-
-static
-rc_t KSocketAcceptIPv4 ( KSocket *self, KSocket *conn )
-{
-    struct sockaddr_in remote;
-    socklen_t len = sizeof remote;
-    conn -> fd = accept ( self -> fd, ( struct sockaddr* ) & remote, & len );
-    if ( conn -> fd < 0 )
-        return HandleErrno ( __func__, __LINE__ );
-    if ( len > sizeof remote )
-        return RC ( rcNS, rcConnection, rcWaiting, rcBuffer, rcInsufficient );
-    return 0;
-}
-
-static
-rc_t KSocketAcceptIPC ( KSocket *self, KSocket *conn )
-{
-    struct sockaddr_un remote;
-    socklen_t len = sizeof remote;
-    conn -> fd = accept ( self -> fd, ( struct sockaddr* ) & remote, & len );
-    if ( conn -> fd < 0 )
-        return HandleErrno ( __func__, __LINE__ );
-    if ( len > sizeof remote )
-        return RC ( rcNS, rcConnection, rcWaiting, rcBuffer, rcInsufficient );
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KSocketAccept ( KSocket *self, struct KStream **out )
-{
-    rc_t rc;
-
-    if ( out == NULL )
-        rc = RC ( rcNS, rcConnection, rcWaiting, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcNS, rcConnection, rcWaiting, rcSelf, rcNull);
-        else
-        {
-            KSocket * conn = calloc ( 1, sizeof * conn );
-            if ( conn == NULL )
-                rc = RC ( rcNS, rcConnection, rcWaiting, rcMemory, rcExhausted );
-            else
-            {
-                conn -> fd = -1;
-                conn -> read_timeout = self -> read_timeout;
-                conn -> write_timeout = self -> write_timeout;
-
-                rc = KStreamInit ( & conn -> dad, ( const KStream_vt* ) & vtKSocket,
-                                   "KSocket", "", true, true );
-                if ( rc == 0 )
-                {
-                    switch ( self -> type )
-                    {
-                    case epIPV4:
-                        rc = KSocketAcceptIPv4 ( self, conn );
-                        break;
-                    case epIPC:
-                        rc = KSocketAcceptIPC ( self, conn );
-                        break;
-                    default:
-                        rc = RC ( rcNS, rcSocket, rcConstructing, rcSelf, rcCorrupt );
-                    }
-
-                    if ( rc == 0 )
-                    {
-                        * out = & conn -> dad;
-                        return 0;
-                    }
-
-                    free ( conn );
-                }
-            }
-        }
-
-        * out = NULL;
-    }
-
-    return rc;
-}
diff --git a/libs/kns/unix/sysstream.c b/libs/kns/unix/sysstream.c
deleted file mode 100644
index de03f29..0000000
--- a/libs/kns/unix/sysstream.c
+++ /dev/null
@@ -1,251 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-#define KSTREAM_IMPL KStdIOStream
-typedef struct KStdIOStream KStdIOStream;
-
-#include <kns/extern.h>
-#include <kns/stream.h>
-#include <kns/impl.h>
-#include <klib/rc.h>
-#include <klib/log.h>
-#include <sysalloc.h>
-
-#include "stream-priv.h"
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * KStdIOStream
- *  a virtual stream
- */
-struct KStdIOStream
-{
-    KStream dad;
-    int fd;
-};
-
-static
-rc_t CC KStdIOStreamWhack ( KStdIOStream *self )
-{
-    /* we don't close self->fd because we did not open it */
-    free ( self );
-    return 0;
-}
-
-static
-rc_t CC KStdIOStreamRead ( const KStdIOStream *self,
-    void *buffer, size_t bsize, size_t *num_read )
-{
-    rc_t rc;
-    assert ( self != NULL );
-
-    while ( 1 )
-    {
-        int lerrno;
-
-        ssize_t count = read ( self -> fd, buffer, bsize );
-
-        if ( count < 0 ) switch ( lerrno = errno )
-        {
-        case ENOSPC:
-            rc = RC ( rcNS, rcStream, rcReading, rcStorage, rcExhausted );
-            LOGERR (klogSys, rc, "system device full error");
-            return rc;
-
-        case EINTR:
-            continue;
-
-        case EFBIG:
-            rc = RC ( rcNS, rcStream, rcReading, rcStream, rcExcessive );
-            LOGERR (klogErr, rc, "system file too big error");
-            return rc;
-
-        case EIO:
-            rc = RC ( rcNS, rcStream, rcReading, rcTransfer, rcUnknown );
-            LOGERR (klogErr, rc, "system I/O error - broken pipe");
-            return rc;
-            
-        case EBADF:
-            rc = RC ( rcNS, rcStream, rcReading, rcFileDesc, rcInvalid );
-            PLOGERR (klogInt,
-                     (klogInt, rc, "system bad file descriptor error fd=$(F)",
-                      "F=%d", lerrno, self->fd));
-            return rc;
-
-        case EINVAL:
-            rc = RC ( rcNS, rcStream, rcReading, rcParam, rcInvalid );
-            LOGERR (klogInt, rc, "system invalid argument error");
-            return rc;
-
-        default:
-            rc = RC ( rcNS, rcStream, rcReading, rcNoObj, rcUnknown );
-            PLOGERR (klogErr,
-                     (klogErr, rc, "unknown system error '$(S)($(E))'",
-                      "S=%!,E=%d", lerrno, lerrno));
-            return rc;
-        }
-
-        assert ( num_read != NULL );
-        * num_read = count;
-        break;
-    }
-
-    return 0;
-}
-
-static
-rc_t CC KStdIOStreamWrite ( KStdIOStream *self,
-    const void *buffer, size_t size, size_t *num_writ )
-{
-    rc_t rc;
-    assert ( self != NULL );
-
-    while ( 1 )
-    {
-        int lerrno;
-
-        ssize_t count = write ( self -> fd, buffer, size );
-
-        if ( count < 0 ) switch ( lerrno = errno )
-        {
-        case ENOSPC:
-            rc = RC ( rcNS, rcStream, rcWriting, rcStorage, rcExhausted );
-            LOGERR (klogSys, rc, "system device full error");
-            return rc;
-
-        case EINTR:
-            continue;
-
-        case EFBIG:
-            rc = RC ( rcNS, rcStream, rcWriting, rcStream, rcExcessive );
-            LOGERR (klogErr, rc, "system file too big error");
-            return rc;
-
-        case EIO:
-            rc = RC ( rcNS, rcStream, rcWriting, rcTransfer, rcUnknown );
-            LOGERR (klogErr, rc, "system I/O error - broken pipe");
-            return rc;
-            
-        case EBADF:
-            rc = RC ( rcNS, rcStream, rcWriting, rcFileDesc, rcInvalid );
-            PLOGERR (klogInt,
-                     (klogInt, rc, "system bad file descriptor error fd=$(F)",
-                      "F=%d", lerrno, self->fd));
-            return rc;
-
-        case EINVAL:
-            rc = RC ( rcNS, rcStream, rcWriting, rcParam, rcInvalid );
-            LOGERR (klogInt, rc, "system invalid argument error");
-            return rc;
-
-        default:
-            rc = RC ( rcNS, rcStream, rcWriting, rcNoObj, rcUnknown );
-            PLOGERR (klogErr,
-                     (klogErr, rc, "unknown system error '$(S)($(E))'",
-                      "S=%!,E=%d", lerrno, lerrno));
-            return rc;
-        }
-
-        assert ( num_writ != NULL );
-        * num_writ = count;
-        break;
-    }
-
-    return 0;
-}
-
-static KStream_vt_v1 vtKStdIOStream =
-{
-    1, 0,
-    KStdIOStreamWhack,
-    KStdIOStreamRead,
-    KStdIOStreamWrite
-};
-
-
-static
-rc_t KStdIOStreamMake ( KStream **sp, int fd, const char *strname,
-    bool read_enabled, bool write_enabled )
-{
-    rc_t rc;
-
-    if ( sp == NULL )
-        rc = RC ( rcNS, rcStream, rcConstructing, rcParam, rcNull );
-    else
-    {
-        KStdIOStream *s = calloc ( sizeof *s, 1 );
-        if ( s == NULL )
-            rc = RC ( rcNS, rcStream, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            rc = KStreamInit ( & s -> dad, ( const KStream_vt* ) & vtKStdIOStream,
-                               "KStdIOStream", strname, read_enabled, write_enabled );
-            if ( rc == 0 )
-            {
-                s -> fd = fd;
-                * sp = & s -> dad;
-                return 0;
-            }
-
-            free ( s );
-        }
-
-        * sp = NULL;
-    }
-
-    return rc;
-}
-
-/* MakeStdIn
- *  creates a read-only stream on stdin
- */
-LIB_EXPORT rc_t CC KStreamMakeStdIn ( const KStream **std_in )
-{
-    return KStdIOStreamMake ( ( KStream** ) std_in, 0, "stdin", true, false );
-}
-
-/* MakeStdOut
- * MakeStdErr
- *  creates a write-only stream on stdout or stderr
- */
-LIB_EXPORT rc_t CC KStreamMakeStdOut ( KStream **std_out )
-{
-    return KStdIOStreamMake ( std_out, 1, "stdout", false, true );
-}
-
-LIB_EXPORT rc_t CC KStreamMakeStdErr ( KStream **std_err )
-{
-    return KStdIOStreamMake ( std_err, 2, "stderr", false, true );
-}
diff --git a/libs/kns/url-fetcher-curl.c b/libs/kns/url-fetcher-curl.c
deleted file mode 100644
index 12c7073..0000000
--- a/libs/kns/url-fetcher-curl.c
+++ /dev/null
@@ -1,255 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kns/extern.h>
-#include <klib/rc.h>
-#include <kns/manager.h>
-#include <kns/url-fetcher.h>
-
-/* IMPORTANT define this before including the *-impl.h !!!! */
-#define KURL_FETCHER_IMPL KUrlFetcherCurl
-#include "url-fetcher-impl.h"
-
-#include "kns_mgr_priv.h"
-
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-
-/*
-#include <curl/curl.h>
-#include <curl/types.h>
-#include <curl/easy.h>
-*/
-
-/*--------------------------------------------------------------------------
- * KVectorNamelist ... a generic Namelist based on a Vector
- */
-struct KUrlFetcherCurl
-{
-    KUrlFetcher dad;
-
-    struct KNSManager *kns_mgr;
-    CURL *curl_handle;
-
-    /* this buffer is passed in from read() to the callback 
-       it is owned by the caller not this class */
-    char *buff;
-    size_t buffsize;
-    size_t in_buff;
-    
-    /* this is the spill-over buffer, used by the callback
-       if the caller-provided buffer is too small */
-    char *spill_over_buff;
-    size_t spill_over_buffsize;
-};
-
-/* implementation of the the virtual KUrlFetcher-Interface for curl */
-
-static
-rc_t CC KUrlFetcherCurlDestroy ( KUrlFetcherCurl *self )
-{
-    self->kns_mgr->curl_easy_cleanup_fkt( self -> curl_handle );
-    KNSManagerRelease( self->kns_mgr );
-
-    if ( self -> spill_over_buff != NULL )
-        free( self -> spill_over_buff );
-    free ( self );
-    return 0;
-}
-
-static
-size_t CC KUrlFetcherCurlCallback( void *ptr, size_t size, size_t nmemb, void *data )
-{
-    size_t given_bytes = size * nmemb; /* calculate the size given in ptr */
-    KUrlFetcherCurl *self = ( KUrlFetcherCurl * )data;
-    if ( self != NULL )
-    {
-        if ( ( self -> in_buff + given_bytes ) > self -> buffsize )
-        {
-            /* the caller-provided buffer IS NOT enough... */
-            size_t to_copy = ( self -> buffsize - self -> in_buff );
-            if ( to_copy > 0 )
-            {
-                /* the caller-provided buffer can hold a part of it... */
-                if ( self -> buff )
-                {
-                    memcpy( &( self -> buff [ self -> in_buff ] ), ptr, given_bytes );
-                    self -> in_buff += given_bytes;
-                }
-            }
-            else
-            {
-                /* the spill-over-buffer has to take care of the rest... */
-                size_t remaining = ( given_bytes - to_copy );
-                if ( self -> spill_over_buff == NULL )
-                    self -> spill_over_buff = malloc( remaining );
-                else
-                    self -> spill_over_buff = realloc( self -> spill_over_buff,
-                                                       self -> spill_over_buffsize + remaining );
-                if ( self -> spill_over_buff != NULL )
-                {
-                    memcpy( &( self -> spill_over_buff [ self -> spill_over_buffsize ] ), ptr, remaining );
-                    self -> spill_over_buffsize += remaining;
-                }
-            }
-        }
-        else
-        {
-            /* the caller-provided buffer IS enough... */
-            if ( self -> buff )
-            {
-                memcpy( &( self -> buff [ self -> in_buff ] ), ptr, given_bytes );
-                self -> in_buff += given_bytes;
-            }
-        }
-    }
-    return given_bytes;
-}
-
-
-static
-rc_t CC KUrlFetcherCurlRead( KUrlFetcherCurl *self, const char * uri,
-                          void *dst, size_t to_read, size_t *num_read )
-{
-    CURLcode rcc;
-
-    /* the virtual interface has already checked that self is not NULL */
-    if ( uri == NULL || dst == NULL || to_read == 0 )
-        return RC ( rcApp, rcFunction, rcConstructing, rcParam, rcNull );
-
-    self -> buff = dst;
-    self -> buffsize = to_read;
-    self -> in_buff = 0;
-
-    if ( self -> spill_over_buff != NULL )
-        free( self -> spill_over_buff );
-    self -> spill_over_buff = NULL;
-    self -> spill_over_buffsize = 0;
-
-    if ( self -> curl_handle == NULL )
-        return RC ( rcApp, rcFunction, rcConstructing, rcParam, rcNull );
-
-    rcc = self->kns_mgr->curl_easy_setopt_fkt( self -> curl_handle, CURLOPT_URL, uri );
-    if ( rcc != CURLE_OK )
-    {
-        if ( num_read ) *num_read = 0;
-        return RC ( rcApp, rcFunction, rcConstructing, rcParam, rcNull );
-    }
-    else
-    {
-        rcc = self->kns_mgr->curl_easy_perform_fkt( self-> curl_handle );
-        if ( rcc != CURLE_OK )
-        {
-            if ( num_read ) *num_read = 0;
-            return RC ( rcApp, rcFunction, rcConstructing, rcParam, rcNull );
-        }
-    }
-    
-    if ( num_read )
-        *num_read = self -> in_buff;
-
-    return 0;
-}
-
-static KUrlFetcher_vt_v1 sKUrlFetcherCurl_vt =
-{
-    1, 0,
-    KUrlFetcherCurlDestroy,
-    KUrlFetcherCurlRead,
-};
-
-LIB_EXPORT rc_t CC KUrlFetcherCurlMake( KUrlFetcher **fetcher, const bool verbose )
-{
-    rc_t rc;
-
-    if ( fetcher == NULL )
-        rc = RC ( rcApp, rcFunction, rcConstructing, rcParam, rcNull );
-    else
-    {
-        KUrlFetcherCurl * tmp;
-        *fetcher = NULL;
-        tmp = malloc( sizeof( * tmp ) );
-        if ( tmp != NULL )
-        {
-            rc = KUrlFetcherInit ( &(tmp)->dad, (const KUrlFetcher_vt*)&sKUrlFetcherCurl_vt );
-            if ( rc != 0 )
-                free( tmp );
-            else
-            {
-                tmp -> buff = NULL;
-                tmp -> buffsize = 0;
-                tmp -> in_buff = 0;
-
-                tmp -> spill_over_buff = NULL;
-                tmp -> spill_over_buffsize = 0;
-
-                rc = KNSManagerMake( &tmp->kns_mgr );
-                if ( rc == 0 )
-                {
-                    tmp -> curl_handle = tmp -> kns_mgr -> curl_easy_init_fkt();
-                    if ( tmp -> curl_handle == NULL )
-                    {
-                        KNSManagerRelease( tmp->kns_mgr );
-                        free( tmp );
-                        rc = RC ( rcApp, rcFunction, rcConstructing, rcParam, rcNull );
-                    }
-                    else
-                    {
-                        CURLcode rcc;
-                        
-                        if ( verbose )
-                            tmp -> kns_mgr -> curl_easy_setopt_fkt( tmp -> curl_handle, CURLOPT_VERBOSE , 1 );
-                        
-                        rcc = tmp -> kns_mgr -> curl_easy_setopt_fkt( tmp -> curl_handle, CURLOPT_WRITEFUNCTION, KUrlFetcherCurlCallback );
-                        if ( rcc != CURLE_OK )
-                        {
-                            KNSManagerRelease( tmp -> kns_mgr );
-                            free( tmp );
-                            rc = RC ( rcApp, rcFunction, rcConstructing, rcParam, rcNull );
-                        }
-                        else
-                        {
-                            rcc = tmp -> kns_mgr -> curl_easy_setopt_fkt( tmp -> curl_handle, CURLOPT_WRITEDATA, (void *)tmp );
-                            if ( rcc != CURLE_OK )
-                            {
-                                KNSManagerRelease( tmp -> kns_mgr );
-                                free( tmp );
-                                rc = RC ( rcApp, rcFunction, rcConstructing, rcParam, rcNull );
-                            }
-                            else
-                                *fetcher = & tmp -> dad;
-                        }
-                    }
-                }
-            }
-        }
-        else
-            rc = RC( rcApp, rcFunction, rcListing, rcParam, rcNull );
-    }
-    return rc;
-}
diff --git a/libs/kns/url-fetcher-impl.h b/libs/kns/url-fetcher-impl.h
deleted file mode 100644
index 0965bfa..0000000
--- a/libs/kns/url-fetcher-impl.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/*--------------------------------------------------------------------------
- * this file contains the private parts (v-table) of a generic url-fetcher
-    the user has to provide 3 things to the fetcher:
-        (1) the url to fetch via vt->set_url()
-        (2) eventually a context pointer via vt->set_context()
-        (3) a callback function via vt->set_callback()
-    before the user can "start" the fetcher:
-        via vt->fetch()
- */
-
-#ifndef _h_url_fetcher_impl_
-#define _h_url_fetcher_impl_
-
-#ifndef _h_kns_extern_
-#include <kns/extern.h>
-#endif
-
-#ifndef _h_kfs_file_
-#include <kfs/file.h>
-#endif
-
-#ifndef _h_url_fetcher_
-#include <kns/url-fetcher.h>
-#endif
-
-#ifndef _h_klib_refcount_
-#include <klib/refcount.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-typedef union KUrlFetcher_vt KUrlFetcher_vt;
-
-/*--------------------------------------------------------------------------
- * KUrl_fetcher
- *  a virtual url-fetcher
- */
-struct KUrlFetcher
-{
-    const KUrlFetcher_vt *vt;
-    KRefcount refcount;
-};
-
-
-#ifndef KURL_FETCHER_IMPL
-#define KURL_FETCHER_IMPL KUrlFetcher
-#endif
-
-
-typedef struct KUrlFetcher_vt_v1 KUrlFetcher_vt_v1;
-struct KUrlFetcher_vt_v1
-{
-    /* version == 1.x */
-    uint32_t maj;
-    uint32_t min;
-
-    /* start minor version == 0 */
-    rc_t ( CC * destroy ) ( KURL_FETCHER_IMPL *self );
-    rc_t ( CC * read ) ( KURL_FETCHER_IMPL *self, const char * uri,
-                      void *dst, size_t to_read, size_t *num_read );
-    rc_t ( CC * get_size ) ( KURL_FETCHER_IMPL *self, size_t *num_size );
-    /* end minor version == 0 */
-};
-
-union KUrlFetcher_vt
-{
-    KUrlFetcher_vt_v1 v1;
-};
-
-/* Init
- */
-KNS_EXTERN rc_t CC KUrlFetcherInit ( KUrlFetcher *self, const KUrlFetcher_vt *vt );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/libs/kns/url-fetcher.c b/libs/kns/url-fetcher.c
deleted file mode 100644
index ff9e16b..0000000
--- a/libs/kns/url-fetcher.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kns/extern.h>
-#include <klib/rc.h>
-#include <klib/text.h>
-#include "url-fetcher-impl.h"
-#include <sysalloc.h>
-
-#include <stdlib.h>
-
-/* to define the latest version of the url-fetcher in the vt */
-#define KURLFETCHER_LATEST 1
-
-static const char classname[] = "KUrlFetcher";
-
-/* AddRef
- *  creates a new reference
- *  ignores NULL references
- */
-LIB_EXPORT rc_t CC KUrlFetcherAddRef ( const KUrlFetcher *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, classname ) )
-        {
-        case krefLimit:
-            return RC ( rcApp, rcFunction, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-/* Release
- *  discard reference to list
- *  ignores NULL references
- */
-LIB_EXPORT rc_t CC KUrlFetcherRelease ( const KUrlFetcher *cself )
-{
-    KUrlFetcher *self = ( KUrlFetcher* ) cself;
-    if ( cself != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, classname ) )
-        {
-        case krefWhack:
-            {
-                rc_t rc;
-                switch ( self -> vt -> v1 . maj )
-                {
-                case 1:
-                    rc = ( * self -> vt -> v1 . destroy ) ( self );
-                    break;
-
-                default:
-                    rc = RC ( rcApp, rcFunction, rcReleasing, rcInterface, rcBadVersion );
-                }
-
-                if ( rc != 0 )
-                    KRefcountInit ( & self -> refcount, 1, classname, "failed-release", "orphan" );
-                return rc;
-            }
-        case krefLimit:
-            return RC ( rcApp, rcFunction, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/* Read
- *  reads data from the internal buffer ...
- */
-LIB_EXPORT rc_t CC KUrlFetcherRead( KUrlFetcher *self, const char * uri,
-                      void *dst, size_t to_read, size_t *num_read )
-{
-    if ( self == NULL )
-        return RC ( rcApp, rcFunction, rcAccessing, rcSelf, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . read ) ( self, uri, dst, to_read, num_read );
-    }
-
-    return RC ( rcApp, rcFunction, rcAccessing, rcInterface, rcBadVersion );
-}
-
-
-/* Init
- *  polymorphic parent constructor
- */
-LIB_EXPORT rc_t CC KUrlFetcherInit ( KUrlFetcher *self, const KUrlFetcher_vt *vt )
-{
-    if ( self == NULL || vt == NULL )
-        return RC ( rcApp, rcFunction, rcConstructing, rcSelf, rcNull );
-
-    if ( vt -> v1 . maj == 0 )
-        return RC ( rcApp, rcFunction, rcConstructing, rcInterface, rcInvalid );
-
-    if ( vt -> v1 . maj > KURLFETCHER_LATEST )
-        return RC ( rcApp, rcFunction, rcConstructing, rcInterface, rcBadVersion );
-
-    self -> vt = vt;
-    KRefcountInit ( & self -> refcount, 1, classname, "initialized", "regular" );
-    return 0;
-}
diff --git a/libs/kns/win/sysendpoint.c b/libs/kns/win/sysendpoint.c
deleted file mode 100644
index e7c3374..0000000
--- a/libs/kns/win/sysendpoint.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kns/impl.h>
-#include <kns/endpoint.h>
-#include <klib/text.h>
-#include <klib/printf.h>
-#include <klib/rc.h>
-#include <klib/data-buffer.h>
-
-#include <sysalloc.h>
-
-#include "stream-priv.h"
-
-#include <assert.h>
-
-#include <Windows.H>
-
-/* InitDNSEndpoint
- *  initialize the endpoint with a DNS name and a port number
- *
- *  "ep" [ OUT ] - address of endpoint block to be intialized
- *
- *  "dns" [ IN ] - textual DNS address.
- *
- *  "port" [ IN, DEFAULT 0 ] - binary port number in native integer byte order.
- *   if the special port number 0 is given, it represents any available port.
- */
-LIB_EXPORT
-rc_t CC KNSManagerInitDNSEndpoint ( struct KNSManager const *self,
-    KEndPoint *ep, struct String const *dns, uint16_t port )
-{
-    rc_t rc = 0;
-
-    if ( ep == NULL )
-        rc = RC (rcNS, rcNoTarg, rcInitializing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcNS, rcNoTarg, rcInitializing, rcSelf, rcNull );
-        else if ( dns == NULL )
-            rc = RC ( rcNS, rcNoTarg, rcInitializing, rcParam, rcNull );
-        else if ( dns -> size == 0 )
-            rc = RC ( rcNS, rcNoTarg, rcInitializing, rcSelf, rcInsufficient );
-        else
-        {
-            KDataBuffer b;
-            char buffer [ 4096 ], * hostname = buffer;
-            size_t buff_size = sizeof buffer;
-
-            if ( dns -> size >= sizeof buffer )
-            {
-                rc = KDataBufferMakeBytes ( & b, dns -> size + 1 );
-                if ( rc == 0 )
-                {
-                    hostname = b . base;
-                    buff_size = ( size_t ) b . elem_count;
-                }
-            }
-
-            if ( rc == 0 )
-            {
-                size_t size;
-                rc = string_printf ( hostname, buff_size, & size, "%S", dns );
-
-                assert ( rc == 0 );
-                assert ( size < buff_size );
-                assert ( hostname [ size ] == 0 );
-
-                if ( rc ==  0 )
-                {
-                    int lerrno;
-                    struct hostent *remote = gethostbyname ( hostname );
-                    if ( remote != NULL )
-                    { 
-                        ep -> type = epIPV4;
-                        memcpy ( & ep -> u . ipv4 . addr, remote -> h_addr_list [ 0 ], sizeof ep -> u . ipv4 . addr );
-                        ep -> u . ipv4 . addr = htonl ( ep -> u . ipv4 . addr );
-                        ep -> u . ipv4 . port = ( uint16_t ) port;
-                    }
-                    else switch ( lerrno = WSAGetLastError () )
-                    {
-                    case WSANOTINITIALISED: /* Must have WSAStartup call */
-                        rc = RC ( rcNS, rcNoTarg, rcInitializing, rcEnvironment, rcUndefined );
-                        break;
-                    case WSAENETDOWN:/* network subsystem failed */
-                        rc = RC ( rcNS, rcNoTarg, rcInitializing, rcNoObj, rcFailed );
-                        break;
-                    case WSAHOST_NOT_FOUND: /* Answer host not found */
-                        rc = RC ( rcNS, rcNoTarg, rcValidating, rcConnection, rcNotFound );
-                        break;
-                    case WSATRY_AGAIN: /* host not found or server failure */
-                        rc = RC ( rcNS, rcNoTarg, rcValidating, rcConnection, rcBusy );
-                        break;
-                    case WSANO_RECOVERY: /* non-recoverable error */
-                        rc = RC ( rcNS, rcNoTarg, rcValidating, rcConnection, rcError );
-                        break;
-                    case WSANO_DATA: /* name is valid but no data */
-                        rc = RC ( rcNS, rcNoTarg, rcValidating, rcConnection, rcEmpty );
-                        break;
-                    case WSAEINPROGRESS: /* call is in progress */
-                        rc = RC ( rcNS, rcNoTarg, rcReading, rcId, rcUndefined );
-                        break;
-                    case WSAEFAULT: /* name paremeter is not valid part of addr space */
-                        rc = RC ( rcNS, rcNoTarg, rcReading, rcMemory, rcOutofrange );
-                        break;
-                    case WSAEINTR: /* socket call was calanceled */
-                        rc = RC ( rcNS, rcNoTarg, rcReading, rcConnection, rcCanceled );
-                        break;
-                    default:
-                        rc = RC ( rcNS, rcNoTarg, rcReading, rcNoObj, rcError );
-                    }
-                }
-            }
-
-            if ( hostname != buffer )
-                KDataBufferWhack ( & b );
-        }
-
-        if ( rc != 0 )
-            memset ( ep, 0, sizeof * ep );        
-    }
-
-    return rc;
-}
diff --git a/libs/kns/win/sysmgr.c b/libs/kns/win/sysmgr.c
deleted file mode 100644
index 67c59a4..0000000
--- a/libs/kns/win/sysmgr.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <klib/rc.h>
-#include <atomic32.h>
-
-#include "sysmgr.h"
-
-#include <WINDOWS.H>
-
-static atomic32_t mgr_count;
-
-rc_t KNSManagerInit ( void )
-{
-    if ( atomic32_test_and_inc ( & mgr_count ) )
-    {
-        WSADATA wsaData;
-        if ( WSAStartup ( MAKEWORD ( 2, 2 ), & wsaData ) != 0 )
-        {
-            int lerrno = WSAGetLastError ();
-            switch ( lerrno )
-            {
-            case WSASYSNOTREADY:
-            case WSAVERNOTSUPPORTED:
-            case WSAEINPROGRESS:
-            case WSAEPROCLIM:
-            case WSAEFAULT:
-            default:
-                atomic32_dec ( & mgr_count );
-                return RC ( rcNS, rcMgr, rcInitializing, rcLibrary, rcNotAvailable );
-            }
-        }
-    }
-
-    return 0;
-} 
-
-void KNSManagerCleanup ( void )
-{
-    if ( atomic32_dec_and_test ( & mgr_count ) )
-        WSACleanup ();
-}
diff --git a/libs/kns/win/syssock.c b/libs/kns/win/syssock.c
deleted file mode 100644
index d5ea566..0000000
--- a/libs/kns/win/syssock.c
+++ /dev/null
@@ -1,1296 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-#define KSTREAM_IMPL KSocket
-typedef struct KSocket KSocket;
-
-#include <kns/extern.h>
-#include <kns/manager.h>
-#include <kns/socket.h>
-#include <kns/impl.h>
-#include <kns/endpoint.h>
-#include <klib/rc.h>
-#include <klib/log.h>
-#include <klib/printf.h>
-#include <klib/text.h>
-#include <sysalloc.h>
-#include <kproc/timeout.h>
-
-#include "../stream-priv.h"
-
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-#include <os-native.h>
-
-#include <WINDOWS.H>
-
-#define LOG
-
-#define SHUT_RD 0
-#define SHUT_WR 1
-typedef SSIZE_T ssize_t;
-
-static rc_t HandleErrnoEx ( const char *func, unsigned int lineno );
-#define HandleErrno() HandleErrnoEx ( __func__, __LINE__ )
-
-/*--------------------------------------------------------------------------
- * KSocket
- *  a socket IS a stream
- *
- *  in Berkeley socket terminology, a STREAM implies a CONTINUOUS stream,
- *  which is implemented by the TCP connection. A "chunked" or discontiguous
- *  stream would be a datagram stream, implemented usually by UDP.
- *
- *  in VDB terminology, a STREAM is a fluid, moving target that is observed
- *  from a stationary point, whereas a FILE or OBJECT is a static stationary
- *  target observed from a movable window. This means that a STREAM cannot be
- *  addressed randomly, whereas a FILE or OBJECT can.
- */
- 
- /*
-  * On Windows, we have 2 different mechanisms to implement KSockets, 
-  * WinSock based for Ipv4 connections and named pipes based for IPC
-  */
-  
-struct KSocket
-{   /* the "base type" for KIpv4Socket and PKIPCSocket */
-    KStream dad;
-
-    int32_t read_timeout;
-    int32_t write_timeout;
-};
-
-LIB_EXPORT rc_t CC KSocketAddRef( struct KSocket *self )
-{   /* this will handle all derived types */
-    return KStreamAddRef(&self->dad);
-}
-
-LIB_EXPORT rc_t CC KSocketRelease( struct KSocket *self )
-{   /* this will handle all derived types */
-    return KStreamRelease(&self->dad);
-}
-
-/*
-    KIpv4Socket
-*/
-struct KIpv4Socket
-{
-    KSocket dad;
-    SOCKET fd;
-};
-typedef struct KIpv4Socket KIpv4Socket;
-
-static
-rc_t CC KIpv4SocketWhack ( KSocket *base )
-{
-    KIpv4Socket* self = (KIpv4Socket*)base;
-    rc_t rc = 0;
-    
-    assert ( self != NULL );
-
-    if (shutdown ( self -> fd, SHUT_WR ) != -1)
-    {
-        while ( 1 ) 
-        {
-            char buffer [ 1024 ];
-            ssize_t result = recv ( self -> fd, buffer, sizeof buffer, 0 );
-            if ( result <= 0 )
-                break;
-        }
-        if (shutdown ( self -> fd, SHUT_RD ) != -1)
-        {
-            if ( closesocket ( self -> fd ) == SOCKET_ERROR )
-                rc = RC ( rcNS, rcNoTarg, rcClosing, rcNoObj, rcError );
-                /* maybe report */
-        }
-        else
-            rc = HandleErrno();
-    }
-    else
-        rc = HandleErrno();
-    
-    free ( self );
-
-    return rc;
-}
-
-static
-rc_t CC KIpv4SocketTimedRead ( const KSocket *base,
-    void *buffer, size_t bsize, size_t *num_read, timeout_t *tm )
-{
-    rc_t rc = 0;
-
-    struct timeval ts;
-    fd_set readFds;
-    int selectRes;
-    
-    KIpv4Socket* self = (KIpv4Socket*)base;
-    assert ( self != NULL );
-    
-    /* convert timeout (relative time) */
-    if (tm != NULL)
-    {
-        ts.tv_sec = tm -> mS / 1000;
-        ts.tv_usec = (tm -> mS % 1000) * 1000;
-    }
-    
-    /* wait for socket to become readable */
-    FD_ZERO(&readFds);
-    FD_SET(self -> fd, &readFds);
-    selectRes = select(0, &readFds, NULL, NULL, tm == NULL ? NULL : &ts);
-    
-    /* check for error */
-    if (selectRes == -1)
-    {
-        rc = HandleErrno();
-    }
-    else if (selectRes == 0)
-    {   /* timeout */
-        rc = RC ( rcNS, rcStream, rcWriting, rcTimeout, rcExhausted );
-    }
-    else if (FD_ISSET(self -> fd, &readFds))
-    {
-        while ( rc == 0 )
-        {
-            ssize_t count = recv ( self -> fd, buffer, (int)bsize, 0 );
-
-            if ( count >= 0 )
-            {
-                assert ( num_read != NULL );
-                * num_read = ( size_t ) count;
-                return 0;
-            }
-            if (WSAGetLastError() != WSAEINTR)
-                rc = HandleErrno();
-            break;
-        }
-    }
-    else
-    {
-        rc = HandleErrno();
-    }
-            
-    return rc;
-}
-
-static
-rc_t CC KIpv4SocketRead ( const KSocket *self,
-    void *buffer, size_t bsize, size_t *num_read )
-{
-    timeout_t tm;
-    assert ( self != NULL );
-
-    if ( self -> read_timeout < 0 )
-        return KIpv4SocketTimedRead ( self, buffer, bsize, num_read, NULL );
-
-    TimeoutInit ( & tm, self -> read_timeout );
-    return KIpv4SocketTimedRead ( self, buffer, bsize, num_read, & tm );
-}
-
-static
-rc_t CC KIpv4SocketTimedWrite ( KSocket *base,
-    const void *buffer, size_t bsize, size_t *num_writ, timeout_t *tm )
-{
-    rc_t rc = 0;
-    
-    struct timeval ts;
-    fd_set writeFds;
-    int selectRes;
-    
-    KIpv4Socket* self = (KIpv4Socket*)base;
-    assert ( self != NULL );
-    
-    /* convert timeout (relative time) */
-    if (tm != NULL)
-    {
-        ts.tv_sec = tm -> mS / 1000;
-        ts.tv_usec = (tm -> mS % 1000) * 1000;
-    }
-    
-    /* wait for socket to become writable */
-    FD_ZERO(&writeFds);
-    FD_SET(self -> fd, &writeFds);
-    selectRes = select(0, NULL, &writeFds, NULL, tm == NULL ? NULL : &ts);
-    
-    /* check for error */
-    if (selectRes == -1)
-    {
-        rc = HandleErrno();
-    }
-    else if (selectRes == 0)
-    {   /* timeout */
-        rc = RC ( rcNS, rcStream, rcWriting, rcTimeout, rcExhausted );
-    }
-    else if (FD_ISSET(self -> fd, &writeFds))
-    {
-        while ( rc == 0 )
-        {
-            ssize_t count = send ( self -> fd , buffer, (int)bsize, 0 );
-            if ( count >= 0 )
-            {
-                assert ( num_writ != NULL );
-                * num_writ = count;
-                return 0;
-            }
-            if (WSAGetLastError() != WSAEINTR)
-                rc = HandleErrno();
-
-            break;        
-        }
-    }
-    else
-    {
-        rc = HandleErrno();
-    }
-
-    return rc;
-}
-
-static
-rc_t CC KIpv4SocketWrite ( KSocket *self,
-    const void *buffer, size_t bsize, size_t *num_writ )
-{
-    timeout_t tm;
-    assert ( self != NULL );
-
-    if ( self -> write_timeout < 0 )
-        return KIpv4SocketTimedWrite ( self, buffer, bsize, num_writ, NULL );
-
-    TimeoutInit ( & tm, self -> write_timeout );
-    return KIpv4SocketTimedWrite ( self, buffer, bsize, num_writ, & tm );
-}
-
-static KStream_vt_v1 vtKIpv4Socket =
-{
-    1, 1,
-    KIpv4SocketWhack,
-    KIpv4SocketRead,
-    KIpv4SocketWrite,
-    KIpv4SocketTimedRead,
-    KIpv4SocketTimedWrite
-};
-
-static
-rc_t KNSManagerMakeIPv4Connection ( struct KNSManager const *self, 
-                                    KStream **out, 
-                                    const KEndPoint *from, 
-                                    const KEndPoint *to,
-                                    int32_t retryTimeout, 
-                                    int32_t readMillis, 
-                                    int32_t writeMillis )
-{
-    rc_t rc = 0;
-    uint32_t retry_count = 0;
-    SOCKET fd;
-
-    assert ( self != NULL );
-    assert ( out != NULL );
-
-    * out = NULL;
-
-    assert ( to != NULL );
-    assert ( to -> type == epIPV4 );
-    assert ( ( from == NULL || from -> type == to -> type ) );
-
-    do
-    {
-        fd = socket ( AF_INET, SOCK_STREAM, IPPROTO_TCP );
-        if ( fd == INVALID_SOCKET )
-            rc = HandleErrno();
-        else
-        {
-            struct sockaddr_in ss;
-            memset ( & ss, 0, sizeof ss );
-            ss . sin_family = AF_INET;
-            if ( from != NULL )
-            {
-                ss . sin_port = htons ( from -> u. ipv4 . port );
-                ss . sin_addr . s_addr = htonl ( from -> u . ipv4 . addr );
-            }
-            if ( bind ( fd, (const struct sockaddr*)&ss, sizeof ss  ) == SOCKET_ERROR ) 
-                rc = HandleErrno();
-                
-            if (rc == 0)
-            {
-                ss . sin_port = htons ( to -> u . ipv4 . port );
-                ss . sin_addr . s_addr = htonl ( to -> u . ipv4 . addr );
-                
-                if ( connect ( fd, (const struct sockaddr*)&ss, sizeof ss ) != SOCKET_ERROR )
-                {   /* create the KSocket */
-                    KIpv4Socket *ksock = calloc ( sizeof *ksock, 1 );
-                    if ( ksock == NULL )
-                        rc = RC ( rcNS, rcNoTarg, rcAllocating, rcNoObj, rcNull ); 
-                    else
-                    {   /* initialize the KSocket */
-                        rc = KStreamInit ( & ksock -> dad . dad, ( const KStream_vt* ) & vtKIpv4Socket,
-                                           "KSocket", "tcp", true, true );
-                        if ( rc == 0 )
-                        {
-                            ksock -> dad . read_timeout  = readMillis;
-                            ksock -> dad . write_timeout = writeMillis;
-                            ksock -> fd = fd;
-                            *out = & ksock -> dad . dad;
-                            return 0;
-                        }
-                        free(ksock);
-                    }
-                    /* we connected but then then ran out of memory or something bad like that, so no need to retry 
-                       - simply close fd and return RC */
-                    closesocket(fd);
-                    return rc;
-                }
-                else /* connect () failed */
-                    rc = HandleErrno();
-            } 
-            
-            /* dump socket */
-            closesocket(fd);
-        }
-        
-        /* rc != 0 */
-        if (retryTimeout < 0 || (int32_t)retry_count < retryTimeout)
-        {   /* retry */
-            Sleep ( 1000 ); /*ms*/
-            ++retry_count;
-            rc = 0;
-        }            
-    }
-    while (rc == 0);
-    
-    return rc;
-}
-
-static rc_t KNSManagerMakeIPv4Listener ( const KNSManager *self, KSocket **out, const KEndPoint * ep )
-{   /* this is for server side which we do not support for IPv4 */
-    * out = NULL;
-    return RC ( rcNS, rcNoTarg, rcValidating, rcFunction, rcUnsupported);
-}
-
-/*
- *  KIPCSocket
- */
-enum { isIpcListener, isIpcPipeServer, isIpcPipeClient };
- 
-struct KIPCSocket
-{
-    KSocket dad;
-
-    HANDLE pipe;
-    wchar_t pipename [ 256 ];
-
-    uint8_t type;
-    HANDLE listenerPipe; /* only used iftype == isIpcListener */ 
-};
-typedef struct KIPCSocket KIPCSocket;
-
-static
-rc_t CC KIPCSocketWhack ( KSocket *base )
-{
-    rc_t rc = 0;
-
-    KIPCSocket* self = (KIPCSocket*)base;
-    assert ( self != NULL );
-    pLogLibMsg(klogInfo, "$(b): KIPCSocketWhack()...", "b=%p", base); 
-
-    switch (self->type)
-    {
-    case isIpcListener: /* an unconnected server-side pipe */
-        pLogLibMsg(klogInfo, "$(b): isIpcListener", "b=%p", base);    
-        if (self->listenerPipe != INVALID_HANDLE_VALUE)
-        {   /* !!! In case there is an active call to ConnectNamedPipe() on some thread, "wake" the synchronous named pipe,
-            otherwise DisconnectNamedPipe/CloseHandle will block forever */
-            HANDLE hPipe = CreateFileW(self->pipename, 
-                                       GENERIC_READ, 
-                                       FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, 
-                                       NULL, 
-                                       OPEN_EXISTING, 
-                                       0, 
-                                       NULL);
-            if (hPipe != INVALID_HANDLE_VALUE)
-                CloseHandle(hPipe);
-
-            /* now, Disconnect/Close the original pipe */
-            if (!DisconnectNamedPipe(self->listenerPipe) && rc == 0)
-            {
-                rc = HandleErrno();
-                pLogLibMsg(klogInfo, "$(b): DisconnectNamedPipe failed", "b=%p", base);    
-            }
-            
-            if (!CloseHandle(self->listenerPipe) && rc == 0)
-            {
-                rc = HandleErrno();
-                pLogLibMsg(klogInfo, "$(b): CloseHandle failed", "b=%p", base);    
-            }
-        }
-        break;
-    case isIpcPipeServer:
-        pLogLibMsg(klogInfo, "$(b): isIpcPipeServer", "b=%p", base);  
-        if (!FlushFileBuffers(self->pipe))
-        {
-            if (GetLastError() != ERROR_BROKEN_PIPE)
-            {
-                rc = HandleErrno();
-                pLogLibMsg(klogInfo, "$(b): FlushFileBuffers failed, err=$(e)", "b=%p,e=%d", base, GetLastError());    
-            }
-        }
-        if (!DisconnectNamedPipe(self->pipe) && rc == 0)
-        {
-            rc = HandleErrno();
-            pLogLibMsg(klogInfo, "$(b): DisconnectNamedPipe failed", "b=%p", base);    
-        }
-        if (!CloseHandle(self->pipe) && rc == 0)
-        {
-            rc = HandleErrno();
-            pLogLibMsg(klogInfo, "$(b): CloseHandle failed", "b=%p", base);    
-        }
-        break;
-    case isIpcPipeClient:
-        pLogLibMsg(klogInfo, "$(b): isIpcPipeClient", "b=%p", base);  
-        if (!CloseHandle(self->pipe))
-        {
-            rc = HandleErrno();
-            pLogLibMsg(klogInfo, "$(b): CloseHandle failed", "b=%p", base);    
-        }
-        break;
-    }
-    
-    free ( self );
-
-    return rc;
-}
-
-static
-rc_t
-WaitForData(const KIPCSocket* base, void* buffer, size_t bsize, size_t* num_read, uint32_t* tmMs, OVERLAPPED* overlap)
-{   /* received a ERROR_NO_DATA trying to read from a pipe; wait for the data to arrive or a time out to expire */ 
-    /* on success, will leave tmMs set to the remaining portion of timeout, if specified */
-    uint32_t tm_decrement = 100; 
-    pLogLibMsg(klogInfo, "$(b): no data on the pipe - going into a wait loop, tm=$(t)", "b=%p,t=%d", base, tmMs == 0 ? -1 : *tmMs);   
-    while (true)
-    {
-        rc_t rc = 0;
-        BOOL ret;
-        DWORD count;
-    
-        if (tmMs != NULL)
-        {
-            if (*tmMs <= tm_decrement)
-            {
-                CloseHandle(overlap->hEvent);
-                return RC ( rcNS, rcFile, rcReading, rcTimeout, rcExhausted );
-            }
-            *tmMs -= tm_decrement;
-        }
-        ret = ReadFile( base->pipe, buffer, (DWORD)bsize, &count, overlap ); /* *usually* returns FALSE in asynch mode */
-        if (ret)
-        {
-            pLogLibMsg(klogInfo, "$(b): (wait loop) ReadFile completed synchronously, count=$(c)", "b=%p,c=%d", base, count);            
-            assert ( num_read != NULL );
-            * num_read = ( size_t ) count;
-            CloseHandle(overlap->hEvent);
-            return 0;
-        }
-        
-        switch (GetLastError())
-        {
-        case ERROR_IO_PENDING:
-            return 0; /* the caller will wait for completion */
-            
-        case ERROR_NO_DATA:
-            pLogLibMsg(klogInfo, "$(b): (wait loop) Sleep($(t))", "b=%p,t=%d", base, tm_decrement);            
-            Sleep(tm_decrement);
-            break;
-            
-        case ERROR_SUCCESS: /* not expected in asynch mode */
-            return RC ( rcNS, rcFile, rcReading, rcError, rcUnexpected);
-            
-        default:
-            return HandleErrno();
-        }
-    }
-    return 0;
-}
-
-static
-rc_t CC KIPCSocketTimedRead ( const KSocket *base,
-    void *buffer, size_t bsize, size_t *num_read, timeout_t *tm )
-{
-    rc_t rc = 0;
-    OVERLAPPED overlap;
-    
-    KIPCSocket* self = (KIPCSocket*)base;
-    assert ( self != NULL );
-    assert ( num_read != NULL );
-
-    pLogLibMsg(klogInfo, "$(b): KIPCSocketTimedRead($(t), $(buf), $(s))... ", "b=%p,t=%d,buf=%p,s=%d", base, tm == NULL ? -1 : tm -> mS, buffer, bsize);           
-
-    /*TODO: wait for pipe to become readable? */
-    memset(&overlap, 0, sizeof(overlap));
-    overlap.hEvent = CreateEvent( 
-                              NULL,     /* default security attribute */
-                              TRUE,     /* manual reset event */
-                              FALSE,    /* initial state = nonsignalled */
-                              NULL); 
-    if (overlap.hEvent != NULL)
-    {
-        DWORD count;
-        BOOL ret = ReadFile( self->pipe, buffer, (DWORD)bsize, &count, &overlap ); /* *usually* returns FALSE in asynch mode */
-        if (ret) /* done: must be synch mode */
-        {
-            pLogLibMsg(klogInfo, "$(b): ReadFile completed synchronously, count=$(c)", "b=%p,c=%d", base, count);            
-            * num_read = ( size_t ) count;
-            CloseHandle(overlap.hEvent);
-            return 0;
-        }
-        
-        *num_read = 0;
-        /* asynch mode - wait for the operation to complete */
-        if (GetLastError() == ERROR_NO_DATA) /* 232 */
-        {
-            pLogLibMsg(klogInfo, "$(b): ReadFile($(h)) returned FALSE, GetLastError() = ERROR_NO_DATA", "b=%p,h=%x", base, self->pipe);            
-            rc = WaitForData(self, buffer, bsize, num_read, tm == NULL ? NULL : &tm -> mS, &overlap);
-            if (*num_read != 0) /* read completed*/
-            {
-                CloseHandle(overlap.hEvent);
-                return 0;
-            }
-            if (rc != 0)
-            {
-                CloseHandle(overlap.hEvent);
-                return rc;
-            }
-        }   
-
-        if (GetLastError() == ERROR_IO_PENDING) /* 997 */
-        {
-            pLogLibMsg(klogInfo, "$(b): ReadFile($(h)) returned FALSE, GetLastError() = ERROR_IO_PENDING", "b=%p,h=%x", base, self->pipe);            
-            if (tm == NULL)
-                pLogLibMsg(klogInfo, "$(b): waiting forever", "b=%p", base);            
-            else
-                pLogLibMsg(klogInfo, "$(b): waiting for $(t) ms", "b=%p,t=%d", base, tm -> mS);            
-                
-            switch (WaitForSingleObject(overlap.hEvent, tm == NULL ? INFINITE : tm -> mS ))
-            {
-                case WAIT_TIMEOUT:
-                    pLogLibMsg(klogInfo, "$(b): timed out", "b=%p", base);            
-                    rc = RC ( rcNS, rcFile, rcReading, rcTimeout, rcExhausted );
-                    break;
-                    
-                case WAIT_OBJECT_0:
-                {
-                    DWORD count;
-                    pLogLibMsg(klogInfo, "$(b): successful", "b=%p", base);   
-                    if (GetOverlappedResult(self->pipe, &overlap, &count, TRUE)) /* wait to complete if necessary */
-                    {
-                        pLogLibMsg(klogInfo, "$(b): $(c) bytes read", "b=%p,c=%d", base, count);   
-                        * num_read = ( size_t ) count;
-                        rc = 0;
-                    }
-                    else
-                    {
-                        rc = HandleErrno();
-                        pLogLibMsg(klogInfo, "$(b): GetOverlappedResult() failed", "b=%p", base);         
-                    }
-                    break;
-                }
-                
-                default:
-                    rc = HandleErrno();
-                    pLogLibMsg(klogInfo, "$(b): WaitForSingleObject() failed", "b=%p", base);         
-                    break;
-            }
-        }
-        else if (GetLastError() == ERROR_SUCCESS)
-        {
-            pLogLibMsg(klogInfo, "$(b): ReadFile($(h)) returned FALSE, GetLastError() = ERROR_SUCCESS", "b=%p,h=%x", base, self->pipe);  
-            rc = RC ( rcNS, rcFile, rcReading, rcError, rcUnexpected);
-        }
-        else
-        {
-            rc = HandleErrno();
-        }
-        CloseHandle(overlap.hEvent);
-    }
-    else
-        rc = HandleErrno();
-    
-    return rc;
-}
-
-static
-rc_t CC KIPCSocketRead ( const KSocket *self,
-    void *buffer, size_t bsize, size_t *num_read )
-{
-    timeout_t tm;
-    assert ( self != NULL );
-
-    if ( self -> read_timeout < 0 )
-        return KIPCSocketTimedRead ( self, buffer, bsize, num_read, NULL );
-
-    TimeoutInit ( & tm, self -> read_timeout );
-    return KIPCSocketTimedRead ( self, buffer, bsize, num_read, & tm );
-}
-
-static
-rc_t CC KIPCSocketTimedWrite ( KSocket *base,
-    const void *buffer, size_t bsize, size_t *num_writ, timeout_t *tm )
-{
-    rc_t rc = 0;
-    OVERLAPPED overlap;
-
-    KIPCSocket* self = (KIPCSocket*)base;
-    assert ( self != NULL );
-    
-    pLogLibMsg(klogInfo, "$(b): KIPCSocketTimedWrite($(s), $(t))...", "b=%p,s=%d,t=%d", base, bsize, tm == NULL ? -1 : tm -> mS);
-
-    memset(&overlap, 0, sizeof(overlap));
-    overlap.hEvent = CreateEvent( 
-                              NULL,     /* default security attribute */
-                              TRUE,     /* manual reset event */
-                              FALSE,    /* initial state = nonsignalled */
-                              NULL); 
-    if (overlap.hEvent != NULL)
-    {
-        DWORD count;
-        BOOL ret = WriteFile( self->pipe, buffer, (DWORD)bsize, &count, &overlap ); /* returns FALSE in asynch mode */
-        int err = GetLastError();
-        /*pLogLibMsg(klogInfo, "$(b): WriteFile returned $(r), GetError() = $(e)", "b=%p,r=%s,e=%d", base, ret ? "TRUE" : "FALSE", err);            */
-        if (ret) /* completed synchronously; either message is so short that is went out immediately, or the pipe is full */
-        {   
-            if (count > 0)
-            {
-                pLogLibMsg(klogInfo, "$(b): $(c) bytes written", "b=%p,c=%d", base, count);   
-                assert ( num_writ != NULL );
-                * num_writ = ( size_t ) count;
-                CloseHandle(overlap.hEvent);
-                return 0;
-            }
-            else 
-            {   /* pipe is full - go into a wait loop */
-                uint32_t tm_left = tm == NULL ? 0 : tm -> mS;
-                uint32_t tm_decrement = 100; 
-                pLogLibMsg(klogInfo, "$(b): pipe full - going into a wait loop for $(t) ms", "b=%p,t=%d", base, tm == NULL ? -1 : tm->mS);   
-                while (count == 0)
-                {
-                    if (tm != NULL)
-                    {
-                        if (tm_left <= tm_decrement)
-                        {
-                            CloseHandle(overlap.hEvent);
-                            return RC ( rcNS, rcFile, rcWriting, rcTimeout, rcExhausted );
-                        }
-                        tm_left -= tm_decrement;
-                    }
-                    
-                    Sleep(1);/*ms*/
-                    
-                    pLogLibMsg(klogInfo, "$(b): write wait loop: attempting to WriteFile", "b=%p", base);   
-                    ret = WriteFile( self->pipe, buffer, (DWORD)bsize, &count, &overlap ); /* returns FALSE in asynch mode */
-                    err = GetLastError();
-                    /*pLogLibMsg(klogInfo, "$(b): WriteFile returned $(r), GetError() = $(e)", "b=%p,r=%s,e=%d", base, ret ? "TRUE" : "FALSE", err);            */
-                    if (!ret)
-                        break; /* and proceed to handling the asynch mode*/
-                }
-            }
-        }
-        
-        /* asynch mode - wait for the operation to complete */
-        switch (err) /* set by the last call to WriteFile */
-        {
-        case NO_ERROR:
-        case ERROR_IO_PENDING:
-        {
-            switch (WaitForSingleObject(overlap.hEvent, tm == NULL ? INFINITE : tm -> mS ))
-            {
-            case WAIT_TIMEOUT:
-                pLogLibMsg(klogInfo, "$(b): timed out ", "b=%p", base);
-                CloseHandle(overlap.hEvent);
-                return RC ( rcNS, rcStream, rcWriting, rcTimeout, rcExhausted );
-
-            case WAIT_OBJECT_0:
-            {
-                pLogLibMsg(klogInfo, "$(b): successful", "b=%p", base);   
-                if (GetOverlappedResult(self->pipe, &overlap, &count, TRUE)) /* wait to complete if necessary */
-                {
-                    pLogLibMsg(klogInfo, "$(b): $(c) bytes written", "b=%p,c=%d", base, count);   
-                    assert ( num_writ != NULL );
-                    * num_writ = count;
-                    CloseHandle(overlap.hEvent);
-                    return 0;
-                }
-                rc = HandleErrno();
-                pLogLibMsg(klogInfo, "$(b): GetOverlappedResult() failed", "b=%p", base);         
-                break;
-            }
-            
-            default:
-                rc = HandleErrno();
-                pLogLibMsg(klogInfo, "$(b): WaitForSingleObject() failed", "b=%p", base);         
-                break;
-            }
-        }
-        case ERROR_NO_DATA:
-            /* the secret MS lore says when WriteFile to a pipe returns ERROR_NO_DATA, it's 
-                "Pipe was closed (normal exit path)." - see http://support.microsoft.com/kb/190351 */
-            CloseHandle(overlap.hEvent);
-            return 0;
-
-        default:
-            rc = HandleErrno();
-            pLogLibMsg(klogInfo, "$(b): WriteFile() failed", "b=%p", base);            
-            break;
-        }
-
-        CloseHandle(overlap.hEvent);
-    }
-    else
-        rc = HandleErrno();
-        
-    return rc;
-}
-
-static
-rc_t CC KIPCSocketWrite ( KSocket *self,
-    const void *buffer, size_t bsize, size_t *num_writ )
-{
-    timeout_t tm;
-    assert ( self != NULL );
-
-    if ( self -> write_timeout < 0 )
-        return KIPCSocketTimedWrite ( self, buffer, bsize, num_writ, NULL );
-
-    TimeoutInit ( & tm, self -> write_timeout );
-    return KIPCSocketTimedWrite ( self, buffer, bsize, num_writ, & tm );
-}
-
-static KStream_vt_v1 vtKIPCSocket =
-{
-    1, 1,
-    KIPCSocketWhack,
-    KIPCSocketRead,
-    KIPCSocketWrite,
-    KIPCSocketTimedRead,
-    KIPCSocketTimedWrite
-};
-
-static
-rc_t KNSManagerMakeIPCConnection ( struct KNSManager const *self, 
-                                   KStream **out, 
-                                   const KEndPoint *to, 
-                                   int32_t retryTimeout, 
-                                   int32_t readMillis, 
-                                   int32_t writeMillis)
-{
-    uint8_t retry_count = 0;
-    rc_t rc = 0;
-    char pipename[256];
-    wchar_t pipenameW[256];
-    size_t num_writ;
-    
-    assert ( self != NULL );
-    assert ( out != NULL );
-
-    * out = NULL;
-
-    assert ( to != NULL );
-    assert ( to->type == epIPC );
-
-    /* use named pipes to implement unix domain socket - like behavior */
-    rc = string_printf(pipename, sizeof(pipename), &num_writ, "\\\\.\\pipe\\%s", to->u.ipc_name);
-    if (rc == 0)
-        string_cvt_wchar_copy(pipenameW, sizeof(pipenameW), pipename, num_writ);
-        
-    while (rc == 0)
-    {
-        HANDLE h = CreateFileW(pipenameW,       /* pipe name */
-                               GENERIC_READ |  /* read and write access */
-                                 GENERIC_WRITE, 
-                               0,              /* no sharing */
-                               NULL,           /* default security attributes */
-                               OPEN_EXISTING,  /* opens existing pipe  */
-                               FILE_FLAG_OVERLAPPED,  /* using overlapped IO */
-                               NULL);          /* no template file */
-        if ( h != INVALID_HANDLE_VALUE )
-        {   /* create the KSocket */
-            DWORD dwMode = PIPE_READMODE_MESSAGE | PIPE_NOWAIT; /* need NOWAIT if pipe is created in asynch mode */
-            if (SetNamedPipeHandleState( 
-                  h,        /* pipe handle */
-                  &dwMode,  /* new pipe mode */
-                  NULL,     /* don't set maximum bytes */
-                  NULL))    /* don't set maximum time */
-            {
-                KIPCSocket* ksock = calloc ( sizeof *ksock, 1 );
-
-                if ( ksock == NULL )
-                    rc = RC ( rcNS, rcNoTarg, rcAllocating, rcNoObj, rcNull ); 
-                else
-                {   
-                    
-                    /* initialize the KSocket */
-                    rc = KStreamInit ( & ksock -> dad . dad, ( const KStream_vt* ) & vtKIPCSocket,
-                                       "KSocket", "tcp", true, true );
-                    if ( rc == 0 )
-                    {
-                        pLogLibMsg(klogInfo, "$(b): KNSManagerMakeIPCConnection($(e),'$(n)')", "b=%p,e=%p,n=%s", ksock, to, pipename);
-                    
-                        ksock -> dad . read_timeout  = readMillis;
-                        ksock -> dad . write_timeout = writeMillis;
-                        ksock -> type = isIpcPipeClient;
-                        ksock -> pipe = h;
-                        *out = & ksock -> dad . dad;
-                        return 0;
-                    }
-                    free ( ksock );
-                }
-            }
-            else
-                rc = HandleErrno();
-        }
-        else /* CreateFileW failed */
-        {
-            switch (GetLastError())
-            {
-            case ERROR_PIPE_BUSY:
-                LogLibMsg(klogInfo, "KNSManagerMakeIPCConnection: pipe busy, retrying");
-                {
-                    BOOL pipeAvailable = WaitNamedPipeW(pipenameW, NMPWAIT_USE_DEFAULT_WAIT);
-                    if (pipeAvailable)
-                    {
-                        LogLibMsg(klogInfo, "KNSManagerMakeIPCConnection: WaitNamedPipeW returned TRUE");
-                        continue;
-                    }
-                    /* time-out, try again */
-                    rc = HandleErrno();
-                    LogLibMsg(klogInfo, "KNSManagerMakeIPCConnection: WaitNamedPipeW returned FALSE(timeout)");
-                    if ( retryTimeout < 0 || retry_count < retryTimeout )
-                    {
-                        Sleep(1000); /*ms*/
-                        ++retry_count;
-                        rc = 0;
-                        continue;   
-                    }
-                }
-                break;
-                
-            case (ERROR_FILE_NOT_FOUND):
-                if ( retryTimeout < 0 || retry_count < retryTimeout )
-                {
-                    LogLibMsg(klogInfo, "KNSManagerMakeIPCConnection: pipe not found, retrying");
-                    Sleep(1000); /*ms*/
-                    ++retry_count;
-                    rc = 0;
-                    continue;
-                }
-                else
-                    rc = HandleErrno();
-                break;
-                
-            default:
-                rc = HandleErrno();
-                break;
-            }
-        }
-        break;
-    }
-    return rc;
-}
-
-static
-rc_t KNSManagerMakeIPCListener( struct KNSManager const *self, struct KSocket** out, struct KEndPoint const * ep )
-{   
-    rc_t rc = 0;
-    KIPCSocket* ksock;
-
-    assert ( self != NULL );
-    assert ( out != NULL );
-
-    * out = NULL;
-
-    assert ( ep != NULL );
-    assert (ep->type == epIPC);
-    
-    /* use named pipes to implement unix domain socket - like behavior */
-    ksock = calloc ( sizeof *ksock, 1 );
-    if ( ksock == NULL )
-        rc = RC ( rcNS, rcNoTarg, rcAllocating, rcNoObj, rcNull ); 
-    else
-    {
-        rc = KStreamInit ( & ksock -> dad . dad, ( const KStream_vt* ) & vtKIPCSocket,
-                           "KSocket", "tcp", true, true );
-        if ( rc == 0 )
-        {
-            size_t num_writ;
-            char pipename[256];
-            rc = string_printf(pipename, sizeof(pipename), &num_writ, "\\\\.\\pipe\\%s", ep->u.ipc_name);
-            if (rc == 0)
-            {
-                string_cvt_wchar_copy(ksock->pipename, sizeof(ksock->pipename), pipename, num_writ);
-                
-                ksock -> type = isIpcListener;
-                ksock -> listenerPipe = INVALID_HANDLE_VALUE;
-                *out = & ksock -> dad;
-                
-                pLogLibMsg(klogInfo, "$(b): KNSManagerMakeIPCListener($(e),'$(n)')", "b=%p,e=%p,n=%s", ksock, ep, pipename);
-                return 0;
-            }
-            KIPCSocketWhack( & ksock -> dad );
-        }
-        else
-            free ( ksock );
-    }
-        
-    pLogLibMsg(klogInfo, "$(b): KNSManagerMakeIPCListener failed", "b=%p", ksock);
-    return rc;
-}
-
-/*
- * Entry points
-*/
-LIB_EXPORT 
-rc_t CC KSocketAccept ( struct KSocket *listenerBase, struct KStream **out )
-{
-    rc_t rc = 0;
-    KIPCSocket* listener = (KIPCSocket*)listenerBase;
-    pLogLibMsg(klogInfo, "$(b): KSocketAccept", "b=%p", listener);
-
-    if ( listener == NULL )
-        return RC ( rcNS, rcNoTarg, rcValidating, rcSelf, rcNull);
-        
-    if ( out == NULL )
-        return RC ( rcNS, rcStream, rcConstructing, rcParam, rcNull );
-
-    * out = NULL;
-
-    /* make sure listener points to a KIPCSocket */
-    if (listener -> dad . dad . vt -> v1 . destroy != KIPCSocketWhack)
-        return RC ( rcNS, rcNoTarg, rcValidating, rcParam, rcInvalid);
-
-    if (listener->type != isIpcListener)
-        return RC ( rcNS, rcNoTarg, rcValidating, rcParam, rcInvalid);
-        
-    listener->listenerPipe = CreateNamedPipeW(listener->pipename,    /* pipe name */
-                                              FILE_FLAG_OVERLAPPED |   /* using overlapped IO */
-                                              PIPE_ACCESS_DUPLEX,      /* read/write access  */
-                                              PIPE_TYPE_MESSAGE |      /* message type pipe  */
-                                              PIPE_READMODE_MESSAGE |  /* message-read mode  */
-                                              PIPE_WAIT,               /* blocking mode  */
-                                              PIPE_UNLIMITED_INSTANCES,/* max. instances   */
-                                              1024,                    /* output buffer size  */
-                                              1024,                    /* input buffer size  */
-                                              0,                       /* client time-out  */
-                                              NULL);                   /* default security attribute  */
-    if ( listener->listenerPipe != INVALID_HANDLE_VALUE )
-    {
-        OVERLAPPED overlap;
-        LogLibMsg(klogInfo, "KSocketAccept: calling CreateEvent");
-        overlap.hEvent = CreateEvent( 
-                                  NULL,    /* default security attribute */
-                                  TRUE,    /* manual reset event */
-                                  FALSE,    /* initial state = nonsignalled */
-                                  NULL); 
-        if (overlap.hEvent != NULL)
-        {
-            BOOL connected =  ConnectNamedPipe(listener->listenerPipe, &overlap);
-            /*LogLibMsg(klogInfo, "KSocketAccept: calling ConnectNamedPipe");*/
-            if ( !connected ) /* normal for asynch mode */
-            {
-                switch (GetLastError())
-                {
-                case ERROR_PIPE_CONNECTED: /* client connected since the call to CreateNamedPipeW */
-                    break;
-                    
-                case ERROR_IO_PENDING:
-                    LogLibMsg(klogInfo, "KSocketAccept: calling WaitForSingleObject");
-                    if (WaitForSingleObject(overlap.hEvent, INFINITE) != WAIT_OBJECT_0)
-                    {
-                        rc = HandleErrno();
-                        CloseHandle(overlap.hEvent);
-                        LogLibMsg(klogInfo, "KSocketAccept: WaitForSingleObject failed");
-                        return rc;
-                    }
-                    break;
-                    
-                default:
-                    rc = HandleErrno();
-                    CloseHandle(overlap.hEvent);
-                    LogLibMsg(klogInfo, "KSocketAccept: ConnectNamedPipe failed");
-                    return rc;
-                }
-            }
-            /* we are connected, create the socket stream */
-            {
-                KIPCSocket *ksock = calloc ( sizeof *ksock, 1 );
-                pLogLibMsg(klogInfo, "$(b): KSocketAccept", "b=%p", ksock);
-                
-                if ( ksock == NULL )
-                {
-                    rc = RC ( rcNS, rcNoTarg, rcAllocating, rcNoObj, rcNull ); 
-                    LogLibMsg(klogInfo, "KSocketAccept: calloc failed");
-                }
-                else
-                {
-                    rc = KStreamInit ( & ksock -> dad . dad, ( const KStream_vt* ) & vtKIPCSocket,
-                                       "KSocket", "tcp", true, true );
-                    if ( rc == 0 )
-                    {
-                        ksock -> type = isIpcPipeServer;
-                        ksock -> pipe = listener->listenerPipe;
-                        listener->listenerPipe = INVALID_HANDLE_VALUE; /* this is only to be used while ConnectNamedPipe() is in progress */
-                        *out = & ksock -> dad . dad;
-                        CloseHandle(overlap.hEvent);
-                        return 0;
-                    }
-                    free ( ksock );
-                    LogLibMsg(klogInfo, "KSocketAccept: KStreamInit failed");
-                }
-                CloseHandle(overlap.hEvent);
-                return rc;
-            }
-        }
-    }
-    else
-    {
-        rc = HandleErrno();
-        LogLibMsg(klogInfo, "KSocketAccept: CreateNamedPipeW failed");
-    }
-    return rc;
-}   
-
-LIB_EXPORT rc_t CC KNSManagerMakeRetryTimedConnection ( const KNSManager * self,
-    KStream **out, int32_t retryTimeout, int32_t readMillis, int32_t writeMillis,
-    const KEndPoint *from, const KEndPoint *to )
-{
-    rc_t rc;
-
-    if ( out == NULL )
-        rc = RC ( rcNS, rcStream, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcNS, rcStream, rcConstructing, rcSelf, rcNull );
-        else if ( to == NULL )
-            rc = RC ( rcNS, rcStream, rcConstructing, rcParam, rcNull );
-        else if ( from != NULL && from -> type != to -> type )
-            rc = RC ( rcNS, rcStream, rcConstructing, rcParam, rcIncorrect );
-        else
-        {
-            switch ( to -> type )
-            {
-            case epIPV4:
-                rc = KNSManagerMakeIPv4Connection ( self, out, from, to, retryTimeout, readMillis, writeMillis );
-                break;
-            case epIPC:
-                rc = KNSManagerMakeIPCConnection ( self, out, to, retryTimeout, readMillis, writeMillis );
-                break;
-            default:
-                rc = RC ( rcNS, rcStream, rcConstructing, rcParam, rcIncorrect );
-            }
-
-            if ( rc == 0 )
-                return 0;
-        }
-
-        * out = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT
-rc_t CC KNSManagerMakeListener( struct KNSManager const *self, struct KSocket** out, struct KEndPoint const * ep )
-{
-    rc_t rc;
-
-    if ( out == NULL )
-        rc = RC ( rcNS, rcSocket, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcNS, rcSocket, rcConstructing, rcSelf, rcNull );
-        else if ( ep == NULL )
-            rc = RC ( rcNS, rcSocket, rcConstructing, rcParam, rcNull );
-        else
-        {
-            switch ( ep -> type )
-            {
-            case epIPV4:
-                rc = KNSManagerMakeIPv4Listener ( self, out, ep );
-                break;
-            case epIPC:
-                rc = KNSManagerMakeIPCListener ( self, out, ep );
-                break;
-            default:
-                rc = RC ( rcNS, rcSocket, rcConstructing, rcParam, rcIncorrect );
-            }
-
-            if ( rc == 0 )
-                return 0;
-        }
-
-        * out = NULL;
-    }
-
-    return rc;
-}
-
-/* 
- * Local helpers
-*/
-static
-rc_t HandleErrnoEx ( const char *func_name, unsigned int lineno )
-{
-    rc_t rc;
-    int lerrno = WSAGetLastError();
-
-    switch ( lerrno )
-    {
-    case ERROR_FILE_NOT_FOUND:
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcFile, rcNotFound);            
-        break;
-    case ERROR_INVALID_HANDLE:
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcId, rcInvalid);            
-        break;
-    case ERROR_INVALID_PARAMETER:
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcParam, rcInvalid);            
-        break;
-    case ERROR_PIPE_BUSY:
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcConnection, rcCanceled );
-        break;
-    case ERROR_SEM_TIMEOUT:
-        rc = RC ( rcNS, rcStream, rcReading, rcTimeout, rcExhausted );
-        break;
-    case WSAEACCES: /* write permission denied */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcMemory, rcUnauthorized );            
-        break;
-    case WSAEADDRINUSE:/* address is already in use */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcMemory, rcExists );
-        break;
-    case WSAEADDRNOTAVAIL: /* requested address was not local */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcMemory, rcNotFound );
-        break;
-    case WSAEAFNOSUPPORT: /* address didnt have correct address family in ss_family field */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcName, rcError );
-        break;
-    case WSAEALREADY: /* socket is non blocking and a previous connection has not yet completed */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcId, rcUndefined );
-        break;
-    case WSAECONNABORTED: /* virtual circuit terminated. Application should close socket */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcId, rcInterrupted );
-        break;
-    case WSAECONNREFUSED: /* remote host refused to allow network connection */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcConnection, rcCanceled );
-        break;
-    case WSAECONNRESET: /* connection reset by peer */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcId, rcCanceled );
-        break;
-    case WSAEFAULT: /* name paremeter is not valid part of addr space */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcMemory, rcOutofrange );
-        break;
-    case WSAEHOSTUNREACH: /* remote hoste cannot be reached at this time */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcConnection, rcNotAvailable );
-        break;
-    case WSAEINPROGRESS: /* call is in progress */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcId, rcUndefined );
-        break;
-    case WSAEINVAL: /* invalid argument */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcParam, rcInvalid );
-        break;
-    case WSAEISCONN: /* connected already */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcConnection, rcExists );
-        break;
-    case WSAEMSGSIZE:  /* msg size too big */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcMessage, rcExcessive );
-        break;
-    case WSAENETDOWN:/* network subsystem failed */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcNoObj, rcFailed );
-        break;
-    case WSAENETRESET: /* connection broken due to keep-alive activity that 
-                          detected a failure while in progress */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcConnection, rcCanceled );
-        break;
-    case WSAENETUNREACH: /* network is unreachable */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcConnection, rcNotAvailable );
-        break;
-    case WSAENOBUFS: /* output queue for a network connection was full. 
-                     ( wont typically happen in linux. Packets are just silently dropped */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcConnection, rcInterrupted );
-        break;
-    case ERROR_PIPE_NOT_CONNECTED:
-    case WSAENOTCONN: /* socket is not connected */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcConnection, rcInvalid );
-        break;
-    case WSANOTINITIALISED: /* Must have WSAStartup call */
-        rc = RC ( rcNS, rcNoTarg, rcInitializing, rcEnvironment, rcUndefined );
-        break;
-    case WSAENOTSOCK: /* sock fd is not a socket */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcId, rcInvalid );
-        break;
-    case WSAEOPNOTSUPP: /* socket is not stream-style such as SOCK_STREAM */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcId, rcUnsupported );
-        break;
-    case WSAEPROTONOSUPPORT: /* specified protocol is not supported */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcNoObj, rcError );
-        break;
-    case WSAEPROTOTYPE: /* wrong type of protocol for this socket */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcId, rcUnsupported );
-        break;
-    case WSAEPROVIDERFAILEDINIT: /* service provider failed to initialize */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcNoObj, rcError );
-        break;
-    case ERROR_BROKEN_PIPE:
-    case WSAESHUTDOWN: /* socket had been shutdown */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcId, rcUnsupported );
-        break;
-    case WSAESOCKTNOSUPPORT: /* specified socket type is not supported */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcId, rcUnsupported );
-        break;
-    case WSAETIMEDOUT: /* connection dropped because of network failure */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcConnection, rcCanceled );
-        break;
-    case WSAEWOULDBLOCK: /* socket is marked as non-blocking but the recv operation
-                            would block */
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcId, rcError );
-        break;
-
-    case WSAEINTR: /* call was cancelled */
-    case WSAEMFILE: /* no more socket fd available */
-    default:
-        rc = RC ( rcNS, rcNoTarg, rcReading, rcNoObj, rcError );
-        PLOGERR (klogErr,
-                 (klogErr, rc, "unknown system error '$(S)($(E))', line=$(L)",
-                  "S=%!,E=%d,L=%d", lerrno, lerrno, lineno));
-    }
-    return rc;
-}
-
diff --git a/libs/kns/win/sysstream.c b/libs/kns/win/sysstream.c
deleted file mode 100644
index 83bdc30..0000000
--- a/libs/kns/win/sysstream.c
+++ /dev/null
@@ -1,232 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-#define KSTREAM_IMPL KStdIOStream
-typedef struct KStdIOStream KStdIOStream;
-
-#include <kns/extern.h>
-#include <kns/stream.h>
-#include <kns/impl.h>
-#include <klib/rc.h>
-#include <klib/log.h>
-
-#include <sysalloc.h>
-
-#include "stream-priv.h"
-
-#include <assert.h>
-
-#include <Windows.h>
-
-/*--------------------------------------------------------------------------
- * KStdIOStream
- *  a virtual stream
- */
-struct KStdIOStream
-{
-    KStream dad;
-    HANDLE fd;
-};
-
-static
-rc_t CC KStdIOStreamWhack ( KStdIOStream *self )
-{
-    /* we don't close self->fd because we did not open it */
-    free ( self );
-    return 0;
-}
-
-static
-rc_t CC KStdIOStreamRead ( const KStdIOStream *self,
-    void *buffer, size_t bsize, size_t *num_read )
-{
-    DWORD to_read;
-
-    assert ( self != NULL );
-
-    to_read = ( DWORD ) bsize;
-    if ( ( size_t ) to_read < bsize )
-        to_read = -1;
-
-    while ( 1 )
-    {
-        rc_t rc;
-        DWORD count, lerrno;
-
-        if ( ReadFile ( self -> fd, buffer, to_read, & count, NULL ) )
-        {
-            * num_read = count;
-            break;
-        }
-
-        lerrno = GetLastError ();
-        switch ( lerrno )
-        {
-        case ERROR_HANDLE_EOF:
-            * num_read = 0;
-            break;
-        case ERROR_IO_PENDING:
-            continue;
-        default:
-            rc = RC ( rcNS, rcStream, rcReading, rcNoObj, rcUnknown );
-            PLOGERR ( klogErr,
-                      ( klogErr, rc, "unknown system error '$(S)($(E))'",
-                        "S=%!,E=%d", lerrno, lerrno ) );
-            return rc;
-        }
-        break;
-    }
-
-    return 0;
-}
-
-static
-rc_t CC KStdIOStreamWrite ( KStdIOStream *self,
-    const void *buffer, size_t size, size_t *num_writ )
-{
-    DWORD to_write;
-
-    assert ( self != NULL );
-
-    to_write = ( DWORD ) size;
-    if ( ( size_t ) to_write < size )
-        to_write = -1;
-
-    * num_writ = 0;
-
-    while ( 1 )
-    {
-        rc_t rc;
-        DWORD lerrno, count = 0;
-
-        if ( WriteFile ( self -> fd, buffer, to_write, & count, NULL ) == 0 )
-        {
-            * num_writ += count;
-            break;
-        }
-
-        lerrno = GetLastError ();
-        switch ( lerrno )
-        {
-        case ERROR_IO_PENDING:
-            if ( count != 0 )
-            {
-                buffer = & ( ( const char* ) buffer ) [ count ];
-                to_write -= count;
-                * num_writ += count;
-                if ( to_write == 0 )
-                    break;
-            }
-            Sleep ( 100 );
-            continue;
-
-        case ERROR_NOT_ENOUGH_MEMORY:
-            rc = RC ( rcNS, rcStream, rcWriting, rcStorage, rcExhausted );
-            LOGERR ( klogSys, rc, "system device full error" );
-            return rc;
-
-        default:
-            rc = RC ( rcNS, rcStream, rcWriting, rcNoObj, rcUnknown );
-            PLOGERR ( klogErr,
-                      ( klogErr, rc, "unknown system error '$(S)($(E))'",
-                        "S=%!,E=%d", lerrno, lerrno ) );
-            return rc;
-        }
-        break;
-    }
-
-    return 0;
-}
-
-static KStream_vt_v1 vtKStdIOStream =
-{
-    1, 0,
-    KStdIOStreamWhack,
-    KStdIOStreamRead,
-    KStdIOStreamWrite
-};
-
-
-static
-rc_t KStdIOStreamMake ( KStream **sp, HANDLE fd, const char *strname,
-    bool read_enabled, bool write_enabled )
-{
-    rc_t rc;
-
-    if ( sp == NULL )
-        rc = RC ( rcNS, rcStream, rcConstructing, rcParam, rcNull );
-    else
-    {
-        KStdIOStream *s = calloc ( sizeof *s, 1 );
-        if ( s == NULL )
-            rc = RC ( rcNS, rcStream, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            rc = KStreamInit ( & s -> dad, ( const KStream_vt* ) & vtKStdIOStream,
-                               "KStdIOStream", strname, read_enabled, write_enabled );
-            if ( rc == 0 )
-            {
-                s -> fd = fd;
-                * sp = & s -> dad;
-                return 0;
-            }
-
-            free ( s );
-        }
-
-        * sp = NULL;
-    }
-
-    return rc;
-}
-
-/* MakeStdIn
- *  creates a read-only stream on stdin
- */
-LIB_EXPORT rc_t CC KStreamMakeStdIn ( const KStream **std_in )
-{
-    HANDLE fd = GetStdHandle ( STD_INPUT_HANDLE );
-    return KStdIOStreamMake ( ( KStream** ) std_in, fd, "stdin", true, false );
-}
-
-/* MakeStdOut
- * MakeStdErr
- *  creates a write-only stream on stdout or stderr
- */
-LIB_EXPORT rc_t CC KStreamMakeStdOut ( KStream **std_out )
-{
-    HANDLE fd = GetStdHandle ( STD_OUTPUT_HANDLE );
-    return KStdIOStreamMake ( std_out, fd, "stdout", false, true );
-}
-
-LIB_EXPORT rc_t CC KStreamMakeStdErr ( KStream **std_err )
-{
-    HANDLE fd = GetStdHandle ( STD_ERROR_HANDLE );
-    return KStdIOStreamMake ( std_err, fd, "stderr", false, true );
-}
diff --git a/libs/kproc/Makefile b/libs/kproc/Makefile
deleted file mode 100644
index 24a2d95..0000000
--- a/libs/kproc/Makefile
+++ /dev/null
@@ -1,153 +0,0 @@
-# ===========================================================================
-#
-#                            PUBLIC DOMAIN NOTICE
-#               National Center for Biotechnology Information
-#
-#  This software/database is a "United States Government Work" under the
-#  terms of the United States Copyright Act.  It was written as part of
-#  the author's official duties as a United States Government employee and
-#  thus cannot be copyrighted.  This software/database is freely available
-#  to the public for use. The National Library of Medicine and the U.S.
-#  Government have not placed any restriction on its use or reproduction.
-#
-#  Although all reasonable efforts have been taken to ensure the accuracy
-#  and reliability of the software and data, the NLM and the U.S.
-#  Government do not and cannot warrant the performance or results that
-#  may be obtained by using this software or data. The NLM and the U.S.
-#  Government disclaim all warranties, express or implied, including
-#  warranties of performance, merchantability or fitness for any particular
-#  purpose.
-#
-#  Please cite the author in any work or product based on this material.
-#
-# ===========================================================================
-
-
-default: std
-
-TOP ?= $(shell ../../build/abspath.sh ../..)
-MODULE = libs/kproc
-
-include $(TOP)/build/Makefile.env
-
-INT_LIBS = \
-	libksproc \
-	libkproc
-
-ifneq (win,$(OS))
-INT_LIBS += \
-	libkq
-endif
-
-ALL_LIBS = \
-	$(INT_LIBS)
-
-#-------------------------------------------------------------------------------
-# outer targets
-#
-all std: makedirs
-	@ $(MAKE_CMD) $(TARGDIR)/std
-
-$(INT_LIBS): makedirs
-	@ $(MAKE_CMD) $(ILIBDIR)/$@
-
-.PHONY: all std $(ALL_LIBS)
-
-#-------------------------------------------------------------------------------
-# std
-#
-$(TARGDIR)/std: \
-	$(addprefix $(ILIBDIR)/,$(INT_LIBS))
-
-.PHONY: $(TARGDIR)/std
-
-#-------------------------------------------------------------------------------
-# clean
-#
-clean: stdclean
-
-.PHONY: clean
-
-#-------------------------------------------------------------------------------
-# multi-threaded process support
-#
-$(ILIBDIR)/libkproc: $(addprefix $(ILIBDIR)/libkproc.,$(ILIBEXT))
-
-PROC_CMN = \
-	task \
-	procmgr
-
-PROC_SRC = \
-	$(PROC_CMN)
-
-ifneq (win,$(OS))
-PROC_SRC += \
-	systimeout \
-	syslock \
-	systhread \
-	syscond \
-	sem
-else
-PROC_SRC += \
-	systimeout \
-	syslock \
-	systhread \
-	syscond
-endif
-
-PROC_OBJ = \
-	$(addsuffix .$(LOBX),$(PROC_SRC))
-
-ifneq (win,$(OS))
-PROC_LIB = \
-	-dpthread
-else
-PROC_LIB = \
-	-dklib
-endif
-
-$(ILIBDIR)/libkproc.$(LIBX): $(PROC_OBJ)
-	$(LD) --slib -o $@ $^ $(PROC_LIB)
-
-
-#-------------------------------------------------------------------------------
-# single-threaded process support
-#
-$(ILIBDIR)/libksproc: $(addprefix $(ILIBDIR)/libksproc.,$(ILIBEXT))
-
-SPROC_SRC = \
-	$(PROC_CMN) \
-	sttimeout \
-	stlock \
-	stcond \
-	stsem \
-	stthread \
-	stbarrier
-
-SPROC_OBJ = \
-	$(addsuffix .$(LOBX),$(SPROC_SRC))
-
-SPROC_LIB = \
-	-dklib
-
-$(ILIBDIR)/libksproc.$(LIBX): $(SPROC_OBJ)
-	$(LD) --slib -o $@ $^ $(SPROC_LIB)
-
-
-#-------------------------------------------------------------------------------
-# cross-thread reference queue
-#
-$(ILIBDIR)/libkq: $(addprefix $(ILIBDIR)/libkq.,$(ILIBEXT))
-
-Q_SRC = \
-	queue
-
-Q_OBJ = \
-	$(addsuffix .$(LOBX),$(Q_SRC))
-
-Q_LIB = \
-	-dkproc \
-	-dklib
-
-$(ILIBDIR)/libkq.$(LIBX): $(Q_OBJ)
-	$(LD) --slib -o $@ $^ $(Q_LIB)
diff --git a/libs/kproc/bsd/syslock-priv.h b/libs/kproc/bsd/syslock-priv.h
deleted file mode 100644
index 438888f..0000000
--- a/libs/kproc/bsd/syslock-priv.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_syslock_priv_
-#define _h_syslock_priv_
-
-#include <pthread.h>
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifndef _h_atomic32_
-#include <atomic32.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * KLock
- *  a POSIX-style mutual exclusion lock
- */
-struct KLock
-{
-    pthread_mutex_t mutex;
-    atomic32_t refcount;
-};
-
-/*--------------------------------------------------------------------------
- * KTimedLock
- *  a POSIX-style mutual exclusion lock
- *  with some facilities for timed operations
- */
-struct KTimedLock
-{
-    pthread_mutex_t mutex;
-    pthread_mutex_t cond_lock;
-    pthread_cond_t cond;
-    uint32_t waiters;
-    atomic32_t refcount;
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_syslock_priv_ */
diff --git a/libs/kproc/bsd/syslock.c b/libs/kproc/bsd/syslock.c
deleted file mode 100644
index c28c81e..0000000
--- a/libs/kproc/bsd/syslock.c
+++ /dev/null
@@ -1,932 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kproc/extern.h>
-#include "syslock-priv.h"
-#include "syscond-priv.h"
-#include <kproc/timeout.h>
-#include <kproc/lock.h>
-#include <kproc/cond.h>
-#include <os-native.h>
-#include <kproc/lock.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <errno.h>
-
-/*--------------------------------------------------------------------------
- * pthread_mutex
- */
-static
-rc_t pthread_mutex_whack ( pthread_mutex_t *mutex )
-{
-    int status = pthread_mutex_destroy ( mutex );
-    switch ( status )
-    {
-    case 0:
-        break;
-    case EBUSY:
-        return RC ( rcPS, rcLock, rcDestroying, rcLock, rcBusy );
-    case EINVAL:
-        return RC ( rcPS, rcLock, rcDestroying, rcLock, rcInvalid );
-    default:
-        return RC ( rcPS, rcLock, rcDestroying, rcNoObj, rcUnknown );
-    }
-    return 0;
-}
-
-static
-rc_t pthread_mutex_acquire ( pthread_mutex_t *mutex )
-{
-/*    pthread_t t = pthread_self();
-    fprintf(stdout, "pthread_mutex_lock(%p), thread=%x\n", mutex, t);*/
-    int status = pthread_mutex_lock ( mutex );
-/*fprintf(stdout, "pthread_mutex_lock, thread=%x, status = %d\n", t, status);*/
-    switch ( status )
-    {
-    case 0:
-        break;
-    case EDEADLK:
-        return RC ( rcPS, rcLock, rcLocking, rcThread, rcDeadlock );
-    case EINVAL:
-        return RC ( rcPS, rcLock, rcLocking, rcLock, rcInvalid );
-    default:
-        return RC ( rcPS, rcLock, rcLocking, rcNoObj, rcUnknown );
-    }
-    return 0;
-}
-
-static
-int pthread_mutex_tryacquire ( pthread_mutex_t *mutex )
-{
-/*    pthread_t t = pthread_self();
-fprintf(stdout, "pthread_mutex_trylock(%p), thread=%x\n", mutex, t);*/
-    int status = pthread_mutex_trylock ( mutex );
-/*fprintf(stdout, "pthread_mutex_trylock, thread=%x, status = %d\n", t, status);*/
-    return status;
-}
-
-static
-rc_t pthread_mutex_release ( pthread_mutex_t *mutex )
-{
-/*    pthread_t t = pthread_self();
-fprintf(stdout, "pthread_mutex_unlock(%p), thread=%x\n", mutex, t);*/
-    int status = pthread_mutex_unlock ( mutex );
-/*fprintf(stdout, "pthread_mutex_unlock, thread=%x, status = %d\n", t, status);*/
-    switch ( status )
-    {
-    case 0:
-        break;
-    case EPERM:
-        return RC ( rcPS, rcLock, rcUnlocking, rcThread, rcIncorrect );
-    case EINVAL:
-        return RC ( rcPS, rcLock, rcUnlocking, rcLock, rcInvalid );
-    default:
-        return RC ( rcPS, rcLock, rcUnlocking, rcNoObj, rcUnknown );
-    }
-    return 0;
-}
-
-/*--------------------------------------------------------------------------
- * pthread_condition
- */
-static
-rc_t pthread_condition_init ( pthread_cond_t *cond )
- {
-    int status = pthread_cond_init ( cond, NULL );
-    switch ( status )
-    {
-    case 0:
-        break;
-    case EAGAIN:
-        return RC ( rcPS, rcCondition, rcConstructing, rcCondition, rcExhausted );
-    case ENOMEM:
-        return RC ( rcPS, rcCondition, rcConstructing, rcMemory, rcExhausted );
-    case EBUSY:
-        return RC ( rcPS, rcCondition, rcConstructing, rcCondition, rcBusy );
-    case EINVAL:
-        return RC ( rcPS, rcCondition, rcConstructing, rcCondition, rcInvalid );
-    default:
-        return RC ( rcPS, rcCondition, rcConstructing, rcNoObj, rcUnknown );
-    }
-
-    return 0;
-}
-
-static
-rc_t pthread_condition_whack ( pthread_cond_t *cond )
-{
-    int status = pthread_cond_destroy ( cond );
-    switch ( status )
-    {
-    case 0:
-        break;
-    case EBUSY:
-        return RC ( rcPS, rcLock, rcDestroying, rcCondition, rcBusy );
-    case EINVAL:
-        return RC ( rcPS, rcLock, rcDestroying, rcCondition, rcInvalid );
-    default:
-        return RC ( rcPS, rcLock, rcDestroying, rcNoObj, rcUnknown );
-    }
-    return 0;
-}
-
-static
-rc_t pthread_condition_wait ( pthread_cond_t *cond, pthread_mutex_t *mutex )
-{
-/*    pthread_t t = pthread_self();
-fprintf(stdout, "pthread_cond_wait(%p, %p), thread=%x\n", cond, mutex, t);*/
-    int status = pthread_cond_wait( cond, mutex );
-/*fprintf(stdout, "pthread_cond_wait, thread=%x, status = %d\n", t, status);*/
-    
-    switch ( status )
-    {
-    case 0:
-        break;
-    default:
-        return RC ( rcPS, rcLock, rcSignaling, rcCondition, rcUnknown );
-    }
-    return 0;
-}
-
-static
-rc_t pthread_condition_timedwait ( pthread_cond_t *cond, pthread_mutex_t *mutex, struct timespec *ts )
-{
-    int status = pthread_cond_timedwait ( cond, mutex, ts );
-    switch ( status )
-    {
-    case 0:
-        break;
-    case ETIMEDOUT:
-        return RC ( rcPS, rcCondition, rcWaiting, rcTimeout, rcExhausted );
-    case EINTR:
-        return RC ( rcPS, rcCondition, rcWaiting, rcThread, rcInterrupted );
-    default:
-        return RC ( rcPS, rcCondition, rcWaiting, rcNoObj, rcUnknown );
-    }
-
-    return 0;
-}
-
-static
-rc_t pthread_condition_signal( pthread_cond_t *cond )
-{
-    int status = pthread_cond_signal ( cond );
-    switch ( status )
-    {
-    case 0:
-        break;
-    default:
-        return RC ( rcPS, rcCondition, rcSignaling, rcNoObj, rcUnknown );
-    }
-
-    return 0;
-}
-
-static
-rc_t pthread_condition_broadcast ( pthread_cond_t *cond )
-{
-    int status = pthread_cond_broadcast ( cond );
-    switch ( status )
-    {
-    case 0:
-        break;
-    default:
-        return RC ( rcPS, rcCondition, rcSignaling, rcNoObj, rcUnknown );
-    }
-
-    return 0;
-}
-
-/*--------------------------------------------------------------------------
- * KLock
- *  a POSIX-style mutual exclusion lock
- */
-
-/* Destroy
- */
-static
-rc_t KLockDestroy ( KLock *self )
-{
-    return pthread_mutex_whack ( & self -> mutex );
-}
-
-/* Whack
- */
-static
-rc_t KLockWhack ( KLock *self )
-{
-    rc_t rc = KLockDestroy ( self );
-    if ( rc == 0 )
-        free ( self );
-    return rc;
-}
-
-/* Init
- */
-static
-rc_t KLockInit ( KLock *self )
-{
-    int status = pthread_mutex_init ( & self -> mutex, NULL );
-    switch ( status )
-    {
-    case 0:
-        atomic32_set ( & self -> refcount, 1 );
-        return 0;
-    case EAGAIN:
-        return RC ( rcPS, rcLock, rcConstructing, rcResources, rcInsufficient );
-    case ENOMEM:
-        return RC ( rcPS, rcLock, rcConstructing, rcMemory, rcInsufficient );
-    }
-
-    return RC ( rcPS, rcLock, rcConstructing, rcNoObj, rcUnknown );
- }
-
-
-/* Make
- *  make a simple mutex
- */
-LIB_EXPORT rc_t CC KLockMake ( KLock **lockp )
-{
-    rc_t rc;
-    if ( lockp == NULL )
-        rc = RC ( rcPS, rcLock, rcConstructing, rcParam, rcNull );
-    else
-    {
-        KLock *lock = malloc ( sizeof * lock );
-        if ( lock == NULL )
-            rc = RC ( rcPS, rcLock, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            rc = KLockInit ( lock );
-            if ( rc == 0 )
-            {
-                * lockp = lock;
-                return 0;
-            }
-
-            free ( lock );
-        }
-
-        * lockp = NULL;
-    }
-    return rc;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KLockAddRef ( const KLock *cself )
-{
-    if ( cself != NULL )
-        atomic32_inc ( & ( ( KLock* ) cself ) -> refcount );
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KLockRelease ( const KLock *cself )
-{
-    KLock *self = ( KLock* ) cself;
-    if ( cself != NULL )
-    {
-        if ( atomic32_dec_and_test ( & self -> refcount ) )
-        {
-            atomic32_set ( & self -> refcount, 1 );
-            return KLockWhack ( self );
-        }
-    }
-    return 0;
-}
-
-
-/* Acquire
- *  acquires lock
- */
-LIB_EXPORT rc_t CC KLockAcquire ( KLock *self )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcPS, rcLock, rcLocking, rcSelf, rcNull );
-    else
-    {
-        rc = pthread_mutex_acquire ( & self -> mutex );
-    }
-
-    return rc;
-}
-
-/* Unlock
- *  releases lock
- */
-LIB_EXPORT rc_t CC KLockUnlock ( KLock *self )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcLock, rcUnlocking, rcSelf, rcNull );
-        
-    /* release the guy */
-    rc = pthread_mutex_release ( & self -> mutex );
-
-    return rc;
-}
-
-/*--------------------------------------------------------------------------
- * KTimedLock
- *  a POSIX-style mutual exclusion lock with support for timed acquire
- */
-
-/* Destroy
- */
-static
-rc_t KTimedLockDestroy ( KTimedLock *self )
-{
-    rc_t rc = pthread_mutex_whack ( & self -> mutex );
-    if ( rc == 0 )
-    {
-        pthread_mutex_whack ( & self -> cond_lock );
-        pthread_condition_whack ( & self -> cond );
-    }
-    return rc;
-}
-
-/* Whack
- */
-static
-rc_t KTimedLockWhack ( KTimedLock *self )
-{
-    rc_t rc = KTimedLockDestroy ( self );
-    if ( rc == 0 )
-        free ( self );
-    return rc;
-}
-
-/* Init
- */
-static
-rc_t KTimedLockInit ( KTimedLock *self )
-{
-    int status = pthread_mutex_init ( & self -> mutex, NULL );
-    if ( status == 0 )
-    {
-        status = pthread_mutex_init ( & self -> cond_lock, NULL );
-        if ( status == 0 )
-        {
-            status = pthread_cond_init ( & self -> cond, NULL );
-            if ( status == 0 )
-            {
-                self -> waiters = 0;
-                atomic32_set ( & self -> refcount, 1 );
-                return 0;
-            }
-
-            pthread_mutex_destroy ( & self -> cond_lock );
-        }
-
-        pthread_mutex_destroy ( & self -> mutex );
-    }
-
-    switch ( status )
-    {
-    case EAGAIN:
-        return RC ( rcPS, rcLock, rcConstructing, rcResources, rcInsufficient );
-    case ENOMEM:
-        return RC ( rcPS, rcLock, rcConstructing, rcMemory, rcInsufficient );
-    }
-
-    return RC ( rcPS, rcLock, rcConstructing, rcNoObj, rcUnknown );
- }
-
-
-/* Make
- *  make a simple mutex
- */
-LIB_EXPORT rc_t CC KTimedLockMake ( KTimedLock **lockp )
-{
-    rc_t rc;
-    if ( lockp == NULL )
-        rc = RC ( rcPS, rcLock, rcConstructing, rcParam, rcNull );
-    else
-    {
-        KTimedLock *lock = malloc ( sizeof * lock );
-        if ( lock == NULL )
-            rc = RC ( rcPS, rcLock, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            rc = KTimedLockInit ( lock );
-            if ( rc == 0 )
-            {
-                * lockp = lock;
-                return 0;
-            }
-
-            free ( lock );
-        }
-
-        * lockp = NULL;
-    }
-    return rc;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KTimedLockAddRef ( const KTimedLock *cself )
-{
-    if ( cself != NULL )
-        atomic32_inc ( & ( ( KTimedLock* ) cself ) -> refcount );
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KTimedLockRelease ( const KTimedLock *cself )
-{
-    KTimedLock *self = ( KTimedLock* ) cself;
-    if ( cself != NULL )
-    {
-        if ( atomic32_dec_and_test ( & self -> refcount ) )
-        {
-            atomic32_set ( & self -> refcount, 1 );
-            return KTimedLockWhack ( self );
-        }
-    }
-    return 0;
-}
-
-
-/* Acquire
- *  acquires lock
- */
-LIB_EXPORT rc_t CC KTimedLockAcquire ( KTimedLock *self, timeout_t *tm )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcLock, rcLocking, rcSelf, rcNull );
-
-    if ( tm == NULL )
-        return pthread_mutex_acquire ( & self -> mutex );
-
-    /* this is ugly, but don't want to prepare inside lock */
-    if ( ! tm -> prepared )
-        TimeoutPrepare ( tm );
-
-    rc = pthread_mutex_acquire ( & self -> cond_lock );
-    if ( rc == 0 )
-    {
-        int status = pthread_mutex_tryacquire ( & self -> mutex );
-        if ( status == EBUSY )
-        {
-            while ( 1 )
-            {
-                ++ self -> waiters;
-                status = pthread_cond_timedwait ( & self -> cond, & self -> cond_lock, & tm -> ts );
-                -- self -> waiters;
-
-                if ( status == EINTR )
-                    continue;
-                if ( status != 0 )
-                    break;
-                status = pthread_mutex_tryacquire ( & self -> mutex );
-                if ( status != EBUSY )
-                    break;
-            }
-        }
-
-        pthread_mutex_release ( & self -> cond_lock );
-
-        switch ( status )
-        {
-        case 0:
-            break;
-        case ETIMEDOUT:
-            rc = RC ( rcPS, rcLock, rcLocking, rcTimeout, rcExhausted );
-            break;
-        case EBUSY:
-            rc = RC ( rcPS, rcLock, rcLocking, rcLock, rcBusy );
-            break;
-        case EINVAL:
-            rc = RC ( rcPS, rcLock, rcLocking, rcLock, rcInvalid );
-            break;
-        default:
-            rc = RC ( rcPS, rcLock, rcLocking, rcNoObj, rcUnknown );
-        }
-    }
-
-    return rc;
-}
-
-/* Unlock
- *  releases lock
- */
-LIB_EXPORT rc_t CC KTimedLockUnlock ( KTimedLock *self )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcLock, rcUnlocking, rcSelf, rcNull );
-
-    rc = pthread_mutex_acquire ( & self -> cond_lock );
-    if ( rc == 0 )
-    {
-        /* release the guy */
-        rc = pthread_mutex_release ( & self -> mutex );
-
-        if ( self -> waiters != 0 )
-            pthread_condition_signal ( & self -> cond );
-
-        pthread_mutex_release ( & self -> cond_lock );
-    }
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * KRWLock
- *  a POSIX-style read/write lock
- */
-struct KRWLock
-{
-    KLock lock;
-    pthread_cond_t rcond;
-    pthread_cond_t wcond;
-    uint32_t rwait;
-    uint32_t wwait;
-    int32_t count;
-    atomic32_t refcount;
-    
-    /* used in KRWLockTimedAcquire */
-    pthread_mutex_t timed_lock;
-    pthread_cond_t  timed_cond;
-    uint32_t        timed_waiters;
-};
-
-
-/* Whack
- */
-static
-rc_t KRWLockWhack ( KRWLock *self )
-{
-    rc_t rc;
-    if ( self -> count || self -> rwait || self -> wwait )
-        return RC ( rcPS, rcRWLock, rcDestroying, rcRWLock, rcBusy );
-
-    rc = KLockDestroy ( & self -> lock );
-    if ( rc == 0 )
-    {
-        pthread_cond_destroy ( & self -> rcond );
-        pthread_cond_destroy ( & self -> wcond );
-       
-        pthread_cond_destroy ( & self -> timed_cond );
-        pthread_mutex_whack ( & self -> timed_lock );
-        
-        free ( self );
-    }
-
-    return rc;
-}
-
-
-/* Make
- *  make a simple read/write lock
- */
-LIB_EXPORT rc_t CC KRWLockMake ( KRWLock **lockp )
-{
-    rc_t rc;
-
-    if ( lockp == NULL )
-        rc = RC ( rcPS, rcRWLock, rcConstructing, rcParam, rcNull );
-    else
-    {
-        KRWLock *lock = malloc ( sizeof * lock );
-        if ( lock == NULL )
-            rc = RC ( rcPS, rcRWLock, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            rc = KLockInit ( & lock -> lock );
-            if ( rc == 0 )
-            {
-                rc = pthread_condition_init ( & lock -> rcond );
-                if ( rc == 0 )
-                {
-                    rc = pthread_condition_init ( & lock -> wcond );
-                    if ( rc == 0 )
-                    {
-                        rc = pthread_condition_init ( & lock -> timed_cond );
-                        if ( rc == 0 )
-                        {
-                            int status = pthread_mutex_init ( & lock -> timed_lock, NULL );
-                            if ( status == 0 )
-                            {
-                            
-                                lock -> rwait = lock -> wwait = 0;
-                                lock -> count = 0;
-                                atomic32_set ( & lock -> refcount, 1 );
-                                lock -> timed_waiters = 0;
-                                * lockp = lock;
-                                return 0;
-                            }
-                            pthread_cond_destroy ( & lock -> timed_cond );
-                        }
-                        pthread_cond_destroy ( & lock -> wcond );
-                    }
-
-                    pthread_cond_destroy ( & lock -> rcond );
-                }
-
-                KLockDestroy ( & lock -> lock );
-            }
-
-            free ( lock );
-        }
-
-        * lockp = NULL;
-    }
-
-    return rc;
-}
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KRWLockAddRef ( const KRWLock *cself )
-{
-    if ( cself != NULL )
-        atomic32_inc ( & ( ( KRWLock* ) cself ) -> refcount );
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KRWLockRelease ( const KRWLock *cself )
-{
-    KRWLock *self = ( KRWLock* ) cself;
-    if ( cself != NULL )
-    {
-        if ( atomic32_dec_and_test ( & self -> refcount ) )
-        {
-            atomic32_set ( & self -> refcount, 1 );
-            return KRWLockWhack ( self );
-        }
-    }
-    return 0;
-}
-
-
-/* AcquireShared
- *  acquires read ( shared ) lock
- */
-LIB_EXPORT rc_t CC KRWLockAcquireShared ( KRWLock *self )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcRWLock, rcLocking, rcSelf, rcNull );
-
-    rc = KLockAcquire ( & self -> lock );
-    if ( rc == 0 )
-    {
-        ++ self -> rwait;
-        while ( self -> count < 0 || self -> wwait != 0 )
-        {
-            rc = pthread_condition_wait ( & self -> rcond, & self -> lock . mutex );
-            if ( rc != 0 )
-                break;
-        }
-        -- self -> rwait;
-
-        if ( rc == 0 )
-        {
-            ++ self -> count;
-        }
-
-        KLockUnlock ( & self -> lock );
-    }
-
-    return rc;
-}
-
-static
-rc_t KRWLockTimedAcquire( KRWLock *self, timeout_t *tm )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcLock, rcLocking, rcSelf, rcNull );
-
-    if ( tm == NULL )
-        return pthread_mutex_acquire ( & self -> lock . mutex );
-
-    /* this is ugly, but don't want to prepare inside lock */
-    if ( ! tm -> prepared )
-        TimeoutPrepare ( tm );
-
-    rc = pthread_mutex_acquire ( & self -> timed_lock );
-    if ( rc == 0 )
-    {
-        int status = pthread_mutex_tryacquire ( & self -> lock . mutex );
-        if ( status == EBUSY )
-        {
-            while ( 1 )
-            {
-                ++ self -> timed_waiters;
-                status = pthread_cond_timedwait ( & self -> timed_cond, & self -> timed_lock, & tm -> ts );
-                -- self -> timed_waiters;
-
-                if ( status == EINTR )
-                    continue;
-                if ( status != 0 )
-                    break;
-                status = pthread_mutex_tryacquire ( & self -> lock . mutex );
-                if ( status != EBUSY )
-                    break;
-            }
-        }
-
-        pthread_mutex_release ( & self -> timed_lock );
-
-        switch ( status )
-        {
-        case 0:
-            break;
-        case ETIMEDOUT:
-            rc = RC ( rcPS, rcLock, rcLocking, rcTimeout, rcExhausted );
-            break;
-        case EBUSY:
-            rc = RC ( rcPS, rcLock, rcLocking, rcLock, rcBusy );
-            break;
-        case EINVAL:
-            rc = RC ( rcPS, rcLock, rcLocking, rcLock, rcInvalid );
-            break;
-        default:
-            rc = RC ( rcPS, rcLock, rcLocking, rcNoObj, rcUnknown );
-        }
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KRWLockTimedAcquireShared ( KRWLock *self, timeout_t *tm )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcRWLock, rcLocking, rcSelf, rcNull );
-
-    rc = KRWLockTimedAcquire ( self, tm );
-    if ( rc == 0 )
-    {
-        ++ self -> rwait;
-        while ( self -> count < 0 || self -> wwait != 0 )
-        {
-            rc = pthread_condition_timedwait ( & self -> rcond, & self -> lock .  mutex, & tm -> ts );
-            if ( rc != 0 )
-            {
-                if ( GetRCState ( rc ) == rcExhausted && GetRCObject ( rc ) == rcTimeout )
-                    rc = ResetRCContext ( rc, rcPS, rcRWLock, rcLocking );
-                break;
-            }
-        }
-        -- self -> rwait;
-
-        if ( rc == 0 )
-        {
-            ++ self -> count;
-        }
-
-        KLockUnlock ( & self -> lock );
-    }
-
-    return rc;
-}
-
-/* AcquireExcl
- *  acquires write ( exclusive ) lock
- */
-LIB_EXPORT rc_t CC KRWLockAcquireExcl ( KRWLock *self )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcRWLock, rcLocking, rcSelf, rcNull );
-
-    rc = KLockAcquire ( & self -> lock );
-    if ( rc == 0 )
-    {
-        ++ self -> wwait;
-        while ( self -> count != 0 )
-        {
-            rc = pthread_condition_wait ( & self -> wcond, & self -> lock . mutex );
-            if ( rc != 0 )
-                break;
-        }
-        -- self -> wwait;
-
-        if ( rc == 0 )
-        {
-            self -> count = -1;
-        }
-
-        KLockUnlock ( & self -> lock );
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KRWLockTimedAcquireExcl ( KRWLock *self, timeout_t *tm )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcRWLock, rcLocking, rcSelf, rcNull );
-
-    rc = KRWLockTimedAcquire ( self, tm );
-    if ( rc == 0 )
-    {
-        ++ self -> wwait;
-        while ( self -> count != 0 )
-        {
-            rc = pthread_condition_timedwait ( & self -> wcond, & self -> lock . mutex, & tm -> ts );
-            if ( rc != 0 )
-            {
-                if ( GetRCState ( rc ) == rcExhausted && GetRCObject ( rc ) == rcTimeout )
-                    rc = ResetRCContext ( rc, rcPS, rcRWLock, rcLocking );
-                break;
-            }
-        }
-        -- self -> wwait;
-
-        if ( rc == 0 )
-        {
-            self -> count = -1;
-        }
-
-        KLockUnlock ( & self -> lock );
-    }
-
-    return rc;
-}
-
-/* Unlock
- *  releases lock
- */
-LIB_EXPORT rc_t CC KRWLockUnlock ( KRWLock *self )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcRWLock, rcUnlocking, rcSelf, rcNull );
-
-    rc = KLockAcquire ( & self -> lock );
-    if ( rc == 0 )
-    {
-        /* release the count */
-        if ( self -> count < 0 )
-            self -> count = 0;
-        else if ( self -> count > 0 )
-            -- self -> count;
-
-        /* if there are writers waiting... */
-        if ( self -> wwait != 0 )
-        {
-            /* don't bother unless the lock is free */
-            if ( self -> count == 0 )
-                pthread_condition_signal ( & self -> wcond );
-        }
-
-        /* if there are readers waiting */
-        else if ( self -> rwait != 0 )
-        {
-            /* any number of readers can come through now */
-            pthread_condition_broadcast ( & self -> rcond );
-        }
-
-        KLockUnlock ( & self -> lock );
-    }
-
-    return rc;
-}
diff --git a/libs/kproc/linux/sysbarrier.c b/libs/kproc/linux/sysbarrier.c
deleted file mode 100644
index 2b1ccaa..0000000
--- a/libs/kproc/linux/sysbarrier.c
+++ /dev/null
@@ -1,170 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kproc/extern.h>
-#include <kproc/barrier.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-#include <atomic32.h>
-
-#include <pthread.h>
-#include <stdlib.h>
-#include <errno.h>
-
-
-/*--------------------------------------------------------------------------
- * KBarrier
- *  a thread synchronization device
- *  detains all callers until the required number has been reached
- */
-struct KBarrier
-{
-    pthread_barrier_t barrier;
-    atomic32_t refcount;
-};
-
-
-/* Whack
- */
-static
-rc_t KBarrierWhack ( KBarrier *self )
-{
-    int status = pthread_barrier_destroy ( & self -> barrier );
-    switch ( status )
-    {
-    case 0:
-        break;
-    case EBUSY:
-        return RC ( rcPS, rcBarrier, rcDestroying, rcBarrier, rcBusy );
-    case EINVAL:
-        return RC ( rcPS, rcBarrier, rcDestroying, rcBarrier, rcInvalid );
-    default:
-        return RC ( rcPS, rcBarrier, rcDestroying, rcNoObj, rcUnknown );
-    }
-    return 0;
-}
-
-
-/* Make
- *  create a barrier
- *
- *  "count" [ IN ] - the number of threads to block
- */
-LIB_EXPORT rc_t CC KBarrierMake ( KBarrier **bp, uint32_t count )
-{
-    rc_t rc;
-    if ( bp == NULL )
-        rc = RC ( rcPS, rcBarrier, rcConstructing, rcParam, rcNull );
-    else
-    {
-        KBarrier *b = malloc ( sizeof * b );
-        if ( b == NULL )
-            rc = RC ( rcPS, rcBarrier, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            int status = pthread_barrier_init ( & b -> barrier, NULL, count );
-            if ( status == 0 )
-            {
-                atomic32_set ( & b -> refcount, 1 );
-                * bp = b;
-                return 0;
-            }
-
-            switch ( status )
-            {
-            case EINVAL:
-                rc = RC ( rcPS, rcBarrier, rcConstructing, rcParam, rcInvalid );
-                break;
-            case EBUSY:
-                rc = RC ( rcPS, rcBarrier, rcConstructing, rcBarrier, rcBusy );
-                break;
-            case EAGAIN:
-                rc = RC ( rcPS, rcBarrier, rcConstructing, rcBarrier, rcExhausted );
-                break;
-            case ENOMEM:
-                rc = RC ( rcPS, rcBarrier, rcConstructing, rcMemory, rcExhausted );
-                break;
-            default:
-                rc = RC ( rcPS, rcBarrier, rcConstructing, rcNoObj, rcUnknown );
-            }
-
-            free ( b );
-        }
-
-        * bp = NULL;
-    }
-    return rc;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KBarrierAddRef ( const KBarrier *cself )
-{
-    if ( cself != NULL )
-        atomic32_inc ( & ( ( KBarrier* ) cself ) -> refcount );
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KBarrierRelease ( const KBarrier *cself )
-{
-    KBarrier *self = ( KBarrier* ) cself;
-    if ( cself != NULL )
-    {
-        if ( atomic32_dec_and_test ( & self -> refcount ) )
-        {
-            atomic32_set ( & self -> refcount, 1 );
-            return KBarrierWhack ( self );
-        }
-    }
-    return 0;
-}
-
-
-/* Wait
- *  block until the required number of callers has been reached
- */
-LIB_EXPORT rc_t CC KBarrierWait ( KBarrier *self )
-{
-    int status;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcBarrier, rcWaiting, rcSelf, rcNull );
-
-    status = pthread_barrier_wait ( & self -> barrier );
-    switch ( status )
-    {
-    case 0:
-        break;
-    case EINVAL:
-        return RC ( rcPS, rcBarrier, rcWaiting, rcBarrier, rcInvalid );
-    default:
-        return RC ( rcPS, rcBarrier, rcWaiting, rcNoObj, rcUnknown );
-    }
-
-    return 0;
-}
diff --git a/libs/kproc/linux/syslock-priv.h b/libs/kproc/linux/syslock-priv.h
deleted file mode 100644
index 1b2adff..0000000
--- a/libs/kproc/linux/syslock-priv.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_syslock_priv_
-#define _h_syslock_priv_
-
-/* BEGIN HACK to get rwlocks defined */
-#include <stdint.h>
-#include <stddef.h>
-
-#undef __USE_UNIX98
-#define __USE_UNIX98 1
-
-#undef __USE_XOPEN2K
-#define __USE_XOPEN2K 1
-/* END HACK */
-
-#include <pthread.h>
-#include <atomic32.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * KLock
- *  a POSIX-style mutual exclusion lock
- */
-struct KLock
-{
-    pthread_mutex_t mutex;
-    atomic32_t refcount;
-};
-
-struct KTimedLock
-{
-    pthread_mutex_t mutex;
-    atomic32_t refcount;
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_syslock_priv_ */
diff --git a/libs/kproc/linux/syslock.c b/libs/kproc/linux/syslock.c
deleted file mode 100644
index dffd05f..0000000
--- a/libs/kproc/linux/syslock.c
+++ /dev/null
@@ -1,617 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kproc/extern.h>
-#include "syslock-priv.h"
-#include <os-native.h>
-#include <kproc/timeout.h>
-#include <kproc/lock.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <errno.h>
-
-/*--------------------------------------------------------------------------
- * KLock
- *  a POSIX-style mutual exclusion lock
- */
-
-/* Whack
- */
-static
-rc_t KLockWhack ( KLock *self )
-{
-    int status = pthread_mutex_destroy ( & self -> mutex );
-    switch ( status )
-    {
-    case 0:
-        break;
-    case EBUSY:
-        return RC ( rcPS, rcLock, rcDestroying, rcLock, rcBusy );
-    case EINVAL:
-        return RC ( rcPS, rcLock, rcDestroying, rcLock, rcInvalid );
-    default:
-        return RC ( rcPS, rcLock, rcDestroying, rcNoObj, rcUnknown );
-    }
-
-    free ( self );
-    return 0;
-}
-
-/* Make
- *  make a simple mutex
- */
-LIB_EXPORT rc_t CC KLockMake ( KLock **lockp )
-{
-    rc_t rc;
-    if ( lockp == NULL )
-        rc = RC ( rcPS, rcLock, rcConstructing, rcParam, rcNull );
-    else
-    {
-        KLock *lock = malloc ( sizeof * lock );
-        if ( lock == NULL )
-            rc = RC ( rcPS, rcLock, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            int status = pthread_mutex_init ( & lock -> mutex, NULL );
-            if ( status == 0 )
-            {
-                atomic32_set ( & lock -> refcount, 1 );
-                * lockp = lock;
-                return 0;
-            }
-
-            /* pthread_mutex_init is documented as always returning 0 */
-            rc = RC ( rcPS, rcLock, rcConstructing, rcNoObj, rcUnknown );
-
-            free ( lock );
-        }
-
-        * lockp = NULL;
-    }
-    return rc;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KLockAddRef ( const KLock *cself )
-{
-    if ( cself != NULL )
-        atomic32_inc ( & ( ( KLock* ) cself ) -> refcount );
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KLockRelease ( const KLock *cself )
-{
-    KLock *self = ( KLock* ) cself;
-    if ( cself != NULL )
-    {
-        if ( atomic32_dec_and_test ( & self -> refcount ) )
-        {
-            atomic32_set ( & self -> refcount, 1 );
-            return KLockWhack ( self );
-        }
-    }
-    return 0;
-}
-
-
-/* Acquire
- *  acquires lock
- */
-LIB_EXPORT rc_t CC KLockAcquire ( KLock *self )
-{
-    int status;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcLock, rcLocking, rcSelf, rcNull );
-
-    status = pthread_mutex_lock ( & self -> mutex );
-    switch ( status )
-    {
-    case 0:
-        break;
-    case EDEADLK:
-        return RC ( rcPS, rcLock, rcLocking, rcThread, rcDeadlock );
-    case EINVAL:
-        return RC ( rcPS, rcLock, rcLocking, rcLock, rcInvalid );
-    default:
-        return RC ( rcPS, rcLock, rcLocking, rcNoObj, rcUnknown );
-    }
-
-    return 0;
-}
-
-/* Unlock
- *  releases lock
- */
-LIB_EXPORT rc_t CC KLockUnlock ( KLock *self )
-{
-    int status;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcLock, rcUnlocking, rcSelf, rcNull );
-
-    status = pthread_mutex_unlock ( & self -> mutex );
-    switch ( status )
-    {
-    case 0:
-        break;
-    case EPERM:
-        return RC ( rcPS, rcLock, rcUnlocking, rcThread, rcIncorrect );
-    case EINVAL:
-        return RC ( rcPS, rcLock, rcUnlocking, rcLock, rcInvalid );
-    default:
-        return RC ( rcPS, rcLock, rcUnlocking, rcNoObj, rcUnknown );
-    }
-
-    return 0;
-}
-
-/*--------------------------------------------------------------------------
- * KTimedLock
- *  a POSIX-style mutual exclusion lock with support for timed Acquire
- */
-
- /* Whack
- */
-static
-rc_t KTimedLockWhack ( KTimedLock *self )
-{
-    int status = pthread_mutex_destroy ( & self -> mutex );
-    switch ( status )
-    {
-    case 0:
-        break;
-    case EBUSY:
-        return RC ( rcPS, rcLock, rcDestroying, rcLock, rcBusy );
-    case EINVAL:
-        return RC ( rcPS, rcLock, rcDestroying, rcLock, rcInvalid );
-    default:
-        return RC ( rcPS, rcLock, rcDestroying, rcNoObj, rcUnknown );
-    }
-
-    free ( self );
-    return 0;
-}
-
-/* Make
- *  make a simple mutex
- */
-LIB_EXPORT rc_t CC KTimedLockMake ( KTimedLock **lockp )
-{
-    rc_t rc;
-    if ( lockp == NULL )
-        rc = RC ( rcPS, rcLock, rcConstructing, rcParam, rcNull );
-    else
-    {
-        KTimedLock *lock = malloc ( sizeof * lock );
-        if ( lock == NULL )
-            rc = RC ( rcPS, rcLock, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            int status = pthread_mutex_init ( & lock -> mutex, NULL );
-            if ( status == 0 )
-            {
-                atomic32_set ( & lock -> refcount, 1 );
-                * lockp = lock;
-                return 0;
-            }
-
-            /* pthread_mutex_init is documented as always returning 0 */
-            rc = RC ( rcPS, rcLock, rcConstructing, rcNoObj, rcUnknown );
-
-            free ( lock );
-        }
-
-        * lockp = NULL;
-    }
-    return rc;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KTimedLockAddRef ( const KTimedLock *cself )
-{
-    if ( cself != NULL )
-        atomic32_inc ( & ( ( KLock* ) cself ) -> refcount );
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KTimedLockRelease ( const KTimedLock *cself )
-{
-    KTimedLock *self = ( KTimedLock* ) cself;
-    if ( cself != NULL )
-    {
-        if ( atomic32_dec_and_test ( & self -> refcount ) )
-        {
-            atomic32_set ( & self -> refcount, 1 );
-            return KTimedLockWhack ( self );
-        }
-    }
-    return 0;
-}
-
-
-/* Acquire
- *  acquires lock with a timeout
- */
-LIB_EXPORT rc_t CC KTimedLockAcquire ( KTimedLock *self, timeout_t *tm )
-{
-    int status;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcLock, rcLocking, rcSelf, rcNull );
-
-    status = pthread_mutex_trylock ( & self -> mutex );
-    switch ( status )
-    {
-    case 0:
-        return 0;
-    case EBUSY:
-        if ( tm != NULL )
-            break;
-        return RC ( rcPS, rcLock, rcLocking, rcLock, rcBusy );
-    case EINVAL:
-        return RC ( rcPS, rcLock, rcLocking, rcLock, rcInvalid );
-    default:
-        return RC ( rcPS, rcLock, rcLocking, rcNoObj, rcUnknown );
-    }
-
-    if ( ! tm -> prepared )
-        TimeoutPrepare ( tm );
-
-    status = pthread_mutex_timedlock ( & self -> mutex, & tm -> ts );
-    switch ( status )
-    {
-    case 0:
-        break;
-    case ETIMEDOUT:
-        return RC ( rcPS, rcLock, rcLocking, rcTimeout, rcExhausted );
-    case EINVAL:
-        return RC ( rcPS, rcLock, rcLocking, rcTimeout, rcInvalid );
-    default:
-        return RC ( rcPS, rcLock, rcLocking, rcNoObj, rcUnknown );
-    }
-
-    return 0;
-}
-
-/* Unlock
- *  releases lock
- */
-LIB_EXPORT rc_t CC KTimedLockUnlock ( KTimedLock *self )
-{
-    int status;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcLock, rcUnlocking, rcSelf, rcNull );
-
-    status = pthread_mutex_unlock ( & self -> mutex );
-    switch ( status )
-    {
-    case 0:
-        break;
-    case EPERM:
-        return RC ( rcPS, rcLock, rcUnlocking, rcThread, rcIncorrect );
-    case EINVAL:
-        return RC ( rcPS, rcLock, rcUnlocking, rcLock, rcInvalid );
-    default:
-        return RC ( rcPS, rcLock, rcUnlocking, rcNoObj, rcUnknown );
-    }
-
-    return 0;
-}
-
-
-
-/*--------------------------------------------------------------------------
- * KRWLock
- *  a POSIX-style read/write lock
- */
-struct KRWLock
-{
-    pthread_rwlock_t lock;
-    atomic32_t refcount;
-};
-
-
-/* Whack
- */
-static
-rc_t KRWLockWhack ( KRWLock *self )
-{
-    int status = pthread_rwlock_destroy ( & self -> lock );
-    switch ( status )
-    {
-    case 0:
-        break;
-    case EBUSY:
-        return RC ( rcPS, rcRWLock, rcDestroying, rcRWLock, rcBusy );
-    case EINVAL:
-        return RC ( rcPS, rcRWLock, rcDestroying, rcRWLock, rcInvalid );
-    default:
-        return RC ( rcPS, rcRWLock, rcDestroying, rcNoObj, rcUnknown );
-    }
-
-    free ( self );
-    return 0;
-}
-
-
-/* Make
- *  make a simple read/write lock
- */
-LIB_EXPORT rc_t CC KRWLockMake ( KRWLock **lockp )
-{
-    rc_t rc;
-
-    if ( lockp == NULL )
-        rc = RC ( rcPS, rcRWLock, rcConstructing, rcParam, rcNull );
-    else
-    {
-        KRWLock *lock = malloc ( sizeof * lock );
-        if ( lock == NULL )
-            rc = RC ( rcPS, rcRWLock, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            int status = pthread_rwlock_init ( & lock -> lock, NULL );
-            if ( status == 0 )
-            {
-                atomic32_set ( & lock -> refcount, 1 );
-                * lockp = lock;
-                return 0;
-            }
-
-            switch ( status )
-            {
-            case EAGAIN:
-                rc = RC ( rcPS, rcRWLock, rcConstructing, rcRWLock, rcExhausted );
-                break;
-            case ENOMEM:
-                rc = RC ( rcPS, rcRWLock, rcConstructing, rcMemory, rcExhausted );
-                break;
-            case EPERM:
-                rc = RC ( rcPS, rcRWLock, rcConstructing, rcProcess, rcUnauthorized );
-                break;
-            case EBUSY:
-                rc = RC ( rcPS, rcRWLock, rcConstructing, rcRWLock, rcBusy );
-                break;
-            default:
-                rc = RC ( rcPS, rcRWLock, rcConstructing, rcNoObj, rcUnknown );
-            }
-
-            free ( lock );
-        }
-
-        * lockp = NULL;
-    }
-
-    return rc;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KRWLockAddRef ( const KRWLock *cself )
-{
-    if ( cself != NULL )
-        atomic32_inc ( & ( ( KRWLock* ) cself ) -> refcount );
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KRWLockRelease ( const KRWLock *cself )
-{
-    KRWLock *self = ( KRWLock* ) cself;
-    if ( cself != NULL )
-    {
-        if ( atomic32_dec_and_test ( & self -> refcount ) )
-        {
-            atomic32_set ( & self -> refcount, 1 );
-            return KRWLockWhack ( self );
-        }
-    }
-    return 0;
-}
-
-
-/* AcquireShared
- *  acquires read ( shared ) lock
- */
-LIB_EXPORT rc_t CC KRWLockAcquireShared ( KRWLock *self )
-{
-    int status;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcRWLock, rcLocking, rcSelf, rcNull );
-
-    status = pthread_rwlock_rdlock ( & self -> lock );
-    switch ( status )
-    {
-    case 0:
-        break;
-    case EDEADLK:
-        return RC ( rcPS, rcRWLock, rcLocking, rcThread, rcDeadlock );
-    case EAGAIN:
-        return RC ( rcPS, rcRWLock, rcLocking, rcRWLock, rcExhausted );
-    case EINVAL:
-        return RC ( rcPS, rcRWLock, rcLocking, rcRWLock, rcInvalid );
-    default:
-        return RC ( rcPS, rcRWLock, rcLocking, rcNoObj, rcUnknown );
-    }
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KRWLockTimedAcquireShared ( KRWLock *self, timeout_t *tm )
-{
-    int status;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcRWLock, rcLocking, rcSelf, rcNull );
-
-    status = pthread_rwlock_tryrdlock ( & self -> lock );
-    switch ( status )
-    {
-    case 0:
-        return 0;
-    case EBUSY:
-        if ( tm != NULL )
-            break;
-        return RC ( rcPS, rcLock, rcLocking, rcRWLock, rcBusy );
-    case EAGAIN:
-        return RC ( rcPS, rcRWLock, rcLocking, rcRWLock, rcExhausted );
-    case EINVAL:
-        return RC ( rcPS, rcRWLock, rcLocking, rcRWLock, rcInvalid );
-    default:
-        return RC ( rcPS, rcRWLock, rcLocking, rcNoObj, rcUnknown );
-    }
-
-    if ( ! tm -> prepared )
-        TimeoutPrepare ( tm );
-
-    status = pthread_rwlock_timedrdlock ( & self -> lock, & tm -> ts );
-    switch ( status )
-    {
-    case 0:
-        break;
-    case ETIMEDOUT:
-        return RC ( rcPS, rcRWLock, rcLocking, rcTimeout, rcExhausted );
-    case EAGAIN:
-        return RC ( rcPS, rcRWLock, rcLocking, rcRWLock, rcExhausted );
-    case EDEADLK:
-        return RC ( rcPS, rcRWLock, rcLocking, rcThread, rcDeadlock );
-    case EINVAL:
-        return RC ( rcPS, rcRWLock, rcLocking, rcTimeout, rcInvalid );
-    default:
-        return RC ( rcPS, rcRWLock, rcLocking, rcNoObj, rcUnknown );
-    }
-
-    return 0;
-}
-
-
-/* AcquireExcl
- *  acquires write ( exclusive ) lock
- */
-LIB_EXPORT rc_t CC KRWLockAcquireExcl ( KRWLock *self )
-{
-    int status;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcRWLock, rcLocking, rcSelf, rcNull );
-
-    status = pthread_rwlock_wrlock ( & self -> lock );
-    switch ( status )
-    {
-    case 0:
-        break;
-    case EDEADLK:
-        return RC ( rcPS, rcRWLock, rcLocking, rcThread, rcDeadlock );
-    case EINVAL:
-        return RC ( rcPS, rcRWLock, rcLocking, rcRWLock, rcInvalid );
-    default:
-        return RC ( rcPS, rcRWLock, rcLocking, rcNoObj, rcUnknown );
-    }
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KRWLockTimedAcquireExcl ( KRWLock *self, timeout_t *tm )
-{
-    int status;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcRWLock, rcLocking, rcSelf, rcNull );
-
-    status = pthread_rwlock_trywrlock ( & self -> lock );
-    switch ( status )
-    {
-    case 0:
-        return 0;
-    case EBUSY:
-        if ( tm != NULL )
-            break;
-        return RC ( rcPS, rcRWLock, rcLocking, rcLock, rcBusy );
-    case EINVAL:
-        return RC ( rcPS, rcRWLock, rcLocking, rcRWLock, rcInvalid );
-    default:
-        return RC ( rcPS, rcRWLock, rcLocking, rcNoObj, rcUnknown );
-    }
-
-    if ( ! tm -> prepared )
-        TimeoutPrepare ( tm );
-
-    status = pthread_rwlock_timedwrlock ( & self -> lock, & tm -> ts );
-    switch ( status )
-    {
-    case 0:
-        break;
-    case ETIMEDOUT:
-        return RC ( rcPS, rcRWLock, rcLocking, rcTimeout, rcExhausted );
-    case EDEADLK:
-        return RC ( rcPS, rcRWLock, rcLocking, rcThread, rcDeadlock );
-    case EINVAL:
-        return RC ( rcPS, rcRWLock, rcLocking, rcTimeout, rcInvalid );
-    default:
-        return RC ( rcPS, rcRWLock, rcLocking, rcNoObj, rcUnknown );
-    }
-
-    return 0;
-}
-
-
-/* Unlock
- *  releases lock
- */
-LIB_EXPORT rc_t CC KRWLockUnlock ( KRWLock *self )
-{
-    int status;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcRWLock, rcUnlocking, rcSelf, rcNull );
-
-    status = pthread_rwlock_unlock ( & self -> lock );
-    switch ( status )
-    {
-    case 0:
-        break;
-    case EPERM:
-        return RC ( rcPS, rcRWLock, rcUnlocking, rcThread, rcIncorrect );
-    case EINVAL:
-        return RC ( rcPS, rcRWLock, rcUnlocking, rcRWLock, rcInvalid );
-    default:
-        return RC ( rcPS, rcRWLock, rcUnlocking, rcNoObj, rcUnknown );
-    }
-
-    return 0;
-}
diff --git a/libs/kproc/procmgr.c b/libs/kproc/procmgr.c
deleted file mode 100644
index 6f768b3..0000000
--- a/libs/kproc/procmgr.c
+++ /dev/null
@@ -1,412 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kproc/extern.h>
-
-#include <kproc/procmgr.h>
-#include <kproc/task.h>
-#include <kproc/lock.h>
-#include <klib/refcount.h>
-#include <klib/rc.h>
-
-#define rcTask rcCmd
-
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * KCleanupTaskQueue
- */
-typedef struct KCleanupTaskQueue KCleanupTaskQueue;
-struct KCleanupTaskQueue
-{
-    uint64_t count;
-    uint64_t capacity;
-    uint64_t start;
-    KTask *q [ 1 ];
-};
-
-
-/*--------------------------------------------------------------------------
- * KProcMgr
- */
-struct KProcMgr
-{
-    KLock *cleanup_lock;
-    KCleanupTaskQueue *cleanup;
-    KRefcount refcount;
-};
-
-static KProcMgr * s_proc_mgr;
-
-
-/* Whack
- *  tear down proc mgr
- *  runs any outstanding cleanup tasks
- *  deletes the singleton object
- *  intended to be called from an "atexit()" or similar task
- */
-LIB_EXPORT rc_t CC KProcMgrWhack ( void )
-{
-    rc_t rc = 0;
-
-    KProcMgr *self = s_proc_mgr;
-    if ( s_proc_mgr != NULL )
-    {
-        s_proc_mgr = NULL;
-
-        rc = KLockAcquire ( self -> cleanup_lock );
-        if ( rc == 0 )
-        {
-            uint64_t i;
-
-            KCleanupTaskQueue *cleanup = self -> cleanup;
-            self -> cleanup = NULL;
-            KLockUnlock ( self -> cleanup_lock );
-
-            if ( cleanup != NULL )
-            {
-                for ( i = 0; i < cleanup -> count; ++ i )
-                {
-                    KTask *task = cleanup -> q [ i ];
-                    if ( task != NULL )
-                    {
-                        rc_t task_rc = KTaskExecute ( task );
-                        if ( rc == 0 )
-                            rc = task_rc;
-
-                        cleanup -> q [ i ] = NULL;
-                        KTaskRelease ( task );
-                    }
-                }
-
-                free ( cleanup );
-            }
-        }
-
-        KLockRelease ( self -> cleanup_lock );
-        free ( self );
-    }
-
-    return rc;
-}
-
-
-/* Init
- *  initialize the proc mgr
- *  creates the singleton object
- */
-LIB_EXPORT rc_t CC KProcMgrInit ( void )
-{
-    rc_t rc = 0;
-
-    if ( s_proc_mgr == NULL )
-    {
-        KProcMgr *mgr = malloc ( sizeof * s_proc_mgr );
-        if ( mgr == NULL )
-            rc = RC ( rcPS, rcMgr, rcInitializing, rcMemory, rcExhausted );
-        else
-        {
-            rc = KLockMake ( & mgr -> cleanup_lock );
-            if ( rc == 0 )
-            {
-                mgr -> cleanup = NULL;
-                KRefcountInit ( & mgr -> refcount, 0, "KProcMgr", "init", "process mgr" );
-
-                s_proc_mgr = mgr;
-                return 0;
-            }
-
-            free ( mgr );
-        }
-    }
-
-    return rc;
-}
-
-
-/* MakeSingleton
- *  make or access singleton process manager
- *  VDB-2 ONLY
- */
-LIB_EXPORT rc_t CC KProcMgrMakeSingleton ( KProcMgr ** mgrp )
-{
-    rc_t rc;
-
-    if ( mgrp == NULL )
-        rc = RC ( rcPS, rcMgr, rcConstructing, rcParam, rcNull );
-    else
-    {
-        * mgrp = s_proc_mgr;
-
-        if ( s_proc_mgr == NULL )
-            rc = RC ( rcPS, rcMgr, rcConstructing, rcMgr, rcNull );
-        else
-            rc = KProcMgrAddRef ( s_proc_mgr );
-    }
-
-    return rc;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KProcMgrAddRef ( const KProcMgr *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KProcMgr" ) )
-        {
-        case krefLimit:
-            return RC ( rcPS, rcMgr, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KProcMgrRelease ( const KProcMgr *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KProcMgr" ) )
-        {
-        case krefWhack:
-            return 0;
-        case krefNegative:
-            return RC ( rcPS, rcMgr, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/* AddCleanupTask
- *  add a task to be performed at process exit time
- *
- *  "ticket" [ OUT ] - an id that can be used later to remove task
- *
- *  "task" [ IN ] - task object that will be executed at process
- *   exit, unless previously removed ( see RemoveCleanupTask ).
- *   NB - a new reference to "task" will be created
- */
-LIB_EXPORT rc_t CC KProcMgrAddCleanupTask ( KProcMgr *self, KTaskTicket *ticket, KTask *task )
-{
-    rc_t rc;
-
-    if ( ticket == NULL )
-        rc = RC ( rcPS, rcQueue, rcInserting, rcId, rcNull );
-    else
-    {
-        memset ( ticket, 0, sizeof * ticket );
-
-        if ( self == NULL )
-            rc = RC ( rcPS, rcQueue, rcInserting, rcSelf, rcNull );
-        else if ( self != s_proc_mgr )
-            rc = RC ( rcPS, rcQueue, rcInserting, rcSelf, rcIncorrect );
-        else if ( task == NULL )
-            rc = RC ( rcPS, rcQueue, rcInserting, rcTask, rcNull );
-        else
-        {
-            rc = KTaskAddRef ( task );
-            if ( rc == 0 )
-            {
-                rc = KLockAcquire ( self -> cleanup_lock );
-                if ( rc == 0 )
-                {
-                    const uint64_t extend = 1024;
-                    KCleanupTaskQueue *cleanup = self -> cleanup;
-
-                    /* on first insert, allocate queue */
-                    if ( self -> cleanup == NULL )
-                    {
-                        cleanup = malloc ( sizeof * cleanup - sizeof cleanup -> q
-                            + sizeof cleanup -> q [ 0 ] * extend );
-                        if ( cleanup == NULL )
-                            rc = RC ( rcPS, rcQueue, rcInserting, rcMemory, rcExhausted );
-                        else
-                        {
-                            cleanup -> count = 0;
-                            cleanup -> capacity = extend;
-                            cleanup -> start = 0;
-
-                            self -> cleanup = cleanup;
-                        }
-                    }
-
-                    /* if queue is full */
-                    else if ( cleanup -> count == cleanup -> capacity )
-                    {
-                        uint64_t empty;
-
-                        /* determine number of empty slots at start */
-                        for ( empty = 0; empty < cleanup -> count; ++ empty )
-                        {
-                            if ( cleanup -> q [ empty ] != NULL )
-                                break;
-                        }
-
-                        /* if none are empty, simply reallocate - probably bad... */
-                        if ( empty == 0 )
-                        {
-                            cleanup = realloc ( cleanup, sizeof * cleanup - sizeof cleanup -> q
-                                + sizeof cleanup -> q [ 0 ] * ( cleanup -> capacity + extend ) );
-                            if ( cleanup == NULL )
-                                rc = RC ( rcPS, rcQueue, rcInserting, rcMemory, rcExhausted );
-                            else
-                            {
-                                cleanup -> capacity += extend;
-                                self -> cleanup = cleanup;
-                            }
-                        }
-
-                        /* otherwise, rewrite to remove empty slots */
-                        else
-                        {
-                            uint64_t i;
-                            const KCleanupTaskQueue *orig = cleanup;
-
-                            /* only bother with resize if there are enough to recover */
-                            if ( empty >= 4096 )
-                            {
-                                cleanup = malloc ( sizeof * cleanup - sizeof cleanup -> q
-                                    + sizeof cleanup -> q [ 0 ] * ( orig -> capacity - empty + extend ) );
-                                if ( cleanup == NULL )
-                                    rc = RC ( rcPS, rcQueue, rcInserting, rcMemory, rcExhausted );
-                                else
-                                {
-                                    cleanup -> capacity = orig -> capacity - empty + extend;
-                                }
-                            }
-
-                            /* rewrite count to remove leading NULL entries */
-                            cleanup -> count = orig -> count - empty;
-
-                            /* accumulate NULL entries into the start offset */
-                            cleanup -> start = orig -> start + empty;
-
-                            /* copy the tasks */
-                            for ( i = 0; i < cleanup -> count; ++ i )
-                                cleanup -> q [ i ] = orig -> q [ empty + i ];
-
-                            if ( ( const KCleanupTaskQueue* ) cleanup != orig )
-                            {
-                                self -> cleanup = cleanup;
-                                free ( ( void* ) orig );
-                            }
-                        }
-                    }
-
-                    /* detect valid queue for insertion */
-                    if ( rc == 0 )
-                    {
-                        /* assert that there is space for a task */
-                        assert ( cleanup -> count < cleanup -> capacity );
-
-                        /* record reference to task */
-                        cleanup -> q [ cleanup -> count ] = task;
-
-                        /* fill out the ticket information */
-                        ticket -> info [ 0 ] =  cleanup -> start + cleanup -> count;
-                        ticket -> info [ 1 ] = ( size_t ) task;
-                        ticket -> info [ 0 ] ^= ( size_t ) self;
-                        ticket -> info [ 1 ] ^= ( size_t ) self;
-                        ticket -> info [ 0 ] ^= ( size_t ) task;
-
-                        /* account for insertion */
-                        ++ cleanup -> count;
-                    }
-
-                    KLockUnlock ( self -> cleanup_lock );
-                }
-
-                if ( rc != 0 )
-                    KTaskRelease ( task );
-            }
-        }
-    }
-
-    return rc;
-}
-
-
-/* RemoveCleanupTask
- *  remove a task from exit queue
- *  releases reference to task object
- *  returns an rcNotFound code if task no longer exists
- */
-LIB_EXPORT rc_t CC KProcMgrRemoveCleanupTask ( KProcMgr *self, const KTaskTicket *ticket )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcPS, rcQueue, rcRemoving, rcSelf, rcNull );
-    else if ( self != s_proc_mgr )
-        rc = RC ( rcPS, rcQueue, rcRemoving, rcSelf, rcIncorrect );
-    else if ( ticket == NULL )
-        rc = RC ( rcPS, rcQueue, rcRemoving, rcId, rcNull );
-    else
-    {
-        /* recover task* and idx */
-        KTask *task = ( KTask* ) ( ( size_t ) ticket -> info [ 1 ] ^ ( size_t ) self );
-        uint64_t idx = ticket -> info [ 0 ] ^ ( size_t ) task;
-        idx ^= ( size_t ) self;
-
-        /* go into queue */
-        rc = KLockAcquire ( self -> cleanup_lock );
-        if ( rc == 0 )
-        {
-            KCleanupTaskQueue *cleanup = self -> cleanup;
-            if ( self -> cleanup == NULL )
-                rc = RC ( rcPS, rcQueue, rcRemoving, rcItem, rcNotFound );
-            else if ( idx < cleanup -> start )
-                rc = RC ( rcPS, rcQueue, rcRemoving, rcItem, rcNotFound );
-            else
-            {
-                idx -= cleanup -> start;
-                if ( idx >= cleanup -> count )
-                    rc = RC ( rcPS, rcQueue, rcRemoving, rcItem, rcNotFound );
-                else if ( cleanup -> q [ idx ] != task )
-                    rc = RC ( rcPS, rcQueue, rcRemoving, rcItem, rcNotFound );
-                else
-                {
-                    cleanup -> q [ idx ] = NULL;
-                }
-            }
-
-            KLockUnlock ( self -> cleanup_lock );
-        }
-
-        if ( rc == 0 )
-            KTaskRelease ( task );
-    }
-
-    return rc;
-}
diff --git a/libs/kproc/queue.c b/libs/kproc/queue.c
deleted file mode 100644
index 5b30d2e..0000000
--- a/libs/kproc/queue.c
+++ /dev/null
@@ -1,398 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kproc/q-extern.h>
-#include <kproc/queue.h>
-#include <kproc/timeout.h>
-#include <kproc/lock.h>
-#include <kproc/sem.h>
-#include <klib/out.h>
-#include <klib/rc.h>
-#include <atomic32.h>
-#include <os-native.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <assert.h>
-
-#if _DEBUGGING && 0
-#define QMSG( msg, ... ) \
-    KOutMsg ( msg, __VA_ARGS__ )
-#else
-#define QMSG( msg, ... ) \
-    ( void ) 0
-#endif
-
-/*--------------------------------------------------------------------------
- * KQueue
- *  a simple thread-safe queue structure supporting push/pop operation
- *  makes use of semaphore objects for synchronization
- */
-struct KQueue
-{
-    KSemaphore *rc;
-    KSemaphore *wc;
-
-    KLock *rl;
-    KLock *wl;
-
-    uint32_t capacity;
-    uint32_t bmask, imask;
-    volatile uint32_t read, write;
-    atomic32_t refcount;
-    volatile bool sealed;
-    uint8_t align [ 7 ];
-    void *buffer [ 16 ];
-};
-
-
-/* Whack
- */
-static
-rc_t KQueueWhack ( KQueue *self )
-{
-    rc_t rc;
-    QMSG ( "%s: releasing write semaphore\n", __func__ );
-    rc = KSemaphoreRelease ( self -> wc );
-    if ( rc == 0 )
-    {
-        QMSG ( "%s: releasing read semaphore\n", __func__ );
-        KSemaphoreRelease ( self -> rc );
-        QMSG ( "%s: releasing write lock\n", __func__ );
-        KLockRelease ( self -> wl );
-        QMSG ( "%s: releasing read lock\n", __func__ );
-        KLockRelease ( self -> rl );
-        free ( self );
-        QMSG ( "%s: done\n", __func__ );
-    }
-    return rc;
-}
-
-/* AddRef
- * Release
- *  ignores NULL references
- */
-LIB_EXPORT rc_t CC KQueueAddRef ( const KQueue *cself )
-{
-    if ( cself != NULL )
-        atomic32_inc ( & ( ( KQueue* ) cself ) -> refcount );
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KQueueRelease ( const KQueue *cself )
-{
-    KQueue *self = ( KQueue* ) cself;
-    if ( cself != NULL )
-    {
-        if ( atomic32_dec_and_test ( & self -> refcount ) )
-            return KQueueWhack ( self );
-    }
-    return 0;
-}
-
-/* Make
- * create an empty queue object
- *
- *  "capacity" [ IN ] - minimum queue length
- *  always expands to a power of 2, i.e. providing
- *  a length of 10 will result in a length of 16.
- */
-LIB_EXPORT rc_t CC KQueueMake ( KQueue **qp, uint32_t capacity )
-{
-    rc_t rc;
-    if ( qp == NULL )
-        rc = RC ( rcCont, rcQueue, rcConstructing, rcParam, rcNull );
-    else
-    {
-        KQueue *q;
-
-        uint32_t cap = 1;
-        while ( cap < capacity )
-            cap += cap;
-
-        q = malloc ( sizeof * q - sizeof q -> buffer + cap * sizeof q -> buffer [ 0 ] );
-        if ( q == NULL )
-            rc = RC ( rcCont, rcQueue, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            rc = KSemaphoreMake ( & q -> rc, 0 );
-            if ( rc == 0 )
-            {
-                rc = KSemaphoreMake ( & q -> wc, cap );
-                if ( rc == 0 )
-                {
-                    rc = KLockMake ( & q -> rl );
-                    if ( rc == 0 )
-                    {
-                        rc = KLockMake ( & q -> wl );
-                        if ( rc == 0 )
-                        {
-                            q -> capacity = cap;
-                            q -> bmask = cap - 1;
-                            q -> imask = ( cap + cap ) - 1;
-                            q -> read = q -> write = 0;
-                            atomic32_set ( & q -> refcount, 1 );
-                            q -> sealed = false;
-
-                            QMSG ( "%s: created queue with capacity %u, "
-                                   "bmask %#032b, imask %#032b.\n"
-                                   , __func__, q -> capacity, q -> bmask, q -> imask
-                                );
-
-                            * qp = q;
-                            return 0;
-                        }
-
-                        KLockRelease ( q -> rl );
-                    }
-
-                    KSemaphoreRelease ( q -> wc );
-                }
-
-                KSemaphoreRelease ( q -> rc );
-            }
-            free ( q );
-        }
-        * qp = NULL;
-    }
-    return rc;
-}
-
-/* Push
- *  add an object to the queue
- *
- *  "item" [ IN, OPAQUE ] - pointer to item being queued
- *
- *  "tm" [ IN, NULL OKAY ] - pointer to system specific timeout
- *  structure. if the queue is full, wait for indicated period
- *  of time for space to become available, or return status
- *  code indicating a timeout. when NULL and queue is full,
- *  Push will time out immediately and return status code.
- */
-LIB_EXPORT rc_t CC KQueuePush ( KQueue *self, const void *item, timeout_t *tm )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        return RC ( rcCont, rcQueue, rcInserting, rcSelf, rcNull );
-    if ( self -> sealed )
-    {
-        QMSG ( "%s: failed to insert into queue due to seal\n", __func__ );
-        return RC ( rcCont, rcQueue, rcInserting, rcQueue, rcReadonly );
-    }
-    if ( item == NULL )
-        return RC ( rcCont, rcQueue, rcInserting, rcTimeout, rcNull );
-
-    QMSG ( "%s: acquiring write lock ( %p )...\n", __func__, self -> wl );
-    rc = KLockAcquire ( self -> wl );
-    QMSG ( "%s: ...done, rc = %R\n", __func__, rc );
-    if ( rc == 0 )
-    {
-        QMSG ( "%s: waiting on write semaphore...\n", __func__ );
-        rc = KSemaphoreTimedWait ( self -> wc, self -> wl, tm );
-        QMSG ( "%s: ...done, rc = %R. unlocking write lock ( %p ).\n", __func__, rc, self -> wl );
-        KLockUnlock ( self -> wl );
-
-        if ( rc == 0 )
-        {
-            uint32_t w;
-
-            /* re-check the seal */
-            if ( self -> sealed )
-            {
-                QMSG ( "%s: queue has been sealed\n", __func__ );
-
-                /* not a disaster if semaphore not signaled */
-                QMSG ( "%s: acquiring write lock\n", __func__ );
-                if ( ! KLockAcquire ( self -> wl ) )
-                {
-                    QMSG ( "%s: signaling write semaphore\n", __func__ );
-                    KSemaphoreSignal ( self -> wc );
-                    QMSG ( "%s: unlocking write lock\n", __func__ );
-                    KLockUnlock ( self -> wl );
-                }
-
-                QMSG ( "%s: failed to insert into queue due to seal\n", __func__ );
-                return RC ( rcCont, rcQueue, rcInserting, rcQueue, rcReadonly );
-            }
-
-            /* insert item */
-            w = self -> write & self -> imask;
-            QMSG ( "%s: write index is %u, masked against 0x%x\n", __func__, w, self -> imask );
-            self -> buffer [ w & self -> bmask ] = ( void* ) item;
-            QMSG ( "%s: inserted item into buffer [ %u ], using mask 0x%x\n", __func__, w & self -> bmask, self -> bmask );
-            self -> write = w + 1;
-
-            /* let listeners know about item */
-            QMSG ( "%s: acquiring read lock ( %p )\n", __func__, self -> rl );
-            if ( KLockAcquire ( self -> rl ) == 0 )
-            {
-                QMSG ( "%s: signaling read semaphore\n", __func__ );
-                KSemaphoreSignal ( self -> rc );
-                QMSG ( "%s: unlocking read lock ( %p )\n", __func__, self -> rl );
-                KLockUnlock ( self -> rl );
-            }
-        }
-    }
-
-    return rc;
-}
-
-/* Pop
- *  pop an object from queue
- *
- *  "item" [ OUT, OPAQUE* ] - return parameter for popped item
- *
- *  "tm" [ IN, NULL OKAY ] - pointer to system specific timeout
- *  structure. if the queue is empty, wait for indicated period
- *  of time for an object to become available, or return status
- *  code indicating a timeout. when NULL and queue is empty,
- *  Pop will time out immediately and return status code.
- */
-LIB_EXPORT rc_t CC KQueuePop ( KQueue *self, void **item, timeout_t *tm )
-{
-    rc_t rc;
-
-    if ( item == NULL )
-        rc = RC ( rcCont, rcQueue, rcRemoving, rcParam, rcNull );
-    else
-    {
-        * item = NULL;
-
-        if ( self == NULL )
-            rc = RC ( rcCont, rcQueue, rcRemoving, rcSelf, rcNull );
-        else
-        {
-            QMSG ( "%s: acquiring read lock ( %p )\n", __func__, self -> rl );
-            rc = KLockAcquire ( self -> rl );
-            if ( rc == 0 )
-            {
-                QMSG ( "%s: waiting on read semaphore...\n", __func__ );
-                rc = KSemaphoreTimedWait ( self -> rc, self -> rl, self -> sealed ? NULL : tm );
-                QMSG ( "%s: ...done, rc = %R. unlocking read lock. ( %p )\n", __func__, rc, self -> rl );
-                KLockUnlock ( self -> rl );
-
-                if ( rc == 0 )
-                {
-                    uint32_t r, idx;
-
-                    /* got an element */
-                    QMSG ( "%s: asserting  self -> read ( %u ) != self -> write ( %u )\n",
-                           __func__, self -> read, self -> write
-                        );
-                    assert ( self -> read != self -> write );
-
-                    /* read element */
-                    r = self -> read & self -> imask;
-                    QMSG ( "%s: read index is %u, masked against 0x%x\n", __func__, r, self -> imask );
-                    idx = r & self -> bmask;
-                    * item = self -> buffer [ idx ];
-                    QMSG ( "%s: read item from buffer [ %u ], using mask 0x%x\n", __func__, idx, self -> bmask );
-                    self -> buffer [ idx ] = NULL;
-                    self -> read = r + 1;
-
-                    /* let write know there's a free slot available */
-                    QMSG ( "%s: acquiring write lock ( %p )\n", __func__, self -> wl );
-                    if ( KLockAcquire ( self -> wl ) == 0 )
-                    {
-                        QMSG ( "%s: signaling write semaphore\n", __func__ );
-                        KSemaphoreSignal ( self -> wc );
-                        QMSG ( "%s: unlocking write lock ( %p )\n", __func__, self -> wl );
-                        KLockUnlock ( self -> wl );
-                    }
-                }
-                else if ( self -> sealed && GetRCObject ( rc ) == rcTimeout )
-                {
-                    rc = RC ( rcCont, rcQueue, rcRemoving, rcData, rcDone );
-                    QMSG ( "%s: resetting rc to %R\n", __func__, rc );
-                }
-            }
-        }
-    }
-
-    return rc;
-}
-
-/* Sealed
- *  ask if the queue has been closed off
- *  meaning there will be no further push operations
- *
- *  NB - if "self" is NULL, the return value is "true"
- *  since a NULL queue cannot accept items via push
- */
-LIB_EXPORT bool CC KQueueSealed ( const KQueue *self )
-{
-    QMSG ( "%s called\n", __func__ );
-    if ( self != NULL )
-        return self -> sealed;
-    return false;
-}
-
-
-/* Seal
- *  indicate that the queue has been closed off
- *  meaning there will be no further push operations
- *  if "writes" is true, and no further pop operations
- *  otherwise.
- */
-LIB_EXPORT rc_t CC KQueueSeal ( KQueue *self )
-{
-    rc_t rc = 0;
-
-    QMSG ( "%s called\n", __func__ );
-
-    if ( self == NULL )
-        return RC ( rcCont, rcQueue, rcFreezing, rcSelf, rcNull );
-
-    self -> sealed = true;
-
-#if 0
-    QMSG ( "%s: acquiring write lock ( %p )\n", __func__, self -> wl );
-    rc = KLockAcquire ( self -> wl );
-    if ( rc == 0 )
-    {
-        QMSG ( "%s: canceling write semaphore...\n", __func__ );
-        rc = KSemaphoreCancel ( self -> wc );
-        QMSG ( "%s: ...done, rc = %R.\n", __func__, rc );
-        KLockUnlock ( self -> wl );
-
-        if ( rc == 0 )
-        {
-            QMSG ( "%s: acquiring read lock ( %p )\n", __func__, self -> rl );
-            rc = KLockAcquire ( self -> rl );
-            if ( rc == 0 )
-            {
-                QMSG ( "%s: canceling read semaphore...\n", __func__ );
-                rc = KSemaphoreCancel ( self -> rc );
-                QMSG ( "%s: ...done, rc = %R.\n", __func__, rc );
-                KLockUnlock ( self -> rl );
-            }
-        }
-    }
-#endif
-
-    return rc;
-}
diff --git a/libs/kproc/sem.c b/libs/kproc/sem.c
deleted file mode 100644
index 822f8cb..0000000
--- a/libs/kproc/sem.c
+++ /dev/null
@@ -1,435 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include "syscond-priv.h"
-#include <kproc/extern.h>
-#include <kproc/sem.h>
-#include <kproc/cond.h>
-#include <klib/out.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-#include <atomic32.h>
-
-#include <stdlib.h>
-
-#if _DEBUGGING && 0
-#define SMSG( msg, ... ) \
-    KOutMsg ( msg, __VA_ARGS__ )
-#else
-#define SMSG( msg, ... ) \
-    ( void ) 0
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KSemaphore
- *  a metering device
- */
-struct KSemaphore
-{
-    volatile uint64_t avail;
-    volatile uint64_t requested;
-    volatile uint64_t min_requested;
-    KCondition* cond;
-    volatile uint32_t waiting;
-    volatile bool uniform;
-};
-
-
-/* Whack
- */
-static
-rc_t KSemaphoreWhack ( KSemaphore *self )
-{
-    rc_t rc;
-
-    if ( self -> waiting != 0 )
-        return RC ( rcPS, rcSemaphore, rcDestroying, rcSemaphore, rcBusy );
-
-    rc = KConditionRelease ( self -> cond );
-    if ( rc != 0 )
-        return ResetRCContext ( rc, rcPS, rcSemaphore, rcDestroying );
-
-    free ( self );
-    return 0;
-}
-
-
-/* Make
- *
- *  "count" [ IN ] - initial count value
- */
-LIB_EXPORT rc_t CC KSemaphoreMake ( KSemaphore **semp, uint64_t count )
-{
-    rc_t rc;
-    if ( semp == NULL )
-        rc = RC ( rcPS, rcSemaphore, rcConstructing, rcParam, rcNull );
-    else
-    {
-        KSemaphore *sem = malloc ( sizeof * sem );
-        if ( sem == NULL )
-            rc = RC ( rcPS, rcSemaphore, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            rc = KConditionMake( & sem -> cond );
-            if ( rc == 0 )
-            {
-                sem -> avail = count;
-                sem -> requested = 0;
-                sem -> min_requested = 0;
-                sem -> waiting = 0;
-                sem -> uniform = false;
-
-                * semp = sem;
-                return 0;
-            }
-
-            free ( sem );
-        }
-
-        * semp = NULL;
-    }
-    return rc;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KSemaphoreAddRef ( const KSemaphore *cself )
-{
-    if ( cself != NULL )
-        return KConditionAddRef ( cself -> cond );
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KSemaphoreRelease ( const KSemaphore *cself )
-{
-    if ( cself != NULL )
-    {
-        if ( KConditionDropRef ( cself -> cond ) )
-            return KSemaphoreWhack ( ( KSemaphore* ) cself );
-    }
-    return 0;
-}
-
-
-/* Wait
- *  block until a count becomes available
- *
- *  "lock" [ IN ] - externally acquired lock
- */
-LIB_EXPORT rc_t CC KSemaphoreWait ( KSemaphore *self, struct KLock *lock )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcSemaphore, rcWaiting, rcSelf, rcNull );
-
-    if ( self -> avail == 0 )
-    {
-        if ( ++ self -> waiting == 1 )
-        {
-            self -> requested = self -> min_requested = 1;
-            self -> uniform = true;
-        }
-        else if ( self -> requested != 1 )
-        {
-            self -> min_requested = 1;
-            self -> uniform = false;
-        }
-
-        do
-        {
-            rc_t rc = KConditionWait ( self -> cond, lock );
-            if ( rc != 0 )
-            {
-                -- self -> waiting;
-                return ResetRCContext ( rc, rcPS, rcSemaphore, rcWaiting );
-            }
-        }
-        while ( self -> avail == 0 );
-
-        -- self -> waiting;
-    }
-
-    -- self -> avail;
-    return 0;
-}
-
-/* TimedWait
- *  block until a count becomes available
- *
- *  "lock" [ IN ] - externally acquired lock
- *
- *  "tm" [ IN, NULL OKAY ] - optional timeout where
- *  NULL means timeout value of 0
- */
-LIB_EXPORT rc_t CC KSemaphoreTimedWait ( KSemaphore *self,
-    struct KLock *lock, struct timeout_t *tm )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcSemaphore, rcWaiting, rcSelf, rcNull );
-
-    if ( self -> avail == 0 )
-    {
-        SMSG ( "%s[%p]: avail == 0\n", __func__, self );
-        if ( tm == NULL )
-        {
-            SMSG ( "%s[%p]: non-blocking mode - return timeout exhausted\n", __func__, self );
-            return RC ( rcPS, rcSemaphore, rcWaiting, rcTimeout, rcExhausted );
-        }
-
-        if ( ++ self -> waiting == 1 )
-        {
-            SMSG ( "%s[%p]: first waiter\n", __func__, self );
-            self -> requested = self -> min_requested = 1;
-            self -> uniform = true;
-        }
-        else if ( self -> requested != 1 )
-        {
-            SMSG ( "%s[%p]: multiple waiters ( %u )\n", __func__, self, self -> waiting );
-            self -> min_requested = 1;
-            self -> uniform = false;
-        }
-
-        do
-        {
-            rc_t rc;
-
-            SMSG ( "%s[%p]: wait on condition...\n", __func__, self );
-            rc = KConditionTimedWait ( self -> cond, lock, tm );
-            SMSG ( "%s[%p]:...done, rc = %R\n", __func__, self, rc );
-            if ( rc != 0 )
-            {
-                SMSG ( "%s[%p]: timed out - decrementing wait count\n", __func__, self );
-                -- self -> waiting;
-                return ResetRCContext ( rc, rcPS, rcSemaphore, rcWaiting );
-            }
-
-            SMSG ( "%s[%p]: condition signaled - avail = %lu\n", __func__, self, self -> avail );
-        }
-        while ( self -> avail == 0 );
-
-        SMSG ( "%s[%p]: finished waiting\n", __func__, self );
-        -- self -> waiting;
-    }
-
-    SMSG ( "%s[%p]: decrementing count from %lu\n", __func__, self, self -> avail );
-    -- self -> avail;
-    return 0;
-}
-
-
-/* Cancel
- *  signal that the count will never increase
- */
-LIB_EXPORT rc_t CC KSemaphoreCancel ( KSemaphore *self )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcSemaphore, rcSignaling, rcSelf, rcNull );
-
-    if ( self -> waiting != 0 )
-    {
-        SMSG ( "%s[%p]: canceling %u waiters\n", __func__, self, self -> waiting );
-        return KConditionBroadcast ( self -> cond );
-    }
-
-    SMSG ( "%s[%p]: cancel request ( no waiters )\n", __func__, self );
-    return 0;
-}
-
-
-/* Signal
- *  signal that a count has become available
- */
-LIB_EXPORT rc_t CC KSemaphoreSignal ( KSemaphore *self )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcSemaphore, rcSignaling, rcSelf, rcNull );
-
-    ++ self -> avail;
-    if ( self -> waiting != 0 && self -> avail >= self -> min_requested )
-    {
-        /* whacky logic
-           - if everyone has requested the same amount
-           - and only one request can be satisfied
-           - then signal. otherwise, broadcast */
-        if ( self -> uniform && self -> avail / self -> min_requested == 1 )
-            return KConditionSignal ( self -> cond );
-        return KConditionBroadcast ( self -> cond );
-    }
-
-    return 0;
-}
-
-
-/* Alloc
- *  allocate a count
- *  used for resource metering
- *
- *  "lock" [ IN ] - externally acquired lock
- *
- *  "count" [ IN ] - the resource count
- */
-LIB_EXPORT rc_t CC KSemaphoreAlloc ( KSemaphore *self,
-    struct KLock *lock, uint64_t count )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcSemaphore, rcWaiting, rcSelf, rcNull );
-
-    if ( self -> avail < count )
-    {
-        if ( ++ self -> waiting == 1 )
-        {
-            self -> requested = self -> min_requested = count;
-            self -> uniform = true;
-        }
-        else if ( self -> requested != count )
-        {
-            if ( self -> min_requested > count )
-                self -> min_requested = count;
-            self -> uniform = false;
-        }
-
-        do
-        {
-            rc_t rc = KConditionWait ( self -> cond, lock );
-            if ( rc != 0 )
-            {
-                -- self -> waiting;
-                return ResetRCContext ( rc, rcPS, rcSemaphore, rcWaiting );
-            }
-        }
-        while ( self -> avail < count );
-
-        -- self -> waiting;
-    }
-
-    self -> avail -= count;
-    return 0;
-}
-
-/* TimedAlloc
- *  allocate a count
- *  used for resource metering
- *
- *  "lock" [ IN ] - externally acquired lock
- *
- *  "count" [ IN ] - the resource count
- *
- *  "tm" [ IN, NULL OKAY ] - optional timeout where
- *  NULL means timeout value of 0
- */
-LIB_EXPORT rc_t CC KSemaphoreTimedAlloc ( KSemaphore *self,
-    struct KLock *lock, uint64_t count, struct timeout_t *tm )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcSemaphore, rcWaiting, rcSelf, rcNull );
-
-    if ( self -> avail < count )
-    {
-        if ( tm == NULL )
-            return RC ( rcPS, rcSemaphore, rcWaiting, rcTimeout, rcExhausted );
-
-        if ( ++ self -> waiting == 1 )
-        {
-            self -> requested = self -> min_requested = count;
-            self -> uniform = true;
-        }
-        else if ( self -> requested != count )
-        {
-            if ( self -> min_requested > count )
-                self -> min_requested = count;
-            self -> uniform = false;
-        }
-
-        do
-        {
-            rc_t rc = KConditionTimedWait ( self -> cond, lock, tm );
-            if ( rc != 0 )
-            {
-                -- self -> waiting;
-                return ResetRCContext ( rc, rcPS, rcSemaphore, rcWaiting );
-            }
-        }
-        while ( self -> avail < count );
-
-        -- self -> waiting;
-    }
-
-    self -> avail -= count;
-    return 0;
-}
-
-
-/* Free
- *  signal that resources have become available
- */
-LIB_EXPORT rc_t CC KSemaphoreFree ( KSemaphore *self, uint64_t count )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcSemaphore, rcSignaling, rcSelf, rcNull );
-
-    self -> avail += count;
-    if ( self -> waiting != 0 && self -> avail >= self -> min_requested )
-    {
-        /* whacky logic
-           - if everyone has requested the same amount
-           - and only one request can be satisfied
-           - then signal. otherwise, broadcast */
-        if ( self -> uniform && self -> avail / self -> min_requested == 1 )
-            return KConditionSignal ( self -> cond );
-        return KConditionBroadcast ( self -> cond );
-    }
-
-    return 0;
-}
-
-
-/* Count
- *  request the current resource usage
- *  valid only within lock
- *
- *  "count" [ OUT ] - return parameter for current count
- */
-LIB_EXPORT rc_t CC KSemaphoreCount ( const KSemaphore *self, uint64_t *count )
-{
-    rc_t rc;
-    if ( count == NULL )
-        rc = RC ( rcPS, rcSemaphore, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcPS, rcSemaphore, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            * count = self -> avail;
-            return 0;
-        }
-
-        * count = 0;
-    }
-    return rc;
-}
diff --git a/libs/kproc/stbarrier.c b/libs/kproc/stbarrier.c
deleted file mode 100644
index 56b621b..0000000
--- a/libs/kproc/stbarrier.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kproc/extern.h>
-#include <kproc/barrier.h>
-#include <klib/rc.h>
-#include <atomic32.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-
-/*--------------------------------------------------------------------------
- * KBarrier
- *  a thread synchronization device
- *  detains all callers until the required number has been reached
- */
-struct KBarrier
-{
-    atomic32_t refcount;
-    uint32_t barrier;
-    uint32_t count;
-};
-
-
-/* Whack
- */
-static
-rc_t KBarrierWhack ( KBarrier *self )
-{
-    free ( self );
-    return 0;
-}
-
-
-/* Make
- *  create a barrier
- *
- *  "count" [ IN ] - the number of threads to block
- */
-LIB_EXPORT rc_t CC KBarrierMake ( KBarrier **bp, uint32_t count )
-{
-    rc_t rc;
-    if ( bp == NULL )
-        rc = RC ( rcPS, rcBarrier, rcConstructing, rcParam, rcNull );
-    else
-    {
-        KBarrier *b = malloc ( sizeof * b );
-        if ( b == NULL )
-            rc = RC ( rcPS, rcBarrier, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            atomic32_set ( & b -> refcount, 1 );
-            b -> barrier = count;
-            b -> count = 0;
-            * bp = b;
-            return 0;
-        }
-
-        * bp = NULL;
-    }
-    return rc;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KBarrierAddRef ( const KBarrier *cself )
-{
-    if ( cself != NULL )
-        atomic32_inc ( & ( ( KBarrier* ) cself ) -> refcount );
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KBarrierRelease ( const KBarrier *cself )
-{
-    KBarrier *self = ( KBarrier* ) cself;
-    if ( cself != NULL )
-    {
-        if ( atomic32_dec_and_test ( & self -> refcount ) )
-        {
-            atomic32_set ( & self -> refcount, 1 );
-            return KBarrierWhack ( self );
-        }
-    }
-    return 0;
-}
-
-
-/* Wait
- *  block until the required number of callers has been reached
- */
-LIB_EXPORT rc_t CC KBarrierWait ( KBarrier *self )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcBarrier, rcWaiting, rcSelf, rcNull );
-
-    if ( ++ self -> count < self -> barrier )
-    {
-        -- self -> count;
-        return RC ( rcPS, rcBarrier, rcWaiting, rcThread, rcDeadlock );
-    }
-
-    return 0;
-}
diff --git a/libs/kproc/stcond.c b/libs/kproc/stcond.c
deleted file mode 100644
index 79084bf..0000000
--- a/libs/kproc/stcond.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <kproc/extern.h>
-#include <kproc/cond.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-#include <atomic32.h>
-
-#include <stdlib.h>
-
-
-/*--------------------------------------------------------------------------
- * KCondition
- *  a POSIX-style condition object
- */
-struct KCondition
-{
-    atomic32_t refcount;
-};
-
-
-/* Whack
- */
-static
-rc_t KConditionWhack ( KCondition *self )
-{
-    free ( self );
-    return 0;
-}
-
-
-/* Make
- *  create a condition
- */
-LIB_EXPORT rc_t CC KConditionMake ( KCondition **condp )
-{
-    rc_t rc;
-    if ( condp == NULL )
-        rc = RC ( rcPS, rcCondition, rcConstructing, rcParam, rcNull );
-    else
-    {
-        KCondition *cond = malloc ( sizeof * cond );
-        if ( cond == NULL )
-            rc = RC ( rcPS, rcCondition, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            atomic32_set ( & cond -> refcount, 1 );
-            * condp = cond;
-            return 0;
-        }
-
-        * condp = NULL;
-    }
-    return rc;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KConditionAddRef ( const KCondition *cself )
-{
-    if ( cself != NULL )
-        atomic32_inc ( & ( ( KCondition* ) cself ) -> refcount );
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KConditionRelease ( const KCondition *cself )
-{
-    KCondition *self = ( KCondition* ) cself;
-    if ( cself != NULL )
-    {
-        if ( atomic32_dec_and_test ( & self -> refcount ) )
-            return KConditionWhack ( self );
-    }
-    return 0;
-}
-
-
-/* Wait
- *  block on external lock until signaled
- */
-LIB_EXPORT rc_t CC KConditionWait ( KCondition *self, struct KLock *lock )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcCondition, rcWaiting, rcSelf, rcNull );
-    if ( lock == NULL )
-        return RC ( rcPS, rcCondition, rcWaiting, rcLock, rcNull );
-
-    return RC ( rcPS, rcCondition, rcWaiting, rcThread, rcDeadlock );
-}
-
-LIB_EXPORT rc_t CC KConditionTimedWait ( KCondition *self, struct KLock *lock, struct timeout_t *tm )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcCondition, rcWaiting, rcSelf, rcNull );
-    if ( lock == NULL )
-        return RC ( rcPS, rcCondition, rcWaiting, rcLock, rcNull );
-    if ( tm == NULL )
-        return RC ( rcPS, rcCondition, rcWaiting, rcTimeout, rcNull );
-
-    return RC ( rcPS, rcCondition, rcWaiting, rcThread, rcDeadlock );
-}
-
-
-/* Signal
- *  signal waiting threads
- *  awaken at most a single thread
- */
-LIB_EXPORT rc_t CC KConditionSignal ( KCondition *self )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcCondition, rcSignaling, rcSelf, rcNull );
-
-    return RC ( rcPS, rcCondition, rcSignaling, rcThread, rcDeadlock );
-}
-
-
-/* Broadcast
- *  signal waiting threads
- *  awaken all waiting thread
- */
-LIB_EXPORT rc_t CC KConditionBroadcast ( KCondition *self )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcCondition, rcSignaling, rcSelf, rcNull );
-
-    return RC ( rcPS, rcCondition, rcSignaling, rcThread, rcDeadlock );
-}
diff --git a/libs/kproc/stlock.c b/libs/kproc/stlock.c
deleted file mode 100644
index dc5a961..0000000
--- a/libs/kproc/stlock.c
+++ /dev/null
@@ -1,311 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <kproc/extern.h>
-#include <kproc/lock.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-#include <atomic32.h>
-
-#include <stdlib.h>
-
-/*--------------------------------------------------------------------------
- * KLock
- *  a POSIX-style mutual exclusion lock
- */
-struct KLock
-{
-    atomic32_t refcount;
-    int32_t count;
-};
-
-
-/* Whack
- */
-static
-rc_t KLockWhack ( KLock *self )
-{
-    if ( self -> count > 0 )
-        return RC ( rcPS, rcLock, rcDestroying, rcLock, rcBusy );
-
-    free ( self );
-    return 0;
-}
-
-
-/* Make
- *  make a simple mutex
- */
-LIB_EXPORT rc_t CC KLockMake ( KLock **lockp )
-{
-    rc_t rc;
-    if ( lockp == NULL )
-        rc = RC ( rcPS, rcLock, rcConstructing, rcParam, rcNull );
-    else
-    {
-        KLock *lock = malloc ( sizeof * lock );
-        if ( lock == NULL )
-            rc = RC ( rcPS, rcLock, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            atomic32_set ( & lock -> refcount, 1 );
-            lock -> count = 0;
-            * lockp = lock;
-            return 0;
-        }
-
-        * lockp = NULL;
-    }
-    return rc;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KLockAddRef ( const KLock *cself )
-{
-    if ( cself != NULL )
-        atomic32_inc ( & ( ( KLock* ) cself ) -> refcount );
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KLockRelease ( const KLock *cself )
-{
-    KLock *self = ( KLock* ) cself;
-    if ( cself != NULL )
-    {
-        if ( atomic32_dec_and_test ( & self -> refcount ) )
-        {
-            atomic32_set ( & self -> refcount, 1 );
-            return KLockWhack ( self );
-        }
-    }
-    return 0;
-}
-
-
-/* Acquire
- *  acquires lock
- */
-LIB_EXPORT rc_t CC KLockAcquire ( KLock *self )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcLock, rcLocking, rcSelf, rcNull );
-
-    ++ self -> count;
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KLockTimedAcquire ( KLock *self, struct timeout_t *tm )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcLock, rcLocking, rcSelf, rcNull );
-
-    ++ self -> count;
-
-    return 0;
-}
-
-/* Unlock
- *  releases lock
- */
-LIB_EXPORT rc_t CC KLockUnlock ( KLock *self )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcLock, rcUnlocking, rcSelf, rcNull );
-
-    /* pthread_mutex_unlock's man page states that the only
-       unlock error we could see is that another thread tries
-       to release a lock. what if the lock is not locked? */
-    if ( self -> count <= 0 )
-        return RC ( rcPS, rcLock, rcUnlocking, rcThread, rcIncorrect );
-
-    -- self -> count;
-
-    return 0;
-}
-
-
-/*--------------------------------------------------------------------------
- * KRWLock
- *  a POSIX-style read/write lock
- */
-struct KRWLock
-{
-    atomic32_t refcount;
-    int32_t count;
-};
-
-
-/* Whack
- */
-static
-rc_t KRWLockWhack ( KRWLock *self )
-{
-    if ( self -> count != 0 )
-        return RC ( rcPS, rcRWLock, rcDestroying, rcRWLock, rcBusy );
-
-    free ( self );
-    return 0;
-}
-
-
-/* Make
- *  make a simple read/write lock
- */
-LIB_EXPORT rc_t CC KRWLockMake ( KRWLock **lockp )
-{
-    rc_t rc;
-
-    if ( lockp == NULL )
-        rc = RC ( rcPS, rcRWLock, rcConstructing, rcParam, rcNull );
-    else
-    {
-        KRWLock *lock = malloc ( sizeof * lock );
-        if ( lock == NULL )
-            rc = RC ( rcPS, rcRWLock, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            atomic32_set ( & lock -> refcount, 1 );
-            lock -> count = 0;
-            * lockp = lock;
-            return 0;
-        }
-
-        * lockp = NULL;
-    }
-
-    return rc;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KRWLockAddRef ( const KRWLock *cself )
-{
-    if ( cself != NULL )
-        atomic32_inc ( & ( ( KRWLock* ) cself ) -> refcount );
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KRWLockRelease ( const KRWLock *cself )
-{
-    KRWLock *self = ( KRWLock* ) cself;
-    if ( cself != NULL )
-    {
-        if ( atomic32_dec_and_test ( & self -> refcount ) )
-        {
-            atomic32_set ( & self -> refcount, 1 );
-            return KRWLockWhack ( self );
-        }
-    }
-    return 0;
-}
-
-
-/* AcquireShared
- *  acquires read ( shared ) lock
- */
-LIB_EXPORT rc_t CC KRWLockAcquireShared ( KRWLock *self )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcRWLock, rcLocking, rcSelf, rcNull );
-
-    if ( self -> count < 0 )
-        return RC ( rcPS, rcRWLock, rcLocking, rcThread, rcDeadlock );
-
-    ++ self -> count;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KRWLockTimedAcquireShared ( KRWLock *self, struct timeout_t *tm )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcRWLock, rcLocking, rcSelf, rcNull );
-
-    if ( self -> count < 0 )
-    {
-        if ( tm == NULL )
-            return RC ( rcPS, rcLock, rcLocking, rcRWLock, rcBusy );
-        return RC ( rcPS, rcRWLock, rcLocking, rcTimeout, rcExhausted );
-    }
-
-    ++ self -> count;
-    return 0;
-}
-
-
-/* AcquireExcl
- *  acquires write ( exclusive ) lock
- */
-LIB_EXPORT rc_t CC KRWLockAcquireExcl ( KRWLock *self )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcRWLock, rcLocking, rcSelf, rcNull );
-
-    if ( self -> count != 0 )
-        return RC ( rcPS, rcRWLock, rcLocking, rcThread, rcDeadlock );
-
-    -- self -> count;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KRWLockTimedAcquireExcl ( KRWLock *self, struct timeout_t *tm )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcRWLock, rcLocking, rcSelf, rcNull );
-
-    if ( self -> count != 0 )
-    {
-        if ( tm == NULL )
-            return RC ( rcPS, rcLock, rcLocking, rcRWLock, rcBusy );
-        return RC ( rcPS, rcRWLock, rcLocking, rcTimeout, rcExhausted );
-    }
-
-    -- self -> count;
-    return 0;
-}
-
-
-/* Unlock
- *  releases lock
- */
-LIB_EXPORT rc_t CC KRWLockUnlock ( KRWLock *self )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcRWLock, rcUnlocking, rcSelf, rcNull );
-
-    if ( self -> count < 0 )
-        self -> count = 0;
-    else if ( self -> count > 0 )
-        -- self -> count;
-    else
-        return RC ( rcPS, rcRWLock, rcUnlocking, rcThread, rcIncorrect );
-
-    return 0;
-}
diff --git a/libs/kproc/stsem.c b/libs/kproc/stsem.c
deleted file mode 100644
index 458c9ce..0000000
--- a/libs/kproc/stsem.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kproc/extern.h>
-#include <kproc/sem.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-#include <atomic32.h>
-
-#include <stdlib.h>
-
-
-/*--------------------------------------------------------------------------
- * KSemaphore
- *  a metering device
- */
-struct KSemaphore
-{
-    uint64_t avail;
-    atomic32_t refcount;
-};
-
-
-/* Whack
- */
-static
-rc_t KSemaphoreWhack ( KSemaphore *self )
-{
-    free ( self );
-    return 0;
-}
-
-
-/* Make
- *
- *  "count" [ IN ] - initial count value
- */
-LIB_EXPORT rc_t CC KSemaphoreMake ( KSemaphore **semp, uint64_t count )
-{
-    rc_t rc;
-    if ( semp == NULL )
-        rc = RC ( rcPS, rcSemaphore, rcConstructing, rcParam, rcNull );
-    else
-    {
-        KSemaphore *sem = malloc ( sizeof * sem );
-        if ( sem == NULL )
-            rc = RC ( rcPS, rcSemaphore, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            sem -> avail = count;
-            atomic32_set ( & sem -> refcount, 1 );
-            * semp = sem;
-            return 0;
-        }
-
-        * semp = NULL;
-    }
-    return rc;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KSemaphoreAddRef ( const KSemaphore *cself )
-{
-    if ( cself != NULL )
-        atomic32_inc ( & ( ( KSemaphore* ) cself ) -> refcount );
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KSemaphoreRelease ( const KSemaphore *cself )
-{
-    KSemaphore *self = ( KSemaphore* ) cself;
-    if ( cself != NULL )
-    {
-        if ( atomic32_dec_and_test ( & self -> refcount ) )
-            return KSemaphoreWhack ( self );
-    }
-    return 0;
-}
-
-
-/* Wait
- *  block until a count becomes available
- *
- *  "lock" [ IN ] - externally acquired lock
- */
-LIB_EXPORT rc_t CC KSemaphoreWait ( KSemaphore *self, struct KLock *lock )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcSemaphore, rcWaiting, rcSelf, rcNull );
-
-    if ( self -> avail == 0 )
-        return RC ( rcPS, rcSemaphore, rcWaiting, rcThread, rcDeadlock );
-
-    -- self -> avail;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KSemaphoreTimedWait ( KSemaphore *self,
-    struct KLock *lock, struct timeout_t *tm )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcSemaphore, rcWaiting, rcSelf, rcNull );
-
-    if ( self -> avail == 0 )
-    {
-        if ( tm == NULL )
-            return RC ( rcPS, rcSemaphore, rcWaiting, rcTimeout, rcNull );
-
-        return RC ( rcPS, rcSemaphore, rcWaiting, rcThread, rcDeadlock );
-    }
-
-    -- self -> avail;
-    return 0;
-}
-
-
-/* Signal
- *  signal that a count has become available
- */
-LIB_EXPORT rc_t CC KSemaphoreSignal ( KSemaphore *self )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcSemaphore, rcSignaling, rcSelf, rcNull );
-
-    ++ self -> avail;
-    return 0;
-}
-
-
-/* Alloc
- *  allocate a count
- *  used for resource metering
- *
- *  "lock" [ IN ] - externally acquired lock
- *
- *  "count" [ IN ] - the resource count
- */
-LIB_EXPORT rc_t CC KSemaphoreAlloc ( KSemaphore *self,
-    struct KLock *lock, uint64_t count )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcSemaphore, rcWaiting, rcSelf, rcNull );
-
-    if ( self -> avail < count )
-        return RC ( rcPS, rcSemaphore, rcWaiting, rcThread, rcDeadlock );
-
-    self -> avail -= count;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KSemaphoreTimedAlloc ( KSemaphore *self,
-    struct KLock *lock, uint64_t count, struct timeout_t *tm )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcSemaphore, rcWaiting, rcSelf, rcNull );
-
-    if ( self -> avail < count )
-    {
-        if ( tm == NULL )
-            return RC ( rcPS, rcSemaphore, rcWaiting, rcTimeout, rcNull );
-
-        return RC ( rcPS, rcSemaphore, rcWaiting, rcThread, rcDeadlock );
-    }
-
-    self -> avail -= count;
-    return 0;
-}
-
-
-/* Free
- *  signal that resources have become available
- */
-LIB_EXPORT rc_t CC KSemaphoreFree ( KSemaphore *self, uint64_t count )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcSemaphore, rcSignaling, rcSelf, rcNull );
-
-    self -> avail += count;
-    return 0;
-}
-
-
-/* Count
- *  request the current resource usage
- *  valid only within lock
- *
- *  "count" [ OUT ] - return parameter for current count
- */
-LIB_EXPORT rc_t CC KSemaphoreCount ( const KSemaphore *self, uint64_t *count )
-{
-    rc_t rc;
-    if ( count == NULL )
-        rc = RC ( rcPS, rcSemaphore, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcPS, rcSemaphore, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            * count = self -> avail;
-            return 0;
-        }
-
-        * count = 0;
-    }
-    return rc;
-}
diff --git a/libs/kproc/stthread.c b/libs/kproc/stthread.c
deleted file mode 100644
index 982b13b..0000000
--- a/libs/kproc/stthread.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <kproc/extern.h>
-#include <kproc/thread.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-#include <atomic32.h>
-
-#include <stdlib.h>
-
-/*--------------------------------------------------------------------------
- * KThread
- *  a CPU execution thread
- */
-struct KThread
-{
-    atomic32_t refcount;
-    rc_t rc;
-};
-
-
-/* Whack
- */
-static
-rc_t KThreadWhack ( KThread *self )
-{
-    free ( self );
-    return 0;
-}
-
-
-/* Make
- *  create and run a thread
- *
- *  "run_thread" [ IN ] - thread entrypoint
- *
- *  "data" [ IN, OPAQUE ] - user-supplied thread data
- */
-LIB_EXPORT rc_t CC KThreadMake ( KThread **tp,
-    rc_t ( * run_thread ) ( const KThread*, void* ), void *data )
-{
-    rc_t rc;
-    if ( tp == NULL )
-        rc = RC ( rcPS, rcThread, rcCreating, rcParam, rcNull );
-    else
-    {
-        if ( run_thread == NULL )
-            rc = RC ( rcPS, rcThread, rcCreating, rcFunction, rcNull );
-        else
-        {
-            KThread *t = malloc ( sizeof * t );
-            if ( t == NULL )
-                rc = RC ( rcPS, rcThread, rcCreating, rcMemory, rcExhausted );
-            else
-            {
-                /* run function on current thread */
-                atomic32_set ( & t -> refcount, 1 );
-                t -> rc = ( * run_thread ) ( t, data );
-                * tp = t;
-                return 0;
-            }
-        }
-
-        * tp = NULL;
-    }
-    return rc;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KThreadAddRef ( const KThread *cself )
-{
-    if ( cself != NULL )
-        atomic32_inc ( & ( ( KThread* ) cself ) -> refcount );
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KThreadRelease ( const KThread *cself )
-{
-    KThread *self = ( KThread* ) cself;
-    if ( cself != NULL )
-    {
-        if ( atomic32_dec_and_test ( & self -> refcount ) )
-            return KThreadWhack ( self );
-    }
-    return 0;
-}
-
-
-/* Cancel
- *  signal the thread to finish
- */
-LIB_EXPORT rc_t CC KThreadCancel ( KThread *self )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcThread, rcSignaling, rcSelf, rcNull );
-    return RC ( rcPS, rcThread, rcSignaling, rcThread, rcDestroyed );
-}
-
-
-/* Wait
- *  waits for a thread to exit
- *
- *  "status" [ OUT ] - return parameter for thread's exit code
- */
-LIB_EXPORT rc_t CC KThreadWait ( KThread *self, rc_t *status )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcThread, rcWaiting, rcSelf, rcNull );
-    if ( status != NULL )
-        * status = self -> rc;
-    return 0;
-}
-
-
-/* Detach
- *  allow thread to run independently of group
- */
-LIB_EXPORT rc_t CC KThreadDetach ( KThread *self )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcThread, rcDetaching, rcSelf, rcNull );
-    return RC ( rcPS, rcThread, rcDetaching, rcThread, rcDestroyed );
-}
diff --git a/libs/kproc/sttimeout.c b/libs/kproc/sttimeout.c
deleted file mode 100644
index 47ba6cc..0000000
--- a/libs/kproc/sttimeout.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kproc/extern.h>
-#include <kproc/timeout.h>
-#include <os-native.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-/*--------------------------------------------------------------------------
- * timeout_t
- *  a structure for communicating a timeout
- */
-
-/* Init
- *  initialize a timeout in milliseconds
- */
-LIB_EXPORT rc_t CC TimeoutInit ( timeout_t *tm, uint32_t msec )
-{
-    if ( tm == NULL )
-        return RC ( rcPS, rcTimeout, rcConstructing, rcSelf, rcNull );
-
-    tm -> mS = msec;
-    tm -> prepared = false;
-
-    return 0;
-}
-
-/* Prepare
- *  ensures that a timeout is prepared with an absolute value
-*/
-LIB_EXPORT rc_t CC TimeoutPrepare ( timeout_t *self )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcTimeout, rcUpdating, rcSelf, rcNull );
-
-    if ( ! self -> prepared )
-        self -> prepared = true;
-
-    return 0;
-}
diff --git a/libs/kproc/task.c b/libs/kproc/task.c
deleted file mode 100644
index 3a7fcc7..0000000
--- a/libs/kproc/task.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kproc/extern.h>
-
-#include <kproc/task.h>
-#include <kproc/impl.h>
-#include <klib/rc.h>
-
-#define rcTask rcCmd
-
-
-/*--------------------------------------------------------------------------
- * KTask
- *  a deferred task abstraction
- *  specific task objects are constructed with required parameters
- *  and implement the Execute method to perform their operation
- */
-
-
-/* Whack
- */
-static
-rc_t KTaskWhack ( KTask * self )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcTask, rcDestroying, rcSelf, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . destroy ) ( self );
-    }
-
-    return RC ( rcPS, rcTask, rcDestroying, rcInterface, rcBadVersion );
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KTaskAddRef ( const KTask *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KTask" ) )
-        {
-        case krefLimit:
-            return RC ( rcPS, rcTask, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KTaskRelease ( const KTask *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "KTask" ) )
-        {
-        case krefWhack:
-            return KTaskWhack ( ( KTask* ) self );
-        case krefNegative:
-            return RC ( rcPS, rcTask, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/* Execute
- *  perform deferred operation
- */
-LIB_EXPORT rc_t CC KTaskExecute ( KTask *self )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcTask, rcExecuting, rcSelf, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return ( * self -> vt -> v1 . execute ) ( self );
-    }
-
-    return RC ( rcPS, rcTask, rcExecuting, rcInterface, rcBadVersion );
-}
-
-
-/* Init
- *  initialize a newly allocated task object
- */
-LIB_EXPORT rc_t CC KTaskInit ( KTask *self, const KTask_vt *vt, const char *clsname, const char *name )
-{
-    if ( self == NULL )
-        return RC ( rcFS, rcTask, rcConstructing, rcSelf, rcNull );
-    if ( vt == NULL )
-        return RC ( rcFS, rcTask, rcConstructing, rcInterface, rcNull );
-    switch ( vt -> v1 . maj )
-    {
-    case 1:
-        switch ( vt -> v1 . min )
-        {
-            /* insert new minor versions in reverse order */
-        case 0:
-#if _DEBUGGING
-            if ( vt -> v1 . destroy == NULL ||
-                 vt -> v1 . execute == NULL )
-            return RC ( rcFS, rcTask, rcConstructing, rcInterface, rcNull );
-#endif
-            break;
-        default:
-            return RC ( rcFS, rcTask, rcConstructing, rcInterface, rcInvalid );
-        }
-        break;
-    default:
-        return RC ( rcFS, rcTask, rcConstructing, rcInterface, rcInvalid );
-    }
-
-    self -> vt = vt;
-    KRefcountInit ( & self -> refcount, 1, clsname, "init", name );
-    return 0;
-}
-
-
-/* Destroy
- *  destroy task
- */
-LIB_EXPORT rc_t CC KTaskDestroy ( KTask *self, const char *clsname )
-{
-    if ( self != NULL )
-        KRefcountWhack ( & self -> refcount, clsname );
-    return 0;
-}
diff --git a/libs/kproc/unix/syscond-priv.h b/libs/kproc/unix/syscond-priv.h
deleted file mode 100644
index ba8ba01..0000000
--- a/libs/kproc/unix/syscond-priv.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_syscond_priv_
-#define _h_syscond_priv_
-
-#include <pthread.h>
-#include <atomic32.h>
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * KCondition
- *  a POSIX-style condition object
- *  ( requires an external lock object )
- *
- *  usage: the user first acquires an external lock. then, depending upon
- *  the operation, will either test for a condition or establish it, where
- *  the former involves the potential to wait for a signal and the latter
- *  to generate a signal using the external lock for blocking.
- */
-struct KCondition
-{
-    pthread_cond_t cond;
-    atomic32_t refcount;
-};
-
-/* Init
- *  initialize an inline KCondition
- */
-rc_t KConditionInit ( struct KCondition *self );
-
-/* Destroy
- *  run destructor on inline KCondition
- */
-rc_t KConditionDestroy ( struct KCondition *self );
-
-/* DropRef
- *  manipulates reference counter
- *  returns true if last ref
- */
-int KConditionDropRef ( struct KCondition const *self );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_syscond_priv_ */
diff --git a/libs/kproc/unix/syscond.c b/libs/kproc/unix/syscond.c
deleted file mode 100644
index cebf31a..0000000
--- a/libs/kproc/unix/syscond.c
+++ /dev/null
@@ -1,320 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include "syslock-priv.h"
-#include "syscond-priv.h"
-
-#include <kproc/extern.h>
-#include <os-native.h>
-#include <kproc/timeout.h>
-#include <kproc/cond.h>
-#include <klib/out.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-#include <atomic32.h>
-
-#include <stdlib.h>
-#include <errno.h>
-#include <assert.h>
-
-#if _DEBUGGING && 0
-#define CMSG( msg, ... ) \
-    KOutMsg ( msg, __VA_ARGS__ )
-#else
-#define CMSG( msg, ... ) \
-    ( void ) 0
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KCondition
- *  a POSIX-style condition object
- *  ( requires an external lock object )
- *
- *  usage: the user first acquires an external lock. then, depending upon
- *  the operation, will either test for a condition or establish it, where
- *  the former involves the potential to wait for a signal and the latter
- *  to generate a signal using the external lock for blocking.
- */
-
-
-/* Destroy
- */
-LIB_EXPORT rc_t CC KConditionDestroy ( KCondition *self )
-{
-    int status = pthread_cond_destroy ( & self -> cond );
-    switch ( status )
-    {
-    case 0:
-        break;
-    case EBUSY:
-        return RC ( rcPS, rcCondition, rcDestroying, rcCondition, rcBusy );
-    default:
-        return RC ( rcPS, rcCondition, rcDestroying, rcNoObj, rcUnknown );
-    }
-
-    return 0;
-}
-
-
-/* Whack
- */
-static
-rc_t KConditionWhack ( KCondition *self )
-{
-    rc_t rc = KConditionDestroy ( self );
-    if ( rc == 0 )
-        free ( self );
-    return rc;
-}
-
-/* Init
- */
-LIB_EXPORT rc_t CC KConditionInit ( KCondition *self )
-{
-    int status;
-
-    assert ( self != NULL );
-    status = pthread_cond_init ( & self -> cond, NULL );
-    switch ( status )
-    {
-    case 0:
-        break;
-    case EAGAIN:
-        return RC ( rcPS, rcCondition, rcConstructing, rcCondition, rcExhausted );
-    case ENOMEM:
-        return RC ( rcPS, rcCondition, rcConstructing, rcMemory, rcExhausted );
-    case EBUSY:
-        return RC ( rcPS, rcCondition, rcConstructing, rcCondition, rcBusy );
-    case EINVAL:
-        return RC ( rcPS, rcCondition, rcConstructing, rcCondition, rcInvalid );
-    default:
-        return RC ( rcPS, rcCondition, rcConstructing, rcNoObj, rcUnknown );
-    }
-
-    atomic32_set ( & self -> refcount, 1 );
-    return 0;
-}
-
-
-/* Make
- *  create a condition
- */
-LIB_EXPORT rc_t CC KConditionMake ( KCondition **condp )
-{
-    rc_t rc;
-    if ( condp == NULL )
-        rc = RC ( rcPS, rcCondition, rcConstructing, rcParam, rcNull );
-    else
-    {
-        KCondition *cond = malloc ( sizeof * cond );
-        if ( cond == NULL )
-            rc = RC ( rcPS, rcCondition, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            rc = KConditionInit ( cond );
-            if ( rc == 0 )
-            {
-                * condp = cond;
-                return 0;
-            }
-            
-            free ( cond );
-        }
-
-        * condp = NULL;
-    }
-    return rc;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KConditionAddRef ( const KCondition *cself )
-{
-    if ( cself != NULL )
-        atomic32_inc ( & ( ( KCondition* ) cself ) -> refcount );
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KConditionRelease ( const KCondition *cself )
-{
-    KCondition *self = ( KCondition* ) cself;
-    if ( cself != NULL )
-    {
-        if ( atomic32_read_and_add ( & self -> refcount, -1 ) <= 1 )
-            return KConditionWhack ( self );
-    }
-    return 0;
-}
-
-/* DropRef
- *  manipulates reference counter
- *  returns true if last ref
- */
-LIB_EXPORT int CC KConditionDropRef ( const KCondition *cself )
-{
-    assert ( cself != NULL );
-    return atomic32_dec_and_test ( & ( ( KCondition* ) cself ) -> refcount );
-}
-
-
-/* Wait
- *  block on external lock until signaled
- */
-LIB_EXPORT rc_t CC KConditionWait ( KCondition *self, struct KLock *lock )
-{
-    int status;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcCondition, rcWaiting, rcSelf, rcNull );
-    if ( lock == NULL )
-        return RC ( rcPS, rcCondition, rcWaiting, rcLock, rcNull );
-
-    status = pthread_cond_wait ( & self -> cond, & lock -> mutex );
-    switch ( status )
-    {
-    case 0:
-        break;
-    default:
-        return RC ( rcPS, rcCondition, rcWaiting, rcNoObj, rcUnknown );
-    }
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KConditionTimedWait ( KCondition *self, struct KLock *lock, timeout_t *tm )
-{
-    int status;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcCondition, rcWaiting, rcSelf, rcNull );
-    if ( lock == NULL )
-        return RC ( rcPS, rcCondition, rcWaiting, rcLock, rcNull );
-    if ( tm == NULL )
-        return RC ( rcPS, rcCondition, rcWaiting, rcTimeout, rcNull );
-
-    CMSG ( "%s[%p]: testing timeout structure\n", __func__, self );
-    if ( ! tm -> prepared )
-    {
-        CMSG ( "%s[%p]: preparing timeout...\n", __func__, self );
-        TimeoutPrepare ( tm );
-        CMSG ( "%s[%p]: ...done preparing timeout\n", __func__, self );
-    }
-
-#if 1
-    CMSG ( "%s[%p]: calling 'pthread_cond_timedwait ( cond = %p, mutex = %p, ts = %p )'...\n"
-           , __func__, self, & self -> cond, & lock -> mutex, & tm -> ts
-        );
-    status = pthread_cond_timedwait ( & self -> cond, & lock -> mutex, & tm -> ts );
-#else
-    CMSG ( "%s[%p]: calling 'pthread_cond_wait ( cond = %p, mutex = %p )'...\n"
-           , __func__, self, & self -> cond, & lock -> mutex, & tm -> ts
-        );
-    status = pthread_cond_wait ( & self -> cond, & lock -> mutex );
-#endif
-    CMSG ( "%s[%p]: ...done, OS status = %!\n", __func__, self, status );
-    switch ( status )
-    {
-    case 0:
-        break;
-    case ETIMEDOUT:
-        return RC ( rcPS, rcCondition, rcWaiting, rcTimeout, rcExhausted );
-/*
-  The pthread_cond_timedwait() function shall fail if:
-
-  ETIMEDOUT
-  The time specified by abstime to pthread_cond_timedwait() has passed.
-
-  The pthread_cond_timedwait() and pthread_cond_wait() functions may fail if:
-
-  EINVAL The value specified by cond, mutex, or abstime is invalid.
-
-  EINVAL Different mutexes were supplied for concurrent pthread_cond_timedwait()
-  or pthread_cond_wait() operations on the same condition variable.
-
-  EPERM  The mutex was not owned by the current thread at the time of the call.
-
-  *** These functions shall not return an error code of [EINTR]. ***
-
- */
-    case EINTR:
-        return RC ( rcPS, rcCondition, rcWaiting, rcThread, rcInterrupted );
-    default:
-        return RC ( rcPS, rcCondition, rcWaiting, rcNoObj, rcUnknown );
-    }
-
-    return 0;
-}
-
-
-/* Signal
- *  signal waiting threads
- *  awaken at most a single thread
- */
-LIB_EXPORT rc_t CC KConditionSignal ( KCondition *self )
-{
-    int status;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcCondition, rcSignaling, rcSelf, rcNull );
-
-    status = pthread_cond_signal ( & self -> cond );
-    switch ( status )
-    {
-    case 0:
-        break;
-    default:
-        return RC ( rcPS, rcCondition, rcSignaling, rcNoObj, rcUnknown );
-    }
-
-    return 0;
-}
-
-
-/* Broadcast
- *  signal waiting threads
- *  awaken all waiting thread
- */
-LIB_EXPORT rc_t CC KConditionBroadcast ( KCondition *self )
-{
-    int status;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcCondition, rcSignaling, rcSelf, rcNull );
-
-    status = pthread_cond_broadcast ( & self -> cond );
-    switch ( status )
-    {
-    case 0:
-        break;
-    default:
-        return RC ( rcPS, rcCondition, rcSignaling, rcNoObj, rcUnknown );
-    }
-
-    return 0;
-}
diff --git a/libs/kproc/unix/systhread.c b/libs/kproc/unix/systhread.c
deleted file mode 100644
index 5707d41..0000000
--- a/libs/kproc/unix/systhread.c
+++ /dev/null
@@ -1,272 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kproc/extern.h>
-#include <kproc/thread.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-#include <atomic32.h>
-
-#include <pthread.h>
-#include <stdlib.h>
-#include <errno.h>
-
-
-/*--------------------------------------------------------------------------
- * KThread
- *  a CPU execution thread
- */
-struct KThread
-{
-    /* thread entrypoint and data */
-    rc_t ( * run ) ( const KThread*, void* );
-    void *data;
-
-    pthread_t thread;
-    atomic32_t waiting;
-    atomic32_t refcount;
-    rc_t rc;
-    bool join;
-};
-
-
-/* Whack
- */
-static
-rc_t KThreadWhack ( KThread *self )
-{
-    if ( self -> join )
-    {
-        void *td;
-        pthread_join ( self -> thread, & td );
-    }
-
-    free ( self );
-    return 0;
-}
-
-
-/* Run
- */
-static
-void *KThreadRun ( void *td )
-{
-    KThread *self = td;
-
-    /* run the function */
-    self -> rc = ( * self -> run ) ( self, self -> data );
-
-    /* release thread's reference */
-    if ( atomic32_dec_and_test ( & self -> refcount ) )
-        free ( self );
-
-    return NULL;
-}
-
-
-/* Make
- *  create and run a thread
- *
- *  "run_thread" [ IN ] - thread entrypoint
- *
- *  "data" [ IN, OPAQUE ] - user-supplied thread data
- */
-LIB_EXPORT rc_t CC KThreadMake ( KThread **tp,
-    rc_t ( CC * run_thread ) ( const KThread*, void* ), void *data )
-{
-    rc_t rc;
-    if ( tp == NULL )
-        rc = RC ( rcPS, rcThread, rcCreating, rcParam, rcNull );
-    else
-    {
-        if ( run_thread == NULL )
-            rc = RC ( rcPS, rcThread, rcCreating, rcFunction, rcNull );
-        else
-        {
-            KThread *t = malloc ( sizeof * t );
-            if ( t == NULL )
-                rc = RC ( rcPS, rcThread, rcCreating, rcMemory, rcExhausted );
-            else
-            {
-                int status;
-
-                /* finish constructing thread */
-                t -> run = run_thread;
-                t -> data = data;
-                atomic32_set ( & t -> waiting, 0 );
-                atomic32_set ( & t -> refcount, 2 );
-                t -> rc = 0;
-                t -> join = true;
-
-                /* attempt to create thread */
-                status = pthread_create ( & t -> thread, 0, KThreadRun, t );
-                if ( status == 0 )
-                {
-                    * tp = t;
-                    return 0;
-                }
-
-                /* see why we failed */
-                switch ( status )
-                {
-                case EAGAIN:
-                    rc = RC ( rcPS, rcThread, rcCreating, rcThread, rcExhausted );
-                    break;
-                default:
-                    rc = RC ( rcPS, rcThread, rcCreating, rcNoObj, rcUnknown );
-                }
-
-                free ( t );
-            }
-        }
-
-        * tp = NULL;
-    }
-    return rc;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KThreadAddRef ( const KThread *cself )
-{
-    if ( cself != NULL )
-        atomic32_inc ( & ( ( KThread* ) cself ) -> refcount );
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KThreadRelease ( const KThread *cself )
-{
-    KThread *self = ( KThread* ) cself;
-    if ( cself != NULL )
-    {
-        if ( atomic32_dec_and_test ( & self -> refcount ) )
-            return KThreadWhack ( self );
-    }
-    return 0;
-}
-
-
-/* Cancel
- *  signal the thread to finish
- */
-LIB_EXPORT rc_t CC KThreadCancel ( KThread *self )
-{
-    int status;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcThread, rcSignaling, rcSelf, rcNull );
-
-    status = pthread_cancel ( self -> thread );
-    switch ( status )
-    {
-    case 0:
-        break;
-    case ESRCH:
-        self -> join = false;
-        return RC ( rcPS, rcThread, rcSignaling, rcThread, rcDestroyed );
-    default:
-        return RC ( rcPS, rcThread, rcSignaling, rcNoObj, rcUnknown );
-    }
-
-    return 0;
-}
-
-
-/* Wait
- *  waits for a thread to exit
- *
- *  "status" [ OUT ] - return parameter for thread's exit code
- */
-LIB_EXPORT rc_t CC KThreadWait ( KThread *self, rc_t *out )
-{
-    void *td;
-    int status;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcThread, rcWaiting, rcSelf, rcNull );
-
-    /* prevent multiple waiters */
-    if ( atomic32_test_and_set ( & self -> waiting, 0, 1 ) != 0 )
-        return RC ( rcPS, rcThread, rcWaiting, rcThread, rcBusy );
-
-    status = pthread_join ( self -> thread, & td );
-
-    /* release waiter lock */                                                                                                                                                                                   
-    atomic32_set ( & self -> waiting, 0 );
-
-    switch ( status )
-    {
-    case 0:
-        break;
-    case ESRCH:
-        return RC ( rcPS, rcThread, rcWaiting, rcThread, rcDestroyed );
-    case EINVAL:
-        return RC ( rcPS, rcThread, rcWaiting, rcThread, rcDetached );
-    case EDEADLK:
-        return RC ( rcPS, rcThread, rcWaiting, rcThread, rcDeadlock );
-    default:
-        return RC ( rcPS, rcThread, rcWaiting, rcNoObj, rcUnknown );
-    }
-
-    self -> join = false;
-
-    if ( td == PTHREAD_CANCELED )
-        self -> rc = RC ( rcPS, rcThread, rcWaiting, rcThread, rcCanceled );
-
-    if ( out != NULL )
-        * out = self -> rc;
-
-    return 0;
-}
-
-
-/* Detach
- *  allow thread to run independently of group
- */
-LIB_EXPORT rc_t CC KThreadDetach ( KThread *self )
-{
-    int status;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcThread, rcDetaching, rcSelf, rcNull );
-
-    status = pthread_detach ( self -> thread );
-    switch ( status )
-    {
-    case 0:
-    case EINVAL:
-        break;
-    case ESRCH:
-        return RC ( rcPS, rcThread, rcDetaching, rcThread, rcDestroyed );
-    default:
-        return RC ( rcPS, rcThread, rcDetaching, rcNoObj, rcUnknown );
-    }
-
-    self -> join = false;
-    return 0;
-}
diff --git a/libs/kproc/unix/systimeout.c b/libs/kproc/unix/systimeout.c
deleted file mode 100644
index 35295b7..0000000
--- a/libs/kproc/unix/systimeout.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <sysalloc.h>
-#include <kproc/timeout.h>
-#include <os-native.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-
-
-/*--------------------------------------------------------------------------
- * timeout_t
- *  a structure for communicating a timeout
- *  which under Unix converts to an absolute time once prepared
- */
-
-
-/* Init
- *  initialize a timeout in milliseconds
- */
-LIB_EXPORT rc_t TimeoutInit ( timeout_t *tm, uint32_t msec )
-{
-    if ( tm == NULL )
-        return RC ( rcPS, rcTimeout, rcConstructing, rcSelf, rcNull );
-
-    tm -> mS = msec;
-    tm -> prepared = false;
-
-    return 0;
-}
-
-/* Prepare
- *  ensures that a timeout is prepared with an absolute value
-*/
-LIB_EXPORT rc_t TimeoutPrepare ( timeout_t *self )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcTimeout, rcUpdating, rcSelf, rcNull );
-
-    if ( ! self -> prepared )
-    {
-        struct timeval tv;
-        struct timezone tz;
-        int64_t abs_micros;
-
-        /* current time in seconds and uS */
-        gettimeofday ( & tv, & tz );
-    
-        /* convert to uS */
-        abs_micros = tv . tv_sec;
-        abs_micros = abs_micros * 1000 * 1000 + tv . tv_usec;
-    
-        /* add wait period for future timeout */
-        abs_micros += ( uint64_t ) self -> mS * 1000;
-    
-        /* convert to seconds and nS */
-        self -> ts . tv_sec = ( time_t ) ( abs_micros / 1000000 );
-        self -> ts . tv_nsec = ( uint32_t ) ( ( abs_micros % 1000000 ) * 1000 );
-        self -> prepared = true;
-    }
-
-    return 0;
-}
diff --git a/libs/kproc/win/syscond-priv.h b/libs/kproc/win/syscond-priv.h
deleted file mode 100644
index 509a913..0000000
--- a/libs/kproc/win/syscond-priv.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_syscond_priv_
-#define _h_syscond_priv_
-
-#if 0
-#include <pthread.h>
-#endif
-
-#include <atomic32.h>
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KCondition
- *  a POSIX-style condition object
- *  ( requires an external lock object )
- *
- *  usage: the user first acquires an external lock. then, depending upon
- *  the operation, will either test for a condition or establish it, where
- *  the former involves the potential to wait for a signal and the latter
- *  to generate a signal using the external lock for blocking.
- */
-struct KCondition;
-
-
-/* Init
- *  initialize an inline KCondition
- */
-rc_t KConditionInit ( struct KCondition *self );
-
-/* Destroy
- *  run destructor on inline KCondition
- */
-rc_t KConditionDestroy ( struct KCondition *self );
-
-/* DropRef
- *  manipulates reference counter
- *  returns true if last ref
- */
-int KConditionDropRef ( struct KCondition const *self );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_syscond_priv_ */
diff --git a/libs/kproc/win/syscond.c b/libs/kproc/win/syscond.c
deleted file mode 100644
index 9fb08a2..0000000
--- a/libs/kproc/win/syscond.c
+++ /dev/null
@@ -1,500 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kproc/extern.h>
-
-#include "syslock-priv.h"
-#include "syscond-priv.h"
-
-#include <os-native.h>
-#include <kproc/timeout.h>
-#include <kproc/cond.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-#include <atomic32.h>
-
-#include <stdlib.h>
-#include <errno.h>
-#include <assert.h>
-
-#include <time.h> /* struct timespec */
-
-/* #include <stdio.h> */
-
-
-/*
-
-This Windows condition implementation is taken from 
-"Strategies for Implementing POSIX Condition Variables on Win32"
-by Douglas C. Schmidt
-( http://www.cs.wustl.edu/~schmidt/win32-cv-1.html ) :
-
-3.4. The SignalObjectAndWait Solution
-The implementation relies on the Windows NT 4.0 SignalObjectAndWait function,
-thus it is not available in Windows CE, Windows '95, or Windows NT 3.51.
-
-The code was taken from the article.
-
-The C++ source code for POSIX condition variable on Win32
-described in the article is freely available with the ACE framework
-at //www.cs.wustl.edu/~schmidt/ACE.html.
-It is possible that the latter is better.
-
-*/
-
-
-typedef struct
-{
-  int waiters_count_;
-  // Number of waiting threads.
-
-  CRITICAL_SECTION waiters_count_lock_;
-  // Serialize access to <waiters_count_>.
-
-  HANDLE sema_;
-  // Semaphore used to queue up threads waiting for the condition to
-  // become signaled. 
-
-  HANDLE waiters_done_;
-  // An auto-reset event used by the broadcast/signal thread to wait
-  // for all the waiting thread(s) to wake up and be released from the
-  // semaphore. 
-
-  size_t was_broadcast_;
-  // Keeps track of whether we were broadcasting or signaling.  This
-  // allows us to optimize the code if we're just signaling.
-} pthread_cond_t;
-
-
-/*--------------------------------------------------------------------------
- * KCondition
- *  a POSIX-style condition object
- *  ( requires an external lock object )
- *
- *  usage: the user first acquires an external lock. then, depending upon
- *  the operation, will either test for a condition or establish it, where
- *  the former involves the potential to wait for a signal and the latter
- *  to generate a signal using the external lock for blocking.
- */
-struct KCondition
-{
-    pthread_cond_t cond;
-
-    atomic32_t refcount;
-};
-
-
-typedef HANDLE pthread_mutex_t;
-typedef struct pthread_condattr_t { char dummy; } pthread_condattr_t;
-
-int 
-pthread_cond_init (pthread_cond_t *cv,
-                   const pthread_condattr_t *dummy)
-{
-  cv->waiters_count_ = 0;
-  cv->was_broadcast_ = 0;
-  cv->sema_ = CreateSemaphore (NULL,       // no security
-                                0,          // initially 0
-                                0x7fffffff, // max count
-                                NULL);      // unnamed 
-  InitializeCriticalSection (&cv->waiters_count_lock_);
-  cv->waiters_done_ = CreateEvent (NULL,  // no security
-                                   FALSE, // auto-reset
-                                   FALSE, // non-signaled initially
-                                   NULL); // unnamed
-  return 0;
-}
-
-int pthread_cond_destroy (pthread_cond_t *cv) {
-    CloseHandle(cv->sema_);
-    DeleteCriticalSection(&cv->waiters_count_lock_);
-    CloseHandle(cv->waiters_done_);
-    memset(cv, 0, sizeof *cv);
-    return 0;
-}
-
-#ifndef timespec
-typedef struct timespec
-  {
-    time_t tv_sec;            /* Seconds.  */
-    long int tv_nsec;           /* Nanoseconds.  */
-  } timespec;
-#endif
-
-int pthread_cond_waitImpl (pthread_cond_t *cv, 
-                   pthread_mutex_t *external_mutex,
-                   const struct timespec *abstime,
-                   bool infinite)
-{
-    int last_waiter;
-    DWORD dwMilliseconds = INFINITE;
-
-  // Avoid race conditions.
-  EnterCriticalSection (&cv->waiters_count_lock_);
-  cv->waiters_count_++;
-  LeaveCriticalSection (&cv->waiters_count_lock_);
-
-  // This call atomically releases the mutex and waits on the
-  // semaphore until <pthread_cond_signal> or <pthread_cond_broadcast>
-  // are called by another thread.
-  if (!infinite && abstime != NULL)
-  { dwMilliseconds = ( DWORD ) ( abstime->tv_sec * 1000 + abstime->tv_nsec / 1000000 ) ; }
-  SignalObjectAndWait (*external_mutex, cv->sema_, dwMilliseconds, FALSE);
-
-  // Reacquire lock to avoid race conditions.
-  EnterCriticalSection (&cv->waiters_count_lock_);
-
-  // We're no longer waiting...
-  cv->waiters_count_--;
-
-  // Check to see if we're the last waiter after <pthread_cond_broadcast>.
-  last_waiter = cv->was_broadcast_ && cv->waiters_count_ == 0;
-
-  LeaveCriticalSection (&cv->waiters_count_lock_);
-
-  // If we're the last waiter thread during this particular broadcast
-  // then let all the other threads proceed.
-  if (last_waiter)
-    // This call atomically signals the <waiters_done_> event and waits until
-    // it can acquire the <external_mutex>.
-    // This is required to ensure fairness.
-    SignalObjectAndWait (cv->waiters_done_, *external_mutex, INFINITE, FALSE);
-  else {
-    // Always regain the external mutex since that's the guarantee we
-    // give to our callers. 
-/*      fprintf(stderr, "%s: WaitForSingleObject...\n", __func__); */
-    WaitForSingleObject (*external_mutex, INFINITE);
-/*      fprintf(stderr, "... %s: WaitForSingleObject\n", __func__); */
-  }
-
-  return 0;
-}
-
-int pthread_cond_timedwait(pthread_cond_t *cv,
-              pthread_mutex_t *external_mutex,
-              const struct timespec *abstime)
-{
-  return pthread_cond_waitImpl(cv, external_mutex, abstime, false);
-}
-
-int
-pthread_cond_wait (pthread_cond_t *cv, 
-                   pthread_mutex_t *external_mutex)
-{
-  return pthread_cond_waitImpl(cv, external_mutex, NULL, true);
-}
-
-int
-pthread_cond_signal (pthread_cond_t *cv)
-{
-    int have_waiters;
-
-  EnterCriticalSection (&cv->waiters_count_lock_);
-  have_waiters = cv->waiters_count_ > 0;
-  LeaveCriticalSection (&cv->waiters_count_lock_);
-
-  // If there aren't any waiters, then this is a no-op.  
-  if (have_waiters)
-    ReleaseSemaphore (cv->sema_, 1, 0);
-
-  return 0;
-}
-
-int
-pthread_cond_broadcast (pthread_cond_t *cv)
-{
-  int have_waiters = 0;
-
-  // This is needed to ensure that <waiters_count_> and <was_broadcast_> are
-  // consistent relative to each other.
-  EnterCriticalSection (&cv->waiters_count_lock_);
-
-  if (cv->waiters_count_ > 0) {
-    // We are broadcasting, even if there is just one waiter...
-    // Record that we are broadcasting, which helps optimize
-    // <pthread_cond_wait> for the non-broadcast case.
-    cv->was_broadcast_ = 1;
-    have_waiters = 1;
-  }
-
-  if (have_waiters) {
-    // Wake up all the waiters atomically.
-    ReleaseSemaphore (cv->sema_, cv->waiters_count_, 0);
-
-    LeaveCriticalSection (&cv->waiters_count_lock_);
-
-    // Wait for all the awakened threads to acquire the counting
-    // semaphore. 
-    WaitForSingleObject (cv->waiters_done_, INFINITE);
-    // This assignment is okay, even without the <waiters_count_lock_> held 
-    // because no other waiter threads can wake up to access it.
-    cv->was_broadcast_ = 0;
-  }
-  else
-    LeaveCriticalSection (&cv->waiters_count_lock_);
-
-  return 0;
-}
-
-/*--------------------------------------------------------------------------
- * KCondition
- *  a POSIX-style condition object
- *  ( requires an external lock object )
- *
- *  usage: the user first acquires an external lock. then, depending upon
- *  the operation, will either test for a condition or establish it, where
- *  the former involves the potential to wait for a signal and the latter
- *  to generate a signal using the external lock for blocking.
- */
-
-/* Destroy
- */
-rc_t KConditionDestroy ( KCondition *self )
-{
-    int status = pthread_cond_destroy ( & self -> cond );
-    switch ( status )
-    {
-    case 0:
-        break;
-    case EBUSY:
-        return RC ( rcPS, rcCondition, rcDestroying, rcCondition, rcBusy );
-    default:
-        return RC ( rcPS, rcCondition, rcDestroying, rcNoObj, rcUnknown );
-    }
-
-    return 0;
-}
-
-
-/* Whack
- */
-static
-rc_t KConditionWhack ( KCondition *self )
-{
-    rc_t rc = KConditionDestroy ( self );
-    if ( rc == 0 )
-        free ( self );
-    return rc;
-}
-
-/* Init
- */
-rc_t KConditionInit ( KCondition *self )
-{
-    int status;
-
-    assert ( self != NULL );
-    status = pthread_cond_init ( & self -> cond, NULL );
-    switch ( status )
-    {
-    case 0:
-        break;
-    case EAGAIN:
-        return RC ( rcPS, rcCondition, rcConstructing, rcCondition, rcExhausted );
-    case ENOMEM:
-        return RC ( rcPS, rcCondition, rcConstructing, rcMemory, rcExhausted );
-    case EBUSY:
-        return RC ( rcPS, rcCondition, rcConstructing, rcCondition, rcBusy );
-    case EINVAL:
-        return RC ( rcPS, rcCondition, rcConstructing, rcCondition, rcInvalid );
-    default:
-        return RC ( rcPS, rcCondition, rcConstructing, rcNoObj, rcUnknown );
-    }
-
-    atomic32_set ( & self -> refcount, 1 );
-    return 0;
-}
-
-
-/* Make
- *  create a condition
- */
-LIB_EXPORT rc_t CC KConditionMake ( KCondition **condp )
-{
-    rc_t rc;
-    if ( condp == NULL )
-        rc = RC ( rcPS, rcCondition, rcConstructing, rcParam, rcNull );
-    else
-    {
-        KCondition *cond = malloc ( sizeof * cond );
-        if ( cond == NULL )
-            rc = RC ( rcPS, rcCondition, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            rc = KConditionInit ( cond );
-            if ( rc == 0 )
-            {
-                * condp = cond;
-                return 0;
-            }
-            
-            free ( cond );
-        }
-
-        * condp = NULL;
-    }
-    return rc;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KConditionAddRef ( const KCondition *cself )
-{
-    if ( cself != NULL )
-        atomic32_inc ( & ( ( KCondition* ) cself ) -> refcount );
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KConditionRelease ( const KCondition *cself )
-{
-    KCondition *self = ( KCondition* ) cself;
-    if ( cself != NULL )
-    {
-        if ( atomic32_dec_and_test ( & self -> refcount ) )
-            return KConditionWhack ( self );
-    }
-    return 0;
-}
-
-/* DropRef
- *  manipulates reference counter
- *  returns true if last ref
- */
-int KConditionDropRef ( const KCondition *cself )
-{
-    assert ( cself != NULL );
-    return atomic32_dec_and_test ( & ( ( KCondition* ) cself ) -> refcount );
-}
-
-
-/* Wait
- *  block on external lock until signaled
- */
-LIB_EXPORT rc_t CC KConditionWait ( KCondition *self, struct KLock *lock )
-{
-    int status;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcCondition, rcWaiting, rcSelf, rcNull );
-    if ( lock == NULL )
-        return RC ( rcPS, rcCondition, rcWaiting, rcLock, rcNull );
-
-    status = pthread_cond_wait ( & self -> cond, & lock -> mutex );
-    switch ( status )
-    {
-    case 0:
-        break;
-    default:
-        return RC ( rcPS, rcCondition, rcWaiting, rcNoObj, rcUnknown );
-    }
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KConditionTimedWait ( KCondition *self, struct KLock *lock, timeout_t *tm )
-{
-    int status;
-    timespec ts;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcCondition, rcWaiting, rcSelf, rcNull );
-    if ( lock == NULL )
-        return RC ( rcPS, rcCondition, rcWaiting, rcLock, rcNull );
-    if ( tm == NULL )
-        return RC ( rcPS, rcCondition, rcWaiting, rcTimeout, rcNull );
-
-    if ( ! tm -> prepared )
-        TimeoutPrepare ( tm );
-
-    memset(&ts, 0, sizeof ts);
-    ts.tv_sec = tm -> mS / 1000;
-    ts.tv_nsec = ( long ) ( (tm -> mS - ts.tv_sec * 1000) * 1000000 );
-
-    status = pthread_cond_timedwait ( & self -> cond, & lock -> mutex, & ts );
-    switch ( status )
-    {
-    case 0:
-        break;
-/*  case ETIMEDOUT:
-        return RC ( rcPS, rcCondition, rcWaiting, rcTimeout, rcExhausted ); */
-    case EINTR:
-        return RC ( rcPS, rcCondition, rcWaiting, rcThread, rcInterrupted );
-    default:
-        return RC ( rcPS, rcCondition, rcWaiting, rcNoObj, rcUnknown );
-    }
-
-    return 0;
-}
-
-
-/* Signal
- *  signal waiting threads
- *  awaken at most a single thread
- */
-LIB_EXPORT rc_t CC KConditionSignal ( KCondition *self )
-{
-    int status;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcCondition, rcSignaling, rcSelf, rcNull );
-
-    status = pthread_cond_signal ( & self -> cond );
-    switch ( status )
-    {
-    case 0:
-        break;
-    default:
-        return RC ( rcPS, rcCondition, rcSignaling, rcNoObj, rcUnknown );
-    }
-
-    return 0;
-}
-
-
-/* Broadcast
- *  signal waiting threads
- *  awaken all waiting thread
- */
-LIB_EXPORT rc_t CC KConditionBroadcast ( KCondition *self )
-{
-    int status;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcCondition, rcSignaling, rcSelf, rcNull );
-
-    status = pthread_cond_broadcast ( & self -> cond );
-    switch ( status )
-    {
-    case 0:
-        break;
-    default:
-        return RC ( rcPS, rcCondition, rcSignaling, rcNoObj, rcUnknown );
-    }
-
-    return 0;
-}
diff --git a/libs/kproc/win/syslock-priv.h b/libs/kproc/win/syslock-priv.h
deleted file mode 100644
index 412cdf0..0000000
--- a/libs/kproc/win/syslock-priv.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_syslock_priv_
-#define _h_syslock_priv_
-
-#ifndef _h_os_native_
-#include <os-native.h>
-#endif
-
-#ifndef _h_klib_refcount_
-#include <klib/refcount.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * KLock
- *  a POSIX-style mutual exclusion lock
- */
-struct KLock
-{
-    HANDLE mutex;
-    KRefcount refcount;
-};
-
-/*--------------------------------------------------------------------------
- * KTimedLock
- *  a POSIX-style mutual exclusion lock with wupport for timed Acquire
- */
-struct KTimedLock
-{
-    HANDLE mutex;
-    KRefcount refcount;
-};
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_syslock_priv_ */
diff --git a/libs/kproc/win/syslock.c b/libs/kproc/win/syslock.c
deleted file mode 100644
index 4aefc1c..0000000
--- a/libs/kproc/win/syslock.c
+++ /dev/null
@@ -1,725 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kproc/extern.h>
-
-#include "syslock-priv.h"
-#include <kproc/timeout.h>
-#include <kproc/lock.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <errno.h>
-#include <assert.h>
-
-/*--------------------------------------------------------------------------
- * KLock
- *  a mutual exclusion lock
- */
-
-/* Whack
- */
-static
-rc_t KLockWhack ( KLock *self )
-{
-    if ( CloseHandle ( self -> mutex ) )
-    {
-        free ( self );
-        return 0;
-    }
-
-    switch ( GetLastError () )
-    {
-    case ERROR_INVALID_HANDLE:
-        return RC ( rcPS, rcLock, rcDestroying, rcLock, rcInvalid );
-    }
-
-    return RC ( rcPS, rcLock, rcDestroying, rcNoObj, rcUnknown );
-}
-
-
-/* Make
- *  make a simple mutex
- */
-LIB_EXPORT rc_t CC KLockMake ( KLock **lockp )
-{
-    rc_t rc;
-    if ( lockp == NULL )
-        rc = RC ( rcPS, rcLock, rcConstructing, rcParam, rcNull );
-    else
-    {
-        KLock *lock = malloc ( sizeof * lock );
-        if ( lock == NULL )
-            rc = RC ( rcPS, rcLock, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            lock -> mutex = CreateMutex ( NULL, false, NULL );
-            if ( lock -> mutex != NULL )
-            {
-                atomic32_set ( & lock -> refcount, 1 );
-                * lockp = lock;
-                return 0;
-            }
-
-            switch ( GetLastError () )
-            {
-            default:
-                rc = RC ( rcPS, rcLock, rcConstructing, rcNoObj, rcUnknown );
-            }
-
-            free ( lock );
-        }
-
-        * lockp = NULL;
-    }
-    return rc;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KLockAddRef ( const KLock *cself )
-{
-    if ( cself != NULL )
-        atomic32_inc ( & ( ( KLock* ) cself ) -> refcount );
-    return 0;
-}
-
-
-LIB_EXPORT rc_t CC KLockRelease ( const KLock *cself )
-{
-    KLock *self = ( KLock* ) cself;
-    if ( cself != NULL )
-    {
-        if ( atomic32_dec_and_test ( & self -> refcount ) )
-        {
-            atomic32_set ( & self -> refcount, 1 );
-            return KLockWhack ( self );
-        }
-    }
-    return 0;
-}
-
-
-/* Acquire
- *  acquires lock
- */
-LIB_EXPORT rc_t CC KLockAcquire ( KLock *self )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcLock, rcLocking, rcSelf, rcNull );
-
-    switch ( WaitForSingleObject ( self -> mutex, INFINITE ) )
-    {
-    case WAIT_ABANDONED:
-    case WAIT_OBJECT_0:
-        return 0;
-    case WAIT_TIMEOUT:
-        return RC ( rcPS, rcLock, rcLocking, rcTimeout, rcExhausted );
-    }
-
-    switch ( GetLastError () )
-    {
-    case ERROR_INVALID_HANDLE:
-        return RC ( rcPS, rcLock, rcLocking, rcLock, rcInvalid );
-    }
-
-    return RC ( rcPS, rcLock, rcLocking, rcNoObj, rcUnknown );
-}
-
-/* Unlock
- *  releases lock
- */
-LIB_EXPORT rc_t CC KLockUnlock ( KLock *self )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcLock, rcUnlocking, rcSelf, rcNull );
-
-    if ( ReleaseMutex ( self -> mutex ) )
-        return 0;
-
-    switch ( GetLastError () )
-    {
-    case ERROR_INVALID_HANDLE:
-        return RC ( rcPS, rcLock, rcUnlocking, rcLock, rcInvalid );
-    }
-
-    return RC ( rcPS, rcLock, rcUnlocking, rcNoObj, rcUnknown );
-}
-
-
-/*--------------------------------------------------------------------------
- * KTimedLock
- *  a mutual exclusion lock with support for timed Acquire
- */
-
-/* Whack
- */
-static
-rc_t KTimedLockWhack ( KTimedLock *self )
-{
-    if ( CloseHandle ( self -> mutex ) )
-    {
-        free ( self );
-        return 0;
-    }
-
-    switch ( GetLastError () )
-    {
-    case ERROR_INVALID_HANDLE:
-        return RC ( rcPS, rcLock, rcDestroying, rcLock, rcInvalid );
-    }
-
-    return RC ( rcPS, rcLock, rcDestroying, rcNoObj, rcUnknown );
-}
-
-
-/* Make
- *  make a simple mutex
- */
-LIB_EXPORT rc_t CC KTimedLockMake ( KTimedLock **lockp )
-{
-    rc_t rc;
-    if ( lockp == NULL )
-        rc = RC ( rcPS, rcLock, rcConstructing, rcParam, rcNull );
-    else
-    {
-        KTimedLock *lock = malloc ( sizeof * lock );
-        if ( lock == NULL )
-            rc = RC ( rcPS, rcLock, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            lock -> mutex = CreateMutex ( NULL, false, NULL );
-            if ( lock -> mutex != NULL )
-            {
-                atomic32_set ( & lock -> refcount, 1 );
-                * lockp = lock;
-                return 0;
-            }
-
-            switch ( GetLastError () )
-            {
-            default:
-                rc = RC ( rcPS, rcLock, rcConstructing, rcNoObj, rcUnknown );
-            }
-
-            free ( lock );
-        }
-
-        * lockp = NULL;
-    }
-    return rc;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KTimedLockAddRef ( const KTimedLock *cself )
-{
-    if ( cself != NULL )
-        atomic32_inc ( & ( ( KTimedLock* ) cself ) -> refcount );
-    return 0;
-}
-
-
-LIB_EXPORT rc_t CC KTimedLockRelease ( const KTimedLock *cself )
-{
-    KTimedLock *self = ( KTimedLock* ) cself;
-    if ( cself != NULL )
-    {
-        if ( atomic32_dec_and_test ( & self -> refcount ) )
-        {
-            atomic32_set ( & self -> refcount, 1 );
-            return KTimedLockWhack ( self );
-        }
-    }
-    return 0;
-}
-
-
-/* Acquire
- *  acquires lock
- */
-LIB_EXPORT rc_t CC KTimedLockAcquire ( KTimedLock *self, timeout_t *tm )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcLock, rcLocking, rcSelf, rcNull );
-
-    switch ( WaitForSingleObject( self -> mutex, tm != NULL ? tm -> mS : 0 ) )
-    {
-    case WAIT_ABANDONED:
-    case WAIT_OBJECT_0:
-        return 0;
-    case WAIT_TIMEOUT:
-        if ( tm == NULL )
-            return RC ( rcPS, rcLock, rcLocking, rcLock, rcBusy );
-        return RC ( rcPS, rcLock, rcLocking, rcTimeout, rcExhausted );
-    }
-
-    switch ( GetLastError () )
-    {
-    case ERROR_INVALID_HANDLE:
-        return RC ( rcPS, rcLock, rcLocking, rcLock, rcInvalid );
-    }
-
-    return RC ( rcPS, rcLock, rcLocking, rcNoObj, rcUnknown );
-}
-
-
-/* Unlock
- *  releases lock
- */
-LIB_EXPORT rc_t CC KTimedLockUnlock ( KTimedLock *self )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcLock, rcUnlocking, rcSelf, rcNull );
-
-    if ( ReleaseMutex ( self -> mutex ) )
-        return 0;
-
-    switch ( GetLastError () )
-    {
-    case ERROR_INVALID_HANDLE:
-        return RC ( rcPS, rcLock, rcUnlocking, rcLock, rcInvalid );
-    }
-
-    return RC ( rcPS, rcLock, rcUnlocking, rcNoObj, rcUnknown );
-}
-
-
-/*--------------------------------------------------------------------------
- * KRWLock
- *  a read/write lock
- */
-struct KRWLock
-{
-    HANDLE mutex;
-    HANDLE rcond;
-    HANDLE wcond;
-    HANDLE ack;
-    atomic32_t refcount;
-    uint32_t rwait;
-    uint32_t wwait;
-    int32_t busy;
-};
-
-
-/* Whack
- */
-static
-rc_t KRWLockWhack ( KRWLock *self )
-{
-    switch ( WaitForSingleObject ( self -> mutex, 0 ) )
-    {
-    case WAIT_ABANDONED:
-    case WAIT_OBJECT_0:
-        if ( self -> busy != 0 || self -> rwait != 0 || self -> wwait != 0 )
-        {
-            ReleaseMutex ( self -> mutex );
-            return RC ( rcPS, rcRWLock, rcDestroying, rcRWLock, rcBusy );
-        }
-        ReleaseMutex ( self -> mutex );
-        break;
-    case WAIT_TIMEOUT:
-        return RC ( rcPS, rcRWLock, rcDestroying, rcRWLock, rcBusy );
-    }
-
-    CloseHandle ( self -> ack );
-    CloseHandle ( self -> wcond );
-    CloseHandle ( self -> rcond );
-    CloseHandle ( self -> mutex );
-
-    free ( self );
-    return 0;
-}
-
-
-/* Make
- *  make a simple read/write lock
- */
-LIB_EXPORT rc_t CC KRWLockMake ( KRWLock **lockp )
-{
-    rc_t rc;
-
-    if ( lockp == NULL )
-        rc = RC ( rcPS, rcRWLock, rcConstructing, rcParam, rcNull );
-    else
-    {
-        KRWLock *lock = malloc ( sizeof * lock );
-        if ( lock == NULL )
-            rc = RC ( rcPS, rcRWLock, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            DWORD status;
-            lock -> mutex = CreateMutex ( NULL, false, NULL );
-            if ( lock -> mutex == NULL )
-                status = GetLastError ();
-            else
-            {
-                lock -> rcond = CreateEvent ( NULL, true, false, NULL );
-                if ( lock -> rcond == NULL )
-                    status = GetLastError ();
-                else
-                {
-                    lock -> wcond = CreateEvent ( NULL, true, false, NULL );
-                    if ( lock -> wcond == NULL )
-                        status = GetLastError ();
-                    else
-                    {
-                        lock -> ack = CreateEvent ( NULL, true, false, NULL );
-                        if ( lock -> ack != NULL )
-                        {
-                            atomic32_set ( & lock -> refcount, 1 );
-                            lock -> rwait = lock -> wwait = 0;
-                            lock -> busy = 0;
-                            * lockp = lock;
-                            return 0;
-                        }
-
-                        status = GetLastError ();
-                        CloseHandle ( lock -> wcond );
-                    }
-
-                    CloseHandle ( lock -> rcond );
-                }
-
-                CloseHandle ( lock -> mutex );
-            }
-
-            switch ( status )
-            {
-            default:
-                rc = RC ( rcPS, rcRWLock, rcConstructing, rcNoObj, rcUnknown );
-            }
-
-            free ( lock );
-        }
-
-        * lockp = NULL;
-    }
-
-    return rc;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC KRWLockAddRef ( const KRWLock *cself )
-{
-    if ( cself != NULL )
-        atomic32_inc ( & ( ( KRWLock* ) cself ) -> refcount );
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KRWLockRelease ( const KRWLock *cself )
-{
-    KRWLock *self = ( KRWLock* ) cself;
-    if ( cself != NULL )
-    {
-        if ( atomic32_dec_and_test ( & self -> refcount ) )
-        {
-            atomic32_set ( & self -> refcount, 1 );
-            return KRWLockWhack ( self );
-        }
-    }
-    return 0;
-}
-
-
-/* AcquireShared
- *  acquires read ( shared ) lock
- */
-static
-rc_t KRWLockAcquireSharedInt ( KRWLock *self, DWORD mS )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcRWLock, rcLocking, rcSelf, rcNull );
-
-    /* acquire mutex */
-    switch ( WaitForSingleObject ( self -> mutex, mS ) )
-    {
-    case WAIT_ABANDONED:
-    case WAIT_OBJECT_0:
-        break;
-    case WAIT_TIMEOUT:
-        return RC ( rcPS, rcRWLock, rcLocking, rcTimeout, rcExhausted );
-    default:
-        return RC ( rcPS, rcRWLock, rcLocking, rcNoObj, rcUnknown );
-    }
-
-    /* don't allow readers if writers are waiting */
-    if ( self -> rwait != 0 || self -> wwait != 0 || self -> busy < 0 )
-    {
-        /* indicate a waiting read lock request on our mutex */
-        ++ self -> rwait;
-
-        switch ( SignalObjectAndWait ( self -> mutex, self -> rcond, mS, false ) )
-        {
-        case WAIT_OBJECT_0:
-
-            /* drop wait count under unlock mutex */
-            -- self -> rwait;
-
-            /* release unlock and reacquire */
-            switch ( SignalObjectAndWait ( self -> ack, self -> mutex, INFINITE, false ) )
-            {
-            case WAIT_ABANDONED:
-            case WAIT_OBJECT_0:
-                break;
-            case WAIT_FAILED:
-                switch ( GetLastError () )
-                {
-                case ERROR_INVALID_HANDLE:
-                    return RC ( rcPS, rcRWLock, rcLocking, rcRWLock, rcInvalid );
-                }
-            default:
-                return RC ( rcPS, rcRWLock, rcLocking, rcNoObj, rcUnknown );
-            }
-            break;
-
-        case WAIT_TIMEOUT:
-
-            /* need to drop count, but don't have mutex */
-            switch ( WaitForSingleObject ( self -> mutex, INFINITE ) )
-            {
-            case WAIT_ABANDONED:
-            case WAIT_OBJECT_0:
-                break;
-            case WAIT_FAILED:
-                switch ( GetLastError () )
-                {
-                case ERROR_INVALID_HANDLE:
-                    return RC ( rcPS, rcRWLock, rcLocking, rcRWLock, rcInvalid );
-                }
-            default:
-                return RC ( rcPS, rcRWLock, rcLocking, rcNoObj, rcUnknown );
-            }
-
-            /* drop count and go */
-            -- self -> rwait;
-            ReleaseMutex ( self -> mutex );
-            return RC ( rcPS, rcRWLock, rcLocking, rcTimeout, rcExhausted );
-
-        case WAIT_FAILED:
-            switch ( GetLastError () )
-            {
-            case ERROR_INVALID_HANDLE:
-                return RC ( rcPS, rcRWLock, rcLocking, rcRWLock, rcInvalid );
-            }
-
-        default:
-            return RC ( rcPS, rcRWLock, rcLocking, rcNoObj, rcUnknown );
-        }
-    }
-
-    assert ( self -> busy >= 0 );
-    ++ self -> busy;
-
-    ReleaseMutex ( self -> mutex );
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KRWLockAcquireShared ( KRWLock *self )
-{
-    return KRWLockAcquireSharedInt ( self, INFINITE );
-}
-
-LIB_EXPORT rc_t CC KRWLockTimedAcquireShared ( KRWLock *self, timeout_t *tm )
-{
-    return KRWLockAcquireSharedInt ( self, tm != NULL ? tm -> mS : 0 );
-}
-
-
-/* AcquireExcl
- *  acquires write ( exclusive ) lock
- */
-static
-rc_t KRWLockAcquireExclInt ( KRWLock *self, DWORD mS )
-{
-    if ( self == NULL )
-        return RC ( rcPS, rcRWLock, rcLocking, rcSelf, rcNull );
-
-    /* acquire mutex */
-    switch ( WaitForSingleObject ( self -> mutex, mS ) )
-    {
-    case WAIT_ABANDONED:
-    case WAIT_OBJECT_0:
-        break;
-    case WAIT_TIMEOUT:
-        return RC ( rcPS, rcRWLock, rcLocking, rcTimeout, rcExhausted );
-    default:
-        return RC ( rcPS, rcRWLock, rcLocking, rcNoObj, rcUnknown );
-    }
-
-    if ( self -> wwait != 0 || self -> busy != 0 )
-    {
-        /* indicate a waiting write lock request on our mutex */
-        ++ self -> wwait;
-
-        switch ( SignalObjectAndWait ( self -> mutex, self -> wcond, mS, false ) )
-        {
-        case WAIT_OBJECT_0:
-
-            /* drop wait count under unlock mutex */
-            -- self -> wwait;
-
-            /* release unlock and reacquire */
-            switch ( SignalObjectAndWait ( self -> ack, self -> mutex, INFINITE, false ) )
-            {
-            case WAIT_ABANDONED:
-            case WAIT_OBJECT_0:
-                break;
-            case WAIT_FAILED:
-                switch ( GetLastError () )
-                {
-                case ERROR_INVALID_HANDLE:
-                    return RC ( rcPS, rcRWLock, rcLocking, rcRWLock, rcInvalid );
-                }
-            default:
-                return RC ( rcPS, rcRWLock, rcLocking, rcNoObj, rcUnknown );
-            }
-            break;
-
-        case WAIT_TIMEOUT:
-
-            /* need to drop count, but don't have mutex */
-            switch ( WaitForSingleObject ( self -> mutex, INFINITE ) )
-            {
-            case WAIT_ABANDONED:
-            case WAIT_OBJECT_0:
-                break;
-            case WAIT_FAILED:
-                switch ( GetLastError () )
-                {
-                case ERROR_INVALID_HANDLE:
-                    return RC ( rcPS, rcRWLock, rcLocking, rcRWLock, rcInvalid );
-                }
-            default:
-                return RC ( rcPS, rcRWLock, rcLocking, rcNoObj, rcUnknown );
-            }
-
-            /* drop count and go */
-            -- self -> wwait;
-            ReleaseMutex ( self -> mutex );
-            return RC ( rcPS, rcRWLock, rcLocking, rcTimeout, rcExhausted );
-
-        case WAIT_FAILED:
-            switch ( GetLastError () )
-            {
-            case ERROR_INVALID_HANDLE:
-                return RC ( rcPS, rcRWLock, rcLocking, rcRWLock, rcInvalid );
-            }
-
-        default:
-            return RC ( rcPS, rcRWLock, rcLocking, rcNoObj, rcUnknown );
-        }
-    }
-
-    assert ( self -> busy == 0 );
-    -- self -> busy;
-
-    ReleaseMutex ( self -> mutex );
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KRWLockAcquireExcl ( KRWLock *self )
-{
-    return KRWLockAcquireExclInt ( self, INFINITE );
-}
-
-LIB_EXPORT rc_t CC KRWLockTimedAcquireExcl ( KRWLock *self, timeout_t *tm )
-{
-    return KRWLockAcquireExclInt ( self, tm != NULL ? tm -> mS : 0 );
-}
-
-
-/* Unlock
- *  releases lock
- */
-LIB_EXPORT rc_t CC KRWLockUnlock ( KRWLock *self )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        return RC ( rcPS, rcRWLock, rcUnlocking, rcSelf, rcNull );
-
-    /* acquire mutex */
-    switch ( WaitForSingleObject ( self -> mutex, INFINITE ) )
-    {
-    case WAIT_ABANDONED:
-    case WAIT_OBJECT_0:
-        break;
-    case WAIT_TIMEOUT:
-        return RC ( rcPS, rcRWLock, rcUnlocking, rcTimeout, rcExhausted );
-    default:
-        return RC ( rcPS, rcRWLock, rcUnlocking, rcNoObj, rcUnknown );
-    }
-
-    /* adjust busy */
-    if ( self -> busy > 0 )
-        -- self -> busy;
-    else if ( self -> busy < 0 )
-    {
-        ++ self -> busy;
-        assert ( self -> busy == 0 );
-    }
-
-    /* detect a zero crossing and waiters */
-    if ( self -> busy != 0 || ( self -> wwait == 0 && self -> rwait == 0 ) )
-        rc = 0;
-    else
-    {
-        HANDLE cond = self -> wwait != 0 ? self -> wcond : self -> rcond;
-        switch ( SignalObjectAndWait ( cond, self -> ack, INFINITE, false ) )
-        {
-        case WAIT_OBJECT_0:
-            rc = 0;
-            break;
-        case WAIT_FAILED:
-            switch ( GetLastError () )
-            {
-            case ERROR_INVALID_HANDLE:
-                rc = RC ( rcPS, rcRWLock, rcUnlocking, rcRWLock, rcInvalid );
-                break;
-            default:
-                rc = RC ( rcPS, rcRWLock, rcUnlocking, rcNoObj, rcUnknown );
-            }
-            break;
-
-        default:
-            rc = RC ( rcPS, rcRWLock, rcUnlocking, rcNoObj, rcUnknown );
-        }
-    }
-
-    ReleaseMutex ( self -> mutex );
-    return rc;
-}
diff --git a/libs/krypto/Makefile b/libs/krypto/Makefile
deleted file mode 100644
index 4fd6fe0..0000000
--- a/libs/krypto/Makefile
+++ /dev/null
@@ -1,292 +0,0 @@
-# ===========================================================================
-#
-#                            PUBLIC DOMAIN NOTICE
-#               National Center for Biotechnology Information
-#
-#  This software/database is a "United States Government Work" under the
-#  terms of the United States Copyright Act.  It was written as part of
-#  the author's official duties as a United States Government employee and
-#  thus cannot be copyrighted.  This software/database is freely available
-#  to the public for use. The National Library of Medicine and the U.S.
-#  Government have not placed any restriction on its use or reproduction.
-#
-#  Although all reasonable efforts have been taken to ensure the accuracy
-#  and reliability of the software and data, the NLM and the U.S.
-#  Government do not and cannot warrant the performance or results that
-#  may be obtained by using this software or data. The NLM and the U.S.
-#  Government disclaim all warranties, express or implied, including
-#  warranties of performance, merchantability or fitness for any particular
-#  purpose.
-#
-#  Please cite the author in any work or product based on this material.
-#
-# ===========================================================================
-
-default: all
-
-USE_GCC_IF_ICC = 1
-
-TOP ?= $(shell ../../build/abspath.sh ../..)
-MODULE = libs/krypto
-
-INT_LIBS = \
-	libkrypto
-
-ALL_LIBS = \
-	$(INT_LIBS)
-
-include $(TOP)/build/Makefile.env
-
-ifeq ($(OS),linux)
-	INT_LIBS += libkryptotest
-endif
-
-
-#-------------------------------------------------------------------------------
-# outer targets
-#
-# This differs from other sister Makefiles in needing three other symbols defined
-# VEC_SUPPORTED, VECREG_SUPPORTED and AESNI_SUPPORTED
-# The successive symbols are additive
-# In order they are the compiler supports  the vector 'container' type,
-# the processor has supported vector registers
-# the processor supports the Intel AES-NI instruction set
-#
-# The prerequisite call to make compiler-test will have tried to compile objects
-# that show such support if the objec can be made
-all std: makedirs compiler-test
-	@ $(MAKE_CMD) \
-		VEC_SUPPORTED=$(shell if test -f $(OBJDIR)/compile-test.vec.$(LOBX) ; then echo "true"; else echo "false" ; fi) \
-		VECREG_SUPPORTED=$(shell if test -f $(OBJDIR)/compile-test.vecreg.$(LOBX) ; then echo "true"; else echo "false" ; fi) \
-		AESNI_SUPPORTED=$(shell if test -f $(OBJDIR)/compile-test.aes-ni.$(LOBX) ; then echo "true"; else echo "false" ; fi) \
-		$(TARGDIR)/std || \
-	( echo "reattempting without AES-NI instructions"; \
-	  $(MAKE_CMD) \
-		VEC_SUPPORTED=$(shell if test -f $(OBJDIR)/compile-test.vec.$(LOBX) ; then echo "true"; else echo "false" ; fi) \
-		VECREG_SUPPORTED=$(shell if test -f $(OBJDIR)/compile-test.vecreg.$(LOBX) ; then echo "true"; else echo "false" ; fi) \
-		AESNI_SUPPORTED=false \
-		$(TARGDIR)/std ) || \
-	( echo "reattempting without vector register instructions"; \
-	  $(MAKE_CMD) \
-		VEC_SUPPORTED=$(shell if test -f $(OBJDIR)/compile-test.vec.$(LOBX) ; then echo "true"; else echo "false" ; fi) \
-		VECREG_SUPPORTED=false \
-		AESNI_SUPPORTED=false \
-		$(TARGDIR)/std ) || \
-	( echo "reattempting without vector instructions"; \
-	  $(MAKE_CMD) \
-		VEC_SUPPORTED=false \
-		VECREG_SUPPORTED=false \
-		AESNI_SUPPORTED=false \
-		$(TARGDIR)/std )
-
-$(INT_LIBS): makedirs
-	@ $(MAKE_CMD) $(ILIBDIR)/$@
-
-.PHONY: all std $(ALL_LIBS)
-
-#-------------------------------------------------------------------------------
-# std
-#
-$(TARGDIR)/std: \
-	$(addprefix $(ILIBDIR)/,$(INT_LIBS))
-#	@echo VEC_SUPPORTED $(VEC_SUPPORTED)
-#	@echo VECREG_SUPPORTED $(VECREG_SUPPORTED)
-#	@echo AESNI_SUPPORTED $(AESNI_SUPPORTED)
-
-.PHONY: $(TARGDIR)/std
-
-#-------------------------------------------------------------------------------
-# clean
-#
-clean: stdclean
-
-.PHONY: clean
-
-#-------------------------------------------------------------------------------
-# compiler-test
-#
-.PHONY: compiler-test $(TARGDIR)/compiler-test
-
-# Silently try to compile three objects
-compiler-test : makedirs
-	@ $(MAKE_CMD) -i $(TARGDIR)/compiler-test >/dev/null 2>/dev/null
-
-
-COMPILE_TEST_SRC = \
-	compile-test.vec \
-	compile-test.vecreg \
-	compile-test.aes-ni
-
-COMPILE_TEST_OBJ = \
-	$(addsuffix .$(LOBX),$(COMPILE_TEST_SRC))
-
-$(TARGDIR)/compiler-test : $(COMPILE_TEST_OBJ)
-	@echo VEC_SUPPORTED $(VEC_SUPPORTED)
-	@echo VECREG_SUPPORTED $(VECREG_SUPPORTED)
-	@echo AESNI_SUPPORTED $(AESNI_SUPPORTED)
-
-#-------------------------------------------------------------------------------
-# define some additional compiler flags for special object file types
-# currently only gcc is supported and it turns out only with 4.4.0 and up
-# though other compilers could also be supported
-ifeq ($(COMP),gcc)
-CC_LISTING = -Wa,-ahlms=$(<D)/$(@F).list
-_CC_AES_NI  = -funsafe-math-optimizations -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -maes -Wa,-march=generic64+aes $(CC_LISTING)
-_CC_VECREG  = -funsafe-math-optimizations -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -Wa,-march=generic64+sse4 $(CC_LISTING)
-_CC_VEC     = $(CC_LISTING)
-else
-_CC_LISTING =
-_CC_AES_NI  =
-_CC_VECREG  =
-_CC_VEC     =
-endif
-
-ifeq ($(VEC_SUPPORTED),true)
-CC_VEC = $(_CC_VEC)
-else
-CC_VEC =
-endif
-
-ifeq ($(VECREG_SUPPORTED),true)
-CC_VECREG = $(_CC_VECREG)
-else
-CC_VECREG = 
-endif
-
-ifeq ($(AESNI_SUPPORTED),true)
-CC_AES_NI = $(_CC_AES_NI)
-else
-CC_AES_NI = 
-endif
-
-# Rules for making objects using compiler vectors
-compile-test.vec.pic.o : compile-test.c
-	@ echo +++++ Making $@ using its own rule
-	@ echo $@ $(_CC_VEC)
-	$(CC) -o $@ -fPIC $(OPT) -D_LIBRARY -DUSEVEC $(_CC_VEC) $<
-
-
-%.vec.$(LOBX): %.c
-	$(CC) -o $@ -fPIC $(OPT) -D_LIBRARY -DUSEVEC $(CC_VEC) $<
-
-
-# Rules for making objects using vectors in registers
-compile-test.vecreg.pic.o : compile-test.c
-	@ echo +++++ Making $@ using its own rule
-	@ echo $@ $(_CC_VECREG)
-	$(CC) -o $@ -fPIC $(OPT) -D_LIBRARY -DUSEVEC -DUSEVECREG $(_CC_VECREG) $<
-
-%.vecreg.$(LOBX): %.c
-	$(CC) -o $@ -fPIC $(OPT) -D_LIBRARY -DUSEVEC -DUSEVECREG $(CC_VECREG) $<
-
-
-# Rules for making objects using AES-NI extensions vectors in registers
-compile-test.aes-ni.pic.o : compile-test.c
-	@ echo +++++ Making $@ using its own rule
-	@ echo $@ $(_CC_AES_NI)
-	$(CC) -o $@ -fPIC $(OPT) -D_LIBRARY -DUSEVEC -DUSEVECREG -DUSEAESNI $(_CC_AES_NI) $<
-
-%.aes-ni.$(LOBX): %.c
-	$(CC) -o $@ -fPIC $(OPT) -D_LIBRARY -DUSEVEC -DUSEVECREG -DUSEAESNI $(CC_AES_NI) $<
-
-
-
-#-------------------------------------------------------------------------------
-# krypto
-#
-$(ILIBDIR)/libkrypto: $(addprefix $(ILIBDIR)/libkrypto.,$(ILIBEXT))
-
-ALL_LIB_SRC = \
-	ciphermgr \
-	wgaencrypt \
-	encfile \
-	encfilev2 \
-	cipher \
-	aes_core \
-	aes-byte \
-	cipher-byte \
-	key \
-	reencfile
-
-LIB_SRC = \
-	no-null-ncbi
-
-TEST_LIB_SRC =  \
-	testcipher
-
-ifeq ($(VEC_SUPPORTED),true)
-ALL_LIB_SRC += \
-	cipher-vec.vec \
-	aes-ncbi.vec
-LIB_SRC += \
-	no-null-ncbi.vec
-TEST_LIB_SRC += 
-else
-ALL_LIB_SRC += \
-	cipher-no-vec.vec
-LIB_SRC += \
-	no-null-ncbi.vec
-TEST_LIB_SRC += 
-endif
-
-ifeq ($(VECREG_SUPPORTED),true)
-ALL_LIB_SRC += \
-	cipher-vec.vecreg \
-	aes-ncbi.vecreg
-LIB_SRC += \
-	no-null-ncbi.vecreg
-TEST_LIB_SRC += 
-else
-ALL_LIB_SRC += \
-	cipher-no-vec.vecreg
-LIB_SRC += \
-	no-null-ncbi.vecreg
-TEST_LIB_SRC += 
-endif
-
-ifeq ($(AESNI_SUPPORTED),true)
-ALL_LIB_SRC += \
-	cipher-vec.aes-ni \
-	aes-ncbi.aes-ni
-LIB_SRC += \
-	no-null-ncbi.aes-ni
-TEST_LIB_SRC += 
-else
-ALL_LIB_SRC += \
-	cipher-no-vec.aes-ni
-LIB_SRC += \
-	no-null-ncbi.aes-ni
-TEST_LIB_SRC += 
-endif
-
-
-KRYPTO_SRC = $(ALL_LIB_SRC) $(LIB_SRC)
-
-KRYPTO_OBJ = \
-	$(addsuffix .$(LOBX),$(KRYPTO_SRC))
-
-KRYPTO_LIB = \
-
-$(ILIBDIR)/libkrypto.$(LIBX): $(KRYPTO_OBJ)
-	$(LD) --slib -o $@ $^ $(KRYPTO_LIB)
-
-
-#-------------------------------------------------------------------------------
-# kryptotest
-#
-
-$(ILIBDIR)/libkryptotest: $(addprefix $(ILIBDIR)/libkryptotest.,$(ILIBEXT))
-
-KRYPTOTEST_SRC = $(TEST_LIB_SRC)
-
-KRYPTOTEST_OBJ = \
-	$(addsuffix .$(LOBX),$(KRYPTOTEST_SRC))
-
-KRYPTOTEST_LIB = \
-
-$(ILIBDIR)/libkryptotest.$(LIBX): $(KRYPTOTEST_OBJ)
-	$(LD) --slib -o $@ $^ $(KRYPTOTEST_LIB)
-
-
-
-
diff --git a/libs/krypto/aes-byte.c b/libs/krypto/aes-byte.c
deleted file mode 100644
index 29e104b..0000000
--- a/libs/krypto/aes-byte.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-#include <krypto/extern.h>
-#include <klib/defs.h>
-
-#include "aes-priv.h"
-#include "cipher-priv.h"
-
-#include <klib/rc.h>
-
-#include <string.h>
-#include <assert.h>
-
-
-/* instantiate for class functions that use the VT */
-#define BLOCKCIPHER_BYTE_IMPL KAESBlockCipherByte
-#include "blockcipher-impl.h"
-
-static const char KAESByteBlockCipherClassName[] = "KAESCipherByte";
-
-static
-void KAESBlockCipherByteDestroy (const KAESBlockCipherByte * self)
-{
-    /* we use a constant object */
-}
-
-
-static
-uint32_t KAESBlockCipherByteBlockSize ()
-{
-    return AES_BLOCK_SIZE;
-}
-
-
-/* ----------------------------------------------------------------------
- * KeySize
- *   How large is the stored key for this cipher?  Not the user key used
- *   to create this key (key schedule)
- *
- *   This is needed by KCipher to know how large the KCipher objecr is at
- *   allocation and to know how much of a buffer each decryption/encryption is
- */
-static
-uint32_t KAESBlockCipherByteKeySize ()
-{
-    return  (uint32_t)sizeof (AES_KEY);
-}
-
-
-/* ----------------------------------------------------------------------
- * SetEncryptKey
- *   The KCipher calls this to have the block cipher build an encryption
- *   key in the KCipher object
- *
- */
-static
-rc_t KAESBlockCipherByteSetEncryptKey (void * encrypt_key,
-                                       const char * user_key,
-                                       uint32_t user_key_size)
-{
-    int iii;
-    rc_t rc;
-
-    assert (encrypt_key);
-    assert (user_key);
-    assert (user_key_size != 0);
-
-    iii = AES_set_encrypt_key((const unsigned char *)user_key,
-                              (int)user_key_size * 8,
-                              encrypt_key);
-    if (iii == 0)
-        rc = 0;
-    else
-    {
-        switch (iii)
-        {
-        default: /* not in the code when this was written */
-            rc = RC (rcKrypto, rcCipher, rcUpdating, rcEncryptionKey, rcUnknown);
-            break;
-
-        case -1: /* bad parameters */
-            rc = RC (rcKrypto, rcCipher, rcUpdating, rcParam, rcInvalid);
-            break;
-
-        case -2: /* bad bit count */
-            rc = RC (rcKrypto, rcCipher, rcUpdating, rcParam, rcIncorrect);
-            break;
-        }
-        memset (encrypt_key, 0, sizeof (AES_KEY));
-    }
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * SetDecryptKey
- *   The KCipher calls this to have the block cipher build an decryption
- *   key in the KCipher object
- *
- */
-static
-rc_t KAESBlockCipherByteSetDecryptKey (void * decrypt_key,
-                                       const char * user_key,
-                                       uint32_t user_key_size)
-{
-    int iii;
-    rc_t rc;
-
-    assert (decrypt_key);
-    assert (user_key);
-    assert (user_key_size != 0);
-
-    iii = AES_set_decrypt_key((const unsigned char *)user_key, (int)user_key_size * 8,
-                              decrypt_key);
-    if (iii == 0)
-        rc = 0;
-    else
-    {
-        switch (iii)
-        {
-        default: /* not in the code when this was written */
-            rc = RC (rcKrypto, rcCipher, rcUpdating, rcEncryptionKey, rcUnknown);
-            break;
-
-        case -1: /* bad parameters */
-            rc = RC (rcKrypto, rcCipher, rcUpdating, rcParam, rcInvalid);
-            break;
-
-        case -2: /* bad bit count */
-            rc = RC (rcKrypto, rcCipher, rcUpdating, rcParam, rcIncorrect);
-            break;
-        }
-        memset (decrypt_key, 0, sizeof (AES_KEY));
-    }
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * Encrypt
- *
- *   Perform an encryption of a single block.  Chained modes and stream
- *   cipher modes will call this multiple times.
- *
- */
-static
-void KAESBlockCipherByteEncrypt (const CipherBlock in,
-                                 CipherBlock out,
-                                 const void * key)
-{
-    assert (in);
-    assert (out);
-    assert (key);
-
-    AES_encrypt ((const uint8_t*)in, (uint8_t*)out, key);
-}
-
-
-/* ----------------------------------------------------------------------
- * Decrypt
- *
- *   Perform a decryption of a single block.  Chained modes and stream
- *   cipher modes will call this multiple times.
- *
- */
-static
-void KAESBlockCipherByteDecrypt (const CipherBlock in,
-                                 CipherBlock out,
-                                 const void * key)
-{
-    assert (in);
-    assert (out);
-    assert (key);
-
-    AES_decrypt ((const uint8_t*)in, (uint8_t*)out, key);
-}
-
-
-static const struct
-KBlockCipherByte_vt_v1 aes_vt = 
-{
-    /* .version */
-    { 1, 0 },
-
-    KAESBlockCipherByteDestroy,
-
-    KAESBlockCipherByteBlockSize,
-    KAESBlockCipherByteKeySize,
-
-    KAESBlockCipherByteSetEncryptKey,
-    KAESBlockCipherByteSetDecryptKey,
-
-    KAESBlockCipherByteEncrypt,
-    KAESBlockCipherByteDecrypt
-};
-
-
-rc_t KAESBlockCipherByteMake (KBlockCipherByte ** pobj)
-{
-    rc_t rc;
-
-    if (pobj == NULL)
-        rc = RC (rcKrypto, rcBlockCipher, rcConstructing, rcSelf, rcNull);
-
-    else
-    {
-        rc = 0;
-        *pobj = (KBlockCipherByte*)&aes_vt;
-    }
-    return rc;
-}
-
-/* EOF */
-
diff --git a/libs/krypto/aes-ncbi-priv.h b/libs/krypto/aes-ncbi-priv.h
deleted file mode 100644
index 5738029..0000000
--- a/libs/krypto/aes-ncbi-priv.h
+++ /dev/null
@@ -1,227 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-#ifndef _h_krypto_aes_ncbi_priv_libs_
-#define _h_krypto_aes_ncbi_priv_libs_
-
-#include <klib/defs.h>
-#include <v128.h>
-
-#include "ncbi-priv.h"
-#include "cipher-impl.h"
-#include "blockcipher-impl.h"
-
-#ifdef  __cplusplus
-extern "C" {
-#endif
-
-
-/* ======================================================================
- * FIPS-197 2.1
- */
-#define AES_BLOCK_BITS (128)
-#define AES_BLOCK_BYTES (AES_BLOCK_BITS/8)
-
-
-/* ======================================================================
- * FIPS-197 3,4 - 3.5
- *
- * FIPS-197 defines Nk as number of 32-bit words in the user key
- */
-#define AES_Nk_128 (4)
-#define AES_Nk_192 (6)
-#define AES_Nk_256 (8)
-
-
-/*
- * FIPS-197 defines Nb as number of 32-bit words in the cipher block
- *
- * There is much odd naming in the document from the perspective of a software
- * engineer.
- */
-#define AES_Nb (4)
-#define AES_Nb_128 (AES_Nb)
-#define AES_Nb_192 (AES_Nb)
-#define AES_Nb_256 (AES_Nb)
-
-
-/* 
- * FIPS-197 defines Nr as the number of rounds for a cipher of a given original 
- * user key length.
- *
- * Another odd naming as it is really the zero based highest round offset
- * as 1 first round + Nr-1 middle rounds + 1 last round are performed for
- * each encrypt or decrypt block.  There are thus Nr + 1 round keys needed
- * in the encryption and decryption key schedules
- */
-#define AES_Nr_128 (10)
-#define AES_Nr_192 (12)
-#define AES_Nr_256 (14)
-#define AES_Nr_MAX (15)
-
-/* Most useful for testingg against Appendix A-C of the FIPS-197 document */
-#define DEBUG_OBJECT(msg) DBGMSG(DBG_AES,DBG_FLAG(DBG_AES_OBJECT), msg)
-#define DEBUG_KEYEXP(msg) DBGMSG(DBG_AES,DBG_FLAG(DBG_AES_KEYEXP), msg)
-#define DEBUG_CIPHER(msg) DBGMSG(DBG_AES,DBG_FLAG(DBG_AES_CIPHER), msg)
-#define DEBUG_INVKEYEXP(msg) DBGMSG(DBG_AES,DBG_FLAG(DBG_AES_INVKEYEXP), msg)
-#define DEBUG_INVCIPHER(msg) DBGMSG(DBG_AES,DBG_FLAG(DBG_AES_INVCIPHER), msg)
-
-#define DEBUG_CIPHER_MVECTOR(M,v)                                   \
-    DBGMSG(DBG_AES,DBG_FLAG(DBG_AES_CIPHER),                        \
-           ("%s:\t%0.8x %0.8x %0.8x %0.8x\n",M,                     \
-            v.columns[0],v.columns[1],v.columns[2],v.columns[3]))
-#define DEBUG_INVCIPHER_MVECTOR(M,v)                                \
-    DBGMSG(DBG_AES,DBG_FLAG(DBG_AES_INVCIPHER),                     \
-           ("%s:\t%0.8x %0.8x %0.8x %0.8x\n",M,                     \
-            v.columns[0],v.columns[1],v.columns[2],v.columns[3]))
-
-#if _DEBUGGING
-#if 1
-#define DEBUG_CIPHER_VECTOR(M,V)                        \
-    {                                                   \
-        CipherVec_AES_u v; v.state = V;                 \
-        DBGMSG(DBG_AES,DBG_FLAG(DBG_AES_CIPHER),        \
-               ("%s:\t%0.8x %0.8x %0.8x %0.8x\n", M,    \
-                bswap_32(v.columns[0]),                 \
-                bswap_32(v.columns[1]),                 \
-                bswap_32(v.columns[2]),                 \
-                bswap_32(v.columns[3])));               \
-            }
-#define DEBUG_INVCIPHER_VECTOR(M,V)                     \
-    {                                                   \
-        CipherVec_AES_u v; v.state = V;                 \
-        DBGMSG(DBG_AES,DBG_FLAG(DBG_AES_INVCIPHER),     \
-               ("%s:\t%0.8x %0.8x %0.8x %0.8x\n", M,    \
-                bswap_32(v.columns[0]),                 \
-                bswap_32(v.columns[1]),                 \
-                bswap_32(v.columns[2]),                 \
-                bswap_32(v.columns[3])));               \
-            }
-#else
-#define DEBUG_CIPHER_VECTOR(M,v)                              \
-    KOutMsg ( "%s:\t%0.8x %0.8x %0.8x %0.8x\n", M,            \
-              bswap_32(((CipherVec_AES_u*)&(v))->columns[0]), \
-              bswap_32(((CipherVec_AES_u*)&(v))->columns[1]), \
-              bswap_32(((CipherVec_AES_u*)&(v))->columns[2]), \
-              bswap_32(((CipherVec_AES_u*)&(v))->columns[3]))
-#define DEBUG_INVCIPHER_VECTOR(M,v)                           \
-    KOutMsg ( "%s:\t%0.8x %0.8x %0.8x %0.8x\n", M,            \
-              bswap_32(((CipherVec_AES_u*)&(v))->columns[0]), \
-              bswap_32(((CipherVec_AES_u*)&(v))->columns[1]), \
-              bswap_32(((CipherVec_AES_u*)&(v))->columns[2]), \
-              bswap_32(((CipherVec_AES_u*)&(v))->columns[3]))
-#endif
-#define DDEBUG_CIPHER_VECTOR(M,v)                             \
-    KOutMsg ( "%s:\t%0.8x %0.8x %0.8x %0.8x\n", M,            \
-              bswap_32(((CipherVec_AES_u*)&(v))->columns[0]), \
-              bswap_32(((CipherVec_AES_u*)&(v))->columns[1]), \
-              bswap_32(((CipherVec_AES_u*)&(v))->columns[2]), \
-              bswap_32(((CipherVec_AES_u*)&(v))->columns[3]))
-#define DDEBUG_INVCIPHER_VECTOR(M,v)                          \
-    KOutMsg ( "%s:\t%0.8x %0.8x %0.8x %0.8x\n", M,            \
-              bswap_32(((CipherVec_AES_u*)&(v))->columns[0]), \
-              bswap_32(((CipherVec_AES_u*)&(v))->columns[1]), \
-              bswap_32(((CipherVec_AES_u*)&(v))->columns[2]), \
-              bswap_32(((CipherVec_AES_u*)&(v))->columns[3]))
-
-#else
-#define DEBUG_CIPHER_VECTOR(M,V)
-#define DEBUG_INVCIPHER_VECTOR(M,V)
-#endif
-
-/* -----
- * 8 and 32 bit unsigned integers
- */
-typedef uint8_t  AESByte;
-typedef uint32_t AESWord;
-typedef union AESColumn AESColumn;
-union AESColumn
-{
-    AESWord word;
-    AESByte bytes [sizeof(AESWord)];
-};
-
-
-/* -----
- * 128 byte block in various forms
- */
-typedef AESByte AESBlock [AES_Nb*sizeof(AESWord)];
-
-typedef v128_u8_t  CipherVecByte;
-typedef v128_u32_t CipherVecWord;
-
-
-typedef struct AESKeySchedule  AESKeySchedule;
-struct AESKeySchedule
-{
-    CipherVec round_keys [AES_Nr_MAX];
-    uint32_t number_of_rounds;
-};
-
-/* ======================================================================
- * FIPS-197 3,4 - 3.5
- *
- * An AES State is the same size as the cipher block size.
- * They are eaither 4 columns of 32 bits or 16 individual bytes.
- * The columns can be accessed by their individual bytes s0
- * there are 4X32, 4X4X8 or 16X8 bits in a state.
- */
-typedef union
-{
-    CipherVec   state;
-    uint64_t    u64     [AES_Nb/2];
-    AESWord     columns [AES_Nb];
-    AESByte     bytes   [AES_Nb * sizeof (AESWord)];
-    AESByte     grid    [AES_Nb][sizeof (AESWord)];
-} CipherVec_AES_u;
-
-
-typedef union
-{
-    CipherVec   state;
-    v128_u32_t columns;
-} CipherVec_uu __attribute__ ((aligned(16)));
-
-/* 
- * KCipher with 128 bit alignment.
- */
-typedef struct CipherAes CipherAes;
-struct CipherAes
-{
-    KCipher dad;
-    AESKeySchedule e_key;
-    AESKeySchedule d_key;
-    CipherVec    e_ivec;
-    CipherVec    d_ivec;
-};
-
-
-#ifdef  __cplusplus
-}
-#endif
-
-#endif /* #ifndef _h_krypto_aes_ncbi_priv_libs_ */
-
-
diff --git a/libs/krypto/aes-ncbi.c b/libs/krypto/aes-ncbi.c
deleted file mode 100644
index 4215feb..0000000
--- a/libs/krypto/aes-ncbi.c
+++ /dev/null
@@ -1,2644 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-
-#include <krypto/extern.h>
-
-#include "ncbi-priv.h"
-#include "aes-ncbi-priv.h"
-#include "cipher-priv.h"
-#include "blockcipher-priv.h"
-
-#include <klib/debug.h>
-#include <klib/out.h>
-#include <klib/rc.h>
-
-
-#include <byteswap.h>
-#include <string.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <sysalloc.h>
-
-#if USE_VEC
-#include <cpuid.h>
-#endif
-
-#if USE_VECREG
-#include <v128.h>
-#endif
-
-/*
- * This implements the AES cipher as defined by FIPS-197 from NIST
- *  
- * Notes on implmentation:
- *
- * NOTE:
- * Byte ordering in AES is not critical but unllike the original implmentation
- * bytes are not re-ordered to a big endian order upon reading them in and this
- * code will expect to run on an Intel/AMD type processor and might have issues
- * on some big endian processors.
- *
- * NOTE:
- * Many functions are written as static inline functions to
- * facilitate GCC type assembly language optimization on various processors
- *
- * NOTE:
- * This implements the Equivalent Inverse Cipher not the Inverse Cipher.  In
- * general functions will match those defined in the FIPS-197 document where they
- * do not get optimized away for Intel/AMD XMM registers and AES-NI instructions.
- *
- * NOTE:
- * C-99 types are used for specific sized types.  An unaddornded unsigned type
- * is used for many index type variables to allow the compiler choice in
- * size where size does not matter very much.  As these index variables do
- * not go above 16 any size would do but the compiler can choose the size most
- * suited for array subscripting.
- */
-
-static const
-CipherVec vec_00 =  { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-
-static const
-CipherVec vec_01 =  { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-                      0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 };
-
-static const
-CipherVec vec_0F =  { 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
-                      0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F };
-
-static const
-CipherVec vec_10 =  { 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
-                      0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10 };
-
-
-
-/* ======================================================================
- * These functions implment the Advanced Encryption Standard AES as defined
- * in the FIPS (Federal Information Processing Standars Publication 197
- * Of Nevember 26, 2001.
- */
-
-/* ======================================================================
- * FIPS-197 5.1
- */
-
-/*
- * Read a blocks worth of bytes into an CipherVec
- *
- * With vector registers it is a single instruction, without them it
- * is a memmove call
- */
-static __inline__ 
-CipherVec AESBCMEMBER(StateIn) (const void * ain)
-    __attribute__ ((always_inline));
-
-static __inline__ 
-CipherVec AESBCMEMBER(StateIn) (const void * ain)
-{
-#if USE_VEC_REG
-
-    register CipherVec vec;
-    __asm__ (
-        "movdqu (%[a]),%[s]" : [s] "=x" (vec) : [a] "D" (ain)
-        );
-    return vec;
-
-#else
-
-    CipherVec_AES_u u;
-    memmove (&u.bytes, ain, sizeof (u));
-    return u.state;
-
-#endif
-}
-
-
-/*
- * Write a block's worth of bytes out from an CipherVec
- *
- * With vector registers it is a single instruction, without them it
- * is a memmove call
- */
-static __inline__
-void AESBCMEMBER(StateOut) (const CipherVec vec, void * rout)
-    __attribute__ ((always_inline));
-
-static __inline__
-void AESBCMEMBER(StateOut) (const CipherVec vec, void * rout)
-{
-#if USE_VEC_REG
-
-    register CipherVec rvec = vec;
-    __asm__ (
-        "movdqu %[s],(%[a])" : : [s] "x" (rvec), [a] "D" (rout)
-        );
-
-#else
-
-    memmove (rout, &vec, sizeof (vec));
-
-#endif
-}
-
-
-static __inline__ 
-CipherVec AESBCMEMBER(VecXor) (CipherVec v1, CipherVec v2)
-    __attribute__ ((always_inline));
-
-static __inline__ 
-CipherVec AESBCMEMBER(VecXor) (CipherVec v1, CipherVec v2)
-{
-#if USE_VEC
-
-    return v1 ^ v2;
-
-#else
-
-    CipherVec_AES_u u1, u2; /* state and key not countries :) */
-    unsigned ix;
-
-    u1.state = v1;
-    u2.state = v2;
-
-    for (ix = 0; ix < AES_Nb; ++ix)
-        u1.columns[ix] ^= u2.columns[ix];
-
-    return u1.state;
-
-#endif
-}
-
-
-static __inline__ 
-CipherVec AESBCMEMBER(VecAnd) (CipherVec v1, CipherVec v2)
-    __attribute__ ((always_inline));
-
-static __inline__ 
-CipherVec AESBCMEMBER(VecAnd) (CipherVec v1, CipherVec v2)
-{
-#if USE_VEC
-
-    return v1 & v2;
-
-#else
-
-    CipherVec_AES_u u1, u2; /* state and key not countries :) */
-    unsigned ix;
-
-    u1.state = v1;
-    u2.state = v2;
-
-    for (ix = 0; ix < AES_Nb; ++ix)
-        u1.columns[ix] &= u2.columns[ix];
-
-    return u1.state;
-
-#endif
-}
-
-
-static __inline__ 
-CipherVec AESBCMEMBER(VecOr) (CipherVec v1, CipherVec v2)
-    __attribute__ ((always_inline));
-
-static __inline__ 
-CipherVec AESBCMEMBER(VecOr) (CipherVec v1, CipherVec v2)
-{
-#if USE_VEC
-
-    return v1 | v2;
-
-#else
-
-    CipherVec_AES_u u1, u2; /* state and key not countries :) */
-    unsigned ix;
-
-    u1.state = v1;
-    u2.state = v2;
-
-    for (ix = 0; ix < AES_Nb; ++ix)
-        u1.columns[ix] |= u2.columns[ix];
-
-    return u1.state;
-
-#endif
-}
-
-
-static __inline__ 
-CipherVec AESBCMEMBER(VecAdd) (CipherVec v1, CipherVec v2)
-    __attribute__ ((always_inline));
-
-static __inline__ 
-CipherVec AESBCMEMBER(VecAdd) (CipherVec v1, CipherVec v2)
-{
-#if USE_VEC
-
-    return v1 + v2;
-
-#else
-
-    CipherVec_AES_u u1, u2; /* state and key not countries :) */
-    unsigned ix;
-
-    u1.state = v1;
-    u2.state = v2;
-
-    for (ix = 0; ix < AES_Nb; ++ix)
-        u1.columns[ix] += u2.columns[ix];
-
-    return u1.state;
-
-#endif
-}
-
-
-static __inline__ 
-CipherVec AESBCMEMBER(VecSub) (CipherVec v1, CipherVec v2)
-    __attribute__ ((always_inline));
-
-static __inline__ 
-CipherVec AESBCMEMBER(VecSub) (CipherVec v1, CipherVec v2)
-{
-#if USE_VEC
-
-    return v1 - v2;
-
-#else
-
-    CipherVec_AES_u u1, u2; /* state and key not countries :) */
-    unsigned ix;
-
-    u1.state = v1;
-    u2.state = v2;
-
-    for (ix = 0; ix < AES_Nb; ++ix)
-        u1.columns[ix] -= u2.columns[ix];
-
-    return u1.state;
-
-#endif
-}
-
-
-static __inline__ 
-CipherVec AESBCMEMBER(VecMul) (CipherVec v1, CipherVec v2)
-    __attribute__ ((always_inline));
-
-static __inline__ 
-CipherVec AESBCMEMBER(VecMul) (CipherVec v1, CipherVec v2)
-{
-#if USE_VEC
-
-    return v1 * v2;
-
-#else
-
-    CipherVec_AES_u u1, u2; /* state and key not countries :) */
-    unsigned ix;
-
-    u1.state = v1;
-    u2.state = v2;
-
-    for (ix = 0; ix < AES_Nb; ++ix)
-        u1.columns[ix] *= u2.columns[ix];
-
-    return u1.state;
-
-#endif
-}
-
-
-static __inline__ 
-CipherVec AESBCMEMBER(VecDiv) (CipherVec v1, CipherVec v2)
-    __attribute__ ((always_inline));
-
-static __inline__ 
-CipherVec AESBCMEMBER(VecDiv) (CipherVec v1, CipherVec v2)
-{
-#if USE_VEC
-
-    return v1 / v2;
-
-#else
-
-    CipherVec_AES_u u1, u2; /* state and key not countries :) */
-    unsigned ix;
-
-    u1.state = v1;
-    u2.state = v2;
-
-    for (ix = 0; ix < AES_Nb; ++ix)
-        u1.columns[ix] /= u2.columns[ix];
-
-    return u1.state;
-
-#endif
-}
-
-static __inline__ 
-CipherVec AESBCMEMBER(PackShuffleBytes) (CipherVec dest, CipherVec mask)
-    __attribute__ ((always_inline));
-
-static __inline__ 
-CipherVec AESBCMEMBER(PackShuffleBytes) (CipherVec dest, CipherVec mask)
-{
-#if USE_VEC_REG
-
-    return op_PSHUFB128 (dest, mask);
-
-#else
-
-    CipherVec_AES_u out, in, gate;
-    unsigned ix;
-
-    in.state = dest;
-    gate.state = mask;
-
-    for (ix = 0; ix < sizeof dest; ++ix)
-    {
-        if (gate.bytes[ix] & 0x80)
-            out.bytes[ix] = 0;
-        else
-            out.bytes[ix] = in.bytes[gate.bytes[ix] & 0x0F];
-    }
-
-    return out.state;
-
-#endif
-}
-
-
-static __inline__ 
-CipherVec AESBCMEMBER(VecSLLBI) (CipherVec v, const int k)
-    __attribute__ ((always_inline));
-
-static __inline__ 
-CipherVec AESBCMEMBER(VecSLLBI) (CipherVec v, const int k)
-{
-#if USE_VEC_REG
-    static const CipherVec sl_mask [9] = 
-        {
-            { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-              0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
-            { 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
-              0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE },
-            { 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC,
-              0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC },
-            { 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8,
-              0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8 },
-            { 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
-              0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0 },
-            { 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0,
-              0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0 },
-            { 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0,
-              0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0 },
-            { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
-              0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 },
-            { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-              0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
-        };
-    CipherVec vv = v;
-
-    assert (k <= 8);
-    
-
-/*     DEBUG_CIPHER_VECTOR ("mask", sl_mask[k]); */
-/*     DEBUG_CIPHER_VECTOR ("v 1", vv); */
-    vv = op_PSLLDI128 (vv, k);
-/*     DEBUG_CIPHER_VECTOR ("v 2", vv); */
-    vv = AESBCMEMBER(VecAnd) (vv, sl_mask[k]);
-/*     DEBUG_CIPHER_VECTOR ("v 3", vv); */
-    return vv;
-
-#else
-
-    CipherVec_AES_u vv; /* state and key not countries :) */
-    unsigned ix;
-
-    vv.state = v;
-
-    for (ix = 0; ix < sizeof (v); ++ix)
-    {
-        KOutMsg ("SLLBI %d %x ", k, vv.bytes[ix]);
-        vv.bytes[ix] <<= k;
-        KOutMsg ("%x\n", vv.bytes[ix]);
-    }
-    return vv.state;
-
-#endif
-}
-
-
-static __inline__ 
-CipherVec AESBCMEMBER(VecSRLBI) (CipherVec v, const int k)
-    __attribute__ ((always_inline));
-
-static __inline__ 
-CipherVec AESBCMEMBER(VecSRLBI) (CipherVec v, const int k)
-{
-#if USE_VEC_REG
-    static const CipherVec sr_mask [9] = 
-        {
-            { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-              0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
-            { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F,
-              0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F },
-            { 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
-              0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F },
-            { 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F,
-              0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F },
-            { 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
-              0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F },
-            { 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
-              0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07 },
-            { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
-              0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03 },
-            { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-              0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 },
-            { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-              0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
-        };
-
-    v = op_PSRLDI128 (v, k);
-    v = AESBCMEMBER(VecAnd) (v, sr_mask[(k<8)?k:8]);
-    return v;
-
-#else
-
-    CipherVec_AES_u vv; /* state and key not countries :) */
-    unsigned ix;
-
-    vv.state = v;
-
-    for (ix = 0; ix < sizeof (v); ++ix)
-    {
-        KOutMsg ("SRLBI %d %x ", k, vv.bytes[ix]);
-        vv.bytes[ix] >>= k;
-        KOutMsg ("%x\n", vv.bytes[ix]);
-    }
-    return vv.state;
-
-#endif
-}
-
-
-static __inline__
-CipherVec AESBCMEMBER(SetColumn) (CipherVec state, AESWord column, const int which)
-    __attribute__ ((always_inline));
-
-static __inline__
-CipherVec AESBCMEMBER(SetColumn) (CipherVec state, AESWord column, const int which)
-{
-#if USE_VEC_REG
-    state = op_PINSRUD (state, column, which);
-#else
-    CipherVec_AES_u u;
-    u.state = state;
-    u.columns [which] = column;
-    state = u.state;
-#endif
-    return state;
-}
-
-
-/* ======================================================================
- * FIPS-197 5.1.4
- *
- * The AddRoundKey transformation is a sinple exclusive or of all 128 bits
- * in the current block against a round key.  This operation is used in all
- * Cipher and EqInvCipher rounds
- *
- * With vector types it is a single operation that with vector registers is
- * a single op-code.
- */
-static __inline__ 
-CipherVec AESBCMEMBER(AddRoundKey) (CipherVec state, CipherVec round_key)
-    __attribute__ ((always_inline));
-
-static __inline__ 
-CipherVec AESBCMEMBER(AddRoundKey) (CipherVec state, CipherVec round_key)
-{
-    return AESBCMEMBER(VecXor) (state, round_key);
-}
-
-
-/* ======================================================================
- * FIPS-197 5.1.2
- *
- * FIPS 197 describes the state in column major format
- * while C and assembly programmers tend to think in row major
- * The byte order is 0,1,2,3,,...F as shown in the first diagram.
- *
- *  ShiftRows() is defined as leaving this state
- * +---+---+---+---+     +---+---+---+---+
- * | 0 | 4 | 8 | C |     | 0 | 4 | 8 | C |
- * +---+---+---+---+     +---+---+---+---+
- * | 1 | 5 | 9 | D |     | 5 | 9 | D | 1 |
- * +---+---+---+---+     +---+---+---+---+
- * | 2 | 6 | A | E |     | A | E | 2 | 6 |
- * +---+---+---+---+     +---+---+---+---+
- * | 3 | 7 | B | F |     | F | 3 | 7 | B |
- * +---+---+---+---+     +---+---+---+---+
- */
-static __inline__
-CipherVec AESBCMEMBER(ShiftRows) (CipherVec state)
-    __attribute__ ((always_inline));
-
-static __inline__
-CipherVec AESBCMEMBER(ShiftRows) (CipherVec state)
-{
-static const
-    CipherVec ShiftRowTable
-    /*   0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15 */
-    = {  0,  5, 10, 15,  4,  9, 14,  3,  8, 13,  2,  7, 12,  1,  6, 11 };
-
-    state = AESBCMEMBER(PackShuffleBytes) (state, ShiftRowTable);
-    return state;
-}
-
-
-/* ======================================================================
- * FIPS-197 5.3.1
- *
- * InvShiftRows() is defined as leaving this state
- * +---+---+---+---+     +---+---+---+---+
- * | 0 | 4 | 8 | C |     | 0 | 4 | 8 | C |
- * +---+---+---+---+     +---+---+---+---+
- * | 1 | 5 | 9 | D |     | D | 1 | 5 | 9 |
- * +---+---+---+---+     +---+---+---+---+
- * | 2 | 6 | A | E |     | A | E | 2 | 6 |
- * +---+---+---+---+     +---+---+---+---+
- * | 3 | 7 | B | F |     | 7 | B | F | 3 |
- * +---+---+---+---+     +---+---+---+---+
- */
-static __inline__
-CipherVec AESBCMEMBER(InvShiftRows) (CipherVec state)
-    __attribute__ ((always_inline));
-
-
-static __inline__
-CipherVec AESBCMEMBER(InvShiftRows) (CipherVec state)
-{
-    static const CipherVecByte InvShiftRowTable
-        /*   0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15 */
-        = {  0, 13, 10,  7,  4,  1, 14, 11,  8,  5,  2, 15, 12,  9,  6,  3 };
-
-    state = AESBCMEMBER(PackShuffleBytes) (state, InvShiftRowTable);
-    return state;
-}
-
-
-/* ======================================================================
- * +---+---+---+---+     +---+---+---+---+
- * | 0 | 4 | 8 | C |     | 3 | 7 | B | F |
- * +---+---+---+---+     +---+---+---+---+
- * | 1 | 5 | 9 | D |     | 0 | 4 | 8 | C |
- * +---+---+---+---+     +---+---+---+---+
- * | 2 | 6 | A | E |     | 1 | 5 | 9 | D |
- * +---+---+---+---+     +---+---+---+---+
- * | 3 | 7 | B | F |     | 2 | 6 | A | E |
- * +---+---+---+---+     +---+---+---+---+
- */
-static __inline__
-CipherVec AESBCMEMBER(RotBytesRight) (CipherVec state)
-    __attribute__ ((always_inline));
-
-static __inline__
-CipherVec AESBCMEMBER(RotBytesRight) (CipherVec state)
-{
-static const
-    CipherVec ShiftRowTable
-    /*   0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15 */
-    = {  3,  0,  1,  2,  7,  4,  5,  6, 11,  8,  9, 10, 15, 12, 13, 14 };
-
-    state = AESBCMEMBER(PackShuffleBytes) (state, ShiftRowTable);
-    return state;
-}
-
-
-/* ======================================================================
- * +---+---+---+---+     +---+---+---+---+
- * | 0 | 4 | 8 | C |     | 1 | 5 | B | D |
- * +---+---+---+---+     +---+---+---+---+
- * | 1 | 5 | 9 | D |     | 2 | 6 | 8 | E |
- * +---+---+---+---+     +---+---+---+---+
- * | 2 | 6 | A | E |     | 3 | 7 | 9 | F |
- * +---+---+---+---+     +---+---+---+---+
- * | 3 | 7 | B | F |     | 0 | 4 | 8 | C |
- * +---+---+---+---+     +---+---+---+---+
- */
-static __inline__
-CipherVec AESBCMEMBER(RotBytesLeft) (CipherVec state)
-    __attribute__ ((always_inline));
-
-static __inline__
-CipherVec AESBCMEMBER(RotBytesLeft) (CipherVec state)
-{
-    static const CipherVec ShiftRowTable
-        /*   0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15 */
-        = {  1,  2,  3,  0,  5,  6,  7,  4,  9, 10, 11,  8, 13, 14, 15, 12 };
-
-    state = AESBCMEMBER(PackShuffleBytes) (state, ShiftRowTable);
-    return state;
-}
-
-
-/* ======================================================================
- * FIPS-197 5.1.1
- */
-
-
-/*
- * SubBytes replaces each byte in a state with a specific byte value from
- * A Rijndael Substitution box
- */
-static const 
-AESByte AESBCMEMBER(RijndaelSBox)[256] = 
-{
-/*        -0    -1    -2    -3    -4    -5    -6    -7    -8    -9    -A    -B    -C    -D    -E    -F */
-/* 0- */ 0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76,
-/* 1- */ 0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0,
-/* 2- */ 0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC, 0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15,
-/* 3- */ 0x04, 0xC7, 0x23, 0xC3, 0x18, 0x96, 0x05, 0x9A, 0x07, 0x12, 0x80, 0xE2, 0xEB, 0x27, 0xB2, 0x75,
-/* 4- */ 0x09, 0x83, 0x2C, 0x1A, 0x1B, 0x6E, 0x5A, 0xA0, 0x52, 0x3B, 0xD6, 0xB3, 0x29, 0xE3, 0x2F, 0x84,
-/* 5- */ 0x53, 0xD1, 0x00, 0xED, 0x20, 0xFC, 0xB1, 0x5B, 0x6A, 0xCB, 0xBE, 0x39, 0x4A, 0x4C, 0x58, 0xCF,
-/* 6- */ 0xD0, 0xEF, 0xAA, 0xFB, 0x43, 0x4D, 0x33, 0x85, 0x45, 0xF9, 0x02, 0x7F, 0x50, 0x3C, 0x9F, 0xA8,
-/* 7- */ 0x51, 0xA3, 0x40, 0x8F, 0x92, 0x9D, 0x38, 0xF5, 0xBC, 0xB6, 0xDA, 0x21, 0x10, 0xFF, 0xF3, 0xD2,
-/* 8- */ 0xCD, 0x0C, 0x13, 0xEC, 0x5F, 0x97, 0x44, 0x17, 0xC4, 0xA7, 0x7E, 0x3D, 0x64, 0x5D, 0x19, 0x73,
-/* 9- */ 0x60, 0x81, 0x4F, 0xDC, 0x22, 0x2A, 0x90, 0x88, 0x46, 0xEE, 0xB8, 0x14, 0xDE, 0x5E, 0x0B, 0xDB,
-/* A- */ 0xE0, 0x32, 0x3A, 0x0A, 0x49, 0x06, 0x24, 0x5C, 0xC2, 0xD3, 0xAC, 0x62, 0x91, 0x95, 0xE4, 0x79,
-/* B- */ 0xE7, 0xC8, 0x37, 0x6D, 0x8D, 0xD5, 0x4E, 0xA9, 0x6C, 0x56, 0xF4, 0xEA, 0x65, 0x7A, 0xAE, 0x08,
-/* C- */ 0xBA, 0x78, 0x25, 0x2E, 0x1C, 0xA6, 0xB4, 0xC6, 0xE8, 0xDD, 0x74, 0x1F, 0x4B, 0xBD, 0x8B, 0x8A,
-/* D- */ 0x70, 0x3E, 0xB5, 0x66, 0x48, 0x03, 0xF6, 0x0E, 0x61, 0x35, 0x57, 0xB9, 0x86, 0xC1, 0x1D, 0x9E,
-/* E- */ 0xE1, 0xF8, 0x98, 0x11, 0x69, 0xD9, 0x8E, 0x94, 0x9B, 0x1E, 0x87, 0xE9, 0xCE, 0x55, 0x28, 0xDF,
-/* F- */ 0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68, 0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16
-};
-
-
-#if 0
-static __inline__
-CipherVec AESBCMEMBER(SubBytes) (CipherVec state)
-    __attribute__ ((always_inline));
-
-static __inline__
-CipherVec AESBCMEMBER(SubBytes) (CipherVec state)
-{
-    CipherVec_AES_u u;
-    unsigned ix;
-
-    u.state = state;
-
-    for (ix = 0; ix < sizeof (u.bytes); ++ix)
-    {
-        u.bytes[ix] = AESBCMEMBER(RijndaelSBox)[u.bytes[ix]];
-    }
-
-    return u.state;
-}
-#endif
-
-/*
- * SubWord performs the same operation as SubBytes but on
- * the four bytes of a column and not a whole state
- */
-static __inline__
-AESWord AESBCMEMBER(SubWord) (AESWord w)
-    __attribute__ ((always_inline));
-
-static __inline__
-AESWord AESBCMEMBER(SubWord) (AESWord w)
-{
-    AESColumn col;
-    unsigned ix;
-
-    col.word = w;
-    for (ix = 0; ix < sizeof (col); ++ix)
-        col.bytes[ix] = AESBCMEMBER(RijndaelSBox)[(unsigned)col.bytes[ix]];
-    return col.word;
-}
-
-#if 0
-/*
- * InvSubBytes replaces each byte in a state with a specific byte value from
- * an Inversze Rijndael Substitution box.  That is InvSubBytes undoes SubBytes
- */
-static const 
-uint8_t AESBCMEMBER(RijndaelInvSBox)[256] = 
-{
-/*        -0    -1    -2    -3    -4    -5    -6    -7    -8    -9    -A    -B    -C    -D    -E    -F */
-/* 0- */ 0x52, 0x09, 0x6A, 0xD5, 0x30, 0x36, 0xA5, 0x38, 0xBF, 0x40, 0xA3, 0x9E, 0x81, 0xF3, 0xD7, 0xFB,
-/* 1- */ 0x7C, 0xE3, 0x39, 0x82, 0x9B, 0x2F, 0xFF, 0x87, 0x34, 0x8E, 0x43, 0x44, 0xC4, 0xDE, 0xE9, 0xCB,
-/* 2- */ 0x54, 0x7B, 0x94, 0x32, 0xA6, 0xC2, 0x23, 0x3D, 0xEE, 0x4C, 0x95, 0x0B, 0x42, 0xFA, 0xC3, 0x4E,
-/* 3- */ 0x08, 0x2E, 0xA1, 0x66, 0x28, 0xD9, 0x24, 0xB2, 0x76, 0x5B, 0xA2, 0x49, 0x6D, 0x8B, 0xD1, 0x25,
-/* 4- */ 0x72, 0xF8, 0xF6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xD4, 0xA4, 0x5C, 0xCC, 0x5D, 0x65, 0xB6, 0x92,
-/* 5- */ 0x6C, 0x70, 0x48, 0x50, 0xFD, 0xED, 0xB9, 0xDA, 0x5E, 0x15, 0x46, 0x57, 0xA7, 0x8D, 0x9D, 0x84,
-/* 6- */ 0x90, 0xD8, 0xAB, 0x00, 0x8C, 0xBC, 0xD3, 0x0A, 0xF7, 0xE4, 0x58, 0x05, 0xB8, 0xB3, 0x45, 0x06,
-/* 7- */ 0xD0, 0x2C, 0x1E, 0x8F, 0xCA, 0x3F, 0x0F, 0x02, 0xC1, 0xAF, 0xBD, 0x03, 0x01, 0x13, 0x8A, 0x6B,
-/* 8- */ 0x3A, 0x91, 0x11, 0x41, 0x4F, 0x67, 0xDC, 0xEA, 0x97, 0xF2, 0xCF, 0xCE, 0xF0, 0xB4, 0xE6, 0x73,
-/* 9- */ 0x96, 0xAC, 0x74, 0x22, 0xE7, 0xAD, 0x35, 0x85, 0xE2, 0xF9, 0x37, 0xE8, 0x1C, 0x75, 0xDF, 0x6E,
-/* A- */ 0x47, 0xF1, 0x1A, 0x71, 0x1D, 0x29, 0xC5, 0x89, 0x6F, 0xB7, 0x62, 0x0E, 0xAA, 0x18, 0xBE, 0x1B,
-/* B- */ 0xFC, 0x56, 0x3E, 0x4B, 0xC6, 0xD2, 0x79, 0x20, 0x9A, 0xDB, 0xC0, 0xFE, 0x78, 0xCD, 0x5A, 0xF4,
-/* C- */ 0x1F, 0xDD, 0xA8, 0x33, 0x88, 0x07, 0xC7, 0x31, 0xB1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xEC, 0x5F,
-/* D- */ 0x60, 0x51, 0x7F, 0xA9, 0x19, 0xB5, 0x4A, 0x0D, 0x2D, 0xE5, 0x7A, 0x9F, 0x93, 0xC9, 0x9C, 0xEF,
-/* E- */ 0xA0, 0xE0, 0x3B, 0x4D, 0xAE, 0x2A, 0xF5, 0xB0, 0xC8, 0xEB, 0xBB, 0x3C, 0x83, 0x53, 0x99, 0x61,
-/* F- */ 0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26, 0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D
-};
-
-
-static __inline__
-CipherVec AESBCMEMBER(InvSubBytes) (CipherVec state)
-    __attribute__ ((always_inline));
-
-static __inline__
-CipherVec AESBCMEMBER(InvSubBytes) (CipherVec state)
-{
-    CipherVec_AES_u u;
-    unsigned ix;
-
-    u.state = state;
-    for (ix = 0; ix < sizeof (u.bytes); ++ix)
-        u.bytes[ix] = AESBCMEMBER(RijndaelInvSBox)[u.bytes[ix]];
-
-    return u.state;
-}
-#endif
-
-static const
-CipherVec AESBCMEMBER(RijndaelSBoxV)[16] = 
-{
-/*     -0    -1    -2    -3    -4    -5    -6    -7    -8    -9    -A    -B    -C    -D    -E    -F */
-    { 0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76 },
-    { 0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0 },
-    { 0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC, 0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15 },
-    { 0x04, 0xC7, 0x23, 0xC3, 0x18, 0x96, 0x05, 0x9A, 0x07, 0x12, 0x80, 0xE2, 0xEB, 0x27, 0xB2, 0x75 },
-    { 0x09, 0x83, 0x2C, 0x1A, 0x1B, 0x6E, 0x5A, 0xA0, 0x52, 0x3B, 0xD6, 0xB3, 0x29, 0xE3, 0x2F, 0x84 },
-    { 0x53, 0xD1, 0x00, 0xED, 0x20, 0xFC, 0xB1, 0x5B, 0x6A, 0xCB, 0xBE, 0x39, 0x4A, 0x4C, 0x58, 0xCF },
-    { 0xD0, 0xEF, 0xAA, 0xFB, 0x43, 0x4D, 0x33, 0x85, 0x45, 0xF9, 0x02, 0x7F, 0x50, 0x3C, 0x9F, 0xA8 },
-    { 0x51, 0xA3, 0x40, 0x8F, 0x92, 0x9D, 0x38, 0xF5, 0xBC, 0xB6, 0xDA, 0x21, 0x10, 0xFF, 0xF3, 0xD2 },
-    { 0xCD, 0x0C, 0x13, 0xEC, 0x5F, 0x97, 0x44, 0x17, 0xC4, 0xA7, 0x7E, 0x3D, 0x64, 0x5D, 0x19, 0x73 },
-    { 0x60, 0x81, 0x4F, 0xDC, 0x22, 0x2A, 0x90, 0x88, 0x46, 0xEE, 0xB8, 0x14, 0xDE, 0x5E, 0x0B, 0xDB },
-    { 0xE0, 0x32, 0x3A, 0x0A, 0x49, 0x06, 0x24, 0x5C, 0xC2, 0xD3, 0xAC, 0x62, 0x91, 0x95, 0xE4, 0x79 },
-    { 0xE7, 0xC8, 0x37, 0x6D, 0x8D, 0xD5, 0x4E, 0xA9, 0x6C, 0x56, 0xF4, 0xEA, 0x65, 0x7A, 0xAE, 0x08 },
-    { 0xBA, 0x78, 0x25, 0x2E, 0x1C, 0xA6, 0xB4, 0xC6, 0xE8, 0xDD, 0x74, 0x1F, 0x4B, 0xBD, 0x8B, 0x8A },
-    { 0x70, 0x3E, 0xB5, 0x66, 0x48, 0x03, 0xF6, 0x0E, 0x61, 0x35, 0x57, 0xB9, 0x86, 0xC1, 0x1D, 0x9E },
-    { 0xE1, 0xF8, 0x98, 0x11, 0x69, 0xD9, 0x8E, 0x94, 0x9B, 0x1E, 0x87, 0xE9, 0xCE, 0x55, 0x28, 0xDF },
-    { 0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68, 0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16 }
-};
-
-static const
-CipherVec AESBCMEMBER(RijndaelInvSBoxV)[16] = 
-{
-/*     -0    -1    -2    -3    -4    -5    -6    -7    -8    -9    -A    -B    -C    -D    -E    -F */
-    { 0x52, 0x09, 0x6A, 0xD5, 0x30, 0x36, 0xA5, 0x38, 0xBF, 0x40, 0xA3, 0x9E, 0x81, 0xF3, 0xD7, 0xFB },
-    { 0x7C, 0xE3, 0x39, 0x82, 0x9B, 0x2F, 0xFF, 0x87, 0x34, 0x8E, 0x43, 0x44, 0xC4, 0xDE, 0xE9, 0xCB },
-    { 0x54, 0x7B, 0x94, 0x32, 0xA6, 0xC2, 0x23, 0x3D, 0xEE, 0x4C, 0x95, 0x0B, 0x42, 0xFA, 0xC3, 0x4E },
-    { 0x08, 0x2E, 0xA1, 0x66, 0x28, 0xD9, 0x24, 0xB2, 0x76, 0x5B, 0xA2, 0x49, 0x6D, 0x8B, 0xD1, 0x25 },
-    { 0x72, 0xF8, 0xF6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xD4, 0xA4, 0x5C, 0xCC, 0x5D, 0x65, 0xB6, 0x92 },
-    { 0x6C, 0x70, 0x48, 0x50, 0xFD, 0xED, 0xB9, 0xDA, 0x5E, 0x15, 0x46, 0x57, 0xA7, 0x8D, 0x9D, 0x84 },
-    { 0x90, 0xD8, 0xAB, 0x00, 0x8C, 0xBC, 0xD3, 0x0A, 0xF7, 0xE4, 0x58, 0x05, 0xB8, 0xB3, 0x45, 0x06 },
-    { 0xD0, 0x2C, 0x1E, 0x8F, 0xCA, 0x3F, 0x0F, 0x02, 0xC1, 0xAF, 0xBD, 0x03, 0x01, 0x13, 0x8A, 0x6B },
-    { 0x3A, 0x91, 0x11, 0x41, 0x4F, 0x67, 0xDC, 0xEA, 0x97, 0xF2, 0xCF, 0xCE, 0xF0, 0xB4, 0xE6, 0x73 },
-    { 0x96, 0xAC, 0x74, 0x22, 0xE7, 0xAD, 0x35, 0x85, 0xE2, 0xF9, 0x37, 0xE8, 0x1C, 0x75, 0xDF, 0x6E },
-    { 0x47, 0xF1, 0x1A, 0x71, 0x1D, 0x29, 0xC5, 0x89, 0x6F, 0xB7, 0x62, 0x0E, 0xAA, 0x18, 0xBE, 0x1B },
-    { 0xFC, 0x56, 0x3E, 0x4B, 0xC6, 0xD2, 0x79, 0x20, 0x9A, 0xDB, 0xC0, 0xFE, 0x78, 0xCD, 0x5A, 0xF4 },
-    { 0x1F, 0xDD, 0xA8, 0x33, 0x88, 0x07, 0xC7, 0x31, 0xB1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xEC, 0x5F },
-    { 0x60, 0x51, 0x7F, 0xA9, 0x19, 0xB5, 0x4A, 0x0D, 0x2D, 0xE5, 0x7A, 0x9F, 0x93, 0xC9, 0x9C, 0xEF },
-    { 0xA0, 0xE0, 0x3B, 0x4D, 0xAE, 0x2A, 0xF5, 0xB0, 0xC8, 0xEB, 0xBB, 0x3C, 0x83, 0x53, 0x99, 0x61 },
-    { 0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26, 0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D }
-};
-
-
-static const
-CipherVec lo_filter = { 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-                        0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
-
-static __inline__
-CipherVec AESBCMEMBER(SubBytesInt) (CipherVec state, const CipherVec box [16])
-    __attribute__ ((always_inline));
-
-static __inline__
-CipherVec AESBCMEMBER(SubBytesInt) (CipherVec state, const CipherVec box [16])
-{
-    CipherVec lo, hi, tmp, out;
-    unsigned ix;
-
-    out = vec_00;
-
-/*     DEBUG_CIPHER_VECTOR ("state", state); */
-    lo = AESBCMEMBER(VecAnd) (state, vec_0F);
-/*     DEBUG_CIPHER_VECTOR ("lo", lo); */
-#if USE_VEC_REG
-    hi = op_PSRLDI128 (state, 4);
-/*     DEBUG_CIPHER_VECTOR ("hi", hi); */
-    hi = AESBCMEMBER(VecAnd) (hi, vec_0F);
-/*     DEBUG_CIPHER_VECTOR ("hi", hi); */
-#else
-    hi = AESBCMEMBER(VecDiv) (state, vec_10);
-/*     DEBUG_CIPHER_VECTOR ("hi", hi); */
-#endif
-
-    for (ix = 0; ix < sizeof (state); ++ix)
-    {
-        tmp = AESBCMEMBER(PackShuffleBytes) (lo_filter, hi);
-/*         DEBUG_CIPHER_VECTOR ("tmp", tmp); */
-        tmp = AESBCMEMBER(VecOr) (lo, tmp);
-/*         DEBUG_CIPHER_VECTOR ("tmp", tmp); */
-        tmp = AESBCMEMBER(PackShuffleBytes) (box[ix], tmp);
-/*         DEBUG_CIPHER_VECTOR ("tmp", tmp); */
-        out = AESBCMEMBER(VecOr) (out, tmp);
-/*         DEBUG_CIPHER_VECTOR ("out", out); */
-        hi  = AESBCMEMBER(VecSub) (hi, vec_01);
-/*         DEBUG_CIPHER_VECTOR ("hi", hi); */
-        hi  = AESBCMEMBER(VecAnd) (hi, vec_0F);
-/*         DEBUG_CIPHER_VECTOR ("hi", hi); */
-    }
-/*     DEBUG_CIPHER_VECTOR ("out", out); */
-    return out;
-}
-
-
-static __inline__
-CipherVec AESBCMEMBER(SubBytes) (CipherVec state)
-    __attribute__ ((always_inline));
-
-static __inline__
-CipherVec AESBCMEMBER(SubBytes) (CipherVec state)
-{
-    return AESBCMEMBER(SubBytesInt) (state, AESBCMEMBER(RijndaelSBoxV));
-}
-
-
-static __inline__
-CipherVec AESBCMEMBER(InvSubBytes) (CipherVec state)
-    __attribute__ ((always_inline));
-
-static __inline__
-CipherVec AESBCMEMBER(InvSubBytes) (CipherVec state)
-{
-    return AESBCMEMBER(SubBytesInt) (state, AESBCMEMBER(RijndaelInvSBoxV));
-}
-
-
-/* ======================================================================
- * FIPS-197 5.1.3
- */
-
-/*
- * there are no psllb or psrlb instructions so shift words not bytes
- * and then cut off bits that would have been zeroed if there were
- * such instructions
- *
- * 
- */
-static const CipherVec FF_tab = 
-{ 0x00, 0x1B, 0x36, 0x2D, 0x6C, 0x77, 0x5A, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-
-static __inline__
-CipherVec AESBCMEMBER(FF_mul) (register CipherVec state, const int bits)
-    __attribute__ ((always_inline));
-
-static __inline__
-CipherVec AESBCMEMBER(FF_mul) (register CipherVec state, const int bits)
-{
-    CipherVec sl, sr;
-
-    assert (bits <= 8);
-
-    DEBUG_CIPHER_VECTOR ("state", state);
-    sr = AESBCMEMBER(VecSRLBI) (state, 8 - bits);
-    DEBUG_CIPHER_VECTOR ("sr", sr);
-    sl = AESBCMEMBER(VecSLLBI) (state, bits);
-    DEBUG_CIPHER_VECTOR ("sl", sl);
-    sr = AESBCMEMBER(PackShuffleBytes) (FF_tab, sr);
-    return AESBCMEMBER(VecXor)(sl, sr);
-}
-
-
-static __inline__
-CipherVec AESBCMEMBER(FF_mul_02) (CipherVec state)
-    __attribute__ ((always_inline));
-
-static __inline__
-CipherVec AESBCMEMBER(FF_mul_02) (register CipherVec state)
-{
-    DEBUG_CIPHER_VECTOR ("state", state);
-
-    state =  AESBCMEMBER(FF_mul) (state, 1);
-    DEBUG_CIPHER_VECTOR ("state", state);
-
-    return state;
-}
-
-
-static __inline__
-CipherVec AESBCMEMBER(FF_mul_04) (CipherVec state)
-    __attribute__ ((always_inline));
-
-static __inline__
-CipherVec AESBCMEMBER(FF_mul_04) (CipherVec state)
-{
-    DEBUG_CIPHER_VECTOR ("state", state);
-
-    state =  AESBCMEMBER(FF_mul) (state, 2);
-    DEBUG_CIPHER_VECTOR ("state", state);
-
-    return state;
-}
-
-
-static __inline__
-CipherVec AESBCMEMBER(FF_mul_08) (CipherVec state)
-    __attribute__ ((always_inline));
-
-static __inline__
-CipherVec AESBCMEMBER(FF_mul_08) (CipherVec state)
-{
-    DEBUG_CIPHER_VECTOR ("state", state);
-
-    state =  AESBCMEMBER(FF_mul) (state, 3);
-    DEBUG_CIPHER_VECTOR ("state", state);
-
-    return state;
-}
-
-
-static AESByte AESBCMEMBER(FFtable)[] = { 0x00, 0x1b, 0x36, 0x2d, 0x6c, 0x77, 0x5a, 0x41 };
-
-
-static __inline__ 
-AESByte AESBCMEMBER(FFtab) (uint8_t x)
-    __attribute__ ((always_inline));
-
-static __inline__ 
-AESByte AESBCMEMBER(FFtab) (uint8_t x)
-{
-    return AESBCMEMBER(FFtable)[x];
-}
-
-
-static __inline__ 
-AESByte AESBCMEMBER(FFmul02) (AESByte b)
-    __attribute__ ((always_inline));
-
-static __inline__ 
-AESByte AESBCMEMBER(FFmul02) (AESByte b)
-{
-    return (b << 1) ^ AESBCMEMBER(FFtab)(b >> 7);
-}
-
-
-static __inline__ 
-AESByte AESBCMEMBER(FFmul04) (AESByte b)
-    __attribute__ ((always_inline));
-
-static __inline__ 
-AESByte AESBCMEMBER(FFmul04) (AESByte b)
-{
-    return (b << 2) ^ AESBCMEMBER(FFtab)(b >> 6);
-}
-
-
-static __inline__ 
-AESByte AESBCMEMBER(FFmul08) (AESByte b)
-    __attribute__ ((always_inline));
-
-static __inline__ 
-AESByte AESBCMEMBER(FFmul08) (AESByte b)
-{
-    return (b << 3) ^ AESBCMEMBER(FFtab)(b >> 5);
-}
-
-
-static __inline__
-CipherVec AESBCMEMBER(MixColumns) (CipherVec state)
-    __attribute__ ((always_inline));
-
-static __inline__
-CipherVec AESBCMEMBER(MixColumns) (CipherVec state)
-{
-    register CipherVec c0, c1, c2, c3;
-    
-    c1 = AESBCMEMBER(RotBytesLeft) (state);
-    c2 = AESBCMEMBER(RotBytesLeft) (c1);
-    c3 = AESBCMEMBER(RotBytesLeft) (c2);
-    c0 = AESBCMEMBER(VecXor) (state, c1);
-
-
-#if USE_VEC_REG
-    c0 = AESBCMEMBER(FF_mul_02) (c0);
-#else
-    {
-        CipherVec_AES_u tmp;
-        unsigned ix;
-
-        tmp.state = c0;
-    
-        for (ix = 0; ix < sizeof tmp; ++ix)
-            tmp.bytes[ix] = AESBCMEMBER(FFmul02)(tmp.bytes[ix]);
-        c0 = tmp.state;
-    }
-#endif
-    c1 = AESBCMEMBER(VecXor) (c1, c2);
-    c1 = AESBCMEMBER(VecXor) (c1, c3);
-    c1 = AESBCMEMBER(VecXor) (c1, c0);
-
-    return c1;
-/* obsoleted 
-    CipherVec_AES_u in, out;
-    unsigned ix;
-
-    in.state = state;
-
-    for (ix = 0; ix < sizeof (out.bytes); ix += 4)
-    {
-        unsigned const s0 = in.bytes[ix + 0];
-        unsigned const s1 = in.bytes[ix + 1];
-        unsigned const s2 = in.bytes[ix + 2];
-        unsigned const s3 = in.bytes[ix + 3];
-
-        out.bytes[ix + 0] =      s1 ^ s2 ^ s3 ^ AESBCMEMBER(FFmul02)(s0 ^ s1);
-        out.bytes[ix + 1] = s0      ^ s2 ^ s3 ^ AESBCMEMBER(FFmul02)(s1 ^ s2);
-        out.bytes[ix + 2] = s0 ^ s1      ^ s3 ^ AESBCMEMBER(FFmul02)(s2 ^ s3);
-        out.bytes[ix + 3] = s0 ^ s1 ^ s2      ^ AESBCMEMBER(FFmul02)(s3 ^ s0);
-    }
-    return out.state;
-*/
-}
-
-static __inline__
-CipherVec AESBCMEMBER(InvMixColumns) (CipherVec state)
-    __attribute__ ((always_inline));
-
-static __inline__
-CipherVec AESBCMEMBER(InvMixColumns) (CipherVec state)
-{
-#if USE_AES_NI
-    state = op_AESIMC (state);
-#else
-    register CipherVec r1, r2, r3, f2, f4, f8;
-
-    r1 = AESBCMEMBER(RotBytesLeft) (state);
-    r2 = AESBCMEMBER(RotBytesLeft) (r1);
-    r3 = AESBCMEMBER(RotBytesLeft) (r2);        
-
-    f4 = AESBCMEMBER(VecXor) (state, r2);
-    f2 = AESBCMEMBER(VecXor) (state, r1);
-    f8 = AESBCMEMBER(VecXor) (r2, r3);
-    state = AESBCMEMBER(VecXor) (f8, r1);
-    f8 = AESBCMEMBER(VecXor) (f8, f2);
-
-
-#if USE_VEC_REG
-    f2 = AESBCMEMBER(FF_mul) (f2,1);
-    f4 = AESBCMEMBER(FF_mul) (f4,2);
-    f8 = AESBCMEMBER(FF_mul) (f8,3);
-#else
-    {
-        CipherVec_AES_u fu2, fu4, fu8;
-        unsigned ix;
-
-        fu2.state = f2;
-        fu4.state = f4;
-        fu8.state = f8;
-
-        for (ix = 0; ix < sizeof fu2; ++ix)
-        {
-            fu2.bytes[ix] = AESBCMEMBER(FFmul02)(fu2.bytes[ix]);
-            fu4.bytes[ix] = AESBCMEMBER(FFmul04)(fu4.bytes[ix]);
-            fu8.bytes[ix] = AESBCMEMBER(FFmul08)(fu8.bytes[ix]);
-        }
-        f2 = fu2.state;
-        f4 = fu4.state;
-        f8 = fu8.state;
-    }
-#endif
-
-    state = AESBCMEMBER(VecXor) (state, f2);
-    state = AESBCMEMBER(VecXor) (state, f4);
-    state = AESBCMEMBER(VecXor) (state, f8);
-
-#endif
-
-    return state;
-/*
-    CipherVec_AES_u in, out;
-    unsigned ix;
-
-    in.state = state;
-
-    for (ix = 0; ix < sizeof (out.bytes); ix += AES_Nb)
-    {
-        AESWord s0 = in.bytes[ix + 0];
-        AESWord s1 = in.bytes[ix + 1];
-        AESWord s2 = in.bytes[ix + 2];
-        AESWord s3 = in.bytes[ix + 3];
-        AESWord p, q;
-
-        q =     AESBCMEMBER(FFmul08)(s0 ^ s1 ^ s2 ^ s3);
-        p = q ^ AESBCMEMBER(FFmul04)(s0 ^ s2);
-        q = q ^ AESBCMEMBER(FFmul04)(s1 ^ s3);
-
-        out.bytes[ix + 0] =      s1 ^ s2 ^ s3 ^ AESBCMEMBER(FFmul02)(s0 ^ s1) ^ p;
-        out.bytes[ix + 1] = s0      ^ s2 ^ s3 ^ AESBCMEMBER(FFmul02)(s1 ^ s2) ^ q;
-        out.bytes[ix + 2] = s0 ^ s1      ^ s3 ^ AESBCMEMBER(FFmul02)(s2 ^ s3) ^ p;
-        out.bytes[ix + 3] = s0 ^ s1 ^ s2      ^ AESBCMEMBER(FFmul02)(s3 ^ s0) ^ q;
-    }
-
-    return out.state;
-*/
-}
-
-
-/* ======================================================================
- * FIPS-197 5.2
- */
-static const
-AESWord AESBCMEMBER(Rcon)[] = {
-    0x00000001, 0x00000002, 0x00000004, 0x00000008,
-    0x00000010, 0x00000020, 0x00000040, 0x00000080,
-    0x0000001B, 0x00000036
-};
-
-
-static __inline__
-AESWord AESBCMEMBER(RotWord) (AESWord w)
-    __attribute__ ((always_inline));
-
-static __inline__
-AESWord AESBCMEMBER(RotWord) (AESWord w)
-{
-    return (w >> 8) | (w << 24);
-}
-
-
-static __inline__
-AESWord AESBCMEMBER(GetWord) (const AESByte * pointer)
-    __attribute__ ((always_inline));
-
-static __inline__
-AESWord AESBCMEMBER(GetWord) (const AESByte * pointer)
-{
-    /*
-     * not portable to architectures which require aligned multibyte reads
-     * but as this only runs on Intel at this point it is fine for now
-     */
-    return *(AESWord*)pointer;
-}
-
-
-
-static __inline__
-void AESBCMEMBER(KeyExpansion) (CipherVec * r, const AESByte * key, unsigned Nr, unsigned Nk)
-{
-    AESWord * w = (AESWord*)r;
-    const AESWord * pRcon;
-    unsigned ix, limit;
-    AESWord temp;
-
-
-    DEBUG_KEYEXP(("%s (w (%p), key (%p), Nr (%u) Nk (%u))\n", __func__, w, key, Nr, Nk));
-
-    for (ix = 0; ix < Nk; ++ix)
-    {
-        DEBUG_KEYEXP(("i (dec): %u\n", ix));
-        temp = AESBCMEMBER(GetWord) (key+(ix*4));
-        w[ix] = temp;
-        DEBUG_KEYEXP(("kw[%i]: %0.8x\n", ix, temp));
-    }
-
-    limit = AES_Nb * (Nr + 1);
-    pRcon = AESBCMEMBER(Rcon);
-    DEBUG_KEYEXP(("Nk (%u) Nr (%u) limit (%u)\n", Nk, Nr, limit));
-        
-    for (; ix < limit; ++ix)
-    {
-
-        DEBUG_KEYEXP(("i (dec): %u %u\n", ix, limit));
-
-        /* temp should already be set */
-        DEBUG_KEYEXP(("temp: %0.8x\n", temp));
-        if ((ix % Nk) == 0)
-        {
-            temp = AESBCMEMBER(RotWord)(temp);
-            DEBUG_KEYEXP(("after RotWord: %0.8x \n", temp));
-            temp = AESBCMEMBER(SubWord) (temp);
-            DEBUG_KEYEXP(("after SubWord: %0.8x \n", temp));
-            DEBUG_KEYEXP(("Rcon [i/Nk]: %0.8x\n", *pRcon));
-            temp ^= *pRcon++;
-            DEBUG_KEYEXP(("after XOR with Rcon: %0.8x \n", temp));
-        }
-        else if ((Nk > 6) && ((ix % Nk) == 4))
-        {
-            temp = AESBCMEMBER(SubWord) (temp);
-            DEBUG_KEYEXP(("after SubWord: %0.8x \n", temp));
-        }
-        DEBUG_KEYEXP(("w[i-Nk]: %0.8x\n", w[ix-Nk]));
-        temp ^= w [ix - Nk];
-        DEBUG_KEYEXP(("kw[ix]: %0.8x\n", temp));
-        w [ix] = temp;
-    }
-}
-
-
-static __inline__
-CipherVec AESBCMEMBER(StateShiftLeft32) (CipherVec state)
-    __attribute__ ((always_inline));
-
-static __inline__
-CipherVec AESBCMEMBER(StateShiftLeft32) (CipherVec state)
-{
-#if (USE_VEC_REG)
-    static const CipherVec mask = { 0xFF, 0xFF, 0xFF, 0xFF, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
-    return AESBCMEMBER(PackShuffleBytes) (state, mask);
-#else
-    CipherVec_AES_u temp;
-
-    temp.state = state;
-    temp.columns[3] = temp.columns[2];
-    temp.columns[2] = temp.columns[1];
-    temp.columns[1] = temp.columns[0];
-    temp.columns[0] = 0;
-    return temp.state;
-#endif
-}
-
-
-static __inline__
-CipherVec AESBCMEMBER(StateShiftRight64) (CipherVec state)
-    __attribute__ ((always_inline));
-
-static __inline__
-CipherVec AESBCMEMBER(StateShiftRight64) (CipherVec state)
-{
-#if (USE_VEC_REG)
-    static const CipherVec mask = { 8, 9, 10, 11, 12, 13, 14, 15, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
-    return AESBCMEMBER(PackShuffleBytes) (state, mask);
-#else
-    CipherVec_AES_u temp;
-
-    temp.state = state;
-    temp.columns[0] = temp.columns[2];
-    temp.columns[1] = temp.columns[3];
-    temp.columns[2] = 0;
-    temp.columns[3] = 0;
-    return temp.state;
-#endif
-}
-
-
-static __inline__
-CipherVec AESBCMEMBER(StateShiftLeft64) (CipherVec state)
-    __attribute__ ((always_inline));
-
-static __inline__
-CipherVec AESBCMEMBER(StateShiftLeft64) (CipherVec state)
-{
-#if (USE_VEC_REG)
-    static const CipherVec mask = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 1, 2, 3, 4, 5, 6, 7 };
-    return AESBCMEMBER(PackShuffleBytes) (state, mask);
-#else
-    CipherVec_AES_u temp;
-
-    temp.state = state;
-    temp.columns[3] = temp.columns[2];
-    temp.columns[2] = temp.columns[1];
-    temp.columns[1] = temp.columns[0];
-    temp.columns[0] = 0;
-    return temp.state;
-#endif
-}
-
-
-/*
- * incoming vector in words
- *     W0:W1:W2:W3
- *
- * output vector in words
- *     W3:W3:W3:W3
- */
-static __inline__
-CipherVec AESBCMEMBER(StateDupColumn3) (CipherVec state)
-    __attribute__ ((always_inline));
-
-static __inline__
-CipherVec AESBCMEMBER(StateDupColumn3) (CipherVec state)
-{
-#if (USE_VEC_REG)
-    return op_PSHUFD128 (state,0xFF);
-#else
-    CipherVec_AES_u temp;
-
-    temp.state = state;
-    temp.columns[2] = temp.columns[3];
-    temp.columns[1] = temp.columns[3];
-    temp.columns[0] = temp.columns[3];
-    return temp.state;
-#endif
-}
-
-
-/*
- * incoming vector in words
- *     W0:W1:W2:W3
- *
- * output vector in words
- *     W2:W2:W2:W2
- */
-static __inline__
-CipherVec AESBCMEMBER(StateDupColumn2) (CipherVec state)
-    __attribute__ ((always_inline));
-
-static __inline__
-CipherVec AESBCMEMBER(StateDupColumn2) (CipherVec state)
-{
-#if (USE_VEC_REG)
-    return op_PSHUFD128 (state,0xAA);
-#else
-    CipherVec_AES_u temp;
-
-    temp.state = state;
-    temp.columns[3] = temp.columns[2];
-    temp.columns[1] = temp.columns[2];
-    temp.columns[0] = temp.columns[2];
-    return temp.state;
-#endif
-}
-
-
-/*
- * incoming vector in words
- *     W0:W1:W2:W3
- *
- * output vector in words
- *     W2:W2:W2:W2
- */
-static __inline__
-CipherVec AESBCMEMBER(StateDupColumn1) (CipherVec state)
-    __attribute__ ((always_inline));
-
-static __inline__
-CipherVec AESBCMEMBER(StateDupColumn1) (CipherVec state)
-{
-#if (USE_VEC_REG)
-    return op_PSHUFD128 (state,0x55);
-#else
-    CipherVec_AES_u temp;
-
-    temp.state = state;
-    temp.columns[3] = temp.columns[1];
-    temp.columns[2] = temp.columns[1];
-    temp.columns[0] = temp.columns[1];
-    return temp.state;
-#endif
-}
-
-
-/*
- * incoming vector in words
- *     W0:W1:W2:W3
- *
- * output vector in words
- *     W0:W0:W0:W0
- */
-static __inline__
-CipherVec AESBCMEMBER(StateDupColumn0) (CipherVec state)
-    __attribute__ ((always_inline));
-
-static __inline__
-CipherVec AESBCMEMBER(StateDupColumn0) (CipherVec state)
-{
-#if (USE_VEC_REG)
-    return op_PSHUFD128 (state,0x00);
-#else
-    CipherVec_AES_u temp;
-
-    temp.state = state;
-    temp.columns[3] = temp.columns[0];
-    temp.columns[2] = temp.columns[0];
-    temp.columns[1] = temp.columns[0];
-    return temp.state;
-#endif
-}
-
-
-/*
- * incoming vector in words
- *     W0:W1:W2:W3
- *     X0:X1:X2:X3
- *
- * output vector in words
- *     W0:W1:X0:X1
- */
-static __inline__
-CipherVec AESBCMEMBER(StateMerge1) (CipherVec w, CipherVec x)
-    __attribute__ ((always_inline));
-
-static __inline__
-CipherVec AESBCMEMBER(StateMerge1) (CipherVec w, CipherVec x)
-{
-#if USE_VEC_REG
-    return op_SHUFPD (w, x, 0x00);
-#else
-    CipherVec_AES_u ww;
-    CipherVec_AES_u xx;
-
-    ww.state = w;
-    xx.state = x;
-
-    ww.columns[2] = xx.columns[0];
-    ww.columns[3] = xx.columns[1];
-
-    return ww.state;
-#endif
-}
-
-
-/*
- * incoming vector in words
- *     W0:W1:W2:W3
- *     X0:X1:X2:X3
- *
- * output vector in words
- *     X2:X3:W0:W1
- */
-static __inline__
-CipherVec AESBCMEMBER(StateMerge2) (CipherVec w, CipherVec x)
-    __attribute__ ((always_inline));
-
-static __inline__
-CipherVec AESBCMEMBER(StateMerge2) (CipherVec w, CipherVec x)
-{
-#if USE_VEC_REG
-    return op_SHUFPD (w, x, 0x01);
-#else
-    CipherVec_AES_u ww;
-    CipherVec_AES_u xx;
-
-    ww.state = w;
-    xx.state = x;
-
-    ww.columns[0] = ww.columns[2];
-    ww.columns[1] = ww.columns[3];
-    ww.columns[2] = xx.columns[0];
-    ww.columns[3] = xx.columns[1];
-
-    return ww.state;
-#endif
-}
-
-
-/*
- * incoming vector in words
- *     W0:W1:W2:W3
- *     X0:X1:X2:X3
- *
- * output vector in words
- *     X2:X3:W0:W1
- */
-static __inline__
-CipherVec AESBCMEMBER(StateMerge3) (CipherVec v0, CipherVec v1)
-    __attribute__ ((always_inline));
-
-static __inline__
-CipherVec AESBCMEMBER(StateMerge3) (CipherVec v0, CipherVec v1)
-{
-#if USE_VEC_REG
-    return op_SHUFPD (v0, v1, 0x02);
-#else
-    CipherVec_AES_u t0;
-    CipherVec_AES_u t1;
-
-    t0.state = v0;
-    t1.state = v1;
-
-    t0.columns[2] = t0.columns[0];
-    t0.columns[3] = t0.columns[1];
-    t0.columns[0] = t1.columns[2];
-    t0.columns[1] = t1.columns[3];
-
-    return t0.state;
-#endif
-}
-
-
-/*
- * incoming vector in words
- *     W0:W1:W2:W3
- *
- * output vector in words
- *     W0:W0^W1:W0^W1^W2:W0^W1^W2^W3
- */
-static __inline__
-CipherVec AESBCMEMBER(ShiftXorColumns) (CipherVec state)
-    __attribute__ ((always_inline));
-
-static __inline__
-CipherVec AESBCMEMBER(ShiftXorColumns) (CipherVec state)
-{
-#if USE_VEC
-    register CipherVec shift = state;
-
-    state ^= shift = AESBCMEMBER(StateShiftLeft32) (shift);
-    state ^= shift = AESBCMEMBER(StateShiftLeft32) (shift);
-    state ^= shift = AESBCMEMBER(StateShiftLeft32) (shift);
-
-    return state;
-#else
-    CipherVec_AES_u temp;
-
-    temp.state = state;
-
-    temp.columns[1] ^= temp.columns[0];
-    temp.columns[2] ^= temp.columns[1];
-    temp.columns[3] ^= temp.columns[2];
-
-    return temp.state;
-#endif
-}
-
-
-static __inline__ 
-CipherVec AESBCMEMBER(AesKeyGenAssist) (register CipherVec state, const int rcon)
-    __attribute__ ((always_inline));
-
-static __inline__ 
-CipherVec AESBCMEMBER(AesKeyGenAssist) (register CipherVec state, const int rcon)
-{
-#if (USE_AES_NI)
-    return op_AESKEYGENASSIST (state, rcon);
-#else
-    CipherVec_AES_u in;
-    CipherVec_AES_u out;
-    AESWord rconw;
-
-    rconw = (AESWord)(AESByte)rcon;
-    in.state = state;
-
-    out.columns[0] = AESBCMEMBER(SubWord)(in.columns[1]);
-    out.columns[1] = AESBCMEMBER(RotWord)(out.columns[0]) ^ rconw;
-    out.columns[2] = AESBCMEMBER(SubWord)(in.columns[3]);
-    out.columns[3] = AESBCMEMBER(RotWord)(out.columns[2]) ^ rconw;
-
-    return out.state;
-#endif
-}
-
-
-static __inline__ 
-CipherVec AESBCMEMBER(AesKeyGenAssistColumn1) (register CipherVec state, const int rcon)
-    __attribute__ ((always_inline));
-
-static __inline__ 
-CipherVec AESBCMEMBER(AesKeyGenAssistColumn1) (register CipherVec state, const int rcon)
-{
-#if (USE_AES_NI)
-    register CipherVec tmp = state;
-    tmp = op_AESKEYGENASSIST (tmp, rcon);
-    return  AESBCMEMBER(StateDupColumn1) (tmp);
-#else
-    CipherVec_AES_u u;
-    AESWord rconw;
-    AESWord temp;
-
-    rconw = (AESWord)(AESByte)rcon;
-    u.state = state;
-    temp  = AESBCMEMBER(SubWord)(u.columns[1]);
-    temp  = AESBCMEMBER(RotWord)(temp);
-    temp ^= rconw;
-
-    u.columns [0] = u.columns [1] = u.columns [2] = u.columns [3] = temp;
-    return u.state;
-#endif
-}
-
-
-static __inline__ 
-CipherVec AESBCMEMBER(AesKeyGenAssistColumn2) (register CipherVec state)
-    __attribute__ ((always_inline));
-
-static __inline__ 
-CipherVec AESBCMEMBER(AesKeyGenAssistColumn2) (register CipherVec state)
-{
-#if (USE_AES_NI)
-    register CipherVec tmp = state;
-    tmp = op_AESKEYGENASSIST (tmp, 0);
-    return  AESBCMEMBER(StateDupColumn2) (tmp);
-#else
-    CipherVec_AES_u u;
-    AESWord temp;
-
-    u.state = state;
-    temp  = AESBCMEMBER(SubWord)(u.columns[3]);
-
-    u.columns [0] = u.columns [1] = u.columns [2] = u.columns [3] = temp;
-    return u.state;
-#endif
-}
-
-
-static __inline__ 
-CipherVec AESBCMEMBER(AesKeyGenAssistColumn3) (register CipherVec state, const int rcon)
-    __attribute__ ((always_inline));
-
-static __inline__ 
-CipherVec AESBCMEMBER(AesKeyGenAssistColumn3) (register CipherVec state, const int rcon)
-{
-#if (USE_AES_NI)
-    register CipherVec tmp = state;
-    tmp = op_AESKEYGENASSIST (tmp, rcon);
-    return  AESBCMEMBER(StateDupColumn3) (tmp);
-
-#else
-    register CipherVec vrcon;
-    register CipherVec tmp;
-
-    vrcon = AESBCMEMBER(SetColumn) (vec_00, (AESWord)rcon, 3);
-    tmp = AESBCMEMBER(SubBytes) (state);
-    DEBUG_CIPHER_VECTOR ("SubBytes", tmp);
-    tmp = AESBCMEMBER(RotBytesLeft) (tmp);
-    DEBUG_CIPHER_VECTOR ("RotBytesLeft", tmp);
-    tmp = AESBCMEMBER(VecXor)(tmp, vrcon);
-    DEBUG_CIPHER_VECTOR ("VecXor", tmp);
-    tmp = AESBCMEMBER(StateDupColumn3) (tmp);
-    DEBUG_CIPHER_VECTOR ("StateDupColumn3", tmp);
-    return tmp;
-
-#endif
-/*
-#elif USE_VEC && 1
-    register CipherVec tmp;
-    CipherVec_AES_u u;
-    
-    u.columns [3] = rcon;
-
-    tmp = AESBCMEMBER(SubBytes) (state);
-    DEBUG_CIPHER_VECTOR ("SubBytes", tmp);
-    tmp = AESBCMEMBER(RotBytesLeft) (tmp);
-    DEBUG_CIPHER_VECTOR ("RotBytesLeft", tmp);
-    tmp = AESBCMEMBER(VecXor)(tmp, u.state);
-    DEBUG_CIPHER_VECTOR ("VecXor", tmp);
-    tmp = AESBCMEMBER(StateDupColumn3) (tmp);
-    DEBUG_CIPHER_VECTOR ("StateDupColumn3", tmp);
-    return tmp;
-
-#else
-    CipherVec_AES_u u;
-    AESWord rconw;
-    AESWord temp;
-
-    rconw = (AESWord)(AESByte)rcon;
-    u.state = state;
-    temp  = AESBCMEMBER(SubWord)(u.columns[3]);
-    temp  = AESBCMEMBER(RotWord)(temp);
-    temp ^= rconw;
-
-    u.columns [0] = u.columns [1] = u.columns [2] = u.columns [3] = temp;
-    return u.state;
-#endif
-*/
-}
-
-
-#if USE_VEC
-static __inline__
-void AESBCMEMBER(KeyExpansion128) (CipherVec * round_keys, const AESByte * key)
-{
-    CipherVec state;
-    CipherVec kgastate;
-
-    state = AESBCMEMBER(StateIn) (key);
-    round_keys[0] = state;
-
-#define KE128(rcon,offset) \
-    kgastate = AESBCMEMBER(AesKeyGenAssistColumn3) (state, rcon); \
-    state = AESBCMEMBER(ShiftXorColumns) (state); \
-    state ^= kgastate; \
-    round_keys[offset] = state
-
-    KE128(0x01,1);
-    KE128(0x02,2);
-    KE128(0x04,3);
-    KE128(0x08,4);
-    KE128(0x10,5);
-    KE128(0x20,6);
-    KE128(0x40,7);
-    KE128(0x80,8);
-    KE128(0x1B,9);
-    KE128(0x36,10);
-}
-#else
-static __inline__
-void AESBCMEMBER(KeyExpansion128) (CipherVec * w, const AESByte * key)
-{
-    OUTMSG(("\n\n\n%s: Not my code\n\n\n",__func__));
-    AESBCMEMBER(KeyExpansion) (w, key, AES_Nr_128, AES_Nk_128);
-}
-#endif
-
-
-#if USE_VEC
-static __inline__
-void AESBCMEMBER(KeyExpansion192) (CipherVec * round_keys, const AESByte * key)
-{
-    /* work on three blocks at a time which is two Nr worth
-     * we'll build it with 6 words in v0:v1 and 6 words in w0:w1
-     * but move them them into v0:v1:v2 before writing them to
-     * the key schedule
-     */
-
-    register CipherVec v0, v1, v2, v3, v4;
-    register CipherVec k;          /* we'll only need one of the key gen assist blocks at a time */
-
-/* pattern 0 */
-    v0  = AESBCMEMBER(StateIn) (key);              /* k0    : k1    : k2     : k3           */
-    v1  = AESBCMEMBER(StateIn) (key+8);            /* k2    : k3    : k4     : k5           */
-    v1  = AESBCMEMBER(StateShiftRight64) (v1);     /* k4    : k5    : 0      : 0            */
-
-    round_keys[0] = v0; /* K0:K1:K2:K3 */
-
-/* pattern 1 */
-/* start the working pattern with 6 ready words in v0:v1 */
-
-    k   = AESBCMEMBER(AesKeyGenAssistColumn1)
-        (k = v1, 0x01);                            /* F(k5) : F(k5) : F(k5)  : F(k5)        */
-    v3  = AESBCMEMBER(ShiftXorColumns) (v0);       /* k0    : k0^k1 :k0^k1^k2:k0^k1^k2^k3   */
-    v3 ^= k;                                       /* k6    : k7    : k8     : k9           */
-    v4  = AESBCMEMBER(ShiftXorColumns) (v1);       /* k4    : k4^k5 : k4^k5  : k4^k5        */
-    k   = AESBCMEMBER(StateDupColumn3) (k = v3);   /* k9    : k9    : k9     : k9           */
-    v4 ^= k;                                       /* k10   : k11   : k10    : k11          */
-    v1  = AESBCMEMBER(StateMerge1) (v1,v3);        /* k4    : k5    : k6     : k7           */
-    round_keys[1] = v1; /* K4:K5:K6:K7 */
-
-    v2  = AESBCMEMBER(StateMerge2) (v3,v4);        /* k8    : k9    : k10    : k11          */
-    round_keys[2] = v2; /* K8:K9:K10:K11 */
-
-/* pattern 2 */
-    v0  = AESBCMEMBER(ShiftXorColumns) (v3);       /* k6    : k6^k7 :k6^k7^k8:k6^k7^k8^k9   */
-    v1  = AESBCMEMBER(ShiftXorColumns) (v4);       /* k10   :k10^k11: k10^k11: k10^k11      */
-    k   = AESBCMEMBER(AesKeyGenAssistColumn3)
-        (k = v2,0x02);                             /* F(k11): F(k11): F(k11) : F(k11)       */
-    v0 ^= k;                                       /* k12   : k13   : k14    : k15          */
-    round_keys[3] = v0; /* K12:K13:K14:K15 */
-    k   = AESBCMEMBER(StateDupColumn3) (k = v0);   /* k15   : k15   : k15    : k15          */
-    v1 ^= k;                                       /* k16   : k17   : k16    : k17          */
-
-
-/* pattern 1 */
-/* start the working pattern with 6 ready words in v0:v1 */
-
-    k   = AESBCMEMBER(AesKeyGenAssistColumn1)
-        (k = v1,0x04);                             /* F(k17): F(k17): F(k17) : F(k17)       */
-    v3  = AESBCMEMBER(ShiftXorColumns) (v0);       /* k12   :k12^k13:k12^k13^k14:k12^k13^k14^k15 */
-    v3 ^= k;                                       /* k18   : k19   : k20    : k21          */
-    v4  = AESBCMEMBER(ShiftXorColumns) (v1);       /* k16   :k16^k17: k17    : 0            */
-    k   = AESBCMEMBER(StateDupColumn3) (k = v3);   /* k21   : k21   : k21    : k21          */
-    v4 ^= k;                                       /* k22   : k23   : x      : x            */
-    v1  = AESBCMEMBER(StateMerge1) (v1,v3);        /* k16   : k17   : k18    : k19          */
-    round_keys[4] = v1; /* K16:K17:K18:K19 */
-
-    v2  = AESBCMEMBER(StateMerge2) (v3,v4);        /* k20   : k21   : k22    : k23          */
-    round_keys[5] = v2; /* K20:K21:K22:K23 */
-
-/* pattern 2 */
-    v0  = AESBCMEMBER(ShiftXorColumns) (v3);       /* k18   :k18^k19:k18^k19^k20:k18^k19^k20^k21 */
-    v1  = AESBCMEMBER(ShiftXorColumns) (v4);       /* k22   :k22^k23: k23    : 0            */
-    k   = AESBCMEMBER(AesKeyGenAssistColumn3)
-        (k = v2,0x08);                             /* F(k23): F(k23): F(k23) : F(k23)       */
-    v0 ^= k;                                       /* k24   : k25   : k26    : k27          */
-    k   = AESBCMEMBER(StateDupColumn3) (k = v0);   /* k27   : k27   : k27    : k27          */
-    v1 ^= k;                                       /* k28   : k29   : x      : x            */
-
-    round_keys[6] = v0; /* K24:K25:K26:K27 */
-
-/* pattern 1 4-15 = 28-39 */
-/* start the working pattern with 6 ready words in v0:v1 */
-
-    k   = AESBCMEMBER(AesKeyGenAssistColumn1)
-        (k = v1,0x10);                             /* F(k29): F(k29): F(k29) : F(k29)       */
-    v3  = AESBCMEMBER(ShiftXorColumns) (v0);       /* k24   :k24^k25:k24^k25^k26:k24^k25^k26^k27 */
-    v3 ^= k;                                       /* k30   : k31   : k32    : k33          */
-    v4  = AESBCMEMBER(ShiftXorColumns) (v1);       /* k26   :k28^k29: k29    : 0            */
-    k   = AESBCMEMBER(StateDupColumn3) (k = v3);   /* k33   : k33   : k33    : k33          */
-    v4 ^= k;                                       /* k34   : k35   : x      : x            */
-    v1  = AESBCMEMBER(StateMerge1) (v1,v3);        /* k28   : k29   : k30    : k31          */
-
-    round_keys[7] = v1; /* K28:K29:K30:K31 */
-
-    v2  = AESBCMEMBER(StateMerge2) (v3,v4);        /* k32   : k33   : k34    : k35          */
-    round_keys[8] = v2; /* K32:K33:K34:K35 */
-/* pattern 2 */
-    v0  = AESBCMEMBER(ShiftXorColumns) (v3);       /* k30   :k30^k31:k30^k31^k32:k30^k31^k32^k33 */
-    v1  = AESBCMEMBER(ShiftXorColumns) (v4);       /* k26   :k26^k27: k27    : 0            */
-    k   = AESBCMEMBER(AesKeyGenAssistColumn3)
-        (k = v2,0x20);                             /* F(k35): F(k35): F(k35) : F(k35)       */
-    v0 ^= k;                                       /* k36   : k37   : k38    : k39          */
-    k   = AESBCMEMBER(StateDupColumn3) (v0);       /* k39   : k39   : k39    : k39          */
-    v1 ^= k;                                       /* k40   : k41   : x      : x            */
-
-    round_keys[9] = v0; /* K36:K37:K38:K39 */
-
-/* pattern 1 4-15 = 40-55 but we only need through 51 so we change from pattern 2 to pattern 3 */
-/* start the working pattern with 6 ready words in v0:v1 */
-
-    k   = AESBCMEMBER(AesKeyGenAssistColumn1)
-        (k = v1,0x40);                             /* F(k41): F(k41): F(k41) : F(k41)       */
-    v3  = AESBCMEMBER(ShiftXorColumns) (v0);       /* k36   :k36^k37:k36^k37^k38:k36^k37^k38^k39 */
-    v4  = AESBCMEMBER(ShiftXorColumns) (v1);       /* k40   :k40^k41: x   5  : x            */
-    v3 ^= k;                                       /* k42   : k43   : k44    : k45          */
-    k   = AESBCMEMBER(StateDupColumn3) (k = v3);   /* k45   : k45   : k45    : k45          */
-    v4 ^= k;                                       /* k46   : k47   : x      : x            */
-    v1  = AESBCMEMBER(StateMerge1) (v1,v3);        /* k40   : k41   : k42    : k43          */
-    round_keys[10] = v1; /* K40:K41:K42:K43 */
-    v2  = AESBCMEMBER(StateMerge2) (v3,v4);        /* k44   : k45   : k46    : k47          */
-    round_keys[11] = v2; /* K44:K45:K46:K47 */
-
-/* pattern 3 */
-    v0  = AESBCMEMBER(ShiftXorColumns) (v3);       /* k42   :k42^k43:k42^k43^k44:k42^k43^k44^k45  */
-    k   = AESBCMEMBER(AesKeyGenAssistColumn3)
-                                       (v2,0x80);  /* F(k47): F(k47): F(k47) : F(k47)       */
-    v0 ^= k;                                       /* k48   : k49   : k50    : k51          */
-    round_keys[12] = v0;                           /* K48:K49:K50:K51 */
-}
-#else
-static __inline__
-void AESBCMEMBER(KeyExpansion192) (CipherVec * w, const AESByte * key)
-{
-    AESBCMEMBER(KeyExpansion) (w, key, AES_Nr_192, AES_Nk_192);
-}
-#endif
-
-
-
-
-/* ----- */
-
-#if USE_VEC || 1
-static __inline__
-void AESBCMEMBER(KeyExpansion256) (CipherVec * round_keys, const AESByte * key)
-{
-    CipherVec v0, v1;
-    CipherVec k;
-
-    v0 = AESBCMEMBER (StateIn) (key);
-    v1 = AESBCMEMBER (StateIn) (key + sizeof v0);
-
-    round_keys[0] = v0; /* k0  : k1  : k2  : k3  */
-    round_keys[1] = v1; /* k4  : k5  : k6  : k7  */
-
-#define KE256_1(offset,rcon)                            \
-    k   = AESBCMEMBER(AesKeyGenAssistColumn3)(v1,rcon); \
-    v0  = AESBCMEMBER(ShiftXorColumns) (v0);            \
-    v0  = AESBCMEMBER(VecXor) (v0, k);                  \
-    round_keys[offset] = v0
-
-#define KE256_2(offset) \
-    k   = AESBCMEMBER(AesKeyGenAssistColumn2)(v0);      \
-    v1  = AESBCMEMBER(ShiftXorColumns) (v1);            \
-    v1  = AESBCMEMBER(VecXor) (v1, k);                  \
-    round_keys[offset] = v1
-
-    KE256_1(2,0x01);    /* k8  : k9  : k10 : k11 */
-    KE256_2(3);         /* k12 : k13 : k14 : k15 */
-    KE256_1(4,0x02);    /* k16 : k17 : k18 : k19 */
-    KE256_2(5);         /* k20 : k21 : k22 : k23 */
-    KE256_1(6,0x04);    /* k24 : k25 : k26 : k27 */
-    KE256_2(7);         /* k28 : k29 : k30 : k31 */
-    KE256_1(8,0x08);    /* k32 : k33 : k34 : k35 */
-    KE256_2(9);         /* k36 : k37 : k38 : k39 */
-    KE256_1(10,0x10);   /* k40 : k41 : k42 : k43 */
-    KE256_2(11);        /* k44 : k45 : k46 : k47 */
-    KE256_1(12,0x20);   /* k48 : k49 : k50 : k51 */
-    KE256_2(13);        /* k52 : k53 : k54 : k55 */
-    KE256_1(14,0x40);   /* k56 : k57 : k58 : k59 */
-}
-#else
-static __inline__
-void AESBCMEMBER(KeyExpansion256) (CipherVec * w, const AESByte * key)
-{
-    AESBCMEMBER(KeyExpansion) (w, key, AES_Nr_256, AES_Nk_256);
-}
-#endif
-
-
-static __inline__
-void AESBCMEMBER(EqInvKeyExpansion) (CipherVec * r, const CipherVec * dr, unsigned Nr)
-{
-    unsigned ix, jx;
-
-    jx = Nr;
-    ix = 0;
-    r[ix++] = dr[jx--];
-    while (jx)
-        r[ix++] = AESBCMEMBER(InvMixColumns)(dr[jx--]);
-    r[ix] = dr[jx];
-}
-
-
-static __inline__
-void AESBCMEMBER(EqInvKeyExpansion128) (CipherVec * w, const CipherVec * kw)
-{
-    AESBCMEMBER(EqInvKeyExpansion) (w, kw, AES_Nr_128);
-}
-
-
-static __inline__
-void AESBCMEMBER(EqInvKeyExpansion192) (CipherVec * w, const CipherVec * kw)
-{
-    AESBCMEMBER(EqInvKeyExpansion) (w, kw, AES_Nr_192);
-}
-
-
-static __inline__
-void AESBCMEMBER(EqInvKeyExpansion256) (CipherVec * w, const CipherVec * kw)
-{
-    AESBCMEMBER(EqInvKeyExpansion) (w, kw, AES_Nr_256);
-}
-
-
-/*
- * Cipher First Round
- */
-static __inline__ 
-CipherVec AESBCMEMBER(FirstRound) (CipherVec state, const CipherVec round_keys)
-    __attribute__ ((always_inline));
-
-static __inline__ 
-CipherVec AESBCMEMBER(FirstRound) (CipherVec state, const CipherVec round_keys)
-{
-    DEBUG_CIPHER_VECTOR("Start of Round", state);
-
-    DEBUG_CIPHER_VECTOR("Round Key", round_keys);
-
-    state = AESBCMEMBER(AddRoundKey) (state, round_keys);
-
-    DEBUG_CIPHER_VECTOR("End 1st Round", state);
-
-    return state;
-}
-
-
-static __inline__ 
-CipherVec AESBCMEMBER(MiddleRound) (register CipherVec state,
-                                    register const CipherVec round_keys)
-    __attribute__ ((always_inline));
-
-static __inline__ 
-CipherVec AESBCMEMBER(MiddleRound) (register CipherVec state,
-                                    register const CipherVec round_keys)
-{
-#if _DEBUGGING
-    CipherVec mstate;
-    CipherVec mround_keys;
-
-    mstate = state;
-    mround_keys = round_keys;
-
-    DEBUG_CIPHER_VECTOR("Start of Round", mstate);
-
-#endif
-
-#if USE_AES_NI
-    state = op_AESENC (state, round_keys);
-#else
-    state = AESBCMEMBER(SubBytes) (state);
-
-    DEBUG_CIPHER_VECTOR("After SubBytes", state);
-
-    state = AESBCMEMBER(ShiftRows) (state);
-
-    DEBUG_CIPHER_VECTOR("After ShiftRow", state);
-
-    state = AESBCMEMBER(MixColumns) (state);
-
-    /* ommited n on purpose */
-    DEBUG_CIPHER_VECTOR("After MixColum", state);
-
-    state = AESBCMEMBER(AddRoundKey) (state, round_keys);
-#endif
-    DEBUG_CIPHER_VECTOR("Round Key", round_keys);
-    DEBUG_CIPHER_VECTOR("End of Round", state);
-
-    return state;
-}
-
-
-static __inline__ 
-CipherVec AESBCMEMBER(LastRound) (register CipherVec state, register CipherVec round_keys)
-    __attribute__ ((always_inline));
-
-static __inline__ 
-CipherVec AESBCMEMBER(LastRound) (register CipherVec state, register CipherVec round_keys)
-{
-    DEBUG_CIPHER_VECTOR("Start of Round", state);
-
-#if USE_AES_NI
-    state = op_AESENCLAST (state, round_keys);
-#else
-    state = AESBCMEMBER(SubBytes) (state);
-
-    DEBUG_CIPHER_VECTOR("After SubBytes", state);
-
-    state = AESBCMEMBER(ShiftRows) (state);
-
-    DEBUG_CIPHER_VECTOR("After ShiftRow", state);
-
-    state = AESBCMEMBER(AddRoundKey) (state, round_keys);
-#endif
-    DEBUG_CIPHER_VECTOR("Round Key", round_keys);
-    DEBUG_CIPHER_VECTOR("End of Round", state);
-
-    return state;
-}
-
-
-/* ----------------------------------------------------------------------
- * Cipher
- */
-/*
- * 
-This implementation as stated
- * above for simplifaction broke out the three types of rounds into
- * first round, middle rounds, and last round.  This approach was taken
- * for ease of coding for optimization using smaller bytes of code
- * but inlining of the functions for efficiency
- */
-static __inline__ 
-CipherVec AESBCMEMBER(Cipher) (CipherVec state, const CipherVec * key,
-                            unsigned Nr)
-{
-    unsigned ix = 0;
-
-    state = AESBCMEMBER(FirstRound) (state, key[ix++]);
-
-    for ( ; ix < Nr; ++ix)
-        state = AESBCMEMBER(MiddleRound) (state, key[ix] );
-
-    return AESBCMEMBER(LastRound) (state, key[ix]);
-}
-
-
-/* 
- * Section 5.1 of FIPS 197
- *
- *   This set of routines implements our structured wrapping of the 
- *   FIPS-197 Section 5.3.5 Equivalent Inverse Cipher.  In particular
- *   figure 15 Pseudo Code for the Equivalent Inverse Cipher.
- *
- *   The FIPS pseudocode has a single function which we have broken out 
- *   into three kinds of rounds - first round, middle rounds and last
- *   round as we have also done with the cipher rountine.
- *
- *   The EqInvCipher operates on whole cipher blocks so the Byte and Block
- *   code is the same here until subroutines of the round functions are
- *   called.  
- */
-
-/* 
- * First round of equivalent inverse cipher is merely an XOR against the
- * round key.
- */
-static __inline__
-CipherVec AESBCMEMBER(EqInvFirstRound) (CipherVec state, CipherVec round_keys)
-    __attribute__ ((always_inline));
-
-static __inline__
-CipherVec AESBCMEMBER(EqInvFirstRound) (CipherVec state, CipherVec round_keys)
-{
-    DEBUG_INVCIPHER_VECTOR("Start of Round", state);
-
-    state =  AESBCMEMBER(AddRoundKey) (state, round_keys);
-
-    DEBUG_INVCIPHER_VECTOR("Round Key", round_keys);
-    DEBUG_INVCIPHER_VECTOR("End of Round", state);
-    return state;
-}
-
-
-/*
- * middle rounds of the equivalent inverse cipher perform four steps
- *   InvSubBytes (inverse substitute bytes
- *   InvShiftRows (inverse shift rows
- *   InvMixColumns (inverse mix columns)
- *   AddRoundKey   (xor against the round key)
- *
- * the AES-NI instruction set from until implments all four steps with 
- * a single instruction
- */
-
-static __inline__
-CipherVec AESBCMEMBER(EqInvMiddleRound) (register CipherVec state,
-                                         register CipherVec round_keys)
-    __attribute__ ((always_inline));
-
-static __inline__
-CipherVec AESBCMEMBER(EqInvMiddleRound) (register CipherVec state,
-                                         register CipherVec round_keys)
-{
-#if _DEBUGGING
-    CipherVec mstate;
-    CipherVec mround_keys;
-
-    mstate = state;
-    mround_keys = round_keys;
-#endif
-
-    DEBUG_INVCIPHER_VECTOR("Start of Round", mstate);
-
-    /* 
-     * AES-NI implmentation
-     */
-#if USE_AES_NI
-
-    state = op_AESDEC (state, round_keys);
-
-#else /* #if USE_AES_NI */
-
-    /*
-     * All other implementations
-     */
-    state = AESBCMEMBER(InvSubBytes) (state);
-
-# if _DEBUGGING
-    mstate = state;
-
-    DEBUG_INVCIPHER_VECTOR("After InvSubBy", mstate);
-# endif
-
-    state = AESBCMEMBER(InvShiftRows) (state);
-
-# if _DEBUGGING
-    mstate = state;
-
-    DEBUG_INVCIPHER_VECTOR("After InvShift", mstate);
-# endif
-
-    state = AESBCMEMBER(InvMixColumns) (state);
-
-# if _DEBUGGING
-    mstate = state;
-
-    DEBUG_INVCIPHER_VECTOR("After InvMixCo", mstate);
-# endif
-
-    state = AESBCMEMBER(AddRoundKey) (state, round_keys);
-#endif
-
-#if _DEBUGGING
-    mstate = state;
-
-    DEBUG_INVCIPHER_VECTOR("Round Key", mround_keys);
-
-    DEBUG_INVCIPHER_VECTOR("End of Round", mstate);
-#endif /* #if USE_AES_NI */
-
-    return state;
-}
-
-
-/*
- * The final round of the equivalent inverse cipher is the same as 
- * the middle rounds with the ommission of the InvMixColumns step.
- */
-static __inline__
-CipherVec AESBCMEMBER(EqInvLastRound) (register CipherVec state,
-                                       register CipherVec round_keys)
-    __attribute__ ((always_inline));
-
-static __inline__
-CipherVec AESBCMEMBER(EqInvLastRound) (register CipherVec state,
-                                       register CipherVec round_keys)
-{
-    DEBUG_INVCIPHER_VECTOR("Start of Round", state);
-
-#if USE_AES_NI
-    state = op_AESDECLAST (state, round_keys);
-#else
-
-    state = AESBCMEMBER(InvSubBytes) (state);
-
-    DEBUG_INVCIPHER_VECTOR("After InvSubBy", state);
-
-    state = AESBCMEMBER(InvShiftRows) (state);
-
-    DEBUG_INVCIPHER_VECTOR("After InvShift", state);
-
-    state = AESBCMEMBER(AddRoundKey) (state, round_keys);
-#endif
-    DEBUG_INVCIPHER_VECTOR("Round Key", round_keys);
-    DEBUG_INVCIPHER_VECTOR("End of Round", state);
-
-    return state;
-}
-
-
-/*
- * The EqInvCipher functions (is defined in Figure 15 'Pseudo Code for
- * for the Equivalent Inverse Cipher.  This implementation as stated
- * above for simplifaction broke out the three types of rounds into
- * first round, middle rounds, and last round.  This approach was taken
- * for ease of coding for optimization using smaller bytes of code
- * but inlining of the functions for efficiency
- */
-static /*__inline__*/
-CipherVec AESBCMEMBER(EqInvCipher) (CipherVec state, const CipherVec * key,
-                                    unsigned Nr)
-{
-    unsigned ix = 0;
-
-    state = AESBCMEMBER(EqInvFirstRound) (state, key[ix++]);
-
-    for ( ; ix < Nr; ++ix)
-        state = AESBCMEMBER(EqInvMiddleRound) (state, key[ix] );
-
-    return AESBCMEMBER(EqInvLastRound) (state, key[ix]);
-}
-
-
-/* ======================================================================
- * This section of the file is the use of the cipher defined above within
- * our BlockCipherObject.
- *
- * These are the functions that will be directly referenced in the vector
- * table for the block cipher.  These are not specifically derived from
- * the FIPS-197 document.
- */
-#include "blockcipher-impl.h"
-
-typedef struct AES_CLASS AES_CLASS;
-
-static const char AESBCMEMBER(aes_ncbi_name) [] = CLASS_STRING(AES_CLASS);
-
-
-/* ----------------------------------------------------------------------
- * Destroy
- *   How large is the stored key for this cipher?  Not the user key used
- *   to create this key (key schedule)
- *
- *   This is needed by KCipher to know how large the KCipher objecr is at
- *   allocation and to know how much of a buffer each decryption/encryption is
- */
-static
-void AESBCMEMBER(Destroy) (const BLOCKCIPHER_VEC_IMPL * self)
-{
-    /* we use a constant object so do nothing */
-}
-
-
-/* ----------------------------------------------------------------------
- * BlockSize
- */
-static
-uint32_t AESBCMEMBER(BlockSize) ()
-{
-    return (uint32_t) sizeof (AESBlock);
-}
-
-
-/* ----------------------------------------------------------------------
- * KeySize
- *   How large is the stored key for this cipher?  Not the user key used
- *   to create this key (key schedule)
- *
- *   This is needed by KCipher to know how large the KCipher objecr is at
- *   allocation and to know how much of a buffer each decryption/encryption is
- */
-static
-uint32_t AESBCMEMBER(KeySize) ()
-{
-    return (uint32_t) sizeof (AESKeySchedule);
-}
-
-
-/* ----------------------------------------------------------------------
- * SetEncryptKey
- *   The KCipher calls this to have the block cipher build an encryption
- *   key in the KCipher object
- *
- */
-static
-rc_t AESBCMEMBER(SetEncryptKey) (void * encrypt_key, const char * user_key,
-                                 uint32_t user_key_size)
-{
-    rc_t rc;
-    AESKeySchedule * key;
-
-    rc = 0;
-    key = encrypt_key;
-
-    switch (user_key_size)
-    {
-    case AES_Nk_128 * sizeof (AESWord):
-        key->number_of_rounds = AES_Nr_128;
-        AESBCMEMBER(KeyExpansion128) (key->round_keys, (AESByte*)user_key);
-        break;
-
-    case AES_Nk_192 * sizeof (AESWord):
-        key->number_of_rounds = AES_Nr_192;
-        AESBCMEMBER(KeyExpansion192) (key->round_keys, (AESByte*)user_key);
-        break;
-
-    case AES_Nk_256 * sizeof (AESWord):
-        key->number_of_rounds = AES_Nr_256;
-        AESBCMEMBER(KeyExpansion256) (key->round_keys, (AESByte*)user_key);
-        break;
-
-    default:
-        key->number_of_rounds = 0;
-        memset (key, 0, sizeof (*key));
-        rc = RC (rcKrypto, rcBlockCipher, rcUpdating, rcParam, rcInvalid);
-        break;
-    }
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * SetDecryptKey
- *   The KCipher calls this to have the block cipher build an decryption
- *   key in the KCipher object
- *
- */
-static
-rc_t AESBCMEMBER(SetDecryptKey) (void * decrypt_key,
-                                 const char * user_key,
-                                 uint32_t user_key_size)
-{
-    AESKeySchedule encrypt_key;
-    rc_t rc;
-
-    rc = AESBCMEMBER(SetEncryptKey) (&encrypt_key, user_key, user_key_size);
-    if (rc == 0)
-    {
-        AESKeySchedule * key;
-
-        key = decrypt_key;
-
-        switch (key->number_of_rounds = encrypt_key.number_of_rounds)
-        {
-        case AES_Nr_128:
-            AESBCMEMBER(EqInvKeyExpansion128) (key->round_keys,
-                                               encrypt_key.round_keys);
-            break;
-
-        case AES_Nr_192:
-            AESBCMEMBER(EqInvKeyExpansion192) (key->round_keys,
-                                               encrypt_key.round_keys);
-            break;
-
-        case AES_Nr_256:
-            AESBCMEMBER(EqInvKeyExpansion256) (key->round_keys,
-                                               encrypt_key.round_keys);
-            break;
-        }
-    }
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * Encrypt
- *
- *   Perform an encryption of a single block.  Chained modes and stream
- *   cipher modes will call this multiple times.
- *
- */
-static
-CipherVec AESBCMEMBER(Encrypt) (CipherVec state,
-                                const void * encrypt_key)
-{
-    const AESKeySchedule * key = encrypt_key;
-    assert (key);
-
-    switch (key->number_of_rounds)
-    {
-    default:
-        state = vec_00;
-        break;
-
-    case AES_Nr_128:
-        state = AESBCMEMBER(Cipher) (state, key->round_keys, AES_Nr_128);
-        break;
-
-    case AES_Nr_192:
-        state = AESBCMEMBER(Cipher) (state, key->round_keys, AES_Nr_192);
-        break;
-
-    case AES_Nr_256:
-        state = AESBCMEMBER(Cipher) (state, key->round_keys, AES_Nr_256);
-        break;
-    }
-
-    return state;
-}
-
-
-/* ----------------------------------------------------------------------
- * Decrypt
- *
- *   Perform a decryption of a single block.  Chained modes and stream
- *   cipher modes will call this multiple times.
- */
-static
-CipherVec AESBCMEMBER(Decrypt) (CipherVec state,
-                                const void * decrypt_key)
-{
-    const AESKeySchedule * key = decrypt_key;
-
-    assert (key);
-
-    switch (key->number_of_rounds)
-    {
-    default:
-        state = vec_00; /* for an illegal cipher key schedule just write zeroes */
-        break;
-
-    case AES_Nr_128:
-        state = AESBCMEMBER(EqInvCipher) (state, key->round_keys,
-                                          AES_Nr_128);
-        break;
-
-    case AES_Nr_192:
-        state = AESBCMEMBER(EqInvCipher) (state, key->round_keys,
-                                          AES_Nr_192);
-        break;
-
-    case AES_Nr_256:
-        state = AESBCMEMBER(EqInvCipher) (state, key->round_keys,
-                                          AES_Nr_256);
-        break;
-    }
-
-    return state;
-}
-
-
-/* ----------------------------------------------------------------------
- * MakeProcessorSupport
- *
- * Run-time check for support of this particular AES implmentation by
- * checking the flags given via the cpuid instruction.
- */
-static __inline__
-bool AESBCMEMBER(ProcessorSupport) ()
-{
-    uint32_t level = 1, a, b, c, d;
-    bool ret = true;
-
-    __cpuid (level, a, b, c, d);
-
-    DEBUG_OBJECT(("%s: level %x a %x, b %x c %x d %x\n",__func__, level, a,b,c,d));
-
-#if USE_AES_NI
-    /*
-     * Only one flag tells whether the AES-NI instructions
-     * are implmented in this CPU
-     */
-    if ( ! (c & bit_AES))
-    {
-        DEBUG_OBJECT(("%s: failed no AES\n",__func__));
-        ret = false;
-    } else
-#endif
-
-#if USE_VEC_REG
-    /*
-     * Several flags indicate different levels of SSE
-     * instruction implmentation
-     *
-     * we require SSE4.1
-     *
-     * that dates from 2006 so is most likely good enough
-     */
-        /* if ( ! (c & (bit_SSE4_2))
-    {
-        DEBUG_OBJECT(("%s: failed no SSSE3\n",__func__));
-        ret = false;
-    }
-
-    else */
-        if ( ! (c & bit_SSE4_1))
-    {
-        DEBUG_OBJECT(("%s: failed no SSSE3\n",__func__));
-        ret = false;
-    }
-
-    else if ( ! (c & bit_SSSE3))
-    {
-        DEBUG_OBJECT(("%s: failed no SSSE3\n",__func__));
-        ret = false;
-    }
-
-    else if ( ! (c & bit_SSE3))
-    {
-        DEBUG_OBJECT(("%s: failed no SSE3\n",__func__));
-        ret = false;
-    }
-
-    else if ( ! (d & bit_SSE2))
-    {
-        DEBUG_OBJECT(("%s: failed no SSE2\n",__func__));
-        ret = false;
-    }
-
-    else if ( ! (d & bit_SSE))
-    {
-        DEBUG_OBJECT(("%s: failed no SSE\n",__func__));
-        ret = false;
-    }
-#endif
-    DEBUG_OBJECT(("%s: passed\n",__func__));
-    return ret;
-}
-
-
-/* ----------------------------------------------------------------------
- * Init
- *
- *   Initialize the fields of this object.  The derived class will call this
- *   during it's initialization.
- *
- * self      object to initialze
- * vt        the virtual table of the derived class
- * mgr       the cipher manager that is the construction factory block cipher
- *           objects hold references to the manager while the manager merely
- *           points at the block ciphers when all block ciphers are destroyed
- *           the manager loses its references and it too can be destroyed if not
- *           held elsewhere
- * name      ASCIZ c-string the name of this class
- */
-static const
-KBlockCipherVec_vt_v1 AESBCMEMBER(_vt_) = 
-{
-    { 1, 1 },
-
-    AESBCMEMBER(Destroy),
-    AESBCMEMBER(BlockSize),
-    AESBCMEMBER(KeySize),
-    AESBCMEMBER(SetEncryptKey),
-    AESBCMEMBER(SetDecryptKey),
-    AESBCMEMBER(Encrypt),
-    AESBCMEMBER(Decrypt)
-};
-
-
-/* ----------------------------------------------------------------------
- * Make
- *
- * Create a new AES Block Cipher object.
- * The processor is checked to see if this particular version is supported on
- * this particular CPU.
- */
-rc_t AESBCMEMBER(Make) (KBlockCipher ** new_obj)
-{
-    rc_t rc;
-
-    DEBUG_OBJECT(("%s: %p\n",__func__,new_obj));
-
-    /* Check parameter first */
-    if (new_obj == NULL)
-        rc = RC (rcKrypto, rcBlockCipher, rcConstructing, rcSelf, rcNull);
-
-    else
-    {
-        *new_obj = NULL;
-
-        /* check for processor support of this flavor */
-        if ( ! AESBCMEMBER(ProcessorSupport)())
-            rc = RC (rcKrypto, rcBlockCipher, rcConstructing, rcFunction, rcUnsupported);
-
-        else
-        {
-            rc = 0;
-            *new_obj = (KBlockCipher*)&(AESBCMEMBER(_vt_));
-        }
-    }
-    return rc;
-}
-
-/* end of file lib/krypto/aes-ncbi.c */
diff --git a/libs/krypto/aes-priv.h b/libs/krypto/aes-priv.h
deleted file mode 100644
index 4ebdbb0..0000000
--- a/libs/krypto/aes-priv.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-#ifndef _h_krypto_aes_priv_
-#define _h_krypto_aes_priv_
-
-/*
- * This header file was written to integrate the public domain AES code
- * with the SRA project
- */
-
-#define AES_ENCRYPT	1
-#define AES_DECRYPT	0
-
-/* Because array size can't be a const in C, the following two are macros.
-   Both sizes are in bytes. */
-#define AES_MAXNR (14)
-#define AES_BLOCK_SIZE (16)
-
-
-#ifdef  __cplusplus
-extern "C" {
-#endif
-
-typedef uint8_t AES_BYTE;
-typedef uint32_t AES_WORD;
-
-
-
-
-/* typedef int64_t AESState  __attribute__ ((vector_size (AES_BLOCK_SIZE))); */
-
-typedef struct AES_KEY AES_KEY;
-struct AES_KEY
-{
-    uint32_t rd_key [sizeof (AES_WORD) * (AES_MAXNR + 1)];
-    uint32_t rounds;
-};
-
-
-int AES_set_encrypt_key(const uint8_t *userKey, const uint32_t bits,
-                        AES_KEY *key);
-
-int AES_set_decrypt_key(const uint8_t *userKey, const uint32_t bits,
-                        AES_KEY *key);
-
-void AES_encrypt(const uint8_t *in, uint8_t *out,
-                 const AES_KEY *key);
-void AES_decrypt(const uint8_t *in, uint8_t *out,
-                 const AES_KEY *key);
-
-
-int AESx86_set_encrypt_key(const uint8_t *userKey, const uint32_t bits,
-                        AES_KEY *key);
-
-int AESx86_set_decrypt_key(const uint8_t *userKey, const uint32_t bits,
-                        AES_KEY *key);
-
-void AESx86_encrypt(const uint8_t *in, uint8_t *out,
-                 const AES_KEY *key);
-void AES_decrypt(const uint8_t *in, uint8_t *out,
-                 const AES_KEY *key);
-
-
-
-#ifdef  __cplusplus
-}
-#endif
-
-#endif /* #ifndef _h_krypto_aes_priv_ */
-
-
diff --git a/libs/krypto/aes.c b/libs/krypto/aes.c
deleted file mode 100644
index 328ba6d..0000000
--- a/libs/krypto/aes.c
+++ /dev/null
@@ -1 +0,0 @@
-#error "Obsolete do not use"
diff --git a/libs/krypto/aes_core.c b/libs/krypto/aes_core.c
deleted file mode 100644
index 385f669..0000000
--- a/libs/krypto/aes_core.c
+++ /dev/null
@@ -1,1181 +0,0 @@
-/*
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was modified as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *  Tweaked to match standards of the NCBI SRA project
- * We obatined this file from version 1.0.0e of OpenSSL but we have
- * eliminated the OpenSSL code where it could be identified
- *
- * We created our own header file as there was no public domain
- * header file associated with this public domain C file.
- */
-
-/**
- * rijndael-alg-fst.c
- *
- * @version 3.0 (December 2000)
- *
- * Optimised ANSI C code for the Rijndael cipher (now AES)
- *
- * @author Vincent Rijmen <vincent.rijmen at esat.kuleuven.ac.be>
- * @author Antoon Bosselaers <antoon.bosselaers at esat.kuleuven.ac.be>
- * @author Paulo Barreto <paulo.barreto at terra.com.br>
- *
- * This code is hereby placed in the public domain.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''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 AUTHORS 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.
- */
-
-
-#include <krypto/extern.h>
-#include <klib/defs.h>
-
-#include "aes-priv.h"
-
-#include <assert.h>
-
-
-#define FULL_UNROLL (true)
-
-# define GETU32(pt) (((uint32_t)(pt)[0] << 24) ^ ((uint32_t)(pt)[1] << 16) ^ ((uint32_t)(pt)[2] <<  8) ^ ((uint32_t)(pt)[3]))
-# define PUTU32(ct, st) (((ct)[0] = (uint8_t)((st) >> 24)), ((ct)[1] = (uint8_t)((st) >> 16)),((ct)[2] = (uint8_t)((st) >>  8)),((ct)[3] = (uint8_t)(st)))
-
-/*
-Te0[x] = S [x].[02, 01, 01, 03];
-Te1[x] = S [x].[03, 02, 01, 01];
-Te2[x] = S [x].[01, 03, 02, 01];
-Te3[x] = S [x].[01, 01, 03, 02];
-
-Td0[x] = Si[x].[0e, 09, 0d, 0b];
-Td1[x] = Si[x].[0b, 0e, 09, 0d];
-Td2[x] = Si[x].[0d, 0b, 0e, 09];
-Td3[x] = Si[x].[09, 0d, 0b, 0e];
-Td4[x] = Si[x].[01];
-*/
-
-static const uint32_t Te0[256] = {
-    0xc66363a5U, 0xf87c7c84U, 0xee777799U, 0xf67b7b8dU,
-    0xfff2f20dU, 0xd66b6bbdU, 0xde6f6fb1U, 0x91c5c554U,
-    0x60303050U, 0x02010103U, 0xce6767a9U, 0x562b2b7dU,
-    0xe7fefe19U, 0xb5d7d762U, 0x4dababe6U, 0xec76769aU,
-    0x8fcaca45U, 0x1f82829dU, 0x89c9c940U, 0xfa7d7d87U,
-    0xeffafa15U, 0xb25959ebU, 0x8e4747c9U, 0xfbf0f00bU,
-    0x41adadecU, 0xb3d4d467U, 0x5fa2a2fdU, 0x45afafeaU,
-    0x239c9cbfU, 0x53a4a4f7U, 0xe4727296U, 0x9bc0c05bU,
-    0x75b7b7c2U, 0xe1fdfd1cU, 0x3d9393aeU, 0x4c26266aU,
-    0x6c36365aU, 0x7e3f3f41U, 0xf5f7f702U, 0x83cccc4fU,
-    0x6834345cU, 0x51a5a5f4U, 0xd1e5e534U, 0xf9f1f108U,
-    0xe2717193U, 0xabd8d873U, 0x62313153U, 0x2a15153fU,
-    0x0804040cU, 0x95c7c752U, 0x46232365U, 0x9dc3c35eU,
-    0x30181828U, 0x379696a1U, 0x0a05050fU, 0x2f9a9ab5U,
-    0x0e070709U, 0x24121236U, 0x1b80809bU, 0xdfe2e23dU,
-    0xcdebeb26U, 0x4e272769U, 0x7fb2b2cdU, 0xea75759fU,
-    0x1209091bU, 0x1d83839eU, 0x582c2c74U, 0x341a1a2eU,
-    0x361b1b2dU, 0xdc6e6eb2U, 0xb45a5aeeU, 0x5ba0a0fbU,
-    0xa45252f6U, 0x763b3b4dU, 0xb7d6d661U, 0x7db3b3ceU,
-    0x5229297bU, 0xdde3e33eU, 0x5e2f2f71U, 0x13848497U,
-    0xa65353f5U, 0xb9d1d168U, 0x00000000U, 0xc1eded2cU,
-    0x40202060U, 0xe3fcfc1fU, 0x79b1b1c8U, 0xb65b5bedU,
-    0xd46a6abeU, 0x8dcbcb46U, 0x67bebed9U, 0x7239394bU,
-    0x944a4adeU, 0x984c4cd4U, 0xb05858e8U, 0x85cfcf4aU,
-    0xbbd0d06bU, 0xc5efef2aU, 0x4faaaae5U, 0xedfbfb16U,
-    0x864343c5U, 0x9a4d4dd7U, 0x66333355U, 0x11858594U,
-    0x8a4545cfU, 0xe9f9f910U, 0x04020206U, 0xfe7f7f81U,
-    0xa05050f0U, 0x783c3c44U, 0x259f9fbaU, 0x4ba8a8e3U,
-    0xa25151f3U, 0x5da3a3feU, 0x804040c0U, 0x058f8f8aU,
-    0x3f9292adU, 0x219d9dbcU, 0x70383848U, 0xf1f5f504U,
-    0x63bcbcdfU, 0x77b6b6c1U, 0xafdada75U, 0x42212163U,
-    0x20101030U, 0xe5ffff1aU, 0xfdf3f30eU, 0xbfd2d26dU,
-    0x81cdcd4cU, 0x180c0c14U, 0x26131335U, 0xc3ecec2fU,
-    0xbe5f5fe1U, 0x359797a2U, 0x884444ccU, 0x2e171739U,
-    0x93c4c457U, 0x55a7a7f2U, 0xfc7e7e82U, 0x7a3d3d47U,
-    0xc86464acU, 0xba5d5de7U, 0x3219192bU, 0xe6737395U,
-    0xc06060a0U, 0x19818198U, 0x9e4f4fd1U, 0xa3dcdc7fU,
-    0x44222266U, 0x542a2a7eU, 0x3b9090abU, 0x0b888883U,
-    0x8c4646caU, 0xc7eeee29U, 0x6bb8b8d3U, 0x2814143cU,
-    0xa7dede79U, 0xbc5e5ee2U, 0x160b0b1dU, 0xaddbdb76U,
-    0xdbe0e03bU, 0x64323256U, 0x743a3a4eU, 0x140a0a1eU,
-    0x924949dbU, 0x0c06060aU, 0x4824246cU, 0xb85c5ce4U,
-    0x9fc2c25dU, 0xbdd3d36eU, 0x43acacefU, 0xc46262a6U,
-    0x399191a8U, 0x319595a4U, 0xd3e4e437U, 0xf279798bU,
-    0xd5e7e732U, 0x8bc8c843U, 0x6e373759U, 0xda6d6db7U,
-    0x018d8d8cU, 0xb1d5d564U, 0x9c4e4ed2U, 0x49a9a9e0U,
-    0xd86c6cb4U, 0xac5656faU, 0xf3f4f407U, 0xcfeaea25U,
-    0xca6565afU, 0xf47a7a8eU, 0x47aeaee9U, 0x10080818U,
-    0x6fbabad5U, 0xf0787888U, 0x4a25256fU, 0x5c2e2e72U,
-    0x381c1c24U, 0x57a6a6f1U, 0x73b4b4c7U, 0x97c6c651U,
-    0xcbe8e823U, 0xa1dddd7cU, 0xe874749cU, 0x3e1f1f21U,
-    0x964b4bddU, 0x61bdbddcU, 0x0d8b8b86U, 0x0f8a8a85U,
-    0xe0707090U, 0x7c3e3e42U, 0x71b5b5c4U, 0xcc6666aaU,
-    0x904848d8U, 0x06030305U, 0xf7f6f601U, 0x1c0e0e12U,
-    0xc26161a3U, 0x6a35355fU, 0xae5757f9U, 0x69b9b9d0U,
-    0x17868691U, 0x99c1c158U, 0x3a1d1d27U, 0x279e9eb9U,
-    0xd9e1e138U, 0xebf8f813U, 0x2b9898b3U, 0x22111133U,
-    0xd26969bbU, 0xa9d9d970U, 0x078e8e89U, 0x339494a7U,
-    0x2d9b9bb6U, 0x3c1e1e22U, 0x15878792U, 0xc9e9e920U,
-    0x87cece49U, 0xaa5555ffU, 0x50282878U, 0xa5dfdf7aU,
-    0x038c8c8fU, 0x59a1a1f8U, 0x09898980U, 0x1a0d0d17U,
-    0x65bfbfdaU, 0xd7e6e631U, 0x844242c6U, 0xd06868b8U,
-    0x824141c3U, 0x299999b0U, 0x5a2d2d77U, 0x1e0f0f11U,
-    0x7bb0b0cbU, 0xa85454fcU, 0x6dbbbbd6U, 0x2c16163aU,
-};
-static const uint32_t Te1[256] = {
-    0xa5c66363U, 0x84f87c7cU, 0x99ee7777U, 0x8df67b7bU,
-    0x0dfff2f2U, 0xbdd66b6bU, 0xb1de6f6fU, 0x5491c5c5U,
-    0x50603030U, 0x03020101U, 0xa9ce6767U, 0x7d562b2bU,
-    0x19e7fefeU, 0x62b5d7d7U, 0xe64dababU, 0x9aec7676U,
-    0x458fcacaU, 0x9d1f8282U, 0x4089c9c9U, 0x87fa7d7dU,
-    0x15effafaU, 0xebb25959U, 0xc98e4747U, 0x0bfbf0f0U,
-    0xec41adadU, 0x67b3d4d4U, 0xfd5fa2a2U, 0xea45afafU,
-    0xbf239c9cU, 0xf753a4a4U, 0x96e47272U, 0x5b9bc0c0U,
-    0xc275b7b7U, 0x1ce1fdfdU, 0xae3d9393U, 0x6a4c2626U,
-    0x5a6c3636U, 0x417e3f3fU, 0x02f5f7f7U, 0x4f83ccccU,
-    0x5c683434U, 0xf451a5a5U, 0x34d1e5e5U, 0x08f9f1f1U,
-    0x93e27171U, 0x73abd8d8U, 0x53623131U, 0x3f2a1515U,
-    0x0c080404U, 0x5295c7c7U, 0x65462323U, 0x5e9dc3c3U,
-    0x28301818U, 0xa1379696U, 0x0f0a0505U, 0xb52f9a9aU,
-    0x090e0707U, 0x36241212U, 0x9b1b8080U, 0x3ddfe2e2U,
-    0x26cdebebU, 0x694e2727U, 0xcd7fb2b2U, 0x9fea7575U,
-    0x1b120909U, 0x9e1d8383U, 0x74582c2cU, 0x2e341a1aU,
-    0x2d361b1bU, 0xb2dc6e6eU, 0xeeb45a5aU, 0xfb5ba0a0U,
-    0xf6a45252U, 0x4d763b3bU, 0x61b7d6d6U, 0xce7db3b3U,
-    0x7b522929U, 0x3edde3e3U, 0x715e2f2fU, 0x97138484U,
-    0xf5a65353U, 0x68b9d1d1U, 0x00000000U, 0x2cc1ededU,
-    0x60402020U, 0x1fe3fcfcU, 0xc879b1b1U, 0xedb65b5bU,
-    0xbed46a6aU, 0x468dcbcbU, 0xd967bebeU, 0x4b723939U,
-    0xde944a4aU, 0xd4984c4cU, 0xe8b05858U, 0x4a85cfcfU,
-    0x6bbbd0d0U, 0x2ac5efefU, 0xe54faaaaU, 0x16edfbfbU,
-    0xc5864343U, 0xd79a4d4dU, 0x55663333U, 0x94118585U,
-    0xcf8a4545U, 0x10e9f9f9U, 0x06040202U, 0x81fe7f7fU,
-    0xf0a05050U, 0x44783c3cU, 0xba259f9fU, 0xe34ba8a8U,
-    0xf3a25151U, 0xfe5da3a3U, 0xc0804040U, 0x8a058f8fU,
-    0xad3f9292U, 0xbc219d9dU, 0x48703838U, 0x04f1f5f5U,
-    0xdf63bcbcU, 0xc177b6b6U, 0x75afdadaU, 0x63422121U,
-    0x30201010U, 0x1ae5ffffU, 0x0efdf3f3U, 0x6dbfd2d2U,
-    0x4c81cdcdU, 0x14180c0cU, 0x35261313U, 0x2fc3ececU,
-    0xe1be5f5fU, 0xa2359797U, 0xcc884444U, 0x392e1717U,
-    0x5793c4c4U, 0xf255a7a7U, 0x82fc7e7eU, 0x477a3d3dU,
-    0xacc86464U, 0xe7ba5d5dU, 0x2b321919U, 0x95e67373U,
-    0xa0c06060U, 0x98198181U, 0xd19e4f4fU, 0x7fa3dcdcU,
-    0x66442222U, 0x7e542a2aU, 0xab3b9090U, 0x830b8888U,
-    0xca8c4646U, 0x29c7eeeeU, 0xd36bb8b8U, 0x3c281414U,
-    0x79a7dedeU, 0xe2bc5e5eU, 0x1d160b0bU, 0x76addbdbU,
-    0x3bdbe0e0U, 0x56643232U, 0x4e743a3aU, 0x1e140a0aU,
-    0xdb924949U, 0x0a0c0606U, 0x6c482424U, 0xe4b85c5cU,
-    0x5d9fc2c2U, 0x6ebdd3d3U, 0xef43acacU, 0xa6c46262U,
-    0xa8399191U, 0xa4319595U, 0x37d3e4e4U, 0x8bf27979U,
-    0x32d5e7e7U, 0x438bc8c8U, 0x596e3737U, 0xb7da6d6dU,
-    0x8c018d8dU, 0x64b1d5d5U, 0xd29c4e4eU, 0xe049a9a9U,
-    0xb4d86c6cU, 0xfaac5656U, 0x07f3f4f4U, 0x25cfeaeaU,
-    0xafca6565U, 0x8ef47a7aU, 0xe947aeaeU, 0x18100808U,
-    0xd56fbabaU, 0x88f07878U, 0x6f4a2525U, 0x725c2e2eU,
-    0x24381c1cU, 0xf157a6a6U, 0xc773b4b4U, 0x5197c6c6U,
-    0x23cbe8e8U, 0x7ca1ddddU, 0x9ce87474U, 0x213e1f1fU,
-    0xdd964b4bU, 0xdc61bdbdU, 0x860d8b8bU, 0x850f8a8aU,
-    0x90e07070U, 0x427c3e3eU, 0xc471b5b5U, 0xaacc6666U,
-    0xd8904848U, 0x05060303U, 0x01f7f6f6U, 0x121c0e0eU,
-    0xa3c26161U, 0x5f6a3535U, 0xf9ae5757U, 0xd069b9b9U,
-    0x91178686U, 0x5899c1c1U, 0x273a1d1dU, 0xb9279e9eU,
-    0x38d9e1e1U, 0x13ebf8f8U, 0xb32b9898U, 0x33221111U,
-    0xbbd26969U, 0x70a9d9d9U, 0x89078e8eU, 0xa7339494U,
-    0xb62d9b9bU, 0x223c1e1eU, 0x92158787U, 0x20c9e9e9U,
-    0x4987ceceU, 0xffaa5555U, 0x78502828U, 0x7aa5dfdfU,
-    0x8f038c8cU, 0xf859a1a1U, 0x80098989U, 0x171a0d0dU,
-    0xda65bfbfU, 0x31d7e6e6U, 0xc6844242U, 0xb8d06868U,
-    0xc3824141U, 0xb0299999U, 0x775a2d2dU, 0x111e0f0fU,
-    0xcb7bb0b0U, 0xfca85454U, 0xd66dbbbbU, 0x3a2c1616U,
-};
-static const uint32_t Te2[256] = {
-    0x63a5c663U, 0x7c84f87cU, 0x7799ee77U, 0x7b8df67bU,
-    0xf20dfff2U, 0x6bbdd66bU, 0x6fb1de6fU, 0xc55491c5U,
-    0x30506030U, 0x01030201U, 0x67a9ce67U, 0x2b7d562bU,
-    0xfe19e7feU, 0xd762b5d7U, 0xabe64dabU, 0x769aec76U,
-    0xca458fcaU, 0x829d1f82U, 0xc94089c9U, 0x7d87fa7dU,
-    0xfa15effaU, 0x59ebb259U, 0x47c98e47U, 0xf00bfbf0U,
-    0xadec41adU, 0xd467b3d4U, 0xa2fd5fa2U, 0xafea45afU,
-    0x9cbf239cU, 0xa4f753a4U, 0x7296e472U, 0xc05b9bc0U,
-    0xb7c275b7U, 0xfd1ce1fdU, 0x93ae3d93U, 0x266a4c26U,
-    0x365a6c36U, 0x3f417e3fU, 0xf702f5f7U, 0xcc4f83ccU,
-    0x345c6834U, 0xa5f451a5U, 0xe534d1e5U, 0xf108f9f1U,
-    0x7193e271U, 0xd873abd8U, 0x31536231U, 0x153f2a15U,
-    0x040c0804U, 0xc75295c7U, 0x23654623U, 0xc35e9dc3U,
-    0x18283018U, 0x96a13796U, 0x050f0a05U, 0x9ab52f9aU,
-    0x07090e07U, 0x12362412U, 0x809b1b80U, 0xe23ddfe2U,
-    0xeb26cdebU, 0x27694e27U, 0xb2cd7fb2U, 0x759fea75U,
-    0x091b1209U, 0x839e1d83U, 0x2c74582cU, 0x1a2e341aU,
-    0x1b2d361bU, 0x6eb2dc6eU, 0x5aeeb45aU, 0xa0fb5ba0U,
-    0x52f6a452U, 0x3b4d763bU, 0xd661b7d6U, 0xb3ce7db3U,
-    0x297b5229U, 0xe33edde3U, 0x2f715e2fU, 0x84971384U,
-    0x53f5a653U, 0xd168b9d1U, 0x00000000U, 0xed2cc1edU,
-    0x20604020U, 0xfc1fe3fcU, 0xb1c879b1U, 0x5bedb65bU,
-    0x6abed46aU, 0xcb468dcbU, 0xbed967beU, 0x394b7239U,
-    0x4ade944aU, 0x4cd4984cU, 0x58e8b058U, 0xcf4a85cfU,
-    0xd06bbbd0U, 0xef2ac5efU, 0xaae54faaU, 0xfb16edfbU,
-    0x43c58643U, 0x4dd79a4dU, 0x33556633U, 0x85941185U,
-    0x45cf8a45U, 0xf910e9f9U, 0x02060402U, 0x7f81fe7fU,
-    0x50f0a050U, 0x3c44783cU, 0x9fba259fU, 0xa8e34ba8U,
-    0x51f3a251U, 0xa3fe5da3U, 0x40c08040U, 0x8f8a058fU,
-    0x92ad3f92U, 0x9dbc219dU, 0x38487038U, 0xf504f1f5U,
-    0xbcdf63bcU, 0xb6c177b6U, 0xda75afdaU, 0x21634221U,
-    0x10302010U, 0xff1ae5ffU, 0xf30efdf3U, 0xd26dbfd2U,
-    0xcd4c81cdU, 0x0c14180cU, 0x13352613U, 0xec2fc3ecU,
-    0x5fe1be5fU, 0x97a23597U, 0x44cc8844U, 0x17392e17U,
-    0xc45793c4U, 0xa7f255a7U, 0x7e82fc7eU, 0x3d477a3dU,
-    0x64acc864U, 0x5de7ba5dU, 0x192b3219U, 0x7395e673U,
-    0x60a0c060U, 0x81981981U, 0x4fd19e4fU, 0xdc7fa3dcU,
-    0x22664422U, 0x2a7e542aU, 0x90ab3b90U, 0x88830b88U,
-    0x46ca8c46U, 0xee29c7eeU, 0xb8d36bb8U, 0x143c2814U,
-    0xde79a7deU, 0x5ee2bc5eU, 0x0b1d160bU, 0xdb76addbU,
-    0xe03bdbe0U, 0x32566432U, 0x3a4e743aU, 0x0a1e140aU,
-    0x49db9249U, 0x060a0c06U, 0x246c4824U, 0x5ce4b85cU,
-    0xc25d9fc2U, 0xd36ebdd3U, 0xacef43acU, 0x62a6c462U,
-    0x91a83991U, 0x95a43195U, 0xe437d3e4U, 0x798bf279U,
-    0xe732d5e7U, 0xc8438bc8U, 0x37596e37U, 0x6db7da6dU,
-    0x8d8c018dU, 0xd564b1d5U, 0x4ed29c4eU, 0xa9e049a9U,
-    0x6cb4d86cU, 0x56faac56U, 0xf407f3f4U, 0xea25cfeaU,
-    0x65afca65U, 0x7a8ef47aU, 0xaee947aeU, 0x08181008U,
-    0xbad56fbaU, 0x7888f078U, 0x256f4a25U, 0x2e725c2eU,
-    0x1c24381cU, 0xa6f157a6U, 0xb4c773b4U, 0xc65197c6U,
-    0xe823cbe8U, 0xdd7ca1ddU, 0x749ce874U, 0x1f213e1fU,
-    0x4bdd964bU, 0xbddc61bdU, 0x8b860d8bU, 0x8a850f8aU,
-    0x7090e070U, 0x3e427c3eU, 0xb5c471b5U, 0x66aacc66U,
-    0x48d89048U, 0x03050603U, 0xf601f7f6U, 0x0e121c0eU,
-    0x61a3c261U, 0x355f6a35U, 0x57f9ae57U, 0xb9d069b9U,
-    0x86911786U, 0xc15899c1U, 0x1d273a1dU, 0x9eb9279eU,
-    0xe138d9e1U, 0xf813ebf8U, 0x98b32b98U, 0x11332211U,
-    0x69bbd269U, 0xd970a9d9U, 0x8e89078eU, 0x94a73394U,
-    0x9bb62d9bU, 0x1e223c1eU, 0x87921587U, 0xe920c9e9U,
-    0xce4987ceU, 0x55ffaa55U, 0x28785028U, 0xdf7aa5dfU,
-    0x8c8f038cU, 0xa1f859a1U, 0x89800989U, 0x0d171a0dU,
-    0xbfda65bfU, 0xe631d7e6U, 0x42c68442U, 0x68b8d068U,
-    0x41c38241U, 0x99b02999U, 0x2d775a2dU, 0x0f111e0fU,
-    0xb0cb7bb0U, 0x54fca854U, 0xbbd66dbbU, 0x163a2c16U,
-};
-static const uint32_t Te3[256] = {
-    0x6363a5c6U, 0x7c7c84f8U, 0x777799eeU, 0x7b7b8df6U,
-    0xf2f20dffU, 0x6b6bbdd6U, 0x6f6fb1deU, 0xc5c55491U,
-    0x30305060U, 0x01010302U, 0x6767a9ceU, 0x2b2b7d56U,
-    0xfefe19e7U, 0xd7d762b5U, 0xababe64dU, 0x76769aecU,
-    0xcaca458fU, 0x82829d1fU, 0xc9c94089U, 0x7d7d87faU,
-    0xfafa15efU, 0x5959ebb2U, 0x4747c98eU, 0xf0f00bfbU,
-    0xadadec41U, 0xd4d467b3U, 0xa2a2fd5fU, 0xafafea45U,
-    0x9c9cbf23U, 0xa4a4f753U, 0x727296e4U, 0xc0c05b9bU,
-    0xb7b7c275U, 0xfdfd1ce1U, 0x9393ae3dU, 0x26266a4cU,
-    0x36365a6cU, 0x3f3f417eU, 0xf7f702f5U, 0xcccc4f83U,
-    0x34345c68U, 0xa5a5f451U, 0xe5e534d1U, 0xf1f108f9U,
-    0x717193e2U, 0xd8d873abU, 0x31315362U, 0x15153f2aU,
-    0x04040c08U, 0xc7c75295U, 0x23236546U, 0xc3c35e9dU,
-    0x18182830U, 0x9696a137U, 0x05050f0aU, 0x9a9ab52fU,
-    0x0707090eU, 0x12123624U, 0x80809b1bU, 0xe2e23ddfU,
-    0xebeb26cdU, 0x2727694eU, 0xb2b2cd7fU, 0x75759feaU,
-    0x09091b12U, 0x83839e1dU, 0x2c2c7458U, 0x1a1a2e34U,
-    0x1b1b2d36U, 0x6e6eb2dcU, 0x5a5aeeb4U, 0xa0a0fb5bU,
-    0x5252f6a4U, 0x3b3b4d76U, 0xd6d661b7U, 0xb3b3ce7dU,
-    0x29297b52U, 0xe3e33eddU, 0x2f2f715eU, 0x84849713U,
-    0x5353f5a6U, 0xd1d168b9U, 0x00000000U, 0xeded2cc1U,
-    0x20206040U, 0xfcfc1fe3U, 0xb1b1c879U, 0x5b5bedb6U,
-    0x6a6abed4U, 0xcbcb468dU, 0xbebed967U, 0x39394b72U,
-    0x4a4ade94U, 0x4c4cd498U, 0x5858e8b0U, 0xcfcf4a85U,
-    0xd0d06bbbU, 0xefef2ac5U, 0xaaaae54fU, 0xfbfb16edU,
-    0x4343c586U, 0x4d4dd79aU, 0x33335566U, 0x85859411U,
-    0x4545cf8aU, 0xf9f910e9U, 0x02020604U, 0x7f7f81feU,
-    0x5050f0a0U, 0x3c3c4478U, 0x9f9fba25U, 0xa8a8e34bU,
-    0x5151f3a2U, 0xa3a3fe5dU, 0x4040c080U, 0x8f8f8a05U,
-    0x9292ad3fU, 0x9d9dbc21U, 0x38384870U, 0xf5f504f1U,
-    0xbcbcdf63U, 0xb6b6c177U, 0xdada75afU, 0x21216342U,
-    0x10103020U, 0xffff1ae5U, 0xf3f30efdU, 0xd2d26dbfU,
-    0xcdcd4c81U, 0x0c0c1418U, 0x13133526U, 0xecec2fc3U,
-    0x5f5fe1beU, 0x9797a235U, 0x4444cc88U, 0x1717392eU,
-    0xc4c45793U, 0xa7a7f255U, 0x7e7e82fcU, 0x3d3d477aU,
-    0x6464acc8U, 0x5d5de7baU, 0x19192b32U, 0x737395e6U,
-    0x6060a0c0U, 0x81819819U, 0x4f4fd19eU, 0xdcdc7fa3U,
-    0x22226644U, 0x2a2a7e54U, 0x9090ab3bU, 0x8888830bU,
-    0x4646ca8cU, 0xeeee29c7U, 0xb8b8d36bU, 0x14143c28U,
-    0xdede79a7U, 0x5e5ee2bcU, 0x0b0b1d16U, 0xdbdb76adU,
-    0xe0e03bdbU, 0x32325664U, 0x3a3a4e74U, 0x0a0a1e14U,
-    0x4949db92U, 0x06060a0cU, 0x24246c48U, 0x5c5ce4b8U,
-    0xc2c25d9fU, 0xd3d36ebdU, 0xacacef43U, 0x6262a6c4U,
-    0x9191a839U, 0x9595a431U, 0xe4e437d3U, 0x79798bf2U,
-    0xe7e732d5U, 0xc8c8438bU, 0x3737596eU, 0x6d6db7daU,
-    0x8d8d8c01U, 0xd5d564b1U, 0x4e4ed29cU, 0xa9a9e049U,
-    0x6c6cb4d8U, 0x5656faacU, 0xf4f407f3U, 0xeaea25cfU,
-    0x6565afcaU, 0x7a7a8ef4U, 0xaeaee947U, 0x08081810U,
-    0xbabad56fU, 0x787888f0U, 0x25256f4aU, 0x2e2e725cU,
-    0x1c1c2438U, 0xa6a6f157U, 0xb4b4c773U, 0xc6c65197U,
-    0xe8e823cbU, 0xdddd7ca1U, 0x74749ce8U, 0x1f1f213eU,
-    0x4b4bdd96U, 0xbdbddc61U, 0x8b8b860dU, 0x8a8a850fU,
-    0x707090e0U, 0x3e3e427cU, 0xb5b5c471U, 0x6666aaccU,
-    0x4848d890U, 0x03030506U, 0xf6f601f7U, 0x0e0e121cU,
-    0x6161a3c2U, 0x35355f6aU, 0x5757f9aeU, 0xb9b9d069U,
-    0x86869117U, 0xc1c15899U, 0x1d1d273aU, 0x9e9eb927U,
-    0xe1e138d9U, 0xf8f813ebU, 0x9898b32bU, 0x11113322U,
-    0x6969bbd2U, 0xd9d970a9U, 0x8e8e8907U, 0x9494a733U,
-    0x9b9bb62dU, 0x1e1e223cU, 0x87879215U, 0xe9e920c9U,
-    0xcece4987U, 0x5555ffaaU, 0x28287850U, 0xdfdf7aa5U,
-    0x8c8c8f03U, 0xa1a1f859U, 0x89898009U, 0x0d0d171aU,
-    0xbfbfda65U, 0xe6e631d7U, 0x4242c684U, 0x6868b8d0U,
-    0x4141c382U, 0x9999b029U, 0x2d2d775aU, 0x0f0f111eU,
-    0xb0b0cb7bU, 0x5454fca8U, 0xbbbbd66dU, 0x16163a2cU,
-};
-
-static const uint32_t Td0[256] = {
-    0x51f4a750U, 0x7e416553U, 0x1a17a4c3U, 0x3a275e96U,
-    0x3bab6bcbU, 0x1f9d45f1U, 0xacfa58abU, 0x4be30393U,
-    0x2030fa55U, 0xad766df6U, 0x88cc7691U, 0xf5024c25U,
-    0x4fe5d7fcU, 0xc52acbd7U, 0x26354480U, 0xb562a38fU,
-    0xdeb15a49U, 0x25ba1b67U, 0x45ea0e98U, 0x5dfec0e1U,
-    0xc32f7502U, 0x814cf012U, 0x8d4697a3U, 0x6bd3f9c6U,
-    0x038f5fe7U, 0x15929c95U, 0xbf6d7aebU, 0x955259daU,
-    0xd4be832dU, 0x587421d3U, 0x49e06929U, 0x8ec9c844U,
-    0x75c2896aU, 0xf48e7978U, 0x99583e6bU, 0x27b971ddU,
-    0xbee14fb6U, 0xf088ad17U, 0xc920ac66U, 0x7dce3ab4U,
-    0x63df4a18U, 0xe51a3182U, 0x97513360U, 0x62537f45U,
-    0xb16477e0U, 0xbb6bae84U, 0xfe81a01cU, 0xf9082b94U,
-    0x70486858U, 0x8f45fd19U, 0x94de6c87U, 0x527bf8b7U,
-    0xab73d323U, 0x724b02e2U, 0xe31f8f57U, 0x6655ab2aU,
-    0xb2eb2807U, 0x2fb5c203U, 0x86c57b9aU, 0xd33708a5U,
-    0x302887f2U, 0x23bfa5b2U, 0x02036abaU, 0xed16825cU,
-    0x8acf1c2bU, 0xa779b492U, 0xf307f2f0U, 0x4e69e2a1U,
-    0x65daf4cdU, 0x0605bed5U, 0xd134621fU, 0xc4a6fe8aU,
-    0x342e539dU, 0xa2f355a0U, 0x058ae132U, 0xa4f6eb75U,
-    0x0b83ec39U, 0x4060efaaU, 0x5e719f06U, 0xbd6e1051U,
-    0x3e218af9U, 0x96dd063dU, 0xdd3e05aeU, 0x4de6bd46U,
-    0x91548db5U, 0x71c45d05U, 0x0406d46fU, 0x605015ffU,
-    0x1998fb24U, 0xd6bde997U, 0x894043ccU, 0x67d99e77U,
-    0xb0e842bdU, 0x07898b88U, 0xe7195b38U, 0x79c8eedbU,
-    0xa17c0a47U, 0x7c420fe9U, 0xf8841ec9U, 0x00000000U,
-    0x09808683U, 0x322bed48U, 0x1e1170acU, 0x6c5a724eU,
-    0xfd0efffbU, 0x0f853856U, 0x3daed51eU, 0x362d3927U,
-    0x0a0fd964U, 0x685ca621U, 0x9b5b54d1U, 0x24362e3aU,
-    0x0c0a67b1U, 0x9357e70fU, 0xb4ee96d2U, 0x1b9b919eU,
-    0x80c0c54fU, 0x61dc20a2U, 0x5a774b69U, 0x1c121a16U,
-    0xe293ba0aU, 0xc0a02ae5U, 0x3c22e043U, 0x121b171dU,
-    0x0e090d0bU, 0xf28bc7adU, 0x2db6a8b9U, 0x141ea9c8U,
-    0x57f11985U, 0xaf75074cU, 0xee99ddbbU, 0xa37f60fdU,
-    0xf701269fU, 0x5c72f5bcU, 0x44663bc5U, 0x5bfb7e34U,
-    0x8b432976U, 0xcb23c6dcU, 0xb6edfc68U, 0xb8e4f163U,
-    0xd731dccaU, 0x42638510U, 0x13972240U, 0x84c61120U,
-    0x854a247dU, 0xd2bb3df8U, 0xaef93211U, 0xc729a16dU,
-    0x1d9e2f4bU, 0xdcb230f3U, 0x0d8652ecU, 0x77c1e3d0U,
-    0x2bb3166cU, 0xa970b999U, 0x119448faU, 0x47e96422U,
-    0xa8fc8cc4U, 0xa0f03f1aU, 0x567d2cd8U, 0x223390efU,
-    0x87494ec7U, 0xd938d1c1U, 0x8ccaa2feU, 0x98d40b36U,
-    0xa6f581cfU, 0xa57ade28U, 0xdab78e26U, 0x3fadbfa4U,
-    0x2c3a9de4U, 0x5078920dU, 0x6a5fcc9bU, 0x547e4662U,
-    0xf68d13c2U, 0x90d8b8e8U, 0x2e39f75eU, 0x82c3aff5U,
-    0x9f5d80beU, 0x69d0937cU, 0x6fd52da9U, 0xcf2512b3U,
-    0xc8ac993bU, 0x10187da7U, 0xe89c636eU, 0xdb3bbb7bU,
-    0xcd267809U, 0x6e5918f4U, 0xec9ab701U, 0x834f9aa8U,
-    0xe6956e65U, 0xaaffe67eU, 0x21bccf08U, 0xef15e8e6U,
-    0xbae79bd9U, 0x4a6f36ceU, 0xea9f09d4U, 0x29b07cd6U,
-    0x31a4b2afU, 0x2a3f2331U, 0xc6a59430U, 0x35a266c0U,
-    0x744ebc37U, 0xfc82caa6U, 0xe090d0b0U, 0x33a7d815U,
-    0xf104984aU, 0x41ecdaf7U, 0x7fcd500eU, 0x1791f62fU,
-    0x764dd68dU, 0x43efb04dU, 0xccaa4d54U, 0xe49604dfU,
-    0x9ed1b5e3U, 0x4c6a881bU, 0xc12c1fb8U, 0x4665517fU,
-    0x9d5eea04U, 0x018c355dU, 0xfa877473U, 0xfb0b412eU,
-    0xb3671d5aU, 0x92dbd252U, 0xe9105633U, 0x6dd64713U,
-    0x9ad7618cU, 0x37a10c7aU, 0x59f8148eU, 0xeb133c89U,
-    0xcea927eeU, 0xb761c935U, 0xe11ce5edU, 0x7a47b13cU,
-    0x9cd2df59U, 0x55f2733fU, 0x1814ce79U, 0x73c737bfU,
-    0x53f7cdeaU, 0x5ffdaa5bU, 0xdf3d6f14U, 0x7844db86U,
-    0xcaaff381U, 0xb968c43eU, 0x3824342cU, 0xc2a3405fU,
-    0x161dc372U, 0xbce2250cU, 0x283c498bU, 0xff0d9541U,
-    0x39a80171U, 0x080cb3deU, 0xd8b4e49cU, 0x6456c190U,
-    0x7bcb8461U, 0xd532b670U, 0x486c5c74U, 0xd0b85742U,
-};
-static const uint32_t Td1[256] = {
-    0x5051f4a7U, 0x537e4165U, 0xc31a17a4U, 0x963a275eU,
-    0xcb3bab6bU, 0xf11f9d45U, 0xabacfa58U, 0x934be303U,
-    0x552030faU, 0xf6ad766dU, 0x9188cc76U, 0x25f5024cU,
-    0xfc4fe5d7U, 0xd7c52acbU, 0x80263544U, 0x8fb562a3U,
-    0x49deb15aU, 0x6725ba1bU, 0x9845ea0eU, 0xe15dfec0U,
-    0x02c32f75U, 0x12814cf0U, 0xa38d4697U, 0xc66bd3f9U,
-    0xe7038f5fU, 0x9515929cU, 0xebbf6d7aU, 0xda955259U,
-    0x2dd4be83U, 0xd3587421U, 0x2949e069U, 0x448ec9c8U,
-    0x6a75c289U, 0x78f48e79U, 0x6b99583eU, 0xdd27b971U,
-    0xb6bee14fU, 0x17f088adU, 0x66c920acU, 0xb47dce3aU,
-    0x1863df4aU, 0x82e51a31U, 0x60975133U, 0x4562537fU,
-    0xe0b16477U, 0x84bb6baeU, 0x1cfe81a0U, 0x94f9082bU,
-    0x58704868U, 0x198f45fdU, 0x8794de6cU, 0xb7527bf8U,
-    0x23ab73d3U, 0xe2724b02U, 0x57e31f8fU, 0x2a6655abU,
-    0x07b2eb28U, 0x032fb5c2U, 0x9a86c57bU, 0xa5d33708U,
-    0xf2302887U, 0xb223bfa5U, 0xba02036aU, 0x5ced1682U,
-    0x2b8acf1cU, 0x92a779b4U, 0xf0f307f2U, 0xa14e69e2U,
-    0xcd65daf4U, 0xd50605beU, 0x1fd13462U, 0x8ac4a6feU,
-    0x9d342e53U, 0xa0a2f355U, 0x32058ae1U, 0x75a4f6ebU,
-    0x390b83ecU, 0xaa4060efU, 0x065e719fU, 0x51bd6e10U,
-    0xf93e218aU, 0x3d96dd06U, 0xaedd3e05U, 0x464de6bdU,
-    0xb591548dU, 0x0571c45dU, 0x6f0406d4U, 0xff605015U,
-    0x241998fbU, 0x97d6bde9U, 0xcc894043U, 0x7767d99eU,
-    0xbdb0e842U, 0x8807898bU, 0x38e7195bU, 0xdb79c8eeU,
-    0x47a17c0aU, 0xe97c420fU, 0xc9f8841eU, 0x00000000U,
-    0x83098086U, 0x48322bedU, 0xac1e1170U, 0x4e6c5a72U,
-    0xfbfd0effU, 0x560f8538U, 0x1e3daed5U, 0x27362d39U,
-    0x640a0fd9U, 0x21685ca6U, 0xd19b5b54U, 0x3a24362eU,
-    0xb10c0a67U, 0x0f9357e7U, 0xd2b4ee96U, 0x9e1b9b91U,
-    0x4f80c0c5U, 0xa261dc20U, 0x695a774bU, 0x161c121aU,
-    0x0ae293baU, 0xe5c0a02aU, 0x433c22e0U, 0x1d121b17U,
-    0x0b0e090dU, 0xadf28bc7U, 0xb92db6a8U, 0xc8141ea9U,
-    0x8557f119U, 0x4caf7507U, 0xbbee99ddU, 0xfda37f60U,
-    0x9ff70126U, 0xbc5c72f5U, 0xc544663bU, 0x345bfb7eU,
-    0x768b4329U, 0xdccb23c6U, 0x68b6edfcU, 0x63b8e4f1U,
-    0xcad731dcU, 0x10426385U, 0x40139722U, 0x2084c611U,
-    0x7d854a24U, 0xf8d2bb3dU, 0x11aef932U, 0x6dc729a1U,
-    0x4b1d9e2fU, 0xf3dcb230U, 0xec0d8652U, 0xd077c1e3U,
-    0x6c2bb316U, 0x99a970b9U, 0xfa119448U, 0x2247e964U,
-    0xc4a8fc8cU, 0x1aa0f03fU, 0xd8567d2cU, 0xef223390U,
-    0xc787494eU, 0xc1d938d1U, 0xfe8ccaa2U, 0x3698d40bU,
-    0xcfa6f581U, 0x28a57adeU, 0x26dab78eU, 0xa43fadbfU,
-    0xe42c3a9dU, 0x0d507892U, 0x9b6a5fccU, 0x62547e46U,
-    0xc2f68d13U, 0xe890d8b8U, 0x5e2e39f7U, 0xf582c3afU,
-    0xbe9f5d80U, 0x7c69d093U, 0xa96fd52dU, 0xb3cf2512U,
-    0x3bc8ac99U, 0xa710187dU, 0x6ee89c63U, 0x7bdb3bbbU,
-    0x09cd2678U, 0xf46e5918U, 0x01ec9ab7U, 0xa8834f9aU,
-    0x65e6956eU, 0x7eaaffe6U, 0x0821bccfU, 0xe6ef15e8U,
-    0xd9bae79bU, 0xce4a6f36U, 0xd4ea9f09U, 0xd629b07cU,
-    0xaf31a4b2U, 0x312a3f23U, 0x30c6a594U, 0xc035a266U,
-    0x37744ebcU, 0xa6fc82caU, 0xb0e090d0U, 0x1533a7d8U,
-    0x4af10498U, 0xf741ecdaU, 0x0e7fcd50U, 0x2f1791f6U,
-    0x8d764dd6U, 0x4d43efb0U, 0x54ccaa4dU, 0xdfe49604U,
-    0xe39ed1b5U, 0x1b4c6a88U, 0xb8c12c1fU, 0x7f466551U,
-    0x049d5eeaU, 0x5d018c35U, 0x73fa8774U, 0x2efb0b41U,
-    0x5ab3671dU, 0x5292dbd2U, 0x33e91056U, 0x136dd647U,
-    0x8c9ad761U, 0x7a37a10cU, 0x8e59f814U, 0x89eb133cU,
-    0xeecea927U, 0x35b761c9U, 0xede11ce5U, 0x3c7a47b1U,
-    0x599cd2dfU, 0x3f55f273U, 0x791814ceU, 0xbf73c737U,
-    0xea53f7cdU, 0x5b5ffdaaU, 0x14df3d6fU, 0x867844dbU,
-    0x81caaff3U, 0x3eb968c4U, 0x2c382434U, 0x5fc2a340U,
-    0x72161dc3U, 0x0cbce225U, 0x8b283c49U, 0x41ff0d95U,
-    0x7139a801U, 0xde080cb3U, 0x9cd8b4e4U, 0x906456c1U,
-    0x617bcb84U, 0x70d532b6U, 0x74486c5cU, 0x42d0b857U,
-};
-static const uint32_t Td2[256] = {
-    0xa75051f4U, 0x65537e41U, 0xa4c31a17U, 0x5e963a27U,
-    0x6bcb3babU, 0x45f11f9dU, 0x58abacfaU, 0x03934be3U,
-    0xfa552030U, 0x6df6ad76U, 0x769188ccU, 0x4c25f502U,
-    0xd7fc4fe5U, 0xcbd7c52aU, 0x44802635U, 0xa38fb562U,
-    0x5a49deb1U, 0x1b6725baU, 0x0e9845eaU, 0xc0e15dfeU,
-    0x7502c32fU, 0xf012814cU, 0x97a38d46U, 0xf9c66bd3U,
-    0x5fe7038fU, 0x9c951592U, 0x7aebbf6dU, 0x59da9552U,
-    0x832dd4beU, 0x21d35874U, 0x692949e0U, 0xc8448ec9U,
-    0x896a75c2U, 0x7978f48eU, 0x3e6b9958U, 0x71dd27b9U,
-    0x4fb6bee1U, 0xad17f088U, 0xac66c920U, 0x3ab47dceU,
-    0x4a1863dfU, 0x3182e51aU, 0x33609751U, 0x7f456253U,
-    0x77e0b164U, 0xae84bb6bU, 0xa01cfe81U, 0x2b94f908U,
-    0x68587048U, 0xfd198f45U, 0x6c8794deU, 0xf8b7527bU,
-    0xd323ab73U, 0x02e2724bU, 0x8f57e31fU, 0xab2a6655U,
-    0x2807b2ebU, 0xc2032fb5U, 0x7b9a86c5U, 0x08a5d337U,
-    0x87f23028U, 0xa5b223bfU, 0x6aba0203U, 0x825ced16U,
-    0x1c2b8acfU, 0xb492a779U, 0xf2f0f307U, 0xe2a14e69U,
-    0xf4cd65daU, 0xbed50605U, 0x621fd134U, 0xfe8ac4a6U,
-    0x539d342eU, 0x55a0a2f3U, 0xe132058aU, 0xeb75a4f6U,
-    0xec390b83U, 0xefaa4060U, 0x9f065e71U, 0x1051bd6eU,
-    0x8af93e21U, 0x063d96ddU, 0x05aedd3eU, 0xbd464de6U,
-    0x8db59154U, 0x5d0571c4U, 0xd46f0406U, 0x15ff6050U,
-    0xfb241998U, 0xe997d6bdU, 0x43cc8940U, 0x9e7767d9U,
-    0x42bdb0e8U, 0x8b880789U, 0x5b38e719U, 0xeedb79c8U,
-    0x0a47a17cU, 0x0fe97c42U, 0x1ec9f884U, 0x00000000U,
-    0x86830980U, 0xed48322bU, 0x70ac1e11U, 0x724e6c5aU,
-    0xfffbfd0eU, 0x38560f85U, 0xd51e3daeU, 0x3927362dU,
-    0xd9640a0fU, 0xa621685cU, 0x54d19b5bU, 0x2e3a2436U,
-    0x67b10c0aU, 0xe70f9357U, 0x96d2b4eeU, 0x919e1b9bU,
-    0xc54f80c0U, 0x20a261dcU, 0x4b695a77U, 0x1a161c12U,
-    0xba0ae293U, 0x2ae5c0a0U, 0xe0433c22U, 0x171d121bU,
-    0x0d0b0e09U, 0xc7adf28bU, 0xa8b92db6U, 0xa9c8141eU,
-    0x198557f1U, 0x074caf75U, 0xddbbee99U, 0x60fda37fU,
-    0x269ff701U, 0xf5bc5c72U, 0x3bc54466U, 0x7e345bfbU,
-    0x29768b43U, 0xc6dccb23U, 0xfc68b6edU, 0xf163b8e4U,
-    0xdccad731U, 0x85104263U, 0x22401397U, 0x112084c6U,
-    0x247d854aU, 0x3df8d2bbU, 0x3211aef9U, 0xa16dc729U,
-    0x2f4b1d9eU, 0x30f3dcb2U, 0x52ec0d86U, 0xe3d077c1U,
-    0x166c2bb3U, 0xb999a970U, 0x48fa1194U, 0x642247e9U,
-    0x8cc4a8fcU, 0x3f1aa0f0U, 0x2cd8567dU, 0x90ef2233U,
-    0x4ec78749U, 0xd1c1d938U, 0xa2fe8ccaU, 0x0b3698d4U,
-    0x81cfa6f5U, 0xde28a57aU, 0x8e26dab7U, 0xbfa43fadU,
-    0x9de42c3aU, 0x920d5078U, 0xcc9b6a5fU, 0x4662547eU,
-    0x13c2f68dU, 0xb8e890d8U, 0xf75e2e39U, 0xaff582c3U,
-    0x80be9f5dU, 0x937c69d0U, 0x2da96fd5U, 0x12b3cf25U,
-    0x993bc8acU, 0x7da71018U, 0x636ee89cU, 0xbb7bdb3bU,
-    0x7809cd26U, 0x18f46e59U, 0xb701ec9aU, 0x9aa8834fU,
-    0x6e65e695U, 0xe67eaaffU, 0xcf0821bcU, 0xe8e6ef15U,
-    0x9bd9bae7U, 0x36ce4a6fU, 0x09d4ea9fU, 0x7cd629b0U,
-    0xb2af31a4U, 0x23312a3fU, 0x9430c6a5U, 0x66c035a2U,
-    0xbc37744eU, 0xcaa6fc82U, 0xd0b0e090U, 0xd81533a7U,
-    0x984af104U, 0xdaf741ecU, 0x500e7fcdU, 0xf62f1791U,
-    0xd68d764dU, 0xb04d43efU, 0x4d54ccaaU, 0x04dfe496U,
-    0xb5e39ed1U, 0x881b4c6aU, 0x1fb8c12cU, 0x517f4665U,
-    0xea049d5eU, 0x355d018cU, 0x7473fa87U, 0x412efb0bU,
-    0x1d5ab367U, 0xd25292dbU, 0x5633e910U, 0x47136dd6U,
-    0x618c9ad7U, 0x0c7a37a1U, 0x148e59f8U, 0x3c89eb13U,
-    0x27eecea9U, 0xc935b761U, 0xe5ede11cU, 0xb13c7a47U,
-    0xdf599cd2U, 0x733f55f2U, 0xce791814U, 0x37bf73c7U,
-    0xcdea53f7U, 0xaa5b5ffdU, 0x6f14df3dU, 0xdb867844U,
-    0xf381caafU, 0xc43eb968U, 0x342c3824U, 0x405fc2a3U,
-    0xc372161dU, 0x250cbce2U, 0x498b283cU, 0x9541ff0dU,
-    0x017139a8U, 0xb3de080cU, 0xe49cd8b4U, 0xc1906456U,
-    0x84617bcbU, 0xb670d532U, 0x5c74486cU, 0x5742d0b8U,
-};
-static const uint32_t Td3[256] = {
-    0xf4a75051U, 0x4165537eU, 0x17a4c31aU, 0x275e963aU,
-    0xab6bcb3bU, 0x9d45f11fU, 0xfa58abacU, 0xe303934bU,
-    0x30fa5520U, 0x766df6adU, 0xcc769188U, 0x024c25f5U,
-    0xe5d7fc4fU, 0x2acbd7c5U, 0x35448026U, 0x62a38fb5U,
-    0xb15a49deU, 0xba1b6725U, 0xea0e9845U, 0xfec0e15dU,
-    0x2f7502c3U, 0x4cf01281U, 0x4697a38dU, 0xd3f9c66bU,
-    0x8f5fe703U, 0x929c9515U, 0x6d7aebbfU, 0x5259da95U,
-    0xbe832dd4U, 0x7421d358U, 0xe0692949U, 0xc9c8448eU,
-    0xc2896a75U, 0x8e7978f4U, 0x583e6b99U, 0xb971dd27U,
-    0xe14fb6beU, 0x88ad17f0U, 0x20ac66c9U, 0xce3ab47dU,
-    0xdf4a1863U, 0x1a3182e5U, 0x51336097U, 0x537f4562U,
-    0x6477e0b1U, 0x6bae84bbU, 0x81a01cfeU, 0x082b94f9U,
-    0x48685870U, 0x45fd198fU, 0xde6c8794U, 0x7bf8b752U,
-    0x73d323abU, 0x4b02e272U, 0x1f8f57e3U, 0x55ab2a66U,
-    0xeb2807b2U, 0xb5c2032fU, 0xc57b9a86U, 0x3708a5d3U,
-    0x2887f230U, 0xbfa5b223U, 0x036aba02U, 0x16825cedU,
-    0xcf1c2b8aU, 0x79b492a7U, 0x07f2f0f3U, 0x69e2a14eU,
-    0xdaf4cd65U, 0x05bed506U, 0x34621fd1U, 0xa6fe8ac4U,
-    0x2e539d34U, 0xf355a0a2U, 0x8ae13205U, 0xf6eb75a4U,
-    0x83ec390bU, 0x60efaa40U, 0x719f065eU, 0x6e1051bdU,
-    0x218af93eU, 0xdd063d96U, 0x3e05aeddU, 0xe6bd464dU,
-    0x548db591U, 0xc45d0571U, 0x06d46f04U, 0x5015ff60U,
-    0x98fb2419U, 0xbde997d6U, 0x4043cc89U, 0xd99e7767U,
-    0xe842bdb0U, 0x898b8807U, 0x195b38e7U, 0xc8eedb79U,
-    0x7c0a47a1U, 0x420fe97cU, 0x841ec9f8U, 0x00000000U,
-    0x80868309U, 0x2bed4832U, 0x1170ac1eU, 0x5a724e6cU,
-    0x0efffbfdU, 0x8538560fU, 0xaed51e3dU, 0x2d392736U,
-    0x0fd9640aU, 0x5ca62168U, 0x5b54d19bU, 0x362e3a24U,
-    0x0a67b10cU, 0x57e70f93U, 0xee96d2b4U, 0x9b919e1bU,
-    0xc0c54f80U, 0xdc20a261U, 0x774b695aU, 0x121a161cU,
-    0x93ba0ae2U, 0xa02ae5c0U, 0x22e0433cU, 0x1b171d12U,
-    0x090d0b0eU, 0x8bc7adf2U, 0xb6a8b92dU, 0x1ea9c814U,
-    0xf1198557U, 0x75074cafU, 0x99ddbbeeU, 0x7f60fda3U,
-    0x01269ff7U, 0x72f5bc5cU, 0x663bc544U, 0xfb7e345bU,
-    0x4329768bU, 0x23c6dccbU, 0xedfc68b6U, 0xe4f163b8U,
-    0x31dccad7U, 0x63851042U, 0x97224013U, 0xc6112084U,
-    0x4a247d85U, 0xbb3df8d2U, 0xf93211aeU, 0x29a16dc7U,
-    0x9e2f4b1dU, 0xb230f3dcU, 0x8652ec0dU, 0xc1e3d077U,
-    0xb3166c2bU, 0x70b999a9U, 0x9448fa11U, 0xe9642247U,
-    0xfc8cc4a8U, 0xf03f1aa0U, 0x7d2cd856U, 0x3390ef22U,
-    0x494ec787U, 0x38d1c1d9U, 0xcaa2fe8cU, 0xd40b3698U,
-    0xf581cfa6U, 0x7ade28a5U, 0xb78e26daU, 0xadbfa43fU,
-    0x3a9de42cU, 0x78920d50U, 0x5fcc9b6aU, 0x7e466254U,
-    0x8d13c2f6U, 0xd8b8e890U, 0x39f75e2eU, 0xc3aff582U,
-    0x5d80be9fU, 0xd0937c69U, 0xd52da96fU, 0x2512b3cfU,
-    0xac993bc8U, 0x187da710U, 0x9c636ee8U, 0x3bbb7bdbU,
-    0x267809cdU, 0x5918f46eU, 0x9ab701ecU, 0x4f9aa883U,
-    0x956e65e6U, 0xffe67eaaU, 0xbccf0821U, 0x15e8e6efU,
-    0xe79bd9baU, 0x6f36ce4aU, 0x9f09d4eaU, 0xb07cd629U,
-    0xa4b2af31U, 0x3f23312aU, 0xa59430c6U, 0xa266c035U,
-    0x4ebc3774U, 0x82caa6fcU, 0x90d0b0e0U, 0xa7d81533U,
-    0x04984af1U, 0xecdaf741U, 0xcd500e7fU, 0x91f62f17U,
-    0x4dd68d76U, 0xefb04d43U, 0xaa4d54ccU, 0x9604dfe4U,
-    0xd1b5e39eU, 0x6a881b4cU, 0x2c1fb8c1U, 0x65517f46U,
-    0x5eea049dU, 0x8c355d01U, 0x877473faU, 0x0b412efbU,
-    0x671d5ab3U, 0xdbd25292U, 0x105633e9U, 0xd647136dU,
-    0xd7618c9aU, 0xa10c7a37U, 0xf8148e59U, 0x133c89ebU,
-    0xa927eeceU, 0x61c935b7U, 0x1ce5ede1U, 0x47b13c7aU,
-    0xd2df599cU, 0xf2733f55U, 0x14ce7918U, 0xc737bf73U,
-    0xf7cdea53U, 0xfdaa5b5fU, 0x3d6f14dfU, 0x44db8678U,
-    0xaff381caU, 0x68c43eb9U, 0x24342c38U, 0xa3405fc2U,
-    0x1dc37216U, 0xe2250cbcU, 0x3c498b28U, 0x0d9541ffU,
-    0xa8017139U, 0x0cb3de08U, 0xb4e49cd8U, 0x56c19064U,
-    0xcb84617bU, 0x32b670d5U, 0x6c5c7448U, 0xb85742d0U,
-};
-static const uint8_t Td4[256] = {
-    0x52U, 0x09U, 0x6aU, 0xd5U, 0x30U, 0x36U, 0xa5U, 0x38U,
-    0xbfU, 0x40U, 0xa3U, 0x9eU, 0x81U, 0xf3U, 0xd7U, 0xfbU,
-    0x7cU, 0xe3U, 0x39U, 0x82U, 0x9bU, 0x2fU, 0xffU, 0x87U,
-    0x34U, 0x8eU, 0x43U, 0x44U, 0xc4U, 0xdeU, 0xe9U, 0xcbU,
-    0x54U, 0x7bU, 0x94U, 0x32U, 0xa6U, 0xc2U, 0x23U, 0x3dU,
-    0xeeU, 0x4cU, 0x95U, 0x0bU, 0x42U, 0xfaU, 0xc3U, 0x4eU,
-    0x08U, 0x2eU, 0xa1U, 0x66U, 0x28U, 0xd9U, 0x24U, 0xb2U,
-    0x76U, 0x5bU, 0xa2U, 0x49U, 0x6dU, 0x8bU, 0xd1U, 0x25U,
-    0x72U, 0xf8U, 0xf6U, 0x64U, 0x86U, 0x68U, 0x98U, 0x16U,
-    0xd4U, 0xa4U, 0x5cU, 0xccU, 0x5dU, 0x65U, 0xb6U, 0x92U,
-    0x6cU, 0x70U, 0x48U, 0x50U, 0xfdU, 0xedU, 0xb9U, 0xdaU,
-    0x5eU, 0x15U, 0x46U, 0x57U, 0xa7U, 0x8dU, 0x9dU, 0x84U,
-    0x90U, 0xd8U, 0xabU, 0x00U, 0x8cU, 0xbcU, 0xd3U, 0x0aU,
-    0xf7U, 0xe4U, 0x58U, 0x05U, 0xb8U, 0xb3U, 0x45U, 0x06U,
-    0xd0U, 0x2cU, 0x1eU, 0x8fU, 0xcaU, 0x3fU, 0x0fU, 0x02U,
-    0xc1U, 0xafU, 0xbdU, 0x03U, 0x01U, 0x13U, 0x8aU, 0x6bU,
-    0x3aU, 0x91U, 0x11U, 0x41U, 0x4fU, 0x67U, 0xdcU, 0xeaU,
-    0x97U, 0xf2U, 0xcfU, 0xceU, 0xf0U, 0xb4U, 0xe6U, 0x73U,
-    0x96U, 0xacU, 0x74U, 0x22U, 0xe7U, 0xadU, 0x35U, 0x85U,
-    0xe2U, 0xf9U, 0x37U, 0xe8U, 0x1cU, 0x75U, 0xdfU, 0x6eU,
-    0x47U, 0xf1U, 0x1aU, 0x71U, 0x1dU, 0x29U, 0xc5U, 0x89U,
-    0x6fU, 0xb7U, 0x62U, 0x0eU, 0xaaU, 0x18U, 0xbeU, 0x1bU,
-    0xfcU, 0x56U, 0x3eU, 0x4bU, 0xc6U, 0xd2U, 0x79U, 0x20U,
-    0x9aU, 0xdbU, 0xc0U, 0xfeU, 0x78U, 0xcdU, 0x5aU, 0xf4U,
-    0x1fU, 0xddU, 0xa8U, 0x33U, 0x88U, 0x07U, 0xc7U, 0x31U,
-    0xb1U, 0x12U, 0x10U, 0x59U, 0x27U, 0x80U, 0xecU, 0x5fU,
-    0x60U, 0x51U, 0x7fU, 0xa9U, 0x19U, 0xb5U, 0x4aU, 0x0dU,
-    0x2dU, 0xe5U, 0x7aU, 0x9fU, 0x93U, 0xc9U, 0x9cU, 0xefU,
-    0xa0U, 0xe0U, 0x3bU, 0x4dU, 0xaeU, 0x2aU, 0xf5U, 0xb0U,
-    0xc8U, 0xebU, 0xbbU, 0x3cU, 0x83U, 0x53U, 0x99U, 0x61U,
-    0x17U, 0x2bU, 0x04U, 0x7eU, 0xbaU, 0x77U, 0xd6U, 0x26U,
-    0xe1U, 0x69U, 0x14U, 0x63U, 0x55U, 0x21U, 0x0cU, 0x7dU,
-};
-static const uint32_t rcon[] = {
-	0x01000000, 0x02000000, 0x04000000, 0x08000000,
-	0x10000000, 0x20000000, 0x40000000, 0x80000000,
-	0x1B000000, 0x36000000, /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */
-};
-
-/**
- * Expand the cipher key into the encryption key schedule.
- */
-int AES_set_encrypt_key(const uint8_t *userKey, const uint32_t bits,
-			AES_KEY *key) {
-
-	uint32_t *rk;
-   	int i = 0;
-	uint32_t temp;
-
-	if (!userKey || !key)
-		return -1;
-	if (bits != 128 && bits != 192 && bits != 256)
-		return -2;
-
-	rk = key->rd_key;
-
-	if (bits==128)
-		key->rounds = 10;
-	else if (bits==192)
-		key->rounds = 12;
-	else
-		key->rounds = 14;
-
-	rk[0] = GETU32(userKey     );
-	rk[1] = GETU32(userKey +  4);
-	rk[2] = GETU32(userKey +  8);
-	rk[3] = GETU32(userKey + 12);
-	if (bits == 128) {
-		while (1) {
-			temp  = rk[3];
-			rk[4] = rk[0] ^
-				(Te2[(temp >> 16) & 0xff] & 0xff000000) ^
-				(Te3[(temp >>  8) & 0xff] & 0x00ff0000) ^
-				(Te0[(temp      ) & 0xff] & 0x0000ff00) ^
-				(Te1[(temp >> 24)       ] & 0x000000ff) ^
-				rcon[i];
-			rk[5] = rk[1] ^ rk[4];
-			rk[6] = rk[2] ^ rk[5];
-			rk[7] = rk[3] ^ rk[6];
-			if (++i == 10) {
-				return 0;
-			}
-			rk += 4;
-		}
-	}
-	rk[4] = GETU32(userKey + 16);
-	rk[5] = GETU32(userKey + 20);
-	if (bits == 192) {
-		while (1) {
-			temp = rk[ 5];
-			rk[ 6] = rk[ 0] ^
-				(Te2[(temp >> 16) & 0xff] & 0xff000000) ^
-				(Te3[(temp >>  8) & 0xff] & 0x00ff0000) ^
-				(Te0[(temp      ) & 0xff] & 0x0000ff00) ^
-				(Te1[(temp >> 24)       ] & 0x000000ff) ^
-				rcon[i];
-			rk[ 7] = rk[ 1] ^ rk[ 6];
-			rk[ 8] = rk[ 2] ^ rk[ 7];
-			rk[ 9] = rk[ 3] ^ rk[ 8];
-			if (++i == 8) {
-				return 0;
-			}
-			rk[10] = rk[ 4] ^ rk[ 9];
-			rk[11] = rk[ 5] ^ rk[10];
-			rk += 6;
-		}
-	}
-	rk[6] = GETU32(userKey + 24);
-	rk[7] = GETU32(userKey + 28);
-	if (bits == 256) {
-		while (1) {
-			temp = rk[ 7];
-			rk[ 8] = rk[ 0] ^
-				(Te2[(temp >> 16) & 0xff] & 0xff000000) ^
-				(Te3[(temp >>  8) & 0xff] & 0x00ff0000) ^
-				(Te0[(temp      ) & 0xff] & 0x0000ff00) ^
-				(Te1[(temp >> 24)       ] & 0x000000ff) ^
-				rcon[i];
-			rk[ 9] = rk[ 1] ^ rk[ 8];
-			rk[10] = rk[ 2] ^ rk[ 9];
-			rk[11] = rk[ 3] ^ rk[10];
-			if (++i == 7) {
-				return 0;
-			}
-			temp = rk[11];
-			rk[12] = rk[ 4] ^
-				(Te2[(temp >> 24)       ] & 0xff000000) ^
-				(Te3[(temp >> 16) & 0xff] & 0x00ff0000) ^
-				(Te0[(temp >>  8) & 0xff] & 0x0000ff00) ^
-				(Te1[(temp      ) & 0xff] & 0x000000ff);
-			rk[13] = rk[ 5] ^ rk[12];
-			rk[14] = rk[ 6] ^ rk[13];
-			rk[15] = rk[ 7] ^ rk[14];
-
-			rk += 8;
-        	}
-	}
-	return 0;
-}
-
-/**
- * Expand the cipher key into the decryption key schedule.
- */
-int AES_set_decrypt_key(const uint8_t *userKey, const uint32_t bits,
-                        AES_KEY *key) {
-
-        uint32_t *rk;
-	int i, j, status;
-	uint32_t temp;
-
-	/* first, start with an encryption schedule */
-	status = AES_set_encrypt_key(userKey, bits, key);
-	if (status < 0)
-		return status;
-
-	rk = key->rd_key;
-
-	/* invert the order of the round keys: */
-	for (i = 0, j = 4*(key->rounds); i < j; i += 4, j -= 4) {
-		temp = rk[i    ]; rk[i    ] = rk[j    ]; rk[j    ] = temp;
-		temp = rk[i + 1]; rk[i + 1] = rk[j + 1]; rk[j + 1] = temp;
-		temp = rk[i + 2]; rk[i + 2] = rk[j + 2]; rk[j + 2] = temp;
-		temp = rk[i + 3]; rk[i + 3] = rk[j + 3]; rk[j + 3] = temp;
-	}
-	/* apply the inverse MixColumn transform to all round keys but the first and the last: */
-	for (i = 1; i < (key->rounds); i++) {
-		rk += 4;
-		rk[0] =
-			Td0[Te1[(rk[0] >> 24)       ] & 0xff] ^
-			Td1[Te1[(rk[0] >> 16) & 0xff] & 0xff] ^
-			Td2[Te1[(rk[0] >>  8) & 0xff] & 0xff] ^
-			Td3[Te1[(rk[0]      ) & 0xff] & 0xff];
-		rk[1] =
-			Td0[Te1[(rk[1] >> 24)       ] & 0xff] ^
-			Td1[Te1[(rk[1] >> 16) & 0xff] & 0xff] ^
-			Td2[Te1[(rk[1] >>  8) & 0xff] & 0xff] ^
-			Td3[Te1[(rk[1]      ) & 0xff] & 0xff];
-		rk[2] =
-			Td0[Te1[(rk[2] >> 24)       ] & 0xff] ^
-			Td1[Te1[(rk[2] >> 16) & 0xff] & 0xff] ^
-			Td2[Te1[(rk[2] >>  8) & 0xff] & 0xff] ^
-			Td3[Te1[(rk[2]      ) & 0xff] & 0xff];
-		rk[3] =
-			Td0[Te1[(rk[3] >> 24)       ] & 0xff] ^
-			Td1[Te1[(rk[3] >> 16) & 0xff] & 0xff] ^
-			Td2[Te1[(rk[3] >>  8) & 0xff] & 0xff] ^
-			Td3[Te1[(rk[3]      ) & 0xff] & 0xff];
-	}
-	return 0;
-}
-
-/*
- * Encrypt a single block
- * in and out can overlap
- */
-void AES_encrypt(const uint8_t *in, uint8_t *out,
-		 const AES_KEY *key) {
-
-	const uint32_t *rk;
-	uint32_t s0, s1, s2, s3, t0, t1, t2, t3;
-#ifndef FULL_UNROLL
-	int r;
-#endif /* ?FULL_UNROLL */
-
-	assert(in && out && key);
-	rk = key->rd_key;
-
-	/*
-	 * map byte array block to cipher state
-	 * and add initial round key:
-	 */
-	s0 = GETU32(in     ) ^ rk[0];
-	s1 = GETU32(in +  4) ^ rk[1];
-	s2 = GETU32(in +  8) ^ rk[2];
-	s3 = GETU32(in + 12) ^ rk[3];
-#ifdef FULL_UNROLL
-	/* round 1: */
-   	t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[ 4];
-   	t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[ 5];
-   	t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[ 6];
-   	t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[ 7];
-   	/* round 2: */
-   	s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[ 8];
-   	s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[ 9];
-   	s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[10];
-   	s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[11];
-	/* round 3: */
-   	t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[12];
-   	t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[13];
-   	t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[14];
-   	t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[15];
-   	/* round 4: */
-   	s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[16];
-   	s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[17];
-   	s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[18];
-   	s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[19];
-	/* round 5: */
-   	t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[20];
-   	t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[21];
-   	t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[22];
-   	t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[23];
-   	/* round 6: */
-   	s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[24];
-   	s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[25];
-   	s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[26];
-   	s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[27];
-	/* round 7: */
-   	t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[28];
-   	t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[29];
-   	t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[30];
-   	t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[31];
-   	/* round 8: */
-   	s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[32];
-   	s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[33];
-   	s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[34];
-   	s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[35];
-	/* round 9: */
-   	t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[36];
-   	t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[37];
-   	t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[38];
-   	t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[39];
-    if (key->rounds > 10) {
-        /* round 10: */
-        s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[40];
-        s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[41];
-        s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[42];
-        s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[43];
-        /* round 11: */
-        t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[44];
-        t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[45];
-        t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[46];
-        t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[47];
-        if (key->rounds > 12) {
-            /* round 12: */
-            s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[48];
-            s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[49];
-            s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[50];
-            s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[51];
-            /* round 13: */
-            t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[52];
-            t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[53];
-            t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[54];
-            t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[55];
-        }
-    }
-    rk += key->rounds << 2;
-#else  /* !FULL_UNROLL */
-    /*
-     * Nr - 1 full rounds:
-     */
-    r = key->rounds >> 1;
-    for (;;) {
-        t0 =
-            Te0[(s0 >> 24)       ] ^
-            Te1[(s1 >> 16) & 0xff] ^
-            Te2[(s2 >>  8) & 0xff] ^
-            Te3[(s3      ) & 0xff] ^
-            rk[4];
-        t1 =
-            Te0[(s1 >> 24)       ] ^
-            Te1[(s2 >> 16) & 0xff] ^
-            Te2[(s3 >>  8) & 0xff] ^
-            Te3[(s0      ) & 0xff] ^
-            rk[5];
-        t2 =
-            Te0[(s2 >> 24)       ] ^
-            Te1[(s3 >> 16) & 0xff] ^
-            Te2[(s0 >>  8) & 0xff] ^
-            Te3[(s1      ) & 0xff] ^
-            rk[6];
-        t3 =
-            Te0[(s3 >> 24)       ] ^
-            Te1[(s0 >> 16) & 0xff] ^
-            Te2[(s1 >>  8) & 0xff] ^
-            Te3[(s2      ) & 0xff] ^
-            rk[7];
-
-        rk += 8;
-        if (--r == 0) {
-            break;
-        }
-
-        s0 =
-            Te0[(t0 >> 24)       ] ^
-            Te1[(t1 >> 16) & 0xff] ^
-            Te2[(t2 >>  8) & 0xff] ^
-            Te3[(t3      ) & 0xff] ^
-            rk[0];
-        s1 =
-            Te0[(t1 >> 24)       ] ^
-            Te1[(t2 >> 16) & 0xff] ^
-            Te2[(t3 >>  8) & 0xff] ^
-            Te3[(t0      ) & 0xff] ^
-            rk[1];
-        s2 =
-            Te0[(t2 >> 24)       ] ^
-            Te1[(t3 >> 16) & 0xff] ^
-            Te2[(t0 >>  8) & 0xff] ^
-            Te3[(t1      ) & 0xff] ^
-            rk[2];
-        s3 =
-            Te0[(t3 >> 24)       ] ^
-            Te1[(t0 >> 16) & 0xff] ^
-            Te2[(t1 >>  8) & 0xff] ^
-            Te3[(t2      ) & 0xff] ^
-            rk[3];
-    }
-#endif /* ?FULL_UNROLL */
-    /*
-	 * apply last round and
-	 * map cipher state to byte array block:
-	 */
-	s0 =
-		(Te2[(t0 >> 24)       ] & 0xff000000) ^
-		(Te3[(t1 >> 16) & 0xff] & 0x00ff0000) ^
-		(Te0[(t2 >>  8) & 0xff] & 0x0000ff00) ^
-		(Te1[(t3      ) & 0xff] & 0x000000ff) ^
-		rk[0];
-	PUTU32(out     , s0);
-	s1 =
-		(Te2[(t1 >> 24)       ] & 0xff000000) ^
-		(Te3[(t2 >> 16) & 0xff] & 0x00ff0000) ^
-		(Te0[(t3 >>  8) & 0xff] & 0x0000ff00) ^
-		(Te1[(t0      ) & 0xff] & 0x000000ff) ^
-		rk[1];
-	PUTU32(out +  4, s1);
-	s2 =
-		(Te2[(t2 >> 24)       ] & 0xff000000) ^
-		(Te3[(t3 >> 16) & 0xff] & 0x00ff0000) ^
-		(Te0[(t0 >>  8) & 0xff] & 0x0000ff00) ^
-		(Te1[(t1      ) & 0xff] & 0x000000ff) ^
-		rk[2];
-	PUTU32(out +  8, s2);
-	s3 =
-		(Te2[(t3 >> 24)       ] & 0xff000000) ^
-		(Te3[(t0 >> 16) & 0xff] & 0x00ff0000) ^
-		(Te0[(t1 >>  8) & 0xff] & 0x0000ff00) ^
-		(Te1[(t2      ) & 0xff] & 0x000000ff) ^
-		rk[3];
-	PUTU32(out + 12, s3);
-}
-
-/*
- * Decrypt a single block
- * in and out can overlap
- */
-void AES_decrypt(const uint8_t *in, uint8_t *out,
-		 const AES_KEY *key) {
-
-	const uint32_t *rk;
-	uint32_t s0, s1, s2, s3, t0, t1, t2, t3;
-#ifndef FULL_UNROLL
-	int r;
-#endif /* ?FULL_UNROLL */
-
-	assert(in && out && key);
-	rk = key->rd_key;
-
-	/*
-	 * map byte array block to cipher state
-	 * and add initial round key:
-	 */
-    s0 = GETU32(in     ) ^ rk[0];
-    s1 = GETU32(in +  4) ^ rk[1];
-    s2 = GETU32(in +  8) ^ rk[2];
-    s3 = GETU32(in + 12) ^ rk[3];
-#ifdef FULL_UNROLL
-    /* round 1: */
-    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[ 4];
-    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[ 5];
-    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[ 6];
-    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[ 7];
-    /* round 2: */
-    s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[ 8];
-    s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[ 9];
-    s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[10];
-    s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[11];
-    /* round 3: */
-    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[12];
-    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[13];
-    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[14];
-    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[15];
-    /* round 4: */
-    s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[16];
-    s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[17];
-    s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[18];
-    s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[19];
-    /* round 5: */
-    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[20];
-    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[21];
-    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[22];
-    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[23];
-    /* round 6: */
-    s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[24];
-    s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[25];
-    s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[26];
-    s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[27];
-    /* round 7: */
-    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[28];
-    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[29];
-    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[30];
-    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[31];
-    /* round 8: */
-    s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[32];
-    s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[33];
-    s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[34];
-    s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[35];
-    /* round 9: */
-    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[36];
-    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[37];
-    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[38];
-    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[39];
-    if (key->rounds > 10) {
-        /* round 10: */
-        s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[40];
-        s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[41];
-        s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[42];
-        s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[43];
-        /* round 11: */
-        t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[44];
-        t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[45];
-        t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[46];
-        t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[47];
-        if (key->rounds > 12) {
-            /* round 12: */
-            s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[48];
-            s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[49];
-            s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[50];
-            s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[51];
-            /* round 13: */
-            t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[52];
-            t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[53];
-            t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[54];
-            t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[55];
-        }
-    }
-	rk += key->rounds << 2;
-#else  /* !FULL_UNROLL */
-    /*
-     * Nr - 1 full rounds:
-     */
-    r = key->rounds >> 1;
-    for (;;) {
-        t0 =
-            Td0[(s0 >> 24)       ] ^
-            Td1[(s3 >> 16) & 0xff] ^
-            Td2[(s2 >>  8) & 0xff] ^
-            Td3[(s1      ) & 0xff] ^
-            rk[4];
-        t1 =
-            Td0[(s1 >> 24)       ] ^
-            Td1[(s0 >> 16) & 0xff] ^
-            Td2[(s3 >>  8) & 0xff] ^
-            Td3[(s2      ) & 0xff] ^
-            rk[5];
-        t2 =
-            Td0[(s2 >> 24)       ] ^
-            Td1[(s1 >> 16) & 0xff] ^
-            Td2[(s0 >>  8) & 0xff] ^
-            Td3[(s3      ) & 0xff] ^
-            rk[6];
-        t3 =
-            Td0[(s3 >> 24)       ] ^
-            Td1[(s2 >> 16) & 0xff] ^
-            Td2[(s1 >>  8) & 0xff] ^
-            Td3[(s0      ) & 0xff] ^
-            rk[7];
-
-        rk += 8;
-        if (--r == 0) {
-            break;
-        }
-
-        s0 =
-            Td0[(t0 >> 24)       ] ^
-            Td1[(t3 >> 16) & 0xff] ^
-            Td2[(t2 >>  8) & 0xff] ^
-            Td3[(t1      ) & 0xff] ^
-            rk[0];
-        s1 =
-            Td0[(t1 >> 24)       ] ^
-            Td1[(t0 >> 16) & 0xff] ^
-            Td2[(t3 >>  8) & 0xff] ^
-            Td3[(t2      ) & 0xff] ^
-            rk[1];
-        s2 =
-            Td0[(t2 >> 24)       ] ^
-            Td1[(t1 >> 16) & 0xff] ^
-            Td2[(t0 >>  8) & 0xff] ^
-            Td3[(t3      ) & 0xff] ^
-            rk[2];
-        s3 =
-            Td0[(t3 >> 24)       ] ^
-            Td1[(t2 >> 16) & 0xff] ^
-            Td2[(t1 >>  8) & 0xff] ^
-            Td3[(t0      ) & 0xff] ^
-            rk[3];
-    }
-#endif /* ?FULL_UNROLL */
-    /*
-	 * apply last round and
-	 * map cipher state to byte array block:
-	 */
-   	s0 =
-   		(Td4[(t0 >> 24)       ] << 24) ^
-   		(Td4[(t3 >> 16) & 0xff] << 16) ^
-   		(Td4[(t2 >>  8) & 0xff] <<  8) ^
-   		(Td4[(t1      ) & 0xff])       ^
-   		rk[0];
-	PUTU32(out     , s0);
-   	s1 =
-   		(Td4[(t1 >> 24)       ] << 24) ^
-   		(Td4[(t0 >> 16) & 0xff] << 16) ^
-   		(Td4[(t3 >>  8) & 0xff] <<  8) ^
-   		(Td4[(t2      ) & 0xff])       ^
-   		rk[1];
-	PUTU32(out +  4, s1);
-   	s2 =
-   		(Td4[(t2 >> 24)       ] << 24) ^
-   		(Td4[(t1 >> 16) & 0xff] << 16) ^
-   		(Td4[(t0 >>  8) & 0xff] <<  8) ^
-   		(Td4[(t3      ) & 0xff])       ^
-   		rk[2];
-	PUTU32(out +  8, s2);
-   	s3 =
-   		(Td4[(t3 >> 24)       ] << 24) ^
-   		(Td4[(t2 >> 16) & 0xff] << 16) ^
-   		(Td4[(t1 >>  8) & 0xff] <<  8) ^
-   		(Td4[(t0      ) & 0xff])       ^
-   		rk[3];
-	PUTU32(out + 12, s3);
-}
-
diff --git a/libs/krypto/blockcipher-impl.h b/libs/krypto/blockcipher-impl.h
deleted file mode 100644
index 5d7d257..0000000
--- a/libs/krypto/blockcipher-impl.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifndef _h_krypto_blockcipher_impl_
-#define _h_krypto_blockcipher_impl_
-
-/* 
- * NOTE:  Currently this is being written to support cipher blocks of
- * exactly 128 bits.  It will have to be amended if alternative block
- * sizes are need for other cipher blocks
- */
-
-#include <krypto/extern.h>
-#include <klib/defs.h>
-
-/*
- * we need to know whether we are supporting vectors as 
- * XMM type registers or as structs
- */
-#include "ncbi-priv.h"
-
-
-#ifndef USE_VEC
-#error "USE_VEC most be defined true or false"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define CIPHER_BLOCK_MAX (16)
-
-typedef char CipherBlock [CIPHER_BLOCK_MAX];
-
-#if USEVEC
-#include <v128.h>
-typedef v128_u8_t CipherVec;
-#else
-typedef struct CipherVec
-{
-    CipherBlock block;
-} CipherVec;
-#endif
-
-typedef struct KBlockCipher_vt KBlockCipher_vt;
-struct KBlockCipher_vt
-{
-    uint32_t maj;
-    uint32_t min;
-};
-
-typedef uint32_t BlockCipherType;
-enum block_cipher_type
-{
-    blockcipher_type_byte,
-    blockcipher_type_vec
-};
-
-
-typedef struct KBlockCipherByte_vt_v1 KBlockCipherByte_vt_v1;
-typedef union KBlockCipherByte KBlockCipherByte;
-
-#ifndef BLOCKCIPHER_BYTE_IMPL
-#define BLOCKCIPHER_BYTE_IMPL KBlockCipherByte
-#else
-typedef union KBlockCipherByte BLOCKCIPHER_BYTE_IMPL;
-#endif
-
-
-struct KBlockCipherByte_vt_v1
-{
-    KBlockCipher_vt version;
-
-    /* version == 1.x */
-
-    /* start minor version == 0 */
-    void        (* destroy         )(const BLOCKCIPHER_BYTE_IMPL * self);
-
-    uint32_t    (* block_size      )();
-
-    uint32_t    (* key_size        )();
-
-    rc_t        (* set_encrypt_key )(void * encrypt_key,
-                                     const char * user_key,
-                                     uint32_t user_key_bits);
-
-    rc_t        (* set_decrypt_key )(void * decrypt_key,
-                                     const char * user_key,
-                                     uint32_t user_key_bits);
-
-    void        (* encrypt         )(const CipherBlock in,
-                                     CipherBlock out,
-                                     const void * encrypt_key);
-
-    void        (* decrypt         )(const CipherBlock in,
-                                     CipherBlock out,
-                                     const void * encrypt_key);
-
-    /* end minor version == 0 */
-
-};
-
-union KBlockCipherByte
-{
-    KBlockCipher_vt        version;
-    KBlockCipherByte_vt_v1 v1;
-};
-
-
-typedef struct KBlockCipherVec_vt_v1 KBlockCipherVec_vt_v1;
-typedef union KBlockCipherVec KBlockCipherVec;
-
-#ifndef BLOCKCIPHER_VEC_IMPL
-#define BLOCKCIPHER_VEC_IMPL KBlockCipherVec
-#else
-typedef union KBlockCipherVec BLOCKCIPHER_VEC_IMPL;
-#endif
-
-
-struct KBlockCipherVec_vt_v1
-{
-    KBlockCipher_vt version;
-
-    /* version == 1.x */
-
-    /* start minor version == 0 */
-    void        (* destroy         )(const BLOCKCIPHER_VEC_IMPL * self);
-
-    uint32_t    (* block_size      )();
-
-    uint32_t    (* key_size        )();
-
-    rc_t        (* set_encrypt_key )(void * encrypt_key,
-                                     const char * user_key,
-                                     uint32_t user_key_size);
-
-    rc_t        (* set_decrypt_key )(void * decrypt_key,
-                                     const char * user_key,
-                                     uint32_t user_key_size);
-
-    CipherVec   (* encrypt         )(CipherVec block,
-                                     const void * encrypt_key);
-
-    CipherVec   (* decrypt         )(CipherVec block,
-                                     const void * decrypt_key);
-
-    /* end minor version == 0 */
-
-};
-
-union KBlockCipherVec
-{
-    KBlockCipher_vt       version;
-    KBlockCipherVec_vt_v1 v1;
-};
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-
-#endif /* _h_krypto_blockcipher_impl_ */
-
diff --git a/libs/krypto/blockcipher-priv.h b/libs/krypto/blockcipher-priv.h
deleted file mode 100644
index d812f23..0000000
--- a/libs/krypto/blockcipher-priv.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_krypto_blockcipher_priv_
-#define _h_krypto_blockcipher_priv_
-
-#include <krypto/extern.h>
-#include "cipher-impl.h"
-
-#include "blockcipher-impl.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* ======================================================================
- */
-/* typedef struct KBlockCipher KBlockCipher; */
-/*     typedef union KBlockCipher_vt KBlockCipher_vt; */
-
-/* ----------------------------------------------------------------------
- * Init
- *
- *   Initialize the fields of this object.  The derived class will call this
- *   during it's initialization.
- *
- * self      object to initialze
- * vt        the virtual table of the derived class
- * mgr       the cipher manager that is the construction factory block cipher
- *           objects hold references to the manager while the manager merely
- *           points at the block ciphers when all block ciphers are destroyed
- *           the manager loses its references and it too can be destroyed if not
- *           held elsewhere
- * name      ASCIZ c-string the name of this class
- */
-/* rc_t KBlockCipherInit (KBlockCipher * self, */
-/*                        const KBlockCipher_vt * vt, */
-/*                        const char * name); */
-
-
-typedef union KBlockCipher KBlockCipher;
-union KBlockCipher
-{
-    KBlockCipherByte byte;
-    KBlockCipherVec  vec;
-};
-
-
-rc_t KAESBlockCipherVecAesNiMake  (KBlockCipher ** vec_cipher);
-rc_t KAESBlockCipherVecRegMake    (KBlockCipher ** vec_cipher);
-rc_t KAESBlockCipherVecMake       (KBlockCipher ** vec_cipher);
-rc_t KAESBlockCipherByteMake      (KBlockCipher ** byte_cipher);
-
-rc_t KNullBlockCipherVecAesNiMake (KBlockCipher ** vec_cipher);
-rc_t KNullBlockCipherVecRegMake   (KBlockCipher ** vec_cipher);
-rc_t KNullBlockCipherVecMake      (KBlockCipher ** vec_cipher);
-rc_t KNullBlockCipherByteMake     (KBlockCipher ** byte_cipher);
-
-
-/* KRYPTO_EXTERN rc_t CC KBlockCipherAlloc (KBlockCipher ** obj, size_t z); */
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* #ifndef _h_krypto_blockcipher_priv_ */
diff --git a/libs/krypto/blockcipher.c b/libs/krypto/blockcipher.c
deleted file mode 100644
index 22539eb..0000000
--- a/libs/krypto/blockcipher.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#error "OBSOLETE do not use"
-
-
diff --git a/libs/krypto/cipher-byte.c b/libs/krypto/cipher-byte.c
deleted file mode 100644
index 49dcb07..0000000
--- a/libs/krypto/cipher-byte.c
+++ /dev/null
@@ -1,522 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-/*
- * KCipherByte is a byte oriented KCipher that can work on all processors
- * and be built with all compilers
- */
-#include <krypto/extern.h>
-#include <klib/defs.h>
-#include <krypto/cipher.h>
-
-#include "ncbi-priv.h"
-
-#include "blockcipher-impl.h"
-
-#include "cipher-impl.h"
-#include "cipher-priv.h"
-#include "blockcipher-priv.h"
-
-#include <klib/rc.h>
-
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-const char MEMBER(ClassName)[] = CLASS_STRING(CIPHER_IMPL);
-
-/* 
- * KCipher with unaligned data.  Byte alignment.
- */
-struct KCipherByte
-{
-    KCipher dad;
-
-    const KBlockCipherByte * block_cipher;
-};
-
-
-static rc_t MEMBER(Destroy) (KCipherByte * self)
-{
-    rc_t rc = 0;
-
-    if (self)
-    {
-        rc =  KCipherDestroy (&self->dad);
-        free (self);
-    }
-    return rc;
-}
-
-
-static rc_t MEMBER(SetEncryptKey) (KCipherByte * self,
-                                   const char * user_key,
-                                   uint32_t user_key_bits)
-{
-    rc_t rc = 0;
-
-    switch (self->block_cipher->version.maj)
-    {
-    default:
-        rc = RC (rcKrypto, rcCipher, rcUpdating, rcBlockCipher, rcBadVersion);
-        break;
-
-    case 1:
-        rc = self->block_cipher->v1.set_encrypt_key (self->dad.encrypt_key, user_key,
-                                                     user_key_bits);
-        break;
-    }
-    return rc;
-}
-
-
-static rc_t MEMBER(SetDecryptKey) (KCipherByte * self,
-                                   const char * user_key,
-                                   uint32_t user_key_bits)
-{
-    rc_t rc = 0;
-
-    switch (self->block_cipher->version.maj)
-    {
-    default:
-        rc = RC (rcKrypto, rcCipher, rcDestroying, rcBlockCipher, rcBadVersion);
-        break;
-
-    case 1:
-        rc = self->block_cipher->v1.set_decrypt_key (self->dad.decrypt_key, user_key,
-                                                     user_key_bits);
-        break;
-    }
-    return rc;
-}
-
-
-static rc_t MEMBER(SetEncryptIvec)(KCipherByte * self,
-                                   const void * ivec)
-{
-    assert (self);
-    assert (ivec);
-
-    memcpy (self->dad.encrypt_ivec, ivec, self->dad.block_size);
-
-    return 0;
-}
-
-
-static rc_t MEMBER(SetDecryptIvec)(KCipherByte * self,
-                                   const void * ivec)
-{
-    assert (self);
-    assert (ivec);
-
-    memcpy (self->dad.decrypt_ivec, ivec, self->dad.block_size);
-
-    return 0;
-}
-
-
-static rc_t MEMBER(SetEncryptCounterFunc)(KCipherByte * self,
-                                          cipher_ctr_func func)
-{
-    assert (self);
-    assert (func);
-
-    self->dad.encrypt_counter_func = func;
-
-    return 0;
-}
-
-
-static rc_t MEMBER(SetDecryptCounterFunc)(KCipherByte * self,
-                                          cipher_ctr_func func)
-{
-    assert (self);
-    assert (func);
-
-    self->dad.decrypt_counter_func = func;
-
-    return 0;
-}
-
-
-static rc_t MEMBER(Encrypt)(const KCipherByte * self,
-                            const void * in, void * out)
-{
-    rc_t rc = 0;
-
-    switch (self->block_cipher->version.maj)
-    {
-    default:
-        rc = RC (rcKrypto, rcCipher, rcEncoding, rcBlockCipher, rcBadVersion);
-        break;
-
-    case 1:
-        self->block_cipher->v1.encrypt (in, out, self->dad.encrypt_key);
-        break;
-    }
-    return rc;
-}
-
-
-static rc_t MEMBER(Decrypt)(const KCipherByte * self,
-                            const void * in, void * out)
-{
-    rc_t rc = 0;
-
-    switch (self->block_cipher->version.maj)
-    {
-    default:
-        rc = RC (rcKrypto, rcCipher, rcEncoding, rcBlockCipher, rcBadVersion);
-        break;
-
-    case 1:
-        self->block_cipher->v1.decrypt (in, out, self->dad.decrypt_key);
-        break;
-    }
-    return rc;
-}
-
-
-static rc_t MEMBER(EncryptEcb)(const KCipherByte * self,
-                               const void * in, void * out,
-                               uint32_t block_count)
-{
-    rc_t rc = 0;
-    const char * pin = in;
-    char * pout = out;
-
-    switch (self->block_cipher->version.maj)
-    {
-    default:
-        rc = RC (rcKrypto, rcCipher, rcEncoding, rcBlockCipher, rcBadVersion);
-        break;
-
-    case 1:
-        for (; block_count; --block_count)
-        {
-            self->block_cipher->v1.encrypt (pin, pout, self->dad.encrypt_key);
-
-            pin += self->dad.block_size;
-            pout += self->dad.block_size;
-        }
-        break;
-    }
-    return rc;
-}
-
-
-static rc_t MEMBER(DecryptEcb)(const KCipherByte * self,
-                               const void * in, void * out,
-                               uint32_t block_count)
-{
-    rc_t rc = 0;
-    const char * pin = in;
-    char * pout = out;
-
-    switch (self->block_cipher->version.maj)
-    {
-    default:
-        rc = RC (rcKrypto, rcCipher, rcEncoding, rcBlockCipher, rcBadVersion);
-        break;
-
-    case 1:
-        for (; block_count; --block_count)
-        {
-            self->block_cipher->v1.decrypt (pin, pout, self->dad.decrypt_key);
-
-            pin += self->dad.block_size;
-            pout += self->dad.block_size;
-        }
-        break;
-    }
-    return rc;
-}
-
-
-static rc_t MEMBER(EncryptCbc)(KCipherByte * self,
-                               const void * in, void * out,
-                               uint32_t block_count)
-{
-    rc_t rc = 0;
-    const char * pin = in;
-    char * pout = out;
-
-    switch (self->block_cipher->version.maj)
-    {
-    default:
-        rc = RC (rcKrypto, rcCipher, rcEncoding, rcBlockCipher, rcBadVersion);
-        break;
-
-    case 1:
-        if (block_count)
-        {
-            CipherBlock block;
-            unsigned ix;
-
-            memcpy (block, self->dad.encrypt_ivec, self->dad.block_size);
-
-            do
-            {
-                for (ix = 0; ix < self->dad.block_size; ++ix)
-                    block[ix] ^= pin[ix];
-
-                self->block_cipher->v1.encrypt (block, block,
-                                                self->dad.encrypt_key);
-
-                memcpy (pout, block, self->dad.block_size);
-
-                pin += self->dad.block_size;
-                pout += self->dad.block_size;
-
-            } while (--block_count);
-
-            memcpy (self->dad.encrypt_ivec, block, self->dad.block_size);
-        }
-        break;
-    }
-    return rc;
-}
-
-
-static rc_t MEMBER(DecryptCbc)(KCipherByte * self,
-                               const void * in, void * out,
-                               uint32_t block_count)
-{
-    rc_t rc = 0;
-    const char * pin = in;
-    char * pout = out;
-
-    switch (self->block_cipher->version.maj)
-    {
-    default:
-        rc = RC (rcKrypto, rcCipher, rcEncoding, rcBlockCipher, rcBadVersion);
-        break;
-
-    case 1:
-        if (block_count)
-        {
-            CipherBlock ivec;
-            CipherBlock block;
-            unsigned ix;
-
-            memcpy (ivec, self->dad.decrypt_ivec, self->dad.block_size);
-
-            do
-            {
-                self->block_cipher->v1.decrypt (pin, block,
-                                                self->dad.decrypt_key);
-
-                for (ix = 0; ix < self->dad.block_size; ++ix)
-                    pout[ix] = block[ix] ^ ivec[ix];
-
-                memcpy (ivec, pin, self->dad.block_size); 
-
-                pin += self->dad.block_size;
-                pout += self->dad.block_size;
-
-            } while (--block_count);
-
-            memcpy (self->dad.decrypt_ivec, ivec, self->dad.block_size);
-        }
-        break;
-    }
-    return rc;
-}
-
-
-static rc_t MEMBER(EncryptPcbc)(KCipherByte * self,
-                                const void * in, void * out,
-                                uint32_t block_count)
-{
-    return RC (rcKrypto, rcCipher, rcEncoding, rcFunction, rcUnsupported);
-}
-
-
-static rc_t MEMBER(DecryptPcbc)(KCipherByte * self,
-                                const void * in, void * out,
-                                uint32_t block_count)
-{
-    return RC (rcKrypto, rcCipher, rcEncoding, rcFunction, rcUnsupported);
-}
-
-
-static rc_t MEMBER(EncryptCfb)(KCipherByte * self,
-                               const void * in, void * out,
-                               uint32_t block_count)
-{
-    return RC (rcKrypto, rcCipher, rcEncoding, rcFunction, rcUnsupported);
-}
-
-
-static rc_t MEMBER(DecryptCfb)(KCipherByte * self,
-                               const void * in, void * out,
-                               uint32_t block_count)
-{
-    return RC (rcKrypto, rcCipher, rcEncoding, rcFunction, rcUnsupported);
-}
-
-
-static rc_t MEMBER(EncryptOfb)(KCipherByte * self,
-                               const void * in, void * out,
-                               uint32_t block_count)
-{
-    return RC (rcKrypto, rcCipher, rcEncoding, rcFunction, rcUnsupported);
-}
-
-
-static rc_t MEMBER(DecryptOfb)(KCipherByte * self,
-                               const void * in, void * out,
-                               uint32_t block_count)
-{
-    return RC (rcKrypto, rcCipher, rcEncoding, rcFunction, rcUnsupported);
-}
-
-
-static rc_t MEMBER(EncryptCtr)(KCipherByte * self,
-                               const void * in, void * out,
-                               uint32_t block_count)
-{
-    return RC (rcKrypto, rcCipher, rcEncoding, rcFunction, rcUnsupported);
-}
-
-
-static rc_t MEMBER(DecryptCtr)(KCipherByte * self,
-                               const void * in, void * out,
-                               uint32_t block_count)
-{
-    return RC (rcKrypto, rcCipher, rcEncoding, rcFunction, rcUnsupported);
-}
-
-
-static struct KCipher_vt_v1 MEMBER(_vt_v1) =
-{
-    { 1, 0 },
-
-    MEMBER(Destroy),
-    MEMBER(SetEncryptKey),
-    MEMBER(SetDecryptKey),
-    MEMBER(SetEncryptIvec),
-    MEMBER(SetDecryptIvec),
-    MEMBER(SetEncryptCounterFunc),
-    MEMBER(SetDecryptCounterFunc),
-    MEMBER(Encrypt),
-    MEMBER(Decrypt),
-    MEMBER(EncryptEcb),
-    MEMBER(DecryptEcb),
-    MEMBER(EncryptCbc),
-    MEMBER(DecryptCbc),
-    MEMBER(EncryptPcbc),
-    MEMBER(DecryptPcbc),
-    MEMBER(EncryptCfb),
-    MEMBER(DecryptCfb),
-    MEMBER(EncryptOfb),
-    MEMBER(DecryptOfb),
-    MEMBER(EncryptCtr),
-    MEMBER(DecryptCtr)
-};
-
-
-static __inline__ rc_t MEMBER(Alloc)(KCipherByte ** pobj,
-                                     const KBlockCipher * block_cipher)
-{
-    size_t block_size = block_cipher->byte.v1.block_size();
-    size_t key_size = block_cipher->byte.v1.key_size();
-    rc_t rc = 0;
-
-    *pobj = calloc (1, sizeof (**pobj) + 2 * key_size + 2 * block_size);
-    if (*pobj == NULL)
-        rc = RC (rcKrypto, rcCipher, rcConstructing, rcMemory, rcExhausted);
-
-    return rc;
-}
-
-
-static __inline__ rc_t MEMBER(Init)(KCipherByte * self,
-                                    const KBlockCipher * block_cipher)
-{
-    KCipher * dad = &self->dad;
-    size_t block_size = block_cipher->byte.v1.block_size();
-    size_t key_size = block_cipher->byte.v1.key_size();
-
-    KCipherInit (dad, (uint32_t) block_size,
-                 (const KCipher_vt*)&MEMBER(_vt_v1),
-                 MEMBER(ClassName));
-
-    dad->encrypt_key = (uint8_t *)(self + 1);
-    dad->decrypt_key = ((uint8_t *)dad->encrypt_key) + key_size;
-    dad->encrypt_ivec = ((uint8_t *)dad->decrypt_key) + key_size;
-    dad->decrypt_ivec = ((uint8_t *)dad->encrypt_ivec) + block_size;
-
-    self->block_cipher = &block_cipher->byte;
-
-    return 0;
-}
-
-
-rc_t MEMBER(Make) (KCipher ** new_obj, kcipher_type type)
-{
-    rc_t rc;
-    KBlockCipher * block_cipher;
-
-    if (new_obj == NULL)
-        return RC (rcKrypto, rcCipher, rcConstructing, rcSelf, rcNull);
-
-    *new_obj = NULL;
-
-    switch (type)
-    {
-    default:
-        return RC (rcKrypto, rcCipher, rcConstructing, rcParam, rcInvalid);
-
-    case kcipher_null:
-        rc = NULLBCMEMBER(Make)(&block_cipher);
-        break;
-
-    case kcipher_AES:
-        rc = AESBCMEMBER(Make)(&block_cipher);
-        break;
-    }
-
-    if (rc == 0)
-    {
-        KCipherByte * obj;
-
-        rc = MEMBER(Alloc)(&obj, block_cipher);
-        if (rc == 0)
-        {
-            rc = MEMBER(Init)(obj, block_cipher);
-            if (rc == 0)
-                *new_obj = &obj->dad;
-            else
-                free (obj);
-        }
-    }
-    return rc;
-}
-
-/* EOF */
diff --git a/libs/krypto/cipher-impl.h b/libs/krypto/cipher-impl.h
deleted file mode 100644
index fbccdb5..0000000
--- a/libs/krypto/cipher-impl.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_krypto_cipher_impl_
-#define _h_krypto_cipher_impl_
-
-#include <krypto/extern.h>
-#include <klib/defs.h>
-#include <klib/refcount.h>
-#include <krypto/cipher.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#ifndef CIPHER_IMPL
-#define CIPHER_IMPL KCipher
-#else
-struct CIPHER_IMPL;
-typedef struct CIPHER_IMPL CIPHER_IMPL;
-#endif
-
-typedef struct KCipher_vt KCipher_vt;
-struct KCipher_vt
-{
-    uint32_t maj;
-    uint32_t min;
-};
-
-
-typedef struct KCipher_vt_v1 KCipher_vt_v1;
-struct KCipher_vt_v1
-{
-    KCipher_vt version;
-
-    /* version == 1.x */
-    /* start minor version == 0 */
-    rc_t ( CC * destroy             )(CIPHER_IMPL * self);
-
-    rc_t ( CC * set_encrypt_key     )(CIPHER_IMPL * self,
-                                      const char * user_key,
-                                      uint32_t user_key_bits);
-
-    rc_t ( CC * set_decrypt_key     )(CIPHER_IMPL * self,
-                                      const char * user_key,
-                                      uint32_t user_key_bits);
-
-    rc_t ( CC * set_encrypt_ivec    )(CIPHER_IMPL * self,
-                                      const void * ivec);
-
-    rc_t ( CC * set_decrypt_ivec    )(CIPHER_IMPL * self,
-                                      const void * ivec);
-
-    rc_t ( CC * set_encrypt_ctr_func)(CIPHER_IMPL * self,
-                                      cipher_ctr_func enc_ctr_func);
-
-    rc_t ( CC * set_decrypt_ctr_func)(CIPHER_IMPL * self,
-                                      cipher_ctr_func enc_ctr_func);
-
-    /* single block encryption */
-    rc_t ( CC * encrypt             )(const CIPHER_IMPL * self,
-                                      const void * in,
-                                      void * out);
-    rc_t ( CC * decrypt             )(const CIPHER_IMPL * self,
-                                      const void * in,
-                                      void * out);
-
-    /* electronic code book */
-    rc_t ( CC * encrypt_ecb         )(const CIPHER_IMPL * self,
-                                      const void * in,
-                                      void * out,
-                                      uint32_t block_count);
-
-    rc_t ( CC * decrypt_ecb         )(const CIPHER_IMPL * self,
-                                      const void * in,
-                                      void * out,
-                                      uint32_t block_count);
-
-    /* cipher-block chaining */
-    rc_t ( CC * encrypt_cbc         )(CIPHER_IMPL * self,
-                                      const void * in,
-                                      void * out,
-                                      uint32_t block_count);
-    rc_t ( CC * decrypt_cbc         )(CIPHER_IMPL * self,
-                                      const void * in,
-                                      void * out,
-                                      uint32_t block_count);
-
-    /* propagating cipher-block chaining */
-    rc_t ( CC * encrypt_pcbc        )(CIPHER_IMPL * self, const void * in,
-                                      void * out, uint32_t block_count);
-    rc_t ( CC * decrypt_pcbc        )(CIPHER_IMPL * self, const void * in,
-                                      void * out, uint32_t block_count);
-
-    /* cipher feedback */
-    rc_t ( CC * encrypt_cfb         )(CIPHER_IMPL * self, const void * in,
-                                      void * out, uint32_t block_count);
-    rc_t ( CC * decrypt_cfb         )(CIPHER_IMPL * self, const void * in,
-                                      void * out, uint32_t block_count);
-
-    /* output feedback */
-    rc_t ( CC * encrypt_ofb         )(CIPHER_IMPL * self, const void * in,
-                                      void * out, uint32_t block_count);
-    rc_t ( CC * decrypt_ofb         )(CIPHER_IMPL * self, const void * in,
-                                      void * out, uint32_t block_count);
-
-    /* Counter */
-    rc_t ( CC * encrypt_ctr         )(CIPHER_IMPL * self, const void * in,
-                                      void * out, uint32_t block_count);
-    rc_t ( CC * decrypt_ctr         )(CIPHER_IMPL * self, const void * in,
-                                      void * out, uint32_t block_count);
-
-    /* end minor version == 0 */
-
-    /* ANY NEW ENTRIES MUST BE REFLECTED IN libs/krypto/cipher.c
-       BY BOTH THE CORRESPONDING MESSAGE DISPATCH FUNCTION(s) AND
-       VTABLE VALIDITY CHECKS IN CIPHERInit */
-};
-
-typedef union KCipher_ptr KCipher_ptr;
-union KCipher_ptr
-{
-    const KCipher_vt    * version;
-    const KCipher_vt_v1 * v1;
-};
-
-
-struct KCipher
-{
-    KRefcount refcount;
-    uint32_t block_size;
-    KCipher_ptr vt;
-    const char * name;
-    void * encrypt_key;
-    void * decrypt_key;
-    void * encrypt_ivec;
-    void * decrypt_ivec;
-    cipher_ctr_func encrypt_counter_func;
-    cipher_ctr_func decrypt_counter_func;
-};
-
-void KCipherInit (KCipher * self, uint32_t block_size,
-                  const KCipher_vt * vt, const char * name);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_krypto_cipher_impl_ */
diff --git a/libs/krypto/cipher-no-vec.c b/libs/krypto/cipher-no-vec.c
deleted file mode 100644
index 7e0eded..0000000
--- a/libs/krypto/cipher-no-vec.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-#include <krypto/extern.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-
-#include <krypto/ciphermgr.h>
-#include "cipher-priv.h"
-#include "ncbi-priv.h"
-
-struct KCipher;
-
-rc_t CMEMBER(Make) (struct KCipher ** new_obj, kcipher_type type)
-{
-    return RC (rcKrypto, rcCipher, rcConstructing, rcFunction, rcUnsupported);
-}
-
-
-/* EOF */
diff --git a/libs/krypto/cipher-priv.h b/libs/krypto/cipher-priv.h
deleted file mode 100644
index bcc39e5..0000000
--- a/libs/krypto/cipher-priv.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-#ifndef _h_krypto_cipher_priv_
-#define _h_krypto_cipher_priv_
-
-#include <krypto/extern.h>
-#include <krypto/ciphermgr.h>
-#include <krypto/cipher.h>
-
-#include <klib/refcount.h>
-
-/*
- * klib/rc.h ran out of room for new targets so we'll fake it for now
- * with a now unused target that will unfortunately leave some
- * confusing rc to english translations
- */
-#define rcBlockCipher rcRng
-#define rcCipher      rcRng
-
-/*
- * for use within krypto and krypto testing
- */
-
-enum e_aes_type
-{
-    kcipher_AES_core,     /* Rijndael aes_core.c portable */
-    kcipher_AES_ncbi_sim, /* clean AES written for NCBI specifically from the  */
-    kcipher_AES_ncbi_vec, /* xmm vector version version */
-    kcipher_AES_ncbi_ni,  /* 64 bit AES-NI version */
-    kcipher_AES_count
-};
-
-rc_t KCipherMake         (struct KCipher ** new_cipher,
-                          kcipher_type type);
-rc_t KCipherVecAesNiMake (struct KCipher ** new_cipher,
-                          kcipher_type type);
-rc_t KCipherVecRegMake   (struct KCipher ** new_cipher,
-                          kcipher_type type);
-rc_t KCipherVecMake      (struct KCipher ** new_cipher,
-                          kcipher_type type);
-rc_t KCipherByteMake     (struct KCipher ** new_cipher,
-                          kcipher_type type);
-
-/*
- * not for use outside krypto
- */
-rc_t KCipherDestroy (struct KCipher * self);
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* #ifndef _h_krypto_cipher_priv_ */
diff --git a/libs/krypto/cipher-vec.c b/libs/krypto/cipher-vec.c
deleted file mode 100644
index 6b61c9e..0000000
--- a/libs/krypto/cipher-vec.c
+++ /dev/null
@@ -1,808 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-#include <krypto/extern.h>
-#include <klib/defs.h>
-
-/* CIPHER_IMPL and BLOCKCIPHER_IMPL are defined in this header */
-#include "ncbi-priv.h"
-/* CIPHER_IMPL is used in this header */
-#include "cipher-impl.h"
-/* BLOCKCIPHER_IMPL is used in this header */
-#include "blockcipher-impl.h"
-
-#include "aes-ncbi-priv.h"
-#include "null-ncbi-priv.h"
-#include "cipher-priv.h"
-#include "blockcipher-priv.h"
-
-#include <krypto/cipher.h>
-#include <krypto/ciphermgr.h>
-
-#include <klib/defs.h>
-#include <klib/refcount.h>
-#include <klib/out.h>
-#include <klib/rc.h>
-
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-const char CMEMBER(ClassName)[] = CLASS_STRING(CIPHER_IMPL);
-
-
-
-struct CIPHER_IMPL
-{
-    KCipher dad;
-    const KBlockCipherVec * block_cipher;
-};
-
-typedef union CipherVec_u
-{
-    CipherVec   vec;
-    CipherBlock block;
-} CipherVec_u;
-
-/*
- * Read a blocks worth of bytes into an AESState
- */
-static __inline__ CipherVec CipherVecIn (const void * cvin)
-{
-#if USE_VEC_REG
-    register CipherVec cv;
-
-    __asm__ (
-        "movdqu (%[a]),%[s]" : [s] "=x" (cv) : [a] "D" (cvin)
-        );
-
-    return cv;
-#else
-    CipherVec_u u;
-
-    memmove (&u.block, cvin, sizeof (u));
-    return u.vec;
-#endif
-}
-
-
-
-/*
- * Write a block's worth of bytes out from an AESState
- */
-static __inline__ void CipherVecOut (const CipherVec cv, void * cvout)
-{
-#if USE_VEC_REG
-    register CipherVec rcv = cv;
-
-    __asm__ (
-        "movdqu %[s],(%[a])" : : [s] "x" (rcv), [a] "D" (cvout)
-        );
-#else
-    CipherVec lcv = cv;
-    memmove (cvout, &lcv, sizeof (lcv));
-#endif
-}
-
-
-static rc_t CMEMBER(Destroy) (CIPHER_IMPL * self)
-{
-    rc_t rc = 0;
-
-    if (self)
-    {
-        rc =  KCipherDestroy (&self->dad);
-        free (self);
-    }
-    return rc;
-}
-
-
-static rc_t CMEMBER(SetEncryptKey)(CIPHER_IMPL * self,
-                                  const char * user_key,
-                                  uint32_t user_key_bits)
-{
-    rc_t rc = 0;
-
-    assert (self);
-    assert (user_key);
-    assert (user_key_bits);
-
-    switch (self->block_cipher->version.maj)
-    {
-    default:
-        rc = RC (rcKrypto, rcCipher, rcUpdating, rcBlockCipher, rcBadVersion);
-        break;
-
-    case 1:
-        self->block_cipher->v1.set_encrypt_key (self->dad.encrypt_key, user_key,
-                                                user_key_bits);
-        break;
-    }
-    return rc;
-}
-
-
-static rc_t CMEMBER(SetDecryptKey)(CIPHER_IMPL * self,
-                                  const char * user_key,
-                                  uint32_t user_key_bits)
-{
-    rc_t rc = 0;
-
-    assert (self);
-    assert (user_key);
-    assert (user_key_bits);
-
-    switch (self->block_cipher->version.maj)
-    {
-    default:
-        rc = RC (rcKrypto, rcCipher, rcUpdating, rcBlockCipher, rcBadVersion);
-        break;
-
-    case 1:
-        self->block_cipher->v1.set_decrypt_key (self->dad.decrypt_key, user_key,
-                                                    user_key_bits);
-        break;
-    }
-    return rc;
-}
-
-
-static
-rc_t CMEMBER(SetEncryptIvec) (CIPHER_IMPL * self,
-                             const void * ivec)
-{
-    assert (self);
-    assert (ivec);
-
-    memcpy (self->dad.encrypt_ivec, ivec, self->dad.block_size);
-
-    return 0;
-}
-
-
-static
-rc_t CMEMBER(SetDecryptIvec) (CIPHER_IMPL * self,
-                             const void * ivec)
-{
-    assert (self);
-    assert (ivec);
-
-    memcpy (self->dad.decrypt_ivec, ivec, self->dad.block_size);
-
-    return 0;
-}
-
-
-static
-rc_t CMEMBER(SetEncryptCounterFunc) (CIPHER_IMPL * self,
-                                    cipher_ctr_func func)
-{
-    assert (self);
-    assert (func);
-
-    self->dad.encrypt_counter_func = func;
-
-    return 0;
-}
-
-
-static
-rc_t CMEMBER(SetDecryptCounterFunc) (CIPHER_IMPL * self,
-                                    cipher_ctr_func func)
-{
-    assert (self);
-    assert (func);
-
-    self->dad.decrypt_counter_func = func;
-
-    return 0;
-}
-
-
-static __inline__ CipherVec CMEMBER(EncryptV1)(const CIPHER_IMPL * self,
-                                              register CipherVec cv)
-{
-    return self->block_cipher->v1.encrypt (cv, self->dad.encrypt_key);
-}
-
-
-static __inline__ CipherVec  CMEMBER(DecryptV1)(const CIPHER_IMPL * self,
-                                              register CipherVec cv)
-{
-    return self->block_cipher->v1.decrypt (cv, self->dad.decrypt_key);
-}
-
-
-static __inline__ rc_t CMEMBER(EncryptV1Int)(const CIPHER_IMPL * self,
-                                            const void * in, void * out)
-{
-    CipherVec cv;
-
-    cv = CipherVecIn(in);
-    cv = CMEMBER(EncryptV1)(self, cv);
-    CipherVecOut(cv, out);
-    return 0;
-}
-
-
-static __inline__ rc_t CMEMBER(DecryptV1Int)(const CIPHER_IMPL * self,
-                                            const void * in, void * out)
-{
-    CipherVec cv;
-
-    cv = CipherVecIn(in);
-    cv = CMEMBER(DecryptV1)(self, cv);
-    CipherVecOut(cv, out);
-    return 0;
-}
-
-
-static rc_t CMEMBER(Encrypt) (const CIPHER_IMPL * self, const void * in, void * out)
-{
-    rc_t rc;
-
-    switch (self->block_cipher->version.maj)
-    {
-    default:
-        rc = RC (rcKrypto, rcCipher, rcEncoding, rcBlockCipher, rcBadVersion);
-        break;
-
-    case 1:
-        rc = CMEMBER(EncryptV1Int)(self, in, out);
-        break;
-    }
-
-    return rc;
-}
-
-
-static
-rc_t CMEMBER(Decrypt) (const CIPHER_IMPL * self, const void * in, void * out)
-{
-    rc_t rc = 0;
-
-    switch (self->block_cipher->version.maj)
-    {
-    default:
-        rc = RC (rcKrypto, rcCipher, rcEncoding, rcBlockCipher, rcBadVersion);
-        break;
-
-    case 1:
-        rc = CMEMBER(DecryptV1Int)(self, in, out);
-        break;
-    }
-
-    return rc;
-}
-
-
-/* ====================
- * longer runs of multiple blocks.
- *
- * The algorithms are well defined and standard in most cases
- *
- * These aremore or elss equivalent to class functions as they do not depend upon
- * the operation of the cipher and the algorithms are independent of anything about
- * the cipher other than its block size.
- *
- * PT: plain text block
- * CT: cipher text block
- * EK: encryption key
- * DK: decryption key (might be sthe same as EK)
- * ENC: encrypt cipher function on a block using a key
- * DEC: decrypt cipher function on a block using a key
- * IV: initialization vector - used as feedback for chaining
- * N:  number used once (nonce)
- * FB: feedback is the next IV in a chained/feedback mode
- */
-
-
-/* -----
- * NOTE:
- * 'in' can be the same as 'out' but other overlaps are dangers as a block at a
- * time is written. The code does not look for overlaps at this point.
- */
-
-/* ----------
- * Electronic Code Book - simple cipher with no chaining feedback  just iterate
- * simple encrypt/decrypt with the plain, text, cipher text and key/
- *
- * CT = ENC (PT,EK)
- * PT = DEC (CT,DK)
- */
-
-/* -----
- * NOTE: currently an implmentation detail limits us to 8192 bit cipher block
- * size.  Changing MAX_BLOCK_SIZE in cipher.c can up that limit without 
- * causing any other compatibility issues. 
- *
- * Two local byte arrays are defined on the stack of 1024 bytes or 8192 bits.
- */
-static
-rc_t CMEMBER(EncryptEcb) (const CIPHER_IMPL * self, const void * in, void * out, uint32_t block_count)
-{
-    const uint8_t * pin;
-    uint8_t * pout;
-
-    for ((pin = in), (pout = out);
-         block_count --; 
-         (pin += self->dad.block_size), (pout += self->dad.block_size))
-    {
-        CMEMBER(EncryptV1Int)(self, pin, pout);
-    }
-    return 0;
-}
-
-
-static
-rc_t CMEMBER(DecryptEcb) (const CIPHER_IMPL * self, const void * in, void * out, uint32_t block_count)
-{
-    const uint8_t * pin;
-    uint8_t * pout;
-
-    for ((pin = in), (pout = out);
-         block_count --; 
-         (pin += self->dad.block_size), (pout += self->dad.block_size))
-    {
-        CMEMBER(DecryptV1Int)(self, pin, pout);
-    }
-
-    return 0;
-}
-
-
-/* ----------
- * Cipher-Block Chaining
- * CT = (FB = ENC (PT^IV, EK))
- * PT = DEC ((FB = CT), DK)
- */
-static
-rc_t CMEMBER(EncryptCbc) (CIPHER_IMPL * self, const void * in, void * out, uint32_t block_count)
-{
-    CipherVec cv;
-    CipherVec ivec;
-    const uint8_t * pin;
-    uint8_t * pout;
-
-#if 0
-    ivec = *(const CipherVec*)self->dad.encrypt_ivec;
-#else
-    ivec = CipherVecIn (self->dad.encrypt_ivec);
-#endif
-
-    for ((pin = in), (pout = out);
-         block_count --; 
-         (pin += self->dad.block_size), (pout += self->dad.block_size))
-    {
-        cv = CipherVecIn (pin);
-        cv ^= ivec;
-        ivec = CMEMBER(EncryptV1)(self, cv);
-        CipherVecOut (ivec, pout);
-    }
-
-#if 0
-    *(CipherVec*)self->dad.encrypt_ivec = ivec;
-#else
-    CipherVecOut (ivec, self->dad.encrypt_ivec);
-#endif
-
-    return 0;
-}    
-
-
-static
-rc_t CMEMBER(DecryptCbc) (CIPHER_IMPL * self, const void * in, void * out, uint32_t block_count)
-{
-    CipherVec cv;
-    CipherVec ivec;
-    const uint8_t * pin;
-    uint8_t * pout;
-
-    ivec = CipherVecIn (self->dad.decrypt_ivec);
-
-    for ((pin = in), (pout = out);
-         block_count --; 
-         (pin += self->dad.block_size), (pout += self->dad.block_size))
-    {
-        CipherVec temp;
-
-        cv = CipherVecIn (pin);
-#if 0
-        temp = cv;
-        temp = CMEMBER(DecryptV1)(self, temp);
-#else
-        temp = CMEMBER(DecryptV1)(self, cv);
-#endif
-        temp ^= ivec;
-        CipherVecOut (temp, pout);
-        ivec = cv;
-    }
-
-    *(CipherVec*)self->dad.decrypt_ivec = ivec;
-    return 0;
-}
-
-
-/* ----------
- * Propagating cipher-block chaining
- * FB = PT ^ (CT = ENC ((PT^IV), EK))
- * FB = CT ^ (PT = DEC (CT,DK) ^ IV)
- */
-static
-rc_t CMEMBER(EncryptPcbc) (CIPHER_IMPL * self, const void * in, void * out, uint32_t block_count)
-{
-#if 1
-    CipherVec cv;
-    CipherVec ivec;
-    const uint8_t * pin;
-    uint8_t * pout;
-
-    ivec = *(const CipherVec*)self->dad.encrypt_ivec;
-
-    for ((pin = in), (pout = out);
-         block_count --; 
-         (pin += self->dad.block_size), (pout += self->dad.block_size))
-    {
-        CipherVec temp;
-
-        cv = CipherVecIn (pin);
-        temp = cv ^ ivec;
-        temp = CMEMBER(EncryptV1)(self, temp); 
-        ivec = cv ^ temp;
-        CipherVecOut (temp, pout);
-    }
-
-    *(CipherVec*)self->dad.encrypt_ivec = ivec;
-
-    return 0;
-#else
-    return RC (rcKrypto, rcCipher, rcEncoding, rcFunction, rcUnsupported);
-#endif
-}
-
-
-static
-rc_t CMEMBER(DecryptPcbc) (CIPHER_IMPL * self, const void * in, void * out, uint32_t block_count)
-{
-#if 1
-    CipherVec cv;
-    CipherVec ivec;
-    const uint8_t * pin;
-    uint8_t * pout;
-
-    ivec = *(const CipherVec*)self->dad.encrypt_ivec;
-
-    for ((pin = in), (pout = out);
-         block_count --; 
-         (pin += self->dad.block_size), (pout += self->dad.block_size))
-    {
-        CipherVec temp;
-
-        cv = CipherVecIn (pin);
-        temp = CMEMBER(DecryptV1)(self, cv);
-        ivec ^= temp;
-        CipherVecOut (temp, pout);
-    }
-
-    *(CipherVec*)self->dad.encrypt_ivec = ivec;
-
-    return 0;
-#else
-    return RC (rcKrypto, rcCipher, rcEncoding, rcFunction, rcUnsupported);
-#endif
-}
-
-
-/* ----------
- * Cipher Feedback
- * CT = (FB = PT) ^ ENC (IV, EK))
- * PT = (FB = CT) ^ DEC (IV, DK)
- */
-static
-rc_t CMEMBER(EncryptCfb) (CIPHER_IMPL * self, const void * in, void * out, uint32_t block_count)
-{
-#if 1
-    CipherVec cv;
-    CipherVec ivec;
-    const uint8_t * pin;
-    uint8_t * pout;
-
-    ivec = *(const CipherVec*)self->dad.encrypt_ivec;
-
-    for ((pin = in), (pout = out);
-         block_count --; 
-         (pin += self->dad.block_size), (pout += self->dad.block_size))
-    {
-        ivec = CMEMBER(EncryptV1)(self, ivec); 
-        cv = CipherVecIn (pin);
-        ivec ^= cv;
-        CipherVecOut (ivec, pout);
-    }
-
-    *(CipherVec*)self->dad.encrypt_ivec = ivec;
-
-    return 0;
-#else
-    return RC (rcKrypto, rcCipher, rcEncoding, rcFunction, rcUnsupported);
-#endif
-}
-
-
-static
-rc_t CMEMBER(DecryptCfb) (CIPHER_IMPL * self, const void * in, void * out, uint32_t block_count)
-{
-#if 1
-    CipherVec cv;
-    CipherVec ivec;
-    const uint8_t * pin;
-    uint8_t * pout;
-
-    ivec = *(const CipherVec*)self->dad.encrypt_ivec;
-
-    for ((pin = in), (pout = out);
-         block_count --; 
-         (pin += self->dad.block_size), (pout += self->dad.block_size))
-    {
-        cv = CMEMBER(EncryptV1)(self, ivec); 
-        ivec = CipherVecIn (pin);
-        cv ^= ivec;
-        CipherVecOut (cv, pout);
-    }
-
-    *(CipherVec*)self->dad.encrypt_ivec = ivec;
-
-    return 0;
-#else
-    return RC (rcKrypto, rcCipher, rcEncoding, rcFunction, rcUnsupported);
-#endif
-}
-
-
-/* ----------
- * Output Feedback
- * CT = PT ^ (FB = ENC (IV, EK))
- * PT = CT ^ (FB = DEC (IV, DK))
- */
-static
-rc_t CMEMBER(EncryptOfb) (CIPHER_IMPL * self, const void * in, void * out, uint32_t block_count)
-{
-#if 1
-    CipherVec cv;
-    CipherVec ivec;
-    const uint8_t * pin;
-    uint8_t * pout;
-
-    ivec = *(const CipherVec*)self->dad.encrypt_ivec;
-
-    for ((pin = in), (pout = out);
-         block_count --; 
-         (pin += self->dad.block_size), (pout += self->dad.block_size))
-    {
-        ivec = CMEMBER(EncryptV1)(self, ivec); 
-        cv = CipherVecIn (pin);
-        cv ^= ivec;
-        CipherVecOut (cv, pout);
-    }
-
-    *(CipherVec*)self->dad.encrypt_ivec = ivec;
-
-    return 0;
-#else
-    return RC (rcKrypto, rcCipher, rcEncoding, rcFunction, rcUnsupported);
-#endif
-}
-
-
-static
-rc_t CMEMBER(DecryptOfb) (CIPHER_IMPL * self, const void * in, void * out, uint32_t block_count)
-{
-    return CMEMBER(EncryptOfb)(self, in, out, block_count);
-}
-
-
-/* Counter
- * IV is a nonce and not re-used as FB
- * CT = PT ^ ENC (N, EK)
- * PT = CT ^ ENC (N, DK) 
- * Note decrypt is encrypt.
- * nonce is a function that given an iv generates the next iv
- */
-static
-rc_t CMEMBER(EncryptCtr) (CIPHER_IMPL * self, const void * in, void * out, uint32_t block_count)
-{
-    return RC (rcKrypto, rcCipher, rcEncoding, rcFunction, rcUnsupported);
-}
-
-
-static
-rc_t CMEMBER(DecryptCtr) (CIPHER_IMPL * self, const void * in, void * out, uint32_t block_count)
-{
-    return RC (rcKrypto, rcCipher, rcEncoding, rcFunction, rcUnsupported);
-}
-
-static
-struct KCipher_vt_v1 CMEMBER(_vt_v1) =
-{
-    { 1, 0 },
-
-    CMEMBER(Destroy),
-    CMEMBER(SetEncryptKey),
-    CMEMBER(SetDecryptKey),
-    CMEMBER(SetEncryptIvec),
-    CMEMBER(SetDecryptIvec),
-    CMEMBER(SetEncryptCounterFunc),
-    CMEMBER(SetDecryptCounterFunc),
-    CMEMBER(Encrypt),
-    CMEMBER(Decrypt),
-    CMEMBER(EncryptEcb),
-    CMEMBER(DecryptEcb),
-    CMEMBER(EncryptCbc),
-    CMEMBER(DecryptCbc),
-    CMEMBER(EncryptPcbc),
-    CMEMBER(DecryptPcbc),
-    CMEMBER(EncryptCfb),
-    CMEMBER(DecryptCfb),
-    CMEMBER(EncryptOfb),
-    CMEMBER(DecryptOfb),
-    CMEMBER(EncryptCtr),
-    CMEMBER(DecryptCtr)
-};
-
-
-static __inline__
-rc_t CMEMBER(AllocAes)(CIPHER_IMPL ** pobj,
-                       const KBlockCipher * block_cipher)
-{
-    CipherAes * obj;
-
-    obj = calloc (1, sizeof (*obj));
-    *pobj = (CIPHER_IMPL*)obj;
-
-    return (obj ? 0 : RC (rcKrypto, rcCipher, rcConstructing, rcMemory, rcExhausted));
-}
-
-
-static __inline__
-rc_t CMEMBER(InitAes) (CIPHER_IMPL * self,
-                      const KBlockCipher * block_cipher)
-{
-    KCipher * dad = &self->dad;
-    CipherAes * aes = (struct CipherAes*)self;
-
-    KCipherInit (dad, sizeof (CipherVec),
-                 (const KCipher_vt*)&CMEMBER(_vt_v1),
-                 CMEMBER(ClassName));
-
-    dad->encrypt_key = &aes->e_key;
-    dad->decrypt_key = &aes->d_key;
-    dad->encrypt_ivec = &aes->e_ivec;
-    dad->decrypt_ivec = &aes->d_ivec;
-
-    self->block_cipher = &block_cipher->vec;
-
-    return 0;
-}
-
-
-static __inline__
-rc_t CMEMBER(AllocNull)(CIPHER_IMPL ** pobj,
-                        const KBlockCipher * block_cipher)
-{
-    CipherNull * obj;
-
-    obj = calloc (1, sizeof (*obj));
-    *pobj = (CIPHER_IMPL*)obj;
-
-    return (obj ? 0 : RC (rcKrypto, rcCipher, rcConstructing, rcMemory, rcExhausted));
-}
-
-
-static __inline__
-rc_t CMEMBER(InitNull) (CIPHER_IMPL * self,
-                        const KBlockCipher * block_cipher)
-{
-    KCipher * dad = &self->dad;
-    CipherNull * null = (CipherNull*)self;
-
-    KCipherInit (dad, sizeof (CipherVec),
-                 (const KCipher_vt*)&CMEMBER(_vt_v1),
-                 CMEMBER(ClassName));
-
-    dad->encrypt_key = &null->e_ivec;
-    dad->decrypt_key = &null->d_ivec;
-    dad->encrypt_ivec = &null->e_ivec;
-    dad->decrypt_ivec = &null->d_ivec;
-
-    self->block_cipher = &block_cipher->vec;
-
-    return 0;
-}
-
-
-rc_t CMEMBER(Make) (KCipher ** new_obj, kcipher_type type)
-{
-    rc_t rc;
-    KBlockCipher * block_cipher;
-
-    if (new_obj == NULL)
-        return RC (rcKrypto, rcCipher, rcConstructing, rcSelf, rcNull);
-
-    *new_obj = NULL;
-
-    switch (type)
-    {
-    default:
-        return RC (rcKrypto, rcCipher, rcConstructing, rcParam, rcInvalid);
-
-    case kcipher_null:
-        rc = NULLBCMEMBER(Make)(&block_cipher);
-        break;
-
-    case kcipher_AES:
-        rc = AESBCMEMBER(Make)(&block_cipher);
-        break;
-    }
-
-    if (rc == 0)
-    {
-        CIPHER_IMPL * obj;
-
-        switch (type)
-        {
-        case kcipher_null:
-            rc = CMEMBER(AllocNull) (&obj, block_cipher);
-            if (rc == 0)
-            {
-                rc = CMEMBER(InitNull) (obj, block_cipher);
-                if (rc == 0)
-                    *new_obj = (KCipher*)obj;
-                else
-                    free (obj);
-            }
-            break;
-        case kcipher_AES:
-            rc = CMEMBER(AllocAes) (&obj, block_cipher);
-            if (rc == 0)
-            {
-                rc = CMEMBER(InitAes) (obj, block_cipher);
-                if (rc == 0)
-                    *new_obj = (KCipher*)obj;
-                else
-                    free (obj);
-            }
-        default:
-            /* can't really get here */
-            break;
-        }
-    }
-    return rc;
-}
-
-
-/* EOF */
diff --git a/libs/krypto/cipher.c b/libs/krypto/cipher.c
deleted file mode 100644
index bf7a4a3..0000000
--- a/libs/krypto/cipher.c
+++ /dev/null
@@ -1,538 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-#include <krypto/extern.h>
-#include <klib/defs.h>
-
-#include <krypto/cipher.h>
-#include <krypto/ciphermgr.h>
-#include <krypto/testciphermgr.h>
-#include "cipher-priv.h"
-#include "cipher-impl.h"
-
-#include <klib/rc.h>
-
-
-static const char KCipherClassName[] = "KCipherClassName";
-
-/* ----------------------------------------------------------------------
- * Init
- *
- *   Initialize the fields of this object.  The derived class will call this
- *   during it's initialization.
- *
- * self      object to initialze
- * vt        the virtual table of the derived class
- * mgr       the cipher manager that is the construction factory block cipher
- *           objects hold references to the manager while the manager merely
- *           points at the block ciphers when all block ciphers are destroyed
- *           the manager loses its references and it too can be destroyed if not
- *           held elsewhere
- * name      ASCIZ c-string the name of this class; pointer is expected to remain valid
- *           for the life of the object
- */
-void KCipherInit (KCipher * self,
-                  uint32_t block_size,
-                  const KCipher_vt * vt,
-                  const char * name)
-{
-    KRefcountInit (&self->refcount, 1, KCipherClassName, "init", name);
-    self->block_size = block_size;
-    self->vt.version = vt;
-    self->name = name;
-
-    /* the remaining fields have to be initialized in the derived object init */
-}
-
-
-/* ----------------------------------------------------------------------
- * Destroy
- *   base class destruction called during the derived class destruction
- *
- * self is the cipher object
- *
- * memory release is the repsonsibility of the derived class destructor
- */
-rc_t KCipherDestroy (KCipher * self)
-{
-    if (self)
-    {
-        KRefcountWhack (&self->refcount, self->name);
-    }
-    return 0;
-}
-
-/* ----------------------------------------------------------------------
- * AddRef
- *   add a new owner to this class.  This will mean another instance of 
- *   KCipher used this Block Cipher
- */
-KRYPTO_EXTERN
-rc_t CC KCipherAddRef (const KCipher * self)
-{
-    if (self)
-    {
-        switch (KRefcountAdd (&self->refcount, KCipherClassName))
-        {
-        case krefLimit:
-            return RC (rcKrypto, rcCipher, rcAttaching, rcRange, rcExcessive);
-        }
-    }
-    return 0;
-}
-
-
-/* ----------------------------------------------------------------------
- * Release
- *   
- */
-static __inline__ rc_t KCipherWhack (KCipher * self)
-{
-    switch (self->vt.version->maj)
-    {
-    case 1:
-        return self->vt.v1->destroy (self);
-    }
-    return RC (rcKrypto, rcCipher, rcDestroying, rcInterface, rcBadVersion);
-}
-
-
-KRYPTO_EXTERN
-rc_t CC KCipherRelease (const KCipher * self)
-{
-    if ( self != NULL )
-    {
-        switch (KRefcountDrop ( & self -> refcount, KCipherClassName))
-        {
-        case krefWhack:
-            return KCipherWhack ((KCipher *)self);
-
-        case krefNegative:
-            return RC ( rcKrypto, rcCipher, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/* ----------------------------------------------------------------------
- * Some Cipher Methods are really pass through methods to the block cipher
- *   
- */
-KRYPTO_EXTERN rc_t CC KCipherBlockSize (const KCipher * self, size_t * bytes)
-{
-    if (self == NULL)
-        return RC (rcKrypto, rcCipher, rcAccessing, rcSelf, rcNull);
-
-    if (bytes == NULL)
-        return RC (rcKrypto, rcCipher, rcAccessing, rcParam, rcNull);
-
-    *bytes = self->block_size;
-
-    return 0;
-}
-
-
-/* ----------------------------------------------------------------------
- * 
- *   
- */
-KRYPTO_EXTERN rc_t CC KCipherSetEncryptKey (KCipher * self, const void * user_key, size_t user_key_size)
-{
-    if (self == NULL)
-        return RC (rcKrypto, rcCipher, rcAccessing, rcSelf, rcNull);
-
-    if ((user_key == NULL)||(user_key_size == 0))
-        return RC (rcKrypto, rcCipher, rcAccessing, rcParam, rcNull);
-
-    switch (self->vt.version->maj)
-    {
-    case 1:
-        return self->vt.v1->set_encrypt_key (self, user_key, (uint32_t) user_key_size);
-    }
-    return RC (rcKrypto, rcCipher, rcUpdating, rcInterface, rcBadVersion);
-}
-
-
-/* ----------------------------------------------------------------------
- * 
- *   
- */
-KRYPTO_EXTERN rc_t CC KCipherSetDecryptKey (KCipher * self, const void * user_key, size_t user_key_size)
-{
-    if (self == NULL)
-        return RC (rcKrypto, rcCipher, rcAccessing, rcSelf, rcNull);
-
-    if ((user_key == NULL)||(user_key_size == 0))
-        return RC (rcKrypto, rcCipher, rcAccessing, rcParam, rcNull);
-
-    switch (self->vt.version->maj)
-    {
-    case 1:
-        return self->vt.v1->set_decrypt_key (self, user_key, (uint32_t) user_key_size);
-    }
-    return RC (rcKrypto, rcCipher, rcUpdating, rcInterface, rcBadVersion);
-}
-
-
-
-/* ----------------------------------------------------------------------
- *  
- *
- * Set the ivec (Initialization vector or feedback) for the cipher
- *
- * the size of ivec  must match KCipherBlockSize
- *
- * the ivec is copied into the cipher not used in place
- */
-KRYPTO_EXTERN rc_t CC KCipherSetEncryptIVec (KCipher * self, const void * ivec)
-{
-    if (self == NULL)
-        return RC (rcKrypto, rcCipher, rcAccessing, rcSelf, rcNull);
-
-    if (ivec == NULL)
-        return RC (rcKrypto, rcCipher, rcAccessing, rcParam, rcNull);
-
-    switch (self->vt.version->maj)
-    {
-    case 1:
-        return self->vt.v1->set_encrypt_ivec (self, ivec);
-    }
-    return RC (rcKrypto, rcCipher, rcUpdating, rcInterface, rcBadVersion);
-}
-
-
-/* ----------------------------------------------------------------------
- * 
- *   
- */
-KRYPTO_EXTERN rc_t CC KCipherSetDecryptIVec (KCipher * self, const void * ivec)
-{
-    if (self == NULL)
-        return RC (rcKrypto, rcCipher, rcAccessing, rcSelf, rcNull);
-
-    if (ivec == NULL)
-        return RC (rcKrypto, rcCipher, rcAccessing, rcParam, rcNull);
-
-    switch (self->vt.version->maj)
-    {
-    case 1:
-        return self->vt.v1->set_decrypt_ivec (self, ivec);
-    }
-    return RC (rcKrypto, rcCipher, rcUpdating, rcInterface, rcBadVersion);
-}
-
-
-/* ----------------------------------------------------------------------
- * 
- *   
- */
-KRYPTO_EXTERN rc_t CC KCipherSetEncryptCtrFunc (KCipher * self, cipher_ctr_func func)
-{
-    if (self == NULL)
-        return RC (rcKrypto, rcCipher, rcAccessing, rcSelf, rcNull);
-
-    if (func == NULL)
-        return RC (rcKrypto, rcCipher, rcAccessing, rcParam, rcNull);
-
-    switch (self->vt.version->maj)
-    {
-    case 1:
-        return self->vt.v1->set_encrypt_ctr_func (self, func);
-    }
-    return RC (rcKrypto, rcCipher, rcUpdating, rcInterface, rcBadVersion);
-}
-
-
-/* ----------------------------------------------------------------------
- * 
- *   
- */
-KRYPTO_EXTERN rc_t CC KCipherSetDecryptCtrFunc (KCipher * self, cipher_ctr_func func)
-{
-    if (self == NULL)
-        return RC (rcKrypto, rcCipher, rcAccessing, rcSelf, rcNull);
-
-    if (func == NULL)
-        return RC (rcKrypto, rcCipher, rcAccessing, rcParam, rcNull);
-
-    switch (self->vt.version->maj)
-    {
-    case 1:
-        return self->vt.v1->set_decrypt_ctr_func (self, func);
-    }
-    return RC (rcKrypto, rcCipher, rcUpdating, rcInterface, rcBadVersion);
-}
-
-
-KRYPTO_EXTERN rc_t CC KCipherEncrypt (KCipher * self, const void * in, void * out)
-{
-    if (self == NULL)
-        return RC (rcKrypto, rcCipher, rcEncoding, rcSelf, rcNull);
-
-    if ((in == NULL) || (out == NULL))
-        return RC (rcKrypto, rcCipher, rcEncoding, rcParam, rcNull);
-
-    switch (self->vt.version->maj)
-    {
-    case 1:
-        return self->vt.v1->encrypt (self, in, out);
-    }
-    return RC (rcKrypto, rcCipher, rcAccessing, rcInterface, rcBadVersion);
-}
-
-
-KRYPTO_EXTERN rc_t CC KCipherDecrypt (KCipher * self, const void * in, void * out)
-{
-    if (self == NULL)
-        return RC (rcKrypto, rcCipher, rcEncoding, rcSelf, rcNull);
-
-    if ((in == NULL) || (out == NULL))
-        return RC (rcKrypto, rcCipher, rcEncoding, rcParam, rcNull);
-
-    switch (self->vt.version->maj)
-    {
-    case 1:
-        return self->vt.v1->decrypt (self, in, out);
-    }
-    return RC (rcKrypto, rcCipher, rcAccessing, rcInterface, rcBadVersion);
-}
-
-
-/* ====================
- * longer runs of multiple blocks.
- *
- * The algorithms are well defined and standard in most cases
- *
- * These aremore or elss equivalent to class functions as they do not depend upon
- * the operation of the cipher and the algorithms are independent of anything about
- * the cipher other than its block size.
- *
- * PT: plain text block
- * CT: cipher text block
- * EK: encryption key
- * DK: decryption key (might be sthe same as EK)
- * ENC: encrypt cipher function on a block using a key
- * DEC: decrypt cipher function on a block using a key
- * IV: initialization vector - used as feedback for chaining
- * N:  number used once (nonce)
- * FB: feedback is the next IV in a chained/feedback mode
- */
-
-/* -----
- * NOTE:
- * 'in' can be the same as 'out' but other overlaps are dangers as a block at a
- * time is written. The code does not look for overlaps at this point.
- *
- * NOTE: currently an implementation detail limits us to 8192 bit cipher block
- * size.  Changing MAX_BLOCK_SIZE in cipher.c can up that limit without 
- * causing any other compatibility issues. 
- *
- * Two local byte arrays are defined on the stack of 1024 bytes or 8192 bits.
- */
-/*
- * NOTE: if in and out overlap incorrectly this will fail
- */
-#define BLOCK_FUNC_PASTE(A,B) A##B
-#define BLOCK_FUNC(MODE,METHOD) \
-    KRYPTO_EXTERN rc_t CC BLOCK_FUNC_PASTE(KCipher,MODE)                \
-        (KCipher * self, const void * in, void * out,                   \
-         uint32_t block_count)                                          \
-    {                                                                   \
-        rc_t rc;                                                        \
-                                                                        \
-        if (self == NULL)                                               \
-            rc = RC (rcKrypto, rcCipher, rcEncoding, rcSelf, rcNull);   \
-                                                                        \
-        else if (in == NULL)                                            \
-            rc = RC (rcKrypto, rcCipher, rcEncoding, rcParam, rcNull);  \
-                                                                        \
-        else if (out == NULL)                                           \
-            rc = RC (rcKrypto, rcCipher, rcEncoding, rcParam, rcNull);  \
-                                                                        \
-        else if (block_count == 0)                                      \
-            rc = 0;                                                     \
-                                                                        \
-        else                                                            \
-        {                                                               \
-            switch (self->vt.version->maj)                              \
-            {                                                           \
-            case 1:                                                     \
-                return self->vt.v1->METHOD(self, in, out, block_count); \
-            }                                                           \
-            rc = RC (rcKrypto, rcCipher, rcAccessing, rcInterface,      \
-                     rcBadVersion);                                     \
-        }                                                               \
-                                                                        \
-        return rc;                                                      \
-    }
-
-/* ----------
- * Electronic Code Book - simple cipher with no chaining feedback  just iterate
- * simple encrypt/decrypt with the plain, text, cipher text and key/
- *
- * CT = ENC (PT,EK)
- * PT = DEC (CT,DK)
- */
-BLOCK_FUNC(EncryptECB,encrypt_ecb)
-BLOCK_FUNC(DecryptECB,decrypt_ecb)
-
-/* ----------
- * Cipher-Block Chaining
- * CT = (FB = ENC (PT^IV, EK))
- * PT = DEC ((FB = CT), DK)
- */
-BLOCK_FUNC(EncryptCBC,encrypt_cbc)
-BLOCK_FUNC(DecryptCBC,decrypt_cbc)
-
-/* ----------
- * Propagating cipher-block chaining
- * FB = PT ^ (CT = ENC ((PT^IV), EK))
- * FB = CT ^ (PT = DEC (CT,DK) ^ IV)
- */
-BLOCK_FUNC(EncryptPCBC,encrypt_pcbc)
-BLOCK_FUNC(DecryptPCBC,decrypt_pcbc)
-
-/* ----------
- * Cipher Feedback
- * CT = (FB = PT) ^ ENC (IV, EK))
- * PT = (FB = CT) ^ DEC (IV, DK)
- */
-BLOCK_FUNC(EncryptCFB,encrypt_cfb)
-BLOCK_FUNC(DecryptCFB,decrypt_cfb)
-
-/* ----------
- * Output Feedback
- * CT = PT ^ (FB = ENC (IV, EK))
- * PT = CT ^ (FB = DEC (IV, DK))
- */
-BLOCK_FUNC(EncryptOFB,encrypt_ofb)
-BLOCK_FUNC(DecryptOFB,decrypt_ofb)
-
-/* Counter
- * IV is a nonce and not re-used as FB
- * CT = PT ^ ENC (N, EK)
- * PT = CT ^ ENC (N, DK) 
- *
- * The enc_ctr_func (or dec_ctr_func) will be called to update the ivec before
- * to be the nonce (number used once) before each call to the block cipher 
- * encrypt function.  The encrypt function is used for decryption mode as well
- */
-BLOCK_FUNC(EncryptCTR,encrypt_ctr)
-BLOCK_FUNC(DecryptCTR,decrypt_ctr)
-
-
-#ifndef USE_SLOW_ONES
-#define USE_SLOW_ONES 0
-#endif
-rc_t KCipherMakeInt (KCipher ** new_cipher, kcipher_type type)
-{
-    rc_t rc;
-
-    *new_cipher = NULL;
-
-#if 0
-    rc = KCipherVecAesNiMake (new_cipher, type);
-    if (rc)
-    {
-        if (GetRCState(rc) == rcUnsupported)
-        {
-#if USE_SLOW_ONES
-            rc = KCipherVecRegMake (new_cipher, type);
-            if (rc)
-            {
-                if (GetRCState(rc) == rcUnsupported)
-                {
-                    rc = KCipherVecMake (new_cipher, type);
-                    if (GetRCState(rc) == rcUnsupported)
-                    {
-#endif
-#endif
-                        rc = KCipherByteMake (new_cipher, type);
-#if 0
-#if USE_SLOW_ONES
-                    }
-                }
-            }
-#endif
-        }
-    }
-#endif
-    return rc;
-}
-
-kcipher_subtype KCipherSubType = ksubcipher_none;
-
-rc_t KCipherMake (KCipher ** new_cipher, kcipher_type type)
-{
-    rc_t rc;
-
-    if (new_cipher == NULL)
-        rc = RC (rcKrypto, rcCipher, rcConstructing, rcSelf, rcNull);
-
-    else
-    {
-        switch (type)
-        {
-        case kcipher_null:
-        case kcipher_AES:
-            switch (KCipherSubType)
-            {
-            case ksubcipher_byte:
-                rc = KCipherByteMake (new_cipher, type);
-                break;
-#ifdef USEVEC
-            case ksubcipher_vec:
-                rc = KCipherVecMake (new_cipher, type);
-                break;
-#endif
-#ifdef USEVECREG
-            case ksubcipher_vecreg:
-                rc = KCipherVecRegMake (new_cipher, type);
-                break;
-#endif
-#ifdef USEAESNI
-            case ksubcipher_accelerated:
-                rc = KCipherVecAesNiMake (new_cipher, type);
-                break;
-#endif
-            default:
-                rc = KCipherMakeInt (new_cipher, type);
-                break;
-            }
-            break;
-        default:
-            rc = RC (rcKrypto, rcCipher, rcConstructing, rcBlockCipher, rcInvalid);
-            break;
-        }
-    }
-    return rc;
-}
-
-
-
-
-
-
-/* EOF */
diff --git a/libs/krypto/ciphermgr.c b/libs/krypto/ciphermgr.c
deleted file mode 100644
index 25e0b1a..0000000
--- a/libs/krypto/ciphermgr.c
+++ /dev/null
@@ -1,295 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#define USE_AES_NI false
-
-#include <krypto/extern.h>
-#include <krypto/ciphermgr.h>
-#include <krypto/cipher.h>
-
-#include "cipher-priv.h"
-
-#include <kproc/lock.h>
-
-#include <klib/rc.h>
-#include <klib/refcount.h>
-#include <klib/debug.h>
-
-#include <sysalloc.h>
-
-#include <atomic.h>
-
-#include <stdlib.h>
-#include <assert.h>
-
-#ifdef _DEBUGGING
-#define MGR_DEBUG(msg) DBGMSG(DBG_KFS,DBG_FLAG(DBG_KFS_MGR), msg)
-#else
-#define MGR_DEBUG(msg)
-#endif
-
-
-
-static const char kciphermanager_classname [] = "KCipherManager";
-
-
-/*--------------------------------------------------------------------------
- * KCipherManager
- */
-/* currently expected to be a singleton and not use a vtable but
- * be fully fleshed out here */
-static 
-KCipherManager * singleton = NULL;
-
-
-struct KCipherManager
-{
-    KRefcount refcount;
-
-    KLock * lock;
-
-};
-
-
-static
-rc_t KCipherManagerAlloc (KCipherManager ** ppobj)
-{
-    KCipherManager * pobj;
-
-    assert (ppobj);
-
-    pobj = calloc (sizeof *pobj, 1);
-    if (pobj)
-    {
-        *ppobj = pobj;
-        return 0;
-    }
-
-    *ppobj = NULL;
-    return RC (rcKrypto, rcMgr, rcConstructing, rcMemory, rcExhausted);
-}
-
-
-static
-rc_t KCipherManagerInit (KCipherManager * self)
-{
-    rc_t rc;
-
-    rc = KLockMake (&self->lock);
-    if (rc == 0)
-    {
-        KRefcountInit (&self->refcount, 1, kciphermanager_classname, "init",
-                       "singleton");
-    }
-
-    return rc;
-}
-
-
-/* Destroy
- *  destroy
- */
-LIB_EXPORT rc_t CC KCipherManagerDestroy ( KCipherManager *self )
-{
-    rc_t rc = 0;
-
-    if ( self == NULL )
-        rc = RC ( rcKrypto, rcMgr, rcDestroying, rcSelf, rcNull );
-    else
-    {
-        if (self == singleton)
-        {
-            KCipherManager * reread;
-
-            reread = atomic_test_and_set_ptr ((void*volatile*)&singleton, NULL, self);
-
-            /* ignore results: just going for guaranteed atomicity though might not need it */
-        }
-
-        /* no return value */
-        KRefcountWhack (&self->refcount, kciphermanager_classname);
-
-        rc = KLockRelease (self->lock);
-
-        free (self);
-    }
-    return rc;
-}
-
-
-/* AddRef
- *  creates a new reference
- *  ignores NULL references
- */
-LIB_EXPORT rc_t CC KCipherManagerAddRef ( const KCipherManager *self )
-{
-    if (self != NULL)
-    {
-        switch (KRefcountAdd (&self->refcount, kciphermanager_classname))
-        {
-        case krefOkay:
-            break;
-        case krefZero:
-            return RC (rcFS, rcMgr, rcAttaching, rcRefcount, rcIncorrect);
-        case krefLimit:
-            return RC (rcFS, rcMgr, rcAttaching, rcRefcount, rcExhausted);
-        case krefNegative:
-            return RC (rcFS, rcMgr, rcAttaching, rcRefcount, rcInvalid);
-        default:
-            return RC (rcFS, rcMgr, rcAttaching, rcRefcount, rcUnknown);
-        }
-    }
-    return 0;
-}
-
-
-/* Release
- *  discard reference to manager
- *  ignores NULL references
- */
-LIB_EXPORT rc_t CC KCipherManagerRelease ( const KCipherManager *self )
-{
-    rc_t rc = 0;
-    if (self != NULL)
-    {
-        switch (KRefcountDrop (&self->refcount, kciphermanager_classname))
-        {
-        case krefOkay:
-        case krefZero:
-            break;
-        case krefWhack:
-            rc = KCipherManagerDestroy ((KCipherManager*)self);
-            break;
-        case krefNegative:
-            return RC (rcFS, rcMgr, rcAttaching, rcRefcount, rcInvalid);
-        default:
-            rc = RC (rcFS, rcMgr, rcAttaching, rcRefcount, rcUnknown);
-            break;            
-        }
-    }
-    return rc;
-}
-
-
-/* Make
- *  we have a shared singleton for the cipher manager
- *  first call actually makes the managerblo
- *  subsequent calls get added references
- */
-LIB_EXPORT rc_t CC KCipherManagerMake (KCipherManager ** mgr)
-{
-    rc_t rc = 0;
-
-    if (mgr == NULL)
-        return RC (rcKrypto, rcMgr, rcConstructing, rcSelf, rcNull);
-
-    *mgr = NULL;
-
-make_race_retry:
-
-    if (singleton)
-    {
-        rc = KCipherManagerAddRef (singleton);
-        if (rc == 0)
-        {
-            *mgr = singleton;
-            return 0;
-        }
-    }
-    else
-    {
-        KCipherManager * self;
-
-        rc = KCipherManagerAlloc (&self);
-        if (rc == 0)
-        {
-            rc = KCipherManagerInit (self);
-            if (rc == 0)
-            {
-                KCipherManager * reread;
-
-                reread = atomic_test_and_set_ptr ((void*volatile*)&singleton, self, NULL);
-
-                if (reread)
-                {
-                    KCipherManagerDestroy (self);
-                    goto make_race_retry;
-                }
-
-                *mgr = self;
-                return 0;
-            }
-            else
-            {
-                KCipherManagerDestroy (self);
-            }
-        }
-    }
-    return rc;
-}
-
-
-static __inline__
-rc_t KCipherManagerMakeCipherInt (const KCipherManager *self,
-                                  KCipher ** pcipher,
-                                  kcipher_type type)
-{
-    KCipher * pc;
-    rc_t rc;
-
-    assert (self);
-    assert (pcipher);
-
-    rc = KCipherMake (&pc, type);
-
-    *pcipher = rc ? NULL : pc;
-
-    return rc;
-}
-
-
-LIB_EXPORT
-rc_t CC KCipherManagerMakeCipher (const KCipherManager * self,
-                                  struct KCipher ** pcipher,
-                                  kcipher_type type)
-{
-    rc_t rc;
-    
-    if (self == NULL)
-        return RC (rcKrypto, rcMgr, rcConstructing, rcSelf, rcNull);
-
-    if (pcipher == NULL)
-        return RC (rcKrypto, rcMgr, rcConstructing, rcParam, rcNull);
-
-    *pcipher = NULL;
-
-    rc = KCipherManagerMakeCipherInt (self, pcipher, type);
-
-    return rc;
-}
-
-
-
diff --git a/libs/krypto/compile-test.c b/libs/krypto/compile-test.c
deleted file mode 100644
index 1d3de7a..0000000
--- a/libs/krypto/compile-test.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-
-#include <cpuid.h>
-#include <v128.h>
-
-#include "ncbi-priv.h"
-#include "blockcipher-impl.h"
-
-
-
-const
-CipherVec CMEMBER(test) (void)
-{
-#if USEVEC
-    CipherVec zero  =  { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-    CipherVec one   =  { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-                         0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 };
-#else
-    CipherVec zero  =  { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-    CipherVec one   =  { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-                         0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 };
-#endif
-    return zero + one;
-}
diff --git a/libs/krypto/csprng.c b/libs/krypto/csprng.c
deleted file mode 100644
index 4ee747b..0000000
--- a/libs/krypto/csprng.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-
-#include <krypto/extern.h>
-
-#include <krypto/rng.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <klib/refcount.h>
-
-#include <sysalloc.h>
-
-#include <openssl/rand.h>
-
-#include <string.h>
-#include <stdlib.h>
-#include <assert.h>
-
-typedef KRng KCSPRng;
-
-#define KRNG_IMPL KCSPRng
-#include <krypto/rng-impl.h>
-
-
-
-static
-rc_t CC KCSPRngDestroy (KCSPRng * self)
-{
-    free (self);
-    return 0;
-}
-
-static
-rc_t CC KCSPRngSeed (KRng * self)
-{
-    rc_t rc;
-    uint8_t buff [16];
-
-    if (self == NULL)
-        return RC (rcKrypto, rcRng, rcWriting, rcSelf, rcNull);
-
-    /* get some system entropy */
-    rc = KRngSysEntropy (self, buff, sizeof (buff));
-    if (rc)
-        return rc;
-
-    RAND_seed (buff, sizeof (buff));
-
-    return 0;
-}
-
-static
-rc_t CC KCSPRngReseed (KRng * self, const void * buffer_, 
-                       size_t buff_size)
-{
-    const char * buffer;
-    rc_t rc;
-    int32_t ix;
-    uint8_t buff [256];
-
-    if (self == NULL)
-        return RC (rcKrypto, rcRng, rcUpdating, rcSelf, rcNull);
-
-    if (((buffer = buffer_) == NULL) && (buff_size != 0))
-        return RC (rcKrypto, rcRng, rcUpdating, rcParam, rcNull);
-
-    rc = KRngSysEntropy (self, buff, 16);
-    if (rc)
-        return rc;
-
-    if (buffer)
-        for (ix = (buff_size + sizeof (buff) - 1)/sizeof (buff);
-             ix > 0; 
-             (ix -= sizeof (buff)),
-                 (buff_size -= sizeof(buff)),
-                 (buffer += sizeof (buff)))
-        {
-            int32_t jx = (buff_size>sizeof (buff))?sizeof(buff):buff_size;
-            while (--jx > 0)
-                buff[jx] ^= buffer[jx];
-        }
-
-    RAND_add (buffer, buff_size, 1); /* what is that entropy supposed to do? */
-
-    return 0;
-}
-
-static
-rc_t CC KCSPRngRead (const KCSPRng * self, void * buffer, uint32_t bsize, uint32_t * num_read)
-{
-    int ret;
-
-    ret = RAND_bytes (buffer, bsize);
-    if (ret == -1)
-    {
-        *num_read = 0;
-        return RC (rcKrypto, rcRng, rcReading, rcSelf, rcInsufficient);
-    }
-    *num_read = bsize;
-    return 0;
-}
-
-static const
-KRng_vt_v1 vt = 
-{
-    1, 0,
-
-    /* start minor version == 0 */
-    KCSPRngDestroy,
-    KCSPRngSeed,
-    KCSPRngReseed,
-    KCSPRngRead
-    /* end minor version == 0 */
-};
-    
-LIB_EXPORT rc_t CC KCSPRngMake (KRng ** pself)
-{
-    KCSPRng * self;
-    rc_t rc;
-
-    if (pself == NULL)
-        return RC (rcRuntime, 0, rcConstructing, rcSelf, rcNull);
-    else
-    {
-        *pself = NULL;
-
-        self = malloc (sizeof (*self));
-        if (self == NULL)
-            return RC (rcRuntime, 0, rcConstructing, rcMemory, rcExhausted);
-
-        else
-        {
-            rc = KRngInit (self, (union KRng_vt*)&vt, "KCSPRng");
-            *pself = self;
-            return 0;
-        }
-    }
-    return rc;
-}
diff --git a/libs/krypto/encfile-priv.h b/libs/krypto/encfile-priv.h
deleted file mode 100644
index 9456b5a..0000000
--- a/libs/krypto/encfile-priv.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-#ifndef _h_krypto_encfile_priv_libs_
-#define _h_krypto_encfile_priv_libs_
-
-#ifdef  __cplusplus
-extern "C" {
-#endif
-
-/* ----------------------------------------------------------------------
- * Offset conversions between encrypted file offset, decrypted file offset
- * and block ID and block offset
- */
-
-/* -----
- * A data block within the encrypted file may not divide nicely by the size of
- * its greatest alignment issue. That is there is currently a uint64_t within 
- * the KEncFileKey forcing 8-byte alignment by default but the whole of the
- * size of KEncFileKey plus the size of the KEncFileData plus the size of
- * the KEncFileCRC is not divisible by 8 so it can't be treated as a single 
- * structure for the puroses of using the sizeof() operator.
- *
- * If the size of the header, block or footer are modified in the future
- * care should be take to retain accuracy of the new versions of these
- * functions.
- */
-
-static __inline__ uint64_t BlockId_to_EncryptedPos (uint64_t block_id)
-{
-    /* the whole block structure is not divisible by 8
-     * so this is not a simple multiply by the sizeof KEncFileBlock
-     */
-    return (sizeof (KEncFileHeader) + block_id * sizeof (KEncFileBlock));
-}
-
-
-static __inline__ uint64_t BlockId_to_DecryptedPos (uint64_t block_id)
-{
-    /* the simplest conversion as its a simple multiply */
-    return (block_id * sizeof (KEncFileData));
-}
-
-
-/* -----
- * when converting from file offsets to block ids we effectively have a
- * quotient and a remainder.  The block id is the quotient and the
- * offset within the block is the remainder.  We use lldiv not ldiv as we
- * are required to work on both 32 and 64 bit machines where long might
- * be 32 bits or it might be 64 bits.  If long long is 128 we willingly
- * sacrifice efficiency for accuracy.
- */
-static __inline__
-uint64_t DecryptedPos_to_BlockId (uint64_t dec_offset, uint32_t * poffset)
-{
-    if (poffset)
-        *poffset = dec_offset % sizeof (KEncFileData);
-    return dec_offset / sizeof (KEncFileData);
-}
-
-static __inline__
-uint64_t EncryptedPos_to_BlockId (uint64_t enc_offset, uint32_t * poffset,
-                                     bool * in_block)
-{
-    uint64_t block_id;
-
-    if (enc_offset < sizeof (KEncFileHeader))
-    {
-        if (poffset)
-            *poffset = 0;
-        if (in_block)
-            *in_block = false;
-        block_id = 0;
-    }
-    else
-    {
-        uint64_t offset;
-
-        enc_offset -= sizeof (KEncFileHeader);
-        block_id = enc_offset / sizeof (KEncFileBlock);
-        offset = enc_offset % sizeof (KEncFileBlock);
-
-        if (offset <= sizeof(KEncFileKey))
-        {
-            if (poffset)
-                *poffset = 0;
-            if (in_block)
-                *in_block = false;
-        }
-        else
-        {
-            offset -= sizeof(KEncFileKey);
-
-            if (offset >= sizeof(KEncFileData))
-            {
-                if (poffset)
-                    *poffset = 0;
-                if (in_block)
-                    *in_block = false;
-            }
-            else
-            {
-                if (poffset)
-                    *poffset = (uint32_t)offset;
-                if (in_block)
-                    *in_block = true;
-            }
-        }
-    }
-    return block_id;
-}
-
-struct KFile;
-struct KKey;
-
-KRYPTO_EXTERN rc_t CC KEncFileWriteHeader (struct KFile * self);
-KRYPTO_EXTERN rc_t CC KEncFileWriteHeader_v1 (struct KFile * self);
-KRYPTO_EXTERN rc_t CC KEncFileWriteHeader_v2 (struct KFile * self);
-KRYPTO_EXTERN rc_t CC KEncFileMakeWriteBlock (struct KFile ** pself, 
-                                              struct KFile * encrypted,
-                                              const struct KKey * key);
-
-KRYPTO_EXTERN rc_t CC KEncFileMakeBlock_v2 (struct KFile ** pself,
-                                         struct KFile * encrypted,
-                                         const struct KKey * key);
-
-
-#if 0
-#if USE_UPDATE_V1
-#define KEncFileWriteHeader KEncFileWriteHeader_v1
-#else
-#define KEncFileWriteHeader KEncFileWriteHeader_v2
-#endif
-#endif
-
-#ifdef  __cplusplus
-}
-#endif
-
-#endif /* #ifndef _h_krypto_encfile_priv_libs_ */
-
-
diff --git a/libs/krypto/encfile.c b/libs/krypto/encfile.c
deleted file mode 100644
index 2755fca..0000000
--- a/libs/krypto/encfile.c
+++ /dev/null
@@ -1,2122 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-#include <krypto/extern.h>
-#include <krypto/encfile.h>
-#include <krypto/encfile-priv.h>
-#include <krypto/key.h>
-#include <krypto/ciphermgr.h>
-#include <krypto/cipher.h>
-#include "aes-priv.h"
-#include "encfile-priv.h"
-
-#include <klib/rc.h>
-#include <klib/checksum.h>
-#include <klib/log.h>
-#include <klib/out.h>
-#include <klib/debug.h>
-#include <klib/vector.h>
-#include <klib/status.h>
-#include <kfs/file.h>
-
-#include <sysalloc.h>
-
-#include <byteswap.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-#include <klib/out.h>
-
-#define USE_READ_V1     false
-#define USE_WRITE_V1    false
-#define USE_UPDATE_V1   false
-#define USE_BLOCK_V1    false
-/* KReencFile and KEncryptFile need to use update v1 as it is different */
-#define USE_VALIDATE_V1 false
-#define USE_ISENC_V1    false
-
-#define ENABLE_V2 true
-
-
-/* ----------------------------------------------------------------------
- * KEncFileV1
- *   Base object class for the encryption, decryption and validation of
- *   the file format defined above
- */
-typedef struct KEncFileV1  KEncFileV1;
-#define KFILE_IMPL struct KEncFileV1
-#include <kfs/impl.h>
-
-
-#include "encfile-priv.h"
-
-/* ----------
- * BufferCalcMD5
- *    Generate the MD5 digest for a buffer
- */
-static
-void BufferCalcMD5 (const void * buffer, size_t size, uint8_t digest [16])
-{
-    MD5State state;
-
-    assert (buffer);
-    assert (size);
-    assert (digest);
-
-    MD5StateInit (&state);
-    MD5StateAppend (&state, buffer, size);
-    MD5StateFinish (&state, digest);
-}
-
-#if 0
-/* ----------------------------------------------------------------------
- * Offset conversions between encrypted file offset, decrypted file offset
- * and block ID and block offset
- */
-
-/* -----
- * A data block within the encrypted file may not divide nicely by the size of
- * its greatest alignment issue. That is there is currently a uint64_t within 
- * the KEncFileKey forcing 8-byte alignment by default but the whole of the
- * size of KEncFileKey plus the sizze of the KEncFileData plus the size of
- * the KEncFileCRC is not divisible by 8 so it can't be treated as a single 
- * structure for the puroses of using the sizeof() operator.
- *
- * If the size of the header, block or footer are modified in the future
- * care should be take to retain accuracy of the new versions of these
- * functions.
- */
-
-static __inline__ uint64_t BlockId_to_EncryptedPos (uint64_t block_id)
-{
-    /* the whole block structure is not divisible by 8
-     * so this is not a simple multiply by the sizeof KEncFileBlock
-     */
-    return (sizeof (KEncFileHeader) + block_id * sizeof (KEncFileBlock));
-}
-
-
-static __inline__ uint64_t BlockId_to_DecryptedPos (uint64_t block_id)
-{
-    /* the simplest conversion as its a simple multiply */
-    return (block_id * sizeof (KEncFileData));
-}
-
-
-/* -----
- * when converting from file offsets to block ids we effectively have a
- * quotient and a remainder.  The block id is the quotient and the
- * offset within the block is the remainder.  We use lldiv not ldiv as we
- * are required to work on both 32 and 64 bit machines where long might
- * be 32 bits or it might be 64 bits.  If long long is 128 we willingly
- * sacrifice efficiency for accuracy.
- */
-static __inline__
-uint64_t DecryptedPos_to_BlockId (uint64_t dec_offset, uint32_t * poffset)
-{
-    if (poffset)
-        *poffset = dec_offset % sizeof (KEncFileData);
-    return dec_offset / sizeof (KEncFileData);
-}
-
-/* not so easy - fix this if needed... */
-#if 0
-static
-uint64_t EncryptedPos_to_BlockId (uint64_t enc_offset, uint32_t * poffset)
-{
-    uint64_t block_id;
-
-    if (enc_offset < sizeof (KEncFileHeader))
-    {
-        if (poffset)
-            *poffset = 0;
-        block_id = 0;
-    }
-    else
-    {
-        uint64_t offset;
-
-        enc_offset -= sizeof (KEncFileHeader);
-        block_id = enc_offset / sizeof (KEncFileBlock);
-        offset = enc_offset % sizeof (KEncFileBlock);
-
-        if (offset <= sizeof(KEncFileKey))
-            offset = 0;
-        else
-        {
-            offset -= sizeof(KEncFileKey);
-
-            if (offset >= sizeof(KEncFileData))
-            {
-                ++block_id;
-                offset = 0;
-            }
-        }
-
-        if (poffset)
-            *poffset = offset;
-    }
-    return block_id;
-}
-#endif
-#endif
-
-typedef struct KEncFileCiphers KEncFileCiphers;
-struct KEncFileCiphers
-{
-    KCipher * master;
-    KCipher * block;
-};
-
-typedef uint8_t KEncFileIVec [16];
-/* -----
- */
-struct KEncFileV1
-{
-    KFile dad;                  /* base class */
-    KFile * encrypted;          /* encrypted file as a KFile */
-    KEncFileCiphers ciphers;
-    KEncFileBlock block;        /* */
-    uint64_t encrypted_max;     /* highest read/written point in the encrypted file */
-    KEncFileFooter foot;        /* contains rcrchecksum and blockcount */
-#if ENABLE_V2
-    KEncFileVersion version;
-#endif
-    bool dirty;                 /* data written but not flushed */
-    bool bswap;
-    bool eof;
-    bool seekable;
-    bool written;
-    bool swarm;
-};
-
-
-/* ----------------------------------------------------------------------
- * Buffer - just some part of the encrypted file read or written
- *
- *   these functions exist to hide the potential multiple calls needed
- *   if the KFileRead or KFileWrite called on the encrypted file break up
- *   the requested amount into partial reads or writes
- */
-
-/* ----------
- * BufferRead
- *    Fill a buffer with a requested number of bytes from the encrypted file.  
- *    Read either the requested number of bytes or up through EOF.
- *    The caller has to handle an EOF shorted buffer.
- */
-static
-rc_t KEncFileV1BufferRead (const KEncFileV1 * cself, uint64_t pos, void * buffer,
-                         size_t bsize, size_t * pnum_read)
-{
-    KEncFileV1 * self;   /* for mutable fields */
-    uint8_t * bbuffer; /* void pointer made to a byyte pointer */
-    rc_t rc;
-
-    assert (cself);
-    assert (buffer);
-    assert (pnum_read);
-
-    *pnum_read = 0;
-
-    self = (KEncFileV1*)cself; /* to hit mutable fields */
-    bbuffer = buffer; /* convert to a pointer of sized target */
-
-    /* we want to read a full requested size if possible so keep trying if we
-     * haven't read enough yet. 
-     * We can quit early only if EOF (i.e. read 0 bytes.
-     */
-    rc = KFileReadAll (self->encrypted, pos, buffer, bsize, pnum_read);
-    if (rc)
-        PLOGERR (klogErr,
-                 (klogErr, rc,
-                  "error reading position '$(P)' in encrypted file",
-                  "P=%lu", pos));
-
-    else if (self->encrypted_max < pos)
-        self->encrypted_max = pos;
-            
-    return rc;
-}
-
-
-/* ----------
- * BufferWrite
- *    Write a buffer of requested size out to the encrypted file.
- *    return the number of bytes successfully written
- */
-static
-rc_t KEncFileV1BufferWrite (KEncFileV1 * self, uint64_t pos, const void * buffer,
-                          size_t bsize, size_t * pnum_writ)
-{
-    rc_t rc;
-
-    rc =  KFileWriteAll (self->encrypted, pos, buffer, bsize, pnum_writ);
-    if ((rc == 0) && (self->encrypted_max < pos))
-        self->encrypted_max = pos;
-
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * operations on KEncFileHeader
- *
- * The header only needs to be read and validated or written  we need not 
- * reatian within the KEncFile object any information about the header in
- * the initial version of this file format.
- */
-
-/* -----
- * the first eight bytes of the file are two four byte strings
- *  The first is a common "NCBI"
- *  The second is the format specific "nenc"
- */
-static const KEncFileSig KEncFileSignature = "NCBInenc";
-
-/* -----
- * the common constant used throughout the project to check the byte order 
- * as written by the system which created the file
- */
-/* enum fails to handle these due to integer overflow */
-
-#define eByteOrderTag     (0x05031988)
-#define eByteOrderReverse (0x88190305)
-
-/* ----
- * Not unexpectedly the first version of this file will be "1"
- */
-#if ENABLE_V2
-
-#define eCurrentVersion (0x00000002)
-#define eCurrentVersionReverse (0x02000000)
-
-static
-const KEncFileHeader const_header_v1
-= { "NCBInenc", eByteOrderTag, 0x00000001 };
-
-static
-const KEncFileHeader const_bswap_header_v1
-= { "NCBInenc", eByteOrderReverse, 0x01000000 };
-    
-#else
-
-#define eCurrentVersion (0x00000001)
-#define eCurrentVersionReverse (0x01000000)
-
-#endif
-    
-static
-const KEncFileHeader const_header
-= { "NCBInenc", eByteOrderTag, eCurrentVersion };
-
-static
-const KEncFileHeader const_bswap_header
-= { "NCBInenc", eByteOrderReverse, eCurrentVersionReverse };
-
-
-/* ----------
- * HeaderRead
- *    Read the header of an encrypted file and validate it.
- */
-static
-rc_t KEncFileV1HeaderRead (KEncFileV1 * self)
-{
-    KEncFileHeader header;
-    size_t num_read;
-    rc_t rc;
-
-    assert (self);
-
-    rc = KEncFileV1BufferRead (self, 0, &header, sizeof (header), &num_read);
-    if (rc)
-        return rc;
-
-    if (num_read != sizeof (header))
-    {
-        rc = RC (rcFS, rcFile, rcConstructing, rcHeader, rcTooShort);
-        PLOGERR (klogErr,
-                 (klogErr, rc, "error reading full header of encrypted "
-                  "file  wanted '$(S)' got '$(N); bytes read", "S=%u,N=%u",
-                  sizeof (header), num_read));
-        return rc;
-    }
-
-    /* expected is encrypted on a system of the same endianess */
-    if (memcmp (&header, &const_header, sizeof (header)) == 0)
-    {
-        self->bswap = false;
-#if ENABLE_V2
-        self->version = eCurrentVersion;
-#endif
-        return 0;
-    }
-
-    /* next most likely is encrypted on a machine of opposite endianess */
-    if (memcmp (&header, &const_bswap_header, sizeof (header)) == 0)
-    {
-        self->bswap = true;
-#if ENABLE_V2
-        self->version = eCurrentVersion;
-#endif
-        return 0;
-    }
-
-#if ENABLE_V2
-    if (memcmp (&header, &const_header_v1, sizeof (header)) == 0)
-    {
-        self->bswap = false;
-        self->version = 1;
-        return 0;
-    }
-
-    /* next most likely is encrypted on a machine of opposite endianess */
-    if (memcmp (&header, &const_bswap_header_v1, sizeof (header)) == 0)
-    {
-        self->bswap = true;
-        self->version = 1;
-        return 0;
-    }
-#endif
-
-    /* okay it's a "bad" header, so figure out why */
-    if (memcmp (&header, &const_header, sizeof (header.file_sig)) != 0)
-    {
-        rc = RC (rcKrypto, rcFile, rcReading, rcHeader, rcInvalid);
-        LOGERR (klogErr, rc, "file is not the NCBI encrypted file format");
-        /* if this fails the rest doesn't matter */
-        return rc;
-    }
-
-    switch (header.byte_order)
-    {
-    default:
-        rc = RC (rcFS, rcFile, rcConstructing, rcByteOrder, rcInvalid);
-        PLOGERR (klogErr, 
-                 (klogErr, rc, "invalid byte order flag '$(F); in "
-                  "encrypted file", "F=%X", header.byte_order));
-        /* we don't return to possibly log other version errors */
-        break;
-    case eByteOrderReverse:
-    case eByteOrderTag:
-        break;
-    }
-
-    switch (header.version)
-    {
-    default:
-        rc = RC (rcFS, rcFile, rcConstructing, rcHeader, rcBadVersion);
-        PLOGERR (klogErr, 
-                 (klogErr, rc, "can not decrypt version '$(V)'",
-                  "V=%u", header.version));
-        break;
-
-    case 1:
-#if ENABLE_V2
-    case 2:
-#endif
-        break;
-    }
-    return rc;
-}
-
-
-/* -----
- * HeaderWrite
- *
- * build a ram copy of the header and write it to the file
- */
-static
-rc_t KEncFileV1HeaderWrite (KEncFileV1 * self)
-{
-    size_t num_writ;
-    rc_t rc;
-
-    rc = KEncFileV1BufferWrite (self, 0, &const_header, sizeof (const_header),
-                              &num_writ);
-    if (rc == 0)
-    {
-        if (num_writ != sizeof (const_header))
-            rc = RC (rcFS, rcFile, rcWriting, rcHeader, rcInsufficient);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KEncFileV1WriteHeader_v1  (KFile * self)
-{
-    if (self == NULL)
-        return RC (rcKrypto, rcFile, rcWriting, rcSelf, rcNull);
-    return KEncFileV1HeaderWrite ((KEncFileV1*)self);
-}
-
-
-/* ----------------------------------------------------------------------
- * operations on KEncFileFooter
- */
-
-/* ----------
- * Validate
- * we expect to read a Footer when we expect a Block so we validate in RAM
- * without a Read
- *
- * we're just comparing the values in the footer against expected values
- */
-static
-rc_t KEncFileV1FooterValidate (const KEncFileV1 * self,
-                             uint64_t block_count, uint64_t crc_checksum)
-{
-    rc_t rc1 = 0, rc2 = 0;
-
-    if (self->foot.block_count != block_count)
-    {
-        rc2 = RC (rcKrypto, rcFile, rcValidating, rcFile, rcCorrupt);
-        LOGERR (klogErr, rc1, "bad block count in encrypted file footer");
-    }
-    if ((self->foot.crc_checksum != crc_checksum)
-#if ENABLE_V2
-        &&((crc_checksum != 0) || (self->version == 1))
-#endif
-        )
-    {
-        rc1 = RC (rcKrypto, rcFile, rcValidating, rcChecksum, rcCorrupt);
-        LOGERR (klogErr, rc2, "bad crc checksum in encrypted file footer");
-    }
-    return (rc1 ? rc1 : rc2);
-}
-
-
-/* ----------
- * Write
- * when we write a footer we write from the values in the object.  They
- * are stored in the same object format as the footer so its very simple
- */
-static
-rc_t KEncFileV1FooterWrite (KEncFileV1 * self)
-{
-    KEncFileFooter foot;
-    uint64_t offset;
-    size_t num_writ;
-    rc_t rc;
-
-    memcpy (&foot, &self->foot, sizeof (foot));
-    if (self->bswap)
-    {
-        foot.block_count = bswap_64 (foot.block_count);
-        foot.crc_checksum = bswap_64 (foot.crc_checksum);
-    }
-
-    offset = BlockId_to_EncryptedPos (self->foot.block_count);
-
-/*     assert ((self->encrypted_max == offset) || */
-/*             (self->encrypted_max + sizeof(self->foot) == offset)); */
-
-    rc = KEncFileV1BufferWrite (self, offset, &foot, sizeof (foot),
-                              &num_writ);
-    if (rc == 0)
-    {
-        if (num_writ != sizeof (foot))
-            rc = RC (rcFS, rcFile, rcWriting, rcFile, rcInsufficient);
-    }
-    return rc;
-}
-
-
-/* ----------
- * IvecInit
- *    create the ivec for a given block
- *    done in a function to ensure decrypt and encrypt use the same code to
- *    generate this.  Anything used to create this has to be available to
- *    code that doesn't know the content of the data or the state of the file
- *    beyond the location of the block with in the file.
- *
- *    This is definitely over-kill using the MD5.
- */
-static
-void KEncFileV1IVecInit (const KEncFileV1 * self, KEncFileIVec ivec)
-{
-    BufferCalcMD5 (&self->block.id, sizeof self->block.id, ivec);
-}
-
- 
-/* ----------
- * BlockEncrypt
- */
-
-static
-rc_t KEncFileV1BlockEncrypt (KEncFileV1 * self, KEncFileBlock * e)
-{
-    SHA256State state;
-    uint64_t id;
-    uint16_t valid;
-    uint16_t saved_valid;
-    KEncFileCRC crc;
-    uint8_t ivec [16];
-    rc_t rc;
-
-    assert (self);
-    assert (e);
-
-    /*
-     * First we finish preparing the two ciphers by creating the block
-     * user key out of the first part of the data and the shared Initialization
-     * vector for Chained Block Cipher mode encryption out of the block id
-     * 
-     * create the initialization vector for this block
-     */
-    KEncFileV1IVecInit (self, ivec);
-
-    /*
-     * set the ivec for both the master and data block ciphers
-     */
-    rc = KCipherSetEncryptIVec (self->ciphers.master, ivec);
-    if (rc)
-        return rc;
-
-    rc = KCipherSetEncryptIVec (self->ciphers.block, ivec);
-    if (rc)
-        return rc;
-
-    /*
-     * create the block user key out of the first 4kb of data and the block id 
-     */
-    saved_valid = valid = self->block.u.valid;
-    id = self->block.id;
-
-    SHA256StateInit (&state);
-    SHA256StateAppend (&state, self->block.data, 
-                       valid > 4096 ? 4096 : valid);
-    SHA256StateAppend (&state, &id, sizeof (id));
-    SHA256StateFinish (&state, self->block.key);
-        
-    /*
-     * create the block key schedule out of the block user key
-     */
-    rc = KCipherSetEncryptKey (self->ciphers.block, self->block.key,
-                               sizeof self->block.key);
-    if (rc)
-        return rc;
-
-    /* 
-     * Salt the block using the randomish user key to randomly select
-     * data from the valid data.
-     *
-     * This will cover the data portion of the block past the last valid
-     * byte.
-     *
-     * NOTE we are accessing a byte array as a word array.
-     *
-     * NOTE we are using the array named data to access data beyond it's end.
-     */
-    {
-        uint16_t * pw;
-        unsigned int windex;
-        unsigned int rindex;
-        size_t bindex;
-
-        pw = (uint16_t*)self->block.key;
-        windex = 0;
-
-        for (bindex = valid;
-             bindex < sizeof self->block.data + sizeof self->block.u; 
-             ++ bindex)
-        {
-            /* this goes beyond the end of the data array by design */
-            rindex = (size_t)pw[windex];
-            rindex %= bindex;
-
-            self->block.data[bindex] = self->block.data[rindex];
-        
-            ++rindex;
-            if (rindex >= sizeof self->block.key / sizeof *pw)
-                rindex = 0;
-        }
-    }
-
-    /* 
-     * If we are modifying a block created on a system with a different default
-     * Endian choice we'll need to byte swap the block id and the block valid
-     * count
-     */
-    if (self->bswap)
-    {
-        id = bswap_64 (id);
-        valid = bswap_16 (valid);
-    }
-
-
-    if (saved_valid == sizeof self->block.data)
-        self->block.u.valid |= valid;
-    else
-        self->block.u.valid = valid;
-
-    e->id = id;
-
-    /* 
-     * encrypt the block user key into the buffer
-     */
-    rc = KCipherEncryptCBC (self->ciphers.master, self->block.key, e->key,
-                            sizeof (self->block.key) / sizeof (ivec));
-    if (rc)
-        return rc;
-
-    /*
-     * encrypt the data, offset and valid values
-     */
-    rc = KCipherEncryptCBC (self->ciphers.block, 
-                            self->block.data, e->data,
-                            (sizeof self->block.data + sizeof self->block.u) / sizeof (ivec));
-    if (rc)
-        return rc;
-
-    self->block.u.valid = saved_valid;
-
-    crc = CRC32 (0, e, (char*)(&e->crc)-(char*)e);
-
-    self->block.crc = crc;
-
-    if (self->bswap)
-    {
-        crc = bswap_32 (crc);
-    }
-    e->crc_copy = e->crc = crc;
-    
-    return 0;
-}
-
-
-/* ----------
- * BlockDecrypt
- *   decrypt decrypts the data from a KEncFileBlock into the KEncFileBlock
- *   in the KEncFile object
- */
-
-static
-rc_t KEncFileV1BlockDecrypt (KEncFileV1 * self, KEncFileBlock * e)
-{
-    uint8_t ivec [16];
-    rc_t rc;
-
-    assert (self);
-    assert (e);
-
-    /* create the initialization vector for this block */
-    KEncFileV1IVecInit (self, ivec);
-
-    /*
-     * set the ivec for both the master and data block ciphers
-     */
-    rc = KCipherSetDecryptIVec (self->ciphers.master, ivec);
-    if (rc)
-        return rc;
-
-    rc = KCipherSetDecryptIVec (self->ciphers.block, ivec);
-    if (rc)
-        return rc;
-
-    /* 
-     * decrypt the block key and initial vector using the user key and 
-     * the computer ivec
-     */
-    rc = KCipherDecryptCBC (self->ciphers.master, e->key, self->block.key,
-                            (sizeof e->key) / sizeof ivec);
-    if (rc)
-        return rc;
-
-    /* 
-     * now create the AES key for the block from the newly decrypted 
-     * block key
-     */
-    rc = KCipherSetDecryptKey (self->ciphers.block, self->block.key,
-                               sizeof self->block.key);
-    if (rc)
-        return rc;
-    rc = KCipherDecryptCBC (self->ciphers.block, e->data, 
-                            self->block.data, 
-                            (sizeof e->data + sizeof e->u) / sizeof ivec);
-    if (rc)
-        return rc;
-
-    if (self->bswap)
-    {
-        self->block.u.valid = bswap_16 (self->block.u.valid);
-/*         self->block.id = bswap_64 (self->block.id); */
-    }
-
-    /* we choose not to flag errors in decryption so don't validate these */
-    if (self->block.u.valid & 0x8000)
-        self->block.u.valid = 0x8000;
-
-    return rc;
-}
-
-
-/* ----------
- * BlockRead
- *    read a requested block from the encrypted file; 
- *    decryption is a separate step
- */
-static
-rc_t KEncFileV1BlockRead (const KEncFileV1 * cself, uint64_t block_id,
-                        KEncFileBlock * block, bool validate)
-{
-    KEncFileV1 * self;    /* mutable fields */
-    uint64_t pos;
-    uint64_t max;
-    size_t num_read;
-    rc_t rc;
-    KEncFileBlock e;
-
-    assert (cself);
-    assert (block);
-
-    self = (KEncFileV1*)cself;
-    pos = BlockId_to_EncryptedPos (block_id);
-
-    /* set aside the current maximum position within the encrypted file */
-    max = self->encrypted_max;
-
-    memset (&self->block, 0, sizeof self->block);
-    self->block.id = block_id;
-    self->block.u.valid = 0;
-    self->dirty = false;
-
-    rc = KEncFileV1BufferRead (self, pos, &e, sizeof e, &num_read);
-    if (rc)
-        PLOGERR (klogErr,
-                 (klogErr, rc,
-                  "error in reading block '$(BID)' from encrypted file",
-                  "BID=%lu", block_id));
-    else
-    {
-        uint32_t crc;
-
-        /* we'll judge the success of the read now on how many bytes read
-         * there are only three legitimate values:  
-         *   + size of a block 
-         *   + size of a footer
-         *   + zero meaning no footer yet
-         *
-         * This might have to change to handled streamed files where the 
-         * producer jsut hasn't finished yet
-         */
-        switch (num_read)
-        {
-        default: /* bad value means a truncated file most likely */
-            rc = RC (rcKrypto, rcFile, rcReading, rcFile, rcInsufficient);
-            PLOGERR (klogErr,
-                     (klogErr, rc, "wrong size reading block '$(B)' at '$(P)' "
-                      "from encrypted file - likely truncated", "B=%lu,P=%lu",
-                      block_id, pos));
-            break;
-
-        case sizeof e:
-            if (max <= pos) /* if we hadn't read this far do accounting */
-            {
-                if (self->bswap)
-                {
-                    e.crc = bswap_32 (e.crc);
-                    e.id = bswap_64 (e.id);
-                }
-
-                if (block_id != e.id)
-                {
-                    PLOGERR (klogErr,
-                             (klogErr,
-                              RC (rcKrypto, rcFile, rcValidating, rcIndex, rcIncorrect),
-                              "error validating id for block '$(BID)' is not $(C2)", 
-                              "BID=%lu,C2=%lu", block_id, e.id));
-                }
-
-                if (validate)
-                {
-                    crc = CRC32 (0, &e, (char*)(&e.crc)-(char*)&e);
-
-
-                    if (crc != e.crc)
-                    {
-                        PLOGERR (klogErr,
-                                 (klogErr,
-                                  RC (rcKrypto, rcFile, rcValidating, rcCrc, rcCorrupt),
-                                  "error validating crc for block '$(BID)' $(C1) is not $(C2)", 
-                                  "BID=%lu,C1=0x%X,C2=0x%X", block_id,
-                                  crc, e.crc));
-                    }
-                }
-
-                ++self->foot.block_count;
-/* Byte Endian problem! */
-                self->foot.crc_checksum += e.crc;
-            }
-            memcpy (block, &e, sizeof e);
-            self->eof = false;
-            break;
-
-        case sizeof (self->foot):
-            {
-                KEncFileFooter foot;
-                memmove (&foot, &e, sizeof foot);
-                if (self->bswap)
-                {
-                    foot.block_count = bswap_64 (foot.block_count);
-                    foot.crc_checksum = bswap_64 (foot.crc_checksum);
-                }
-                if (validate && !self->written)
-                {
-                    rc = KEncFileV1FooterValidate (self, foot.block_count,
-                                                 foot.crc_checksum);
-                    if (rc)
-                        break;
-                }
-            }
-            /* fall through */
-        case 0:
-            self->block.u.valid = 0;
-            self->block.crc = 0;
-            self->eof = true;
-            return 0;
-
-        }
-    }
-    return rc;
-}
-
-static
-rc_t KEncFileV1BlockWrite (KEncFileV1 * self)
-{
-    KEncFileBlock e;
-    uint64_t block_offset;
-    size_t num_writ;
-    rc_t rc;
- 
-    assert (self);
-
-    if (self->block.u.valid > sizeof self->block.data)
-        return RC (rcFS, rcFile, rcWriting, rcBuffer, rcCorrupt);
-
-    /* where in the file is this block */
-    block_offset = BlockId_to_EncryptedPos(self->block.id);
-
-    /* if this is an update to a block take out the old crc value */
-    if (block_offset < self->encrypted_max)
-        self->foot.crc_checksum -= self->block.crc;
-
-    /* if it's not we need to add it as a new block in the count */
-    else
-        ++self->foot.block_count;
-
-    rc = KEncFileV1BlockEncrypt (self, &e);
-    if (rc)
-        return rc;
-
-/* Byte Endian problem */
-    self->foot.crc_checksum += self->block.crc;
-
-    /* now write the buffer to the encrypted file */
-    rc = KEncFileV1BufferWrite (self, block_offset, &e, sizeof e, &num_writ);
-
-    if ((rc == 0) && (num_writ != sizeof e))
-    {
-        rc = RC (rcFS, rcFile, rcWriting, rcFile, rcTooShort);
-        PLOGERR (klogErr,
-                 (klogErr, rc, "incomplete block write '$(B)' wanted"
-                  " '$(V)' got '$(N)'", "B=%lu,V=%u,N=%u",
-                  self->foot.block_count+1, self->block.u.valid, num_writ));
-    }
-    return rc;
-}
-
-
-static
-rc_t KEncFileV1BlockFlush (KEncFileV1 *self)
-{
-    rc_t rc = 0;
-
-    assert (self);
-    assert (self->block.u.valid);
-    assert (self->block.u.valid <= sizeof (self->block.data));
-
-    /* first do we need to deal with the file header? 
-     * if the encrypted file has not been written to we do */
-    if ((self->encrypted_max == 0) && (self->swarm == false))
-    {
-        rc = KEncFileV1HeaderWrite (self);
-        if (rc)
-            return rc;
-    }
-
-    if (self->dirty)
-    {
-        rc = KEncFileV1BlockWrite (self);
-        if (rc == 0)
-            self->dirty = false;
-    }
-    return rc;
-}
-
-
-/*
- * block_id - which block to read and decrypt
- * fill - if not false, we fill in zero blocks up through this block
- *
- */
-static
-rc_t KEncFileV1BlockSeek (KEncFileV1 * self, uint64_t block_id, bool fill, bool validate)
-{
-    KEncFileBlock b;
-    rc_t rc;
-
-    if (block_id != self->block.id)
-    {
-        if (self->dirty)
-        {
-            /* flush what we got */
-            rc = KEncFileV1BlockFlush (self);
-            if (rc)
-                return rc;
-        }
-
-        if (validate && (block_id > self->block.id))
-        {
-            uint64_t tid;
-
-            for (tid = self->block.id + 1; tid < block_id; ++tid)
-            {
-                if (self->encrypted_max > BlockId_to_EncryptedPos(block_id))
-                    continue;
-
-                memset (&b, 0, sizeof b);
-
-                rc = KEncFileV1BlockRead (self, tid, &b, validate);
-                if (rc)
-                    return rc;
-
-                if (self->eof)
-                {
-                    if (fill)
-                    {
-                        self->eof = false;
-                        memset (self->block.data, 0, sizeof (self->block.data));
-                        self->block.u.valid = sizeof (self->block.data);
-                        self->dirty = true;
-                        rc = KEncFileV1BlockFlush (self);
-                        if (rc)
-                            return rc;
-                    }
-                    else
-                        return 0;
-                }
-                /* in this loop a less than full block is end of file */
-                else if (fill)
-                {
-                    rc = KEncFileV1BlockDecrypt (self, &b);
-                    if (rc)
-                        return rc;
-
-                    if (self->block.u.valid < sizeof self->block.u.valid)
-                    {
-                        memset (self->block.data + self->block.u.valid, 0, 
-                                sizeof (self->block.data) - self->block.u.valid);
-                        self->dirty = true;
-                        rc = KEncFileV1BlockFlush (self);
-                        if (rc)
-                            return rc;
-                    }
-                    else
-                    {
-                        return 0;
-                    }
-                }
-            }
-        }
-    }
-    /* done with intervening blocks */
-    memset (&b, 0, sizeof b);
-
-    rc = KEncFileV1BlockRead (self, block_id, &b, validate);
-    if (rc)
-        return rc;
-
-    if (! self->eof)
-    {
-        rc = KEncFileV1BlockDecrypt (self, &b);
-    }
-    if (fill)
-    {
-        self->block.id = block_id;
-        self->block.u.valid = 0;
-    }
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * Interface Functions
- *
- * Destroy
- *
- */
-static
-rc_t CC KEncFileV1DestroyRead (KEncFileV1 *self)
-{
-    rc_t rc1 = 0;
-    rc_t rc2 = 0;
-    rc_t rc3 = 0;
-
-    if (self)
-    {
-        rc1 = KFileRelease (self->encrypted);
-        rc2 = KCipherRelease (self->ciphers.master);
-        rc3 = KCipherRelease (self->ciphers.block);
-        free (self);
-        return rc1 ?  rc1 : rc2 ? rc2 : rc3;
-    }
-    return 0;
-}
-
-
-static
-rc_t CC KEncFileV1DestroyWrite (KEncFileV1 *self)
-{
-    rc_t rc1;
-    rc_t rc2;
-
-    rc1 = (self->block.u.valid) ? KEncFileV1BlockFlush (self) : 0;
-    if ((rc1 == 0)&&(self->encrypted_max != 0))
-        rc1 = KEncFileV1FooterWrite (self);
-    rc2 = KFileRelease (self->encrypted);
-
-    return (rc1 ?  rc1 : rc2);
-}
-
-
-static
-rc_t CC KEncFileV1DestroySwarm (KEncFileV1 *self)
-{
-    rc_t rc1 = 0;
-    rc_t rc2 = 0;
-    rc_t rc3 = 0;
-
-    if (self)
-    {
-        rc1 = KFileRelease (self->encrypted);
-        rc2 = KCipherRelease (self->ciphers.master);
-        rc3 = KCipherRelease (self->ciphers.block);
-        free (self);
-        return rc1 ?  rc1 : rc2 ? rc2 : rc3;
-    }
-    return 0;
-}
-
-
-/* ----------------------------------------------------------------------
- * GetSysFile
- *  returns an underlying system file object
- *  and starting offset to contiguous region
- *  suitable for memory mapping, or NULL if
- *  no such file is available.
- *
- * We do not allow this for read, write or update as you can not memory map the 
- * unencrypted file in a meaningful way.
- */
-static
-struct KSysFile *CC KEncFileV1GetSysFileUnsupported (const KEncFileV1 *self, uint64_t *offset)
-{
-    assert (self);
-    assert (offset);
-    return NULL;
-}
-
-
-/* ----------------------------------------------------------------------
- * RandomAccess
- *
- *  returns 0 if random access, error code otherwise
- */
-static
-rc_t CC KEncFileV1RandomAccess (const KEncFileV1 *self)
-{
-    assert (self != NULL);
-    assert (self->encrypted != NULL);
-    return KFileRandomAccess (self->encrypted);
-}
-
-
-static
-rc_t CC KEncFileV1RandomAccessUnsupported (const KEncFileV1 *self)
-{
-    return RC ( rcFS, rcFile, rcUpdating, rcFunction, rcUnsupported );
-}
-
-
-/* ----------------------------------------------------------------------
- * Size
- *  returns size in bytes of file
- *
- *  "size" [ OUT ] - return parameter for file size
- */
-static
-rc_t CC KEncFileV1SizeUnsupported (const KEncFileV1 *self, uint64_t *size)
-{
-    return RC ( rcFS, rcFile, rcAccessing, rcFunction, rcUnsupported );
-}
-
-
-/* ----------------------------------------------------------------------
- * SetSize
- *  sets size in bytes of file
- *
- *  "size" [ IN ] - new file size
- */
-static
-rc_t CC KEncFileV1SetSizeUnsupported (KEncFileV1 *self, uint64_t size)
-{
-    assert (self);
-    return RC ( rcFS, rcFile, rcUpdating, rcFunction, rcUnsupported );
-}
-
-
-/* ----------------------------------------------------------------------
- * Read
- *  read file from known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually read
- */
-static
-rc_t CC KEncFileV1ReadUnsupported (const KEncFileV1 *self,
-                                 uint64_t pos,
-                                 void *buffer,
-                                 size_t bsize,
-                                 size_t *num_read)
-{
-    return RC ( rcFS, rcFile, rcReading, rcFunction, rcUnsupported );
-}
-
-
-static
-rc_t CC KEncFileV1Read	(const KEncFileV1 *cself,
-                         uint64_t pos,
-                         void *buffer,
-                         size_t bsize,
-                         size_t *num_read)
-{
-    KEncFileV1 * self = (KEncFileV1 *)cself; /* mutable values */
-    uint64_t block_id;
-    uint32_t offset;
-    size_t to_copy;
-    rc_t rc = 0;
-
-    assert (self); /* checked in file.c KFileRead() */
-    /* pos can be 'anything' */
-    assert (buffer); /* checked in file.c KFileRead() */
-    assert (bsize); /* checked in file.c KFileRead() */
-    assert (num_read); /* checked in file.c KFileRead() */
-
-    *num_read = 0;
-
-    block_id = DecryptedPos_to_BlockId (pos, &offset);
-
-    /*
-     * are we on the wrong block?
-     * Or are do we need to read the first block?
-     */
-    if ((block_id != self->block.id) || (self->block.u.valid == 0))
-    {
-        rc = KEncFileV1BlockSeek (self, block_id, false, false);
-        if (rc)
-            return rc;
-    }
-
-    /*
-     * if we are trying to read past the end of the file 
-     * return 0 with nothing read
-     */
-    if (self->eof || (block_id != self->block.id) ||
-        (offset >= self->block.u.valid))
-        return 0;
-
-    to_copy = self->block.u.valid - offset;
-    if (to_copy > bsize)
-        to_copy = bsize;
-
-    memmove (buffer, self->block.data + offset, to_copy);
-    *num_read = to_copy;
-
-    return 0;
-}
-
-
-/* ----------------------------------------------------------------------
- * Write
- *  write file at known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ IN ] and "size" [ IN ] - data to be written
- *
- *  "num_writ" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually written
- *
- * Unsupported as we now treat archives as READ ONLY
- */
-static
-rc_t CC KEncFileV1WriteUnsupported (KEncFileV1 *self, uint64_t pos,
-                                  const void *buffer, size_t bsize,
-                                  size_t *num_writ)
-{
-    rc_t rc = RC (rcFS, rcFile, rcReading, rcFunction, rcUnsupported);
-    LOGERR (klogInt, rc, "KFileRead failed to filter call");
-    return rc;
-}
-
-static
-rc_t KEncFileV1WriteInt (KEncFileV1 *self, uint64_t block_id, uint32_t block_offset,
-                       const void *buffer, size_t bsize,
-                       size_t *pnum_writ, bool seek)
-{
-    const uint8_t * pb;
-    size_t tot_writ;
-    rc_t rc;
-
-    assert (self);
-    assert (self->block.u.valid <= sizeof (self->block.data));
-    assert (block_offset < sizeof (self->block.data));
-    assert (buffer);
-    assert (bsize);
-    assert (pnum_writ);
-
-    if (seek)
-    {
-        /* if we need to change blocks */
-        if (block_id != self->block.id)
-        {
-            rc = KEncFileV1BlockSeek (self, block_id, true, false);
-            if (rc)
-                return rc;
-        }
-        /* do we have to fill some of this block */
-        if (self->block.u.valid < block_id)
-        {
-            memset (self->block.data + self->block.u.valid, 0,
-                    block_offset - self->block.u.valid);
-            self->block.u.valid = block_offset;
-        }
-    }
-
-    /*
-     * is the full write within this block?
-     * doesn't matter whether we are skipping back or not
-     */
-    if ((block_offset + bsize) <= sizeof (self->block.data))
-    {
-        memmove (self->block.data + block_offset, buffer, bsize);
-        self->dirty = true;
-        if (block_offset + bsize > self->block.u.valid)
-            self->block.u.valid = (KEncFileBlockValid) ( block_offset + bsize );
-        *pnum_writ = bsize;
-        return 0;
-    }
-
-    /* we are either forcing ourselves backward or not */
-    else 
-        self->block.u.valid = block_offset;
-
-    /* by this point we are 'at' the right place in the file */
-    /* do we have an existing (possibly partial) block? */
-
-    /* change to a sized target pointer */
-    pb = buffer;
-    tot_writ = 0;
-
-    /* handle this first block with some data in it */
-    if (self->block.u.valid != 0)
-    {
-        size_t remaining;
-
-        /* how many bytes left in this block */
-        remaining = sizeof self->block.data - self->block.u.valid;
-
-        memmove (self->block.data + self->block.u.valid, buffer, remaining);
-        self->block.u.valid = sizeof self->block.data;
-
-        self->dirty = true;
-        rc = KEncFileV1BlockFlush (self);
-        if (rc)
-        {
-            LOGERR (klogErr, rc, "error flushing block in encrypt");
-            return rc;
-        }
-
-        tot_writ = remaining;
-        pb += remaining;
-        bsize -= remaining; 
-        ++block_id;
-    }
-
-    /* now loop through complete blocks to write */
-    for (; bsize >= sizeof self->block.data; bsize -= sizeof self->block.data)
-    {
-        memcpy (self->block.data, pb, sizeof self->block.data);
-
-        self->block.u.valid = sizeof self->block.data;
-        self->block.id = block_id;
-        self->dirty = true;
-        rc = KEncFileV1BlockFlush (self);
-        if (rc)
-        {
-            LOGERR (klogErr, rc, "error flushing block in encrypt");
-            return rc;
-        }
-        pb += sizeof self->block.data;
-	tot_writ += sizeof self->block.data;
-        ++block_id;
-    }
-
-    /* now any last partial block that starts at the beginning of a block */
-    if (bsize != 0)
-    {
-        KEncFileBlock b;
-
-        if (self->encrypted_max > BlockId_to_EncryptedPos(block_id))
-        {
-            rc = KEncFileV1BlockRead (self, block_id, &b, false);
-            if (rc)
-                return rc;
-            /* if valid is not 0 we actually read something */
-            if (b.u.valid)
-                rc = KEncFileV1BlockDecrypt (self, &b);
-        }
-        else
-        {
-            self->block.u.valid = 0;
-            self->block.id = block_id;
-        }
-
-        memmove (self->block.data, pb, bsize);
-
-        if (bsize > self->block.u.valid)
-            self->block.u.valid = (KEncFileBlockValid) bsize;
-
-        self->dirty = true;
-        tot_writ += bsize;
-    }
-    *pnum_writ = tot_writ;
-    return 0;
-}
-
-
-static
-rc_t CC KEncFileV1Write (KEncFileV1 *self, uint64_t pos,
-                       const void *buffer, size_t bsize,
-                       size_t *pnum_writ)
-{
-    uint64_t block_id;
-    uint64_t curr_block_id;
-    uint32_t block_offset;
-    uint32_t curr_block_offset;
-    rc_t rc = 0;
-
-    /* -----
-     * check for incorrect call with a seek attempt
-     * we only allow seeks on read or read/write files
-     *
-     * find our location in the encrypted file by block id
-     * and offset
-     */
-    block_id = DecryptedPos_to_BlockId (pos, &block_offset);
-    curr_block_id = DecryptedPos_to_BlockId
-        (BlockId_to_DecryptedPos (self->block.id) + self->block.u.valid,
-         &curr_block_offset);
-
-    /* are we writing to the wrong block/offset? */
-    if ((block_id != curr_block_id) || (block_offset != curr_block_offset))
-    {
-        rc = RC (rcFS, rcFile, rcWriting, rcOffset, rcIncorrect);
-        PLOGERR (klogErr, (klogErr, rc, "attempt to seek in encryption write at"
-                           " '$(O)' seek to '$(P)'", "O=%lu,P=%lu",
-                           BlockId_to_EncryptedPos(self->block.id), pos));
-    }
-    else
-    {
-        if ((block_id != 0) && (block_id != self->block.id))
-        {
-            rc = KEncFileV1BlockFlush (self);
-            if (rc == 0)
-            {
-                ++self->block.id;
-                self->block.u.valid = 0;
-            }
-        }
-        
-        if (rc == 0)
-            rc = KEncFileV1WriteInt (self, block_id, block_offset, buffer,
-                                       bsize, pnum_writ, false);
-    }
-    return rc;
-}
-
-
-static
-rc_t CC KEncFileV1WriteSwarm (KEncFileV1 *self, uint64_t pos,
-                            const void *buffer, size_t bsize,
-                            size_t *pnum_writ)
-{
-    uint32_t block_offset;
-    rc_t rc;
-
-    self->block.id = DecryptedPos_to_BlockId (pos, &block_offset);
-    self->block.u.valid = 0;
-    if (bsize > sizeof self->block.data - block_offset)
-        bsize = sizeof self->block.data - block_offset;
-
-    rc = KEncFileV1WriteInt (self, self->block.id, block_offset, buffer,
-                           bsize, pnum_writ, false);
-    if (rc == 0)
-        rc = KEncFileV1BlockFlush (self);
-    return rc;
-}
-
-
-static
-rc_t CC KEncFileV1Update (KEncFileV1 *self, uint64_t pos,
-                        const void *buffer, size_t bsize,
-                        size_t *pnum_writ)
-{
-    return RC (rcKrypto, rcFile, rcConstructing, rcFunction, rcUnsupported);
-}
-
-
-/* ----------------------------------------------------------------------
- * Type
- *  returns a KFileDesc
- *  not intended to be a content type,
- *  but rather an implementation class
- */
-static
-uint32_t CC KEncFileV1Type (const KEncFileV1 *self)
-{
-    assert (self != NULL);
-    assert (self->encrypted != NULL);
-
-    return KFileType (self->encrypted);
-}
-
-
-/* ----------------------------------------------------------------------
- * KEncFileV1Make
- *  create a new file object
- */
-
-/* ----------
- * KeysInit
- */
-static
-rc_t KEncFileV1CiphersInit (KEncFileV1 * self, const KKey * key, bool read, bool write)
-{
-    KCipherManager * mgr;
-    size_t z;
-    rc_t rc;
-
-    switch ( key->type)
-    {
-    default:
-        return RC (rcKrypto, rcEncryptionKey, rcConstructing, rcParam, rcInvalid);
-
-    case kkeyNone:
-        return RC (rcKrypto, rcEncryptionKey, rcConstructing, rcParam, rcIncorrect);
-
-    case kkeyAES128:
-        z = 128/8; break;
-
-    case kkeyAES192:
-        z = 192/8; break;
-
-    case kkeyAES256:
-        z = 256/8; break;
-    }
-    rc = KCipherManagerMake (&mgr);
-    if (rc == 0)
-    {
-        rc = KCipherManagerMakeCipher (mgr, &self->ciphers.master, kcipher_AES);
-        if (rc == 0)
-        {
-            rc = KCipherManagerMakeCipher (mgr, &self->ciphers.block, kcipher_AES);
-            if (rc == 0)
-            {
-                rc = KCipherSetDecryptKey (self->ciphers.master, key->text, z);
-                if (rc == 0)
-                {
-                    rc = KCipherSetEncryptKey (self->ciphers.master, key->text, z);
-                    if (rc == 0)
-                        goto keep_ciphers;
-                }
-                KCipherRelease (self->ciphers.block);
-                self->ciphers.block = NULL;
-            }
-            KCipherRelease (self->ciphers.master);
-            self->ciphers.master = NULL;
-        }
-    keep_ciphers:
-        KCipherManagerRelease (mgr);
-    }
-    return rc;
-}
-
-
-
-/* ----------
- * MakeInt
- *    common make for all encryptor/decryptors
- */
-static
-rc_t KEncFileV1MakeInt (KEncFileV1 ** pself, KFile * encrypted,
-                      const KFile_vt_v1 * vt, bool r, bool w, bool v)
-{
-    KEncFileV1 * self;
-    rc_t rc;
-
-    assert (pself);
-    assert (encrypted);
-
-    /* allocate and zero out an object since we want much of it to be zeroed */
-    self = calloc (sizeof *self, 1);
-    if (self == NULL)
-    {
-        rc = RC (rcFS, rcFile, rcConstructing, rcMemory, rcExhausted);
-        LOGERR (klogSys, rc,
-                "out of memory creating encrypter and/or decryptor");
-    }
-    else
-    {
-        /* all KFiles get this initialization */
-        rc = KFileInit (&self->dad, (const KFile_vt*)vt, "KEncFileV1", "no-name", r, w);
-        if (rc)
-            LOGERR (klogInt, rc, "failure initialize encrypted file root class");
-        else
-        {
-            rc = KFileAddRef (encrypted);
-            if (rc == 0)
-            {
-                self->encrypted = encrypted;
-                *pself = self;
-                return 0;
-            }
-        }
-        free (self);
-    }
-    return rc;
-}
-
-
-/* ----------
- * MakeCmn
- * common parameter validation for all encryptor/decryptors
- */
-static
-rc_t KEncFileV1MakeCmn (KEncFileV1 ** pself, KFile * encrypted, const KKey * key,
-                      const KFile_vt_v1 * vt, bool r, bool w)
-{
-    rc_t rc = 0;
-
-    do
-    {
-        CRC32Init();    /* likely to be called way too often */
-
-        if (pself == NULL)
-        {
-            rc = RC (rcFS, rcFile, rcConstructing, rcSelf, rcNull);
-            LOGERR (klogErr, rc,
-                    "pointer to self NULL when creating "
-                    "an encryptor/decryptor");
-            break;
-        }
-        *pself = NULL;
-
-        if (encrypted == NULL)
-        {
-            rc = RC (rcFS, rcFile, rcConstructing, rcParam, rcNull);
-            LOGERR (klogErr, rc, 
-                    "encrypted file not supplied when creating "
-                    "an encryptor/decryptor");
-            break;
-        }
-
-        if (key == NULL)
-        {
-            rc = RC (rcFS, rcFile, rcConstructing, rcParam, rcNull);
-            LOGERR (klogErr, rc, 
-                    "key not supplied when creating an encryptor/decryptor");
-            break;
-        }
-
-        switch (key->type)
-        {
-        default:
-            rc = RC (rcFS, rcFile, rcConstructing, rcParam, rcInvalid);
-            PLOGERR (klogErr,
-                     (klogErr, rc, "invalid key type '$(T)' should be "
-                      "kkeyAES128(1), kkeyAES192(2) or kkeyAES256(3)",
-                      "T=%u", key->type));
-            break;
-
-        case kkeyAES128:
-        case kkeyAES192:
-        case kkeyAES256:
-            break;
-        }
-        if (rc == 0)
-        {
-            KEncFileV1 * self;
-
-            assert (vt);
-            assert ((r == true) || (r == false));
-            assert ((w == true) || (w == false));
-
-            rc = KEncFileV1MakeInt (&self, encrypted, vt, r, w, false);
-            if (rc == 0)
-            {
-                rc = KEncFileV1CiphersInit (self, key, r, w);
-                if (rc == 0)
-                {
-                    *pself = self;
-                    return 0;
-                }
-                KFileRelease (&self->dad);
-            }
-        }
-    } while (0);
-    return rc;
-}
-
-
-
-static const KFile_vt_v1 vtKEncFileV1Read =
-{
-    /* version */
-    1, 1,
-
-    /* 1.0 */
-    KEncFileV1DestroyRead,
-    KEncFileV1GetSysFileUnsupported,
-    KEncFileV1RandomAccess,
-    KEncFileV1SizeUnsupported,
-    KEncFileV1SetSizeUnsupported,
-    KEncFileV1Read,
-    KEncFileV1WriteUnsupported,
-
-    /* 1.1 */
-    KEncFileV1Type
-};
-static const KFile_vt_v1 vtKEncFileV1Write =
-{
-    /* version */
-    1, 1,
-
-    /* 1.0 */
-    KEncFileV1DestroyWrite,
-    KEncFileV1GetSysFileUnsupported,
-    KEncFileV1RandomAccessUnsupported,
-    KEncFileV1SizeUnsupported,
-    KEncFileV1SetSizeUnsupported,
-    KEncFileV1ReadUnsupported,
-    KEncFileV1Write,
-
-    /* 1.1 */
-    KEncFileV1Type
-};
-static const KFile_vt_v1 vtKEncFileV1Update =
-{
-    /* version */
-    1, 1,
-
-    /* 1.0 */
-    KEncFileV1DestroySwarm,
-    KEncFileV1GetSysFileUnsupported,
-    KEncFileV1RandomAccess,
-    KEncFileV1SizeUnsupported,
-    KEncFileV1SetSizeUnsupported,
-    KEncFileV1ReadUnsupported,
-    KEncFileV1WriteSwarm,
-
-    /* 1.1 */
-    KEncFileV1Type
-};
-static const KFile_vt_v1 vtKEncFileV1Validate =
-{
-    /* version */
-    1, 1,
-
-    /* 1.0 */
-    KEncFileV1DestroyRead,
-    KEncFileV1GetSysFileUnsupported,
-    KEncFileV1RandomAccessUnsupported,
-    KEncFileV1SizeUnsupported,
-    KEncFileV1SetSizeUnsupported,
-    KEncFileV1ReadUnsupported,
-    KEncFileV1WriteUnsupported,
-
-    /* 1.1 */
-    KEncFileV1Type
-};
-
-
-/* ----------
- * Read mode is fully seekable if the underlying KFile is seekable some
- * integrity checking will not be performed in allowing this seeking.
- */
-LIB_EXPORT rc_t CC KEncFileMakeRead_v1 (const KFile ** pself, 
-                                        const KFile * encrypted,
-                                        const KKey * key)
-{
-    KEncFileV1 * self;
-    rc_t rc;
-    rc = KEncFileV1MakeCmn (&self, (KFile *)encrypted, key, &vtKEncFileV1Read, 
-                          true, false);
-    if (rc)
-        LOGERR (klogErr, rc, "error constructing decryptor");
-    else
-    {
-        rc = KEncFileV1HeaderRead (self);
-        if (rc)
-            LOGERR (klogErr, rc, "error reading encrypted file header");
-        else
-        {
-            *pself = &self->dad;
-            return 0;
-        }
-        KFileRelease (&self->dad);
-    }
-    return rc;
-}
-
-
-/* ----------
- * Write mode encrypted file can only be written straight through form the
- * first byte to the last.
- */
-LIB_EXPORT rc_t CC KEncFileMakeWrite_v1 (KFile ** pself, 
-                                         KFile * encrypted,
-                                         const KKey * key)
-{
-    KEncFileV1 * self;
-    rc_t rc;
-
-    rc = KFileSetSize (encrypted, 0);
-#if 0
-    if (rc)
-        LOGERR (klogWarn, rc, "error truncating output file - "
-                "corrupted file might result");
-#endif
-
-    rc = KEncFileV1MakeCmn (&self, encrypted, key, &vtKEncFileV1Write, 
-                          false, true);
-    if (rc)
-        LOGERR (klogErr, rc, "error creating encryptor");
-    else
-        *pself = &self->dad;
-    return rc;
-}
-
-
-/* ----------
- * Update mode is read/write mode where seeking within the file is allowed.
- */
-
-
-LIB_EXPORT rc_t CC KEncFileV1MakeUpdate_v1 (KFile ** pself, 
-                                          KFile * encrypted,
-                                          const KKey * key)
-{
-    KEncFileV1 * self;
-    rc_t rc;
-
-    rc = KEncFileV1MakeCmn (&self, encrypted, key, &vtKEncFileV1Update, 
-                          false, true);
-    if (rc)
-        LOGERR (klogErr, rc, "error creating encryptor");
-    else
-    {
-        self->swarm = true;
-        *pself = &self->dad;
-    }
-    return rc;
-}
-
-
-/* ----------
- * Validate mode is useful only for the KFileEncValidate function
- */
-static
-rc_t KEncFileV1MakeValidate (const KEncFileV1 ** pself, const KFile * encrypted)
-{
-    KEncFileV1 * self;
-    rc_t rc;
-
-    assert (pself);
-    assert (encrypted);
-
-    rc = KEncFileV1MakeInt (&self, (KFile*)encrypted, &vtKEncFileV1Validate, true, false, true);
-    if (rc)
-        LOGERR (klogErr, rc, "error making KEncFileV1");
-    else
-    {
-        rc = KEncFileV1HeaderRead (self);
-        if (rc)
-            LOGERR (klogErr, rc, "error reading encrypted file header");
-        else
-        {
-            *pself = self;
-            return 0;
-        }
-    }
-    *pself = NULL;
-    return rc;
-}
-
-
-/* ----------
- * Validate mode can not be read or written.
- * Upon open the whole file is read from begining to end and all CRC
- * and other integrity checks are performed immedaitely
- */
-LIB_EXPORT rc_t CC KEncFileV1Validate_v1 (const KFile * encrypted)
-{
-    const KEncFileV1 * file;
-    rc_t rc;
-
-    /* fail if a NULL parameter: can't validate all addresses */
-    if (encrypted == NULL)
-    {
-        rc = RC (rcKrypto, rcFile, rcValidating, rcParam, rcNull);
-        LOGERR (klogErr, rc, "encrypted file was null when trying to validate");
-        return rc;
-    }
-
-    /* if the parameter is already a KEncFileV1 work on the file behind it instead */
-    /* we definitely can't work on a file being written that has not been closed */
-    if (encrypted->vt == (const KFile_vt*)&vtKEncFileV1Read)
-        encrypted = (const KFile *)(((const KEncFileV1*)encrypted)->encrypted);
-
-    /* file header is validated within the call to Make Validate */
-    rc = KEncFileV1MakeValidate (&file, encrypted);
-    if (rc)
-        LOGERR (klogErr, rc,
-                "unable to validate encrypted file due to "
-                "inability to open as encrypted file");
-    else
-    {
-        uint64_t pos;             /* position within the encrypted file */
-        uint64_t block_count = 0; /* how many blocks have we read */
-
-        /* loop through all data blocks */
-        pos = sizeof (KEncFileHeader);
-        for (block_count = 0; ; ++block_count)
-        {
-            KEncFileBlock block;
-
-            STSMSG (2, ("reading block '%u' at '%lu'", block_count,
-                        BlockId_to_EncryptedPos(block_count)));
-           
-            rc = KEncFileV1BlockRead (file, block_count, &block, true);
-            if (rc)
-            {
-                STSMSG (2, ("read error at block '%u'", block_count));
-                break;
-            }
-            if (file->eof)
-            {
-                STSMSG (2, ("block '%u' was end", block_count));
-
-                break;
-            }
-            pos += sizeof (KEncFileData);
-        }
-        KFileRelease (&file->dad);
-    }
-    return (rc);
-}
-
-
-LIB_EXPORT rc_t CC KFileIsEnc_v1 (const char * buffer, size_t buffer_size)
-{
-    const KEncFileHeader * header;
-
-    if ((buffer == NULL) || (buffer_size == 0))
-        return RC  (rcFS, rcFile, rcIdentifying, rcParam, rcNull); 
-
-    header = (const KEncFileHeader*)buffer;
-
-    if (buffer_size < sizeof header->file_sig)
-        return RC (rcFS, rcFile, rcIdentifying, rcBuffer, rcInsufficient); 
-
-    if (buffer_size > sizeof (*header))
-        buffer_size = sizeof (*header);
-
-    if ((memcmp (header, &const_header, buffer_size) == 0) ||
-        (memcmp (header, &const_bswap_header, buffer_size) == 0)
-#if ENABLE_V2
-        ||
-        (memcmp (header, &const_header_v1, buffer_size) == 0) ||
-        (memcmp (header, &const_bswap_header_v1, buffer_size) == 0)
-#endif
-        )
-        return 0;
-
-    return RC (rcFS, rcFile, rcIdentifying, rcFile, rcWrongType); 
-}
-
-
-
-/* ----------
- * Read mode is fully seekable if the underlying KFile is seekable some
- * integrity checking will not be performed in allowing this seeking.
- */
-LIB_EXPORT rc_t CC KEncFileMakeRead (const struct KFile ** pself,
-                                        const struct KFile * encrypted_input,
-                                        const struct KKey * key)
-{
-#if USE_READ_V1
-    return KEncFileV1MakeRead_v1 (pself, encrypted_input, key);
-#else
-    return KEncFileMakeRead_v2 (pself, encrypted_input, key);
-#endif
-}
-
-
-/* ----------
- * Write mode encrypted file can only be written straight through from the
- * first byte to the last.
- */
-LIB_EXPORT rc_t CC KEncFileMakeWrite (struct KFile ** pself,
-                                         struct KFile * encrypted_output,
-                                         const struct KKey * key)
-{
-#if USE_WRITE_V1
-    return KEncFileV1MakeWrite_v1 (pself, encrypted_output, key);
-#else
-    return KEncFileMakeWrite_v2 (pself, encrypted_output, key);
-#endif
-}
-
-/* ----------
- * Update mode is read/write mode where seeking within the file is allowed.
- *
- * NOTE this is in the private interface because it is not actually working
- * yet.
- */
-LIB_EXPORT rc_t CC KEncFileMakeUpdate (struct KFile ** pself, 
-                                       struct KFile * encrypted,
-                                       const struct KKey * key)
-{
-#if USE_UPDATE_V1
-    return KEncFileV1MakeUpdate_v1 (pself, encrypted, key);
-#else
-    return KEncFileMakeUpdate_v2 (pself, encrypted, key);
-#endif
-}
-LIB_EXPORT rc_t CC KEncFileMakeWriteBlock (struct KFile ** pself, 
-                                           struct KFile * encrypted,
-                                           const struct KKey * key)
-{
-#if USE_BLOCK_V1
-    return KEncFileV1MakeUpdate_v1 (pself, encrypted, key);
-#else
-    return KEncFileMakeBlock_v2 (pself, encrypted, key);
-#endif
-}
-
-
-LIB_EXPORT rc_t CC KEncFileWriteHeader  (KFile * self)
-{
-#if USE_BLOCK_V1
-    return KEncFileV1WriteHeader_v1  (self);
-#else
-    return KEncFileWriteHeader_v2  (self);
-#endif
-}
-
-
-/* ----------
- * Validate mode can not be read or written.
- * Upon open the whole file is read from begining to end and all CRC
- * and other integrity checks are performed immedaitely
- */
-LIB_EXPORT rc_t CC KEncFileValidate (const struct KFile * encrypted)
-{
-#if USE_VALIDATE_V1
-    return KEncFileV1Validate_v1 (encrypted);
-#else
-    return KEncFileValidate_v2 (encrypted);
-#endif
-}
-
-
-/* ----------
- * Identify whether a file is a KEncFile type encrypted file by the header.
- * read the header into a buffer and pass it into this function.  
- * The buffer_size needs to be at least 8 but more bytes lead to a better
- * check up to the size of the header of a KEncFile type encrypted file.
- * As the header may change in the future (in a backwards compatible way)
- * that size might change from the current 16.
- *
- * Possible returns:
- * 0:
- *      the file is an identified KEncFile type file.  False positives are
- *      possible if a file happens to match at 8 or more bytes
- *
- * RC (rcFS, rcFile, rcIdentifying, rcFile, rcWrongType)
- *      the file is definitely not a KEncFile type encrypted file.
- *     
- * RC (rcFS, rcFile, rcIdentifying, rcParam, rcNull)
- *      bad parameters in the call
- *
- * RC (rcFS, rcFile, rcIdentifying, rcBuffer, rcInsufficient)
- *      not a large enough buffer to make an identification
- */
-LIB_EXPORT rc_t CC KFileIsEnc (const char * buffer, size_t buffer_size)
-{
-#if USE_ISENC_V1
-    return KFileIsEnc_v1 (buffer, buffer_size);
-#else
-    return KFileIsEnc_v2 (buffer, buffer_size);
-#endif
-}
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-
-/* end of file encfile.c */
-
diff --git a/libs/krypto/encfilev2.c b/libs/krypto/encfilev2.c
deleted file mode 100644
index 44d82bd..0000000
--- a/libs/krypto/encfilev2.c
+++ /dev/null
@@ -1,2589 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-#include <krypto/extern.h>
-#include <krypto/encfile.h>
-#include <krypto/encfile-priv.h>
-#include "encfile-priv.h"
-#include <krypto/cipher.h>
-#include <krypto/ciphermgr.h>
-#include <krypto/key.h>
-
-/* #include "aes-priv.h" */
-
-#include <klib/rc.h>
-#include <klib/checksum.h>
-#include <klib/log.h>
-#include <klib/out.h>
-#include <klib/debug.h>
-#include <klib/status.h>
-/* #include <klib/vector.h> */
-/* #include <klib/status.h> */
-#include <kfs/file.h>
-#include <kfs/sra.h>
-#include <sysalloc.h>
-
-#include <byteswap.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-/* #include <klib/out.h> */
-
-
-/* ----------------------------------------------------------------------
- * KEncFile
- *   Base object class for the encryption, decryption and validation of
- *   the file format defined above
- */
-
-#define KFILE_IMPL struct KEncFile
-#include <kfs/impl.h>
-
-
-#include "encfile-priv.h"
-
-typedef struct KEncFileCiphers KEncFileCiphers;
-struct KEncFileCiphers
-{
-    KCipher * master;
-    KCipher * block;
-};
-
-
-typedef struct KEncFileIVec { uint8_t ivec [16]; } KEncFileIVec;
-
-/* -----
- */
-struct KEncFile
-{
-    KFile dad;                  /* base class */
-    KFile * encrypted;          /* encrypted file as a KFile */
-    KEncFileCiphers ciphers;    /* file and block ciphers */
-    KEncFileBlock block;        /* current data block */
-    KEncFileFooter foot;        /* contains crc checksum and block count */
-    uint64_t dec_size;          /* size of decrypted file */
-    uint64_t enc_size;          /* size of encrypted file */
-    bool dirty;                 /* data written but not flushed set in Write cleared in Flush*/
-    bool seekable;              /* we can seek within the encrypted file */
-    bool size_known;            /* can we know the size? Only streaming read can not know */
-    bool bswap;                 /* file created on system of opposite endianess */
-    bool changed;               /* some write has happened cleared in Make, set in BufferWrite */
-    bool sought;                /* did a seek on a read or write invalidating crc checksum */
-    bool has_header;            /* have we read or written a header? */
-    bool eof;                   
-    bool sra;                   /* we know we are encrypting an SRA/KAR archive file */
-    bool swarm;                 /* block mode for swarm mode using KReencFile or KEncryptFile */
-    KEncFileVersion version;    /* version from the header if read; or the one being written */
-};
-
-
-/* ----------
- * BufferCalcMD5
- *    Generate the MD5 digest for a buffer
- */
-static __inline__
-void BufferCalcMD5 (const void * buffer, size_t size, uint8_t digest [16])
-{
-    MD5State state;
-
-    assert (buffer);
-    assert (size);
-    assert (digest);
-
-    MD5StateInit (&state);
-    MD5StateAppend (&state, buffer, size);
-    MD5StateFinish (&state, digest);
-}
-
-
-/* -----
- * return true or false as to whether the the buffer described is all 0 bits
- */
-static __inline__
-bool BufferAllZero (const void * buffer_, size_t size)
-{
-    const uint8_t * buffer;
-    size_t count;
-    bool ret;
-
-    assert (buffer_);
-
-    buffer = buffer_;
-    ret = true;
-
-    for (count = 0; count < size; ++count)
-    {
-        if (buffer[count] != '\0')
-        {
-            ret = false;
-            break;
-        }
-    }
-    return ret;
-}
-
-
-/* ----------
- * BufferRead
- *    Read from an encrypted file and update size if warranted
- *
- * Read's aren't guaranteed to get full amount
- */
-static
-rc_t KEncFileBufferRead (KEncFile * self, uint64_t offset, void * buffer,
-                         size_t bsize, size_t * num_read)
-{
-    rc_t rc;
-
-    assert (self);
-    assert (self->encrypted);
-    assert (buffer);
-    assert (bsize > 0);
-    assert (num_read);
-
-    rc = KFileReadAll (self->encrypted, offset, buffer, bsize, num_read);
-    if (rc == 0)
-    {
-        if (self->enc_size < offset + *num_read)
-        {
-            self->enc_size = offset + *num_read;
-        }
-    }
-/* leave logging to callers? */
-    else
-        PLOGERR (klogErr, (klogErr, rc, "Error reading from encrypted file "
-                           "at '$(P)", "P=%lu", offset));
-
-    return rc;
-}
-
-
-/* ----------
- * BufferWrite
- *    write to an encrypted file, mark it as changed and update size if warranted
- */
-static
-rc_t KEncFileBufferWrite (KEncFile * self, uint64_t offset, const void * buffer,
-                          size_t bsize, size_t * num_writ)
-{
-    rc_t rc = 0;
-
-    assert (self);
-    assert (self->encrypted);
-    assert (buffer);
-    assert (bsize > 0);
-    assert (num_writ);
-
-    rc = KFileWriteAll (self->encrypted, offset, buffer, bsize, num_writ);
-    if (rc)
-/* leave logging to callers? */
-        PLOGERR (klogErr, (klogErr, rc, "Error writing to encrypted file "
-                           "at '$(P)", "P=%lu", offset));
-    if (bsize != *num_writ)
-    {
-/*         KOutMsg ("%s: bsize %zu *num_writ %zu\n",__func__, bsize, *num_writ); */
-        rc = RC (rcKrypto, rcFile, rcWriting, rcTransfer, rcIncomplete);
-/* leave logging to callers? */
-        PLOGERR (klogErr, (klogErr, rc, "Error writing full buffer to"
-                           " encrypted file at '$(P) wrote '$(W)'",
-                           "P=%lu,W=%zu", offset, *num_writ));
-    }
-    else if (*num_writ > 0)
-    {
-        self->changed = true;
-        if (self->enc_size < offset + *num_writ)
-        {
-            self->enc_size = offset + *num_writ;
-        }
-    }
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * operations on KEncFileHeader
- *
- * The header only needs to be read and validated or written  we need not 
- * reatian within the KEncFile object any information about the header in
- * the initial version of this file format.
- */
-
-/* -----
- * the first eight bytes of the file are two four byte strings
- *  The first is a common "NCBI"
- *  The second is the format specific "nenc"
- */
-static const KEncFileSig KEncFileSignature = "NCBInenc";
-
-
-/* -----
- * the common constant used throughout the project to check the byte order 
- * as written by the system which created the file
- */
-/* enum fails to handle these due to integer overflow */
-
-#define eEncFileByteOrderTag     (0x05031988)
-#define eEncFileByteOrderReverse (0x88190305)
-
-/* ----
- */
-#define eCurrentVersion        (0x00000002)
-#define eCurrentVersionReverse (0x02000000)
-
-
-static
-const KEncFileHeader const_header
-= { "NCBInenc", eEncFileByteOrderTag, eCurrentVersion };
-
-
-static
-const KEncFileHeader const_bswap_header
-= { "NCBInenc", eEncFileByteOrderReverse, eCurrentVersionReverse };
-
-/* skipping v1 for NCBIkenc */
-static
-const KEncFileHeader const_header_sra
-= { "NCBIsenc", eEncFileByteOrderTag, eCurrentVersion };
-
-
-static
-const KEncFileHeader const_bswap_header_sra
-= { "NCBIsenc", eEncFileByteOrderReverse, eCurrentVersionReverse };
-
-    
-/* ----------
- * HeaderRead
- *    Read the header of an encrypted file and validate it.
- *
- * We only allow a missing header for an empty file opened for update
- */
-static
-rc_t KEncFileHeaderRead (KEncFile * self)
-{
-    KEncFileHeader header;
-    size_t num_read;
-    rc_t rc;
-
-    assert (self);
-
-    rc = KEncFileBufferRead (self, 0, &header, sizeof (header), &num_read);
-    if (rc)
-        LOGERR (klogErr, rc, "error reading encrypted file header");
-
-    else if ((num_read == 0) && (self->dad.write_enabled))
-    {
-        /* only allow read to fail with zero length if opened with write */
-        self->version = eCurrentVersion;
-        self->bswap = false;
-        self->enc_size = 0; /* redundant? */
-        self->dec_size = 0; /* redundant? */
-    }
-    else if (num_read != sizeof (header))
-    {
-        rc = RC (rcFS, rcFile, rcConstructing, rcHeader, rcTooShort);
-        PLOGERR (klogErr,
-                 (klogErr, rc, "error reading full header of encrypted "
-                  "file  wanted '$(S)' got '$(N); bytes read", "S=%u,N=%u",
-                  sizeof (header), num_read));
-    }
-    else
-    {
-        rc_t orc;
-
-        if (memcmp (header.file_sig, const_header.file_sig,
-                     sizeof (header.file_sig)) == 0)
-            self->sra = false;
-        else if (memcmp (header.file_sig, const_header_sra.file_sig,
-                         sizeof (header.file_sig)) == 0)
-            self->sra = true;
-        else
-        {
-            rc = RC (rcFS, rcFile, rcConstructing, rcHeader, rcInvalid);
-            LOGERR (klogErr, rc, "file signature not correct for encrypted file");
-        }
-
-        switch (header.byte_order)
-        {
-        case eEncFileByteOrderTag:
-            self->bswap = false;
-            self->version = header.version;
-            break;
-
-        case eEncFileByteOrderReverse:
-            self->bswap = true;
-
-            /* assert for the right bswap call */
-            assert (sizeof (self->version) == 4);
-
-            self->version = bswap_32 (header.version);
-            break;
-
-        default:
-            orc = RC (rcFS, rcFile, rcConstructing, rcByteOrder, rcInvalid);
-            PLOGERR (klogErr, (klogErr, rc, "invalid byte order flag '$(F); in "
-                               "encrypted file header", "F=%X",
-                               header.byte_order));
-            if (rc == 0)
-                rc = orc;
-            break;
-        }
-
-        if ((self->version > eCurrentVersion) || (self->version == 0))
-        {
-            orc = RC (rcFS, rcFile, rcConstructing, rcHeader, rcBadVersion);
-            PLOGERR (klogErr, (klogErr, orc, "can not decrypt version '$(V)'",
-                               "V=%u", header.version));
-            if (rc == 0)
-                rc = orc;
-        }
-        if (rc == 0)
-            self->has_header = true;
-    }
-    return rc;
-}
-
-
-/* -----
- * HeaderWrite
- */
-#ifndef SENC_IS_NENC_FOR_WRITER
-#define SENC_IS_NENC_FOR_WRITER 1
-#endif
-
-static
-rc_t KEncFileHeaderWrite (KEncFile * self)
-{
-    rc_t rc;
-    size_t num_writ;
-    const KEncFileHeader * head;
-
-#if SENC_IS_NENC_FOR_WRITER
-    head = self->sra 
-        ? (self->bswap ? &const_bswap_header_sra : &const_header_sra)
-        : (self->bswap ? &const_bswap_header : &const_header);
-#else
-    head = self->bswap ? &const_bswap_header : &const_header;
-#endif
-
-    rc = KEncFileBufferWrite (self, 0, head, sizeof * head, &num_writ);
-    if (rc)
-        LOGERR (klogErr, rc, "Failed to write encrypted file header");
-
-    else
-        /* forced upgrade by writing the header */
-        self->version = eCurrentVersion;
-
-    if (rc == 0)
-        self->has_header = true;
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KEncFileWriteHeader_v2  (KFile * self)
-{
-    if (self == NULL)
-        return RC (rcKrypto, rcFile, rcWriting, rcSelf, rcNull);
-
-    return KEncFileHeaderWrite ((KEncFile*)self);
-}
-
-
-
-/* ----------------------------------------------------------------------
- * operations on KEncFileFooter
- */
-
-/* ----------
- * Validate
- * we expect to read a Footer when we expect a Block so we validate in RAM
- * without a Read
- *
- * we're just comparing the values in the footer against expected values
- */
-static
-rc_t KEncFileFooterValidate (const KEncFile * self, 
-                             const uint64_t block_count,
-                             const uint64_t crc_checksum)
-{
-    rc_t rc1 = 0, rc2 = 0;
-
-    assert (self);
-
-    if (self->foot.block_count != block_count)
-    {
-        rc1 = RC (rcKrypto, rcFile, rcValidating, rcFile, rcCorrupt);
-        LOGERR (klogErr, rc1, "bad block count in encrypted file footer");
-    }
-    /*
-     * crcs should match or the crc should be 0 and the version is 1
-     */
-    if ((self->foot.crc_checksum != crc_checksum) &&
-        ((self->version == 1) || (crc_checksum != 0)))
-    {
-        rc2 = RC (rcKrypto, rcFile, rcValidating, rcChecksum, rcCorrupt);
-        LOGERR (klogErr, rc2, "bad crc checksum in encrypted file footer");
-    }
-    return (rc1 ? rc1 : rc2);
-}
-
-
-static __inline__
-void KEncFileFooterSwap (const KEncFile * self, KEncFileFooter * foot)
-{
-    assert (self);
-    assert (foot);
-
-    if (self->bswap)
-    {
-        assert (sizeof (foot->block_count) == 8);
-        foot->block_count = bswap_64 (foot->block_count);
-
-        assert (sizeof (foot->crc_checksum) == 8);
-        foot->crc_checksum = bswap_64 (foot->crc_checksum);
-    }
-}
-
-
-/* ----------
- * Read
- * If we know where the footer is we can read it specifically
- */
-static
-rc_t KEncFileFooterRead (KEncFile * self, const uint64_t pos,
-                         const bool validate)
-{
-    union foot_plus
-    {
-        KEncFileFooter foot;
-        uint8_t bytes [sizeof (KEncFileFooter) + 1];
-    } u;
-    size_t num_read;
-    rc_t rc;
-
-    assert ((self->size_known == true) || (self->size_known == false));
-    assert (((self->size_known == true) &&
-             ((pos + sizeof (u.foot)) == self->enc_size)) ||
-            (pos == self->enc_size));
-
-    /* try to read too much just to validate nothing after the footer */
-    rc = KEncFileBufferRead (self, pos, u.bytes, sizeof u.bytes, &num_read);
-    if (rc)
-        PLOGERR (klogErr, (klogErr, rc, "failed to read encrypted file footer "
-                           "at '$(P)'", "P=%lu", pos));
-
-    else if (num_read == sizeof u.foot)
-    {
-        KEncFileFooterSwap (self, &u.foot);
-
-        if (validate)
-            rc = KEncFileFooterValidate (self, u.foot.block_count,
-                                         u.foot.crc_checksum);
-
-        if (rc == 0)
-        {
-            self->foot.block_count = u.foot.block_count;
-            self->foot.crc_checksum = u.foot.crc_checksum;
-        }
-    }
-    else if (num_read < sizeof u.foot)
-        rc = RC (rcKrypto, rcFile, rcReading, rcSize, rcInsufficient);
-
-    else
-    {
-        assert (num_read > sizeof u.foot);
-        rc = RC (rcKrypto, rcFile, rcReading, rcSize, rcExcessive);
-    }
-
-    return rc;
-}
-
-
-/* ----------
- * Write
- * when we write a footer we write from the values in the object.  They
- * are stored in the same object format as the footer so its very simple
- */
-static
-rc_t KEncFileFooterWrite (KEncFile * self)
-{
-    KEncFileFooter foot;
-    uint64_t pos;
-    size_t num_writ;
-    rc_t rc;
-
-    if (self->sought)
-    {
-        self->foot.block_count = foot.block_count = 1 + DecryptedPos_to_BlockId (self->dec_size, NULL);
-        foot.crc_checksum = 0;
-    }
-    else
-        memcpy (&foot, &self->foot, sizeof (foot));
-
-    KEncFileFooterSwap (self, &foot);
-
-    if (self->sought)
-        foot.crc_checksum = 0;
-
-    pos = BlockId_to_EncryptedPos (self->foot.block_count);
-
-    assert ((self->size_known == true) || (self->size_known == false));
-
-/*     if (!(((self->size_known == true) && */
-/*              ((pos + sizeof (foot)) == self->enc_size)) || */
-/*           (pos == self->enc_size))); */
-/*     { */
-/*         KOutMsg ("self->foot.block_count %lu\n",self->foot.block_count); */
-/*         KOutMsg ("self->size_known %u\n",self->size_known); */
-/*         KOutMsg ("pos %lu\n",pos); */
-/*         KOutMsg ("sizeof (foot) %zu\n",sizeof (foot)); */
-/*         KOutMsg ("pos + sizeof (foot) %lu\n", pos + sizeof (foot)); */
-/*         KOutMsg ("self->enc_size %lu\n",self->enc_size); */
-/*     } */
-/*     assert (((self->size_known == true) && */
-/*              ((pos + sizeof (foot)) == self->enc_size)) || */
-/*             (pos == self->enc_size)); */
-
-    rc = KEncFileBufferWrite (self, pos, &foot, sizeof (foot),
-                              &num_writ);
-    if (rc == 0)
-    {
-        if (num_writ != sizeof (foot))
-        {
-            rc = RC (rcFS, rcFile, rcWriting, rcFile, rcInsufficient);
-            LOGERR (klogErr, rc, "faled to write correctly sized fotter "
-                    "for encrypted file");
-        }
-        else
-            assert ((pos + sizeof (foot)) == self->enc_size);
-    }
-    return rc;
-}
-
-
-/* ----------
- * IvecInit
- *    create the ivec for a given block
- *    done in a function to ensure decrypt and encrypt use the same code to
- *    generate this.  Anything used to create this has to be available to
- *    code that doesn't know the content of the data or the state of the file
- *    beyond the location of the block with in the file.
- *
- *    This is definitely over-kill using the MD5.
- */
-static __inline__
-void KEncFileIVecInit (const uint64_t block_id, KEncFileIVec * ivec)
-{
-    BufferCalcMD5 (&block_id, sizeof block_id, ivec->ivec);
-}
-
- 
-/* ----------
- * BlockEncrypt
- *
- * Not thread safe - use of cipher schedules ivec and block key in the ciphers
- *
- * If this function were a protected region where only one thread could be in
- * the body of this function at a time it could be made thread safe.
- */
-static
-rc_t KEncFileBlockEncrypt (KEncFile * self, KEncFileBlock * d,
-                           KEncFileBlock * e)
-{
-    SHA256State state;
-    uint64_t id;
-    uint16_t valid;
-    uint16_t saved_valid;
-    KEncFileCRC crc;
-    KEncFileIVec ivec;
-    rc_t rc;
-
-    assert (self);
-    assert (d);
-    assert (e);
-
-    /*
-     * First we finish preparing the two ciphers by creating the block
-     * user key out of the first part of the data and the shared Initialization
-     * vector for Chained Block Cipher mode encryption out of the block id
-     * 
-     * create the initialization vector for this block
-     */
-    KEncFileIVecInit (d->id, &ivec);
-
-    /*
-     * set the ivec for both the master and data block ciphers
-     */
-    rc = KCipherSetEncryptIVec (self->ciphers.master, &ivec);
-    if (rc)
-        return rc;
-
-    rc = KCipherSetEncryptIVec (self->ciphers.block, &ivec);
-    if (rc)
-        return rc;
-
-    /*
-     * create the block user key out of the first 4kb of data and the block id 
-     */
-    saved_valid = valid = d->u.valid;
-    id = d->id;
-
-    SHA256StateInit (&state);
-    SHA256StateAppend (&state, d->data, 
-                       valid > 4096 ? 4096 : valid);
-    SHA256StateAppend (&state, &id, sizeof (id));
-    SHA256StateFinish (&state, d->key);
-        
-    /*
-     * create the block key schedule out of the block user key
-     */
-    rc = KCipherSetEncryptKey (self->ciphers.block, d->key, sizeof d->key);
-    if (rc)
-        return rc;
-
-    /* 
-     * Salt the block using the randomish user key to randomly select
-     * data from the valid data.
-     *
-     * This will cover the data portion of the block past the last valid
-     * byte.
-     *
-     * NOTE we are accessing a byte array as a word array. COuld be trouble
-     *      on some archaic processors such as the MC68000 family.
-     *
-     * NOTE we are using the array named data to access data beyond it's end
-     *      based on knowledge of the structure of the KEncFileBlock.
-     */
-    {
-        uint16_t * pw;
-        unsigned int windex;
-        unsigned int rindex;
-        size_t bindex;
-
-        pw = (uint16_t*)d->key;
-        windex = 0;
-
-        for (bindex = valid;
-             bindex < sizeof d->data + sizeof d->u; 
-             ++ bindex)
-        {
-            /* this goes beyond the end of the data array by design */
-            rindex = (size_t)pw[windex];
-            rindex %= bindex;
-
-            d->data[bindex] = d->data[rindex];
-        
-            ++rindex;
-            if (rindex >= sizeof self->block.key / sizeof *pw)
-                rindex = 0;
-        }
-    }
-
-    /* 
-     * If we are modifying a block created on a system with a different default
-     * Endian choice we'll need to byte swap the block id and the block valid
-     * count
-     */
-    if (self->bswap)
-    {
-        assert (sizeof id == 8);
-        id = bswap_64 (id);
-
-        assert (sizeof (valid = 2));
-        valid = bswap_16 (valid);
-    }
-
-    /* is this a bswap problem? */
-    if (saved_valid == sizeof d->data)
-        d->u.valid |= valid;
-    else
-        d->u.valid = valid;
-
-    e->id = id;
-
-    /* 
-     * encrypt the block user key into the buffer
-     */
-#if 0
-    {
-        unsigned iii;
-        KOutMsg ("v2 decrypted key %lu\n", d->id);
-        for (iii = 0; iii < sizeof (d->key); +++ iii) 
-            KOutMsg ("%2.2x ", d->key[iii]);
-        KOutMsg ("\n");
-    }
-#endif
-    rc = KCipherEncryptCBC (self->ciphers.master, d->key, e->key,
-                            sizeof (d->key) / sizeof (ivec));
-    if (rc)
-        return rc;
-#if 0
-    {
-        unsigned iii;
-        KOutMsg ("v2 encrypted key\n");
-        for (iii = 0; iii < sizeof (e->key); +++ iii) 
-            KOutMsg ("%2.2x ", e->key[iii]);
-        KOutMsg ("\n");
-    }
-#endif
-    /*
-     * encrypt the data, offset and valid values
-     */
-    rc = KCipherEncryptCBC (self->ciphers.block, 
-                            d->data, e->data,
-                            (sizeof d->data + sizeof d->u) / sizeof (ivec));
-    if (rc)
-        return rc;
-
-    d->u.valid = saved_valid;
-
-    crc = CRC32 (0, e, (char*)(&e->crc)-(char*)e);
-
-    self->block.crc = crc;
-
-    if (self->bswap)
-    {
-        assert (sizeof crc == 4);
-        crc = bswap_32 (crc);
-    }
-    e->crc_copy = e->crc = crc;
-
-/*     KOutMsg ("%s: %lu %lu %lu ", __func__, self->foot.block_count, self->foot.crc_checksum,self->block.id); */
-    if (self->foot.block_count <= self->block.id)
-        self->foot.block_count = self->block.id + 1;
-
-    if (!self->sought)
-        self->foot.crc_checksum += crc;
-
-/*     KOutMsg ("%lu %lu\n", __func__, self->foot.block_count, self->foot.crc_checksum); */
-
-    return 0;
-}
-
-
-/* ----------
- * BlockDecrypt
- *   decrypt decrypts the data from a KEncFileBlock into the KEncFileBlock
- *   in the KEncFile object
- *
- * Not thread safe - use of cipher schedules ivec and block key in the ciphers
- *
- * If this function were a protected region where only one thread could be in
- * the body of this function at a time it could be made thread safe.
- */
-static
-rc_t KEncFileBlockDecrypt (KEncFile * self, KEncFileBlockId bid,
-                           const KEncFileBlock * e, KEncFileBlock * d)
-{
-    KEncFileIVec ivec;
-    rc_t rc;
-
-    d->id = e->id;
-
-    /* create the initialization vector for this block */
-    KEncFileIVecInit (bid, &ivec);
-
-    /*
-     * set the ivec for both the master and data block ciphers
-     */
-    rc = KCipherSetDecryptIVec (self->ciphers.master, &ivec);
-    if (rc)
-        return rc;
-
-    rc = KCipherSetDecryptIVec (self->ciphers.block, &ivec);
-    if (rc)
-        return rc;
-
-    /* 
-     * decrypt the block key and initial vector using the user key and 
-     * the computer ivec
-     */
-    rc = KCipherDecryptCBC (self->ciphers.master, e->key, d->key,
-                            (sizeof e->key) / sizeof ivec);
-    if (rc)
-        return rc;
-
-    /* 
-     * now create the AES key for the block from the newly decrypted 
-     * block key
-     */
-    rc = KCipherSetDecryptKey (self->ciphers.block, d->key,
-                               sizeof d->key);
-    if (rc)
-        return rc;
-
-    rc = KCipherDecryptCBC (self->ciphers.block, e->data, d->data,
-                            (sizeof e->data + sizeof e->u) / sizeof ivec);
-    if (rc)
-        return rc;
-
-    if (self->bswap)
-    {
-        assert (sizeof d->u.valid == 2);
-        d->u.valid = bswap_16 (d->u.valid);
-    }
-
-    if (d->u.valid >= sizeof d->data)
-        d->u.valid = sizeof d->data;
-    else
-        memset (d->data + d->u.valid, 0, sizeof d->data - d->u.valid);
-
-    return rc;
-}
-
-
-/*
- * if not decrypting block can be NULL
- */
-
-/*
-  TBD: figure out rational way to handle bad password making blocks look really weird
-  If we have one that looks like a partial but isn't the last block -what do we do?
-*/
-
-static
-rc_t KEncFileBlockRead (KEncFile * self, KEncFileBlock * block, 
-                        KEncFileBlockId block_id, bool validate)
-{
-    union
-    {
-        KEncFileBlock b;
-        KEncFileFooter f;
-    } u;
-    size_t num_read;
-    uint64_t epos, dpos;
-    rc_t vrc, rc = 0;
-    bool missing;
-
-    assert (self);
-    assert ((validate == false) || (validate == true));
-    /* we should be decrypting or validating - maybe both */
-    assert ((block != NULL) || (validate == true));
-
-    /* translate block id into both encrypted and decrypted addresses */
-    epos = BlockId_to_EncryptedPos (block_id);
-    dpos = BlockId_to_DecryptedPos (block_id);
-
-    missing = false;
-
-    /* clear out target block */
-    if (block != NULL)
-        memset (block, 0, sizeof * block);
-
-    rc = KEncFileBufferRead (self, epos, &u.b, sizeof u.b, &num_read);
-    if (rc)
-    {
-        PLOGERR (klogErr, (klogErr, rc, "Failure to read block '$(B)' at '$(E)'"
-                           " in encrypted file decrypted at '$(D)",
-                           "B=%lu,E=%lu,D=%lu", block_id, epos, dpos));
-    }
-    else
-    {
-        switch (num_read)
-        {
-        case 0:
-            self->eof = true;
-            /* ain't got no block here */
-            break;
-
-        default:
-            /* Invalid size */
-            rc = RC (rcKrypto, rcFile, rcReading, rcBuffer, rcInsufficient);
-            PLOGERR (klogErr, (klogErr, rc, "Failure to read full block '$(B)' "
-                               "at '$(E)' in encrypted file decrypted at '$(D)",
-                               "B=%lu,E=%lu,D=%lu", block_id, epos, dpos));
-            break;
-
-        case sizeof (u.f):
-            /* footer */
-            if (validate) /* validate before checking as missing */
-            {
-                KEncFileFooterSwap (self, &u.f);
-
-                if (u.f.block_count != block_id)
-                {
-                    vrc = RC (rcKrypto, rcFile, rcValidating, rcSize,
-                              rcIncorrect);
-                    PLOGERR (klogErr,  (klogErr, vrc, "read footer block count "
-                                        "'$(B)' does not match actual block "
-                                        "count '$(A)'", "B=%lu,A=%lu",
-                                        u.f.block_count, block_id));
-                    if ( rc == 0 )
-                        rc = vrc;
-                }
-                vrc = KEncFileFooterValidate (self, u.f.block_count,
-                                              u.f.crc_checksum);
-
-#if 1
-                if ( rc == 0 )
-                    rc = vrc;
-#else
-                /* what is the significance of a NULL block? */
-                if (block == NULL)
-                    rc = vrc;
-#endif
-            }
-
-            /* is it a "missing" footer? */
-            /* or if the footer appears invalid - make it "valid" */
-            if (((missing = BufferAllZero(&u.f, sizeof u.f)) == true) ||
-                (self->foot.block_count != block_id))
-            {
-/*                 self->foot.block_count = block_id; */
-                self->foot.crc_checksum = 0;
-            }
-
-            /* force some values though they might already be known */
-            self->enc_size = epos + sizeof u.f;
-            self->size_known = true;
-            self->dec_size = dpos;
-            self->eof = true;
-            break;
-
-        case sizeof (u.b):
-            /* block */
-            self->eof = false;
-            /* is it a "missing" block? */
-            if ((missing = BufferAllZero(&u.b, sizeof u.b)) == true)
-            {
-                if (validate)
-                {
-                    vrc = RC (rcKrypto, rcFile, rcValidating,
-                                   rcData, rcNull);
-
-                    PLOGERR (klogErr, (klogErr, vrc, "read missing block at "
-                                       "block number '$(I)' encrypted position "
-                                       "$(E) decrypted postion $(D)",
-                                       "I=%lu,E=%lu,D=%lu", block_id, epos,
-                                       dpos));
-                    if ( rc == 0 )
-                        rc = vrc;
-                }
-                u.b.id = block_id;
-                u.b.u.valid = sizeof u.b.data;
-
-                /* if we can only learn of the size by reading and are thus scanning
-                 * through the current decrypt position must be the current known
-                 * decrypted side size
-                 */
-                if (!self->size_known)
-                {
-                    assert (dpos == self->dec_size);
-                    self->dec_size = dpos + sizeof u.b.data;
-                }
-                /*
-                 * if we know the decrypted size and it is less than what we
-                 * read, adjust the valid.  BUT this must not be for the block read
-                 * for the last block to know the decrypted size. A chicken and egg
-                 * problem.
-                 */
-                else if ((self->dec_size >= dpos) &&
-                         (self->dec_size < dpos + sizeof u.b.data))
-                    u.b.u.valid  = (uint16_t)(self->dec_size - dpos);
-            }
-
-            /* we read a full block that wasn't all zeroes */
-            else
-            {
-                /* since we've chosen not to standardize the file format byte ordering */
-                if (self->bswap)
-                {
-                    assert (sizeof u.b.crc == 4);
-                    u.b.crc = bswap_32 (u.b.crc);
-                    u.b.crc_copy = bswap_32 (u.b.crc_copy);
-
-                    assert (sizeof u.b.id == 8);
-                    u.b.id = bswap_64 (u.b.id);
-                }
-
-                if (validate)
-                {
-                    uint32_t crc;
-
-                    if (block_id != u.b.id)
-                    {
-                        vrc = RC (rcKrypto, rcFile, rcValidating, rcIndex,
-                                  rcIncorrect);
-                        PLOGERR (klogErr, (klogErr, vrc, "error validating id "
-                                           "for block '$(BID)' is not $(C2)", 
-                                           "BID=%lu,C2=%lu", block_id, u.b.id));
-                        if ( rc == 0 )
-                            rc = vrc;
-                    }
-
-                    crc = CRC32 (0, &u.b, (char*)&u.b.crc - (char*)&u.b);
-
-                    if (crc != u.b.crc)
-                    {
-                        vrc = RC (rcKrypto, rcFile, rcValidating, rcCrc, rcCorrupt);
-                        PLOGERR (klogErr,
-                                 (klogErr,
-                                  vrc,
-                                  "error validating crc for block '$(BID)' $(C1) is not $(C2)", 
-                                  "BID=%lu,C1=0x%X,C2=0x%X", block_id,
-                                  crc, u.b.crc));
-                        if ( rc == 0 )
-                            rc = vrc;
-                    }
-                    if (crc != u.b.crc_copy)
-                    {
-                        vrc = RC (rcKrypto, rcFile, rcValidating, rcCrc, rcCorrupt);
-                        PLOGERR (klogErr,
-                                 (klogErr,
-                                  vrc,
-                                  "error validating crc_copy for block '$(BID)' $(C1) is not $(C2)", 
-                                  "BID=%lu,C1=0x%X,C2=0x%X", block_id,
-                                  crc, u.b.crc_copy));
-                        if ( rc == 0 )
-                            rc = vrc;
-                    }
-                }
-            }
-            if (self->sought == false)
-            {
-                if (block_id == 0)
-                {
-                    self->foot.block_count = 1;
-                    self->foot.crc_checksum = u.b.crc;
-                }
-                else
-                {
-                    ++self->foot.block_count;
-                    self->foot.crc_checksum += u.b.crc;
-                }
-            }
-
-            if (block != NULL)
-            {
-                if (missing)
-                {
-                    if (self->dad.write_enabled == false)
-                        rc = RC (rcKrypto, rcFile, rcReading, rcData, rcIncomplete);
-                    else
-                    {
-                        memcpy (block, &u.b, sizeof u.b);
-                        rc = 0;
-                    }
-                }
-                else
-                {
-                    rc = KEncFileBlockDecrypt (self, block_id, &u.b, block);
-                    if (rc == 0)
-                    {
-                        if (block_id == 0)
-                        {
-                            rc_t sra = KFileIsSRA ((const char *)block->data, block->u.valid);
-                            self->sra =  (sra == 0);
-                        }
-
-                        if (!self->size_known)
-                        {
-                            assert (dpos == self->dec_size);
-                            self->dec_size = dpos + sizeof u.b.u.valid;
-                            if (u.b.u.valid != sizeof u.b.data)
-                            {
-                                self->size_known = true;
-                                self->enc_size = epos + sizeof u.b + sizeof self->foot;
-                            }
-                        }
-                    }
-                }
-            }
-            break;
-        }
-    }
-    return rc;
-}
-
-
-/*
- * Take a dirty block, encrypt it and write it to the backing file
- */
-static
-rc_t KEncFileBlockFlush (KEncFile * self, KEncFileBlock * dec_block)
-{
-    rc_t rc = 0;
-
-    assert (self);
-    assert (dec_block);
-
-
-    if (dec_block->id == 0)
-    {
-        rc = KFileIsSRA ((const char *)(dec_block->data), sizeof (KSraHeader));
-
-        /* we wait ALL the way until we try to flush the first block before we set
-         * the sra flag for write only files.
-         * we get it when we read the first block otherwise.
-         */
-        if (self->sra != (rc == 0))
-        {
-            self->sra = (rc == 0);
-            self->has_header = false;
-        }
-    }
-    if ((dec_block->id == 0) || (self->seekable))
-    {
-        if (!self->has_header)
-        {
-            if (!self->swarm)
-            {
-                rc = KEncFileHeaderWrite (self);
-                if (rc)
-                    return rc;
-            }
-            else if (dec_block->id == 0)
-                self->enc_size = sizeof (KEncFileHeader);
-        }
-    }
-
-/*     if (self->dirty) */
-    {
-        KEncFileBlock enc_block;
-
-        rc = KEncFileBlockEncrypt (self, dec_block, &enc_block);
-        if (rc == 0)
-        {
-            KEncFileBlockId block_id;
-            uint64_t pos;
-            size_t num_writ;
-
-            block_id = dec_block->id;
-
-            pos = BlockId_to_EncryptedPos (block_id);
-
-            rc = KEncFileBufferWrite (self, pos, &enc_block, sizeof enc_block,
-                                      &num_writ);
-
-            if (rc)
-                PLOGERR (klogErr, (klogErr, rc,
-                                   "error writing encrypted block '$(B)'",
-                                   "B=%lu", block_id));
-
-            else if (num_writ != sizeof enc_block)
-            {
-                rc = RC (rcKrypto, rcFile, rcWriting, rcBuffer, rcInsufficient);
-                PLOGERR (klogErr, (klogErr, rc, "error writing encrypted block "
-                                   "'$(B)' wrote '$(Z)' not '$(Y)'",
-                                   "B=%lu, Z=%zu", block_id, num_writ,
-                                   sizeof enc_block));
-            }
-            else
-                self->dirty = false;
-        }
-    }
-
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * Interface Functions
- *
- * Destroy
- *
- */
-static
-rc_t CC KEncFileDestroy (KEncFile *self)
-{
-    rc_t rc1 = 0;
-    rc_t rc2 = 0;
-    rc_t rc3 = 0;
-    rc_t rc4 = 0;
-    rc_t rc5 = 0;
-    rc_t rc6 = 0;
-
-    assert (self);
-
-    if (self->dad.write_enabled)
-    {
-        /*
-         * write the header if we've written nothing to an empty file
-         * or if we've written something which will mean a change to v2
-         * of the encrypted file format
-         */
-        if ((self->enc_size == 0) || (self->seekable && self->changed) ||
-            (self->has_header == false))
-            rc1 = KEncFileHeaderWrite (self);
-
-        /* write any dirty block */
-        if (self->dirty)
-            rc2 = KEncFileBlockFlush (self, &self->block);
-
-        /* [re]write footer */
-        if (self->changed)
-            rc3 = KEncFileFooterWrite (self);
-    }
-    rc4 = KFileRelease (self->encrypted);
-    rc5 = KCipherRelease (self->ciphers.master);
-    rc6 = KCipherRelease (self->ciphers.block);
-
-    free (self);
-    
-    if (rc1)
-        return rc1;
-    if (rc2)
-        return rc2;
-    if (rc3)
-        return rc3;
-    if (rc4)
-        return rc4;
-    if (rc5)
-        return rc5;
-    return rc6;
-}
-
-
-/* ----------------------------------------------------------------------
- * GetSysFile
- *  returns an underlying system file object
- *  and starting offset to contiguous region
- *  suitable for memory mapping, or NULL if
- *  no such file is available.
- *
- * We do not allow this for read, write or update as you can not memory map the 
- * unencrypted file in a meaningful way.
- */
-static
-struct KSysFile *CC KEncFileGetSysFile (const KEncFile *self, uint64_t *offset)
-{
-    assert (self);
-    assert (offset);
-
-    return NULL;
-}
-
-
-/* ----------------------------------------------------------------------
- * RandomAccess
- *
- *  returns 0 if random access, error code otherwise
- */
-static
-rc_t CC KEncFileRandomAccess (const KEncFile *self)
-{
-    assert (self != NULL);
-    assert ((self->seekable == true) || (self->seekable == false));
-
-    /* we checked for random access in the contructor */
-    if (self->seekable)
-        return 0;
-
-    return RC (rcFS, rcFile, rcUpdating, rcFunction, rcUnsupported);
-}
-
-
-/* ----------------------------------------------------------------------
- * Size
- *  returns size in bytes of file
- *
- *  "size" [ OUT ] - return parameter for file size
- */
-static
-rc_t CC KEncFileSize (const KEncFile *self, uint64_t *size)
-{
-    if (!self->size_known)
-        return RC (rcKrypto, rcFile, rcAccessing, rcSize, rcUnsupported);
-
-    *size = self->dec_size;
-    return 0;
-}
-
-
-/* ----------------------------------------------------------------------
- * SetSize
- *  sets size in bytes of file
- *
- *  "size" [ IN ] - new file size
- *
- * This is the size of the decrypted payload not of the encrypted file
- */
-static
-rc_t KEncFileSetSizeBlockFull (KEncFile *self, uint64_t block_id)
-{
-    if ((self->block.id == block_id) && (self->block.u.valid != 0))
-    {
-        if (self->block.u.valid < sizeof self->block.data)
-        {
-            self->block.u.valid = sizeof self->block.data;
-            self->dirty = true;
-        }
-        else
-            assert (self->block.u.valid  == sizeof self->block.data);
-    }
-    else
-    {
-        KEncFileBlock block;
-        rc_t rc;
-
-        rc = KEncFileBlockRead (self, &block, block_id, false);
-        if (rc)
-            return rc;
-
-/*         if (self->block.u.valid  != sizeof self->block.data) */
-/*         { */
-/*             OUTMSG (("%s: %u %u\n", __func__,self->block.u.valid,sizeof self->block.data)); */
-/*             OUTMSG (("%s: %lu %lu\n", __func__,self->block.id,block_id)); */
-/*         } */
-
-        /* only change block if not "missing" */
-        if (BufferAllZero (&block, sizeof block) == false)
-        {
-            assert (block.id == block_id);
-
-            /* only change if not already full - shouldnt get here if not? */
-            if (block.u.valid < sizeof block.data)
-            {
-                self->changed = self->sought = true;
-                block.u.valid = sizeof block.data;
-
-                rc = KEncFileBlockFlush (self, &block);
-                if (rc)
-                    return rc;
-            }
-            else
-                assert (self->block.u.valid  == sizeof self->block.data);
-        }
-    }
-    return 0;
-}
-
-
-static
-rc_t KEncFileSetSizeBlockPartial (KEncFile *self, uint64_t block_id, uint32_t valid)
-{
-    if ((self->block.id == block_id) && (self->block.u.valid != 0))
-    {
-        if (self->block.u.valid != valid)
-        {
-            self->block.u.valid = valid;
-            self->dirty = true;
-        }
-    }
-    else
-    {
-        KEncFileBlock block;
-        rc_t rc;
-
-        rc = KEncFileBlockRead (self, &block, block_id, false);
-        if (rc)
-            return rc;
-
-        /* only change block if not "missing" */
-        if (BufferAllZero (&block, sizeof block) == false)
-        {
-            assert (block.id == block_id);
-
-            if (block.u.valid != valid)
-            {
-                self->changed = self->sought = true;
-                block.u.valid = valid;
-                
-                rc = KEncFileBlockFlush (self, &block);
-                if (rc)
-                    return rc;
-            }
-        }
-    }
-    return 0;
-}
-
-
-static
-rc_t KEncFileSetSizeInt (KEncFile *self, uint64_t dec_size)
-{
-    uint64_t trim_size = 0;
-    uint64_t enc_size;
-    bool do_size = true;
-
-    rc_t rc = 0;
-
-    /* should we not have been called? */
-    if ((dec_size == self->dec_size) && (self->enc_size != 0))
-        return 0;
-
-    /* if wiping out the whole file */
-    if (dec_size == 0)
-    {
-        trim_size = sizeof (KEncFileHeader);
-        enc_size = (sizeof (KEncFileHeader) + sizeof (KEncFileFooter));
-
-        /* if we did clear out the RAM structures to match */
-        memset (&self->block, 0, sizeof self->block);
-        memset (&self->foot, 0, sizeof self->foot);
-        self->dirty = false;
-        self->size_known = true;
-        self->bswap = false;
-        self->changed = true;
-        self->sought = false;
-        self->has_header = false;
-        self->version = eCurrentVersion;
-    }
-    else
-    {
-        KEncFileBlockId new_bid;    /* block id of new last block */
-        KEncFileBlockId new_fid;    /* block id of new footer / block count */
-        uint32_t        new_doff;   /* bytes into last partial block */
-
-        /*
-         * determine sizes of decrypted virtual file
-         * and encrypted 'real' file
-         */
-        new_fid = new_bid = DecryptedPos_to_BlockId (dec_size, &new_doff);
-        if (new_doff == 0)
-            --new_bid; /* exactly fills a block */
-        else
-            ++new_fid;  /* leaves a partial block */
-    
-        enc_size = BlockId_to_EncryptedPos (new_fid) + sizeof self->foot;
-
-        /* are we starting with an empty file? It's easy if we are */
-        if (self->dec_size == 0)
-        {
-            trim_size = sizeof (KEncFileHeader);
-
-            /* if we did clear out the RAM structures to match */
-            memset (&self->block, 0, sizeof self->block);
-            self->bswap = false;
-            self->changed = true;
-            self->version = eCurrentVersion;
-        }
-        else
-        {
-            KEncFileBlockId old_bid;    /* block id of old last block */
-            KEncFileBlockId old_fid;    /* block id of old footer / block count */
-            uint32_t        old_doff;   /* bytes into last partial block */
-
-            old_fid = old_bid = DecryptedPos_to_BlockId (self->dec_size, &old_doff);
-            if (old_doff == 0)
-                --old_bid; /* exactly fills a block */
-            else
-                ++old_fid;  /* leaves a partial block */
-
-            /* are we only changing the last block? */
-            if (old_bid == new_bid)
-            {
-                assert ((self->dad.read_enabled == false) || (self->enc_size == enc_size));
-
-                if (new_doff == 0)
-                    rc = KEncFileSetSizeBlockFull (self, new_bid);
-                else
-                    rc = KEncFileSetSizeBlockPartial (self, new_bid, new_doff);
-                do_size = false;
-            }
-            else
-            {
-
-                /* truncating the file? */
-                if (dec_size < self->dec_size)
-                {
-                    trim_size = BlockId_to_EncryptedPos (new_fid);
-
-                    /* do we throw away the block in the object? */
-                    if (self->block.id > new_bid)
-                    {
-                        self->dirty = false;
-                        memset (&self->block, 0, sizeof self->block);
-                    }
-
-                    /* we only change the new last block if its now partial */
-                    if (new_doff)
-                        rc = KEncFileSetSizeBlockPartial (self, new_bid, new_doff);
-
-                }
-                /* expanding the file */
-                else
-                {
-                    assert (dec_size > self->dec_size);
-
-                    trim_size = BlockId_to_EncryptedPos (old_fid);
-
-                    /* make old last block a full block if it wasn't already */
-                    if (old_doff != 0)
-                        rc = KEncFileSetSizeBlockFull (self, old_bid);
-                }
-            }
-        }
-    }
-    if (rc == 0)
-    {
-        if (do_size)
-        {
-            rc = KFileSetSize (self->encrypted, trim_size);
-            if (rc)
-                LOGERR (klogErr, rc, "failure to trim size of encrpted file");
-            else
-            {
-                rc = KFileSetSize (self->encrypted, enc_size);
-                if (rc)
-                    LOGERR (klogErr, rc, "failure to file size of encrpted file");
-            }
-        }
-        if (rc == 0)
-        {
-            self->enc_size = enc_size;
-            self->dec_size = dec_size;
-        }
-    }
-    return rc;
-}
-
-
-static
-rc_t CC KEncFileSetSize (KEncFile *self, uint64_t dec_size)
-{
-    assert (self);
-    assert (self->encrypted);
-
-    if (self->dad.write_enabled == false)
-        return RC (rcKrypto, rcFile, rcResizing, rcFile, rcNoPerm);
-
-    if ((self->seekable == false) || (self->size_known == false))
-        return RC(rcKrypto, rcFile, rcAccessing, rcFunction, rcUnsupported);
-
-    /* silently ignore changes in size that don't change the size */
-    if (dec_size == self->dec_size)
-        return 0;
-
-    else
-        return KEncFileSetSizeInt (self, dec_size);
-}
-
-
-/* ----------------------------------------------------------------------
- * Read
- *  read file from known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually read
- */
-static
-rc_t CC KEncFileRead (const KEncFile *cself,
-                      uint64_t pos,
-                      void *buffer,
-                      size_t bsize,
-                      size_t *num_read)
-{
-    KEncFile * self = (KEncFile *)cself; /* mutable values */
-    uint64_t max_bid;
-    uint64_t block_id;
-    uint32_t offset;
-    rc_t rc = 0;
-
-    assert (self); /* checked in file.c KFileRead() */
-    /* pos can be 'anything' */
-    assert (buffer); /* checked in file.c KFileRead() */
-    assert (bsize); /* checked in file.c KFileRead() */
-    assert (num_read); /* checked in file.c KFileRead() */
-
-    assert (self->dad.read_enabled);
-    assert (self->encrypted);
-
-    /* do we have a decrypted_size? */
-
-    block_id = DecryptedPos_to_BlockId (pos, &offset);
-
-    switch (self->size_known)
-    {
-    case false:
-
-        max_bid = EncryptedPos_to_BlockId (self->enc_size, NULL, NULL);
-
-        /* if past end of file as we know it so far quick out */
-        if (max_bid <= block_id)
-            return 0;
-        break;
-
-    case true:
-        /* if past end of file quick out */
-        if (pos > self->dec_size)
-            return 0;
-        break;
-
-    default:
-        assert (self->size_known);
-        break;
-    }
-
-    /*
-     * are we on the wrong block?
-     * Or are do we need to read the first block?
-     */
-    if ((block_id != self->block.id) || (self->block.u.valid == 0))
-    {
-        if ((!self->seekable) && (self->block.id + 1 != block_id))
-        {
-            rc = RC (rcFS, rcFile, rcReading, rcOffset, rcIncorrect);
-            PLOGERR (klogErr, (klogErr, rc, "attempt to seek in encryption write at"
-                               " '$(O)' seek to '$(P)'", "O=%lu,P=%lu",
-                               BlockId_to_EncryptedPos(self->block.id), pos));
-        }
-        else
-        {
-            /* flush any dirty block */
-            if (self->dirty)
-            {
-                assert (self->dad.write_enabled);
-                rc = KEncFileBlockFlush (self, &self->block);
-            }
-
-            /* now try to read in a new block */
-            if (rc == 0)
-                rc = KEncFileBlockRead (self, &self->block, block_id, false);
-
-            if (rc == 0)
-            {
-                uint64_t read_max;
-
-                read_max = BlockId_to_DecryptedPos(block_id) + self->block.u.valid;
-                if (self->dec_size < read_max)
-                    self->dec_size = read_max;
-            }
-        }
-    }
-
-    /*
-     * if we are trying to read past the end of the file 
-     * return 0 with nothing read
-     */
-    if ((rc == 0) &&
-        (block_id == self->block.id) &&
-        (offset < self->block.u.valid))
-    {
-        size_t to_copy;
-
-        to_copy = self->block.u.valid - offset;
-        if (to_copy > bsize)
-            to_copy = bsize;
-
-        memmove (buffer, self->block.data + offset, to_copy);
-        *num_read = to_copy;
-    }
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * Write
- *  write file at known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ IN ] and "size" [ IN ] - data to be written
- *
- *  "num_writ" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually written
- */
-static
-rc_t CC KEncFileWrite (KEncFile *self, uint64_t pos,
-                       const void *buffer, size_t bsize,
-                       size_t *pnum_writ)
-{
-    rc_t rc = 0;
-
-    assert (self);
-    assert (buffer);
-    assert (bsize > 0);
-    assert (pnum_writ);
-
-    assert (self->dad.write_enabled);
-    assert (self->encrypted);
-
-/*     KOutMsg ("+++++\n%s: pos %lu\n",__func__,pos); */
-
-    if (self->dec_size != pos)
-    {
-        /* write only does not allow seeks */
-        if ((!self->dad.read_enabled) && (!self->swarm))
-        {
-            rc = RC (rcFS, rcFile, rcWriting, rcOffset, rcIncorrect);
-            PLOGERR (klogErr, (klogErr, rc, "attempt to seek in encryption write at"
-                               " '$(O)' seek to '$(P)'", "O=%lu,P=%lu",
-                               BlockId_to_EncryptedPos(self->block.id), pos));
-        }
-        else
-            self->sought = true;
-    }
-    if (rc == 0)
-    {
-        uint64_t block_id;
-        uint32_t offset;
-        uint64_t block_max;
-        uint64_t new_size;
-
-        rc = 0;
-        /* Block Id for this write */
-        block_id = DecryptedPos_to_BlockId (pos, &offset);
-
-        block_max = BlockId_to_DecryptedPos (block_id+1);
-
-        new_size = pos + bsize;
-        if (new_size > block_max)
-            bsize = block_max - new_size;
-
-
-        /* is the new position beyond the current file length? */
-        if ((new_size > self->dec_size) && (self->dad.read_enabled) && (!self->swarm))
-        {
-            rc = KEncFileSetSizeInt (self, new_size);
-            if (rc)
-                return rc;
-        }
-
-        /* are we going to a new block? */
-        if ((block_id != self->block.id) || (self->block.u.valid == 0))
-        {
-            /* do we have sometihng to flush first? */
-            if (self->dirty)
-            {
-                assert (self->dad.write_enabled);
-                rc = KEncFileBlockFlush (self, &self->block);
-            }
-
-            if (rc == 0)
-            {
-                /* if we are going to over write the whole block */
-                if ((!self->dad.read_enabled) ||
-                    ((offset == 0) && (bsize >= sizeof (self->block.data))))
-                {
-                    memset (&self->block, 0, sizeof self->block);
-                    self->block.id = block_id;
-                }
-                /* else try to fetch an existing block */
-                else
-                    rc = KEncFileBlockRead (self, &self->block, block_id, false);
-            }
-        }
-
-        if (rc == 0)
-        {
-            /* we are at the right block and ready to write */
-            uint32_t new_valid;
-            size_t to_copy;
-
-            /*
-             * force block id to be right even if fetch was beyond end of 
-             * existing file
-             */
-            self->block.id = block_id;
-
-/*             to_copy = sizeof self->block.data - self->block.u.valid; */
-            to_copy = sizeof self->block.data - offset;
-
-            if (to_copy > bsize)
-                to_copy = bsize;
-
-            memmove (self->block.data + offset, buffer, to_copy);
-            self->dirty = true;
-            *pnum_writ = to_copy;
-
-            new_valid = (uint32_t) ( offset + to_copy );
-            if (new_valid > self->block.u.valid)
-            {
-                uint64_t new_size;
-
-                self->block.u.valid = new_valid;
-
-                new_size = pos + to_copy;
-                if (new_size > self->dec_size)
-                    self->dec_size = new_size;
-            }
-
-            if (self->swarm)
-                rc = KEncFileBlockFlush (self, &self->block);
-
-
-        }
-    }
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * Type
- *  returns a KFileDesc
- *  not intended to be a content type,
- *  but rather an implementation class
- *
- * Just return what the backing file says...
- */
-static
-uint32_t CC KEncFileType (const KEncFile *self)
-{
-    assert (self != NULL);
-    assert (self->encrypted != NULL);
-
-    return KFileType (self->encrypted);
-}
-
-
-/* ----------------------------------------------------------------------
- * KEncFileMake
- *  create a new file object
- */
-
-/* ----------
- * KeysInit
- */
-static
-rc_t KEncFileCiphersInit (KEncFile * self, const KKey * key, bool read, bool write)
-{
-    KCipherManager * mgr;
-    size_t z;
-    rc_t rc;
-
-    switch ( key->type)
-    {
-    default:
-        return RC (rcKrypto, rcEncryptionKey, rcConstructing, rcParam, rcInvalid);
-
-    case kkeyNone:
-        return RC (rcKrypto, rcEncryptionKey, rcConstructing, rcParam, rcIncorrect);
-
-    case kkeyAES128:
-        z = 128/8; break;
-
-    case kkeyAES192:
-        z = 192/8; break;
-
-    case kkeyAES256:
-        z = 256/8; break;
-    }
-    rc = KCipherManagerMake (&mgr);
-    if (rc == 0)
-    {
-        rc = KCipherManagerMakeCipher (mgr, &self->ciphers.master, kcipher_AES);
-        if (rc == 0)
-        {
-            rc = KCipherManagerMakeCipher (mgr, &self->ciphers.block, kcipher_AES);
-            if (rc == 0)
-            {
-                rc = KCipherSetDecryptKey (self->ciphers.master, key->text, z);
-                if (rc == 0)
-                {
-                    rc = KCipherSetEncryptKey (self->ciphers.master, key->text, z);
-                    if (rc == 0)
-                        goto keep_ciphers;
-                }
-                KCipherRelease (self->ciphers.block);
-                self->ciphers.block = NULL;
-            }
-            KCipherRelease (self->ciphers.master);
-            self->ciphers.master = NULL;
-        }
-    keep_ciphers:
-        KCipherManagerRelease (mgr);
-    }
-    return rc;
-}
-
-
-
-static const KFile_vt_v1 vtKEncFile =
-{
-    /* version */
-    1, 1,
-
-    /* 1.0 */
-    KEncFileDestroy,
-    KEncFileGetSysFile,
-    KEncFileRandomAccess,
-    KEncFileSize,
-    KEncFileSetSize,
-    KEncFileRead,
-    KEncFileWrite,
-    
-    /* 1.1 */
-    KEncFileType
-};
-
-
-static
-rc_t  KEncFileMakeIntValidSize (uint64_t enc_size, bool w)
-{
-
-    if (enc_size == 0)
-    {
-        if (w)
-            return 0;
-    }
-    else
-    {
-        uint64_t min_size = sizeof (KEncFileHeader) + sizeof (KEncFileFooter);
-        uint64_t block_count;
-
-        if (enc_size >= min_size)
-        {
-            block_count = EncryptedPos_to_BlockId (enc_size, NULL, NULL);
-
-            if (enc_size - BlockId_to_EncryptedPos (block_count) == sizeof (KEncFileFooter))
-                return 0;
-        }
-    }
-    return RC (rcKrypto, rcFile, rcConstructing, rcSize, rcIncorrect);
-}
-
-
-/* ----------
- * MakeInt
- *    common make for all encryptor/decryptors
- */
-static
-rc_t KEncFileMakeInt (KEncFile ** pself, KFile * encrypted,
-                      bool r, bool w, bool v, bool s)
-{
-    uint64_t enc_size;
-    rc_t rc = 0, orc;
-    bool seekable;
-    bool size_known;
-
-    assert (pself);
-    assert (encrypted);
-    assert (((r == true) || (r == false)) &&
-            ((w == true) || (w == false)) &&
-            ((v == true) || (v == false)));
-
-    /* must be able to do at elast one of read and write */
-    assert (r || w);
-
-    /* expecting to validate read only right now */
-/*     assert ((v && r && !w) || (!v)); */
-
-    if (w && ! encrypted->write_enabled)
-    {
-        rc = RC (rcKrypto, rcFile, rcConstructing, rcFile, rcReadonly);
-        LOGERR (klogErr, rc, "Can not make a encryptor for a unwritable file");
-    }
-    if (r && ! encrypted->read_enabled)
-    {
-        orc = RC (rcKrypto, rcFile, rcConstructing, rcFile, rcWriteonly);
-        LOGERR (klogErr, orc, "Can not make a decryptor for an unreadable file");
-        if (rc == 0)
-            rc = orc;
-    }
-    if (rc)
-        return rc;
-
-    /* determine whether the original file can tell us the size */
-    rc = KFileSize (encrypted, &enc_size);
-    if (rc == 0)
-        size_known = true;
-
-    else if (GetRCState(rc) == rcUnsupported)
-        size_known = false;
-    
-    else
-        return rc;
-
-    if (!v && size_known)
-    {
-        rc = KEncFileMakeIntValidSize (enc_size, w);
-        if (rc)
-            return rc;
-    }
-
-    /* determine whether the original file allows seeks */
-    rc = KFileRandomAccess (encrypted);
-    if (rc == 0)
-        seekable = true;
-
-    else if (GetRCState(rc) == rcUnsupported)
-        seekable = false;
-
-    else
-    {
-        LOGERR (klogErr, rc, "error checking random access building "
-                "encrypted file");
-        return rc;
-    }
-
-    /* We are currently only supporting update on seekable and size_known original files */
-    if (r && w && ((!seekable) || (!size_known)))
-    {
-        rc = RC (rcKrypto, rcFile, rcConstructing, rcFile, rcIncorrect);
-        LOGERR (klogErr, rc, "encryptor/decryptor requires seek and size ability");
-        return rc;
-    }
-
-    rc = KFileAddRef (encrypted);
-    if (rc)
-    {
-        LOGERR (klogErr, rc, "Could not add reference to encrypted file");
-        return rc;
-    }
-    else
-    {
-        KEncFile * self;
-
-        /* allocate and zero out an object since we want much of it to be zeroed */
-        self = calloc (1, sizeof *self);
-        if (self == NULL)
-        {
-            rc = RC (rcFS, rcFile, rcConstructing, rcMemory, rcExhausted);
-            LOGERR (klogSys, rc,
-                    "out of memory creating encryptor and/or decryptor");
-        }
-        else
-        {
-            /* all KFiles get this initialization */
-            rc = KFileInit (&self->dad, (const KFile_vt*)&vtKEncFile, "KEncFile", "no-name", r, w);
-            if (rc)
-                LOGERR (klogInt, rc, "error with init for encrypted file");
-
-            else
-            {
-                self->encrypted = encrypted;
-                self->swarm = s;
-
-                /* write only or empty updatable */
-                if ((!r) || (w && size_known && (enc_size == 0)))
-                {
-                    /* dummy size to make the SetSizeInt work */
-                    self->enc_size = enc_size;
-                    rc = KEncFileSetSizeInt (self, 0);
-                    self->seekable = r && seekable;
-                }
-                else
-                {
-                    self->enc_size = enc_size;
-                    self->seekable = seekable;
-                    self->size_known = size_known;
-                    rc = KEncFileHeaderRead (self);
-                }
-                if (rc == 0)
-                {
-                    *pself = self;
-                    return 0;
-                }
-            }
-            free (self);
-        }
-        KFileRelease (encrypted);
-    }
-    return rc;
-}
-
-
-static
-rc_t KEncFileMakeSize (KEncFile *self)
-{
-    KEncFileBlockId fid;
-    rc_t rc;
-
-    assert (self->seekable);
-
-    /*
-     * turn the encrypted size into a block/offset
-     * the offset should be 0 for a missing footer
-     * or the size of a footer
-     */
-    fid = EncryptedPos_to_BlockId (self->enc_size, NULL, NULL);
-
-    assert (BlockId_to_EncryptedPos(fid) + sizeof (self->foot) == self->enc_size);
-
-    if (fid == 0)
-        self->dec_size = 0;
-
-    else
-    {
-        KEncFileBlockId bid = fid - 1;
-        KEncFileBlock b;
-
-        /*
-         * not calling this a seek as its not reading a data block
-         * out of order that will be modified
-         */
-        rc = KEncFileBlockRead (self, &b, bid, false);
-        if (rc)
-            return rc;
-        else
-        {
-            if (BufferAllZero(&b, sizeof b) == true)
-                self->dec_size = BlockId_to_DecryptedPos (bid) + 
-                    sizeof self->block.data;
-
-            else
-                self->dec_size = BlockId_to_DecryptedPos (bid) + b.u.valid;
-        }
-    }
-    self->size_known = true;
-    return 0;
-}
-
-
-/* ----------
- * MakeCmn
- * common parameter validation for all encryptor/decryptors
- */
-static
-rc_t KEncFileMakeCmn (KEncFile ** pself, KFile * encrypted, const KKey * key,
-                      bool r, bool w, bool s)
-{
-    rc_t rc = 0, orc;
-
-    assert (((r == true)||(r == false))&&((w == true)||(w == false)));
-    assert (w || r);
-
-    if (pself == NULL)
-    {
-        rc = RC (rcKrypto, rcFile, rcConstructing, rcSelf, rcNull);
-        LOGERR (klogErr, rc,
-                "pointer to self NULL when creating "
-                "an encryptor/decryptor");
-    }
-    else
-        *pself = NULL;
-
-    if (encrypted == NULL)
-    {
-        orc = RC (rcFS, rcFile, rcConstructing, rcParam, rcNull);
-        LOGERR (klogErr, orc, 
-                "encrypted file not readable when creating "
-                "an encryptor/decryptor");
-        if (rc == 0)
-            rc = orc;
-    }
-
-    if (key == NULL)
-    {
-        orc = RC (rcFS, rcFile, rcConstructing, rcParam, rcNull);
-        LOGERR (klogErr, orc, 
-                "key not supplied when creating an encryptor/decryptor");
-        if (rc == 0)
-            rc = orc;
-    }
-
-    CRC32Init();    /* likely to be called way too often */
-
-    switch (key->type)
-    {
-    default:
-        orc = RC (rcFS, rcFile, rcConstructing, rcParam, rcInvalid);
-        PLOGERR (klogErr,
-                 (klogErr, orc, "invalid key type '$(T)' should be "
-                  "kkeyAES128(1), kkeyAES192(2) or kkeyAES256(3)",
-                  "T=%u", key->type));
-        if (rc == 0)
-            rc = orc;
-        break;
-
-    case kkeyAES128:
-    case kkeyAES192:
-    case kkeyAES256:
-        break;
-    }
-    if (rc == 0)
-    {
-        KEncFile * self;
-
-        assert ((r == true) || (r == false));
-        assert ((w == true) || (w == false));
-
-        rc = KEncFileMakeInt (&self, encrypted, r, w, false, s);
-        if (rc == 0)
-        {
-            rc = KEncFileCiphersInit (self, key, r, w);
-            if (rc == 0)
-            {
-                
-                if (self->seekable && self->size_known)
-                    rc = KEncFileMakeSize (self);
-
-                if (rc == 0)
-                {
-                    *pself = self;
-                    return 0;
-                }
-            }
-            KFileRelease (&self->dad);
-        }
-    }
-    return rc;
-}
-
-
-/* ----------
- * Read mode is fully seekable if the underlying KFile is seekable some
- * integrity checking will not be performed in allowing this seeking.
- */
-LIB_EXPORT rc_t CC KEncFileMakeRead_v2 (const KFile ** pself, 
-                                        const KFile * encrypted,
-                                        const KKey * key)
-{
-    KEncFile * self;
-    rc_t rc;
-
-    /*
-     * casting encrypted dowsn't actually make it writable
-     * it just lets us use a common constructor
-     */
-    rc = KEncFileMakeCmn (&self, (KFile *)encrypted, key, true, false, false);
-    if (rc)
-        LOGERR (klogErr, rc, "error constructing decryptor");
-
-    else
-        *pself = &self->dad;
-
-    return rc;
-}
-
-
-/* ----------
- * Write mode encrypted file can only be written straight through form the
- * first byte to the last.
- *
- * Existing content is lost.
- */
-LIB_EXPORT rc_t CC KEncFileMakeWrite_v2 (KFile ** pself, 
-                                         KFile * encrypted,
-                                         const KKey * key)
-{
-    KEncFile * self;
-    rc_t rc;
-
-    rc = KEncFileMakeCmn (&self, encrypted, key, false, true, false);
-    if (rc)
-        LOGERR (klogErr, rc, "error constructing encryptor");
-
-    else
-        *pself = &self->dad;
-
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC KEncFileMakeUpdate_v2 (KFile ** pself, 
-                                          KFile * encrypted,
-                                          const KKey * key)
-{
-    KEncFile * self;
-    rc_t rc;
-
-/*     static int count = 0; */
-
-/*     KOutMsg ("%s: %d\n",__func__,++count); */
-
-    rc = KEncFileMakeCmn (&self, (KFile *)encrypted, key, true, true, false);
-    if (rc)
-        LOGERR (klogErr, rc, "error constructing encryptor/decryptor");
-
-    else
-        *pself = &self->dad;
-
-    return rc;
-}
-
-
-/* ----------
- * Swarm mode encrypted file can be writtenout of order but the footer is not
- * handled automatically
- */
-LIB_EXPORT rc_t CC KEncFileMakeBlock_v2 (KFile ** pself, 
-                                         KFile * encrypted,
-                                         const KKey * key)
-{
-    KEncFile * self;
-    rc_t rc;
-
-/*     static int count = 0; */
-
-/*     KOutMsg ("%s: %d\n",__func__,++count); */
-
-    rc = KEncFileMakeCmn (&self, (KFile *)encrypted, key, false, true, true);
-    if (rc)
-        LOGERR (klogErr, rc, "error constructing encryptor/decryptor");
-
-    else
-        *pself = &self->dad;
-
-    return rc;
-}
-
-
-/* ----------
- * Validate mode is useful only for the KFileEncValidate function
- */
-static
-rc_t KEncFileMakeValidate (KEncFile ** pself, const KFile * encrypted)
-{
-    KEncFile * self;
-    rc_t rc;
-
-    assert (pself);
-    assert (encrypted);
-
-    rc = KEncFileMakeInt (&self, (KFile*)encrypted, true, false, true, false);
-    if (rc)
-        LOGERR (klogErr, rc, "error making KEncFile");
-    else
-    {
-        rc = KEncFileHeaderRead (self);
-        if (rc)
-            LOGERR (klogErr, rc, "error reading encrypted file header");
-        else
-        {
-            *pself = self;
-            return 0;
-        }
-    }
-    *pself = NULL;
-    return rc;
-}
-
-
-/* ======================================================================
- * Interface extensions
- */
-
-
-/* ----------
- * Validate mode can not be read or written.
- * Upon open the whole file is read from begining to end and all CRC
- * and other integrity checks are performed immedaitely
- *
- * This will fail if the file being tested is not "at position 0" and can not
- * be sought back to 0.
- */
-
-
-
-LIB_EXPORT rc_t CC KEncFileValidate_v2 (const KFile * encrypted)
-{
-    KEncFile * file;
-    rc_t rc = 0;
-
-    /* fail if a NULL parameter: can't validate all addresses */
-    if (encrypted == NULL)
-    {
-        rc = RC (rcKrypto, rcFile, rcValidating, rcParam, rcNull);
-        LOGERR (klogErr, rc, "encrypted file was null when trying to validate");
-        return rc;
-    }
-
-    /* file header is validated within the call to Make Validate */
-    rc = KEncFileMakeValidate (&file, encrypted);
-    if (rc)
-        LOGERR (klogErr, rc,
-                "unable to validate encrypted file due to "
-                "inability to open as encrypted file");
-    else
-    {
-        uint64_t pos;             /* position within the encrypted file */
-        uint64_t block_count = 0; /* how many blocks have we read */
-
-        /* loop through all data blocks */
-        pos = sizeof (KEncFileHeader);
-        for (block_count = 0; ; ++block_count)
-        {
-            rc_t vrc;
-            STSMSG (2, ("reading block '%u' at '%lu'", block_count,
-                        BlockId_to_EncryptedPos(block_count)));
-           
-            vrc = KEncFileBlockRead (file, NULL, block_count, true);
-            if (vrc != 0)
-            {
-                if ( rc == 0 )
-                    rc = vrc;
-                if ( GetRCContext( vrc ) != rcValidating )
-                {
-                    STSMSG (2, ("read error at block '%u'", block_count));
-                    break;
-                }
-            }
-            if (file->eof)
-            {
-                STSMSG (2, ("block '%u' was end", block_count));
-                break;
-            }
-            pos += sizeof (KEncFileData);
-        }   
-        KFileRelease (&file->dad);
-    }
-    return (rc);
-}
-
-
-LIB_EXPORT rc_t CC KEncFileHeaderWrite_v2 (KFile * dad)
-{
-    rc_t rc;
-
-    if (dad->vt != (const KFile_vt*)&vtKEncFile)
-    {
-        rc = RC (rcKrypto, rcFile, rcWriting, rcType, rcIncorrect);
-        LOGERR (klogErr, rc, "file not an encryptor requested writing header");
-    }
-    else
-    {
-        KEncFile * self;
-        self = (KEncFile*)dad;
-
-        rc = KEncFileHeaderWrite (self);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC KEncFileFooterWrite_v2 (KFile * dad)
-{
-    rc_t rc;
-
-    if (dad->vt != (const KFile_vt*)&vtKEncFile)
-    {
-        rc = RC (rcKrypto, rcFile, rcWriting, rcType, rcIncorrect);
-        LOGERR (klogErr, rc, "file not an encryptor requested writing footer");
-    }
-    else
-    {
-        KEncFile * self;
-        self = (KEncFile*)dad;
-
-        rc = KEncFileFooterWrite (self);
-    }
-    return rc;
-}
-
-/* ----------
- * Identify whether a file is a KEncFile type encrypted file by the header.
- * read the header into a buffer and pass it into this function.  
- * The buffer_size needs to be at least 8 but more bytes lead to a better
- * check up to the size of the header of a KEncFile type encrypted file.
- * As the header may change in the future (in a backwards compatible way)
- * that size might change from the current 16.
- *
- * Possible returns:
- * 0:
- *      the file is an identified KEncFile type file.  False positives are
- *      possible if a file happens to match at 8 or more bytes
- *
- * RC (rcFS, rcFile, rcIdentifying, rcFile, rcWrongType)
- *      the file is definitely not a KEncFile type encrypted file.
- *     
- * RC (rcFS, rcFile, rcIdentifying, rcParam, rcNull)
- *      bad parameters in the call
- *
- * RC (rcFS, rcFile, rcIdentifying, rcBuffer, rcInsufficient)
- *      not a large enough buffer to make an identification
- */
-LIB_EXPORT rc_t CC KFileIsEnc_v2 (const char * buffer, size_t buffer_size)
-{
-    KEncFileHeader header;
-    size_t count;
-    bool byte_swapped;
-
-    if ((buffer == NULL) || (buffer_size == 0))
-        return RC  (rcFS, rcFile, rcIdentifying, rcParam, rcNull); 
-
-    /* must have the signature to consider it an Encrypted file */
-    if (buffer_size < sizeof (header.file_sig))
-        return RC (rcFS, rcFile, rcIdentifying, rcBuffer, rcInsufficient); 
-
-    if ((memcmp (buffer, &const_header.file_sig, sizeof const_header.file_sig ) != 0) &&
-        (memcmp (buffer, &const_header_sra.file_sig, sizeof const_header_sra.file_sig ) != 0))
-        return RC (rcFS, rcFile, rcIdentifying, rcFile, rcWrongType); 
-
-    /* can we also check the byte order? It's okay if we can't */
-    if (buffer_size < sizeof header.file_sig + sizeof header.byte_order)
-        return 0; 
-    
-    count = buffer_size > sizeof header ? sizeof header : buffer_size;
-
-    memcpy (&header, buffer, count);
-
-    if (header.byte_order == const_header.byte_order)
-        byte_swapped = false;
-
-    else if (header.byte_order == const_bswap_header.byte_order)
-        byte_swapped = true;
-
-    /* but if it's not we fail with a different error */
-    else
-        return RC (rcFS, rcFile, rcIdentifying, rcFile, rcOutoforder); 
-
-    /* can we check the version as well? It's okay if we can't */
-    if (buffer_size < sizeof (header))
-        return 0; 
-
-    assert (sizeof (header.version) == 4);
-    if (byte_swapped)
-        header.version = bswap_32(header.version);
-
-    /* and it's a different error if the version is not within our range */
-    if ((header.version <= 0) || (header.version > eCurrentVersion))
-        return RC (rcKrypto, rcFile, rcClassifying, rcFile, rcBadVersion);
-
-    return 0;
-}
-
-
-LIB_EXPORT rc_t CC KFileIsSraEnc (const char * buffer, size_t buffer_size)
-{
-    KEncFileHeader header;
-    size_t count;
-    bool byte_swapped;
-
-    if ((buffer == NULL) || (buffer_size == 0))
-        return RC  (rcFS, rcFile, rcIdentifying, rcParam, rcNull); 
-
-
-    if (buffer_size < sizeof (header.file_sig))
-        return RC (rcFS, rcFile, rcIdentifying, rcBuffer, rcInsufficient); 
-
-    if (memcmp (buffer, &const_header_sra.file_sig, sizeof const_header.file_sig ) != 0)
-        return RC (rcFS, rcFile, rcIdentifying, rcFile, rcWrongType); 
-
-    if (buffer_size < sizeof header.file_sig + sizeof header.byte_order)
-        return 0; 
-    
-    count = buffer_size > sizeof header ? sizeof header : buffer_size;
-
-    memcpy (&header, buffer, count);
-
-    if (header.byte_order == const_header.byte_order)
-        byte_swapped = false;
-
-    else if (header.byte_order == const_bswap_header.byte_order)
-        byte_swapped = true;
-
-    else
-        return RC (rcFS, rcFile, rcIdentifying, rcFile, rcOutoforder); 
-
-    if (buffer_size < sizeof (header))
-        return 0; 
-
-    assert (sizeof (header.version) == 4);
-    if (byte_swapped)
-        header.version = bswap_32(header.version);
-
-    if ((header.version <= 0) || (header.version > eCurrentVersion))
-        return RC (rcKrypto, rcFile, rcClassifying, rcFile, rcBadVersion);
-
-    return 0;
-}
-
-/* end of file encfile.c */
-
-
-
diff --git a/libs/krypto/key.c b/libs/krypto/key.c
deleted file mode 100644
index c57a45f..0000000
--- a/libs/krypto/key.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-#include <krypto/extern.h>
-#include <krypto/key.h>
-#include <kapp/args.h>
-#include <klib/checksum.h>
-#include <klib/rc.h>
-#include <klib/log.h>
-#include <string.h>
-
-KRYPTO_EXTERN_DATA KKey KKeyEncrypt;
-KRYPTO_EXTERN_DATA KKey KKeyDecrypt;
-KRYPTO_EXTERN_DATA char WGAEncryptPassword[WGA_MAX_PASSWORD];
-KRYPTO_EXTERN_DATA char WGADecryptPassword[WGA_MAX_PASSWORD];
-
-
-static rc_t KKeyInitInt (KKey * self, KKeyType key_type, 
-                         const void * password, size_t password_size)
-{
-    if (self == NULL)
-        return RC (rcKrypto, rcEncryptionKey, rcConstructing, rcSelf, rcNull);
-
-    if (key_type >= kkeyTypeCount)
-        return RC (rcKrypto, rcEncryptionKey, rcConstructing, rcParam, rcInvalid);
-
-    if (key_type == kkeyNone)
-        return RC (rcKrypto, rcEncryptionKey, rcConstructing, rcParam, rcIncorrect);
-
-    if (password == NULL)
-        return RC (rcKrypto, rcEncryptionKey, rcConstructing, rcParam, rcNull);
-
-    if (password_size == 0)
-        return RC (rcKrypto, rcEncryptionKey, rcConstructing, rcParam, rcTooShort);
-
-    {
-        SHA256State state;
-        size_t z;
-        uint8_t digest [64];
-
-
-        SHA256StateInit (&state);
-        SHA256StateAppend (&state, password, password_size);
-        SHA256StateFinish (&state, digest);
-        
-        switch (self->type = key_type)
-        {
-        default:
-            z = 0;
-            break;
-
-        case kkeyAES128:
-            z = 128/8;
-            break;
-
-        case kkeyAES192:
-            z = 192/8;
-            break;
-
-        case kkeyAES256:
-            z = 256/8;
-            break;
-        }
-        memcpy (self->text, digest, z);
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KKeyInitRead (KKey * self, KKeyType key_type, 
-                                 const void * password, size_t password_size)
-{
-    return KKeyInitInt (self, key_type, password, password_size);
-}
-
-LIB_EXPORT rc_t CC KKeyInitUpdate (KKey * self, KKeyType key_type, 
-                                   const void * password, size_t password_size)
-{
-    if (password_size < kkeyMinimumSize)
-    {
-        rc_t rc = RC (rcKrypto, rcEncryptionKey, rcConstructing, rcParam, 
-                      rcTooShort);
-#if FAIL_SHORT_PASSWORD
-        return rc;
-#else
-        PLOGERR (klogWarn, (klogWarn, rc,
-                            "Password is shorter than recommended '$(P)' is less than '$(Q)'"
-                            , "P=%zu,Q=%u"
-                            , password_size
-                            , ( uint32_t ) kkeyMinimumSize
-                     ));
-#endif
-    }
-    return KKeyInitInt (self, key_type, password, password_size);
-}
-    
-
-
-LIB_EXPORT rc_t CC KKeyInitHex()
-{
-    return 0;
-}
-
-/* end of file encfile.c */
-
diff --git a/libs/krypto/manager.c b/libs/krypto/manager.c
deleted file mode 100644
index 8b8c766..0000000
--- a/libs/krypto/manager.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#error "obsolete do not use"
-
-
-
-
-
-
-
-
-
-
diff --git a/libs/krypto/ncbi-priv.h b/libs/krypto/ncbi-priv.h
deleted file mode 100644
index 4814e4f..0000000
--- a/libs/krypto/ncbi-priv.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-#ifndef _h_krypto_ncbi_priv_
-#define _h_krypto_ncbi_priv_
-
-#include <klib/defs.h>
-
-#ifdef _GNUC_
-#include <v128.h>
-#endif
-
-#ifdef  __cplusplus
-extern "C" {
-#endif
-
-#if defined (USEVEC)
-#if defined (USEAESNI)
-
-# if ! defined (USEVECREG)
-/*
- * AES_NI && ! VECREG
- * Illegal
- */
-#  error "Bad combination of defines"
-
-# else
-
-/*
- * AESNI && VECREG
- * use AES-NI, and SSSE3 and lower
- */
-
-# define USE_AES_NI             true
-# define USE_VEC_REG            true
-# define USE_VEC                true
-# define CMEMBER(name)          KCipherVecAesNi##name
-# define CIPHER_IMPL            KCipherVecAesNi
-# define AESBCMEMBER(name)      KAESBlockCipherVecAesNi##name
-# define AESBCIPHER_IMPL        KAESBlockCipherVecAesNi
-# define NULLBCMEMBER(name)     KNullBlockCipherVecAesNi##name
-# define NULLBCIPHER_IMPL       KNullBlockCipherVecAesNi
-# define BCIPHER_VALUE          CipherVec
-
-# endif
-#elif defined (USEVECREG)
-
-# define USE_AES_NI             false
-# define USE_VEC_REG            true
-# define USE_VEC                true
-# define CMEMBER(name)          KCipherVecReg##name
-# define CIPHER_IMPL            KCipherVecReg
-# define AESBCMEMBER(name)      KAESBlockCipherVecReg##name
-# define AESBCIPHER_IMPL        KAESBlockCipherVecReg
-# define NULLBCMEMBER(name)     KNullBlockCipherVecReg##name
-# define NULLBCIPHER_IMPL       KNullBlockCipherVecReg
-# define BCIPHER_VALUE          CipherVec
-
-#else
-
-# define USE_AES_NI             false
-# define USE_VEC_REG            false
-# define USE_VEC                true
-# define CMEMBER(name)          KCipherVec##name
-# define CIPHER_IMPL            KCipherVec
-# define AESBCMEMBER(name)      KAESBlockCipherVec##name
-# define AESBCIPHER_IMPL        KAESBlockCipherVec
-# define NULLBCMEMBER(name)     KNullBlockCipherVec##name
-# define NULLBCIPHER_IMPL       KNullBlockCipherVec
-# define BCIPHER_VALUE          CipherVec
-
-#endif
-
-#else /* ! defined (USEVEC) */
-
-
-# define USE_AES_NI             false
-# define USE_VEC_REG            false
-# define USE_VEC                false
-# define MEMBER(name)           KCipherByte##name
-# define CMEMBER(name)          KCipherByte##name
-# define CIPHER_IMPL            KCipherByte
-# define AESBCMEMBER(name)      KAESBlockCipherByte##name
-# define AESBCIPHER_IMPL        KAESBlockCipherByte
-# define NULLBCMEMBER(name)     KNullBlockCipherByte##name
-# define NULLBCIPHER_IMPL       KNullBlockCipherByte
-# define BCIPHER_VALUE          CipherBlock
-
-#endif /* defined (USEVEC) */
-
-#define CLASS_STRING(name)  #name
-
-
-
-#ifdef  __cplusplus
-}
-#endif
-
-#endif /* #ifndef _h_krypto_ncbi_priv_ */
-
-
diff --git a/libs/krypto/no-null-ncbi.c b/libs/krypto/no-null-ncbi.c
deleted file mode 100644
index 7477512..0000000
--- a/libs/krypto/no-null-ncbi.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-#include <krypto/extern.h>
-
-#include "ncbi-priv.h"
-#include "cipher-priv.h"
-/* #include "blockcipher-priv.h" */
-
-#include <klib/rc.h>
-
-/* ----------------------------------------------------------------------
- * Make
- *
- * Create a new Null Block Cipher object.
- * The processor is checked to see if this particular version is supported on
- * this particular CPU.
- */
-struct KBlockCipher;
-rc_t NULLBCMEMBER(Make) (struct KBlockCipher ** new_obj)
-{
-    rc_t rc;
-
-    /* Check parameter first */
-    if (new_obj == NULL)
-        rc = RC (rcKrypto, rcBlockCipher, rcConstructing, rcSelf, rcNull);
-
-    else
-    {
-        *new_obj = NULL;
-
-        rc = RC (rcKrypto, rcBlockCipher, rcConstructing, rcFunction, rcUnsupported);
-    }
-    return rc;
-}
-
-/* end of file lib/krypto/aes-ncbi.c */
diff --git a/libs/krypto/null-ncbi-priv.h b/libs/krypto/null-ncbi-priv.h
deleted file mode 100644
index 1e485bd..0000000
--- a/libs/krypto/null-ncbi-priv.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-#ifndef _h_krypto_null_ncbi_priv_libs_
-#define _h_krypto_null_ncbi_priv_libs_
-
-#include <klib/defs.h>
-#include <v128.h>
-
-#include "ncbi-priv.h"
-#include "cipher-impl.h"
-#include "blockcipher-impl.h"
-
-#ifdef  __cplusplus
-extern "C" {
-#endif
-
-
-typedef struct CipherNull CipherNull;
-struct CipherNull
-{
-    KCipher dad;
-    CipherVec    e_ivec;
-    CipherVec    d_ivec;
-};
-
-
-#ifdef  __cplusplus
-}
-#endif
-
-#endif /* #ifndef _h_krypto_null_ncbi_priv_libs_ */
-
-
diff --git a/libs/krypto/null-ncbi.c b/libs/krypto/null-ncbi.c
deleted file mode 100644
index fe5e7bc..0000000
--- a/libs/krypto/null-ncbi.c
+++ /dev/null
@@ -1,251 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-#include <krypto/extern.h>
-
-#include "ncbi-priv.h"
-#include "cipher-priv.h"
-#include "blockcipher-priv.h"
-
-#include <klib/rc.h>
-
-
-#include <byteswap.h>
-#include <string.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <sysalloc.h>
-
-#include "blockcipher-impl.h"
-
-#if USE_VEC
-#include <cpuid.h>
-#endif
-#if USE_VECREG
-#include <v128.h>
-#endif
-
-
-#if USE_VEC
-#define BLOCKCIPHER_IMPL BLOCKCIPHER_VEC_IMPL
-#else
-#define BLOCKCIPHER_IMPL BLOCKCIPHER_BYTE_IMPL
-#endif
-
-typedef struct NULL_CLASS NULL_CLASS;
-
-static const char NULLBCMEMBER(aes_ncbi_name) [] = CLASS_STRING(AES_CLASS);
-
-
-/* ----------------------------------------------------------------------
- * Destroy
- *   How large is the stored key for this cipher?  Not the user key used
- *   to create this key (key schedule)
- *
- *   This is needed by KCipher to know how large the KCipher objecr is at
- *   allocation and to know how much of a buffer each decryption/encryption is
- */
-static
-void NULLBCMEMBER(Destroy)    (const BLOCKCIPHER_IMPL * self)
-{
-    /* we use a constant object so do nothing */
-}
-
-
-/* ----------------------------------------------------------------------
- * BlockSize
- */
-static
-uint32_t NULLBCMEMBER(BlockSize) ()
-{
-    return 16;
-}
-
-
-/* ----------------------------------------------------------------------
- * KeySize
- *   How large is the stored key for this cipher?  Not the user key used
- *   to create this key (key schedule)
- *
- *   This is needed by KCipher to know how large the KCipher objecr is at
- *   allocation and to know how much of a buffer each decryption/encryption is
- */
-static uint32_t NULLBCMEMBER(KeySize) ()
-{
-    return 0;
-}
-
-
-/* ----------------------------------------------------------------------
- * SetEncryptKey
- *   The KCipher calls this to have the block cipher build an encryption
- *   key in the KCipher object
- *
- */
-static rc_t NULLBCMEMBER(SetEncryptKey) (void * encrypt_key, const char * user_key,
-                                         uint32_t user_key_size)
-{
-    return 0;
-}
-
-
-/* ----------------------------------------------------------------------
- * SetDecryptKey
- *   The KCipher calls this to have the block cipher build an decryption
- *   key in the KCipher object
- *
- */
-static rc_t NULLBCMEMBER(SetDecryptKey) (void * decrypt_key,
-                                     const char * user_key,
-                                     uint32_t user_key_size)
-{
-    return 0;
-}
-
-
-/* ----------------------------------------------------------------------
- * Encrypt
- *
- *   Perform an encryption of a single block.  Chained modes and stream
- *   cipher modes will call this multiple times.
- *
- */
-#if USE_VEC
-static CipherVec NULLBCMEMBER(Encrypt) (CipherVec state,
-                                        const void * encrypt_key)
-{
-    return state;
-}
-#else
-static void NULLBCMEMBER(Encrypt) (const CipherBlock in,
-                                   CipherBlock * out,
-                                   const void * encrypt_key)
-{
-}
-#endif
-
-
-/* ----------------------------------------------------------------------
- * Decrypt
- *
- *   Perform a decryption of a single block.  Chained modes and stream
- *   cipher modes will call this multiple times.
- */
-#if USE_VEC
-static CipherVec NULLBCMEMBER(Decrypt) (CipherVec state,
-                                        const void * decrypt_key)
-{
-    return state;
-}
-#else
-static void NULLBCMEMBER(Decrypt) (const CipherBlock in,
-                                   CipherBlock * out,
-                                   const void * encrypt_key)
-{
-}
-#endif
-
-
-/* ----------------------------------------------------------------------
- * MakeProcessorSupport
- *
- * Run-time check for support of this particular AES implementation by
- * checking the flags given via the cpuid instruction.
- */
-static __inline__
-bool NULLBCMEMBER(ProcessorSupport) ()
-{
-    return true;
-}
-
-
-/* ----------------------------------------------------------------------
- * Init
- *
- *   Initialize the fields of this object.  The derived class will call this
- *   during it's initialization.
- *
- * self      object to initialze
- * vt        the virtual table of the derived class
- * mgr       the cipher manager that is the construction factory block cipher
- *           objects hold references to the manager while the manager merely
- *           points at the block ciphers when all block ciphers are destroyed
- *           the manager loses its references and it too can be destroyed if not
- *           held elsewhere
- * name      ASCIZ c-string the name of this class
- */
-static const
-#if USE_VEC
-KBlockCipherVec_vt_v1
-#else
-KBlockCipherByte_vt_v1
-#endif
-NULLBCMEMBER(_vt_) = {
-    { 1, 1 },
-
-    NULLBCMEMBER(Destroy),
-    NULLBCMEMBER(BlockSize),
-    NULLBCMEMBER(KeySize),
-    NULLBCMEMBER(SetEncryptKey),
-    NULLBCMEMBER(SetDecryptKey),
-    NULLBCMEMBER(Encrypt),
-    NULLBCMEMBER(Decrypt)
-};
-
-
-/* ----------------------------------------------------------------------
- * Make
- *
- * Create a new Null Block Cipher object.
- * The processor is checked to see if this particular version is supported on
- * this particular CPU.
- */
-rc_t NULLBCMEMBER(Make) (KBlockCipher ** new_obj)
-{
-    rc_t rc;
-
-    /* Check parameter first */
-    if (new_obj == NULL)
-        rc = RC (rcKrypto, rcBlockCipher, rcConstructing, rcSelf, rcNull);
-
-    else
-    {
-        *new_obj = NULL;
-
-        /* check for processor support of this flavor */
-        if ( ! NULLBCMEMBER(ProcessorSupport)())
-            rc = RC (rcKrypto, rcBlockCipher, rcConstructing, rcFunction, rcUnsupported);
-
-        else
-        {
-            rc = 0;
-            *new_obj = (KBlockCipher*)&(NULLBCMEMBER(_vt_));
-        }
-    }
-    return rc;
-}
-
-/* end of file lib/krypto/aes-ncbi.c */
diff --git a/libs/krypto/reencfile.c b/libs/krypto/reencfile.c
deleted file mode 100644
index 8ae0b05..0000000
--- a/libs/krypto/reencfile.c
+++ /dev/null
@@ -1,1255 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-#include <krypto/extern.h>
-#include <krypto/reencfile.h>
-#include <krypto/key.h>
-#include <krypto/encfile.h>
-#include <krypto/encfile-priv.h>
-#include "encfile-priv.h"
-
-#include <klib/rc.h>
-#include <klib/checksum.h>
-#include <klib/log.h>
-#include <klib/out.h>
-#include <klib/debug.h>
-#include <klib/vector.h>
-#include <klib/status.h>
-#include <kfs/file.h>
-#include <kfs/ramfile.h>
-
-#include <sysalloc.h>
-
-#include <byteswap.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-#include <klib/out.h>
-
-#define USE_MISSING_VECTOR false
-
-/* ----------------------------------------------------------------------
- * KReencFile
- *   Base object class for the encryption, decryption and validation of
- *   the file format defined above
- */
-#define KFILE_IMPL KReencFile
-#include <kfs/impl.h>
-
-/* -----
- */
-struct KReencFile
-{
-    KFile         dad;          /* base class */
-    const KFile * encrypted;    /* encrypted file we start from */
-    const KFile * dec;          /* decryptor of the original */
-    KFile *       enc;          /* encryptor */
-    KFile *       ram;          /* a file that works from a sliding window buffer */
-
-    size_t        num_read;
-    size_t        num_writ;
-/* block id's can not max out a 64 bit number as that is a file that is 32K times too big */
-#define NO_CURRENT_BLOCK (~(uint64_t)0)
-    uint64_t      block_id;
-    uint64_t      footer_block; /* if zero, still unknown */
-
-    uint64_t      size;         /* size as known from the original file [see known_size] */
-    bool          known_size;   /* is the size of the original file known? */
-
-    char          plain_text  [ENC_DATA_BLOCK_SIZE];
-    union
-    {
-        KEncFileBlock block;
-        char          text [sizeof (KEncFileBlock)];
-    } block;
-    union
-    {
-        KEncFileFooter foot;
-        char           text [sizeof (KEncFileFooter)];
-    } foot;
-
-};
-
-/* ----------------------------------------------------------------------
- * Interface Functions
- *
- * Destroy
- *
- */
-static
-rc_t CC KReencFileDestroy (KReencFile *self)
-{
-    if (self)
-    {
-        rc_t rc1, rc2, rc3, rc4;
-
-        rc1 = KFileRelease (self->encrypted);
-        if (rc1)
-            LOGERR (klogInt, rc1, "Re-enc failed to release encrypted file");
-
-        rc2 = KFileRelease (self->dec);
-        if (rc2)
-            LOGERR (klogInt, rc2, "Re-enc failed to release decryptor");
-
-        rc3 = KFileRelease (self->ram);
-        if (rc3)
-            LOGERR (klogInt, rc3, "Re-enc failed to release ram file");
-
-        rc4 = KFileRelease (self->enc);
-        if (rc4)
-            LOGERR (klogInt, rc4, "Re-enc failed to release encryptor");
-
-        free (self);
-
-        return (rc1 ? rc1 :
-                rc2 ? rc2 :
-                rc3 ? rc3 :
-                rc4);
-    }
-    return 0;
-}
-
-
-/* ----------------------------------------------------------------------
- * GetSysFile
- *  returns an underlying system file object
- *  and starting offset to contiguous region
- *  suitable for memory mapping, or NULL if
- *  no such file is available.
- *
- * We do not allow this for read, write or update as you can not memory map the 
- * unencrypted file in a meaningful way.
- */
-static
-struct KSysFile *CC KReencFileGetSysFileUnsupported (const KReencFile *self, uint64_t *offset)
-{
-    assert (self);
-    assert (offset);
-
-    return NULL;
-}
-
-
-/* ----------------------------------------------------------------------
- * RandomAccess
- *
- *  returns 0 if random access, error code otherwise
- */
-static
-rc_t CC KReencFileRandomAccess (const KReencFile *self)
-{
-    assert (self != NULL);
-    assert (self->encrypted != NULL);
-
-    return KFileRandomAccess (self->encrypted);
-}
-
-
-/* ----------------------------------------------------------------------
- * Size
- *  returns size in bytes of file
- *
- *  "size" [ OUT ] - return parameter for file size
- */
-static
-rc_t CC KReencFileSize (const KReencFile *self, uint64_t *size)
-{
-    assert (self != NULL);
-    assert (self->encrypted != NULL);
-
-    /* -----
-     * the re-encrypted file will be the same size as the 
-     * previously encrypted file and we have the same understanding
-     * about knowing the size
-     */
-    return KFileSize (self->encrypted, size);
-}
-
-
-static
-rc_t CC KEncryptFileSize (const KReencFile *self, uint64_t *size)
-{
-    uint64_t z;
-    rc_t rc;
-
-    assert (self != NULL);
-    assert (self->encrypted != NULL);
-
-    /* -----
-     * the re-encrypted file will be the same size as the 
-     * previously encrypted file and we have the same understanding
-     * about knowing the size
-     */
-    rc = KFileSize (self->encrypted, &z);
-
-    if (rc == 0)
-    {
-        uint64_t bid;
-
-        bid = DecryptedPos_to_BlockId (z, NULL);
-
-        *size = BlockId_to_EncryptedPos (bid + 1) + sizeof (KEncFileFooter);
-    }
-    else
-        *size = z;
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * SetSize
- *  sets size in bytes of file
- *
- *  "size" [ IN ] - new file size
- */
-static
-rc_t CC KReencFileSetSizeUnsupported (KReencFile *self, uint64_t size)
-{
-    assert (self);
-
-    return RC ( rcFS, rcFile, rcUpdating, rcFunction, rcUnsupported );
-}
-
-
-/*
- * The next three functions do the actual Out from a KFileRead.
- * We will only out from the header, or a footer or a single
- * encrypted block rather than try to fully satisfy all of a
- * KFileRead. USe KFileReadAll to get more than one part
- *
- * For all we have an offset within the part which is the
- * position from the original read request for the header
- */
-static __inline__
-rc_t KReencFileReadHeaderOut (KReencFile * self, size_t offset, void * buffer,
-                              size_t bsize, size_t *num_read)
-{
-    assert (self);
-    assert (offset < sizeof (KEncFileHeader));
-    assert (buffer);
-    assert (bsize);
-    assert (num_read);
-
-    /* trim request if necessary */
-    if (offset + bsize > sizeof (KEncFileHeader))
-        bsize = sizeof (KEncFileHeader) - offset;
-
-    memcpy (buffer, self->block.text + offset, bsize);
-    self->block_id = NO_CURRENT_BLOCK;
-    *num_read = bsize;
-    
-    return 0;
-}
-
-
-static __inline__
-rc_t KReencFileReadBlockOut (KReencFile * self, size_t offset, void * buffer,
-                             size_t bsize, size_t * num_read)
-{
-    assert (self);
-    assert (offset < sizeof self->block);
-    assert (buffer);
-    assert (bsize);
-    assert (num_read);
-
-    if (offset + bsize > sizeof self->block)
-        bsize = sizeof self->block - offset;
-
-    memcpy (buffer, self->block.text + offset, bsize);
-    *num_read = bsize;
-
-    return 0;
-}
-
-
-static __inline__
-rc_t KReencFileReadFooterOut (KReencFile * self, size_t offset,
-                              void * buffer, size_t bsize, size_t * num_read)
-{
-    /* for the footer we will copy out from the footer in self */
-
-    assert (self);
-    assert (offset < sizeof self->foot);
-    assert (buffer);
-    assert (bsize);
-    assert (num_read);
-
-/* KOutMsg ("%s: offset '%zu' bsize '%zu'",__func__,offset,bsize); */
-    if (offset + bsize > sizeof self->foot)
-        bsize = sizeof self->foot - offset;
-
-    memcpy (buffer, self->foot.text + offset, bsize);
-    self->block_id = NO_CURRENT_BLOCK;
-    *num_read = bsize;
-
-/* KOutMsg (" *num_read '%zu'\n",bsize); */
-/* { */
-/*     size_t ix; */
-/*     char * b = buffer; */
-/*     KOutMsg ("%s:",__func__); */
-/*     for (ix = 0; ix < bsize; ++ix) */
-/*         KOutMsg (" %2.2x",b[ix]); */
-/*     KOutMsg ("\n"); */
-
-/* } */
-    return 0;
-}
-
-
-/*
- * Handle Read within the Encrypted file header
- *
- * We use a private interface into the KEncFile then 
- * the Out function below to take what we write with
- * the Encryptor and copy it to the callers read buffer.
- */
-static
-rc_t KReencFileReadHandleBlock (KReencFile *self,
-                                uint64_t pos,
-                                void *buffer,
-                                size_t bsize,
-                                size_t *num_read);
-
-static __inline__
-rc_t KReencFileReadHandleHeader (KReencFile *self,
-                                 uint64_t pos,
-                                 void *buffer,
-                                 size_t bsize,
-                                 size_t *num_read)
-{
-    rc_t rc;
-
-    assert (self);
-    assert (pos < sizeof (KEncFileHeader));
-    assert (buffer);
-    assert (bsize);
-    assert (num_read);
-
-    /* added to support NCBInenc and NCBIsenc variants of KEncFile
-     * read the first block of the source file but don't write any of it
-     *
-     * If the source is stream mode only then the next block to be read is the
-     * first and this will not violate by seeking. It will just have already
-     * read the block it will want to read real soon. Likewith within a
-     * single call to KFileReadAll.
-     */
-    rc = KReencFileReadHandleBlock (self, 0, NULL, 0, NULL);
-    if (rc)
-        return rc;
-
-    /* use a private function from KEncFile to generate a header */
-    rc = KEncFileWriteHeader (self->enc);
-    if (rc)
-        LOGERR (klogErr, rc, "re-enc error generating encrypted header");
-    else
-    {
-        /*
-         * assume it worked and its the right size 
-         * copy the requested portion of the header out to finish the read
-         */
-        rc = KReencFileReadHeaderOut (self, pos, buffer, bsize, num_read);
-        if (rc)
-            LOGERR (klogErr, rc, "re-enc error filling read request");
-    }
-    return rc;
-}
-
-
-/*
- * Read the requested block form the source encrypted file
- */
-static
-rc_t KReencFileReadABlock (KReencFile * self, uint64_t block_id)
-{
-    rc_t rc;
-
-
-/*     OUTMSG (("%s: block_id %lu\n",__func__,block_id)); */
-
-    if (block_id + 1 == self->footer_block)
-        memset (self->plain_text, 0, sizeof self->plain_text);
-
-    /* -----
-     * simple call down to the decryptor to get the plain text data
-     * for this block. We will regenerate the framing when we re-encrypt
-     */
-    rc = KFileReadAll (self->dec, BlockId_to_DecryptedPos (block_id),
-                       &self->plain_text, sizeof (self->plain_text),
-                       &self->num_read);
-    if (rc)
-        LOGERR (klogErr, rc, "re-enc error reading a block");
-
-    /*
-     * interpret bytes read for validity
-     *
-     * zero means we hit a premature end of file where we expected a block
-     */
-    else if (self->num_read == 0)
-    {
-        /*misleading RC? */
-        rc = RC (rcKrypto, rcFile, rcReading, rcSize, rcInsufficient);
-        LOGERR (klogErr, rc, "re-enc no block read");
-    }
-    /*
-     * less than a full block must be in the last block
-     */
-    else if (self->num_read < sizeof self->plain_text)
-    {
-/*         KOutMsg ("%s: block_id '%lu'num_read '%zu' of '%zu' last_block '%lu'\n", */
-/*                  __func__, block_id, self->num_read, sizeof self->plain_text, */
-/*                  self->footer_block); */
-
-        if (block_id + 1 != self->footer_block)
-        {
-            rc = RC (rcKrypto, rcFile, rcReading, rcSize, rcInsufficient);
-            LOGERR (klogErr, rc, "re-enc incomplete block read");
-        }
-    }
-    /*
-     * unlikely scenario, read too much
-     */
-    else if (self->num_read > sizeof self->plain_text)
-    {
-        rc = RC (rcKrypto, rcFile, rcReading, rcBuffer, rcIncorrect);
-        LOGERR (klogErr, rc, "re-enc no block read");
-    }
-    if (rc == 0)
-        self->block_id = block_id;
-    return rc;
-}
-
-
-static
-rc_t KReencFileWriteABlock (KReencFile * self, uint64_t block_id)
-{
-    rc_t rc;
-
-    /* -----
-     * simple call to encrypt an entire data section for the relevant block
-     * We send in up to 32KB of plain text which through two element KFiles will
-     * we written into a buffer back in this KFile. More data will be written
-     * to that buffer than requested here - that is the framing and also the
-     * header if the block is the first one.
-     */
-    rc = KFileWriteAll (self->enc, BlockId_to_DecryptedPos (block_id),
-                         self->plain_text, self->num_read, &self->num_writ);
-
-    if (rc)
-        LOGERR (klogInt, rc, "re-enc error encrypting a block");
-
-    else if (self->num_writ != self->num_read)
-    {
-        rc = RC (rcKrypto, rcFile, rcWriting, rcFile, rcIncomplete);
-        LOGERR (klogErr, rc, "re-enc failure encrypting all of block");
-    }
-
-    /* trigger a flush */
-/*     if (rc == 0) */
-/*         rc = KFileWriteAll (self->enc, BlockId_to_DecryptedPos (block_id^1), */
-/*                          self->plain_text, self->num_read, &self->num_writ); */
-
-    return rc;
-}
-
-
-/*
- * Add the current encrypted block to the footer statistics
- */
-static __inline__
-rc_t KReencFileAddToFooter (KReencFile * self)
-{
-    assert (self);
-/*     KOutMsg ("%s: ",__func__);  */
-
-    if (self->block.block.crc != self->block.block.crc_copy)
-    {
-        rc_t rc = RC (rcKrypto, rcFile, rcReading, rcChecksum, rcInvalid);
-        LOGERR (klogInt, rc, "rc-enc block CRCs disagree");
-        return rc;
-    }
-
-    ++ self->foot.foot.block_count;
-    self->foot.foot.crc_checksum += self->block.block.crc;
-
-/*     KOutMsg ("%lu %lu %lu\n",self->foot.foot.block_count,self->block.block.crc,self->foot.foot.crc_checksum); */
-    return 0;
-}
-
-
-/*
- * Read a block from the source encrypted block and Write it which reencrypts it
- *
- * The new_block parameter says whether this is the first time we've seen this
- * block. If it is we need to add data to the footer
- */
-static
-rc_t KReencFileReencBlock (KReencFile * self, uint64_t block_id, bool new_block)
-{
-    rc_t rc;
-
-    assert (self);
-
-/*     KOutMsg ("%s: %lu %lu\n", __func__, block_id, self->footer_block); */
-    assert (block_id < self->footer_block);
-    assert ((new_block == true) || (new_block == false));
-
-
-
-    rc = KReencFileReadABlock (self, block_id);
-    if (rc)
-        LOGERR (klogErr, rc, "re-enc failure to read a block");
-    else
-    {
-        if ((self->num_read == 0) || (self->num_read > sizeof (self->plain_text)))
-        {
-            rc = RC (rcFS, rcFile, rcReading, rcSize, rcIncorrect);
-            LOGERR (klogErr, rc, "Bad length on block read of encrypted file");
-        }
-        else
-        {
-            rc = KReencFileWriteABlock (self, block_id);
-            if (rc)
-                LOGERR (klogErr, rc, "re-enc failure to write a block");
-
-            else if (new_block)
-            {
-                rc = KReencFileAddToFooter (self);
-                if (rc)
-                    LOGERR (klogErr, rc,
-                            "re-enc failure to do block accounting");
-            }
-        }
-    }
-    return rc;
-}
-
-
-/*
- * Handle Read within the Encrypted file footer
- */
-static __inline__
-rc_t KReencFileReadHandleFooter (KReencFile *self,
-                                 uint64_t pos,
-                                 void *buffer,
-                                 size_t bsize,
-                                 size_t *num_read)
-{
-    uint64_t block_id;  /* block id for the footer gets us the start of footer */
-    size_t offset;
-    rc_t rc;
-
-/* KOutMsg ("\n\n\n%s: pos '%lu' bsize '%zu'\n",__func__,pos,bsize); */
-
-    assert (self);
-    assert (pos >= sizeof (KEncFileHeader) + sizeof self->block);
-    assert (buffer);
-    assert (bsize);
-    assert (num_read);
-
-    rc = 0;
-    block_id = EncryptedPos_to_BlockId (pos, NULL, NULL);
-
-    /* our library does not allow an empty file to be encrypted
-     * so we call that an error
-     */
-    assert (block_id > 0);
-
-    assert (block_id == self->footer_block);
-
-    offset = pos - BlockId_to_EncryptedPos (block_id);
-
-    assert (offset < sizeof self->foot);
-
-    /* if we are tying to treat this as a footer but it wasn't the next
-     * expected block mark all inbetween as missing to handle in the 
-     * function just below this
-     */
-
-/* KOutMsg ("%s: self->next_block %lu\n",__func__, self->next_block); */
-
-    self->foot.foot.block_count = block_id;
-    self->foot.foot.crc_checksum = 0;
-
-    if (rc == 0)
-    {
-        uint64_t header_pos;
-
-        header_pos = BlockId_to_EncryptedPos(block_id);
-
-        assert (header_pos <= pos);
-        assert (pos - header_pos <= sizeof self->foot);
-
-        rc = KReencFileReadFooterOut (self, (size_t)(pos - header_pos),
-                                      buffer, bsize, num_read);
-
-/*             KOutMsg ("%s: footer '%lu' '%lx'\n",__func__, */
-/*                      self->foot.foot.block_count, */
-/*                      self->foot.foot.crc_checksum); */
-
-        if (rc)
-            LOGERR (klogInt, rc, "re-enc failed to output footer");
-    }
-    return rc;
-}
-
-
-/*
- *
- */
-static
-rc_t KReencFileReadHandleBlock (KReencFile *self,
-                                uint64_t pos,
-                                void *buffer,
-                                size_t bsize,
-                                size_t *num_read)
-{ 
-    rc_t rc = 0;            /* we have a path where we need to check this without set */
-    uint64_t block_id;      /* block id for the requeted position */
-    uint32_t offset;        /* how far into the encrypted block */
-    bool new_block;         /* is this the first time for this block */
-
-    /* -----
-     * figure out what block this corresponds to. 
-     * the header is for this purpose part of the first block
-     * when we decide what to give the reader. We only care
-     * about which block and not whether it is in the payload
-     * or framing.
-     * This block id is not to a known to exist block. It could be 
-     * to the header, the footer or past the end of the file.
-     *
-     * NOTE: This could be a pre-fetch of the first block when
-     * processing the header - it will have some funny values
-     * with just a self and all other parameters 0s.
-     * pos of zero gives block_id of 0 and the bsize of zero
-     * means we never look at the others. Thi sis to allow the 
-     * (at the time this was written) new feature of two
-     * different file-signatures for encrypted files.
-     */
-    block_id = EncryptedPos_to_BlockId (pos, NULL, NULL);
-
-    if (block_id != self->block_id)
-    {
-        new_block = true;
-
-        if (rc == 0)
-        {
-            /* read requested block */
-            rc = KReencFileReencBlock (self, block_id, new_block);
-            if (rc)
-            {
-                LOGERR (klogErr, rc,
-                        "re-enc failure re-encryptinng a requested block");
-            }
-        }
-    }
-    if ((rc == 0) && (bsize > 0))
-    {
-        /* satisfy read request
-         *
-         * if we are here we decrypted and re-encrypted the
-         * expected block
-         */
-        offset = (uint32_t) ( pos - BlockId_to_EncryptedPos (block_id) );
-        rc = KReencFileReadBlockOut (self, offset, buffer, bsize, num_read);
-        if (rc)
-            LOGERR (klogErr, rc, "re-enc error copying out from block");
-    }
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * Read
- *  read file from known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually read
- */
-static
-rc_t CC KReencFileReadUnsupported (const KReencFile *self,
-                                   uint64_t pos,
-                                   void *buffer,
-                                   size_t bsize,
-                                   size_t *num_read)
-{
-    assert (self);
-    assert (buffer);
-    assert (bsize);
-    assert (num_read);
-
-    return RC ( rcFS, rcFile, rcReading, rcFunction, rcUnsupported );
-}
-
-
-/*
- * Read will often return only a partial read.
- *
- * We take the less complex route here and return only from the header, a
- * single block or the footer, whatever is at the beginning of the requested
- * region.
- */
-static
-rc_t CC KReencFileRead (const KReencFile *self_,
-                        uint64_t pos,
-                        void *buffer,
-                        size_t bsize,
-                        size_t *num_read)
-{
-    /* make it all mutable and stop using self_ */
-    KReencFile * self = (KReencFile *)self_;
-    rc_t rc = 0;
-
-    assert (self);
-    assert (buffer);
-    assert (bsize);
-    assert (num_read);
-
-    *num_read = 0;
-
-    /* -----
-     * the size of the re-encrypted file will be the same as the size of the
-     * previously encrypted file so we can bail early if we know we can.
-     *
-     * The initial use case is that the file will just be lying out on disk
-     * and a KSysfile so that we do know the size.
-     *
-     * There are three pieces to an encrypted file:
-     * 1 Header
-     * 2 One or More Blocks
-     * 3 Footer
-     *
-     * We will only know if we are in the footer if we already know the size of
-     * the file. Else we have to find the footer by not finding a block when we
-     * try to read it. We'll thus look for the header first, then the footer else
-     * we try to find a block,
-     */
-
-    /* Header */
-    if (pos < sizeof (KEncFileHeader))
-        rc = KReencFileReadHandleHeader (self, pos, buffer, bsize, num_read);
-
-    /* if past the whole encrypted file */
-    else if (pos >= self->size)
-        rc = 0;
-
-    /* Footer */
-    else if (pos >= self->size - sizeof self->foot)
-        rc = KReencFileReadHandleFooter (self, pos, buffer, bsize, num_read);
-
-    /* Blocks */
-    else
-        rc = KReencFileReadHandleBlock (self, pos, buffer, bsize, num_read);
-
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * Write
- *  write file at known position
- *
- *  "pos" [ IN ] - starting position within file
- *  "buffer" [ IN ] and "size" [ IN ] - data to be written
- *
- *  "num_writ" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually written
- *
- * Unsupported as we now treat archives as READ ONLY
- */
-static
-rc_t CC KReencFileWriteUnsupported (KReencFile *self, uint64_t pos,
-                                    const void *buffer, size_t bsize,
-                                    size_t *num_writ)
-{
-    rc_t rc = RC (rcFS, rcFile, rcReading, rcFunction, rcUnsupported);
-
-    assert (self);
-    assert (buffer);
-    assert (bsize);
-    assert (num_writ);
-
-    assert (false);
-
-    LOGERR (klogInt, rc, "KFileRead failed to filter call");
-
-    return rc;
-}
-
-static
-rc_t CC KReencFileWrite (KReencFile *self, uint64_t pos,
-                         const void *buffer, size_t bsize,
-                         size_t *num_writ)
-{
-    assert (self);
-    assert (buffer);
-    assert (bsize);
-    assert (num_writ);
-
-    assert (REENCFILE_WRITE_SUPPORTED);
-
-    /* this needs to be finished before we can support Write open */
-
-    return KReencFileWriteUnsupported (self, pos, buffer, bsize, num_writ);
-}
-
-
-/* ----------------------------------------------------------------------
- * Type
- *  returns a KFileDesc
- *  not intended to be a content type,
- *  but rather an implementation class
- */
-static
-uint32_t CC KReencFileType (const KReencFile *self)
-{
-    assert (self != NULL);
-    assert (self->encrypted != NULL);
-
-    return KFileType (self->encrypted);
-}
-
-
-/* ----------------------------------------------------------------------
- * KReencFileMake
- *  create a new file object
- */
-
-
-/* ----------
- * MakeParamValidate
- * common parameter validation for both reencryptors
- */
-static
-rc_t KReencFileMakeParamValidate (const KFile ** pself, const KFile * encrypted, 
-                                  const KKey * deckey, const KKey * enckey)
-{
-    rc_t rc = 0;
-
-    do
-    {
-        if (pself == NULL)
-        {
-            rc = RC (rcFS, rcFile, rcConstructing, rcSelf, rcNull);
-            LOGERR (klogErr, rc,
-                    "pointer to self NULL when creating "
-                    "a re-encryptor");
-            break;
-        }
-
-        *pself = NULL;
-
-        if (encrypted == NULL)
-        {
-            rc = RC (rcFS, rcFile, rcConstructing, rcParam, rcNull);
-            LOGERR (klogErr, rc, 
-                    "encrypted file not supplied when creating "
-                    "an encryptor/decryptor");
-            break;
-        }
-
-        if ((enckey == NULL) || (deckey == NULL))
-        {
-            rc = RC (rcFS, rcFile, rcConstructing, rcParam, rcNull);
-            LOGERR (klogErr, rc, 
-                    "key not supplied when creating a re-encryptor");
-            break;
-        }
-
-        switch (deckey->type)
-        {
-        default:
-            rc = RC (rcFS, rcFile, rcConstructing, rcParam, rcInvalid);
-            PLOGERR (klogErr,
-                     (klogErr, rc, "invalid key type '$(T)' should be "
-                      "kkeyAES128(1), kkeyAES192(2) or kkeyAES256(3)",
-                      "T=%u", deckey->type));
-            break;
-
-        case kkeyAES128:
-        case kkeyAES192:
-        case kkeyAES256:
-            break;
-        }
-        switch (enckey->type)
-        {
-        default:
-            rc = RC (rcFS, rcFile, rcConstructing, rcParam, rcInvalid);
-            PLOGERR (klogErr,
-                     (klogErr, rc, "invalid key type '$(T)' should be "
-                      "kkeyAES128(1), kkeyAES192(2) or kkeyAES256(3)",
-                      "T=%u", enckey->type));
-            break;
-
-        case kkeyAES128:
-        case kkeyAES192:
-        case kkeyAES256:
-            break;
-        }
-    } while (0);
-    return rc;
-}
-
-
-/* ----------
- * Read mode is fully seekable if the underlying KFile is seekable some
- * integrity checking will not be performed in allowing this seeking.
- */
-static const KFile_vt_v1 vtKReencFileRead =
-{
-    /* version */
-    1, 1,
-
-    /* 1.0 */
-    KReencFileDestroy,
-    KReencFileGetSysFileUnsupported,
-    KReencFileRandomAccess,
-    KReencFileSize,
-    KReencFileSetSizeUnsupported,
-    KReencFileRead,
-    KReencFileWriteUnsupported,
-
-    /* 1.1 */
-    KReencFileType
-};
-
-
-LIB_EXPORT rc_t CC KReencFileMakeRead (const KFile ** pself, 
-                                       const KFile * encrypted,
-                                       const KKey * deckey,
-                                       const KKey * enckey)
-{
-    KReencFile * self;
-    uint64_t size;
-    uint64_t block_count;
-    rc_t rc;
-
-    rc = KReencFileMakeParamValidate (pself, encrypted, deckey, enckey);
-    if (rc)
-    {
-        LOGERR (klogErr, rc, "error constructing decryptor");
-        return rc;
-    }
-
-    rc = KFileSize (encrypted, &size);
-    if (GetRCState (rc) == rcUnsupported)
-    {
-        size = 0;
-        rc = RC (rcKrypto, rcFile, rcConstructing, rcSize, rcUnsupported);
-        LOGERR (klogErr, rc, "Can't re-encrypt files that don't support KFileSize");
-        return rc;
-    }
-    
-    if (rc)
-    {
-        LOGERR (klogErr, rc, "Unable to attempt to size encrypted file for reencryption");
-        return rc;
-    }
-
-    rc = KFileAddRef (encrypted);
-    if (rc)
-    {
-        LOGERR (klogErr, rc, "Unable to add reference to encrypted file for re-encryptor");
-        return rc;
-    }
-
-    if (size == 0)
-    {
-        *pself = encrypted;
-        return rc;
-    }
-    if (size < sizeof (KEncFileHeader) + sizeof (KEncFileBlock) + sizeof (KEncFileFooter))
-    {
-        rc = RC (rcKrypto, rcFile, rcConstructing, rcSize, rcTooShort);
-        LOGERR (klogErr, rc, "encrypted file too short to be valied for re-encryption");
-        KFileRelease (encrypted);
-        return rc;
-    }
-
-    {
-        uint64_t temp;
-
-        temp = size - (sizeof (KEncFileHeader) + sizeof (KEncFileFooter));
-        block_count = temp / sizeof (KEncFileBlock);
-        if ((block_count * sizeof (KEncFileBlock)) != temp)
-        {
-            rc = RC (rcKrypto, rcFile, rcConstructing, rcSize, rcInvalid);
-            LOGERR (klogErr, rc, "encrypted file invalid size for re-encryption");
-            KFileRelease (encrypted);
-            return rc;
-        }
-    }
-
-    self = calloc (1,sizeof (*self));
-
-    if (self == NULL)
-    {
-        rc = RC (rcFS, rcFile, rcConstructing, rcMemory, rcExhausted);
-        LOGERR (klogSys, rc,
-                "out of memory creating encrypter and/or decryptor");
-    }
-    else
-    {
-        rc = KFileInit (&self->dad, (const KFile_vt*)&vtKReencFileRead, "KReencFile", "no-name", true, false);
-        if (rc)
-            LOGERR (klogInt, rc, "failed in initialize reenc base class");
-        else
-        {
-            self->encrypted = encrypted;
-            /* dec, enc, ram need to be Make */
-            /* num_read, num_write stay 0 */
-            self->block_id = NO_CURRENT_BLOCK;
-            /* missing needs to be Made */
-            /* next_block stays 0 */
-            /* seek_block stays 0 - obsolete */
-            self->footer_block = EncryptedPos_to_BlockId (size, NULL, NULL);
-            self->size = size;
-            self->known_size = true; /* obsolete */
-            /* plain_text and block stay 0 */
-            self->foot.foot.block_count = self->footer_block;
-
-            rc = KEncFileMakeRead (&self->dec, encrypted, deckey);
-            if (rc)
-                LOGERR (klogErr, rc, "Failed to create re-enc decryptor");
-
-            else
-            {
-                rc = KRamFileMakeUpdate (&self->ram, self->block.text, 
-                                         sizeof self->block.text);
-                if (rc)
-                    LOGERR (klogErr, rc, 
-                            "Failed to create re-enc encryptor");
-                else
-                {
-
-                    rc = KEncFileMakeWriteBlock (&self->enc, self->ram, enckey);
-                    if (rc)
-                        LOGERR (klogErr, rc,
-                                "Failed to create RAM file for reenc");
-                    else
-                    {
-                        *pself = &self->dad;
-                        return 0;
-                    }
-                    KFileRelease (self->ram);
-                }
-                KFileRelease (self->dec);
-            }
-        }
-        free (self);
-    }
-    KFileRelease (encrypted);
-    return rc;
-}
-
-
-static const KFile_vt_v1 vtKEncryptFileRead =
-{
-    /* version */
-    1, 1,
-
-    /* 1.0 */
-    KReencFileDestroy,
-    KReencFileGetSysFileUnsupported,
-    KReencFileRandomAccess,
-    KEncryptFileSize,
-    KReencFileSetSizeUnsupported,
-    KReencFileRead,
-    KReencFileWriteUnsupported,
-
-    /* 1.1 */
-    KReencFileType
-};
-
-
-LIB_EXPORT rc_t CC KEncryptFileMakeRead (const KFile ** pself, 
-                                         const KFile * encrypted,
-                                         const KKey * enckey)
-{
-    KReencFile * self;
-    uint64_t rawsize;
-    uint64_t size;
-    uint64_t max_block;
-    rc_t rc;
-
-    rc = KReencFileMakeParamValidate (pself, encrypted, enckey, enckey);
-    if (rc)
-    {
-        LOGERR (klogErr, rc, "error constructing decryptor");
-        return rc;
-    }
-
-    rc = KFileSize (encrypted, &rawsize);
-    if (GetRCState (rc) == rcUnsupported)
-    {
-        size = 0;
-        rc = RC (rcKrypto, rcFile, rcConstructing, rcSize, rcUnsupported);
-        LOGERR (klogErr, rc, "Can't encrypt files that don't support KFileSize");
-        return rc;
-    }
-    
-    if (rc)
-    {
-        LOGERR (klogErr, rc, "Unable to attempt to size encrypted file for encryption");
-        return rc;
-    }
-
-    rc = KFileAddRef (encrypted);
-    if (rc)
-    {
-        LOGERR (klogErr, rc, "Unable to add reference to unencrypted file for encryptor");
-        return rc;
-    }
-
-    if (rawsize == 0)
-    {
-        *pself = encrypted;
-        return rc;
-    }
-
-    self = calloc (1,sizeof (*self));
-
-    if (self == NULL)
-    {
-        rc = RC (rcFS, rcFile, rcConstructing, rcMemory, rcExhausted);
-        LOGERR (klogSys, rc,
-                "out of memory creating encrypter and/or decryptor");
-    }
-    else
-    {
-        rc = KFileInit (&self->dad, (const KFile_vt*)&vtKEncryptFileRead, "KEncryptFile", "no-path", true, false);
-        if (rc)
-            LOGERR (klogInt, rc, "failed in initialize reenc base class");
-        else
-        {
-            self->encrypted = encrypted;
-            /* dec, enc, ram need to be made below */
-            /* num_read, num_write stay 0 */
-            self->block_id = NO_CURRENT_BLOCK;
-            /* missing needs to be Made */
-            /* next_block stays 0 */
-            /* seek_block stays 0 - obsolete */
-            max_block = DecryptedPos_to_BlockId (rawsize, NULL);
-            self->footer_block = max_block + 1;
-            size = BlockId_to_EncryptedPos (self->footer_block) + sizeof (KEncFileFooter);
-            self->size = size;
-            self->known_size = true; /* obsolete */
-
-            /* plain_text and block stay 0 */
-            self->foot.foot.block_count = self->footer_block;
-
-            rc = KFileAddRef (self->dec = encrypted);
-            if (rc)
-                LOGERR (klogErr, rc, "Unable to add reference to unencrypted file for encryptor");
-
-            else
-            {
-                rc = KRamFileMakeUpdate (&self->ram, self->block.text, 
-                                         sizeof self->block.text);
-                if (rc)
-                    LOGERR (klogErr, rc, 
-                            "Failed to create ram file for encryptor");
-                else
-                {
-                    
-                    rc = KEncFileMakeWriteBlock (&self->enc, self->ram, enckey);
-                    if (rc)
-                        LOGERR (klogErr, rc,
-                                "Failed to create RAM file for enc");
-                    else
-                    {
-                        *pself = &self->dad;
-                        return 0;
-                    }
-                    KFileRelease (self->ram);
-                }
-                KFileRelease (self->dec);
-            }
-        }
-        free (self);
-    }
-    KFileRelease (encrypted);
-    return rc;
-}
-
-
-/* ----------
- * Write mode re-encrypted file 
- */
-static const KFile_vt_v1 vtKReencFileWrite =
-{
-    /* version */
-    1, 1,
-
-    /* 1.0 */
-    KReencFileDestroy,
-    KReencFileGetSysFileUnsupported,
-    KReencFileRandomAccess,
-    KReencFileSize,
-    KReencFileSetSizeUnsupported,
-    KReencFileReadUnsupported,
-    KReencFileWrite,
-
-    /* 1.1 */
-    KReencFileType
-};
-
-
-LIB_EXPORT rc_t CC KReencFileMakeWrite (KFile ** pself, 
-                                        KFile * encrypted,
-                                        const KKey * deckey,
-                                        const KKey * enckey)
-{
-#if REENCFILE_WRITE_SUPPORTED
-    KReencFile * self;
-    rc_t rc;
-
-    rc = KFileSetSize (encrypted, 0);
-#if 0
-    if (rc)
-        LOGERR (klogWarn, rc, "error truncating output file - "
-                "corrupted file might result");
-#endif
-
-    rc = KReencFileMakeParamValidate (&self, encrypted, deckey, enckey,
-                                      &vtKEncFileWrite, true);
-    if (rc)
-        LOGERR (klogErr, rc, "error creating encryptor");
-    else
-        *pself = &self->dad;
-    return rc;
-#else
-    return RC ( rcFS, rcFile, rcCreating, rcFunction, rcUnsupported );
-#endif
-}
-
-
-/* end of file reencfile.c */
-
-
diff --git a/libs/krypto/rng-impl.h b/libs/krypto/rng-impl.h
deleted file mode 100644
index 04b3418..0000000
--- a/libs/krypto/rng-impl.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kryptoimpl_
-#define _h_kryptoimpl_
-
-#include <klib/rc.h>
-#include <klib/refcount.h>
-#include <atomic.h>
-#include <krypto/rng.h>
-#include "rng-priv.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-
-typedef union KRng_vt KRng_vt;
-
-
-
-
-#ifndef KRNG_IMPL
-#define KRNG_IMPL KRng
-#endif
-
-typedef struct KRng_vt_v1 KRng_vt_v1;
-struct KRng_vt_v1
-{
-    /* version == 1.x */
-    uint32_t maj;
-    uint32_t min;
-
-    /* start minor version == 0 */
-    rc_t (CC * destroy) (KRNG_IMPL * self);
-    rc_t (CC * seed)    (KRNG_IMPL * self);
-    rc_t (CC * reseed)  (KRNG_IMPL * self, const void * buff, size_t buff_size);
-    rc_t (CC * read)    (const KRNG_IMPL *self, void * buff, uint32_t buff_len,
-                         uint32_t * num_read);
-    /* end minor version == 0 */
-    /* start minor version == 1 */
-    /* end minor version == 1 */
-    /* end version == 1.x */
-};
-
-union KRng_vt
-{
-    KRng_vt_v1 v1;
-};
-
-static
-rc_t KRngInit (KRng * self, union KRng_vt * vt, const char * type)
-{
-    self->vt = vt;
-    KRefcountInit (&self->refcount, 1, "KRng", "Init", type);
-    return 0;
-}
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_kryptoimpl_ */
diff --git a/libs/krypto/rng-priv.h b/libs/krypto/rng-priv.h
deleted file mode 100644
index e69de29..0000000
diff --git a/libs/krypto/rng.c b/libs/krypto/rng.c
deleted file mode 100644
index f19c4f9..0000000
--- a/libs/krypto/rng.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <krypto/extern.h>
-#include <krypto/rng.h>
-#include <krypto/rng-impl.h>
-
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <klib/refcount.h>
-
-#include <stdlib.h>
-#include <assert.h>
-
-LIB_EXPORT rc_t CC KRngAddRef (const KRng * self)
-{
-    if (self) switch (KRefcountAdd (&self->refcount, "KRng"))
-    {
-    case krefLimit:
-        return RC (rcRuntime, rcNoTarg, rcAttaching, rcRange, rcExcessive);
-    }
-
-    return 0;
-}
-
-
-LIB_EXPORT rc_t CC KRngRelease (const KRng * self)
-{
-    if (self) switch (KRefcountDrop (&self->refcount, "KRng"))
-    {
-    case krefWhack:
-        switch (self->vt->v1.maj)
-        {
-        case 1:
-            return (self->vt->v1.destroy ((KRng*)self));
-        }
-        return RC (rcKrypto, rcRng, rcAccessing, rcSelf, rcBadVersion);
-    }
-    return 0;
-}
-
-
-LIB_EXPORT rc_t CC KRngSeed (KRng * self)
-{
-    if (self == NULL)
-        return RC (rcKrypto, rcRng, rcReading, rcSelf, rcNull);
-
-    switch (self->vt->v1.maj)
-    {
-    case 1:
-        return (self->vt->v1.seed (self));
-    }
-    return RC (rcKrypto, rcRng, rcAccessing, rcSelf, rcBadVersion);
-}
-
-
-LIB_EXPORT rc_t CC KRngReseed (KRng * self, void * buffer, size_t bsize)
-{
-    if (self == NULL)
-        return RC (rcKrypto, rcRng, rcReading, rcSelf, rcNull);
-    if (buffer == NULL)
-        return RC (rcKrypto, rcRng, rcReading, rcBuffer, rcNull);
-
-    switch (self->vt->v1.maj)
-    {
-    case 1:
-        return (self->vt->v1.reseed (self, buffer, bsize));
-    }
-    return RC (rcKrypto, rcRng, rcAccessing, rcSelf, rcBadVersion);
-}
-
-LIB_EXPORT rc_t CC KRngRead (const KRng * self, void * buffer, uint32_t bsize, uint32_t * num_read)
-{
-    if (num_read == NULL)
-        return RC (rcKrypto, rcRng, rcReading, rcParam, rcNull);
-    *num_read = 0;
-    if (self == NULL)
-        return RC (rcKrypto, rcRng, rcReading, rcSelf, rcNull);
-    if (buffer == NULL)
-        return RC (rcKrypto, rcRng, rcReading, rcBuffer, rcNull);
-
-    switch (self->vt->v1.maj)
-    {
-    case 1:
-        return (self->vt->v1.read (self, buffer, bsize, num_read));
-    }
-    return RC (rcKrypto, rcRng, rcAccessing, rcSelf, rcBadVersion);
-}
-
-LIB_EXPORT rc_t CC KRngInit (KRng * self, union KRng_vt * vt, const char * type)
-{
-    self->vt = vt;
-    KRefcountInit (&self->refcount, 1, "KRng", "Init", type);
-    return 0;
-}
-
-    
diff --git a/libs/krypto/testcipher.c b/libs/krypto/testcipher.c
deleted file mode 100644
index d23257f..0000000
--- a/libs/krypto/testcipher.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-#include <krypto/extern.h>
-#include <klib/defs.h>
-
-#include <krypto/cipher-test.h>
-#include "cipher-priv.h"
-#include <klib/rc.h>
-
-
-KRYPTO_EXTERN
-rc_t KCipherTestVecAesNiMake (struct KCipher ** new_cipher, kcipher_type type)
-{
-    if (new_cipher == NULL)
-        return RC (rcKrypto, rcCipher, rcConstructing, rcSelf, rcNull);
-
-    else
-        return KCipherVecAesNiMake (new_cipher, type);
-}
-
-
-KRYPTO_EXTERN
-rc_t KCipherTestVecRegMake   (struct KCipher ** new_cipher, kcipher_type type)
-{
-    if (new_cipher == NULL)
-        return RC (rcKrypto, rcCipher, rcConstructing, rcSelf, rcNull);
-
-    else
-        return KCipherVecRegMake (new_cipher, type);
-}
-
-
-KRYPTO_EXTERN
-rc_t KCipherTestVecMake      (struct KCipher ** new_cipher, kcipher_type type)
-{
-    if (new_cipher == NULL)
-        return RC (rcKrypto, rcCipher, rcConstructing, rcSelf, rcNull);
-
-    else
-        return KCipherVecMake (new_cipher, type);
-}
-
-
-KRYPTO_EXTERN
-rc_t KCipherTestByteMake     (struct KCipher ** new_cipher, kcipher_type type)
-{
-    if (new_cipher == NULL)
-        return RC (rcKrypto, rcCipher, rcConstructing, rcSelf, rcNull);
-
-    else
-        return KCipherByteMake (new_cipher, type);
-}
-
-
diff --git a/libs/krypto/wgaencrypt.c b/libs/krypto/wgaencrypt.c
deleted file mode 100644
index b2858fb..0000000
--- a/libs/krypto/wgaencrypt.c
+++ /dev/null
@@ -1,1254 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- */
-
-#include <krypto/extern.h>
-#include <krypto/cipher.h>
-#include <krypto/ciphermgr.h>
-
-#include <krypto/wgaencrypt.h>
-
-#include <kfs/file.h>
-#include <kfs/countfile.h>
-#include <kfs/md5.h>
-#include <kfs/buffile.h>
-#include <kfs/nullfile.h>
-
-#include <klib/printf.h>
-#include <klib/rc.h>
-#include <klib/text.h>
-#include <klib/checksum.h>
-#include <klib/log.h>
-#include <klib/debug.h>
-
-#include <sysalloc.h>
-
-#include <strtol.h>
-
-#include <time.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-#include <os-native.h> /* strncasecmp on Windows */
-
-/* retain errors in encryption to be compatible with C++ */
-#define RETAINED_COMPATIBILTY_WITH_ERROR 1
-
-
-#define WGA_AES_BITS (256)
-#define ECB_BYTES (16)
-#define DEFAULT_BUFF_SIZE       (32*1024)
-
-
-#define DEBUG_STS(msg)     DBGMSG(DBG_KRYPTO,DBG_FLAG(DBG_KRYPTO_STS),msg)
-#define DEBUG_CFG(msg)     DBGMSG(DBG_KRYPTO,DBG_FLAG(DBG_KRYPTO_CFG_,msg)
-#define DEBUG_ENCRYPT(msg) DBGMSG(DBG_KRYPTO,DBG_FLAG(DBG_KRYPTO_ENCRYPT_,msg)
-#define DEBUG_DECRYPT(msg) DBGMSG(DBG_KRYPTO,DBG_FLAG(DBG_KRYPTO_DECRYPT_,msg)
-
-static
-void CalcMD5 (void * buffer, size_t size, char hexstr [32])
-{
-    static const char to_hex[16] = "0123456789abcdef";
-    MD5State state;
-    uint8_t digest [16];
-    uint8_t * bin;
-    char * hex;
-    int ix;
-
-    MD5StateInit (&state);
-    MD5StateAppend (&state, buffer, size);
-    MD5StateFinish (&state, digest);
-
-    bin = digest;
-    hex = hexstr;
-
-    for (ix = 0; ix < sizeof digest; ++ix)
-    {
-        uint8_t upper;
-        uint8_t lower;
-
-        upper = *bin++;
-        lower = upper & 0xF;
-        upper >>= 4;
-
-        *hex++ = to_hex [upper];
-        *hex++ = to_hex[lower];
-    }
-}
-
-
-/* ----------------------------------------------------------------------
- * KWGAEncFileMagic is extracted from 
- *      internal/WGA/access_countrol/src/wga/fuse/enc_reader.[ch]pp
- * 
- * the size 9 is not commented on but appears to be the size of ASCIZ
- * that is the 'magic' pattern including the NUL.
- *
- * There is no version number in the header and that NUL could be turned
- * into a single byte version.
- */
-typedef char KWGAEncFileMagic [9];
-static const KWGAEncFileMagic ncbi_crypt_magic = "NeCnBcIo";
-
-/* ----------------------------------------------------------------------
- * Some values are stored in the encrypted file header using an odd radix 33
- */
-#define KWGA_ENC_FILE_HEADER_RADIX      (33)
-
-static
-const char KWGAEncFileHeaderAlphabet[] = "0123456789abcdefghijklmnopqrstuvwxyz";
-
-
-/* ----------------------------------------------------------------------
- * KWGAEncFileHeader is extracted from 
- *      internal/WGA/access_countrol/src/wga/fuse/enc_reader.[ch]pp
- *
- * There is no version number in this header; see the comment about KWGAEncFileMagic
- */
-typedef uint8_t FER_ENCODING;
-enum
-{
-    fer_encDES,
-    fer_encBLF,
-    fer_encAES
-};
-
-typedef struct KWGAEncFileHeader
-{
-    char magic [9];     /* "NeCnBcIo" -- NUL could be turned into a version */          /* 00 */
-    char block_sz [8];  /* radixx33 encoded: block size in bytes / usually 4096  */     /* 09 */
-    char file_sz [16];  /* radixx33 encoded: total size of unencrypted file */          /* 11 */
-    char mtime [8];     /* radixx33 encoded: 32 bit time_t  */                          /* 21 */
-    char fer_enc;       /* see FER_ENCODING */                                          /* 29 */
-    char md5_here;      /* bool if non zero, the whole file MD5 is below */             /* 2A */
-    char md5 [32];      /* whole file MD5 is ASCII hex */                               /* 2B */
-    char md51 [32];     /* first block MD5 */                                           /* 4B */
-    char reserved [21];                                                                 /* 6B */
-} KWGAEncFileHeader;                                                                    /* 80 */
-
-/* Original definition is in internal/WGA/access_countrol/src/wga/fuse/enc_reader.hpp */
-static const int8_t header_table[sizeof (KWGAEncFileHeader)] =
-{
-    101,  -6,   -23,  5,    -93,  20,   -128, -36,      /* 00 */
-    -42,  74,   -98,  104,  42,   12,   127,  37,       /* 08 */
-    -47,  -61,  124,  54,   -124, -94,  47,   72,       /* 10 */
-    70,   17,   -10,  108,  8,    31,   37,   -38,      /* 18 */
-    104,  -6,   -117, 79,   115,  89,   33,   -93,      /* 20 */
-    -47,  -105, -87,  -38,  90,   -45,  -59,  -46,      /* 28 */
-    -96,  106,  15,   -87,  -110, -101, 106,  -117,     /* 30 */
-    39,   73,   120,  -30,  -63,  21,   127,  -32,      /* 38 */
-    98,   -104, -3,   -81,  -60,  -120, 13,   -108,     /* 40 */
-    -53,  88,   123,  7,    103,  32,   -14,  -113,     /* 48 */
-    -68,  -27,  44,   109,  -122, -7,   81,   -13,      /* 50 */
-    64,   42,   -88,  -37,  -1,   -19,  66,   -105,     /* 58 */
-    -75,  -108, -5,   -121, -86,  47,   -120, -18,      /* 60 */
-    -69,  -29,  -68,  124,  -53,  -104, -28,  42,       /* 68 */
-    120,  52,   -80,  -23,  -110, -101, 106,  -117,     /* 70 */
-    -21,  -35,  12,   -117, 9,    -122, -21,  31        /* 78 */
-};                                                      /* 80 */
-
-static const KWGAEncFileHeader header_const =
-{
-    "NeCnBcIo", /* NUL terminator is significant */
-    {0},{0},{0},/* not constant */
-    fer_encAES, /* constant as DES and Blowfish are not implmented */
-    0,{0},{0},  /* not constant */
-    {0}         /* constant */
-};
-
-/* the header is obscured by XOR against a predefined pattern */
-static
-void KWGAEncFileHeaderDecrypt (KWGAEncFileHeader * header)
-{
-    size_t ix;
-    int8_t * p = (int8_t*)header;
-
-    assert (header);
-    for (ix = 0; ix < sizeof (*header); ++ix)
-        p[ix] ^= header_table[ix];
-}
-
-KRYPTO_EXTERN rc_t CC KFileIsWGAEnc (const void * buffer, size_t buffer_size)
-{
-    const uint8_t * ph;
-    const uint8_t * pt;
-    const uint8_t * pb;
-    size_t ix;
-    size_t lim;
-
-    if ((buffer == NULL) || (buffer_size == 0))
-        return RC  (rcFS, rcFile, rcIdentifying, rcParam, rcNull); 
-
-    /* bare minimum size to identify we decide is the first 8 
-     * obsfucated ASCII bytes */
-
-    if (buffer_size < (sizeof (header_const.magic) - 1))
-        return RC (rcFS, rcFile, rcIdentifying, rcBuffer, rcInsufficient); 
-
-    /* a match is ph[X] ^ pt[X] == pb[X] at specially identified points
-     * we could have put the ^ into a constant for a tad faster operation
-     * but meh...
-     */
-    ph = (const uint8_t*)&header_const;
-    pt = (const uint8_t*)&header_table;
-    pb = (const uint8_t*)buffer;
-
-    ix = offsetof (struct KWGAEncFileHeader, magic);
-    lim = ix + sizeof (header_const.magic);
-    if (lim > buffer_size)
-        lim = buffer_size;
-    for (; (ix < lim) && (ix < buffer_size); ++ix)
-        if ((ph[ix] ^ pt[ix]) != pb[ix])
-            return RC (rcFS, rcFile, rcIdentifying, rcFile, rcWrongType); 
-
-    if (buffer_size < offsetof (struct KWGAEncFileHeader, fer_enc))
-        return 0;
-
-    if ((ph[offsetof (struct KWGAEncFileHeader, fer_enc)] ^ pt[offsetof (struct KWGAEncFileHeader, fer_enc)])
-        != pb[offsetof (struct KWGAEncFileHeader, fer_enc)])
-        return RC (rcFS, rcFile, rcIdentifying, rcFile, rcWrongType); 
-
-
-    ix = offsetof (struct KWGAEncFileHeader, reserved);
-    if (buffer_size < ix)
-        return 0;
-
-    lim = ix + sizeof (header_const.reserved);
-
-    if (lim > buffer_size)
-        lim = buffer_size;
-    
-    for (; ix < lim; ++ix)
-        if ((ph[ix] ^ pt[ix]) != pb[ix])
-            return RC (rcFS, rcFile, rcIdentifying, rcFile, rcWrongType);
-
-    return 0;
-}
-
-
-
-
-
-
-/* ======================================================================
- * KWGAEncFile
- */
-
-/* -----
- * define the specific types to be used in the templatish/inheritancish
- * definition of vtables and their elements
- */
-typedef struct KWGAEncFile KWGAEncFile;
-#define KFILE_IMPL struct KWGAEncFile
-
-#include <kfs/impl.h>
-
-struct KWGAEncFile
-{
-    KFile dad;                  /* base class */
-    const KFile * encrypted;    /* encrypted file as a read only KFile */
-    uint64_t file_size;         /* as read from the encrypted file header */
-    KTime_t mtime;              /* as read from the encrypted file header */
-    uint32_t block_size;        /* block size is in KB  not bytes */
-    KCipher * cipher;
-
-    char inkey [32];
-    size_t inkey_size;
-
-    bool md5_here;              /* was the md5 in the header? */
-    char md5[32];            /* external md5 loaded into the header as ASCII hex */
-    char md51[32];           /* md5 of first block loaded into the header as ASCII hex */
-    struct
-    {
-        uint64_t  offset;       /* position with in the unencrypted file */
-        uint32_t  valid;        /* how much usable at data */
-        uint8_t   data [DEFAULT_BUFF_SIZE];
-    } buffer;
-};
-
-
-/* ----------------------------------------------------------------------
- * InitKey
- *
- * This method mimics the prepare_key method in the WGA C++ code including
- * what looks like programming errors.
- *
- * The goal is compatibility not 'correctness'.
- */
-static
-rc_t KWGAEncFileKeyInit (KWGAEncFile * self, const char * key, size_t key_size)
-{
-    rc_t rc;
-    char g_key [32];  /* original used 513 but no key uses that much */
-
-    /* scary! */
-    /* this is copied directly from enc_read.cpp with all the 'possibly wrong' code */
-    memset (g_key, 0, sizeof g_key);
-    if (key_size > sizeof (g_key))
-        key_size = sizeof (g_key);
-    memcpy (g_key, key, key_size);
-
-    if (key_size < 16) /* even though g_key and some cipher keys are larger than 16 */
-    {
-        size_t jx, ix;
-        for ((jx = key_size),(ix = 0); jx < 16; ++jx, ++ix)
-        {
-            g_key[jx] = self->md51[ix] | g_key[ix%(jx?jx:1)];    /* cringe? */
-        }
-    }
-
-    /* okay we'll use 32 bytes from g_key though is is highly
-     * likely we've only got 16 non-zero bytes */
-     rc = KCipherSetDecryptKey (self->cipher, g_key, WGA_AES_BITS/8);
-
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * Destroy
- *
- */
-static
-rc_t CC KWGAEncFileDestroyRead (KWGAEncFile *self)
-{
-    rc_t rc = 0;
-
-    if (self)
-    {
-        rc = KFileRelease (self->encrypted);
-        free (self);
-    }
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * GetSysFile
- *  returns an underlying system file object
- *  and starting offset to contiguous region
- *  suitable for memory mapping, or NULL if
- *  no such file is available.
- *
- * We do not allow this for read, write or update as you can not memory map the 
- * unencrypted file in a meaningful way.
- */
-static
-struct KSysFile *CC KWGAEncFileGetSysFile (const KWGAEncFile *self, uint64_t *offset)
-{
-    assert (self);
-    assert (offset);
-    return NULL;
-}
-
-
-/* ----------------------------------------------------------------------
- * RandomAccess
- *
- *  returns 0 if random access, error code otherwise
- */
-static
-rc_t CC KWGAEncFileRandomAccess (const KWGAEncFile *self)
-{
-    assert (self != NULL);
-    assert (self->encrypted != NULL);
-    return KFileRandomAccess (self->encrypted);
-}
-
-
-/* ----------------------------------------------------------------------
- * Size
- *  returns size in bytes of file
- *
- *  "size" [ OUT ] - return parameter for file size
- */
-static
-rc_t CC KWGAEncFileSize (const KWGAEncFile *self, uint64_t *size)
-{
-    uint64_t esize;
-    rc_t rc;
-    assert (self != NULL);
-    assert (self->encrypted != NULL);
-    assert (size != NULL);
-
-    *size = 0;
-    rc = KFileSize (self->encrypted, &esize);
-    if (rc == 0)
-        *size = esize - sizeof (KWGAEncFileHeader);
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * SetSize
- *  sets size in bytes of file
- *
- *  "size" [ IN ] - new file size
- */
-static
-rc_t CC KWGAEncFileSetSize (KWGAEncFile *self, uint64_t size)
-{
-    assert (self);
-
-    return RC ( rcFS, rcFile, rcUpdating, rcFunction, rcUnsupported );
-}
-
-
-/* ----------------------------------------------------------------------
- * Read
- *  read file from known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually read
- */
-
-/* local fill the buffer with block or more  */
-static
-rc_t KWGAEncFileReadInt (KWGAEncFile * self, uint64_t pos, size_t bsize)
-{
-    uint64_t adjpos;
-    size_t tot_read;
-    size_t num_read;
-    rc_t rc = 0;
-
-    assert (self);
-    assert (bsize);
-    assert (bsize <= 32 * 1024);
-    assert (128%16 == 0);
-
-    memset (self->buffer.data, 0, sizeof self->buffer.data);
-    tot_read = num_read = 0;
-    adjpos = pos + sizeof (KWGAEncFileHeader);
-#if 0
-    do
-    {
-        rc = KFileRead (self->encrypted, adjpos + tot_read,
-                        self->buffer.data + tot_read, bsize - tot_read,
-                        &num_read);
-        if (rc)
-            return rc;        
-        tot_read += num_read;
-    } while ((tot_read < bsize) && (num_read > 0));
-#else
-    rc = KFileReadAll (self->encrypted, adjpos, self->buffer.data, bsize,
-                       &tot_read);
-#endif
-    self->buffer.offset = pos;
-    self->buffer.valid = (uint32_t)tot_read;
-
-    if (tot_read & 15)
-        rc = RC (rcKrypto, rcFile, rcReading, rcSize, rcInsufficient);
-    else if (tot_read > 0)
-    {
-#if 1
-
-#if RETAINED_COMPATIBILTY_WITH_ERROR
-        KCipherDecryptECB (self->cipher, self->buffer.data, self->buffer.data,
-                           (uint32_t)(tot_read / ECB_BYTES));
-#else
-/* Well this is wrong for even being wrong now */
-        KCipherDecryptECB (self->cipher, self->buffer.data, self->buffer.data,
-                           tot_read);
-#endif
-
-#else
-        uint32_t count;
-        uint32_t ix;
-
-        /* this loop can be replaced by the KCipherDecryptECB
-         * with care taken to match the error in the original
-         * C++
-         */
-
-#if RETAINED_COMPATIBILTY_WITH_ERROR
-        count = tot_read / ECB_BYTES;
-#else
-        /* do all full 16 byte blocks plus a last partial block */
-        count = (tot_read + (ECB_BYTES-1)) / ECB_BYTES;
-#endif
-        for (ix = 0; ix < count; ++ix)
-        {
-            uint8_t * pb = self->buffer.data + (ix * ECB_BYTES);
-
-            rc = KCipherDecrypt (self->cipher, pb, pb);
-            if (rc)
-                break;
-        }
-#endif
-    }
-    return rc;
-}
-
-
-static
-rc_t CC KWGAEncFileRead	(const KWGAEncFile *cself,
-                         uint64_t pos,
-                         void *buffer,
-                         size_t bsize,
-                         size_t *num_read)
-{
-    KWGAEncFile * self = (KWGAEncFile *)cself; /* mutable values */
-    rc_t rc = 0;
-
-    assert (cself);
-    assert (buffer);
-    assert (num_read);
-
-
-    *num_read = 0;
-
-    /* are we even within the file? If not just say no. Drugs are bad Mmmkay */
-    if (pos >= self->file_size)
-    {}
-    /* are we not reading from out what is already in the decrypted buffer space? */
-    else
-    {
-        if ((self->buffer.valid == 0) ||
-            (pos < self->buffer.offset) ||
-            (pos >= (self->buffer.offset + self->buffer.valid)))
-        {
-            if (pos < self->block_size) /* we'll be reading from the first 'block' */
-            {
-                rc = KWGAEncFileReadInt (self, 0, self->block_size);
-                if (rc)
-                {
-                    LOGERR (klogErr, rc, "error reading first data block of"
-                            " encrypted file");
-                    return rc;
-                }
-                if (self->buffer.valid > self->block_size)
-                {
-                    rc = RC (rcFS, rcFile, rcReading, rcBuffer, rcTooBig);
-                    LOGERR (klogInt, rc, "read wrong amount for first block");
-                    return rc;
-                }
-                else
-                {
-                    size_t md5_size;
-                    size_t nudge = 0;
-                    char md51_comp [32];
-
-                    if (self->buffer.valid & (ECB_BYTES-1))
-                        nudge = ECB_BYTES - (self->buffer.valid & (ECB_BYTES-1));
-                    if (nudge)
-                        memset (self->buffer.data + self->buffer.valid, 0, nudge);
-
-                    md5_size = self->buffer.valid + nudge;
-
-                    CalcMD5 (self->buffer.data, md5_size, md51_comp);
-
-#if 1
-                    if (strcase_cmp (self->md51, string_size(self->md51),
-                                     md51_comp, string_size(md51_comp), 32) != 0)
-#else
-                    if (strncasecmp (self->md51, md51_comp, 32) != 0)
-#endif
-                    {
-                        rc = RC (rcFS, rcFile, rcReading, rcConstraint, rcCorrupt);
-                        LOGERR (klogErr, rc, "MD5 does not match in decryption");
-                        return rc;
-                    }
-                }
-            }
-            else /* if (pos >= self->block_size) */
-            {
-                rc = KWGAEncFileReadInt (self, (pos & ~ ( uint64_t ) (16-1)),
-                                         DEFAULT_BUFF_SIZE);
-                if (rc)
-                {
-                    LOGERR (klogErr, rc, "error reading data block of"
-                            " encrypted file");
-                    return rc;
-                }
-            }  /* if (pos < self->block_size) */
-        } /* if ((self->buffer.valid == 0) || etc. */
-        /* if here we have a valid buffer and it contains the start pos requested */
-/*     assert (pos >= self->buffer.offset); */
-/*     assert (pos < (self->buffer.offset +self->buffer.valid)); */
-        {
-            size_t start;
-            size_t limit;
-
-            /* find offset of start for copy within the buffer */
-            start = (size_t)(pos - self->buffer.offset);
-            /* how many bytes available starting here */
-            limit = self->buffer.valid - start;
-
-            if (pos + limit > self->file_size)
-                limit = self->file_size - pos;
-
-            /* are we asking to read more than we have? is so trim the request */
-            if (limit < bsize)
-                bsize = limit;
-
-            memmove (buffer, self->buffer.data + start, bsize);
-            *num_read = bsize;
-        }
-    }
-    return 0;
-}
-
-
-/* ----------------------------------------------------------------------
- * Write
- *  write file at known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ IN ] and "size" [ IN ] - data to be written
- *
- *  "num_writ" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually written
- *
- * Unsupported as we now treat archives as READ ONLY
- */
-static
-rc_t CC KWGAEncFileWriteFail (KWGAEncFile *self, uint64_t pos,
-                              const void *buffer, size_t bsize,
-                              size_t *num_writ)
-{
-    assert (self);
-    return RC (rcFS, rcFile, rcReading, rcFunction, rcUnsupported);
-}
-
-
-/* ----------------------------------------------------------------------
- * Type
- *  returns a KFileDesc
- *  not intended to be a content type,
- *  but rather an implementation class
- */
-static
-uint32_t CC KWGAEncFileType (const KWGAEncFile *self)
-{
-    assert (self != NULL);
-    assert (self->encrypted != NULL);
-
-    return KFileType (self->encrypted);
-}
-
-
-static const KFile_vt_v1 vtKWGAEncFileRead =
-{
-    /* version */
-    1, 1,
-
-    /* 1.0 */
-    KWGAEncFileDestroyRead,
-    KWGAEncFileGetSysFile,
-    KWGAEncFileRandomAccess,
-    KWGAEncFileSize,
-    KWGAEncFileSetSize,
-    KWGAEncFileRead,
-    KWGAEncFileWriteFail,
-
-    /* 1.1 */
-    KWGAEncFileType
-};
-
-
-static
-rc_t KWGAEncFileHeaderRead (KWGAEncFile * self)
-{
-    KWGAEncFileHeader header;
-    uint8_t * pb;
-    size_t num_read;
-    size_t tot_read;
-    rc_t rc;
-
-    assert (self);
-    assert (sizeof (KWGAEncFileHeader) == 128);
-
-
-    DEBUG_STS (("s: Enter '%p'\n", __func__, self));
-    pb = (void*)&header;
-    for (num_read = tot_read = 0; tot_read < sizeof header; )
-    {
-        rc = KFileRead (self->encrypted, (uint64_t)tot_read, pb, 
-                        sizeof (header) - tot_read, &num_read);
-        if (rc)
-        {
-            LOGERR (klogErr, rc, "Error reading the header for an encrypted file");
-            return rc;
-        }
-
-        if (num_read == 0)
-        {
-            rc =  RC (rcFS, rcFile, rcReading, rcFile, rcInsufficient);
-            LOGERR (klogErr, rc, "Header incomplete for an encrypted file");
-            return rc;
-        }
-        tot_read += num_read;
-        pb += num_read;
-    }
-
-    KWGAEncFileHeaderDecrypt (&header);
-
-    if (memcmp (header.magic, ncbi_crypt_magic, sizeof ncbi_crypt_magic) != 0)
-    {
-        rc = RC (rcFS, rcFile, rcReading, rcHeader, rcCorrupt);
-        LOGERR (klogErr, rc, "Header's magic bad for encrypted file");
-        return rc;
-    }
-
-    /* so far unknown legal range */
-    self->block_size = strtou32 (header.block_sz, NULL, KWGA_ENC_FILE_HEADER_RADIX);
-
-    self->file_size = strtou64 (header.file_sz, NULL, KWGA_ENC_FILE_HEADER_RADIX);
-
-    /* file format has limiting feature of a 32 bit timestamp */
-    self->mtime = (KTime_t)strtol (header.mtime, NULL, KWGA_ENC_FILE_HEADER_RADIX);
-
-    switch ((FER_ENCODING)header.fer_enc)
-    {
-    default:
-        rc = RC (rcFS, rcFile, rcReading, rcHeader, rcOutofrange);
-        LOGERR (klogErr, rc, "Enryption type code out of range");
-        return rc;
-    case fer_encDES:
-    case fer_encBLF:
-        rc = RC (rcFS, rcFile, rcReading, rcHeader, rcIncorrect);
-        LOGERR (klogErr, rc, "Enryption type code not supported");
-        return rc;
-    case fer_encAES:
-        break;
-    }
-
-    self->md5_here = (header.md5_here != 0);
-
-    if (self->md5_here)
-        memcpy (self->md5, header.md5, sizeof (self->md5));
-
-    memcpy (self->md51, header.md51, sizeof (self->md51));
-
-    return 0; /* yeah not really checking later errors am i? */
-}
-
-/* ----------------------------------------------------------------------
- * KWGAEncFileMake
- *  create a new file object
- *
- * pself        where to put pointer to new object
- * encrypted    a readable file that is encrypted
- * cipher       a cipher object that must support AES with 256 bit key
- *              not verified except through failure to decrypt a file
- * key          bytes containing the user key - should be utf-8 but with no
- *              control characters
- * key_size     how many bytes to use from the key 
- */
-/* read only version for decrypting of existing files */
-KRYPTO_EXTERN rc_t CC KFileMakeWGAEncRead (const struct KFile ** pself, 
-                                           const struct KFile * encrypted,
-                                           const char * key,
-                                           size_t key_size)
-{
-    rc_t rc;
-
-    if (pself == NULL)
-    {
-        rc = RC (rcFS, rcFile, rcConstructing, rcSelf, rcNull);
-        LOGERR (klogErr, rc, "key parameter for WGA encrypted file is empty");
-        return rc;
-    }
-
-    *pself = NULL;
-
-    if ((encrypted == NULL)||(key == NULL))
-    {
-        rc = RC (rcFS, rcFile, rcConstructing, rcParam, rcNull);
-        LOGERR (klogErr, rc, "missing WGA encrypted file passed in to constructor");
-    }
-
-    else if (key_size == 0)
-    {
-        rc = RC (rcFS, rcFile, rcConstructing, rcParam, rcInvalid);
-        LOGERR (klogErr, rc, "missing WGA encrypted file passed in to constructor");
-    }
-
-    else if (encrypted->read_enabled == 0)
-    {
-        rc = RC (rcFS, rcFile, rcConstructing, rcParam, rcIncorrect);
-        LOGERR (klogErr, rc, "encrypted file not readable");
-    }
-    else
-    {
-        KCipherManager * cipher_mgr;
-
-        rc = KCipherManagerMake (&cipher_mgr);
-        if (rc == 0)
-        {
-            KCipher * cipher;
-
-            rc = KCipherManagerMakeCipher (cipher_mgr, &cipher, kcipher_AES);
-            if (rc == 0)
-            {
-                size_t z;
-
-                rc = KCipherBlockSize (cipher, &z);
-                if (rc)
-                {
-                    LOGERR (klogErr, rc, "unable to get block size for WGA "
-                            "encrypted file cipher passed in to constructor");
-                }
-                else
-                {
-                    if (z != ECB_BYTES)
-                    {
-                        rc = RC (rcFS, rcFile, rcConstructing, rcParam,
-                                 rcInvalid);
-                        LOGERR (klogErr, rc, "wrong block size for WGA "
-                                "encrypted file cipher passed in to "
-                                "constructor");
-                    }
-                    else
-                    {
-                        KWGAEncFile * self;
-
-                        self = calloc (sizeof (*self), sizeof (uint8_t));
-                        if (self == NULL)
-                        {
-                            rc = RC (rcFS, rcFile, rcConstructing, rcMemory,
-                                     rcExhausted);
-                            LOGERR (klogErr, rc, "out of memory while "
-                                    "constructing decryptor");
-                        }
-                        else
-                        {
-                            rc = KFileAddRef (encrypted);
-                            if (rc)
-                                LOGERR (klogErr, rc, "unable to add reference "
-                                "to encrypted file");
-                            else
-                            {
-                                /* cast to strip const */
-                                self->encrypted = encrypted;
-                                self->cipher = cipher;
-
-                                /* read the header of the encrypted file for
-                                 * details about the  decrypted file */
-                                DEBUG_STS(("%s: calling KWGAEncFileHeaderRead\n",
-                                           __func__));
-                                rc = KWGAEncFileHeaderRead (self);
-                                if (rc == 0)
-                                {
-                                    /* using the file header's stored encoding
-                                     * key build a key from the parameter key */
-                                    DEBUG_STS(("%s: calling "
-                                               "KWGAEncFileHeaderRead\n",
-                                               __func__));
-                                    rc = KWGAEncFileKeyInit (self, key,
-                                                             key_size);
-                                }
-                                if (rc == 0)
-                                {
-                                    rc = KFileInit (&self->dad, 
-                                                    (const KFile_vt*)
-                                                    &vtKWGAEncFileRead,
-                                                    "KWGAEncFile", "no-name",
-                                                    true, false);
-                                    if (rc)
-                                        LOGERR (klogInt, rc, "Failed to initialize decrypting file");
-                                    else
-                                    {
-                                        *pself = &self->dad;
-                                        self->buffer.offset = 0;
-                                        self->buffer.valid = 0;
-                                        KCipherManagerRelease (cipher_mgr);
-                                        return 0;
-                                    }
-                                }
-                                /* release of encrypted handled in destroy() */
-                            }
-                            KWGAEncFileDestroyRead (self);
-                        }
-                    }
-                }
-                KCipherRelease (cipher);
-            }           
-        }
-    }
-    return rc; 
-}
-
-static __inline__
-rc_t WGAEncValidateHeader (const KWGAEncFileHeader * header,
-                           size_t header_size)
-{
-    rc_t rc = 0;
-    unsigned ix;
-
-    if (header_size != sizeof * header)
-    {
-        rc = RC (rcKrypto, rcFile, rcValidating, rcHeader, rcInsufficient);
-        LOGERR (klogErr, rc, "incomplete header");
-        return rc;
-    }
-
-    if (memcmp (header, &header_const, sizeof header->magic) != 0)
-    {
-        rc = RC (rcKrypto, rcFile, rcValidating, rcHeader, rcInvalid);
-        LOGERR (klogErr, rc, "bad signature in encrypted file header");
-        return rc;
-    }
-
-#if 0
-    /* check block_size */
-    do
-    {
-        for (ix = 0; isspace(header->block_sz[ix]); ++ix)
-            ;
-
-        if (ix >= sizeof (header->block_sz))
-            break;
-
-        if (header->block_sz[ix] == '+')
-            ++ix;
-
-        if (ix >= sizeof (header->block_sz))
-            break;
-
-        for (; (ix < sizeof header->block_sz); ++ix)
-        {
-            if (isdigit (header->block_sz[ix]))
-                ;
-            else if ((header->block_sz[ix] >= 'a') &&
-                     (header->block_sz[ix] <= 'w'))
-                ;
-            else if ((header->block_sz[ix] >= 'A') &&
-                     (header->block_sz[ix] <= 'W'))
-                ;
-            else
-                break;
-        }
-        for (; (ix < sizeof header->block_sz); ++ix)
-        {
-            if (header->block_sz[ix] == '\0')
-                ;
-            else
-                break;
-        }
-        if (rc)
-        
-
-
-        for (ix = 0; ix < sizeof header->block_size; ++ix)
-        {
-            if ()
-                ;
-                }
-        
-            ;
-        else if (header->block_sz[ix] == '-')
-            ;
-        else
-            ;
-    }while (0);
-    /* check file_sz */
-    /* check mtime */
-#endif
-
-    if (header->fer_enc != fer_encAES)
-    {
-        rc = RC (rcKrypto, rcFile, rcValidating, rcHeader, rcInvalid);
-        LOGERR (klogErr, rc, "bad encoding flag in encrypted file header");
-        return rc;
-    }
-
-    if ((header->md5_here != true) && (header->md5_here != false))
-    {
-        rc = RC (rcKrypto, rcFile, rcValidating, rcHeader, rcInvalid);
-        LOGERR (klogErr, rc, "bad checksum flag in encrypted file header");
-        return rc;
-    }
-
-    /* check md5 */
-    /* check md51 */
-
-    for (ix = 0; ix < sizeof header->reserved; ++ix)
-    {
-        if (header->reserved[ix] != 0)
-        {
-            rc = RC (rcKrypto, rcFile, rcValidating, rcHeader, rcInvalid);
-            LOGERR (klogErr, rc, "bad reserved space in encrypted file header");
-            return rc;
-        }
-    }
-
-    return 0;
-}
-
-
-KRYPTO_EXTERN rc_t CC WGAEncValidate (const KFile * encrypted, 
-                                      const char * key,
-                                      size_t key_size)
-{
-    const KFile * buffile;
-    rc_t rc, orc;
-
-    rc = KBufFileMakeRead (&buffile, encrypted, 64*1024);
-    if (rc)
-        LOGERR (klogErr, rc, "unable to buffer encrypted file");
-
-    else
-    {
-        KWGAEncFileHeader header;
-        size_t num_read;
-
-        /* first let's disect the header */
-        rc = KFileReadAll (buffile, 0, &header, sizeof header, &num_read);
-        if (rc)
-            LOGERR (klogErr, rc, "unable to read encrypted file header");
-
-        else
-        {
-            uint64_t file_size;
-            uint64_t header_file_size;
-            char ascii_md5 [32];
-            char header_ascii_md5 [32];
-
-            KWGAEncFileHeaderDecrypt (&header);
-
-            rc = WGAEncValidateHeader (&header, num_read);
-            if (rc)
-                ;
-
-            else
-            {
-                if (key_size == 0)
-                {
-                    const KFile * countfile;
-                    rc = KFileMakeCounterRead (&countfile, encrypted, &file_size, NULL, false);
-                    if (rc)
-                    {
-                        LOGERR (klogErr, rc, "error making file size counter");
-                        file_size = 0;
-                    }
-                    else
-                    {
-                        KFileAddRef (encrypted);
-                        KFileRelease (countfile);
-
-                        file_size -= sizeof header;
-                    }
-                }
-                else
-                {
-                    union
-                    {
-                        const KFile * decrypted;
-                        const KWGAEncFile * decryptor;
-                    } u;
-
-                    rc = KFileMakeWGAEncRead (&u.decrypted, buffile, key, key_size);
-                    if (rc)
-                        LOGERR (klogErr, rc, "error making decryptor");
-
-                    else
-                    {
-                        KFile * nullfile;
-
-                        rc = KFileMakeNullUpdate (&nullfile);
-                        if (rc)
-                            LOGERR (klogInt, rc, "error making data sync");
-
-                        else
-                        {
-                            KMD5SumFmt * fmt;
-                            static const char name[] = "wgaencrypt";
-
-                            rc = KMD5SumFmtMakeUpdate (&fmt, nullfile);
-                            if (rc)
-                            {
-                                LOGERR (klogInt, rc, "error making md5sum database");
-                                KFileRelease (nullfile);
-                            }
-                            else
-                            {
-                                const KFile * md5file;
-
-                                rc = KFileMakeNewMD5Read (&md5file, u.decrypted, fmt, name);
-                                if (rc)
-                                    LOGERR (klogInt, rc, "error making MD5 calculator");
-
-                                else
-                                {
-                                    /*
-                                     * ill mannered md5file steals
-                                     * references instead of adding one
-                                     */
-                                    rc = KFileAddRef (u.decrypted);
-                                    if (rc)
-                                        LOGERR (klogInt, rc, "error adding reference to decryptor");
-
-                                    else
-                                    {
-
-                                        const KFile * countfile;
-                                        rc = KFileMakeCounterRead (&countfile,
-                                                                   md5file,
-                                                                   &file_size, NULL,
-                                                                   true);
-                                        if (rc)
-                                            LOGERR (klogErr, rc,
-                                                    "error making file size "
-                                                    "counter");
-                                        else
-                                        {
-                                            /*
-                                             * ill mannered countfile steals
-                                             * references instead of adding one
-                                             */
-                                            KFileAddRef (md5file);
-                                            rc = KFileRelease (countfile);
-                                        }
-
-                                        orc = KFileRelease (md5file);
-                                    
-                                        if (rc == 0)
-                                            rc = orc;
-
-                                        if (rc == 0)
-                                        {
-                                            uint8_t md5 [16];
-                                            bool bin;
-
-                                            rc = KMD5SumFmtFind (fmt, name, md5, &bin);
-                                            if (rc)
-                                                LOGERR (klogInt, rc, "error locating MD5");
-
-                                            else
-                                            {
-                                                size_t zz;
-                                                unsigned ix;
-                                                for (ix = 0; ix < 16; ++ix)
-                                                {
-                                                    string_printf (&ascii_md5[2*ix], 2, &zz, "%2.2x",
-                                                               (unsigned)(uint8_t)md5[ix]);
-                                                }
-                                                memcpy (header_ascii_md5,
-                                                        u.decryptor->md5,
-                                                        sizeof header_ascii_md5);
-                                            }
-                                        }
-                                    }
-                                }
-                                KMD5SumFmtRelease (fmt);
-                            }
-                        }
-                        KFileRelease (u.decrypted);
-                    }                
-                }
-            }
-            if (rc == 0)
-            {
-                uint64_t sys_file_size;
-                uint64_t pad_file_size = 0;
-                rc_t orc;
-
-                /* ccheck file size */
-
-                orc = KFileSize (encrypted, &sys_file_size);
-                if (orc == 0)
-                {
-                    pad_file_size = file_size + 15;
-                    pad_file_size &= ~ ( uint64_t ) 15;
-                    pad_file_size += sizeof (KWGAEncFileHeader);
-                }
-                header_file_size = strtou64 (header.file_sz, NULL, KWGA_ENC_FILE_HEADER_RADIX);
-
-                if (key_size == 0)
-                {
-                    header_file_size += 15;
-                    header_file_size &= ~ ( uint64_t ) 15;
-                }
-
-                if (file_size < header_file_size)
-                    rc = RC (rcKrypto, rcFile, rcValidating, rcSize, rcInsufficient);
-                
-                else if (file_size > header_file_size)
-                    rc = RC (rcKrypto, rcFile, rcValidating, rcSize, rcExcessive);
-
-                else if ((orc == 0) &&
-                         (sys_file_size > pad_file_size))
-                    rc = RC (rcKrypto, rcFile, rcValidating, rcSize, rcExcessive);
-
-                /* check md5 */
-                else if (!header.md5_here)
-                {
-                    /* rc = RC (rcKrypto, rcFile, rcValidating, rcEncryption, rcNotFound); */
-                }
-                else if (key_size == 0)
-                    rc = RC (rcKrypto, rcFile, rcValidating, rcEncryption, rcNull);
-
-                else
-                {
-                    int cmp;
-
-                    cmp = strcase_cmp (ascii_md5, sizeof ascii_md5, 
-                                       header_ascii_md5, sizeof header_ascii_md5,
-                                       sizeof ascii_md5);
-                    if (cmp)
-                    {
-                        rc = RC (rcKrypto, rcFile, rcValidating, rcChecksum,
-                                 rcInvalid);
-                        LOGERR (klogErr, rc, "Encrypted file MD5 does not match");
-                    }
-                }
-            }
-        }
-        KFileRelease (buffile);
-    }
-    return rc;
-}
-#if 0
-        /* not working as planned */
-        if (rc == 0)
-        {
-            uint32_t this_read;
-
-            /* try to read past size now obtained */
-            do
-            {
-                uint8_t throwaway [8192];
-
-                rc = KFileRead (encrypted, z + sizeof (KWGAEncFileHeader), throwaway, sizeof throwaway,
-                                &this_read);
-                if (rc)
-                {
-                    LOGERR (klogErr, rc, "Error reading file");
-                    break;
-                }
-                z += this_read;
-
-            } while (this_read);
-        }
-#endif
-
-/* end of file wgaencrypt.c */
-
diff --git a/libs/ktst/Makefile b/libs/ktst/Makefile
deleted file mode 100644
index f028b00..0000000
--- a/libs/ktst/Makefile
+++ /dev/null
@@ -1,81 +0,0 @@
-# ===========================================================================
-#
-#                            PUBLIC DOMAIN NOTICE
-#               National Center for Biotechnology Information
-#
-#  This software/database is a "United States Government Work" under the
-#  terms of the United States Copyright Act.  It was written as part of
-#  the author's official duties as a United States Government employee and
-#  thus cannot be copyrighted.  This software/database is freely available
-#  to the public for use. The National Library of Medicine and the U.S.
-#  Government have not placed any restriction on its use or reproduction.
-#
-#  Although all reasonable efforts have been taken to ensure the accuracy
-#  and reliability of the software and data, the NLM and the U.S.
-#  Government do not and cannot warrant the performance or results that
-#  may be obtained by using this software or data. The NLM and the U.S.
-#  Government disclaim all warranties, express or implied, including
-#  warranties of performance, merchantability or fitness for any particular
-#  purpose.
-#
-#  Please cite the author in any work or product based on this material.
-#
-# ===========================================================================
-
-
-default: std
-
-TOP ?= $(shell ../../build/abspath.sh ../..)
-MODULE = libs/ktst
-
-INT_LIBS = \
-    libktst
-
-ALL_LIBS = \
-	$(INT_LIBS)
-
-include $(TOP)/build/Makefile.env
-
-#-------------------------------------------------------------------------------
-# outer targets
-#
-all std: makedirs
-	@ $(MAKE_CMD) $(TARGDIR)/std
-
-$(INT_LIBS): makedirs
-	@ $(MAKE_CMD) $(ILIBDIR)/$@
-
-.PHONY: all std $(ALL_LIBS)
-
-#-------------------------------------------------------------------------------
-# std
-#
-$(TARGDIR)/std: \
-	$(addprefix $(ILIBDIR)/,$(INT_LIBS))
-
-.PHONY: $(TARGDIR)/std
-
-#-------------------------------------------------------------------------------
-# clean
-#
-clean: stdclean
-
-.PHONY: clean
-
-#-------------------------------------------------------------------------------
-# testing framework
-#
-$(ILIBDIR)/libktst: $(addprefix $(ILIBDIR)/libktst.,$(LIBX))
-
-TST_SRC = \
-	runprocesstestcase \
-	testenv \
-	testcase \
-	testrunner
-
-TST_OBJ = \
-	$(addsuffix .$(LOBX),$(TST_SRC))
-
-$(ILIBDIR)/libktst.$(LIBX): $(TST_OBJ)
-	$(LP) --slib -o $@ $^ $(TST_LIB)
-
diff --git a/libs/ktst/testcase.cpp b/libs/ktst/testcase.cpp
deleted file mode 100644
index 5c0a948..0000000
--- a/libs/ktst/testcase.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <ktst/unit_test.hpp>
-
-#include <klib/printf.h> 
-
-using namespace ncbi::NK;
-
-TestCase::TestCase(const std::string& name) 
-: _name(name), _ec(0) 
-{
-}
-
-void TestCase::report_error(const char* msg, const char* file, int line, bool is_msg, bool isCritical)
-{
-    ncbi::NK::saveLocation(file, line);
-    ++_ec;
-    LOG(LogLevel::e_error, file << "(" << line << "): ");
-    if (isCritical) 
-    {
-        LOG(LogLevel::e_error, "fatal ");
-    }
-    LOG(LogLevel::e_error, "error in \"" << _name << "\": ");
-    if (is_msg) 
-    {
-        LOG(LogLevel::e_error, msg);
-    }
-    else 
-    {
-        if (isCritical) 
-        {
-            LOG(LogLevel::e_error, "critical ");
-        }
-        LOG(LogLevel::e_error, "check " << msg << " failed");
-    }
-    LOG(LogLevel::e_error, std::endl);
-    if (isCritical)
-    { 
-        throw ncbi::NK::execution_aborted(); 
-    }
-}
-
-void TestCase::report_passed(const char* msg, const char* file, int line) 
-{
-    ncbi::NK::saveLocation(file, line);
-    LOG(LogLevel::e_all, file << "(" << line << "): info: " "check " << msg << " passed" << std::endl);
-}
-
-void TestCase::_REPORT_CRITICAL_ERROR_(const std::string& msg, const char* file, int line, bool is_msg)
-{ 
-    report_error( msg.c_str(), file, line, is_msg, true ); 
-}
-
-void TestCase::report_rc(rc_t rc, const char* callStr, const char* file, int line, int successExpected, bool isCritical)
-{
-    if ((successExpected && rc != 0) || (!successExpected && rc == 0))
-    {
-        const int BufSize=1024;
-        char buf[BufSize];
-        size_t num_writ=0;
-        if (0 == string_printf (buf, BufSize, &num_writ, "Unexpected return code from %s: %R\n", callStr, rc))
-        {
-            report_error(buf, file, line, true, isCritical);
-        }
-        else
-        {
-            report_error("***error message too large to print***", file, line, true, isCritical);
-        }
-    }
-}
-
diff --git a/libs/ktst/testenv.cpp b/libs/ktst/testenv.cpp
deleted file mode 100644
index d76b93e..0000000
--- a/libs/ktst/testenv.cpp
+++ /dev/null
@@ -1,514 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <ktst/unit_test.hpp>
-
-#if ALLOW_TESTING_CODE_TO_RELY_UPON_CODE_BEING_TESTED
-
-#include <kapp/main.h> // KAppVersion
-#include <kapp/args.h> // ArgsWhack
-#include <klib/out.h> // KOutMsg
-
-#endif
-
-#include <klib/rc.h>
-#include <sstream> 
-#include <csignal>
-#include <cstdlib>
-#include <cstring>
-
-using namespace ::ncbi::NK;
-using std::string;
-
-//const int TestEnv::TEST_CASE_TIMED_OUT=14; //SIGALRM
-//const int TestEnv::TEST_CASE_FAILED=255;
-
-bool TestEnv::in_child_process = false;
-
-#if ALLOW_TESTING_CODE_TO_RELY_UPON_CODE_BEING_TESTED
-struct Args* TestEnv::args = 0;
-#endif
-
-TestEnv::TestEnv(int argc, char* argv[], ArgsHandler* argsHandler) 
-    : catch_system_errors(true)
-    , argc2(0)
-    , argv2(NULL)
-{
-    rc_t rc = process_args(argc, argv, argsHandler);
-    if (rc != 0) {
-        throw rc;
-    }
-}
-
-TestEnv::~TestEnv ()
-{
-    if (argv2 != NULL) {
-        for (int i = 0; i < argc2; ++i) {
-            free(argv2[i]);
-            argv2[i] = NULL;
-        }
-        free(argv2);
-    }
-
-#if ALLOW_TESTING_CODE_TO_RELY_UPON_CODE_BEING_TESTED
-    ArgsWhack(args);
-    args = NULL;
-#endif
-}
-
-string TestEnv::lastLocation;
-LogLevel::E TestEnv::verbosity = LogLevel::e_error;
-
-void CC TestEnv::TermHandler() 
-{
-    SigHandler(SIGTERM);
-}
-
-void CC TestEnv::SigHandler(int sig) 
-{
-    switch (sig)
-    {
-        case SIGABRT:
-            LOG(ncbi::NK::LogLevel::e_fatal_error,
-                "fatal error: signal: SIGABRT(Abort call)\n");
-            break;
-        case SIGFPE:
-            LOG(ncbi::NK::LogLevel::e_fatal_error,
-                "fatal error: signal: SIGFPE(Floating point exception)\n");
-            break;
-        case SIGILL:
-            LOG(ncbi::NK::LogLevel::e_fatal_error,
-                "fatal error: signal: SIGILL(Illegal instruction)\n");
-            break;
-        case SIGSEGV:
-            LOG(ncbi::NK::LogLevel::e_fatal_error,
-                "fatal error: signal: SIGSEGV(Segmentation fault)\n");
-            break;
-        default:
-            LOG(ncbi::NK::LogLevel::e_fatal_error,
-                "fatal error: signal: " << sig << "\n");
-            break;
-    }
-    if (!ncbi::NK::TestEnv::lastLocation.empty())
-    {
-        LOG(ncbi::NK::LogLevel::e_fatal_error,
-            ncbi::NK::TestEnv::lastLocation << ": last checkpoint\n");
-    }
-    LOG(ncbi::NK::LogLevel::e_fatal_error, "Test is aborted\n");
-    exit(sig);
-}
-
-
-#if ALLOW_TESTING_CODE_TO_RELY_UPON_CODE_BEING_TESTED
-
-#define OPTION_DBG "verbose_cmd_line"
-#define ALIAS_DBG "a"
-static const char * dbg_usage[] = { "print command line argument processing information", NULL };
-
-#define OPTION_CSE "catch_system_errors"
-#define ALIAS_CSE "c"
-static const char * cse_usage[] = { "[yes|y|no|n] catch system errors, default is yes", NULL };
-
-#define OPTION_LOG "test_log_level"
-#define ALIAS_LOG "t"
-static const char * log_usage[] = { "test log level, one of:",
-    "'all':       report all log messages",
-    "             including the passed test notification;",
-    "'test_suite': show test suite messages;",
-    "'message':   show user messages",
-    "'warning':   report warnings issued by user;",
-    "'error':     report all error conditions (default);",
-    "'fatal_error': report user or system originated fatal errors",
-    "             (for example, memory access violation);",
-    "'nothing':   do not report any information", NULL };
-
-OptDef Options[] = {
-      { OPTION_DBG, ALIAS_DBG, NULL, dbg_usage, 1, false, false }
-    , { OPTION_CSE, ALIAS_CSE, NULL, cse_usage, 1, true , false }
-    , { OPTION_LOG, ALIAS_LOG, NULL, log_usage, 1, true , false }
-};
-
-#endif
-
-rc_t TestEnv::process_args(int argc, char* argv[], ArgsHandler* argsHandler) 
-{
-    int arg2 = 9;
-    argv2 = static_cast<char**>(calloc(arg2, sizeof *argv2));
-    if (argv2 == NULL)
-    {   return RC (rcApp, rcArgv, rcAccessing, rcMemory, rcExhausted); }
-    argv2[argc2] = strdup(argv[argc2]);
-    if (argv2[argc2] == NULL)
-    {   return RC (rcApp, rcArgv, rcAccessing, rcMemory, rcExhausted); }
-    ++argc2;
-
-#if ALLOW_TESTING_CODE_TO_RELY_UPON_CODE_BEING_TESTED
-
-    rc_t rc = ArgsMakeAndHandle(&args, argc, argv, 1,
-        Options, sizeof Options / sizeof (OptDef));
-    if (rc)
-    {   return rc; }
-
-    bool debug = false;
-    LogLevel::E detected = LogLevel::e_undefined;
-    do {
-        uint32_t pcount = 0;
-
-        rc = ArgsOptionCount(args, OPTION_DBG, &pcount);
-        if (rc)
-        {   return rc; }
-        if (pcount) {
-            debug = true;
-            LOG(LogLevel::e_nothing, "debug: debug was set to true\n");
-        }
-
-        rc = ArgsOptionCount(args, OPTION_CSE, &pcount);
-        if (rc)
-        {   return rc; }
-        if (pcount) {
-            const char* pc = NULL;
-            rc = ArgsOptionValue(args, OPTION_CSE, 0, &pc);
-            if (rc)
-            {   return rc; }
-            if (!strcmp(pc, "n") || !strcmp(pc, "no")) {
-                catch_system_errors = false;
-                if (debug) {
-                    LOG(LogLevel::e_nothing,
-                       "debug: arg_catch_system_errors was set to false\n");
-                }
-            }
-            else {
-                if (debug) {
-                    LOG(LogLevel::e_nothing,
-                       "debug: arg_catch_system_errors was set to true\n");
-                }
-            }
-        }
-
-        rc = ArgsOptionCount(args, OPTION_LOG, &pcount);
-        if (rc)
-        {   return rc; }
-        if (pcount) {
-            const char* a = NULL;
-            rc = ArgsOptionValue(args, OPTION_LOG, 0, &a);
-            if (rc)
-            {   return rc; }
-            if (!strcmp(a, "test_suite"))
-            { detected = LogLevel::e_test_suite; }
-            else if (strcmp(a, "all"    ) == 0)
-            { detected = LogLevel::e_all; }
-            else if (strcmp(a, "message") == 0)
-            { detected = LogLevel::e_message; }
-            else if (strcmp(a, "warning") == 0)
-            { detected = LogLevel::e_warning; }
-            else if (strcmp(a, "error"  ) == 0)
-            { detected = LogLevel::e_error; }
-            else if (strcmp(a, "nothing") == 0)
-            { detected = LogLevel::e_nothing; }
-            else if (strcmp(a, "fatal_error") == 0)
-            { detected = LogLevel::e_fatal_error; }
-            if (detected != LogLevel::e_undefined) {
-                verbosity = detected;
-                if (debug) {
-                    LOG(LogLevel::e_nothing,
-                        "debug: log_level was set to " << a << std::endl);
-                }
-            }
-            else {
-                verbosity = LogLevel::e_error;
-                if (debug) {
-                    LOG(LogLevel::e_nothing,
-                        "debug: log_level was set to error\n");
-                }
-            }
-        }
-    } while (0);
-
-    if (verbosity == LogLevel::e_undefined) {
-        verbosity = LogLevel::e_error;
-        if (debug) {
-            LOG(LogLevel::e_nothing,
-                "debug: log_level was set to error\n");
-        }
-    }
-#else
-
-    rc_t rc = 0;
-
-    bool debug = false;
-    LogLevel::E detected = LogLevel::e_undefined;
-    char arg_catch_system_errors[] = "-catch_system_errors=";
-    char arg_log_level          [] = "-l=";
-    char arg_app_args           [] = "-app_args=";
-    for (int i = 1; i < argc; ++i)
-    {
-        if (strncmp(argv[i], arg_log_level, strlen(arg_log_level))
-            == 0)
-        {
-            char* a = argv[i] + strlen(arg_log_level);
-            if (strcmp(a, "test_suite") == 0)
-                detected = LogLevel::e_test_suite;
-            else if (strcmp(a, "all"    ) == 0)
-                detected = LogLevel::e_all;
-            else if (strcmp(a, "message") == 0)
-                detected = LogLevel::e_message;
-            else if (strcmp(a, "warning") == 0)
-                detected = LogLevel::e_warning;
-            else if (strcmp(a, "error"  ) == 0)
-                detected = LogLevel::e_error;
-            else if (strcmp(a, "nothing") == 0)
-                detected = LogLevel::e_nothing;
-            else if (strcmp(a, "fatal_error") == 0)
-                detected = LogLevel::e_fatal_error;
-            if (detected != LogLevel::e_undefined)
-            {
-                verbosity = detected;
-                if (debug)
-                {
-                    LOG(LogLevel::e_nothing,
-                        "debug: log_level was set to " << a << std::endl);
-                }
-            }
-            else
-            {
-                verbosity = LogLevel::e_error;
-                if (debug)
-                {
-                    LOG(LogLevel::e_nothing,
-                        "debug: log_level was set to error\n");
-                }
-            }
-        }
-        else if (strncmp(argv[i], arg_catch_system_errors,
-            strlen(arg_catch_system_errors)) == 0)
-        {
-            char* a = argv[i] + strlen(arg_catch_system_errors);
-            if (strcmp(a, "n") == 0 || strcmp(a, "no") == 0)
-            {
-                catch_system_errors = false;
-                if (debug)
-                {
-                    LOG(LogLevel::e_nothing,
-                       "debug: arg_catch_system_errors was set to false\n");
-                }
-            }
-            else
-            {
-                if (debug)
-                {
-                    LOG(LogLevel::e_nothing,
-                       "debug: arg_catch_system_errors was set to true\n");
-                }
-            }
-        }
-        else if (strcmp(argv[i], "-debug") == 0)
-        {
-            debug = true;
-            LOG(LogLevel::e_nothing, "debug: debug was set to true\n");
-        }
-        else if (strcmp(argv[i], "-h") == 0)
-        {
-            if (debug)
-            {
-                LOG(LogLevel::e_nothing, "debug: help was set to true\n");
-            }
-            std::cout << "Usage:\n"
-                      << argv[0]
-                      << " [-debug] [-catch_system_errors=[yes|y|no|n]]\n"
-                         "      [-app_args='<value>'] [-l=<value>] [-h]\n"
-                "where:\n"
-                "debug              - Print recognized command line arguments\n"
-                "                     (should be specified first)\n"
-                "catch_system_errors -  Allows to switch between catching\n"
-                "                     and ignoring system errors (signals)\n"
-                "app_args           - Allows to pass command line arguments\n"
-                "                     to application handler\n"
-                "    (see unit_test.hpp/FIXTURE_TEST_SUITE_WITH_ARGS_HANDLER)\n"
-                "\n"
-                "l (log_level)       - Specifies log level\n"
-                "\tall        - report all log messages\n"
-                "\t             including the passed test notification\n"
-                "\ttest_suite - show test suite messages\n"
-                "\tmessage    - show user messages\n"
-                "\twarning    - report warnings issued by user\n"
-                "\terror      - report all error conditions (default)\n"
-                "\tfatal_error- report user or system originated fatal errors\n"
-                "\t             (for example, memory access violation)\n"
-                "\tnothing    - do not report any information\n"
-                "\n"
-                "h (help)            - this help message\n";
-            exit(0);
-        }
-        else if (strncmp(argv[i], arg_app_args, strlen(arg_app_args)) == 0)
-        {
-            char* a = argv[i] + strlen(arg_app_args);
-            if (debug)
-            {
-                LOG(LogLevel::e_nothing,
-                    string("debug: arg_app_args was detected: ") + a + "\n");
-            }
-            char* pch = strtok(a ," ");
-            while (pch != NULL) {
-                if (argc2 >= arg2) {
-                    arg2 *= 2;
-                    char** tmp = static_cast<char**>(
-                        realloc(argv2, arg2 * sizeof *argv2));
-                    if (tmp == NULL) {
-                        return RC(
-                            rcApp, rcArgv, rcAccessing, rcMemory, rcExhausted);
-                    }
-                    argv2 = tmp;
-                }
-                argv2[argc2] = strdup(pch);
-                if (argv2[argc2] == NULL) {
-                    return RC(
-                        rcApp, rcArgv, rcAccessing, rcMemory, rcExhausted);
-                }
-                ++argc2;
-                pch = strtok(NULL, " ");
-            }
-        }
-    }
-
-    if (verbosity == LogLevel::e_undefined)
-    {
-        verbosity = LogLevel::e_error;
-        if (debug)
-        {
-            LOG(LogLevel::e_nothing,
-                "debug: log_level was set to error\n");
-        }
-    }
-#endif
-
-    if (rc == 0) {
-        if (argsHandler)
-        {	rc = argsHandler(argc2, argv2); }
-    }
-
-    return rc;
-}
-
-void ::ncbi::NK::saveLocation(const char* file, int line) 
-{
-    std::ostringstream s;
-    s << file << "(" << line << ")";
-    TestEnv::lastLocation = s.str();
-}
-
-void ::ncbi::NK::_REPORT_CRITICAL_ERROR_(const string& msg, const char* file, int line, bool is_msg)
-{
-    LOG(ncbi::NK::LogLevel::e_error, file << "(" << line << "): ");
-    LOG(ncbi::NK::LogLevel::e_error, "fatal ");
-    LOG(ncbi::NK::LogLevel::e_error, "error in fixture: ");
-    if (is_msg) {
-        LOG(ncbi::NK::LogLevel::e_error, msg);
-    }
-    else {
-        LOG(ncbi::NK::LogLevel::e_error, "critical ");
-        LOG(ncbi::NK::LogLevel::e_error, "check " << msg << " failed");
-    }
-    LOG(ncbi::NK::LogLevel::e_error, std::endl);
-    throw ncbi::NK::execution_aborted();
- }
-
-ncbi::NK::TestRunner* 
-ncbi::NK::GetTestSuite(void)
-{ 
-    static ncbi::NK::TestRunner t; 
-    return &t; 
-}
-
-rc_t CC TestEnv::UsageSummary(const char* progname) {
-#if ALLOW_TESTING_CODE_TO_RELY_UPON_CODE_BEING_TESTED
-    return KOutMsg(
-        "Usage:\n"
-        "  %s [--verbose_cmd_line] [--catch_system_errors [yes|y|no|n]] "
-        "[-t <value>] [-h] [...]\n", progname);
-#else
-    std::cout
-        << "Usage:\n"
-        << progname
-        << " [-debug] [-catch_system_errors=[yes|y|no|n]] "
-        "[-l=<value>] [-h] [...]\n";
-    return 0;
-#endif
-}
-
-#if ALLOW_TESTING_CODE_TO_RELY_UPON_CODE_BEING_TESTED
-rc_t CC TestEnv::Usage(const Args* args)
-{
-    const char* progname = UsageDefaultName;
-    const char* fullpath = UsageDefaultName;
-
-    rc_t rc = (args == NULL) ?
-        RC (rcApp, rcArgv, rcAccessing, rcSelf, rcNull):
-        ArgsProgram(args, &fullpath, &progname);
-
-    if (rc != 0)
-        progname = fullpath = UsageDefaultName;
-
-    UsageSummary(progname);
-
-    KOutMsg("\nOptions:\n");
-    
-    HelpOptionLine(ALIAS_DBG, OPTION_DBG, NULL, dbg_usage);
-    HelpOptionLine(ALIAS_CSE, OPTION_CSE, NULL, cse_usage);
-    HelpOptionLine(ALIAS_LOG, OPTION_LOG, NULL, log_usage);
-    KOutMsg("\n");
-    HelpOptionsStandard();
-    HelpVersion(fullpath, KAppVersion());
-    
-    return rc;
-}
-#else
-rc_t CC TestEnv::Usage(const char *progname)
-{
-    UsageSummary ( progname );
-    std::cout <<
-        "where:\n"
-        "debug - Print recognized command line arguments (should be specified first)\n"
-        "catch_system_errors - "
-        "Allows to switch between catching and ignoring system errors (signals)\n"
-        "l (log_level) - Specifies log level\n"
-        "\tall        - report all log messages\n"
-        "\t             including the passed test notification\n"
-        "\ttest_suite - show test suite messages\n"
-        "\tmessage    - show user messages\n"
-        "\twarning    - report warnings issued by user\n"
-        "\terror      - report all error conditions (default)\n"
-        "\tfatal_error- report user or system originated fatal errors\n"
-        "\t             (for example, memory access violation)\n"
-        "\tnothing    - do not report any information\n"
-        "h (help) - this help message\n";
-    return 0;
-}
-#endif
-
-bool TestEnv::Sleep(unsigned int seconds)
-{
-    return TestEnv::SleepMs(seconds*1000);
-}
-
diff --git a/libs/ktst/testrunner.cpp b/libs/ktst/testrunner.cpp
deleted file mode 100644
index cb31e16..0000000
--- a/libs/ktst/testrunner.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <ktst/unit_test.hpp>
-
-using namespace ncbi::NK;
-
-TestRunner::TestRunner() : argc(0), argv(NULL) {}
-
-void TestRunner::ReportTestNumber(void) 
-{
-    T::size_type sz = _cases.size();
-    if (sz == 1) {
-       LOG(LogLevel::e_fatal_error, "Running " << sz << " test case...\n");
-    } else if (sz > 1) {
-       LOG(LogLevel::e_fatal_error, "Running " << sz << " test cases...\n");
-    }
-}
-
-void TestRunner::SetArgs(int argc, char* argv[]) 
-{
-    this->argc = argc;
-    this->argv = argv;
-}
-
-void TestRunner::Add(ncbi::NK::TestInvoker* t) 
-{
-    if (t) 
-    {
-        _cases.push_back(t);
-    }
-}
-
-counter_t TestRunner::Run(void* globalFixture) const 
-{
-    counter_t ec = 0;
-    for (TCI it = _cases.begin(); it != _cases.end(); ++it) 
-    {
-       ncbi::NK::TestInvoker* c = *it;
-       try {
-           LOG(LogLevel::e_test_suite,
-               "Entering test case \"" << c->GetName() << "\"\n");
-           c->Run(globalFixture);
-           LOG(LogLevel::e_test_suite,
-               "Leaving test case \"" << c->GetName() << "\"\n");
-       } catch (const ncbi::NK::execution_aborted&) {
-           LOG(LogLevel::e_test_suite,
-               "Leaving test case \"" << c->GetName() << "\"\n");
-       }
-       ec += c->GetErrorCounter();
-    }
-    return ec;
-}
-
diff --git a/libs/ktst/unix/runprocesstestcase.cpp b/libs/ktst/unix/runprocesstestcase.cpp
deleted file mode 100644
index 192a750..0000000
--- a/libs/ktst/unix/runprocesstestcase.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <ktst/unit_test_suite.hpp>
-
-#include <sstream>
-
-#include <csignal> // sigaction, not necessarily in csignal :-/
-#include <cstdlib>
-#include <cstring>
-
-#include <time.h>
-#include <unistd.h> /* fork */
-
-#include <sys/wait.h>
-#include <sys/types.h>
-
-using namespace std;
-using namespace ncbi::NK;
-
-#undef REPORT_ERROR
-#define REPORT_ERROR(msg) _REPORT_CRITICAL_ERROR_("TestEnv::" msg, __FILE__, __LINE__, true);
-
-static void alarmHandler(int)
-{
-    cerr << "child process timed out" << endl;
-    
-    exit(TestEnv::TEST_CASE_TIMED_OUT);
-}
-
-int TestEnv::RunProcessTestCase(TestCase& obj, void(TestCase::*meth)(), int timeout)
-{
-    int pid=fork();
-    if (pid == -1)
-    {
-        REPORT_ERROR("RunProcessTestCase: fork() failed");
-    }
-    if (pid == 0)
-    {   /* child process */
-        if (timeout != 0)
-        {
-            struct sigaction act;
-            memset(&act, 0, sizeof act);
-            act.sa_handler = alarmHandler;
-            act.sa_flags = SA_RESETHAND;
-            sigaction(SIGALRM , &act, NULL);        
-            alarm(timeout);
-        }
-        try 
-        {
-            in_child_process = true;
-            (obj.*meth)();
-        }   
-        catch (const exception& ex)
-        {
-            cerr << obj.GetName() << " threw " << ex.what() << endl;
-            exit(TEST_CASE_FAILED);
-        }
-        catch (const ncbi::NK::execution_aborted&)
-        {
-            cerr << obj.GetName() << " aborted " << endl;
-            exit(TEST_CASE_FAILED);
-        }
-        catch (...)
-        {
-            cerr << obj.GetName() << " threw something " << endl;
-            exit(TEST_CASE_FAILED);  
-        }
-        exit(0);
-    }
-    /* parent process */
-    int status;
-    if (waitpid(pid, &status, 0) != pid) /* suspend until the child terminates */
-    {   
-        REPORT_ERROR("RunProcessTestCase: wait() failed");
-    }
-    if (!WIFEXITED(status)) 
-    {   
-        REPORT_ERROR("RunProcessTestCase: child exited abnormally");
-    }
-    
-    return WEXITSTATUS(status); /* exit status of the child process */
-}
-
-bool TestEnv::SleepMs(unsigned int milliseconds)
-{
-    struct timespec time = { milliseconds / 1000, (milliseconds % 1000) * 1000 * 1000 };
-    return nanosleep(&time, NULL) == 0; 
-}
-
-void TestEnv::set_handlers(void)
-{
-    struct sigaction act;
-    memset(&act, 0, sizeof act);
-    act.sa_handler = SigHandler;
-    act.sa_flags = SA_RESETHAND;
-    if (sigaction(SIGFPE , &act, NULL) != 0)    REPORT_ERROR("set_handlers: sigaction() failed");
-    if (sigaction(SIGILL , &act, NULL) != 0)    REPORT_ERROR("set_handlers: sigaction() failed");
-    if (sigaction(SIGSEGV , &act, NULL) != 0)   REPORT_ERROR("set_handlers: sigaction() failed");
-}
-
-string TestEnv::GetPidString()
-{
-    ostringstream str;
-    str << getpid();
-    return str.str();
-}
-
diff --git a/libs/ktst/win/runprocesstestcase.cpp b/libs/ktst/win/runprocesstestcase.cpp
deleted file mode 100644
index 0ff1651..0000000
--- a/libs/ktst/win/runprocesstestcase.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <ktst/unit_test_suite.hpp>
-
-#include <csignal> 
-#include <sstream> 
-#include <windows.h>
-#include <process.h>
-
-using namespace std;
-using namespace ncbi::NK;
-
-#undef REPORT_ERROR
-#define REPORT_ERROR(msg) _REPORT_CRITICAL_ERROR_(string("TestEnv::") + msg, __FILE__, __LINE__, true)
-
-/* signal handlers for a single-test case thread */
-void CC SigSubHandler(int sig)
-{
-    _endthreadex(sig);
-}
-void CC TermSubHandler() 
-{
-    SigSubHandler(SIGTERM);
-}
-
-struct TestCaseCall
-{
-    TestCaseCall(TestCase& obj, void(TestCase::*meth)())
-        : object(&obj), method(meth)
-    {
-    }
-
-    TestCase* object;
-    void(TestCase::*method)();
-};
-
-void ThreadProc(void* call)
-{
-    signal(SIGABRT, SigSubHandler);
-    signal(SIGFPE, SigSubHandler);
-    signal(SIGILL, SigSubHandler);
-    signal(SIGINT, SigSubHandler);
-    signal(SIGSEGV, SigSubHandler);
-    signal(SIGTERM, SigSubHandler);
-    set_terminate(TermSubHandler);
-
-    try
-    {
-        TestCaseCall* c=(TestCaseCall*)call;
-        ((c->object)->*(c->method))();
-    }
-    catch (...)
-    {
-        _endthreadex(TestEnv::TEST_CASE_FAILED);
-    }
-    _endthreadex(0);
-}
-
-int TestEnv::RunProcessTestCase(TestCase& obj, void(TestCase::*meth)(), int timeout)
-{
-    TestCaseCall call(obj, meth);
-    TestEnv::in_child_process = true;
-    HANDLE thread = (HANDLE)_beginthread( ThreadProc, 0, &call );
-    if (thread == NULL)
-    {
-        REPORT_ERROR("TestEnv::RunProcessTestCase: failed to start a test case thread");
-    }
-
-    // make sure to restore main process's signal handlers before re-throwing an exception
-    DWORD rc=0;
-    DWORD result=WaitForSingleObject( (HANDLE)thread, timeout == 0 ? INFINITE : timeout*1000);
-    try
-    {
-        switch (result)
-        {
-        case WAIT_OBJECT_0:
-            if (GetExitCodeThread(thread, &rc) == 0)
-                REPORT_ERROR("RunProcessTestCase failed");
-            break;
-        case WAIT_TIMEOUT:
-            if (!CloseHandle(thread))
-                REPORT_ERROR("CloseHandle failed");
-            cerr << "child process timed out" << endl;            
-            rc=TEST_CASE_TIMED_OUT;
-            break;
-        default:
-            REPORT_ERROR("WaitForSingleObject failed");
-            break;
-        }
-    }
-    catch (const exception& ex)
-    {
-        REPORT_ERROR(obj.GetName() + " threw " + ex.what());
-        rc=TEST_CASE_FAILED;
-    }
-    catch (const ncbi::NK::execution_aborted&)
-    {
-        REPORT_ERROR(obj.GetName() + " aborted ");
-        rc=TEST_CASE_FAILED;
-    }
-    catch (...)
-    {
-        REPORT_ERROR(obj.GetName() + " threw something ");
-        rc=TEST_CASE_FAILED;
-        set_handlers(); 
-        throw;
-    }
-#undef CALL_FAILED
-    set_handlers(); 
-    in_child_process = false;
-    return (int)rc;
-}
-
-bool TestEnv::SleepMs(unsigned int milliseconds)
-{
-    ::Sleep((DWORD)milliseconds);
-    return true;
-}
-
-void TestEnv::set_handlers(void) 
-{
-    signal(SIGABRT, SigHandler);
-    signal(SIGFPE, SigHandler);
-    signal(SIGILL, SigHandler);
-    signal(SIGINT, SigHandler);
-    signal(SIGSEGV, SigHandler);
-    signal(SIGTERM, SigHandler);
-    set_terminate(TermHandler);
-}
-
-string TestEnv::GetPidString()
-{
-    ostringstream str;
-    str << GetCurrentProcessId();
-    return str.str();
-}
-
diff --git a/libs/kxml/Makefile b/libs/kxml/Makefile
deleted file mode 100644
index 15de2ca..0000000
--- a/libs/kxml/Makefile
+++ /dev/null
@@ -1,124 +0,0 @@
-# ===========================================================================
-#
-#                            PUBLIC DOMAIN NOTICE
-#               National Center for Biotechnology Information
-#
-#  This software/database is a "United States Government Work" under the
-#  terms of the United States Copyright Act.  It was written as part of
-#  the author's official duties as a United States Government employee and
-#  thus cannot be copyrighted.  This software/database is freely available
-#  to the public for use. The National Library of Medicine and the U.S.
-#  Government have not placed any restriction on its use or reproduction.
-#
-#  Although all reasonable efforts have been taken to ensure the accuracy
-#  and reliability of the software and data, the NLM and the U.S.
-#  Government do not and cannot warrant the performance or results that
-#  may be obtained by using this software or data. The NLM and the U.S.
-#  Government disclaim all warranties, express or implied, including
-#  warranties of performance, merchantability or fitness for any particular
-#  purpose.
-#
-#  Please cite the author in any work or product based on this material.
-#
-# ===========================================================================
-
-
-default: std
-
-TOP ?= $(shell ../../build/abspath.sh ../..)
-MODULE = libs/kxml
-
-INT_LIBS = \
-	libkxml \
-	libkxfs
-
-ALL_LIBS = \
-	$(INT_LIBS)
-
-include $(TOP)/build/Makefile.env
-
-#-------------------------------------------------------------------------------
-# where to find includes
-#
-DFLT_LIBXML_INCLUDES ?= /usr/include/libxml2
-
-LIBXML_INCLUDES ?= $(DFLT_LIBXML_INCLUDES)
-
-INCDIRS += $(addprefix -I,$(LIBXML_INCLUDES))
-
-#-------------------------------------------------------------------------------
-# outer targets
-#
-ifeq (win,$(OS))
-all std:
-	@ true
-else
-all std: makedirs
-	@ $(MAKE_CMD) LIBXML_INCLUDES=$(LIBXML_INCLUDES) $(TARGDIR)/std
-endif
-
-$(INT_LIBS): makedirs
-	@ $(MAKE_CMD) LIBXML_INCLUDES=$(LIBXML_INCLUDES) $(ILIBDIR)/$@
-
-.PHONY: all std $(ALL_LIBS)
-
-#-------------------------------------------------------------------------------
-# std
-#
-$(TARGDIR)/std: \
-	$(addprefix $(ILIBDIR)/,$(INT_LIBS))
-
-.PHONY: $(TARGDIR)/std
-
-#-------------------------------------------------------------------------------
-# clean
-#
-clean: stdclean
-
-.PHONY: clean
-
-#-------------------------------------------------------------------------------
-# tiny, lightweight interface to libxml
-#
-$(ILIBDIR)/libkxml: $(addprefix $(ILIBDIR)/libkxml.,$(ILIBEXT))
-
-XML_SRC = \
-	xml
-
-XML_OBJ = \
-	$(addsuffix .$(LOBX),$(XML_SRC))
-
-XML_LIB = \
-	-dkfs \
-	-dklib 
-
-ifdef LIBXML_LPATH
-XML_LIB += \
-	-X$(LIBXML_LPATH) -lxml2
-endif
-
-$(ILIBDIR)/libkxml.$(LIBX): $(XML_OBJ)
-	$(LD) --slib -o $@ $^ $(XML_LIB)
-
-#-------------------------------------------------------------------------------
-# kxfs
-#
-$(ILIBDIR)/libkxfs: $(addprefix $(ILIBDIR)/libkxfs.,$(ILIBEXT))
-
-KXFS_SRC = \
-	xtoc \
-	xtoc-parsexml
-
-KXFS_OBJ = \
-	$(addsuffix .$(LOBX),$(KXFS_SRC))
-
-KXFS_LIB = \
-	-dkxml \
-	-dklib \
-	-ddl \
-	-dz \
-	-dbz2 \
-
-$(ILIBDIR)/libkxfs.$(LIBX): $(KXFS_OBJ)
-	$(LD) --slib -o $@ $^ $(KXFS_LIB)
-
diff --git a/libs/kxml/xml.c b/libs/kxml/xml.c
deleted file mode 100644
index ce44542..0000000
--- a/libs/kxml/xml.c
+++ /dev/null
@@ -1,1705 +0,0 @@
-/*==============================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-struct s_KNodeNamelist;
-#define KNAMELIST_IMPL struct s_KNodeNamelist
-
-#include <sysalloc.h>
-#include <kxml/xml.h>
-
-#include <klib/impl.h>
-#include <kfs/file.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <klib/debug.h>
-#include <klib/text.h>
-
-#include <os-native.h> /* for strndup on mac */
-#include <strtol.h>
-
-#include <libxml/xmlreader.h>
-#include <libxml/xpath.h>
-
-#include <assert.h>
-#include <string.h>
-
-
-#define XML_DEBUG(msg) DBGMSG (DBG_XML, DBG_FLAG(DBG_XML_XML), msg)
-
-/********* XML manager ********/
-
-struct KXMLMgr {
-    atomic32_t refcount;
-};
-
-static KXMLMgr s_KXMLMgr;
-/** calls vsnprintf and converts errors into KXMLErr */
-static rc_t s_KXML_vsnprintf(char *str,
-    size_t size,
-    const char *format,
-    va_list ap)
-{
-    int printed = vsnprintf(str, size, format, ap);
-    if (printed < 0) {
-        return RC ( rcXML, rcDoc, rcConstructing, rcData, rcCorrupt );
-    }
-    if ((size_t) printed >= size) { /* buffer is too small */
-        return RC ( rcXML, rcDoc, rcConstructing, rcBuffer, rcExhausted );
-    }
-    return 0;
-}
-
-rc_t KXMLMgrMakeRead(const KXMLMgr **result)
-{
-    if (!result) {
-        return RC ( rcXML, rcMgr, rcConstructing, rcParam, rcNull );
-    }
-    if (atomic32_read_and_add(&s_KXMLMgr.refcount, 1) == 0) {
-        xmlInitParser();
-    }
-    *result = &s_KXMLMgr;
-    return 0;
-}
-
-rc_t KXMLMgrAddRef(const KXMLMgr *cself)
-{
-    if (cself) {
-        KXMLMgr *self = (KXMLMgr*) cself;
-        atomic32_inc(&self->refcount);
-    }
-    return 0;
-}
-
-rc_t KXMLMgrRelease(const KXMLMgr *cself)
-{
-    if (cself) {
-        KXMLMgr *self = (KXMLMgr*) cself;
-        if (atomic32_dec_and_test(&self->refcount)) {
-            xmlCleanupParser();
-        }
-    }
-    return 0;
-}
-
-/********* XML doucument ********/
-struct KXMLDoc {
-    const KXMLMgr* parent;
-    xmlDocPtr doc;
-    xmlXPathContextPtr xpathCtx;
-    atomic32_t refcount;
-};
-
-/*static int s_XmlInputReadCallback(void * context, 
-					 char * buffer, 
-					 int len)
-{
-    static size_t offset = 0;
-    KFile *src = (KFile*) context;
-    assert(src);
-    {
-        size_t num_read = 0;
-        rc_t rc = KFileRead(src, offset, buffer, len, &num_read);
-        if (rc)
-        {   return -1; }
-        offset += num_read;
-        return num_read;
-    }
-}*/
-
-/* SchemaValidate
- *  validates an XML source file against an XSD schema.
- * schema parameter is the path to the schema
- */
-#if 0
-rc_t KXMLMgrSchemaValidate ( const KXMLMgr *self,
-    struct KFile const *src,
-    const char *schema )
-{
-    if (!src || !schema)
-    {   return RC(rcXML, rcDoc, rcValidating, rcParam, rcNull); }
-
-    {
-        rc_t rc = 0;
-        xmlTextReaderPtr reader
-            = xmlReaderForIO(s_XmlInputReadCallback, 0, (void*)src, "/", 0, 0);
-        if (!reader)
-        {   return RC(rcXML, rcDoc, rcValidating, rcSchema, rcUnknown); }
-        {
-            int r = xmlTextReaderSchemaValidate(reader, schema);
-            if (r != 0) {
-                rc = RC(rcXML, rcDoc, rcValidating, rcSchema, rcUnknown);
-            } else {
-                do {
-                    r = xmlTextReaderRead(reader);
-                } while (r == 1);
-                if (r == -1) {
-                    rc = RC(rcXML, rcDoc, rcValidating, rcDoc, rcInvalid);
-                } else {
-                    assert(r == 0);
-                    r = xmlTextReaderIsValid(reader);
-                    if (r != 1)
-                    {   rc = RC(rcXML, rcDoc, rcValidating, rcDoc, rcInvalid); }
-                }
-            }
-        }
-        xmlTextReaderClose(reader);
-        return rc;
-    }
-}
-#endif
-
-static void s_xmlGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED,
-    const char *msg,
-    ...)
-{
-    va_list args;
-    va_start(args, msg);
-/*  vfprintf(stderr, msg, args); */
-    va_end(args);
-}
-
-static rc_t s_XmlReadFile(const KFile *src, char** aBuffer, uint64_t* aSize)
-{
-    rc_t rc = 0;
-    bool unknownFileSize = false;
-    uint64_t size = 0;
-    uint32_t t = KFileType(src);
-    assert(aBuffer && aSize);
-    *aBuffer = NULL;
-    *aSize = 0;
-
-    /* Read KFile by KFileRead: can use mmap instead */
-    if (t == kfdFIFO) {
-        XML_DEBUG (("%s: reading stdin ?", __func__));
-        unknownFileSize = true;
-        size = 0x10000;
-    }
-    else {
-        rc = KFileSize(src, &size);
-        if (rc)
-        {   return rc; }
-        if (!size) {
-            rc = RC(rcXML, rcDoc, rcConstructing, rcFile, rcEmpty);
-            return rc;
-        }
-    }
-    {
-        size_t num_read = 0;
-        char* buffer = (char*) malloc(size);
-        if (!buffer)
-        {   return RC(rcXML, rcDoc, rcConstructing, rcMemory, rcExhausted); }
-        rc = KFileRead(src, 0, buffer, size, &num_read);
-        if (rc == 0) {
-            if (!unknownFileSize) {
-                if (num_read != size) {
-                    rc = RC(rcXML, rcDoc, rcConstructing, rcFile, rcIncomplete);
-                }
-            }
-            else {
-                if (num_read == size) {
-                    rc = RC(rcXML, rcDoc, rcConstructing, rcFile, rcTooBig);
-                }
-            }
-        }
-        if (rc) {
-            free(buffer);
-            return rc;
-        }
-        *aBuffer = buffer;
-        *aSize = size;
-    }
-
-    return rc;
-}
-
-static int s_UseDefaultErrorHandler = 0;
-
-rc_t KXMLMgrMakeDocRead(const KXMLMgr *self,
-    const KXMLDoc **result,
-    const KFile *src)
-{
-    rc_t rc = 0;
-    if (self && src) {
-        char* buffer = NULL;
-        uint64_t size = 0;
-        rc = s_XmlReadFile(src, &buffer, &size);
-        if (rc)
-        {    return rc; }
-        rc = KXMLMgrMakeDocReadFromMemory(self, result, buffer, size);
-        free(buffer);
-    }
-    else
-    {    rc = RC ( rcXML, rcDoc, rcConstructing, rcParam, rcNull ); }
-    return rc;
-}
-
-rc_t KXMLMgrMakeDocReadFromMemory(const KXMLMgr *self,
-    const KXMLDoc **result,
-    const char* buffer,
-    uint64_t size)
-{
-    rc_t rc = 0;
-    if (!s_UseDefaultErrorHandler)
-    {   xmlSetGenericErrorFunc(0, s_xmlGenericErrorDefaultFunc); }
-    if (!result)
-    {   return RC ( rcXML, rcDoc, rcConstructing, rcParam, rcNull ); }
-    *result = 0;
-    if (self && buffer && size) {
-        KXMLDoc *obj = (KXMLDoc*) malloc(sizeof(KXMLDoc));
-        if (!obj)
-        {   return RC ( rcXML, rcDoc, rcConstructing, rcMemory, rcExhausted ); }
-        atomic32_set(&obj->refcount, 1);
-        obj->parent = self;
-        KXMLMgrAddRef(obj->parent);
-        obj->doc = 0;
-        obj->xpathCtx = 0;
-
-        /* Load XML document */
-        obj->doc = xmlParseMemory(buffer, size);
-
-        if (!obj->doc) {
-            KXMLDocRelease(obj);
-            return RC ( rcXML, rcDoc, rcConstructing, rcXmlDoc, rcInvalid );
-        }
-
-        /* Create xpath evaluation context */
-        obj->xpathCtx = xmlXPathNewContext(obj->doc);
-        if (!obj->xpathCtx) {
-            KXMLDocRelease(obj);
-            return RC ( rcXML, rcDoc, rcConstructing, rcMemory, rcCorrupt );
-        }
-        *result = obj;
-        rc = 0;
-    }
-    else {
-        rc = RC ( rcXML, rcDoc, rcConstructing, rcParam, rcNull );
-    }
-    return rc;
-}
-
-rc_t KXMLDocAddRef(const KXMLDoc *cself)
-{
-    if (cself) {
-        KXMLDoc *self = (KXMLDoc*) cself;
-        atomic32_inc(&self->refcount);
-    }
-    return 0;
-}
-
-rc_t KXMLDocRelease(const KXMLDoc *cself)
-{
-    if (cself) {
-        KXMLDoc *self = (KXMLDoc*) cself;
-        if (atomic32_dec_and_test(&self->refcount)) {
-            if (self->xpathCtx) {
-                xmlXPathFreeContext(self->xpathCtx);
-                self->xpathCtx = 0;
-            }
-            if (self->doc) {
-                xmlFreeDoc(self->doc);
-                self->doc = 0;
-            }
-            KXMLMgrRelease(self->parent);
-            self->parent = 0;
-            free(self);
-        }
-    }
-    return 0;
-}
-
-/********* XML node set ********/
-
-struct KXMLNodeset {
-    atomic32_t refcount;
-    const KXMLDoc *parent;
-    char *path;
-    xmlXPathObjectPtr xpathObj;
-};
-
-/** KXMLNodeset constructor */
-static rc_t KXMLNodeset_cTor(const KXMLDoc *parent,
-    const KXMLNodeset **result,
-    const char *path)
-{
-    assert(parent && result && path && path[0]);
-    if (!parent->xpathCtx) {
-        return RC ( rcXML, rcDoc, rcConstructing, rcData, rcIncorrect );
-    }
-    {
-        size_t size;
-        KXMLNodeset *obj = (KXMLNodeset*) malloc(sizeof(KXMLNodeset));
-        if (!obj) {
-            return RC ( rcXML, rcDoc, rcConstructing, rcMemory, rcExhausted );
-        }
-        atomic32_set(&obj->refcount, 1);
-        obj->parent = parent;
-        obj->path = 0;
-        KXMLDocAddRef(obj->parent);
-        obj->xpathObj = xmlXPathEvalExpression(BAD_CAST path, parent->xpathCtx);
-        if (!obj->xpathObj) {
-            KXMLNodesetRelease(obj);
-            return RC ( rcXML, rcDoc, rcConstructing, rcData, rcCorrupt );
-        }
-        if( obj->xpathObj->type != XPATH_NODESET ) {
-            KXMLNodesetRelease(obj);
-            return RC(rcXML, rcDoc, rcConstructing, rcData, rcUnsupported );
-        }
-        obj->path = string_dup(path, string_measure(path, &size));
-        if (!obj->path) {
-            KXMLNodesetRelease(obj);
-            return RC ( rcXML, rcDoc, rcConstructing, rcMemory, rcExhausted );
-        }
-        *result = obj;
-    }
-    return 0;
-}
-
-static rc_t s_KXML_snprintf(char *str,
-    size_t size,
-    const char *format,
-    ...)
-{
-    va_list args;
-    va_start(args, format);
-    {
-        rc_t rc = s_KXML_vsnprintf(str, size, format, args);
-        va_end(args);
-        return rc;
-    }
-}
-
-#define XPATH_MAX_LEN 1001
-/** Opens a node set relative to current node */
-rc_t KXMLDocOpenNodesetRead(const KXMLDoc *self,
-    const KXMLNodeset **result,
-    const char *path,
-    ...)
-{
-    rc_t rc = 0;
-    va_list args;
-    va_start ( args, path );
-    rc = KXMLDocVOpenNodesetRead ( self, result, path, args );
-    va_end ( args );
-    return rc;
-}
-
-rc_t KXMLDocVOpenNodesetRead(const KXMLDoc *self,
-    const KXMLNodeset **result,
-    const char *path,
-    va_list args)
-{
-    rc_t rc = 0;
-
-    if (!result || !path || !path[0]) {
-        return RC ( rcXML, rcDoc, rcConstructing, rcParam, rcNull );
-    }
-
-    *result = 0;
-
-    if (self) {
-        char buffer[XPATH_MAX_LEN];
-        rc = s_KXML_vsnprintf(buffer, sizeof(buffer), path, args);
-        if (rc != 0) {
-            return rc;
-        }
-        rc = KXMLNodeset_cTor(self, result, buffer);
-    }
-    else { rc = RC ( rcXML, rcDoc, rcConstructing, rcSelf, rcNull ); }
-
-    return rc;
-}
-
-rc_t KXMLNodesetAddRef(const KXMLNodeset *cself)
-{
-    if (cself) {
-        KXMLNodeset *self = (KXMLNodeset*) cself;
-        atomic32_inc(&self->refcount);
-    }
-    return 0;
-}
-
-rc_t KXMLNodesetRelease(const KXMLNodeset *cself)
-{
-    if (cself) {
-        KXMLNodeset *self = (KXMLNodeset*) cself;
-        if (atomic32_dec_and_test(&self->refcount)) {
-            if (self->xpathObj) {
-                xmlXPathFreeObject(self->xpathObj);
-                self->xpathObj = 0;
-            }
-            KXMLDocRelease(self->parent);
-            self->parent = 0;
-            if (self->path) {
-                free(self->path);
-                self->path = 0;
-            }
-            free(self);
-        }
-    }
-    return 0;
-}
-
-rc_t KXMLNodesetCount(const KXMLNodeset *self,
-    uint32_t *result)
-{
-    if (!result)
-    { return RC ( rcXML, rcDoc, rcListing, rcParam, rcNull ); }
-
-    *result = 0;
-
-    if (self && self->xpathObj) {
-        const xmlNodeSetPtr nodes = self->xpathObj->nodesetval;
-        if (nodes)
-        { *result = nodes->nodeNr; }
-        return 0;
-    }
-    else {
-        return RC ( rcXML, rcDoc, rcAccessing, rcSelf, rcNull );
-    }
-}
-
-/********* XML node ********/
-
-struct KXMLNode {
-    const KXMLNodeset *parent;
-    /* use parent's refcount; */
-
-    /* parent and index are used to find a node within a nodeset
-    (when children == 0) */
-    int32_t idx;
-
-    /* when children != 0 then children is an XML node,
-    path is node's path relative to parent's path */
-    const struct _xmlNode *children;
-    char *path;
-};
-
-static rc_t s_KXMLNode_cTor(const KXMLNodeset *self,
-    const KXMLNode **result,
-    uint32_t idx,
-    const struct _xmlNode *children,
-    char *path)
-{
-    KXMLNode *obj = (KXMLNode*) malloc(sizeof(KXMLNode));
-    if (!obj) {
-        return RC ( rcXML, rcDoc, rcAccessing, rcMemory, rcExhausted );
-    }
-    obj->parent = self;
-    obj->path = 0;
-    obj->children = children;
-    if (children) {
-        size_t size = 0;
-        size_t path_size;
-        if (path)
-        {   size += string_measure(path, &path_size) + 1; }
-        if (children->name)
-        {   
-            size_t sz;
-            size += string_measure((char*)children->name, &sz); 
-        }
-        obj->path = (char*)malloc(size + 1);
-        if (!obj->path) {
-            free(obj);
-            return RC ( rcXML, rcDoc, rcAccessing, rcMemory, rcExhausted );
-        }
-        *obj->path = 0;
-        if (path && path[0]) {
-            string_copy(obj->path, size + 1, path, path_size);
-            strcat(obj->path, "/");
-        }
-        strcat(obj->path, (char*)children->name);
-    }
-    KXMLNodesetAddRef(obj->parent);
-    obj->idx = idx;
-    *result = obj;
-    return 0;
-}
-
-/* GetName
- */
-rc_t KXMLNodeGetName ( const KXMLNode *self, const char **name ) {
-    if (!self)
-    {   return RC ( rcXML, rcNode, rcAccessing, rcSelf, rcNull ); }
-    if (!name)
-    {   return RC ( rcXML, rcNode, rcAccessing, rcParam, rcNull ); }
-    *name = 0;
-    if (!self->children) {
-        assert(self->parent);
-        *name = self->parent->path;
-        /*TODO
-        here name if not the last node name but absolute name from xml root*/
-    } else {
-        *name = (const char*)self->children->name;
-    }
-    return 0;
-}
-
-rc_t KXMLNodeElementName ( const KXMLNode *self, const char **name )
-{
-    if( self == NULL ) {
-        return RC ( rcXML, rcNode, rcAccessing, rcSelf, rcNull );
-    }
-    if( name == NULL ) {
-        return RC ( rcXML, rcNode, rcAccessing, rcParam, rcNull );
-    }
-    *name = NULL;
-    if( self->children == NULL ) {
-        *name = (const char*)self->parent->xpathObj->nodesetval->nodeTab[self->idx]->name;
-    } else {
-        *name = (const char*)self->children->name;
-    }
-    return 0;
-}
-
-rc_t KXMLNodesetGetNodeRead(const KXMLNodeset *self,
-    const KXMLNode **result,
-    uint32_t idx)
-{
-    rc_t rc = 0;
-    uint32_t count = 0;
-
-    if (!result)
-    { return RC ( rcXML, rcNode, rcAccessing, rcParam, rcNull ); }
-
-    *result = 0;
-
-    if (self) {
-        rc = KXMLNodesetCount(self, &count);
-        if (rc == 0) {
-            assert(count >= 0);
-            if (count == 0) {
-            /* TODO: this test should be made when KXMLNodeset is created */
-                rc = RC(rcXML, rcNode, rcAccessing, rcNode, rcNotFound);
-            }
-            else if (idx < count) {
-                rc = s_KXMLNode_cTor(self, result, idx, NULL, NULL);
-            }
-            else {
-                rc = RC (rcXML, rcNode, rcAccessing, rcParam, rcIncorrect);
-            }
-        }
-    }
-    else {
-        rc = RC ( rcXML, rcDoc, rcAccessing, rcSelf, rcCorrupt );
-    }
-    return rc;
-}
-
-/** Opens a node set relative to current node */
-rc_t KXMLNodeVOpenNodesetRead ( const KXMLNode *self,
-    struct KXMLNodeset const **result, const char *path, va_list args )
-{
-    rc_t rc = 0;
-
-    if (!result || !path || !path[0])
-    { return RC ( rcXML, rcNode, rcAccessing, rcParam, rcNull ); }
-
-    *result = 0;
-
-    if (self == NULL)
-    {  return RC ( rcXML, rcNode, rcAccessing, rcSelf, rcNull );}
-
-    if (self && self->parent && self->parent->path) {
-        char *newPath = 0;
-        char buffer[XPATH_MAX_LEN];
-        char outpath[XPATH_MAX_LEN];
-        rc = s_KXML_vsnprintf(outpath, sizeof(outpath), path, args);
-        if (rc != 0)
-        { return rc; }
-
-        if (path[0] == '/')
-        { newPath = outpath; }
-        else {
-            size_t size;
-            if ((string_measure(self->parent->path, &size) + 1 + string_measure(outpath, &size) + 1 + 3)
-                > XPATH_MAX_LEN)
-            {
-                /* buffer is too small */
-                return RC
-                    ( rcXML, rcNode, rcAccessing, rcBuffer, rcExhausted );
-            }
-            if( self->parent->path[0] == '/' && self->parent->path[1] == '\0' ) {
-                /* correctly construct child path if parent path is "/" */
-                rc = s_KXML_snprintf(buffer, sizeof(buffer), "/%s", outpath);
-            } else {
-                rc = s_KXML_snprintf(buffer, sizeof(buffer), "(%s)[%d]/%s", self->parent->path, self->idx + 1, outpath);
-            }
-            newPath = buffer;
-        }
-        assert(self->parent && self->parent->parent);
-        rc = KXMLNodeset_cTor(self->parent->parent, result, newPath);
-    }
-    else { rc = RC ( rcXML, rcNode, rcAccessing, rcSelf, rcCorrupt ); }
-
-    return rc;
-}
-
-/** Opens a node set relative to current node */
-rc_t KXMLNodeOpenNodesetRead(const KXMLNode *self,
-    const KXMLNodeset **result,
-    const char *path,
-    ...)
-{
-    rc_t rc = 0;
-    va_list args;
-    va_start ( args, path );
-    rc = KXMLNodeVOpenNodesetRead ( self, result, path, args );
-    va_end ( args );
-    return rc;
-}
-
-rc_t KXMLNodeRelease(const KXMLNode *cself) {
-    if (cself) {
-        KXMLNode *self = (KXMLNode*) cself;
-        KXMLNodesetRelease(self->parent);
-        free(self->path);
-        free(self);
-    }
-    return 0;
-}
-
-/** Reads node's value.
-remaining can be NULL */
-/* Implementation:
-Iterates over all XML_TEXT_NODE children starting from firstChild.
-Uses state machine.
-
-Initial state is eNotFound.
-First it skips all nodes until their cumulative size is < offset;
-Then it copies the [part of] the first node considering offset:
-if the buffer is filled then state changes to eFilled,
-otherwise to eStarted.
-
-If the state is eStarted: node is added to buffer.
-State remains eStarted or changes to eFilled.
-
-If the state is eFilled then remaining value is added up. */
-int s_KXMLNode_readTextNode(const xmlNodePtr firstChild,
-    void *buffer,
-    size_t bsize,
-    size_t *num_read,
-    size_t *remaining,
-    size_t offset)
-{
-    enum EState {
-        eNotFound,
-        eStarted,
-        eFilled
-    } state = eNotFound;
-
-    size_t head = 0;
-    size_t copied = 0;
-    size_t remains = 0;
-    xmlNodePtr node = firstChild;
-
-    if (!firstChild)
-    {   return RC ( rcXML, rcNode, rcReading, rcParam, rcNull ); }
-
-    assert(num_read);
-
-    while (node) {
-        if (node->type == XML_TEXT_NODE) {
-            char* content = (char*) node->content;
-            size_t size;
-            size_t chunkSz = string_measure(content, &size);
-            switch (state) {
-                case eNotFound: {
-                    if (offset < head + chunkSz) {
-                        size_t chunkOffset = offset - head;
-                        size_t readySz = chunkOffset + chunkSz;
-                        size_t size = readySz;
-                        if (readySz >= (bsize - copied)) {
-                            size = bsize - copied;
-                            state = eFilled;
-                        }
-                        else {
-                            state = eStarted;
-                        }
-                        if (size) {
-                            assert(buffer);
-                            string_copy((char*) buffer + copied, bsize - copied, 
-                                content + chunkOffset, size);
-                        }
-                        copied += size;
-                        if (state == eFilled) {
-                            remains = readySz - size;
-                        }
-                    }
-                    break;
-                }
-                case eStarted: {
-                    size_t chunkOffset = 0;
-                    size_t readySz = chunkSz;
-                    size_t size = readySz;
-                    if (readySz >= (bsize - copied)) {
-                        size = bsize - copied;
-                        state = eFilled;
-                    }
-                    if (size) {
-                        assert(buffer);
-                        string_copy((char*) buffer + copied, bsize - copied,
-                            content + chunkOffset, size);
-                    }
-                    copied += size;
-                    if (state == eFilled) {
-                        remains = readySz - size;
-                    }
-                    break;
-                }
-                case eFilled:
-                    remains += chunkSz;
-                    break;
-                default:
-                    assert(0);
-                    break;
-            }
-        }
-        node = node->next;
-    }
-
-    *num_read = copied;
-
-    if (remaining)
-    { *remaining = remains; }
-
-    return 0;
-}
-
-/** Reads XML Node value
-    remaining can be NULL.
-Can have bsize parameter equal to 0:
-can be used to find out the node value length.
-*/
-rc_t KXMLNodeRead(const KXMLNode *self,
-    size_t offset,
-    void *buffer,
-    size_t bsize,
-    size_t *num_read,
-    size_t *remaining)
-{
-    rc_t rc = 0;
-
-    if (!num_read)
-    { return RC ( rcXML, rcNode, rcReading, rcParam, rcNull ); }
-    if (bsize && !buffer)
-    { return RC ( rcXML, rcNode, rcReading, rcParam, rcNull ); }
-
-    *num_read = 0;
-
-    if (remaining)
-    { *remaining = 0; }
-
-    if (self) {
-        const struct _xmlNode *children = NULL;
-        if (self->children) {
-            /*the case when (KXMLNode::children != NULL) is implemented here*/
-            if (self->children->children)
-            { children = self->children->children; }
-        }
-        else if (self->parent && self->parent->xpathObj) {
-            xmlNodePtr node = NULL;
-            int32_t idx = self->idx;
-            const xmlXPathObjectPtr xpathObj = self->parent->xpathObj;
-            assert(xpathObj->nodesetval && idx < xpathObj->nodesetval->nodeNr);
-            node = xpathObj->nodesetval->nodeTab[idx];
-            if (node && node->type == XML_ELEMENT_NODE) {
-                children = node->children;
-            }
-            rc = 0;
-        }
-        if (children != NULL) {
-            return s_KXMLNode_readTextNode( ( xmlNodePtr )
-                children, buffer, bsize, num_read, remaining, offset);
-        }
-    }
-    else { rc = RC ( rcXML, rcNode, rcReading, rcNode, rcCorrupt ); }
-
-    return rc;
-}
-
-
-#define MAX_I16      0x8000 /* 32768 */
-#define MAX_U16     0x10000
-#define MAX_I32  0x80000000
-#define MAX_U32 0x100000000
-
-static
-rc_t s_KXMLNodeReadNodeOrAttrCString(const KXMLNode *self,
-    char *buffer, size_t bsize, size_t *size, const char *attr)
-{
-    if (attr)
-    { return KXMLNodeReadAttrCString(self, attr, buffer, bsize, size); }
-    else { return KXMLNodeReadCString(self, buffer, bsize, size); }
-}
-
-static
-rc_t s_KXMLNodeReadNodeOrAttrAs_long(const KXMLNode *self, long *l,
-    const char *attr)
-{
-    rc_t rc;
-    size_t num_read;
-    char buffer [ 256 ];
-
-    assert ( l );
-
-    rc = s_KXMLNodeReadNodeOrAttrCString
-        ( self, buffer, sizeof buffer, & num_read, attr );
-
-    if ( rc == 0 )
-    {
-        char *end;
-        *l = strtol ( buffer, & end, 0 );
-        if ( end [ 0 ] != 0 )
-            rc = RC ( rcXML, rcNode, rcReading, rcType, rcIncorrect );
-    }
-
-    return rc;
-}
-
-static
-rc_t s_KXMLNodeReadNodeOrAttrAs_ulong(const KXMLNode *self, unsigned long *l,
-    const char *attr)
-{
-    rc_t rc;
-    size_t num_read;
-    char buffer [ 256 ];
-
-    assert ( l );
-
-    rc = s_KXMLNodeReadNodeOrAttrCString
-        ( self, buffer, sizeof buffer, & num_read, attr );
-
-    if ( rc == 0 )
-    {
-        char *end;
-        *l = strtoul ( buffer, & end, 0 );
-
-        if ( end [ 0 ] != 0 )
-        {
-    #if 1
-            rc = RC ( rcXML, rcNode, rcReading, rcType, rcIncorrect );
-    #else
-            if ( end [ 0 ] != '-' && end [ 0 ] != '+' )
-                rc = RC ( rcXML, rcNode, rcReading, rcType, rcIncorrect );
-            else
-            {
-                /* read signed, cast to unsigned... ? */
-            }
-    #endif
-        }
-    }
-
-    return rc;
-}
-
-/* ReadAs ( formatted )
- *  reads as integer or float value in native byte order
- *  casts smaller-sized values to desired size, e.g.
- *    uint32_t to uint64_t
- *
- *  "i" [ OUT ] - return parameter for signed integer
- *  "u" [ OUT ] - return parameter for unsigned integer
- *  "f" [ OUT ] - return parameter for double float
- */
-static
-rc_t s_KXMLNodeReadNodeOrAttrAsI16 ( const KXMLNode *self, int16_t *i,
-    const char *attr )
-{
-    rc_t rc = 0;
-    long val = 0;
-
-    if ( i == NULL )
-        return RC ( rcXML, rcNode, rcReading, rcParam, rcNull );
-
-    rc = s_KXMLNodeReadNodeOrAttrAs_long ( self, &val, attr );
-
-    if ( rc == 0 )
-    {
-        if ( val < -32768  || val >= 32768 )
-            rc = RC ( rcXML, rcNode, rcReading, rcRange, rcExcessive );
-        else
-            * i = ( int16_t ) val;
-    }
-
-    return rc;
-}
-
-rc_t KXMLNodeReadAsI16 ( const KXMLNode *self, int16_t *i )
-{ return s_KXMLNodeReadNodeOrAttrAsI16(self, i, NULL); }
-static 
-rc_t s_KXMLNodeReadNodeOrAttrAsU16 ( const KXMLNode *self, uint16_t *u,
-    const char *attr )
-{
-    rc_t rc = 0;
-    unsigned long val = 0;
-
-    if ( u == NULL )
-        return RC ( rcXML, rcNode, rcReading, rcParam, rcNull );
-
-    rc = s_KXMLNodeReadNodeOrAttrAs_ulong(self, &val, attr);
-
-    if ( rc == 0 )
-    {
-        if ( val >= 0x10000 )
-            rc = RC ( rcXML, rcNode, rcReading, rcRange, rcExcessive );
-        else
-            * u = ( uint16_t ) val;
-    }
-
-    return rc;
-}
-
-rc_t KXMLNodeReadAsU16 ( const KXMLNode *self, uint16_t *u )
-{ return s_KXMLNodeReadNodeOrAttrAsU16(self, u, NULL); }
-static
-rc_t s_KXMLNodeReadNodeOrAttrAsI32 ( const KXMLNode *self, int32_t *i,
-    const char *attr )
-{
-    rc_t rc = 0;
-    long val = 0;
-
-    if ( i == NULL )
-        return RC ( rcXML, rcNode, rcReading, rcParam, rcNull );
-
-    rc = s_KXMLNodeReadNodeOrAttrAs_long ( self, &val, attr );
-
-    if ( rc == 0 )
-    {
-        * i = ( int32_t ) val;
-        if ( ( long ) ( * i ) != val )
-            rc = RC ( rcXML, rcNode, rcReading, rcRange, rcExcessive );
-    }
-
-    return rc;
-}
-
-rc_t KXMLNodeReadAsI32 ( const KXMLNode *self, int32_t *i )
-{ return s_KXMLNodeReadNodeOrAttrAsI32(self, i, NULL); }
-rc_t s_KXMLNodeReadNodeOrAttrAsU32 ( const KXMLNode *self, uint32_t *u,
-    const char *attr )
-{
-    rc_t rc = 0;
-    unsigned long val = 0;
-
-    if ( u == NULL )
-        return RC ( rcXML, rcNode, rcReading, rcParam, rcNull );
-
-    rc = s_KXMLNodeReadNodeOrAttrAs_ulong(self, &val, attr);
-
-    if ( rc == 0 )
-    {
-        * u = ( uint32_t ) val;
-        if ( ( unsigned long ) ( * u ) != val )
-            rc = RC ( rcXML, rcNode, rcReading, rcRange, rcExcessive );
-    }
-
-    return rc;
-}
-rc_t KXMLNodeReadAsU32 ( const KXMLNode *self, uint32_t *u )
-{ return s_KXMLNodeReadNodeOrAttrAsU32(self, u, NULL); }
-static
-rc_t s_KXMLNodeReadNodeOrAttrAsI64 ( const KXMLNode *self, int64_t *i,
-    const char *attr )
-{
-    rc_t rc;
-
-    if ( i == NULL )
-        rc = RC ( rcXML, rcNode, rcReading, rcParam, rcNull );
-    else
-    {
-        size_t num_read;
-        char buffer [ 256 ];
-
-        rc = s_KXMLNodeReadNodeOrAttrCString
-            ( self, buffer, sizeof buffer, & num_read, attr );
-
-        if ( rc == 0 )
-        {
-            char *end;
-            int64_t val = strtoi64 ( buffer, & end, 0 );
-
-            if ( end [ 0 ] != 0 )
-                rc = RC ( rcXML, rcNode, rcReading, rcType, rcIncorrect );
-            else
-                * i = val;
-        }
-    }
-
-    return rc;
-}
-rc_t KXMLNodeReadAsI64 ( const KXMLNode *self, int64_t *i )
-{ return s_KXMLNodeReadNodeOrAttrAsI64(self, i, NULL); }
-
-rc_t s_KXMLNodeReadNodeOrAttrAsU64 ( const KXMLNode *self, uint64_t *u,
-    const char *attr )
-{
-    rc_t rc;
-
-    if ( u == NULL )
-        rc = RC ( rcXML, rcNode, rcReading, rcParam, rcNull );
-    else
-    {
-        size_t num_read;
-        char buffer [ 256 ];
-
-        rc = s_KXMLNodeReadNodeOrAttrCString
-            ( self, buffer, sizeof buffer, & num_read, attr );
-
-        if ( rc == 0 )
-        {
-            char *end;
-            uint64_t val = strtou64 ( buffer, & end, 0 );
-
-            if ( end [ 0 ] != 0 )
-            {
-        #if 1
-                rc = RC ( rcXML, rcNode, rcReading, rcType, rcIncorrect );
-        #else
-                if ( end [ 0 ] != '-' && end [ 0 ] != '+' )
-                    rc = RC ( rcXML, rcNode, rcReading, rcType, rcIncorrect );
-                else
-                {
-                    /* read signed, cast to unsigned... ? */
-                    /* FYI
-                       centos64: strtou64("-1") = 0xffff...
-                       errno = 1; end[0] = '\0' */
-                }
-        #endif
-            }
-            else
-                * u = val;
-        }
-    }
-
-    return rc;
-}
-
-rc_t KXMLNodeReadAsU64 ( const KXMLNode *self, uint64_t *u )
-{ return s_KXMLNodeReadNodeOrAttrAsU64(self, u, NULL); }
-rc_t s_KXMLNodeReadNodeOrAttrAsF64 ( const KXMLNode *self, double *f,
-    const char *attr )
-{
-    rc_t rc;
-
-    if ( f == NULL )
-        rc = RC ( rcXML, rcNode, rcReading, rcParam, rcNull );
-    else
-    {
-        size_t num_read;
-        char buffer [ 256 ];
-
-        rc = s_KXMLNodeReadNodeOrAttrCString
-            ( self, buffer, sizeof buffer, & num_read, attr );
-
-        if ( rc == 0 )
-        {
-            char *end;
-            * f = strtod ( buffer, & end );
-            if ( end [ 0 ] != 0 )
-                rc = RC ( rcXML, rcNode, rcReading, rcType, rcIncorrect );
-        }
-    }
-
-    return rc;
-}
-rc_t KXMLNodeReadAsF64 ( const KXMLNode *self, double *f )
-{ return s_KXMLNodeReadNodeOrAttrAsF64(self, f, NULL); }
-
-/* Read ( formatted )
- *  reads as C-string
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - output buffer for
- *  NUL terminated string.
- *
- *  "size" [ OUT ] - return parameter giving size of string
- *  not including NUL byte. the size is set both upon success
- *  and insufficient buffer space error.
- */
-rc_t KXMLNodeReadCString ( const KXMLNode *self,
-    char *buffer, size_t bsize, size_t *size )
-{
-    rc_t rc;
-
-    if ( size == NULL )
-        rc = RC ( rcXML, rcNode, rcReading, rcParam, rcNull );
-    else
-    {
-        size_t remaining;
-        rc = KXMLNodeRead ( self, 0, buffer, bsize, size, & remaining );
-        if ( rc == 0 )
-        {
-            if ( * size == bsize )
-            {
-                rc = RC ( rcXML, rcNode, rcReading, rcBuffer, rcInsufficient );
-                * size += remaining;
-            }
-            else
-            {
-                buffer [ * size ] = 0;
-            }
-        }
-    }
-
-    return rc;
-}
-
-rc_t KXMLNodeReadCStr( const KXMLNode *self, char** str, const char* default_value)
-{
-    rc_t rc = 0;
-
-    if( self == NULL || str == NULL ) {
-        rc = RC( rcXML, rcNode, rcReading, rcParam, rcNull);
-    } else { 
-        char b[10240];
-        size_t to_read = sizeof(b) - 1, nread = 0;
-        
-        *str = NULL;
-        if( (rc = KXMLNodeReadCString(self, b, to_read, &nread)) == 0 ) {
-            if( nread == 0 && default_value != NULL ) {
-                size_t size;
-                *str = string_dup(default_value, string_measure(default_value, &size));
-            } else {
-                *str = string_dup(b, nread);
-            }
-            if( *str == NULL ) {
-                rc = RC(rcXML, rcNode, rcReading, rcMemory, rcInsufficient);
-            }
-        }
-    }
-    return rc;
-}
-
-
-/** Reads XML Node attribute value
-attr: attribute name
-    remaining can be NULL.
-Can have bsize parameter equal to 0:
-can be used to find out the attribute value length.
-*/
-rc_t KXMLNodeReadAttr(const KXMLNode *self,
-     const char *attr,
-     void *buffer,
-     size_t bsize,
-     size_t *num_read,
-     size_t *remaining)
-{
-    rc_t status = 0;
-    struct _xmlAttr* properti = NULL;
-    if (!attr || !num_read) {
-        return RC ( rcXML, rcAttr, rcReading, rcParam, rcNull );
-    }
-    if (bsize && !buffer)
-    {   return RC ( rcXML, rcNode, rcReading, rcParam, rcNull ); }
-    *num_read = 0;
-    if (remaining) {
-        *remaining = 0;
-    }
-    if (!self)
-    {   return RC ( rcXML, rcAttr, rcReading, rcSelf, rcCorrupt ); }
-    if (self->children) {
-        properti = self->children->properties;
-    }
-    else if (self->parent && self->parent->xpathObj) {
-        int32_t idx = self->idx;
-        const xmlXPathObjectPtr xpathObj = self->parent->xpathObj;
-        assert(xpathObj->nodesetval && idx < xpathObj->nodesetval->nodeNr);
-        {
-            xmlNodePtr node = xpathObj->nodesetval->nodeTab[idx];
-            if (node && node->type == XML_ELEMENT_NODE)
-            {   properti = node->properties; }
-        }
-    }
-    else {
-        status = RC ( rcXML, rcAttr, rcReading, rcSelf, rcCorrupt );
-    }
-    if (properti) {
-        while (properti) {
-            if (!xmlStrcmp(BAD_CAST attr, properti->name)) {
-                return s_KXMLNode_readTextNode(properti->children,
-                    buffer, bsize, num_read, remaining, 0);
-            }
-            properti = properti->next;
-        }
-    }
-    status = RC ( rcXML, rcAttr, rcReading, rcAttr, rcNotFound );
-    return status;
-}
-
-
-/* ReadAttrAs ( formatted )
- *  reads as integer or float value in native byte order
- *  casts smaller-sized values to desired size, e.g.
- *    uint32_t to uint64_t
- *
- *  "i" [ OUT ] - return parameter for signed integer
- *  "u" [ OUT ] - return parameter for unsigned integer
- *  "f" [ OUT ] - return parameter for double float
- */
-rc_t KXMLNodeReadAttrAsI16
-    ( const KXMLNode *self, const char *attr, int16_t *i )
-{ return s_KXMLNodeReadNodeOrAttrAsI16(self, i, attr); }
-
-rc_t KXMLNodeReadAttrAsU16
-    ( const KXMLNode *self, const char *attr, uint16_t *u )
-{ return s_KXMLNodeReadNodeOrAttrAsU16(self, u, attr); }
-
-rc_t KXMLNodeReadAttrAsI32 ( const KXMLNode *self,
-    const char *attr, int32_t *i )
-{ return s_KXMLNodeReadNodeOrAttrAsI32(self, i, attr); }
-
-rc_t KXMLNodeReadAttrAsU32
-    ( const KXMLNode *self, const char *attr, uint32_t *u )
-{ return s_KXMLNodeReadNodeOrAttrAsU32(self, u, attr); }
-
-rc_t KXMLNodeReadAttrAsI64
-    ( const KXMLNode *self, const char *attr, int64_t *i )
-{ return s_KXMLNodeReadNodeOrAttrAsI64(self, i, attr); }
-
-rc_t KXMLNodeReadAttrAsU64
-    ( const KXMLNode *self, const char *attr, uint64_t *u )
-{ return s_KXMLNodeReadNodeOrAttrAsU64(self, u, attr); }
-
-rc_t KXMLNodeReadAttrAsF64 ( const KXMLNode *self, const char *attr, double *f )
-{ return s_KXMLNodeReadNodeOrAttrAsF64(self, f, attr); }
-
-
-/* ReadAttrCString ( formatted )
- *  reads as C-string
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - output buffer for
- *  NUL terminated string.
- *
- *  "size" [ OUT ] - return parameter giving size of string
- *  not including NUL byte. the size is set both upon success
- *  and insufficient buffer space error.
- */
-rc_t KXMLNodeReadAttrCString ( const KXMLNode *self, const char *attr,
-    char *buffer, size_t bsize, size_t *size )
-{
-    rc_t rc;
-
-    if ( size == NULL )
-        rc = RC ( rcXML, rcAttr, rcReading, rcParam, rcNull );
-    else
-    {
-        size_t remaining;
-        rc = KXMLNodeReadAttr ( self, attr, buffer, bsize, size, & remaining );
-        if ( rc == 0 )
-        {
-            if ( * size == bsize )
-            {
-                rc = RC ( rcXML, rcAttr, rcReading, rcBuffer, rcInsufficient );
-                * size += remaining;
-            }
-            else
-            {
-                buffer [ * size ] = 0;
-            }
-        }
-    }
-
-    return rc;
-}
-
-rc_t KXMLNodeReadAttrCStr( const KXMLNode *self, const char *attr, char** str, const char* default_value)
-{
-    rc_t rc = 0;
-
-    if( self == NULL || attr == NULL || str == NULL ) {
-        rc = RC( rcXML, rcNode, rcReading, rcParam, rcNull);
-    } else { 
-        char b[10240];
-        size_t to_read = sizeof(b) - 1, nread = 0;
-        
-        *str = NULL;
-        if( (rc = KXMLNodeReadAttrCString(self, attr, b, to_read, &nread)) == 0 ) {
-            if( nread == 0 && default_value != NULL ) {
-                size_t size;
-                *str = string_dup(default_value, string_measure(default_value, &size));
-            } else {
-                *str = string_dup(b, nread);
-            }
-        } else if( GetRCState(rc) == rcNotFound && default_value != NULL ) {
-            size_t size;
-            *str = string_dup(default_value, string_measure(default_value, &size));
-            rc = 0;
-        }
-        if( rc == 0 && *str == NULL ) {
-            rc = RC(rcXML, rcNode, rcReading, rcMemory, rcInsufficient);
-        }
-    }
-    return rc;
-}
-
-
-struct s_KNodeNamelist {
-    KNamelist dad;
-    struct _xmlAttr* properties;
-    struct _xmlNode* children;
-};
-typedef struct s_KNodeNamelist s_KNodeNamelist;
-static rc_t KNodeNamelistDestroy (s_KNodeNamelist *self)
-{
-    free(self);
-    return 0;
-}
-
-static rc_t s_LibXmlCount(uint32_t *count,
-    const struct _xmlNode* children,
-    const struct _xmlAttr* properties)
-{
-    assert(count);
-
-    *count = 0;
-
-    /* It neither of properties nor children exists
-    then this node does not have children */
-
-    if (properties) {
-        while (properties) {
-            ++(*count);
-            properties = properties->next;
-        }
-    }
-    else if (children) {
-        while (children) {
-            if (children->type == XML_ELEMENT_NODE) {
-                ++(*count);
-            }
-            children = children->next;
-        }
-    }
-
-    return 0;
-}
-
-static rc_t KNodeNamelistCount(const s_KNodeNamelist *self,
-    uint32_t *count)
-{
-    if (!count) {
-        return RC ( rcXML, rcNamelist, rcListing, rcParam, rcNull );
-    }
-
-    return s_LibXmlCount(count, self->children, self->properties);
-}
-
-static rc_t s_LibXmlGetNode(const struct _xmlNode** result,
-    uint32_t idx,
-    const struct _xmlNode* children)
-{
-    uint32_t count = 0;
-    while (children) {
-        if (children->type == XML_ELEMENT_NODE) {
-            if (count == idx) {
-                *result = children;
-                return 0;
-            }
-            ++count;
-        }
-        children = children->next;
-    }
-    return RC ( rcXML, rcNode, rcReading, rcIndex, rcNotFound );
-}
-
-/* TODO:
-quick and dirty version: bad style and code copying: has to be refactored */
-rc_t KXMLNodeGetNodeRead ( const KXMLNode *self,
-    const KXMLNode **result,
-    uint32_t idx )
-{
-    if (!self)
-    {   return RC ( rcXML, rcNode, rcReading, rcSelf, rcNull ); }
-    if (!result)
-    {   return RC ( rcXML, rcNode, rcReading, rcParam, rcNull ); }
-
-    *result = 0;
-
-    {
-        uint32_t count = 0;
-        rc_t rc = KXMLNodeCountChildNodes(self, &count);
-        if (rc)
-        {   return rc; }
-        if (idx >= count)
-        {   return RC ( rcXML, rcNode, rcCreating, rcIndex, rcInvalid ); }
-
-        {
-            const struct _xmlNode *resultChildren = 0;
-            const struct _xmlNode *children = self->children;
-            if (children) {
-                children = children->children;
-                assert(children);
-            }
-            else {
-                if (self && self->parent && self->parent->xpathObj) {
-                    const xmlNodeSetPtr nodesetval
-                        = self->parent->xpathObj->nodesetval;
-                    if (nodesetval) {
-                        if ((nodesetval->nodeNr > 0)
-                            && nodesetval->nodeTab)
-                        {
-                            if (nodesetval->nodeNr <= self->idx) {
-                                return RC ( rcXML, rcNode, rcCreating,
-                                    rcSelf, rcCorrupt );
-                            }
-                            if (nodesetval->nodeTab[self->idx]) {
-                                children
-                                    = nodesetval->nodeTab[self->idx]->children;
-                            /*parent node for our requested parent->child[idx]*/
-                                assert(children);
-                            }
-                            else {
-                                return RC ( rcXML, rcNode, rcCreating,
-                                    rcSelf, rcCorrupt );
-                            }
-                        }
-                        else {
-                            return RC ( rcXML, rcNode, rcCreating,
-                                rcSelf, rcCorrupt );
-                        }
-                    } else {
-                        return RC(rcXML, rcNode, rcCreating, rcSelf, rcCorrupt);
-                    }
-                } else {
-                    return RC ( rcXML, rcNode, rcCreating, rcSelf, rcCorrupt );
-                }
-            }
-            rc = s_LibXmlGetNode(&resultChildren, idx, children);
-            if (rc)
-            {   return rc; }
-            rc = s_KXMLNode_cTor
-                (self->parent, result, 0, resultChildren, self->path);
-            return rc;
-        }
-    }
-}
-
-static rc_t KNodeNamelistGet(const s_KNodeNamelist *self,
-    uint32_t idx,
-    const char **name)
-{
-    uint32_t count = 0;
-    if (self->properties) {
-        struct _xmlAttr* properties = self->properties;
-        while (properties) {
-            if (count == idx) {
-                *name = (const char*)properties->name;
-                return 0;
-            }
-            ++count;
-            properties = properties->next;
-        }
-    }
-    else if (self->children) {
-        const struct _xmlNode *result = 0;
-        rc_t rc = s_LibXmlGetNode(&result, idx, self->children);
-        if (rc)
-        { return rc; }
-        *name = (const char*)result->name;
-        return 0;
-    }
-    return RC ( rcXML, rcNode, rcReading, rcIndex, rcNotFound );
-}
-
-static KNamelist_vt_v1 vtKNodeNamelist = {
-    /* version 1.0 */
-    1, 0,
-
-    /* start minor version 0 methods */
-    KNodeNamelistDestroy,
-    KNodeNamelistCount,
-    KNodeNamelistGet
-    /* end minor version 0 methods */
-};
-
-enum EKNodeNamelistType {
-    eAttr,
-    eNode
-};
-
-/** KAttrNamelist factory method */
-static int s_KXMLNode_createKNodeNamelist(const KXMLNode *self,
-    const KNamelist **list,
-    uint32_t type)
-{
-    /*TODO it seems
-    that the case when (KXMLNode::children != NULL) is not implemented*/
-    rc_t status = 0;
-    *list = 0;
-    if (self && self->parent && self->parent->xpathObj) {
-        s_KNodeNamelist* obj
-            = (s_KNodeNamelist*) malloc(sizeof(s_KNodeNamelist));
-        if (!obj) {
-            return RC ( rcXML, rcNamelist, rcCreating, rcMemory, rcExhausted );
-        }
-        status
-            = KNamelistInit(&obj->dad, (const KNamelist_vt*) &vtKNodeNamelist);
-        if (status != 0) {
-            free(obj);
-            return status;
-        }
-        obj->properties = 0;
-        obj->children = 0;
-        *list = &obj->dad;
-        if( self->children ) {
-            switch (type) {
-                case eAttr:
-                    obj->properties = self->children->properties;
-                    break;
-                case eNode:
-                    obj->children = self->children->children;
-                    break;
-                default:
-                    assert(0);
-                    break;
-            }
-        } else {
-            const xmlNodeSetPtr nodesetval = self->parent->xpathObj->nodesetval;
-            if (nodesetval) {
-                if ((nodesetval->nodeNr > 0) && nodesetval->nodeTab) {
-                    if (nodesetval->nodeNr <= self->idx) {
-                        free(obj);
-                        *list = 0;
-                        return RC
-                            (rcXML, rcNamelist, rcCreating, rcSelf, rcCorrupt);
-                    }
-                    if (nodesetval->nodeTab[self->idx]) {
-                        switch (type) {
-                            case eAttr:
-                                obj->properties =
-                                    nodesetval->nodeTab[self->idx]->properties;
-                                break;
-                            case eNode:
-                                obj->children =
-                                    nodesetval->nodeTab[self->idx]->children;
-                                break;
-                            default:
-                                assert(0);
-                                break;
-                        }
-                    }
-                }
-            }
-        }
-        status = 0;
-    }
-    else {
-        status = RC ( rcXML, rcNamelist, rcCreating, rcSelf, rcCorrupt );
-    }
-    return status;
-}
-rc_t KXMLNodeListAttr(const KXMLNode *self,
-    const KNamelist **names)
-{
-    return s_KXMLNode_createKNodeNamelist(self, names, eAttr);
-}
-
-rc_t KXMLNodeListChild(const KXMLNode *self,
-    const KNamelist **names)
-{
-    return s_KXMLNode_createKNodeNamelist(self, names, eNode);
-}
-
-rc_t KXMLNodeCountChildNodes(const KXMLNode *self,
-    uint32_t *count)
-{
-    if (!self)
-    {   return RC ( rcXML, rcNode, rcListing, rcSelf, rcNull ); }
-    if (!count)
-    {   return RC ( rcXML, rcNode, rcListing, rcParam, rcNull ); }
-    *count = 0;
-    if (self && self->parent && self->parent->xpathObj) {
-        const xmlNodeSetPtr nodesetval = self->parent->xpathObj->nodesetval;
-        if (nodesetval) {
-            if ((nodesetval->nodeNr > 0) && nodesetval->nodeTab) {
-                if (nodesetval->nodeNr <= self->idx) {
-                    return RC(rcXML, rcNamelist, rcCreating, rcSelf, rcCorrupt);
-                }
-                if (nodesetval->nodeTab[self->idx]) {
-                    if (!self->children) {
-                        return s_LibXmlCount(
-                            count, nodesetval->nodeTab[self->idx]->children, 0);
-                    } else { 
-                        /*assert(0); // not implemented*/
-                        if (!self->children->children)
-        /* 'self->children'
-         is a node that should contain its children in self->children->children.
-         If (self->children->children == NULL) then the node has no child. */
-                        {   return 0; }
-                        else {
-                            return s_LibXmlCount
-                                (count, self->children->children, 0);
-                        }
-                    }
-                }
-            }
-        }
-    }
-    return RC ( rcXML, rcNamelist, rcCreating, rcSelf, rcCorrupt );
-}
-
-/* GetFirstChildNodeRead
- *  Returns the first(with index 0) sub-node of self using path.
- *  Is equivalent to:
- *          KXMLNodeOpenNodesetRead(self, &nc, path, ...);
- *          KXMLNodesetGetNodeRead(ns, node, 0);
- */
-rc_t KXMLNodeVGetFirstChildNodeRead ( const KXMLNode *self,
-    const KXMLNode **node, const char *path, va_list args )
-{
-    rc_t rc = 0;
-
-    struct KXMLNodeset const *ns = NULL;
-
-    if (node == NULL) {
-        return RC(rcXML, rcNode, rcReading, rcParam, rcNull);
-    }
-
-    *node = NULL;
-
-    rc = KXMLNodeVOpenNodesetRead(self, &ns, path, args);
-
-    if (rc == 0) {
-        rc = KXMLNodesetGetNodeRead(ns, node, 0);
-        KXMLNodesetRelease(ns);
-    }
-
-    return rc;
-}
-
-rc_t KXMLNodeGetFirstChildNodeRead ( const KXMLNode *self,
-    const KXMLNode **node, const char *path, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start(args, path);
-    rc = KXMLNodeVGetFirstChildNodeRead(self, node, path, args);
-    va_end(args);
-
-    return rc;
-}
-
-/* EOF */
diff --git a/libs/kxml/xtoc-parsexml.c b/libs/kxml/xtoc-parsexml.c
deleted file mode 100644
index b2093d2..0000000
--- a/libs/kxml/xtoc-parsexml.c
+++ /dev/null
@@ -1,576 +0,0 @@
-/*******************************************************************************
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * =============================================================================
- */
-
-#include "xtoc-priv.h" /* XTocParseXml */
-
-#include <kxml/xml.h> /* KXMLNode */
-/* #include <klib/log.h> LOGERR */
-#include <klib/debug.h> /* DBGMSG */
-#include <klib/printf.h>
-#include <klib/out.h>
-#include <klib/rc.h> /* RC */
-
-#include "os-native.h"
-
-#include <sysalloc.h>
-
-#include <assert.h>
-#include <stdio.h> /* printf */
-#include <stdlib.h> /* free */
-#include <string.h> /* memset */
-#include <time.h>      /* timegm */
-#include <os-native.h> /* timegm */
-
-typedef struct KFile KFile;
-
-/*#define DISP_RC(rc, msg) (void) ( (rc == 0) ? 0 : LOGERR(klogInt, rc, msg) )*/
-#define DISP_RC(rc, msg) (void) ( 0 )
-
-/* copy-paste from libs/kfs/md5.c */
-
-static
-int hex_to_int ( char hex )
-{
-    int i = hex - '0';
-    if ( hex > '9' )
-    {
-        if ( hex < 'a' )
-            i = hex - 'A' + 10;
-        else
-            i = hex - 'a' + 10;
-
-        if ( i > 15 )
-            return -1;
-    }
-    return i;
-}
-
-static
-rc_t MD5SumExtract(const char* str, uint8_t digest[16])
-{
-    rc_t rc = 0;
-
-    int i = 0;
-    /* parse checksum */
-    for ( i = 0; i < 16; ++ i )
-    {
-        int l, u = hex_to_int ( str [ i + i + 0 ] );
-        l = hex_to_int ( str [ i + i + 1 ] );
-        if ( u < 0 || l < 0 )
-        {
-            rc = RC ( rcFS, rcXmlDoc, rcReading, rcFormat, rcInvalid );
-            break;
-        }
-
-        digest [ i ] = ( uint8_t ) ( ( u << 4 ) | l );
-    }
-
-    return rc;
-}
-
-typedef enum NodeType {
-     eUndefined
-    ,eROOT
-    ,eArchive
-    ,eContainer
-    ,eDirectory
-    ,eFile
-    ,eSymlink
-} NodeType;
-typedef struct NodeData {
-    const char* nodeName;
-
-/* need to free */
-    char* nodeValue;
-
-/* attributes */
-    char* id;
-    char* path;
-    char* name;
-    char* mtime;
-    char* filetype;
-    char* md5;
-    char* crc32;
-    char* size;
-    char* offset;
-
-/* parsed node information */
-    NodeType nodeType;
-    uint8_t digest[16];
-    uint64_t iSize;
-    uint64_t iOffset;
-    KTime_t tMtime;
-} NodeData;
-
-static
-NodeType GetNodeType(const char* nodeName)
-{
-    NodeType t = eUndefined;
-
-    if (nodeName == NULL) {
-        t = eUndefined;
-    }
-    else if (!strcmp(nodeName, "archive")) {
-        t = eArchive;
-    }
-    else if (!strcmp(nodeName, "container")) {
-        t = eContainer;
-    }
-    else if (!strcmp(nodeName, "directory")) {
-        t = eDirectory;
-    }
-    else if (!strcmp(nodeName, "file")) {
-        t = eFile;
-    }
-    else if (!strcmp(nodeName, "symlink")) {
-        t = eSymlink;
-    }
-    else if (strstr(nodeName, "ROOT")) {
-        t = eROOT;
-    }
-
-    return t;
-}
-
-#define DEBUG_PRINT false /* true false */
-
-/* TODO: check possible errors */
-/* Reverse to KTimePrint for tools/copycat/cctree-dump.c */
-static
-rc_t CC StrToKTime(const char* str, KTime_t* t)
-{
-    rc_t rc = 0;
-
-    assert(t);
-
-    if (str) {
-        int y, m, d, hr, mn, sc;
-        struct tm gmt;
-        memset(&gmt, 0, sizeof gmt);
-        sscanf(str, "%04d-%02d-%02dT%02d:%02d:%02dZ",
-                                &y, &m, &d, &hr, &mn, &sc);
-        gmt.tm_year = y - 1900;
-        gmt.tm_mon  = m - 1;
-        gmt.tm_mday = d;
-        gmt.tm_hour = hr;
-        gmt.tm_min  = mn;
-        gmt.tm_sec  = sc;
-        *t = timegm(&gmt);
-
-        if (DEBUG_PRINT) {
-            time_t t2 = ( time_t ) * t;
-            size_t len;
-            char buffer [ 64 ];
-
-            struct tm gmt;
-#if SUN
-	    gmt = * gmtime ( & t2 );
-#else
-            gmtime_r ( & t2, & gmt );
-#endif
-            rc = string_printf ( buffer, sizeof buffer, & len
-                , "%04d-%02d-%02dT%02d:%02d:%02dZ"
-                , gmt . tm_year + 1900
-                , gmt . tm_mon + 1
-                , gmt . tm_mday
-                , gmt . tm_hour
-                , gmt . tm_min
-                , gmt . tm_sec
-            );
-            
-            OUTMSG((">> %s\n", str));
-            OUTMSG(("<< %s\n", buffer));
-        }
-    }
-
-    return rc;
-}
-
-#define READ_ATTR(NODE, V) \
-    if (rc == 0) { \
-        rc = KXMLNodeReadAttrCStr(NODE, #V, &data->V, NULL); \
-        if (rc != 0) { \
-            if (GetRCState(rc) == rcNotFound) \
-                rc = 0; \
-        } \
-    }
-/*          else if (data->nodeName) \
-                PLOGERR(klogErr, (klogErr, rc, \
-                    "while calling KXMLNodeReadAttrCStr($(name)/@$(attr))", \
-                    "name=%s,attr=%s", data->nodeName, #V)); */
-
-#define PRN_ATTR(NM, V) \
-    if (DEBUG_PRINT && data->V) OUTMSG(("%s=\"%s\" ", NM, data->V))
-
-#define GET_ATTR(NODE, V) READ_ATTR(NODE, V); PRN_ATTR(#V, V)
-
-static rc_t CC NodeDataReadAttribs(NodeData* data, const KXMLNode* node,
-    const char* parentName, uint32_t idx)
-{
-    rc_t rc = 0;
-
-    assert(node && parentName && data);
-
-    if (DEBUG_PRINT) OUTMSG(("<%s ", data->nodeName));
-
-    GET_ATTR(node, id);
-    GET_ATTR(node, path);
-    GET_ATTR(node, name);
-    GET_ATTR(node, mtime);
-    GET_ATTR(node, filetype);
-    GET_ATTR(node, md5);
-    GET_ATTR(node, crc32);
-
-    READ_ATTR(node, size);
-    READ_ATTR(node, offset);
-
-    if (rc == 0)
-    {
-/* TODO: what size is negative no error is detected */
-        char * attr = "size";
-        rc = KXMLNodeReadAttrAsU64(node, attr, &data->iSize);
-        if (rc != 0) {
-            if (GetRCState(rc) == rcNotFound) {
-                rc = 0;
-            }
-        }
-
-        attr = "offset";
-        rc = KXMLNodeReadAttrAsU64(node, attr, &data->iOffset);
-        if (rc != 0) {
-            if (GetRCState(rc) == rcNotFound) {
-                rc = 0;
-            }
-        }
-/*          else if (data->nodeName) {
-                PLOGERR(klogErr, (klogErr, rc,
-                    "while calling KXMLNodeReadAttrAsU64($(name)/@$(attr))",
-                    "name=%s,attr=%s", data->nodeName, attr));
-            }*/
-        if (DEBUG_PRINT) 
-        {
-            OUTMSG(("%s=\"%lu\" ", attr, data->iSize));
-            OUTMSG(("%s=\"%lu\" ", attr, data->iOffset));
-        }
-    }
-
-    if (DEBUG_PRINT) OUTMSG((">"));
-    if (DEBUG_PRINT && data->nodeValue) OUTMSG(("%s", data->nodeValue));
-    if (DEBUG_PRINT) OUTMSG(("</%s>\n", data->nodeName));
-
-    return rc;
-}
-
-#define FREE(V) free(data->V); data->V = NULL
-
-static
-rc_t CC NodeDataDestroy(NodeData* data)
-{
-    assert(data);
-
-    FREE(nodeValue);
-    FREE(id);
-    FREE(path);
-    FREE(name);
-    FREE(mtime);
-    FREE(filetype);
-    FREE(md5);
-    FREE(crc32);
-    FREE(size);
-    FREE(offset);
-
-    return 0;
-}
-
-static rc_t CC NodeDataInit(NodeData* data, const KXMLNode* node,
-    const char* parentName, uint32_t idx)
-{
-    rc_t rc = 0;
-
-    assert(node && parentName && data);
-
-    memset(data, 0, sizeof *data);
-
-    rc = KXMLNodeGetName(node, &data->nodeName);
-/*  if (rc != 0) {
-        PLOGERR(klogErr, (klogErr, rc,
-            "while calling KXMLNodeGetName($(parent)[$(i)]",
-            "parent=%s,i=%d", parentName, idx));
-    }*/
-
-    if (rc == 0
-        && data->nodeName && !strcmp(data->nodeName, "symlink"))
-    {
-        rc = KXMLNodeReadCStr(node, &data->nodeValue, NULL);
-/*      if (rc != 0) {
-            PLOGERR(klogErr, (klogErr, rc,
-                "while calling KXMLNodeReadCStr($(name))",
-                "name=%s", data->nodeName));
-        }*/
-    }
-
-    if (rc == 0) {
-        rc = NodeDataReadAttribs(data, node, parentName, idx);
-    }
-
-    if (rc == 0) {
-        data->nodeType = GetNodeType(data->nodeName);
-
-        if (data->md5) {
-            if (strlen(data->md5) != 32) {
-                rc = RC(rcFS, rcXmlDoc, rcReading, rcFormat, rcInvalid);
-/*              PLOGERR(klogErr, (klogErr, rc,
-                    "md5sum '$(md5)'", "md5=%s", data->md5));*/
-            }
-            else {
-                rc = MD5SumExtract(data->md5, data->digest);
-            }
-        }
-    }
-
-    if (rc == 0) {
-        rc = StrToKTime(data->mtime, &data->tMtime);
-    }
-
-    return rc;
-}
-
-static
-rc_t CC NodeDataAddToXToc(NodeData* data,
-                          struct XTocEntry* xSelf, struct XTocEntry* xContainer,
-                          struct XTocEntry** xEntry, bool *isContainer)
-{
-    rc_t rc = 0;
-
-    assert(data && xEntry && isContainer);
-
-    *isContainer = false;
-
-    switch (data->nodeType) {
-        case eUndefined:
-            rc = RC(rcFS, rcTocEntry, rcInflating, rcData, rcInvalid);
-/*          LOGERR(klogErr, rc, "undefined node type in DataXAdd");*/
-            break;
-        case eROOT: /* ignore root node */
-            *xEntry = xSelf;
-            break;
-        case eArchive:
-            *isContainer = true;
-            rc = XTocTreeAddArchive(xSelf, xEntry, xContainer,
-                data->name, data->tMtime, data->id, 
-                data->filetype, data->iSize, data->iOffset, data->digest);
-            break;
-        case eContainer:
-            *isContainer = true;
-            rc = XTocTreeAddContainer(xSelf, xEntry, xContainer,
-                data->name, data->tMtime, data->id, 
-                data->filetype, data->iSize, data->iOffset, data->digest);
-            break;
-        case eDirectory:
-            rc = XTocTreeAddDir(xSelf, xEntry, xContainer,
-                data->name, data->tMtime);
-            break;
-        case eFile:
-            rc = XTocTreeAddFile(xSelf, xEntry, xContainer,
-                data->name, data->tMtime,  data->id, 
-                data->filetype, data->iSize, data->iOffset, data->digest);
-            break;
-        case eSymlink:
-            rc = XTocTreeAddSymlink(xSelf, xEntry, xContainer,
-                data->name, data->tMtime, data->nodeValue);
-            break;
-    }
-
-    return rc;
-}
-
-static
-rc_t ProcessNode(const KXMLNode* node,
-    const char* parentName, uint32_t idx,
-    struct XTocEntry* xSelf, struct XTocEntry* xContainer)
-{
-    rc_t rc = 0;
-    uint32_t count = 0;
-    uint32_t i = 0;
-    struct XTocEntry* xEntry = NULL;
-    bool isContainer = false;
-    NodeData data;
-
-    assert(node && parentName);
-
-    if (rc == 0) {
-        rc = NodeDataInit(&data, node, parentName, idx);
-    }
-
-    if (rc == 0) {
-        DBGMSG(DBG_APP,DBG_COND_1,
-            ("%s[%i] = %s\n", parentName, idx, data.nodeName));
-        rc = NodeDataAddToXToc(&data, xSelf, xContainer, &xEntry, &isContainer);
-        if (isContainer) {
-            xContainer = xEntry;
-        }
-    }
-
-    if (rc == 0) {
-        rc = KXMLNodeCountChildNodes(node, &count);
-        if (rc != 0) {
-/*          PLOGERR(klogErr, (klogErr, rc,
-                "while calling KXMLNodeCountChildNodes($(parent)[$(i)])",
-                "parent=%s,i=%d", parentName, idx));*/
-        }
-        else {
-/*          DBGMSG(DBG_APP,DBG_COND_1,
-                ("KXMLNodeCountChildNodes(%s) = %i\n", data.nodeName, count));*/
-        }
-    }
-
-    for (i = 0; i < count && rc == 0; ++i) {
-        const KXMLNode* child = NULL;
-
-        rc = KXMLNodeGetNodeRead(node, &child, i);
-        if (rc != 0) {
-/*          PLOGERR(klogErr, (klogErr, rc,
-                "while calling KXMLNodeCountChildNodes($(parent)[$(i)][$(j)]",
-                "parent=%s,i=%d,j=%d", parentName, idx, i));*/
-        }
-        else {
-/*          DBGMSG(DBG_APP,DBG_COND_1,
-                ("KXMLNodeGetNodeRead(%s[%i])\n", data.nodeName, idx, i));*/
-            ProcessNode(child, data.nodeName, i, xEntry, xContainer);
-        }
-
-        {
-            rc_t rc2 = KXMLNodeRelease(child);
-            if (rc == 0)
-            {   rc = rc2; }
-            child = NULL;
-        }
-    }
-
-    NodeDataDestroy(&data);
-
-    return rc;
-}
-
-rc_t XTocParseXml(struct XTocEntry* xRoot, const KFile* file)
-{
-    rc_t rc = 0;
-
-    const KXMLMgr* mgr = NULL;
-    const KXMLDoc* doc = NULL;
-    const KXMLNodeset* root = NULL;
-    const char rootName[] = "/ROOT";
-
-/**** INIT ****/
-
-    if (rc == 0) {
-        rc = KXMLMgrMakeRead(&mgr);
-        DISP_RC(rc, "while calling KXMLMgrMakeRead");
-    }
-
-    if (rc == 0) {
-        KXMLMgrMakeDocRead(mgr, &doc, file);
-        DISP_RC(rc, "while calling KXMLMgrMakeDocRead");
-    }
-
-    if (rc == 0) {
-        rc = KXMLDocOpenNodesetRead(doc, &root, rootName);
-        if (rc != 0) {
-/*          PLOGERR(klogErr, (klogErr, rc,
-                "while calling KXMLDocOpenNodesetRead $(name)",
-                "name=%s", rootName));*/
-        }
-    }
-
-    if (rc == 0) {
-        uint32_t count = 0;
-        rc = KXMLNodesetCount(root, &count);
-        if (rc != 0) {
-/*          PLOGERR(klogErr, (klogErr, rc,
-                "while calling KXMLNodesetCount($(name))", "name=%s",
-                rootName));*/
-        }
-        else if (count != 1) {
-            rc = RC(rcFS, rcXmlDoc, rcReading,
-                rcTag, count ? rcExcessive : rcNotFound);
-/*          PLOGERR(klogErr, (klogErr, rc, "$(name)", "name=%s", rootName));*/
-        }
-        else if (false) {
-            DBGMSG(DBG_APP,DBG_COND_1,
-                ("KXMLNodesetCount(%s)=%d\n", rootName, count));
-        }
-    }
-
-/**** READ AND PROCESS THE ROOT XML NODE ****/
-
-    if (rc == 0) {
-        uint32_t i = 0;
-        const KXMLNode *node = NULL;
-
-        rc = KXMLNodesetGetNodeRead(root, &node, i);
-        if (rc == 0) {
-            ProcessNode(node, rootName, i, xRoot, xRoot);
-        }
-/*      else {
-*            PLOGERR(klogErr, (klogErr, rc,
-                "while calling KXMLNodesetGetNodeRead($(name), $(i))",
-                "name=%s,i=%d", rootName, i));
-        }*/
-
-        {
-            rc_t rc2 = KXMLNodeRelease(node);
-            if (rc == 0)
-            {   rc = rc2; }
-            node = NULL;
-        }
-    }
-
-/**** RELEASE ****/
-
-    {
-        rc_t rc2 = KXMLDocRelease(doc);
-        if (rc == 0)
-        {   rc = rc2; }
-        doc = NULL;
-    }
-
-    {
-        rc_t rc2 = KXMLNodesetRelease(root);
-        if (rc == 0)
-        {   rc = rc2; }
-        root = NULL;
-    }
-
-    {
-        rc_t rc2 = KXMLMgrRelease(mgr);
-        if (rc == 0)
-        {   rc = rc2; }
-        mgr = NULL;
-    }
-
-    return rc;
-}
-
-/************************************ EOF ****************** ******************/
diff --git a/libs/kxml/xtoc-priv.h b/libs/kxml/xtoc-priv.h
deleted file mode 100644
index 688ec88..0000000
--- a/libs/kxml/xtoc-priv.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_kfs_xtoc_priv_h_
-#define _h_kfs_xtoc_priv_h_
-
-#include <klib/defs.h>
-#include <klib/text.h>
-#include <klib/container.h>
-#include <stdarg.h>
-
-struct KFile;
-struct KDirectory;
-struct XToc;
-struct XTocEntry;
-struct XTocEntryDir;
-struct XTocEntryFile;
-struct XTocListing;
-
-/* ======================================================================
- * shared path routines that really should be their own class
- */
-
-rc_t XTocPathMakePath (char ** ppath, bool canon, const char * path,
-                       va_list args);
-
-/*
- * In parsing the copycat XML we add nodes stating at the root XTocEntry
- * of the XToc.
- *
- * For each node in the DOM add one entry in the XTocEntry for the containing
- * container/archive/directory
- *
- * use the id="xxx" attribute to create a symbolic link in the root.
- * we'll come up with a safe version of the name such as "id:1" using a name
- * that won't exist in the regular filename space.
- *
- *Parameters:
- *   self:      Use the inner most archive, directory, or container for self.
- *              Use the root for the entries inside of root
- *
- *   entry:     Use a local XTocEntry pointer for each new node.  Some will 
- *              remembered for a while and some won't.  It depends upon whether
- *              it has subnodes.  Do not free or release these pointers.  Just
- *              stop using them as they are not referenced counted and freed only
- *              by the KToc itself when it is Whacked.
- *
- *   container: Use the most recent containing archive or container XTocEntry for
- *              each new node.  Use root for those outside the outer most
- *              container or archive.  Do not use directory nodes for this.
- *
- *   name:      comes directly form the XML as is
- *
- *   mtime:     comes directly form the XML converted to 64 bit unsigned
- *
- *   filetype:  comes directly form the XML as is
- *
- *   md5:       comes directly form the XML converted from hex string to byte string
- *
- *   size:      comes directly form the XML converty to 64 bit unsigned
- *
- * For each directory node in the XML use XTocTreeAddDir()
- * For each archive node in the XML use XTocTreeAddArchive()
- * For each container node in the XML use XTocTreeAddContainer()
- * For each file node in the XML use XTocTreeAddFile()
- * For each symlink node in the XML use XTocTreeAddSymLink()
- *
- * For each file, container, or archive use XTocTreeAddSymLink()
- *  use the original root as self, a local pointer, name, mtime from the target and
- *  path of the file, archive or container from the XML as target
- *
- * All of these are local and in Windows build they do not get the CC needed for inter-library calls.
- */
-rc_t XTocParseXml (struct XTocEntry * root, const struct KFile * xml);
-
-rc_t XTocTreeAddFile      (struct XTocEntry * self, struct XTocEntry ** pentry,
-                           struct XTocEntry * container, const char * name,
-                           KTime_t mtime, const char * id, const char * filetype, 
-                           uint64_t size, uint64_t offset, uint8_t md5 [16]);
-
-rc_t XTocTreeAddContainer (struct XTocEntry * self, struct XTocEntry ** pentry,
-                           struct XTocEntry * container, const char * name,
-                           KTime_t mtime, const char * id, const char * filetype, 
-                           uint64_t size, uint64_t offset, uint8_t md5 [16]);
-
-rc_t XTocTreeAddArchive (struct XTocEntry * self, struct XTocEntry ** pentry,
-                         struct XTocEntry * container, const char * name,
-                         KTime_t mtime, const char * id, const char * filetype,
-                         uint64_t size, uint64_t offset, uint8_t md5 [16]);
-
-rc_t XTocTreeAddDir       (struct XTocEntry * self, struct XTocEntry ** entry,
-                           struct XTocEntry * container, const char * name,
-                           KTime_t mtime);
-
-rc_t XTocTreeAddSymlink   (struct XTocEntry * self, struct XTocEntry ** entry,
-                           struct XTocEntry * container, const char * name,
-                           KTime_t mtime, const char * target);
-
-
-#endif /* #ifndef _h_kfs_xtoc_priv_h_ */
-/* end of file */
diff --git a/libs/kxml/xtoc.c b/libs/kxml/xtoc.c
deleted file mode 100644
index d1acd3a..0000000
--- a/libs/kxml/xtoc.c
+++ /dev/null
@@ -1,3464 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <kfs/extern.h>
-
-#include <kxml/xml.h>
-
-#include <klib/defs.h>
-#include <klib/container.h>
-#include <klib/text.h>
-#include <klib/rc.h>
-#include <klib/refcount.h>
-#include <klib/vector.h>
-#include <klib/log.h>
-#include <klib/out.h>
-#include <klib/namelist.h>
-
-#include <kfs/file.h>
-#include <kfs/bzip.h>
-#include <kfs/gzip.h>
-#include <kfs/directory.h>
-
-#include <vfs/manager.h>
-#include <vfs/path.h>
-
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#include <assert.h>
-
-#include <klib/debug.h>
-#define DBGTOC(m)   DBGMSG (DBG_KFS, DBG_FLAG(DBG_KFS_TOC), m)
-#define DBGENTRY(m) DBGMSG (DBG_KFS, DBG_FLAG(DBG_KFS_TOC), m)
-#define DBGCACHE(m) DBGMSG (DBG_KFS, DBG_FLAG(DBG_KFS_TOC), m)
-
-#include "xtoc-priv.h"
-
-struct KSysFile;
-
-typedef struct XToc XToc;
-static rc_t XTocRelease (const XToc * self);
-static rc_t XTocAddRef (const XToc * self);
-
-typedef struct XTocListing XTocListing;
-typedef struct XTocEntry XTocEntry;
-typedef struct KXTocDir KXTocDir;
-typedef struct KXTocFile KXTocFile;
-typedef struct XTocCache XTocCache;
-
-
-/* ======================================================================
- * XTocEntry_t
- *   Each node in the XToc tree needs to be one of a limited number of types
- *   these relate to the KPathType for KDirectory but are more limited in
- *   number.  However the file can explicity be treated as a directory if
- *   flagged as such.
- */
-
-typedef uint32_t XTocEntry_t;
-typedef enum XTocEntry_e
-{
-    xtoce_undefined,
-    xtoce_root,
-    xtoce_id,
-    xtoce_file,
-    xtoce_dir,
-    xtoce_link
-} XTocEntry_e;
-
-#define KDIR_IMPL struct KXTocDir
-#define KFILE_IMPL struct KXTocFile
-#include <kfs/impl.h>
-
-
-#define KNAMELIST_IMPL struct XTocListing
-#include <klib/impl.h>
-
-
-/* ======================================================================
- * XTocEntry
- *
- * TBD:  More efficient use of memory might be obtained by converting
- *       the union into space allocated after the main entry
- */
-struct XTocEntry
-{
-    BSTNode     node;           /* book keeping for the tree structure */
-    String	name;           /* leaf name */
-    XTocEntry * parent;         /* directory containing this entry */
-    XTocEntry * container;      /* compressed file or archive holding this */
-    XTocEntry * root;           /* base entry of the TOC that is '/' */
-    XTocCache * cache;          /* if opened this will be non-NULL */
-    KTime_t     mtime;          /* object modified time/date from the XML */
-    BSTree      tree;           /* objects below this (inverse of parent */
-    XTocEntry_t type;           /* XTocEntry_e */
-    union utype
-    {
-        struct /* idtype - name conflict on Solaris */
-        {
-            XTocEntry * target;
-        } id;
-
-        struct dirtype
-        {
-            int ignored;        /* currently nothing is here */
-        } dir;
-
-        struct filetype
-        {
-            String   filetype;  /* string from copycat XML describing file */
-            uint64_t size;      /* size of file within archive or decompressed */
-            uint64_t offset;    /* offset with in containing file */
-            uint8_t  md5 [16];  /* md5 sum digest */
-            bool has_tree;      /* tree is meaningfull if not false: see next two */
-            bool archive;       /* set if this is an archive, has_tree also set */
-            bool container;     /* set if this is acompressed file, has_tree also set */
-        } file;
-
-        struct linktype
-        {
-            String target;      /* path of the symbolic link */
-        } link;
-    } u;
-};
-
-#if _DEBUGGING
-#define DBG_XTocEntry(p)                                                \
-    {                                                                   \
-        DBGENTRY(("XTocEntry: %p\n", p));                               \
-        if (p)                                                          \
-        {                                                               \
-            DBGENTRY(("    name:      %S\n", &(p)->name));              \
-            DBGENTRY(("    parent:    %p\n", (p)->parent));             \
-            DBGENTRY(("    container: %p\n", (p)->container));          \
-            DBGENTRY(("    root:      %p\n", (p)->root));               \
-            DBGENTRY(("    cache:     %p\n", (p)->cache));              \
-            DBGENTRY(("    tree:      %p\n", (p)->tree));               \
-            DBGENTRY(("    type:      %u\n", (p)->type));               \
-            if ((p)->type == xtoce_id)                                  \
-                DBGENTRY(("    target:      %p\n", &(p)->u.id.target)); \
-            else if ((p)->type == xtoce_link)                          \
-                DBGENTRY(("    target:      %S\n", &(p)->u.link.target)); \
-            else if((p)->type == xtoce_file)                            \
-            {                                                           \
-                DBGENTRY(("    filetype:     %S\n", &(p)->u.file.filetype)); \
-                DBGENTRY(("    size:         %lu\n", (p)->u.file.size)); \
-                DBGENTRY(("    offset:       %lu\n", (p)->u.file.offset)); \
-                DBGENTRY(("    base_tree:    %u\n", (p)->u.file.has_tree)); \
-                DBGENTRY(("    archive:      %u\n", (p)->u.file.archive)); \
-                DBGENTRY(("    container:    %u\n", (p)->u.file.container));  }}}
-#else
-#define DBG_XTocEntry(p)
-#endif
-
-/* function for BSTreeInsert or BSTreeInsertUnique */
-static
-int CC XTocEntrySort (const BSTNode * item, const BSTNode * n)
-{
-    return StringCompare (&((const XTocEntry*)item)->name,
-                          &((const XTocEntry*)n)->name);
-}
-
-/* function for BSTreeFind */
-static
-int CC XTocEntryCmpString (const void * item, const BSTNode * n)
-{
-    return (int)StringCompare ((const String *)item, 
-                               &((const XTocEntry*)n)->name);
-}
-
-/* forward as we have a loop in calls */
-static
-void XTocTreeWhack (BSTNode * item, void * data);
-
-/*
- * XTocEntryDestroy
- *  object destructor
- *  It recursively destroys entries in its tree
- */
-static
-void XTocEntryDestroy (XTocEntry * self)
-{
-    if (self)
-    {
-        switch (self->type)
-        {
-        case xtoce_root:
-        case xtoce_dir:
-        case xtoce_file:
-            /* delete an entries below this one */
-            BSTreeWhack (&self->tree, XTocTreeWhack, NULL);
-            break;
-        case xtoce_link:
-        case xtoce_id:
-        default:
-            break;
-        }
-        free (self);
-    }
-}
-
-/* recursive destructor call for BSTreeWhack */
-static
-void XTocTreeWhack (BSTNode * item, void * data)
-{
-    XTocEntryDestroy ((XTocEntry*)item);
-}
-
-
-rc_t XTocEntryResolvePath (const XTocEntry * self, const char * path_, bool follow_link,
-                           XTocEntry ** pnode)
-{
-    rc_t rc = 0;
-    const char * path;
-    const char * limit;
-    XTocEntry * node;
-    size_t size;
-
-    assert (self);
-    assert (path_);
-    assert (pnode);
-#if 0
-    DBGENTRY (("%s: resolve %s from %p\n", __func__, path_, self));
-#endif
-    node = (XTocEntry *)self;
-#if 0
-    DBGENTRY(("%s: node starts at %s\n", __func__, node ? node->name.addr : "NULL"));
-#endif
-    path = path_;
-#if 0
-    /* this was causing a seg fault for some reason */
-    limit = path + string_size (path);
-#else
-    limit = path + string_measure(path, &size);
-#endif
-
-    do
-    {
-        String s;
-        char * slash;
-        size_t z;
-        BSTree * t;
-#if 0
-        DBGENTRY (("%s: path %s size %lu %p - %p = %lu\n", __func__, path, string_size(path), limit, path, limit-path));
-#endif
-        while (*path == '/')
-                ++path;
-
-        z = limit - path;
-        if (z == 0)
-            break;
-#if 0
-        DBGENTRY (("%s: path %s z %lu %p - %p = %lu\n", __func__, path, z, limit, path, limit-path));
-        DBG_XTocEntry(node);
-#endif
-        switch (node->type)
-        {
-        case xtoce_link:
-        {
-            XTocEntry * nnode;
-            rc = XTocEntryResolvePath (node, node->u.link.target.addr,
-                                       follow_link, &nnode);
-#if 0
-            DBGENTRY(("%s: node becomes %s\n", __func__, node ? node->name.addr : "NULL"));
-#endif
-            if (rc)
-                return rc;
-
-            node = nnode;
-            continue;
-        }
-        case xtoce_id:
-            /* this needed to be a leaf */
-            rc = RC (rcFS, rcDirectory, rcResolving, rcPath, rcInvalid);
-            LOGERR (klogErr, rc, "bad path resolving path by id in XML FS");
-            return rc;
-        default:
-            return RC (rcFS, rcDirectory, rcResolving, rcPath, rcIncorrect);
-
-        case xtoce_file:
-            if ( ! node->u.file.has_tree)
-            {
-                /* this needed to be a leaf */
-                rc = RC (rcFS, rcDirectory, rcResolving, rcPath, rcInvalid);
-                LOGERR (klogErr, rc, "bad path resolving path by name in XML FS");
-                return rc;
-            }
-            /* fall through */
-        case xtoce_root:
-        case xtoce_dir:
-            t = &node->tree;
-            break;
-        }
-        slash = string_chr (path, z, '/');
-        if (slash)
-            z = slash - path;
-
-        StringInit (&s, path, z, string_len (path, z));
-#if 0
-        DBGENTRY (("%s: as String %S\n", __func__, &s));
-#endif
-        node = (XTocEntry*)BSTreeFind (t, &s, XTocEntryCmpString);
-#if 0
-        DBGENTRY (("%s: node is now %p\n", __func__, node));
-#endif
-        if (node == NULL)
-            return RC (rcFS, rcDirectory, rcResolving, rcPath, rcNotFound);
-
-        path += StringSize (&s);
-#if 0
-        DBGENTRY (("%s: looping at %s %p %p\n", __func__, path, path, limit-1));
-#endif
-    } while (path < limit-1);
-
-    if (rc == 0)
-    {
-        if(path[0] == '\0')
-        {
-            switch (node->type)
-            {
-            case xtoce_id:
-                node = node->u.id.target;
-                if (node == NULL)
-                    rc = RC (rcFS, rcDirectory, rcResolving, rcLink, rcCorrupt);
-                break;
-            case xtoce_link:
-                if (follow_link)
-                    return XTocEntryResolvePath (node, path, follow_link, pnode);
-            default:
-                break;
-            }
-        }
-        *pnode = node;
-    }
-#if 1
-    DBGENTRY(("%s: %R\n",__func__, rc));
-#endif
-    return rc;
-}
-
-
-KPathType XTocEntryPathType (const XTocEntry * self, const char * path)
-{
-    rc_t rc;
-    KPathType type = 0;
-    XTocEntry * node;
-
-    rc = XTocEntryResolvePath (self, path, false, &node);
-    if ((rc == 0) && (node->type == xtoce_link))
-        type = kptAlias;
-
-    rc = XTocEntryResolvePath (self, path, true, &node);
-    if (rc)
-    {
-        if (GetRCState (rc) == rcNotFound)
-            return type | kptNotFound;
-        return type | kptBadPath;
-    }
-
-    switch (node->type)
-    {
-    default:
-    case xtoce_undefined:
-        return type | kptBadPath;
-
-    case xtoce_root:
-    case xtoce_dir:
-        return type | kptDir;
-
-    case xtoce_file:
-#if 0
-    /* archives and containers are files */
-        return type | kptFile;
-#else
-    /* archives and containers are directories */
-        return type | (node->u.file.has_tree) ? kptDir : kptFile;
-#endif
-        /* not sure how we'd get here */
-    case xtoce_link:
-        return type | kptBadPath;
-    }
-}
-
-
-/* ======================================================================
- * rc_t XTocTree
- *   This set of functions is the API for building up the entries within an 
- *   XToc.
- */
-
-/*
- * XTocEntryMakeInt
- *
- *  This function creates and initializes the common part of the
- *  XTocEntry
- *
- *  extra_alloc is space set aside for string space not initialized
- *              here.  target path in links for example
- */
-static
-rc_t XTocEntryMakeInt (XTocEntry ** pself, const char * name,
-                       XTocEntry * parent, XTocEntry * container,
-                       KTime_t mtime, size_t extra_alloc)
-{
-    XTocEntry * self;
-    char * pc;
-    size_t  z;
-    rc_t rc = 0;
-
-    assert ((container != NULL) || (strcmp(name,"/") == 0));
-    assert (name);
-    assert (pself);
-
-    z = string_size (name) + 1;
-
-    if (z <= 1)
-    {
-        rc = RC (rcFS, rcTocEntry, rcConstructing, rcName, rcTooShort);
-        LOGERR (klogErr, rc, "No name for directory entry in XML TOC");
-        return rc;
-    }
-
-    /* allocate the memory for the entry node.  
-     * size of the node, space for the name and extra space requested
-     * by the caller of this intermediate function
-     */
-    self = malloc (sizeof (*self) + z + extra_alloc);
-    DBGENTRY (("%s: entry %p name %s\n",__func__,self,name));
-    if (self == NULL)
-        rc = RC (rcFS, rcToc, rcConstructing, rcMemory, rcExhausted);
-
-    else
-    {
-        /* copy the name immediately after the common section */
-        pc = (char*)(self+1);
-        string_copy (pc, z, name, z);
-        z --;
-        StringInit (&self->name, pc, z, string_len (pc, z));
-
-        self->container = container;
-        self->parent = parent;
-        self->root = container == NULL ? container : container->root;
-        self->cache = NULL;
-        self->mtime = mtime;
-        BSTreeInit (&self->tree);
-        if (parent)
-            rc = BSTreeInsert (&parent->tree, &self->node, XTocEntrySort);
-        if (rc == 0)
-        {
-            *pself = self;
-            return 0;
-        }
-        XTocEntryDestroy (self);
-    }
-    return rc;
-}
-
-static
-rc_t XTocTreeAddID (XTocEntry * self, const char * name, KTime_t mtime, 
-                    XTocEntry * target)
-{
-    XTocEntry * entry;
-    rc_t rc;
-
-    DBGENTRY(("%s: self %p name %s target %p\n", __func__, self, name, target));
-    rc = XTocEntryMakeInt (&entry, name, self, self, mtime, 0);
-    if (rc == 0)
-    {
-        entry->u.id.target = target;
-        entry->type = xtoce_id;
-        DBG_XTocEntry (entry);
-    }
-    return rc;
-}
-
-
-rc_t XTocTreeAddDir (XTocEntry * self, XTocEntry ** pentry, XTocEntry * container,
-                           const char * name, KTime_t mtime)
-{
-    rc_t rc = XTocEntryMakeInt (pentry, name, self, container, mtime, 0);
-    if (rc == 0)
-    {
-        (*pentry)->type = xtoce_dir;
-        DBG_XTocEntry (*pentry);
-    }
-    return rc;
-}
-
-
-rc_t XTocTreeAddSymlink   (XTocEntry * self, XTocEntry ** pentry, XTocEntry * container,
-                           const char * name, KTime_t mtime, const char * target)
-{
-    XTocEntry * entry;
-    size_t z = string_size (target) + 1;
-    rc_t rc = XTocEntryMakeInt (&entry, name, self, container, mtime, z);
-
-    if (rc == 0)
-    {
-        char * pc = (char *)entry->name.addr + entry->name.size + 1;
-        string_copy (pc, z, target, z);
-        z--;
-        StringInit (&entry->u.link.target, pc, z, string_len (pc, z));
-        entry->type = xtoce_link;
-        DBG_XTocEntry (entry);
-    }
-    *pentry = entry;
-    return rc;
-}
-
-
-rc_t XTocTreeAddFile      (XTocEntry * self, XTocEntry ** pentry,
-                           XTocEntry * container, const char * name,
-                           KTime_t mtime, const char * id,
-                           const char * filetype, uint64_t size,
-                           uint64_t offset, uint8_t md5 [16])
-{
-    XTocEntry * entry;
-    size_t z;
-    rc_t rc;
-
-    DBGENTRY (("%s: name %s id %s filetype %s\n", __func__, name, id, filetype));
-
-    z = string_size (filetype) + 1;
-    rc = XTocEntryMakeInt (&entry, name, self, container, mtime, z);
-    if (rc == 0)
-    {
-        char * pc;
-
-        pc = (char*)entry->name.addr + entry->name.size + 1;
-        string_copy (pc, z, filetype, z);
-        z--;
-
-        StringInit (&entry->u.file.filetype, pc, z, string_len (pc, z));
-        entry->u.file.size = size;
-        entry->u.file.offset = offset;
-        memcpy (entry->u.file.md5, md5, sizeof entry->u.file.md5);
-        entry->u.file.has_tree = false;
-        entry->u.file.archive = false;
-        entry->u.file.container = false;
-        entry->type = xtoce_file;
-
-        DBGENTRY (("%s: entry %p entry->root %p id %s\n",
-                   __func__, entry, id, entry->root));
-        rc = XTocTreeAddID (entry->root, id, mtime, entry);
-        if (rc)
-        {
-            LOGERR (klogErr, rc, "failed to create alias id - continuing");
-            rc = 0;
-        }
-        DBG_XTocEntry (entry);
-    }
-    *pentry = entry;
-    return rc;
-}
-
-
-rc_t XTocTreeAddContainer (XTocEntry * self, XTocEntry ** pentry,
-                           XTocEntry * container, const char * name,
-                           KTime_t mtime, const char * id,
-                           const char * filetype, uint64_t size,
-                           uint64_t offset, uint8_t md5 [16])
-{
-    rc_t rc = XTocTreeAddFile (self, pentry, container, name, mtime, id, 
-                               filetype, size, offset, md5);
-    if (rc == 0)
-    {
-        (*pentry)->u.file.has_tree = true;
-        (*pentry)->u.file.container = true;
-        DBG_XTocEntry ((*pentry));
-    }
-    return rc;
-}
-
-
-rc_t XTocTreeAddArchive (XTocEntry * self, XTocEntry ** pentry,
-                         XTocEntry * container, const char * name,
-                         KTime_t mtime, const char * id,
-                         const char * filetype, uint64_t size,
-                         uint64_t offset, uint8_t md5 [16])
-{
-    rc_t rc = XTocTreeAddFile (self, pentry, container, name, mtime, id, 
-                               filetype, size, offset, md5);
-    if (rc == 0)
-    {
-        (*pentry)->u.file.has_tree = true;
-        (*pentry)->u.file.archive = true;
-        DBG_XTocEntry ((*pentry));
-    }
-    return rc;
-}
-
-
-/* ======================================================================
- * XTocCache
- *
- * When an entry in the TOC is opened as either a file or a directory
- * it is recorded in the tree indexed by path.  The objects in that
- * tree are of tupe XTocCache
- */
-struct XTocCache
-{
-    BSTNode node;
-    KRefcount refcount;
-    String path;
-    XToc * toc;                 /* ref counted keep daddy alive */
-
-    /* these three references are not reference counted */
-    XTocEntry * entry;
-
-    /* these references are back pointers for "re-opens" */
-    const KXTocFile * file;
-    const KXTocDir * dir;
-};
-static const char XTocCacheClassname[] = "XTocCache";
-
-#if _DEBUGGING
-#define DBG_XTocCache(p)                                                \
-    {   DBGCACHE(("XTocCache: %p\n", (p)));                             \
-        if (p) {                                                        \
-            DBGCACHE(("    refcount: %u\n",*(unsigned*)&(p)->refcount)); \
-            DBGCACHE(("    path:     %S\n",&(p)->path));                \
-            DBGCACHE(("    toc:      %p\n",(p)->toc));                  \
-            DBGCACHE(("    entry:    %p\n",(p)->entry));                \
-            DBGCACHE(("    file:     %p\n",(p)->file));                 \
-            DBGCACHE(("    dir:      %p\n",(p)->dir));                  \
-            if ((p)->file) DBG_KXTocDir((p)->file);                     \
-            if ((p)->dir) DBG_KXTocDir((p)->dir); }}
-#else
-#define DBG_XTocCache(p)
-#endif
-
-/* Sort
- *   A sort comparitor suitable for BSTreeInsert/NSTreInsertUnique
- */
-static
-int CC XTocCacheSort (const BSTNode * item, const BSTNode * n)
-{
-    return StringCompare (&((const XTocCache*)item)->path,
-                          &((const XTocCache*)n)->path);
-}
-
-
-/* 
- * Cmp
- *   A sort comparitor suitable for BSTreeFind
- */
-static
-int CC XTocCacheCmp (const void * item, const BSTNode * n)
-{
-    const String * s = item;
-    const XTocCache * node = (const XTocCache *)n;
-    return StringCompare (s, &node->path);
-}
-
-
-/* 
- * Destroy
- */
-static void XTocCacheDestroy (XTocCache * self);
-
-
-/*
- * AddRef
- */
-static
-rc_t XTocCacheAddRef (const XTocCache * self)
-{
-    assert (self);
-    switch (KRefcountAdd (&self->refcount, XTocCacheClassname))
-    {
-    case krefLimit:
-        return RC (rcFS, rcToc, rcAttaching, rcRange, rcExcessive);
-    }
-    return 0;
-}
-
-
-/*
- * Release
- */
-static
-rc_t XTocCacheRelease (const XTocCache * cself)
-{
-    if (cself)
-    {
-        XTocCache * self = (XTocCache*)cself;
-        switch (KRefcountDrop (&self->refcount, XTocCacheClassname))
-        {
-        case krefWhack:
-            XTocCacheDestroy (self);
-        }
-    }
-    return 0;    
-}
-
-
-/*
- * Make
- *
- * This creates the node with one reference.  The file or directory
- * are not opened by this, nor are they initialized to non-NULL.
- */
-static
-rc_t XTocCacheMake (XTocCache ** pself, String * path,
-                         XToc * toc, XTocEntry * entry)
-{
-    XTocCache * self;
-    char * pc;
-    rc_t rc;
-
-    assert (pself);
-    assert (path);
-    assert (entry);
-
-    *pself = NULL;
-
-    rc = XTocAddRef (toc);
-    if (rc)
-        return rc;
-
-    self = calloc (sizeof (*self) + 1 + StringSize (path), 1);
-    if (self == NULL)
-        return RC (rcFS, rcTocEntry, rcConstructing, rcMemory, rcExhausted);
-
-
-    KRefcountInit (&self->refcount, 1,  XTocCacheClassname, "Init",
-                   path->addr);
-
-    self->entry = entry;
-    self->toc = toc;
-
-    pc = (char *)(self + 1);
-    string_copy (pc, StringSize (path), path->addr, StringSize (path));
-    StringInit (&self->path, pc, StringSize(path), StringLength(path));
-    *pself = self;
-    return 0;
-}
-
-
-/* ======================================================================
- * XToc
- */
-
-/* ----------------------------------------------------------------------
- * XToc
- *   The flagshop class for this is a very simple class.  It has no use 
- *   outside of NCBI at this point.
- *
- *   It maintains in debugging situations the path for the object that
- *   was opened upon creation.
- *
- *   It maintains the directory like entries created by copycat when it
- *    cataloged a submission.
- *
- *   It maintains a list of what fiels and directories within that catalog
- *   are currently open.  A request to open it again will end up just reusing
- *   the same KFile/KDirectory
- */
-
-struct XToc
-{
-    String base_path;
-    KRefcount refcount;
-    XTocEntry * root;   /* binary search tree full objects of type XTocEntry */
-    BSTree open;        /* opened entries stored in an XTocCache */
-    XTocCache * cache;  /* shortcut to "/" cache entry - not ref counted */
-};
-static char XTocClassname[] = "XToc";
-
-#if _DEBUGGING
-#define DBG_XToc(p) \
-    {   DBGTOC(("XToc: %p\n", (p))); \
-        if (p) {                                                        \
-            DBGTOC(("    base_path: %S\n", &(p)->base_path));           \
-            DBGTOC(("    refcount:  %u\n", *(unsigned*)&(p)->refcount)); \
-            DBGTOC(("    root       %p\n", (p)->root));                 \
-            DBGTOC(("    open       %p\n", *(void**)&(p)->open)); \
-            DBGTOC(("    cache      %p\n", (p)->cache)); \
-            if((p)->root) DBG_XTocEntry((p)->root); \
-            if((p)->cache) DBGXTocCache((p)->cache); }}
-#else
-#define DBG_XToc(p)
-#endif
-
-static
-rc_t XTocDestroy (XToc * self)
-{
-    XTocEntryDestroy (self->root);
-    /* the open tree will be empty for us to get here */
-    free (self);
-    return 0;
-}
-
-
-static
-rc_t XTocAddRef (const XToc * self)
-{
-    if (self)
-        switch (KRefcountAdd (&self->refcount, XTocClassname))
-        {
-        case krefLimit:
-            return RC (rcFS, rcToc, rcAttaching, rcRange, rcExcessive);
-        }
-    return 0;
-}
-
-
-static
-rc_t XTocRelease (const XToc * cself)
-{
-    if (cself)
-    {
-        XToc * self = (XToc*)cself;
-        switch (KRefcountDrop (&self->refcount, XTocClassname))
-        {
-        case krefWhack:
-            XTocDestroy (self);
-        }
-    }
-    return 0;    
-}
-
-
-static
-void XTocCacheDestroy (XTocCache * self)
-{
-    assert (self);
-    BSTreeUnlink (&self->toc->open, &self->node);
-    self->entry->cache = NULL;
-    XTocRelease (self->toc);
-    free (self);
-}
-
-
-static
-rc_t XTocMake (XToc ** pself, const String * base_path)
-{
-    XToc * self;
-    char * pc;
-    rc_t rc;
-
-    assert (pself);
-    assert (base_path);
-
-    self = malloc (sizeof (*self) + StringSize(base_path) + 1);
-    if (self == NULL)
-        return RC (rcFS, rcToc, rcConstructing, rcMemory, rcExhausted);
-
-    pc = (char*)(self+1);
-    memcpy (pc, base_path->addr, StringSize(base_path));
-    pc[StringSize(base_path)] = '\0';
-    StringInit (&self->base_path, pc, StringSize(base_path),
-                StringLength(base_path));
-
-    KRefcountInit (&self->refcount, 1, XTocClassname, "Init", base_path->addr);
-
-    rc = XTocEntryMakeInt (&self->root, "/", NULL, NULL,
-                           (KTime_t)time(NULL), 0);
-    if (rc)
-    {
-        free (self);
-        return rc;
-    }
-    self->root->type = xtoce_root;
-    self->root->container = self->root->root = self->root;
-    
-    BSTreeInit (&self->open);
-
-    *pself = self;
-    return 0;
-}
-
-
-/*--------------------------------------------------------------------------
- * KXTocFile
- *  
- *
- * This type exists only to keep the XToc Open
- */
-struct KXTocFile
-{
-    KFile dad;
-    const KFile * base;
-    XTocCache * cache;
-    XTocEntry * entry;
-    String base_path;
-};
-#if _DEBUGGING
-#define DBG_KXTocFile(p)                             \
-    {   DBGTOC(("  KXTocFile: %p\n", (p)));                               \
-        if (p) {                                                        \
-            DBGTOC(("    dad.vt:            %p\n", (p)->dad.vt));           \
-            DBGTOC(("    dad.file:          %p\n",(p)->dad.dir));           \
-            DBGTOC(("    dad.refcount:      %u\n",*(unsigned*)&(p)->dad.refcount)); \
-            DBGTOC(("    dad.read_enabled:  %u\n",*(unsigned*)&(p)->dad.read_enabled)); \
-            DBGTOC(("    dad.write_enabled: %u\n",*(unsigned*)&(p)->dad.write_enabled)); \
-            DBGTOC(("    base:              %p\n",(p)->base));              \
-            DBGTOC(("    cache:             %p\n",(p)->cache));             \
-            DBGTOC(("    entry:             %p\n",(p)->entry));             \
-            DBGTOC(("    base_path:         %S\n",&(p)->base_path));        \
-            if ((p)->base){                                             \
-                DBGTOC(("      base->vt:            %p\n", (p)->base->vt));       \
-                DBGTOC(("      base->file:          %p\n",(p)->base->dir));       \
-                DBGTOC(("      base->refcount:      %u\n",*(unsigned*)&(p)->base->refcount)); \
-                DBGTOC(("      base->read_enabled:  %u\n",*(unsigned*)&(p)->base->read_enabled)); \
-                DBGTOC(("      base->write_enabled: %u\n",*(unsigned*)&(p)->base->write_enabled)); \
-            }}}
-#else
-#define DBG_KXTocFile(p)
-#endif
-
-/* Destroy
- */
-static
-rc_t KXTocFileDestroy ( KXTocFile *self )
-{
-    assert (self);
-    KFileRelease (self->base);
-    XTocCacheRelease (self->cache);
-    free (self);
-    return 0;
-}
-
-/* GetSysFile
- *  returns an underlying system file object
- *  and starting offset to contiguous region
- *  suitable for memory mapping, or NULL if
- *  no such file is available.
- */
-static
-struct KSysFile *KXTocFileGetSysFile ( const KXTocFile *self, uint64_t *offset )
-{
-#if 1
-    return NULL;
-#else
-    struct KSysfile * sf;
-    uint64_t loffset;
-
-    assert (self);
-    assert (offset);
-
-    sf = KFileGetSysFile (self->base, &loffset);
-    if (sf)
-        *offset = 0;
-    else
-        *offset = loffset + self->entry->u.file.offset;
-    return sf;
-#endif
-}
-
-/* RandomAccess
- *  ALMOST by definition, the file is random access
- *  certain file types ( notably compressors ) will refuse random access
- *
- *  returns 0 if random access, error code otherwise
- */
-static
-rc_t KXTocFileRandomAccess ( const KXTocFile *self )
-{
-    assert (self);
-    return KFileRandomAccess (self->base);
-}
-
-
-/* Type
- *  returns a KFileDesc
- *  not intended to be a content type,
- *  but rather an implementation class
- */
-static
-uint32_t KXTocFileType ( const KXTocFile *self )
-{
-    assert (self);
-    return KFileType (self->base);
-}
-
-
-/* Size
- *  returns size in bytes of file
- *
- *  "size" [ OUT ] - return parameter for file size
- */
-static
-rc_t KXTocFileSize ( const KXTocFile *self, uint64_t *size )
-{
-    assert (self);
-    assert (size);
-    *size = self->entry->u.file.size;
-    return 0;
-}
-
-
-/* SetSize
- *  sets size in bytes of file
- *
- *  "size" [ IN ] - new file size
- */
-static
-rc_t KXTocFileSetSize ( KXTocFile *self, uint64_t size )
-{
-    return RC (rcFS, rcFile, rcUpdating, rcSelf, rcUnsupported);
-}
-
-
-/* Read
- *  read file from known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
- *
- *  "num_read" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually read
- */
-static
-rc_t CC KXTocFileRead ( const KXTocFile *self, uint64_t pos,
-    void *buffer, size_t bsize, size_t *num_read )
-{
-    uint64_t size;
-    uint64_t limit;
-
-    assert (self);
-    assert (buffer);
-    assert (num_read);
-
-    DBG_XTocEntry(self->entry);
-
-    size = self->entry->u.file.size;    /* how big is our portion of the file */
-    if(pos >= size)  {                  /* if past end of file we're done */
-        *num_read = 0;
-        return 0;
-    }
-    limit = pos + bsize;                /* requested limit */
-    if(limit > size) {                  /* if beyond end of file trim it down */
-        limit = size;
-    }
-    return KFileRead (self->base, pos + self->entry->u.file.offset, buffer,
-                      limit - pos, num_read);
-}
-
-
-/* Write
- *  write file at known position
- *
- *  "pos" [ IN ] - starting position within file
- *
- *  "buffer" [ IN ] and "size" [ IN ] - data to be written
- *
- *  "num_writ" [ OUT, NULL OKAY ] - optional return parameter
- *  giving number of bytes actually written
- */
-static
-rc_t KXTocFileWrite ( KXTocFile *self, uint64_t pos,
-    const void *buffer, size_t size, size_t *num_writ)
-{
-    return RC (rcFS, rcFile, rcUpdating, rcSelf, rcUnsupported);
-}
-
-
-/* Make
- *  create a new file object
- *  from file descriptor
- */
-static KFile_vt_v1 vtKXTocFile =
-{
-    /* version 1.1 */
-    1, 1,
-
-    /* start minor version 0 methods */
-    KXTocFileDestroy,
-    KXTocFileGetSysFile,
-    KXTocFileRandomAccess,
-    KXTocFileSize,
-    KXTocFileSetSize,
-    KXTocFileRead,
-    KXTocFileWrite,
-    /* end minor version 0 methods */
-
-    /* start minor version == 1 */
-    KXTocFileType
-    /* end minor version == 1 */
-};
-
-
-static
- rc_t KXTocFileMake (KXTocFile **pself, const KFile * base,
-                     XTocCache * cache, XTocEntry * entry,
-                     const String *path)
-{
-    KXTocFile * self;
-    rc_t rc;
-
-    assert (pself);
-    assert (base);
-    assert (cache);
-    assert (path);
-
-    self = malloc (sizeof (*self) + 1 + StringSize (path));
-    if (self == NULL)
-        rc = RC (rcFS, rcFile, rcConstructing, rcMemory, rcExhausted);
-    else
-    {
-        rc = KFileInit (&self->dad, (const KFile_vt*)&vtKXTocFile, "KXTocFile", "no-name", true, false);
-        if (rc == 0)
-        {
-            rc = KFileAddRef (base);
-            if (rc == 0)
-            {
-                rc = XTocCacheAddRef (cache);
-                if (rc == 0)
-                {
-                    char * pc;
-
-                    pc = (char*)(self+1);
-                    string_copy (pc, StringSize(path), path->addr, StringSize(path));
-                    pc[StringSize(path)] = '\0';
-                    StringInit (&self->base_path, pc, StringSize (path),
-                                StringLength (path));
-                    self->base = base;
-                    self->entry = entry;
-                    self->cache = cache;
-
-                    cache -> file = self;
-
-                    * pself = self;
-                    return 0;
-                }
-
-                KFileRelease ( base );
-            }
-        }
-
-        free ( self );
-    }
-
-    PLOGERR (klogErr, 
-             (klogErr, rc,
-              "Unable to make/open $(F)",
-              "F=%S", path));
-
-    *pself = NULL;
-    return rc;
-}
-
-
-struct KXTocDir
-{
-    KDirectory dad;
-    const KDirectory * base;
-    XToc * toc;
-    XTocCache * cache;    /* owns a reference */
-    XTocEntry * entry;
-    XTocEntry * container;
-    XTocEntry * root;
-    String      base_path;
-};
-
-#if _DEBUGGING
-#define DBG_KXTocDir(p)                                                 \
-    {   if (p)                                                          \
-            DBGTOC(("KXTocDir -   %p\n"                                 \
-                    "   base_path %S\n"                                 \
-                    "   base      %p\n"                                 \
-                    "   cache     %p\n"                                 \
-                    "   entry     %p\n"                                 \
-                    "   container %p\n"                                 \
-                    "   root      %p\n",                                \
-                    p, &p->base_path, p->base, p->cache,                \
-                    p->entry, p->container, p->root));                  \
-        else DBGTOC(("KXTocDir @ NULL\n")); }
-#else
-#define DBG_KXTocDir(p)
-#endif
-/*--------------------------------------------------------------------------
- * XTocListing
- *  a directory listing
- *
- * NOTE:
- * This is nearly identical to KSysDirListing but both are currently private to
- * their compilation units.
- */
-struct XTocListing
-{
-    KNamelist dad;      /* base class */
-    Vector    list;
-    XTocEntry * entry;
-};
-
-
-
-/* ======================================================================
- * shared path routines that really should be their own class
- */
-/* ----------------------------------------------------------------------
- * KXTocDirCanonPath
- *
- * In this context CanonPath means to make the path a pure /x/y/z with no back tracking 
- * by using ~/../~ or redundant ~/./~ or ~//~ here notations.  Not exactly the usage of 
- * canonical in describing a path in other places but consistent within KFS.  It matches
- * the common meaning of canonical path as the one true path except that processing out
- * of sym links isn't done here but would normally have been.  Not processing the 
- * links means potentially more than one canonical path can reach the same target 
- * violating the usual meaning of canonical path as the one true shortest path to any
- * element.
- *
- * const KXTocDir *		self		Object oriented C; KXTocDir object for this method
- * enum RCContext 		ctx
- * char * 			path
- * size_t			psize
- */
-static
-rc_t XTocPathCanonize (char * path, size_t psize)
-{
-    char *	low;	/* a pointer to the root location in path; not changed after initialization */
-    char *	dst;	/* a target reference for compressing a path to remove . and .. references */
-    char *	last;	/* the end of the last processed facet of the path */
-    char *	end;	/* absolute end of the incoming path */
-    char * 	src;	/* the start of the current facet to be processed */
-
-    /* end is the character after the end of the incoming path */
-    end = path + psize;
-
-    /* point all other temp pointers at the root point in the incoming path */
-    last = path;
-
-    /* handle windows / / network path starter */
-    if ((last == path) && (last[0] == '/') && (last[1] == '/'))
-      last ++;
-
-    low = dst = last;
-
-    for (;;)
-    {
-
-	/* point at the first / after the most recent processed facet */
-	src = string_chr (last + 1, end-last-1, '/');
-	if (src == NULL)	/* if no '/' point to the end */
-	    src = end;
-
-	/* detect special sequences */
-	switch (src - last)
-	{
-	case 1: /* / / (with nothing between) is a superflouous / hurting us to parse later;
-		 * /. is a here reference to the same directory as the previous */
-	    if ((last[1] == '/')||(last[1] == '.'))
-	    {
-		/* skip over */
-		last = src;
-		if (src != end)
-		    continue;
-	    }
-	    break;
-	case 2: /* /./ is a "here" reference point and is omitted by not copying it over */
-	    if (last[1] == '.')
-	    {
-		/* skip over */
-		last = src;
-		if (src != end)
-		    continue;
-	    }
-	    break;
-
-	case 3: /* /../ is a up one directory and is processed by deleting the last facet copied */
-	    if (last [1] == '.' && last [2] == '.')
-	    {
-		/* remove previous leaf in path */
-		dst [ 0 ] = 0;
-		dst = string_rchr (path, end-path, '/');
-		/* can't up a directory past the root */
-		if (dst == NULL || dst < low)
-		{
-		    return RC (rcFS, rcDirectory, rcResolving, rcPath, rcInvalid);
-		}
-
-		last = src;
-		if (src != end)
-		    continue;
-	    }
-	    break;
-	}
-
-	/* if rewriting, copy leaf */
-	if (dst != last)
-	{
-	    memmove (dst, last, src - last);
-	}
-
-	/* move destination ahead */
-	dst += src - last;
-        
-	/* if we're done, go */
-	if (src == end)
-	    break;
-
-	/* find next separator */
-	last = src;
-    }
-
-    /* NUL terminate if modified */
-    if (dst != end)
-	* dst = 0;
-
-    /* say we did did it with no problems */
-    return 0;
-}
-
-
-rc_t XTocMakePath (const char ** ppath, bool canon, const char * path, va_list args)
-{
-    char * b;
-    size_t bz;  /* size to allocate */
-    rc_t rc = 0;
-    bool   use_printf;
-
-    assert (ppath);
-    assert (path);
-#if 0
-    DBGTOC(("%s: make path from %s\n", __func__, path));
-#endif
-    b = NULL;
-    bz = string_size (path) + 1;  /* start assuming out is same size as in */
-
-    use_printf = (string_chr (path, bz, '%') != NULL);
-    if (use_printf)
-    {
-        char shortbuff [32];
-        int  pz = vsnprintf (shortbuff, sizeof shortbuff, path, args);
-        if (pz < 0)
-        {
-            rc = RC (rcFS, rcDirectory, rcFormatting, rcPath, rcInvalid);
-            DBGTOC(("%s: invalid path %s\n", __func__, path));
-            LOGERR(klogErr, rc, "Error building XTOC path");
-            return rc;
-        }
-        bz = pz + 1;
-    }
-
-    b = malloc (bz);
-    if (b == NULL)
-        return RC (rcFS, rcDirectory, rcFormatting, rcMemory, rcExhausted);
-
-    if (use_printf)
-    {
-        int pz = vsnprintf (b, bz, path, args);
-        if (pz < 0)
-            rc = RC (rcFS, rcDirectory, rcFormatting, rcPath, rcInvalid);
-        else
-            b[pz] = '\0';
-    }
-    else
-        string_copy (b, bz, path, bz);
-
-    if ((rc == 0) && canon)
-        rc = XTocPathCanonize (b, bz);
-
-    if (rc == 0)
-        *ppath = b;
-    else
-        free (b);
-    return 0;
-}
-
-static char * XTocEntryMakeFullPathRecur (XTocEntry * self, size_t also, 
-                                          char ** phere)
-{
-    char * path;
-    char * here;
-
-    assert (self);
-
-#if 0
-    DBGENTRY(("%s: self %p also %lu  %p\n",__func__,self,also,phere));
-    DBG_XTocEntry(self);
-#endif
-    if (self->type == xtoce_root)
-    {
-        *phere = NULL;
-        path = malloc (2 + also);
-        if (path != NULL)
-        {
-            path[0] = '/';
-            path[1] = '\0';
-            *phere = path;
-        }
-#if 0
-        DBGENTRY (("%s: path %s %p %p\n", __func__, path, path, *phere));
-#endif
-    }
-    else
-    {
-        path = XTocEntryMakeFullPathRecur (self->parent,
-                                           also + 1 + StringSize (&self->name),
-                                           &here);
-        if (path == NULL)
-        {
-            *phere = NULL;
-            return NULL;
-        }
-#if 0
-        DBGENTRY (("%s: path '%s' %p '%s' %p\n",__func__, path, path, here, here));
-#endif
-        here[0] = '/';
-        string_copy (here+1, StringSize (&self->name) + 1,
-                     self->name.addr, StringSize (&self->name));
-        *phere = here + 1 + StringSize (&self->name);
-    }
-    return path;
-}
-
-static
-rc_t XTocEntryMakeFullPath (XTocEntry * self, const char ** pfull)
-{
-    char * ignored;
-    char * full_path;
-#if 0
-    DBGENTRY(("%s: self %p pfull %p\n",__func__,self,pfull));
-#endif
-    assert (pfull);
-    *pfull = NULL;
-    full_path = XTocEntryMakeFullPathRecur (self, 0, &ignored);
-    if (full_path == NULL)
-        return RC (rcFS, rcPath, rcCreating, rcMemory, rcExhausted);
-    *pfull = full_path;
-    return 0;
-}
-
-
-
-/* ======================================================================
- */
-/* ----------------------------------------------------------------------
- * XTocListingDestroy
- * Class destructor
- *
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [INOUT] XTocListing *	self		Listing self reference: object oriented in C
- */
-static
-rc_t CC XTocListingDestroy (XTocListing *self)
-{
-    VectorWhack (&self->list, NULL, NULL);
-    free (self);
-    return 0;
-}
-
-
-/* ----------------------------------------------------------------------
- * XTocListingCount
- *
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [IN]  const XTocListing *	self		Listing self reference: object oriented in C
- * [OUT] uint32_t *		count		Where to put the count of names
- */
-static rc_t CC XTocListingCount (const XTocListing *self, uint32_t *count)
-{
-    *count = VectorLength (&self->list);
-    return 0;
-}
-
-
-/* ----------------------------------------------------------------------
- * XTocListingGet
- *
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [IN]  const XTocListing *	self		Listing self reference: object oriented in C
- * [IN]  uint32_t		idx		?
- * [OUT] const char **		name		Where to put the name
- */
-static rc_t CC XTocListingGet (const XTocListing *self, uint32_t idx, const char **name)
-{
-    uint32_t count;
-    rc_t rc;
-
-    rc = XTocListingCount(self, &count);
-    if (rc == 0)
-    {
-        if (idx >= count)
-            return RC (rcFS, rcNamelist, rcAccessing, rcParam, rcExcessive);
-        *name = VectorGet (&self->list, idx);
-    }
-    return 0;
-}
-
-
-/* ----------------------------------------------------------------------
- * XTocListingSort
- *
- * This function has the signature needed to use with the NameList base class for
- * XTocListings to determine the order of two names.  Matches the signature of
- * strcmp() and other functions suitable for use by qsort() and others
- *
- * [RET] int					0:  if a == b 
- *						<0: if a < b
- *						>0: if a > b
- * [IN] const void *		a
- * [IN] const void *		b
- *
- * Elements are typed as const void * to match the signature needed for 
- * a call to qsort() but they should be pointers to namelist elements
- */
-#if NOT_YET
-static int CC XTocListingSort (const void *a, const void *b, void * ignored)
-{
-    return strcmp (*(const char**)a, *(const char**)b);
-}
-#endif
-static KNamelist_vt_v1 vtXTocListing =
-{
-    /* version 1.0 */
-    1, 0,
-
-    /* start minor version 0 methods */
-    XTocListingDestroy,
-    XTocListingCount,
-    XTocListingGet
-    /* end minor version 0 methods */
-};
-
-
-/* ----------------------------------------------------------------------
- * XTocListingInit
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [INOUT] XTocListing *	self		Listing self reference: object oriented in C
- * [IN]    const char *		path		?
- * [IN]    const KDirectory *	dir		?
- * [IN]    bool (* 		f	)(const KDirectory*, const char*, void*),
- *						This is a filter function - any listing element
- *						passed to this function will generate a true ot
- *						a false.  If false that listing element is dropped.
- *						If this parameter is NULL all elements are kept.
- * [IN]	   void *		data		Ignored.  May use NULL if permitted
- *						by 'f'.
- */
-struct XTocListingInitData
-{
-    Vector * v;
-    rc_t rc;
-};
-static
-void CC XTocListingAdd (BSTNode * n_, void * data_)
-{
-    struct XTocListingInitData * data = data_;
-    const XTocEntry * n = (const XTocEntry *)n_;
-
-    if (data->rc == 0)
-    {
-        data->rc = VectorAppend (data->v, NULL, n->name.addr);
-    }
-}
-
-
-rc_t XTocListingMake (XTocListing ** pself, XTocEntry * entry,
-                      bool (CC* f) (const KDirectory*, const char*, void*),
-                      void *data)
-{
-    XTocListing * self;
-    BSTree * tree;
-    rc_t rc;
-
-    /* is self parameter possibly NULL? */
-    if (pself == NULL)
-    {
-	return  RC (rcFS, rcDirectory, rcConstructing, rcSelf, rcNull);
-    }
-    *pself = NULL;
-
-    self = malloc (sizeof (*self));
-    if (self == NULL)
-        return RC (rcFS, rcListing, rcConstructing, rcMemory, rcExhausted);
-
-    switch (entry->type)
-    {
-    default:
-        return RC (rcFS, rcDirectory, rcConstructing, rcListing, rcIncorrect);
-
-    case xtoce_file:
-    case xtoce_dir:
-        tree = &entry->tree;
-        break;
-    }
-
-    /* start with an empty name list */
-    VectorInit (&self->list, 0, 16);
-
-    /* initialize the Namelist base class */
-    if ((rc = KNamelistInit (& self -> dad,
-			     (const KNamelist_vt*)&vtXTocListing)) == 0)
-    {
-        struct XTocListingInitData data;
-
-        data.v = &self->list;
-        data.rc = 0;
-
-        BSTreeForEach (tree, false, XTocListingAdd, &data);
-
-        rc = data.rc;
-    }
-    if (rc == 0)
-        *pself = self;
-    return rc;
-}
-
-
-static
-rc_t XTocFindXTocCache (XToc * self, XTocCache ** pcache,
-                        const String * spath)
-{
-    XTocCache * cache;
-    assert (self);
-    assert (pcache);
-    assert (spath);
-
-    DBGTOC(("%s: self %p pcache %p spath %S\n",__func__,self,pcache,spath));
-    cache = (XTocCache*)BSTreeFind (&self->open, spath, XTocCacheCmp);
-    DBGTOC(("%s: found cache %p\n",__func__,cache));
-    *pcache = cache;
-    return cache ? 0 : RC (rcFS, rcToc, rcSearching, rcNode, rcNotFound);
-}
-
-
-static
-rc_t XTocMakeXTocCache (XToc * self, XTocCache ** pcache,
-                        String * path, XTocEntry * entry)
-{
-    XTocCache * cache;
-    rc_t rc;
-
-    assert (self);
-    assert (pcache);
-    assert (path);
-
-/*     DBGTOC(("%s: %S\n",path)); */
-    *pcache = NULL;
-    rc = XTocCacheMake (&cache, path, self, entry);
-    if (rc)
-        PLOGERR (klogErr,
-                 (klogErr, rc, "error creating cache entry for $(P)",
-                  "P=%S", path));
-    else
-    {
-        union
-        {
-            BSTNode * b;
-            XTocCache * x;
-        } exist;
-        DBGTOC(("%s: insert cache\n",__func__));
-        rc = BSTreeInsertUnique (&self->open, &cache->node, &exist.b, XTocCacheSort);
-        if (rc)
-            PLOGERR (klogErr,
-                     (klogErr, rc, "error inserting cache entry for $(P)",
-                      "P=%S", path));
-        else
-        {
-            *pcache = entry->cache = cache;
-            return 0;
-        }
-        XTocCacheDestroy (cache);
-    }
-    return rc;
-}
-
-
-static
-rc_t XTocDirGetCache (const KXTocDir * self, const char * path_, XTocCache ** pcache)
-{
-    const char * path;  /* absolute canonical path in ASCIZ */
-    String spath;       /* absolute canonical path as a String */
-    XTocEntry * entry;  /* toc entry for the path */
-    XTocCache * cache;  /* cache entry for the path */
-    rc_t rc;
-
-    assert (self);
-    assert (path_);
-    assert (pcache);
-
-    DBGCACHE(("%s: Get cache node for %s\n", __func__, path_));
-
-    /* assume not found or errors */
-    *pcache = NULL;
-
-    /* first resolve the path to an entry node */
-    rc = XTocEntryResolvePath (self->entry, path_, true, &entry);
-    DBGCACHE (("%s: path resolved\n",__func__));
-    if (rc)
-    {
-        PLOGERR (klogErr, 
-                 (klogErr, rc, "Unable to resolve path $(P)",
-                  "P=%s", path_));
-        return rc;
-    }
-
-    DBGCACHE(("%s: entry  %p\n",__func__,entry));
-
-    /* now create a actual canonical path from the root to the located entry
-     * the incoming path could have had symbolic links or the like so we're
-     * making it a single non-ambiguous version
-     */
-    rc = XTocEntryMakeFullPath (entry, &path);
-    if (rc)
-    {
-        PLOGERR (klogErr, 
-                 (klogErr, rc, "Unable to build full path for $(P)",
-                  "P=%s", path_));
-        return rc;
-    }
-
-    /* make a String version as that is what the cache holds */
-    StringInitCString (&spath, path);
-    DBGCACHE(("%s: made full path %S %s\n",__func__,&spath,path));
-
-    /* see if it's already open */
-
-    rc = XTocFindXTocCache (self->toc, &cache, &spath);
-    if (rc == 0)
-    {
-        DBGCACHE(("%s: found an existing cache node for %S\n",__func__,&spath));
-        XTocCacheAddRef (cache);
-    }
-    else
-    {
-        DBGCACHE(("%s: did not find an existing cache node for %S\n",__func__,&spath));
-        /* not found is not an error condition */
-        if (GetRCState(rc) == rcNotFound)
-        {
-            /* not found so make one */
-            rc = XTocMakeXTocCache (self->toc, &cache, &spath, entry);
-            DBGCACHE(("%s: made a cache node %p\n",__func__,cache));
-        }
-    }
-    /* for rc to be 0 here we either found or created a cache node
-     * we will have an ownership apassed to the caller
-     */
-    if (rc == 0)
-        *pcache = cache;
-    /* free allocated path in a buffer */
-    free ((void*)path);
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * KXTocDirDestroy
- */
-static
-rc_t CC KXTocDirDestroy (KXTocDir *self)
-{
-    assert (self);
-
-    XTocCacheRelease (self->cache);
-    KDirectoryRelease (self->base);
-    free (self);
-    return 0;
-}
-
-
-
-
-/* ----------------------------------------------------------------------
- * KXTocDirList
- *  create a directory listing
- *
- *  "list" [ OUT ] - return parameter for list object
- *
- *  "path" [ IN, NULL OKAY ] - optional parameter for target
- *  directory. if NULL, interpreted to mean "."
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [IN]	 const KXTocDir *	self		Object oriented C; KXTocDir object for this method
- * [OUT] KNamelist **		listp,
- * [IN]  bool (* 		f	)(const KDirectory*,const char *, void *)
- * [IN]  void *			data
- * [IN]  const char *		path
- * [IN]  va_list		args
- */
-static
-rc_t CC KXTocDirList (const KXTocDir *self,
-                     KNamelist **listp,
-                     bool (CC* f) (const KDirectory *dir, const char *name, void *data),
-                     void *data,
-                     const char *path_,
-                     va_list args)
-{
-    const char * path;
-    rc_t rc;
-
-    if (path_ == NULL)
-        path_ = "/";
-
-    rc = XTocMakePath (&path, true, path_, args);
-    if (rc == 0)
-    {
-        struct XTocEntry * node;
-
-        rc = XTocEntryResolvePath (self->entry->root, path, true, &node);
-        if (rc == 0)
-        {
-            rc = XTocListingMake ((struct XTocListing **)listp, node, f, data);
-        }
-        free ((void*)path);
-    }
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * KXTocDirPathType
- *  returns a KPathType
- *
- *  "path" [ IN ] - NUL terminated string in directory-native character set
- *
- * [RET] uint32_t
- * [IN]  const KXTocDir *	self		Object oriented C; KXTocDir object for this method
- * [IN]  const char *		path
- * [IN]  va_list		args
- */
-static KPathType CC KXTocDirPathType (const KXTocDir *self, const char *path_, va_list args)
-{
-    const char * path;
-    rc_t rc;
-    KPathType type = kptBadPath;
-
-    rc = XTocMakePath (&path, true, path_, args);
-    if (rc == 0)
-    {
-        type = XTocEntryPathType (self->cache->entry->root, path);
-        free ((void*)path);
-    }
-    return type;
-}
-
-
-/* ----------------------------------------------------------------------
- * KXTocDirRelativePath
- *
- * KXTocDirRelativePath
- *  makes "path" relative to "root"
- *  both "root" and "path" MUST be absolute
- *  both "root" and "path" MUST be canonical, i.e. have no "//", "/./" or "/../" sequences
- *
- * [RET] rc_t					0 for success; anything else for a failure
- *						see itf/klib/rc.h for general details
- * [IN] const KXTocDir *		self		Object oriented C; KXTocDir object for this method
- * [IN] enum RCContext 		ctx
- * [IN] const char *		root
- * [IN] char *			path
- * [IN] size_t			path_max
- */
-#if not_USED
-static
-rc_t KXTocDirRelativePath (const KXTocDir *self, enum RCContext ctx,
-                           const char *root, char *path, size_t path_max)
-{
-#if 1
-    return -1;
-#else
-    int backup;
-    size_t bsize, psize;
-    size_t size;
-
-    const char *r = root + self -> root;
-    const char *p = path + self -> root;
-
-    assert (r != NULL && r [ 0 ] == '/');
-    assert (p != NULL && p [ 0 ] == '/');
-
-    for (; * r == * p; ++ r, ++ p)
-    {
-	/* disallow identical paths */
-	if (* r == 0)
-	    return RC (rcFS, rcDirectory, ctx, rcPath, rcInvalid);
-    }
-
-    /* paths are identical up to "r","p"
-       if "r" is within a leaf name, then no backup is needed
-       by counting every '/' from "r" to end, obtain backup count */
-    for (backup = 0; * r != 0; ++ r)
-    {
-	if (* r == '/')
-	    ++ backup;
-    }
-
-    /* the number of bytes to be inserted */
-    bsize = backup * 3;
-
-    /* align "p" to last directory separator */
-    while (p [ -1 ] != '/') -- p;
-
-    /* the size of the remaining relative path */
-    psize = string_measure(p, &size);
-
-    /* open up space if needed */
-    if ( (size_t)(p - path) < bsize )
-    {
-	/* prevent overflow */
-	if (bsize + psize >= path_max)
-	    return RC (rcFS, rcDirectory, ctx, rcPath, rcExcessive);
-	memmove (path + bsize, p, psize);
-    }
-
-    /* insert backup sequences */
-    for (bsize = 0; backup > 0; bsize += 3, -- backup)
-	memcpy (& path [ bsize ], "../", 3);
-
-    /* close gap */
-    if ( (size_t)( p - path ) > bsize )
-	{
-        size_t size;
-		string_copy (& path [ bsize ], path_max - bsize, p, measure_string(p, &size));
-	}
-
-	return 0;
-#endif
-}
-#endif
-
-/* ----------------------------------------------------------------------
- * KXTocDirVisit
- *  visit each path under designated directory,
- *  recursively if so indicated
- *
- *  "recurse" [ IN ] - if non-zero, recursively visit sub-directories
- *
- *  "f" [ IN ] and "data" [ IN, OPAQUE ] - function to execute
- *  on each path. receives a base directory and relative path
- *  for each entry, where each path is also given the leaf name
- *  for convenience. if "f" returns non-zero, the iteration will
- *  terminate and that value will be returned. NB - "dir" will not
- *  be the same as "self".
- *
- *  "path" [ IN ] - NUL terminated string in directory-native character set
- */
-/* ----------------------------------------------------------------------
- * KXTocDirVisitDir
- *
- * [IN] KXTocDirVisitData *	pb
- */
-#if NOT_YET
-typedef struct KXTocDirVisitData
-{
-    int nada;
-} KXTocDirVisitData;
-static
-rc_t KXTocDirVisitDir(KXTocDirVisitData *pb)
-{
-    return -1;
-}
-#endif
-static 
-rc_t CC KXTocDirVisit (const KXTocDir *self, 
-                      bool recurse,
-                      rc_t (CC* f) (const KDirectory *, uint32_t, const char *, void *), 
-                      void *data,
-                      const char *path,
-                      va_list args)
-{
-#if 1
-    return RC (rcFS, rcDirectory, rcVisiting, rcSelf, rcUnsupported);
-#else
-    char * full_path;
-    rc_t   rc;
-
-    if (path == NULL)
-        path = "/";
-
-    /* -----
-     * First fix the path to make it useable
-     */
-    rc = KXTocDirMakePath (self, rcVisiting, true, &full_path, path, args);
-    if (rc != 0)
-    {
-	LOGERR (klogInt, rc, "failed to make path in Visit");
-    }
-    else
-    {
-	const XTocEntry * pnode;
-
-	/* -----
-	 * Now find that path as a node and validate it is a directory
-	 */
-	rc = KXTocEntryResolvePath (&self->toc->root, full_path, true, &pnode);
-	if (rc != 0)
-	{
-	    PLOGERR (klogInt, (klogInt, rc, "failed to resolve path $(P) in Visit", "P=%s", full_path));
-	}
-	else
-	{
-            switch (pnode->type)
-            {
-            case xtoce_file:
-                if (pnode->u.file.has_tree)
-                    break;
-            default:
-                rc = RC (rcFS, rcDirectory, rcVisiting, rcPath, rcInvalid);
-                break;
-            case xtoce_dir:
-                break;
-            }
-
-            if (rc == 0)
-            {
-                size_t size;
-		KXTocDir * full_dir;
-		uint32_t path_size;
-
-		/* -----
-		 * make a locally accessible private KDirectory/KXTocDir
-		 */
-		for ( path_size = (uint32_t)string_measure( full_path, &size );
-		      ( path_size > self->root ) && ( full_path[ path_size - 1 ] == '/' );
-		      -- path_size )
-		{}
-		rc = KXTocDirMake (&full_dir, 
-				  rcVisiting,
-				  self->parent,
-				  self->toc,
-				  pnode,
-				  self->archive.v,
-				  self->arctype,
-				  self->root,
-				  full_path,
-				  path_size, 
-				  true,
-				  false);
-		if (rc == 0)
-		{
-		    KXTocDirVisitData pb;
-
-		    pb.f = f;
-		    pb.data = data;
-		    pb.dir = full_dir;
-		    pb.recurse = recurse;
-/*		    pb.dir.path[--pb.dir.size] = 0; */
-
-		    rc = KXTocDirVisitDir (&pb);
-
-		    KXTocDirDestroy (full_dir);
-		}
-	    }
-	    else
-	    {
-		rc = RC (rcFS, rcDirectory, rcVisiting, rcPath, rcIncorrect);
-		LOGERR (klogInt, rc, "Type is not a directory");
-	    }
-	}
-	free (full_path);
-    }
-    return rc;
-#endif
-}
-
-/* ----------------------------------------------------------------------
- * KXTocDirVisitUpdate
- */
-static rc_t CC KXTocDirVisitUpdate (KXTocDir *self,
-                                   bool recurse,
-                                   rc_t (CC*f) (KDirectory *,uint32_t,const char *,void *),
-                                   void *data,
-                                   const char *path,
-                                   va_list args)
-{
-    return RC (rcFS, rcDirectory, rcUpdating, rcSelf, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * KXTocDirResolvePath
- *
- *  resolves path to an absolute or directory-relative path
- *
- * [IN]  const KXTocDir *self		Objected oriented self
- * [IN]	 bool 		absolute	if non-zero, always give a path starting
- *  					with '/'. NB - if the directory is 
- *					chroot'd, the absolute path
- *					will still be relative to directory root.
- * [OUT] char *		resolved	buffer for NUL terminated result path in 
- *					directory-native character set
- * [IN]	 size_t		rsize		limiting size of resolved buffer
- * [IN]  const char *	path		NUL terminated string in directory-native
- *					character set denoting target path. 
- *					NB - need not exist.
- */
-static rc_t CC KXTocDirResolvePath (const KXTocDir *self,
-                                   bool absolute,
-                                   char *resolved,
-                                   size_t rsize,
-                                   const char *path_,
-                                   va_list args)
-{
-    rc_t rc;
-    const char * path;
-
-    KOutMsg ("+++++\n%s: absolute %d\n", __func__, absolute);
-
-    assert (self);
-    assert (resolved);
-    assert (path_);
-
-    *resolved = '\0';
-    rc = XTocMakePath (&path, false, path_, args);
-    KOutMsg ("%s: rc %R new '%s' old '%s'\n", __func__, rc, path, path_);
-    if (rc != 0)
-    {
-        PLOGERR (klogErr,
-                 (klogErr, rc, "Error building path based on $(P)", "P=%s", path_));
-    }
-    else
-    {
-        size_t path_sz = string_size(path);
-
-        if (absolute)
-        {
-            XTocEntry * entry;
-
-            rc = XTocEntryResolvePath (self->entry, path, false, &entry);
-
-            if (rc)
-                PLOGERR (klogErr,
-                         (klogErr, rc, "Error resolving path based on $(P)", "P=%s", path_));
-            else
-            {
-                free ((void*)path);
-                path = NULL;
-                rc = XTocEntryMakeFullPath (entry, &path);
-                if (rc == 0)
-                {
-                    size_t k = self->toc->base_path.size;
-                    if (k > 1)
-                    {
-                        memcpy (resolved, self->toc->base_path.addr, k);
-                        resolved += k;
-                        rsize -= k;
-                    }
-                }
-            }
-        }
-        if (rc == 0)
-        {
-            if (rsize < (path_sz - 1))
-                rc = RC(rcFS, rcDirectory, rcResolving, rcBuffer, rcInsufficient);
-            else
-                string_copy(resolved, rsize, path, path_sz);
-        }
-        if (path)
-            free ((void*)path);
-    }
-    return rc;
-}
-
-/* ----------------------------------------------------------------------
- * KXTocDirResolveAlias
- *  resolves an alias path to its immediate target
- *  NB - the resolved path may be yet another alias
- *
- *  "alias" [ IN ] - NUL terminated string in directory-native
- *  character set denoting an object presumed to be an alias.
- *
- *  "resolved" [ OUT ] and "rsize" [ IN ] - buffer for
- *  NUL terminated result path in directory-native character set
- *
- * NOTE: Does not meet a design target of on stack (localized variable) allocation of single 4kb path
- */
-static rc_t CC KXTocDirResolveAlias (const KXTocDir * self, 
-				 bool absolute,
-				 char * resolved,
-				 size_t rsize,
-				 const char *path_,
-				 va_list args)
-{
-#if 0
-    return -1;
-#else
-    rc_t rc;
-    const char * path;
-
-    assert (self);
-    assert (resolved);
-    assert (path_);
-
-    *resolved = '\0';
-    rc = XTocMakePath (&path, false, path_, args);
-    if (rc != 0)
-    {
-        PLOGERR (klogErr,
-                 (klogErr, rc, "Error building path based on $(P)", "P=%s", path_));
-    }
-    else
-    {
-        XTocEntry * entry;
-
-        rc = XTocEntryResolvePath (self->entry, path, true , &entry);
-        if (rc)
-            PLOGERR (klogErr,
-                     (klogErr, rc, "Error resolving path based on $(P)", "P=%s", path_));
-        else
-        {
-            free ((void*)path);
-            path = NULL;
-            rc = XTocEntryMakeFullPath (entry, &path);
-        }
-    }
-
-/* THIS IS WRONG!
- * this is the absolute path not the relative one
- */
-    if (rc == 0)
-        string_copy (resolved, rsize, path, string_size (path));
-    
-    if (path)
-        free ((void*)path);
-
-    return rc;
-#endif
-}
-
-/* ----------------------------------------------------------------------
- * KXTocDirRename
- *  rename an object accessible from directory, replacing
- *  any existing target object of the same type
- *
- *  "from" [ IN ] - NUL terminated string in directory-native
- *  character set denoting existing object
- *
- *  "to" [ IN ] - NUL terminated string in directory-native
- *  character set denoting existing object
- */
-static
-rc_t CC KXTocDirRename (KXTocDir *self, bool force, const char *from, const char *to)
-{
-    assert (self != NULL);
-    assert (from != NULL);
-    assert (to != NULL);
-
-    return RC (rcFS, rcArc, rcUpdating, rcSelf, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * KXTocDirRemove
- *  remove an accessible object from its directory
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- *
- *  "force" [ IN ] - if non-zero and target is a directory,
- *  remove recursively
- */
-static
-rc_t CC KXTocDirRemove (KXTocDir *self, bool force, const char *path, va_list args)
-{
-    assert (self != NULL);
-    assert (path != NULL);
-
-    return RC (rcFS, rcArc, rcUpdating, rcSelf, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * KXTocDirClearDir
- *  remove all directory contents
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target directory
- *
- *  "force" [ IN ] - if non-zero and directory entry is a
- *  sub-directory, remove recursively
- */
-static
-rc_t CC KXTocDirClearDir (KXTocDir *self, bool force, const char *path, va_list args)
-{
-    assert (self != NULL);
-    assert (path != NULL);
-
-    return RC (rcFS, rcArc, rcUpdating, rcSelf, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * KXTocDirAccess
- *  get access to object
- *
- *  "access" [ OUT ] - return parameter for Unix access mode
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- */
-static rc_t CC KXTocDirVAccess (const KXTocDir *self,
-			    uint32_t *access,
-			    const char *path_,
-			    va_list args)
-{
-#if 1
-    return -1;
-#else
-    char * path;
-    rc_t rc;
-
-    if (path_ == NULL)
-        path_ = "/";
-
-    rc = KXTocDirMakePath (self, rcAccessing, true, &path, path_, args);
-    if (rc == 0)
-    {
-        XTocEntry * node;
-
-        rc = XTocEntryResolvePath (&self->toc->root, path, true, &node);
-
-
-    const KTocEntry *	entry;
-    rc_t 		rc;
-    uint32_t		acc;
-    KTocEntryType	type;
-    char * 		full;
-
-    assert (self != NULL);
-    assert (access != NULL);
-    assert (path != NULL);
-
-    /* -----
-     * by C standard the nested ifs (if A { if B { if C ... could have been if A && B && C
-     */
-    if ((rc = KXTocDirMakePath (self, rcAccessing, false, &full, path, args)) == 0)
-    {
-	if ((rc = KXTocDirResolvePathNode (self, rcAccessing, path, true, &entry, &type)) == 0)
-	{
-	    if ((rc = KTocEntryGetAccess (entry, &acc)) == 0)
-	    {
-                /*
-                 * We want to filter the access because within an Archive
-                 * a file is unwritable
-                 */
-		*access = acc & ~(S_IWRITE|S_IWGRP|S_IWOTH);
-		rc = 0;
-	    }
-	}
-    }
-    if (full != NULL)
-	free (full);
-    return rc;
-#endif
-}
-
-/* ----------------------------------------------------------------------
- * KXTocDirSetAccess
- *  set access to object a la Unix "chmod"
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- *
- *  "access" [ IN ] and "mask" [ IN ] - definition of change
- *  where "access" contains new bit values and "mask defines
- *  which bits should be changed.
- *
- *  "recurse" [ IN ] - if non zero and "path" is a directory,
- *  apply changes recursively.
- */
-static rc_t CC KXTocDirSetAccess (KXTocDir *self,
-			      bool recurse,
-			      uint32_t access,
-			      uint32_t mask,
-			      const char *path,
-			      va_list args)
-{
-    assert (self != NULL);
-    assert (path != NULL);
-
-    return RC (rcFS, rcArc, rcUpdating, rcSelf, rcUnsupported);
-}
-
-
-static	rc_t CC KXTocDirVDate		(const KXTocDir *self,
-					 KTime_t *date,
-					 const char *path_,
-					 va_list args)
-{
-    const char * path;
-    rc_t rc;
-
-    assert (self);
-    assert (date);
-    assert (path_);
-
-    *date = 0;
-    path = NULL;
-    rc = XTocMakePath (&path, false, path_, args);
-    if (rc)
-        PLOGERR (klogErr,
-                 (klogErr, rc, "Error resolving path from $(P)", "P=%s", path_));
-    else
-    {
-        XTocEntry * entry;
-        rc = XTocEntryResolvePath (self->entry, path, false, &entry);
-        if (rc)
-            PLOGERR (klogErr,
-                     (klogErr, rc, "Error resolving path from $(P)", "P=%s", path_));
-        else
-            *date = entry->mtime;
-        free ((void*)path);
-    }
-    return rc;
-}
-
-static	rc_t CC KXTocDirSetDate		(KXTocDir *self,
-					 bool recurse,
-					 KTime_t date,
-					 const char *path,
-					 va_list args)
-{
-    assert (self != NULL);
-    assert (path != NULL);
-
-    return RC (rcFS, rcArc, rcUpdating, rcSelf, rcUnsupported);
-}
-
-static
-struct KSysDir *CC KXTocDirGetSysDir ( const KXTocDir *self )
-{
-    return NULL;
-}
-
-/* ----------------------------------------------------------------------
- * KXTocDirCreateAlias
- *  creates a path alias according to create mode
- *
- *  "targ" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- *
- *  "alias" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target alias
- *
- *  "access" [ IN ] - standard Unix directory access mode
- *  used when "mode" has kcmParents set and alias path does
- *  not exist.
- *
- *  "mode" [ IN ] - a creation mode (see explanation above).
- */
-static
-rc_t CC KXTocDirCreateAlias (KXTocDir *self,
-			 uint32_t access,
-			 KCreateMode mode,
-			 const char *targ,
-			 const char *alias)
-{
-    assert (self != NULL);
-    assert (targ != NULL);
-    assert (alias != NULL);
-
-    return RC (rcFS, rcArc, rcCreating, rcSelf, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * KXTocDirOpenFileRead
- *  opens an existing file with read-only access
- *
- *  "f" [ OUT ] - return parameter for newly opened file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- * NOTE: Does not meet a design target of on stack (localized variable) allocation of single 4kb path
- */
-static
-rc_t  KXTocDirOpenFileReadInt	(const KXTocDir *self,
-                                 const KXTocFile **f,
-                                 const char *path)
-{
-    XTocCache * cache;
-    rc_t rc;
-
-    DBGTOC (("%s: Opening %s\n", __func__, path));
-    /* resolve path to a cache entry - one will be created if it did not yet exist */
-    rc = XTocDirGetCache (self, path, &cache);
-    DBGTOC(("%s: got cache %p\n",__func__,cache));
-    if (rc == 0)
-    {
-        /* if the file is already open this is easiest */
-        if (cache->file)
-        {
-            DBGTOC(("%s: found open\n",__func__));
-            rc = KFileAddRef (&cache->file->dad);
-            if (rc)
-                *f = cache->file;
-        }
-        else
-        {
-            do
-            {
-                const KFile * bfile = NULL;     /* base file for this new KXTocFile */
-                XTocEntry * entry;
-
-                entry = cache->entry;
-
-                /* next easiest is files not in a container or archive
-                 * the base file will be a KSysFile (most likely) */
-                if (entry->container == entry->root)
-                {
-                    DBGTOC(("%s: NOT in a container or archive\n",__func__));
-                    rc = KDirectoryOpenFileRead (((const KXTocDir*)self->toc->cache->dir)->base,
-                                                 &bfile, path);
-                }
-                else do
-                {
-                    /* more difficult is a file inside a compressed container
-                     * or an archive container */
-                    const KXTocFile * cfile;    /* container's KXTocFile */
-                    XTocCache * ccache;
-
-                    DBGTOC(("%s: in a container or archive\n",__func__));
-                    ccache = entry->container->cache;
-
-                    /* is the container open? */
-                    if (ccache)
-                    {
-                        /* was the container open but not the file?
-                         * not sure if this is possible */
-                        if (ccache->file == NULL)
-                        {
-                            rc = KXTocDirOpenFileReadInt (self->toc->cache->dir, 
-                                                          &cfile, 
-                                                          ccache->path.addr);
-                            if (rc)
-                                break;
-                        }
-                        else
-                            cfile = ccache->file;
-                    }
-                    /* else the container was not yet open */
-                    else
-                    {
-                        /* build the conatiner's path */
-                        const char * cpath;
-                        rc = XTocEntryMakeFullPath (entry->container, &cpath);
-                        if (rc)
-                            break;
-                        else
-                        {
-                            /* now open the container's KXTocFile */
-                            rc = KXTocDirOpenFileReadInt (self->toc->cache->dir, &cfile, cpath);
-                            free ((void*)cpath);
-                            if (rc)
-                                break;
-                        }                        
-                    }
-
-                    /* we should now have an opened container file
-                     * it might be our base file or the source for our base */
-                    DBGTOC(("%s: we have a container file %p\n", __func__, cfile));
-                    DBG_KXTocFile (cfile);
-                    
-                    if (entry->container->u.file.archive) /* extracting from an archive file */
-                    {
-                        /* base file is the container file for an archive */
-                        bfile = &cfile->dad;
-                            DBGTOC(("%s: archive file set cfile %p bfile %p\n",
-                                    __func__, cfile, bfile));
-                    }
-                    else if (entry->container->u.file.container) /* extracting from a compressed file */
-                    {
-                        /* the base file is built from the container's file via decompression */
-                        if (strcmp (entry->container->u.file.filetype.addr, "Compressed/GnuZip") == 0)
-                        {
-                            rc = KFileMakeGzipForRead (&bfile, &cfile->dad);
-                        }
-                        else if (strcmp (entry->container->u.file.filetype.addr, "Compressed/Bzip") == 0)
-                        {
-                            rc = KFileMakeBzip2ForRead (&bfile, &cfile->dad);
-                        }
-                        else
-                        {
-                            DBGTOC(("%s: unsupported %s %s\n",__func__, cfile, 
-                                    entry->container->u.file.filetype.addr));
-                            LOGERR (klogErr, rc, "Unsupported compression type");
-                            rc = RC (rcFS, rcToc, rcOpening, rcToc, rcUnsupported);
-                        }
-                        if (rc == 0)
-                        {
-                            /* release the container file leaving only the
-                             * decompressed file owning it */
-                            KFileRelease (&cfile->dad);
-                            DBGTOC(("%s: container file created cfile %p bfile %p\n",
-                                    __func__, cfile, bfile));
-                        }
-                    }
-                    else
-                        rc = RC (rcFS, rcToc, rcOpening, rcToc, rcCorrupt);
-                }  while (0);
-                if (rc == 0)
-                {
-                    /* now we have a base file for our XTocFile */
-                    String spath;
-                    KXTocFile * xfile;
-                    StringInitCString (&spath, path);
-                    rc = KXTocFileMake (&xfile, bfile, cache, entry, &spath);
-                    DBGTOC(("%s: we have a new KXTocFile file %p bfile %p)\n", __func__, xfile, bfile));
-                    DBG_KXTocFile(xfile);
-                    if (rc == 0)
-                        *f = xfile;
-                }
-                KFileRelease (bfile);
-            } while (0);
-        }
-        XTocCacheRelease (cache);
-    }
-    return rc;
-}
-
-
-static
-rc_t CC KXTocDirOpenFileRead	(const KXTocDir *self,
-                                 const KFile **f,
-                                 const char *path_,
-                                 va_list args)
-{
-    const char * path;
-    rc_t rc;
-
-    assert (self);
-    assert (f);
-    assert (path_);
-
-    DBGTOC (("%s: open %s\n", __func__, path_));
-
-    /* make sure we'll write something to the output pointer */
-    *f = NULL;
-
-    /* build path from format and arguments or just the format that is a path in and of itself */
-    rc = XTocMakePath (&path, true, path_, args);
-    if (rc)
-    {
-        PLOGERR (klogErr,
-                 (klogErr, rc, "Error opening file $(P)", "P=%s", path_));
-    }
-    else
-        rc = KXTocDirOpenFileReadInt (self, (const KXTocFile**)f, path);
-    free ((void*)path);
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * KXTocDirOpenFileWrite
- *  opens an existing file with write access
- *
- *  "f" [ OUT ] - return parameter for newly opened file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- *
- *  "update" [ IN ] - if non-zero, open in read/write mode
- *  otherwise, open in write-only mode
- */
-static
-rc_t CC KXTocDirOpenFileWrite	(KXTocDir *self,
-					 KFile **f,
-					 bool update,
-					 const char *path,
-					 va_list args)
-{
-    assert (self != NULL);
-    assert (f != NULL);
-    assert (path != NULL);
-
-    return RC (rcFS, rcArc, rcCreating, rcSelf, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * KXTocDirCreateFile
- *  opens a file with write access
- *
- *  "f" [ OUT ] - return parameter for newly opened file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- *
- *  "access" [ IN ] - standard Unix access mode, e.g. 0664
- *
- *  "update" [ IN ] - if non-zero, open in read/write mode
- *  otherwise, open in write-only mode
- *
- *  "mode" [ IN ] - a creation mode (see explanation above).
- */
-static
-rc_t CC KXTocDirCreateFile	(KXTocDir *self,
-					 KFile **f,
-					 bool update,
-					 uint32_t access,
-					 KCreateMode cmode,
-					 const char *path,
-					 va_list args)
-{
-    assert (self != NULL);
-    assert (f != NULL);
-    assert (path != NULL);
-
-    return RC (rcFS, rcArc, rcCreating, rcSelf, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * KXTocDirFileLocator
- *  returns locator in bytes of target file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- *
- *  "locator" [ OUT ] - return parameter for file locator
- * NOTE: Does not meet a design target of on stack (localized variable) allocation of single 4kb path
- */
-static
-rc_t CC KXTocDirFileLocator		(const KXTocDir *self,
-					 uint64_t *locator,
-					 const char *path_,
-					 va_list args)
-{
-    const char * path;
-    rc_t rc;
-
-    assert (self);
-    assert (locator);
-    assert (path_);
-
-    *locator = 0;
-    path = NULL;
-    rc = XTocMakePath (&path, false, path_, args);
-    if (rc)
-        PLOGERR (klogErr,
-                 (klogErr, rc, "Error resolving path from $(P)", "P=%s", path_));
-    else
-    {
-        XTocEntry * entry;
-        rc = XTocEntryResolvePath (self->entry, path, false, &entry);
-        if (rc)
-            PLOGERR (klogErr,
-                     (klogErr, rc, "Error resolving path from $(P)", "P=%s", path_));
-        else if (entry->type != xtoce_file)
-            rc = RC (rcFS, rcDirectory, rcAccessing, rcPath, rcIncorrect);
-        else
-            *locator = entry->u.file.offset;
-        free ((void*)path);
-    }
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * KXTocDirFileSize
- *  returns size in bytes of target file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- *
- *  "size" [ OUT ] - return parameter for file size
- * NOTE: Does not meet a design target of on stack (localized variable) allocation of single 4kb path
- */
-static
-rc_t CC KXTocDirFileSize		(const KXTocDir *self,
-					 uint64_t *size,
-					 const char *path_,
-					 va_list args)
-{
-    const char * path;
-    rc_t rc;
-
-    assert (self);
-    assert (size);
-    assert (path_);
-
-    *size = 0;
-    path = NULL;
-    rc = XTocMakePath (&path, false, path_, args);
-    if (rc)
-        PLOGERR (klogErr,
-                 (klogErr, rc, "Error resolving path from $(P)", "P=%s", path_));
-    else
-    {
-        XTocEntry * entry;
-        rc = XTocEntryResolvePath (self->entry, path, false, &entry);
-        if (rc)
-            PLOGERR (klogErr,
-                     (klogErr, rc, "Error resolving path from $(P)", "P=%s", path_));
-        else if (entry->type != xtoce_file)
-            rc = RC (rcFS, rcDirectory, rcAccessing, rcPath, rcIncorrect);
-        else
-            *size = entry->u.file.size;
-        free ((void*)path);
-    }
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * KXTocDirFileSize
- *  returns size in bytes of target file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- *
- *  "size" [ OUT ] - return parameter for file size
- * NOTE: Does not meet a design target of on stack (localized variable) allocation of single 4kb path
- */
-static
-rc_t CC KXTocDirFilePhysicalSize        (const KXTocDir *self,
-					 uint64_t *size,
-					 const char *path_,
-					 va_list args)
-{
-    const char * path;
-    rc_t rc;
-
-    assert (self);
-    assert (size);
-    assert (path_);
-
-    *size = 0;
-    path = NULL;
-    rc = XTocMakePath (&path, false, path_, args);
-    if (rc)
-        PLOGERR (klogErr,
-                 (klogErr, rc, "Error resolving path from $(P)", "P=%s", path_));
-    else
-    {
-        XTocEntry * entry;
-        rc = XTocEntryResolvePath (self->entry, path, false, &entry);
-        if (rc)
-            PLOGERR (klogErr,
-                     (klogErr, rc, "Error resolving path from $(P)", "P=%s", path_));
-        else if (entry->type != xtoce_file)
-            rc = RC (rcFS, rcDirectory, rcAccessing, rcPath, rcIncorrect);
-        else
-            *size = entry->u.file.size;
-        free ((void*)path);
-    }
-    return rc;
-}
-
-
-/* ----------------------------------------------------------------------
- * KXTocDirSetFileSize
- *  sets size in bytes of target file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- *
- *  "size" [ IN ] - new file size
- */
-static
-rc_t CC KXTocDirSetFileSize	(KXTocDir *self,
-					 uint64_t size,
-					 const char *path,
-					 va_list args)
-{
-    assert (self != NULL);
-    assert (path != NULL);
-
-    return RC (rcFS, rcArc, rcWriting, rcSelf, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * KXTocDirOpenDirRead
- *
- *  opens a sub-directory
- *
- * [IN]  const KXTocDir *	self	Object Oriented C KXTocDir self
- * [OUT] const KDirectory **	subp	Where to put the new KDirectory/KXTocDir
- * [IN]  bool			chroot	Create a chroot cage for this new subdirectory
- * [IN]  const char *		path	Path to the directory to open
- * [IN]  va_list		args	So far the only use of args is possible additions to path
- */
-static 
-rc_t CC KXTocDirOpenDirRead	(const KXTocDir *self,
-					 const KDirectory **subp,
-					 bool chroot,
-					 const char *path,
-					 va_list args)
-{
-#if 1
-    return -1;
-#else
-    char * full;
-    rc_t rc;
-    size_t size;
-
-    assert (self != NULL);
-    assert (subp != NULL);
-    assert (path != NULL);
-
-    rc = KXTocDirMakePath (self, rcOpening, true, &full, path, args);
-    if (rc == 0)
-    {
-	const KTocEntry *	pnode;
-	KTocEntryType		type;
-	size_t path_size = string_measure (full, &size);
-
-	/* -----
-	 * get rid of any extra '/' characters at the end of path
-	 */
-	while (path_size > 0 && full [ path_size - 1 ] == '/')
-	    full [ -- path_size ] = 0;
-
-	/* -----
-	 * get the node for this path 
-	 */
-	rc = KXTocDirResolvePathNode (self, rcOpening, full, true, &pnode, &type);
-	if (rc == 0)
-	{
-            switch (type)
-            {
-            default:
-		/* fail */
-		rc = RC (rcFS, rcDirectory, rcOpening, rcPath, rcIncorrect);
-                break;
-            case ktocentrytype_dir:
-            case ktocentrytype_hardlink:
-	    {
-		KXTocDir *	sub;
-
-		rc = KXTocDirMake (&sub,
-				  rcOpening,
-				  self->parent,
-				  self->toc,
-				  pnode,
-				  self->archive.v,
-				  self->arctype,
-				  self->root,
-				  full,
-				  (uint32_t)path_size,
-				  false,
-				  chroot);
-		if (rc == 0)
-		{
-		    /* succeed */
-		    *subp = &sub->dad;
-		}
-	    }
-            }
-	}
-	free (full);
-    }
-    return rc;
-#endif
-}
-
-/* ----------------------------------------------------------------------
- * KXTocDirOpenDirUpdate
- *  opens a sub-directory
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target directory
- *
- *  "chroot" [ IN ] - if non-zero, the new directory becomes
- *  chroot'd and will interpret paths beginning with '/'
- *  relative to itself.
- */
-static
-rc_t CC KXTocDirOpenDirUpdate	(KXTocDir *self,
-					 KDirectory ** subp, 
-					 bool chroot, 
-					 const char *path, 
-					 va_list args)
-{
-    assert (self != NULL);
-    assert (subp != NULL);
-    assert (path != NULL);
-
-    return RC (rcFS, rcArc, rcUpdating, rcSelf, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * KXTocDirCreateDir
- *  create a sub-directory
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target directory
- *
- *  "access" [ IN ] - standard Unix directory permissions
- *
- *  "mode" [ IN ] - a creation mode (see explanation above).
- */
-static
-rc_t CC KXTocDirCreateDir	(KXTocDir *self,
-					 uint32_t access,
-					 KCreateMode mode,
-					 const char *path,
-					 va_list args)
-{
-    assert (self != NULL);
-    assert (path != NULL);
-
-    return RC (rcFS, rcArc, rcCreating, rcSelf, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * KXTocDirDestroyFile
- */
-static
-rc_t CC KXTocDirDestroyFile	(KXTocDir *self,
-					 KFile * f)
-{
-    assert (self != NULL);
-    assert (f != NULL);
-
-    return RC (rcFS, rcArc, rcDestroying, rcSelf, rcUnsupported);
-}
-
-/* ----------------------------------------------------------------------
- * KXTocDirFileContiguous
- *  
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- *
- *  "contiguous" [ OUT ] - return parameter for file status
- */
-static
-rc_t CC KXTocDirFileContiguous		(const KXTocDir *self,
-                                         bool * contiguous,
-					 const char *path,
-                                         va_list args)
-{
-#if 1
-    return -1;
-#else
-    char *		full_path;
-    rc_t		rc;
-
-    assert (self != NULL);
-    assert (contiguous != NULL);
-    assert (path != NULL);
-
-    rc = KXTocDirMakePath (self, rcResolving, true,
-			  &full_path, path, args);
-
-    if (rc != 0)
-    {
-	/* can't "fix" path */
-	/*rc = RC (rcFS, rcDirectory, rcResolving, rcPath, rcInvalid); ? or tweak it? */
-    }
-    else
-    {
-	const KTocEntry * pnode;
-	KTocEntryType     type;
-
-	rc = KXTocDirResolvePathNode (self, rcResolving, full_path, /*follow links*/true, &pnode, &type);
-
-	if (rc != 0)
-	{
-	    /* can't resolve path */
-	    /*rc = RC (rcFS, rcDirectory, rcResolving, rcPath, rcInvalid); ? or tweak it? */
-	}
-	else
-	{
-	    switch (type)
-	    {
-	    default:
-                *contiguous = false;
-		break;
-	    case ktocentrytype_emptyfile:
-	    case ktocentrytype_file:
-                *contiguous = true;
-		break;
-	    }
-	}
-	free (full_path);
-    }
-    return rc;
-#endif
-}
-/* ----------------------------------------------------------------------
- *
- */
-static KDirectory_vt_v1 vtKXTocDir =
-{
-    /* version 1.0 */
-    1, 3,
-
-    /* start minor version 0 methods*/
-    KXTocDirDestroy,
-    KXTocDirList,
-    KXTocDirVisit,
-    KXTocDirVisitUpdate,
-    KXTocDirPathType,
-    KXTocDirResolvePath,
-    KXTocDirResolveAlias,
-    KXTocDirRename,
-    KXTocDirRemove,
-    KXTocDirClearDir,
-    KXTocDirVAccess,
-    KXTocDirSetAccess,
-    KXTocDirCreateAlias,
-    KXTocDirOpenFileRead,
-    KXTocDirOpenFileWrite,
-    KXTocDirCreateFile,
-    KXTocDirFileSize,
-    KXTocDirSetFileSize,
-    KXTocDirOpenDirRead,
-    KXTocDirOpenDirUpdate,
-    KXTocDirCreateDir,
-    KXTocDirDestroyFile,
-    /* end minor version 0 methods*/
-    /* start minor version 1 methods*/
-    KXTocDirVDate,
-    KXTocDirSetDate,
-    KXTocDirGetSysDir,
-    /* end minor version 2 methods*/
-    KXTocDirFileLocator,
-    /* end minor version 2 methods*/
-    /* end minor version 3 methods*/
-    KXTocDirFilePhysicalSize,
-    KXTocDirFileContiguous
-    /* end minor version 3 methods*/
-};
-
-static
-rc_t KXTocDirMake (const KXTocDir ** pself, const KDirectory * base,
-                   XToc * toc, XTocCache * cache, XTocEntry * entry,
-                   const String * path)
-{
-    rc_t rc;
-    KXTocDir * self;
-
-    assert (pself);
-    assert (base);
-    assert (toc);
-    assert (cache);
-    assert (entry);
-    assert (path);
-
-    self = malloc (sizeof (*self) + 1 + StringSize (path));
-    if (self == NULL)
-        rc = RC (rcFS, rcDirectory, rcConstructing, rcMemory, rcExhausted);
-    else
-    {
-        char * pc;
-
-        self->base = base;        /* we take ownership of base */
-        self->toc = toc;
-        self->cache = cache;
-        self->entry = entry;
-        self->container = entry->container;
-        self->root = toc->root;
-
-        pc = (char *)(self + 1);
-        string_copy (pc, StringSize (path), path->addr, StringSize (path));
-        StringInit (&self->base_path, pc, StringSize (path), StringLength (path));
-
-        rc = KDirectoryInit (&self->dad, (const KDirectory_vt*)&vtKXTocDir,
-                             "KXTocDir", pc, false);
-        if (rc == 0)
-        {
-            *pself = self;
-            return 0;
-        }
-        free (self);
-    }
-    return rc;
-}
-
-
-static 
-rc_t KDirectoryOpenXTocDirReadInt (const KDirectory * dir,
-                                   const KDirectory ** pnew_dir,
-                                   const KFile * xml,
-                                   const String * spath)
-{
-    XToc * xtoc;
-    rc_t rc;
-
-    rc = XTocMake (&xtoc, spath);
-    if (rc)
-        LOGERR (klogErr, rc, "Error creating toc for xtc directory");
-    else
-    {
-        String sroot;
-        XTocCache * cache;
-
-        StringInitCString (&sroot, ".");
-        rc = XTocMakeXTocCache (xtoc, &cache, &sroot, xtoc->root);
-        if (rc)
-            LOGERR (klogErr, rc, 
-                    "Failed to make cache for root for "
-                    "xtoc directory");
-        else
-        {
-            const KXTocDir * xdir;
-
-            /* now that we have a cache node we should release
-             * the original reference to the xtoc */
-/* ??? */
-            XTocRelease (xtoc);
-
-            xtoc->cache = xtoc->root->cache = cache;
-
-            rc = KXTocDirMake (&xdir, dir, xtoc, cache, xtoc->root,
-                               &sroot);
-            if (rc)
-                LOGERR (klogErr, rc, "Error making xtoc directory");
-            else
-            {
-                DBG_KXTocDir((xdir));
-                cache->dir = xdir;
-
-                rc = XTocParseXml (xtoc->root, xml);
-                if (rc)
-                    LOGERR (klogErr, rc, "Error parsing copycat xml file");
-                else
-                {
-                    *pnew_dir = &xdir->dad;
-                    return 0;
-                }
-                KDirectoryRelease (&xdir->dad);
-            }                
-            XTocCacheRelease (cache);
-        }
-        XTocRelease (xtoc);
-    }
-    return rc;
-}
-
-rc_t CC KDirectoryOpenXTocDirReadDir (const KDirectory * self,
-                                                 const KDirectory ** pnew_dir,
-                                                 const KFile * xml,
-                                                 const String * spath)
-{
-    rc_t rc;
-    
-    /* loosely validate parameters */
-    if (pnew_dir == NULL)
-    {
-        rc = RC (rcFS, rcDirectory, rcOpening, rcParam, rcNull);
-        LOGERR (klogErr, rc,
-                "new directory parameter is NULL for opening XToc Directory");
-        return rc;
-    }
-    *pnew_dir = NULL;
-
-    if (self == NULL)
-    {
-        rc = RC (rcFS, rcDirectory, rcOpening, rcSelf, rcNull);
-        LOGERR (klogErr, rc, "self is NULL for opening XToc Directory");
-        return rc;
-    }
-    else if (xml == NULL)
-    {
-        rc = RC (rcFS, rcDirectory, rcOpening, rcParam, rcNull);
-        LOGERR (klogErr, rc, "xml parameter is NULL for opening XToc Directory");
-        return rc;
-    }
-    else if (spath == NULL)
-    {
-        rc = RC (rcFS, rcDirectory, rcOpening, rcParam, rcNull);
-        LOGERR (klogErr, rc, "base path parameter is NULL for opening XToc Directory");
-        return rc;
-    }
-    else
-    {
-        rc = KDirectoryOpenXTocDirReadInt (self, pnew_dir, xml, spath);
-    }
-    return rc;
-}
-
-
-rc_t CC KDirectoryVOpenXTocDirRead (const KDirectory * self,
-                                               const KDirectory ** pnew_dir,
-                                               bool chroot,
-                                               const KFile * xml,
-                                               const char * _path,
-                                               va_list args )
-{
-    rc_t rc;
-    
-    /* loosely validate parameters */
-    if (pnew_dir == NULL)
-    {
-        rc = RC (rcFS, rcDirectory, rcOpening, rcParam, rcNull);
-        LOGERR (klogErr, rc,
-                "new directory parameter is NULL for opening XToc Directory");
-        return rc;
-    }
-    *pnew_dir = NULL;
-
-    if (self == NULL)
-    {
-        rc = RC (rcFS, rcDirectory, rcOpening, rcSelf, rcNull);
-        LOGERR (klogErr, rc, "self is NULL for opening XToc Directory");
-        return rc;
-    }
-    else if (xml == NULL)
-    {
-        rc = RC (rcFS, rcDirectory, rcOpening, rcParam, rcNull);
-        LOGERR (klogErr, rc, "xml parameter is NULL for opening XToc Directory");
-        return rc;
-    }
-    else if (_path == NULL)
-    {
-        rc = RC (rcFS, rcDirectory, rcOpening, rcParam, rcNull);
-        LOGERR (klogErr, rc, "base path parameter is NULL for opening XToc Directory");
-        return rc;
-    }
-    else
-    /* okay none of our parameters are NULL; they could still be bad but let's start */
-    {
-        String spath;
-        const KDirectory * bdir;
-        KPathType type;
-        char path [8192];
-
-        rc = KDirectoryVResolvePath (self, true, path, sizeof path, _path, args);
-        if (rc)
-            return rc;
-
-        type = KDirectoryPathType (self, path);
-        switch (type & ~kptAlias)
-        {
-        case kptNotFound:
-            rc = RC (rcFS, rcDirectory, rcOpening, rcParam, rcNotFound);
-            LOGERR (klogErr, rc, "base path parameter is not found when opening XToc Directory");
-            return rc;
-
-        case kptBadPath:
-            rc = RC (rcFS, rcDirectory, rcOpening, rcParam, rcInvalid);
-            LOGERR (klogErr, rc, "base path parameter is a bad path when opening XToc Directory");
-            return rc;
-
-        case kptFile:
-        case kptCharDev:
-        case kptBlockDev:
-        case kptFIFO:
-        case kptZombieFile:
-        case kptDataset:
-        case kptDatatype:
-            KOutMsg ("%s: type '%u' path '%s'\n",type,path);
-            rc = RC (rcFS, rcDirectory, rcOpening, rcParam, rcWrongType);
-            LOGERR (klogErr, rc, "base path parameter is an unusable type when opening XToc Directory");
-            return rc;
-
-        default:
-            rc = RC (rcFS, rcDirectory, rcOpening, rcParam, rcCorrupt);
-            LOGERR (klogErr, rc, "base path parameter is not a known type when opening XToc Directory");
-            return rc;
-
-        case kptDir:
-            break;
-        }
-
-        rc = KDirectoryVOpenDirRead (self, &bdir, true, path, args);
-        if (rc)
-        {
-            LOGERR (klogErr, rc, "failed to open base directory for XToc directory");
-            return rc;
-        }
-        else
-        {
-            static const char absroot[] = "/";
-
-            if (chroot)
-                StringInitCString (&spath, absroot);
-            else
-                StringInitCString (&spath, path);
-
-            rc = KDirectoryOpenXTocDirReadInt (bdir, pnew_dir, xml, &spath);
-            if (rc == 0)
-                return 0;
-
-            KDirectoryRelease (bdir);
-        }
-    }
-    return rc;
-}
-
-
-rc_t CC KDirectoryOpenXTocDirRead (const KDirectory * self,
-                                              const KDirectory ** pnew_dir,
-                                              bool chroot,
-                                              const KFile * xml,
-                                              const char * path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start (args, path);
-    rc = KDirectoryVOpenXTocDirRead (self, pnew_dir, chroot, xml, path, args);
-    va_end (args);
-
-    return rc;
-}
-
-
-struct VFSManager;
-
-rc_t CC VFSManagerOpenXTocDirRead (const struct VFSManager * self,
-                                              const struct KDirectory ** pnew_dir,
-                                              const struct KFile * xml,
-                                              const struct VPath * path)
-{
-    rc_t rc = 0;
-
-    /* needs to be replaced with proper checking and rc returns */
-    assert (pnew_dir);
-
-    *pnew_dir = NULL;
-
-    assert (self);
-    assert (xml);
-    assert (path);
-
-    if (rc == 0)
-    {
-        const KDirectory * dir;
-
-        rc = VFSManagerOpenDirectoryRead (self, &dir, path);
-        if (rc == 0)
-        {
-            char pbuff [8192];
-            size_t z;
-
-            rc = VPathReadPath (path, pbuff, sizeof pbuff, &z);
-            if (rc == 0)
-            {
-                String string;
-
-                StringInit (&string, pbuff, z, string_len (pbuff, z));
-
-                rc = KDirectoryOpenXTocDirReadDir (dir, pnew_dir, xml, &string);
-                if (rc == 0)
-                    return 0;
-            }
-
-            KDirectoryRelease (dir);
-        }
-    }
-    return rc;
-}
-
-
-
-/* end of file */
diff --git a/libs/loader/Makefile b/libs/loader/Makefile
deleted file mode 100644
index d1410c8..0000000
--- a/libs/loader/Makefile
+++ /dev/null
@@ -1,87 +0,0 @@
-# ===========================================================================
-#
-#                            PUBLIC DOMAIN NOTICE
-#               National Center for Biotechnology Information
-#
-#  This software/database is a "United States Government Work" under the
-#  terms of the United States Copyright Act.  It was written as part of
-#  the author's official duties as a United States Government employee and
-#  thus cannot be copyrighted.  This software/database is freely available
-#  to the public for use. The National Library of Medicine and the U.S.
-#  Government have not placed any restriction on its use or reproduction.
-#
-#  Although all reasonable efforts have been taken to ensure the accuracy
-#  and reliability of the software and data, the NLM and the U.S.
-#  Government do not and cannot warrant the performance or results that
-#  may be obtained by using this software or data. The NLM and the U.S.
-#  Government disclaim all warranties, express or implied, including
-#  warranties of performance, merchantability or fitness for any particular
-#  purpose.
-#
-#  Please cite the author in any work or product based on this material.
-#
-# ===========================================================================
-
-default: all
-
-TOP ?= $(shell ../../build/abspath.sh ../..)
-MODULE = libs/loader
-
-INT_LIBS = \
-	libloader
-
-ALL_LIBS = \
-	$(INT_LIBS)
-
-TEST_TOOLS = 
-
-include $(TOP)/build/Makefile.env
-
-#-------------------------------------------------------------------------------
-# outer targets
-#
-all std: makedirs 
-	@ $(MAKE_CMD) $(TARGDIR)/std
-
-$(INT_LIBS): makedirs
-	@ $(MAKE_CMD) $(ILIBDIR)/$@
-
-$(TEST_TOOLS): std makedirs
-	@ $(MAKE_CMD) $(TEST_BINDIR)/$@
-
-.PHONY: all std $(ALL_LIBS) $(TEST_TOOLS)
-
-#-------------------------------------------------------------------------------
-# std
-#
-$(TARGDIR)/std: \
-	$(addprefix $(ILIBDIR)/,$(INT_LIBS))
-
-.PHONY: $(TARGDIR)/std
-
-#-------------------------------------------------------------------------------
-# clean
-#
-clean: stdclean
-
-.PHONY: clean
-
-#-------------------------------------------------------------------------------
-# libloader
-#
-$(ILIBDIR)/libloader: $(ILIBDIR)/libloader.$(LIBX)
-
-LOADER_SRC = \
-    mmarray \
-	common-reader \
-	common-writer \
-	sequence-writer \
-	reference-writer \
-	alignment-writer
-
-LOADER_OBJ = \
-	$(addsuffix .$(LOBX),$(LOADER_SRC))
-
-$(ILIBDIR)/libloader.$(LIBX): $(LOADER_OBJ)
-	$(LD) --slib -o $@ $^ $(LOADER_LIB)
-
diff --git a/libs/loader/alignment-writer.c b/libs/loader/alignment-writer.c
deleted file mode 100644
index 0b85c31..0000000
--- a/libs/loader/alignment-writer.c
+++ /dev/null
@@ -1,262 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <klib/rc.h>
-#include <klib/log.h>
-#include <sysalloc.h>
-#include <klib/out.h>
-
-#include <vdb/vdb-priv.h>
-
-#include <loader/alignment-writer.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-enum e_tables {
-    tblPrimary,
-    tblSecondary,
-    tblN
-};
-
-struct AlignmentWriter {
-    VDatabase *db;
-    TableWriterAlgn const *tbl[tblN];
-    int64_t rowId;
-    int st;
-};
-
-AlignmentWriter *AlignmentMake(VDatabase *db) {
-    AlignmentWriter *self = calloc(1, sizeof(*self));
-    
-    if (self) {
-        self->db = db;
-        VDatabaseAddRef(self->db);
-    }
-    return self;
-}
-
-static rc_t SetColumnDefaults(TableWriterAlgn const *tbl)
-{
-    return 0;
-}
-
-static rc_t WritePrimaryRecord(AlignmentWriter *const self, AlignmentRecord *const data, bool expectUnsorted)
-{
-    if (self->tbl[tblPrimary] == NULL) {
-        rc_t rc = TableWriterAlgn_Make(&self->tbl[tblPrimary], self->db,
-                                       ewalgn_tabletype_PrimaryAlignment,
-                                       ewalgn_co_TMP_KEY_ID + 
-                                       (expectUnsorted ? ewalgn_co_unsorted : 0));
-        if (rc)
-            return rc;
-        rc = SetColumnDefaults(self->tbl[tblPrimary]);
-        if (rc)
-            return rc;
-    }
-    return TableWriterAlgn_Write(self->tbl[tblPrimary], &data->data, &data->alignId);
-}
-
-static rc_t WriteSecondaryRecord(AlignmentWriter *const self, AlignmentRecord *const data, bool expectUnsorted)
-{
-    if (self->tbl[tblSecondary] == NULL) {
-        rc_t rc = TableWriterAlgn_Make(&self->tbl[tblSecondary], self->db,
-                                       ewalgn_tabletype_SecondaryAlignment,
-                                       ewalgn_co_TMP_KEY_ID + 
-                                       (expectUnsorted ? ewalgn_co_unsorted : 0));
-        if (rc)
-            return rc;
-        rc = SetColumnDefaults(self->tbl[tblSecondary]);
-        if (rc)
-            return rc;
-    }
-#if 1
-    /* try to make consistent with cg-load */
-    if (data->mate_ref_pos == 0) {
-        data->data.mate_ref_orientation.elements = 0;
-    }
-#endif
-    return TableWriterAlgn_Write(self->tbl[tblSecondary], &data->data, &data->alignId);
-}
-
-rc_t AlignmentWriteRecord(AlignmentWriter *const self, AlignmentRecord *const data, bool expectUnsorted)
-{
-    return data->isPrimary ? WritePrimaryRecord(self, data, expectUnsorted) : WriteSecondaryRecord(self, data, expectUnsorted);
-}
-
-rc_t AlignmentStartUpdatingSpotIds(AlignmentWriter *const self)
-{
-    return 0;
-}
-
-rc_t AlignmentGetSpotKey(AlignmentWriter * const self, uint64_t *keyId, int64_t *alignId, bool *isPrimary)
-{
-    rc_t rc;
-    
-    switch (self->st) {
-    case 0:
-        rc = TableWriterAlgn_TmpKeyStart(self->tbl[tblPrimary]);
-        if (rc)
-            break;
-        self->rowId = 0;
-        ++self->st;
-    case 1:
-        rc = TableWriterAlgn_TmpKey(self->tbl[tblPrimary], ++self->rowId, keyId);
-        if (rc == 0) {
-            *alignId = self->rowId;
-            *isPrimary = true;
-            break;
-        }
-        ++self->st;
-        if (GetRCState(rc) != rcNotFound || GetRCObject(rc) != rcRow || self->tbl[tblSecondary] == NULL)
-            break;
-    case 2:
-        rc = TableWriterAlgn_TmpKeyStart(self->tbl[tblSecondary]);
-        if (rc)
-            break;
-        self->rowId = 0;
-        ++self->st;
-    case 3:
-        rc = TableWriterAlgn_TmpKey(self->tbl[tblSecondary], ++self->rowId, keyId);
-        if (rc == 0) {
-            *alignId = self->rowId;
-            *isPrimary = false;
-            break;
-        }
-        if (GetRCState(rc) != rcNotFound || GetRCObject(rc) != rcRow)
-            break;
-        ++self->st;
-        break;
-    default:
-        rc = RC(rcAlign, rcTable, rcUpdating, rcError, rcIgnored);
-        break;
-    }
-    return rc;
-}
-
-rc_t AlignmentGetRefPos(AlignmentWriter *const self, int64_t row, ReferenceStart *const rslt)
-{
-    switch (self->st) {
-    case 1:
-        return TableWriterAlgn_RefStart(self->tbl[tblPrimary], self->rowId, rslt);
-    case 3:
-    default:
-        return RC(rcAlign, rcTable, rcUpdating, rcSelf, rcInconsistent);
-    }
-}
-
-rc_t AlignmentUpdateInfo(AlignmentWriter * const self, int64_t const spotId, int64_t const mateId, ReferenceStart const *mateRefPos)
-{
-    switch (self->st) {
-    case 1:
-        return TableWriterAlgn_Write_SpotInfo(self->tbl[tblPrimary], self->rowId, spotId, mateId, mateRefPos);
-    case 3:
-        return TableWriterAlgn_Write_SpotInfo(self->tbl[tblSecondary], self->rowId, spotId, 0, 0);
-    default:
-        return RC(rcAlign, rcTable, rcUpdating, rcSelf, rcInconsistent);
-    }
-}
-
-rc_t AlignmentWhack(AlignmentWriter * const self, bool const commit) 
-{
-    rc_t const rc = TableWriterAlgn_Whack(self->tbl[tblPrimary], commit, NULL);
-    rc_t const rc2 = self->tbl[tblSecondary] ? TableWriterAlgn_Whack(self->tbl[tblSecondary], commit | (rc == 0), NULL) : 0;
-
-    VDatabaseRelease(self->db);
-    free(self);
-    return rc ? rc : rc2;
-}
-
-size_t AlignmentRecordBufferSize(size_t const readlen, bool hasMismatchQual)
-{
-    AlignmentRecord const *const dummy;
-    size_t const elemSize = sizeof(AR_OFFSET(*dummy)[0])
-                          + sizeof(AR_HAS_MISMATCH(*dummy)[0])
-                          + sizeof(AR_HAS_OFFSET(*dummy)[0])
-                          + sizeof(AR_MISMATCH(*dummy)[0])
-                          + (hasMismatchQual ? sizeof(AR_MISMATCH_QUAL(*dummy)[0]) : 0);
-    
-    return elemSize * readlen;
-}
-
-void AlignmentRecordInit(AlignmentRecord *self, void *buffer, unsigned readlen,
-                         char **endp,
-                         bool expectUnsorted,
-                         bool hasMismatchQual
-                         )
-{
-    memset(self, 0, sizeof(*self));
-
-    self->data.seq_read_id.buffer = &self->read_id;
-    self->data.seq_read_id.elements = 1;
-    self->data.ref_id.buffer = &self->ref_id;
-    self->data.ref_id.elements = 1;
-    if (expectUnsorted) {
-        self->data.ref_start.buffer = &self->ref_start;
-        self->data.ref_start.elements = 1;
-    }
-    else {
-        self->data.global_ref_start.buffer = &self->global_ref_start;
-        self->data.global_ref_start.elements = 1;
-    }
-    self->data.ref_orientation.buffer = &self->ref_orientation;
-    self->data.ref_orientation.elements = 1;
-    self->data.mapq.buffer = &self->mapq;
-    self->data.mapq.elements = 1;
-    self->data.tmp_key_id.buffer = &self->tmp_key_id;
-    self->data.tmp_key_id.elements = 1;
-    
-    self->data.read_start.buffer = &self->read_start;
-    self->data.read_start.elements = 1;
-    self->data.read_len.buffer = &self->read_len;
-    self->data.read_len.elements = 1;
-    
-    self->data.mate_ref_orientation.buffer = &self->mate_ref_orientation;
-    self->data.mate_ref_orientation.elements = 1;
-    self->data.mate_ref_id.buffer = &self->mate_ref_id;
-    self->data.mate_ref_id.elements = 1;
-    self->data.mate_ref_pos.buffer = &self->mate_ref_pos;
-    self->data.mate_ref_pos.elements = 1;
-    self->data.mate_align_id.buffer = &self->mate_align_id;
-    self->data.mate_align_id.elements = 1;
-    self->data.template_len.buffer = &self->template_len;
-    self->data.template_len.elements = 1;
-    
-    self->data.ref_offset.buffer = (int32_t *)buffer;
-    self->data.has_mismatch.buffer = (bool *)&AR_OFFSET(*self)[readlen];
-    self->data.has_mismatch.elements = readlen;
-    self->data.has_ref_offset.buffer = &AR_HAS_MISMATCH(*self)[readlen];
-    self->data.has_ref_offset.elements = readlen;
-    self->data.mismatch.buffer = (char *)&AR_HAS_OFFSET(*self)[readlen];
-    
-    if (hasMismatchQual) {
-        self->data.mismatch_qual.buffer = (uint8_t *)&AR_MISMATCH(*self)[readlen];
-        *endp = (char *)&AR_MISMATCH_QUAL(*self)[readlen];
-    }
-    else
-        *endp = (char *)&AR_MISMATCH(*self)[readlen];
-}
diff --git a/libs/loader/common-reader.c b/libs/loader/common-reader.c
deleted file mode 100644
index cde2bcf..0000000
--- a/libs/loader/common-reader.c
+++ /dev/null
@@ -1,614 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <loader/common-reader-priv.h>
-
-#include <sysalloc.h>
-
-#include <assert.h>
-#include <stdlib.h>
-
-#include <klib/rc.h>
-
-/*--------------------------------------------------------------------------
- ReaderFile
- */
-rc_t CC ReaderFileAddRef ( const ReaderFile *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "ReaderFile" ) )
-        {
-        case krefLimit:
-            return RC ( RC_MODULE, rcFile, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-rc_t CC ReaderFileRelease ( const ReaderFile *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "ReaderFile" ) )
-        {
-        case krefWhack:
-            return self->vt.v1->destroy( (ReaderFile *)self );
-        case krefNegative:
-            return RC ( RC_MODULE, rcFile, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-rc_t CC ReaderFileGetRecord( const ReaderFile *self, const Record** result)
-{
-    assert(self);
-    assert(result);
-    return self->vt.v1->getRecord( self, result );
-}
-
-float CC ReaderFileGetProportionalPosition ( const READERFILE_IMPL *self )
-{
-    assert(self);
-    assert(self->vt.v1->getProportionalPosition);
-    return self->vt.v1->getProportionalPosition( self );
-}
-
-rc_t CC ReaderFileGetReferenceInfo ( const ReaderFile *self, const ReferenceInfo** result )
-{
-    assert(self);
-    assert(self->vt.v1->getReferenceInfo);
-    return self->vt.v1->getReferenceInfo( self, result );
-}
-
-/* Init
- *  polymorphic parent constructor
- */
-rc_t CC ReaderFileInit ( ReaderFile *self )
-{
-    if ( self == NULL )
-        return RC ( RC_MODULE, rcFileFormat, rcConstructing, rcSelf, rcNull );
-
-    KRefcountInit ( & self -> refcount, 1, "ReaderFile", "ReaderFileInit", "");
-
-    self->pathname = NULL;
-
-    return 0;
-}
-
-rc_t CC ReaderFileWhack ( ReaderFile *self )
-{
-    if ( self == NULL )
-        return RC ( RC_MODULE, rcFileFormat, rcConstructing, rcSelf, rcNull );
-
-    free( self->pathname );
-
-    return 0;
-}
-
-const char* CC ReaderFileGetPathname ( const ReaderFile *self )
-{
-    if ( self == NULL )
-        return NULL;
-    return self->pathname;
-}
-
-/*--------------------------------------------------------------------------
- Record
- */
-
-rc_t CC RecordAddRef ( const Record *self )
-{
-    assert(self);
-    assert(self->vt.v1->addRef);
-    return self->vt.v1->addRef(self);
-}
-
-rc_t CC RecordRelease ( const Record *self )
-{
-    assert(self);
-    assert(self->vt.v1->release);
-    return self->vt.v1->release(self);
-}
-
-rc_t CC RecordGetSequence ( const Record *self, const Sequence** result)
-{
-    assert(self);
-    assert(result);
-    assert(self->vt.v1->getSequence);
-    return self->vt.v1->getSequence(self, result);
-}
-
-rc_t CC RecordGetAlignment( const Record *self, const Alignment** result)
-{
-    assert(self);
-    assert(result);
-    assert(self->vt.v1->getAlignment);
-    return self->vt.v1->getAlignment(self, result);
-}
-
-rc_t CC RecordGetRejected ( const Record *self, const Rejected** result)
-{
-    assert(self);
-    assert(result);
-    assert(self->vt.v1->getRejected);
-    return self->vt.v1->getRejected(self, result);
-}
-
-/*--------------------------------------------------------------------------
- Sequence
- */
-rc_t CC SequenceAddRef ( const Sequence *self )
-{
-    assert(self);
-    assert(self->vt.v1->addRef);
-    return self->vt.v1->addRef(self);
-}
-
-rc_t CC SequenceRelease ( const Sequence *self )
-{
-    assert(self);
-    assert(self->vt.v1->release);
-    return self->vt.v1->release(self);
-}
-
-rc_t CC SequenceGetReadLength ( const Sequence *self, uint32_t *length )
-{
-    assert(self);
-    assert(length);
-    assert(self->vt.v1->getReadLength);
-    return self->vt.v1->getReadLength(self, length);
-}
-
-rc_t CC SequenceGetRead( const Sequence *self, char *sequence )
-{
-    assert(self);
-    assert(sequence);
-    assert(self->vt.v1->getRead);
-    return self->vt.v1->getRead(self, sequence);
-}
-
-rc_t CC SequenceGetRead2 ( const Sequence *self, char *sequence, uint32_t start, uint32_t stop)
-{
-    assert(self);
-    assert(sequence);
-    assert(self->vt.v1->getRead2);
-    return self->vt.v1->getRead2(self, sequence, start, stop);
-}
-
-rc_t CC SequenceGetQuality(const Sequence *self, const int8_t **quality, uint8_t *offset, int *qualType)
-{
-    assert(self);
-    assert(quality);
-    assert(offset);
-    assert(qualType);
-    assert(self->vt.v1->getQuality);
-    return self->vt.v1->getQuality(self, quality, offset, qualType);
-}
-
-rc_t CC SequenceGetSpotGroup ( const Sequence *self, const char **name, size_t *length )
-{
-    assert(self);
-    assert(name);
-    assert(length);
-    assert(self->vt.v1->getSpotGroup);
-    return self->vt.v1->getSpotGroup(self, name, length);
-}
-
-rc_t CC SequenceGetSpotName ( const Sequence *self, const char **name, size_t *length )
-{
-    assert(self);
-    assert(name);
-    assert(length);
-    assert(self->vt.v1->getSpotName);
-    return self->vt.v1->getSpotName(self, name, length);
-}
-
-bool CC SequenceIsColorSpace ( const Sequence *self )
-{
-    assert(self);
-    assert(self->vt.v1->isColorSpace);
-    return self->vt.v1->isColorSpace(self);
-}
-
-rc_t CC SequenceGetCSKey ( const Sequence *self, char cskey[1] )
-{
-    assert(self);
-    assert(self->vt.v1->getCSKey);
-    return self->vt.v1->getCSKey(self, cskey);
-}
-
-rc_t CC SequenceGetCSReadLength ( const Sequence *self, uint32_t *length )
-{
-    assert(self);
-    assert(self->vt.v1->getCSReadLength);
-    return self->vt.v1->getCSReadLength(self, length);
-}
-
-rc_t CC SequenceGetCSRead( const Sequence *self, char *sequence )
-{
-    assert(self);
-    assert(self->vt.v1->getCSRead);
-    return self->vt.v1->getCSRead(self, sequence);
-}
-
-rc_t CC SequenceGetCSQuality(const Sequence *self, const int8_t **quality, uint8_t *offset, int *qualType)
-{
-    assert(self);
-    assert(quality);
-    assert(offset);
-    assert(qualType);
-    assert(self->vt.v1->getCSQuality);
-    return self->vt.v1->getCSQuality(self, quality, offset, qualType);
-}
-
-bool CC SequenceWasPaired     ( const Sequence *self )
-{
-    assert(self);
-    assert(self->vt.v1->wasPaired);
-    return self->vt.v1->wasPaired(self);
-}
-
-int CC SequenceGetOrientationSelf( const Sequence *self )
-{
-    assert(self);
-    assert(self->vt.v1->orientationSelf);
-    return self->vt.v1->orientationSelf(self);
-}
- 
-int CC SequenceGetOrientationMate( const Sequence *self )
-{
-    assert(self);
-    assert(self->vt.v1->orientationMate);
-    return self->vt.v1->orientationMate(self);
-}
-
-bool CC SequenceIsFirst       ( const Sequence *self )
-{
-    assert(self);
-    assert(self->vt.v1->isFirst);
-    return self->vt.v1->isFirst(self);
-}
-
-bool CC SequenceIsSecond      ( const Sequence *self )
-{
-    assert(self);
-    assert(self->vt.v1->isSecond);
-    return self->vt.v1->isSecond(self);
-}
-
-rc_t SequenceGetTI(Sequence const *self, uint64_t *ti)
-{
-    assert(self);
-    assert(ti);
-    assert(self->vt.v1->getTI);
-    return self->vt.v1->getTI(self, ti);
-}
-
-bool CC SequenceIsDuplicate( const Sequence *self )
-{
-    assert(self);
-    assert(self->vt.v1->isDuplicate);
-    return self->vt.v1->isDuplicate(self);
-}
-
-bool CC SequenceIsLowQuality( const Sequence *self )
-{
-    assert(self);
-    assert(self->vt.v1->isLowQuality);
-    return self->vt.v1->isLowQuality(self);
-}
-
-/*--------------------------------------------------------------------------
- Alignment
- */
-
-rc_t CC AlignmentAddRef ( const Alignment *self )
-{
-    assert(self);
-    assert(self->vt.v1->addRef);
-    return self->vt.v1->addRef(self);
-}
-
-rc_t CC AlignmentRelease ( const Alignment *self )
-{
-    assert(self);
-    assert(self->vt.v1->release);
-    return self->vt.v1->release(self);
-}
-
-rc_t CC AlignmentGetRefSeqId ( const Alignment *self, int32_t *refSeqId )
-{
-    assert(self);
-    assert(refSeqId);
-    assert(self->vt.v1->getRefSeqId);
-    return self->vt.v1->getRefSeqId(self, refSeqId);
-}
-
-rc_t CC AlignmentGetMateRefSeqId ( const Alignment *self, int32_t *refSeqId )
-{
-    assert(self);
-    assert(refSeqId);
-    assert(self->vt.v1->getMateRefSeqId);
-    return self->vt.v1->getMateRefSeqId(self, refSeqId);
-}
-
-rc_t CC AlignmentGetPosition ( const Alignment *self, int64_t *pos )
-{
-    assert(self);
-    assert(pos);
-    assert(self->vt.v1->getPosition);
-    return self->vt.v1->getPosition(self, pos);
-}
-
-rc_t CC AlignmentGetMatePosition ( const Alignment *self, int64_t *pos )
-{
-    assert(self);
-    assert(pos);
-    assert(self->vt.v1->getMatePosition);
-    return self->vt.v1->getMatePosition(self, pos);
-}
-
-rc_t CC AlignmentGetMapQuality ( const Alignment *self, uint8_t *qual )
-{
-    assert(self);
-    assert(qual);
-    assert(self->vt.v1->getMapQuality);
-    return self->vt.v1->getMapQuality(self, qual);
-}
-
-rc_t CC AlignmentGetAlignmentDetail ( const Alignment *self,
-                                      AlignmentDetail *rslt, 
-                                      uint32_t count, 
-                                      uint32_t *actual,
-                                      int32_t *firstMatch, 
-                                      int32_t *lastMatch )
-{
-    assert(self);
-    assert(self->vt.v1->getAlignmentDetail);
-    return self->vt.v1->getAlignmentDetail(self, rslt, count, actual, firstMatch, lastMatch);
-}
-
-rc_t CC AlignmentGetAlignOpCount ( const Alignment *self, uint32_t *n )
-{
-    assert(self);
-    assert(n);
-    assert(self->vt.v1->getAlignOpCount);
-    return self->vt.v1->getAlignOpCount(self, n);
-}
-
-rc_t CC AlignmentGetInsertSize ( const Alignment *self, int64_t *size )
-{
-    assert(self);
-    assert(size);
-    assert(self->vt.v1->getInsertSize);
-    return self->vt.v1->getInsertSize(self, size);
-}
-
-rc_t AlignmentGetCGData ( const ALIGNMENT_IMPL *self, const CGData** result)
-{
-    assert(self);
-    assert(result);
-    assert(self->vt.v1->getCG);
-    return self->vt.v1->getCG(self, result);
-}
-
-rc_t AlignmentGetBAMCigar ( const ALIGNMENT_IMPL *self, uint32_t const **rslt, uint32_t *length )
-{
-    assert(self);
-    assert(rslt);
-    assert(length);
-    assert(self->vt.v1->getBAMCigar);
-    return self->vt.v1->getBAMCigar(self, rslt, length);
-}
-
-bool AlignmentIsSecondary( const Alignment *self )
-{
-    assert(self);
-    assert(self->vt.v1->isSecondary);
-    return self->vt.v1->isSecondary(self);
-}
-
-/*--------------------------------------------------------------------------
- * CGData
- */
-rc_t CC CGDataAddRef ( const CGData *self )
-{
-    assert(self);
-    assert(self->vt.v1->addRef);
-    return self->vt.v1->addRef(self);
-}
-
-rc_t CC CGDataRelease ( const CGData *self )
-{
-    assert(self);
-    assert(self->vt.v1->release);
-    return self->vt.v1->release(self);
-}
-
-/* CGGetSeqQual
- */
-rc_t CC CGDataGetSeqQual ( const CGData* self,
-                           char sequence[/* 35 */],
-                           uint8_t quality[/* 35 */] )
-{
-    assert(self);
-    assert(sequence);
-    assert(quality);
-    assert(self->vt.v1->getSeqQual);
-    return self->vt.v1->getSeqQual(self, sequence, quality); 
-}                       
-
-/* CGGetCigar
- */
-rc_t CC CGDataGetCigar ( const CGData* self,
-                         uint32_t *cigar,
-                         uint32_t cig_max,
-                         uint32_t *cig_act )
-{
-    assert(self);
-    assert(cigar);
-    assert(cig_act);
-    assert(self->vt.v1->getCigar);
-    return self->vt.v1->getCigar(self, cigar, cig_max, cig_act);
-}                     
-
-/* CGGetAlignGroup
- */
-rc_t CC CGDataGetAlignGroup ( const CGData* self,
-                              char buffer[],
-                              size_t max_size,
-                              size_t *act_size )
-{
-    assert(self);
-    assert(act_size);
-    assert(self->vt.v1->getAlignGroup);
-    return self->vt.v1->getAlignGroup(self, buffer, max_size, act_size);
-}
-                          
-/*--------------------------------------------------------------------------
- * Rejected
- */
-
-rc_t CC RejectedInit ( Rejected *self )
-{
-    KRefcountInit ( & self -> refcount, 1, "Rejected", "RejectedInit", "");
-    StringInit(&self->source, 0, 0, 0);
-    self->message = 0;
-    self->column = 0;
-    self->line = 0;
-    self->fatal = false;
-    return 0;
-}
-
-static rc_t CC RejectedWhack ( const Rejected *self )
-{
-    free( (void*)self->source.addr );
-    free( (void*)self->message );
-    free( (void*)self );
-    return 0;
-}
-
-rc_t CC RejectedAddRef ( const Rejected *self )
-{
-    assert(self);
-    KRefcountAdd( & self->refcount, "Rejected" );
-    /* TODO: handle rc from KRefcountAdd */
-    return 0;
-}
-
-rc_t CC RejectedRelease ( const Rejected *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "Rejected" ) )
-        {
-        case krefWhack:
-            RejectedWhack( self );
-            break;
-        default:
-            /* TODO: handle other values */
-            break;
-        }
-    }
-    return 0;
-}
-
-rc_t CC RejectedGetError( const Rejected* self, const char** text, uint64_t* line, uint64_t* column, bool* fatal )
-{
-    assert(self);
-    assert(text);
-    assert(line);
-    assert(column);
-    *text = self->message;
-    *line = self->line;
-    *column = self->column;
-    *fatal = self->fatal;
-    return 0;
-}
-
-rc_t CC RejectedGetData( const Rejected* self, const void** data, size_t* length )
-{
-    assert(self);
-    assert(data);
-    assert(length);
-    *data = self->source.addr;
-    *length = StringSize( & self->source );
-    return 0;
-}
-
-/*--------------------------------------------------------------------------
- * ReferenceInfo
- */
-rc_t CC ReferenceInfoAddRef ( const ReferenceInfo *self )
-{
-    assert(self);
-    assert(self->vt.v1->addRef);
-    return self->vt.v1->addRef(self);
-}
-
-rc_t CC ReferenceInfoRelease ( const ReferenceInfo *self )
-{
-    assert(self);
-    assert(self->vt.v1->release);
-    return self->vt.v1->release(self);
-}
-
-rc_t CC ReferenceInfoGetRefSeqCount ( const ReferenceInfo *self, uint32_t* count )
-{
-    assert(self);
-    assert(self->vt.v1->getRefSeqCount);
-    return self->vt.v1->getRefSeqCount(self, count);
-}
-
-rc_t CC ReferenceInfoGetRefSeq ( const ReferenceInfo *self, uint32_t n, ReferenceSequence *result )
-{
-    assert(self);
-    assert(self->vt.v1->getRefSeq);
-    return self->vt.v1->getRefSeq(self, n, result);
-}
-
-rc_t CC ReferenceInfoGetReadGroupCount ( const ReferenceInfo *self, uint32_t *count )
-{
-    assert(self);
-    assert(self->vt.v1->getReadGroupCount);
-    return self->vt.v1->getReadGroupCount(self, count);
-}
-
-rc_t CC ReferenceInfoGetReadGroup ( const ReferenceInfo *self, unsigned n, ReadGroup *result )
-{
-    assert(self);
-    assert(self->vt.v1->getReadGroup);
-    return self->vt.v1->getReadGroup(self, n, result);
-}
-
-rc_t CC ReferenceInfoGetReadGroupByName ( const ReferenceInfo *self, const char *name, ReadGroup *result )
-{
-    assert(self);
-    assert(self->vt.v1->getReadGroupByName );
-    return self->vt.v1->getReadGroupByName(self, name, result);
-}
diff --git a/libs/loader/common-writer.c b/libs/loader/common-writer.c
deleted file mode 100644
index 2c0f5e0..0000000
--- a/libs/loader/common-writer.c
+++ /dev/null
@@ -1,2074 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
- 
-#include <sysalloc.h>
-#include <string.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <klib/printf.h>
-#include <klib/status.h>
-
-#include <kdb/btree.h>
-
-#include <kfs/pmem.h>
-#include <kfs/file.h>
-#include <kfs/pagefile.h>
-
-#include <kapp/progressbar.h>
-#include <kapp/main.h>
-
-#include <vdb/manager.h>
-#include <vdb/database.h>
-
-#include <loader/sequence-writer.h>
-#include <loader/alignment-writer.h>
-#include <loader/reference-writer.h>
-#include <loader/common-writer.h>
-#include <loader/common-reader-priv.h>
-
-/*--------------------------------------------------------------------------
- * ctx_value_t, FragmentInfo
- */
-typedef struct {
-    uint32_t primaryId[2];
-    uint32_t spotId;
-    uint32_t fragmentId;
-    uint16_t seqHash[2];
-    uint8_t  platform;
-    uint8_t  pId_ext[2];
-    uint8_t  spotId_ext;
-    uint8_t  alignmentCount[2]; /* 0..254; 254: saturated max; 255: special meaning "too many" */
-    uint8_t  unmated: 1,
-             pcr_dup: 1,
-             has_a_read: 1,
-             unaligned_1: 1,
-             unaligned_2: 1;
-} ctx_value_t;
-
-#define CTX_VALUE_SET_P_ID(O,N,V) do { int64_t tv = (V); (O).primaryId[N] = (uint32_t)tv; (O).pId_ext[N] = tv >> 32; } while(0);
-#define CTX_VALUE_GET_P_ID(O,N) ((((int64_t)((O).pId_ext[N])) << 32) | (O).primaryId[N])
-
-#define CTX_VALUE_SET_S_ID(O,V) do { int64_t tv = (V); (O).spotId = (uint32_t)tv; (O).spotId_ext = tv >> 32; } while(0);
-#define CTX_VALUE_GET_S_ID(O) ((((int64_t)(O).spotId_ext) << 32) | (O).spotId)
-
-typedef struct FragmentInfo {
-    uint64_t ti;
-    uint32_t readlen;
-    uint8_t  aligned;
-    uint8_t  is_bad;
-    uint8_t  orientation;
-    uint8_t  otherReadNo;
-    uint8_t  sglen;
-    uint8_t  cskey;
-} FragmentInfo;
-
-
-rc_t OpenKBTree(const CommonWriterSettings* settings, struct KBTree **const rslt, size_t const n, size_t const max)
-{
-    size_t const cacheSize = (((settings->cache_size - (settings->cache_size / 2) - (settings->cache_size / 8)) / max)
-                            + 0xFFFFF) & ~((size_t)0xFFFFF);
-    KFile *file = NULL;
-    KDirectory *dir;
-    char fname[4096];
-    rc_t rc;
-
-    rc = KDirectoryNativeDir(&dir);
-    if (rc)
-        return rc;
-    
-    rc = string_printf(fname, sizeof(fname), NULL, "%s/key2id.%u.%u", settings->tmpfs, settings->pid, n); if (rc) return rc;
-    STSMSG(1, ("Path for scratch files: %s\n", fname));
-    rc = KDirectoryCreateFile(dir, &file, true, 0600, kcmInit, fname);
-    KDirectoryRemove(dir, 0, fname);
-    KDirectoryRelease(dir);
-    if (rc == 0) {
-        rc = KBTreeMakeUpdate(rslt, file, cacheSize,
-                              false, kbtOpaqueKey,
-                              1, 255, sizeof ( uint32_t ),
-                              NULL
-                              );
-        KFileRelease(file);
-#if PERF
-        if (rc == 0) {
-            static unsigned treecount = 0;
-
-            (void)PLOGMSG(klogInfo, (klogInfo, "Number of trees: $(cnt)", "cnt=%u", ++treecount));
-        }
-#endif
-    }
-    return rc;
-}
-
-rc_t GetKeyIDOld(const CommonWriterSettings* settings, SpotAssembler* const ctx, uint64_t *const rslt, bool *const wasInserted, char const key[], char const name[], size_t const namelen)
-{
-    size_t const keylen = strlen(key);
-    rc_t rc;
-    uint64_t tmpKey;
-
-    if (ctx->key2id_count == 0) {
-        rc = OpenKBTree(settings, &ctx->key2id[0], 1, 1);
-        if (rc) return rc;
-        ctx->key2id_count = 1;
-    }
-    if (memcmp(key, name, keylen) == 0) {
-        /* qname starts with read group; no append */
-        tmpKey = ctx->idCount[0];
-        rc = KBTreeEntry(ctx->key2id[0], &tmpKey, wasInserted, name, namelen);
-    }
-    else {
-        char sbuf[4096];
-        char *buf = sbuf;
-        char *hbuf = NULL;
-        size_t bsize = sizeof(sbuf);
-        size_t actsize;
-        
-        if (keylen + namelen + 2 > bsize) {
-            hbuf = malloc(bsize = keylen + namelen + 2);
-            if (hbuf == NULL)
-                return RC(rcExe, rcName, rcAllocating, rcMemory, rcExhausted);
-            buf = hbuf;
-        }
-        rc = string_printf(buf, bsize, &actsize, "%s\t%.*s", key, (int)namelen, name);
-        
-        tmpKey = ctx->idCount[0];
-        rc = KBTreeEntry(ctx->key2id[0], &tmpKey, wasInserted, buf, actsize);
-        if (hbuf)
-            free(hbuf);
-    }
-    if (rc == 0) {
-        *rslt = tmpKey;
-        if (*wasInserted)
-            ++ctx->idCount[0];
-    }
-    return rc;
-}
-
-#if _DEBUGGING
-static char const *Print_ctx_value_t(ctx_value_t const *const self)
-{
-    static char buffer[4096];
-    uint8_t const *const flag = self->alignmentCount + 2;
-    rc_t rc = string_printf(buffer, sizeof(buffer), NULL,
-                            "pid: { %lu, %lu }, sid: %lu, fid: %u, alc: { %u, %u }, flg: %x",
-                            CTX_VALUE_GET_P_ID(*self, 0),
-                            CTX_VALUE_GET_P_ID(*self, 1),
-                            CTX_VALUE_GET_S_ID(*self),
-                            self->fragmentId,
-                            self->alignmentCount[0],
-                            self->alignmentCount[1],
-                            *flag);
-
-    if (rc)
-        return 0;
-    return buffer;
-}
-#endif
-
-static unsigned HashKey(void const *const key, size_t const keylen)
-{
-    /* There is nothing special about this hash. It was randomly generated. */
-    static const uint8_t T1[] = {
-         64, 186,  39, 203,  54, 211,  98,  32,  26,  23, 219,  94,  77,  60,  56, 184,
-        129, 242,  10,  91,  84, 192,  19, 197, 231, 133, 125, 244,  48, 176, 160, 164,
-         17,  41,  57, 137,  44, 196, 116, 146, 105,  40, 122,  47, 220, 226, 213, 212,
-        107, 191,  52, 144,   9, 145,  81, 101, 217, 206,  85, 134, 143,  58, 128,  20,
-        236, 102,  83, 149, 148, 180, 167, 163,  12, 239,  31,   0,  73, 152,   1,  15,
-         75, 200,   4, 165,   5,  66,  25, 111, 255,  70, 174, 151,  96, 126, 147,  34,
-        112, 161, 127, 181, 237,  78,  37,  74, 222, 123,  21, 132,  95,  51, 141,  45,
-         61, 131, 193,  68,  62, 249, 178,  33,   7, 195, 228,  82,  27,  46, 254,  90,
-        185, 240, 246, 124, 205, 182,  42,  22, 198,  69, 166,  92, 169, 136, 223, 245,
-        118,  97, 115,  80, 252, 209,  49,  79, 221,  38,  28,  35,  36, 208, 187, 248,
-        158, 201, 202, 168,   2,  18, 189, 119, 216, 214,  11,   6,  89,  16, 229, 109,
-        120,  43, 162, 106, 204,   8, 199, 235, 142, 210,  86, 153, 227, 230,  24, 100,
-        224, 113, 190, 243, 218, 215, 225, 173,  99, 238, 138,  59, 183, 154, 171, 232,
-        157, 247, 233,  67,  88,  50, 253, 251, 140, 104, 156, 170, 150, 103, 117, 110,
-        155,  72, 207, 250, 159, 194, 177, 130, 135,  87,  71, 175,  14,  55, 172, 121,
-        234,  13,  30, 241,  93, 188,  53, 114,  76,  29,  65,   3, 179, 108,  63, 139
-    };
-    unsigned h = 0x55;
-    size_t i = keylen;
-    
-    do { h = T1[h ^ ((uint8_t)i)]; } while ((i >>= 8) != 0);
-
-    for (i = 0; i != keylen; ++i)
-        h = T1[h ^ ((uint8_t const *)key)[i]];
-
-    return h;
-}
-
-static unsigned SeqHashKey(void const *const key, size_t const keylen)
-{
-    /* There is nothing special about this hash. It was randomly generated. */
-    static const uint8_t T1[] = {
-         64, 186,  39, 203,  54, 211,  98,  32,  26,  23, 219,  94,  77,  60,  56, 184,
-        129, 242,  10,  91,  84, 192,  19, 197, 231, 133, 125, 244,  48, 176, 160, 164,
-         17,  41,  57, 137,  44, 196, 116, 146, 105,  40, 122,  47, 220, 226, 213, 212,
-        107, 191,  52, 144,   9, 145,  81, 101, 217, 206,  85, 134, 143,  58, 128,  20,
-        236, 102,  83, 149, 148, 180, 167, 163,  12, 239,  31,   0,  73, 152,   1,  15,
-         75, 200,   4, 165,   5,  66,  25, 111, 255,  70, 174, 151,  96, 126, 147,  34,
-        112, 161, 127, 181, 237,  78,  37,  74, 222, 123,  21, 132,  95,  51, 141,  45,
-         61, 131, 193,  68,  62, 249, 178,  33,   7, 195, 228,  82,  27,  46, 254,  90,
-        185, 240, 246, 124, 205, 182,  42,  22, 198,  69, 166,  92, 169, 136, 223, 245,
-        118,  97, 115,  80, 252, 209,  49,  79, 221,  38,  28,  35,  36, 208, 187, 248,
-        158, 201, 202, 168,   2,  18, 189, 119, 216, 214,  11,   6,  89,  16, 229, 109,
-        120,  43, 162, 106, 204,   8, 199, 235, 142, 210,  86, 153, 227, 230,  24, 100,
-        224, 113, 190, 243, 218, 215, 225, 173,  99, 238, 138,  59, 183, 154, 171, 232,
-        157, 247, 233,  67,  88,  50, 253, 251, 140, 104, 156, 170, 150, 103, 117, 110,
-        155,  72, 207, 250, 159, 194, 177, 130, 135,  87,  71, 175,  14,  55, 172, 121,
-        234,  13,  30, 241,  93, 188,  53, 114,  76,  29,  65,   3, 179, 108,  63, 139
-    };
-    unsigned h1 = 0x55;
-    unsigned h2 = 0x22;
-    size_t i = keylen;
-    
-    do { h1 = T1[h1 ^ ((uint8_t)i)]; } while ((i >>= 8) != 0);
-
-    for (i = 0; i != keylen; ++i)
-    {
-        unsigned temp = ((uint8_t const *)key)[i];
-        h1 = T1[h1 ^ temp];
-        h2 = T1[h2 ^ temp];
-    }
-
-    return (h1 << 8) | h2;
-}
-
-#define USE_ILLUMINA_NAMING_POUND_NUMBER_SLASH_HACK 1
-
-static size_t GetFixedNameLength(char const name[], size_t const namelen)
-{
-#if USE_ILLUMINA_NAMING_POUND_NUMBER_SLASH_HACK
-    char const *const pound = string_chr(name, namelen, '#');
-    
-    if (pound && pound + 2u < name + namelen && pound[1] >= '0' && pound[1] <= '9' && pound[2] == '/') {
-        return (size_t)(pound - name) + 2u;
-    }
-#endif
-    return namelen;
-}
-
-rc_t GetKeyID(CommonWriterSettings *const settings,
-              SpotAssembler *const ctx,
-              uint64_t *const rslt,
-              bool *const wasInserted,
-              char const key[],
-              char const name[],
-              size_t const o_namelen)
-{
-    size_t const namelen = GetFixedNameLength(name, o_namelen);
-
-    if (ctx->key2id_max == 1)
-        return GetKeyIDOld(settings, ctx, rslt, wasInserted, key, name, namelen);
-    else {
-        size_t const keylen = strlen(key);
-        unsigned const h = HashKey(key, keylen);
-        size_t f;
-        size_t e = ctx->key2id_count;
-        uint64_t tmpKey;
-        
-        *rslt = 0;
-        {{
-            uint32_t const bucket_value = ctx->key2id_hash[h];
-            unsigned const n  = (uint8_t) bucket_value;
-            unsigned const i1 = (uint8_t)(bucket_value >>  8);
-            unsigned const i2 = (uint8_t)(bucket_value >> 16);
-            unsigned const i3 = (uint8_t)(bucket_value >> 24);
-            
-            if (n > 0 && strcmp(key, ctx->key2id_names + ctx->key2id_name[i1]) == 0) {
-                f = i1;
-                /*
-                ctx->key2id_hash[h] = (i3 << 24) | (i2 << 16) | (i1 << 8) | n;
-                 */
-                goto GET_ID;
-            }
-            if (n > 1 && strcmp(key, ctx->key2id_names + ctx->key2id_name[i2]) == 0) {
-                f = i2;
-                ctx->key2id_hash[h] = (i3 << 24) | (i1 << 16) | (i2 << 8) | n;
-                goto GET_ID;
-            }
-            if (n > 2 && strcmp(key, ctx->key2id_names + ctx->key2id_name[i3]) == 0) {
-                f = i3;
-                ctx->key2id_hash[h] = (i2 << 24) | (i1 << 16) | (i3 << 8) | n;
-                goto GET_ID;
-            }
-        }}
-        f = 0;
-        while (f < e) {
-            size_t const m = (f + e) / 2;
-            size_t const oid = ctx->key2id_oid[m];
-            int const diff = strcmp(key, ctx->key2id_names + ctx->key2id_name[oid]);
-            
-            if (diff < 0)
-                e = m;
-            else if (diff > 0)
-                f = m + 1;
-            else {
-                f = oid;
-                goto GET_ID;
-            }
-        }
-        if (ctx->key2id_count < ctx->key2id_max) {
-            size_t const name_max = ctx->key2id_name_max + keylen + 1;
-            KBTree *tree;
-            rc_t rc = OpenKBTree(settings, &tree, ctx->key2id_count + 1, 1); /* ctx->key2id_max); */
-            
-            if (rc) return rc;
-            
-            if (ctx->key2id_name_alloc < name_max) {
-                size_t alloc = ctx->key2id_name_alloc;
-                void *tmp;
-                
-                if (alloc == 0)
-                    alloc = 4096;
-                while (alloc < name_max)
-                    alloc <<= 1;
-                tmp = realloc(ctx->key2id_names, alloc);
-                if (tmp == NULL)
-                    return RC(rcExe, rcName, rcAllocating, rcMemory, rcExhausted);
-                ctx->key2id_names = tmp;
-                ctx->key2id_name_alloc = alloc;
-            }
-            if (f < ctx->key2id_count) {
-                memmove(&ctx->key2id_oid[f + 1], &ctx->key2id_oid[f], (ctx->key2id_count - f) * sizeof(ctx->key2id_oid[f]));
-            }
-            ctx->key2id_oid[f] = ctx->key2id_count;
-            ++ctx->key2id_count;
-            f = ctx->key2id_oid[f];
-            ctx->key2id_name[f] = ctx->key2id_name_max;
-            ctx->key2id_name_max = name_max;
-
-            memcpy(&ctx->key2id_names[ctx->key2id_name[f]], key, keylen + 1);
-            ctx->key2id[f] = tree;
-            ctx->idCount[f] = 0;
-            if ((uint8_t)ctx->key2id_hash[h] < 3) {
-                unsigned const n = (uint8_t)ctx->key2id_hash[h] + 1;
-                
-                ctx->key2id_hash[h] = (uint32_t)((((ctx->key2id_hash[h] & ~(0xFFu)) | f) << 8) | n);
-            }
-            else {
-                /* the hash function isn't working too well
-                 * keep the 3 mru
-                 */
-                ctx->key2id_hash[h] = (uint32_t)((((ctx->key2id_hash[h] & ~(0xFFu)) | f) << 8) | 3);
-            }
-        GET_ID:
-            tmpKey = ctx->idCount[f];
-            rc = KBTreeEntry(ctx->key2id[f], &tmpKey, wasInserted, name, namelen);
-            if (rc == 0) {
-                *rslt = (((uint64_t)f) << 32) | tmpKey;
-                if (*wasInserted)
-                    ++ctx->idCount[f];
-                assert(tmpKey < ctx->idCount[f]);
-            }
-            return rc;
-        }
-        return RC(rcExe, rcTree, rcAllocating, rcConstraint, rcViolated);
-    }
-}
-
-static rc_t OpenMMapFile(const CommonWriterSettings* settings, SpotAssembler *const ctx, KDirectory *const dir)
-{
-    KFile *file = NULL;
-    char fname[4096];
-    rc_t rc = string_printf(fname, sizeof(fname), NULL, "%s/id2value.%u", settings->tmpfs, settings->pid);
-    
-    if (rc)
-        return rc;
-    
-    rc = KDirectoryCreateFile(dir, &file, true, 0600, kcmInit, fname);
-    KDirectoryRemove(dir, 0, fname);
-    if (rc == 0)
-        rc = MMArrayMake(&ctx->id2value, file, sizeof(ctx_value_t));
-    KFileRelease(file);
-    return rc;
-}
-
-static rc_t OpenMBankFile(const CommonWriterSettings* settings, SpotAssembler *const ctx, KDirectory *const dir, int which, size_t climit)
-{
-    KFile *file = NULL;
-    char fname[4096];
-    char const *const suffix = which == 1 ? "One" : "Both";
-    KMemBank **const mbank = which == 1 ? &ctx->fragsOne : &ctx->fragsBoth;
-    rc_t rc = string_printf(fname, sizeof(fname), NULL, "%s/frag_data%s.%u", settings->tmpfs, suffix, settings->pid);
-    
-    if (rc)
-        return rc;
-    
-    rc = KDirectoryCreateFile(dir, &file, true, 0600, kcmInit, fname);
-    KDirectoryRemove(dir, 0, fname);
-    if (rc == 0) {
-        KPageFile *backing;
-        
-        rc = KPageFileMakeUpdate(&backing, file, climit, false);
-        KFileRelease(file);
-        if (rc == 0) {
-            rc = KMemBankMake(mbank, FRAG_CHUNK_SIZE, 0, backing);
-            KPageFileRelease(backing);
-        }
-    }
-    return rc;
-}
-
-rc_t SetupContext(const CommonWriterSettings* settings, SpotAssembler *ctx)
-{
-    rc_t rc = 0;
-
-    memset(ctx, 0, sizeof(*ctx));
-    
-    ctx->pass = 1;
-    
-    if (settings->mode == mode_Archive) {
-        KDirectory *dir;
-        size_t fragSizeBoth; /*** temporary hold for first side of mate pair with both sides aligned**/
-        size_t fragSizeOne; /*** temporary hold for first side of mate pair with one side aligned**/
-
-        STSMSG(1, ("Cache size: %uM\n", settings->cache_size / 1024 / 1024));
-        
-        fragSizeBoth    =   (settings->cache_size / 8);
-        fragSizeOne     =   (settings->cache_size / 2);
-
-        rc = KLoadProgressbar_Make(&ctx->progress[0], 0); if (rc) return rc;
-        rc = KLoadProgressbar_Make(&ctx->progress[1], 0); if (rc) return rc;
-        rc = KLoadProgressbar_Make(&ctx->progress[2], 0); if (rc) return rc;
-        rc = KLoadProgressbar_Make(&ctx->progress[3], 0); if (rc) return rc;
-        
-        KLoadProgressbar_Append(ctx->progress[0], 100 * settings->numfiles);
-        
-        rc = KDirectoryNativeDir(&dir);
-        if (rc == 0)
-            rc = OpenMMapFile(settings, ctx, dir);
-        if (rc == 0)
-            rc = OpenMBankFile(settings, ctx, dir, 0, fragSizeBoth);
-        if (rc == 0)
-            rc = OpenMBankFile(settings, ctx, dir, 1, fragSizeOne);
-        KDirectoryRelease(dir);
-    }
-    return rc;
-}
-
-void ContextReleaseMemBank(SpotAssembler *ctx)
-{
-    KMemBankRelease(ctx->fragsOne);
-    ctx->fragsOne = NULL;
-    KMemBankRelease(ctx->fragsBoth);
-    ctx->fragsBoth = NULL;
-}
-
-void ContextRelease(SpotAssembler *ctx)
-{
-    KLoadProgressbar_Release(ctx->progress[0], true);
-    KLoadProgressbar_Release(ctx->progress[1], true);
-    KLoadProgressbar_Release(ctx->progress[2], true);
-    KLoadProgressbar_Release(ctx->progress[3], true);
-    MMArrayWhack(ctx->id2value);
-}
-
-static
-rc_t WriteSoloFragments(const CommonWriterSettings* settings, SpotAssembler* ctx, SequenceWriter *seq)
-{
-    uint32_t i;
-    unsigned j;
-    uint32_t fcountOne  = 0;
-    uint32_t fcountBoth = 0;
-    uint64_t idCount = 0;
-    rc_t rc;
-    KDataBuffer fragBuf;
-    SequenceRecord srec;
-    
-    ++ctx->pass;
-    memset(&srec, 0, sizeof(srec));
-    
-    rc = KDataBufferMake(&fragBuf, 8, 0);
-    if (rc) {
-        (void)LOGERR(klogErr, rc, "KDataBufferMake failed");
-        return rc;
-    }
-    for (idCount = 0, j = 0; j < ctx->key2id_count; ++j) {
-        idCount += ctx->idCount[j];
-    }
-    KLoadProgressbar_Append(ctx->progress[ctx->pass - 1], idCount);
-    
-    for (idCount = 0, j = 0; j < ctx->key2id_count; ++j) {
-        for (i = 0; i != ctx->idCount[j]; ++i, ++idCount) {
-            uint64_t const keyId = ((uint64_t)j << 32) | i;
-            ctx_value_t *value;
-            size_t rsize;
-            uint64_t id;
-            uint64_t sz;
-            unsigned readLen[2];
-            unsigned read = 0;
-            FragmentInfo const *fip;
-            uint8_t const *src;
-            KMemBank *frags;
-            
-            rc = MMArrayGet(ctx->id2value, (void **)&value, keyId);
-            if (rc)
-                break;
-            KLoadProgressbar_Process(ctx->progress[ctx->pass - 1], 1, false);
-            if (value->fragmentId == 0)
-                continue;
-            if (value->fragmentId & 1) {
-                frags = ctx->fragsOne;
-                fcountOne++;
-            }
-            else {
-                frags = ctx->fragsBoth; 
-                fcountBoth++;
-            }
-            id = value->fragmentId >> 1;
-            
-            rc = KMemBankSize(frags, id, &sz);
-            if (rc) {
-                (void)LOGERR(klogErr, rc, "KMemBankSize failed");
-                break;
-            }
-            rc = KDataBufferResize(&fragBuf, (size_t)sz);
-            if (rc) {
-                (void)LOGERR(klogErr, rc, "KDataBufferResize failed");
-                break;
-            }
-            rc = KMemBankRead(frags, id, 0, fragBuf.base, sz, &rsize);
-            if (rc) {
-                (void)LOGERR(klogErr, rc, "KMemBankRead failed");
-                break;
-            }
-            assert( rsize == sz );
-            fip = (FragmentInfo const *)fragBuf.base;
-            src = (uint8_t const *)&fip[1];
-            
-            readLen[0] = readLen[1] = 0;
-            if (!value->unmated && (   (fip->aligned && CTX_VALUE_GET_P_ID(*value, 0) == 0)
-                                     || (value->unaligned_2)))
-            {
-                read = 1;
-            }
-            
-            readLen[read] = fip->readlen;
-            rc = SequenceRecordInit(&srec, value->unmated ? 1 : 2, readLen);
-            if (rc) {
-                (void)LOGERR(klogErr, rc, "SequenceRecordInit failed");
-                break;
-            }
-            
-            srec.ti[read] = fip->ti;
-            srec.aligned[read] = fip->aligned;
-            srec.is_bad[read] = fip->is_bad;
-            srec.orientation[read] = fip->orientation;
-            srec.cskey[read] = fip->cskey;
-            memcpy(srec.seq + srec.readStart[read], src, srec.readLen[read]);
-            src += fip->readlen;
-            
-            memcpy(srec.qual + srec.readStart[read], src, srec.readLen[read]);
-            src += fip->readlen;
-            srec.spotGroup = (char *)src;
-            srec.spotGroupLen = fip->sglen;
-            srec.keyId = keyId;
-            
-            rc = SequenceWriteRecord(seq, &srec, ctx->isColorSpace, value->pcr_dup, value->platform, 
-                                    settings->keepMismatchQual, settings->no_real_output, settings->hasTI, settings->QualQuantizer);
-            if (rc) {
-                (void)LOGERR(klogErr, rc, "SequenceWriteRecord failed");
-                break;
-            }
-            /*rc = KMemBankFree(frags, id);*/
-            CTX_VALUE_SET_S_ID(*value, ++ctx->spotId);
-        }
-    }
-    /*printf("DONE_SOLO:\tcnt2=%d\tcnt1=%d\n",fcountBoth,fcountOne);*/
-    KDataBufferWhack(&fragBuf);
-    KDataBufferWhack(&srec.storage);
-    return rc;
-}
-
-static
-rc_t AlignmentUpdateSpotInfo(SpotAssembler *ctx, struct AlignmentWriter *align, uint64_t maxDistance)
-{
-    rc_t rc;
-    
-    ++ctx->pass;
-
-    KLoadProgressbar_Append(ctx->progress[ctx->pass - 1], ctx->alignCount);
-
-    rc = AlignmentStartUpdatingSpotIds(align);
-    while (rc == 0 && (rc = Quitting()) == 0) {
-        ctx_value_t const *value;
-        uint64_t keyId;
-        int64_t alignId;
-        bool isPrimary;
-        
-        rc = AlignmentGetSpotKey(align, &keyId, &alignId, &isPrimary);
-        if (rc) {
-            if (GetRCObject(rc) == rcRow && GetRCState(rc) == rcNotFound)
-                rc = 0;
-            break;
-        }
-        assert(keyId >> 32 < ctx->key2id_count);
-        assert((uint32_t)keyId < ctx->idCount[keyId >> 32]);
-        rc = MMArrayGet(ctx->id2value, (void **)&value, keyId);
-        if (rc == 0) {
-            int64_t const spotId = CTX_VALUE_GET_S_ID(*value);
-            int64_t const id[] = {
-                CTX_VALUE_GET_P_ID(*value, 0),
-                CTX_VALUE_GET_P_ID(*value, 1)
-            };
-            int64_t mateId = 0;
-            ReferenceStart mateGlobalRefPos;
-            
-            memset(&mateGlobalRefPos, 0, sizeof(mateGlobalRefPos));
-            if (spotId == 0) {
-                assert(!isPrimary);
-                (void)PLOGMSG(klogWarn, (klogWarn, "Spot '$(id)' was never assigned a spot id, probably has no primary alignments", "id=%lx", keyId));
-                /* (void)PLOGMSG(klogWarn, (klogWarn, "Spot #$(i): { $(s) }", "i=%lu,s=%s", keyId, Print_ctx_value_t(value))); */
-            }
-            if (isPrimary) {
-                if (id[0] != 0 && id[1] != 0)
-                    mateId = alignId == id[0] ? id[1] : id[0];
-                
-                if (mateId && maxDistance && (id[0] > id[1] ? id[0] - id[1] : id[1] - id[0]) > maxDistance) {
-                    rc = AlignmentGetRefPos(align, mateId, &mateGlobalRefPos);
-                    if (rc) break;
-                }
-            }
-            rc = AlignmentUpdateInfo(align, spotId, mateId, &mateGlobalRefPos);
-        }
-        KLoadProgressbar_Process(ctx->progress[ctx->pass - 1], 1, false);
-    }
-    return rc;
-}
-
-rc_t SequenceUpdateAlignInfo(SpotAssembler *ctx, struct SequenceWriter *seq)
-{
-    rc_t rc = 0;
-    uint64_t row;
-    const ctx_value_t *value;
-    uint64_t keyId;
-    
-    ++ctx->pass;
-    KLoadProgressbar_Append(ctx->progress[ctx->pass - 1], ctx->spotId + 1);
-    
-    for (row = 1; row <= ctx->spotId; ++row) {
-        rc = SequenceReadKey(seq, row, &keyId);
-        if (rc) {
-            (void)PLOGERR(klogErr, (klogErr, rc, "Failed to get key for row $(row)", "row=%u", (unsigned)row));
-            break;
-        }
-        rc = MMArrayGet(ctx->id2value, (void **)&value, keyId);
-        if (rc) {
-            (void)PLOGERR(klogErr, (klogErr, rc, "Failed to read info for row $(row), index $(idx)", "row=%u,idx=%u", (unsigned)row, (unsigned)keyId));
-            break;
-        }
-        if (row != CTX_VALUE_GET_S_ID(*value)) {
-            rc = RC(rcApp, rcTable, rcWriting, rcData, rcUnexpected);
-            (void)PLOGMSG(klogErr, (klogErr, "Unexpected spot id $(spotId) for row $(row), index $(idx)", "spotId=%u,row=%u,idx=%u", (unsigned)CTX_VALUE_GET_S_ID(*value), (unsigned)row, (unsigned)keyId));
-            break;
-        }
-        {{
-            int64_t primaryId[2];
-            /*uint64_t const spotId = CTX_VALUE_GET_S_ID(*value);*/
-            
-            primaryId[0] = CTX_VALUE_GET_P_ID(*value, 0);
-            primaryId[1] = CTX_VALUE_GET_P_ID(*value, 1);
-            
-            rc = SequenceUpdateAlignData(seq, row, value->unmated ? 1 : 2,
-                                         primaryId,
-                                         value->alignmentCount);
-        }}
-        if (rc) {
-            (void)LOGERR(klogErr, rc, "Failed updating AlignmentWriter data in sequence table");
-            break;
-        }
-        KLoadProgressbar_Process(ctx->progress[ctx->pass - 1], 1, false);
-    }
-    return rc;
-}
-
-void EditAlignedQualities(const CommonWriterSettings* settings, uint8_t qual[], bool const hasMismatch[], unsigned readlen) /* generic */
-{
-    unsigned i;
-    
-    for (i = 0; i < readlen; ++i) {
-        uint8_t const q = hasMismatch[i] ? settings->alignedQualValue : qual[i];
-        
-        qual[i] = q;
-    }
-}
-
-void EditUnalignedQualities(uint8_t qual[], bool const hasMismatch[], unsigned readlen) /* generic */
-{
-    unsigned i;
-    
-    for (i = 0; i < readlen; ++i) {
-        uint8_t const q = (qual[i] & 0x7F) | (hasMismatch[i] ? 0x80 : 0);
-        
-        qual[i] = q;
-    }
-}
-
-bool platform_cmp(char const platform[], char const test[])
-{
-    unsigned i;
-
-    for (i = 0; ; ++i) {
-        int ch1 = test[i];
-        int ch2 = toupper(platform[i]);
-        
-        if (ch1 != ch2)
-            break;
-        if (ch1 == 0)
-            return true;
-    }
-    return false;
-}
-
-rc_t CheckLimitAndLogError(CommonWriterSettings* settings)
-{
-    ++settings->errCount;
-    if (settings->maxErrCount > 0 && settings->errCount > settings->maxErrCount) {
-        (void)PLOGERR(klogErr, (klogErr, RC(rcAlign, rcFile, rcReading, rcError, rcExcessive), 
-                                "Number of errors $(cnt) exceeds limit of $(max): Exiting", "cnt=%lu,max=%lu", 
-                                settings->errCount, settings->maxErrCount));
-        return RC(rcAlign, rcFile, rcReading, rcError, rcExcessive);
-    }
-    return 0;
-}
-
-void RecordNoMatch(const CommonWriterSettings* settings, char const readName[], char const refName[], uint32_t const refPos)
-{
-    if (settings->noMatchLog) {
-        static uint64_t lpos = 0;
-        char logbuf[256];
-        size_t len;
-        
-        if (string_printf(logbuf, sizeof(logbuf), &len, "%s\t%s\t%u\n", readName, refName, refPos) == 0) {
-            KFileWrite(settings->noMatchLog, lpos, logbuf, len, NULL);
-            lpos += len;
-        }
-    }
-}
-
-rc_t LogNoMatch(CommonWriterSettings* settings, char const readName[], char const refName[], unsigned rpos, unsigned matches)
-{
-    rc_t const rc = CheckLimitAndLogError(settings);
-    static unsigned count = 0;
-    
-    ++count;
-    if (rc) {
-        (void)PLOGMSG(klogInfo, (klogInfo, "This is the last warning; this class of warning occurred $(occurred) times",
-                                 "occurred=%u", count));
-        (void)PLOGMSG(klogWarn, (klogWarn, "Spot '$(name)' contains too few ($(count)) matching bases to reference '$(ref)' at $(pos)",
-                                 "name=%s,ref=%s,pos=%u,count=%u", readName, refName, rpos, matches));
-    }
-    else if (settings->maxWarnCount_NoMatch == 0 || count < settings->maxWarnCount_NoMatch)
-        (void)PLOGMSG(klogWarn, (klogWarn, "Spot '$(name)' contains too few ($(count)) matching bases to reference '$(ref)' at $(pos)",
-                                 "name=%s,ref=%s,pos=%u,count=%u", readName, refName, rpos, matches));
-    return rc;
-}
-
-rc_t LogDupConflict(CommonWriterSettings* settings, char const readName[])
-{
-    rc_t const rc = CheckLimitAndLogError(settings);
-    static unsigned count = 0;
-    
-    ++count;
-    if (rc) {
-        (void)PLOGMSG(klogInfo, (klogInfo, "This is the last warning; this class of warning occurred $(occurred) times",
-                                 "occurred=%u", count));
-        (void)PLOGERR(klogWarn, (klogWarn, RC(rcApp, rcFile, rcReading, rcData, rcInconsistent),
-                                 "Spot '$(name)' is both a duplicate and NOT a duplicate!",
-                                 "name=%s", readName));
-    }
-    else if (settings->maxWarnCount_DupConflict == 0 || count < settings->maxWarnCount_DupConflict)
-        (void)PLOGERR(klogWarn, (klogWarn, RC(rcApp, rcFile, rcReading, rcData, rcInconsistent),
-                                 "Spot '$(name)' is both a duplicate and NOT a duplicate!",
-                                 "name=%s", readName));
-    return rc;
-}
-
-void COPY_QUAL(uint8_t D[], uint8_t const S[], unsigned const L, bool const R)
-{
-    if (R) {
-        unsigned i;
-        unsigned j;
-        
-        for (i = 0, j = L - 1; i != L; ++i, --j)
-            D[i] = S[j];
-    }
-    else
-        memcpy(D, S, L);
-}
-
-void COPY_READ(INSDC_dna_text D[], INSDC_dna_text const S[], unsigned const L, bool const R)
-{
-    static INSDC_dna_text const compl[] = {
-         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
-         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
-         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
-         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
-         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
-         0 ,  0 ,  0 ,  0 ,  0 ,  0 , '.',  0 , 
-        '0', '1', '2', '3',  0 ,  0 ,  0 ,  0 , 
-         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
-         0 , 'T', 'V', 'G', 'H',  0 ,  0 , 'C', 
-        'D',  0 ,  0 , 'M',  0 , 'K', 'N',  0 , 
-         0 ,  0 , 'Y', 'S', 'A', 'A', 'B', 'W', 
-         0 , 'R',  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
-         0 , 'T', 'V', 'G', 'H',  0 ,  0 , 'C', 
-        'D',  0 ,  0 , 'M',  0 , 'K', 'N',  0 , 
-         0 ,  0 , 'Y', 'S', 'A', 'A', 'B', 'W', 
-         0 , 'R',  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
-         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
-         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
-         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
-         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
-         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
-         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
-         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
-         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
-         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
-         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
-         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
-         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
-         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
-         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
-         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
-         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0
-    };
-    if (R) {
-        unsigned i;
-        unsigned j;
-        
-        for (i = 0, j = L - 1; i != L; ++i, --j)
-            D[i] = compl[((uint8_t const *)S)[j]];
-    }
-    else
-        memcpy(D, S, L);
-}
-
-/*--------------------------------------------------------------------------
- * ArchiveFile
- */
-static uint8_t GetMapQ(Alignment const *rec)
-{
-    uint8_t mapQ;
-    
-    AlignmentGetMapQuality(rec, &mapQ);
-    return mapQ;
-}
-
-INSDC_SRA_platform_id PlatformToId(const char* name)
-{
-    if (name != NULL)
-    {
-        switch (toupper(name[0])) {
-        case 'C':
-            if (platform_cmp(name, "COMPLETE GENOMICS") || platform_cmp(name, "COMPLETE_GENOMICS"))
-                return SRA_PLATFORM_COMPLETE_GENOMICS;
-            if (platform_cmp(name, "CAPILLARY"))
-                return SRA_PLATFORM_SANGER;
-            break;
-        case 'H':
-            if (platform_cmp(name, "HELICOS"))
-                return SRA_PLATFORM_HELICOS;
-            break;
-        case 'I':
-            if (platform_cmp(name, "ILLUMINA"))
-                return SRA_PLATFORM_ILLUMINA;
-            if (platform_cmp(name, "IONTORRENT"))
-                return SRA_PLATFORM_ION_TORRENT;
-            break;
-        case 'L':
-            if (platform_cmp(name, "LS454"))
-                return SRA_PLATFORM_454;
-            break;
-        case 'P':
-            if (platform_cmp(name, "PACBIO"))
-                return SRA_PLATFORM_PACBIO_SMRT;
-            break;
-        case 'S':
-            if (platform_cmp(name, "SOLID"))
-                return SRA_PLATFORM_ABSOLID;
-            break;
-        default:
-            break;
-        }
-    }
-    return SRA_PLATFORM_UNDEFINED;
-}
-
-INSDC_SRA_platform_id GetINSDCPlatform(ReferenceInfo const *ref, char const name[]) {
-    if (ref != NULL && name != NULL) {
-        ReadGroup rg;
-
-        rc_t rc = ReferenceInfoGetReadGroupByName(ref, name, &rg);
-        if (rc == 0 && rg.platform) 
-            return PlatformToId(rg.platform) ;
-    }
-    return SRA_PLATFORM_UNDEFINED;
-}
-
-void ParseSpotName(char const name[], size_t* namelen)
-{ /* remove trailing #... */
-    const char* hash = string_chr(name, *namelen, '#');
-    if (hash)
-        *namelen = hash - name;
-}
-
-
-static const int8_t toPhred[] =
-{
-              0, 1, 1, 2, 2, 3, 3,
-     4, 4, 5, 5, 6, 7, 8, 9,10,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
-};
-
-static int8_t LogOddsToPhred ( int8_t logOdds )
-{ /* conversion table copied from interface/ncbi/seq.vschema */
-    if (logOdds < -6)
-        return 0;
-    if (logOdds > 40)
-        return 40;
-    return toPhred[logOdds + 6];
-}
-
-rc_t ArchiveFile(const struct ReaderFile *const reader,
-                 CommonWriterSettings *const G,
-                 struct SpotAssembler *const ctx,
-                 struct Reference *const ref,
-                 struct SequenceWriter *const seq,
-                 struct AlignmentWriter *const align,
-                 bool *const had_alignments,
-                 bool *const had_sequences)
-{
-    KDataBuffer buf;
-    KDataBuffer fragBuf;
-    KDataBuffer cigBuf;
-    rc_t rc;
-    int32_t lastRefSeqId = -1;
-    size_t rsize;
-    uint64_t keyId = 0;
-    uint64_t reccount = 0;
-    SequenceRecord srec;
-    char spotGroup[512];
-    size_t namelen;
-    unsigned progress = 0;
-    unsigned warned = 0;
-    long     fcountBoth=0;
-    long     fcountOne=0;
-    int skipRefSeqID = -1;
-    uint64_t recordsProcessed = 0;
-    uint64_t filterFlagConflictRecords=0; /*** counts number of conflicts between flags 'duplicate' and 'lowQuality' ***/
-#define MAX_WARNINGS_FLAG_CONFLICT 10000 /*** maximum errors to report ***/
-
-    bool isColorSpace = false;
-    bool isNotColorSpace = G->noColorSpace;
-    char alignGroup[32];
-    size_t alignGroupLen;
-    
-    const ReferenceInfo* header = NULL;
-    
-    rc = ReaderFileGetReferenceInfo(reader, &header);
-    if (rc)
-        return rc;
-
-    if (ctx->key2id_max == 0) {
-        if (header != NULL) {
-            uint32_t rgcount;
-            unsigned rgi;
-            
-            ReferenceInfoGetReadGroupCount(header, &rgcount);
-            if (rgcount > (sizeof(ctx->key2id)/sizeof(ctx->key2id[0]) - 1))
-                ctx->key2id_max = 1;
-            else
-                ctx->key2id_max = sizeof(ctx->key2id)/sizeof(ctx->key2id[0]);
-            
-            for (rgi = 0; rgi != rgcount; ++rgi) {
-                ReadGroup rg;
-                
-                rc_t rc2 = ReferenceInfoGetReadGroup(header, rgi, &rg);
-                if (rc2 == 0 && rg.platform && platform_cmp(rg.platform, "CAPILLARY")) {
-                    G->hasTI = true;
-                    break;
-                }
-            }
-        }
-        else
-            ctx->key2id_max = 1;        
-    }
-    
-    memset(&srec, 0, sizeof(srec));
-    
-    rc = KDataBufferMake(&cigBuf, 32, 0);
-    if (rc)
-        return rc;
-    
-    rc = KDataBufferMake(&fragBuf, 8, FRAG_CHUNK_SIZE);
-    if (rc)
-        return rc;
-    
-    rc = KDataBufferMake(&buf, (AlignmentRecordBufferSize(1, false) + sizeof(char) + sizeof(uint8_t)) * 8, 0);
-    if (rc)
-        return rc;
-    
-    if (rc == 0) {
-        (void)PLOGMSG(klogInfo, (klogInfo, "Loading '$(file)'", "file=%s", ReaderFileGetPathname(reader)));
-    }
-    
-    *had_alignments = false;
-    *had_sequences = false;
-    
-    while (rc == 0 && (rc = Quitting()) == 0) {
-        bool aligned;
-        AlignmentRecord data;
-        uint32_t readlen;
-        int64_t rpos=0;
-        char *seqDNA;
-        ReferenceSequence refSeq;
-        ctx_value_t *value;
-        bool wasInserted;
-        int32_t refSeqId=-1;
-        uint8_t *qual;
-        bool mated;
-        const char *name;
-        char cskey = 0;
-        bool originally_aligned;
-        bool isPrimary;
-        uint32_t opCount;
-        bool hasCG;
-        uint64_t ti = 0;
-        uint32_t csSeqLen = 0;
-        int readOrientation;
-        
-        const Record* record;
-        const Sequence* sequence = NULL;
-        const Alignment* alignment = NULL;
-        const CGData* cg = NULL;
-
-        rc = ReaderFileGetRecord(reader, &record);
-        if (GetRCObject(rc) == rcRow && (GetRCState(rc) == rcInvalid || GetRCState(rc) == rcEmpty)) {
-            (void)PLOGERR(klogWarn, (klogWarn, rc, "ArchiveFile: '$(file)' - row $(row)", "file=%s,row=%lu", ReaderFileGetPathname(reader), reccount + 1));
-            rc = CheckLimitAndLogError(G);
-        }
-        else if (rc || record == 0)
-            break;
-
-        {
-            const Rejected* rej;
-            rc = RecordGetRejected(record, &rej);
-            if (rc)
-            {
-                (void)LOGERR(klogErr, rc, "ArchiveFile: RecordGetSequence failed");
-                break;
-            }
-            if (rej != NULL)
-            {
-                const char* message;
-                uint64_t line;
-                uint64_t col;
-                bool fatal;
-                rc = RejectedGetError(rej, &message, &line, &col, &fatal);
-                if (rc)
-                {
-                    (void)LOGERR(klogErr, rc, "ArchiveFile: RejectedGetError failed");
-                    break;
-                }
-                (void)PLOGMSG(fatal ? klogErr : klogWarn, (fatal ? klogErr : klogWarn, 
-                              "$(file):$(l):$(c):$(msg)", "file=%s,l=%lu,c=%lu,msg=%s", 
-                              ReaderFileGetPathname(reader), line, col, message));
-                rc = CheckLimitAndLogError(G);
-                RejectedRelease(rej);
-                
-                if (fatal)
-                {
-                    rc = RC(rcExe, rcFile, rcParsing, rcFormat, rcUnsupported);
-                    break;
-                }
-                    
-                goto LOOP_END;
-            }
-        }
-        rc = RecordGetSequence(record, &sequence);
-        if (rc)
-        {
-            (void)LOGERR(klogErr, rc, "ArchiveFile: RecordGetSequence failed");
-            break;
-        }
-        rc = RecordGetAlignment(record, &alignment);
-        if (rc)
-        {
-            (void)LOGERR(klogErr, rc, "ArchiveFile: RecordGetAlignment failed");
-            break;
-        }
-        if (alignment != NULL)
-        {
-            rc = AlignmentGetCGData(alignment, &cg);      
-            if (rc)
-            {
-                (void)LOGERR(klogErr, rc, "ArchiveFile: AlignmentGetCG failed");
-                break;
-            }
-        }
-        
-        if ((unsigned)(ReaderFileGetProportionalPosition(reader) * 100.0) > progress) { 
-            unsigned new_value = ReaderFileGetProportionalPosition(reader) * 100.0;
-            KLoadProgressbar_Process(ctx->progress[0], new_value - progress, false);
-            progress = new_value;
-        }
-
-
-        /**************************************************************/
-        if (!G->noColorSpace) {
-            if (SequenceIsColorSpace(sequence)) {
-                if (isNotColorSpace) {
-                MIXED_BASE_AND_COLOR:
-                    rc = RC(rcApp, rcFile, rcReading, rcData, rcInconsistent);  
-                    (void)PLOGERR(klogErr, (klogErr, rc, "File '$(file)' contains base space and color space", "file=%s", ReaderFileGetPathname(reader)));
-                    goto LOOP_END;
-                }
-                ctx->isColorSpace = isColorSpace = true;
-            }
-            else if (isColorSpace)
-                goto MIXED_BASE_AND_COLOR;
-            else
-                isNotColorSpace = true;
-        }
-        hasCG = cg != NULL;
-        if (hasCG) {
-            AlignmentGetAlignOpCount(alignment, &opCount);
-            rc = KDataBufferResize(&cigBuf, opCount * 2 + 5);
-            if (rc) {
-                (void)LOGERR(klogErr, rc, "Failed to resize CIGAR buffer");
-                goto LOOP_END;
-            }
-            
-            rc = KDataBufferResize(&buf, readlen = 35);
-            if (rc) {
-                (void)LOGERR(klogErr, rc, "Failed to resize record buffer");
-                goto LOOP_END;
-            }
-            
-            AlignmentRecordInit(&data, buf.base, readlen, &seqDNA, G->expectUnsorted, G->compressQuality);
-            qual = (uint8_t *)&seqDNA[readlen];
-        }
-        else {
-            if (alignment != 0)
-            {
-                uint32_t const *tmp;
-                AlignmentGetBAMCigar(alignment, &tmp, &opCount);
-                rc = KDataBufferResize(&cigBuf, opCount);
-                if (rc) {
-                    (void)LOGERR(klogErr, rc, "Failed to resize CIGAR buffer");
-                    goto LOOP_END;
-                }
-                memcpy(cigBuf.base, tmp, opCount * sizeof(uint32_t));
-            }
-            
-            SequenceGetReadLength(sequence, &readlen);
-            if (isColorSpace) {
-                SequenceGetCSReadLength(sequence, &csSeqLen);
-                if (readlen > csSeqLen) {
-                    rc = RC(rcAlign, rcRow, rcReading, rcData, rcInconsistent);
-                    (void)LOGERR(klogErr, rc, "SequenceWriter length and CS SequenceWriter length are inconsistent");
-                    goto LOOP_END;
-                }
-                else if (readlen < csSeqLen)
-                {
-                    readlen = 0; /* will be hard clipped */
-                }
-            }
-            else if (readlen == 0) {
-            }
-            rc = KDataBufferResize(&buf, readlen | csSeqLen);
-            if (rc) {
-                (void)LOGERR(klogErr, rc, "Failed to resize record buffer");
-                goto LOOP_END;
-            }
-            
-            AlignmentRecordInit(&data, buf.base, readlen | csSeqLen, &seqDNA, G->expectUnsorted, G->compressQuality);
-            qual = (uint8_t *)&seqDNA[readlen | csSeqLen];
-        }
-        SequenceGetSpotName(sequence, &name, &namelen);
-        if (G->parseSpotName)
-            ParseSpotName(name, &namelen);
-        SequenceGetRead(sequence, seqDNA);
-        
-        {
-            int8_t const *squal;
-            uint8_t qoffset = 0;
-            int qualType=0;            
-            unsigned i;
-            
-            rc = SequenceGetQuality(sequence, &squal, &qoffset, &qualType);
-            if (rc) {
-                (void)PLOGERR(klogErr, (klogErr, rc, "Spot '$(name)': length of original quality does not match sequence", 
-                                                        "name=%.*s", (uint32_t)namelen, name));
-                rc = CheckLimitAndLogError(G);
-                goto LOOP_END;
-            }
-            else if (squal == NULL)
-                memset(qual, 0, readlen);
-            else 
-            {  
-                if (G->useQUAL)
-                    memcpy(qual, squal, readlen);
-                else
-                {
-                    switch (qualType)
-                    {
-                    case QT_LogOdds:
-                        for (i = 0; i != readlen; ++i)
-                            qual[i] = LogOddsToPhred(squal[i]);
-                        break;
-                        
-                    case QT_Phred:
-                        if (qoffset) {
-                            for (i = 0; i != readlen; ++i)
-                                qual[i] = squal[i] - qoffset;
-                        }
-                        else
-                            memcpy(qual, squal, readlen);
-                        break;
-                        
-                    default:
-                        memcpy(qual, squal, readlen);
-                        break;
-                    }
-                }
-            }
-        }
-        
-        if (hasCG) {
-            rc = CGDataGetSeqQual(cg, seqDNA, qual);
-            if (rc == 0)
-                rc = CGDataGetCigar(cg, cigBuf.base, cigBuf.elem_count, &opCount);
-            if (rc) {
-                (void)LOGERR(klogErr, rc, "Failed to read CG data");
-                goto LOOP_END;
-            }
-        }
-        if (G->hasTI) {
-            rc = SequenceGetTI(sequence, &ti);
-            if (rc)
-                ti = 0;
-            rc = 0;
-        }
-        data.data.align_group.buffer = alignGroup;
-        if (hasCG && CGDataGetAlignGroup(cg, alignGroup, sizeof(alignGroup), &alignGroupLen) == 0)
-            data.data.align_group.elements = alignGroupLen;
-        else
-            data.data.align_group.elements = 0;
-
-        if (alignment != 0)
-            AR_MAPQ(data) = GetMapQ(alignment);
-        {{
-            char const *rgname;
-            size_t rgnamelen;
-
-            SequenceGetSpotGroup(sequence, &rgname, &rgnamelen);
-            if (rgname)
-            {
-                string_copy(spotGroup, sizeof(spotGroup), rgname, rgnamelen);
-                spotGroup[rgnamelen] = '\0';
-            }
-            else
-                spotGroup[0] = '\0';
-        }}        
-        readOrientation = SequenceGetOrientationSelf(sequence);
-        AR_REF_ORIENT(data) = readOrientation == ReadOrientationReverse;
-        isPrimary = alignment == 0 || ! AlignmentIsSecondary(alignment);
-        if (G->noSecondary && !isPrimary)
-            goto LOOP_END;
-        originally_aligned = (alignment != 0);
-        aligned = originally_aligned && (AR_MAPQ(data) >= G->minMapQual);
-        
-        if (isColorSpace && readlen == 0)   /* detect hard clipped colorspace   */
-            aligned = false;                /* reads and make unaligned         */
-
-        if (aligned && align == NULL) {
-            rc = RC(rcApp, rcFile, rcReading, rcData, rcInconsistent);
-            (void)PLOGERR(klogErr, (klogErr, rc, "File '$(file)' contains aligned records", "file=%s", ReaderFileGetPathname(reader)));
-            goto LOOP_END;
-        }
-        if (header != NULL)
-        {
-            while (aligned) {
-                AlignmentGetPosition(alignment, &rpos);
-                AlignmentGetRefSeqId(alignment, &refSeqId);
-                if (rpos >= 0 && refSeqId >= 0) {
-                    if (refSeqId == skipRefSeqID)
-                        goto LOOP_END;
-                    if (refSeqId == lastRefSeqId)
-                        break;
-                    rc = ReferenceInfoGetRefSeq(header, refSeqId, &refSeq);
-                    if (rc != 0) {
-                        rc = RC(rcApp, rcFile, rcReading, rcData, rcInconsistent);
-                        (void)PLOGERR(klogWarn, (klogWarn, rc, "File '$(file)': Spot '$(name)' refers to an unknown Reference number $(refSeqId)", "file=%s,refSeqId=%i,name=%s", ReaderFileGetPathname(reader), (int)refSeqId, name));
-                        rc = CheckLimitAndLogError(G);
-                        goto LOOP_END;
-                    }
-                    else {
-                        if (G->refFilter && strcmp(G->refFilter, refSeq.name) != 0) {
-                            (void)PLOGMSG(klogInfo, (klogInfo, "Skipping Reference '$(name)'", "name=%s", refSeq.name));
-                            skipRefSeqID = refSeqId;
-                            goto LOOP_END;
-                        }
-                        
-                        rc = ReferenceSetFile(ref, refSeq.name, refSeq.length, refSeq.checksum, G->maxSeqLen);
-                        if (rc == 0) {
-                            lastRefSeqId = refSeqId;
-                            break;
-                        }
-                        if (GetRCObject(rc) == rcConstraint && GetRCState(rc) == rcViolated) {
-                            int const level = G->limit2config ? klogWarn : klogErr;
-                            
-                            (void)PLOGMSG(level, (level, "Could not find a Reference to match { name: '$(name)', length: $(rlen) }", "name=%s,rlen=%u", refSeq.name, (unsigned)refSeq.length));
-                        }
-                        else if (!G->limit2config)
-                            (void)PLOGERR(klogErr, (klogErr, rc, "File '$(file)': Spot '$(sname)' refers to an unknown Reference '$(rname)'", "file=%s,rname=%s,sname=%s", ReaderFileGetPathname(reader), refSeq.name, name));
-                        if (G->limit2config)
-                            rc = 0;
-                        goto LOOP_END;
-                    }
-                }
-                else {
-                    (void)PLOGMSG(klogWarn, (klogWarn, "Spot '$(name)' was marked aligned, but reference id = $(id) and reference position = $(pos) are invalid", "name=%.*s,id=%i,pos=%i", namelen, name, refSeqId, rpos));
-                    if ((rc = CheckLimitAndLogError(G)) != 0) goto LOOP_END;
-                }
-
-                aligned = false;
-            }
-        }
-        if (!aligned && (G->refFilter != NULL || G->limit2config))
-            goto LOOP_END;
-        
-        rc = GetKeyID(G, ctx, &keyId, &wasInserted, spotGroup, name, namelen);
-        if (rc) {
-            (void)PLOGERR(klogErr, (klogErr, rc, "KBTreeEntry: failed on key '$(key)'", "key=%.*s", namelen, name));
-            goto LOOP_END;
-        }
-        rc = MMArrayGet(ctx->id2value, (void **)&value, keyId);
-        if (rc) {
-            (void)PLOGERR(klogErr, (klogErr, rc, "MMArrayGet: failed on id '$(id)'", "id=%u", keyId));
-            goto LOOP_END;
-        }
-        
-        AR_KEY(data) = keyId;
-        
-        mated = false;
-        if (SequenceWasPaired(sequence)) {
-            if (SequenceIsFirst(sequence))
-                AR_READNO(data) |= 1;
-            if (SequenceIsSecond(sequence))
-                AR_READNO(data) |= 2;
-            switch (AR_READNO(data)) {
-            case 1:
-            case 2:
-                mated = true;
-                break;
-            case 0:
-                if ((warned & 1) == 0) {
-                    (void)LOGMSG(klogWarn, "Spots without fragment info have been encountered");
-                    warned |= 1;
-                }
-                break;
-            case 3:
-                if ((warned & 2) == 0) {
-                    (void)LOGMSG(klogWarn, "Spots with more than two fragments have been encountered");
-                    warned |= 2;
-                }
-                break;
-            }
-        }
-        if (!mated)
-            AR_READNO(data) = 1;
-        
-        if (wasInserted) {
-            memset(value, 0, sizeof(*value));
-            value->unmated = !mated;
-            value->pcr_dup = SequenceIsDuplicate(sequence);
-            value->platform = GetINSDCPlatform(header, spotGroup);
-            if (value->platform == SRA_PLATFORM_UNDEFINED)
-                value->platform = G->platform;
-        }
-        else {
-            if (!G->acceptBadDups && value->pcr_dup != SequenceIsDuplicate(sequence)) {
-                rc = LogDupConflict(G, name);
-                goto LOOP_END; /* TODO: is this correct? */
-            }
-            value->pcr_dup &= SequenceIsDuplicate(sequence);
-            if (mated && value->unmated) {
-                (void)PLOGERR(klogWarn, (klogWarn, RC(rcApp, rcFile, rcReading, rcData, rcInconsistent),
-                                         "Spot '$(name)', which was first seen without mate info, now has mate info",
-                                         "name=%s", name));
-                rc = CheckLimitAndLogError(G);
-                goto LOOP_END;
-            }
-            else if (!mated && !value->unmated) {
-                (void)PLOGERR(klogWarn, (klogWarn, RC(rcApp, rcFile, rcReading, rcData, rcInconsistent),
-                                         "Spot '$(name)', which was first seen with mate info, now has no mate info",
-                                         "name=%s", name));
-                rc = CheckLimitAndLogError(G);
-                goto LOOP_END;
-            }
-        }
-        
-        ++recordsProcessed;
-
-        if (isPrimary) {
-            switch (AR_READNO(data)) {
-            case 1:
-                if (CTX_VALUE_GET_P_ID(*value, 0) != 0)
-                {
-                    isPrimary = false;
-                    if (value->seqHash[0] != SeqHashKey(seqDNA, readlen))
-                    {
-                        (void)PLOGERR(klogWarn, (klogWarn, RC(rcApp, rcFile, rcReading, rcData, rcInconsistent),
-                                                 "Read 1 of spot '$(name)', possible sequence mismatch", "name=%s", name));
-                        rc = CheckLimitAndLogError(G);
-                        goto LOOP_END;
-                    }
-                }
-                else if (aligned && value->unaligned_1) {
-                    (void)PLOGMSG(klogWarn, (klogWarn, "Read 1 of spot '$(name)', which was unmapped, is now being mapped at position $(pos) on reference '$(ref)'; this alignment will be considered as secondary", "name=%s,ref=%s,pos=%u", name, refSeq.name, rpos));
-                    isPrimary = false;
-                }
-                break;
-            case 2:
-                if (CTX_VALUE_GET_P_ID(*value, 1) != 0)
-                {
-                    isPrimary = false;
-                    if (value->seqHash[1] != SeqHashKey(seqDNA, readlen))
-                    {
-                        (void)PLOGERR(klogWarn, (klogWarn, RC(rcApp, rcFile, rcReading, rcData, rcInconsistent),
-                                                 "Read 2 of spot '$(name)', possible sequence mismatch", "name=%s", name));
-                        rc = CheckLimitAndLogError(G);
-                        goto LOOP_END;
-                    }
-                }
-                else if (aligned && value->unaligned_2) {
-                    (void)PLOGMSG(klogWarn, (klogWarn, "Read 2 of spot '$(name)', which was unmapped, is now being mapped at position $(pos) on reference '$(ref)'; this alignment will be considered as secondary", "name=%s,ref=%s,pos=%u", name, refSeq.name, rpos));
-                    isPrimary = false;
-                }
-                break;
-            default:
-                break;
-            }
-        }
-        data.isPrimary = isPrimary;
-        if (aligned) {
-            uint32_t matches = 0;
-            
-            rc = ReferenceRead(ref, &data, rpos, cigBuf.base, opCount, seqDNA, readlen, &matches, G->acceptNoMatch, G->minMatchCount, G->maxSeqLen);
-            if (rc) {
-                aligned = false;
-                
-                if (   (GetRCState(rc) == rcViolated  && GetRCObject(rc) == rcConstraint)
-                    || (GetRCState(rc) == rcExcessive && GetRCObject(rc) == rcRange))
-                {
-                    RecordNoMatch(G, name, refSeq.name, rpos);
-                }
-                if (GetRCState(rc) == rcViolated && GetRCObject(rc) == rcConstraint) {
-                    rc = LogNoMatch(G, name, refSeq.name, (unsigned)rpos, (unsigned)matches);
-                }
-                else if (GetRCObject(rc) == rcData && GetRCState(rc) == rcInvalid) {
-                    (void)PLOGERR(klogWarn, (klogWarn, rc, "Spot '$(name)': bad alignment to reference '$(ref)' at $(pos)", "name=%s,ref=%s,pos=%u", name, refSeq.name, rpos));
-                    rc = CheckLimitAndLogError(G);
-                }
-                else if (GetRCObject(rc) == rcData) {
-                    (void)PLOGERR(klogWarn, (klogWarn, rc, "Spot '$(name)': bad alignment to reference '$(ref)' at $(pos)", "name=%s,ref=%s,pos=%u", name, refSeq.name, rpos));
-                    rc = CheckLimitAndLogError(G);
-                }
-                else {
-                    (void)PLOGERR(klogWarn, (klogWarn, rc, "Spot '$(name)': error reading reference '$(ref)' at $(pos)", "name=%s,ref=%s,pos=%u", name, refSeq.name, rpos));
-                    rc = CheckLimitAndLogError(G);
-                }
-                if (rc) goto LOOP_END;
-            }
-        }
-        if (isColorSpace) {
-            /* must be after ReferenceRead */
-            SequenceGetCSKey(sequence, &cskey);
-            SequenceGetCSRead(sequence, seqDNA);
-            if (!aligned && !G->useQUAL) {
-                int8_t const *squal;
-                uint8_t qoffset = 0;
-                int qualType=0;                
-                
-                rc = SequenceGetCSQuality(sequence, &squal, &qoffset, &qualType);
-                if (rc) {
-                    (void)PLOGERR(klogErr, (klogErr, rc, "Spot '$(name)': length of colorspace quality does not match sequence", "name=%s", name));
-                    goto LOOP_END;
-                }
-                if (qoffset) {
-                    unsigned i;
-                    
-                    for (i = 0; i < csSeqLen; ++i)
-                        qual[i] = squal[i] - qoffset;
-                }
-                else if (squal != NULL)
-                    memcpy(qual, squal, csSeqLen);
-                else
-                    memset(qual, 0, csSeqLen);
-                readlen = csSeqLen;
-            }
-        }
-        
-        if (aligned) {
-            if (G->editAlignedQual ) EditAlignedQualities  (G, qual, AR_HAS_MISMATCH(data), readlen);
-            if (G->keepMismatchQual) EditUnalignedQualities(qual, AR_HAS_MISMATCH(data), readlen);
-
-            if (AR_MISMATCH_QUAL(data) == NULL) {
-                AR_NUM_MISMATCH_QUAL(data) = 0;
-            }
-            else {
-                size_t i;
-                size_t n;
-                bool const *const has_mismatch = AR_HAS_MISMATCH(data);
-                uint8_t *const mismatch = AR_MISMATCH_QUAL(data);
-                
-                for (n = i = 0; i < readlen; ++i) {
-                    if (has_mismatch[i])
-                        mismatch[n++] = qual[i];
-                }
-                AR_NUM_MISMATCH_QUAL(data) = n;
-            }
-        }
-        else if (isPrimary) {
-            switch (AR_READNO(data)) {
-            case 1:
-                value->unaligned_1 = 1;
-                break;
-            case 2:
-                value->unaligned_2 = 1;
-                break;
-            default:
-                break;
-            }
-        }
-        if (isPrimary) {
-            switch (AR_READNO(data)) {
-            case 1:
-                if (CTX_VALUE_GET_P_ID(*value, 0) == 0 && aligned) {
-                    data.alignId = ++ctx->primaryId;
-                    CTX_VALUE_SET_P_ID(*value, 0, data.alignId);
-                }
-                break;
-            case 2:
-                if (CTX_VALUE_GET_P_ID(*value, 1) == 0 && aligned) {
-                    data.alignId = ++ctx->primaryId;
-                    CTX_VALUE_SET_P_ID(*value, 1, data.alignId);
-                }
-                break;
-            default:
-                break;
-            }
-        }
-        if (mated) {
-            if (isPrimary || !originally_aligned) {
-                if (CTX_VALUE_GET_S_ID(*value) != 0) {
-                    (void)PLOGMSG(klogWarn, (klogWarn, "Spot '$(name)' has already been assigned a spot id", "name=%.*s", namelen, name));
-                }
-                else if (!value->has_a_read) {
-                    /* new mated fragment - do spot assembly */
-                    unsigned sz;
-                    uint64_t    fragmentId;
-                    FragmentInfo fi;
-                    KMemBank *frags;
-                    int32_t mate_refSeqId = -1;
-                    int64_t pnext = 0;
-                    
-                    value->seqHash[AR_READNO(data) - 1] = SeqHashKey(seqDNA, readlen);
-                    
-                    memset(&fi, 0, sizeof(fi));
-                    fi.aligned = aligned;
-                    fi.ti = ti;
-                    fi.orientation = readOrientation;
-                    fi.otherReadNo = AR_READNO(data);
-                    fi.sglen   = strlen(spotGroup);
-                    fi.readlen = readlen;
-                    fi.cskey = cskey;
-                    fi.is_bad = SequenceIsLowQuality(sequence);
-                    sz = sizeof(fi) + 2*fi.readlen + fi.sglen;
-                    if (align && aligned) {
-                        AlignmentGetMateRefSeqId(alignment, &mate_refSeqId);
-                        AlignmentGetMatePosition(alignment, &pnext);
-                    }
-                    if(align && aligned && mate_refSeqId == refSeqId && pnext > 0 && pnext!=rpos /*** weird case in some bams**/){ 
-                        frags = ctx->fragsBoth;
-                        rc = KMemBankAlloc(frags, &fragmentId, sz, 0);
-                        value->fragmentId = fragmentId*2;
-                        fcountBoth++;
-                    } else {
-                        frags = ctx->fragsOne;
-                        rc = KMemBankAlloc(frags, &fragmentId, sz, 0);
-                        value->fragmentId = fragmentId*2+1;
-                        fcountOne++;
-                    }
-                    if (rc) {
-                        (void)LOGERR(klogErr, rc, "KMemBankAlloc failed");
-                        goto LOOP_END;
-                    }
-                    /*printf("IN:%10d\tcnt2=%ld\tcnt1=%ld\n",value->fragmentId,fcountBoth,fcountOne);*/
-                    
-                    rc = KDataBufferResize(&fragBuf, sz);
-                    if (rc) {
-                        (void)LOGERR(klogErr, rc, "Failed to resize fragment buffer");
-                        goto LOOP_END;
-                    }
-                    {{
-                        uint8_t *dst = (uint8_t*) fragBuf.base;
-                        memcpy(dst,&fi,sizeof(fi));
-                        dst += sizeof(fi);
-                        COPY_READ((char *)dst, seqDNA, fi.readlen, (isColorSpace && !aligned) ? 0 : fi.orientation == ReadOrientationReverse);
-                        dst += fi.readlen;
-                        COPY_QUAL(dst, qual, fi.readlen, (isColorSpace && !aligned) ? 0 : fi.orientation == ReadOrientationReverse);
-                        dst += fi.readlen;
-                        memcpy(dst,spotGroup,fi.sglen);
-                    }}
-                    rc = KMemBankWrite(frags, fragmentId, 0, fragBuf.base, sz, &rsize);
-                    if (rc) {
-                        (void)PLOGERR(klogErr, (klogErr, rc, "KMemBankWrite failed writing fragment $(id)", "id=%u", fragmentId));
-                        goto LOOP_END;
-                    }
-                    value->has_a_read = 1;
-                }
-                else if (value->fragmentId != 0 ) {
-                    /* might be second fragment */
-                    uint64_t sz;
-                    FragmentInfo *fip;
-                    KMemBank *frags;
-                    
-                    if(value->fragmentId & 1) frags = ctx->fragsOne;
-                    else               frags = ctx->fragsBoth; 
-                    
-                    rc=KMemBankSize(frags, value->fragmentId>>1, &sz);
-                    if (rc) {
-                        (void)PLOGERR(klogErr, (klogErr, rc, "KMemBankSize failed on fragment $(id)", "id=%u", value->fragmentId>>1));
-                        goto LOOP_END;
-                    }
-                    rc=KDataBufferResize(&fragBuf, (size_t)sz);
-                    if (rc) {
-                        (void)PLOGERR(klogErr, (klogErr, rc, "Failed to resize fragment buffer", ""));
-                        goto LOOP_END;
-                    }
-                    rc=KMemBankRead(frags, value->fragmentId>>1, 0, fragBuf.base, sz, &rsize);
-                    if (rc) {
-                        (void)PLOGERR(klogErr, (klogErr, rc, "KMemBankRead failed on fragment $(id)", "id=%u", value->fragmentId>>1));
-                        goto LOOP_END;
-                    }
-                    
-                    assert( rsize == sz );
-                    fip = (FragmentInfo *) fragBuf.base;
-                    if(AR_READNO(data) != fip->otherReadNo) {
-                        /* mate found */
-                        unsigned readLen[2];
-                        unsigned read1 = 0;
-                        unsigned read2 = 1;
-                        uint8_t  *src  = (uint8_t*) fip + sizeof(*fip);
-                        
-                        value->seqHash[AR_READNO(data) - 1] = SeqHashKey(seqDNA, readlen);
-                        
-                        if (AR_READNO(data) < fip->otherReadNo) {
-                            read1 = 1;
-                            read2 = 0;
-                        }
-                        readLen[read1] = fip->readlen;
-                        readLen[read2] = readlen;
-                        rc = SequenceRecordInit(&srec, 2, readLen);
-                        if (rc) {
-                            (void)PLOGERR(klogErr, (klogErr, rc, "Failed resizing sequence record buffer", ""));
-                            goto LOOP_END;
-                        }
-                        srec.ti[read1] = fip->ti;
-                        srec.aligned[read1] = fip->aligned;
-                        srec.is_bad[read1] = fip->is_bad;
-                        srec.orientation[read1] = fip->orientation;
-                        srec.cskey[read1] = fip->cskey;
-                        memcpy(srec.seq + srec.readStart[read1], src, fip->readlen);
-                        src += fip->readlen;
-                        memcpy(srec.qual + srec.readStart[read1], src, fip->readlen);
-                        src += fip->readlen;
-                        
-                        srec.orientation[read2] = readOrientation;
-                        COPY_READ(srec.seq + srec.readStart[read2], 
-                                  seqDNA, 
-                                  srec.readLen[read2], 
-                                  (isColorSpace && !aligned) ? 0 : srec.orientation[read2] == ReadOrientationReverse);
-                        COPY_QUAL(srec.qual + srec.readStart[read2], 
-                                  qual, 
-                                  srec.readLen[read2],  
-                                  (isColorSpace && !aligned) ? 0 : srec.orientation[read2] == ReadOrientationReverse);
-
-                        srec.keyId = keyId;
-                        srec.is_bad[read2] = SequenceIsLowQuality(sequence);
-                        srec.aligned[read2] = aligned;
-                        srec.cskey[read2] = cskey;
-                        srec.ti[read2] = ti;
-                        
-                        srec.spotGroup = spotGroup;
-                        srec.spotGroupLen = strlen(spotGroup);
-                        if (value->pcr_dup && (srec.is_bad[0] || srec.is_bad[1])) {
-                            filterFlagConflictRecords++;
-                            if(filterFlagConflictRecords < MAX_WARNINGS_FLAG_CONFLICT){
-                                (void)PLOGMSG(klogWarn, (klogWarn, "Spot '$(name)': both 'duplicate' and 'lowQuality' flag bits set, only 'duplicate' will be saved", "name=%s", name));
-                            } else if(filterFlagConflictRecords == MAX_WARNINGS_FLAG_CONFLICT){
-                                (void)PLOGMSG(klogWarn, (klogWarn, "Last reported warning: Spot '$(name)': both 'duplicate' and 'lowQuality' flag bits set, only 'duplicate' will be saved", "name=%s", name));
-                            }
-                        }
-                        rc = SequenceWriteRecord(seq, &srec, isColorSpace, value->pcr_dup, value->platform, 
-                                                G->keepMismatchQual, G->no_real_output, G->hasTI, G->QualQuantizer);
-                        if (rc) {
-                            (void)LOGERR(klogErr, rc, "SequenceWriteRecord failed");
-                            goto LOOP_END;
-                        }
-                        CTX_VALUE_SET_S_ID(*value, ++ctx->spotId);
-                        if(value->fragmentId & 1){
-                            fcountOne--;
-                        } else {
-                            fcountBoth--;
-                        }
-                        /*  printf("OUT:%9d\tcnt2=%ld\tcnt1=%ld\n",value->fragmentId,fcountBoth,fcountOne);*/
-                        rc = KMemBankFree(frags, value->fragmentId>>1);
-                        if (rc) {
-                            (void)PLOGERR(klogErr, (klogErr, rc, "KMemBankFree failed on fragment $(id)", "id=%u", value->fragmentId>>1));
-                            goto LOOP_END;
-                        }
-                        value->fragmentId = 0;
-                    }
-                }
-            }
-            if (!isPrimary && aligned) {
-                int32_t bam_mrid;
-                int64_t mpos;
-                int64_t mrid;
-                int64_t tlen;
-                
-                AlignmentGetMatePosition(alignment, &mpos);
-                AlignmentGetMateRefSeqId(alignment, &bam_mrid);
-                AlignmentGetInsertSize(alignment, &tlen);
-                
-                if (mpos >= 0 && bam_mrid >= 0 && tlen != 0 && header != NULL) {
-                    ReferenceSequence mref;
-                    if (ReferenceInfoGetRefSeq(header, bam_mrid, &mref) == 0) {
-                        rc_t rc_temp = ReferenceGet1stRow(ref, &mrid, mref.name);
-                        if (rc_temp == 0) {
-                            data.mate_ref_pos = mpos;
-                            data.template_len = tlen;
-                            data.mate_ref_orientation = (SequenceGetOrientationMate(sequence) == ReadOrientationReverse);
-                        }
-                        else {
-                            (void)PLOGERR(klogWarn, (klogWarn, rc_temp, "Failed to get refID for $(name)", "name=%s", mref.name));
-                            mrid = 0;
-                        }
-                        data.mate_ref_id = mrid;
-                    }
-                }
-            }
-        }
-        else if (CTX_VALUE_GET_S_ID(*value) == 0 && (isPrimary || !originally_aligned)) {
-            /* new unmated fragment - no spot assembly */
-            unsigned readLen[1];
-
-            value->seqHash[0] = SeqHashKey(seqDNA, readlen);
-            
-            readLen[0] = readlen;
-            rc = SequenceRecordInit(&srec, 1, readLen);
-            if (rc) {
-                (void)PLOGERR(klogErr, (klogErr, rc, "Failed resizing sequence record buffer", ""));
-                goto LOOP_END;
-            }
-            srec.ti[0] = ti;
-            srec.aligned[0] = aligned;
-            srec.is_bad[0] = SequenceIsLowQuality(sequence);
-            srec.orientation[0] = readOrientation;
-            srec.cskey[0] = cskey;
-            COPY_READ(srec.seq  + srec.readStart[0], seqDNA, readlen, (isColorSpace && !aligned) ? 0 : srec.orientation[0] == ReadOrientationReverse);
-            COPY_QUAL(srec.qual + srec.readStart[0], qual, readlen, (isColorSpace && !aligned) ? 0 : srec.orientation[0] == ReadOrientationReverse);
-         
-            srec.keyId = keyId;
-            
-            srec.spotGroup = spotGroup;
-            srec.spotGroupLen = strlen(spotGroup);
-            if (value->pcr_dup && srec.is_bad[0]) {
-                filterFlagConflictRecords++;
-                if (filterFlagConflictRecords < MAX_WARNINGS_FLAG_CONFLICT) {
-                    (void)PLOGMSG(klogWarn, (klogWarn, "Spot '$(name)': both 'duplicate' and 'lowQuality' flag bits set, only 'duplicate' will be saved", "name=%s", name));
-                }
-                else if (filterFlagConflictRecords == MAX_WARNINGS_FLAG_CONFLICT) {
-                    (void)PLOGMSG(klogWarn, (klogWarn, "Last reported warning: Spot '$(name)': both 'duplicate' and 'lowQuality' flag bits set, only 'duplicate' will be saved", "name=%s", name));
-        }
-            }
-            rc = SequenceWriteRecord(seq, &srec, isColorSpace, value->pcr_dup, value->platform, 
-                                                G->keepMismatchQual, G->no_real_output, G->hasTI, G->QualQuantizer);
-            if (rc) {
-                (void)PLOGERR(klogErr, (klogErr, rc, "SequenceWriteRecord failed", ""));
-                goto LOOP_END;
-            }
-            CTX_VALUE_SET_S_ID(*value, ++ctx->spotId);
-            value->fragmentId = 0;
-        }
-        
-        if (aligned) {
-            if (value->alignmentCount[AR_READNO(data) - 1] < 254)
-                ++value->alignmentCount[AR_READNO(data) - 1];
-            ++ctx->alignCount;
-            
-            assert(keyId >> 32 < ctx->key2id_count);
-            assert((uint32_t)keyId < ctx->idCount[keyId >> 32]);
-            
-            rc = AlignmentWriteRecord(align, &data, G->expectUnsorted);
-            if (rc == 0) {
-                if (!isPrimary)
-                    data.alignId = ++ctx->secondId;
-                
-                rc = ReferenceAddAlignId(ref, data.alignId, isPrimary);
-                if (rc) {
-                    (void)PLOGERR(klogErr, (klogErr, rc, "ReferenceAddAlignId failed", ""));
-                }
-                else {
-                    *had_alignments = true;
-                }
-            }
-            else {
-                (void)PLOGERR(klogErr, (klogErr, rc, "AlignmentWriteRecord failed", ""));
-            }
-        }
-        /**************************************************************/
-        
-    LOOP_END:
-        RecordRelease(record);
-        if (sequence != NULL)
-            SequenceRelease(sequence);
-        if (alignment != NULL)
-            AlignmentRelease(alignment);
-        if (cg != NULL)
-            CGDataRelease(cg);
-        
-        ++reccount;
-        if (G->maxAlignCount > 0 && reccount >= G->maxAlignCount)
-            break;
-        if (rc == 0)
-            *had_sequences = true;
-    }
-    
-    if (header != NULL)
-        ReferenceInfoRelease(header);
-    
-    if (filterFlagConflictRecords > 0) {
-        (void)PLOGMSG(klogWarn, (klogWarn, "$(cnt1) out of $(cnt2) records contained warning : both 'duplicate' and 'lowQuality' flag bits set, only 'duplicate' will be saved", "cnt1=%lu,cnt2=%lu", filterFlagConflictRecords,recordsProcessed));
-    }
-    if (rc == 0 && recordsProcessed == 0) {
-        (void)LOGMSG(klogWarn, (G->limit2config || G->refFilter != NULL) ? 
-                     "All records from the file were filtered out" :
-                     "The file contained no records that were processed.");
-        rc = RC(rcAlign, rcFile, rcReading, rcData, rcEmpty);
-    }
-    if (rc == 0 && reccount > 0) {
-        double percentage = ((double)G->errCount) / reccount; 
-        double allowed = G->maxErrPct/ 100.0;
-        if (percentage > allowed) {
-            rc = RC(rcExe, rcTable, rcClosing, rcData, rcInvalid);
-            (void)PLOGERR(klogErr, 
-                            (klogErr, rc,
-                             "Too many bad records: "
-                                 "records: $(records), bad records: $(bad_records), "
-                                 "bad records percentage: $(percentage), "
-                                 "allowed percentage: $(allowed)",
-                             "records=%lu,bad_records=%lu,percentage=%.2f,allowed=%.2f",
-                             reccount, G->errCount, percentage, allowed));
-        }
-    }
-
-    KDataBufferWhack(&buf);
-    KDataBufferWhack(&fragBuf);
-    KDataBufferWhack(&srec.storage);
-    KDataBufferWhack(&cigBuf);
-    return rc;
-}
-
-/*--------------------------------------------------------------------------
- * CommonWriter
- */
- 
-rc_t CommonWriterInit(CommonWriter* self, struct VDBManager *mgr, struct VDatabase *db, const CommonWriterSettings* G)
-{
-    rc_t rc; 
-    assert(self);
-    assert(mgr);
-    assert(db);
-    
-    memset(self, 0, sizeof(*self));
-    if (G)
-        self->settings = *G;
-
-    self->ref = malloc(sizeof(*self->ref));
-    if (self->ref == 0)
-        return RC(rcAlign, rcArc, rcAllocating, rcMemory, rcExhausted);
-        
-    rc = ReferenceInit(self->ref, 
-                       mgr, 
-                       db, 
-                       self->settings.expectUnsorted, 
-                       self->settings.acceptHardClip, 
-                       self->settings.refXRefPath, 
-                       self->settings.inpath, 
-                       self->settings.maxSeqLen, 
-                       self->settings.refFiles);
-    if (rc == 0)
-    {
-        self->seq = malloc(sizeof(*self->seq));
-        if (self->seq == 0)
-        {
-            ReferenceWhack(self->ref, false, 0, NULL);
-            free(self->ref);
-            return RC(rcAlign, rcArc, rcAllocating, rcMemory, rcExhausted);
-        }
-        SequenceWriterInit(self->seq, db);
-        
-        self->align = AlignmentMake(db);
-        if (self->align == 0)
-        {
-            ReferenceWhack(self->ref, false, 0, NULL);
-            free(self->ref);
-            
-            SequenceWhack(self->seq, false);
-            free(self->seq);
-            
-            return RC(rcAlign, rcArc, rcAllocating, rcMemory, rcExhausted);
-        }
-        
-        rc = SetupContext(&self->settings, &self->ctx);
-        if (rc != 0)
-        {
-            ReferenceWhack(self->ref, false, 0, NULL);
-            free(self->ref);
-            
-            SequenceWhack(self->seq, false);
-            free(self->seq);
-            
-            AlignmentWhack(self->align, false);
-        }
-    }
-    if (self->settings.tmpfs == NULL)
-        self->settings.tmpfs = "/tmp";
-
-    self->commit = true;
-    
-    return rc;
-}
-
-rc_t CommonWriterArchive(CommonWriter *const self,
-                         const struct ReaderFile *const reader)
-{
-    rc_t rc;
-
-    assert(self);
-    rc = ArchiveFile(reader,
-                     &self->settings,
-                     &self->ctx,
-                     self->ref,
-                     self->seq,
-                     self->align,
-                     &self->had_alignments,
-                     &self->had_sequences);
-    if (rc)
-        self->commit = false;
-    
-    self->err_count += self->settings.errCount;
-    return rc;
-}
-
-rc_t CommonWriterComplete(CommonWriter* self, bool quitting, uint64_t maxDistance)
-{
-    rc_t rc=0;
-    /*** No longer need memory for key2id ***/
-    size_t i;
-    for (i = 0; i != self->ctx.key2id_count; ++i) {
-        KBTreeDropBacking(self->ctx.key2id[i]);
-        KBTreeRelease(self->ctx.key2id[i]);
-        self->ctx.key2id[i] = NULL;
-    }
-    free(self->ctx.key2id_names);
-    self->ctx.key2id_names = NULL;
-    /*******************/
-
-    if (self->had_sequences) {
-        if (!quitting) {
-            (void)LOGMSG(klogInfo, "Writing unpaired sequences");
-            rc = WriteSoloFragments(&self->settings, &self->ctx, self->seq);
-            ContextReleaseMemBank(&self->ctx);
-            if (rc == 0) {
-                rc = SequenceDoneWriting(self->seq);
-                if (rc == 0) {
-                    (void)LOGMSG(klogInfo, "Updating sequence alignment info");
-                    rc = SequenceUpdateAlignInfo(&self->ctx, self->seq);
-                }
-            }
-        }
-        else
-            ContextReleaseMemBank(&self->ctx);
-    }
-    
-    if (self->had_alignments && !quitting) {
-        (void)LOGMSG(klogInfo, "Writing alignment spot ids");
-        rc = AlignmentUpdateSpotInfo(&self->ctx, self->align, maxDistance);
-    }
-
-    return rc;
-}
-
-rc_t CommonWriterWhack(CommonWriter* self)
-{
-    rc_t rc = 0;
-    assert(self);
-    
-    ContextRelease(&self->ctx);
-    
-    if (self->align)
-        rc = AlignmentWhack(self->align, self->commit);
-        
-    if (self->seq)
-    {
-        SequenceWhack(self->seq, self->commit);
-        free(self->seq);
-    }
-
-    if (self->ref)
-    {
-        rc_t rc2 = ReferenceWhack(self->ref, self->commit, self->settings.maxSeqLen, Quitting);
-        if (rc == 0)
-            rc = rc2;
-        free(self->ref);
-    }
-
-    return rc;
-}
-
diff --git a/libs/loader/mmarray.c b/libs/loader/mmarray.c
deleted file mode 100644
index 9a62fd2..0000000
--- a/libs/loader/mmarray.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <loader/mmarray.h>
-
-#include <sysalloc.h>
-#include <stdlib.h>
-
-#include <klib/rc.h>
-
-#include <kfs/mmap.h>
-#include <kfs/file.h>
-
-#define MMA_NUM_CHUNKS_BITS (24u)
-#define MMA_NUM_SUBCHUNKS_BITS ((32u)-(MMA_NUM_CHUNKS_BITS))
-#define MMA_SUBCHUNK_SIZE (1u << MMA_NUM_CHUNKS_BITS)
-#define MMA_SUBCHUNK_COUNT (1u << MMA_NUM_SUBCHUNKS_BITS)
-
-typedef struct MMArray {
-    KFile *fp;
-    size_t elemSize;
-    uint64_t fsize;
-    struct mma_map_s {
-        struct mma_submap_s {
-            uint8_t *base;
-            KMMap *mmap;
-        } submap[MMA_SUBCHUNK_COUNT];
-    } map[NUM_ID_SPACES];
-} MMArray;
-
-rc_t MMArrayMake(struct MMArray **rslt, KFile *fp, uint32_t elemSize)
-{
-    MMArray *const self = calloc(1, sizeof(*self));
-
-    if (self == NULL)
-        return RC(rcExe, rcMemMap, rcConstructing, rcMemory, rcExhausted);
-    self->elemSize = (elemSize + 3) & ~(3u); /** align to 4 byte **/
-    self->fp = fp;
-    KFileAddRef(fp);
-    *rslt = self;
-    return 0;
-}
-
-#define PERF 0
-
-rc_t MMArrayGet(struct MMArray *const self, void **const value, uint64_t const element)
-{
-    unsigned const bin_no = element >> 32;
-    unsigned const subbin = ((uint32_t)element) >> MMA_NUM_CHUNKS_BITS;
-    unsigned const in_bin = (uint32_t)element & (MMA_SUBCHUNK_SIZE - 1);
-
-    if (bin_no >= sizeof(self->map)/sizeof(self->map[0]))
-        return RC(rcExe, rcMemMap, rcConstructing, rcId, rcExcessive);
-    
-    if (self->map[bin_no].submap[subbin].base == NULL) {
-        size_t const chunk = MMA_SUBCHUNK_SIZE * self->elemSize;
-        size_t const fsize = self->fsize + chunk;
-        rc_t rc = KFileSetSize(self->fp, fsize);
-        
-        if (rc == 0) {
-            KMMap *mmap;
-            
-            self->fsize = fsize;
-            rc = KMMapMakeRgnUpdate(&mmap, self->fp, self->fsize, chunk);
-            if (rc == 0) {
-                void *base;
-                
-                rc = KMMapAddrUpdate(mmap, &base);
-                if (rc == 0) {
-#if PERF
-                    static unsigned mapcount = 0;
-
-                    (void)PLOGMSG(klogInfo, (klogInfo, "Number of mmaps: $(cnt)", "cnt=%u", ++mapcount));
-#endif
-                    self->map[bin_no].submap[subbin].mmap = mmap;
-                    self->map[bin_no].submap[subbin].base = base;
-
-                    goto GET_MAP;
-                }
-                KMMapRelease(mmap);
-            }
-        }
-        return rc;
-    }
-GET_MAP:
-    *value = &self->map[bin_no].submap[subbin].base[(size_t)in_bin * self->elemSize];
-    return 0;
-}
-
-void MMArrayWhack(struct MMArray *self)
-{
-    unsigned i;
-
-    for (i = 0; i != sizeof(self->map)/sizeof(self->map[0]); ++i) {
-        unsigned j;
-        
-        for (j = 0; j != sizeof(self->map[0].submap)/sizeof(self->map[0].submap[0]); ++j) {
-            if (self->map[i].submap[j].mmap)
-                KMMapRelease(self->map[i].submap[j].mmap);
-            self->map[i].submap[j].mmap = NULL;
-            self->map[i].submap[j].base = NULL;
-        }
-    }
-    KFileRelease(self->fp);
-    free(self);
-}
-
-
diff --git a/libs/loader/reference-writer.c b/libs/loader/reference-writer.c
deleted file mode 100644
index 8a41009..0000000
--- a/libs/loader/reference-writer.c
+++ /dev/null
@@ -1,462 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <klib/rc.h>
-#include <klib/log.h>
-#include <kfs/file.h>
-
-#include <vdb/schema.h>
-#include <vdb/table.h>
-#include <vdb/cursor.h>
-
-#include <align/writer-refseq.h>
-
-#include <loader/reference-writer.h>
-
-#include <stdlib.h>
-#include <limits.h>
-#include <string.h>
-#include <assert.h>
-#include <ctype.h>
-
-#define SORTED_OPEN_TABLE_LIMIT (2)
-#define SORTED_CACHE_SIZE ((2 * 1024 * 1024)/(SORTED_OPEN_TABLE_LIMIT))
-
-#ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
-#define UNSORTED_OPEN_TABLE_LIMIT (8)
-#define UNSORTED_CACHE_SIZE ((1024 * 1024 * 1024)/(UNSORTED_OPEN_TABLE_LIMIT))
-#else
-#define UNSORTED_OPEN_TABLE_LIMIT (64)
-#define UNSORTED_CACHE_SIZE (350 * 1024 * 1024)
-#endif
-
-#if _DEBUGGING
-#define DUMP_CONFIG 1
-#endif
-
-struct overlap_s {
-    uint32_t min; /* minimum start pos of any alignment that ends in this chunk */
-    uint32_t max; /* maximum end pos of any alignment that starts before this chunk and ends in this chunk */
-};
-
-extern void ReferenceMgr_DumpConfig(ReferenceMgr const *const self);
-
-rc_t ReferenceInit(Reference *self, 
-                   const VDBManager *mgr, 
-                   VDatabase *db, 
-                   bool expectUnsorted,
-                   bool acceptHardClip,
-                   char const *refXRefPath,
-                   char const *inpath,
-                   uint32_t maxSeqLen,
-                   char const** refFiles
-                   )
-{
-    rc_t rc;
-    size_t const cache = expectUnsorted ? UNSORTED_CACHE_SIZE : SORTED_CACHE_SIZE;
-    unsigned const open_count = expectUnsorted ? UNSORTED_OPEN_TABLE_LIMIT : SORTED_OPEN_TABLE_LIMIT;
-    
-    memset(self, 0, sizeof(*self));
-    
-    self->coverage.elem_bits = self->mismatches.elem_bits = self->indels.elem_bits = 32;
-    self->pri_align.elem_bits = self->sec_align.elem_bits = 64;
-    self->pri_overlap.elem_bits = self->sec_overlap.elem_bits = sizeof(struct overlap_s) * 8;
-    
-    self->acceptHardClip = acceptHardClip;
-    
-    rc = ReferenceMgr_Make(&self->mgr, db, mgr, 
-                           ewrefmgr_co_Coverage,
-                           refXRefPath, inpath,
-                           maxSeqLen, cache, open_count);
-    if (rc == 0 && refFiles != NULL) {
-        unsigned i;
-        
-        for (i = 0; refFiles[i]; ++i) {
-            rc = ReferenceMgr_FastaPath(self->mgr, refFiles[i]);
-            if (rc) {
-                (void)PLOGERR(klogWarn, (klogWarn, rc, "fasta file '$(file)'", "file=%s", refFiles[i]));
-                break;
-            }
-        }
-#if DUMP_CONFIG
-        if (rc == 0) {
-            ReferenceMgr_DumpConfig(self->mgr);
-        }
-#endif
-    }
-    return rc;
-}
-
-static
-void Unsorted(Reference *self) {
-    (void)LOGMSG(klogWarn, "Alignments are unsorted");
-    self->out_of_order = true;
-    ReferenceMgr_SetCache(self->mgr, UNSORTED_CACHE_SIZE, UNSORTED_OPEN_TABLE_LIMIT);
-    KDataBufferWhack(&self->sec_align);
-    KDataBufferWhack(&self->pri_align);
-    KDataBufferWhack(&self->mismatches);
-    KDataBufferWhack(&self->indels);
-    KDataBufferWhack(&self->coverage);
-    KDataBufferWhack(&self->pri_overlap);
-    KDataBufferWhack(&self->sec_overlap);
-}
-
-#define BAIL_ON_FAIL(STMT) do { rc_t const rc__ = (STMT); if (rc__) return rc__; } while(0)
-
-static rc_t FlushBuffers(Reference *self, uint64_t upto, bool full, bool final, uint32_t maxSeqLen)
-{
-    if (!self->out_of_order && upto > 0) {
-        size_t offset = 0;
-        unsigned *const miss = (unsigned *)self->mismatches.base;
-        unsigned *const indel = (unsigned *)self->indels.base;
-        unsigned *const cov = (unsigned *)self->coverage.base;
-        struct overlap_s *const pri_overlap = (struct overlap_s *)self->pri_overlap.base;
-        struct overlap_s *const sec_overlap = (struct overlap_s *)self->sec_overlap.base;
-        unsigned chunk = 0;
-        
-        while ((self->curPos + offset + (full ? 0 : maxSeqLen)) <= upto) {
-            ReferenceSeqCoverage data;
-            uint64_t const curPos = self->curPos + offset;
-            unsigned const n = self->endPos > (curPos + maxSeqLen) ?
-                               maxSeqLen : (self->endPos - curPos);
-            unsigned const m = curPos + n > upto ? upto - curPos : n;
-            unsigned i;
-            unsigned hi;
-            unsigned lo;
-            
-            if (n == 0) break;
-            
-            memset(&data, 0, sizeof(data));
-            
-            data.ids[ewrefcov_primary_table].elements = self->pri_align.elem_count;
-            data.ids[ewrefcov_primary_table].buffer = self->pri_align.base;
-            data.overlap_ref_pos[ewrefcov_primary_table] = pri_overlap[chunk].min;
-            data.overlap_ref_len[ewrefcov_primary_table] = pri_overlap[chunk].max ? pri_overlap[chunk].max - curPos : 0;
-            
-            data.ids[ewrefcov_secondary_table].elements = self->sec_align.elem_count;
-            data.ids[ewrefcov_secondary_table].buffer = self->sec_align.base;
-            data.overlap_ref_pos[ewrefcov_secondary_table] = sec_overlap[chunk].min;
-            data.overlap_ref_len[ewrefcov_secondary_table] = sec_overlap[chunk].max ? sec_overlap[chunk].max - curPos : 0;
-            
-            for (hi = 0, lo = UINT_MAX, i = 0; i != m; ++i) {
-                unsigned const coverage = cov[offset + i];
-                
-                if (hi < coverage)
-                    hi = coverage;
-                if (lo > coverage)
-                    lo = coverage;
-            }
-            data.low  = lo > 255 ? 255 : lo;
-            data.high = hi > 255 ? 255 : hi;
-            
-            for (i = 0; i != m; ++i)
-                data.mismatches += miss[offset + i];
-
-            for (i = 0; i != m; ++i)
-                data.indels += indel[offset + i];
-            
-            {
-                rc_t rc = ReferenceSeq_AddCoverage(self->rseq, curPos, &data);
-                
-                if (rc) {
-                    Unsorted(self);
-                    return 0;
-                }
-            }
-            
-            KDataBufferResize(&self->pri_align, 0);
-            KDataBufferResize(&self->sec_align, 0);
-            offset += n;
-            ++chunk;
-        }
-        if (!final && offset > 0) {
-            unsigned const newChunkCount = self->pri_overlap.elem_count - chunk;
-            unsigned const newBaseCount = self->endPos - self->curPos - offset;
-            
-            memmove(self->pri_overlap.base, pri_overlap + chunk, newChunkCount * sizeof(pri_overlap[0]));
-            memmove(self->sec_overlap.base, sec_overlap + chunk, newChunkCount * sizeof(sec_overlap[0]));
-            memmove(self->mismatches.base, miss + offset, newBaseCount * sizeof(miss[0]));
-            memmove(self->indels.base, indel + offset, newBaseCount * sizeof(indel[0]));
-            memmove(self->coverage.base, cov + offset, newBaseCount * sizeof(cov[0]));
-
-            KDataBufferResize(&self->pri_overlap, newChunkCount);
-            KDataBufferResize(&self->sec_overlap, newChunkCount);
-            
-            self->curPos += offset;
-        }
-    }
-    return 0;
-}
-
-rc_t ReferenceSetFile(Reference *self, const char id[],
-                      uint64_t length, uint8_t const md5[16], uint32_t maxSeqLen)
-{
-    const ReferenceSeq *rseq;
-    unsigned n;
-    
-    for (n = 0; ; ++n) {
-        if (self->last_id[n] != id[n])
-            break;
-        if (self->last_id[n] == 0 && id[n] == 0)
-            return 0;
-    }
-    while (id[n])
-        ++n;
-    if (n >= sizeof(self->last_id))
-        return RC(rcApp, rcTable, rcAccessing, rcParam, rcTooLong);
-    
-    BAIL_ON_FAIL(FlushBuffers(self, self->length, true, true, maxSeqLen));
-    BAIL_ON_FAIL(ReferenceMgr_GetSeq(self->mgr, &rseq, id));
-
-    if (self->rseq)
-        ReferenceSeq_Release(self->rseq);
-    self->rseq = rseq;
-    
-    memcpy(self->last_id, id, n + 1);
-    self->curPos = self->endPos = 0;
-    self->length = length;
-    self->lastOffset = 0;
-
-    if(!self->out_of_order) (void)PLOGMSG(klogInfo, (klogInfo, "Processing Reference '$(id)'", "id=%s", id));
-    
-    return 0;
-}
-
-rc_t ReferenceVerify(Reference const *self, char const id[], uint64_t length, uint8_t const md5[16])
-{
-    return ReferenceMgr_Verify(self->mgr, id, length, md5);
-}
-
-rc_t ReferenceGet1stRow(Reference const *self, int64_t *refID, char const refName[])
-{
-    const ReferenceSeq* rseq;
-    rc_t rc = ReferenceMgr_GetSeq(self->mgr, &rseq, refName);
-    if( rc == 0 ) {
-        rc = ReferenceSeq_Get1stRow(rseq, refID);
-        ReferenceSeq_Release(rseq);
-    }
-    return rc;
-}
-
-static
-rc_t ReferenceAddCoverage(Reference *const self,
-                          unsigned const refStart,
-                          unsigned const refLength,
-                          uint32_t const mismatches,
-                          uint32_t const indels,
-                          bool const isPrimary,
-                          uint32_t maxSeqLen
-                          )
-{
-    unsigned const refEnd = refStart + refLength;
-    
-    if (refEnd > self->endPos) {
-        unsigned const t1 = refEnd + (maxSeqLen - 1);
-        unsigned const adjust = t1 % maxSeqLen;
-        unsigned const newEndPos = t1 - adjust;
-        unsigned const baseCount = self->endPos - self->curPos;
-        unsigned const newBaseCount = newEndPos - self->curPos;
-        
-        BAIL_ON_FAIL(KDataBufferResize(&self->coverage, newBaseCount));
-        BAIL_ON_FAIL(KDataBufferResize(&self->mismatches, newBaseCount));
-        BAIL_ON_FAIL(KDataBufferResize(&self->indels, newBaseCount));
-        
-        memset(&((unsigned *)self->coverage.base)[baseCount], 0, (newBaseCount - baseCount) * sizeof(unsigned));
-        memset(&((unsigned *)self->mismatches.base)[baseCount], 0, (newBaseCount - baseCount) * sizeof(unsigned));
-        memset(&((unsigned *)self->indels.base)[baseCount], 0, (newBaseCount - baseCount) * sizeof(unsigned));
-        self->endPos = newEndPos;
-    }
-    if ((refEnd - self->curPos) / maxSeqLen >= self->pri_overlap.elem_count) {
-        unsigned const chunks = (refEnd - self->curPos) / maxSeqLen + 1;
-        unsigned const end = self->pri_overlap.elem_count;
-        
-        BAIL_ON_FAIL(KDataBufferResize(&self->pri_overlap, chunks));
-        BAIL_ON_FAIL(KDataBufferResize(&self->sec_overlap, chunks));
-        
-        memset(&((struct overlap_s *)self->pri_overlap.base)[end], 0, (chunks - end) * sizeof(struct overlap_s));
-        memset(&((struct overlap_s *)self->sec_overlap.base)[end], 0, (chunks - end) * sizeof(struct overlap_s));
-    }
-    BAIL_ON_FAIL(FlushBuffers(self, refStart, false, false, maxSeqLen));
-    if (!self->out_of_order) {
-        unsigned const startBase = refStart - self->curPos;
-        unsigned const endChunk = (startBase + refLength) / maxSeqLen;
-        KDataBuffer *const overlapBuffer = isPrimary ? &self->pri_overlap : &self->sec_overlap;
-        unsigned *const cov = &((unsigned *)self->coverage.base)[startBase];
-        unsigned i;
-        
-        ((unsigned *)self->mismatches.base)[startBase] += mismatches;
-        ((unsigned *)self->indels.base)[startBase] += indels;
-        
-        if (((struct overlap_s *)overlapBuffer->base)[endChunk].min == 0 || 
-            ((struct overlap_s *)overlapBuffer->base)[endChunk].min > refStart)
-        {
-            ((struct overlap_s *)overlapBuffer->base)[endChunk].min = refStart;
-        }
-        if (endChunk != 0 &&
-            ((struct overlap_s *)overlapBuffer->base)[endChunk].max < refStart + refLength)
-        {
-            ((struct overlap_s *)overlapBuffer->base)[endChunk].max = refStart + refLength;
-        }
-        
-        for (i = 0; i != refLength; ++i) {
-            if (cov[i] < UINT_MAX)
-                ++cov[i];
-        }
-    }
-    return 0;
-}
-
-static void GetCounts(AlignmentRecord const *data, unsigned const seqLen,
-                      unsigned *const nMatch,
-                      unsigned *const nMiss,
-                      unsigned *const nIndels)
-{
-    bool const *has_mismatch = data->data.has_mismatch.buffer;
-    bool const *has_offset = data->data.has_ref_offset.buffer;
-    int32_t const *ref_offset = data->data.ref_offset.buffer;
-    unsigned const n = data->data.ref_offset.elements;
-    unsigned const left_clip = (n != 0 && has_offset[0] && ref_offset[0] < 0) ? -ref_offset[0] : 0;
-    int right_edge;
-    unsigned nmis;
-    unsigned nmatch;
-    unsigned i;
-    unsigned j;
-    
-    for (right_edge = data->data.ref_len, i = 0; i != n; ++i)
-        right_edge -= ref_offset[i];
-    if (right_edge > seqLen)
-        right_edge = seqLen;
-    for (j = left_clip ? 1 : 0, i = left_clip, nmatch = nmis = 0; i < right_edge; ) {
-        if (has_offset[i]) {
-            int const offs = ref_offset[j++];
-            
-            if (offs < 0) {
-                i += (unsigned)(-offs);
-                continue;
-            }
-        }
-        if (has_mismatch[i])
-            ++nmis;
-        else
-            ++nmatch;
-        ++i;
-    }
-    *nMatch = nmatch;
-    *nMiss = nmis;
-    *nIndels = n - (left_clip ? 1 : 0);
-}
-
-rc_t ReferenceRead(Reference *self, AlignmentRecord *data, uint64_t const pos,
-                   uint32_t const rawCigar[], uint32_t const cigCount,
-                   char const seqDNA[], uint32_t const seqLen, uint32_t *matches,
-                   bool acceptNoMatch, unsigned minMatchCount, uint32_t maxSeqLen)
-{
-    *matches = 0;
-    BAIL_ON_FAIL(ReferenceSeq_Compress(self->rseq, 
-                                       (self->acceptHardClip ? ewrefmgr_co_AcceptHardClip : 0) + ewrefmgr_cmp_Binary, 
-                                       pos,
-                                       seqDNA, seqLen, rawCigar, cigCount, 0, NULL, 0, 0, NULL, 0, &data->data));
-
-    if (!acceptNoMatch && data->data.ref_len == 0)
-        return RC(rcApp, rcFile, rcReading, rcConstraint, rcViolated);
-    
-    if (!self->out_of_order && pos < self->lastOffset) {
-        Unsorted(self);
-    }
-    if (self->out_of_order)
-        return 0;
-    else {
-        unsigned nmis;
-        unsigned nmatch;
-        unsigned indels;
-
-        self->lastOffset = data->data.effective_offset;
-        GetCounts(data, seqLen, &nmatch, &nmis, &indels);
-        *matches = nmatch;
-        
-        if (acceptNoMatch || nmatch >= minMatchCount)
-            return ReferenceAddCoverage(self, data->data.effective_offset,
-                                        data->data.ref_len, nmis, indels,
-                                        data->isPrimary, maxSeqLen);
-        else
-            return RC(rcApp, rcFile, rcReading, rcConstraint, rcViolated);
-    }
-}
-
-static rc_t IdVecAppend(KDataBuffer *vec, uint64_t id)
-{
-    uint64_t const end = vec->elem_count;
-    
-    BAIL_ON_FAIL(KDataBufferResize(vec, end + 1));
-    ((uint64_t *)vec->base)[end] = id;
-    return 0;
-}
-
-rc_t ReferenceAddAlignId(Reference *self,
-                         int64_t align_id,
-                         bool is_primary
-                         )
-{
-    if (self->out_of_order)
-        return 0;
-    return IdVecAppend(is_primary ? &self->pri_align : &self->sec_align, align_id);
-}
-
-rc_t ReferenceWhack(Reference *self, bool commit, uint32_t maxSeqLen,
-                    rc_t (*const quitting)(void)
-                    )
-{
-    rc_t rc = 0;
-    
-    if (self) {
-#if DUMP_CONFIG
-        if (self->mgr)
-            ReferenceMgr_DumpConfig(self->mgr);
-#endif
-        if (commit) {
-            rc = FlushBuffers(self, self->length, true, true, maxSeqLen);
-            if (rc != 0)
-                commit = false;
-        }
-        KDataBufferWhack(&self->sec_align);
-        KDataBufferWhack(&self->pri_align);
-        KDataBufferWhack(&self->mismatches);
-        KDataBufferWhack(&self->indels);
-        KDataBufferWhack(&self->coverage);
-        KDataBufferWhack(&self->pri_overlap);
-        KDataBufferWhack(&self->sec_overlap);
-        if (self->rseq)
-            rc = ReferenceSeq_Release(self->rseq);
-        if (self->out_of_order) {
-            (void)LOGMSG(klogInfo, "Starting coverage calculation");
-            rc = ReferenceMgr_Release(self->mgr, commit, NULL, true, quitting);
-        }
-        else {
-            rc = ReferenceMgr_Release(self->mgr, commit, NULL, false, NULL);
-        }
-    }
-    return rc;
-}
diff --git a/libs/loader/sequence-writer.c b/libs/loader/sequence-writer.c
deleted file mode 100644
index a5f3e1b..0000000
--- a/libs/loader/sequence-writer.c
+++ /dev/null
@@ -1,361 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <klib/rc.h>
-#include <klib/log.h>
-
-#include <vdb/database.h>
-
-#include <kdb/manager.h>
-
-#include <insdc/sra.h>
-#include <insdc/insdc.h>
-
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <assert.h>
-#include <ctype.h>
-
-#include <align/writer-sequence.h>
-
-#include <loader/sequence-writer.h>
-#include <loader/common-reader.h>
-
-/* MARK: SequenceWriter Object */
-
-SequenceWriter *SequenceWriterInit(SequenceWriter *self, VDatabase *db) {
-    memset(self, 0, sizeof(*self));
-    self->db = db;
-    VDatabaseAddRef(db);
-    return self;
-}
-
-rc_t SequenceWriteRecord(SequenceWriter *self,
-                         SequenceRecord const *rec,
-                         bool color,
-                         bool isDup,
-                         INSDC_SRA_platform_id platform,
-                         bool keepMismatchQual,
-                         bool no_real_output,
-                         bool hasTI,
-                         char const *QualQuantizer
-                         )
-{
-    rc_t rc = 0;
-    uint8_t nreads = rec->numreads;
-    unsigned i;
-    unsigned seqLen;
-    int64_t dummyRowId;
-    
-    uint8_t readInfo[4096];
-    void *h_readInfo = NULL;
-    
-    INSDC_coord_zero *readStart = (void *)readInfo;
-    INSDC_coord_len *readLen;
-    uint8_t *alcnt;
-    INSDC_SRA_xread_type *readType;
-    INSDC_SRA_read_filter *readFilter;
-    bool *mask = NULL;
-    size_t const elemSize = sizeof(alcnt[0]) + sizeof(readType[0])
-                          + sizeof(readStart[0]) + sizeof(readLen[0])
-                          + sizeof(readFilter[0]);
-    
-    TableWriterSeqData data;
-
-    for (i = seqLen = 0; i != nreads; ++i) {
-        seqLen += rec->readLen[i];
-    }
-    
-    if (nreads * elemSize + keepMismatchQual * seqLen * sizeof(mask[0]) > sizeof(readInfo))
-    {
-        h_readInfo = malloc(nreads * elemSize + keepMismatchQual * seqLen * sizeof(mask[0]));
-        if (h_readInfo == NULL)
-            return RC(rcAlign, rcTable, rcWriting, rcMemory, rcExhausted);
-        readStart = h_readInfo;
-    }
-    readLen = (INSDC_coord_len *)&readStart[nreads];
-    alcnt = (uint8_t *)&readLen[nreads];
-    readType = (INSDC_SRA_xread_type *)&alcnt[nreads];
-    readFilter = (INSDC_SRA_read_filter *)&readType[nreads];
-    
-    if (keepMismatchQual) {
-        mask = (bool *)&readFilter[nreads];
-        
-        for (i = 0; i != seqLen; ++i) {
-            mask[i] = (rec->qual[i] & 0x80) != 0;
-        }
-    }
-    
-    for (i = 0; i != nreads; ++i) {
-        alcnt[i] = rec->aligned[i] ? 1 : 0;
-        readLen[i] = rec->readLen[i];
-        readStart[i] = rec->readStart[i];
-        readType[i] = readLen[i] ? SRA_READ_TYPE_BIOLOGICAL : SRA_READ_TYPE_TECHNICAL;
-        switch ( rec->orientation[i] )
-        {
-            case ReadOrientationForward:
-                readType[i] |= SRA_READ_TYPE_FORWARD;
-                break;
-            case ReadOrientationReverse:
-                readType[i] |= SRA_READ_TYPE_REVERSE;
-                break;
-            case ReadOrientationUnknown:
-            default:
-                break;
-        }
-        readFilter[i] = isDup ? SRA_READ_FILTER_CRITERIA
-                      : rec->is_bad[i] ? SRA_READ_FILTER_REJECT : SRA_READ_FILTER_PASS;
-    }
-
-    memset(&data, 0, sizeof(data));
-    
-    data.sequence.buffer = rec->seq;
-    data.sequence.elements = seqLen;
-    
-    data.quality.buffer = rec->qual;
-    data.quality.elements = seqLen;
-    
-    if (keepMismatchQual) {
-        data.no_quantize_mask.buffer = mask;
-        data.no_quantize_mask.elements = seqLen;
-    }
-    
-    data.alignment_count.buffer = alcnt;
-    data.alignment_count.elements = nreads;
-    
-    data.nreads = nreads;
-    
-    data.read_type.buffer = readType;
-    data.read_type.elements = nreads;
-    
-    data.read_start.buffer = readStart;
-    data.read_start.elements = nreads;
-    
-    data.read_len.buffer = readLen;
-    data.read_len.elements = nreads;
-    
-    data.tmp_key_id = rec->keyId;
-    
-    data.spot_group.buffer = rec->spotGroup;
-    data.spot_group.elements = rec->spotGroupLen;
-    
-    data.cskey.buffer = rec->cskey;
-    data.cskey.elements = nreads;
-    
-    data.read_filter.buffer = readFilter;
-    data.read_filter.elements = nreads;
-    
-    data.platform.buffer = &platform;
-    data.platform.elements = 1;
-    
-    data.ti.buffer = rec->ti;
-    data.ti.elements = nreads;
-    
-    if (!no_real_output) {
-        if (self->tbl == NULL) {
-            int csoption = (color ? ewseq_co_ColorSpace : 0);
-
-	    if(hasTI) csoption |= ewseq_co_TI;
-            
-            rc = TableWriterSeq_Make(&self->tbl, self->db,
-                                     csoption | ewseq_co_NoLabelData | ewseq_co_SpotGroup, QualQuantizer);
-        }
-        if (rc == 0) {
-            rc = TableWriterSeq_Write(self->tbl, &data, &dummyRowId);
-        }
-    }
-    
-    if (h_readInfo)
-        free(h_readInfo);
-    
-    return rc;
-}
-
-rc_t SequenceDoneWriting(SequenceWriter *self)
-{
-    return TableWriterSeq_TmpKeyStart(self->tbl);
-}
-
-rc_t SequenceReadKey(const SequenceWriter *cself, int64_t row, uint64_t *keyId)
-{
-    return TableWriterSeq_TmpKey(cself->tbl, row, keyId);
-}
-
-rc_t SequenceUpdateAlignData(SequenceWriter *self, int64_t rowId, unsigned nreads,
-                             int64_t const primeId[/* nreads */],
-                             uint8_t const algnCnt[/* nreads */])
-{
-    TableWriterData data[2];
-    
-    data[0].buffer = primeId; data[0].elements = nreads;
-    data[1].buffer = algnCnt; data[1].elements = nreads;
-    
-    return TableWriterSeq_WriteAlignmentData(self->tbl, rowId, &data[0], &data[1]);
-}
-
-void SequenceWhack(SequenceWriter *self, bool commit) {
-    uint64_t dummyRows;
-    rc_t rc;
-    
-    VDatabaseRelease(self->db);
-    
-    if (self->tbl == NULL)
-        return;
-    
-    rc = TableWriterSeq_Whack(self->tbl, commit, &dummyRows);
-}
-
-/* MARK: SequenceRecord Object */
-static
-rc_t SequenceRecordResize(SequenceRecord *self,
-                          KDataBuffer *storage,
-                          unsigned numreads,
-                          unsigned seqLen)
-{
-    size_t sz;
-    rc_t rc;
-    
-    sz = seqLen * (sizeof(self->seq[0]) + sizeof(self->qual[0])) +
-         numreads * (sizeof(self->ti) +
-                     sizeof(self->readStart[0]) +
-                     sizeof(self->readLen[0]) +
-                     sizeof(self->aligned[0]) + 
-                     sizeof(self->orientation[0]) +
-                     sizeof(self->alignmentCount[0]) +
-                     sizeof(self->cskey[0])
-                     );
-    storage->elem_bits = 8;
-    rc = KDataBufferResize(storage, sz);
-    if (rc)
-        return rc;
-    self->numreads = numreads;
-    
-    self->ti = (uint64_t *)storage->base;
-    self->readStart = (uint32_t *)&self->ti[numreads];
-    self->readLen = (uint32_t *)&self->readStart[numreads];
-    self->aligned = (bool *)&self->readLen[numreads];
-    self->orientation = (uint8_t *)&self->aligned[numreads];
-    self->is_bad = (uint8_t *)&self->orientation[numreads];
-    self->alignmentCount = (uint8_t *)&self->is_bad[numreads];
-    self->cskey = (char *)&self->alignmentCount[numreads];
-    self->seq = (char *)&self->cskey[numreads];
-    self->qual = (uint8_t *)&self->seq[seqLen];
-
-    self->spotGroup = NULL;
-    self->spotGroupLen = 0;
-    
-    return 0;
-}
-
-rc_t SequenceRecordInit(SequenceRecord *self, unsigned numreads, unsigned readLen[])
-{
-    unsigned i;
-    unsigned seqlen = 0;
-    rc_t rc;
-    
-    for (i = 0; i != numreads; ++i) {
-        seqlen += readLen[i];
-    }
-    rc = SequenceRecordResize(self, &self->storage, numreads, seqlen);
-    if (rc)
-        return rc;
-    memset(self->storage.base, 0, KDataBufferBytes(&self->storage));
-    
-    for (seqlen = 0, i = 0; i != numreads; ++i) {
-        self->readLen[i] = readLen[i];
-        self->readStart[i] = seqlen;
-        seqlen += readLen[i];
-    }
-    self->numreads = numreads;
-    memset(self->cskey, 'T', numreads);
-    return 0;
-}
-
-rc_t SequenceRecordAppend(SequenceRecord *self,
-                          const SequenceRecord *other
-                          )
-{
-    /* save the locations of the original data */
-    unsigned const seq = (uint8_t const *)self->seq - (uint8_t const *)self->storage.base;
-    unsigned const qual = (uint8_t const *)self->qual - (uint8_t const *)self->storage.base;
-    unsigned const cskey = (uint8_t const *)self->cskey - (uint8_t const *)self->storage.base;
-    unsigned const alignmentCount = (uint8_t const *)self->alignmentCount - (uint8_t const *)self->storage.base;
-    unsigned const is_bad = (uint8_t const *)self->is_bad - (uint8_t const *)self->storage.base;
-    unsigned const orientation = (uint8_t const *)self->orientation - (uint8_t const *)self->storage.base;
-    unsigned const aligned = (uint8_t const *)self->aligned - (uint8_t const *)self->storage.base;
-    unsigned const ti = (uint8_t const *)self->ti - (uint8_t const *)self->storage.base;
-    unsigned const readLen = (uint8_t const *)self->readLen - (uint8_t const *)self->storage.base;
-/*    unsigned const readStart = (uint8_t const *)self->readStart - (uint8_t const *)self->storage.base;*/
-
-    rc_t rc;
-    unsigned seqlen;
-    unsigned otherSeqlen;
-    unsigned i;
-    unsigned numreads = self->numreads;
-    
-    for (seqlen = 0, i = 0; i != numreads; ++i) {
-        seqlen += self->readLen[i];
-    }
-    for (otherSeqlen = 0, i = 0; i != other->numreads; ++i) {
-        otherSeqlen += other->readLen[i];
-    }
-
-    rc = SequenceRecordResize(self, &self->storage, self->numreads + other->numreads, seqlen + otherSeqlen);
-    if (rc)
-        return rc;
-    /* this needs to be reverse order from assignment in Resize function
-     * these regions can overlap
-     */
-    memmove(self->qual,             &((uint8_t const *)self->storage.base)[qual],              seqlen);
-    memmove(self->seq,              &((uint8_t const *)self->storage.base)[seq],               seqlen);
-    memmove(self->cskey,            &((uint8_t const *)self->storage.base)[cskey],             numreads * sizeof(self->cskey[0]));
-    memmove(self->alignmentCount,   &((uint8_t const *)self->storage.base)[alignmentCount],    numreads * sizeof(self->alignmentCount[0]));
-    memmove(self->is_bad,           &((uint8_t const *)self->storage.base)[is_bad],            numreads * sizeof(self->is_bad[0]));
-    memmove(self->orientation,      &((uint8_t const *)self->storage.base)[orientation],       numreads * sizeof(self->orientation[0]));
-    memmove(self->aligned,          &((uint8_t const *)self->storage.base)[aligned],           numreads * sizeof(self->aligned[0]));
-    memmove(self->readLen,          &((uint8_t const *)self->storage.base)[readLen],           numreads * sizeof(self->readLen[0]));
-    memmove(self->ti,               &((uint8_t const *)self->storage.base)[ti],                numreads * sizeof(self->ti[0]));
-    
-    memcpy(&self->ti[numreads],             other->ti,              other->numreads * sizeof(self->ti[0]));
-    memcpy(&self->readLen[numreads],        other->readLen,         other->numreads * sizeof(self->readLen[0]));
-    memcpy(&self->aligned[numreads],        other->aligned,         other->numreads * sizeof(self->aligned[0]));
-    memcpy(&self->orientation[numreads],    other->orientation,     other->numreads * sizeof(self->orientation[0]));
-    memcpy(&self->is_bad[numreads],         other->is_bad,          other->numreads * sizeof(self->is_bad[0]));
-    memcpy(&self->alignmentCount[numreads], other->alignmentCount,  other->numreads * sizeof(self->alignmentCount[0]));
-    memcpy(&self->cskey[numreads],          other->cskey,           other->numreads * sizeof(self->cskey[0]));
-    memcpy(&self->seq[seqlen],              other->seq,             otherSeqlen);
-    memcpy(&self->qual[seqlen],             other->qual,            otherSeqlen);
-    
-    for (i = 0, seqlen = 0; i != self->numreads; ++i) {
-        self->readStart[i] = seqlen;
-        seqlen += self->readLen[i];
-    }
-    
-    return 0;
-}
diff --git a/libs/ncbi-vdb/Makefile b/libs/ncbi-vdb/Makefile
deleted file mode 100644
index 8821403..0000000
--- a/libs/ncbi-vdb/Makefile
+++ /dev/null
@@ -1,152 +0,0 @@
-# ===========================================================================
-#
-#                            PUBLIC DOMAIN NOTICE
-#               National Center for Biotechnology Information
-#
-#  This software/database is a "United States Government Work" under the
-#  terms of the United States Copyright Act.  It was written as part of
-#  the author's official duties as a United States Government employee and
-#  thus cannot be copyrighted.  This software/database is freely available
-#  to the public for use. The National Library of Medicine and the U.S.
-#  Government have not placed any restriction on its use or reproduction.
-#
-#  Although all reasonable efforts have been taken to ensure the accuracy
-#  and reliability of the software and data, the NLM and the U.S.
-#  Government do not and cannot warrant the performance or results that
-#  may be obtained by using this software or data. The NLM and the U.S.
-#  Government disclaim all warranties, express or implied, including
-#  warranties of performance, merchantability or fitness for any particular
-#  purpose.
-#
-#  Please cite the author in any work or product based on this material.
-#
-# ===========================================================================
-
-
-default: std
-
-TOP ?= $(shell ../../build/abspath.sh ../..)
-MODULE = libs/ncbi-vdb
-
-EXT_LIBS = \
-	libncbi-vdb \
-	libncbi-wvdb
-
-ALL_LIBS = \
-	$(EXT_LIBS)
-
-include $(TOP)/build/Makefile.env
-
-#-------------------------------------------------------------------------------
-# outer targets
-#
-all std: makedirs
-	@ $(MAKE_CMD) $(TARGDIR)/std
-
-$(EXT_LIBS): makedirs
-	@ $(MAKE_CMD) $(LIBDIR)/$@
-
-.PHONY: all std $(ALL_LIBS)
-
-#-------------------------------------------------------------------------------
-# std
-#
-$(TARGDIR)/std: \
-	$(addprefix $(LIBDIR)/,$(EXT_LIBS))
-
-.PHONY: $(TARGDIR)/all $(TARGDIR)/std
-
-#-------------------------------------------------------------------------------
-# clean
-#
-clean: stdclean
-
-.PHONY: clean
-
-#-------------------------------------------------------------------------------
-# virtual db library
-#
-$(LIBDIR)/libncbi-vdb: $(addprefix $(LIBDIR)/libncbi-vdb.,$(LIBEXT))
-
-ifeq (linux,$(OS))
-LIBKFF = kff magic
-LIBVDB_BLAST = vdb-blast
-else
-LIBKFF =
-LIBVDB_BLAST =
-endif
-
-ifeq (win,$(OS))
-LIBKQ =
-LIBKXML =
-else
-LIBKQ = kq
-LIBKXML = kxml kxfs
-endif
-
-VDB_LIB_CMN = \
-	align-access \
-	ncbi-bam \
-	bz2 \
-	kfg \
-	kfs \
-	klib \
-	kproc \
-	$(LIBKQ) \
-	krypto \
-	ksrch \
-	$(LIBKXML) \
-	kns \
-	vfs \
-	z
-
-VDB_LIB_RD = \
-	$(VDB_LIB_CMN) \
-	align-reader \
-	ascp \
-	$(EXT_SCHEMA_MODULES) \
-	kdb \
-	sradb \
-	srareader \
-	$(LIBVDB-BLAST) \
-	vdb
-
-VDB_OBJ = \
-	$(addprefix $(ILIBDIR)/lib,$(addsuffix .a,$(VDB_LIB_RD)))
-
-VDB_LIB = \
-	$(addprefix -s,$(VDB_LIB_RD))
-
-$(LIBDIR)/libncbi-vdb.$(SHLX): $(VDB_OBJ)
-	$(LD) --dlib --vers $(SRCDIR) -o $@ $(VDB_LIB)
-
-$(LIBDIR)/libncbi-vdb.$(LIBX): $(VDB_OBJ)
-	$(LD) --slib --vers $(SRCDIR) -o $@ $(VDB_LIB)
-
-#-------------------------------------------------------------------------------
-# update version
-#
-$(LIBDIR)/libncbi-wvdb: $(addprefix $(LIBDIR)/libncbi-wvdb.,$(LIBEXT))
-
-VDB_LIB_RDWR = \
-	$(VDB_LIB_CMN) \
-	align-writer \
-	waxf \
-	wkdb \
-	wsradb \
-	wsraxf \
-	wvdb \
-	wvxf \
-	wwgsxf
-
-WVDB_OBJ = \
-	$(addprefix $(ILIBDIR)/lib,$(addsuffix .a,$(VDB_LIB_RDWR)))
-
-WVDB_LIB = \
-	$(addprefix -s,$(VDB_LIB_RDWR))
-
-$(LIBDIR)/libncbi-wvdb.$(SHLX): $(WVDB_OBJ)
-	$(LD) --dlib --vers $(SRCDIR) -o $@ $(WVDB_LIB) -lxml2
-
-$(LIBDIR)/libncbi-wvdb.$(LIBX): $(WVDB_OBJ)
-	$(LD) --slib --vers $(SRCDIR) -o $@ $(WVDB_LIB)
diff --git a/libs/ncbi-vdb/libncbi-vdb.vers b/libs/ncbi-vdb/libncbi-vdb.vers
deleted file mode 100644
index cc6c9a4..0000000
--- a/libs/ncbi-vdb/libncbi-vdb.vers
+++ /dev/null
@@ -1 +0,0 @@
-2.3.5
diff --git a/libs/ncbi-vdb/libncbi-wvdb.vers b/libs/ncbi-vdb/libncbi-wvdb.vers
deleted file mode 100644
index cc6c9a4..0000000
--- a/libs/ncbi-vdb/libncbi-wvdb.vers
+++ /dev/null
@@ -1 +0,0 @@
-2.3.5
diff --git a/libs/search/Makefile b/libs/search/Makefile
deleted file mode 100644
index 1157a73..0000000
--- a/libs/search/Makefile
+++ /dev/null
@@ -1,97 +0,0 @@
-# ===========================================================================
-#
-#                            PUBLIC DOMAIN NOTICE
-#               National Center for Biotechnology Information
-#
-#  This software/database is a "United States Government Work" under the
-#  terms of the United States Copyright Act.  It was written as part of
-#  the author's official duties as a United States Government employee and
-#  thus cannot be copyrighted.  This software/database is freely available
-#  to the public for use. The National Library of Medicine and the U.S.
-#  Government have not placed any restriction on its use or reproduction.
-#
-#  Although all reasonable efforts have been taken to ensure the accuracy
-#  and reliability of the software and data, the NLM and the U.S.
-#  Government do not and cannot warrant the performance or results that
-#  may be obtained by using this software or data. The NLM and the U.S.
-#  Government disclaim all warranties, express or implied, including
-#  warranties of performance, merchantability or fitness for any particular
-#  purpose.
-#
-#  Please cite the author in any work or product based on this material.
-#
-# ===========================================================================
-
-
-default: std
-
-TOP ?= $(shell ../../build/abspath.sh ../..)
-MODULE = libs/search
-
-INT_LIBS = \
-	libksrch
-
-ALL_LIBS = \
-	$(INT_LIBS)
-
-include $(TOP)/build/Makefile.env
-
-#-------------------------------------------------------------------------------
-# outer targets
-#
-all std: makedirs
-	@ $(MAKE_CMD) $(TARGDIR)/std
-
-$(INT_LIBS): makedirs
-	@ $(MAKE_CMD) $(ILIBDIR)/$@
-
-.PHONY: all std $(ALL_LIBS)
-
-#-------------------------------------------------------------------------------
-# std
-#
-$(TARGDIR)/std: \
-	$(addprefix $(ILIBDIR)/,$(INT_LIBS))
-
-.PHONY: $(TARGDIR)/all $(TARGDIR)/std
-
-#-------------------------------------------------------------------------------
-# clean
-#
-clean: stdclean
-	@ rm -f $(addsuffix .*,$(addprefix $(ILIBDIR)/,libnucstrstr libgrep))
-
-.PHONY: clean
-
-#-------------------------------------------------------------------------------
-# search
-#
-$(ILIBDIR)/libksrch: $(addprefix $(ILIBDIR)/libksrch.,$(ILIBEXT))
-
-SEARCH_SRC = \
-	search \
-	fgrep-dumb \
-	fgrep-boyermoore \
-	fgrep-aho \
-	agrep-wumanber \
-	agrep-myers \
-	agrep-myersunltd \
-	agrep-dp
-
-ifeq (linux,$(OS))
-SEARCH_SRC += \
-	nucstrstr-icc-$(ARCH)-$(BUILDTYPE)
-else
-SEARCH_SRC += \
-	nucstrstr
-endif
-
-SEARCH_OBJ = \
-	$(addsuffix .$(LOBX),$(SEARCH_SRC))
-
-SEARCH_LIB = \
-	-dklib \
-	-dm
-
-$(ILIBDIR)/libksrch.$(LIBX): $(SEARCH_OBJ)
-	$(LD) --slib -o $@ $^ $(SEARCH_LIB)
diff --git a/libs/search/agrep-dp.c b/libs/search/agrep-dp.c
deleted file mode 100644
index 45a188e..0000000
--- a/libs/search/agrep-dp.c
+++ /dev/null
@@ -1,881 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/*
-  From Gene Myers, 1998, 
-  "A Fast Bit-vector Algorithm for Approxsimat String Matching
-  Based on Dynamic Programming" -- explains dp pretty well.
-
-  If we place the pattern down the left of a matrix,
-  and the scored text along the top horizontally,
-  pattern p(length m) and text t(length n),
-  we can compute the dynamic programming matrix C[0..m, 0..n] as 
-
-  C[i,j] = min{C[i-1,j-1]+(if p(i)=t(j) then 0 else 1), C[i-1,j]+1, C[i,j-1]+1}
-
-  given that C[0,j] = 0 for all j.
-  We can replace the constants with table-driven scores,
-  so that we have a match cost for (P(i),t(i)), 
-  and costs for skippings parts of the pattern (first 1) or text (second 1).
-*/
-
-#include <search/extern.h>
-#include <os-native.h>
-#include <compiler.h>
-#include <sysalloc.h>
-#include "search-priv.h"
-
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h> /* lroundf */
-
-#define _TRACE 0
-
-static
-void reverse_string(const char* from, int32_t len, char *to) 
-{
-    const char* p = from + len;
-    while( p != from ) {
-        *to++ = *--p;
-    }
-    *to = '\0';
-}
-
-struct DPParams {
-    char *pattern;
-    char *rpattern;
-    AgrepFlags mode;
-    int32_t plen;
-};
-
-rc_t AgrepDPMake( DPParams **self, AgrepFlags mode, const char *pattern )
-{
-    rc_t rc = 0;
-
-    if( (*self = malloc(sizeof(**self))) == NULL ) {
-        rc = RC(rcText, rcString, rcSearching, rcMemory, rcExhausted);
-    } else {
-        int32_t i;
-        (*self)->mode = mode;
-        (*self)->pattern = strdup(pattern);
-        (*self)->plen = strlen(pattern);
-        (*self)->rpattern = malloc((*self)->plen + 1);
-        if( (*self)->pattern == NULL || (*self)->pattern == NULL ) {
-            rc = RC(rcText, rcString, rcSearching, rcMemory, rcExhausted);
-        } else if( mode & AGREP_MODE_ASCII ) {
-            if( mode & AGREP_IGNORE_CASE ) {
-                for(i = 0; i < (*self)->plen; i++) {
-                    (*self)->pattern[i] = tolower((*self)->pattern[i]);
-                }
-            }
-        }
-    }
-    if( rc != 0 ) {
-        AgrepDPFree(*self);
-    } else {
-        reverse_string((*self)->pattern, (*self)->plen, (*self)->rpattern);
-    }
-    return rc;
-}
-
-void AgrepDPFree( DPParams *self )
-{
-    if( self != NULL ) {
-        free(self->pattern);
-        free(self->rpattern);
-        free(self);
-    }
-}
-
-#if _TRACE
-static
-void print_col_as_row(int32_t *col, int32_t plen) 
-{
-    int32_t i;
-    for (i=0; i<=plen; i++) {
-        printf("%2d ", col[i]);
-    }
-    printf("\n");
-}
-#endif
-
-static
-void init_col(const char *p, int32_t plen, int32_t *col)
-{
-    int32_t i;
-    col[0] = 0;
-    for (i=1; i<=plen; i++) {
-        col[i] = col[i-1] + 1;
-    }  
-}
-
-bool na4_match(unsigned char p, unsigned char c)
-{
-    if( p == c ) {
-        return true;
-    } else {
-        const unsigned char* ps = IUPAC_decode[p];
-        const unsigned char* cs = IUPAC_decode[c];
-        if( ps != NULL && cs != NULL ) {
-            while( *ps != '\0' ) {
-                while( *cs != '\0' ) {
-                    if( *ps == *cs++ ) {
-                        return true;
-                    }
-                }
-                ps++;
-            }
-        }
-    }
-    return false;
-}
-
-#undef min
-#define min(a,b) ((a)<(b)?(a):(b))
-
-/* No longer returns a return code. */
-static
-void compute_dp_next_col(const char *p, int32_t plen, AgrepFlags mode, int32_t startcost, char t, int32_t *prev, int32_t *nxt)
-{
-    int32_t i;
-    int32_t matchscore = 0;
-    nxt[0] = startcost;
-
-    if( (mode & AGREP_TEXT_EXPANDED_2NA) && t < 5 ) {
-        t = "ACGTN"[(unsigned char)t];
-    }
-    for(i = 1; i <= plen; i++) {
-        if( p[i - 1] == t ) {
-            matchscore = 0;
-        } else if( mode & AGREP_MODE_ASCII ) {
-            if( mode & AGREP_IGNORE_CASE ) {
-                t = tolower(t);
-            }
-            if( p[i - 1] == t ) {
-                matchscore = 0;
-            }
-        } else if( (mode & AGREP_PATTERN_4NA) && na4_match(p[i - 1], t) ) {
-            matchscore = 0;
-        } else {
-            matchscore = 1;
-        }
-        /*
-        a = prev[i-1] + matchscore;
-        b = nxt[i-1] + 1;
-        c = prev[i] + 1;
-        if (a < b) {
-            if (a < c) {
-                nxt[i] = a;
-            } else {
-                nxt[i] = c;
-            }
-        } else {
-            if (c < b) {
-                nxt[i] = c;
-            } else {
-                nxt[i] = b;
-            }
-            }*/
-        nxt[i] = min(min(prev[i-1] + matchscore,
-                         nxt[i-1] + 1),
-                     prev[i] + 1);
-    }
-}
-
-/*
-This is new functionality to support partial matches at the beginning
-or end of a sequence.
-Errors is the number of errors over the whole pattern,
-so we can assume a constant error rate, or do something more sophisticated.
-Bestpos is the last position that seems to be a match,
-and returns the number of "hits" and "misses" where a hit decreases the
-edit distance score, and a miss is everything else.
-
-The way to use this is use it in the "forward" direction to find an endpoint,
-then assume that's the end of the pattern, and do a reverse search
-compare with the (reversed) pattern to see if it really matches
-the end of the pattern.  See how it's used in the system for more hints.
-*/
-
-LIB_EXPORT void CC dp_scan_for_left_match ( char *pattern, int errors, char *buf, 
-    int buflen, int *bestpos, int *ret_hits, int *ret_misses )
-{
-    int plen = strlen(pattern);
-    int *prev = malloc(sizeof(int)*(plen+1));
-    int *nxt = malloc(sizeof(int)*(plen+1));
-    int *tmp;
-    int i;
-
-    int patlen = strlen(pattern);
-    float errrate = (float)errors / (float)patlen;
-    float play;
-
-    int hits = 0;
-    int misses = 0;
-
-    int change;
-
-    int lastscore = plen;
-
-    int cont = 1;
-
-    int lastwasmiss = 0;
-    int trailing_misses = 0;
-
-    *bestpos = -1;
-#if _TRACE
-    printf("Err rate is %f\n", errrate);
-#endif
-
-    init_col(pattern, plen, nxt);
-#if _TRACE
-    print_col_as_row(nxt, plen);
-#endif
-    for (i=0; i<buflen && cont; i++) {
-        tmp = prev; prev = nxt; nxt = tmp;
-        compute_dp_next_col(pattern, plen, 0, buf[i], i, prev, nxt);
-
-        change = lastscore - nxt[plen];
-        if (change == 1) {
-            lastwasmiss = 0;
-            trailing_misses = 0;
-            hits++;
-        } else {
-            if (lastwasmiss)
-                trailing_misses++;
-            else
-                trailing_misses = 1;
-            misses++;
-            lastwasmiss = 1;
-        }
-
-        play = errrate * (i+1);
-
-        cont = (misses < (1.0+play));
-
-#if _TRACE
-        printf("i %d char %c score %d diff %d continue %d misses %d play %f\n", 
-               i, buf[i], nxt[plen], lastscore - nxt[plen], cont, misses, play);
-#endif
-        lastscore = nxt[plen];
-
-    }
-    /* Settle up */
-    i--;
-#if _TRACE
-    printf("Total hits: %d trailing misses: %d  position: %d\n",
-           hits, trailing_misses, i);
-#endif
-    free(prev);
-    free(nxt);
-
-    *bestpos = i - trailing_misses;
-    /* Not our usual score. */
-    *ret_hits = hits;
-    *ret_misses = misses;
-}
-
-
-static
-AgrepContinueFlag dp_callback_begin(const AgrepCallArgs *args, int32_t end, int32_t forwardscore)
-{
-    AgrepFlags mode = args->self->mode;
-    char *reverse_pattern = args->self->dp->rpattern;
-    int32_t threshold = args->threshold;
-    const char *buf = args->buf;
-    AgrepMatchCallback cb = args->cb;
-    void *cbinfo = args->cbinfo;
-
-    int32_t plen = strlen(reverse_pattern);
-    int32_t *prev = malloc(sizeof(int32_t)*(plen+1));
-    int32_t *nxt = malloc(sizeof(int32_t)*(plen+1));
-    AgrepMatch match;
-    AgrepContinueFlag cont;
-    int32_t *tmp;
-    int32_t i;
-
-    int32_t curscore = 0;
-    int32_t curlast = 0;
-    int32_t continuing = 0;
-
-    int32_t limit;
-
-    init_col(reverse_pattern, plen, nxt);
-#if _TRACE
-    print_col_as_row(nxt, plen);
-#endif
-
-    limit = end - args->self->dp->plen - threshold - 1;
-    if (limit < 0)
-        limit = 0;
-    
-    for (i=end; i>=limit; i--) {
-        tmp = prev; prev = nxt; nxt = tmp;
-        /* For the reverse scan, we need to make the initial cost
-           of the column depend upon the price of skipping the
-           suffix (up to this point) of the text */
-        compute_dp_next_col(reverse_pattern, plen, mode, end-i+1,
-                            buf[i], prev, nxt);
-
-        if ((mode & AGREP_LEFT_MAINTAIN_SCORE)?
-            nxt[plen] <= forwardscore:
-            nxt[plen] <= threshold)
-        {
-            if (continuing) {
-                if (nxt[plen] < curscore) {
-                    curscore = nxt[plen];
-                    curlast = i;
-                } else if (nxt[plen] == curscore &&
-                           (mode & AGREP_EXTEND_SAME)) {
-                    curlast = i;
-                } else {
-                    continuing = 0;
-                    match.score = curscore;
-                    match.position = curlast;
-                    match.length = end - curlast + 1;
-                    cont = AGREP_CONTINUE;
-                    (*cb)(cbinfo, &match, &cont);
-                    if (cont != AGREP_CONTINUE)
-                        goto EXIT;
-                }
-            } else if ((mode & AGREP_EXTEND_SAME) ||
-                       (mode & AGREP_EXTEND_BETTER)) {
-                curscore = nxt[plen];
-                curlast = i;
-                continuing = 1;
-            } else {
-                match.score = nxt[plen];
-                match.position = i;
-                match.length = end - i + 1;
-                cont = AGREP_CONTINUE;
-                (*cb)(cbinfo, &match, &cont);
-                if (cont != AGREP_CONTINUE)
-                    goto EXIT;
-            }
-        }
-#if _TRACE
-        print_col_as_row(nxt, plen);
-#endif
-    }
-    if (continuing) {
-        continuing = 0;
-        match.score = curscore;
-        match.position = curlast;
-        match.length = end - curlast + 1;
-        cont = AGREP_CONTINUE;
-        (*cb)(cbinfo, &match, &cont);
-        goto EXIT;
-    }
-    cont = AGREP_CONTINUE;
-EXIT:
-    free(prev);
-    free(nxt);
-    return cont;
-}
-
-rc_t CC dp_end_callback( const void *cbinfo, const AgrepMatch *match, AgrepContinueFlag *flag )
-{
-    const AgrepCallArgs *cbi = cbinfo;
-    *flag = dp_callback_begin(cbi, match->position, match->score);
-    return 0;
-}
-
-
-static
-void dp_callback_end( const AgrepCallArgs *args )
-{
-    AgrepFlags mode = args->self->mode;
-    char *pattern = args->self->dp->pattern;
-    int32_t threshold = args->threshold;
-    const char *buf = args->buf;
-    int32_t buflen = args->buflen;
-
-    AgrepMatchCallback cb = dp_end_callback;
-    const void *cbinfo = args;
-
-    int32_t plen = strlen(pattern);
-    int32_t *prev = malloc(sizeof(int32_t)*(plen+1));
-    int32_t *nxt = malloc(sizeof(int32_t)*(plen+1));
-    int32_t curscore = 0;
-    int32_t curlast = 0;
-    int32_t continuing = 0;
-
-    int32_t startingcost = 0;
-    int32_t limit;
-
-    AgrepMatch match;
-    AgrepContinueFlag cont;
-    int32_t *tmp;
-    int32_t i;
-
-    init_col(pattern, plen, nxt);
-#if _TRACE
-    print_col_as_row(nxt, plen);
-#endif
-    
-    limit = buflen;
-    if (mode & AGREP_ANCHOR_LEFT) {
-        limit = args->self->dp->plen + threshold+1;
-        if (limit > buflen) {
-            limit = buflen;
-        }
-        cb = args->cb;
-        cbinfo = args->cbinfo;
-    }
-
-    for (i=0; i<limit; i++) {
-        tmp = prev; prev = nxt; nxt = tmp;
-
-        if (mode & AGREP_ANCHOR_LEFT) 
-            startingcost = i+1;
-        compute_dp_next_col(pattern, plen, mode, startingcost, 
-                            buf[i], prev, nxt);
-        if (nxt[plen] <= threshold) {
-
-            if (continuing) {
-                if (nxt[plen] < curscore &&
-                    ((mode & AGREP_EXTEND_BETTER) ||
-                     (mode & AGREP_EXTEND_SAME))) {
-                    curscore = nxt[plen];
-                    curlast = i;
-                } else if (nxt[plen] == curscore &&
-                           ((mode & AGREP_EXTEND_BETTER) ||
-                            (mode & AGREP_EXTEND_SAME))) {
-                    if (mode & AGREP_EXTEND_SAME) {
-                        curlast = i;
-                    }
-                } else {
-                    continuing = 0;
-                    match.score = curscore;
-                    if (mode & AGREP_ANCHOR_LEFT) {
-                        match.position = 0;
-                        match.length = curlast+1;
-                    } else {
-                        match.position = curlast;
-                        match.length = -1;
-                    }
-                    cont = AGREP_CONTINUE;
-                    (*cb)(cbinfo, &match, &cont);
-                    if (cont != AGREP_CONTINUE)
-                        goto EXIT;
-                }
-            } else if ((mode & AGREP_EXTEND_SAME) ||
-                       (mode & AGREP_EXTEND_BETTER)) {
-                curscore = nxt[plen];
-                curlast = i;
-                continuing = 1;
-            } else {
-                match.score = nxt[plen];
-                if (mode & AGREP_ANCHOR_LEFT) {
-                    match.position = 0;
-                    match.length = i+1;
-                } else {
-                    match.position = i;
-                    match.length = -1;
-                }
-                cont = AGREP_CONTINUE;
-                (*cb)(cbinfo, &match, &cont);
-                if (cont != AGREP_CONTINUE)
-                    goto EXIT;
-            }
-            /* If we're no longer under the threshold, we might
-               have been moving forward looking for a better match 
-            */
-        } else if (continuing) {
-            continuing = 0;
-            match.score = curscore;
-            if (mode & AGREP_ANCHOR_LEFT) {
-                match.position = 0;
-                match.length = curlast+1;
-            } else {
-                match.position = curlast;
-                match.length = -1;
-            }
-            cont = AGREP_CONTINUE;
-            (*cb)(cbinfo, &match, &cont);
-            if (cont != AGREP_CONTINUE)
-                goto EXIT;
-        }
-#if _TRACE
-        print_col_as_row(nxt, plen);
-#endif
-    }
-    if (continuing) {
-        continuing = 0;
-        match.score = curscore;
-        if (mode & AGREP_ANCHOR_LEFT) {
-            match.position = 0;
-            match.length = curlast+1;
-        } else {
-            match.position = curlast;
-            match.length = -1;
-        }
-        (*cb)(cbinfo, &match, &cont);
-    }
-EXIT:
-    free(prev);
-    free(nxt);
-}
-
-
-
-static
-uint32_t dp_find_end(const char *pattern, AgrepFlags mode, int32_t threshold, const char *buf, int32_t buflen, int32_t *bestpos, int32_t *bestscore) 
-{
-    int32_t plen = strlen(pattern);
-    int32_t *prev = malloc(sizeof(int32_t)*(plen+1));
-    int32_t *nxt = malloc(sizeof(int32_t)*(plen+1));
-    int32_t *tmp;
-    int32_t i;
-
-    int32_t foundit = 0;
-
-
-    *bestscore = 10000;
-    *bestpos = 1;
-
-    init_col(pattern, plen, nxt);
-#if _TRACE
-    print_col_as_row(nxt, plen);
-#endif
-    for (i=0; i<buflen; i++) {
-        tmp = prev; prev = nxt; nxt = tmp;
-        compute_dp_next_col(pattern, plen, mode, 0, buf[i], prev, nxt);
-        if (nxt[plen] <= threshold) {
-            if (foundit) {
-                if (nxt[plen] <= *bestscore) {
-                    *bestpos = i;
-                    *bestscore = nxt[plen];
-                } else {
-                    /* Here we'd extend even if the score was equal, maybe */
-                }
-            } else {
-                /* Ok, we have a match under threshold.
-                   Let's continue and see if we can improve on it.
-                */
-                *bestpos = i;
-                *bestscore = nxt[plen];
-                foundit = 1;
-            }
-        } else {
-            if (foundit)
-                goto EXIT;
-        }
-#if _TRACE
-        print_col_as_row(nxt, plen);
-#endif
-    }
-EXIT:
-    free(prev);
-    free(nxt);
-    if (foundit)
-        return 1;
-    return 0;
-}
-
-
-
-
-static
-uint32_t dp_find_begin(char *reverse_pattern, AgrepFlags mode, int32_t threshold, const char *buf, int32_t buflen, int32_t end, int32_t *begin) 
-{
-    int32_t plen = strlen(reverse_pattern);
-    int32_t *prev = malloc(sizeof(int32_t)*(plen+1));
-    int32_t *nxt = malloc(sizeof(int32_t)*(plen+1));
-    int32_t *tmp;
-    int32_t i;
-
-    int32_t limit;
-
-    int32_t foundit = 0;
-    int32_t bestscore = 10000;
-
-    *begin = 0;
-
-    limit = end - plen - threshold - 1;
-    if (limit < 0)
-        limit = 0;
-
-    init_col(reverse_pattern, plen, nxt);
-#if _TRACE
-    print_col_as_row(nxt, plen);
-#endif
-    for (i=end; i>=limit; i--) {
-        tmp = prev; prev = nxt; nxt = tmp;
-        /* We need to make the initial cost of this column
-           reflect the cost of skipping the suffix (up to this point)
-           of the text */
-        compute_dp_next_col(reverse_pattern, plen, mode, end-i, buf[i], prev, nxt);
-
-        if (nxt[plen] <= threshold) {
-            *begin = i;
-            bestscore = nxt[plen];
-            foundit = 1;
-        } else {
-            if (foundit)
-                goto EXIT;
-        }
-#if _TRACE
-        print_col_as_row(nxt, plen);
-#endif
-    }
-EXIT:
-    free(prev);
-    free(nxt);
-    if (foundit)
-        return 1;
-    return 0;
-}
-
-
-uint32_t AgrepDPFindFirst ( const DPParams *self, int32_t threshold, AgrepFlags mode, 
-        const char *buf, int32_t buflen, AgrepMatch *match )
-{
-    int32_t begin, end;
-    int32_t score;
-    if (dp_find_end(self->pattern, mode, threshold, buf, buflen, &end, &score)) {
-        if (dp_find_begin(self->rpattern, mode, threshold, buf, buflen, end, &begin)) {
-            match->position = begin;
-            match->length = end-begin+1;
-            match->score = score;
-            return 1;
-        }
-    }
-    return 0;
-}
-
-
-void AgrepDPFindAll( const AgrepCallArgs *args )
-{
-    dp_callback_end( args );
-}
-
-
-/* Try the longest match first. */
-LIB_EXPORT uint32_t CC has_left_approx_match( char *pattern, uint32_t errors, 
-                               char *buf, size_t buflen, 
-                               uint32_t *length, uint32_t *errcnt )
-{
-    int32_t plen = strlen(pattern);
-    int32_t *prev = malloc(sizeof(int)*(plen+1));
-    int32_t *nxt = malloc(sizeof(int)*(plen+1));
-    int32_t *tmp;
-    int32_t i, j;
-    int32_t allowable;
-    char *subpattern;
-    int32_t dist;
-
-    int32_t found = 0;
-    int32_t foundpos = 0;
-    int32_t founderr = 0;
-
-    for (i=plen; i>=8; i--) {
-
-        /* See if the first i chars of the text match the last i
-           chars of the pattern with (errors) errors.
-        */
-        subpattern = pattern + (plen - i);
-        init_col(subpattern, i, nxt);
-        for (j=0; j<i; j++) {
-            tmp = prev; prev = nxt; nxt = tmp;
-            compute_dp_next_col(subpattern, i, 0, buf[j], j, prev, nxt);
-        }
-        dist = nxt[i];
-        allowable = 1+lroundf((float)i * (float)errors / (float)plen);
-        if (found) {
-            if (dist <= founderr) {
-                foundpos = i-1;
-                founderr = dist;
-            } else {
-                goto DONE;
-            }
-        } else if (dist <= allowable) {
-            /* Found a match */
-            found = 1;
-            foundpos = i-1;
-            founderr = dist;
-
-            /* Continue a bit to see if something's equally good or better */
-        }
-    }
-    DONE:
-    free(prev);
-    free(nxt);
-    if (found) {
-        *length = foundpos+1;
-        *errcnt = founderr;
-        return 1;
-    }
-    return 0;
-}
-
-
-/* Try the longest match first. */
-LIB_EXPORT uint32_t CC has_right_approx_match( char *pattern, uint32_t errors, 
-                                char *buf, size_t buflen, 
-                                uint32_t *bestpos, uint32_t *errcnt )
-{
-    uint32_t plen = strlen(pattern);
-    int32_t *prev = malloc(sizeof(int)*(plen+1));
-    int32_t *nxt = malloc(sizeof(int)*(plen+1));
-    int32_t *tmp;
-    int32_t i, j;
-    int32_t allowable;
-    char *subpattern, chBackup;
-    char *subpattern_r;
-    int32_t dist;
-
-    int32_t found = 0;
-    int32_t foundpos = 0;
-    int32_t founderr = 0;
-    int32_t bufj;
-
-    int bound = plen;
-    if (buflen < bound) {
-        bound = buflen;
-    }
-
-    subpattern = malloc(plen + 1);
-    subpattern_r = malloc(plen + 1);
-    strncpy(subpattern, pattern, plen);
-
-    for (i=bound; i>=8; i--, subpattern[i] = chBackup) {
-
-        /* See if the first i chars of the pattern match the last i
-           chars of the text with (errors) errors.
-           We match in reverse, so the initial penalty of skipping
-           the "first part" of the pattern means skipping the end
-        */
-        /* making prefix of length i out of pattern
-        (subpattern contains full copy of pattern)*/
-        chBackup = subpattern[i];
-        subpattern[i] = '\0';
-
-        reverse_string(subpattern, i, subpattern_r);
-        init_col(subpattern_r, i, nxt);
-
-        for (j=0; j<i; j++) {
-            bufj = buflen - j - 1;
-            tmp = prev; prev = nxt; nxt = tmp;
-            compute_dp_next_col(subpattern_r, i, 0, buf[bufj], j, prev, nxt);
-        }
-        dist = nxt[i];
-        allowable = 1+lroundf((float)i * (float)errors / (float)plen);
-        if (found) {
-            if (dist <= founderr) {
-                foundpos = buflen - i;
-                founderr = dist;
-            } else {
-                goto DONE;
-            }
-        } else if (dist <= allowable) {
-            /* Found a match */
-            found = 1;
-            foundpos = buflen - i;
-            founderr = dist;
-
-            /* Continue a bit to see if something's equally good or better */
-        }
-    }
-    DONE:
-    free(subpattern);
-    free(subpattern_r);
-    free(prev);
-    free(nxt);
-    if (found) {
-        *bestpos = foundpos;
-        *errcnt = founderr;
-        return 1;
-    }
-    return 0;
-}
-
-
-
-/* Try the longest match first. */
-/* Call with pattern as the text, text as pattern. */
-LIB_EXPORT uint32_t CC has_inside_approx_match( char *pattern, uint32_t plen, uint32_t errors, 
-                                 char *buf, size_t buflen, 
-                                 uint32_t *skip, uint32_t *errcnt )
-{
-    int32_t *prev = malloc(sizeof(int)*(plen+1));
-    int32_t *nxt = malloc(sizeof(int)*(plen+1));
-    int32_t *tmp;
-    int32_t j;
-    int32_t allowable;
-    int32_t dist;
-
-    int32_t found = 0;
-    int32_t foundpos = 0;
-    int32_t founderr = 0;
-
-    allowable = 1+lroundf((float)errors * plen / (float)buflen);
-
-
-    init_col(pattern, plen, nxt);
-    
-    for (j=0; j<buflen; j++) {
-        tmp = prev; prev = nxt; nxt = tmp;
-        compute_dp_next_col(pattern, plen, 0, buf[j], 0, prev, nxt);
-
-        dist = nxt[plen];
-
-        /* 
-           We still have to do this kind of thing because otherwise
-           the match will extend past the end of the text (here pattern),
-           and will match "useless" letters that just increase the score.
-           So we continue looking at smaller subsequences of the pattern
-           to see if something smaller matches better. 
-        */
-        
-        if (found) {
-            if (dist <= founderr && dist <= allowable) {
-                foundpos = j;
-                founderr = dist;
-            } else {
-                goto DONE;
-            }
-        } else if (dist <= allowable) {
-            /* Found a match */
-            found = 1;
-            foundpos = j;
-            founderr = dist;
-
-            /* Continue a bit to see if something's equally good or better */
-        }
-    }
-DONE:
-    free(prev);
-    free(nxt);
-    if (found) {
-        *skip = foundpos;
-        *errcnt = founderr;
-        return 1;
-    }
-    return 0;
-}
diff --git a/libs/search/agrep-myers.c b/libs/search/agrep-myers.c
deleted file mode 100644
index de22993..0000000
--- a/libs/search/agrep-myers.c
+++ /dev/null
@@ -1,586 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <search/extern.h>
-#include <compiler.h>
-#include <os-native.h>
-#include <sysalloc.h>
-#include <assert.h>
-#include "search-priv.h"
-#include "debug.h"
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdlib.h>
-
-#define DBG_SEARCH_METHOD DBG_SEARCH_MYERS
-
-#define UBITTYPE uint64_t
-
-struct MyersSearch {
-    AgrepFlags mode;
-    int32_t m;
-    UBITTYPE PEq[256];
-    UBITTYPE PEq_R[256];
-};
-
-static
-rc_t myers_translate(AgrepFlags mode, UBITTYPE* PEq, unsigned char p, UBITTYPE val)
-{
-    if( mode & AGREP_PATTERN_4NA ) {
-        return na4_set_bits(mode, PEq, p, val);
-    } else if( mode & AGREP_MODE_ASCII ) {
-        if( mode & AGREP_IGNORE_CASE ) {
-            PEq[tolower(p)] |= val;
-            PEq[toupper(p)] |= val;
-        } else {
-            PEq[p] |= val;
-        }
-    }
-    return 0;
-}
-
-#if _DEBUGGING
-static
-void printbits( UBITTYPE in )
-{
-    char buf[9];
-    int32_t j, k;
-    unsigned char byte;
-    buf[8] = '\0';
-    for (j=0; j<sizeof(UBITTYPE); j++) {
-        byte = in >> (8*(sizeof(UBITTYPE) - j - 1));
-        for (k=0; k<8; k++) {
-            buf[k] = "01"[1&(byte>>(7-k))];
-        }
-        SEARCH_DBGF(("%s ", buf));
-    }
-}
-#else
-#define printbits(in) ((void)0)
-#endif
-
-void AgrepMyersFree( MyersSearch *self )
-{
-    free(self);
-}
-  
-rc_t AgrepMyersMake( MyersSearch **self, AgrepFlags mode, const char *pattern )
-{
-    rc_t rc = 0;
-    uint32_t max_pattern_length = sizeof(UBITTYPE) * 8;
-    int32_t m = strlen(pattern);
-
-    *self = NULL;
-    if( m > max_pattern_length ) {
-        rc = RC(rcText, rcString, rcSearching, rcParam, rcExcessive);
-    } else if( (*self = malloc(sizeof(**self))) == NULL ) {
-        rc = RC(rcText, rcString, rcSearching, rcMemory, rcExhausted);
-    } else {            
-        int32_t j;
-        const unsigned char *upattern = (const unsigned char *)pattern;
-
-        (*self)->m = m;
-        (*self)->mode = mode;
-        memset((*self)->PEq, 0, sizeof((*self)->PEq));
-        for(j = 0; rc == 0 && j < m; j++) {
-            rc = myers_translate(mode, (*self)->PEq, upattern[j], (UBITTYPE)1 << j);
-        }
-        SEARCH_DBG("pattern '%s'", upattern);
-        for(j = 0; j < sizeof((*self)->PEq) / sizeof((*self)->PEq[0]); j++) {
-            if( (*self)->PEq[j] ) {
-                printbits((*self)->PEq[j]);
-                SEARCH_DBGF((" <- %c\n", j));
-            }
-        }
-        memset((*self)->PEq_R, 0, sizeof((*self)->PEq_R));
-        for(j = 0; rc == 0 && j < m; j++) {
-            rc = myers_translate(mode, (*self)->PEq_R, upattern[m - j - 1], (UBITTYPE)1 << j);
-        }
-        SEARCH_DBG("pattern rev '%s'", upattern);
-        for(j = 0; j < sizeof((*self)->PEq) / sizeof((*self)->PEq[0]); j++) {
-            if( (*self)->PEq[j] ) {
-                printbits((*self)->PEq[j]);
-                SEARCH_DBGF((" <- %c\n", j));
-            }
-        }
-    }
-    return rc;
-}
-
-/* 
-   This finds the first match forward in the string less than or equal
-   the threshold.  If nonzero, this will be a prefix of any exact match.
-*/
-
-uint32_t MyersFindFirst( MyersSearch *self, int32_t threshold, 
-                   const char* text, size_t n,
-                   AgrepMatch *match )
-{
-    const unsigned char *utext = (const unsigned char *)text;
-    UBITTYPE Pv;
-    UBITTYPE Mv;
-
-    int32_t m = self->m;
-    int32_t Score;
-    int32_t BestScore = m;
-    int32_t from = 0;
-    int32_t to = -1;
-
-    int32_t j;
-    UBITTYPE Eq, Xv, Xh, Ph, Mh;
-
-    Score = m;
-    Pv = (UBITTYPE)-1;
-    Mv = (UBITTYPE)0;
-    
-    for(j = 0; j < n; j++) {
-        Eq = self->PEq[utext[j]];
-        Xv = Eq | Mv;
-        Xh = (((Eq & Pv) + Pv) ^ Pv) | Eq;
-        Ph = Mv | ~ (Xh | Pv);
-        Mh = Pv & Xh;
-        if(Ph & ((UBITTYPE)1 << (m - 1))) {
-            Score++;
-        } else if(Mh & ((UBITTYPE)1 << (m - 1))) {
-            Score--;
-        }
-        Ph <<= 1;
-        Mh <<= 1;
-        Pv = Mh | ~(Xv | Ph);
-        Mv = Ph & Xv;
-        SEARCH_DBG("1st: %3d. '%c' score %d", j, utext[j], Score);
-        if (Score <= threshold) {
-            BestScore = Score;
-            to = j;
-            break;
-        }
-    }
-
-    if (BestScore <= threshold) {
-
-        /* Continue while score decreases under the threshold */
-        for(j++; j < n; j++) {
-            Eq = self->PEq[utext[j]];
-            Xv = Eq | Mv;
-            Xh = (((Eq & Pv) + Pv) ^ Pv) | Eq;
-            Ph = Mv | ~ (Xh | Pv);
-            Mh = Pv & Xh;
-            if(Ph & ((UBITTYPE)1 << (m - 1))) {
-                Score++;
-            } else if(Mh & ((UBITTYPE)1 << (m - 1))) {
-                Score--;
-            }
-            Ph <<= 1;
-            Mh <<= 1;
-            Pv = Mh | ~(Xv | Ph);
-            Mv = Ph & Xv;
-            SEARCH_DBG("2nd: %3d. '%c' score %d", j, utext[j], Score);
-            if( Score < BestScore ||
-                ( (self->mode & (AGREP_EXTEND_BETTER | AGREP_EXTEND_SAME)) && Score <= BestScore) ) {
-                BestScore = Score;
-                to = j;
-            } else {
-                break;
-            }
-        }
-    }
-
-    if (BestScore <= threshold) {
-        /* Re-initialize for next scan! */
-        Score = m;
-        Pv = (UBITTYPE)-1;
-        Mv = (UBITTYPE)0;
-        
-        for(j = to; j >= 0; j--) {
-            Eq = self->PEq_R[utext[j]];
-            Xv = Eq | Mv;
-            Xh = (((Eq & Pv) + Pv) ^ Pv) | Eq;
-            Ph = Mv | ~ (Xh | Pv);
-            Mh = Pv & Xh;
-            if(Ph & ((UBITTYPE)1 << (m - 1))) {
-                Score++;
-            } else if(Mh & ((UBITTYPE)1 << (m - 1))) {
-                Score--;
-            }
-            Ph <<= 1;
-            Mh <<= 1;
-            Pv = Mh | ~(Xv | Ph);
-            Mv = Ph & Xv;
-            SEARCH_DBG("Rvs: %3d. '%c' score %d", j, utext[j], Score);
-            if(Score <= BestScore) {
-                from = j;
-                break;
-            }
-        }
-    }
-    if (BestScore <= threshold) {
-        match->position = from;
-        match->length = to-from+1;
-        match->score = BestScore;
-        SEARCH_DBG("Hit: [%d,%d] '%.*s' score %d", match->position, match->length,
-                    match->length, &utext[match->position], match->score);
-        return 1;
-    }
-    return 0;
-}
-
-  
-
-/* 
-   Returns non-negative if something found.
-   Return value is the number of mismatches.
-*/
-LIB_EXPORT int32_t CC MyersFindBest ( MyersSearch *self, const char* text, 
-    size_t n, int32_t *pos, int32_t *len )
-{
-    const unsigned char *utext = (const unsigned char *)text;
-    UBITTYPE Pv;
-    UBITTYPE Mv;
-
-    int32_t m = self->m;
-    int32_t Score;
-    int32_t BestScore = m;
-    int32_t from = 0;
-    int32_t to = -1;
-
-    int32_t j;
-    UBITTYPE Eq, Xv, Xh, Ph, Mh;
-
-    Score = m;
-    Pv = (UBITTYPE)-1;
-    Mv = (UBITTYPE)0;
-    
-    for(j = 0; j < n; j++) {
-        Eq = self->PEq[utext[j]];
-        Xv = Eq | Mv;
-        Xh = (((Eq & Pv) + Pv) ^ Pv) | Eq;
-        Ph = Mv | ~ (Xh | Pv);
-        Mh = Pv & Xh;
-        if(Ph & ((UBITTYPE)1 << (m - 1))) {
-            Score++;
-        } else if(Mh & ((UBITTYPE)1 << (m - 1))) {
-            Score--;
-        }
-        Ph <<= 1;
-        Mh <<= 1;
-        Pv = Mh | ~(Xv | Ph);
-        Mv = Ph & Xv;
-        SEARCH_DBG("Fwd: %3d. '%c' score %d", j, utext[j], Score);
-        if( Score < BestScore ) {
-            BestScore = Score;
-            to = j;
-        }
-    }
-
-    /* Re-initialize for next scan! */
-    Score = m;
-    Pv = (UBITTYPE)-1;
-    Mv = (UBITTYPE)0;
-    
-    for(j = to; j >= 0; j--) {
-        Eq = self->PEq_R[utext[j]];
-        Xv = Eq | Mv;
-        Xh = (((Eq & Pv) + Pv) ^ Pv) | Eq;
-        Ph = Mv | ~ (Xh | Pv);
-        Mh = Pv & Xh;
-        if(Ph & ((UBITTYPE)1 << (m - 1))) {
-            Score++;
-        } else if(Mh & ((UBITTYPE)1 << (m - 1))) {
-            Score--;
-        }
-        Ph <<= 1;
-        Mh <<= 1;
-        Pv = Mh | ~(Xv | Ph);
-        Mv = Ph & Xv;
-        SEARCH_DBG("Rvs: %3d. '%c' score %d", j, utext[j], Score);
-        if(Score <= BestScore) {
-            from = j;
-            break;
-        }
-    }
-    
-    *pos = from;
-    *len = to-from+1;
-    SEARCH_DBG("Hit: [%d,%d] '%.*s' score %d", *pos, *len, *len, &utext[*pos], BestScore);
-    return BestScore;
-}
-
-/* 
-   This finds the first match forward in the string less than or equal
-   the threshold.  If nonzero, this will be a prefix of any exact match.
-*/
-
-/*
-    MyersFindAllOld is the old implementation of MyersFindAll.
-    It uses inline copy-pasted Myers core algorithm steps therefore
-    it might be faster than the new MyersFindAll (if compiler doesn't optimize it enough)
-    Also for some reason it uses unoptimized dp algorithm to find starting point of the match.
-
-    Leaving it in CVS for a while just in case (with fixed bug in "const void *cbinfo = args->cbinfo;"
-    and some minor improvements like marking data being used for read only as explicitly const)
-*/
-#ifdef COMMENT_OUT_MYERS_FIND_ALL_OLD_AND_HOPE_NOBODY_IS_USING_THIS_NAME_FOR_DEFINE
-void MyersFindAllOld ( const AgrepCallArgs *args )
-{
-    AgrepFlags const mode = args->self->mode;
-    MyersSearch const* self = args->self->myers;
-    int32_t const threshold = args->threshold;
-    const unsigned char *utext = (const unsigned char *)args->buf;
-    int32_t const n = args->buflen;
-    AgrepMatchCallback cb = dp_end_callback;
-    const void *cbinfo = args->cbinfo;
-
-    AgrepMatch match;
-    AgrepContinueFlag cont;
-
-    UBITTYPE Pv;
-    UBITTYPE Mv;
-
-    int32_t const m = self->m;
-    int32_t Score;
-    int32_t BestScore;
-
-    int32_t j;
-    UBITTYPE Eq, Xv, Xh, Ph, Mh;
-
-    int32_t curscore = 0;
-    int32_t curlast = 0;
-    int32_t continuing = 0;
-    
-    BestScore = m;
-    Score = m;
-    Pv = (UBITTYPE)-1;
-    Mv = (UBITTYPE)0;
-    
-    for (j = 0; j < n; j++)
-    {
-        Eq = self->PEq[utext[j]];
-        Xv = Eq | Mv;
-        Xh = (((Eq & Pv) + Pv) ^ Pv) | Eq;
-        Ph = Mv | ~ (Xh | Pv);
-        Mh = Pv & Xh;
-
-        SEARCH_DBG("%d: Ph ", j);
-        printbits(Ph);
-        SEARCH_DBG(" %s ", "Mh");
-        printbits(Mh);
-        SEARCH_DBG("%s", "");
-
-        if(Ph & ((UBITTYPE)1 << (m - 1))) {
-            Score++;
-        } else if(Mh & ((UBITTYPE)1 << (m - 1))) {
-            Score--;
-        }
-        Ph <<= 1;
-        Mh <<= 1;
-        Pv = Mh | ~(Xv | Ph);
-        Mv = Ph & Xv;
-        SEARCH_DBG("%3d. '%c' score %d", j, utext[j], Score);
-        if (Score <= threshold) {
-            /* At this point we let the DP algorithm find the starting point. */
-            /* This just passes the end position. */
-
-            if (continuing) {
-                if (Score < curscore &&
-                    ((mode & AGREP_EXTEND_BETTER) ||
-                     (mode & AGREP_EXTEND_SAME))) {
-                    curscore = Score;
-                    curlast = j;
-                } else if (Score == curscore &&
-                           ((mode & AGREP_EXTEND_BETTER) ||
-                            (mode & AGREP_EXTEND_SAME))) {
-                    if (mode & AGREP_EXTEND_SAME) {
-                        curlast = j;
-                    }
-                } else {
-                    continuing = 0;
-                    match.score = curscore;
-                    match.position = curlast;
-                    match.length = -1;
-                    cont = AGREP_CONTINUE;
-                    (*cb)(cbinfo, &match, &cont);
-                    if (cont != AGREP_CONTINUE)
-                        return;
-                }
-            } else if ((mode & AGREP_EXTEND_SAME) ||
-                       (mode & AGREP_EXTEND_BETTER)) {
-                curscore = Score;
-                curlast = j;
-                continuing = 1;
-            } else {
-                match.score = Score;
-                match.position = j;
-                match.length = -1;
-                cont = AGREP_CONTINUE;
-                (*cb)(cbinfo, &match, &cont);
-                if (cont != AGREP_CONTINUE)
-                    return;
-            }
-            /* If we're no longer under the threshold, we might
-               have been moving forward looking for a better match 
-            */
-        } else if (continuing) {
-            continuing = 0;
-            match.score = curscore;
-            match.position = curlast;
-            match.length = -1;
-            cont = AGREP_CONTINUE;
-            (*cb)(cbinfo, &match, &cont);
-            if (cont != AGREP_CONTINUE)
-                return;
-        }
-    }
-    if (continuing) {
-        continuing = 0;
-        match.score = curscore;
-        match.position = curlast;
-        match.length = -1;
-        (*cb)(cbinfo, &match, &cont);
-    }
-}
-#endif
-
-
-/* The core of the Myers algorithm - calculation of j-th score
-    Now using for new MyersFindAll only but can be used by all other Myers-find
-    functons if there is no issues with performance because of function call with
-    so many parameters and locals
-*/
-static void MyersCoreStep(unsigned char const* utext, int32_t const j, int32_t const m
-    ,UBITTYPE const* PEq, UBITTYPE* Mv, UBITTYPE* Pv, int32_t *Score
-)
-{
-    UBITTYPE Eq, Xv, Xh, Ph, Mh;
-
-    Eq = PEq[utext[j]];
-    Xv = Eq | *Mv;
-    Xh = (((Eq & *Pv) + *Pv) ^ *Pv) | Eq;
-    Ph = *Mv | ~ (Xh | *Pv);
-    Mh = *Pv & Xh;
-    if (Ph & ((UBITTYPE)1 << (m - 1)))
-        ++(*Score);
-    else if (Mh & ((UBITTYPE)1 << (m - 1)))
-        --(*Score);
-
-    Ph <<= 1;
-    Mh <<= 1;
-    *Pv = Mh | ~(Xv | Ph);
-    *Mv = Ph & Xv;
-}
-
-/* Return start position of the match given its end position and score */
-static int32_t MyersGetMatchStartingPosition(AgrepCallArgs const* args
-    ,int32_t const indexEnd, int32_t const TargetScore
-)
-{
-    MyersSearch const* self = args->self->myers;
-    unsigned char const* utext = (unsigned char const*)args->buf;
-    int32_t const m = self->m;
-
-    UBITTYPE Pv;
-    UBITTYPE Mv;
-
-    int32_t Score, ScorePrev;
-
-    int32_t j;
-
-    Score = m;
-    ScorePrev = m;
-    Pv = (UBITTYPE)-1;
-    Mv = (UBITTYPE)0;
-
-    /*
-        Here we're guaranteed that score will be decreasing down to:
-        1) TargetScore in the case when indexEnd points to the
-            string with deletions/modifications from the pattern
-        2) 0 in the case when indexEnd points to the string with
-            insertions to the end of the pattern
-        So we need to search backwards until Score is non-increasing
-    */
-    for (j = indexEnd; j >= 0; --j, ScorePrev = Score)
-    {
-        MyersCoreStep(utext, j, m, self->PEq_R, &Mv, &Pv, &Score);
-        SEARCH_DBG("Rvs: %3d. '%c' score %d", j, utext[j], Score);
-        if (Score > ScorePrev && ScorePrev <= TargetScore)
-        {
-            ++j;
-            break;
-        }
-        if (j == 0 && Score <= TargetScore)
-            break;
-    }
-    assert(j >= 0);
-    return j;
-}
-
-void MyersFindAll(AgrepCallArgs const *args )
-{
-    MyersSearch const* self = args->self->myers;
-    int32_t const threshold = args->threshold;
-    const unsigned char *utext = (const unsigned char *)args->buf;
-    int32_t const n = args->buflen;
-    const void *cbinfo = args->cbinfo;
-
-    AgrepMatch match;
-    AgrepContinueFlag cont;
-
-    UBITTYPE Pv;
-    UBITTYPE Mv;
-
-    int32_t const m = self->m;
-    int32_t Score;
-    int32_t BestScore;
-
-    int32_t j, indexStart;
-
-    BestScore = m;
-    Score = m;
-    Pv = (UBITTYPE)-1;
-    Mv = (UBITTYPE)0;
-    
-    for (j = 0; j < n; ++j)
-    {
-        MyersCoreStep(utext, j, m, self->PEq, &Mv, &Pv, &Score);
-        if (Score <= threshold)
-        {
-            indexStart = MyersGetMatchStartingPosition(args, j, Score);
-
-            /* found starting point indexStart for current match ending at j with Score */
-            match.score = Score;
-            match.position = indexStart;
-            match.length = j - indexStart + 1;
-            cont = AGREP_CONTINUE;
-            (*args->cb)(cbinfo, &match, &cont);
-            if (cont != AGREP_CONTINUE)
-                return;
-        }
-    }
-}
-
-
diff --git a/libs/search/agrep-myersunltd.c b/libs/search/agrep-myersunltd.c
deleted file mode 100644
index bb47527..0000000
--- a/libs/search/agrep-myersunltd.c
+++ /dev/null
@@ -1,1039 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <search/extern.h>
-#include <compiler.h>
-#include <os-native.h>
-#include <sysalloc.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "search-priv.h"
-
-
-/* 
-   We don't use longs here because the addition means we need to keep
-   some bits in reserve to calculate carries.
-*/   
-
-typedef int32_t schunk;
-typedef uint32_t uchunk;
-
-typedef struct CHUNK {
-    int32_t size;
-    uchunk *chunks;
-} CHUNK;
-
-struct MyersUnlimitedSearch {
-    int32_t m;
-    CHUNK *PEq[256];
-    CHUNK *PEq_R[256];
-};
-
-static const char NA2KEY [] = "ACGT";
-static const char NA4KEY [] = " ACMGRSVTWYHKDBN";
-
-static
-int32_t any_non_4na_chars(const char *pattern)
-{
-    int32_t len = strlen(pattern);
-    int32_t i;
-    char *p;
-
-    for ( i=0; i<len; i++ )
-    {
-        p = strchr( NA4KEY, pattern[i] );
-        if ( p == NULL )
-            return 1;
-    }
-    return 0;
-}
-
-static
-int32_t na4key_matches(AgrepFlags mode, char na4, char acgt)
-{
-    char *p;
-    int32_t pos4, pos2;
-    p = strchr( NA4KEY, na4 );
-    if ( p == NULL )
-    {
-        p = strchr( NA4KEY, 'N' );
-    }
-    pos4 = p - NA4KEY;
-    pos2 = strchr( NA2KEY, acgt ) - NA2KEY;
-    if ( pos4 & ( 1 << pos2 ) )
-        return 1;
-    return 0;
-}
-
-
-
-
-int32_t chunksize(int32_t size) {
-    int32_t ret;
-    ret = 1 + (size / (8*sizeof(uchunk)));
-    return ret;
-}
-
-void chunk_or_in(CHUNK *chunk, CHUNK *or)
-{
-    int32_t i;
-    int32_t size = chunk->size;
-    for (i=0; i<size; i++)
-        chunk->chunks[i] |= or->chunks[i];
-}
-
-void chunk_xor_in(CHUNK *chunk, CHUNK *xor)
-{
-    int32_t i;
-    int32_t size = chunk->size;
-    for (i=0; i<size; i++)
-        chunk->chunks[i] ^= xor->chunks[i];
-}
-
-
-void chunk_and_in(CHUNK *chunk, CHUNK *and)
-{
-    int32_t i;
-    int32_t size = chunk->size;
-    for (i=0; i<size; i++)
-        chunk->chunks[i] &= and->chunks[i];
-}
-
-void chunk_add_in(CHUNK *chunk, CHUNK *add)
-{
-    int32_t i;
-    int32_t size = chunk->size;
-    uint64_t carry = 0;
-    uint64_t newcarry;
-    for (i=size-1; i>=0; i--) {
-        newcarry = 
-            ((uint64_t)chunk->chunks[i] + (uint64_t)add->chunks[i]
-             + carry)
-            >> (8*sizeof(uchunk));
-        chunk->chunks[i] += add->chunks[i] + carry;
-        carry = newcarry;
-    }
-}
-
-
-void chunk_set(CHUNK *chunk, CHUNK *copy)
-{
-    int32_t i;
-    for (i=0; i<chunk->size; i++) {
-        chunk->chunks[i] = copy->chunks[i];
-    }
-}
-
-
-int32_t chunk_isbit_set(CHUNK *chunk, int32_t bit)
-{
-    int32_t cn = chunk->size - 1 - (bit / (8*sizeof(uchunk)));
-    int32_t chunkbit = bit % (8*sizeof(uchunk));
-    return chunk->chunks[cn] & (1 << chunkbit);
-}
-
-
-void chunk_set_bit(CHUNK *chunk, int32_t bit) 
-{
-    int32_t cn = chunk->size - 1 - (bit / (8*sizeof(uchunk)));
-    int32_t chunkbit = bit % (8*sizeof(uchunk));
-    chunk->chunks[cn] |= (1 << chunkbit);
-}
-
-
-void chunk_negate(CHUNK *chunk)
-{
-    int32_t i;
-    for (i=0; i<chunk->size; i++) {
-        chunk->chunks[i] = ~chunk->chunks[i];
-    }
-}
-
-void alloc_chunk_and_zero(CHUNK *chunk, int32_t size)
-{
-    chunk->chunks = malloc(size * sizeof(uchunk));
-    memset(chunk->chunks, 0, size * sizeof(uchunk));
-}
-
-void free_chunk_parts(CHUNK *chunk)
-{
-    free(chunk->chunks);
-    chunk->chunks = NULL;
-}
-
-void free_chunk(CHUNK *chunk)
-{
-    free(chunk->chunks);
-    free(chunk);
-}
-
-
-CHUNK *alloc_chunk(int32_t size)
-{
-    CHUNK *ret;
-    ret = malloc(sizeof(CHUNK));
-    ret->size = size;
-    ret->chunks = malloc(size * sizeof(uchunk));
-    memset(ret->chunks, 0, size * sizeof(uchunk));
-    return ret;
-}
-  
-void chunk_set_minusone(CHUNK *src)
-{
-    int32_t i;
-    for (i=0; i<src->size; i++) {
-        src->chunks[i] = (uchunk)-1;
-    }
-}
-
-void chunk_zero(CHUNK *src)
-{
-    int32_t i;
-    for (i=0; i<src->size; i++) {
-        src->chunks[i] = (uchunk)0;
-    }
-}
-
-void print_chunk(CHUNK *src)
-{
-    uchunk chunk;
-    unsigned char byte;
-    char buf[9];
-    int32_t i, j, k;
-    buf[8] = '\0';
-    for (i=0; i<src->size; i++) {
-        chunk = src->chunks[i];
-        for (j=0; j<sizeof(uchunk); j++) {
-            byte = chunk >> (8*(sizeof(uchunk) - j - 1));
-            for (k=0; k<8; k++) {
-                buf[k] = "01"[1&(byte>>(7-k))];
-            }
-            printf("%s ", buf);
-        }
-    }
-    printf("\n");
-}
-
-
-/*
-  This currently does not preserve the sign bit.
-*/
-void lshift_chunk(CHUNK *dest, CHUNK *src, int32_t n)
-{
-    int32_t i, j;
-    uchunk slop;
-    int32_t chunkshift = n / (8*sizeof(uchunk));
-    int32_t rem = n % (8*sizeof(uchunk));
-    /* Assumes they're both the same size. */
-    int32_t size = src->size;
-
-
-    /* i is the destination chunk */
-    slop = 0;
-    for (i=size-1; i>=0; i--) {
-        j = i+chunkshift;
-        if (j >= size) {
-            dest->chunks[i] = 0;
-        } else {
-            dest->chunks[i] = slop | src->chunks[j] << rem;
-            slop = src->chunks[j] >> (8*sizeof(uchunk) - rem);
-        }
-    }
-}
-
-void chunk_lshift_one_inplace(CHUNK *dest)
-{
-    int32_t i;
-    uchunk slop, newslop;
-    int32_t size = dest->size;
-
-    slop = 0;
-    for (i=size-1; i>=0; i--) {
-        newslop = dest->chunks[i] >> (8*sizeof(uchunk) - 1);
-        dest->chunks[i] = slop | dest->chunks[i] << 1;
-        slop = newslop;
-    }
-}
-
-
-void chunk_lshift_one(CHUNK *dest, CHUNK *src)
-{
-    int32_t i;
-    uchunk slop;
-    int32_t size = src->size;
-
-    slop = 0;
-    for (i=size-1; i>=0; i--) {
-        dest->chunks[i] = slop | src->chunks[i] << 1;
-        slop = src->chunks[i] >> (8*sizeof(uchunk) - 1);
-    }
-}
-
-
-
-#ifdef UNUSED_MAY_NOT_WORK  
-  
-/*
- * In this, chunks are big-endian, meaning 0 is the most significant chunk.
- */
-void rshift_uchunk(CHUNK *dest, CHUNK *src, int32_t n)
-{
-    int32_t size = src->size;
-    uchunk slop;
-    int32_t chunkshift = n / (8*sizeof(uchunk));
-    int32_t rem = n % (8*sizeof(uchunk));
-    int32_t i, j;
-
-    /* i is the destination chunk */
-    slop = 0;
-    for (i=0; i<size; i++) {
-        j = i-chunkshift;
-        if (j < 0) {
-            dest->chunks[i] = 0;
-        } else {
-            dest->chunks[i] = slop | src->chunks[j] >> rem;
-            slop = src->chunks[j] << (8*sizeof(uchunk) - rem);
-        }
-    }
-}
-
-void rshift_schunk(CHUNK *dest, CHUNK *src, int32_t n)
-{
-    uchunk slop;
-    int32_t chunkshift = n / (8*sizeof(uchunk));
-    int32_t rem = n % (8*sizeof(uchunk));
-    int32_t i, j, size;
-
-    /* i is the destination chunk */
-    slop = -1;
-    for (i=0; i<size; i++) {
-        j = i-chunkshift;
-        if (j < 0) {
-            dest->chunks[i] = -1;
-        } else {
-            dest->chunks[i] = slop | src->chunks[j] >> rem;
-            slop = src->chunks[j] << (8*sizeof(uchunk) - rem);
-        }
-    }
-}
-
-#endif
-
-
-void MyersUnlimitedFree ( MyersUnlimitedSearch *self )
-{
-    int32_t j;
-    for (j=0; j<256; j++) {
-        free_chunk(self->PEq[j]);
-        free_chunk(self->PEq_R[j]);
-    }
-    free(self);
-}
-  
-
-rc_t MyersUnlimitedMake ( MyersUnlimitedSearch **self,
-        AgrepFlags mode, const char *pattern )
-{
-    const unsigned char *upattern = (const unsigned char *)pattern;
-    int32_t rc;
-    int32_t len = strlen(pattern);
-    int32_t plen = len;
-    int32_t i, j;
-    int32_t m;
-    int32_t chunks;
-
-    if (!(mode & AGREP_ANYTHING_ELSE_IS_N) &&
-        any_non_4na_chars(pattern))
-        /* This should be a return code. */
-        return RC( rcText, rcString, rcSearching, rcParam, rcUnrecognized);
-
-
-    *self = malloc(sizeof(MyersUnlimitedSearch));
-    m = (*self)->m = len;
-    chunks = chunksize(m);
-    for (j=0; j<256; j++) {
-        (*self)->PEq[j] = alloc_chunk(chunks);
-        (*self)->PEq_R[j] = alloc_chunk(chunks);
-    }
-
-    for(j = 0; j < m; j++) {
-        chunk_set_bit((*self)->PEq[upattern[j]], j);
-        if( pattern[j] == 'a' ) {
-            chunk_set_bit((*self)->PEq['t'], j); /* t == a */
-        }
-    }
-
-    for(j = 0; j < m; j++) {
-        chunk_set_bit((*self)->PEq_R[upattern[m-j-1]], j);
-        if( pattern[m-j-1] == 'a' ) {
-            chunk_set_bit((*self)->PEq_R['t'], j); /* t == a */
-        }
-    }
-
-    for (i=0; i<4; i++) {
-        unsigned char acgt = NA2KEY[i];
-        for (j=0; j<plen; j++) {
-            if (na4key_matches(mode, pattern[j], acgt)) {
-                /* bits |= (unsigned long)1<<j; */
-                chunk_set_bit((*self)->PEq[acgt], j);
-                if (mode & AGREP_TEXT_EXPANDED_2NA)
-                    chunk_set_bit((*self)->PEq[i], j);
-            }
-        }
-    }
-    for (i=0; i<4; i++) {
-        unsigned char acgt = NA2KEY[i];
-        for (j=0; j<plen; j++) {
-            if (na4key_matches(mode, pattern[plen-j-1], acgt)) {
-                chunk_set_bit((*self)->PEq_R[acgt], j);
-                if (mode & AGREP_TEXT_EXPANDED_2NA)
-                    chunk_set_bit((*self)->PEq_R[i], j);
-            }
-        }
-    }
-    return 0;
-
-    for (j=0; j<256; j++) {
-        free_chunk((*self)->PEq[j]);
-        free_chunk((*self)->PEq_R[j]);
-    }
-    free(*self);
-    *self = NULL;
-    return rc;
-
-}
-
-
-/* 
-   This finds the first match forward in the string less than or equal
-   the threshold.  If nonzero, this will be a prefix of any exact match.
-*/
-uint32_t MyersUnlimitedFindFirst ( MyersUnlimitedSearch *self, 
-        int32_t threshold, const char* text, size_t n, AgrepMatch *match )
-{
-    const unsigned char *utext = (const unsigned char *)text;
-    CHUNK *Pv;
-    CHUNK *Mv;
-    CHUNK *Xv, *Xh, *Ph, *Mh;
-
-    int32_t m = self->m;
-    int32_t csize = chunksize(m);
-    int32_t Score;
-    int32_t BestScore = m;
-    int32_t from = 0;
-    int32_t to = -1;
-
-    int32_t j;
-
-    CHUNK *Eq;
-
-    Pv = alloc_chunk(csize);
-    Mv = alloc_chunk(csize);
-    Xv = alloc_chunk(csize);
-    Xh = alloc_chunk(csize);
-    Ph = alloc_chunk(csize);
-    Mh = alloc_chunk(csize);
-
-
-    Score = m;
-    chunk_set_minusone(Pv);
-    chunk_zero(Mv);
-    
-    for(j = 0; j < n; j++) {
-#ifdef DEBUG
-        printf("%d j loop\n", j);
-#endif
-        Eq = self->PEq[utext[j]];
-#ifdef DEBUG
-        printf("Eq: "); print_chunk(Eq); printf("\n");
-#endif
-        /* Xv = Eq | Mv; */
-        chunk_set(Xv, Eq);
-        chunk_or_in(Xv, Mv);
-#ifdef DEBUG
-        printf("Xv: "); print_chunk(Xv); printf("\n");
-#endif
-        /* Xh = (((Eq & Pv) + Pv) ^ Pv) | Eq; */
-        chunk_set(Xh, Eq);
-        chunk_and_in(Xh, Pv);
-        chunk_add_in(Xh, Pv);
-        chunk_xor_in(Xh, Pv);
-        chunk_or_in(Xh, Eq);
-#ifdef DEBUG
-        printf("Xh: "); print_chunk(Xh); printf("\n");
-#endif
-        /* Ph = Mv | ~ (Xh | Pv); */
-        chunk_set(Ph, Xh);
-        chunk_or_in(Ph, Pv);
-        chunk_negate(Ph);
-        chunk_or_in(Ph, Mv);
-#ifdef DEBUG
-        printf("Ph: "); print_chunk(Ph); printf("\n");
-#endif
-        /* Mh = Pv & Xh; */
-        chunk_set(Mh, Pv);
-        chunk_and_in(Mh, Xh);
-#ifdef DEBUG
-        printf("Mh: "); print_chunk(Mh); printf("\n");
-#endif
-        /* Ph & (1 << (m - 1)) */
-        if (chunk_isbit_set(Ph, m-1)) {
-            Score++;
-            /* Mh & (1 << (m - 1)) */
-        } else if (chunk_isbit_set(Mh, m-1)) {
-            Score--;
-        }
-        /* Ph <<= 1; */
-        chunk_lshift_one_inplace(Ph);
-#ifdef DEBUG
-        printf("Ph: "); print_chunk(Ph); printf("\n");
-#endif
-        /* Mh <<= 1; */
-        chunk_lshift_one_inplace(Mh);
-#ifdef DEBUG
-        printf("Mh: "); print_chunk(Mh); printf("\n");
-#endif
-        /* Pv = Mh | ~(Xv | Ph); */
-        chunk_set(Pv, Xv);
-        chunk_or_in(Pv, Ph);
-        chunk_negate(Pv);
-        chunk_or_in(Pv, Mh);
-#ifdef DEBUG
-        printf("Pv: "); print_chunk(Pv); printf("\n");
-#endif
-        /* Mv = Ph & Xv; */
-        chunk_set(Mv, Ph);
-        chunk_and_in(Mv, Xv);
-#ifdef DEBUG
-        printf("Mv: "); print_chunk(Mv); printf("\n");
-#endif
-#ifdef DEBUG
-        printf("%3d. score %d\n", j, Score);
-#endif
-        if (Score <= threshold) {
-            BestScore = Score;
-            to = j;
-            break;
-        }
-    }
-
-    /* Continue while score decreases under the threshold */
-    for(j++; j < n; j++) {
-        Eq = self->PEq[utext[j]];
-        /* Xv = Eq | Mv; */
-        chunk_set(Xv, Eq);
-        chunk_or_in(Xv, Mv);
-        /* Xh = (((Eq & Pv) + Pv) ^ Pv) | Eq; */
-        chunk_set(Xh, Eq);
-        chunk_and_in(Xh, Pv);
-        chunk_add_in(Xh, Pv);
-        chunk_xor_in(Xh, Pv);
-        chunk_or_in(Xh, Eq);
-        /* Ph = Mv | ~ (Xh | Pv); */
-        chunk_set(Ph, Xh);
-        chunk_or_in(Ph, Pv);
-        chunk_negate(Ph);
-        chunk_or_in(Ph, Mv);
-        /* Mh = Pv & Xh; */
-        chunk_set(Mh, Pv);
-        chunk_and_in(Mh, Xh);
-        /* Ph & (1 << (m - 1)) */
-        if (chunk_isbit_set(Ph, m-1)) {
-            Score++;
-            /* Mh & (1 << (m - 1)) */
-        } else if (chunk_isbit_set(Mh, m-1)) {
-            Score--;
-        }
-        /* Ph <<= 1; */
-        chunk_lshift_one_inplace(Ph);
-        /* Mh <<= 1; */
-        chunk_lshift_one_inplace(Mh);
-        /* Pv = Mh | ~(Xv | Ph); */
-        chunk_set(Pv, Xv);
-        chunk_or_in(Pv, Ph);
-        chunk_negate(Pv);
-        chunk_or_in(Pv, Mh);
-        /* Mv = Ph & Xv; */
-        chunk_set(Mv, Ph);
-        chunk_and_in(Mv, Xv);
-
-#ifdef DEBUG	
-        printf("%3d. score %d\n", j, Score);
-#endif
-        if (Score < BestScore) {
-            BestScore = Score;
-            to = j;
-        } else {
-            break;
-        }
-    }
-
-    /* Re-initialize for next scan! */
-    Score = m;
-    chunk_set_minusone(Pv);
-    chunk_zero(Mv);
-    
-    for(j = to; j >= 0; j--) {
-        Eq = self->PEq_R[utext[j]]; 	/* This line is different. */
-        /* Xv = Eq | Mv; */
-        chunk_set(Xv, Eq);
-        chunk_or_in(Xv, Mv);
-        /* Xh = (((Eq & Pv) + Pv) ^ Pv) | Eq; */
-        chunk_set(Xh, Eq);
-        chunk_and_in(Xh, Pv);
-        chunk_add_in(Xh, Pv);
-        chunk_xor_in(Xh, Pv);
-        chunk_or_in(Xh, Eq);
-        /* Ph = Mv | ~ (Xh | Pv); */
-        chunk_set(Ph, Xh);
-        chunk_or_in(Ph, Pv);
-        chunk_negate(Ph);
-        chunk_or_in(Ph, Mv);
-        /* Mh = Pv & Xh; */
-        chunk_set(Mh, Pv);
-        chunk_and_in(Mh, Xh);
-        /* Ph & (1 << (m - 1)) */
-        if (chunk_isbit_set(Ph, m-1)) {
-            Score++;
-            /* Mh & (1 << (m - 1)) */
-        } else if (chunk_isbit_set(Mh, m-1)) {
-            Score--;
-        }
-        /* Ph <<= 1; */
-        chunk_lshift_one_inplace(Ph);
-        /* Mh <<= 1; */
-        chunk_lshift_one_inplace(Mh);
-        /* Pv = Mh | ~(Xv | Ph); */
-        chunk_set(Pv, Xv);
-        chunk_or_in(Pv, Ph);
-        chunk_negate(Pv);
-        chunk_or_in(Pv, Mh);
-        /* Mv = Ph & Xv; */
-        chunk_set(Mv, Ph);
-        chunk_and_in(Mv, Xv);
-
-#ifdef DEBUG	
-        printf("%3d. score %d\n", j, Score); 
-#endif
-        if(Score <= BestScore) {
-#ifdef DEBUG	    
-            printf("rev match at position %d\n", j);
-#endif
-            from = j;
-            break;
-        }
-    }
-
-    free_chunk(Pv);
-    free_chunk(Mv);
-    free_chunk(Xv);
-    free_chunk(Xh);
-    free_chunk(Ph);
-    free_chunk(Mh);
-    
-    if (BestScore <= threshold) {
-        match->position = from;
-        match->length = to-from+1;
-        match->score = BestScore;
-        return 1;
-    } else {
-        return 0;
-    }
-}
-
-/* 
-   This finds the first match forward in the string less than or equal
-   the threshold.  If nonzero, this will be a prefix of any exact match.
-*/
-void MyersUnlimitedFindAll ( const AgrepCallArgs *args )
-{
-    AgrepFlags mode = args->self->mode;
-    MyersUnlimitedSearch *self = args->self->myersunltd;
-    int32_t threshold = args->threshold;
-    const unsigned char *utext = (const unsigned char *)args->buf;
-    int32_t n = args->buflen;
-    AgrepMatchCallback cb = dp_end_callback;
-    const void *cbinfo = args;
-
-    AgrepMatch match;
-    AgrepContinueFlag cont;
-
-    CHUNK *Pv;
-    CHUNK *Mv;
-    CHUNK *Xv, *Xh, *Ph, *Mh;
-
-    int32_t m = self->m;
-    int32_t csize = chunksize(m);
-    int32_t Score;
-
-    int32_t curscore = 0;
-    int32_t curlast = 0;
-    int32_t continuing = 0;
-
-    int32_t j;
-
-    CHUNK *Eq;
-
-
-
-    Pv = alloc_chunk(csize);
-    Mv = alloc_chunk(csize);
-    Xv = alloc_chunk(csize);
-    Xh = alloc_chunk(csize);
-    Ph = alloc_chunk(csize);
-    Mh = alloc_chunk(csize);
-
-    Score = m;
-    chunk_set_minusone(Pv);
-    chunk_zero(Mv);
-    
-    for(j = 0; j < n; j++) {
-#ifdef DEBUG
-        printf("%d j loop\n", j);
-#endif
-        Eq = self->PEq[utext[j]];
-#ifdef DEBUG
-        printf("Eq: "); print_chunk(Eq); printf("\n");
-#endif
-        /* Xv = Eq | Mv; */
-        chunk_set(Xv, Eq);
-        chunk_or_in(Xv, Mv);
-#ifdef DEBUG
-        printf("Xv: "); print_chunk(Xv); printf("\n");
-#endif
-        /* Xh = (((Eq & Pv) + Pv) ^ Pv) | Eq; */
-        chunk_set(Xh, Eq);
-        chunk_and_in(Xh, Pv);
-        chunk_add_in(Xh, Pv);
-        chunk_xor_in(Xh, Pv);
-        chunk_or_in(Xh, Eq);
-#ifdef DEBUG
-        printf("Xh: "); print_chunk(Xh); printf("\n");
-#endif
-        /* Ph = Mv | ~ (Xh | Pv); */
-        chunk_set(Ph, Xh);
-        chunk_or_in(Ph, Pv);
-        chunk_negate(Ph);
-        chunk_or_in(Ph, Mv);
-#ifdef DEBUG
-        printf("Ph: "); print_chunk(Ph); printf("\n");
-#endif
-        /* Mh = Pv & Xh; */
-        chunk_set(Mh, Pv);
-        chunk_and_in(Mh, Xh);
-#ifdef DEBUG
-        printf("Mh: "); print_chunk(Mh); printf("\n");
-#endif
-        /* Ph & (1 << (m - 1)) */
-        if (chunk_isbit_set(Ph, m-1)) {
-            Score++;
-            /* Mh & (1 << (m - 1)) */
-        } else if (chunk_isbit_set(Mh, m-1)) {
-            Score--;
-        }
-        /* Ph <<= 1; */
-        chunk_lshift_one_inplace(Ph);
-#ifdef DEBUG
-        printf("Ph: "); print_chunk(Ph); printf("\n");
-#endif
-        /* Mh <<= 1; */
-        chunk_lshift_one_inplace(Mh);
-#ifdef DEBUG
-        printf("Mh: "); print_chunk(Mh); printf("\n");
-#endif
-        /* Pv = Mh | ~(Xv | Ph); */
-        chunk_set(Pv, Xv);
-        chunk_or_in(Pv, Ph);
-        chunk_negate(Pv);
-        chunk_or_in(Pv, Mh);
-#ifdef DEBUG
-        printf("Pv: "); print_chunk(Pv); printf("\n");
-#endif
-        /* Mv = Ph & Xv; */
-        chunk_set(Mv, Ph);
-        chunk_and_in(Mv, Xv);
-#ifdef DEBUG
-        printf("Mv: "); print_chunk(Mv); printf("\n");
-#endif
-#ifdef DEBUG
-        printf("%3d. score %d\n", j, Score);
-#endif
-        if (Score <= threshold) {
-            if (continuing) {
-                if (Score < curscore &&
-                    ((mode & AGREP_EXTEND_BETTER) ||
-                     (mode & AGREP_EXTEND_SAME))) {
-                    curscore = Score;
-                    curlast = j;
-                } else if (Score == curscore &&
-                           ((mode & AGREP_EXTEND_BETTER) ||
-                            (mode & AGREP_EXTEND_SAME))) {
-                    if (mode & AGREP_EXTEND_SAME) {
-                        curlast = j;
-                    }
-                } else {
-                    continuing = 0;
-                    match.score = curscore;
-                    match.position = curlast;
-                    match.length = -1;
-                    cont = AGREP_CONTINUE;
-                    (*cb)(cbinfo, &match, &cont);
-                    if (cont != AGREP_CONTINUE)
-                        goto EXIT;
-                }
-            } else if ((mode & AGREP_EXTEND_SAME) ||
-                       (mode & AGREP_EXTEND_BETTER)) {
-                curscore = Score;
-                curlast = j;
-                continuing = 1;
-            } else {
-                match.score = Score;
-                match.position = j;
-                match.length = -1;
-                cont = AGREP_CONTINUE;
-                (*cb)(cbinfo, &match, &cont);
-                if (cont != AGREP_CONTINUE)
-                    goto EXIT;
-            }
-            /* If we're no longer under the threshold, we might
-               have been moving forward looking for a better match 
-            */
-        } else if (continuing) {
-            continuing = 0;
-            match.score = curscore;
-            match.position = curlast;
-            match.length = -1;
-            cont = AGREP_CONTINUE;
-            (*cb)(cbinfo, &match, &cont);
-            if (cont != AGREP_CONTINUE)
-                goto EXIT;
-        }
-        /* print_col_as_row(nxt, plen); */
-    }
-    if (continuing) {
-        continuing = 0;
-        match.score = curscore;
-        match.position = curlast;
-        match.length = -1;
-        (*cb)(cbinfo, &match, &cont);
-    }
-
-EXIT:
-
-    free_chunk(Pv);
-    free_chunk(Mv);
-    free_chunk(Xv);
-    free_chunk(Xh);
-    free_chunk(Ph);
-    free_chunk(Mh);
-}
-
-
-LIB_EXPORT int32_t CC MyersUnlimitedFindBest ( MyersUnlimitedSearch *self,
-        const char* text, size_t n, int32_t *pos, int32_t *len )
-{
-    const unsigned char *utext = (const unsigned char *)text;
-    CHUNK *Pv;
-    CHUNK *Mv;
-    CHUNK *Xv, *Xh, *Ph, *Mh;
-
-    int32_t m = self->m;
-    int32_t csize = chunksize(m);
-    int32_t Score;
-    int32_t BestScore = m;
-    int32_t from = 0;
-    int32_t to = -1;
-
-    int32_t j;
-
-    CHUNK *Eq;
-
-    Pv = alloc_chunk(csize);
-    Mv = alloc_chunk(csize);
-    Xv = alloc_chunk(csize);
-    Xh = alloc_chunk(csize);
-    Ph = alloc_chunk(csize);
-    Mh = alloc_chunk(csize);
-
-
-    Score = m;
-    chunk_set_minusone(Pv);
-    chunk_zero(Mv);
-    
-    for(j = 0; j < n; j++) {
-#ifdef DEBUG
-        printf("%d j loop\n", j);
-#endif
-        Eq = self->PEq[utext[j]];
-#ifdef DEBUG
-        printf("Eq: "); print_chunk(Eq); printf("\n");
-#endif
-        /* Xv = Eq | Mv; */
-        chunk_set(Xv, Eq);
-        chunk_or_in(Xv, Mv);
-#ifdef DEBUG
-        printf("Xv: "); print_chunk(Xv); printf("\n");
-#endif
-        /* Xh = (((Eq & Pv) + Pv) ^ Pv) | Eq; */
-        chunk_set(Xh, Eq);
-        chunk_and_in(Xh, Pv);
-        chunk_add_in(Xh, Pv);
-        chunk_xor_in(Xh, Pv);
-        chunk_or_in(Xh, Eq);
-#ifdef DEBUG
-        printf("Xh: "); print_chunk(Xh); printf("\n");
-#endif
-        /* Ph = Mv | ~ (Xh | Pv); */
-        chunk_set(Ph, Xh);
-        chunk_or_in(Ph, Pv);
-        chunk_negate(Ph);
-        chunk_or_in(Ph, Mv);
-#ifdef DEBUG
-        printf("Ph: "); print_chunk(Ph); printf("\n");
-#endif
-        /* Mh = Pv & Xh; */
-        chunk_set(Mh, Pv);
-        chunk_and_in(Mh, Xh);
-#ifdef DEBUG
-        printf("Mh: "); print_chunk(Mh); printf("\n");
-#endif
-        /* Ph & (1 << (m - 1)) */
-        if (chunk_isbit_set(Ph, m-1)) {
-            Score++;
-            /* Mh & (1 << (m - 1)) */
-        } else if (chunk_isbit_set(Mh, m-1)) {
-            Score--;
-        }
-        /* Ph <<= 1; */
-        chunk_lshift_one_inplace(Ph);
-#ifdef DEBUG
-        printf("Ph: "); print_chunk(Ph); printf("\n");
-#endif
-        /* Mh <<= 1; */
-        chunk_lshift_one_inplace(Mh);
-#ifdef DEBUG
-        printf("Mh: "); print_chunk(Mh); printf("\n");
-#endif
-        /* Pv = Mh | ~(Xv | Ph); */
-        chunk_set(Pv, Xv);
-        chunk_or_in(Pv, Ph);
-        chunk_negate(Pv);
-        chunk_or_in(Pv, Mh);
-#ifdef DEBUG
-        printf("Pv: "); print_chunk(Pv); printf("\n");
-#endif
-        /* Mv = Ph & Xv; */
-        chunk_set(Mv, Ph);
-        chunk_and_in(Mv, Xv);
-#ifdef DEBUG
-        printf("Mv: "); print_chunk(Mv); printf("\n");
-#endif
-#ifdef DEBUG
-        printf("%3d. score %d\n", j, Score);
-#endif
-        if (Score < BestScore) {
-            BestScore = Score;
-            to = j;
-        }
-    }
-
-    /* Re-initialize for next scan! */
-    Score = m;
-    chunk_set_minusone(Pv);
-    chunk_zero(Mv);
-    
-    for(j = to; j >= 0; j--) {
-        Eq = self->PEq_R[utext[j]]; 	/* This line is different. */
-        /* Xv = Eq | Mv; */
-        chunk_set(Xv, Eq);
-        chunk_or_in(Xv, Mv);
-        /* Xh = (((Eq & Pv) + Pv) ^ Pv) | Eq; */
-        chunk_set(Xh, Eq);
-        chunk_and_in(Xh, Pv);
-        chunk_add_in(Xh, Pv);
-        chunk_xor_in(Xh, Pv);
-        chunk_or_in(Xh, Eq);
-        /* Ph = Mv | ~ (Xh | Pv); */
-        chunk_set(Ph, Xh);
-        chunk_or_in(Ph, Pv);
-        chunk_negate(Ph);
-        chunk_or_in(Ph, Mv);
-        /* Mh = Pv & Xh; */
-        chunk_set(Mh, Pv);
-        chunk_and_in(Mh, Xh);
-        /* Ph & (1 << (m - 1)) */
-        if (chunk_isbit_set(Ph, m-1)) {
-            Score++;
-            /* Mh & (1 << (m - 1)) */
-        } else if (chunk_isbit_set(Mh, m-1)) {
-            Score--;
-        }
-        /* Ph <<= 1; */
-        chunk_lshift_one_inplace(Ph);
-        /* Mh <<= 1; */
-        chunk_lshift_one_inplace(Mh);
-        /* Pv = Mh | ~(Xv | Ph); */
-        chunk_set(Pv, Xv);
-        chunk_or_in(Pv, Ph);
-        chunk_negate(Pv);
-        chunk_or_in(Pv, Mh);
-        /* Mv = Ph & Xv; */
-        chunk_set(Mv, Ph);
-        chunk_and_in(Mv, Xv);
-
-#ifdef DEBUG
-        printf("%3d. score %d\n", j, Score); 
-#endif
-        if(Score <= BestScore) {
-#ifdef DEBUG
-            printf("rev match at position %d\n", j);
-#endif
-            from = j;
-            break;
-        }
-    }
-
-    free_chunk(Pv);
-    free_chunk(Mv);
-    free_chunk(Xv);
-    free_chunk(Xh);
-    free_chunk(Ph);
-    free_chunk(Mh);
-    
-    *pos = from;
-    *len = to-from+1;
-
-    return BestScore;
-
-    /* printf("Found [%d,%d]\n", from, to);
-       printf("Found '%.*s'\n", to - from + 1, &text[from]); */
-}
-
diff --git a/libs/search/agrep-wumanber.c b/libs/search/agrep-wumanber.c
deleted file mode 100644
index 881b83d..0000000
--- a/libs/search/agrep-wumanber.c
+++ /dev/null
@@ -1,415 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <search/extern.h>
-#include <compiler.h>
-#include <os-native.h>
-#include <sysalloc.h>
-
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "search-priv.h"
-
-static
-int32_t debug = 0;
-
-struct AgrepWuParams {
-    unsigned char* pattern;
-    int32_t len;
-    uint64_t alphabits[256];
-    uint64_t r_alphabits[256];
-    int64_t patmask; /* Actually an inverse mask (0's in the pattern positions) */
-};
-
-/* This now computes the alphabits for a 4na pattern. */
-static
-rc_t compute_alphabits_4na(AgrepWuParams *self, AgrepFlags mode)
-{
-    rc_t rc = 0;
-    int32_t i;
-
-    self->patmask = ((uint64_t) -1) << self->len;
-
-    for(i = 0; i < 256; i++) {
-        self->alphabits[i] = self->patmask;
-        self->r_alphabits[i] = self->patmask;
-    }
-    for(i = 0; rc == 0 && i < self->len; i++) {
-        if( (rc = na4_set_bits(mode, self->alphabits, self->pattern[i], (uint64_t)1<<(self->len-i-1))) == 0 ) {
-            rc = na4_set_bits(mode, self->r_alphabits, self->pattern[self->len-i-1], (uint64_t)1<<(self->len-i-1));
-        }
-    }
-    return rc;
-}
-
-static
-void compute_alphabits(AgrepWuParams *self)
-{
-    int32_t i, j;
-    uint64_t bits, patmask;
-
-    patmask = self->patmask = ((uint64_t)-1) << self->len;
- 
-    /* TBD use AGREP_IGNORE_CASE */
-    for (i=0; i<256; i++) {
-        bits = 0;
-        for (j=0; j<self->len; j++) {
-            if (self->pattern[j] == i) {
-                bits |= (uint64_t)1<<(self->len-j-1);
-            }
-        }
-        self->alphabits[i] = bits | patmask;
-    }
-    for (i=0; i<256; i++) {
-        bits = 0;
-        for (j=0; j<self->len; j++) {
-            if (self->pattern[self->len-j-1] == i) {
-                bits |= (uint64_t)1<<(self->len-j-1);
-            }
-        }
-        self->r_alphabits[i] = bits | patmask;
-    }
-}
-
-rc_t AgrepWuMake( AgrepWuParams **self, AgrepFlags mode, const char *pattern )
-{
-    rc_t rc = 0;
-
-    *self = NULL;
-    if(strlen(pattern) > 63) {
-        rc = RC( rcText, rcString, rcSearching, rcParam, rcExcessive);
-    } else if( (*self = malloc(sizeof(**self))) == NULL ) {
-        rc = RC(rcText, rcString, rcSearching, rcMemory, rcExhausted);
-    } else {
-        (*self)->pattern = (unsigned char*)strdup(pattern);
-        (*self)->len = strlen(pattern);
-        if( (*self)->pattern == NULL ) {
-            rc = RC(rcText, rcString, rcSearching, rcMemory, rcExhausted);
-        } else if(mode & AGREP_PATTERN_4NA) {
-            rc = compute_alphabits_4na(*self, mode);
-        } else {
-            compute_alphabits(*self);
-        }
-    }
-    if( rc != 0 ) {
-        AgrepWuFree(*self);
-        *self = NULL;
-    }
-    return rc;
-}
-
-void AgrepWuFree ( AgrepWuParams *self )
-{
-    if( self != NULL ) {
-        free(self->pattern);
-        free(self);
-    }
-}
-
-static
-void callback_with_end( const AgrepCallArgs *args )
-{
-    AgrepFlags mode = args->self->mode;
-    AgrepWuParams *self = args->self->wu;
-    int32_t threshold = args->threshold;
-    unsigned char *buf = (unsigned char *)args->buf;
-    int32_t buflen = args->buflen;
-    AgrepMatchCallback cb = dp_end_callback;
-    const void *cbinfo = args;
-    
-    AgrepMatch match;
-    AgrepContinueFlag cont;
-    int32_t i, k;
-    int64_t *R = malloc(sizeof(int64_t) * (threshold + 1));
-    int64_t *Rnew = malloc(sizeof(int64_t) * (threshold + 1));
-    int64_t *tmp;
-
-    int32_t Score;
-    int32_t curscore = 0;
-    int32_t curlast = 0;
-    int32_t continuing = 0;
-
-    for (k=0; k<=threshold; k++) {
-        R[k] = self->patmask>>k;
-    }
-
-    for (i=0; i<buflen; i++) {
-        /* Not with 2na, you don't! 
-        if (buf[i] == '\0')
-        break; */
-
-        uint64_t bits = self->alphabits[buf[i]];
-        Rnew[0] = (R[0] >> 1) & bits;
-        for (k=1; k<=threshold; k++) {
-            Rnew[k] = ((R[k] >> 1) & bits) | R[k-1]>>1 | Rnew[k-1]>>1 | R[k-1];
-        }
-        Score = -1;
-        for (k=0; k<=threshold; k++) {
-            if (Rnew[k] & 1) {
-                /* Found a match -- report ending position, use DP for backscan */
-                Score = k;
-                break;
-            }
-        }
-        if (Score >= 0) {
-            if (continuing) {
-                if (Score < curscore &&
-                    ((mode & AGREP_EXTEND_BETTER) ||
-                     (mode & AGREP_EXTEND_SAME))) {
-                    curscore = Score;
-                    curlast = i;
-                } else if (Score == curscore &&
-                           ((mode & AGREP_EXTEND_BETTER) ||
-                            (mode & AGREP_EXTEND_SAME))) {
-                    if (mode & AGREP_EXTEND_SAME) {
-                        curlast = i;
-                    }
-                } else {
-                    continuing = 0;
-                    match.score = curscore;
-                    match.position = curlast;
-                    match.length = -1;
-                    cont = AGREP_CONTINUE;
-                    (*cb)(cbinfo, &match, &cont);
-                    if (cont != AGREP_CONTINUE)
-                        goto EXIT;
-                }
-            } else if ((mode & AGREP_EXTEND_SAME) ||
-                       (mode & AGREP_EXTEND_BETTER)) {
-                curscore = Score;
-                curlast = i;
-                continuing = 1;
-            } else {
-                match.score = Score;
-                match.position = i;
-                match.length = -1;
-                cont = AGREP_CONTINUE;
-                (*cb)(cbinfo, &match, &cont);
-                if (cont != AGREP_CONTINUE)
-                    goto EXIT;
-            }
-            /* If we're no longer under the threshold, we might
-               have been moving forward looking for a better match 
-            */
-        } else if (continuing) {
-            continuing = 0;
-            match.score = curscore;
-            match.position = curlast;
-            match.length = -1;
-            cont = AGREP_CONTINUE;
-            (*cb)(cbinfo, &match, &cont);
-            if (cont != AGREP_CONTINUE)
-                goto EXIT;
-        }
-        tmp = R; R = Rnew; Rnew = tmp;
-    }
-    if (continuing) {
-        continuing = 0;
-        match.score = curscore;
-        match.position = curlast;
-        match.length = -1;
-        (*cb)(cbinfo, &match, &cont);
-    }
-EXIT:
-    free(R);
-    free(Rnew);
-}
-
-/* 
-   Returns -1 if no match found, otherwise returns ENDING position.
-*/
-
-static
-int32_t find_end(const AgrepWuParams *self, int32_t threshold, const char *buf, int32_t buflen, int32_t *score)
-{
-    const unsigned char *ubuf = (const unsigned char *)buf;
-    int32_t i, k;
-    int64_t *R = malloc(sizeof(int64_t) * (threshold + 1));
-    int64_t *Rnew = malloc(sizeof(int64_t) * (threshold + 1));
-    int64_t *tmp;
-    int32_t foundit = 0;
-    int32_t found = -1; /* This is the value. */
-    int32_t stillunderthreshold = 0;
-    uint64_t bits;
-
-    *score = threshold;
-
-    for (k=0; k<=threshold; k++) {
-        R[k] = self->patmask>>k;
-    }
-
-    for (i=0; i<buflen; i++) {
-
-        if (buf[i] == '\0')
-            break;
-        bits = self->alphabits[ubuf[i]];
-        Rnew[0] = (R[0] >> 1) & bits;
-        if (Rnew[0] & 1) {
-            /* Exact match */
-            *score = 0;
-            if (debug) {
-                printf("Found end match at position %d\n", i);
-            }
-            free(R);
-            free(Rnew);
-            return i;
-        }
-        stillunderthreshold = 0;
-        for (k=1; k<=threshold; k++) {
-
-            Rnew[k] = ((R[k] >> 1) & bits) | R[k-1]>>1 | Rnew[k-1]>>1 | R[k-1];
-
-            if (Rnew[k] & 1) {
-                stillunderthreshold = 1;
-                /* Approx match */
-                if (k <= *score) {
-                    *score = k;
-                    if (debug) {
-                        printf("Found approx match at position %d\n", i);
-                    }
-                    foundit = 1;
-                    found = i;
-                }
-            }
-        }
-        /* If we're here, we haven't found anything at the threshold we're looking. */
-        if (foundit && !stillunderthreshold) {
-            free(R);
-            free(Rnew);
-            return found;
-        }
-        tmp = R; R = Rnew; Rnew = tmp;
-    }
-    free(R);
-    free(Rnew);
-    if (foundit)
-        return found;
-    return -1;
-}
-
-/*
-We only need to compute up to the score we're searching for.
-
-Returns nonnegative if found, otherwise returns -1.
-*/
-static
-int32_t find_begin(const AgrepWuParams *self, const char *buf, int32_t buflen, int32_t end, int32_t score )
-{
-    const unsigned char *ubuf = (const unsigned char *)buf;
-    int32_t i, k;
-    int64_t *R = malloc(sizeof(int64_t) * (score + 1));
-    int64_t *Rnew = malloc(sizeof(int64_t) * (score + 1));
-    int64_t *tmp;
-    int32_t foundit = 0;
-    int32_t found = -1;
-
-    for (k=0; k<=score; k++) {
-        R[k] = self->patmask>>k;
-    }
-
-    for (i=end; i>=0; i--) {
-
-        uint64_t bits = self->r_alphabits[ubuf[i]];
-        Rnew[0] = (R[0] >> 1) & bits;
-        if (Rnew[0] & 1) {
-            /* Exact match */
-            if (debug) {
-                printf("Found begin match at position %d\n", i);
-            }
-            free(R);
-            free(Rnew);
-            return i;
-        }
-        for (k=1; k<=score; k++) {
-
-            Rnew[k] = ((R[k] >> 1) & bits) | R[k-1]>>1 | Rnew[k-1]>>1 | R[k-1];
-
-            if (Rnew[k] & 1) {
-                /* Approx match */
-                if (debug) {
-                    printf("Found approx begin match at position %d\n", i);
-                }
-                score = k; /* Not sure this has an effect */
-                foundit = 1;
-                found = i;
-                goto CONTINUE;
-            }
-        }
-        /* If we're here, we haven't found anything at the threshold we're looking */
-        if (foundit) {
-            free(R);
-            free(Rnew);
-            return found;
-        }
-    CONTINUE:
-        tmp = R; R = Rnew; Rnew = tmp;
-    }
-    free(R);
-    free(Rnew);
-    if (foundit)
-        return found;
-    return -1;
-}
-
-/* 
-Returns nonzero if found something.
-*/
-uint32_t AgrepWuFindFirst( const AgrepWuParams *self, 
-        int32_t threshold, const char *buf, int32_t buflen, AgrepMatch *match )
-{
-    int32_t end, begin;
-    int32_t score;
-    while (-1 != (end = find_end(self, threshold, buf, buflen, &score))) {
-        begin = find_begin(self, buf, buflen, end, threshold);
-        if (begin < 0) {
-            /* This is some kind of error condition -- when the reverse search
-               goes past the beginning.  I think I wasn't biasing the 
-               reverse search, so a "best" reverse search didn't necessarily 
-               start at the end of the matching sequence. */
-            /* printf("It happened\n"); */
-            begin = end-self->len - threshold;
-            if (begin < 0) {
-                begin = 0;
-            }
-        }
-        match->position = begin;
-        match->length = end - begin + 1;
-        match->score = score;
-        return 1;
-    }
-    return 0;
-}
-
-void AgrepWuFindAll( const AgrepCallArgs *args )
-{
-    callback_with_end( args );
-}
-    
-
diff --git a/libs/search/debug.h b/libs/search/debug.h
deleted file mode 100644
index cbbb709..0000000
--- a/libs/search/debug.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#ifndef _h_search_debug_
-#define _h_search_debug_
-
-#include <klib/debug.h>
-
-#if _DEBUGGING
-#define SEARCH_DBGF(msg) DBGMSG(DBG_SEARCH, DBG_FLAG(DBG_SEARCH_METHOD), msg)
-#define SEARCH_DBG(fmt, ...) SEARCH_DBGF(("%s:%u: " fmt "\n", __func__, __LINE__, __VA_ARGS__))
-#define SEARCH_DBGERR(rc) SEARCH_DBGF(("%s:%u: %R\n", __func__, __LINE__, rc))
-#define SEARCH_DBGERRP(fmt, rc, ...) SEARCH_DBGF(("%s:%u: %R " fmt "\n", __func__, __LINE__, rc, __VA_ARGS__))
-#else
-#define SEARCH_DBG(fmt, ...) ((void)0)
-#define SEARCH_DBGERR(rc) ((void)0)
-#define SEARCH_DBGERRP(fmt, rc, ...) ((void)0)
-#define SEARCH_DBGF(msg) ((void)0)
-#endif
-
-#endif /* _h_search_debug_ */
diff --git a/libs/search/fgrep-aho.c b/libs/search/fgrep-aho.c
deleted file mode 100644
index f0be9ca..0000000
--- a/libs/search/fgrep-aho.c
+++ /dev/null
@@ -1,348 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <search/extern.h>
-#include <compiler.h>
-#include <os-native.h>
-#include "search-priv.h"
-#include <sysalloc.h>
-
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-struct FgrepAhoParams {
-    struct trie *trie;
-    int32_t charskips[256];
-    int32_t minlength;
-};
-
-/*
-  Need tries for large alphabets -- maybe based on hashtable
-  of (state, char) pairs.
-  Can build alphabet-indexed trie for small alphabets.
-
-  Given a set of strings we're looking for, we have minlength.
-  We start looking at curpos + minlength.
-*/
-
-static int32_t quiet = 1;
-
-typedef struct out_s {
-    const char *s;
-    int32_t whichpattern;
-    struct out_s *nxt;
-} out_s;
-
-void push_out(out_s **where, const char *out, int32_t whichpattern)
-{
-    out_s *newout = malloc(sizeof(out_s));
-    newout->s = out;
-    newout->whichpattern = whichpattern;
-    newout->nxt = *where;
-    *where = newout;
-}
-    
-
-struct trie {
-    struct trie *next[256];  
-    struct trie *fail; /* New for aho-corasick */
-    out_s *outs;
-    char *debugs;
-    int32_t depth;
-    int32_t hasmatch; /* Has match below here in the trie. */
-};
-
-static
-void print_trie_node(struct trie *self, char *car)
-{
-    out_s *outs;
-    if (!quiet) {
-        printf("%s: %s: outputs ", car, self->debugs);
-        outs = self->outs;
-        while (outs != NULL) {
-            printf("%s ", outs->s);
-            outs = outs->nxt;
-        }
-    }
-}
-
-static
-void free_trie(struct trie *self)
-{
-    int i;
-    for (i=0; i<256; i++) {
-        if (self->next[i] != NULL) {
-            free_trie(self->next[i]);
-            self->next[i] = NULL;
-        }
-    }
-    free(self);
-}
-
-static
-void print_trie(struct trie *self, char *car) 
-{
-    int32_t i;
-    char buf[2];
-    if (!quiet) {
-        for (i=0; i<self->depth; i++) 
-            printf(" ");
-        print_trie_node(self, car);
-        for (i=0; i<256; i++) {
-            if (self->next[i] != NULL) {
-                buf[0] = i;
-                buf[1] = '\0';
-                print_trie(self->next[i], buf);
-            }
-        }
-    }
-}
-
-static
-void trie_enter(struct trie *self, int32_t whichpattern, const char *s, int32_t minlen)
-{
-    struct trie *cur = self;
-    struct trie *newone = NULL;
-    int32_t len;
-    int32_t i;
-    len = strlen(s);
-    for (i=0; i<len; i++) {
-        unsigned char c = (unsigned char)s[i];
-        if (NULL != cur->next[c]) {
-            cur->hasmatch = 1;
-            cur = cur->next[c];
-        } else {
-            newone = (struct trie *)malloc(sizeof(struct trie));
-            newone->fail = NULL;
-            newone->outs = NULL;
-            newone->debugs = create_substring(s, i+1);
-            newone->depth = i+1;
-            newone->hasmatch = 1;
-            memset( newone->next, 0, sizeof( *newone->next ) );
-            cur->next[c] = newone;
-            cur = newone;
-        }
-    }
-    push_out(&cur->outs, s, whichpattern);
-}
-
-static
-void trie_calc_failure_links(struct trie *self)
-{
-    struct queue_s {
-        struct trie *trie;
-        struct queue_s *nxt;
-    };
-    struct queue_s *queue = NULL;
-    struct queue_s *queueend = NULL;
-    struct queue_s *newq, *tmpqueue;
-    struct trie *r, *u, *v;
-    struct trie *trie;
-    int32_t i;
-    out_s *outs;
-
-    for (i = 0; i<256; i++) {
-        if ((trie = self->next[i]) != NULL) {
-            trie->fail = self;
-            newq = malloc(sizeof(struct queue_s));
-            newq->nxt = NULL;
-            newq->trie = trie;
-            if (queueend != NULL) {
-                queueend->nxt = newq;
-                queueend = newq;
-            } else {
-                queue = queueend = newq;
-            }
-        }
-    }
-    while (queue != NULL) {
-        r = queue->trie;
-        tmpqueue = queue;
-        queue = queue->nxt;
-        free(tmpqueue);
-        if (queueend == tmpqueue) {
-            queueend = NULL;
-        }
-
-        if (r == NULL) {
-            printf("It happened.\n");
-            continue;
-        }
-        
-        for (i = 0; i<256; i++) {
-            if ((u = r->next[i]) != NULL) {            
-                newq = malloc(sizeof(struct queue_s));
-                newq->trie = u;
-                newq->nxt = NULL;
-                if (queueend != NULL) {
-                    queueend->nxt = newq;
-                    queueend = newq;
-                } else {
-                    queue = queueend = newq;
-                }
-                /* Not sure about this stuff here. */
-                v = r->fail;
-                while (v != NULL && v->next[i] == NULL) {
-                    v = v->fail;
-                }
-                if (v != NULL && v->next[i] != NULL) {
-                    u->fail = v->next[i];
-                } else {
-                    u->fail = self;
-                }
-                outs = u->fail->outs;
-                while (outs != NULL) {
-                    push_out(&trie->outs, outs->s, outs->whichpattern);
-                    outs = outs->nxt;
-                }
-            }
-        }
-    }
-}
-
-static 
-void buildtrie(struct trie **self, const char *strings[], int32_t numstrings)
-{
-    int32_t i;
-    int32_t minlen = 1000000;
-    int32_t len;
-
-    for (i=0; i<numstrings; i++) {
-        len = strlen(strings[i]);
-        if (len < minlen) {
-            minlen = len;
-        }
-    }
-
-    *self = (struct trie *)malloc(sizeof(struct trie));
-    for (i=0; i<256; i++) {
-        (*self)->next[i] = NULL;
-    }
-    (*self)->outs = NULL;
-  
-    for (i=0; i<numstrings; i++) {
-        trie_enter(*self, i, strings[i], minlen);
-    }
-    trie_calc_failure_links(*self);
-}
-
-void FgrepAhoFree( FgrepAhoParams *self )
-{
-    free_trie(self->trie);
-    free(self);
-}
-
-void FgrepAhoMake ( FgrepAhoParams **self,
-        const char *strings[], uint32_t numstrings )
-{
-    int32_t i;
-    struct trie *trie;
-    int32_t len;
-    buildtrie(&trie, strings, numstrings);
-    if (!quiet) {
-        print_trie(trie, "");
-    }
-    *self = (FgrepAhoParams *)malloc(sizeof(FgrepAhoParams));
-    (*self)->trie = trie;
-    (*self)->minlength = 10000;
-    for (i=0; i<numstrings; i++) {
-        len = strlen(strings[i]);
-        if (len < (*self)->minlength) {
-            (*self)->minlength = len;
-        }
-    }
-}
-
-
-/* 
-Returns nonzero when found something.
-*/  
-uint32_t FgrepAhoFindFirst ( FgrepAhoParams *self,
-        const char *buf, size_t len, FgrepMatch *match )
-{
-    unsigned char *ubuf = (unsigned char *)buf;
-    struct trie *trie;
-    struct trie *newtrie;
-    
-    unsigned char nxt;
-    int32_t mend = 0;
-    
-    trie = self->trie;
-    while (mend < len) {
-        nxt = ubuf[mend++];
-        newtrie = trie->next[nxt];
-        if (newtrie == NULL) {
-            newtrie = trie->fail;
-            mend--;
-        }
-        if (newtrie == NULL) {
-            trie = self->trie;
-            mend++;
-        } else if (newtrie->outs != NULL) {
-            match->position = mend - newtrie->depth;
-            match->length = newtrie->depth;
-            match->whichpattern = newtrie->outs->whichpattern;
-            return 1;
-        } else {
-            trie = newtrie;
-        }
-    }
-    return 0;
-}
-
-int32_t FgrepAhoFindAll ( FgrepAhoParams *self,
-    char *buf, int32_t len, int32_t *whichpattern )
-{
-    unsigned char *ubuf = (unsigned char *)buf;
-    struct trie *trie;
-    struct trie *newtrie;
-
-    unsigned char nxt;
-    int32_t mend = 0;
-    
-    trie = self->trie;
-    while (mend < len) {
-        nxt = ubuf[mend++];
-        newtrie = trie->next[nxt];
-        if (newtrie == NULL) {
-            newtrie = trie->fail;
-            mend--;
-        }
-        if (newtrie == NULL) {
-            trie = self->trie;
-            mend++;
-        } else if (newtrie->outs != NULL) {
-            *whichpattern = newtrie->outs->whichpattern;
-            return mend - newtrie->depth;
-        } else {
-            trie = newtrie;
-        }
-    }
-    return -1;
-}
diff --git a/libs/search/fgrep-boyermoore.c b/libs/search/fgrep-boyermoore.c
deleted file mode 100644
index 8029ca3..0000000
--- a/libs/search/fgrep-boyermoore.c
+++ /dev/null
@@ -1,458 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <search/extern.h>
-#include <compiler.h>
-#include <os-native.h>
-#include "search-priv.h"
-#include <sysalloc.h>
-
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-/*
-  Need tries for large alphabets -- maybe based on hashtable
-  of (state, char) pairs.
-  Can build alphabet-indexed trie for small alphabets.
-
-  Given a set of strings we're looking for, we have minlength.
-  We start looking at curpos + minlength.
-*/
-
-static
-char *reverse_string(const char *s) 
-{
-    int32_t len = strlen(s);
-    char *ret = malloc(len+1);
-    char *rp = ret;
-    const char *src = s+len;
-    while (--src >= s) {
-        *rp++ = *src;
-    }
-    *rp = '\0';
-    return ret;
-}
-
-
-struct trie {
-    struct trie *next[256];
-    char *s;
-#ifdef DEBUG
-    char *debugs;
-#endif
-    int32_t whichpattern;
-    int32_t depth;
-    int32_t hasmatch; /* Has match below here in the trie. */
-    /*
-      Used to be called "contained".  Basically we have a pattern that
-      has been matched in the text, so we either need to contain this,
-      or use a suffix of this as a prefix of our pattern.
-
-      Any prospective pattern must either have its prefix here,
-      or contain what we've seen.
-      Note: this will be less than the skip below.
-    */
-    int32_t minskip_matched; 
-
-    /* 
-       The pattern contained unmatched chars.  This used to be called prefix.
-       Basically we have some unmatched characters, so it doesn't help to 
-       contain this pattern, we need to start our string using some suffix
-       of this pattern.  Note: the whole pattern could start a match.
-
-       Any prospective pattern must have its prefix match a suffix of this.
-    */
-    int32_t minskip_unmatched; 
-};
-
-#ifdef DEBUG
-
-static
-void print_trie_node(struct trie *self, char *car)
-{
-    printf("%s: %s: %s hasmatch %d matched %d unmatched %d\n",
-           car, self->debugs, self->s, self->hasmatch, self->minskip_matched, self->minskip_unmatched);
-}
-
-static
-void print_trie(struct trie *self, char *car) 
-{
-    int32_t i;
-    char buf[2];
-    for (i=0; i<self->depth; i++) 
-        printf(" ");
-    print_trie_node(self, car);
-    for (i=0; i<256; i++) {
-        if (self->next[i] != NULL) {
-            buf[0] = i;
-            buf[1] = '\0';
-            print_trie(self->next[i], buf);
-        }
-    }
-}
-
-#endif /* DEBUG */
-
-
-static
-void free_trie(struct trie *self)
-{
-    int i;
-    for (i=0; i<256; i++) {
-        if (self->next[i] != NULL) {
-            free_trie(self->next[i]);
-            self->next[i] = NULL;
-        }
-    }
-    free(self);
-}
-
-
-static
-void trie_enter(struct trie *self, int32_t whichpattern, char *s, int32_t minlen)
-{
-    struct trie *cur = self;
-    struct trie *newone = NULL;
-    int32_t len;
-    int32_t i;
-    len = strlen(s);
-    for (i=0; i<len; i++) {
-        unsigned char c = (unsigned char)s[i];
-        if (NULL != cur->next[c]) {
-            cur->hasmatch = 1;
-            cur = cur->next[c];
-        } else {
-            newone = (struct trie *)malloc(sizeof(struct trie));
-            newone->s = NULL;
-#ifdef DEBUG
-            newone->debugs = create_substring(s, i+1);
-#endif
-            newone->depth = i+1;
-            newone->hasmatch = 1;
-            newone->minskip_matched = minlen;
-            newone->minskip_unmatched = minlen;
-            memset( newone->next, 0, sizeof( *newone->next ) );
-            cur->next[c] = newone;
-            cur = newone;
-        }
-    }
-    cur->whichpattern = whichpattern;
-    cur->s = s;
-}
-
-static
-void trie_enter_suffixes(struct trie *self, char *s, int32_t minlen)
-{
-    struct trie *cur;
-    struct trie *newone;
-    int32_t suf;
-    int32_t i;
-    int32_t len;
-    len = strlen(s);
-    for (suf = 1; suf<len; suf++) {
-        cur = self;
-        for (i=0; suf+i<len; i++) {
-            unsigned char c = s[suf+i];
-            if (NULL != cur->next[c]) {
-                cur = cur->next[c];
-#ifdef NOPE
-                if (!cur->hasmatch)
-                    break;
-#endif
-            } else {
-                newone = (struct trie *)malloc(sizeof(struct trie));
-                newone->s = NULL;
-#ifdef DEBUG
-                newone->debugs = create_substring(s+suf, i+1);
-#endif
-                newone->depth = i+1;
-                newone->hasmatch = 0;
-                newone->minskip_matched = suf;
-                newone->minskip_unmatched = minlen;
-                memset( newone->next, 0, sizeof( *newone->next ) );
-                cur->next[c] = newone;
-                cur = newone;
-            }
-        }
-    }
-}
-
-
-/* This recurses down the trie and sets the prefix_skip
-   based upon what's computer in trie_set_minskip for the prefix skip.
-*/
-static
-void trie_recurse_prefix_minskip(struct trie *trie, int32_t skip) 
-{
-    int32_t i;
-    if (skip < trie->minskip_unmatched) {
-#ifdef DEBUG
-        if (trie->debugs == NULL) {
-            fprintf(stderr, "Setting minskip prefix unmatched of (something) to %d\n", skip);
-        } else {
-            fprintf(stderr, "Setting minskip prefix unmatched of %s to %d\n", trie->debugs, skip);
-        }
-#endif
-        trie->minskip_unmatched = skip;
-    }
-    if (skip < trie->minskip_matched) {
-#ifdef DEBUG
-        if (trie->debugs == NULL) {
-            fprintf(stderr, "Setting minskip prefix matched of (something) to %d\n", skip);
-        } else {
-            fprintf(stderr, "Setting minskip prefix matched of %s to %d\n", trie->debugs, skip);
-        }
-#endif
-        trie->minskip_matched = skip;
-    }
-    for (i=0; i<256; i++) {
-        if (trie->next[i] != NULL) {
-            trie_recurse_prefix_minskip(trie->next[i], skip);
-        }
-    }
-}
-
-static
-void trie_set_minskip(struct trie *trie, const char *s, const char *rs)
-{
-    unsigned char *urs = (unsigned char *)rs;
-    unsigned char *us = (unsigned char *)s;
-    struct trie *cur;
-    int32_t len;
-    int32_t i;
-    int32_t skip;
-    char buf[1024];
-    int32_t prefix;
-    len = strlen(rs);
-    for (skip=1; skip<len; skip++) {
-        cur = trie->next[urs[skip]];
-        for (i=1; i<len-skip && cur != NULL; i++) {
-            if (skip < cur->minskip_matched) {
-                strncpy(buf, rs+skip, i);
-                buf[i] = '\0';
-#ifdef DEBUG
-                fprintf(stderr, "Setting minskip contained of %s to %d\n", buf, skip);
-#endif                    
-                cur->minskip_matched = skip;
-            }
-            cur = cur->next[urs[skip+i]];
-        }
-    }
-    /* Now we need to set up minskip_prefix --
-       We need to walk down the tree from any prefix of our word,
-       and set the minskip_prefix based upon (wordlen-prefix).
-       Note: non-empty prefixes, so start at 1.
-    */
-    for (prefix = 1; prefix<len; prefix++) {
-        skip = len - prefix;
-        cur = trie;
-        for (i=prefix-1; i>=0 && cur != NULL; i--) {
-            cur = cur->next[us[i]];
-        }
-        if (cur != NULL) {
-#ifdef DEBUG
-            fprintf(stderr, "Setting minskip to at most %d in:\n", skip);
-            print_trie_node(cur, s);
-#endif            
-            trie_recurse_prefix_minskip(cur, skip);
-        }
-    }
-}
-
-static    
-void buildreversetrie(struct trie **self, const char *strings[], int32_t numstrings)
-{
-    int32_t i;
-    int32_t minlen = 1000000;
-    int32_t len;
-    char *reversestrings[10000];
-
-    for (i=0; i<numstrings; i++) {
-        len = strlen(strings[i]);
-        if (len < minlen) {
-            minlen = len;
-        }
-    }
-
-    *self = (struct trie *)malloc(sizeof(struct trie));
-    for (i=0; i<256; i++) {
-        (*self)->next[i] = NULL;
-    }
-    (*self)->s = NULL;
-  
-    for (i=0; i<numstrings; i++) {
-        reversestrings[i] = reverse_string(strings[i]);
-    }
-    for (i=0; i<numstrings; i++) {
-        trie_enter(*self, i, reversestrings[i], minlen);
-    }
-    for (i=0; i<numstrings; i++) {
-        trie_enter_suffixes(*self, reversestrings[i], minlen);
-    }
-    for (i=0; i<numstrings; i++) {
-        trie_set_minskip(*self, strings[i], reversestrings[i]);
-    }
-    (*self)->minskip_matched = 1;
-    (*self)->minskip_unmatched = minlen;
-}
-
-
-
-struct FgrepBoyerParams {
-    struct trie *trie;
-    int32_t charskips[256];
-    int32_t minlength;
-};
-
-
-void FgrepBoyerSearchFree( FgrepBoyerParams *self )
-{
-    free_trie(self->trie);
-    free(self);
-}
-
-
-void FgrepBoyerSearchMake ( FgrepBoyerParams **self,
-        const char *strings[], uint32_t numstrings )
-{
-    int32_t i;
-    struct trie *trie;
-    int32_t len;
-    buildreversetrie(&trie, strings, numstrings);
-#ifdef DEBUG
-    print_trie(trie, "");
-#endif
-    *self = (FgrepBoyerParams *)malloc(sizeof(FgrepBoyerParams));
-    (*self)->trie = trie;
-    (*self)->minlength = 10000;
-    for (i=0; i<numstrings; i++) {
-        len = strlen(strings[i]);
-        if (len < (*self)->minlength) {
-            (*self)->minlength = len;
-        }
-    }
-}
-
-/*
-  Currently implementing for bytes.
-  Returns non-negative if found, -1 if not.
-*/
-uint32_t FgrepBoyerFindFirst ( FgrepBoyerParams *self,
-        const char *buf, size_t len, FgrepMatch *match )
-{
-    unsigned char *ubuf = (unsigned char *)buf;
-    struct trie *trie;
-    struct trie *newtrie;
-    unsigned char *p = ubuf;
-    unsigned char *startp;
-    unsigned char *endp = ubuf+len;
-    int32_t skips = 0;
-
-    /* fprintf(stderr, "Searching %10s... for %d chars\n", buf, len); */
-    p = ubuf + self->minlength;
-    while (1) {
-        if (p >= endp)
-            break;
-        startp = p;
-        trie = self->trie;
-    CONT:
-        if (NULL == (newtrie = trie->next[*--p])) {
-            p = startp + trie->minskip_unmatched;
-            skips += trie->minskip_unmatched;
-            continue;
-        }
-        if (!newtrie->hasmatch) {
-            while (newtrie) {
-                trie = newtrie;
-                newtrie = newtrie->next[*--p];
-            }
-            p = startp + trie->minskip_unmatched;
-            skips += trie->minskip_unmatched;
-            continue;
-        }
-        if (newtrie->s != NULL) {
-            match->position = p - ubuf;
-            match->length = newtrie->depth;
-            match->whichpattern = newtrie->whichpattern;
-            return 1;
-        }
-        trie = newtrie;
-        goto CONT;
-    }
-    return 0;
-}
-
-void FgrepBoyerFindAll ( FgrepBoyerParams *self,
-        char *buf, int32_t len, FgrepMatchCallback cb, void *cbinfo )
-{
-    unsigned char *ubuf = (unsigned char *)buf;
-    struct trie *trie;
-    struct trie *newtrie;
-    unsigned char *p = ubuf;
-    unsigned char *startp;
-    unsigned char *endp = ubuf+len;
-    int32_t skips = 0;
-    FgrepContinueFlag cont;
-    FgrepMatch match;
-
-    /* fprintf(stderr, "Searching %10s... for %d chars\n", buf, len); */
-    p = ubuf + self->minlength;
-    while (1) {
-        if (p >= endp)
-            break;
-        startp = p;
-        trie = self->trie;
-    CONT:
-        if (NULL == (newtrie = trie->next[*--p])) {
-            p = startp + trie->minskip_unmatched;
-            skips += trie->minskip_unmatched;
-            continue;
-        }
-        if (!newtrie->hasmatch) {
-            while (newtrie) {
-                trie = newtrie;
-                newtrie = newtrie->next[*--p];
-            }
-            p = startp + trie->minskip_unmatched;
-            skips += trie->minskip_unmatched;
-            continue;
-        }
-        if (newtrie->s != NULL) {
-            cont = FGREP_CONTINUE;
-            match.position = p - ubuf;
-            match.length = newtrie->depth;
-            match.whichpattern = newtrie->whichpattern;
-            (*cb)(cbinfo, &match, &cont);
-            if (cont != FGREP_CONTINUE)
-                return;
-        }
-        trie = newtrie;
-        goto CONT;
-    }
-}
diff --git a/libs/search/fgrep-dumb.c b/libs/search/fgrep-dumb.c
deleted file mode 100644
index b0abfe2..0000000
--- a/libs/search/fgrep-dumb.c
+++ /dev/null
@@ -1,326 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <search/extern.h>
-#include <compiler.h>
-#include <os-native.h>
-#include "search-priv.h"
-#include <sysalloc.h>
-
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-/*
-  Need tries for large alphabets -- maybe based on hashtable
-  of (state, char) pairs.
-  Can build alphabet-indexed trie for small alphabets.
-
-  Given a set of strings we're looking for, we have minlength.
-  We start looking at curpos + minlength.
-*/
-
-struct trie {
-    struct trie *next[256];
-    const char *s;
-#ifdef DEBUG
-    char *debugs;
-#endif
-    int32_t whichpattern;
-    int32_t depth;
-    int32_t hasmatch; /* Has match below here in the trie. */
-};
-
-struct FgrepDumbParams {
-    struct trie *trie;
-};
-
-
-#ifdef DEBUG
-
-static
-void print_trie_node(struct trie *self, char *car)
-{
-    printf("%s: %s: %s hasmatch %d\n",
-           car, self->debugs, self->s, 0);
-}
-
-static
-void print_trie(struct trie *self, char *car) 
-{
-    int32_t i;
-    char buf[2];
-    for (i=0; i<self->depth; i++) 
-        printf(" ");
-    print_trie_node(self, car);
-    for (i=0; i<256; i++) {
-        if (self->next[i] != NULL) {
-            buf[0] = i;
-            buf[1] = '\0';
-            print_trie(self->next[i], buf);
-        }
-    }
-}
-
-#endif /* DEBUG */
-
-static
-void free_trie(struct trie *self)
-{
-    int i;
-    for (i=0; i<256; i++) {
-        if (self->next[i] != NULL) {
-            free_trie(self->next[i]);
-            self->next[i] = NULL;
-        }
-    }
-    free(self);
-}
-
-static
-void trie_enter(struct trie *self, const char *s, int32_t minlen)
-{
-    struct trie *cur = self;
-    struct trie *newone = NULL;
-    int32_t len;
-    int32_t i;
-    len = strlen(s);
-    for (i=0; i<len; i++) {
-        unsigned char c = s[i];
-        if (NULL != cur->next[c]) {
-            cur->hasmatch = 1;
-            cur = cur->next[c];
-        } else {
-            newone = (struct trie *)malloc(sizeof(struct trie));
-            newone->s = NULL;
-#ifdef DEBUG
-            newone->debugs = create_substring(s, i+1);
-#endif
-            newone->depth = i+1;
-            newone->hasmatch = 1;
-            memset( newone->next, 0, sizeof( *newone->next ) );
-            cur->next[c] = newone;
-            cur = newone;
-        }
-    }
-    cur->s = s;
-}
-
-
-static
-void buildtrie(struct trie **self, const char *strings[], int32_t numstrings)
-{
-    int32_t i;
-    int32_t minlen = 1000000;
-    int32_t len;
-
-    for (i=0; i<numstrings; i++) {
-        len = strlen(strings[i]);
-        if (len < minlen) {
-            minlen = len;
-        }
-    }
-
-    *self = (struct trie *)malloc(sizeof(struct trie));
-    for (i=0; i<256; i++) {
-        (*self)->next[i] = NULL;
-    }
-    (*self)->s = NULL;
-  
-    for (i=0; i<numstrings; i++) {
-        trie_enter(*self, strings[i], minlen);
-    }
-}
-
-void FgrepDumbSearchFree( FgrepDumbParams *self )
-{
-    free_trie(self->trie);
-    free(self);
-}
-
-void FgrepDumbSearchMake( FgrepDumbParams **self,
-        const char *strings[], uint32_t numstrings )
-{
-    int32_t i;
-    struct trie *trie;
-    int32_t len;
-    buildtrie(&trie, strings, numstrings);
-    *self = (FgrepDumbParams *)malloc(sizeof(FgrepDumbParams));
-    (*self)->trie = trie;
-    for (i=0; i<numstrings; i++) {
-        len = strlen(strings[i]);
-    }
-}
-
-uint32_t FgrepDumbFindFirst( FgrepDumbParams *self,
-        const char *buf, size_t len, FgrepMatch *match )
-{
-    struct trie *trie;
-    struct trie *newtrie;
-    unsigned char *p = (unsigned char *)buf;
-    unsigned char *startp;
-    unsigned char *endp = (unsigned char *)buf+len;
-
-    for (startp = (unsigned char *)buf; startp < endp; startp++) {
-        p = startp;
-        trie = self->trie;
-        while (p < endp) {
-            newtrie = trie->next[*p++];
-            if (newtrie == NULL) {
-                break;
-            }
-            trie = newtrie;
-            if (trie->s != NULL) {
-                match->position = startp-(unsigned char *)buf;
-                match->length = trie->depth;
-                match->whichpattern = trie->whichpattern;
-                return 1;
-            }
-        }
-    }
-    return 0;
-}
-
-void FgrepDumbFindAll ( FgrepDumbParams *self,
-        char *buf, int32_t len, FgrepMatchCallback cb, void *cbinfo )
-{
-    unsigned char *ubuf = (unsigned char *)buf;
-    struct trie *trie;
-    struct trie *newtrie;
-    unsigned char *p = ubuf;
-    unsigned char *startp;
-    unsigned char *endp = ubuf+len;
-    FgrepContinueFlag cont;
-    FgrepMatch match;
-
-    for (startp = ubuf; startp < endp; startp++) {
-        p = startp;
-        trie = self->trie;
-        while (p < endp) {
-            newtrie = trie->next[*p++];
-            if (newtrie == NULL) {
-                break;
-            }
-            trie = newtrie;
-            if (trie->s != NULL) {
-                cont = FGREP_CONTINUE;
-                match.position = startp-ubuf;
-                match.length = trie->depth;
-                match.whichpattern = trie->whichpattern;
-                (*cb)(cbinfo, &match, &cont);
-                if (cont != FGREP_CONTINUE)
-                    return;
-            }
-        }
-    }
-}
-
-
-/* Try the longest match first. */
-LIB_EXPORT uint32_t CC has_left_exact_match( char *pattern, char *buf, size_t buflen, 
-                              int32_t *length )
-{
-    int32_t plen = strlen(pattern);
-    int32_t i, j;
-
-    /* Added bounds checking -- untested */
-    int32_t bound = plen;
-    if (buflen < bound)
-        bound = buflen;
-    
-    for (i=bound; i>=1; i--) {
-        for (j=0; j<i; j++) {
-            if (pattern[plen-i+j] != buf[j] &&
-                buf[j] != 'N')
-                goto CONT;
-        }
-        /* Found a match */
-        *length = i;
-        return 1;
-    CONT: {}
-    }
-    return 0;
-}
-
-LIB_EXPORT uint32_t CC has_right_exact_match( char *pattern, char *buf, size_t buflen, 
-                               int32_t *bestpos )
-{
-    int32_t plen = strlen(pattern);
-    int32_t bound = plen;
-    int32_t i, j;
-
-    if (buflen <= 0)
-        return 0;
-
-    if (buflen < bound) 
-        bound = buflen;
-
-    /* i is here the length of the prefix */
-    for (i=bound; i>=1; i--) {
-        for (j=0; j<i; j++) {
-            if (pattern[j] != buf[buflen-i+j] &&
-                buf[buflen-i+j] != 'N')
-                goto CONT;
-        }
-        /* Found a match */
-        *bestpos = buflen-i;
-        return 1;
-    CONT: {}
-    }
-    return 0;
-}
-
-
-/* Try the longest match first. */
-/* Used to assume that the text to be matched was at least as long as 
-the pattern.  No more. 
-*/
-LIB_EXPORT uint32_t CC has_inside_exact_match( char *pattern, char *buf, size_t buflen, 
-                                int32_t *skip )
-{
-    int32_t plen = strlen(pattern);
-    int32_t i, j;
-
-    if (buflen <= 0)
-        return 0;
-
-    /* i is here the start in the pattern */
-    for (i=1; i<=plen; i++) {
-        for (j=0; j<buflen; j++) {
-            if (pattern[i+j] != buf[j] &&
-                buf[j] != 'N')
-                goto CONT;
-        }
-        /* Found a match */
-        *skip = i;
-        return 1;
-    CONT: {}
-    }
-    return 0;
-}
-
diff --git a/libs/search/nucstrstr-icc-i386-dbg.pic.s b/libs/search/nucstrstr-icc-i386-dbg.pic.s
deleted file mode 100644
index 3fe1a26..0000000
--- a/libs/search/nucstrstr-icc-i386-dbg.pic.s
+++ /dev/null
@@ -1,31488 +0,0 @@
-	.section .text
-.LNDBG_TX:
-# -- Machine type IA32
-# mark_description "Intel(R) C++ Compiler for applications running on IA-32, Version 10.1    Build 20081024 %s";
-# mark_description "-I/home/yaschenk/devel/internal/asm-trace/sra/search/linux -I/home/yaschenk/devel/internal/asm-trace/sra/sea";
-# mark_description "rch/unix -I/home/yaschenk/devel/internal/asm-trace/sra/search -I/home/yaschenk/devel/internal/asm-trace/itf ";
-# mark_description "-I/home/yaschenk/devel/internal/asm-trace/inc/icc/i386 -I/home/yaschenk/devel/internal/asm-trace/inc/icc -I/";
-# mark_description "home/yaschenk/devel/internal/asm-trace/inc/gcc/i386 -I/home/yaschenk/devel/internal/asm-trace/inc/gcc -I/hom";
-# mark_description "e/yaschenk/devel/internal/asm-trace/inc/linux -I/home/yaschenk/devel/internal/asm-trace/inc/unix -I/home/rod";
-# mark_description "armer/devel/internal/asm-trace/inc -c -S -o nucstrstr.pic.s -fPIC -g -Wall -D_DEBUGGING -DLINUX -DUNIX -D_GN";
-# mark_description "U_SOURCE -D_REENTRANT -D_FILE_OFFSET_BITS=64 -MD";
-	.file "nucstrstr.c"
-	.data
-	.text
-..TXTST0:
-# -- Begin  uint16_lsbit
-# mark_begin;
-       .align    2,0x90
-uint16_lsbit:
-# parameter 1(self): 8 + %ebp
-..B1.1:                         # Preds ..B1.0
-..___tag_value_uint16_lsbit.2:                                  #
-..LN1:
-        pushl     %ebp                                          #38.1
-        movl      %esp, %ebp                                    #38.1
-..___tag_value_uint16_lsbit.7:                                  #
-        pushl     %esi                                          #38.1
-..LN3:
-        movzwl    8(%ebp), %eax                                 #40.0
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #40.0
-        movw      %ax, -4(%ebp)                                 #40.0
-..LN5:
-        movswl    -4(%ebp), %eax                                #49.12
-        leave                                                   #49.12
-..___tag_value_uint16_lsbit.11:                                 #
-        ret                                                     #49.12
-        .align    2,0x90
-..___tag_value_uint16_lsbit.12:                                 #
-                                # LOE
-# mark_end;
-	.type	uint16_lsbit, at function
-	.size	uint16_lsbit,.-uint16_lsbit
-.LNuint16_lsbit:
-	.data
-# -- End  uint16_lsbit
-	.data
-	.text
-# -- Begin  uint128_shr
-# mark_begin;
-       .align    2,0x90
-uint128_shr:
-# parameter 1(self): 8 + %ebp
-# parameter 2(i): 12 + %ebp
-..B2.1:                         # Preds ..B2.0
-..___tag_value_uint128_shr.15:                                  #
-..LN7:
-        pushl     %ebp                                          #295.1
-        movl      %esp, %ebp                                    #295.1
-..___tag_value_uint128_shr.20:                                  #
-..LN9:
-        movl      8(%ebp), %edx                                 #296.0
-        movl      12(%ebp), %ecx                                #296.0
-# Begin ASM
-        mov 4(%edx), %eax;shrd %cl, %eax, (%edx);mov 8(%edx), %eax;shrd %cl, %eax, 4(%edx);mov 12(%edx), %eax;shrd %cl, %eax, 8(%edx);shr %cl, %eax;mov %eax, 12(%edx);
-# End ASM                                                       #296.0
-..LN11:
-        leave                                                   #310.1
-..___tag_value_uint128_shr.24:                                  #
-        ret                                                     #310.1
-        .align    2,0x90
-..___tag_value_uint128_shr.25:                                  #
-                                # LOE
-# mark_end;
-	.type	uint128_shr, at function
-	.size	uint128_shr,.-uint128_shr
-.LNuint128_shr:
-	.data
-# -- End  uint128_shr
-	.text
-# -- Begin  uint128_bswap
-# mark_begin;
-       .align    2,0x90
-uint128_bswap:
-# parameter 1(self): 8 + %ebp
-..B3.1:                         # Preds ..B3.0
-..___tag_value_uint128_bswap.28:                                #
-..LN13:
-        pushl     %ebp                                          #333.1
-        movl      %esp, %ebp                                    #333.1
-..___tag_value_uint128_bswap.33:                                #
-..LN15:
-        movl      8(%ebp), %ecx                                 #334.0
-# Begin ASM
-        mov (%ecx), %eax;mov 12(%ecx), %edx;bswap %eax;bswap %edx;mov %eax, 12(%ecx);mov %edx, (%ecx);mov 4(%ecx), %eax;mov 8(%ecx), %edx;bswap %eax;bswap %edx;mov %eax, 8(%ecx);mov %edx, 4(%ecx);
-# End ASM                                                       #334.0
-..LN17:
-        leave                                                   #352.1
-..___tag_value_uint128_bswap.37:                                #
-        ret                                                     #352.1
-        .align    2,0x90
-..___tag_value_uint128_bswap.38:                                #
-                                # LOE
-# mark_end;
-	.type	uint128_bswap, at function
-	.size	uint128_bswap,.-uint128_bswap
-.LNuint128_bswap:
-	.data
-# -- End  uint128_bswap
-	.text
-# -- Begin  uint128_bswap_copy
-# mark_begin;
-       .align    2,0x90
-uint128_bswap_copy:
-# parameter 1(to): 8 + %ebp
-# parameter 2(from): 12 + %ebp
-..B4.1:                         # Preds ..B4.0
-..___tag_value_uint128_bswap_copy.41:                           #
-..LN19:
-        pushl     %ebp                                          #356.1
-        movl      %esp, %ebp                                    #356.1
-..___tag_value_uint128_bswap_copy.46:                           #
-..LN21:
-        movl      8(%ebp), %ecx                                 #357.0
-        movl      12(%ebp), %edx                                #357.0
-# Begin ASM
-        push %ebx;mov (%edx), %eax;mov 12(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 12(%ecx);mov %ebx, (%ecx);mov 4(%edx), %eax;mov 8(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 8(%ecx);mov %ebx, 4(%ecx);pop %ebx;
-# End ASM                                                       #357.0
-..LN23:
-        leave                                                   #377.1
-..___tag_value_uint128_bswap_copy.50:                           #
-        ret                                                     #377.1
-        .align    2,0x90
-..___tag_value_uint128_bswap_copy.51:                           #
-                                # LOE
-# mark_end;
-	.type	uint128_bswap_copy, at function
-	.size	uint128_bswap_copy,.-uint128_bswap_copy
-.LNuint128_bswap_copy:
-	.data
-# -- End  uint128_bswap_copy
-	.data
-	.text
-# -- Begin  prime_buffer_2na
-# mark_begin;
-       .align    2,0x90
-prime_buffer_2na:
-# parameter 1(src): 8 + %ebx
-# parameter 2(ignore): 12 + %ebx
-..B5.1:                         # Preds ..B5.0
-..___tag_value_prime_buffer_2na.54:                             #
-..LN25:
-        pushl     %ebx                                          #2129.1
-..___tag_value_prime_buffer_2na.59:                             #
-        movl      %esp, %ebx                                    #2129.1
-..___tag_value_prime_buffer_2na.60:                             #
-        andl      $-16, %esp                                    #2129.1
-        pushl     %ebp                                          #2129.1
-        pushl     %ebp                                          #2129.1
-        movl      4(%ebx), %ebp                                 #2129.1
-        movl      %ebp, 4(%esp)                                 #2129.1
-        movl      %esp, %ebp                                    #2129.1
-..___tag_value_prime_buffer_2na.62:                             #
-        subl      $24, %esp                                     #2129.1
-..LN27:
-        movl      8(%ebx), %eax                                 #2132.23
-..LN29:
-        testb     $15, %al                                      #2132.29
-..LN31:
-        jne       ..B5.3        # Prob 50%                      #2132.37
-                                # LOE
-..B5.2:                         # Preds ..B5.1
-..LN33:
-        movl      8(%ebx), %eax                                 #2133.54
-        movdqa    (%eax), %xmm0                                 #2133.54
-..LN35:
-        movdqa    %xmm0, -24(%ebp)                              #2133.9
-        jmp       ..B5.4        # Prob 100%                     #2133.9
-                                # LOE
-..B5.3:                         # Preds ..B5.1
-..LN37:
-        movl      8(%ebx), %eax                                 #2135.55
-        movdqu    (%eax), %xmm0                                 #2135.55
-..LN39:
-        movdqa    %xmm0, -24(%ebp)                              #2135.9
-                                # LOE
-..B5.4:                         # Preds ..B5.2 ..B5.3
-..LN41:
-        movdqa    -24(%ebp), %xmm0                              #2136.12
-        leave                                                   #2136.12
-..___tag_value_prime_buffer_2na.65:                             #
-        movl      %ebx, %esp                                    #2136.12
-        popl      %ebx                                          #2136.12
-..___tag_value_prime_buffer_2na.66:                             #
-        ret                                                     #2136.12
-        .align    2,0x90
-..___tag_value_prime_buffer_2na.68:                             #
-                                # LOE
-# mark_end;
-	.type	prime_buffer_2na, at function
-	.size	prime_buffer_2na,.-prime_buffer_2na
-.LNprime_buffer_2na:
-	.data
-# -- End  prime_buffer_2na
-	.data
-	.align 32
-	.align 32
-expand_2na:
-	.word	4369
-	.word	4370
-	.word	4372
-	.word	4376
-	.word	4385
-	.word	4386
-	.word	4388
-	.word	4392
-	.word	4417
-	.word	4418
-	.word	4420
-	.word	4424
-	.word	4481
-	.word	4482
-	.word	4484
-	.word	4488
-	.word	4625
-	.word	4626
-	.word	4628
-	.word	4632
-	.word	4641
-	.word	4642
-	.word	4644
-	.word	4648
-	.word	4673
-	.word	4674
-	.word	4676
-	.word	4680
-	.word	4737
-	.word	4738
-	.word	4740
-	.word	4744
-	.word	5137
-	.word	5138
-	.word	5140
-	.word	5144
-	.word	5153
-	.word	5154
-	.word	5156
-	.word	5160
-	.word	5185
-	.word	5186
-	.word	5188
-	.word	5192
-	.word	5249
-	.word	5250
-	.word	5252
-	.word	5256
-	.word	6161
-	.word	6162
-	.word	6164
-	.word	6168
-	.word	6177
-	.word	6178
-	.word	6180
-	.word	6184
-	.word	6209
-	.word	6210
-	.word	6212
-	.word	6216
-	.word	6273
-	.word	6274
-	.word	6276
-	.word	6280
-	.word	8465
-	.word	8466
-	.word	8468
-	.word	8472
-	.word	8481
-	.word	8482
-	.word	8484
-	.word	8488
-	.word	8513
-	.word	8514
-	.word	8516
-	.word	8520
-	.word	8577
-	.word	8578
-	.word	8580
-	.word	8584
-	.word	8721
-	.word	8722
-	.word	8724
-	.word	8728
-	.word	8737
-	.word	8738
-	.word	8740
-	.word	8744
-	.word	8769
-	.word	8770
-	.word	8772
-	.word	8776
-	.word	8833
-	.word	8834
-	.word	8836
-	.word	8840
-	.word	9233
-	.word	9234
-	.word	9236
-	.word	9240
-	.word	9249
-	.word	9250
-	.word	9252
-	.word	9256
-	.word	9281
-	.word	9282
-	.word	9284
-	.word	9288
-	.word	9345
-	.word	9346
-	.word	9348
-	.word	9352
-	.word	10257
-	.word	10258
-	.word	10260
-	.word	10264
-	.word	10273
-	.word	10274
-	.word	10276
-	.word	10280
-	.word	10305
-	.word	10306
-	.word	10308
-	.word	10312
-	.word	10369
-	.word	10370
-	.word	10372
-	.word	10376
-	.word	16657
-	.word	16658
-	.word	16660
-	.word	16664
-	.word	16673
-	.word	16674
-	.word	16676
-	.word	16680
-	.word	16705
-	.word	16706
-	.word	16708
-	.word	16712
-	.word	16769
-	.word	16770
-	.word	16772
-	.word	16776
-	.word	16913
-	.word	16914
-	.word	16916
-	.word	16920
-	.word	16929
-	.word	16930
-	.word	16932
-	.word	16936
-	.word	16961
-	.word	16962
-	.word	16964
-	.word	16968
-	.word	17025
-	.word	17026
-	.word	17028
-	.word	17032
-	.word	17425
-	.word	17426
-	.word	17428
-	.word	17432
-	.word	17441
-	.word	17442
-	.word	17444
-	.word	17448
-	.word	17473
-	.word	17474
-	.word	17476
-	.word	17480
-	.word	17537
-	.word	17538
-	.word	17540
-	.word	17544
-	.word	18449
-	.word	18450
-	.word	18452
-	.word	18456
-	.word	18465
-	.word	18466
-	.word	18468
-	.word	18472
-	.word	18497
-	.word	18498
-	.word	18500
-	.word	18504
-	.word	18561
-	.word	18562
-	.word	18564
-	.word	18568
-	.word	33041
-	.word	33042
-	.word	33044
-	.word	33048
-	.word	33057
-	.word	33058
-	.word	33060
-	.word	33064
-	.word	33089
-	.word	33090
-	.word	33092
-	.word	33096
-	.word	33153
-	.word	33154
-	.word	33156
-	.word	33160
-	.word	33297
-	.word	33298
-	.word	33300
-	.word	33304
-	.word	33313
-	.word	33314
-	.word	33316
-	.word	33320
-	.word	33345
-	.word	33346
-	.word	33348
-	.word	33352
-	.word	33409
-	.word	33410
-	.word	33412
-	.word	33416
-	.word	33809
-	.word	33810
-	.word	33812
-	.word	33816
-	.word	33825
-	.word	33826
-	.word	33828
-	.word	33832
-	.word	33857
-	.word	33858
-	.word	33860
-	.word	33864
-	.word	33921
-	.word	33922
-	.word	33924
-	.word	33928
-	.word	34833
-	.word	34834
-	.word	34836
-	.word	34840
-	.word	34849
-	.word	34850
-	.word	34852
-	.word	34856
-	.word	34881
-	.word	34882
-	.word	34884
-	.word	34888
-	.word	34945
-	.word	34946
-	.word	34948
-	.word	34952
-	.type	expand_2na, at object
-	.size	expand_2na,512
-	.data
-	.text
-# -- Begin  prime_buffer_4na
-# mark_begin;
-       .align    2,0x90
-prime_buffer_4na:
-# parameter 1(src): 8 + %ebx
-# parameter 2(ignore): 12 + %ebx
-..B6.1:                         # Preds ..B6.0
-..___tag_value_prime_buffer_4na.71:                             #
-..LN43:
-        pushl     %ebx                                          #3990.1
-..___tag_value_prime_buffer_4na.76:                             #
-        movl      %esp, %ebx                                    #3990.1
-..___tag_value_prime_buffer_4na.77:                             #
-        andl      $-16, %esp                                    #3990.1
-        pushl     %ebp                                          #3990.1
-        pushl     %ebp                                          #3990.1
-        movl      4(%ebx), %ebp                                 #3990.1
-        movl      %ebp, 4(%esp)                                 #3990.1
-        movl      %esp, %ebp                                    #3990.1
-..___tag_value_prime_buffer_4na.79:                             #
-        subl      $40, %esp                                     #3990.1
-        call      ..L81         # Prob 100%                     #3990.1
-..L81:                                                          #
-        popl      %eax                                          #3990.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L81], %eax      #3990.1
-..LN45:
-        movl      8(%ebx), %edx                                 #3996.34
-        movzbl    (%edx), %edx                                  #3996.34
-        movzbl    %dl, %edx                                     #3996.34
-..LN47:
-        movzwl    expand_2na at GOTOFF(%eax,%edx,2), %edx          #3996.21
-..LN49:
-        movw      %dx, -40(%ebp)                                #3996.5
-..LN51:
-        movl      8(%ebx), %edx                                 #3997.34
-        movzbl    1(%edx), %edx                                 #3997.34
-        movzbl    %dl, %edx                                     #3997.34
-..LN53:
-        movzwl    expand_2na at GOTOFF(%eax,%edx,2), %edx          #3997.21
-..LN55:
-        movw      %dx, -38(%ebp)                                #3997.5
-..LN57:
-        movl      8(%ebx), %edx                                 #3998.34
-        movzbl    2(%edx), %edx                                 #3998.34
-        movzbl    %dl, %edx                                     #3998.34
-..LN59:
-        movzwl    expand_2na at GOTOFF(%eax,%edx,2), %edx          #3998.21
-..LN61:
-        movw      %dx, -36(%ebp)                                #3998.5
-..LN63:
-        movl      8(%ebx), %edx                                 #3999.34
-        movzbl    3(%edx), %edx                                 #3999.34
-        movzbl    %dl, %edx                                     #3999.34
-..LN65:
-        movzwl    expand_2na at GOTOFF(%eax,%edx,2), %edx          #3999.21
-..LN67:
-        movw      %dx, -34(%ebp)                                #3999.5
-..LN69:
-        movl      8(%ebx), %edx                                 #4000.34
-        movzbl    4(%edx), %edx                                 #4000.34
-        movzbl    %dl, %edx                                     #4000.34
-..LN71:
-        movzwl    expand_2na at GOTOFF(%eax,%edx,2), %edx          #4000.21
-..LN73:
-        movw      %dx, -32(%ebp)                                #4000.5
-..LN75:
-        movl      8(%ebx), %edx                                 #4001.34
-        movzbl    5(%edx), %edx                                 #4001.34
-        movzbl    %dl, %edx                                     #4001.34
-..LN77:
-        movzwl    expand_2na at GOTOFF(%eax,%edx,2), %edx          #4001.21
-..LN79:
-        movw      %dx, -30(%ebp)                                #4001.5
-..LN81:
-        movl      8(%ebx), %edx                                 #4002.34
-        movzbl    6(%edx), %edx                                 #4002.34
-        movzbl    %dl, %edx                                     #4002.34
-..LN83:
-        movzwl    expand_2na at GOTOFF(%eax,%edx,2), %edx          #4002.21
-..LN85:
-        movw      %dx, -28(%ebp)                                #4002.5
-..LN87:
-        movl      8(%ebx), %edx                                 #4003.34
-        movzbl    7(%edx), %edx                                 #4003.34
-        movzbl    %dl, %edx                                     #4003.34
-..LN89:
-        movzwl    expand_2na at GOTOFF(%eax,%edx,2), %eax          #4003.21
-..LN91:
-        movw      %ax, -26(%ebp)                                #4003.5
-..LN93:
-        movdqu    -40(%ebp), %xmm0                              #4005.51
-..LN95:
-        movdqa    %xmm0, -24(%ebp)                              #4005.5
-..LN97:
-        movdqa    -24(%ebp), %xmm0                              #4006.12
-        leave                                                   #4006.12
-..___tag_value_prime_buffer_4na.83:                             #
-        movl      %ebx, %esp                                    #4006.12
-        popl      %ebx                                          #4006.12
-..___tag_value_prime_buffer_4na.84:                             #
-        ret                                                     #4006.12
-        .align    2,0x90
-..___tag_value_prime_buffer_4na.86:                             #
-                                # LOE
-# mark_end;
-	.type	prime_buffer_4na, at function
-	.size	prime_buffer_4na,.-prime_buffer_4na
-.LNprime_buffer_4na:
-	.data
-# -- End  prime_buffer_4na
-	.section .rodata, "a"
-	.align 4
-	.align 4
-__$U0:
-	.byte	78
-	.byte	117
-	.byte	99
-	.byte	83
-	.byte	116
-	.byte	114
-	.byte	70
-	.byte	97
-	.byte	115
-	.byte	116
-	.byte	97
-	.byte	69
-	.byte	120
-	.byte	112
-	.byte	114
-	.byte	65
-	.byte	108
-	.byte	108
-	.byte	111
-	.byte	99
-	.byte	0
-	.type	__$U0, at object
-	.size	__$U0,21
-	.space 3	# pad
-_2__STRING.1:
-	.byte	110
-	.byte	117
-	.byte	99
-	.byte	115
-	.byte	116
-	.byte	114
-	.byte	115
-	.byte	116
-	.byte	114
-	.byte	46
-	.byte	99
-	.byte	0
-	.type	_2__STRING.1, at object
-	.size	_2__STRING.1,12
-_2__STRING.0:
-	.byte	40
-	.byte	32
-	.byte	40
-	.byte	32
-	.byte	115
-	.byte	105
-	.byte	122
-	.byte	101
-	.byte	95
-	.byte	116
-	.byte	32
-	.byte	41
-	.byte	32
-	.byte	38
-	.byte	32
-	.byte	101
-	.byte	32
-	.byte	45
-	.byte	62
-	.byte	32
-	.byte	113
-	.byte	117
-	.byte	101
-	.byte	114
-	.byte	121
-	.byte	32
-	.byte	91
-	.byte	32
-	.byte	48
-	.byte	32
-	.byte	93
-	.byte	32
-	.byte	46
-	.byte	32
-	.byte	112
-	.byte	97
-	.byte	116
-	.byte	116
-	.byte	101
-	.byte	114
-	.byte	110
-	.byte	32
-	.byte	38
-	.byte	32
-	.byte	49
-	.byte	53
-	.byte	32
-	.byte	41
-	.byte	32
-	.byte	61
-	.byte	61
-	.byte	32
-	.byte	48
-	.byte	0
-	.type	_2__STRING.0, at object
-	.size	_2__STRING.0,54
-	.space 2	# pad
-_2__STRING.2:
-	.byte	40
-	.byte	32
-	.byte	40
-	.byte	32
-	.byte	115
-	.byte	105
-	.byte	122
-	.byte	101
-	.byte	95
-	.byte	116
-	.byte	32
-	.byte	41
-	.byte	32
-	.byte	38
-	.byte	32
-	.byte	101
-	.byte	32
-	.byte	45
-	.byte	62
-	.byte	32
-	.byte	113
-	.byte	117
-	.byte	101
-	.byte	114
-	.byte	121
-	.byte	32
-	.byte	91
-	.byte	32
-	.byte	48
-	.byte	32
-	.byte	93
-	.byte	32
-	.byte	46
-	.byte	32
-	.byte	109
-	.byte	97
-	.byte	115
-	.byte	107
-	.byte	32
-	.byte	38
-	.byte	32
-	.byte	49
-	.byte	53
-	.byte	32
-	.byte	41
-	.byte	32
-	.byte	61
-	.byte	61
-	.byte	32
-	.byte	48
-	.byte	0
-	.type	_2__STRING.2, at object
-	.size	_2__STRING.2,51
-	.data
-	.text
-# -- Begin  NucStrFastaExprAlloc
-# mark_begin;
-       .align    2,0x90
-NucStrFastaExprAlloc:
-# parameter 1(sz): 8 + %ebp
-..B7.1:                         # Preds ..B7.0
-..___tag_value_NucStrFastaExprAlloc.89:                         #
-..LN99:
-        pushl     %ebp                                          #790.1
-        movl      %esp, %ebp                                    #790.1
-..___tag_value_NucStrFastaExprAlloc.94:                         #
-        subl      $24, %esp                                     #790.1
-        movl      %ebx, -4(%ebp)                                #790.1
-..___tag_value_NucStrFastaExprAlloc.97:                         #
-        call      ..L98         # Prob 100%                     #790.1
-..L98:                                                          #
-        popl      %eax                                          #790.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L98], %eax      #790.1
-        movl      %eax, -12(%ebp)                               #790.1
-..LN101:
-        addl      $0, %esp                                      #791.19
-..LN103:
-        movl      8(%ebp), %edx                                 #791.28
-..LN105:
-        addl      $16, %edx                                     #791.33
-        movl      %edx, (%esp)                                  #791.33
-..LN107:
-        movl      %eax, %ebx                                    #791.19
-        call      malloc at PLT                                    #791.19
-                                # LOE eax
-..B7.11:                        # Preds ..B7.1
-        popl      %ecx                                          #791.19
-        movl      %eax, -8(%ebp)                                #791.19
-                                # LOE
-..B7.2:                         # Preds ..B7.11
-..LN109:
-        movl      -8(%ebp), %eax                                #791.17
-        movl      %eax, -16(%ebp)                               #791.17
-..LN111:
-        movl      -16(%ebp), %eax                               #792.10
-..LN113:
-        testl     %eax, %eax                                    #792.19
-        je        ..B7.8        # Prob 50%                      #792.19
-                                # LOE
-..B7.3:                         # Preds ..B7.2
-..LN115:
-        movl      -16(%ebp), %eax                               #795.28
-..LN117:
-        addl      $15, %eax                                     #795.36
-..LN119:
-        andl      $-16, %eax                                    #795.43
-..LN121:
-        movl      %eax, -20(%ebp)                               #794.28
-..LN123:
-        movl      -20(%ebp), %eax                               #796.9
-..LN125:
-        movl      -16(%ebp), %edx                               #796.26
-..LN127:
-        movl      %edx, 8(%eax)                                 #796.9
-..LN129:
-        movl      -20(%ebp), %eax                               #797.9
-        testb     $15, %al                                      #797.9
-        je        ..B7.5        # Prob 50%                      #797.9
-..___tag_value_NucStrFastaExprAlloc.99:                         #
-                                # LOE
-..B7.4:                         # Preds ..B7.3
-        addl      $-16, %esp                                    #797.9
-        movl      -12(%ebp), %eax                               #797.9
-        lea       _2__STRING.0 at GOTOFF(%eax), %eax               #797.9
-        movl      %eax, (%esp)                                  #797.9
-        movl      -12(%ebp), %eax                               #797.9
-        lea       _2__STRING.1 at GOTOFF(%eax), %eax               #797.9
-        movl      %eax, 4(%esp)                                 #797.9
-        movl      $797, 8(%esp)                                 #797.9
-        movl      -12(%ebp), %eax                               #797.9
-        lea       __$U0 at GOTOFF(%eax), %eax                      #797.9
-        movl      %eax, 12(%esp)                                #797.9
-        movl      -12(%ebp), %eax                               #797.9
-        movl      %eax, %ebx                                    #797.9
-        call      __assert_fail at PLT                             #797.9
-                                # LOE
-..B7.12:                        # Preds ..B7.4
-        addl      $16, %esp                                     #797.9
-..___tag_value_NucStrFastaExprAlloc.100:                        #
-                                # LOE
-..B7.5:                         # Preds ..B7.3
-..LN131:
-        movl      -20(%ebp), %eax                               #798.9
-        testb     $15, %al                                      #798.9
-        je        ..B7.7        # Prob 50%                      #798.9
-..___tag_value_NucStrFastaExprAlloc.101:                        #
-                                # LOE
-..B7.6:                         # Preds ..B7.5
-        addl      $-16, %esp                                    #798.9
-        movl      -12(%ebp), %eax                               #798.9
-        lea       _2__STRING.2 at GOTOFF(%eax), %eax               #798.9
-        movl      %eax, (%esp)                                  #798.9
-        movl      -12(%ebp), %eax                               #798.9
-        lea       _2__STRING.1 at GOTOFF(%eax), %eax               #798.9
-        movl      %eax, 4(%esp)                                 #798.9
-        movl      $798, 8(%esp)                                 #798.9
-        movl      -12(%ebp), %eax                               #798.9
-        lea       __$U0 at GOTOFF(%eax), %eax                      #798.9
-        movl      %eax, 12(%esp)                                #798.9
-        movl      -12(%ebp), %eax                               #798.9
-        movl      %eax, %ebx                                    #798.9
-        call      __assert_fail at PLT                             #798.9
-                                # LOE
-..B7.13:                        # Preds ..B7.6
-        addl      $16, %esp                                     #798.9
-..___tag_value_NucStrFastaExprAlloc.102:                        #
-                                # LOE
-..B7.7:                         # Preds ..B7.5
-..LN133:
-        movl      -20(%ebp), %eax                               #799.16
-        movl      -4(%ebp), %ebx                                #799.16
-..___tag_value_NucStrFastaExprAlloc.103:                        #
-        leave                                                   #799.16
-..___tag_value_NucStrFastaExprAlloc.105:                        #
-        ret                                                     #799.16
-..___tag_value_NucStrFastaExprAlloc.106:                        #
-                                # LOE
-..B7.8:                         # Preds ..B7.2
-..LN135:
-        xorl      %eax, %eax                                    #801.12
-        movl      -4(%ebp), %ebx                                #801.12
-..___tag_value_NucStrFastaExprAlloc.108:                        #
-        leave                                                   #801.12
-..___tag_value_NucStrFastaExprAlloc.110:                        #
-        ret                                                     #801.12
-        .align    2,0x90
-..___tag_value_NucStrFastaExprAlloc.111:                        #
-                                # LOE
-# mark_end;
-	.type	NucStrFastaExprAlloc, at function
-	.size	NucStrFastaExprAlloc,.-NucStrFastaExprAlloc
-.LNNucStrFastaExprAlloc:
-	.data
-# -- End  NucStrFastaExprAlloc
-	.bss
-	.align 32
-	.align 32
-fasta_2na_map:
-	.type	fasta_2na_map, at object
-	.size	fasta_2na_map,128
-	.space 128	# pad
-	.data
-	.text
-# -- Begin  NucStrFastaExprMake2
-# mark_begin;
-       .align    2,0x90
-NucStrFastaExprMake2:
-# parameter 1(expr): 8 + %ebp
-# parameter 2(positional): 12 + %ebp
-# parameter 3(fasta): 16 + %ebp
-# parameter 4(size): 20 + %ebp
-..B8.1:                         # Preds ..B8.0
-..___tag_value_NucStrFastaExprMake2.114:                        #
-..LN137:
-        pushl     %ebp                                          #838.1
-        movl      %esp, %ebp                                    #838.1
-..___tag_value_NucStrFastaExprMake2.119:                        #
-        subl      $60, %esp                                     #838.1
-        movl      %ebx, -4(%ebp)                                #838.1
-..___tag_value_NucStrFastaExprMake2.122:                        #
-..LN139:
-        movl      20(%ebp), %eax                                #844.10
-..LN141:
-        cmpl      $61, %eax                                     #844.17
-        jbe       ..B8.3        # Prob 50%                      #844.17
-                                # LOE
-..B8.2:                         # Preds ..B8.1
-..LN143:
-        movl      $7, %eax                                      #845.16
-        movl      -4(%ebp), %ebx                                #845.16
-..___tag_value_NucStrFastaExprMake2.123:                        #
-        leave                                                   #845.16
-..___tag_value_NucStrFastaExprMake2.125:                        #
-        ret                                                     #845.16
-..___tag_value_NucStrFastaExprMake2.126:                        #
-                                # LOE
-..B8.3:                         # Preds ..B8.1
-..LN145:
-        pushl     %edi                                          #847.9
-..LN147:
-        movl      $144, (%esp)                                  #847.32
-..LN149:
-        call      NucStrFastaExprAlloc                          #847.9
-                                # LOE eax
-..B8.48:                        # Preds ..B8.3
-        popl      %ecx                                          #847.9
-        movl      %eax, -16(%ebp)                               #847.9
-                                # LOE
-..B8.4:                         # Preds ..B8.48
-        call      ..L128        # Prob 100%                     #
-..L128:                                                         #
-        popl      %eax                                          #
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L128], %eax     #
-        movl      %eax, -12(%ebp)                               #
-..LN151:
-        movl      -16(%ebp), %eax                               #847.5
-        movl      %eax, -20(%ebp)                               #847.5
-..LN153:
-        movl      -20(%ebp), %eax                               #848.10
-..LN155:
-        testl     %eax, %eax                                    #848.15
-        jne       ..B8.6        # Prob 50%                      #848.15
-                                # LOE
-..B8.5:                         # Preds ..B8.4
-..LN157:
-        movl      -12(%ebp), %eax                               #849.16
-        movl      %eax, %ebx                                    #849.16
-        call      __errno_location at PLT                          #849.16
-                                # LOE eax
-..B8.49:                        # Preds ..B8.5
-        movl      (%eax), %eax                                  #849.16
-        movl      -4(%ebp), %ebx                                #849.16
-..___tag_value_NucStrFastaExprMake2.129:                        #
-        leave                                                   #849.16
-..___tag_value_NucStrFastaExprMake2.131:                        #
-        ret                                                     #849.16
-..___tag_value_NucStrFastaExprMake2.132:                        #
-                                # LOE
-..B8.6:                         # Preds ..B8.4
-..LN159:
-        movl      8(%ebp), %eax                                 #851.5
-..LN161:
-        movl      -20(%ebp), %edx                               #851.14
-..LN163:
-        movl      %edx, (%eax)                                  #851.5
-..LN165:
-        movl      -20(%ebp), %eax                               #852.5
-..LN167:
-        movl      20(%ebp), %edx                                #852.25
-..LN169:
-        movl      %edx, 4(%eax)                                 #852.5
-..LN171:
-        movl      $0, -28(%ebp)                                 #856.11
-..LN173:
-        movl      -28(%ebp), %eax                               #856.18
-..LN175:
-        movl      20(%ebp), %edx                                #856.22
-        cmpl      %edx, %eax                                    #856.22
-        jb        ..B8.9        # Prob 50%                      #856.22
-        jmp       ..B8.17       # Prob 100%                     #856.22
-                                # LOE
-..B8.7:                         # Preds ..B8.13 ..B8.14 ..B8.15 ..B8.16 ..B8.12
-                                #      
-..LN177:
-        incl      -28(%ebp)                                     #856.31
-..LN179:
-        movl      -28(%ebp), %eax                               #856.18
-..LN181:
-        movl      20(%ebp), %edx                                #856.22
-        cmpl      %edx, %eax                                    #856.22
-        jae       ..B8.17       # Prob 50%                      #856.22
-                                # LOE
-..B8.9:                         # Preds ..B8.6 ..B8.7
-..LN183:
-        movl      16(%ebp), %eax                                #858.48
-..LN185:
-        movl      -28(%ebp), %edx                               #858.56
-..LN187:
-        movzbl    (%edx,%eax), %eax                             #858.48
-        movsbl    %al, %eax                                     #858.48
-..LN189:
-        movl      -12(%ebp), %edx                               #858.24
-        movzbl    fasta_2na_map at GOTOFF(%eax,%edx), %eax         #858.24
-..LN191:
-        movb      %al, -8(%ebp)                                 #858.22
-..LN193:
-        movl      -28(%ebp), %eax                               #859.18
-..LN195:
-        andl      $3, %eax                                      #859.22
-        movl      %eax, -24(%ebp)                               #859.22
-        je        ..B8.13       # Prob 50%                      #859.22
-                                # LOE
-..B8.10:                        # Preds ..B8.9
-        movl      -24(%ebp), %eax                               #859.22
-        cmpl      $1, %eax                                      #859.22
-        je        ..B8.14       # Prob 50%                      #859.22
-                                # LOE
-..B8.11:                        # Preds ..B8.10
-        movl      -24(%ebp), %eax                               #859.22
-        cmpl      $2, %eax                                      #859.22
-        je        ..B8.15       # Prob 50%                      #859.22
-                                # LOE
-..B8.12:                        # Preds ..B8.11
-        movl      -24(%ebp), %eax                               #859.22
-        cmpl      $3, %eax                                      #859.22
-        je        ..B8.16       # Prob 50%                      #859.22
-        jmp       ..B8.7        # Prob 100%                     #859.22
-                                # LOE
-..B8.13:                        # Preds ..B8.9
-..LN197:
-        movzbl    -8(%ebp), %eax                                #862.38
-..LN199:
-        shll      $6, %eax                                      #862.46
-..LN201:
-        movl      -28(%ebp), %edx                               #862.27
-..LN203:
-        shrl      $2, %edx                                      #862.32
-..LN205:
-        movb      %al, -60(%ebp,%edx)                           #862.13
-..LN207:
-        movl      -28(%ebp), %eax                               #863.24
-..LN209:
-        shrl      $2, %eax                                      #863.29
-..LN211:
-        movb      $192, -44(%ebp,%eax)                          #863.13
-        jmp       ..B8.7        # Prob 100%                     #863.13
-                                # LOE
-..B8.14:                        # Preds ..B8.10
-..LN213:
-        movl      -28(%ebp), %eax                               #866.27
-..LN215:
-        shrl      $2, %eax                                      #866.32
-..LN217:
-        movzbl    -60(%ebp,%eax), %eax                          #866.13
-..LN219:
-        movzbl    -8(%ebp), %edx                                #866.39
-..LN221:
-        shll      $4, %edx                                      #866.47
-..LN223:
-        orl       %edx, %eax                                    #866.13
-..LN225:
-        movl      -28(%ebp), %edx                               #866.27
-..LN227:
-        shrl      $2, %edx                                      #866.32
-..LN229:
-        movb      %al, -60(%ebp,%edx)                           #866.13
-..LN231:
-        movl      -28(%ebp), %eax                               #867.24
-..LN233:
-        shrl      $2, %eax                                      #867.29
-..LN235:
-        movzbl    -44(%ebp,%eax), %eax                          #867.13
-        orl       $48, %eax                                     #867.13
-..LN237:
-        movl      -28(%ebp), %edx                               #867.24
-..LN239:
-        shrl      $2, %edx                                      #867.29
-..LN241:
-        movb      %al, -44(%ebp,%edx)                           #867.13
-        jmp       ..B8.7        # Prob 100%                     #867.13
-                                # LOE
-..B8.15:                        # Preds ..B8.11
-..LN243:
-        movl      -28(%ebp), %eax                               #870.27
-..LN245:
-        shrl      $2, %eax                                      #870.32
-..LN247:
-        movzbl    -60(%ebp,%eax), %eax                          #870.13
-..LN249:
-        movzbl    -8(%ebp), %edx                                #870.39
-..LN251:
-        shll      $2, %edx                                      #870.47
-..LN253:
-        orl       %edx, %eax                                    #870.13
-..LN255:
-        movl      -28(%ebp), %edx                               #870.27
-..LN257:
-        shrl      $2, %edx                                      #870.32
-..LN259:
-        movb      %al, -60(%ebp,%edx)                           #870.13
-..LN261:
-        movl      -28(%ebp), %eax                               #871.24
-..LN263:
-        shrl      $2, %eax                                      #871.29
-..LN265:
-        movzbl    -44(%ebp,%eax), %eax                          #871.13
-        orl       $12, %eax                                     #871.13
-..LN267:
-        movl      -28(%ebp), %edx                               #871.24
-..LN269:
-        shrl      $2, %edx                                      #871.29
-..LN271:
-        movb      %al, -44(%ebp,%edx)                           #871.13
-        jmp       ..B8.7        # Prob 100%                     #871.13
-                                # LOE
-..B8.16:                        # Preds ..B8.12
-..LN273:
-        movl      -28(%ebp), %eax                               #874.27
-..LN275:
-        shrl      $2, %eax                                      #874.32
-..LN277:
-        movzbl    -60(%ebp,%eax), %eax                          #874.13
-..LN279:
-        movzbl    -8(%ebp), %edx                                #874.39
-..LN281:
-        orl       %edx, %eax                                    #874.13
-..LN283:
-        movl      -28(%ebp), %edx                               #874.27
-..LN285:
-        shrl      $2, %edx                                      #874.32
-..LN287:
-        movb      %al, -60(%ebp,%edx)                           #874.13
-..LN289:
-        movl      -28(%ebp), %eax                               #875.24
-..LN291:
-        shrl      $2, %eax                                      #875.29
-..LN293:
-        movzbl    -44(%ebp,%eax), %eax                          #875.13
-        orl       $3, %eax                                      #875.13
-..LN295:
-        movl      -28(%ebp), %edx                               #875.24
-..LN297:
-        shrl      $2, %edx                                      #875.29
-..LN299:
-        movb      %al, -44(%ebp,%edx)                           #875.13
-        jmp       ..B8.7        # Prob 100%                     #875.13
-                                # LOE
-..B8.17:                        # Preds ..B8.7 ..B8.6
-..LN301:
-        movl      -28(%ebp), %eax                               #881.17
-..LN303:
-        addl      $3, %eax                                      #881.21
-..LN305:
-        shrl      $2, %eax                                      #881.28
-..LN307:
-        movl      %eax, -28(%ebp)                               #881.11
-..LN309:
-        movl      -28(%ebp), %eax                               #881.31
-..LN311:
-        cmpl      $16, %eax                                     #881.35
-        jae       ..B8.20       # Prob 50%                      #881.35
-                                # LOE
-..B8.19:                        # Preds ..B8.17 ..B8.19
-..LN313:
-        movl      -28(%ebp), %eax                               #883.23
-..LN315:
-        xorl      %edx, %edx                                    #883.9
-        movb      %dl, -60(%ebp,%eax)                           #883.9
-..LN317:
-        movl      -28(%ebp), %eax                               #884.20
-..LN319:
-        movb      %dl, -44(%ebp,%eax)                           #884.9
-..LN321:
-        incl      -28(%ebp)                                     #881.42
-..LN323:
-        movl      -28(%ebp), %eax                               #881.31
-..LN325:
-        cmpl      $16, %eax                                     #881.35
-        jb        ..B8.19       # Prob 50%                      #881.35
-                                # LOE
-..B8.20:                        # Preds ..B8.19 ..B8.17
-..LN327:
-        movl      12(%ebp), %eax                                #890.10
-        testl     %eax, %eax                                    #890.10
-        je        ..B8.22       # Prob 50%                      #890.10
-                                # LOE
-..B8.21:                        # Preds ..B8.20
-..LN329:
-        movl      -20(%ebp), %eax                               #892.9
-        movl      $9, (%eax)                                    #892.9
-        jmp       ..B8.31       # Prob 100%                     #892.9
-                                # LOE
-..B8.22:                        # Preds ..B8.20
-..LN331:
-        movl      20(%ebp), %eax                                #896.15
-..LN333:
-        cmpl      $2, %eax                                      #896.22
-        jae       ..B8.24       # Prob 50%                      #896.22
-                                # LOE
-..B8.23:                        # Preds ..B8.22
-..LN335:
-        movzbl    -60(%ebp), %eax                               #898.29
-..LN337:
-        movb      %al, -59(%ebp)                                #898.9
-..LN339:
-        movzwl    -60(%ebp), %eax                               #899.29
-..LN341:
-        movw      %ax, -58(%ebp)                                #899.9
-..LN343:
-        movl      -60(%ebp), %eax                               #900.29
-..LN345:
-        movl      %eax, -56(%ebp)                               #900.9
-..LN347:
-        movl      -60(%ebp), %eax                               #901.29
-        movl      -56(%ebp), %edx                               #901.29
-..LN349:
-        movl      %eax, -52(%ebp)                               #901.9
-        movl      %edx, -48(%ebp)                               #901.9
-..LN351:
-        movzbl    -44(%ebp), %eax                               #903.26
-..LN353:
-        movb      %al, -43(%ebp)                                #903.9
-..LN355:
-        movzwl    -44(%ebp), %eax                               #904.26
-..LN357:
-        movw      %ax, -42(%ebp)                                #904.9
-..LN359:
-        movl      -44(%ebp), %eax                               #905.26
-..LN361:
-        movl      %eax, -40(%ebp)                               #905.9
-..LN363:
-        movl      -44(%ebp), %eax                               #906.26
-        movl      -40(%ebp), %edx                               #906.26
-..LN365:
-        movl      %eax, -36(%ebp)                               #906.9
-        movl      %edx, -32(%ebp)                               #906.9
-..LN367:
-        movl      -20(%ebp), %eax                               #908.9
-        movl      $2, (%eax)                                    #908.9
-        jmp       ..B8.31       # Prob 100%                     #908.9
-                                # LOE
-..B8.24:                        # Preds ..B8.22
-..LN369:
-        movl      20(%ebp), %eax                                #910.15
-..LN371:
-        cmpl      $6, %eax                                      #910.22
-        jae       ..B8.26       # Prob 50%                      #910.22
-                                # LOE
-..B8.25:                        # Preds ..B8.24
-..LN373:
-        movzwl    -60(%ebp), %eax                               #912.29
-..LN375:
-        movw      %ax, -58(%ebp)                                #912.9
-..LN377:
-        movl      -60(%ebp), %eax                               #913.29
-..LN379:
-        movl      %eax, -56(%ebp)                               #913.9
-..LN381:
-        movl      -60(%ebp), %eax                               #914.29
-        movl      -56(%ebp), %edx                               #914.29
-..LN383:
-        movl      %eax, -52(%ebp)                               #914.9
-        movl      %edx, -48(%ebp)                               #914.9
-..LN385:
-        movzwl    -44(%ebp), %eax                               #916.26
-..LN387:
-        movw      %ax, -42(%ebp)                                #916.9
-..LN389:
-        movl      -44(%ebp), %eax                               #917.26
-..LN391:
-        movl      %eax, -40(%ebp)                               #917.9
-..LN393:
-        movl      -44(%ebp), %eax                               #918.26
-        movl      -40(%ebp), %edx                               #918.26
-..LN395:
-        movl      %eax, -36(%ebp)                               #918.9
-        movl      %edx, -32(%ebp)                               #918.9
-..LN397:
-        movl      -20(%ebp), %eax                               #920.9
-        movl      $3, (%eax)                                    #920.9
-        jmp       ..B8.31       # Prob 100%                     #920.9
-                                # LOE
-..B8.26:                        # Preds ..B8.24
-..LN399:
-        movl      20(%ebp), %eax                                #922.15
-..LN401:
-        cmpl      $14, %eax                                     #922.22
-        jae       ..B8.28       # Prob 50%                      #922.22
-                                # LOE
-..B8.27:                        # Preds ..B8.26
-..LN403:
-        movl      -60(%ebp), %eax                               #924.29
-..LN405:
-        movl      %eax, -56(%ebp)                               #924.9
-..LN407:
-        movl      -60(%ebp), %eax                               #925.29
-        movl      -56(%ebp), %edx                               #925.29
-..LN409:
-        movl      %eax, -52(%ebp)                               #925.9
-        movl      %edx, -48(%ebp)                               #925.9
-..LN411:
-        movl      -44(%ebp), %eax                               #927.26
-..LN413:
-        movl      %eax, -40(%ebp)                               #927.9
-..LN415:
-        movl      -44(%ebp), %eax                               #928.26
-        movl      -40(%ebp), %edx                               #928.26
-..LN417:
-        movl      %eax, -36(%ebp)                               #928.9
-        movl      %edx, -32(%ebp)                               #928.9
-..LN419:
-        movl      -20(%ebp), %eax                               #930.9
-        movl      $4, (%eax)                                    #930.9
-        jmp       ..B8.31       # Prob 100%                     #930.9
-                                # LOE
-..B8.28:                        # Preds ..B8.26
-..LN421:
-        movl      20(%ebp), %eax                                #932.15
-..LN423:
-        cmpl      $30, %eax                                     #932.22
-        jae       ..B8.30       # Prob 50%                      #932.22
-                                # LOE
-..B8.29:                        # Preds ..B8.28
-..LN425:
-        movl      -60(%ebp), %eax                               #934.29
-        movl      -56(%ebp), %edx                               #934.29
-..LN427:
-        movl      %eax, -52(%ebp)                               #934.9
-        movl      %edx, -48(%ebp)                               #934.9
-..LN429:
-        movl      -44(%ebp), %eax                               #935.26
-        movl      -40(%ebp), %edx                               #935.26
-..LN431:
-        movl      %eax, -36(%ebp)                               #935.9
-        movl      %edx, -32(%ebp)                               #935.9
-..LN433:
-        movl      -20(%ebp), %eax                               #937.9
-        movl      $0, (%eax)                                    #937.9
-        jmp       ..B8.31       # Prob 100%                     #937.9
-                                # LOE
-..B8.30:                        # Preds ..B8.28
-..LN435:
-        movl      -20(%ebp), %eax                               #941.9
-        movl      $5, (%eax)                                    #941.9
-                                # LOE
-..B8.31:                        # Preds ..B8.21 ..B8.23 ..B8.25 ..B8.27 ..B8.29
-                                #       ..B8.30
-..LN437:
-        movl      -20(%ebp), %eax                               #944.5
-..LN439:
-        movl      -60(%ebp), %edx                               #944.42
-        movl      %edx, 16(%eax)                                #944.42
-        movl      -56(%ebp), %edx                               #944.42
-        movl      %edx, 20(%eax)                                #944.42
-        movl      -52(%ebp), %edx                               #944.42
-        movl      %edx, 24(%eax)                                #944.42
-        movl      -48(%ebp), %edx                               #944.42
-        movl      %edx, 28(%eax)                                #944.42
-..LN441:
-        movl      -20(%ebp), %eax                               #945.5
-..LN443:
-        movl      -44(%ebp), %edx                               #945.39
-        movl      %edx, 32(%eax)                                #945.39
-        movl      -40(%ebp), %edx                               #945.39
-        movl      %edx, 36(%eax)                                #945.39
-        movl      -36(%ebp), %edx                               #945.39
-        movl      %edx, 40(%eax)                                #945.39
-        movl      -32(%ebp), %edx                               #945.39
-        movl      %edx, 44(%eax)                                #945.39
-..LN445:
-        pushl     %edi                                          #948.5
-..LN447:
-        lea       -60(%ebp), %eax                               #948.23
-        movl      %eax, (%esp)                                  #948.23
-..LN449:
-        call      uint128_bswap                                 #948.5
-                                # LOE
-..B8.50:                        # Preds ..B8.31
-        popl      %ecx                                          #948.5
-                                # LOE
-..B8.32:                        # Preds ..B8.50
-..LN451:
-        pushl     %edi                                          #949.5
-..LN453:
-        lea       -44(%ebp), %eax                               #949.23
-        movl      %eax, (%esp)                                  #949.23
-..LN455:
-        call      uint128_bswap                                 #949.5
-                                # LOE
-..B8.51:                        # Preds ..B8.32
-        popl      %ecx                                          #949.5
-                                # LOE
-..B8.33:                        # Preds ..B8.51
-..LN457:
-        addl      $-8, %esp                                     #952.5
-..LN459:
-        lea       -60(%ebp), %eax                               #952.21
-        movl      %eax, (%esp)                                  #952.21
-..LN461:
-        movl      $2, 4(%esp)                                   #952.34
-..LN463:
-        call      uint128_shr                                   #952.5
-                                # LOE
-..B8.52:                        # Preds ..B8.33
-        addl      $8, %esp                                      #952.5
-                                # LOE
-..B8.34:                        # Preds ..B8.52
-..LN465:
-        addl      $-8, %esp                                     #953.5
-..LN467:
-        lea       -44(%ebp), %eax                               #953.21
-        movl      %eax, (%esp)                                  #953.21
-..LN469:
-        movl      $2, 4(%esp)                                   #953.31
-..LN471:
-        call      uint128_shr                                   #953.5
-                                # LOE
-..B8.53:                        # Preds ..B8.34
-        addl      $8, %esp                                      #953.5
-                                # LOE
-..B8.35:                        # Preds ..B8.53
-..LN473:
-        addl      $-8, %esp                                     #956.5
-..LN475:
-        movl      -20(%ebp), %eax                               #956.28
-..LN477:
-        addl      $48, %eax                                     #956.5
-        movl      %eax, (%esp)                                  #956.5
-..LN479:
-        lea       -60(%ebp), %eax                               #956.70
-        movl      %eax, 4(%esp)                                 #956.70
-..LN481:
-        call      uint128_bswap_copy                            #956.5
-                                # LOE
-..B8.54:                        # Preds ..B8.35
-        addl      $8, %esp                                      #956.5
-                                # LOE
-..B8.36:                        # Preds ..B8.54
-..LN483:
-        addl      $-8, %esp                                     #957.5
-..LN485:
-        movl      -20(%ebp), %eax                               #957.28
-..LN487:
-        addl      $64, %eax                                     #957.5
-        movl      %eax, (%esp)                                  #957.5
-..LN489:
-        lea       -44(%ebp), %eax                               #957.67
-        movl      %eax, 4(%esp)                                 #957.67
-..LN491:
-        call      uint128_bswap_copy                            #957.5
-                                # LOE
-..B8.55:                        # Preds ..B8.36
-        addl      $8, %esp                                      #957.5
-                                # LOE
-..B8.37:                        # Preds ..B8.55
-..LN493:
-        addl      $-8, %esp                                     #959.5
-..LN495:
-        lea       -60(%ebp), %eax                               #959.21
-        movl      %eax, (%esp)                                  #959.21
-..LN497:
-        movl      $2, 4(%esp)                                   #959.34
-..LN499:
-        call      uint128_shr                                   #959.5
-                                # LOE
-..B8.56:                        # Preds ..B8.37
-        addl      $8, %esp                                      #959.5
-                                # LOE
-..B8.38:                        # Preds ..B8.56
-..LN501:
-        addl      $-8, %esp                                     #960.5
-..LN503:
-        lea       -44(%ebp), %eax                               #960.21
-        movl      %eax, (%esp)                                  #960.21
-..LN505:
-        movl      $2, 4(%esp)                                   #960.31
-..LN507:
-        call      uint128_shr                                   #960.5
-                                # LOE
-..B8.57:                        # Preds ..B8.38
-        addl      $8, %esp                                      #960.5
-                                # LOE
-..B8.39:                        # Preds ..B8.57
-..LN509:
-        addl      $-8, %esp                                     #962.5
-..LN511:
-        movl      -20(%ebp), %eax                               #962.28
-..LN513:
-        addl      $80, %eax                                     #962.5
-        movl      %eax, (%esp)                                  #962.5
-..LN515:
-        lea       -60(%ebp), %eax                               #962.70
-        movl      %eax, 4(%esp)                                 #962.70
-..LN517:
-        call      uint128_bswap_copy                            #962.5
-                                # LOE
-..B8.58:                        # Preds ..B8.39
-        addl      $8, %esp                                      #962.5
-                                # LOE
-..B8.40:                        # Preds ..B8.58
-..LN519:
-        addl      $-8, %esp                                     #963.5
-..LN521:
-        movl      -20(%ebp), %eax                               #963.28
-..LN523:
-        addl      $96, %eax                                     #963.5
-        movl      %eax, (%esp)                                  #963.5
-..LN525:
-        lea       -44(%ebp), %eax                               #963.67
-        movl      %eax, 4(%esp)                                 #963.67
-..LN527:
-        call      uint128_bswap_copy                            #963.5
-                                # LOE
-..B8.59:                        # Preds ..B8.40
-        addl      $8, %esp                                      #963.5
-                                # LOE
-..B8.41:                        # Preds ..B8.59
-..LN529:
-        addl      $-8, %esp                                     #965.5
-..LN531:
-        lea       -60(%ebp), %eax                               #965.21
-        movl      %eax, (%esp)                                  #965.21
-..LN533:
-        movl      $2, 4(%esp)                                   #965.34
-..LN535:
-        call      uint128_shr                                   #965.5
-                                # LOE
-..B8.60:                        # Preds ..B8.41
-        addl      $8, %esp                                      #965.5
-                                # LOE
-..B8.42:                        # Preds ..B8.60
-..LN537:
-        addl      $-8, %esp                                     #966.5
-..LN539:
-        lea       -44(%ebp), %eax                               #966.21
-        movl      %eax, (%esp)                                  #966.21
-..LN541:
-        movl      $2, 4(%esp)                                   #966.31
-..LN543:
-        call      uint128_shr                                   #966.5
-                                # LOE
-..B8.61:                        # Preds ..B8.42
-        addl      $8, %esp                                      #966.5
-                                # LOE
-..B8.43:                        # Preds ..B8.61
-..LN545:
-        addl      $-8, %esp                                     #968.5
-..LN547:
-        movl      -20(%ebp), %eax                               #968.28
-..LN549:
-        addl      $112, %eax                                    #968.5
-        movl      %eax, (%esp)                                  #968.5
-..LN551:
-        lea       -60(%ebp), %eax                               #968.70
-        movl      %eax, 4(%esp)                                 #968.70
-..LN553:
-        call      uint128_bswap_copy                            #968.5
-                                # LOE
-..B8.62:                        # Preds ..B8.43
-        addl      $8, %esp                                      #968.5
-                                # LOE
-..B8.44:                        # Preds ..B8.62
-..LN555:
-        addl      $-8, %esp                                     #969.5
-..LN557:
-        movl      -20(%ebp), %eax                               #969.28
-..LN559:
-        addl      $128, %eax                                    #969.5
-        movl      %eax, (%esp)                                  #969.5
-..LN561:
-        lea       -44(%ebp), %eax                               #969.67
-        movl      %eax, 4(%esp)                                 #969.67
-..LN563:
-        call      uint128_bswap_copy                            #969.5
-                                # LOE
-..B8.63:                        # Preds ..B8.44
-        addl      $8, %esp                                      #969.5
-                                # LOE
-..B8.45:                        # Preds ..B8.63
-..LN565:
-        xorl      %eax, %eax                                    #1011.12
-        movl      -4(%ebp), %ebx                                #1011.12
-..___tag_value_NucStrFastaExprMake2.134:                        #
-        leave                                                   #1011.12
-..___tag_value_NucStrFastaExprMake2.136:                        #
-        ret                                                     #1011.12
-        .align    2,0x90
-..___tag_value_NucStrFastaExprMake2.137:                        #
-                                # LOE
-# mark_end;
-	.type	NucStrFastaExprMake2, at function
-	.size	NucStrFastaExprMake2,.-NucStrFastaExprMake2
-.LNNucStrFastaExprMake2:
-	.data
-# -- End  NucStrFastaExprMake2
-	.bss
-	.align 32
-fasta_4na_map:
-	.type	fasta_4na_map, at object
-	.size	fasta_4na_map,128
-	.space 128	# pad
-	.data
-	.text
-# -- Begin  NucStrFastaExprMake4
-# mark_begin;
-       .align    2,0x90
-NucStrFastaExprMake4:
-# parameter 1(expr): 8 + %ebp
-# parameter 2(positional): 12 + %ebp
-# parameter 3(fasta): 16 + %ebp
-# parameter 4(size): 20 + %ebp
-..B9.1:                         # Preds ..B9.0
-..___tag_value_NucStrFastaExprMake4.140:                        #
-..LN567:
-        pushl     %ebp                                          #1017.1
-        movl      %esp, %ebp                                    #1017.1
-..___tag_value_NucStrFastaExprMake4.145:                        #
-        subl      $60, %esp                                     #1017.1
-        movl      %ebx, -4(%ebp)                                #1017.1
-..___tag_value_NucStrFastaExprMake4.148:                        #
-..LN569:
-        movl      20(%ebp), %eax                                #1023.10
-..LN571:
-        cmpl      $29, %eax                                     #1023.17
-        jbe       ..B9.3        # Prob 50%                      #1023.17
-                                # LOE
-..B9.2:                         # Preds ..B9.1
-..LN573:
-        movl      $7, %eax                                      #1024.16
-        movl      -4(%ebp), %ebx                                #1024.16
-..___tag_value_NucStrFastaExprMake4.149:                        #
-        leave                                                   #1024.16
-..___tag_value_NucStrFastaExprMake4.151:                        #
-        ret                                                     #1024.16
-..___tag_value_NucStrFastaExprMake4.152:                        #
-                                # LOE
-..B9.3:                         # Preds ..B9.1
-..LN575:
-        pushl     %edi                                          #1026.9
-..LN577:
-        movl      $144, (%esp)                                  #1026.32
-..LN579:
-        call      NucStrFastaExprAlloc                          #1026.9
-                                # LOE eax
-..B9.46:                        # Preds ..B9.3
-        popl      %ecx                                          #1026.9
-        movl      %eax, -12(%ebp)                               #1026.9
-                                # LOE
-..B9.4:                         # Preds ..B9.46
-        call      ..L154        # Prob 100%                     #
-..L154:                                                         #
-        popl      %eax                                          #
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L154], %eax     #
-        movl      %eax, -8(%ebp)                                #
-..LN581:
-        movl      -12(%ebp), %eax                               #1026.5
-        movl      %eax, -16(%ebp)                               #1026.5
-..LN583:
-        movl      -16(%ebp), %eax                               #1027.10
-..LN585:
-        testl     %eax, %eax                                    #1027.15
-        jne       ..B9.6        # Prob 50%                      #1027.15
-                                # LOE
-..B9.5:                         # Preds ..B9.4
-..LN587:
-        movl      -8(%ebp), %eax                                #1028.16
-        movl      %eax, %ebx                                    #1028.16
-        call      __errno_location at PLT                          #1028.16
-                                # LOE eax
-..B9.47:                        # Preds ..B9.5
-        movl      (%eax), %eax                                  #1028.16
-        movl      -4(%ebp), %ebx                                #1028.16
-..___tag_value_NucStrFastaExprMake4.155:                        #
-        leave                                                   #1028.16
-..___tag_value_NucStrFastaExprMake4.157:                        #
-        ret                                                     #1028.16
-..___tag_value_NucStrFastaExprMake4.158:                        #
-                                # LOE
-..B9.6:                         # Preds ..B9.4
-..LN589:
-        movl      8(%ebp), %eax                                 #1030.5
-..LN591:
-        movl      -16(%ebp), %edx                               #1030.14
-..LN593:
-        movl      %edx, (%eax)                                  #1030.5
-..LN595:
-        movl      -16(%ebp), %eax                               #1031.5
-..LN597:
-        movl      20(%ebp), %edx                                #1031.25
-..LN599:
-        movl      %edx, 4(%eax)                                 #1031.5
-..LN601:
-        movl      $0, -28(%ebp)                                 #1035.11
-..LN603:
-        movl      -28(%ebp), %eax                               #1035.18
-..LN605:
-        movl      20(%ebp), %edx                                #1035.22
-        cmpl      %edx, %eax                                    #1035.22
-        jb        ..B9.9        # Prob 50%                      #1035.22
-        jmp       ..B9.17       # Prob 100%                     #1035.22
-                                # LOE
-..B9.7:                         # Preds ..B9.13 ..B9.14 ..B9.15 ..B9.16 ..B9.12
-                                #      
-..LN607:
-        incl      -28(%ebp)                                     #1035.31
-..LN609:
-        movl      -28(%ebp), %eax                               #1035.18
-..LN611:
-        movl      20(%ebp), %edx                                #1035.22
-        cmpl      %edx, %eax                                    #1035.22
-        jae       ..B9.17       # Prob 50%                      #1035.22
-                                # LOE
-..B9.9:                         # Preds ..B9.6 ..B9.7
-..LN613:
-        movl      16(%ebp), %eax                                #1037.49
-..LN615:
-        movl      -28(%ebp), %edx                               #1037.57
-..LN617:
-        movzbl    (%edx,%eax), %eax                             #1037.49
-        movsbl    %al, %eax                                     #1037.49
-..LN619:
-        movl      -8(%ebp), %edx                                #1037.25
-        movzbl    fasta_4na_map at GOTOFF(%eax,%edx), %eax         #1037.25
-        movsbl    %al, %eax                                     #1037.25
-..LN621:
-        movw      %ax, -20(%ebp)                                #1037.23
-..LN623:
-        movl      -28(%ebp), %eax                               #1038.18
-..LN625:
-        andl      $3, %eax                                      #1038.22
-        movl      %eax, -24(%ebp)                               #1038.22
-        je        ..B9.13       # Prob 50%                      #1038.22
-                                # LOE
-..B9.10:                        # Preds ..B9.9
-        movl      -24(%ebp), %eax                               #1038.22
-        cmpl      $1, %eax                                      #1038.22
-        je        ..B9.14       # Prob 50%                      #1038.22
-                                # LOE
-..B9.11:                        # Preds ..B9.10
-        movl      -24(%ebp), %eax                               #1038.22
-        cmpl      $2, %eax                                      #1038.22
-        je        ..B9.15       # Prob 50%                      #1038.22
-                                # LOE
-..B9.12:                        # Preds ..B9.11
-        movl      -24(%ebp), %eax                               #1038.22
-        cmpl      $3, %eax                                      #1038.22
-        je        ..B9.16       # Prob 50%                      #1038.22
-        jmp       ..B9.7        # Prob 100%                     #1038.22
-                                # LOE
-..B9.13:                        # Preds ..B9.9
-..LN627:
-        movzwl    -20(%ebp), %eax                               #1041.38
-..LN629:
-        shll      $4, %eax                                      #1041.46
-..LN631:
-        movl      -28(%ebp), %edx                               #1041.27
-..LN633:
-        shrl      $2, %edx                                      #1041.32
-..LN635:
-        movw      %ax, -60(%ebp,%edx,2)                         #1041.13
-..LN637:
-        movl      -28(%ebp), %eax                               #1042.24
-..LN639:
-        shrl      $2, %eax                                      #1042.29
-..LN641:
-        movw      $240, -44(%ebp,%eax,2)                        #1042.13
-        jmp       ..B9.7        # Prob 100%                     #1042.13
-                                # LOE
-..B9.14:                        # Preds ..B9.10
-..LN643:
-        movl      -28(%ebp), %eax                               #1045.27
-..LN645:
-        shrl      $2, %eax                                      #1045.32
-..LN647:
-        movzwl    -60(%ebp,%eax,2), %eax                        #1045.13
-..LN649:
-        movzwl    -20(%ebp), %edx                               #1045.39
-..LN651:
-        orl       %edx, %eax                                    #1045.13
-..LN653:
-        movl      -28(%ebp), %edx                               #1045.27
-..LN655:
-        shrl      $2, %edx                                      #1045.32
-..LN657:
-        movw      %ax, -60(%ebp,%edx,2)                         #1045.13
-..LN659:
-        movl      -28(%ebp), %eax                               #1046.24
-..LN661:
-        shrl      $2, %eax                                      #1046.29
-..LN663:
-        movzwl    -44(%ebp,%eax,2), %eax                        #1046.13
-        orl       $15, %eax                                     #1046.13
-..LN665:
-        movl      -28(%ebp), %edx                               #1046.24
-..LN667:
-        shrl      $2, %edx                                      #1046.29
-..LN669:
-        movw      %ax, -44(%ebp,%edx,2)                         #1046.13
-        jmp       ..B9.7        # Prob 100%                     #1046.13
-                                # LOE
-..B9.15:                        # Preds ..B9.11
-..LN671:
-        movl      -28(%ebp), %eax                               #1049.27
-..LN673:
-        shrl      $2, %eax                                      #1049.32
-..LN675:
-        movzwl    -60(%ebp,%eax,2), %eax                        #1049.13
-..LN677:
-        movzwl    -20(%ebp), %edx                               #1049.39
-..LN679:
-        shll      $12, %edx                                     #1049.47
-..LN681:
-        orl       %edx, %eax                                    #1049.13
-..LN683:
-        movl      -28(%ebp), %edx                               #1049.27
-..LN685:
-        shrl      $2, %edx                                      #1049.32
-..LN687:
-        movw      %ax, -60(%ebp,%edx,2)                         #1049.13
-..LN689:
-        movl      -28(%ebp), %eax                               #1050.24
-..LN691:
-        shrl      $2, %eax                                      #1050.29
-..LN693:
-        movzwl    -44(%ebp,%eax,2), %eax                        #1050.13
-        orl       $-4096, %eax                                  #1050.13
-..LN695:
-        movl      -28(%ebp), %edx                               #1050.24
-..LN697:
-        shrl      $2, %edx                                      #1050.29
-..LN699:
-        movw      %ax, -44(%ebp,%edx,2)                         #1050.13
-        jmp       ..B9.7        # Prob 100%                     #1050.13
-                                # LOE
-..B9.16:                        # Preds ..B9.12
-..LN701:
-        movl      -28(%ebp), %eax                               #1053.27
-..LN703:
-        shrl      $2, %eax                                      #1053.32
-..LN705:
-        movzwl    -60(%ebp,%eax,2), %eax                        #1053.13
-..LN707:
-        movzwl    -20(%ebp), %edx                               #1053.39
-..LN709:
-        shll      $8, %edx                                      #1053.47
-..LN711:
-        orl       %edx, %eax                                    #1053.13
-..LN713:
-        movl      -28(%ebp), %edx                               #1053.27
-..LN715:
-        shrl      $2, %edx                                      #1053.32
-..LN717:
-        movw      %ax, -60(%ebp,%edx,2)                         #1053.13
-..LN719:
-        movl      -28(%ebp), %eax                               #1054.24
-..LN721:
-        shrl      $2, %eax                                      #1054.29
-..LN723:
-        movzwl    -44(%ebp,%eax,2), %eax                        #1054.13
-        orl       $-61696, %eax                                 #1054.13
-..LN725:
-        movl      -28(%ebp), %edx                               #1054.24
-..LN727:
-        shrl      $2, %edx                                      #1054.29
-..LN729:
-        movw      %ax, -44(%ebp,%edx,2)                         #1054.13
-        jmp       ..B9.7        # Prob 100%                     #1054.13
-                                # LOE
-..B9.17:                        # Preds ..B9.7 ..B9.6
-..LN731:
-        movl      -28(%ebp), %eax                               #1060.17
-..LN733:
-        addl      $3, %eax                                      #1060.21
-..LN735:
-        shrl      $2, %eax                                      #1060.28
-..LN737:
-        movl      %eax, -28(%ebp)                               #1060.11
-..LN739:
-        movl      -28(%ebp), %eax                               #1060.31
-..LN741:
-        cmpl      $8, %eax                                      #1060.35
-        jae       ..B9.20       # Prob 50%                      #1060.35
-                                # LOE
-..B9.19:                        # Preds ..B9.17 ..B9.19
-..LN743:
-        movl      -28(%ebp), %eax                               #1062.23
-..LN745:
-        xorl      %edx, %edx                                    #1062.9
-        movw      %dx, -60(%ebp,%eax,2)                         #1062.9
-..LN747:
-        movl      -28(%ebp), %eax                               #1063.20
-..LN749:
-        movw      %dx, -44(%ebp,%eax,2)                         #1063.9
-..LN751:
-        incl      -28(%ebp)                                     #1060.41
-..LN753:
-        movl      -28(%ebp), %eax                               #1060.31
-..LN755:
-        cmpl      $8, %eax                                      #1060.35
-        jb        ..B9.19       # Prob 50%                      #1060.35
-                                # LOE
-..B9.20:                        # Preds ..B9.19 ..B9.17
-..LN757:
-        movl      12(%ebp), %eax                                #1068.10
-        testl     %eax, %eax                                    #1068.10
-        je        ..B9.22       # Prob 50%                      #1068.10
-                                # LOE
-..B9.21:                        # Preds ..B9.20
-..LN759:
-        movl      -16(%ebp), %eax                               #1070.9
-        movl      $10, (%eax)                                   #1070.9
-        jmp       ..B9.29       # Prob 100%                     #1070.9
-                                # LOE
-..B9.22:                        # Preds ..B9.20
-..LN761:
-        movl      20(%ebp), %eax                                #1072.15
-..LN763:
-        cmpl      $2, %eax                                      #1072.22
-        jae       ..B9.24       # Prob 50%                      #1072.22
-                                # LOE
-..B9.23:                        # Preds ..B9.22
-..LN765:
-        movzwl    -60(%ebp), %eax                               #1074.29
-..LN767:
-        movw      %ax, -58(%ebp)                                #1074.9
-..LN769:
-        movl      -60(%ebp), %eax                               #1075.29
-..LN771:
-        movl      %eax, -56(%ebp)                               #1075.9
-..LN773:
-        movl      -60(%ebp), %eax                               #1076.29
-        movl      -56(%ebp), %edx                               #1076.29
-..LN775:
-        movl      %eax, -52(%ebp)                               #1076.9
-        movl      %edx, -48(%ebp)                               #1076.9
-..LN777:
-        movzwl    -44(%ebp), %eax                               #1078.26
-..LN779:
-        movw      %ax, -42(%ebp)                                #1078.9
-..LN781:
-        movl      -44(%ebp), %eax                               #1079.26
-..LN783:
-        movl      %eax, -40(%ebp)                               #1079.9
-..LN785:
-        movl      -44(%ebp), %eax                               #1080.26
-        movl      -40(%ebp), %edx                               #1080.26
-..LN787:
-        movl      %eax, -36(%ebp)                               #1080.9
-        movl      %edx, -32(%ebp)                               #1080.9
-..LN789:
-        movl      -16(%ebp), %eax                               #1082.9
-        movl      $6, (%eax)                                    #1082.9
-        jmp       ..B9.29       # Prob 100%                     #1082.9
-                                # LOE
-..B9.24:                        # Preds ..B9.22
-..LN791:
-        movl      20(%ebp), %eax                                #1084.15
-..LN793:
-        cmpl      $6, %eax                                      #1084.22
-        jae       ..B9.26       # Prob 50%                      #1084.22
-                                # LOE
-..B9.25:                        # Preds ..B9.24
-..LN795:
-        movl      -60(%ebp), %eax                               #1086.29
-..LN797:
-        movl      %eax, -56(%ebp)                               #1086.9
-..LN799:
-        movl      -60(%ebp), %eax                               #1087.29
-        movl      -56(%ebp), %edx                               #1087.29
-..LN801:
-        movl      %eax, -52(%ebp)                               #1087.9
-        movl      %edx, -48(%ebp)                               #1087.9
-..LN803:
-        movl      -44(%ebp), %eax                               #1089.26
-..LN805:
-        movl      %eax, -40(%ebp)                               #1089.9
-..LN807:
-        movl      -44(%ebp), %eax                               #1090.26
-        movl      -40(%ebp), %edx                               #1090.26
-..LN809:
-        movl      %eax, -36(%ebp)                               #1090.9
-        movl      %edx, -32(%ebp)                               #1090.9
-..LN811:
-        movl      -16(%ebp), %eax                               #1092.9
-        movl      $7, (%eax)                                    #1092.9
-        jmp       ..B9.29       # Prob 100%                     #1092.9
-                                # LOE
-..B9.26:                        # Preds ..B9.24
-..LN813:
-        movl      20(%ebp), %eax                                #1094.15
-..LN815:
-        cmpl      $14, %eax                                     #1094.22
-        jae       ..B9.28       # Prob 50%                      #1094.22
-                                # LOE
-..B9.27:                        # Preds ..B9.26
-..LN817:
-        movl      -60(%ebp), %eax                               #1096.29
-        movl      -56(%ebp), %edx                               #1096.29
-..LN819:
-        movl      %eax, -52(%ebp)                               #1096.9
-        movl      %edx, -48(%ebp)                               #1096.9
-..LN821:
-        movl      -44(%ebp), %eax                               #1097.26
-        movl      -40(%ebp), %edx                               #1097.26
-..LN823:
-        movl      %eax, -36(%ebp)                               #1097.9
-        movl      %edx, -32(%ebp)                               #1097.9
-..LN825:
-        movl      -16(%ebp), %eax                               #1099.9
-        movl      $1, (%eax)                                    #1099.9
-        jmp       ..B9.29       # Prob 100%                     #1099.9
-                                # LOE
-..B9.28:                        # Preds ..B9.26
-..LN827:
-        movl      -16(%ebp), %eax                               #1103.9
-        movl      $8, (%eax)                                    #1103.9
-                                # LOE
-..B9.29:                        # Preds ..B9.21 ..B9.23 ..B9.25 ..B9.27 ..B9.28
-                                #      
-..LN829:
-        movl      -16(%ebp), %eax                               #1106.5
-..LN831:
-        movl      -60(%ebp), %edx                               #1106.42
-        movl      %edx, 16(%eax)                                #1106.42
-        movl      -56(%ebp), %edx                               #1106.42
-        movl      %edx, 20(%eax)                                #1106.42
-        movl      -52(%ebp), %edx                               #1106.42
-        movl      %edx, 24(%eax)                                #1106.42
-        movl      -48(%ebp), %edx                               #1106.42
-        movl      %edx, 28(%eax)                                #1106.42
-..LN833:
-        movl      -16(%ebp), %eax                               #1107.5
-..LN835:
-        movl      -44(%ebp), %edx                               #1107.39
-        movl      %edx, 32(%eax)                                #1107.39
-        movl      -40(%ebp), %edx                               #1107.39
-        movl      %edx, 36(%eax)                                #1107.39
-        movl      -36(%ebp), %edx                               #1107.39
-        movl      %edx, 40(%eax)                                #1107.39
-        movl      -32(%ebp), %edx                               #1107.39
-        movl      %edx, 44(%eax)                                #1107.39
-..LN837:
-        pushl     %edi                                          #1110.5
-..LN839:
-        lea       -60(%ebp), %eax                               #1110.23
-        movl      %eax, (%esp)                                  #1110.23
-..LN841:
-        call      uint128_bswap                                 #1110.5
-                                # LOE
-..B9.48:                        # Preds ..B9.29
-        popl      %ecx                                          #1110.5
-                                # LOE
-..B9.30:                        # Preds ..B9.48
-..LN843:
-        pushl     %edi                                          #1111.5
-..LN845:
-        lea       -44(%ebp), %eax                               #1111.23
-        movl      %eax, (%esp)                                  #1111.23
-..LN847:
-        call      uint128_bswap                                 #1111.5
-                                # LOE
-..B9.49:                        # Preds ..B9.30
-        popl      %ecx                                          #1111.5
-                                # LOE
-..B9.31:                        # Preds ..B9.49
-..LN849:
-        addl      $-8, %esp                                     #1114.5
-..LN851:
-        lea       -60(%ebp), %eax                               #1114.21
-        movl      %eax, (%esp)                                  #1114.21
-..LN853:
-        movl      $4, 4(%esp)                                   #1114.34
-..LN855:
-        call      uint128_shr                                   #1114.5
-                                # LOE
-..B9.50:                        # Preds ..B9.31
-        addl      $8, %esp                                      #1114.5
-                                # LOE
-..B9.32:                        # Preds ..B9.50
-..LN857:
-        addl      $-8, %esp                                     #1115.5
-..LN859:
-        lea       -44(%ebp), %eax                               #1115.21
-        movl      %eax, (%esp)                                  #1115.21
-..LN861:
-        movl      $4, 4(%esp)                                   #1115.31
-..LN863:
-        call      uint128_shr                                   #1115.5
-                                # LOE
-..B9.51:                        # Preds ..B9.32
-        addl      $8, %esp                                      #1115.5
-                                # LOE
-..B9.33:                        # Preds ..B9.51
-..LN865:
-        addl      $-8, %esp                                     #1118.5
-..LN867:
-        movl      -16(%ebp), %eax                               #1118.28
-..LN869:
-        addl      $48, %eax                                     #1118.5
-        movl      %eax, (%esp)                                  #1118.5
-..LN871:
-        lea       -60(%ebp), %eax                               #1118.70
-        movl      %eax, 4(%esp)                                 #1118.70
-..LN873:
-        call      uint128_bswap_copy                            #1118.5
-                                # LOE
-..B9.52:                        # Preds ..B9.33
-        addl      $8, %esp                                      #1118.5
-                                # LOE
-..B9.34:                        # Preds ..B9.52
-..LN875:
-        addl      $-8, %esp                                     #1119.5
-..LN877:
-        movl      -16(%ebp), %eax                               #1119.28
-..LN879:
-        addl      $64, %eax                                     #1119.5
-        movl      %eax, (%esp)                                  #1119.5
-..LN881:
-        lea       -44(%ebp), %eax                               #1119.67
-        movl      %eax, 4(%esp)                                 #1119.67
-..LN883:
-        call      uint128_bswap_copy                            #1119.5
-                                # LOE
-..B9.53:                        # Preds ..B9.34
-        addl      $8, %esp                                      #1119.5
-                                # LOE
-..B9.35:                        # Preds ..B9.53
-..LN885:
-        addl      $-8, %esp                                     #1121.5
-..LN887:
-        lea       -60(%ebp), %eax                               #1121.21
-        movl      %eax, (%esp)                                  #1121.21
-..LN889:
-        movl      $4, 4(%esp)                                   #1121.34
-..LN891:
-        call      uint128_shr                                   #1121.5
-                                # LOE
-..B9.54:                        # Preds ..B9.35
-        addl      $8, %esp                                      #1121.5
-                                # LOE
-..B9.36:                        # Preds ..B9.54
-..LN893:
-        addl      $-8, %esp                                     #1122.5
-..LN895:
-        lea       -44(%ebp), %eax                               #1122.21
-        movl      %eax, (%esp)                                  #1122.21
-..LN897:
-        movl      $4, 4(%esp)                                   #1122.31
-..LN899:
-        call      uint128_shr                                   #1122.5
-                                # LOE
-..B9.55:                        # Preds ..B9.36
-        addl      $8, %esp                                      #1122.5
-                                # LOE
-..B9.37:                        # Preds ..B9.55
-..LN901:
-        addl      $-8, %esp                                     #1124.5
-..LN903:
-        movl      -16(%ebp), %eax                               #1124.28
-..LN905:
-        addl      $80, %eax                                     #1124.5
-        movl      %eax, (%esp)                                  #1124.5
-..LN907:
-        lea       -60(%ebp), %eax                               #1124.70
-        movl      %eax, 4(%esp)                                 #1124.70
-..LN909:
-        call      uint128_bswap_copy                            #1124.5
-                                # LOE
-..B9.56:                        # Preds ..B9.37
-        addl      $8, %esp                                      #1124.5
-                                # LOE
-..B9.38:                        # Preds ..B9.56
-..LN911:
-        addl      $-8, %esp                                     #1125.5
-..LN913:
-        movl      -16(%ebp), %eax                               #1125.28
-..LN915:
-        addl      $96, %eax                                     #1125.5
-        movl      %eax, (%esp)                                  #1125.5
-..LN917:
-        lea       -44(%ebp), %eax                               #1125.67
-        movl      %eax, 4(%esp)                                 #1125.67
-..LN919:
-        call      uint128_bswap_copy                            #1125.5
-                                # LOE
-..B9.57:                        # Preds ..B9.38
-        addl      $8, %esp                                      #1125.5
-                                # LOE
-..B9.39:                        # Preds ..B9.57
-..LN921:
-        addl      $-8, %esp                                     #1127.5
-..LN923:
-        lea       -60(%ebp), %eax                               #1127.21
-        movl      %eax, (%esp)                                  #1127.21
-..LN925:
-        movl      $4, 4(%esp)                                   #1127.34
-..LN927:
-        call      uint128_shr                                   #1127.5
-                                # LOE
-..B9.58:                        # Preds ..B9.39
-        addl      $8, %esp                                      #1127.5
-                                # LOE
-..B9.40:                        # Preds ..B9.58
-..LN929:
-        addl      $-8, %esp                                     #1128.5
-..LN931:
-        lea       -44(%ebp), %eax                               #1128.21
-        movl      %eax, (%esp)                                  #1128.21
-..LN933:
-        movl      $4, 4(%esp)                                   #1128.31
-..LN935:
-        call      uint128_shr                                   #1128.5
-                                # LOE
-..B9.59:                        # Preds ..B9.40
-        addl      $8, %esp                                      #1128.5
-                                # LOE
-..B9.41:                        # Preds ..B9.59
-..LN937:
-        addl      $-8, %esp                                     #1130.5
-..LN939:
-        movl      -16(%ebp), %eax                               #1130.28
-..LN941:
-        addl      $112, %eax                                    #1130.5
-        movl      %eax, (%esp)                                  #1130.5
-..LN943:
-        lea       -60(%ebp), %eax                               #1130.70
-        movl      %eax, 4(%esp)                                 #1130.70
-..LN945:
-        call      uint128_bswap_copy                            #1130.5
-                                # LOE
-..B9.60:                        # Preds ..B9.41
-        addl      $8, %esp                                      #1130.5
-                                # LOE
-..B9.42:                        # Preds ..B9.60
-..LN947:
-        addl      $-8, %esp                                     #1131.5
-..LN949:
-        movl      -16(%ebp), %eax                               #1131.28
-..LN951:
-        addl      $128, %eax                                    #1131.5
-        movl      %eax, (%esp)                                  #1131.5
-..LN953:
-        lea       -44(%ebp), %eax                               #1131.67
-        movl      %eax, 4(%esp)                                 #1131.67
-..LN955:
-        call      uint128_bswap_copy                            #1131.5
-                                # LOE
-..B9.61:                        # Preds ..B9.42
-        addl      $8, %esp                                      #1131.5
-                                # LOE
-..B9.43:                        # Preds ..B9.61
-..LN957:
-        xorl      %eax, %eax                                    #1173.12
-        movl      -4(%ebp), %ebx                                #1173.12
-..___tag_value_NucStrFastaExprMake4.160:                        #
-        leave                                                   #1173.12
-..___tag_value_NucStrFastaExprMake4.162:                        #
-        ret                                                     #1173.12
-        .align    2,0x90
-..___tag_value_NucStrFastaExprMake4.163:                        #
-                                # LOE
-# mark_end;
-	.type	NucStrFastaExprMake4, at function
-	.size	NucStrFastaExprMake4,.-NucStrFastaExprMake4
-.LNNucStrFastaExprMake4:
-	.data
-# -- End  NucStrFastaExprMake4
-	.data
-	.text
-# -- Begin  nss_sob
-# mark_begin;
-       .align    2,0x90
-nss_sob:
-# parameter 1(p): 8 + %ebp
-# parameter 2(end): 12 + %ebp
-..B10.1:                        # Preds ..B10.0
-..___tag_value_nss_sob.166:                                     #
-..LN959:
-        pushl     %ebp                                          #1181.1
-        movl      %esp, %ebp                                    #1181.1
-..___tag_value_nss_sob.171:                                     #
-        subl      $8, %esp                                      #1181.1
-        movl      %ebx, -4(%ebp)                                #1181.1
-..___tag_value_nss_sob.174:                                     #
-..LN961:
-        movl      8(%ebp), %eax                                 #1182.13
-..LN963:
-        movl      12(%ebp), %edx                                #1182.17
-        cmpl      %edx, %eax                                    #1182.17
-        jae       ..B10.6       # Prob 50%                      #1182.17
-                                # LOE
-..B10.2:                        # Preds ..B10.1
-        call      ..L175        # Prob 100%                     #
-..L175:                                                         #
-        popl      %eax                                          #
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L175], %eax     #
-        movl      %eax, -8(%ebp)                                #
-..LN965:
-        movl      %eax, %ebx                                    #1182.24
-        call      __ctype_b_loc at PLT                             #1182.24
-                                # LOE eax
-..B10.9:                        # Preds ..B10.2
-        movl      8(%ebp), %edx                                 #1182.24
-        movzbl    (%edx), %edx                                  #1182.24
-        movzbl    %dl, %edx                                     #1182.24
-        movl      (%eax), %eax                                  #1182.24
-        movzwl    (%eax,%edx,2), %eax                           #1182.24
-        testl     $8192, %eax                                   #1182.24
-        jne       ..B10.5       # Prob 50%                      #1182.24
-        jmp       ..B10.6       # Prob 100%                     #1182.24
-                                # LOE
-..B10.3:                        # Preds ..B10.5
-        movl      -8(%ebp), %eax                                #1182.24
-        movl      %eax, %ebx                                    #1182.24
-        call      __ctype_b_loc at PLT                             #1182.24
-                                # LOE eax
-..B10.10:                       # Preds ..B10.3
-        movl      8(%ebp), %edx                                 #1182.24
-        movzbl    (%edx), %edx                                  #1182.24
-        movzbl    %dl, %edx                                     #1182.24
-        movl      (%eax), %eax                                  #1182.24
-        movzwl    (%eax,%edx,2), %eax                           #1182.24
-        testl     $8192, %eax                                   #1182.24
-        je        ..B10.6       # Prob 50%                      #1182.24
-                                # LOE
-..B10.5:                        # Preds ..B10.9 ..B10.10
-..LN967:
-        incl      8(%ebp)                                       #1183.12
-..LN969:
-        movl      8(%ebp), %eax                                 #1182.13
-..LN971:
-        movl      12(%ebp), %edx                                #1182.17
-        cmpl      %edx, %eax                                    #1182.17
-        jb        ..B10.3       # Prob 50%                      #1182.17
-                                # LOE
-..B10.6:                        # Preds ..B10.10 ..B10.9 ..B10.5 ..B10.1
-..LN973:
-        movl      8(%ebp), %eax                                 #1184.12
-        movl      -4(%ebp), %ebx                                #1184.12
-..___tag_value_nss_sob.176:                                     #
-        leave                                                   #1184.12
-..___tag_value_nss_sob.178:                                     #
-        ret                                                     #1184.12
-        .align    2,0x90
-..___tag_value_nss_sob.179:                                     #
-                                # LOE
-# mark_end;
-	.type	nss_sob, at function
-	.size	nss_sob,.-nss_sob
-.LNnss_sob:
-	.data
-# -- End  nss_sob
-	.text
-# -- Begin  nss_FASTA_expr
-# mark_begin;
-       .align    2,0x90
-nss_FASTA_expr:
-# parameter 1(p): 8 + %ebp
-# parameter 2(end): 12 + %ebp
-# parameter 3(expr): 16 + %ebp
-# parameter 4(status): 20 + %ebp
-# parameter 5(positional): 24 + %ebp
-..B11.1:                        # Preds ..B11.0
-..___tag_value_nss_FASTA_expr.182:                              #
-..LN975:
-        pushl     %ebp                                          #1192.1
-        movl      %esp, %ebp                                    #1192.1
-..___tag_value_nss_FASTA_expr.187:                              #
-        subl      $24, %esp                                     #1192.1
-..LN977:
-        movl      8(%ebp), %eax                                 #1193.10
-..LN979:
-        movl      12(%ebp), %edx                                #1193.15
-        cmpl      %edx, %eax                                    #1193.15
-        jb        ..B11.3       # Prob 50%                      #1193.15
-                                # LOE
-..B11.2:                        # Preds ..B11.1
-..LN981:
-        movl      20(%ebp), %eax                                #1194.9
-        movl      $22, (%eax)                                   #1194.9
-        jmp       ..B11.17      # Prob 100%                     #1194.9
-                                # LOE
-..B11.3:                        # Preds ..B11.1
-        call      ..L190        # Prob 100%                     #
-..L190:                                                         #
-        popl      %eax                                          #
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L190], %eax     #
-        movl      %eax, -4(%ebp)                                #
-..LN983:
-        movl      8(%ebp), %edx                                 #1197.30
-..LN985:
-        movl      %edx, -16(%ebp)                               #1197.27
-..LN987:
-        movl      $0, -12(%ebp)                                 #1199.22
-..LN989:
-        lea       fasta_2na_map at GOTOFF(%eax), %eax              #1200.27
-        movl      %eax, -8(%ebp)                                #1200.27
-                                # LOE
-..B11.4:                        # Preds ..B11.9 ..B11.3
-..LN991:
-        movl      8(%ebp), %eax                                 #1203.20
-        movzbl    (%eax), %eax                                  #1203.20
-        movsbl    %al, %eax                                     #1203.20
-..LN993:
-        testl     %eax, %eax                                    #1203.24
-        jl        ..B11.10      # Prob 50%                      #1203.24
-                                # LOE
-..B11.5:                        # Preds ..B11.4
-..LN995:
-        movl      8(%ebp), %eax                                 #1206.45
-        movzbl    (%eax), %eax                                  #1206.45
-        movzbl    %al, %eax                                     #1206.45
-..LN997:
-        movl      -8(%ebp), %edx                                #1206.18
-        movzbl    (%eax,%edx), %eax                             #1206.18
-        movsbl    %al, %eax                                     #1206.18
-..LN999:
-        testl     %eax, %eax                                    #1206.51
-        jge       ..B11.9       # Prob 50%                      #1206.51
-                                # LOE
-..B11.6:                        # Preds ..B11.5
-..LN1001:
-        movl      -4(%ebp), %eax                                #1208.29
-        lea       fasta_4na_map at GOTOFF(%eax), %eax              #1208.29
-..LN1003:
-        movl      -8(%ebp), %edx                                #1208.22
-..LN1005:
-        cmpl      %eax, %edx                                    #1208.29
-        je        ..B11.10      # Prob 50%                      #1208.29
-                                # LOE
-..B11.7:                        # Preds ..B11.6
-..LN1007:
-        movl      8(%ebp), %eax                                 #1210.59
-        movzbl    (%eax), %eax                                  #1210.59
-        movzbl    %al, %eax                                     #1210.59
-..LN1009:
-        movl      -4(%ebp), %edx                                #1210.22
-        movzbl    fasta_4na_map at GOTOFF(%eax,%edx), %eax         #1210.22
-        movsbl    %al, %eax                                     #1210.22
-..LN1011:
-        testl     %eax, %eax                                    #1210.65
-        jl        ..B11.10      # Prob 50%                      #1210.65
-                                # LOE
-..B11.8:                        # Preds ..B11.7
-..LN1013:
-        movl      $1, -12(%ebp)                                 #1212.17
-..LN1015:
-        movl      -4(%ebp), %eax                                #1213.23
-        lea       fasta_4na_map at GOTOFF(%eax), %eax              #1213.23
-..LN1017:
-        movl      %eax, -8(%ebp)                                #1213.17
-                                # LOE
-..B11.9:                        # Preds ..B11.8 ..B11.5
-..LN1019:
-        movl      8(%ebp), %eax                                 #1216.20
-        incl      %eax                                          #1216.20
-        movl      %eax, 8(%ebp)                                 #1216.20
-..LN1021:
-        movl      12(%ebp), %edx                                #1216.24
-        cmpl      %edx, %eax                                    #1216.24
-        jb        ..B11.4       # Prob 50%                      #1216.24
-                                # LOE
-..B11.10:                       # Preds ..B11.7 ..B11.6 ..B11.4 ..B11.9
-..LN1023:
-        movl      8(%ebp), %eax                                 #1218.14
-..LN1025:
-        movl      -16(%ebp), %edx                               #1218.19
-        cmpl      %edx, %eax                                    #1218.19
-        ja        ..B11.12      # Prob 50%                      #1218.19
-                                # LOE
-..B11.11:                       # Preds ..B11.10
-..LN1027:
-        movl      20(%ebp), %eax                                #1219.13
-        movl      $22, (%eax)                                   #1219.13
-        jmp       ..B11.17      # Prob 100%                     #1219.13
-                                # LOE
-..B11.12:                       # Preds ..B11.10
-..LN1029:
-        movl      -12(%ebp), %eax                               #1220.19
-..LN1031:
-        testl     %eax, %eax                                    #1220.27
-        jne       ..B11.15      # Prob 50%                      #1220.27
-                                # LOE
-..B11.13:                       # Preds ..B11.12
-..LN1033:
-        addl      $-16, %esp                                    #1221.24
-..LN1035:
-        movl      16(%ebp), %eax                                #1221.47
-        movl      %eax, (%esp)                                  #1221.47
-..LN1037:
-        movl      24(%ebp), %eax                                #1221.53
-        movl      %eax, 4(%esp)                                 #1221.53
-..LN1039:
-        movl      -16(%ebp), %eax                               #1221.65
-        movl      %eax, 8(%esp)                                 #1221.65
-..LN1041:
-        movl      -16(%ebp), %eax                               #1221.76
-        negl      %eax                                          #1221.76
-        addl      8(%ebp), %eax                                 #1221.76
-        movl      %eax, 12(%esp)                                #1221.76
-..LN1043:
-        call      NucStrFastaExprMake2                          #1221.24
-                                # LOE eax
-..B11.20:                       # Preds ..B11.13
-        addl      $16, %esp                                     #1221.24
-        movl      %eax, -24(%ebp)                               #1221.24
-                                # LOE
-..B11.14:                       # Preds ..B11.20
-..LN1045:
-        movl      20(%ebp), %eax                                #1221.13
-        movl      -24(%ebp), %edx                               #1221.13
-        movl      %edx, (%eax)                                  #1221.13
-        jmp       ..B11.17      # Prob 100%                     #1221.13
-                                # LOE
-..B11.15:                       # Preds ..B11.12
-..LN1047:
-        addl      $-16, %esp                                    #1223.24
-..LN1049:
-        movl      16(%ebp), %eax                                #1223.47
-        movl      %eax, (%esp)                                  #1223.47
-..LN1051:
-        movl      24(%ebp), %eax                                #1223.53
-        movl      %eax, 4(%esp)                                 #1223.53
-..LN1053:
-        movl      -16(%ebp), %eax                               #1223.65
-        movl      %eax, 8(%esp)                                 #1223.65
-..LN1055:
-        movl      -16(%ebp), %eax                               #1223.76
-        negl      %eax                                          #1223.76
-        addl      8(%ebp), %eax                                 #1223.76
-        movl      %eax, 12(%esp)                                #1223.76
-..LN1057:
-        call      NucStrFastaExprMake4                          #1223.24
-                                # LOE eax
-..B11.21:                       # Preds ..B11.15
-        addl      $16, %esp                                     #1223.24
-        movl      %eax, -20(%ebp)                               #1223.24
-                                # LOE
-..B11.16:                       # Preds ..B11.21
-..LN1059:
-        movl      20(%ebp), %eax                                #1223.13
-        movl      -20(%ebp), %edx                               #1223.13
-        movl      %edx, (%eax)                                  #1223.13
-                                # LOE
-..B11.17:                       # Preds ..B11.2 ..B11.11 ..B11.14 ..B11.16
-..LN1061:
-        movl      8(%ebp), %eax                                 #1226.12
-        leave                                                   #1226.12
-..___tag_value_nss_FASTA_expr.192:                              #
-        ret                                                     #1226.12
-        .align    2,0x90
-..___tag_value_nss_FASTA_expr.193:                              #
-                                # LOE
-# mark_end;
-	.type	nss_FASTA_expr, at function
-	.size	nss_FASTA_expr,.-nss_FASTA_expr
-.LNnss_FASTA_expr:
-	.data
-# -- End  nss_FASTA_expr
-	.section .rodata, "a"
-	.align 4
-__$U1:
-	.byte	110
-	.byte	115
-	.byte	115
-	.byte	95
-	.byte	102
-	.byte	97
-	.byte	115
-	.byte	116
-	.byte	97
-	.byte	95
-	.byte	101
-	.byte	120
-	.byte	112
-	.byte	114
-	.byte	0
-	.type	__$U1, at object
-	.size	__$U1,15
-	.space 1	# pad
-_2__STRING.3:
-	.byte	112
-	.byte	32
-	.byte	60
-	.byte	32
-	.byte	101
-	.byte	110
-	.byte	100
-	.byte	0
-	.type	_2__STRING.3, at object
-	.size	_2__STRING.3,8
-	.text
-# -- Begin  nss_fasta_expr
-# mark_begin;
-       .align    2,0x90
-nss_fasta_expr:
-# parameter 1(p): 8 + %ebp
-# parameter 2(end): 12 + %ebp
-# parameter 3(expr): 16 + %ebp
-# parameter 4(status): 20 + %ebp
-# parameter 5(positional): 24 + %ebp
-..B12.1:                        # Preds ..B12.0
-..___tag_value_nss_fasta_expr.196:                              #
-..LN1063:
-        pushl     %ebp                                          #1234.1
-        movl      %esp, %ebp                                    #1234.1
-..___tag_value_nss_fasta_expr.201:                              #
-        subl      $28, %esp                                     #1234.1
-        movl      %ebx, -4(%ebp)                                #1234.1
-..___tag_value_nss_fasta_expr.204:                              #
-..LN1065:
-        movl      8(%ebp), %eax                                 #1235.5
-        movl      12(%ebp), %edx                                #1235.5
-        cmpl      %edx, %eax                                    #1235.5
-        jb        ..B12.3       # Prob 50%                      #1235.5
-..___tag_value_nss_fasta_expr.205:                              #
-                                # LOE
-..B12.2:                        # Preds ..B12.1
-        call      ..L206        # Prob 100%                     #
-..L206:                                                         #
-        popl      %eax                                          #
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L206], %eax     #
-        addl      $-16, %esp                                    #1235.5
-        lea       _2__STRING.3 at GOTOFF(%eax), %edx               #1235.5
-        movl      %edx, (%esp)                                  #1235.5
-        lea       _2__STRING.1 at GOTOFF(%eax), %edx               #1235.5
-        movl      %edx, 4(%esp)                                 #1235.5
-        movl      $1235, 8(%esp)                                #1235.5
-        lea       __$U1 at GOTOFF(%eax), %edx                      #1235.5
-        movl      %edx, 12(%esp)                                #1235.5
-        movl      %eax, %ebx                                    #1235.5
-        call      __assert_fail at PLT                             #1235.5
-                                # LOE
-..B12.26:                       # Preds ..B12.2
-        addl      $16, %esp                                     #1235.5
-..___tag_value_nss_fasta_expr.207:                              #
-                                # LOE
-..B12.3:                        # Preds ..B12.1
-..LN1067:
-        movl      8(%ebp), %eax                                 #1236.16
-        movzbl    (%eax), %eax                                  #1236.16
-        movsbl    %al, %eax                                     #1236.16
-        movl      %eax, -8(%ebp)                                #1236.16
-        cmpl      $39, %eax                                     #1236.16
-        je        ..B12.5       # Prob 50%                      #1236.16
-                                # LOE
-..B12.4:                        # Preds ..B12.3
-        movl      -8(%ebp), %eax                                #1236.16
-        cmpl      $34, %eax                                     #1236.16
-        je        ..B12.13      # Prob 50%                      #1236.16
-        jmp       ..B12.21      # Prob 100%                     #1236.16
-                                # LOE
-..B12.5:                        # Preds ..B12.3
-..LN1069:
-        addl      $-20, %esp                                    #1239.13
-..LN1071:
-        movl      8(%ebp), %eax                                 #1239.30
-        incl      %eax                                          #1239.30
-        movl      %eax, (%esp)                                  #1239.30
-..LN1073:
-        movl      12(%ebp), %eax                                #1239.37
-        movl      %eax, 4(%esp)                                 #1239.37
-..LN1075:
-        movl      16(%ebp), %eax                                #1239.42
-        movl      %eax, 8(%esp)                                 #1239.42
-..LN1077:
-        movl      20(%ebp), %eax                                #1239.48
-        movl      %eax, 12(%esp)                                #1239.48
-..LN1079:
-        movl      24(%ebp), %eax                                #1239.56
-        movl      %eax, 16(%esp)                                #1239.56
-..LN1081:
-        call      nss_FASTA_expr                                #1239.13
-                                # LOE eax
-..B12.27:                       # Preds ..B12.5
-        addl      $20, %esp                                     #1239.13
-        movl      %eax, -12(%ebp)                               #1239.13
-                                # LOE
-..B12.6:                        # Preds ..B12.27
-..LN1083:
-        movl      -12(%ebp), %eax                               #1239.9
-        movl      %eax, 8(%ebp)                                 #1239.9
-..LN1085:
-        movl      20(%ebp), %eax                                #1240.16
-        movl      (%eax), %eax                                  #1240.16
-..LN1087:
-        testl     %eax, %eax                                    #1240.26
-        jne       ..B12.23      # Prob 50%                      #1240.26
-                                # LOE
-..B12.7:                        # Preds ..B12.6
-..LN1089:
-        movl      8(%ebp), %eax                                 #1240.33
-..LN1091:
-        movl      12(%ebp), %edx                                #1240.38
-        cmpl      %edx, %eax                                    #1240.38
-        je        ..B12.12      # Prob 50%                      #1240.38
-                                # LOE
-..B12.8:                        # Preds ..B12.7
-..LN1093:
-        movl      8(%ebp), %eax                                 #1240.47
-        movzbl    (%eax), %eax                                  #1240.47
-        movsbl    %al, %eax                                     #1240.47
-..LN1095:
-        cmpl      $39, %eax                                     #1240.55
-        jne       ..B12.10      # Prob 50%                      #1240.55
-                                # LOE
-..B12.9:                        # Preds ..B12.8
-        movl      $0, -24(%ebp)                                 #1240.55
-        jmp       ..B12.11      # Prob 100%                     #1240.55
-                                # LOE
-..B12.10:                       # Preds ..B12.8
-        movl      $1, -24(%ebp)                                 #1240.55
-                                # LOE
-..B12.11:                       # Preds ..B12.10 ..B12.9
-..LN1097:
-        movl      -24(%ebp), %eax                               #1240.47
-        incl      8(%ebp)                                       #1240.47
-..LN1099:
-        testl     %eax, %eax                                    #1240.55
-        je        ..B12.23      # Prob 100%                     #1240.55
-                                # LOE
-..B12.12:                       # Preds ..B12.7 ..B12.11
-..LN1101:
-        movl      20(%ebp), %eax                                #1241.13
-        movl      $22, (%eax)                                   #1241.13
-        jmp       ..B12.23      # Prob 100%                     #1241.13
-                                # LOE
-..B12.13:                       # Preds ..B12.4
-..LN1103:
-        addl      $-20, %esp                                    #1244.13
-..LN1105:
-        movl      8(%ebp), %eax                                 #1244.30
-        incl      %eax                                          #1244.30
-        movl      %eax, (%esp)                                  #1244.30
-..LN1107:
-        movl      12(%ebp), %eax                                #1244.37
-        movl      %eax, 4(%esp)                                 #1244.37
-..LN1109:
-        movl      16(%ebp), %eax                                #1244.42
-        movl      %eax, 8(%esp)                                 #1244.42
-..LN1111:
-        movl      20(%ebp), %eax                                #1244.48
-        movl      %eax, 12(%esp)                                #1244.48
-..LN1113:
-        movl      24(%ebp), %eax                                #1244.56
-        movl      %eax, 16(%esp)                                #1244.56
-..LN1115:
-        call      nss_FASTA_expr                                #1244.13
-                                # LOE eax
-..B12.28:                       # Preds ..B12.13
-        addl      $20, %esp                                     #1244.13
-        movl      %eax, -20(%ebp)                               #1244.13
-                                # LOE
-..B12.14:                       # Preds ..B12.28
-..LN1117:
-        movl      -20(%ebp), %eax                               #1244.9
-        movl      %eax, 8(%ebp)                                 #1244.9
-..LN1119:
-        movl      20(%ebp), %eax                                #1245.16
-        movl      (%eax), %eax                                  #1245.16
-..LN1121:
-        testl     %eax, %eax                                    #1245.26
-        jne       ..B12.23      # Prob 50%                      #1245.26
-                                # LOE
-..B12.15:                       # Preds ..B12.14
-..LN1123:
-        movl      8(%ebp), %eax                                 #1245.33
-..LN1125:
-        movl      12(%ebp), %edx                                #1245.38
-        cmpl      %edx, %eax                                    #1245.38
-        je        ..B12.20      # Prob 50%                      #1245.38
-                                # LOE
-..B12.16:                       # Preds ..B12.15
-..LN1127:
-        movl      8(%ebp), %eax                                 #1245.47
-        movzbl    (%eax), %eax                                  #1245.47
-        movsbl    %al, %eax                                     #1245.47
-..LN1129:
-        cmpl      $34, %eax                                     #1245.55
-        jne       ..B12.18      # Prob 50%                      #1245.55
-                                # LOE
-..B12.17:                       # Preds ..B12.16
-        movl      $0, -28(%ebp)                                 #1245.55
-        jmp       ..B12.19      # Prob 100%                     #1245.55
-                                # LOE
-..B12.18:                       # Preds ..B12.16
-        movl      $1, -28(%ebp)                                 #1245.55
-                                # LOE
-..B12.19:                       # Preds ..B12.18 ..B12.17
-..LN1131:
-        movl      -28(%ebp), %eax                               #1245.47
-        incl      8(%ebp)                                       #1245.47
-..LN1133:
-        testl     %eax, %eax                                    #1245.55
-        je        ..B12.23      # Prob 100%                     #1245.55
-                                # LOE
-..B12.20:                       # Preds ..B12.15 ..B12.19
-..LN1135:
-        movl      20(%ebp), %eax                                #1246.13
-        movl      $22, (%eax)                                   #1246.13
-        jmp       ..B12.23      # Prob 100%                     #1246.13
-                                # LOE
-..B12.21:                       # Preds ..B12.4
-..LN1137:
-        addl      $-20, %esp                                    #1249.16
-..LN1139:
-        movl      8(%ebp), %eax                                 #1249.33
-        movl      %eax, (%esp)                                  #1249.33
-..LN1141:
-        movl      12(%ebp), %eax                                #1249.36
-        movl      %eax, 4(%esp)                                 #1249.36
-..LN1143:
-        movl      16(%ebp), %eax                                #1249.41
-        movl      %eax, 8(%esp)                                 #1249.41
-..LN1145:
-        movl      20(%ebp), %eax                                #1249.47
-        movl      %eax, 12(%esp)                                #1249.47
-..LN1147:
-        movl      24(%ebp), %eax                                #1249.55
-        movl      %eax, 16(%esp)                                #1249.55
-..LN1149:
-        call      nss_FASTA_expr                                #1249.16
-                                # LOE eax
-..B12.29:                       # Preds ..B12.21
-        addl      $20, %esp                                     #1249.16
-        movl      %eax, -16(%ebp)                               #1249.16
-                                # LOE
-..B12.22:                       # Preds ..B12.29
-        movl      -16(%ebp), %eax                               #1249.16
-        movl      -4(%ebp), %ebx                                #1249.16
-..___tag_value_nss_fasta_expr.208:                              #
-        leave                                                   #1249.16
-..___tag_value_nss_fasta_expr.210:                              #
-        ret                                                     #1249.16
-..___tag_value_nss_fasta_expr.211:                              #
-                                # LOE
-..B12.23:                       # Preds ..B12.12 ..B12.11 ..B12.6 ..B12.20 ..B12.19
-                                #       ..B12.14
-..LN1151:
-        movl      8(%ebp), %eax                                 #1252.12
-        movl      -4(%ebp), %ebx                                #1252.12
-..___tag_value_nss_fasta_expr.213:                              #
-        leave                                                   #1252.12
-..___tag_value_nss_fasta_expr.215:                              #
-        ret                                                     #1252.12
-        .align    2,0x90
-..___tag_value_nss_fasta_expr.216:                              #
-                                # LOE
-# mark_end;
-	.type	nss_fasta_expr, at function
-	.size	nss_fasta_expr,.-nss_fasta_expr
-.LNnss_fasta_expr:
-	.data
-# -- End  nss_fasta_expr
-	.section .rodata, "a"
-	.align 4
-__$U2:
-	.byte	110
-	.byte	115
-	.byte	115
-	.byte	95
-	.byte	112
-	.byte	114
-	.byte	105
-	.byte	109
-	.byte	97
-	.byte	114
-	.byte	121
-	.byte	95
-	.byte	101
-	.byte	120
-	.byte	112
-	.byte	114
-	.byte	0
-	.type	__$U2, at object
-	.size	__$U2,17
-	.text
-# -- Begin  nss_primary_expr
-# mark_begin;
-       .align    2,0x90
-nss_primary_expr:
-# parameter 1(p): 8 + %ebp
-# parameter 2(end): 12 + %ebp
-# parameter 3(expr): 16 + %ebp
-# parameter 4(status): 20 + %ebp
-# parameter 5(positional): 24 + %ebp
-..B13.1:                        # Preds ..B13.0
-..___tag_value_nss_primary_expr.219:                            #
-..LN1153:
-        pushl     %ebp                                          #1291.1
-        movl      %esp, %ebp                                    #1291.1
-..___tag_value_nss_primary_expr.224:                            #
-        subl      $52, %esp                                     #1291.1
-        movl      %ebx, -4(%ebp)                                #1291.1
-..___tag_value_nss_primary_expr.227:                            #
-        call      ..L228        # Prob 100%                     #1291.1
-..L228:                                                         #
-        popl      %eax                                          #1291.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L228], %eax     #1291.1
-        movl      %eax, -8(%ebp)                                #1291.1
-..LN1155:
-        movl      8(%ebp), %eax                                 #1294.5
-        movl      12(%ebp), %edx                                #1294.5
-        cmpl      %edx, %eax                                    #1294.5
-        jb        ..B13.3       # Prob 50%                      #1294.5
-..___tag_value_nss_primary_expr.229:                            #
-                                # LOE
-..B13.2:                        # Preds ..B13.1
-        addl      $-16, %esp                                    #1294.5
-        movl      -8(%ebp), %eax                                #1294.5
-        lea       _2__STRING.3 at GOTOFF(%eax), %eax               #1294.5
-        movl      %eax, (%esp)                                  #1294.5
-        movl      -8(%ebp), %eax                                #1294.5
-        lea       _2__STRING.1 at GOTOFF(%eax), %eax               #1294.5
-        movl      %eax, 4(%esp)                                 #1294.5
-        movl      $1294, 8(%esp)                                #1294.5
-        movl      -8(%ebp), %eax                                #1294.5
-        lea       __$U2 at GOTOFF(%eax), %eax                      #1294.5
-        movl      %eax, 12(%esp)                                #1294.5
-        movl      -8(%ebp), %eax                                #1294.5
-        movl      %eax, %ebx                                    #1294.5
-        call      __assert_fail at PLT                             #1294.5
-                                # LOE
-..B13.38:                       # Preds ..B13.2
-        addl      $16, %esp                                     #1294.5
-..___tag_value_nss_primary_expr.230:                            #
-                                # LOE
-..B13.3:                        # Preds ..B13.1
-..LN1157:
-        movl      8(%ebp), %eax                                 #1295.16
-        movzbl    (%eax), %eax                                  #1295.16
-        movsbl    %al, %eax                                     #1295.16
-        movl      %eax, -12(%ebp)                               #1295.16
-        cmpl      $94, %eax                                     #1295.16
-        je        ..B13.5       # Prob 50%                      #1295.16
-                                # LOE
-..B13.4:                        # Preds ..B13.3
-        movl      -12(%ebp), %eax                               #1295.16
-        cmpl      $40, %eax                                     #1295.16
-        je        ..B13.12      # Prob 50%                      #1295.16
-        jmp       ..B13.25      # Prob 100%                     #1295.16
-                                # LOE
-..B13.5:                        # Preds ..B13.3
-..LN1159:
-        pushl     %edi                                          #1298.13
-..LN1161:
-        movl      $12, (%esp)                                   #1298.22
-..LN1163:
-        movl      -8(%ebp), %eax                                #1298.13
-        movl      %eax, %ebx                                    #1298.13
-        call      malloc at PLT                                    #1298.13
-                                # LOE eax
-..B13.39:                       # Preds ..B13.5
-        popl      %ecx                                          #1298.13
-        movl      %eax, -16(%ebp)                               #1298.13
-                                # LOE
-..B13.6:                        # Preds ..B13.39
-..LN1165:
-        movl      -16(%ebp), %eax                               #1298.9
-        movl      %eax, -20(%ebp)                               #1298.9
-..LN1167:
-        movl      -20(%ebp), %eax                               #1299.14
-..LN1169:
-        testl     %eax, %eax                                    #1299.19
-        jne       ..B13.8       # Prob 50%                      #1299.19
-                                # LOE
-..B13.7:                        # Preds ..B13.6
-..LN1171:
-        movl      -8(%ebp), %eax                                #1300.24
-        movl      %eax, %ebx                                    #1300.24
-        call      __errno_location at PLT                          #1300.24
-                                # LOE eax
-..B13.40:                       # Preds ..B13.7
-..LN1173:
-        movl      20(%ebp), %edx                                #1300.13
-..LN1175:
-        movl      (%eax), %eax                                  #1300.24
-..LN1177:
-        movl      %eax, (%edx)                                  #1300.13
-        jmp       ..B13.11      # Prob 100%                     #1300.13
-                                # LOE
-..B13.8:                        # Preds ..B13.6
-..LN1179:
-        movl      -20(%ebp), %eax                               #1303.13
-        movl      $12, (%eax)                                   #1303.13
-..LN1181:
-        movl      -20(%ebp), %eax                               #1304.13
-        movl      $14, 4(%eax)                                  #1304.13
-..LN1183:
-        movl      -20(%ebp), %eax                               #1305.13
-        movl      $0, 8(%eax)                                   #1305.13
-..LN1185:
-        movl      16(%ebp), %eax                                #1306.13
-..LN1187:
-        movl      -20(%ebp), %edx                               #1306.22
-..LN1189:
-        movl      %edx, (%eax)                                  #1306.13
-..LN1191:
-        addl      $-8, %esp                                     #1308.17
-..LN1193:
-        movl      8(%ebp), %eax                                 #1308.27
-        incl      %eax                                          #1308.27
-        movl      %eax, (%esp)                                  #1308.27
-..LN1195:
-        movl      12(%ebp), %eax                                #1308.34
-        movl      %eax, 4(%esp)                                 #1308.34
-..LN1197:
-        call      nss_sob                                       #1308.17
-                                # LOE eax
-..B13.41:                       # Preds ..B13.8
-        addl      $8, %esp                                      #1308.17
-        movl      %eax, -36(%ebp)                               #1308.17
-                                # LOE
-..B13.9:                        # Preds ..B13.41
-..LN1199:
-        movl      -36(%ebp), %eax                               #1308.13
-        movl      %eax, 8(%ebp)                                 #1308.13
-..LN1201:
-        addl      $-20, %esp                                    #1309.17
-        movl      8(%ebp), %eax                                 #1309.17
-        movl      %eax, (%esp)                                  #1309.17
-        movl      12(%ebp), %eax                                #1309.17
-        movl      %eax, 4(%esp)                                 #1309.17
-        movl      -20(%ebp), %eax                               #1309.17
-        addl      $8, %eax                                      #1309.17
-        movl      %eax, 8(%esp)                                 #1309.17
-        movl      20(%ebp), %eax                                #1309.17
-        movl      %eax, 12(%esp)                                #1309.17
-        movl      24(%ebp), %eax                                #1309.17
-        movl      %eax, 16(%esp)                                #1309.17
-        call      nss_fasta_expr                                #1309.17
-                                # LOE eax
-..B13.42:                       # Preds ..B13.9
-        addl      $20, %esp                                     #1309.17
-        movl      %eax, -32(%ebp)                               #1309.17
-                                # LOE
-..B13.10:                       # Preds ..B13.42
-..LN1203:
-        movl      -32(%ebp), %eax                               #1309.13
-        movl      %eax, 8(%ebp)                                 #1309.13
-                                # LOE
-..B13.11:                       # Preds ..B13.40 ..B13.10
-..LN1205:
-        movl      8(%ebp), %eax                                 #1311.16
-        movl      -4(%ebp), %ebx                                #1311.16
-..___tag_value_nss_primary_expr.231:                            #
-        leave                                                   #1311.16
-..___tag_value_nss_primary_expr.233:                            #
-        ret                                                     #1311.16
-..___tag_value_nss_primary_expr.234:                            #
-                                # LOE
-..B13.12:                       # Preds ..B13.4
-..LN1207:
-        pushl     %edi                                          #1313.13
-..LN1209:
-        movl      $12, (%esp)                                   #1313.22
-..LN1211:
-        movl      -8(%ebp), %eax                                #1313.13
-        movl      %eax, %ebx                                    #1313.13
-        call      malloc at PLT                                    #1313.13
-                                # LOE eax
-..B13.43:                       # Preds ..B13.12
-        popl      %ecx                                          #1313.13
-        movl      %eax, -28(%ebp)                               #1313.13
-                                # LOE
-..B13.13:                       # Preds ..B13.43
-..LN1213:
-        movl      -28(%ebp), %eax                               #1313.9
-        movl      %eax, -20(%ebp)                               #1313.9
-..LN1215:
-        movl      -20(%ebp), %eax                               #1314.14
-..LN1217:
-        testl     %eax, %eax                                    #1314.19
-        jne       ..B13.15      # Prob 50%                      #1314.19
-                                # LOE
-..B13.14:                       # Preds ..B13.13
-..LN1219:
-        movl      -8(%ebp), %eax                                #1315.24
-        movl      %eax, %ebx                                    #1315.24
-        call      __errno_location at PLT                          #1315.24
-                                # LOE eax
-..B13.44:                       # Preds ..B13.14
-..LN1221:
-        movl      20(%ebp), %edx                                #1315.13
-..LN1223:
-        movl      (%eax), %eax                                  #1315.24
-..LN1225:
-        movl      %eax, (%edx)                                  #1315.13
-        jmp       ..B13.24      # Prob 100%                     #1315.13
-                                # LOE
-..B13.15:                       # Preds ..B13.13
-..LN1227:
-        movl      -20(%ebp), %eax                               #1318.13
-        movl      $12, (%eax)                                   #1318.13
-..LN1229:
-        movl      -20(%ebp), %eax                               #1319.13
-        movl      $0, 4(%eax)                                   #1319.13
-..LN1231:
-        movl      16(%ebp), %eax                                #1320.13
-..LN1233:
-        movl      -20(%ebp), %edx                               #1320.22
-..LN1235:
-        movl      %edx, (%eax)                                  #1320.13
-..LN1237:
-        addl      $-20, %esp                                    #1322.17
-..LN1239:
-        movl      8(%ebp), %eax                                 #1322.28
-        incl      %eax                                          #1322.28
-        movl      %eax, (%esp)                                  #1322.28
-..LN1241:
-        movl      12(%ebp), %eax                                #1322.35
-        movl      %eax, 4(%esp)                                 #1322.35
-..LN1243:
-        movl      -20(%ebp), %eax                               #1322.42
-        addl      $8, %eax                                      #1322.42
-        movl      %eax, 8(%esp)                                 #1322.42
-..LN1245:
-        movl      20(%ebp), %eax                                #1322.59
-        movl      %eax, 12(%esp)                                #1322.59
-..LN1247:
-        movl      24(%ebp), %eax                                #1322.67
-        movl      %eax, 16(%esp)                                #1322.67
-..LN1249:
-        call      nss_expr                                      #1322.17
-                                # LOE eax
-..B13.45:                       # Preds ..B13.15
-        addl      $20, %esp                                     #1322.17
-        movl      %eax, -40(%ebp)                               #1322.17
-                                # LOE
-..B13.16:                       # Preds ..B13.45
-..LN1251:
-        movl      -40(%ebp), %eax                               #1322.13
-        movl      %eax, 8(%ebp)                                 #1322.13
-..LN1253:
-        movl      20(%ebp), %eax                                #1323.20
-        movl      (%eax), %eax                                  #1323.20
-..LN1255:
-        testl     %eax, %eax                                    #1323.30
-        jne       ..B13.24      # Prob 50%                      #1323.30
-                                # LOE
-..B13.17:                       # Preds ..B13.16
-..LN1257:
-        movl      -20(%ebp), %eax                               #1325.22
-        movl      8(%eax), %eax                                 #1325.22
-..LN1259:
-        testl     %eax, %eax                                    #1325.41
-        je        ..B13.23      # Prob 50%                      #1325.41
-                                # LOE
-..B13.18:                       # Preds ..B13.17
-..LN1261:
-        movl      8(%ebp), %eax                                 #1325.49
-..LN1263:
-        movl      12(%ebp), %edx                                #1325.54
-        cmpl      %edx, %eax                                    #1325.54
-        je        ..B13.23      # Prob 50%                      #1325.54
-                                # LOE
-..B13.19:                       # Preds ..B13.18
-..LN1265:
-        movl      8(%ebp), %eax                                 #1325.63
-        movzbl    (%eax), %eax                                  #1325.63
-        movsbl    %al, %eax                                     #1325.63
-..LN1267:
-        cmpl      $41, %eax                                     #1325.71
-        jne       ..B13.21      # Prob 50%                      #1325.71
-                                # LOE
-..B13.20:                       # Preds ..B13.19
-        movl      $0, -52(%ebp)                                 #1325.71
-        jmp       ..B13.22      # Prob 100%                     #1325.71
-                                # LOE
-..B13.21:                       # Preds ..B13.19
-        movl      $1, -52(%ebp)                                 #1325.71
-                                # LOE
-..B13.22:                       # Preds ..B13.21 ..B13.20
-..LN1269:
-        movl      -52(%ebp), %eax                               #1325.63
-        incl      8(%ebp)                                       #1325.63
-..LN1271:
-        testl     %eax, %eax                                    #1325.71
-        je        ..B13.24      # Prob 100%                     #1325.71
-                                # LOE
-..B13.23:                       # Preds ..B13.17 ..B13.18 ..B13.22
-..LN1273:
-        movl      20(%ebp), %eax                                #1326.21
-        movl      $22, (%eax)                                   #1326.21
-                                # LOE
-..B13.24:                       # Preds ..B13.44 ..B13.23 ..B13.22 ..B13.16
-..LN1275:
-        movl      8(%ebp), %eax                                 #1329.16
-        movl      -4(%ebp), %ebx                                #1329.16
-..___tag_value_nss_primary_expr.236:                            #
-        leave                                                   #1329.16
-..___tag_value_nss_primary_expr.238:                            #
-        ret                                                     #1329.16
-..___tag_value_nss_primary_expr.239:                            #
-                                # LOE
-..B13.25:                       # Preds ..B13.4
-..LN1277:
-        addl      $-20, %esp                                    #1332.9
-        movl      8(%ebp), %eax                                 #1332.9
-        movl      %eax, (%esp)                                  #1332.9
-        movl      12(%ebp), %eax                                #1332.9
-        movl      %eax, 4(%esp)                                 #1332.9
-        movl      16(%ebp), %eax                                #1332.9
-        movl      %eax, 8(%esp)                                 #1332.9
-        movl      20(%ebp), %eax                                #1332.9
-        movl      %eax, 12(%esp)                                #1332.9
-        movl      24(%ebp), %eax                                #1332.9
-        movl      %eax, 16(%esp)                                #1332.9
-        call      nss_fasta_expr                                #1332.9
-                                # LOE eax
-..B13.46:                       # Preds ..B13.25
-        addl      $20, %esp                                     #1332.9
-        movl      %eax, -24(%ebp)                               #1332.9
-                                # LOE
-..B13.26:                       # Preds ..B13.46
-..LN1279:
-        movl      -24(%ebp), %eax                               #1332.5
-        movl      %eax, 8(%ebp)                                 #1332.5
-..LN1281:
-        movl      20(%ebp), %eax                                #1333.12
-        movl      (%eax), %eax                                  #1333.12
-..LN1283:
-        testl     %eax, %eax                                    #1333.22
-        jne       ..B13.35      # Prob 50%                      #1333.22
-                                # LOE
-..B13.27:                       # Preds ..B13.26
-..LN1285:
-        movl      8(%ebp), %eax                                 #1333.27
-..LN1287:
-        movl      12(%ebp), %edx                                #1333.31
-        cmpl      %edx, %eax                                    #1333.31
-        jae       ..B13.35      # Prob 50%                      #1333.31
-                                # LOE
-..B13.28:                       # Preds ..B13.27
-..LN1289:
-        addl      $-8, %esp                                     #1335.13
-..LN1291:
-        movl      8(%ebp), %eax                                 #1335.23
-        movl      %eax, (%esp)                                  #1335.23
-..LN1293:
-        movl      12(%ebp), %eax                                #1335.26
-        movl      %eax, 4(%esp)                                 #1335.26
-..LN1295:
-        call      nss_sob                                       #1335.13
-                                # LOE eax
-..B13.47:                       # Preds ..B13.28
-        addl      $8, %esp                                      #1335.13
-        movl      %eax, -44(%ebp)                               #1335.13
-                                # LOE
-..B13.29:                       # Preds ..B13.47
-..LN1297:
-        movl      -44(%ebp), %eax                               #1335.9
-        movl      %eax, 8(%ebp)                                 #1335.9
-..LN1299:
-        movl      8(%ebp), %eax                                 #1336.14
-..LN1301:
-        movl      12(%ebp), %edx                                #1336.18
-        cmpl      %edx, %eax                                    #1336.18
-        jae       ..B13.35      # Prob 50%                      #1336.18
-                                # LOE
-..B13.30:                       # Preds ..B13.29
-..LN1303:
-        movl      8(%ebp), %eax                                 #1336.27
-        movzbl    (%eax), %eax                                  #1336.27
-        movsbl    %al, %eax                                     #1336.27
-..LN1305:
-        cmpl      $36, %eax                                     #1336.32
-        jne       ..B13.35      # Prob 50%                      #1336.32
-                                # LOE
-..B13.31:                       # Preds ..B13.30
-..LN1307:
-        incl      8(%ebp)                                       #1338.16
-..LN1309:
-        pushl     %edi                                          #1340.17
-..LN1311:
-        movl      $12, (%esp)                                   #1340.26
-..LN1313:
-        movl      -8(%ebp), %eax                                #1340.17
-        movl      %eax, %ebx                                    #1340.17
-        call      malloc at PLT                                    #1340.17
-                                # LOE eax
-..B13.48:                       # Preds ..B13.31
-        popl      %ecx                                          #1340.17
-        movl      %eax, -48(%ebp)                               #1340.17
-                                # LOE
-..B13.32:                       # Preds ..B13.48
-..LN1315:
-        movl      -48(%ebp), %eax                               #1340.13
-        movl      %eax, -20(%ebp)                               #1340.13
-..LN1317:
-        movl      -20(%ebp), %eax                               #1341.18
-..LN1319:
-        testl     %eax, %eax                                    #1341.23
-        jne       ..B13.34      # Prob 50%                      #1341.23
-                                # LOE
-..B13.33:                       # Preds ..B13.32
-..LN1321:
-        movl      -8(%ebp), %eax                                #1342.28
-        movl      %eax, %ebx                                    #1342.28
-        call      __errno_location at PLT                          #1342.28
-                                # LOE eax
-..B13.49:                       # Preds ..B13.33
-..LN1323:
-        movl      20(%ebp), %edx                                #1342.17
-..LN1325:
-        movl      (%eax), %eax                                  #1342.28
-..LN1327:
-        movl      %eax, (%edx)                                  #1342.17
-        jmp       ..B13.35      # Prob 100%                     #1342.17
-                                # LOE
-..B13.34:                       # Preds ..B13.32
-..LN1329:
-        movl      -20(%ebp), %eax                               #1345.17
-        movl      $12, (%eax)                                   #1345.17
-..LN1331:
-        movl      -20(%ebp), %eax                               #1346.17
-        movl      $15, 4(%eax)                                  #1346.17
-..LN1333:
-        movl      16(%ebp), %eax                                #1347.37
-..LN1335:
-        movl      -20(%ebp), %edx                               #1347.17
-..LN1337:
-        movl      (%eax), %eax                                  #1347.37
-..LN1339:
-        movl      %eax, 8(%edx)                                 #1347.17
-..LN1341:
-        movl      16(%ebp), %eax                                #1348.17
-..LN1343:
-        movl      -20(%ebp), %edx                               #1348.26
-..LN1345:
-        movl      %edx, (%eax)                                  #1348.17
-                                # LOE
-..B13.35:                       # Preds ..B13.49 ..B13.34 ..B13.30 ..B13.29 ..B13.27
-                                #       ..B13.26
-..LN1347:
-        movl      8(%ebp), %eax                                 #1353.12
-        movl      -4(%ebp), %ebx                                #1353.12
-..___tag_value_nss_primary_expr.241:                            #
-        leave                                                   #1353.12
-..___tag_value_nss_primary_expr.243:                            #
-        ret                                                     #1353.12
-        .align    2,0x90
-..___tag_value_nss_primary_expr.244:                            #
-                                # LOE
-# mark_end;
-	.type	nss_primary_expr, at function
-	.size	nss_primary_expr,.-nss_primary_expr
-.LNnss_primary_expr:
-	.data
-# -- End  nss_primary_expr
-	.section .rodata, "a"
-	.align 4
-__$U3:
-	.byte	110
-	.byte	115
-	.byte	115
-	.byte	95
-	.byte	117
-	.byte	110
-	.byte	97
-	.byte	114
-	.byte	121
-	.byte	95
-	.byte	101
-	.byte	120
-	.byte	112
-	.byte	114
-	.byte	0
-	.type	__$U3, at object
-	.size	__$U3,15
-	.space 1	# pad
-_2__STRING.4:
-	.byte	42
-	.byte	32
-	.byte	115
-	.byte	116
-	.byte	97
-	.byte	116
-	.byte	117
-	.byte	115
-	.byte	32
-	.byte	33
-	.byte	61
-	.byte	32
-	.byte	48
-	.byte	32
-	.byte	124
-	.byte	124
-	.byte	32
-	.byte	101
-	.byte	32
-	.byte	45
-	.byte	62
-	.byte	32
-	.byte	115
-	.byte	117
-	.byte	98
-	.byte	32
-	.byte	46
-	.byte	32
-	.byte	101
-	.byte	120
-	.byte	112
-	.byte	114
-	.byte	32
-	.byte	33
-	.byte	61
-	.byte	32
-	.byte	40
-	.byte	40
-	.byte	118
-	.byte	111
-	.byte	105
-	.byte	100
-	.byte	32
-	.byte	42
-	.byte	41
-	.byte	48
-	.byte	41
-	.byte	0
-	.type	_2__STRING.4, at object
-	.size	_2__STRING.4,48
-	.text
-# -- Begin  nss_unary_expr
-# mark_begin;
-       .align    2,0x90
-nss_unary_expr:
-# parameter 1(p): 8 + %ebp
-# parameter 2(end): 12 + %ebp
-# parameter 3(expr): 16 + %ebp
-# parameter 4(status): 20 + %ebp
-# parameter 5(positional): 24 + %ebp
-..B14.1:                        # Preds ..B14.0
-..___tag_value_nss_unary_expr.247:                              #
-..LN1349:
-        pushl     %ebp                                          #1361.1
-        movl      %esp, %ebp                                    #1361.1
-..___tag_value_nss_unary_expr.252:                              #
-        subl      $28, %esp                                     #1361.1
-        movl      %ebx, -4(%ebp)                                #1361.1
-..___tag_value_nss_unary_expr.255:                              #
-        call      ..L256        # Prob 100%                     #1361.1
-..L256:                                                         #
-        popl      %eax                                          #1361.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L256], %eax     #1361.1
-        movl      %eax, -8(%ebp)                                #1361.1
-..LN1351:
-        movl      8(%ebp), %eax                                 #1362.5
-        movl      12(%ebp), %edx                                #1362.5
-        cmpl      %edx, %eax                                    #1362.5
-        jb        ..B14.3       # Prob 50%                      #1362.5
-..___tag_value_nss_unary_expr.257:                              #
-                                # LOE
-..B14.2:                        # Preds ..B14.1
-        addl      $-16, %esp                                    #1362.5
-        movl      -8(%ebp), %eax                                #1362.5
-        lea       _2__STRING.3 at GOTOFF(%eax), %eax               #1362.5
-        movl      %eax, (%esp)                                  #1362.5
-        movl      -8(%ebp), %eax                                #1362.5
-        lea       _2__STRING.1 at GOTOFF(%eax), %eax               #1362.5
-        movl      %eax, 4(%esp)                                 #1362.5
-        movl      $1362, 8(%esp)                                #1362.5
-        movl      -8(%ebp), %eax                                #1362.5
-        lea       __$U3 at GOTOFF(%eax), %eax                      #1362.5
-        movl      %eax, 12(%esp)                                #1362.5
-        movl      -8(%ebp), %eax                                #1362.5
-        movl      %eax, %ebx                                    #1362.5
-        call      __assert_fail at PLT                             #1362.5
-                                # LOE
-..B14.19:                       # Preds ..B14.2
-        addl      $16, %esp                                     #1362.5
-..___tag_value_nss_unary_expr.258:                              #
-                                # LOE
-..B14.3:                        # Preds ..B14.1
-..LN1353:
-        movl      8(%ebp), %eax                                 #1363.12
-        movzbl    (%eax), %eax                                  #1363.12
-        movsbl    %al, %eax                                     #1363.12
-..LN1355:
-        cmpl      $33, %eax                                     #1363.17
-        je        ..B14.6       # Prob 50%                      #1363.17
-                                # LOE
-..B14.4:                        # Preds ..B14.3
-..LN1357:
-        addl      $-20, %esp                                    #1364.16
-..LN1359:
-        movl      8(%ebp), %eax                                 #1364.35
-        movl      %eax, (%esp)                                  #1364.35
-..LN1361:
-        movl      12(%ebp), %eax                                #1364.38
-        movl      %eax, 4(%esp)                                 #1364.38
-..LN1363:
-        movl      16(%ebp), %eax                                #1364.43
-        movl      %eax, 8(%esp)                                 #1364.43
-..LN1365:
-        movl      20(%ebp), %eax                                #1364.49
-        movl      %eax, 12(%esp)                                #1364.49
-..LN1367:
-        movl      24(%ebp), %eax                                #1364.57
-        movl      %eax, 16(%esp)                                #1364.57
-..LN1369:
-        call      nss_primary_expr                              #1364.16
-                                # LOE eax
-..B14.20:                       # Preds ..B14.4
-        addl      $20, %esp                                     #1364.16
-        movl      %eax, -16(%ebp)                               #1364.16
-                                # LOE
-..B14.5:                        # Preds ..B14.20
-        movl      -16(%ebp), %eax                               #1364.16
-        movl      -4(%ebp), %ebx                                #1364.16
-..___tag_value_nss_unary_expr.259:                              #
-        leave                                                   #1364.16
-..___tag_value_nss_unary_expr.261:                              #
-        ret                                                     #1364.16
-..___tag_value_nss_unary_expr.262:                              #
-                                # LOE
-..B14.6:                        # Preds ..B14.3
-..LN1371:
-        addl      $-8, %esp                                     #1374.9
-..LN1373:
-        movl      8(%ebp), %eax                                 #1374.19
-        incl      %eax                                          #1374.19
-        movl      %eax, (%esp)                                  #1374.19
-..LN1375:
-        movl      12(%ebp), %eax                                #1374.26
-        movl      %eax, 4(%esp)                                 #1374.26
-..LN1377:
-        call      nss_sob                                       #1374.9
-                                # LOE eax
-..B14.21:                       # Preds ..B14.6
-        addl      $8, %esp                                      #1374.9
-        movl      %eax, -12(%ebp)                               #1374.9
-                                # LOE
-..B14.7:                        # Preds ..B14.21
-..LN1379:
-        movl      -12(%ebp), %eax                               #1374.5
-        movl      %eax, 8(%ebp)                                 #1374.5
-..LN1381:
-        movl      8(%ebp), %eax                                 #1375.10
-..LN1383:
-        movl      12(%ebp), %edx                                #1375.15
-        cmpl      %edx, %eax                                    #1375.15
-        jne       ..B14.9       # Prob 50%                      #1375.15
-                                # LOE
-..B14.8:                        # Preds ..B14.7
-..LN1385:
-        movl      20(%ebp), %eax                                #1376.9
-        movl      $22, (%eax)                                   #1376.9
-        jmp       ..B14.16      # Prob 100%                     #1376.9
-                                # LOE
-..B14.9:                        # Preds ..B14.7
-..LN1387:
-        pushl     %edi                                          #1379.25
-..LN1389:
-        movl      $12, (%esp)                                   #1379.34
-..LN1391:
-        movl      -8(%ebp), %eax                                #1379.25
-        movl      %eax, %ebx                                    #1379.25
-        call      malloc at PLT                                    #1379.25
-                                # LOE eax
-..B14.22:                       # Preds ..B14.9
-        popl      %ecx                                          #1379.25
-        movl      %eax, -20(%ebp)                               #1379.25
-                                # LOE
-..B14.10:                       # Preds ..B14.22
-..LN1393:
-        movl      -20(%ebp), %eax                               #1379.23
-        movl      %eax, -24(%ebp)                               #1379.23
-..LN1395:
-        movl      -24(%ebp), %eax                               #1380.14
-..LN1397:
-        testl     %eax, %eax                                    #1380.19
-        jne       ..B14.12      # Prob 50%                      #1380.19
-                                # LOE
-..B14.11:                       # Preds ..B14.10
-..LN1399:
-        movl      -8(%ebp), %eax                                #1381.24
-        movl      %eax, %ebx                                    #1381.24
-        call      __errno_location at PLT                          #1381.24
-                                # LOE eax
-..B14.23:                       # Preds ..B14.11
-..LN1401:
-        movl      20(%ebp), %edx                                #1381.13
-..LN1403:
-        movl      (%eax), %eax                                  #1381.24
-..LN1405:
-        movl      %eax, (%edx)                                  #1381.13
-        jmp       ..B14.16      # Prob 100%                     #1381.13
-                                # LOE
-..B14.12:                       # Preds ..B14.10
-..LN1407:
-        movl      -24(%ebp), %eax                               #1384.13
-        movl      $12, (%eax)                                   #1384.13
-..LN1409:
-        movl      -24(%ebp), %eax                               #1385.13
-        movl      $13, 4(%eax)                                  #1385.13
-..LN1411:
-        movl      -24(%ebp), %eax                               #1386.13
-        movl      $0, 8(%eax)                                   #1386.13
-..LN1413:
-        movl      16(%ebp), %eax                                #1387.13
-..LN1415:
-        movl      -24(%ebp), %edx                               #1387.22
-..LN1417:
-        movl      %edx, (%eax)                                  #1387.13
-..LN1419:
-        addl      $-20, %esp                                    #1389.17
-..LN1421:
-        movl      8(%ebp), %eax                                 #1389.34
-        movl      %eax, (%esp)                                  #1389.34
-..LN1423:
-        movl      12(%ebp), %eax                                #1389.37
-        movl      %eax, 4(%esp)                                 #1389.37
-..LN1425:
-        movl      -24(%ebp), %eax                               #1389.44
-        addl      $8, %eax                                      #1389.44
-        movl      %eax, 8(%esp)                                 #1389.44
-..LN1427:
-        movl      20(%ebp), %eax                                #1389.61
-        movl      %eax, 12(%esp)                                #1389.61
-..LN1429:
-        movl      24(%ebp), %eax                                #1389.69
-        movl      %eax, 16(%esp)                                #1389.69
-..LN1431:
-        call      nss_unary_expr                                #1389.17
-                                # LOE eax
-..B14.24:                       # Preds ..B14.12
-        addl      $20, %esp                                     #1389.17
-        movl      %eax, -28(%ebp)                               #1389.17
-                                # LOE
-..B14.13:                       # Preds ..B14.24
-..LN1433:
-        movl      -28(%ebp), %eax                               #1389.13
-        movl      %eax, 8(%ebp)                                 #1389.13
-..LN1435:
-        movl      20(%ebp), %eax                                #1390.13
-        movl      (%eax), %eax                                  #1390.13
-        testl     %eax, %eax                                    #1390.13
-        jne       ..B14.16      # Prob 50%                      #1390.13
-                                # LOE
-..B14.14:                       # Preds ..B14.13
-        movl      -24(%ebp), %eax                               #1390.13
-        movl      8(%eax), %eax                                 #1390.13
-        testl     %eax, %eax                                    #1390.13
-        jne       ..B14.16      # Prob 50%                      #1390.13
-..___tag_value_nss_unary_expr.264:                              #
-                                # LOE
-..B14.15:                       # Preds ..B14.14
-        addl      $-16, %esp                                    #1390.13
-        movl      -8(%ebp), %eax                                #1390.13
-        lea       _2__STRING.4 at GOTOFF(%eax), %eax               #1390.13
-        movl      %eax, (%esp)                                  #1390.13
-        movl      -8(%ebp), %eax                                #1390.13
-        lea       _2__STRING.1 at GOTOFF(%eax), %eax               #1390.13
-        movl      %eax, 4(%esp)                                 #1390.13
-        movl      $1390, 8(%esp)                                #1390.13
-        movl      -8(%ebp), %eax                                #1390.13
-        lea       __$U3 at GOTOFF(%eax), %eax                      #1390.13
-        movl      %eax, 12(%esp)                                #1390.13
-        movl      -8(%ebp), %eax                                #1390.13
-        movl      %eax, %ebx                                    #1390.13
-        call      __assert_fail at PLT                             #1390.13
-                                # LOE
-..B14.25:                       # Preds ..B14.15
-        addl      $16, %esp                                     #1390.13
-..___tag_value_nss_unary_expr.265:                              #
-                                # LOE
-..B14.16:                       # Preds ..B14.23 ..B14.8 ..B14.14 ..B14.13
-..LN1437:
-        movl      8(%ebp), %eax                                 #1393.12
-        movl      -4(%ebp), %ebx                                #1393.12
-..___tag_value_nss_unary_expr.266:                              #
-        leave                                                   #1393.12
-..___tag_value_nss_unary_expr.268:                              #
-        ret                                                     #1393.12
-        .align    2,0x90
-..___tag_value_nss_unary_expr.269:                              #
-                                # LOE
-# mark_end;
-	.type	nss_unary_expr, at function
-	.size	nss_unary_expr,.-nss_unary_expr
-.LNnss_unary_expr:
-	.data
-# -- End  nss_unary_expr
-	.section .rodata, "a"
-	.align 4
-__$U4:
-	.byte	110
-	.byte	115
-	.byte	115
-	.byte	95
-	.byte	101
-	.byte	120
-	.byte	112
-	.byte	114
-	.byte	0
-	.type	__$U4, at object
-	.size	__$U4,9
-	.space 3	# pad
-_2__STRING.5:
-	.byte	42
-	.byte	32
-	.byte	101
-	.byte	120
-	.byte	112
-	.byte	114
-	.byte	32
-	.byte	33
-	.byte	61
-	.byte	32
-	.byte	40
-	.byte	40
-	.byte	118
-	.byte	111
-	.byte	105
-	.byte	100
-	.byte	32
-	.byte	42
-	.byte	41
-	.byte	48
-	.byte	41
-	.byte	0
-	.type	_2__STRING.5, at object
-	.size	_2__STRING.5,22
-	.space 2	# pad
-_2__STRING.6:
-	.byte	42
-	.byte	32
-	.byte	115
-	.byte	116
-	.byte	97
-	.byte	116
-	.byte	117
-	.byte	115
-	.byte	32
-	.byte	33
-	.byte	61
-	.byte	32
-	.byte	48
-	.byte	32
-	.byte	124
-	.byte	124
-	.byte	32
-	.byte	101
-	.byte	32
-	.byte	45
-	.byte	62
-	.byte	32
-	.byte	98
-	.byte	111
-	.byte	111
-	.byte	108
-	.byte	101
-	.byte	97
-	.byte	110
-	.byte	32
-	.byte	46
-	.byte	32
-	.byte	114
-	.byte	105
-	.byte	103
-	.byte	104
-	.byte	116
-	.byte	32
-	.byte	33
-	.byte	61
-	.byte	32
-	.byte	40
-	.byte	40
-	.byte	118
-	.byte	111
-	.byte	105
-	.byte	100
-	.byte	32
-	.byte	42
-	.byte	41
-	.byte	48
-	.byte	41
-	.byte	0
-	.type	_2__STRING.6, at object
-	.size	_2__STRING.6,53
-	.text
-# -- Begin  nss_expr
-# mark_begin;
-       .align    2,0x90
-nss_expr:
-# parameter 1(p): 8 + %ebp
-# parameter 2(end): 12 + %ebp
-# parameter 3(expr): 16 + %ebp
-# parameter 4(status): 20 + %ebp
-# parameter 5(positional): 24 + %ebp
-..B15.1:                        # Preds ..B15.0
-..___tag_value_nss_expr.272:                                    #
-..LN1439:
-        pushl     %ebp                                          #1406.1
-        movl      %esp, %ebp                                    #1406.1
-..___tag_value_nss_expr.277:                                    #
-        subl      $48, %esp                                     #1406.1
-        movl      %ebx, -4(%ebp)                                #1406.1
-..___tag_value_nss_expr.280:                                    #
-..LN1441:
-        movl      16(%ebp), %eax                                #1407.5
-        movl      $0, (%eax)                                    #1407.5
-..LN1443:
-        addl      $0, %esp                                      #1409.9
-..LN1445:
-        movl      8(%ebp), %eax                                 #1409.19
-        movl      %eax, (%esp)                                  #1409.19
-..LN1447:
-        movl      12(%ebp), %eax                                #1409.22
-        movl      %eax, 4(%esp)                                 #1409.22
-..LN1449:
-        call      nss_sob                                       #1409.9
-                                # LOE eax
-..B15.32:                       # Preds ..B15.1
-        addl      $8, %esp                                      #1409.9
-        movl      %eax, -8(%ebp)                                #1409.9
-                                # LOE
-..B15.2:                        # Preds ..B15.32
-..LN1451:
-        movl      -8(%ebp), %eax                                #1409.5
-        movl      %eax, 8(%ebp)                                 #1409.5
-..LN1453:
-        movl      8(%ebp), %eax                                 #1410.10
-..LN1455:
-        movl      12(%ebp), %edx                                #1410.15
-        cmpl      %edx, %eax                                    #1410.15
-        je        ..B15.29      # Prob 50%                      #1410.15
-                                # LOE
-..B15.3:                        # Preds ..B15.2
-..LN1457:
-        addl      $-20, %esp                                    #1412.13
-..LN1459:
-        movl      8(%ebp), %eax                                 #1412.30
-        movl      %eax, (%esp)                                  #1412.30
-..LN1461:
-        movl      12(%ebp), %eax                                #1412.33
-        movl      %eax, 4(%esp)                                 #1412.33
-..LN1463:
-        movl      16(%ebp), %eax                                #1412.38
-        movl      %eax, 8(%esp)                                 #1412.38
-..LN1465:
-        movl      20(%ebp), %eax                                #1412.44
-        movl      %eax, 12(%esp)                                #1412.44
-..LN1467:
-        movl      24(%ebp), %eax                                #1412.52
-        movl      %eax, 16(%esp)                                #1412.52
-..LN1469:
-        call      nss_unary_expr                                #1412.13
-                                # LOE eax
-..B15.33:                       # Preds ..B15.3
-        addl      $20, %esp                                     #1412.13
-        movl      %eax, -12(%ebp)                               #1412.13
-                                # LOE
-..B15.4:                        # Preds ..B15.33
-..LN1471:
-        movl      -12(%ebp), %eax                               #1412.9
-        movl      %eax, 8(%ebp)                                 #1412.9
-..LN1473:
-        movl      20(%ebp), %eax                                #1413.16
-        movl      (%eax), %eax                                  #1413.16
-..LN1475:
-        testl     %eax, %eax                                    #1413.26
-        jne       ..B15.29      # Prob 50%                      #1413.26
-                                # LOE
-..B15.5:                        # Preds ..B15.4
-..LN1477:
-        addl      $-8, %esp                                     #1415.17
-..LN1479:
-        movl      8(%ebp), %eax                                 #1415.27
-        movl      %eax, (%esp)                                  #1415.27
-..LN1481:
-        movl      12(%ebp), %eax                                #1415.30
-        movl      %eax, 4(%esp)                                 #1415.30
-..LN1483:
-        call      nss_sob                                       #1415.17
-                                # LOE eax
-..B15.34:                       # Preds ..B15.5
-        addl      $8, %esp                                      #1415.17
-        movl      %eax, -16(%ebp)                               #1415.17
-                                # LOE
-..B15.6:                        # Preds ..B15.34
-..LN1485:
-        movl      -16(%ebp), %eax                               #1415.13
-        movl      %eax, 8(%ebp)                                 #1415.13
-..LN1487:
-        movl      8(%ebp), %eax                                 #1416.18
-..LN1489:
-        movl      12(%ebp), %edx                                #1416.23
-        cmpl      %edx, %eax                                    #1416.23
-        je        ..B15.29      # Prob 50%                      #1416.23
-                                # LOE
-..B15.7:                        # Preds ..B15.6
-        call      ..L281        # Prob 100%                     #
-..L281:                                                         #
-        popl      %eax                                          #
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L281], %eax     #
-        movl      %eax, -20(%ebp)                               #
-..LN1491:
-        movl      16(%ebp), %eax                                #1420.17
-        movl      (%eax), %eax                                  #1420.17
-        testl     %eax, %eax                                    #1420.17
-        jne       ..B15.9       # Prob 50%                      #1420.17
-..___tag_value_nss_expr.282:                                    #
-                                # LOE
-..B15.8:                        # Preds ..B15.7
-        addl      $-16, %esp                                    #1420.17
-        movl      -20(%ebp), %eax                               #1420.17
-        lea       _2__STRING.5 at GOTOFF(%eax), %eax               #1420.17
-        movl      %eax, (%esp)                                  #1420.17
-        movl      -20(%ebp), %eax                               #1420.17
-        lea       _2__STRING.1 at GOTOFF(%eax), %eax               #1420.17
-        movl      %eax, 4(%esp)                                 #1420.17
-        movl      $1420, 8(%esp)                                #1420.17
-        movl      -20(%ebp), %eax                               #1420.17
-        lea       __$U4 at GOTOFF(%eax), %eax                      #1420.17
-        movl      %eax, 12(%esp)                                #1420.17
-        movl      -20(%ebp), %eax                               #1420.17
-        movl      %eax, %ebx                                    #1420.17
-        call      __assert_fail at PLT                             #1420.17
-                                # LOE
-..B15.35:                       # Preds ..B15.8
-        addl      $16, %esp                                     #1420.17
-..___tag_value_nss_expr.283:                                    #
-                                # LOE
-..B15.9:                        # Preds ..B15.7
-..LN1493:
-        movl      8(%ebp), %eax                                 #1422.28
-        movzbl    (%eax), %eax                                  #1422.28
-        movsbl    %al, %eax                                     #1422.28
-        movl      %eax, -24(%ebp)                               #1422.28
-        incl      8(%ebp)                                       #1422.28
-        cmpl      $41, %eax                                     #1422.28
-        je        ..B15.12      # Prob 50%                      #1422.28
-                                # LOE
-..B15.10:                       # Preds ..B15.9
-        movl      -24(%ebp), %eax                               #1422.28
-        cmpl      $38, %eax                                     #1422.28
-        je        ..B15.13      # Prob 50%                      #1422.28
-                                # LOE
-..B15.11:                       # Preds ..B15.10
-        movl      -24(%ebp), %eax                               #1422.28
-        cmpl      $124, %eax                                    #1422.28
-        je        ..B15.17      # Prob 50%                      #1422.28
-        jmp       ..B15.21      # Prob 100%                     #1422.28
-                                # LOE
-..B15.12:                       # Preds ..B15.9
-..LN1495:
-        movl      8(%ebp), %eax                                 #1425.28
-..LN1497:
-        decl      %eax                                          #1425.32
-        movl      -4(%ebp), %ebx                                #1425.32
-..___tag_value_nss_expr.284:                                    #
-        leave                                                   #1425.32
-..___tag_value_nss_expr.286:                                    #
-        ret                                                     #1425.32
-..___tag_value_nss_expr.287:                                    #
-                                # LOE
-..B15.13:                       # Preds ..B15.10
-..LN1499:
-        movl      8(%ebp), %eax                                 #1427.26
-..LN1501:
-        movl      12(%ebp), %edx                                #1427.30
-        cmpl      %edx, %eax                                    #1427.30
-        jae       ..B15.16      # Prob 50%                      #1427.30
-                                # LOE
-..B15.14:                       # Preds ..B15.13
-..LN1503:
-        movl      8(%ebp), %eax                                 #1427.39
-        movzbl    (%eax), %eax                                  #1427.39
-        movsbl    %al, %eax                                     #1427.39
-..LN1505:
-        cmpl      $38, %eax                                     #1427.44
-        jne       ..B15.16      # Prob 50%                      #1427.44
-                                # LOE
-..B15.15:                       # Preds ..B15.14
-..LN1507:
-        incl      8(%ebp)                                       #1428.28
-                                # LOE
-..B15.16:                       # Preds ..B15.15 ..B15.14 ..B15.13
-..LN1509:
-        movl      $16, -36(%ebp)                                #1429.21
-        jmp       ..B15.22      # Prob 100%                     #1429.21
-                                # LOE
-..B15.17:                       # Preds ..B15.11
-..LN1511:
-        movl      8(%ebp), %eax                                 #1432.26
-..LN1513:
-        movl      12(%ebp), %edx                                #1432.30
-        cmpl      %edx, %eax                                    #1432.30
-        jae       ..B15.20      # Prob 50%                      #1432.30
-                                # LOE
-..B15.18:                       # Preds ..B15.17
-..LN1515:
-        movl      8(%ebp), %eax                                 #1432.39
-        movzbl    (%eax), %eax                                  #1432.39
-        movsbl    %al, %eax                                     #1432.39
-..LN1517:
-        cmpl      $124, %eax                                    #1432.44
-        jne       ..B15.20      # Prob 50%                      #1432.44
-                                # LOE
-..B15.19:                       # Preds ..B15.18
-..LN1519:
-        incl      8(%ebp)                                       #1433.28
-                                # LOE
-..B15.20:                       # Preds ..B15.19 ..B15.18 ..B15.17
-..LN1521:
-        movl      $17, -36(%ebp)                                #1434.21
-        jmp       ..B15.22      # Prob 100%                     #1434.21
-                                # LOE
-..B15.21:                       # Preds ..B15.11
-..LN1523:
-        movl      20(%ebp), %eax                                #1438.21
-        movl      $22, (%eax)                                   #1438.21
-..LN1525:
-        movl      8(%ebp), %eax                                 #1439.28
-..LN1527:
-        decl      %eax                                          #1439.32
-        movl      -4(%ebp), %ebx                                #1439.32
-..___tag_value_nss_expr.289:                                    #
-        leave                                                   #1439.32
-..___tag_value_nss_expr.291:                                    #
-        ret                                                     #1439.32
-..___tag_value_nss_expr.292:                                    #
-                                # LOE
-..B15.22:                       # Preds ..B15.16 ..B15.20
-..LN1529:
-        pushl     %edi                                          #1451.21
-..LN1531:
-        movl      $16, (%esp)                                   #1451.30
-..LN1533:
-        movl      -20(%ebp), %eax                               #1451.21
-        movl      %eax, %ebx                                    #1451.21
-        call      malloc at PLT                                    #1451.21
-                                # LOE eax
-..B15.36:                       # Preds ..B15.22
-        popl      %ecx                                          #1451.21
-        movl      %eax, -28(%ebp)                               #1451.21
-                                # LOE
-..B15.23:                       # Preds ..B15.36
-..LN1535:
-        movl      -28(%ebp), %eax                               #1451.17
-        movl      %eax, -32(%ebp)                               #1451.17
-..LN1537:
-        movl      -32(%ebp), %eax                               #1452.22
-..LN1539:
-        testl     %eax, %eax                                    #1452.27
-        jne       ..B15.25      # Prob 50%                      #1452.27
-                                # LOE
-..B15.24:                       # Preds ..B15.23
-..LN1541:
-        movl      -20(%ebp), %eax                               #1454.32
-        movl      %eax, %ebx                                    #1454.32
-        call      __errno_location at PLT                          #1454.32
-                                # LOE eax
-..B15.37:                       # Preds ..B15.24
-..LN1543:
-        movl      20(%ebp), %edx                                #1454.21
-..LN1545:
-        movl      (%eax), %eax                                  #1454.32
-..LN1547:
-        movl      %eax, (%edx)                                  #1454.21
-..LN1549:
-        movl      8(%ebp), %eax                                 #1455.28
-        movl      -4(%ebp), %ebx                                #1455.28
-..___tag_value_nss_expr.294:                                    #
-        leave                                                   #1455.28
-..___tag_value_nss_expr.296:                                    #
-        ret                                                     #1455.28
-..___tag_value_nss_expr.297:                                    #
-                                # LOE
-..B15.25:                       # Preds ..B15.23
-..LN1551:
-        movl      -32(%ebp), %eax                               #1458.17
-        movl      $11, (%eax)                                   #1458.17
-..LN1553:
-        movl      -32(%ebp), %eax                               #1459.17
-..LN1555:
-        movl      -36(%ebp), %edx                               #1459.37
-..LN1557:
-        movl      %edx, 4(%eax)                                 #1459.17
-..LN1559:
-        movl      16(%ebp), %eax                                #1460.41
-..LN1561:
-        movl      -32(%ebp), %edx                               #1460.17
-..LN1563:
-        movl      (%eax), %eax                                  #1460.41
-..LN1565:
-        movl      %eax, 8(%edx)                                 #1460.17
-..LN1567:
-        movl      16(%ebp), %eax                                #1461.17
-..LN1569:
-        movl      -32(%ebp), %edx                               #1461.26
-..LN1571:
-        movl      %edx, (%eax)                                  #1461.17
-..LN1573:
-        addl      $-20, %esp                                    #1464.21
-..LN1575:
-        movl      8(%ebp), %eax                                 #1464.32
-        movl      %eax, (%esp)                                  #1464.32
-..LN1577:
-        movl      12(%ebp), %eax                                #1464.35
-        movl      %eax, 4(%esp)                                 #1464.35
-..LN1579:
-        movl      -32(%ebp), %eax                               #1464.42
-        addl      $12, %eax                                     #1464.42
-        movl      %eax, 8(%esp)                                 #1464.42
-..LN1581:
-        movl      20(%ebp), %eax                                #1464.64
-        movl      %eax, 12(%esp)                                #1464.64
-..LN1583:
-        movl      24(%ebp), %eax                                #1464.72
-        movl      %eax, 16(%esp)                                #1464.72
-..LN1585:
-        call      nss_expr                                      #1464.21
-                                # LOE eax
-..B15.38:                       # Preds ..B15.25
-        addl      $20, %esp                                     #1464.21
-        movl      %eax, -40(%ebp)                               #1464.21
-                                # LOE
-..B15.26:                       # Preds ..B15.38
-..LN1587:
-        movl      -40(%ebp), %eax                               #1464.17
-        movl      %eax, 8(%ebp)                                 #1464.17
-..LN1589:
-        movl      20(%ebp), %eax                                #1465.17
-        movl      (%eax), %eax                                  #1465.17
-        testl     %eax, %eax                                    #1465.17
-        jne       ..B15.29      # Prob 50%                      #1465.17
-                                # LOE
-..B15.27:                       # Preds ..B15.26
-        movl      -32(%ebp), %eax                               #1465.17
-        movl      12(%eax), %eax                                #1465.17
-        testl     %eax, %eax                                    #1465.17
-        jne       ..B15.29      # Prob 50%                      #1465.17
-..___tag_value_nss_expr.299:                                    #
-                                # LOE
-..B15.28:                       # Preds ..B15.27
-        addl      $-16, %esp                                    #1465.17
-        movl      -20(%ebp), %eax                               #1465.17
-        lea       _2__STRING.6 at GOTOFF(%eax), %eax               #1465.17
-        movl      %eax, (%esp)                                  #1465.17
-        movl      -20(%ebp), %eax                               #1465.17
-        lea       _2__STRING.1 at GOTOFF(%eax), %eax               #1465.17
-        movl      %eax, 4(%esp)                                 #1465.17
-        movl      $1465, 8(%esp)                                #1465.17
-        movl      -20(%ebp), %eax                               #1465.17
-        lea       __$U4 at GOTOFF(%eax), %eax                      #1465.17
-        movl      %eax, 12(%esp)                                #1465.17
-        movl      -20(%ebp), %eax                               #1465.17
-        movl      %eax, %ebx                                    #1465.17
-        call      __assert_fail at PLT                             #1465.17
-                                # LOE
-..B15.39:                       # Preds ..B15.28
-        addl      $16, %esp                                     #1465.17
-..___tag_value_nss_expr.300:                                    #
-                                # LOE
-..B15.29:                       # Preds ..B15.27 ..B15.26 ..B15.6 ..B15.4 ..B15.2
-                                #      
-..LN1591:
-        movl      8(%ebp), %eax                                 #1470.12
-        movl      -4(%ebp), %ebx                                #1470.12
-..___tag_value_nss_expr.301:                                    #
-        leave                                                   #1470.12
-..___tag_value_nss_expr.303:                                    #
-        ret                                                     #1470.12
-        .align    2,0x90
-..___tag_value_nss_expr.304:                                    #
-                                # LOE
-# mark_end;
-	.type	nss_expr, at function
-	.size	nss_expr,.-nss_expr
-.LNnss_expr:
-	.data
-# -- End  nss_expr
-	.section .rodata, "a"
-	.align 4
-_2__STRING.7:
-	.byte	65
-	.byte	67
-	.byte	71
-	.byte	84
-	.byte	0
-	.type	_2__STRING.7, at object
-	.size	_2__STRING.7,5
-	.space 3	# pad
-_2__STRING.8:
-	.byte	45
-	.byte	65
-	.byte	67
-	.byte	77
-	.byte	71
-	.byte	82
-	.byte	83
-	.byte	86
-	.byte	84
-	.byte	87
-	.byte	89
-	.byte	72
-	.byte	75
-	.byte	68
-	.byte	66
-	.byte	78
-	.byte	0
-	.type	_2__STRING.8, at object
-	.size	_2__STRING.8,17
-	.text
-# -- Begin  NucStrstrInit
-# mark_begin;
-       .align    2,0x90
-NucStrstrInit:
-..B16.1:                        # Preds ..B16.0
-..___tag_value_NucStrstrInit.307:                               #
-..LN1593:
-        pushl     %ebp                                          #1484.1
-        movl      %esp, %ebp                                    #1484.1
-..___tag_value_NucStrstrInit.312:                               #
-        subl      $64, %esp                                     #1484.1
-        movl      %ebx, -12(%ebp)                               #1484.1
-..___tag_value_NucStrstrInit.315:                               #
-        call      ..L316        # Prob 100%                     #1484.1
-..L316:                                                         #
-        popl      %eax                                          #1484.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L316], %eax     #1484.1
-        movl      %eax, -32(%ebp)                               #1484.1
-..LN1595:
-        lea       _2__STRING.7 at GOTOFF(%eax), %edx               #1487.29
-        movl      %edx, -52(%ebp)                               #1487.29
-..LN1597:
-        lea       _2__STRING.8 at GOTOFF(%eax), %edx               #1488.25
-        movl      %edx, -48(%ebp)                               #1488.25
-..LN1599:
-        addl      $0, %esp                                      #1491.5
-..LN1601:
-        lea       fasta_2na_map at GOTOFF(%eax), %edx              #1491.14
-        movl      %edx, (%esp)                                  #1491.14
-..LN1603:
-        movl      $-1, 4(%esp)                                  #1491.29
-..LN1605:
-        movl      $128, 8(%esp)                                 #1491.33
-..LN1607:
-        movl      %eax, %ebx                                    #1491.5
-        call      memset at PLT                                    #1491.5
-                                # LOE
-..B16.20:                       # Preds ..B16.1
-        addl      $12, %esp                                     #1491.5
-                                # LOE
-..B16.2:                        # Preds ..B16.20
-..LN1609:
-        addl      $-12, %esp                                    #1492.5
-..LN1611:
-        movl      -32(%ebp), %eax                               #1492.14
-        lea       fasta_4na_map at GOTOFF(%eax), %eax              #1492.14
-        movl      %eax, (%esp)                                  #1492.14
-..LN1613:
-        movl      $-1, 4(%esp)                                  #1492.29
-..LN1615:
-        movl      $128, 8(%esp)                                 #1492.33
-..LN1617:
-        movl      -32(%ebp), %eax                               #1492.5
-        movl      %eax, %ebx                                    #1492.5
-        call      memset at PLT                                    #1492.5
-                                # LOE
-..B16.21:                       # Preds ..B16.2
-        addl      $12, %esp                                     #1492.5
-                                # LOE
-..B16.3:                        # Preds ..B16.21
-..LN1619:
-        movl      $0, -44(%ebp)                                 #1495.11
-..LN1621:
-        movl      -52(%ebp), %eax                               #1495.22
-..LN1623:
-        movl      %eax, -40(%ebp)                               #1495.18
-..LN1625:
-        movl      -40(%ebp), %eax                               #1495.31
-        movzbl    (%eax), %eax                                  #1495.31
-        movsbl    %al, %eax                                     #1495.31
-..LN1627:
-        testl     %eax, %eax                                    #1495.42
-        je        ..B16.7       # Prob 50%                      #1495.42
-                                # LOE
-..B16.5:                        # Preds ..B16.3 ..B16.6
-..LN1629:
-        movl      -40(%ebp), %eax                               #1497.14
-        movzbl    (%eax), %eax                                  #1497.14
-        movsbl    %al, %eax                                     #1497.14
-..LN1631:
-        movl      %eax, -36(%ebp)                               #1497.9
-..LN1633:
-        movl      -44(%ebp), %eax                               #1498.78
-        movsbl    %al, %eax                                     #1498.78
-        movl      %eax, -28(%ebp)                               #1498.78
-..LN1635:
-        pushl     %edi                                          #1498.48
-..LN1637:
-        movl      -36(%ebp), %eax                               #1498.58
-        movl      %eax, (%esp)                                  #1498.58
-..LN1639:
-        movl      -32(%ebp), %eax                               #1498.48
-        movl      %eax, %ebx                                    #1498.48
-        call      tolower at PLT                                   #1498.48
-                                # LOE eax
-..B16.22:                       # Preds ..B16.5
-        popl      %ecx                                          #1498.48
-        movl      %eax, -24(%ebp)                               #1498.48
-                                # LOE
-..B16.6:                        # Preds ..B16.22
-..LN1641:
-        movl      -32(%ebp), %eax                               #1498.32
-        movl      -28(%ebp), %edx                               #1498.32
-        movl      -24(%ebp), %ecx                               #1498.32
-        movb      %dl, fasta_2na_map at GOTOFF(%ecx,%eax)          #1498.32
-..LN1643:
-        movl      -36(%ebp), %eax                               #1498.25
-..LN1645:
-        movl      -32(%ebp), %edx                               #1498.9
-        movl      -28(%ebp), %ecx                               #1498.9
-        movb      %cl, fasta_2na_map at GOTOFF(%eax,%edx)          #1498.9
-..LN1647:
-        incl      -44(%ebp)                                     #1495.48
-..LN1649:
-        incl      -40(%ebp)                                     #1495.54
-..LN1651:
-        movl      -40(%ebp), %eax                               #1495.31
-        movzbl    (%eax), %eax                                  #1495.31
-        movsbl    %al, %eax                                     #1495.31
-..LN1653:
-        testl     %eax, %eax                                    #1495.42
-        jne       ..B16.5       # Prob 50%                      #1495.42
-                                # LOE
-..B16.7:                        # Preds ..B16.6 ..B16.3
-..LN1655:
-        movl      $0, -44(%ebp)                                 #1502.11
-..LN1657:
-        movl      -48(%ebp), %eax                               #1502.22
-..LN1659:
-        movl      %eax, -40(%ebp)                               #1502.18
-..LN1661:
-        movl      -40(%ebp), %eax                               #1502.31
-        movzbl    (%eax), %eax                                  #1502.31
-        movsbl    %al, %eax                                     #1502.31
-..LN1663:
-        testl     %eax, %eax                                    #1502.42
-        je        ..B16.11      # Prob 50%                      #1502.42
-                                # LOE
-..B16.9:                        # Preds ..B16.7 ..B16.10
-..LN1665:
-        movl      -40(%ebp), %eax                               #1504.14
-        movzbl    (%eax), %eax                                  #1504.14
-        movsbl    %al, %eax                                     #1504.14
-..LN1667:
-        movl      %eax, -36(%ebp)                               #1504.9
-..LN1669:
-        movl      -44(%ebp), %eax                               #1505.78
-        movsbl    %al, %eax                                     #1505.78
-        movl      %eax, -20(%ebp)                               #1505.78
-..LN1671:
-        pushl     %edi                                          #1505.48
-..LN1673:
-        movl      -36(%ebp), %eax                               #1505.58
-        movl      %eax, (%esp)                                  #1505.58
-..LN1675:
-        movl      -32(%ebp), %eax                               #1505.48
-        movl      %eax, %ebx                                    #1505.48
-        call      tolower at PLT                                   #1505.48
-                                # LOE eax
-..B16.23:                       # Preds ..B16.9
-        popl      %ecx                                          #1505.48
-        movl      %eax, -16(%ebp)                               #1505.48
-                                # LOE
-..B16.10:                       # Preds ..B16.23
-..LN1677:
-        movl      -32(%ebp), %eax                               #1505.32
-        movl      -20(%ebp), %edx                               #1505.32
-        movl      -16(%ebp), %ecx                               #1505.32
-        movb      %dl, fasta_4na_map at GOTOFF(%ecx,%eax)          #1505.32
-..LN1679:
-        movl      -36(%ebp), %eax                               #1505.25
-..LN1681:
-        movl      -32(%ebp), %edx                               #1505.9
-        movl      -20(%ebp), %ecx                               #1505.9
-        movb      %cl, fasta_4na_map at GOTOFF(%eax,%edx)          #1505.9
-..LN1683:
-        incl      -44(%ebp)                                     #1502.48
-..LN1685:
-        incl      -40(%ebp)                                     #1502.54
-..LN1687:
-        movl      -40(%ebp), %eax                               #1502.31
-        movzbl    (%eax), %eax                                  #1502.31
-        movsbl    %al, %eax                                     #1502.31
-..LN1689:
-        testl     %eax, %eax                                    #1502.42
-        jne       ..B16.9       # Prob 50%                      #1502.42
-                                # LOE
-..B16.11:                       # Preds ..B16.10 ..B16.7
-..LN1691:
-        movl      $0, -44(%ebp)                                 #1510.11
-..LN1693:
-        movl      -44(%ebp), %eax                               #1510.18
-..LN1695:
-        cmpl      $256, %eax                                    #1510.22
-        jae       ..B16.17      # Prob 50%                      #1510.22
-                                # LOE
-..B16.13:                       # Preds ..B16.11 ..B16.16
-..LN1697:
-        movl      -44(%ebp), %eax                               #1511.28
-        movl      -32(%ebp), %edx                               #1511.28
-        movzwl    expand_2na at GOTOFF(%edx,%eax,2), %eax          #1511.28
-        movw      %ax, -8(%ebp)                                 #1511.28
-        xorl      %eax, %eax                                    #1511.28
-        testl     %eax, %eax                                    #1511.28
-        jne       ..B16.15      # Prob 50%                      #1511.28
-                                # LOE
-..B16.14:                       # Preds ..B16.13
-..LN1699:
-        movzwl    -8(%ebp), %eax                                #1511.0
-# Begin ASM
-        rorw $8, %ax
-# End ASM                                                       #1511.0
-        movw      %ax, -4(%ebp)                                 #1511.0
-        jmp       ..B16.16      # Prob 100%                     #1511.0
-                                # LOE
-..B16.15:                       # Preds ..B16.13
-..LN1701:
-        movzwl    -8(%ebp), %eax                                #1511.28
-        shrl      $8, %eax                                      #1511.28
-        movzbl    %al, %eax                                     #1511.28
-        movzwl    -8(%ebp), %edx                                #1511.28
-        movzbl    %dl, %edx                                     #1511.28
-        shll      $8, %edx                                      #1511.28
-        orl       %edx, %eax                                    #1511.28
-        movw      %ax, -4(%ebp)                                 #1511.28
-                                # LOE
-..B16.16:                       # Preds ..B16.15 ..B16.14
-..LN1703:
-        movl      -44(%ebp), %eax                               #1511.22
-..LN1705:
-        movzwl    -4(%ebp), %edx                                #1511.28
-..LN1707:
-        movl      -32(%ebp), %ecx                               #1511.9
-        movw      %dx, expand_2na at GOTOFF(%ecx,%eax,2)           #1511.9
-..LN1709:
-        incl      -44(%ebp)                                     #1510.30
-..LN1711:
-        movl      -44(%ebp), %eax                               #1510.18
-..LN1713:
-        cmpl      $256, %eax                                    #1510.22
-        jb        ..B16.13      # Prob 50%                      #1510.22
-                                # LOE
-..B16.17:                       # Preds ..B16.16 ..B16.11
-..LN1715:
-        movl      -12(%ebp), %ebx                               #1513.1
-..___tag_value_NucStrstrInit.317:                               #
-        leave                                                   #1513.1
-..___tag_value_NucStrstrInit.319:                               #
-        ret                                                     #1513.1
-        .align    2,0x90
-..___tag_value_NucStrstrInit.320:                               #
-                                # LOE
-# mark_end;
-	.type	NucStrstrInit, at function
-	.size	NucStrstrInit,.-NucStrstrInit
-.LNNucStrstrInit:
-	.data
-# -- End  NucStrstrInit
-	.text
-# -- Begin  NucStrstrMake
-# mark_begin;
-       .align    2,0x90
-	.globl NucStrstrMake
-NucStrstrMake:
-# parameter 1(nss): 8 + %ebp
-# parameter 2(positional): 12 + %ebp
-# parameter 3(query): 16 + %ebp
-# parameter 4(len): 20 + %ebp
-..B17.1:                        # Preds ..B17.0
-..___tag_value_NucStrstrMake.323:                               #
-..LN1717:
-        pushl     %ebp                                          #1539.1
-        movl      %esp, %ebp                                    #1539.1
-..___tag_value_NucStrstrMake.328:                               #
-        subl      $20, %esp                                     #1539.1
-        movl      %ebx, -4(%ebp)                                #1539.1
-..___tag_value_NucStrstrMake.331:                               #
-..LN1719:
-        movl      8(%ebp), %eax                                 #1540.10
-..LN1721:
-        testl     %eax, %eax                                    #1540.17
-        je        ..B17.14      # Prob 50%                      #1540.17
-                                # LOE
-..B17.2:                        # Preds ..B17.1
-..LN1723:
-        movl      16(%ebp), %eax                                #1542.14
-..LN1725:
-        testl     %eax, %eax                                    #1542.23
-        je        ..B17.13      # Prob 50%                      #1542.23
-                                # LOE
-..B17.3:                        # Preds ..B17.2
-..LN1727:
-        movl      20(%ebp), %eax                                #1542.31
-..LN1729:
-        testl     %eax, %eax                                    #1542.38
-        je        ..B17.13      # Prob 50%                      #1542.38
-                                # LOE
-..B17.4:                        # Preds ..B17.3
-        call      ..L332        # Prob 100%                     #
-..L332:                                                         #
-        popl      %eax                                          #
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L332], %eax     #
-        movl      %eax, -12(%ebp)                               #
-..LN1731:
-        movl      $0, -20(%ebp)                                 #1544.24
-..LN1733:
-        movzbl    fasta_2na_map at GOTOFF(%eax), %eax              #1547.18
-        movsbl    %al, %eax                                     #1547.18
-..LN1735:
-        testl     %eax, %eax                                    #1547.41
-        jne       ..B17.6       # Prob 50%                      #1547.41
-                                # LOE
-..B17.5:                        # Preds ..B17.4
-..LN1737:
-        call      NucStrstrInit                                 #1548.17
-                                # LOE
-..B17.6:                        # Preds ..B17.5 ..B17.4
-..LN1739:
-        movl      20(%ebp), %eax                                #1550.27
-..LN1741:
-        addl      16(%ebp), %eax                                #1550.19
-..LN1743:
-        movl      %eax, -16(%ebp)                               #1550.13
-..LN1745:
-        addl      $-20, %esp                                    #1551.21
-..LN1747:
-        movl      16(%ebp), %eax                                #1551.32
-        movl      %eax, (%esp)                                  #1551.32
-..LN1749:
-        movl      -16(%ebp), %eax                               #1551.39
-        movl      %eax, 4(%esp)                                 #1551.39
-..LN1751:
-        movl      8(%ebp), %eax                                 #1551.44
-        movl      %eax, 8(%esp)                                 #1551.44
-..LN1753:
-        lea       -20(%ebp), %eax                               #1551.49
-        movl      %eax, 12(%esp)                                #1551.49
-..LN1755:
-        movl      12(%ebp), %eax                                #1551.59
-        movl      %eax, 16(%esp)                                #1551.59
-..LN1757:
-        call      nss_expr                                      #1551.21
-                                # LOE eax
-..B17.17:                       # Preds ..B17.6
-        addl      $20, %esp                                     #1551.21
-        movl      %eax, -8(%ebp)                                #1551.21
-                                # LOE
-..B17.7:                        # Preds ..B17.17
-..LN1759:
-        movl      -8(%ebp), %eax                                #1551.13
-        movl      %eax, 16(%ebp)                                #1551.13
-..LN1761:
-        movl      -20(%ebp), %eax                               #1552.18
-..LN1763:
-        testl     %eax, %eax                                    #1552.28
-        jne       ..B17.11      # Prob 50%                      #1552.28
-                                # LOE
-..B17.8:                        # Preds ..B17.7
-..LN1765:
-        movl      16(%ebp), %eax                                #1554.22
-..LN1767:
-        movl      -16(%ebp), %edx                               #1554.31
-        cmpl      %edx, %eax                                    #1554.31
-        jne       ..B17.10      # Prob 50%                      #1554.31
-                                # LOE
-..B17.9:                        # Preds ..B17.8
-..LN1769:
-        xorl      %eax, %eax                                    #1555.28
-        movl      -4(%ebp), %ebx                                #1555.28
-..___tag_value_NucStrstrMake.333:                               #
-        leave                                                   #1555.28
-..___tag_value_NucStrstrMake.335:                               #
-        ret                                                     #1555.28
-..___tag_value_NucStrstrMake.336:                               #
-                                # LOE
-..B17.10:                       # Preds ..B17.8
-..LN1771:
-        movl      $22, -20(%ebp)                                #1557.17
-                                # LOE
-..B17.11:                       # Preds ..B17.10 ..B17.7
-..LN1773:
-        pushl     %edi                                          #1560.13
-..LN1775:
-        movl      8(%ebp), %eax                                 #1560.32
-        movl      (%eax), %eax                                  #1560.32
-        movl      %eax, (%esp)                                  #1560.32
-..LN1777:
-        movl      -12(%ebp), %eax                               #1560.13
-        movl      %eax, %ebx                                    #1560.13
-        call      NucStrstrWhack at PLT                            #1560.13
-                                # LOE
-..B17.18:                       # Preds ..B17.11
-        popl      %ecx                                          #1560.13
-                                # LOE
-..B17.12:                       # Preds ..B17.18
-..LN1779:
-        movl      8(%ebp), %eax                                 #1561.13
-        movl      $0, (%eax)                                    #1561.13
-..LN1781:
-        movl      -20(%ebp), %eax                               #1562.20
-        movl      -4(%ebp), %ebx                                #1562.20
-..___tag_value_NucStrstrMake.338:                               #
-        leave                                                   #1562.20
-..___tag_value_NucStrstrMake.340:                               #
-        ret                                                     #1562.20
-..___tag_value_NucStrstrMake.341:                               #
-                                # LOE
-..B17.13:                       # Preds ..B17.3 ..B17.2
-..LN1783:
-        movl      8(%ebp), %eax                                 #1565.9
-        movl      $0, (%eax)                                    #1565.9
-                                # LOE
-..B17.14:                       # Preds ..B17.13 ..B17.1
-..LN1785:
-        movl      $22, %eax                                     #1567.12
-        movl      -4(%ebp), %ebx                                #1567.12
-..___tag_value_NucStrstrMake.343:                               #
-        leave                                                   #1567.12
-..___tag_value_NucStrstrMake.345:                               #
-        ret                                                     #1567.12
-        .align    2,0x90
-..___tag_value_NucStrstrMake.346:                               #
-                                # LOE
-# mark_end;
-	.type	NucStrstrMake, at function
-	.size	NucStrstrMake,.-NucStrstrMake
-.LNNucStrstrMake:
-	.data
-# -- End  NucStrstrMake
-	.text
-# -- Begin  NucStrstrWhack
-# mark_begin;
-       .align    2,0x90
-	.globl NucStrstrWhack
-NucStrstrWhack:
-# parameter 1(self): 8 + %ebp
-..B18.1:                        # Preds ..B18.0
-..___tag_value_NucStrstrWhack.349:                              #
-..LN1787:
-        pushl     %ebp                                          #1574.1
-        movl      %esp, %ebp                                    #1574.1
-..___tag_value_NucStrstrWhack.354:                              #
-        subl      $12, %esp                                     #1574.1
-        movl      %ebx, -4(%ebp)                                #1574.1
-..___tag_value_NucStrstrWhack.357:                              #
-..LN1789:
-        movl      8(%ebp), %eax                                 #1575.10
-..LN1791:
-        testl     %eax, %eax                                    #1575.18
-        je        ..B18.22      # Prob 50%                      #1575.18
-                                # LOE
-..B18.2:                        # Preds ..B18.1
-        call      ..L358        # Prob 100%                     #
-..L358:                                                         #
-        popl      %eax                                          #
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L358], %eax     #
-        movl      %eax, -12(%ebp)                               #
-..LN1793:
-        movl      8(%ebp), %eax                                 #1577.18
-        movl      (%eax), %eax                                  #1577.18
-        movl      %eax, -8(%ebp)                                #1577.18
-..LN1795:
-        cmpl      $12, %eax                                     #1577.9
-        ja        ..B18.21      # Prob 50%                      #1577.9
-                                # LOE
-..B18.3:                        # Preds ..B18.2
-        movl      -12(%ebp), %eax                               #1577.9
-        movl      -8(%ebp), %edx                                #1577.9
-        movl      ..1..TPKT.18_0 at GOTOFF(%eax,%edx,4), %eax      #1577.9
-        jmp       *%eax                                         #1577.9
-                                # LOE
-..1.18_0.TAG.0a:
-..1.18_0.TAG.09:
-..1.18_0.TAG.08:
-..1.18_0.TAG.07:
-..1.18_0.TAG.06:
-..1.18_0.TAG.05:
-..1.18_0.TAG.04:
-..1.18_0.TAG.03:
-..1.18_0.TAG.02:
-..1.18_0.TAG.01:
-..1.18_0.TAG.00:
-..B18.15:                       # Preds ..B18.3 ..B18.3 ..B18.3 ..B18.3 ..B18.3
-                                #       ..B18.3 ..B18.3 ..B18.3 ..B18.3 ..B18.3
-                                #       ..B18.3
-..LN1797:
-        movl      8(%ebp), %eax                                 #1593.20
-        movl      8(%eax), %eax                                 #1593.20
-..LN1799:
-        movl      %eax, 8(%ebp)                                 #1593.13
-        jmp       ..B18.21      # Prob 100%                     #1593.13
-                                # LOE
-..1.18_0.TAG.0b:
-..B18.17:                       # Preds ..B18.3
-..LN1801:
-        pushl     %edi                                          #1597.13
-..LN1803:
-        movl      8(%ebp), %eax                                 #1597.30
-        movl      8(%eax), %eax                                 #1597.30
-        movl      %eax, (%esp)                                  #1597.30
-..LN1805:
-        movl      -12(%ebp), %eax                               #1597.13
-        movl      %eax, %ebx                                    #1597.13
-        call      NucStrstrWhack at PLT                            #1597.13
-                                # LOE
-..B18.25:                       # Preds ..B18.17
-        popl      %ecx                                          #1597.13
-                                # LOE
-..B18.18:                       # Preds ..B18.25
-..LN1807:
-        pushl     %edi                                          #1598.13
-..LN1809:
-        movl      8(%ebp), %eax                                 #1598.30
-        movl      12(%eax), %eax                                #1598.30
-        movl      %eax, (%esp)                                  #1598.30
-..LN1811:
-        movl      -12(%ebp), %eax                               #1598.13
-        movl      %eax, %ebx                                    #1598.13
-        call      NucStrstrWhack at PLT                            #1598.13
-                                # LOE
-..B18.26:                       # Preds ..B18.18
-        popl      %ecx                                          #1598.13
-        jmp       ..B18.21      # Prob 100%                     #1598.13
-                                # LOE
-..1.18_0.TAG.0c:
-..B18.20:                       # Preds ..B18.3
-..LN1813:
-        pushl     %edi                                          #1601.13
-..LN1815:
-        movl      8(%ebp), %eax                                 #1601.30
-        movl      8(%eax), %eax                                 #1601.30
-        movl      %eax, (%esp)                                  #1601.30
-..LN1817:
-        movl      -12(%ebp), %eax                               #1601.13
-        movl      %eax, %ebx                                    #1601.13
-        call      NucStrstrWhack at PLT                            #1601.13
-                                # LOE
-..B18.27:                       # Preds ..B18.20
-        popl      %ecx                                          #1601.13
-                                # LOE
-..B18.21:                       # Preds ..B18.27 ..B18.26 ..B18.15 ..B18.2
-..LN1819:
-        pushl     %edi                                          #1604.9
-..LN1821:
-        movl      8(%ebp), %eax                                 #1604.16
-        movl      %eax, (%esp)                                  #1604.16
-..LN1823:
-        movl      -12(%ebp), %eax                               #1604.9
-        movl      %eax, %ebx                                    #1604.9
-        call      free at PLT                                      #1604.9
-                                # LOE
-..B18.28:                       # Preds ..B18.21
-        popl      %ecx                                          #1604.9
-                                # LOE
-..B18.22:                       # Preds ..B18.28 ..B18.1
-..LN1825:
-        movl      -4(%ebp), %ebx                                #1606.1
-..___tag_value_NucStrstrWhack.359:                              #
-        leave                                                   #1606.1
-..___tag_value_NucStrstrWhack.361:                              #
-        ret                                                     #1606.1
-        .align    2,0x90
-..___tag_value_NucStrstrWhack.362:                              #
-                                # LOE
-# mark_end;
-	.type	NucStrstrWhack, at function
-	.size	NucStrstrWhack,.-NucStrstrWhack
-.LNNucStrstrWhack:
-	.section .data1, "wa"
-	.align 4
-	.align 4
-..1..TPKT.18_0:
-	.long	..1.18_0.TAG.00
-	.long	..1.18_0.TAG.01
-	.long	..1.18_0.TAG.02
-	.long	..1.18_0.TAG.03
-	.long	..1.18_0.TAG.04
-	.long	..1.18_0.TAG.05
-	.long	..1.18_0.TAG.06
-	.long	..1.18_0.TAG.07
-	.long	..1.18_0.TAG.08
-	.long	..1.18_0.TAG.09
-	.long	..1.18_0.TAG.0a
-	.long	..1.18_0.TAG.0b
-	.long	..1.18_0.TAG.0c
-	.data
-# -- End  NucStrstrWhack
-	.section .rodata, "a"
-	.align 4
-__$U5:
-	.byte	101
-	.byte	118
-	.byte	97
-	.byte	108
-	.byte	95
-	.byte	50
-	.byte	110
-	.byte	97
-	.byte	95
-	.byte	56
-	.byte	0
-	.type	__$U5, at object
-	.size	__$U5,11
-	.space 1	# pad
-_2__STRING.9:
-	.byte	108
-	.byte	101
-	.byte	110
-	.byte	32
-	.byte	62
-	.byte	61
-	.byte	32
-	.byte	113
-	.byte	108
-	.byte	101
-	.byte	110
-	.byte	0
-	.type	_2__STRING.9, at object
-	.size	_2__STRING.9,12
-	.data
-	.text
-# -- Begin  eval_2na_8
-# mark_begin;
-       .align    2,0x90
-eval_2na_8:
-# parameter 1(self): 8 + %ebx
-# parameter 2(ncbi2na): 12 + %ebx
-# parameter 3(pos): 16 + %ebx
-# parameter 4(len): 20 + %ebx
-..B19.1:                        # Preds ..B19.0
-..___tag_value_eval_2na_8.365:                                  #
-..LN1827:
-        pushl     %ebx                                          #2196.1
-..___tag_value_eval_2na_8.370:                                  #
-        movl      %esp, %ebx                                    #2196.1
-..___tag_value_eval_2na_8.371:                                  #
-        andl      $-16, %esp                                    #2196.1
-        pushl     %ebp                                          #2196.1
-        pushl     %ebp                                          #2196.1
-        movl      4(%ebx), %ebp                                 #2196.1
-        movl      %ebp, 4(%esp)                                 #2196.1
-        movl      %esp, %ebp                                    #2196.1
-..___tag_value_eval_2na_8.373:                                  #
-        subl      $280, %esp                                    #2196.1
-        movl      %ebx, -280(%ebp)                              #2196.1
-..LN1829:
-        movl      8(%ebx), %eax                                 #2226.25
-        movl      4(%eax), %eax                                 #2226.25
-..LN1831:
-        movl      %eax, -4(%ebp)                                #2226.23
-..LN1833:
-        movl      20(%ebx), %eax                                #2229.5
-        movl      -4(%ebp), %edx                                #2229.5
-        cmpl      %edx, %eax                                    #2229.5
-        jae       ..B19.3       # Prob 50%                      #2229.5
-                                # LOE
-..B19.2:                        # Preds ..B19.1
-        call      ..L375        # Prob 100%                     #
-..L375:                                                         #
-        popl      %eax                                          #
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L375], %eax     #
-        addl      $-16, %esp                                    #2229.5
-        lea       _2__STRING.9 at GOTOFF(%eax), %edx               #2229.5
-        movl      %edx, (%esp)                                  #2229.5
-        lea       _2__STRING.1 at GOTOFF(%eax), %edx               #2229.5
-        movl      %edx, 4(%esp)                                 #2229.5
-        movl      $2229, 8(%esp)                                #2229.5
-        lea       __$U5 at GOTOFF(%eax), %edx                      #2229.5
-        movl      %edx, 12(%esp)                                #2229.5
-        movl      %eax, %ebx                                    #2229.5
-..___tag_value_eval_2na_8.376:                                  #2229.5
-        call      __assert_fail at PLT                             #2229.5
-        movl      -280(%ebp), %ebx                              #2229.5
-..___tag_value_eval_2na_8.377:                                  #
-                                # LOE
-..B19.43:                       # Preds ..B19.2
-        addl      $16, %esp                                     #2229.5
-                                # LOE
-..B19.3:                        # Preds ..B19.1
-..LN1835:
-        movl      16(%ebx), %eax                                #2233.12
-..LN1837:
-        addl      20(%ebx), %eax                                #2233.5
-        movl      %eax, 20(%ebx)                                #2233.5
-..LN1839:
-        movl      16(%ebx), %eax                                #2236.42
-..LN1841:
-        shrl      $2, %eax                                      #2236.49
-..LN1843:
-        addl      12(%ebx), %eax                                #2236.30
-..LN1845:
-        movl      %eax, -36(%ebp)                               #2236.5
-..LN1847:
-        movl      -4(%ebp), %eax                                #2239.18
-        negl      %eax                                          #2239.18
-        addl      20(%ebx), %eax                                #2239.18
-..LN1849:
-        movl      %eax, -32(%ebp)                               #2239.5
-..LN1851:
-        movl      20(%ebx), %eax                                #2242.44
-..LN1853:
-        addl      $3, %eax                                      #2242.50
-..LN1855:
-        shrl      $2, %eax                                      #2242.57
-..LN1857:
-        addl      12(%ebx), %eax                                #2242.30
-..LN1859:
-        movl      %eax, -28(%ebp)                               #2242.5
-..LN1861:
-        addl      $-8, %esp                                     #2245.14
-..LN1863:
-        movl      -36(%ebp), %eax                               #2245.33
-        movl      %eax, (%esp)                                  #2245.33
-..LN1865:
-        movl      -28(%ebp), %eax                               #2245.38
-        movl      %eax, 4(%esp)                                 #2245.38
-..LN1867:
-        call      prime_buffer_2na                              #2245.14
-                                # LOE xmm0
-..B19.44:                       # Preds ..B19.3
-        addl      $8, %esp                                      #2245.14
-        movdqa    %xmm0, -88(%ebp)                              #2245.14
-                                # LOE
-..B19.4:                        # Preds ..B19.44
-..LN1869:
-        movdqa    -88(%ebp), %xmm0                              #2245.5
-        movdqa    %xmm0, -232(%ebp)                             #2245.5
-..LN1871:
-        addl      $16, -36(%ebp)                                #2246.5
-..LN1873:
-        movl      8(%ebx), %eax                                 #2256.5
-        movdqa    16(%eax), %xmm0                               #2256.5
-        movdqa    %xmm0, -216(%ebp)                             #2256.5
-        movl      8(%ebx), %eax                                 #2256.5
-        movdqa    32(%eax), %xmm0                               #2256.5
-        movdqa    %xmm0, -200(%ebp)                             #2256.5
-        movl      8(%ebx), %eax                                 #2256.5
-        movdqa    48(%eax), %xmm0                               #2256.5
-        movdqa    %xmm0, -184(%ebp)                             #2256.5
-        movl      8(%ebx), %eax                                 #2256.5
-        movdqa    64(%eax), %xmm0                               #2256.5
-        movdqa    %xmm0, -168(%ebp)                             #2256.5
-        movl      8(%ebx), %eax                                 #2256.5
-        movdqa    80(%eax), %xmm0                               #2256.5
-        movdqa    %xmm0, -152(%ebp)                             #2256.5
-        movl      8(%ebx), %eax                                 #2256.5
-        movdqa    96(%eax), %xmm0                               #2256.5
-        movdqa    %xmm0, -136(%ebp)                             #2256.5
-        movl      8(%ebx), %eax                                 #2256.5
-        movdqa    112(%eax), %xmm0                              #2256.5
-        movdqa    %xmm0, -120(%ebp)                             #2256.5
-        movl      8(%ebx), %eax                                 #2256.5
-        movdqa    128(%eax), %xmm0                              #2256.5
-        movdqa    %xmm0, -104(%ebp)                             #2256.5
-..LN1875:
-        xorl      %eax, %eax                                    #2259.15
-        movl      %eax, -24(%ebp)                               #2259.15
-..LN1877:
-        movl      %eax, -20(%ebp)                               #2259.10
-..LN1879:
-        movl      %eax, -16(%ebp)                               #2259.5
-..LN1881:
-        movl      $1, -12(%ebp)                                 #2263.5
-..LN1883:
-        movl      16(%ebx), %eax                                #2268.14
-..LN1885:
-        andl      $3, %eax                                      #2268.20
-        movl      %eax, -8(%ebp)                                #2268.20
-        je        ..B19.12      # Prob 50%                      #2268.20
-                                # LOE
-..B19.5:                        # Preds ..B19.4
-        movl      -8(%ebp), %eax                                #2268.20
-        cmpl      $1, %eax                                      #2268.20
-        je        ..B19.13      # Prob 50%                      #2268.20
-                                # LOE
-..B19.6:                        # Preds ..B19.5
-        movl      -8(%ebp), %eax                                #2268.20
-        cmpl      $2, %eax                                      #2268.20
-        je        ..B19.14      # Prob 50%                      #2268.20
-                                # LOE
-..B19.7:                        # Preds ..B19.6
-        movl      -8(%ebp), %eax                                #2268.20
-        cmpl      $3, %eax                                      #2268.20
-        je        ..B19.15      # Prob 50%                      #2268.20
-                                # LOE
-..B19.8:                        # Preds ..B19.39 ..B19.7
-..LN1887:
-        movl      $1, %eax                                      #2273.9
-        testl     %eax, %eax                                    #2273.9
-        je        ..B19.40      # Prob 100%                     #2273.9
-                                # LOE
-..B19.9:                        # Preds ..B19.8
-..LN1889:
-        movl      $1, -12(%ebp)                                 #2275.13
-                                # LOE
-..B19.10:                       # Preds ..B19.34 ..B19.9
-..LN1891:
-        movl      $1, %eax                                      #2278.13
-        testl     %eax, %eax                                    #2278.13
-        je        ..B19.36      # Prob 100%                     #2278.13
-                                # LOE
-..B19.12:                       # Preds ..B19.4 ..B19.10
-..LN1893:
-        movdqa    -232(%ebp), %xmm0                             #2285.38
-..LN1895:
-        movdqa    -200(%ebp), %xmm1                             #2285.46
-..LN1897:
-        pand      %xmm1, %xmm0                                  #2285.22
-..LN1899:
-        movdqa    %xmm0, -248(%ebp)                             #2285.17
-..LN1901:
-        movdqa    -248(%ebp), %xmm0                             #2286.22
-        movdqa    -216(%ebp), %xmm1                             #2286.22
-        pcmpeqb   %xmm1, %xmm0                                  #2286.22
-..LN1903:
-        movdqa    %xmm0, -248(%ebp)                             #2286.17
-..LN1905:
-        movdqa    -248(%ebp), %xmm0                             #2287.42
-..LN1907:
-        pmovmskb  %xmm0, %eax                                   #2287.22
-..LN1909:
-        movl      %eax, -16(%ebp)                               #2287.17
-                                # LOE
-..B19.13:                       # Preds ..B19.5 ..B19.12
-..LN1911:
-        movdqa    -232(%ebp), %xmm0                             #2291.38
-..LN1913:
-        movdqa    -168(%ebp), %xmm1                             #2291.46
-..LN1915:
-        pand      %xmm1, %xmm0                                  #2291.22
-..LN1917:
-        movdqa    %xmm0, -248(%ebp)                             #2291.17
-..LN1919:
-        movdqa    -248(%ebp), %xmm0                             #2292.22
-        movdqa    -184(%ebp), %xmm1                             #2292.22
-        pcmpeqb   %xmm1, %xmm0                                  #2292.22
-..LN1921:
-        movdqa    %xmm0, -248(%ebp)                             #2292.17
-..LN1923:
-        movdqa    -248(%ebp), %xmm0                             #2293.42
-..LN1925:
-        pmovmskb  %xmm0, %eax                                   #2293.22
-..LN1927:
-        movl      %eax, -20(%ebp)                               #2293.17
-                                # LOE
-..B19.14:                       # Preds ..B19.6 ..B19.13
-..LN1929:
-        movdqa    -232(%ebp), %xmm0                             #2297.38
-..LN1931:
-        movdqa    -136(%ebp), %xmm1                             #2297.46
-..LN1933:
-        pand      %xmm1, %xmm0                                  #2297.22
-..LN1935:
-        movdqa    %xmm0, -248(%ebp)                             #2297.17
-..LN1937:
-        movdqa    -248(%ebp), %xmm0                             #2298.22
-        movdqa    -152(%ebp), %xmm1                             #2298.22
-        pcmpeqb   %xmm1, %xmm0                                  #2298.22
-..LN1939:
-        movdqa    %xmm0, -248(%ebp)                             #2298.17
-..LN1941:
-        movdqa    -248(%ebp), %xmm0                             #2299.42
-..LN1943:
-        pmovmskb  %xmm0, %eax                                   #2299.22
-..LN1945:
-        movl      %eax, -24(%ebp)                               #2299.17
-                                # LOE
-..B19.15:                       # Preds ..B19.7 ..B19.14
-..LN1947:
-        movdqa    -232(%ebp), %xmm0                             #2303.38
-..LN1949:
-        movdqa    -104(%ebp), %xmm1                             #2303.46
-..LN1951:
-        pand      %xmm1, %xmm0                                  #2303.22
-..LN1953:
-        movdqa    %xmm0, -248(%ebp)                             #2303.17
-..LN1955:
-        movdqa    -248(%ebp), %xmm0                             #2304.22
-        movdqa    -120(%ebp), %xmm1                             #2304.22
-        pcmpeqb   %xmm1, %xmm0                                  #2304.22
-..LN1957:
-        movdqa    %xmm0, -248(%ebp)                             #2304.17
-..LN1959:
-        movdqa    -248(%ebp), %xmm0                             #2305.42
-..LN1961:
-        pmovmskb  %xmm0, %eax                                   #2305.22
-..LN1963:
-        movl      %eax, -40(%ebp)                               #2305.17
-..LN1965:
-        movl      16(%ebx), %eax                                #2310.17
-        andl      $-4, %eax                                     #2310.17
-        movl      %eax, 16(%ebx)                                #2310.17
-..LN1967:
-        movl      -20(%ebp), %eax                               #2313.29
-        orl       -16(%ebp), %eax                               #2313.29
-..LN1969:
-        orl       -24(%ebp), %eax                               #2313.34
-..LN1971:
-        orl       -40(%ebp), %eax                               #2313.39
-..LN1973:
-        je        ..B19.32      # Prob 50%                      #2313.47
-                                # LOE
-..B19.16:                       # Preds ..B19.15
-..LN1975:
-        pushl     %edi                                          #2331.30
-..LN1977:
-        movl      -16(%ebp), %eax                               #2331.58
-        movw      %ax, (%esp)                                   #2331.58
-..LN1979:
-        call      uint16_lsbit                                  #2331.30
-                                # LOE eax
-..B19.45:                       # Preds ..B19.16
-        popl      %ecx                                          #2331.30
-        movl      %eax, -56(%ebp)                               #2331.30
-                                # LOE
-..B19.17:                       # Preds ..B19.45
-        movl      -56(%ebp), %eax                               #2331.30
-        movswl    %ax, %eax                                     #2331.30
-..LN1981:
-        movl      %eax, -72(%ebp)                               #2331.28
-..LN1983:
-        pushl     %edi                                          #2332.30
-..LN1985:
-        movl      -20(%ebp), %eax                               #2332.58
-        movw      %ax, (%esp)                                   #2332.58
-..LN1987:
-        call      uint16_lsbit                                  #2332.30
-                                # LOE eax
-..B19.46:                       # Preds ..B19.17
-        popl      %ecx                                          #2332.30
-        movl      %eax, -52(%ebp)                               #2332.30
-                                # LOE
-..B19.18:                       # Preds ..B19.46
-        movl      -52(%ebp), %eax                               #2332.30
-        movswl    %ax, %eax                                     #2332.30
-..LN1989:
-        movl      %eax, -68(%ebp)                               #2332.28
-..LN1991:
-        pushl     %edi                                          #2333.30
-..LN1993:
-        movl      -24(%ebp), %eax                               #2333.58
-        movw      %ax, (%esp)                                   #2333.58
-..LN1995:
-        call      uint16_lsbit                                  #2333.30
-                                # LOE eax
-..B19.47:                       # Preds ..B19.18
-        popl      %ecx                                          #2333.30
-        movl      %eax, -48(%ebp)                               #2333.30
-                                # LOE
-..B19.19:                       # Preds ..B19.47
-        movl      -48(%ebp), %eax                               #2333.30
-        movswl    %ax, %eax                                     #2333.30
-..LN1997:
-        movl      %eax, -64(%ebp)                               #2333.28
-..LN1999:
-        pushl     %edi                                          #2334.30
-..LN2001:
-        movl      -40(%ebp), %eax                               #2334.58
-        movw      %ax, (%esp)                                   #2334.58
-..LN2003:
-        call      uint16_lsbit                                  #2334.30
-                                # LOE eax
-..B19.48:                       # Preds ..B19.19
-        popl      %ecx                                          #2334.30
-        movl      %eax, -44(%ebp)                               #2334.30
-                                # LOE
-..B19.20:                       # Preds ..B19.48
-        movl      -44(%ebp), %eax                               #2334.30
-        movswl    %ax, %eax                                     #2334.30
-..LN2005:
-        movl      %eax, -60(%ebp)                               #2334.28
-..LN2007:
-        shll      $2, -72(%ebp)                                 #2339.34
-..LN2009:
-        movl      -68(%ebp), %eax                               #2340.28
-..LN2011:
-        lea       1(,%eax,4), %eax                              #2340.40
-..LN2013:
-        movl      %eax, -68(%ebp)                               #2340.21
-..LN2015:
-        movl      -64(%ebp), %eax                               #2341.28
-..LN2017:
-        lea       2(,%eax,4), %eax                              #2341.40
-..LN2019:
-        movl      %eax, -64(%ebp)                               #2341.21
-..LN2021:
-        movl      -60(%ebp), %eax                               #2342.28
-..LN2023:
-        lea       3(,%eax,4), %eax                              #2342.40
-..LN2025:
-        movl      %eax, -60(%ebp)                               #2342.21
-..LN2027:
-        movl      -16(%ebp), %eax                               #2346.26
-..LN2029:
-        testl     %eax, %eax                                    #2346.32
-        je        ..B19.23      # Prob 50%                      #2346.32
-                                # LOE
-..B19.21:                       # Preds ..B19.20
-..LN2031:
-        movl      -72(%ebp), %eax                               #2346.43
-        addl      16(%ebx), %eax                                #2346.43
-..LN2033:
-        movl      -32(%ebp), %edx                               #2346.49
-        cmpl      %edx, %eax                                    #2346.49
-        ja        ..B19.23      # Prob 50%                      #2346.49
-                                # LOE
-..B19.22:                       # Preds ..B19.21
-..LN2035:
-        movl      $1, %eax                                      #2346.63
-        leave                                                   #2346.63
-..___tag_value_eval_2na_8.379:                                  #
-        movl      %ebx, %esp                                    #2346.63
-        popl      %ebx                                          #2346.63
-..___tag_value_eval_2na_8.380:                                  #
-        ret                                                     #2346.63
-..___tag_value_eval_2na_8.382:                                  #
-                                # LOE
-..B19.23:                       # Preds ..B19.21 ..B19.20
-..LN2037:
-        movl      -20(%ebp), %eax                               #2347.26
-..LN2039:
-        testl     %eax, %eax                                    #2347.32
-        je        ..B19.26      # Prob 50%                      #2347.32
-                                # LOE
-..B19.24:                       # Preds ..B19.23
-..LN2041:
-        movl      -68(%ebp), %eax                               #2347.43
-        addl      16(%ebx), %eax                                #2347.43
-..LN2043:
-        movl      -32(%ebp), %edx                               #2347.49
-        cmpl      %edx, %eax                                    #2347.49
-        ja        ..B19.26      # Prob 50%                      #2347.49
-                                # LOE
-..B19.25:                       # Preds ..B19.24
-..LN2045:
-        movl      $1, %eax                                      #2347.63
-        leave                                                   #2347.63
-..___tag_value_eval_2na_8.386:                                  #
-        movl      %ebx, %esp                                    #2347.63
-        popl      %ebx                                          #2347.63
-..___tag_value_eval_2na_8.387:                                  #
-        ret                                                     #2347.63
-..___tag_value_eval_2na_8.389:                                  #
-                                # LOE
-..B19.26:                       # Preds ..B19.24 ..B19.23
-..LN2047:
-        movl      -24(%ebp), %eax                               #2348.26
-..LN2049:
-        testl     %eax, %eax                                    #2348.32
-        je        ..B19.29      # Prob 50%                      #2348.32
-                                # LOE
-..B19.27:                       # Preds ..B19.26
-..LN2051:
-        movl      -64(%ebp), %eax                               #2348.43
-        addl      16(%ebx), %eax                                #2348.43
-..LN2053:
-        movl      -32(%ebp), %edx                               #2348.49
-        cmpl      %edx, %eax                                    #2348.49
-        ja        ..B19.29      # Prob 50%                      #2348.49
-                                # LOE
-..B19.28:                       # Preds ..B19.27
-..LN2055:
-        movl      $1, %eax                                      #2348.63
-        leave                                                   #2348.63
-..___tag_value_eval_2na_8.393:                                  #
-        movl      %ebx, %esp                                    #2348.63
-        popl      %ebx                                          #2348.63
-..___tag_value_eval_2na_8.394:                                  #
-        ret                                                     #2348.63
-..___tag_value_eval_2na_8.396:                                  #
-                                # LOE
-..B19.29:                       # Preds ..B19.27 ..B19.26
-..LN2057:
-        movl      -40(%ebp), %eax                               #2349.26
-..LN2059:
-        testl     %eax, %eax                                    #2349.32
-        je        ..B19.32      # Prob 50%                      #2349.32
-                                # LOE
-..B19.30:                       # Preds ..B19.29
-..LN2061:
-        movl      -60(%ebp), %eax                               #2349.43
-        addl      16(%ebx), %eax                                #2349.43
-..LN2063:
-        movl      -32(%ebp), %edx                               #2349.49
-        cmpl      %edx, %eax                                    #2349.49
-        ja        ..B19.32      # Prob 50%                      #2349.49
-                                # LOE
-..B19.31:                       # Preds ..B19.30
-..LN2065:
-        movl      $1, %eax                                      #2349.63
-        leave                                                   #2349.63
-..___tag_value_eval_2na_8.400:                                  #
-        movl      %ebx, %esp                                    #2349.63
-        popl      %ebx                                          #2349.63
-..___tag_value_eval_2na_8.401:                                  #
-        ret                                                     #2349.63
-..___tag_value_eval_2na_8.403:                                  #
-                                # LOE
-..B19.32:                       # Preds ..B19.30 ..B19.29 ..B19.15
-..LN2067:
-        movl      16(%ebx), %eax                                #2354.17
-        addl      $4, %eax                                      #2354.17
-        movl      %eax, 16(%ebx)                                #2354.17
-..LN2069:
-        movl      16(%ebx), %eax                                #2357.22
-..LN2071:
-        movl      -32(%ebp), %edx                               #2357.28
-        cmpl      %edx, %eax                                    #2357.28
-        jbe       ..B19.34      # Prob 50%                      #2357.28
-                                # LOE
-..B19.33:                       # Preds ..B19.32
-..LN2073:
-        xorl      %eax, %eax                                    #2358.28
-        leave                                                   #2358.28
-..___tag_value_eval_2na_8.407:                                  #
-        movl      %ebx, %esp                                    #2358.28
-        popl      %ebx                                          #2358.28
-..___tag_value_eval_2na_8.408:                                  #
-        ret                                                     #2358.28
-..___tag_value_eval_2na_8.410:                                  #
-                                # LOE
-..B19.34:                       # Preds ..B19.32
-..LN2075:
-        movl      -12(%ebp), %eax                               #2361.25
-        decl      %eax                                          #2361.25
-        movl      %eax, -12(%ebp)                               #2361.25
-..LN2077:
-        jne       ..B19.10      # Prob 50%                      #2361.39
-                                # LOE
-..B19.36:                       # Preds ..B19.34 ..B19.10
-..LN2079:
-        movl      -36(%ebp), %eax                               #2382.18
-..LN2081:
-        movl      -28(%ebp), %edx                               #2382.25
-        cmpl      %edx, %eax                                    #2382.25
-        jae       ..B19.40      # Prob 50%                      #2382.25
-                                # LOE
-..B19.37:                       # Preds ..B19.36
-..LN2083:
-        movl      16(%ebx), %eax                                #2386.13
-        addl      $60, %eax                                     #2386.13
-        movl      %eax, 16(%ebx)                                #2386.13
-..LN2085:
-        movl      16(%ebx), %eax                                #2387.18
-..LN2087:
-        movl      -32(%ebp), %edx                               #2387.24
-        cmpl      %edx, %eax                                    #2387.24
-        ja        ..B19.40      # Prob 50%                      #2387.24
-                                # LOE
-..B19.38:                       # Preds ..B19.37
-..LN2089:
-        addl      $-8, %esp                                     #2392.22
-..LN2091:
-        movl      -36(%ebp), %eax                               #2392.41
-        movl      %eax, (%esp)                                  #2392.41
-..LN2093:
-        movl      -28(%ebp), %eax                               #2392.46
-        movl      %eax, 4(%esp)                                 #2392.46
-..LN2095:
-        call      prime_buffer_2na                              #2392.22
-                                # LOE xmm0
-..B19.49:                       # Preds ..B19.38
-        addl      $8, %esp                                      #2392.22
-        movdqa    %xmm0, -264(%ebp)                             #2392.22
-                                # LOE
-..B19.39:                       # Preds ..B19.49
-..LN2097:
-        movdqa    -264(%ebp), %xmm0                             #2392.13
-        movdqa    %xmm0, -232(%ebp)                             #2392.13
-..LN2099:
-        addl      $16, -36(%ebp)                                #2470.13
-        jmp       ..B19.8       # Prob 100%                     #2470.13
-                                # LOE
-..B19.40:                       # Preds ..B19.37 ..B19.36 ..B19.8
-..LN2101:
-        xorl      %eax, %eax                                    #2483.12
-        leave                                                   #2483.12
-..___tag_value_eval_2na_8.414:                                  #
-        movl      %ebx, %esp                                    #2483.12
-        popl      %ebx                                          #2483.12
-..___tag_value_eval_2na_8.415:                                  #
-        ret                                                     #2483.12
-        .align    2,0x90
-..___tag_value_eval_2na_8.417:                                  #
-                                # LOE
-# mark_end;
-	.type	eval_2na_8, at function
-	.size	eval_2na_8,.-eval_2na_8
-.LNeval_2na_8:
-	.data
-# -- End  eval_2na_8
-	.section .rodata, "a"
-	.align 4
-__$U6:
-	.byte	101
-	.byte	118
-	.byte	97
-	.byte	108
-	.byte	95
-	.byte	50
-	.byte	110
-	.byte	97
-	.byte	95
-	.byte	49
-	.byte	54
-	.byte	0
-	.type	__$U6, at object
-	.size	__$U6,12
-	.text
-# -- Begin  eval_2na_16
-# mark_begin;
-       .align    2,0x90
-eval_2na_16:
-# parameter 1(self): 8 + %ebx
-# parameter 2(ncbi2na): 12 + %ebx
-# parameter 3(pos): 16 + %ebx
-# parameter 4(len): 20 + %ebx
-..B20.1:                        # Preds ..B20.0
-..___tag_value_eval_2na_16.420:                                 #
-..LN2103:
-        pushl     %ebx                                          #2489.1
-..___tag_value_eval_2na_16.425:                                 #
-        movl      %esp, %ebx                                    #2489.1
-..___tag_value_eval_2na_16.426:                                 #
-        andl      $-16, %esp                                    #2489.1
-        pushl     %ebp                                          #2489.1
-        pushl     %ebp                                          #2489.1
-        movl      4(%ebx), %ebp                                 #2489.1
-        movl      %ebp, 4(%esp)                                 #2489.1
-        movl      %esp, %ebp                                    #2489.1
-..___tag_value_eval_2na_16.428:                                 #
-        subl      $296, %esp                                    #2489.1
-        movl      %ebx, -296(%ebp)                              #2489.1
-..LN2105:
-        movl      8(%ebx), %eax                                 #2519.25
-        movl      4(%eax), %eax                                 #2519.25
-..LN2107:
-        movl      %eax, -12(%ebp)                               #2519.23
-..LN2109:
-        movl      20(%ebx), %eax                                #2522.5
-        movl      -12(%ebp), %edx                               #2522.5
-        cmpl      %edx, %eax                                    #2522.5
-        jae       ..B20.3       # Prob 50%                      #2522.5
-                                # LOE
-..B20.2:                        # Preds ..B20.1
-        call      ..L430        # Prob 100%                     #
-..L430:                                                         #
-        popl      %eax                                          #
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L430], %eax     #
-        addl      $-16, %esp                                    #2522.5
-        lea       _2__STRING.9 at GOTOFF(%eax), %edx               #2522.5
-        movl      %edx, (%esp)                                  #2522.5
-        lea       _2__STRING.1 at GOTOFF(%eax), %edx               #2522.5
-        movl      %edx, 4(%esp)                                 #2522.5
-        movl      $2522, 8(%esp)                                #2522.5
-        lea       __$U6 at GOTOFF(%eax), %edx                      #2522.5
-        movl      %edx, 12(%esp)                                #2522.5
-        movl      %eax, %ebx                                    #2522.5
-..___tag_value_eval_2na_16.431:                                 #2522.5
-        call      __assert_fail at PLT                             #2522.5
-        movl      -296(%ebp), %ebx                              #2522.5
-..___tag_value_eval_2na_16.432:                                 #
-                                # LOE
-..B20.49:                       # Preds ..B20.2
-        addl      $16, %esp                                     #2522.5
-                                # LOE
-..B20.3:                        # Preds ..B20.1
-..LN2111:
-        movl      16(%ebx), %eax                                #2526.12
-..LN2113:
-        addl      20(%ebx), %eax                                #2526.5
-        movl      %eax, 20(%ebx)                                #2526.5
-..LN2115:
-        movl      16(%ebx), %eax                                #2529.42
-..LN2117:
-        shrl      $2, %eax                                      #2529.49
-..LN2119:
-        addl      12(%ebx), %eax                                #2529.30
-..LN2121:
-        movl      %eax, -48(%ebp)                               #2529.5
-..LN2123:
-        movl      -12(%ebp), %eax                               #2532.18
-        negl      %eax                                          #2532.18
-        addl      20(%ebx), %eax                                #2532.18
-..LN2125:
-        movl      %eax, -44(%ebp)                               #2532.5
-..LN2127:
-        movl      20(%ebx), %eax                                #2535.44
-..LN2129:
-        addl      $3, %eax                                      #2535.50
-..LN2131:
-        shrl      $2, %eax                                      #2535.57
-..LN2133:
-        addl      12(%ebx), %eax                                #2535.30
-..LN2135:
-        movl      %eax, -40(%ebp)                               #2535.5
-..LN2137:
-        addl      $-8, %esp                                     #2538.14
-..LN2139:
-        movl      -48(%ebp), %eax                               #2538.33
-        movl      %eax, (%esp)                                  #2538.33
-..LN2141:
-        movl      -40(%ebp), %eax                               #2538.38
-        movl      %eax, 4(%esp)                                 #2538.38
-..LN2143:
-        call      prime_buffer_2na                              #2538.14
-                                # LOE xmm0
-..B20.50:                       # Preds ..B20.3
-        addl      $8, %esp                                      #2538.14
-        movdqa    %xmm0, -104(%ebp)                             #2538.14
-                                # LOE
-..B20.4:                        # Preds ..B20.50
-..LN2145:
-        movdqa    -104(%ebp), %xmm0                             #2538.5
-        movdqa    %xmm0, -248(%ebp)                             #2538.5
-..LN2147:
-        addl      $16, -48(%ebp)                                #2539.5
-..LN2149:
-        movl      -48(%ebp), %eax                               #2541.9
-..LN2151:
-        movl      %eax, -36(%ebp)                               #2541.5
-..LN2153:
-        movl      -48(%ebp), %eax                               #2544.10
-..LN2155:
-        movl      -40(%ebp), %edx                               #2544.16
-        cmpl      %edx, %eax                                    #2544.16
-        jae       ..B20.6       # Prob 50%                      #2544.16
-                                # LOE
-..B20.5:                        # Preds ..B20.4
-..LN2157:
-        movl      -48(%ebp), %eax                               #2545.24
-        movzbl    -1(%eax), %eax                                #2545.24
-        movzbl    %al, %eax                                     #2545.24
-..LN2159:
-        shll      $8, %eax                                      #2545.38
-..LN2161:
-        movl      %eax, -56(%ebp)                               #2545.9
-                                # LOE
-..B20.6:                        # Preds ..B20.5 ..B20.4
-..LN2163:
-        movl      8(%ebx), %eax                                 #2549.5
-        movdqa    16(%eax), %xmm0                               #2549.5
-        movdqa    %xmm0, -232(%ebp)                             #2549.5
-        movl      8(%ebx), %eax                                 #2549.5
-        movdqa    32(%eax), %xmm0                               #2549.5
-        movdqa    %xmm0, -216(%ebp)                             #2549.5
-        movl      8(%ebx), %eax                                 #2549.5
-        movdqa    48(%eax), %xmm0                               #2549.5
-        movdqa    %xmm0, -200(%ebp)                             #2549.5
-        movl      8(%ebx), %eax                                 #2549.5
-        movdqa    64(%eax), %xmm0                               #2549.5
-        movdqa    %xmm0, -184(%ebp)                             #2549.5
-        movl      8(%ebx), %eax                                 #2549.5
-        movdqa    80(%eax), %xmm0                               #2549.5
-        movdqa    %xmm0, -168(%ebp)                             #2549.5
-        movl      8(%ebx), %eax                                 #2549.5
-        movdqa    96(%eax), %xmm0                               #2549.5
-        movdqa    %xmm0, -152(%ebp)                             #2549.5
-        movl      8(%ebx), %eax                                 #2549.5
-        movdqa    112(%eax), %xmm0                              #2549.5
-        movdqa    %xmm0, -136(%ebp)                             #2549.5
-        movl      8(%ebx), %eax                                 #2549.5
-        movdqa    128(%eax), %xmm0                              #2549.5
-        movdqa    %xmm0, -120(%ebp)                             #2549.5
-..LN2165:
-        xorl      %eax, %eax                                    #2552.15
-        movl      %eax, -32(%ebp)                               #2552.15
-..LN2167:
-        movl      %eax, -28(%ebp)                               #2552.10
-..LN2169:
-        movl      %eax, -24(%ebp)                               #2552.5
-..LN2171:
-        movl      $2, -20(%ebp)                                 #2556.5
-..LN2173:
-        movl      16(%ebx), %eax                                #2561.14
-..LN2175:
-        andl      $3, %eax                                      #2561.20
-        movl      %eax, -16(%ebp)                               #2561.20
-        je        ..B20.14      # Prob 50%                      #2561.20
-                                # LOE
-..B20.7:                        # Preds ..B20.6
-        movl      -16(%ebp), %eax                               #2561.20
-        cmpl      $1, %eax                                      #2561.20
-        je        ..B20.15      # Prob 50%                      #2561.20
-                                # LOE
-..B20.8:                        # Preds ..B20.7
-        movl      -16(%ebp), %eax                               #2561.20
-        cmpl      $2, %eax                                      #2561.20
-        je        ..B20.16      # Prob 50%                      #2561.20
-                                # LOE
-..B20.9:                        # Preds ..B20.8
-        movl      -16(%ebp), %eax                               #2561.20
-        cmpl      $3, %eax                                      #2561.20
-        je        ..B20.17      # Prob 50%                      #2561.20
-                                # LOE
-..B20.10:                       # Preds ..B20.45 ..B20.44 ..B20.9
-..LN2177:
-        movl      $1, %eax                                      #2566.9
-        testl     %eax, %eax                                    #2566.9
-        je        ..B20.46      # Prob 100%                     #2566.9
-                                # LOE
-..B20.11:                       # Preds ..B20.10
-..LN2179:
-        movl      $2, -20(%ebp)                                 #2568.13
-                                # LOE
-..B20.12:                       # Preds ..B20.39 ..B20.11
-..LN2181:
-        movl      $1, %eax                                      #2571.13
-        testl     %eax, %eax                                    #2571.13
-        je        ..B20.41      # Prob 100%                     #2571.13
-                                # LOE
-..B20.14:                       # Preds ..B20.6 ..B20.12
-..LN2183:
-        movdqa    -248(%ebp), %xmm0                             #2578.38
-..LN2185:
-        movdqa    -216(%ebp), %xmm1                             #2578.46
-..LN2187:
-        pand      %xmm1, %xmm0                                  #2578.22
-..LN2189:
-        movdqa    %xmm0, -264(%ebp)                             #2578.17
-..LN2191:
-        movdqa    -264(%ebp), %xmm0                             #2579.22
-        movdqa    -232(%ebp), %xmm1                             #2579.22
-        pcmpeqw   %xmm1, %xmm0                                  #2579.22
-..LN2193:
-        movdqa    %xmm0, -264(%ebp)                             #2579.17
-..LN2195:
-        movdqa    -264(%ebp), %xmm0                             #2580.42
-..LN2197:
-        pmovmskb  %xmm0, %eax                                   #2580.22
-..LN2199:
-        movl      %eax, -24(%ebp)                               #2580.17
-                                # LOE
-..B20.15:                       # Preds ..B20.7 ..B20.14
-..LN2201:
-        movdqa    -248(%ebp), %xmm0                             #2584.38
-..LN2203:
-        movdqa    -184(%ebp), %xmm1                             #2584.46
-..LN2205:
-        pand      %xmm1, %xmm0                                  #2584.22
-..LN2207:
-        movdqa    %xmm0, -264(%ebp)                             #2584.17
-..LN2209:
-        movdqa    -264(%ebp), %xmm0                             #2585.22
-        movdqa    -200(%ebp), %xmm1                             #2585.22
-        pcmpeqw   %xmm1, %xmm0                                  #2585.22
-..LN2211:
-        movdqa    %xmm0, -264(%ebp)                             #2585.17
-..LN2213:
-        movdqa    -264(%ebp), %xmm0                             #2586.42
-..LN2215:
-        pmovmskb  %xmm0, %eax                                   #2586.22
-..LN2217:
-        movl      %eax, -28(%ebp)                               #2586.17
-                                # LOE
-..B20.16:                       # Preds ..B20.8 ..B20.15
-..LN2219:
-        movdqa    -248(%ebp), %xmm0                             #2590.38
-..LN2221:
-        movdqa    -152(%ebp), %xmm1                             #2590.46
-..LN2223:
-        pand      %xmm1, %xmm0                                  #2590.22
-..LN2225:
-        movdqa    %xmm0, -264(%ebp)                             #2590.17
-..LN2227:
-        movdqa    -264(%ebp), %xmm0                             #2591.22
-        movdqa    -168(%ebp), %xmm1                             #2591.22
-        pcmpeqw   %xmm1, %xmm0                                  #2591.22
-..LN2229:
-        movdqa    %xmm0, -264(%ebp)                             #2591.17
-..LN2231:
-        movdqa    -264(%ebp), %xmm0                             #2592.42
-..LN2233:
-        pmovmskb  %xmm0, %eax                                   #2592.22
-..LN2235:
-        movl      %eax, -32(%ebp)                               #2592.17
-                                # LOE
-..B20.17:                       # Preds ..B20.9 ..B20.16
-..LN2237:
-        movdqa    -248(%ebp), %xmm0                             #2596.38
-..LN2239:
-        movdqa    -120(%ebp), %xmm1                             #2596.46
-..LN2241:
-        pand      %xmm1, %xmm0                                  #2596.22
-..LN2243:
-        movdqa    %xmm0, -264(%ebp)                             #2596.17
-..LN2245:
-        movdqa    -264(%ebp), %xmm0                             #2597.22
-        movdqa    -136(%ebp), %xmm1                             #2597.22
-        pcmpeqw   %xmm1, %xmm0                                  #2597.22
-..LN2247:
-        movdqa    %xmm0, -264(%ebp)                             #2597.17
-..LN2249:
-        movdqa    -264(%ebp), %xmm0                             #2598.42
-..LN2251:
-        pmovmskb  %xmm0, %eax                                   #2598.22
-..LN2253:
-        movl      %eax, -52(%ebp)                               #2598.17
-..LN2255:
-        movl      16(%ebx), %eax                                #2603.17
-        andl      $-4, %eax                                     #2603.17
-        movl      %eax, 16(%ebx)                                #2603.17
-..LN2257:
-        movl      -28(%ebp), %eax                               #2606.29
-        orl       -24(%ebp), %eax                               #2606.29
-..LN2259:
-        orl       -32(%ebp), %eax                               #2606.34
-..LN2261:
-        orl       -52(%ebp), %eax                               #2606.39
-..LN2263:
-        je        ..B20.34      # Prob 50%                      #2606.47
-                                # LOE
-..B20.18:                       # Preds ..B20.17
-..LN2265:
-        pushl     %edi                                          #2624.30
-..LN2267:
-        movl      -24(%ebp), %eax                               #2624.58
-        movw      %ax, (%esp)                                   #2624.58
-..LN2269:
-        call      uint16_lsbit                                  #2624.30
-                                # LOE eax
-..B20.51:                       # Preds ..B20.18
-        popl      %ecx                                          #2624.30
-        movl      %eax, -72(%ebp)                               #2624.30
-                                # LOE
-..B20.19:                       # Preds ..B20.51
-        movl      -72(%ebp), %eax                               #2624.30
-        movswl    %ax, %eax                                     #2624.30
-..LN2271:
-        movl      %eax, -88(%ebp)                               #2624.28
-..LN2273:
-        pushl     %edi                                          #2625.30
-..LN2275:
-        movl      -28(%ebp), %eax                               #2625.58
-        movw      %ax, (%esp)                                   #2625.58
-..LN2277:
-        call      uint16_lsbit                                  #2625.30
-                                # LOE eax
-..B20.52:                       # Preds ..B20.19
-        popl      %ecx                                          #2625.30
-        movl      %eax, -68(%ebp)                               #2625.30
-                                # LOE
-..B20.20:                       # Preds ..B20.52
-        movl      -68(%ebp), %eax                               #2625.30
-        movswl    %ax, %eax                                     #2625.30
-..LN2279:
-        movl      %eax, -84(%ebp)                               #2625.28
-..LN2281:
-        pushl     %edi                                          #2626.30
-..LN2283:
-        movl      -32(%ebp), %eax                               #2626.58
-        movw      %ax, (%esp)                                   #2626.58
-..LN2285:
-        call      uint16_lsbit                                  #2626.30
-                                # LOE eax
-..B20.53:                       # Preds ..B20.20
-        popl      %ecx                                          #2626.30
-        movl      %eax, -64(%ebp)                               #2626.30
-                                # LOE
-..B20.21:                       # Preds ..B20.53
-        movl      -64(%ebp), %eax                               #2626.30
-        movswl    %ax, %eax                                     #2626.30
-..LN2287:
-        movl      %eax, -80(%ebp)                               #2626.28
-..LN2289:
-        pushl     %edi                                          #2627.30
-..LN2291:
-        movl      -52(%ebp), %eax                               #2627.58
-        movw      %ax, (%esp)                                   #2627.58
-..LN2293:
-        call      uint16_lsbit                                  #2627.30
-                                # LOE eax
-..B20.54:                       # Preds ..B20.21
-        popl      %ecx                                          #2627.30
-        movl      %eax, -60(%ebp)                               #2627.30
-                                # LOE
-..B20.22:                       # Preds ..B20.54
-        movl      -60(%ebp), %eax                               #2627.30
-        movswl    %ax, %eax                                     #2627.30
-..LN2295:
-        movl      %eax, -76(%ebp)                               #2627.28
-..LN2297:
-        shll      $2, -88(%ebp)                                 #2632.34
-..LN2299:
-        movl      -84(%ebp), %eax                               #2633.28
-..LN2301:
-        lea       1(,%eax,4), %eax                              #2633.40
-..LN2303:
-        movl      %eax, -84(%ebp)                               #2633.21
-..LN2305:
-        movl      -80(%ebp), %eax                               #2634.28
-..LN2307:
-        lea       2(,%eax,4), %eax                              #2634.40
-..LN2309:
-        movl      %eax, -80(%ebp)                               #2634.21
-..LN2311:
-        movl      -76(%ebp), %eax                               #2635.28
-..LN2313:
-        lea       3(,%eax,4), %eax                              #2635.40
-..LN2315:
-        movl      %eax, -76(%ebp)                               #2635.21
-..LN2317:
-        movl      -24(%ebp), %eax                               #2639.26
-..LN2319:
-        testl     %eax, %eax                                    #2639.32
-        je        ..B20.25      # Prob 50%                      #2639.32
-                                # LOE
-..B20.23:                       # Preds ..B20.22
-..LN2321:
-        movl      -88(%ebp), %eax                               #2639.43
-        addl      16(%ebx), %eax                                #2639.43
-..LN2323:
-        movl      -44(%ebp), %edx                               #2639.49
-        cmpl      %edx, %eax                                    #2639.49
-        ja        ..B20.25      # Prob 50%                      #2639.49
-                                # LOE
-..B20.24:                       # Preds ..B20.23
-..LN2325:
-        movl      $1, %eax                                      #2639.63
-        leave                                                   #2639.63
-..___tag_value_eval_2na_16.434:                                 #
-        movl      %ebx, %esp                                    #2639.63
-        popl      %ebx                                          #2639.63
-..___tag_value_eval_2na_16.435:                                 #
-        ret                                                     #2639.63
-..___tag_value_eval_2na_16.437:                                 #
-                                # LOE
-..B20.25:                       # Preds ..B20.23 ..B20.22
-..LN2327:
-        movl      -28(%ebp), %eax                               #2640.26
-..LN2329:
-        testl     %eax, %eax                                    #2640.32
-        je        ..B20.28      # Prob 50%                      #2640.32
-                                # LOE
-..B20.26:                       # Preds ..B20.25
-..LN2331:
-        movl      -84(%ebp), %eax                               #2640.43
-        addl      16(%ebx), %eax                                #2640.43
-..LN2333:
-        movl      -44(%ebp), %edx                               #2640.49
-        cmpl      %edx, %eax                                    #2640.49
-        ja        ..B20.28      # Prob 50%                      #2640.49
-                                # LOE
-..B20.27:                       # Preds ..B20.26
-..LN2335:
-        movl      $1, %eax                                      #2640.63
-        leave                                                   #2640.63
-..___tag_value_eval_2na_16.441:                                 #
-        movl      %ebx, %esp                                    #2640.63
-        popl      %ebx                                          #2640.63
-..___tag_value_eval_2na_16.442:                                 #
-        ret                                                     #2640.63
-..___tag_value_eval_2na_16.444:                                 #
-                                # LOE
-..B20.28:                       # Preds ..B20.26 ..B20.25
-..LN2337:
-        movl      -32(%ebp), %eax                               #2641.26
-..LN2339:
-        testl     %eax, %eax                                    #2641.32
-        je        ..B20.31      # Prob 50%                      #2641.32
-                                # LOE
-..B20.29:                       # Preds ..B20.28
-..LN2341:
-        movl      -80(%ebp), %eax                               #2641.43
-        addl      16(%ebx), %eax                                #2641.43
-..LN2343:
-        movl      -44(%ebp), %edx                               #2641.49
-        cmpl      %edx, %eax                                    #2641.49
-        ja        ..B20.31      # Prob 50%                      #2641.49
-                                # LOE
-..B20.30:                       # Preds ..B20.29
-..LN2345:
-        movl      $1, %eax                                      #2641.63
-        leave                                                   #2641.63
-..___tag_value_eval_2na_16.448:                                 #
-        movl      %ebx, %esp                                    #2641.63
-        popl      %ebx                                          #2641.63
-..___tag_value_eval_2na_16.449:                                 #
-        ret                                                     #2641.63
-..___tag_value_eval_2na_16.451:                                 #
-                                # LOE
-..B20.31:                       # Preds ..B20.29 ..B20.28
-..LN2347:
-        movl      -52(%ebp), %eax                               #2642.26
-..LN2349:
-        testl     %eax, %eax                                    #2642.32
-        je        ..B20.34      # Prob 50%                      #2642.32
-                                # LOE
-..B20.32:                       # Preds ..B20.31
-..LN2351:
-        movl      -76(%ebp), %eax                               #2642.43
-        addl      16(%ebx), %eax                                #2642.43
-..LN2353:
-        movl      -44(%ebp), %edx                               #2642.49
-        cmpl      %edx, %eax                                    #2642.49
-        ja        ..B20.34      # Prob 50%                      #2642.49
-                                # LOE
-..B20.33:                       # Preds ..B20.32
-..LN2355:
-        movl      $1, %eax                                      #2642.63
-        leave                                                   #2642.63
-..___tag_value_eval_2na_16.455:                                 #
-        movl      %ebx, %esp                                    #2642.63
-        popl      %ebx                                          #2642.63
-..___tag_value_eval_2na_16.456:                                 #
-        ret                                                     #2642.63
-..___tag_value_eval_2na_16.458:                                 #
-                                # LOE
-..B20.34:                       # Preds ..B20.32 ..B20.31 ..B20.17
-..LN2357:
-        movl      16(%ebx), %eax                                #2647.17
-        addl      $4, %eax                                      #2647.17
-        movl      %eax, 16(%ebx)                                #2647.17
-..LN2359:
-        movl      16(%ebx), %eax                                #2650.22
-..LN2361:
-        movl      -44(%ebp), %edx                               #2650.28
-        cmpl      %edx, %eax                                    #2650.28
-        jbe       ..B20.36      # Prob 50%                      #2650.28
-                                # LOE
-..B20.35:                       # Preds ..B20.34
-..LN2363:
-        xorl      %eax, %eax                                    #2651.28
-        leave                                                   #2651.28
-..___tag_value_eval_2na_16.462:                                 #
-        movl      %ebx, %esp                                    #2651.28
-        popl      %ebx                                          #2651.28
-..___tag_value_eval_2na_16.463:                                 #
-        ret                                                     #2651.28
-..___tag_value_eval_2na_16.465:                                 #
-                                # LOE
-..B20.36:                       # Preds ..B20.34
-..LN2365:
-        movl      -20(%ebp), %eax                               #2654.25
-        decl      %eax                                          #2654.25
-        movl      %eax, -20(%ebp)                               #2654.25
-..LN2367:
-        je        ..B20.41      # Prob 50%                      #2654.39
-                                # LOE
-..B20.37:                       # Preds ..B20.36
-..LN2369:
-        movdqa    -248(%ebp), %xmm0                             #2659.43
-..LN2371:
-        psrldq    $1, %xmm0                                     #2659.26
-..LN2373:
-        movdqa    %xmm0, -248(%ebp)                             #2659.17
-..LN2375:
-        movl      -36(%ebp), %eax                               #2662.22
-..LN2377:
-        movl      -40(%ebp), %edx                               #2662.26
-        cmpl      %edx, %eax                                    #2662.26
-        jae       ..B20.39      # Prob 50%                      #2662.26
-                                # LOE
-..B20.38:                       # Preds ..B20.37
-..LN2379:
-        sarl      $8, -56(%ebp)                                 #2664.21
-..LN2381:
-        movl      -36(%ebp), %eax                               #2665.37
-        movzbl    (%eax), %eax                                  #2665.37
-        movzbl    %al, %eax                                     #2665.37
-..LN2383:
-        shll      $8, %eax                                      #2665.48
-..LN2385:
-        orl       -56(%ebp), %eax                               #2665.21
-        movl      %eax, -56(%ebp)                               #2665.21
-..LN2387:
-        movdqa    -248(%ebp), %xmm0                             #2666.49
-..LN2389:
-        movl      -56(%ebp), %eax                               #2666.57
-..LN2391:
-        pinsrw    $7, %eax, %xmm0                               #2666.30
-..LN2393:
-        movdqa    %xmm0, -248(%ebp)                             #2666.21
-                                # LOE
-..B20.39:                       # Preds ..B20.38 ..B20.37
-..LN2395:
-        incl      -36(%ebp)                                     #2670.20
-        jmp       ..B20.12      # Prob 100%                     #2670.20
-                                # LOE
-..B20.41:                       # Preds ..B20.36 ..B20.12
-..LN2397:
-        movl      -48(%ebp), %eax                               #2675.18
-..LN2399:
-        movl      -40(%ebp), %edx                               #2675.25
-        cmpl      %edx, %eax                                    #2675.25
-        jae       ..B20.46      # Prob 50%                      #2675.25
-                                # LOE
-..B20.42:                       # Preds ..B20.41
-..LN2401:
-        movl      16(%ebx), %eax                                #2679.13
-        addl      $56, %eax                                     #2679.13
-        movl      %eax, 16(%ebx)                                #2679.13
-..LN2403:
-        movl      16(%ebx), %eax                                #2680.18
-..LN2405:
-        movl      -44(%ebp), %edx                               #2680.24
-        cmpl      %edx, %eax                                    #2680.24
-        ja        ..B20.46      # Prob 50%                      #2680.24
-                                # LOE
-..B20.43:                       # Preds ..B20.42
-..LN2407:
-        addl      $-8, %esp                                     #2685.22
-..LN2409:
-        movl      -48(%ebp), %eax                               #2685.41
-        movl      %eax, (%esp)                                  #2685.41
-..LN2411:
-        movl      -40(%ebp), %eax                               #2685.46
-        movl      %eax, 4(%esp)                                 #2685.46
-..LN2413:
-        call      prime_buffer_2na                              #2685.22
-                                # LOE xmm0
-..B20.55:                       # Preds ..B20.43
-        addl      $8, %esp                                      #2685.22
-        movdqa    %xmm0, -280(%ebp)                             #2685.22
-                                # LOE
-..B20.44:                       # Preds ..B20.55
-..LN2415:
-        movdqa    -280(%ebp), %xmm0                             #2685.13
-        movdqa    %xmm0, -248(%ebp)                             #2685.13
-..LN2417:
-        addl      $16, -48(%ebp)                                #2763.13
-..LN2419:
-        movl      -48(%ebp), %eax                               #2765.17
-..LN2421:
-        movl      %eax, -36(%ebp)                               #2765.13
-..LN2423:
-        movl      -48(%ebp), %eax                               #2766.18
-..LN2425:
-        movl      -40(%ebp), %edx                               #2766.24
-        cmpl      %edx, %eax                                    #2766.24
-        jae       ..B20.10      # Prob 50%                      #2766.24
-                                # LOE
-..B20.45:                       # Preds ..B20.44
-..LN2427:
-        movl      -48(%ebp), %eax                               #2767.32
-        movzbl    -1(%eax), %eax                                #2767.32
-        movzbl    %al, %eax                                     #2767.32
-..LN2429:
-        shll      $8, %eax                                      #2767.46
-..LN2431:
-        movl      %eax, -56(%ebp)                               #2767.17
-        jmp       ..B20.10      # Prob 100%                     #2767.17
-                                # LOE
-..B20.46:                       # Preds ..B20.42 ..B20.41 ..B20.10
-..LN2433:
-        xorl      %eax, %eax                                    #2776.12
-        leave                                                   #2776.12
-..___tag_value_eval_2na_16.469:                                 #
-        movl      %ebx, %esp                                    #2776.12
-        popl      %ebx                                          #2776.12
-..___tag_value_eval_2na_16.470:                                 #
-        ret                                                     #2776.12
-        .align    2,0x90
-..___tag_value_eval_2na_16.472:                                 #
-                                # LOE
-# mark_end;
-	.type	eval_2na_16, at function
-	.size	eval_2na_16,.-eval_2na_16
-.LNeval_2na_16:
-	.data
-# -- End  eval_2na_16
-	.section .rodata, "a"
-	.align 4
-__$U7:
-	.byte	101
-	.byte	118
-	.byte	97
-	.byte	108
-	.byte	95
-	.byte	50
-	.byte	110
-	.byte	97
-	.byte	95
-	.byte	51
-	.byte	50
-	.byte	0
-	.type	__$U7, at object
-	.size	__$U7,12
-	.text
-# -- Begin  eval_2na_32
-# mark_begin;
-       .align    2,0x90
-eval_2na_32:
-# parameter 1(self): 8 + %ebx
-# parameter 2(ncbi2na): 12 + %ebx
-# parameter 3(pos): 16 + %ebx
-# parameter 4(len): 20 + %ebx
-..B21.1:                        # Preds ..B21.0
-..___tag_value_eval_2na_32.475:                                 #
-..LN2435:
-        pushl     %ebx                                          #2782.1
-..___tag_value_eval_2na_32.480:                                 #
-        movl      %esp, %ebx                                    #2782.1
-..___tag_value_eval_2na_32.481:                                 #
-        andl      $-16, %esp                                    #2782.1
-        pushl     %ebp                                          #2782.1
-        pushl     %ebp                                          #2782.1
-        movl      4(%ebx), %ebp                                 #2782.1
-        movl      %ebp, 4(%esp)                                 #2782.1
-        movl      %esp, %ebp                                    #2782.1
-..___tag_value_eval_2na_32.483:                                 #
-        subl      $296, %esp                                    #2782.1
-        movl      %ebx, -296(%ebp)                              #2782.1
-..LN2437:
-        movl      8(%ebx), %eax                                 #2812.25
-        movl      4(%eax), %eax                                 #2812.25
-..LN2439:
-        movl      %eax, -12(%ebp)                               #2812.23
-..LN2441:
-        movl      20(%ebx), %eax                                #2815.5
-        movl      -12(%ebp), %edx                               #2815.5
-        cmpl      %edx, %eax                                    #2815.5
-        jae       ..B21.3       # Prob 50%                      #2815.5
-                                # LOE
-..B21.2:                        # Preds ..B21.1
-        call      ..L485        # Prob 100%                     #
-..L485:                                                         #
-        popl      %eax                                          #
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L485], %eax     #
-        addl      $-16, %esp                                    #2815.5
-        lea       _2__STRING.9 at GOTOFF(%eax), %edx               #2815.5
-        movl      %edx, (%esp)                                  #2815.5
-        lea       _2__STRING.1 at GOTOFF(%eax), %edx               #2815.5
-        movl      %edx, 4(%esp)                                 #2815.5
-        movl      $2815, 8(%esp)                                #2815.5
-        lea       __$U7 at GOTOFF(%eax), %edx                      #2815.5
-        movl      %edx, 12(%esp)                                #2815.5
-        movl      %eax, %ebx                                    #2815.5
-..___tag_value_eval_2na_32.486:                                 #2815.5
-        call      __assert_fail at PLT                             #2815.5
-        movl      -296(%ebp), %ebx                              #2815.5
-..___tag_value_eval_2na_32.487:                                 #
-                                # LOE
-..B21.49:                       # Preds ..B21.2
-        addl      $16, %esp                                     #2815.5
-                                # LOE
-..B21.3:                        # Preds ..B21.1
-..LN2443:
-        movl      16(%ebx), %eax                                #2819.12
-..LN2445:
-        addl      20(%ebx), %eax                                #2819.5
-        movl      %eax, 20(%ebx)                                #2819.5
-..LN2447:
-        movl      16(%ebx), %eax                                #2822.42
-..LN2449:
-        shrl      $2, %eax                                      #2822.49
-..LN2451:
-        addl      12(%ebx), %eax                                #2822.30
-..LN2453:
-        movl      %eax, -48(%ebp)                               #2822.5
-..LN2455:
-        movl      -12(%ebp), %eax                               #2825.18
-        negl      %eax                                          #2825.18
-        addl      20(%ebx), %eax                                #2825.18
-..LN2457:
-        movl      %eax, -44(%ebp)                               #2825.5
-..LN2459:
-        movl      20(%ebx), %eax                                #2828.44
-..LN2461:
-        addl      $3, %eax                                      #2828.50
-..LN2463:
-        shrl      $2, %eax                                      #2828.57
-..LN2465:
-        addl      12(%ebx), %eax                                #2828.30
-..LN2467:
-        movl      %eax, -40(%ebp)                               #2828.5
-..LN2469:
-        addl      $-8, %esp                                     #2831.14
-..LN2471:
-        movl      -48(%ebp), %eax                               #2831.33
-        movl      %eax, (%esp)                                  #2831.33
-..LN2473:
-        movl      -40(%ebp), %eax                               #2831.38
-        movl      %eax, 4(%esp)                                 #2831.38
-..LN2475:
-        call      prime_buffer_2na                              #2831.14
-                                # LOE xmm0
-..B21.50:                       # Preds ..B21.3
-        addl      $8, %esp                                      #2831.14
-        movdqa    %xmm0, -104(%ebp)                             #2831.14
-                                # LOE
-..B21.4:                        # Preds ..B21.50
-..LN2477:
-        movdqa    -104(%ebp), %xmm0                             #2831.5
-        movdqa    %xmm0, -248(%ebp)                             #2831.5
-..LN2479:
-        addl      $16, -48(%ebp)                                #2832.5
-..LN2481:
-        movl      -48(%ebp), %eax                               #2834.9
-..LN2483:
-        movl      %eax, -36(%ebp)                               #2834.5
-..LN2485:
-        movl      -48(%ebp), %eax                               #2837.10
-..LN2487:
-        movl      -40(%ebp), %edx                               #2837.16
-        cmpl      %edx, %eax                                    #2837.16
-        jae       ..B21.6       # Prob 50%                      #2837.16
-                                # LOE
-..B21.5:                        # Preds ..B21.4
-..LN2489:
-        movl      -48(%ebp), %eax                               #2838.24
-        movzbl    -1(%eax), %eax                                #2838.24
-        movzbl    %al, %eax                                     #2838.24
-..LN2491:
-        shll      $8, %eax                                      #2838.38
-..LN2493:
-        movl      %eax, -56(%ebp)                               #2838.9
-                                # LOE
-..B21.6:                        # Preds ..B21.5 ..B21.4
-..LN2495:
-        movl      8(%ebx), %eax                                 #2842.5
-        movdqa    16(%eax), %xmm0                               #2842.5
-        movdqa    %xmm0, -232(%ebp)                             #2842.5
-        movl      8(%ebx), %eax                                 #2842.5
-        movdqa    32(%eax), %xmm0                               #2842.5
-        movdqa    %xmm0, -216(%ebp)                             #2842.5
-        movl      8(%ebx), %eax                                 #2842.5
-        movdqa    48(%eax), %xmm0                               #2842.5
-        movdqa    %xmm0, -200(%ebp)                             #2842.5
-        movl      8(%ebx), %eax                                 #2842.5
-        movdqa    64(%eax), %xmm0                               #2842.5
-        movdqa    %xmm0, -184(%ebp)                             #2842.5
-        movl      8(%ebx), %eax                                 #2842.5
-        movdqa    80(%eax), %xmm0                               #2842.5
-        movdqa    %xmm0, -168(%ebp)                             #2842.5
-        movl      8(%ebx), %eax                                 #2842.5
-        movdqa    96(%eax), %xmm0                               #2842.5
-        movdqa    %xmm0, -152(%ebp)                             #2842.5
-        movl      8(%ebx), %eax                                 #2842.5
-        movdqa    112(%eax), %xmm0                              #2842.5
-        movdqa    %xmm0, -136(%ebp)                             #2842.5
-        movl      8(%ebx), %eax                                 #2842.5
-        movdqa    128(%eax), %xmm0                              #2842.5
-        movdqa    %xmm0, -120(%ebp)                             #2842.5
-..LN2497:
-        xorl      %eax, %eax                                    #2845.15
-        movl      %eax, -32(%ebp)                               #2845.15
-..LN2499:
-        movl      %eax, -28(%ebp)                               #2845.10
-..LN2501:
-        movl      %eax, -24(%ebp)                               #2845.5
-..LN2503:
-        movl      $4, -20(%ebp)                                 #2849.5
-..LN2505:
-        movl      16(%ebx), %eax                                #2854.14
-..LN2507:
-        andl      $3, %eax                                      #2854.20
-        movl      %eax, -16(%ebp)                               #2854.20
-        je        ..B21.14      # Prob 50%                      #2854.20
-                                # LOE
-..B21.7:                        # Preds ..B21.6
-        movl      -16(%ebp), %eax                               #2854.20
-        cmpl      $1, %eax                                      #2854.20
-        je        ..B21.15      # Prob 50%                      #2854.20
-                                # LOE
-..B21.8:                        # Preds ..B21.7
-        movl      -16(%ebp), %eax                               #2854.20
-        cmpl      $2, %eax                                      #2854.20
-        je        ..B21.16      # Prob 50%                      #2854.20
-                                # LOE
-..B21.9:                        # Preds ..B21.8
-        movl      -16(%ebp), %eax                               #2854.20
-        cmpl      $3, %eax                                      #2854.20
-        je        ..B21.17      # Prob 50%                      #2854.20
-                                # LOE
-..B21.10:                       # Preds ..B21.45 ..B21.44 ..B21.9
-..LN2509:
-        movl      $1, %eax                                      #2859.9
-        testl     %eax, %eax                                    #2859.9
-        je        ..B21.46      # Prob 100%                     #2859.9
-                                # LOE
-..B21.11:                       # Preds ..B21.10
-..LN2511:
-        movl      $4, -20(%ebp)                                 #2861.13
-                                # LOE
-..B21.12:                       # Preds ..B21.39 ..B21.11
-..LN2513:
-        movl      $1, %eax                                      #2864.13
-        testl     %eax, %eax                                    #2864.13
-        je        ..B21.41      # Prob 100%                     #2864.13
-                                # LOE
-..B21.14:                       # Preds ..B21.6 ..B21.12
-..LN2515:
-        movdqa    -248(%ebp), %xmm0                             #2871.38
-..LN2517:
-        movdqa    -216(%ebp), %xmm1                             #2871.46
-..LN2519:
-        pand      %xmm1, %xmm0                                  #2871.22
-..LN2521:
-        movdqa    %xmm0, -264(%ebp)                             #2871.17
-..LN2523:
-        movdqa    -264(%ebp), %xmm0                             #2872.22
-        movdqa    -232(%ebp), %xmm1                             #2872.22
-        pcmpeqd   %xmm1, %xmm0                                  #2872.22
-..LN2525:
-        movdqa    %xmm0, -264(%ebp)                             #2872.17
-..LN2527:
-        movdqa    -264(%ebp), %xmm0                             #2873.42
-..LN2529:
-        pmovmskb  %xmm0, %eax                                   #2873.22
-..LN2531:
-        movl      %eax, -24(%ebp)                               #2873.17
-                                # LOE
-..B21.15:                       # Preds ..B21.7 ..B21.14
-..LN2533:
-        movdqa    -248(%ebp), %xmm0                             #2877.38
-..LN2535:
-        movdqa    -184(%ebp), %xmm1                             #2877.46
-..LN2537:
-        pand      %xmm1, %xmm0                                  #2877.22
-..LN2539:
-        movdqa    %xmm0, -264(%ebp)                             #2877.17
-..LN2541:
-        movdqa    -264(%ebp), %xmm0                             #2878.22
-        movdqa    -200(%ebp), %xmm1                             #2878.22
-        pcmpeqd   %xmm1, %xmm0                                  #2878.22
-..LN2543:
-        movdqa    %xmm0, -264(%ebp)                             #2878.17
-..LN2545:
-        movdqa    -264(%ebp), %xmm0                             #2879.42
-..LN2547:
-        pmovmskb  %xmm0, %eax                                   #2879.22
-..LN2549:
-        movl      %eax, -28(%ebp)                               #2879.17
-                                # LOE
-..B21.16:                       # Preds ..B21.8 ..B21.15
-..LN2551:
-        movdqa    -248(%ebp), %xmm0                             #2883.38
-..LN2553:
-        movdqa    -152(%ebp), %xmm1                             #2883.46
-..LN2555:
-        pand      %xmm1, %xmm0                                  #2883.22
-..LN2557:
-        movdqa    %xmm0, -264(%ebp)                             #2883.17
-..LN2559:
-        movdqa    -264(%ebp), %xmm0                             #2884.22
-        movdqa    -168(%ebp), %xmm1                             #2884.22
-        pcmpeqd   %xmm1, %xmm0                                  #2884.22
-..LN2561:
-        movdqa    %xmm0, -264(%ebp)                             #2884.17
-..LN2563:
-        movdqa    -264(%ebp), %xmm0                             #2885.42
-..LN2565:
-        pmovmskb  %xmm0, %eax                                   #2885.22
-..LN2567:
-        movl      %eax, -32(%ebp)                               #2885.17
-                                # LOE
-..B21.17:                       # Preds ..B21.9 ..B21.16
-..LN2569:
-        movdqa    -248(%ebp), %xmm0                             #2889.38
-..LN2571:
-        movdqa    -120(%ebp), %xmm1                             #2889.46
-..LN2573:
-        pand      %xmm1, %xmm0                                  #2889.22
-..LN2575:
-        movdqa    %xmm0, -264(%ebp)                             #2889.17
-..LN2577:
-        movdqa    -264(%ebp), %xmm0                             #2890.22
-        movdqa    -136(%ebp), %xmm1                             #2890.22
-        pcmpeqd   %xmm1, %xmm0                                  #2890.22
-..LN2579:
-        movdqa    %xmm0, -264(%ebp)                             #2890.17
-..LN2581:
-        movdqa    -264(%ebp), %xmm0                             #2891.42
-..LN2583:
-        pmovmskb  %xmm0, %eax                                   #2891.22
-..LN2585:
-        movl      %eax, -52(%ebp)                               #2891.17
-..LN2587:
-        movl      16(%ebx), %eax                                #2896.17
-        andl      $-4, %eax                                     #2896.17
-        movl      %eax, 16(%ebx)                                #2896.17
-..LN2589:
-        movl      -28(%ebp), %eax                               #2899.29
-        orl       -24(%ebp), %eax                               #2899.29
-..LN2591:
-        orl       -32(%ebp), %eax                               #2899.34
-..LN2593:
-        orl       -52(%ebp), %eax                               #2899.39
-..LN2595:
-        je        ..B21.34      # Prob 50%                      #2899.47
-                                # LOE
-..B21.18:                       # Preds ..B21.17
-..LN2597:
-        pushl     %edi                                          #2917.30
-..LN2599:
-        movl      -24(%ebp), %eax                               #2917.58
-        movw      %ax, (%esp)                                   #2917.58
-..LN2601:
-        call      uint16_lsbit                                  #2917.30
-                                # LOE eax
-..B21.51:                       # Preds ..B21.18
-        popl      %ecx                                          #2917.30
-        movl      %eax, -72(%ebp)                               #2917.30
-                                # LOE
-..B21.19:                       # Preds ..B21.51
-        movl      -72(%ebp), %eax                               #2917.30
-        movswl    %ax, %eax                                     #2917.30
-..LN2603:
-        movl      %eax, -88(%ebp)                               #2917.28
-..LN2605:
-        pushl     %edi                                          #2918.30
-..LN2607:
-        movl      -28(%ebp), %eax                               #2918.58
-        movw      %ax, (%esp)                                   #2918.58
-..LN2609:
-        call      uint16_lsbit                                  #2918.30
-                                # LOE eax
-..B21.52:                       # Preds ..B21.19
-        popl      %ecx                                          #2918.30
-        movl      %eax, -68(%ebp)                               #2918.30
-                                # LOE
-..B21.20:                       # Preds ..B21.52
-        movl      -68(%ebp), %eax                               #2918.30
-        movswl    %ax, %eax                                     #2918.30
-..LN2611:
-        movl      %eax, -84(%ebp)                               #2918.28
-..LN2613:
-        pushl     %edi                                          #2919.30
-..LN2615:
-        movl      -32(%ebp), %eax                               #2919.58
-        movw      %ax, (%esp)                                   #2919.58
-..LN2617:
-        call      uint16_lsbit                                  #2919.30
-                                # LOE eax
-..B21.53:                       # Preds ..B21.20
-        popl      %ecx                                          #2919.30
-        movl      %eax, -64(%ebp)                               #2919.30
-                                # LOE
-..B21.21:                       # Preds ..B21.53
-        movl      -64(%ebp), %eax                               #2919.30
-        movswl    %ax, %eax                                     #2919.30
-..LN2619:
-        movl      %eax, -80(%ebp)                               #2919.28
-..LN2621:
-        pushl     %edi                                          #2920.30
-..LN2623:
-        movl      -52(%ebp), %eax                               #2920.58
-        movw      %ax, (%esp)                                   #2920.58
-..LN2625:
-        call      uint16_lsbit                                  #2920.30
-                                # LOE eax
-..B21.54:                       # Preds ..B21.21
-        popl      %ecx                                          #2920.30
-        movl      %eax, -60(%ebp)                               #2920.30
-                                # LOE
-..B21.22:                       # Preds ..B21.54
-        movl      -60(%ebp), %eax                               #2920.30
-        movswl    %ax, %eax                                     #2920.30
-..LN2627:
-        movl      %eax, -76(%ebp)                               #2920.28
-..LN2629:
-        shll      $2, -88(%ebp)                                 #2925.34
-..LN2631:
-        movl      -84(%ebp), %eax                               #2926.28
-..LN2633:
-        lea       1(,%eax,4), %eax                              #2926.40
-..LN2635:
-        movl      %eax, -84(%ebp)                               #2926.21
-..LN2637:
-        movl      -80(%ebp), %eax                               #2927.28
-..LN2639:
-        lea       2(,%eax,4), %eax                              #2927.40
-..LN2641:
-        movl      %eax, -80(%ebp)                               #2927.21
-..LN2643:
-        movl      -76(%ebp), %eax                               #2928.28
-..LN2645:
-        lea       3(,%eax,4), %eax                              #2928.40
-..LN2647:
-        movl      %eax, -76(%ebp)                               #2928.21
-..LN2649:
-        movl      -24(%ebp), %eax                               #2932.26
-..LN2651:
-        testl     %eax, %eax                                    #2932.32
-        je        ..B21.25      # Prob 50%                      #2932.32
-                                # LOE
-..B21.23:                       # Preds ..B21.22
-..LN2653:
-        movl      -88(%ebp), %eax                               #2932.43
-        addl      16(%ebx), %eax                                #2932.43
-..LN2655:
-        movl      -44(%ebp), %edx                               #2932.49
-        cmpl      %edx, %eax                                    #2932.49
-        ja        ..B21.25      # Prob 50%                      #2932.49
-                                # LOE
-..B21.24:                       # Preds ..B21.23
-..LN2657:
-        movl      $1, %eax                                      #2932.63
-        leave                                                   #2932.63
-..___tag_value_eval_2na_32.489:                                 #
-        movl      %ebx, %esp                                    #2932.63
-        popl      %ebx                                          #2932.63
-..___tag_value_eval_2na_32.490:                                 #
-        ret                                                     #2932.63
-..___tag_value_eval_2na_32.492:                                 #
-                                # LOE
-..B21.25:                       # Preds ..B21.23 ..B21.22
-..LN2659:
-        movl      -28(%ebp), %eax                               #2933.26
-..LN2661:
-        testl     %eax, %eax                                    #2933.32
-        je        ..B21.28      # Prob 50%                      #2933.32
-                                # LOE
-..B21.26:                       # Preds ..B21.25
-..LN2663:
-        movl      -84(%ebp), %eax                               #2933.43
-        addl      16(%ebx), %eax                                #2933.43
-..LN2665:
-        movl      -44(%ebp), %edx                               #2933.49
-        cmpl      %edx, %eax                                    #2933.49
-        ja        ..B21.28      # Prob 50%                      #2933.49
-                                # LOE
-..B21.27:                       # Preds ..B21.26
-..LN2667:
-        movl      $1, %eax                                      #2933.63
-        leave                                                   #2933.63
-..___tag_value_eval_2na_32.496:                                 #
-        movl      %ebx, %esp                                    #2933.63
-        popl      %ebx                                          #2933.63
-..___tag_value_eval_2na_32.497:                                 #
-        ret                                                     #2933.63
-..___tag_value_eval_2na_32.499:                                 #
-                                # LOE
-..B21.28:                       # Preds ..B21.26 ..B21.25
-..LN2669:
-        movl      -32(%ebp), %eax                               #2934.26
-..LN2671:
-        testl     %eax, %eax                                    #2934.32
-        je        ..B21.31      # Prob 50%                      #2934.32
-                                # LOE
-..B21.29:                       # Preds ..B21.28
-..LN2673:
-        movl      -80(%ebp), %eax                               #2934.43
-        addl      16(%ebx), %eax                                #2934.43
-..LN2675:
-        movl      -44(%ebp), %edx                               #2934.49
-        cmpl      %edx, %eax                                    #2934.49
-        ja        ..B21.31      # Prob 50%                      #2934.49
-                                # LOE
-..B21.30:                       # Preds ..B21.29
-..LN2677:
-        movl      $1, %eax                                      #2934.63
-        leave                                                   #2934.63
-..___tag_value_eval_2na_32.503:                                 #
-        movl      %ebx, %esp                                    #2934.63
-        popl      %ebx                                          #2934.63
-..___tag_value_eval_2na_32.504:                                 #
-        ret                                                     #2934.63
-..___tag_value_eval_2na_32.506:                                 #
-                                # LOE
-..B21.31:                       # Preds ..B21.29 ..B21.28
-..LN2679:
-        movl      -52(%ebp), %eax                               #2935.26
-..LN2681:
-        testl     %eax, %eax                                    #2935.32
-        je        ..B21.34      # Prob 50%                      #2935.32
-                                # LOE
-..B21.32:                       # Preds ..B21.31
-..LN2683:
-        movl      -76(%ebp), %eax                               #2935.43
-        addl      16(%ebx), %eax                                #2935.43
-..LN2685:
-        movl      -44(%ebp), %edx                               #2935.49
-        cmpl      %edx, %eax                                    #2935.49
-        ja        ..B21.34      # Prob 50%                      #2935.49
-                                # LOE
-..B21.33:                       # Preds ..B21.32
-..LN2687:
-        movl      $1, %eax                                      #2935.63
-        leave                                                   #2935.63
-..___tag_value_eval_2na_32.510:                                 #
-        movl      %ebx, %esp                                    #2935.63
-        popl      %ebx                                          #2935.63
-..___tag_value_eval_2na_32.511:                                 #
-        ret                                                     #2935.63
-..___tag_value_eval_2na_32.513:                                 #
-                                # LOE
-..B21.34:                       # Preds ..B21.32 ..B21.31 ..B21.17
-..LN2689:
-        movl      16(%ebx), %eax                                #2940.17
-        addl      $4, %eax                                      #2940.17
-        movl      %eax, 16(%ebx)                                #2940.17
-..LN2691:
-        movl      16(%ebx), %eax                                #2943.22
-..LN2693:
-        movl      -44(%ebp), %edx                               #2943.28
-        cmpl      %edx, %eax                                    #2943.28
-        jbe       ..B21.36      # Prob 50%                      #2943.28
-                                # LOE
-..B21.35:                       # Preds ..B21.34
-..LN2695:
-        xorl      %eax, %eax                                    #2944.28
-        leave                                                   #2944.28
-..___tag_value_eval_2na_32.517:                                 #
-        movl      %ebx, %esp                                    #2944.28
-        popl      %ebx                                          #2944.28
-..___tag_value_eval_2na_32.518:                                 #
-        ret                                                     #2944.28
-..___tag_value_eval_2na_32.520:                                 #
-                                # LOE
-..B21.36:                       # Preds ..B21.34
-..LN2697:
-        movl      -20(%ebp), %eax                               #2947.25
-        decl      %eax                                          #2947.25
-        movl      %eax, -20(%ebp)                               #2947.25
-..LN2699:
-        je        ..B21.41      # Prob 50%                      #2947.39
-                                # LOE
-..B21.37:                       # Preds ..B21.36
-..LN2701:
-        movdqa    -248(%ebp), %xmm0                             #2952.43
-..LN2703:
-        psrldq    $1, %xmm0                                     #2952.26
-..LN2705:
-        movdqa    %xmm0, -248(%ebp)                             #2952.17
-..LN2707:
-        movl      -36(%ebp), %eax                               #2955.22
-..LN2709:
-        movl      -40(%ebp), %edx                               #2955.26
-        cmpl      %edx, %eax                                    #2955.26
-        jae       ..B21.39      # Prob 50%                      #2955.26
-                                # LOE
-..B21.38:                       # Preds ..B21.37
-..LN2711:
-        sarl      $8, -56(%ebp)                                 #2957.21
-..LN2713:
-        movl      -36(%ebp), %eax                               #2958.37
-        movzbl    (%eax), %eax                                  #2958.37
-        movzbl    %al, %eax                                     #2958.37
-..LN2715:
-        shll      $8, %eax                                      #2958.48
-..LN2717:
-        orl       -56(%ebp), %eax                               #2958.21
-        movl      %eax, -56(%ebp)                               #2958.21
-..LN2719:
-        movdqa    -248(%ebp), %xmm0                             #2959.49
-..LN2721:
-        movl      -56(%ebp), %eax                               #2959.57
-..LN2723:
-        pinsrw    $7, %eax, %xmm0                               #2959.30
-..LN2725:
-        movdqa    %xmm0, -248(%ebp)                             #2959.21
-                                # LOE
-..B21.39:                       # Preds ..B21.38 ..B21.37
-..LN2727:
-        incl      -36(%ebp)                                     #2963.20
-        jmp       ..B21.12      # Prob 100%                     #2963.20
-                                # LOE
-..B21.41:                       # Preds ..B21.36 ..B21.12
-..LN2729:
-        movl      -48(%ebp), %eax                               #2968.18
-..LN2731:
-        movl      -40(%ebp), %edx                               #2968.25
-        cmpl      %edx, %eax                                    #2968.25
-        jae       ..B21.46      # Prob 50%                      #2968.25
-                                # LOE
-..B21.42:                       # Preds ..B21.41
-..LN2733:
-        movl      16(%ebx), %eax                                #2972.13
-        addl      $48, %eax                                     #2972.13
-        movl      %eax, 16(%ebx)                                #2972.13
-..LN2735:
-        movl      16(%ebx), %eax                                #2973.18
-..LN2737:
-        movl      -44(%ebp), %edx                               #2973.24
-        cmpl      %edx, %eax                                    #2973.24
-        ja        ..B21.46      # Prob 50%                      #2973.24
-                                # LOE
-..B21.43:                       # Preds ..B21.42
-..LN2739:
-        addl      $-8, %esp                                     #2978.22
-..LN2741:
-        movl      -48(%ebp), %eax                               #2978.41
-        movl      %eax, (%esp)                                  #2978.41
-..LN2743:
-        movl      -40(%ebp), %eax                               #2978.46
-        movl      %eax, 4(%esp)                                 #2978.46
-..LN2745:
-        call      prime_buffer_2na                              #2978.22
-                                # LOE xmm0
-..B21.55:                       # Preds ..B21.43
-        addl      $8, %esp                                      #2978.22
-        movdqa    %xmm0, -280(%ebp)                             #2978.22
-                                # LOE
-..B21.44:                       # Preds ..B21.55
-..LN2747:
-        movdqa    -280(%ebp), %xmm0                             #2978.13
-        movdqa    %xmm0, -248(%ebp)                             #2978.13
-..LN2749:
-        addl      $16, -48(%ebp)                                #3056.13
-..LN2751:
-        movl      -48(%ebp), %eax                               #3058.17
-..LN2753:
-        movl      %eax, -36(%ebp)                               #3058.13
-..LN2755:
-        movl      -48(%ebp), %eax                               #3059.18
-..LN2757:
-        movl      -40(%ebp), %edx                               #3059.24
-        cmpl      %edx, %eax                                    #3059.24
-        jae       ..B21.10      # Prob 50%                      #3059.24
-                                # LOE
-..B21.45:                       # Preds ..B21.44
-..LN2759:
-        movl      -48(%ebp), %eax                               #3060.32
-        movzbl    -1(%eax), %eax                                #3060.32
-        movzbl    %al, %eax                                     #3060.32
-..LN2761:
-        shll      $8, %eax                                      #3060.46
-..LN2763:
-        movl      %eax, -56(%ebp)                               #3060.17
-        jmp       ..B21.10      # Prob 100%                     #3060.17
-                                # LOE
-..B21.46:                       # Preds ..B21.42 ..B21.41 ..B21.10
-..LN2765:
-        xorl      %eax, %eax                                    #3069.12
-        leave                                                   #3069.12
-..___tag_value_eval_2na_32.524:                                 #
-        movl      %ebx, %esp                                    #3069.12
-        popl      %ebx                                          #3069.12
-..___tag_value_eval_2na_32.525:                                 #
-        ret                                                     #3069.12
-        .align    2,0x90
-..___tag_value_eval_2na_32.527:                                 #
-                                # LOE
-# mark_end;
-	.type	eval_2na_32, at function
-	.size	eval_2na_32,.-eval_2na_32
-.LNeval_2na_32:
-	.data
-# -- End  eval_2na_32
-	.section .rodata, "a"
-	.align 4
-__$U8:
-	.byte	101
-	.byte	118
-	.byte	97
-	.byte	108
-	.byte	95
-	.byte	50
-	.byte	110
-	.byte	97
-	.byte	95
-	.byte	54
-	.byte	52
-	.byte	0
-	.type	__$U8, at object
-	.size	__$U8,12
-	.text
-# -- Begin  eval_2na_64
-# mark_begin;
-       .align    2,0x90
-eval_2na_64:
-# parameter 1(self): 8 + %ebx
-# parameter 2(ncbi2na): 12 + %ebx
-# parameter 3(pos): 16 + %ebx
-# parameter 4(len): 20 + %ebx
-..B22.1:                        # Preds ..B22.0
-..___tag_value_eval_2na_64.530:                                 #
-..LN2767:
-        pushl     %ebx                                          #3075.1
-..___tag_value_eval_2na_64.535:                                 #
-        movl      %esp, %ebx                                    #3075.1
-..___tag_value_eval_2na_64.536:                                 #
-        andl      $-16, %esp                                    #3075.1
-        pushl     %ebp                                          #3075.1
-        pushl     %ebp                                          #3075.1
-        movl      4(%ebx), %ebp                                 #3075.1
-        movl      %ebp, 4(%esp)                                 #3075.1
-        movl      %esp, %ebp                                    #3075.1
-..___tag_value_eval_2na_64.538:                                 #
-        subl      $296, %esp                                    #3075.1
-        movl      %ebx, -296(%ebp)                              #3075.1
-..LN2769:
-        movl      8(%ebx), %eax                                 #3106.25
-        movl      4(%eax), %eax                                 #3106.25
-..LN2771:
-        movl      %eax, -12(%ebp)                               #3106.23
-..LN2773:
-        movl      20(%ebx), %eax                                #3109.5
-        movl      -12(%ebp), %edx                               #3109.5
-        cmpl      %edx, %eax                                    #3109.5
-        jae       ..B22.3       # Prob 50%                      #3109.5
-                                # LOE
-..B22.2:                        # Preds ..B22.1
-        call      ..L540        # Prob 100%                     #
-..L540:                                                         #
-        popl      %eax                                          #
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L540], %eax     #
-        addl      $-16, %esp                                    #3109.5
-        lea       _2__STRING.9 at GOTOFF(%eax), %edx               #3109.5
-        movl      %edx, (%esp)                                  #3109.5
-        lea       _2__STRING.1 at GOTOFF(%eax), %edx               #3109.5
-        movl      %edx, 4(%esp)                                 #3109.5
-        movl      $3109, 8(%esp)                                #3109.5
-        lea       __$U8 at GOTOFF(%eax), %edx                      #3109.5
-        movl      %edx, 12(%esp)                                #3109.5
-        movl      %eax, %ebx                                    #3109.5
-..___tag_value_eval_2na_64.541:                                 #3109.5
-        call      __assert_fail at PLT                             #3109.5
-        movl      -296(%ebp), %ebx                              #3109.5
-..___tag_value_eval_2na_64.542:                                 #
-                                # LOE
-..B22.49:                       # Preds ..B22.2
-        addl      $16, %esp                                     #3109.5
-                                # LOE
-..B22.3:                        # Preds ..B22.1
-..LN2775:
-        movl      16(%ebx), %eax                                #3113.12
-..LN2777:
-        addl      20(%ebx), %eax                                #3113.5
-        movl      %eax, 20(%ebx)                                #3113.5
-..LN2779:
-        movl      16(%ebx), %eax                                #3116.42
-..LN2781:
-        shrl      $2, %eax                                      #3116.49
-..LN2783:
-        addl      12(%ebx), %eax                                #3116.30
-..LN2785:
-        movl      %eax, -48(%ebp)                               #3116.5
-..LN2787:
-        movl      -12(%ebp), %eax                               #3119.18
-        negl      %eax                                          #3119.18
-        addl      20(%ebx), %eax                                #3119.18
-..LN2789:
-        movl      %eax, -44(%ebp)                               #3119.5
-..LN2791:
-        movl      20(%ebx), %eax                                #3122.44
-..LN2793:
-        addl      $3, %eax                                      #3122.50
-..LN2795:
-        shrl      $2, %eax                                      #3122.57
-..LN2797:
-        addl      12(%ebx), %eax                                #3122.30
-..LN2799:
-        movl      %eax, -40(%ebp)                               #3122.5
-..LN2801:
-        addl      $-8, %esp                                     #3125.14
-..LN2803:
-        movl      -48(%ebp), %eax                               #3125.33
-        movl      %eax, (%esp)                                  #3125.33
-..LN2805:
-        movl      -40(%ebp), %eax                               #3125.38
-        movl      %eax, 4(%esp)                                 #3125.38
-..LN2807:
-        call      prime_buffer_2na                              #3125.14
-                                # LOE xmm0
-..B22.50:                       # Preds ..B22.3
-        addl      $8, %esp                                      #3125.14
-        movdqa    %xmm0, -104(%ebp)                             #3125.14
-                                # LOE
-..B22.4:                        # Preds ..B22.50
-..LN2809:
-        movdqa    -104(%ebp), %xmm0                             #3125.5
-        movdqa    %xmm0, -248(%ebp)                             #3125.5
-..LN2811:
-        addl      $16, -48(%ebp)                                #3126.5
-..LN2813:
-        movl      -48(%ebp), %eax                               #3128.9
-..LN2815:
-        movl      %eax, -36(%ebp)                               #3128.5
-..LN2817:
-        movl      -48(%ebp), %eax                               #3131.10
-..LN2819:
-        movl      -40(%ebp), %edx                               #3131.16
-        cmpl      %edx, %eax                                    #3131.16
-        jae       ..B22.6       # Prob 50%                      #3131.16
-                                # LOE
-..B22.5:                        # Preds ..B22.4
-..LN2821:
-        movl      -48(%ebp), %eax                               #3132.24
-        movzbl    -1(%eax), %eax                                #3132.24
-        movzbl    %al, %eax                                     #3132.24
-..LN2823:
-        shll      $8, %eax                                      #3132.38
-..LN2825:
-        movl      %eax, -56(%ebp)                               #3132.9
-                                # LOE
-..B22.6:                        # Preds ..B22.5 ..B22.4
-..LN2827:
-        movl      8(%ebx), %eax                                 #3136.5
-        movdqa    16(%eax), %xmm0                               #3136.5
-        movdqa    %xmm0, -232(%ebp)                             #3136.5
-        movl      8(%ebx), %eax                                 #3136.5
-        movdqa    32(%eax), %xmm0                               #3136.5
-        movdqa    %xmm0, -216(%ebp)                             #3136.5
-        movl      8(%ebx), %eax                                 #3136.5
-        movdqa    48(%eax), %xmm0                               #3136.5
-        movdqa    %xmm0, -200(%ebp)                             #3136.5
-        movl      8(%ebx), %eax                                 #3136.5
-        movdqa    64(%eax), %xmm0                               #3136.5
-        movdqa    %xmm0, -184(%ebp)                             #3136.5
-        movl      8(%ebx), %eax                                 #3136.5
-        movdqa    80(%eax), %xmm0                               #3136.5
-        movdqa    %xmm0, -168(%ebp)                             #3136.5
-        movl      8(%ebx), %eax                                 #3136.5
-        movdqa    96(%eax), %xmm0                               #3136.5
-        movdqa    %xmm0, -152(%ebp)                             #3136.5
-        movl      8(%ebx), %eax                                 #3136.5
-        movdqa    112(%eax), %xmm0                              #3136.5
-        movdqa    %xmm0, -136(%ebp)                             #3136.5
-        movl      8(%ebx), %eax                                 #3136.5
-        movdqa    128(%eax), %xmm0                              #3136.5
-        movdqa    %xmm0, -120(%ebp)                             #3136.5
-..LN2829:
-        xorl      %eax, %eax                                    #3139.15
-        movl      %eax, -32(%ebp)                               #3139.15
-..LN2831:
-        movl      %eax, -28(%ebp)                               #3139.10
-..LN2833:
-        movl      %eax, -24(%ebp)                               #3139.5
-..LN2835:
-        movl      $8, -20(%ebp)                                 #3143.5
-..LN2837:
-        movl      16(%ebx), %eax                                #3148.14
-..LN2839:
-        andl      $3, %eax                                      #3148.20
-        movl      %eax, -16(%ebp)                               #3148.20
-        je        ..B22.14      # Prob 50%                      #3148.20
-                                # LOE
-..B22.7:                        # Preds ..B22.6
-        movl      -16(%ebp), %eax                               #3148.20
-        cmpl      $1, %eax                                      #3148.20
-        je        ..B22.15      # Prob 50%                      #3148.20
-                                # LOE
-..B22.8:                        # Preds ..B22.7
-        movl      -16(%ebp), %eax                               #3148.20
-        cmpl      $2, %eax                                      #3148.20
-        je        ..B22.16      # Prob 50%                      #3148.20
-                                # LOE
-..B22.9:                        # Preds ..B22.8
-        movl      -16(%ebp), %eax                               #3148.20
-        cmpl      $3, %eax                                      #3148.20
-        je        ..B22.17      # Prob 50%                      #3148.20
-                                # LOE
-..B22.10:                       # Preds ..B22.45 ..B22.44 ..B22.9
-..LN2841:
-        movl      $1, %eax                                      #3153.9
-        testl     %eax, %eax                                    #3153.9
-        je        ..B22.46      # Prob 100%                     #3153.9
-                                # LOE
-..B22.11:                       # Preds ..B22.10
-..LN2843:
-        movl      $8, -20(%ebp)                                 #3155.13
-                                # LOE
-..B22.12:                       # Preds ..B22.39 ..B22.11
-..LN2845:
-        movl      $1, %eax                                      #3158.13
-        testl     %eax, %eax                                    #3158.13
-        je        ..B22.41      # Prob 100%                     #3158.13
-                                # LOE
-..B22.14:                       # Preds ..B22.6 ..B22.12
-..LN2847:
-        movdqa    -248(%ebp), %xmm0                             #3165.38
-..LN2849:
-        movdqa    -216(%ebp), %xmm1                             #3165.46
-..LN2851:
-        pand      %xmm1, %xmm0                                  #3165.22
-..LN2853:
-        movdqa    %xmm0, -264(%ebp)                             #3165.17
-..LN2855:
-        movdqa    -264(%ebp), %xmm0                             #3166.22
-        movdqa    -232(%ebp), %xmm1                             #3166.22
-        pcmpeqd   %xmm1, %xmm0                                  #3166.22
-..LN2857:
-        movdqa    %xmm0, -264(%ebp)                             #3166.17
-..LN2859:
-        movdqa    -264(%ebp), %xmm0                             #3167.42
-..LN2861:
-        pmovmskb  %xmm0, %eax                                   #3167.22
-..LN2863:
-        movl      %eax, -24(%ebp)                               #3167.17
-..LN2865:
-        movl      -24(%ebp), %eax                               #3168.17
-        andl      $3855, %eax                                   #3168.17
-        shll      $4, %eax                                      #3168.17
-        andl      -24(%ebp), %eax                               #3168.17
-        movl      %eax, -24(%ebp)                               #3168.17
-        movl      -24(%ebp), %eax                               #3168.17
-        sarl      $4, %eax                                      #3168.17
-        orl       -24(%ebp), %eax                               #3168.17
-        movl      %eax, -24(%ebp)                               #3168.17
-                                # LOE
-..B22.15:                       # Preds ..B22.7 ..B22.14
-..LN2867:
-        movdqa    -248(%ebp), %xmm0                             #3171.38
-..LN2869:
-        movdqa    -184(%ebp), %xmm1                             #3171.46
-..LN2871:
-        pand      %xmm1, %xmm0                                  #3171.22
-..LN2873:
-        movdqa    %xmm0, -264(%ebp)                             #3171.17
-..LN2875:
-        movdqa    -264(%ebp), %xmm0                             #3172.22
-        movdqa    -200(%ebp), %xmm1                             #3172.22
-        pcmpeqd   %xmm1, %xmm0                                  #3172.22
-..LN2877:
-        movdqa    %xmm0, -264(%ebp)                             #3172.17
-..LN2879:
-        movdqa    -264(%ebp), %xmm0                             #3173.42
-..LN2881:
-        pmovmskb  %xmm0, %eax                                   #3173.22
-..LN2883:
-        movl      %eax, -28(%ebp)                               #3173.17
-..LN2885:
-        movl      -28(%ebp), %eax                               #3174.17
-        andl      $3855, %eax                                   #3174.17
-        shll      $4, %eax                                      #3174.17
-        andl      -28(%ebp), %eax                               #3174.17
-        movl      %eax, -28(%ebp)                               #3174.17
-        movl      -28(%ebp), %eax                               #3174.17
-        sarl      $4, %eax                                      #3174.17
-        orl       -28(%ebp), %eax                               #3174.17
-        movl      %eax, -28(%ebp)                               #3174.17
-                                # LOE
-..B22.16:                       # Preds ..B22.8 ..B22.15
-..LN2887:
-        movdqa    -248(%ebp), %xmm0                             #3177.38
-..LN2889:
-        movdqa    -152(%ebp), %xmm1                             #3177.46
-..LN2891:
-        pand      %xmm1, %xmm0                                  #3177.22
-..LN2893:
-        movdqa    %xmm0, -264(%ebp)                             #3177.17
-..LN2895:
-        movdqa    -264(%ebp), %xmm0                             #3178.22
-        movdqa    -168(%ebp), %xmm1                             #3178.22
-        pcmpeqd   %xmm1, %xmm0                                  #3178.22
-..LN2897:
-        movdqa    %xmm0, -264(%ebp)                             #3178.17
-..LN2899:
-        movdqa    -264(%ebp), %xmm0                             #3179.42
-..LN2901:
-        pmovmskb  %xmm0, %eax                                   #3179.22
-..LN2903:
-        movl      %eax, -32(%ebp)                               #3179.17
-..LN2905:
-        movl      -32(%ebp), %eax                               #3180.17
-        andl      $3855, %eax                                   #3180.17
-        shll      $4, %eax                                      #3180.17
-        andl      -32(%ebp), %eax                               #3180.17
-        movl      %eax, -32(%ebp)                               #3180.17
-        movl      -32(%ebp), %eax                               #3180.17
-        sarl      $4, %eax                                      #3180.17
-        orl       -32(%ebp), %eax                               #3180.17
-        movl      %eax, -32(%ebp)                               #3180.17
-                                # LOE
-..B22.17:                       # Preds ..B22.9 ..B22.16
-..LN2907:
-        movdqa    -248(%ebp), %xmm0                             #3183.38
-..LN2909:
-        movdqa    -120(%ebp), %xmm1                             #3183.46
-..LN2911:
-        pand      %xmm1, %xmm0                                  #3183.22
-..LN2913:
-        movdqa    %xmm0, -264(%ebp)                             #3183.17
-..LN2915:
-        movdqa    -264(%ebp), %xmm0                             #3184.22
-        movdqa    -136(%ebp), %xmm1                             #3184.22
-        pcmpeqd   %xmm1, %xmm0                                  #3184.22
-..LN2917:
-        movdqa    %xmm0, -264(%ebp)                             #3184.17
-..LN2919:
-        movdqa    -264(%ebp), %xmm0                             #3185.42
-..LN2921:
-        pmovmskb  %xmm0, %eax                                   #3185.22
-..LN2923:
-        movl      %eax, -52(%ebp)                               #3185.17
-..LN2925:
-        movl      -52(%ebp), %eax                               #3186.17
-        andl      $3855, %eax                                   #3186.17
-        shll      $4, %eax                                      #3186.17
-        andl      -52(%ebp), %eax                               #3186.17
-        movl      %eax, -52(%ebp)                               #3186.17
-        movl      -52(%ebp), %eax                               #3186.17
-        sarl      $4, %eax                                      #3186.17
-        orl       -52(%ebp), %eax                               #3186.17
-        movl      %eax, -52(%ebp)                               #3186.17
-..LN2927:
-        movl      16(%ebx), %eax                                #3190.17
-        andl      $-4, %eax                                     #3190.17
-        movl      %eax, 16(%ebx)                                #3190.17
-..LN2929:
-        movl      -28(%ebp), %eax                               #3193.29
-        orl       -24(%ebp), %eax                               #3193.29
-..LN2931:
-        orl       -32(%ebp), %eax                               #3193.34
-..LN2933:
-        orl       -52(%ebp), %eax                               #3193.39
-..LN2935:
-        je        ..B22.34      # Prob 50%                      #3193.47
-                                # LOE
-..B22.18:                       # Preds ..B22.17
-..LN2937:
-        pushl     %edi                                          #3211.30
-..LN2939:
-        movl      -24(%ebp), %eax                               #3211.58
-        movw      %ax, (%esp)                                   #3211.58
-..LN2941:
-        call      uint16_lsbit                                  #3211.30
-                                # LOE eax
-..B22.51:                       # Preds ..B22.18
-        popl      %ecx                                          #3211.30
-        movl      %eax, -72(%ebp)                               #3211.30
-                                # LOE
-..B22.19:                       # Preds ..B22.51
-        movl      -72(%ebp), %eax                               #3211.30
-        movswl    %ax, %eax                                     #3211.30
-..LN2943:
-        movl      %eax, -88(%ebp)                               #3211.28
-..LN2945:
-        pushl     %edi                                          #3212.30
-..LN2947:
-        movl      -28(%ebp), %eax                               #3212.58
-        movw      %ax, (%esp)                                   #3212.58
-..LN2949:
-        call      uint16_lsbit                                  #3212.30
-                                # LOE eax
-..B22.52:                       # Preds ..B22.19
-        popl      %ecx                                          #3212.30
-        movl      %eax, -68(%ebp)                               #3212.30
-                                # LOE
-..B22.20:                       # Preds ..B22.52
-        movl      -68(%ebp), %eax                               #3212.30
-        movswl    %ax, %eax                                     #3212.30
-..LN2951:
-        movl      %eax, -84(%ebp)                               #3212.28
-..LN2953:
-        pushl     %edi                                          #3213.30
-..LN2955:
-        movl      -32(%ebp), %eax                               #3213.58
-        movw      %ax, (%esp)                                   #3213.58
-..LN2957:
-        call      uint16_lsbit                                  #3213.30
-                                # LOE eax
-..B22.53:                       # Preds ..B22.20
-        popl      %ecx                                          #3213.30
-        movl      %eax, -64(%ebp)                               #3213.30
-                                # LOE
-..B22.21:                       # Preds ..B22.53
-        movl      -64(%ebp), %eax                               #3213.30
-        movswl    %ax, %eax                                     #3213.30
-..LN2959:
-        movl      %eax, -80(%ebp)                               #3213.28
-..LN2961:
-        pushl     %edi                                          #3214.30
-..LN2963:
-        movl      -52(%ebp), %eax                               #3214.58
-        movw      %ax, (%esp)                                   #3214.58
-..LN2965:
-        call      uint16_lsbit                                  #3214.30
-                                # LOE eax
-..B22.54:                       # Preds ..B22.21
-        popl      %ecx                                          #3214.30
-        movl      %eax, -60(%ebp)                               #3214.30
-                                # LOE
-..B22.22:                       # Preds ..B22.54
-        movl      -60(%ebp), %eax                               #3214.30
-        movswl    %ax, %eax                                     #3214.30
-..LN2967:
-        movl      %eax, -76(%ebp)                               #3214.28
-..LN2969:
-        shll      $2, -88(%ebp)                                 #3219.34
-..LN2971:
-        movl      -84(%ebp), %eax                               #3220.28
-..LN2973:
-        lea       1(,%eax,4), %eax                              #3220.40
-..LN2975:
-        movl      %eax, -84(%ebp)                               #3220.21
-..LN2977:
-        movl      -80(%ebp), %eax                               #3221.28
-..LN2979:
-        lea       2(,%eax,4), %eax                              #3221.40
-..LN2981:
-        movl      %eax, -80(%ebp)                               #3221.21
-..LN2983:
-        movl      -76(%ebp), %eax                               #3222.28
-..LN2985:
-        lea       3(,%eax,4), %eax                              #3222.40
-..LN2987:
-        movl      %eax, -76(%ebp)                               #3222.21
-..LN2989:
-        movl      -24(%ebp), %eax                               #3226.26
-..LN2991:
-        testl     %eax, %eax                                    #3226.32
-        je        ..B22.25      # Prob 50%                      #3226.32
-                                # LOE
-..B22.23:                       # Preds ..B22.22
-..LN2993:
-        movl      -88(%ebp), %eax                               #3226.43
-        addl      16(%ebx), %eax                                #3226.43
-..LN2995:
-        movl      -44(%ebp), %edx                               #3226.49
-        cmpl      %edx, %eax                                    #3226.49
-        ja        ..B22.25      # Prob 50%                      #3226.49
-                                # LOE
-..B22.24:                       # Preds ..B22.23
-..LN2997:
-        movl      $1, %eax                                      #3226.63
-        leave                                                   #3226.63
-..___tag_value_eval_2na_64.544:                                 #
-        movl      %ebx, %esp                                    #3226.63
-        popl      %ebx                                          #3226.63
-..___tag_value_eval_2na_64.545:                                 #
-        ret                                                     #3226.63
-..___tag_value_eval_2na_64.547:                                 #
-                                # LOE
-..B22.25:                       # Preds ..B22.23 ..B22.22
-..LN2999:
-        movl      -28(%ebp), %eax                               #3227.26
-..LN3001:
-        testl     %eax, %eax                                    #3227.32
-        je        ..B22.28      # Prob 50%                      #3227.32
-                                # LOE
-..B22.26:                       # Preds ..B22.25
-..LN3003:
-        movl      -84(%ebp), %eax                               #3227.43
-        addl      16(%ebx), %eax                                #3227.43
-..LN3005:
-        movl      -44(%ebp), %edx                               #3227.49
-        cmpl      %edx, %eax                                    #3227.49
-        ja        ..B22.28      # Prob 50%                      #3227.49
-                                # LOE
-..B22.27:                       # Preds ..B22.26
-..LN3007:
-        movl      $1, %eax                                      #3227.63
-        leave                                                   #3227.63
-..___tag_value_eval_2na_64.551:                                 #
-        movl      %ebx, %esp                                    #3227.63
-        popl      %ebx                                          #3227.63
-..___tag_value_eval_2na_64.552:                                 #
-        ret                                                     #3227.63
-..___tag_value_eval_2na_64.554:                                 #
-                                # LOE
-..B22.28:                       # Preds ..B22.26 ..B22.25
-..LN3009:
-        movl      -32(%ebp), %eax                               #3228.26
-..LN3011:
-        testl     %eax, %eax                                    #3228.32
-        je        ..B22.31      # Prob 50%                      #3228.32
-                                # LOE
-..B22.29:                       # Preds ..B22.28
-..LN3013:
-        movl      -80(%ebp), %eax                               #3228.43
-        addl      16(%ebx), %eax                                #3228.43
-..LN3015:
-        movl      -44(%ebp), %edx                               #3228.49
-        cmpl      %edx, %eax                                    #3228.49
-        ja        ..B22.31      # Prob 50%                      #3228.49
-                                # LOE
-..B22.30:                       # Preds ..B22.29
-..LN3017:
-        movl      $1, %eax                                      #3228.63
-        leave                                                   #3228.63
-..___tag_value_eval_2na_64.558:                                 #
-        movl      %ebx, %esp                                    #3228.63
-        popl      %ebx                                          #3228.63
-..___tag_value_eval_2na_64.559:                                 #
-        ret                                                     #3228.63
-..___tag_value_eval_2na_64.561:                                 #
-                                # LOE
-..B22.31:                       # Preds ..B22.29 ..B22.28
-..LN3019:
-        movl      -52(%ebp), %eax                               #3229.26
-..LN3021:
-        testl     %eax, %eax                                    #3229.32
-        je        ..B22.34      # Prob 50%                      #3229.32
-                                # LOE
-..B22.32:                       # Preds ..B22.31
-..LN3023:
-        movl      -76(%ebp), %eax                               #3229.43
-        addl      16(%ebx), %eax                                #3229.43
-..LN3025:
-        movl      -44(%ebp), %edx                               #3229.49
-        cmpl      %edx, %eax                                    #3229.49
-        ja        ..B22.34      # Prob 50%                      #3229.49
-                                # LOE
-..B22.33:                       # Preds ..B22.32
-..LN3027:
-        movl      $1, %eax                                      #3229.63
-        leave                                                   #3229.63
-..___tag_value_eval_2na_64.565:                                 #
-        movl      %ebx, %esp                                    #3229.63
-        popl      %ebx                                          #3229.63
-..___tag_value_eval_2na_64.566:                                 #
-        ret                                                     #3229.63
-..___tag_value_eval_2na_64.568:                                 #
-                                # LOE
-..B22.34:                       # Preds ..B22.32 ..B22.31 ..B22.17
-..LN3029:
-        movl      16(%ebx), %eax                                #3234.17
-        addl      $4, %eax                                      #3234.17
-        movl      %eax, 16(%ebx)                                #3234.17
-..LN3031:
-        movl      16(%ebx), %eax                                #3237.22
-..LN3033:
-        movl      -44(%ebp), %edx                               #3237.28
-        cmpl      %edx, %eax                                    #3237.28
-        jbe       ..B22.36      # Prob 50%                      #3237.28
-                                # LOE
-..B22.35:                       # Preds ..B22.34
-..LN3035:
-        xorl      %eax, %eax                                    #3238.28
-        leave                                                   #3238.28
-..___tag_value_eval_2na_64.572:                                 #
-        movl      %ebx, %esp                                    #3238.28
-        popl      %ebx                                          #3238.28
-..___tag_value_eval_2na_64.573:                                 #
-        ret                                                     #3238.28
-..___tag_value_eval_2na_64.575:                                 #
-                                # LOE
-..B22.36:                       # Preds ..B22.34
-..LN3037:
-        movl      -20(%ebp), %eax                               #3241.25
-        decl      %eax                                          #3241.25
-        movl      %eax, -20(%ebp)                               #3241.25
-..LN3039:
-        je        ..B22.41      # Prob 50%                      #3241.39
-                                # LOE
-..B22.37:                       # Preds ..B22.36
-..LN3041:
-        movdqa    -248(%ebp), %xmm0                             #3246.43
-..LN3043:
-        psrldq    $1, %xmm0                                     #3246.26
-..LN3045:
-        movdqa    %xmm0, -248(%ebp)                             #3246.17
-..LN3047:
-        movl      -36(%ebp), %eax                               #3249.22
-..LN3049:
-        movl      -40(%ebp), %edx                               #3249.26
-        cmpl      %edx, %eax                                    #3249.26
-        jae       ..B22.39      # Prob 50%                      #3249.26
-                                # LOE
-..B22.38:                       # Preds ..B22.37
-..LN3051:
-        sarl      $8, -56(%ebp)                                 #3251.21
-..LN3053:
-        movl      -36(%ebp), %eax                               #3252.37
-        movzbl    (%eax), %eax                                  #3252.37
-        movzbl    %al, %eax                                     #3252.37
-..LN3055:
-        shll      $8, %eax                                      #3252.48
-..LN3057:
-        orl       -56(%ebp), %eax                               #3252.21
-        movl      %eax, -56(%ebp)                               #3252.21
-..LN3059:
-        movdqa    -248(%ebp), %xmm0                             #3253.49
-..LN3061:
-        movl      -56(%ebp), %eax                               #3253.57
-..LN3063:
-        pinsrw    $7, %eax, %xmm0                               #3253.30
-..LN3065:
-        movdqa    %xmm0, -248(%ebp)                             #3253.21
-                                # LOE
-..B22.39:                       # Preds ..B22.38 ..B22.37
-..LN3067:
-        incl      -36(%ebp)                                     #3257.20
-        jmp       ..B22.12      # Prob 100%                     #3257.20
-                                # LOE
-..B22.41:                       # Preds ..B22.36 ..B22.12
-..LN3069:
-        movl      -48(%ebp), %eax                               #3262.18
-..LN3071:
-        movl      -40(%ebp), %edx                               #3262.25
-        cmpl      %edx, %eax                                    #3262.25
-        jae       ..B22.46      # Prob 50%                      #3262.25
-                                # LOE
-..B22.42:                       # Preds ..B22.41
-..LN3073:
-        movl      16(%ebx), %eax                                #3266.13
-        addl      $32, %eax                                     #3266.13
-        movl      %eax, 16(%ebx)                                #3266.13
-..LN3075:
-        movl      16(%ebx), %eax                                #3267.18
-..LN3077:
-        movl      -44(%ebp), %edx                               #3267.24
-        cmpl      %edx, %eax                                    #3267.24
-        ja        ..B22.46      # Prob 50%                      #3267.24
-                                # LOE
-..B22.43:                       # Preds ..B22.42
-..LN3079:
-        addl      $-8, %esp                                     #3272.22
-..LN3081:
-        movl      -48(%ebp), %eax                               #3272.41
-        movl      %eax, (%esp)                                  #3272.41
-..LN3083:
-        movl      -40(%ebp), %eax                               #3272.46
-        movl      %eax, 4(%esp)                                 #3272.46
-..LN3085:
-        call      prime_buffer_2na                              #3272.22
-                                # LOE xmm0
-..B22.55:                       # Preds ..B22.43
-        addl      $8, %esp                                      #3272.22
-        movdqa    %xmm0, -280(%ebp)                             #3272.22
-                                # LOE
-..B22.44:                       # Preds ..B22.55
-..LN3087:
-        movdqa    -280(%ebp), %xmm0                             #3272.13
-        movdqa    %xmm0, -248(%ebp)                             #3272.13
-..LN3089:
-        addl      $16, -48(%ebp)                                #3350.13
-..LN3091:
-        movl      -48(%ebp), %eax                               #3352.17
-..LN3093:
-        movl      %eax, -36(%ebp)                               #3352.13
-..LN3095:
-        movl      -48(%ebp), %eax                               #3353.18
-..LN3097:
-        movl      -40(%ebp), %edx                               #3353.24
-        cmpl      %edx, %eax                                    #3353.24
-        jae       ..B22.10      # Prob 50%                      #3353.24
-                                # LOE
-..B22.45:                       # Preds ..B22.44
-..LN3099:
-        movl      -48(%ebp), %eax                               #3354.32
-        movzbl    -1(%eax), %eax                                #3354.32
-        movzbl    %al, %eax                                     #3354.32
-..LN3101:
-        shll      $8, %eax                                      #3354.46
-..LN3103:
-        movl      %eax, -56(%ebp)                               #3354.17
-        jmp       ..B22.10      # Prob 100%                     #3354.17
-                                # LOE
-..B22.46:                       # Preds ..B22.42 ..B22.41 ..B22.10
-..LN3105:
-        xorl      %eax, %eax                                    #3363.12
-        leave                                                   #3363.12
-..___tag_value_eval_2na_64.579:                                 #
-        movl      %ebx, %esp                                    #3363.12
-        popl      %ebx                                          #3363.12
-..___tag_value_eval_2na_64.580:                                 #
-        ret                                                     #3363.12
-        .align    2,0x90
-..___tag_value_eval_2na_64.582:                                 #
-                                # LOE
-# mark_end;
-	.type	eval_2na_64, at function
-	.size	eval_2na_64,.-eval_2na_64
-.LNeval_2na_64:
-	.data
-# -- End  eval_2na_64
-	.section .rodata, "a"
-	.align 4
-__$U9:
-	.byte	101
-	.byte	118
-	.byte	97
-	.byte	108
-	.byte	95
-	.byte	50
-	.byte	110
-	.byte	97
-	.byte	95
-	.byte	49
-	.byte	50
-	.byte	56
-	.byte	0
-	.type	__$U9, at object
-	.size	__$U9,13
-	.text
-# -- Begin  eval_2na_128
-# mark_begin;
-       .align    2,0x90
-eval_2na_128:
-# parameter 1(self): 8 + %ebx
-# parameter 2(ncbi2na): 12 + %ebx
-# parameter 3(pos): 16 + %ebx
-# parameter 4(len): 20 + %ebx
-..B23.1:                        # Preds ..B23.0
-..___tag_value_eval_2na_128.585:                                #
-..LN3107:
-        pushl     %ebx                                          #3369.1
-..___tag_value_eval_2na_128.590:                                #
-        movl      %esp, %ebx                                    #3369.1
-..___tag_value_eval_2na_128.591:                                #
-        andl      $-16, %esp                                    #3369.1
-        pushl     %ebp                                          #3369.1
-        pushl     %ebp                                          #3369.1
-        movl      4(%ebx), %ebp                                 #3369.1
-        movl      %ebp, 4(%esp)                                 #3369.1
-        movl      %esp, %ebp                                    #3369.1
-..___tag_value_eval_2na_128.593:                                #
-        subl      $264, %esp                                    #3369.1
-        movl      %ebx, -264(%ebp)                              #3369.1
-..LN3109:
-        movl      8(%ebx), %eax                                 #3399.25
-        movl      4(%eax), %eax                                 #3399.25
-..LN3111:
-        movl      %eax, -8(%ebp)                                #3399.23
-..LN3113:
-        movl      20(%ebx), %eax                                #3402.5
-        movl      -8(%ebp), %edx                                #3402.5
-        cmpl      %edx, %eax                                    #3402.5
-        jae       ..B23.3       # Prob 50%                      #3402.5
-                                # LOE
-..B23.2:                        # Preds ..B23.1
-        call      ..L595        # Prob 100%                     #
-..L595:                                                         #
-        popl      %eax                                          #
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L595], %eax     #
-        addl      $-16, %esp                                    #3402.5
-        lea       _2__STRING.9 at GOTOFF(%eax), %edx               #3402.5
-        movl      %edx, (%esp)                                  #3402.5
-        lea       _2__STRING.1 at GOTOFF(%eax), %edx               #3402.5
-        movl      %edx, 4(%esp)                                 #3402.5
-        movl      $3402, 8(%esp)                                #3402.5
-        lea       __$U9 at GOTOFF(%eax), %edx                      #3402.5
-        movl      %edx, 12(%esp)                                #3402.5
-        movl      %eax, %ebx                                    #3402.5
-..___tag_value_eval_2na_128.596:                                #3402.5
-        call      __assert_fail at PLT                             #3402.5
-        movl      -264(%ebp), %ebx                              #3402.5
-..___tag_value_eval_2na_128.597:                                #
-                                # LOE
-..B23.44:                       # Preds ..B23.2
-        addl      $16, %esp                                     #3402.5
-                                # LOE
-..B23.3:                        # Preds ..B23.1
-..LN3115:
-        movl      16(%ebx), %eax                                #3406.12
-..LN3117:
-        addl      20(%ebx), %eax                                #3406.5
-        movl      %eax, 20(%ebx)                                #3406.5
-..LN3119:
-        movl      16(%ebx), %eax                                #3409.42
-..LN3121:
-        shrl      $2, %eax                                      #3409.49
-..LN3123:
-        addl      12(%ebx), %eax                                #3409.30
-..LN3125:
-        movl      %eax, -44(%ebp)                               #3409.5
-..LN3127:
-        movl      -8(%ebp), %eax                                #3412.18
-        negl      %eax                                          #3412.18
-        addl      20(%ebx), %eax                                #3412.18
-..LN3129:
-        movl      %eax, -40(%ebp)                               #3412.5
-..LN3131:
-        movl      20(%ebx), %eax                                #3415.44
-..LN3133:
-        addl      $3, %eax                                      #3415.50
-..LN3135:
-        shrl      $2, %eax                                      #3415.57
-..LN3137:
-        addl      12(%ebx), %eax                                #3415.30
-..LN3139:
-        movl      %eax, -36(%ebp)                               #3415.5
-..LN3141:
-        addl      $-8, %esp                                     #3418.14
-..LN3143:
-        movl      -44(%ebp), %eax                               #3418.33
-        movl      %eax, (%esp)                                  #3418.33
-..LN3145:
-        movl      -36(%ebp), %eax                               #3418.38
-        movl      %eax, 4(%esp)                                 #3418.38
-..LN3147:
-        call      prime_buffer_2na                              #3418.14
-                                # LOE xmm0
-..B23.45:                       # Preds ..B23.3
-        addl      $8, %esp                                      #3418.14
-        movdqa    %xmm0, -72(%ebp)                              #3418.14
-                                # LOE
-..B23.4:                        # Preds ..B23.45
-..LN3149:
-        movdqa    -72(%ebp), %xmm0                              #3418.5
-        movdqa    %xmm0, -216(%ebp)                             #3418.5
-..LN3151:
-        addl      $16, -44(%ebp)                                #3419.5
-..LN3153:
-        movl      -44(%ebp), %eax                               #3421.9
-..LN3155:
-        movl      %eax, -32(%ebp)                               #3421.5
-..LN3157:
-        movl      -44(%ebp), %eax                               #3424.10
-..LN3159:
-        movl      -36(%ebp), %edx                               #3424.16
-        cmpl      %edx, %eax                                    #3424.16
-        jae       ..B23.6       # Prob 50%                      #3424.16
-                                # LOE
-..B23.5:                        # Preds ..B23.4
-..LN3161:
-        movl      -44(%ebp), %eax                               #3425.24
-        movzbl    -1(%eax), %eax                                #3425.24
-        movzbl    %al, %eax                                     #3425.24
-..LN3163:
-        shll      $8, %eax                                      #3425.38
-..LN3165:
-        movl      %eax, -52(%ebp)                               #3425.9
-                                # LOE
-..B23.6:                        # Preds ..B23.5 ..B23.4
-..LN3167:
-        movl      8(%ebx), %eax                                 #3429.5
-        movdqa    16(%eax), %xmm0                               #3429.5
-        movdqa    %xmm0, -200(%ebp)                             #3429.5
-        movl      8(%ebx), %eax                                 #3429.5
-        movdqa    32(%eax), %xmm0                               #3429.5
-        movdqa    %xmm0, -184(%ebp)                             #3429.5
-        movl      8(%ebx), %eax                                 #3429.5
-        movdqa    48(%eax), %xmm0                               #3429.5
-        movdqa    %xmm0, -168(%ebp)                             #3429.5
-        movl      8(%ebx), %eax                                 #3429.5
-        movdqa    64(%eax), %xmm0                               #3429.5
-        movdqa    %xmm0, -152(%ebp)                             #3429.5
-        movl      8(%ebx), %eax                                 #3429.5
-        movdqa    80(%eax), %xmm0                               #3429.5
-        movdqa    %xmm0, -136(%ebp)                             #3429.5
-        movl      8(%ebx), %eax                                 #3429.5
-        movdqa    96(%eax), %xmm0                               #3429.5
-        movdqa    %xmm0, -120(%ebp)                             #3429.5
-        movl      8(%ebx), %eax                                 #3429.5
-        movdqa    112(%eax), %xmm0                              #3429.5
-        movdqa    %xmm0, -104(%ebp)                             #3429.5
-        movl      8(%ebx), %eax                                 #3429.5
-        movdqa    128(%eax), %xmm0                              #3429.5
-        movdqa    %xmm0, -88(%ebp)                              #3429.5
-..LN3169:
-        xorl      %eax, %eax                                    #3432.15
-        movl      %eax, -28(%ebp)                               #3432.15
-..LN3171:
-        movl      %eax, -24(%ebp)                               #3432.10
-..LN3173:
-        movl      %eax, -20(%ebp)                               #3432.5
-..LN3175:
-        movl      16(%ebx), %eax                                #3434.27
-        negl      %eax                                          #3434.27
-..LN3177:
-        movl      -40(%ebp), %edx                               #3434.20
-..LN3179:
-        lea       7(%edx,%eax), %eax                            #3434.33
-..LN3181:
-        shrl      $2, %eax                                      #3434.40
-..LN3183:
-        movl      %eax, -16(%ebp)                               #3434.5
-..LN3185:
-        movl      16(%ebx), %eax                                #3441.14
-..LN3187:
-        andl      $3, %eax                                      #3441.20
-        movl      %eax, -12(%ebp)                               #3441.20
-        je        ..B23.14      # Prob 50%                      #3441.20
-                                # LOE
-..B23.7:                        # Preds ..B23.6
-        movl      -12(%ebp), %eax                               #3441.20
-        cmpl      $1, %eax                                      #3441.20
-        je        ..B23.15      # Prob 50%                      #3441.20
-                                # LOE
-..B23.8:                        # Preds ..B23.7
-        movl      -12(%ebp), %eax                               #3441.20
-        cmpl      $2, %eax                                      #3441.20
-        je        ..B23.16      # Prob 50%                      #3441.20
-                                # LOE
-..B23.9:                        # Preds ..B23.8
-        movl      -12(%ebp), %eax                               #3441.20
-        cmpl      $3, %eax                                      #3441.20
-        je        ..B23.17      # Prob 50%                      #3441.20
-                                # LOE
-..B23.10:                       # Preds ..B23.40 ..B23.39 ..B23.9
-..LN3189:
-        movl      $1, %eax                                      #3446.9
-        testl     %eax, %eax                                    #3446.9
-        je        ..B23.41      # Prob 100%                     #3446.9
-                                # LOE
-..B23.11:                       # Preds ..B23.10
-..LN3191:
-        movl      $16, -16(%ebp)                                #3448.13
-                                # LOE
-..B23.12:                       # Preds ..B23.34 ..B23.11
-..LN3193:
-        movl      $1, %eax                                      #3451.13
-        testl     %eax, %eax                                    #3451.13
-        je        ..B23.36      # Prob 100%                     #3451.13
-                                # LOE
-..B23.14:                       # Preds ..B23.6 ..B23.12
-..LN3195:
-        movdqa    -216(%ebp), %xmm0                             #3458.38
-..LN3197:
-        movdqa    -184(%ebp), %xmm1                             #3458.46
-..LN3199:
-        pand      %xmm1, %xmm0                                  #3458.22
-..LN3201:
-        movdqa    %xmm0, -232(%ebp)                             #3458.17
-..LN3203:
-        movdqa    -232(%ebp), %xmm0                             #3459.22
-        movdqa    -200(%ebp), %xmm1                             #3459.22
-        pcmpeqd   %xmm1, %xmm0                                  #3459.22
-..LN3205:
-        movdqa    %xmm0, -232(%ebp)                             #3459.17
-..LN3207:
-        movdqa    -232(%ebp), %xmm0                             #3460.42
-..LN3209:
-        pmovmskb  %xmm0, %eax                                   #3460.22
-..LN3211:
-        movl      %eax, -20(%ebp)                               #3460.17
-..LN3213:
-        movl      -20(%ebp), %eax                               #3461.17
-        incl      %eax                                          #3461.17
-        sarl      $16, %eax                                     #3461.17
-        negl      %eax                                          #3461.17
-        movl      %eax, -20(%ebp)                               #3461.17
-                                # LOE
-..B23.15:                       # Preds ..B23.7 ..B23.14
-..LN3215:
-        movdqa    -216(%ebp), %xmm0                             #3464.38
-..LN3217:
-        movdqa    -152(%ebp), %xmm1                             #3464.46
-..LN3219:
-        pand      %xmm1, %xmm0                                  #3464.22
-..LN3221:
-        movdqa    %xmm0, -232(%ebp)                             #3464.17
-..LN3223:
-        movdqa    -232(%ebp), %xmm0                             #3465.22
-        movdqa    -168(%ebp), %xmm1                             #3465.22
-        pcmpeqd   %xmm1, %xmm0                                  #3465.22
-..LN3225:
-        movdqa    %xmm0, -232(%ebp)                             #3465.17
-..LN3227:
-        movdqa    -232(%ebp), %xmm0                             #3466.42
-..LN3229:
-        pmovmskb  %xmm0, %eax                                   #3466.22
-..LN3231:
-        movl      %eax, -24(%ebp)                               #3466.17
-..LN3233:
-        movl      -24(%ebp), %eax                               #3467.17
-        incl      %eax                                          #3467.17
-        sarl      $16, %eax                                     #3467.17
-        negl      %eax                                          #3467.17
-        movl      %eax, -24(%ebp)                               #3467.17
-                                # LOE
-..B23.16:                       # Preds ..B23.8 ..B23.15
-..LN3235:
-        movdqa    -216(%ebp), %xmm0                             #3470.38
-..LN3237:
-        movdqa    -120(%ebp), %xmm1                             #3470.46
-..LN3239:
-        pand      %xmm1, %xmm0                                  #3470.22
-..LN3241:
-        movdqa    %xmm0, -232(%ebp)                             #3470.17
-..LN3243:
-        movdqa    -232(%ebp), %xmm0                             #3471.22
-        movdqa    -136(%ebp), %xmm1                             #3471.22
-        pcmpeqd   %xmm1, %xmm0                                  #3471.22
-..LN3245:
-        movdqa    %xmm0, -232(%ebp)                             #3471.17
-..LN3247:
-        movdqa    -232(%ebp), %xmm0                             #3472.42
-..LN3249:
-        pmovmskb  %xmm0, %eax                                   #3472.22
-..LN3251:
-        movl      %eax, -28(%ebp)                               #3472.17
-..LN3253:
-        movl      -28(%ebp), %eax                               #3473.17
-        incl      %eax                                          #3473.17
-        sarl      $16, %eax                                     #3473.17
-        negl      %eax                                          #3473.17
-        movl      %eax, -28(%ebp)                               #3473.17
-                                # LOE
-..B23.17:                       # Preds ..B23.9 ..B23.16
-..LN3255:
-        movdqa    -216(%ebp), %xmm0                             #3476.38
-..LN3257:
-        movdqa    -88(%ebp), %xmm1                              #3476.46
-..LN3259:
-        pand      %xmm1, %xmm0                                  #3476.22
-..LN3261:
-        movdqa    %xmm0, -232(%ebp)                             #3476.17
-..LN3263:
-        movdqa    -232(%ebp), %xmm0                             #3477.22
-        movdqa    -104(%ebp), %xmm1                             #3477.22
-        pcmpeqd   %xmm1, %xmm0                                  #3477.22
-..LN3265:
-        movdqa    %xmm0, -232(%ebp)                             #3477.17
-..LN3267:
-        movdqa    -232(%ebp), %xmm0                             #3478.42
-..LN3269:
-        pmovmskb  %xmm0, %eax                                   #3478.22
-..LN3271:
-        movl      %eax, -48(%ebp)                               #3478.17
-..LN3273:
-        movl      -48(%ebp), %eax                               #3479.17
-        incl      %eax                                          #3479.17
-        sarl      $16, %eax                                     #3479.17
-        negl      %eax                                          #3479.17
-        movl      %eax, -48(%ebp)                               #3479.17
-..LN3275:
-        movl      16(%ebx), %eax                                #3483.17
-        andl      $-4, %eax                                     #3483.17
-        movl      %eax, 16(%ebx)                                #3483.17
-..LN3277:
-        movl      -24(%ebp), %eax                               #3486.29
-        orl       -20(%ebp), %eax                               #3486.29
-..LN3279:
-        orl       -28(%ebp), %eax                               #3486.34
-..LN3281:
-        orl       -48(%ebp), %eax                               #3486.39
-..LN3283:
-        je        ..B23.29      # Prob 50%                      #3486.47
-                                # LOE
-..B23.18:                       # Preds ..B23.17
-..LN3285:
-        movl      16(%ebx), %eax                                #3489.37
-        negl      %eax                                          #3489.37
-        addl      -40(%ebp), %eax                               #3489.37
-        movl      %eax, -56(%ebp)                               #3489.37
-        cmpl      $2, %eax                                      #3489.37
-        je        ..B23.22      # Prob 50%                      #3489.37
-                                # LOE
-..B23.19:                       # Preds ..B23.18
-        movl      -56(%ebp), %eax                               #3489.37
-        cmpl      $1, %eax                                      #3489.37
-        je        ..B23.24      # Prob 50%                      #3489.37
-                                # LOE
-..B23.20:                       # Preds ..B23.19
-        movl      -56(%ebp), %eax                               #3489.37
-        testl     %eax, %eax                                    #3489.37
-        je        ..B23.26      # Prob 50%                      #3489.37
-                                # LOE
-..B23.21:                       # Preds ..B23.20
-..LN3287:
-        movl      $1, %eax                                      #3492.32
-        leave                                                   #3492.32
-..___tag_value_eval_2na_128.599:                                #
-        movl      %ebx, %esp                                    #3492.32
-        popl      %ebx                                          #3492.32
-..___tag_value_eval_2na_128.600:                                #
-        ret                                                     #3492.32
-..___tag_value_eval_2na_128.602:                                #
-                                # LOE
-..B23.22:                       # Preds ..B23.18
-..LN3289:
-        movl      -28(%ebp), %eax                               #3494.30
-..LN3291:
-        testl     %eax, %eax                                    #3494.36
-        je        ..B23.24      # Prob 50%                      #3494.36
-                                # LOE
-..B23.23:                       # Preds ..B23.22
-..LN3293:
-        movl      $1, %eax                                      #3494.47
-        leave                                                   #3494.47
-..___tag_value_eval_2na_128.606:                                #
-        movl      %ebx, %esp                                    #3494.47
-        popl      %ebx                                          #3494.47
-..___tag_value_eval_2na_128.607:                                #
-        ret                                                     #3494.47
-..___tag_value_eval_2na_128.609:                                #
-                                # LOE
-..B23.24:                       # Preds ..B23.22 ..B23.19
-..LN3295:
-        movl      -24(%ebp), %eax                               #3496.30
-..LN3297:
-        testl     %eax, %eax                                    #3496.36
-        je        ..B23.26      # Prob 50%                      #3496.36
-                                # LOE
-..B23.25:                       # Preds ..B23.24
-..LN3299:
-        movl      $1, %eax                                      #3496.47
-        leave                                                   #3496.47
-..___tag_value_eval_2na_128.613:                                #
-        movl      %ebx, %esp                                    #3496.47
-        popl      %ebx                                          #3496.47
-..___tag_value_eval_2na_128.614:                                #
-        ret                                                     #3496.47
-..___tag_value_eval_2na_128.616:                                #
-                                # LOE
-..B23.26:                       # Preds ..B23.24 ..B23.20
-..LN3301:
-        movl      -20(%ebp), %eax                               #3498.30
-..LN3303:
-        testl     %eax, %eax                                    #3498.36
-        je        ..B23.28      # Prob 50%                      #3498.36
-                                # LOE
-..B23.27:                       # Preds ..B23.26
-..LN3305:
-        movl      $1, %eax                                      #3498.47
-        leave                                                   #3498.47
-..___tag_value_eval_2na_128.620:                                #
-        movl      %ebx, %esp                                    #3498.47
-        popl      %ebx                                          #3498.47
-..___tag_value_eval_2na_128.621:                                #
-        ret                                                     #3498.47
-..___tag_value_eval_2na_128.623:                                #
-                                # LOE
-..B23.28:                       # Preds ..B23.26
-..LN3307:
-        xorl      %eax, %eax                                    #3500.28
-        leave                                                   #3500.28
-..___tag_value_eval_2na_128.627:                                #
-        movl      %ebx, %esp                                    #3500.28
-        popl      %ebx                                          #3500.28
-..___tag_value_eval_2na_128.628:                                #
-        ret                                                     #3500.28
-..___tag_value_eval_2na_128.630:                                #
-                                # LOE
-..B23.29:                       # Preds ..B23.17
-..LN3309:
-        movl      16(%ebx), %eax                                #3527.17
-        addl      $4, %eax                                      #3527.17
-        movl      %eax, 16(%ebx)                                #3527.17
-..LN3311:
-        movl      16(%ebx), %eax                                #3530.22
-..LN3313:
-        movl      -40(%ebp), %edx                               #3530.28
-        cmpl      %edx, %eax                                    #3530.28
-        jbe       ..B23.31      # Prob 50%                      #3530.28
-                                # LOE
-..B23.30:                       # Preds ..B23.29
-..LN3315:
-        xorl      %eax, %eax                                    #3531.28
-        leave                                                   #3531.28
-..___tag_value_eval_2na_128.634:                                #
-        movl      %ebx, %esp                                    #3531.28
-        popl      %ebx                                          #3531.28
-..___tag_value_eval_2na_128.635:                                #
-        ret                                                     #3531.28
-..___tag_value_eval_2na_128.637:                                #
-                                # LOE
-..B23.31:                       # Preds ..B23.29
-..LN3317:
-        movl      -16(%ebp), %eax                               #3534.25
-        decl      %eax                                          #3534.25
-        movl      %eax, -16(%ebp)                               #3534.25
-..LN3319:
-        je        ..B23.36      # Prob 50%                      #3534.39
-                                # LOE
-..B23.32:                       # Preds ..B23.31
-..LN3321:
-        movdqa    -216(%ebp), %xmm0                             #3539.43
-..LN3323:
-        psrldq    $1, %xmm0                                     #3539.26
-..LN3325:
-        movdqa    %xmm0, -216(%ebp)                             #3539.17
-..LN3327:
-        movl      -32(%ebp), %eax                               #3542.22
-..LN3329:
-        movl      -36(%ebp), %edx                               #3542.26
-        cmpl      %edx, %eax                                    #3542.26
-        jae       ..B23.34      # Prob 50%                      #3542.26
-                                # LOE
-..B23.33:                       # Preds ..B23.32
-..LN3331:
-        sarl      $8, -52(%ebp)                                 #3544.21
-..LN3333:
-        movl      -32(%ebp), %eax                               #3545.37
-        movzbl    (%eax), %eax                                  #3545.37
-        movzbl    %al, %eax                                     #3545.37
-..LN3335:
-        shll      $8, %eax                                      #3545.48
-..LN3337:
-        orl       -52(%ebp), %eax                               #3545.21
-        movl      %eax, -52(%ebp)                               #3545.21
-..LN3339:
-        movdqa    -216(%ebp), %xmm0                             #3546.49
-..LN3341:
-        movl      -52(%ebp), %eax                               #3546.57
-..LN3343:
-        pinsrw    $7, %eax, %xmm0                               #3546.30
-..LN3345:
-        movdqa    %xmm0, -216(%ebp)                             #3546.21
-                                # LOE
-..B23.34:                       # Preds ..B23.33 ..B23.32
-..LN3347:
-        incl      -32(%ebp)                                     #3550.20
-        jmp       ..B23.12      # Prob 100%                     #3550.20
-                                # LOE
-..B23.36:                       # Preds ..B23.31 ..B23.12
-..LN3349:
-        movl      -44(%ebp), %eax                               #3555.18
-..LN3351:
-        movl      -36(%ebp), %edx                               #3555.25
-        cmpl      %edx, %eax                                    #3555.25
-        jae       ..B23.41      # Prob 50%                      #3555.25
-                                # LOE
-..B23.37:                       # Preds ..B23.36
-..LN3353:
-        movl      16(%ebx), %eax                                #3560.18
-..LN3355:
-        movl      -40(%ebp), %edx                               #3560.24
-        cmpl      %edx, %eax                                    #3560.24
-        ja        ..B23.41      # Prob 50%                      #3560.24
-                                # LOE
-..B23.38:                       # Preds ..B23.37
-..LN3357:
-        addl      $-8, %esp                                     #3565.22
-..LN3359:
-        movl      -44(%ebp), %eax                               #3565.41
-        movl      %eax, (%esp)                                  #3565.41
-..LN3361:
-        movl      -36(%ebp), %eax                               #3565.46
-        movl      %eax, 4(%esp)                                 #3565.46
-..LN3363:
-        call      prime_buffer_2na                              #3565.22
-                                # LOE xmm0
-..B23.46:                       # Preds ..B23.38
-        addl      $8, %esp                                      #3565.22
-        movdqa    %xmm0, -248(%ebp)                             #3565.22
-                                # LOE
-..B23.39:                       # Preds ..B23.46
-..LN3365:
-        movdqa    -248(%ebp), %xmm0                             #3565.13
-        movdqa    %xmm0, -216(%ebp)                             #3565.13
-..LN3367:
-        addl      $16, -44(%ebp)                                #3643.13
-..LN3369:
-        movl      -44(%ebp), %eax                               #3645.17
-..LN3371:
-        movl      %eax, -32(%ebp)                               #3645.13
-..LN3373:
-        movl      -44(%ebp), %eax                               #3646.18
-..LN3375:
-        movl      -36(%ebp), %edx                               #3646.24
-        cmpl      %edx, %eax                                    #3646.24
-        jae       ..B23.10      # Prob 50%                      #3646.24
-                                # LOE
-..B23.40:                       # Preds ..B23.39
-..LN3377:
-        movl      -44(%ebp), %eax                               #3647.32
-        movzbl    -1(%eax), %eax                                #3647.32
-        movzbl    %al, %eax                                     #3647.32
-..LN3379:
-        shll      $8, %eax                                      #3647.46
-..LN3381:
-        movl      %eax, -52(%ebp)                               #3647.17
-        jmp       ..B23.10      # Prob 100%                     #3647.17
-                                # LOE
-..B23.41:                       # Preds ..B23.37 ..B23.36 ..B23.10
-..LN3383:
-        xorl      %eax, %eax                                    #3656.12
-        leave                                                   #3656.12
-..___tag_value_eval_2na_128.641:                                #
-        movl      %ebx, %esp                                    #3656.12
-        popl      %ebx                                          #3656.12
-..___tag_value_eval_2na_128.642:                                #
-        ret                                                     #3656.12
-        .align    2,0x90
-..___tag_value_eval_2na_128.644:                                #
-                                # LOE
-# mark_end;
-	.type	eval_2na_128, at function
-	.size	eval_2na_128,.-eval_2na_128
-.LNeval_2na_128:
-	.data
-# -- End  eval_2na_128
-	.section .rodata, "a"
-	.align 4
-__$Ua:
-	.byte	101
-	.byte	118
-	.byte	97
-	.byte	108
-	.byte	95
-	.byte	50
-	.byte	110
-	.byte	97
-	.byte	95
-	.byte	112
-	.byte	111
-	.byte	115
-	.byte	0
-	.type	__$Ua, at object
-	.size	__$Ua,13
-	.text
-# -- Begin  eval_2na_pos
-# mark_begin;
-       .align    2,0x90
-eval_2na_pos:
-# parameter 1(self): 8 + %ebx
-# parameter 2(ncbi2na): 12 + %ebx
-# parameter 3(pos): 16 + %ebx
-# parameter 4(len): 20 + %ebx
-..B24.1:                        # Preds ..B24.0
-..___tag_value_eval_2na_pos.647:                                #
-..LN3385:
-        pushl     %ebx                                          #3662.1
-..___tag_value_eval_2na_pos.652:                                #
-        movl      %esp, %ebx                                    #3662.1
-..___tag_value_eval_2na_pos.653:                                #
-        andl      $-16, %esp                                    #3662.1
-        pushl     %ebp                                          #3662.1
-        pushl     %ebp                                          #3662.1
-        movl      4(%ebx), %ebp                                 #3662.1
-        movl      %ebp, 4(%esp)                                 #3662.1
-        movl      %esp, %ebp                                    #3662.1
-..___tag_value_eval_2na_pos.655:                                #
-        subl      $264, %esp                                    #3662.1
-        movl      %ebx, -264(%ebp)                              #3662.1
-..LN3387:
-        movl      8(%ebx), %eax                                 #3698.25
-        movl      4(%eax), %eax                                 #3698.25
-..LN3389:
-        movl      %eax, -4(%ebp)                                #3698.23
-..LN3391:
-        movl      20(%ebx), %eax                                #3701.5
-        movl      -4(%ebp), %edx                                #3701.5
-        cmpl      %edx, %eax                                    #3701.5
-        jae       ..B24.3       # Prob 50%                      #3701.5
-                                # LOE
-..B24.2:                        # Preds ..B24.1
-        call      ..L657        # Prob 100%                     #
-..L657:                                                         #
-        popl      %eax                                          #
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L657], %eax     #
-        addl      $-16, %esp                                    #3701.5
-        lea       _2__STRING.9 at GOTOFF(%eax), %edx               #3701.5
-        movl      %edx, (%esp)                                  #3701.5
-        lea       _2__STRING.1 at GOTOFF(%eax), %edx               #3701.5
-        movl      %edx, 4(%esp)                                 #3701.5
-        movl      $3701, 8(%esp)                                #3701.5
-        lea       __$Ua at GOTOFF(%eax), %edx                      #3701.5
-        movl      %edx, 12(%esp)                                #3701.5
-        movl      %eax, %ebx                                    #3701.5
-..___tag_value_eval_2na_pos.658:                                #3701.5
-        call      __assert_fail at PLT                             #3701.5
-        movl      -264(%ebp), %ebx                              #3701.5
-..___tag_value_eval_2na_pos.659:                                #
-                                # LOE
-..B24.57:                       # Preds ..B24.2
-        addl      $16, %esp                                     #3701.5
-                                # LOE
-..B24.3:                        # Preds ..B24.1
-..LN3393:
-        movl      16(%ebx), %eax                                #3705.12
-..LN3395:
-        addl      20(%ebx), %eax                                #3705.5
-        movl      %eax, 20(%ebx)                                #3705.5
-..LN3397:
-        movl      16(%ebx), %eax                                #3709.13
-..LN3399:
-        movl      %eax, -44(%ebp)                               #3709.5
-..LN3401:
-        movl      16(%ebx), %eax                                #3713.42
-..LN3403:
-        shrl      $2, %eax                                      #3713.49
-..LN3405:
-        addl      12(%ebx), %eax                                #3713.30
-..LN3407:
-        movl      %eax, -40(%ebp)                               #3713.5
-..LN3409:
-        movl      -4(%ebp), %eax                                #3716.18
-        negl      %eax                                          #3716.18
-        addl      20(%ebx), %eax                                #3716.18
-..LN3411:
-        movl      %eax, -36(%ebp)                               #3716.5
-..LN3413:
-        movl      20(%ebx), %eax                                #3719.44
-..LN3415:
-        addl      $3, %eax                                      #3719.50
-..LN3417:
-        shrl      $2, %eax                                      #3719.57
-..LN3419:
-        addl      12(%ebx), %eax                                #3719.30
-..LN3421:
-        movl      %eax, -32(%ebp)                               #3719.5
-..LN3423:
-        addl      $-8, %esp                                     #3722.14
-..LN3425:
-        movl      -40(%ebp), %eax                               #3722.33
-        movl      %eax, (%esp)                                  #3722.33
-..LN3427:
-        movl      -32(%ebp), %eax                               #3722.38
-        movl      %eax, 4(%esp)                                 #3722.38
-..LN3429:
-        call      prime_buffer_2na                              #3722.14
-                                # LOE xmm0
-..B24.58:                       # Preds ..B24.3
-        addl      $8, %esp                                      #3722.14
-        movdqa    %xmm0, -72(%ebp)                              #3722.14
-                                # LOE
-..B24.4:                        # Preds ..B24.58
-..LN3431:
-        movdqa    -72(%ebp), %xmm0                              #3722.5
-        movdqa    %xmm0, -216(%ebp)                             #3722.5
-..LN3433:
-        addl      $16, -40(%ebp)                                #3723.5
-..LN3435:
-        movl      -40(%ebp), %eax                               #3725.9
-..LN3437:
-        movl      %eax, -28(%ebp)                               #3725.5
-..LN3439:
-        movl      -40(%ebp), %eax                               #3728.10
-..LN3441:
-        movl      -32(%ebp), %edx                               #3728.16
-        cmpl      %edx, %eax                                    #3728.16
-        jae       ..B24.6       # Prob 50%                      #3728.16
-                                # LOE
-..B24.5:                        # Preds ..B24.4
-..LN3443:
-        movl      -40(%ebp), %eax                               #3729.24
-        movzbl    -1(%eax), %eax                                #3729.24
-        movzbl    %al, %eax                                     #3729.24
-..LN3445:
-        shll      $8, %eax                                      #3729.38
-..LN3447:
-        movl      %eax, -52(%ebp)                               #3729.9
-                                # LOE
-..B24.6:                        # Preds ..B24.5 ..B24.4
-..LN3449:
-        movl      8(%ebx), %eax                                 #3733.5
-        movdqa    16(%eax), %xmm0                               #3733.5
-        movdqa    %xmm0, -200(%ebp)                             #3733.5
-        movl      8(%ebx), %eax                                 #3733.5
-        movdqa    32(%eax), %xmm0                               #3733.5
-        movdqa    %xmm0, -184(%ebp)                             #3733.5
-        movl      8(%ebx), %eax                                 #3733.5
-        movdqa    48(%eax), %xmm0                               #3733.5
-        movdqa    %xmm0, -168(%ebp)                             #3733.5
-        movl      8(%ebx), %eax                                 #3733.5
-        movdqa    64(%eax), %xmm0                               #3733.5
-        movdqa    %xmm0, -152(%ebp)                             #3733.5
-        movl      8(%ebx), %eax                                 #3733.5
-        movdqa    80(%eax), %xmm0                               #3733.5
-        movdqa    %xmm0, -136(%ebp)                             #3733.5
-        movl      8(%ebx), %eax                                 #3733.5
-        movdqa    96(%eax), %xmm0                               #3733.5
-        movdqa    %xmm0, -120(%ebp)                             #3733.5
-        movl      8(%ebx), %eax                                 #3733.5
-        movdqa    112(%eax), %xmm0                              #3733.5
-        movdqa    %xmm0, -104(%ebp)                             #3733.5
-        movl      8(%ebx), %eax                                 #3733.5
-        movdqa    128(%eax), %xmm0                              #3733.5
-        movdqa    %xmm0, -88(%ebp)                              #3733.5
-..LN3451:
-        xorl      %eax, %eax                                    #3736.15
-        movl      %eax, -24(%ebp)                               #3736.15
-..LN3453:
-        movl      %eax, -20(%ebp)                               #3736.10
-..LN3455:
-        movl      %eax, -16(%ebp)                               #3736.5
-..LN3457:
-        movl      16(%ebx), %eax                                #3738.27
-        negl      %eax                                          #3738.27
-..LN3459:
-        movl      -36(%ebp), %edx                               #3738.20
-..LN3461:
-        lea       7(%edx,%eax), %eax                            #3738.33
-..LN3463:
-        shrl      $2, %eax                                      #3738.40
-..LN3465:
-        movl      %eax, -12(%ebp)                               #3738.5
-..LN3467:
-        movl      16(%ebx), %eax                                #3745.14
-..LN3469:
-        andl      $3, %eax                                      #3745.20
-        movl      %eax, -8(%ebp)                                #3745.20
-        je        ..B24.14      # Prob 50%                      #3745.20
-                                # LOE
-..B24.7:                        # Preds ..B24.6
-        movl      -8(%ebp), %eax                                #3745.20
-        cmpl      $1, %eax                                      #3745.20
-        je        ..B24.15      # Prob 50%                      #3745.20
-                                # LOE
-..B24.8:                        # Preds ..B24.7
-        movl      -8(%ebp), %eax                                #3745.20
-        cmpl      $2, %eax                                      #3745.20
-        je        ..B24.16      # Prob 50%                      #3745.20
-                                # LOE
-..B24.9:                        # Preds ..B24.8
-        movl      -8(%ebp), %eax                                #3745.20
-        cmpl      $3, %eax                                      #3745.20
-        je        ..B24.17      # Prob 50%                      #3745.20
-                                # LOE
-..B24.10:                       # Preds ..B24.53 ..B24.52 ..B24.9
-..LN3471:
-        movl      $1, %eax                                      #3750.9
-        testl     %eax, %eax                                    #3750.9
-        je        ..B24.54      # Prob 100%                     #3750.9
-                                # LOE
-..B24.11:                       # Preds ..B24.10
-..LN3473:
-        movl      $16, -12(%ebp)                                #3752.13
-                                # LOE
-..B24.12:                       # Preds ..B24.47 ..B24.11
-..LN3475:
-        movl      $1, %eax                                      #3755.13
-        testl     %eax, %eax                                    #3755.13
-        je        ..B24.49      # Prob 100%                     #3755.13
-                                # LOE
-..B24.14:                       # Preds ..B24.6 ..B24.12
-..LN3477:
-        movdqa    -216(%ebp), %xmm0                             #3762.38
-..LN3479:
-        movdqa    -184(%ebp), %xmm1                             #3762.46
-..LN3481:
-        pand      %xmm1, %xmm0                                  #3762.22
-..LN3483:
-        movdqa    %xmm0, -232(%ebp)                             #3762.17
-..LN3485:
-        movdqa    -232(%ebp), %xmm0                             #3763.22
-        movdqa    -200(%ebp), %xmm1                             #3763.22
-        pcmpeqd   %xmm1, %xmm0                                  #3763.22
-..LN3487:
-        movdqa    %xmm0, -232(%ebp)                             #3763.17
-..LN3489:
-        movdqa    -232(%ebp), %xmm0                             #3764.42
-..LN3491:
-        pmovmskb  %xmm0, %eax                                   #3764.22
-..LN3493:
-        movl      %eax, -16(%ebp)                               #3764.17
-..LN3495:
-        movl      -16(%ebp), %eax                               #3765.17
-        incl      %eax                                          #3765.17
-        sarl      $16, %eax                                     #3765.17
-        negl      %eax                                          #3765.17
-        movl      %eax, -16(%ebp)                               #3765.17
-                                # LOE
-..B24.15:                       # Preds ..B24.7 ..B24.14
-..LN3497:
-        movdqa    -216(%ebp), %xmm0                             #3768.38
-..LN3499:
-        movdqa    -152(%ebp), %xmm1                             #3768.46
-..LN3501:
-        pand      %xmm1, %xmm0                                  #3768.22
-..LN3503:
-        movdqa    %xmm0, -232(%ebp)                             #3768.17
-..LN3505:
-        movdqa    -232(%ebp), %xmm0                             #3769.22
-        movdqa    -168(%ebp), %xmm1                             #3769.22
-        pcmpeqd   %xmm1, %xmm0                                  #3769.22
-..LN3507:
-        movdqa    %xmm0, -232(%ebp)                             #3769.17
-..LN3509:
-        movdqa    -232(%ebp), %xmm0                             #3770.42
-..LN3511:
-        pmovmskb  %xmm0, %eax                                   #3770.22
-..LN3513:
-        movl      %eax, -20(%ebp)                               #3770.17
-..LN3515:
-        movl      -20(%ebp), %eax                               #3771.17
-        incl      %eax                                          #3771.17
-        sarl      $16, %eax                                     #3771.17
-        negl      %eax                                          #3771.17
-        movl      %eax, -20(%ebp)                               #3771.17
-                                # LOE
-..B24.16:                       # Preds ..B24.8 ..B24.15
-..LN3517:
-        movdqa    -216(%ebp), %xmm0                             #3774.38
-..LN3519:
-        movdqa    -120(%ebp), %xmm1                             #3774.46
-..LN3521:
-        pand      %xmm1, %xmm0                                  #3774.22
-..LN3523:
-        movdqa    %xmm0, -232(%ebp)                             #3774.17
-..LN3525:
-        movdqa    -232(%ebp), %xmm0                             #3775.22
-        movdqa    -136(%ebp), %xmm1                             #3775.22
-        pcmpeqd   %xmm1, %xmm0                                  #3775.22
-..LN3527:
-        movdqa    %xmm0, -232(%ebp)                             #3775.17
-..LN3529:
-        movdqa    -232(%ebp), %xmm0                             #3776.42
-..LN3531:
-        pmovmskb  %xmm0, %eax                                   #3776.22
-..LN3533:
-        movl      %eax, -24(%ebp)                               #3776.17
-..LN3535:
-        movl      -24(%ebp), %eax                               #3777.17
-        incl      %eax                                          #3777.17
-        sarl      $16, %eax                                     #3777.17
-        negl      %eax                                          #3777.17
-        movl      %eax, -24(%ebp)                               #3777.17
-                                # LOE
-..B24.17:                       # Preds ..B24.9 ..B24.16
-..LN3537:
-        movdqa    -216(%ebp), %xmm0                             #3780.38
-..LN3539:
-        movdqa    -88(%ebp), %xmm1                              #3780.46
-..LN3541:
-        pand      %xmm1, %xmm0                                  #3780.22
-..LN3543:
-        movdqa    %xmm0, -232(%ebp)                             #3780.17
-..LN3545:
-        movdqa    -232(%ebp), %xmm0                             #3781.22
-        movdqa    -104(%ebp), %xmm1                             #3781.22
-        pcmpeqd   %xmm1, %xmm0                                  #3781.22
-..LN3547:
-        movdqa    %xmm0, -232(%ebp)                             #3781.17
-..LN3549:
-        movdqa    -232(%ebp), %xmm0                             #3782.42
-..LN3551:
-        pmovmskb  %xmm0, %eax                                   #3782.22
-..LN3553:
-        movl      %eax, -48(%ebp)                               #3782.17
-..LN3555:
-        movl      -48(%ebp), %eax                               #3783.17
-        incl      %eax                                          #3783.17
-        sarl      $16, %eax                                     #3783.17
-        negl      %eax                                          #3783.17
-        movl      %eax, -48(%ebp)                               #3783.17
-..LN3557:
-        movl      16(%ebx), %eax                                #3787.17
-        andl      $-4, %eax                                     #3787.17
-        movl      %eax, 16(%ebx)                                #3787.17
-..LN3559:
-        movl      -20(%ebp), %eax                               #3790.29
-        orl       -16(%ebp), %eax                               #3790.29
-..LN3561:
-        orl       -24(%ebp), %eax                               #3790.34
-..LN3563:
-        orl       -48(%ebp), %eax                               #3790.39
-..LN3565:
-        je        ..B24.42      # Prob 50%                      #3790.47
-                                # LOE
-..B24.18:                       # Preds ..B24.17
-..LN3567:
-        movl      16(%ebx), %eax                                #3793.37
-        negl      %eax                                          #3793.37
-        addl      -36(%ebp), %eax                               #3793.37
-        movl      %eax, -56(%ebp)                               #3793.37
-        je        ..B24.21      # Prob 50%                      #3793.37
-                                # LOE
-..B24.19:                       # Preds ..B24.18
-        movl      -56(%ebp), %eax                               #3793.37
-        cmpl      $1, %eax                                      #3793.37
-        je        ..B24.23      # Prob 50%                      #3793.37
-                                # LOE
-..B24.20:                       # Preds ..B24.19
-        movl      -56(%ebp), %eax                               #3793.37
-        cmpl      $2, %eax                                      #3793.37
-        je        ..B24.27      # Prob 50%                      #3793.37
-        jmp       ..B24.33      # Prob 100%                     #3793.37
-                                # LOE
-..B24.21:                       # Preds ..B24.18
-..LN3569:
-        movl      -16(%ebp), %eax                               #3796.30
-..LN3571:
-        testl     %eax, %eax                                    #3796.36
-        je        ..B24.41      # Prob 50%                      #3796.36
-                                # LOE
-..B24.22:                       # Preds ..B24.21
-..LN3573:
-        movl      -44(%ebp), %eax                               #3796.53
-        negl      %eax                                          #3796.53
-..LN3575:
-        movl      16(%ebx), %edx                                #3796.47
-..LN3577:
-        lea       1(%edx,%eax), %eax                            #3796.61
-        leave                                                   #3796.61
-..___tag_value_eval_2na_pos.661:                                #
-        movl      %ebx, %esp                                    #3796.61
-        popl      %ebx                                          #3796.61
-..___tag_value_eval_2na_pos.662:                                #
-        ret                                                     #3796.61
-..___tag_value_eval_2na_pos.664:                                #
-                                # LOE
-..B24.23:                       # Preds ..B24.19
-..LN3579:
-        movl      -16(%ebp), %eax                               #3799.30
-..LN3581:
-        testl     %eax, %eax                                    #3799.36
-        je        ..B24.25      # Prob 50%                      #3799.36
-                                # LOE
-..B24.24:                       # Preds ..B24.23
-..LN3583:
-        movl      -44(%ebp), %eax                               #3799.53
-        negl      %eax                                          #3799.53
-..LN3585:
-        movl      16(%ebx), %edx                                #3799.47
-..LN3587:
-        lea       1(%edx,%eax), %eax                            #3799.61
-        leave                                                   #3799.61
-..___tag_value_eval_2na_pos.668:                                #
-        movl      %ebx, %esp                                    #3799.61
-        popl      %ebx                                          #3799.61
-..___tag_value_eval_2na_pos.669:                                #
-        ret                                                     #3799.61
-..___tag_value_eval_2na_pos.671:                                #
-                                # LOE
-..B24.25:                       # Preds ..B24.23
-..LN3589:
-        movl      -20(%ebp), %eax                               #3800.30
-..LN3591:
-        testl     %eax, %eax                                    #3800.36
-        je        ..B24.41      # Prob 50%                      #3800.36
-                                # LOE
-..B24.26:                       # Preds ..B24.25
-..LN3593:
-        movl      -44(%ebp), %eax                               #3800.53
-        negl      %eax                                          #3800.53
-..LN3595:
-        movl      16(%ebx), %edx                                #3800.47
-..LN3597:
-        lea       2(%edx,%eax), %eax                            #3800.61
-        leave                                                   #3800.61
-..___tag_value_eval_2na_pos.675:                                #
-        movl      %ebx, %esp                                    #3800.61
-        popl      %ebx                                          #3800.61
-..___tag_value_eval_2na_pos.676:                                #
-        ret                                                     #3800.61
-..___tag_value_eval_2na_pos.678:                                #
-                                # LOE
-..B24.27:                       # Preds ..B24.20
-..LN3599:
-        movl      -16(%ebp), %eax                               #3803.30
-..LN3601:
-        testl     %eax, %eax                                    #3803.36
-        je        ..B24.29      # Prob 50%                      #3803.36
-                                # LOE
-..B24.28:                       # Preds ..B24.27
-..LN3603:
-        movl      -44(%ebp), %eax                               #3803.53
-        negl      %eax                                          #3803.53
-..LN3605:
-        movl      16(%ebx), %edx                                #3803.47
-..LN3607:
-        lea       1(%edx,%eax), %eax                            #3803.61
-        leave                                                   #3803.61
-..___tag_value_eval_2na_pos.682:                                #
-        movl      %ebx, %esp                                    #3803.61
-        popl      %ebx                                          #3803.61
-..___tag_value_eval_2na_pos.683:                                #
-        ret                                                     #3803.61
-..___tag_value_eval_2na_pos.685:                                #
-                                # LOE
-..B24.29:                       # Preds ..B24.27
-..LN3609:
-        movl      -20(%ebp), %eax                               #3804.30
-..LN3611:
-        testl     %eax, %eax                                    #3804.36
-        je        ..B24.31      # Prob 50%                      #3804.36
-                                # LOE
-..B24.30:                       # Preds ..B24.29
-..LN3613:
-        movl      -44(%ebp), %eax                               #3804.53
-        negl      %eax                                          #3804.53
-..LN3615:
-        movl      16(%ebx), %edx                                #3804.47
-..LN3617:
-        lea       2(%edx,%eax), %eax                            #3804.61
-        leave                                                   #3804.61
-..___tag_value_eval_2na_pos.689:                                #
-        movl      %ebx, %esp                                    #3804.61
-        popl      %ebx                                          #3804.61
-..___tag_value_eval_2na_pos.690:                                #
-        ret                                                     #3804.61
-..___tag_value_eval_2na_pos.692:                                #
-                                # LOE
-..B24.31:                       # Preds ..B24.29
-..LN3619:
-        movl      -24(%ebp), %eax                               #3805.30
-..LN3621:
-        testl     %eax, %eax                                    #3805.36
-        je        ..B24.41      # Prob 50%                      #3805.36
-                                # LOE
-..B24.32:                       # Preds ..B24.31
-..LN3623:
-        movl      -44(%ebp), %eax                               #3805.53
-        negl      %eax                                          #3805.53
-..LN3625:
-        movl      16(%ebx), %edx                                #3805.47
-..LN3627:
-        lea       3(%edx,%eax), %eax                            #3805.61
-        leave                                                   #3805.61
-..___tag_value_eval_2na_pos.696:                                #
-        movl      %ebx, %esp                                    #3805.61
-        popl      %ebx                                          #3805.61
-..___tag_value_eval_2na_pos.697:                                #
-        ret                                                     #3805.61
-..___tag_value_eval_2na_pos.699:                                #
-                                # LOE
-..B24.33:                       # Preds ..B24.20
-..LN3629:
-        movl      -16(%ebp), %eax                               #3808.30
-..LN3631:
-        testl     %eax, %eax                                    #3808.36
-        je        ..B24.35      # Prob 50%                      #3808.36
-                                # LOE
-..B24.34:                       # Preds ..B24.33
-..LN3633:
-        movl      -44(%ebp), %eax                               #3808.53
-        negl      %eax                                          #3808.53
-..LN3635:
-        movl      16(%ebx), %edx                                #3808.47
-..LN3637:
-        lea       1(%edx,%eax), %eax                            #3808.61
-        leave                                                   #3808.61
-..___tag_value_eval_2na_pos.703:                                #
-        movl      %ebx, %esp                                    #3808.61
-        popl      %ebx                                          #3808.61
-..___tag_value_eval_2na_pos.704:                                #
-        ret                                                     #3808.61
-..___tag_value_eval_2na_pos.706:                                #
-                                # LOE
-..B24.35:                       # Preds ..B24.33
-..LN3639:
-        movl      -20(%ebp), %eax                               #3809.30
-..LN3641:
-        testl     %eax, %eax                                    #3809.36
-        je        ..B24.37      # Prob 50%                      #3809.36
-                                # LOE
-..B24.36:                       # Preds ..B24.35
-..LN3643:
-        movl      -44(%ebp), %eax                               #3809.53
-        negl      %eax                                          #3809.53
-..LN3645:
-        movl      16(%ebx), %edx                                #3809.47
-..LN3647:
-        lea       2(%edx,%eax), %eax                            #3809.61
-        leave                                                   #3809.61
-..___tag_value_eval_2na_pos.710:                                #
-        movl      %ebx, %esp                                    #3809.61
-        popl      %ebx                                          #3809.61
-..___tag_value_eval_2na_pos.711:                                #
-        ret                                                     #3809.61
-..___tag_value_eval_2na_pos.713:                                #
-                                # LOE
-..B24.37:                       # Preds ..B24.35
-..LN3649:
-        movl      -24(%ebp), %eax                               #3810.30
-..LN3651:
-        testl     %eax, %eax                                    #3810.36
-        je        ..B24.39      # Prob 50%                      #3810.36
-                                # LOE
-..B24.38:                       # Preds ..B24.37
-..LN3653:
-        movl      -44(%ebp), %eax                               #3810.53
-        negl      %eax                                          #3810.53
-..LN3655:
-        movl      16(%ebx), %edx                                #3810.47
-..LN3657:
-        lea       3(%edx,%eax), %eax                            #3810.61
-        leave                                                   #3810.61
-..___tag_value_eval_2na_pos.717:                                #
-        movl      %ebx, %esp                                    #3810.61
-        popl      %ebx                                          #3810.61
-..___tag_value_eval_2na_pos.718:                                #
-        ret                                                     #3810.61
-..___tag_value_eval_2na_pos.720:                                #
-                                # LOE
-..B24.39:                       # Preds ..B24.37
-..LN3659:
-        movl      -48(%ebp), %eax                               #3811.30
-..LN3661:
-        testl     %eax, %eax                                    #3811.36
-        je        ..B24.41      # Prob 50%                      #3811.36
-                                # LOE
-..B24.40:                       # Preds ..B24.39
-..LN3663:
-        movl      -44(%ebp), %eax                               #3811.53
-        negl      %eax                                          #3811.53
-..LN3665:
-        movl      16(%ebx), %edx                                #3811.47
-..LN3667:
-        lea       4(%edx,%eax), %eax                            #3811.61
-        leave                                                   #3811.61
-..___tag_value_eval_2na_pos.724:                                #
-        movl      %ebx, %esp                                    #3811.61
-        popl      %ebx                                          #3811.61
-..___tag_value_eval_2na_pos.725:                                #
-        ret                                                     #3811.61
-..___tag_value_eval_2na_pos.727:                                #
-                                # LOE
-..B24.41:                       # Preds ..B24.21 ..B24.25 ..B24.31 ..B24.39
-..LN3669:
-        xorl      %eax, %eax                                    #3813.28
-        leave                                                   #3813.28
-..___tag_value_eval_2na_pos.731:                                #
-        movl      %ebx, %esp                                    #3813.28
-        popl      %ebx                                          #3813.28
-..___tag_value_eval_2na_pos.732:                                #
-        ret                                                     #3813.28
-..___tag_value_eval_2na_pos.734:                                #
-                                # LOE
-..B24.42:                       # Preds ..B24.17
-..LN3671:
-        movl      16(%ebx), %eax                                #3853.17
-        addl      $4, %eax                                      #3853.17
-        movl      %eax, 16(%ebx)                                #3853.17
-..LN3673:
-        movl      16(%ebx), %eax                                #3856.22
-..LN3675:
-        movl      -36(%ebp), %edx                               #3856.28
-        cmpl      %edx, %eax                                    #3856.28
-        jbe       ..B24.44      # Prob 50%                      #3856.28
-                                # LOE
-..B24.43:                       # Preds ..B24.42
-..LN3677:
-        xorl      %eax, %eax                                    #3857.28
-        leave                                                   #3857.28
-..___tag_value_eval_2na_pos.738:                                #
-        movl      %ebx, %esp                                    #3857.28
-        popl      %ebx                                          #3857.28
-..___tag_value_eval_2na_pos.739:                                #
-        ret                                                     #3857.28
-..___tag_value_eval_2na_pos.741:                                #
-                                # LOE
-..B24.44:                       # Preds ..B24.42
-..LN3679:
-        movl      -12(%ebp), %eax                               #3860.25
-        decl      %eax                                          #3860.25
-        movl      %eax, -12(%ebp)                               #3860.25
-..LN3681:
-        je        ..B24.49      # Prob 50%                      #3860.39
-                                # LOE
-..B24.45:                       # Preds ..B24.44
-..LN3683:
-        movdqa    -216(%ebp), %xmm0                             #3865.43
-..LN3685:
-        psrldq    $1, %xmm0                                     #3865.26
-..LN3687:
-        movdqa    %xmm0, -216(%ebp)                             #3865.17
-..LN3689:
-        movl      -28(%ebp), %eax                               #3868.22
-..LN3691:
-        movl      -32(%ebp), %edx                               #3868.26
-        cmpl      %edx, %eax                                    #3868.26
-        jae       ..B24.47      # Prob 50%                      #3868.26
-                                # LOE
-..B24.46:                       # Preds ..B24.45
-..LN3693:
-        sarl      $8, -52(%ebp)                                 #3870.21
-..LN3695:
-        movl      -28(%ebp), %eax                               #3871.37
-        movzbl    (%eax), %eax                                  #3871.37
-        movzbl    %al, %eax                                     #3871.37
-..LN3697:
-        shll      $8, %eax                                      #3871.48
-..LN3699:
-        orl       -52(%ebp), %eax                               #3871.21
-        movl      %eax, -52(%ebp)                               #3871.21
-..LN3701:
-        movdqa    -216(%ebp), %xmm0                             #3872.49
-..LN3703:
-        movl      -52(%ebp), %eax                               #3872.57
-..LN3705:
-        pinsrw    $7, %eax, %xmm0                               #3872.30
-..LN3707:
-        movdqa    %xmm0, -216(%ebp)                             #3872.21
-                                # LOE
-..B24.47:                       # Preds ..B24.46 ..B24.45
-..LN3709:
-        incl      -28(%ebp)                                     #3876.20
-        jmp       ..B24.12      # Prob 100%                     #3876.20
-                                # LOE
-..B24.49:                       # Preds ..B24.44 ..B24.12
-..LN3711:
-        movl      -40(%ebp), %eax                               #3881.18
-..LN3713:
-        movl      -32(%ebp), %edx                               #3881.25
-        cmpl      %edx, %eax                                    #3881.25
-        jae       ..B24.54      # Prob 50%                      #3881.25
-                                # LOE
-..B24.50:                       # Preds ..B24.49
-..LN3715:
-        movl      16(%ebx), %eax                                #3886.18
-..LN3717:
-        movl      -36(%ebp), %edx                               #3886.24
-        cmpl      %edx, %eax                                    #3886.24
-        ja        ..B24.54      # Prob 50%                      #3886.24
-                                # LOE
-..B24.51:                       # Preds ..B24.50
-..LN3719:
-        addl      $-8, %esp                                     #3891.22
-..LN3721:
-        movl      -40(%ebp), %eax                               #3891.41
-        movl      %eax, (%esp)                                  #3891.41
-..LN3723:
-        movl      -32(%ebp), %eax                               #3891.46
-        movl      %eax, 4(%esp)                                 #3891.46
-..LN3725:
-        call      prime_buffer_2na                              #3891.22
-                                # LOE xmm0
-..B24.59:                       # Preds ..B24.51
-        addl      $8, %esp                                      #3891.22
-        movdqa    %xmm0, -248(%ebp)                             #3891.22
-                                # LOE
-..B24.52:                       # Preds ..B24.59
-..LN3727:
-        movdqa    -248(%ebp), %xmm0                             #3891.13
-        movdqa    %xmm0, -216(%ebp)                             #3891.13
-..LN3729:
-        addl      $16, -40(%ebp)                                #3969.13
-..LN3731:
-        movl      -40(%ebp), %eax                               #3971.17
-..LN3733:
-        movl      %eax, -28(%ebp)                               #3971.13
-..LN3735:
-        movl      -40(%ebp), %eax                               #3972.18
-..LN3737:
-        movl      -32(%ebp), %edx                               #3972.24
-        cmpl      %edx, %eax                                    #3972.24
-        jae       ..B24.10      # Prob 50%                      #3972.24
-                                # LOE
-..B24.53:                       # Preds ..B24.52
-..LN3739:
-        movl      -40(%ebp), %eax                               #3973.32
-        movzbl    -1(%eax), %eax                                #3973.32
-        movzbl    %al, %eax                                     #3973.32
-..LN3741:
-        shll      $8, %eax                                      #3973.46
-..LN3743:
-        movl      %eax, -52(%ebp)                               #3973.17
-        jmp       ..B24.10      # Prob 100%                     #3973.17
-                                # LOE
-..B24.54:                       # Preds ..B24.50 ..B24.49 ..B24.10
-..LN3745:
-        xorl      %eax, %eax                                    #3983.12
-        leave                                                   #3983.12
-..___tag_value_eval_2na_pos.745:                                #
-        movl      %ebx, %esp                                    #3983.12
-        popl      %ebx                                          #3983.12
-..___tag_value_eval_2na_pos.746:                                #
-        ret                                                     #3983.12
-        .align    2,0x90
-..___tag_value_eval_2na_pos.748:                                #
-                                # LOE
-# mark_end;
-	.type	eval_2na_pos, at function
-	.size	eval_2na_pos,.-eval_2na_pos
-.LNeval_2na_pos:
-	.data
-# -- End  eval_2na_pos
-	.section .rodata, "a"
-	.align 4
-__$Ub:
-	.byte	101
-	.byte	118
-	.byte	97
-	.byte	108
-	.byte	95
-	.byte	52
-	.byte	110
-	.byte	97
-	.byte	95
-	.byte	49
-	.byte	54
-	.byte	0
-	.type	__$Ub, at object
-	.size	__$Ub,12
-	.text
-# -- Begin  eval_4na_16
-# mark_begin;
-       .align    2,0x90
-eval_4na_16:
-# parameter 1(self): 8 + %ebx
-# parameter 2(ncbi2na): 12 + %ebx
-# parameter 3(pos): 16 + %ebx
-# parameter 4(len): 20 + %ebx
-..B25.1:                        # Preds ..B25.0
-..___tag_value_eval_4na_16.751:                                 #
-..LN3747:
-        pushl     %ebx                                          #4057.1
-..___tag_value_eval_4na_16.756:                                 #
-        movl      %esp, %ebx                                    #4057.1
-..___tag_value_eval_4na_16.757:                                 #
-        andl      $-16, %esp                                    #4057.1
-        pushl     %ebp                                          #4057.1
-        pushl     %ebp                                          #4057.1
-        movl      4(%ebx), %ebp                                 #4057.1
-        movl      %ebp, 4(%esp)                                 #4057.1
-        movl      %esp, %ebp                                    #4057.1
-..___tag_value_eval_4na_16.759:                                 #
-        subl      $296, %esp                                    #4057.1
-        movl      %ebx, -296(%ebp)                              #4057.1
-..LN3749:
-        movl      8(%ebx), %eax                                 #4083.25
-        movl      4(%eax), %eax                                 #4083.25
-..LN3751:
-        movl      %eax, -4(%ebp)                                #4083.23
-..LN3753:
-        movl      20(%ebx), %eax                                #4086.5
-        movl      -4(%ebp), %edx                                #4086.5
-        cmpl      %edx, %eax                                    #4086.5
-        jae       ..B25.3       # Prob 50%                      #4086.5
-                                # LOE
-..B25.2:                        # Preds ..B25.1
-        call      ..L761        # Prob 100%                     #
-..L761:                                                         #
-        popl      %eax                                          #
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L761], %eax     #
-        addl      $-16, %esp                                    #4086.5
-        lea       _2__STRING.9 at GOTOFF(%eax), %edx               #4086.5
-        movl      %edx, (%esp)                                  #4086.5
-        lea       _2__STRING.1 at GOTOFF(%eax), %edx               #4086.5
-        movl      %edx, 4(%esp)                                 #4086.5
-        movl      $4086, 8(%esp)                                #4086.5
-        lea       __$Ub at GOTOFF(%eax), %edx                      #4086.5
-        movl      %edx, 12(%esp)                                #4086.5
-        movl      %eax, %ebx                                    #4086.5
-..___tag_value_eval_4na_16.762:                                 #4086.5
-        call      __assert_fail at PLT                             #4086.5
-        movl      -296(%ebp), %ebx                              #4086.5
-..___tag_value_eval_4na_16.763:                                 #
-                                # LOE
-..B25.43:                       # Preds ..B25.2
-        addl      $16, %esp                                     #4086.5
-                                # LOE
-..B25.3:                        # Preds ..B25.1
-..LN3755:
-        movl      16(%ebx), %eax                                #4090.12
-..LN3757:
-        addl      20(%ebx), %eax                                #4090.5
-        movl      %eax, 20(%ebx)                                #4090.5
-..LN3759:
-        movl      16(%ebx), %eax                                #4093.42
-..LN3761:
-        shrl      $2, %eax                                      #4093.49
-..LN3763:
-        addl      12(%ebx), %eax                                #4093.30
-..LN3765:
-        movl      %eax, -36(%ebp)                               #4093.5
-..LN3767:
-        movl      -4(%ebp), %eax                                #4096.18
-        negl      %eax                                          #4096.18
-        addl      20(%ebx), %eax                                #4096.18
-..LN3769:
-        movl      %eax, -32(%ebp)                               #4096.5
-..LN3771:
-        movl      20(%ebx), %eax                                #4099.44
-..LN3773:
-        addl      $3, %eax                                      #4099.50
-..LN3775:
-        shrl      $2, %eax                                      #4099.57
-..LN3777:
-        addl      12(%ebx), %eax                                #4099.30
-..LN3779:
-        movl      %eax, -28(%ebp)                               #4099.5
-..LN3781:
-        addl      $-8, %esp                                     #4102.14
-..LN3783:
-        movl      -36(%ebp), %eax                               #4102.33
-        movl      %eax, (%esp)                                  #4102.33
-..LN3785:
-        movl      -28(%ebp), %eax                               #4102.38
-        movl      %eax, 4(%esp)                                 #4102.38
-..LN3787:
-        call      prime_buffer_4na                              #4102.14
-                                # LOE xmm0
-..B25.44:                       # Preds ..B25.3
-        addl      $8, %esp                                      #4102.14
-        movdqa    %xmm0, -88(%ebp)                              #4102.14
-                                # LOE
-..B25.4:                        # Preds ..B25.44
-..LN3789:
-        movdqa    -88(%ebp), %xmm0                              #4102.5
-        movdqa    %xmm0, -232(%ebp)                             #4102.5
-..LN3791:
-        addl      $8, -36(%ebp)                                 #4103.5
-..LN3793:
-        movl      8(%ebx), %eax                                 #4109.5
-        movdqa    16(%eax), %xmm0                               #4109.5
-        movdqa    %xmm0, -216(%ebp)                             #4109.5
-        movl      8(%ebx), %eax                                 #4109.5
-        movdqa    32(%eax), %xmm0                               #4109.5
-        movdqa    %xmm0, -200(%ebp)                             #4109.5
-        movl      8(%ebx), %eax                                 #4109.5
-        movdqa    48(%eax), %xmm0                               #4109.5
-        movdqa    %xmm0, -184(%ebp)                             #4109.5
-        movl      8(%ebx), %eax                                 #4109.5
-        movdqa    64(%eax), %xmm0                               #4109.5
-        movdqa    %xmm0, -168(%ebp)                             #4109.5
-        movl      8(%ebx), %eax                                 #4109.5
-        movdqa    80(%eax), %xmm0                               #4109.5
-        movdqa    %xmm0, -152(%ebp)                             #4109.5
-        movl      8(%ebx), %eax                                 #4109.5
-        movdqa    96(%eax), %xmm0                               #4109.5
-        movdqa    %xmm0, -136(%ebp)                             #4109.5
-        movl      8(%ebx), %eax                                 #4109.5
-        movdqa    112(%eax), %xmm0                              #4109.5
-        movdqa    %xmm0, -120(%ebp)                             #4109.5
-        movl      8(%ebx), %eax                                 #4109.5
-        movdqa    128(%eax), %xmm0                              #4109.5
-        movdqa    %xmm0, -104(%ebp)                             #4109.5
-..LN3795:
-        xorl      %eax, %eax                                    #4112.15
-        movl      %eax, -24(%ebp)                               #4112.15
-..LN3797:
-        movl      %eax, -20(%ebp)                               #4112.10
-..LN3799:
-        movl      %eax, -16(%ebp)                               #4112.5
-..LN3801:
-        movl      $1, -12(%ebp)                                 #4118.5
-..LN3803:
-        movl      16(%ebx), %eax                                #4123.14
-..LN3805:
-        andl      $3, %eax                                      #4123.20
-        movl      %eax, -8(%ebp)                                #4123.20
-        je        ..B25.12      # Prob 50%                      #4123.20
-                                # LOE
-..B25.5:                        # Preds ..B25.4
-        movl      -8(%ebp), %eax                                #4123.20
-        cmpl      $1, %eax                                      #4123.20
-        je        ..B25.13      # Prob 50%                      #4123.20
-                                # LOE
-..B25.6:                        # Preds ..B25.5
-        movl      -8(%ebp), %eax                                #4123.20
-        cmpl      $2, %eax                                      #4123.20
-        je        ..B25.14      # Prob 50%                      #4123.20
-                                # LOE
-..B25.7:                        # Preds ..B25.6
-        movl      -8(%ebp), %eax                                #4123.20
-        cmpl      $3, %eax                                      #4123.20
-        je        ..B25.15      # Prob 50%                      #4123.20
-                                # LOE
-..B25.8:                        # Preds ..B25.39 ..B25.7
-..LN3807:
-        movl      $1, %eax                                      #4128.9
-        testl     %eax, %eax                                    #4128.9
-        je        ..B25.40      # Prob 100%                     #4128.9
-                                # LOE
-..B25.9:                        # Preds ..B25.8
-..LN3809:
-        movl      $1, -12(%ebp)                                 #4130.13
-                                # LOE
-..B25.10:                       # Preds ..B25.34 ..B25.9
-..LN3811:
-        movl      $1, %eax                                      #4133.13
-        testl     %eax, %eax                                    #4133.13
-        je        ..B25.36      # Prob 100%                     #4133.13
-                                # LOE
-..B25.12:                       # Preds ..B25.4 ..B25.10
-..LN3813:
-        movdqa    -232(%ebp), %xmm0                             #4140.38
-..LN3815:
-        movdqa    -216(%ebp), %xmm1                             #4140.46
-..LN3817:
-        pand      %xmm1, %xmm0                                  #4140.22
-..LN3819:
-        movdqa    %xmm0, -264(%ebp)                             #4140.17
-..LN3821:
-        movdqa    -232(%ebp), %xmm0                             #4141.38
-..LN3823:
-        movdqa    -200(%ebp), %xmm1                             #4141.46
-..LN3825:
-        pand      %xmm1, %xmm0                                  #4141.22
-..LN3827:
-        movdqa    %xmm0, -248(%ebp)                             #4141.17
-..LN3829:
-        movdqa    -264(%ebp), %xmm0                             #4142.22
-        movdqa    -248(%ebp), %xmm1                             #4142.22
-        pcmpeqw   %xmm1, %xmm0                                  #4142.22
-..LN3831:
-        movdqa    %xmm0, -264(%ebp)                             #4142.17
-..LN3833:
-        movdqa    -264(%ebp), %xmm0                             #4143.42
-..LN3835:
-        pmovmskb  %xmm0, %eax                                   #4143.22
-..LN3837:
-        movl      %eax, -16(%ebp)                               #4143.17
-                                # LOE
-..B25.13:                       # Preds ..B25.5 ..B25.12
-..LN3839:
-        movdqa    -232(%ebp), %xmm0                             #4147.38
-..LN3841:
-        movdqa    -184(%ebp), %xmm1                             #4147.46
-..LN3843:
-        pand      %xmm1, %xmm0                                  #4147.22
-..LN3845:
-        movdqa    %xmm0, -264(%ebp)                             #4147.17
-..LN3847:
-        movdqa    -232(%ebp), %xmm0                             #4148.38
-..LN3849:
-        movdqa    -168(%ebp), %xmm1                             #4148.46
-..LN3851:
-        pand      %xmm1, %xmm0                                  #4148.22
-..LN3853:
-        movdqa    %xmm0, -248(%ebp)                             #4148.17
-..LN3855:
-        movdqa    -264(%ebp), %xmm0                             #4149.22
-        movdqa    -248(%ebp), %xmm1                             #4149.22
-        pcmpeqw   %xmm1, %xmm0                                  #4149.22
-..LN3857:
-        movdqa    %xmm0, -264(%ebp)                             #4149.17
-..LN3859:
-        movdqa    -264(%ebp), %xmm0                             #4150.42
-..LN3861:
-        pmovmskb  %xmm0, %eax                                   #4150.22
-..LN3863:
-        movl      %eax, -20(%ebp)                               #4150.17
-                                # LOE
-..B25.14:                       # Preds ..B25.6 ..B25.13
-..LN3865:
-        movdqa    -232(%ebp), %xmm0                             #4154.38
-..LN3867:
-        movdqa    -152(%ebp), %xmm1                             #4154.46
-..LN3869:
-        pand      %xmm1, %xmm0                                  #4154.22
-..LN3871:
-        movdqa    %xmm0, -264(%ebp)                             #4154.17
-..LN3873:
-        movdqa    -232(%ebp), %xmm0                             #4155.38
-..LN3875:
-        movdqa    -136(%ebp), %xmm1                             #4155.46
-..LN3877:
-        pand      %xmm1, %xmm0                                  #4155.22
-..LN3879:
-        movdqa    %xmm0, -248(%ebp)                             #4155.17
-..LN3881:
-        movdqa    -264(%ebp), %xmm0                             #4156.22
-        movdqa    -248(%ebp), %xmm1                             #4156.22
-        pcmpeqw   %xmm1, %xmm0                                  #4156.22
-..LN3883:
-        movdqa    %xmm0, -264(%ebp)                             #4156.17
-..LN3885:
-        movdqa    -264(%ebp), %xmm0                             #4157.42
-..LN3887:
-        pmovmskb  %xmm0, %eax                                   #4157.22
-..LN3889:
-        movl      %eax, -24(%ebp)                               #4157.17
-                                # LOE
-..B25.15:                       # Preds ..B25.7 ..B25.14
-..LN3891:
-        movdqa    -232(%ebp), %xmm0                             #4161.38
-..LN3893:
-        movdqa    -120(%ebp), %xmm1                             #4161.46
-..LN3895:
-        pand      %xmm1, %xmm0                                  #4161.22
-..LN3897:
-        movdqa    %xmm0, -264(%ebp)                             #4161.17
-..LN3899:
-        movdqa    -232(%ebp), %xmm0                             #4162.38
-..LN3901:
-        movdqa    -104(%ebp), %xmm1                             #4162.46
-..LN3903:
-        pand      %xmm1, %xmm0                                  #4162.22
-..LN3905:
-        movdqa    %xmm0, -248(%ebp)                             #4162.17
-..LN3907:
-        movdqa    -264(%ebp), %xmm0                             #4163.22
-        movdqa    -248(%ebp), %xmm1                             #4163.22
-        pcmpeqw   %xmm1, %xmm0                                  #4163.22
-..LN3909:
-        movdqa    %xmm0, -264(%ebp)                             #4163.17
-..LN3911:
-        movdqa    -264(%ebp), %xmm0                             #4164.42
-..LN3913:
-        pmovmskb  %xmm0, %eax                                   #4164.22
-..LN3915:
-        movl      %eax, -40(%ebp)                               #4164.17
-..LN3917:
-        movl      16(%ebx), %eax                                #4169.17
-        andl      $-4, %eax                                     #4169.17
-        movl      %eax, 16(%ebx)                                #4169.17
-..LN3919:
-        movl      -20(%ebp), %eax                               #4172.29
-        orl       -16(%ebp), %eax                               #4172.29
-..LN3921:
-        orl       -24(%ebp), %eax                               #4172.34
-..LN3923:
-        orl       -40(%ebp), %eax                               #4172.39
-..LN3925:
-        je        ..B25.32      # Prob 50%                      #4172.47
-                                # LOE
-..B25.16:                       # Preds ..B25.15
-..LN3927:
-        pushl     %edi                                          #4190.30
-..LN3929:
-        movl      -16(%ebp), %eax                               #4190.58
-        movw      %ax, (%esp)                                   #4190.58
-..LN3931:
-        call      uint16_lsbit                                  #4190.30
-                                # LOE eax
-..B25.45:                       # Preds ..B25.16
-        popl      %ecx                                          #4190.30
-        movl      %eax, -56(%ebp)                               #4190.30
-                                # LOE
-..B25.17:                       # Preds ..B25.45
-        movl      -56(%ebp), %eax                               #4190.30
-        movswl    %ax, %eax                                     #4190.30
-..LN3933:
-        movl      %eax, -72(%ebp)                               #4190.28
-..LN3935:
-        pushl     %edi                                          #4191.30
-..LN3937:
-        movl      -20(%ebp), %eax                               #4191.58
-        movw      %ax, (%esp)                                   #4191.58
-..LN3939:
-        call      uint16_lsbit                                  #4191.30
-                                # LOE eax
-..B25.46:                       # Preds ..B25.17
-        popl      %ecx                                          #4191.30
-        movl      %eax, -52(%ebp)                               #4191.30
-                                # LOE
-..B25.18:                       # Preds ..B25.46
-        movl      -52(%ebp), %eax                               #4191.30
-        movswl    %ax, %eax                                     #4191.30
-..LN3941:
-        movl      %eax, -68(%ebp)                               #4191.28
-..LN3943:
-        pushl     %edi                                          #4192.30
-..LN3945:
-        movl      -24(%ebp), %eax                               #4192.58
-        movw      %ax, (%esp)                                   #4192.58
-..LN3947:
-        call      uint16_lsbit                                  #4192.30
-                                # LOE eax
-..B25.47:                       # Preds ..B25.18
-        popl      %ecx                                          #4192.30
-        movl      %eax, -48(%ebp)                               #4192.30
-                                # LOE
-..B25.19:                       # Preds ..B25.47
-        movl      -48(%ebp), %eax                               #4192.30
-        movswl    %ax, %eax                                     #4192.30
-..LN3949:
-        movl      %eax, -64(%ebp)                               #4192.28
-..LN3951:
-        pushl     %edi                                          #4193.30
-..LN3953:
-        movl      -40(%ebp), %eax                               #4193.58
-        movw      %ax, (%esp)                                   #4193.58
-..LN3955:
-        call      uint16_lsbit                                  #4193.30
-                                # LOE eax
-..B25.48:                       # Preds ..B25.19
-        popl      %ecx                                          #4193.30
-        movl      %eax, -44(%ebp)                               #4193.30
-                                # LOE
-..B25.20:                       # Preds ..B25.48
-        movl      -44(%ebp), %eax                               #4193.30
-        movswl    %ax, %eax                                     #4193.30
-..LN3957:
-        movl      %eax, -60(%ebp)                               #4193.28
-..LN3959:
-        movl      -72(%ebp), %eax                               #4198.28
-..LN3961:
-        addl      %eax, %eax                                    #4198.34
-..LN3963:
-        movl      %eax, -72(%ebp)                               #4198.21
-..LN3965:
-        movl      -68(%ebp), %eax                               #4199.28
-..LN3967:
-        lea       1(%eax,%eax), %eax                            #4199.40
-..LN3969:
-        movl      %eax, -68(%ebp)                               #4199.21
-..LN3971:
-        movl      -64(%ebp), %eax                               #4200.28
-..LN3973:
-        lea       2(%eax,%eax), %eax                            #4200.40
-..LN3975:
-        movl      %eax, -64(%ebp)                               #4200.21
-..LN3977:
-        movl      -60(%ebp), %eax                               #4201.28
-..LN3979:
-        lea       3(%eax,%eax), %eax                            #4201.40
-..LN3981:
-        movl      %eax, -60(%ebp)                               #4201.21
-..LN3983:
-        movl      -16(%ebp), %eax                               #4205.26
-..LN3985:
-        testl     %eax, %eax                                    #4205.32
-        je        ..B25.23      # Prob 50%                      #4205.32
-                                # LOE
-..B25.21:                       # Preds ..B25.20
-..LN3987:
-        movl      -72(%ebp), %eax                               #4205.43
-        addl      16(%ebx), %eax                                #4205.43
-..LN3989:
-        movl      -32(%ebp), %edx                               #4205.49
-        cmpl      %edx, %eax                                    #4205.49
-        ja        ..B25.23      # Prob 50%                      #4205.49
-                                # LOE
-..B25.22:                       # Preds ..B25.21
-..LN3991:
-        movl      $1, %eax                                      #4205.63
-        leave                                                   #4205.63
-..___tag_value_eval_4na_16.765:                                 #
-        movl      %ebx, %esp                                    #4205.63
-        popl      %ebx                                          #4205.63
-..___tag_value_eval_4na_16.766:                                 #
-        ret                                                     #4205.63
-..___tag_value_eval_4na_16.768:                                 #
-                                # LOE
-..B25.23:                       # Preds ..B25.21 ..B25.20
-..LN3993:
-        movl      -20(%ebp), %eax                               #4206.26
-..LN3995:
-        testl     %eax, %eax                                    #4206.32
-        je        ..B25.26      # Prob 50%                      #4206.32
-                                # LOE
-..B25.24:                       # Preds ..B25.23
-..LN3997:
-        movl      -68(%ebp), %eax                               #4206.43
-        addl      16(%ebx), %eax                                #4206.43
-..LN3999:
-        movl      -32(%ebp), %edx                               #4206.49
-        cmpl      %edx, %eax                                    #4206.49
-        ja        ..B25.26      # Prob 50%                      #4206.49
-                                # LOE
-..B25.25:                       # Preds ..B25.24
-..LN4001:
-        movl      $1, %eax                                      #4206.63
-        leave                                                   #4206.63
-..___tag_value_eval_4na_16.772:                                 #
-        movl      %ebx, %esp                                    #4206.63
-        popl      %ebx                                          #4206.63
-..___tag_value_eval_4na_16.773:                                 #
-        ret                                                     #4206.63
-..___tag_value_eval_4na_16.775:                                 #
-                                # LOE
-..B25.26:                       # Preds ..B25.24 ..B25.23
-..LN4003:
-        movl      -24(%ebp), %eax                               #4207.26
-..LN4005:
-        testl     %eax, %eax                                    #4207.32
-        je        ..B25.29      # Prob 50%                      #4207.32
-                                # LOE
-..B25.27:                       # Preds ..B25.26
-..LN4007:
-        movl      -64(%ebp), %eax                               #4207.43
-        addl      16(%ebx), %eax                                #4207.43
-..LN4009:
-        movl      -32(%ebp), %edx                               #4207.49
-        cmpl      %edx, %eax                                    #4207.49
-        ja        ..B25.29      # Prob 50%                      #4207.49
-                                # LOE
-..B25.28:                       # Preds ..B25.27
-..LN4011:
-        movl      $1, %eax                                      #4207.63
-        leave                                                   #4207.63
-..___tag_value_eval_4na_16.779:                                 #
-        movl      %ebx, %esp                                    #4207.63
-        popl      %ebx                                          #4207.63
-..___tag_value_eval_4na_16.780:                                 #
-        ret                                                     #4207.63
-..___tag_value_eval_4na_16.782:                                 #
-                                # LOE
-..B25.29:                       # Preds ..B25.27 ..B25.26
-..LN4013:
-        movl      -40(%ebp), %eax                               #4208.26
-..LN4015:
-        testl     %eax, %eax                                    #4208.32
-        je        ..B25.32      # Prob 50%                      #4208.32
-                                # LOE
-..B25.30:                       # Preds ..B25.29
-..LN4017:
-        movl      -60(%ebp), %eax                               #4208.43
-        addl      16(%ebx), %eax                                #4208.43
-..LN4019:
-        movl      -32(%ebp), %edx                               #4208.49
-        cmpl      %edx, %eax                                    #4208.49
-        ja        ..B25.32      # Prob 50%                      #4208.49
-                                # LOE
-..B25.31:                       # Preds ..B25.30
-..LN4021:
-        movl      $1, %eax                                      #4208.63
-        leave                                                   #4208.63
-..___tag_value_eval_4na_16.786:                                 #
-        movl      %ebx, %esp                                    #4208.63
-        popl      %ebx                                          #4208.63
-..___tag_value_eval_4na_16.787:                                 #
-        ret                                                     #4208.63
-..___tag_value_eval_4na_16.789:                                 #
-                                # LOE
-..B25.32:                       # Preds ..B25.30 ..B25.29 ..B25.15
-..LN4023:
-        movl      16(%ebx), %eax                                #4213.17
-        addl      $4, %eax                                      #4213.17
-        movl      %eax, 16(%ebx)                                #4213.17
-..LN4025:
-        movl      16(%ebx), %eax                                #4216.22
-..LN4027:
-        movl      -32(%ebp), %edx                               #4216.28
-        cmpl      %edx, %eax                                    #4216.28
-        jbe       ..B25.34      # Prob 50%                      #4216.28
-                                # LOE
-..B25.33:                       # Preds ..B25.32
-..LN4029:
-        xorl      %eax, %eax                                    #4217.28
-        leave                                                   #4217.28
-..___tag_value_eval_4na_16.793:                                 #
-        movl      %ebx, %esp                                    #4217.28
-        popl      %ebx                                          #4217.28
-..___tag_value_eval_4na_16.794:                                 #
-        ret                                                     #4217.28
-..___tag_value_eval_4na_16.796:                                 #
-                                # LOE
-..B25.34:                       # Preds ..B25.32
-..LN4031:
-        movl      -12(%ebp), %eax                               #4220.25
-        decl      %eax                                          #4220.25
-        movl      %eax, -12(%ebp)                               #4220.25
-..LN4033:
-        jne       ..B25.10      # Prob 50%                      #4220.39
-                                # LOE
-..B25.36:                       # Preds ..B25.34 ..B25.10
-..LN4035:
-        movl      -36(%ebp), %eax                               #4237.18
-..LN4037:
-        movl      -28(%ebp), %edx                               #4237.25
-        cmpl      %edx, %eax                                    #4237.25
-        jae       ..B25.40      # Prob 50%                      #4237.25
-                                # LOE
-..B25.37:                       # Preds ..B25.36
-..LN4039:
-        movl      16(%ebx), %eax                                #4241.13
-        addl      $28, %eax                                     #4241.13
-        movl      %eax, 16(%ebx)                                #4241.13
-..LN4041:
-        movl      16(%ebx), %eax                                #4242.18
-..LN4043:
-        movl      -32(%ebp), %edx                               #4242.24
-        cmpl      %edx, %eax                                    #4242.24
-        ja        ..B25.40      # Prob 50%                      #4242.24
-                                # LOE
-..B25.38:                       # Preds ..B25.37
-..LN4045:
-        addl      $-8, %esp                                     #4247.22
-..LN4047:
-        movl      -36(%ebp), %eax                               #4247.41
-        movl      %eax, (%esp)                                  #4247.41
-..LN4049:
-        movl      -28(%ebp), %eax                               #4247.46
-        movl      %eax, 4(%esp)                                 #4247.46
-..LN4051:
-        call      prime_buffer_4na                              #4247.22
-                                # LOE xmm0
-..B25.49:                       # Preds ..B25.38
-        addl      $8, %esp                                      #4247.22
-        movdqa    %xmm0, -280(%ebp)                             #4247.22
-                                # LOE
-..B25.39:                       # Preds ..B25.49
-..LN4053:
-        movdqa    -280(%ebp), %xmm0                             #4247.13
-        movdqa    %xmm0, -232(%ebp)                             #4247.13
-..LN4055:
-        addl      $8, -36(%ebp)                                 #4262.13
-        jmp       ..B25.8       # Prob 100%                     #4262.13
-                                # LOE
-..B25.40:                       # Preds ..B25.37 ..B25.36 ..B25.8
-..LN4057:
-        xorl      %eax, %eax                                    #4273.12
-        leave                                                   #4273.12
-..___tag_value_eval_4na_16.800:                                 #
-        movl      %ebx, %esp                                    #4273.12
-        popl      %ebx                                          #4273.12
-..___tag_value_eval_4na_16.801:                                 #
-        ret                                                     #4273.12
-        .align    2,0x90
-..___tag_value_eval_4na_16.803:                                 #
-                                # LOE
-# mark_end;
-	.type	eval_4na_16, at function
-	.size	eval_4na_16,.-eval_4na_16
-.LNeval_4na_16:
-	.data
-# -- End  eval_4na_16
-	.section .rodata, "a"
-	.align 4
-__$Uc:
-	.byte	101
-	.byte	118
-	.byte	97
-	.byte	108
-	.byte	95
-	.byte	52
-	.byte	110
-	.byte	97
-	.byte	95
-	.byte	51
-	.byte	50
-	.byte	0
-	.type	__$Uc, at object
-	.size	__$Uc,12
-	.text
-# -- Begin  eval_4na_32
-# mark_begin;
-       .align    2,0x90
-eval_4na_32:
-# parameter 1(self): 8 + %ebx
-# parameter 2(ncbi2na): 12 + %ebx
-# parameter 3(pos): 16 + %ebx
-# parameter 4(len): 20 + %ebx
-..B26.1:                        # Preds ..B26.0
-..___tag_value_eval_4na_32.806:                                 #
-..LN4059:
-        pushl     %ebx                                          #4279.1
-..___tag_value_eval_4na_32.811:                                 #
-        movl      %esp, %ebx                                    #4279.1
-..___tag_value_eval_4na_32.812:                                 #
-        andl      $-16, %esp                                    #4279.1
-        pushl     %ebp                                          #4279.1
-        pushl     %ebp                                          #4279.1
-        movl      4(%ebx), %ebp                                 #4279.1
-        movl      %ebp, 4(%esp)                                 #4279.1
-        movl      %esp, %ebp                                    #4279.1
-..___tag_value_eval_4na_32.814:                                 #
-        subl      $312, %esp                                    #4279.1
-        movl      %ebx, -312(%ebp)                              #4279.1
-        call      ..L816        # Prob 100%                     #4279.1
-..L816:                                                         #
-        popl      %eax                                          #4279.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L816], %eax     #4279.1
-        movl      %eax, -12(%ebp)                               #4279.1
-..LN4061:
-        movl      8(%ebx), %eax                                 #4305.25
-        movl      4(%eax), %eax                                 #4305.25
-..LN4063:
-        movl      %eax, -16(%ebp)                               #4305.23
-..LN4065:
-        movl      20(%ebx), %eax                                #4308.5
-        movl      -16(%ebp), %edx                               #4308.5
-        cmpl      %edx, %eax                                    #4308.5
-        jae       ..B26.3       # Prob 50%                      #4308.5
-                                # LOE
-..B26.2:                        # Preds ..B26.1
-        addl      $-16, %esp                                    #4308.5
-        movl      -12(%ebp), %eax                               #4308.5
-        lea       _2__STRING.9 at GOTOFF(%eax), %eax               #4308.5
-        movl      %eax, (%esp)                                  #4308.5
-        movl      -12(%ebp), %eax                               #4308.5
-        lea       _2__STRING.1 at GOTOFF(%eax), %eax               #4308.5
-        movl      %eax, 4(%esp)                                 #4308.5
-        movl      $4308, 8(%esp)                                #4308.5
-        movl      -12(%ebp), %eax                               #4308.5
-        lea       __$Uc at GOTOFF(%eax), %eax                      #4308.5
-        movl      %eax, 12(%esp)                                #4308.5
-        movl      -12(%ebp), %eax                               #4308.5
-        movl      %eax, %ebx                                    #4308.5
-..___tag_value_eval_4na_32.817:                                 #4308.5
-        call      __assert_fail at PLT                             #4308.5
-        movl      -312(%ebp), %ebx                              #4308.5
-..___tag_value_eval_4na_32.818:                                 #
-                                # LOE
-..B26.46:                       # Preds ..B26.2
-        addl      $16, %esp                                     #4308.5
-                                # LOE
-..B26.3:                        # Preds ..B26.1
-..LN4067:
-        movl      16(%ebx), %eax                                #4312.12
-..LN4069:
-        addl      20(%ebx), %eax                                #4312.5
-        movl      %eax, 20(%ebx)                                #4312.5
-..LN4071:
-        movl      16(%ebx), %eax                                #4315.42
-..LN4073:
-        shrl      $2, %eax                                      #4315.49
-..LN4075:
-        addl      12(%ebx), %eax                                #4315.30
-..LN4077:
-        movl      %eax, -52(%ebp)                               #4315.5
-..LN4079:
-        movl      -16(%ebp), %eax                               #4318.18
-        negl      %eax                                          #4318.18
-        addl      20(%ebx), %eax                                #4318.18
-..LN4081:
-        movl      %eax, -48(%ebp)                               #4318.5
-..LN4083:
-        movl      20(%ebx), %eax                                #4321.44
-..LN4085:
-        addl      $3, %eax                                      #4321.50
-..LN4087:
-        shrl      $2, %eax                                      #4321.57
-..LN4089:
-        addl      12(%ebx), %eax                                #4321.30
-..LN4091:
-        movl      %eax, -44(%ebp)                               #4321.5
-..LN4093:
-        addl      $-8, %esp                                     #4324.14
-..LN4095:
-        movl      -52(%ebp), %eax                               #4324.33
-        movl      %eax, (%esp)                                  #4324.33
-..LN4097:
-        movl      -44(%ebp), %eax                               #4324.38
-        movl      %eax, 4(%esp)                                 #4324.38
-..LN4099:
-        call      prime_buffer_4na                              #4324.14
-                                # LOE xmm0
-..B26.47:                       # Preds ..B26.3
-        addl      $8, %esp                                      #4324.14
-        movdqa    %xmm0, -104(%ebp)                             #4324.14
-                                # LOE
-..B26.4:                        # Preds ..B26.47
-..LN4101:
-        movdqa    -104(%ebp), %xmm0                             #4324.5
-        movdqa    %xmm0, -248(%ebp)                             #4324.5
-..LN4103:
-        addl      $8, -52(%ebp)                                 #4325.5
-..LN4105:
-        movl      -52(%ebp), %eax                               #4327.9
-..LN4107:
-        movl      %eax, -40(%ebp)                               #4327.5
-..LN4109:
-        movl      8(%ebx), %eax                                 #4331.5
-        movdqa    16(%eax), %xmm0                               #4331.5
-        movdqa    %xmm0, -232(%ebp)                             #4331.5
-        movl      8(%ebx), %eax                                 #4331.5
-        movdqa    32(%eax), %xmm0                               #4331.5
-        movdqa    %xmm0, -216(%ebp)                             #4331.5
-        movl      8(%ebx), %eax                                 #4331.5
-        movdqa    48(%eax), %xmm0                               #4331.5
-        movdqa    %xmm0, -200(%ebp)                             #4331.5
-        movl      8(%ebx), %eax                                 #4331.5
-        movdqa    64(%eax), %xmm0                               #4331.5
-        movdqa    %xmm0, -184(%ebp)                             #4331.5
-        movl      8(%ebx), %eax                                 #4331.5
-        movdqa    80(%eax), %xmm0                               #4331.5
-        movdqa    %xmm0, -168(%ebp)                             #4331.5
-        movl      8(%ebx), %eax                                 #4331.5
-        movdqa    96(%eax), %xmm0                               #4331.5
-        movdqa    %xmm0, -152(%ebp)                             #4331.5
-        movl      8(%ebx), %eax                                 #4331.5
-        movdqa    112(%eax), %xmm0                              #4331.5
-        movdqa    %xmm0, -136(%ebp)                             #4331.5
-        movl      8(%ebx), %eax                                 #4331.5
-        movdqa    128(%eax), %xmm0                              #4331.5
-        movdqa    %xmm0, -120(%ebp)                             #4331.5
-..LN4111:
-        xorl      %eax, %eax                                    #4334.15
-        movl      %eax, -36(%ebp)                               #4334.15
-..LN4113:
-        movl      %eax, -32(%ebp)                               #4334.10
-..LN4115:
-        movl      %eax, -28(%ebp)                               #4334.5
-..LN4117:
-        movl      $2, -24(%ebp)                                 #4340.5
-..LN4119:
-        movl      16(%ebx), %eax                                #4345.14
-..LN4121:
-        andl      $3, %eax                                      #4345.20
-        movl      %eax, -20(%ebp)                               #4345.20
-        je        ..B26.12      # Prob 50%                      #4345.20
-                                # LOE
-..B26.5:                        # Preds ..B26.4
-        movl      -20(%ebp), %eax                               #4345.20
-        cmpl      $1, %eax                                      #4345.20
-        je        ..B26.13      # Prob 50%                      #4345.20
-                                # LOE
-..B26.6:                        # Preds ..B26.5
-        movl      -20(%ebp), %eax                               #4345.20
-        cmpl      $2, %eax                                      #4345.20
-        je        ..B26.14      # Prob 50%                      #4345.20
-                                # LOE
-..B26.7:                        # Preds ..B26.6
-        movl      -20(%ebp), %eax                               #4345.20
-        cmpl      $3, %eax                                      #4345.20
-        je        ..B26.15      # Prob 50%                      #4345.20
-                                # LOE
-..B26.8:                        # Preds ..B26.42 ..B26.7
-..LN4123:
-        movl      $1, %eax                                      #4350.9
-        testl     %eax, %eax                                    #4350.9
-        je        ..B26.43      # Prob 100%                     #4350.9
-                                # LOE
-..B26.9:                        # Preds ..B26.8
-..LN4125:
-        movl      $2, -24(%ebp)                                 #4352.13
-                                # LOE
-..B26.10:                       # Preds ..B26.37 ..B26.9
-..LN4127:
-        movl      $1, %eax                                      #4355.13
-        testl     %eax, %eax                                    #4355.13
-        je        ..B26.39      # Prob 100%                     #4355.13
-                                # LOE
-..B26.12:                       # Preds ..B26.4 ..B26.10
-..LN4129:
-        movdqa    -248(%ebp), %xmm0                             #4362.38
-..LN4131:
-        movdqa    -232(%ebp), %xmm1                             #4362.46
-..LN4133:
-        pand      %xmm1, %xmm0                                  #4362.22
-..LN4135:
-        movdqa    %xmm0, -280(%ebp)                             #4362.17
-..LN4137:
-        movdqa    -248(%ebp), %xmm0                             #4363.38
-..LN4139:
-        movdqa    -216(%ebp), %xmm1                             #4363.46
-..LN4141:
-        pand      %xmm1, %xmm0                                  #4363.22
-..LN4143:
-        movdqa    %xmm0, -264(%ebp)                             #4363.17
-..LN4145:
-        movdqa    -280(%ebp), %xmm0                             #4364.22
-        movdqa    -264(%ebp), %xmm1                             #4364.22
-        pcmpeqd   %xmm1, %xmm0                                  #4364.22
-..LN4147:
-        movdqa    %xmm0, -280(%ebp)                             #4364.17
-..LN4149:
-        movdqa    -280(%ebp), %xmm0                             #4365.42
-..LN4151:
-        pmovmskb  %xmm0, %eax                                   #4365.22
-..LN4153:
-        movl      %eax, -28(%ebp)                               #4365.17
-                                # LOE
-..B26.13:                       # Preds ..B26.5 ..B26.12
-..LN4155:
-        movdqa    -248(%ebp), %xmm0                             #4369.38
-..LN4157:
-        movdqa    -200(%ebp), %xmm1                             #4369.46
-..LN4159:
-        pand      %xmm1, %xmm0                                  #4369.22
-..LN4161:
-        movdqa    %xmm0, -280(%ebp)                             #4369.17
-..LN4163:
-        movdqa    -248(%ebp), %xmm0                             #4370.38
-..LN4165:
-        movdqa    -184(%ebp), %xmm1                             #4370.46
-..LN4167:
-        pand      %xmm1, %xmm0                                  #4370.22
-..LN4169:
-        movdqa    %xmm0, -264(%ebp)                             #4370.17
-..LN4171:
-        movdqa    -280(%ebp), %xmm0                             #4371.22
-        movdqa    -264(%ebp), %xmm1                             #4371.22
-        pcmpeqd   %xmm1, %xmm0                                  #4371.22
-..LN4173:
-        movdqa    %xmm0, -280(%ebp)                             #4371.17
-..LN4175:
-        movdqa    -280(%ebp), %xmm0                             #4372.42
-..LN4177:
-        pmovmskb  %xmm0, %eax                                   #4372.22
-..LN4179:
-        movl      %eax, -32(%ebp)                               #4372.17
-                                # LOE
-..B26.14:                       # Preds ..B26.6 ..B26.13
-..LN4181:
-        movdqa    -248(%ebp), %xmm0                             #4376.38
-..LN4183:
-        movdqa    -168(%ebp), %xmm1                             #4376.46
-..LN4185:
-        pand      %xmm1, %xmm0                                  #4376.22
-..LN4187:
-        movdqa    %xmm0, -280(%ebp)                             #4376.17
-..LN4189:
-        movdqa    -248(%ebp), %xmm0                             #4377.38
-..LN4191:
-        movdqa    -152(%ebp), %xmm1                             #4377.46
-..LN4193:
-        pand      %xmm1, %xmm0                                  #4377.22
-..LN4195:
-        movdqa    %xmm0, -264(%ebp)                             #4377.17
-..LN4197:
-        movdqa    -280(%ebp), %xmm0                             #4378.22
-        movdqa    -264(%ebp), %xmm1                             #4378.22
-        pcmpeqd   %xmm1, %xmm0                                  #4378.22
-..LN4199:
-        movdqa    %xmm0, -280(%ebp)                             #4378.17
-..LN4201:
-        movdqa    -280(%ebp), %xmm0                             #4379.42
-..LN4203:
-        pmovmskb  %xmm0, %eax                                   #4379.22
-..LN4205:
-        movl      %eax, -36(%ebp)                               #4379.17
-                                # LOE
-..B26.15:                       # Preds ..B26.7 ..B26.14
-..LN4207:
-        movdqa    -248(%ebp), %xmm0                             #4383.38
-..LN4209:
-        movdqa    -136(%ebp), %xmm1                             #4383.46
-..LN4211:
-        pand      %xmm1, %xmm0                                  #4383.22
-..LN4213:
-        movdqa    %xmm0, -280(%ebp)                             #4383.17
-..LN4215:
-        movdqa    -248(%ebp), %xmm0                             #4384.38
-..LN4217:
-        movdqa    -120(%ebp), %xmm1                             #4384.46
-..LN4219:
-        pand      %xmm1, %xmm0                                  #4384.22
-..LN4221:
-        movdqa    %xmm0, -264(%ebp)                             #4384.17
-..LN4223:
-        movdqa    -280(%ebp), %xmm0                             #4385.22
-        movdqa    -264(%ebp), %xmm1                             #4385.22
-        pcmpeqd   %xmm1, %xmm0                                  #4385.22
-..LN4225:
-        movdqa    %xmm0, -280(%ebp)                             #4385.17
-..LN4227:
-        movdqa    -280(%ebp), %xmm0                             #4386.42
-..LN4229:
-        pmovmskb  %xmm0, %eax                                   #4386.22
-..LN4231:
-        movl      %eax, -56(%ebp)                               #4386.17
-..LN4233:
-        movl      16(%ebx), %eax                                #4391.17
-        andl      $-4, %eax                                     #4391.17
-        movl      %eax, 16(%ebx)                                #4391.17
-..LN4235:
-        movl      -32(%ebp), %eax                               #4394.29
-        orl       -28(%ebp), %eax                               #4394.29
-..LN4237:
-        orl       -36(%ebp), %eax                               #4394.34
-..LN4239:
-        orl       -56(%ebp), %eax                               #4394.39
-..LN4241:
-        je        ..B26.32      # Prob 50%                      #4394.47
-                                # LOE
-..B26.16:                       # Preds ..B26.15
-..LN4243:
-        pushl     %edi                                          #4412.30
-..LN4245:
-        movl      -28(%ebp), %eax                               #4412.58
-        movw      %ax, (%esp)                                   #4412.58
-..LN4247:
-        call      uint16_lsbit                                  #4412.30
-                                # LOE eax
-..B26.48:                       # Preds ..B26.16
-        popl      %ecx                                          #4412.30
-        movl      %eax, -72(%ebp)                               #4412.30
-                                # LOE
-..B26.17:                       # Preds ..B26.48
-        movl      -72(%ebp), %eax                               #4412.30
-        movswl    %ax, %eax                                     #4412.30
-..LN4249:
-        movl      %eax, -88(%ebp)                               #4412.28
-..LN4251:
-        pushl     %edi                                          #4413.30
-..LN4253:
-        movl      -32(%ebp), %eax                               #4413.58
-        movw      %ax, (%esp)                                   #4413.58
-..LN4255:
-        call      uint16_lsbit                                  #4413.30
-                                # LOE eax
-..B26.49:                       # Preds ..B26.17
-        popl      %ecx                                          #4413.30
-        movl      %eax, -68(%ebp)                               #4413.30
-                                # LOE
-..B26.18:                       # Preds ..B26.49
-        movl      -68(%ebp), %eax                               #4413.30
-        movswl    %ax, %eax                                     #4413.30
-..LN4257:
-        movl      %eax, -84(%ebp)                               #4413.28
-..LN4259:
-        pushl     %edi                                          #4414.30
-..LN4261:
-        movl      -36(%ebp), %eax                               #4414.58
-        movw      %ax, (%esp)                                   #4414.58
-..LN4263:
-        call      uint16_lsbit                                  #4414.30
-                                # LOE eax
-..B26.50:                       # Preds ..B26.18
-        popl      %ecx                                          #4414.30
-        movl      %eax, -64(%ebp)                               #4414.30
-                                # LOE
-..B26.19:                       # Preds ..B26.50
-        movl      -64(%ebp), %eax                               #4414.30
-        movswl    %ax, %eax                                     #4414.30
-..LN4265:
-        movl      %eax, -80(%ebp)                               #4414.28
-..LN4267:
-        pushl     %edi                                          #4415.30
-..LN4269:
-        movl      -56(%ebp), %eax                               #4415.58
-        movw      %ax, (%esp)                                   #4415.58
-..LN4271:
-        call      uint16_lsbit                                  #4415.30
-                                # LOE eax
-..B26.51:                       # Preds ..B26.19
-        popl      %ecx                                          #4415.30
-        movl      %eax, -60(%ebp)                               #4415.30
-                                # LOE
-..B26.20:                       # Preds ..B26.51
-        movl      -60(%ebp), %eax                               #4415.30
-        movswl    %ax, %eax                                     #4415.30
-..LN4273:
-        movl      %eax, -76(%ebp)                               #4415.28
-..LN4275:
-        movl      -88(%ebp), %eax                               #4420.28
-..LN4277:
-        addl      %eax, %eax                                    #4420.34
-..LN4279:
-        movl      %eax, -88(%ebp)                               #4420.21
-..LN4281:
-        movl      -84(%ebp), %eax                               #4421.28
-..LN4283:
-        lea       1(%eax,%eax), %eax                            #4421.40
-..LN4285:
-        movl      %eax, -84(%ebp)                               #4421.21
-..LN4287:
-        movl      -80(%ebp), %eax                               #4422.28
-..LN4289:
-        lea       2(%eax,%eax), %eax                            #4422.40
-..LN4291:
-        movl      %eax, -80(%ebp)                               #4422.21
-..LN4293:
-        movl      -76(%ebp), %eax                               #4423.28
-..LN4295:
-        lea       3(%eax,%eax), %eax                            #4423.40
-..LN4297:
-        movl      %eax, -76(%ebp)                               #4423.21
-..LN4299:
-        movl      -28(%ebp), %eax                               #4427.26
-..LN4301:
-        testl     %eax, %eax                                    #4427.32
-        je        ..B26.23      # Prob 50%                      #4427.32
-                                # LOE
-..B26.21:                       # Preds ..B26.20
-..LN4303:
-        movl      -88(%ebp), %eax                               #4427.43
-        addl      16(%ebx), %eax                                #4427.43
-..LN4305:
-        movl      -48(%ebp), %edx                               #4427.49
-        cmpl      %edx, %eax                                    #4427.49
-        ja        ..B26.23      # Prob 50%                      #4427.49
-                                # LOE
-..B26.22:                       # Preds ..B26.21
-..LN4307:
-        movl      $1, %eax                                      #4427.63
-        leave                                                   #4427.63
-..___tag_value_eval_4na_32.820:                                 #
-        movl      %ebx, %esp                                    #4427.63
-        popl      %ebx                                          #4427.63
-..___tag_value_eval_4na_32.821:                                 #
-        ret                                                     #4427.63
-..___tag_value_eval_4na_32.823:                                 #
-                                # LOE
-..B26.23:                       # Preds ..B26.21 ..B26.20
-..LN4309:
-        movl      -32(%ebp), %eax                               #4428.26
-..LN4311:
-        testl     %eax, %eax                                    #4428.32
-        je        ..B26.26      # Prob 50%                      #4428.32
-                                # LOE
-..B26.24:                       # Preds ..B26.23
-..LN4313:
-        movl      -84(%ebp), %eax                               #4428.43
-        addl      16(%ebx), %eax                                #4428.43
-..LN4315:
-        movl      -48(%ebp), %edx                               #4428.49
-        cmpl      %edx, %eax                                    #4428.49
-        ja        ..B26.26      # Prob 50%                      #4428.49
-                                # LOE
-..B26.25:                       # Preds ..B26.24
-..LN4317:
-        movl      $1, %eax                                      #4428.63
-        leave                                                   #4428.63
-..___tag_value_eval_4na_32.827:                                 #
-        movl      %ebx, %esp                                    #4428.63
-        popl      %ebx                                          #4428.63
-..___tag_value_eval_4na_32.828:                                 #
-        ret                                                     #4428.63
-..___tag_value_eval_4na_32.830:                                 #
-                                # LOE
-..B26.26:                       # Preds ..B26.24 ..B26.23
-..LN4319:
-        movl      -36(%ebp), %eax                               #4429.26
-..LN4321:
-        testl     %eax, %eax                                    #4429.32
-        je        ..B26.29      # Prob 50%                      #4429.32
-                                # LOE
-..B26.27:                       # Preds ..B26.26
-..LN4323:
-        movl      -80(%ebp), %eax                               #4429.43
-        addl      16(%ebx), %eax                                #4429.43
-..LN4325:
-        movl      -48(%ebp), %edx                               #4429.49
-        cmpl      %edx, %eax                                    #4429.49
-        ja        ..B26.29      # Prob 50%                      #4429.49
-                                # LOE
-..B26.28:                       # Preds ..B26.27
-..LN4327:
-        movl      $1, %eax                                      #4429.63
-        leave                                                   #4429.63
-..___tag_value_eval_4na_32.834:                                 #
-        movl      %ebx, %esp                                    #4429.63
-        popl      %ebx                                          #4429.63
-..___tag_value_eval_4na_32.835:                                 #
-        ret                                                     #4429.63
-..___tag_value_eval_4na_32.837:                                 #
-                                # LOE
-..B26.29:                       # Preds ..B26.27 ..B26.26
-..LN4329:
-        movl      -56(%ebp), %eax                               #4430.26
-..LN4331:
-        testl     %eax, %eax                                    #4430.32
-        je        ..B26.32      # Prob 50%                      #4430.32
-                                # LOE
-..B26.30:                       # Preds ..B26.29
-..LN4333:
-        movl      -76(%ebp), %eax                               #4430.43
-        addl      16(%ebx), %eax                                #4430.43
-..LN4335:
-        movl      -48(%ebp), %edx                               #4430.49
-        cmpl      %edx, %eax                                    #4430.49
-        ja        ..B26.32      # Prob 50%                      #4430.49
-                                # LOE
-..B26.31:                       # Preds ..B26.30
-..LN4337:
-        movl      $1, %eax                                      #4430.63
-        leave                                                   #4430.63
-..___tag_value_eval_4na_32.841:                                 #
-        movl      %ebx, %esp                                    #4430.63
-        popl      %ebx                                          #4430.63
-..___tag_value_eval_4na_32.842:                                 #
-        ret                                                     #4430.63
-..___tag_value_eval_4na_32.844:                                 #
-                                # LOE
-..B26.32:                       # Preds ..B26.30 ..B26.29 ..B26.15
-..LN4339:
-        movl      16(%ebx), %eax                                #4435.17
-        addl      $4, %eax                                      #4435.17
-        movl      %eax, 16(%ebx)                                #4435.17
-..LN4341:
-        movl      16(%ebx), %eax                                #4438.22
-..LN4343:
-        movl      -48(%ebp), %edx                               #4438.28
-        cmpl      %edx, %eax                                    #4438.28
-        jbe       ..B26.34      # Prob 50%                      #4438.28
-                                # LOE
-..B26.33:                       # Preds ..B26.32
-..LN4345:
-        xorl      %eax, %eax                                    #4439.28
-        leave                                                   #4439.28
-..___tag_value_eval_4na_32.848:                                 #
-        movl      %ebx, %esp                                    #4439.28
-        popl      %ebx                                          #4439.28
-..___tag_value_eval_4na_32.849:                                 #
-        ret                                                     #4439.28
-..___tag_value_eval_4na_32.851:                                 #
-                                # LOE
-..B26.34:                       # Preds ..B26.32
-..LN4347:
-        movl      -24(%ebp), %eax                               #4442.25
-        decl      %eax                                          #4442.25
-        movl      %eax, -24(%ebp)                               #4442.25
-..LN4349:
-        je        ..B26.39      # Prob 50%                      #4442.39
-                                # LOE
-..B26.35:                       # Preds ..B26.34
-..LN4351:
-        movdqa    -248(%ebp), %xmm0                             #4447.43
-..LN4353:
-        psrldq    $2, %xmm0                                     #4447.26
-..LN4355:
-        movdqa    %xmm0, -248(%ebp)                             #4447.17
-..LN4357:
-        movl      -40(%ebp), %eax                               #4450.22
-..LN4359:
-        movl      -44(%ebp), %edx                               #4450.26
-        cmpl      %edx, %eax                                    #4450.26
-        jae       ..B26.37      # Prob 50%                      #4450.26
-                                # LOE
-..B26.36:                       # Preds ..B26.35
-..LN4361:
-        movdqa    -248(%ebp), %xmm0                             #4451.49
-..LN4363:
-        movl      -40(%ebp), %eax                               #4451.72
-        movzbl    (%eax), %eax                                  #4451.72
-        movzbl    %al, %eax                                     #4451.72
-..LN4365:
-        movl      -12(%ebp), %edx                               #4451.57
-        movzwl    expand_2na at GOTOFF(%edx,%eax,2), %eax          #4451.57
-        movzwl    %ax, %eax                                     #4451.57
-..LN4367:
-        pinsrw    $7, %eax, %xmm0                               #4451.30
-..LN4369:
-        movdqa    %xmm0, -248(%ebp)                             #4451.21
-                                # LOE
-..B26.37:                       # Preds ..B26.36 ..B26.35
-..LN4371:
-        incl      -40(%ebp)                                     #4454.20
-        jmp       ..B26.10      # Prob 100%                     #4454.20
-                                # LOE
-..B26.39:                       # Preds ..B26.34 ..B26.10
-..LN4373:
-        movl      -52(%ebp), %eax                               #4459.18
-..LN4375:
-        movl      -44(%ebp), %edx                               #4459.25
-        cmpl      %edx, %eax                                    #4459.25
-        jae       ..B26.43      # Prob 50%                      #4459.25
-                                # LOE
-..B26.40:                       # Preds ..B26.39
-..LN4377:
-        movl      16(%ebx), %eax                                #4463.13
-        addl      $24, %eax                                     #4463.13
-        movl      %eax, 16(%ebx)                                #4463.13
-..LN4379:
-        movl      16(%ebx), %eax                                #4464.18
-..LN4381:
-        movl      -48(%ebp), %edx                               #4464.24
-        cmpl      %edx, %eax                                    #4464.24
-        ja        ..B26.43      # Prob 50%                      #4464.24
-                                # LOE
-..B26.41:                       # Preds ..B26.40
-..LN4383:
-        addl      $-8, %esp                                     #4469.22
-..LN4385:
-        movl      -52(%ebp), %eax                               #4469.41
-        movl      %eax, (%esp)                                  #4469.41
-..LN4387:
-        movl      -44(%ebp), %eax                               #4469.46
-        movl      %eax, 4(%esp)                                 #4469.46
-..LN4389:
-        call      prime_buffer_4na                              #4469.22
-                                # LOE xmm0
-..B26.52:                       # Preds ..B26.41
-        addl      $8, %esp                                      #4469.22
-        movdqa    %xmm0, -296(%ebp)                             #4469.22
-                                # LOE
-..B26.42:                       # Preds ..B26.52
-..LN4391:
-        movdqa    -296(%ebp), %xmm0                             #4469.13
-        movdqa    %xmm0, -248(%ebp)                             #4469.13
-..LN4393:
-        addl      $8, -52(%ebp)                                 #4484.13
-..LN4395:
-        movl      -52(%ebp), %eax                               #4486.17
-..LN4397:
-        movl      %eax, -40(%ebp)                               #4486.13
-        jmp       ..B26.8       # Prob 100%                     #4486.13
-                                # LOE
-..B26.43:                       # Preds ..B26.40 ..B26.39 ..B26.8
-..LN4399:
-        xorl      %eax, %eax                                    #4495.12
-        leave                                                   #4495.12
-..___tag_value_eval_4na_32.855:                                 #
-        movl      %ebx, %esp                                    #4495.12
-        popl      %ebx                                          #4495.12
-..___tag_value_eval_4na_32.856:                                 #
-        ret                                                     #4495.12
-        .align    2,0x90
-..___tag_value_eval_4na_32.858:                                 #
-                                # LOE
-# mark_end;
-	.type	eval_4na_32, at function
-	.size	eval_4na_32,.-eval_4na_32
-.LNeval_4na_32:
-	.data
-# -- End  eval_4na_32
-	.section .rodata, "a"
-	.align 4
-__$Ud:
-	.byte	101
-	.byte	118
-	.byte	97
-	.byte	108
-	.byte	95
-	.byte	52
-	.byte	110
-	.byte	97
-	.byte	95
-	.byte	54
-	.byte	52
-	.byte	0
-	.type	__$Ud, at object
-	.size	__$Ud,12
-	.text
-# -- Begin  eval_4na_64
-# mark_begin;
-       .align    2,0x90
-eval_4na_64:
-# parameter 1(self): 8 + %ebx
-# parameter 2(ncbi2na): 12 + %ebx
-# parameter 3(pos): 16 + %ebx
-# parameter 4(len): 20 + %ebx
-..B27.1:                        # Preds ..B27.0
-..___tag_value_eval_4na_64.861:                                 #
-..LN4401:
-        pushl     %ebx                                          #4501.1
-..___tag_value_eval_4na_64.866:                                 #
-        movl      %esp, %ebx                                    #4501.1
-..___tag_value_eval_4na_64.867:                                 #
-        andl      $-16, %esp                                    #4501.1
-        pushl     %ebp                                          #4501.1
-        pushl     %ebp                                          #4501.1
-        movl      4(%ebx), %ebp                                 #4501.1
-        movl      %ebp, 4(%esp)                                 #4501.1
-        movl      %esp, %ebp                                    #4501.1
-..___tag_value_eval_4na_64.869:                                 #
-        subl      $312, %esp                                    #4501.1
-        movl      %ebx, -312(%ebp)                              #4501.1
-        call      ..L871        # Prob 100%                     #4501.1
-..L871:                                                         #
-        popl      %eax                                          #4501.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L871], %eax     #4501.1
-        movl      %eax, -12(%ebp)                               #4501.1
-..LN4403:
-        movl      8(%ebx), %eax                                 #4528.25
-        movl      4(%eax), %eax                                 #4528.25
-..LN4405:
-        movl      %eax, -16(%ebp)                               #4528.23
-..LN4407:
-        movl      20(%ebx), %eax                                #4531.5
-        movl      -16(%ebp), %edx                               #4531.5
-        cmpl      %edx, %eax                                    #4531.5
-        jae       ..B27.3       # Prob 50%                      #4531.5
-                                # LOE
-..B27.2:                        # Preds ..B27.1
-        addl      $-16, %esp                                    #4531.5
-        movl      -12(%ebp), %eax                               #4531.5
-        lea       _2__STRING.9 at GOTOFF(%eax), %eax               #4531.5
-        movl      %eax, (%esp)                                  #4531.5
-        movl      -12(%ebp), %eax                               #4531.5
-        lea       _2__STRING.1 at GOTOFF(%eax), %eax               #4531.5
-        movl      %eax, 4(%esp)                                 #4531.5
-        movl      $4531, 8(%esp)                                #4531.5
-        movl      -12(%ebp), %eax                               #4531.5
-        lea       __$Ud at GOTOFF(%eax), %eax                      #4531.5
-        movl      %eax, 12(%esp)                                #4531.5
-        movl      -12(%ebp), %eax                               #4531.5
-        movl      %eax, %ebx                                    #4531.5
-..___tag_value_eval_4na_64.872:                                 #4531.5
-        call      __assert_fail at PLT                             #4531.5
-        movl      -312(%ebp), %ebx                              #4531.5
-..___tag_value_eval_4na_64.873:                                 #
-                                # LOE
-..B27.46:                       # Preds ..B27.2
-        addl      $16, %esp                                     #4531.5
-                                # LOE
-..B27.3:                        # Preds ..B27.1
-..LN4409:
-        movl      16(%ebx), %eax                                #4535.12
-..LN4411:
-        addl      20(%ebx), %eax                                #4535.5
-        movl      %eax, 20(%ebx)                                #4535.5
-..LN4413:
-        movl      16(%ebx), %eax                                #4538.42
-..LN4415:
-        shrl      $2, %eax                                      #4538.49
-..LN4417:
-        addl      12(%ebx), %eax                                #4538.30
-..LN4419:
-        movl      %eax, -52(%ebp)                               #4538.5
-..LN4421:
-        movl      -16(%ebp), %eax                               #4541.18
-        negl      %eax                                          #4541.18
-        addl      20(%ebx), %eax                                #4541.18
-..LN4423:
-        movl      %eax, -48(%ebp)                               #4541.5
-..LN4425:
-        movl      20(%ebx), %eax                                #4544.44
-..LN4427:
-        addl      $3, %eax                                      #4544.50
-..LN4429:
-        shrl      $2, %eax                                      #4544.57
-..LN4431:
-        addl      12(%ebx), %eax                                #4544.30
-..LN4433:
-        movl      %eax, -44(%ebp)                               #4544.5
-..LN4435:
-        addl      $-8, %esp                                     #4547.14
-..LN4437:
-        movl      -52(%ebp), %eax                               #4547.33
-        movl      %eax, (%esp)                                  #4547.33
-..LN4439:
-        movl      -44(%ebp), %eax                               #4547.38
-        movl      %eax, 4(%esp)                                 #4547.38
-..LN4441:
-        call      prime_buffer_4na                              #4547.14
-                                # LOE xmm0
-..B27.47:                       # Preds ..B27.3
-        addl      $8, %esp                                      #4547.14
-        movdqa    %xmm0, -104(%ebp)                             #4547.14
-                                # LOE
-..B27.4:                        # Preds ..B27.47
-..LN4443:
-        movdqa    -104(%ebp), %xmm0                             #4547.5
-        movdqa    %xmm0, -248(%ebp)                             #4547.5
-..LN4445:
-        addl      $8, -52(%ebp)                                 #4548.5
-..LN4447:
-        movl      -52(%ebp), %eax                               #4550.9
-..LN4449:
-        movl      %eax, -40(%ebp)                               #4550.5
-..LN4451:
-        movl      8(%ebx), %eax                                 #4554.5
-        movdqa    16(%eax), %xmm0                               #4554.5
-        movdqa    %xmm0, -232(%ebp)                             #4554.5
-        movl      8(%ebx), %eax                                 #4554.5
-        movdqa    32(%eax), %xmm0                               #4554.5
-        movdqa    %xmm0, -216(%ebp)                             #4554.5
-        movl      8(%ebx), %eax                                 #4554.5
-        movdqa    48(%eax), %xmm0                               #4554.5
-        movdqa    %xmm0, -200(%ebp)                             #4554.5
-        movl      8(%ebx), %eax                                 #4554.5
-        movdqa    64(%eax), %xmm0                               #4554.5
-        movdqa    %xmm0, -184(%ebp)                             #4554.5
-        movl      8(%ebx), %eax                                 #4554.5
-        movdqa    80(%eax), %xmm0                               #4554.5
-        movdqa    %xmm0, -168(%ebp)                             #4554.5
-        movl      8(%ebx), %eax                                 #4554.5
-        movdqa    96(%eax), %xmm0                               #4554.5
-        movdqa    %xmm0, -152(%ebp)                             #4554.5
-        movl      8(%ebx), %eax                                 #4554.5
-        movdqa    112(%eax), %xmm0                              #4554.5
-        movdqa    %xmm0, -136(%ebp)                             #4554.5
-        movl      8(%ebx), %eax                                 #4554.5
-        movdqa    128(%eax), %xmm0                              #4554.5
-        movdqa    %xmm0, -120(%ebp)                             #4554.5
-..LN4453:
-        xorl      %eax, %eax                                    #4557.15
-        movl      %eax, -36(%ebp)                               #4557.15
-..LN4455:
-        movl      %eax, -32(%ebp)                               #4557.10
-..LN4457:
-        movl      %eax, -28(%ebp)                               #4557.5
-..LN4459:
-        movl      $4, -24(%ebp)                                 #4563.5
-..LN4461:
-        movl      16(%ebx), %eax                                #4568.14
-..LN4463:
-        andl      $3, %eax                                      #4568.20
-        movl      %eax, -20(%ebp)                               #4568.20
-        je        ..B27.12      # Prob 50%                      #4568.20
-                                # LOE
-..B27.5:                        # Preds ..B27.4
-        movl      -20(%ebp), %eax                               #4568.20
-        cmpl      $1, %eax                                      #4568.20
-        je        ..B27.13      # Prob 50%                      #4568.20
-                                # LOE
-..B27.6:                        # Preds ..B27.5
-        movl      -20(%ebp), %eax                               #4568.20
-        cmpl      $2, %eax                                      #4568.20
-        je        ..B27.14      # Prob 50%                      #4568.20
-                                # LOE
-..B27.7:                        # Preds ..B27.6
-        movl      -20(%ebp), %eax                               #4568.20
-        cmpl      $3, %eax                                      #4568.20
-        je        ..B27.15      # Prob 50%                      #4568.20
-                                # LOE
-..B27.8:                        # Preds ..B27.42 ..B27.7
-..LN4465:
-        movl      $1, %eax                                      #4573.9
-        testl     %eax, %eax                                    #4573.9
-        je        ..B27.43      # Prob 100%                     #4573.9
-                                # LOE
-..B27.9:                        # Preds ..B27.8
-..LN4467:
-        movl      $4, -24(%ebp)                                 #4575.13
-                                # LOE
-..B27.10:                       # Preds ..B27.37 ..B27.9
-..LN4469:
-        movl      $1, %eax                                      #4578.13
-        testl     %eax, %eax                                    #4578.13
-        je        ..B27.39      # Prob 100%                     #4578.13
-                                # LOE
-..B27.12:                       # Preds ..B27.4 ..B27.10
-..LN4471:
-        movdqa    -248(%ebp), %xmm0                             #4585.38
-..LN4473:
-        movdqa    -232(%ebp), %xmm1                             #4585.46
-..LN4475:
-        pand      %xmm1, %xmm0                                  #4585.22
-..LN4477:
-        movdqa    %xmm0, -280(%ebp)                             #4585.17
-..LN4479:
-        movdqa    -248(%ebp), %xmm0                             #4586.38
-..LN4481:
-        movdqa    -216(%ebp), %xmm1                             #4586.46
-..LN4483:
-        pand      %xmm1, %xmm0                                  #4586.22
-..LN4485:
-        movdqa    %xmm0, -264(%ebp)                             #4586.17
-..LN4487:
-        movdqa    -280(%ebp), %xmm0                             #4587.22
-        movdqa    -264(%ebp), %xmm1                             #4587.22
-        pcmpeqd   %xmm1, %xmm0                                  #4587.22
-..LN4489:
-        movdqa    %xmm0, -280(%ebp)                             #4587.17
-..LN4491:
-        movdqa    -280(%ebp), %xmm0                             #4588.42
-..LN4493:
-        pmovmskb  %xmm0, %eax                                   #4588.22
-..LN4495:
-        movl      %eax, -28(%ebp)                               #4588.17
-..LN4497:
-        movl      -28(%ebp), %eax                               #4589.17
-        andl      $3855, %eax                                   #4589.17
-        shll      $4, %eax                                      #4589.17
-        andl      -28(%ebp), %eax                               #4589.17
-        movl      %eax, -28(%ebp)                               #4589.17
-        movl      -28(%ebp), %eax                               #4589.17
-        sarl      $4, %eax                                      #4589.17
-        orl       -28(%ebp), %eax                               #4589.17
-        movl      %eax, -28(%ebp)                               #4589.17
-                                # LOE
-..B27.13:                       # Preds ..B27.5 ..B27.12
-..LN4499:
-        movdqa    -248(%ebp), %xmm0                             #4592.38
-..LN4501:
-        movdqa    -200(%ebp), %xmm1                             #4592.46
-..LN4503:
-        pand      %xmm1, %xmm0                                  #4592.22
-..LN4505:
-        movdqa    %xmm0, -280(%ebp)                             #4592.17
-..LN4507:
-        movdqa    -248(%ebp), %xmm0                             #4593.38
-..LN4509:
-        movdqa    -184(%ebp), %xmm1                             #4593.46
-..LN4511:
-        pand      %xmm1, %xmm0                                  #4593.22
-..LN4513:
-        movdqa    %xmm0, -264(%ebp)                             #4593.17
-..LN4515:
-        movdqa    -280(%ebp), %xmm0                             #4594.22
-        movdqa    -264(%ebp), %xmm1                             #4594.22
-        pcmpeqd   %xmm1, %xmm0                                  #4594.22
-..LN4517:
-        movdqa    %xmm0, -280(%ebp)                             #4594.17
-..LN4519:
-        movdqa    -280(%ebp), %xmm0                             #4595.42
-..LN4521:
-        pmovmskb  %xmm0, %eax                                   #4595.22
-..LN4523:
-        movl      %eax, -32(%ebp)                               #4595.17
-..LN4525:
-        movl      -32(%ebp), %eax                               #4596.17
-        andl      $3855, %eax                                   #4596.17
-        shll      $4, %eax                                      #4596.17
-        andl      -32(%ebp), %eax                               #4596.17
-        movl      %eax, -32(%ebp)                               #4596.17
-        movl      -32(%ebp), %eax                               #4596.17
-        sarl      $4, %eax                                      #4596.17
-        orl       -32(%ebp), %eax                               #4596.17
-        movl      %eax, -32(%ebp)                               #4596.17
-                                # LOE
-..B27.14:                       # Preds ..B27.6 ..B27.13
-..LN4527:
-        movdqa    -248(%ebp), %xmm0                             #4599.38
-..LN4529:
-        movdqa    -168(%ebp), %xmm1                             #4599.46
-..LN4531:
-        pand      %xmm1, %xmm0                                  #4599.22
-..LN4533:
-        movdqa    %xmm0, -280(%ebp)                             #4599.17
-..LN4535:
-        movdqa    -248(%ebp), %xmm0                             #4600.38
-..LN4537:
-        movdqa    -152(%ebp), %xmm1                             #4600.46
-..LN4539:
-        pand      %xmm1, %xmm0                                  #4600.22
-..LN4541:
-        movdqa    %xmm0, -264(%ebp)                             #4600.17
-..LN4543:
-        movdqa    -280(%ebp), %xmm0                             #4601.22
-        movdqa    -264(%ebp), %xmm1                             #4601.22
-        pcmpeqd   %xmm1, %xmm0                                  #4601.22
-..LN4545:
-        movdqa    %xmm0, -280(%ebp)                             #4601.17
-..LN4547:
-        movdqa    -280(%ebp), %xmm0                             #4602.42
-..LN4549:
-        pmovmskb  %xmm0, %eax                                   #4602.22
-..LN4551:
-        movl      %eax, -36(%ebp)                               #4602.17
-..LN4553:
-        movl      -36(%ebp), %eax                               #4603.17
-        andl      $3855, %eax                                   #4603.17
-        shll      $4, %eax                                      #4603.17
-        andl      -36(%ebp), %eax                               #4603.17
-        movl      %eax, -36(%ebp)                               #4603.17
-        movl      -36(%ebp), %eax                               #4603.17
-        sarl      $4, %eax                                      #4603.17
-        orl       -36(%ebp), %eax                               #4603.17
-        movl      %eax, -36(%ebp)                               #4603.17
-                                # LOE
-..B27.15:                       # Preds ..B27.7 ..B27.14
-..LN4555:
-        movdqa    -248(%ebp), %xmm0                             #4606.38
-..LN4557:
-        movdqa    -136(%ebp), %xmm1                             #4606.46
-..LN4559:
-        pand      %xmm1, %xmm0                                  #4606.22
-..LN4561:
-        movdqa    %xmm0, -280(%ebp)                             #4606.17
-..LN4563:
-        movdqa    -248(%ebp), %xmm0                             #4607.38
-..LN4565:
-        movdqa    -120(%ebp), %xmm1                             #4607.46
-..LN4567:
-        pand      %xmm1, %xmm0                                  #4607.22
-..LN4569:
-        movdqa    %xmm0, -264(%ebp)                             #4607.17
-..LN4571:
-        movdqa    -280(%ebp), %xmm0                             #4608.22
-        movdqa    -264(%ebp), %xmm1                             #4608.22
-        pcmpeqd   %xmm1, %xmm0                                  #4608.22
-..LN4573:
-        movdqa    %xmm0, -280(%ebp)                             #4608.17
-..LN4575:
-        movdqa    -280(%ebp), %xmm0                             #4609.42
-..LN4577:
-        pmovmskb  %xmm0, %eax                                   #4609.22
-..LN4579:
-        movl      %eax, -56(%ebp)                               #4609.17
-..LN4581:
-        movl      -56(%ebp), %eax                               #4610.17
-        andl      $3855, %eax                                   #4610.17
-        shll      $4, %eax                                      #4610.17
-        andl      -56(%ebp), %eax                               #4610.17
-        movl      %eax, -56(%ebp)                               #4610.17
-        movl      -56(%ebp), %eax                               #4610.17
-        sarl      $4, %eax                                      #4610.17
-        orl       -56(%ebp), %eax                               #4610.17
-        movl      %eax, -56(%ebp)                               #4610.17
-..LN4583:
-        movl      16(%ebx), %eax                                #4614.17
-        andl      $-4, %eax                                     #4614.17
-        movl      %eax, 16(%ebx)                                #4614.17
-..LN4585:
-        movl      -32(%ebp), %eax                               #4617.29
-        orl       -28(%ebp), %eax                               #4617.29
-..LN4587:
-        orl       -36(%ebp), %eax                               #4617.34
-..LN4589:
-        orl       -56(%ebp), %eax                               #4617.39
-..LN4591:
-        je        ..B27.32      # Prob 50%                      #4617.47
-                                # LOE
-..B27.16:                       # Preds ..B27.15
-..LN4593:
-        pushl     %edi                                          #4635.30
-..LN4595:
-        movl      -28(%ebp), %eax                               #4635.58
-        movw      %ax, (%esp)                                   #4635.58
-..LN4597:
-        call      uint16_lsbit                                  #4635.30
-                                # LOE eax
-..B27.48:                       # Preds ..B27.16
-        popl      %ecx                                          #4635.30
-        movl      %eax, -72(%ebp)                               #4635.30
-                                # LOE
-..B27.17:                       # Preds ..B27.48
-        movl      -72(%ebp), %eax                               #4635.30
-        movswl    %ax, %eax                                     #4635.30
-..LN4599:
-        movl      %eax, -88(%ebp)                               #4635.28
-..LN4601:
-        pushl     %edi                                          #4636.30
-..LN4603:
-        movl      -32(%ebp), %eax                               #4636.58
-        movw      %ax, (%esp)                                   #4636.58
-..LN4605:
-        call      uint16_lsbit                                  #4636.30
-                                # LOE eax
-..B27.49:                       # Preds ..B27.17
-        popl      %ecx                                          #4636.30
-        movl      %eax, -68(%ebp)                               #4636.30
-                                # LOE
-..B27.18:                       # Preds ..B27.49
-        movl      -68(%ebp), %eax                               #4636.30
-        movswl    %ax, %eax                                     #4636.30
-..LN4607:
-        movl      %eax, -84(%ebp)                               #4636.28
-..LN4609:
-        pushl     %edi                                          #4637.30
-..LN4611:
-        movl      -36(%ebp), %eax                               #4637.58
-        movw      %ax, (%esp)                                   #4637.58
-..LN4613:
-        call      uint16_lsbit                                  #4637.30
-                                # LOE eax
-..B27.50:                       # Preds ..B27.18
-        popl      %ecx                                          #4637.30
-        movl      %eax, -64(%ebp)                               #4637.30
-                                # LOE
-..B27.19:                       # Preds ..B27.50
-        movl      -64(%ebp), %eax                               #4637.30
-        movswl    %ax, %eax                                     #4637.30
-..LN4615:
-        movl      %eax, -80(%ebp)                               #4637.28
-..LN4617:
-        pushl     %edi                                          #4638.30
-..LN4619:
-        movl      -56(%ebp), %eax                               #4638.58
-        movw      %ax, (%esp)                                   #4638.58
-..LN4621:
-        call      uint16_lsbit                                  #4638.30
-                                # LOE eax
-..B27.51:                       # Preds ..B27.19
-        popl      %ecx                                          #4638.30
-        movl      %eax, -60(%ebp)                               #4638.30
-                                # LOE
-..B27.20:                       # Preds ..B27.51
-        movl      -60(%ebp), %eax                               #4638.30
-        movswl    %ax, %eax                                     #4638.30
-..LN4623:
-        movl      %eax, -76(%ebp)                               #4638.28
-..LN4625:
-        movl      -88(%ebp), %eax                               #4643.28
-..LN4627:
-        addl      %eax, %eax                                    #4643.34
-..LN4629:
-        movl      %eax, -88(%ebp)                               #4643.21
-..LN4631:
-        movl      -84(%ebp), %eax                               #4644.28
-..LN4633:
-        lea       1(%eax,%eax), %eax                            #4644.40
-..LN4635:
-        movl      %eax, -84(%ebp)                               #4644.21
-..LN4637:
-        movl      -80(%ebp), %eax                               #4645.28
-..LN4639:
-        lea       2(%eax,%eax), %eax                            #4645.40
-..LN4641:
-        movl      %eax, -80(%ebp)                               #4645.21
-..LN4643:
-        movl      -76(%ebp), %eax                               #4646.28
-..LN4645:
-        lea       3(%eax,%eax), %eax                            #4646.40
-..LN4647:
-        movl      %eax, -76(%ebp)                               #4646.21
-..LN4649:
-        movl      -28(%ebp), %eax                               #4650.26
-..LN4651:
-        testl     %eax, %eax                                    #4650.32
-        je        ..B27.23      # Prob 50%                      #4650.32
-                                # LOE
-..B27.21:                       # Preds ..B27.20
-..LN4653:
-        movl      -88(%ebp), %eax                               #4650.43
-        addl      16(%ebx), %eax                                #4650.43
-..LN4655:
-        movl      -48(%ebp), %edx                               #4650.49
-        cmpl      %edx, %eax                                    #4650.49
-        ja        ..B27.23      # Prob 50%                      #4650.49
-                                # LOE
-..B27.22:                       # Preds ..B27.21
-..LN4657:
-        movl      $1, %eax                                      #4650.63
-        leave                                                   #4650.63
-..___tag_value_eval_4na_64.875:                                 #
-        movl      %ebx, %esp                                    #4650.63
-        popl      %ebx                                          #4650.63
-..___tag_value_eval_4na_64.876:                                 #
-        ret                                                     #4650.63
-..___tag_value_eval_4na_64.878:                                 #
-                                # LOE
-..B27.23:                       # Preds ..B27.21 ..B27.20
-..LN4659:
-        movl      -32(%ebp), %eax                               #4651.26
-..LN4661:
-        testl     %eax, %eax                                    #4651.32
-        je        ..B27.26      # Prob 50%                      #4651.32
-                                # LOE
-..B27.24:                       # Preds ..B27.23
-..LN4663:
-        movl      -84(%ebp), %eax                               #4651.43
-        addl      16(%ebx), %eax                                #4651.43
-..LN4665:
-        movl      -48(%ebp), %edx                               #4651.49
-        cmpl      %edx, %eax                                    #4651.49
-        ja        ..B27.26      # Prob 50%                      #4651.49
-                                # LOE
-..B27.25:                       # Preds ..B27.24
-..LN4667:
-        movl      $1, %eax                                      #4651.63
-        leave                                                   #4651.63
-..___tag_value_eval_4na_64.882:                                 #
-        movl      %ebx, %esp                                    #4651.63
-        popl      %ebx                                          #4651.63
-..___tag_value_eval_4na_64.883:                                 #
-        ret                                                     #4651.63
-..___tag_value_eval_4na_64.885:                                 #
-                                # LOE
-..B27.26:                       # Preds ..B27.24 ..B27.23
-..LN4669:
-        movl      -36(%ebp), %eax                               #4652.26
-..LN4671:
-        testl     %eax, %eax                                    #4652.32
-        je        ..B27.29      # Prob 50%                      #4652.32
-                                # LOE
-..B27.27:                       # Preds ..B27.26
-..LN4673:
-        movl      -80(%ebp), %eax                               #4652.43
-        addl      16(%ebx), %eax                                #4652.43
-..LN4675:
-        movl      -48(%ebp), %edx                               #4652.49
-        cmpl      %edx, %eax                                    #4652.49
-        ja        ..B27.29      # Prob 50%                      #4652.49
-                                # LOE
-..B27.28:                       # Preds ..B27.27
-..LN4677:
-        movl      $1, %eax                                      #4652.63
-        leave                                                   #4652.63
-..___tag_value_eval_4na_64.889:                                 #
-        movl      %ebx, %esp                                    #4652.63
-        popl      %ebx                                          #4652.63
-..___tag_value_eval_4na_64.890:                                 #
-        ret                                                     #4652.63
-..___tag_value_eval_4na_64.892:                                 #
-                                # LOE
-..B27.29:                       # Preds ..B27.27 ..B27.26
-..LN4679:
-        movl      -56(%ebp), %eax                               #4653.26
-..LN4681:
-        testl     %eax, %eax                                    #4653.32
-        je        ..B27.32      # Prob 50%                      #4653.32
-                                # LOE
-..B27.30:                       # Preds ..B27.29
-..LN4683:
-        movl      -76(%ebp), %eax                               #4653.43
-        addl      16(%ebx), %eax                                #4653.43
-..LN4685:
-        movl      -48(%ebp), %edx                               #4653.49
-        cmpl      %edx, %eax                                    #4653.49
-        ja        ..B27.32      # Prob 50%                      #4653.49
-                                # LOE
-..B27.31:                       # Preds ..B27.30
-..LN4687:
-        movl      $1, %eax                                      #4653.63
-        leave                                                   #4653.63
-..___tag_value_eval_4na_64.896:                                 #
-        movl      %ebx, %esp                                    #4653.63
-        popl      %ebx                                          #4653.63
-..___tag_value_eval_4na_64.897:                                 #
-        ret                                                     #4653.63
-..___tag_value_eval_4na_64.899:                                 #
-                                # LOE
-..B27.32:                       # Preds ..B27.30 ..B27.29 ..B27.15
-..LN4689:
-        movl      16(%ebx), %eax                                #4658.17
-        addl      $4, %eax                                      #4658.17
-        movl      %eax, 16(%ebx)                                #4658.17
-..LN4691:
-        movl      16(%ebx), %eax                                #4661.22
-..LN4693:
-        movl      -48(%ebp), %edx                               #4661.28
-        cmpl      %edx, %eax                                    #4661.28
-        jbe       ..B27.34      # Prob 50%                      #4661.28
-                                # LOE
-..B27.33:                       # Preds ..B27.32
-..LN4695:
-        xorl      %eax, %eax                                    #4662.28
-        leave                                                   #4662.28
-..___tag_value_eval_4na_64.903:                                 #
-        movl      %ebx, %esp                                    #4662.28
-        popl      %ebx                                          #4662.28
-..___tag_value_eval_4na_64.904:                                 #
-        ret                                                     #4662.28
-..___tag_value_eval_4na_64.906:                                 #
-                                # LOE
-..B27.34:                       # Preds ..B27.32
-..LN4697:
-        movl      -24(%ebp), %eax                               #4665.25
-        decl      %eax                                          #4665.25
-        movl      %eax, -24(%ebp)                               #4665.25
-..LN4699:
-        je        ..B27.39      # Prob 50%                      #4665.39
-                                # LOE
-..B27.35:                       # Preds ..B27.34
-..LN4701:
-        movdqa    -248(%ebp), %xmm0                             #4670.43
-..LN4703:
-        psrldq    $2, %xmm0                                     #4670.26
-..LN4705:
-        movdqa    %xmm0, -248(%ebp)                             #4670.17
-..LN4707:
-        movl      -40(%ebp), %eax                               #4673.22
-..LN4709:
-        movl      -44(%ebp), %edx                               #4673.26
-        cmpl      %edx, %eax                                    #4673.26
-        jae       ..B27.37      # Prob 50%                      #4673.26
-                                # LOE
-..B27.36:                       # Preds ..B27.35
-..LN4711:
-        movdqa    -248(%ebp), %xmm0                             #4674.49
-..LN4713:
-        movl      -40(%ebp), %eax                               #4674.72
-        movzbl    (%eax), %eax                                  #4674.72
-        movzbl    %al, %eax                                     #4674.72
-..LN4715:
-        movl      -12(%ebp), %edx                               #4674.57
-        movzwl    expand_2na at GOTOFF(%edx,%eax,2), %eax          #4674.57
-        movzwl    %ax, %eax                                     #4674.57
-..LN4717:
-        pinsrw    $7, %eax, %xmm0                               #4674.30
-..LN4719:
-        movdqa    %xmm0, -248(%ebp)                             #4674.21
-                                # LOE
-..B27.37:                       # Preds ..B27.36 ..B27.35
-..LN4721:
-        incl      -40(%ebp)                                     #4677.20
-        jmp       ..B27.10      # Prob 100%                     #4677.20
-                                # LOE
-..B27.39:                       # Preds ..B27.34 ..B27.10
-..LN4723:
-        movl      -52(%ebp), %eax                               #4682.18
-..LN4725:
-        movl      -44(%ebp), %edx                               #4682.25
-        cmpl      %edx, %eax                                    #4682.25
-        jae       ..B27.43      # Prob 50%                      #4682.25
-                                # LOE
-..B27.40:                       # Preds ..B27.39
-..LN4727:
-        movl      16(%ebx), %eax                                #4686.13
-        addl      $16, %eax                                     #4686.13
-        movl      %eax, 16(%ebx)                                #4686.13
-..LN4729:
-        movl      16(%ebx), %eax                                #4687.18
-..LN4731:
-        movl      -48(%ebp), %edx                               #4687.24
-        cmpl      %edx, %eax                                    #4687.24
-        ja        ..B27.43      # Prob 50%                      #4687.24
-                                # LOE
-..B27.41:                       # Preds ..B27.40
-..LN4733:
-        addl      $-8, %esp                                     #4692.22
-..LN4735:
-        movl      -52(%ebp), %eax                               #4692.41
-        movl      %eax, (%esp)                                  #4692.41
-..LN4737:
-        movl      -44(%ebp), %eax                               #4692.46
-        movl      %eax, 4(%esp)                                 #4692.46
-..LN4739:
-        call      prime_buffer_4na                              #4692.22
-                                # LOE xmm0
-..B27.52:                       # Preds ..B27.41
-        addl      $8, %esp                                      #4692.22
-        movdqa    %xmm0, -296(%ebp)                             #4692.22
-                                # LOE
-..B27.42:                       # Preds ..B27.52
-..LN4741:
-        movdqa    -296(%ebp), %xmm0                             #4692.13
-        movdqa    %xmm0, -248(%ebp)                             #4692.13
-..LN4743:
-        addl      $8, -52(%ebp)                                 #4707.13
-..LN4745:
-        movl      -52(%ebp), %eax                               #4709.17
-..LN4747:
-        movl      %eax, -40(%ebp)                               #4709.13
-        jmp       ..B27.8       # Prob 100%                     #4709.13
-                                # LOE
-..B27.43:                       # Preds ..B27.40 ..B27.39 ..B27.8
-..LN4749:
-        xorl      %eax, %eax                                    #4718.12
-        leave                                                   #4718.12
-..___tag_value_eval_4na_64.910:                                 #
-        movl      %ebx, %esp                                    #4718.12
-        popl      %ebx                                          #4718.12
-..___tag_value_eval_4na_64.911:                                 #
-        ret                                                     #4718.12
-        .align    2,0x90
-..___tag_value_eval_4na_64.913:                                 #
-                                # LOE
-# mark_end;
-	.type	eval_4na_64, at function
-	.size	eval_4na_64,.-eval_4na_64
-.LNeval_4na_64:
-	.data
-# -- End  eval_4na_64
-	.section .rodata, "a"
-	.align 4
-__$Ue:
-	.byte	101
-	.byte	118
-	.byte	97
-	.byte	108
-	.byte	95
-	.byte	52
-	.byte	110
-	.byte	97
-	.byte	95
-	.byte	49
-	.byte	50
-	.byte	56
-	.byte	0
-	.type	__$Ue, at object
-	.size	__$Ue,13
-	.text
-# -- Begin  eval_4na_128
-# mark_begin;
-       .align    2,0x90
-eval_4na_128:
-# parameter 1(self): 8 + %ebx
-# parameter 2(ncbi2na): 12 + %ebx
-# parameter 3(pos): 16 + %ebx
-# parameter 4(len): 20 + %ebx
-..B28.1:                        # Preds ..B28.0
-..___tag_value_eval_4na_128.916:                                #
-..LN4751:
-        pushl     %ebx                                          #4724.1
-..___tag_value_eval_4na_128.921:                                #
-        movl      %esp, %ebx                                    #4724.1
-..___tag_value_eval_4na_128.922:                                #
-        andl      $-16, %esp                                    #4724.1
-        pushl     %ebp                                          #4724.1
-        pushl     %ebp                                          #4724.1
-        movl      4(%ebx), %ebp                                 #4724.1
-        movl      %ebp, 4(%esp)                                 #4724.1
-        movl      %esp, %ebp                                    #4724.1
-..___tag_value_eval_4na_128.924:                                #
-        subl      $280, %esp                                    #4724.1
-        movl      %ebx, -280(%ebp)                              #4724.1
-        call      ..L926        # Prob 100%                     #4724.1
-..L926:                                                         #
-        popl      %eax                                          #4724.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L926], %eax     #4724.1
-        movl      %eax, -8(%ebp)                                #4724.1
-..LN4753:
-        movl      8(%ebx), %eax                                 #4750.25
-        movl      4(%eax), %eax                                 #4750.25
-..LN4755:
-        movl      %eax, -12(%ebp)                               #4750.23
-..LN4757:
-        movl      20(%ebx), %eax                                #4753.5
-        movl      -12(%ebp), %edx                               #4753.5
-        cmpl      %edx, %eax                                    #4753.5
-        jae       ..B28.3       # Prob 50%                      #4753.5
-                                # LOE
-..B28.2:                        # Preds ..B28.1
-        addl      $-16, %esp                                    #4753.5
-        movl      -8(%ebp), %eax                                #4753.5
-        lea       _2__STRING.9 at GOTOFF(%eax), %eax               #4753.5
-        movl      %eax, (%esp)                                  #4753.5
-        movl      -8(%ebp), %eax                                #4753.5
-        lea       _2__STRING.1 at GOTOFF(%eax), %eax               #4753.5
-        movl      %eax, 4(%esp)                                 #4753.5
-        movl      $4753, 8(%esp)                                #4753.5
-        movl      -8(%ebp), %eax                                #4753.5
-        lea       __$Ue at GOTOFF(%eax), %eax                      #4753.5
-        movl      %eax, 12(%esp)                                #4753.5
-        movl      -8(%ebp), %eax                                #4753.5
-        movl      %eax, %ebx                                    #4753.5
-..___tag_value_eval_4na_128.927:                                #4753.5
-        call      __assert_fail at PLT                             #4753.5
-        movl      -280(%ebp), %ebx                              #4753.5
-..___tag_value_eval_4na_128.928:                                #
-                                # LOE
-..B28.41:                       # Preds ..B28.2
-        addl      $16, %esp                                     #4753.5
-                                # LOE
-..B28.3:                        # Preds ..B28.1
-..LN4759:
-        movl      16(%ebx), %eax                                #4757.12
-..LN4761:
-        addl      20(%ebx), %eax                                #4757.5
-        movl      %eax, 20(%ebx)                                #4757.5
-..LN4763:
-        movl      16(%ebx), %eax                                #4760.42
-..LN4765:
-        shrl      $2, %eax                                      #4760.49
-..LN4767:
-        addl      12(%ebx), %eax                                #4760.30
-..LN4769:
-        movl      %eax, -48(%ebp)                               #4760.5
-..LN4771:
-        movl      -12(%ebp), %eax                               #4763.18
-        negl      %eax                                          #4763.18
-        addl      20(%ebx), %eax                                #4763.18
-..LN4773:
-        movl      %eax, -44(%ebp)                               #4763.5
-..LN4775:
-        movl      20(%ebx), %eax                                #4766.44
-..LN4777:
-        addl      $3, %eax                                      #4766.50
-..LN4779:
-        shrl      $2, %eax                                      #4766.57
-..LN4781:
-        addl      12(%ebx), %eax                                #4766.30
-..LN4783:
-        movl      %eax, -40(%ebp)                               #4766.5
-..LN4785:
-        addl      $-8, %esp                                     #4769.14
-..LN4787:
-        movl      -48(%ebp), %eax                               #4769.33
-        movl      %eax, (%esp)                                  #4769.33
-..LN4789:
-        movl      -40(%ebp), %eax                               #4769.38
-        movl      %eax, 4(%esp)                                 #4769.38
-..LN4791:
-        call      prime_buffer_4na                              #4769.14
-                                # LOE xmm0
-..B28.42:                       # Preds ..B28.3
-        addl      $8, %esp                                      #4769.14
-        movdqa    %xmm0, -72(%ebp)                              #4769.14
-                                # LOE
-..B28.4:                        # Preds ..B28.42
-..LN4793:
-        movdqa    -72(%ebp), %xmm0                              #4769.5
-        movdqa    %xmm0, -216(%ebp)                             #4769.5
-..LN4795:
-        addl      $8, -48(%ebp)                                 #4770.5
-..LN4797:
-        movl      -48(%ebp), %eax                               #4772.9
-..LN4799:
-        movl      %eax, -36(%ebp)                               #4772.5
-..LN4801:
-        movl      8(%ebx), %eax                                 #4776.5
-        movdqa    16(%eax), %xmm0                               #4776.5
-        movdqa    %xmm0, -200(%ebp)                             #4776.5
-        movl      8(%ebx), %eax                                 #4776.5
-        movdqa    32(%eax), %xmm0                               #4776.5
-        movdqa    %xmm0, -184(%ebp)                             #4776.5
-        movl      8(%ebx), %eax                                 #4776.5
-        movdqa    48(%eax), %xmm0                               #4776.5
-        movdqa    %xmm0, -168(%ebp)                             #4776.5
-        movl      8(%ebx), %eax                                 #4776.5
-        movdqa    64(%eax), %xmm0                               #4776.5
-        movdqa    %xmm0, -152(%ebp)                             #4776.5
-        movl      8(%ebx), %eax                                 #4776.5
-        movdqa    80(%eax), %xmm0                               #4776.5
-        movdqa    %xmm0, -136(%ebp)                             #4776.5
-        movl      8(%ebx), %eax                                 #4776.5
-        movdqa    96(%eax), %xmm0                               #4776.5
-        movdqa    %xmm0, -120(%ebp)                             #4776.5
-        movl      8(%ebx), %eax                                 #4776.5
-        movdqa    112(%eax), %xmm0                              #4776.5
-        movdqa    %xmm0, -104(%ebp)                             #4776.5
-        movl      8(%ebx), %eax                                 #4776.5
-        movdqa    128(%eax), %xmm0                              #4776.5
-        movdqa    %xmm0, -88(%ebp)                              #4776.5
-..LN4803:
-        xorl      %eax, %eax                                    #4779.15
-        movl      %eax, -32(%ebp)                               #4779.15
-..LN4805:
-        movl      %eax, -28(%ebp)                               #4779.10
-..LN4807:
-        movl      %eax, -24(%ebp)                               #4779.5
-..LN4809:
-        movl      16(%ebx), %eax                                #4781.27
-        negl      %eax                                          #4781.27
-..LN4811:
-        movl      -44(%ebp), %edx                               #4781.20
-..LN4813:
-        lea       7(%edx,%eax), %eax                            #4781.33
-..LN4815:
-        shrl      $2, %eax                                      #4781.40
-..LN4817:
-        movl      %eax, -20(%ebp)                               #4781.5
-..LN4819:
-        movl      16(%ebx), %eax                                #4790.14
-..LN4821:
-        andl      $3, %eax                                      #4790.20
-        movl      %eax, -16(%ebp)                               #4790.20
-        je        ..B28.12      # Prob 50%                      #4790.20
-                                # LOE
-..B28.5:                        # Preds ..B28.4
-        movl      -16(%ebp), %eax                               #4790.20
-        cmpl      $1, %eax                                      #4790.20
-        je        ..B28.13      # Prob 50%                      #4790.20
-                                # LOE
-..B28.6:                        # Preds ..B28.5
-        movl      -16(%ebp), %eax                               #4790.20
-        cmpl      $2, %eax                                      #4790.20
-        je        ..B28.14      # Prob 50%                      #4790.20
-                                # LOE
-..B28.7:                        # Preds ..B28.6
-        movl      -16(%ebp), %eax                               #4790.20
-        cmpl      $3, %eax                                      #4790.20
-        je        ..B28.15      # Prob 50%                      #4790.20
-                                # LOE
-..B28.8:                        # Preds ..B28.37 ..B28.7
-..LN4823:
-        movl      $1, %eax                                      #4795.9
-        testl     %eax, %eax                                    #4795.9
-        je        ..B28.38      # Prob 100%                     #4795.9
-                                # LOE
-..B28.9:                        # Preds ..B28.8
-..LN4825:
-        movl      $8, -20(%ebp)                                 #4797.13
-                                # LOE
-..B28.10:                       # Preds ..B28.32 ..B28.9
-..LN4827:
-        movl      $1, %eax                                      #4800.13
-        testl     %eax, %eax                                    #4800.13
-        je        ..B28.34      # Prob 100%                     #4800.13
-                                # LOE
-..B28.12:                       # Preds ..B28.4 ..B28.10
-..LN4829:
-        movdqa    -216(%ebp), %xmm0                             #4807.38
-..LN4831:
-        movdqa    -200(%ebp), %xmm1                             #4807.46
-..LN4833:
-        pand      %xmm1, %xmm0                                  #4807.22
-..LN4835:
-        movdqa    %xmm0, -248(%ebp)                             #4807.17
-..LN4837:
-        movdqa    -216(%ebp), %xmm0                             #4808.38
-..LN4839:
-        movdqa    -184(%ebp), %xmm1                             #4808.46
-..LN4841:
-        pand      %xmm1, %xmm0                                  #4808.22
-..LN4843:
-        movdqa    %xmm0, -232(%ebp)                             #4808.17
-..LN4845:
-        movdqa    -248(%ebp), %xmm0                             #4809.22
-        movdqa    -232(%ebp), %xmm1                             #4809.22
-        pcmpeqd   %xmm1, %xmm0                                  #4809.22
-..LN4847:
-        movdqa    %xmm0, -248(%ebp)                             #4809.17
-..LN4849:
-        movdqa    -248(%ebp), %xmm0                             #4810.42
-..LN4851:
-        pmovmskb  %xmm0, %eax                                   #4810.22
-..LN4853:
-        movl      %eax, -24(%ebp)                               #4810.17
-..LN4855:
-        movl      -24(%ebp), %eax                               #4811.17
-        incl      %eax                                          #4811.17
-        sarl      $16, %eax                                     #4811.17
-        negl      %eax                                          #4811.17
-        movl      %eax, -24(%ebp)                               #4811.17
-                                # LOE
-..B28.13:                       # Preds ..B28.5 ..B28.12
-..LN4857:
-        movdqa    -216(%ebp), %xmm0                             #4814.38
-..LN4859:
-        movdqa    -168(%ebp), %xmm1                             #4814.46
-..LN4861:
-        pand      %xmm1, %xmm0                                  #4814.22
-..LN4863:
-        movdqa    %xmm0, -248(%ebp)                             #4814.17
-..LN4865:
-        movdqa    -216(%ebp), %xmm0                             #4815.38
-..LN4867:
-        movdqa    -152(%ebp), %xmm1                             #4815.46
-..LN4869:
-        pand      %xmm1, %xmm0                                  #4815.22
-..LN4871:
-        movdqa    %xmm0, -232(%ebp)                             #4815.17
-..LN4873:
-        movdqa    -248(%ebp), %xmm0                             #4816.22
-        movdqa    -232(%ebp), %xmm1                             #4816.22
-        pcmpeqd   %xmm1, %xmm0                                  #4816.22
-..LN4875:
-        movdqa    %xmm0, -248(%ebp)                             #4816.17
-..LN4877:
-        movdqa    -248(%ebp), %xmm0                             #4817.42
-..LN4879:
-        pmovmskb  %xmm0, %eax                                   #4817.22
-..LN4881:
-        movl      %eax, -28(%ebp)                               #4817.17
-..LN4883:
-        movl      -28(%ebp), %eax                               #4818.17
-        incl      %eax                                          #4818.17
-        sarl      $16, %eax                                     #4818.17
-        negl      %eax                                          #4818.17
-        movl      %eax, -28(%ebp)                               #4818.17
-                                # LOE
-..B28.14:                       # Preds ..B28.6 ..B28.13
-..LN4885:
-        movdqa    -216(%ebp), %xmm0                             #4821.38
-..LN4887:
-        movdqa    -136(%ebp), %xmm1                             #4821.46
-..LN4889:
-        pand      %xmm1, %xmm0                                  #4821.22
-..LN4891:
-        movdqa    %xmm0, -248(%ebp)                             #4821.17
-..LN4893:
-        movdqa    -216(%ebp), %xmm0                             #4822.38
-..LN4895:
-        movdqa    -120(%ebp), %xmm1                             #4822.46
-..LN4897:
-        pand      %xmm1, %xmm0                                  #4822.22
-..LN4899:
-        movdqa    %xmm0, -232(%ebp)                             #4822.17
-..LN4901:
-        movdqa    -248(%ebp), %xmm0                             #4823.22
-        movdqa    -232(%ebp), %xmm1                             #4823.22
-        pcmpeqd   %xmm1, %xmm0                                  #4823.22
-..LN4903:
-        movdqa    %xmm0, -248(%ebp)                             #4823.17
-..LN4905:
-        movdqa    -248(%ebp), %xmm0                             #4824.42
-..LN4907:
-        pmovmskb  %xmm0, %eax                                   #4824.22
-..LN4909:
-        movl      %eax, -32(%ebp)                               #4824.17
-..LN4911:
-        movl      -32(%ebp), %eax                               #4825.17
-        incl      %eax                                          #4825.17
-        sarl      $16, %eax                                     #4825.17
-        negl      %eax                                          #4825.17
-        movl      %eax, -32(%ebp)                               #4825.17
-                                # LOE
-..B28.15:                       # Preds ..B28.7 ..B28.14
-..LN4913:
-        movdqa    -216(%ebp), %xmm0                             #4828.38
-..LN4915:
-        movdqa    -104(%ebp), %xmm1                             #4828.46
-..LN4917:
-        pand      %xmm1, %xmm0                                  #4828.22
-..LN4919:
-        movdqa    %xmm0, -248(%ebp)                             #4828.17
-..LN4921:
-        movdqa    -216(%ebp), %xmm0                             #4829.38
-..LN4923:
-        movdqa    -88(%ebp), %xmm1                              #4829.46
-..LN4925:
-        pand      %xmm1, %xmm0                                  #4829.22
-..LN4927:
-        movdqa    %xmm0, -232(%ebp)                             #4829.17
-..LN4929:
-        movdqa    -248(%ebp), %xmm0                             #4830.22
-        movdqa    -232(%ebp), %xmm1                             #4830.22
-        pcmpeqd   %xmm1, %xmm0                                  #4830.22
-..LN4931:
-        movdqa    %xmm0, -248(%ebp)                             #4830.17
-..LN4933:
-        movdqa    -248(%ebp), %xmm0                             #4831.42
-..LN4935:
-        pmovmskb  %xmm0, %eax                                   #4831.22
-..LN4937:
-        movl      %eax, -52(%ebp)                               #4831.17
-..LN4939:
-        movl      -52(%ebp), %eax                               #4832.17
-        incl      %eax                                          #4832.17
-        sarl      $16, %eax                                     #4832.17
-        negl      %eax                                          #4832.17
-        movl      %eax, -52(%ebp)                               #4832.17
-..LN4941:
-        movl      16(%ebx), %eax                                #4836.17
-        andl      $-4, %eax                                     #4836.17
-        movl      %eax, 16(%ebx)                                #4836.17
-..LN4943:
-        movl      -28(%ebp), %eax                               #4839.29
-        orl       -24(%ebp), %eax                               #4839.29
-..LN4945:
-        orl       -32(%ebp), %eax                               #4839.34
-..LN4947:
-        orl       -52(%ebp), %eax                               #4839.39
-..LN4949:
-        je        ..B28.27      # Prob 50%                      #4839.47
-                                # LOE
-..B28.16:                       # Preds ..B28.15
-..LN4951:
-        movl      16(%ebx), %eax                                #4842.37
-        negl      %eax                                          #4842.37
-        addl      -44(%ebp), %eax                               #4842.37
-        movl      %eax, -56(%ebp)                               #4842.37
-        cmpl      $2, %eax                                      #4842.37
-        je        ..B28.20      # Prob 50%                      #4842.37
-                                # LOE
-..B28.17:                       # Preds ..B28.16
-        movl      -56(%ebp), %eax                               #4842.37
-        cmpl      $1, %eax                                      #4842.37
-        je        ..B28.22      # Prob 50%                      #4842.37
-                                # LOE
-..B28.18:                       # Preds ..B28.17
-        movl      -56(%ebp), %eax                               #4842.37
-        testl     %eax, %eax                                    #4842.37
-        je        ..B28.24      # Prob 50%                      #4842.37
-                                # LOE
-..B28.19:                       # Preds ..B28.18
-..LN4953:
-        movl      $1, %eax                                      #4845.32
-        leave                                                   #4845.32
-..___tag_value_eval_4na_128.930:                                #
-        movl      %ebx, %esp                                    #4845.32
-        popl      %ebx                                          #4845.32
-..___tag_value_eval_4na_128.931:                                #
-        ret                                                     #4845.32
-..___tag_value_eval_4na_128.933:                                #
-                                # LOE
-..B28.20:                       # Preds ..B28.16
-..LN4955:
-        movl      -32(%ebp), %eax                               #4847.30
-..LN4957:
-        testl     %eax, %eax                                    #4847.36
-        je        ..B28.22      # Prob 50%                      #4847.36
-                                # LOE
-..B28.21:                       # Preds ..B28.20
-..LN4959:
-        movl      $1, %eax                                      #4847.47
-        leave                                                   #4847.47
-..___tag_value_eval_4na_128.937:                                #
-        movl      %ebx, %esp                                    #4847.47
-        popl      %ebx                                          #4847.47
-..___tag_value_eval_4na_128.938:                                #
-        ret                                                     #4847.47
-..___tag_value_eval_4na_128.940:                                #
-                                # LOE
-..B28.22:                       # Preds ..B28.20 ..B28.17
-..LN4961:
-        movl      -28(%ebp), %eax                               #4849.30
-..LN4963:
-        testl     %eax, %eax                                    #4849.36
-        je        ..B28.24      # Prob 50%                      #4849.36
-                                # LOE
-..B28.23:                       # Preds ..B28.22
-..LN4965:
-        movl      $1, %eax                                      #4849.47
-        leave                                                   #4849.47
-..___tag_value_eval_4na_128.944:                                #
-        movl      %ebx, %esp                                    #4849.47
-        popl      %ebx                                          #4849.47
-..___tag_value_eval_4na_128.945:                                #
-        ret                                                     #4849.47
-..___tag_value_eval_4na_128.947:                                #
-                                # LOE
-..B28.24:                       # Preds ..B28.22 ..B28.18
-..LN4967:
-        movl      -24(%ebp), %eax                               #4851.30
-..LN4969:
-        testl     %eax, %eax                                    #4851.36
-        je        ..B28.26      # Prob 50%                      #4851.36
-                                # LOE
-..B28.25:                       # Preds ..B28.24
-..LN4971:
-        movl      $1, %eax                                      #4851.47
-        leave                                                   #4851.47
-..___tag_value_eval_4na_128.951:                                #
-        movl      %ebx, %esp                                    #4851.47
-        popl      %ebx                                          #4851.47
-..___tag_value_eval_4na_128.952:                                #
-        ret                                                     #4851.47
-..___tag_value_eval_4na_128.954:                                #
-                                # LOE
-..B28.26:                       # Preds ..B28.24
-..LN4973:
-        xorl      %eax, %eax                                    #4853.28
-        leave                                                   #4853.28
-..___tag_value_eval_4na_128.958:                                #
-        movl      %ebx, %esp                                    #4853.28
-        popl      %ebx                                          #4853.28
-..___tag_value_eval_4na_128.959:                                #
-        ret                                                     #4853.28
-..___tag_value_eval_4na_128.961:                                #
-                                # LOE
-..B28.27:                       # Preds ..B28.15
-..LN4975:
-        movl      16(%ebx), %eax                                #4880.17
-        addl      $4, %eax                                      #4880.17
-        movl      %eax, 16(%ebx)                                #4880.17
-..LN4977:
-        movl      16(%ebx), %eax                                #4883.22
-..LN4979:
-        movl      -44(%ebp), %edx                               #4883.28
-        cmpl      %edx, %eax                                    #4883.28
-        jbe       ..B28.29      # Prob 50%                      #4883.28
-                                # LOE
-..B28.28:                       # Preds ..B28.27
-..LN4981:
-        xorl      %eax, %eax                                    #4884.28
-        leave                                                   #4884.28
-..___tag_value_eval_4na_128.965:                                #
-        movl      %ebx, %esp                                    #4884.28
-        popl      %ebx                                          #4884.28
-..___tag_value_eval_4na_128.966:                                #
-        ret                                                     #4884.28
-..___tag_value_eval_4na_128.968:                                #
-                                # LOE
-..B28.29:                       # Preds ..B28.27
-..LN4983:
-        movl      -20(%ebp), %eax                               #4887.25
-        decl      %eax                                          #4887.25
-        movl      %eax, -20(%ebp)                               #4887.25
-..LN4985:
-        je        ..B28.34      # Prob 50%                      #4887.39
-                                # LOE
-..B28.30:                       # Preds ..B28.29
-..LN4987:
-        movdqa    -216(%ebp), %xmm0                             #4892.43
-..LN4989:
-        psrldq    $2, %xmm0                                     #4892.26
-..LN4991:
-        movdqa    %xmm0, -216(%ebp)                             #4892.17
-..LN4993:
-        movl      -36(%ebp), %eax                               #4895.22
-..LN4995:
-        movl      -40(%ebp), %edx                               #4895.26
-        cmpl      %edx, %eax                                    #4895.26
-        jae       ..B28.32      # Prob 50%                      #4895.26
-                                # LOE
-..B28.31:                       # Preds ..B28.30
-..LN4997:
-        movdqa    -216(%ebp), %xmm0                             #4896.49
-..LN4999:
-        movl      -36(%ebp), %eax                               #4896.72
-        movzbl    (%eax), %eax                                  #4896.72
-        movzbl    %al, %eax                                     #4896.72
-..LN5001:
-        movl      -8(%ebp), %edx                                #4896.57
-        movzwl    expand_2na at GOTOFF(%edx,%eax,2), %eax          #4896.57
-        movzwl    %ax, %eax                                     #4896.57
-..LN5003:
-        pinsrw    $7, %eax, %xmm0                               #4896.30
-..LN5005:
-        movdqa    %xmm0, -216(%ebp)                             #4896.21
-                                # LOE
-..B28.32:                       # Preds ..B28.31 ..B28.30
-..LN5007:
-        incl      -36(%ebp)                                     #4899.20
-        jmp       ..B28.10      # Prob 100%                     #4899.20
-                                # LOE
-..B28.34:                       # Preds ..B28.29 ..B28.10
-..LN5009:
-        movl      -48(%ebp), %eax                               #4904.18
-..LN5011:
-        movl      -40(%ebp), %edx                               #4904.25
-        cmpl      %edx, %eax                                    #4904.25
-        jae       ..B28.38      # Prob 50%                      #4904.25
-                                # LOE
-..B28.35:                       # Preds ..B28.34
-..LN5013:
-        movl      16(%ebx), %eax                                #4909.18
-..LN5015:
-        movl      -44(%ebp), %edx                               #4909.24
-        cmpl      %edx, %eax                                    #4909.24
-        ja        ..B28.38      # Prob 50%                      #4909.24
-                                # LOE
-..B28.36:                       # Preds ..B28.35
-..LN5017:
-        addl      $-8, %esp                                     #4914.22
-..LN5019:
-        movl      -48(%ebp), %eax                               #4914.41
-        movl      %eax, (%esp)                                  #4914.41
-..LN5021:
-        movl      -40(%ebp), %eax                               #4914.46
-        movl      %eax, 4(%esp)                                 #4914.46
-..LN5023:
-        call      prime_buffer_4na                              #4914.22
-                                # LOE xmm0
-..B28.43:                       # Preds ..B28.36
-        addl      $8, %esp                                      #4914.22
-        movdqa    %xmm0, -264(%ebp)                             #4914.22
-                                # LOE
-..B28.37:                       # Preds ..B28.43
-..LN5025:
-        movdqa    -264(%ebp), %xmm0                             #4914.13
-        movdqa    %xmm0, -216(%ebp)                             #4914.13
-..LN5027:
-        addl      $8, -48(%ebp)                                 #4929.13
-..LN5029:
-        movl      -48(%ebp), %eax                               #4931.17
-..LN5031:
-        movl      %eax, -36(%ebp)                               #4931.13
-        jmp       ..B28.8       # Prob 100%                     #4931.13
-                                # LOE
-..B28.38:                       # Preds ..B28.35 ..B28.34 ..B28.8
-..LN5033:
-        xorl      %eax, %eax                                    #4940.12
-        leave                                                   #4940.12
-..___tag_value_eval_4na_128.972:                                #
-        movl      %ebx, %esp                                    #4940.12
-        popl      %ebx                                          #4940.12
-..___tag_value_eval_4na_128.973:                                #
-        ret                                                     #4940.12
-        .align    2,0x90
-..___tag_value_eval_4na_128.975:                                #
-                                # LOE
-# mark_end;
-	.type	eval_4na_128, at function
-	.size	eval_4na_128,.-eval_4na_128
-.LNeval_4na_128:
-	.data
-# -- End  eval_4na_128
-	.section .rodata, "a"
-	.align 4
-__$Uf:
-	.byte	101
-	.byte	118
-	.byte	97
-	.byte	108
-	.byte	95
-	.byte	52
-	.byte	110
-	.byte	97
-	.byte	95
-	.byte	112
-	.byte	111
-	.byte	115
-	.byte	0
-	.type	__$Uf, at object
-	.size	__$Uf,13
-	.text
-# -- Begin  eval_4na_pos
-# mark_begin;
-       .align    2,0x90
-eval_4na_pos:
-# parameter 1(self): 8 + %ebx
-# parameter 2(ncbi2na): 12 + %ebx
-# parameter 3(pos): 16 + %ebx
-# parameter 4(len): 20 + %ebx
-..B29.1:                        # Preds ..B29.0
-..___tag_value_eval_4na_pos.978:                                #
-..LN5035:
-        pushl     %ebx                                          #4946.1
-..___tag_value_eval_4na_pos.983:                                #
-        movl      %esp, %ebx                                    #4946.1
-..___tag_value_eval_4na_pos.984:                                #
-        andl      $-16, %esp                                    #4946.1
-        pushl     %ebp                                          #4946.1
-        pushl     %ebp                                          #4946.1
-        movl      4(%ebx), %ebp                                 #4946.1
-        movl      %ebp, 4(%esp)                                 #4946.1
-        movl      %esp, %ebp                                    #4946.1
-..___tag_value_eval_4na_pos.986:                                #
-        subl      $280, %esp                                    #4946.1
-        movl      %ebx, -280(%ebp)                              #4946.1
-        call      ..L988        # Prob 100%                     #4946.1
-..L988:                                                         #
-        popl      %eax                                          #4946.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L988], %eax     #4946.1
-        movl      %eax, -4(%ebp)                                #4946.1
-..LN5037:
-        movl      8(%ebx), %eax                                 #4978.25
-        movl      4(%eax), %eax                                 #4978.25
-..LN5039:
-        movl      %eax, -8(%ebp)                                #4978.23
-..LN5041:
-        movl      20(%ebx), %eax                                #4981.5
-        movl      -8(%ebp), %edx                                #4981.5
-        cmpl      %edx, %eax                                    #4981.5
-        jae       ..B29.3       # Prob 50%                      #4981.5
-                                # LOE
-..B29.2:                        # Preds ..B29.1
-        addl      $-16, %esp                                    #4981.5
-        movl      -4(%ebp), %eax                                #4981.5
-        lea       _2__STRING.9 at GOTOFF(%eax), %eax               #4981.5
-        movl      %eax, (%esp)                                  #4981.5
-        movl      -4(%ebp), %eax                                #4981.5
-        lea       _2__STRING.1 at GOTOFF(%eax), %eax               #4981.5
-        movl      %eax, 4(%esp)                                 #4981.5
-        movl      $4981, 8(%esp)                                #4981.5
-        movl      -4(%ebp), %eax                                #4981.5
-        lea       __$Uf at GOTOFF(%eax), %eax                      #4981.5
-        movl      %eax, 12(%esp)                                #4981.5
-        movl      -4(%ebp), %eax                                #4981.5
-        movl      %eax, %ebx                                    #4981.5
-..___tag_value_eval_4na_pos.989:                                #4981.5
-        call      __assert_fail at PLT                             #4981.5
-        movl      -280(%ebp), %ebx                              #4981.5
-..___tag_value_eval_4na_pos.990:                                #
-                                # LOE
-..B29.54:                       # Preds ..B29.2
-        addl      $16, %esp                                     #4981.5
-                                # LOE
-..B29.3:                        # Preds ..B29.1
-..LN5043:
-        movl      16(%ebx), %eax                                #4985.12
-..LN5045:
-        addl      20(%ebx), %eax                                #4985.5
-        movl      %eax, 20(%ebx)                                #4985.5
-..LN5047:
-        movl      16(%ebx), %eax                                #4989.13
-..LN5049:
-        movl      %eax, -48(%ebp)                               #4989.5
-..LN5051:
-        movl      16(%ebx), %eax                                #4993.42
-..LN5053:
-        shrl      $2, %eax                                      #4993.49
-..LN5055:
-        addl      12(%ebx), %eax                                #4993.30
-..LN5057:
-        movl      %eax, -44(%ebp)                               #4993.5
-..LN5059:
-        movl      -8(%ebp), %eax                                #4996.18
-        negl      %eax                                          #4996.18
-        addl      20(%ebx), %eax                                #4996.18
-..LN5061:
-        movl      %eax, -40(%ebp)                               #4996.5
-..LN5063:
-        movl      20(%ebx), %eax                                #4999.44
-..LN5065:
-        addl      $3, %eax                                      #4999.50
-..LN5067:
-        shrl      $2, %eax                                      #4999.57
-..LN5069:
-        addl      12(%ebx), %eax                                #4999.30
-..LN5071:
-        movl      %eax, -36(%ebp)                               #4999.5
-..LN5073:
-        addl      $-8, %esp                                     #5002.14
-..LN5075:
-        movl      -44(%ebp), %eax                               #5002.33
-        movl      %eax, (%esp)                                  #5002.33
-..LN5077:
-        movl      -36(%ebp), %eax                               #5002.38
-        movl      %eax, 4(%esp)                                 #5002.38
-..LN5079:
-        call      prime_buffer_4na                              #5002.14
-                                # LOE xmm0
-..B29.55:                       # Preds ..B29.3
-        addl      $8, %esp                                      #5002.14
-        movdqa    %xmm0, -72(%ebp)                              #5002.14
-                                # LOE
-..B29.4:                        # Preds ..B29.55
-..LN5081:
-        movdqa    -72(%ebp), %xmm0                              #5002.5
-        movdqa    %xmm0, -216(%ebp)                             #5002.5
-..LN5083:
-        addl      $8, -44(%ebp)                                 #5003.5
-..LN5085:
-        movl      -44(%ebp), %eax                               #5005.9
-..LN5087:
-        movl      %eax, -32(%ebp)                               #5005.5
-..LN5089:
-        movl      8(%ebx), %eax                                 #5009.5
-        movdqa    16(%eax), %xmm0                               #5009.5
-        movdqa    %xmm0, -200(%ebp)                             #5009.5
-        movl      8(%ebx), %eax                                 #5009.5
-        movdqa    32(%eax), %xmm0                               #5009.5
-        movdqa    %xmm0, -184(%ebp)                             #5009.5
-        movl      8(%ebx), %eax                                 #5009.5
-        movdqa    48(%eax), %xmm0                               #5009.5
-        movdqa    %xmm0, -168(%ebp)                             #5009.5
-        movl      8(%ebx), %eax                                 #5009.5
-        movdqa    64(%eax), %xmm0                               #5009.5
-        movdqa    %xmm0, -152(%ebp)                             #5009.5
-        movl      8(%ebx), %eax                                 #5009.5
-        movdqa    80(%eax), %xmm0                               #5009.5
-        movdqa    %xmm0, -136(%ebp)                             #5009.5
-        movl      8(%ebx), %eax                                 #5009.5
-        movdqa    96(%eax), %xmm0                               #5009.5
-        movdqa    %xmm0, -120(%ebp)                             #5009.5
-        movl      8(%ebx), %eax                                 #5009.5
-        movdqa    112(%eax), %xmm0                              #5009.5
-        movdqa    %xmm0, -104(%ebp)                             #5009.5
-        movl      8(%ebx), %eax                                 #5009.5
-        movdqa    128(%eax), %xmm0                              #5009.5
-        movdqa    %xmm0, -88(%ebp)                              #5009.5
-..LN5091:
-        xorl      %eax, %eax                                    #5012.15
-        movl      %eax, -28(%ebp)                               #5012.15
-..LN5093:
-        movl      %eax, -24(%ebp)                               #5012.10
-..LN5095:
-        movl      %eax, -20(%ebp)                               #5012.5
-..LN5097:
-        movl      16(%ebx), %eax                                #5014.27
-        negl      %eax                                          #5014.27
-..LN5099:
-        movl      -40(%ebp), %edx                               #5014.20
-..LN5101:
-        lea       7(%edx,%eax), %eax                            #5014.33
-..LN5103:
-        shrl      $2, %eax                                      #5014.40
-..LN5105:
-        movl      %eax, -16(%ebp)                               #5014.5
-..LN5107:
-        movl      16(%ebx), %eax                                #5023.14
-..LN5109:
-        andl      $3, %eax                                      #5023.20
-        movl      %eax, -12(%ebp)                               #5023.20
-        je        ..B29.12      # Prob 50%                      #5023.20
-                                # LOE
-..B29.5:                        # Preds ..B29.4
-        movl      -12(%ebp), %eax                               #5023.20
-        cmpl      $1, %eax                                      #5023.20
-        je        ..B29.13      # Prob 50%                      #5023.20
-                                # LOE
-..B29.6:                        # Preds ..B29.5
-        movl      -12(%ebp), %eax                               #5023.20
-        cmpl      $2, %eax                                      #5023.20
-        je        ..B29.14      # Prob 50%                      #5023.20
-                                # LOE
-..B29.7:                        # Preds ..B29.6
-        movl      -12(%ebp), %eax                               #5023.20
-        cmpl      $3, %eax                                      #5023.20
-        je        ..B29.15      # Prob 50%                      #5023.20
-                                # LOE
-..B29.8:                        # Preds ..B29.50 ..B29.7
-..LN5111:
-        movl      $1, %eax                                      #5028.9
-        testl     %eax, %eax                                    #5028.9
-        je        ..B29.51      # Prob 100%                     #5028.9
-                                # LOE
-..B29.9:                        # Preds ..B29.8
-..LN5113:
-        movl      $8, -16(%ebp)                                 #5030.13
-                                # LOE
-..B29.10:                       # Preds ..B29.45 ..B29.9
-..LN5115:
-        movl      $1, %eax                                      #5033.13
-        testl     %eax, %eax                                    #5033.13
-        je        ..B29.47      # Prob 100%                     #5033.13
-                                # LOE
-..B29.12:                       # Preds ..B29.4 ..B29.10
-..LN5117:
-        movdqa    -216(%ebp), %xmm0                             #5040.38
-..LN5119:
-        movdqa    -200(%ebp), %xmm1                             #5040.46
-..LN5121:
-        pand      %xmm1, %xmm0                                  #5040.22
-..LN5123:
-        movdqa    %xmm0, -248(%ebp)                             #5040.17
-..LN5125:
-        movdqa    -216(%ebp), %xmm0                             #5041.38
-..LN5127:
-        movdqa    -184(%ebp), %xmm1                             #5041.46
-..LN5129:
-        pand      %xmm1, %xmm0                                  #5041.22
-..LN5131:
-        movdqa    %xmm0, -232(%ebp)                             #5041.17
-..LN5133:
-        movdqa    -248(%ebp), %xmm0                             #5042.22
-        movdqa    -232(%ebp), %xmm1                             #5042.22
-        pcmpeqd   %xmm1, %xmm0                                  #5042.22
-..LN5135:
-        movdqa    %xmm0, -248(%ebp)                             #5042.17
-..LN5137:
-        movdqa    -248(%ebp), %xmm0                             #5043.42
-..LN5139:
-        pmovmskb  %xmm0, %eax                                   #5043.22
-..LN5141:
-        movl      %eax, -20(%ebp)                               #5043.17
-..LN5143:
-        movl      -20(%ebp), %eax                               #5044.17
-        incl      %eax                                          #5044.17
-        sarl      $16, %eax                                     #5044.17
-        negl      %eax                                          #5044.17
-        movl      %eax, -20(%ebp)                               #5044.17
-                                # LOE
-..B29.13:                       # Preds ..B29.5 ..B29.12
-..LN5145:
-        movdqa    -216(%ebp), %xmm0                             #5047.38
-..LN5147:
-        movdqa    -168(%ebp), %xmm1                             #5047.46
-..LN5149:
-        pand      %xmm1, %xmm0                                  #5047.22
-..LN5151:
-        movdqa    %xmm0, -248(%ebp)                             #5047.17
-..LN5153:
-        movdqa    -216(%ebp), %xmm0                             #5048.38
-..LN5155:
-        movdqa    -152(%ebp), %xmm1                             #5048.46
-..LN5157:
-        pand      %xmm1, %xmm0                                  #5048.22
-..LN5159:
-        movdqa    %xmm0, -232(%ebp)                             #5048.17
-..LN5161:
-        movdqa    -248(%ebp), %xmm0                             #5049.22
-        movdqa    -232(%ebp), %xmm1                             #5049.22
-        pcmpeqd   %xmm1, %xmm0                                  #5049.22
-..LN5163:
-        movdqa    %xmm0, -248(%ebp)                             #5049.17
-..LN5165:
-        movdqa    -248(%ebp), %xmm0                             #5050.42
-..LN5167:
-        pmovmskb  %xmm0, %eax                                   #5050.22
-..LN5169:
-        movl      %eax, -24(%ebp)                               #5050.17
-..LN5171:
-        movl      -24(%ebp), %eax                               #5051.17
-        incl      %eax                                          #5051.17
-        sarl      $16, %eax                                     #5051.17
-        negl      %eax                                          #5051.17
-        movl      %eax, -24(%ebp)                               #5051.17
-                                # LOE
-..B29.14:                       # Preds ..B29.6 ..B29.13
-..LN5173:
-        movdqa    -216(%ebp), %xmm0                             #5054.38
-..LN5175:
-        movdqa    -136(%ebp), %xmm1                             #5054.46
-..LN5177:
-        pand      %xmm1, %xmm0                                  #5054.22
-..LN5179:
-        movdqa    %xmm0, -248(%ebp)                             #5054.17
-..LN5181:
-        movdqa    -216(%ebp), %xmm0                             #5055.38
-..LN5183:
-        movdqa    -120(%ebp), %xmm1                             #5055.46
-..LN5185:
-        pand      %xmm1, %xmm0                                  #5055.22
-..LN5187:
-        movdqa    %xmm0, -232(%ebp)                             #5055.17
-..LN5189:
-        movdqa    -248(%ebp), %xmm0                             #5056.22
-        movdqa    -232(%ebp), %xmm1                             #5056.22
-        pcmpeqd   %xmm1, %xmm0                                  #5056.22
-..LN5191:
-        movdqa    %xmm0, -248(%ebp)                             #5056.17
-..LN5193:
-        movdqa    -248(%ebp), %xmm0                             #5057.42
-..LN5195:
-        pmovmskb  %xmm0, %eax                                   #5057.22
-..LN5197:
-        movl      %eax, -28(%ebp)                               #5057.17
-..LN5199:
-        movl      -28(%ebp), %eax                               #5058.17
-        incl      %eax                                          #5058.17
-        sarl      $16, %eax                                     #5058.17
-        negl      %eax                                          #5058.17
-        movl      %eax, -28(%ebp)                               #5058.17
-                                # LOE
-..B29.15:                       # Preds ..B29.7 ..B29.14
-..LN5201:
-        movdqa    -216(%ebp), %xmm0                             #5061.38
-..LN5203:
-        movdqa    -104(%ebp), %xmm1                             #5061.46
-..LN5205:
-        pand      %xmm1, %xmm0                                  #5061.22
-..LN5207:
-        movdqa    %xmm0, -248(%ebp)                             #5061.17
-..LN5209:
-        movdqa    -216(%ebp), %xmm0                             #5062.38
-..LN5211:
-        movdqa    -88(%ebp), %xmm1                              #5062.46
-..LN5213:
-        pand      %xmm1, %xmm0                                  #5062.22
-..LN5215:
-        movdqa    %xmm0, -232(%ebp)                             #5062.17
-..LN5217:
-        movdqa    -248(%ebp), %xmm0                             #5063.22
-        movdqa    -232(%ebp), %xmm1                             #5063.22
-        pcmpeqd   %xmm1, %xmm0                                  #5063.22
-..LN5219:
-        movdqa    %xmm0, -248(%ebp)                             #5063.17
-..LN5221:
-        movdqa    -248(%ebp), %xmm0                             #5064.42
-..LN5223:
-        pmovmskb  %xmm0, %eax                                   #5064.22
-..LN5225:
-        movl      %eax, -52(%ebp)                               #5064.17
-..LN5227:
-        movl      -52(%ebp), %eax                               #5065.17
-        incl      %eax                                          #5065.17
-        sarl      $16, %eax                                     #5065.17
-        negl      %eax                                          #5065.17
-        movl      %eax, -52(%ebp)                               #5065.17
-..LN5229:
-        movl      16(%ebx), %eax                                #5069.17
-        andl      $-4, %eax                                     #5069.17
-        movl      %eax, 16(%ebx)                                #5069.17
-..LN5231:
-        movl      -24(%ebp), %eax                               #5072.29
-        orl       -20(%ebp), %eax                               #5072.29
-..LN5233:
-        orl       -28(%ebp), %eax                               #5072.34
-..LN5235:
-        orl       -52(%ebp), %eax                               #5072.39
-..LN5237:
-        je        ..B29.40      # Prob 50%                      #5072.47
-                                # LOE
-..B29.16:                       # Preds ..B29.15
-..LN5239:
-        movl      16(%ebx), %eax                                #5075.37
-        negl      %eax                                          #5075.37
-        addl      -40(%ebp), %eax                               #5075.37
-        movl      %eax, -56(%ebp)                               #5075.37
-        je        ..B29.19      # Prob 50%                      #5075.37
-                                # LOE
-..B29.17:                       # Preds ..B29.16
-        movl      -56(%ebp), %eax                               #5075.37
-        cmpl      $1, %eax                                      #5075.37
-        je        ..B29.21      # Prob 50%                      #5075.37
-                                # LOE
-..B29.18:                       # Preds ..B29.17
-        movl      -56(%ebp), %eax                               #5075.37
-        cmpl      $2, %eax                                      #5075.37
-        je        ..B29.25      # Prob 50%                      #5075.37
-        jmp       ..B29.31      # Prob 100%                     #5075.37
-                                # LOE
-..B29.19:                       # Preds ..B29.16
-..LN5241:
-        movl      -20(%ebp), %eax                               #5078.30
-..LN5243:
-        testl     %eax, %eax                                    #5078.36
-        je        ..B29.39      # Prob 50%                      #5078.36
-                                # LOE
-..B29.20:                       # Preds ..B29.19
-..LN5245:
-        movl      -48(%ebp), %eax                               #5078.53
-        negl      %eax                                          #5078.53
-..LN5247:
-        movl      16(%ebx), %edx                                #5078.47
-..LN5249:
-        lea       1(%edx,%eax), %eax                            #5078.61
-        leave                                                   #5078.61
-..___tag_value_eval_4na_pos.992:                                #
-        movl      %ebx, %esp                                    #5078.61
-        popl      %ebx                                          #5078.61
-..___tag_value_eval_4na_pos.993:                                #
-        ret                                                     #5078.61
-..___tag_value_eval_4na_pos.995:                                #
-                                # LOE
-..B29.21:                       # Preds ..B29.17
-..LN5251:
-        movl      -20(%ebp), %eax                               #5081.30
-..LN5253:
-        testl     %eax, %eax                                    #5081.36
-        je        ..B29.23      # Prob 50%                      #5081.36
-                                # LOE
-..B29.22:                       # Preds ..B29.21
-..LN5255:
-        movl      -48(%ebp), %eax                               #5081.53
-        negl      %eax                                          #5081.53
-..LN5257:
-        movl      16(%ebx), %edx                                #5081.47
-..LN5259:
-        lea       1(%edx,%eax), %eax                            #5081.61
-        leave                                                   #5081.61
-..___tag_value_eval_4na_pos.999:                                #
-        movl      %ebx, %esp                                    #5081.61
-        popl      %ebx                                          #5081.61
-..___tag_value_eval_4na_pos.1000:                               #
-        ret                                                     #5081.61
-..___tag_value_eval_4na_pos.1002:                               #
-                                # LOE
-..B29.23:                       # Preds ..B29.21
-..LN5261:
-        movl      -24(%ebp), %eax                               #5082.30
-..LN5263:
-        testl     %eax, %eax                                    #5082.36
-        je        ..B29.39      # Prob 50%                      #5082.36
-                                # LOE
-..B29.24:                       # Preds ..B29.23
-..LN5265:
-        movl      -48(%ebp), %eax                               #5082.53
-        negl      %eax                                          #5082.53
-..LN5267:
-        movl      16(%ebx), %edx                                #5082.47
-..LN5269:
-        lea       2(%edx,%eax), %eax                            #5082.61
-        leave                                                   #5082.61
-..___tag_value_eval_4na_pos.1006:                               #
-        movl      %ebx, %esp                                    #5082.61
-        popl      %ebx                                          #5082.61
-..___tag_value_eval_4na_pos.1007:                               #
-        ret                                                     #5082.61
-..___tag_value_eval_4na_pos.1009:                               #
-                                # LOE
-..B29.25:                       # Preds ..B29.18
-..LN5271:
-        movl      -20(%ebp), %eax                               #5085.30
-..LN5273:
-        testl     %eax, %eax                                    #5085.36
-        je        ..B29.27      # Prob 50%                      #5085.36
-                                # LOE
-..B29.26:                       # Preds ..B29.25
-..LN5275:
-        movl      -48(%ebp), %eax                               #5085.53
-        negl      %eax                                          #5085.53
-..LN5277:
-        movl      16(%ebx), %edx                                #5085.47
-..LN5279:
-        lea       1(%edx,%eax), %eax                            #5085.61
-        leave                                                   #5085.61
-..___tag_value_eval_4na_pos.1013:                               #
-        movl      %ebx, %esp                                    #5085.61
-        popl      %ebx                                          #5085.61
-..___tag_value_eval_4na_pos.1014:                               #
-        ret                                                     #5085.61
-..___tag_value_eval_4na_pos.1016:                               #
-                                # LOE
-..B29.27:                       # Preds ..B29.25
-..LN5281:
-        movl      -24(%ebp), %eax                               #5086.30
-..LN5283:
-        testl     %eax, %eax                                    #5086.36
-        je        ..B29.29      # Prob 50%                      #5086.36
-                                # LOE
-..B29.28:                       # Preds ..B29.27
-..LN5285:
-        movl      -48(%ebp), %eax                               #5086.53
-        negl      %eax                                          #5086.53
-..LN5287:
-        movl      16(%ebx), %edx                                #5086.47
-..LN5289:
-        lea       2(%edx,%eax), %eax                            #5086.61
-        leave                                                   #5086.61
-..___tag_value_eval_4na_pos.1020:                               #
-        movl      %ebx, %esp                                    #5086.61
-        popl      %ebx                                          #5086.61
-..___tag_value_eval_4na_pos.1021:                               #
-        ret                                                     #5086.61
-..___tag_value_eval_4na_pos.1023:                               #
-                                # LOE
-..B29.29:                       # Preds ..B29.27
-..LN5291:
-        movl      -28(%ebp), %eax                               #5087.30
-..LN5293:
-        testl     %eax, %eax                                    #5087.36
-        je        ..B29.39      # Prob 50%                      #5087.36
-                                # LOE
-..B29.30:                       # Preds ..B29.29
-..LN5295:
-        movl      -48(%ebp), %eax                               #5087.53
-        negl      %eax                                          #5087.53
-..LN5297:
-        movl      16(%ebx), %edx                                #5087.47
-..LN5299:
-        lea       3(%edx,%eax), %eax                            #5087.61
-        leave                                                   #5087.61
-..___tag_value_eval_4na_pos.1027:                               #
-        movl      %ebx, %esp                                    #5087.61
-        popl      %ebx                                          #5087.61
-..___tag_value_eval_4na_pos.1028:                               #
-        ret                                                     #5087.61
-..___tag_value_eval_4na_pos.1030:                               #
-                                # LOE
-..B29.31:                       # Preds ..B29.18
-..LN5301:
-        movl      -20(%ebp), %eax                               #5090.30
-..LN5303:
-        testl     %eax, %eax                                    #5090.36
-        je        ..B29.33      # Prob 50%                      #5090.36
-                                # LOE
-..B29.32:                       # Preds ..B29.31
-..LN5305:
-        movl      -48(%ebp), %eax                               #5090.53
-        negl      %eax                                          #5090.53
-..LN5307:
-        movl      16(%ebx), %edx                                #5090.47
-..LN5309:
-        lea       1(%edx,%eax), %eax                            #5090.61
-        leave                                                   #5090.61
-..___tag_value_eval_4na_pos.1034:                               #
-        movl      %ebx, %esp                                    #5090.61
-        popl      %ebx                                          #5090.61
-..___tag_value_eval_4na_pos.1035:                               #
-        ret                                                     #5090.61
-..___tag_value_eval_4na_pos.1037:                               #
-                                # LOE
-..B29.33:                       # Preds ..B29.31
-..LN5311:
-        movl      -24(%ebp), %eax                               #5091.30
-..LN5313:
-        testl     %eax, %eax                                    #5091.36
-        je        ..B29.35      # Prob 50%                      #5091.36
-                                # LOE
-..B29.34:                       # Preds ..B29.33
-..LN5315:
-        movl      -48(%ebp), %eax                               #5091.53
-        negl      %eax                                          #5091.53
-..LN5317:
-        movl      16(%ebx), %edx                                #5091.47
-..LN5319:
-        lea       2(%edx,%eax), %eax                            #5091.61
-        leave                                                   #5091.61
-..___tag_value_eval_4na_pos.1041:                               #
-        movl      %ebx, %esp                                    #5091.61
-        popl      %ebx                                          #5091.61
-..___tag_value_eval_4na_pos.1042:                               #
-        ret                                                     #5091.61
-..___tag_value_eval_4na_pos.1044:                               #
-                                # LOE
-..B29.35:                       # Preds ..B29.33
-..LN5321:
-        movl      -28(%ebp), %eax                               #5092.30
-..LN5323:
-        testl     %eax, %eax                                    #5092.36
-        je        ..B29.37      # Prob 50%                      #5092.36
-                                # LOE
-..B29.36:                       # Preds ..B29.35
-..LN5325:
-        movl      -48(%ebp), %eax                               #5092.53
-        negl      %eax                                          #5092.53
-..LN5327:
-        movl      16(%ebx), %edx                                #5092.47
-..LN5329:
-        lea       3(%edx,%eax), %eax                            #5092.61
-        leave                                                   #5092.61
-..___tag_value_eval_4na_pos.1048:                               #
-        movl      %ebx, %esp                                    #5092.61
-        popl      %ebx                                          #5092.61
-..___tag_value_eval_4na_pos.1049:                               #
-        ret                                                     #5092.61
-..___tag_value_eval_4na_pos.1051:                               #
-                                # LOE
-..B29.37:                       # Preds ..B29.35
-..LN5331:
-        movl      -52(%ebp), %eax                               #5093.30
-..LN5333:
-        testl     %eax, %eax                                    #5093.36
-        je        ..B29.39      # Prob 50%                      #5093.36
-                                # LOE
-..B29.38:                       # Preds ..B29.37
-..LN5335:
-        movl      -48(%ebp), %eax                               #5093.53
-        negl      %eax                                          #5093.53
-..LN5337:
-        movl      16(%ebx), %edx                                #5093.47
-..LN5339:
-        lea       4(%edx,%eax), %eax                            #5093.61
-        leave                                                   #5093.61
-..___tag_value_eval_4na_pos.1055:                               #
-        movl      %ebx, %esp                                    #5093.61
-        popl      %ebx                                          #5093.61
-..___tag_value_eval_4na_pos.1056:                               #
-        ret                                                     #5093.61
-..___tag_value_eval_4na_pos.1058:                               #
-                                # LOE
-..B29.39:                       # Preds ..B29.19 ..B29.23 ..B29.29 ..B29.37
-..LN5341:
-        xorl      %eax, %eax                                    #5095.28
-        leave                                                   #5095.28
-..___tag_value_eval_4na_pos.1062:                               #
-        movl      %ebx, %esp                                    #5095.28
-        popl      %ebx                                          #5095.28
-..___tag_value_eval_4na_pos.1063:                               #
-        ret                                                     #5095.28
-..___tag_value_eval_4na_pos.1065:                               #
-                                # LOE
-..B29.40:                       # Preds ..B29.15
-..LN5343:
-        movl      16(%ebx), %eax                                #5135.17
-        addl      $4, %eax                                      #5135.17
-        movl      %eax, 16(%ebx)                                #5135.17
-..LN5345:
-        movl      16(%ebx), %eax                                #5138.22
-..LN5347:
-        movl      -40(%ebp), %edx                               #5138.28
-        cmpl      %edx, %eax                                    #5138.28
-        jbe       ..B29.42      # Prob 50%                      #5138.28
-                                # LOE
-..B29.41:                       # Preds ..B29.40
-..LN5349:
-        xorl      %eax, %eax                                    #5139.28
-        leave                                                   #5139.28
-..___tag_value_eval_4na_pos.1069:                               #
-        movl      %ebx, %esp                                    #5139.28
-        popl      %ebx                                          #5139.28
-..___tag_value_eval_4na_pos.1070:                               #
-        ret                                                     #5139.28
-..___tag_value_eval_4na_pos.1072:                               #
-                                # LOE
-..B29.42:                       # Preds ..B29.40
-..LN5351:
-        movl      -16(%ebp), %eax                               #5142.25
-        decl      %eax                                          #5142.25
-        movl      %eax, -16(%ebp)                               #5142.25
-..LN5353:
-        je        ..B29.47      # Prob 50%                      #5142.39
-                                # LOE
-..B29.43:                       # Preds ..B29.42
-..LN5355:
-        movdqa    -216(%ebp), %xmm0                             #5147.43
-..LN5357:
-        psrldq    $2, %xmm0                                     #5147.26
-..LN5359:
-        movdqa    %xmm0, -216(%ebp)                             #5147.17
-..LN5361:
-        movl      -32(%ebp), %eax                               #5150.22
-..LN5363:
-        movl      -36(%ebp), %edx                               #5150.26
-        cmpl      %edx, %eax                                    #5150.26
-        jae       ..B29.45      # Prob 50%                      #5150.26
-                                # LOE
-..B29.44:                       # Preds ..B29.43
-..LN5365:
-        movdqa    -216(%ebp), %xmm0                             #5151.49
-..LN5367:
-        movl      -32(%ebp), %eax                               #5151.72
-        movzbl    (%eax), %eax                                  #5151.72
-        movzbl    %al, %eax                                     #5151.72
-..LN5369:
-        movl      -4(%ebp), %edx                                #5151.57
-        movzwl    expand_2na at GOTOFF(%edx,%eax,2), %eax          #5151.57
-        movzwl    %ax, %eax                                     #5151.57
-..LN5371:
-        pinsrw    $7, %eax, %xmm0                               #5151.30
-..LN5373:
-        movdqa    %xmm0, -216(%ebp)                             #5151.21
-                                # LOE
-..B29.45:                       # Preds ..B29.44 ..B29.43
-..LN5375:
-        incl      -32(%ebp)                                     #5154.20
-        jmp       ..B29.10      # Prob 100%                     #5154.20
-                                # LOE
-..B29.47:                       # Preds ..B29.42 ..B29.10
-..LN5377:
-        movl      -44(%ebp), %eax                               #5159.18
-..LN5379:
-        movl      -36(%ebp), %edx                               #5159.25
-        cmpl      %edx, %eax                                    #5159.25
-        jae       ..B29.51      # Prob 50%                      #5159.25
-                                # LOE
-..B29.48:                       # Preds ..B29.47
-..LN5381:
-        movl      16(%ebx), %eax                                #5164.18
-..LN5383:
-        movl      -40(%ebp), %edx                               #5164.24
-        cmpl      %edx, %eax                                    #5164.24
-        ja        ..B29.51      # Prob 50%                      #5164.24
-                                # LOE
-..B29.49:                       # Preds ..B29.48
-..LN5385:
-        addl      $-8, %esp                                     #5169.22
-..LN5387:
-        movl      -44(%ebp), %eax                               #5169.41
-        movl      %eax, (%esp)                                  #5169.41
-..LN5389:
-        movl      -36(%ebp), %eax                               #5169.46
-        movl      %eax, 4(%esp)                                 #5169.46
-..LN5391:
-        call      prime_buffer_4na                              #5169.22
-                                # LOE xmm0
-..B29.56:                       # Preds ..B29.49
-        addl      $8, %esp                                      #5169.22
-        movdqa    %xmm0, -264(%ebp)                             #5169.22
-                                # LOE
-..B29.50:                       # Preds ..B29.56
-..LN5393:
-        movdqa    -264(%ebp), %xmm0                             #5169.13
-        movdqa    %xmm0, -216(%ebp)                             #5169.13
-..LN5395:
-        addl      $8, -44(%ebp)                                 #5184.13
-..LN5397:
-        movl      -44(%ebp), %eax                               #5186.17
-..LN5399:
-        movl      %eax, -32(%ebp)                               #5186.13
-        jmp       ..B29.8       # Prob 100%                     #5186.13
-                                # LOE
-..B29.51:                       # Preds ..B29.48 ..B29.47 ..B29.8
-..LN5401:
-        xorl      %eax, %eax                                    #5196.12
-        leave                                                   #5196.12
-..___tag_value_eval_4na_pos.1076:                               #
-        movl      %ebx, %esp                                    #5196.12
-        popl      %ebx                                          #5196.12
-..___tag_value_eval_4na_pos.1077:                               #
-        ret                                                     #5196.12
-        .align    2,0x90
-..___tag_value_eval_4na_pos.1079:                               #
-                                # LOE
-# mark_end;
-	.type	eval_4na_pos, at function
-	.size	eval_4na_pos,.-eval_4na_pos
-.LNeval_4na_pos:
-	.data
-# -- End  eval_4na_pos
-	.data
-	.text
-# -- Begin  NucStrstrSearch
-# mark_begin;
-       .align    2,0x90
-	.globl NucStrstrSearch
-NucStrstrSearch:
-# parameter 1(self): 8 + %ebp
-# parameter 2(ncbi2na): 12 + %ebp
-# parameter 3(pos): 16 + %ebp
-# parameter 4(len): 20 + %ebp
-# parameter 5(selflen): 24 + %ebp
-..B30.1:                        # Preds ..B30.0
-..___tag_value_NucStrstrSearch.1082:                            #
-..LN5403:
-        pushl     %ebp                                          #5217.1
-        movl      %esp, %ebp                                    #5217.1
-..___tag_value_NucStrstrSearch.1087:                            #
-        subl      $92, %esp                                     #5217.1
-        movl      %ebx, -4(%ebp)                                #5217.1
-..___tag_value_NucStrstrSearch.1090:                            #
-..LN5405:
-        movl      8(%ebp), %eax                                 #5218.10
-..LN5407:
-        testl     %eax, %eax                                    #5218.18
-        je        ..B30.111     # Prob 50%                      #5218.18
-                                # LOE
-..B30.2:                        # Preds ..B30.1
-..LN5409:
-        movl      12(%ebp), %eax                                #5218.26
-..LN5411:
-        testl     %eax, %eax                                    #5218.37
-        je        ..B30.111     # Prob 50%                      #5218.37
-                                # LOE
-..B30.3:                        # Preds ..B30.2
-..LN5413:
-        movl      20(%ebp), %eax                                #5218.45
-..LN5415:
-        testl     %eax, %eax                                    #5218.52
-        je        ..B30.111     # Prob 50%                      #5218.52
-                                # LOE
-..B30.4:                        # Preds ..B30.3
-..LN5417:
-        movl      8(%ebp), %eax                                 #5223.18
-        movl      (%eax), %eax                                  #5223.18
-        movl      %eax, -8(%ebp)                                #5223.18
-..LN5419:
-        cmpl      $12, %eax                                     #5223.9
-        ja        ..B30.111     # Prob 50%                      #5223.9
-                                # LOE
-..B30.5:                        # Preds ..B30.4
-        call      ..L1091       # Prob 100%                     #
-..L1091:                                                        #
-        popl      %eax                                          #
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L1091], %eax    #
-        movl      %eax, -12(%ebp)                               #
-        movl      -8(%ebp), %edx                                #5223.9
-        movl      ..1..TPKT.30_0 at GOTOFF(%eax,%edx,4), %eax      #5223.9
-        jmp       *%eax                                         #5223.9
-                                # LOE
-..1.30_0.TAG.00:
-..B30.7:                        # Preds ..B30.5
-..LN5421:
-        movl      8(%ebp), %eax                                 #5226.24
-..LN5423:
-        movl      20(%ebp), %edx                                #5226.18
-..LN5425:
-        movl      4(%eax), %eax                                 #5226.24
-        cmpl      %eax, %edx                                    #5226.24
-        jae       ..B30.9       # Prob 50%                      #5226.24
-                                # LOE
-..B30.8:                        # Preds ..B30.7
-..LN5427:
-        xorl      %eax, %eax                                    #5226.54
-        movl      -4(%ebp), %ebx                                #5226.54
-..___tag_value_NucStrstrSearch.1092:                            #
-        leave                                                   #5226.54
-..___tag_value_NucStrstrSearch.1094:                            #
-        ret                                                     #5226.54
-..___tag_value_NucStrstrSearch.1095:                            #
-                                # LOE
-..B30.9:                        # Preds ..B30.7
-..LN5429:
-        movl      24(%ebp), %eax                                #5227.9
-        testl     %eax, %eax                                    #5227.9
-        je        ..B30.11      # Prob 50%                      #5227.9
-                                # LOE
-..B30.10:                       # Preds ..B30.9
-..LN5431:
-        movl      8(%ebp), %eax                                 #5227.27
-..LN5433:
-        movl      24(%ebp), %edx                                #5227.18
-..LN5435:
-        movl      4(%eax), %eax                                 #5227.27
-..LN5437:
-        movl      %eax, (%edx)                                  #5227.18
-                                # LOE
-..B30.11:                       # Preds ..B30.10 ..B30.9
-..LN5439:
-        addl      $-16, %esp                                    #5228.20
-..LN5441:
-        movl      8(%ebp), %eax                                 #5228.36
-        movl      %eax, (%esp)                                  #5228.36
-..LN5443:
-        movl      12(%ebp), %eax                                #5228.51
-        movl      %eax, 4(%esp)                                 #5228.51
-..LN5445:
-        movl      16(%ebp), %eax                                #5228.60
-        movl      %eax, 8(%esp)                                 #5228.60
-..LN5447:
-        movl      20(%ebp), %eax                                #5228.65
-        movl      %eax, 12(%esp)                                #5228.65
-..LN5449:
-        call      eval_2na_64                                   #5228.20
-                                # LOE eax
-..B30.114:                      # Preds ..B30.11
-        addl      $16, %esp                                     #5228.20
-        movl      %eax, -80(%ebp)                               #5228.20
-                                # LOE
-..B30.12:                       # Preds ..B30.114
-        movl      -80(%ebp), %eax                               #5228.20
-        movl      -4(%ebp), %ebx                                #5228.20
-..___tag_value_NucStrstrSearch.1097:                            #
-        leave                                                   #5228.20
-..___tag_value_NucStrstrSearch.1099:                            #
-        ret                                                     #5228.20
-..___tag_value_NucStrstrSearch.1100:                            #
-                                # LOE
-..1.30_0.TAG.01:
-..B30.14:                       # Preds ..B30.5
-..LN5451:
-        movl      8(%ebp), %eax                                 #5230.24
-..LN5453:
-        movl      20(%ebp), %edx                                #5230.18
-..LN5455:
-        movl      4(%eax), %eax                                 #5230.24
-        cmpl      %eax, %edx                                    #5230.24
-        jae       ..B30.16      # Prob 50%                      #5230.24
-                                # LOE
-..B30.15:                       # Preds ..B30.14
-..LN5457:
-        xorl      %eax, %eax                                    #5230.54
-        movl      -4(%ebp), %ebx                                #5230.54
-..___tag_value_NucStrstrSearch.1102:                            #
-        leave                                                   #5230.54
-..___tag_value_NucStrstrSearch.1104:                            #
-        ret                                                     #5230.54
-..___tag_value_NucStrstrSearch.1105:                            #
-                                # LOE
-..B30.16:                       # Preds ..B30.14
-..LN5459:
-        movl      24(%ebp), %eax                                #5231.9
-        testl     %eax, %eax                                    #5231.9
-        je        ..B30.18      # Prob 50%                      #5231.9
-                                # LOE
-..B30.17:                       # Preds ..B30.16
-..LN5461:
-        movl      8(%ebp), %eax                                 #5231.27
-..LN5463:
-        movl      24(%ebp), %edx                                #5231.18
-..LN5465:
-        movl      4(%eax), %eax                                 #5231.27
-..LN5467:
-        movl      %eax, (%edx)                                  #5231.18
-                                # LOE
-..B30.18:                       # Preds ..B30.17 ..B30.16
-..LN5469:
-        addl      $-16, %esp                                    #5232.20
-..LN5471:
-        movl      8(%ebp), %eax                                 #5232.36
-        movl      %eax, (%esp)                                  #5232.36
-..LN5473:
-        movl      12(%ebp), %eax                                #5232.51
-        movl      %eax, 4(%esp)                                 #5232.51
-..LN5475:
-        movl      16(%ebp), %eax                                #5232.60
-        movl      %eax, 8(%esp)                                 #5232.60
-..LN5477:
-        movl      20(%ebp), %eax                                #5232.65
-        movl      %eax, 12(%esp)                                #5232.65
-..LN5479:
-        call      eval_4na_64                                   #5232.20
-                                # LOE eax
-..B30.115:                      # Preds ..B30.18
-        addl      $16, %esp                                     #5232.20
-        movl      %eax, -76(%ebp)                               #5232.20
-                                # LOE
-..B30.19:                       # Preds ..B30.115
-        movl      -76(%ebp), %eax                               #5232.20
-        movl      -4(%ebp), %ebx                                #5232.20
-..___tag_value_NucStrstrSearch.1107:                            #
-        leave                                                   #5232.20
-..___tag_value_NucStrstrSearch.1109:                            #
-        ret                                                     #5232.20
-..___tag_value_NucStrstrSearch.1110:                            #
-                                # LOE
-..1.30_0.TAG.02:
-..B30.21:                       # Preds ..B30.5
-..LN5481:
-        movl      8(%ebp), %eax                                 #5235.24
-..LN5483:
-        movl      20(%ebp), %edx                                #5235.18
-..LN5485:
-        movl      4(%eax), %eax                                 #5235.24
-        cmpl      %eax, %edx                                    #5235.24
-        jae       ..B30.23      # Prob 50%                      #5235.24
-                                # LOE
-..B30.22:                       # Preds ..B30.21
-..LN5487:
-        xorl      %eax, %eax                                    #5235.54
-        movl      -4(%ebp), %ebx                                #5235.54
-..___tag_value_NucStrstrSearch.1112:                            #
-        leave                                                   #5235.54
-..___tag_value_NucStrstrSearch.1114:                            #
-        ret                                                     #5235.54
-..___tag_value_NucStrstrSearch.1115:                            #
-                                # LOE
-..B30.23:                       # Preds ..B30.21
-..LN5489:
-        movl      24(%ebp), %eax                                #5236.9
-        testl     %eax, %eax                                    #5236.9
-        je        ..B30.25      # Prob 50%                      #5236.9
-                                # LOE
-..B30.24:                       # Preds ..B30.23
-..LN5491:
-        movl      8(%ebp), %eax                                 #5236.27
-..LN5493:
-        movl      24(%ebp), %edx                                #5236.18
-..LN5495:
-        movl      4(%eax), %eax                                 #5236.27
-..LN5497:
-        movl      %eax, (%edx)                                  #5236.18
-                                # LOE
-..B30.25:                       # Preds ..B30.24 ..B30.23
-..LN5499:
-        addl      $-16, %esp                                    #5237.20
-..LN5501:
-        movl      8(%ebp), %eax                                 #5237.35
-        movl      %eax, (%esp)                                  #5237.35
-..LN5503:
-        movl      12(%ebp), %eax                                #5237.50
-        movl      %eax, 4(%esp)                                 #5237.50
-..LN5505:
-        movl      16(%ebp), %eax                                #5237.59
-        movl      %eax, 8(%esp)                                 #5237.59
-..LN5507:
-        movl      20(%ebp), %eax                                #5237.64
-        movl      %eax, 12(%esp)                                #5237.64
-..LN5509:
-        call      eval_2na_8                                    #5237.20
-                                # LOE eax
-..B30.116:                      # Preds ..B30.25
-        addl      $16, %esp                                     #5237.20
-        movl      %eax, -72(%ebp)                               #5237.20
-                                # LOE
-..B30.26:                       # Preds ..B30.116
-        movl      -72(%ebp), %eax                               #5237.20
-        movl      -4(%ebp), %ebx                                #5237.20
-..___tag_value_NucStrstrSearch.1117:                            #
-        leave                                                   #5237.20
-..___tag_value_NucStrstrSearch.1119:                            #
-        ret                                                     #5237.20
-..___tag_value_NucStrstrSearch.1120:                            #
-                                # LOE
-..1.30_0.TAG.03:
-..B30.28:                       # Preds ..B30.5
-..LN5511:
-        movl      8(%ebp), %eax                                 #5239.24
-..LN5513:
-        movl      20(%ebp), %edx                                #5239.18
-..LN5515:
-        movl      4(%eax), %eax                                 #5239.24
-        cmpl      %eax, %edx                                    #5239.24
-        jae       ..B30.30      # Prob 50%                      #5239.24
-                                # LOE
-..B30.29:                       # Preds ..B30.28
-..LN5517:
-        xorl      %eax, %eax                                    #5239.54
-        movl      -4(%ebp), %ebx                                #5239.54
-..___tag_value_NucStrstrSearch.1122:                            #
-        leave                                                   #5239.54
-..___tag_value_NucStrstrSearch.1124:                            #
-        ret                                                     #5239.54
-..___tag_value_NucStrstrSearch.1125:                            #
-                                # LOE
-..B30.30:                       # Preds ..B30.28
-..LN5519:
-        movl      24(%ebp), %eax                                #5240.9
-        testl     %eax, %eax                                    #5240.9
-        je        ..B30.32      # Prob 50%                      #5240.9
-                                # LOE
-..B30.31:                       # Preds ..B30.30
-..LN5521:
-        movl      8(%ebp), %eax                                 #5240.27
-..LN5523:
-        movl      24(%ebp), %edx                                #5240.18
-..LN5525:
-        movl      4(%eax), %eax                                 #5240.27
-..LN5527:
-        movl      %eax, (%edx)                                  #5240.18
-                                # LOE
-..B30.32:                       # Preds ..B30.31 ..B30.30
-..LN5529:
-        addl      $-16, %esp                                    #5241.20
-..LN5531:
-        movl      8(%ebp), %eax                                 #5241.36
-        movl      %eax, (%esp)                                  #5241.36
-..LN5533:
-        movl      12(%ebp), %eax                                #5241.51
-        movl      %eax, 4(%esp)                                 #5241.51
-..LN5535:
-        movl      16(%ebp), %eax                                #5241.60
-        movl      %eax, 8(%esp)                                 #5241.60
-..LN5537:
-        movl      20(%ebp), %eax                                #5241.65
-        movl      %eax, 12(%esp)                                #5241.65
-..LN5539:
-        call      eval_2na_16                                   #5241.20
-                                # LOE eax
-..B30.117:                      # Preds ..B30.32
-        addl      $16, %esp                                     #5241.20
-        movl      %eax, -68(%ebp)                               #5241.20
-                                # LOE
-..B30.33:                       # Preds ..B30.117
-        movl      -68(%ebp), %eax                               #5241.20
-        movl      -4(%ebp), %ebx                                #5241.20
-..___tag_value_NucStrstrSearch.1127:                            #
-        leave                                                   #5241.20
-..___tag_value_NucStrstrSearch.1129:                            #
-        ret                                                     #5241.20
-..___tag_value_NucStrstrSearch.1130:                            #
-                                # LOE
-..1.30_0.TAG.04:
-..B30.35:                       # Preds ..B30.5
-..LN5541:
-        movl      8(%ebp), %eax                                 #5243.24
-..LN5543:
-        movl      20(%ebp), %edx                                #5243.18
-..LN5545:
-        movl      4(%eax), %eax                                 #5243.24
-        cmpl      %eax, %edx                                    #5243.24
-        jae       ..B30.37      # Prob 50%                      #5243.24
-                                # LOE
-..B30.36:                       # Preds ..B30.35
-..LN5547:
-        xorl      %eax, %eax                                    #5243.54
-        movl      -4(%ebp), %ebx                                #5243.54
-..___tag_value_NucStrstrSearch.1132:                            #
-        leave                                                   #5243.54
-..___tag_value_NucStrstrSearch.1134:                            #
-        ret                                                     #5243.54
-..___tag_value_NucStrstrSearch.1135:                            #
-                                # LOE
-..B30.37:                       # Preds ..B30.35
-..LN5549:
-        movl      24(%ebp), %eax                                #5244.9
-        testl     %eax, %eax                                    #5244.9
-        je        ..B30.39      # Prob 50%                      #5244.9
-                                # LOE
-..B30.38:                       # Preds ..B30.37
-..LN5551:
-        movl      8(%ebp), %eax                                 #5244.27
-..LN5553:
-        movl      24(%ebp), %edx                                #5244.18
-..LN5555:
-        movl      4(%eax), %eax                                 #5244.27
-..LN5557:
-        movl      %eax, (%edx)                                  #5244.18
-                                # LOE
-..B30.39:                       # Preds ..B30.38 ..B30.37
-..LN5559:
-        addl      $-16, %esp                                    #5245.20
-..LN5561:
-        movl      8(%ebp), %eax                                 #5245.36
-        movl      %eax, (%esp)                                  #5245.36
-..LN5563:
-        movl      12(%ebp), %eax                                #5245.51
-        movl      %eax, 4(%esp)                                 #5245.51
-..LN5565:
-        movl      16(%ebp), %eax                                #5245.60
-        movl      %eax, 8(%esp)                                 #5245.60
-..LN5567:
-        movl      20(%ebp), %eax                                #5245.65
-        movl      %eax, 12(%esp)                                #5245.65
-..LN5569:
-        call      eval_2na_32                                   #5245.20
-                                # LOE eax
-..B30.118:                      # Preds ..B30.39
-        addl      $16, %esp                                     #5245.20
-        movl      %eax, -64(%ebp)                               #5245.20
-                                # LOE
-..B30.40:                       # Preds ..B30.118
-        movl      -64(%ebp), %eax                               #5245.20
-        movl      -4(%ebp), %ebx                                #5245.20
-..___tag_value_NucStrstrSearch.1137:                            #
-        leave                                                   #5245.20
-..___tag_value_NucStrstrSearch.1139:                            #
-        ret                                                     #5245.20
-..___tag_value_NucStrstrSearch.1140:                            #
-                                # LOE
-..1.30_0.TAG.05:
-..B30.42:                       # Preds ..B30.5
-..LN5571:
-        movl      8(%ebp), %eax                                 #5247.24
-..LN5573:
-        movl      20(%ebp), %edx                                #5247.18
-..LN5575:
-        movl      4(%eax), %eax                                 #5247.24
-        cmpl      %eax, %edx                                    #5247.24
-        jae       ..B30.44      # Prob 50%                      #5247.24
-                                # LOE
-..B30.43:                       # Preds ..B30.42
-..LN5577:
-        xorl      %eax, %eax                                    #5247.54
-        movl      -4(%ebp), %ebx                                #5247.54
-..___tag_value_NucStrstrSearch.1142:                            #
-        leave                                                   #5247.54
-..___tag_value_NucStrstrSearch.1144:                            #
-        ret                                                     #5247.54
-..___tag_value_NucStrstrSearch.1145:                            #
-                                # LOE
-..B30.44:                       # Preds ..B30.42
-..LN5579:
-        movl      24(%ebp), %eax                                #5248.9
-        testl     %eax, %eax                                    #5248.9
-        je        ..B30.46      # Prob 50%                      #5248.9
-                                # LOE
-..B30.45:                       # Preds ..B30.44
-..LN5581:
-        movl      8(%ebp), %eax                                 #5248.27
-..LN5583:
-        movl      24(%ebp), %edx                                #5248.18
-..LN5585:
-        movl      4(%eax), %eax                                 #5248.27
-..LN5587:
-        movl      %eax, (%edx)                                  #5248.18
-                                # LOE
-..B30.46:                       # Preds ..B30.45 ..B30.44
-..LN5589:
-        addl      $-16, %esp                                    #5249.20
-..LN5591:
-        movl      8(%ebp), %eax                                 #5249.37
-        movl      %eax, (%esp)                                  #5249.37
-..LN5593:
-        movl      12(%ebp), %eax                                #5249.52
-        movl      %eax, 4(%esp)                                 #5249.52
-..LN5595:
-        movl      16(%ebp), %eax                                #5249.61
-        movl      %eax, 8(%esp)                                 #5249.61
-..LN5597:
-        movl      20(%ebp), %eax                                #5249.66
-        movl      %eax, 12(%esp)                                #5249.66
-..LN5599:
-        call      eval_2na_128                                  #5249.20
-                                # LOE eax
-..B30.119:                      # Preds ..B30.46
-        addl      $16, %esp                                     #5249.20
-        movl      %eax, -60(%ebp)                               #5249.20
-                                # LOE
-..B30.47:                       # Preds ..B30.119
-        movl      -60(%ebp), %eax                               #5249.20
-        movl      -4(%ebp), %ebx                                #5249.20
-..___tag_value_NucStrstrSearch.1147:                            #
-        leave                                                   #5249.20
-..___tag_value_NucStrstrSearch.1149:                            #
-        ret                                                     #5249.20
-..___tag_value_NucStrstrSearch.1150:                            #
-                                # LOE
-..1.30_0.TAG.06:
-..B30.49:                       # Preds ..B30.5
-..LN5601:
-        movl      8(%ebp), %eax                                 #5251.24
-..LN5603:
-        movl      20(%ebp), %edx                                #5251.18
-..LN5605:
-        movl      4(%eax), %eax                                 #5251.24
-        cmpl      %eax, %edx                                    #5251.24
-        jae       ..B30.51      # Prob 50%                      #5251.24
-                                # LOE
-..B30.50:                       # Preds ..B30.49
-..LN5607:
-        xorl      %eax, %eax                                    #5251.54
-        movl      -4(%ebp), %ebx                                #5251.54
-..___tag_value_NucStrstrSearch.1152:                            #
-        leave                                                   #5251.54
-..___tag_value_NucStrstrSearch.1154:                            #
-        ret                                                     #5251.54
-..___tag_value_NucStrstrSearch.1155:                            #
-                                # LOE
-..B30.51:                       # Preds ..B30.49
-..LN5609:
-        movl      24(%ebp), %eax                                #5252.9
-        testl     %eax, %eax                                    #5252.9
-        je        ..B30.53      # Prob 50%                      #5252.9
-                                # LOE
-..B30.52:                       # Preds ..B30.51
-..LN5611:
-        movl      8(%ebp), %eax                                 #5252.27
-..LN5613:
-        movl      24(%ebp), %edx                                #5252.18
-..LN5615:
-        movl      4(%eax), %eax                                 #5252.27
-..LN5617:
-        movl      %eax, (%edx)                                  #5252.18
-                                # LOE
-..B30.53:                       # Preds ..B30.52 ..B30.51
-..LN5619:
-        addl      $-16, %esp                                    #5253.20
-..LN5621:
-        movl      8(%ebp), %eax                                 #5253.36
-        movl      %eax, (%esp)                                  #5253.36
-..LN5623:
-        movl      12(%ebp), %eax                                #5253.51
-        movl      %eax, 4(%esp)                                 #5253.51
-..LN5625:
-        movl      16(%ebp), %eax                                #5253.60
-        movl      %eax, 8(%esp)                                 #5253.60
-..LN5627:
-        movl      20(%ebp), %eax                                #5253.65
-        movl      %eax, 12(%esp)                                #5253.65
-..LN5629:
-        call      eval_4na_16                                   #5253.20
-                                # LOE eax
-..B30.120:                      # Preds ..B30.53
-        addl      $16, %esp                                     #5253.20
-        movl      %eax, -56(%ebp)                               #5253.20
-                                # LOE
-..B30.54:                       # Preds ..B30.120
-        movl      -56(%ebp), %eax                               #5253.20
-        movl      -4(%ebp), %ebx                                #5253.20
-..___tag_value_NucStrstrSearch.1157:                            #
-        leave                                                   #5253.20
-..___tag_value_NucStrstrSearch.1159:                            #
-        ret                                                     #5253.20
-..___tag_value_NucStrstrSearch.1160:                            #
-                                # LOE
-..1.30_0.TAG.07:
-..B30.56:                       # Preds ..B30.5
-..LN5631:
-        movl      8(%ebp), %eax                                 #5255.24
-..LN5633:
-        movl      20(%ebp), %edx                                #5255.18
-..LN5635:
-        movl      4(%eax), %eax                                 #5255.24
-        cmpl      %eax, %edx                                    #5255.24
-        jae       ..B30.58      # Prob 50%                      #5255.24
-                                # LOE
-..B30.57:                       # Preds ..B30.56
-..LN5637:
-        xorl      %eax, %eax                                    #5255.54
-        movl      -4(%ebp), %ebx                                #5255.54
-..___tag_value_NucStrstrSearch.1162:                            #
-        leave                                                   #5255.54
-..___tag_value_NucStrstrSearch.1164:                            #
-        ret                                                     #5255.54
-..___tag_value_NucStrstrSearch.1165:                            #
-                                # LOE
-..B30.58:                       # Preds ..B30.56
-..LN5639:
-        movl      24(%ebp), %eax                                #5256.9
-        testl     %eax, %eax                                    #5256.9
-        je        ..B30.60      # Prob 50%                      #5256.9
-                                # LOE
-..B30.59:                       # Preds ..B30.58
-..LN5641:
-        movl      8(%ebp), %eax                                 #5256.27
-..LN5643:
-        movl      24(%ebp), %edx                                #5256.18
-..LN5645:
-        movl      4(%eax), %eax                                 #5256.27
-..LN5647:
-        movl      %eax, (%edx)                                  #5256.18
-                                # LOE
-..B30.60:                       # Preds ..B30.59 ..B30.58
-..LN5649:
-        addl      $-16, %esp                                    #5257.20
-..LN5651:
-        movl      8(%ebp), %eax                                 #5257.36
-        movl      %eax, (%esp)                                  #5257.36
-..LN5653:
-        movl      12(%ebp), %eax                                #5257.51
-        movl      %eax, 4(%esp)                                 #5257.51
-..LN5655:
-        movl      16(%ebp), %eax                                #5257.60
-        movl      %eax, 8(%esp)                                 #5257.60
-..LN5657:
-        movl      20(%ebp), %eax                                #5257.65
-        movl      %eax, 12(%esp)                                #5257.65
-..LN5659:
-        call      eval_4na_32                                   #5257.20
-                                # LOE eax
-..B30.121:                      # Preds ..B30.60
-        addl      $16, %esp                                     #5257.20
-        movl      %eax, -52(%ebp)                               #5257.20
-                                # LOE
-..B30.61:                       # Preds ..B30.121
-        movl      -52(%ebp), %eax                               #5257.20
-        movl      -4(%ebp), %ebx                                #5257.20
-..___tag_value_NucStrstrSearch.1167:                            #
-        leave                                                   #5257.20
-..___tag_value_NucStrstrSearch.1169:                            #
-        ret                                                     #5257.20
-..___tag_value_NucStrstrSearch.1170:                            #
-                                # LOE
-..1.30_0.TAG.08:
-..B30.63:                       # Preds ..B30.5
-..LN5661:
-        movl      8(%ebp), %eax                                 #5259.24
-..LN5663:
-        movl      20(%ebp), %edx                                #5259.18
-..LN5665:
-        movl      4(%eax), %eax                                 #5259.24
-        cmpl      %eax, %edx                                    #5259.24
-        jae       ..B30.65      # Prob 50%                      #5259.24
-                                # LOE
-..B30.64:                       # Preds ..B30.63
-..LN5667:
-        xorl      %eax, %eax                                    #5259.54
-        movl      -4(%ebp), %ebx                                #5259.54
-..___tag_value_NucStrstrSearch.1172:                            #
-        leave                                                   #5259.54
-..___tag_value_NucStrstrSearch.1174:                            #
-        ret                                                     #5259.54
-..___tag_value_NucStrstrSearch.1175:                            #
-                                # LOE
-..B30.65:                       # Preds ..B30.63
-..LN5669:
-        movl      24(%ebp), %eax                                #5260.9
-        testl     %eax, %eax                                    #5260.9
-        je        ..B30.67      # Prob 50%                      #5260.9
-                                # LOE
-..B30.66:                       # Preds ..B30.65
-..LN5671:
-        movl      8(%ebp), %eax                                 #5260.27
-..LN5673:
-        movl      24(%ebp), %edx                                #5260.18
-..LN5675:
-        movl      4(%eax), %eax                                 #5260.27
-..LN5677:
-        movl      %eax, (%edx)                                  #5260.18
-                                # LOE
-..B30.67:                       # Preds ..B30.66 ..B30.65
-..LN5679:
-        addl      $-16, %esp                                    #5261.20
-..LN5681:
-        movl      8(%ebp), %eax                                 #5261.37
-        movl      %eax, (%esp)                                  #5261.37
-..LN5683:
-        movl      12(%ebp), %eax                                #5261.52
-        movl      %eax, 4(%esp)                                 #5261.52
-..LN5685:
-        movl      16(%ebp), %eax                                #5261.61
-        movl      %eax, 8(%esp)                                 #5261.61
-..LN5687:
-        movl      20(%ebp), %eax                                #5261.66
-        movl      %eax, 12(%esp)                                #5261.66
-..LN5689:
-        call      eval_4na_128                                  #5261.20
-                                # LOE eax
-..B30.122:                      # Preds ..B30.67
-        addl      $16, %esp                                     #5261.20
-        movl      %eax, -48(%ebp)                               #5261.20
-                                # LOE
-..B30.68:                       # Preds ..B30.122
-        movl      -48(%ebp), %eax                               #5261.20
-        movl      -4(%ebp), %ebx                                #5261.20
-..___tag_value_NucStrstrSearch.1177:                            #
-        leave                                                   #5261.20
-..___tag_value_NucStrstrSearch.1179:                            #
-        ret                                                     #5261.20
-..___tag_value_NucStrstrSearch.1180:                            #
-                                # LOE
-..1.30_0.TAG.09:
-..B30.70:                       # Preds ..B30.5
-..LN5691:
-        movl      8(%ebp), %eax                                 #5264.24
-..LN5693:
-        movl      20(%ebp), %edx                                #5264.18
-..LN5695:
-        movl      4(%eax), %eax                                 #5264.24
-        cmpl      %eax, %edx                                    #5264.24
-        jae       ..B30.72      # Prob 50%                      #5264.24
-                                # LOE
-..B30.71:                       # Preds ..B30.70
-..LN5697:
-        xorl      %eax, %eax                                    #5264.54
-        movl      -4(%ebp), %ebx                                #5264.54
-..___tag_value_NucStrstrSearch.1182:                            #
-        leave                                                   #5264.54
-..___tag_value_NucStrstrSearch.1184:                            #
-        ret                                                     #5264.54
-..___tag_value_NucStrstrSearch.1185:                            #
-                                # LOE
-..B30.72:                       # Preds ..B30.70
-..LN5699:
-        movl      24(%ebp), %eax                                #5265.9
-        testl     %eax, %eax                                    #5265.9
-        je        ..B30.74      # Prob 50%                      #5265.9
-                                # LOE
-..B30.73:                       # Preds ..B30.72
-..LN5701:
-        movl      8(%ebp), %eax                                 #5265.27
-..LN5703:
-        movl      24(%ebp), %edx                                #5265.18
-..LN5705:
-        movl      4(%eax), %eax                                 #5265.27
-..LN5707:
-        movl      %eax, (%edx)                                  #5265.18
-                                # LOE
-..B30.74:                       # Preds ..B30.73 ..B30.72
-..LN5709:
-        addl      $-16, %esp                                    #5266.20
-..LN5711:
-        movl      8(%ebp), %eax                                 #5266.37
-        movl      %eax, (%esp)                                  #5266.37
-..LN5713:
-        movl      12(%ebp), %eax                                #5266.52
-        movl      %eax, 4(%esp)                                 #5266.52
-..LN5715:
-        movl      16(%ebp), %eax                                #5266.61
-        movl      %eax, 8(%esp)                                 #5266.61
-..LN5717:
-        movl      20(%ebp), %eax                                #5266.66
-        movl      %eax, 12(%esp)                                #5266.66
-..LN5719:
-        call      eval_2na_pos                                  #5266.20
-                                # LOE eax
-..B30.123:                      # Preds ..B30.74
-        addl      $16, %esp                                     #5266.20
-        movl      %eax, -44(%ebp)                               #5266.20
-                                # LOE
-..B30.75:                       # Preds ..B30.123
-        movl      -44(%ebp), %eax                               #5266.20
-        movl      -4(%ebp), %ebx                                #5266.20
-..___tag_value_NucStrstrSearch.1187:                            #
-        leave                                                   #5266.20
-..___tag_value_NucStrstrSearch.1189:                            #
-        ret                                                     #5266.20
-..___tag_value_NucStrstrSearch.1190:                            #
-                                # LOE
-..1.30_0.TAG.0a:
-..B30.77:                       # Preds ..B30.5
-..LN5721:
-        movl      8(%ebp), %eax                                 #5268.24
-..LN5723:
-        movl      20(%ebp), %edx                                #5268.18
-..LN5725:
-        movl      4(%eax), %eax                                 #5268.24
-        cmpl      %eax, %edx                                    #5268.24
-        jae       ..B30.79      # Prob 50%                      #5268.24
-                                # LOE
-..B30.78:                       # Preds ..B30.77
-..LN5727:
-        xorl      %eax, %eax                                    #5268.54
-        movl      -4(%ebp), %ebx                                #5268.54
-..___tag_value_NucStrstrSearch.1192:                            #
-        leave                                                   #5268.54
-..___tag_value_NucStrstrSearch.1194:                            #
-        ret                                                     #5268.54
-..___tag_value_NucStrstrSearch.1195:                            #
-                                # LOE
-..B30.79:                       # Preds ..B30.77
-..LN5729:
-        movl      24(%ebp), %eax                                #5269.9
-        testl     %eax, %eax                                    #5269.9
-        je        ..B30.81      # Prob 50%                      #5269.9
-                                # LOE
-..B30.80:                       # Preds ..B30.79
-..LN5731:
-        movl      8(%ebp), %eax                                 #5269.27
-..LN5733:
-        movl      24(%ebp), %edx                                #5269.18
-..LN5735:
-        movl      4(%eax), %eax                                 #5269.27
-..LN5737:
-        movl      %eax, (%edx)                                  #5269.18
-                                # LOE
-..B30.81:                       # Preds ..B30.80 ..B30.79
-..LN5739:
-        addl      $-16, %esp                                    #5270.20
-..LN5741:
-        movl      8(%ebp), %eax                                 #5270.37
-        movl      %eax, (%esp)                                  #5270.37
-..LN5743:
-        movl      12(%ebp), %eax                                #5270.52
-        movl      %eax, 4(%esp)                                 #5270.52
-..LN5745:
-        movl      16(%ebp), %eax                                #5270.61
-        movl      %eax, 8(%esp)                                 #5270.61
-..LN5747:
-        movl      20(%ebp), %eax                                #5270.66
-        movl      %eax, 12(%esp)                                #5270.66
-..LN5749:
-        call      eval_4na_pos                                  #5270.20
-                                # LOE eax
-..B30.124:                      # Preds ..B30.81
-        addl      $16, %esp                                     #5270.20
-        movl      %eax, -40(%ebp)                               #5270.20
-                                # LOE
-..B30.82:                       # Preds ..B30.124
-        movl      -40(%ebp), %eax                               #5270.20
-        movl      -4(%ebp), %ebx                                #5270.20
-..___tag_value_NucStrstrSearch.1197:                            #
-        leave                                                   #5270.20
-..___tag_value_NucStrstrSearch.1199:                            #
-        ret                                                     #5270.20
-..___tag_value_NucStrstrSearch.1200:                            #
-                                # LOE
-..1.30_0.TAG.0b:
-..B30.84:                       # Preds ..B30.5
-..LN5751:
-        addl      $-20, %esp                                    #5272.21
-..LN5753:
-        movl      8(%ebp), %eax                                 #5272.39
-        movl      8(%eax), %eax                                 #5272.39
-        movl      %eax, (%esp)                                  #5272.39
-..LN5755:
-        movl      12(%ebp), %eax                                #5272.63
-        movl      %eax, 4(%esp)                                 #5272.63
-..LN5757:
-        movl      16(%ebp), %eax                                #5272.72
-        movl      %eax, 8(%esp)                                 #5272.72
-..LN5759:
-        movl      20(%ebp), %eax                                #5272.77
-        movl      %eax, 12(%esp)                                #5272.77
-..LN5761:
-        movl      24(%ebp), %eax                                #5272.82
-        movl      %eax, 16(%esp)                                #5272.82
-..LN5763:
-        movl      -12(%ebp), %eax                               #5272.21
-        movl      %eax, %ebx                                    #5272.21
-        call      NucStrstrSearch at PLT                           #5272.21
-                                # LOE eax
-..B30.125:                      # Preds ..B30.84
-        addl      $20, %esp                                     #5272.21
-        movl      %eax, -24(%ebp)                               #5272.21
-                                # LOE
-..B30.85:                       # Preds ..B30.125
-..LN5765:
-        movl      -24(%ebp), %eax                               #5272.13
-        movl      %eax, -28(%ebp)                               #5272.13
-..LN5767:
-        movl      8(%ebp), %eax                                 #5273.22
-        movl      4(%eax), %eax                                 #5273.22
-        movl      %eax, -20(%ebp)                               #5273.22
-        cmpl      $17, %eax                                     #5273.22
-        je        ..B30.87      # Prob 50%                      #5273.22
-                                # LOE
-..B30.86:                       # Preds ..B30.85
-        movl      -20(%ebp), %eax                               #5273.22
-        cmpl      $16, %eax                                     #5273.22
-        je        ..B30.89      # Prob 50%                      #5273.22
-        jmp       ..B30.91      # Prob 100%                     #5273.22
-                                # LOE
-..B30.87:                       # Preds ..B30.85
-..LN5769:
-        movl      -28(%ebp), %eax                               #5276.22
-..LN5771:
-        testl     %eax, %eax                                    #5276.31
-        je        ..B30.91      # Prob 50%                      #5276.31
-                                # LOE
-..B30.88:                       # Preds ..B30.87
-..LN5773:
-        movl      -28(%ebp), %eax                               #5277.28
-        movl      -4(%ebp), %ebx                                #5277.28
-..___tag_value_NucStrstrSearch.1202:                            #
-        leave                                                   #5277.28
-..___tag_value_NucStrstrSearch.1204:                            #
-        ret                                                     #5277.28
-..___tag_value_NucStrstrSearch.1205:                            #
-                                # LOE
-..B30.89:                       # Preds ..B30.86
-..LN5775:
-        movl      -28(%ebp), %eax                               #5280.22
-..LN5777:
-        testl     %eax, %eax                                    #5280.31
-        jne       ..B30.91      # Prob 50%                      #5280.31
-                                # LOE
-..B30.90:                       # Preds ..B30.89
-..LN5779:
-        movl      -28(%ebp), %eax                               #5281.28
-        movl      -4(%ebp), %ebx                                #5281.28
-..___tag_value_NucStrstrSearch.1207:                            #
-        leave                                                   #5281.28
-..___tag_value_NucStrstrSearch.1209:                            #
-        ret                                                     #5281.28
-..___tag_value_NucStrstrSearch.1210:                            #
-                                # LOE
-..B30.91:                       # Preds ..B30.87 ..B30.89 ..B30.86
-..LN5781:
-        addl      $-20, %esp                                    #5284.20
-..LN5783:
-        movl      8(%ebp), %eax                                 #5284.38
-        movl      12(%eax), %eax                                #5284.38
-        movl      %eax, (%esp)                                  #5284.38
-..LN5785:
-        movl      12(%ebp), %eax                                #5284.63
-        movl      %eax, 4(%esp)                                 #5284.63
-..LN5787:
-        movl      16(%ebp), %eax                                #5284.72
-        movl      %eax, 8(%esp)                                 #5284.72
-..LN5789:
-        movl      20(%ebp), %eax                                #5284.77
-        movl      %eax, 12(%esp)                                #5284.77
-..LN5791:
-        movl      24(%ebp), %eax                                #5284.82
-        movl      %eax, 16(%esp)                                #5284.82
-..LN5793:
-        movl      -12(%ebp), %eax                               #5284.20
-        movl      %eax, %ebx                                    #5284.20
-        call      NucStrstrSearch at PLT                           #5284.20
-                                # LOE eax
-..B30.126:                      # Preds ..B30.91
-        addl      $20, %esp                                     #5284.20
-        movl      %eax, -36(%ebp)                               #5284.20
-                                # LOE
-..B30.92:                       # Preds ..B30.126
-        movl      -36(%ebp), %eax                               #5284.20
-        movl      -4(%ebp), %ebx                                #5284.20
-..___tag_value_NucStrstrSearch.1212:                            #
-        leave                                                   #5284.20
-..___tag_value_NucStrstrSearch.1214:                            #
-        ret                                                     #5284.20
-..___tag_value_NucStrstrSearch.1215:                            #
-                                # LOE
-..1.30_0.TAG.0c:
-..B30.94:                       # Preds ..B30.5
-..LN5795:
-        movl      8(%ebp), %eax                                 #5286.22
-        movl      4(%eax), %eax                                 #5286.22
-        movl      %eax, -16(%ebp)                               #5286.22
-        testl     %eax, %eax                                    #5286.22
-        je        ..B30.98      # Prob 50%                      #5286.22
-                                # LOE
-..B30.95:                       # Preds ..B30.94
-        movl      -16(%ebp), %eax                               #5286.22
-        cmpl      $13, %eax                                     #5286.22
-        je        ..B30.98      # Prob 50%                      #5286.22
-                                # LOE
-..B30.96:                       # Preds ..B30.95
-        movl      -16(%ebp), %eax                               #5286.22
-        cmpl      $14, %eax                                     #5286.22
-        je        ..B30.103     # Prob 50%                      #5286.22
-                                # LOE
-..B30.97:                       # Preds ..B30.96
-        movl      -16(%ebp), %eax                               #5286.22
-        cmpl      $15, %eax                                     #5286.22
-        je        ..B30.107     # Prob 50%                      #5286.22
-        jmp       ..B30.111     # Prob 100%                     #5286.22
-                                # LOE
-..B30.98:                       # Preds ..B30.94 ..B30.95
-..LN5797:
-        addl      $-20, %esp                                    #5290.25
-..LN5799:
-        movl      8(%ebp), %eax                                 #5290.43
-        movl      8(%eax), %eax                                 #5290.43
-        movl      %eax, (%esp)                                  #5290.43
-..LN5801:
-        movl      12(%ebp), %eax                                #5290.63
-        movl      %eax, 4(%esp)                                 #5290.63
-..LN5803:
-        movl      16(%ebp), %eax                                #5290.72
-        movl      %eax, 8(%esp)                                 #5290.72
-..LN5805:
-        movl      20(%ebp), %eax                                #5290.77
-        movl      %eax, 12(%esp)                                #5290.77
-..LN5807:
-        movl      24(%ebp), %eax                                #5290.82
-        movl      %eax, 16(%esp)                                #5290.82
-..LN5809:
-        movl      -12(%ebp), %eax                               #5290.25
-        movl      %eax, %ebx                                    #5290.25
-        call      NucStrstrSearch at PLT                           #5290.25
-                                # LOE eax
-..B30.127:                      # Preds ..B30.98
-        addl      $20, %esp                                     #5290.25
-        movl      %eax, -32(%ebp)                               #5290.25
-                                # LOE
-..B30.99:                       # Preds ..B30.127
-..LN5811:
-        movl      -32(%ebp), %eax                               #5290.17
-        movl      %eax, -28(%ebp)                               #5290.17
-..LN5813:
-        movl      8(%ebp), %eax                                 #5291.22
-        movl      4(%eax), %eax                                 #5291.22
-..LN5815:
-        testl     %eax, %eax                                    #5291.42
-        jne       ..B30.101     # Prob 50%                      #5291.42
-                                # LOE
-..B30.100:                      # Preds ..B30.99
-..LN5817:
-        movl      -28(%ebp), %eax                               #5292.28
-        movl      -4(%ebp), %ebx                                #5292.28
-..___tag_value_NucStrstrSearch.1217:                            #
-        leave                                                   #5292.28
-..___tag_value_NucStrstrSearch.1219:                            #
-        ret                                                     #5292.28
-..___tag_value_NucStrstrSearch.1220:                            #
-                                # LOE
-..B30.101:                      # Preds ..B30.99
-..LN5819:
-        movl      -28(%ebp), %eax                               #5293.22
-..LN5821:
-        testl     %eax, %eax                                    #5293.31
-        jne       ..B30.111     # Prob 50%                      #5293.31
-                                # LOE
-..B30.102:                      # Preds ..B30.101
-..LN5823:
-        movl      $1, %eax                                      #5294.28
-        movl      -4(%ebp), %ebx                                #5294.28
-..___tag_value_NucStrstrSearch.1222:                            #
-        leave                                                   #5294.28
-..___tag_value_NucStrstrSearch.1224:                            #
-        ret                                                     #5294.28
-..___tag_value_NucStrstrSearch.1225:                            #
-                                # LOE
-..B30.103:                      # Preds ..B30.96
-..LN5825:
-        movl      8(%ebp), %eax                                 #5297.29
-        movl      8(%eax), %eax                                 #5297.29
-        movl      4(%eax), %eax                                 #5297.29
-..LN5827:
-        movl      %eax, -84(%ebp)                               #5297.17
-..LN5829:
-        movl      -84(%ebp), %eax                               #5298.22
-..LN5831:
-        movl      20(%ebp), %edx                                #5298.34
-        cmpl      %edx, %eax                                    #5298.34
-        jbe       ..B30.105     # Prob 50%                      #5298.34
-                                # LOE
-..B30.104:                      # Preds ..B30.103
-..LN5833:
-        xorl      %eax, %eax                                    #5299.28
-        movl      -4(%ebp), %ebx                                #5299.28
-..___tag_value_NucStrstrSearch.1227:                            #
-        leave                                                   #5299.28
-..___tag_value_NucStrstrSearch.1229:                            #
-        ret                                                     #5299.28
-..___tag_value_NucStrstrSearch.1230:                            #
-                                # LOE
-..B30.105:                      # Preds ..B30.103
-..LN5835:
-        addl      $-20, %esp                                    #5300.24
-..LN5837:
-        movl      8(%ebp), %eax                                 #5300.42
-        movl      8(%eax), %eax                                 #5300.42
-        movl      %eax, (%esp)                                  #5300.42
-..LN5839:
-        movl      12(%ebp), %eax                                #5300.62
-        movl      %eax, 4(%esp)                                 #5300.62
-..LN5841:
-        movl      16(%ebp), %eax                                #5300.71
-        movl      %eax, 8(%esp)                                 #5300.71
-..LN5843:
-        movl      -84(%ebp), %eax                               #5300.76
-        movl      %eax, 12(%esp)                                #5300.76
-..LN5845:
-        movl      24(%ebp), %eax                                #5300.87
-        movl      %eax, 16(%esp)                                #5300.87
-..LN5847:
-        movl      -12(%ebp), %eax                               #5300.24
-        movl      %eax, %ebx                                    #5300.24
-        call      NucStrstrSearch at PLT                           #5300.24
-                                # LOE eax
-..B30.128:                      # Preds ..B30.105
-        addl      $20, %esp                                     #5300.24
-        movl      %eax, -88(%ebp)                               #5300.24
-                                # LOE
-..B30.106:                      # Preds ..B30.128
-        movl      -88(%ebp), %eax                               #5300.24
-        movl      -4(%ebp), %ebx                                #5300.24
-..___tag_value_NucStrstrSearch.1232:                            #
-        leave                                                   #5300.24
-..___tag_value_NucStrstrSearch.1234:                            #
-        ret                                                     #5300.24
-..___tag_value_NucStrstrSearch.1235:                            #
-                                # LOE
-..B30.107:                      # Preds ..B30.97
-..LN5849:
-        movl      8(%ebp), %eax                                 #5302.29
-        movl      8(%eax), %eax                                 #5302.29
-        movl      4(%eax), %eax                                 #5302.29
-..LN5851:
-        movl      %eax, -84(%ebp)                               #5302.17
-..LN5853:
-        movl      -84(%ebp), %eax                               #5303.22
-..LN5855:
-        movl      20(%ebp), %edx                                #5303.34
-        cmpl      %edx, %eax                                    #5303.34
-        jbe       ..B30.109     # Prob 50%                      #5303.34
-                                # LOE
-..B30.108:                      # Preds ..B30.107
-..LN5857:
-        xorl      %eax, %eax                                    #5304.28
-        movl      -4(%ebp), %ebx                                #5304.28
-..___tag_value_NucStrstrSearch.1237:                            #
-        leave                                                   #5304.28
-..___tag_value_NucStrstrSearch.1239:                            #
-        ret                                                     #5304.28
-..___tag_value_NucStrstrSearch.1240:                            #
-                                # LOE
-..B30.109:                      # Preds ..B30.107
-..LN5859:
-        addl      $-20, %esp                                    #5305.24
-..LN5861:
-        movl      8(%ebp), %eax                                 #5305.42
-        movl      8(%eax), %eax                                 #5305.42
-        movl      %eax, (%esp)                                  #5305.42
-..LN5863:
-        movl      12(%ebp), %eax                                #5305.62
-        movl      %eax, 4(%esp)                                 #5305.62
-..LN5865:
-        movl      20(%ebp), %eax                                #5306.27
-        addl      16(%ebp), %eax                                #5306.27
-..LN5867:
-        movl      -84(%ebp), %edx                               #5306.33
-        negl      %edx                                          #5306.33
-        addl      %edx, %eax                                    #5306.33
-        movl      %eax, 8(%esp)                                 #5306.33
-..LN5869:
-        movl      -84(%ebp), %eax                               #5306.44
-        movl      %eax, 12(%esp)                                #5306.44
-..LN5871:
-        movl      24(%ebp), %eax                                #5306.55
-        movl      %eax, 16(%esp)                                #5306.55
-..LN5873:
-        movl      -12(%ebp), %eax                               #5305.24
-        movl      %eax, %ebx                                    #5305.24
-        call      NucStrstrSearch at PLT                           #5305.24
-                                # LOE eax
-..B30.129:                      # Preds ..B30.109
-        addl      $20, %esp                                     #5305.24
-        movl      %eax, -92(%ebp)                               #5305.24
-                                # LOE
-..B30.110:                      # Preds ..B30.129
-        movl      -92(%ebp), %eax                               #5305.24
-        movl      -4(%ebp), %ebx                                #5305.24
-..___tag_value_NucStrstrSearch.1242:                            #
-        leave                                                   #5305.24
-..___tag_value_NucStrstrSearch.1244:                            #
-        ret                                                     #5305.24
-..___tag_value_NucStrstrSearch.1245:                            #
-                                # LOE
-..B30.111:                      # Preds ..B30.101 ..B30.97 ..B30.4 ..B30.3 ..B30.2
-                                #       ..B30.1
-..LN5875:
-        xorl      %eax, %eax                                    #5311.12
-        movl      -4(%ebp), %ebx                                #5311.12
-..___tag_value_NucStrstrSearch.1247:                            #
-        leave                                                   #5311.12
-..___tag_value_NucStrstrSearch.1249:                            #
-        ret                                                     #5311.12
-        .align    2,0x90
-..___tag_value_NucStrstrSearch.1250:                            #
-                                # LOE
-# mark_end;
-	.type	NucStrstrSearch, at function
-	.size	NucStrstrSearch,.-NucStrstrSearch
-.LNNucStrstrSearch:
-	.section .data1, "wa"
-	.align 4
-..1..TPKT.30_0:
-	.long	..1.30_0.TAG.00
-	.long	..1.30_0.TAG.01
-	.long	..1.30_0.TAG.02
-	.long	..1.30_0.TAG.03
-	.long	..1.30_0.TAG.04
-	.long	..1.30_0.TAG.05
-	.long	..1.30_0.TAG.06
-	.long	..1.30_0.TAG.07
-	.long	..1.30_0.TAG.08
-	.long	..1.30_0.TAG.09
-	.long	..1.30_0.TAG.0a
-	.long	..1.30_0.TAG.0b
-	.long	..1.30_0.TAG.0c
-	.data
-# -- End  NucStrstrSearch
-	.data
-	.section .note.GNU-stack, ""
-// -- Begin DWARF2 SEGMENT .debug_info
-	.section .debug_info
-.debug_info_seg:
-	.align 1
-	.4byte 0x00002957
-	.2byte 0x0002
-	.4byte .debug_abbrev_seg
-	.byte 0x04
-.DWinfo0:
-//	DW_TAG_compile_unit:
-	.byte 0x01
-//	DW_AT_comp_dir:
-	.8byte 0x6f722f656d6f682f
-	.8byte 0x642f72656d726164
-	.8byte 0x746e692f6c657665
-	.8byte 0x73612f6c616e7265
-	.8byte 0x2f65636172742d6d
-	.8byte 0x726165732f617273
-	.2byte 0x6863
-	.byte 0x00
-//	DW_AT_language:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x747372747363756e
-	.4byte 0x00632e72
-//	DW_AT_producer:
-	.8byte 0x2952286c65746e49
-	.8byte 0x6d6f43202b2b4320
-	.8byte 0x6f662072656c6970
-	.8byte 0x63696c7070612072
-	.8byte 0x7220736e6f697461
-	.8byte 0x6f20676e696e6e75
-	.8byte 0x2c32332d4149206e
-	.8byte 0x6e6f697372655620
-	.8byte 0x202020312e303120
-	.8byte 0x3220646c69754220
-	.8byte 0x2034323031383030
-	.8byte 0x65786946200a7325
-	.8byte 0x7365676e61522073
-	.8byte 0x65766974616c6552
-	.2byte 0x000a
-//	DW_AT_stmt_list:
-	.4byte .debug_line_seg
-.DWinfo31:
-//	DW_TAG_enumeration_type:
-	.byte 0x02
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_byte_size:
-	.byte 0x04
-//	DW_AT_encoding:
-	.byte 0x07
-//	DW_AT_sibling:
-	.4byte 0x0000015b
-.DWinfo32:
-//	DW_TAG_enumerator:
-	.byte 0x03
-//	DW_AT_name:
-	.8byte 0x726570707553495f
-	.byte 0x00
-//	DW_AT_const_value:
-	.2byte 0x0280
-.DWinfo33:
-//	DW_TAG_enumerator:
-	.byte 0x03
-//	DW_AT_name:
-	.8byte 0x7265776f6c53495f
-	.byte 0x00
-//	DW_AT_const_value:
-	.2byte 0x0480
-.DWinfo34:
-//	DW_TAG_enumerator:
-	.byte 0x03
-//	DW_AT_name:
-	.8byte 0x6168706c6153495f
-	.byte 0x00
-//	DW_AT_const_value:
-	.2byte 0x0880
-.DWinfo35:
-//	DW_TAG_enumerator:
-	.byte 0x03
-//	DW_AT_name:
-	.8byte 0x746967696453495f
-	.byte 0x00
-//	DW_AT_const_value:
-	.2byte 0x1080
-.DWinfo36:
-//	DW_TAG_enumerator:
-	.byte 0x03
-//	DW_AT_name:
-	.8byte 0x696769647853495f
-	.2byte 0x0074
-//	DW_AT_const_value:
-	.2byte 0x2080
-.DWinfo37:
-//	DW_TAG_enumerator:
-	.byte 0x03
-//	DW_AT_name:
-	.8byte 0x656361707353495f
-	.byte 0x00
-//	DW_AT_const_value:
-	.2byte 0xc080
-	.byte 0x00
-.DWinfo38:
-//	DW_TAG_enumerator:
-	.byte 0x03
-//	DW_AT_name:
-	.8byte 0x746e69727053495f
-	.byte 0x00
-//	DW_AT_const_value:
-	.2byte 0x8080
-	.byte 0x01
-.DWinfo39:
-//	DW_TAG_enumerator:
-	.byte 0x03
-//	DW_AT_name:
-	.8byte 0x687061726753495f
-	.byte 0x00
-//	DW_AT_const_value:
-	.2byte 0x8080
-	.byte 0x02
-.DWinfo40:
-//	DW_TAG_enumerator:
-	.byte 0x03
-//	DW_AT_name:
-	.8byte 0x6b6e616c6253495f
-	.byte 0x00
-//	DW_AT_const_value:
-	.byte 0x01
-.DWinfo41:
-//	DW_TAG_enumerator:
-	.byte 0x03
-//	DW_AT_name:
-	.8byte 0x6c72746e6353495f
-	.byte 0x00
-//	DW_AT_const_value:
-	.byte 0x02
-.DWinfo42:
-//	DW_TAG_enumerator:
-	.byte 0x03
-//	DW_AT_name:
-	.8byte 0x74636e757053495f
-	.byte 0x00
-//	DW_AT_const_value:
-	.byte 0x04
-.DWinfo43:
-//	DW_TAG_enumerator:
-	.byte 0x03
-//	DW_AT_name:
-	.8byte 0x6d756e6c6153495f
-	.byte 0x00
-//	DW_AT_const_value:
-	.byte 0x08
-	.byte 0x00
-.DWinfo44:
-//	DW_TAG_enumeration_type:
-	.byte 0x02
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_byte_size:
-	.byte 0x04
-//	DW_AT_encoding:
-	.byte 0x07
-//	DW_AT_sibling:
-	.4byte 0x00000245
-.DWinfo45:
-//	DW_TAG_enumerator:
-	.byte 0x03
-//	DW_AT_name:
-	.8byte 0x616e325f65707974
-	.4byte 0x0034365f
-//	DW_AT_const_value:
-	.byte 0x00
-.DWinfo46:
-//	DW_TAG_enumerator:
-	.byte 0x03
-//	DW_AT_name:
-	.8byte 0x616e345f65707974
-	.4byte 0x0034365f
-//	DW_AT_const_value:
-	.byte 0x01
-.DWinfo47:
-//	DW_TAG_enumerator:
-	.byte 0x03
-//	DW_AT_name:
-	.8byte 0x616e325f65707974
-	.2byte 0x385f
-	.byte 0x00
-//	DW_AT_const_value:
-	.byte 0x02
-.DWinfo48:
-//	DW_TAG_enumerator:
-	.byte 0x03
-//	DW_AT_name:
-	.8byte 0x616e325f65707974
-	.4byte 0x0036315f
-//	DW_AT_const_value:
-	.byte 0x03
-.DWinfo49:
-//	DW_TAG_enumerator:
-	.byte 0x03
-//	DW_AT_name:
-	.8byte 0x616e325f65707974
-	.4byte 0x0032335f
-//	DW_AT_const_value:
-	.byte 0x04
-.DWinfo50:
-//	DW_TAG_enumerator:
-	.byte 0x03
-//	DW_AT_name:
-	.8byte 0x616e325f65707974
-	.4byte 0x3832315f
-	.byte 0x00
-//	DW_AT_const_value:
-	.byte 0x05
-.DWinfo51:
-//	DW_TAG_enumerator:
-	.byte 0x03
-//	DW_AT_name:
-	.8byte 0x616e345f65707974
-	.4byte 0x0036315f
-//	DW_AT_const_value:
-	.byte 0x06
-.DWinfo52:
-//	DW_TAG_enumerator:
-	.byte 0x03
-//	DW_AT_name:
-	.8byte 0x616e345f65707974
-	.4byte 0x0032335f
-//	DW_AT_const_value:
-	.byte 0x07
-.DWinfo53:
-//	DW_TAG_enumerator:
-	.byte 0x03
-//	DW_AT_name:
-	.8byte 0x616e345f65707974
-	.4byte 0x3832315f
-	.byte 0x00
-//	DW_AT_const_value:
-	.byte 0x08
-.DWinfo54:
-//	DW_TAG_enumerator:
-	.byte 0x03
-//	DW_AT_name:
-	.8byte 0x616e325f65707974
-	.4byte 0x736f705f
-	.byte 0x00
-//	DW_AT_const_value:
-	.byte 0x09
-.DWinfo55:
-//	DW_TAG_enumerator:
-	.byte 0x03
-//	DW_AT_name:
-	.8byte 0x616e345f65707974
-	.4byte 0x736f705f
-	.byte 0x00
-//	DW_AT_const_value:
-	.byte 0x0a
-.DWinfo56:
-//	DW_TAG_enumerator:
-	.byte 0x03
-//	DW_AT_name:
-	.8byte 0x00504f5f65707974
-//	DW_AT_const_value:
-	.byte 0x0b
-.DWinfo57:
-//	DW_TAG_enumerator:
-	.byte 0x03
-//	DW_AT_name:
-	.8byte 0x5058455f65707974
-	.2byte 0x0052
-//	DW_AT_const_value:
-	.byte 0x0c
-.DWinfo58:
-//	DW_TAG_enumerator:
-	.byte 0x03
-//	DW_AT_name:
-	.4byte 0x4e5f706f
-	.2byte 0x544f
-	.byte 0x00
-//	DW_AT_const_value:
-	.byte 0x0d
-.DWinfo59:
-//	DW_TAG_enumerator:
-	.byte 0x03
-//	DW_AT_name:
-	.8byte 0x00444145485f706f
-//	DW_AT_const_value:
-	.byte 0x0e
-.DWinfo60:
-//	DW_TAG_enumerator:
-	.byte 0x03
-//	DW_AT_name:
-	.8byte 0x004c4941545f706f
-//	DW_AT_const_value:
-	.byte 0x0f
-.DWinfo61:
-//	DW_TAG_enumerator:
-	.byte 0x03
-//	DW_AT_name:
-	.4byte 0x415f706f
-	.2byte 0x444e
-	.byte 0x00
-//	DW_AT_const_value:
-	.byte 0x10
-.DWinfo62:
-//	DW_TAG_enumerator:
-	.byte 0x03
-//	DW_AT_name:
-	.4byte 0x4f5f706f
-	.2byte 0x0052
-//	DW_AT_const_value:
-	.byte 0x11
-	.byte 0x00
-.DWinfo63:
-//	DW_TAG_typedef:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.byte 0x26
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x02
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x00745f3631746e69
-//	DW_AT_type:
-	.4byte 0x00000256
-.DWinfo64:
-//	DW_TAG_base_type:
-	.byte 0x05
-//	DW_AT_byte_size:
-	.byte 0x02
-//	DW_AT_encoding:
-	.byte 0x05
-//	DW_AT_name:
-	.4byte 0x726f6873
-	.2byte 0x0074
-.DWinfo1:
-//	DW_TAG_subprogram:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.byte 0x25
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x01
-//	DW_AT_inline:
-	.byte 0x02
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00000245
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x6c5f3631746e6975
-	.4byte 0x74696273
-	.byte 0x00
-	.8byte 0x6c5f3631746e6975
-	.4byte 0x74696273
-	.byte 0x00
-//	DW_AT_low_pc:
-	.4byte uint16_lsbit
-//	DW_AT_high_pc:
-	.4byte .LNuint16_lsbit
-//	DW_AT_external:
-	.byte 0x00
-//	DW_AT_sibling:
-	.4byte 0x000002b2
-.DWinfo65:
-//	DW_TAG_formal_parameter:
-	.byte 0x07
-//	DW_AT_decl_line:
-	.byte 0x25
-//	DW_AT_decl_column:
-	.byte 0x21
-//	DW_AT_decl_file:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x000002b2
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x08
-.DWinfo66:
-//	DW_TAG_variable:
-	.byte 0x08
-//	DW_AT_decl_line:
-	.byte 0x27
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x01
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x006e7472
-//	DW_AT_type:
-	.4byte 0x00000245
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x7c
-	.byte 0x00
-.DWinfo67:
-//	DW_TAG_typedef:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.byte 0x32
-//	DW_AT_decl_column:
-	.byte 0x1c
-//	DW_AT_decl_file:
-	.byte 0x02
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x745f3631746e6975
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000002c4
-.DWinfo68:
-//	DW_TAG_base_type:
-	.byte 0x05
-//	DW_AT_byte_size:
-	.byte 0x02
-//	DW_AT_encoding:
-	.byte 0x07
-//	DW_AT_name:
-	.8byte 0x64656e6769736e75
-	.4byte 0x6f687320
-	.2byte 0x7472
-	.byte 0x00
-.DWinfo69:
-//	DW_TAG_base_type:
-	.byte 0x05
-//	DW_AT_byte_size:
-	.byte 0x00
-//	DW_AT_encoding:
-	.byte 0x05
-//	DW_AT_name:
-	.4byte 0x64696f76
-	.byte 0x00
-.DWinfo2:
-//	DW_TAG_subprogram:
-	.byte 0x09
-//	DW_AT_decl_line:
-	.2byte 0x0126
-//	DW_AT_decl_column:
-	.byte 0x06
-//	DW_AT_decl_file:
-	.byte 0x01
-//	DW_AT_inline:
-	.byte 0x02
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x000002d6
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x5f383231746e6975
-	.4byte 0x00726873
-	.8byte 0x5f383231746e6975
-	.4byte 0x00726873
-//	DW_AT_low_pc:
-	.4byte uint128_shr
-//	DW_AT_high_pc:
-	.4byte .LNuint128_shr
-//	DW_AT_external:
-	.byte 0x00
-//	DW_AT_sibling:
-	.4byte 0x0000032f
-.DWinfo70:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0126
-//	DW_AT_decl_column:
-	.byte 0x1f
-//	DW_AT_decl_file:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x0000032f
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x08
-.DWinfo71:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0126
-//	DW_AT_decl_column:
-	.byte 0x2e
-//	DW_AT_decl_file:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x000003a0
-//	DW_AT_name:
-	.2byte 0x0069
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x0c
-	.byte 0x00
-.DWinfo72:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x00000334
-.DWinfo73:
-//	DW_TAG_typedef:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.byte 0x63
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x01
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x5f383231746e6975
-	.2byte 0x0074
-//	DW_AT_type:
-	.4byte 0x00000347
-.DWinfo74:
-//	DW_TAG_structure_type:
-	.byte 0x0c
-//	DW_AT_decl_line:
-	.byte 0x64
-//	DW_AT_decl_column:
-	.byte 0x08
-//	DW_AT_decl_file:
-	.byte 0x01
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_byte_size:
-	.byte 0x10
-//	DW_AT_name:
-	.8byte 0x5f383231746e6975
-	.2byte 0x0074
-//	DW_AT_sibling:
-	.4byte 0x00000378
-.DWinfo75:
-//	DW_TAG_member:
-	.byte 0x0d
-//	DW_AT_decl_line:
-	.byte 0x66
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x01
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x00
-//	DW_AT_name:
-	.2byte 0x6f6c
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000378
-.DWinfo76:
-//	DW_TAG_member:
-	.byte 0x0d
-//	DW_AT_decl_line:
-	.byte 0x67
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x01
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x08
-//	DW_AT_name:
-	.2byte 0x6968
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000378
-	.byte 0x00
-.DWinfo77:
-//	DW_TAG_typedef:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.byte 0x3b
-//	DW_AT_decl_column:
-	.byte 0x20
-//	DW_AT_decl_file:
-	.byte 0x02
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x745f3436746e6975
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x0000038a
-.DWinfo78:
-//	DW_TAG_base_type:
-	.byte 0x05
-//	DW_AT_byte_size:
-	.byte 0x08
-//	DW_AT_encoding:
-	.byte 0x07
-//	DW_AT_name:
-	.8byte 0x64656e6769736e75
-	.8byte 0x6f6c20676e6f6c20
-	.2byte 0x676e
-	.byte 0x00
-.DWinfo79:
-//	DW_TAG_typedef:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.byte 0x34
-//	DW_AT_decl_column:
-	.byte 0x17
-//	DW_AT_decl_file:
-	.byte 0x02
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x745f3233746e6975
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-.DWinfo80:
-//	DW_TAG_base_type:
-	.byte 0x05
-//	DW_AT_byte_size:
-	.byte 0x04
-//	DW_AT_encoding:
-	.byte 0x07
-//	DW_AT_name:
-	.8byte 0x64656e6769736e75
-	.4byte 0x746e6920
-	.byte 0x00
-.DWinfo3:
-//	DW_TAG_subprogram:
-	.byte 0x09
-//	DW_AT_decl_line:
-	.2byte 0x014c
-//	DW_AT_decl_column:
-	.byte 0x06
-//	DW_AT_decl_file:
-	.byte 0x01
-//	DW_AT_inline:
-	.byte 0x02
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x000002d6
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x5f383231746e6975
-	.4byte 0x61777362
-	.2byte 0x0070
-	.8byte 0x5f383231746e6975
-	.4byte 0x61777362
-	.2byte 0x0070
-//	DW_AT_low_pc:
-	.4byte uint128_bswap
-//	DW_AT_high_pc:
-	.4byte .LNuint128_bswap
-//	DW_AT_external:
-	.byte 0x00
-//	DW_AT_sibling:
-	.4byte 0x00000409
-.DWinfo81:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x014c
-//	DW_AT_decl_column:
-	.byte 0x21
-//	DW_AT_decl_file:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x0000032f
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x08
-	.byte 0x00
-.DWinfo4:
-//	DW_TAG_subprogram:
-	.byte 0x09
-//	DW_AT_decl_line:
-	.2byte 0x0163
-//	DW_AT_decl_column:
-	.byte 0x06
-//	DW_AT_decl_file:
-	.byte 0x01
-//	DW_AT_inline:
-	.byte 0x02
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x000002d6
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x5f383231746e6975
-	.8byte 0x6f635f7061777362
-	.2byte 0x7970
-	.byte 0x00
-	.8byte 0x5f383231746e6975
-	.8byte 0x6f635f7061777362
-	.2byte 0x7970
-	.byte 0x00
-//	DW_AT_low_pc:
-	.4byte uint128_bswap_copy
-//	DW_AT_high_pc:
-	.4byte .LNuint128_bswap_copy
-//	DW_AT_external:
-	.byte 0x00
-//	DW_AT_sibling:
-	.4byte 0x00000469
-.DWinfo82:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0163
-//	DW_AT_decl_column:
-	.byte 0x26
-//	DW_AT_decl_file:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x0000032f
-//	DW_AT_name:
-	.2byte 0x6f74
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x08
-.DWinfo83:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0163
-//	DW_AT_decl_column:
-	.byte 0x3b
-//	DW_AT_decl_file:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00000469
-//	DW_AT_name:
-	.4byte 0x6d6f7266
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x0c
-	.byte 0x00
-.DWinfo84:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x0000046e
-.DWinfo85:
-//	DW_TAG_const_type:
-	.byte 0x0e
-//	DW_AT_type:
-	.4byte 0x00000334
-.DWinfo86:
-//	DW_TAG_typedef:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.byte 0x2b
-//	DW_AT_decl_column:
-	.byte 0x36
-//	DW_AT_decl_file:
-	.byte 0x04
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x00693832316d5f5f
-//	DW_AT_type:
-	.4byte 0x00000484
-.DWinfo87:
-//	DW_TAG_array_type:
-	.byte 0x0f
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x00693832316d5f5f
-//	DW_AT_type:
-	.4byte 0x0000038a
-//	DW_AT_byte_size:
-	.byte 0x10
-//	DW_AT_sibling:
-	.4byte 0x000004a4
-.DWinfo88:
-//	DW_TAG_subrange_type:
-	.byte 0x10
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x00693832316d5f5f
-//	DW_AT_upper_bound:
-	.byte 0x01
-//	DW_AT_lower_bound:
-	.byte 0x00
-	.byte 0x00
-.DWinfo5:
-//	DW_TAG_subprogram:
-	.byte 0x09
-//	DW_AT_decl_line:
-	.2byte 0x0850
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x02
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00000473
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x75625f656d697270
-	.8byte 0x616e325f72656666
-	.byte 0x00
-	.8byte 0x75625f656d697270
-	.8byte 0x616e325f72656666
-	.byte 0x00
-//	DW_AT_low_pc:
-	.4byte prime_buffer_2na
-//	DW_AT_high_pc:
-	.4byte .LNprime_buffer_2na
-//	DW_AT_external:
-	.byte 0x00
-//	DW_AT_sibling:
-	.4byte 0x00000517
-.DWinfo89:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0850
-//	DW_AT_decl_column:
-	.byte 0x2b
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_name:
-	.4byte 0x00637273
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x08
-.DWinfo90:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0850
-//	DW_AT_decl_column:
-	.byte 0x3f
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_name:
-	.4byte 0x6f6e6769
-	.2byte 0x6572
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x0c
-.DWinfo91:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0852
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x66667562
-	.2byte 0x7265
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000473
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x68
-	.byte 0x00
-.DWinfo92:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x0000051c
-.DWinfo93:
-//	DW_TAG_const_type:
-	.byte 0x0e
-//	DW_AT_type:
-	.4byte 0x00000521
-.DWinfo94:
-//	DW_TAG_typedef:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.byte 0x31
-//	DW_AT_decl_column:
-	.byte 0x18
-//	DW_AT_decl_file:
-	.byte 0x02
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x00745f38746e6975
-//	DW_AT_type:
-	.4byte 0x00000532
-.DWinfo95:
-//	DW_TAG_base_type:
-	.byte 0x05
-//	DW_AT_byte_size:
-	.byte 0x01
-//	DW_AT_encoding:
-	.byte 0x08
-//	DW_AT_name:
-	.8byte 0x64656e6769736e75
-	.4byte 0x61686320
-	.2byte 0x0072
-.DWinfo6:
-//	DW_TAG_subprogram:
-	.byte 0x09
-//	DW_AT_decl_line:
-	.2byte 0x0f95
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x02
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00000473
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x75625f656d697270
-	.8byte 0x616e345f72656666
-	.byte 0x00
-	.8byte 0x75625f656d697270
-	.8byte 0x616e345f72656666
-	.byte 0x00
-//	DW_AT_low_pc:
-	.4byte prime_buffer_4na
-//	DW_AT_high_pc:
-	.4byte .LNprime_buffer_4na
-//	DW_AT_external:
-	.byte 0x00
-//	DW_AT_sibling:
-	.4byte 0x000005c7
-.DWinfo96:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0f95
-//	DW_AT_decl_column:
-	.byte 0x2b
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_name:
-	.4byte 0x00637273
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x08
-.DWinfo97:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0f95
-//	DW_AT_decl_column:
-	.byte 0x3f
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_name:
-	.4byte 0x6f6e6769
-	.2byte 0x6572
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x0c
-.DWinfo98:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0f97
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00706d74
-//	DW_AT_type:
-	.4byte 0x000005c7
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x58
-.DWinfo99:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0f98
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x66667562
-	.2byte 0x7265
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000473
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x68
-	.byte 0x00
-.DWinfo100:
-//	DW_TAG_typedef:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.byte 0x48
-//	DW_AT_decl_column:
-	.byte 0x03
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x745f74617063756e
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000005d9
-.DWinfo101:
-//	DW_TAG_union_type:
-	.byte 0x12
-//	DW_AT_decl_line:
-	.byte 0x42
-//	DW_AT_decl_column:
-	.byte 0x01
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_byte_size:
-	.byte 0x10
-//	DW_AT_sibling:
-	.4byte 0x0000062a
-.DWinfo102:
-//	DW_TAG_member:
-	.byte 0x13
-//	DW_AT_decl_line:
-	.byte 0x43
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x00
-//	DW_AT_name:
-	.2byte 0x0062
-//	DW_AT_type:
-	.4byte 0x0000062a
-.DWinfo103:
-//	DW_TAG_member:
-	.byte 0x13
-//	DW_AT_decl_line:
-	.byte 0x44
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x00
-//	DW_AT_name:
-	.2byte 0x0077
-//	DW_AT_type:
-	.4byte 0x00000637
-.DWinfo104:
-//	DW_TAG_member:
-	.byte 0x13
-//	DW_AT_decl_line:
-	.byte 0x45
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x00
-//	DW_AT_name:
-	.2byte 0x0069
-//	DW_AT_type:
-	.4byte 0x00000644
-.DWinfo105:
-//	DW_TAG_member:
-	.byte 0x13
-//	DW_AT_decl_line:
-	.byte 0x46
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x00
-//	DW_AT_name:
-	.2byte 0x006c
-//	DW_AT_type:
-	.4byte 0x00000651
-.DWinfo106:
-//	DW_TAG_member:
-	.byte 0x13
-//	DW_AT_decl_line:
-	.byte 0x47
-//	DW_AT_decl_column:
-	.byte 0x0f
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x00
-//	DW_AT_name:
-	.2byte 0x0073
-//	DW_AT_type:
-	.4byte 0x00000334
-	.byte 0x00
-.DWinfo107:
-//	DW_TAG_array_type:
-	.byte 0x14
-//	DW_AT_type:
-	.4byte 0x00000521
-//	DW_AT_byte_size:
-	.byte 0x10
-//	DW_AT_sibling:
-	.4byte 0x00000637
-.DWinfo108:
-//	DW_TAG_subrange_type:
-	.byte 0x15
-//	DW_AT_upper_bound:
-	.byte 0x0f
-	.byte 0x00
-.DWinfo109:
-//	DW_TAG_array_type:
-	.byte 0x14
-//	DW_AT_type:
-	.4byte 0x000002b2
-//	DW_AT_byte_size:
-	.byte 0x10
-//	DW_AT_sibling:
-	.4byte 0x00000644
-.DWinfo110:
-//	DW_TAG_subrange_type:
-	.byte 0x15
-//	DW_AT_upper_bound:
-	.byte 0x07
-	.byte 0x00
-.DWinfo111:
-//	DW_TAG_array_type:
-	.byte 0x14
-//	DW_AT_type:
-	.4byte 0x000003a0
-//	DW_AT_byte_size:
-	.byte 0x10
-//	DW_AT_sibling:
-	.4byte 0x00000651
-.DWinfo112:
-//	DW_TAG_subrange_type:
-	.byte 0x15
-//	DW_AT_upper_bound:
-	.byte 0x03
-	.byte 0x00
-.DWinfo113:
-//	DW_TAG_array_type:
-	.byte 0x14
-//	DW_AT_type:
-	.4byte 0x00000378
-//	DW_AT_byte_size:
-	.byte 0x10
-//	DW_AT_sibling:
-	.4byte 0x0000065e
-.DWinfo114:
-//	DW_TAG_subrange_type:
-	.byte 0x15
-//	DW_AT_upper_bound:
-	.byte 0x01
-	.byte 0x00
-.DWinfo115:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x000002d6
-.DWinfo7:
-//	DW_TAG_subprogram:
-	.byte 0x09
-//	DW_AT_decl_line:
-	.2byte 0x0315
-//	DW_AT_decl_column:
-	.byte 0x07
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x0000065e
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x614672745363754e
-	.8byte 0x4172707845617473
-	.4byte 0x636f6c6c
-	.byte 0x00
-	.8byte 0x614672745363754e
-	.8byte 0x4172707845617473
-	.4byte 0x636f6c6c
-	.byte 0x00
-//	DW_AT_low_pc:
-	.4byte NucStrFastaExprAlloc
-//	DW_AT_high_pc:
-	.4byte .LNNucStrFastaExprAlloc
-//	DW_AT_external:
-	.byte 0x00
-//	DW_AT_sibling:
-	.4byte 0x000006e6
-.DWinfo116:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0315
-//	DW_AT_decl_column:
-	.byte 0x25
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000006e6
-//	DW_AT_name:
-	.2byte 0x7a73
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x08
-.DWinfo117:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0317
-//	DW_AT_decl_column:
-	.byte 0x0b
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6574756f
-	.2byte 0x0072
-//	DW_AT_type:
-	.4byte 0x0000065e
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x70
-.DWinfo118:
-//	DW_TAG_lexical_block:
-	.byte 0x16
-//	DW_AT_decl_line:
-	.2byte 0x0319
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.4byte ..LN121
-//	DW_AT_high_pc:
-	.4byte ..LN135
-.DWinfo119:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x031a
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0065
-//	DW_AT_type:
-	.4byte 0x000006f6
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x6c
-	.byte 0x00
-	.byte 0x00
-.DWinfo120:
-//	DW_TAG_typedef:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.byte 0x20
-//	DW_AT_decl_column:
-	.byte 0x17
-//	DW_AT_decl_file:
-	.byte 0x05
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x657a6973
-	.2byte 0x745f
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-.DWinfo121:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x000006fb
-.DWinfo122:
-//	DW_TAG_typedef:
-	.byte 0x17
-//	DW_AT_decl_line:
-	.2byte 0x02fa
-//	DW_AT_decl_column:
-	.byte 0x20
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x614672745363754e
-	.8byte 0x0072707845617473
-//	DW_AT_type:
-	.4byte 0x00000715
-.DWinfo123:
-//	DW_TAG_structure_type:
-	.byte 0x18
-//	DW_AT_decl_line:
-	.2byte 0x02fb
-//	DW_AT_decl_column:
-	.byte 0x08
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_byte_size:
-	.byte 0x90
-//	DW_AT_name:
-	.8byte 0x614672745363754e
-	.8byte 0x0072707845617473
-//	DW_AT_sibling:
-	.4byte 0x00000773
-.DWinfo124:
-//	DW_TAG_member:
-	.byte 0x19
-//	DW_AT_decl_line:
-	.2byte 0x02fd
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x00
-//	DW_AT_name:
-	.4byte 0x65707974
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000773
-.DWinfo125:
-//	DW_TAG_member:
-	.byte 0x19
-//	DW_AT_decl_line:
-	.2byte 0x02fe
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x04
-//	DW_AT_name:
-	.4byte 0x657a6973
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003a0
-.DWinfo126:
-//	DW_TAG_member:
-	.byte 0x19
-//	DW_AT_decl_line:
-	.2byte 0x0307
-//	DW_AT_decl_column:
-	.byte 0x07
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x08
-//	DW_AT_name:
-	.2byte 0x0075
-//	DW_AT_type:
-	.4byte 0x0000078b
-.DWinfo127:
-//	DW_TAG_member:
-	.byte 0x19
-//	DW_AT_decl_line:
-	.2byte 0x030d
-//	DW_AT_decl_column:
-	.byte 0x07
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x10
-//	DW_AT_name:
-	.4byte 0x72657571
-	.2byte 0x0079
-//	DW_AT_type:
-	.4byte 0x000007bd
-	.byte 0x00
-.DWinfo128:
-//	DW_TAG_typedef:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.byte 0x27
-//	DW_AT_decl_column:
-	.byte 0x0f
-//	DW_AT_decl_file:
-	.byte 0x02
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x00745f3233746e69
-//	DW_AT_type:
-	.4byte 0x00000784
-.DWinfo129:
-//	DW_TAG_base_type:
-	.byte 0x05
-//	DW_AT_byte_size:
-	.byte 0x04
-//	DW_AT_encoding:
-	.byte 0x05
-//	DW_AT_name:
-	.4byte 0x00746e69
-.DWinfo130:
-//	DW_TAG_union_type:
-	.byte 0x1a
-//	DW_AT_decl_line:
-	.2byte 0x0301
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_byte_size:
-	.byte 0x08
-//	DW_AT_sibling:
-	.4byte 0x000007bd
-.DWinfo131:
-//	DW_TAG_member:
-	.byte 0x1b
-//	DW_AT_decl_line:
-	.2byte 0x0305
-//	DW_AT_decl_column:
-	.byte 0x0f
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x00
-//	DW_AT_name:
-	.4byte 0x6574756f
-	.2byte 0x0072
-//	DW_AT_type:
-	.4byte 0x0000065e
-.DWinfo132:
-//	DW_TAG_member:
-	.byte 0x1b
-//	DW_AT_decl_line:
-	.2byte 0x0306
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x00
-//	DW_AT_name:
-	.4byte 0x67696c61
-	.2byte 0x006e
-//	DW_AT_type:
-	.4byte 0x00000378
-	.byte 0x00
-.DWinfo133:
-//	DW_TAG_array_type:
-	.byte 0x14
-//	DW_AT_type:
-	.4byte 0x000007ca
-//	DW_AT_byte_size:
-	.byte 0x80
-//	DW_AT_sibling:
-	.4byte 0x000007ca
-.DWinfo134:
-//	DW_TAG_subrange_type:
-	.byte 0x15
-//	DW_AT_upper_bound:
-	.byte 0x03
-	.byte 0x00
-.DWinfo135:
-//	DW_TAG_structure_type:
-	.byte 0x1c
-//	DW_AT_decl_line:
-	.2byte 0x030a
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_byte_size:
-	.byte 0x20
-//	DW_AT_sibling:
-	.4byte 0x000007fb
-.DWinfo136:
-//	DW_TAG_member:
-	.byte 0x19
-//	DW_AT_decl_line:
-	.2byte 0x030b
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x00
-//	DW_AT_name:
-	.8byte 0x006e726574746170
-//	DW_AT_type:
-	.4byte 0x000005c7
-.DWinfo137:
-//	DW_TAG_member:
-	.byte 0x19
-//	DW_AT_decl_line:
-	.2byte 0x030c
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x10
-//	DW_AT_name:
-	.4byte 0x6b73616d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000005c7
-	.byte 0x00
-.DWinfo8:
-//	DW_TAG_subprogram:
-	.byte 0x09
-//	DW_AT_decl_line:
-	.2byte 0x0344
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x614672745363754e
-	.8byte 0x4d72707845617473
-	.4byte 0x32656b61
-	.byte 0x00
-	.8byte 0x614672745363754e
-	.8byte 0x4d72707845617473
-	.4byte 0x32656b61
-	.byte 0x00
-//	DW_AT_low_pc:
-	.4byte NucStrFastaExprMake2
-//	DW_AT_high_pc:
-	.4byte .LNNucStrFastaExprMake2
-//	DW_AT_external:
-	.byte 0x00
-//	DW_AT_sibling:
-	.4byte 0x000008ef
-.DWinfo138:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0344
-//	DW_AT_decl_column:
-	.byte 0x29
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000008ef
-//	DW_AT_name:
-	.4byte 0x72707865
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x08
-.DWinfo139:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0344
-//	DW_AT_decl_column:
-	.byte 0x33
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_name:
-	.8byte 0x6e6f697469736f70
-	.2byte 0x6c61
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x0c
-.DWinfo140:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0345
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000a46
-//	DW_AT_name:
-	.4byte 0x74736166
-	.2byte 0x0061
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x10
-.DWinfo141:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0345
-//	DW_AT_decl_column:
-	.byte 0x1f
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000006e6
-//	DW_AT_name:
-	.4byte 0x657a6973
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x14
-.DWinfo142:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0347
-//	DW_AT_decl_column:
-	.byte 0x0c
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0069
-//	DW_AT_type:
-	.4byte 0x000006e6
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x64
-.DWinfo143:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0348
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0065
-//	DW_AT_type:
-	.4byte 0x000008f4
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x6c
-.DWinfo144:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0349
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x006e726574746170
-//	DW_AT_type:
-	.4byte 0x000005c7
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x44
-.DWinfo145:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0349
-//	DW_AT_decl_column:
-	.byte 0x17
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6b73616d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000005c7
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x54
-.DWinfo146:
-//	DW_TAG_lexical_block:
-	.byte 0x16
-//	DW_AT_decl_line:
-	.2byte 0x0359
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.4byte ..LN191
-//	DW_AT_high_pc:
-	.4byte ..LN301
-.DWinfo147:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x035a
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x65736162
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000521
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x78
-	.byte 0x00
-	.byte 0x00
-.DWinfo148:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x000008f4
-.DWinfo149:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x000008f9
-.DWinfo150:
-//	DW_TAG_typedef:
-	.byte 0x17
-//	DW_AT_decl_line:
-	.2byte 0x02df
-//	DW_AT_decl_column:
-	.byte 0x13
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x784572745363754e
-	.2byte 0x7270
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x0000090e
-.DWinfo151:
-//	DW_TAG_typedef:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.byte 0x44
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x06
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x747372745363754e
-	.2byte 0x0072
-//	DW_AT_type:
-	.4byte 0x00000921
-.DWinfo152:
-//	DW_TAG_union_type:
-	.byte 0x1d
-//	DW_AT_decl_line:
-	.2byte 0x0339
-//	DW_AT_decl_column:
-	.byte 0x08
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_byte_size:
-	.byte 0x90
-//	DW_AT_name:
-	.8byte 0x747372745363754e
-	.2byte 0x0072
-//	DW_AT_sibling:
-	.4byte 0x00000970
-.DWinfo153:
-//	DW_TAG_member:
-	.byte 0x1b
-//	DW_AT_decl_line:
-	.2byte 0x033b
-//	DW_AT_decl_column:
-	.byte 0x15
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x00
-//	DW_AT_name:
-	.4byte 0x74736166
-	.2byte 0x0061
-//	DW_AT_type:
-	.4byte 0x000006fb
-.DWinfo154:
-//	DW_TAG_member:
-	.byte 0x1b
-//	DW_AT_decl_line:
-	.2byte 0x033c
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x00
-//	DW_AT_name:
-	.8byte 0x006e61656c6f6f62
-//	DW_AT_type:
-	.4byte 0x00000970
-.DWinfo155:
-//	DW_TAG_member:
-	.byte 0x1b
-//	DW_AT_decl_line:
-	.2byte 0x033d
-//	DW_AT_decl_column:
-	.byte 0x13
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x00
-//	DW_AT_name:
-	.4byte 0x00627573
-//	DW_AT_type:
-	.4byte 0x000009e3
-	.byte 0x00
-.DWinfo156:
-//	DW_TAG_typedef:
-	.byte 0x17
-//	DW_AT_decl_line:
-	.2byte 0x0328
-//	DW_AT_decl_column:
-	.byte 0x1d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x704f72745363754e
-	.4byte 0x72707845
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000987
-.DWinfo157:
-//	DW_TAG_structure_type:
-	.byte 0x18
-//	DW_AT_decl_line:
-	.2byte 0x0329
-//	DW_AT_decl_column:
-	.byte 0x08
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_byte_size:
-	.byte 0x10
-//	DW_AT_name:
-	.8byte 0x704f72745363754e
-	.4byte 0x72707845
-	.byte 0x00
-//	DW_AT_sibling:
-	.4byte 0x000009e3
-.DWinfo158:
-//	DW_TAG_member:
-	.byte 0x19
-//	DW_AT_decl_line:
-	.2byte 0x032b
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x00
-//	DW_AT_name:
-	.4byte 0x65707974
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000773
-.DWinfo159:
-//	DW_TAG_member:
-	.byte 0x19
-//	DW_AT_decl_line:
-	.2byte 0x032c
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x04
-//	DW_AT_name:
-	.2byte 0x706f
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000773
-.DWinfo160:
-//	DW_TAG_member:
-	.byte 0x19
-//	DW_AT_decl_line:
-	.2byte 0x032d
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x08
-//	DW_AT_name:
-	.4byte 0x7466656c
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000008f4
-.DWinfo161:
-//	DW_TAG_member:
-	.byte 0x19
-//	DW_AT_decl_line:
-	.2byte 0x032e
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x0c
-//	DW_AT_name:
-	.4byte 0x68676972
-	.2byte 0x0074
-//	DW_AT_type:
-	.4byte 0x000008f4
-	.byte 0x00
-.DWinfo162:
-//	DW_TAG_typedef:
-	.byte 0x17
-//	DW_AT_decl_line:
-	.2byte 0x0331
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x755372745363754e
-	.4byte 0x70784562
-	.2byte 0x0072
-//	DW_AT_type:
-	.4byte 0x000009fb
-.DWinfo163:
-//	DW_TAG_structure_type:
-	.byte 0x18
-//	DW_AT_decl_line:
-	.2byte 0x0332
-//	DW_AT_decl_column:
-	.byte 0x08
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_byte_size:
-	.byte 0x0c
-//	DW_AT_name:
-	.8byte 0x755372745363754e
-	.4byte 0x70784562
-	.2byte 0x0072
-//	DW_AT_sibling:
-	.4byte 0x00000a46
-.DWinfo164:
-//	DW_TAG_member:
-	.byte 0x19
-//	DW_AT_decl_line:
-	.2byte 0x0334
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x00
-//	DW_AT_name:
-	.4byte 0x65707974
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000773
-.DWinfo165:
-//	DW_TAG_member:
-	.byte 0x19
-//	DW_AT_decl_line:
-	.2byte 0x0335
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x04
-//	DW_AT_name:
-	.2byte 0x706f
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000773
-.DWinfo166:
-//	DW_TAG_member:
-	.byte 0x19
-//	DW_AT_decl_line:
-	.2byte 0x0336
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x08
-//	DW_AT_name:
-	.4byte 0x72707865
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000008f4
-	.byte 0x00
-.DWinfo167:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x00000a4b
-.DWinfo168:
-//	DW_TAG_const_type:
-	.byte 0x0e
-//	DW_AT_type:
-	.4byte 0x00000a50
-.DWinfo169:
-//	DW_TAG_base_type:
-	.byte 0x05
-//	DW_AT_byte_size:
-	.byte 0x01
-//	DW_AT_encoding:
-	.byte 0x06
-//	DW_AT_name:
-	.4byte 0x72616863
-	.byte 0x00
-.DWinfo9:
-//	DW_TAG_subprogram:
-	.byte 0x09
-//	DW_AT_decl_line:
-	.2byte 0x03f7
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x614672745363754e
-	.8byte 0x4d72707845617473
-	.4byte 0x34656b61
-	.byte 0x00
-	.8byte 0x614672745363754e
-	.8byte 0x4d72707845617473
-	.4byte 0x34656b61
-	.byte 0x00
-//	DW_AT_low_pc:
-	.4byte NucStrFastaExprMake4
-//	DW_AT_high_pc:
-	.4byte .LNNucStrFastaExprMake4
-//	DW_AT_external:
-	.byte 0x00
-//	DW_AT_sibling:
-	.4byte 0x00000b4c
-.DWinfo170:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x03f7
-//	DW_AT_decl_column:
-	.byte 0x29
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000008ef
-//	DW_AT_name:
-	.4byte 0x72707865
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x08
-.DWinfo171:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x03f7
-//	DW_AT_decl_column:
-	.byte 0x33
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_name:
-	.8byte 0x6e6f697469736f70
-	.2byte 0x6c61
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x0c
-.DWinfo172:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x03f8
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000a46
-//	DW_AT_name:
-	.4byte 0x74736166
-	.2byte 0x0061
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x10
-.DWinfo173:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x03f8
-//	DW_AT_decl_column:
-	.byte 0x1f
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000006e6
-//	DW_AT_name:
-	.4byte 0x657a6973
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x14
-.DWinfo174:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x03fa
-//	DW_AT_decl_column:
-	.byte 0x0c
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0069
-//	DW_AT_type:
-	.4byte 0x000006e6
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x64
-.DWinfo175:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x03fb
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0065
-//	DW_AT_type:
-	.4byte 0x000008f4
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x70
-.DWinfo176:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x03fc
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x006e726574746170
-//	DW_AT_type:
-	.4byte 0x000005c7
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x44
-.DWinfo177:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x03fc
-//	DW_AT_decl_column:
-	.byte 0x17
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6b73616d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000005c7
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x54
-.DWinfo178:
-//	DW_TAG_lexical_block:
-	.byte 0x16
-//	DW_AT_decl_line:
-	.2byte 0x040c
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.4byte ..LN621
-//	DW_AT_high_pc:
-	.4byte ..LN731
-.DWinfo179:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x040d
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x65736162
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000002b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x6c
-	.byte 0x00
-	.byte 0x00
-.DWinfo10:
-//	DW_TAG_subprogram:
-	.byte 0x09
-//	DW_AT_decl_line:
-	.2byte 0x049c
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00000a46
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x00626f735f73736e
-	.8byte 0x00626f735f73736e
-//	DW_AT_low_pc:
-	.4byte nss_sob
-//	DW_AT_high_pc:
-	.4byte .LNnss_sob
-//	DW_AT_external:
-	.byte 0x00
-//	DW_AT_sibling:
-	.4byte 0x00000b94
-.DWinfo180:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x049c
-//	DW_AT_decl_column:
-	.byte 0x23
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000a46
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x08
-.DWinfo181:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x049c
-//	DW_AT_decl_column:
-	.byte 0x32
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000a46
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x0c
-	.byte 0x00
-.DWinfo11:
-//	DW_TAG_subprogram:
-	.byte 0x09
-//	DW_AT_decl_line:
-	.2byte 0x04a6
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00000a46
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x545341465f73736e
-	.4byte 0x78655f41
-	.2byte 0x7270
-	.byte 0x00
-	.8byte 0x545341465f73736e
-	.4byte 0x78655f41
-	.2byte 0x7270
-	.byte 0x00
-//	DW_AT_low_pc:
-	.4byte nss_FASTA_expr
-//	DW_AT_high_pc:
-	.4byte .LNnss_FASTA_expr
-//	DW_AT_external:
-	.byte 0x00
-//	DW_AT_sibling:
-	.4byte 0x00000c69
-.DWinfo182:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x04a6
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000a46
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x08
-.DWinfo183:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x04a6
-//	DW_AT_decl_column:
-	.byte 0x39
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000a46
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x0c
-.DWinfo184:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x04a7
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000008ef
-//	DW_AT_name:
-	.4byte 0x72707865
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x10
-.DWinfo185:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x04a7
-//	DW_AT_decl_column:
-	.byte 0x1d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000c69
-//	DW_AT_name:
-	.4byte 0x74617473
-	.2byte 0x7375
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x14
-.DWinfo186:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x04a7
-//	DW_AT_decl_column:
-	.byte 0x29
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_name:
-	.8byte 0x6e6f697469736f70
-	.2byte 0x6c61
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x18
-.DWinfo187:
-//	DW_TAG_lexical_block:
-	.byte 0x16
-//	DW_AT_decl_line:
-	.2byte 0x04ac
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.4byte ..LN985
-//	DW_AT_high_pc:
-	.4byte ..LN1061
-.DWinfo188:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x04ad
-//	DW_AT_decl_column:
-	.byte 0x15
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x72617473
-	.2byte 0x0074
-//	DW_AT_type:
-	.4byte 0x00000a46
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x70
-.DWinfo189:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x04af
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x65707974
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000773
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x74
-.DWinfo190:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x04b0
-//	DW_AT_decl_column:
-	.byte 0x17
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x0070616d
-//	DW_AT_type:
-	.4byte 0x00000c6e
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x78
-	.byte 0x00
-	.byte 0x00
-.DWinfo191:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x00000784
-.DWinfo192:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x00000c73
-.DWinfo193:
-//	DW_TAG_const_type:
-	.byte 0x0e
-//	DW_AT_type:
-	.4byte 0x00000c78
-.DWinfo194:
-//	DW_TAG_typedef:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.byte 0x25
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x02
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x38746e69
-	.2byte 0x745f
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000a50
-.DWinfo12:
-//	DW_TAG_subprogram:
-	.byte 0x09
-//	DW_AT_decl_line:
-	.2byte 0x04d0
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00000a46
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x747361665f73736e
-	.4byte 0x78655f61
-	.2byte 0x7270
-	.byte 0x00
-	.8byte 0x747361665f73736e
-	.4byte 0x78655f61
-	.2byte 0x7270
-	.byte 0x00
-//	DW_AT_low_pc:
-	.4byte nss_fasta_expr
-//	DW_AT_high_pc:
-	.4byte .LNnss_fasta_expr
-//	DW_AT_external:
-	.byte 0x00
-//	DW_AT_sibling:
-	.4byte 0x00000d19
-.DWinfo195:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x04d0
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000a46
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x08
-.DWinfo196:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x04d0
-//	DW_AT_decl_column:
-	.byte 0x39
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000a46
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x0c
-.DWinfo197:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x04d1
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000008ef
-//	DW_AT_name:
-	.4byte 0x72707865
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x10
-.DWinfo198:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x04d1
-//	DW_AT_decl_column:
-	.byte 0x1d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000c69
-//	DW_AT_name:
-	.4byte 0x74617473
-	.2byte 0x7375
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x14
-.DWinfo199:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x04d1
-//	DW_AT_decl_column:
-	.byte 0x29
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_name:
-	.8byte 0x6e6f697469736f70
-	.2byte 0x6c61
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x18
-	.byte 0x00
-.DWinfo13:
-//	DW_TAG_subprogram:
-	.byte 0x09
-//	DW_AT_decl_line:
-	.2byte 0x0509
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00000a46
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x6d6972705f73736e
-	.8byte 0x727078655f797261
-	.byte 0x00
-	.8byte 0x6d6972705f73736e
-	.8byte 0x727078655f797261
-	.byte 0x00
-//	DW_AT_low_pc:
-	.4byte nss_primary_expr
-//	DW_AT_high_pc:
-	.4byte .LNnss_primary_expr
-//	DW_AT_external:
-	.byte 0x00
-//	DW_AT_sibling:
-	.4byte 0x00000dbd
-.DWinfo200:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0509
-//	DW_AT_decl_column:
-	.byte 0x2c
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000a46
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x08
-.DWinfo201:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0509
-//	DW_AT_decl_column:
-	.byte 0x3b
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000a46
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x0c
-.DWinfo202:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x050a
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000008ef
-//	DW_AT_name:
-	.4byte 0x72707865
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x10
-.DWinfo203:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x050a
-//	DW_AT_decl_column:
-	.byte 0x1d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000c69
-//	DW_AT_name:
-	.4byte 0x74617473
-	.2byte 0x7375
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x14
-.DWinfo204:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x050a
-//	DW_AT_decl_column:
-	.byte 0x29
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_name:
-	.8byte 0x6e6f697469736f70
-	.2byte 0x6c61
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x18
-.DWinfo205:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x050c
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0065
-//	DW_AT_type:
-	.4byte 0x000008f4
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x6c
-	.byte 0x00
-.DWinfo14:
-//	DW_TAG_subprogram:
-	.byte 0x09
-//	DW_AT_decl_line:
-	.2byte 0x054f
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00000a46
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x72616e755f73736e
-	.4byte 0x78655f79
-	.2byte 0x7270
-	.byte 0x00
-	.8byte 0x72616e755f73736e
-	.4byte 0x78655f79
-	.2byte 0x7270
-	.byte 0x00
-//	DW_AT_low_pc:
-	.4byte nss_unary_expr
-//	DW_AT_high_pc:
-	.4byte .LNnss_unary_expr
-//	DW_AT_external:
-	.byte 0x00
-//	DW_AT_sibling:
-	.4byte 0x00000e6b
-.DWinfo206:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x054f
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000a46
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x08
-.DWinfo207:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x054f
-//	DW_AT_decl_column:
-	.byte 0x39
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000a46
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x0c
-.DWinfo208:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0550
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000008ef
-//	DW_AT_name:
-	.4byte 0x72707865
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x10
-.DWinfo209:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0550
-//	DW_AT_decl_column:
-	.byte 0x1d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000c69
-//	DW_AT_name:
-	.4byte 0x74617473
-	.2byte 0x7375
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x14
-.DWinfo210:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0550
-//	DW_AT_decl_column:
-	.byte 0x29
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_name:
-	.8byte 0x6e6f697469736f70
-	.2byte 0x6c61
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x18
-.DWinfo211:
-//	DW_TAG_lexical_block:
-	.byte 0x16
-//	DW_AT_decl_line:
-	.2byte 0x0562
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.4byte ..LN1393
-//	DW_AT_high_pc:
-	.4byte ..LN1437
-.DWinfo212:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0563
-//	DW_AT_decl_column:
-	.byte 0x15
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0065
-//	DW_AT_type:
-	.4byte 0x000008f4
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x68
-	.byte 0x00
-	.byte 0x00
-.DWinfo15:
-//	DW_TAG_subprogram:
-	.byte 0x09
-//	DW_AT_decl_line:
-	.2byte 0x057c
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00000a46
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x727078655f73736e
-	.byte 0x00
-	.8byte 0x727078655f73736e
-	.byte 0x00
-//	DW_AT_low_pc:
-	.4byte nss_expr
-//	DW_AT_high_pc:
-	.4byte .LNnss_expr
-//	DW_AT_external:
-	.byte 0x00
-//	DW_AT_sibling:
-	.4byte 0x00000f1d
-.DWinfo213:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x057c
-//	DW_AT_decl_column:
-	.byte 0x24
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000a46
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x08
-.DWinfo214:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x057c
-//	DW_AT_decl_column:
-	.byte 0x33
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000a46
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x0c
-.DWinfo215:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x057d
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000008ef
-//	DW_AT_name:
-	.4byte 0x72707865
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x10
-.DWinfo216:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x057d
-//	DW_AT_decl_column:
-	.byte 0x1d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000c69
-//	DW_AT_name:
-	.4byte 0x74617473
-	.2byte 0x7375
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x14
-.DWinfo217:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x057d
-//	DW_AT_decl_column:
-	.byte 0x29
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_name:
-	.8byte 0x6e6f697469736f70
-	.2byte 0x6c61
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x18
-.DWinfo218:
-//	DW_TAG_lexical_block:
-	.byte 0x16
-//	DW_AT_decl_line:
-	.2byte 0x0589
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.4byte ..LN1491
-//	DW_AT_high_pc:
-	.4byte ..LN1591
-.DWinfo219:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x058a
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x706f
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000773
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x5c
-.DWinfo220:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x058b
-//	DW_AT_decl_column:
-	.byte 0x1d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0065
-//	DW_AT_type:
-	.4byte 0x000008f4
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x60
-	.byte 0x00
-	.byte 0x00
-.DWinfo16:
-//	DW_TAG_subprogram:
-	.byte 0x09
-//	DW_AT_decl_line:
-	.2byte 0x05cb
-//	DW_AT_decl_column:
-	.byte 0x06
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x000002d6
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x747372745363754e
-	.4byte 0x696e4972
-	.2byte 0x0074
-	.8byte 0x747372745363754e
-	.4byte 0x696e4972
-	.2byte 0x0074
-//	DW_AT_low_pc:
-	.4byte NucStrstrInit
-//	DW_AT_high_pc:
-	.4byte .LNNucStrstrInit
-//	DW_AT_external:
-	.byte 0x00
-//	DW_AT_sibling:
-	.4byte 0x00000fdb
-.DWinfo221:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x05cd
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6863
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x5c
-.DWinfo222:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x05ce
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0069
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x54
-.DWinfo223:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x05cf
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_type:
-	.4byte 0x00000a46
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x58
-.DWinfo224:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x05cf
-//	DW_AT_decl_column:
-	.byte 0x15
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x00616e326962636e
-//	DW_AT_type:
-	.4byte 0x00000a46
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x4c
-.DWinfo225:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x05d0
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x00616e346962636e
-//	DW_AT_type:
-	.4byte 0x00000a46
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x50
-.DWinfo226:
-//	DW_TAG_lexical_block:
-	.byte 0x16
-//	DW_AT_decl_line:
-	.2byte 0x05e7
-//	DW_AT_decl_column:
-	.byte 0x1c
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.4byte ..LN1699
-//	DW_AT_high_pc:
-	.4byte ..LN1715
-.DWinfo227:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x05e7
-//	DW_AT_decl_column:
-	.byte 0x1c
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00765f5f
-//	DW_AT_type:
-	.4byte 0x000002c4
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x7c
-.DWinfo228:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x05e7
-//	DW_AT_decl_column:
-	.byte 0x1c
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00785f5f
-//	DW_AT_type:
-	.4byte 0x000002c4
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x78
-	.byte 0x00
-	.byte 0x00
-.DWinfo17:
-//	DW_TAG_subprogram:
-	.byte 0x09
-//	DW_AT_decl_line:
-	.2byte 0x0601
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x747372745363754e
-	.4byte 0x6b614d72
-	.2byte 0x0065
-	.8byte 0x747372745363754e
-	.4byte 0x6b614d72
-	.2byte 0x0065
-//	DW_AT_low_pc:
-	.4byte NucStrstrMake
-//	DW_AT_high_pc:
-	.4byte .LNNucStrstrMake
-//	DW_AT_external:
-	.byte 0x01
-//	DW_AT_sibling:
-	.4byte 0x0000108d
-.DWinfo229:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0601
-//	DW_AT_decl_column:
-	.byte 0x21
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x0000108d
-//	DW_AT_name:
-	.4byte 0x0073736e
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x08
-.DWinfo230:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0601
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_name:
-	.8byte 0x6e6f697469736f70
-	.2byte 0x6c61
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x0c
-.DWinfo231:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0602
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00000a46
-//	DW_AT_name:
-	.4byte 0x72657571
-	.2byte 0x0079
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x10
-.DWinfo232:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0602
-//	DW_AT_decl_column:
-	.byte 0x25
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_name:
-	.4byte 0x006e656c
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x14
-.DWinfo233:
-//	DW_TAG_lexical_block:
-	.byte 0x16
-//	DW_AT_decl_line:
-	.2byte 0x0607
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.4byte ..LN1731
-//	DW_AT_high_pc:
-	.4byte ..LN1783
-.DWinfo234:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0608
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x74617473
-	.2byte 0x7375
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x6c
-.DWinfo235:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0609
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_type:
-	.4byte 0x00000a46
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x70
-	.byte 0x00
-	.byte 0x00
-.DWinfo236:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x00001092
-.DWinfo237:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x0000090e
-.DWinfo18:
-//	DW_TAG_subprogram:
-	.byte 0x09
-//	DW_AT_decl_line:
-	.2byte 0x0625
-//	DW_AT_decl_column:
-	.byte 0x06
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x000002d6
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x747372745363754e
-	.4byte 0x61685772
-	.2byte 0x6b63
-	.byte 0x00
-	.8byte 0x747372745363754e
-	.4byte 0x61685772
-	.2byte 0x6b63
-	.byte 0x00
-//	DW_AT_low_pc:
-	.4byte NucStrstrWhack
-//	DW_AT_high_pc:
-	.4byte .LNNucStrstrWhack
-//	DW_AT_external:
-	.byte 0x01
-//	DW_AT_sibling:
-	.4byte 0x000010e0
-.DWinfo238:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0625
-//	DW_AT_decl_column:
-	.byte 0x22
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00001092
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x08
-	.byte 0x00
-.DWinfo19:
-//	DW_TAG_subprogram:
-	.byte 0x09
-//	DW_AT_decl_line:
-	.2byte 0x0892
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x616e325f6c617665
-	.2byte 0x385f
-	.byte 0x00
-	.8byte 0x616e325f6c617665
-	.2byte 0x385f
-	.byte 0x00
-//	DW_AT_low_pc:
-	.4byte eval_2na_8
-//	DW_AT_high_pc:
-	.4byte .LNeval_2na_8
-//	DW_AT_external:
-	.byte 0x00
-//	DW_AT_sibling:
-	.4byte 0x000012f1
-.DWinfo239:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0892
-//	DW_AT_decl_column:
-	.byte 0x29
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000012f1
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x08
-.DWinfo240:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0893
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000012fb
-//	DW_AT_name:
-	.8byte 0x00616e326962636e
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x0c
-.DWinfo241:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0893
-//	DW_AT_decl_column:
-	.byte 0x27
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_name:
-	.4byte 0x00736f70
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x10
-.DWinfo242:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0893
-//	DW_AT_decl_column:
-	.byte 0x39
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_name:
-	.4byte 0x006e656c
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x14
-.DWinfo243:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x08a1
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x66667562
-	.2byte 0x7265
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7e987503
-.DWinfo244:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x08a1
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6972
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7e887503
-.DWinfo245:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x08a2
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3070
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ea87503
-.DWinfo246:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x08a2
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3170
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ec87503
-.DWinfo247:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x08a2
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3270
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ee87503
-.DWinfo248:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x08a2
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3370
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7f887503
-.DWinfo249:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x08a2
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x306d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7eb87503
-.DWinfo250:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x08a2
-//	DW_AT_decl_column:
-	.byte 0x22
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x316d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ed87503
-.DWinfo251:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x08a2
-//	DW_AT_decl_column:
-	.byte 0x26
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x326d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ef87503
-.DWinfo252:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x08a2
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x336d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7f987503
-.DWinfo253:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x08a5
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6172
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x70
-.DWinfo254:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x08a5
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6272
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x6c
-.DWinfo255:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x08a5
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6372
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x68
-.DWinfo256:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x08a5
-//	DW_AT_decl_column:
-	.byte 0x15
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6472
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x58
-.DWinfo257:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x08a8
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x737361705f6d756e
-	.2byte 0x7365
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x74
-.DWinfo258:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x08a8
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x706f7473
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x60
-.DWinfo259:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x08b1
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x64
-.DWinfo260:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x08b1
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00637273
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x5c
-.DWinfo261:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x08b2
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6e656c71
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x7c
-.DWinfo262:
-//	DW_TAG_lexical_block:
-	.byte 0x16
-//	DW_AT_decl_line:
-	.2byte 0x090a
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.4byte ..LN1981
-//	DW_AT_high_pc:
-	.4byte ..LN2067
-.DWinfo263:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x091b
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6166
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.4byte 0x7fb87503
-.DWinfo264:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x091c
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6266
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.4byte 0x7fbc7503
-.DWinfo265:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x091d
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6366
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x40
-.DWinfo266:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x091e
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6466
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x44
-	.byte 0x00
-	.byte 0x00
-.DWinfo267:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x000012f6
-.DWinfo268:
-//	DW_TAG_const_type:
-	.byte 0x0e
-//	DW_AT_type:
-	.4byte 0x000006fb
-.DWinfo269:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x00001300
-.DWinfo270:
-//	DW_TAG_const_type:
-	.byte 0x0e
-//	DW_AT_type:
-	.4byte 0x000002d6
-.DWinfo271:
-//	DW_TAG_typedef:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.byte 0x40
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x745f67657263756e
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000473
-.DWinfo20:
-//	DW_TAG_subprogram:
-	.byte 0x09
-//	DW_AT_decl_line:
-	.2byte 0x09b7
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x616e325f6c617665
-	.4byte 0x0036315f
-	.8byte 0x616e325f6c617665
-	.4byte 0x0036315f
-//	DW_AT_low_pc:
-	.4byte eval_2na_16
-//	DW_AT_high_pc:
-	.4byte .LNeval_2na_16
-//	DW_AT_external:
-	.byte 0x00
-//	DW_AT_sibling:
-	.4byte 0x0000154d
-.DWinfo272:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x09b7
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000012f1
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x08
-.DWinfo273:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x09b8
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000012fb
-//	DW_AT_name:
-	.8byte 0x00616e326962636e
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x0c
-.DWinfo274:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x09b8
-//	DW_AT_decl_column:
-	.byte 0x27
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_name:
-	.4byte 0x00736f70
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x10
-.DWinfo275:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x09b8
-//	DW_AT_decl_column:
-	.byte 0x39
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_name:
-	.4byte 0x006e656c
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x14
-.DWinfo276:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x09c6
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x66667562
-	.2byte 0x7265
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7e887503
-.DWinfo277:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x09c6
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6972
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7df87503
-.DWinfo278:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x09c7
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3070
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7e987503
-.DWinfo279:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x09c7
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3170
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7eb87503
-.DWinfo280:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x09c7
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3270
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ed87503
-.DWinfo281:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x09c7
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3370
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ef87503
-.DWinfo282:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x09c7
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x306d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ea87503
-.DWinfo283:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x09c7
-//	DW_AT_decl_column:
-	.byte 0x22
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x316d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ec87503
-.DWinfo284:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x09c7
-//	DW_AT_decl_column:
-	.byte 0x26
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x326d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ee87503
-.DWinfo285:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x09c7
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x336d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7f887503
-.DWinfo286:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x09ca
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6172
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x68
-.DWinfo287:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x09ca
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6272
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x64
-.DWinfo288:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x09ca
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6372
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x60
-.DWinfo289:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x09ca
-//	DW_AT_decl_column:
-	.byte 0x15
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6472
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x4c
-.DWinfo290:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x09cd
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x737361705f6d756e
-	.2byte 0x7365
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x6c
-.DWinfo291:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x09cd
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x706f7473
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x54
-.DWinfo292:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x09d2
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6d616c73
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x48
-.DWinfo293:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x09d3
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x5c
-.DWinfo294:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x09d6
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x58
-.DWinfo295:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x09d6
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00637273
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x50
-.DWinfo296:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x09d7
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6e656c71
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x74
-.DWinfo297:
-//	DW_TAG_lexical_block:
-	.byte 0x16
-//	DW_AT_decl_line:
-	.2byte 0x0a2f
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.4byte ..LN2271
-//	DW_AT_high_pc:
-	.4byte ..LN2357
-.DWinfo298:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0a40
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6166
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.4byte 0x7fa87503
-.DWinfo299:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0a41
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6266
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.4byte 0x7fac7503
-.DWinfo300:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0a42
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6366
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.4byte 0x7fb07503
-.DWinfo301:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0a43
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6466
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.4byte 0x7fb47503
-	.byte 0x00
-	.byte 0x00
-.DWinfo21:
-//	DW_TAG_subprogram:
-	.byte 0x09
-//	DW_AT_decl_line:
-	.2byte 0x0adc
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x616e325f6c617665
-	.4byte 0x0032335f
-	.8byte 0x616e325f6c617665
-	.4byte 0x0032335f
-//	DW_AT_low_pc:
-	.4byte eval_2na_32
-//	DW_AT_high_pc:
-	.4byte .LNeval_2na_32
-//	DW_AT_external:
-	.byte 0x00
-//	DW_AT_sibling:
-	.4byte 0x00001783
-.DWinfo302:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0adc
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000012f1
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x08
-.DWinfo303:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0add
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000012fb
-//	DW_AT_name:
-	.8byte 0x00616e326962636e
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x0c
-.DWinfo304:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0add
-//	DW_AT_decl_column:
-	.byte 0x27
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_name:
-	.4byte 0x00736f70
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x10
-.DWinfo305:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0add
-//	DW_AT_decl_column:
-	.byte 0x39
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_name:
-	.4byte 0x006e656c
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x14
-.DWinfo306:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0aeb
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x66667562
-	.2byte 0x7265
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7e887503
-.DWinfo307:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0aeb
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6972
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7df87503
-.DWinfo308:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0aec
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3070
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7e987503
-.DWinfo309:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0aec
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3170
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7eb87503
-.DWinfo310:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0aec
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3270
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ed87503
-.DWinfo311:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0aec
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3370
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ef87503
-.DWinfo312:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0aec
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x306d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ea87503
-.DWinfo313:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0aec
-//	DW_AT_decl_column:
-	.byte 0x22
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x316d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ec87503
-.DWinfo314:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0aec
-//	DW_AT_decl_column:
-	.byte 0x26
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x326d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ee87503
-.DWinfo315:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0aec
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x336d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7f887503
-.DWinfo316:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0aef
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6172
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x68
-.DWinfo317:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0aef
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6272
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x64
-.DWinfo318:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0aef
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6372
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x60
-.DWinfo319:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0aef
-//	DW_AT_decl_column:
-	.byte 0x15
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6472
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x4c
-.DWinfo320:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0af2
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x737361705f6d756e
-	.2byte 0x7365
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x6c
-.DWinfo321:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0af2
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x706f7473
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x54
-.DWinfo322:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0af7
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6d616c73
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x48
-.DWinfo323:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0af8
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x5c
-.DWinfo324:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0afb
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x58
-.DWinfo325:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0afb
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00637273
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x50
-.DWinfo326:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0afc
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6e656c71
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x74
-.DWinfo327:
-//	DW_TAG_lexical_block:
-	.byte 0x16
-//	DW_AT_decl_line:
-	.2byte 0x0b54
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.4byte ..LN2603
-//	DW_AT_high_pc:
-	.4byte ..LN2689
-.DWinfo328:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0b65
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6166
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.4byte 0x7fa87503
-.DWinfo329:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0b66
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6266
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.4byte 0x7fac7503
-.DWinfo330:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0b67
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6366
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.4byte 0x7fb07503
-.DWinfo331:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0b68
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6466
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.4byte 0x7fb47503
-	.byte 0x00
-	.byte 0x00
-.DWinfo22:
-//	DW_TAG_subprogram:
-	.byte 0x09
-//	DW_AT_decl_line:
-	.2byte 0x0c01
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x616e325f6c617665
-	.4byte 0x0034365f
-	.8byte 0x616e325f6c617665
-	.4byte 0x0034365f
-//	DW_AT_low_pc:
-	.4byte eval_2na_64
-//	DW_AT_high_pc:
-	.4byte .LNeval_2na_64
-//	DW_AT_external:
-	.byte 0x00
-//	DW_AT_sibling:
-	.4byte 0x000019b9
-.DWinfo332:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0c01
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000012f1
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x08
-.DWinfo333:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0c02
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000012fb
-//	DW_AT_name:
-	.8byte 0x00616e326962636e
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x0c
-.DWinfo334:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0c02
-//	DW_AT_decl_column:
-	.byte 0x27
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_name:
-	.4byte 0x00736f70
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x10
-.DWinfo335:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0c02
-//	DW_AT_decl_column:
-	.byte 0x39
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_name:
-	.4byte 0x006e656c
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x14
-.DWinfo336:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0c11
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x66667562
-	.2byte 0x7265
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7e887503
-.DWinfo337:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0c11
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6972
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7df87503
-.DWinfo338:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0c12
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3070
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7e987503
-.DWinfo339:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0c12
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3170
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7eb87503
-.DWinfo340:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0c12
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3270
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ed87503
-.DWinfo341:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0c12
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3370
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ef87503
-.DWinfo342:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0c12
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x306d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ea87503
-.DWinfo343:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0c12
-//	DW_AT_decl_column:
-	.byte 0x22
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x316d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ec87503
-.DWinfo344:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0c12
-//	DW_AT_decl_column:
-	.byte 0x26
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x326d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ee87503
-.DWinfo345:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0c12
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x336d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7f887503
-.DWinfo346:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0c15
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6172
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x68
-.DWinfo347:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0c15
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6272
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x64
-.DWinfo348:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0c15
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6372
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x60
-.DWinfo349:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0c15
-//	DW_AT_decl_column:
-	.byte 0x15
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6472
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x4c
-.DWinfo350:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0c18
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x737361705f6d756e
-	.2byte 0x7365
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x6c
-.DWinfo351:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0c18
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x706f7473
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x54
-.DWinfo352:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0c1d
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6d616c73
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x48
-.DWinfo353:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0c1e
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x5c
-.DWinfo354:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0c21
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x58
-.DWinfo355:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0c21
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00637273
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x50
-.DWinfo356:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0c22
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6e656c71
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x74
-.DWinfo357:
-//	DW_TAG_lexical_block:
-	.byte 0x16
-//	DW_AT_decl_line:
-	.2byte 0x0c7a
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.4byte ..LN2943
-//	DW_AT_high_pc:
-	.4byte ..LN3029
-.DWinfo358:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0c8b
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6166
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.4byte 0x7fa87503
-.DWinfo359:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0c8c
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6266
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.4byte 0x7fac7503
-.DWinfo360:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0c8d
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6366
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.4byte 0x7fb07503
-.DWinfo361:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0c8e
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6466
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.4byte 0x7fb47503
-	.byte 0x00
-	.byte 0x00
-.DWinfo23:
-//	DW_TAG_subprogram:
-	.byte 0x09
-//	DW_AT_decl_line:
-	.2byte 0x0d27
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x616e325f6c617665
-	.4byte 0x3832315f
-	.byte 0x00
-	.8byte 0x616e325f6c617665
-	.4byte 0x3832315f
-	.byte 0x00
-//	DW_AT_low_pc:
-	.4byte eval_2na_128
-//	DW_AT_high_pc:
-	.4byte .LNeval_2na_128
-//	DW_AT_external:
-	.byte 0x00
-//	DW_AT_sibling:
-	.4byte 0x00001b9f
-.DWinfo362:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0d27
-//	DW_AT_decl_column:
-	.byte 0x2b
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000012f1
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x08
-.DWinfo363:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0d28
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000012fb
-//	DW_AT_name:
-	.8byte 0x00616e326962636e
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x0c
-.DWinfo364:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0d28
-//	DW_AT_decl_column:
-	.byte 0x27
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_name:
-	.4byte 0x00736f70
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x10
-.DWinfo365:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0d28
-//	DW_AT_decl_column:
-	.byte 0x39
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_name:
-	.4byte 0x006e656c
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x14
-.DWinfo366:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0d36
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x66667562
-	.2byte 0x7265
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ea87503
-.DWinfo367:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0d36
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6972
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7e987503
-.DWinfo368:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0d37
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3070
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7eb87503
-.DWinfo369:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0d37
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3170
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ed87503
-.DWinfo370:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0d37
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3270
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ef87503
-.DWinfo371:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0d37
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3370
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7f987503
-.DWinfo372:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0d37
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x306d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ec87503
-.DWinfo373:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0d37
-//	DW_AT_decl_column:
-	.byte 0x22
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x316d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ee87503
-.DWinfo374:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0d37
-//	DW_AT_decl_column:
-	.byte 0x26
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x326d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7f887503
-.DWinfo375:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0d37
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x336d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7fa87503
-.DWinfo376:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0d3a
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6172
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x6c
-.DWinfo377:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0d3a
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6272
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x68
-.DWinfo378:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0d3a
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6372
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x64
-.DWinfo379:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0d3a
-//	DW_AT_decl_column:
-	.byte 0x15
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6472
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x50
-.DWinfo380:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0d3d
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x737361705f6d756e
-	.2byte 0x7365
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x70
-.DWinfo381:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0d3d
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x706f7473
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x58
-.DWinfo382:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0d42
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6d616c73
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x4c
-.DWinfo383:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0d43
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x60
-.DWinfo384:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0d46
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x5c
-.DWinfo385:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0d46
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00637273
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x54
-.DWinfo386:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0d47
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6e656c71
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x78
-	.byte 0x00
-.DWinfo24:
-//	DW_TAG_subprogram:
-	.byte 0x09
-//	DW_AT_decl_line:
-	.2byte 0x0e4c
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x616e325f6c617665
-	.4byte 0x736f705f
-	.byte 0x00
-	.8byte 0x616e325f6c617665
-	.4byte 0x736f705f
-	.byte 0x00
-//	DW_AT_low_pc:
-	.4byte eval_2na_pos
-//	DW_AT_high_pc:
-	.4byte .LNeval_2na_pos
-//	DW_AT_external:
-	.byte 0x00
-//	DW_AT_sibling:
-	.4byte 0x00001d98
-.DWinfo387:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0e4c
-//	DW_AT_decl_column:
-	.byte 0x2b
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000012f1
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x08
-.DWinfo388:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0e4d
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000012fb
-//	DW_AT_name:
-	.8byte 0x00616e326962636e
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x0c
-.DWinfo389:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0e4d
-//	DW_AT_decl_column:
-	.byte 0x27
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_name:
-	.4byte 0x00736f70
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x10
-.DWinfo390:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0e4d
-//	DW_AT_decl_column:
-	.byte 0x39
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_name:
-	.4byte 0x006e656c
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x14
-.DWinfo391:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0e5c
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x66667562
-	.2byte 0x7265
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ea87503
-.DWinfo392:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0e5c
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6972
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7e987503
-.DWinfo393:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0e5d
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3070
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7eb87503
-.DWinfo394:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0e5d
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3170
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ed87503
-.DWinfo395:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0e5d
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3270
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ef87503
-.DWinfo396:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0e5d
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3370
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7f987503
-.DWinfo397:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0e5d
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x306d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ec87503
-.DWinfo398:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0e5d
-//	DW_AT_decl_column:
-	.byte 0x22
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x316d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ee87503
-.DWinfo399:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0e5d
-//	DW_AT_decl_column:
-	.byte 0x26
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x326d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7f887503
-.DWinfo400:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0e5d
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x336d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7fa87503
-.DWinfo401:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0e60
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6172
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x70
-.DWinfo402:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0e60
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6272
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x6c
-.DWinfo403:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0e60
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6372
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x68
-.DWinfo404:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0e60
-//	DW_AT_decl_column:
-	.byte 0x15
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6472
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x50
-.DWinfo405:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0e63
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x737361705f6d756e
-	.2byte 0x7365
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x74
-.DWinfo406:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0e63
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x706f7473
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x5c
-.DWinfo407:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0e67
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x72617473
-	.2byte 0x0074
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x54
-.DWinfo408:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0e6d
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6d616c73
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x4c
-.DWinfo409:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0e6e
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x64
-.DWinfo410:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0e71
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x60
-.DWinfo411:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0e71
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00637273
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x58
-.DWinfo412:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0e72
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6e656c71
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x7c
-	.byte 0x00
-.DWinfo25:
-//	DW_TAG_subprogram:
-	.byte 0x09
-//	DW_AT_decl_line:
-	.2byte 0x0fd7
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x616e345f6c617665
-	.4byte 0x0036315f
-	.8byte 0x616e345f6c617665
-	.4byte 0x0036315f
-//	DW_AT_low_pc:
-	.4byte eval_4na_16
-//	DW_AT_high_pc:
-	.4byte .LNeval_4na_16
-//	DW_AT_external:
-	.byte 0x00
-//	DW_AT_sibling:
-	.4byte 0x00001fbc
-.DWinfo413:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0fd7
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000012f1
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x08
-.DWinfo414:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0fd8
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000012fb
-//	DW_AT_name:
-	.8byte 0x00616e326962636e
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x0c
-.DWinfo415:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0fd8
-//	DW_AT_decl_column:
-	.byte 0x27
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_name:
-	.4byte 0x00736f70
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x10
-.DWinfo416:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x0fd8
-//	DW_AT_decl_column:
-	.byte 0x39
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_name:
-	.4byte 0x006e656c
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x14
-.DWinfo417:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0fe6
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x66667562
-	.2byte 0x7265
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7e987503
-.DWinfo418:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0fe6
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6972
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7df87503
-.DWinfo419:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0fe6
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6a72
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7e887503
-.DWinfo420:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0fe7
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3070
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ea87503
-.DWinfo421:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0fe7
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3170
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ec87503
-.DWinfo422:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0fe7
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3270
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ee87503
-.DWinfo423:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0fe7
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3370
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7f887503
-.DWinfo424:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0fe7
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x306d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7eb87503
-.DWinfo425:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0fe7
-//	DW_AT_decl_column:
-	.byte 0x22
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x316d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ed87503
-.DWinfo426:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0fe7
-//	DW_AT_decl_column:
-	.byte 0x26
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x326d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ef87503
-.DWinfo427:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0fe7
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x336d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7f987503
-.DWinfo428:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0fea
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6172
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x70
-.DWinfo429:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0fea
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6272
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x6c
-.DWinfo430:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0fea
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6372
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x68
-.DWinfo431:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0fea
-//	DW_AT_decl_column:
-	.byte 0x15
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6472
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x58
-.DWinfo432:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0fed
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x737361705f6d756e
-	.2byte 0x7365
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x74
-.DWinfo433:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0fed
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x706f7473
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x60
-.DWinfo434:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0ff2
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x64
-.DWinfo435:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0ff2
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00637273
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x5c
-.DWinfo436:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0ff3
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6e656c71
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x7c
-.DWinfo437:
-//	DW_TAG_lexical_block:
-	.byte 0x16
-//	DW_AT_decl_line:
-	.2byte 0x104d
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.4byte ..LN3933
-//	DW_AT_high_pc:
-	.4byte ..LN4023
-.DWinfo438:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x105e
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6166
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.4byte 0x7fb87503
-.DWinfo439:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x105f
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6266
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.4byte 0x7fbc7503
-.DWinfo440:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1060
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6366
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x40
-.DWinfo441:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1061
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6466
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x44
-	.byte 0x00
-	.byte 0x00
-.DWinfo26:
-//	DW_TAG_subprogram:
-	.byte 0x09
-//	DW_AT_decl_line:
-	.2byte 0x10b5
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x616e345f6c617665
-	.4byte 0x0032335f
-	.8byte 0x616e345f6c617665
-	.4byte 0x0032335f
-//	DW_AT_low_pc:
-	.4byte eval_4na_32
-//	DW_AT_high_pc:
-	.4byte .LNeval_4na_32
-//	DW_AT_external:
-	.byte 0x00
-//	DW_AT_sibling:
-	.4byte 0x000021f1
-.DWinfo442:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x10b5
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000012f1
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x08
-.DWinfo443:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x10b6
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000012fb
-//	DW_AT_name:
-	.8byte 0x00616e326962636e
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x0c
-.DWinfo444:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x10b6
-//	DW_AT_decl_column:
-	.byte 0x27
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_name:
-	.4byte 0x00736f70
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x10
-.DWinfo445:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x10b6
-//	DW_AT_decl_column:
-	.byte 0x39
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_name:
-	.4byte 0x006e656c
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x14
-.DWinfo446:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x10c4
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x66667562
-	.2byte 0x7265
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7e887503
-.DWinfo447:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x10c4
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6972
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7de87503
-.DWinfo448:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x10c4
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6a72
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7df87503
-.DWinfo449:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x10c5
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3070
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7e987503
-.DWinfo450:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x10c5
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3170
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7eb87503
-.DWinfo451:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x10c5
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3270
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ed87503
-.DWinfo452:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x10c5
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3370
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ef87503
-.DWinfo453:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x10c5
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x306d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ea87503
-.DWinfo454:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x10c5
-//	DW_AT_decl_column:
-	.byte 0x22
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x316d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ec87503
-.DWinfo455:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x10c5
-//	DW_AT_decl_column:
-	.byte 0x26
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x326d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ee87503
-.DWinfo456:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x10c5
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x336d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7f887503
-.DWinfo457:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x10c8
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6172
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x64
-.DWinfo458:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x10c8
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6272
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x60
-.DWinfo459:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x10c8
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6372
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x5c
-.DWinfo460:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x10c8
-//	DW_AT_decl_column:
-	.byte 0x15
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6472
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x48
-.DWinfo461:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x10cb
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x737361705f6d756e
-	.2byte 0x7365
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x68
-.DWinfo462:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x10cb
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x706f7473
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x50
-.DWinfo463:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x10ce
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x58
-.DWinfo464:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x10d0
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x54
-.DWinfo465:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x10d0
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00637273
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x4c
-.DWinfo466:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x10d1
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6e656c71
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x70
-.DWinfo467:
-//	DW_TAG_lexical_block:
-	.byte 0x16
-//	DW_AT_decl_line:
-	.2byte 0x112b
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.4byte ..LN4249
-//	DW_AT_high_pc:
-	.4byte ..LN4339
-.DWinfo468:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x113c
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6166
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.4byte 0x7fa87503
-.DWinfo469:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x113d
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6266
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.4byte 0x7fac7503
-.DWinfo470:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x113e
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6366
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.4byte 0x7fb07503
-.DWinfo471:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x113f
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6466
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.4byte 0x7fb47503
-	.byte 0x00
-	.byte 0x00
-.DWinfo27:
-//	DW_TAG_subprogram:
-	.byte 0x09
-//	DW_AT_decl_line:
-	.2byte 0x1193
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x616e345f6c617665
-	.4byte 0x0034365f
-	.8byte 0x616e345f6c617665
-	.4byte 0x0034365f
-//	DW_AT_low_pc:
-	.4byte eval_4na_64
-//	DW_AT_high_pc:
-	.4byte .LNeval_4na_64
-//	DW_AT_external:
-	.byte 0x00
-//	DW_AT_sibling:
-	.4byte 0x00002426
-.DWinfo472:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x1193
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000012f1
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x08
-.DWinfo473:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x1194
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000012fb
-//	DW_AT_name:
-	.8byte 0x00616e326962636e
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x0c
-.DWinfo474:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x1194
-//	DW_AT_decl_column:
-	.byte 0x27
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_name:
-	.4byte 0x00736f70
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x10
-.DWinfo475:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x1194
-//	DW_AT_decl_column:
-	.byte 0x39
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_name:
-	.4byte 0x006e656c
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x14
-.DWinfo476:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x11a3
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x66667562
-	.2byte 0x7265
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7e887503
-.DWinfo477:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x11a3
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6972
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7de87503
-.DWinfo478:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x11a3
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6a72
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7df87503
-.DWinfo479:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x11a4
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3070
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7e987503
-.DWinfo480:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x11a4
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3170
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7eb87503
-.DWinfo481:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x11a4
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3270
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ed87503
-.DWinfo482:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x11a4
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3370
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ef87503
-.DWinfo483:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x11a4
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x306d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ea87503
-.DWinfo484:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x11a4
-//	DW_AT_decl_column:
-	.byte 0x22
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x316d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ec87503
-.DWinfo485:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x11a4
-//	DW_AT_decl_column:
-	.byte 0x26
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x326d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ee87503
-.DWinfo486:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x11a4
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x336d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7f887503
-.DWinfo487:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x11a7
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6172
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x64
-.DWinfo488:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x11a7
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6272
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x60
-.DWinfo489:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x11a7
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6372
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x5c
-.DWinfo490:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x11a7
-//	DW_AT_decl_column:
-	.byte 0x15
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6472
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x48
-.DWinfo491:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x11aa
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x737361705f6d756e
-	.2byte 0x7365
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x68
-.DWinfo492:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x11aa
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x706f7473
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x50
-.DWinfo493:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x11ad
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x58
-.DWinfo494:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x11af
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x54
-.DWinfo495:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x11af
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00637273
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x4c
-.DWinfo496:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x11b0
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6e656c71
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x70
-.DWinfo497:
-//	DW_TAG_lexical_block:
-	.byte 0x16
-//	DW_AT_decl_line:
-	.2byte 0x120a
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.4byte ..LN4599
-//	DW_AT_high_pc:
-	.4byte ..LN4689
-.DWinfo498:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x121b
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6166
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.4byte 0x7fa87503
-.DWinfo499:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x121c
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6266
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.4byte 0x7fac7503
-.DWinfo500:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x121d
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6366
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.4byte 0x7fb07503
-.DWinfo501:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x121e
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6466
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.4byte 0x7fb47503
-	.byte 0x00
-	.byte 0x00
-.DWinfo28:
-//	DW_TAG_subprogram:
-	.byte 0x09
-//	DW_AT_decl_line:
-	.2byte 0x1272
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x616e345f6c617665
-	.4byte 0x3832315f
-	.byte 0x00
-	.8byte 0x616e345f6c617665
-	.4byte 0x3832315f
-	.byte 0x00
-//	DW_AT_low_pc:
-	.4byte eval_4na_128
-//	DW_AT_high_pc:
-	.4byte .LNeval_4na_128
-//	DW_AT_external:
-	.byte 0x00
-//	DW_AT_sibling:
-	.4byte 0x0000260b
-.DWinfo502:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x1272
-//	DW_AT_decl_column:
-	.byte 0x2b
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000012f1
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x08
-.DWinfo503:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x1273
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000012fb
-//	DW_AT_name:
-	.8byte 0x00616e326962636e
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x0c
-.DWinfo504:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x1273
-//	DW_AT_decl_column:
-	.byte 0x27
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_name:
-	.4byte 0x00736f70
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x10
-.DWinfo505:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x1273
-//	DW_AT_decl_column:
-	.byte 0x39
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_name:
-	.4byte 0x006e656c
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x14
-.DWinfo506:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1281
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x66667562
-	.2byte 0x7265
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ea87503
-.DWinfo507:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1281
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6972
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7e887503
-.DWinfo508:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1281
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6a72
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7e987503
-.DWinfo509:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1282
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3070
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7eb87503
-.DWinfo510:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1282
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3170
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ed87503
-.DWinfo511:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1282
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3270
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ef87503
-.DWinfo512:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1282
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3370
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7f987503
-.DWinfo513:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1282
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x306d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ec87503
-.DWinfo514:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1282
-//	DW_AT_decl_column:
-	.byte 0x22
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x316d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ee87503
-.DWinfo515:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1282
-//	DW_AT_decl_column:
-	.byte 0x26
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x326d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7f887503
-.DWinfo516:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1282
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x336d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7fa87503
-.DWinfo517:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1285
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6172
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x68
-.DWinfo518:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1285
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6272
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x64
-.DWinfo519:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1285
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6372
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x60
-.DWinfo520:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1285
-//	DW_AT_decl_column:
-	.byte 0x15
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6472
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x4c
-.DWinfo521:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1288
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x737361705f6d756e
-	.2byte 0x7365
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x6c
-.DWinfo522:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1288
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x706f7473
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x54
-.DWinfo523:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x128b
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x5c
-.DWinfo524:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x128d
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x58
-.DWinfo525:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x128d
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00637273
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x50
-.DWinfo526:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x128e
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6e656c71
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x74
-	.byte 0x00
-.DWinfo29:
-//	DW_TAG_subprogram:
-	.byte 0x09
-//	DW_AT_decl_line:
-	.2byte 0x1350
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x616e345f6c617665
-	.4byte 0x736f705f
-	.byte 0x00
-	.8byte 0x616e345f6c617665
-	.4byte 0x736f705f
-	.byte 0x00
-//	DW_AT_low_pc:
-	.4byte eval_4na_pos
-//	DW_AT_high_pc:
-	.4byte .LNeval_4na_pos
-//	DW_AT_external:
-	.byte 0x00
-//	DW_AT_sibling:
-	.4byte 0x00002803
-.DWinfo527:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x1350
-//	DW_AT_decl_column:
-	.byte 0x2b
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000012f1
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x08
-.DWinfo528:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x1351
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000012fb
-//	DW_AT_name:
-	.8byte 0x00616e326962636e
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x0c
-.DWinfo529:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x1351
-//	DW_AT_decl_column:
-	.byte 0x27
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_name:
-	.4byte 0x00736f70
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x10
-.DWinfo530:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x1351
-//	DW_AT_decl_column:
-	.byte 0x39
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_name:
-	.4byte 0x006e656c
-//	DW_AT_location:
-	.2byte 0x7302
-	.byte 0x14
-.DWinfo531:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1360
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x66667562
-	.2byte 0x7265
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ea87503
-.DWinfo532:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1360
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6972
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7e887503
-.DWinfo533:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1360
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6a72
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7e987503
-.DWinfo534:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1361
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3070
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7eb87503
-.DWinfo535:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1361
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3170
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ed87503
-.DWinfo536:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1361
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3270
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ef87503
-.DWinfo537:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1361
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3370
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7f987503
-.DWinfo538:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1361
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x306d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ec87503
-.DWinfo539:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1361
-//	DW_AT_decl_column:
-	.byte 0x22
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x316d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7ee87503
-.DWinfo540:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1361
-//	DW_AT_decl_column:
-	.byte 0x26
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x326d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7f887503
-.DWinfo541:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1361
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x336d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00001305
-//	DW_AT_location:
-	.4byte 0x7fa87503
-.DWinfo542:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1364
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6172
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x6c
-.DWinfo543:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1364
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6272
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x68
-.DWinfo544:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1364
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6372
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x64
-.DWinfo545:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1364
-//	DW_AT_decl_column:
-	.byte 0x15
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6472
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x4c
-.DWinfo546:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1367
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x737361705f6d756e
-	.2byte 0x7365
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x70
-.DWinfo547:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1367
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x706f7473
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x58
-.DWinfo548:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x136b
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x72617473
-	.2byte 0x0074
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x50
-.DWinfo549:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x136f
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x60
-.DWinfo550:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1371
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x5c
-.DWinfo551:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1371
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00637273
-//	DW_AT_type:
-	.4byte 0x00000517
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x54
-.DWinfo552:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1372
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6e656c71
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x78
-	.byte 0x00
-.DWinfo30:
-//	DW_TAG_subprogram:
-	.byte 0x09
-//	DW_AT_decl_line:
-	.2byte 0x145f
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x747372745363754e
-	.8byte 0x0068637261655372
-	.8byte 0x747372745363754e
-	.8byte 0x0068637261655372
-//	DW_AT_low_pc:
-	.4byte NucStrstrSearch
-//	DW_AT_high_pc:
-	.4byte .LNNucStrstrSearch
-//	DW_AT_external:
-	.byte 0x01
-//	DW_AT_sibling:
-	.4byte 0x000028cf
-.DWinfo553:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x145f
-//	DW_AT_decl_column:
-	.byte 0x28
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000028cf
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x08
-.DWinfo554:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x1460
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000012fb
-//	DW_AT_name:
-	.8byte 0x00616e326962636e
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x0c
-.DWinfo555:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x1460
-//	DW_AT_decl_column:
-	.byte 0x27
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_name:
-	.4byte 0x00736f70
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x10
-.DWinfo556:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x1460
-//	DW_AT_decl_column:
-	.byte 0x39
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_name:
-	.4byte 0x006e656c
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x14
-.DWinfo557:
-//	DW_TAG_formal_parameter:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.2byte 0x1460
-//	DW_AT_decl_column:
-	.byte 0x4e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000028d9
-//	DW_AT_name:
-	.8byte 0x006e656c666c6573
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x18
-.DWinfo558:
-//	DW_TAG_lexical_block:
-	.byte 0x16
-//	DW_AT_decl_line:
-	.2byte 0x1463
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.4byte ..LN5427
-//	DW_AT_high_pc:
-	.4byte ..LN5875
-.DWinfo559:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1464
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6e756f66
-	.2byte 0x0064
-//	DW_AT_type:
-	.4byte 0x00000784
-//	DW_AT_location:
-	.2byte 0x7502
-	.byte 0x64
-.DWinfo560:
-//	DW_TAG_variable:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x1465
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x656c5f6174736166
-	.2byte 0x006e
-//	DW_AT_type:
-	.4byte 0x000003b2
-//	DW_AT_location:
-	.4byte 0x7fac7503
-	.byte 0x00
-	.byte 0x00
-.DWinfo561:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x000028d4
-.DWinfo562:
-//	DW_TAG_const_type:
-	.byte 0x0e
-//	DW_AT_type:
-	.4byte 0x0000090e
-.DWinfo563:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x000003b2
-.DWinfo564:
-//	DW_TAG_variable:
-	.byte 0x08
-//	DW_AT_decl_line:
-	.byte 0x5a
-//	DW_AT_decl_column:
-	.byte 0x0f
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x6e325f6174736166
-	.4byte 0x616d5f61
-	.2byte 0x0070
-//	DW_AT_type:
-	.4byte 0x000028fb
-//	DW_AT_location:
-	.2byte 0x0305
-	.4byte fasta_2na_map
-.DWinfo565:
-//	DW_TAG_array_type:
-	.byte 0x14
-//	DW_AT_type:
-	.4byte 0x00000c78
-//	DW_AT_byte_size:
-	.byte 0x80
-//	DW_AT_sibling:
-	.4byte 0x00002908
-.DWinfo566:
-//	DW_TAG_subrange_type:
-	.byte 0x15
-//	DW_AT_upper_bound:
-	.byte 0x7f
-	.byte 0x00
-.DWinfo567:
-//	DW_TAG_variable:
-	.byte 0x08
-//	DW_AT_decl_line:
-	.byte 0x5b
-//	DW_AT_decl_column:
-	.byte 0x0f
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x6e345f6174736166
-	.4byte 0x616d5f61
-	.2byte 0x0070
-//	DW_AT_type:
-	.4byte 0x00002925
-//	DW_AT_location:
-	.2byte 0x0305
-	.4byte fasta_4na_map
-.DWinfo568:
-//	DW_TAG_array_type:
-	.byte 0x14
-//	DW_AT_type:
-	.4byte 0x00000c78
-//	DW_AT_byte_size:
-	.byte 0x80
-//	DW_AT_sibling:
-	.4byte 0x00002932
-.DWinfo569:
-//	DW_TAG_subrange_type:
-	.byte 0x15
-//	DW_AT_upper_bound:
-	.byte 0x7f
-	.byte 0x00
-.DWinfo570:
-//	DW_TAG_variable:
-	.byte 0x08
-//	DW_AT_decl_line:
-	.byte 0x5c
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x325f646e61707865
-	.2byte 0x616e
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x0000294c
-//	DW_AT_location:
-	.2byte 0x0305
-	.4byte expand_2na
-.DWinfo571:
-//	DW_TAG_array_type:
-	.byte 0x1e
-//	DW_AT_type:
-	.4byte 0x000002b2
-//	DW_AT_byte_size:
-	.2byte 0x0200
-.DWinfo572:
-//	DW_TAG_subrange_type:
-	.byte 0x1f
-//	DW_AT_upper_bound:
-	.2byte 0x00ff
-	.byte 0x00
-	.byte 0x00
-	.byte 0x00
-	.byte 0x00
-	.byte 0x00
-// -- Begin DWARF2 SEGMENT .debug_line
-	.section .debug_line
-.debug_line_seg:
-	.align 1
-	.4byte 0x000026aa
-	.2byte 0x0002
-	.4byte 0x00000114
-	.byte 0x01
-	.byte 0x01
-	.byte 0xff
-	.byte 0x04
-	.byte 0x0a
-	.8byte 0x0000000101010100
-	.byte 0x01
-	.8byte 0x6f722f656d6f682f
-	.8byte 0x642f72656d726164
-	.8byte 0x746e692f6c657665
-	.8byte 0x73612f6c616e7265
-	.8byte 0x2f65636172742d6d
-	.8byte 0x2f6363672f636e69
-	.4byte 0x36383369
-	.byte 0x00
-	.8byte 0x636e692f7273752f
-	.4byte 0x6564756c
-	.byte 0x00
-	.8byte 0x746e692f74706f2f
-	.8byte 0x30312f63632f6c65
-	.8byte 0x692f3132302e312e
-	.4byte 0x756c636e
-	.2byte 0x6564
-	.byte 0x00
-	.8byte 0x6f722f656d6f682f
-	.8byte 0x642f72656d726164
-	.8byte 0x746e692f6c657665
-	.8byte 0x73612f6c616e7265
-	.8byte 0x2f65636172742d6d
-	.8byte 0x006172732f667469
-	.byte 0x00
-	.8byte 0x706d692d68637261
-	.4byte 0x00682e6c
-	.8byte 0x41e904d1e4efaf01
-	.8byte 0x682e746e69647473
-	.byte 0x00
-	.8byte 0x42e104bffdfc8e02
-	.8byte 0x747372747363756e
-	.4byte 0x00632e72
-	.8byte 0x8eec04d283e7bd00
-	.byte 0x0a
-	.8byte 0x6972746e696d6d65
-	.4byte 0x00682e6e
-	.8byte 0x7bca04c1ab8cdd03
-	.8byte 0x682e666564647473
-	.byte 0x00
-	.8byte 0x07c404c1ab8cdd03
-	.8byte 0x747372747363756e
-	.4byte 0x00682e72
-	.8byte 0x27d104cb94abbd04
-	.byte 0x00
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1
-	.2byte 0x2503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5
-	.2byte 0x0903
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN7
-	.2byte 0xf603
-	.byte 0x01
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN9
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN11
-	.2byte 0x0e03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN13
-	.2byte 0x1703
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN15
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN17
-	.2byte 0x1203
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN19
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN21
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN23
-	.2byte 0x1403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN25
-	.byte 0x04
-	.byte 0x03
-	.2byte 0xd803
-	.byte 0x0d
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN27
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN33
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN37
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN41
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN43
-	.2byte 0xbe03
-	.byte 0x0e
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN45
-	.2byte 0x0603
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN51
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN57
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN63
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN69
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN75
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN81
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN87
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN93
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN97
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN99
-	.2byte 0xf003
-	.byte 0x66
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN101
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN111
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN115
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN121
-	.byte 0x0a
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN123
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN129
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN131
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN133
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN135
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN137
-	.2byte 0x2503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN139
-	.2byte 0x0603
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN143
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN145
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN153
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN157
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN159
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN165
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN171
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN183
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN193
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN197
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN207
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN213
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN231
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN243
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN261
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN273
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN289
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN301
-	.2byte 0x0603
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN313
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN317
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN321
-	.2byte 0x7d03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN327
-	.2byte 0x0903
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN329
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN331
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN335
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN339
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN343
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN347
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN351
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN355
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN359
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN363
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN367
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN369
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN373
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN377
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN381
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN385
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN389
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN393
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN397
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN399
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN403
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN407
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN411
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN415
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN419
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN421
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN425
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN429
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN433
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN435
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN437
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN441
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN445
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN451
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN457
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN465
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN473
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN483
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN493
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN501
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN509
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN519
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN529
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN537
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN545
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN555
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN565
-	.2byte 0x2a03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN567
-	.2byte 0x0603
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN569
-	.2byte 0x0603
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN573
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN575
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN583
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN587
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN589
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN595
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN601
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN613
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN623
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN627
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN637
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN643
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN659
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN671
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN689
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN701
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN719
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN731
-	.2byte 0x0603
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN743
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN747
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN751
-	.2byte 0x7d03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN757
-	.2byte 0x0803
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN759
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN761
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN765
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN769
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN773
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN777
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN781
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN785
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN789
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN791
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN795
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN799
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN803
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN807
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN811
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN813
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN817
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN821
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN825
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN827
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN829
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN833
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN837
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN843
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN849
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN857
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN865
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN875
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN885
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN893
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN901
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN911
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN921
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN929
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN937
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN947
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN957
-	.2byte 0x2a03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN959
-	.2byte 0x0803
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN961
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN967
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN969
-	.byte 0x0a
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN973
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN975
-	.2byte 0x0803
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN977
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN981
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN983
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN987
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN989
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN991
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN995
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1001
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1007
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1013
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1015
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1019
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1023
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1027
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1029
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1033
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1047
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1061
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1063
-	.2byte 0x0803
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1065
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1067
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1069
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1085
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1101
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1103
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1119
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1135
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1137
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1151
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1153
-	.2byte 0x2703
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1155
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1157
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1159
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1167
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1171
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1179
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1181
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1183
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1185
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1191
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1201
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1205
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1207
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1215
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1219
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1227
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1229
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1231
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1237
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1253
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1257
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1273
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1275
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1277
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1281
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1289
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1299
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1307
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1309
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1317
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1321
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1329
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1331
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1333
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1341
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1347
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1349
-	.2byte 0x0803
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1351
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1353
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1357
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1371
-	.2byte 0x0a03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1381
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1385
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1387
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1395
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1399
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1407
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1409
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1411
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1413
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1419
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1435
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1437
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1439
-	.2byte 0x0d03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1441
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1443
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1453
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1457
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1473
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1477
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1487
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1491
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1493
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1495
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1499
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1507
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1509
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1511
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1519
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1521
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1523
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1525
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1529
-	.2byte 0x0c03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1537
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1541
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1549
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1551
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1553
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1559
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1567
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1573
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1589
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1591
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1593
-	.2byte 0x0e03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1595
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1597
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1599
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1609
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1619
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1629
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1633
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1647
-	.2byte 0x7d03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1655
-	.2byte 0x0703
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1665
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1669
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1683
-	.2byte 0x7d03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1691
-	.2byte 0x0803
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1697
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1709
-	.byte 0x0a
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1715
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1717
-	.2byte 0x1a03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1719
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1723
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1731
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1733
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1737
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1739
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1745
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1761
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1765
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1769
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1771
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1773
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1779
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1781
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1783
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1785
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1787
-	.2byte 0x0703
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1789
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1793
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1797
-	.2byte 0x1003
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1801
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1807
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1813
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1819
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1825
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1827
-	.2byte 0xce03
-	.byte 0x04
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1829
-	.2byte 0x1e03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1833
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1835
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1839
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1847
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1851
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1861
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1871
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1873
-	.2byte 0x0a03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1875
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1881
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1883
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1887
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1889
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1891
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1893
-	.2byte 0x0703
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1901
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1905
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1911
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1919
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1923
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1929
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1937
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1941
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1947
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1955
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1959
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1965
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1967
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1975
-	.2byte 0x1203
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1983
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1991
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN1999
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2007
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2009
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2015
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2021
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2027
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2037
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2047
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2057
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2067
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2069
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2073
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2075
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2079
-	.2byte 0x1503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2083
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2085
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2089
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2099
-	.2byte 0xce03
-	.byte 0x00
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2101
-	.2byte 0x0d03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2103
-	.2byte 0x0603
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2105
-	.2byte 0x1e03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2109
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2111
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2115
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2123
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2127
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2137
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2147
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2149
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2153
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2157
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2163
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2165
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2171
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2173
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2177
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2179
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2181
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2183
-	.2byte 0x0703
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2191
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2195
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2201
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2209
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2213
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2219
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2227
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2231
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2237
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2245
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2249
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2255
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2257
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2265
-	.2byte 0x1203
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2273
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2281
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2289
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2297
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2299
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2305
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2311
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2317
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2327
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2337
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2347
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2357
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2359
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2363
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2365
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2369
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2375
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2379
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2381
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2387
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2395
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2397
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2401
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2403
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2407
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2417
-	.2byte 0xce03
-	.byte 0x00
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2419
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2423
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2427
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2433
-	.2byte 0x0903
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2435
-	.2byte 0x0603
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2437
-	.2byte 0x1e03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2441
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2443
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2447
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2455
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2459
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2469
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2479
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2481
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2485
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2489
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2495
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2497
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2503
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2505
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2509
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2511
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2513
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2515
-	.2byte 0x0703
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2523
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2527
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2533
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2541
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2545
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2551
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2559
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2563
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2569
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2577
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2581
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2587
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2589
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2597
-	.2byte 0x1203
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2605
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2613
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2621
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2629
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2631
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2637
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2643
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2649
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2659
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2669
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2679
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2689
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2691
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2695
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2697
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2701
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2707
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2711
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2713
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2719
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2727
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2729
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2733
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2735
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2739
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2749
-	.2byte 0xce03
-	.byte 0x00
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2751
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2755
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2759
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2765
-	.2byte 0x0903
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2767
-	.2byte 0x0603
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2769
-	.2byte 0x1f03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2773
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2775
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2779
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2787
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2791
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2801
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2811
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2813
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2817
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2821
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2827
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2829
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2835
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2837
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2841
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2843
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2845
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2847
-	.2byte 0x0703
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2855
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2859
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2865
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2867
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2875
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2879
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2885
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2887
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2895
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2899
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2905
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2907
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2915
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2919
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2925
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2927
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2929
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2937
-	.2byte 0x1203
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2945
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2953
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2961
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2969
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2971
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2977
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2983
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2989
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN2999
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3009
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3019
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3029
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3031
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3035
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3037
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3041
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3047
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3051
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3053
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3059
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3067
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3069
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3073
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3075
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3079
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3089
-	.2byte 0xce03
-	.byte 0x00
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3091
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3095
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3099
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3105
-	.2byte 0x0903
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3107
-	.2byte 0x0603
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3109
-	.2byte 0x1e03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3113
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3115
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3119
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3127
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3131
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3141
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3151
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3153
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3157
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3161
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3167
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3169
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3175
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3185
-	.2byte 0x0703
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3189
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3191
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3193
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3195
-	.2byte 0x0703
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3203
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3207
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3213
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3215
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3223
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3227
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3233
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3235
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3243
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3247
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3253
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3255
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3263
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3267
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3273
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3275
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3277
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3285
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3287
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3289
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3295
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3301
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3307
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3309
-	.2byte 0x1b03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3311
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3315
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3317
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3321
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3327
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3331
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3333
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3339
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3347
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3349
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3353
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3357
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3367
-	.2byte 0xce03
-	.byte 0x00
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3369
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3373
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3377
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3383
-	.2byte 0x0903
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3385
-	.2byte 0x0603
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3387
-	.2byte 0x2403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3391
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3393
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3397
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3401
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3409
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3413
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3423
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3433
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3435
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3439
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3443
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3449
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3451
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3457
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3467
-	.2byte 0x0703
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3471
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3473
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3475
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3477
-	.2byte 0x0703
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3485
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3489
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3495
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3497
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3505
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3509
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3515
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3517
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3525
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3529
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3535
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3537
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3545
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3549
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3555
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3557
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3559
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3567
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3569
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3579
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3589
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3599
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3609
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3619
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3629
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3639
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3649
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3659
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3669
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3671
-	.2byte 0x2803
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3673
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3677
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3679
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3683
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3689
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3693
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3695
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3701
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3709
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3711
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3715
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3719
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3729
-	.2byte 0xce03
-	.byte 0x00
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3731
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3735
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3739
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3745
-	.2byte 0x0a03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3747
-	.2byte 0xca03
-	.byte 0x00
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3749
-	.2byte 0x1a03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3753
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3755
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3759
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3767
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3771
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3781
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3791
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3793
-	.2byte 0x0603
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3795
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3801
-	.2byte 0x0603
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3803
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3807
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3809
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3811
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3813
-	.2byte 0x0703
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3821
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3829
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3833
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3839
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3847
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3855
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3859
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3865
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3873
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3881
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3885
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3891
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3899
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3907
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3911
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3917
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3919
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3927
-	.2byte 0x1203
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3935
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3943
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3951
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3959
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3965
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3971
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3977
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3983
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN3993
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4003
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4013
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4023
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4025
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4029
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4031
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4035
-	.2byte 0x1103
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4039
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4041
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4045
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4055
-	.2byte 0x0f03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4057
-	.2byte 0x0b03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4059
-	.2byte 0x0603
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4061
-	.2byte 0x1a03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4065
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4067
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4071
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4079
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4083
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4093
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4103
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4105
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4109
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4111
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4117
-	.2byte 0x0603
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4119
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4123
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4125
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4127
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4129
-	.2byte 0x0703
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4137
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4145
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4149
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4155
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4163
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4171
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4175
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4181
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4189
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4197
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4201
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4207
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4215
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4223
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4227
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4233
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4235
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4243
-	.2byte 0x1203
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4251
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4259
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4267
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4275
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4281
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4287
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4293
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4299
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4309
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4319
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4329
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4339
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4341
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4345
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4347
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4351
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4357
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4361
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4371
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4373
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4377
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4379
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4383
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4393
-	.2byte 0x0f03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4395
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4399
-	.2byte 0x0903
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4401
-	.2byte 0x0603
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4403
-	.2byte 0x1b03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4407
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4409
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4413
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4421
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4425
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4435
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4445
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4447
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4451
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4453
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4459
-	.2byte 0x0603
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4461
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4465
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4467
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4469
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4471
-	.2byte 0x0703
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4479
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4487
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4491
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4497
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4499
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4507
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4515
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4519
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4525
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4527
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4535
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4543
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4547
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4553
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4555
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4563
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4571
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4575
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4581
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4583
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4585
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4593
-	.2byte 0x1203
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4601
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4609
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4617
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4625
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4631
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4637
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4643
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4649
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4659
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4669
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4679
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4689
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4691
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4695
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4697
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4701
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4707
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4711
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4721
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4723
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4727
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4729
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4733
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4743
-	.2byte 0x0f03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4745
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4749
-	.2byte 0x0903
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4751
-	.2byte 0x0603
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4753
-	.2byte 0x1a03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4757
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4759
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4763
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4771
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4775
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4785
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4795
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4797
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4801
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4803
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4809
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4819
-	.2byte 0x0903
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4823
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4825
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4827
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4829
-	.2byte 0x0703
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4837
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4845
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4849
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4855
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4857
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4865
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4873
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4877
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4883
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4885
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4893
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4901
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4905
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4911
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4913
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4921
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4929
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4933
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4939
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4941
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4943
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4951
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4953
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4955
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4961
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4967
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4973
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4975
-	.2byte 0x1b03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4977
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4981
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4983
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4987
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4993
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN4997
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5007
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5009
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5013
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5017
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5027
-	.2byte 0x0f03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5029
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5033
-	.2byte 0x0903
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5035
-	.2byte 0x0603
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5037
-	.2byte 0x2003
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5041
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5043
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5047
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5051
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5059
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5063
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5073
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5083
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5085
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5089
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5091
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5097
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5107
-	.2byte 0x0903
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5111
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5113
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5115
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5117
-	.2byte 0x0703
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5125
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5133
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5137
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5143
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5145
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5153
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5161
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5165
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5171
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5173
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5181
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5189
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5193
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5199
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5201
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5209
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5217
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5221
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5227
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5229
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5231
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5239
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5241
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5251
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5261
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5271
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5281
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5291
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5301
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5311
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5321
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5331
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5341
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5343
-	.2byte 0x2803
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5345
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5349
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5351
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5355
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5361
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5365
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5375
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5377
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5381
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5385
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5395
-	.2byte 0x0f03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5397
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5401
-	.2byte 0x0a03
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5403
-	.2byte 0x1503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5405
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5417
-	.2byte 0x0503
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5421
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5429
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5439
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5451
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5459
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5469
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5481
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5489
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5499
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5511
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5519
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5529
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5541
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5549
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5559
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5571
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5579
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5589
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5601
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5609
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5619
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5631
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5639
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5649
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5661
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5669
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5679
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5691
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5699
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5709
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5721
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5729
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5739
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5751
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5767
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5769
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5773
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5775
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5779
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5781
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5795
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5797
-	.2byte 0x0403
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5813
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5817
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5819
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5823
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5825
-	.2byte 0x0303
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5829
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5833
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5835
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5849
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5853
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5857
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5859
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5865
-	.byte 0x0c
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5873
-	.byte 0x0a
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte ..LN5875
-	.2byte 0x0603
-	.byte 0x01
-	.byte 0x00
-	.byte 0x05
-	.byte 0x02
-	.4byte .LNNucStrstrSearch
-	.byte 0x00
-	.byte 0x01
-	.byte 0x01
-// -- Begin DWARF2 SEGMENT .debug_abbrev
-	.section .debug_abbrev
-.debug_abbrev_seg:
-	.align 1
-	.byte 0x01
-	.byte 0x11
-	.byte 0x01
-	.byte 0x1b
-	.byte 0x08
-	.byte 0x13
-	.byte 0x0b
-	.byte 0x03
-	.byte 0x08
-	.byte 0x25
-	.byte 0x08
-	.byte 0x10
-	.byte 0x06
-	.2byte 0x0000
-	.byte 0x02
-	.byte 0x04
-	.byte 0x01
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x0b
-	.byte 0x0b
-	.byte 0x3e
-	.byte 0x0b
-	.byte 0x01
-	.byte 0x13
-	.2byte 0x0000
-	.byte 0x03
-	.byte 0x28
-	.byte 0x00
-	.byte 0x03
-	.byte 0x08
-	.byte 0x1c
-	.byte 0x0d
-	.2byte 0x0000
-	.byte 0x04
-	.byte 0x16
-	.byte 0x00
-	.byte 0x3b
-	.byte 0x0b
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x03
-	.byte 0x08
-	.byte 0x49
-	.byte 0x13
-	.2byte 0x0000
-	.byte 0x05
-	.byte 0x24
-	.byte 0x00
-	.byte 0x0b
-	.byte 0x0b
-	.byte 0x3e
-	.byte 0x0b
-	.byte 0x03
-	.byte 0x08
-	.2byte 0x0000
-	.byte 0x06
-	.byte 0x2e
-	.byte 0x01
-	.byte 0x3b
-	.byte 0x0b
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x20
-	.byte 0x0b
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x49
-	.byte 0x13
-	.byte 0x27
-	.byte 0x0c
-	.byte 0x03
-	.byte 0x08
-	.2byte 0x4087
-	.byte 0x08
-	.byte 0x11
-	.byte 0x01
-	.byte 0x12
-	.byte 0x01
-	.byte 0x3f
-	.byte 0x0c
-	.byte 0x01
-	.byte 0x13
-	.2byte 0x0000
-	.byte 0x07
-	.byte 0x05
-	.byte 0x00
-	.byte 0x3b
-	.byte 0x0b
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x49
-	.byte 0x13
-	.byte 0x03
-	.byte 0x08
-	.byte 0x02
-	.byte 0x0a
-	.2byte 0x0000
-	.byte 0x08
-	.byte 0x34
-	.byte 0x00
-	.byte 0x3b
-	.byte 0x0b
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x03
-	.byte 0x08
-	.byte 0x49
-	.byte 0x13
-	.byte 0x02
-	.byte 0x0a
-	.2byte 0x0000
-	.byte 0x09
-	.byte 0x2e
-	.byte 0x01
-	.byte 0x3b
-	.byte 0x05
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x20
-	.byte 0x0b
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x49
-	.byte 0x13
-	.byte 0x27
-	.byte 0x0c
-	.byte 0x03
-	.byte 0x08
-	.2byte 0x4087
-	.byte 0x08
-	.byte 0x11
-	.byte 0x01
-	.byte 0x12
-	.byte 0x01
-	.byte 0x3f
-	.byte 0x0c
-	.byte 0x01
-	.byte 0x13
-	.2byte 0x0000
-	.byte 0x0a
-	.byte 0x05
-	.byte 0x00
-	.byte 0x3b
-	.byte 0x05
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x49
-	.byte 0x13
-	.byte 0x03
-	.byte 0x08
-	.byte 0x02
-	.byte 0x0a
-	.2byte 0x0000
-	.byte 0x0b
-	.byte 0x0f
-	.byte 0x00
-	.byte 0x49
-	.byte 0x13
-	.2byte 0x0000
-	.byte 0x0c
-	.byte 0x13
-	.byte 0x01
-	.byte 0x3b
-	.byte 0x0b
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x0b
-	.byte 0x0b
-	.byte 0x03
-	.byte 0x08
-	.byte 0x01
-	.byte 0x13
-	.2byte 0x0000
-	.byte 0x0d
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x3b
-	.byte 0x0b
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x38
-	.byte 0x0a
-	.byte 0x03
-	.byte 0x08
-	.byte 0x49
-	.byte 0x13
-	.2byte 0x0000
-	.byte 0x0e
-	.byte 0x26
-	.byte 0x00
-	.byte 0x49
-	.byte 0x13
-	.2byte 0x0000
-	.byte 0x0f
-	.byte 0x01
-	.byte 0x01
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x03
-	.byte 0x08
-	.byte 0x49
-	.byte 0x13
-	.byte 0x0b
-	.byte 0x0b
-	.byte 0x01
-	.byte 0x13
-	.2byte 0x0000
-	.byte 0x10
-	.byte 0x21
-	.byte 0x00
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x03
-	.byte 0x08
-	.byte 0x2f
-	.byte 0x0b
-	.byte 0x22
-	.byte 0x0b
-	.2byte 0x0000
-	.byte 0x11
-	.byte 0x34
-	.byte 0x00
-	.byte 0x3b
-	.byte 0x05
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x03
-	.byte 0x08
-	.byte 0x49
-	.byte 0x13
-	.byte 0x02
-	.byte 0x0a
-	.2byte 0x0000
-	.byte 0x12
-	.byte 0x17
-	.byte 0x01
-	.byte 0x3b
-	.byte 0x0b
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x0b
-	.byte 0x0b
-	.byte 0x01
-	.byte 0x13
-	.2byte 0x0000
-	.byte 0x13
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x3b
-	.byte 0x0b
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x38
-	.byte 0x0a
-	.byte 0x03
-	.byte 0x08
-	.byte 0x49
-	.byte 0x13
-	.2byte 0x0000
-	.byte 0x14
-	.byte 0x01
-	.byte 0x01
-	.byte 0x49
-	.byte 0x13
-	.byte 0x0b
-	.byte 0x0b
-	.byte 0x01
-	.byte 0x13
-	.2byte 0x0000
-	.byte 0x15
-	.byte 0x21
-	.byte 0x00
-	.byte 0x2f
-	.byte 0x0b
-	.2byte 0x0000
-	.byte 0x16
-	.byte 0x0b
-	.byte 0x01
-	.byte 0x3b
-	.byte 0x05
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x11
-	.byte 0x01
-	.byte 0x12
-	.byte 0x01
-	.2byte 0x0000
-	.byte 0x17
-	.byte 0x16
-	.byte 0x00
-	.byte 0x3b
-	.byte 0x05
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x03
-	.byte 0x08
-	.byte 0x49
-	.byte 0x13
-	.2byte 0x0000
-	.byte 0x18
-	.byte 0x13
-	.byte 0x01
-	.byte 0x3b
-	.byte 0x05
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x0b
-	.byte 0x0b
-	.byte 0x03
-	.byte 0x08
-	.byte 0x01
-	.byte 0x13
-	.2byte 0x0000
-	.byte 0x19
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x3b
-	.byte 0x05
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x38
-	.byte 0x0a
-	.byte 0x03
-	.byte 0x08
-	.byte 0x49
-	.byte 0x13
-	.2byte 0x0000
-	.byte 0x1a
-	.byte 0x17
-	.byte 0x01
-	.byte 0x3b
-	.byte 0x05
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x0b
-	.byte 0x0b
-	.byte 0x01
-	.byte 0x13
-	.2byte 0x0000
-	.byte 0x1b
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x3b
-	.byte 0x05
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x38
-	.byte 0x0a
-	.byte 0x03
-	.byte 0x08
-	.byte 0x49
-	.byte 0x13
-	.2byte 0x0000
-	.byte 0x1c
-	.byte 0x13
-	.byte 0x01
-	.byte 0x3b
-	.byte 0x05
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x0b
-	.byte 0x0b
-	.byte 0x01
-	.byte 0x13
-	.2byte 0x0000
-	.byte 0x1d
-	.byte 0x17
-	.byte 0x01
-	.byte 0x3b
-	.byte 0x05
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x0b
-	.byte 0x0b
-	.byte 0x03
-	.byte 0x08
-	.byte 0x01
-	.byte 0x13
-	.2byte 0x0000
-	.byte 0x1e
-	.byte 0x01
-	.byte 0x01
-	.byte 0x49
-	.byte 0x13
-	.byte 0x0b
-	.byte 0x05
-	.2byte 0x0000
-	.byte 0x1f
-	.byte 0x21
-	.byte 0x00
-	.byte 0x2f
-	.byte 0x05
-	.2byte 0x0000
-	.byte 0x00
-// -- Begin DWARF2 SEGMENT .debug_frame
-	.section .debug_frame
-.debug_frame_seg:
-	.align 1
-	.4byte 0x00000010
-	.4byte 0xffffffff
-	.byte 0x01
-	.byte 0x00
-	.byte 0x01
-	.byte 0x7c
-	.byte 0x08
-	.4byte 0x8804040c
-	.byte 0x01
-	.2byte 0x0000
-	.4byte 0x0000001c
-	.4byte .debug_frame_seg
-	.4byte ..___tag_value_uint16_lsbit.2
-	.4byte ..___tag_value_uint16_lsbit.12-..___tag_value_uint16_lsbit.2
-	.byte 0x04
-	.4byte 0x00000000
-	.byte 0x04
-	.4byte ..___tag_value_uint16_lsbit.7-..___tag_value_uint16_lsbit.2
-	.byte 0x0c
-	.2byte 0x0805
-	.byte 0x85
-	.byte 0x02
-	.byte 0x00
-	.4byte 0x0000001c
-	.4byte .debug_frame_seg
-	.4byte ..___tag_value_uint128_shr.15
-	.4byte ..___tag_value_uint128_shr.25-..___tag_value_uint128_shr.15
-	.byte 0x04
-	.4byte 0x00000000
-	.byte 0x04
-	.4byte ..___tag_value_uint128_shr.20-..___tag_value_uint128_shr.15
-	.byte 0x0c
-	.2byte 0x0805
-	.byte 0x85
-	.byte 0x02
-	.byte 0x00
-	.4byte 0x0000001c
-	.4byte .debug_frame_seg
-	.4byte ..___tag_value_uint128_bswap.28
-	.4byte ..___tag_value_uint128_bswap.38-..___tag_value_uint128_bswap.28
-	.byte 0x04
-	.4byte 0x00000000
-	.byte 0x04
-	.4byte ..___tag_value_uint128_bswap.33-..___tag_value_uint128_bswap.28
-	.byte 0x0c
-	.2byte 0x0805
-	.byte 0x85
-	.byte 0x02
-	.byte 0x00
-	.4byte 0x0000001c
-	.4byte .debug_frame_seg
-	.4byte ..___tag_value_uint128_bswap_copy.41
-	.4byte ..___tag_value_uint128_bswap_copy.51-..___tag_value_uint128_bswap_copy.41
-	.byte 0x04
-	.4byte 0x00000000
-	.byte 0x04
-	.4byte ..___tag_value_uint128_bswap_copy.46-..___tag_value_uint128_bswap_copy.41
-	.byte 0x0c
-	.2byte 0x0805
-	.byte 0x85
-	.byte 0x02
-	.byte 0x00
-	.4byte 0x00000038
-	.4byte .debug_frame_seg
-	.4byte ..___tag_value_prime_buffer_2na.54
-	.4byte ..___tag_value_prime_buffer_2na.68-..___tag_value_prime_buffer_2na.54
-	.byte 0x04
-	.4byte 0x00000000
-	.byte 0x04
-	.4byte ..___tag_value_prime_buffer_2na.59-..___tag_value_prime_buffer_2na.54
-	.byte 0x0c
-	.2byte 0x0804
-	.byte 0x04
-	.4byte ..___tag_value_prime_buffer_2na.60-..___tag_value_prime_buffer_2na.59
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_prime_buffer_2na.62-..___tag_value_prime_buffer_2na.60
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x04
-	.4byte ..___tag_value_prime_buffer_2na.66-..___tag_value_prime_buffer_2na.62
-	.byte 0x0c
-	.2byte 0x0404
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x00000038
-	.4byte .debug_frame_seg
-	.4byte ..___tag_value_prime_buffer_4na.71
-	.4byte ..___tag_value_prime_buffer_4na.86-..___tag_value_prime_buffer_4na.71
-	.byte 0x04
-	.4byte 0x00000000
-	.byte 0x04
-	.4byte ..___tag_value_prime_buffer_4na.76-..___tag_value_prime_buffer_4na.71
-	.byte 0x0c
-	.2byte 0x0804
-	.byte 0x04
-	.4byte ..___tag_value_prime_buffer_4na.77-..___tag_value_prime_buffer_4na.76
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_prime_buffer_4na.79-..___tag_value_prime_buffer_4na.77
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x04
-	.4byte ..___tag_value_prime_buffer_4na.84-..___tag_value_prime_buffer_4na.79
-	.byte 0x0c
-	.2byte 0x0404
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x0000003c
-	.4byte .debug_frame_seg
-	.4byte ..___tag_value_NucStrFastaExprAlloc.89
-	.4byte ..___tag_value_NucStrFastaExprAlloc.111-..___tag_value_NucStrFastaExprAlloc.89
-	.byte 0x04
-	.4byte 0x00000000
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprAlloc.94-..___tag_value_NucStrFastaExprAlloc.89
-	.byte 0x0c
-	.2byte 0x0805
-	.byte 0x85
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprAlloc.97-..___tag_value_NucStrFastaExprAlloc.94
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprAlloc.100-..___tag_value_NucStrFastaExprAlloc.97
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprAlloc.102-..___tag_value_NucStrFastaExprAlloc.100
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprAlloc.106-..___tag_value_NucStrFastaExprAlloc.102
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x00000034
-	.4byte .debug_frame_seg
-	.4byte ..___tag_value_NucStrFastaExprMake2.114
-	.4byte ..___tag_value_NucStrFastaExprMake2.137-..___tag_value_NucStrFastaExprMake2.114
-	.byte 0x04
-	.4byte 0x00000000
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.119-..___tag_value_NucStrFastaExprMake2.114
-	.byte 0x0c
-	.2byte 0x0805
-	.byte 0x85
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.122-..___tag_value_NucStrFastaExprMake2.119
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.126-..___tag_value_NucStrFastaExprMake2.122
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.132-..___tag_value_NucStrFastaExprMake2.126
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.4byte 0x00000034
-	.4byte .debug_frame_seg
-	.4byte ..___tag_value_NucStrFastaExprMake4.140
-	.4byte ..___tag_value_NucStrFastaExprMake4.163-..___tag_value_NucStrFastaExprMake4.140
-	.byte 0x04
-	.4byte 0x00000000
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.145-..___tag_value_NucStrFastaExprMake4.140
-	.byte 0x0c
-	.2byte 0x0805
-	.byte 0x85
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.148-..___tag_value_NucStrFastaExprMake4.145
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.152-..___tag_value_NucStrFastaExprMake4.148
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.158-..___tag_value_NucStrFastaExprMake4.152
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.4byte 0x00000024
-	.4byte .debug_frame_seg
-	.4byte ..___tag_value_nss_sob.166
-	.4byte ..___tag_value_nss_sob.179-..___tag_value_nss_sob.166
-	.byte 0x04
-	.4byte 0x00000000
-	.byte 0x04
-	.4byte ..___tag_value_nss_sob.171-..___tag_value_nss_sob.166
-	.byte 0x0c
-	.2byte 0x0805
-	.byte 0x85
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_sob.174-..___tag_value_nss_sob.171
-	.byte 0x83
-	.byte 0x03
-	.2byte 0x0000
-	.4byte 0x0000001c
-	.4byte .debug_frame_seg
-	.4byte ..___tag_value_nss_FASTA_expr.182
-	.4byte ..___tag_value_nss_FASTA_expr.193-..___tag_value_nss_FASTA_expr.182
-	.byte 0x04
-	.4byte 0x00000000
-	.byte 0x04
-	.4byte ..___tag_value_nss_FASTA_expr.187-..___tag_value_nss_FASTA_expr.182
-	.byte 0x0c
-	.2byte 0x0805
-	.byte 0x85
-	.byte 0x02
-	.byte 0x00
-	.4byte 0x00000034
-	.4byte .debug_frame_seg
-	.4byte ..___tag_value_nss_fasta_expr.196
-	.4byte ..___tag_value_nss_fasta_expr.216-..___tag_value_nss_fasta_expr.196
-	.byte 0x04
-	.4byte 0x00000000
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.201-..___tag_value_nss_fasta_expr.196
-	.byte 0x0c
-	.2byte 0x0805
-	.byte 0x85
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.204-..___tag_value_nss_fasta_expr.201
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.207-..___tag_value_nss_fasta_expr.204
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.211-..___tag_value_nss_fasta_expr.207
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.2byte 0x0000
-	.4byte 0x0000003c
-	.4byte .debug_frame_seg
-	.4byte ..___tag_value_nss_primary_expr.219
-	.4byte ..___tag_value_nss_primary_expr.244-..___tag_value_nss_primary_expr.219
-	.byte 0x04
-	.4byte 0x00000000
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.224-..___tag_value_nss_primary_expr.219
-	.byte 0x0c
-	.2byte 0x0805
-	.byte 0x85
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.227-..___tag_value_nss_primary_expr.224
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.230-..___tag_value_nss_primary_expr.227
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.234-..___tag_value_nss_primary_expr.230
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.239-..___tag_value_nss_primary_expr.234
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x00
-	.4byte 0x0000003c
-	.4byte .debug_frame_seg
-	.4byte ..___tag_value_nss_unary_expr.247
-	.4byte ..___tag_value_nss_unary_expr.269-..___tag_value_nss_unary_expr.247
-	.byte 0x04
-	.4byte 0x00000000
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.252-..___tag_value_nss_unary_expr.247
-	.byte 0x0c
-	.2byte 0x0805
-	.byte 0x85
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.255-..___tag_value_nss_unary_expr.252
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.258-..___tag_value_nss_unary_expr.255
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.262-..___tag_value_nss_unary_expr.258
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.265-..___tag_value_nss_unary_expr.262
-	.byte 0x83
-	.byte 0x03
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x0000004c
-	.4byte .debug_frame_seg
-	.4byte ..___tag_value_nss_expr.272
-	.4byte ..___tag_value_nss_expr.304-..___tag_value_nss_expr.272
-	.byte 0x04
-	.4byte 0x00000000
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.277-..___tag_value_nss_expr.272
-	.byte 0x0c
-	.2byte 0x0805
-	.byte 0x85
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.280-..___tag_value_nss_expr.277
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.283-..___tag_value_nss_expr.280
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.287-..___tag_value_nss_expr.283
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.292-..___tag_value_nss_expr.287
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.297-..___tag_value_nss_expr.292
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.300-..___tag_value_nss_expr.297
-	.byte 0x83
-	.byte 0x03
-	.byte 0x00
-	.4byte 0x00000024
-	.4byte .debug_frame_seg
-	.4byte ..___tag_value_NucStrstrInit.307
-	.4byte ..___tag_value_NucStrstrInit.320-..___tag_value_NucStrstrInit.307
-	.byte 0x04
-	.4byte 0x00000000
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrInit.312-..___tag_value_NucStrstrInit.307
-	.byte 0x0c
-	.2byte 0x0805
-	.byte 0x85
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrInit.315-..___tag_value_NucStrstrInit.312
-	.byte 0x83
-	.byte 0x05
-	.2byte 0x0000
-	.4byte 0x00000034
-	.4byte .debug_frame_seg
-	.4byte ..___tag_value_NucStrstrMake.323
-	.4byte ..___tag_value_NucStrstrMake.346-..___tag_value_NucStrstrMake.323
-	.byte 0x04
-	.4byte 0x00000000
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.328-..___tag_value_NucStrstrMake.323
-	.byte 0x0c
-	.2byte 0x0805
-	.byte 0x85
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.331-..___tag_value_NucStrstrMake.328
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.336-..___tag_value_NucStrstrMake.331
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.341-..___tag_value_NucStrstrMake.336
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.4byte 0x00000024
-	.4byte .debug_frame_seg
-	.4byte ..___tag_value_NucStrstrWhack.349
-	.4byte ..___tag_value_NucStrstrWhack.362-..___tag_value_NucStrstrWhack.349
-	.byte 0x04
-	.4byte 0x00000000
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrWhack.354-..___tag_value_NucStrstrWhack.349
-	.byte 0x0c
-	.2byte 0x0805
-	.byte 0x85
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrWhack.357-..___tag_value_NucStrstrWhack.354
-	.byte 0x83
-	.byte 0x03
-	.2byte 0x0000
-	.4byte 0x000000c0
-	.4byte .debug_frame_seg
-	.4byte ..___tag_value_eval_2na_8.365
-	.4byte ..___tag_value_eval_2na_8.417-..___tag_value_eval_2na_8.365
-	.byte 0x04
-	.4byte 0x00000000
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.370-..___tag_value_eval_2na_8.365
-	.byte 0x0c
-	.2byte 0x0804
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.371-..___tag_value_eval_2na_8.370
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.373-..___tag_value_eval_2na_8.371
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.376-..___tag_value_eval_2na_8.373
-	.byte 0x0f
-	.4byte 0x7de87506
-	.2byte 0x2306
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.377-..___tag_value_eval_2na_8.376
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.380-..___tag_value_eval_2na_8.377
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.382-..___tag_value_eval_2na_8.380
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.387-..___tag_value_eval_2na_8.382
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.389-..___tag_value_eval_2na_8.387
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.394-..___tag_value_eval_2na_8.389
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.396-..___tag_value_eval_2na_8.394
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.401-..___tag_value_eval_2na_8.396
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.403-..___tag_value_eval_2na_8.401
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.408-..___tag_value_eval_2na_8.403
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.410-..___tag_value_eval_2na_8.408
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.415-..___tag_value_eval_2na_8.410
-	.byte 0x0c
-	.2byte 0x0404
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x000000c0
-	.4byte .debug_frame_seg
-	.4byte ..___tag_value_eval_2na_16.420
-	.4byte ..___tag_value_eval_2na_16.472-..___tag_value_eval_2na_16.420
-	.byte 0x04
-	.4byte 0x00000000
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.425-..___tag_value_eval_2na_16.420
-	.byte 0x0c
-	.2byte 0x0804
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.426-..___tag_value_eval_2na_16.425
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.428-..___tag_value_eval_2na_16.426
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.431-..___tag_value_eval_2na_16.428
-	.byte 0x0f
-	.4byte 0x7dd87506
-	.2byte 0x2306
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.432-..___tag_value_eval_2na_16.431
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.435-..___tag_value_eval_2na_16.432
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.437-..___tag_value_eval_2na_16.435
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.442-..___tag_value_eval_2na_16.437
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.444-..___tag_value_eval_2na_16.442
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.449-..___tag_value_eval_2na_16.444
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.451-..___tag_value_eval_2na_16.449
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.456-..___tag_value_eval_2na_16.451
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.458-..___tag_value_eval_2na_16.456
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.463-..___tag_value_eval_2na_16.458
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.465-..___tag_value_eval_2na_16.463
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.470-..___tag_value_eval_2na_16.465
-	.byte 0x0c
-	.2byte 0x0404
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x000000c0
-	.4byte .debug_frame_seg
-	.4byte ..___tag_value_eval_2na_32.475
-	.4byte ..___tag_value_eval_2na_32.527-..___tag_value_eval_2na_32.475
-	.byte 0x04
-	.4byte 0x00000000
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.480-..___tag_value_eval_2na_32.475
-	.byte 0x0c
-	.2byte 0x0804
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.481-..___tag_value_eval_2na_32.480
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.483-..___tag_value_eval_2na_32.481
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.486-..___tag_value_eval_2na_32.483
-	.byte 0x0f
-	.4byte 0x7dd87506
-	.2byte 0x2306
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.487-..___tag_value_eval_2na_32.486
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.490-..___tag_value_eval_2na_32.487
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.492-..___tag_value_eval_2na_32.490
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.497-..___tag_value_eval_2na_32.492
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.499-..___tag_value_eval_2na_32.497
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.504-..___tag_value_eval_2na_32.499
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.506-..___tag_value_eval_2na_32.504
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.511-..___tag_value_eval_2na_32.506
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.513-..___tag_value_eval_2na_32.511
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.518-..___tag_value_eval_2na_32.513
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.520-..___tag_value_eval_2na_32.518
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.525-..___tag_value_eval_2na_32.520
-	.byte 0x0c
-	.2byte 0x0404
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x000000c0
-	.4byte .debug_frame_seg
-	.4byte ..___tag_value_eval_2na_64.530
-	.4byte ..___tag_value_eval_2na_64.582-..___tag_value_eval_2na_64.530
-	.byte 0x04
-	.4byte 0x00000000
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.535-..___tag_value_eval_2na_64.530
-	.byte 0x0c
-	.2byte 0x0804
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.536-..___tag_value_eval_2na_64.535
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.538-..___tag_value_eval_2na_64.536
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.541-..___tag_value_eval_2na_64.538
-	.byte 0x0f
-	.4byte 0x7dd87506
-	.2byte 0x2306
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.542-..___tag_value_eval_2na_64.541
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.545-..___tag_value_eval_2na_64.542
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.547-..___tag_value_eval_2na_64.545
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.552-..___tag_value_eval_2na_64.547
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.554-..___tag_value_eval_2na_64.552
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.559-..___tag_value_eval_2na_64.554
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.561-..___tag_value_eval_2na_64.559
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.566-..___tag_value_eval_2na_64.561
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.568-..___tag_value_eval_2na_64.566
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.573-..___tag_value_eval_2na_64.568
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.575-..___tag_value_eval_2na_64.573
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.580-..___tag_value_eval_2na_64.575
-	.byte 0x0c
-	.2byte 0x0404
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x000000d4
-	.4byte .debug_frame_seg
-	.4byte ..___tag_value_eval_2na_128.585
-	.4byte ..___tag_value_eval_2na_128.644-..___tag_value_eval_2na_128.585
-	.byte 0x04
-	.4byte 0x00000000
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.590-..___tag_value_eval_2na_128.585
-	.byte 0x0c
-	.2byte 0x0804
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.591-..___tag_value_eval_2na_128.590
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.593-..___tag_value_eval_2na_128.591
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.596-..___tag_value_eval_2na_128.593
-	.byte 0x0f
-	.4byte 0x7df87506
-	.2byte 0x2306
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.597-..___tag_value_eval_2na_128.596
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.600-..___tag_value_eval_2na_128.597
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.602-..___tag_value_eval_2na_128.600
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.607-..___tag_value_eval_2na_128.602
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.609-..___tag_value_eval_2na_128.607
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.614-..___tag_value_eval_2na_128.609
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.616-..___tag_value_eval_2na_128.614
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.621-..___tag_value_eval_2na_128.616
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.623-..___tag_value_eval_2na_128.621
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.628-..___tag_value_eval_2na_128.623
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.630-..___tag_value_eval_2na_128.628
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.635-..___tag_value_eval_2na_128.630
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.637-..___tag_value_eval_2na_128.635
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.642-..___tag_value_eval_2na_128.637
-	.byte 0x0c
-	.2byte 0x0404
-	.4byte 0x00000160
-	.4byte .debug_frame_seg
-	.4byte ..___tag_value_eval_2na_pos.647
-	.4byte ..___tag_value_eval_2na_pos.748-..___tag_value_eval_2na_pos.647
-	.byte 0x04
-	.4byte 0x00000000
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.652-..___tag_value_eval_2na_pos.647
-	.byte 0x0c
-	.2byte 0x0804
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.653-..___tag_value_eval_2na_pos.652
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.655-..___tag_value_eval_2na_pos.653
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.658-..___tag_value_eval_2na_pos.655
-	.byte 0x0f
-	.4byte 0x7df87506
-	.2byte 0x2306
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.659-..___tag_value_eval_2na_pos.658
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.662-..___tag_value_eval_2na_pos.659
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.664-..___tag_value_eval_2na_pos.662
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.669-..___tag_value_eval_2na_pos.664
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.671-..___tag_value_eval_2na_pos.669
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.676-..___tag_value_eval_2na_pos.671
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.678-..___tag_value_eval_2na_pos.676
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.683-..___tag_value_eval_2na_pos.678
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.685-..___tag_value_eval_2na_pos.683
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.690-..___tag_value_eval_2na_pos.685
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.692-..___tag_value_eval_2na_pos.690
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.697-..___tag_value_eval_2na_pos.692
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.699-..___tag_value_eval_2na_pos.697
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.704-..___tag_value_eval_2na_pos.699
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.706-..___tag_value_eval_2na_pos.704
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.711-..___tag_value_eval_2na_pos.706
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.713-..___tag_value_eval_2na_pos.711
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.718-..___tag_value_eval_2na_pos.713
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.720-..___tag_value_eval_2na_pos.718
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.725-..___tag_value_eval_2na_pos.720
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.727-..___tag_value_eval_2na_pos.725
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.732-..___tag_value_eval_2na_pos.727
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.734-..___tag_value_eval_2na_pos.732
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.739-..___tag_value_eval_2na_pos.734
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.741-..___tag_value_eval_2na_pos.739
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.746-..___tag_value_eval_2na_pos.741
-	.byte 0x0c
-	.2byte 0x0404
-	.2byte 0x0000
-	.4byte 0x000000c0
-	.4byte .debug_frame_seg
-	.4byte ..___tag_value_eval_4na_16.751
-	.4byte ..___tag_value_eval_4na_16.803-..___tag_value_eval_4na_16.751
-	.byte 0x04
-	.4byte 0x00000000
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.756-..___tag_value_eval_4na_16.751
-	.byte 0x0c
-	.2byte 0x0804
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.757-..___tag_value_eval_4na_16.756
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.759-..___tag_value_eval_4na_16.757
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.762-..___tag_value_eval_4na_16.759
-	.byte 0x0f
-	.4byte 0x7dd87506
-	.2byte 0x2306
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.763-..___tag_value_eval_4na_16.762
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.766-..___tag_value_eval_4na_16.763
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.768-..___tag_value_eval_4na_16.766
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.773-..___tag_value_eval_4na_16.768
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.775-..___tag_value_eval_4na_16.773
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.780-..___tag_value_eval_4na_16.775
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.782-..___tag_value_eval_4na_16.780
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.787-..___tag_value_eval_4na_16.782
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.789-..___tag_value_eval_4na_16.787
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.794-..___tag_value_eval_4na_16.789
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.796-..___tag_value_eval_4na_16.794
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.801-..___tag_value_eval_4na_16.796
-	.byte 0x0c
-	.2byte 0x0404
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x000000c0
-	.4byte .debug_frame_seg
-	.4byte ..___tag_value_eval_4na_32.806
-	.4byte ..___tag_value_eval_4na_32.858-..___tag_value_eval_4na_32.806
-	.byte 0x04
-	.4byte 0x00000000
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.811-..___tag_value_eval_4na_32.806
-	.byte 0x0c
-	.2byte 0x0804
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.812-..___tag_value_eval_4na_32.811
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.814-..___tag_value_eval_4na_32.812
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.817-..___tag_value_eval_4na_32.814
-	.byte 0x0f
-	.4byte 0x7dc87506
-	.2byte 0x2306
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.818-..___tag_value_eval_4na_32.817
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.821-..___tag_value_eval_4na_32.818
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.823-..___tag_value_eval_4na_32.821
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.828-..___tag_value_eval_4na_32.823
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.830-..___tag_value_eval_4na_32.828
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.835-..___tag_value_eval_4na_32.830
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.837-..___tag_value_eval_4na_32.835
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.842-..___tag_value_eval_4na_32.837
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.844-..___tag_value_eval_4na_32.842
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.849-..___tag_value_eval_4na_32.844
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.851-..___tag_value_eval_4na_32.849
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.856-..___tag_value_eval_4na_32.851
-	.byte 0x0c
-	.2byte 0x0404
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x000000c0
-	.4byte .debug_frame_seg
-	.4byte ..___tag_value_eval_4na_64.861
-	.4byte ..___tag_value_eval_4na_64.913-..___tag_value_eval_4na_64.861
-	.byte 0x04
-	.4byte 0x00000000
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.866-..___tag_value_eval_4na_64.861
-	.byte 0x0c
-	.2byte 0x0804
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.867-..___tag_value_eval_4na_64.866
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.869-..___tag_value_eval_4na_64.867
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.872-..___tag_value_eval_4na_64.869
-	.byte 0x0f
-	.4byte 0x7dc87506
-	.2byte 0x2306
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.873-..___tag_value_eval_4na_64.872
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.876-..___tag_value_eval_4na_64.873
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.878-..___tag_value_eval_4na_64.876
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.883-..___tag_value_eval_4na_64.878
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.885-..___tag_value_eval_4na_64.883
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.890-..___tag_value_eval_4na_64.885
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.892-..___tag_value_eval_4na_64.890
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.897-..___tag_value_eval_4na_64.892
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.899-..___tag_value_eval_4na_64.897
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.904-..___tag_value_eval_4na_64.899
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.906-..___tag_value_eval_4na_64.904
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.911-..___tag_value_eval_4na_64.906
-	.byte 0x0c
-	.2byte 0x0404
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x000000d4
-	.4byte .debug_frame_seg
-	.4byte ..___tag_value_eval_4na_128.916
-	.4byte ..___tag_value_eval_4na_128.975-..___tag_value_eval_4na_128.916
-	.byte 0x04
-	.4byte 0x00000000
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.921-..___tag_value_eval_4na_128.916
-	.byte 0x0c
-	.2byte 0x0804
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.922-..___tag_value_eval_4na_128.921
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.924-..___tag_value_eval_4na_128.922
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.927-..___tag_value_eval_4na_128.924
-	.byte 0x0f
-	.4byte 0x7de87506
-	.2byte 0x2306
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.928-..___tag_value_eval_4na_128.927
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.931-..___tag_value_eval_4na_128.928
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.933-..___tag_value_eval_4na_128.931
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.938-..___tag_value_eval_4na_128.933
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.940-..___tag_value_eval_4na_128.938
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.945-..___tag_value_eval_4na_128.940
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.947-..___tag_value_eval_4na_128.945
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.952-..___tag_value_eval_4na_128.947
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.954-..___tag_value_eval_4na_128.952
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.959-..___tag_value_eval_4na_128.954
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.961-..___tag_value_eval_4na_128.959
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.966-..___tag_value_eval_4na_128.961
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.968-..___tag_value_eval_4na_128.966
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.973-..___tag_value_eval_4na_128.968
-	.byte 0x0c
-	.2byte 0x0404
-	.4byte 0x00000160
-	.4byte .debug_frame_seg
-	.4byte ..___tag_value_eval_4na_pos.978
-	.4byte ..___tag_value_eval_4na_pos.1079-..___tag_value_eval_4na_pos.978
-	.byte 0x04
-	.4byte 0x00000000
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.983-..___tag_value_eval_4na_pos.978
-	.byte 0x0c
-	.2byte 0x0804
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.984-..___tag_value_eval_4na_pos.983
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.986-..___tag_value_eval_4na_pos.984
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.989-..___tag_value_eval_4na_pos.986
-	.byte 0x0f
-	.4byte 0x7de87506
-	.2byte 0x2306
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.990-..___tag_value_eval_4na_pos.989
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.993-..___tag_value_eval_4na_pos.990
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.995-..___tag_value_eval_4na_pos.993
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.1000-..___tag_value_eval_4na_pos.995
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.1002-..___tag_value_eval_4na_pos.1000
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.1007-..___tag_value_eval_4na_pos.1002
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.1009-..___tag_value_eval_4na_pos.1007
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.1014-..___tag_value_eval_4na_pos.1009
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.1016-..___tag_value_eval_4na_pos.1014
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.1021-..___tag_value_eval_4na_pos.1016
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.1023-..___tag_value_eval_4na_pos.1021
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.1028-..___tag_value_eval_4na_pos.1023
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.1030-..___tag_value_eval_4na_pos.1028
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.1035-..___tag_value_eval_4na_pos.1030
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.1037-..___tag_value_eval_4na_pos.1035
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.1042-..___tag_value_eval_4na_pos.1037
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.1044-..___tag_value_eval_4na_pos.1042
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.1049-..___tag_value_eval_4na_pos.1044
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.1051-..___tag_value_eval_4na_pos.1049
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.1056-..___tag_value_eval_4na_pos.1051
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.1058-..___tag_value_eval_4na_pos.1056
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.1063-..___tag_value_eval_4na_pos.1058
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.1065-..___tag_value_eval_4na_pos.1063
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.1070-..___tag_value_eval_4na_pos.1065
-	.byte 0x0c
-	.2byte 0x0404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.1072-..___tag_value_eval_4na_pos.1070
-	.byte 0x0c
-	.2byte 0x0803
-	.byte 0x10
-	.4byte 0x00750205
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.1077-..___tag_value_eval_4na_pos.1072
-	.byte 0x0c
-	.2byte 0x0404
-	.2byte 0x0000
-	.4byte 0x0000013c
-	.4byte .debug_frame_seg
-	.4byte ..___tag_value_NucStrstrSearch.1082
-	.4byte ..___tag_value_NucStrstrSearch.1250-..___tag_value_NucStrstrSearch.1082
-	.byte 0x04
-	.4byte 0x00000000
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1087-..___tag_value_NucStrstrSearch.1082
-	.byte 0x0c
-	.2byte 0x0805
-	.byte 0x85
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1090-..___tag_value_NucStrstrSearch.1087
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1095-..___tag_value_NucStrstrSearch.1090
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1100-..___tag_value_NucStrstrSearch.1095
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1105-..___tag_value_NucStrstrSearch.1100
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1110-..___tag_value_NucStrstrSearch.1105
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1115-..___tag_value_NucStrstrSearch.1110
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1120-..___tag_value_NucStrstrSearch.1115
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1125-..___tag_value_NucStrstrSearch.1120
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1130-..___tag_value_NucStrstrSearch.1125
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1135-..___tag_value_NucStrstrSearch.1130
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1140-..___tag_value_NucStrstrSearch.1135
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1145-..___tag_value_NucStrstrSearch.1140
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1150-..___tag_value_NucStrstrSearch.1145
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1155-..___tag_value_NucStrstrSearch.1150
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1160-..___tag_value_NucStrstrSearch.1155
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1165-..___tag_value_NucStrstrSearch.1160
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1170-..___tag_value_NucStrstrSearch.1165
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1175-..___tag_value_NucStrstrSearch.1170
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1180-..___tag_value_NucStrstrSearch.1175
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1185-..___tag_value_NucStrstrSearch.1180
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1190-..___tag_value_NucStrstrSearch.1185
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1195-..___tag_value_NucStrstrSearch.1190
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1200-..___tag_value_NucStrstrSearch.1195
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1205-..___tag_value_NucStrstrSearch.1200
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1210-..___tag_value_NucStrstrSearch.1205
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1215-..___tag_value_NucStrstrSearch.1210
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1220-..___tag_value_NucStrstrSearch.1215
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1225-..___tag_value_NucStrstrSearch.1220
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1230-..___tag_value_NucStrstrSearch.1225
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1235-..___tag_value_NucStrstrSearch.1230
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1240-..___tag_value_NucStrstrSearch.1235
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.1245-..___tag_value_NucStrstrSearch.1240
-	.byte 0x85
-	.byte 0x02
-	.byte 0x83
-	.byte 0x03
-	.2byte 0x0000
-	.byte 0x00
-	.section .text
-.LNDBG_TXe:
-# End
diff --git a/libs/search/nucstrstr-icc-i386-prof.pic.s b/libs/search/nucstrstr-icc-i386-prof.pic.s
deleted file mode 100644
index a44ad71..0000000
--- a/libs/search/nucstrstr-icc-i386-prof.pic.s
+++ /dev/null
@@ -1,7600 +0,0 @@
-	.section .text
-.LNDBG_TX:
-# -- Machine type PW
-# mark_description "Intel(R) C++ Compiler for applications running on IA-32, Version 10.1    Build 20081024 %s";
-# mark_description "-I/home/yaschenk/devel/internal/asm-trace/sra/search/linux -I/home/yaschenk/devel/internal/asm-trace/sra/sea";
-# mark_description "rch/unix -I/home/yaschenk/devel/internal/asm-trace/sra/search -I/home/yaschenk/devel/internal/asm-trace/itf ";
-# mark_description "-I/home/yaschenk/devel/internal/asm-trace/inc/icc/i386 -I/home/yaschenk/devel/internal/asm-trace/inc/icc -I/";
-# mark_description "home/yaschenk/devel/internal/asm-trace/inc/gcc/i386 -I/home/yaschenk/devel/internal/asm-trace/inc/gcc -I/hom";
-# mark_description "e/yaschenk/devel/internal/asm-trace/inc/linux -I/home/yaschenk/devel/internal/asm-trace/inc/unix -I/home/rod";
-# mark_description "armer/devel/internal/asm-trace/inc -c -S -o nucstrstr.pic.s -fPIC -O3 -unroll -xW -vec_report5 -DNDEBUG -D_P";
-# mark_description "ROFILING -p -DLINUX -DUNIX -D_GNU_SOURCE -D_REENTRANT -D_FILE_OFFSET_BITS=64 -MD";
-	.file "nucstrstr.c"
-	.text
-..TXTST0:
-# -- Begin  NucStrstrSearch
-# mark_begin;
-       .align    2,0x90
-	.globl NucStrstrSearch
-NucStrstrSearch:
-# parameter 1(self): 8 + %ebp
-# parameter 2(ncbi2na): 12 + %ebp
-# parameter 3(pos): 16 + %ebp
-# parameter 4(len): 20 + %ebp
-# parameter 5(selflen): 24 + %ebp
-..B1.1:                         # Preds ..B1.0
-        pushl     %ebp                                          #5217.1
-        movl      %esp, %ebp                                    #5217.1
-        subl      $16, %esp                                     #5217.1
-        movl      %edi, -8(%ebp)                                #5217.1
-        movl      %esi, -12(%ebp)                               #5217.1
-        movl      %ebx, -16(%ebp)                               #5217.1
-        movl      8(%ebp), %edi                                 #5215.5
-        movl      16(%ebp), %eax                                #5215.5
-        movl      20(%ebp), %esi                                #5215.5
-        movl      %eax, -4(%ebp)                                #5215.5
-        call      ..L1          # Prob 100%                     #5217.1
-..L1:                                                           #
-        popl      %ebx                                          #5217.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L1], %ebx       #5217.1
-        lea       _gprof_pack0 at GOTOFF(%ebx), %edx               #5217.1
-        call      mcount at PLT                                    #5217.1
-                                # LOE ebx esi edi
-..B1.2:                         # Preds ..B1.1
-        testl     %edi, %edi                                    #5218.18
-        je        ..B1.108      # Prob 6%                       #5218.18
-                                # LOE ebx esi edi
-..B1.3:                         # Preds ..B1.2
-        movl      12(%ebp), %eax                                #5218.37
-        testl     %eax, %eax                                    #5218.37
-        je        ..B1.108      # Prob 6%                       #5218.37
-                                # LOE ebx esi edi
-..B1.4:                         # Preds ..B1.3
-        movl      -4(%ebp), %edx                                #
-                                # LOE edx ebx esi edi
-..B1.5:                         # Preds ..B1.15 ..B1.18 ..B1.4
-        testl     %esi, %esi                                    #5218.52
-        je        ..B1.108      # Prob 28%                      #5218.52
-                                # LOE edx ebx esi edi
-..B1.8:                         # Preds ..B1.5 ..B1.32
-        movl      (%edi), %eax                                  #5223.18
-        cmpl      $12, %eax                                     #5223.9
-        ja        ..B1.108      # Prob 50%                      #5223.9
-                                # LOE eax edx ebx esi edi
-..B1.9:                         # Preds ..B1.8
-        movl      ..1..TPKT.30_0.0.0 at GOTOFF(%ebx,%eax,4), %eax  #5223.9
-        jmp       *%eax                                         #5223.9
-                                # LOE edx ebx esi edi
-..1.30_0.TAG.0c.0.0:
-..B1.11:                        # Preds ..B1.9
-        movl      4(%edi), %eax                                 #5286.22
-        testl     %eax, %eax                                    #5286.22
-        je        ..B1.20       # Prob 20%                      #5286.22
-                                # LOE eax edx ebx esi edi
-..B1.12:                        # Preds ..B1.11
-        cmpl      $13, %eax                                     #5286.22
-        je        ..B1.20       # Prob 25%                      #5286.22
-                                # LOE eax edx ebx esi edi
-..B1.13:                        # Preds ..B1.12
-        cmpl      $14, %eax                                     #5286.22
-        jne       ..B1.16       # Prob 67%                      #5286.22
-                                # LOE eax edx ebx esi edi
-..B1.14:                        # Preds ..B1.13
-        movl      8(%edi), %edi                                 #5297.29
-        movl      4(%edi), %eax                                 #5297.29
-        cmpl      %esi, %eax                                    #5298.34
-        ja        ..B1.108      # Prob 5%                       #5298.34
-                                # LOE eax edx ebx edi
-..B1.15:                        # Preds ..B1.14
-        movl      %eax, %esi                                    #5297.17
-        testl     %edi, %edi                                    #5218.18
-        jne       ..B1.5        # Prob 94%                      #5218.18
-        jmp       ..B1.108      # Prob 100%                     #5218.18
-                                # LOE edx ebx esi edi
-..B1.16:                        # Preds ..B1.13
-        cmpl      $15, %eax                                     #5286.22
-        jne       ..B1.108      # Prob 50%                      #5286.22
-                                # LOE edx ebx esi edi
-..B1.17:                        # Preds ..B1.16
-        movl      8(%edi), %edi                                 #5302.29
-        movl      4(%edi), %eax                                 #5302.29
-        cmpl      %esi, %eax                                    #5303.34
-        ja        ..B1.108      # Prob 5%                       #5303.34
-                                # LOE eax edx ebx esi edi
-..B1.18:                        # Preds ..B1.17
-        addl      %esi, %edx                                    #5306.27
-        subl      %eax, %edx                                    #5306.33
-        movl      %eax, %esi                                    #5302.17
-        testl     %edi, %edi                                    #5218.18
-        jne       ..B1.5        # Prob 94%                      #5218.18
-        jmp       ..B1.108      # Prob 100%                     #5218.18
-                                # LOE edx ebx esi edi
-..B1.20:                        # Preds ..B1.11 ..B1.12
-        movl      %edx, -4(%ebp)                                #
-                                # LOE edx ebx esi edi dl dh
-..B1.21:                        # Preds ..B1.20
-        movl      24(%ebp), %eax                                #5217.1
-        movl      12(%ebp), %ecx                                #5217.1
-        pushl     %eax                                          #5217.1
-        pushl     %esi                                          #5217.1
-        pushl     %edx                                          #5217.1
-        pushl     %ecx                                          #5217.1
-        pushl     8(%edi)                                       #5217.1
-        call      NucStrstrSearch at PLT                           #5290.25
-                                # LOE eax edi
-..B1.118:                       # Preds ..B1.21
-        addl      $20, %esp                                     #5290.25
-                                # LOE eax edi
-..B1.22:                        # Preds ..B1.118
-        movl      4(%edi), %edx                                 #5291.22
-        testl     %edx, %edx                                    #5291.42
-        je        ..B1.57       # Prob 28%                      #5291.42
-                                # LOE eax
-..B1.23:                        # Preds ..B1.22
-        testl     %eax, %eax                                    #5293.31
-        jne       ..B1.108      # Prob 72%                      #5293.31
-                                # LOE
-..B1.24:                        # Preds ..B1.23
-        movl      -16(%ebp), %ebx                               #5294.28
-        movl      -12(%ebp), %esi                               #5294.28
-        movl      -8(%ebp), %edi                                #5294.28
-        movl      $1, %eax                                      #5294.28
-        movl      %ebp, %esp                                    #5294.28
-        popl      %ebp                                          #5294.28
-        ret                                                     #5294.28
-                                # LOE
-..1.30_0.TAG.0b.0.0:
-..B1.27:                        # Preds ..B1.9
-        movl      24(%ebp), %eax                                #5217.1
-        movl      12(%ebp), %ecx                                #5217.1
-        movl      %edx, -4(%ebp)                                #5272.21
-        pushl     %eax                                          #5217.1
-        pushl     %esi                                          #5217.1
-        pushl     %edx                                          #5217.1
-        pushl     %ecx                                          #5217.1
-        pushl     8(%edi)                                       #5217.1
-        call      NucStrstrSearch at PLT                           #5272.21
-                                # LOE eax ebx esi edi
-..B1.119:                       # Preds ..B1.27
-        movl      -4(%ebp), %edx                                #
-        addl      $20, %esp                                     #5272.21
-                                # LOE eax edx ebx esi edi dl dh
-..B1.28:                        # Preds ..B1.119
-        movl      4(%edi), %ecx                                 #5273.22
-        cmpl      $17, %ecx                                     #5273.22
-        jne       ..B1.30       # Prob 67%                      #5273.22
-                                # LOE eax edx ecx ebx esi edi dl dh
-..B1.29:                        # Preds ..B1.28
-        testl     %eax, %eax                                    #5276.31
-        jne       ..B1.57       # Prob 5%                       #5276.31
-        jmp       ..B1.32       # Prob 100%                     #5276.31
-                                # LOE eax edx ebx esi edi dl dh
-..B1.30:                        # Preds ..B1.28
-        cmpl      $16, %ecx                                     #5273.22
-        jne       ..B1.32       # Prob 50%                      #5273.22
-                                # LOE eax edx ebx esi edi dl dh
-..B1.31:                        # Preds ..B1.30
-        testl     %eax, %eax                                    #5280.31
-        je        ..B1.57       # Prob 5%                       #5280.31
-                                # LOE eax edx ebx esi edi dl dh
-..B1.32:                        # Preds ..B1.29 ..B1.31 ..B1.30
-        movl      12(%edi), %edi                                #5284.38
-        testl     %edi, %edi                                    #5218.18
-        jne       ..B1.8        # Prob 94%                      #5218.18
-        jmp       ..B1.108      # Prob 100%                     #5218.18
-                                # LOE edx ebx esi edi
-..1.30_0.TAG.0a.0.0:
-..B1.34:                        # Preds ..B1.9
-        movl      %edx, -4(%ebp)                                #
-                                # LOE esi edi
-..B1.35:                        # Preds ..B1.34
-        movl      4(%edi), %edx                                 #5268.24
-        cmpl      %edx, %esi                                    #5268.24
-        jb        ..B1.108      # Prob 28%                      #5268.24
-                                # LOE edx esi edi
-..B1.36:                        # Preds ..B1.35
-        movl      24(%ebp), %eax                                #5269.9
-        testl     %eax, %eax                                    #5269.9
-        je        ..B1.38       # Prob 12%                      #5269.9
-                                # LOE edx esi edi
-..B1.37:                        # Preds ..B1.36
-        movl      24(%ebp), %eax                                #5269.18
-        movl      %edx, (%eax)                                  #5269.18
-                                # LOE esi edi
-..B1.38:                        # Preds ..B1.37 ..B1.36
-        movl      -4(%ebp), %eax                                #5218.5
-        movl      12(%ebp), %edx                                #5218.5
-        pushl     %esi                                          #5218.5
-        pushl     %eax                                          #5218.5
-        pushl     %edx                                          #5218.5
-        pushl     %edi                                          #5218.5
-        call      eval_4na_pos                                  #5270.20
-                                # LOE eax
-..B1.120:                       # Preds ..B1.38
-        movl      -16(%ebp), %ebx                               #5270.20
-        movl      -12(%ebp), %esi                               #5270.20
-        movl      -8(%ebp), %edi                                #5270.20
-        addl      $16, %esp                                     #5270.20
-        movl      %ebp, %esp                                    #5270.20
-        popl      %ebp                                          #5270.20
-        ret                                                     #5270.20
-                                # LOE
-..1.30_0.TAG.09.0.0:
-..B1.40:                        # Preds ..B1.9
-        movl      %edx, -4(%ebp)                                #
-                                # LOE esi edi
-..B1.41:                        # Preds ..B1.40
-        movl      4(%edi), %edx                                 #5264.24
-        cmpl      %edx, %esi                                    #5264.24
-        jb        ..B1.108      # Prob 28%                      #5264.24
-                                # LOE edx esi edi
-..B1.42:                        # Preds ..B1.41
-        movl      24(%ebp), %eax                                #5265.9
-        testl     %eax, %eax                                    #5265.9
-        je        ..B1.44       # Prob 12%                      #5265.9
-                                # LOE edx esi edi
-..B1.43:                        # Preds ..B1.42
-        movl      24(%ebp), %eax                                #5265.18
-        movl      %edx, (%eax)                                  #5265.18
-                                # LOE esi edi
-..B1.44:                        # Preds ..B1.43 ..B1.42
-        movl      -4(%ebp), %eax                                #5218.5
-        movl      12(%ebp), %edx                                #5218.5
-        pushl     %esi                                          #5218.5
-        pushl     %eax                                          #5218.5
-        pushl     %edx                                          #5218.5
-        pushl     %edi                                          #5218.5
-        call      eval_2na_pos                                  #5266.20
-                                # LOE eax
-..B1.121:                       # Preds ..B1.44
-        movl      -16(%ebp), %ebx                               #5266.20
-        movl      -12(%ebp), %esi                               #5266.20
-        movl      -8(%ebp), %edi                                #5266.20
-        addl      $16, %esp                                     #5266.20
-        movl      %ebp, %esp                                    #5266.20
-        popl      %ebp                                          #5266.20
-        ret                                                     #5266.20
-                                # LOE
-..1.30_0.TAG.08.0.0:
-..B1.46:                        # Preds ..B1.9
-        movl      %edx, -4(%ebp)                                #
-                                # LOE esi edi
-..B1.47:                        # Preds ..B1.46
-        movl      4(%edi), %edx                                 #5259.24
-        cmpl      %edx, %esi                                    #5259.24
-        jb        ..B1.108      # Prob 28%                      #5259.24
-                                # LOE edx esi edi
-..B1.48:                        # Preds ..B1.47
-        movl      24(%ebp), %eax                                #5260.9
-        testl     %eax, %eax                                    #5260.9
-        je        ..B1.50       # Prob 12%                      #5260.9
-                                # LOE edx esi edi
-..B1.49:                        # Preds ..B1.48
-        movl      24(%ebp), %eax                                #5260.18
-        movl      %edx, (%eax)                                  #5260.18
-                                # LOE esi edi
-..B1.50:                        # Preds ..B1.49 ..B1.48
-        movl      -4(%ebp), %eax                                #5218.5
-        movl      12(%ebp), %edx                                #5218.5
-        pushl     %esi                                          #5218.5
-        pushl     %eax                                          #5218.5
-        pushl     %edx                                          #5218.5
-        pushl     %edi                                          #5218.5
-        call      eval_4na_128                                  #5261.20
-                                # LOE eax
-..B1.122:                       # Preds ..B1.50
-        movl      -16(%ebp), %ebx                               #5261.20
-        movl      -12(%ebp), %esi                               #5261.20
-        movl      -8(%ebp), %edi                                #5261.20
-        addl      $16, %esp                                     #5261.20
-        movl      %ebp, %esp                                    #5261.20
-        popl      %ebp                                          #5261.20
-        ret                                                     #5261.20
-                                # LOE
-..1.30_0.TAG.07.0.0:
-..B1.52:                        # Preds ..B1.9
-        movl      %edx, -4(%ebp)                                #
-                                # LOE esi edi
-..B1.53:                        # Preds ..B1.52
-        movl      4(%edi), %edx                                 #5255.24
-        cmpl      %edx, %esi                                    #5255.24
-        jb        ..B1.108      # Prob 28%                      #5255.24
-                                # LOE edx esi edi
-..B1.54:                        # Preds ..B1.53
-        movl      24(%ebp), %eax                                #5256.9
-        testl     %eax, %eax                                    #5256.9
-        je        ..B1.56       # Prob 12%                      #5256.9
-                                # LOE edx esi edi
-..B1.55:                        # Preds ..B1.54
-        movl      24(%ebp), %eax                                #5256.18
-        movl      %edx, (%eax)                                  #5256.18
-                                # LOE esi edi
-..B1.56:                        # Preds ..B1.55 ..B1.54
-        movl      -4(%ebp), %eax                                #5218.5
-        movl      12(%ebp), %edx                                #5218.5
-        pushl     %esi                                          #5218.5
-        pushl     %eax                                          #5218.5
-        pushl     %edx                                          #5218.5
-        pushl     %edi                                          #5218.5
-        call      eval_4na_32                                   #5257.20
-                                # LOE eax
-..B1.123:                       # Preds ..B1.56
-        addl      $16, %esp                                     #5257.20
-                                # LOE eax
-..B1.57:                        # Preds ..B1.29 ..B1.31 ..B1.22 ..B1.123
-        movl      -16(%ebp), %ebx                               #5257.20
-        movl      -12(%ebp), %esi                               #5257.20
-        movl      -8(%ebp), %edi                                #5257.20
-        movl      %ebp, %esp                                    #5257.20
-        popl      %ebp                                          #5257.20
-        ret                                                     #5257.20
-                                # LOE
-..1.30_0.TAG.06.0.0:
-..B1.59:                        # Preds ..B1.9
-        movl      %edx, -4(%ebp)                                #
-                                # LOE esi edi
-..B1.60:                        # Preds ..B1.59
-        movl      4(%edi), %edx                                 #5251.24
-        cmpl      %edx, %esi                                    #5251.24
-        jb        ..B1.108      # Prob 28%                      #5251.24
-                                # LOE edx esi edi
-..B1.61:                        # Preds ..B1.60
-        movl      24(%ebp), %eax                                #5252.9
-        testl     %eax, %eax                                    #5252.9
-        je        ..B1.63       # Prob 12%                      #5252.9
-                                # LOE edx esi edi
-..B1.62:                        # Preds ..B1.61
-        movl      24(%ebp), %eax                                #5252.18
-        movl      %edx, (%eax)                                  #5252.18
-                                # LOE esi edi
-..B1.63:                        # Preds ..B1.62 ..B1.61
-        movl      -4(%ebp), %eax                                #5218.5
-        movl      12(%ebp), %edx                                #5218.5
-        pushl     %esi                                          #5218.5
-        pushl     %eax                                          #5218.5
-        pushl     %edx                                          #5218.5
-        pushl     %edi                                          #5218.5
-        call      eval_4na_16                                   #5253.20
-                                # LOE eax
-..B1.124:                       # Preds ..B1.63
-        addl      $16, %esp                                     #5253.20
-                                # LOE eax
-..B1.64:                        # Preds ..B1.124
-        movl      -16(%ebp), %ebx                               #5253.20
-        movl      -12(%ebp), %esi                               #5253.20
-        movl      -8(%ebp), %edi                                #5253.20
-        movl      %ebp, %esp                                    #5253.20
-        popl      %ebp                                          #5253.20
-        ret                                                     #5253.20
-                                # LOE
-..1.30_0.TAG.05.0.0:
-..B1.66:                        # Preds ..B1.9
-        movl      %edx, -4(%ebp)                                #
-                                # LOE esi edi
-..B1.67:                        # Preds ..B1.66
-        movl      4(%edi), %edx                                 #5247.24
-        cmpl      %edx, %esi                                    #5247.24
-        jb        ..B1.108      # Prob 28%                      #5247.24
-                                # LOE edx esi edi
-..B1.68:                        # Preds ..B1.67
-        movl      24(%ebp), %eax                                #5248.9
-        testl     %eax, %eax                                    #5248.9
-        je        ..B1.70       # Prob 12%                      #5248.9
-                                # LOE edx esi edi
-..B1.69:                        # Preds ..B1.68
-        movl      24(%ebp), %eax                                #5248.18
-        movl      %edx, (%eax)                                  #5248.18
-                                # LOE esi edi
-..B1.70:                        # Preds ..B1.69 ..B1.68
-        movl      -4(%ebp), %eax                                #5218.5
-        movl      12(%ebp), %edx                                #5218.5
-        pushl     %esi                                          #5218.5
-        pushl     %eax                                          #5218.5
-        pushl     %edx                                          #5218.5
-        pushl     %edi                                          #5218.5
-        call      eval_2na_128                                  #5249.20
-                                # LOE eax
-..B1.125:                       # Preds ..B1.70
-        movl      -16(%ebp), %ebx                               #5249.20
-        movl      -12(%ebp), %esi                               #5249.20
-        movl      -8(%ebp), %edi                                #5249.20
-        addl      $16, %esp                                     #5249.20
-        movl      %ebp, %esp                                    #5249.20
-        popl      %ebp                                          #5249.20
-        ret                                                     #5249.20
-                                # LOE
-..1.30_0.TAG.04.0.0:
-..B1.72:                        # Preds ..B1.9
-        movl      %edx, -4(%ebp)                                #
-                                # LOE esi edi
-..B1.73:                        # Preds ..B1.72
-        movl      4(%edi), %edx                                 #5243.24
-        cmpl      %edx, %esi                                    #5243.24
-        jb        ..B1.108      # Prob 28%                      #5243.24
-                                # LOE edx esi edi
-..B1.74:                        # Preds ..B1.73
-        movl      24(%ebp), %eax                                #5244.9
-        testl     %eax, %eax                                    #5244.9
-        je        ..B1.76       # Prob 12%                      #5244.9
-                                # LOE edx esi edi
-..B1.75:                        # Preds ..B1.74
-        movl      24(%ebp), %eax                                #5244.18
-        movl      %edx, (%eax)                                  #5244.18
-                                # LOE esi edi
-..B1.76:                        # Preds ..B1.75 ..B1.74
-        movl      -4(%ebp), %eax                                #5218.5
-        movl      12(%ebp), %edx                                #5218.5
-        pushl     %esi                                          #5218.5
-        pushl     %eax                                          #5218.5
-        pushl     %edx                                          #5218.5
-        pushl     %edi                                          #5218.5
-        call      eval_2na_32                                   #5245.20
-                                # LOE eax
-..B1.126:                       # Preds ..B1.76
-        addl      $16, %esp                                     #5245.20
-                                # LOE eax
-..B1.77:                        # Preds ..B1.126
-        movl      -16(%ebp), %ebx                               #5245.20
-        movl      -12(%ebp), %esi                               #5245.20
-        movl      -8(%ebp), %edi                                #5245.20
-        movl      %ebp, %esp                                    #5245.20
-        popl      %ebp                                          #5245.20
-        ret                                                     #5245.20
-                                # LOE
-..1.30_0.TAG.03.0.0:
-..B1.79:                        # Preds ..B1.9
-        movl      %edx, -4(%ebp)                                #
-                                # LOE esi edi
-..B1.80:                        # Preds ..B1.79
-        movl      4(%edi), %edx                                 #5239.24
-        cmpl      %edx, %esi                                    #5239.24
-        jb        ..B1.108      # Prob 28%                      #5239.24
-                                # LOE edx esi edi
-..B1.81:                        # Preds ..B1.80
-        movl      24(%ebp), %eax                                #5240.9
-        testl     %eax, %eax                                    #5240.9
-        je        ..B1.83       # Prob 12%                      #5240.9
-                                # LOE edx esi edi
-..B1.82:                        # Preds ..B1.81
-        movl      24(%ebp), %eax                                #5240.18
-        movl      %edx, (%eax)                                  #5240.18
-                                # LOE esi edi
-..B1.83:                        # Preds ..B1.82 ..B1.81
-        movl      -4(%ebp), %eax                                #5218.5
-        movl      12(%ebp), %edx                                #5218.5
-        pushl     %esi                                          #5218.5
-        pushl     %eax                                          #5218.5
-        pushl     %edx                                          #5218.5
-        pushl     %edi                                          #5218.5
-        call      eval_2na_16                                   #5241.20
-                                # LOE eax
-..B1.127:                       # Preds ..B1.83
-        addl      $16, %esp                                     #5241.20
-                                # LOE eax
-..B1.84:                        # Preds ..B1.127
-        movl      -16(%ebp), %ebx                               #5241.20
-        movl      -12(%ebp), %esi                               #5241.20
-        movl      -8(%ebp), %edi                                #5241.20
-        movl      %ebp, %esp                                    #5241.20
-        popl      %ebp                                          #5241.20
-        ret                                                     #5241.20
-                                # LOE
-..1.30_0.TAG.02.0.0:
-..B1.86:                        # Preds ..B1.9
-        movl      %edx, -4(%ebp)                                #
-                                # LOE esi edi
-..B1.87:                        # Preds ..B1.86
-        movl      4(%edi), %edx                                 #5235.24
-        cmpl      %edx, %esi                                    #5235.24
-        jb        ..B1.108      # Prob 28%                      #5235.24
-                                # LOE edx esi edi
-..B1.88:                        # Preds ..B1.87
-        movl      24(%ebp), %eax                                #5236.9
-        testl     %eax, %eax                                    #5236.9
-        je        ..B1.90       # Prob 12%                      #5236.9
-                                # LOE edx esi edi
-..B1.89:                        # Preds ..B1.88
-        movl      24(%ebp), %eax                                #5236.18
-        movl      %edx, (%eax)                                  #5236.18
-                                # LOE esi edi
-..B1.90:                        # Preds ..B1.89 ..B1.88
-        movl      -4(%ebp), %eax                                #5218.5
-        movl      12(%ebp), %edx                                #5218.5
-        pushl     %esi                                          #5218.5
-        pushl     %eax                                          #5218.5
-        pushl     %edx                                          #5218.5
-        pushl     %edi                                          #5218.5
-        call      eval_2na_8                                    #5237.20
-                                # LOE eax
-..B1.128:                       # Preds ..B1.90
-        addl      $16, %esp                                     #5237.20
-                                # LOE eax
-..B1.91:                        # Preds ..B1.128
-        movl      -16(%ebp), %ebx                               #5237.20
-        movl      -12(%ebp), %esi                               #5237.20
-        movl      -8(%ebp), %edi                                #5237.20
-        movl      %ebp, %esp                                    #5237.20
-        popl      %ebp                                          #5237.20
-        ret                                                     #5237.20
-                                # LOE
-..1.30_0.TAG.01.0.0:
-..B1.93:                        # Preds ..B1.9
-        movl      %edx, -4(%ebp)                                #
-                                # LOE esi edi
-..B1.94:                        # Preds ..B1.93
-        movl      4(%edi), %edx                                 #5230.24
-        cmpl      %edx, %esi                                    #5230.24
-        jb        ..B1.108      # Prob 28%                      #5230.24
-                                # LOE edx esi edi
-..B1.95:                        # Preds ..B1.94
-        movl      24(%ebp), %eax                                #5231.9
-        testl     %eax, %eax                                    #5231.9
-        je        ..B1.97       # Prob 12%                      #5231.9
-                                # LOE edx esi edi
-..B1.96:                        # Preds ..B1.95
-        movl      24(%ebp), %eax                                #5231.18
-        movl      %edx, (%eax)                                  #5231.18
-                                # LOE esi edi
-..B1.97:                        # Preds ..B1.96 ..B1.95
-        movl      -4(%ebp), %eax                                #5218.5
-        movl      12(%ebp), %edx                                #5218.5
-        pushl     %esi                                          #5218.5
-        pushl     %eax                                          #5218.5
-        pushl     %edx                                          #5218.5
-        pushl     %edi                                          #5218.5
-        call      eval_4na_64                                   #5232.20
-                                # LOE eax
-..B1.129:                       # Preds ..B1.97
-        addl      $16, %esp                                     #5232.20
-                                # LOE eax
-..B1.98:                        # Preds ..B1.129
-        movl      -16(%ebp), %ebx                               #5232.20
-        movl      -12(%ebp), %esi                               #5232.20
-        movl      -8(%ebp), %edi                                #5232.20
-        movl      %ebp, %esp                                    #5232.20
-        popl      %ebp                                          #5232.20
-        ret                                                     #5232.20
-                                # LOE
-..1.30_0.TAG.00.0.0:
-..B1.100:                       # Preds ..B1.9
-        movl      %edx, -4(%ebp)                                #
-                                # LOE esi edi
-..B1.101:                       # Preds ..B1.100
-        movl      4(%edi), %edx                                 #5226.24
-        cmpl      %edx, %esi                                    #5226.24
-        jb        ..B1.108      # Prob 28%                      #5226.24
-                                # LOE edx esi edi
-..B1.102:                       # Preds ..B1.101
-        movl      24(%ebp), %eax                                #5227.9
-        testl     %eax, %eax                                    #5227.9
-        je        ..B1.104      # Prob 12%                      #5227.9
-                                # LOE edx esi edi
-..B1.103:                       # Preds ..B1.102
-        movl      24(%ebp), %eax                                #5227.18
-        movl      %edx, (%eax)                                  #5227.18
-                                # LOE esi edi
-..B1.104:                       # Preds ..B1.103 ..B1.102
-        movl      -4(%ebp), %eax                                #5218.5
-        movl      12(%ebp), %edx                                #5218.5
-        pushl     %esi                                          #5218.5
-        pushl     %eax                                          #5218.5
-        pushl     %edx                                          #5218.5
-        pushl     %edi                                          #5218.5
-        call      eval_2na_64                                   #5228.20
-                                # LOE eax
-..B1.130:                       # Preds ..B1.104
-        addl      $16, %esp                                     #5228.20
-                                # LOE eax
-..B1.105:                       # Preds ..B1.130
-        movl      -16(%ebp), %ebx                               #5228.20
-        movl      -12(%ebp), %esi                               #5228.20
-        movl      -8(%ebp), %edi                                #5228.20
-        movl      %ebp, %esp                                    #5228.20
-        popl      %ebp                                          #5228.20
-        ret                                                     #5228.20
-                                # LOE
-..B1.108:                       # Preds ..B1.14 ..B1.17 ..B1.18 ..B1.15 ..B1.8
-                                #       ..B1.32 ..B1.16 ..B1.5 ..B1.101 ..B1.94
-                                #       ..B1.87 ..B1.80 ..B1.73 ..B1.67 ..B1.60
-                                #       ..B1.53 ..B1.47 ..B1.41 ..B1.35 ..B1.23
-                                #       ..B1.3 ..B1.2
-        movl      -16(%ebp), %ebx                               #5311.12
-        movl      -12(%ebp), %esi                               #5311.12
-        movl      -8(%ebp), %edi                                #5311.12
-        xorl      %eax, %eax                                    #5311.12
-        movl      %ebp, %esp                                    #5311.12
-        popl      %ebp                                          #5311.12
-        ret                                                     #5311.12
-        .align    2,0x90
-                                # LOE
-# mark_end;
-	.type	NucStrstrSearch, at function
-	.size	NucStrstrSearch,.-NucStrstrSearch
-.LNNucStrstrSearch:
-	.section .data1, "wa"
-	.align 4
-	.align 4
-..1..TPKT.30_0.0.0:
-	.long	..1.30_0.TAG.00.0.0
-	.long	..1.30_0.TAG.01.0.0
-	.long	..1.30_0.TAG.02.0.0
-	.long	..1.30_0.TAG.03.0.0
-	.long	..1.30_0.TAG.04.0.0
-	.long	..1.30_0.TAG.05.0.0
-	.long	..1.30_0.TAG.06.0.0
-	.long	..1.30_0.TAG.07.0.0
-	.long	..1.30_0.TAG.08.0.0
-	.long	..1.30_0.TAG.09.0.0
-	.long	..1.30_0.TAG.0a.0.0
-	.long	..1.30_0.TAG.0b.0.0
-	.long	..1.30_0.TAG.0c.0.0
-	.data
-# -- End  NucStrstrSearch
-	.text
-# -- Begin  eval_2na_64
-# mark_begin;
-       .align    2,0x90
-eval_2na_64:
-# parameter 1(self): 8 + %ebx
-# parameter 2(ncbi2na): 12 + %ebx
-# parameter 3(pos): 16 + %ebx
-# parameter 4(len): 20 + %ebx
-..B2.1:                         # Preds ..B2.0
-        pushl     %ebx                                          #3075.1
-        movl      %esp, %ebx                                    #3075.1
-        andl      $-16, %esp                                    #3075.1
-        pushl     %ebp                                          #3075.1
-        pushl     %ebp                                          #3075.1
-        movl      4(%ebx), %ebp                                 #3075.1
-        movl      %ebp, 4(%esp)                                 #3075.1
-        movl      %esp, %ebp                                    #3075.1
-        subl      $120, %esp                                    #3075.1
-        movl      %ebx, -120(%ebp)                              #3075.1
-        movl      %edi, -40(%ebp)                               #3075.1
-        movl      %esi, -36(%ebp)                               #3075.1
-        movl      16(%ebx), %eax                                #3073.5
-        movl      %eax, -24(%ebp)                               #3073.5
-        call      ..L2          # Prob 100%                     #3075.1
-..L2:                                                           #
-        popl      %ecx                                          #3075.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L2], %ecx       #3075.1
-        lea       _gprof_pack1 at GOTOFF(%ecx), %edx               #3075.1
-        movl      %ecx, %ebx                                    #3075.1
-        call      mcount at PLT                                    #3075.1
-        movl      -120(%ebp), %ebx                              #3075.1
-                                # LOE
-..B2.51:                        # Preds ..B2.1
-        movl      20(%ebx), %edx                                #3113.5
-        movl      -24(%ebp), %eax                               #3113.5
-        movl      12(%ebx), %ecx                                #3116.30
-        lea       (%eax,%edx), %esi                             #3113.5
-        movl      %eax, %edi                                    #3116.49
-        shrl      $2, %edi                                      #3116.49
-        movl      %edi, -16(%ebp)                               #3116.49
-        lea       (%ecx,%edi), %edi                             #3116.30
-        movl      %edi, -20(%ebp)                               #3116.30
-        movl      8(%ebx), %edi                                 #3119.12
-        subl      4(%edi), %esi                                 #3119.12
-        movl      %esi, -28(%ebp)                               #3119.12
-        lea       3(%eax,%edx), %esi                            #3122.50
-        movl      -20(%ebp), %eax                               #3125.14
-        movl      -16(%ebp), %edx                               #3125.14
-        shrl      $2, %esi                                      #3122.57
-        addl      %ecx, %esi                                    #3122.30
-        testb     $15, %al                                      #3125.14
-        jne       ..B2.3        # Prob 50%                      #3125.14
-                                # LOE eax edx esi al dl ah dh
-..B2.2:                         # Preds ..B2.51
-        movdqa    (%eax), %xmm0                                 #3125.14
-        movdqa    %xmm0, -104(%ebp)                             #3125.14
-        jmp       ..B2.4        # Prob 100%                     #3125.14
-                                # LOE edx esi dl dh
-..B2.3:                         # Preds ..B2.51
-        movdqu    (%eax), %xmm0                                 #3125.14
-        movdqa    %xmm0, -104(%ebp)                             #3125.14
-                                # LOE edx esi dl dh
-..B2.4:                         # Preds ..B2.2 ..B2.3
-        movl      12(%ebx), %eax                                #3126.5
-        lea       16(%eax,%edx), %edx                           #3126.5
-        movl      %edx, -32(%ebp)                               #3126.5
-        cmpl      %esi, %edx                                    #3131.16
-        jae       ..B2.6        # Prob 12%                      #3131.16
-                                # LOE edx esi dl dh
-..B2.5:                         # Preds ..B2.4
-        movzbl    -1(%edx), %eax                                #3132.24
-        shll      $8, %eax                                      #3132.38
-        jmp       ..B2.7        # Prob 100%                     #3132.38
-                                # LOE eax edx esi dl dh
-..B2.6:                         # Preds ..B2.4
-        xorl      %eax, %eax                                    #
-                                # LOE eax edx esi dl dh
-..B2.7:                         # Preds ..B2.5 ..B2.6
-        movl      8(%ebx), %ecx                                 #3136.5
-        movl      -24(%ebp), %edi                               #3148.20
-        movdqa    16(%ecx), %xmm6                               #3136.5
-        movdqa    32(%ecx), %xmm5                               #3136.5
-        movdqa    48(%ecx), %xmm7                               #3136.5
-        movdqa    64(%ecx), %xmm4                               #3136.5
-        movdqa    80(%ecx), %xmm3                               #3136.5
-        movdqa    96(%ecx), %xmm2                               #3136.5
-        movdqa    112(%ecx), %xmm0                              #3136.5
-        movdqa    128(%ecx), %xmm1                              #3136.5
-        andl      $3, %edi                                      #3148.20
-        je        ..B2.43       # Prob 20%                      #3148.20
-                                # LOE eax edx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B2.8:                         # Preds ..B2.7
-        cmpl      $1, %edi                                      #3148.20
-        je        ..B2.14       # Prob 25%                      #3148.20
-                                # LOE eax edx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B2.9:                         # Preds ..B2.8
-        cmpl      $2, %edi                                      #3148.20
-        je        ..B2.13       # Prob 33%                      #3148.20
-                                # LOE eax edx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B2.10:                        # Preds ..B2.9
-        cmpl      $3, %edi                                      #3148.20
-        je        ..B2.12       # Prob 50%                      #3148.20
-                                # LOE eax edx esi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B2.11:                        # Preds ..B2.10
-        movdqa    %xmm0, -88(%ebp)                              #
-        movdqa    -104(%ebp), %xmm0                             #
-        movdqa    %xmm7, -72(%ebp)                              #
-        movl      %esi, -48(%ebp)                               #
-        jmp       ..B2.35       # Prob 100%                     #
-                                # LOE eax edx dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.12:                        # Preds ..B2.10
-        movdqa    %xmm0, -88(%ebp)                              #
-        movdqa    -104(%ebp), %xmm0                             #
-        movdqa    %xmm7, -72(%ebp)                              #
-        movl      %esi, -48(%ebp)                               #
-        xorl      %ecx, %ecx                                    #
-        movl      %ecx, -56(%ebp)                               #
-        movl      %ecx, -52(%ebp)                               #
-        movl      %ecx, -44(%ebp)                               #
-        movl      $8, %ecx                                      #
-        jmp       ..B2.17       # Prob 100%                     #
-                                # LOE eax edx ecx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.13:                        # Preds ..B2.9
-        movdqa    %xmm0, -88(%ebp)                              #
-        movdqa    -104(%ebp), %xmm0                             #
-        movdqa    %xmm7, -72(%ebp)                              #
-        movl      %esi, -48(%ebp)                               #
-        xorl      %ecx, %ecx                                    #
-        movl      %ecx, -52(%ebp)                               #
-        movl      %ecx, -44(%ebp)                               #
-        movl      $8, %ecx                                      #
-        jmp       ..B2.16       # Prob 100%                     #
-                                # LOE eax edx ecx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.14:                        # Preds ..B2.8
-        movdqa    %xmm0, -88(%ebp)                              #
-        movdqa    -104(%ebp), %xmm0                             #
-        movdqa    %xmm7, -72(%ebp)                              #
-        movl      %esi, -48(%ebp)                               #
-        xorl      %edi, %edi                                    #
-        movl      %edi, -44(%ebp)                               #
-        movl      $8, %ecx                                      #
-                                # LOE eax edx ecx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.15:                        # Preds ..B2.14 ..B2.39
-        movdqa    %xmm0, %xmm7                                  #3171.22
-        pand      %xmm4, %xmm7                                  #3171.22
-        pcmpeqd   -72(%ebp), %xmm7                              #3172.22
-        pmovmskb  %xmm7, %esi                                   #3173.22
-        movl      %esi, %edi                                    #3174.17
-        andl      $3855, %edi                                   #3174.17
-        shll      $4, %edi                                      #3174.17
-        andl      %edi, %esi                                    #3174.17
-        movl      %esi, %edi                                    #3174.17
-        sarl      $4, %edi                                      #3174.17
-        orl       %edi, %esi                                    #3174.17
-        movl      %esi, -52(%ebp)                               #3174.17
-                                # LOE eax edx ecx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.16:                        # Preds ..B2.13 ..B2.15
-        movdqa    %xmm0, %xmm7                                  #3177.22
-        pand      %xmm2, %xmm7                                  #3177.22
-        pcmpeqd   %xmm3, %xmm7                                  #3178.22
-        pmovmskb  %xmm7, %esi                                   #3179.22
-        movl      %esi, %edi                                    #3180.17
-        andl      $3855, %edi                                   #3180.17
-        shll      $4, %edi                                      #3180.17
-        andl      %edi, %esi                                    #3180.17
-        movl      %esi, %edi                                    #3180.17
-        sarl      $4, %edi                                      #3180.17
-        orl       %edi, %esi                                    #3180.17
-        movl      %esi, -56(%ebp)                               #3180.17
-                                # LOE eax edx ecx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.17:                        # Preds ..B2.12 ..B2.16
-        movdqa    %xmm0, %xmm7                                  #3183.22
-        pand      %xmm1, %xmm7                                  #3183.22
-        pcmpeqd   -88(%ebp), %xmm7                              #3184.22
-        pmovmskb  %xmm7, %esi                                   #3185.22
-        movl      %esi, %edi                                    #3186.17
-        andl      $3855, %edi                                   #3186.17
-        shll      $4, %edi                                      #3186.17
-        andl      %edi, %esi                                    #3186.17
-        movl      %esi, %edi                                    #3186.17
-        sarl      $4, %edi                                      #3186.17
-        orl       %edi, %esi                                    #3186.17
-        movl      -24(%ebp), %edi                               #3190.17
-        movl      %esi, -20(%ebp)                               #3186.17
-        andl      $-4, %edi                                     #3190.17
-        movl      %edi, -16(%ebp)                               #3190.17
-        movl      -44(%ebp), %edi                               #3193.29
-        orl       -52(%ebp), %edi                               #3193.29
-        orl       -56(%ebp), %edi                               #3193.34
-        orl       %esi, %edi                                    #3193.39
-        je        ..B2.26       # Prob 78%                      #3193.47
-                                # LOE eax edx ecx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.18:                        # Preds ..B2.17
-        movl      -44(%ebp), %edi                               #3211.58
-        movl      %ecx, -104(%ebp)                              #
-        movl      %edx, -100(%ebp)                              #
-        movl      %eax, -96(%ebp)                               #
-        movzwl    %di, %eax                                     #3211.58
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #3211.30
-        movswl    %ax, %eax                                     #3211.30
-        movl      %eax, -24(%ebp)                               #3211.30
-        movl      -52(%ebp), %eax                               #3212.58
-        movzwl    %ax, %eax                                     #3212.58
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #3212.30
-        movswl    %ax, %esi                                     #3212.30
-        movl      -56(%ebp), %eax                               #3213.58
-        movzwl    %ax, %eax                                     #3213.58
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #3213.30
-        movswl    %ax, %ecx                                     #3213.30
-        movl      -20(%ebp), %eax                               #3214.58
-        movzwl    %ax, %eax                                     #3214.58
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #3214.30
-        movswl    %ax, %edx                                     #3214.30
-        lea       1(,%esi,4), %eax                              #3220.40
-        movl      %eax, -116(%ebp)                              #3220.40
-        lea       2(,%ecx,4), %eax                              #3221.40
-        movl      -104(%ebp), %ecx                              #3226.32
-        testl     %edi, %edi                                    #3226.32
-        movl      %eax, -112(%ebp)                              #3221.40
-        lea       3(,%edx,4), %eax                              #3222.40
-        movl      -100(%ebp), %edx                              #3226.32
-        movl      %eax, -108(%ebp)                              #3222.40
-        movl      -96(%ebp), %eax                               #3226.32
-        je        ..B2.20       # Prob 50%                      #3226.32
-                                # LOE eax edx ecx al dl cl ah dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.19:                        # Preds ..B2.18
-        movl      -24(%ebp), %edi                               #3226.43
-        movl      -16(%ebp), %esi                               #3226.43
-        lea       (%esi,%edi,4), %edi                           #3226.43
-        movl      -28(%ebp), %esi                               #3226.49
-        cmpl      %edi, %esi                                    #3226.49
-        jae       ..B2.44       # Prob 1%                       #3226.49
-                                # LOE eax edx ecx al dl cl ah dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.20:                        # Preds ..B2.19 ..B2.18
-        movl      -52(%ebp), %esi                               #3227.32
-        testl     %esi, %esi                                    #3227.32
-        je        ..B2.22       # Prob 50%                      #3227.32
-                                # LOE eax edx ecx al dl cl ah dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.21:                        # Preds ..B2.20
-        movl      -116(%ebp), %edi                              #3227.43
-        addl      -16(%ebp), %edi                               #3227.43
-        movl      -28(%ebp), %esi                               #3227.49
-        cmpl      %edi, %esi                                    #3227.49
-        jae       ..B2.44       # Prob 1%                       #3227.49
-                                # LOE eax edx ecx al dl cl ah dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.22:                        # Preds ..B2.21 ..B2.20
-        movl      -56(%ebp), %esi                               #3228.32
-        testl     %esi, %esi                                    #3228.32
-        je        ..B2.24       # Prob 50%                      #3228.32
-                                # LOE eax edx ecx al dl cl ah dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.23:                        # Preds ..B2.22
-        movl      -112(%ebp), %edi                              #3228.43
-        addl      -16(%ebp), %edi                               #3228.43
-        movl      -28(%ebp), %esi                               #3228.49
-        cmpl      %edi, %esi                                    #3228.49
-        jae       ..B2.44       # Prob 1%                       #3228.49
-                                # LOE eax edx ecx al dl cl ah dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.24:                        # Preds ..B2.23 ..B2.22
-        movl      -20(%ebp), %esi                               #3229.32
-        testl     %esi, %esi                                    #3229.32
-        je        ..B2.26       # Prob 50%                      #3229.32
-                                # LOE eax edx ecx al dl cl ah dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.25:                        # Preds ..B2.24
-        movl      -108(%ebp), %edi                              #3229.43
-        addl      -16(%ebp), %edi                               #3229.43
-        movl      -28(%ebp), %esi                               #3229.49
-        cmpl      %edi, %esi                                    #3229.49
-        jae       ..B2.44       # Prob 1%                       #3229.49
-                                # LOE eax edx ecx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.26:                        # Preds ..B2.25 ..B2.24 ..B2.17
-        movl      -16(%ebp), %esi                               #3234.17
-        lea       4(%esi), %edi                                 #3234.17
-        movl      -28(%ebp), %esi                               #3237.28
-        movl      %edi, -24(%ebp)                               #3234.17
-        cmpl      %esi, %edi                                    #3237.28
-        ja        ..B2.41       # Prob 1%                       #3237.28
-                                # LOE eax edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.27:                        # Preds ..B2.26
-        addl      $-1, %ecx                                     #3241.25
-        jne       ..B2.36       # Prob 50%                      #3241.39
-                                # LOE eax edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.28:                        # Preds ..B2.27
-        movl      -48(%ebp), %ecx                               #3262.25
-        cmpl      %ecx, %edx                                    #3262.25
-        jae       ..B2.41       # Prob 1%                       #3262.25
-                                # LOE eax edx esi xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.29:                        # Preds ..B2.28
-        movl      -16(%ebp), %ecx                               #3266.13
-        movl      %esi, %edi                                    #3267.24
-        lea       36(%ecx), %esi                                #3266.13
-        movl      %esi, -24(%ebp)                               #3266.13
-        cmpl      %edi, %esi                                    #3267.24
-        ja        ..B2.41       # Prob 1%                       #3267.24
-                                # LOE eax edx xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.30:                        # Preds ..B2.29
-        testb     $15, %dl                                      #3272.22
-        jne       ..B2.32       # Prob 50%                      #3272.22
-                                # LOE eax edx xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.31:                        # Preds ..B2.30
-        movdqa    (%edx), %xmm0                                 #3272.22
-        jmp       ..B2.33       # Prob 100%                     #3272.22
-                                # LOE eax edx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.32:                        # Preds ..B2.30
-        movdqu    (%edx), %xmm0                                 #3272.22
-                                # LOE eax edx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.33:                        # Preds ..B2.31 ..B2.32
-        movl      -48(%ebp), %ecx                               #3353.24
-        addl      $16, %edx                                     #3350.13
-        movl      %edx, -32(%ebp)                               #3350.13
-        cmpl      %ecx, %edx                                    #3353.24
-        jae       ..B2.35       # Prob 12%                      #3353.24
-                                # LOE eax edx dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.34:                        # Preds ..B2.33
-        movzbl    -1(%edx), %eax                                #3354.32
-        shll      $8, %eax                                      #3354.46
-                                # LOE eax edx dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.35:                        # Preds ..B2.33 ..B2.11 ..B2.34
-        movl      $8, %ecx                                      #3155.13
-        jmp       ..B2.39       # Prob 100%                     #3155.13
-                                # LOE eax edx ecx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.36:                        # Preds ..B2.27
-        movl      -32(%ebp), %esi                               #3249.26
-        movl      -48(%ebp), %edi                               #3249.26
-        psrldq    $1, %xmm0                                     #3246.26
-        cmpl      %edi, %esi                                    #3249.26
-        jae       ..B2.38       # Prob 19%                      #3249.26
-                                # LOE eax edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.37:                        # Preds ..B2.36
-        movzbl    (%esi), %edi                                  #3252.37
-        sarl      $8, %eax                                      #3251.21
-        shll      $8, %edi                                      #3252.48
-        orl       %edi, %eax                                    #3252.21
-        pinsrw    $7, %eax, %xmm0                               #3253.30
-                                # LOE eax edx ecx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.38:                        # Preds ..B2.37 ..B2.36
-        addl      $1, -32(%ebp)                                 #3257.20
-                                # LOE eax edx ecx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.39:                        # Preds ..B2.35 ..B2.38 ..B2.43
-        movdqa    %xmm0, %xmm7                                  #3165.22
-        pand      %xmm5, %xmm7                                  #3165.22
-        pcmpeqd   %xmm6, %xmm7                                  #3166.22
-        pmovmskb  %xmm7, %esi                                   #3167.22
-        movl      %esi, %edi                                    #3168.17
-        andl      $3855, %edi                                   #3168.17
-        shll      $4, %edi                                      #3168.17
-        andl      %edi, %esi                                    #3168.17
-        movl      %esi, %edi                                    #3168.17
-        sarl      $4, %edi                                      #3168.17
-        orl       %edi, %esi                                    #3168.17
-        movl      %esi, -44(%ebp)                               #3168.17
-        jmp       ..B2.15       # Prob 100%                     #3168.17
-                                # LOE eax edx ecx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.41:                        # Preds ..B2.26 ..B2.28 ..B2.29 # Infreq
-        movl      -36(%ebp), %esi                               #3363.12
-        movl      -40(%ebp), %edi                               #3363.12
-        xorl      %eax, %eax                                    #3363.12
-        movl      %ebp, %esp                                    #3363.12
-        popl      %ebp                                          #3363.12
-        movl      %ebx, %esp                                    #3363.12
-        popl      %ebx                                          #3363.12
-        ret                                                     #3363.12
-                                # LOE
-..B2.43:                        # Preds ..B2.7                  # Infreq
-        movdqa    %xmm0, -88(%ebp)                              #
-        movdqa    -104(%ebp), %xmm0                             #
-        movdqa    %xmm7, -72(%ebp)                              #
-        movl      %esi, -48(%ebp)                               #
-        movl      $8, %ecx                                      #
-        jmp       ..B2.39       # Prob 100%                     #
-                                # LOE eax edx ecx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.44:                        # Preds ..B2.21 ..B2.19 ..B2.25 ..B2.23 # Infreq
-        movl      -36(%ebp), %esi                               #3228.63
-        movl      -40(%ebp), %edi                               #3228.63
-        movl      $1, %eax                                      #3228.63
-        movl      %ebp, %esp                                    #3228.63
-        popl      %ebp                                          #3228.63
-        movl      %ebx, %esp                                    #3228.63
-        popl      %ebx                                          #3228.63
-        ret                                                     #3228.63
-        .align    2,0x90
-                                # LOE
-# mark_end;
-	.type	eval_2na_64, at function
-	.size	eval_2na_64,.-eval_2na_64
-.LNeval_2na_64:
-	.data
-# -- End  eval_2na_64
-	.text
-# -- Begin  eval_4na_64
-# mark_begin;
-       .align    2,0x90
-eval_4na_64:
-# parameter 1(self): 8 + %ebx
-# parameter 2(ncbi2na): 12 + %ebx
-# parameter 3(pos): 16 + %ebx
-# parameter 4(len): 20 + %ebx
-..B3.1:                         # Preds ..B3.0
-        pushl     %ebx                                          #4501.1
-        movl      %esp, %ebx                                    #4501.1
-        andl      $-16, %esp                                    #4501.1
-        pushl     %ebp                                          #4501.1
-        pushl     %ebp                                          #4501.1
-        movl      4(%ebx), %ebp                                 #4501.1
-        movl      %ebp, 4(%esp)                                 #4501.1
-        movl      %esp, %ebp                                    #4501.1
-        subl      $152, %esp                                    #4501.1
-        movl      %ebx, -152(%ebp)                              #4501.1
-        movl      %edi, -44(%ebp)                               #4501.1
-        movl      %esi, -40(%ebp)                               #4501.1
-        movl      12(%ebx), %ecx                                #4499.5
-        movl      16(%ebx), %esi                                #4499.5
-        call      ..L3          # Prob 100%                     #4501.1
-..L3:                                                           #
-        popl      %edi                                          #4501.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L3], %edi       #4501.1
-        lea       _gprof_pack2 at GOTOFF(%edi), %edx               #4501.1
-        movl      %edi, %ebx                                    #4501.1
-        call      mcount at PLT                                    #4501.1
-        movl      -152(%ebp), %ebx                              #4501.1
-                                # LOE esi edi
-..B3.41:                        # Preds ..B3.1
-        movl      12(%ebx), %ecx                                #
-        movl      %esi, -24(%ebp)                               #
-        movl      %esi, %eax                                    #4538.49
-        movl      %edi, -16(%ebp)                               #
-        shrl      $2, %eax                                      #4538.49
-        movl      20(%ebx), %edi                                #4535.5
-        movl      %eax, -20(%ebp)                               #4538.49
-        movl      8(%ebx), %eax                                 #4541.12
-        movdqa    16(%eax), %xmm5                               #4554.5
-        movdqa    32(%eax), %xmm4                               #4554.5
-        movdqa    48(%eax), %xmm3                               #4554.5
-        movdqa    64(%eax), %xmm6                               #4554.5
-        movdqa    80(%eax), %xmm2                               #4554.5
-        movdqa    96(%eax), %xmm1                               #4554.5
-        movdqa    128(%eax), %xmm7                              #4554.5
-        lea       (%esi,%edi), %edx                             #4535.5
-        subl      4(%eax), %edx                                 #4541.12
-        movl      %edx, -32(%ebp)                               #4541.12
-        lea       3(%esi,%edi), %edx                            #4544.50
-        shrl      $2, %edx                                      #4544.57
-        movl      -20(%ebp), %esi                               #4547.14
-        movl      -16(%ebp), %edi                               #4547.14
-        addl      %ecx, %edx                                    #4544.30
-        movl      %edx, -36(%ebp)                               #4544.30
-        movzbl    (%esi,%ecx), %edx                             #4547.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%edx,2), %edx        #4547.14
-        movw      %dx, -148(%ebp)                               #4547.14
-        movzbl    1(%esi,%ecx), %edx                            #4547.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%edx,2), %edx        #4547.14
-        movw      %dx, -146(%ebp)                               #4547.14
-        movzbl    2(%esi,%ecx), %edx                            #4547.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%edx,2), %edx        #4547.14
-        movw      %dx, -144(%ebp)                               #4547.14
-        movzbl    3(%esi,%ecx), %edx                            #4547.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%edx,2), %edx        #4547.14
-        movw      %dx, -142(%ebp)                               #4547.14
-        movzbl    4(%esi,%ecx), %edx                            #4547.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%edx,2), %edx        #4547.14
-        movw      %dx, -140(%ebp)                               #4547.14
-        movzbl    5(%esi,%ecx), %edx                            #4547.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%edx,2), %edx        #4547.14
-        movw      %dx, -138(%ebp)                               #4547.14
-        movzbl    6(%esi,%ecx), %edx                            #4547.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%edx,2), %edx        #4547.14
-        movw      %dx, -136(%ebp)                               #4547.14
-        movzbl    7(%esi,%ecx), %edx                            #4547.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%edx,2), %edx        #4547.14
-        movw      %dx, -134(%ebp)                               #4547.14
-        movdqu    -148(%ebp), %xmm0                             #4547.14
-        lea       8(%ecx,%esi), %edx                            #4548.5
-        movl      -24(%ebp), %esi                               #4568.20
-        movdqa    %xmm0, -120(%ebp)                             #4547.14
-        movdqa    112(%eax), %xmm0                              #4554.5
-        movl      %esi, %eax                                    #4568.20
-        movl      %edx, -28(%ebp)                               #4548.5
-        andl      $3, %eax                                      #4568.20
-        je        ..B3.33       # Prob 20%                      #4568.20
-                                # LOE eax edx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B3.2:                         # Preds ..B3.41
-        cmpl      $1, %eax                                      #4568.20
-        je        ..B3.8        # Prob 25%                      #4568.20
-                                # LOE eax edx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B3.3:                         # Preds ..B3.2
-        cmpl      $2, %eax                                      #4568.20
-        je        ..B3.7        # Prob 33%                      #4568.20
-                                # LOE eax edx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B3.4:                         # Preds ..B3.3
-        cmpl      $3, %eax                                      #4568.20
-        je        ..B3.6        # Prob 50%                      #4568.20
-                                # LOE edx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B3.5:                         # Preds ..B3.4
-        movdqa    %xmm7, -104(%ebp)                             #
-        movdqa    %xmm0, -72(%ebp)                              #
-        movdqa    -120(%ebp), %xmm0                             #
-        movdqa    %xmm6, -88(%ebp)                              #
-        movl      %edi, -16(%ebp)                               #
-        jmp       ..B3.25       # Prob 100%                     #
-                                # LOE edx esi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.6:                         # Preds ..B3.4
-        movdqa    %xmm7, -104(%ebp)                             #
-        movdqa    %xmm0, -72(%ebp)                              #
-        movdqa    -120(%ebp), %xmm0                             #
-        movdqa    %xmm6, -88(%ebp)                              #
-        xorl      %eax, %eax                                    #
-        movl      %eax, -56(%ebp)                               #
-        movl      %edi, -16(%ebp)                               #
-        xorl      %ecx, %ecx                                    #
-        movl      $4, %eax                                      #
-        movl      %ecx, -52(%ebp)                               #
-        movl      %ecx, -48(%ebp)                               #
-        jmp       ..B3.11       # Prob 100%                     #
-                                # LOE eax edx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.7:                         # Preds ..B3.3
-        movdqa    %xmm7, -104(%ebp)                             #
-        movdqa    %xmm0, -72(%ebp)                              #
-        movdqa    -120(%ebp), %xmm0                             #
-        movdqa    %xmm6, -88(%ebp)                              #
-        xorl      %eax, %eax                                    #
-        movl      %eax, -52(%ebp)                               #
-        movl      %edi, -16(%ebp)                               #
-        xorl      %ecx, %ecx                                    #
-        movl      $4, %eax                                      #
-        movl      %ecx, -48(%ebp)                               #
-        jmp       ..B3.10       # Prob 100%                     #
-                                # LOE eax edx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.8:                         # Preds ..B3.2
-        movdqa    %xmm7, -104(%ebp)                             #
-        movdqa    %xmm0, -72(%ebp)                              #
-        movdqa    -120(%ebp), %xmm0                             #
-        movdqa    %xmm6, -88(%ebp)                              #
-        xorl      %ecx, %ecx                                    #
-        movl      %ecx, -48(%ebp)                               #
-        movl      %edi, -16(%ebp)                               #
-        movl      $4, %eax                                      #
-                                # LOE eax edx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.9:                         # Preds ..B3.8 ..B3.29
-        movdqa    %xmm0, %xmm7                                  #4592.22
-        movdqa    %xmm0, %xmm6                                  #4593.22
-        pand      -88(%ebp), %xmm6                              #4593.22
-        pand      %xmm3, %xmm7                                  #4592.22
-        pcmpeqd   %xmm6, %xmm7                                  #4594.22
-        pmovmskb  %xmm7, %ecx                                   #4595.22
-        movl      %ecx, %edi                                    #4596.17
-        andl      $3855, %edi                                   #4596.17
-        shll      $4, %edi                                      #4596.17
-        andl      %edi, %ecx                                    #4596.17
-        movl      %ecx, %edi                                    #4596.17
-        sarl      $4, %edi                                      #4596.17
-        orl       %edi, %ecx                                    #4596.17
-        movl      %ecx, -52(%ebp)                               #4596.17
-                                # LOE eax edx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.10:                        # Preds ..B3.7 ..B3.9
-        movdqa    %xmm0, %xmm7                                  #4599.22
-        movdqa    %xmm0, %xmm6                                  #4600.22
-        pand      %xmm2, %xmm7                                  #4599.22
-        pand      %xmm1, %xmm6                                  #4600.22
-        pcmpeqd   %xmm6, %xmm7                                  #4601.22
-        pmovmskb  %xmm7, %ecx                                   #4602.22
-        movl      %ecx, %edi                                    #4603.17
-        andl      $3855, %edi                                   #4603.17
-        shll      $4, %edi                                      #4603.17
-        andl      %edi, %ecx                                    #4603.17
-        movl      %ecx, %edi                                    #4603.17
-        sarl      $4, %edi                                      #4603.17
-        orl       %edi, %ecx                                    #4603.17
-        movl      %ecx, -56(%ebp)                               #4603.17
-                                # LOE eax edx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.11:                        # Preds ..B3.6 ..B3.10
-        movdqa    %xmm0, %xmm7                                  #4606.22
-        movdqa    %xmm0, %xmm6                                  #4607.22
-        pand      -72(%ebp), %xmm7                              #4606.22
-        pand      -104(%ebp), %xmm6                             #4607.22
-        pcmpeqd   %xmm6, %xmm7                                  #4608.22
-        pmovmskb  %xmm7, %edi                                   #4609.22
-        movl      %edi, %ecx                                    #4610.17
-        andl      $3855, %ecx                                   #4610.17
-        shll      $4, %ecx                                      #4610.17
-        andl      %ecx, %edi                                    #4610.17
-        movl      %edi, %ecx                                    #4610.17
-        sarl      $4, %ecx                                      #4610.17
-        orl       %ecx, %edi                                    #4610.17
-        movl      %edi, -20(%ebp)                               #4610.17
-        movl      %esi, %ecx                                    #4614.17
-        andl      $-4, %ecx                                     #4614.17
-        movl      -48(%ebp), %esi                               #4617.29
-        orl       -52(%ebp), %esi                               #4617.29
-        orl       -56(%ebp), %esi                               #4617.34
-        orl       %edi, %esi                                    #4617.39
-        je        ..B3.20       # Prob 78%                      #4617.47
-                                # LOE eax edx ecx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.12:                        # Preds ..B3.11
-        movl      -48(%ebp), %edi                               #4635.58
-        movl      %ecx, -120(%ebp)                              #
-        movl      %eax, -116(%ebp)                              #
-        movzwl    %di, %eax                                     #4635.58
-        movl      %edx, -112(%ebp)                              #
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4635.30
-        movswl    %ax, %eax                                     #4635.30
-        movl      %eax, -132(%ebp)                              #4635.30
-        movl      -52(%ebp), %eax                               #4636.58
-        movzwl    %ax, %eax                                     #4636.58
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4636.30
-        movswl    %ax, %esi                                     #4636.30
-        movl      -56(%ebp), %eax                               #4637.58
-        movzwl    %ax, %eax                                     #4637.58
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4637.30
-        movswl    %ax, %ecx                                     #4637.30
-        movl      -20(%ebp), %eax                               #4638.58
-        movzwl    %ax, %eax                                     #4638.58
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4638.30
-        movswl    %ax, %edx                                     #4638.30
-        lea       1(%esi,%esi), %eax                            #4644.40
-        movl      %eax, -128(%ebp)                              #4644.40
-        lea       2(%ecx,%ecx), %eax                            #4645.40
-        movl      -120(%ebp), %ecx                              #4650.32
-        testl     %edi, %edi                                    #4650.32
-        movl      %eax, -124(%ebp)                              #4645.40
-        lea       3(%edx,%edx), %eax                            #4646.40
-        movl      -112(%ebp), %edx                              #4650.32
-        movl      %eax, -24(%ebp)                               #4646.40
-        movl      -116(%ebp), %eax                              #4650.32
-        je        ..B3.14       # Prob 50%                      #4650.32
-                                # LOE eax edx ecx al dl cl ah dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.13:                        # Preds ..B3.12
-        movl      -132(%ebp), %esi                              #4650.43
-        movl      -32(%ebp), %edi                               #4650.49
-        lea       (%ecx,%esi,2), %esi                           #4650.43
-        cmpl      %esi, %edi                                    #4650.49
-        jae       ..B3.34       # Prob 1%                       #4650.49
-                                # LOE eax edx ecx al dl cl ah dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.14:                        # Preds ..B3.13 ..B3.12
-        movl      -52(%ebp), %esi                               #4651.32
-        testl     %esi, %esi                                    #4651.32
-        je        ..B3.16       # Prob 50%                      #4651.32
-                                # LOE eax edx ecx al dl cl ah dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.15:                        # Preds ..B3.14
-        movl      -128(%ebp), %edi                              #4651.43
-        movl      -32(%ebp), %esi                               #4651.49
-        addl      %ecx, %edi                                    #4651.43
-        cmpl      %edi, %esi                                    #4651.49
-        jae       ..B3.34       # Prob 1%                       #4651.49
-                                # LOE eax edx ecx al dl cl ah dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.16:                        # Preds ..B3.15 ..B3.14
-        movl      -56(%ebp), %esi                               #4652.32
-        testl     %esi, %esi                                    #4652.32
-        je        ..B3.18       # Prob 50%                      #4652.32
-                                # LOE eax edx ecx al dl cl ah dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.17:                        # Preds ..B3.16
-        movl      -124(%ebp), %edi                              #4652.43
-        movl      -32(%ebp), %esi                               #4652.49
-        addl      %ecx, %edi                                    #4652.43
-        cmpl      %edi, %esi                                    #4652.49
-        jae       ..B3.34       # Prob 1%                       #4652.49
-                                # LOE eax edx ecx al dl cl ah dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.18:                        # Preds ..B3.17 ..B3.16
-        movl      -20(%ebp), %esi                               #4653.32
-        testl     %esi, %esi                                    #4653.32
-        je        ..B3.20       # Prob 50%                      #4653.32
-                                # LOE eax edx ecx al dl cl ah dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.19:                        # Preds ..B3.18
-        movl      -24(%ebp), %edi                               #4653.43
-        movl      -32(%ebp), %esi                               #4653.49
-        addl      %ecx, %edi                                    #4653.43
-        cmpl      %edi, %esi                                    #4653.49
-        jae       ..B3.34       # Prob 1%                       #4653.49
-                                # LOE eax edx ecx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.20:                        # Preds ..B3.19 ..B3.18 ..B3.11
-        movl      -32(%ebp), %edi                               #4661.28
-        lea       4(%ecx), %esi                                 #4658.17
-        cmpl      %edi, %esi                                    #4661.28
-        ja        ..B3.31       # Prob 1%                       #4661.28
-                                # LOE eax edx ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.21:                        # Preds ..B3.20
-        addl      $-1, %eax                                     #4665.25
-        jne       ..B3.26       # Prob 50%                      #4665.39
-                                # LOE eax edx ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.22:                        # Preds ..B3.21
-        movl      -36(%ebp), %eax                               #4682.25
-        cmpl      %eax, %edx                                    #4682.25
-        jae       ..B3.31       # Prob 1%                       #4682.25
-                                # LOE edx ecx edi xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.23:                        # Preds ..B3.22
-        movl      %edi, %eax                                    #4687.24
-        lea       20(%ecx), %esi                                #4686.13
-        cmpl      %eax, %esi                                    #4687.24
-        ja        ..B3.31       # Prob 1%                       #4687.24
-                                # LOE edx esi xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.24:                        # Preds ..B3.23
-        movl      -16(%ebp), %eax                               #4692.22
-        movzbl    (%edx), %ecx                                  #4692.22
-        movzwl    expand_2na.0 at GOTOFF(%eax,%ecx,2), %edi        #4692.22
-        movzbl    1(%edx), %ecx                                 #4692.22
-        movzwl    expand_2na.0 at GOTOFF(%eax,%ecx,2), %ecx        #4692.22
-        movw      %di, -148(%ebp)                               #4692.22
-        movw      %cx, -146(%ebp)                               #4692.22
-        movzbl    2(%edx), %ecx                                 #4692.22
-        movzwl    expand_2na.0 at GOTOFF(%eax,%ecx,2), %ecx        #4692.22
-        movw      %cx, -144(%ebp)                               #4692.22
-        movzbl    3(%edx), %ecx                                 #4692.22
-        movzwl    expand_2na.0 at GOTOFF(%eax,%ecx,2), %ecx        #4692.22
-        movw      %cx, -142(%ebp)                               #4692.22
-        movzbl    4(%edx), %ecx                                 #4692.22
-        movzwl    expand_2na.0 at GOTOFF(%eax,%ecx,2), %ecx        #4692.22
-        movw      %cx, -140(%ebp)                               #4692.22
-        movzbl    5(%edx), %ecx                                 #4692.22
-        movzwl    expand_2na.0 at GOTOFF(%eax,%ecx,2), %ecx        #4692.22
-        movw      %cx, -138(%ebp)                               #4692.22
-        movzbl    6(%edx), %ecx                                 #4692.22
-        movzwl    expand_2na.0 at GOTOFF(%eax,%ecx,2), %ecx        #4692.22
-        movw      %cx, -136(%ebp)                               #4692.22
-        movzbl    7(%edx), %ecx                                 #4692.22
-        addl      $8, %edx                                      #4707.13
-        movzwl    expand_2na.0 at GOTOFF(%eax,%ecx,2), %eax        #4692.22
-        movw      %ax, -134(%ebp)                               #4692.22
-        movdqu    -148(%ebp), %xmm0                             #4692.22
-        movl      %edx, -28(%ebp)                               #4707.13
-                                # LOE edx esi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.25:                        # Preds ..B3.5 ..B3.24
-        movl      $4, %eax                                      #4575.13
-        jmp       ..B3.29       # Prob 100%                     #4575.13
-                                # LOE eax edx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.26:                        # Preds ..B3.21
-        movl      -36(%ebp), %edi                               #4673.26
-        movl      -28(%ebp), %ecx                               #4673.26
-        psrldq    $2, %xmm0                                     #4670.26
-        cmpl      %edi, %ecx                                    #4673.26
-        jae       ..B3.28       # Prob 19%                      #4673.26
-                                # LOE eax edx ecx esi cl ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.27:                        # Preds ..B3.26
-        movl      -16(%ebp), %edi                               #4674.57
-        movzbl    (%ecx), %ecx                                  #4674.72
-        movzwl    expand_2na.0 at GOTOFF(%edi,%ecx,2), %ecx        #4674.57
-        pinsrw    $7, %ecx, %xmm0                               #4674.30
-                                # LOE eax edx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.28:                        # Preds ..B3.27 ..B3.26
-        addl      $1, -28(%ebp)                                 #4677.20
-                                # LOE eax edx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.29:                        # Preds ..B3.25 ..B3.28 ..B3.33
-        movdqa    %xmm0, %xmm7                                  #4585.22
-        movdqa    %xmm0, %xmm6                                  #4586.22
-        pand      %xmm5, %xmm7                                  #4585.22
-        pand      %xmm4, %xmm6                                  #4586.22
-        pcmpeqd   %xmm6, %xmm7                                  #4587.22
-        pmovmskb  %xmm7, %ecx                                   #4588.22
-        movl      %ecx, %edi                                    #4589.17
-        andl      $3855, %edi                                   #4589.17
-        shll      $4, %edi                                      #4589.17
-        andl      %edi, %ecx                                    #4589.17
-        movl      %ecx, %edi                                    #4589.17
-        sarl      $4, %edi                                      #4589.17
-        orl       %edi, %ecx                                    #4589.17
-        movl      %ecx, -48(%ebp)                               #4589.17
-        jmp       ..B3.9        # Prob 100%                     #4589.17
-                                # LOE eax edx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.31:                        # Preds ..B3.20 ..B3.22 ..B3.23 # Infreq
-        movl      -40(%ebp), %esi                               #4718.12
-        movl      -44(%ebp), %edi                               #4718.12
-        xorl      %eax, %eax                                    #4718.12
-        movl      %ebp, %esp                                    #4718.12
-        popl      %ebp                                          #4718.12
-        movl      %ebx, %esp                                    #4718.12
-        popl      %ebx                                          #4718.12
-        ret                                                     #4718.12
-                                # LOE
-..B3.33:                        # Preds ..B3.41                 # Infreq
-        movdqa    %xmm7, -104(%ebp)                             #
-        movdqa    %xmm0, -72(%ebp)                              #
-        movdqa    -120(%ebp), %xmm0                             #
-        movdqa    %xmm6, -88(%ebp)                              #
-        movl      $4, %eax                                      #
-        movl      %edi, -16(%ebp)                               #
-        jmp       ..B3.29       # Prob 100%                     #
-                                # LOE eax edx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.34:                        # Preds ..B3.13 ..B3.19 ..B3.17 ..B3.15 # Infreq
-        movl      -40(%ebp), %esi                               #4651.63
-        movl      -44(%ebp), %edi                               #4651.63
-        movl      $1, %eax                                      #4651.63
-        movl      %ebp, %esp                                    #4651.63
-        popl      %ebp                                          #4651.63
-        movl      %ebx, %esp                                    #4651.63
-        popl      %ebx                                          #4651.63
-        ret                                                     #4651.63
-        .align    2,0x90
-                                # LOE
-# mark_end;
-	.type	eval_4na_64, at function
-	.size	eval_4na_64,.-eval_4na_64
-.LNeval_4na_64:
-	.data
-# -- End  eval_4na_64
-	.text
-# -- Begin  eval_2na_8
-# mark_begin;
-       .align    2,0x90
-eval_2na_8:
-# parameter 1(self): 8 + %ebx
-# parameter 2(ncbi2na): 12 + %ebx
-# parameter 3(pos): 16 + %ebx
-# parameter 4(len): 20 + %ebx
-..B4.1:                         # Preds ..B4.0
-        pushl     %ebx                                          #2196.1
-        movl      %esp, %ebx                                    #2196.1
-        andl      $-16, %esp                                    #2196.1
-        pushl     %ebp                                          #2196.1
-        pushl     %ebp                                          #2196.1
-        movl      4(%ebx), %ebp                                 #2196.1
-        movl      %ebp, 4(%esp)                                 #2196.1
-        movl      %esp, %ebp                                    #2196.1
-        subl      $88, %esp                                     #2196.1
-        movl      %ebx, -88(%ebp)                               #2196.1
-        movl      %edi, -16(%ebp)                               #2196.1
-        movl      %esi, -12(%ebp)                               #2196.1
-        movl      16(%ebx), %esi                                #2194.5
-        call      ..L4          # Prob 100%                     #2196.1
-..L4:                                                           #
-        popl      %eax                                          #2196.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L4], %eax       #2196.1
-        lea       _gprof_pack3 at GOTOFF(%eax), %edx               #2196.1
-        movl      %eax, %ebx                                    #2196.1
-        call      mcount at PLT                                    #2196.1
-        movl      -88(%ebp), %ebx                               #2196.1
-                                # LOE esi
-..B4.41:                        # Preds ..B4.1
-        movl      20(%ebx), %eax                                #2233.5
-        movl      12(%ebx), %ecx                                #2236.30
-        lea       (%esi,%eax), %edx                             #2233.5
-        movl      %esi, %edi                                    #2236.49
-        shrl      $2, %edi                                      #2236.49
-        lea       3(%esi,%eax), %eax                            #2242.50
-        movl      %edi, -4(%ebp)                                #2236.49
-        lea       (%ecx,%edi), %edi                             #2236.30
-        movl      %edi, -8(%ebp)                                #2236.30
-        shrl      $2, %eax                                      #2242.57
-        movl      8(%ebx), %edi                                 #2239.12
-        subl      4(%edi), %edx                                 #2239.12
-        movl      -8(%ebp), %edi                                #2245.14
-        addl      %ecx, %eax                                    #2242.30
-        testl     $15, %edi                                     #2245.14
-        movl      -4(%ebp), %ecx                                #2245.14
-        jne       ..B4.3        # Prob 50%                      #2245.14
-                                # LOE eax edx ecx esi edi cl ch
-..B4.2:                         # Preds ..B4.41
-        movdqa    (%edi), %xmm6                                 #2245.14
-        jmp       ..B4.4        # Prob 100%                     #2245.14
-                                # LOE eax edx ecx esi cl ch xmm6
-..B4.3:                         # Preds ..B4.41
-        movdqu    (%edi), %xmm6                                 #2245.14
-                                # LOE eax edx ecx esi cl ch xmm6
-..B4.4:                         # Preds ..B4.2 ..B4.3
-        movl      12(%ebx), %edi                                #2246.5
-        lea       16(%edi,%ecx), %ecx                           #2246.5
-        movl      8(%ebx), %edi                                 #2256.5
-        movdqa    16(%edi), %xmm0                               #2256.5
-        movdqa    32(%edi), %xmm5                               #2256.5
-        movdqa    48(%edi), %xmm4                               #2256.5
-        movdqa    64(%edi), %xmm3                               #2256.5
-        movdqa    80(%edi), %xmm2                               #2256.5
-        movdqa    96(%edi), %xmm1                               #2256.5
-        movdqa    128(%edi), %xmm7                              #2256.5
-        movdqa    %xmm0, -40(%ebp)                              #2256.5
-        movdqa    112(%edi), %xmm0                              #2256.5
-        movdqa    %xmm7, -56(%ebp)                              #2256.5
-        movl      %esi, %edi                                    #2268.20
-        andl      $3, %edi                                      #2268.20
-        je        ..B4.8        # Prob 20%                      #2268.20
-                                # LOE eax edx ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.5:                         # Preds ..B4.4
-        cmpl      $1, %edi                                      #2268.20
-        je        ..B4.11       # Prob 25%                      #2268.20
-                                # LOE eax edx ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.6:                         # Preds ..B4.5
-        cmpl      $2, %edi                                      #2268.20
-        je        ..B4.10       # Prob 33%                      #2268.20
-                                # LOE eax edx ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.7:                         # Preds ..B4.6
-        cmpl      $3, %edi                                      #2268.20
-        je        ..B4.9        # Prob 50%                      #2268.20
-                                # LOE eax edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.8:                         # Preds ..B4.4 ..B4.7
-        movl      %eax, -20(%ebp)                               #
-        jmp       ..B4.30       # Prob 100%                     #
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.9:                         # Preds ..B4.7
-        movl      %eax, -20(%ebp)                               #
-        xorl      %edi, %edi                                    #
-        movl      %edi, -60(%ebp)                               #
-        movl      %edi, -24(%ebp)                               #
-        movl      %edi, -4(%ebp)                                #
-        jmp       ..B4.14       # Prob 100%                     #
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.10:                        # Preds ..B4.6
-        movl      %eax, -20(%ebp)                               #
-        xorl      %edi, %edi                                    #
-        movl      %edi, -24(%ebp)                               #
-        movl      %edi, -4(%ebp)                                #
-        jmp       ..B4.13       # Prob 100%                     #
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.11:                        # Preds ..B4.5
-        movl      %eax, -20(%ebp)                               #
-        xorl      %edi, %edi                                    #
-        movl      %edi, -4(%ebp)                                #
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.12:                        # Preds ..B4.11 ..B4.30
-        movdqa    %xmm6, %xmm7                                  #2291.22
-        pand      %xmm3, %xmm7                                  #2291.22
-        pcmpeqb   %xmm4, %xmm7                                  #2292.22
-        pmovmskb  %xmm7, %eax                                   #2293.22
-        movl      %eax, -24(%ebp)                               #2293.22
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.13:                        # Preds ..B4.10 ..B4.12
-        movdqa    %xmm6, %xmm7                                  #2297.22
-        pand      %xmm1, %xmm7                                  #2297.22
-        pcmpeqb   %xmm2, %xmm7                                  #2298.22
-        pmovmskb  %xmm7, %eax                                   #2299.22
-        movl      %eax, -60(%ebp)                               #2299.22
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.14:                        # Preds ..B4.9 ..B4.13
-        pand      -56(%ebp), %xmm6                              #2303.22
-        movl      -4(%ebp), %edi                                #2313.29
-        pcmpeqb   %xmm0, %xmm6                                  #2304.22
-        pmovmskb  %xmm6, %eax                                   #2305.22
-        movl      %eax, -8(%ebp)                                #2305.22
-        andl      $-4, %esi                                     #2310.17
-        orl       -24(%ebp), %edi                               #2313.29
-        orl       -60(%ebp), %edi                               #2313.34
-        orl       %eax, %edi                                    #2313.39
-        je        ..B4.23       # Prob 78%                      #2313.47
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B4.15:                        # Preds ..B4.14
-        movl      -4(%ebp), %edi                                #2331.30
-        movl      %esi, -68(%ebp)                               #
-        movl      %edi, %eax                                    #2331.30
-        movl      %ecx, -64(%ebp)                               #
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2331.30
-        movswl    %ax, %ecx                                     #2331.30
-        movl      -24(%ebp), %eax                               #2332.30
-        movl      %ecx, -84(%ebp)                               #2331.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2332.30
-        movswl    %ax, %ecx                                     #2332.30
-        movl      -60(%ebp), %eax                               #2333.30
-        lea       1(,%ecx,4), %ecx                              #2340.40
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2333.30
-        movswl    %ax, %esi                                     #2333.30
-        movl      -8(%ebp), %eax                                #2334.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2334.30
-        movl      %ecx, -80(%ebp)                               #2340.40
-        movswl    %ax, %eax                                     #2334.30
-        lea       2(,%esi,4), %ecx                              #2341.40
-        movl      -68(%ebp), %esi                               #2346.32
-        movl      %ecx, -76(%ebp)                               #2341.40
-        lea       3(,%eax,4), %ecx                              #2342.40
-        movl      %ecx, -72(%ebp)                               #2342.40
-        movl      -64(%ebp), %ecx                               #2346.32
-        testl     %edi, %edi                                    #2346.32
-        je        ..B4.17       # Prob 50%                      #2346.32
-                                # LOE edx ecx esi cl ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B4.16:                        # Preds ..B4.15
-        movl      -84(%ebp), %eax                               #2346.43
-        lea       (%esi,%eax,4), %edi                           #2346.43
-        cmpl      %edi, %edx                                    #2346.49
-        jae       ..B4.34       # Prob 1%                       #2346.49
-                                # LOE edx ecx esi cl ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B4.17:                        # Preds ..B4.16 ..B4.15
-        movl      -24(%ebp), %eax                               #2347.32
-        testl     %eax, %eax                                    #2347.32
-        je        ..B4.19       # Prob 50%                      #2347.32
-                                # LOE edx ecx esi cl ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B4.18:                        # Preds ..B4.17
-        movl      -80(%ebp), %eax                               #2347.43
-        addl      %esi, %eax                                    #2347.43
-        cmpl      %eax, %edx                                    #2347.49
-        jae       ..B4.35       # Prob 1%                       #2347.49
-                                # LOE edx ecx esi cl ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B4.19:                        # Preds ..B4.18 ..B4.17
-        movl      -60(%ebp), %eax                               #2348.32
-        testl     %eax, %eax                                    #2348.32
-        je        ..B4.21       # Prob 50%                      #2348.32
-                                # LOE edx ecx esi cl ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B4.20:                        # Preds ..B4.19
-        movl      -76(%ebp), %eax                               #2348.43
-        addl      %esi, %eax                                    #2348.43
-        cmpl      %eax, %edx                                    #2348.49
-        jae       ..B4.35       # Prob 1%                       #2348.49
-                                # LOE edx ecx esi cl ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B4.21:                        # Preds ..B4.20 ..B4.19
-        movl      -8(%ebp), %eax                                #2349.32
-        testl     %eax, %eax                                    #2349.32
-        je        ..B4.23       # Prob 50%                      #2349.32
-                                # LOE edx ecx esi cl ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B4.22:                        # Preds ..B4.21
-        movl      -72(%ebp), %eax                               #2349.43
-        addl      %esi, %eax                                    #2349.43
-        cmpl      %eax, %edx                                    #2349.49
-        jae       ..B4.35       # Prob 1%                       #2349.49
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B4.23:                        # Preds ..B4.22 ..B4.21 ..B4.14
-        lea       4(%esi), %eax                                 #2386.13
-        cmpl      %eax, %edx                                    #2357.28
-        jb        ..B4.32       # Prob 1%                       #2357.28
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B4.24:                        # Preds ..B4.23
-        movl      -20(%ebp), %eax                               #2382.25
-        cmpl      %eax, %ecx                                    #2382.25
-        jae       ..B4.32       # Prob 1%                       #2382.25
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B4.25:                        # Preds ..B4.24
-        addl      $64, %esi                                     #2386.13
-        cmpl      %edx, %esi                                    #2387.24
-        ja        ..B4.32       # Prob 1%                       #2387.24
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B4.26:                        # Preds ..B4.25
-        testb     $15, %cl                                      #2392.22
-        jne       ..B4.28       # Prob 50%                      #2392.22
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B4.27:                        # Preds ..B4.26
-        movdqa    (%ecx), %xmm6                                 #2392.22
-        jmp       ..B4.29       # Prob 100%                     #2392.22
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.28:                        # Preds ..B4.26
-        movdqu    (%ecx), %xmm6                                 #2392.22
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.29:                        # Preds ..B4.27 ..B4.28
-        addl      $16, %ecx                                     #2470.13
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.30:                        # Preds ..B4.29 ..B4.8
-        movdqa    %xmm6, %xmm7                                  #2285.22
-        pand      %xmm5, %xmm7                                  #2285.22
-        pcmpeqb   -40(%ebp), %xmm7                              #2286.22
-        pmovmskb  %xmm7, %eax                                   #2287.22
-        movl      %eax, -4(%ebp)                                #2287.22
-        jmp       ..B4.12       # Prob 100%                     #2287.22
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.32:                        # Preds ..B4.23 ..B4.24 ..B4.25 # Infreq
-        movl      -12(%ebp), %esi                               #2483.12
-        movl      -16(%ebp), %edi                               #2483.12
-        xorl      %eax, %eax                                    #2483.12
-        movl      %ebp, %esp                                    #2483.12
-        popl      %ebp                                          #2483.12
-        movl      %ebx, %esp                                    #2483.12
-        popl      %ebx                                          #2483.12
-        ret                                                     #2483.12
-                                # LOE
-..B4.34:                        # Preds ..B4.16                 # Infreq
-        movl      -12(%ebp), %esi                               #2346.63
-        movl      -16(%ebp), %edi                               #2346.63
-        movl      $1, %eax                                      #2346.63
-        movl      %ebp, %esp                                    #2346.63
-        popl      %ebp                                          #2346.63
-        movl      %ebx, %esp                                    #2346.63
-        popl      %ebx                                          #2346.63
-        ret                                                     #2346.63
-                                # LOE
-..B4.35:                        # Preds ..B4.22 ..B4.20 ..B4.18 # Infreq
-        movl      -12(%ebp), %esi                               #2347.63
-        movl      -16(%ebp), %edi                               #2347.63
-        movl      $1, %eax                                      #2347.63
-        movl      %ebp, %esp                                    #2347.63
-        popl      %ebp                                          #2347.63
-        movl      %ebx, %esp                                    #2347.63
-        popl      %ebx                                          #2347.63
-        ret                                                     #2347.63
-        .align    2,0x90
-                                # LOE
-# mark_end;
-	.type	eval_2na_8, at function
-	.size	eval_2na_8,.-eval_2na_8
-.LNeval_2na_8:
-	.data
-# -- End  eval_2na_8
-	.text
-# -- Begin  eval_2na_16
-# mark_begin;
-       .align    2,0x90
-eval_2na_16:
-# parameter 1(self): 8 + %ebx
-# parameter 2(ncbi2na): 12 + %ebx
-# parameter 3(pos): 16 + %ebx
-# parameter 4(len): 20 + %ebx
-..B5.1:                         # Preds ..B5.0
-        pushl     %ebx                                          #2489.1
-        movl      %esp, %ebx                                    #2489.1
-        andl      $-16, %esp                                    #2489.1
-        pushl     %ebp                                          #2489.1
-        pushl     %ebp                                          #2489.1
-        movl      4(%ebx), %ebp                                 #2489.1
-        movl      %ebp, 4(%esp)                                 #2489.1
-        movl      %esp, %ebp                                    #2489.1
-        subl      $104, %esp                                    #2489.1
-        movl      %ebx, -104(%ebp)                              #2489.1
-        movl      %edi, -28(%ebp)                               #2489.1
-        movl      %esi, -24(%ebp)                               #2489.1
-        movl      16(%ebx), %eax                                #2487.5
-        movl      %eax, -12(%ebp)                               #2487.5
-        call      ..L5          # Prob 100%                     #2489.1
-..L5:                                                           #
-        popl      %ecx                                          #2489.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L5], %ecx       #2489.1
-        lea       _gprof_pack4 at GOTOFF(%ecx), %edx               #2489.1
-        movl      %ecx, %ebx                                    #2489.1
-        call      mcount at PLT                                    #2489.1
-        movl      -104(%ebp), %ebx                              #2489.1
-                                # LOE
-..B5.51:                        # Preds ..B5.1
-        movl      20(%ebx), %ecx                                #2526.5
-        movl      -12(%ebp), %edx                               #2526.5
-        movl      12(%ebx), %esi                                #2529.30
-        lea       (%edx,%ecx), %eax                             #2526.5
-        movl      %edx, %edi                                    #2529.49
-        shrl      $2, %edi                                      #2529.49
-        movl      %edi, -4(%ebp)                                #2529.49
-        lea       (%esi,%edi), %edi                             #2529.30
-        movl      %edi, -8(%ebp)                                #2529.30
-        movl      8(%ebx), %edi                                 #2532.12
-        subl      4(%edi), %eax                                 #2532.12
-        movl      %eax, -16(%ebp)                               #2532.12
-        lea       3(%edx,%ecx), %eax                            #2535.50
-        movl      -8(%ebp), %edx                                #2538.14
-        movl      -4(%ebp), %ecx                                #2538.14
-        shrl      $2, %eax                                      #2535.57
-        addl      %esi, %eax                                    #2535.30
-        testb     $15, %dl                                      #2538.14
-        jne       ..B5.3        # Prob 50%                      #2538.14
-                                # LOE eax edx ecx dl cl dh ch
-..B5.2:                         # Preds ..B5.51
-        movdqa    (%edx), %xmm0                                 #2538.14
-        movdqa    %xmm0, -88(%ebp)                              #2538.14
-        jmp       ..B5.4        # Prob 100%                     #2538.14
-                                # LOE eax ecx cl ch
-..B5.3:                         # Preds ..B5.51
-        movdqu    (%edx), %xmm0                                 #2538.14
-        movdqa    %xmm0, -88(%ebp)                              #2538.14
-                                # LOE eax ecx cl ch
-..B5.4:                         # Preds ..B5.2 ..B5.3
-        movl      12(%ebx), %edx                                #2539.5
-        lea       16(%edx,%ecx), %esi                           #2539.5
-        movl      %esi, -20(%ebp)                               #2539.5
-        cmpl      %eax, %esi                                    #2544.16
-        jae       ..B5.6        # Prob 12%                      #2544.16
-                                # LOE eax esi
-..B5.5:                         # Preds ..B5.4
-        movzbl    -1(%esi), %ecx                                #2545.24
-        shll      $8, %ecx                                      #2545.38
-        jmp       ..B5.7        # Prob 100%                     #2545.38
-                                # LOE eax ecx esi
-..B5.6:                         # Preds ..B5.4
-        xorl      %ecx, %ecx                                    #
-                                # LOE eax ecx esi
-..B5.7:                         # Preds ..B5.5 ..B5.6
-        movl      8(%ebx), %edx                                 #2549.5
-        movl      -12(%ebp), %edi                               #2561.20
-        movdqa    16(%edx), %xmm7                               #2549.5
-        movdqa    32(%edx), %xmm6                               #2549.5
-        movdqa    48(%edx), %xmm5                               #2549.5
-        movdqa    64(%edx), %xmm4                               #2549.5
-        movdqa    80(%edx), %xmm3                               #2549.5
-        movdqa    96(%edx), %xmm2                               #2549.5
-        movdqa    112(%edx), %xmm0                              #2549.5
-        movdqa    128(%edx), %xmm1                              #2549.5
-        andl      $3, %edi                                      #2561.20
-        je        ..B5.43       # Prob 20%                      #2561.20
-                                # LOE eax ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B5.8:                         # Preds ..B5.7
-        cmpl      $1, %edi                                      #2561.20
-        je        ..B5.14       # Prob 25%                      #2561.20
-                                # LOE eax ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B5.9:                         # Preds ..B5.8
-        cmpl      $2, %edi                                      #2561.20
-        je        ..B5.13       # Prob 33%                      #2561.20
-                                # LOE eax ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B5.10:                        # Preds ..B5.9
-        cmpl      $3, %edi                                      #2561.20
-        je        ..B5.12       # Prob 50%                      #2561.20
-                                # LOE eax ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B5.11:                        # Preds ..B5.10
-        movdqa    %xmm0, -56(%ebp)                              #
-        movdqa    -88(%ebp), %xmm0                              #
-        movdqa    %xmm7, -72(%ebp)                              #
-        movl      %eax, -32(%ebp)                               #
-        jmp       ..B5.35       # Prob 100%                     #
-                                # LOE ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.12:                        # Preds ..B5.10
-        movdqa    %xmm0, -56(%ebp)                              #
-        movdqa    -88(%ebp), %xmm0                              #
-        movdqa    %xmm7, -72(%ebp)                              #
-        movl      %eax, -32(%ebp)                               #
-        xorl      %edx, %edx                                    #
-        movl      %edx, -40(%ebp)                               #
-        movl      %edx, -36(%ebp)                               #
-        movl      %edx, -8(%ebp)                                #
-        movl      $2, %edx                                      #
-        jmp       ..B5.17       # Prob 100%                     #
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.13:                        # Preds ..B5.9
-        movdqa    %xmm0, -56(%ebp)                              #
-        movdqa    -88(%ebp), %xmm0                              #
-        movdqa    %xmm7, -72(%ebp)                              #
-        movl      %eax, -32(%ebp)                               #
-        xorl      %edx, %edx                                    #
-        movl      %edx, -36(%ebp)                               #
-        movl      %edx, -8(%ebp)                                #
-        movl      $2, %edx                                      #
-        jmp       ..B5.16       # Prob 100%                     #
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.14:                        # Preds ..B5.8
-        movdqa    %xmm0, -56(%ebp)                              #
-        movdqa    -88(%ebp), %xmm0                              #
-        movdqa    %xmm7, -72(%ebp)                              #
-        movl      %eax, -32(%ebp)                               #
-        xorl      %edi, %edi                                    #
-        movl      %edi, -8(%ebp)                                #
-        movl      $2, %edx                                      #
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.15:                        # Preds ..B5.14 ..B5.39
-        movdqa    %xmm0, %xmm7                                  #2584.22
-        pand      %xmm4, %xmm7                                  #2584.22
-        pcmpeqw   %xmm5, %xmm7                                  #2585.22
-        pmovmskb  %xmm7, %eax                                   #2586.22
-        movl      %eax, -36(%ebp)                               #2586.22
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.16:                        # Preds ..B5.13 ..B5.15
-        movdqa    %xmm0, %xmm7                                  #2590.22
-        pand      %xmm2, %xmm7                                  #2590.22
-        pcmpeqw   %xmm3, %xmm7                                  #2591.22
-        pmovmskb  %xmm7, %eax                                   #2592.22
-        movl      %eax, -40(%ebp)                               #2592.22
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.17:                        # Preds ..B5.12 ..B5.16
-        movdqa    %xmm0, %xmm7                                  #2596.22
-        movl      -12(%ebp), %edi                               #2603.17
-        pand      %xmm1, %xmm7                                  #2596.22
-        andl      $-4, %edi                                     #2603.17
-        pcmpeqw   -56(%ebp), %xmm7                              #2597.22
-        pmovmskb  %xmm7, %eax                                   #2598.22
-        movl      %edi, -4(%ebp)                                #2603.17
-        movl      -8(%ebp), %edi                                #2606.29
-        movl      %eax, -76(%ebp)                               #2598.22
-        orl       -36(%ebp), %edi                               #2606.29
-        orl       -40(%ebp), %edi                               #2606.34
-        orl       %eax, %edi                                    #2606.39
-        je        ..B5.26       # Prob 78%                      #2606.47
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.18:                        # Preds ..B5.17
-        movl      -8(%ebp), %edi                                #2624.30
-        movl      %edx, -88(%ebp)                               #
-        movl      %edi, %eax                                    #2624.30
-        movl      %esi, -84(%ebp)                               #
-        movl      %ecx, -80(%ebp)                               #
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2624.30
-        movswl    %ax, %edx                                     #2624.30
-        movl      -36(%ebp), %eax                               #2625.30
-        movl      %edx, -12(%ebp)                               #2624.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2625.30
-        movswl    %ax, %esi                                     #2625.30
-        movl      -40(%ebp), %eax                               #2626.30
-        lea       1(,%esi,4), %esi                              #2633.40
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2626.30
-        movswl    %ax, %ecx                                     #2626.30
-        lea       2(,%ecx,4), %ecx                              #2634.40
-        movl      -76(%ebp), %eax                               #2627.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2627.30
-        movl      %esi, -100(%ebp)                              #2633.40
-        movl      -84(%ebp), %esi                               #2639.32
-        movl      %ecx, -96(%ebp)                               #2634.40
-        movl      -80(%ebp), %ecx                               #2639.32
-        movswl    %ax, %edx                                     #2627.30
-        lea       3(,%edx,4), %edx                              #2635.40
-        movl      %edx, -92(%ebp)                               #2635.40
-        movl      -88(%ebp), %edx                               #2639.32
-        testl     %edi, %edi                                    #2639.32
-        je        ..B5.20       # Prob 50%                      #2639.32
-                                # LOE edx ecx esi dl cl dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.19:                        # Preds ..B5.18
-        movl      -12(%ebp), %edi                               #2639.43
-        movl      -4(%ebp), %eax                                #2639.43
-        lea       (%eax,%edi,4), %edi                           #2639.43
-        movl      -16(%ebp), %eax                               #2639.49
-        cmpl      %edi, %eax                                    #2639.49
-        jae       ..B5.44       # Prob 1%                       #2639.49
-                                # LOE edx ecx esi dl cl dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.20:                        # Preds ..B5.19 ..B5.18
-        movl      -36(%ebp), %eax                               #2640.32
-        testl     %eax, %eax                                    #2640.32
-        je        ..B5.22       # Prob 50%                      #2640.32
-                                # LOE edx ecx esi dl cl dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.21:                        # Preds ..B5.20
-        movl      -100(%ebp), %edi                              #2640.43
-        addl      -4(%ebp), %edi                                #2640.43
-        movl      -16(%ebp), %eax                               #2640.49
-        cmpl      %edi, %eax                                    #2640.49
-        jae       ..B5.44       # Prob 1%                       #2640.49
-                                # LOE edx ecx esi dl cl dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.22:                        # Preds ..B5.21 ..B5.20
-        movl      -40(%ebp), %eax                               #2641.32
-        testl     %eax, %eax                                    #2641.32
-        je        ..B5.24       # Prob 50%                      #2641.32
-                                # LOE edx ecx esi dl cl dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.23:                        # Preds ..B5.22
-        movl      -96(%ebp), %edi                               #2641.43
-        addl      -4(%ebp), %edi                                #2641.43
-        movl      -16(%ebp), %eax                               #2641.49
-        cmpl      %edi, %eax                                    #2641.49
-        jae       ..B5.44       # Prob 1%                       #2641.49
-                                # LOE edx ecx esi dl cl dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.24:                        # Preds ..B5.23 ..B5.22
-        movl      -76(%ebp), %eax                               #2642.32
-        testl     %eax, %eax                                    #2642.32
-        je        ..B5.26       # Prob 50%                      #2642.32
-                                # LOE edx ecx esi dl cl dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.25:                        # Preds ..B5.24
-        movl      -92(%ebp), %edi                               #2642.43
-        addl      -4(%ebp), %edi                                #2642.43
-        movl      -16(%ebp), %eax                               #2642.49
-        cmpl      %edi, %eax                                    #2642.49
-        jae       ..B5.44       # Prob 1%                       #2642.49
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.26:                        # Preds ..B5.25 ..B5.24 ..B5.17
-        movl      -4(%ebp), %eax                                #2647.17
-        lea       4(%eax), %edi                                 #2647.17
-        movl      -16(%ebp), %eax                               #2650.28
-        movl      %edi, -12(%ebp)                               #2647.17
-        cmpl      %eax, %edi                                    #2650.28
-        ja        ..B5.41       # Prob 1%                       #2650.28
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.27:                        # Preds ..B5.26
-        addl      $-1, %edx                                     #2654.25
-        jne       ..B5.36       # Prob 50%                      #2654.39
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.28:                        # Preds ..B5.27
-        movl      -32(%ebp), %eax                               #2675.25
-        cmpl      %eax, %esi                                    #2675.25
-        jae       ..B5.41       # Prob 1%                       #2675.25
-                                # LOE ecx esi xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.29:                        # Preds ..B5.28
-        movl      -4(%ebp), %eax                                #2679.13
-        movl      -16(%ebp), %edi                               #2680.24
-        lea       60(%eax), %edx                                #2679.13
-        movl      %edx, -12(%ebp)                               #2679.13
-        cmpl      %edi, %edx                                    #2680.24
-        ja        ..B5.41       # Prob 1%                       #2680.24
-                                # LOE ecx esi xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.30:                        # Preds ..B5.29
-        testl     $15, %esi                                     #2685.22
-        jne       ..B5.32       # Prob 50%                      #2685.22
-                                # LOE ecx esi xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.31:                        # Preds ..B5.30
-        movdqa    (%esi), %xmm0                                 #2685.22
-        jmp       ..B5.33       # Prob 100%                     #2685.22
-                                # LOE ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.32:                        # Preds ..B5.30
-        movdqu    (%esi), %xmm0                                 #2685.22
-                                # LOE ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.33:                        # Preds ..B5.31 ..B5.32
-        movl      -32(%ebp), %eax                               #2766.24
-        addl      $16, %esi                                     #2763.13
-        movl      %esi, -20(%ebp)                               #2763.13
-        cmpl      %eax, %esi                                    #2766.24
-        jae       ..B5.35       # Prob 12%                      #2766.24
-                                # LOE ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.34:                        # Preds ..B5.33
-        movzbl    -1(%esi), %ecx                                #2767.32
-        shll      $8, %ecx                                      #2767.46
-                                # LOE ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.35:                        # Preds ..B5.33 ..B5.11 ..B5.34
-        movl      $2, %edx                                      #2568.13
-        jmp       ..B5.39       # Prob 100%                     #2568.13
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.36:                        # Preds ..B5.27
-        movl      -20(%ebp), %eax                               #2662.26
-        movl      -32(%ebp), %edi                               #2662.26
-        psrldq    $1, %xmm0                                     #2659.26
-        cmpl      %edi, %eax                                    #2662.26
-        jae       ..B5.38       # Prob 19%                      #2662.26
-                                # LOE eax edx ecx esi al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.37:                        # Preds ..B5.36
-        movzbl    (%eax), %edi                                  #2665.37
-        sarl      $8, %ecx                                      #2664.21
-        shll      $8, %edi                                      #2665.48
-        orl       %edi, %ecx                                    #2665.21
-        pinsrw    $7, %ecx, %xmm0                               #2666.30
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.38:                        # Preds ..B5.37 ..B5.36
-        addl      $1, -20(%ebp)                                 #2670.20
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.39:                        # Preds ..B5.35 ..B5.38 ..B5.43
-        movdqa    %xmm0, %xmm7                                  #2578.22
-        pand      %xmm6, %xmm7                                  #2578.22
-        pcmpeqw   -72(%ebp), %xmm7                              #2579.22
-        pmovmskb  %xmm7, %eax                                   #2580.22
-        movl      %eax, -8(%ebp)                                #2580.22
-        jmp       ..B5.15       # Prob 100%                     #2580.22
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.41:                        # Preds ..B5.26 ..B5.28 ..B5.29 # Infreq
-        movl      -24(%ebp), %esi                               #2776.12
-        movl      -28(%ebp), %edi                               #2776.12
-        xorl      %eax, %eax                                    #2776.12
-        movl      %ebp, %esp                                    #2776.12
-        popl      %ebp                                          #2776.12
-        movl      %ebx, %esp                                    #2776.12
-        popl      %ebx                                          #2776.12
-        ret                                                     #2776.12
-                                # LOE
-..B5.43:                        # Preds ..B5.7                  # Infreq
-        movdqa    %xmm0, -56(%ebp)                              #
-        movdqa    -88(%ebp), %xmm0                              #
-        movdqa    %xmm7, -72(%ebp)                              #
-        movl      %eax, -32(%ebp)                               #
-        movl      $2, %edx                                      #
-        jmp       ..B5.39       # Prob 100%                     #
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.44:                        # Preds ..B5.21 ..B5.19 ..B5.25 ..B5.23 # Infreq
-        movl      -24(%ebp), %esi                               #2641.63
-        movl      -28(%ebp), %edi                               #2641.63
-        movl      $1, %eax                                      #2641.63
-        movl      %ebp, %esp                                    #2641.63
-        popl      %ebp                                          #2641.63
-        movl      %ebx, %esp                                    #2641.63
-        popl      %ebx                                          #2641.63
-        ret                                                     #2641.63
-        .align    2,0x90
-                                # LOE
-# mark_end;
-	.type	eval_2na_16, at function
-	.size	eval_2na_16,.-eval_2na_16
-.LNeval_2na_16:
-	.data
-# -- End  eval_2na_16
-	.text
-# -- Begin  eval_2na_32
-# mark_begin;
-       .align    2,0x90
-eval_2na_32:
-# parameter 1(self): 8 + %ebx
-# parameter 2(ncbi2na): 12 + %ebx
-# parameter 3(pos): 16 + %ebx
-# parameter 4(len): 20 + %ebx
-..B6.1:                         # Preds ..B6.0
-        pushl     %ebx                                          #2782.1
-        movl      %esp, %ebx                                    #2782.1
-        andl      $-16, %esp                                    #2782.1
-        pushl     %ebp                                          #2782.1
-        pushl     %ebp                                          #2782.1
-        movl      4(%ebx), %ebp                                 #2782.1
-        movl      %ebp, 4(%esp)                                 #2782.1
-        movl      %esp, %ebp                                    #2782.1
-        subl      $104, %esp                                    #2782.1
-        movl      %ebx, -104(%ebp)                              #2782.1
-        movl      %edi, -28(%ebp)                               #2782.1
-        movl      %esi, -24(%ebp)                               #2782.1
-        movl      16(%ebx), %eax                                #2780.5
-        movl      %eax, -12(%ebp)                               #2780.5
-        call      ..L6          # Prob 100%                     #2782.1
-..L6:                                                           #
-        popl      %ecx                                          #2782.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L6], %ecx       #2782.1
-        lea       _gprof_pack5 at GOTOFF(%ecx), %edx               #2782.1
-        movl      %ecx, %ebx                                    #2782.1
-        call      mcount at PLT                                    #2782.1
-        movl      -104(%ebp), %ebx                              #2782.1
-                                # LOE
-..B6.51:                        # Preds ..B6.1
-        movl      20(%ebx), %ecx                                #2819.5
-        movl      -12(%ebp), %edx                               #2819.5
-        movl      12(%ebx), %esi                                #2822.30
-        lea       (%edx,%ecx), %eax                             #2819.5
-        movl      %edx, %edi                                    #2822.49
-        shrl      $2, %edi                                      #2822.49
-        movl      %edi, -4(%ebp)                                #2822.49
-        lea       (%esi,%edi), %edi                             #2822.30
-        movl      %edi, -8(%ebp)                                #2822.30
-        movl      8(%ebx), %edi                                 #2825.12
-        subl      4(%edi), %eax                                 #2825.12
-        movl      %eax, -16(%ebp)                               #2825.12
-        lea       3(%edx,%ecx), %eax                            #2828.50
-        movl      -8(%ebp), %edx                                #2831.14
-        movl      -4(%ebp), %ecx                                #2831.14
-        shrl      $2, %eax                                      #2828.57
-        addl      %esi, %eax                                    #2828.30
-        testb     $15, %dl                                      #2831.14
-        jne       ..B6.3        # Prob 50%                      #2831.14
-                                # LOE eax edx ecx dl cl dh ch
-..B6.2:                         # Preds ..B6.51
-        movdqa    (%edx), %xmm0                                 #2831.14
-        movdqa    %xmm0, -88(%ebp)                              #2831.14
-        jmp       ..B6.4        # Prob 100%                     #2831.14
-                                # LOE eax ecx cl ch
-..B6.3:                         # Preds ..B6.51
-        movdqu    (%edx), %xmm0                                 #2831.14
-        movdqa    %xmm0, -88(%ebp)                              #2831.14
-                                # LOE eax ecx cl ch
-..B6.4:                         # Preds ..B6.2 ..B6.3
-        movl      12(%ebx), %edx                                #2832.5
-        lea       16(%edx,%ecx), %esi                           #2832.5
-        movl      %esi, -20(%ebp)                               #2832.5
-        cmpl      %eax, %esi                                    #2837.16
-        jae       ..B6.6        # Prob 12%                      #2837.16
-                                # LOE eax esi
-..B6.5:                         # Preds ..B6.4
-        movzbl    -1(%esi), %ecx                                #2838.24
-        shll      $8, %ecx                                      #2838.38
-        jmp       ..B6.7        # Prob 100%                     #2838.38
-                                # LOE eax ecx esi
-..B6.6:                         # Preds ..B6.4
-        xorl      %ecx, %ecx                                    #
-                                # LOE eax ecx esi
-..B6.7:                         # Preds ..B6.5 ..B6.6
-        movl      8(%ebx), %edx                                 #2842.5
-        movl      -12(%ebp), %edi                               #2854.20
-        movdqa    16(%edx), %xmm7                               #2842.5
-        movdqa    32(%edx), %xmm6                               #2842.5
-        movdqa    48(%edx), %xmm5                               #2842.5
-        movdqa    64(%edx), %xmm4                               #2842.5
-        movdqa    80(%edx), %xmm3                               #2842.5
-        movdqa    96(%edx), %xmm2                               #2842.5
-        movdqa    112(%edx), %xmm0                              #2842.5
-        movdqa    128(%edx), %xmm1                              #2842.5
-        andl      $3, %edi                                      #2854.20
-        je        ..B6.43       # Prob 20%                      #2854.20
-                                # LOE eax ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B6.8:                         # Preds ..B6.7
-        cmpl      $1, %edi                                      #2854.20
-        je        ..B6.14       # Prob 25%                      #2854.20
-                                # LOE eax ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B6.9:                         # Preds ..B6.8
-        cmpl      $2, %edi                                      #2854.20
-        je        ..B6.13       # Prob 33%                      #2854.20
-                                # LOE eax ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B6.10:                        # Preds ..B6.9
-        cmpl      $3, %edi                                      #2854.20
-        je        ..B6.12       # Prob 50%                      #2854.20
-                                # LOE eax ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B6.11:                        # Preds ..B6.10
-        movdqa    %xmm0, -56(%ebp)                              #
-        movdqa    -88(%ebp), %xmm0                              #
-        movdqa    %xmm7, -72(%ebp)                              #
-        movl      %eax, -32(%ebp)                               #
-        jmp       ..B6.35       # Prob 100%                     #
-                                # LOE ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.12:                        # Preds ..B6.10
-        movdqa    %xmm0, -56(%ebp)                              #
-        movdqa    -88(%ebp), %xmm0                              #
-        movdqa    %xmm7, -72(%ebp)                              #
-        movl      %eax, -32(%ebp)                               #
-        xorl      %edx, %edx                                    #
-        movl      %edx, -40(%ebp)                               #
-        movl      %edx, -36(%ebp)                               #
-        movl      %edx, -8(%ebp)                                #
-        movl      $4, %edx                                      #
-        jmp       ..B6.17       # Prob 100%                     #
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.13:                        # Preds ..B6.9
-        movdqa    %xmm0, -56(%ebp)                              #
-        movdqa    -88(%ebp), %xmm0                              #
-        movdqa    %xmm7, -72(%ebp)                              #
-        movl      %eax, -32(%ebp)                               #
-        xorl      %edx, %edx                                    #
-        movl      %edx, -36(%ebp)                               #
-        movl      %edx, -8(%ebp)                                #
-        movl      $4, %edx                                      #
-        jmp       ..B6.16       # Prob 100%                     #
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.14:                        # Preds ..B6.8
-        movdqa    %xmm0, -56(%ebp)                              #
-        movdqa    -88(%ebp), %xmm0                              #
-        movdqa    %xmm7, -72(%ebp)                              #
-        movl      %eax, -32(%ebp)                               #
-        xorl      %edi, %edi                                    #
-        movl      %edi, -8(%ebp)                                #
-        movl      $4, %edx                                      #
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.15:                        # Preds ..B6.14 ..B6.39
-        movdqa    %xmm0, %xmm7                                  #2877.22
-        pand      %xmm4, %xmm7                                  #2877.22
-        pcmpeqd   %xmm5, %xmm7                                  #2878.22
-        pmovmskb  %xmm7, %eax                                   #2879.22
-        movl      %eax, -36(%ebp)                               #2879.22
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.16:                        # Preds ..B6.13 ..B6.15
-        movdqa    %xmm0, %xmm7                                  #2883.22
-        pand      %xmm2, %xmm7                                  #2883.22
-        pcmpeqd   %xmm3, %xmm7                                  #2884.22
-        pmovmskb  %xmm7, %eax                                   #2885.22
-        movl      %eax, -40(%ebp)                               #2885.22
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.17:                        # Preds ..B6.12 ..B6.16
-        movdqa    %xmm0, %xmm7                                  #2889.22
-        movl      -12(%ebp), %edi                               #2896.17
-        pand      %xmm1, %xmm7                                  #2889.22
-        andl      $-4, %edi                                     #2896.17
-        pcmpeqd   -56(%ebp), %xmm7                              #2890.22
-        pmovmskb  %xmm7, %eax                                   #2891.22
-        movl      %edi, -4(%ebp)                                #2896.17
-        movl      -8(%ebp), %edi                                #2899.29
-        movl      %eax, -76(%ebp)                               #2891.22
-        orl       -36(%ebp), %edi                               #2899.29
-        orl       -40(%ebp), %edi                               #2899.34
-        orl       %eax, %edi                                    #2899.39
-        je        ..B6.26       # Prob 78%                      #2899.47
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.18:                        # Preds ..B6.17
-        movl      -8(%ebp), %edi                                #2917.30
-        movl      %edx, -88(%ebp)                               #
-        movl      %edi, %eax                                    #2917.30
-        movl      %esi, -84(%ebp)                               #
-        movl      %ecx, -80(%ebp)                               #
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2917.30
-        movswl    %ax, %edx                                     #2917.30
-        movl      -36(%ebp), %eax                               #2918.30
-        movl      %edx, -12(%ebp)                               #2917.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2918.30
-        movswl    %ax, %esi                                     #2918.30
-        movl      -40(%ebp), %eax                               #2919.30
-        lea       1(,%esi,4), %esi                              #2926.40
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2919.30
-        movswl    %ax, %ecx                                     #2919.30
-        lea       2(,%ecx,4), %ecx                              #2927.40
-        movl      -76(%ebp), %eax                               #2920.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2920.30
-        movl      %esi, -100(%ebp)                              #2926.40
-        movl      -84(%ebp), %esi                               #2932.32
-        movl      %ecx, -96(%ebp)                               #2927.40
-        movl      -80(%ebp), %ecx                               #2932.32
-        movswl    %ax, %edx                                     #2920.30
-        lea       3(,%edx,4), %edx                              #2928.40
-        movl      %edx, -92(%ebp)                               #2928.40
-        movl      -88(%ebp), %edx                               #2932.32
-        testl     %edi, %edi                                    #2932.32
-        je        ..B6.20       # Prob 50%                      #2932.32
-                                # LOE edx ecx esi dl cl dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.19:                        # Preds ..B6.18
-        movl      -12(%ebp), %edi                               #2932.43
-        movl      -4(%ebp), %eax                                #2932.43
-        lea       (%eax,%edi,4), %edi                           #2932.43
-        movl      -16(%ebp), %eax                               #2932.49
-        cmpl      %edi, %eax                                    #2932.49
-        jae       ..B6.44       # Prob 1%                       #2932.49
-                                # LOE edx ecx esi dl cl dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.20:                        # Preds ..B6.19 ..B6.18
-        movl      -36(%ebp), %eax                               #2933.32
-        testl     %eax, %eax                                    #2933.32
-        je        ..B6.22       # Prob 50%                      #2933.32
-                                # LOE edx ecx esi dl cl dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.21:                        # Preds ..B6.20
-        movl      -100(%ebp), %edi                              #2933.43
-        addl      -4(%ebp), %edi                                #2933.43
-        movl      -16(%ebp), %eax                               #2933.49
-        cmpl      %edi, %eax                                    #2933.49
-        jae       ..B6.44       # Prob 1%                       #2933.49
-                                # LOE edx ecx esi dl cl dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.22:                        # Preds ..B6.21 ..B6.20
-        movl      -40(%ebp), %eax                               #2934.32
-        testl     %eax, %eax                                    #2934.32
-        je        ..B6.24       # Prob 50%                      #2934.32
-                                # LOE edx ecx esi dl cl dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.23:                        # Preds ..B6.22
-        movl      -96(%ebp), %edi                               #2934.43
-        addl      -4(%ebp), %edi                                #2934.43
-        movl      -16(%ebp), %eax                               #2934.49
-        cmpl      %edi, %eax                                    #2934.49
-        jae       ..B6.44       # Prob 1%                       #2934.49
-                                # LOE edx ecx esi dl cl dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.24:                        # Preds ..B6.23 ..B6.22
-        movl      -76(%ebp), %eax                               #2935.32
-        testl     %eax, %eax                                    #2935.32
-        je        ..B6.26       # Prob 50%                      #2935.32
-                                # LOE edx ecx esi dl cl dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.25:                        # Preds ..B6.24
-        movl      -92(%ebp), %edi                               #2935.43
-        addl      -4(%ebp), %edi                                #2935.43
-        movl      -16(%ebp), %eax                               #2935.49
-        cmpl      %edi, %eax                                    #2935.49
-        jae       ..B6.44       # Prob 1%                       #2935.49
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.26:                        # Preds ..B6.25 ..B6.24 ..B6.17
-        movl      -4(%ebp), %eax                                #2940.17
-        lea       4(%eax), %edi                                 #2940.17
-        movl      -16(%ebp), %eax                               #2943.28
-        movl      %edi, -12(%ebp)                               #2940.17
-        cmpl      %eax, %edi                                    #2943.28
-        ja        ..B6.41       # Prob 1%                       #2943.28
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.27:                        # Preds ..B6.26
-        addl      $-1, %edx                                     #2947.25
-        jne       ..B6.36       # Prob 50%                      #2947.39
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.28:                        # Preds ..B6.27
-        movl      -32(%ebp), %eax                               #2968.25
-        cmpl      %eax, %esi                                    #2968.25
-        jae       ..B6.41       # Prob 1%                       #2968.25
-                                # LOE ecx esi xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.29:                        # Preds ..B6.28
-        movl      -4(%ebp), %eax                                #2972.13
-        movl      -16(%ebp), %edi                               #2973.24
-        lea       52(%eax), %edx                                #2972.13
-        movl      %edx, -12(%ebp)                               #2972.13
-        cmpl      %edi, %edx                                    #2973.24
-        ja        ..B6.41       # Prob 1%                       #2973.24
-                                # LOE ecx esi xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.30:                        # Preds ..B6.29
-        testl     $15, %esi                                     #2978.22
-        jne       ..B6.32       # Prob 50%                      #2978.22
-                                # LOE ecx esi xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.31:                        # Preds ..B6.30
-        movdqa    (%esi), %xmm0                                 #2978.22
-        jmp       ..B6.33       # Prob 100%                     #2978.22
-                                # LOE ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.32:                        # Preds ..B6.30
-        movdqu    (%esi), %xmm0                                 #2978.22
-                                # LOE ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.33:                        # Preds ..B6.31 ..B6.32
-        movl      -32(%ebp), %eax                               #3059.24
-        addl      $16, %esi                                     #3056.13
-        movl      %esi, -20(%ebp)                               #3056.13
-        cmpl      %eax, %esi                                    #3059.24
-        jae       ..B6.35       # Prob 12%                      #3059.24
-                                # LOE ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.34:                        # Preds ..B6.33
-        movzbl    -1(%esi), %ecx                                #3060.32
-        shll      $8, %ecx                                      #3060.46
-                                # LOE ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.35:                        # Preds ..B6.33 ..B6.11 ..B6.34
-        movl      $4, %edx                                      #2861.13
-        jmp       ..B6.39       # Prob 100%                     #2861.13
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.36:                        # Preds ..B6.27
-        movl      -20(%ebp), %eax                               #2955.26
-        movl      -32(%ebp), %edi                               #2955.26
-        psrldq    $1, %xmm0                                     #2952.26
-        cmpl      %edi, %eax                                    #2955.26
-        jae       ..B6.38       # Prob 19%                      #2955.26
-                                # LOE eax edx ecx esi al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.37:                        # Preds ..B6.36
-        movzbl    (%eax), %edi                                  #2958.37
-        sarl      $8, %ecx                                      #2957.21
-        shll      $8, %edi                                      #2958.48
-        orl       %edi, %ecx                                    #2958.21
-        pinsrw    $7, %ecx, %xmm0                               #2959.30
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.38:                        # Preds ..B6.37 ..B6.36
-        addl      $1, -20(%ebp)                                 #2963.20
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.39:                        # Preds ..B6.35 ..B6.38 ..B6.43
-        movdqa    %xmm0, %xmm7                                  #2871.22
-        pand      %xmm6, %xmm7                                  #2871.22
-        pcmpeqd   -72(%ebp), %xmm7                              #2872.22
-        pmovmskb  %xmm7, %eax                                   #2873.22
-        movl      %eax, -8(%ebp)                                #2873.22
-        jmp       ..B6.15       # Prob 100%                     #2873.22
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.41:                        # Preds ..B6.26 ..B6.28 ..B6.29 # Infreq
-        movl      -24(%ebp), %esi                               #3069.12
-        movl      -28(%ebp), %edi                               #3069.12
-        xorl      %eax, %eax                                    #3069.12
-        movl      %ebp, %esp                                    #3069.12
-        popl      %ebp                                          #3069.12
-        movl      %ebx, %esp                                    #3069.12
-        popl      %ebx                                          #3069.12
-        ret                                                     #3069.12
-                                # LOE
-..B6.43:                        # Preds ..B6.7                  # Infreq
-        movdqa    %xmm0, -56(%ebp)                              #
-        movdqa    -88(%ebp), %xmm0                              #
-        movdqa    %xmm7, -72(%ebp)                              #
-        movl      %eax, -32(%ebp)                               #
-        movl      $4, %edx                                      #
-        jmp       ..B6.39       # Prob 100%                     #
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.44:                        # Preds ..B6.21 ..B6.19 ..B6.25 ..B6.23 # Infreq
-        movl      -24(%ebp), %esi                               #2934.63
-        movl      -28(%ebp), %edi                               #2934.63
-        movl      $1, %eax                                      #2934.63
-        movl      %ebp, %esp                                    #2934.63
-        popl      %ebp                                          #2934.63
-        movl      %ebx, %esp                                    #2934.63
-        popl      %ebx                                          #2934.63
-        ret                                                     #2934.63
-        .align    2,0x90
-                                # LOE
-# mark_end;
-	.type	eval_2na_32, at function
-	.size	eval_2na_32,.-eval_2na_32
-.LNeval_2na_32:
-	.data
-# -- End  eval_2na_32
-	.text
-# -- Begin  eval_2na_128
-# mark_begin;
-       .align    2,0x90
-eval_2na_128:
-# parameter 1(self): 8 + %ebx
-# parameter 2(ncbi2na): 12 + %ebx
-# parameter 3(pos): 16 + %ebx
-# parameter 4(len): 20 + %ebx
-..B7.1:                         # Preds ..B7.0
-        pushl     %ebx                                          #3369.1
-        movl      %esp, %ebx                                    #3369.1
-        andl      $-16, %esp                                    #3369.1
-        pushl     %ebp                                          #3369.1
-        pushl     %ebp                                          #3369.1
-        movl      4(%ebx), %ebp                                 #3369.1
-        movl      %ebp, 4(%esp)                                 #3369.1
-        movl      %esp, %ebp                                    #3369.1
-        subl      $88, %esp                                     #3369.1
-        movl      %ebx, -88(%ebp)                               #3369.1
-        movl      %edi, -24(%ebp)                               #3369.1
-        movl      %esi, -20(%ebp)                               #3369.1
-        movl      16(%ebx), %esi                                #3367.5
-        call      ..L7          # Prob 100%                     #3369.1
-..L7:                                                           #
-        popl      %eax                                          #3369.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L7], %eax       #3369.1
-        lea       _gprof_pack6 at GOTOFF(%eax), %edx               #3369.1
-        movl      %eax, %ebx                                    #3369.1
-        call      mcount at PLT                                    #3369.1
-        movl      -88(%ebp), %ebx                               #3369.1
-                                # LOE esi
-..B7.47:                        # Preds ..B7.1
-        movl      20(%ebx), %ecx                                #3406.5
-        movl      12(%ebx), %edx                                #3409.30
-        lea       (%esi,%ecx), %eax                             #3406.5
-        movl      %esi, %edi                                    #3409.49
-        shrl      $2, %edi                                      #3409.49
-        lea       3(%esi,%ecx), %ecx                            #3415.50
-        movl      %edi, -4(%ebp)                                #3409.49
-        lea       (%edx,%edi), %edi                             #3409.30
-        movl      %edi, -12(%ebp)                               #3409.30
-        shrl      $2, %ecx                                      #3415.57
-        movl      8(%ebx), %edi                                 #3412.12
-        subl      4(%edi), %eax                                 #3412.12
-        addl      %edx, %ecx                                    #3415.30
-        movl      -12(%ebp), %edx                               #3418.14
-        movl      %ecx, -8(%ebp)                                #3415.30
-        movl      -4(%ebp), %ecx                                #3418.14
-        testb     $15, %dl                                      #3418.14
-        jne       ..B7.3        # Prob 50%                      #3418.14
-                                # LOE eax edx ecx esi dl cl dh ch
-..B7.2:                         # Preds ..B7.47
-        movdqa    (%edx), %xmm0                                 #3418.14
-        movdqa    %xmm0, -40(%ebp)                              #3418.14
-        jmp       ..B7.4        # Prob 100%                     #3418.14
-                                # LOE eax ecx esi cl ch
-..B7.3:                         # Preds ..B7.47
-        movdqu    (%edx), %xmm0                                 #3418.14
-        movdqa    %xmm0, -40(%ebp)                              #3418.14
-                                # LOE eax ecx esi cl ch
-..B7.4:                         # Preds ..B7.2 ..B7.3
-        movl      12(%ebx), %edi                                #3419.5
-        movl      -8(%ebp), %edx                                #3424.16
-        lea       16(%edi,%ecx), %edi                           #3419.5
-        movl      %edi, -16(%ebp)                               #3419.5
-        cmpl      %edx, %edi                                    #3424.16
-        jae       ..B7.6        # Prob 12%                      #3424.16
-                                # LOE eax esi edi
-..B7.5:                         # Preds ..B7.4
-        movzbl    -1(%edi), %ecx                                #3425.24
-        shll      $8, %ecx                                      #3425.38
-        jmp       ..B7.7        # Prob 100%                     #3425.38
-                                # LOE eax ecx esi edi
-..B7.6:                         # Preds ..B7.4
-        xorl      %ecx, %ecx                                    #
-                                # LOE eax ecx esi edi
-..B7.7:                         # Preds ..B7.5 ..B7.6
-        movl      8(%ebx), %edx                                 #3429.5
-        movdqa    16(%edx), %xmm6                               #3429.5
-        movdqa    32(%edx), %xmm5                               #3429.5
-        movdqa    48(%edx), %xmm4                               #3429.5
-        movdqa    64(%edx), %xmm3                               #3429.5
-        movdqa    80(%edx), %xmm2                               #3429.5
-        movdqa    96(%edx), %xmm1                               #3429.5
-        movdqa    112(%edx), %xmm0                              #3429.5
-        movdqa    128(%edx), %xmm7                              #3429.5
-        movl      %eax, %edx                                    #3434.20
-        subl      %esi, %edx                                    #3434.20
-        addl      $7, %edx                                      #3434.33
-        shrl      $2, %edx                                      #3434.40
-        movl      %edx, -12(%ebp)                               #3434.40
-        movl      %esi, %edx                                    #3441.20
-        andl      $3, %edx                                      #3441.20
-        je        ..B7.42       # Prob 20%                      #3441.20
-                                # LOE eax edx ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B7.8:                         # Preds ..B7.7
-        cmpl      $1, %edx                                      #3441.20
-        je        ..B7.14       # Prob 25%                      #3441.20
-                                # LOE eax edx ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B7.9:                         # Preds ..B7.8
-        cmpl      $2, %edx                                      #3441.20
-        je        ..B7.13       # Prob 33%                      #3441.20
-                                # LOE eax edx ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B7.10:                        # Preds ..B7.9
-        cmpl      $3, %edx                                      #3441.20
-        je        ..B7.12       # Prob 50%                      #3441.20
-                                # LOE eax ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B7.11:                        # Preds ..B7.10
-        movdqa    %xmm7, -72(%ebp)                              #
-        movdqa    %xmm0, -56(%ebp)                              #
-        movdqa    -40(%ebp), %xmm0                              #
-        movl      %eax, -76(%ebp)                               #
-        movl      %ecx, -4(%ebp)                                #
-        jmp       ..B7.26       # Prob 100%                     #
-                                # LOE esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.12:                        # Preds ..B7.10
-        movdqa    %xmm7, -72(%ebp)                              #
-        movdqa    %xmm0, -56(%ebp)                              #
-        movdqa    -40(%ebp), %xmm0                              #
-        movl      %eax, -76(%ebp)                               #
-        movl      %ecx, -4(%ebp)                                #
-        xorl      %edx, %edx                                    #
-        movl      %edx, -84(%ebp)                               #
-        movl      %edx, -80(%ebp)                               #
-        jmp       ..B7.17       # Prob 100%                     #
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.13:                        # Preds ..B7.9
-        movdqa    %xmm7, -72(%ebp)                              #
-        movdqa    %xmm0, -56(%ebp)                              #
-        movdqa    -40(%ebp), %xmm0                              #
-        movl      %eax, -76(%ebp)                               #
-        movl      %ecx, -4(%ebp)                                #
-        xorl      %edx, %edx                                    #
-        movl      %edx, -80(%ebp)                               #
-        jmp       ..B7.16       # Prob 100%                     #
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.14:                        # Preds ..B7.8
-        movdqa    %xmm7, -72(%ebp)                              #
-        movdqa    %xmm0, -56(%ebp)                              #
-        movdqa    -40(%ebp), %xmm0                              #
-        movl      %eax, -76(%ebp)                               #
-        movl      %ecx, -4(%ebp)                                #
-        xorl      %edx, %edx                                    #
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.15:                        # Preds ..B7.14 ..B7.30
-        movdqa    %xmm0, %xmm7                                  #3464.22
-        pand      %xmm3, %xmm7                                  #3464.22
-        pcmpeqd   %xmm4, %xmm7                                  #3465.22
-        pmovmskb  %xmm7, %eax                                   #3466.22
-        addl      $1, %eax                                      #3467.17
-        shrl      $16, %eax                                     #3467.17
-        negl      %eax                                          #3467.17
-        movl      %eax, -80(%ebp)                               #3467.17
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.16:                        # Preds ..B7.13 ..B7.15
-        movdqa    %xmm0, %xmm7                                  #3470.22
-        pand      %xmm1, %xmm7                                  #3470.22
-        pcmpeqd   %xmm2, %xmm7                                  #3471.22
-        pmovmskb  %xmm7, %eax                                   #3472.22
-        addl      $1, %eax                                      #3473.17
-        shrl      $16, %eax                                     #3473.17
-        negl      %eax                                          #3473.17
-        movl      %eax, -84(%ebp)                               #3473.17
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.17:                        # Preds ..B7.12 ..B7.16
-        movdqa    %xmm0, %xmm7                                  #3476.22
-        pand      -72(%ebp), %xmm7                              #3476.22
-        pcmpeqd   -56(%ebp), %xmm7                              #3477.22
-        pmovmskb  %xmm7, %eax                                   #3478.22
-        andl      $-4, %esi                                     #3483.17
-        movl      %edx, %ecx                                    #3486.29
-        orl       -80(%ebp), %ecx                               #3486.29
-        addl      $1, %eax                                      #3479.17
-        shrl      $16, %eax                                     #3479.17
-        orl       -84(%ebp), %ecx                               #3486.34
-        negl      %eax                                          #3479.17
-        orl       %eax, %ecx                                    #3486.39
-        jne       ..B7.31       # Prob 1%                       #3486.47
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.18:                        # Preds ..B7.17
-        movl      -76(%ebp), %eax                               #3530.28
-        addl      $4, %esi                                      #3527.17
-        cmpl      %eax, %esi                                    #3530.28
-        ja        ..B7.38       # Prob 1%                       #3530.28
-                                # LOE esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.19:                        # Preds ..B7.18
-        movl      -12(%ebp), %eax                               #3534.25
-        addl      $-1, %eax                                     #3534.25
-        movl      %eax, -12(%ebp)                               #3534.25
-        jne       ..B7.27       # Prob 50%                      #3534.39
-                                # LOE esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.20:                        # Preds ..B7.19
-        movl      -8(%ebp), %eax                                #3555.25
-        cmpl      %eax, %edi                                    #3555.25
-        jae       ..B7.38       # Prob 1%                       #3555.25
-                                # LOE eax esi edi al ah xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.21:                        # Preds ..B7.20
-        testl     $15, %edi                                     #3565.22
-        jne       ..B7.23       # Prob 50%                      #3565.22
-                                # LOE eax esi edi al ah xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.22:                        # Preds ..B7.21
-        movdqa    (%edi), %xmm0                                 #3565.22
-        jmp       ..B7.24       # Prob 100%                     #3565.22
-                                # LOE eax esi edi al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.23:                        # Preds ..B7.21
-        movdqu    (%edi), %xmm0                                 #3565.22
-                                # LOE eax esi edi al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.24:                        # Preds ..B7.22 ..B7.23
-        addl      $16, %edi                                     #3643.13
-        movl      %edi, -16(%ebp)                               #3643.13
-        cmpl      %eax, %edi                                    #3646.24
-        jae       ..B7.26       # Prob 12%                      #3646.24
-                                # LOE esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.25:                        # Preds ..B7.24
-        movzbl    -1(%edi), %eax                                #3647.32
-        shll      $8, %eax                                      #3647.46
-        movl      %eax, -4(%ebp)                                #3647.46
-                                # LOE esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.26:                        # Preds ..B7.24 ..B7.11 ..B7.25
-        movl      $16, %eax                                     #3448.13
-        movl      %eax, -12(%ebp)                               #3448.13
-        jmp       ..B7.30       # Prob 100%                     #3448.13
-                                # LOE esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.27:                        # Preds ..B7.19
-        movl      -8(%ebp), %edx                                #3542.26
-        movl      -16(%ebp), %eax                               #3542.26
-        psrldq    $1, %xmm0                                     #3539.26
-        cmpl      %edx, %eax                                    #3542.26
-        jae       ..B7.29       # Prob 19%                      #3542.26
-                                # LOE eax esi edi al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.28:                        # Preds ..B7.27
-        movl      -4(%ebp), %ecx                                #3544.21
-        movzbl    (%eax), %edx                                  #3545.37
-        sarl      $8, %ecx                                      #3544.21
-        shll      $8, %edx                                      #3545.48
-        orl       %edx, %ecx                                    #3545.21
-        pinsrw    $7, %ecx, %xmm0                               #3546.30
-        movl      %ecx, -4(%ebp)                                #3545.21
-                                # LOE esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.29:                        # Preds ..B7.28 ..B7.27
-        addl      $1, -16(%ebp)                                 #3550.20
-                                # LOE esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.30:                        # Preds ..B7.26 ..B7.29 ..B7.42
-        movdqa    %xmm0, %xmm7                                  #3458.22
-        pand      %xmm5, %xmm7                                  #3458.22
-        pcmpeqd   %xmm6, %xmm7                                  #3459.22
-        pmovmskb  %xmm7, %edx                                   #3460.22
-        addl      $1, %edx                                      #3461.17
-        shrl      $16, %edx                                     #3461.17
-        negl      %edx                                          #3461.17
-        jmp       ..B7.15       # Prob 100%                     #3461.17
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.31:                        # Preds ..B7.17                 # Infreq
-        movl      -76(%ebp), %eax                               #
-        subl      %esi, %eax                                    #3489.30
-        cmpl      $2, %eax                                      #3489.37
-        je        ..B7.35       # Prob 25%                      #3489.37
-                                # LOE eax edx
-..B7.32:                        # Preds ..B7.31                 # Infreq
-        cmpl      $1, %eax                                      #3489.37
-        je        ..B7.36       # Prob 33%                      #3489.37
-                                # LOE eax edx
-..B7.33:                        # Preds ..B7.32                 # Infreq
-        testl     %eax, %eax                                    #3489.37
-        je        ..B7.37       # Prob 50%                      #3489.37
-                                # LOE edx
-..B7.34:                        # Preds ..B7.35 ..B7.36 ..B7.37 ..B7.33 # Infreq
-        movl      -20(%ebp), %esi                               #3492.32
-        movl      -24(%ebp), %edi                               #3492.32
-        movl      $1, %eax                                      #3492.32
-        movl      %ebp, %esp                                    #3492.32
-        popl      %ebp                                          #3492.32
-        movl      %ebx, %esp                                    #3492.32
-        popl      %ebx                                          #3492.32
-        ret                                                     #3492.32
-                                # LOE
-..B7.35:                        # Preds ..B7.31                 # Infreq
-        movl      -84(%ebp), %eax                               #3494.36
-        testl     %eax, %eax                                    #3494.36
-        jne       ..B7.34       # Prob 28%                      #3494.36
-                                # LOE edx
-..B7.36:                        # Preds ..B7.35 ..B7.32         # Infreq
-        movl      -80(%ebp), %eax                               #3496.36
-        testl     %eax, %eax                                    #3496.36
-        jne       ..B7.34       # Prob 28%                      #3496.36
-                                # LOE edx
-..B7.37:                        # Preds ..B7.33 ..B7.36         # Infreq
-        testl     %edx, %edx                                    #3498.36
-        jne       ..B7.34       # Prob 28%                      #3498.36
-                                # LOE
-..B7.38:                        # Preds ..B7.20 ..B7.18 ..B7.37 # Infreq
-        movl      -20(%ebp), %esi                               #3500.28
-        movl      -24(%ebp), %edi                               #3500.28
-        xorl      %eax, %eax                                    #3500.28
-        movl      %ebp, %esp                                    #3500.28
-        popl      %ebp                                          #3500.28
-        movl      %ebx, %esp                                    #3500.28
-        popl      %ebx                                          #3500.28
-        ret                                                     #3500.28
-                                # LOE
-..B7.42:                        # Preds ..B7.7                  # Infreq
-        movdqa    %xmm7, -72(%ebp)                              #
-        movdqa    %xmm0, -56(%ebp)                              #
-        movdqa    -40(%ebp), %xmm0                              #
-        movl      %eax, -76(%ebp)                               #
-        movl      %ecx, -4(%ebp)                                #
-        jmp       ..B7.30       # Prob 100%                     #
-        .align    2,0x90
-                                # LOE esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-# mark_end;
-	.type	eval_2na_128, at function
-	.size	eval_2na_128,.-eval_2na_128
-.LNeval_2na_128:
-	.data
-# -- End  eval_2na_128
-	.text
-# -- Begin  eval_4na_16
-# mark_begin;
-       .align    2,0x90
-eval_4na_16:
-# parameter 1(self): 8 + %ebx
-# parameter 2(ncbi2na): 12 + %ebx
-# parameter 3(pos): 16 + %ebx
-# parameter 4(len): 20 + %ebx
-..B8.1:                         # Preds ..B8.0
-        pushl     %ebx                                          #4057.1
-        movl      %esp, %ebx                                    #4057.1
-        andl      $-16, %esp                                    #4057.1
-        pushl     %ebp                                          #4057.1
-        pushl     %ebp                                          #4057.1
-        movl      4(%ebx), %ebp                                 #4057.1
-        movl      %ebp, 4(%esp)                                 #4057.1
-        movl      %esp, %ebp                                    #4057.1
-        subl      $136, %esp                                    #4057.1
-        movl      %ebx, -136(%ebp)                              #4057.1
-        movl      %edi, -36(%ebp)                               #4057.1
-        movl      %esi, -32(%ebp)                               #4057.1
-        movl      12(%ebx), %ecx                                #4055.5
-        movl      16(%ebx), %esi                                #4055.5
-        call      ..L8          # Prob 100%                     #4057.1
-..L8:                                                           #
-        popl      %edi                                          #4057.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L8], %edi       #4057.1
-        lea       _gprof_pack7 at GOTOFF(%edi), %edx               #4057.1
-        movl      %edi, %ebx                                    #4057.1
-        call      mcount at PLT                                    #4057.1
-        movl      -136(%ebp), %ebx                              #4057.1
-                                # LOE esi edi
-..B8.35:                        # Preds ..B8.1
-        movl      12(%ebx), %ecx                                #
-        movl      %esi, -16(%ebp)                               #
-        movl      %esi, %eax                                    #4093.49
-        movl      %edi, -116(%ebp)                              #
-        shrl      $2, %eax                                      #4093.49
-        movl      20(%ebx), %edi                                #4090.5
-        movl      %eax, -20(%ebp)                               #4093.49
-        movl      8(%ebx), %eax                                 #4096.12
-        movdqa    16(%eax), %xmm5                               #4109.5
-        movdqa    32(%eax), %xmm4                               #4109.5
-        movdqa    48(%eax), %xmm3                               #4109.5
-        movdqa    64(%eax), %xmm0                               #4109.5
-        movdqa    80(%eax), %xmm7                               #4109.5
-        movdqa    96(%eax), %xmm1                               #4109.5
-        movdqa    112(%eax), %xmm6                              #4109.5
-        movdqa    %xmm0, -56(%ebp)                              #4109.5
-        movdqa    128(%eax), %xmm0                              #4109.5
-        lea       (%esi,%edi), %edx                             #4090.5
-        subl      4(%eax), %edx                                 #4096.12
-        movl      %edx, -24(%ebp)                               #4096.12
-        lea       3(%esi,%edi), %edx                            #4099.50
-        shrl      $2, %edx                                      #4099.57
-        movl      -20(%ebp), %esi                               #4102.14
-        movl      -116(%ebp), %edi                              #4102.14
-        addl      %ecx, %edx                                    #4099.30
-        movl      %edx, -28(%ebp)                               #4099.30
-        movzbl    (%esi,%ecx), %edx                             #4102.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%edx,2), %edx        #4102.14
-        movw      %dx, -132(%ebp)                               #4102.14
-        movzbl    1(%esi,%ecx), %edx                            #4102.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%edx,2), %edx        #4102.14
-        movw      %dx, -130(%ebp)                               #4102.14
-        movzbl    2(%esi,%ecx), %edx                            #4102.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%edx,2), %edx        #4102.14
-        movw      %dx, -128(%ebp)                               #4102.14
-        movzbl    3(%esi,%ecx), %edx                            #4102.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%edx,2), %edx        #4102.14
-        movw      %dx, -126(%ebp)                               #4102.14
-        movzbl    4(%esi,%ecx), %edx                            #4102.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%edx,2), %edx        #4102.14
-        movw      %dx, -124(%ebp)                               #4102.14
-        movzbl    5(%esi,%ecx), %edx                            #4102.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%edx,2), %edx        #4102.14
-        movw      %dx, -122(%ebp)                               #4102.14
-        movzbl    6(%esi,%ecx), %edx                            #4102.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%edx,2), %edx        #4102.14
-        movw      %dx, -120(%ebp)                               #4102.14
-        movzbl    7(%esi,%ecx), %edx                            #4102.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%edx,2), %edx        #4102.14
-        movw      %dx, -118(%ebp)                               #4102.14
-        movdqu    -132(%ebp), %xmm2                             #4102.14
-        lea       8(%ecx,%esi), %edx                            #4103.5
-        movl      -16(%ebp), %esi                               #4123.20
-        movl      %esi, %eax                                    #4123.20
-        andl      $3, %eax                                      #4123.20
-        je        ..B8.5        # Prob 20%                      #4123.20
-                                # LOE eax edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B8.2:                         # Preds ..B8.35
-        cmpl      $1, %eax                                      #4123.20
-        je        ..B8.8        # Prob 25%                      #4123.20
-                                # LOE eax edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B8.3:                         # Preds ..B8.2
-        cmpl      $2, %eax                                      #4123.20
-        je        ..B8.7        # Prob 33%                      #4123.20
-                                # LOE eax edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B8.4:                         # Preds ..B8.3
-        cmpl      $3, %eax                                      #4123.20
-        je        ..B8.6        # Prob 50%                      #4123.20
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B8.5:                         # Preds ..B8.35 ..B8.4
-        movdqa    %xmm6, -72(%ebp)                              #
-        movdqa    %xmm7, -88(%ebp)                              #
-        jmp       ..B8.24       # Prob 100%                     #
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B8.6:                         # Preds ..B8.4
-        movdqa    %xmm6, -72(%ebp)                              #
-        movdqa    %xmm7, -88(%ebp)                              #
-        xorl      %eax, %eax                                    #
-        movl      %eax, -96(%ebp)                               #
-        movl      %eax, -20(%ebp)                               #
-        movl      %eax, -40(%ebp)                               #
-        jmp       ..B8.11       # Prob 100%                     #
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B8.7:                         # Preds ..B8.3
-        movdqa    %xmm6, -72(%ebp)                              #
-        movdqa    %xmm7, -88(%ebp)                              #
-        xorl      %eax, %eax                                    #
-        movl      %eax, -40(%ebp)                               #
-        movl      %eax, -20(%ebp)                               #
-        jmp       ..B8.10       # Prob 100%                     #
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B8.8:                         # Preds ..B8.2
-        movdqa    %xmm6, -72(%ebp)                              #
-        movdqa    %xmm7, -88(%ebp)                              #
-        xorl      %ecx, %ecx                                    #
-        movl      %ecx, -20(%ebp)                               #
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B8.9:                         # Preds ..B8.8 ..B8.24
-        movdqa    %xmm2, %xmm7                                  #4147.22
-        movdqa    %xmm2, %xmm6                                  #4148.22
-        pand      -56(%ebp), %xmm6                              #4148.22
-        pand      %xmm3, %xmm7                                  #4147.22
-        pcmpeqw   %xmm6, %xmm7                                  #4149.22
-        pmovmskb  %xmm7, %eax                                   #4150.22
-        movl      %eax, -40(%ebp)                               #4150.22
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B8.10:                        # Preds ..B8.7 ..B8.9
-        movdqa    %xmm2, %xmm7                                  #4154.22
-        movdqa    %xmm2, %xmm6                                  #4155.22
-        pand      -88(%ebp), %xmm7                              #4154.22
-        pand      %xmm1, %xmm6                                  #4155.22
-        pcmpeqw   %xmm6, %xmm7                                  #4156.22
-        pmovmskb  %xmm7, %eax                                   #4157.22
-        movl      %eax, -96(%ebp)                               #4157.22
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B8.11:                        # Preds ..B8.6 ..B8.10
-        movdqa    %xmm2, %xmm6                                  #4161.22
-        pand      -72(%ebp), %xmm6                              #4161.22
-        movl      -20(%ebp), %ecx                               #4172.29
-        pand      %xmm0, %xmm2                                  #4162.22
-        pcmpeqw   %xmm2, %xmm6                                  #4163.22
-        pmovmskb  %xmm6, %eax                                   #4164.22
-        movl      %eax, -92(%ebp)                               #4164.22
-        andl      $-4, %esi                                     #4169.17
-        orl       -40(%ebp), %ecx                               #4172.29
-        orl       -96(%ebp), %ecx                               #4172.34
-        orl       %eax, %ecx                                    #4172.39
-        je        ..B8.20       # Prob 78%                      #4172.47
-                                # LOE edx esi edi xmm0 xmm1 xmm3 xmm4 xmm5
-..B8.12:                        # Preds ..B8.11
-        movl      %esi, -16(%ebp)                               #
-        movl      -20(%ebp), %esi                               #4190.30
-        movl      %edx, -100(%ebp)                              #
-        movl      %esi, %eax                                    #4190.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4190.30
-        movswl    %ax, %edx                                     #4190.30
-        movl      -40(%ebp), %eax                               #4191.30
-        movl      %edx, -116(%ebp)                              #4190.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4191.30
-        movswl    %ax, %edx                                     #4191.30
-        movl      -96(%ebp), %eax                               #4192.30
-        lea       1(%edx,%edx), %edx                            #4199.40
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4192.30
-        movswl    %ax, %ecx                                     #4192.30
-        movl      -92(%ebp), %eax                               #4193.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4193.30
-        movl      %edx, -112(%ebp)                              #4199.40
-        movswl    %ax, %eax                                     #4193.30
-        lea       2(%ecx,%ecx), %edx                            #4200.40
-        movl      %edx, -108(%ebp)                              #4200.40
-        lea       3(%eax,%eax), %edx                            #4201.40
-        testl     %esi, %esi                                    #4205.32
-        movl      -16(%ebp), %esi                               #4205.32
-        movl      %edx, -104(%ebp)                              #4201.40
-        movl      -100(%ebp), %edx                              #4205.32
-        je        ..B8.14       # Prob 50%                      #4205.32
-                                # LOE edx esi edi dl dh xmm0 xmm1 xmm3 xmm4 xmm5
-..B8.13:                        # Preds ..B8.12
-        movl      -116(%ebp), %eax                              #4205.43
-        movl      -24(%ebp), %ecx                               #4205.49
-        lea       (%esi,%eax,2), %eax                           #4205.43
-        cmpl      %eax, %ecx                                    #4205.49
-        jae       ..B8.28       # Prob 1%                       #4205.49
-                                # LOE edx esi edi dl dh xmm0 xmm1 xmm3 xmm4 xmm5
-..B8.14:                        # Preds ..B8.13 ..B8.12
-        movl      -40(%ebp), %eax                               #4206.32
-        testl     %eax, %eax                                    #4206.32
-        je        ..B8.16       # Prob 50%                      #4206.32
-                                # LOE edx esi edi dl dh xmm0 xmm1 xmm3 xmm4 xmm5
-..B8.15:                        # Preds ..B8.14
-        movl      -112(%ebp), %ecx                              #4206.43
-        movl      -24(%ebp), %eax                               #4206.49
-        addl      %esi, %ecx                                    #4206.43
-        cmpl      %ecx, %eax                                    #4206.49
-        jae       ..B8.28       # Prob 1%                       #4206.49
-                                # LOE edx esi edi dl dh xmm0 xmm1 xmm3 xmm4 xmm5
-..B8.16:                        # Preds ..B8.15 ..B8.14
-        movl      -96(%ebp), %eax                               #4207.32
-        testl     %eax, %eax                                    #4207.32
-        je        ..B8.18       # Prob 50%                      #4207.32
-                                # LOE edx esi edi dl dh xmm0 xmm1 xmm3 xmm4 xmm5
-..B8.17:                        # Preds ..B8.16
-        movl      -108(%ebp), %ecx                              #4207.43
-        movl      -24(%ebp), %eax                               #4207.49
-        addl      %esi, %ecx                                    #4207.43
-        cmpl      %ecx, %eax                                    #4207.49
-        jae       ..B8.28       # Prob 1%                       #4207.49
-                                # LOE edx esi edi dl dh xmm0 xmm1 xmm3 xmm4 xmm5
-..B8.18:                        # Preds ..B8.17 ..B8.16
-        movl      -92(%ebp), %eax                               #4208.32
-        testl     %eax, %eax                                    #4208.32
-        je        ..B8.20       # Prob 50%                      #4208.32
-                                # LOE edx esi edi dl dh xmm0 xmm1 xmm3 xmm4 xmm5
-..B8.19:                        # Preds ..B8.18
-        movl      -104(%ebp), %ecx                              #4208.43
-        movl      -24(%ebp), %eax                               #4208.49
-        addl      %esi, %ecx                                    #4208.43
-        cmpl      %ecx, %eax                                    #4208.49
-        jae       ..B8.28       # Prob 1%                       #4208.49
-                                # LOE edx esi edi xmm0 xmm1 xmm3 xmm4 xmm5
-..B8.20:                        # Preds ..B8.19 ..B8.18 ..B8.11
-        movl      -24(%ebp), %eax                               #4216.28
-        lea       4(%esi), %ecx                                 #4241.13
-        cmpl      %ecx, %eax                                    #4216.28
-        jb        ..B8.26       # Prob 1%                       #4216.28
-                                # LOE edx esi edi xmm0 xmm1 xmm3 xmm4 xmm5
-..B8.21:                        # Preds ..B8.20
-        movl      -28(%ebp), %eax                               #4237.25
-        cmpl      %eax, %edx                                    #4237.25
-        jae       ..B8.26       # Prob 1%                       #4237.25
-                                # LOE edx esi edi xmm0 xmm1 xmm3 xmm4 xmm5
-..B8.22:                        # Preds ..B8.21
-        movl      -24(%ebp), %eax                               #4242.24
-        addl      $32, %esi                                     #4241.13
-        cmpl      %eax, %esi                                    #4242.24
-        ja        ..B8.26       # Prob 1%                       #4242.24
-                                # LOE edx esi edi xmm0 xmm1 xmm3 xmm4 xmm5
-..B8.23:                        # Preds ..B8.22
-        movzbl    (%edx), %eax                                  #4247.22
-        movzwl    expand_2na.0 at GOTOFF(%edi,%eax,2), %ecx        #4247.22
-        movzbl    1(%edx), %eax                                 #4247.22
-        movzwl    expand_2na.0 at GOTOFF(%edi,%eax,2), %eax        #4247.22
-        movw      %cx, -132(%ebp)                               #4247.22
-        movw      %ax, -130(%ebp)                               #4247.22
-        movzbl    2(%edx), %eax                                 #4247.22
-        movzwl    expand_2na.0 at GOTOFF(%edi,%eax,2), %eax        #4247.22
-        movw      %ax, -128(%ebp)                               #4247.22
-        movzbl    3(%edx), %eax                                 #4247.22
-        movzwl    expand_2na.0 at GOTOFF(%edi,%eax,2), %eax        #4247.22
-        movw      %ax, -126(%ebp)                               #4247.22
-        movzbl    4(%edx), %eax                                 #4247.22
-        movzwl    expand_2na.0 at GOTOFF(%edi,%eax,2), %eax        #4247.22
-        movw      %ax, -124(%ebp)                               #4247.22
-        movzbl    5(%edx), %eax                                 #4247.22
-        movzwl    expand_2na.0 at GOTOFF(%edi,%eax,2), %eax        #4247.22
-        movw      %ax, -122(%ebp)                               #4247.22
-        movzbl    6(%edx), %eax                                 #4247.22
-        movzwl    expand_2na.0 at GOTOFF(%edi,%eax,2), %eax        #4247.22
-        movw      %ax, -120(%ebp)                               #4247.22
-        movzbl    7(%edx), %eax                                 #4247.22
-        movzwl    expand_2na.0 at GOTOFF(%edi,%eax,2), %eax        #4247.22
-        addl      $8, %edx                                      #4262.13
-        movw      %ax, -118(%ebp)                               #4247.22
-        movdqu    -132(%ebp), %xmm2                             #4247.22
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B8.24:                        # Preds ..B8.23 ..B8.5
-        movdqa    %xmm2, %xmm7                                  #4140.22
-        movdqa    %xmm2, %xmm6                                  #4141.22
-        pand      %xmm5, %xmm7                                  #4140.22
-        pand      %xmm4, %xmm6                                  #4141.22
-        pcmpeqw   %xmm6, %xmm7                                  #4142.22
-        pmovmskb  %xmm7, %eax                                   #4143.22
-        movl      %eax, -20(%ebp)                               #4143.22
-        jmp       ..B8.9        # Prob 100%                     #4143.22
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B8.26:                        # Preds ..B8.20 ..B8.21 ..B8.22 # Infreq
-        movl      -32(%ebp), %esi                               #4273.12
-        movl      -36(%ebp), %edi                               #4273.12
-        xorl      %eax, %eax                                    #4273.12
-        movl      %ebp, %esp                                    #4273.12
-        popl      %ebp                                          #4273.12
-        movl      %ebx, %esp                                    #4273.12
-        popl      %ebx                                          #4273.12
-        ret                                                     #4273.12
-                                # LOE
-..B8.28:                        # Preds ..B8.19 ..B8.17 ..B8.15 ..B8.13 # Infreq
-        movl      -32(%ebp), %esi                               #4205.63
-        movl      -36(%ebp), %edi                               #4205.63
-        movl      $1, %eax                                      #4205.63
-        movl      %ebp, %esp                                    #4205.63
-        popl      %ebp                                          #4205.63
-        movl      %ebx, %esp                                    #4205.63
-        popl      %ebx                                          #4205.63
-        ret                                                     #4205.63
-        .align    2,0x90
-                                # LOE
-# mark_end;
-	.type	eval_4na_16, at function
-	.size	eval_4na_16,.-eval_4na_16
-.LNeval_4na_16:
-	.data
-# -- End  eval_4na_16
-	.text
-# -- Begin  eval_4na_32
-# mark_begin;
-       .align    2,0x90
-eval_4na_32:
-# parameter 1(self): 8 + %ebx
-# parameter 2(ncbi2na): 12 + %ebx
-# parameter 3(pos): 16 + %ebx
-# parameter 4(len): 20 + %ebx
-..B9.1:                         # Preds ..B9.0
-        pushl     %ebx                                          #4279.1
-        movl      %esp, %ebx                                    #4279.1
-        andl      $-16, %esp                                    #4279.1
-        pushl     %ebp                                          #4279.1
-        pushl     %ebp                                          #4279.1
-        movl      4(%ebx), %ebp                                 #4279.1
-        movl      %ebp, 4(%esp)                                 #4279.1
-        movl      %esp, %ebp                                    #4279.1
-        subl      $152, %esp                                    #4279.1
-        movl      %ebx, -152(%ebp)                              #4279.1
-        movl      %edi, -44(%ebp)                               #4279.1
-        movl      %esi, -40(%ebp)                               #4279.1
-        movl      12(%ebx), %ecx                                #4277.5
-        movl      16(%ebx), %esi                                #4277.5
-        call      ..L9          # Prob 100%                     #4279.1
-..L9:                                                           #
-        popl      %edi                                          #4279.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L9], %edi       #4279.1
-        lea       _gprof_pack8 at GOTOFF(%edi), %edx               #4279.1
-        movl      %edi, %ebx                                    #4279.1
-        call      mcount at PLT                                    #4279.1
-        movl      -152(%ebp), %ebx                              #4279.1
-                                # LOE esi edi
-..B9.41:                        # Preds ..B9.1
-        movl      12(%ebx), %ecx                                #
-        movl      %esi, -24(%ebp)                               #
-        movl      %esi, %eax                                    #4315.49
-        movl      %edi, -16(%ebp)                               #
-        shrl      $2, %eax                                      #4315.49
-        movl      20(%ebx), %edi                                #4312.5
-        movl      %eax, -20(%ebp)                               #4315.49
-        movl      8(%ebx), %eax                                 #4318.12
-        movdqa    16(%eax), %xmm5                               #4331.5
-        movdqa    32(%eax), %xmm4                               #4331.5
-        movdqa    48(%eax), %xmm3                               #4331.5
-        movdqa    64(%eax), %xmm6                               #4331.5
-        movdqa    80(%eax), %xmm2                               #4331.5
-        movdqa    96(%eax), %xmm1                               #4331.5
-        movdqa    128(%eax), %xmm7                              #4331.5
-        lea       (%esi,%edi), %edx                             #4312.5
-        subl      4(%eax), %edx                                 #4318.12
-        movl      %edx, -32(%ebp)                               #4318.12
-        lea       3(%esi,%edi), %edx                            #4321.50
-        shrl      $2, %edx                                      #4321.57
-        movl      -20(%ebp), %esi                               #4324.14
-        movl      -16(%ebp), %edi                               #4324.14
-        addl      %ecx, %edx                                    #4321.30
-        movl      %edx, -36(%ebp)                               #4321.30
-        movzbl    (%esi,%ecx), %edx                             #4324.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%edx,2), %edx        #4324.14
-        movw      %dx, -148(%ebp)                               #4324.14
-        movzbl    1(%esi,%ecx), %edx                            #4324.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%edx,2), %edx        #4324.14
-        movw      %dx, -146(%ebp)                               #4324.14
-        movzbl    2(%esi,%ecx), %edx                            #4324.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%edx,2), %edx        #4324.14
-        movw      %dx, -144(%ebp)                               #4324.14
-        movzbl    3(%esi,%ecx), %edx                            #4324.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%edx,2), %edx        #4324.14
-        movw      %dx, -142(%ebp)                               #4324.14
-        movzbl    4(%esi,%ecx), %edx                            #4324.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%edx,2), %edx        #4324.14
-        movw      %dx, -140(%ebp)                               #4324.14
-        movzbl    5(%esi,%ecx), %edx                            #4324.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%edx,2), %edx        #4324.14
-        movw      %dx, -138(%ebp)                               #4324.14
-        movzbl    6(%esi,%ecx), %edx                            #4324.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%edx,2), %edx        #4324.14
-        movw      %dx, -136(%ebp)                               #4324.14
-        movzbl    7(%esi,%ecx), %edx                            #4324.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%edx,2), %edx        #4324.14
-        movw      %dx, -134(%ebp)                               #4324.14
-        movdqu    -148(%ebp), %xmm0                             #4324.14
-        lea       8(%ecx,%esi), %edx                            #4325.5
-        movl      -24(%ebp), %esi                               #4345.20
-        movdqa    %xmm0, -120(%ebp)                             #4324.14
-        movdqa    112(%eax), %xmm0                              #4331.5
-        movl      %esi, %eax                                    #4345.20
-        movl      %edx, -28(%ebp)                               #4325.5
-        andl      $3, %eax                                      #4345.20
-        je        ..B9.33       # Prob 20%                      #4345.20
-                                # LOE eax edx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B9.2:                         # Preds ..B9.41
-        cmpl      $1, %eax                                      #4345.20
-        je        ..B9.8        # Prob 25%                      #4345.20
-                                # LOE eax edx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B9.3:                         # Preds ..B9.2
-        cmpl      $2, %eax                                      #4345.20
-        je        ..B9.7        # Prob 33%                      #4345.20
-                                # LOE eax edx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B9.4:                         # Preds ..B9.3
-        cmpl      $3, %eax                                      #4345.20
-        je        ..B9.6        # Prob 50%                      #4345.20
-                                # LOE edx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B9.5:                         # Preds ..B9.4
-        movdqa    %xmm7, -72(%ebp)                              #
-        movdqa    %xmm0, -88(%ebp)                              #
-        movdqa    -120(%ebp), %xmm0                             #
-        movdqa    %xmm6, -104(%ebp)                             #
-        movl      %edi, -16(%ebp)                               #
-        jmp       ..B9.25       # Prob 100%                     #
-                                # LOE edx esi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.6:                         # Preds ..B9.4
-        movdqa    %xmm7, -72(%ebp)                              #
-        movdqa    %xmm0, -88(%ebp)                              #
-        movdqa    -120(%ebp), %xmm0                             #
-        movdqa    %xmm6, -104(%ebp)                             #
-        xorl      %eax, %eax                                    #
-        movl      %eax, -56(%ebp)                               #
-        movl      %edi, -16(%ebp)                               #
-        xorl      %ecx, %ecx                                    #
-        movl      %ecx, -52(%ebp)                               #
-        movl      %eax, -48(%ebp)                               #
-        movl      $2, %ecx                                      #
-        jmp       ..B9.11       # Prob 100%                     #
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.7:                         # Preds ..B9.3
-        movdqa    %xmm7, -72(%ebp)                              #
-        movdqa    %xmm0, -88(%ebp)                              #
-        movdqa    -120(%ebp), %xmm0                             #
-        movdqa    %xmm6, -104(%ebp)                             #
-        xorl      %eax, %eax                                    #
-        movl      %eax, -52(%ebp)                               #
-        movl      %edi, -16(%ebp)                               #
-        movl      $2, %ecx                                      #
-        movl      %eax, -48(%ebp)                               #
-        jmp       ..B9.10       # Prob 100%                     #
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.8:                         # Preds ..B9.2
-        movdqa    %xmm7, -72(%ebp)                              #
-        movdqa    %xmm0, -88(%ebp)                              #
-        movdqa    -120(%ebp), %xmm0                             #
-        movdqa    %xmm6, -104(%ebp)                             #
-        xorl      %eax, %eax                                    #
-        movl      %eax, -48(%ebp)                               #
-        movl      %edi, -16(%ebp)                               #
-        movl      $2, %ecx                                      #
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.9:                         # Preds ..B9.8 ..B9.29
-        movdqa    %xmm0, %xmm7                                  #4369.22
-        movdqa    %xmm0, %xmm6                                  #4370.22
-        pand      -104(%ebp), %xmm6                             #4370.22
-        pand      %xmm3, %xmm7                                  #4369.22
-        pcmpeqd   %xmm6, %xmm7                                  #4371.22
-        pmovmskb  %xmm7, %eax                                   #4372.22
-        movl      %eax, -52(%ebp)                               #4372.22
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.10:                        # Preds ..B9.7 ..B9.9
-        movdqa    %xmm0, %xmm7                                  #4376.22
-        movdqa    %xmm0, %xmm6                                  #4377.22
-        pand      %xmm2, %xmm7                                  #4376.22
-        pand      %xmm1, %xmm6                                  #4377.22
-        pcmpeqd   %xmm6, %xmm7                                  #4378.22
-        pmovmskb  %xmm7, %eax                                   #4379.22
-        movl      %eax, -56(%ebp)                               #4379.22
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.11:                        # Preds ..B9.6 ..B9.10
-        movdqa    %xmm0, %xmm7                                  #4383.22
-        movdqa    %xmm0, %xmm6                                  #4384.22
-        pand      -88(%ebp), %xmm7                              #4383.22
-        pand      -72(%ebp), %xmm6                              #4384.22
-        pcmpeqd   %xmm6, %xmm7                                  #4385.22
-        pmovmskb  %xmm7, %eax                                   #4386.22
-        movl      -48(%ebp), %edi                               #4394.29
-        movl      %eax, -112(%ebp)                              #4386.22
-        andl      $-4, %esi                                     #4391.17
-        movl      %esi, -20(%ebp)                               #4391.17
-        orl       -52(%ebp), %edi                               #4394.29
-        orl       -56(%ebp), %edi                               #4394.34
-        orl       %eax, %edi                                    #4394.39
-        je        ..B9.20       # Prob 78%                      #4394.47
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.12:                        # Preds ..B9.11
-        movl      %esi, %eax                                    #
-        movl      -48(%ebp), %edi                               #4412.30
-        movl      %eax, -20(%ebp)                               #
-        movl      %edi, %eax                                    #4412.30
-        movl      %ecx, -120(%ebp)                              #
-        movl      %edx, -116(%ebp)                              #
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4412.30
-        movswl    %ax, %edx                                     #4412.30
-        movl      -52(%ebp), %eax                               #4413.30
-        movl      %edx, -132(%ebp)                              #4412.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4413.30
-        movswl    %ax, %esi                                     #4413.30
-        lea       1(%esi,%esi), %esi                            #4421.40
-        movl      -56(%ebp), %eax                               #4414.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4414.30
-        movswl    %ax, %ecx                                     #4414.30
-        movl      -112(%ebp), %eax                              #4415.30
-        lea       2(%ecx,%ecx), %ecx                            #4422.40
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4415.30
-        movl      %esi, -128(%ebp)                              #4421.40
-        movl      %ecx, -124(%ebp)                              #4422.40
-        movl      -120(%ebp), %ecx                              #4427.32
-        movswl    %ax, %edx                                     #4415.30
-        lea       3(%edx,%edx), %edx                            #4423.40
-        testl     %edi, %edi                                    #4427.32
-        movl      %edx, -24(%ebp)                               #4423.40
-        movl      -116(%ebp), %edx                              #4427.32
-        je        ..B9.14       # Prob 50%                      #4427.32
-                                # LOE edx ecx dl cl dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.13:                        # Preds ..B9.12
-        movl      -132(%ebp), %esi                              #4427.43
-        movl      -20(%ebp), %eax                               #4427.43
-        movl      -32(%ebp), %edi                               #4427.49
-        lea       (%eax,%esi,2), %eax                           #4427.43
-        cmpl      %eax, %edi                                    #4427.49
-        jae       ..B9.34       # Prob 1%                       #4427.49
-                                # LOE edx ecx dl cl dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.14:                        # Preds ..B9.13 ..B9.12
-        movl      -52(%ebp), %eax                               #4428.32
-        testl     %eax, %eax                                    #4428.32
-        je        ..B9.16       # Prob 50%                      #4428.32
-                                # LOE edx ecx dl cl dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.15:                        # Preds ..B9.14
-        movl      -128(%ebp), %esi                              #4428.43
-        addl      -20(%ebp), %esi                               #4428.43
-        movl      -32(%ebp), %eax                               #4428.49
-        cmpl      %esi, %eax                                    #4428.49
-        jae       ..B9.34       # Prob 1%                       #4428.49
-                                # LOE edx ecx dl cl dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.16:                        # Preds ..B9.15 ..B9.14
-        movl      -56(%ebp), %eax                               #4429.32
-        testl     %eax, %eax                                    #4429.32
-        je        ..B9.18       # Prob 50%                      #4429.32
-                                # LOE edx ecx dl cl dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.17:                        # Preds ..B9.16
-        movl      -124(%ebp), %esi                              #4429.43
-        addl      -20(%ebp), %esi                               #4429.43
-        movl      -32(%ebp), %eax                               #4429.49
-        cmpl      %esi, %eax                                    #4429.49
-        jae       ..B9.34       # Prob 1%                       #4429.49
-                                # LOE edx ecx dl cl dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.18:                        # Preds ..B9.17 ..B9.16
-        movl      -112(%ebp), %eax                              #4430.32
-        testl     %eax, %eax                                    #4430.32
-        je        ..B9.20       # Prob 50%                      #4430.32
-                                # LOE edx ecx dl cl dh ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.19:                        # Preds ..B9.18
-        movl      -24(%ebp), %esi                               #4430.43
-        addl      -20(%ebp), %esi                               #4430.43
-        movl      -32(%ebp), %eax                               #4430.49
-        cmpl      %esi, %eax                                    #4430.49
-        jae       ..B9.34       # Prob 1%                       #4430.49
-                                # LOE edx ecx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.20:                        # Preds ..B9.19 ..B9.18 ..B9.11
-        movl      -20(%ebp), %esi                               #4435.17
-        movl      -32(%ebp), %eax                               #4438.28
-        lea       4(%esi), %esi                                 #4435.17
-        cmpl      %eax, %esi                                    #4438.28
-        ja        ..B9.31       # Prob 1%                       #4438.28
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.21:                        # Preds ..B9.20
-        addl      $-1, %ecx                                     #4442.25
-        jne       ..B9.26       # Prob 50%                      #4442.39
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.22:                        # Preds ..B9.21
-        movl      -36(%ebp), %eax                               #4459.25
-        cmpl      %eax, %edx                                    #4459.25
-        jae       ..B9.31       # Prob 1%                       #4459.25
-                                # LOE edx xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.23:                        # Preds ..B9.22
-        movl      -20(%ebp), %esi                               #4463.13
-        movl      -32(%ebp), %eax                               #4464.24
-        lea       28(%esi), %esi                                #4463.13
-        cmpl      %eax, %esi                                    #4464.24
-        ja        ..B9.31       # Prob 1%                       #4464.24
-                                # LOE edx esi xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.24:                        # Preds ..B9.23
-        movl      -16(%ebp), %eax                               #4469.22
-        movzbl    (%edx), %ecx                                  #4469.22
-        movzwl    expand_2na.0 at GOTOFF(%eax,%ecx,2), %edi        #4469.22
-        movzbl    1(%edx), %ecx                                 #4469.22
-        movzwl    expand_2na.0 at GOTOFF(%eax,%ecx,2), %ecx        #4469.22
-        movw      %di, -148(%ebp)                               #4469.22
-        movw      %cx, -146(%ebp)                               #4469.22
-        movzbl    2(%edx), %ecx                                 #4469.22
-        movzwl    expand_2na.0 at GOTOFF(%eax,%ecx,2), %ecx        #4469.22
-        movw      %cx, -144(%ebp)                               #4469.22
-        movzbl    3(%edx), %ecx                                 #4469.22
-        movzwl    expand_2na.0 at GOTOFF(%eax,%ecx,2), %ecx        #4469.22
-        movw      %cx, -142(%ebp)                               #4469.22
-        movzbl    4(%edx), %ecx                                 #4469.22
-        movzwl    expand_2na.0 at GOTOFF(%eax,%ecx,2), %ecx        #4469.22
-        movw      %cx, -140(%ebp)                               #4469.22
-        movzbl    5(%edx), %ecx                                 #4469.22
-        movzwl    expand_2na.0 at GOTOFF(%eax,%ecx,2), %ecx        #4469.22
-        movw      %cx, -138(%ebp)                               #4469.22
-        movzbl    6(%edx), %ecx                                 #4469.22
-        movzwl    expand_2na.0 at GOTOFF(%eax,%ecx,2), %ecx        #4469.22
-        movw      %cx, -136(%ebp)                               #4469.22
-        movzbl    7(%edx), %ecx                                 #4469.22
-        addl      $8, %edx                                      #4484.13
-        movzwl    expand_2na.0 at GOTOFF(%eax,%ecx,2), %eax        #4469.22
-        movw      %ax, -134(%ebp)                               #4469.22
-        movdqu    -148(%ebp), %xmm0                             #4469.22
-        movl      %edx, -28(%ebp)                               #4484.13
-                                # LOE edx esi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.25:                        # Preds ..B9.5 ..B9.24
-        movl      $2, %ecx                                      #4352.13
-        jmp       ..B9.29       # Prob 100%                     #4352.13
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.26:                        # Preds ..B9.21
-        movl      -36(%ebp), %edi                               #4450.26
-        movl      -28(%ebp), %eax                               #4450.26
-        psrldq    $2, %xmm0                                     #4447.26
-        cmpl      %edi, %eax                                    #4450.26
-        jae       ..B9.28       # Prob 19%                      #4450.26
-                                # LOE eax edx ecx esi al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.27:                        # Preds ..B9.26
-        movl      -16(%ebp), %edi                               #4451.57
-        movzbl    (%eax), %eax                                  #4451.72
-        movzwl    expand_2na.0 at GOTOFF(%edi,%eax,2), %eax        #4451.57
-        pinsrw    $7, %eax, %xmm0                               #4451.30
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.28:                        # Preds ..B9.27 ..B9.26
-        addl      $1, -28(%ebp)                                 #4454.20
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.29:                        # Preds ..B9.25 ..B9.28 ..B9.33
-        movdqa    %xmm0, %xmm7                                  #4362.22
-        movdqa    %xmm0, %xmm6                                  #4363.22
-        pand      %xmm5, %xmm7                                  #4362.22
-        pand      %xmm4, %xmm6                                  #4363.22
-        pcmpeqd   %xmm6, %xmm7                                  #4364.22
-        pmovmskb  %xmm7, %eax                                   #4365.22
-        movl      %eax, -48(%ebp)                               #4365.22
-        jmp       ..B9.9        # Prob 100%                     #4365.22
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.31:                        # Preds ..B9.20 ..B9.22 ..B9.23 # Infreq
-        movl      -40(%ebp), %esi                               #4495.12
-        movl      -44(%ebp), %edi                               #4495.12
-        xorl      %eax, %eax                                    #4495.12
-        movl      %ebp, %esp                                    #4495.12
-        popl      %ebp                                          #4495.12
-        movl      %ebx, %esp                                    #4495.12
-        popl      %ebx                                          #4495.12
-        ret                                                     #4495.12
-                                # LOE
-..B9.33:                        # Preds ..B9.41                 # Infreq
-        movdqa    %xmm7, -72(%ebp)                              #
-        movdqa    %xmm0, -88(%ebp)                              #
-        movdqa    -120(%ebp), %xmm0                             #
-        movdqa    %xmm6, -104(%ebp)                             #
-        movl      $2, %ecx                                      #
-        movl      %edi, -16(%ebp)                               #
-        jmp       ..B9.29       # Prob 100%                     #
-                                # LOE edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.34:                        # Preds ..B9.13 ..B9.19 ..B9.17 ..B9.15 # Infreq
-        movl      -40(%ebp), %esi                               #4428.63
-        movl      -44(%ebp), %edi                               #4428.63
-        movl      $1, %eax                                      #4428.63
-        movl      %ebp, %esp                                    #4428.63
-        popl      %ebp                                          #4428.63
-        movl      %ebx, %esp                                    #4428.63
-        popl      %ebx                                          #4428.63
-        ret                                                     #4428.63
-        .align    2,0x90
-                                # LOE
-# mark_end;
-	.type	eval_4na_32, at function
-	.size	eval_4na_32,.-eval_4na_32
-.LNeval_4na_32:
-	.data
-# -- End  eval_4na_32
-	.text
-# -- Begin  eval_4na_128
-# mark_begin;
-       .align    2,0x90
-eval_4na_128:
-# parameter 1(self): 8 + %ebx
-# parameter 2(ncbi2na): 12 + %ebx
-# parameter 3(pos): 16 + %ebx
-# parameter 4(len): 20 + %ebx
-..B10.1:                        # Preds ..B10.0
-        pushl     %ebx                                          #4724.1
-        movl      %esp, %ebx                                    #4724.1
-        andl      $-16, %esp                                    #4724.1
-        pushl     %ebp                                          #4724.1
-        pushl     %ebp                                          #4724.1
-        movl      4(%ebx), %ebp                                 #4724.1
-        movl      %ebp, 4(%esp)                                 #4724.1
-        movl      %esp, %ebp                                    #4724.1
-        subl      $120, %esp                                    #4724.1
-        movl      %ebx, -120(%ebp)                              #4724.1
-        movl      %edi, -24(%ebp)                               #4724.1
-        movl      %esi, -20(%ebp)                               #4724.1
-        movl      12(%ebx), %ecx                                #4722.5
-        movl      16(%ebx), %esi                                #4722.5
-        call      ..L10         # Prob 100%                     #4724.1
-..L10:                                                          #
-        popl      %edi                                          #4724.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L10], %edi      #4724.1
-        lea       _gprof_pack9 at GOTOFF(%edi), %edx               #4724.1
-        movl      %edi, %ebx                                    #4724.1
-        call      mcount at PLT                                    #4724.1
-        movl      -120(%ebp), %ebx                              #4724.1
-                                # LOE esi edi
-..B10.37:                       # Preds ..B10.1
-        movl      12(%ebx), %ecx                                #
-        movl      %esi, -100(%ebp)                              #
-        movl      %esi, %eax                                    #4760.49
-        movl      %edi, -96(%ebp)                               #
-        shrl      $2, %eax                                      #4760.49
-        movl      20(%ebx), %edi                                #4757.5
-        movl      %eax, -4(%ebp)                                #4760.49
-        movl      8(%ebx), %eax                                 #4763.12
-        movdqa    16(%eax), %xmm5                               #4776.5
-        movdqa    32(%eax), %xmm4                               #4776.5
-        movdqa    48(%eax), %xmm3                               #4776.5
-        movdqa    64(%eax), %xmm2                               #4776.5
-        movdqa    80(%eax), %xmm1                               #4776.5
-        movdqa    96(%eax), %xmm6                               #4776.5
-        movdqa    128(%eax), %xmm7                              #4776.5
-        lea       (%esi,%edi), %edx                             #4757.5
-        subl      4(%eax), %edx                                 #4763.12
-        movl      %edx, -12(%ebp)                               #4763.12
-        movl      -4(%ebp), %edx                                #4769.14
-        lea       3(%esi,%edi), %esi                            #4766.50
-        movl      -96(%ebp), %edi                               #4769.14
-        shrl      $2, %esi                                      #4766.57
-        addl      %ecx, %esi                                    #4766.30
-        movl      %esi, -16(%ebp)                               #4766.30
-        movzbl    (%edx,%ecx), %esi                             #4769.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%esi,2), %esi        #4769.14
-        movw      %si, -116(%ebp)                               #4769.14
-        movzbl    1(%edx,%ecx), %esi                            #4769.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%esi,2), %esi        #4769.14
-        movw      %si, -114(%ebp)                               #4769.14
-        movzbl    2(%edx,%ecx), %esi                            #4769.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%esi,2), %esi        #4769.14
-        movw      %si, -112(%ebp)                               #4769.14
-        movzbl    3(%edx,%ecx), %esi                            #4769.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%esi,2), %esi        #4769.14
-        movw      %si, -110(%ebp)                               #4769.14
-        movzbl    4(%edx,%ecx), %esi                            #4769.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%esi,2), %esi        #4769.14
-        movw      %si, -108(%ebp)                               #4769.14
-        movzbl    5(%edx,%ecx), %esi                            #4769.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%esi,2), %esi        #4769.14
-        movw      %si, -106(%ebp)                               #4769.14
-        movzbl    6(%edx,%ecx), %esi                            #4769.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%esi,2), %esi        #4769.14
-        movw      %si, -104(%ebp)                               #4769.14
-        movzbl    7(%edx,%ecx), %esi                            #4769.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%esi,2), %esi        #4769.14
-        lea       8(%ecx,%edx), %edx                            #4770.5
-        movl      -12(%ebp), %ecx                               #4781.20
-        movw      %si, -102(%ebp)                               #4769.14
-        movdqu    -116(%ebp), %xmm0                             #4769.14
-        movl      -100(%ebp), %esi                              #4781.20
-        movdqa    %xmm0, -40(%ebp)                              #4769.14
-        movdqa    112(%eax), %xmm0                              #4776.5
-        movl      %edx, -8(%ebp)                                #4770.5
-        subl      %esi, %ecx                                    #4781.20
-        addl      $7, %ecx                                      #4781.33
-        shrl      $2, %ecx                                      #4781.40
-        movl      %esi, %eax                                    #4790.20
-        andl      $3, %eax                                      #4790.20
-        je        ..B10.32      # Prob 20%                      #4790.20
-                                # LOE eax edx ecx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B10.2:                        # Preds ..B10.37
-        cmpl      $1, %eax                                      #4790.20
-        je        ..B10.8       # Prob 25%                      #4790.20
-                                # LOE eax edx ecx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B10.3:                        # Preds ..B10.2
-        cmpl      $2, %eax                                      #4790.20
-        je        ..B10.7       # Prob 33%                      #4790.20
-                                # LOE eax edx ecx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B10.4:                        # Preds ..B10.3
-        cmpl      $3, %eax                                      #4790.20
-        je        ..B10.6       # Prob 50%                      #4790.20
-                                # LOE edx ecx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B10.5:                        # Preds ..B10.4
-        movdqa    %xmm7, -88(%ebp)                              #
-        movdqa    %xmm0, -72(%ebp)                              #
-        movdqa    -40(%ebp), %xmm0                              #
-        movdqa    %xmm6, -56(%ebp)                              #
-        jmp       ..B10.16      # Prob 100%                     #
-                                # LOE edx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.6:                        # Preds ..B10.4
-        movdqa    %xmm7, -88(%ebp)                              #
-        movdqa    %xmm0, -72(%ebp)                              #
-        movdqa    -40(%ebp), %xmm0                              #
-        movdqa    %xmm6, -56(%ebp)                              #
-        xorl      %eax, %eax                                    #
-        movl      %eax, -100(%ebp)                              #
-        movl      %ecx, -4(%ebp)                                #
-        movl      %eax, -96(%ebp)                               #
-        movl      %eax, -92(%ebp)                               #
-        jmp       ..B10.11      # Prob 100%                     #
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.7:                        # Preds ..B10.3
-        movdqa    %xmm7, -88(%ebp)                              #
-        movdqa    %xmm0, -72(%ebp)                              #
-        movdqa    -40(%ebp), %xmm0                              #
-        movdqa    %xmm6, -56(%ebp)                              #
-        xorl      %eax, %eax                                    #
-        movl      %eax, -96(%ebp)                               #
-        movl      %ecx, -4(%ebp)                                #
-        movl      %eax, -92(%ebp)                               #
-        jmp       ..B10.10      # Prob 100%                     #
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.8:                        # Preds ..B10.2
-        movdqa    %xmm7, -88(%ebp)                              #
-        movdqa    %xmm0, -72(%ebp)                              #
-        movdqa    -40(%ebp), %xmm0                              #
-        movdqa    %xmm6, -56(%ebp)                              #
-        xorl      %eax, %eax                                    #
-        movl      %ecx, -4(%ebp)                                #
-        movl      %eax, -92(%ebp)                               #
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.9:                        # Preds ..B10.8 ..B10.20
-        movdqa    %xmm0, %xmm7                                  #4814.22
-        movdqa    %xmm0, %xmm6                                  #4815.22
-        pand      %xmm3, %xmm7                                  #4814.22
-        pand      %xmm2, %xmm6                                  #4815.22
-        pcmpeqd   %xmm6, %xmm7                                  #4816.22
-        pmovmskb  %xmm7, %eax                                   #4817.22
-        addl      $1, %eax                                      #4818.17
-        shrl      $16, %eax                                     #4818.17
-        negl      %eax                                          #4818.17
-        movl      %eax, -96(%ebp)                               #4818.17
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.10:                       # Preds ..B10.7 ..B10.9
-        movdqa    %xmm0, %xmm7                                  #4821.22
-        movdqa    %xmm0, %xmm6                                  #4822.22
-        pand      -56(%ebp), %xmm6                              #4822.22
-        pand      %xmm1, %xmm7                                  #4821.22
-        pcmpeqd   %xmm6, %xmm7                                  #4823.22
-        pmovmskb  %xmm7, %eax                                   #4824.22
-        addl      $1, %eax                                      #4825.17
-        shrl      $16, %eax                                     #4825.17
-        negl      %eax                                          #4825.17
-        movl      %eax, -100(%ebp)                              #4825.17
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.11:                       # Preds ..B10.6 ..B10.10
-        movdqa    %xmm0, %xmm7                                  #4828.22
-        movdqa    %xmm0, %xmm6                                  #4829.22
-        movl      -92(%ebp), %ecx                               #4839.29
-        pand      -72(%ebp), %xmm7                              #4828.22
-        pand      -88(%ebp), %xmm6                              #4829.22
-        pcmpeqd   %xmm6, %xmm7                                  #4830.22
-        pmovmskb  %xmm7, %eax                                   #4831.22
-        andl      $-4, %esi                                     #4836.17
-        addl      $1, %eax                                      #4832.17
-        orl       -96(%ebp), %ecx                               #4839.29
-        orl       -100(%ebp), %ecx                              #4839.34
-        shrl      $16, %eax                                     #4832.17
-        negl      %eax                                          #4832.17
-        orl       %eax, %ecx                                    #4839.39
-        jne       ..B10.21      # Prob 1%                       #4839.47
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.12:                       # Preds ..B10.11
-        movl      -12(%ebp), %eax                               #4883.28
-        addl      $4, %esi                                      #4880.17
-        cmpl      %eax, %esi                                    #4883.28
-        ja        ..B10.28      # Prob 1%                       #4883.28
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.13:                       # Preds ..B10.12
-        movl      -4(%ebp), %eax                                #4887.25
-        addl      $-1, %eax                                     #4887.25
-        movl      %eax, -4(%ebp)                                #4887.25
-        jne       ..B10.17      # Prob 50%                      #4887.39
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.14:                       # Preds ..B10.13
-        movl      -16(%ebp), %eax                               #4904.25
-        cmpl      %eax, %edx                                    #4904.25
-        jae       ..B10.28      # Prob 1%                       #4904.25
-                                # LOE edx esi edi xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.15:                       # Preds ..B10.14
-        movzbl    (%edx), %eax                                  #4914.22
-        movzwl    expand_2na.0 at GOTOFF(%edi,%eax,2), %ecx        #4914.22
-        movzbl    1(%edx), %eax                                 #4914.22
-        movzwl    expand_2na.0 at GOTOFF(%edi,%eax,2), %eax        #4914.22
-        movw      %cx, -116(%ebp)                               #4914.22
-        movw      %ax, -114(%ebp)                               #4914.22
-        movzbl    2(%edx), %eax                                 #4914.22
-        movzwl    expand_2na.0 at GOTOFF(%edi,%eax,2), %eax        #4914.22
-        movw      %ax, -112(%ebp)                               #4914.22
-        movzbl    3(%edx), %eax                                 #4914.22
-        movzwl    expand_2na.0 at GOTOFF(%edi,%eax,2), %eax        #4914.22
-        movw      %ax, -110(%ebp)                               #4914.22
-        movzbl    4(%edx), %eax                                 #4914.22
-        movzwl    expand_2na.0 at GOTOFF(%edi,%eax,2), %eax        #4914.22
-        movw      %ax, -108(%ebp)                               #4914.22
-        movzbl    5(%edx), %eax                                 #4914.22
-        movzwl    expand_2na.0 at GOTOFF(%edi,%eax,2), %eax        #4914.22
-        movw      %ax, -106(%ebp)                               #4914.22
-        movzbl    6(%edx), %eax                                 #4914.22
-        movzwl    expand_2na.0 at GOTOFF(%edi,%eax,2), %eax        #4914.22
-        movw      %ax, -104(%ebp)                               #4914.22
-        movzbl    7(%edx), %eax                                 #4914.22
-        movzwl    expand_2na.0 at GOTOFF(%edi,%eax,2), %eax        #4914.22
-        addl      $8, %edx                                      #4929.13
-        movw      %ax, -102(%ebp)                               #4914.22
-        movdqu    -116(%ebp), %xmm0                             #4914.22
-        movl      %edx, -8(%ebp)                                #4929.13
-                                # LOE edx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.16:                       # Preds ..B10.5 ..B10.15
-        movl      $8, %eax                                      #4797.13
-        movl      %eax, -4(%ebp)                                #4797.13
-        jmp       ..B10.20      # Prob 100%                     #4797.13
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.17:                       # Preds ..B10.13
-        movl      -16(%ebp), %ecx                               #4895.26
-        movl      -8(%ebp), %eax                                #4895.26
-        psrldq    $2, %xmm0                                     #4892.26
-        cmpl      %ecx, %eax                                    #4895.26
-        jae       ..B10.19      # Prob 19%                      #4895.26
-                                # LOE eax edx esi edi al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.18:                       # Preds ..B10.17
-        movzbl    (%eax), %ecx                                  #4896.72
-        movzwl    expand_2na.0 at GOTOFF(%edi,%ecx,2), %eax        #4896.57
-        pinsrw    $7, %eax, %xmm0                               #4896.30
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.19:                       # Preds ..B10.18 ..B10.17
-        addl      $1, -8(%ebp)                                  #4899.20
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.20:                       # Preds ..B10.16 ..B10.19 ..B10.32
-        movdqa    %xmm0, %xmm7                                  #4807.22
-        movdqa    %xmm0, %xmm6                                  #4808.22
-        pand      %xmm5, %xmm7                                  #4807.22
-        pand      %xmm4, %xmm6                                  #4808.22
-        pcmpeqd   %xmm6, %xmm7                                  #4809.22
-        pmovmskb  %xmm7, %eax                                   #4810.22
-        addl      $1, %eax                                      #4811.17
-        shrl      $16, %eax                                     #4811.17
-        negl      %eax                                          #4811.17
-        movl      %eax, -92(%ebp)                               #4811.17
-        jmp       ..B10.9       # Prob 100%                     #4811.17
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.21:                       # Preds ..B10.11                # Infreq
-        movl      -92(%ebp), %eax                               #
-        movl      -12(%ebp), %edx                               #4842.30
-        subl      %esi, %edx                                    #4842.30
-        movl      %edx, -12(%ebp)                               #4842.30
-        cmpl      $2, %edx                                      #4842.37
-        je        ..B10.25      # Prob 25%                      #4842.37
-                                # LOE eax edx al dl ah dh
-..B10.22:                       # Preds ..B10.21                # Infreq
-        cmpl      $1, %edx                                      #4842.37
-        je        ..B10.26      # Prob 33%                      #4842.37
-                                # LOE eax edx al dl ah dh
-..B10.23:                       # Preds ..B10.22                # Infreq
-        testl     %edx, %edx                                    #4842.37
-        je        ..B10.27      # Prob 50%                      #4842.37
-                                # LOE eax al ah
-..B10.24:                       # Preds ..B10.25 ..B10.26 ..B10.27 ..B10.23 # Infreq
-        movl      -20(%ebp), %esi                               #4845.32
-        movl      -24(%ebp), %edi                               #4845.32
-        movl      $1, %eax                                      #4845.32
-        movl      %ebp, %esp                                    #4845.32
-        popl      %ebp                                          #4845.32
-        movl      %ebx, %esp                                    #4845.32
-        popl      %ebx                                          #4845.32
-        ret                                                     #4845.32
-                                # LOE
-..B10.25:                       # Preds ..B10.21                # Infreq
-        movl      -100(%ebp), %edx                              #4847.36
-        testl     %edx, %edx                                    #4847.36
-        jne       ..B10.24      # Prob 28%                      #4847.36
-                                # LOE eax al ah
-..B10.26:                       # Preds ..B10.25 ..B10.22       # Infreq
-        movl      -96(%ebp), %edx                               #4849.36
-        testl     %edx, %edx                                    #4849.36
-        jne       ..B10.24      # Prob 28%                      #4849.36
-                                # LOE eax al ah
-..B10.27:                       # Preds ..B10.23 ..B10.26       # Infreq
-        testl     %eax, %eax                                    #4851.36
-        jne       ..B10.24      # Prob 28%                      #4851.36
-                                # LOE
-..B10.28:                       # Preds ..B10.14 ..B10.12 ..B10.27 # Infreq
-        movl      -20(%ebp), %esi                               #4853.28
-        movl      -24(%ebp), %edi                               #4853.28
-        xorl      %eax, %eax                                    #4853.28
-        movl      %ebp, %esp                                    #4853.28
-        popl      %ebp                                          #4853.28
-        movl      %ebx, %esp                                    #4853.28
-        popl      %ebx                                          #4853.28
-        ret                                                     #4853.28
-                                # LOE
-..B10.32:                       # Preds ..B10.37                # Infreq
-        movdqa    %xmm7, -88(%ebp)                              #
-        movdqa    %xmm0, -72(%ebp)                              #
-        movdqa    -40(%ebp), %xmm0                              #
-        movdqa    %xmm6, -56(%ebp)                              #
-        movl      %ecx, -4(%ebp)                                #
-        jmp       ..B10.20      # Prob 100%                     #
-        .align    2,0x90
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-# mark_end;
-	.type	eval_4na_128, at function
-	.size	eval_4na_128,.-eval_4na_128
-.LNeval_4na_128:
-	.data
-# -- End  eval_4na_128
-	.text
-# -- Begin  eval_2na_pos
-# mark_begin;
-       .align    2,0x90
-eval_2na_pos:
-# parameter 1(self): 8 + %ebx
-# parameter 2(ncbi2na): 12 + %ebx
-# parameter 3(pos): 16 + %ebx
-# parameter 4(len): 20 + %ebx
-..B11.1:                        # Preds ..B11.0
-        pushl     %ebx                                          #3662.1
-        movl      %esp, %ebx                                    #3662.1
-        andl      $-16, %esp                                    #3662.1
-        pushl     %ebp                                          #3662.1
-        pushl     %ebp                                          #3662.1
-        movl      4(%ebx), %ebp                                 #3662.1
-        movl      %ebp, 4(%esp)                                 #3662.1
-        movl      %esp, %ebp                                    #3662.1
-        subl      $104, %esp                                    #3662.1
-        movl      %ebx, -104(%ebp)                              #3662.1
-        movl      %edi, -36(%ebp)                               #3662.1
-        movl      %esi, -40(%ebp)                               #3662.1
-        movl      16(%ebx), %esi                                #3660.5
-        call      ..L11         # Prob 100%                     #3662.1
-..L11:                                                          #
-        popl      %eax                                          #3662.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L11], %eax      #3662.1
-        lea       _gprof_pack10 at GOTOFF(%eax), %edx              #3662.1
-        movl      %eax, %ebx                                    #3662.1
-        call      mcount at PLT                                    #3662.1
-        movl      -104(%ebp), %ebx                              #3662.1
-                                # LOE esi
-..B11.60:                       # Preds ..B11.1
-        movl      20(%ebx), %ecx                                #3705.5
-        movl      12(%ebx), %eax                                #3713.30
-        movl      %esi, -32(%ebp)                               #3662.1
-        lea       (%esi,%ecx), %edx                             #3705.5
-        movl      %esi, %edi                                    #3713.49
-        shrl      $2, %edi                                      #3713.49
-        movl      %edi, -12(%ebp)                               #3713.49
-        lea       (%eax,%edi), %edi                             #3713.30
-        movl      %edi, -16(%ebp)                               #3713.30
-        lea       3(%esi,%ecx), %ecx                            #3719.50
-        shrl      $2, %ecx                                      #3719.57
-        movl      8(%ebx), %edi                                 #3716.12
-        subl      4(%edi), %edx                                 #3716.12
-        addl      %eax, %ecx                                    #3719.30
-        movl      -16(%ebp), %eax                               #3722.14
-        movl      %ecx, -20(%ebp)                               #3719.30
-        movl      -12(%ebp), %ecx                               #3722.14
-        testb     $15, %al                                      #3722.14
-        jne       ..B11.3       # Prob 50%                      #3722.14
-                                # LOE eax edx ecx esi al cl ah ch
-..B11.2:                        # Preds ..B11.60
-        movdqa    (%eax), %xmm0                                 #3722.14
-        movdqa    %xmm0, -56(%ebp)                              #3722.14
-        jmp       ..B11.4       # Prob 100%                     #3722.14
-                                # LOE edx ecx esi cl ch
-..B11.3:                        # Preds ..B11.60
-        movdqu    (%eax), %xmm0                                 #3722.14
-        movdqa    %xmm0, -56(%ebp)                              #3722.14
-                                # LOE edx ecx esi cl ch
-..B11.4:                        # Preds ..B11.2 ..B11.3
-        movl      12(%ebx), %edi                                #3723.5
-        movl      -20(%ebp), %eax                               #3728.16
-        lea       16(%edi,%ecx), %edi                           #3723.5
-        movl      %edi, -28(%ebp)                               #3723.5
-        cmpl      %eax, %edi                                    #3728.16
-        jae       ..B11.6       # Prob 12%                      #3728.16
-                                # LOE edx esi edi
-..B11.5:                        # Preds ..B11.4
-        movzbl    -1(%edi), %ecx                                #3729.24
-        shll      $8, %ecx                                      #3729.38
-        jmp       ..B11.7       # Prob 100%                     #3729.38
-                                # LOE edx ecx esi edi
-..B11.6:                        # Preds ..B11.4
-        xorl      %ecx, %ecx                                    #
-                                # LOE edx ecx esi edi
-..B11.7:                        # Preds ..B11.5 ..B11.6
-        movl      8(%ebx), %eax                                 #3733.5
-        movdqa    16(%eax), %xmm6                               #3733.5
-        movdqa    32(%eax), %xmm5                               #3733.5
-        movdqa    48(%eax), %xmm4                               #3733.5
-        movdqa    64(%eax), %xmm3                               #3733.5
-        movdqa    80(%eax), %xmm2                               #3733.5
-        movdqa    96(%eax), %xmm1                               #3733.5
-        movdqa    112(%eax), %xmm0                              #3733.5
-        movdqa    128(%eax), %xmm7                              #3733.5
-        movl      %edx, %eax                                    #3738.20
-        subl      %esi, %eax                                    #3738.20
-        addl      $7, %eax                                      #3738.33
-        shrl      $2, %eax                                      #3738.40
-        movl      %eax, -24(%ebp)                               #3738.40
-        movl      %esi, %eax                                    #3745.20
-        andl      $3, %eax                                      #3745.20
-        je        ..B11.55      # Prob 20%                      #3745.20
-                                # LOE eax edx ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B11.8:                        # Preds ..B11.7
-        cmpl      $1, %eax                                      #3745.20
-        je        ..B11.14      # Prob 25%                      #3745.20
-                                # LOE eax edx ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B11.9:                        # Preds ..B11.8
-        cmpl      $2, %eax                                      #3745.20
-        je        ..B11.13      # Prob 33%                      #3745.20
-                                # LOE eax edx ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B11.10:                       # Preds ..B11.9
-        cmpl      $3, %eax                                      #3745.20
-        je        ..B11.12      # Prob 50%                      #3745.20
-                                # LOE edx ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B11.11:                       # Preds ..B11.10
-        movdqa    %xmm7, -88(%ebp)                              #
-        movdqa    %xmm0, -72(%ebp)                              #
-        movdqa    -56(%ebp), %xmm0                              #
-        movl      %edx, -92(%ebp)                               #
-        jmp       ..B11.26      # Prob 100%                     #
-                                # LOE ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.12:                       # Preds ..B11.10
-        movdqa    %xmm7, -88(%ebp)                              #
-        movdqa    %xmm0, -72(%ebp)                              #
-        movdqa    -56(%ebp), %xmm0                              #
-        movl      %edx, -92(%ebp)                               #
-        xorl      %eax, %eax                                    #
-        movl      %eax, -100(%ebp)                              #
-        movl      %eax, -96(%ebp)                               #
-        movl      %eax, -12(%ebp)                               #
-        jmp       ..B11.17      # Prob 100%                     #
-                                # LOE ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.13:                       # Preds ..B11.9
-        movdqa    %xmm7, -88(%ebp)                              #
-        movdqa    %xmm0, -72(%ebp)                              #
-        movdqa    -56(%ebp), %xmm0                              #
-        movl      %edx, -92(%ebp)                               #
-        xorl      %eax, %eax                                    #
-        movl      %eax, -96(%ebp)                               #
-        movl      %eax, -12(%ebp)                               #
-        jmp       ..B11.16      # Prob 100%                     #
-                                # LOE ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.14:                       # Preds ..B11.8
-        movdqa    %xmm7, -88(%ebp)                              #
-        movdqa    %xmm0, -72(%ebp)                              #
-        movdqa    -56(%ebp), %xmm0                              #
-        movl      %edx, -92(%ebp)                               #
-        xorl      %eax, %eax                                    #
-        movl      %eax, -12(%ebp)                               #
-                                # LOE ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.15:                       # Preds ..B11.14 ..B11.30
-        movdqa    %xmm0, %xmm7                                  #3768.22
-        pand      %xmm3, %xmm7                                  #3768.22
-        pcmpeqd   %xmm4, %xmm7                                  #3769.22
-        pmovmskb  %xmm7, %eax                                   #3770.22
-        addl      $1, %eax                                      #3771.17
-        shrl      $16, %eax                                     #3771.17
-        negl      %eax                                          #3771.17
-        movl      %eax, -96(%ebp)                               #3771.17
-                                # LOE ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.16:                       # Preds ..B11.13 ..B11.15
-        movdqa    %xmm0, %xmm7                                  #3774.22
-        pand      %xmm1, %xmm7                                  #3774.22
-        pcmpeqd   %xmm2, %xmm7                                  #3775.22
-        pmovmskb  %xmm7, %eax                                   #3776.22
-        addl      $1, %eax                                      #3777.17
-        shrl      $16, %eax                                     #3777.17
-        negl      %eax                                          #3777.17
-        movl      %eax, -100(%ebp)                              #3777.17
-                                # LOE ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.17:                       # Preds ..B11.12 ..B11.16
-        movdqa    %xmm0, %xmm7                                  #3780.22
-        movl      -12(%ebp), %edx                               #3790.29
-        pand      -88(%ebp), %xmm7                              #3780.22
-        pcmpeqd   -72(%ebp), %xmm7                              #3781.22
-        pmovmskb  %xmm7, %eax                                   #3782.22
-        andl      $-4, %esi                                     #3787.17
-        orl       -96(%ebp), %edx                               #3790.29
-        addl      $1, %eax                                      #3783.17
-        orl       -100(%ebp), %edx                              #3790.34
-        shrl      $16, %eax                                     #3783.17
-        negl      %eax                                          #3783.17
-        orl       %eax, %edx                                    #3790.39
-        movl      %eax, -16(%ebp)                               #3783.17
-        jne       ..B11.31      # Prob 1%                       #3790.47
-                                # LOE eax ecx esi edi al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.18:                       # Preds ..B11.17
-        movl      -92(%ebp), %eax                               #3856.28
-        addl      $4, %esi                                      #3853.17
-        cmpl      %eax, %esi                                    #3856.28
-        ja        ..B11.53      # Prob 1%                       #3856.28
-                                # LOE ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.19:                       # Preds ..B11.18
-        movl      -24(%ebp), %eax                               #3860.25
-        addl      $-1, %eax                                     #3860.25
-        movl      %eax, -24(%ebp)                               #3860.25
-        jne       ..B11.27      # Prob 50%                      #3860.39
-                                # LOE ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.20:                       # Preds ..B11.19
-        movl      -20(%ebp), %eax                               #3881.25
-        cmpl      %eax, %edi                                    #3881.25
-        jae       ..B11.53      # Prob 1%                       #3881.25
-                                # LOE eax ecx esi edi al ah xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.21:                       # Preds ..B11.20
-        testl     $15, %edi                                     #3891.22
-        jne       ..B11.23      # Prob 50%                      #3891.22
-                                # LOE eax ecx esi edi al ah xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.22:                       # Preds ..B11.21
-        movdqa    (%edi), %xmm0                                 #3891.22
-        jmp       ..B11.24      # Prob 100%                     #3891.22
-                                # LOE eax ecx esi edi al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.23:                       # Preds ..B11.21
-        movdqu    (%edi), %xmm0                                 #3891.22
-                                # LOE eax ecx esi edi al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.24:                       # Preds ..B11.22 ..B11.23
-        addl      $16, %edi                                     #3969.13
-        movl      %edi, -28(%ebp)                               #3969.13
-        cmpl      %eax, %edi                                    #3972.24
-        jae       ..B11.26      # Prob 12%                      #3972.24
-                                # LOE ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.25:                       # Preds ..B11.24
-        movzbl    -1(%edi), %ecx                                #3973.32
-        shll      $8, %ecx                                      #3973.46
-                                # LOE ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.26:                       # Preds ..B11.24 ..B11.11 ..B11.25
-        movl      $16, %eax                                     #3752.13
-        movl      %eax, -24(%ebp)                               #3752.13
-        jmp       ..B11.30      # Prob 100%                     #3752.13
-                                # LOE ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.27:                       # Preds ..B11.19
-        movl      -20(%ebp), %edx                               #3868.26
-        movl      -28(%ebp), %eax                               #3868.26
-        psrldq    $1, %xmm0                                     #3865.26
-        cmpl      %edx, %eax                                    #3868.26
-        jae       ..B11.29      # Prob 19%                      #3868.26
-                                # LOE eax ecx esi edi al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.28:                       # Preds ..B11.27
-        movzbl    (%eax), %edx                                  #3871.37
-        sarl      $8, %ecx                                      #3870.21
-        shll      $8, %edx                                      #3871.48
-        orl       %edx, %ecx                                    #3871.21
-        pinsrw    $7, %ecx, %xmm0                               #3872.30
-                                # LOE ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.29:                       # Preds ..B11.28 ..B11.27
-        addl      $1, -28(%ebp)                                 #3876.20
-                                # LOE ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.30:                       # Preds ..B11.26 ..B11.29 ..B11.55
-        movdqa    %xmm0, %xmm7                                  #3762.22
-        pand      %xmm5, %xmm7                                  #3762.22
-        pcmpeqd   %xmm6, %xmm7                                  #3763.22
-        pmovmskb  %xmm7, %eax                                   #3764.22
-        addl      $1, %eax                                      #3765.17
-        shrl      $16, %eax                                     #3765.17
-        negl      %eax                                          #3765.17
-        movl      %eax, -12(%ebp)                               #3765.17
-        jmp       ..B11.15      # Prob 100%                     #3765.17
-                                # LOE ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.31:                       # Preds ..B11.17                # Infreq
-        movl      -92(%ebp), %edx                               #
-        movl      %eax, %ecx                                    #
-        movl      -12(%ebp), %eax                               #
-        subl      %esi, %edx                                    #3793.30
-        je        ..B11.52      # Prob 25%                      #3793.37
-                                # LOE eax edx ecx esi al cl ah ch
-..B11.32:                       # Preds ..B11.31                # Infreq
-        cmpl      $1, %edx                                      #3793.37
-        jne       ..B11.37      # Prob 67%                      #3793.37
-                                # LOE eax edx ecx esi al cl ah ch
-..B11.33:                       # Preds ..B11.32                # Infreq
-        testl     %eax, %eax                                    #3799.36
-        jne       ..B11.36      # Prob 28%                      #3799.36
-                                # LOE esi
-..B11.34:                       # Preds ..B11.33                # Infreq
-        movl      -96(%ebp), %eax                               #3800.36
-        testl     %eax, %eax                                    #3800.36
-        je        ..B11.53      # Prob 72%                      #3800.36
-                                # LOE esi
-..B11.35:                       # Preds ..B11.45 ..B11.39 ..B11.34 # Infreq
-        subl      -32(%ebp), %esi                               #3800.47
-        movl      -36(%ebp), %edi                               #3800.61
-        addl      $2, %esi                                      #3800.61
-        movl      %esi, %eax                                    #3800.61
-        movl      -40(%ebp), %esi                               #3800.61
-        movl      %ebp, %esp                                    #3800.61
-        popl      %ebp                                          #3800.61
-        movl      %ebx, %esp                                    #3800.61
-        popl      %ebx                                          #3800.61
-        ret                                                     #3800.61
-                                # LOE
-..B11.36:                       # Preds ..B11.52 ..B11.44 ..B11.38 ..B11.33 # Infreq
-        subl      -32(%ebp), %esi                               #3799.47
-        movl      -36(%ebp), %edi                               #3799.61
-        addl      $1, %esi                                      #3799.61
-        movl      %esi, %eax                                    #3799.61
-        movl      -40(%ebp), %esi                               #3799.61
-        movl      %ebp, %esp                                    #3799.61
-        popl      %ebp                                          #3799.61
-        movl      %ebx, %esp                                    #3799.61
-        popl      %ebx                                          #3799.61
-        ret                                                     #3799.61
-                                # LOE
-..B11.37:                       # Preds ..B11.32                # Infreq
-        cmpl      $2, %edx                                      #3793.37
-        jne       ..B11.44      # Prob 50%                      #3793.37
-                                # LOE eax ecx esi al cl ah ch
-..B11.38:                       # Preds ..B11.37                # Infreq
-        testl     %eax, %eax                                    #3803.36
-        jne       ..B11.36      # Prob 28%                      #3803.36
-                                # LOE esi
-..B11.39:                       # Preds ..B11.38                # Infreq
-        movl      -96(%ebp), %eax                               #3804.36
-        testl     %eax, %eax                                    #3804.36
-        jne       ..B11.35      # Prob 28%                      #3804.36
-                                # LOE esi
-..B11.40:                       # Preds ..B11.39                # Infreq
-        movl      -100(%ebp), %eax                              #3805.36
-        testl     %eax, %eax                                    #3805.36
-        je        ..B11.53      # Prob 72%                      #3805.36
-                                # LOE esi
-..B11.41:                       # Preds ..B11.46 ..B11.40       # Infreq
-        subl      -32(%ebp), %esi                               #3805.47
-        movl      -36(%ebp), %edi                               #3805.61
-        addl      $3, %esi                                      #3805.61
-        movl      %esi, %eax                                    #3805.61
-        movl      -40(%ebp), %esi                               #3805.61
-        movl      %ebp, %esp                                    #3805.61
-        popl      %ebp                                          #3805.61
-        movl      %ebx, %esp                                    #3805.61
-        popl      %ebx                                          #3805.61
-        ret                                                     #3805.61
-                                # LOE
-..B11.44:                       # Preds ..B11.37                # Infreq
-        testl     %eax, %eax                                    #3808.36
-        jne       ..B11.36      # Prob 28%                      #3808.36
-                                # LOE ecx esi cl ch
-..B11.45:                       # Preds ..B11.44                # Infreq
-        movl      -96(%ebp), %eax                               #3809.36
-        testl     %eax, %eax                                    #3809.36
-        jne       ..B11.35      # Prob 28%                      #3809.36
-                                # LOE ecx esi cl ch
-..B11.46:                       # Preds ..B11.45                # Infreq
-        movl      -100(%ebp), %eax                              #3810.36
-        testl     %eax, %eax                                    #3810.36
-        jne       ..B11.41      # Prob 28%                      #3810.36
-                                # LOE ecx esi cl ch
-..B11.47:                       # Preds ..B11.46                # Infreq
-        testl     %ecx, %ecx                                    #3811.36
-        je        ..B11.53      # Prob 72%                      #3811.36
-                                # LOE esi
-..B11.48:                       # Preds ..B11.47                # Infreq
-        subl      -32(%ebp), %esi                               #3811.47
-        movl      -36(%ebp), %edi                               #3811.61
-        addl      $4, %esi                                      #3811.61
-        movl      %esi, %eax                                    #3811.61
-        movl      -40(%ebp), %esi                               #3811.61
-        movl      %ebp, %esp                                    #3811.61
-        popl      %ebp                                          #3811.61
-        movl      %ebx, %esp                                    #3811.61
-        popl      %ebx                                          #3811.61
-        ret                                                     #3811.61
-                                # LOE
-..B11.52:                       # Preds ..B11.31                # Infreq
-        testl     %eax, %eax                                    #3796.36
-        jne       ..B11.36      # Prob 28%                      #3796.36
-                                # LOE esi
-..B11.53:                       # Preds ..B11.20 ..B11.18 ..B11.52 ..B11.34 ..B11.40
-                                #       ..B11.47                # Infreq
-        movl      -40(%ebp), %esi                               #3813.28
-        movl      -36(%ebp), %edi                               #3813.28
-        xorl      %eax, %eax                                    #3813.28
-        movl      %ebp, %esp                                    #3813.28
-        popl      %ebp                                          #3813.28
-        movl      %ebx, %esp                                    #3813.28
-        popl      %ebx                                          #3813.28
-        ret                                                     #3813.28
-                                # LOE
-..B11.55:                       # Preds ..B11.7                 # Infreq
-        movdqa    %xmm7, -88(%ebp)                              #
-        movdqa    %xmm0, -72(%ebp)                              #
-        movdqa    -56(%ebp), %xmm0                              #
-        movl      %edx, -92(%ebp)                               #
-        jmp       ..B11.30      # Prob 100%                     #
-        .align    2,0x90
-                                # LOE ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-# mark_end;
-	.type	eval_2na_pos, at function
-	.size	eval_2na_pos,.-eval_2na_pos
-.LNeval_2na_pos:
-	.data
-# -- End  eval_2na_pos
-	.text
-# -- Begin  eval_4na_pos
-# mark_begin;
-       .align    2,0x90
-eval_4na_pos:
-# parameter 1(self): 8 + %ebx
-# parameter 2(ncbi2na): 12 + %ebx
-# parameter 3(pos): 16 + %ebx
-# parameter 4(len): 20 + %ebx
-..B12.1:                        # Preds ..B12.0
-        pushl     %ebx                                          #4946.1
-        movl      %esp, %ebx                                    #4946.1
-        andl      $-16, %esp                                    #4946.1
-        pushl     %ebp                                          #4946.1
-        pushl     %ebp                                          #4946.1
-        movl      4(%ebx), %ebp                                 #4946.1
-        movl      %ebp, 4(%esp)                                 #4946.1
-        movl      %esp, %ebp                                    #4946.1
-        subl      $136, %esp                                    #4946.1
-        movl      %ebx, -136(%ebp)                              #4946.1
-        movl      %edi, -32(%ebp)                               #4946.1
-        movl      %esi, -36(%ebp)                               #4946.1
-        movl      12(%ebx), %ecx                                #4944.5
-        movl      16(%ebx), %esi                                #4944.5
-        call      ..L12         # Prob 100%                     #4946.1
-..L12:                                                          #
-        popl      %edi                                          #4946.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L12], %edi      #4946.1
-        lea       _gprof_pack11 at GOTOFF(%edi), %edx              #4946.1
-        movl      %edi, %ebx                                    #4946.1
-        call      mcount at PLT                                    #4946.1
-        movl      -136(%ebp), %ebx                              #4946.1
-                                # LOE esi edi
-..B12.50:                       # Preds ..B12.1
-        movl      12(%ebx), %ecx                                #
-        movl      %esi, -116(%ebp)                              #
-        movl      %esi, %eax                                    #4993.49
-        movl      %edi, -112(%ebp)                              #
-        movl      20(%ebx), %edi                                #4985.5
-        movl      %esi, -28(%ebp)                               #4946.1
-        lea       (%esi,%edi), %edx                             #4985.5
-        shrl      $2, %eax                                      #4993.49
-        lea       3(%esi,%edi), %esi                            #4999.50
-        movl      -112(%ebp), %edi                              #5002.14
-        movl      %eax, -12(%ebp)                               #4993.49
-        movl      8(%ebx), %eax                                 #4996.12
-        movdqa    16(%eax), %xmm5                               #5009.5
-        movdqa    32(%eax), %xmm4                               #5009.5
-        subl      4(%eax), %edx                                 #4996.12
-        movdqa    48(%eax), %xmm3                               #5009.5
-        movdqa    64(%eax), %xmm2                               #5009.5
-        movdqa    80(%eax), %xmm1                               #5009.5
-        movdqa    96(%eax), %xmm6                               #5009.5
-        movdqa    128(%eax), %xmm7                              #5009.5
-        movl      %edx, -20(%ebp)                               #4996.12
-        movl      -12(%ebp), %edx                               #5002.14
-        shrl      $2, %esi                                      #4999.57
-        addl      %ecx, %esi                                    #4999.30
-        movl      %esi, -24(%ebp)                               #4999.30
-        movzbl    (%edx,%ecx), %esi                             #5002.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%esi,2), %esi        #5002.14
-        movw      %si, -132(%ebp)                               #5002.14
-        movzbl    1(%edx,%ecx), %esi                            #5002.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%esi,2), %esi        #5002.14
-        movw      %si, -130(%ebp)                               #5002.14
-        movzbl    2(%edx,%ecx), %esi                            #5002.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%esi,2), %esi        #5002.14
-        movw      %si, -128(%ebp)                               #5002.14
-        movzbl    3(%edx,%ecx), %esi                            #5002.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%esi,2), %esi        #5002.14
-        movw      %si, -126(%ebp)                               #5002.14
-        movzbl    4(%edx,%ecx), %esi                            #5002.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%esi,2), %esi        #5002.14
-        movw      %si, -124(%ebp)                               #5002.14
-        movzbl    5(%edx,%ecx), %esi                            #5002.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%esi,2), %esi        #5002.14
-        movw      %si, -122(%ebp)                               #5002.14
-        movzbl    6(%edx,%ecx), %esi                            #5002.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%esi,2), %esi        #5002.14
-        movw      %si, -120(%ebp)                               #5002.14
-        movzbl    7(%edx,%ecx), %esi                            #5002.14
-        movzwl    expand_2na.0 at GOTOFF(%edi,%esi,2), %esi        #5002.14
-        lea       8(%ecx,%edx), %edx                            #5003.5
-        movl      -20(%ebp), %ecx                               #5014.20
-        movw      %si, -118(%ebp)                               #5002.14
-        movdqu    -132(%ebp), %xmm0                             #5002.14
-        movl      -116(%ebp), %esi                              #5014.20
-        movdqa    %xmm0, -56(%ebp)                              #5002.14
-        movdqa    112(%eax), %xmm0                              #5009.5
-        movl      %edx, -16(%ebp)                               #5003.5
-        subl      %esi, %ecx                                    #5014.20
-        addl      $7, %ecx                                      #5014.33
-        shrl      $2, %ecx                                      #5014.40
-        movl      %esi, %eax                                    #5023.20
-        andl      $3, %eax                                      #5023.20
-        je        ..B12.45      # Prob 20%                      #5023.20
-                                # LOE eax edx ecx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B12.2:                        # Preds ..B12.50
-        cmpl      $1, %eax                                      #5023.20
-        je        ..B12.8       # Prob 25%                      #5023.20
-                                # LOE eax edx ecx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B12.3:                        # Preds ..B12.2
-        cmpl      $2, %eax                                      #5023.20
-        je        ..B12.7       # Prob 33%                      #5023.20
-                                # LOE eax edx ecx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B12.4:                        # Preds ..B12.3
-        cmpl      $3, %eax                                      #5023.20
-        je        ..B12.6       # Prob 50%                      #5023.20
-                                # LOE edx ecx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B12.5:                        # Preds ..B12.4
-        movdqa    %xmm7, -104(%ebp)                             #
-        movdqa    %xmm0, -88(%ebp)                              #
-        movdqa    -56(%ebp), %xmm0                              #
-        movdqa    %xmm6, -72(%ebp)                              #
-        jmp       ..B12.16      # Prob 100%                     #
-                                # LOE edx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.6:                        # Preds ..B12.4
-        movdqa    %xmm7, -104(%ebp)                             #
-        movdqa    %xmm0, -88(%ebp)                              #
-        movdqa    -56(%ebp), %xmm0                              #
-        movdqa    %xmm6, -72(%ebp)                              #
-        xorl      %eax, %eax                                    #
-        movl      %eax, -116(%ebp)                              #
-        movl      %ecx, -12(%ebp)                               #
-        movl      %eax, -112(%ebp)                              #
-        movl      %eax, -40(%ebp)                               #
-        jmp       ..B12.11      # Prob 100%                     #
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.7:                        # Preds ..B12.3
-        movdqa    %xmm7, -104(%ebp)                             #
-        movdqa    %xmm0, -88(%ebp)                              #
-        movdqa    -56(%ebp), %xmm0                              #
-        movdqa    %xmm6, -72(%ebp)                              #
-        xorl      %eax, %eax                                    #
-        movl      %eax, -112(%ebp)                              #
-        movl      %ecx, -12(%ebp)                               #
-        movl      %eax, -40(%ebp)                               #
-        jmp       ..B12.10      # Prob 100%                     #
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.8:                        # Preds ..B12.2
-        movdqa    %xmm7, -104(%ebp)                             #
-        movdqa    %xmm0, -88(%ebp)                              #
-        movdqa    -56(%ebp), %xmm0                              #
-        movdqa    %xmm6, -72(%ebp)                              #
-        xorl      %eax, %eax                                    #
-        movl      %ecx, -12(%ebp)                               #
-        movl      %eax, -40(%ebp)                               #
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.9:                        # Preds ..B12.8 ..B12.20
-        movdqa    %xmm0, %xmm7                                  #5047.22
-        movdqa    %xmm0, %xmm6                                  #5048.22
-        pand      %xmm3, %xmm7                                  #5047.22
-        pand      %xmm2, %xmm6                                  #5048.22
-        pcmpeqd   %xmm6, %xmm7                                  #5049.22
-        pmovmskb  %xmm7, %eax                                   #5050.22
-        addl      $1, %eax                                      #5051.17
-        shrl      $16, %eax                                     #5051.17
-        negl      %eax                                          #5051.17
-        movl      %eax, -112(%ebp)                              #5051.17
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.10:                       # Preds ..B12.7 ..B12.9
-        movdqa    %xmm0, %xmm7                                  #5054.22
-        movdqa    %xmm0, %xmm6                                  #5055.22
-        pand      -72(%ebp), %xmm6                              #5055.22
-        pand      %xmm1, %xmm7                                  #5054.22
-        pcmpeqd   %xmm6, %xmm7                                  #5056.22
-        pmovmskb  %xmm7, %eax                                   #5057.22
-        addl      $1, %eax                                      #5058.17
-        shrl      $16, %eax                                     #5058.17
-        negl      %eax                                          #5058.17
-        movl      %eax, -116(%ebp)                              #5058.17
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.11:                       # Preds ..B12.6 ..B12.10
-        movdqa    %xmm0, %xmm7                                  #5061.22
-        movdqa    %xmm0, %xmm6                                  #5062.22
-        movl      -40(%ebp), %ecx                               #5072.29
-        pand      -88(%ebp), %xmm7                              #5061.22
-        pand      -104(%ebp), %xmm6                             #5062.22
-        pcmpeqd   %xmm6, %xmm7                                  #5063.22
-        pmovmskb  %xmm7, %eax                                   #5064.22
-        andl      $-4, %esi                                     #5069.17
-        addl      $1, %eax                                      #5065.17
-        orl       -112(%ebp), %ecx                              #5072.29
-        orl       -116(%ebp), %ecx                              #5072.34
-        shrl      $16, %eax                                     #5065.17
-        negl      %eax                                          #5065.17
-        movl      %eax, -108(%ebp)                              #5065.17
-        orl       %eax, %ecx                                    #5072.39
-        jne       ..B12.21      # Prob 1%                       #5072.47
-                                # LOE eax edx esi edi al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.12:                       # Preds ..B12.11
-        movl      -20(%ebp), %eax                               #5138.28
-        addl      $4, %esi                                      #5135.17
-        cmpl      %eax, %esi                                    #5138.28
-        ja        ..B12.43      # Prob 1%                       #5138.28
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.13:                       # Preds ..B12.12
-        movl      -12(%ebp), %eax                               #5142.25
-        addl      $-1, %eax                                     #5142.25
-        movl      %eax, -12(%ebp)                               #5142.25
-        jne       ..B12.17      # Prob 50%                      #5142.39
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.14:                       # Preds ..B12.13
-        movl      -24(%ebp), %eax                               #5159.25
-        cmpl      %eax, %edx                                    #5159.25
-        jae       ..B12.43      # Prob 1%                       #5159.25
-                                # LOE edx esi edi xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.15:                       # Preds ..B12.14
-        movzbl    (%edx), %eax                                  #5169.22
-        movzwl    expand_2na.0 at GOTOFF(%edi,%eax,2), %ecx        #5169.22
-        movzbl    1(%edx), %eax                                 #5169.22
-        movzwl    expand_2na.0 at GOTOFF(%edi,%eax,2), %eax        #5169.22
-        movw      %cx, -132(%ebp)                               #5169.22
-        movw      %ax, -130(%ebp)                               #5169.22
-        movzbl    2(%edx), %eax                                 #5169.22
-        movzwl    expand_2na.0 at GOTOFF(%edi,%eax,2), %eax        #5169.22
-        movw      %ax, -128(%ebp)                               #5169.22
-        movzbl    3(%edx), %eax                                 #5169.22
-        movzwl    expand_2na.0 at GOTOFF(%edi,%eax,2), %eax        #5169.22
-        movw      %ax, -126(%ebp)                               #5169.22
-        movzbl    4(%edx), %eax                                 #5169.22
-        movzwl    expand_2na.0 at GOTOFF(%edi,%eax,2), %eax        #5169.22
-        movw      %ax, -124(%ebp)                               #5169.22
-        movzbl    5(%edx), %eax                                 #5169.22
-        movzwl    expand_2na.0 at GOTOFF(%edi,%eax,2), %eax        #5169.22
-        movw      %ax, -122(%ebp)                               #5169.22
-        movzbl    6(%edx), %eax                                 #5169.22
-        movzwl    expand_2na.0 at GOTOFF(%edi,%eax,2), %eax        #5169.22
-        movw      %ax, -120(%ebp)                               #5169.22
-        movzbl    7(%edx), %eax                                 #5169.22
-        movzwl    expand_2na.0 at GOTOFF(%edi,%eax,2), %eax        #5169.22
-        addl      $8, %edx                                      #5184.13
-        movw      %ax, -118(%ebp)                               #5169.22
-        movdqu    -132(%ebp), %xmm0                             #5169.22
-        movl      %edx, -16(%ebp)                               #5184.13
-                                # LOE edx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.16:                       # Preds ..B12.5 ..B12.15
-        movl      $8, %eax                                      #5030.13
-        movl      %eax, -12(%ebp)                               #5030.13
-        jmp       ..B12.20      # Prob 100%                     #5030.13
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.17:                       # Preds ..B12.13
-        movl      -24(%ebp), %ecx                               #5150.26
-        movl      -16(%ebp), %eax                               #5150.26
-        psrldq    $2, %xmm0                                     #5147.26
-        cmpl      %ecx, %eax                                    #5150.26
-        jae       ..B12.19      # Prob 19%                      #5150.26
-                                # LOE eax edx esi edi al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.18:                       # Preds ..B12.17
-        movzbl    (%eax), %ecx                                  #5151.72
-        movzwl    expand_2na.0 at GOTOFF(%edi,%ecx,2), %eax        #5151.57
-        pinsrw    $7, %eax, %xmm0                               #5151.30
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.19:                       # Preds ..B12.18 ..B12.17
-        addl      $1, -16(%ebp)                                 #5154.20
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.20:                       # Preds ..B12.16 ..B12.19 ..B12.45
-        movdqa    %xmm0, %xmm7                                  #5040.22
-        movdqa    %xmm0, %xmm6                                  #5041.22
-        pand      %xmm5, %xmm7                                  #5040.22
-        pand      %xmm4, %xmm6                                  #5041.22
-        pcmpeqd   %xmm6, %xmm7                                  #5042.22
-        pmovmskb  %xmm7, %eax                                   #5043.22
-        addl      $1, %eax                                      #5044.17
-        shrl      $16, %eax                                     #5044.17
-        negl      %eax                                          #5044.17
-        movl      %eax, -40(%ebp)                               #5044.17
-        jmp       ..B12.9       # Prob 100%                     #5044.17
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.21:                       # Preds ..B12.11                # Infreq
-        movl      %eax, %edx                                    #
-        movl      -40(%ebp), %eax                               #
-        movl      -20(%ebp), %ecx                               #5075.30
-        subl      %esi, %ecx                                    #5075.30
-        movl      %ecx, -20(%ebp)                               #5075.30
-        je        ..B12.42      # Prob 25%                      #5075.37
-                                # LOE eax edx ecx esi al dl cl ah dh ch
-..B12.22:                       # Preds ..B12.21                # Infreq
-        cmpl      $1, %ecx                                      #5075.37
-        jne       ..B12.27      # Prob 67%                      #5075.37
-                                # LOE eax edx ecx esi al dl cl ah dh ch
-..B12.23:                       # Preds ..B12.22                # Infreq
-        testl     %eax, %eax                                    #5081.36
-        jne       ..B12.26      # Prob 28%                      #5081.36
-                                # LOE esi
-..B12.24:                       # Preds ..B12.23                # Infreq
-        movl      -112(%ebp), %eax                              #5082.36
-        testl     %eax, %eax                                    #5082.36
-        je        ..B12.43      # Prob 72%                      #5082.36
-                                # LOE esi
-..B12.25:                       # Preds ..B12.35 ..B12.29 ..B12.24 # Infreq
-        subl      -28(%ebp), %esi                               #5082.47
-        movl      -32(%ebp), %edi                               #5082.61
-        addl      $2, %esi                                      #5082.61
-        movl      %esi, %eax                                    #5082.61
-        movl      -36(%ebp), %esi                               #5082.61
-        movl      %ebp, %esp                                    #5082.61
-        popl      %ebp                                          #5082.61
-        movl      %ebx, %esp                                    #5082.61
-        popl      %ebx                                          #5082.61
-        ret                                                     #5082.61
-                                # LOE
-..B12.26:                       # Preds ..B12.42 ..B12.34 ..B12.28 ..B12.23 # Infreq
-        subl      -28(%ebp), %esi                               #5081.47
-        movl      -32(%ebp), %edi                               #5081.61
-        addl      $1, %esi                                      #5081.61
-        movl      %esi, %eax                                    #5081.61
-        movl      -36(%ebp), %esi                               #5081.61
-        movl      %ebp, %esp                                    #5081.61
-        popl      %ebp                                          #5081.61
-        movl      %ebx, %esp                                    #5081.61
-        popl      %ebx                                          #5081.61
-        ret                                                     #5081.61
-                                # LOE
-..B12.27:                       # Preds ..B12.22                # Infreq
-        cmpl      $2, %ecx                                      #5075.37
-        jne       ..B12.34      # Prob 50%                      #5075.37
-                                # LOE eax edx esi al dl ah dh
-..B12.28:                       # Preds ..B12.27                # Infreq
-        testl     %eax, %eax                                    #5085.36
-        jne       ..B12.26      # Prob 28%                      #5085.36
-                                # LOE esi
-..B12.29:                       # Preds ..B12.28                # Infreq
-        movl      -112(%ebp), %eax                              #5086.36
-        testl     %eax, %eax                                    #5086.36
-        jne       ..B12.25      # Prob 28%                      #5086.36
-                                # LOE esi
-..B12.30:                       # Preds ..B12.29                # Infreq
-        movl      -116(%ebp), %eax                              #5087.36
-        testl     %eax, %eax                                    #5087.36
-        je        ..B12.43      # Prob 72%                      #5087.36
-                                # LOE esi
-..B12.31:                       # Preds ..B12.36 ..B12.30       # Infreq
-        subl      -28(%ebp), %esi                               #5087.47
-        movl      -32(%ebp), %edi                               #5087.61
-        addl      $3, %esi                                      #5087.61
-        movl      %esi, %eax                                    #5087.61
-        movl      -36(%ebp), %esi                               #5087.61
-        movl      %ebp, %esp                                    #5087.61
-        popl      %ebp                                          #5087.61
-        movl      %ebx, %esp                                    #5087.61
-        popl      %ebx                                          #5087.61
-        ret                                                     #5087.61
-                                # LOE
-..B12.34:                       # Preds ..B12.27                # Infreq
-        testl     %eax, %eax                                    #5090.36
-        jne       ..B12.26      # Prob 28%                      #5090.36
-                                # LOE edx esi dl dh
-..B12.35:                       # Preds ..B12.34                # Infreq
-        movl      -112(%ebp), %eax                              #5091.36
-        testl     %eax, %eax                                    #5091.36
-        jne       ..B12.25      # Prob 28%                      #5091.36
-                                # LOE edx esi dl dh
-..B12.36:                       # Preds ..B12.35                # Infreq
-        movl      -116(%ebp), %eax                              #5092.36
-        testl     %eax, %eax                                    #5092.36
-        jne       ..B12.31      # Prob 28%                      #5092.36
-                                # LOE edx esi dl dh
-..B12.37:                       # Preds ..B12.36                # Infreq
-        testl     %edx, %edx                                    #5093.36
-        je        ..B12.43      # Prob 72%                      #5093.36
-                                # LOE esi
-..B12.38:                       # Preds ..B12.37                # Infreq
-        subl      -28(%ebp), %esi                               #5093.47
-        movl      -32(%ebp), %edi                               #5093.61
-        addl      $4, %esi                                      #5093.61
-        movl      %esi, %eax                                    #5093.61
-        movl      -36(%ebp), %esi                               #5093.61
-        movl      %ebp, %esp                                    #5093.61
-        popl      %ebp                                          #5093.61
-        movl      %ebx, %esp                                    #5093.61
-        popl      %ebx                                          #5093.61
-        ret                                                     #5093.61
-                                # LOE
-..B12.42:                       # Preds ..B12.21                # Infreq
-        testl     %eax, %eax                                    #5078.36
-        jne       ..B12.26      # Prob 28%                      #5078.36
-                                # LOE esi
-..B12.43:                       # Preds ..B12.14 ..B12.12 ..B12.42 ..B12.24 ..B12.30
-                                #       ..B12.37                # Infreq
-        movl      -36(%ebp), %esi                               #5095.28
-        movl      -32(%ebp), %edi                               #5095.28
-        xorl      %eax, %eax                                    #5095.28
-        movl      %ebp, %esp                                    #5095.28
-        popl      %ebp                                          #5095.28
-        movl      %ebx, %esp                                    #5095.28
-        popl      %ebx                                          #5095.28
-        ret                                                     #5095.28
-                                # LOE
-..B12.45:                       # Preds ..B12.50                # Infreq
-        movdqa    %xmm7, -104(%ebp)                             #
-        movdqa    %xmm0, -88(%ebp)                              #
-        movdqa    -56(%ebp), %xmm0                              #
-        movdqa    %xmm6, -72(%ebp)                              #
-        movl      %ecx, -12(%ebp)                               #
-        jmp       ..B12.20      # Prob 100%                     #
-        .align    2,0x90
-                                # LOE edx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-# mark_end;
-	.type	eval_4na_pos, at function
-	.size	eval_4na_pos,.-eval_4na_pos
-.LNeval_4na_pos:
-	.data
-# -- End  eval_4na_pos
-	.text
-# -- Begin  NucStrstrMake
-# mark_begin;
-       .align    2,0x90
-	.globl NucStrstrMake
-NucStrstrMake:
-# parameter 1(nss): 8 + %ebp
-# parameter 2(positional): 12 + %ebp
-# parameter 3(query): 16 + %ebp
-# parameter 4(len): 20 + %ebp
-..B13.1:                        # Preds ..B13.0
-        pushl     %ebp                                          #1539.1
-        movl      %esp, %ebp                                    #1539.1
-        subl      $16, %esp                                     #1539.1
-        movl      %edi, -8(%ebp)                                #1539.1
-        movl      %esi, -4(%ebp)                                #1539.1
-        movl      %ebx, -12(%ebp)                               #1539.1
-        movl      8(%ebp), %esi                                 #1537.5
-        call      ..L13         # Prob 100%                     #1539.1
-..L13:                                                          #
-        popl      %ebx                                          #1539.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L13], %ebx      #1539.1
-        lea       _gprof_pack12 at GOTOFF(%ebx), %edx              #1539.1
-        call      mcount at PLT                                    #1539.1
-                                # LOE ebx esi
-..B13.17:                       # Preds ..B13.1
-        testl     %esi, %esi                                    #1540.17
-        je        ..B13.12      # Prob 6%                       #1540.17
-                                # LOE ebx esi
-..B13.2:                        # Preds ..B13.17
-        movl      16(%ebp), %eax                                #1542.23
-        testl     %eax, %eax                                    #1542.23
-        je        ..B13.11      # Prob 12%                      #1542.23
-                                # LOE ebx esi
-..B13.3:                        # Preds ..B13.2
-        movl      20(%ebp), %eax                                #1542.38
-        testl     %eax, %eax                                    #1542.38
-        je        ..B13.11      # Prob 50%                      #1542.38
-                                # LOE ebx esi
-..B13.4:                        # Preds ..B13.3
-        movsbl    fasta_2na_map.0 at GOTOFF(%ebx), %eax            #1547.18
-        movl      $0, -16(%ebp)                                 #1544.24
-        testl     %eax, %eax                                    #1547.41
-        je        ..B13.13      # Prob 5%                       #1547.41
-                                # LOE ebx esi
-..B13.5:                        # Preds ..B13.13 ..B13.4
-        pushl     12(%ebp)                                      #1539.1
-        movl      20(%ebp), %edi                                #1550.19
-        movl      16(%ebp), %edx                                #1550.19
-        lea       -16(%ebp), %eax                               #1551.49
-        pushl     %eax                                          #1539.1
-        pushl     %esi                                          #1539.1
-        lea       (%edi,%edx), %edi                             #1550.19
-        pushl     %edi                                          #1539.1
-        pushl     %edx                                          #1539.1
-        call      nss_expr                                      #1551.21
-                                # LOE eax ebx esi edi
-..B13.18:                       # Preds ..B13.5
-        addl      $20, %esp                                     #1551.21
-                                # LOE eax ebx esi edi
-..B13.6:                        # Preds ..B13.18
-        movl      -16(%ebp), %edx                               #1552.18
-        testl     %edx, %edx                                    #1552.28
-        jne       ..B13.9       # Prob 22%                      #1552.28
-                                # LOE eax ebx esi edi
-..B13.7:                        # Preds ..B13.6
-        cmpl      %edi, %eax                                    #1554.31
-        je        ..B13.14      # Prob 5%                       #1554.31
-                                # LOE ebx esi
-..B13.8:                        # Preds ..B13.7
-        movl      $22, -16(%ebp)                                #1557.17
-                                # LOE ebx esi
-..B13.9:                        # Preds ..B13.8 ..B13.6
-        pushl     (%esi)                                        #1560.32
-        call      NucStrstrWhack at PLT                            #1560.13
-                                # LOE esi
-..B13.19:                       # Preds ..B13.9
-        popl      %ecx                                          #1560.13
-                                # LOE esi
-..B13.10:                       # Preds ..B13.19
-        movl      -16(%ebp), %eax                               #1562.20
-        movl      -12(%ebp), %ebx                               #1562.20
-        movl      -8(%ebp), %edi                                #1562.20
-        movl      $0, (%esi)                                    #1561.13
-        movl      -4(%ebp), %esi                                #1562.20
-        movl      %ebp, %esp                                    #1562.20
-        popl      %ebp                                          #1562.20
-        ret                                                     #1562.20
-                                # LOE
-..B13.11:                       # Preds ..B13.3 ..B13.2
-        movl      $0, (%esi)                                    #1565.9
-                                # LOE
-..B13.12:                       # Preds ..B13.17 ..B13.11
-        movl      -12(%ebp), %ebx                               #1567.12
-        movl      -4(%ebp), %esi                                #1567.12
-        movl      -8(%ebp), %edi                                #1567.12
-        movl      $22, %eax                                     #1567.12
-        movl      %ebp, %esp                                    #1567.12
-        popl      %ebp                                          #1567.12
-        ret                                                     #1567.12
-                                # LOE
-..B13.13:                       # Preds ..B13.4                 # Infreq
-        call      NucStrstrInit                                 #1548.17
-        jmp       ..B13.5       # Prob 100%                     #1548.17
-                                # LOE ebx esi
-..B13.14:                       # Preds ..B13.7                 # Infreq
-        movl      -12(%ebp), %ebx                               #1555.28
-        movl      -4(%ebp), %esi                                #1555.28
-        movl      -8(%ebp), %edi                                #1555.28
-        xorl      %eax, %eax                                    #1555.28
-        movl      %ebp, %esp                                    #1555.28
-        popl      %ebp                                          #1555.28
-        ret                                                     #1555.28
-        .align    2,0x90
-                                # LOE
-# mark_end;
-	.type	NucStrstrMake, at function
-	.size	NucStrstrMake,.-NucStrstrMake
-.LNNucStrstrMake:
-	.data
-# -- End  NucStrstrMake
-	.text
-# -- Begin  NucStrstrWhack
-# mark_begin;
-       .align    2,0x90
-	.globl NucStrstrWhack
-NucStrstrWhack:
-# parameter 1(self): 8 + %ebp
-..B14.1:                        # Preds ..B14.0
-        pushl     %ebp                                          #1574.1
-        movl      %esp, %ebp                                    #1574.1
-        subl      $8, %esp                                      #1574.1
-        movl      %edi, -4(%ebp)                                #1574.1
-        movl      %ebx, -8(%ebp)                                #1574.1
-        movl      8(%ebp), %edi                                 #1573.6
-        call      ..L14         # Prob 100%                     #1574.1
-..L14:                                                          #
-        popl      %ebx                                          #1574.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L14], %ebx      #1574.1
-        lea       _gprof_pack13 at GOTOFF(%ebx), %edx              #1574.1
-        call      mcount at PLT                                    #1574.1
-                                # LOE ebx esi edi
-..B14.25:                       # Preds ..B14.1
-        testl     %edi, %edi                                    #1575.18
-        je        ..B14.22      # Prob 12%                      #1575.18
-                                # LOE ebx esi edi
-..B14.2:                        # Preds ..B14.25
-        movl      (%edi), %eax                                  #1577.18
-        cmpl      $12, %eax                                     #1577.9
-        ja        ..B14.21      # Prob 50%                      #1577.9
-                                # LOE eax ebx esi edi
-..B14.3:                        # Preds ..B14.2
-        movl      ..1..TPKT.18_0.0.15 at GOTOFF(%ebx,%eax,4), %eax #1577.9
-        jmp       *%eax                                         #1577.9
-                                # LOE ebx esi edi
-..1.18_0.TAG.0c.0.15:
-..B14.5:                        # Preds ..B14.3
-        pushl     8(%edi)                                       #1601.30
-        call      NucStrstrWhack at PLT                            #1601.13
-                                # LOE ebx esi edi
-..B14.26:                       # Preds ..B14.5
-        popl      %ecx                                          #1601.13
-        jmp       ..B14.21      # Prob 100%                     #1601.13
-                                # LOE ebx esi edi
-..1.18_0.TAG.0b.0.15:
-..B14.7:                        # Preds ..B14.3
-        pushl     8(%edi)                                       #1597.30
-        call      NucStrstrWhack at PLT                            #1597.13
-                                # LOE ebx esi edi
-..B14.8:                        # Preds ..B14.7
-        pushl     12(%edi)                                      #1598.30
-        call      NucStrstrWhack at PLT                            #1598.13
-                                # LOE ebx esi edi
-..B14.27:                       # Preds ..B14.8
-        addl      $8, %esp                                      #1598.13
-        jmp       ..B14.21      # Prob 100%                     #1598.13
-                                # LOE ebx esi edi
-..1.18_0.TAG.0a.0.15:
-..1.18_0.TAG.09.0.15:
-..1.18_0.TAG.08.0.15:
-..1.18_0.TAG.07.0.15:
-..1.18_0.TAG.06.0.15:
-..1.18_0.TAG.05.0.15:
-..1.18_0.TAG.04.0.15:
-..1.18_0.TAG.03.0.15:
-..1.18_0.TAG.02.0.15:
-..1.18_0.TAG.01.0.15:
-..1.18_0.TAG.00.0.15:
-..B14.20:                       # Preds ..B14.3 ..B14.3 ..B14.3 ..B14.3 ..B14.3
-                                #       ..B14.3 ..B14.3 ..B14.3 ..B14.3 ..B14.3
-                                #       ..B14.3
-        movl      8(%edi), %edi                                 #1593.20
-                                # LOE ebx esi edi
-..B14.21:                       # Preds ..B14.27 ..B14.26 ..B14.20 ..B14.2
-        pushl     %edi                                          #1604.9
-        call      free at PLT                                      #1604.9
-                                # LOE esi
-..B14.28:                       # Preds ..B14.21
-        popl      %ecx                                          #1604.9
-                                # LOE esi
-..B14.22:                       # Preds ..B14.28 ..B14.25
-        movl      -8(%ebp), %ebx                                #1606.1
-        movl      -4(%ebp), %edi                                #1606.1
-        movl      %ebp, %esp                                    #1606.1
-        popl      %ebp                                          #1606.1
-        ret                                                     #1606.1
-        .align    2,0x90
-                                # LOE
-# mark_end;
-	.type	NucStrstrWhack, at function
-	.size	NucStrstrWhack,.-NucStrstrWhack
-.LNNucStrstrWhack:
-	.section .data1, "wa"
-	.align 4
-..1..TPKT.18_0.0.15:
-	.long	..1.18_0.TAG.00.0.15
-	.long	..1.18_0.TAG.01.0.15
-	.long	..1.18_0.TAG.02.0.15
-	.long	..1.18_0.TAG.03.0.15
-	.long	..1.18_0.TAG.04.0.15
-	.long	..1.18_0.TAG.05.0.15
-	.long	..1.18_0.TAG.06.0.15
-	.long	..1.18_0.TAG.07.0.15
-	.long	..1.18_0.TAG.08.0.15
-	.long	..1.18_0.TAG.09.0.15
-	.long	..1.18_0.TAG.0a.0.15
-	.long	..1.18_0.TAG.0b.0.15
-	.long	..1.18_0.TAG.0c.0.15
-	.data
-# -- End  NucStrstrWhack
-	.text
-# -- Begin  nss_unary_expr
-# mark_begin;
-       .align    2,0x90
-nss_unary_expr:
-# parameter 1(p): 8 + %ebp
-# parameter 2(end): 12 + %ebp
-# parameter 3(expr): 16 + %ebp
-# parameter 4(status): 20 + %ebp
-# parameter 5(positional): 24 + %ebp
-..B15.1:                        # Preds ..B15.0
-        pushl     %ebp                                          #1361.1
-        movl      %esp, %ebp                                    #1361.1
-        subl      $16, %esp                                     #1361.1
-        movl      %edi, -12(%ebp)                               #1361.1
-        movl      %esi, -8(%ebp)                                #1361.1
-        movl      %ebx, -4(%ebp)                                #1361.1
-        movl      8(%ebp), %esi                                 #1359.13
-        movl      16(%ebp), %edi                                #1359.13
-        call      ..L15         # Prob 100%                     #1361.1
-..L15:                                                          #
-        popl      %ebx                                          #1361.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L15], %ebx      #1361.1
-        lea       _gprof_pack14 at GOTOFF(%ebx), %edx              #1361.1
-        call      mcount at PLT                                    #1361.1
-        jmp       ..B15.2       # Prob 100%                     #1361.1
-                                # LOE ebx esi edi
-..B15.43:                       # Preds ..B15.42
-        movl      $12, (%eax)                                   #1384.13
-        movl      $13, 4(%eax)                                  #1385.13
-        movl      $0, 8(%eax)                                   #1386.13
-        movl      %eax, (%edi)                                  #1387.13
-        lea       8(%eax), %edi                                 #1389.44
-                                # LOE ebx esi edi
-..B15.2:                        # Preds ..B15.43 ..B15.1
-        movsbl    (%esi), %eax                                  #1363.12
-        cmpl      $33, %eax                                     #1363.17
-        je        ..B15.32      # Prob 16%                      #1363.17
-                                # LOE eax ebx esi edi
-..B15.3:                        # Preds ..B15.2
-        cmpl      $94, %eax                                     #1364.16
-        jne       ..B15.10      # Prob 67%                      #1364.16
-                                # LOE eax ebx esi edi
-..B15.4:                        # Preds ..B15.3
-        pushl     $12                                           #1364.16
-        call      malloc at PLT                                    #1364.16
-                                # LOE eax ebx esi edi
-..B15.48:                       # Preds ..B15.4
-        popl      %ecx                                          #1364.16
-        movl      %eax, %edx                                    #1364.16
-                                # LOE edx ebx esi edi
-..B15.5:                        # Preds ..B15.48
-        testl     %edx, %edx                                    #1364.16
-        jne       ..B15.7       # Prob 68%                      #1364.16
-                                # LOE edx ebx esi edi
-..B15.6:                        # Preds ..B15.5
-        call      __errno_location at PLT                          #1364.16
-                                # LOE eax esi
-..B15.49:                       # Preds ..B15.6
-        movl      20(%ebp), %ecx                                #1364.16
-        movl      (%eax), %edx                                  #1364.16
-        movl      %edx, (%ecx)                                  #1364.16
-        jmp       ..B15.27      # Prob 100%                     #1364.16
-                                # LOE esi
-..B15.7:                        # Preds ..B15.5
-        movl      12(%ebp), %ecx                                #1361.1
-        movl      %edx, -16(%ebp)                               #1364.16
-        movl      $12, (%edx)                                   #1364.16
-        movl      $14, 4(%edx)                                  #1364.16
-        pushl     %ecx                                          #1361.1
-        movl      %edx, (%edi)                                  #1364.16
-        movl      $0, 8(%edx)                                   #1364.16
-        addl      $1, %esi                                      #1364.16
-        pushl     %esi                                          #1361.1
-        call      nss_sob                                       #1364.16
-                                # LOE eax
-..B15.50:                       # Preds ..B15.7
-        movl      -16(%ebp), %edx                               #
-        movl      24(%ebp), %ecx                                #1361.1
-        movl      20(%ebp), %ebx                                #1361.1
-        pushl     %ecx                                          #1361.1
-        pushl     %ebx                                          #1361.1
-        addl      $8, %edx                                      #1364.16
-        pushl     %edx                                          #1361.1
-        movl      12(%ebp), %edx                                #1361.1
-        pushl     %edx                                          #1361.1
-        pushl     %eax                                          #1361.1
-        call      nss_fasta_expr                                #1364.16
-                                # LOE eax
-..B15.51:                       # Preds ..B15.50
-        addl      $28, %esp                                     #1364.16
-        movl      %eax, %esi                                    #1364.16
-        jmp       ..B15.27      # Prob 100%                     #1364.16
-                                # LOE esi
-..B15.10:                       # Preds ..B15.3
-        cmpl      $40, %eax                                     #1364.16
-        jne       ..B15.21      # Prob 50%                      #1364.16
-                                # LOE ebx esi edi
-..B15.11:                       # Preds ..B15.10
-        pushl     $12                                           #1364.16
-        call      malloc at PLT                                    #1364.16
-                                # LOE eax ebx esi edi
-..B15.52:                       # Preds ..B15.11
-        popl      %ecx                                          #1364.16
-        movl      %eax, %edx                                    #1364.16
-                                # LOE edx ebx esi edi
-..B15.12:                       # Preds ..B15.52
-        testl     %edx, %edx                                    #1364.16
-        jne       ..B15.14      # Prob 68%                      #1364.16
-                                # LOE edx ebx esi edi
-..B15.13:                       # Preds ..B15.12
-        call      __errno_location at PLT                          #1364.16
-                                # LOE eax esi
-..B15.53:                       # Preds ..B15.13
-        movl      20(%ebp), %ecx                                #1364.16
-        movl      (%eax), %edx                                  #1364.16
-        movl      %edx, (%ecx)                                  #1364.16
-        jmp       ..B15.27      # Prob 100%                     #1364.16
-                                # LOE esi
-..B15.14:                       # Preds ..B15.12
-        movl      24(%ebp), %ecx                                #1361.1
-        movl      20(%ebp), %ebx                                #1361.1
-        movl      %edx, -16(%ebp)                               #1364.16
-        pushl     %ecx                                          #1361.1
-        movl      12(%ebp), %ecx                                #1361.1
-        movl      $12, (%edx)                                   #1364.16
-        movl      %edx, (%edi)                                  #1364.16
-        addl      $1, %esi                                      #1364.16
-        movl      $0, 4(%edx)                                   #1364.16
-        pushl     %ebx                                          #1361.1
-        lea       8(%edx), %edi                                 #1364.16
-        pushl     %edi                                          #1361.1
-        pushl     %ecx                                          #1361.1
-        pushl     %esi                                          #1361.1
-        call      nss_expr                                      #1364.16
-                                # LOE eax
-..B15.54:                       # Preds ..B15.14
-        movl      -16(%ebp), %edx                               #
-        addl      $20, %esp                                     #1364.16
-        movl      %eax, %esi                                    #1364.16
-                                # LOE edx esi dl dh
-..B15.15:                       # Preds ..B15.54
-        movl      20(%ebp), %ecx                                #1364.16
-        movl      (%ecx), %ebx                                  #1364.16
-        testl     %ebx, %ebx                                    #1364.16
-        jne       ..B15.27      # Prob 50%                      #1364.16
-                                # LOE edx esi dl dh
-..B15.16:                       # Preds ..B15.15
-        movl      8(%edx), %eax                                 #1364.16
-        testl     %eax, %eax                                    #1364.16
-        je        ..B15.19      # Prob 12%                      #1364.16
-                                # LOE esi
-..B15.17:                       # Preds ..B15.16
-        movl      12(%ebp), %eax                                #1364.16
-        cmpl      %eax, %esi                                    #1364.16
-        je        ..B15.19      # Prob 12%                      #1364.16
-                                # LOE esi
-..B15.18:                       # Preds ..B15.17
-        movsbl    (%esi), %eax                                  #1364.16
-        addl      $1, %esi                                      #1364.16
-        cmpl      $41, %eax                                     #1364.16
-        je        ..B15.27      # Prob 50%                      #1364.16
-                                # LOE esi
-..B15.19:                       # Preds ..B15.18 ..B15.17 ..B15.16
-        movl      20(%ebp), %eax                                #1364.16
-        movl      $22, (%eax)                                   #1364.16
-        jmp       ..B15.27      # Prob 100%                     #1364.16
-                                # LOE esi
-..B15.21:                       # Preds ..B15.10
-        movl      24(%ebp), %eax                                #1361.1
-        movl      20(%ebp), %edx                                #1361.1
-        movl      12(%ebp), %ecx                                #1361.1
-        pushl     %eax                                          #1361.1
-        pushl     %edx                                          #1361.1
-        pushl     %edi                                          #1361.1
-        pushl     %ecx                                          #1361.1
-        pushl     %esi                                          #1361.1
-        call      nss_fasta_expr                                #1364.16
-                                # LOE eax ebx edi
-..B15.55:                       # Preds ..B15.21
-        addl      $20, %esp                                     #1364.16
-        movl      %eax, %esi                                    #1364.16
-                                # LOE ebx esi edi
-..B15.22:                       # Preds ..B15.55
-        movl      20(%ebp), %eax                                #1364.16
-        movl      (%eax), %edx                                  #1364.16
-        testl     %edx, %edx                                    #1364.16
-        jne       ..B15.27      # Prob 50%                      #1364.16
-                                # LOE ebx esi edi
-..B15.23:                       # Preds ..B15.22
-        movl      12(%ebp), %eax                                #1364.16
-        cmpl      %eax, %esi                                    #1364.16
-        jae       ..B15.27      # Prob 33%                      #1364.16
-                                # LOE ebx esi edi
-..B15.24:                       # Preds ..B15.23
-        movl      12(%ebp), %eax                                #1361.1
-        pushl     %eax                                          #1361.1
-        pushl     %esi                                          #1361.1
-        call      nss_sob                                       #1364.16
-                                # LOE eax ebx edi
-..B15.56:                       # Preds ..B15.24
-        addl      $8, %esp                                      #1364.16
-        movl      %eax, %esi                                    #1364.16
-        movl      12(%ebp), %eax                                #1364.16
-        cmpl      %eax, %esi                                    #1364.16
-        jae       ..B15.27      # Prob 12%                      #1364.16
-                                # LOE ebx esi edi
-..B15.25:                       # Preds ..B15.56
-        movsbl    (%esi), %eax                                  #1364.16
-        cmpl      $36, %eax                                     #1364.16
-        je        ..B15.28      # Prob 5%                       #1364.16
-                                # LOE ebx esi edi
-..B15.27:                       # Preds ..B15.22 ..B15.23 ..B15.25 ..B15.30 ..B15.56
-                                #       ..B15.58 ..B15.15 ..B15.19 ..B15.18 ..B15.53
-                                #       ..B15.49 ..B15.51
-        movl      -4(%ebp), %ebx                                #1364.16
-        movl      -12(%ebp), %edi                               #1364.16
-        movl      %esi, %eax                                    #1364.16
-        movl      -8(%ebp), %esi                                #1364.16
-        movl      %ebp, %esp                                    #1364.16
-        popl      %ebp                                          #1364.16
-        ret                                                     #1364.16
-                                # LOE
-..B15.28:                       # Preds ..B15.25                # Infreq
-        pushl     $12                                           #1364.16
-        addl      $1, %esi                                      #1364.16
-        call      malloc at PLT                                    #1364.16
-                                # LOE eax ebx esi edi
-..B15.57:                       # Preds ..B15.28                # Infreq
-        popl      %ecx                                          #1364.16
-                                # LOE eax ebx esi edi
-..B15.29:                       # Preds ..B15.57                # Infreq
-        testl     %eax, %eax                                    #1364.16
-        je        ..B15.31      # Prob 12%                      #1364.16
-                                # LOE eax ebx esi edi
-..B15.30:                       # Preds ..B15.29                # Infreq
-        movl      (%edi), %edx                                  #1364.16
-        movl      $12, (%eax)                                   #1364.16
-        movl      %edx, 8(%eax)                                 #1364.16
-        movl      %eax, (%edi)                                  #1364.16
-        movl      $15, 4(%eax)                                  #1364.16
-        jmp       ..B15.27      # Prob 100%                     #1364.16
-                                # LOE esi
-..B15.31:                       # Preds ..B15.29                # Infreq
-        call      __errno_location at PLT                          #1364.16
-                                # LOE eax esi
-..B15.58:                       # Preds ..B15.31                # Infreq
-        movl      20(%ebp), %ecx                                #1364.16
-        movl      (%eax), %edx                                  #1364.16
-        movl      %edx, (%ecx)                                  #1364.16
-        jmp       ..B15.27      # Prob 100%                     #1364.16
-                                # LOE esi
-..B15.32:                       # Preds ..B15.2                 # Infreq
-        movl      12(%ebp), %eax                                #1374.9
-        addl      $1, %esi                                      #1374.19
-        cmpl      %eax, %esi                                    #1374.9
-        jae       ..B15.38      # Prob 12%                      #1374.9
-                                # LOE ebx esi edi
-..B15.33:                       # Preds ..B15.32                # Infreq
-        call      __ctype_b_loc at PLT                             #1374.9
-                                # LOE eax ebx esi edi
-..B15.59:                       # Preds ..B15.33                # Infreq
-        movzbl    (%esi), %ecx                                  #1374.9
-        movl      (%eax), %edx                                  #1374.9
-        movzwl    (%edx,%ecx,2), %eax                           #1374.9
-        testl     $8192, %eax                                   #1374.9
-        je        ..B15.38      # Prob 15%                      #1374.9
-                                # LOE edx ebx esi edi
-..B15.34:                       # Preds ..B15.59                # Infreq
-        movl      12(%ebp), %eax                                #
-                                # LOE eax edx ebx esi edi
-..B15.35:                       # Preds ..B15.36 ..B15.34       # Infreq
-        addl      $1, %esi                                      #1374.9
-        cmpl      %eax, %esi                                    #1374.9
-        jae       ..B15.38      # Prob 1%                       #1374.9
-                                # LOE eax edx ebx esi edi
-..B15.36:                       # Preds ..B15.35                # Infreq
-        movzbl    (%esi), %ecx                                  #1374.9
-        movzwl    (%edx,%ecx,2), %ecx                           #1374.9
-        testl     $8192, %ecx                                   #1374.9
-        jne       ..B15.35      # Prob 82%                      #1374.9
-                                # LOE eax edx ebx esi edi
-..B15.38:                       # Preds ..B15.35 ..B15.36 ..B15.59 ..B15.32 # Infreq
-        movl      12(%ebp), %eax                                #1375.15
-        cmpl      %eax, %esi                                    #1375.15
-        jne       ..B15.41      # Prob 68%                      #1375.15
-                                # LOE ebx esi edi
-..B15.39:                       # Preds ..B15.38                # Infreq
-        movl      20(%ebp), %eax                                #1376.9
-        movl      $22, (%eax)                                   #1376.9
-                                # LOE esi
-..B15.40:                       # Preds ..B15.61 ..B15.39       # Infreq
-        movl      -4(%ebp), %ebx                                #1393.12
-        movl      -12(%ebp), %edi                               #1393.12
-        movl      %esi, %eax                                    #1375.5
-        movl      -8(%ebp), %esi                                #1393.12
-        movl      %ebp, %esp                                    #1393.12
-        popl      %ebp                                          #1393.12
-        ret                                                     #1393.12
-                                # LOE
-..B15.41:                       # Preds ..B15.38                # Infreq
-        pushl     $12                                           #1379.34
-        call      malloc at PLT                                    #1379.25
-                                # LOE eax ebx esi edi
-..B15.60:                       # Preds ..B15.41                # Infreq
-        popl      %ecx                                          #1379.25
-                                # LOE eax ebx esi edi
-..B15.42:                       # Preds ..B15.60                # Infreq
-        testl     %eax, %eax                                    #1380.19
-        jne       ..B15.43      # Prob 99%                      #1380.19
-                                # LOE eax ebx esi edi
-..B15.44:                       # Preds ..B15.42                # Infreq
-        call      __errno_location at PLT                          #1381.24
-                                # LOE eax esi
-..B15.61:                       # Preds ..B15.44                # Infreq
-        movl      20(%ebp), %ecx                                #1381.13
-        movl      (%eax), %edx                                  #1381.24
-        movl      %edx, (%ecx)                                  #1381.13
-        jmp       ..B15.40      # Prob 100%                     #1381.13
-        .align    2,0x90
-                                # LOE esi
-# mark_end;
-	.type	nss_unary_expr, at function
-	.size	nss_unary_expr,.-nss_unary_expr
-.LNnss_unary_expr:
-	.data
-# -- End  nss_unary_expr
-	.text
-# -- Begin  nss_sob
-# mark_begin;
-       .align    2,0x90
-nss_sob:
-# parameter 1(p): 8 + %ebp
-# parameter 2(end): 12 + %ebp
-..B16.1:                        # Preds ..B16.0
-        pushl     %ebp                                          #1181.1
-        movl      %esp, %ebp                                    #1181.1
-        subl      $12, %esp                                     #1181.1
-        movl      %edi, -4(%ebp)                                #1181.1
-        movl      %esi, -8(%ebp)                                #1181.1
-        movl      %ebx, -12(%ebp)                               #1181.1
-        movl      8(%ebp), %esi                                 #1180.13
-        movl      12(%ebp), %edi                                #1180.13
-        call      ..L16         # Prob 100%                     #1181.1
-..L16:                                                          #
-        popl      %ebx                                          #1181.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L16], %ebx      #1181.1
-        lea       _gprof_pack15 at GOTOFF(%ebx), %edx              #1181.1
-        call      mcount at PLT                                    #1181.1
-                                # LOE ebx esi edi
-..B16.11:                       # Preds ..B16.1
-        cmpl      %edi, %esi                                    #1182.17
-        jae       ..B16.7       # Prob 12%                      #1182.17
-                                # LOE ebx esi edi
-..B16.2:                        # Preds ..B16.11
-        call      __ctype_b_loc at PLT                             #1182.24
-                                # LOE eax esi edi
-..B16.12:                       # Preds ..B16.2
-        movzbl    (%esi), %edx                                  #1182.24
-        movl      (%eax), %ecx                                  #1182.24
-        movzwl    (%ecx,%edx,2), %ebx                           #1182.24
-        testl     $8192, %ebx                                   #1182.24
-        je        ..B16.7       # Prob 15%                      #1182.24
-                                # LOE ecx esi edi
-..B16.3:                        # Preds ..B16.12
-        xorl      %edx, %edx                                    #1182.24
-        movl      %esi, %eax                                    #1182.24
-                                # LOE eax edx ecx esi edi
-..B16.4:                        # Preds ..B16.5 ..B16.3
-        addl      $1, %eax                                      #1182.24
-        addl      $1, %edx                                      #1182.24
-        cmpl      %eax, %edi                                    #1182.17
-        jbe       ..B16.6       # Prob 1%                       #1182.17
-                                # LOE eax edx ecx esi edi
-..B16.5:                        # Preds ..B16.4
-        movzbl    (%esi,%edx), %ebx                             #1182.24
-        movzwl    (%ecx,%ebx,2), %ebx                           #1182.24
-        testl     $8192, %ebx                                   #1182.24
-        jne       ..B16.4       # Prob 82%                      #1182.24
-                                # LOE eax edx ecx esi edi
-..B16.6:                        # Preds ..B16.4 ..B16.5
-        addl      %edx, %esi                                    #1183.12
-                                # LOE esi
-..B16.7:                        # Preds ..B16.12 ..B16.11 ..B16.6
-        movl      -12(%ebp), %ebx                               #1184.12
-        movl      -4(%ebp), %edi                                #1184.12
-        movl      %esi, %eax                                    #1184.12
-        movl      -8(%ebp), %esi                                #1184.12
-        movl      %ebp, %esp                                    #1184.12
-        popl      %ebp                                          #1184.12
-        ret                                                     #1184.12
-        .align    2,0x90
-                                # LOE
-# mark_end;
-	.type	nss_sob, at function
-	.size	nss_sob,.-nss_sob
-.LNnss_sob:
-	.data
-# -- End  nss_sob
-	.text
-# -- Begin  nss_fasta_expr
-# mark_begin;
-       .align    2,0x90
-nss_fasta_expr:
-# parameter 1(p): 8 + %ebp
-# parameter 2(end): 12 + %ebp
-# parameter 3(expr): 16 + %ebp
-# parameter 4(status): 20 + %ebp
-# parameter 5(positional): 24 + %ebp
-..B17.1:                        # Preds ..B17.0
-        pushl     %ebp                                          #1234.1
-        movl      %esp, %ebp                                    #1234.1
-        subl      $16, %esp                                     #1234.1
-        movl      %edi, -4(%ebp)                                #1234.1
-        movl      %esi, -8(%ebp)                                #1234.1
-        movl      %ebx, -12(%ebp)                               #1234.1
-        movl      8(%ebp), %esi                                 #1232.13
-        call      ..L17         # Prob 100%                     #1234.1
-..L17:                                                          #
-        popl      %ebx                                          #1234.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L17], %ebx      #1234.1
-        lea       _gprof_pack16 at GOTOFF(%ebx), %edx              #1234.1
-        call      mcount at PLT                                    #1234.1
-                                # LOE ebx esi
-..B17.77:                       # Preds ..B17.1
-        movsbl    (%esi), %eax                                  #1236.16
-        cmpl      $39, %eax                                     #1236.16
-        jne       ..B17.16      # Prob 67%                      #1236.16
-                                # LOE eax ebx esi
-..B17.2:                        # Preds ..B17.77
-        movl      12(%ebp), %eax                                #1239.13
-        lea       1(%esi), %ecx                                 #1239.30
-        movl      %ecx, %esi                                    #1239.30
-        cmpl      %eax, %ecx                                    #1239.13
-        jae       ..B17.10      # Prob 44%                      #1239.13
-                                # LOE ecx ebx esi
-..B17.4:                        # Preds ..B17.2
-        lea       fasta_2na_map.0 at GOTOFF(%ebx), %edx            #1239.13
-        movl      %ecx, -16(%ebp)                               #
-        xorl      %eax, %eax                                    #
-                                # LOE eax edx ebx esi
-..B17.5:                        # Preds ..B17.7 ..B17.4
-        movsbl    (%esi), %ecx                                  #1239.13
-        testl     %ecx, %ecx                                    #1239.13
-        jl        ..B17.92      # Prob 1%                       #1239.13
-                                # LOE eax edx ebx esi
-..B17.6:                        # Preds ..B17.5
-        movzbl    (%esi), %edi                                  #1239.13
-        movsbl    (%edi,%edx), %ecx                             #1239.13
-        testl     %ecx, %ecx                                    #1239.13
-        jl        ..B17.47      # Prob 16%                      #1239.13
-                                # LOE eax edx ebx esi edi
-..B17.7:                        # Preds ..B17.49 ..B17.6
-        movl      12(%ebp), %ecx                                #1239.13
-        addl      $1, %esi                                      #1239.13
-        cmpl      %ecx, %esi                                    #1239.13
-        jb        ..B17.5       # Prob 82%                      #1239.13
-                                # LOE eax edx ebx esi
-..B17.8:                        # Preds ..B17.7
-        movl      -16(%ebp), %ecx                               #
-                                # LOE eax ecx esi cl ch
-..B17.9:                        # Preds ..B17.92 ..B17.8
-        cmpl      %ecx, %esi                                    #1239.13
-        ja        ..B17.42      # Prob 12%                      #1239.13
-                                # LOE eax ecx esi cl ch
-..B17.10:                       # Preds ..B17.2 ..B17.9
-        movl      $22, %edx                                     #1239.13
-        movl      $22, %eax                                     #
-                                # LOE eax edx esi
-..B17.11:                       # Preds ..B17.10 ..B17.44 ..B17.46
-        testl     %eax, %eax                                    #1240.26
-        jne       ..B17.30      # Prob 50%                      #1240.26
-                                # LOE edx esi
-..B17.12:                       # Preds ..B17.11
-        movl      12(%ebp), %eax                                #1240.38
-        cmpl      %eax, %esi                                    #1240.38
-        je        ..B17.14      # Prob 12%                      #1240.38
-                                # LOE edx esi
-..B17.13:                       # Preds ..B17.12
-        movl      20(%ebp), %eax                                #1241.13
-        movl      %edx, (%eax)                                  #1241.13
-        movsbl    (%esi), %edx                                  #1240.47
-        addl      $1, %esi                                      #1240.47
-        cmpl      $39, %edx                                     #1240.55
-        je        ..B17.31      # Prob 50%                      #1240.55
-                                # LOE esi
-..B17.14:                       # Preds ..B17.13 ..B17.12
-        movl      20(%ebp), %eax                                #1241.13
-        movl      $22, (%eax)                                   #1241.13
-        jmp       ..B17.31      # Prob 100%                     #1241.13
-                                # LOE esi
-..B17.16:                       # Preds ..B17.77
-        cmpl      $34, %eax                                     #1236.16
-        jne       ..B17.32      # Prob 50%                      #1236.16
-                                # LOE ebx esi
-..B17.17:                       # Preds ..B17.16
-        movl      12(%ebp), %eax                                #1244.13
-        lea       1(%esi), %ecx                                 #1244.30
-        movl      %ecx, %esi                                    #1244.30
-        cmpl      %eax, %ecx                                    #1244.13
-        jae       ..B17.25      # Prob 44%                      #1244.13
-                                # LOE ecx ebx esi
-..B17.19:                       # Preds ..B17.17
-        lea       fasta_2na_map.0 at GOTOFF(%ebx), %edx            #1244.13
-        movl      %ecx, -16(%ebp)                               #
-        xorl      %eax, %eax                                    #
-                                # LOE eax edx ebx esi
-..B17.20:                       # Preds ..B17.22 ..B17.19
-        movsbl    (%esi), %ecx                                  #1244.13
-        testl     %ecx, %ecx                                    #1244.13
-        jl        ..B17.91      # Prob 1%                       #1244.13
-                                # LOE eax edx ebx esi
-..B17.21:                       # Preds ..B17.20
-        movzbl    (%esi), %edi                                  #1244.13
-        movsbl    (%edi,%edx), %ecx                             #1244.13
-        testl     %ecx, %ecx                                    #1244.13
-        jl        ..B17.58      # Prob 16%                      #1244.13
-                                # LOE eax edx ebx esi edi
-..B17.22:                       # Preds ..B17.60 ..B17.21
-        movl      12(%ebp), %ecx                                #1244.13
-        addl      $1, %esi                                      #1244.13
-        cmpl      %ecx, %esi                                    #1244.13
-        jb        ..B17.20      # Prob 82%                      #1244.13
-                                # LOE eax edx ebx esi
-..B17.23:                       # Preds ..B17.22
-        movl      -16(%ebp), %ecx                               #
-                                # LOE eax ecx esi cl ch
-..B17.24:                       # Preds ..B17.91 ..B17.23
-        cmpl      %ecx, %esi                                    #1244.13
-        ja        ..B17.53      # Prob 12%                      #1244.13
-                                # LOE eax ecx esi cl ch
-..B17.25:                       # Preds ..B17.17 ..B17.24
-        movl      $22, %edx                                     #1244.13
-        movl      $22, %eax                                     #
-                                # LOE eax edx esi
-..B17.26:                       # Preds ..B17.25 ..B17.55 ..B17.57
-        testl     %eax, %eax                                    #1245.26
-        jne       ..B17.30      # Prob 50%                      #1245.26
-                                # LOE edx esi
-..B17.27:                       # Preds ..B17.26
-        movl      12(%ebp), %eax                                #1245.38
-        cmpl      %eax, %esi                                    #1245.38
-        je        ..B17.29      # Prob 12%                      #1245.38
-                                # LOE edx esi
-..B17.28:                       # Preds ..B17.27
-        movl      20(%ebp), %eax                                #1241.13
-        movl      %edx, (%eax)                                  #1241.13
-        movsbl    (%esi), %edx                                  #1245.47
-        addl      $1, %esi                                      #1245.47
-        cmpl      $34, %edx                                     #1245.55
-        je        ..B17.31      # Prob 50%                      #1245.55
-                                # LOE esi
-..B17.29:                       # Preds ..B17.28 ..B17.27
-        movl      20(%ebp), %eax                                #1246.13
-        movl      $22, (%eax)                                   #1246.13
-        jmp       ..B17.31      # Prob 100%                     #1246.13
-                                # LOE esi
-..B17.30:                       # Preds ..B17.11 ..B17.26
-        movl      20(%ebp), %eax                                #1241.13
-        movl      %edx, (%eax)                                  #1241.13
-                                # LOE esi
-..B17.31:                       # Preds ..B17.13 ..B17.28 ..B17.30 ..B17.14 ..B17.29
-                                #      
-        movl      -12(%ebp), %ebx                               #1252.12
-        movl      -4(%ebp), %edi                                #1252.12
-        movl      %esi, %eax                                    #1252.12
-        movl      -8(%ebp), %esi                                #1252.12
-        movl      %ebp, %esp                                    #1252.12
-        popl      %ebp                                          #1252.12
-        ret                                                     #1252.12
-                                # LOE
-..B17.32:                       # Preds ..B17.16
-        movl      12(%ebp), %eax                                #1249.16
-        movl      %esi, %edi                                    #1234.1
-        cmpl      %eax, %esi                                    #1249.16
-        jae       ..B17.40      # Prob 44%                      #1249.16
-                                # LOE ebx esi edi
-..B17.34:                       # Preds ..B17.32
-        lea       fasta_2na_map.0 at GOTOFF(%ebx), %edx            #1249.16
-        xorl      %eax, %eax                                    #
-                                # LOE eax edx ebx esi edi
-..B17.35:                       # Preds ..B17.37 ..B17.34
-        movsbl    (%edi), %ecx                                  #1249.16
-        testl     %ecx, %ecx                                    #1249.16
-        jl        ..B17.90      # Prob 1%                       #1249.16
-                                # LOE eax edx ebx edi
-..B17.36:                       # Preds ..B17.35
-        movzbl    (%edi), %esi                                  #1249.16
-        movsbl    (%esi,%edx), %ecx                             #1249.16
-        testl     %ecx, %ecx                                    #1249.16
-        jl        ..B17.69      # Prob 16%                      #1249.16
-                                # LOE eax edx ebx esi edi
-..B17.37:                       # Preds ..B17.71 ..B17.36
-        movl      12(%ebp), %ecx                                #1249.16
-        addl      $1, %edi                                      #1249.16
-        cmpl      %ecx, %edi                                    #1249.16
-        jb        ..B17.35      # Prob 82%                      #1249.16
-                                # LOE eax edx ebx edi
-..B17.38:                       # Preds ..B17.37
-        movl      8(%ebp), %esi                                 #
-                                # LOE eax esi edi
-..B17.39:                       # Preds ..B17.90 ..B17.38
-        cmpl      %esi, %edi                                    #1249.16
-        ja        ..B17.64      # Prob 12%                      #1249.16
-                                # LOE eax esi edi
-..B17.40:                       # Preds ..B17.32 ..B17.39
-        movl      20(%ebp), %eax                                #1249.16
-        movl      $22, (%eax)                                   #1249.16
-                                # LOE edi
-..B17.41:                       # Preds ..B17.40 ..B17.66 ..B17.68
-        movl      -12(%ebp), %ebx                               #1249.16
-        movl      -8(%ebp), %esi                                #1249.16
-        movl      %edi, %eax                                    #1249.16
-        movl      -4(%ebp), %edi                                #1249.16
-        movl      %ebp, %esp                                    #1249.16
-        popl      %ebp                                          #1249.16
-        ret                                                     #1249.16
-                                # LOE
-..B17.42:                       # Preds ..B17.9                 # Infreq
-        testl     %eax, %eax                                    #1239.13
-        jne       ..B17.45      # Prob 50%                      #1239.13
-                                # LOE ecx esi cl ch
-..B17.43:                       # Preds ..B17.42                # Infreq
-        movl      24(%ebp), %edx                                #1239.13
-        movl      %esi, %eax                                    #1239.13
-        subl      %ecx, %eax                                    #1239.13
-        pushl     %eax                                          #1239.13
-        pushl     %ecx                                          #1239.13
-        movl      16(%ebp), %ecx                                #1239.13
-        pushl     %edx                                          #1239.13
-        pushl     %ecx                                          #1239.13
-        call      NucStrFastaExprMake2                          #1239.13
-                                # LOE eax esi
-..B17.78:                       # Preds ..B17.43                # Infreq
-        addl      $16, %esp                                     #1239.13
-                                # LOE eax esi
-..B17.44:                       # Preds ..B17.78                # Infreq
-        movl      %eax, %edx                                    #1239.13
-        jmp       ..B17.11      # Prob 100%                     #1239.13
-                                # LOE eax edx esi
-..B17.45:                       # Preds ..B17.42                # Infreq
-        movl      24(%ebp), %edx                                #1239.13
-        movl      %esi, %eax                                    #1239.13
-        subl      %ecx, %eax                                    #1239.13
-        pushl     %eax                                          #1239.13
-        pushl     %ecx                                          #1239.13
-        movl      16(%ebp), %ecx                                #1239.13
-        pushl     %edx                                          #1239.13
-        pushl     %ecx                                          #1239.13
-        call      NucStrFastaExprMake4                          #1239.13
-                                # LOE eax esi
-..B17.79:                       # Preds ..B17.45                # Infreq
-        addl      $16, %esp                                     #1239.13
-                                # LOE eax esi
-..B17.46:                       # Preds ..B17.79                # Infreq
-        movl      %eax, %edx                                    #1239.13
-        jmp       ..B17.11      # Prob 100%                     #1239.13
-                                # LOE eax edx esi
-..B17.47:                       # Preds ..B17.6                 # Infreq
-        lea       fasta_4na_map.0 at GOTOFF(%ebx), %ecx            #1239.13
-        cmpl      %ecx, %edx                                    #1239.13
-        je        ..B17.92      # Prob 1%                       #1239.13
-                                # LOE eax ecx ebx esi edi
-..B17.48:                       # Preds ..B17.47                # Infreq
-        movsbl    (%edi,%ecx), %edx                             #1239.13
-        testl     %edx, %edx                                    #1239.13
-        jl        ..B17.92      # Prob 1%                       #1239.13
-                                # LOE eax ecx ebx esi
-..B17.49:                       # Preds ..B17.48                # Infreq
-        movl      %ecx, %edx                                    #1239.13
-        movl      $1, %eax                                      #
-        jmp       ..B17.7       # Prob 100%                     #
-                                # LOE eax edx ebx esi
-..B17.92:                       # Preds ..B17.47 ..B17.48 ..B17.5 # Infreq
-        movl      -16(%ebp), %ecx                               #
-        jmp       ..B17.9       # Prob 100%                     #
-                                # LOE eax ecx esi cl ch
-..B17.53:                       # Preds ..B17.24                # Infreq
-        testl     %eax, %eax                                    #1244.13
-        jne       ..B17.56      # Prob 50%                      #1244.13
-                                # LOE ecx esi cl ch
-..B17.54:                       # Preds ..B17.53                # Infreq
-        movl      24(%ebp), %edx                                #1244.13
-        movl      %esi, %eax                                    #1244.13
-        subl      %ecx, %eax                                    #1244.13
-        pushl     %eax                                          #1244.13
-        pushl     %ecx                                          #1244.13
-        movl      16(%ebp), %ecx                                #1244.13
-        pushl     %edx                                          #1244.13
-        pushl     %ecx                                          #1244.13
-        call      NucStrFastaExprMake2                          #1244.13
-                                # LOE eax esi
-..B17.80:                       # Preds ..B17.54                # Infreq
-        addl      $16, %esp                                     #1244.13
-                                # LOE eax esi
-..B17.55:                       # Preds ..B17.80                # Infreq
-        movl      %eax, %edx                                    #1244.13
-        jmp       ..B17.26      # Prob 100%                     #1244.13
-                                # LOE eax edx esi
-..B17.56:                       # Preds ..B17.53                # Infreq
-        movl      24(%ebp), %edx                                #1244.13
-        movl      %esi, %eax                                    #1244.13
-        subl      %ecx, %eax                                    #1244.13
-        pushl     %eax                                          #1244.13
-        pushl     %ecx                                          #1244.13
-        movl      16(%ebp), %ecx                                #1244.13
-        pushl     %edx                                          #1244.13
-        pushl     %ecx                                          #1244.13
-        call      NucStrFastaExprMake4                          #1244.13
-                                # LOE eax esi
-..B17.81:                       # Preds ..B17.56                # Infreq
-        addl      $16, %esp                                     #1244.13
-                                # LOE eax esi
-..B17.57:                       # Preds ..B17.81                # Infreq
-        movl      %eax, %edx                                    #1244.13
-        jmp       ..B17.26      # Prob 100%                     #1244.13
-                                # LOE eax edx esi
-..B17.58:                       # Preds ..B17.21                # Infreq
-        lea       fasta_4na_map.0 at GOTOFF(%ebx), %ecx            #1244.13
-        cmpl      %ecx, %edx                                    #1244.13
-        je        ..B17.91      # Prob 1%                       #1244.13
-                                # LOE eax ecx ebx esi edi
-..B17.59:                       # Preds ..B17.58                # Infreq
-        movsbl    (%edi,%ecx), %edx                             #1244.13
-        testl     %edx, %edx                                    #1244.13
-        jl        ..B17.91      # Prob 1%                       #1244.13
-                                # LOE eax ecx ebx esi
-..B17.60:                       # Preds ..B17.59                # Infreq
-        movl      %ecx, %edx                                    #1244.13
-        movl      $1, %eax                                      #
-        jmp       ..B17.22      # Prob 100%                     #
-                                # LOE eax edx ebx esi
-..B17.91:                       # Preds ..B17.58 ..B17.59 ..B17.20 # Infreq
-        movl      -16(%ebp), %ecx                               #
-        jmp       ..B17.24      # Prob 100%                     #
-                                # LOE eax ecx esi cl ch
-..B17.64:                       # Preds ..B17.39                # Infreq
-        testl     %eax, %eax                                    #1249.16
-        jne       ..B17.67      # Prob 50%                      #1249.16
-                                # LOE esi edi
-..B17.65:                       # Preds ..B17.64                # Infreq
-        movl      24(%ebp), %edx                                #1249.16
-        movl      16(%ebp), %ecx                                #1249.16
-        movl      %edi, %eax                                    #1249.16
-        subl      %esi, %eax                                    #1249.16
-        pushl     %eax                                          #1249.16
-        pushl     %esi                                          #1249.16
-        pushl     %edx                                          #1249.16
-        pushl     %ecx                                          #1249.16
-        call      NucStrFastaExprMake2                          #1249.16
-                                # LOE eax edi
-..B17.82:                       # Preds ..B17.65                # Infreq
-        addl      $16, %esp                                     #1249.16
-                                # LOE eax edi
-..B17.66:                       # Preds ..B17.82                # Infreq
-        movl      20(%ebp), %edx                                #1249.16
-        movl      %eax, (%edx)                                  #1249.16
-        jmp       ..B17.41      # Prob 100%                     #1249.16
-                                # LOE edi
-..B17.67:                       # Preds ..B17.64                # Infreq
-        movl      24(%ebp), %edx                                #1249.16
-        movl      16(%ebp), %ecx                                #1249.16
-        movl      %edi, %eax                                    #1249.16
-        subl      %esi, %eax                                    #1249.16
-        pushl     %eax                                          #1249.16
-        pushl     %esi                                          #1249.16
-        pushl     %edx                                          #1249.16
-        pushl     %ecx                                          #1249.16
-        call      NucStrFastaExprMake4                          #1249.16
-                                # LOE eax edi
-..B17.83:                       # Preds ..B17.67                # Infreq
-        addl      $16, %esp                                     #1249.16
-                                # LOE eax edi
-..B17.68:                       # Preds ..B17.83                # Infreq
-        movl      20(%ebp), %edx                                #1249.16
-        movl      %eax, (%edx)                                  #1249.16
-        jmp       ..B17.41      # Prob 100%                     #1249.16
-                                # LOE edi
-..B17.69:                       # Preds ..B17.36                # Infreq
-        lea       fasta_4na_map.0 at GOTOFF(%ebx), %ecx            #1249.16
-        cmpl      %ecx, %edx                                    #1249.16
-        je        ..B17.90      # Prob 1%                       #1249.16
-                                # LOE eax ecx ebx esi edi
-..B17.70:                       # Preds ..B17.69                # Infreq
-        movsbl    (%ecx,%esi), %edx                             #1249.16
-        testl     %edx, %edx                                    #1249.16
-        jl        ..B17.90      # Prob 1%                       #1249.16
-                                # LOE eax ecx ebx edi
-..B17.71:                       # Preds ..B17.70                # Infreq
-        movl      %ecx, %edx                                    #1249.16
-        movl      $1, %eax                                      #
-        jmp       ..B17.37      # Prob 100%                     #
-                                # LOE eax edx ebx edi
-..B17.90:                       # Preds ..B17.69 ..B17.70 ..B17.35 # Infreq
-        movl      8(%ebp), %esi                                 #
-        jmp       ..B17.39      # Prob 100%                     #
-        .align    2,0x90
-                                # LOE eax esi edi
-# mark_end;
-	.type	nss_fasta_expr, at function
-	.size	nss_fasta_expr,.-nss_fasta_expr
-.LNnss_fasta_expr:
-	.data
-# -- End  nss_fasta_expr
-	.text
-# -- Begin  NucStrFastaExprMake4
-# mark_begin;
-       .align    2,0x90
-NucStrFastaExprMake4:
-# parameter 1(expr): 8 + %ebx
-# parameter 2(positional): 12 + %ebx
-# parameter 3(fasta): 16 + %ebx
-# parameter 4(size): 20 + %ebx
-..B18.1:                        # Preds ..B18.0
-        pushl     %ebx                                          #1017.1
-        movl      %esp, %ebx                                    #1017.1
-        andl      $-16, %esp                                    #1017.1
-        pushl     %ebp                                          #1017.1
-        pushl     %ebp                                          #1017.1
-        movl      4(%ebx), %ebp                                 #1017.1
-        movl      %ebp, 4(%esp)                                 #1017.1
-        movl      %esp, %ebp                                    #1017.1
-        subl      $72, %esp                                     #1017.1
-        movl      %ebx, -72(%ebp)                               #1017.1
-        movl      %edi, -44(%ebp)                               #1017.1
-        movl      %esi, -48(%ebp)                               #1017.1
-        call      ..L18         # Prob 100%                     #1017.1
-..L18:                                                          #
-        popl      %edi                                          #1017.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L18], %edi      #1017.1
-        lea       _gprof_pack17 at GOTOFF(%edi), %edx              #1017.1
-        movl      %edi, %ebx                                    #1017.1
-        call      mcount at PLT                                    #1017.1
-        movl      -72(%ebp), %ebx                               #1017.1
-                                # LOE edi
-..B18.46:                       # Preds ..B18.1
-        movl      20(%ebx), %eax                                #1023.17
-        cmpl      $29, %eax                                     #1023.17
-        jbe       ..B18.3       # Prob 43%                      #1023.17
-                                # LOE edi
-..B18.2:                        # Preds ..B18.46
-        movl      -48(%ebp), %esi                               #1024.16
-        movl      -44(%ebp), %edi                               #1024.16
-        movl      $7, %eax                                      #1024.16
-        movl      %ebp, %esp                                    #1024.16
-        popl      %ebp                                          #1024.16
-        movl      %ebx, %esp                                    #1024.16
-        popl      %ebx                                          #1024.16
-        ret                                                     #1024.16
-                                # LOE
-..B18.3:                        # Preds ..B18.46
-        pushl     $160                                          #1026.32
-        movl      %edi, %ebx                                    #1026.9
-        call      malloc at PLT                                    #1026.9
-        movl      -72(%ebp), %ebx                               #1026.9
-                                # LOE eax edi
-..B18.47:                       # Preds ..B18.3
-        addl      $4, %esp                                      #1026.9
-                                # LOE eax edi
-..B18.4:                        # Preds ..B18.47
-        testl     %eax, %eax                                    #1026.9
-        je        ..B18.43      # Prob 12%                      #1026.9
-                                # LOE eax edi
-..B18.5:                        # Preds ..B18.4
-        lea       15(%eax), %esi                                #1026.9
-        andl      $-16, %esi                                    #1026.9
-        movl      %eax, 8(%esi)                                 #1026.9
-        je        ..B18.43      # Prob 5%                       #1027.15
-                                # LOE esi edi
-..B18.6:                        # Preds ..B18.5
-        movl      8(%ebx), %eax                                 #1030.5
-        movl      20(%ebx), %edx                                #1031.5
-        movl      %esi, (%eax)                                  #1030.5
-        movl      %edx, 4(%esi)                                 #1031.5
-        testl     %edx, %edx                                    #1035.22
-        jbe       ..B18.42      # Prob 16%                      #1035.22
-                                # LOE esi edi
-..B18.7:                        # Preds ..B18.6
-        movl      16(%ebx), %ecx                                #
-        movl      %esi, -60(%ebp)                               #
-        xorl      %eax, %eax                                    #
-                                # LOE eax ecx edi
-..B18.8:                        # Preds ..B18.15 ..B18.7
-        movsbl    (%ecx,%eax), %edx                             #1037.49
-        movsbl    fasta_4na_map.0 at GOTOFF(%edi,%edx), %edx       #1037.25
-        movl      %eax, %esi                                    #1038.22
-        andl      $3, %esi                                      #1038.22
-        je        ..B18.41      # Prob 20%                      #1038.22
-                                # LOE eax edx ecx esi edi
-..B18.9:                        # Preds ..B18.8
-        cmpl      $1, %esi                                      #1038.22
-        je        ..B18.14      # Prob 25%                      #1038.22
-                                # LOE eax edx ecx esi edi
-..B18.10:                       # Preds ..B18.9
-        cmpl      $2, %esi                                      #1038.22
-        jne       ..B18.12      # Prob 67%                      #1038.22
-                                # LOE eax edx ecx esi edi
-..B18.11:                       # Preds ..B18.10
-        movl      %eax, %esi                                    #1049.32
-        shrl      $2, %esi                                      #1049.32
-        shll      $12, %edx                                     #1049.47
-        orw       %dx, -40(%ebp,%esi,2)                         #1049.13
-        movzwl    -24(%ebp,%esi,2), %edx                        #1050.13
-        orl       $-4096, %edx                                  #1050.13
-        movw      %dx, -24(%ebp,%esi,2)                         #1050.13
-        jmp       ..B18.15      # Prob 100%                     #1050.13
-                                # LOE eax ecx edi
-..B18.12:                       # Preds ..B18.10
-        cmpl      $3, %esi                                      #1038.22
-        jne       ..B18.15      # Prob 50%                      #1038.22
-                                # LOE eax edx ecx edi
-..B18.13:                       # Preds ..B18.12
-        movl      %eax, %esi                                    #1053.32
-        shrl      $2, %esi                                      #1053.32
-        shll      $8, %edx                                      #1053.47
-        orw       %dx, -40(%ebp,%esi,2)                         #1053.13
-        movzwl    -24(%ebp,%esi,2), %edx                        #1054.13
-        orl       $-61696, %edx                                 #1054.13
-        movw      %dx, -24(%ebp,%esi,2)                         #1054.13
-        jmp       ..B18.15      # Prob 100%                     #1054.13
-                                # LOE eax ecx edi
-..B18.14:                       # Preds ..B18.9
-        movl      %eax, %esi                                    #1045.32
-        shrl      $2, %esi                                      #1045.32
-        orw       %dx, -40(%ebp,%esi,2)                         #1045.13
-        movzwl    -24(%ebp,%esi,2), %edx                        #1046.13
-        orl       $15, %edx                                     #1046.13
-        movw      %dx, -24(%ebp,%esi,2)                         #1046.13
-                                # LOE eax ecx edi
-..B18.15:                       # Preds ..B18.41 ..B18.14 ..B18.11 ..B18.13 ..B18.12
-                                #      
-        movl      20(%ebx), %edx                                #1035.22
-        addl      $1, %eax                                      #1035.31
-        cmpl      %edx, %eax                                    #1035.22
-        jb        ..B18.8       # Prob 82%                      #1035.22
-                                # LOE eax ecx edi
-..B18.16:                       # Preds ..B18.15
-        movl      -60(%ebp), %esi                               #
-                                # LOE eax esi
-..B18.17:                       # Preds ..B18.16 ..B18.42
-        addl      $3, %eax                                      #1060.21
-        shrl      $2, %eax                                      #1060.28
-        cmpl      $8, %eax                                      #1060.35
-        jae       ..B18.30      # Prob 50%                      #1060.35
-                                # LOE eax esi
-..B18.18:                       # Preds ..B18.17
-        lea       -40(%ebp,%eax,2), %ecx                        #1060.5
-        movl      %eax, %edi                                    #1060.5
-        negl      %edi                                          #1060.5
-        addl      $8, %edi                                      #1060.5
-        lea       (%eax,%eax), %edx                             #
-        andl      $15, %ecx                                     #1060.5
-        movl      %edx, -56(%ebp)                               #
-        movl      %ecx, %edx                                    #1060.5
-        negl      %edx                                          #1060.5
-        addl      $16, %edx                                     #1060.5
-        shrl      $1, %edx                                      #1060.5
-        cmpl      $0, %ecx                                      #1060.5
-        cmovne    %edx, %ecx                                    #1060.5
-        movl      %ecx, -52(%ebp)                               #1060.5
-        lea       8(%ecx), %edx                                 #1060.5
-        cmpl      %edx, %edi                                    #1060.5
-        jb        ..B18.40      # Prob 10%                      #1060.5
-                                # LOE eax ecx esi edi cl ch
-..B18.19:                       # Preds ..B18.18
-        movl      %edi, %edx                                    #1060.5
-        subl      %ecx, %edx                                    #1060.5
-        andl      $7, %edx                                      #1060.5
-        negl      %edx                                          #1060.5
-        addl      %edi, %edx                                    #1060.5
-        testl     %ecx, %ecx                                    #1060.5
-        jbe       ..B18.23      # Prob 1%                       #1060.5
-                                # LOE eax edx ecx esi edi cl ch
-..B18.20:                       # Preds ..B18.19
-        movl      %edi, -68(%ebp)                               #
-        movl      %ecx, %edi                                    #
-        movl      %eax, -64(%ebp)                               #
-        xorl      %ecx, %ecx                                    #
-        movl      %esi, -60(%ebp)                               #
-        movl      -56(%ebp), %esi                               #
-                                # LOE edx ecx esi edi
-..B18.21:                       # Preds ..B18.21 ..B18.20
-        xorl      %eax, %eax                                    #1062.9
-        movw      %ax, -40(%ebp,%esi)                           #1062.9
-        addl      $1, %ecx                                      #1060.5
-        movw      %ax, -24(%ebp,%esi)                           #1063.9
-        addl      $2, %esi                                      #1060.5
-        cmpl      %edi, %ecx                                    #1060.5
-        jb        ..B18.21      # Prob 99%                      #1060.5
-                                # LOE edx ecx esi edi
-..B18.22:                       # Preds ..B18.21
-        movl      -64(%ebp), %eax                               #
-        movl      -60(%ebp), %esi                               #
-        movl      %edi, -52(%ebp)                               #
-        movl      -68(%ebp), %edi                               #
-                                # LOE eax edx esi edi
-..B18.23:                       # Preds ..B18.22 ..B18.19
-        movl      -52(%ebp), %ecx                               #1062.29
-        movl      %esi, -60(%ebp)                               #1062.29
-        movl      %ecx, %esi                                    #1062.29
-        lea       (%ecx,%ecx), %ecx                             #1062.29
-        pxor      %xmm0, %xmm0                                  #1062.29
-        lea       (%ecx,%eax,2), %ecx                           #1062.29
-                                # LOE eax edx ecx esi edi xmm0
-..B18.24:                       # Preds ..B18.24 ..B18.23
-        movdqa    %xmm0, -40(%ebp,%ecx)                         #1062.9
-        movdqa    %xmm0, -24(%ebp,%ecx)                         #1063.9
-        addl      $16, %ecx                                     #1060.5
-        addl      $8, %esi                                      #1060.5
-        cmpl      %edx, %esi                                    #1060.5
-        jb        ..B18.24      # Prob 99%                      #1060.5
-                                # LOE eax edx ecx esi edi xmm0
-..B18.25:                       # Preds ..B18.24
-        movl      -60(%ebp), %esi                               #
-                                # LOE eax edx esi edi
-..B18.26:                       # Preds ..B18.25 ..B18.40
-        cmpl      %edi, %edx                                    #1060.5
-        jae       ..B18.30      # Prob 1%                       #1060.5
-                                # LOE eax edx esi edi
-..B18.27:                       # Preds ..B18.26
-        lea       (%edx,%edx), %ecx                             #
-        lea       (%ecx,%eax,2), %eax                           #
-                                # LOE eax edx esi edi
-..B18.28:                       # Preds ..B18.28 ..B18.27
-        xorl      %ecx, %ecx                                    #1062.9
-        movw      %cx, -40(%ebp,%eax)                           #1062.9
-        addl      $1, %edx                                      #1060.5
-        movw      %cx, -24(%ebp,%eax)                           #1063.9
-        addl      $2, %eax                                      #1060.5
-        cmpl      %edi, %edx                                    #1060.5
-        jb        ..B18.28      # Prob 99%                      #1060.5
-                                # LOE eax edx esi edi
-..B18.30:                       # Preds ..B18.28 ..B18.26 ..B18.17
-        movl      12(%ebx), %eax                                #1068.10
-        testl     %eax, %eax                                    #1068.10
-        je        ..B18.32      # Prob 50%                      #1068.10
-                                # LOE esi
-..B18.31:                       # Preds ..B18.30
-        movl      $10, (%esi)                                   #1070.9
-        jmp       ..B18.39      # Prob 100%                     #1070.9
-                                # LOE esi
-..B18.32:                       # Preds ..B18.30
-        movl      20(%ebx), %eax                                #1072.22
-        cmpl      $2, %eax                                      #1072.22
-        jae       ..B18.34      # Prob 50%                      #1072.22
-                                # LOE esi
-..B18.33:                       # Preds ..B18.32
-        movzwl    -40(%ebp), %eax                               #1074.29
-        movl      $6, (%esi)                                    #1082.9
-        movw      %ax, -38(%ebp)                                #1074.9
-        movl      -40(%ebp), %edi                               #1075.29
-        movzwl    -24(%ebp), %eax                               #1078.26
-        movl      %edi, -36(%ebp)                               #1075.9
-        movl      -40(%ebp), %edx                               #1076.29
-        movl      %edx, -32(%ebp)                               #1076.9
-        movl      %edi, -28(%ebp)                               #1076.9
-        movw      %ax, -22(%ebp)                                #1078.9
-        movl      -24(%ebp), %edx                               #1079.26
-        movl      %edx, -20(%ebp)                               #1079.9
-        movl      -24(%ebp), %eax                               #1080.26
-        movl      %eax, -16(%ebp)                               #1080.9
-        movl      %edx, -12(%ebp)                               #1080.9
-        jmp       ..B18.39      # Prob 100%                     #1080.9
-                                # LOE esi
-..B18.34:                       # Preds ..B18.32
-        movl      20(%ebx), %eax                                #1084.22
-        cmpl      $6, %eax                                      #1084.22
-        jae       ..B18.36      # Prob 50%                      #1084.22
-                                # LOE esi
-..B18.35:                       # Preds ..B18.34
-        movl      -40(%ebp), %edx                               #1086.29
-        movl      $7, (%esi)                                    #1092.9
-        movl      %edx, -36(%ebp)                               #1086.9
-        movl      -40(%ebp), %eax                               #1087.29
-        movl      %eax, -32(%ebp)                               #1087.9
-        movl      -24(%ebp), %eax                               #1089.26
-        movl      %edx, -28(%ebp)                               #1087.9
-        movl      %eax, -20(%ebp)                               #1089.9
-        movl      -24(%ebp), %edi                               #1090.26
-        movl      %edi, -16(%ebp)                               #1090.9
-        movl      %eax, -12(%ebp)                               #1090.9
-        jmp       ..B18.39      # Prob 100%                     #1090.9
-                                # LOE esi
-..B18.36:                       # Preds ..B18.34
-        movl      20(%ebx), %eax                                #1094.22
-        cmpl      $14, %eax                                     #1094.22
-        jae       ..B18.38      # Prob 50%                      #1094.22
-                                # LOE esi
-..B18.37:                       # Preds ..B18.36
-        movl      -40(%ebp), %eax                               #1096.29
-        movl      -36(%ebp), %edx                               #1096.29
-        movl      -24(%ebp), %edi                               #1097.26
-        movl      %eax, -32(%ebp)                               #1096.9
-        movl      -20(%ebp), %eax                               #1097.26
-        movl      $1, (%esi)                                    #1099.9
-        movl      %edx, -28(%ebp)                               #1096.9
-        movl      %edi, -16(%ebp)                               #1097.9
-        movl      %eax, -12(%ebp)                               #1097.9
-        jmp       ..B18.39      # Prob 100%                     #1097.9
-                                # LOE esi
-..B18.38:                       # Preds ..B18.36
-        movl      $8, (%esi)                                    #1103.9
-                                # LOE esi
-..B18.39:                       # Preds ..B18.31 ..B18.33 ..B18.35 ..B18.37 ..B18.38
-                                #      
-        movl      -40(%ebp), %eax                               #1106.42
-        movl      -36(%ebp), %edi                               #1106.42
-        lea       -40(%ebp), %ecx                               #1110.5
-        movl      %eax, 16(%esi)                                #1106.42
-        movl      -32(%ebp), %eax                               #1106.42
-        movl      %edi, 20(%esi)                                #1106.42
-        movl      %eax, 24(%esi)                                #1106.42
-        movl      -28(%ebp), %eax                               #1106.42
-        movl      %eax, 28(%esi)                                #1106.42
-        movl      -24(%ebp), %eax                               #1107.39
-        movl      %eax, 32(%esi)                                #1107.39
-        movl      -20(%ebp), %eax                               #1107.39
-        movl      %eax, 36(%esi)                                #1107.39
-        movl      -16(%ebp), %eax                               #1107.39
-        movl      %eax, 40(%esi)                                #1107.39
-        movl      -12(%ebp), %eax                               #1107.39
-        movl      %eax, 44(%esi)                                #1107.39
-# Begin ASM
-        mov (%ecx), %eax;mov 12(%ecx), %edx;bswap %eax;bswap %edx;mov %eax, 12(%ecx);mov %edx, (%ecx);mov 4(%ecx), %eax;mov 8(%ecx), %edx;bswap %eax;bswap %edx;mov %eax, 8(%ecx);mov %edx, 4(%ecx);
-# End ASM                                                       #1110.5
-        lea       -24(%ebp), %ecx                               #1111.5
-# Begin ASM
-        mov (%ecx), %eax;mov 12(%ecx), %edx;bswap %eax;bswap %edx;mov %eax, 12(%ecx);mov %edx, (%ecx);mov 4(%ecx), %eax;mov 8(%ecx), %edx;bswap %eax;bswap %edx;mov %eax, 8(%ecx);mov %edx, 4(%ecx);
-# End ASM                                                       #1111.5
-        movl      $4, %ecx                                      #1114.5
-        lea       -40(%ebp), %edx                               #1114.5
-# Begin ASM
-        mov 4(%edx), %eax;shrd %cl, %eax, (%edx);mov 8(%edx), %eax;shrd %cl, %eax, 4(%edx);mov 12(%edx), %eax;shrd %cl, %eax, 8(%edx);shr %cl, %eax;mov %eax, 12(%edx);
-# End ASM                                                       #1114.5
-        lea       -24(%ebp), %edx                               #1115.5
-# Begin ASM
-        mov 4(%edx), %eax;shrd %cl, %eax, (%edx);mov 8(%edx), %eax;shrd %cl, %eax, 4(%edx);mov 12(%edx), %eax;shrd %cl, %eax, 8(%edx);shr %cl, %eax;mov %eax, 12(%edx);
-# End ASM                                                       #1115.5
-        lea       48(%esi), %ecx                                #1118.5
-        lea       -40(%ebp), %edx                               #1118.5
-# Begin ASM
-        push %ebx;mov (%edx), %eax;mov 12(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 12(%ecx);mov %ebx, (%ecx);mov 4(%edx), %eax;mov 8(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 8(%ecx);mov %ebx, 4(%ecx);pop %ebx;
-# End ASM                                                       #1118.5
-        lea       64(%esi), %ecx                                #1119.5
-        lea       -24(%ebp), %edx                               #1119.5
-# Begin ASM
-        push %ebx;mov (%edx), %eax;mov 12(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 12(%ecx);mov %ebx, (%ecx);mov 4(%edx), %eax;mov 8(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 8(%ecx);mov %ebx, 4(%ecx);pop %ebx;
-# End ASM                                                       #1119.5
-        movl      $4, %ecx                                      #1121.5
-        lea       -40(%ebp), %edx                               #1121.5
-# Begin ASM
-        mov 4(%edx), %eax;shrd %cl, %eax, (%edx);mov 8(%edx), %eax;shrd %cl, %eax, 4(%edx);mov 12(%edx), %eax;shrd %cl, %eax, 8(%edx);shr %cl, %eax;mov %eax, 12(%edx);
-# End ASM                                                       #1121.5
-        lea       -24(%ebp), %edx                               #1122.5
-# Begin ASM
-        mov 4(%edx), %eax;shrd %cl, %eax, (%edx);mov 8(%edx), %eax;shrd %cl, %eax, 4(%edx);mov 12(%edx), %eax;shrd %cl, %eax, 8(%edx);shr %cl, %eax;mov %eax, 12(%edx);
-# End ASM                                                       #1122.5
-        lea       80(%esi), %ecx                                #1124.5
-        lea       -40(%ebp), %edx                               #1124.5
-# Begin ASM
-        push %ebx;mov (%edx), %eax;mov 12(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 12(%ecx);mov %ebx, (%ecx);mov 4(%edx), %eax;mov 8(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 8(%ecx);mov %ebx, 4(%ecx);pop %ebx;
-# End ASM                                                       #1124.5
-        lea       96(%esi), %ecx                                #1125.5
-        lea       -24(%ebp), %edx                               #1125.5
-# Begin ASM
-        push %ebx;mov (%edx), %eax;mov 12(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 12(%ecx);mov %ebx, (%ecx);mov 4(%edx), %eax;mov 8(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 8(%ecx);mov %ebx, 4(%ecx);pop %ebx;
-# End ASM                                                       #1125.5
-        movl      $4, %ecx                                      #1127.5
-        lea       -40(%ebp), %edx                               #1127.5
-# Begin ASM
-        mov 4(%edx), %eax;shrd %cl, %eax, (%edx);mov 8(%edx), %eax;shrd %cl, %eax, 4(%edx);mov 12(%edx), %eax;shrd %cl, %eax, 8(%edx);shr %cl, %eax;mov %eax, 12(%edx);
-# End ASM                                                       #1127.5
-        lea       -24(%ebp), %edx                               #1128.5
-# Begin ASM
-        mov 4(%edx), %eax;shrd %cl, %eax, (%edx);mov 8(%edx), %eax;shrd %cl, %eax, 4(%edx);mov 12(%edx), %eax;shrd %cl, %eax, 8(%edx);shr %cl, %eax;mov %eax, 12(%edx);
-# End ASM                                                       #1128.5
-        lea       112(%esi), %ecx                               #1130.5
-        lea       -40(%ebp), %edx                               #1130.5
-# Begin ASM
-        push %ebx;mov (%edx), %eax;mov 12(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 12(%ecx);mov %ebx, (%ecx);mov 4(%edx), %eax;mov 8(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 8(%ecx);mov %ebx, 4(%ecx);pop %ebx;
-# End ASM                                                       #1130.5
-        addl      $128, %esi                                    #1131.5
-        movl      %esi, %ecx                                    #1131.5
-        lea       -24(%ebp), %edx                               #1131.5
-# Begin ASM
-        push %ebx;mov (%edx), %eax;mov 12(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 12(%ecx);mov %ebx, (%ecx);mov 4(%edx), %eax;mov 8(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 8(%ecx);mov %ebx, 4(%ecx);pop %ebx;
-# End ASM                                                       #1131.5
-        xorl      %eax, %eax                                    #1173.12
-        movl      -48(%ebp), %esi                               #1173.12
-        movl      -44(%ebp), %edi                               #1173.12
-        movl      %ebp, %esp                                    #1173.12
-        popl      %ebp                                          #1173.12
-        movl      %ebx, %esp                                    #1173.12
-        popl      %ebx                                          #1173.12
-        ret                                                     #1173.12
-                                # LOE
-..B18.40:                       # Preds ..B18.18                # Infreq
-        xorl      %edx, %edx                                    #1060.5
-        jmp       ..B18.26      # Prob 100%                     #1060.5
-                                # LOE eax edx esi edi
-..B18.41:                       # Preds ..B18.8                 # Infreq
-        movl      %eax, %esi                                    #1041.32
-        shrl      $2, %esi                                      #1041.32
-        shll      $4, %edx                                      #1041.46
-        movw      %dx, -40(%ebp,%esi,2)                         #1041.13
-        movl      $240, %edx                                    #1042.13
-        movw      %dx, -24(%ebp,%esi,2)                         #1042.13
-        jmp       ..B18.15      # Prob 100%                     #1042.13
-                                # LOE eax ecx edi
-..B18.42:                       # Preds ..B18.6                 # Infreq
-        xorl      %eax, %eax                                    #
-        jmp       ..B18.17      # Prob 100%                     #
-                                # LOE eax esi
-..B18.43:                       # Preds ..B18.4 ..B18.5         # Infreq
-        movl      %edi, %ebx                                    #1028.16
-        call      __errno_location at PLT                          #1028.16
-        movl      -72(%ebp), %ebx                               #1028.16
-                                # LOE eax
-..B18.48:                       # Preds ..B18.43                # Infreq
-        movl      -48(%ebp), %esi                               #1028.16
-        movl      -44(%ebp), %edi                               #1028.16
-        movl      (%eax), %eax                                  #1028.16
-        movl      %ebp, %esp                                    #1028.16
-        popl      %ebp                                          #1028.16
-        movl      %ebx, %esp                                    #1028.16
-        popl      %ebx                                          #1028.16
-        ret                                                     #1028.16
-        .align    2,0x90
-                                # LOE
-# mark_end;
-	.type	NucStrFastaExprMake4, at function
-	.size	NucStrFastaExprMake4,.-NucStrFastaExprMake4
-.LNNucStrFastaExprMake4:
-	.data
-# -- End  NucStrFastaExprMake4
-	.text
-# -- Begin  NucStrFastaExprMake2
-# mark_begin;
-       .align    2,0x90
-NucStrFastaExprMake2:
-# parameter 1(expr): 8 + %ebx
-# parameter 2(positional): 12 + %ebx
-# parameter 3(fasta): 16 + %ebx
-# parameter 4(size): 20 + %ebx
-..B19.1:                        # Preds ..B19.0
-        pushl     %ebx                                          #838.1
-        movl      %esp, %ebx                                    #838.1
-        andl      $-16, %esp                                    #838.1
-        pushl     %ebp                                          #838.1
-        pushl     %ebp                                          #838.1
-        movl      4(%ebx), %ebp                                 #838.1
-        movl      %ebp, 4(%esp)                                 #838.1
-        movl      %esp, %ebp                                    #838.1
-        subl      $72, %esp                                     #838.1
-        movl      %ebx, -72(%ebp)                               #838.1
-        movl      %edi, -48(%ebp)                               #838.1
-        movl      %esi, -52(%ebp)                               #838.1
-        call      ..L19         # Prob 100%                     #838.1
-..L19:                                                          #
-        popl      %edi                                          #838.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L19], %edi      #838.1
-        lea       _gprof_pack18 at GOTOFF(%edi), %edx              #838.1
-        movl      %edi, %ebx                                    #838.1
-        call      mcount at PLT                                    #838.1
-        movl      -72(%ebp), %ebx                               #838.1
-                                # LOE edi
-..B19.48:                       # Preds ..B19.1
-        movl      20(%ebx), %eax                                #844.17
-        cmpl      $61, %eax                                     #844.17
-        jbe       ..B19.3       # Prob 43%                      #844.17
-                                # LOE edi
-..B19.2:                        # Preds ..B19.48
-        movl      -52(%ebp), %esi                               #845.16
-        movl      -48(%ebp), %edi                               #845.16
-        movl      $7, %eax                                      #845.16
-        movl      %ebp, %esp                                    #845.16
-        popl      %ebp                                          #845.16
-        movl      %ebx, %esp                                    #845.16
-        popl      %ebx                                          #845.16
-        ret                                                     #845.16
-                                # LOE
-..B19.3:                        # Preds ..B19.48
-        pushl     $160                                          #847.32
-        movl      %edi, %ebx                                    #847.9
-        call      malloc at PLT                                    #847.9
-        movl      -72(%ebp), %ebx                               #847.9
-                                # LOE eax edi
-..B19.49:                       # Preds ..B19.3
-        addl      $4, %esp                                      #847.9
-                                # LOE eax edi
-..B19.4:                        # Preds ..B19.49
-        testl     %eax, %eax                                    #847.9
-        je        ..B19.45      # Prob 12%                      #847.9
-                                # LOE eax edi
-..B19.5:                        # Preds ..B19.4
-        lea       15(%eax), %esi                                #847.9
-        andl      $-16, %esi                                    #847.9
-        movl      %eax, 8(%esi)                                 #847.9
-        je        ..B19.45      # Prob 5%                       #848.15
-                                # LOE esi edi
-..B19.6:                        # Preds ..B19.5
-        movl      8(%ebx), %eax                                 #851.5
-        movl      20(%ebx), %edx                                #852.5
-        movl      %esi, (%eax)                                  #851.5
-        movl      %edx, 4(%esi)                                 #852.5
-        testl     %edx, %edx                                    #856.22
-        jbe       ..B19.44      # Prob 16%                      #856.22
-                                # LOE esi edi
-..B19.7:                        # Preds ..B19.6
-        movl      16(%ebx), %edx                                #
-        movl      %esi, -60(%ebp)                               #
-        movl      %edi, -44(%ebp)                               #
-        xorl      %eax, %eax                                    #
-                                # LOE eax edx
-..B19.8:                        # Preds ..B19.15 ..B19.7
-        movl      -44(%ebp), %ecx                               #858.24
-        movsbl    (%edx,%eax), %esi                             #858.48
-        movzbl    fasta_2na_map.0 at GOTOFF(%ecx,%esi), %ecx       #858.24
-        movl      %eax, %esi                                    #859.22
-        andl      $3, %esi                                      #859.22
-        je        ..B19.43      # Prob 20%                      #859.22
-                                # LOE eax edx ecx esi
-..B19.9:                        # Preds ..B19.8
-        cmpl      $1, %esi                                      #859.22
-        je        ..B19.14      # Prob 25%                      #859.22
-                                # LOE eax edx ecx esi
-..B19.10:                       # Preds ..B19.9
-        cmpl      $2, %esi                                      #859.22
-        jne       ..B19.12      # Prob 67%                      #859.22
-                                # LOE eax edx ecx esi
-..B19.11:                       # Preds ..B19.10
-        movl      %eax, %esi                                    #870.32
-        shrl      $2, %esi                                      #870.32
-        orb       $12, -24(%ebp,%esi)                           #871.13
-        shll      $2, %ecx                                      #870.47
-        orb       %cl, -40(%ebp,%esi)                           #870.13
-        jmp       ..B19.15      # Prob 100%                     #870.13
-                                # LOE eax edx
-..B19.12:                       # Preds ..B19.10
-        cmpl      $3, %esi                                      #859.22
-        jne       ..B19.15      # Prob 50%                      #859.22
-                                # LOE eax edx ecx
-..B19.13:                       # Preds ..B19.12
-        movl      %eax, %esi                                    #874.32
-        shrl      $2, %esi                                      #874.32
-        orb       $3, -24(%ebp,%esi)                            #875.13
-        orb       %cl, -40(%ebp,%esi)                           #874.13
-        jmp       ..B19.15      # Prob 100%                     #874.13
-                                # LOE eax edx
-..B19.14:                       # Preds ..B19.9
-        movl      %eax, %esi                                    #866.32
-        shrl      $2, %esi                                      #866.32
-        orb       $48, -24(%ebp,%esi)                           #867.13
-        shll      $4, %ecx                                      #866.47
-        orb       %cl, -40(%ebp,%esi)                           #866.13
-                                # LOE eax edx
-..B19.15:                       # Preds ..B19.43 ..B19.14 ..B19.11 ..B19.13 ..B19.12
-                                #      
-        movl      20(%ebx), %ecx                                #856.22
-        addl      $1, %eax                                      #856.31
-        cmpl      %ecx, %eax                                    #856.22
-        jb        ..B19.8       # Prob 82%                      #856.22
-                                # LOE eax edx
-..B19.16:                       # Preds ..B19.15
-        movl      -60(%ebp), %esi                               #
-                                # LOE eax esi
-..B19.17:                       # Preds ..B19.16 ..B19.44
-        addl      $3, %eax                                      #881.21
-        shrl      $2, %eax                                      #881.28
-        cmpl      $16, %eax                                     #881.35
-        jae       ..B19.30      # Prob 50%                      #881.35
-                                # LOE eax esi
-..B19.18:                       # Preds ..B19.17
-        lea       -40(%ebp), %edx                               #883.9
-        movl      %eax, %ecx                                    #881.5
-        negl      %ecx                                          #881.5
-        addl      $16, %ecx                                     #881.5
-        lea       (%edx,%eax), %edx                             #881.5
-        andl      $15, %edx                                     #881.5
-        movl      %edx, %edi                                    #881.5
-        negl      %edi                                          #881.5
-        addl      $16, %edi                                     #881.5
-        cmpl      $0, %edx                                      #881.5
-        cmovne    %edi, %edx                                    #881.5
-        movl      %edx, -56(%ebp)                               #881.5
-        lea       16(%edx), %edx                                #881.5
-        cmpl      %edx, %ecx                                    #881.5
-        jb        ..B19.42      # Prob 10%                      #881.5
-                                # LOE eax ecx esi
-..B19.19:                       # Preds ..B19.18
-        movl      -56(%ebp), %edx                               #881.5
-        movl      %ecx, %edi                                    #881.5
-        subl      %edx, %edi                                    #881.5
-        andl      $15, %edi                                     #881.5
-        negl      %edi                                          #881.5
-        addl      %ecx, %edi                                    #881.5
-        testl     %edx, %edx                                    #881.5
-        jbe       ..B19.23      # Prob 1%                       #881.5
-                                # LOE eax edx ecx esi edi dl dh
-..B19.20:                       # Preds ..B19.19
-        movl      %eax, -64(%ebp)                               #
-        movl      %ecx, -68(%ebp)                               #
-        movl      %eax, %ecx                                    #
-        movl      %esi, -60(%ebp)                               #
-        lea       (%edx,%eax), %edx                             #
-        movl      %edx, -44(%ebp)                               #
-        movl      %edx, %esi                                    #
-                                # LOE eax ecx esi edi
-..B19.21:                       # Preds ..B19.21 ..B19.20
-        xorl      %edx, %edx                                    #883.9
-        movb      %dl, -40(%ebp,%ecx)                           #883.9
-        movb      %dl, -24(%ebp,%ecx)                           #884.9
-        addl      $1, %ecx                                      #881.5
-        cmpl      %esi, %ecx                                    #881.5
-        jb        ..B19.21      # Prob 99%                      #881.5
-                                # LOE eax ecx esi edi
-..B19.22:                       # Preds ..B19.21
-        movl      -68(%ebp), %ecx                               #
-        movl      -60(%ebp), %esi                               #
-                                # LOE eax ecx esi edi
-..B19.23:                       # Preds ..B19.22 ..B19.19
-        movl      -56(%ebp), %edx                               #883.29
-        movl      %esi, -60(%ebp)                               #883.29
-        movl      %edx, %esi                                    #883.29
-        lea       (%edx,%eax), %edx                             #883.29
-        pxor      %xmm0, %xmm0                                  #883.29
-        movl      %edx, -44(%ebp)                               #883.29
-                                # LOE eax edx ecx esi edi xmm0
-..B19.24:                       # Preds ..B19.24 ..B19.23
-        movdqa    %xmm0, -40(%ebp,%edx)                         #883.9
-        movdqa    %xmm0, -24(%ebp,%edx)                         #884.9
-        addl      $16, %edx                                     #881.5
-        addl      $16, %esi                                     #881.5
-        cmpl      %edi, %esi                                    #881.5
-        jb        ..B19.24      # Prob 99%                      #881.5
-                                # LOE eax edx ecx esi edi xmm0
-..B19.25:                       # Preds ..B19.24
-        movl      -60(%ebp), %esi                               #
-                                # LOE eax ecx esi edi
-..B19.26:                       # Preds ..B19.25 ..B19.42
-        cmpl      %ecx, %edi                                    #881.5
-        jae       ..B19.30      # Prob 1%                       #881.5
-                                # LOE eax ecx esi edi
-..B19.27:                       # Preds ..B19.26
-        addl      %edi, %eax                                    #
-                                # LOE eax ecx esi edi
-..B19.28:                       # Preds ..B19.28 ..B19.27
-        xorl      %edx, %edx                                    #883.9
-        movb      %dl, -40(%ebp,%eax)                           #883.9
-        addl      $1, %edi                                      #881.5
-        movb      %dl, -24(%ebp,%eax)                           #884.9
-        addl      $1, %eax                                      #881.5
-        cmpl      %ecx, %edi                                    #881.5
-        jb        ..B19.28      # Prob 99%                      #881.5
-                                # LOE eax ecx esi edi
-..B19.30:                       # Preds ..B19.28 ..B19.26 ..B19.17
-        movl      12(%ebx), %eax                                #890.10
-        testl     %eax, %eax                                    #890.10
-        je        ..B19.32      # Prob 50%                      #890.10
-                                # LOE esi
-..B19.31:                       # Preds ..B19.30
-        movl      $9, (%esi)                                    #892.9
-        jmp       ..B19.41      # Prob 100%                     #892.9
-                                # LOE esi
-..B19.32:                       # Preds ..B19.30
-        movl      20(%ebx), %eax                                #896.22
-        cmpl      $2, %eax                                      #896.22
-        jae       ..B19.34      # Prob 50%                      #896.22
-                                # LOE esi
-..B19.33:                       # Preds ..B19.32
-        movzbl    -40(%ebp), %eax                               #898.29
-        movl      $2, (%esi)                                    #908.9
-        movb      %al, -39(%ebp)                                #898.9
-        movzwl    -40(%ebp), %edi                               #899.29
-        movw      %di, -38(%ebp)                                #899.9
-        movl      -40(%ebp), %eax                               #900.29
-        movl      %eax, -36(%ebp)                               #900.9
-        movl      -40(%ebp), %edx                               #901.29
-        movl      %edx, -32(%ebp)                               #901.9
-        movl      %eax, -28(%ebp)                               #901.9
-        movzbl    -24(%ebp), %eax                               #903.26
-        movb      %al, -23(%ebp)                                #903.9
-        movzwl    -24(%ebp), %eax                               #904.26
-        movw      %ax, -22(%ebp)                                #904.9
-        movl      -24(%ebp), %edx                               #905.26
-        movl      %edx, -20(%ebp)                               #905.9
-        movl      -24(%ebp), %eax                               #906.26
-        movl      %eax, -16(%ebp)                               #906.9
-        movl      %edx, -12(%ebp)                               #906.9
-        jmp       ..B19.41      # Prob 100%                     #906.9
-                                # LOE esi
-..B19.34:                       # Preds ..B19.32
-        movl      20(%ebx), %eax                                #910.22
-        cmpl      $6, %eax                                      #910.22
-        jae       ..B19.36      # Prob 50%                      #910.22
-                                # LOE esi
-..B19.35:                       # Preds ..B19.34
-        movzwl    -40(%ebp), %eax                               #912.29
-        movl      $3, (%esi)                                    #920.9
-        movw      %ax, -38(%ebp)                                #912.9
-        movl      -40(%ebp), %edi                               #913.29
-        movzwl    -24(%ebp), %eax                               #916.26
-        movl      %edi, -36(%ebp)                               #913.9
-        movl      -40(%ebp), %edx                               #914.29
-        movl      %edx, -32(%ebp)                               #914.9
-        movl      %edi, -28(%ebp)                               #914.9
-        movw      %ax, -22(%ebp)                                #916.9
-        movl      -24(%ebp), %edx                               #917.26
-        movl      %edx, -20(%ebp)                               #917.9
-        movl      -24(%ebp), %eax                               #918.26
-        movl      %eax, -16(%ebp)                               #918.9
-        movl      %edx, -12(%ebp)                               #918.9
-        jmp       ..B19.41      # Prob 100%                     #918.9
-                                # LOE esi
-..B19.36:                       # Preds ..B19.34
-        movl      20(%ebx), %eax                                #922.22
-        cmpl      $14, %eax                                     #922.22
-        jae       ..B19.38      # Prob 50%                      #922.22
-                                # LOE esi
-..B19.37:                       # Preds ..B19.36
-        movl      -40(%ebp), %edx                               #924.29
-        movl      $4, (%esi)                                    #930.9
-        movl      %edx, -36(%ebp)                               #924.9
-        movl      -40(%ebp), %eax                               #925.29
-        movl      %eax, -32(%ebp)                               #925.9
-        movl      -24(%ebp), %eax                               #927.26
-        movl      %edx, -28(%ebp)                               #925.9
-        movl      %eax, -20(%ebp)                               #927.9
-        movl      -24(%ebp), %edi                               #928.26
-        movl      %edi, -16(%ebp)                               #928.9
-        movl      %eax, -12(%ebp)                               #928.9
-        jmp       ..B19.41      # Prob 100%                     #928.9
-                                # LOE esi
-..B19.38:                       # Preds ..B19.36
-        movl      20(%ebx), %eax                                #932.22
-        cmpl      $30, %eax                                     #932.22
-        jae       ..B19.40      # Prob 50%                      #932.22
-                                # LOE esi
-..B19.39:                       # Preds ..B19.38
-        movl      -40(%ebp), %eax                               #934.29
-        movl      -36(%ebp), %edx                               #934.29
-        movl      -24(%ebp), %edi                               #935.26
-        movl      %eax, -32(%ebp)                               #934.9
-        movl      -20(%ebp), %eax                               #935.26
-        movl      $0, (%esi)                                    #937.9
-        movl      %edx, -28(%ebp)                               #934.9
-        movl      %edi, -16(%ebp)                               #935.9
-        movl      %eax, -12(%ebp)                               #935.9
-        jmp       ..B19.41      # Prob 100%                     #935.9
-                                # LOE esi
-..B19.40:                       # Preds ..B19.38
-        movl      $5, (%esi)                                    #941.9
-                                # LOE esi
-..B19.41:                       # Preds ..B19.31 ..B19.33 ..B19.35 ..B19.37 ..B19.39
-                                #       ..B19.40
-        movl      -40(%ebp), %eax                               #944.42
-        movl      -36(%ebp), %edi                               #944.42
-        lea       -40(%ebp), %ecx                               #948.5
-        movl      %eax, 16(%esi)                                #944.42
-        movl      -32(%ebp), %eax                               #944.42
-        movl      %edi, 20(%esi)                                #944.42
-        movl      %eax, 24(%esi)                                #944.42
-        movl      -28(%ebp), %eax                               #944.42
-        movl      %eax, 28(%esi)                                #944.42
-        movl      -24(%ebp), %eax                               #945.39
-        movl      %eax, 32(%esi)                                #945.39
-        movl      -20(%ebp), %eax                               #945.39
-        movl      %eax, 36(%esi)                                #945.39
-        movl      -16(%ebp), %eax                               #945.39
-        movl      %eax, 40(%esi)                                #945.39
-        movl      -12(%ebp), %eax                               #945.39
-        movl      %eax, 44(%esi)                                #945.39
-# Begin ASM
-        mov (%ecx), %eax;mov 12(%ecx), %edx;bswap %eax;bswap %edx;mov %eax, 12(%ecx);mov %edx, (%ecx);mov 4(%ecx), %eax;mov 8(%ecx), %edx;bswap %eax;bswap %edx;mov %eax, 8(%ecx);mov %edx, 4(%ecx);
-# End ASM                                                       #948.5
-        lea       -24(%ebp), %ecx                               #949.5
-# Begin ASM
-        mov (%ecx), %eax;mov 12(%ecx), %edx;bswap %eax;bswap %edx;mov %eax, 12(%ecx);mov %edx, (%ecx);mov 4(%ecx), %eax;mov 8(%ecx), %edx;bswap %eax;bswap %edx;mov %eax, 8(%ecx);mov %edx, 4(%ecx);
-# End ASM                                                       #949.5
-        movl      $2, %ecx                                      #952.5
-        lea       -40(%ebp), %edx                               #952.5
-# Begin ASM
-        mov 4(%edx), %eax;shrd %cl, %eax, (%edx);mov 8(%edx), %eax;shrd %cl, %eax, 4(%edx);mov 12(%edx), %eax;shrd %cl, %eax, 8(%edx);shr %cl, %eax;mov %eax, 12(%edx);
-# End ASM                                                       #952.5
-        lea       -24(%ebp), %edx                               #953.5
-# Begin ASM
-        mov 4(%edx), %eax;shrd %cl, %eax, (%edx);mov 8(%edx), %eax;shrd %cl, %eax, 4(%edx);mov 12(%edx), %eax;shrd %cl, %eax, 8(%edx);shr %cl, %eax;mov %eax, 12(%edx);
-# End ASM                                                       #953.5
-        lea       48(%esi), %ecx                                #956.5
-        lea       -40(%ebp), %edx                               #956.5
-# Begin ASM
-        push %ebx;mov (%edx), %eax;mov 12(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 12(%ecx);mov %ebx, (%ecx);mov 4(%edx), %eax;mov 8(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 8(%ecx);mov %ebx, 4(%ecx);pop %ebx;
-# End ASM                                                       #956.5
-        lea       64(%esi), %ecx                                #957.5
-        lea       -24(%ebp), %edx                               #957.5
-# Begin ASM
-        push %ebx;mov (%edx), %eax;mov 12(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 12(%ecx);mov %ebx, (%ecx);mov 4(%edx), %eax;mov 8(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 8(%ecx);mov %ebx, 4(%ecx);pop %ebx;
-# End ASM                                                       #957.5
-        movl      $2, %ecx                                      #959.5
-        lea       -40(%ebp), %edx                               #959.5
-# Begin ASM
-        mov 4(%edx), %eax;shrd %cl, %eax, (%edx);mov 8(%edx), %eax;shrd %cl, %eax, 4(%edx);mov 12(%edx), %eax;shrd %cl, %eax, 8(%edx);shr %cl, %eax;mov %eax, 12(%edx);
-# End ASM                                                       #959.5
-        lea       -24(%ebp), %edx                               #960.5
-# Begin ASM
-        mov 4(%edx), %eax;shrd %cl, %eax, (%edx);mov 8(%edx), %eax;shrd %cl, %eax, 4(%edx);mov 12(%edx), %eax;shrd %cl, %eax, 8(%edx);shr %cl, %eax;mov %eax, 12(%edx);
-# End ASM                                                       #960.5
-        lea       80(%esi), %ecx                                #962.5
-        lea       -40(%ebp), %edx                               #962.5
-# Begin ASM
-        push %ebx;mov (%edx), %eax;mov 12(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 12(%ecx);mov %ebx, (%ecx);mov 4(%edx), %eax;mov 8(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 8(%ecx);mov %ebx, 4(%ecx);pop %ebx;
-# End ASM                                                       #962.5
-        lea       96(%esi), %ecx                                #963.5
-        lea       -24(%ebp), %edx                               #963.5
-# Begin ASM
-        push %ebx;mov (%edx), %eax;mov 12(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 12(%ecx);mov %ebx, (%ecx);mov 4(%edx), %eax;mov 8(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 8(%ecx);mov %ebx, 4(%ecx);pop %ebx;
-# End ASM                                                       #963.5
-        movl      $2, %ecx                                      #965.5
-        lea       -40(%ebp), %edx                               #965.5
-# Begin ASM
-        mov 4(%edx), %eax;shrd %cl, %eax, (%edx);mov 8(%edx), %eax;shrd %cl, %eax, 4(%edx);mov 12(%edx), %eax;shrd %cl, %eax, 8(%edx);shr %cl, %eax;mov %eax, 12(%edx);
-# End ASM                                                       #965.5
-        lea       -24(%ebp), %edx                               #966.5
-# Begin ASM
-        mov 4(%edx), %eax;shrd %cl, %eax, (%edx);mov 8(%edx), %eax;shrd %cl, %eax, 4(%edx);mov 12(%edx), %eax;shrd %cl, %eax, 8(%edx);shr %cl, %eax;mov %eax, 12(%edx);
-# End ASM                                                       #966.5
-        lea       112(%esi), %ecx                               #968.5
-        lea       -40(%ebp), %edx                               #968.5
-# Begin ASM
-        push %ebx;mov (%edx), %eax;mov 12(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 12(%ecx);mov %ebx, (%ecx);mov 4(%edx), %eax;mov 8(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 8(%ecx);mov %ebx, 4(%ecx);pop %ebx;
-# End ASM                                                       #968.5
-        addl      $128, %esi                                    #969.5
-        movl      %esi, %ecx                                    #969.5
-        lea       -24(%ebp), %edx                               #969.5
-# Begin ASM
-        push %ebx;mov (%edx), %eax;mov 12(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 12(%ecx);mov %ebx, (%ecx);mov 4(%edx), %eax;mov 8(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 8(%ecx);mov %ebx, 4(%ecx);pop %ebx;
-# End ASM                                                       #969.5
-        xorl      %eax, %eax                                    #1011.12
-        movl      -52(%ebp), %esi                               #1011.12
-        movl      -48(%ebp), %edi                               #1011.12
-        movl      %ebp, %esp                                    #1011.12
-        popl      %ebp                                          #1011.12
-        movl      %ebx, %esp                                    #1011.12
-        popl      %ebx                                          #1011.12
-        ret                                                     #1011.12
-                                # LOE
-..B19.42:                       # Preds ..B19.18                # Infreq
-        xorl      %edi, %edi                                    #881.5
-        jmp       ..B19.26      # Prob 100%                     #881.5
-                                # LOE eax ecx esi edi
-..B19.43:                       # Preds ..B19.8                 # Infreq
-        movl      %eax, %esi                                    #862.32
-        shrl      $2, %esi                                      #862.32
-        movb      $192, -24(%ebp,%esi)                          #863.13
-        shll      $6, %ecx                                      #862.46
-        movb      %cl, -40(%ebp,%esi)                           #862.13
-        jmp       ..B19.15      # Prob 100%                     #862.13
-                                # LOE eax edx
-..B19.44:                       # Preds ..B19.6                 # Infreq
-        xorl      %eax, %eax                                    #
-        jmp       ..B19.17      # Prob 100%                     #
-                                # LOE eax esi
-..B19.45:                       # Preds ..B19.4 ..B19.5         # Infreq
-        movl      %edi, %ebx                                    #849.16
-        call      __errno_location at PLT                          #849.16
-        movl      -72(%ebp), %ebx                               #849.16
-                                # LOE eax
-..B19.50:                       # Preds ..B19.45                # Infreq
-        movl      -52(%ebp), %esi                               #849.16
-        movl      -48(%ebp), %edi                               #849.16
-        movl      (%eax), %eax                                  #849.16
-        movl      %ebp, %esp                                    #849.16
-        popl      %ebp                                          #849.16
-        movl      %ebx, %esp                                    #849.16
-        popl      %ebx                                          #849.16
-        ret                                                     #849.16
-        .align    2,0x90
-                                # LOE
-# mark_end;
-	.type	NucStrFastaExprMake2, at function
-	.size	NucStrFastaExprMake2,.-NucStrFastaExprMake2
-.LNNucStrFastaExprMake2:
-	.data
-# -- End  NucStrFastaExprMake2
-	.text
-# -- Begin  nss_expr
-# mark_begin;
-       .align    2,0x90
-nss_expr:
-# parameter 1(p): 8 + %ebp
-# parameter 2(end): 12 + %ebp
-# parameter 3(expr): 16 + %ebp
-# parameter 4(status): 20 + %ebp
-# parameter 5(positional): 24 + %ebp
-..B20.1:                        # Preds ..B20.0
-        pushl     %ebp                                          #1406.1
-        movl      %esp, %ebp                                    #1406.1
-        subl      $28, %esp                                     #1406.1
-        movl      %edi, -16(%ebp)                               #1406.1
-        movl      %esi, -20(%ebp)                               #1406.1
-        movl      %ebx, -12(%ebp)                               #1406.1
-        movl      8(%ebp), %esi                                 #1404.13
-        movl      16(%ebp), %edi                                #1404.13
-        call      ..L20         # Prob 100%                     #1406.1
-..L20:                                                          #
-        popl      %ebx                                          #1406.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L20], %ebx      #1406.1
-        lea       _gprof_pack19 at GOTOFF(%ebx), %edx              #1406.1
-        call      mcount at PLT                                    #1406.1
-                                # LOE ebx esi edi
-..B20.85:                       # Preds ..B20.1
-        call      __ctype_b_loc at PLT                             #1409.9
-                                # LOE eax ebx esi edi
-..B20.86:                       # Preds ..B20.85
-        movl      20(%ebp), %edx                                #1409.9
-        movl      12(%ebp), %ecx                                #1409.9
-        movl      %ebx, -8(%ebp)                                #1409.9
-        movl      %eax, -4(%ebp)                                #1409.9
-        jmp       ..B20.2       # Prob 100%                     #1409.9
-                                # LOE edx ecx esi edi
-..B20.54:                       # Preds ..B20.53
-        movl      -24(%ebp), %ebx                               #1459.17
-        movl      $11, (%eax)                                   #1458.17
-        movl      %ebx, 4(%eax)                                 #1459.17
-        movl      (%edi), %ebx                                  #1460.41
-        movl      %ebx, 8(%eax)                                 #1460.17
-        movl      %eax, (%edi)                                  #1461.17
-        lea       12(%eax), %edi                                #1464.42
-                                # LOE edx ecx esi edi
-..B20.2:                        # Preds ..B20.86 ..B20.54
-        movl      $0, (%edi)                                    #1407.5
-        cmpl      %ecx, %esi                                    #1409.9
-        jae       ..B20.8       # Prob 12%                      #1409.9
-                                # LOE edx ecx esi edi
-..B20.3:                        # Preds ..B20.2
-        movl      -4(%ebp), %eax                                #1409.9
-        movl      (%eax), %eax                                  #1409.9
-        movzbl    (%esi), %ebx                                  #1409.9
-        movzwl    (%eax,%ebx,2), %ebx                           #1409.9
-        testl     $8192, %ebx                                   #1409.9
-        je        ..B20.8       # Prob 15%                      #1409.9
-                                # LOE eax edx ecx esi edi
-..B20.5:                        # Preds ..B20.3 ..B20.6
-        addl      $1, %esi                                      #1409.9
-        cmpl      %ecx, %esi                                    #1409.9
-        jae       ..B20.8       # Prob 1%                       #1409.9
-                                # LOE eax edx ecx esi edi
-..B20.6:                        # Preds ..B20.5
-        movzbl    (%esi), %ebx                                  #1409.9
-        movzwl    (%eax,%ebx,2), %ebx                           #1409.9
-        testl     $8192, %ebx                                   #1409.9
-        jne       ..B20.5       # Prob 82%                      #1409.9
-                                # LOE eax edx ecx esi edi
-..B20.8:                        # Preds ..B20.5 ..B20.6 ..B20.3 ..B20.2
-        cmpl      %ecx, %esi                                    #1410.15
-        je        ..B20.58      # Prob 16%                      #1410.15
-                                # LOE edx ecx esi edi
-..B20.9:                        # Preds ..B20.8
-        movsbl    (%esi), %eax                                  #1412.13
-        cmpl      $33, %eax                                     #1412.13
-        je        ..B20.65      # Prob 16%                      #1412.13
-                                # LOE eax edx ecx esi edi
-..B20.10:                       # Preds ..B20.9
-        cmpl      $94, %eax                                     #1412.13
-        jne       ..B20.17      # Prob 67%                      #1412.13
-                                # LOE eax edx ecx esi edi
-..B20.11:                       # Preds ..B20.10
-        movl      -8(%ebp), %ebx                                #1412.13
-        pushl     $12                                           #1412.13
-        call      malloc at PLT                                    #1412.13
-                                # LOE eax esi edi
-..B20.87:                       # Preds ..B20.11
-        movl      20(%ebp), %edx                                #
-        movl      12(%ebp), %ecx                                #
-        addl      $4, %esp                                      #1412.13
-        movl      %eax, %ebx                                    #1412.13
-                                # LOE edx ecx ebx esi edi
-..B20.12:                       # Preds ..B20.87
-        testl     %ebx, %ebx                                    #1412.13
-        jne       ..B20.14      # Prob 68%                      #1412.13
-                                # LOE edx ecx ebx esi edi
-..B20.13:                       # Preds ..B20.12
-        movl      -8(%ebp), %ebx                                #1412.13
-        call      __errno_location at PLT                          #1412.13
-                                # LOE eax esi edi
-..B20.88:                       # Preds ..B20.13
-        movl      20(%ebp), %edx                                #
-        movl      12(%ebp), %ecx                                #
-        movl      (%eax), %ebx                                  #1412.13
-        movl      %ebx, (%edx)                                  #1412.13
-        jmp       ..B20.35      # Prob 100%                     #1412.13
-                                # LOE edx ecx ebx esi edi
-..B20.14:                       # Preds ..B20.12
-        movl      %ebx, -24(%ebp)                               #1412.13
-        movl      $12, (%ebx)                                   #1412.13
-        movl      %ebx, (%edi)                                  #1412.13
-        movl      $14, 4(%ebx)                                  #1412.13
-        pushl     %ecx                                          #1406.1
-        addl      $1, %esi                                      #1412.13
-        movl      $0, 8(%ebx)                                   #1412.13
-        pushl     %esi                                          #1406.1
-        call      nss_sob                                       #1412.13
-                                # LOE eax ebx edi bl bh
-..B20.89:                       # Preds ..B20.14
-        movl      20(%ebp), %edx                                #
-        movl      12(%ebp), %ecx                                #
-        movl      24(%ebp), %esi                                #1406.1
-        addl      $8, %ebx                                      #1412.13
-        pushl     %esi                                          #1406.1
-        pushl     %edx                                          #1406.1
-        pushl     %ebx                                          #1406.1
-        pushl     %ecx                                          #1406.1
-        pushl     %eax                                          #1406.1
-        call      nss_fasta_expr                                #1412.13
-                                # LOE eax edi
-..B20.90:                       # Preds ..B20.89
-        movl      20(%ebp), %edx                                #
-        movl      12(%ebp), %ecx                                #
-        addl      $28, %esp                                     #1412.13
-        movl      %eax, %esi                                    #1412.13
-                                # LOE edx ecx esi edi
-..B20.15:                       # Preds ..B20.90
-        movl      (%edx), %ebx                                  #1413.16
-        jmp       ..B20.35      # Prob 100%                     #1413.16
-                                # LOE edx ecx ebx esi edi
-..B20.17:                       # Preds ..B20.10
-        cmpl      $40, %eax                                     #1412.13
-        jne       ..B20.28      # Prob 50%                      #1412.13
-                                # LOE edx ecx esi edi
-..B20.18:                       # Preds ..B20.17
-        movl      -8(%ebp), %ebx                                #1412.13
-        pushl     $12                                           #1412.13
-        call      malloc at PLT                                    #1412.13
-                                # LOE eax esi edi
-..B20.91:                       # Preds ..B20.18
-        movl      20(%ebp), %edx                                #
-        movl      12(%ebp), %ecx                                #
-        movl      %eax, -24(%ebp)                               #1412.13
-        addl      $4, %esp                                      #1412.13
-                                # LOE eax edx ecx esi edi al ah
-..B20.19:                       # Preds ..B20.91
-        testl     %eax, %eax                                    #1412.13
-        jne       ..B20.21      # Prob 68%                      #1412.13
-                                # LOE eax edx ecx esi edi al ah
-..B20.20:                       # Preds ..B20.19
-        movl      -8(%ebp), %ebx                                #1412.13
-        call      __errno_location at PLT                          #1412.13
-                                # LOE eax esi edi
-..B20.92:                       # Preds ..B20.20
-        movl      20(%ebp), %edx                                #
-        movl      12(%ebp), %ecx                                #
-        movl      (%eax), %ebx                                  #1412.13
-        movl      %ebx, (%edx)                                  #1412.13
-        jmp       ..B20.35      # Prob 100%                     #1412.13
-                                # LOE edx ecx ebx esi edi
-..B20.21:                       # Preds ..B20.19
-        movl      24(%ebp), %ebx                                #1406.1
-        movl      $12, (%eax)                                   #1412.13
-        movl      %eax, (%edi)                                  #1412.13
-        movl      $0, 4(%eax)                                   #1412.13
-        pushl     %ebx                                          #1406.1
-        addl      $1, %esi                                      #1412.13
-        pushl     %edx                                          #1406.1
-        lea       8(%eax), %eax                                 #1412.13
-        pushl     %eax                                          #1406.1
-        pushl     %ecx                                          #1406.1
-        pushl     %esi                                          #1406.1
-        call      nss_expr                                      #1412.13
-                                # LOE eax edi
-..B20.93:                       # Preds ..B20.21
-        movl      20(%ebp), %edx                                #
-        movl      12(%ebp), %ecx                                #
-        addl      $20, %esp                                     #1412.13
-        movl      %eax, %esi                                    #1412.13
-                                # LOE edx ecx esi edi
-..B20.22:                       # Preds ..B20.93
-        movl      (%edx), %ebx                                  #1412.13
-        testl     %ebx, %ebx                                    #1412.13
-        jne       ..B20.35      # Prob 50%                      #1412.13
-                                # LOE edx ecx ebx esi edi
-..B20.23:                       # Preds ..B20.22
-        movl      -24(%ebp), %eax                               #1412.13
-        movl      8(%eax), %eax                                 #1412.13
-        testl     %eax, %eax                                    #1412.13
-        je        ..B20.26      # Prob 12%                      #1412.13
-                                # LOE edx ecx ebx esi edi
-..B20.24:                       # Preds ..B20.23
-        cmpl      %ecx, %esi                                    #1412.13
-        je        ..B20.26      # Prob 12%                      #1412.13
-                                # LOE edx ecx ebx esi edi
-..B20.25:                       # Preds ..B20.24
-        movsbl    (%esi), %eax                                  #1412.13
-        addl      $1, %esi                                      #1412.13
-        cmpl      $41, %eax                                     #1412.13
-        je        ..B20.35      # Prob 50%                      #1412.13
-                                # LOE edx ecx ebx esi edi
-..B20.26:                       # Preds ..B20.25 ..B20.24 ..B20.23
-        movl      $22, (%edx)                                   #1412.13
-        movl      $22, %ebx                                     #
-        jmp       ..B20.35      # Prob 100%                     #
-                                # LOE edx ecx ebx esi edi
-..B20.28:                       # Preds ..B20.17
-        movl      24(%ebp), %eax                                #1406.1
-        pushl     %eax                                          #1406.1
-        pushl     %edx                                          #1406.1
-        pushl     %edi                                          #1406.1
-        pushl     %ecx                                          #1406.1
-        pushl     %esi                                          #1406.1
-        call      nss_fasta_expr                                #1412.13
-                                # LOE eax edi
-..B20.94:                       # Preds ..B20.28
-        movl      20(%ebp), %edx                                #
-        movl      12(%ebp), %ecx                                #
-        addl      $20, %esp                                     #1412.13
-        movl      %eax, %esi                                    #1412.13
-                                # LOE edx ecx esi edi
-..B20.29:                       # Preds ..B20.94
-        movl      (%edx), %ebx                                  #1412.13
-        testl     %ebx, %ebx                                    #1412.13
-        jne       ..B20.35      # Prob 50%                      #1412.13
-                                # LOE edx ecx ebx esi edi
-..B20.30:                       # Preds ..B20.29
-        cmpl      %ecx, %esi                                    #1412.13
-        jae       ..B20.35      # Prob 33%                      #1412.13
-                                # LOE edx ecx ebx esi edi
-..B20.31:                       # Preds ..B20.30
-        movl      %ebx, -28(%ebp)                               #1412.13
-        pushl     %ecx                                          #1406.1
-        pushl     %esi                                          #1406.1
-        call      nss_sob                                       #1412.13
-                                # LOE eax ebx edi bl bh
-..B20.95:                       # Preds ..B20.31
-        movl      20(%ebp), %edx                                #
-        movl      12(%ebp), %ecx                                #
-        addl      $8, %esp                                      #1412.13
-        movl      %eax, %esi                                    #1412.13
-        cmpl      %ecx, %esi                                    #1412.13
-        jae       ..B20.35      # Prob 12%                      #1412.13
-                                # LOE edx ecx ebx esi edi bl bh
-..B20.32:                       # Preds ..B20.95
-        movsbl    (%esi), %eax                                  #1412.13
-        cmpl      $36, %eax                                     #1412.13
-        je        ..B20.59      # Prob 5%                       #1412.13
-                                # LOE edx ecx ebx esi edi
-..B20.35:                       # Preds ..B20.76 ..B20.72 ..B20.101 ..B20.88 ..B20.15
-                                #       ..B20.92 ..B20.25 ..B20.26 ..B20.22 ..B20.98
-                                #       ..B20.95 ..B20.61 ..B20.32 ..B20.30 ..B20.29
-                                #      
-        testl     %ebx, %ebx                                    #1413.26
-        jne       ..B20.58      # Prob 58%                      #1413.26
-                                # LOE edx ecx esi edi
-..B20.36:                       # Preds ..B20.35
-        cmpl      %ecx, %esi                                    #1415.17
-        jae       ..B20.42      # Prob 12%                      #1415.17
-                                # LOE edx ecx esi edi
-..B20.37:                       # Preds ..B20.36
-        movl      -4(%ebp), %eax                                #1415.17
-        movl      (%eax), %eax                                  #1415.17
-        movzbl    (%esi), %ebx                                  #1415.17
-        movzwl    (%eax,%ebx,2), %ebx                           #1415.17
-        testl     $8192, %ebx                                   #1415.17
-        je        ..B20.42      # Prob 15%                      #1415.17
-                                # LOE eax edx ecx esi edi
-..B20.39:                       # Preds ..B20.37 ..B20.40
-        addl      $1, %esi                                      #1415.17
-        cmpl      %ecx, %esi                                    #1415.17
-        jae       ..B20.42      # Prob 1%                       #1415.17
-                                # LOE eax edx ecx esi edi
-..B20.40:                       # Preds ..B20.39
-        movzbl    (%esi), %ebx                                  #1415.17
-        movzwl    (%eax,%ebx,2), %ebx                           #1415.17
-        testl     $8192, %ebx                                   #1415.17
-        jne       ..B20.39      # Prob 82%                      #1415.17
-                                # LOE eax edx ecx esi edi
-..B20.42:                       # Preds ..B20.39 ..B20.40 ..B20.37 ..B20.36
-        cmpl      %ecx, %esi                                    #1416.23
-        je        ..B20.58      # Prob 4%                       #1416.23
-                                # LOE edx ecx esi edi
-..B20.43:                       # Preds ..B20.42
-        movsbl    (%esi), %eax                                  #1422.28
-        addl      $1, %esi                                      #1422.28
-        cmpl      $41, %eax                                     #1422.28
-        je        ..B20.56      # Prob 25%                      #1422.28
-                                # LOE eax edx ecx esi edi
-..B20.44:                       # Preds ..B20.43
-        cmpl      $38, %eax                                     #1422.28
-        jne       ..B20.48      # Prob 67%                      #1422.28
-                                # LOE eax edx ecx esi edi
-..B20.45:                       # Preds ..B20.44
-        cmpl      %ecx, %esi                                    #1427.30
-        jae       ..B20.47      # Prob 12%                      #1427.30
-                                # LOE edx ecx esi edi
-..B20.46:                       # Preds ..B20.45
-        movsbl    (%esi), %eax                                  #1427.39
-        lea       1(%esi), %ebx                                 #1428.28
-        cmpl      $38, %eax                                     #1428.28
-        cmove     %ebx, %esi                                    #1428.28
-                                # LOE edx ecx esi edi
-..B20.47:                       # Preds ..B20.46 ..B20.45
-        movl      $16, %eax                                     #1429.21
-        movl      %eax, -24(%ebp)                               #1429.21
-        jmp       ..B20.52      # Prob 100%                     #1429.21
-                                # LOE edx ecx esi edi
-..B20.48:                       # Preds ..B20.44
-        cmpl      $124, %eax                                    #1422.28
-        jne       ..B20.55      # Prob 50%                      #1422.28
-                                # LOE edx ecx esi edi
-..B20.49:                       # Preds ..B20.48
-        cmpl      %ecx, %esi                                    #1432.30
-        jae       ..B20.51      # Prob 12%                      #1432.30
-                                # LOE edx ecx esi edi
-..B20.50:                       # Preds ..B20.49
-        movsbl    (%esi), %eax                                  #1432.39
-        lea       1(%esi), %ebx                                 #1433.28
-        cmpl      $124, %eax                                    #1433.28
-        cmove     %ebx, %esi                                    #1433.28
-                                # LOE edx ecx esi edi
-..B20.51:                       # Preds ..B20.50 ..B20.49
-        movl      $17, %eax                                     #1434.21
-        movl      %eax, -24(%ebp)                               #1434.21
-                                # LOE edx ecx esi edi
-..B20.52:                       # Preds ..B20.47 ..B20.51
-        movl      -8(%ebp), %ebx                                #1451.21
-        pushl     $16                                           #1451.30
-        call      malloc at PLT                                    #1451.21
-                                # LOE eax esi edi
-..B20.96:                       # Preds ..B20.52
-        movl      20(%ebp), %edx                                #
-        movl      12(%ebp), %ecx                                #
-        addl      $4, %esp                                      #1451.21
-                                # LOE eax edx ecx esi edi
-..B20.53:                       # Preds ..B20.96
-        testl     %eax, %eax                                    #1452.27
-        je        ..B20.82      # Prob 1%                       #1452.27
-        jmp       ..B20.54      # Prob 100%                     #1452.27
-                                # LOE eax edx ecx esi edi
-..B20.55:                       # Preds ..B20.48
-        movl      20(%ebp), %edx                                #1438.21
-        movl      -12(%ebp), %ebx                               #1439.32
-        movl      -16(%ebp), %edi                               #1439.32
-        addl      $-1, %esi                                     #1439.32
-        movl      %esi, %eax                                    #1439.32
-        movl      -20(%ebp), %esi                               #1439.32
-        movl      $22, (%edx)                                   #1438.21
-        movl      %ebp, %esp                                    #1439.32
-        popl      %ebp                                          #1439.32
-        ret                                                     #1439.32
-                                # LOE
-..B20.56:                       # Preds ..B20.43
-        movl      -12(%ebp), %ebx                               #1425.32
-        movl      -16(%ebp), %edi                               #1425.32
-        addl      $-1, %esi                                     #1425.32
-        movl      %esi, %eax                                    #1425.32
-        movl      -20(%ebp), %esi                               #1425.32
-        movl      %ebp, %esp                                    #1425.32
-        popl      %ebp                                          #1425.32
-        ret                                                     #1425.32
-                                # LOE
-..B20.58:                       # Preds ..B20.8 ..B20.42 ..B20.35
-        movl      -12(%ebp), %ebx                               #1470.12
-        movl      -16(%ebp), %edi                               #1470.12
-        movl      %esi, %eax                                    #1470.12
-        movl      -20(%ebp), %esi                               #1470.12
-        movl      %ebp, %esp                                    #1470.12
-        popl      %ebp                                          #1470.12
-        ret                                                     #1470.12
-                                # LOE
-..B20.59:                       # Preds ..B20.32                # Infreq
-        movl      -8(%ebp), %ebx                                #1412.13
-        pushl     $12                                           #1412.13
-        addl      $1, %esi                                      #1412.13
-        call      malloc at PLT                                    #1412.13
-                                # LOE eax esi edi
-..B20.97:                       # Preds ..B20.59                # Infreq
-        movl      20(%ebp), %edx                                #
-        movl      12(%ebp), %ecx                                #
-        addl      $4, %esp                                      #1412.13
-                                # LOE eax edx ecx esi edi
-..B20.60:                       # Preds ..B20.97                # Infreq
-        testl     %eax, %eax                                    #1412.13
-        je        ..B20.62      # Prob 12%                      #1412.13
-                                # LOE eax edx ecx esi edi
-..B20.61:                       # Preds ..B20.60                # Infreq
-        movl      (%edi), %ebx                                  #1412.13
-        movl      $12, (%eax)                                   #1412.13
-        movl      %ebx, 8(%eax)                                 #1412.13
-        movl      %eax, (%edi)                                  #1412.13
-        movl      (%edx), %ebx                                  #1413.16
-        movl      $15, 4(%eax)                                  #1412.13
-        jmp       ..B20.35      # Prob 100%                     #1412.13
-                                # LOE edx ecx ebx esi edi
-..B20.62:                       # Preds ..B20.60                # Infreq
-        movl      -8(%ebp), %ebx                                #1412.13
-        call      __errno_location at PLT                          #1412.13
-                                # LOE eax esi edi
-..B20.98:                       # Preds ..B20.62                # Infreq
-        movl      20(%ebp), %edx                                #
-        movl      12(%ebp), %ecx                                #
-        movl      (%eax), %ebx                                  #1412.13
-        movl      %ebx, (%edx)                                  #1412.13
-        jmp       ..B20.35      # Prob 100%                     #1412.13
-                                # LOE edx ecx ebx esi edi
-..B20.65:                       # Preds ..B20.9                 # Infreq
-        addl      $1, %esi                                      #1412.13
-        cmpl      %ecx, %esi                                    #1412.13
-        jae       ..B20.71      # Prob 12%                      #1412.13
-                                # LOE edx ecx esi edi
-..B20.66:                       # Preds ..B20.65                # Infreq
-        movl      -4(%ebp), %eax                                #1412.13
-        movl      (%eax), %eax                                  #1412.13
-        movzbl    (%esi), %ebx                                  #1412.13
-        movzwl    (%eax,%ebx,2), %ebx                           #1412.13
-        testl     $8192, %ebx                                   #1412.13
-        je        ..B20.71      # Prob 15%                      #1412.13
-                                # LOE eax edx ecx esi edi
-..B20.68:                       # Preds ..B20.66 ..B20.69       # Infreq
-        addl      $1, %esi                                      #1412.13
-        cmpl      %ecx, %esi                                    #1412.13
-        jae       ..B20.71      # Prob 1%                       #1412.13
-                                # LOE eax edx ecx esi edi
-..B20.69:                       # Preds ..B20.68                # Infreq
-        movzbl    (%esi), %ebx                                  #1412.13
-        movzwl    (%eax,%ebx,2), %ebx                           #1412.13
-        testl     $8192, %ebx                                   #1412.13
-        jne       ..B20.68      # Prob 82%                      #1412.13
-                                # LOE eax edx ecx esi edi
-..B20.71:                       # Preds ..B20.68 ..B20.69 ..B20.66 ..B20.65 # Infreq
-        cmpl      %ecx, %esi                                    #1412.13
-        jne       ..B20.73      # Prob 68%                      #1412.13
-                                # LOE edx ecx esi edi
-..B20.72:                       # Preds ..B20.71                # Infreq
-        movl      $22, (%edx)                                   #1412.13
-        movl      $22, %ebx                                     #
-        jmp       ..B20.35      # Prob 100%                     #
-                                # LOE edx ecx ebx esi edi
-..B20.73:                       # Preds ..B20.71                # Infreq
-        movl      -8(%ebp), %ebx                                #1412.13
-        pushl     $12                                           #1412.13
-        call      malloc at PLT                                    #1412.13
-                                # LOE eax esi edi
-..B20.99:                       # Preds ..B20.73                # Infreq
-        movl      20(%ebp), %edx                                #
-        movl      12(%ebp), %ecx                                #
-        addl      $4, %esp                                      #1412.13
-                                # LOE eax edx ecx esi edi
-..B20.74:                       # Preds ..B20.99                # Infreq
-        testl     %eax, %eax                                    #1412.13
-        je        ..B20.78      # Prob 1%                       #1412.13
-                                # LOE eax edx ecx esi edi
-..B20.75:                       # Preds ..B20.74                # Infreq
-        movl      24(%ebp), %ebx                                #1406.1
-        movl      $12, (%eax)                                   #1412.13
-        movl      %eax, (%edi)                                  #1412.13
-        movl      $13, 4(%eax)                                  #1412.13
-        pushl     %ebx                                          #1406.1
-        movl      $0, 8(%eax)                                   #1412.13
-        pushl     %edx                                          #1406.1
-        addl      $8, %eax                                      #1412.13
-        pushl     %eax                                          #1406.1
-        pushl     %ecx                                          #1406.1
-        pushl     %esi                                          #1406.1
-        call      nss_unary_expr                                #1412.13
-                                # LOE eax edi
-..B20.100:                      # Preds ..B20.75                # Infreq
-        movl      20(%ebp), %edx                                #
-        movl      12(%ebp), %ecx                                #
-        addl      $20, %esp                                     #1412.13
-        movl      %eax, %esi                                    #1412.13
-                                # LOE edx ecx esi edi
-..B20.76:                       # Preds ..B20.100               # Infreq
-        movl      (%edx), %ebx                                  #1413.16
-        jmp       ..B20.35      # Prob 100%                     #1413.16
-                                # LOE edx ecx ebx esi edi
-..B20.78:                       # Preds ..B20.74                # Infreq
-        movl      -8(%ebp), %ebx                                #1412.13
-        call      __errno_location at PLT                          #1412.13
-                                # LOE eax esi edi
-..B20.101:                      # Preds ..B20.78                # Infreq
-        movl      20(%ebp), %edx                                #
-        movl      12(%ebp), %ecx                                #
-        movl      (%eax), %ebx                                  #1412.13
-        movl      %ebx, (%edx)                                  #1412.13
-        jmp       ..B20.35      # Prob 100%                     #1412.13
-                                # LOE edx ecx ebx esi edi
-..B20.82:                       # Preds ..B20.53                # Infreq
-        movl      -8(%ebp), %ebx                                #
-        call      __errno_location at PLT                          #1454.32
-                                # LOE eax esi
-..B20.102:                      # Preds ..B20.82                # Infreq
-        movl      20(%ebp), %ecx                                #1454.21
-        movl      -12(%ebp), %ebx                               #1455.28
-        movl      -16(%ebp), %edi                               #1455.28
-        movl      (%eax), %edx                                  #1454.32
-        movl      %edx, (%ecx)                                  #1454.21
-        movl      %esi, %eax                                    #1451.21
-        movl      -20(%ebp), %esi                               #1455.28
-        movl      %ebp, %esp                                    #1455.28
-        popl      %ebp                                          #1455.28
-        ret                                                     #1455.28
-        .align    2,0x90
-                                # LOE
-# mark_end;
-	.type	nss_expr, at function
-	.size	nss_expr,.-nss_expr
-.LNnss_expr:
-	.data
-# -- End  nss_expr
-	.text
-# -- Begin  NucStrstrInit
-# mark_begin;
-       .align    2,0x90
-NucStrstrInit:
-..B21.1:                        # Preds ..B21.0
-        pushl     %ebp                                          #1484.1
-        movl      %esp, %ebp                                    #1484.1
-        subl      $32, %esp                                     #1484.1
-        movl      %edi, -24(%ebp)                               #1484.1
-        movl      %esi, -28(%ebp)                               #1484.1
-        movl      %ebx, -32(%ebp)                               #1484.1
-        call      ..L21         # Prob 100%                     #1484.1
-..L21:                                                          #
-        popl      %ebx                                          #1484.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L21], %ebx      #1484.1
-        lea       _gprof_pack20 at GOTOFF(%ebx), %edx              #1484.1
-        call      mcount at PLT                                    #1484.1
-                                # LOE ebx
-..B21.29:                       # Preds ..B21.1
-        lea       fasta_2na_map.0 at GOTOFF(%ebx), %edi            #1491.14
-        movl      $-1, %eax                                     #1491.5
-        movd      %eax, %xmm0                                   #1491.5
-        pshufd    $0, %xmm0, %xmm1                              #1491.5
-        movq      %xmm1, (%edi)                                 #1491.5
-        movq      %xmm1, 8(%edi)                                #1491.5
-        movq      %xmm1, 16(%edi)                               #1491.5
-        movq      %xmm1, 24(%edi)                               #1491.5
-        movq      %xmm1, 32(%edi)                               #1491.5
-        movq      %xmm1, 40(%edi)                               #1491.5
-        movq      %xmm1, 48(%edi)                               #1491.5
-        movq      %xmm1, 56(%edi)                               #1491.5
-        movq      %xmm1, 64(%edi)                               #1491.5
-        movq      %xmm1, 72(%edi)                               #1491.5
-        movq      %xmm1, 80(%edi)                               #1491.5
-        movq      %xmm1, 88(%edi)                               #1491.5
-        movq      %xmm1, 96(%edi)                               #1491.5
-        movq      %xmm1, 104(%edi)                              #1491.5
-        movq      %xmm1, 112(%edi)                              #1491.5
-        movq      %xmm1, 120(%edi)                              #1491.5
-                                # LOE ebx edi
-..B21.2:                        # Preds ..B21.29
-        lea       fasta_4na_map.0 at GOTOFF(%ebx), %eax            #1492.14
-        movl      $-1, %edx                                     #1492.5
-        movd      %edx, %xmm0                                   #1492.5
-        pshufd    $0, %xmm0, %xmm1                              #1492.5
-        movq      %xmm1, (%eax)                                 #1492.5
-        movq      %xmm1, 8(%eax)                                #1492.5
-        movq      %xmm1, 16(%eax)                               #1492.5
-        movq      %xmm1, 24(%eax)                               #1492.5
-        movq      %xmm1, 32(%eax)                               #1492.5
-        movq      %xmm1, 40(%eax)                               #1492.5
-        movq      %xmm1, 48(%eax)                               #1492.5
-        movq      %xmm1, 56(%eax)                               #1492.5
-        movq      %xmm1, 64(%eax)                               #1492.5
-        movq      %xmm1, 72(%eax)                               #1492.5
-        movq      %xmm1, 80(%eax)                               #1492.5
-        movq      %xmm1, 88(%eax)                               #1492.5
-        movq      %xmm1, 96(%eax)                               #1492.5
-        movq      %xmm1, 104(%eax)                              #1492.5
-        movq      %xmm1, 112(%eax)                              #1492.5
-        movq      %xmm1, 120(%eax)                              #1492.5
-                                # LOE eax ebx edi
-..B21.3:                        # Preds ..B21.2
-        lea       _2__STRING.0.0 at GOTOFF(%ebx), %ecx             #1487.29
-        movsbl    (%ecx), %esi                                  #1497.14
-        movl      %eax, -8(%ebp)                                #
-        movl      %edi, -4(%ebp)                                #
-        movl      %ebx, -20(%ebp)                               #
-        xorl      %edx, %edx                                    #
-                                # LOE edx ecx esi
-..B21.10:                       # Preds ..B21.3 ..B21.11
-        movl      -20(%ebp), %ebx                               #1498.48
-        movl      %edx, -16(%ebp)                               #1498.48
-        pushl     %esi                                          #1497.9
-        movl      %ecx, -12(%ebp)                               #1498.48
-        call      tolower at PLT                                   #1498.48
-                                # LOE eax esi
-..B21.30:                       # Preds ..B21.10
-        movl      -12(%ebp), %ecx                               #
-        movl      -16(%ebp), %edx                               #
-        addl      $4, %esp                                      #1498.48
-                                # LOE eax edx ecx esi dl cl dh ch
-..B21.11:                       # Preds ..B21.30
-        movl      -4(%ebp), %ebx                                #1498.32
-        movb      %dl, (%eax,%ebx)                              #1498.32
-        movb      %dl, (%ebx,%esi)                              #1498.9
-        movsbl    1(%ecx), %esi                                 #1495.31
-        addl      $1, %edx                                      #1495.48
-        addl      $1, %ecx                                      #1495.54
-        testl     %esi, %esi                                    #1495.42
-        jne       ..B21.10      # Prob 82%                      #1495.42
-                                # LOE edx ecx esi
-..B21.12:                       # Preds ..B21.11
-        movl      -8(%ebp), %eax                                #
-        movl      -20(%ebp), %ebx                               #
-        lea       _2__STRING.1.0 at GOTOFF(%ebx), %ecx             #1488.25
-        movsbl    (%ecx), %esi                                  #1504.14
-        xorl      %edx, %edx                                    #
-        movl      %eax, -8(%ebp)                                #
-        movl      %ebx, -20(%ebp)                               #
-                                # LOE edx ecx esi
-..B21.19:                       # Preds ..B21.12 ..B21.20
-        movl      -20(%ebp), %ebx                               #1505.48
-        movl      %edx, -12(%ebp)                               #1505.48
-        pushl     %esi                                          #1504.9
-        movl      %ecx, -16(%ebp)                               #1505.48
-        call      tolower at PLT                                   #1505.48
-                                # LOE eax esi
-..B21.31:                       # Preds ..B21.19
-        movl      -16(%ebp), %ecx                               #
-        movl      -12(%ebp), %edx                               #
-        addl      $4, %esp                                      #1505.48
-                                # LOE eax edx ecx esi dl cl dh ch
-..B21.20:                       # Preds ..B21.31
-        movl      -8(%ebp), %ebx                                #1505.32
-        movb      %dl, (%eax,%ebx)                              #1505.32
-        movb      %dl, (%ebx,%esi)                              #1505.9
-        movsbl    1(%ecx), %esi                                 #1502.31
-        addl      $1, %edx                                      #1502.48
-        addl      $1, %ecx                                      #1502.54
-        testl     %esi, %esi                                    #1502.42
-        jne       ..B21.19      # Prob 82%                      #1502.42
-                                # LOE edx ecx esi
-..B21.21:                       # Preds ..B21.20
-        movl      -20(%ebp), %ebx                               #
-        lea       512(%ebx), %eax                               #1510.11
-                                # LOE eax ebx
-..B21.22:                       # Preds ..B21.25 ..B21.21
-        movzwl    expand_2na.0 at GOTOFF(%ebx), %edx               #1511.28
-                                # LOE eax edx ebx
-..B21.24:                       # Preds ..B21.22
-# Begin ASM
-        rorw $8, %dx
-# End ASM                                                       #1511.0
-                                # LOE eax edx ebx
-..B21.25:                       # Preds ..B21.24
-        movw      %dx, expand_2na.0 at GOTOFF(%ebx)                #1511.9
-        addl      $2, %ebx                                      #1510.30
-        cmpl      %ebx, %eax                                    #1510.22
-        ja        ..B21.22      # Prob 99%                      #1510.22
-                                # LOE eax ebx
-..B21.26:                       # Preds ..B21.25
-        movl      -32(%ebp), %ebx                               #1513.1
-        movl      -28(%ebp), %esi                               #1513.1
-        movl      -24(%ebp), %edi                               #1513.1
-        movl      %ebp, %esp                                    #1513.1
-        popl      %ebp                                          #1513.1
-        ret                                                     #1513.1
-        .align    2,0x90
-                                # LOE
-# mark_end;
-	.type	NucStrstrInit, at function
-	.size	NucStrstrInit,.-NucStrstrInit
-.LNNucStrstrInit:
-	.data
-# -- End  NucStrstrInit
-	.bss
-	.align 32
-	.align 32
-fasta_2na_map.0:
-	.type	fasta_2na_map.0, at object
-	.size	fasta_2na_map.0,128
-	.space 128	# pad
-fasta_4na_map.0:
-	.type	fasta_4na_map.0, at object
-	.size	fasta_4na_map.0,128
-	.space 128	# pad
-	.data
-	.align 32
-	.align 32
-expand_2na.0:
-	.word	4369
-	.word	4370
-	.word	4372
-	.word	4376
-	.word	4385
-	.word	4386
-	.word	4388
-	.word	4392
-	.word	4417
-	.word	4418
-	.word	4420
-	.word	4424
-	.word	4481
-	.word	4482
-	.word	4484
-	.word	4488
-	.word	4625
-	.word	4626
-	.word	4628
-	.word	4632
-	.word	4641
-	.word	4642
-	.word	4644
-	.word	4648
-	.word	4673
-	.word	4674
-	.word	4676
-	.word	4680
-	.word	4737
-	.word	4738
-	.word	4740
-	.word	4744
-	.word	5137
-	.word	5138
-	.word	5140
-	.word	5144
-	.word	5153
-	.word	5154
-	.word	5156
-	.word	5160
-	.word	5185
-	.word	5186
-	.word	5188
-	.word	5192
-	.word	5249
-	.word	5250
-	.word	5252
-	.word	5256
-	.word	6161
-	.word	6162
-	.word	6164
-	.word	6168
-	.word	6177
-	.word	6178
-	.word	6180
-	.word	6184
-	.word	6209
-	.word	6210
-	.word	6212
-	.word	6216
-	.word	6273
-	.word	6274
-	.word	6276
-	.word	6280
-	.word	8465
-	.word	8466
-	.word	8468
-	.word	8472
-	.word	8481
-	.word	8482
-	.word	8484
-	.word	8488
-	.word	8513
-	.word	8514
-	.word	8516
-	.word	8520
-	.word	8577
-	.word	8578
-	.word	8580
-	.word	8584
-	.word	8721
-	.word	8722
-	.word	8724
-	.word	8728
-	.word	8737
-	.word	8738
-	.word	8740
-	.word	8744
-	.word	8769
-	.word	8770
-	.word	8772
-	.word	8776
-	.word	8833
-	.word	8834
-	.word	8836
-	.word	8840
-	.word	9233
-	.word	9234
-	.word	9236
-	.word	9240
-	.word	9249
-	.word	9250
-	.word	9252
-	.word	9256
-	.word	9281
-	.word	9282
-	.word	9284
-	.word	9288
-	.word	9345
-	.word	9346
-	.word	9348
-	.word	9352
-	.word	10257
-	.word	10258
-	.word	10260
-	.word	10264
-	.word	10273
-	.word	10274
-	.word	10276
-	.word	10280
-	.word	10305
-	.word	10306
-	.word	10308
-	.word	10312
-	.word	10369
-	.word	10370
-	.word	10372
-	.word	10376
-	.word	16657
-	.word	16658
-	.word	16660
-	.word	16664
-	.word	16673
-	.word	16674
-	.word	16676
-	.word	16680
-	.word	16705
-	.word	16706
-	.word	16708
-	.word	16712
-	.word	16769
-	.word	16770
-	.word	16772
-	.word	16776
-	.word	16913
-	.word	16914
-	.word	16916
-	.word	16920
-	.word	16929
-	.word	16930
-	.word	16932
-	.word	16936
-	.word	16961
-	.word	16962
-	.word	16964
-	.word	16968
-	.word	17025
-	.word	17026
-	.word	17028
-	.word	17032
-	.word	17425
-	.word	17426
-	.word	17428
-	.word	17432
-	.word	17441
-	.word	17442
-	.word	17444
-	.word	17448
-	.word	17473
-	.word	17474
-	.word	17476
-	.word	17480
-	.word	17537
-	.word	17538
-	.word	17540
-	.word	17544
-	.word	18449
-	.word	18450
-	.word	18452
-	.word	18456
-	.word	18465
-	.word	18466
-	.word	18468
-	.word	18472
-	.word	18497
-	.word	18498
-	.word	18500
-	.word	18504
-	.word	18561
-	.word	18562
-	.word	18564
-	.word	18568
-	.word	33041
-	.word	33042
-	.word	33044
-	.word	33048
-	.word	33057
-	.word	33058
-	.word	33060
-	.word	33064
-	.word	33089
-	.word	33090
-	.word	33092
-	.word	33096
-	.word	33153
-	.word	33154
-	.word	33156
-	.word	33160
-	.word	33297
-	.word	33298
-	.word	33300
-	.word	33304
-	.word	33313
-	.word	33314
-	.word	33316
-	.word	33320
-	.word	33345
-	.word	33346
-	.word	33348
-	.word	33352
-	.word	33409
-	.word	33410
-	.word	33412
-	.word	33416
-	.word	33809
-	.word	33810
-	.word	33812
-	.word	33816
-	.word	33825
-	.word	33826
-	.word	33828
-	.word	33832
-	.word	33857
-	.word	33858
-	.word	33860
-	.word	33864
-	.word	33921
-	.word	33922
-	.word	33924
-	.word	33928
-	.word	34833
-	.word	34834
-	.word	34836
-	.word	34840
-	.word	34849
-	.word	34850
-	.word	34852
-	.word	34856
-	.word	34881
-	.word	34882
-	.word	34884
-	.word	34888
-	.word	34945
-	.word	34946
-	.word	34948
-	.word	34952
-	.type	expand_2na.0, at object
-	.size	expand_2na.0,512
-	.section .rodata, "a"
-	.align 4
-	.align 4
-_gprof_pack0:
-	.long	0
-	.type	_gprof_pack0, at object
-	.size	_gprof_pack0,4
-_gprof_pack1:
-	.long	0
-	.type	_gprof_pack1, at object
-	.size	_gprof_pack1,4
-_gprof_pack2:
-	.long	0
-	.type	_gprof_pack2, at object
-	.size	_gprof_pack2,4
-_gprof_pack3:
-	.long	0
-	.type	_gprof_pack3, at object
-	.size	_gprof_pack3,4
-_gprof_pack4:
-	.long	0
-	.type	_gprof_pack4, at object
-	.size	_gprof_pack4,4
-_gprof_pack5:
-	.long	0
-	.type	_gprof_pack5, at object
-	.size	_gprof_pack5,4
-_gprof_pack6:
-	.long	0
-	.type	_gprof_pack6, at object
-	.size	_gprof_pack6,4
-_gprof_pack7:
-	.long	0
-	.type	_gprof_pack7, at object
-	.size	_gprof_pack7,4
-_gprof_pack8:
-	.long	0
-	.type	_gprof_pack8, at object
-	.size	_gprof_pack8,4
-_gprof_pack9:
-	.long	0
-	.type	_gprof_pack9, at object
-	.size	_gprof_pack9,4
-_gprof_pack10:
-	.long	0
-	.type	_gprof_pack10, at object
-	.size	_gprof_pack10,4
-_gprof_pack11:
-	.long	0
-	.type	_gprof_pack11, at object
-	.size	_gprof_pack11,4
-_gprof_pack12:
-	.long	0
-	.type	_gprof_pack12, at object
-	.size	_gprof_pack12,4
-_gprof_pack13:
-	.long	0
-	.type	_gprof_pack13, at object
-	.size	_gprof_pack13,4
-_gprof_pack14:
-	.long	0
-	.type	_gprof_pack14, at object
-	.size	_gprof_pack14,4
-_gprof_pack15:
-	.long	0
-	.type	_gprof_pack15, at object
-	.size	_gprof_pack15,4
-_gprof_pack16:
-	.long	0
-	.type	_gprof_pack16, at object
-	.size	_gprof_pack16,4
-_gprof_pack17:
-	.long	0
-	.type	_gprof_pack17, at object
-	.size	_gprof_pack17,4
-_gprof_pack18:
-	.long	0
-	.type	_gprof_pack18, at object
-	.size	_gprof_pack18,4
-_gprof_pack19:
-	.long	0
-	.type	_gprof_pack19, at object
-	.size	_gprof_pack19,4
-_gprof_pack20:
-	.long	0
-	.type	_gprof_pack20, at object
-	.size	_gprof_pack20,4
-	.section .rodata.str1.4, "aMS", at progbits,1
-	.align 4
-	.align 4
-_2__STRING.0.0:
-	.byte	65
-	.byte	67
-	.byte	71
-	.byte	84
-	.byte	0
-	.type	_2__STRING.0.0, at object
-	.size	_2__STRING.0.0,5
-	.space 3	# pad
-_2__STRING.1.0:
-	.byte	45
-	.byte	65
-	.byte	67
-	.byte	77
-	.byte	71
-	.byte	82
-	.byte	83
-	.byte	86
-	.byte	84
-	.byte	87
-	.byte	89
-	.byte	72
-	.byte	75
-	.byte	68
-	.byte	66
-	.byte	78
-	.byte	0
-	.type	_2__STRING.1.0, at object
-	.size	_2__STRING.1.0,17
-	.data
-	.section .note.GNU-stack, ""
-// -- Begin DWARF2 SEGMENT .debug_info
-	.section .debug_info
-.debug_info_seg:
-	.align 1
-// -- Begin DWARF2 SEGMENT .debug_abbrev
-	.section .debug_abbrev
-.debug_abbrev_seg:
-	.align 1
-	.section .text
-.LNDBG_TXe:
-# End
diff --git a/libs/search/nucstrstr-icc-i386-rel.pic.s b/libs/search/nucstrstr-icc-i386-rel.pic.s
deleted file mode 100644
index fad8b32..0000000
--- a/libs/search/nucstrstr-icc-i386-rel.pic.s
+++ /dev/null
@@ -1,6711 +0,0 @@
-# -- Machine type PW
-# mark_description "Intel(R) C++ Compiler for applications running on IA-32, Version 10.1    Build 20081024 %s";
-# mark_description "-I/home/yaschenk/devel/internal/asm-trace/sra/search/linux -I/home/yaschenk/devel/internal/asm-trace/sra/sea";
-# mark_description "rch/unix -I/home/yaschenk/devel/internal/asm-trace/sra/search -I/home/yaschenk/devel/internal/asm-trace/itf ";
-# mark_description "-I/home/yaschenk/devel/internal/asm-trace/inc/icc/i386 -I/home/yaschenk/devel/internal/asm-trace/inc/icc -I/";
-# mark_description "home/yaschenk/devel/internal/asm-trace/inc/gcc/i386 -I/home/yaschenk/devel/internal/asm-trace/inc/gcc -I/hom";
-# mark_description "e/yaschenk/devel/internal/asm-trace/inc/linux -I/home/yaschenk/devel/internal/asm-trace/inc/unix -I/home/rod";
-# mark_description "armer/devel/internal/asm-trace/inc -c -S -o nucstrstr.pic.s -fPIC -O3 -unroll -xW -DNDEBUG -DLINUX -DUNIX -D";
-# mark_description "_GNU_SOURCE -D_REENTRANT -D_FILE_OFFSET_BITS=64 -MD";
-	.file "nucstrstr.c"
-	.text
-..TXTST0:
-# -- Begin  NucStrstrSearch
-# mark_begin;
-       .align    2,0x90
-	.globl NucStrstrSearch
-NucStrstrSearch:
-# parameter 1: 36 + %esp
-# parameter 2: 40 + %esp
-# parameter 3: 44 + %esp
-# parameter 4: 48 + %esp
-# parameter 5: 52 + %esp
-..B1.1:                         # Preds ..B1.0
-        pushl     %edi                                          #5217.1
-        pushl     %esi                                          #5217.1
-        pushl     %ebx                                          #5217.1
-        subl      $20, %esp                                     #5217.1
-        movl      36(%esp), %esi                                #5215.5
-        movl      40(%esp), %edx                                #5215.5
-        movl      44(%esp), %ecx                                #5215.5
-        movl      48(%esp), %edi                                #5215.5
-                                # LOE edx ecx ebp esi edi
-..B1.2:                         # Preds ..B1.1
-        testl     %esi, %esi                                    #5218.18
-        je        ..B1.108      # Prob 6%                       #5218.18
-                                # LOE edx ecx ebp esi edi
-..B1.3:                         # Preds ..B1.2
-        testl     %edx, %edx                                    #5218.37
-        je        ..B1.108      # Prob 6%                       #5218.37
-                                # LOE edx ecx ebp esi edi
-..B1.4:                         # Preds ..B1.3
-        call      ..L1          # Prob 100%                     #
-..L1:                                                           #
-        popl      %ebx                                          #
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L1], %ebx       #
-                                # LOE edx ecx ebx ebp esi edi
-..B1.5:                         # Preds ..B1.15 ..B1.18 ..B1.4
-        testl     %edi, %edi                                    #5218.52
-        je        ..B1.108      # Prob 28%                      #5218.52
-                                # LOE edx ecx ebx ebp esi edi
-..B1.7:                         # Preds ..B1.5
-        movl      %ebp, 16(%esp)                                #
-        movl      %ecx, %ebp                                    #
-                                # LOE edx ebx ebp esi edi
-..B1.8:                         # Preds ..B1.32 ..B1.7
-        movl      (%esi), %eax                                  #5223.18
-        cmpl      $12, %eax                                     #5223.9
-        ja        ..B1.33       # Prob 50%                      #5223.9
-                                # LOE eax ebx ebp esi edi
-..B1.9:                         # Preds ..B1.8
-        movl      ..1..TPKT.30_0.0.0 at GOTOFF(%ebx,%eax,4), %eax  #5223.9
-        jmp       *%eax                                         #5223.9
-                                # LOE ebx ebp esi edi
-..1.30_0.TAG.0c.0.0:
-..B1.10:                        # Preds ..B1.9
-        movl      40(%esp), %edx                                #
-        movl      %ebp, %ecx                                    #
-        movl      16(%esp), %ebp                                #
-                                # LOE edx ecx ebx ebp esi edi
-..B1.11:                        # Preds ..B1.10
-        movl      4(%esi), %eax                                 #5286.22
-        testl     %eax, %eax                                    #5286.22
-        je        ..B1.21       # Prob 20%                      #5286.22
-                                # LOE eax edx ecx ebx ebp esi edi
-..B1.12:                        # Preds ..B1.11
-        cmpl      $13, %eax                                     #5286.22
-        je        ..B1.21       # Prob 25%                      #5286.22
-                                # LOE eax edx ecx ebx ebp esi edi
-..B1.13:                        # Preds ..B1.12
-        cmpl      $14, %eax                                     #5286.22
-        jne       ..B1.16       # Prob 67%                      #5286.22
-                                # LOE eax edx ecx ebx ebp esi edi
-..B1.14:                        # Preds ..B1.13
-        movl      8(%esi), %esi                                 #5297.29
-        movl      4(%esi), %eax                                 #5297.29
-        cmpl      %edi, %eax                                    #5298.34
-        ja        ..B1.108      # Prob 5%                       #5298.34
-                                # LOE eax edx ecx ebx ebp esi
-..B1.15:                        # Preds ..B1.14
-        movl      %eax, %edi                                    #5297.17
-        testl     %esi, %esi                                    #5218.18
-        jne       ..B1.5        # Prob 94%                      #5218.18
-        jmp       ..B1.108      # Prob 100%                     #5218.18
-                                # LOE edx ecx ebx ebp esi edi
-..B1.16:                        # Preds ..B1.13
-        cmpl      $15, %eax                                     #5286.22
-        jne       ..B1.108      # Prob 50%                      #5286.22
-                                # LOE edx ecx ebx ebp esi edi
-..B1.17:                        # Preds ..B1.16
-        movl      8(%esi), %esi                                 #5302.29
-        movl      4(%esi), %eax                                 #5302.29
-        cmpl      %edi, %eax                                    #5303.34
-        ja        ..B1.108      # Prob 5%                       #5303.34
-                                # LOE eax edx ecx ebx ebp esi edi
-..B1.18:                        # Preds ..B1.17
-        addl      %edi, %ecx                                    #5306.27
-        subl      %eax, %ecx                                    #5306.33
-        movl      %eax, %edi                                    #5302.17
-        testl     %esi, %esi                                    #5218.18
-        jne       ..B1.5        # Prob 94%                      #5218.18
-        jmp       ..B1.108      # Prob 100%                     #5218.18
-                                # LOE edx ecx ebx ebp esi edi
-..B1.21:                        # Preds ..B1.11 ..B1.12
-        movl      52(%esp), %eax                                #5217.1
-        pushl     %eax                                          #5217.1
-        pushl     %edi                                          #5217.1
-        pushl     %ecx                                          #5217.1
-        pushl     %edx                                          #5217.1
-        pushl     8(%esi)                                       #5217.1
-        call      NucStrstrSearch at PLT                           #5290.25
-                                # LOE eax ebp esi
-..B1.118:                       # Preds ..B1.21
-        addl      $20, %esp                                     #5290.25
-                                # LOE eax ebp esi
-..B1.22:                        # Preds ..B1.118
-        movl      4(%esi), %edx                                 #5291.22
-        testl     %edx, %edx                                    #5291.42
-        je        ..B1.57       # Prob 28%                      #5291.42
-                                # LOE eax ebp
-..B1.23:                        # Preds ..B1.22
-        testl     %eax, %eax                                    #5293.31
-        jne       ..B1.108      # Prob 72%                      #5293.31
-                                # LOE ebp
-..B1.24:                        # Preds ..B1.23
-        movl      $1, %eax                                      #5294.28
-        addl      $20, %esp                                     #5294.28
-        popl      %ebx                                          #5294.28
-        popl      %esi                                          #5294.28
-        popl      %edi                                          #5294.28
-        ret                                                     #5294.28
-                                # LOE
-..1.30_0.TAG.0b.0.0:
-..B1.27:                        # Preds ..B1.9
-        movl      52(%esp), %eax                                #5217.1
-        pushl     %eax                                          #5217.1
-        pushl     %edi                                          #5217.1
-        pushl     %ebp                                          #5217.1
-        movl      52(%esp), %edx                                #5217.1
-        pushl     %edx                                          #5217.1
-        pushl     8(%esi)                                       #5217.1
-        call      NucStrstrSearch at PLT                           #5272.21
-                                # LOE eax ebx ebp esi edi
-..B1.119:                       # Preds ..B1.27
-        addl      $20, %esp                                     #5272.21
-                                # LOE eax ebx ebp esi edi
-..B1.28:                        # Preds ..B1.119
-        movl      4(%esi), %edx                                 #5273.22
-        cmpl      $17, %edx                                     #5273.22
-        jne       ..B1.30       # Prob 67%                      #5273.22
-                                # LOE eax edx ebx ebp esi edi
-..B1.29:                        # Preds ..B1.28
-        testl     %eax, %eax                                    #5276.31
-        jne       ..B1.112      # Prob 5%                       #5276.31
-        jmp       ..B1.32       # Prob 100%                     #5276.31
-                                # LOE eax ebx ebp esi edi
-..B1.30:                        # Preds ..B1.28
-        cmpl      $16, %edx                                     #5273.22
-        jne       ..B1.32       # Prob 50%                      #5273.22
-                                # LOE eax ebx ebp esi edi
-..B1.31:                        # Preds ..B1.30
-        testl     %eax, %eax                                    #5280.31
-        je        ..B1.112      # Prob 5%                       #5280.31
-                                # LOE eax ebx ebp esi edi
-..B1.32:                        # Preds ..B1.29 ..B1.31 ..B1.30
-        movl      12(%esi), %esi                                #5284.38
-        testl     %esi, %esi                                    #5218.18
-        jne       ..B1.8        # Prob 94%                      #5218.18
-                                # LOE ebx ebp esi edi
-..B1.33:                        # Preds ..B1.8 ..B1.32
-        movl      16(%esp), %ebp                                #
-        jmp       ..B1.108      # Prob 100%                     #
-                                # LOE ebp
-..1.30_0.TAG.0a.0.0:
-..B1.34:                        # Preds ..B1.9
-        movl      40(%esp), %edx                                #
-        movl      %ebp, %ecx                                    #
-        movl      16(%esp), %ebp                                #
-                                # LOE edx ecx ebp esi edi
-..B1.35:                        # Preds ..B1.34
-        movl      4(%esi), %eax                                 #5268.24
-        cmpl      %eax, %edi                                    #5268.24
-        jb        ..B1.108      # Prob 28%                      #5268.24
-                                # LOE eax edx ecx ebp esi edi
-..B1.36:                        # Preds ..B1.35
-        movl      52(%esp), %ebx                                #5269.9
-        testl     %ebx, %ebx                                    #5269.9
-        je        ..B1.38       # Prob 12%                      #5269.9
-                                # LOE eax edx ecx ebp esi edi
-..B1.37:                        # Preds ..B1.36
-        movl      52(%esp), %ebx                                #5269.18
-        movl      %eax, (%ebx)                                  #5269.18
-                                # LOE edx ecx ebp esi edi
-..B1.38:                        # Preds ..B1.37 ..B1.36
-        movl      %edi, 12(%esp)                                #5218.5
-        movl      %esi, %eax                                    #5270.20
-        call      eval_4na_pos                                  #5270.20
-                                # LOE eax ebp
-..B1.120:                       # Preds ..B1.38
-        addl      $20, %esp                                     #5270.20
-        popl      %ebx                                          #5270.20
-        popl      %esi                                          #5270.20
-        popl      %edi                                          #5270.20
-        ret                                                     #5270.20
-                                # LOE
-..1.30_0.TAG.09.0.0:
-..B1.40:                        # Preds ..B1.9
-        movl      40(%esp), %edx                                #
-        movl      %ebp, %ecx                                    #
-        movl      16(%esp), %ebp                                #
-                                # LOE edx ecx ebp esi edi
-..B1.41:                        # Preds ..B1.40
-        movl      4(%esi), %eax                                 #5264.24
-        cmpl      %eax, %edi                                    #5264.24
-        jb        ..B1.108      # Prob 28%                      #5264.24
-                                # LOE eax edx ecx ebp esi edi
-..B1.42:                        # Preds ..B1.41
-        movl      52(%esp), %ebx                                #5265.9
-        testl     %ebx, %ebx                                    #5265.9
-        je        ..B1.44       # Prob 12%                      #5265.9
-                                # LOE eax edx ecx ebp esi edi
-..B1.43:                        # Preds ..B1.42
-        movl      52(%esp), %ebx                                #5265.18
-        movl      %eax, (%ebx)                                  #5265.18
-                                # LOE edx ecx ebp esi edi
-..B1.44:                        # Preds ..B1.43 ..B1.42
-        movl      %edi, 12(%esp)                                #5218.5
-        movl      %esi, %eax                                    #5266.20
-        call      eval_2na_pos                                  #5266.20
-                                # LOE eax ebp
-..B1.121:                       # Preds ..B1.44
-        addl      $20, %esp                                     #5266.20
-        popl      %ebx                                          #5266.20
-        popl      %esi                                          #5266.20
-        popl      %edi                                          #5266.20
-        ret                                                     #5266.20
-                                # LOE
-..1.30_0.TAG.08.0.0:
-..B1.46:                        # Preds ..B1.9
-        movl      40(%esp), %edx                                #
-        movl      %ebp, %ecx                                    #
-        movl      16(%esp), %ebp                                #
-                                # LOE edx ecx ebp esi edi
-..B1.47:                        # Preds ..B1.46
-        movl      4(%esi), %eax                                 #5259.24
-        cmpl      %eax, %edi                                    #5259.24
-        jb        ..B1.108      # Prob 28%                      #5259.24
-                                # LOE eax edx ecx ebp esi edi
-..B1.48:                        # Preds ..B1.47
-        movl      52(%esp), %ebx                                #5260.9
-        testl     %ebx, %ebx                                    #5260.9
-        je        ..B1.50       # Prob 12%                      #5260.9
-                                # LOE eax edx ecx ebp esi edi
-..B1.49:                        # Preds ..B1.48
-        movl      52(%esp), %ebx                                #5260.18
-        movl      %eax, (%ebx)                                  #5260.18
-                                # LOE edx ecx ebp esi edi
-..B1.50:                        # Preds ..B1.49 ..B1.48
-        movl      %edi, 12(%esp)                                #5218.5
-        movl      %esi, %eax                                    #5261.20
-        call      eval_4na_128                                  #5261.20
-                                # LOE eax ebp
-..B1.122:                       # Preds ..B1.50
-        addl      $20, %esp                                     #5261.20
-        popl      %ebx                                          #5261.20
-        popl      %esi                                          #5261.20
-        popl      %edi                                          #5261.20
-        ret                                                     #5261.20
-                                # LOE
-..1.30_0.TAG.07.0.0:
-..B1.52:                        # Preds ..B1.9
-        movl      40(%esp), %edx                                #
-        movl      %ebp, %ecx                                    #
-        movl      16(%esp), %ebp                                #
-                                # LOE edx ecx ebp esi edi
-..B1.53:                        # Preds ..B1.52
-        movl      4(%esi), %eax                                 #5255.24
-        cmpl      %eax, %edi                                    #5255.24
-        jb        ..B1.108      # Prob 28%                      #5255.24
-                                # LOE eax edx ecx ebp esi edi
-..B1.54:                        # Preds ..B1.53
-        movl      52(%esp), %ebx                                #5256.9
-        testl     %ebx, %ebx                                    #5256.9
-        je        ..B1.56       # Prob 12%                      #5256.9
-                                # LOE eax edx ecx ebp esi edi
-..B1.55:                        # Preds ..B1.54
-        movl      52(%esp), %ebx                                #5256.18
-        movl      %eax, (%ebx)                                  #5256.18
-                                # LOE edx ecx ebp esi edi
-..B1.56:                        # Preds ..B1.55 ..B1.54
-        movl      %edi, 12(%esp)                                #5218.5
-        movl      %esi, %eax                                    #5257.20
-        call      eval_4na_32                                   #5257.20
-                                # LOE eax ebp
-..B1.57:                        # Preds ..B1.22 ..B1.56
-        addl      $20, %esp                                     #5257.20
-        popl      %ebx                                          #5257.20
-        popl      %esi                                          #5257.20
-        popl      %edi                                          #5257.20
-        ret                                                     #5257.20
-                                # LOE
-..1.30_0.TAG.06.0.0:
-..B1.59:                        # Preds ..B1.9
-        movl      40(%esp), %edx                                #
-        movl      %ebp, %ecx                                    #
-        movl      16(%esp), %ebp                                #
-                                # LOE edx ecx ebp esi edi
-..B1.60:                        # Preds ..B1.59
-        movl      4(%esi), %eax                                 #5251.24
-        cmpl      %eax, %edi                                    #5251.24
-        jb        ..B1.108      # Prob 28%                      #5251.24
-                                # LOE eax edx ecx ebp esi edi
-..B1.61:                        # Preds ..B1.60
-        movl      52(%esp), %ebx                                #5252.9
-        testl     %ebx, %ebx                                    #5252.9
-        je        ..B1.63       # Prob 12%                      #5252.9
-                                # LOE eax edx ecx ebp esi edi
-..B1.62:                        # Preds ..B1.61
-        movl      52(%esp), %ebx                                #5252.18
-        movl      %eax, (%ebx)                                  #5252.18
-                                # LOE edx ecx ebp esi edi
-..B1.63:                        # Preds ..B1.62 ..B1.61
-        movl      %edi, 12(%esp)                                #5218.5
-        movl      %esi, %eax                                    #5253.20
-        call      eval_4na_16                                   #5253.20
-                                # LOE eax ebp
-..B1.64:                        # Preds ..B1.63
-        addl      $20, %esp                                     #5253.20
-        popl      %ebx                                          #5253.20
-        popl      %esi                                          #5253.20
-        popl      %edi                                          #5253.20
-        ret                                                     #5253.20
-                                # LOE
-..1.30_0.TAG.05.0.0:
-..B1.66:                        # Preds ..B1.9
-        movl      40(%esp), %edx                                #
-        movl      %ebp, %ecx                                    #
-        movl      16(%esp), %ebp                                #
-                                # LOE edx ecx ebp esi edi
-..B1.67:                        # Preds ..B1.66
-        movl      4(%esi), %eax                                 #5247.24
-        cmpl      %eax, %edi                                    #5247.24
-        jb        ..B1.108      # Prob 28%                      #5247.24
-                                # LOE eax edx ecx ebp esi edi
-..B1.68:                        # Preds ..B1.67
-        movl      52(%esp), %ebx                                #5248.9
-        testl     %ebx, %ebx                                    #5248.9
-        je        ..B1.70       # Prob 12%                      #5248.9
-                                # LOE eax edx ecx ebp esi edi
-..B1.69:                        # Preds ..B1.68
-        movl      52(%esp), %ebx                                #5248.18
-        movl      %eax, (%ebx)                                  #5248.18
-                                # LOE edx ecx ebp esi edi
-..B1.70:                        # Preds ..B1.69 ..B1.68
-        movl      %edi, 12(%esp)                                #5218.5
-        movl      %esi, %eax                                    #5249.20
-        call      eval_2na_128                                  #5249.20
-                                # LOE eax ebp
-..B1.125:                       # Preds ..B1.70
-        addl      $20, %esp                                     #5249.20
-        popl      %ebx                                          #5249.20
-        popl      %esi                                          #5249.20
-        popl      %edi                                          #5249.20
-        ret                                                     #5249.20
-                                # LOE
-..1.30_0.TAG.04.0.0:
-..B1.72:                        # Preds ..B1.9
-        movl      40(%esp), %edx                                #
-        movl      %ebp, %ecx                                    #
-        movl      16(%esp), %ebp                                #
-                                # LOE edx ecx ebp esi edi
-..B1.73:                        # Preds ..B1.72
-        movl      4(%esi), %eax                                 #5243.24
-        cmpl      %eax, %edi                                    #5243.24
-        jb        ..B1.108      # Prob 28%                      #5243.24
-                                # LOE eax edx ecx ebp esi edi
-..B1.74:                        # Preds ..B1.73
-        movl      52(%esp), %ebx                                #5244.9
-        testl     %ebx, %ebx                                    #5244.9
-        je        ..B1.76       # Prob 12%                      #5244.9
-                                # LOE eax edx ecx ebp esi edi
-..B1.75:                        # Preds ..B1.74
-        movl      52(%esp), %ebx                                #5244.18
-        movl      %eax, (%ebx)                                  #5244.18
-                                # LOE edx ecx ebp esi edi
-..B1.76:                        # Preds ..B1.75 ..B1.74
-        movl      %edi, 12(%esp)                                #5218.5
-        movl      %esi, %eax                                    #5245.20
-        call      eval_2na_32                                   #5245.20
-                                # LOE eax ebp
-..B1.77:                        # Preds ..B1.76
-        addl      $20, %esp                                     #5245.20
-        popl      %ebx                                          #5245.20
-        popl      %esi                                          #5245.20
-        popl      %edi                                          #5245.20
-        ret                                                     #5245.20
-                                # LOE
-..1.30_0.TAG.03.0.0:
-..B1.79:                        # Preds ..B1.9
-        movl      40(%esp), %edx                                #
-        movl      %ebp, %ecx                                    #
-        movl      16(%esp), %ebp                                #
-                                # LOE edx ecx ebp esi edi
-..B1.80:                        # Preds ..B1.79
-        movl      4(%esi), %eax                                 #5239.24
-        cmpl      %eax, %edi                                    #5239.24
-        jb        ..B1.108      # Prob 28%                      #5239.24
-                                # LOE eax edx ecx ebp esi edi
-..B1.81:                        # Preds ..B1.80
-        movl      52(%esp), %ebx                                #5240.9
-        testl     %ebx, %ebx                                    #5240.9
-        je        ..B1.83       # Prob 12%                      #5240.9
-                                # LOE eax edx ecx ebp esi edi
-..B1.82:                        # Preds ..B1.81
-        movl      52(%esp), %ebx                                #5240.18
-        movl      %eax, (%ebx)                                  #5240.18
-                                # LOE edx ecx ebp esi edi
-..B1.83:                        # Preds ..B1.82 ..B1.81
-        movl      %edi, 12(%esp)                                #5218.5
-        movl      %esi, %eax                                    #5241.20
-        call      eval_2na_16                                   #5241.20
-                                # LOE eax ebp
-..B1.84:                        # Preds ..B1.83
-        addl      $20, %esp                                     #5241.20
-        popl      %ebx                                          #5241.20
-        popl      %esi                                          #5241.20
-        popl      %edi                                          #5241.20
-        ret                                                     #5241.20
-                                # LOE
-..1.30_0.TAG.02.0.0:
-..B1.86:                        # Preds ..B1.9
-        movl      40(%esp), %edx                                #
-        movl      %ebp, %ecx                                    #
-        movl      16(%esp), %ebp                                #
-                                # LOE edx ecx ebp esi edi
-..B1.87:                        # Preds ..B1.86
-        movl      4(%esi), %eax                                 #5235.24
-        cmpl      %eax, %edi                                    #5235.24
-        jb        ..B1.108      # Prob 28%                      #5235.24
-                                # LOE eax edx ecx ebp esi edi
-..B1.88:                        # Preds ..B1.87
-        movl      52(%esp), %ebx                                #5236.9
-        testl     %ebx, %ebx                                    #5236.9
-        je        ..B1.90       # Prob 12%                      #5236.9
-                                # LOE eax edx ecx ebp esi edi
-..B1.89:                        # Preds ..B1.88
-        movl      52(%esp), %ebx                                #5236.18
-        movl      %eax, (%ebx)                                  #5236.18
-                                # LOE edx ecx ebp esi edi
-..B1.90:                        # Preds ..B1.89 ..B1.88
-        movl      %edi, 12(%esp)                                #5218.5
-        movl      %esi, %eax                                    #5237.20
-        call      eval_2na_8                                    #5237.20
-                                # LOE eax ebp
-..B1.91:                        # Preds ..B1.90
-        addl      $20, %esp                                     #5237.20
-        popl      %ebx                                          #5237.20
-        popl      %esi                                          #5237.20
-        popl      %edi                                          #5237.20
-        ret                                                     #5237.20
-                                # LOE
-..1.30_0.TAG.01.0.0:
-..B1.93:                        # Preds ..B1.9
-        movl      40(%esp), %edx                                #
-        movl      %ebp, %ecx                                    #
-        movl      16(%esp), %ebp                                #
-                                # LOE edx ecx ebp esi edi
-..B1.94:                        # Preds ..B1.93
-        movl      4(%esi), %eax                                 #5230.24
-        cmpl      %eax, %edi                                    #5230.24
-        jb        ..B1.108      # Prob 28%                      #5230.24
-                                # LOE eax edx ecx ebp esi edi
-..B1.95:                        # Preds ..B1.94
-        movl      52(%esp), %ebx                                #5231.9
-        testl     %ebx, %ebx                                    #5231.9
-        je        ..B1.97       # Prob 12%                      #5231.9
-                                # LOE eax edx ecx ebp esi edi
-..B1.96:                        # Preds ..B1.95
-        movl      52(%esp), %ebx                                #5231.18
-        movl      %eax, (%ebx)                                  #5231.18
-                                # LOE edx ecx ebp esi edi
-..B1.97:                        # Preds ..B1.96 ..B1.95
-        movl      %edi, 12(%esp)                                #5218.5
-        movl      %esi, %eax                                    #5232.20
-        call      eval_4na_64                                   #5232.20
-                                # LOE eax ebp
-..B1.98:                        # Preds ..B1.97
-        addl      $20, %esp                                     #5232.20
-        popl      %ebx                                          #5232.20
-        popl      %esi                                          #5232.20
-        popl      %edi                                          #5232.20
-        ret                                                     #5232.20
-                                # LOE
-..1.30_0.TAG.00.0.0:
-..B1.100:                       # Preds ..B1.9
-        movl      40(%esp), %edx                                #
-        movl      %ebp, %ecx                                    #
-        movl      16(%esp), %ebp                                #
-                                # LOE edx ecx ebp esi edi
-..B1.101:                       # Preds ..B1.100
-        movl      4(%esi), %eax                                 #5226.24
-        cmpl      %eax, %edi                                    #5226.24
-        jb        ..B1.108      # Prob 28%                      #5226.24
-                                # LOE eax edx ecx ebp esi edi
-..B1.102:                       # Preds ..B1.101
-        movl      52(%esp), %ebx                                #5227.9
-        testl     %ebx, %ebx                                    #5227.9
-        je        ..B1.104      # Prob 12%                      #5227.9
-                                # LOE eax edx ecx ebp esi edi
-..B1.103:                       # Preds ..B1.102
-        movl      52(%esp), %ebx                                #5227.18
-        movl      %eax, (%ebx)                                  #5227.18
-                                # LOE edx ecx ebp esi edi
-..B1.104:                       # Preds ..B1.103 ..B1.102
-        movl      %edi, 12(%esp)                                #5218.5
-        movl      %esi, %eax                                    #5228.20
-        call      eval_2na_64                                   #5228.20
-                                # LOE eax ebp
-..B1.105:                       # Preds ..B1.104
-        addl      $20, %esp                                     #5228.20
-        popl      %ebx                                          #5228.20
-        popl      %esi                                          #5228.20
-        popl      %edi                                          #5228.20
-        ret                                                     #5228.20
-                                # LOE
-..B1.108:                       # Preds ..B1.14 ..B1.17 ..B1.18 ..B1.15 ..B1.16
-                                #       ..B1.5 ..B1.101 ..B1.94 ..B1.87 ..B1.80
-                                #       ..B1.73 ..B1.67 ..B1.60 ..B1.53 ..B1.47
-                                #       ..B1.41 ..B1.35 ..B1.33 ..B1.23 ..B1.3
-                                #       ..B1.2
-        xorl      %eax, %eax                                    #5311.12
-        addl      $20, %esp                                     #5311.12
-        popl      %ebx                                          #5311.12
-        popl      %esi                                          #5311.12
-        popl      %edi                                          #5311.12
-        ret                                                     #5311.12
-                                # LOE
-..B1.112:                       # Preds ..B1.29 ..B1.31         # Infreq
-        movl      16(%esp), %ebp                                #
-        addl      $20, %esp                                     #5281.28
-        popl      %ebx                                          #5281.28
-        popl      %esi                                          #5281.28
-        popl      %edi                                          #5281.28
-        ret                                                     #5281.28
-        .align    2,0x90
-                                # LOE
-# mark_end;
-	.type	NucStrstrSearch, at function
-	.size	NucStrstrSearch,.-NucStrstrSearch
-	.section .data1, "wa"
-	.align 4
-	.align 4
-..1..TPKT.30_0.0.0:
-	.long	..1.30_0.TAG.00.0.0
-	.long	..1.30_0.TAG.01.0.0
-	.long	..1.30_0.TAG.02.0.0
-	.long	..1.30_0.TAG.03.0.0
-	.long	..1.30_0.TAG.04.0.0
-	.long	..1.30_0.TAG.05.0.0
-	.long	..1.30_0.TAG.06.0.0
-	.long	..1.30_0.TAG.07.0.0
-	.long	..1.30_0.TAG.08.0.0
-	.long	..1.30_0.TAG.09.0.0
-	.long	..1.30_0.TAG.0a.0.0
-	.long	..1.30_0.TAG.0b.0.0
-	.long	..1.30_0.TAG.0c.0.0
-	.data
-# -- End  NucStrstrSearch
-	.text
-# -- Begin  eval_2na_64
-# mark_begin;
-       .align    2,0x90
-eval_2na_64:
-# parameter 1: %eax
-# parameter 2: %edx
-# parameter 3: %ecx
-# parameter 4: 20 + %ebp
-..B2.1:                         # Preds ..B2.0
-        pushl     %ebp                                          #3075.1
-        movl      %esp, %ebp                                    #3075.1
-        andl      $-16, %esp                                    #3075.1
-        pushl     %edi                                          #3075.1
-        pushl     %esi                                          #3075.1
-        pushl     %ebx                                          #3075.1
-        subl      $84, %esp                                     #3075.1
-        movl      %ecx, %ebx                                    #3116.49
-        shrl      $2, %ebx                                      #3116.49
-        movl      20(%ebp), %edi                                #3073.5
-        movl      %ebx, 80(%esp)                                #3116.49
-        lea       (%ecx,%edi), %esi                             #3113.5
-        lea       (%edx,%ebx), %ebx                             #3116.30
-        lea       3(%ecx,%edi), %edi                            #3122.50
-        subl      4(%eax), %esi                                 #3119.12
-        movl      %esi, 72(%esp)                                #3119.12
-        movl      80(%esp), %esi                                #3125.14
-        shrl      $2, %edi                                      #3122.57
-        addl      %edx, %edi                                    #3122.30
-        testb     $15, %bl                                      #3125.14
-        jne       ..B2.3        # Prob 50%                      #3125.14
-                                # LOE eax edx ecx ebx esi edi
-..B2.2:                         # Preds ..B2.1
-        movdqa    (%ebx), %xmm0                                 #3125.14
-        movdqa    %xmm0, (%esp)                                 #3125.14
-        jmp       ..B2.4        # Prob 100%                     #3125.14
-                                # LOE eax edx ecx esi edi
-..B2.3:                         # Preds ..B2.1
-        movdqu    (%ebx), %xmm0                                 #3125.14
-        movdqa    %xmm0, (%esp)                                 #3125.14
-                                # LOE eax edx ecx esi edi
-..B2.4:                         # Preds ..B2.2 ..B2.3
-        lea       16(%edx,%esi), %ebx                           #3126.5
-        movl      %ebx, 76(%esp)                                #3126.5
-        cmpl      %edi, %ebx                                    #3131.16
-        jae       ..B2.6        # Prob 12%                      #3131.16
-                                # LOE eax ecx ebx edi bl bh
-..B2.5:                         # Preds ..B2.4
-        movzbl    -1(%ebx), %edx                                #3132.24
-        shll      $8, %edx                                      #3132.38
-        jmp       ..B2.7        # Prob 100%                     #3132.38
-                                # LOE eax edx ecx ebx edi bl bh
-..B2.6:                         # Preds ..B2.4
-        xorl      %edx, %edx                                    #
-                                # LOE eax edx ecx ebx edi bl bh
-..B2.7:                         # Preds ..B2.5 ..B2.6
-        movdqa    16(%eax), %xmm7                               #3136.5
-        movdqa    32(%eax), %xmm6                               #3136.5
-        movdqa    48(%eax), %xmm5                               #3136.5
-        movdqa    64(%eax), %xmm4                               #3136.5
-        movdqa    80(%eax), %xmm3                               #3136.5
-        movdqa    96(%eax), %xmm0                               #3136.5
-        movdqa    112(%eax), %xmm2                              #3136.5
-        movdqa    128(%eax), %xmm1                              #3136.5
-        movl      %ecx, %eax                                    #3148.20
-        andl      $3, %eax                                      #3148.20
-        je        ..B2.43       # Prob 20%                      #3148.20
-                                # LOE eax edx ecx ebx edi bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B2.8:                         # Preds ..B2.7
-        cmpl      $1, %eax                                      #3148.20
-        je        ..B2.14       # Prob 25%                      #3148.20
-                                # LOE eax edx ecx ebx edi bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B2.9:                         # Preds ..B2.8
-        cmpl      $2, %eax                                      #3148.20
-        je        ..B2.13       # Prob 33%                      #3148.20
-                                # LOE eax edx ecx ebx edi bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B2.10:                        # Preds ..B2.9
-        cmpl      $3, %eax                                      #3148.20
-        je        ..B2.12       # Prob 50%                      #3148.20
-                                # LOE edx ecx ebx edi bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B2.11:                        # Preds ..B2.10
-        movdqa    %xmm0, 32(%esp)                               #
-        movdqa    (%esp), %xmm0                                 #
-        movdqa    %xmm7, 48(%esp)                               #
-        movl      %edi, 64(%esp)                                #
-        jmp       ..B2.35       # Prob 100%                     #
-                                # LOE edx ecx ebx bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.12:                        # Preds ..B2.10
-        movdqa    %xmm0, 32(%esp)                               #
-        movdqa    (%esp), %xmm0                                 #
-        movdqa    %xmm7, 48(%esp)                               #
-        movl      %edi, 64(%esp)                                #
-        xorl      %eax, %eax                                    #
-        movl      %eax, 24(%esp)                                #
-        xorl      %esi, %esi                                    #
-        movl      %esi, 28(%esp)                                #
-        movl      %eax, 80(%esp)                                #
-        movl      $8, %esi                                      #
-        jmp       ..B2.17       # Prob 100%                     #
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.13:                        # Preds ..B2.9
-        movdqa    %xmm0, 32(%esp)                               #
-        movdqa    (%esp), %xmm0                                 #
-        movdqa    %xmm7, 48(%esp)                               #
-        movl      %edi, 64(%esp)                                #
-        xorl      %eax, %eax                                    #
-        movl      %eax, 28(%esp)                                #
-        movl      %eax, 80(%esp)                                #
-        movl      $8, %esi                                      #
-        jmp       ..B2.16       # Prob 100%                     #
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.14:                        # Preds ..B2.8
-        movdqa    %xmm0, 32(%esp)                               #
-        movdqa    (%esp), %xmm0                                 #
-        movdqa    %xmm7, 48(%esp)                               #
-        movl      %edi, 64(%esp)                                #
-        xorl      %eax, %eax                                    #
-        movl      %eax, 80(%esp)                                #
-        movl      $8, %esi                                      #
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.15:                        # Preds ..B2.14 ..B2.39
-        movdqa    %xmm0, %xmm7                                  #3171.22
-        pand      %xmm4, %xmm7                                  #3171.22
-        pcmpeqd   %xmm5, %xmm7                                  #3172.22
-        pmovmskb  %xmm7, %eax                                   #3173.22
-        movl      %eax, %edi                                    #3174.17
-        andl      $3855, %edi                                   #3174.17
-        shll      $4, %edi                                      #3174.17
-        andl      %edi, %eax                                    #3174.17
-        movl      %eax, %edi                                    #3174.17
-        sarl      $4, %edi                                      #3174.17
-        orl       %edi, %eax                                    #3174.17
-        movl      %eax, 28(%esp)                                #3174.17
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.16:                        # Preds ..B2.13 ..B2.15
-        movdqa    %xmm0, %xmm7                                  #3177.22
-        pand      32(%esp), %xmm7                               #3177.22
-        pcmpeqd   %xmm3, %xmm7                                  #3178.22
-        pmovmskb  %xmm7, %eax                                   #3179.22
-        movl      %eax, %edi                                    #3180.17
-        andl      $3855, %edi                                   #3180.17
-        shll      $4, %edi                                      #3180.17
-        andl      %edi, %eax                                    #3180.17
-        movl      %eax, %edi                                    #3180.17
-        sarl      $4, %edi                                      #3180.17
-        orl       %edi, %eax                                    #3180.17
-        movl      %eax, 24(%esp)                                #3180.17
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.17:                        # Preds ..B2.12 ..B2.16
-        movdqa    %xmm0, %xmm7                                  #3183.22
-        pand      %xmm1, %xmm7                                  #3183.22
-        pcmpeqd   %xmm2, %xmm7                                  #3184.22
-        pmovmskb  %xmm7, %eax                                   #3185.22
-        movl      %eax, %edi                                    #3186.17
-        andl      $3855, %edi                                   #3186.17
-        shll      $4, %edi                                      #3186.17
-        andl      %edi, %eax                                    #3186.17
-        movl      %eax, %edi                                    #3186.17
-        sarl      $4, %edi                                      #3186.17
-        orl       %edi, %eax                                    #3186.17
-        movl      %eax, 68(%esp)                                #3186.17
-        movl      %ecx, %edi                                    #3190.17
-        movl      80(%esp), %ecx                                #3193.29
-        andl      $-4, %edi                                     #3190.17
-        orl       28(%esp), %ecx                                #3193.29
-        orl       24(%esp), %ecx                                #3193.34
-        orl       %eax, %ecx                                    #3193.39
-        je        ..B2.26       # Prob 78%                      #3193.47
-                                # LOE edx ebx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.18:                        # Preds ..B2.17
-        movl      %ebx, 16(%esp)                                #
-        movl      80(%esp), %ebx                                #3211.58
-        movl      %edx, 20(%esp)                                #
-        movzwl    %bx, %eax                                     #3211.58
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #3211.30
-        movswl    %ax, %eax                                     #3211.30
-        movl      %eax, (%esp)                                  #3211.30
-        movl      28(%esp), %eax                                #3212.58
-        movzwl    %ax, %eax                                     #3212.58
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #3212.30
-        movswl    %ax, %edx                                     #3212.30
-        lea       1(,%edx,4), %edx                              #3220.40
-        movl      24(%esp), %eax                                #3213.58
-        movzwl    %ax, %eax                                     #3213.58
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #3213.30
-        movswl    %ax, %ecx                                     #3213.30
-        movl      68(%esp), %eax                                #3214.58
-        movzwl    %ax, %eax                                     #3214.58
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #3214.30
-        movl      %edx, 4(%esp)                                 #3220.40
-        movswl    %ax, %eax                                     #3214.30
-        lea       2(,%ecx,4), %edx                              #3221.40
-        movl      %edx, 8(%esp)                                 #3221.40
-        movl      20(%esp), %edx                                #3226.32
-        lea       3(,%eax,4), %eax                              #3222.40
-        testl     %ebx, %ebx                                    #3226.32
-        movl      16(%esp), %ebx                                #3226.32
-        movl      %eax, 12(%esp)                                #3222.40
-        je        ..B2.20       # Prob 50%                      #3226.32
-                                # LOE edx ebx esi edi dl bl dh bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.19:                        # Preds ..B2.18
-        movl      (%esp), %eax                                  #3226.43
-        movl      72(%esp), %ecx                                #3226.49
-        lea       (%edi,%eax,4), %eax                           #3226.43
-        cmpl      %eax, %ecx                                    #3226.49
-        jae       ..B2.44       # Prob 1%                       #3226.49
-                                # LOE edx ebx esi edi dl bl dh bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.20:                        # Preds ..B2.19 ..B2.18
-        movl      28(%esp), %eax                                #3227.32
-        testl     %eax, %eax                                    #3227.32
-        je        ..B2.22       # Prob 50%                      #3227.32
-                                # LOE edx ebx esi edi dl bl dh bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.21:                        # Preds ..B2.20
-        movl      4(%esp), %ecx                                 #3227.43
-        movl      72(%esp), %eax                                #3227.49
-        addl      %edi, %ecx                                    #3227.43
-        cmpl      %ecx, %eax                                    #3227.49
-        jae       ..B2.44       # Prob 1%                       #3227.49
-                                # LOE edx ebx esi edi dl bl dh bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.22:                        # Preds ..B2.21 ..B2.20
-        movl      24(%esp), %eax                                #3228.32
-        testl     %eax, %eax                                    #3228.32
-        je        ..B2.24       # Prob 50%                      #3228.32
-                                # LOE edx ebx esi edi dl bl dh bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.23:                        # Preds ..B2.22
-        movl      8(%esp), %ecx                                 #3228.43
-        movl      72(%esp), %eax                                #3228.49
-        addl      %edi, %ecx                                    #3228.43
-        cmpl      %ecx, %eax                                    #3228.49
-        jae       ..B2.44       # Prob 1%                       #3228.49
-                                # LOE edx ebx esi edi dl bl dh bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.24:                        # Preds ..B2.23 ..B2.22
-        movl      68(%esp), %eax                                #3229.32
-        testl     %eax, %eax                                    #3229.32
-        je        ..B2.26       # Prob 50%                      #3229.32
-                                # LOE edx ebx esi edi dl bl dh bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.25:                        # Preds ..B2.24
-        movl      12(%esp), %ecx                                #3229.43
-        movl      72(%esp), %eax                                #3229.49
-        addl      %edi, %ecx                                    #3229.43
-        cmpl      %ecx, %eax                                    #3229.49
-        jae       ..B2.44       # Prob 1%                       #3229.49
-                                # LOE edx ebx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.26:                        # Preds ..B2.25 ..B2.24 ..B2.17
-        movl      72(%esp), %eax                                #3237.28
-        lea       4(%edi), %ecx                                 #3234.17
-        cmpl      %eax, %ecx                                    #3237.28
-        ja        ..B2.41       # Prob 1%                       #3237.28
-                                # LOE edx ecx ebx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.27:                        # Preds ..B2.26
-        addl      $-1, %esi                                     #3241.25
-        jne       ..B2.36       # Prob 50%                      #3241.39
-                                # LOE edx ecx ebx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.28:                        # Preds ..B2.27
-        movl      64(%esp), %eax                                #3262.25
-        cmpl      %eax, %ebx                                    #3262.25
-        jae       ..B2.41       # Prob 1%                       #3262.25
-                                # LOE edx ebx edi xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.29:                        # Preds ..B2.28
-        movl      72(%esp), %eax                                #3267.24
-        lea       36(%edi), %ecx                                #3266.13
-        cmpl      %eax, %ecx                                    #3267.24
-        ja        ..B2.41       # Prob 1%                       #3267.24
-                                # LOE edx ecx ebx xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.30:                        # Preds ..B2.29
-        testb     $15, %bl                                      #3272.22
-        jne       ..B2.32       # Prob 50%                      #3272.22
-                                # LOE edx ecx ebx xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.31:                        # Preds ..B2.30
-        movdqa    (%ebx), %xmm0                                 #3272.22
-        jmp       ..B2.33       # Prob 100%                     #3272.22
-                                # LOE edx ecx ebx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.32:                        # Preds ..B2.30
-        movdqu    (%ebx), %xmm0                                 #3272.22
-                                # LOE edx ecx ebx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.33:                        # Preds ..B2.31 ..B2.32
-        movl      64(%esp), %eax                                #3353.24
-        addl      $16, %ebx                                     #3350.13
-        movl      %ebx, 76(%esp)                                #3350.13
-        cmpl      %eax, %ebx                                    #3353.24
-        jae       ..B2.35       # Prob 12%                      #3353.24
-                                # LOE edx ecx ebx bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.34:                        # Preds ..B2.33
-        movzbl    -1(%ebx), %edx                                #3354.32
-        shll      $8, %edx                                      #3354.46
-                                # LOE edx ecx ebx bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.35:                        # Preds ..B2.33 ..B2.11 ..B2.34
-        movl      $8, %esi                                      #3155.13
-        jmp       ..B2.39       # Prob 100%                     #3155.13
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.36:                        # Preds ..B2.27
-        movl      76(%esp), %eax                                #3249.26
-        movl      64(%esp), %edi                                #3249.26
-        psrldq    $1, %xmm0                                     #3246.26
-        cmpl      %edi, %eax                                    #3249.26
-        jae       ..B2.38       # Prob 19%                      #3249.26
-                                # LOE eax edx ecx ebx esi al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.37:                        # Preds ..B2.36
-        movzbl    (%eax), %edi                                  #3252.37
-        sarl      $8, %edx                                      #3251.21
-        shll      $8, %edi                                      #3252.48
-        orl       %edi, %edx                                    #3252.21
-        pinsrw    $7, %edx, %xmm0                               #3253.30
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.38:                        # Preds ..B2.37 ..B2.36
-        addl      $1, 76(%esp)                                  #3257.20
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.39:                        # Preds ..B2.35 ..B2.38 ..B2.43
-        movdqa    %xmm0, %xmm7                                  #3165.22
-        pand      %xmm6, %xmm7                                  #3165.22
-        pcmpeqd   48(%esp), %xmm7                               #3166.22
-        pmovmskb  %xmm7, %eax                                   #3167.22
-        movl      %eax, %edi                                    #3168.17
-        andl      $3855, %edi                                   #3168.17
-        shll      $4, %edi                                      #3168.17
-        andl      %edi, %eax                                    #3168.17
-        movl      %eax, %edi                                    #3168.17
-        sarl      $4, %edi                                      #3168.17
-        orl       %edi, %eax                                    #3168.17
-        movl      %eax, 80(%esp)                                #3168.17
-        jmp       ..B2.15       # Prob 100%                     #3168.17
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.41:                        # Preds ..B2.26 ..B2.28 ..B2.29 # Infreq
-        xorl      %eax, %eax                                    #3363.12
-        addl      $84, %esp                                     #3363.12
-        popl      %ebx                                          #3363.12
-        popl      %esi                                          #3363.12
-        popl      %edi                                          #3363.12
-        movl      %ebp, %esp                                    #3363.12
-        popl      %ebp                                          #3363.12
-        ret                                                     #3363.12
-                                # LOE
-..B2.43:                        # Preds ..B2.7                  # Infreq
-        movdqa    %xmm0, 32(%esp)                               #
-        movdqa    (%esp), %xmm0                                 #
-        movdqa    %xmm7, 48(%esp)                               #
-        movl      %edi, 64(%esp)                                #
-        movl      $8, %esi                                      #
-        jmp       ..B2.39       # Prob 100%                     #
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B2.44:                        # Preds ..B2.21 ..B2.19 ..B2.25 ..B2.23 # Infreq
-        movl      $1, %eax                                      #3228.63
-        addl      $84, %esp                                     #3228.63
-        popl      %ebx                                          #3228.63
-        popl      %esi                                          #3228.63
-        popl      %edi                                          #3228.63
-        movl      %ebp, %esp                                    #3228.63
-        popl      %ebp                                          #3228.63
-        ret                                                     #3228.63
-        .align    2,0x90
-                                # LOE
-# mark_end;
-	.type	eval_2na_64, at function
-	.size	eval_2na_64,.-eval_2na_64
-	.data
-# -- End  eval_2na_64
-	.text
-# -- Begin  eval_4na_64
-# mark_begin;
-       .align    2,0x90
-eval_4na_64:
-# parameter 1: %eax
-# parameter 2: %edx
-# parameter 3: %ecx
-# parameter 4: 20 + %ebp
-..B3.1:                         # Preds ..B3.0
-        pushl     %ebp                                          #4501.1
-        movl      %esp, %ebp                                    #4501.1
-        andl      $-16, %esp                                    #4501.1
-        pushl     %edi                                          #4501.1
-        pushl     %esi                                          #4501.1
-        pushl     %ebx                                          #4501.1
-        subl      $132, %esp                                    #4501.1
-        movdqa    16(%eax), %xmm5                               #4554.5
-        movdqa    32(%eax), %xmm6                               #4554.5
-        movl      20(%ebp), %ebx                                #4499.5
-        movdqa    48(%eax), %xmm4                               #4554.5
-        movdqa    64(%eax), %xmm3                               #4554.5
-        movdqa    80(%eax), %xmm2                               #4554.5
-        movdqa    96(%eax), %xmm1                               #4554.5
-        movdqa    128(%eax), %xmm7                              #4554.5
-        movl      %ecx, %edi                                    #4538.49
-        shrl      $2, %edi                                      #4538.49
-        call      ..L2          # Prob 100%                     #4501.1
-..L2:                                                           #
-        popl      %esi                                          #4501.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L2], %esi       #4501.1
-        movl      %esi, 32(%esp)                                #4501.1
-        lea       (%ecx,%ebx), %esi                             #4535.5
-        lea       3(%ecx,%ebx), %ebx                            #4544.50
-        shrl      $2, %ebx                                      #4544.57
-        subl      4(%eax), %esi                                 #4541.12
-        movl      %esi, 112(%esp)                               #4541.12
-        movzbl    (%edi,%edx), %esi                             #4547.14
-        addl      %edx, %ebx                                    #4544.30
-        movl      %ebx, 116(%esp)                               #4544.30
-        movl      32(%esp), %ebx                                #4547.14
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%esi,2), %esi        #4547.14
-        movw      %si, (%esp)                                   #4547.14
-        movzbl    1(%edi,%edx), %esi                            #4547.14
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%esi,2), %esi        #4547.14
-        movw      %si, 2(%esp)                                  #4547.14
-        movzbl    2(%edi,%edx), %esi                            #4547.14
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%esi,2), %esi        #4547.14
-        movw      %si, 4(%esp)                                  #4547.14
-        movzbl    3(%edi,%edx), %esi                            #4547.14
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%esi,2), %esi        #4547.14
-        movw      %si, 6(%esp)                                  #4547.14
-        movzbl    4(%edi,%edx), %esi                            #4547.14
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%esi,2), %esi        #4547.14
-        movw      %si, 8(%esp)                                  #4547.14
-        movzbl    5(%edi,%edx), %esi                            #4547.14
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%esi,2), %esi        #4547.14
-        movw      %si, 10(%esp)                                 #4547.14
-        movzbl    6(%edi,%edx), %esi                            #4547.14
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%esi,2), %esi        #4547.14
-        movw      %si, 12(%esp)                                 #4547.14
-        movzbl    7(%edi,%edx), %esi                            #4547.14
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%esi,2), %esi        #4547.14
-        movw      %si, 14(%esp)                                 #4547.14
-        movdqu    (%esp), %xmm0                                 #4547.14
-        lea       8(%edx,%edi), %esi                            #4548.5
-        movdqa    %xmm0, 16(%esp)                               #4547.14
-        movdqa    112(%eax), %xmm0                              #4554.5
-        movl      %esi, %edx                                    #4548.5
-        movl      %ecx, %eax                                    #4568.20
-        andl      $3, %eax                                      #4568.20
-        je        ..B3.33       # Prob 20%                      #4568.20
-                                # LOE eax edx ecx ebx esi bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B3.2:                         # Preds ..B3.1
-        cmpl      $1, %eax                                      #4568.20
-        je        ..B3.8        # Prob 25%                      #4568.20
-                                # LOE eax edx ecx ebx esi bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B3.3:                         # Preds ..B3.2
-        cmpl      $2, %eax                                      #4568.20
-        je        ..B3.7        # Prob 33%                      #4568.20
-                                # LOE eax edx ecx ebx esi bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B3.4:                         # Preds ..B3.3
-        cmpl      $3, %eax                                      #4568.20
-        je        ..B3.6        # Prob 50%                      #4568.20
-                                # LOE edx ecx ebx esi bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B3.5:                         # Preds ..B3.4
-        movdqa    %xmm7, 80(%esp)                               #
-        movdqa    %xmm0, 48(%esp)                               #
-        movdqa    16(%esp), %xmm0                               #
-        movdqa    %xmm6, 64(%esp)                               #
-        movl      %ecx, 96(%esp)                                #
-        jmp       ..B3.25       # Prob 100%                     #
-                                # LOE edx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.6:                         # Preds ..B3.4
-        movdqa    %xmm7, 80(%esp)                               #
-        movdqa    %xmm0, 48(%esp)                               #
-        movdqa    16(%esp), %xmm0                               #
-        movdqa    %xmm6, 64(%esp)                               #
-        xorl      %eax, %eax                                    #
-        movl      %eax, 40(%esp)                                #
-        movl      %ecx, 96(%esp)                                #
-        xorl      %edi, %edi                                    #
-        movl      $4, %eax                                      #
-        movl      %edi, 44(%esp)                                #
-        movl      %edi, 100(%esp)                               #
-        jmp       ..B3.11       # Prob 100%                     #
-                                # LOE eax edx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.7:                         # Preds ..B3.3
-        movdqa    %xmm7, 80(%esp)                               #
-        movdqa    %xmm0, 48(%esp)                               #
-        movdqa    16(%esp), %xmm0                               #
-        movdqa    %xmm6, 64(%esp)                               #
-        xorl      %eax, %eax                                    #
-        movl      %eax, 44(%esp)                                #
-        movl      %ecx, 96(%esp)                                #
-        xorl      %edi, %edi                                    #
-        movl      $4, %eax                                      #
-        movl      %edi, 100(%esp)                               #
-        jmp       ..B3.10       # Prob 100%                     #
-                                # LOE eax edx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.8:                         # Preds ..B3.2
-        movdqa    %xmm7, 80(%esp)                               #
-        movdqa    %xmm0, 48(%esp)                               #
-        movdqa    16(%esp), %xmm0                               #
-        movdqa    %xmm6, 64(%esp)                               #
-        xorl      %edi, %edi                                    #
-        movl      %ecx, 96(%esp)                                #
-        movl      %edi, 100(%esp)                               #
-        movl      $4, %eax                                      #
-                                # LOE eax edx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.9:                         # Preds ..B3.8 ..B3.29
-        movdqa    %xmm0, %xmm7                                  #4592.22
-        movdqa    %xmm0, %xmm6                                  #4593.22
-        pand      %xmm4, %xmm7                                  #4592.22
-        pand      %xmm3, %xmm6                                  #4593.22
-        pcmpeqd   %xmm6, %xmm7                                  #4594.22
-        pmovmskb  %xmm7, %ecx                                   #4595.22
-        movl      %ecx, %edi                                    #4596.17
-        andl      $3855, %edi                                   #4596.17
-        shll      $4, %edi                                      #4596.17
-        andl      %edi, %ecx                                    #4596.17
-        movl      %ecx, %edi                                    #4596.17
-        sarl      $4, %edi                                      #4596.17
-        orl       %edi, %ecx                                    #4596.17
-        movl      %ecx, 44(%esp)                                #4596.17
-                                # LOE eax edx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.10:                        # Preds ..B3.7 ..B3.9
-        movdqa    %xmm0, %xmm7                                  #4599.22
-        movdqa    %xmm0, %xmm6                                  #4600.22
-        pand      %xmm2, %xmm7                                  #4599.22
-        pand      %xmm1, %xmm6                                  #4600.22
-        pcmpeqd   %xmm6, %xmm7                                  #4601.22
-        pmovmskb  %xmm7, %ecx                                   #4602.22
-        movl      %ecx, %edi                                    #4603.17
-        andl      $3855, %edi                                   #4603.17
-        shll      $4, %edi                                      #4603.17
-        andl      %edi, %ecx                                    #4603.17
-        movl      %ecx, %edi                                    #4603.17
-        sarl      $4, %edi                                      #4603.17
-        orl       %edi, %ecx                                    #4603.17
-        movl      %ecx, 40(%esp)                                #4603.17
-                                # LOE eax edx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.11:                        # Preds ..B3.6 ..B3.10
-        movdqa    %xmm0, %xmm7                                  #4606.22
-        movdqa    %xmm0, %xmm6                                  #4607.22
-        pand      48(%esp), %xmm7                               #4606.22
-        pand      80(%esp), %xmm6                               #4607.22
-        pcmpeqd   %xmm6, %xmm7                                  #4608.22
-        pmovmskb  %xmm7, %ecx                                   #4609.22
-        movl      %ecx, %edi                                    #4610.17
-        andl      $3855, %edi                                   #4610.17
-        shll      $4, %edi                                      #4610.17
-        andl      %edi, %ecx                                    #4610.17
-        movl      %ecx, %edi                                    #4610.17
-        sarl      $4, %edi                                      #4610.17
-        orl       %edi, %ecx                                    #4610.17
-        movl      96(%esp), %edi                                #4614.17
-        movl      %ecx, 104(%esp)                               #4610.17
-        andl      $-4, %edi                                     #4614.17
-        movl      %edi, 108(%esp)                               #4614.17
-        movl      100(%esp), %edi                               #4617.29
-        orl       44(%esp), %edi                                #4617.29
-        orl       40(%esp), %edi                                #4617.34
-        orl       %ecx, %edi                                    #4617.39
-        je        ..B3.20       # Prob 78%                      #4617.47
-                                # LOE eax edx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.12:                        # Preds ..B3.11
-        movl      100(%esp), %edi                               #4635.58
-        movl      %eax, 28(%esp)                                #
-        movl      %esi, 32(%esp)                                #
-        movzwl    %di, %eax                                     #4635.58
-        movl      %edx, 36(%esp)                                #
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4635.30
-        movswl    %ax, %eax                                     #4635.30
-        movl      %eax, 16(%esp)                                #4635.30
-        movl      44(%esp), %eax                                #4636.58
-        movzwl    %ax, %eax                                     #4636.58
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4636.30
-        movswl    %ax, %esi                                     #4636.30
-        movl      40(%esp), %eax                                #4637.58
-        movzwl    %ax, %eax                                     #4637.58
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4637.30
-        movswl    %ax, %ecx                                     #4637.30
-        movl      104(%esp), %eax                               #4638.58
-        movzwl    %ax, %eax                                     #4638.58
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4638.30
-        movswl    %ax, %edx                                     #4638.30
-        lea       1(%esi,%esi), %eax                            #4644.40
-        movl      32(%esp), %esi                                #4650.32
-        movl      %eax, 20(%esp)                                #4644.40
-        lea       2(%ecx,%ecx), %eax                            #4645.40
-        testl     %edi, %edi                                    #4650.32
-        movl      %eax, 24(%esp)                                #4645.40
-        lea       3(%edx,%edx), %eax                            #4646.40
-        movl      36(%esp), %edx                                #4650.32
-        movl      %eax, 96(%esp)                                #4646.40
-        movl      28(%esp), %eax                                #4650.32
-        je        ..B3.14       # Prob 50%                      #4650.32
-                                # LOE eax edx ebx esi al dl ah dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.13:                        # Preds ..B3.12
-        movl      16(%esp), %edi                                #4650.43
-        movl      108(%esp), %ecx                               #4650.43
-        lea       (%ecx,%edi,2), %edi                           #4650.43
-        movl      112(%esp), %ecx                               #4650.49
-        cmpl      %edi, %ecx                                    #4650.49
-        jae       ..B3.34       # Prob 1%                       #4650.49
-                                # LOE eax edx ebx esi al dl ah dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.14:                        # Preds ..B3.13 ..B3.12
-        movl      44(%esp), %ecx                                #4651.32
-        testl     %ecx, %ecx                                    #4651.32
-        je        ..B3.16       # Prob 50%                      #4651.32
-                                # LOE eax edx ebx esi al dl ah dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.15:                        # Preds ..B3.14
-        movl      20(%esp), %edi                                #4651.43
-        addl      108(%esp), %edi                               #4651.43
-        movl      112(%esp), %ecx                               #4651.49
-        cmpl      %edi, %ecx                                    #4651.49
-        jae       ..B3.34       # Prob 1%                       #4651.49
-                                # LOE eax edx ebx esi al dl ah dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.16:                        # Preds ..B3.15 ..B3.14
-        movl      40(%esp), %ecx                                #4652.32
-        testl     %ecx, %ecx                                    #4652.32
-        je        ..B3.18       # Prob 50%                      #4652.32
-                                # LOE eax edx ebx esi al dl ah dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.17:                        # Preds ..B3.16
-        movl      24(%esp), %edi                                #4652.43
-        addl      108(%esp), %edi                               #4652.43
-        movl      112(%esp), %ecx                               #4652.49
-        cmpl      %edi, %ecx                                    #4652.49
-        jae       ..B3.34       # Prob 1%                       #4652.49
-                                # LOE eax edx ebx esi al dl ah dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.18:                        # Preds ..B3.17 ..B3.16
-        movl      104(%esp), %ecx                               #4653.32
-        testl     %ecx, %ecx                                    #4653.32
-        je        ..B3.20       # Prob 50%                      #4653.32
-                                # LOE eax edx ebx esi al dl ah dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.19:                        # Preds ..B3.18
-        movl      96(%esp), %edi                                #4653.43
-        addl      108(%esp), %edi                               #4653.43
-        movl      112(%esp), %ecx                               #4653.49
-        cmpl      %edi, %ecx                                    #4653.49
-        jae       ..B3.34       # Prob 1%                       #4653.49
-                                # LOE eax edx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.20:                        # Preds ..B3.19 ..B3.18 ..B3.11
-        movl      108(%esp), %ecx                               #4658.17
-        lea       4(%ecx), %edi                                 #4658.17
-        movl      112(%esp), %ecx                               #4661.28
-        movl      %edi, 96(%esp)                                #4658.17
-        cmpl      %ecx, %edi                                    #4661.28
-        ja        ..B3.31       # Prob 1%                       #4661.28
-                                # LOE eax edx ecx ebx esi cl ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.21:                        # Preds ..B3.20
-        addl      $-1, %eax                                     #4665.25
-        jne       ..B3.26       # Prob 50%                      #4665.39
-                                # LOE eax edx ecx ebx esi cl ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.22:                        # Preds ..B3.21
-        movl      116(%esp), %eax                               #4682.25
-        cmpl      %eax, %esi                                    #4682.25
-        jae       ..B3.31       # Prob 1%                       #4682.25
-                                # LOE ecx ebx esi cl ch xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.23:                        # Preds ..B3.22
-        movl      108(%esp), %eax                               #4686.13
-        lea       20(%eax), %edx                                #4686.13
-        movl      %edx, 96(%esp)                                #4686.13
-        cmpl      %ecx, %edx                                    #4687.24
-        ja        ..B3.31       # Prob 1%                       #4687.24
-                                # LOE ebx esi xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.24:                        # Preds ..B3.23
-        movzbl    (%esi), %eax                                  #4692.22
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%eax,2), %edx        #4692.22
-        movzbl    1(%esi), %ecx                                 #4692.22
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%ecx,2), %edi        #4692.22
-        movzbl    2(%esi), %eax                                 #4692.22
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%eax,2), %eax        #4692.22
-        movw      %dx, (%esp)                                   #4692.22
-        movw      %di, 2(%esp)                                  #4692.22
-        movw      %ax, 4(%esp)                                  #4692.22
-        movzbl    3(%esi), %eax                                 #4692.22
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%eax,2), %eax        #4692.22
-        movw      %ax, 6(%esp)                                  #4692.22
-        movzbl    4(%esi), %eax                                 #4692.22
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%eax,2), %eax        #4692.22
-        movw      %ax, 8(%esp)                                  #4692.22
-        movzbl    5(%esi), %eax                                 #4692.22
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%eax,2), %eax        #4692.22
-        movw      %ax, 10(%esp)                                 #4692.22
-        movzbl    6(%esi), %eax                                 #4692.22
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%eax,2), %eax        #4692.22
-        movw      %ax, 12(%esp)                                 #4692.22
-        movzbl    7(%esi), %eax                                 #4692.22
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%eax,2), %eax        #4692.22
-        addl      $8, %esi                                      #4707.13
-        movl      %esi, %edx                                    #4707.13
-        movw      %ax, 14(%esp)                                 #4692.22
-        movdqu    (%esp), %xmm0                                 #4692.22
-                                # LOE edx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.25:                        # Preds ..B3.5 ..B3.24
-        movl      $4, %eax                                      #4575.13
-        jmp       ..B3.29       # Prob 100%                     #4575.13
-                                # LOE eax edx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.26:                        # Preds ..B3.21
-        movl      116(%esp), %ecx                               #4673.26
-        psrldq    $2, %xmm0                                     #4670.26
-        cmpl      %ecx, %edx                                    #4673.26
-        jae       ..B3.28       # Prob 19%                      #4673.26
-                                # LOE eax edx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.27:                        # Preds ..B3.26
-        movzbl    (%edx), %ecx                                  #4674.72
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%ecx,2), %edi        #4674.57
-        pinsrw    $7, %edi, %xmm0                               #4674.30
-                                # LOE eax edx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.28:                        # Preds ..B3.27 ..B3.26
-        addl      $1, %edx                                      #4677.20
-                                # LOE eax edx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.29:                        # Preds ..B3.25 ..B3.28 ..B3.33
-        movdqa    %xmm0, %xmm7                                  #4585.22
-        movdqa    %xmm0, %xmm6                                  #4586.22
-        pand      64(%esp), %xmm6                               #4586.22
-        pand      %xmm5, %xmm7                                  #4585.22
-        pcmpeqd   %xmm6, %xmm7                                  #4587.22
-        pmovmskb  %xmm7, %ecx                                   #4588.22
-        movl      %ecx, %edi                                    #4589.17
-        andl      $3855, %edi                                   #4589.17
-        shll      $4, %edi                                      #4589.17
-        andl      %edi, %ecx                                    #4589.17
-        movl      %ecx, %edi                                    #4589.17
-        sarl      $4, %edi                                      #4589.17
-        orl       %edi, %ecx                                    #4589.17
-        movl      %ecx, 100(%esp)                               #4589.17
-        jmp       ..B3.9        # Prob 100%                     #4589.17
-                                # LOE eax edx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.31:                        # Preds ..B3.20 ..B3.22 ..B3.23 # Infreq
-        xorl      %eax, %eax                                    #4718.12
-        addl      $132, %esp                                    #4718.12
-        popl      %ebx                                          #4718.12
-        popl      %esi                                          #4718.12
-        popl      %edi                                          #4718.12
-        movl      %ebp, %esp                                    #4718.12
-        popl      %ebp                                          #4718.12
-        ret                                                     #4718.12
-                                # LOE
-..B3.33:                        # Preds ..B3.1                  # Infreq
-        movdqa    %xmm7, 80(%esp)                               #
-        movdqa    %xmm0, 48(%esp)                               #
-        movdqa    16(%esp), %xmm0                               #
-        movdqa    %xmm6, 64(%esp)                               #
-        movl      $4, %eax                                      #
-        movl      %ecx, 96(%esp)                                #
-        jmp       ..B3.29       # Prob 100%                     #
-                                # LOE eax edx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B3.34:                        # Preds ..B3.13 ..B3.19 ..B3.17 ..B3.15 # Infreq
-        movl      $1, %eax                                      #4651.63
-        addl      $132, %esp                                    #4651.63
-        popl      %ebx                                          #4651.63
-        popl      %esi                                          #4651.63
-        popl      %edi                                          #4651.63
-        movl      %ebp, %esp                                    #4651.63
-        popl      %ebp                                          #4651.63
-        ret                                                     #4651.63
-        .align    2,0x90
-                                # LOE
-# mark_end;
-	.type	eval_4na_64, at function
-	.size	eval_4na_64,.-eval_4na_64
-	.data
-# -- End  eval_4na_64
-	.text
-# -- Begin  eval_2na_8
-# mark_begin;
-       .align    2,0x90
-eval_2na_8:
-# parameter 1: %eax
-# parameter 2: %edx
-# parameter 3: %ecx
-# parameter 4: 20 + %ebp
-..B4.1:                         # Preds ..B4.0
-        pushl     %ebp                                          #2196.1
-        movl      %esp, %ebp                                    #2196.1
-        andl      $-16, %esp                                    #2196.1
-        pushl     %edi                                          #2196.1
-        pushl     %esi                                          #2196.1
-        pushl     %ebx                                          #2196.1
-        subl      $84, %esp                                     #2196.1
-        movl      %ecx, %esi                                    #2236.49
-        shrl      $2, %esi                                      #2236.49
-        movl      20(%ebp), %ebx                                #2194.5
-        movl      %esi, 68(%esp)                                #2236.49
-        lea       (%ecx,%ebx), %edi                             #2233.5
-        lea       (%edx,%esi), %esi                             #2236.30
-        lea       3(%ecx,%ebx), %ebx                            #2242.50
-        subl      4(%eax), %edi                                 #2239.12
-        movl      %edi, 64(%esp)                                #2239.12
-        movl      68(%esp), %edi                                #2245.14
-        shrl      $2, %ebx                                      #2242.57
-        addl      %edx, %ebx                                    #2242.30
-        testl     $15, %esi                                     #2245.14
-        jne       ..B4.3        # Prob 50%                      #2245.14
-                                # LOE eax edx ecx ebx esi edi
-..B4.2:                         # Preds ..B4.1
-        movdqa    (%esi), %xmm0                                 #2245.14
-        movdqa    %xmm0, 48(%esp)                               #2245.14
-        jmp       ..B4.4        # Prob 100%                     #2245.14
-                                # LOE eax edx ecx ebx edi
-..B4.3:                         # Preds ..B4.1
-        movdqu    (%esi), %xmm0                                 #2245.14
-        movdqa    %xmm0, 48(%esp)                               #2245.14
-                                # LOE eax edx ecx ebx edi
-..B4.4:                         # Preds ..B4.2 ..B4.3
-        movdqa    16(%eax), %xmm7                               #2256.5
-        movdqa    32(%eax), %xmm6                               #2256.5
-        movdqa    48(%eax), %xmm5                               #2256.5
-        movdqa    64(%eax), %xmm4                               #2256.5
-        movdqa    80(%eax), %xmm3                               #2256.5
-        movdqa    96(%eax), %xmm2                               #2256.5
-        movdqa    112(%eax), %xmm1                              #2256.5
-        movdqa    128(%eax), %xmm0                              #2256.5
-        lea       16(%edx,%edi), %edi                           #2246.5
-        movl      %ecx, %eax                                    #2268.20
-        andl      $3, %eax                                      #2268.20
-        je        ..B4.8        # Prob 20%                      #2268.20
-                                # LOE eax ecx ebx edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B4.5:                         # Preds ..B4.4
-        cmpl      $1, %eax                                      #2268.20
-        je        ..B4.11       # Prob 25%                      #2268.20
-                                # LOE eax ecx ebx edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B4.6:                         # Preds ..B4.5
-        cmpl      $2, %eax                                      #2268.20
-        je        ..B4.10       # Prob 33%                      #2268.20
-                                # LOE eax ecx ebx edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B4.7:                         # Preds ..B4.6
-        cmpl      $3, %eax                                      #2268.20
-        je        ..B4.9        # Prob 50%                      #2268.20
-                                # LOE ecx ebx edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B4.8:                         # Preds ..B4.4 ..B4.7
-        movdqa    %xmm7, 32(%esp)                               #
-        movl      %ebx, 28(%esp)                                #
-        jmp       ..B4.30       # Prob 100%                     #
-                                # LOE ecx edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.9:                         # Preds ..B4.7
-        movdqa    %xmm7, 32(%esp)                               #
-        movl      %ebx, 28(%esp)                                #
-        xorl      %eax, %eax                                    #
-        movl      %eax, 68(%esp)                                #
-        xorl      %edx, %edx                                    #
-        xorl      %esi, %esi                                    #
-        jmp       ..B4.14       # Prob 100%                     #
-                                # LOE edx ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.10:                        # Preds ..B4.6
-        movdqa    %xmm7, 32(%esp)                               #
-        movl      %ebx, 28(%esp)                                #
-        xorl      %edx, %edx                                    #
-        xorl      %esi, %esi                                    #
-        jmp       ..B4.13       # Prob 100%                     #
-                                # LOE edx ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.11:                        # Preds ..B4.5
-        movdqa    %xmm7, 32(%esp)                               #
-        movl      %ebx, 28(%esp)                                #
-        xorl      %esi, %esi                                    #
-                                # LOE ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.12:                        # Preds ..B4.11 ..B4.30
-        movdqa    48(%esp), %xmm7                               #2291.22
-        pand      %xmm4, %xmm7                                  #2291.22
-        pcmpeqb   %xmm5, %xmm7                                  #2292.22
-        pmovmskb  %xmm7, %edx                                   #2293.22
-                                # LOE edx ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.13:                        # Preds ..B4.10 ..B4.12
-        movdqa    48(%esp), %xmm7                               #2297.22
-        pand      %xmm2, %xmm7                                  #2297.22
-        pcmpeqb   %xmm3, %xmm7                                  #2298.22
-        pmovmskb  %xmm7, %ebx                                   #2299.22
-        movl      %ebx, 68(%esp)                                #2299.22
-                                # LOE edx ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.14:                        # Preds ..B4.9 ..B4.13
-        movdqa    48(%esp), %xmm7                               #2303.22
-        pand      %xmm0, %xmm7                                  #2303.22
-        pcmpeqb   %xmm1, %xmm7                                  #2304.22
-        pmovmskb  %xmm7, %ebx                                   #2305.22
-        andl      $-4, %ecx                                     #2310.17
-        movl      %ebx, 24(%esp)                                #2305.22
-        movl      %esi, %eax                                    #2313.29
-        orl       %edx, %eax                                    #2313.29
-        orl       68(%esp), %eax                                #2313.34
-        orl       %ebx, %eax                                    #2313.39
-        je        ..B4.23       # Prob 78%                      #2313.47
-                                # LOE edx ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.15:                        # Preds ..B4.14
-        movl      %ecx, 16(%esp)                                #
-        movl      %esi, %eax                                    #2331.30
-        movl      %edi, 20(%esp)                                #
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2331.30
-        movswl    %ax, %ecx                                     #2331.30
-        movl      %ecx, (%esp)                                  #2331.30
-        movl      %edx, %eax                                    #2332.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2332.30
-        movswl    %ax, %edi                                     #2332.30
-        lea       1(,%edi,4), %edi                              #2340.40
-        movl      68(%esp), %eax                                #2333.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2333.30
-        movswl    %ax, %ebx                                     #2333.30
-        movl      24(%esp), %eax                                #2334.30
-        lea       2(,%ebx,4), %ebx                              #2341.40
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2334.30
-        movl      %edi, 4(%esp)                                 #2340.40
-        movl      20(%esp), %edi                                #2346.32
-        movl      %ebx, 8(%esp)                                 #2341.40
-        movswl    %ax, %ecx                                     #2334.30
-        lea       3(,%ecx,4), %ecx                              #2342.40
-        movl      %ecx, 12(%esp)                                #2342.40
-        movl      16(%esp), %ecx                                #2346.32
-        testl     %esi, %esi                                    #2346.32
-        je        ..B4.17       # Prob 50%                      #2346.32
-                                # LOE edx ecx edi cl ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.16:                        # Preds ..B4.15
-        movl      (%esp), %ebx                                  #2346.43
-        movl      64(%esp), %esi                                #2346.49
-        lea       (%ecx,%ebx,4), %ebx                           #2346.43
-        cmpl      %ebx, %esi                                    #2346.49
-        jae       ..B4.34       # Prob 1%                       #2346.49
-                                # LOE edx ecx edi cl ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.17:                        # Preds ..B4.16 ..B4.15
-        testl     %edx, %edx                                    #2347.32
-        je        ..B4.19       # Prob 50%                      #2347.32
-                                # LOE ecx edi cl ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.18:                        # Preds ..B4.17
-        movl      4(%esp), %edx                                 #2347.43
-        movl      64(%esp), %eax                                #2347.49
-        addl      %ecx, %edx                                    #2347.43
-        cmpl      %edx, %eax                                    #2347.49
-        jae       ..B4.34       # Prob 1%                       #2347.49
-                                # LOE ecx edi cl ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.19:                        # Preds ..B4.18 ..B4.17
-        movl      68(%esp), %eax                                #2348.32
-        testl     %eax, %eax                                    #2348.32
-        je        ..B4.21       # Prob 50%                      #2348.32
-                                # LOE ecx edi cl ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.20:                        # Preds ..B4.19
-        movl      8(%esp), %edx                                 #2348.43
-        movl      64(%esp), %eax                                #2348.49
-        addl      %ecx, %edx                                    #2348.43
-        cmpl      %edx, %eax                                    #2348.49
-        jae       ..B4.34       # Prob 1%                       #2348.49
-                                # LOE ecx edi cl ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.21:                        # Preds ..B4.20 ..B4.19
-        movl      24(%esp), %eax                                #2349.32
-        testl     %eax, %eax                                    #2349.32
-        je        ..B4.23       # Prob 50%                      #2349.32
-                                # LOE ecx edi cl ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.22:                        # Preds ..B4.21
-        movl      12(%esp), %edx                                #2349.43
-        movl      64(%esp), %eax                                #2349.49
-        addl      %ecx, %edx                                    #2349.43
-        cmpl      %edx, %eax                                    #2349.49
-        jae       ..B4.34       # Prob 1%                       #2349.49
-                                # LOE ecx edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.23:                        # Preds ..B4.22 ..B4.21 ..B4.14
-        movl      64(%esp), %eax                                #2357.28
-        lea       4(%ecx), %edx                                 #2386.13
-        cmpl      %edx, %eax                                    #2357.28
-        jb        ..B4.32       # Prob 1%                       #2357.28
-                                # LOE ecx edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.24:                        # Preds ..B4.23
-        movl      28(%esp), %eax                                #2382.25
-        cmpl      %eax, %edi                                    #2382.25
-        jae       ..B4.32       # Prob 1%                       #2382.25
-                                # LOE ecx edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.25:                        # Preds ..B4.24
-        movl      64(%esp), %eax                                #2387.24
-        addl      $64, %ecx                                     #2386.13
-        cmpl      %eax, %ecx                                    #2387.24
-        ja        ..B4.32       # Prob 1%                       #2387.24
-                                # LOE ecx edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.26:                        # Preds ..B4.25
-        testl     $15, %edi                                     #2392.22
-        jne       ..B4.28       # Prob 50%                      #2392.22
-                                # LOE ecx edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.27:                        # Preds ..B4.26
-        movdqa    (%edi), %xmm7                                 #2392.22
-        movdqa    %xmm7, 48(%esp)                               #2392.22
-        jmp       ..B4.29       # Prob 100%                     #2392.22
-                                # LOE ecx edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.28:                        # Preds ..B4.26
-        movdqu    (%edi), %xmm7                                 #2392.22
-        movdqa    %xmm7, 48(%esp)                               #2392.22
-                                # LOE ecx edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.29:                        # Preds ..B4.27 ..B4.28
-        addl      $16, %edi                                     #2470.13
-                                # LOE ecx edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.30:                        # Preds ..B4.29 ..B4.8
-        movdqa    48(%esp), %xmm7                               #2285.22
-        pand      %xmm6, %xmm7                                  #2285.22
-        pcmpeqb   32(%esp), %xmm7                               #2286.22
-        pmovmskb  %xmm7, %esi                                   #2287.22
-        jmp       ..B4.12       # Prob 100%                     #2287.22
-                                # LOE ecx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B4.32:                        # Preds ..B4.23 ..B4.24 ..B4.25 # Infreq
-        xorl      %eax, %eax                                    #2483.12
-        addl      $84, %esp                                     #2483.12
-        popl      %ebx                                          #2483.12
-        popl      %esi                                          #2483.12
-        popl      %edi                                          #2483.12
-        movl      %ebp, %esp                                    #2483.12
-        popl      %ebp                                          #2483.12
-        ret                                                     #2483.12
-                                # LOE
-..B4.34:                        # Preds ..B4.22 ..B4.20 ..B4.18 ..B4.16 # Infreq
-        movl      $1, %eax                                      #2346.63
-        addl      $84, %esp                                     #2346.63
-        popl      %ebx                                          #2346.63
-        popl      %esi                                          #2346.63
-        popl      %edi                                          #2346.63
-        movl      %ebp, %esp                                    #2346.63
-        popl      %ebp                                          #2346.63
-        ret                                                     #2346.63
-        .align    2,0x90
-                                # LOE
-# mark_end;
-	.type	eval_2na_8, at function
-	.size	eval_2na_8,.-eval_2na_8
-	.data
-# -- End  eval_2na_8
-	.text
-# -- Begin  eval_2na_16
-# mark_begin;
-       .align    2,0x90
-eval_2na_16:
-# parameter 1: %eax
-# parameter 2: %edx
-# parameter 3: %ecx
-# parameter 4: 20 + %ebp
-..B5.1:                         # Preds ..B5.0
-        pushl     %ebp                                          #2489.1
-        movl      %esp, %ebp                                    #2489.1
-        andl      $-16, %esp                                    #2489.1
-        pushl     %edi                                          #2489.1
-        pushl     %esi                                          #2489.1
-        pushl     %ebx                                          #2489.1
-        subl      $84, %esp                                     #2489.1
-        movl      %ecx, %ebx                                    #2529.49
-        shrl      $2, %ebx                                      #2529.49
-        movl      20(%ebp), %edi                                #2487.5
-        movl      %ebx, 80(%esp)                                #2529.49
-        lea       (%ecx,%edi), %esi                             #2526.5
-        lea       (%edx,%ebx), %ebx                             #2529.30
-        lea       3(%ecx,%edi), %edi                            #2535.50
-        subl      4(%eax), %esi                                 #2532.12
-        movl      %esi, 72(%esp)                                #2532.12
-        movl      80(%esp), %esi                                #2538.14
-        shrl      $2, %edi                                      #2535.57
-        addl      %edx, %edi                                    #2535.30
-        testb     $15, %bl                                      #2538.14
-        jne       ..B5.3        # Prob 50%                      #2538.14
-                                # LOE eax edx ecx ebx esi edi
-..B5.2:                         # Preds ..B5.1
-        movdqa    (%ebx), %xmm0                                 #2538.14
-        movdqa    %xmm0, (%esp)                                 #2538.14
-        jmp       ..B5.4        # Prob 100%                     #2538.14
-                                # LOE eax edx ecx esi edi
-..B5.3:                         # Preds ..B5.1
-        movdqu    (%ebx), %xmm0                                 #2538.14
-        movdqa    %xmm0, (%esp)                                 #2538.14
-                                # LOE eax edx ecx esi edi
-..B5.4:                         # Preds ..B5.2 ..B5.3
-        lea       16(%edx,%esi), %ebx                           #2539.5
-        movl      %ebx, 76(%esp)                                #2539.5
-        cmpl      %edi, %ebx                                    #2544.16
-        jae       ..B5.6        # Prob 12%                      #2544.16
-                                # LOE eax ecx ebx edi bl bh
-..B5.5:                         # Preds ..B5.4
-        movzbl    -1(%ebx), %edx                                #2545.24
-        shll      $8, %edx                                      #2545.38
-        jmp       ..B5.7        # Prob 100%                     #2545.38
-                                # LOE eax edx ecx ebx edi bl bh
-..B5.6:                         # Preds ..B5.4
-        xorl      %edx, %edx                                    #
-                                # LOE eax edx ecx ebx edi bl bh
-..B5.7:                         # Preds ..B5.5 ..B5.6
-        movdqa    16(%eax), %xmm0                               #2549.5
-        movdqa    32(%eax), %xmm6                               #2549.5
-        movdqa    48(%eax), %xmm5                               #2549.5
-        movdqa    64(%eax), %xmm4                               #2549.5
-        movdqa    80(%eax), %xmm3                               #2549.5
-        movdqa    96(%eax), %xmm2                               #2549.5
-        movdqa    112(%eax), %xmm1                              #2549.5
-        movdqa    128(%eax), %xmm7                              #2549.5
-        movl      %ecx, %eax                                    #2561.20
-        andl      $3, %eax                                      #2561.20
-        je        ..B5.43       # Prob 20%                      #2561.20
-                                # LOE eax edx ecx ebx edi bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B5.8:                         # Preds ..B5.7
-        cmpl      $1, %eax                                      #2561.20
-        je        ..B5.14       # Prob 25%                      #2561.20
-                                # LOE eax edx ecx ebx edi bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B5.9:                         # Preds ..B5.8
-        cmpl      $2, %eax                                      #2561.20
-        je        ..B5.13       # Prob 33%                      #2561.20
-                                # LOE eax edx ecx ebx edi bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B5.10:                        # Preds ..B5.9
-        cmpl      $3, %eax                                      #2561.20
-        je        ..B5.12       # Prob 50%                      #2561.20
-                                # LOE edx ecx ebx edi bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B5.11:                        # Preds ..B5.10
-        movdqa    %xmm7, 48(%esp)                               #
-        movdqa    %xmm0, 32(%esp)                               #
-        movdqa    (%esp), %xmm0                                 #
-        movl      %edi, 64(%esp)                                #
-        jmp       ..B5.35       # Prob 100%                     #
-                                # LOE edx ecx ebx bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.12:                        # Preds ..B5.10
-        movdqa    %xmm7, 48(%esp)                               #
-        movdqa    %xmm0, 32(%esp)                               #
-        movdqa    (%esp), %xmm0                                 #
-        movl      %edi, 64(%esp)                                #
-        xorl      %eax, %eax                                    #
-        xorl      %esi, %esi                                    #
-        movl      %eax, 24(%esp)                                #
-        movl      %esi, 28(%esp)                                #
-        movl      $2, %esi                                      #
-        movl      %eax, 80(%esp)                                #
-        jmp       ..B5.17       # Prob 100%                     #
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.13:                        # Preds ..B5.9
-        movdqa    %xmm7, 48(%esp)                               #
-        movdqa    %xmm0, 32(%esp)                               #
-        movdqa    (%esp), %xmm0                                 #
-        movl      %edi, 64(%esp)                                #
-        xorl      %eax, %eax                                    #
-        movl      $2, %esi                                      #
-        movl      %eax, 28(%esp)                                #
-        movl      %eax, 80(%esp)                                #
-        jmp       ..B5.16       # Prob 100%                     #
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.14:                        # Preds ..B5.8
-        movdqa    %xmm7, 48(%esp)                               #
-        movdqa    %xmm0, 32(%esp)                               #
-        movdqa    (%esp), %xmm0                                 #
-        movl      %edi, 64(%esp)                                #
-        xorl      %eax, %eax                                    #
-        movl      $2, %esi                                      #
-        movl      %eax, 80(%esp)                                #
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.15:                        # Preds ..B5.14 ..B5.39
-        movdqa    %xmm0, %xmm7                                  #2584.22
-        pand      %xmm4, %xmm7                                  #2584.22
-        pcmpeqw   %xmm5, %xmm7                                  #2585.22
-        pmovmskb  %xmm7, %eax                                   #2586.22
-        movl      %eax, 28(%esp)                                #2586.22
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.16:                        # Preds ..B5.13 ..B5.15
-        movdqa    %xmm0, %xmm7                                  #2590.22
-        pand      %xmm2, %xmm7                                  #2590.22
-        pcmpeqw   %xmm3, %xmm7                                  #2591.22
-        pmovmskb  %xmm7, %eax                                   #2592.22
-        movl      %eax, 24(%esp)                                #2592.22
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.17:                        # Preds ..B5.12 ..B5.16
-        movdqa    %xmm0, %xmm7                                  #2596.22
-        pand      48(%esp), %xmm7                               #2596.22
-        pcmpeqw   %xmm1, %xmm7                                  #2597.22
-        pmovmskb  %xmm7, %eax                                   #2598.22
-        movl      %ecx, %edi                                    #2603.17
-        movl      80(%esp), %ecx                                #2606.29
-        movl      %eax, 68(%esp)                                #2598.22
-        andl      $-4, %edi                                     #2603.17
-        orl       28(%esp), %ecx                                #2606.29
-        orl       24(%esp), %ecx                                #2606.34
-        orl       %eax, %ecx                                    #2606.39
-        je        ..B5.26       # Prob 78%                      #2606.47
-                                # LOE edx ebx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.18:                        # Preds ..B5.17
-        movl      %ebx, 16(%esp)                                #
-        movl      80(%esp), %ebx                                #2624.30
-        movl      %edx, 20(%esp)                                #
-        movl      %ebx, %eax                                    #2624.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2624.30
-        movswl    %ax, %edx                                     #2624.30
-        movl      28(%esp), %eax                                #2625.30
-        movl      %edx, (%esp)                                  #2624.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2625.30
-        movswl    %ax, %edx                                     #2625.30
-        movl      24(%esp), %eax                                #2626.30
-        lea       1(,%edx,4), %edx                              #2633.40
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2626.30
-        movswl    %ax, %ecx                                     #2626.30
-        movl      68(%esp), %eax                                #2627.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2627.30
-        movl      %edx, 4(%esp)                                 #2633.40
-        movswl    %ax, %eax                                     #2627.30
-        lea       2(,%ecx,4), %edx                              #2634.40
-        movl      %edx, 8(%esp)                                 #2634.40
-        lea       3(,%eax,4), %edx                              #2635.40
-        testl     %ebx, %ebx                                    #2639.32
-        movl      16(%esp), %ebx                                #2639.32
-        movl      %edx, 12(%esp)                                #2635.40
-        movl      20(%esp), %edx                                #2639.32
-        je        ..B5.20       # Prob 50%                      #2639.32
-                                # LOE edx ebx esi edi dl bl dh bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.19:                        # Preds ..B5.18
-        movl      (%esp), %eax                                  #2639.43
-        movl      72(%esp), %ecx                                #2639.49
-        lea       (%edi,%eax,4), %eax                           #2639.43
-        cmpl      %eax, %ecx                                    #2639.49
-        jae       ..B5.44       # Prob 1%                       #2639.49
-                                # LOE edx ebx esi edi dl bl dh bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.20:                        # Preds ..B5.19 ..B5.18
-        movl      28(%esp), %eax                                #2640.32
-        testl     %eax, %eax                                    #2640.32
-        je        ..B5.22       # Prob 50%                      #2640.32
-                                # LOE edx ebx esi edi dl bl dh bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.21:                        # Preds ..B5.20
-        movl      4(%esp), %ecx                                 #2640.43
-        movl      72(%esp), %eax                                #2640.49
-        addl      %edi, %ecx                                    #2640.43
-        cmpl      %ecx, %eax                                    #2640.49
-        jae       ..B5.44       # Prob 1%                       #2640.49
-                                # LOE edx ebx esi edi dl bl dh bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.22:                        # Preds ..B5.21 ..B5.20
-        movl      24(%esp), %eax                                #2641.32
-        testl     %eax, %eax                                    #2641.32
-        je        ..B5.24       # Prob 50%                      #2641.32
-                                # LOE edx ebx esi edi dl bl dh bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.23:                        # Preds ..B5.22
-        movl      8(%esp), %ecx                                 #2641.43
-        movl      72(%esp), %eax                                #2641.49
-        addl      %edi, %ecx                                    #2641.43
-        cmpl      %ecx, %eax                                    #2641.49
-        jae       ..B5.44       # Prob 1%                       #2641.49
-                                # LOE edx ebx esi edi dl bl dh bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.24:                        # Preds ..B5.23 ..B5.22
-        movl      68(%esp), %eax                                #2642.32
-        testl     %eax, %eax                                    #2642.32
-        je        ..B5.26       # Prob 50%                      #2642.32
-                                # LOE edx ebx esi edi dl bl dh bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.25:                        # Preds ..B5.24
-        movl      12(%esp), %ecx                                #2642.43
-        movl      72(%esp), %eax                                #2642.49
-        addl      %edi, %ecx                                    #2642.43
-        cmpl      %ecx, %eax                                    #2642.49
-        jae       ..B5.44       # Prob 1%                       #2642.49
-                                # LOE edx ebx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.26:                        # Preds ..B5.25 ..B5.24 ..B5.17
-        movl      72(%esp), %eax                                #2650.28
-        lea       4(%edi), %ecx                                 #2647.17
-        cmpl      %eax, %ecx                                    #2650.28
-        ja        ..B5.41       # Prob 1%                       #2650.28
-                                # LOE edx ecx ebx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.27:                        # Preds ..B5.26
-        addl      $-1, %esi                                     #2654.25
-        jne       ..B5.36       # Prob 50%                      #2654.39
-                                # LOE edx ecx ebx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.28:                        # Preds ..B5.27
-        movl      64(%esp), %eax                                #2675.25
-        cmpl      %eax, %ebx                                    #2675.25
-        jae       ..B5.41       # Prob 1%                       #2675.25
-                                # LOE edx ebx edi xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.29:                        # Preds ..B5.28
-        movl      72(%esp), %eax                                #2680.24
-        lea       60(%edi), %ecx                                #2679.13
-        cmpl      %eax, %ecx                                    #2680.24
-        ja        ..B5.41       # Prob 1%                       #2680.24
-                                # LOE edx ecx ebx xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.30:                        # Preds ..B5.29
-        testb     $15, %bl                                      #2685.22
-        jne       ..B5.32       # Prob 50%                      #2685.22
-                                # LOE edx ecx ebx xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.31:                        # Preds ..B5.30
-        movdqa    (%ebx), %xmm0                                 #2685.22
-        jmp       ..B5.33       # Prob 100%                     #2685.22
-                                # LOE edx ecx ebx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.32:                        # Preds ..B5.30
-        movdqu    (%ebx), %xmm0                                 #2685.22
-                                # LOE edx ecx ebx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.33:                        # Preds ..B5.31 ..B5.32
-        movl      64(%esp), %eax                                #2766.24
-        addl      $16, %ebx                                     #2763.13
-        movl      %ebx, 76(%esp)                                #2763.13
-        cmpl      %eax, %ebx                                    #2766.24
-        jae       ..B5.35       # Prob 12%                      #2766.24
-                                # LOE edx ecx ebx bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.34:                        # Preds ..B5.33
-        movzbl    -1(%ebx), %edx                                #2767.32
-        shll      $8, %edx                                      #2767.46
-                                # LOE edx ecx ebx bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.35:                        # Preds ..B5.33 ..B5.11 ..B5.34
-        movl      $2, %esi                                      #2568.13
-        jmp       ..B5.39       # Prob 100%                     #2568.13
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.36:                        # Preds ..B5.27
-        movl      76(%esp), %eax                                #2662.26
-        movl      64(%esp), %edi                                #2662.26
-        psrldq    $1, %xmm0                                     #2659.26
-        cmpl      %edi, %eax                                    #2662.26
-        jae       ..B5.38       # Prob 19%                      #2662.26
-                                # LOE eax edx ecx ebx esi al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.37:                        # Preds ..B5.36
-        movzbl    (%eax), %edi                                  #2665.37
-        sarl      $8, %edx                                      #2664.21
-        shll      $8, %edi                                      #2665.48
-        orl       %edi, %edx                                    #2665.21
-        pinsrw    $7, %edx, %xmm0                               #2666.30
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.38:                        # Preds ..B5.37 ..B5.36
-        addl      $1, 76(%esp)                                  #2670.20
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.39:                        # Preds ..B5.35 ..B5.38 ..B5.43
-        movdqa    %xmm0, %xmm7                                  #2578.22
-        pand      %xmm6, %xmm7                                  #2578.22
-        pcmpeqw   32(%esp), %xmm7                               #2579.22
-        pmovmskb  %xmm7, %eax                                   #2580.22
-        movl      %eax, 80(%esp)                                #2580.22
-        jmp       ..B5.15       # Prob 100%                     #2580.22
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.41:                        # Preds ..B5.26 ..B5.28 ..B5.29 # Infreq
-        xorl      %eax, %eax                                    #2776.12
-        addl      $84, %esp                                     #2776.12
-        popl      %ebx                                          #2776.12
-        popl      %esi                                          #2776.12
-        popl      %edi                                          #2776.12
-        movl      %ebp, %esp                                    #2776.12
-        popl      %ebp                                          #2776.12
-        ret                                                     #2776.12
-                                # LOE
-..B5.43:                        # Preds ..B5.7                  # Infreq
-        movdqa    %xmm7, 48(%esp)                               #
-        movdqa    %xmm0, 32(%esp)                               #
-        movdqa    (%esp), %xmm0                                 #
-        movl      %edi, 64(%esp)                                #
-        movl      $2, %esi                                      #
-        jmp       ..B5.39       # Prob 100%                     #
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B5.44:                        # Preds ..B5.21 ..B5.19 ..B5.25 ..B5.23 # Infreq
-        movl      $1, %eax                                      #2641.63
-        addl      $84, %esp                                     #2641.63
-        popl      %ebx                                          #2641.63
-        popl      %esi                                          #2641.63
-        popl      %edi                                          #2641.63
-        movl      %ebp, %esp                                    #2641.63
-        popl      %ebp                                          #2641.63
-        ret                                                     #2641.63
-        .align    2,0x90
-                                # LOE
-# mark_end;
-	.type	eval_2na_16, at function
-	.size	eval_2na_16,.-eval_2na_16
-	.data
-# -- End  eval_2na_16
-	.text
-# -- Begin  eval_2na_32
-# mark_begin;
-       .align    2,0x90
-eval_2na_32:
-# parameter 1: %eax
-# parameter 2: %edx
-# parameter 3: %ecx
-# parameter 4: 20 + %ebp
-..B6.1:                         # Preds ..B6.0
-        pushl     %ebp                                          #2782.1
-        movl      %esp, %ebp                                    #2782.1
-        andl      $-16, %esp                                    #2782.1
-        pushl     %edi                                          #2782.1
-        pushl     %esi                                          #2782.1
-        pushl     %ebx                                          #2782.1
-        subl      $84, %esp                                     #2782.1
-        movl      %ecx, %ebx                                    #2822.49
-        shrl      $2, %ebx                                      #2822.49
-        movl      20(%ebp), %edi                                #2780.5
-        movl      %ebx, 80(%esp)                                #2822.49
-        lea       (%ecx,%edi), %esi                             #2819.5
-        lea       (%edx,%ebx), %ebx                             #2822.30
-        lea       3(%ecx,%edi), %edi                            #2828.50
-        subl      4(%eax), %esi                                 #2825.12
-        movl      %esi, 72(%esp)                                #2825.12
-        movl      80(%esp), %esi                                #2831.14
-        shrl      $2, %edi                                      #2828.57
-        addl      %edx, %edi                                    #2828.30
-        testb     $15, %bl                                      #2831.14
-        jne       ..B6.3        # Prob 50%                      #2831.14
-                                # LOE eax edx ecx ebx esi edi
-..B6.2:                         # Preds ..B6.1
-        movdqa    (%ebx), %xmm0                                 #2831.14
-        movdqa    %xmm0, (%esp)                                 #2831.14
-        jmp       ..B6.4        # Prob 100%                     #2831.14
-                                # LOE eax edx ecx esi edi
-..B6.3:                         # Preds ..B6.1
-        movdqu    (%ebx), %xmm0                                 #2831.14
-        movdqa    %xmm0, (%esp)                                 #2831.14
-                                # LOE eax edx ecx esi edi
-..B6.4:                         # Preds ..B6.2 ..B6.3
-        lea       16(%edx,%esi), %ebx                           #2832.5
-        movl      %ebx, 76(%esp)                                #2832.5
-        cmpl      %edi, %ebx                                    #2837.16
-        jae       ..B6.6        # Prob 12%                      #2837.16
-                                # LOE eax ecx ebx edi bl bh
-..B6.5:                         # Preds ..B6.4
-        movzbl    -1(%ebx), %edx                                #2838.24
-        shll      $8, %edx                                      #2838.38
-        jmp       ..B6.7        # Prob 100%                     #2838.38
-                                # LOE eax edx ecx ebx edi bl bh
-..B6.6:                         # Preds ..B6.4
-        xorl      %edx, %edx                                    #
-                                # LOE eax edx ecx ebx edi bl bh
-..B6.7:                         # Preds ..B6.5 ..B6.6
-        movdqa    16(%eax), %xmm0                               #2842.5
-        movdqa    32(%eax), %xmm6                               #2842.5
-        movdqa    48(%eax), %xmm5                               #2842.5
-        movdqa    64(%eax), %xmm4                               #2842.5
-        movdqa    80(%eax), %xmm3                               #2842.5
-        movdqa    96(%eax), %xmm2                               #2842.5
-        movdqa    112(%eax), %xmm1                              #2842.5
-        movdqa    128(%eax), %xmm7                              #2842.5
-        movl      %ecx, %eax                                    #2854.20
-        andl      $3, %eax                                      #2854.20
-        je        ..B6.43       # Prob 20%                      #2854.20
-                                # LOE eax edx ecx ebx edi bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B6.8:                         # Preds ..B6.7
-        cmpl      $1, %eax                                      #2854.20
-        je        ..B6.14       # Prob 25%                      #2854.20
-                                # LOE eax edx ecx ebx edi bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B6.9:                         # Preds ..B6.8
-        cmpl      $2, %eax                                      #2854.20
-        je        ..B6.13       # Prob 33%                      #2854.20
-                                # LOE eax edx ecx ebx edi bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B6.10:                        # Preds ..B6.9
-        cmpl      $3, %eax                                      #2854.20
-        je        ..B6.12       # Prob 50%                      #2854.20
-                                # LOE edx ecx ebx edi bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B6.11:                        # Preds ..B6.10
-        movdqa    %xmm7, 48(%esp)                               #
-        movdqa    %xmm0, 32(%esp)                               #
-        movdqa    (%esp), %xmm0                                 #
-        movl      %edi, 64(%esp)                                #
-        jmp       ..B6.35       # Prob 100%                     #
-                                # LOE edx ecx ebx bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.12:                        # Preds ..B6.10
-        movdqa    %xmm7, 48(%esp)                               #
-        movdqa    %xmm0, 32(%esp)                               #
-        movdqa    (%esp), %xmm0                                 #
-        movl      %edi, 64(%esp)                                #
-        xorl      %eax, %eax                                    #
-        xorl      %esi, %esi                                    #
-        movl      %eax, 24(%esp)                                #
-        movl      %esi, 28(%esp)                                #
-        movl      $4, %esi                                      #
-        movl      %eax, 80(%esp)                                #
-        jmp       ..B6.17       # Prob 100%                     #
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.13:                        # Preds ..B6.9
-        movdqa    %xmm7, 48(%esp)                               #
-        movdqa    %xmm0, 32(%esp)                               #
-        movdqa    (%esp), %xmm0                                 #
-        movl      %edi, 64(%esp)                                #
-        xorl      %eax, %eax                                    #
-        movl      $4, %esi                                      #
-        movl      %eax, 28(%esp)                                #
-        movl      %eax, 80(%esp)                                #
-        jmp       ..B6.16       # Prob 100%                     #
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.14:                        # Preds ..B6.8
-        movdqa    %xmm7, 48(%esp)                               #
-        movdqa    %xmm0, 32(%esp)                               #
-        movdqa    (%esp), %xmm0                                 #
-        movl      %edi, 64(%esp)                                #
-        xorl      %eax, %eax                                    #
-        movl      $4, %esi                                      #
-        movl      %eax, 80(%esp)                                #
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.15:                        # Preds ..B6.14 ..B6.39
-        movdqa    %xmm0, %xmm7                                  #2877.22
-        pand      %xmm4, %xmm7                                  #2877.22
-        pcmpeqd   %xmm5, %xmm7                                  #2878.22
-        pmovmskb  %xmm7, %eax                                   #2879.22
-        movl      %eax, 28(%esp)                                #2879.22
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.16:                        # Preds ..B6.13 ..B6.15
-        movdqa    %xmm0, %xmm7                                  #2883.22
-        pand      %xmm2, %xmm7                                  #2883.22
-        pcmpeqd   %xmm3, %xmm7                                  #2884.22
-        pmovmskb  %xmm7, %eax                                   #2885.22
-        movl      %eax, 24(%esp)                                #2885.22
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.17:                        # Preds ..B6.12 ..B6.16
-        movdqa    %xmm0, %xmm7                                  #2889.22
-        pand      48(%esp), %xmm7                               #2889.22
-        pcmpeqd   %xmm1, %xmm7                                  #2890.22
-        pmovmskb  %xmm7, %eax                                   #2891.22
-        movl      %ecx, %edi                                    #2896.17
-        movl      80(%esp), %ecx                                #2899.29
-        movl      %eax, 68(%esp)                                #2891.22
-        andl      $-4, %edi                                     #2896.17
-        orl       28(%esp), %ecx                                #2899.29
-        orl       24(%esp), %ecx                                #2899.34
-        orl       %eax, %ecx                                    #2899.39
-        je        ..B6.26       # Prob 78%                      #2899.47
-                                # LOE edx ebx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.18:                        # Preds ..B6.17
-        movl      %ebx, 16(%esp)                                #
-        movl      80(%esp), %ebx                                #2917.30
-        movl      %edx, 20(%esp)                                #
-        movl      %ebx, %eax                                    #2917.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2917.30
-        movswl    %ax, %edx                                     #2917.30
-        movl      28(%esp), %eax                                #2918.30
-        movl      %edx, (%esp)                                  #2917.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2918.30
-        movswl    %ax, %edx                                     #2918.30
-        movl      24(%esp), %eax                                #2919.30
-        lea       1(,%edx,4), %edx                              #2926.40
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2919.30
-        movswl    %ax, %ecx                                     #2919.30
-        movl      68(%esp), %eax                                #2920.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2920.30
-        movl      %edx, 4(%esp)                                 #2926.40
-        movswl    %ax, %eax                                     #2920.30
-        lea       2(,%ecx,4), %edx                              #2927.40
-        movl      %edx, 8(%esp)                                 #2927.40
-        lea       3(,%eax,4), %edx                              #2928.40
-        testl     %ebx, %ebx                                    #2932.32
-        movl      16(%esp), %ebx                                #2932.32
-        movl      %edx, 12(%esp)                                #2928.40
-        movl      20(%esp), %edx                                #2932.32
-        je        ..B6.20       # Prob 50%                      #2932.32
-                                # LOE edx ebx esi edi dl bl dh bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.19:                        # Preds ..B6.18
-        movl      (%esp), %eax                                  #2932.43
-        movl      72(%esp), %ecx                                #2932.49
-        lea       (%edi,%eax,4), %eax                           #2932.43
-        cmpl      %eax, %ecx                                    #2932.49
-        jae       ..B6.44       # Prob 1%                       #2932.49
-                                # LOE edx ebx esi edi dl bl dh bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.20:                        # Preds ..B6.19 ..B6.18
-        movl      28(%esp), %eax                                #2933.32
-        testl     %eax, %eax                                    #2933.32
-        je        ..B6.22       # Prob 50%                      #2933.32
-                                # LOE edx ebx esi edi dl bl dh bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.21:                        # Preds ..B6.20
-        movl      4(%esp), %ecx                                 #2933.43
-        movl      72(%esp), %eax                                #2933.49
-        addl      %edi, %ecx                                    #2933.43
-        cmpl      %ecx, %eax                                    #2933.49
-        jae       ..B6.44       # Prob 1%                       #2933.49
-                                # LOE edx ebx esi edi dl bl dh bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.22:                        # Preds ..B6.21 ..B6.20
-        movl      24(%esp), %eax                                #2934.32
-        testl     %eax, %eax                                    #2934.32
-        je        ..B6.24       # Prob 50%                      #2934.32
-                                # LOE edx ebx esi edi dl bl dh bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.23:                        # Preds ..B6.22
-        movl      8(%esp), %ecx                                 #2934.43
-        movl      72(%esp), %eax                                #2934.49
-        addl      %edi, %ecx                                    #2934.43
-        cmpl      %ecx, %eax                                    #2934.49
-        jae       ..B6.44       # Prob 1%                       #2934.49
-                                # LOE edx ebx esi edi dl bl dh bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.24:                        # Preds ..B6.23 ..B6.22
-        movl      68(%esp), %eax                                #2935.32
-        testl     %eax, %eax                                    #2935.32
-        je        ..B6.26       # Prob 50%                      #2935.32
-                                # LOE edx ebx esi edi dl bl dh bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.25:                        # Preds ..B6.24
-        movl      12(%esp), %ecx                                #2935.43
-        movl      72(%esp), %eax                                #2935.49
-        addl      %edi, %ecx                                    #2935.43
-        cmpl      %ecx, %eax                                    #2935.49
-        jae       ..B6.44       # Prob 1%                       #2935.49
-                                # LOE edx ebx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.26:                        # Preds ..B6.25 ..B6.24 ..B6.17
-        movl      72(%esp), %eax                                #2943.28
-        lea       4(%edi), %ecx                                 #2940.17
-        cmpl      %eax, %ecx                                    #2943.28
-        ja        ..B6.41       # Prob 1%                       #2943.28
-                                # LOE edx ecx ebx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.27:                        # Preds ..B6.26
-        addl      $-1, %esi                                     #2947.25
-        jne       ..B6.36       # Prob 50%                      #2947.39
-                                # LOE edx ecx ebx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.28:                        # Preds ..B6.27
-        movl      64(%esp), %eax                                #2968.25
-        cmpl      %eax, %ebx                                    #2968.25
-        jae       ..B6.41       # Prob 1%                       #2968.25
-                                # LOE edx ebx edi xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.29:                        # Preds ..B6.28
-        movl      72(%esp), %eax                                #2973.24
-        lea       52(%edi), %ecx                                #2972.13
-        cmpl      %eax, %ecx                                    #2973.24
-        ja        ..B6.41       # Prob 1%                       #2973.24
-                                # LOE edx ecx ebx xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.30:                        # Preds ..B6.29
-        testb     $15, %bl                                      #2978.22
-        jne       ..B6.32       # Prob 50%                      #2978.22
-                                # LOE edx ecx ebx xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.31:                        # Preds ..B6.30
-        movdqa    (%ebx), %xmm0                                 #2978.22
-        jmp       ..B6.33       # Prob 100%                     #2978.22
-                                # LOE edx ecx ebx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.32:                        # Preds ..B6.30
-        movdqu    (%ebx), %xmm0                                 #2978.22
-                                # LOE edx ecx ebx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.33:                        # Preds ..B6.31 ..B6.32
-        movl      64(%esp), %eax                                #3059.24
-        addl      $16, %ebx                                     #3056.13
-        movl      %ebx, 76(%esp)                                #3056.13
-        cmpl      %eax, %ebx                                    #3059.24
-        jae       ..B6.35       # Prob 12%                      #3059.24
-                                # LOE edx ecx ebx bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.34:                        # Preds ..B6.33
-        movzbl    -1(%ebx), %edx                                #3060.32
-        shll      $8, %edx                                      #3060.46
-                                # LOE edx ecx ebx bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.35:                        # Preds ..B6.33 ..B6.11 ..B6.34
-        movl      $4, %esi                                      #2861.13
-        jmp       ..B6.39       # Prob 100%                     #2861.13
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.36:                        # Preds ..B6.27
-        movl      76(%esp), %eax                                #2955.26
-        movl      64(%esp), %edi                                #2955.26
-        psrldq    $1, %xmm0                                     #2952.26
-        cmpl      %edi, %eax                                    #2955.26
-        jae       ..B6.38       # Prob 19%                      #2955.26
-                                # LOE eax edx ecx ebx esi al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.37:                        # Preds ..B6.36
-        movzbl    (%eax), %edi                                  #2958.37
-        sarl      $8, %edx                                      #2957.21
-        shll      $8, %edi                                      #2958.48
-        orl       %edi, %edx                                    #2958.21
-        pinsrw    $7, %edx, %xmm0                               #2959.30
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.38:                        # Preds ..B6.37 ..B6.36
-        addl      $1, 76(%esp)                                  #2963.20
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.39:                        # Preds ..B6.35 ..B6.38 ..B6.43
-        movdqa    %xmm0, %xmm7                                  #2871.22
-        pand      %xmm6, %xmm7                                  #2871.22
-        pcmpeqd   32(%esp), %xmm7                               #2872.22
-        pmovmskb  %xmm7, %eax                                   #2873.22
-        movl      %eax, 80(%esp)                                #2873.22
-        jmp       ..B6.15       # Prob 100%                     #2873.22
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.41:                        # Preds ..B6.26 ..B6.28 ..B6.29 # Infreq
-        xorl      %eax, %eax                                    #3069.12
-        addl      $84, %esp                                     #3069.12
-        popl      %ebx                                          #3069.12
-        popl      %esi                                          #3069.12
-        popl      %edi                                          #3069.12
-        movl      %ebp, %esp                                    #3069.12
-        popl      %ebp                                          #3069.12
-        ret                                                     #3069.12
-                                # LOE
-..B6.43:                        # Preds ..B6.7                  # Infreq
-        movdqa    %xmm7, 48(%esp)                               #
-        movdqa    %xmm0, 32(%esp)                               #
-        movdqa    (%esp), %xmm0                                 #
-        movl      %edi, 64(%esp)                                #
-        movl      $4, %esi                                      #
-        jmp       ..B6.39       # Prob 100%                     #
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B6.44:                        # Preds ..B6.21 ..B6.19 ..B6.25 ..B6.23 # Infreq
-        movl      $1, %eax                                      #2934.63
-        addl      $84, %esp                                     #2934.63
-        popl      %ebx                                          #2934.63
-        popl      %esi                                          #2934.63
-        popl      %edi                                          #2934.63
-        movl      %ebp, %esp                                    #2934.63
-        popl      %ebp                                          #2934.63
-        ret                                                     #2934.63
-        .align    2,0x90
-                                # LOE
-# mark_end;
-	.type	eval_2na_32, at function
-	.size	eval_2na_32,.-eval_2na_32
-	.data
-# -- End  eval_2na_32
-	.text
-# -- Begin  eval_2na_128
-# mark_begin;
-       .align    2,0x90
-eval_2na_128:
-# parameter 1: %eax
-# parameter 2: %edx
-# parameter 3: %ecx
-# parameter 4: 20 + %ebp
-..B7.1:                         # Preds ..B7.0
-        pushl     %ebp                                          #3369.1
-        movl      %esp, %ebp                                    #3369.1
-        andl      $-16, %esp                                    #3369.1
-        pushl     %edi                                          #3369.1
-        pushl     %esi                                          #3369.1
-        pushl     %ebx                                          #3369.1
-        subl      $84, %esp                                     #3369.1
-        movl      %ecx, %esi                                    #3409.49
-        shrl      $2, %esi                                      #3409.49
-        movl      20(%ebp), %ebx                                #3367.5
-        movl      %esi, 68(%esp)                                #3409.49
-        lea       (%ecx,%ebx), %edi                             #3406.5
-        lea       (%edx,%esi), %esi                             #3409.30
-        lea       3(%ecx,%ebx), %ebx                            #3415.50
-        subl      4(%eax), %edi                                 #3412.12
-        movl      %edi, 60(%esp)                                #3412.12
-        movl      68(%esp), %edi                                #3418.14
-        shrl      $2, %ebx                                      #3415.57
-        addl      %edx, %ebx                                    #3415.30
-        testl     $15, %esi                                     #3418.14
-        jne       ..B7.3        # Prob 50%                      #3418.14
-                                # LOE eax edx ecx ebx esi edi
-..B7.2:                         # Preds ..B7.1
-        movdqa    (%esi), %xmm0                                 #3418.14
-        movdqa    %xmm0, 32(%esp)                               #3418.14
-        jmp       ..B7.4        # Prob 100%                     #3418.14
-                                # LOE eax edx ecx ebx edi
-..B7.3:                         # Preds ..B7.1
-        movdqu    (%esi), %xmm0                                 #3418.14
-        movdqa    %xmm0, 32(%esp)                               #3418.14
-                                # LOE eax edx ecx ebx edi
-..B7.4:                         # Preds ..B7.2 ..B7.3
-        lea       16(%edx,%edi), %edx                           #3419.5
-        movl      %edx, 64(%esp)                                #3419.5
-        cmpl      %ebx, %edx                                    #3424.16
-        jae       ..B7.6        # Prob 12%                      #3424.16
-                                # LOE eax edx ecx ebx dl dh
-..B7.5:                         # Preds ..B7.4
-        movzbl    -1(%edx), %esi                                #3425.24
-        shll      $8, %esi                                      #3425.38
-        jmp       ..B7.7        # Prob 100%                     #3425.38
-                                # LOE eax edx ecx ebx esi dl dh
-..B7.6:                         # Preds ..B7.4
-        xorl      %esi, %esi                                    #
-                                # LOE eax edx ecx ebx esi dl dh
-..B7.7:                         # Preds ..B7.5 ..B7.6
-        movl      60(%esp), %edi                                #3434.20
-        movdqa    16(%eax), %xmm6                               #3429.5
-        movdqa    32(%eax), %xmm5                               #3429.5
-        movdqa    48(%eax), %xmm4                               #3429.5
-        movdqa    64(%eax), %xmm3                               #3429.5
-        movdqa    80(%eax), %xmm2                               #3429.5
-        movdqa    96(%eax), %xmm1                               #3429.5
-        movdqa    112(%eax), %xmm0                              #3429.5
-        movdqa    128(%eax), %xmm7                              #3429.5
-        subl      %ecx, %edi                                    #3434.20
-        addl      $7, %edi                                      #3434.33
-        shrl      $2, %edi                                      #3434.40
-        movl      %ecx, %eax                                    #3441.20
-        andl      $3, %eax                                      #3441.20
-        je        ..B7.42       # Prob 20%                      #3441.20
-                                # LOE eax edx ecx ebx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B7.8:                         # Preds ..B7.7
-        cmpl      $1, %eax                                      #3441.20
-        je        ..B7.14       # Prob 25%                      #3441.20
-                                # LOE eax edx ecx ebx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B7.9:                         # Preds ..B7.8
-        cmpl      $2, %eax                                      #3441.20
-        je        ..B7.13       # Prob 33%                      #3441.20
-                                # LOE eax edx ecx ebx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B7.10:                        # Preds ..B7.9
-        cmpl      $3, %eax                                      #3441.20
-        je        ..B7.12       # Prob 50%                      #3441.20
-                                # LOE edx ecx ebx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B7.11:                        # Preds ..B7.10
-        movdqa    %xmm7, (%esp)                                 #
-        movdqa    %xmm0, 16(%esp)                               #
-        movdqa    32(%esp), %xmm0                               #
-        movl      %esi, 68(%esp)                                #
-        movl      %ebx, 56(%esp)                                #
-        jmp       ..B7.26       # Prob 100%                     #
-                                # LOE edx ecx dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.12:                        # Preds ..B7.10
-        movdqa    %xmm7, (%esp)                                 #
-        movdqa    %xmm0, 16(%esp)                               #
-        movdqa    32(%esp), %xmm0                               #
-        movl      %esi, 68(%esp)                                #
-        movl      %ebx, 56(%esp)                                #
-        xorl      %eax, %eax                                    #
-        movl      %eax, 48(%esp)                                #
-        movl      %eax, 52(%esp)                                #
-        jmp       ..B7.17       # Prob 100%                     #
-                                # LOE eax edx ecx edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.13:                        # Preds ..B7.9
-        movdqa    %xmm7, (%esp)                                 #
-        movdqa    %xmm0, 16(%esp)                               #
-        movdqa    32(%esp), %xmm0                               #
-        movl      %esi, 68(%esp)                                #
-        movl      %ebx, 56(%esp)                                #
-        xorl      %eax, %eax                                    #
-        movl      %eax, 52(%esp)                                #
-        jmp       ..B7.16       # Prob 100%                     #
-                                # LOE eax edx ecx edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.14:                        # Preds ..B7.8
-        movdqa    %xmm7, (%esp)                                 #
-        movdqa    %xmm0, 16(%esp)                               #
-        movdqa    32(%esp), %xmm0                               #
-        movl      %esi, 68(%esp)                                #
-        movl      %ebx, 56(%esp)                                #
-        xorl      %eax, %eax                                    #
-                                # LOE eax edx ecx edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.15:                        # Preds ..B7.14 ..B7.30
-        movdqa    %xmm0, %xmm7                                  #3464.22
-        pand      %xmm3, %xmm7                                  #3464.22
-        pcmpeqd   %xmm4, %xmm7                                  #3465.22
-        pmovmskb  %xmm7, %ebx                                   #3466.22
-        addl      $1, %ebx                                      #3467.17
-        shrl      $16, %ebx                                     #3467.17
-        negl      %ebx                                          #3467.17
-        movl      %ebx, 52(%esp)                                #3467.17
-                                # LOE eax edx ecx edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.16:                        # Preds ..B7.13 ..B7.15
-        movdqa    %xmm0, %xmm7                                  #3470.22
-        pand      %xmm1, %xmm7                                  #3470.22
-        pcmpeqd   %xmm2, %xmm7                                  #3471.22
-        pmovmskb  %xmm7, %ebx                                   #3472.22
-        addl      $1, %ebx                                      #3473.17
-        shrl      $16, %ebx                                     #3473.17
-        negl      %ebx                                          #3473.17
-        movl      %ebx, 48(%esp)                                #3473.17
-                                # LOE eax edx ecx edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.17:                        # Preds ..B7.12 ..B7.16
-        movdqa    %xmm0, %xmm7                                  #3476.22
-        pand      (%esp), %xmm7                                 #3476.22
-        pcmpeqd   16(%esp), %xmm7                               #3477.22
-        pmovmskb  %xmm7, %ebx                                   #3478.22
-        andl      $-4, %ecx                                     #3483.17
-        movl      %eax, %esi                                    #3486.29
-        orl       52(%esp), %esi                                #3486.29
-        addl      $1, %ebx                                      #3479.17
-        shrl      $16, %ebx                                     #3479.17
-        orl       48(%esp), %esi                                #3486.34
-        negl      %ebx                                          #3479.17
-        orl       %ebx, %esi                                    #3486.39
-        jne       ..B7.31       # Prob 1%                       #3486.47
-                                # LOE eax edx ecx edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.18:                        # Preds ..B7.17
-        movl      60(%esp), %eax                                #3530.28
-        addl      $4, %ecx                                      #3527.17
-        cmpl      %eax, %ecx                                    #3530.28
-        ja        ..B7.38       # Prob 1%                       #3530.28
-                                # LOE edx ecx edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.19:                        # Preds ..B7.18
-        addl      $-1, %edi                                     #3534.25
-        jne       ..B7.27       # Prob 50%                      #3534.39
-                                # LOE edx ecx edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.20:                        # Preds ..B7.19
-        movl      56(%esp), %eax                                #3555.25
-        cmpl      %eax, %edx                                    #3555.25
-        jae       ..B7.38       # Prob 1%                       #3555.25
-                                # LOE eax edx ecx al ah xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.21:                        # Preds ..B7.20
-        testb     $15, %dl                                      #3565.22
-        jne       ..B7.23       # Prob 50%                      #3565.22
-                                # LOE eax edx ecx al ah xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.22:                        # Preds ..B7.21
-        movdqa    (%edx), %xmm0                                 #3565.22
-        jmp       ..B7.24       # Prob 100%                     #3565.22
-                                # LOE eax edx ecx al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.23:                        # Preds ..B7.21
-        movdqu    (%edx), %xmm0                                 #3565.22
-                                # LOE eax edx ecx al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.24:                        # Preds ..B7.22 ..B7.23
-        addl      $16, %edx                                     #3643.13
-        movl      %edx, 64(%esp)                                #3643.13
-        cmpl      %eax, %edx                                    #3646.24
-        jae       ..B7.26       # Prob 12%                      #3646.24
-                                # LOE edx ecx dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.25:                        # Preds ..B7.24
-        movzbl    -1(%edx), %eax                                #3647.32
-        shll      $8, %eax                                      #3647.46
-        movl      %eax, 68(%esp)                                #3647.46
-                                # LOE edx ecx dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.26:                        # Preds ..B7.24 ..B7.11 ..B7.25
-        movl      $16, %edi                                     #3448.13
-        jmp       ..B7.30       # Prob 100%                     #3448.13
-                                # LOE edx ecx edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.27:                        # Preds ..B7.19
-        movl      64(%esp), %eax                                #3542.26
-        movl      56(%esp), %ebx                                #3542.26
-        psrldq    $1, %xmm0                                     #3539.26
-        cmpl      %ebx, %eax                                    #3542.26
-        jae       ..B7.29       # Prob 19%                      #3542.26
-                                # LOE eax edx ecx edi al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.28:                        # Preds ..B7.27
-        movl      68(%esp), %esi                                #3544.21
-        movzbl    (%eax), %ebx                                  #3545.37
-        sarl      $8, %esi                                      #3544.21
-        shll      $8, %ebx                                      #3545.48
-        orl       %ebx, %esi                                    #3545.21
-        pinsrw    $7, %esi, %xmm0                               #3546.30
-        movl      %esi, 68(%esp)                                #3545.21
-                                # LOE edx ecx edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.29:                        # Preds ..B7.28 ..B7.27
-        addl      $1, 64(%esp)                                  #3550.20
-                                # LOE edx ecx edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.30:                        # Preds ..B7.26 ..B7.29 ..B7.42
-        movdqa    %xmm0, %xmm7                                  #3458.22
-        pand      %xmm5, %xmm7                                  #3458.22
-        pcmpeqd   %xmm6, %xmm7                                  #3459.22
-        pmovmskb  %xmm7, %eax                                   #3460.22
-        addl      $1, %eax                                      #3461.17
-        shrl      $16, %eax                                     #3461.17
-        negl      %eax                                          #3461.17
-        jmp       ..B7.15       # Prob 100%                     #3461.17
-                                # LOE eax edx ecx edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B7.31:                        # Preds ..B7.17                 # Infreq
-        movl      60(%esp), %edx                                #3489.30
-        subl      %ecx, %edx                                    #3489.30
-        movl      %edx, 60(%esp)                                #3489.30
-        cmpl      $2, %edx                                      #3489.37
-        je        ..B7.35       # Prob 25%                      #3489.37
-                                # LOE eax edx dl dh
-..B7.32:                        # Preds ..B7.31                 # Infreq
-        cmpl      $1, %edx                                      #3489.37
-        je        ..B7.36       # Prob 33%                      #3489.37
-                                # LOE eax edx dl dh
-..B7.33:                        # Preds ..B7.32                 # Infreq
-        testl     %edx, %edx                                    #3489.37
-        je        ..B7.37       # Prob 50%                      #3489.37
-                                # LOE eax
-..B7.34:                        # Preds ..B7.35 ..B7.36 ..B7.37 ..B7.33 # Infreq
-        movl      $1, %eax                                      #3492.32
-        addl      $84, %esp                                     #3492.32
-        popl      %ebx                                          #3492.32
-        popl      %esi                                          #3492.32
-        popl      %edi                                          #3492.32
-        movl      %ebp, %esp                                    #3492.32
-        popl      %ebp                                          #3492.32
-        ret                                                     #3492.32
-                                # LOE
-..B7.35:                        # Preds ..B7.31                 # Infreq
-        movl      48(%esp), %edx                                #3494.36
-        testl     %edx, %edx                                    #3494.36
-        jne       ..B7.34       # Prob 28%                      #3494.36
-                                # LOE eax
-..B7.36:                        # Preds ..B7.35 ..B7.32         # Infreq
-        movl      52(%esp), %edx                                #3496.36
-        testl     %edx, %edx                                    #3496.36
-        jne       ..B7.34       # Prob 28%                      #3496.36
-                                # LOE eax
-..B7.37:                        # Preds ..B7.33 ..B7.36         # Infreq
-        testl     %eax, %eax                                    #3498.36
-        jne       ..B7.34       # Prob 28%                      #3498.36
-                                # LOE
-..B7.38:                        # Preds ..B7.20 ..B7.18 ..B7.37 # Infreq
-        xorl      %eax, %eax                                    #3500.28
-        addl      $84, %esp                                     #3500.28
-        popl      %ebx                                          #3500.28
-        popl      %esi                                          #3500.28
-        popl      %edi                                          #3500.28
-        movl      %ebp, %esp                                    #3500.28
-        popl      %ebp                                          #3500.28
-        ret                                                     #3500.28
-                                # LOE
-..B7.42:                        # Preds ..B7.7                  # Infreq
-        movdqa    %xmm7, (%esp)                                 #
-        movdqa    %xmm0, 16(%esp)                               #
-        movdqa    32(%esp), %xmm0                               #
-        movl      %esi, 68(%esp)                                #
-        movl      %ebx, 56(%esp)                                #
-        jmp       ..B7.30       # Prob 100%                     #
-        .align    2,0x90
-                                # LOE edx ecx edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-# mark_end;
-	.type	eval_2na_128, at function
-	.size	eval_2na_128,.-eval_2na_128
-	.data
-# -- End  eval_2na_128
-	.text
-# -- Begin  eval_4na_16
-# mark_begin;
-       .align    2,0x90
-eval_4na_16:
-# parameter 1: %eax
-# parameter 2: %edx
-# parameter 3: %ecx
-# parameter 4: 20 + %ebp
-..B8.1:                         # Preds ..B8.0
-        pushl     %ebp                                          #4057.1
-        movl      %esp, %ebp                                    #4057.1
-        andl      $-16, %esp                                    #4057.1
-        pushl     %edi                                          #4057.1
-        pushl     %esi                                          #4057.1
-        pushl     %ebx                                          #4057.1
-        subl      $116, %esp                                    #4057.1
-        movdqa    16(%eax), %xmm5                               #4109.5
-        movdqa    32(%eax), %xmm4                               #4109.5
-        movl      20(%ebp), %ebx                                #4055.5
-        movdqa    48(%eax), %xmm6                               #4109.5
-        movdqa    64(%eax), %xmm3                               #4109.5
-        movdqa    80(%eax), %xmm2                               #4109.5
-        movdqa    96(%eax), %xmm0                               #4109.5
-        movdqa    128(%eax), %xmm7                              #4109.5
-        movdqa    %xmm0, 80(%esp)                               #4109.5
-        movdqa    112(%eax), %xmm0                              #4109.5
-        movl      %ecx, %edi                                    #4093.49
-        call      ..L3          # Prob 100%                     #4057.1
-..L3:                                                           #
-        popl      %esi                                          #4057.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L3], %esi       #4057.1
-        shrl      $2, %edi                                      #4093.49
-        movl      %esi, 16(%esp)                                #4057.1
-        lea       (%ecx,%ebx), %esi                             #4090.5
-        subl      4(%eax), %esi                                 #4096.12
-        lea       3(%ecx,%ebx), %ebx                            #4099.50
-        movl      %esi, 100(%esp)                               #4096.12
-        movzbl    (%edi,%edx), %esi                             #4102.14
-        shrl      $2, %ebx                                      #4099.57
-        addl      %edx, %ebx                                    #4099.30
-        movl      %ecx, %eax                                    #4123.20
-        movl      %ebx, 104(%esp)                               #4099.30
-        movl      16(%esp), %ebx                                #4102.14
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%esi,2), %esi        #4102.14
-        movw      %si, (%esp)                                   #4102.14
-        movzbl    1(%edi,%edx), %esi                            #4102.14
-        andl      $3, %eax                                      #4123.20
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%esi,2), %esi        #4102.14
-        movw      %si, 2(%esp)                                  #4102.14
-        movzbl    2(%edi,%edx), %esi                            #4102.14
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%esi,2), %esi        #4102.14
-        movw      %si, 4(%esp)                                  #4102.14
-        movzbl    3(%edi,%edx), %esi                            #4102.14
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%esi,2), %esi        #4102.14
-        movw      %si, 6(%esp)                                  #4102.14
-        movzbl    4(%edi,%edx), %esi                            #4102.14
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%esi,2), %esi        #4102.14
-        movw      %si, 8(%esp)                                  #4102.14
-        movzbl    5(%edi,%edx), %esi                            #4102.14
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%esi,2), %esi        #4102.14
-        movw      %si, 10(%esp)                                 #4102.14
-        movzbl    6(%edi,%edx), %esi                            #4102.14
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%esi,2), %esi        #4102.14
-        movw      %si, 12(%esp)                                 #4102.14
-        movzbl    7(%edi,%edx), %esi                            #4102.14
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%esi,2), %esi        #4102.14
-        movw      %si, 14(%esp)                                 #4102.14
-        movdqu    (%esp), %xmm1                                 #4102.14
-        lea       8(%edx,%edi), %esi                            #4103.5
-        je        ..B8.5        # Prob 20%                      #4123.20
-                                # LOE eax ecx ebx esi bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B8.2:                         # Preds ..B8.1
-        cmpl      $1, %eax                                      #4123.20
-        je        ..B8.8        # Prob 25%                      #4123.20
-                                # LOE eax ecx ebx esi bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B8.3:                         # Preds ..B8.2
-        cmpl      $2, %eax                                      #4123.20
-        je        ..B8.7        # Prob 33%                      #4123.20
-                                # LOE eax ecx ebx esi bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B8.4:                         # Preds ..B8.3
-        cmpl      $3, %eax                                      #4123.20
-        je        ..B8.6        # Prob 50%                      #4123.20
-                                # LOE ecx ebx esi bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B8.5:                         # Preds ..B8.1 ..B8.4
-        movdqa    %xmm7, 64(%esp)                               #
-        movdqa    %xmm6, 48(%esp)                               #
-        jmp       ..B8.24       # Prob 100%                     #
-                                # LOE ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B8.6:                         # Preds ..B8.4
-        movdqa    %xmm7, 64(%esp)                               #
-        movdqa    %xmm6, 48(%esp)                               #
-        xorl      %edi, %edi                                    #
-        movl      %edi, 44(%esp)                                #
-        xorl      %edx, %edx                                    #
-        movl      %edi, 96(%esp)                                #
-        jmp       ..B8.11       # Prob 100%                     #
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B8.7:                         # Preds ..B8.3
-        movdqa    %xmm7, 64(%esp)                               #
-        movdqa    %xmm6, 48(%esp)                               #
-        xorl      %eax, %eax                                    #
-        movl      %eax, 96(%esp)                                #
-        xorl      %edx, %edx                                    #
-        jmp       ..B8.10       # Prob 100%                     #
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B8.8:                         # Preds ..B8.2
-        movdqa    %xmm7, 64(%esp)                               #
-        movdqa    %xmm6, 48(%esp)                               #
-        xorl      %edx, %edx                                    #
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B8.9:                         # Preds ..B8.8 ..B8.24
-        movdqa    %xmm1, %xmm7                                  #4147.22
-        movdqa    %xmm1, %xmm6                                  #4148.22
-        pand      48(%esp), %xmm7                               #4147.22
-        pand      %xmm3, %xmm6                                  #4148.22
-        pcmpeqw   %xmm6, %xmm7                                  #4149.22
-        pmovmskb  %xmm7, %edi                                   #4150.22
-        movl      %edi, 96(%esp)                                #4150.22
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B8.10:                        # Preds ..B8.7 ..B8.9
-        movdqa    %xmm1, %xmm7                                  #4154.22
-        movdqa    %xmm1, %xmm6                                  #4155.22
-        pand      80(%esp), %xmm6                               #4155.22
-        pand      %xmm2, %xmm7                                  #4154.22
-        pcmpeqw   %xmm6, %xmm7                                  #4156.22
-        pmovmskb  %xmm7, %edi                                   #4157.22
-        movl      %edi, 44(%esp)                                #4157.22
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B8.11:                        # Preds ..B8.6 ..B8.10
-        movdqa    %xmm1, %xmm6                                  #4161.22
-        pand      64(%esp), %xmm1                               #4162.22
-        andl      $-4, %ecx                                     #4169.17
-        pand      %xmm0, %xmm6                                  #4161.22
-        pcmpeqw   %xmm1, %xmm6                                  #4163.22
-        pmovmskb  %xmm6, %edi                                   #4164.22
-        movl      %edi, 40(%esp)                                #4164.22
-        movl      %edx, %eax                                    #4172.29
-        orl       96(%esp), %eax                                #4172.29
-        orl       44(%esp), %eax                                #4172.34
-        orl       %edi, %eax                                    #4172.39
-        je        ..B8.20       # Prob 78%                      #4172.47
-                                # LOE edx ecx ebx esi xmm0 xmm2 xmm3 xmm4 xmm5
-..B8.12:                        # Preds ..B8.11
-        movl      %ecx, 32(%esp)                                #
-        movl      %edx, %eax                                    #4190.30
-        movl      %esi, 36(%esp)                                #
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4190.30
-        movswl    %ax, %ecx                                     #4190.30
-        movl      96(%esp), %eax                                #4191.30
-        movl      %ecx, 16(%esp)                                #4190.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4191.30
-        movswl    %ax, %edi                                     #4191.30
-        lea       1(%edi,%edi), %edi                            #4199.40
-        movl      44(%esp), %eax                                #4192.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4192.30
-        movswl    %ax, %esi                                     #4192.30
-        movl      40(%esp), %eax                                #4193.30
-        lea       2(%esi,%esi), %esi                            #4200.40
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4193.30
-        movl      %edi, 20(%esp)                                #4199.40
-        movl      %esi, 24(%esp)                                #4200.40
-        movl      36(%esp), %esi                                #4205.32
-        movswl    %ax, %ecx                                     #4193.30
-        lea       3(%ecx,%ecx), %ecx                            #4201.40
-        testl     %edx, %edx                                    #4205.32
-        movl      %ecx, 28(%esp)                                #4201.40
-        movl      32(%esp), %ecx                                #4205.32
-        je        ..B8.14       # Prob 50%                      #4205.32
-                                # LOE ecx ebx esi cl ch xmm0 xmm2 xmm3 xmm4 xmm5
-..B8.13:                        # Preds ..B8.12
-        movl      16(%esp), %eax                                #4205.43
-        movl      100(%esp), %edx                               #4205.49
-        lea       (%ecx,%eax,2), %edi                           #4205.43
-        cmpl      %edi, %edx                                    #4205.49
-        jae       ..B8.28       # Prob 1%                       #4205.49
-                                # LOE ecx ebx esi cl ch xmm0 xmm2 xmm3 xmm4 xmm5
-..B8.14:                        # Preds ..B8.13 ..B8.12
-        movl      96(%esp), %eax                                #4206.32
-        testl     %eax, %eax                                    #4206.32
-        je        ..B8.16       # Prob 50%                      #4206.32
-                                # LOE ecx ebx esi cl ch xmm0 xmm2 xmm3 xmm4 xmm5
-..B8.15:                        # Preds ..B8.14
-        movl      20(%esp), %edx                                #4206.43
-        movl      100(%esp), %eax                               #4206.49
-        addl      %ecx, %edx                                    #4206.43
-        cmpl      %edx, %eax                                    #4206.49
-        jae       ..B8.28       # Prob 1%                       #4206.49
-                                # LOE ecx ebx esi cl ch xmm0 xmm2 xmm3 xmm4 xmm5
-..B8.16:                        # Preds ..B8.15 ..B8.14
-        movl      44(%esp), %eax                                #4207.32
-        testl     %eax, %eax                                    #4207.32
-        je        ..B8.18       # Prob 50%                      #4207.32
-                                # LOE ecx ebx esi cl ch xmm0 xmm2 xmm3 xmm4 xmm5
-..B8.17:                        # Preds ..B8.16
-        movl      24(%esp), %edx                                #4207.43
-        movl      100(%esp), %eax                               #4207.49
-        addl      %ecx, %edx                                    #4207.43
-        cmpl      %edx, %eax                                    #4207.49
-        jae       ..B8.28       # Prob 1%                       #4207.49
-                                # LOE ecx ebx esi cl ch xmm0 xmm2 xmm3 xmm4 xmm5
-..B8.18:                        # Preds ..B8.17 ..B8.16
-        movl      40(%esp), %eax                                #4208.32
-        testl     %eax, %eax                                    #4208.32
-        je        ..B8.20       # Prob 50%                      #4208.32
-                                # LOE ecx ebx esi cl ch xmm0 xmm2 xmm3 xmm4 xmm5
-..B8.19:                        # Preds ..B8.18
-        movl      28(%esp), %edx                                #4208.43
-        movl      100(%esp), %eax                               #4208.49
-        addl      %ecx, %edx                                    #4208.43
-        cmpl      %edx, %eax                                    #4208.49
-        jae       ..B8.28       # Prob 1%                       #4208.49
-                                # LOE ecx ebx esi xmm0 xmm2 xmm3 xmm4 xmm5
-..B8.20:                        # Preds ..B8.19 ..B8.18 ..B8.11
-        movl      100(%esp), %eax                               #4216.28
-        lea       4(%ecx), %edx                                 #4241.13
-        cmpl      %edx, %eax                                    #4216.28
-        jb        ..B8.26       # Prob 1%                       #4216.28
-                                # LOE ecx ebx esi xmm0 xmm2 xmm3 xmm4 xmm5
-..B8.21:                        # Preds ..B8.20
-        movl      104(%esp), %eax                               #4237.25
-        cmpl      %eax, %esi                                    #4237.25
-        jae       ..B8.26       # Prob 1%                       #4237.25
-                                # LOE ecx ebx esi xmm0 xmm2 xmm3 xmm4 xmm5
-..B8.22:                        # Preds ..B8.21
-        movl      100(%esp), %eax                               #4242.24
-        addl      $32, %ecx                                     #4241.13
-        cmpl      %eax, %ecx                                    #4242.24
-        ja        ..B8.26       # Prob 1%                       #4242.24
-                                # LOE ecx ebx esi xmm0 xmm2 xmm3 xmm4 xmm5
-..B8.23:                        # Preds ..B8.22
-        movzbl    (%esi), %eax                                  #4247.22
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%eax,2), %edx        #4247.22
-        movzbl    1(%esi), %edi                                 #4247.22
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%edi,2), %eax        #4247.22
-        movw      %dx, (%esp)                                   #4247.22
-        movw      %ax, 2(%esp)                                  #4247.22
-        movzbl    2(%esi), %eax                                 #4247.22
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%eax,2), %eax        #4247.22
-        movw      %ax, 4(%esp)                                  #4247.22
-        movzbl    3(%esi), %eax                                 #4247.22
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%eax,2), %eax        #4247.22
-        movw      %ax, 6(%esp)                                  #4247.22
-        movzbl    4(%esi), %eax                                 #4247.22
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%eax,2), %eax        #4247.22
-        movw      %ax, 8(%esp)                                  #4247.22
-        movzbl    5(%esi), %eax                                 #4247.22
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%eax,2), %eax        #4247.22
-        movw      %ax, 10(%esp)                                 #4247.22
-        movzbl    6(%esi), %eax                                 #4247.22
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%eax,2), %eax        #4247.22
-        movw      %ax, 12(%esp)                                 #4247.22
-        movzbl    7(%esi), %eax                                 #4247.22
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%eax,2), %eax        #4247.22
-        addl      $8, %esi                                      #4262.13
-        movw      %ax, 14(%esp)                                 #4247.22
-        movdqu    (%esp), %xmm1                                 #4247.22
-                                # LOE ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B8.24:                        # Preds ..B8.23 ..B8.5
-        movdqa    %xmm1, %xmm7                                  #4140.22
-        movdqa    %xmm1, %xmm6                                  #4141.22
-        pand      %xmm5, %xmm7                                  #4140.22
-        pand      %xmm4, %xmm6                                  #4141.22
-        pcmpeqw   %xmm6, %xmm7                                  #4142.22
-        pmovmskb  %xmm7, %edx                                   #4143.22
-        jmp       ..B8.9        # Prob 100%                     #4143.22
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B8.26:                        # Preds ..B8.20 ..B8.21 ..B8.22 # Infreq
-        xorl      %eax, %eax                                    #4273.12
-        addl      $116, %esp                                    #4273.12
-        popl      %ebx                                          #4273.12
-        popl      %esi                                          #4273.12
-        popl      %edi                                          #4273.12
-        movl      %ebp, %esp                                    #4273.12
-        popl      %ebp                                          #4273.12
-        ret                                                     #4273.12
-                                # LOE
-..B8.28:                        # Preds ..B8.19 ..B8.17 ..B8.15 ..B8.13 # Infreq
-        movl      $1, %eax                                      #4205.63
-        addl      $116, %esp                                    #4205.63
-        popl      %ebx                                          #4205.63
-        popl      %esi                                          #4205.63
-        popl      %edi                                          #4205.63
-        movl      %ebp, %esp                                    #4205.63
-        popl      %ebp                                          #4205.63
-        ret                                                     #4205.63
-        .align    2,0x90
-                                # LOE
-# mark_end;
-	.type	eval_4na_16, at function
-	.size	eval_4na_16,.-eval_4na_16
-	.data
-# -- End  eval_4na_16
-	.text
-# -- Begin  eval_4na_32
-# mark_begin;
-       .align    2,0x90
-eval_4na_32:
-# parameter 1: %eax
-# parameter 2: %edx
-# parameter 3: %ecx
-# parameter 4: 20 + %ebp
-..B9.1:                         # Preds ..B9.0
-        pushl     %ebp                                          #4279.1
-        movl      %esp, %ebp                                    #4279.1
-        andl      $-16, %esp                                    #4279.1
-        pushl     %edi                                          #4279.1
-        pushl     %esi                                          #4279.1
-        pushl     %ebx                                          #4279.1
-        subl      $132, %esp                                    #4279.1
-        movdqa    16(%eax), %xmm7                               #4331.5
-        movdqa    32(%eax), %xmm5                               #4331.5
-        movl      20(%ebp), %ebx                                #4277.5
-        movdqa    48(%eax), %xmm4                               #4331.5
-        movdqa    64(%eax), %xmm3                               #4331.5
-        movdqa    80(%eax), %xmm6                               #4331.5
-        movdqa    112(%eax), %xmm2                              #4331.5
-        movdqa    128(%eax), %xmm1                              #4331.5
-        movl      %ecx, %edi                                    #4315.49
-        shrl      $2, %edi                                      #4315.49
-        call      ..L4          # Prob 100%                     #4279.1
-..L4:                                                           #
-        popl      %esi                                          #4279.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L4], %esi       #4279.1
-        movl      %esi, 32(%esp)                                #4279.1
-        lea       (%ecx,%ebx), %esi                             #4312.5
-        lea       3(%ecx,%ebx), %ebx                            #4321.50
-        shrl      $2, %ebx                                      #4321.57
-        subl      4(%eax), %esi                                 #4318.12
-        movl      %esi, 112(%esp)                               #4318.12
-        movzbl    (%edi,%edx), %esi                             #4324.14
-        addl      %edx, %ebx                                    #4321.30
-        movl      %ebx, 116(%esp)                               #4321.30
-        movl      32(%esp), %ebx                                #4324.14
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%esi,2), %esi        #4324.14
-        movw      %si, (%esp)                                   #4324.14
-        movzbl    1(%edi,%edx), %esi                            #4324.14
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%esi,2), %esi        #4324.14
-        movw      %si, 2(%esp)                                  #4324.14
-        movzbl    2(%edi,%edx), %esi                            #4324.14
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%esi,2), %esi        #4324.14
-        movw      %si, 4(%esp)                                  #4324.14
-        movzbl    3(%edi,%edx), %esi                            #4324.14
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%esi,2), %esi        #4324.14
-        movw      %si, 6(%esp)                                  #4324.14
-        movzbl    4(%edi,%edx), %esi                            #4324.14
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%esi,2), %esi        #4324.14
-        movw      %si, 8(%esp)                                  #4324.14
-        movzbl    5(%edi,%edx), %esi                            #4324.14
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%esi,2), %esi        #4324.14
-        movw      %si, 10(%esp)                                 #4324.14
-        movzbl    6(%edi,%edx), %esi                            #4324.14
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%esi,2), %esi        #4324.14
-        movw      %si, 12(%esp)                                 #4324.14
-        movzbl    7(%edi,%edx), %esi                            #4324.14
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%esi,2), %esi        #4324.14
-        movw      %si, 14(%esp)                                 #4324.14
-        movdqu    (%esp), %xmm0                                 #4324.14
-        lea       8(%edx,%edi), %esi                            #4325.5
-        movdqa    %xmm0, 16(%esp)                               #4324.14
-        movdqa    96(%eax), %xmm0                               #4331.5
-        movl      %esi, %edx                                    #4325.5
-        movl      %ecx, %eax                                    #4345.20
-        andl      $3, %eax                                      #4345.20
-        je        ..B9.33       # Prob 20%                      #4345.20
-                                # LOE eax edx ecx ebx esi bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B9.2:                         # Preds ..B9.1
-        cmpl      $1, %eax                                      #4345.20
-        je        ..B9.8        # Prob 25%                      #4345.20
-                                # LOE eax edx ecx ebx esi bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B9.3:                         # Preds ..B9.2
-        cmpl      $2, %eax                                      #4345.20
-        je        ..B9.7        # Prob 33%                      #4345.20
-                                # LOE eax edx ecx ebx esi bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B9.4:                         # Preds ..B9.3
-        cmpl      $3, %eax                                      #4345.20
-        je        ..B9.6        # Prob 50%                      #4345.20
-                                # LOE edx ecx ebx esi bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B9.5:                         # Preds ..B9.4
-        movdqa    %xmm0, 80(%esp)                               #
-        movdqa    16(%esp), %xmm0                               #
-        movdqa    %xmm6, 64(%esp)                               #
-        movdqa    %xmm7, 48(%esp)                               #
-        jmp       ..B9.25       # Prob 100%                     #
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.6:                         # Preds ..B9.4
-        movdqa    %xmm0, 80(%esp)                               #
-        movdqa    16(%esp), %xmm0                               #
-        movdqa    %xmm6, 64(%esp)                               #
-        movdqa    %xmm7, 48(%esp)                               #
-        xorl      %eax, %eax                                    #
-        movl      %eax, 44(%esp)                                #
-        xorl      %edi, %edi                                    #
-        movl      %edi, 96(%esp)                                #
-        movl      %eax, 104(%esp)                               #
-        movl      $2, %edi                                      #
-        jmp       ..B9.11       # Prob 100%                     #
-                                # LOE edx ecx ebx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.7:                         # Preds ..B9.3
-        movdqa    %xmm0, 80(%esp)                               #
-        movdqa    16(%esp), %xmm0                               #
-        movdqa    %xmm6, 64(%esp)                               #
-        movdqa    %xmm7, 48(%esp)                               #
-        xorl      %eax, %eax                                    #
-        movl      %eax, 96(%esp)                                #
-        movl      $2, %edi                                      #
-        movl      %eax, 104(%esp)                               #
-        jmp       ..B9.10       # Prob 100%                     #
-                                # LOE edx ecx ebx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.8:                         # Preds ..B9.2
-        movdqa    %xmm0, 80(%esp)                               #
-        movdqa    16(%esp), %xmm0                               #
-        movdqa    %xmm6, 64(%esp)                               #
-        movdqa    %xmm7, 48(%esp)                               #
-        xorl      %eax, %eax                                    #
-        movl      %eax, 104(%esp)                               #
-        movl      $2, %edi                                      #
-                                # LOE edx ecx ebx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.9:                         # Preds ..B9.8 ..B9.29
-        movdqa    %xmm0, %xmm7                                  #4369.22
-        movdqa    %xmm0, %xmm6                                  #4370.22
-        pand      %xmm4, %xmm7                                  #4369.22
-        pand      %xmm3, %xmm6                                  #4370.22
-        pcmpeqd   %xmm6, %xmm7                                  #4371.22
-        pmovmskb  %xmm7, %eax                                   #4372.22
-        movl      %eax, 96(%esp)                                #4372.22
-                                # LOE edx ecx ebx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.10:                        # Preds ..B9.7 ..B9.9
-        movdqa    %xmm0, %xmm7                                  #4376.22
-        movdqa    %xmm0, %xmm6                                  #4377.22
-        pand      64(%esp), %xmm7                               #4376.22
-        pand      80(%esp), %xmm6                               #4377.22
-        pcmpeqd   %xmm6, %xmm7                                  #4378.22
-        pmovmskb  %xmm7, %eax                                   #4379.22
-        movl      %eax, 44(%esp)                                #4379.22
-                                # LOE edx ecx ebx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.11:                        # Preds ..B9.6 ..B9.10
-        movdqa    %xmm0, %xmm7                                  #4383.22
-        movdqa    %xmm0, %xmm6                                  #4384.22
-        pand      %xmm2, %xmm7                                  #4383.22
-        pand      %xmm1, %xmm6                                  #4384.22
-        pcmpeqd   %xmm6, %xmm7                                  #4385.22
-        pmovmskb  %xmm7, %eax                                   #4386.22
-        movl      %eax, 100(%esp)                               #4386.22
-        andl      $-4, %ecx                                     #4391.17
-        movl      %ecx, 108(%esp)                               #4391.17
-        movl      104(%esp), %ecx                               #4394.29
-        orl       96(%esp), %ecx                                #4394.29
-        orl       44(%esp), %ecx                                #4394.34
-        orl       %eax, %ecx                                    #4394.39
-        je        ..B9.20       # Prob 78%                      #4394.47
-                                # LOE edx ebx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.12:                        # Preds ..B9.11
-        movl      %edi, 32(%esp)                                #
-        movl      104(%esp), %edi                               #4412.30
-        movl      %esi, 36(%esp)                                #
-        movl      %edi, %eax                                    #4412.30
-        movl      %edx, 40(%esp)                                #
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4412.30
-        movswl    %ax, %edx                                     #4412.30
-        movl      96(%esp), %eax                                #4413.30
-        movl      %edx, 16(%esp)                                #4412.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4413.30
-        movswl    %ax, %esi                                     #4413.30
-        lea       1(%esi,%esi), %esi                            #4421.40
-        movl      44(%esp), %eax                                #4414.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4414.30
-        movswl    %ax, %ecx                                     #4414.30
-        movl      100(%esp), %eax                               #4415.30
-        lea       2(%ecx,%ecx), %ecx                            #4422.40
-# Begin ASM
-        bsf %ax, %ax;jnz .+5;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4415.30
-        movl      %esi, 20(%esp)                                #4421.40
-        movl      36(%esp), %esi                                #4427.32
-        movl      %ecx, 24(%esp)                                #4422.40
-        movswl    %ax, %edx                                     #4415.30
-        lea       3(%edx,%edx), %edx                            #4423.40
-        movl      %edx, 28(%esp)                                #4423.40
-        movl      40(%esp), %edx                                #4427.32
-        testl     %edi, %edi                                    #4427.32
-        movl      32(%esp), %edi                                #4427.32
-        je        ..B9.14       # Prob 50%                      #4427.32
-                                # LOE edx ebx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.13:                        # Preds ..B9.12
-        movl      16(%esp), %ecx                                #4427.43
-        movl      108(%esp), %eax                               #4427.43
-        lea       (%eax,%ecx,2), %ecx                           #4427.43
-        movl      112(%esp), %eax                               #4427.49
-        cmpl      %ecx, %eax                                    #4427.49
-        jae       ..B9.34       # Prob 1%                       #4427.49
-                                # LOE edx ebx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.14:                        # Preds ..B9.13 ..B9.12
-        movl      96(%esp), %eax                                #4428.32
-        testl     %eax, %eax                                    #4428.32
-        je        ..B9.16       # Prob 50%                      #4428.32
-                                # LOE edx ebx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.15:                        # Preds ..B9.14
-        movl      20(%esp), %ecx                                #4428.43
-        addl      108(%esp), %ecx                               #4428.43
-        movl      112(%esp), %eax                               #4428.49
-        cmpl      %ecx, %eax                                    #4428.49
-        jae       ..B9.34       # Prob 1%                       #4428.49
-                                # LOE edx ebx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.16:                        # Preds ..B9.15 ..B9.14
-        movl      44(%esp), %eax                                #4429.32
-        testl     %eax, %eax                                    #4429.32
-        je        ..B9.18       # Prob 50%                      #4429.32
-                                # LOE edx ebx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.17:                        # Preds ..B9.16
-        movl      24(%esp), %ecx                                #4429.43
-        addl      108(%esp), %ecx                               #4429.43
-        movl      112(%esp), %eax                               #4429.49
-        cmpl      %ecx, %eax                                    #4429.49
-        jae       ..B9.34       # Prob 1%                       #4429.49
-                                # LOE edx ebx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.18:                        # Preds ..B9.17 ..B9.16
-        movl      100(%esp), %eax                               #4430.32
-        testl     %eax, %eax                                    #4430.32
-        je        ..B9.20       # Prob 50%                      #4430.32
-                                # LOE edx ebx esi edi dl dh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.19:                        # Preds ..B9.18
-        movl      28(%esp), %ecx                                #4430.43
-        addl      108(%esp), %ecx                               #4430.43
-        movl      112(%esp), %eax                               #4430.49
-        cmpl      %ecx, %eax                                    #4430.49
-        jae       ..B9.34       # Prob 1%                       #4430.49
-                                # LOE edx ebx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.20:                        # Preds ..B9.19 ..B9.18 ..B9.11
-        movl      108(%esp), %ecx                               #4435.17
-        movl      112(%esp), %eax                               #4438.28
-        lea       4(%ecx), %ecx                                 #4435.17
-        cmpl      %eax, %ecx                                    #4438.28
-        ja        ..B9.31       # Prob 1%                       #4438.28
-                                # LOE edx ecx ebx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.21:                        # Preds ..B9.20
-        addl      $-1, %edi                                     #4442.25
-        jne       ..B9.26       # Prob 50%                      #4442.39
-                                # LOE edx ecx ebx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.22:                        # Preds ..B9.21
-        movl      116(%esp), %eax                               #4459.25
-        cmpl      %eax, %esi                                    #4459.25
-        jae       ..B9.31       # Prob 1%                       #4459.25
-                                # LOE ebx esi xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.23:                        # Preds ..B9.22
-        movl      108(%esp), %ecx                               #4463.13
-        movl      112(%esp), %eax                               #4464.24
-        lea       28(%ecx), %ecx                                #4463.13
-        cmpl      %eax, %ecx                                    #4464.24
-        ja        ..B9.31       # Prob 1%                       #4464.24
-                                # LOE ecx ebx esi xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.24:                        # Preds ..B9.23
-        movzbl    (%esi), %eax                                  #4469.22
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%eax,2), %edx        #4469.22
-        movzbl    1(%esi), %edi                                 #4469.22
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%edi,2), %eax        #4469.22
-        movw      %dx, (%esp)                                   #4469.22
-        movw      %ax, 2(%esp)                                  #4469.22
-        movzbl    2(%esi), %eax                                 #4469.22
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%eax,2), %eax        #4469.22
-        movw      %ax, 4(%esp)                                  #4469.22
-        movzbl    3(%esi), %eax                                 #4469.22
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%eax,2), %eax        #4469.22
-        movw      %ax, 6(%esp)                                  #4469.22
-        movzbl    4(%esi), %eax                                 #4469.22
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%eax,2), %eax        #4469.22
-        movw      %ax, 8(%esp)                                  #4469.22
-        movzbl    5(%esi), %eax                                 #4469.22
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%eax,2), %eax        #4469.22
-        movw      %ax, 10(%esp)                                 #4469.22
-        movzbl    6(%esi), %eax                                 #4469.22
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%eax,2), %eax        #4469.22
-        movw      %ax, 12(%esp)                                 #4469.22
-        movzbl    7(%esi), %eax                                 #4469.22
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%eax,2), %eax        #4469.22
-        addl      $8, %esi                                      #4484.13
-        movl      %esi, %edx                                    #4484.13
-        movw      %ax, 14(%esp)                                 #4469.22
-        movdqu    (%esp), %xmm0                                 #4469.22
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.25:                        # Preds ..B9.5 ..B9.24
-        movl      $2, %edi                                      #4352.13
-        jmp       ..B9.29       # Prob 100%                     #4352.13
-                                # LOE edx ecx ebx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.26:                        # Preds ..B9.21
-        movl      116(%esp), %eax                               #4450.26
-        psrldq    $2, %xmm0                                     #4447.26
-        cmpl      %eax, %edx                                    #4450.26
-        jae       ..B9.28       # Prob 19%                      #4450.26
-                                # LOE edx ecx ebx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.27:                        # Preds ..B9.26
-        movzbl    (%edx), %eax                                  #4451.72
-        movzwl    expand_2na.0 at GOTOFF(%ebx,%eax,2), %eax        #4451.57
-        pinsrw    $7, %eax, %xmm0                               #4451.30
-                                # LOE edx ecx ebx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.28:                        # Preds ..B9.27 ..B9.26
-        addl      $1, %edx                                      #4454.20
-                                # LOE edx ecx ebx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.29:                        # Preds ..B9.25 ..B9.28 ..B9.33
-        movdqa    %xmm0, %xmm7                                  #4362.22
-        movdqa    %xmm0, %xmm6                                  #4363.22
-        pand      48(%esp), %xmm7                               #4362.22
-        pand      %xmm5, %xmm6                                  #4363.22
-        pcmpeqd   %xmm6, %xmm7                                  #4364.22
-        pmovmskb  %xmm7, %eax                                   #4365.22
-        movl      %eax, 104(%esp)                               #4365.22
-        jmp       ..B9.9        # Prob 100%                     #4365.22
-                                # LOE edx ecx ebx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.31:                        # Preds ..B9.20 ..B9.22 ..B9.23 # Infreq
-        xorl      %eax, %eax                                    #4495.12
-        addl      $132, %esp                                    #4495.12
-        popl      %ebx                                          #4495.12
-        popl      %esi                                          #4495.12
-        popl      %edi                                          #4495.12
-        movl      %ebp, %esp                                    #4495.12
-        popl      %ebp                                          #4495.12
-        ret                                                     #4495.12
-                                # LOE
-..B9.33:                        # Preds ..B9.1                  # Infreq
-        movdqa    %xmm0, 80(%esp)                               #
-        movdqa    16(%esp), %xmm0                               #
-        movdqa    %xmm6, 64(%esp)                               #
-        movdqa    %xmm7, 48(%esp)                               #
-        movl      $2, %edi                                      #
-        jmp       ..B9.29       # Prob 100%                     #
-                                # LOE edx ecx ebx esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B9.34:                        # Preds ..B9.13 ..B9.19 ..B9.17 ..B9.15 # Infreq
-        movl      $1, %eax                                      #4428.63
-        addl      $132, %esp                                    #4428.63
-        popl      %ebx                                          #4428.63
-        popl      %esi                                          #4428.63
-        popl      %edi                                          #4428.63
-        movl      %ebp, %esp                                    #4428.63
-        popl      %ebp                                          #4428.63
-        ret                                                     #4428.63
-        .align    2,0x90
-                                # LOE
-# mark_end;
-	.type	eval_4na_32, at function
-	.size	eval_4na_32,.-eval_4na_32
-	.data
-# -- End  eval_4na_32
-	.text
-# -- Begin  eval_4na_128
-# mark_begin;
-       .align    2,0x90
-eval_4na_128:
-# parameter 1: %eax
-# parameter 2: %edx
-# parameter 3: %ecx
-# parameter 4: 20 + %ebp
-..B10.1:                        # Preds ..B10.0
-        pushl     %ebp                                          #4724.1
-        movl      %esp, %ebp                                    #4724.1
-        andl      $-16, %esp                                    #4724.1
-        pushl     %edi                                          #4724.1
-        pushl     %esi                                          #4724.1
-        pushl     %ebx                                          #4724.1
-        subl      $116, %esp                                    #4724.1
-        movl      20(%ebp), %esi                                #4722.5
-        movl      %ecx, 16(%esp)                                #4724.1
-        movdqa    16(%eax), %xmm5                               #4776.5
-        movdqa    32(%eax), %xmm4                               #4776.5
-        movdqa    48(%eax), %xmm3                               #4776.5
-        movdqa    64(%eax), %xmm2                               #4776.5
-        movdqa    80(%eax), %xmm1                               #4776.5
-        movdqa    96(%eax), %xmm6                               #4776.5
-        movdqa    128(%eax), %xmm7                              #4776.5
-        movl      %ecx, %edi                                    #4760.49
-        shrl      $2, %edi                                      #4760.49
-        call      ..L5          # Prob 100%                     #4724.1
-..L5:                                                           #
-        popl      %ebx                                          #4724.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L5], %ebx       #4724.1
-        movl      %ebx, 20(%esp)                                #4724.1
-        lea       (%ecx,%esi), %ebx                             #4757.5
-        lea       3(%ecx,%esi), %ecx                            #4766.50
-        subl      4(%eax), %ebx                                 #4763.12
-        movl      20(%esp), %esi                                #4769.14
-        movl      %ebx, 100(%esp)                               #4763.12
-        shrl      $2, %ecx                                      #4766.57
-        addl      %edx, %ecx                                    #4766.30
-        movl      %ecx, 96(%esp)                                #4766.30
-        movzbl    (%edi,%edx), %ecx                             #4769.14
-        movzwl    expand_2na.0 at GOTOFF(%esi,%ecx,2), %ecx        #4769.14
-        movw      %cx, (%esp)                                   #4769.14
-        movzbl    1(%edi,%edx), %ecx                            #4769.14
-        movzwl    expand_2na.0 at GOTOFF(%esi,%ecx,2), %ecx        #4769.14
-        movw      %cx, 2(%esp)                                  #4769.14
-        movzbl    2(%edi,%edx), %ecx                            #4769.14
-        movzwl    expand_2na.0 at GOTOFF(%esi,%ecx,2), %ecx        #4769.14
-        movw      %cx, 4(%esp)                                  #4769.14
-        movzbl    3(%edi,%edx), %ecx                            #4769.14
-        movzwl    expand_2na.0 at GOTOFF(%esi,%ecx,2), %ecx        #4769.14
-        movw      %cx, 6(%esp)                                  #4769.14
-        movzbl    4(%edi,%edx), %ecx                            #4769.14
-        movzwl    expand_2na.0 at GOTOFF(%esi,%ecx,2), %ecx        #4769.14
-        movw      %cx, 8(%esp)                                  #4769.14
-        movzbl    5(%edi,%edx), %ecx                            #4769.14
-        movzwl    expand_2na.0 at GOTOFF(%esi,%ecx,2), %ecx        #4769.14
-        movw      %cx, 10(%esp)                                 #4769.14
-        movzbl    6(%edi,%edx), %ecx                            #4769.14
-        movzwl    expand_2na.0 at GOTOFF(%esi,%ecx,2), %ecx        #4769.14
-        movw      %cx, 12(%esp)                                 #4769.14
-        movzbl    7(%edi,%edx), %ecx                            #4769.14
-        movzwl    expand_2na.0 at GOTOFF(%esi,%ecx,2), %ecx        #4769.14
-        movw      %cx, 14(%esp)                                 #4769.14
-        movdqu    (%esp), %xmm0                                 #4769.14
-        lea       8(%edx,%edi), %edx                            #4770.5
-        movdqa    %xmm0, 64(%esp)                               #4769.14
-        movdqa    112(%eax), %xmm0                              #4776.5
-        movl      %edx, %ecx                                    #4770.5
-        movl      16(%esp), %eax                                #4781.20
-        subl      %eax, %ebx                                    #4781.20
-        addl      $7, %ebx                                      #4781.33
-        shrl      $2, %ebx                                      #4781.40
-        movl      %eax, %edi                                    #4790.20
-        andl      $3, %edi                                      #4790.20
-        je        ..B10.32      # Prob 20%                      #4790.20
-                                # LOE eax edx ecx ebx esi edi al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B10.2:                        # Preds ..B10.1
-        cmpl      $1, %edi                                      #4790.20
-        je        ..B10.8       # Prob 25%                      #4790.20
-                                # LOE eax edx ecx ebx esi edi al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B10.3:                        # Preds ..B10.2
-        cmpl      $2, %edi                                      #4790.20
-        je        ..B10.7       # Prob 33%                      #4790.20
-                                # LOE eax edx ecx ebx esi edi al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B10.4:                        # Preds ..B10.3
-        cmpl      $3, %edi                                      #4790.20
-        je        ..B10.6       # Prob 50%                      #4790.20
-                                # LOE eax edx ecx ebx esi al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B10.5:                        # Preds ..B10.4
-        movdqa    %xmm7, 16(%esp)                               #
-        movdqa    %xmm0, 32(%esp)                               #
-        movdqa    64(%esp), %xmm0                               #
-        movdqa    %xmm6, 48(%esp)                               #
-        movl      %ecx, 92(%esp)                                #
-        jmp       ..B10.16      # Prob 100%                     #
-                                # LOE eax edx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.6:                        # Preds ..B10.4
-        movdqa    %xmm7, 16(%esp)                               #
-        movdqa    %xmm0, 32(%esp)                               #
-        movdqa    64(%esp), %xmm0                               #
-        movdqa    %xmm6, 48(%esp)                               #
-        xorl      %edi, %edi                                    #
-        movl      %edi, 80(%esp)                                #
-        movl      %ecx, 92(%esp)                                #
-        movl      %edi, 84(%esp)                                #
-        movl      %edi, 88(%esp)                                #
-        jmp       ..B10.11      # Prob 100%                     #
-                                # LOE eax edx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.7:                        # Preds ..B10.3
-        movdqa    %xmm7, 16(%esp)                               #
-        movdqa    %xmm0, 32(%esp)                               #
-        movdqa    64(%esp), %xmm0                               #
-        movdqa    %xmm6, 48(%esp)                               #
-        xorl      %edi, %edi                                    #
-        movl      %edi, 84(%esp)                                #
-        movl      %ecx, 92(%esp)                                #
-        movl      %edi, 88(%esp)                                #
-        jmp       ..B10.10      # Prob 100%                     #
-                                # LOE eax edx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.8:                        # Preds ..B10.2
-        movdqa    %xmm7, 16(%esp)                               #
-        movdqa    %xmm0, 32(%esp)                               #
-        movdqa    64(%esp), %xmm0                               #
-        movdqa    %xmm6, 48(%esp)                               #
-        xorl      %edi, %edi                                    #
-        movl      %ecx, 92(%esp)                                #
-        movl      %edi, 88(%esp)                                #
-                                # LOE eax edx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.9:                        # Preds ..B10.8 ..B10.20
-        movdqa    %xmm0, %xmm7                                  #4814.22
-        movdqa    %xmm0, %xmm6                                  #4815.22
-        pand      %xmm3, %xmm7                                  #4814.22
-        pand      %xmm2, %xmm6                                  #4815.22
-        pcmpeqd   %xmm6, %xmm7                                  #4816.22
-        pmovmskb  %xmm7, %ecx                                   #4817.22
-        addl      $1, %ecx                                      #4818.17
-        shrl      $16, %ecx                                     #4818.17
-        negl      %ecx                                          #4818.17
-        movl      %ecx, 84(%esp)                                #4818.17
-                                # LOE eax edx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.10:                       # Preds ..B10.7 ..B10.9
-        movdqa    %xmm0, %xmm7                                  #4821.22
-        movdqa    %xmm0, %xmm6                                  #4822.22
-        pand      48(%esp), %xmm6                               #4822.22
-        pand      %xmm1, %xmm7                                  #4821.22
-        pcmpeqd   %xmm6, %xmm7                                  #4823.22
-        pmovmskb  %xmm7, %ecx                                   #4824.22
-        addl      $1, %ecx                                      #4825.17
-        shrl      $16, %ecx                                     #4825.17
-        negl      %ecx                                          #4825.17
-        movl      %ecx, 80(%esp)                                #4825.17
-                                # LOE eax edx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.11:                       # Preds ..B10.6 ..B10.10
-        movdqa    %xmm0, %xmm7                                  #4828.22
-        movdqa    %xmm0, %xmm6                                  #4829.22
-        movl      88(%esp), %edi                                #4839.29
-        pand      32(%esp), %xmm7                               #4828.22
-        pand      16(%esp), %xmm6                               #4829.22
-        pcmpeqd   %xmm6, %xmm7                                  #4830.22
-        pmovmskb  %xmm7, %ecx                                   #4831.22
-        andl      $-4, %eax                                     #4836.17
-        addl      $1, %ecx                                      #4832.17
-        orl       84(%esp), %edi                                #4839.29
-        orl       80(%esp), %edi                                #4839.34
-        shrl      $16, %ecx                                     #4832.17
-        negl      %ecx                                          #4832.17
-        orl       %ecx, %edi                                    #4839.39
-        jne       ..B10.21      # Prob 1%                       #4839.47
-                                # LOE eax edx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.12:                       # Preds ..B10.11
-        movl      100(%esp), %ecx                               #4883.28
-        addl      $4, %eax                                      #4880.17
-        cmpl      %ecx, %eax                                    #4883.28
-        ja        ..B10.28      # Prob 1%                       #4883.28
-                                # LOE eax edx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.13:                       # Preds ..B10.12
-        addl      $-1, %ebx                                     #4887.25
-        jne       ..B10.17      # Prob 50%                      #4887.39
-                                # LOE eax edx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.14:                       # Preds ..B10.13
-        movl      96(%esp), %ecx                                #4904.25
-        cmpl      %ecx, %edx                                    #4904.25
-        jae       ..B10.28      # Prob 1%                       #4904.25
-                                # LOE eax edx esi xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.15:                       # Preds ..B10.14
-        movzbl    (%edx), %ecx                                  #4914.22
-        movzwl    expand_2na.0 at GOTOFF(%esi,%ecx,2), %ebx        #4914.22
-        movzbl    1(%edx), %edi                                 #4914.22
-        movzwl    expand_2na.0 at GOTOFF(%esi,%edi,2), %ecx        #4914.22
-        movw      %bx, (%esp)                                   #4914.22
-        movw      %cx, 2(%esp)                                  #4914.22
-        movzbl    2(%edx), %ecx                                 #4914.22
-        movzwl    expand_2na.0 at GOTOFF(%esi,%ecx,2), %ecx        #4914.22
-        movw      %cx, 4(%esp)                                  #4914.22
-        movzbl    3(%edx), %ecx                                 #4914.22
-        movzwl    expand_2na.0 at GOTOFF(%esi,%ecx,2), %ecx        #4914.22
-        movw      %cx, 6(%esp)                                  #4914.22
-        movzbl    4(%edx), %ecx                                 #4914.22
-        movzwl    expand_2na.0 at GOTOFF(%esi,%ecx,2), %ecx        #4914.22
-        movw      %cx, 8(%esp)                                  #4914.22
-        movzbl    5(%edx), %ecx                                 #4914.22
-        movzwl    expand_2na.0 at GOTOFF(%esi,%ecx,2), %ecx        #4914.22
-        movw      %cx, 10(%esp)                                 #4914.22
-        movzbl    6(%edx), %ecx                                 #4914.22
-        movzwl    expand_2na.0 at GOTOFF(%esi,%ecx,2), %ecx        #4914.22
-        movw      %cx, 12(%esp)                                 #4914.22
-        movzbl    7(%edx), %ecx                                 #4914.22
-        movzwl    expand_2na.0 at GOTOFF(%esi,%ecx,2), %ecx        #4914.22
-        addl      $8, %edx                                      #4929.13
-        movw      %cx, 14(%esp)                                 #4914.22
-        movdqu    (%esp), %xmm0                                 #4914.22
-        movl      %edx, 92(%esp)                                #4929.13
-                                # LOE eax edx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.16:                       # Preds ..B10.5 ..B10.15
-        movl      $8, %ebx                                      #4797.13
-        jmp       ..B10.20      # Prob 100%                     #4797.13
-                                # LOE eax edx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.17:                       # Preds ..B10.13
-        movl      96(%esp), %edi                                #4895.26
-        movl      92(%esp), %ecx                                #4895.26
-        psrldq    $2, %xmm0                                     #4892.26
-        cmpl      %edi, %ecx                                    #4895.26
-        jae       ..B10.19      # Prob 19%                      #4895.26
-                                # LOE eax edx ecx ebx esi cl ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.18:                       # Preds ..B10.17
-        movzbl    (%ecx), %edi                                  #4896.72
-        movzwl    expand_2na.0 at GOTOFF(%esi,%edi,2), %ecx        #4896.57
-        pinsrw    $7, %ecx, %xmm0                               #4896.30
-                                # LOE eax edx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.19:                       # Preds ..B10.18 ..B10.17
-        addl      $1, 92(%esp)                                  #4899.20
-                                # LOE eax edx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.20:                       # Preds ..B10.16 ..B10.19 ..B10.32
-        movdqa    %xmm0, %xmm7                                  #4807.22
-        movdqa    %xmm0, %xmm6                                  #4808.22
-        pand      %xmm5, %xmm7                                  #4807.22
-        pand      %xmm4, %xmm6                                  #4808.22
-        pcmpeqd   %xmm6, %xmm7                                  #4809.22
-        pmovmskb  %xmm7, %ecx                                   #4810.22
-        addl      $1, %ecx                                      #4811.17
-        shrl      $16, %ecx                                     #4811.17
-        negl      %ecx                                          #4811.17
-        movl      %ecx, 88(%esp)                                #4811.17
-        jmp       ..B10.9       # Prob 100%                     #4811.17
-                                # LOE eax edx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B10.21:                       # Preds ..B10.11                # Infreq
-        movl      88(%esp), %edi                                #
-        movl      100(%esp), %edx                               #4842.30
-        subl      %eax, %edx                                    #4842.30
-        movl      %edx, 100(%esp)                               #4842.30
-        cmpl      $2, %edx                                      #4842.37
-        je        ..B10.25      # Prob 25%                      #4842.37
-                                # LOE edx edi dl dh
-..B10.22:                       # Preds ..B10.21                # Infreq
-        movl      %edx, %eax                                    #4842.37
-        cmpl      $1, %eax                                      #4842.37
-        je        ..B10.26      # Prob 33%                      #4842.37
-                                # LOE eax edi al ah
-..B10.23:                       # Preds ..B10.22                # Infreq
-        testl     %eax, %eax                                    #4842.37
-        je        ..B10.27      # Prob 50%                      #4842.37
-                                # LOE edi
-..B10.24:                       # Preds ..B10.25 ..B10.26 ..B10.27 ..B10.23 # Infreq
-        movl      $1, %eax                                      #4845.32
-        addl      $116, %esp                                    #4845.32
-        popl      %ebx                                          #4845.32
-        popl      %esi                                          #4845.32
-        popl      %edi                                          #4845.32
-        movl      %ebp, %esp                                    #4845.32
-        popl      %ebp                                          #4845.32
-        ret                                                     #4845.32
-                                # LOE
-..B10.25:                       # Preds ..B10.21                # Infreq
-        movl      80(%esp), %eax                                #4847.36
-        testl     %eax, %eax                                    #4847.36
-        jne       ..B10.24      # Prob 28%                      #4847.36
-                                # LOE edi
-..B10.26:                       # Preds ..B10.25 ..B10.22       # Infreq
-        movl      84(%esp), %eax                                #4849.36
-        testl     %eax, %eax                                    #4849.36
-        jne       ..B10.24      # Prob 28%                      #4849.36
-                                # LOE edi
-..B10.27:                       # Preds ..B10.23 ..B10.26       # Infreq
-        testl     %edi, %edi                                    #4851.36
-        jne       ..B10.24      # Prob 28%                      #4851.36
-                                # LOE
-..B10.28:                       # Preds ..B10.14 ..B10.12 ..B10.27 # Infreq
-        xorl      %eax, %eax                                    #4853.28
-        addl      $116, %esp                                    #4853.28
-        popl      %ebx                                          #4853.28
-        popl      %esi                                          #4853.28
-        popl      %edi                                          #4853.28
-        movl      %ebp, %esp                                    #4853.28
-        popl      %ebp                                          #4853.28
-        ret                                                     #4853.28
-                                # LOE
-..B10.32:                       # Preds ..B10.1                 # Infreq
-        movdqa    %xmm7, 16(%esp)                               #
-        movdqa    %xmm0, 32(%esp)                               #
-        movdqa    64(%esp), %xmm0                               #
-        movdqa    %xmm6, 48(%esp)                               #
-        movl      %ecx, 92(%esp)                                #
-        jmp       ..B10.20      # Prob 100%                     #
-        .align    2,0x90
-                                # LOE eax edx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-# mark_end;
-	.type	eval_4na_128, at function
-	.size	eval_4na_128,.-eval_4na_128
-	.data
-# -- End  eval_4na_128
-	.text
-# -- Begin  eval_2na_pos
-# mark_begin;
-       .align    2,0x90
-eval_2na_pos:
-# parameter 1: %eax
-# parameter 2: %edx
-# parameter 3: %ecx
-# parameter 4: 20 + %ebp
-..B11.1:                        # Preds ..B11.0
-        pushl     %ebp                                          #3662.1
-        movl      %esp, %ebp                                    #3662.1
-        andl      $-16, %esp                                    #3662.1
-        pushl     %edi                                          #3662.1
-        pushl     %esi                                          #3662.1
-        pushl     %ebx                                          #3662.1
-        subl      $84, %esp                                     #3662.1
-        movl      20(%ebp), %edi                                #3660.5
-        movl      %ecx, 60(%esp)                                #3662.1
-        lea       (%ecx,%edi), %esi                             #3705.5
-        subl      4(%eax), %esi                                 #3716.12
-        movl      %ecx, %ebx                                    #3713.49
-        movl      %esi, 64(%esp)                                #3716.12
-        shrl      $2, %ebx                                      #3713.49
-        movl      %ebx, 72(%esp)                                #3713.49
-        lea       (%edx,%ebx), %ebx                             #3713.30
-        lea       3(%ecx,%edi), %esi                            #3719.50
-        shrl      $2, %esi                                      #3719.57
-        movl      72(%esp), %edi                                #3722.14
-        addl      %edx, %esi                                    #3719.30
-        testb     $15, %bl                                      #3722.14
-        jne       ..B11.3       # Prob 50%                      #3722.14
-                                # LOE eax edx ecx ebx esi edi cl ch
-..B11.2:                        # Preds ..B11.1
-        movdqa    (%ebx), %xmm0                                 #3722.14
-        movdqa    %xmm0, 32(%esp)                               #3722.14
-        jmp       ..B11.4       # Prob 100%                     #3722.14
-                                # LOE eax edx ecx esi edi cl ch
-..B11.3:                        # Preds ..B11.1
-        movdqu    (%ebx), %xmm0                                 #3722.14
-        movdqa    %xmm0, 32(%esp)                               #3722.14
-                                # LOE eax edx ecx esi edi cl ch
-..B11.4:                        # Preds ..B11.2 ..B11.3
-        lea       16(%edx,%edi), %ebx                           #3723.5
-        movl      %ebx, 68(%esp)                                #3723.5
-        cmpl      %esi, %ebx                                    #3728.16
-        jae       ..B11.6       # Prob 12%                      #3728.16
-                                # LOE eax ecx ebx esi cl bl ch bh
-..B11.5:                        # Preds ..B11.4
-        movzbl    -1(%ebx), %edx                                #3729.24
-        shll      $8, %edx                                      #3729.38
-        jmp       ..B11.7       # Prob 100%                     #3729.38
-                                # LOE eax edx ecx ebx esi cl bl ch bh
-..B11.6:                        # Preds ..B11.4
-        xorl      %edx, %edx                                    #
-                                # LOE eax edx ecx ebx esi cl bl ch bh
-..B11.7:                        # Preds ..B11.5 ..B11.6
-        movdqa    16(%eax), %xmm6                               #3733.5
-        movdqa    32(%eax), %xmm5                               #3733.5
-        movdqa    48(%eax), %xmm4                               #3733.5
-        movdqa    64(%eax), %xmm3                               #3733.5
-        movdqa    80(%eax), %xmm2                               #3733.5
-        movdqa    96(%eax), %xmm1                               #3733.5
-        movdqa    112(%eax), %xmm0                              #3733.5
-        movdqa    128(%eax), %xmm7                              #3733.5
-        movl      64(%esp), %eax                                #3738.20
-        subl      %ecx, %eax                                    #3738.20
-        addl      $7, %eax                                      #3738.33
-        shrl      $2, %eax                                      #3738.40
-        movl      %ecx, %edi                                    #3745.20
-        andl      $3, %edi                                      #3745.20
-        je        ..B11.55      # Prob 20%                      #3745.20
-                                # LOE eax edx ecx ebx esi edi cl bl ch bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B11.8:                        # Preds ..B11.7
-        cmpl      $1, %edi                                      #3745.20
-        je        ..B11.14      # Prob 25%                      #3745.20
-                                # LOE eax edx ecx ebx esi edi cl bl ch bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B11.9:                        # Preds ..B11.8
-        cmpl      $2, %edi                                      #3745.20
-        je        ..B11.13      # Prob 33%                      #3745.20
-                                # LOE eax edx ecx ebx esi edi cl bl ch bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B11.10:                       # Preds ..B11.9
-        cmpl      $3, %edi                                      #3745.20
-        je        ..B11.12      # Prob 50%                      #3745.20
-                                # LOE eax edx ecx ebx esi cl bl ch bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B11.11:                       # Preds ..B11.10
-        movdqa    %xmm7, (%esp)                                 #
-        movdqa    %xmm0, 16(%esp)                               #
-        movdqa    32(%esp), %xmm0                               #
-        movl      %esi, 56(%esp)                                #
-        jmp       ..B11.26      # Prob 100%                     #
-                                # LOE edx ecx ebx bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.12:                       # Preds ..B11.10
-        movdqa    %xmm7, (%esp)                                 #
-        movdqa    %xmm0, 16(%esp)                               #
-        movdqa    32(%esp), %xmm0                               #
-        movl      %esi, 56(%esp)                                #
-        xorl      %edi, %edi                                    #
-        movl      %edi, 48(%esp)                                #
-        movl      %edi, 52(%esp)                                #
-        movl      %edi, 72(%esp)                                #
-        jmp       ..B11.17      # Prob 100%                     #
-                                # LOE eax edx ecx ebx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.13:                       # Preds ..B11.9
-        movdqa    %xmm7, (%esp)                                 #
-        movdqa    %xmm0, 16(%esp)                               #
-        movdqa    32(%esp), %xmm0                               #
-        movl      %esi, 56(%esp)                                #
-        xorl      %edi, %edi                                    #
-        movl      %edi, 52(%esp)                                #
-        movl      %edi, 72(%esp)                                #
-        jmp       ..B11.16      # Prob 100%                     #
-                                # LOE eax edx ecx ebx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.14:                       # Preds ..B11.8
-        movdqa    %xmm7, (%esp)                                 #
-        movdqa    %xmm0, 16(%esp)                               #
-        movdqa    32(%esp), %xmm0                               #
-        movl      %esi, 56(%esp)                                #
-        xorl      %edi, %edi                                    #
-        movl      %edi, 72(%esp)                                #
-                                # LOE eax edx ecx ebx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.15:                       # Preds ..B11.14 ..B11.30
-        movdqa    %xmm0, %xmm7                                  #3768.22
-        pand      %xmm3, %xmm7                                  #3768.22
-        pcmpeqd   %xmm4, %xmm7                                  #3769.22
-        pmovmskb  %xmm7, %esi                                   #3770.22
-        addl      $1, %esi                                      #3771.17
-        shrl      $16, %esi                                     #3771.17
-        negl      %esi                                          #3771.17
-        movl      %esi, 52(%esp)                                #3771.17
-                                # LOE eax edx ecx ebx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.16:                       # Preds ..B11.13 ..B11.15
-        movdqa    %xmm0, %xmm7                                  #3774.22
-        pand      %xmm1, %xmm7                                  #3774.22
-        pcmpeqd   %xmm2, %xmm7                                  #3775.22
-        pmovmskb  %xmm7, %esi                                   #3776.22
-        addl      $1, %esi                                      #3777.17
-        shrl      $16, %esi                                     #3777.17
-        negl      %esi                                          #3777.17
-        movl      %esi, 48(%esp)                                #3777.17
-                                # LOE eax edx ecx ebx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.17:                       # Preds ..B11.12 ..B11.16
-        movdqa    %xmm0, %xmm7                                  #3780.22
-        movl      72(%esp), %edi                                #3790.29
-        pand      (%esp), %xmm7                                 #3780.22
-        pcmpeqd   16(%esp), %xmm7                               #3781.22
-        pmovmskb  %xmm7, %esi                                   #3782.22
-        andl      $-4, %ecx                                     #3787.17
-        orl       52(%esp), %edi                                #3790.29
-        addl      $1, %esi                                      #3783.17
-        orl       48(%esp), %edi                                #3790.34
-        shrl      $16, %esi                                     #3783.17
-        negl      %esi                                          #3783.17
-        orl       %esi, %edi                                    #3790.39
-        movl      %esi, 32(%esp)                                #3783.17
-        jne       ..B11.31      # Prob 1%                       #3790.47
-                                # LOE eax edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.18:                       # Preds ..B11.17
-        movl      64(%esp), %esi                                #3856.28
-        addl      $4, %ecx                                      #3853.17
-        cmpl      %esi, %ecx                                    #3856.28
-        ja        ..B11.53      # Prob 1%                       #3856.28
-                                # LOE eax edx ecx ebx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.19:                       # Preds ..B11.18
-        addl      $-1, %eax                                     #3860.25
-        jne       ..B11.27      # Prob 50%                      #3860.39
-                                # LOE eax edx ecx ebx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.20:                       # Preds ..B11.19
-        movl      56(%esp), %esi                                #3881.25
-        cmpl      %esi, %ebx                                    #3881.25
-        jae       ..B11.53      # Prob 1%                       #3881.25
-                                # LOE edx ecx ebx esi xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.21:                       # Preds ..B11.20
-        testb     $15, %bl                                      #3891.22
-        jne       ..B11.23      # Prob 50%                      #3891.22
-                                # LOE edx ecx ebx esi xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.22:                       # Preds ..B11.21
-        movdqa    (%ebx), %xmm0                                 #3891.22
-        jmp       ..B11.24      # Prob 100%                     #3891.22
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.23:                       # Preds ..B11.21
-        movdqu    (%ebx), %xmm0                                 #3891.22
-                                # LOE edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.24:                       # Preds ..B11.22 ..B11.23
-        addl      $16, %ebx                                     #3969.13
-        movl      %ebx, 68(%esp)                                #3969.13
-        cmpl      %esi, %ebx                                    #3972.24
-        jae       ..B11.26      # Prob 12%                      #3972.24
-                                # LOE edx ecx ebx bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.25:                       # Preds ..B11.24
-        movzbl    -1(%ebx), %edx                                #3973.32
-        shll      $8, %edx                                      #3973.46
-                                # LOE edx ecx ebx bl bh xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.26:                       # Preds ..B11.24 ..B11.11 ..B11.25
-        movl      $16, %eax                                     #3752.13
-        jmp       ..B11.30      # Prob 100%                     #3752.13
-                                # LOE eax edx ecx ebx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.27:                       # Preds ..B11.19
-        movl      68(%esp), %esi                                #3868.26
-        movl      56(%esp), %edi                                #3868.26
-        psrldq    $1, %xmm0                                     #3865.26
-        cmpl      %edi, %esi                                    #3868.26
-        jae       ..B11.29      # Prob 19%                      #3868.26
-                                # LOE eax edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.28:                       # Preds ..B11.27
-        movzbl    (%esi), %edi                                  #3871.37
-        sarl      $8, %edx                                      #3870.21
-        shll      $8, %edi                                      #3871.48
-        orl       %edi, %edx                                    #3871.21
-        pinsrw    $7, %edx, %xmm0                               #3872.30
-                                # LOE eax edx ecx ebx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.29:                       # Preds ..B11.28 ..B11.27
-        addl      $1, 68(%esp)                                  #3876.20
-                                # LOE eax edx ecx ebx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.30:                       # Preds ..B11.26 ..B11.29 ..B11.55
-        movdqa    %xmm0, %xmm7                                  #3762.22
-        pand      %xmm5, %xmm7                                  #3762.22
-        pcmpeqd   %xmm6, %xmm7                                  #3763.22
-        pmovmskb  %xmm7, %esi                                   #3764.22
-        addl      $1, %esi                                      #3765.17
-        shrl      $16, %esi                                     #3765.17
-        negl      %esi                                          #3765.17
-        movl      %esi, 72(%esp)                                #3765.17
-        jmp       ..B11.15      # Prob 100%                     #3765.17
-                                # LOE eax edx ecx ebx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-..B11.31:                       # Preds ..B11.17                # Infreq
-        movl      %esi, %edx                                    #
-        movl      72(%esp), %edi                                #
-        movl      64(%esp), %ebx                                #3793.30
-        subl      %ecx, %ebx                                    #3793.30
-        movl      %ebx, 64(%esp)                                #3793.30
-        je        ..B11.52      # Prob 25%                      #3793.37
-                                # LOE edx ecx ebx edi dl bl dh bh
-..B11.32:                       # Preds ..B11.31                # Infreq
-        cmpl      $1, %ebx                                      #3793.37
-        jne       ..B11.37      # Prob 67%                      #3793.37
-                                # LOE edx ecx ebx edi dl bl dh bh
-..B11.33:                       # Preds ..B11.32                # Infreq
-        testl     %edi, %edi                                    #3799.36
-        jne       ..B11.36      # Prob 28%                      #3799.36
-                                # LOE ecx
-..B11.34:                       # Preds ..B11.33                # Infreq
-        movl      52(%esp), %edx                                #3800.36
-        testl     %edx, %edx                                    #3800.36
-        je        ..B11.53      # Prob 72%                      #3800.36
-                                # LOE ecx
-..B11.35:                       # Preds ..B11.45 ..B11.39 ..B11.34 # Infreq
-        subl      60(%esp), %ecx                                #3800.47
-        addl      $2, %ecx                                      #3800.61
-        movl      %ecx, %eax                                    #3800.61
-        addl      $84, %esp                                     #3800.61
-        popl      %ebx                                          #3800.61
-        popl      %esi                                          #3800.61
-        popl      %edi                                          #3800.61
-        movl      %ebp, %esp                                    #3800.61
-        popl      %ebp                                          #3800.61
-        ret                                                     #3800.61
-                                # LOE
-..B11.36:                       # Preds ..B11.52 ..B11.44 ..B11.38 ..B11.33 # Infreq
-        subl      60(%esp), %ecx                                #3799.47
-        addl      $1, %ecx                                      #3799.61
-        movl      %ecx, %eax                                    #3799.61
-        addl      $84, %esp                                     #3799.61
-        popl      %ebx                                          #3799.61
-        popl      %esi                                          #3799.61
-        popl      %edi                                          #3799.61
-        movl      %ebp, %esp                                    #3799.61
-        popl      %ebp                                          #3799.61
-        ret                                                     #3799.61
-                                # LOE
-..B11.37:                       # Preds ..B11.32                # Infreq
-        cmpl      $2, %ebx                                      #3793.37
-        jne       ..B11.44      # Prob 50%                      #3793.37
-                                # LOE edx ecx edi dl dh
-..B11.38:                       # Preds ..B11.37                # Infreq
-        testl     %edi, %edi                                    #3803.36
-        jne       ..B11.36      # Prob 28%                      #3803.36
-                                # LOE ecx
-..B11.39:                       # Preds ..B11.38                # Infreq
-        movl      52(%esp), %edx                                #3804.36
-        testl     %edx, %edx                                    #3804.36
-        jne       ..B11.35      # Prob 28%                      #3804.36
-                                # LOE ecx
-..B11.40:                       # Preds ..B11.39                # Infreq
-        movl      48(%esp), %edx                                #3805.36
-        testl     %edx, %edx                                    #3805.36
-        je        ..B11.53      # Prob 72%                      #3805.36
-                                # LOE ecx
-..B11.41:                       # Preds ..B11.46 ..B11.40       # Infreq
-        subl      60(%esp), %ecx                                #3805.47
-        addl      $3, %ecx                                      #3805.61
-        movl      %ecx, %eax                                    #3805.61
-        addl      $84, %esp                                     #3805.61
-        popl      %ebx                                          #3805.61
-        popl      %esi                                          #3805.61
-        popl      %edi                                          #3805.61
-        movl      %ebp, %esp                                    #3805.61
-        popl      %ebp                                          #3805.61
-        ret                                                     #3805.61
-                                # LOE
-..B11.44:                       # Preds ..B11.37                # Infreq
-        testl     %edi, %edi                                    #3808.36
-        jne       ..B11.36      # Prob 28%                      #3808.36
-                                # LOE edx ecx dl dh
-..B11.45:                       # Preds ..B11.44                # Infreq
-        movl      52(%esp), %ebx                                #3809.36
-        testl     %ebx, %ebx                                    #3809.36
-        jne       ..B11.35      # Prob 28%                      #3809.36
-                                # LOE edx ecx dl dh
-..B11.46:                       # Preds ..B11.45                # Infreq
-        movl      48(%esp), %ebx                                #3810.36
-        testl     %ebx, %ebx                                    #3810.36
-        jne       ..B11.41      # Prob 28%                      #3810.36
-                                # LOE edx ecx dl dh
-..B11.47:                       # Preds ..B11.46                # Infreq
-        testl     %edx, %edx                                    #3811.36
-        je        ..B11.53      # Prob 72%                      #3811.36
-                                # LOE ecx
-..B11.48:                       # Preds ..B11.47                # Infreq
-        subl      60(%esp), %ecx                                #3811.47
-        addl      $4, %ecx                                      #3811.61
-        movl      %ecx, %eax                                    #3811.61
-        addl      $84, %esp                                     #3811.61
-        popl      %ebx                                          #3811.61
-        popl      %esi                                          #3811.61
-        popl      %edi                                          #3811.61
-        movl      %ebp, %esp                                    #3811.61
-        popl      %ebp                                          #3811.61
-        ret                                                     #3811.61
-                                # LOE
-..B11.52:                       # Preds ..B11.31                # Infreq
-        testl     %edi, %edi                                    #3796.36
-        jne       ..B11.36      # Prob 28%                      #3796.36
-                                # LOE ecx
-..B11.53:                       # Preds ..B11.20 ..B11.18 ..B11.52 ..B11.34 ..B11.40
-                                #       ..B11.47                # Infreq
-        xorl      %eax, %eax                                    #3813.28
-        addl      $84, %esp                                     #3813.28
-        popl      %ebx                                          #3813.28
-        popl      %esi                                          #3813.28
-        popl      %edi                                          #3813.28
-        movl      %ebp, %esp                                    #3813.28
-        popl      %ebp                                          #3813.28
-        ret                                                     #3813.28
-                                # LOE
-..B11.55:                       # Preds ..B11.7                 # Infreq
-        movdqa    %xmm7, (%esp)                                 #
-        movdqa    %xmm0, 16(%esp)                               #
-        movdqa    32(%esp), %xmm0                               #
-        movl      %esi, 56(%esp)                                #
-        jmp       ..B11.30      # Prob 100%                     #
-        .align    2,0x90
-                                # LOE eax edx ecx ebx xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6
-# mark_end;
-	.type	eval_2na_pos, at function
-	.size	eval_2na_pos,.-eval_2na_pos
-	.data
-# -- End  eval_2na_pos
-	.text
-# -- Begin  eval_4na_pos
-# mark_begin;
-       .align    2,0x90
-eval_4na_pos:
-# parameter 1: %eax
-# parameter 2: %edx
-# parameter 3: %ecx
-# parameter 4: 20 + %ebp
-..B12.1:                        # Preds ..B12.0
-        pushl     %ebp                                          #4946.1
-        movl      %esp, %ebp                                    #4946.1
-        andl      $-16, %esp                                    #4946.1
-        pushl     %edi                                          #4946.1
-        pushl     %esi                                          #4946.1
-        pushl     %ebx                                          #4946.1
-        subl      $116, %esp                                    #4946.1
-        movl      20(%ebp), %esi                                #4944.5
-        movl      %ecx, 104(%esp)                               #4946.1
-        movl      %ecx, 92(%esp)                                #4946.1
-        movdqa    16(%eax), %xmm5                               #5009.5
-        movdqa    32(%eax), %xmm4                               #5009.5
-        movdqa    48(%eax), %xmm3                               #5009.5
-        movdqa    64(%eax), %xmm2                               #5009.5
-        movdqa    80(%eax), %xmm1                               #5009.5
-        movdqa    96(%eax), %xmm6                               #5009.5
-        movdqa    128(%eax), %xmm7                              #5009.5
-        movl      %ecx, %edi                                    #4993.49
-        shrl      $2, %edi                                      #4993.49
-        call      ..L6          # Prob 100%                     #4946.1
-..L6:                                                           #
-        popl      %ebx                                          #4946.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L6], %ebx       #4946.1
-        movl      %ebx, 16(%esp)                                #4946.1
-        lea       (%ecx,%esi), %ebx                             #4985.5
-        subl      4(%eax), %ebx                                 #4996.12
-        lea       3(%ecx,%esi), %ecx                            #4999.50
-        movl      16(%esp), %esi                                #5002.14
-        movl      %ebx, 100(%esp)                               #4996.12
-        shrl      $2, %ecx                                      #4999.57
-        addl      %edx, %ecx                                    #4999.30
-        movl      %ecx, 96(%esp)                                #4999.30
-        movzbl    (%edi,%edx), %ecx                             #5002.14
-        movzwl    expand_2na.0 at GOTOFF(%esi,%ecx,2), %ecx        #5002.14
-        movw      %cx, (%esp)                                   #5002.14
-        movzbl    1(%edi,%edx), %ecx                            #5002.14
-        movzwl    expand_2na.0 at GOTOFF(%esi,%ecx,2), %ecx        #5002.14
-        movw      %cx, 2(%esp)                                  #5002.14
-        movzbl    2(%edi,%edx), %ecx                            #5002.14
-        movzwl    expand_2na.0 at GOTOFF(%esi,%ecx,2), %ecx        #5002.14
-        movw      %cx, 4(%esp)                                  #5002.14
-        movzbl    3(%edi,%edx), %ecx                            #5002.14
-        movzwl    expand_2na.0 at GOTOFF(%esi,%ecx,2), %ecx        #5002.14
-        movw      %cx, 6(%esp)                                  #5002.14
-        movzbl    4(%edi,%edx), %ecx                            #5002.14
-        movzwl    expand_2na.0 at GOTOFF(%esi,%ecx,2), %ecx        #5002.14
-        movw      %cx, 8(%esp)                                  #5002.14
-        movzbl    5(%edi,%edx), %ecx                            #5002.14
-        movzwl    expand_2na.0 at GOTOFF(%esi,%ecx,2), %ecx        #5002.14
-        movw      %cx, 10(%esp)                                 #5002.14
-        movzbl    6(%edi,%edx), %ecx                            #5002.14
-        movzwl    expand_2na.0 at GOTOFF(%esi,%ecx,2), %ecx        #5002.14
-        movw      %cx, 12(%esp)                                 #5002.14
-        movzbl    7(%edi,%edx), %ecx                            #5002.14
-        movzwl    expand_2na.0 at GOTOFF(%esi,%ecx,2), %ecx        #5002.14
-        movw      %cx, 14(%esp)                                 #5002.14
-        movdqu    (%esp), %xmm0                                 #5002.14
-        lea       8(%edx,%edi), %ecx                            #5003.5
-        movdqa    %xmm0, 64(%esp)                               #5002.14
-        movdqa    112(%eax), %xmm0                              #5009.5
-        movl      %ecx, %edx                                    #5003.5
-        movl      104(%esp), %eax                               #5014.20
-        subl      %eax, %ebx                                    #5014.20
-        addl      $7, %ebx                                      #5014.33
-        shrl      $2, %ebx                                      #5014.40
-        movl      %eax, %edi                                    #5023.20
-        andl      $3, %edi                                      #5023.20
-        je        ..B12.45      # Prob 20%                      #5023.20
-                                # LOE eax edx ecx ebx esi edi al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B12.2:                        # Preds ..B12.1
-        cmpl      $1, %edi                                      #5023.20
-        je        ..B12.8       # Prob 25%                      #5023.20
-                                # LOE eax edx ecx ebx esi edi al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B12.3:                        # Preds ..B12.2
-        cmpl      $2, %edi                                      #5023.20
-        je        ..B12.7       # Prob 33%                      #5023.20
-                                # LOE eax edx ecx ebx esi edi al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B12.4:                        # Preds ..B12.3
-        cmpl      $3, %edi                                      #5023.20
-        je        ..B12.6       # Prob 50%                      #5023.20
-                                # LOE eax edx ecx ebx esi al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7
-..B12.5:                        # Preds ..B12.4
-        movdqa    %xmm7, 16(%esp)                               #
-        movdqa    %xmm0, 32(%esp)                               #
-        movdqa    64(%esp), %xmm0                               #
-        movdqa    %xmm6, 48(%esp)                               #
-        jmp       ..B12.16      # Prob 100%                     #
-                                # LOE eax edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.6:                        # Preds ..B12.4
-        movdqa    %xmm7, 16(%esp)                               #
-        movdqa    %xmm0, 32(%esp)                               #
-        movdqa    64(%esp), %xmm0                               #
-        movdqa    %xmm6, 48(%esp)                               #
-        xorl      %edi, %edi                                    #
-        movl      %edi, 80(%esp)                                #
-        movl      %edi, 84(%esp)                                #
-        movl      %edi, 88(%esp)                                #
-        jmp       ..B12.11      # Prob 100%                     #
-                                # LOE eax edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.7:                        # Preds ..B12.3
-        movdqa    %xmm7, 16(%esp)                               #
-        movdqa    %xmm0, 32(%esp)                               #
-        movdqa    64(%esp), %xmm0                               #
-        movdqa    %xmm6, 48(%esp)                               #
-        xorl      %edi, %edi                                    #
-        movl      %edi, 84(%esp)                                #
-        movl      %edi, 88(%esp)                                #
-        jmp       ..B12.10      # Prob 100%                     #
-                                # LOE eax edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.8:                        # Preds ..B12.2
-        movdqa    %xmm7, 16(%esp)                               #
-        movdqa    %xmm0, 32(%esp)                               #
-        movdqa    64(%esp), %xmm0                               #
-        movdqa    %xmm6, 48(%esp)                               #
-        xorl      %edi, %edi                                    #
-        movl      %edi, 88(%esp)                                #
-                                # LOE eax edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.9:                        # Preds ..B12.8 ..B12.20
-        movdqa    %xmm0, %xmm7                                  #5047.22
-        movdqa    %xmm0, %xmm6                                  #5048.22
-        pand      %xmm3, %xmm7                                  #5047.22
-        pand      %xmm2, %xmm6                                  #5048.22
-        pcmpeqd   %xmm6, %xmm7                                  #5049.22
-        pmovmskb  %xmm7, %edi                                   #5050.22
-        addl      $1, %edi                                      #5051.17
-        shrl      $16, %edi                                     #5051.17
-        negl      %edi                                          #5051.17
-        movl      %edi, 84(%esp)                                #5051.17
-                                # LOE eax edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.10:                       # Preds ..B12.7 ..B12.9
-        movdqa    %xmm0, %xmm7                                  #5054.22
-        movdqa    %xmm0, %xmm6                                  #5055.22
-        pand      48(%esp), %xmm6                               #5055.22
-        pand      %xmm1, %xmm7                                  #5054.22
-        pcmpeqd   %xmm6, %xmm7                                  #5056.22
-        pmovmskb  %xmm7, %edi                                   #5057.22
-        addl      $1, %edi                                      #5058.17
-        shrl      $16, %edi                                     #5058.17
-        negl      %edi                                          #5058.17
-        movl      %edi, 80(%esp)                                #5058.17
-                                # LOE eax edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.11:                       # Preds ..B12.6 ..B12.10
-        movdqa    %xmm0, %xmm7                                  #5061.22
-        movdqa    %xmm0, %xmm6                                  #5062.22
-        pand      32(%esp), %xmm7                               #5061.22
-        pand      16(%esp), %xmm6                               #5062.22
-        pcmpeqd   %xmm6, %xmm7                                  #5063.22
-        pmovmskb  %xmm7, %edi                                   #5064.22
-        andl      $-4, %eax                                     #5069.17
-        movl      %eax, 104(%esp)                               #5069.17
-        addl      $1, %edi                                      #5065.17
-        shrl      $16, %edi                                     #5065.17
-        movl      88(%esp), %eax                                #5072.29
-        negl      %edi                                          #5065.17
-        movl      %edi, 64(%esp)                                #5065.17
-        orl       84(%esp), %eax                                #5072.29
-        orl       80(%esp), %eax                                #5072.34
-        orl       %edi, %eax                                    #5072.39
-        movl      104(%esp), %eax                               #5072.47
-        jne       ..B12.21      # Prob 1%                       #5072.47
-                                # LOE eax edx ecx ebx esi edi al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.12:                       # Preds ..B12.11
-        movl      100(%esp), %edi                               #5138.28
-        addl      $4, %eax                                      #5135.17
-        cmpl      %edi, %eax                                    #5138.28
-        ja        ..B12.43      # Prob 1%                       #5138.28
-                                # LOE eax edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.13:                       # Preds ..B12.12
-        addl      $-1, %ebx                                     #5142.25
-        jne       ..B12.17      # Prob 50%                      #5142.39
-                                # LOE eax edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.14:                       # Preds ..B12.13
-        movl      96(%esp), %edx                                #5159.25
-        cmpl      %edx, %ecx                                    #5159.25
-        jae       ..B12.43      # Prob 1%                       #5159.25
-                                # LOE eax ecx esi xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.15:                       # Preds ..B12.14
-        movzbl    (%ecx), %edx                                  #5169.22
-        movzwl    expand_2na.0 at GOTOFF(%esi,%edx,2), %ebx        #5169.22
-        movzbl    1(%ecx), %edi                                 #5169.22
-        movzwl    expand_2na.0 at GOTOFF(%esi,%edi,2), %edx        #5169.22
-        movw      %bx, (%esp)                                   #5169.22
-        movw      %dx, 2(%esp)                                  #5169.22
-        movzbl    2(%ecx), %edx                                 #5169.22
-        movzwl    expand_2na.0 at GOTOFF(%esi,%edx,2), %edx        #5169.22
-        movw      %dx, 4(%esp)                                  #5169.22
-        movzbl    3(%ecx), %edx                                 #5169.22
-        movzwl    expand_2na.0 at GOTOFF(%esi,%edx,2), %edx        #5169.22
-        movw      %dx, 6(%esp)                                  #5169.22
-        movzbl    4(%ecx), %edx                                 #5169.22
-        movzwl    expand_2na.0 at GOTOFF(%esi,%edx,2), %edx        #5169.22
-        movw      %dx, 8(%esp)                                  #5169.22
-        movzbl    5(%ecx), %edx                                 #5169.22
-        movzwl    expand_2na.0 at GOTOFF(%esi,%edx,2), %edx        #5169.22
-        movw      %dx, 10(%esp)                                 #5169.22
-        movzbl    6(%ecx), %edx                                 #5169.22
-        movzwl    expand_2na.0 at GOTOFF(%esi,%edx,2), %edx        #5169.22
-        movw      %dx, 12(%esp)                                 #5169.22
-        movzbl    7(%ecx), %edx                                 #5169.22
-        movzwl    expand_2na.0 at GOTOFF(%esi,%edx,2), %edx        #5169.22
-        addl      $8, %ecx                                      #5184.13
-        movw      %dx, 14(%esp)                                 #5169.22
-        movdqu    (%esp), %xmm0                                 #5169.22
-        movl      %ecx, %edx                                    #5184.13
-                                # LOE eax edx ecx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.16:                       # Preds ..B12.5 ..B12.15
-        movl      $8, %ebx                                      #5030.13
-        jmp       ..B12.20      # Prob 100%                     #5030.13
-                                # LOE eax edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.17:                       # Preds ..B12.13
-        movl      96(%esp), %edi                                #5150.26
-        psrldq    $2, %xmm0                                     #5147.26
-        cmpl      %edi, %edx                                    #5150.26
-        jae       ..B12.19      # Prob 19%                      #5150.26
-                                # LOE eax edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.18:                       # Preds ..B12.17
-        movzbl    (%edx), %edi                                  #5151.72
-        movzwl    expand_2na.0 at GOTOFF(%esi,%edi,2), %edi        #5151.57
-        pinsrw    $7, %edi, %xmm0                               #5151.30
-                                # LOE eax edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.19:                       # Preds ..B12.18 ..B12.17
-        addl      $1, %edx                                      #5154.20
-                                # LOE eax edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.20:                       # Preds ..B12.16 ..B12.19 ..B12.45
-        movdqa    %xmm0, %xmm7                                  #5040.22
-        movdqa    %xmm0, %xmm6                                  #5041.22
-        pand      %xmm5, %xmm7                                  #5040.22
-        pand      %xmm4, %xmm6                                  #5041.22
-        pcmpeqd   %xmm6, %xmm7                                  #5042.22
-        pmovmskb  %xmm7, %edi                                   #5043.22
-        addl      $1, %edi                                      #5044.17
-        shrl      $16, %edi                                     #5044.17
-        negl      %edi                                          #5044.17
-        movl      %edi, 88(%esp)                                #5044.17
-        jmp       ..B12.9       # Prob 100%                     #5044.17
-                                # LOE eax edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-..B12.21:                       # Preds ..B12.11                # Infreq
-        movl      %edi, %edx                                    #
-        movl      88(%esp), %edi                                #
-        movl      100(%esp), %ecx                               #5075.30
-        subl      %eax, %ecx                                    #5075.30
-        movl      %ecx, 100(%esp)                               #5075.30
-        je        ..B12.42      # Prob 25%                      #5075.37
-                                # LOE eax edx ecx edi al dl cl ah dh ch
-..B12.22:                       # Preds ..B12.21                # Infreq
-        cmpl      $1, %ecx                                      #5075.37
-        jne       ..B12.27      # Prob 67%                      #5075.37
-                                # LOE eax edx ecx edi al dl cl ah dh ch
-..B12.23:                       # Preds ..B12.22                # Infreq
-        testl     %edi, %edi                                    #5081.36
-        jne       ..B12.26      # Prob 28%                      #5081.36
-                                # LOE eax al ah
-..B12.24:                       # Preds ..B12.23                # Infreq
-        movl      84(%esp), %edx                                #5082.36
-        testl     %edx, %edx                                    #5082.36
-        je        ..B12.43      # Prob 72%                      #5082.36
-                                # LOE eax al ah
-..B12.25:                       # Preds ..B12.35 ..B12.29 ..B12.24 # Infreq
-        subl      92(%esp), %eax                                #5082.47
-        addl      $2, %eax                                      #5082.61
-        addl      $116, %esp                                    #5082.61
-        popl      %ebx                                          #5082.61
-        popl      %esi                                          #5082.61
-        popl      %edi                                          #5082.61
-        movl      %ebp, %esp                                    #5082.61
-        popl      %ebp                                          #5082.61
-        ret                                                     #5082.61
-                                # LOE
-..B12.26:                       # Preds ..B12.42 ..B12.34 ..B12.28 ..B12.23 # Infreq
-        subl      92(%esp), %eax                                #5081.47
-        addl      $1, %eax                                      #5081.61
-        addl      $116, %esp                                    #5081.61
-        popl      %ebx                                          #5081.61
-        popl      %esi                                          #5081.61
-        popl      %edi                                          #5081.61
-        movl      %ebp, %esp                                    #5081.61
-        popl      %ebp                                          #5081.61
-        ret                                                     #5081.61
-                                # LOE
-..B12.27:                       # Preds ..B12.22                # Infreq
-        cmpl      $2, %ecx                                      #5075.37
-        jne       ..B12.34      # Prob 50%                      #5075.37
-                                # LOE eax edx edi al dl ah dh
-..B12.28:                       # Preds ..B12.27                # Infreq
-        testl     %edi, %edi                                    #5085.36
-        jne       ..B12.26      # Prob 28%                      #5085.36
-                                # LOE eax al ah
-..B12.29:                       # Preds ..B12.28                # Infreq
-        movl      84(%esp), %edx                                #5086.36
-        testl     %edx, %edx                                    #5086.36
-        jne       ..B12.25      # Prob 28%                      #5086.36
-                                # LOE eax al ah
-..B12.30:                       # Preds ..B12.29                # Infreq
-        movl      80(%esp), %edx                                #5087.36
-        testl     %edx, %edx                                    #5087.36
-        je        ..B12.43      # Prob 72%                      #5087.36
-                                # LOE eax al ah
-..B12.31:                       # Preds ..B12.36 ..B12.30       # Infreq
-        subl      92(%esp), %eax                                #5087.47
-        addl      $3, %eax                                      #5087.61
-        addl      $116, %esp                                    #5087.61
-        popl      %ebx                                          #5087.61
-        popl      %esi                                          #5087.61
-        popl      %edi                                          #5087.61
-        movl      %ebp, %esp                                    #5087.61
-        popl      %ebp                                          #5087.61
-        ret                                                     #5087.61
-                                # LOE
-..B12.34:                       # Preds ..B12.27                # Infreq
-        testl     %edi, %edi                                    #5090.36
-        jne       ..B12.26      # Prob 28%                      #5090.36
-                                # LOE eax edx al dl ah dh
-..B12.35:                       # Preds ..B12.34                # Infreq
-        movl      84(%esp), %ecx                                #5091.36
-        testl     %ecx, %ecx                                    #5091.36
-        jne       ..B12.25      # Prob 28%                      #5091.36
-                                # LOE eax edx al dl ah dh
-..B12.36:                       # Preds ..B12.35                # Infreq
-        movl      80(%esp), %ecx                                #5092.36
-        testl     %ecx, %ecx                                    #5092.36
-        jne       ..B12.31      # Prob 28%                      #5092.36
-                                # LOE eax edx al dl ah dh
-..B12.37:                       # Preds ..B12.36                # Infreq
-        testl     %edx, %edx                                    #5093.36
-        je        ..B12.43      # Prob 72%                      #5093.36
-                                # LOE eax al ah
-..B12.38:                       # Preds ..B12.37                # Infreq
-        subl      92(%esp), %eax                                #5093.47
-        addl      $4, %eax                                      #5093.61
-        addl      $116, %esp                                    #5093.61
-        popl      %ebx                                          #5093.61
-        popl      %esi                                          #5093.61
-        popl      %edi                                          #5093.61
-        movl      %ebp, %esp                                    #5093.61
-        popl      %ebp                                          #5093.61
-        ret                                                     #5093.61
-                                # LOE
-..B12.42:                       # Preds ..B12.21                # Infreq
-        testl     %edi, %edi                                    #5078.36
-        jne       ..B12.26      # Prob 28%                      #5078.36
-                                # LOE eax al ah
-..B12.43:                       # Preds ..B12.14 ..B12.12 ..B12.42 ..B12.24 ..B12.30
-                                #       ..B12.37                # Infreq
-        xorl      %eax, %eax                                    #5095.28
-        addl      $116, %esp                                    #5095.28
-        popl      %ebx                                          #5095.28
-        popl      %esi                                          #5095.28
-        popl      %edi                                          #5095.28
-        movl      %ebp, %esp                                    #5095.28
-        popl      %ebp                                          #5095.28
-        ret                                                     #5095.28
-                                # LOE
-..B12.45:                       # Preds ..B12.1                 # Infreq
-        movdqa    %xmm7, 16(%esp)                               #
-        movdqa    %xmm0, 32(%esp)                               #
-        movdqa    64(%esp), %xmm0                               #
-        movdqa    %xmm6, 48(%esp)                               #
-        jmp       ..B12.20      # Prob 100%                     #
-        .align    2,0x90
-                                # LOE eax edx ecx ebx esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5
-# mark_end;
-	.type	eval_4na_pos, at function
-	.size	eval_4na_pos,.-eval_4na_pos
-	.data
-# -- End  eval_4na_pos
-	.text
-# -- Begin  NucStrstrMake
-# mark_begin;
-       .align    2,0x90
-	.globl NucStrstrMake
-NucStrstrMake:
-# parameter 1: 44 + %esp
-# parameter 2: 48 + %esp
-# parameter 3: 52 + %esp
-# parameter 4: 56 + %esp
-..B13.1:                        # Preds ..B13.0
-        pushl     %edi                                          #1539.1
-        pushl     %esi                                          #1539.1
-        pushl     %ebp                                          #1539.1
-        pushl     %ebx                                          #1539.1
-        subl      $24, %esp                                     #1539.1
-        movl      44(%esp), %esi                                #1537.5
-        testl     %esi, %esi                                    #1540.17
-        movl      52(%esp), %ebp                                #1537.5
-        movl      56(%esp), %edi                                #1537.5
-        je        ..B13.12      # Prob 6%                       #1540.17
-                                # LOE ebp esi edi
-..B13.2:                        # Preds ..B13.1
-        testl     %ebp, %ebp                                    #1542.23
-        je        ..B13.11      # Prob 12%                      #1542.23
-                                # LOE ebp esi edi
-..B13.3:                        # Preds ..B13.2
-        testl     %edi, %edi                                    #1542.38
-        je        ..B13.11      # Prob 50%                      #1542.38
-                                # LOE ebp esi edi
-..B13.4:                        # Preds ..B13.3
-        movl      $0, 20(%esp)                                  #1544.24
-        call      ..L7          # Prob 100%                     #
-..L7:                                                           #
-        popl      %ebx                                          #
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L7], %ebx       #
-        movsbl    fasta_2na_map.0 at GOTOFF(%ebx), %eax            #1547.18
-        testl     %eax, %eax                                    #1547.41
-        je        ..B13.13      # Prob 5%                       #1547.41
-                                # LOE ebx ebp esi edi
-..B13.5:                        # Preds ..B13.13 ..B13.4
-        lea       20(%esp), %eax                                #1551.49
-        movl      %eax, 12(%esp)                                #1551.49
-        movl      48(%esp), %eax                                #1539.1
-        lea       (%edi,%ebp), %edi                             #1550.19
-        movl      %edi, %edx                                    #1551.21
-        movl      %eax, 16(%esp)                                #1539.1
-        movl      %ebp, %eax                                    #1551.21
-        movl      %esi, %ecx                                    #1551.21
-        call      nss_expr                                      #1551.21
-                                # LOE eax ebx esi edi
-..B13.6:                        # Preds ..B13.5
-        movl      20(%esp), %edx                                #1552.18
-        testl     %edx, %edx                                    #1552.28
-        jne       ..B13.9       # Prob 22%                      #1552.28
-                                # LOE eax ebx esi edi
-..B13.7:                        # Preds ..B13.6
-        cmpl      %edi, %eax                                    #1554.31
-        je        ..B13.14      # Prob 5%                       #1554.31
-                                # LOE ebx esi
-..B13.8:                        # Preds ..B13.7
-        movl      $22, 20(%esp)                                 #1557.17
-                                # LOE ebx esi
-..B13.9:                        # Preds ..B13.8 ..B13.6
-        pushl     (%esi)                                        #1560.32
-        call      NucStrstrWhack at PLT                            #1560.13
-                                # LOE esi
-..B13.10:                       # Preds ..B13.9
-        movl      24(%esp), %eax                                #1562.20
-        movl      $0, (%esi)                                    #1561.13
-        addl      $28, %esp                                     #1562.20
-        popl      %ebx                                          #1562.20
-        popl      %ebp                                          #1562.20
-        popl      %esi                                          #1562.20
-        popl      %edi                                          #1562.20
-        ret                                                     #1562.20
-                                # LOE
-..B13.11:                       # Preds ..B13.3 ..B13.2
-        movl      $0, (%esi)                                    #1565.9
-                                # LOE
-..B13.12:                       # Preds ..B13.11 ..B13.1
-        movl      $22, %eax                                     #1567.12
-        addl      $24, %esp                                     #1567.12
-        popl      %ebx                                          #1567.12
-        popl      %ebp                                          #1567.12
-        popl      %esi                                          #1567.12
-        popl      %edi                                          #1567.12
-        ret                                                     #1567.12
-                                # LOE
-..B13.13:                       # Preds ..B13.4                 # Infreq
-        call      NucStrstrInit                                 #1548.17
-        jmp       ..B13.5       # Prob 100%                     #1548.17
-                                # LOE ebx ebp esi edi
-..B13.14:                       # Preds ..B13.7                 # Infreq
-        xorl      %eax, %eax                                    #1555.28
-        addl      $24, %esp                                     #1555.28
-        popl      %ebx                                          #1555.28
-        popl      %ebp                                          #1555.28
-        popl      %esi                                          #1555.28
-        popl      %edi                                          #1555.28
-        ret                                                     #1555.28
-        .align    2,0x90
-                                # LOE
-# mark_end;
-	.type	NucStrstrMake, at function
-	.size	NucStrstrMake,.-NucStrstrMake
-	.data
-# -- End  NucStrstrMake
-	.text
-# -- Begin  nss_expr
-# mark_begin;
-       .align    2,0x90
-nss_expr:
-# parameter 1: %eax
-# parameter 2: %edx
-# parameter 3: %ecx
-# parameter 4: 68 + %esp
-# parameter 5: 72 + %esp
-..B14.1:                        # Preds ..B14.0
-        pushl     %edi                                          #1406.1
-        pushl     %esi                                          #1406.1
-        pushl     %ebp                                          #1406.1
-        pushl     %ebx                                          #1406.1
-        subl      $36, %esp                                     #1406.1
-        movl      %ecx, %edi                                    #1406.1
-        movl      %edx, %esi                                    #1406.1
-        movl      %eax, %ebp                                    #1406.1
-        call      ..L8          # Prob 100%                     #1406.1
-..L8:                                                           #
-        popl      %ebx                                          #1406.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L8], %ebx       #1406.1
-        call      __ctype_b_loc at PLT                             #1409.9
-                                # LOE eax ebx ebp esi edi
-..B14.41:                       # Preds ..B14.1
-        movl      %ebx, 28(%esp)                                #1409.9
-        movl      %eax, 32(%esp)                                #1409.9
-        movl      %ebp, %edx                                    #1409.9
-        movl      68(%esp), %ebp                                #1409.9
-        jmp       ..B14.2       # Prob 100%                     #1409.9
-                                # LOE edx ebp esi edi
-..B14.29:                       # Preds ..B14.28
-        movl      20(%esp), %ecx                                #1459.17
-        movl      $11, (%eax)                                   #1458.17
-        movl      %ecx, 4(%eax)                                 #1459.17
-        movl      (%edi), %ebx                                  #1460.41
-        movl      %ebx, 8(%eax)                                 #1460.17
-        movl      %eax, (%edi)                                  #1461.17
-        lea       12(%eax), %edi                                #1464.42
-                                # LOE edx ebp esi edi
-..B14.2:                        # Preds ..B14.41 ..B14.29
-        movl      $0, (%edi)                                    #1407.5
-        cmpl      %esi, %edx                                    #1409.9
-        jae       ..B14.8       # Prob 12%                      #1409.9
-                                # LOE edx ebp esi edi
-..B14.3:                        # Preds ..B14.2
-        movl      32(%esp), %ecx                                #1409.9
-        movl      (%ecx), %ecx                                  #1409.9
-        movzbl    (%edx), %ebx                                  #1409.9
-        movzwl    (%ecx,%ebx,2), %ebx                           #1409.9
-        testl     $8192, %ebx                                   #1409.9
-        je        ..B14.8       # Prob 15%                      #1409.9
-                                # LOE edx ecx ebp esi edi
-..B14.5:                        # Preds ..B14.3 ..B14.6
-        addl      $1, %edx                                      #1409.9
-        cmpl      %esi, %edx                                    #1409.9
-        jae       ..B14.8       # Prob 1%                       #1409.9
-                                # LOE edx ecx ebp esi edi
-..B14.6:                        # Preds ..B14.5
-        movzbl    (%edx), %ebx                                  #1409.9
-        movzwl    (%ecx,%ebx,2), %ebx                           #1409.9
-        testl     $8192, %ebx                                   #1409.9
-        jne       ..B14.5       # Prob 82%                      #1409.9
-                                # LOE edx ecx ebp esi edi
-..B14.8:                        # Preds ..B14.5 ..B14.6 ..B14.3 ..B14.2
-        cmpl      %esi, %edx                                    #1410.15
-        je        ..B14.32      # Prob 16%                      #1410.15
-                                # LOE edx ebp esi edi
-..B14.9:                        # Preds ..B14.8
-        movl      72(%esp), %ebx                                #1406.1
-        movl      %ebp, 12(%esp)                                #1406.1
-        movl      %ebx, 16(%esp)                                #1406.1
-        movl      %edx, %eax                                    #1412.13
-        movl      %esi, %edx                                    #1412.13
-        movl      %edi, %ecx                                    #1412.13
-        call      nss_unary_expr                                #1412.13
-                                # LOE eax ebp esi edi
-..B14.42:                       # Preds ..B14.9
-        movl      %eax, %edx                                    #1412.13
-                                # LOE edx ebp esi edi
-..B14.10:                       # Preds ..B14.42
-        movl      (%ebp), %ecx                                  #1413.16
-        testl     %ecx, %ecx                                    #1413.26
-        jne       ..B14.32      # Prob 58%                      #1413.26
-                                # LOE edx ebp esi edi
-..B14.11:                       # Preds ..B14.10
-        cmpl      %esi, %edx                                    #1415.17
-        jae       ..B14.17      # Prob 12%                      #1415.17
-                                # LOE edx ebp esi edi
-..B14.12:                       # Preds ..B14.11
-        movl      32(%esp), %ecx                                #1415.17
-        movl      (%ecx), %ecx                                  #1415.17
-        movzbl    (%edx), %ebx                                  #1415.17
-        movzwl    (%ecx,%ebx,2), %ebx                           #1415.17
-        testl     $8192, %ebx                                   #1415.17
-        je        ..B14.17      # Prob 15%                      #1415.17
-                                # LOE edx ecx ebp esi edi
-..B14.14:                       # Preds ..B14.12 ..B14.15
-        addl      $1, %edx                                      #1415.17
-        cmpl      %esi, %edx                                    #1415.17
-        jae       ..B14.17      # Prob 1%                       #1415.17
-                                # LOE edx ecx ebp esi edi
-..B14.15:                       # Preds ..B14.14
-        movzbl    (%edx), %ebx                                  #1415.17
-        movzwl    (%ecx,%ebx,2), %ebx                           #1415.17
-        testl     $8192, %ebx                                   #1415.17
-        jne       ..B14.14      # Prob 82%                      #1415.17
-                                # LOE edx ecx ebp esi edi
-..B14.17:                       # Preds ..B14.14 ..B14.15 ..B14.12 ..B14.11
-        cmpl      %esi, %edx                                    #1416.23
-        je        ..B14.32      # Prob 4%                       #1416.23
-                                # LOE edx ebp esi edi
-..B14.18:                       # Preds ..B14.17
-        movsbl    (%edx), %ecx                                  #1422.28
-        addl      $1, %edx                                      #1422.28
-        cmpl      $41, %ecx                                     #1422.28
-        je        ..B14.31      # Prob 25%                      #1422.28
-                                # LOE edx ecx ebp esi edi
-..B14.19:                       # Preds ..B14.18
-        cmpl      $38, %ecx                                     #1422.28
-        jne       ..B14.23      # Prob 67%                      #1422.28
-                                # LOE edx ecx ebp esi edi
-..B14.20:                       # Preds ..B14.19
-        cmpl      %esi, %edx                                    #1427.30
-        jae       ..B14.22      # Prob 12%                      #1427.30
-                                # LOE edx ebp esi edi
-..B14.21:                       # Preds ..B14.20
-        movsbl    (%edx), %ecx                                  #1427.39
-        lea       1(%edx), %ebx                                 #1428.28
-        cmpl      $38, %ecx                                     #1428.28
-        cmove     %ebx, %edx                                    #1428.28
-                                # LOE edx ebp esi edi
-..B14.22:                       # Preds ..B14.21 ..B14.20
-        movl      $16, %ecx                                     #1429.21
-        movl      %ecx, 20(%esp)                                #1429.21
-        jmp       ..B14.27      # Prob 100%                     #1429.21
-                                # LOE edx ebp esi edi
-..B14.23:                       # Preds ..B14.19
-        cmpl      $124, %ecx                                    #1422.28
-        jne       ..B14.30      # Prob 50%                      #1422.28
-                                # LOE edx ebp esi edi
-..B14.24:                       # Preds ..B14.23
-        cmpl      %esi, %edx                                    #1432.30
-        jae       ..B14.26      # Prob 12%                      #1432.30
-                                # LOE edx ebp esi edi
-..B14.25:                       # Preds ..B14.24
-        movsbl    (%edx), %ecx                                  #1432.39
-        lea       1(%edx), %ebx                                 #1433.28
-        cmpl      $124, %ecx                                    #1433.28
-        cmove     %ebx, %edx                                    #1433.28
-                                # LOE edx ebp esi edi
-..B14.26:                       # Preds ..B14.25 ..B14.24
-        movl      $17, %ecx                                     #1434.21
-        movl      %ecx, 20(%esp)                                #1434.21
-                                # LOE edx ebp esi edi
-..B14.27:                       # Preds ..B14.22 ..B14.26
-        pushl     $16                                           #1451.30
-        movl      32(%esp), %ebx                                #1451.21
-        movl      %edx, 28(%esp)                                #1451.21
-        call      malloc at PLT                                    #1451.21
-                                # LOE eax ebp esi edi
-..B14.43:                       # Preds ..B14.27
-        movl      28(%esp), %edx                                #
-        addl      $4, %esp                                      #1451.21
-                                # LOE eax edx ebp esi edi dl dh
-..B14.28:                       # Preds ..B14.43
-        testl     %eax, %eax                                    #1452.27
-        je        ..B14.38      # Prob 1%                       #1452.27
-        jmp       ..B14.29      # Prob 100%                     #1452.27
-                                # LOE eax edx ebp esi edi dl dh
-..B14.30:                       # Preds ..B14.23
-        movl      68(%esp), %ecx                                #1438.21
-        movl      $22, (%ecx)                                   #1438.21
-        movl      %edx, %ebp                                    #
-        addl      $-1, %ebp                                     #1439.32
-        movl      %ebp, %eax                                    #1439.32
-        addl      $36, %esp                                     #1439.32
-        popl      %ebx                                          #1439.32
-        popl      %ebp                                          #1439.32
-        popl      %esi                                          #1439.32
-        popl      %edi                                          #1439.32
-        ret                                                     #1439.32
-                                # LOE
-..B14.31:                       # Preds ..B14.18
-        movl      %edx, %ebp                                    #
-        addl      $-1, %ebp                                     #1425.32
-        movl      %ebp, %eax                                    #1425.32
-        addl      $36, %esp                                     #1425.32
-        popl      %ebx                                          #1425.32
-        popl      %ebp                                          #1425.32
-        popl      %esi                                          #1425.32
-        popl      %edi                                          #1425.32
-        ret                                                     #1425.32
-                                # LOE
-..B14.32:                       # Preds ..B14.8 ..B14.17 ..B14.10
-        movl      %edx, %ebp                                    #
-                                # LOE ebp
-..B14.33:                       # Preds ..B14.32
-        movl      %ebp, %eax                                    #1470.12
-        addl      $36, %esp                                     #1470.12
-        popl      %ebx                                          #1470.12
-        popl      %ebp                                          #1470.12
-        popl      %esi                                          #1470.12
-        popl      %edi                                          #1470.12
-        ret                                                     #1470.12
-                                # LOE
-..B14.38:                       # Preds ..B14.28                # Infreq
-        movl      28(%esp), %ebx                                #
-        movl      %edx, %ebp                                    #
-        call      __errno_location at PLT                          #1454.32
-                                # LOE eax ebp
-..B14.44:                       # Preds ..B14.38                # Infreq
-        movl      68(%esp), %ebx                                #1454.21
-        movl      (%eax), %ecx                                  #1454.32
-        movl      %ecx, (%ebx)                                  #1454.21
-        movl      %ebp, %eax                                    #1451.21
-        addl      $36, %esp                                     #1455.28
-        popl      %ebx                                          #1455.28
-        popl      %ebp                                          #1455.28
-        popl      %esi                                          #1455.28
-        popl      %edi                                          #1455.28
-        ret                                                     #1455.28
-        .align    2,0x90
-                                # LOE
-# mark_end;
-	.type	nss_expr, at function
-	.size	nss_expr,.-nss_expr
-	.data
-# -- End  nss_expr
-	.text
-# -- Begin  nss_unary_expr
-# mark_begin;
-       .align    2,0x90
-nss_unary_expr:
-# parameter 1: %eax
-# parameter 2: %edx
-# parameter 3: %ecx
-# parameter 4: 56 + %esp
-# parameter 5: 60 + %esp
-..B15.1:                        # Preds ..B15.0
-        pushl     %edi                                          #1361.1
-        pushl     %esi                                          #1361.1
-        pushl     %ebp                                          #1361.1
-        pushl     %ebx                                          #1361.1
-        subl      $24, %esp                                     #1361.1
-        movl      %ecx, %edi                                    #1361.1
-        movl      %edx, %esi                                    #1361.1
-        movl      %eax, %ebp                                    #1361.1
-        call      ..L9          # Prob 100%                     #1361.1
-..L9:                                                           #
-        popl      %ebx                                          #1361.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L9], %ebx       #1361.1
-        jmp       ..B15.2       # Prob 100%                     #1361.1
-                                # LOE ebx ebp esi edi
-..B15.43:                       # Preds ..B15.42
-        movl      $12, (%eax)                                   #1384.13
-        movl      $13, 4(%eax)                                  #1385.13
-        movl      $0, 8(%eax)                                   #1386.13
-        movl      %eax, (%edi)                                  #1387.13
-        lea       8(%eax), %edi                                 #1389.44
-                                # LOE ebx ebp esi edi
-..B15.2:                        # Preds ..B15.43 ..B15.1
-        movsbl    (%ebp), %eax                                  #1363.12
-        cmpl      $33, %eax                                     #1363.17
-        je        ..B15.32      # Prob 16%                      #1363.17
-                                # LOE eax ebx ebp esi edi
-..B15.3:                        # Preds ..B15.2
-        cmpl      $94, %eax                                     #1364.16
-        jne       ..B15.10      # Prob 67%                      #1364.16
-                                # LOE eax ebx ebp esi edi
-..B15.4:                        # Preds ..B15.3
-        pushl     $12                                           #1364.16
-        call      malloc at PLT                                    #1364.16
-                                # LOE eax ebx ebp esi edi
-..B15.48:                       # Preds ..B15.4
-        popl      %ecx                                          #1364.16
-        movl      %eax, %ecx                                    #1364.16
-                                # LOE ecx ebx ebp esi edi
-..B15.5:                        # Preds ..B15.48
-        testl     %ecx, %ecx                                    #1364.16
-        jne       ..B15.7       # Prob 68%                      #1364.16
-                                # LOE ecx ebx ebp esi edi
-..B15.6:                        # Preds ..B15.5
-        call      __errno_location at PLT                          #1364.16
-                                # LOE eax ebp
-..B15.49:                       # Preds ..B15.6
-        movl      56(%esp), %ecx                                #1364.16
-        movl      (%eax), %edx                                  #1364.16
-        movl      %edx, (%ecx)                                  #1364.16
-        jmp       ..B15.27      # Prob 100%                     #1364.16
-                                # LOE ebp
-..B15.7:                        # Preds ..B15.5
-        movl      $12, (%ecx)                                   #1364.16
-        movl      %ecx, 20(%esp)                                #1364.16
-        movl      %ecx, (%edi)                                  #1364.16
-        addl      $1, %ebp                                      #1364.16
-        movl      $14, 4(%ecx)                                  #1364.16
-        movl      %ebp, %eax                                    #1364.16
-        movl      %esi, %edx                                    #1364.16
-        movl      $0, 8(%ecx)                                   #1364.16
-        call      nss_sob                                       #1364.16
-                                # LOE eax esi
-..B15.50:                       # Preds ..B15.7
-        movl      20(%esp), %ecx                                #
-        movl      56(%esp), %ebx                                #1361.1
-        movl      60(%esp), %ebp                                #1361.1
-        movl      %ebx, 12(%esp)                                #1361.1
-        movl      %ebp, 16(%esp)                                #1361.1
-        addl      $8, %ecx                                      #1364.16
-        movl      %esi, %edx                                    #1364.16
-        call      nss_fasta_expr                                #1364.16
-                                # LOE eax
-..B15.51:                       # Preds ..B15.50
-        movl      %eax, %ebp                                    #1364.16
-        jmp       ..B15.27      # Prob 100%                     #1364.16
-                                # LOE ebp
-..B15.10:                       # Preds ..B15.3
-        cmpl      $40, %eax                                     #1364.16
-        jne       ..B15.21      # Prob 50%                      #1364.16
-                                # LOE ebx ebp esi edi
-..B15.11:                       # Preds ..B15.10
-        pushl     $12                                           #1364.16
-        call      malloc at PLT                                    #1364.16
-                                # LOE eax ebx ebp esi edi
-..B15.52:                       # Preds ..B15.11
-        popl      %ecx                                          #1364.16
-        movl      %eax, 20(%esp)                                #1364.16
-                                # LOE eax ebx ebp esi edi al ah
-..B15.12:                       # Preds ..B15.52
-        testl     %eax, %eax                                    #1364.16
-        jne       ..B15.14      # Prob 68%                      #1364.16
-                                # LOE eax ebx ebp esi edi al ah
-..B15.13:                       # Preds ..B15.12
-        call      __errno_location at PLT                          #1364.16
-                                # LOE eax ebp
-..B15.53:                       # Preds ..B15.13
-        movl      56(%esp), %ecx                                #1364.16
-        movl      (%eax), %edx                                  #1364.16
-        movl      %edx, (%ecx)                                  #1364.16
-        jmp       ..B15.27      # Prob 100%                     #1364.16
-                                # LOE ebp
-..B15.14:                       # Preds ..B15.12
-        movl      %eax, %ebx                                    #1364.16
-        movl      60(%esp), %eax                                #1361.1
-        movl      $12, (%ebx)                                   #1364.16
-        movl      %ebx, (%edi)                                  #1364.16
-        movl      56(%esp), %edi                                #1361.1
-        movl      $0, 4(%ebx)                                   #1364.16
-        addl      $1, %ebp                                      #1364.16
-        lea       8(%ebx), %ecx                                 #1364.16
-        movl      %edi, 12(%esp)                                #1361.1
-        movl      %eax, 16(%esp)                                #1361.1
-        movl      %ebp, %eax                                    #1364.16
-        movl      %esi, %edx                                    #1364.16
-        call      nss_expr                                      #1364.16
-                                # LOE eax ebx esi bl bh
-..B15.54:                       # Preds ..B15.14
-        movl      %eax, %ebp                                    #1364.16
-                                # LOE ebx ebp esi bl bh
-..B15.15:                       # Preds ..B15.54
-        movl      56(%esp), %eax                                #1364.16
-        movl      (%eax), %edx                                  #1364.16
-        testl     %edx, %edx                                    #1364.16
-        jne       ..B15.27      # Prob 50%                      #1364.16
-                                # LOE ebx ebp esi bl bh
-..B15.16:                       # Preds ..B15.15
-        movl      %ebx, %eax                                    #1364.16
-        movl      8(%eax), %edx                                 #1364.16
-        testl     %edx, %edx                                    #1364.16
-        je        ..B15.19      # Prob 12%                      #1364.16
-                                # LOE ebp esi
-..B15.17:                       # Preds ..B15.16
-        cmpl      %esi, %ebp                                    #1364.16
-        je        ..B15.19      # Prob 12%                      #1364.16
-                                # LOE ebp
-..B15.18:                       # Preds ..B15.17
-        movsbl    (%ebp), %eax                                  #1364.16
-        addl      $1, %ebp                                      #1364.16
-        cmpl      $41, %eax                                     #1364.16
-        je        ..B15.27      # Prob 50%                      #1364.16
-                                # LOE ebp
-..B15.19:                       # Preds ..B15.18 ..B15.17 ..B15.16
-        movl      56(%esp), %eax                                #1364.16
-        movl      $22, (%eax)                                   #1364.16
-        jmp       ..B15.27      # Prob 100%                     #1364.16
-                                # LOE ebp
-..B15.21:                       # Preds ..B15.10
-        movl      56(%esp), %eax                                #1361.1
-        movl      %eax, 12(%esp)                                #1361.1
-        movl      60(%esp), %eax                                #1361.1
-        movl      %esi, %edx                                    #1364.16
-        movl      %edi, %ecx                                    #1364.16
-        movl      %eax, 16(%esp)                                #1361.1
-        movl      %ebp, %eax                                    #1364.16
-        call      nss_fasta_expr                                #1364.16
-                                # LOE eax ebx esi edi
-..B15.55:                       # Preds ..B15.21
-        movl      %eax, %ebp                                    #1364.16
-                                # LOE ebx ebp esi edi
-..B15.22:                       # Preds ..B15.55
-        movl      56(%esp), %eax                                #1364.16
-        movl      (%eax), %edx                                  #1364.16
-        testl     %edx, %edx                                    #1364.16
-        jne       ..B15.27      # Prob 50%                      #1364.16
-                                # LOE ebx ebp esi edi
-..B15.23:                       # Preds ..B15.22
-        cmpl      %esi, %ebp                                    #1364.16
-        jae       ..B15.27      # Prob 33%                      #1364.16
-                                # LOE ebx ebp esi edi
-..B15.24:                       # Preds ..B15.23
-        movl      %ebp, %eax                                    #1364.16
-        movl      %esi, %edx                                    #1364.16
-        call      nss_sob                                       #1364.16
-                                # LOE eax ebx esi edi
-..B15.56:                       # Preds ..B15.24
-        movl      %eax, %ebp                                    #1364.16
-        cmpl      %esi, %ebp                                    #1364.16
-        jae       ..B15.27      # Prob 12%                      #1364.16
-                                # LOE ebx ebp edi
-..B15.25:                       # Preds ..B15.56
-        movsbl    (%ebp), %eax                                  #1364.16
-        cmpl      $36, %eax                                     #1364.16
-        je        ..B15.28      # Prob 5%                       #1364.16
-                                # LOE ebx ebp edi
-..B15.27:                       # Preds ..B15.22 ..B15.23 ..B15.25 ..B15.30 ..B15.56
-                                #       ..B15.58 ..B15.15 ..B15.19 ..B15.18 ..B15.53
-                                #       ..B15.49 ..B15.51
-        movl      %ebp, %eax                                    #1364.16
-        addl      $24, %esp                                     #1364.16
-        popl      %ebx                                          #1364.16
-        popl      %ebp                                          #1364.16
-        popl      %esi                                          #1364.16
-        popl      %edi                                          #1364.16
-        ret                                                     #1364.16
-                                # LOE
-..B15.28:                       # Preds ..B15.25                # Infreq
-        pushl     $12                                           #1364.16
-        addl      $1, %ebp                                      #1364.16
-        call      malloc at PLT                                    #1364.16
-                                # LOE eax ebx ebp edi
-..B15.57:                       # Preds ..B15.28                # Infreq
-        popl      %ecx                                          #1364.16
-                                # LOE eax ebx ebp edi
-..B15.29:                       # Preds ..B15.57                # Infreq
-        testl     %eax, %eax                                    #1364.16
-        je        ..B15.31      # Prob 12%                      #1364.16
-                                # LOE eax ebx ebp edi
-..B15.30:                       # Preds ..B15.29                # Infreq
-        movl      (%edi), %edx                                  #1364.16
-        movl      $12, (%eax)                                   #1364.16
-        movl      %edx, 8(%eax)                                 #1364.16
-        movl      %eax, (%edi)                                  #1364.16
-        movl      $15, 4(%eax)                                  #1364.16
-        jmp       ..B15.27      # Prob 100%                     #1364.16
-                                # LOE ebp
-..B15.31:                       # Preds ..B15.29                # Infreq
-        call      __errno_location at PLT                          #1364.16
-                                # LOE eax ebp
-..B15.58:                       # Preds ..B15.31                # Infreq
-        movl      56(%esp), %ecx                                #1364.16
-        movl      (%eax), %edx                                  #1364.16
-        movl      %edx, (%ecx)                                  #1364.16
-        jmp       ..B15.27      # Prob 100%                     #1364.16
-                                # LOE ebp
-..B15.32:                       # Preds ..B15.2                 # Infreq
-        addl      $1, %ebp                                      #1374.19
-        cmpl      %esi, %ebp                                    #1374.9
-        jae       ..B15.38      # Prob 12%                      #1374.9
-                                # LOE ebx ebp esi edi
-..B15.33:                       # Preds ..B15.32                # Infreq
-        call      __ctype_b_loc at PLT                             #1374.9
-                                # LOE eax ebx ebp esi edi
-..B15.59:                       # Preds ..B15.33                # Infreq
-        movzbl    (%ebp), %edx                                  #1374.9
-        movl      (%eax), %eax                                  #1374.9
-        movzwl    (%eax,%edx,2), %ecx                           #1374.9
-        testl     $8192, %ecx                                   #1374.9
-        je        ..B15.38      # Prob 15%                      #1374.9
-                                # LOE eax ebx ebp esi edi
-..B15.35:                       # Preds ..B15.59 ..B15.36       # Infreq
-        addl      $1, %ebp                                      #1374.9
-        cmpl      %esi, %ebp                                    #1374.9
-        jae       ..B15.38      # Prob 1%                       #1374.9
-                                # LOE eax ebx ebp esi edi
-..B15.36:                       # Preds ..B15.35                # Infreq
-        movzbl    (%ebp), %edx                                  #1374.9
-        movzwl    (%eax,%edx,2), %ecx                           #1374.9
-        testl     $8192, %ecx                                   #1374.9
-        jne       ..B15.35      # Prob 82%                      #1374.9
-                                # LOE eax ebx ebp esi edi
-..B15.38:                       # Preds ..B15.35 ..B15.36 ..B15.59 ..B15.32 # Infreq
-        cmpl      %esi, %ebp                                    #1375.15
-        jne       ..B15.41      # Prob 68%                      #1375.15
-                                # LOE ebx ebp esi edi
-..B15.39:                       # Preds ..B15.38                # Infreq
-        movl      56(%esp), %eax                                #1376.9
-        movl      $22, (%eax)                                   #1376.9
-                                # LOE ebp
-..B15.40:                       # Preds ..B15.61 ..B15.39       # Infreq
-        movl      %ebp, %eax                                    #1375.5
-        addl      $24, %esp                                     #1393.12
-        popl      %ebx                                          #1393.12
-        popl      %ebp                                          #1393.12
-        popl      %esi                                          #1393.12
-        popl      %edi                                          #1393.12
-        ret                                                     #1393.12
-                                # LOE
-..B15.41:                       # Preds ..B15.38                # Infreq
-        pushl     $12                                           #1379.34
-        call      malloc at PLT                                    #1379.25
-                                # LOE eax ebx ebp esi edi
-..B15.60:                       # Preds ..B15.41                # Infreq
-        popl      %ecx                                          #1379.25
-                                # LOE eax ebx ebp esi edi
-..B15.42:                       # Preds ..B15.60                # Infreq
-        testl     %eax, %eax                                    #1380.19
-        jne       ..B15.43      # Prob 99%                      #1380.19
-                                # LOE eax ebx ebp esi edi
-..B15.44:                       # Preds ..B15.42                # Infreq
-        call      __errno_location at PLT                          #1381.24
-                                # LOE eax ebp
-..B15.61:                       # Preds ..B15.44                # Infreq
-        movl      56(%esp), %ecx                                #1381.13
-        movl      (%eax), %edx                                  #1381.24
-        movl      %edx, (%ecx)                                  #1381.13
-        jmp       ..B15.40      # Prob 100%                     #1381.13
-        .align    2,0x90
-                                # LOE ebp
-# mark_end;
-	.type	nss_unary_expr, at function
-	.size	nss_unary_expr,.-nss_unary_expr
-	.data
-# -- End  nss_unary_expr
-	.text
-# -- Begin  nss_sob
-# mark_begin;
-       .align    2,0x90
-nss_sob:
-# parameter 1: %eax
-# parameter 2: %edx
-..B16.1:                        # Preds ..B16.0
-        pushl     %edi                                          #1181.1
-        pushl     %esi                                          #1181.1
-        pushl     %ebx                                          #1181.1
-        movl      %edx, %edi                                    #1181.1
-        movl      %eax, %esi                                    #1181.1
-        cmpl      %edi, %esi                                    #1182.17
-        jae       ..B16.7       # Prob 12%                      #1182.17
-                                # LOE ebp esi edi
-..B16.2:                        # Preds ..B16.1
-        call      ..L10         # Prob 100%                     #
-..L10:                                                          #
-        popl      %ebx                                          #
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L10], %ebx      #
-        call      __ctype_b_loc at PLT                             #1182.24
-                                # LOE eax ebp esi edi
-..B16.11:                       # Preds ..B16.2
-        movzbl    (%esi), %edx                                  #1182.24
-        movl      (%eax), %ecx                                  #1182.24
-        movzwl    (%ecx,%edx,2), %ebx                           #1182.24
-        testl     $8192, %ebx                                   #1182.24
-        je        ..B16.7       # Prob 15%                      #1182.24
-                                # LOE ecx ebp esi edi
-..B16.3:                        # Preds ..B16.11
-        xorl      %edx, %edx                                    #1182.24
-        movl      %esi, %eax                                    #1182.24
-                                # LOE eax edx ecx ebp esi edi
-..B16.4:                        # Preds ..B16.5 ..B16.3
-        addl      $1, %eax                                      #1182.24
-        addl      $1, %edx                                      #1182.24
-        cmpl      %eax, %edi                                    #1182.17
-        jbe       ..B16.6       # Prob 1%                       #1182.17
-                                # LOE eax edx ecx ebp esi edi
-..B16.5:                        # Preds ..B16.4
-        movzbl    (%esi,%edx), %ebx                             #1182.24
-        movzwl    (%ecx,%ebx,2), %ebx                           #1182.24
-        testl     $8192, %ebx                                   #1182.24
-        jne       ..B16.4       # Prob 82%                      #1182.24
-                                # LOE eax edx ecx ebp esi edi
-..B16.6:                        # Preds ..B16.4 ..B16.5
-        addl      %edx, %esi                                    #1183.12
-                                # LOE ebp esi
-..B16.7:                        # Preds ..B16.11 ..B16.6 ..B16.1
-        movl      %esi, %eax                                    #1184.12
-        popl      %ebx                                          #1184.12
-        popl      %esi                                          #1184.12
-        popl      %edi                                          #1184.12
-        ret                                                     #1184.12
-        .align    2,0x90
-                                # LOE
-# mark_end;
-	.type	nss_sob, at function
-	.size	nss_sob,.-nss_sob
-	.data
-# -- End  nss_sob
-	.text
-# -- Begin  nss_fasta_expr
-# mark_begin;
-       .align    2,0x90
-nss_fasta_expr:
-# parameter 1: %eax
-# parameter 2: %edx
-# parameter 3: %ecx
-# parameter 4: 56 + %esp
-# parameter 5: 60 + %esp
-..B17.1:                        # Preds ..B17.0
-        pushl     %edi                                          #1234.1
-        pushl     %esi                                          #1234.1
-        pushl     %ebp                                          #1234.1
-        pushl     %ebx                                          #1234.1
-        subl      $24, %esp                                     #1234.1
-        movl      %edx, %ebx                                    #1234.1
-        movl      %eax, %esi                                    #1234.1
-        movsbl    (%esi), %ebp                                  #1236.16
-        call      ..L11         # Prob 100%                     #1234.1
-..L11:                                                          #
-        popl      %edx                                          #1234.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L11], %edx      #1234.1
-        cmpl      $39, %ebp                                     #1236.16
-        jne       ..B17.16      # Prob 67%                      #1236.16
-                                # LOE edx ecx ebx ebp esi
-..B17.2:                        # Preds ..B17.1
-        addl      $1, %esi                                      #1239.30
-        movl      %esi, %ebp                                    #1239.30
-        cmpl      %ebx, %esi                                    #1239.13
-        jae       ..B17.10      # Prob 44%                      #1239.13
-                                # LOE edx ecx ebx ebp esi
-..B17.4:                        # Preds ..B17.2
-        lea       fasta_2na_map.0 at GOTOFF(%edx), %eax            #1239.13
-        movl      %esi, 16(%esp)                                #
-        movl      %ecx, 20(%esp)                                #
-        xorl      %edi, %edi                                    #
-                                # LOE eax edx ebx ebp edi
-..B17.5:                        # Preds ..B17.7 ..B17.4
-        movsbl    (%ebp), %ecx                                  #1239.13
-        testl     %ecx, %ecx                                    #1239.13
-        jl        ..B17.91      # Prob 1%                       #1239.13
-                                # LOE eax edx ebx ebp edi
-..B17.6:                        # Preds ..B17.5
-        movzbl    (%ebp), %esi                                  #1239.13
-        movsbl    (%esi,%eax), %ecx                             #1239.13
-        testl     %ecx, %ecx                                    #1239.13
-        jl        ..B17.47      # Prob 16%                      #1239.13
-                                # LOE eax edx ebx ebp esi edi
-..B17.7:                        # Preds ..B17.49 ..B17.6
-        addl      $1, %ebp                                      #1239.13
-        cmpl      %ebx, %ebp                                    #1239.13
-        jb        ..B17.5       # Prob 82%                      #1239.13
-                                # LOE eax edx ebx ebp edi
-..B17.8:                        # Preds ..B17.7
-        movl      16(%esp), %esi                                #
-        movl      20(%esp), %ecx                                #
-                                # LOE ecx ebx ebp esi edi cl ch
-..B17.9:                        # Preds ..B17.91 ..B17.8
-        cmpl      %esi, %ebp                                    #1239.13
-        ja        ..B17.42      # Prob 12%                      #1239.13
-                                # LOE ecx ebx ebp esi edi cl ch
-..B17.10:                       # Preds ..B17.2 ..B17.9
-        movl      $22, %edx                                     #1239.13
-        movl      $22, %eax                                     #
-                                # LOE eax edx ebx ebp
-..B17.11:                       # Preds ..B17.10 ..B17.44 ..B17.46
-        testl     %eax, %eax                                    #1240.26
-        jne       ..B17.30      # Prob 50%                      #1240.26
-                                # LOE edx ebx ebp
-..B17.12:                       # Preds ..B17.11
-        cmpl      %ebx, %ebp                                    #1240.38
-        je        ..B17.14      # Prob 12%                      #1240.38
-                                # LOE edx ebp
-..B17.13:                       # Preds ..B17.12
-        movl      56(%esp), %eax                                #1241.13
-        movl      %edx, (%eax)                                  #1241.13
-        movsbl    (%ebp), %edx                                  #1240.47
-        addl      $1, %ebp                                      #1240.47
-        cmpl      $39, %edx                                     #1240.55
-        je        ..B17.31      # Prob 50%                      #1240.55
-                                # LOE ebp
-..B17.14:                       # Preds ..B17.13 ..B17.12
-        movl      56(%esp), %eax                                #1241.13
-        movl      $22, (%eax)                                   #1241.13
-        jmp       ..B17.31      # Prob 100%                     #1241.13
-                                # LOE ebp
-..B17.16:                       # Preds ..B17.1
-        cmpl      $34, %ebp                                     #1236.16
-        jne       ..B17.32      # Prob 50%                      #1236.16
-                                # LOE edx ecx ebx esi
-..B17.17:                       # Preds ..B17.16
-        addl      $1, %esi                                      #1244.30
-        movl      %esi, %ebp                                    #1244.30
-        cmpl      %ebx, %esi                                    #1244.13
-        jae       ..B17.25      # Prob 44%                      #1244.13
-                                # LOE edx ecx ebx ebp esi
-..B17.19:                       # Preds ..B17.17
-        lea       fasta_2na_map.0 at GOTOFF(%edx), %eax            #1244.13
-        movl      %esi, 16(%esp)                                #
-        movl      %ecx, 20(%esp)                                #
-        xorl      %edi, %edi                                    #
-                                # LOE eax edx ebx ebp edi
-..B17.20:                       # Preds ..B17.22 ..B17.19
-        movsbl    (%ebp), %ecx                                  #1244.13
-        testl     %ecx, %ecx                                    #1244.13
-        jl        ..B17.90      # Prob 1%                       #1244.13
-                                # LOE eax edx ebx ebp edi
-..B17.21:                       # Preds ..B17.20
-        movzbl    (%ebp), %esi                                  #1244.13
-        movsbl    (%esi,%eax), %ecx                             #1244.13
-        testl     %ecx, %ecx                                    #1244.13
-        jl        ..B17.58      # Prob 16%                      #1244.13
-                                # LOE eax edx ebx ebp esi edi
-..B17.22:                       # Preds ..B17.60 ..B17.21
-        addl      $1, %ebp                                      #1244.13
-        cmpl      %ebx, %ebp                                    #1244.13
-        jb        ..B17.20      # Prob 82%                      #1244.13
-                                # LOE eax edx ebx ebp edi
-..B17.23:                       # Preds ..B17.22
-        movl      16(%esp), %esi                                #
-        movl      20(%esp), %ecx                                #
-                                # LOE ecx ebx ebp esi edi cl ch
-..B17.24:                       # Preds ..B17.90 ..B17.23
-        cmpl      %esi, %ebp                                    #1244.13
-        ja        ..B17.53      # Prob 12%                      #1244.13
-                                # LOE ecx ebx ebp esi edi cl ch
-..B17.25:                       # Preds ..B17.17 ..B17.24
-        movl      $22, %edx                                     #1244.13
-        movl      $22, %eax                                     #
-                                # LOE eax edx ebx ebp
-..B17.26:                       # Preds ..B17.25 ..B17.55 ..B17.57
-        testl     %eax, %eax                                    #1245.26
-        jne       ..B17.30      # Prob 50%                      #1245.26
-                                # LOE edx ebx ebp
-..B17.27:                       # Preds ..B17.26
-        cmpl      %ebx, %ebp                                    #1245.38
-        je        ..B17.29      # Prob 12%                      #1245.38
-                                # LOE edx ebp
-..B17.28:                       # Preds ..B17.27
-        movl      56(%esp), %eax                                #1241.13
-        movl      %edx, (%eax)                                  #1241.13
-        movsbl    (%ebp), %edx                                  #1245.47
-        addl      $1, %ebp                                      #1245.47
-        cmpl      $34, %edx                                     #1245.55
-        je        ..B17.31      # Prob 50%                      #1245.55
-                                # LOE ebp
-..B17.29:                       # Preds ..B17.28 ..B17.27
-        movl      56(%esp), %eax                                #1246.13
-        movl      $22, (%eax)                                   #1246.13
-        jmp       ..B17.31      # Prob 100%                     #1246.13
-                                # LOE ebp
-..B17.30:                       # Preds ..B17.11 ..B17.26
-        movl      56(%esp), %eax                                #1241.13
-        movl      %edx, (%eax)                                  #1241.13
-                                # LOE ebp
-..B17.31:                       # Preds ..B17.13 ..B17.28 ..B17.30 ..B17.14 ..B17.29
-                                #      
-        movl      %ebp, %eax                                    #1252.12
-        addl      $24, %esp                                     #1252.12
-        popl      %ebx                                          #1252.12
-        popl      %ebp                                          #1252.12
-        popl      %esi                                          #1252.12
-        popl      %edi                                          #1252.12
-        ret                                                     #1252.12
-                                # LOE
-..B17.32:                       # Preds ..B17.16
-        movl      %esi, %ebp                                    #1234.1
-        cmpl      %ebx, %esi                                    #1249.16
-        jae       ..B17.40      # Prob 44%                      #1249.16
-                                # LOE edx ecx ebx ebp esi
-..B17.34:                       # Preds ..B17.32
-        lea       fasta_2na_map.0 at GOTOFF(%edx), %eax            #1249.16
-        movl      %esi, 16(%esp)                                #
-        movl      %ecx, 20(%esp)                                #
-        xorl      %edi, %edi                                    #
-                                # LOE eax edx ebx ebp edi
-..B17.35:                       # Preds ..B17.37 ..B17.34
-        movsbl    (%ebp), %ecx                                  #1249.16
-        testl     %ecx, %ecx                                    #1249.16
-        jl        ..B17.89      # Prob 1%                       #1249.16
-                                # LOE eax edx ebx ebp edi
-..B17.36:                       # Preds ..B17.35
-        movzbl    (%ebp), %esi                                  #1249.16
-        movsbl    (%esi,%eax), %ecx                             #1249.16
-        testl     %ecx, %ecx                                    #1249.16
-        jl        ..B17.69      # Prob 16%                      #1249.16
-                                # LOE eax edx ebx ebp esi edi
-..B17.37:                       # Preds ..B17.71 ..B17.36
-        addl      $1, %ebp                                      #1249.16
-        cmpl      %ebx, %ebp                                    #1249.16
-        jb        ..B17.35      # Prob 82%                      #1249.16
-                                # LOE eax edx ebx ebp edi
-..B17.38:                       # Preds ..B17.37
-        movl      16(%esp), %esi                                #
-        movl      20(%esp), %ecx                                #
-                                # LOE ecx ebp esi edi cl ch
-..B17.39:                       # Preds ..B17.89 ..B17.38
-        cmpl      %esi, %ebp                                    #1249.16
-        ja        ..B17.64      # Prob 12%                      #1249.16
-                                # LOE ecx ebp esi edi cl ch
-..B17.40:                       # Preds ..B17.32 ..B17.39
-        movl      56(%esp), %eax                                #1249.16
-        movl      $22, (%eax)                                   #1249.16
-                                # LOE ebp
-..B17.41:                       # Preds ..B17.40 ..B17.66 ..B17.68
-        movl      %ebp, %eax                                    #1249.16
-        addl      $24, %esp                                     #1249.16
-        popl      %ebx                                          #1249.16
-        popl      %ebp                                          #1249.16
-        popl      %esi                                          #1249.16
-        popl      %edi                                          #1249.16
-        ret                                                     #1249.16
-                                # LOE
-..B17.42:                       # Preds ..B17.9                 # Infreq
-        testl     %edi, %edi                                    #1239.13
-        jne       ..B17.45      # Prob 50%                      #1239.13
-                                # LOE ecx ebx ebp esi cl ch
-..B17.43:                       # Preds ..B17.42                # Infreq
-        movl      60(%esp), %edx                                #1239.13
-        movl      %ebp, %edi                                    #1239.13
-        subl      %esi, %edi                                    #1239.13
-        movl      %edi, 12(%esp)                                #1239.13
-        movl      %ecx, %eax                                    #1239.13
-        movl      %esi, %ecx                                    #1239.13
-        call      NucStrFastaExprMake2                          #1239.13
-                                # LOE eax ebx ebp
-..B17.44:                       # Preds ..B17.43                # Infreq
-        movl      %eax, %edx                                    #1239.13
-        jmp       ..B17.11      # Prob 100%                     #1239.13
-                                # LOE eax edx ebx ebp
-..B17.45:                       # Preds ..B17.42                # Infreq
-        movl      60(%esp), %edx                                #1239.13
-        movl      %ebp, %edi                                    #1239.13
-        subl      %esi, %edi                                    #1239.13
-        movl      %edi, 12(%esp)                                #1239.13
-        movl      %ecx, %eax                                    #1239.13
-        movl      %esi, %ecx                                    #1239.13
-        call      NucStrFastaExprMake4                          #1239.13
-                                # LOE eax ebx ebp
-..B17.46:                       # Preds ..B17.45                # Infreq
-        movl      %eax, %edx                                    #1239.13
-        jmp       ..B17.11      # Prob 100%                     #1239.13
-                                # LOE eax edx ebx ebp
-..B17.47:                       # Preds ..B17.6                 # Infreq
-        lea       fasta_4na_map.0 at GOTOFF(%edx), %ecx            #1239.13
-        cmpl      %ecx, %eax                                    #1239.13
-        je        ..B17.91      # Prob 1%                       #1239.13
-                                # LOE edx ecx ebx ebp esi edi
-..B17.48:                       # Preds ..B17.47                # Infreq
-        movsbl    (%esi,%ecx), %eax                             #1239.13
-        testl     %eax, %eax                                    #1239.13
-        jl        ..B17.91      # Prob 1%                       #1239.13
-                                # LOE edx ecx ebx ebp edi
-..B17.49:                       # Preds ..B17.48                # Infreq
-        movl      %ecx, %eax                                    #1239.13
-        movl      $1, %edi                                      #
-        jmp       ..B17.7       # Prob 100%                     #
-                                # LOE eax edx ebx ebp edi
-..B17.91:                       # Preds ..B17.47 ..B17.48 ..B17.5 # Infreq
-        movl      16(%esp), %esi                                #
-        movl      20(%esp), %ecx                                #
-        jmp       ..B17.9       # Prob 100%                     #
-                                # LOE ecx ebx ebp esi edi cl ch
-..B17.53:                       # Preds ..B17.24                # Infreq
-        testl     %edi, %edi                                    #1244.13
-        jne       ..B17.56      # Prob 50%                      #1244.13
-                                # LOE ecx ebx ebp esi cl ch
-..B17.54:                       # Preds ..B17.53                # Infreq
-        movl      60(%esp), %edx                                #1244.13
-        movl      %ebp, %edi                                    #1244.13
-        subl      %esi, %edi                                    #1244.13
-        movl      %edi, 12(%esp)                                #1244.13
-        movl      %ecx, %eax                                    #1244.13
-        movl      %esi, %ecx                                    #1244.13
-        call      NucStrFastaExprMake2                          #1244.13
-                                # LOE eax ebx ebp
-..B17.55:                       # Preds ..B17.54                # Infreq
-        movl      %eax, %edx                                    #1244.13
-        jmp       ..B17.26      # Prob 100%                     #1244.13
-                                # LOE eax edx ebx ebp
-..B17.56:                       # Preds ..B17.53                # Infreq
-        movl      60(%esp), %edx                                #1244.13
-        movl      %ebp, %edi                                    #1244.13
-        subl      %esi, %edi                                    #1244.13
-        movl      %edi, 12(%esp)                                #1244.13
-        movl      %ecx, %eax                                    #1244.13
-        movl      %esi, %ecx                                    #1244.13
-        call      NucStrFastaExprMake4                          #1244.13
-                                # LOE eax ebx ebp
-..B17.57:                       # Preds ..B17.56                # Infreq
-        movl      %eax, %edx                                    #1244.13
-        jmp       ..B17.26      # Prob 100%                     #1244.13
-                                # LOE eax edx ebx ebp
-..B17.58:                       # Preds ..B17.21                # Infreq
-        lea       fasta_4na_map.0 at GOTOFF(%edx), %ecx            #1244.13
-        cmpl      %ecx, %eax                                    #1244.13
-        je        ..B17.90      # Prob 1%                       #1244.13
-                                # LOE edx ecx ebx ebp esi edi
-..B17.59:                       # Preds ..B17.58                # Infreq
-        movsbl    (%esi,%ecx), %eax                             #1244.13
-        testl     %eax, %eax                                    #1244.13
-        jl        ..B17.90      # Prob 1%                       #1244.13
-                                # LOE edx ecx ebx ebp edi
-..B17.60:                       # Preds ..B17.59                # Infreq
-        movl      %ecx, %eax                                    #1244.13
-        movl      $1, %edi                                      #
-        jmp       ..B17.22      # Prob 100%                     #
-                                # LOE eax edx ebx ebp edi
-..B17.90:                       # Preds ..B17.58 ..B17.59 ..B17.20 # Infreq
-        movl      16(%esp), %esi                                #
-        movl      20(%esp), %ecx                                #
-        jmp       ..B17.24      # Prob 100%                     #
-                                # LOE ecx ebx ebp esi edi cl ch
-..B17.64:                       # Preds ..B17.39                # Infreq
-        testl     %edi, %edi                                    #1249.16
-        jne       ..B17.67      # Prob 50%                      #1249.16
-                                # LOE ecx ebp esi cl ch
-..B17.65:                       # Preds ..B17.64                # Infreq
-        movl      60(%esp), %edx                                #1249.16
-        movl      %ebp, %ebx                                    #1249.16
-        subl      %esi, %ebx                                    #1249.16
-        movl      %ebx, 12(%esp)                                #1249.16
-        movl      %ecx, %eax                                    #1249.16
-        movl      %esi, %ecx                                    #1249.16
-        call      NucStrFastaExprMake2                          #1249.16
-                                # LOE eax ebp
-..B17.66:                       # Preds ..B17.65                # Infreq
-        movl      56(%esp), %edx                                #1249.16
-        movl      %eax, (%edx)                                  #1249.16
-        jmp       ..B17.41      # Prob 100%                     #1249.16
-                                # LOE ebp
-..B17.67:                       # Preds ..B17.64                # Infreq
-        movl      60(%esp), %edx                                #1249.16
-        movl      %ebp, %ebx                                    #1249.16
-        subl      %esi, %ebx                                    #1249.16
-        movl      %ebx, 12(%esp)                                #1249.16
-        movl      %ecx, %eax                                    #1249.16
-        movl      %esi, %ecx                                    #1249.16
-        call      NucStrFastaExprMake4                          #1249.16
-                                # LOE eax ebp
-..B17.68:                       # Preds ..B17.67                # Infreq
-        movl      56(%esp), %edx                                #1249.16
-        movl      %eax, (%edx)                                  #1249.16
-        jmp       ..B17.41      # Prob 100%                     #1249.16
-                                # LOE ebp
-..B17.69:                       # Preds ..B17.36                # Infreq
-        lea       fasta_4na_map.0 at GOTOFF(%edx), %ecx            #1249.16
-        cmpl      %ecx, %eax                                    #1249.16
-        je        ..B17.89      # Prob 1%                       #1249.16
-                                # LOE edx ecx ebx ebp esi edi
-..B17.70:                       # Preds ..B17.69                # Infreq
-        movsbl    (%ecx,%esi), %eax                             #1249.16
-        testl     %eax, %eax                                    #1249.16
-        jl        ..B17.89      # Prob 1%                       #1249.16
-                                # LOE edx ecx ebx ebp edi
-..B17.71:                       # Preds ..B17.70                # Infreq
-        movl      %ecx, %eax                                    #1249.16
-        movl      $1, %edi                                      #
-        jmp       ..B17.37      # Prob 100%                     #
-                                # LOE eax edx ebx ebp edi
-..B17.89:                       # Preds ..B17.69 ..B17.70 ..B17.35 # Infreq
-        movl      16(%esp), %esi                                #
-        movl      20(%esp), %ecx                                #
-        jmp       ..B17.39      # Prob 100%                     #
-        .align    2,0x90
-                                # LOE ecx ebp esi edi cl ch
-# mark_end;
-	.type	nss_fasta_expr, at function
-	.size	nss_fasta_expr,.-nss_fasta_expr
-	.data
-# -- End  nss_fasta_expr
-	.text
-# -- Begin  NucStrFastaExprMake4
-# mark_begin;
-       .align    2,0x90
-NucStrFastaExprMake4:
-# parameter 1: %eax
-# parameter 2: %edx
-# parameter 3: %ecx
-# parameter 4: 20 + %ebp
-..B18.1:                        # Preds ..B18.0
-        pushl     %ebp                                          #1017.1
-        movl      %esp, %ebp                                    #1017.1
-        andl      $-16, %esp                                    #1017.1
-        pushl     %edi                                          #1017.1
-        pushl     %esi                                          #1017.1
-        pushl     %ebx                                          #1017.1
-        subl      $52, %esp                                     #1017.1
-        movl      %ecx, %esi                                    #1017.1
-        movl      20(%ebp), %ecx                                #1015.5
-        movl      %edx, 12(%esp)                                #1017.1
-        movl      %eax, %edx                                    #1017.1
-        cmpl      $29, %ecx                                     #1023.17
-        jbe       ..B18.3       # Prob 43%                      #1023.17
-                                # LOE edx esi
-..B18.2:                        # Preds ..B18.1
-        movl      $7, %eax                                      #1024.16
-        addl      $52, %esp                                     #1024.16
-        popl      %ebx                                          #1024.16
-        popl      %esi                                          #1024.16
-        popl      %edi                                          #1024.16
-        movl      %ebp, %esp                                    #1024.16
-        popl      %ebp                                          #1024.16
-        ret                                                     #1024.16
-                                # LOE
-..B18.3:                        # Preds ..B18.1
-        pushl     $160                                          #1026.32
-        movl      %edx, 12(%esp)                                #1026.9
-        call      ..L12         # Prob 100%                     #
-..L12:                                                          #
-        popl      %ebx                                          #
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L12], %ebx      #
-        call      malloc at PLT                                    #1026.9
-                                # LOE eax ebx esi
-..B18.46:                       # Preds ..B18.3
-        movl      12(%esp), %edx                                #
-        addl      $4, %esp                                      #1026.9
-                                # LOE eax edx ebx esi dl dh
-..B18.4:                        # Preds ..B18.46
-        testl     %eax, %eax                                    #1026.9
-        je        ..B18.43      # Prob 12%                      #1026.9
-                                # LOE eax edx ebx esi dl dh
-..B18.5:                        # Preds ..B18.4
-        lea       15(%eax), %edi                                #1026.9
-        andl      $-16, %edi                                    #1026.9
-        movl      %eax, 8(%edi)                                 #1026.9
-        je        ..B18.43      # Prob 5%                       #1027.15
-                                # LOE edx ebx esi edi dl dh
-..B18.6:                        # Preds ..B18.5
-        movl      20(%ebp), %eax                                #1031.5
-        movl      %edi, (%edx)                                  #1030.5
-        movl      %eax, 4(%edi)                                 #1031.5
-        testl     %eax, %eax                                    #1035.22
-        jbe       ..B18.42      # Prob 16%                      #1035.22
-                                # LOE ebx esi edi
-..B18.7:                        # Preds ..B18.6
-        movl      20(%ebp), %edx                                #
-        movl      %edi, 4(%esp)                                 #
-        xorl      %ecx, %ecx                                    #
-                                # LOE edx ecx ebx esi
-..B18.8:                        # Preds ..B18.15 ..B18.7
-        movsbl    (%esi,%ecx), %eax                             #1037.49
-        movsbl    fasta_4na_map.0 at GOTOFF(%ebx,%eax), %eax       #1037.25
-        movl      %ecx, %edi                                    #1038.22
-        andl      $3, %edi                                      #1038.22
-        je        ..B18.41      # Prob 20%                      #1038.22
-                                # LOE eax edx ecx ebx esi edi
-..B18.9:                        # Preds ..B18.8
-        cmpl      $1, %edi                                      #1038.22
-        je        ..B18.14      # Prob 25%                      #1038.22
-                                # LOE eax edx ecx ebx esi edi
-..B18.10:                       # Preds ..B18.9
-        cmpl      $2, %edi                                      #1038.22
-        jne       ..B18.12      # Prob 67%                      #1038.22
-                                # LOE eax edx ecx ebx esi edi
-..B18.11:                       # Preds ..B18.10
-        movl      %ecx, %edi                                    #1049.32
-        shrl      $2, %edi                                      #1049.32
-        shll      $12, %eax                                     #1049.47
-        orw       %ax, 16(%esp,%edi,2)                          #1049.13
-        movzwl    32(%esp,%edi,2), %eax                         #1050.13
-        orl       $-4096, %eax                                  #1050.13
-        movw      %ax, 32(%esp,%edi,2)                          #1050.13
-        jmp       ..B18.15      # Prob 100%                     #1050.13
-                                # LOE edx ecx ebx esi
-..B18.12:                       # Preds ..B18.10
-        cmpl      $3, %edi                                      #1038.22
-        jne       ..B18.15      # Prob 50%                      #1038.22
-                                # LOE eax edx ecx ebx esi
-..B18.13:                       # Preds ..B18.12
-        movl      %ecx, %edi                                    #1053.32
-        shrl      $2, %edi                                      #1053.32
-        shll      $8, %eax                                      #1053.47
-        orw       %ax, 16(%esp,%edi,2)                          #1053.13
-        movzwl    32(%esp,%edi,2), %eax                         #1054.13
-        orl       $-61696, %eax                                 #1054.13
-        movw      %ax, 32(%esp,%edi,2)                          #1054.13
-        jmp       ..B18.15      # Prob 100%                     #1054.13
-                                # LOE edx ecx ebx esi
-..B18.14:                       # Preds ..B18.9
-        movl      %ecx, %edi                                    #1045.32
-        shrl      $2, %edi                                      #1045.32
-        orw       %ax, 16(%esp,%edi,2)                          #1045.13
-        movzwl    32(%esp,%edi,2), %eax                         #1046.13
-        orl       $15, %eax                                     #1046.13
-        movw      %ax, 32(%esp,%edi,2)                          #1046.13
-                                # LOE edx ecx ebx esi
-..B18.15:                       # Preds ..B18.41 ..B18.14 ..B18.11 ..B18.13 ..B18.12
-                                #      
-        addl      $1, %ecx                                      #1035.31
-        cmpl      %edx, %ecx                                    #1035.22
-        jb        ..B18.8       # Prob 82%                      #1035.22
-                                # LOE edx ecx ebx esi
-..B18.16:                       # Preds ..B18.15
-        movl      4(%esp), %edi                                 #
-                                # LOE ecx edi
-..B18.17:                       # Preds ..B18.16 ..B18.42
-        addl      $3, %ecx                                      #1060.21
-        shrl      $2, %ecx                                      #1060.28
-        cmpl      $8, %ecx                                      #1060.35
-        jae       ..B18.30      # Prob 50%                      #1060.35
-                                # LOE ecx edi
-..B18.18:                       # Preds ..B18.17
-        movl      %ecx, %ebx                                    #1060.5
-        negl      %ebx                                          #1060.5
-        addl      $8, %ebx                                      #1060.5
-        lea       (%ecx,%ecx), %esi                             #
-        movl      %esi, 8(%esp)                                 #
-        lea       16(%esp,%ecx,2), %esi                         #1060.5
-        andl      $15, %esi                                     #1060.5
-        movl      %esi, %eax                                    #1060.5
-        negl      %eax                                          #1060.5
-        addl      $16, %eax                                     #1060.5
-        shrl      $1, %eax                                      #1060.5
-        cmpl      $0, %esi                                      #1060.5
-        cmovne    %eax, %esi                                    #1060.5
-        lea       8(%esi), %edx                                 #1060.5
-        cmpl      %edx, %ebx                                    #1060.5
-        jb        ..B18.40      # Prob 10%                      #1060.5
-                                # LOE ecx ebx esi edi
-..B18.19:                       # Preds ..B18.18
-        movl      %ebx, %edx                                    #1060.5
-        subl      %esi, %edx                                    #1060.5
-        andl      $7, %edx                                      #1060.5
-        negl      %edx                                          #1060.5
-        addl      %ebx, %edx                                    #1060.5
-        testl     %esi, %esi                                    #1060.5
-        jbe       ..B18.23      # Prob 1%                       #1060.5
-                                # LOE edx ecx ebx esi edi
-..B18.20:                       # Preds ..B18.19
-        movl      %ecx, (%esp)                                  #
-        movl      %edi, 4(%esp)                                 #
-        movl      8(%esp), %edi                                 #
-        xorl      %eax, %eax                                    #
-                                # LOE eax edx ebx esi edi
-..B18.21:                       # Preds ..B18.21 ..B18.20
-        xorl      %ecx, %ecx                                    #1062.9
-        movw      %cx, 16(%esp,%edi)                            #1062.9
-        addl      $1, %eax                                      #1060.5
-        movw      %cx, 32(%esp,%edi)                            #1063.9
-        addl      $2, %edi                                      #1060.5
-        cmpl      %esi, %eax                                    #1060.5
-        jb        ..B18.21      # Prob 99%                      #1060.5
-                                # LOE eax edx ebx esi edi
-..B18.22:                       # Preds ..B18.21
-        movl      (%esp), %ecx                                  #
-        movl      4(%esp), %edi                                 #
-                                # LOE edx ecx ebx esi edi
-..B18.23:                       # Preds ..B18.22 ..B18.19
-        lea       (%esi,%esi), %eax                             #1062.29
-        lea       (%eax,%ecx,2), %eax                           #1062.29
-        pxor      %xmm0, %xmm0                                  #1062.29
-                                # LOE eax edx ecx ebx esi edi xmm0
-..B18.24:                       # Preds ..B18.24 ..B18.23
-        movdqa    %xmm0, 16(%esp,%eax)                          #1062.9
-        movdqa    %xmm0, 32(%esp,%eax)                          #1063.9
-        addl      $16, %eax                                     #1060.5
-        addl      $8, %esi                                      #1060.5
-        cmpl      %edx, %esi                                    #1060.5
-        jb        ..B18.24      # Prob 99%                      #1060.5
-                                # LOE eax edx ecx ebx esi edi xmm0
-..B18.26:                       # Preds ..B18.24 ..B18.40
-        cmpl      %ebx, %edx                                    #1060.5
-        jae       ..B18.30      # Prob 1%                       #1060.5
-                                # LOE edx ecx ebx edi
-..B18.27:                       # Preds ..B18.26
-        lea       (%edx,%edx), %eax                             #
-        lea       (%eax,%ecx,2), %eax                           #
-                                # LOE eax edx ebx edi
-..B18.28:                       # Preds ..B18.28 ..B18.27
-        xorl      %esi, %esi                                    #1062.9
-        movw      %si, 16(%esp,%eax)                            #1062.9
-        addl      $1, %edx                                      #1060.5
-        movw      %si, 32(%esp,%eax)                            #1063.9
-        addl      $2, %eax                                      #1060.5
-        cmpl      %ebx, %edx                                    #1060.5
-        jb        ..B18.28      # Prob 99%                      #1060.5
-                                # LOE eax edx ebx edi
-..B18.30:                       # Preds ..B18.28 ..B18.26 ..B18.17
-        movl      12(%esp), %eax                                #1068.10
-        testl     %eax, %eax                                    #1068.10
-        je        ..B18.32      # Prob 50%                      #1068.10
-                                # LOE edi
-..B18.31:                       # Preds ..B18.30
-        movl      $10, (%edi)                                   #1070.9
-        jmp       ..B18.39      # Prob 100%                     #1070.9
-                                # LOE edi
-..B18.32:                       # Preds ..B18.30
-        movl      20(%ebp), %eax                                #1072.22
-        cmpl      $2, %eax                                      #1072.22
-        jae       ..B18.34      # Prob 50%                      #1072.22
-                                # LOE edi
-..B18.33:                       # Preds ..B18.32
-        movzwl    16(%esp), %eax                                #1074.29
-        movzwl    32(%esp), %esi                                #1078.26
-        movl      $6, (%edi)                                    #1082.9
-        movw      %ax, 18(%esp)                                 #1074.9
-        movl      16(%esp), %ebx                                #1075.29
-        movl      %ebx, 20(%esp)                                #1075.9
-        movl      16(%esp), %edx                                #1076.29
-        movl      %edx, 24(%esp)                                #1076.9
-        movl      %ebx, 28(%esp)                                #1076.9
-        movw      %si, 34(%esp)                                 #1078.9
-        movl      32(%esp), %edx                                #1079.26
-        movl      %edx, 36(%esp)                                #1079.9
-        movl      32(%esp), %eax                                #1080.26
-        movl      %eax, 40(%esp)                                #1080.9
-        movl      %edx, 44(%esp)                                #1080.9
-        jmp       ..B18.39      # Prob 100%                     #1080.9
-                                # LOE edi
-..B18.34:                       # Preds ..B18.32
-        movl      20(%ebp), %eax                                #1084.22
-        cmpl      $6, %eax                                      #1084.22
-        jae       ..B18.36      # Prob 50%                      #1084.22
-                                # LOE edi
-..B18.35:                       # Preds ..B18.34
-        movl      16(%esp), %edx                                #1086.29
-        movl      32(%esp), %esi                                #1089.26
-        movl      $7, (%edi)                                    #1092.9
-        movl      %edx, 20(%esp)                                #1086.9
-        movl      16(%esp), %eax                                #1087.29
-        movl      %eax, 24(%esp)                                #1087.9
-        movl      %edx, 28(%esp)                                #1087.9
-        movl      %esi, 36(%esp)                                #1089.9
-        movl      32(%esp), %ebx                                #1090.26
-        movl      %ebx, 40(%esp)                                #1090.9
-        movl      %esi, 44(%esp)                                #1090.9
-        jmp       ..B18.39      # Prob 100%                     #1090.9
-                                # LOE edi
-..B18.36:                       # Preds ..B18.34
-        movl      20(%ebp), %eax                                #1094.22
-        cmpl      $14, %eax                                     #1094.22
-        jae       ..B18.38      # Prob 50%                      #1094.22
-                                # LOE edi
-..B18.37:                       # Preds ..B18.36
-        movl      16(%esp), %eax                                #1096.29
-        movl      20(%esp), %edx                                #1096.29
-        movl      32(%esp), %ebx                                #1097.26
-        movl      36(%esp), %esi                                #1097.26
-        movl      %eax, 24(%esp)                                #1096.9
-        movl      $1, (%edi)                                    #1099.9
-        movl      %edx, 28(%esp)                                #1096.9
-        movl      %ebx, 40(%esp)                                #1097.9
-        movl      %esi, 44(%esp)                                #1097.9
-        jmp       ..B18.39      # Prob 100%                     #1097.9
-                                # LOE edi
-..B18.38:                       # Preds ..B18.36
-        movl      $8, (%edi)                                    #1103.9
-                                # LOE edi
-..B18.39:                       # Preds ..B18.31 ..B18.33 ..B18.35 ..B18.37 ..B18.38
-                                #      
-        movl      16(%esp), %eax                                #1106.42
-        movl      20(%esp), %ebx                                #1106.42
-        movl      24(%esp), %esi                                #1106.42
-        lea       16(%esp), %ecx                                #1110.5
-        movl      %eax, 16(%edi)                                #1106.42
-        movl      28(%esp), %eax                                #1106.42
-        movl      %ebx, 20(%edi)                                #1106.42
-        movl      %esi, 24(%edi)                                #1106.42
-        movl      %eax, 28(%edi)                                #1106.42
-        movl      32(%esp), %eax                                #1107.39
-        movl      %eax, 32(%edi)                                #1107.39
-        movl      36(%esp), %eax                                #1107.39
-        movl      %eax, 36(%edi)                                #1107.39
-        movl      40(%esp), %eax                                #1107.39
-        movl      %eax, 40(%edi)                                #1107.39
-        movl      44(%esp), %eax                                #1107.39
-        movl      %eax, 44(%edi)                                #1107.39
-# Begin ASM
-        mov (%ecx), %eax;mov 12(%ecx), %edx;bswap %eax;bswap %edx;mov %eax, 12(%ecx);mov %edx, (%ecx);mov 4(%ecx), %eax;mov 8(%ecx), %edx;bswap %eax;bswap %edx;mov %eax, 8(%ecx);mov %edx, 4(%ecx);
-# End ASM                                                       #1110.5
-        lea       32(%esp), %ecx                                #1111.5
-# Begin ASM
-        mov (%ecx), %eax;mov 12(%ecx), %edx;bswap %eax;bswap %edx;mov %eax, 12(%ecx);mov %edx, (%ecx);mov 4(%ecx), %eax;mov 8(%ecx), %edx;bswap %eax;bswap %edx;mov %eax, 8(%ecx);mov %edx, 4(%ecx);
-# End ASM                                                       #1111.5
-        movl      $4, %ecx                                      #1114.5
-        lea       16(%esp), %edx                                #1114.5
-# Begin ASM
-        mov 4(%edx), %eax;shrd %cl, %eax, (%edx);mov 8(%edx), %eax;shrd %cl, %eax, 4(%edx);mov 12(%edx), %eax;shrd %cl, %eax, 8(%edx);shr %cl, %eax;mov %eax, 12(%edx);
-# End ASM                                                       #1114.5
-        lea       32(%esp), %edx                                #1115.5
-# Begin ASM
-        mov 4(%edx), %eax;shrd %cl, %eax, (%edx);mov 8(%edx), %eax;shrd %cl, %eax, 4(%edx);mov 12(%edx), %eax;shrd %cl, %eax, 8(%edx);shr %cl, %eax;mov %eax, 12(%edx);
-# End ASM                                                       #1115.5
-        lea       48(%edi), %ecx                                #1118.5
-        lea       16(%esp), %edx                                #1118.5
-# Begin ASM
-        push %ebx;mov (%edx), %eax;mov 12(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 12(%ecx);mov %ebx, (%ecx);mov 4(%edx), %eax;mov 8(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 8(%ecx);mov %ebx, 4(%ecx);pop %ebx;
-# End ASM                                                       #1118.5
-        lea       64(%edi), %ecx                                #1119.5
-        lea       32(%esp), %edx                                #1119.5
-# Begin ASM
-        push %ebx;mov (%edx), %eax;mov 12(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 12(%ecx);mov %ebx, (%ecx);mov 4(%edx), %eax;mov 8(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 8(%ecx);mov %ebx, 4(%ecx);pop %ebx;
-# End ASM                                                       #1119.5
-        movl      $4, %ecx                                      #1121.5
-        lea       16(%esp), %edx                                #1121.5
-# Begin ASM
-        mov 4(%edx), %eax;shrd %cl, %eax, (%edx);mov 8(%edx), %eax;shrd %cl, %eax, 4(%edx);mov 12(%edx), %eax;shrd %cl, %eax, 8(%edx);shr %cl, %eax;mov %eax, 12(%edx);
-# End ASM                                                       #1121.5
-        lea       32(%esp), %edx                                #1122.5
-# Begin ASM
-        mov 4(%edx), %eax;shrd %cl, %eax, (%edx);mov 8(%edx), %eax;shrd %cl, %eax, 4(%edx);mov 12(%edx), %eax;shrd %cl, %eax, 8(%edx);shr %cl, %eax;mov %eax, 12(%edx);
-# End ASM                                                       #1122.5
-        lea       80(%edi), %ecx                                #1124.5
-        lea       16(%esp), %edx                                #1124.5
-# Begin ASM
-        push %ebx;mov (%edx), %eax;mov 12(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 12(%ecx);mov %ebx, (%ecx);mov 4(%edx), %eax;mov 8(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 8(%ecx);mov %ebx, 4(%ecx);pop %ebx;
-# End ASM                                                       #1124.5
-        lea       96(%edi), %ecx                                #1125.5
-        lea       32(%esp), %edx                                #1125.5
-# Begin ASM
-        push %ebx;mov (%edx), %eax;mov 12(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 12(%ecx);mov %ebx, (%ecx);mov 4(%edx), %eax;mov 8(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 8(%ecx);mov %ebx, 4(%ecx);pop %ebx;
-# End ASM                                                       #1125.5
-        movl      $4, %ecx                                      #1127.5
-        lea       16(%esp), %edx                                #1127.5
-# Begin ASM
-        mov 4(%edx), %eax;shrd %cl, %eax, (%edx);mov 8(%edx), %eax;shrd %cl, %eax, 4(%edx);mov 12(%edx), %eax;shrd %cl, %eax, 8(%edx);shr %cl, %eax;mov %eax, 12(%edx);
-# End ASM                                                       #1127.5
-        lea       32(%esp), %edx                                #1128.5
-# Begin ASM
-        mov 4(%edx), %eax;shrd %cl, %eax, (%edx);mov 8(%edx), %eax;shrd %cl, %eax, 4(%edx);mov 12(%edx), %eax;shrd %cl, %eax, 8(%edx);shr %cl, %eax;mov %eax, 12(%edx);
-# End ASM                                                       #1128.5
-        lea       112(%edi), %ecx                               #1130.5
-        lea       16(%esp), %edx                                #1130.5
-# Begin ASM
-        push %ebx;mov (%edx), %eax;mov 12(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 12(%ecx);mov %ebx, (%ecx);mov 4(%edx), %eax;mov 8(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 8(%ecx);mov %ebx, 4(%ecx);pop %ebx;
-# End ASM                                                       #1130.5
-        addl      $128, %edi                                    #1131.5
-        movl      %edi, %ecx                                    #1131.5
-        lea       32(%esp), %edx                                #1131.5
-# Begin ASM
-        push %ebx;mov (%edx), %eax;mov 12(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 12(%ecx);mov %ebx, (%ecx);mov 4(%edx), %eax;mov 8(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 8(%ecx);mov %ebx, 4(%ecx);pop %ebx;
-# End ASM                                                       #1131.5
-        xorl      %eax, %eax                                    #1173.12
-        addl      $52, %esp                                     #1173.12
-        popl      %ebx                                          #1173.12
-        popl      %esi                                          #1173.12
-        popl      %edi                                          #1173.12
-        movl      %ebp, %esp                                    #1173.12
-        popl      %ebp                                          #1173.12
-        ret                                                     #1173.12
-                                # LOE
-..B18.40:                       # Preds ..B18.18                # Infreq
-        xorl      %edx, %edx                                    #1060.5
-        jmp       ..B18.26      # Prob 100%                     #1060.5
-                                # LOE edx ecx ebx edi
-..B18.41:                       # Preds ..B18.8                 # Infreq
-        movl      %ecx, %edi                                    #1041.32
-        shrl      $2, %edi                                      #1041.32
-        shll      $4, %eax                                      #1041.46
-        movw      %ax, 16(%esp,%edi,2)                          #1041.13
-        movl      $240, %eax                                    #1042.13
-        movw      %ax, 32(%esp,%edi,2)                          #1042.13
-        jmp       ..B18.15      # Prob 100%                     #1042.13
-                                # LOE edx ecx ebx esi
-..B18.42:                       # Preds ..B18.6                 # Infreq
-        xorl      %ecx, %ecx                                    #
-        jmp       ..B18.17      # Prob 100%                     #
-                                # LOE ecx edi
-..B18.43:                       # Preds ..B18.4 ..B18.5         # Infreq
-        call      __errno_location at PLT                          #1028.16
-                                # LOE eax
-..B18.47:                       # Preds ..B18.43                # Infreq
-        movl      (%eax), %eax                                  #1028.16
-        addl      $52, %esp                                     #1028.16
-        popl      %ebx                                          #1028.16
-        popl      %esi                                          #1028.16
-        popl      %edi                                          #1028.16
-        movl      %ebp, %esp                                    #1028.16
-        popl      %ebp                                          #1028.16
-        ret                                                     #1028.16
-        .align    2,0x90
-                                # LOE
-# mark_end;
-	.type	NucStrFastaExprMake4, at function
-	.size	NucStrFastaExprMake4,.-NucStrFastaExprMake4
-	.data
-# -- End  NucStrFastaExprMake4
-	.text
-# -- Begin  NucStrFastaExprMake2
-# mark_begin;
-       .align    2,0x90
-NucStrFastaExprMake2:
-# parameter 1: %eax
-# parameter 2: %edx
-# parameter 3: %ecx
-# parameter 4: 20 + %ebp
-..B19.1:                        # Preds ..B19.0
-        pushl     %ebp                                          #838.1
-        movl      %esp, %ebp                                    #838.1
-        andl      $-16, %esp                                    #838.1
-        pushl     %edi                                          #838.1
-        pushl     %esi                                          #838.1
-        pushl     %ebx                                          #838.1
-        subl      $52, %esp                                     #838.1
-        movl      %ecx, %esi                                    #838.1
-        movl      %edx, 48(%esp)                                #838.1
-        movl      %eax, %edi                                    #838.1
-        movl      20(%ebp), %eax                                #836.5
-        cmpl      $61, %eax                                     #844.17
-        jbe       ..B19.3       # Prob 43%                      #844.17
-                                # LOE esi edi
-..B19.2:                        # Preds ..B19.1
-        movl      $7, %eax                                      #845.16
-        addl      $52, %esp                                     #845.16
-        popl      %ebx                                          #845.16
-        popl      %esi                                          #845.16
-        popl      %edi                                          #845.16
-        movl      %ebp, %esp                                    #845.16
-        popl      %ebp                                          #845.16
-        ret                                                     #845.16
-                                # LOE
-..B19.3:                        # Preds ..B19.1
-        call      ..L13         # Prob 100%                     #
-..L13:                                                          #
-        popl      %ebx                                          #
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L13], %ebx      #
-        movl      %ebx, 12(%esp)                                #
-        pushl     $160                                          #847.32
-        call      malloc at PLT                                    #847.9
-                                # LOE eax esi edi
-..B19.48:                       # Preds ..B19.3
-        popl      %ecx                                          #847.9
-                                # LOE eax esi edi
-..B19.4:                        # Preds ..B19.48
-        testl     %eax, %eax                                    #847.9
-        je        ..B19.45      # Prob 12%                      #847.9
-                                # LOE eax esi edi
-..B19.5:                        # Preds ..B19.4
-        lea       15(%eax), %ebx                                #847.9
-        andl      $-16, %ebx                                    #847.9
-        movl      %eax, 8(%ebx)                                 #847.9
-        je        ..B19.45      # Prob 5%                       #848.15
-                                # LOE ebx esi edi
-..B19.6:                        # Preds ..B19.5
-        movl      20(%ebp), %eax                                #852.5
-        movl      %ebx, (%edi)                                  #851.5
-        movl      %eax, 4(%ebx)                                 #852.5
-        testl     %eax, %eax                                    #856.22
-        jbe       ..B19.44      # Prob 16%                      #856.22
-                                # LOE ebx esi
-..B19.7:                        # Preds ..B19.6
-        movl      12(%esp), %eax                                #
-        movl      %ebx, 8(%esp)                                 #
-        xorl      %edi, %edi                                    #
-                                # LOE eax esi edi
-..B19.8:                        # Preds ..B19.15 ..B19.7
-        movsbl    (%esi,%edi), %edx                             #858.48
-        movzbl    fasta_2na_map.0 at GOTOFF(%eax,%edx), %edx       #858.24
-        movl      %edi, %ecx                                    #859.22
-        andl      $3, %ecx                                      #859.22
-        je        ..B19.43      # Prob 20%                      #859.22
-                                # LOE eax edx ecx esi edi
-..B19.9:                        # Preds ..B19.8
-        cmpl      $1, %ecx                                      #859.22
-        je        ..B19.14      # Prob 25%                      #859.22
-                                # LOE eax edx ecx esi edi
-..B19.10:                       # Preds ..B19.9
-        cmpl      $2, %ecx                                      #859.22
-        jne       ..B19.12      # Prob 67%                      #859.22
-                                # LOE eax edx ecx esi edi
-..B19.11:                       # Preds ..B19.10
-        movl      %edi, %ecx                                    #870.32
-        shrl      $2, %ecx                                      #870.32
-        orb       $12, 32(%esp,%ecx)                            #871.13
-        shll      $2, %edx                                      #870.47
-        orb       %dl, 16(%esp,%ecx)                            #870.13
-        jmp       ..B19.15      # Prob 100%                     #870.13
-                                # LOE eax esi edi
-..B19.12:                       # Preds ..B19.10
-        cmpl      $3, %ecx                                      #859.22
-        jne       ..B19.15      # Prob 50%                      #859.22
-                                # LOE eax edx esi edi
-..B19.13:                       # Preds ..B19.12
-        movl      %edi, %ecx                                    #874.32
-        shrl      $2, %ecx                                      #874.32
-        orb       $3, 32(%esp,%ecx)                             #875.13
-        orb       %dl, 16(%esp,%ecx)                            #874.13
-        jmp       ..B19.15      # Prob 100%                     #874.13
-                                # LOE eax esi edi
-..B19.14:                       # Preds ..B19.9
-        movl      %edi, %ecx                                    #866.32
-        shrl      $2, %ecx                                      #866.32
-        orb       $48, 32(%esp,%ecx)                            #867.13
-        shll      $4, %edx                                      #866.47
-        orb       %dl, 16(%esp,%ecx)                            #866.13
-                                # LOE eax esi edi
-..B19.15:                       # Preds ..B19.43 ..B19.14 ..B19.11 ..B19.13 ..B19.12
-                                #      
-        movl      20(%ebp), %edx                                #856.22
-        addl      $1, %edi                                      #856.31
-        cmpl      %edx, %edi                                    #856.22
-        jb        ..B19.8       # Prob 82%                      #856.22
-                                # LOE eax esi edi
-..B19.16:                       # Preds ..B19.15
-        movl      8(%esp), %ebx                                 #
-                                # LOE ebx edi
-..B19.17:                       # Preds ..B19.16 ..B19.44
-        addl      $3, %edi                                      #881.21
-        shrl      $2, %edi                                      #881.28
-        cmpl      $16, %edi                                     #881.35
-        jae       ..B19.30      # Prob 50%                      #881.35
-                                # LOE ebx edi
-..B19.18:                       # Preds ..B19.17
-        lea       16(%esp), %edx                                #883.9
-        movl      %edi, %esi                                    #881.5
-        negl      %esi                                          #881.5
-        addl      $16, %esi                                     #881.5
-        lea       (%edx,%edi), %edx                             #881.5
-        andl      $15, %edx                                     #881.5
-        movl      %edx, %eax                                    #881.5
-        negl      %eax                                          #881.5
-        addl      $16, %eax                                     #881.5
-        cmpl      $0, %edx                                      #881.5
-        cmovne    %eax, %edx                                    #881.5
-        lea       16(%edx), %eax                                #881.5
-        cmpl      %eax, %esi                                    #881.5
-        jb        ..B19.42      # Prob 10%                      #881.5
-                                # LOE edx ebx esi edi
-..B19.19:                       # Preds ..B19.18
-        movl      %esi, %eax                                    #881.5
-        subl      %edx, %eax                                    #881.5
-        andl      $15, %eax                                     #881.5
-        negl      %eax                                          #881.5
-        addl      %esi, %eax                                    #881.5
-        testl     %edx, %edx                                    #881.5
-        jbe       ..B19.23      # Prob 1%                       #881.5
-                                # LOE eax edx ebx esi edi
-..B19.20:                       # Preds ..B19.19
-        movl      %edi, 4(%esp)                                 #
-        movl      %esi, (%esp)                                  #
-        movl      %ebx, 8(%esp)                                 #
-        movl      %edi, %ebx                                    #
-        lea       (%edx,%edi), %ecx                             #
-        movl      %ecx, 12(%esp)                                #
-        movl      %ecx, %esi                                    #
-                                # LOE eax edx ebx esi edi
-..B19.21:                       # Preds ..B19.21 ..B19.20
-        xorl      %ecx, %ecx                                    #883.9
-        movb      %cl, 16(%esp,%ebx)                            #883.9
-        movb      %cl, 32(%esp,%ebx)                            #884.9
-        addl      $1, %ebx                                      #881.5
-        cmpl      %esi, %ebx                                    #881.5
-        jb        ..B19.21      # Prob 99%                      #881.5
-                                # LOE eax edx ebx esi edi
-..B19.22:                       # Preds ..B19.21
-        movl      (%esp), %esi                                  #
-        movl      8(%esp), %ebx                                 #
-                                # LOE eax edx ebx esi edi
-..B19.23:                       # Preds ..B19.22 ..B19.19
-        lea       (%edx,%edi), %ecx                             #883.29
-        movl      %ecx, 12(%esp)                                #883.29
-        pxor      %xmm0, %xmm0                                  #883.29
-                                # LOE eax edx ecx ebx esi edi xmm0
-..B19.24:                       # Preds ..B19.24 ..B19.23
-        movdqa    %xmm0, 16(%esp,%ecx)                          #883.9
-        movdqa    %xmm0, 32(%esp,%ecx)                          #884.9
-        addl      $16, %ecx                                     #881.5
-        addl      $16, %edx                                     #881.5
-        cmpl      %eax, %edx                                    #881.5
-        jb        ..B19.24      # Prob 99%                      #881.5
-                                # LOE eax edx ecx ebx esi edi xmm0
-..B19.26:                       # Preds ..B19.24 ..B19.42
-        cmpl      %esi, %eax                                    #881.5
-        jae       ..B19.30      # Prob 1%                       #881.5
-                                # LOE eax ebx esi edi
-..B19.27:                       # Preds ..B19.26
-        addl      %eax, %edi                                    #
-                                # LOE eax ebx esi edi
-..B19.28:                       # Preds ..B19.28 ..B19.27
-        xorl      %edx, %edx                                    #883.9
-        movb      %dl, 16(%esp,%edi)                            #883.9
-        addl      $1, %eax                                      #881.5
-        movb      %dl, 32(%esp,%edi)                            #884.9
-        addl      $1, %edi                                      #881.5
-        cmpl      %esi, %eax                                    #881.5
-        jb        ..B19.28      # Prob 99%                      #881.5
-                                # LOE eax ebx esi edi
-..B19.30:                       # Preds ..B19.28 ..B19.26 ..B19.17
-        movl      48(%esp), %eax                                #890.10
-        testl     %eax, %eax                                    #890.10
-        je        ..B19.32      # Prob 50%                      #890.10
-                                # LOE ebx
-..B19.31:                       # Preds ..B19.30
-        movl      $9, (%ebx)                                    #892.9
-        jmp       ..B19.41      # Prob 100%                     #892.9
-                                # LOE ebx
-..B19.32:                       # Preds ..B19.30
-        movl      20(%ebp), %eax                                #896.22
-        cmpl      $2, %eax                                      #896.22
-        jae       ..B19.34      # Prob 50%                      #896.22
-                                # LOE ebx
-..B19.33:                       # Preds ..B19.32
-        movzbl    16(%esp), %eax                                #898.29
-        movl      $2, (%ebx)                                    #908.9
-        movb      %al, 17(%esp)                                 #898.9
-        movzwl    16(%esp), %esi                                #899.29
-        movzbl    32(%esp), %eax                                #903.26
-        movw      %si, 18(%esp)                                 #899.9
-        movl      16(%esp), %edx                                #900.29
-        movl      %edx, 20(%esp)                                #900.9
-        movl      16(%esp), %edi                                #901.29
-        movl      %edi, 24(%esp)                                #901.9
-        movl      %edx, 28(%esp)                                #901.9
-        movb      %al, 33(%esp)                                 #903.9
-        movzwl    32(%esp), %eax                                #904.26
-        movw      %ax, 34(%esp)                                 #904.9
-        movl      32(%esp), %edx                                #905.26
-        movl      %edx, 36(%esp)                                #905.9
-        movl      32(%esp), %eax                                #906.26
-        movl      %eax, 40(%esp)                                #906.9
-        movl      %edx, 44(%esp)                                #906.9
-        jmp       ..B19.41      # Prob 100%                     #906.9
-                                # LOE ebx
-..B19.34:                       # Preds ..B19.32
-        movl      20(%ebp), %eax                                #910.22
-        cmpl      $6, %eax                                      #910.22
-        jae       ..B19.36      # Prob 50%                      #910.22
-                                # LOE ebx
-..B19.35:                       # Preds ..B19.34
-        movzwl    16(%esp), %eax                                #912.29
-        movzwl    32(%esp), %edi                                #916.26
-        movl      $3, (%ebx)                                    #920.9
-        movw      %ax, 18(%esp)                                 #912.9
-        movl      16(%esp), %esi                                #913.29
-        movl      %esi, 20(%esp)                                #913.9
-        movl      16(%esp), %edx                                #914.29
-        movl      %edx, 24(%esp)                                #914.9
-        movl      %esi, 28(%esp)                                #914.9
-        movw      %di, 34(%esp)                                 #916.9
-        movl      32(%esp), %edx                                #917.26
-        movl      %edx, 36(%esp)                                #917.9
-        movl      32(%esp), %eax                                #918.26
-        movl      %eax, 40(%esp)                                #918.9
-        movl      %edx, 44(%esp)                                #918.9
-        jmp       ..B19.41      # Prob 100%                     #918.9
-                                # LOE ebx
-..B19.36:                       # Preds ..B19.34
-        movl      20(%ebp), %eax                                #922.22
-        cmpl      $14, %eax                                     #922.22
-        jae       ..B19.38      # Prob 50%                      #922.22
-                                # LOE ebx
-..B19.37:                       # Preds ..B19.36
-        movl      16(%esp), %edx                                #924.29
-        movl      32(%esp), %edi                                #927.26
-        movl      $4, (%ebx)                                    #930.9
-        movl      %edx, 20(%esp)                                #924.9
-        movl      16(%esp), %eax                                #925.29
-        movl      %eax, 24(%esp)                                #925.9
-        movl      %edx, 28(%esp)                                #925.9
-        movl      %edi, 36(%esp)                                #927.9
-        movl      32(%esp), %esi                                #928.26
-        movl      %esi, 40(%esp)                                #928.9
-        movl      %edi, 44(%esp)                                #928.9
-        jmp       ..B19.41      # Prob 100%                     #928.9
-                                # LOE ebx
-..B19.38:                       # Preds ..B19.36
-        movl      20(%ebp), %eax                                #932.22
-        cmpl      $30, %eax                                     #932.22
-        jae       ..B19.40      # Prob 50%                      #932.22
-                                # LOE ebx
-..B19.39:                       # Preds ..B19.38
-        movl      16(%esp), %eax                                #934.29
-        movl      20(%esp), %edx                                #934.29
-        movl      32(%esp), %esi                                #935.26
-        movl      36(%esp), %edi                                #935.26
-        movl      %eax, 24(%esp)                                #934.9
-        movl      $0, (%ebx)                                    #937.9
-        movl      %edx, 28(%esp)                                #934.9
-        movl      %esi, 40(%esp)                                #935.9
-        movl      %edi, 44(%esp)                                #935.9
-        jmp       ..B19.41      # Prob 100%                     #935.9
-                                # LOE ebx
-..B19.40:                       # Preds ..B19.38
-        movl      $5, (%ebx)                                    #941.9
-                                # LOE ebx
-..B19.41:                       # Preds ..B19.31 ..B19.33 ..B19.35 ..B19.37 ..B19.39
-                                #       ..B19.40
-        movl      16(%esp), %eax                                #944.42
-        movl      20(%esp), %esi                                #944.42
-        movl      24(%esp), %edi                                #944.42
-        lea       16(%esp), %ecx                                #948.5
-        movl      %eax, 16(%ebx)                                #944.42
-        movl      28(%esp), %eax                                #944.42
-        movl      %esi, 20(%ebx)                                #944.42
-        movl      %edi, 24(%ebx)                                #944.42
-        movl      %eax, 28(%ebx)                                #944.42
-        movl      32(%esp), %eax                                #945.39
-        movl      %eax, 32(%ebx)                                #945.39
-        movl      36(%esp), %eax                                #945.39
-        movl      %eax, 36(%ebx)                                #945.39
-        movl      40(%esp), %eax                                #945.39
-        movl      %eax, 40(%ebx)                                #945.39
-        movl      44(%esp), %eax                                #945.39
-        movl      %eax, 44(%ebx)                                #945.39
-# Begin ASM
-        mov (%ecx), %eax;mov 12(%ecx), %edx;bswap %eax;bswap %edx;mov %eax, 12(%ecx);mov %edx, (%ecx);mov 4(%ecx), %eax;mov 8(%ecx), %edx;bswap %eax;bswap %edx;mov %eax, 8(%ecx);mov %edx, 4(%ecx);
-# End ASM                                                       #948.5
-        lea       32(%esp), %ecx                                #949.5
-# Begin ASM
-        mov (%ecx), %eax;mov 12(%ecx), %edx;bswap %eax;bswap %edx;mov %eax, 12(%ecx);mov %edx, (%ecx);mov 4(%ecx), %eax;mov 8(%ecx), %edx;bswap %eax;bswap %edx;mov %eax, 8(%ecx);mov %edx, 4(%ecx);
-# End ASM                                                       #949.5
-        movl      $2, %ecx                                      #952.5
-        lea       16(%esp), %edx                                #952.5
-# Begin ASM
-        mov 4(%edx), %eax;shrd %cl, %eax, (%edx);mov 8(%edx), %eax;shrd %cl, %eax, 4(%edx);mov 12(%edx), %eax;shrd %cl, %eax, 8(%edx);shr %cl, %eax;mov %eax, 12(%edx);
-# End ASM                                                       #952.5
-        lea       32(%esp), %edx                                #953.5
-# Begin ASM
-        mov 4(%edx), %eax;shrd %cl, %eax, (%edx);mov 8(%edx), %eax;shrd %cl, %eax, 4(%edx);mov 12(%edx), %eax;shrd %cl, %eax, 8(%edx);shr %cl, %eax;mov %eax, 12(%edx);
-# End ASM                                                       #953.5
-        lea       48(%ebx), %ecx                                #956.5
-        lea       16(%esp), %edx                                #956.5
-# Begin ASM
-        push %ebx;mov (%edx), %eax;mov 12(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 12(%ecx);mov %ebx, (%ecx);mov 4(%edx), %eax;mov 8(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 8(%ecx);mov %ebx, 4(%ecx);pop %ebx;
-# End ASM                                                       #956.5
-        lea       64(%ebx), %ecx                                #957.5
-        lea       32(%esp), %edx                                #957.5
-# Begin ASM
-        push %ebx;mov (%edx), %eax;mov 12(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 12(%ecx);mov %ebx, (%ecx);mov 4(%edx), %eax;mov 8(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 8(%ecx);mov %ebx, 4(%ecx);pop %ebx;
-# End ASM                                                       #957.5
-        movl      $2, %ecx                                      #959.5
-        lea       16(%esp), %edx                                #959.5
-# Begin ASM
-        mov 4(%edx), %eax;shrd %cl, %eax, (%edx);mov 8(%edx), %eax;shrd %cl, %eax, 4(%edx);mov 12(%edx), %eax;shrd %cl, %eax, 8(%edx);shr %cl, %eax;mov %eax, 12(%edx);
-# End ASM                                                       #959.5
-        lea       32(%esp), %edx                                #960.5
-# Begin ASM
-        mov 4(%edx), %eax;shrd %cl, %eax, (%edx);mov 8(%edx), %eax;shrd %cl, %eax, 4(%edx);mov 12(%edx), %eax;shrd %cl, %eax, 8(%edx);shr %cl, %eax;mov %eax, 12(%edx);
-# End ASM                                                       #960.5
-        lea       80(%ebx), %ecx                                #962.5
-        lea       16(%esp), %edx                                #962.5
-# Begin ASM
-        push %ebx;mov (%edx), %eax;mov 12(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 12(%ecx);mov %ebx, (%ecx);mov 4(%edx), %eax;mov 8(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 8(%ecx);mov %ebx, 4(%ecx);pop %ebx;
-# End ASM                                                       #962.5
-        lea       96(%ebx), %ecx                                #963.5
-        lea       32(%esp), %edx                                #963.5
-# Begin ASM
-        push %ebx;mov (%edx), %eax;mov 12(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 12(%ecx);mov %ebx, (%ecx);mov 4(%edx), %eax;mov 8(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 8(%ecx);mov %ebx, 4(%ecx);pop %ebx;
-# End ASM                                                       #963.5
-        movl      $2, %ecx                                      #965.5
-        lea       16(%esp), %edx                                #965.5
-# Begin ASM
-        mov 4(%edx), %eax;shrd %cl, %eax, (%edx);mov 8(%edx), %eax;shrd %cl, %eax, 4(%edx);mov 12(%edx), %eax;shrd %cl, %eax, 8(%edx);shr %cl, %eax;mov %eax, 12(%edx);
-# End ASM                                                       #965.5
-        lea       32(%esp), %edx                                #966.5
-# Begin ASM
-        mov 4(%edx), %eax;shrd %cl, %eax, (%edx);mov 8(%edx), %eax;shrd %cl, %eax, 4(%edx);mov 12(%edx), %eax;shrd %cl, %eax, 8(%edx);shr %cl, %eax;mov %eax, 12(%edx);
-# End ASM                                                       #966.5
-        lea       112(%ebx), %ecx                               #968.5
-        lea       16(%esp), %edx                                #968.5
-# Begin ASM
-        push %ebx;mov (%edx), %eax;mov 12(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 12(%ecx);mov %ebx, (%ecx);mov 4(%edx), %eax;mov 8(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 8(%ecx);mov %ebx, 4(%ecx);pop %ebx;
-# End ASM                                                       #968.5
-        addl      $128, %ebx                                    #969.5
-        movl      %ebx, %ecx                                    #969.5
-        lea       32(%esp), %edx                                #969.5
-# Begin ASM
-        push %ebx;mov (%edx), %eax;mov 12(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 12(%ecx);mov %ebx, (%ecx);mov 4(%edx), %eax;mov 8(%edx), %ebx;bswap %eax;bswap %ebx;mov %eax, 8(%ecx);mov %ebx, 4(%ecx);pop %ebx;
-# End ASM                                                       #969.5
-        xorl      %eax, %eax                                    #1011.12
-        addl      $52, %esp                                     #1011.12
-        popl      %ebx                                          #1011.12
-        popl      %esi                                          #1011.12
-        popl      %edi                                          #1011.12
-        movl      %ebp, %esp                                    #1011.12
-        popl      %ebp                                          #1011.12
-        ret                                                     #1011.12
-                                # LOE
-..B19.42:                       # Preds ..B19.18                # Infreq
-        xorl      %eax, %eax                                    #881.5
-        jmp       ..B19.26      # Prob 100%                     #881.5
-                                # LOE eax ebx esi edi
-..B19.43:                       # Preds ..B19.8                 # Infreq
-        movl      %edi, %ecx                                    #862.32
-        shrl      $2, %ecx                                      #862.32
-        movb      $192, 32(%esp,%ecx)                           #863.13
-        shll      $6, %edx                                      #862.46
-        movb      %dl, 16(%esp,%ecx)                            #862.13
-        jmp       ..B19.15      # Prob 100%                     #862.13
-                                # LOE eax esi edi
-..B19.44:                       # Preds ..B19.6                 # Infreq
-        xorl      %edi, %edi                                    #
-        jmp       ..B19.17      # Prob 100%                     #
-                                # LOE ebx edi
-..B19.45:                       # Preds ..B19.4 ..B19.5         # Infreq
-        movl      12(%esp), %ebx                                #849.16
-        call      __errno_location at PLT                          #849.16
-                                # LOE eax
-..B19.49:                       # Preds ..B19.45                # Infreq
-        movl      (%eax), %eax                                  #849.16
-        addl      $52, %esp                                     #849.16
-        popl      %ebx                                          #849.16
-        popl      %esi                                          #849.16
-        popl      %edi                                          #849.16
-        movl      %ebp, %esp                                    #849.16
-        popl      %ebp                                          #849.16
-        ret                                                     #849.16
-        .align    2,0x90
-                                # LOE
-# mark_end;
-	.type	NucStrFastaExprMake2, at function
-	.size	NucStrFastaExprMake2,.-NucStrFastaExprMake2
-	.data
-# -- End  NucStrFastaExprMake2
-	.text
-# -- Begin  NucStrstrWhack
-# mark_begin;
-       .align    2,0x90
-	.globl NucStrstrWhack
-NucStrstrWhack:
-# parameter 1: 12 + %esp
-..B20.1:                        # Preds ..B20.0
-        pushl     %ebp                                          #1574.1
-        pushl     %ebx                                          #1574.1
-        movl      12(%esp), %ebp                                #1573.6
-        testl     %ebp, %ebp                                    #1575.18
-        je        ..B20.22      # Prob 12%                      #1575.18
-                                # LOE ebp esi edi
-..B20.2:                        # Preds ..B20.1
-        movl      (%ebp), %eax                                  #1577.18
-        call      ..L14         # Prob 100%                     #
-..L14:                                                          #
-        popl      %ebx                                          #
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L14], %ebx      #
-        cmpl      $12, %eax                                     #1577.9
-        ja        ..B20.21      # Prob 50%                      #1577.9
-                                # LOE eax ebx ebp esi edi
-..B20.3:                        # Preds ..B20.2
-        movl      ..1..TPKT.18_0.0.15 at GOTOFF(%ebx,%eax,4), %eax #1577.9
-        jmp       *%eax                                         #1577.9
-                                # LOE ebx ebp esi edi
-..1.18_0.TAG.0c.0.15:
-..B20.5:                        # Preds ..B20.3
-        pushl     8(%ebp)                                       #1601.30
-        call      NucStrstrWhack at PLT                            #1601.13
-                                # LOE ebx ebp esi edi
-..B20.25:                       # Preds ..B20.5
-        popl      %ecx                                          #1601.13
-        jmp       ..B20.21      # Prob 100%                     #1601.13
-                                # LOE ebx ebp esi edi
-..1.18_0.TAG.0b.0.15:
-..B20.7:                        # Preds ..B20.3
-        pushl     8(%ebp)                                       #1597.30
-        call      NucStrstrWhack at PLT                            #1597.13
-                                # LOE ebx ebp esi edi
-..B20.8:                        # Preds ..B20.7
-        pushl     12(%ebp)                                      #1598.30
-        call      NucStrstrWhack at PLT                            #1598.13
-                                # LOE ebx ebp esi edi
-..B20.26:                       # Preds ..B20.8
-        addl      $8, %esp                                      #1598.13
-        jmp       ..B20.21      # Prob 100%                     #1598.13
-                                # LOE ebx ebp esi edi
-..1.18_0.TAG.0a.0.15:
-..1.18_0.TAG.09.0.15:
-..1.18_0.TAG.08.0.15:
-..1.18_0.TAG.07.0.15:
-..1.18_0.TAG.06.0.15:
-..1.18_0.TAG.05.0.15:
-..1.18_0.TAG.04.0.15:
-..1.18_0.TAG.03.0.15:
-..1.18_0.TAG.02.0.15:
-..1.18_0.TAG.01.0.15:
-..1.18_0.TAG.00.0.15:
-..B20.20:                       # Preds ..B20.3 ..B20.3 ..B20.3 ..B20.3 ..B20.3
-                                #       ..B20.3 ..B20.3 ..B20.3 ..B20.3 ..B20.3
-                                #       ..B20.3
-        movl      8(%ebp), %ebp                                 #1593.20
-                                # LOE ebx ebp esi edi
-..B20.21:                       # Preds ..B20.26 ..B20.25 ..B20.20 ..B20.2
-        pushl     %ebp                                          #1604.9
-        call      free at PLT                                      #1604.9
-                                # LOE esi edi
-..B20.27:                       # Preds ..B20.21
-        popl      %ecx                                          #1604.9
-                                # LOE esi edi
-..B20.22:                       # Preds ..B20.27 ..B20.1
-        popl      %ebx                                          #1606.1
-        popl      %ebp                                          #1606.1
-        ret                                                     #1606.1
-        .align    2,0x90
-                                # LOE
-# mark_end;
-	.type	NucStrstrWhack, at function
-	.size	NucStrstrWhack,.-NucStrstrWhack
-	.section .data1, "wa"
-	.align 4
-..1..TPKT.18_0.0.15:
-	.long	..1.18_0.TAG.00.0.15
-	.long	..1.18_0.TAG.01.0.15
-	.long	..1.18_0.TAG.02.0.15
-	.long	..1.18_0.TAG.03.0.15
-	.long	..1.18_0.TAG.04.0.15
-	.long	..1.18_0.TAG.05.0.15
-	.long	..1.18_0.TAG.06.0.15
-	.long	..1.18_0.TAG.07.0.15
-	.long	..1.18_0.TAG.08.0.15
-	.long	..1.18_0.TAG.09.0.15
-	.long	..1.18_0.TAG.0a.0.15
-	.long	..1.18_0.TAG.0b.0.15
-	.long	..1.18_0.TAG.0c.0.15
-	.data
-# -- End  NucStrstrWhack
-	.text
-# -- Begin  NucStrstrInit
-# mark_begin;
-       .align    2,0x90
-NucStrstrInit:
-..B21.1:                        # Preds ..B21.0
-        pushl     %edi                                          #1484.1
-        pushl     %esi                                          #1484.1
-        pushl     %ebp                                          #1484.1
-        pushl     %ebx                                          #1484.1
-        subl      $12, %esp                                     #1484.1
-        movl      $-1, %edx                                     #1491.5
-        call      ..L15         # Prob 100%                     #1484.1
-..L15:                                                          #
-        popl      %ebx                                          #1484.1
-        addl      $_GLOBAL_OFFSET_TABLE_+[. - ..L15], %ebx      #1484.1
-        lea       fasta_2na_map.0 at GOTOFF(%ebx), %eax            #1491.14
-        movd      %edx, %xmm0                                   #1491.5
-        pshufd    $0, %xmm0, %xmm1                              #1491.5
-        movq      %xmm1, (%eax)                                 #1491.5
-        movq      %xmm1, 8(%eax)                                #1491.5
-        movq      %xmm1, 16(%eax)                               #1491.5
-        movq      %xmm1, 24(%eax)                               #1491.5
-        movq      %xmm1, 32(%eax)                               #1491.5
-        movq      %xmm1, 40(%eax)                               #1491.5
-        movq      %xmm1, 48(%eax)                               #1491.5
-        movq      %xmm1, 56(%eax)                               #1491.5
-        movq      %xmm1, 64(%eax)                               #1491.5
-        movq      %xmm1, 72(%eax)                               #1491.5
-        movq      %xmm1, 80(%eax)                               #1491.5
-        movq      %xmm1, 88(%eax)                               #1491.5
-        movq      %xmm1, 96(%eax)                               #1491.5
-        movq      %xmm1, 104(%eax)                              #1491.5
-        movq      %xmm1, 112(%eax)                              #1491.5
-        movq      %xmm1, 120(%eax)                              #1491.5
-                                # LOE eax ebx edi
-..B21.2:                        # Preds ..B21.1
-        lea       fasta_4na_map.0 at GOTOFF(%ebx), %ecx            #1492.14
-        movl      $-1, %edx                                     #1492.5
-        movd      %edx, %xmm0                                   #1492.5
-        pshufd    $0, %xmm0, %xmm1                              #1492.5
-        movq      %xmm1, (%ecx)                                 #1492.5
-        movq      %xmm1, 8(%ecx)                                #1492.5
-        movq      %xmm1, 16(%ecx)                               #1492.5
-        movq      %xmm1, 24(%ecx)                               #1492.5
-        movq      %xmm1, 32(%ecx)                               #1492.5
-        movq      %xmm1, 40(%ecx)                               #1492.5
-        movq      %xmm1, 48(%ecx)                               #1492.5
-        movq      %xmm1, 56(%ecx)                               #1492.5
-        movq      %xmm1, 64(%ecx)                               #1492.5
-        movq      %xmm1, 72(%ecx)                               #1492.5
-        movq      %xmm1, 80(%ecx)                               #1492.5
-        movq      %xmm1, 88(%ecx)                               #1492.5
-        movq      %xmm1, 96(%ecx)                               #1492.5
-        movq      %xmm1, 104(%ecx)                              #1492.5
-        movq      %xmm1, 112(%ecx)                              #1492.5
-        movq      %xmm1, 120(%ecx)                              #1492.5
-                                # LOE eax ecx ebx edi
-..B21.3:                        # Preds ..B21.2
-        lea       _2__STRING.0.0 at GOTOFF(%ebx), %esi             #1487.29
-        movsbl    (%esi), %ebp                                  #1497.14
-        movl      %ecx, 4(%esp)                                 #
-        movl      %eax, 8(%esp)                                 #
-        xorl      %edx, %edx                                    #
-                                # LOE edx ebx ebp esi
-..B21.10:                       # Preds ..B21.3 ..B21.11
-        pushl     %ebp                                          #1497.9
-        movl      %edx, 4(%esp)                                 #1498.48
-        call      tolower at PLT                                   #1498.48
-                                # LOE eax ebx ebp esi
-..B21.29:                       # Preds ..B21.10
-        movl      4(%esp), %edx                                 #
-        addl      $4, %esp                                      #1498.48
-                                # LOE eax edx ebx ebp esi dl dh
-..B21.11:                       # Preds ..B21.29
-        movl      8(%esp), %ecx                                 #1498.32
-        movb      %dl, (%eax,%ecx)                              #1498.32
-        movb      %dl, (%ecx,%ebp)                              #1498.9
-        movsbl    1(%esi), %ebp                                 #1495.31
-        addl      $1, %edx                                      #1495.48
-        addl      $1, %esi                                      #1495.54
-        testl     %ebp, %ebp                                    #1495.42
-        jne       ..B21.10      # Prob 82%                      #1495.42
-                                # LOE edx ebx ebp esi
-..B21.12:                       # Preds ..B21.11
-        movl      4(%esp), %ecx                                 #
-        lea       _2__STRING.1.0 at GOTOFF(%ebx), %esi             #1488.25
-        movsbl    (%esi), %ebp                                  #1504.14
-        movl      %ecx, 4(%esp)                                 #
-        xorl      %edx, %edx                                    #
-                                # LOE edx ebx ebp esi
-..B21.19:                       # Preds ..B21.12 ..B21.20
-        pushl     %ebp                                          #1504.9
-        movl      %edx, 4(%esp)                                 #1505.48
-        call      tolower at PLT                                   #1505.48
-                                # LOE eax ebx ebp esi
-..B21.30:                       # Preds ..B21.19
-        movl      4(%esp), %edx                                 #
-        addl      $4, %esp                                      #1505.48
-                                # LOE eax edx ebx ebp esi dl dh
-..B21.20:                       # Preds ..B21.30
-        movl      4(%esp), %ecx                                 #1505.32
-        movb      %dl, (%eax,%ecx)                              #1505.32
-        movb      %dl, (%ecx,%ebp)                              #1505.9
-        movsbl    1(%esi), %ebp                                 #1502.31
-        addl      $1, %edx                                      #1502.48
-        addl      $1, %esi                                      #1502.54
-        testl     %ebp, %ebp                                    #1502.42
-        jne       ..B21.19      # Prob 82%                      #1502.42
-                                # LOE edx ebx ebp esi
-..B21.21:                       # Preds ..B21.20
-        lea       512(%ebx), %eax                               #1510.11
-                                # LOE eax ebx edi
-..B21.22:                       # Preds ..B21.25 ..B21.21
-        movzwl    expand_2na.0 at GOTOFF(%ebx), %edx               #1511.28
-                                # LOE eax edx ebx edi
-..B21.24:                       # Preds ..B21.22
-# Begin ASM
-        rorw $8, %dx
-# End ASM                                                       #1511.0
-                                # LOE eax edx ebx edi
-..B21.25:                       # Preds ..B21.24
-        movw      %dx, expand_2na.0 at GOTOFF(%ebx)                #1511.9
-        addl      $2, %ebx                                      #1510.30
-        cmpl      %ebx, %eax                                    #1510.22
-        ja        ..B21.22      # Prob 99%                      #1510.22
-                                # LOE eax ebx edi
-..B21.26:                       # Preds ..B21.25
-        addl      $12, %esp                                     #1513.1
-        popl      %ebx                                          #1513.1
-        popl      %ebp                                          #1513.1
-        popl      %esi                                          #1513.1
-        popl      %edi                                          #1513.1
-        ret                                                     #1513.1
-        .align    2,0x90
-                                # LOE
-# mark_end;
-	.type	NucStrstrInit, at function
-	.size	NucStrstrInit,.-NucStrstrInit
-	.data
-# -- End  NucStrstrInit
-	.bss
-	.align 32
-	.align 32
-fasta_2na_map.0:
-	.type	fasta_2na_map.0, at object
-	.size	fasta_2na_map.0,128
-	.space 128	# pad
-fasta_4na_map.0:
-	.type	fasta_4na_map.0, at object
-	.size	fasta_4na_map.0,128
-	.space 128	# pad
-	.data
-	.align 32
-	.align 32
-expand_2na.0:
-	.word	4369
-	.word	4370
-	.word	4372
-	.word	4376
-	.word	4385
-	.word	4386
-	.word	4388
-	.word	4392
-	.word	4417
-	.word	4418
-	.word	4420
-	.word	4424
-	.word	4481
-	.word	4482
-	.word	4484
-	.word	4488
-	.word	4625
-	.word	4626
-	.word	4628
-	.word	4632
-	.word	4641
-	.word	4642
-	.word	4644
-	.word	4648
-	.word	4673
-	.word	4674
-	.word	4676
-	.word	4680
-	.word	4737
-	.word	4738
-	.word	4740
-	.word	4744
-	.word	5137
-	.word	5138
-	.word	5140
-	.word	5144
-	.word	5153
-	.word	5154
-	.word	5156
-	.word	5160
-	.word	5185
-	.word	5186
-	.word	5188
-	.word	5192
-	.word	5249
-	.word	5250
-	.word	5252
-	.word	5256
-	.word	6161
-	.word	6162
-	.word	6164
-	.word	6168
-	.word	6177
-	.word	6178
-	.word	6180
-	.word	6184
-	.word	6209
-	.word	6210
-	.word	6212
-	.word	6216
-	.word	6273
-	.word	6274
-	.word	6276
-	.word	6280
-	.word	8465
-	.word	8466
-	.word	8468
-	.word	8472
-	.word	8481
-	.word	8482
-	.word	8484
-	.word	8488
-	.word	8513
-	.word	8514
-	.word	8516
-	.word	8520
-	.word	8577
-	.word	8578
-	.word	8580
-	.word	8584
-	.word	8721
-	.word	8722
-	.word	8724
-	.word	8728
-	.word	8737
-	.word	8738
-	.word	8740
-	.word	8744
-	.word	8769
-	.word	8770
-	.word	8772
-	.word	8776
-	.word	8833
-	.word	8834
-	.word	8836
-	.word	8840
-	.word	9233
-	.word	9234
-	.word	9236
-	.word	9240
-	.word	9249
-	.word	9250
-	.word	9252
-	.word	9256
-	.word	9281
-	.word	9282
-	.word	9284
-	.word	9288
-	.word	9345
-	.word	9346
-	.word	9348
-	.word	9352
-	.word	10257
-	.word	10258
-	.word	10260
-	.word	10264
-	.word	10273
-	.word	10274
-	.word	10276
-	.word	10280
-	.word	10305
-	.word	10306
-	.word	10308
-	.word	10312
-	.word	10369
-	.word	10370
-	.word	10372
-	.word	10376
-	.word	16657
-	.word	16658
-	.word	16660
-	.word	16664
-	.word	16673
-	.word	16674
-	.word	16676
-	.word	16680
-	.word	16705
-	.word	16706
-	.word	16708
-	.word	16712
-	.word	16769
-	.word	16770
-	.word	16772
-	.word	16776
-	.word	16913
-	.word	16914
-	.word	16916
-	.word	16920
-	.word	16929
-	.word	16930
-	.word	16932
-	.word	16936
-	.word	16961
-	.word	16962
-	.word	16964
-	.word	16968
-	.word	17025
-	.word	17026
-	.word	17028
-	.word	17032
-	.word	17425
-	.word	17426
-	.word	17428
-	.word	17432
-	.word	17441
-	.word	17442
-	.word	17444
-	.word	17448
-	.word	17473
-	.word	17474
-	.word	17476
-	.word	17480
-	.word	17537
-	.word	17538
-	.word	17540
-	.word	17544
-	.word	18449
-	.word	18450
-	.word	18452
-	.word	18456
-	.word	18465
-	.word	18466
-	.word	18468
-	.word	18472
-	.word	18497
-	.word	18498
-	.word	18500
-	.word	18504
-	.word	18561
-	.word	18562
-	.word	18564
-	.word	18568
-	.word	33041
-	.word	33042
-	.word	33044
-	.word	33048
-	.word	33057
-	.word	33058
-	.word	33060
-	.word	33064
-	.word	33089
-	.word	33090
-	.word	33092
-	.word	33096
-	.word	33153
-	.word	33154
-	.word	33156
-	.word	33160
-	.word	33297
-	.word	33298
-	.word	33300
-	.word	33304
-	.word	33313
-	.word	33314
-	.word	33316
-	.word	33320
-	.word	33345
-	.word	33346
-	.word	33348
-	.word	33352
-	.word	33409
-	.word	33410
-	.word	33412
-	.word	33416
-	.word	33809
-	.word	33810
-	.word	33812
-	.word	33816
-	.word	33825
-	.word	33826
-	.word	33828
-	.word	33832
-	.word	33857
-	.word	33858
-	.word	33860
-	.word	33864
-	.word	33921
-	.word	33922
-	.word	33924
-	.word	33928
-	.word	34833
-	.word	34834
-	.word	34836
-	.word	34840
-	.word	34849
-	.word	34850
-	.word	34852
-	.word	34856
-	.word	34881
-	.word	34882
-	.word	34884
-	.word	34888
-	.word	34945
-	.word	34946
-	.word	34948
-	.word	34952
-	.type	expand_2na.0, at object
-	.size	expand_2na.0,512
-	.section .rodata.str1.4, "aMS", at progbits,1
-	.align 4
-	.align 4
-_2__STRING.0.0:
-	.byte	65
-	.byte	67
-	.byte	71
-	.byte	84
-	.byte	0
-	.type	_2__STRING.0.0, at object
-	.size	_2__STRING.0.0,5
-	.space 3	# pad
-_2__STRING.1.0:
-	.byte	45
-	.byte	65
-	.byte	67
-	.byte	77
-	.byte	71
-	.byte	82
-	.byte	83
-	.byte	86
-	.byte	84
-	.byte	87
-	.byte	89
-	.byte	72
-	.byte	75
-	.byte	68
-	.byte	66
-	.byte	78
-	.byte	0
-	.type	_2__STRING.1.0, at object
-	.size	_2__STRING.1.0,17
-	.data
-	.section .note.GNU-stack, ""
-# End
diff --git a/libs/search/nucstrstr-icc-x86_64-dbg.pic.s b/libs/search/nucstrstr-icc-x86_64-dbg.pic.s
deleted file mode 100644
index 973e6b2..0000000
--- a/libs/search/nucstrstr-icc-x86_64-dbg.pic.s
+++ /dev/null
@@ -1,25447 +0,0 @@
-	.section .text
-.LNDBG_TX:
-# -- Machine type EFI2
-# mark_description "Intel(R) C++ Compiler Professional for applications running on Intel(R) 64, Version 11.0    Build 20090131 %";
-# mark_description "s";
-# mark_description "-I/home/yaschenk/devel/internal/asm-trace/sra/search/linux -I/home/yaschenk/devel/internal/asm-trace/sra/sea";
-# mark_description "rch/unix -I/home/yaschenk/devel/internal/asm-trace/sra/search -I/home/yaschenk/devel/internal/asm-trace/itf ";
-# mark_description "-I/home/yaschenk/devel/internal/asm-trace/inc/icc/x86_64 -I/home/yaschenk/devel/internal/asm-trace/inc/icc -";
-# mark_description "I/home/yaschenk/devel/internal/asm-trace/inc/gcc/x86_64 -I/home/yaschenk/devel/internal/asm-trace/inc/gcc -I";
-# mark_description "/home/yaschenk/devel/internal/asm-trace/inc/linux -I/home/yaschenk/devel/internal/asm-trace/inc/unix -I/home";
-# mark_description "/yaschenk/devel/internal/asm-trace/inc -c -S -o nucstrstr.pic.s -fPIC -g -Wall -D_DEBUGGING -DLINUX -DUNIX -";
-# mark_description "D_GNU_SOURCE -D_REENTRANT -D_FILE_OFFSET_BITS=64 -MD";
-	.text
-..TXTST0:
-# -- Begin  uint16_lsbit
-# mark_begin;
-       .align    2,0x90
-uint16_lsbit:
-# parameter 1(self): %edi
-..B1.1:                         # Preds ..B1.0
-..___tag_value_uint16_lsbit.2:                                  #
-..LN1:
-        pushq     %rbp                                          #38.1
-        movq      %rsp, %rbp                                    #38.1
-..___tag_value_uint16_lsbit.3:                                  #
-        subq      $16, %rsp                                     #38.1
-        movw      %di, -8(%rbp)                                 #38.1
-..LN3:
-        movzwl    -8(%rbp), %eax                                #40.0
-# Begin ASM
-        bsf %ax, %ax;jnz .+6;xor %eax, %eax;dec %eax;
-# End ASM                                                       #40.0
-        movw      %ax, -16(%rbp)                                #40.0
-..LN5:
-        movswl    -16(%rbp), %eax                               #49.12
-        leave                                                   #49.12
-..___tag_value_uint16_lsbit.7:                                  #
-        ret                                                     #49.12
-        .align    2,0x90
-..___tag_value_uint16_lsbit.8:                                  #
-                                # LOE
-# mark_end;
-	.type	uint16_lsbit, at function
-	.size	uint16_lsbit,.-uint16_lsbit
-.LNuint16_lsbit:
-	.data
-# -- End  uint16_lsbit
-	.text
-# -- Begin  uint128_shr
-# mark_begin;
-       .align    2,0x90
-uint128_shr:
-# parameter 1(self): %rdi
-# parameter 2(i): %esi
-..B2.1:                         # Preds ..B2.0
-..___tag_value_uint128_shr.11:                                  #
-..LN7:
-        pushq     %rbp                                          #262.1
-        movq      %rsp, %rbp                                    #262.1
-..___tag_value_uint128_shr.12:                                  #
-        subq      $16, %rsp                                     #262.1
-        movq      %rdi, -16(%rbp)                               #262.1
-        movl      %esi, -8(%rbp)                                #262.1
-..LN9:
-        movq      -16(%rbp), %rdi                               #263.0
-        movl      -8(%rbp), %esi                                #263.0
-        movl      %esi, %ecx                                    #263.0
-        movq      8(%rdi), %rax                                 #263.0
-        shrdq     %cl, %rax, (%rdi)                             #263.0
-        shrq      %cl, %rax                                     #263.0
-        movq      %rax, 8(%rdi)                                 #263.0
-..LN11:
-        leave                                                   #274.1
-..___tag_value_uint128_shr.16:                                  #
-        ret                                                     #274.1
-        .align    2,0x90
-..___tag_value_uint128_shr.17:                                  #
-                                # LOE
-# mark_end;
-	.type	uint128_shr, at function
-	.size	uint128_shr,.-uint128_shr
-.LNuint128_shr:
-	.data
-# -- End  uint128_shr
-	.text
-# -- Begin  uint128_bswap
-# mark_begin;
-       .align    2,0x90
-uint128_bswap:
-# parameter 1(self): %rdi
-..B3.1:                         # Preds ..B3.0
-..___tag_value_uint128_bswap.20:                                #
-..LN13:
-        pushq     %rbp                                          #294.1
-        movq      %rsp, %rbp                                    #294.1
-..___tag_value_uint128_bswap.21:                                #
-        subq      $16, %rsp                                     #294.1
-        movq      %rdi, -16(%rbp)                               #294.1
-..LN15:
-        movq      -16(%rbp), %rdi                               #295.0
-        movq      (%rdi), %rax                                  #295.0
-        movq      8(%rdi), %rcx                                 #295.0
-        bswap     %rax                                          #295.0
-        bswap     %rcx                                          #295.0
-        movq      %rax, 8(%rdi)                                 #295.0
-        movq      %rcx, (%rdi)                                  #295.0
-..LN17:
-        leave                                                   #307.1
-..___tag_value_uint128_bswap.25:                                #
-        ret                                                     #307.1
-        .align    2,0x90
-..___tag_value_uint128_bswap.26:                                #
-                                # LOE
-# mark_end;
-	.type	uint128_bswap, at function
-	.size	uint128_bswap,.-uint128_bswap
-.LNuint128_bswap:
-	.data
-# -- End  uint128_bswap
-	.text
-# -- Begin  uint128_bswap_copy
-# mark_begin;
-       .align    2,0x90
-uint128_bswap_copy:
-# parameter 1(to): %rdi
-# parameter 2(from): %rsi
-..B4.1:                         # Preds ..B4.0
-..___tag_value_uint128_bswap_copy.29:                           #
-..LN19:
-        pushq     %rbp                                          #311.1
-        movq      %rsp, %rbp                                    #311.1
-..___tag_value_uint128_bswap_copy.30:                           #
-        subq      $16, %rsp                                     #311.1
-        movq      %rdi, -16(%rbp)                               #311.1
-        movq      %rsi, -8(%rbp)                                #311.1
-..LN21:
-        movq      -16(%rbp), %rdi                               #312.0
-        movq      -8(%rbp), %rsi                                #312.0
-        movq      (%rsi), %rax                                  #312.0
-        movq      8(%rsi), %rcx                                 #312.0
-        bswap     %rax                                          #312.0
-        bswap     %rcx                                          #312.0
-        movq      %rax, 8(%rdi)                                 #312.0
-        movq      %rcx, (%rdi)                                  #312.0
-..LN23:
-        leave                                                   #324.1
-..___tag_value_uint128_bswap_copy.34:                           #
-        ret                                                     #324.1
-        .align    2,0x90
-..___tag_value_uint128_bswap_copy.35:                           #
-                                # LOE
-# mark_end;
-	.type	uint128_bswap_copy, at function
-	.size	uint128_bswap_copy,.-uint128_bswap_copy
-.LNuint128_bswap_copy:
-	.data
-# -- End  uint128_bswap_copy
-	.text
-# -- Begin  NucStrFastaExprAlloc
-# mark_begin;
-       .align    2,0x90
-NucStrFastaExprAlloc:
-# parameter 1(sz): %rdi
-..B5.1:                         # Preds ..B5.0
-..___tag_value_NucStrFastaExprAlloc.38:                         #
-..LN25:
-        pushq     %rbp                                          #790.1
-        movq      %rsp, %rbp                                    #790.1
-..___tag_value_NucStrFastaExprAlloc.39:                         #
-        subq      $32, %rsp                                     #790.1
-        movq      %rdi, -24(%rbp)                               #790.1
-..LN27:
-        movq      -24(%rbp), %rax                               #791.28
-..LN29:
-        addq      $16, %rax                                     #791.33
-..LN31:
-        movq      %rax, %rdi                                    #791.19
-        call      malloc at PLT                                    #791.19
-                                # LOE rax
-..B5.11:                        # Preds ..B5.1
-        movq      %rax, -8(%rbp)                                #791.19
-                                # LOE
-..B5.2:                         # Preds ..B5.11
-..LN33:
-        movq      -8(%rbp), %rax                                #791.17
-        movq      %rax, -16(%rbp)                               #791.17
-..LN35:
-        movq      -16(%rbp), %rax                               #792.10
-..LN37:
-        testq     %rax, %rax                                    #792.19
-        je        ..B5.8        # Prob 50%                      #792.19
-                                # LOE
-..B5.3:                         # Preds ..B5.2
-..LN39:
-        movq      -16(%rbp), %rax                               #795.28
-..LN41:
-        addq      $15, %rax                                     #795.36
-..LN43:
-        andq      $-16, %rax                                    #795.43
-..LN45:
-        movq      %rax, -32(%rbp)                               #794.28
-..LN47:
-        movq      -32(%rbp), %rax                               #796.9
-..LN49:
-        movq      -16(%rbp), %rdx                               #796.26
-..LN51:
-        movq      %rdx, 8(%rax)                                 #796.9
-..LN53:
-        movq      -32(%rbp), %rax                               #797.9
-        addq      $16, %rax                                     #797.9
-        testq     $15, %rax                                     #797.9
-        je        ..B5.5        # Prob 50%                      #797.9
-                                # LOE
-..B5.4:                         # Preds ..B5.3
-        lea       _2__STRING.0.0(%rip), %rax                    #797.9
-        lea       _2__STRING.1.0(%rip), %rdx                    #797.9
-        lea       __$U0.0(%rip), %rcx                           #797.9
-        movq      %rax, %rdi                                    #797.9
-        movq      %rdx, %rsi                                    #797.9
-        movl      $797, %edx                                    #797.9
-        call      __assert_fail at PLT                             #797.9
-                                # LOE
-..B5.5:                         # Preds ..B5.3
-..LN55:
-        movq      -32(%rbp), %rax                               #798.9
-        addq      $32, %rax                                     #798.9
-        testq     $15, %rax                                     #798.9
-        je        ..B5.7        # Prob 50%                      #798.9
-                                # LOE
-..B5.6:                         # Preds ..B5.5
-        lea       _2__STRING.2.0(%rip), %rax                    #798.9
-        lea       _2__STRING.1.0(%rip), %rdx                    #798.9
-        lea       __$U0.0(%rip), %rcx                           #798.9
-        movq      %rax, %rdi                                    #798.9
-        movq      %rdx, %rsi                                    #798.9
-        movl      $798, %edx                                    #798.9
-        call      __assert_fail at PLT                             #798.9
-                                # LOE
-..B5.7:                         # Preds ..B5.5
-..LN57:
-        movq      -32(%rbp), %rax                               #799.16
-        leave                                                   #799.16
-..___tag_value_NucStrFastaExprAlloc.43:                         #
-        ret                                                     #799.16
-..___tag_value_NucStrFastaExprAlloc.44:                         #
-                                # LOE
-..B5.8:                         # Preds ..B5.2
-..LN59:
-        xorl      %eax, %eax                                    #801.12
-        leave                                                   #801.12
-..___tag_value_NucStrFastaExprAlloc.46:                         #
-        ret                                                     #801.12
-        .align    2,0x90
-..___tag_value_NucStrFastaExprAlloc.47:                         #
-                                # LOE
-# mark_end;
-	.type	NucStrFastaExprAlloc, at function
-	.size	NucStrFastaExprAlloc,.-NucStrFastaExprAlloc
-.LNNucStrFastaExprAlloc:
-	.data
-# -- End  NucStrFastaExprAlloc
-	.text
-# -- Begin  NucStrFastaExprMake2
-# mark_begin;
-       .align    2,0x90
-NucStrFastaExprMake2:
-# parameter 1(expr): %rdi
-# parameter 2(positional): %esi
-# parameter 3(fasta): %rdx
-# parameter 4(size): %rcx
-..B6.1:                         # Preds ..B6.0
-..___tag_value_NucStrFastaExprMake2.50:                         #
-..LN61:
-        pushq     %rbp                                          #838.1
-        movq      %rsp, %rbp                                    #838.1
-..___tag_value_NucStrFastaExprMake2.51:                         #
-        subq      $112, %rsp                                    #838.1
-        movq      %rdi, -48(%rbp)                               #838.1
-        movl      %esi, -16(%rbp)                               #838.1
-        movq      %rdx, -40(%rbp)                               #838.1
-        movq      %rcx, -32(%rbp)                               #838.1
-..LN63:
-        movq      -32(%rbp), %rax                               #844.10
-..LN65:
-        cmpq      $61, %rax                                     #844.17
-        jbe       ..B6.3        # Prob 50%                      #844.17
-                                # LOE
-..B6.2:                         # Preds ..B6.1
-..LN67:
-        movl      $7, %eax                                      #845.16
-        leave                                                   #845.16
-..___tag_value_NucStrFastaExprMake2.55:                         #
-        ret                                                     #845.16
-..___tag_value_NucStrFastaExprMake2.56:                         #
-                                # LOE
-..B6.3:                         # Preds ..B6.1
-..LN69:
-        movl      $144, %edi                                    #847.9
-        call      NucStrFastaExprAlloc at PLT                      #847.9
-                                # LOE rax
-..B6.48:                        # Preds ..B6.3
-        movq      %rax, -56(%rbp)                               #847.9
-                                # LOE
-..B6.4:                         # Preds ..B6.48
-..LN71:
-        movq      -56(%rbp), %rax                               #847.5
-        movq      %rax, -64(%rbp)                               #847.5
-..LN73:
-        movq      -64(%rbp), %rax                               #848.10
-..LN75:
-        testq     %rax, %rax                                    #848.15
-        jne       ..B6.6        # Prob 50%                      #848.15
-                                # LOE
-..B6.5:                         # Preds ..B6.4
-..LN77:
-        call      __errno_location at PLT                          #849.16
-                                # LOE rax
-..B6.49:                        # Preds ..B6.5
-        movl      (%rax), %eax                                  #849.16
-        leave                                                   #849.16
-..___tag_value_NucStrFastaExprMake2.58:                         #
-        ret                                                     #849.16
-..___tag_value_NucStrFastaExprMake2.59:                         #
-                                # LOE
-..B6.6:                         # Preds ..B6.4
-..LN79:
-        movq      -48(%rbp), %rax                               #851.5
-..LN81:
-        movq      -64(%rbp), %rdx                               #851.14
-..LN83:
-        movq      %rdx, (%rax)                                  #851.5
-..LN85:
-        movq      -32(%rbp), %rax                               #852.38
-..LN87:
-        movq      -64(%rbp), %rdx                               #852.5
-        movl      %eax, 4(%rdx)                                 #852.5
-..LN89:
-        movq      $0, -80(%rbp)                                 #856.11
-..LN91:
-        movq      -80(%rbp), %rax                               #856.18
-..LN93:
-        movq      -32(%rbp), %rdx                               #856.22
-        cmpq      %rdx, %rax                                    #856.22
-        jb        ..B6.9        # Prob 50%                      #856.22
-        jmp       ..B6.17       # Prob 100%                     #856.22
-                                # LOE
-..B6.7:                         # Preds ..B6.13 ..B6.14 ..B6.15 ..B6.16 ..B6.12
-                                #      
-..LN95:
-        incq      -80(%rbp)                                     #856.31
-..LN97:
-        movq      -80(%rbp), %rax                               #856.18
-..LN99:
-        movq      -32(%rbp), %rdx                               #856.22
-        cmpq      %rdx, %rax                                    #856.22
-        jae       ..B6.17       # Prob 50%                      #856.22
-                                # LOE
-..B6.9:                         # Preds ..B6.6 ..B6.7
-..LN101:
-        movq      -40(%rbp), %rax                               #858.48
-..LN103:
-        movq      -80(%rbp), %rdx                               #858.56
-..LN105:
-        movzbl    (%rdx,%rax), %eax                             #858.48
-        movsbq    %al, %rax                                     #858.48
-..LN107:
-        movslq    %eax, %rax                                    #858.24
-        lea       fasta_2na_map.0(%rip), %rdx                   #858.24
-        movzbl    (%rax,%rdx), %eax                             #858.24
-        movsbq    %al, %rax                                     #858.24
-..LN109:
-        movb      %al, -24(%rbp)                                #858.22
-..LN111:
-        movq      -80(%rbp), %rax                               #859.18
-..LN113:
-        andq      $3, %rax                                      #859.22
-        movq      %rax, -72(%rbp)                               #859.22
-        je        ..B6.13       # Prob 50%                      #859.22
-                                # LOE
-..B6.10:                        # Preds ..B6.9
-        movq      -72(%rbp), %rax                               #859.22
-        cmpq      $1, %rax                                      #859.22
-        je        ..B6.14       # Prob 50%                      #859.22
-                                # LOE
-..B6.11:                        # Preds ..B6.10
-        movq      -72(%rbp), %rax                               #859.22
-        cmpq      $2, %rax                                      #859.22
-        je        ..B6.15       # Prob 50%                      #859.22
-                                # LOE
-..B6.12:                        # Preds ..B6.11
-        movq      -72(%rbp), %rax                               #859.22
-        cmpq      $3, %rax                                      #859.22
-        je        ..B6.16       # Prob 50%                      #859.22
-        jmp       ..B6.7        # Prob 100%                     #859.22
-                                # LOE
-..B6.13:                        # Preds ..B6.9
-..LN115:
-        movzbl    -24(%rbp), %eax                               #862.38
-..LN117:
-        shll      $6, %eax                                      #862.46
-..LN119:
-        movq      -80(%rbp), %rdx                               #862.27
-..LN121:
-        shrq      $2, %rdx                                      #862.32
-..LN123:
-        movb      %al, -112(%rbp,%rdx)                          #862.13
-..LN125:
-        movq      -80(%rbp), %rax                               #863.24
-..LN127:
-        shrq      $2, %rax                                      #863.29
-..LN129:
-        movb      $192, -96(%rbp,%rax)                          #863.13
-        jmp       ..B6.7        # Prob 100%                     #863.13
-                                # LOE
-..B6.14:                        # Preds ..B6.10
-..LN131:
-        movq      -80(%rbp), %rax                               #866.27
-..LN133:
-        shrq      $2, %rax                                      #866.32
-..LN135:
-        movzbl    -112(%rbp,%rax), %eax                         #866.13
-..LN137:
-        movzbl    -24(%rbp), %edx                               #866.39
-..LN139:
-        shll      $4, %edx                                      #866.47
-..LN141:
-        orl       %edx, %eax                                    #866.13
-..LN143:
-        movq      -80(%rbp), %rdx                               #866.27
-..LN145:
-        shrq      $2, %rdx                                      #866.32
-..LN147:
-        movb      %al, -112(%rbp,%rdx)                          #866.13
-..LN149:
-        movq      -80(%rbp), %rax                               #867.24
-..LN151:
-        shrq      $2, %rax                                      #867.29
-..LN153:
-        movzbl    -96(%rbp,%rax), %eax                          #867.13
-        orl       $48, %eax                                     #867.13
-..LN155:
-        movq      -80(%rbp), %rdx                               #867.24
-..LN157:
-        shrq      $2, %rdx                                      #867.29
-..LN159:
-        movb      %al, -96(%rbp,%rdx)                           #867.13
-        jmp       ..B6.7        # Prob 100%                     #867.13
-                                # LOE
-..B6.15:                        # Preds ..B6.11
-..LN161:
-        movq      -80(%rbp), %rax                               #870.27
-..LN163:
-        shrq      $2, %rax                                      #870.32
-..LN165:
-        movzbl    -112(%rbp,%rax), %eax                         #870.13
-..LN167:
-        movzbl    -24(%rbp), %edx                               #870.39
-..LN169:
-        shll      $2, %edx                                      #870.47
-..LN171:
-        orl       %edx, %eax                                    #870.13
-..LN173:
-        movq      -80(%rbp), %rdx                               #870.27
-..LN175:
-        shrq      $2, %rdx                                      #870.32
-..LN177:
-        movb      %al, -112(%rbp,%rdx)                          #870.13
-..LN179:
-        movq      -80(%rbp), %rax                               #871.24
-..LN181:
-        shrq      $2, %rax                                      #871.29
-..LN183:
-        movzbl    -96(%rbp,%rax), %eax                          #871.13
-        orl       $12, %eax                                     #871.13
-..LN185:
-        movq      -80(%rbp), %rdx                               #871.24
-..LN187:
-        shrq      $2, %rdx                                      #871.29
-..LN189:
-        movb      %al, -96(%rbp,%rdx)                           #871.13
-        jmp       ..B6.7        # Prob 100%                     #871.13
-                                # LOE
-..B6.16:                        # Preds ..B6.12
-..LN191:
-        movq      -80(%rbp), %rax                               #874.27
-..LN193:
-        shrq      $2, %rax                                      #874.32
-..LN195:
-        movzbl    -112(%rbp,%rax), %eax                         #874.13
-..LN197:
-        movzbl    -24(%rbp), %edx                               #874.39
-..LN199:
-        orl       %edx, %eax                                    #874.13
-..LN201:
-        movq      -80(%rbp), %rdx                               #874.27
-..LN203:
-        shrq      $2, %rdx                                      #874.32
-..LN205:
-        movb      %al, -112(%rbp,%rdx)                          #874.13
-..LN207:
-        movq      -80(%rbp), %rax                               #875.24
-..LN209:
-        shrq      $2, %rax                                      #875.29
-..LN211:
-        movzbl    -96(%rbp,%rax), %eax                          #875.13
-        orl       $3, %eax                                      #875.13
-..LN213:
-        movq      -80(%rbp), %rdx                               #875.24
-..LN215:
-        shrq      $2, %rdx                                      #875.29
-..LN217:
-        movb      %al, -96(%rbp,%rdx)                           #875.13
-        jmp       ..B6.7        # Prob 100%                     #875.13
-                                # LOE
-..B6.17:                        # Preds ..B6.7 ..B6.6
-..LN219:
-        movq      -80(%rbp), %rax                               #881.17
-..LN221:
-        addq      $3, %rax                                      #881.21
-..LN223:
-        shrq      $2, %rax                                      #881.28
-..LN225:
-        movq      %rax, -80(%rbp)                               #881.11
-..LN227:
-        movq      -80(%rbp), %rax                               #881.31
-..LN229:
-        cmpq      $16, %rax                                     #881.35
-        jae       ..B6.20       # Prob 50%                      #881.35
-                                # LOE
-..B6.19:                        # Preds ..B6.17 ..B6.19
-..LN231:
-        movq      -80(%rbp), %rax                               #883.23
-..LN233:
-        xorl      %edx, %edx                                    #883.9
-        movb      %dl, -112(%rbp,%rax)                          #883.9
-..LN235:
-        movq      -80(%rbp), %rax                               #884.20
-..LN237:
-        movb      %dl, -96(%rbp,%rax)                           #884.9
-..LN239:
-        incq      -80(%rbp)                                     #881.42
-..LN241:
-        movq      -80(%rbp), %rax                               #881.31
-..LN243:
-        cmpq      $16, %rax                                     #881.35
-        jb        ..B6.19       # Prob 50%                      #881.35
-                                # LOE
-..B6.20:                        # Preds ..B6.19 ..B6.17
-..LN245:
-        movl      -16(%rbp), %eax                               #890.10
-        testl     %eax, %eax                                    #890.10
-        je        ..B6.22       # Prob 50%                      #890.10
-                                # LOE
-..B6.21:                        # Preds ..B6.20
-..LN247:
-        movq      -64(%rbp), %rax                               #892.9
-        movl      $9, (%rax)                                    #892.9
-        jmp       ..B6.31       # Prob 100%                     #892.9
-                                # LOE
-..B6.22:                        # Preds ..B6.20
-..LN249:
-        movq      -32(%rbp), %rax                               #896.15
-..LN251:
-        cmpq      $2, %rax                                      #896.22
-        jae       ..B6.24       # Prob 50%                      #896.22
-                                # LOE
-..B6.23:                        # Preds ..B6.22
-..LN253:
-        movzbl    -112(%rbp), %eax                              #898.29
-..LN255:
-        movb      %al, -111(%rbp)                               #898.9
-..LN257:
-        movzwl    -112(%rbp), %eax                              #899.29
-..LN259:
-        movw      %ax, -110(%rbp)                               #899.9
-..LN261:
-        movl      -112(%rbp), %eax                              #900.29
-..LN263:
-        movl      %eax, -108(%rbp)                              #900.9
-..LN265:
-        movq      -112(%rbp), %rax                              #901.29
-..LN267:
-        movq      %rax, -104(%rbp)                              #901.9
-..LN269:
-        movzbl    -96(%rbp), %eax                               #903.26
-..LN271:
-        movb      %al, -95(%rbp)                                #903.9
-..LN273:
-        movzwl    -96(%rbp), %eax                               #904.26
-..LN275:
-        movw      %ax, -94(%rbp)                                #904.9
-..LN277:
-        movl      -96(%rbp), %eax                               #905.26
-..LN279:
-        movl      %eax, -92(%rbp)                               #905.9
-..LN281:
-        movq      -96(%rbp), %rax                               #906.26
-..LN283:
-        movq      %rax, -88(%rbp)                               #906.9
-..LN285:
-        movq      -64(%rbp), %rax                               #908.9
-        movl      $2, (%rax)                                    #908.9
-        jmp       ..B6.31       # Prob 100%                     #908.9
-                                # LOE
-..B6.24:                        # Preds ..B6.22
-..LN287:
-        movq      -32(%rbp), %rax                               #910.15
-..LN289:
-        cmpq      $6, %rax                                      #910.22
-        jae       ..B6.26       # Prob 50%                      #910.22
-                                # LOE
-..B6.25:                        # Preds ..B6.24
-..LN291:
-        movzwl    -112(%rbp), %eax                              #912.29
-..LN293:
-        movw      %ax, -110(%rbp)                               #912.9
-..LN295:
-        movl      -112(%rbp), %eax                              #913.29
-..LN297:
-        movl      %eax, -108(%rbp)                              #913.9
-..LN299:
-        movq      -112(%rbp), %rax                              #914.29
-..LN301:
-        movq      %rax, -104(%rbp)                              #914.9
-..LN303:
-        movzwl    -96(%rbp), %eax                               #916.26
-..LN305:
-        movw      %ax, -94(%rbp)                                #916.9
-..LN307:
-        movl      -96(%rbp), %eax                               #917.26
-..LN309:
-        movl      %eax, -92(%rbp)                               #917.9
-..LN311:
-        movq      -96(%rbp), %rax                               #918.26
-..LN313:
-        movq      %rax, -88(%rbp)                               #918.9
-..LN315:
-        movq      -64(%rbp), %rax                               #920.9
-        movl      $3, (%rax)                                    #920.9
-        jmp       ..B6.31       # Prob 100%                     #920.9
-                                # LOE
-..B6.26:                        # Preds ..B6.24
-..LN317:
-        movq      -32(%rbp), %rax                               #922.15
-..LN319:
-        cmpq      $14, %rax                                     #922.22
-        jae       ..B6.28       # Prob 50%                      #922.22
-                                # LOE
-..B6.27:                        # Preds ..B6.26
-..LN321:
-        movl      -112(%rbp), %eax                              #924.29
-..LN323:
-        movl      %eax, -108(%rbp)                              #924.9
-..LN325:
-        movq      -112(%rbp), %rax                              #925.29
-..LN327:
-        movq      %rax, -104(%rbp)                              #925.9
-..LN329:
-        movl      -96(%rbp), %eax                               #927.26
-..LN331:
-        movl      %eax, -92(%rbp)                               #927.9
-..LN333:
-        movq      -96(%rbp), %rax                               #928.26
-..LN335:
-        movq      %rax, -88(%rbp)                               #928.9
-..LN337:
-        movq      -64(%rbp), %rax                               #930.9
-        movl      $4, (%rax)                                    #930.9
-        jmp       ..B6.31       # Prob 100%                     #930.9
-                                # LOE
-..B6.28:                        # Preds ..B6.26
-..LN339:
-        movq      -32(%rbp), %rax                               #932.15
-..LN341:
-        cmpq      $30, %rax                                     #932.22
-        jae       ..B6.30       # Prob 50%                      #932.22
-                                # LOE
-..B6.29:                        # Preds ..B6.28
-..LN343:
-        movq      -112(%rbp), %rax                              #934.29
-..LN345:
-        movq      %rax, -104(%rbp)                              #934.9
-..LN347:
-        movq      -96(%rbp), %rax                               #935.26
-..LN349:
-        movq      %rax, -88(%rbp)                               #935.9
-..LN351:
-        movq      -64(%rbp), %rax                               #937.9
-        movl      $0, (%rax)                                    #937.9
-        jmp       ..B6.31       # Prob 100%                     #937.9
-                                # LOE
-..B6.30:                        # Preds ..B6.28
-..LN353:
-        movq      -64(%rbp), %rax                               #941.9
-        movl      $5, (%rax)                                    #941.9
-                                # LOE
-..B6.31:                        # Preds ..B6.21 ..B6.23 ..B6.25 ..B6.27 ..B6.29
-                                #       ..B6.30
-..LN355:
-        movq      -64(%rbp), %rax                               #944.5
-..LN357:
-        movq      -112(%rbp), %rdx                              #944.42
-        movq      %rdx, 16(%rax)                                #944.42
-        movq      -104(%rbp), %rdx                              #944.42
-        movq      %rdx, 24(%rax)                                #944.42
-..LN359:
-        movq      -64(%rbp), %rax                               #945.5
-..LN361:
-        movq      -96(%rbp), %rdx                               #945.39
-        movq      %rdx, 32(%rax)                                #945.39
-        movq      -88(%rbp), %rdx                               #945.39
-        movq      %rdx, 40(%rax)                                #945.39
-..LN363:
-        lea       -112(%rbp), %rax                              #948.23
-..LN365:
-        movq      %rax, %rdi                                    #948.5
-        call      uint128_bswap at PLT                             #948.5
-                                # LOE
-..B6.32:                        # Preds ..B6.31
-..LN367:
-        lea       -96(%rbp), %rax                               #949.23
-..LN369:
-        movq      %rax, %rdi                                    #949.5
-        call      uint128_bswap at PLT                             #949.5
-                                # LOE
-..B6.33:                        # Preds ..B6.32
-..LN371:
-        lea       -112(%rbp), %rax                              #952.21
-..LN373:
-        movq      %rax, %rdi                                    #952.5
-        movl      $2, %esi                                      #952.5
-        call      uint128_shr at PLT                               #952.5
-                                # LOE
-..B6.34:                        # Preds ..B6.33
-..LN375:
-        lea       -96(%rbp), %rax                               #953.21
-..LN377:
-        movq      %rax, %rdi                                    #953.5
-        movl      $2, %esi                                      #953.5
-        call      uint128_shr at PLT                               #953.5
-                                # LOE
-..B6.35:                        # Preds ..B6.34
-..LN379:
-        movq      -64(%rbp), %rax                               #956.28
-..LN381:
-        addq      $48, %rax                                     #956.5
-..LN383:
-        lea       -112(%rbp), %rdx                              #956.70
-..LN385:
-        movq      %rax, %rdi                                    #956.5
-        movq      %rdx, %rsi                                    #956.5
-        call      uint128_bswap_copy at PLT                        #956.5
-                                # LOE
-..B6.36:                        # Preds ..B6.35
-..LN387:
-        movq      -64(%rbp), %rax                               #957.28
-..LN389:
-        addq      $64, %rax                                     #957.5
-..LN391:
-        lea       -96(%rbp), %rdx                               #957.67
-..LN393:
-        movq      %rax, %rdi                                    #957.5
-        movq      %rdx, %rsi                                    #957.5
-        call      uint128_bswap_copy at PLT                        #957.5
-                                # LOE
-..B6.37:                        # Preds ..B6.36
-..LN395:
-        lea       -112(%rbp), %rax                              #959.21
-..LN397:
-        movq      %rax, %rdi                                    #959.5
-        movl      $2, %esi                                      #959.5
-        call      uint128_shr at PLT                               #959.5
-                                # LOE
-..B6.38:                        # Preds ..B6.37
-..LN399:
-        lea       -96(%rbp), %rax                               #960.21
-..LN401:
-        movq      %rax, %rdi                                    #960.5
-        movl      $2, %esi                                      #960.5
-        call      uint128_shr at PLT                               #960.5
-                                # LOE
-..B6.39:                        # Preds ..B6.38
-..LN403:
-        movq      -64(%rbp), %rax                               #962.28
-..LN405:
-        addq      $80, %rax                                     #962.5
-..LN407:
-        lea       -112(%rbp), %rdx                              #962.70
-..LN409:
-        movq      %rax, %rdi                                    #962.5
-        movq      %rdx, %rsi                                    #962.5
-        call      uint128_bswap_copy at PLT                        #962.5
-                                # LOE
-..B6.40:                        # Preds ..B6.39
-..LN411:
-        movq      -64(%rbp), %rax                               #963.28
-..LN413:
-        addq      $96, %rax                                     #963.5
-..LN415:
-        lea       -96(%rbp), %rdx                               #963.67
-..LN417:
-        movq      %rax, %rdi                                    #963.5
-        movq      %rdx, %rsi                                    #963.5
-        call      uint128_bswap_copy at PLT                        #963.5
-                                # LOE
-..B6.41:                        # Preds ..B6.40
-..LN419:
-        lea       -112(%rbp), %rax                              #965.21
-..LN421:
-        movq      %rax, %rdi                                    #965.5
-        movl      $2, %esi                                      #965.5
-        call      uint128_shr at PLT                               #965.5
-                                # LOE
-..B6.42:                        # Preds ..B6.41
-..LN423:
-        lea       -96(%rbp), %rax                               #966.21
-..LN425:
-        movq      %rax, %rdi                                    #966.5
-        movl      $2, %esi                                      #966.5
-        call      uint128_shr at PLT                               #966.5
-                                # LOE
-..B6.43:                        # Preds ..B6.42
-..LN427:
-        movq      -64(%rbp), %rax                               #968.28
-..LN429:
-        addq      $112, %rax                                    #968.5
-..LN431:
-        lea       -112(%rbp), %rdx                              #968.70
-..LN433:
-        movq      %rax, %rdi                                    #968.5
-        movq      %rdx, %rsi                                    #968.5
-        call      uint128_bswap_copy at PLT                        #968.5
-                                # LOE
-..B6.44:                        # Preds ..B6.43
-..LN435:
-        movq      -64(%rbp), %rax                               #969.28
-..LN437:
-        addq      $128, %rax                                    #969.5
-..LN439:
-        lea       -96(%rbp), %rdx                               #969.67
-..LN441:
-        movq      %rax, %rdi                                    #969.5
-        movq      %rdx, %rsi                                    #969.5
-        call      uint128_bswap_copy at PLT                        #969.5
-                                # LOE
-..B6.45:                        # Preds ..B6.44
-..LN443:
-        xorl      %eax, %eax                                    #1011.12
-        leave                                                   #1011.12
-..___tag_value_NucStrFastaExprMake2.61:                         #
-        ret                                                     #1011.12
-        .align    2,0x90
-..___tag_value_NucStrFastaExprMake2.62:                         #
-                                # LOE
-# mark_end;
-	.type	NucStrFastaExprMake2, at function
-	.size	NucStrFastaExprMake2,.-NucStrFastaExprMake2
-.LNNucStrFastaExprMake2:
-	.data
-# -- End  NucStrFastaExprMake2
-	.text
-# -- Begin  NucStrFastaExprMake4
-# mark_begin;
-       .align    2,0x90
-NucStrFastaExprMake4:
-# parameter 1(expr): %rdi
-# parameter 2(positional): %esi
-# parameter 3(fasta): %rdx
-# parameter 4(size): %rcx
-..B7.1:                         # Preds ..B7.0
-..___tag_value_NucStrFastaExprMake4.65:                         #
-..LN445:
-        pushq     %rbp                                          #1017.1
-        movq      %rsp, %rbp                                    #1017.1
-..___tag_value_NucStrFastaExprMake4.66:                         #
-        subq      $112, %rsp                                    #1017.1
-        movq      %rdi, -40(%rbp)                               #1017.1
-        movl      %esi, -16(%rbp)                               #1017.1
-        movq      %rdx, -32(%rbp)                               #1017.1
-        movq      %rcx, -24(%rbp)                               #1017.1
-..LN447:
-        movq      -24(%rbp), %rax                               #1023.10
-..LN449:
-        cmpq      $29, %rax                                     #1023.17
-        jbe       ..B7.3        # Prob 50%                      #1023.17
-                                # LOE
-..B7.2:                         # Preds ..B7.1
-..LN451:
-        movl      $7, %eax                                      #1024.16
-        leave                                                   #1024.16
-..___tag_value_NucStrFastaExprMake4.70:                         #
-        ret                                                     #1024.16
-..___tag_value_NucStrFastaExprMake4.71:                         #
-                                # LOE
-..B7.3:                         # Preds ..B7.1
-..LN453:
-        movl      $144, %edi                                    #1026.9
-        call      NucStrFastaExprAlloc at PLT                      #1026.9
-                                # LOE rax
-..B7.46:                        # Preds ..B7.3
-        movq      %rax, -56(%rbp)                               #1026.9
-                                # LOE
-..B7.4:                         # Preds ..B7.46
-..LN455:
-        movq      -56(%rbp), %rax                               #1026.5
-        movq      %rax, -64(%rbp)                               #1026.5
-..LN457:
-        movq      -64(%rbp), %rax                               #1027.10
-..LN459:
-        testq     %rax, %rax                                    #1027.15
-        jne       ..B7.6        # Prob 50%                      #1027.15
-                                # LOE
-..B7.5:                         # Preds ..B7.4
-..LN461:
-        call      __errno_location at PLT                          #1028.16
-                                # LOE rax
-..B7.47:                        # Preds ..B7.5
-        movl      (%rax), %eax                                  #1028.16
-        leave                                                   #1028.16
-..___tag_value_NucStrFastaExprMake4.73:                         #
-        ret                                                     #1028.16
-..___tag_value_NucStrFastaExprMake4.74:                         #
-                                # LOE
-..B7.6:                         # Preds ..B7.4
-..LN463:
-        movq      -40(%rbp), %rax                               #1030.5
-..LN465:
-        movq      -64(%rbp), %rdx                               #1030.14
-..LN467:
-        movq      %rdx, (%rax)                                  #1030.5
-..LN469:
-        movq      -24(%rbp), %rax                               #1031.38
-..LN471:
-        movq      -64(%rbp), %rdx                               #1031.5
-        movl      %eax, 4(%rdx)                                 #1031.5
-..LN473:
-        movq      $0, -80(%rbp)                                 #1035.11
-..LN475:
-        movq      -80(%rbp), %rax                               #1035.18
-..LN477:
-        movq      -24(%rbp), %rdx                               #1035.22
-        cmpq      %rdx, %rax                                    #1035.22
-        jb        ..B7.9        # Prob 50%                      #1035.22
-        jmp       ..B7.17       # Prob 100%                     #1035.22
-                                # LOE
-..B7.7:                         # Preds ..B7.13 ..B7.14 ..B7.15 ..B7.16 ..B7.12
-                                #      
-..LN479:
-        incq      -80(%rbp)                                     #1035.31
-..LN481:
-        movq      -80(%rbp), %rax                               #1035.18
-..LN483:
-        movq      -24(%rbp), %rdx                               #1035.22
-        cmpq      %rdx, %rax                                    #1035.22
-        jae       ..B7.17       # Prob 50%                      #1035.22
-                                # LOE
-..B7.9:                         # Preds ..B7.6 ..B7.7
-..LN485:
-        movq      -32(%rbp), %rax                               #1037.49
-..LN487:
-        movq      -80(%rbp), %rdx                               #1037.57
-..LN489:
-        movzbl    (%rdx,%rax), %eax                             #1037.49
-        movsbq    %al, %rax                                     #1037.49
-..LN491:
-        movslq    %eax, %rax                                    #1037.25
-        lea       fasta_4na_map.0(%rip), %rdx                   #1037.25
-        movzbl    (%rax,%rdx), %eax                             #1037.25
-        movsbq    %al, %rax                                     #1037.25
-..LN493:
-        movw      %ax, -48(%rbp)                                #1037.23
-..LN495:
-        movq      -80(%rbp), %rax                               #1038.18
-..LN497:
-        andq      $3, %rax                                      #1038.22
-        movq      %rax, -72(%rbp)                               #1038.22
-        je        ..B7.13       # Prob 50%                      #1038.22
-                                # LOE
-..B7.10:                        # Preds ..B7.9
-        movq      -72(%rbp), %rax                               #1038.22
-        cmpq      $1, %rax                                      #1038.22
-        je        ..B7.14       # Prob 50%                      #1038.22
-                                # LOE
-..B7.11:                        # Preds ..B7.10
-        movq      -72(%rbp), %rax                               #1038.22
-        cmpq      $2, %rax                                      #1038.22
-        je        ..B7.15       # Prob 50%                      #1038.22
-                                # LOE
-..B7.12:                        # Preds ..B7.11
-        movq      -72(%rbp), %rax                               #1038.22
-        cmpq      $3, %rax                                      #1038.22
-        je        ..B7.16       # Prob 50%                      #1038.22
-        jmp       ..B7.7        # Prob 100%                     #1038.22
-                                # LOE
-..B7.13:                        # Preds ..B7.9
-..LN499:
-        movzwl    -48(%rbp), %eax                               #1041.38
-..LN501:
-        shll      $4, %eax                                      #1041.46
-..LN503:
-        movq      -80(%rbp), %rdx                               #1041.27
-..LN505:
-        shrq      $2, %rdx                                      #1041.32
-..LN507:
-        movw      %ax, -112(%rbp,%rdx,2)                        #1041.13
-..LN509:
-        movq      -80(%rbp), %rax                               #1042.24
-..LN511:
-        shrq      $2, %rax                                      #1042.29
-..LN513:
-        movw      $240, -96(%rbp,%rax,2)                        #1042.13
-        jmp       ..B7.7        # Prob 100%                     #1042.13
-                                # LOE
-..B7.14:                        # Preds ..B7.10
-..LN515:
-        movq      -80(%rbp), %rax                               #1045.27
-..LN517:
-        shrq      $2, %rax                                      #1045.32
-..LN519:
-        movzwl    -112(%rbp,%rax,2), %eax                       #1045.13
-..LN521:
-        movzwl    -48(%rbp), %edx                               #1045.39
-..LN523:
-        orl       %edx, %eax                                    #1045.13
-..LN525:
-        movq      -80(%rbp), %rdx                               #1045.27
-..LN527:
-        shrq      $2, %rdx                                      #1045.32
-..LN529:
-        movw      %ax, -112(%rbp,%rdx,2)                        #1045.13
-..LN531:
-        movq      -80(%rbp), %rax                               #1046.24
-..LN533:
-        shrq      $2, %rax                                      #1046.29
-..LN535:
-        movzwl    -96(%rbp,%rax,2), %eax                        #1046.13
-        orl       $15, %eax                                     #1046.13
-..LN537:
-        movq      -80(%rbp), %rdx                               #1046.24
-..LN539:
-        shrq      $2, %rdx                                      #1046.29
-..LN541:
-        movw      %ax, -96(%rbp,%rdx,2)                         #1046.13
-        jmp       ..B7.7        # Prob 100%                     #1046.13
-                                # LOE
-..B7.15:                        # Preds ..B7.11
-..LN543:
-        movq      -80(%rbp), %rax                               #1049.27
-..LN545:
-        shrq      $2, %rax                                      #1049.32
-..LN547:
-        movzwl    -112(%rbp,%rax,2), %eax                       #1049.13
-..LN549:
-        movzwl    -48(%rbp), %edx                               #1049.39
-..LN551:
-        shll      $12, %edx                                     #1049.47
-..LN553:
-        orl       %edx, %eax                                    #1049.13
-..LN555:
-        movq      -80(%rbp), %rdx                               #1049.27
-..LN557:
-        shrq      $2, %rdx                                      #1049.32
-..LN559:
-        movw      %ax, -112(%rbp,%rdx,2)                        #1049.13
-..LN561:
-        movq      -80(%rbp), %rax                               #1050.24
-..LN563:
-        shrq      $2, %rax                                      #1050.29
-..LN565:
-        movzwl    -96(%rbp,%rax,2), %eax                        #1050.13
-        orl       $-4096, %eax                                  #1050.13
-..LN567:
-        movq      -80(%rbp), %rdx                               #1050.24
-..LN569:
-        shrq      $2, %rdx                                      #1050.29
-..LN571:
-        movw      %ax, -96(%rbp,%rdx,2)                         #1050.13
-        jmp       ..B7.7        # Prob 100%                     #1050.13
-                                # LOE
-..B7.16:                        # Preds ..B7.12
-..LN573:
-        movq      -80(%rbp), %rax                               #1053.27
-..LN575:
-        shrq      $2, %rax                                      #1053.32
-..LN577:
-        movzwl    -112(%rbp,%rax,2), %eax                       #1053.13
-..LN579:
-        movzwl    -48(%rbp), %edx                               #1053.39
-..LN581:
-        shll      $8, %edx                                      #1053.47
-..LN583:
-        orl       %edx, %eax                                    #1053.13
-..LN585:
-        movq      -80(%rbp), %rdx                               #1053.27
-..LN587:
-        shrq      $2, %rdx                                      #1053.32
-..LN589:
-        movw      %ax, -112(%rbp,%rdx,2)                        #1053.13
-..LN591:
-        movq      -80(%rbp), %rax                               #1054.24
-..LN593:
-        shrq      $2, %rax                                      #1054.29
-..LN595:
-        movzwl    -96(%rbp,%rax,2), %eax                        #1054.13
-        orl       $-61696, %eax                                 #1054.13
-..LN597:
-        movq      -80(%rbp), %rdx                               #1054.24
-..LN599:
-        shrq      $2, %rdx                                      #1054.29
-..LN601:
-        movw      %ax, -96(%rbp,%rdx,2)                         #1054.13
-        jmp       ..B7.7        # Prob 100%                     #1054.13
-                                # LOE
-..B7.17:                        # Preds ..B7.7 ..B7.6
-..LN603:
-        movq      -80(%rbp), %rax                               #1060.17
-..LN605:
-        addq      $3, %rax                                      #1060.21
-..LN607:
-        shrq      $2, %rax                                      #1060.28
-..LN609:
-        movq      %rax, -80(%rbp)                               #1060.11
-..LN611:
-        movq      -80(%rbp), %rax                               #1060.31
-..LN613:
-        cmpq      $8, %rax                                      #1060.35
-        jae       ..B7.20       # Prob 50%                      #1060.35
-                                # LOE
-..B7.19:                        # Preds ..B7.17 ..B7.19
-..LN615:
-        movq      -80(%rbp), %rax                               #1062.23
-..LN617:
-        xorl      %edx, %edx                                    #1062.9
-        movw      %dx, -112(%rbp,%rax,2)                        #1062.9
-..LN619:
-        movq      -80(%rbp), %rax                               #1063.20
-..LN621:
-        movw      %dx, -96(%rbp,%rax,2)                         #1063.9
-..LN623:
-        incq      -80(%rbp)                                     #1060.41
-..LN625:
-        movq      -80(%rbp), %rax                               #1060.31
-..LN627:
-        cmpq      $8, %rax                                      #1060.35
-        jb        ..B7.19       # Prob 50%                      #1060.35
-                                # LOE
-..B7.20:                        # Preds ..B7.19 ..B7.17
-..LN629:
-        movl      -16(%rbp), %eax                               #1068.10
-        testl     %eax, %eax                                    #1068.10
-        je        ..B7.22       # Prob 50%                      #1068.10
-                                # LOE
-..B7.21:                        # Preds ..B7.20
-..LN631:
-        movq      -64(%rbp), %rax                               #1070.9
-        movl      $10, (%rax)                                   #1070.9
-        jmp       ..B7.29       # Prob 100%                     #1070.9
-                                # LOE
-..B7.22:                        # Preds ..B7.20
-..LN633:
-        movq      -24(%rbp), %rax                               #1072.15
-..LN635:
-        cmpq      $2, %rax                                      #1072.22
-        jae       ..B7.24       # Prob 50%                      #1072.22
-                                # LOE
-..B7.23:                        # Preds ..B7.22
-..LN637:
-        movzwl    -112(%rbp), %eax                              #1074.29
-..LN639:
-        movw      %ax, -110(%rbp)                               #1074.9
-..LN641:
-        movl      -112(%rbp), %eax                              #1075.29
-..LN643:
-        movl      %eax, -108(%rbp)                              #1075.9
-..LN645:
-        movq      -112(%rbp), %rax                              #1076.29
-..LN647:
-        movq      %rax, -104(%rbp)                              #1076.9
-..LN649:
-        movzwl    -96(%rbp), %eax                               #1078.26
-..LN651:
-        movw      %ax, -94(%rbp)                                #1078.9
-..LN653:
-        movl      -96(%rbp), %eax                               #1079.26
-..LN655:
-        movl      %eax, -92(%rbp)                               #1079.9
-..LN657:
-        movq      -96(%rbp), %rax                               #1080.26
-..LN659:
-        movq      %rax, -88(%rbp)                               #1080.9
-..LN661:
-        movq      -64(%rbp), %rax                               #1082.9
-        movl      $6, (%rax)                                    #1082.9
-        jmp       ..B7.29       # Prob 100%                     #1082.9
-                                # LOE
-..B7.24:                        # Preds ..B7.22
-..LN663:
-        movq      -24(%rbp), %rax                               #1084.15
-..LN665:
-        cmpq      $6, %rax                                      #1084.22
-        jae       ..B7.26       # Prob 50%                      #1084.22
-                                # LOE
-..B7.25:                        # Preds ..B7.24
-..LN667:
-        movl      -112(%rbp), %eax                              #1086.29
-..LN669:
-        movl      %eax, -108(%rbp)                              #1086.9
-..LN671:
-        movq      -112(%rbp), %rax                              #1087.29
-..LN673:
-        movq      %rax, -104(%rbp)                              #1087.9
-..LN675:
-        movl      -96(%rbp), %eax                               #1089.26
-..LN677:
-        movl      %eax, -92(%rbp)                               #1089.9
-..LN679:
-        movq      -96(%rbp), %rax                               #1090.26
-..LN681:
-        movq      %rax, -88(%rbp)                               #1090.9
-..LN683:
-        movq      -64(%rbp), %rax                               #1092.9
-        movl      $7, (%rax)                                    #1092.9
-        jmp       ..B7.29       # Prob 100%                     #1092.9
-                                # LOE
-..B7.26:                        # Preds ..B7.24
-..LN685:
-        movq      -24(%rbp), %rax                               #1094.15
-..LN687:
-        cmpq      $14, %rax                                     #1094.22
-        jae       ..B7.28       # Prob 50%                      #1094.22
-                                # LOE
-..B7.27:                        # Preds ..B7.26
-..LN689:
-        movq      -112(%rbp), %rax                              #1096.29
-..LN691:
-        movq      %rax, -104(%rbp)                              #1096.9
-..LN693:
-        movq      -96(%rbp), %rax                               #1097.26
-..LN695:
-        movq      %rax, -88(%rbp)                               #1097.9
-..LN697:
-        movq      -64(%rbp), %rax                               #1099.9
-        movl      $1, (%rax)                                    #1099.9
-        jmp       ..B7.29       # Prob 100%                     #1099.9
-                                # LOE
-..B7.28:                        # Preds ..B7.26
-..LN699:
-        movq      -64(%rbp), %rax                               #1103.9
-        movl      $8, (%rax)                                    #1103.9
-                                # LOE
-..B7.29:                        # Preds ..B7.21 ..B7.23 ..B7.25 ..B7.27 ..B7.28
-                                #      
-..LN701:
-        movq      -64(%rbp), %rax                               #1106.5
-..LN703:
-        movq      -112(%rbp), %rdx                              #1106.42
-        movq      %rdx, 16(%rax)                                #1106.42
-        movq      -104(%rbp), %rdx                              #1106.42
-        movq      %rdx, 24(%rax)                                #1106.42
-..LN705:
-        movq      -64(%rbp), %rax                               #1107.5
-..LN707:
-        movq      -96(%rbp), %rdx                               #1107.39
-        movq      %rdx, 32(%rax)                                #1107.39
-        movq      -88(%rbp), %rdx                               #1107.39
-        movq      %rdx, 40(%rax)                                #1107.39
-..LN709:
-        lea       -112(%rbp), %rax                              #1110.23
-..LN711:
-        movq      %rax, %rdi                                    #1110.5
-        call      uint128_bswap at PLT                             #1110.5
-                                # LOE
-..B7.30:                        # Preds ..B7.29
-..LN713:
-        lea       -96(%rbp), %rax                               #1111.23
-..LN715:
-        movq      %rax, %rdi                                    #1111.5
-        call      uint128_bswap at PLT                             #1111.5
-                                # LOE
-..B7.31:                        # Preds ..B7.30
-..LN717:
-        lea       -112(%rbp), %rax                              #1114.21
-..LN719:
-        movq      %rax, %rdi                                    #1114.5
-        movl      $4, %esi                                      #1114.5
-        call      uint128_shr at PLT                               #1114.5
-                                # LOE
-..B7.32:                        # Preds ..B7.31
-..LN721:
-        lea       -96(%rbp), %rax                               #1115.21
-..LN723:
-        movq      %rax, %rdi                                    #1115.5
-        movl      $4, %esi                                      #1115.5
-        call      uint128_shr at PLT                               #1115.5
-                                # LOE
-..B7.33:                        # Preds ..B7.32
-..LN725:
-        movq      -64(%rbp), %rax                               #1118.28
-..LN727:
-        addq      $48, %rax                                     #1118.5
-..LN729:
-        lea       -112(%rbp), %rdx                              #1118.70
-..LN731:
-        movq      %rax, %rdi                                    #1118.5
-        movq      %rdx, %rsi                                    #1118.5
-        call      uint128_bswap_copy at PLT                        #1118.5
-                                # LOE
-..B7.34:                        # Preds ..B7.33
-..LN733:
-        movq      -64(%rbp), %rax                               #1119.28
-..LN735:
-        addq      $64, %rax                                     #1119.5
-..LN737:
-        lea       -96(%rbp), %rdx                               #1119.67
-..LN739:
-        movq      %rax, %rdi                                    #1119.5
-        movq      %rdx, %rsi                                    #1119.5
-        call      uint128_bswap_copy at PLT                        #1119.5
-                                # LOE
-..B7.35:                        # Preds ..B7.34
-..LN741:
-        lea       -112(%rbp), %rax                              #1121.21
-..LN743:
-        movq      %rax, %rdi                                    #1121.5
-        movl      $4, %esi                                      #1121.5
-        call      uint128_shr at PLT                               #1121.5
-                                # LOE
-..B7.36:                        # Preds ..B7.35
-..LN745:
-        lea       -96(%rbp), %rax                               #1122.21
-..LN747:
-        movq      %rax, %rdi                                    #1122.5
-        movl      $4, %esi                                      #1122.5
-        call      uint128_shr at PLT                               #1122.5
-                                # LOE
-..B7.37:                        # Preds ..B7.36
-..LN749:
-        movq      -64(%rbp), %rax                               #1124.28
-..LN751:
-        addq      $80, %rax                                     #1124.5
-..LN753:
-        lea       -112(%rbp), %rdx                              #1124.70
-..LN755:
-        movq      %rax, %rdi                                    #1124.5
-        movq      %rdx, %rsi                                    #1124.5
-        call      uint128_bswap_copy at PLT                        #1124.5
-                                # LOE
-..B7.38:                        # Preds ..B7.37
-..LN757:
-        movq      -64(%rbp), %rax                               #1125.28
-..LN759:
-        addq      $96, %rax                                     #1125.5
-..LN761:
-        lea       -96(%rbp), %rdx                               #1125.67
-..LN763:
-        movq      %rax, %rdi                                    #1125.5
-        movq      %rdx, %rsi                                    #1125.5
-        call      uint128_bswap_copy at PLT                        #1125.5
-                                # LOE
-..B7.39:                        # Preds ..B7.38
-..LN765:
-        lea       -112(%rbp), %rax                              #1127.21
-..LN767:
-        movq      %rax, %rdi                                    #1127.5
-        movl      $4, %esi                                      #1127.5
-        call      uint128_shr at PLT                               #1127.5
-                                # LOE
-..B7.40:                        # Preds ..B7.39
-..LN769:
-        lea       -96(%rbp), %rax                               #1128.21
-..LN771:
-        movq      %rax, %rdi                                    #1128.5
-        movl      $4, %esi                                      #1128.5
-        call      uint128_shr at PLT                               #1128.5
-                                # LOE
-..B7.41:                        # Preds ..B7.40
-..LN773:
-        movq      -64(%rbp), %rax                               #1130.28
-..LN775:
-        addq      $112, %rax                                    #1130.5
-..LN777:
-        lea       -112(%rbp), %rdx                              #1130.70
-..LN779:
-        movq      %rax, %rdi                                    #1130.5
-        movq      %rdx, %rsi                                    #1130.5
-        call      uint128_bswap_copy at PLT                        #1130.5
-                                # LOE
-..B7.42:                        # Preds ..B7.41
-..LN781:
-        movq      -64(%rbp), %rax                               #1131.28
-..LN783:
-        addq      $128, %rax                                    #1131.5
-..LN785:
-        lea       -96(%rbp), %rdx                               #1131.67
-..LN787:
-        movq      %rax, %rdi                                    #1131.5
-        movq      %rdx, %rsi                                    #1131.5
-        call      uint128_bswap_copy at PLT                        #1131.5
-                                # LOE
-..B7.43:                        # Preds ..B7.42
-..LN789:
-        xorl      %eax, %eax                                    #1173.12
-        leave                                                   #1173.12
-..___tag_value_NucStrFastaExprMake4.76:                         #
-        ret                                                     #1173.12
-        .align    2,0x90
-..___tag_value_NucStrFastaExprMake4.77:                         #
-                                # LOE
-# mark_end;
-	.type	NucStrFastaExprMake4, at function
-	.size	NucStrFastaExprMake4,.-NucStrFastaExprMake4
-.LNNucStrFastaExprMake4:
-	.data
-# -- End  NucStrFastaExprMake4
-	.text
-# -- Begin  nss_sob
-# mark_begin;
-       .align    2,0x90
-nss_sob:
-# parameter 1(p): %rdi
-# parameter 2(end): %rsi
-..B8.1:                         # Preds ..B8.0
-..___tag_value_nss_sob.80:                                      #
-..LN791:
-        pushq     %rbp                                          #1181.1
-        movq      %rsp, %rbp                                    #1181.1
-..___tag_value_nss_sob.81:                                      #
-        subq      $16, %rsp                                     #1181.1
-        movq      %rdi, -16(%rbp)                               #1181.1
-        movq      %rsi, -8(%rbp)                                #1181.1
-..LN793:
-        movq      -16(%rbp), %rax                               #1182.13
-..LN795:
-        movq      -8(%rbp), %rdx                                #1182.17
-        cmpq      %rdx, %rax                                    #1182.17
-        jae       ..B8.5        # Prob 50%                      #1182.17
-                                # LOE
-..B8.3:                         # Preds ..B8.1 ..B8.4
-..LN797:
-        call      __ctype_b_loc at PLT                             #1182.24
-                                # LOE rax
-..B8.8:                         # Preds ..B8.3
-        movq      -16(%rbp), %rdx                               #1182.24
-        movzbl    (%rdx), %edx                                  #1182.24
-        movzbl    %dl, %edx                                     #1182.24
-        movslq    %edx, %rdx                                    #1182.24
-        movq      (%rax), %rax                                  #1182.24
-        movzwl    (%rax,%rdx,2), %eax                           #1182.24
-        testl     $8192, %eax                                   #1182.24
-        je        ..B8.5        # Prob 50%                      #1182.24
-                                # LOE
-..B8.4:                         # Preds ..B8.8
-..LN799:
-        incq      -16(%rbp)                                     #1183.12
-..LN801:
-        movq      -16(%rbp), %rax                               #1182.13
-..LN803:
-        movq      -8(%rbp), %rdx                                #1182.17
-        cmpq      %rdx, %rax                                    #1182.17
-        jb        ..B8.3        # Prob 50%                      #1182.17
-                                # LOE
-..B8.5:                         # Preds ..B8.4 ..B8.8 ..B8.1
-..LN805:
-        movq      -16(%rbp), %rax                               #1184.12
-        leave                                                   #1184.12
-..___tag_value_nss_sob.85:                                      #
-        ret                                                     #1184.12
-        .align    2,0x90
-..___tag_value_nss_sob.86:                                      #
-                                # LOE
-# mark_end;
-	.type	nss_sob, at function
-	.size	nss_sob,.-nss_sob
-.LNnss_sob:
-	.data
-# -- End  nss_sob
-	.text
-# -- Begin  nss_FASTA_expr
-# mark_begin;
-       .align    2,0x90
-nss_FASTA_expr:
-# parameter 1(p): %rdi
-# parameter 2(end): %rsi
-# parameter 3(expr): %rdx
-# parameter 4(status): %rcx
-# parameter 5(positional): %r8d
-..B9.1:                         # Preds ..B9.0
-..___tag_value_nss_FASTA_expr.89:                               #
-..LN807:
-        pushq     %rbp                                          #1192.1
-        movq      %rsp, %rbp                                    #1192.1
-..___tag_value_nss_FASTA_expr.90:                               #
-        subq      $80, %rsp                                     #1192.1
-        movq      %rbx, -16(%rbp)                               #1192.1
-..___tag_value_nss_FASTA_expr.93:                               #
-        movq      %rdi, -48(%rbp)                               #1192.1
-        movq      %rsi, -40(%rbp)                               #1192.1
-        movq      %rdx, -32(%rbp)                               #1192.1
-        movq      %rcx, -24(%rbp)                               #1192.1
-        movl      %r8d, -8(%rbp)                                #1192.1
-..LN809:
-        movq      -48(%rbp), %rax                               #1193.10
-..LN811:
-        movq      -40(%rbp), %rdx                               #1193.15
-        cmpq      %rdx, %rax                                    #1193.15
-        jb        ..B9.3        # Prob 50%                      #1193.15
-                                # LOE
-..B9.2:                         # Preds ..B9.1
-..LN813:
-        movq      -24(%rbp), %rax                               #1194.9
-        movl      $22, (%rax)                                   #1194.9
-        jmp       ..B9.17       # Prob 100%                     #1194.9
-                                # LOE
-..B9.3:                         # Preds ..B9.1
-..LN815:
-        movq      -48(%rbp), %rax                               #1197.30
-..LN817:
-        movq      %rax, -72(%rbp)                               #1197.27
-..LN819:
-        movl      $0, -56(%rbp)                                 #1199.22
-..LN821:
-        lea       fasta_2na_map.0(%rip), %rax                   #1200.27
-        movq      %rax, -64(%rbp)                               #1200.27
-                                # LOE
-..B9.4:                         # Preds ..B9.9 ..B9.3
-..LN823:
-        movq      -48(%rbp), %rax                               #1203.20
-        movzbl    (%rax), %eax                                  #1203.20
-        movsbq    %al, %rax                                     #1203.20
-..LN825:
-        testl     %eax, %eax                                    #1203.24
-        jl        ..B9.10       # Prob 50%                      #1203.24
-                                # LOE
-..B9.5:                         # Preds ..B9.4
-..LN827:
-        movq      -48(%rbp), %rax                               #1206.45
-        movzbl    (%rax), %eax                                  #1206.45
-        movzbl    %al, %eax                                     #1206.45
-..LN829:
-        movslq    %eax, %rax                                    #1206.18
-        movq      -64(%rbp), %rdx                               #1206.18
-        movzbl    (%rax,%rdx), %eax                             #1206.18
-        movsbq    %al, %rax                                     #1206.18
-..LN831:
-        testl     %eax, %eax                                    #1206.51
-        jge       ..B9.9        # Prob 50%                      #1206.51
-                                # LOE
-..B9.6:                         # Preds ..B9.5
-..LN833:
-        movq      -64(%rbp), %rax                               #1208.22
-..LN835:
-        lea       fasta_4na_map.0(%rip), %rdx                   #1208.29
-        cmpq      %rdx, %rax                                    #1208.29
-        je        ..B9.10       # Prob 50%                      #1208.29
-                                # LOE
-..B9.7:                         # Preds ..B9.6
-..LN837:
-        movq      -48(%rbp), %rax                               #1210.59
-        movzbl    (%rax), %eax                                  #1210.59
-        movzbl    %al, %eax                                     #1210.59
-..LN839:
-        movslq    %eax, %rax                                    #1210.22
-        lea       fasta_4na_map.0(%rip), %rdx                   #1210.22
-        movzbl    (%rax,%rdx), %eax                             #1210.22
-        movsbq    %al, %rax                                     #1210.22
-..LN841:
-        testl     %eax, %eax                                    #1210.65
-        jl        ..B9.10       # Prob 50%                      #1210.65
-                                # LOE
-..B9.8:                         # Preds ..B9.7
-..LN843:
-        movl      $1, -56(%rbp)                                 #1212.17
-..LN845:
-        lea       fasta_4na_map.0(%rip), %rax                   #1213.23
-..LN847:
-        movq      %rax, -64(%rbp)                               #1213.17
-                                # LOE
-..B9.9:                         # Preds ..B9.8 ..B9.5
-..LN849:
-        movq      -48(%rbp), %rax                               #1216.20
-        incq      %rax                                          #1216.20
-        movq      %rax, -48(%rbp)                               #1216.20
-..LN851:
-        movq      -40(%rbp), %rdx                               #1216.24
-        cmpq      %rdx, %rax                                    #1216.24
-        jb        ..B9.4        # Prob 50%                      #1216.24
-                                # LOE
-..B9.10:                        # Preds ..B9.7 ..B9.6 ..B9.4 ..B9.9
-..LN853:
-        movq      -48(%rbp), %rax                               #1218.14
-..LN855:
-        movq      -72(%rbp), %rdx                               #1218.19
-        cmpq      %rdx, %rax                                    #1218.19
-        ja        ..B9.12       # Prob 50%                      #1218.19
-                                # LOE
-..B9.11:                        # Preds ..B9.10
-..LN857:
-        movq      -24(%rbp), %rax                               #1219.13
-        movl      $22, (%rax)                                   #1219.13
-        jmp       ..B9.17       # Prob 100%                     #1219.13
-                                # LOE
-..B9.12:                        # Preds ..B9.10
-..LN859:
-        movl      -56(%rbp), %eax                               #1220.19
-..LN861:
-        testl     %eax, %eax                                    #1220.27
-        jne       ..B9.15       # Prob 50%                      #1220.27
-                                # LOE
-..B9.13:                        # Preds ..B9.12
-..LN863:
-        movq      -32(%rbp), %rax                               #1221.47
-..LN865:
-        movl      -8(%rbp), %edx                                #1221.53
-..LN867:
-        movq      -72(%rbp), %rcx                               #1221.65
-..LN869:
-        movq      -72(%rbp), %rbx                               #1221.76
-        negq      %rbx                                          #1221.76
-        addq      -48(%rbp), %rbx                               #1221.76
-..LN871:
-        movq      %rax, %rdi                                    #1221.24
-        movl      %edx, %esi                                    #1221.24
-        movq      %rcx, %rdx                                    #1221.24
-        movq      %rbx, %rcx                                    #1221.24
-        call      NucStrFastaExprMake2 at PLT                      #1221.24
-                                # LOE eax
-..B9.20:                        # Preds ..B9.13
-        movl      %eax, -80(%rbp)                               #1221.24
-                                # LOE
-..B9.14:                        # Preds ..B9.20
-..LN873:
-        movq      -24(%rbp), %rax                               #1221.13
-        movl      -80(%rbp), %edx                               #1221.13
-        movl      %edx, (%rax)                                  #1221.13
-        jmp       ..B9.17       # Prob 100%                     #1221.13
-                                # LOE
-..B9.15:                        # Preds ..B9.12
-..LN875:
-        movq      -32(%rbp), %rax                               #1223.47
-..LN877:
-        movl      -8(%rbp), %edx                                #1223.53
-..LN879:
-        movq      -72(%rbp), %rcx                               #1223.65
-..LN881:
-        movq      -72(%rbp), %rbx                               #1223.76
-        negq      %rbx                                          #1223.76
-        addq      -48(%rbp), %rbx                               #1223.76
-..LN883:
-        movq      %rax, %rdi                                    #1223.24
-        movl      %edx, %esi                                    #1223.24
-        movq      %rcx, %rdx                                    #1223.24
-        movq      %rbx, %rcx                                    #1223.24
-        call      NucStrFastaExprMake4 at PLT                      #1223.24
-                                # LOE eax
-..B9.21:                        # Preds ..B9.15
-        movl      %eax, -76(%rbp)                               #1223.24
-                                # LOE
-..B9.16:                        # Preds ..B9.21
-..LN885:
-        movq      -24(%rbp), %rax                               #1223.13
-        movl      -76(%rbp), %edx                               #1223.13
-        movl      %edx, (%rax)                                  #1223.13
-                                # LOE
-..B9.17:                        # Preds ..B9.2 ..B9.11 ..B9.14 ..B9.16
-..LN887:
-        movq      -48(%rbp), %rax                               #1226.12
-        movq      -16(%rbp), %rbx                               #1226.12
-..___tag_value_nss_FASTA_expr.94:                               #
-        leave                                                   #1226.12
-..___tag_value_nss_FASTA_expr.96:                               #
-        ret                                                     #1226.12
-        .align    2,0x90
-..___tag_value_nss_FASTA_expr.97:                               #
-                                # LOE
-# mark_end;
-	.type	nss_FASTA_expr, at function
-	.size	nss_FASTA_expr,.-nss_FASTA_expr
-.LNnss_FASTA_expr:
-	.data
-# -- End  nss_FASTA_expr
-	.text
-# -- Begin  nss_fasta_expr
-# mark_begin;
-       .align    2,0x90
-nss_fasta_expr:
-# parameter 1(p): %rdi
-# parameter 2(end): %rsi
-# parameter 3(expr): %rdx
-# parameter 4(status): %rcx
-# parameter 5(positional): %r8d
-..B10.1:                        # Preds ..B10.0
-..___tag_value_nss_fasta_expr.100:                              #
-..LN889:
-        pushq     %rbp                                          #1234.1
-        movq      %rsp, %rbp                                    #1234.1
-..___tag_value_nss_fasta_expr.101:                              #
-        subq      $112, %rsp                                    #1234.1
-        movq      %rbx, -16(%rbp)                               #1234.1
-..___tag_value_nss_fasta_expr.104:                              #
-        movq      %rdi, -48(%rbp)                               #1234.1
-        movq      %rsi, -40(%rbp)                               #1234.1
-        movq      %rdx, -32(%rbp)                               #1234.1
-        movq      %rcx, -24(%rbp)                               #1234.1
-        movl      %r8d, -8(%rbp)                                #1234.1
-..LN891:
-        movq      -48(%rbp), %rax                               #1235.5
-        movq      -40(%rbp), %rdx                               #1235.5
-        cmpq      %rdx, %rax                                    #1235.5
-        jb        ..B10.3       # Prob 50%                      #1235.5
-                                # LOE
-..B10.2:                        # Preds ..B10.1
-        lea       _2__STRING.3.0(%rip), %rax                    #1235.5
-        lea       _2__STRING.1.0(%rip), %rdx                    #1235.5
-        lea       __$U1.0(%rip), %rcx                           #1235.5
-        movq      %rax, %rdi                                    #1235.5
-        movq      %rdx, %rsi                                    #1235.5
-        movl      $1235, %edx                                   #1235.5
-        call      __assert_fail at PLT                             #1235.5
-                                # LOE
-..B10.3:                        # Preds ..B10.1
-..LN893:
-        movq      -48(%rbp), %rax                               #1236.16
-        movzbl    (%rax), %eax                                  #1236.16
-        movsbq    %al, %rax                                     #1236.16
-        movl      %eax, -56(%rbp)                               #1236.16
-        cmpl      $39, %eax                                     #1236.16
-        je        ..B10.5       # Prob 50%                      #1236.16
-                                # LOE
-..B10.4:                        # Preds ..B10.3
-        movl      -56(%rbp), %eax                               #1236.16
-        cmpl      $34, %eax                                     #1236.16
-        je        ..B10.13      # Prob 50%                      #1236.16
-        jmp       ..B10.21      # Prob 100%                     #1236.16
-                                # LOE
-..B10.5:                        # Preds ..B10.3
-..LN895:
-        movq      -48(%rbp), %rax                               #1239.30
-        incq      %rax                                          #1239.30
-..LN897:
-        movq      -40(%rbp), %rdx                               #1239.37
-..LN899:
-        movq      -32(%rbp), %rcx                               #1239.42
-..LN901:
-        movq      -24(%rbp), %rbx                               #1239.48
-..LN903:
-        movl      -8(%rbp), %esi                                #1239.56
-..LN905:
-        movq      %rax, %rdi                                    #1239.13
-        movl      %esi, -64(%rbp)                               #1239.13
-        movq      %rdx, %rsi                                    #1239.13
-        movq      %rcx, %rdx                                    #1239.13
-        movq      %rbx, %rcx                                    #1239.13
-        movl      -64(%rbp), %eax                               #1239.13
-        movl      %eax, %r8d                                    #1239.13
-        call      nss_FASTA_expr at PLT                            #1239.13
-                                # LOE rax
-..B10.26:                       # Preds ..B10.5
-        movq      %rax, -72(%rbp)                               #1239.13
-                                # LOE
-..B10.6:                        # Preds ..B10.26
-..LN907:
-        movq      -72(%rbp), %rax                               #1239.9
-        movq      %rax, -48(%rbp)                               #1239.9
-..LN909:
-        movq      -24(%rbp), %rax                               #1240.16
-        movl      (%rax), %eax                                  #1240.16
-..LN911:
-        testl     %eax, %eax                                    #1240.26
-        jne       ..B10.23      # Prob 50%                      #1240.26
-                                # LOE
-..B10.7:                        # Preds ..B10.6
-..LN913:
-        movq      -48(%rbp), %rax                               #1240.33
-..LN915:
-        movq      -40(%rbp), %rdx                               #1240.38
-        cmpq      %rdx, %rax                                    #1240.38
-        je        ..B10.12      # Prob 50%                      #1240.38
-                                # LOE
-..B10.8:                        # Preds ..B10.7
-..LN917:
-        movq      -48(%rbp), %rax                               #1240.47
-        movzbl    (%rax), %eax                                  #1240.47
-        movsbq    %al, %rax                                     #1240.47
-..LN919:
-        cmpl      $39, %eax                                     #1240.55
-        jne       ..B10.10      # Prob 50%                      #1240.55
-                                # LOE
-..B10.9:                        # Preds ..B10.8
-        movl      $0, -108(%rbp)                                #1240.55
-        jmp       ..B10.11      # Prob 100%                     #1240.55
-                                # LOE
-..B10.10:                       # Preds ..B10.8
-        movl      $1, -108(%rbp)                                #1240.55
-                                # LOE
-..B10.11:                       # Preds ..B10.10 ..B10.9
-..LN921:
-        movl      -108(%rbp), %eax                              #1240.47
-        incq      -48(%rbp)                                     #1240.47
-..LN923:
-        testl     %eax, %eax                                    #1240.55
-        je        ..B10.23      # Prob 100%                     #1240.55
-                                # LOE
-..B10.12:                       # Preds ..B10.7 ..B10.11
-..LN925:
-        movq      -24(%rbp), %rax                               #1241.13
-        movl      $22, (%rax)                                   #1241.13
-        jmp       ..B10.23      # Prob 100%                     #1241.13
-                                # LOE
-..B10.13:                       # Preds ..B10.4
-..LN927:
-        movq      -48(%rbp), %rax                               #1244.30
-        incq      %rax                                          #1244.30
-..LN929:
-        movq      -40(%rbp), %rdx                               #1244.37
-..LN931:
-        movq      -32(%rbp), %rcx                               #1244.42
-..LN933:
-        movq      -24(%rbp), %rbx                               #1244.48
-..LN935:
-        movl      -8(%rbp), %esi                                #1244.56
-..LN937:
-        movq      %rax, %rdi                                    #1244.13
-        movl      %esi, -88(%rbp)                               #1244.13
-        movq      %rdx, %rsi                                    #1244.13
-        movq      %rcx, %rdx                                    #1244.13
-        movq      %rbx, %rcx                                    #1244.13
-        movl      -88(%rbp), %eax                               #1244.13
-        movl      %eax, %r8d                                    #1244.13
-        call      nss_FASTA_expr at PLT                            #1244.13
-                                # LOE rax
-..B10.27:                       # Preds ..B10.13
-        movq      %rax, -104(%rbp)                              #1244.13
-                                # LOE
-..B10.14:                       # Preds ..B10.27
-..LN939:
-        movq      -104(%rbp), %rax                              #1244.9
-        movq      %rax, -48(%rbp)                               #1244.9
-..LN941:
-        movq      -24(%rbp), %rax                               #1245.16
-        movl      (%rax), %eax                                  #1245.16
-..LN943:
-        testl     %eax, %eax                                    #1245.26
-        jne       ..B10.23      # Prob 50%                      #1245.26
-                                # LOE
-..B10.15:                       # Preds ..B10.14
-..LN945:
-        movq      -48(%rbp), %rax                               #1245.33
-..LN947:
-        movq      -40(%rbp), %rdx                               #1245.38
-        cmpq      %rdx, %rax                                    #1245.38
-        je        ..B10.20      # Prob 50%                      #1245.38
-                                # LOE
-..B10.16:                       # Preds ..B10.15
-..LN949:
-        movq      -48(%rbp), %rax                               #1245.47
-        movzbl    (%rax), %eax                                  #1245.47
-        movsbq    %al, %rax                                     #1245.47
-..LN951:
-        cmpl      $34, %eax                                     #1245.55
-        jne       ..B10.18      # Prob 50%                      #1245.55
-                                # LOE
-..B10.17:                       # Preds ..B10.16
-        movl      $0, -112(%rbp)                                #1245.55
-        jmp       ..B10.19      # Prob 100%                     #1245.55
-                                # LOE
-..B10.18:                       # Preds ..B10.16
-        movl      $1, -112(%rbp)                                #1245.55
-                                # LOE
-..B10.19:                       # Preds ..B10.18 ..B10.17
-..LN953:
-        movl      -112(%rbp), %eax                              #1245.47
-        incq      -48(%rbp)                                     #1245.47
-..LN955:
-        testl     %eax, %eax                                    #1245.55
-        je        ..B10.23      # Prob 100%                     #1245.55
-                                # LOE
-..B10.20:                       # Preds ..B10.15 ..B10.19
-..LN957:
-        movq      -24(%rbp), %rax                               #1246.13
-        movl      $22, (%rax)                                   #1246.13
-        jmp       ..B10.23      # Prob 100%                     #1246.13
-                                # LOE
-..B10.21:                       # Preds ..B10.4
-..LN959:
-        movq      -48(%rbp), %rax                               #1249.33
-..LN961:
-        movq      -40(%rbp), %rdx                               #1249.36
-..LN963:
-        movq      -32(%rbp), %rcx                               #1249.41
-..LN965:
-        movq      -24(%rbp), %rbx                               #1249.47
-..LN967:
-        movl      -8(%rbp), %esi                                #1249.55
-..LN969:
-        movq      %rax, %rdi                                    #1249.16
-        movl      %esi, -80(%rbp)                               #1249.16
-        movq      %rdx, %rsi                                    #1249.16
-        movq      %rcx, %rdx                                    #1249.16
-        movq      %rbx, %rcx                                    #1249.16
-        movl      -80(%rbp), %eax                               #1249.16
-        movl      %eax, %r8d                                    #1249.16
-        call      nss_FASTA_expr at PLT                            #1249.16
-                                # LOE rax
-..B10.28:                       # Preds ..B10.21
-        movq      %rax, -96(%rbp)                               #1249.16
-                                # LOE
-..B10.22:                       # Preds ..B10.28
-        movq      -96(%rbp), %rax                               #1249.16
-        movq      -16(%rbp), %rbx                               #1249.16
-..___tag_value_nss_fasta_expr.105:                              #
-        leave                                                   #1249.16
-..___tag_value_nss_fasta_expr.107:                              #
-        ret                                                     #1249.16
-..___tag_value_nss_fasta_expr.108:                              #
-                                # LOE
-..B10.23:                       # Preds ..B10.12 ..B10.11 ..B10.6 ..B10.20 ..B10.19
-                                #       ..B10.14
-..LN971:
-        movq      -48(%rbp), %rax                               #1252.12
-        movq      -16(%rbp), %rbx                               #1252.12
-..___tag_value_nss_fasta_expr.110:                              #
-        leave                                                   #1252.12
-..___tag_value_nss_fasta_expr.112:                              #
-        ret                                                     #1252.12
-        .align    2,0x90
-..___tag_value_nss_fasta_expr.113:                              #
-                                # LOE
-# mark_end;
-	.type	nss_fasta_expr, at function
-	.size	nss_fasta_expr,.-nss_fasta_expr
-.LNnss_fasta_expr:
-	.data
-# -- End  nss_fasta_expr
-	.text
-# -- Begin  nss_primary_expr
-# mark_begin;
-       .align    2,0x90
-nss_primary_expr:
-# parameter 1(p): %rdi
-# parameter 2(end): %rsi
-# parameter 3(expr): %rdx
-# parameter 4(status): %rcx
-# parameter 5(positional): %r8d
-..B11.1:                        # Preds ..B11.0
-..___tag_value_nss_primary_expr.116:                            #
-..LN973:
-        pushq     %rbp                                          #1291.1
-        movq      %rsp, %rbp                                    #1291.1
-..___tag_value_nss_primary_expr.117:                            #
-        subq      $160, %rsp                                    #1291.1
-        movq      %rbx, -16(%rbp)                               #1291.1
-..___tag_value_nss_primary_expr.120:                            #
-        movq      %rdi, -48(%rbp)                               #1291.1
-        movq      %rsi, -40(%rbp)                               #1291.1
-        movq      %rdx, -32(%rbp)                               #1291.1
-        movq      %rcx, -24(%rbp)                               #1291.1
-        movl      %r8d, -8(%rbp)                                #1291.1
-..LN975:
-        movq      -48(%rbp), %rax                               #1294.5
-        movq      -40(%rbp), %rdx                               #1294.5
-        cmpq      %rdx, %rax                                    #1294.5
-        jb        ..B11.3       # Prob 50%                      #1294.5
-                                # LOE
-..B11.2:                        # Preds ..B11.1
-        lea       _2__STRING.3.0(%rip), %rax                    #1294.5
-        lea       _2__STRING.1.0(%rip), %rdx                    #1294.5
-        lea       __$U2.0(%rip), %rcx                           #1294.5
-        movq      %rax, %rdi                                    #1294.5
-        movq      %rdx, %rsi                                    #1294.5
-        movl      $1294, %edx                                   #1294.5
-        call      __assert_fail at PLT                             #1294.5
-                                # LOE
-..B11.3:                        # Preds ..B11.1
-..LN977:
-        movq      -48(%rbp), %rax                               #1295.16
-        movzbl    (%rax), %eax                                  #1295.16
-        movsbq    %al, %rax                                     #1295.16
-        movl      %eax, -56(%rbp)                               #1295.16
-        cmpl      $94, %eax                                     #1295.16
-        je        ..B11.5       # Prob 50%                      #1295.16
-                                # LOE
-..B11.4:                        # Preds ..B11.3
-        movl      -56(%rbp), %eax                               #1295.16
-        cmpl      $40, %eax                                     #1295.16
-        je        ..B11.12      # Prob 50%                      #1295.16
-        jmp       ..B11.25      # Prob 100%                     #1295.16
-                                # LOE
-..B11.5:                        # Preds ..B11.3
-..LN979:
-        movl      $16, %edi                                     #1298.13
-        call      malloc at PLT                                    #1298.13
-                                # LOE rax
-..B11.38:                       # Preds ..B11.5
-        movq      %rax, -64(%rbp)                               #1298.13
-                                # LOE
-..B11.6:                        # Preds ..B11.38
-..LN981:
-        movq      -64(%rbp), %rax                               #1298.9
-        movq      %rax, -72(%rbp)                               #1298.9
-..LN983:
-        movq      -72(%rbp), %rax                               #1299.14
-..LN985:
-        testq     %rax, %rax                                    #1299.19
-        jne       ..B11.8       # Prob 50%                      #1299.19
-                                # LOE
-..B11.7:                        # Preds ..B11.6
-..LN987:
-        call      __errno_location at PLT                          #1300.24
-                                # LOE rax
-..B11.39:                       # Preds ..B11.7
-..LN989:
-        movq      -24(%rbp), %rdx                               #1300.13
-..LN991:
-        movl      (%rax), %eax                                  #1300.24
-..LN993:
-        movl      %eax, (%rdx)                                  #1300.13
-        jmp       ..B11.11      # Prob 100%                     #1300.13
-                                # LOE
-..B11.8:                        # Preds ..B11.6
-..LN995:
-        movq      -72(%rbp), %rax                               #1303.13
-        movl      $12, (%rax)                                   #1303.13
-..LN997:
-        movq      -72(%rbp), %rax                               #1304.13
-        movl      $14, 4(%rax)                                  #1304.13
-..LN999:
-        movq      -72(%rbp), %rax                               #1305.13
-        movq      $0, 8(%rax)                                   #1305.13
-..LN1001:
-        movq      -32(%rbp), %rax                               #1306.13
-..LN1003:
-        movq      -72(%rbp), %rdx                               #1306.22
-..LN1005:
-        movq      %rdx, (%rax)                                  #1306.13
-..LN1007:
-        movq      -48(%rbp), %rax                               #1308.27
-        incq      %rax                                          #1308.27
-..LN1009:
-        movq      -40(%rbp), %rdx                               #1308.34
-..LN1011:
-        movq      %rax, %rdi                                    #1308.17
-        movq      %rdx, %rsi                                    #1308.17
-        call      nss_sob at PLT                                   #1308.17
-                                # LOE rax
-..B11.40:                       # Preds ..B11.8
-        movq      %rax, -120(%rbp)                              #1308.17
-                                # LOE
-..B11.9:                        # Preds ..B11.40
-..LN1013:
-        movq      -120(%rbp), %rax                              #1308.13
-        movq      %rax, -48(%rbp)                               #1308.13
-..LN1015:
-        movq      -48(%rbp), %rax                               #1309.17
-        movq      -40(%rbp), %rdx                               #1309.17
-        movq      -72(%rbp), %rcx                               #1309.17
-        addq      $8, %rcx                                      #1309.17
-        movq      -24(%rbp), %rbx                               #1309.17
-        movl      -8(%rbp), %esi                                #1309.17
-        movq      %rax, %rdi                                    #1309.17
-        movl      %esi, -88(%rbp)                               #1309.17
-        movq      %rdx, %rsi                                    #1309.17
-        movq      %rcx, %rdx                                    #1309.17
-        movq      %rbx, %rcx                                    #1309.17
-        movl      -88(%rbp), %eax                               #1309.17
-        movl      %eax, %r8d                                    #1309.17
-        call      nss_fasta_expr at PLT                            #1309.17
-                                # LOE rax
-..B11.41:                       # Preds ..B11.9
-        movq      %rax, -112(%rbp)                              #1309.17
-                                # LOE
-..B11.10:                       # Preds ..B11.41
-..LN1017:
-        movq      -112(%rbp), %rax                              #1309.13
-        movq      %rax, -48(%rbp)                               #1309.13
-                                # LOE
-..B11.11:                       # Preds ..B11.39 ..B11.10
-..LN1019:
-        movq      -48(%rbp), %rax                               #1311.16
-        movq      -16(%rbp), %rbx                               #1311.16
-..___tag_value_nss_primary_expr.121:                            #
-        leave                                                   #1311.16
-..___tag_value_nss_primary_expr.123:                            #
-        ret                                                     #1311.16
-..___tag_value_nss_primary_expr.124:                            #
-                                # LOE
-..B11.12:                       # Preds ..B11.4
-..LN1021:
-        movl      $16, %edi                                     #1313.13
-        call      malloc at PLT                                    #1313.13
-                                # LOE rax
-..B11.42:                       # Preds ..B11.12
-        movq      %rax, -104(%rbp)                              #1313.13
-                                # LOE
-..B11.13:                       # Preds ..B11.42
-..LN1023:
-        movq      -104(%rbp), %rax                              #1313.9
-        movq      %rax, -72(%rbp)                               #1313.9
-..LN1025:
-        movq      -72(%rbp), %rax                               #1314.14
-..LN1027:
-        testq     %rax, %rax                                    #1314.19
-        jne       ..B11.15      # Prob 50%                      #1314.19
-                                # LOE
-..B11.14:                       # Preds ..B11.13
-..LN1029:
-        call      __errno_location at PLT                          #1315.24
-                                # LOE rax
-..B11.43:                       # Preds ..B11.14
-..LN1031:
-        movq      -24(%rbp), %rdx                               #1315.13
-..LN1033:
-        movl      (%rax), %eax                                  #1315.24
-..LN1035:
-        movl      %eax, (%rdx)                                  #1315.13
-        jmp       ..B11.24      # Prob 100%                     #1315.13
-                                # LOE
-..B11.15:                       # Preds ..B11.13
-..LN1037:
-        movq      -72(%rbp), %rax                               #1318.13
-        movl      $12, (%rax)                                   #1318.13
-..LN1039:
-        movq      -72(%rbp), %rax                               #1319.13
-        movl      $0, 4(%rax)                                   #1319.13
-..LN1041:
-        movq      -32(%rbp), %rax                               #1320.13
-..LN1043:
-        movq      -72(%rbp), %rdx                               #1320.22
-..LN1045:
-        movq      %rdx, (%rax)                                  #1320.13
-..LN1047:
-        movq      -48(%rbp), %rax                               #1322.28
-        incq      %rax                                          #1322.28
-..LN1049:
-        movq      -40(%rbp), %rdx                               #1322.35
-..LN1051:
-        movq      -72(%rbp), %rcx                               #1322.42
-        addq      $8, %rcx                                      #1322.42
-..LN1053:
-        movq      -24(%rbp), %rbx                               #1322.59
-..LN1055:
-        movl      -8(%rbp), %esi                                #1322.67
-..LN1057:
-        movq      %rax, %rdi                                    #1322.17
-        movl      %esi, -128(%rbp)                              #1322.17
-        movq      %rdx, %rsi                                    #1322.17
-        movq      %rcx, %rdx                                    #1322.17
-        movq      %rbx, %rcx                                    #1322.17
-        movl      -128(%rbp), %eax                              #1322.17
-        movl      %eax, %r8d                                    #1322.17
-        call      nss_expr at PLT                                  #1322.17
-                                # LOE rax
-..B11.44:                       # Preds ..B11.15
-        movq      %rax, -136(%rbp)                              #1322.17
-                                # LOE
-..B11.16:                       # Preds ..B11.44
-..LN1059:
-        movq      -136(%rbp), %rax                              #1322.13
-        movq      %rax, -48(%rbp)                               #1322.13
-..LN1061:
-        movq      -24(%rbp), %rax                               #1323.20
-        movl      (%rax), %eax                                  #1323.20
-..LN1063:
-        testl     %eax, %eax                                    #1323.30
-        jne       ..B11.24      # Prob 50%                      #1323.30
-                                # LOE
-..B11.17:                       # Preds ..B11.16
-..LN1065:
-        movq      -72(%rbp), %rax                               #1325.22
-        movq      8(%rax), %rax                                 #1325.22
-..LN1067:
-        testq     %rax, %rax                                    #1325.41
-        je        ..B11.23      # Prob 50%                      #1325.41
-                                # LOE
-..B11.18:                       # Preds ..B11.17
-..LN1069:
-        movq      -48(%rbp), %rax                               #1325.49
-..LN1071:
-        movq      -40(%rbp), %rdx                               #1325.54
-        cmpq      %rdx, %rax                                    #1325.54
-        je        ..B11.23      # Prob 50%                      #1325.54
-                                # LOE
-..B11.19:                       # Preds ..B11.18
-..LN1073:
-        movq      -48(%rbp), %rax                               #1325.63
-        movzbl    (%rax), %eax                                  #1325.63
-        movsbq    %al, %rax                                     #1325.63
-..LN1075:
-        cmpl      $41, %eax                                     #1325.71
-        jne       ..B11.21      # Prob 50%                      #1325.71
-                                # LOE
-..B11.20:                       # Preds ..B11.19
-        movl      $0, -152(%rbp)                                #1325.71
-        jmp       ..B11.22      # Prob 100%                     #1325.71
-                                # LOE
-..B11.21:                       # Preds ..B11.19
-        movl      $1, -152(%rbp)                                #1325.71
-                                # LOE
-..B11.22:                       # Preds ..B11.21 ..B11.20
-..LN1077:
-        movl      -152(%rbp), %eax                              #1325.63
-        incq      -48(%rbp)                                     #1325.63
-..LN1079:
-        testl     %eax, %eax                                    #1325.71
-        je        ..B11.24      # Prob 100%                     #1325.71
-                                # LOE
-..B11.23:                       # Preds ..B11.17 ..B11.18 ..B11.22
-..LN1081:
-        movq      -24(%rbp), %rax                               #1326.21
-        movl      $22, (%rax)                                   #1326.21
-                                # LOE
-..B11.24:                       # Preds ..B11.43 ..B11.23 ..B11.22 ..B11.16
-..LN1083:
-        movq      -48(%rbp), %rax                               #1329.16
-        movq      -16(%rbp), %rbx                               #1329.16
-..___tag_value_nss_primary_expr.126:                            #
-        leave                                                   #1329.16
-..___tag_value_nss_primary_expr.128:                            #
-        ret                                                     #1329.16
-..___tag_value_nss_primary_expr.129:                            #
-                                # LOE
-..B11.25:                       # Preds ..B11.4
-..LN1085:
-        movq      -48(%rbp), %rax                               #1332.9
-        movq      -40(%rbp), %rdx                               #1332.9
-        movq      -32(%rbp), %rcx                               #1332.9
-        movq      -24(%rbp), %rbx                               #1332.9
-        movl      -8(%rbp), %esi                                #1332.9
-        movq      %rax, %rdi                                    #1332.9
-        movl      %esi, -80(%rbp)                               #1332.9
-        movq      %rdx, %rsi                                    #1332.9
-        movq      %rcx, %rdx                                    #1332.9
-        movq      %rbx, %rcx                                    #1332.9
-        movl      -80(%rbp), %eax                               #1332.9
-        movl      %eax, %r8d                                    #1332.9
-        call      nss_fasta_expr at PLT                            #1332.9
-                                # LOE rax
-..B11.45:                       # Preds ..B11.25
-        movq      %rax, -96(%rbp)                               #1332.9
-                                # LOE
-..B11.26:                       # Preds ..B11.45
-..LN1087:
-        movq      -96(%rbp), %rax                               #1332.5
-        movq      %rax, -48(%rbp)                               #1332.5
-..LN1089:
-        movq      -24(%rbp), %rax                               #1333.12
-        movl      (%rax), %eax                                  #1333.12
-..LN1091:
-        testl     %eax, %eax                                    #1333.22
-        jne       ..B11.35      # Prob 50%                      #1333.22
-                                # LOE
-..B11.27:                       # Preds ..B11.26
-..LN1093:
-        movq      -48(%rbp), %rax                               #1333.27
-..LN1095:
-        movq      -40(%rbp), %rdx                               #1333.31
-        cmpq      %rdx, %rax                                    #1333.31
-        jae       ..B11.35      # Prob 50%                      #1333.31
-                                # LOE
-..B11.28:                       # Preds ..B11.27
-..LN1097:
-        movq      -48(%rbp), %rax                               #1335.23
-..LN1099:
-        movq      -40(%rbp), %rdx                               #1335.26
-..LN1101:
-        movq      %rax, %rdi                                    #1335.13
-        movq      %rdx, %rsi                                    #1335.13
-        call      nss_sob at PLT                                   #1335.13
-                                # LOE rax
-..B11.46:                       # Preds ..B11.28
-        movq      %rax, -144(%rbp)                              #1335.13
-                                # LOE
-..B11.29:                       # Preds ..B11.46
-..LN1103:
-        movq      -144(%rbp), %rax                              #1335.9
-        movq      %rax, -48(%rbp)                               #1335.9
-..LN1105:
-        movq      -48(%rbp), %rax                               #1336.14
-..LN1107:
-        movq      -40(%rbp), %rdx                               #1336.18
-        cmpq      %rdx, %rax                                    #1336.18
-        jae       ..B11.35      # Prob 50%                      #1336.18
-                                # LOE
-..B11.30:                       # Preds ..B11.29
-..LN1109:
-        movq      -48(%rbp), %rax                               #1336.27
-        movzbl    (%rax), %eax                                  #1336.27
-        movsbq    %al, %rax                                     #1336.27
-..LN1111:
-        cmpl      $36, %eax                                     #1336.32
-        jne       ..B11.35      # Prob 50%                      #1336.32
-                                # LOE
-..B11.31:                       # Preds ..B11.30
-..LN1113:
-        incq      -48(%rbp)                                     #1338.16
-..LN1115:
-        movl      $16, %edi                                     #1340.17
-        call      malloc at PLT                                    #1340.17
-                                # LOE rax
-..B11.47:                       # Preds ..B11.31
-        movq      %rax, -160(%rbp)                              #1340.17
-                                # LOE
-..B11.32:                       # Preds ..B11.47
-..LN1117:
-        movq      -160(%rbp), %rax                              #1340.13
-        movq      %rax, -72(%rbp)                               #1340.13
-..LN1119:
-        movq      -72(%rbp), %rax                               #1341.18
-..LN1121:
-        testq     %rax, %rax                                    #1341.23
-        jne       ..B11.34      # Prob 50%                      #1341.23
-                                # LOE
-..B11.33:                       # Preds ..B11.32
-..LN1123:
-        call      __errno_location at PLT                          #1342.28
-                                # LOE rax
-..B11.48:                       # Preds ..B11.33
-..LN1125:
-        movq      -24(%rbp), %rdx                               #1342.17
-..LN1127:
-        movl      (%rax), %eax                                  #1342.28
-..LN1129:
-        movl      %eax, (%rdx)                                  #1342.17
-        jmp       ..B11.35      # Prob 100%                     #1342.17
-                                # LOE
-..B11.34:                       # Preds ..B11.32
-..LN1131:
-        movq      -72(%rbp), %rax                               #1345.17
-        movl      $12, (%rax)                                   #1345.17
-..LN1133:
-        movq      -72(%rbp), %rax                               #1346.17
-        movl      $15, 4(%rax)                                  #1346.17
-..LN1135:
-        movq      -32(%rbp), %rax                               #1347.37
-..LN1137:
-        movq      -72(%rbp), %rdx                               #1347.17
-..LN1139:
-        movq      (%rax), %rax                                  #1347.37
-..LN1141:
-        movq      %rax, 8(%rdx)                                 #1347.17
-..LN1143:
-        movq      -32(%rbp), %rax                               #1348.17
-..LN1145:
-        movq      -72(%rbp), %rdx                               #1348.26
-..LN1147:
-        movq      %rdx, (%rax)                                  #1348.17
-                                # LOE
-..B11.35:                       # Preds ..B11.48 ..B11.34 ..B11.30 ..B11.29 ..B11.27
-                                #       ..B11.26
-..LN1149:
-        movq      -48(%rbp), %rax                               #1353.12
-        movq      -16(%rbp), %rbx                               #1353.12
-..___tag_value_nss_primary_expr.131:                            #
-        leave                                                   #1353.12
-..___tag_value_nss_primary_expr.133:                            #
-        ret                                                     #1353.12
-        .align    2,0x90
-..___tag_value_nss_primary_expr.134:                            #
-                                # LOE
-# mark_end;
-	.type	nss_primary_expr, at function
-	.size	nss_primary_expr,.-nss_primary_expr
-.LNnss_primary_expr:
-	.data
-# -- End  nss_primary_expr
-	.text
-# -- Begin  nss_unary_expr
-# mark_begin;
-       .align    2,0x90
-nss_unary_expr:
-# parameter 1(p): %rdi
-# parameter 2(end): %rsi
-# parameter 3(expr): %rdx
-# parameter 4(status): %rcx
-# parameter 5(positional): %r8d
-..B12.1:                        # Preds ..B12.0
-..___tag_value_nss_unary_expr.137:                              #
-..LN1151:
-        pushq     %rbp                                          #1361.1
-        movq      %rsp, %rbp                                    #1361.1
-..___tag_value_nss_unary_expr.138:                              #
-        subq      $112, %rsp                                    #1361.1
-        movq      %rbx, -24(%rbp)                               #1361.1
-..___tag_value_nss_unary_expr.141:                              #
-        movq      %rdi, -56(%rbp)                               #1361.1
-        movq      %rsi, -48(%rbp)                               #1361.1
-        movq      %rdx, -40(%rbp)                               #1361.1
-        movq      %rcx, -32(%rbp)                               #1361.1
-        movl      %r8d, -16(%rbp)                               #1361.1
-..LN1153:
-        movq      -56(%rbp), %rax                               #1362.5
-        movq      -48(%rbp), %rdx                               #1362.5
-        cmpq      %rdx, %rax                                    #1362.5
-        jb        ..B12.3       # Prob 50%                      #1362.5
-                                # LOE
-..B12.2:                        # Preds ..B12.1
-        lea       _2__STRING.3.0(%rip), %rax                    #1362.5
-        lea       _2__STRING.1.0(%rip), %rdx                    #1362.5
-        lea       __$U3.0(%rip), %rcx                           #1362.5
-        movq      %rax, %rdi                                    #1362.5
-        movq      %rdx, %rsi                                    #1362.5
-        movl      $1362, %edx                                   #1362.5
-        call      __assert_fail at PLT                             #1362.5
-                                # LOE
-..B12.3:                        # Preds ..B12.1
-..LN1155:
-        movq      -56(%rbp), %rax                               #1363.12
-        movzbl    (%rax), %eax                                  #1363.12
-        movsbq    %al, %rax                                     #1363.12
-..LN1157:
-        cmpl      $33, %eax                                     #1363.17
-        je        ..B12.6       # Prob 50%                      #1363.17
-                                # LOE
-..B12.4:                        # Preds ..B12.3
-..LN1159:
-        movq      -56(%rbp), %rax                               #1364.35
-..LN1161:
-        movq      -48(%rbp), %rdx                               #1364.38
-..LN1163:
-        movq      -40(%rbp), %rcx                               #1364.43
-..LN1165:
-        movq      -32(%rbp), %rbx                               #1364.49
-..LN1167:
-        movl      -16(%rbp), %esi                               #1364.57
-..LN1169:
-        movq      %rax, %rdi                                    #1364.16
-        movl      %esi, -64(%rbp)                               #1364.16
-        movq      %rdx, %rsi                                    #1364.16
-        movq      %rcx, %rdx                                    #1364.16
-        movq      %rbx, %rcx                                    #1364.16
-        movl      -64(%rbp), %eax                               #1364.16
-        movl      %eax, %r8d                                    #1364.16
-        call      nss_primary_expr at PLT                          #1364.16
-                                # LOE rax
-..B12.19:                       # Preds ..B12.4
-        movq      %rax, -80(%rbp)                               #1364.16
-                                # LOE
-..B12.5:                        # Preds ..B12.19
-        movq      -80(%rbp), %rax                               #1364.16
-        movq      -24(%rbp), %rbx                               #1364.16
-..___tag_value_nss_unary_expr.142:                              #
-        leave                                                   #1364.16
-..___tag_value_nss_unary_expr.144:                              #
-        ret                                                     #1364.16
-..___tag_value_nss_unary_expr.145:                              #
-                                # LOE
-..B12.6:                        # Preds ..B12.3
-..LN1171:
-        movq      -56(%rbp), %rax                               #1374.19
-        incq      %rax                                          #1374.19
-..LN1173:
-        movq      -48(%rbp), %rdx                               #1374.26
-..LN1175:
-        movq      %rax, %rdi                                    #1374.9
-        movq      %rdx, %rsi                                    #1374.9
-        call      nss_sob at PLT                                   #1374.9
-                                # LOE rax
-..B12.20:                       # Preds ..B12.6
-        movq      %rax, -72(%rbp)                               #1374.9
-                                # LOE
-..B12.7:                        # Preds ..B12.20
-..LN1177:
-        movq      -72(%rbp), %rax                               #1374.5
-        movq      %rax, -56(%rbp)                               #1374.5
-..LN1179:
-        movq      -56(%rbp), %rax                               #1375.10
-..LN1181:
-        movq      -48(%rbp), %rdx                               #1375.15
-        cmpq      %rdx, %rax                                    #1375.15
-        jne       ..B12.9       # Prob 50%                      #1375.15
-                                # LOE
-..B12.8:                        # Preds ..B12.7
-..LN1183:
-        movq      -32(%rbp), %rax                               #1376.9
-        movl      $22, (%rax)                                   #1376.9
-        jmp       ..B12.16      # Prob 100%                     #1376.9
-                                # LOE
-..B12.9:                        # Preds ..B12.7
-..LN1185:
-        movl      $16, %edi                                     #1379.25
-        call      malloc at PLT                                    #1379.25
-                                # LOE rax
-..B12.21:                       # Preds ..B12.9
-        movq      %rax, -88(%rbp)                               #1379.25
-                                # LOE
-..B12.10:                       # Preds ..B12.21
-..LN1187:
-        movq      -88(%rbp), %rax                               #1379.23
-        movq      %rax, -96(%rbp)                               #1379.23
-..LN1189:
-        movq      -96(%rbp), %rax                               #1380.14
-..LN1191:
-        testq     %rax, %rax                                    #1380.19
-        jne       ..B12.12      # Prob 50%                      #1380.19
-                                # LOE
-..B12.11:                       # Preds ..B12.10
-..LN1193:
-        call      __errno_location at PLT                          #1381.24
-                                # LOE rax
-..B12.22:                       # Preds ..B12.11
-..LN1195:
-        movq      -32(%rbp), %rdx                               #1381.13
-..LN1197:
-        movl      (%rax), %eax                                  #1381.24
-..LN1199:
-        movl      %eax, (%rdx)                                  #1381.13
-        jmp       ..B12.16      # Prob 100%                     #1381.13
-                                # LOE
-..B12.12:                       # Preds ..B12.10
-..LN1201:
-        movq      -96(%rbp), %rax                               #1384.13
-        movl      $12, (%rax)                                   #1384.13
-..LN1203:
-        movq      -96(%rbp), %rax                               #1385.13
-        movl      $13, 4(%rax)                                  #1385.13
-..LN1205:
-        movq      -96(%rbp), %rax                               #1386.13
-        movq      $0, 8(%rax)                                   #1386.13
-..LN1207:
-        movq      -40(%rbp), %rax                               #1387.13
-..LN1209:
-        movq      -96(%rbp), %rdx                               #1387.22
-..LN1211:
-        movq      %rdx, (%rax)                                  #1387.13
-..LN1213:
-        movq      -56(%rbp), %rax                               #1389.34
-..LN1215:
-        movq      -48(%rbp), %rdx                               #1389.37
-..LN1217:
-        movq      -96(%rbp), %rcx                               #1389.44
-        addq      $8, %rcx                                      #1389.44
-..LN1219:
-        movq      -32(%rbp), %rbx                               #1389.61
-..LN1221:
-        movl      -16(%rbp), %esi                               #1389.69
-..LN1223:
-        movq      %rax, %rdi                                    #1389.17
-        movl      %esi, -104(%rbp)                              #1389.17
-        movq      %rdx, %rsi                                    #1389.17
-        movq      %rcx, %rdx                                    #1389.17
-        movq      %rbx, %rcx                                    #1389.17
-        movl      -104(%rbp), %eax                              #1389.17
-        movl      %eax, %r8d                                    #1389.17
-        call      nss_unary_expr at PLT                            #1389.17
-                                # LOE rax
-..B12.23:                       # Preds ..B12.12
-        movq      %rax, -112(%rbp)                              #1389.17
-                                # LOE
-..B12.13:                       # Preds ..B12.23
-..LN1225:
-        movq      -112(%rbp), %rax                              #1389.13
-        movq      %rax, -56(%rbp)                               #1389.13
-..LN1227:
-        movq      -32(%rbp), %rax                               #1390.13
-        movl      (%rax), %eax                                  #1390.13
-        testl     %eax, %eax                                    #1390.13
-        jne       ..B12.16      # Prob 50%                      #1390.13
-                                # LOE
-..B12.14:                       # Preds ..B12.13
-        movq      -96(%rbp), %rax                               #1390.13
-        movq      8(%rax), %rax                                 #1390.13
-        testq     %rax, %rax                                    #1390.13
-        jne       ..B12.16      # Prob 50%                      #1390.13
-                                # LOE
-..B12.15:                       # Preds ..B12.14
-        lea       _2__STRING.4.0(%rip), %rax                    #1390.13
-        lea       _2__STRING.1.0(%rip), %rdx                    #1390.13
-        lea       __$U3.0(%rip), %rcx                           #1390.13
-        movq      %rax, %rdi                                    #1390.13
-        movq      %rdx, %rsi                                    #1390.13
-        movl      $1390, %edx                                   #1390.13
-        call      __assert_fail at PLT                             #1390.13
-                                # LOE
-..B12.16:                       # Preds ..B12.8 ..B12.22 ..B12.14 ..B12.13
-..LN1229:
-        movq      -56(%rbp), %rax                               #1393.12
-        movq      -24(%rbp), %rbx                               #1393.12
-..___tag_value_nss_unary_expr.147:                              #
-        leave                                                   #1393.12
-..___tag_value_nss_unary_expr.149:                              #
-        ret                                                     #1393.12
-        .align    2,0x90
-..___tag_value_nss_unary_expr.150:                              #
-                                # LOE
-# mark_end;
-	.type	nss_unary_expr, at function
-	.size	nss_unary_expr,.-nss_unary_expr
-.LNnss_unary_expr:
-	.data
-# -- End  nss_unary_expr
-	.text
-# -- Begin  nss_expr
-# mark_begin;
-       .align    2,0x90
-nss_expr:
-# parameter 1(p): %rdi
-# parameter 2(end): %rsi
-# parameter 3(expr): %rdx
-# parameter 4(status): %rcx
-# parameter 5(positional): %r8d
-..B13.1:                        # Preds ..B13.0
-..___tag_value_nss_expr.153:                                    #
-..LN1231:
-        pushq     %rbp                                          #1406.1
-        movq      %rsp, %rbp                                    #1406.1
-..___tag_value_nss_expr.154:                                    #
-        subq      $128, %rsp                                    #1406.1
-        movq      %rbx, -24(%rbp)                               #1406.1
-..___tag_value_nss_expr.157:                                    #
-        movq      %rdi, -64(%rbp)                               #1406.1
-        movq      %rsi, -56(%rbp)                               #1406.1
-        movq      %rdx, -48(%rbp)                               #1406.1
-        movq      %rcx, -40(%rbp)                               #1406.1
-        movl      %r8d, -16(%rbp)                               #1406.1
-..LN1233:
-        movq      -48(%rbp), %rax                               #1407.5
-        movq      $0, (%rax)                                    #1407.5
-..LN1235:
-        movq      -64(%rbp), %rax                               #1409.19
-..LN1237:
-        movq      -56(%rbp), %rdx                               #1409.22
-..LN1239:
-        movq      %rax, %rdi                                    #1409.9
-        movq      %rdx, %rsi                                    #1409.9
-        call      nss_sob at PLT                                   #1409.9
-                                # LOE rax
-..B13.32:                       # Preds ..B13.1
-        movq      %rax, -32(%rbp)                               #1409.9
-                                # LOE
-..B13.2:                        # Preds ..B13.32
-..LN1241:
-        movq      -32(%rbp), %rax                               #1409.5
-        movq      %rax, -64(%rbp)                               #1409.5
-..LN1243:
-        movq      -64(%rbp), %rax                               #1410.10
-..LN1245:
-        movq      -56(%rbp), %rdx                               #1410.15
-        cmpq      %rdx, %rax                                    #1410.15
-        je        ..B13.29      # Prob 50%                      #1410.15
-                                # LOE
-..B13.3:                        # Preds ..B13.2
-..LN1247:
-        movq      -64(%rbp), %rax                               #1412.30
-..LN1249:
-        movq      -56(%rbp), %rdx                               #1412.33
-..LN1251:
-        movq      -48(%rbp), %rcx                               #1412.38
-..LN1253:
-        movq      -40(%rbp), %rbx                               #1412.44
-..LN1255:
-        movl      -16(%rbp), %esi                               #1412.52
-..LN1257:
-        movq      %rax, %rdi                                    #1412.13
-        movl      %esi, -72(%rbp)                               #1412.13
-        movq      %rdx, %rsi                                    #1412.13
-        movq      %rcx, %rdx                                    #1412.13
-        movq      %rbx, %rcx                                    #1412.13
-        movl      -72(%rbp), %eax                               #1412.13
-        movl      %eax, %r8d                                    #1412.13
-        call      nss_unary_expr at PLT                            #1412.13
-                                # LOE rax
-..B13.33:                       # Preds ..B13.3
-        movq      %rax, -80(%rbp)                               #1412.13
-                                # LOE
-..B13.4:                        # Preds ..B13.33
-..LN1259:
-        movq      -80(%rbp), %rax                               #1412.9
-        movq      %rax, -64(%rbp)                               #1412.9
-..LN1261:
-        movq      -40(%rbp), %rax                               #1413.16
-        movl      (%rax), %eax                                  #1413.16
-..LN1263:
-        testl     %eax, %eax                                    #1413.26
-        jne       ..B13.29      # Prob 50%                      #1413.26
-                                # LOE
-..B13.5:                        # Preds ..B13.4
-..LN1265:
-        movq      -64(%rbp), %rax                               #1415.27
-..LN1267:
-        movq      -56(%rbp), %rdx                               #1415.30
-..LN1269:
-        movq      %rax, %rdi                                    #1415.17
-        movq      %rdx, %rsi                                    #1415.17
-        call      nss_sob at PLT                                   #1415.17
-                                # LOE rax
-..B13.34:                       # Preds ..B13.5
-        movq      %rax, -88(%rbp)                               #1415.17
-                                # LOE
-..B13.6:                        # Preds ..B13.34
-..LN1271:
-        movq      -88(%rbp), %rax                               #1415.13
-        movq      %rax, -64(%rbp)                               #1415.13
-..LN1273:
-        movq      -64(%rbp), %rax                               #1416.18
-..LN1275:
-        movq      -56(%rbp), %rdx                               #1416.23
-        cmpq      %rdx, %rax                                    #1416.23
-        je        ..B13.29      # Prob 50%                      #1416.23
-                                # LOE
-..B13.7:                        # Preds ..B13.6
-..LN1277:
-        movq      -48(%rbp), %rax                               #1420.17
-        movq      (%rax), %rax                                  #1420.17
-        testq     %rax, %rax                                    #1420.17
-        jne       ..B13.9       # Prob 50%                      #1420.17
-                                # LOE
-..B13.8:                        # Preds ..B13.7
-        lea       _2__STRING.5.0(%rip), %rax                    #1420.17
-        lea       _2__STRING.1.0(%rip), %rdx                    #1420.17
-        lea       __$U4.0(%rip), %rcx                           #1420.17
-        movq      %rax, %rdi                                    #1420.17
-        movq      %rdx, %rsi                                    #1420.17
-        movl      $1420, %edx                                   #1420.17
-        call      __assert_fail at PLT                             #1420.17
-                                # LOE
-..B13.9:                        # Preds ..B13.7
-..LN1279:
-        movq      -64(%rbp), %rax                               #1422.28
-        movzbl    (%rax), %eax                                  #1422.28
-        movsbq    %al, %rax                                     #1422.28
-        movl      %eax, -92(%rbp)                               #1422.28
-        incq      -64(%rbp)                                     #1422.28
-        cmpl      $41, %eax                                     #1422.28
-        je        ..B13.12      # Prob 50%                      #1422.28
-                                # LOE
-..B13.10:                       # Preds ..B13.9
-        movl      -92(%rbp), %eax                               #1422.28
-        cmpl      $38, %eax                                     #1422.28
-        je        ..B13.13      # Prob 50%                      #1422.28
-                                # LOE
-..B13.11:                       # Preds ..B13.10
-        movl      -92(%rbp), %eax                               #1422.28
-        cmpl      $124, %eax                                    #1422.28
-        je        ..B13.17      # Prob 50%                      #1422.28
-        jmp       ..B13.21      # Prob 100%                     #1422.28
-                                # LOE
-..B13.12:                       # Preds ..B13.9
-..LN1281:
-        movq      -64(%rbp), %rax                               #1425.28
-..LN1283:
-        decq      %rax                                          #1425.32
-        movq      -24(%rbp), %rbx                               #1425.32
-..___tag_value_nss_expr.158:                                    #
-        leave                                                   #1425.32
-..___tag_value_nss_expr.160:                                    #
-        ret                                                     #1425.32
-..___tag_value_nss_expr.161:                                    #
-                                # LOE
-..B13.13:                       # Preds ..B13.10
-..LN1285:
-        movq      -64(%rbp), %rax                               #1427.26
-..LN1287:
-        movq      -56(%rbp), %rdx                               #1427.30
-        cmpq      %rdx, %rax                                    #1427.30
-        jae       ..B13.16      # Prob 50%                      #1427.30
-                                # LOE
-..B13.14:                       # Preds ..B13.13
-..LN1289:
-        movq      -64(%rbp), %rax                               #1427.39
-        movzbl    (%rax), %eax                                  #1427.39
-        movsbq    %al, %rax                                     #1427.39
-..LN1291:
-        cmpl      $38, %eax                                     #1427.44
-        jne       ..B13.16      # Prob 50%                      #1427.44
-                                # LOE
-..B13.15:                       # Preds ..B13.14
-..LN1293:
-        incq      -64(%rbp)                                     #1428.28
-                                # LOE
-..B13.16:                       # Preds ..B13.15 ..B13.14 ..B13.13
-..LN1295:
-        movl      $16, -96(%rbp)                                #1429.21
-        jmp       ..B13.22      # Prob 100%                     #1429.21
-                                # LOE
-..B13.17:                       # Preds ..B13.11
-..LN1297:
-        movq      -64(%rbp), %rax                               #1432.26
-..LN1299:
-        movq      -56(%rbp), %rdx                               #1432.30
-        cmpq      %rdx, %rax                                    #1432.30
-        jae       ..B13.20      # Prob 50%                      #1432.30
-                                # LOE
-..B13.18:                       # Preds ..B13.17
-..LN1301:
-        movq      -64(%rbp), %rax                               #1432.39
-        movzbl    (%rax), %eax                                  #1432.39
-        movsbq    %al, %rax                                     #1432.39
-..LN1303:
-        cmpl      $124, %eax                                    #1432.44
-        jne       ..B13.20      # Prob 50%                      #1432.44
-                                # LOE
-..B13.19:                       # Preds ..B13.18
-..LN1305:
-        incq      -64(%rbp)                                     #1433.28
-                                # LOE
-..B13.20:                       # Preds ..B13.19 ..B13.18 ..B13.17
-..LN1307:
-        movl      $17, -96(%rbp)                                #1434.21
-        jmp       ..B13.22      # Prob 100%                     #1434.21
-                                # LOE
-..B13.21:                       # Preds ..B13.11
-..LN1309:
-        movq      -40(%rbp), %rax                               #1438.21
-        movl      $22, (%rax)                                   #1438.21
-..LN1311:
-        movq      -64(%rbp), %rax                               #1439.28
-..LN1313:
-        decq      %rax                                          #1439.32
-        movq      -24(%rbp), %rbx                               #1439.32
-..___tag_value_nss_expr.163:                                    #
-        leave                                                   #1439.32
-..___tag_value_nss_expr.165:                                    #
-        ret                                                     #1439.32
-..___tag_value_nss_expr.166:                                    #
-                                # LOE
-..B13.22:                       # Preds ..B13.16 ..B13.20
-..LN1315:
-        movl      $24, %edi                                     #1451.21
-        call      malloc at PLT                                    #1451.21
-                                # LOE rax
-..B13.35:                       # Preds ..B13.22
-        movq      %rax, -104(%rbp)                              #1451.21
-                                # LOE
-..B13.23:                       # Preds ..B13.35
-..LN1317:
-        movq      -104(%rbp), %rax                              #1451.17
-        movq      %rax, -112(%rbp)                              #1451.17
-..LN1319:
-        movq      -112(%rbp), %rax                              #1452.22
-..LN1321:
-        testq     %rax, %rax                                    #1452.27
-        jne       ..B13.25      # Prob 50%                      #1452.27
-                                # LOE
-..B13.24:                       # Preds ..B13.23
-..LN1323:
-        call      __errno_location at PLT                          #1454.32
-                                # LOE rax
-..B13.36:                       # Preds ..B13.24
-..LN1325:
-        movq      -40(%rbp), %rdx                               #1454.21
-..LN1327:
-        movl      (%rax), %eax                                  #1454.32
-..LN1329:
-        movl      %eax, (%rdx)                                  #1454.21
-..LN1331:
-        movq      -64(%rbp), %rax                               #1455.28
-        movq      -24(%rbp), %rbx                               #1455.28
-..___tag_value_nss_expr.168:                                    #
-        leave                                                   #1455.28
-..___tag_value_nss_expr.170:                                    #
-        ret                                                     #1455.28
-..___tag_value_nss_expr.171:                                    #
-                                # LOE
-..B13.25:                       # Preds ..B13.23
-..LN1333:
-        movq      -112(%rbp), %rax                              #1458.17
-        movl      $11, (%rax)                                   #1458.17
-..LN1335:
-        movq      -112(%rbp), %rax                              #1459.17
-..LN1337:
-        movl      -96(%rbp), %edx                               #1459.37
-..LN1339:
-        movl      %edx, 4(%rax)                                 #1459.17
-..LN1341:
-        movq      -48(%rbp), %rax                               #1460.41
-..LN1343:
-        movq      -112(%rbp), %rdx                              #1460.17
-..LN1345:
-        movq      (%rax), %rax                                  #1460.41
-..LN1347:
-        movq      %rax, 8(%rdx)                                 #1460.17
-..LN1349:
-        movq      -48(%rbp), %rax                               #1461.17
-..LN1351:
-        movq      -112(%rbp), %rdx                              #1461.26
-..LN1353:
-        movq      %rdx, (%rax)                                  #1461.17
-..LN1355:
-        movq      -64(%rbp), %rax                               #1464.32
-..LN1357:
-        movq      -56(%rbp), %rdx                               #1464.35
-..LN1359:
-        movq      -112(%rbp), %rcx                              #1464.42
-        addq      $16, %rcx                                     #1464.42
-..LN1361:
-        movq      -40(%rbp), %rbx                               #1464.64
-..LN1363:
-        movl      -16(%rbp), %esi                               #1464.72
-..LN1365:
-        movq      %rax, %rdi                                    #1464.21
-        movl      %esi, -120(%rbp)                              #1464.21
-        movq      %rdx, %rsi                                    #1464.21
-        movq      %rcx, %rdx                                    #1464.21
-        movq      %rbx, %rcx                                    #1464.21
-        movl      -120(%rbp), %eax                              #1464.21
-        movl      %eax, %r8d                                    #1464.21
-        call      nss_expr at PLT                                  #1464.21
-                                # LOE rax
-..B13.37:                       # Preds ..B13.25
-        movq      %rax, -128(%rbp)                              #1464.21
-                                # LOE
-..B13.26:                       # Preds ..B13.37
-..LN1367:
-        movq      -128(%rbp), %rax                              #1464.17
-        movq      %rax, -64(%rbp)                               #1464.17
-..LN1369:
-        movq      -40(%rbp), %rax                               #1465.17
-        movl      (%rax), %eax                                  #1465.17
-        testl     %eax, %eax                                    #1465.17
-        jne       ..B13.29      # Prob 50%                      #1465.17
-                                # LOE
-..B13.27:                       # Preds ..B13.26
-        movq      -112(%rbp), %rax                              #1465.17
-        movq      16(%rax), %rax                                #1465.17
-        testq     %rax, %rax                                    #1465.17
-        jne       ..B13.29      # Prob 50%                      #1465.17
-                                # LOE
-..B13.28:                       # Preds ..B13.27
-        lea       _2__STRING.6.0(%rip), %rax                    #1465.17
-        lea       _2__STRING.1.0(%rip), %rdx                    #1465.17
-        lea       __$U4.0(%rip), %rcx                           #1465.17
-        movq      %rax, %rdi                                    #1465.17
-        movq      %rdx, %rsi                                    #1465.17
-        movl      $1465, %edx                                   #1465.17
-        call      __assert_fail at PLT                             #1465.17
-                                # LOE
-..B13.29:                       # Preds ..B13.27 ..B13.26 ..B13.6 ..B13.4 ..B13.2
-                                #      
-..LN1371:
-        movq      -64(%rbp), %rax                               #1470.12
-        movq      -24(%rbp), %rbx                               #1470.12
-..___tag_value_nss_expr.173:                                    #
-        leave                                                   #1470.12
-..___tag_value_nss_expr.175:                                    #
-        ret                                                     #1470.12
-        .align    2,0x90
-..___tag_value_nss_expr.176:                                    #
-                                # LOE
-# mark_end;
-	.type	nss_expr, at function
-	.size	nss_expr,.-nss_expr
-.LNnss_expr:
-	.data
-# -- End  nss_expr
-	.text
-# -- Begin  NucStrstrInit
-# mark_begin;
-       .align    2,0x90
-NucStrstrInit:
-..B14.1:                        # Preds ..B14.0
-..___tag_value_NucStrstrInit.179:                               #
-..LN1373:
-        pushq     %rbp                                          #1484.1
-        movq      %rsp, %rbp                                    #1484.1
-..___tag_value_NucStrstrInit.180:                               #
-        subq      $64, %rsp                                     #1484.1
-..LN1375:
-        lea       _2__STRING.7.0(%rip), %rax                    #1487.29
-        movq      %rax, -64(%rbp)                               #1487.29
-..LN1377:
-        lea       _2__STRING.8.0(%rip), %rax                    #1488.25
-        movq      %rax, -56(%rbp)                               #1488.25
-..LN1379:
-        lea       fasta_2na_map.0(%rip), %rax                   #1491.14
-..LN1381:
-        movq      %rax, %rdi                                    #1491.5
-        movl      $-1, %esi                                     #1491.5
-        movl      $128, %edx                                    #1491.5
-        call      memset at PLT                                    #1491.5
-                                # LOE
-..B14.2:                        # Preds ..B14.1
-..LN1383:
-        lea       fasta_4na_map.0(%rip), %rax                   #1492.14
-..LN1385:
-        movq      %rax, %rdi                                    #1492.5
-        movl      $-1, %esi                                     #1492.5
-        movl      $128, %edx                                    #1492.5
-        call      memset at PLT                                    #1492.5
-                                # LOE
-..B14.3:                        # Preds ..B14.2
-..LN1387:
-        movl      $0, -40(%rbp)                                 #1495.11
-..LN1389:
-        movq      -64(%rbp), %rax                               #1495.22
-..LN1391:
-        movq      %rax, -48(%rbp)                               #1495.18
-..LN1393:
-        movq      -48(%rbp), %rax                               #1495.31
-        movzbl    (%rax), %eax                                  #1495.31
-        movsbq    %al, %rax                                     #1495.31
-..LN1395:
-        testl     %eax, %eax                                    #1495.42
-        je        ..B14.7       # Prob 50%                      #1495.42
-                                # LOE
-..B14.5:                        # Preds ..B14.3 ..B14.6
-..LN1397:
-        movq      -48(%rbp), %rax                               #1497.14
-        movzbl    (%rax), %eax                                  #1497.14
-        movsbq    %al, %rax                                     #1497.14
-..LN1399:
-        movl      %eax, -36(%rbp)                               #1497.9
-..LN1401:
-        movl      -40(%rbp), %eax                               #1498.78
-        movl      %eax, -32(%rbp)                               #1498.78
-..LN1403:
-        movl      -36(%rbp), %eax                               #1498.58
-..LN1405:
-        movl      %eax, %edi                                    #1498.48
-        call      tolower at PLT                                   #1498.48
-                                # LOE eax
-..B14.20:                       # Preds ..B14.5
-        movl      %eax, -28(%rbp)                               #1498.48
-                                # LOE
-..B14.6:                        # Preds ..B14.20
-..LN1407:
-        movl      -28(%rbp), %eax                               #1498.32
-        movslq    %eax, %rax                                    #1498.32
-        lea       fasta_2na_map.0(%rip), %rdx                   #1498.32
-        movl      -32(%rbp), %ecx                               #1498.32
-        movb      %cl, (%rax,%rdx)                              #1498.32
-..LN1409:
-        movl      -36(%rbp), %eax                               #1498.25
-..LN1411:
-        movslq    %eax, %rax                                    #1498.9
-        lea       fasta_2na_map.0(%rip), %rdx                   #1498.9
-        movl      -32(%rbp), %ecx                               #1498.9
-        movb      %cl, (%rax,%rdx)                              #1498.9
-..LN1413:
-        incl      -40(%rbp)                                     #1495.48
-..LN1415:
-        incq      -48(%rbp)                                     #1495.54
-..LN1417:
-        movq      -48(%rbp), %rax                               #1495.31
-        movzbl    (%rax), %eax                                  #1495.31
-        movsbq    %al, %rax                                     #1495.31
-..LN1419:
-        testl     %eax, %eax                                    #1495.42
-        jne       ..B14.5       # Prob 50%                      #1495.42
-                                # LOE
-..B14.7:                        # Preds ..B14.6 ..B14.3
-..LN1421:
-        movl      $0, -40(%rbp)                                 #1502.11
-..LN1423:
-        movq      -56(%rbp), %rax                               #1502.22
-..LN1425:
-        movq      %rax, -48(%rbp)                               #1502.18
-..LN1427:
-        movq      -48(%rbp), %rax                               #1502.31
-        movzbl    (%rax), %eax                                  #1502.31
-        movsbq    %al, %rax                                     #1502.31
-..LN1429:
-        testl     %eax, %eax                                    #1502.42
-        je        ..B14.11      # Prob 50%                      #1502.42
-                                # LOE
-..B14.9:                        # Preds ..B14.7 ..B14.10
-..LN1431:
-        movq      -48(%rbp), %rax                               #1504.14
-        movzbl    (%rax), %eax                                  #1504.14
-        movsbq    %al, %rax                                     #1504.14
-..LN1433:
-        movl      %eax, -36(%rbp)                               #1504.9
-..LN1435:
-        movl      -40(%rbp), %eax                               #1505.78
-        movl      %eax, -24(%rbp)                               #1505.78
-..LN1437:
-        movl      -36(%rbp), %eax                               #1505.58
-..LN1439:
-        movl      %eax, %edi                                    #1505.48
-        call      tolower at PLT                                   #1505.48
-                                # LOE eax
-..B14.21:                       # Preds ..B14.9
-        movl      %eax, -20(%rbp)                               #1505.48
-                                # LOE
-..B14.10:                       # Preds ..B14.21
-..LN1441:
-        movl      -20(%rbp), %eax                               #1505.32
-        movslq    %eax, %rax                                    #1505.32
-        lea       fasta_4na_map.0(%rip), %rdx                   #1505.32
-        movl      -24(%rbp), %ecx                               #1505.32
-        movb      %cl, (%rax,%rdx)                              #1505.32
-..LN1443:
-        movl      -36(%rbp), %eax                               #1505.25
-..LN1445:
-        movslq    %eax, %rax                                    #1505.9
-        lea       fasta_4na_map.0(%rip), %rdx                   #1505.9
-        movl      -24(%rbp), %ecx                               #1505.9
-        movb      %cl, (%rax,%rdx)                              #1505.9
-..LN1447:
-        incl      -40(%rbp)                                     #1502.48
-..LN1449:
-        incq      -48(%rbp)                                     #1502.54
-..LN1451:
-        movq      -48(%rbp), %rax                               #1502.31
-        movzbl    (%rax), %eax                                  #1502.31
-        movsbq    %al, %rax                                     #1502.31
-..LN1453:
-        testl     %eax, %eax                                    #1502.42
-        jne       ..B14.9       # Prob 50%                      #1502.42
-                                # LOE
-..B14.11:                       # Preds ..B14.10 ..B14.7
-..LN1455:
-        movl      $0, -40(%rbp)                                 #1510.11
-..LN1457:
-        movl      -40(%rbp), %eax                               #1510.18
-..LN1459:
-        cmpl      $256, %eax                                    #1510.22
-        jae       ..B14.17      # Prob 50%                      #1510.22
-                                # LOE
-..B14.13:                       # Preds ..B14.11 ..B14.16
-..LN1461:
-        movl      -40(%rbp), %eax                               #1511.28
-        movl      %eax, %eax                                    #1511.28
-        lea       expand_2na.0(%rip), %rdx                      #1511.28
-        movzwl    (%rdx,%rax,2), %eax                           #1511.28
-        movw      %ax, -16(%rbp)                                #1511.28
-        xorl      %eax, %eax                                    #1511.28
-        testl     %eax, %eax                                    #1511.28
-        jne       ..B14.15      # Prob 50%                      #1511.28
-                                # LOE
-..B14.14:                       # Preds ..B14.13
-..LN1463:
-        movzwl    -16(%rbp), %eax                               #1511.0
-        rorw      $8, %ax                                       #1511.0
-        movw      %ax, -12(%rbp)                                #1511.0
-        jmp       ..B14.16      # Prob 100%                     #1511.0
-                                # LOE
-..B14.15:                       # Preds ..B14.13
-..LN1465:
-        movzwl    -16(%rbp), %eax                               #1511.28
-        shrl      $8, %eax                                      #1511.28
-        movzbl    %al, %eax                                     #1511.28
-        movzwl    -16(%rbp), %edx                               #1511.28
-        movzbl    %dl, %edx                                     #1511.28
-        shll      $8, %edx                                      #1511.28
-        orl       %edx, %eax                                    #1511.28
-        movw      %ax, -12(%rbp)                                #1511.28
-                                # LOE
-..B14.16:                       # Preds ..B14.15 ..B14.14
-..LN1467:
-        movl      -40(%rbp), %eax                               #1511.22
-..LN1469:
-        movl      %eax, %eax                                    #1511.9
-        lea       expand_2na.0(%rip), %rdx                      #1511.9
-..LN1471:
-        movzwl    -12(%rbp), %ecx                               #1511.28
-..LN1473:
-        movw      %cx, (%rdx,%rax,2)                            #1511.9
-..LN1475:
-        incl      -40(%rbp)                                     #1510.30
-..LN1477:
-        movl      -40(%rbp), %eax                               #1510.18
-..LN1479:
-        cmpl      $256, %eax                                    #1510.22
-        jb        ..B14.13      # Prob 50%                      #1510.22
-                                # LOE
-..B14.17:                       # Preds ..B14.16 ..B14.11
-..LN1481:
-        leave                                                   #1513.1
-..___tag_value_NucStrstrInit.184:                               #
-        ret                                                     #1513.1
-        .align    2,0x90
-..___tag_value_NucStrstrInit.185:                               #
-                                # LOE
-# mark_end;
-	.type	NucStrstrInit, at function
-	.size	NucStrstrInit,.-NucStrstrInit
-.LNNucStrstrInit:
-	.data
-# -- End  NucStrstrInit
-	.text
-# -- Begin  NucStrstrMake
-# mark_begin;
-       .align    2,0x90
-	.globl NucStrstrMake
-NucStrstrMake:
-# parameter 1(nss): %rdi
-# parameter 2(positional): %esi
-# parameter 3(query): %rdx
-# parameter 4(len): %ecx
-..B15.1:                        # Preds ..B15.0
-..___tag_value_NucStrstrMake.188:                               #
-..LN1483:
-        pushq     %rbp                                          #1539.1
-        movq      %rsp, %rbp                                    #1539.1
-..___tag_value_NucStrstrMake.189:                               #
-        subq      $80, %rsp                                     #1539.1
-        movq      %rbx, -32(%rbp)                               #1539.1
-..___tag_value_NucStrstrMake.192:                               #
-        movq      %rdi, -48(%rbp)                               #1539.1
-        movl      %esi, -24(%rbp)                               #1539.1
-        movq      %rdx, -40(%rbp)                               #1539.1
-        movl      %ecx, -16(%rbp)                               #1539.1
-..LN1485:
-        movq      -48(%rbp), %rax                               #1540.10
-..LN1487:
-        testq     %rax, %rax                                    #1540.17
-        je        ..B15.14      # Prob 50%                      #1540.17
-                                # LOE
-..B15.2:                        # Preds ..B15.1
-..LN1489:
-        movq      -40(%rbp), %rax                               #1542.14
-..LN1491:
-        testq     %rax, %rax                                    #1542.23
-        je        ..B15.13      # Prob 50%                      #1542.23
-                                # LOE
-..B15.3:                        # Preds ..B15.2
-..LN1493:
-        movl      -16(%rbp), %eax                               #1542.31
-..LN1495:
-        testl     %eax, %eax                                    #1542.38
-        je        ..B15.13      # Prob 50%                      #1542.38
-                                # LOE
-..B15.4:                        # Preds ..B15.3
-..LN1497:
-        movl      $0, -56(%rbp)                                 #1544.24
-..LN1499:
-        lea       fasta_2na_map.0(%rip), %rax                   #1547.18
-        movzbl    (%rax), %eax                                  #1547.18
-        movsbq    %al, %rax                                     #1547.18
-..LN1501:
-        testl     %eax, %eax                                    #1547.41
-        jne       ..B15.6       # Prob 50%                      #1547.41
-                                # LOE
-..B15.5:                        # Preds ..B15.4
-..LN1503:
-        call      NucStrstrInit at PLT                             #1548.17
-                                # LOE
-..B15.6:                        # Preds ..B15.5 ..B15.4
-..LN1505:
-        movl      -16(%rbp), %eax                               #1550.27
-..LN1507:
-        movl      %eax, %eax                                    #1550.19
-        addq      -40(%rbp), %rax                               #1550.19
-..LN1509:
-        movq      %rax, -80(%rbp)                               #1550.13
-..LN1511:
-        movq      -40(%rbp), %rax                               #1551.32
-..LN1513:
-        movq      -80(%rbp), %rdx                               #1551.39
-..LN1515:
-        movq      -48(%rbp), %rcx                               #1551.44
-..LN1517:
-        lea       -56(%rbp), %rbx                               #1551.49
-..LN1519:
-        movl      -24(%rbp), %esi                               #1551.59
-..LN1521:
-        movq      %rax, %rdi                                    #1551.21
-        movl      %esi, -64(%rbp)                               #1551.21
-        movq      %rdx, %rsi                                    #1551.21
-        movq      %rcx, %rdx                                    #1551.21
-        movq      %rbx, %rcx                                    #1551.21
-        movl      -64(%rbp), %eax                               #1551.21
-        movl      %eax, %r8d                                    #1551.21
-        call      nss_expr at PLT                                  #1551.21
-                                # LOE rax
-..B15.17:                       # Preds ..B15.6
-        movq      %rax, -72(%rbp)                               #1551.21
-                                # LOE
-..B15.7:                        # Preds ..B15.17
-..LN1523:
-        movq      -72(%rbp), %rax                               #1551.13
-        movq      %rax, -40(%rbp)                               #1551.13
-..LN1525:
-        movl      -56(%rbp), %eax                               #1552.18
-..LN1527:
-        testl     %eax, %eax                                    #1552.28
-        jne       ..B15.11      # Prob 50%                      #1552.28
-                                # LOE
-..B15.8:                        # Preds ..B15.7
-..LN1529:
-        movq      -40(%rbp), %rax                               #1554.22
-..LN1531:
-        movq      -80(%rbp), %rdx                               #1554.31
-        cmpq      %rdx, %rax                                    #1554.31
-        jne       ..B15.10      # Prob 50%                      #1554.31
-                                # LOE
-..B15.9:                        # Preds ..B15.8
-..LN1533:
-        xorl      %eax, %eax                                    #1555.28
-        movq      -32(%rbp), %rbx                               #1555.28
-..___tag_value_NucStrstrMake.193:                               #
-        leave                                                   #1555.28
-..___tag_value_NucStrstrMake.195:                               #
-        ret                                                     #1555.28
-..___tag_value_NucStrstrMake.196:                               #
-                                # LOE
-..B15.10:                       # Preds ..B15.8
-..LN1535:
-        movl      $22, -56(%rbp)                                #1557.17
-                                # LOE
-..B15.11:                       # Preds ..B15.10 ..B15.7
-..LN1537:
-        movq      -48(%rbp), %rax                               #1560.32
-        movq      (%rax), %rax                                  #1560.32
-..LN1539:
-        movq      %rax, %rdi                                    #1560.13
-        call      NucStrstrWhack at PLT                            #1560.13
-                                # LOE
-..B15.12:                       # Preds ..B15.11
-..LN1541:
-        movq      -48(%rbp), %rax                               #1561.13
-        movq      $0, (%rax)                                    #1561.13
-..LN1543:
-        movl      -56(%rbp), %eax                               #1562.20
-        movq      -32(%rbp), %rbx                               #1562.20
-..___tag_value_NucStrstrMake.198:                               #
-        leave                                                   #1562.20
-..___tag_value_NucStrstrMake.200:                               #
-        ret                                                     #1562.20
-..___tag_value_NucStrstrMake.201:                               #
-                                # LOE
-..B15.13:                       # Preds ..B15.3 ..B15.2
-..LN1545:
-        movq      -48(%rbp), %rax                               #1565.9
-        movq      $0, (%rax)                                    #1565.9
-                                # LOE
-..B15.14:                       # Preds ..B15.13 ..B15.1
-..LN1547:
-        movl      $22, %eax                                     #1567.12
-        movq      -32(%rbp), %rbx                               #1567.12
-..___tag_value_NucStrstrMake.203:                               #
-        leave                                                   #1567.12
-..___tag_value_NucStrstrMake.205:                               #
-        ret                                                     #1567.12
-        .align    2,0x90
-..___tag_value_NucStrstrMake.206:                               #
-                                # LOE
-# mark_end;
-	.type	NucStrstrMake, at function
-	.size	NucStrstrMake,.-NucStrstrMake
-.LNNucStrstrMake:
-	.data
-# -- End  NucStrstrMake
-	.text
-# -- Begin  NucStrstrWhack
-# mark_begin;
-       .align    2,0x90
-	.globl NucStrstrWhack
-NucStrstrWhack:
-# parameter 1(self): %rdi
-..B16.1:                        # Preds ..B16.0
-..___tag_value_NucStrstrWhack.209:                              #
-..LN1549:
-        pushq     %rbp                                          #1574.1
-        movq      %rsp, %rbp                                    #1574.1
-..___tag_value_NucStrstrWhack.210:                              #
-        subq      $16, %rsp                                     #1574.1
-        movq      %rdi, -8(%rbp)                                #1574.1
-..LN1551:
-        movq      -8(%rbp), %rax                                #1575.10
-..LN1553:
-        testq     %rax, %rax                                    #1575.18
-        je        ..B16.22      # Prob 50%                      #1575.18
-                                # LOE
-..B16.2:                        # Preds ..B16.1
-..LN1555:
-        movq      -8(%rbp), %rax                                #1577.18
-        movl      (%rax), %eax                                  #1577.18
-        movl      %eax, -16(%rbp)                               #1577.18
-..LN1557:
-        cmpl      $12, %eax                                     #1577.9
-        ja        ..B16.21      # Prob 50%                      #1577.9
-                                # LOE
-..B16.3:                        # Preds ..B16.2
-        movl      -16(%rbp), %eax                               #1577.9
-        movl      %eax, %eax                                    #1577.9
-        lea       ..1..TPKT.18_0.0.13(%rip), %rdx               #1577.9
-        movq      (%rdx,%rax,8), %rax                           #1577.9
-        jmp       *%rax                                         #1577.9
-                                # LOE
-..1.18_0.TAG.0a.0.13:
-..1.18_0.TAG.09.0.13:
-..1.18_0.TAG.08.0.13:
-..1.18_0.TAG.07.0.13:
-..1.18_0.TAG.06.0.13:
-..1.18_0.TAG.05.0.13:
-..1.18_0.TAG.04.0.13:
-..1.18_0.TAG.03.0.13:
-..1.18_0.TAG.02.0.13:
-..1.18_0.TAG.01.0.13:
-..1.18_0.TAG.00.0.13:
-..B16.15:                       # Preds ..B16.3 ..B16.3 ..B16.3 ..B16.3 ..B16.3
-                                #       ..B16.3 ..B16.3 ..B16.3 ..B16.3 ..B16.3
-                                #       ..B16.3
-..LN1559:
-        movq      -8(%rbp), %rax                                #1593.20
-        movq      8(%rax), %rax                                 #1593.20
-..LN1561:
-        movq      %rax, -8(%rbp)                                #1593.13
-        jmp       ..B16.21      # Prob 100%                     #1593.13
-                                # LOE
-..1.18_0.TAG.0b.0.13:
-..B16.17:                       # Preds ..B16.3
-..LN1563:
-        movq      -8(%rbp), %rax                                #1597.30
-        movq      8(%rax), %rax                                 #1597.30
-..LN1565:
-        movq      %rax, %rdi                                    #1597.13
-        call      NucStrstrWhack at PLT                            #1597.13
-                                # LOE
-..B16.18:                       # Preds ..B16.17
-..LN1567:
-        movq      -8(%rbp), %rax                                #1598.30
-        movq      16(%rax), %rax                                #1598.30
-..LN1569:
-        movq      %rax, %rdi                                    #1598.13
-        call      NucStrstrWhack at PLT                            #1598.13
-        jmp       ..B16.21      # Prob 100%                     #1598.13
-                                # LOE
-..1.18_0.TAG.0c.0.13:
-..B16.20:                       # Preds ..B16.3
-..LN1571:
-        movq      -8(%rbp), %rax                                #1601.30
-        movq      8(%rax), %rax                                 #1601.30
-..LN1573:
-        movq      %rax, %rdi                                    #1601.13
-        call      NucStrstrWhack at PLT                            #1601.13
-                                # LOE
-..B16.21:                       # Preds ..B16.20 ..B16.18 ..B16.15 ..B16.2
-..LN1575:
-        movq      -8(%rbp), %rax                                #1604.16
-..LN1577:
-        movq      %rax, %rdi                                    #1604.9
-        call      free at PLT                                      #1604.9
-                                # LOE
-..B16.22:                       # Preds ..B16.21 ..B16.1
-..LN1579:
-        leave                                                   #1606.1
-..___tag_value_NucStrstrWhack.214:                              #
-        ret                                                     #1606.1
-        .align    2,0x90
-..___tag_value_NucStrstrWhack.215:                              #
-                                # LOE
-# mark_end;
-	.type	NucStrstrWhack, at function
-	.size	NucStrstrWhack,.-NucStrstrWhack
-.LNNucStrstrWhack:
-	.section .data1, "wa"
-	.align 32
-	.align 32
-..1..TPKT.18_0.0.13:
-	.quad	..1.18_0.TAG.00.0.13
-	.quad	..1.18_0.TAG.01.0.13
-	.quad	..1.18_0.TAG.02.0.13
-	.quad	..1.18_0.TAG.03.0.13
-	.quad	..1.18_0.TAG.04.0.13
-	.quad	..1.18_0.TAG.05.0.13
-	.quad	..1.18_0.TAG.06.0.13
-	.quad	..1.18_0.TAG.07.0.13
-	.quad	..1.18_0.TAG.08.0.13
-	.quad	..1.18_0.TAG.09.0.13
-	.quad	..1.18_0.TAG.0a.0.13
-	.quad	..1.18_0.TAG.0b.0.13
-	.quad	..1.18_0.TAG.0c.0.13
-	.data
-# -- End  NucStrstrWhack
-	.text
-# -- Begin  prime_buffer_2na
-# mark_begin;
-       .align    2,0x90
-prime_buffer_2na:
-# parameter 1(src): %rdi
-# parameter 2(ignore): %rsi
-..B17.1:                        # Preds ..B17.0
-..___tag_value_prime_buffer_2na.218:                            #
-..LN1581:
-        pushq     %rbp                                          #2129.1
-        movq      %rsp, %rbp                                    #2129.1
-..___tag_value_prime_buffer_2na.219:                            #
-        subq      $32, %rsp                                     #2129.1
-        movq      %rdi, -16(%rbp)                               #2129.1
-        movq      %rsi, -8(%rbp)                                #2129.1
-..LN1583:
-        movq      -16(%rbp), %rax                               #2132.23
-..LN1585:
-        testq     $15, %rax                                     #2132.29
-..LN1587:
-        jne       ..B17.3       # Prob 50%                      #2132.37
-                                # LOE
-..B17.2:                        # Preds ..B17.1
-..LN1589:
-        movq      -16(%rbp), %rax                               #2133.54
-        movdqa    (%rax), %xmm0                                 #2133.54
-..LN1591:
-        movdqa    %xmm0, -32(%rbp)                              #2133.9
-        jmp       ..B17.4       # Prob 100%                     #2133.9
-                                # LOE
-..B17.3:                        # Preds ..B17.1
-..LN1593:
-        movq      -16(%rbp), %rax                               #2135.55
-        movdqu    (%rax), %xmm0                                 #2135.55
-..LN1595:
-        movdqa    %xmm0, -32(%rbp)                              #2135.9
-                                # LOE
-..B17.4:                        # Preds ..B17.2 ..B17.3
-..LN1597:
-        movdqa    -32(%rbp), %xmm0                              #2136.12
-        leave                                                   #2136.12
-..___tag_value_prime_buffer_2na.223:                            #
-        ret                                                     #2136.12
-        .align    2,0x90
-..___tag_value_prime_buffer_2na.224:                            #
-                                # LOE
-# mark_end;
-	.type	prime_buffer_2na, at function
-	.size	prime_buffer_2na,.-prime_buffer_2na
-.LNprime_buffer_2na:
-	.data
-# -- End  prime_buffer_2na
-	.text
-# -- Begin  eval_2na_8
-# mark_begin;
-       .align    2,0x90
-eval_2na_8:
-# parameter 1(self): %rdi
-# parameter 2(ncbi2na): %rsi
-# parameter 3(pos): %edx
-# parameter 4(len): %ecx
-..B18.1:                        # Preds ..B18.0
-..___tag_value_eval_2na_8.227:                                  #
-..LN1599:
-        pushq     %rbp                                          #2196.1
-        movq      %rsp, %rbp                                    #2196.1
-..___tag_value_eval_2na_8.228:                                  #
-        subq      $320, %rsp                                    #2196.1
-        movq      %rdi, -48(%rbp)                               #2196.1
-        movq      %rsi, -40(%rbp)                               #2196.1
-        movl      %edx, -24(%rbp)                               #2196.1
-        movl      %ecx, -16(%rbp)                               #2196.1
-..LN1601:
-        movq      -48(%rbp), %rax                               #2226.25
-        movl      4(%rax), %eax                                 #2226.25
-..LN1603:
-        movl      %eax, -32(%rbp)                               #2226.23
-..LN1605:
-        movl      -16(%rbp), %eax                               #2229.5
-        movl      -32(%rbp), %edx                               #2229.5
-        cmpl      %edx, %eax                                    #2229.5
-        jae       ..B18.3       # Prob 50%                      #2229.5
-                                # LOE
-..B18.2:                        # Preds ..B18.1
-        lea       _2__STRING.9.0(%rip), %rax                    #2229.5
-        lea       _2__STRING.1.0(%rip), %rdx                    #2229.5
-        lea       __$U5.0(%rip), %rcx                           #2229.5
-        movq      %rax, %rdi                                    #2229.5
-        movq      %rdx, %rsi                                    #2229.5
-        movl      $2229, %edx                                   #2229.5
-        call      __assert_fail at PLT                             #2229.5
-                                # LOE
-..B18.3:                        # Preds ..B18.1
-..LN1607:
-        movl      -24(%rbp), %eax                               #2233.12
-..LN1609:
-        addl      -16(%rbp), %eax                               #2233.5
-        movl      %eax, -16(%rbp)                               #2233.5
-..LN1611:
-        movl      -24(%rbp), %eax                               #2236.42
-..LN1613:
-        shrl      $2, %eax                                      #2236.49
-..LN1615:
-        addq      -40(%rbp), %rax                               #2236.30
-..LN1617:
-        movq      %rax, -96(%rbp)                               #2236.5
-..LN1619:
-        movl      -32(%rbp), %eax                               #2239.18
-        negl      %eax                                          #2239.18
-        addl      -16(%rbp), %eax                               #2239.18
-..LN1621:
-        movl      %eax, -76(%rbp)                               #2239.5
-..LN1623:
-        movl      -16(%rbp), %eax                               #2242.44
-..LN1625:
-        addl      $3, %eax                                      #2242.50
-..LN1627:
-        shrl      $2, %eax                                      #2242.57
-..LN1629:
-        addq      -40(%rbp), %rax                               #2242.30
-..LN1631:
-        movq      %rax, -88(%rbp)                               #2242.5
-..LN1633:
-        movq      -96(%rbp), %rax                               #2245.33
-..LN1635:
-        movq      -88(%rbp), %rdx                               #2245.38
-..LN1637:
-        movq      %rax, %rdi                                    #2245.14
-        movq      %rdx, %rsi                                    #2245.14
-        call      prime_buffer_2na at PLT                          #2245.14
-                                # LOE xmm0
-..B18.43:                       # Preds ..B18.3
-        movdqa    %xmm0, -144(%rbp)                             #2245.14
-                                # LOE
-..B18.4:                        # Preds ..B18.43
-..LN1639:
-        movdqa    -144(%rbp), %xmm0                             #2245.5
-        movdqa    %xmm0, -288(%rbp)                             #2245.5
-..LN1641:
-        addq      $16, -96(%rbp)                                #2246.5
-..LN1643:
-        movq      -48(%rbp), %rax                               #2256.5
-        movdqa    16(%rax), %xmm0                               #2256.5
-        movdqa    %xmm0, -272(%rbp)                             #2256.5
-        movq      -48(%rbp), %rax                               #2256.5
-        movdqa    32(%rax), %xmm0                               #2256.5
-        movdqa    %xmm0, -256(%rbp)                             #2256.5
-        movq      -48(%rbp), %rax                               #2256.5
-        movdqa    48(%rax), %xmm0                               #2256.5
-        movdqa    %xmm0, -240(%rbp)                             #2256.5
-        movq      -48(%rbp), %rax                               #2256.5
-        movdqa    64(%rax), %xmm0                               #2256.5
-        movdqa    %xmm0, -224(%rbp)                             #2256.5
-        movq      -48(%rbp), %rax                               #2256.5
-        movdqa    80(%rax), %xmm0                               #2256.5
-        movdqa    %xmm0, -208(%rbp)                             #2256.5
-        movq      -48(%rbp), %rax                               #2256.5
-        movdqa    96(%rax), %xmm0                               #2256.5
-        movdqa    %xmm0, -192(%rbp)                             #2256.5
-        movq      -48(%rbp), %rax                               #2256.5
-        movdqa    112(%rax), %xmm0                              #2256.5
-        movdqa    %xmm0, -176(%rbp)                             #2256.5
-        movq      -48(%rbp), %rax                               #2256.5
-        movdqa    128(%rax), %xmm0                              #2256.5
-        movdqa    %xmm0, -160(%rbp)                             #2256.5
-..LN1645:
-        xorl      %eax, %eax                                    #2259.15
-        movl      %eax, -72(%rbp)                               #2259.15
-..LN1647:
-        movl      %eax, -68(%rbp)                               #2259.10
-..LN1649:
-        movl      %eax, -64(%rbp)                               #2259.5
-..LN1651:
-        movl      $1, -60(%rbp)                                 #2263.5
-..LN1653:
-        movl      -24(%rbp), %eax                               #2268.14
-..LN1655:
-        andl      $3, %eax                                      #2268.20
-        movl      %eax, -56(%rbp)                               #2268.20
-        je        ..B18.12      # Prob 50%                      #2268.20
-                                # LOE
-..B18.5:                        # Preds ..B18.4
-        movl      -56(%rbp), %eax                               #2268.20
-        cmpl      $1, %eax                                      #2268.20
-        je        ..B18.13      # Prob 50%                      #2268.20
-                                # LOE
-..B18.6:                        # Preds ..B18.5
-        movl      -56(%rbp), %eax                               #2268.20
-        cmpl      $2, %eax                                      #2268.20
-        je        ..B18.14      # Prob 50%                      #2268.20
-                                # LOE
-..B18.7:                        # Preds ..B18.6
-        movl      -56(%rbp), %eax                               #2268.20
-        cmpl      $3, %eax                                      #2268.20
-        je        ..B18.15      # Prob 50%                      #2268.20
-                                # LOE
-..B18.8:                        # Preds ..B18.39 ..B18.7
-..LN1657:
-        movl      $1, %eax                                      #2273.9
-        testl     %eax, %eax                                    #2273.9
-        je        ..B18.40      # Prob 100%                     #2273.9
-                                # LOE
-..B18.9:                        # Preds ..B18.8
-..LN1659:
-        movl      $1, -60(%rbp)                                 #2275.13
-                                # LOE
-..B18.10:                       # Preds ..B18.34 ..B18.9
-..LN1661:
-        movl      $1, %eax                                      #2278.13
-        testl     %eax, %eax                                    #2278.13
-        je        ..B18.36      # Prob 100%                     #2278.13
-                                # LOE
-..B18.12:                       # Preds ..B18.4 ..B18.10
-..LN1663:
-        movdqa    -288(%rbp), %xmm0                             #2285.38
-..LN1665:
-        movdqa    -256(%rbp), %xmm1                             #2285.46
-..LN1667:
-        pand      %xmm1, %xmm0                                  #2285.22
-..LN1669:
-        movdqa    %xmm0, -304(%rbp)                             #2285.17
-..LN1671:
-        movdqa    -304(%rbp), %xmm0                             #2286.22
-        movdqa    -272(%rbp), %xmm1                             #2286.22
-        pcmpeqb   %xmm1, %xmm0                                  #2286.22
-..LN1673:
-        movdqa    %xmm0, -304(%rbp)                             #2286.17
-..LN1675:
-        movdqa    -304(%rbp), %xmm0                             #2287.42
-..LN1677:
-        pmovmskb  %xmm0, %eax                                   #2287.22
-..LN1679:
-        movl      %eax, -64(%rbp)                               #2287.17
-                                # LOE
-..B18.13:                       # Preds ..B18.5 ..B18.12
-..LN1681:
-        movdqa    -288(%rbp), %xmm0                             #2291.38
-..LN1683:
-        movdqa    -224(%rbp), %xmm1                             #2291.46
-..LN1685:
-        pand      %xmm1, %xmm0                                  #2291.22
-..LN1687:
-        movdqa    %xmm0, -304(%rbp)                             #2291.17
-..LN1689:
-        movdqa    -304(%rbp), %xmm0                             #2292.22
-        movdqa    -240(%rbp), %xmm1                             #2292.22
-        pcmpeqb   %xmm1, %xmm0                                  #2292.22
-..LN1691:
-        movdqa    %xmm0, -304(%rbp)                             #2292.17
-..LN1693:
-        movdqa    -304(%rbp), %xmm0                             #2293.42
-..LN1695:
-        pmovmskb  %xmm0, %eax                                   #2293.22
-..LN1697:
-        movl      %eax, -68(%rbp)                               #2293.17
-                                # LOE
-..B18.14:                       # Preds ..B18.6 ..B18.13
-..LN1699:
-        movdqa    -288(%rbp), %xmm0                             #2297.38
-..LN1701:
-        movdqa    -192(%rbp), %xmm1                             #2297.46
-..LN1703:
-        pand      %xmm1, %xmm0                                  #2297.22
-..LN1705:
-        movdqa    %xmm0, -304(%rbp)                             #2297.17
-..LN1707:
-        movdqa    -304(%rbp), %xmm0                             #2298.22
-        movdqa    -208(%rbp), %xmm1                             #2298.22
-        pcmpeqb   %xmm1, %xmm0                                  #2298.22
-..LN1709:
-        movdqa    %xmm0, -304(%rbp)                             #2298.17
-..LN1711:
-        movdqa    -304(%rbp), %xmm0                             #2299.42
-..LN1713:
-        pmovmskb  %xmm0, %eax                                   #2299.22
-..LN1715:
-        movl      %eax, -72(%rbp)                               #2299.17
-                                # LOE
-..B18.15:                       # Preds ..B18.7 ..B18.14
-..LN1717:
-        movdqa    -288(%rbp), %xmm0                             #2303.38
-..LN1719:
-        movdqa    -160(%rbp), %xmm1                             #2303.46
-..LN1721:
-        pand      %xmm1, %xmm0                                  #2303.22
-..LN1723:
-        movdqa    %xmm0, -304(%rbp)                             #2303.17
-..LN1725:
-        movdqa    -304(%rbp), %xmm0                             #2304.22
-        movdqa    -176(%rbp), %xmm1                             #2304.22
-        pcmpeqb   %xmm1, %xmm0                                  #2304.22
-..LN1727:
-        movdqa    %xmm0, -304(%rbp)                             #2304.17
-..LN1729:
-        movdqa    -304(%rbp), %xmm0                             #2305.42
-..LN1731:
-        pmovmskb  %xmm0, %eax                                   #2305.22
-..LN1733:
-        movl      %eax, -80(%rbp)                               #2305.17
-..LN1735:
-        andl      $-4, -24(%rbp)                                #2310.17
-..LN1737:
-        movl      -68(%rbp), %eax                               #2313.29
-        orl       -64(%rbp), %eax                               #2313.29
-..LN1739:
-        orl       -72(%rbp), %eax                               #2313.34
-..LN1741:
-        orl       -80(%rbp), %eax                               #2313.39
-..LN1743:
-        je        ..B18.32      # Prob 50%                      #2313.47
-                                # LOE
-..B18.16:                       # Preds ..B18.15
-..LN1745:
-        movl      -64(%rbp), %eax                               #2331.58
-..LN1747:
-        movl      %eax, %edi                                    #2331.30
-        call      uint16_lsbit at PLT                              #2331.30
-                                # LOE eax
-..B18.44:                       # Preds ..B18.16
-        movl      %eax, -112(%rbp)                              #2331.30
-                                # LOE
-..B18.17:                       # Preds ..B18.44
-        movl      -112(%rbp), %eax                              #2331.30
-        movswq    %ax, %rax                                     #2331.30
-..LN1749:
-        movl      %eax, -128(%rbp)                              #2331.28
-..LN1751:
-        movl      -68(%rbp), %eax                               #2332.58
-..LN1753:
-        movl      %eax, %edi                                    #2332.30
-        call      uint16_lsbit at PLT                              #2332.30
-                                # LOE eax
-..B18.45:                       # Preds ..B18.17
-        movl      %eax, -108(%rbp)                              #2332.30
-                                # LOE
-..B18.18:                       # Preds ..B18.45
-        movl      -108(%rbp), %eax                              #2332.30
-        movswq    %ax, %rax                                     #2332.30
-..LN1755:
-        movl      %eax, -124(%rbp)                              #2332.28
-..LN1757:
-        movl      -72(%rbp), %eax                               #2333.58
-..LN1759:
-        movl      %eax, %edi                                    #2333.30
-        call      uint16_lsbit at PLT                              #2333.30
-                                # LOE eax
-..B18.46:                       # Preds ..B18.18
-        movl      %eax, -104(%rbp)                              #2333.30
-                                # LOE
-..B18.19:                       # Preds ..B18.46
-        movl      -104(%rbp), %eax                              #2333.30
-        movswq    %ax, %rax                                     #2333.30
-..LN1761:
-        movl      %eax, -120(%rbp)                              #2333.28
-..LN1763:
-        movl      -80(%rbp), %eax                               #2334.58
-..LN1765:
-        movl      %eax, %edi                                    #2334.30
-        call      uint16_lsbit at PLT                              #2334.30
-                                # LOE eax
-..B18.47:                       # Preds ..B18.19
-        movl      %eax, -100(%rbp)                              #2334.30
-                                # LOE
-..B18.20:                       # Preds ..B18.47
-        movl      -100(%rbp), %eax                              #2334.30
-        movswq    %ax, %rax                                     #2334.30
-..LN1767:
-        movl      %eax, -116(%rbp)                              #2334.28
-..LN1769:
-        shll      $2, -128(%rbp)                                #2339.34
-..LN1771:
-        movl      -124(%rbp), %eax                              #2340.28
-..LN1773:
-        shll      $2, %eax                                      #2340.34
-..LN1775:
-        incl      %eax                                          #2340.40
-..LN1777:
-        movl      %eax, -124(%rbp)                              #2340.21
-..LN1779:
-        movl      -120(%rbp), %eax                              #2341.28
-..LN1781:
-        shll      $2, %eax                                      #2341.34
-..LN1783:
-        addl      $2, %eax                                      #2341.40
-..LN1785:
-        movl      %eax, -120(%rbp)                              #2341.21
-..LN1787:
-        movl      -116(%rbp), %eax                              #2342.28
-..LN1789:
-        shll      $2, %eax                                      #2342.34
-..LN1791:
-        addl      $3, %eax                                      #2342.40
-..LN1793:
-        movl      %eax, -116(%rbp)                              #2342.21
-..LN1795:
-        movl      -64(%rbp), %eax                               #2346.26
-..LN1797:
-        testl     %eax, %eax                                    #2346.32
-        je        ..B18.23      # Prob 50%                      #2346.32
-                                # LOE
-..B18.21:                       # Preds ..B18.20
-..LN1799:
-        movl      -128(%rbp), %eax                              #2346.43
-        addl      -24(%rbp), %eax                               #2346.43
-..LN1801:
-        movl      -76(%rbp), %edx                               #2346.49
-        cmpl      %edx, %eax                                    #2346.49
-        ja        ..B18.23      # Prob 50%                      #2346.49
-                                # LOE
-..B18.22:                       # Preds ..B18.21
-..LN1803:
-        movl      $1, %eax                                      #2346.63
-        leave                                                   #2346.63
-..___tag_value_eval_2na_8.232:                                  #
-        ret                                                     #2346.63
-..___tag_value_eval_2na_8.233:                                  #
-                                # LOE
-..B18.23:                       # Preds ..B18.21 ..B18.20
-..LN1805:
-        movl      -68(%rbp), %eax                               #2347.26
-..LN1807:
-        testl     %eax, %eax                                    #2347.32
-        je        ..B18.26      # Prob 50%                      #2347.32
-                                # LOE
-..B18.24:                       # Preds ..B18.23
-..LN1809:
-        movl      -124(%rbp), %eax                              #2347.43
-        addl      -24(%rbp), %eax                               #2347.43
-..LN1811:
-        movl      -76(%rbp), %edx                               #2347.49
-        cmpl      %edx, %eax                                    #2347.49
-        ja        ..B18.26      # Prob 50%                      #2347.49
-                                # LOE
-..B18.25:                       # Preds ..B18.24
-..LN1813:
-        movl      $1, %eax                                      #2347.63
-        leave                                                   #2347.63
-..___tag_value_eval_2na_8.235:                                  #
-        ret                                                     #2347.63
-..___tag_value_eval_2na_8.236:                                  #
-                                # LOE
-..B18.26:                       # Preds ..B18.24 ..B18.23
-..LN1815:
-        movl      -72(%rbp), %eax                               #2348.26
-..LN1817:
-        testl     %eax, %eax                                    #2348.32
-        je        ..B18.29      # Prob 50%                      #2348.32
-                                # LOE
-..B18.27:                       # Preds ..B18.26
-..LN1819:
-        movl      -120(%rbp), %eax                              #2348.43
-        addl      -24(%rbp), %eax                               #2348.43
-..LN1821:
-        movl      -76(%rbp), %edx                               #2348.49
-        cmpl      %edx, %eax                                    #2348.49
-        ja        ..B18.29      # Prob 50%                      #2348.49
-                                # LOE
-..B18.28:                       # Preds ..B18.27
-..LN1823:
-        movl      $1, %eax                                      #2348.63
-        leave                                                   #2348.63
-..___tag_value_eval_2na_8.238:                                  #
-        ret                                                     #2348.63
-..___tag_value_eval_2na_8.239:                                  #
-                                # LOE
-..B18.29:                       # Preds ..B18.27 ..B18.26
-..LN1825:
-        movl      -80(%rbp), %eax                               #2349.26
-..LN1827:
-        testl     %eax, %eax                                    #2349.32
-        je        ..B18.32      # Prob 50%                      #2349.32
-                                # LOE
-..B18.30:                       # Preds ..B18.29
-..LN1829:
-        movl      -116(%rbp), %eax                              #2349.43
-        addl      -24(%rbp), %eax                               #2349.43
-..LN1831:
-        movl      -76(%rbp), %edx                               #2349.49
-        cmpl      %edx, %eax                                    #2349.49
-        ja        ..B18.32      # Prob 50%                      #2349.49
-                                # LOE
-..B18.31:                       # Preds ..B18.30
-..LN1833:
-        movl      $1, %eax                                      #2349.63
-        leave                                                   #2349.63
-..___tag_value_eval_2na_8.241:                                  #
-        ret                                                     #2349.63
-..___tag_value_eval_2na_8.242:                                  #
-                                # LOE
-..B18.32:                       # Preds ..B18.30 ..B18.29 ..B18.15
-..LN1835:
-        addl      $4, -24(%rbp)                                 #2354.17
-..LN1837:
-        movl      -24(%rbp), %eax                               #2357.22
-..LN1839:
-        movl      -76(%rbp), %edx                               #2357.28
-        cmpl      %edx, %eax                                    #2357.28
-        jbe       ..B18.34      # Prob 50%                      #2357.28
-                                # LOE
-..B18.33:                       # Preds ..B18.32
-..LN1841:
-        xorl      %eax, %eax                                    #2358.28
-        leave                                                   #2358.28
-..___tag_value_eval_2na_8.244:                                  #
-        ret                                                     #2358.28
-..___tag_value_eval_2na_8.245:                                  #
-                                # LOE
-..B18.34:                       # Preds ..B18.32
-..LN1843:
-        movl      -60(%rbp), %eax                               #2361.25
-        decl      %eax                                          #2361.25
-        movl      %eax, -60(%rbp)                               #2361.25
-..LN1845:
-        jne       ..B18.10      # Prob 50%                      #2361.39
-                                # LOE
-..B18.36:                       # Preds ..B18.34 ..B18.10
-..LN1847:
-        movq      -96(%rbp), %rax                               #2382.18
-..LN1849:
-        movq      -88(%rbp), %rdx                               #2382.25
-        cmpq      %rdx, %rax                                    #2382.25
-        jae       ..B18.40      # Prob 50%                      #2382.25
-                                # LOE
-..B18.37:                       # Preds ..B18.36
-..LN1851:
-        addl      $60, -24(%rbp)                                #2386.13
-..LN1853:
-        movl      -24(%rbp), %eax                               #2387.18
-..LN1855:
-        movl      -76(%rbp), %edx                               #2387.24
-        cmpl      %edx, %eax                                    #2387.24
-        ja        ..B18.40      # Prob 50%                      #2387.24
-                                # LOE
-..B18.38:                       # Preds ..B18.37
-..LN1857:
-        movq      -96(%rbp), %rax                               #2392.41
-..LN1859:
-        movq      -88(%rbp), %rdx                               #2392.46
-..LN1861:
-        movq      %rax, %rdi                                    #2392.22
-        movq      %rdx, %rsi                                    #2392.22
-        call      prime_buffer_2na at PLT                          #2392.22
-                                # LOE xmm0
-..B18.48:                       # Preds ..B18.38
-        movdqa    %xmm0, -320(%rbp)                             #2392.22
-                                # LOE
-..B18.39:                       # Preds ..B18.48
-..LN1863:
-        movdqa    -320(%rbp), %xmm0                             #2392.13
-        movdqa    %xmm0, -288(%rbp)                             #2392.13
-..LN1865:
-        addq      $16, -96(%rbp)                                #2470.13
-        jmp       ..B18.8       # Prob 100%                     #2470.13
-                                # LOE
-..B18.40:                       # Preds ..B18.37 ..B18.36 ..B18.8
-..LN1867:
-        xorl      %eax, %eax                                    #2483.12
-        leave                                                   #2483.12
-..___tag_value_eval_2na_8.247:                                  #
-        ret                                                     #2483.12
-        .align    2,0x90
-..___tag_value_eval_2na_8.248:                                  #
-                                # LOE
-# mark_end;
-	.type	eval_2na_8, at function
-	.size	eval_2na_8,.-eval_2na_8
-.LNeval_2na_8:
-	.data
-# -- End  eval_2na_8
-	.text
-# -- Begin  eval_2na_16
-# mark_begin;
-       .align    2,0x90
-eval_2na_16:
-# parameter 1(self): %rdi
-# parameter 2(ncbi2na): %rsi
-# parameter 3(pos): %edx
-# parameter 4(len): %ecx
-..B19.1:                        # Preds ..B19.0
-..___tag_value_eval_2na_16.251:                                 #
-..LN1869:
-        pushq     %rbp                                          #2489.1
-        movq      %rsp, %rbp                                    #2489.1
-..___tag_value_eval_2na_16.252:                                 #
-        subq      $336, %rsp                                    #2489.1
-        movq      %rdi, -48(%rbp)                               #2489.1
-        movq      %rsi, -40(%rbp)                               #2489.1
-        movl      %edx, -24(%rbp)                               #2489.1
-        movl      %ecx, -16(%rbp)                               #2489.1
-..LN1871:
-        movq      -48(%rbp), %rax                               #2519.25
-        movl      4(%rax), %eax                                 #2519.25
-..LN1873:
-        movl      %eax, -32(%rbp)                               #2519.23
-..LN1875:
-        movl      -16(%rbp), %eax                               #2522.5
-        movl      -32(%rbp), %edx                               #2522.5
-        cmpl      %edx, %eax                                    #2522.5
-        jae       ..B19.3       # Prob 50%                      #2522.5
-                                # LOE
-..B19.2:                        # Preds ..B19.1
-        lea       _2__STRING.9.0(%rip), %rax                    #2522.5
-        lea       _2__STRING.1.0(%rip), %rdx                    #2522.5
-        lea       __$U6.0(%rip), %rcx                           #2522.5
-        movq      %rax, %rdi                                    #2522.5
-        movq      %rdx, %rsi                                    #2522.5
-        movl      $2522, %edx                                   #2522.5
-        call      __assert_fail at PLT                             #2522.5
-                                # LOE
-..B19.3:                        # Preds ..B19.1
-..LN1877:
-        movl      -24(%rbp), %eax                               #2526.12
-..LN1879:
-        addl      -16(%rbp), %eax                               #2526.5
-        movl      %eax, -16(%rbp)                               #2526.5
-..LN1881:
-        movl      -24(%rbp), %eax                               #2529.42
-..LN1883:
-        shrl      $2, %eax                                      #2529.49
-..LN1885:
-        addq      -40(%rbp), %rax                               #2529.30
-..LN1887:
-        movq      %rax, -104(%rbp)                              #2529.5
-..LN1889:
-        movl      -32(%rbp), %eax                               #2532.18
-        negl      %eax                                          #2532.18
-        addl      -16(%rbp), %eax                               #2532.18
-..LN1891:
-        movl      %eax, -76(%rbp)                               #2532.5
-..LN1893:
-        movl      -16(%rbp), %eax                               #2535.44
-..LN1895:
-        addl      $3, %eax                                      #2535.50
-..LN1897:
-        shrl      $2, %eax                                      #2535.57
-..LN1899:
-        addq      -40(%rbp), %rax                               #2535.30
-..LN1901:
-        movq      %rax, -96(%rbp)                               #2535.5
-..LN1903:
-        movq      -104(%rbp), %rax                              #2538.33
-..LN1905:
-        movq      -96(%rbp), %rdx                               #2538.38
-..LN1907:
-        movq      %rax, %rdi                                    #2538.14
-        movq      %rdx, %rsi                                    #2538.14
-        call      prime_buffer_2na at PLT                          #2538.14
-                                # LOE xmm0
-..B19.49:                       # Preds ..B19.3
-        movdqa    %xmm0, -160(%rbp)                             #2538.14
-                                # LOE
-..B19.4:                        # Preds ..B19.49
-..LN1909:
-        movdqa    -160(%rbp), %xmm0                             #2538.5
-        movdqa    %xmm0, -304(%rbp)                             #2538.5
-..LN1911:
-        addq      $16, -104(%rbp)                               #2539.5
-..LN1913:
-        movq      -104(%rbp), %rax                              #2541.9
-..LN1915:
-        movq      %rax, -88(%rbp)                               #2541.5
-..LN1917:
-        movq      -104(%rbp), %rax                              #2544.10
-..LN1919:
-        movq      -96(%rbp), %rdx                               #2544.16
-        cmpq      %rdx, %rax                                    #2544.16
-        jae       ..B19.6       # Prob 50%                      #2544.16
-                                # LOE
-..B19.5:                        # Preds ..B19.4
-..LN1921:
-        movq      -104(%rbp), %rax                              #2545.24
-        movzbl    -1(%rax), %eax                                #2545.24
-        movzbl    %al, %eax                                     #2545.24
-..LN1923:
-        shll      $8, %eax                                      #2545.38
-..LN1925:
-        movl      %eax, -112(%rbp)                              #2545.9
-                                # LOE
-..B19.6:                        # Preds ..B19.5 ..B19.4
-..LN1927:
-        movq      -48(%rbp), %rax                               #2549.5
-        movdqa    16(%rax), %xmm0                               #2549.5
-        movdqa    %xmm0, -288(%rbp)                             #2549.5
-        movq      -48(%rbp), %rax                               #2549.5
-        movdqa    32(%rax), %xmm0                               #2549.5
-        movdqa    %xmm0, -272(%rbp)                             #2549.5
-        movq      -48(%rbp), %rax                               #2549.5
-        movdqa    48(%rax), %xmm0                               #2549.5
-        movdqa    %xmm0, -256(%rbp)                             #2549.5
-        movq      -48(%rbp), %rax                               #2549.5
-        movdqa    64(%rax), %xmm0                               #2549.5
-        movdqa    %xmm0, -240(%rbp)                             #2549.5
-        movq      -48(%rbp), %rax                               #2549.5
-        movdqa    80(%rax), %xmm0                               #2549.5
-        movdqa    %xmm0, -224(%rbp)                             #2549.5
-        movq      -48(%rbp), %rax                               #2549.5
-        movdqa    96(%rax), %xmm0                               #2549.5
-        movdqa    %xmm0, -208(%rbp)                             #2549.5
-        movq      -48(%rbp), %rax                               #2549.5
-        movdqa    112(%rax), %xmm0                              #2549.5
-        movdqa    %xmm0, -192(%rbp)                             #2549.5
-        movq      -48(%rbp), %rax                               #2549.5
-        movdqa    128(%rax), %xmm0                              #2549.5
-        movdqa    %xmm0, -176(%rbp)                             #2549.5
-..LN1929:
-        xorl      %eax, %eax                                    #2552.15
-        movl      %eax, -72(%rbp)                               #2552.15
-..LN1931:
-        movl      %eax, -68(%rbp)                               #2552.10
-..LN1933:
-        movl      %eax, -64(%rbp)                               #2552.5
-..LN1935:
-        movl      $2, -60(%rbp)                                 #2556.5
-..LN1937:
-        movl      -24(%rbp), %eax                               #2561.14
-..LN1939:
-        andl      $3, %eax                                      #2561.20
-        movl      %eax, -56(%rbp)                               #2561.20
-        je        ..B19.14      # Prob 50%                      #2561.20
-                                # LOE
-..B19.7:                        # Preds ..B19.6
-        movl      -56(%rbp), %eax                               #2561.20
-        cmpl      $1, %eax                                      #2561.20
-        je        ..B19.15      # Prob 50%                      #2561.20
-                                # LOE
-..B19.8:                        # Preds ..B19.7
-        movl      -56(%rbp), %eax                               #2561.20
-        cmpl      $2, %eax                                      #2561.20
-        je        ..B19.16      # Prob 50%                      #2561.20
-                                # LOE
-..B19.9:                        # Preds ..B19.8
-        movl      -56(%rbp), %eax                               #2561.20
-        cmpl      $3, %eax                                      #2561.20
-        je        ..B19.17      # Prob 50%                      #2561.20
-                                # LOE
-..B19.10:                       # Preds ..B19.45 ..B19.44 ..B19.9
-..LN1941:
-        movl      $1, %eax                                      #2566.9
-        testl     %eax, %eax                                    #2566.9
-        je        ..B19.46      # Prob 100%                     #2566.9
-                                # LOE
-..B19.11:                       # Preds ..B19.10
-..LN1943:
-        movl      $2, -60(%rbp)                                 #2568.13
-                                # LOE
-..B19.12:                       # Preds ..B19.39 ..B19.11
-..LN1945:
-        movl      $1, %eax                                      #2571.13
-        testl     %eax, %eax                                    #2571.13
-        je        ..B19.41      # Prob 100%                     #2571.13
-                                # LOE
-..B19.14:                       # Preds ..B19.6 ..B19.12
-..LN1947:
-        movdqa    -304(%rbp), %xmm0                             #2578.38
-..LN1949:
-        movdqa    -272(%rbp), %xmm1                             #2578.46
-..LN1951:
-        pand      %xmm1, %xmm0                                  #2578.22
-..LN1953:
-        movdqa    %xmm0, -320(%rbp)                             #2578.17
-..LN1955:
-        movdqa    -320(%rbp), %xmm0                             #2579.22
-        movdqa    -288(%rbp), %xmm1                             #2579.22
-        pcmpeqw   %xmm1, %xmm0                                  #2579.22
-..LN1957:
-        movdqa    %xmm0, -320(%rbp)                             #2579.17
-..LN1959:
-        movdqa    -320(%rbp), %xmm0                             #2580.42
-..LN1961:
-        pmovmskb  %xmm0, %eax                                   #2580.22
-..LN1963:
-        movl      %eax, -64(%rbp)                               #2580.17
-                                # LOE
-..B19.15:                       # Preds ..B19.7 ..B19.14
-..LN1965:
-        movdqa    -304(%rbp), %xmm0                             #2584.38
-..LN1967:
-        movdqa    -240(%rbp), %xmm1                             #2584.46
-..LN1969:
-        pand      %xmm1, %xmm0                                  #2584.22
-..LN1971:
-        movdqa    %xmm0, -320(%rbp)                             #2584.17
-..LN1973:
-        movdqa    -320(%rbp), %xmm0                             #2585.22
-        movdqa    -256(%rbp), %xmm1                             #2585.22
-        pcmpeqw   %xmm1, %xmm0                                  #2585.22
-..LN1975:
-        movdqa    %xmm0, -320(%rbp)                             #2585.17
-..LN1977:
-        movdqa    -320(%rbp), %xmm0                             #2586.42
-..LN1979:
-        pmovmskb  %xmm0, %eax                                   #2586.22
-..LN1981:
-        movl      %eax, -68(%rbp)                               #2586.17
-                                # LOE
-..B19.16:                       # Preds ..B19.8 ..B19.15
-..LN1983:
-        movdqa    -304(%rbp), %xmm0                             #2590.38
-..LN1985:
-        movdqa    -208(%rbp), %xmm1                             #2590.46
-..LN1987:
-        pand      %xmm1, %xmm0                                  #2590.22
-..LN1989:
-        movdqa    %xmm0, -320(%rbp)                             #2590.17
-..LN1991:
-        movdqa    -320(%rbp), %xmm0                             #2591.22
-        movdqa    -224(%rbp), %xmm1                             #2591.22
-        pcmpeqw   %xmm1, %xmm0                                  #2591.22
-..LN1993:
-        movdqa    %xmm0, -320(%rbp)                             #2591.17
-..LN1995:
-        movdqa    -320(%rbp), %xmm0                             #2592.42
-..LN1997:
-        pmovmskb  %xmm0, %eax                                   #2592.22
-..LN1999:
-        movl      %eax, -72(%rbp)                               #2592.17
-                                # LOE
-..B19.17:                       # Preds ..B19.9 ..B19.16
-..LN2001:
-        movdqa    -304(%rbp), %xmm0                             #2596.38
-..LN2003:
-        movdqa    -176(%rbp), %xmm1                             #2596.46
-..LN2005:
-        pand      %xmm1, %xmm0                                  #2596.22
-..LN2007:
-        movdqa    %xmm0, -320(%rbp)                             #2596.17
-..LN2009:
-        movdqa    -320(%rbp), %xmm0                             #2597.22
-        movdqa    -192(%rbp), %xmm1                             #2597.22
-        pcmpeqw   %xmm1, %xmm0                                  #2597.22
-..LN2011:
-        movdqa    %xmm0, -320(%rbp)                             #2597.17
-..LN2013:
-        movdqa    -320(%rbp), %xmm0                             #2598.42
-..LN2015:
-        pmovmskb  %xmm0, %eax                                   #2598.22
-..LN2017:
-        movl      %eax, -80(%rbp)                               #2598.17
-..LN2019:
-        andl      $-4, -24(%rbp)                                #2603.17
-..LN2021:
-        movl      -68(%rbp), %eax                               #2606.29
-        orl       -64(%rbp), %eax                               #2606.29
-..LN2023:
-        orl       -72(%rbp), %eax                               #2606.34
-..LN2025:
-        orl       -80(%rbp), %eax                               #2606.39
-..LN2027:
-        je        ..B19.34      # Prob 50%                      #2606.47
-                                # LOE
-..B19.18:                       # Preds ..B19.17
-..LN2029:
-        movl      -64(%rbp), %eax                               #2624.58
-..LN2031:
-        movl      %eax, %edi                                    #2624.30
-        call      uint16_lsbit at PLT                              #2624.30
-                                # LOE eax
-..B19.50:                       # Preds ..B19.18
-        movl      %eax, -128(%rbp)                              #2624.30
-                                # LOE
-..B19.19:                       # Preds ..B19.50
-        movl      -128(%rbp), %eax                              #2624.30
-        movswq    %ax, %rax                                     #2624.30
-..LN2033:
-        movl      %eax, -144(%rbp)                              #2624.28
-..LN2035:
-        movl      -68(%rbp), %eax                               #2625.58
-..LN2037:
-        movl      %eax, %edi                                    #2625.30
-        call      uint16_lsbit at PLT                              #2625.30
-                                # LOE eax
-..B19.51:                       # Preds ..B19.19
-        movl      %eax, -124(%rbp)                              #2625.30
-                                # LOE
-..B19.20:                       # Preds ..B19.51
-        movl      -124(%rbp), %eax                              #2625.30
-        movswq    %ax, %rax                                     #2625.30
-..LN2039:
-        movl      %eax, -140(%rbp)                              #2625.28
-..LN2041:
-        movl      -72(%rbp), %eax                               #2626.58
-..LN2043:
-        movl      %eax, %edi                                    #2626.30
-        call      uint16_lsbit at PLT                              #2626.30
-                                # LOE eax
-..B19.52:                       # Preds ..B19.20
-        movl      %eax, -120(%rbp)                              #2626.30
-                                # LOE
-..B19.21:                       # Preds ..B19.52
-        movl      -120(%rbp), %eax                              #2626.30
-        movswq    %ax, %rax                                     #2626.30
-..LN2045:
-        movl      %eax, -136(%rbp)                              #2626.28
-..LN2047:
-        movl      -80(%rbp), %eax                               #2627.58
-..LN2049:
-        movl      %eax, %edi                                    #2627.30
-        call      uint16_lsbit at PLT                              #2627.30
-                                # LOE eax
-..B19.53:                       # Preds ..B19.21
-        movl      %eax, -116(%rbp)                              #2627.30
-                                # LOE
-..B19.22:                       # Preds ..B19.53
-        movl      -116(%rbp), %eax                              #2627.30
-        movswq    %ax, %rax                                     #2627.30
-..LN2051:
-        movl      %eax, -132(%rbp)                              #2627.28
-..LN2053:
-        shll      $2, -144(%rbp)                                #2632.34
-..LN2055:
-        movl      -140(%rbp), %eax                              #2633.28
-..LN2057:
-        shll      $2, %eax                                      #2633.34
-..LN2059:
-        incl      %eax                                          #2633.40
-..LN2061:
-        movl      %eax, -140(%rbp)                              #2633.21
-..LN2063:
-        movl      -136(%rbp), %eax                              #2634.28
-..LN2065:
-        shll      $2, %eax                                      #2634.34
-..LN2067:
-        addl      $2, %eax                                      #2634.40
-..LN2069:
-        movl      %eax, -136(%rbp)                              #2634.21
-..LN2071:
-        movl      -132(%rbp), %eax                              #2635.28
-..LN2073:
-        shll      $2, %eax                                      #2635.34
-..LN2075:
-        addl      $3, %eax                                      #2635.40
-..LN2077:
-        movl      %eax, -132(%rbp)                              #2635.21
-..LN2079:
-        movl      -64(%rbp), %eax                               #2639.26
-..LN2081:
-        testl     %eax, %eax                                    #2639.32
-        je        ..B19.25      # Prob 50%                      #2639.32
-                                # LOE
-..B19.23:                       # Preds ..B19.22
-..LN2083:
-        movl      -144(%rbp), %eax                              #2639.43
-        addl      -24(%rbp), %eax                               #2639.43
-..LN2085:
-        movl      -76(%rbp), %edx                               #2639.49
-        cmpl      %edx, %eax                                    #2639.49
-        ja        ..B19.25      # Prob 50%                      #2639.49
-                                # LOE
-..B19.24:                       # Preds ..B19.23
-..LN2087:
-        movl      $1, %eax                                      #2639.63
-        leave                                                   #2639.63
-..___tag_value_eval_2na_16.256:                                 #
-        ret                                                     #2639.63
-..___tag_value_eval_2na_16.257:                                 #
-                                # LOE
-..B19.25:                       # Preds ..B19.23 ..B19.22
-..LN2089:
-        movl      -68(%rbp), %eax                               #2640.26
-..LN2091:
-        testl     %eax, %eax                                    #2640.32
-        je        ..B19.28      # Prob 50%                      #2640.32
-                                # LOE
-..B19.26:                       # Preds ..B19.25
-..LN2093:
-        movl      -140(%rbp), %eax                              #2640.43
-        addl      -24(%rbp), %eax                               #2640.43
-..LN2095:
-        movl      -76(%rbp), %edx                               #2640.49
-        cmpl      %edx, %eax                                    #2640.49
-        ja        ..B19.28      # Prob 50%                      #2640.49
-                                # LOE
-..B19.27:                       # Preds ..B19.26
-..LN2097:
-        movl      $1, %eax                                      #2640.63
-        leave                                                   #2640.63
-..___tag_value_eval_2na_16.259:                                 #
-        ret                                                     #2640.63
-..___tag_value_eval_2na_16.260:                                 #
-                                # LOE
-..B19.28:                       # Preds ..B19.26 ..B19.25
-..LN2099:
-        movl      -72(%rbp), %eax                               #2641.26
-..LN2101:
-        testl     %eax, %eax                                    #2641.32
-        je        ..B19.31      # Prob 50%                      #2641.32
-                                # LOE
-..B19.29:                       # Preds ..B19.28
-..LN2103:
-        movl      -136(%rbp), %eax                              #2641.43
-        addl      -24(%rbp), %eax                               #2641.43
-..LN2105:
-        movl      -76(%rbp), %edx                               #2641.49
-        cmpl      %edx, %eax                                    #2641.49
-        ja        ..B19.31      # Prob 50%                      #2641.49
-                                # LOE
-..B19.30:                       # Preds ..B19.29
-..LN2107:
-        movl      $1, %eax                                      #2641.63
-        leave                                                   #2641.63
-..___tag_value_eval_2na_16.262:                                 #
-        ret                                                     #2641.63
-..___tag_value_eval_2na_16.263:                                 #
-                                # LOE
-..B19.31:                       # Preds ..B19.29 ..B19.28
-..LN2109:
-        movl      -80(%rbp), %eax                               #2642.26
-..LN2111:
-        testl     %eax, %eax                                    #2642.32
-        je        ..B19.34      # Prob 50%                      #2642.32
-                                # LOE
-..B19.32:                       # Preds ..B19.31
-..LN2113:
-        movl      -132(%rbp), %eax                              #2642.43
-        addl      -24(%rbp), %eax                               #2642.43
-..LN2115:
-        movl      -76(%rbp), %edx                               #2642.49
-        cmpl      %edx, %eax                                    #2642.49
-        ja        ..B19.34      # Prob 50%                      #2642.49
-                                # LOE
-..B19.33:                       # Preds ..B19.32
-..LN2117:
-        movl      $1, %eax                                      #2642.63
-        leave                                                   #2642.63
-..___tag_value_eval_2na_16.265:                                 #
-        ret                                                     #2642.63
-..___tag_value_eval_2na_16.266:                                 #
-                                # LOE
-..B19.34:                       # Preds ..B19.32 ..B19.31 ..B19.17
-..LN2119:
-        addl      $4, -24(%rbp)                                 #2647.17
-..LN2121:
-        movl      -24(%rbp), %eax                               #2650.22
-..LN2123:
-        movl      -76(%rbp), %edx                               #2650.28
-        cmpl      %edx, %eax                                    #2650.28
-        jbe       ..B19.36      # Prob 50%                      #2650.28
-                                # LOE
-..B19.35:                       # Preds ..B19.34
-..LN2125:
-        xorl      %eax, %eax                                    #2651.28
-        leave                                                   #2651.28
-..___tag_value_eval_2na_16.268:                                 #
-        ret                                                     #2651.28
-..___tag_value_eval_2na_16.269:                                 #
-                                # LOE
-..B19.36:                       # Preds ..B19.34
-..LN2127:
-        movl      -60(%rbp), %eax                               #2654.25
-        decl      %eax                                          #2654.25
-        movl      %eax, -60(%rbp)                               #2654.25
-..LN2129:
-        je        ..B19.41      # Prob 50%                      #2654.39
-                                # LOE
-..B19.37:                       # Preds ..B19.36
-..LN2131:
-        movdqa    -304(%rbp), %xmm0                             #2659.43
-..LN2133:
-        psrldq    $1, %xmm0                                     #2659.26
-..LN2135:
-        movdqa    %xmm0, -304(%rbp)                             #2659.17
-..LN2137:
-        movq      -88(%rbp), %rax                               #2662.22
-..LN2139:
-        movq      -96(%rbp), %rdx                               #2662.26
-        cmpq      %rdx, %rax                                    #2662.26
-        jae       ..B19.39      # Prob 50%                      #2662.26
-                                # LOE
-..B19.38:                       # Preds ..B19.37
-..LN2141:
-        sarl      $8, -112(%rbp)                                #2664.21
-..LN2143:
-        movq      -88(%rbp), %rax                               #2665.37
-        movzbl    (%rax), %eax                                  #2665.37
-        movzbl    %al, %eax                                     #2665.37
-..LN2145:
-        shll      $8, %eax                                      #2665.48
-..LN2147:
-        orl       -112(%rbp), %eax                              #2665.21
-        movl      %eax, -112(%rbp)                              #2665.21
-..LN2149:
-        movdqa    -304(%rbp), %xmm0                             #2666.49
-..LN2151:
-        movl      -112(%rbp), %eax                              #2666.57
-..LN2153:
-        pinsrw    $7, %eax, %xmm0                               #2666.30
-..LN2155:
-        movdqa    %xmm0, -304(%rbp)                             #2666.21
-                                # LOE
-..B19.39:                       # Preds ..B19.38 ..B19.37
-..LN2157:
-        incq      -88(%rbp)                                     #2670.20
-        jmp       ..B19.12      # Prob 100%                     #2670.20
-                                # LOE
-..B19.41:                       # Preds ..B19.36 ..B19.12
-..LN2159:
-        movq      -104(%rbp), %rax                              #2675.18
-..LN2161:
-        movq      -96(%rbp), %rdx                               #2675.25
-        cmpq      %rdx, %rax                                    #2675.25
-        jae       ..B19.46      # Prob 50%                      #2675.25
-                                # LOE
-..B19.42:                       # Preds ..B19.41
-..LN2163:
-        addl      $56, -24(%rbp)                                #2679.13
-..LN2165:
-        movl      -24(%rbp), %eax                               #2680.18
-..LN2167:
-        movl      -76(%rbp), %edx                               #2680.24
-        cmpl      %edx, %eax                                    #2680.24
-        ja        ..B19.46      # Prob 50%                      #2680.24
-                                # LOE
-..B19.43:                       # Preds ..B19.42
-..LN2169:
-        movq      -104(%rbp), %rax                              #2685.41
-..LN2171:
-        movq      -96(%rbp), %rdx                               #2685.46
-..LN2173:
-        movq      %rax, %rdi                                    #2685.22
-        movq      %rdx, %rsi                                    #2685.22
-        call      prime_buffer_2na at PLT                          #2685.22
-                                # LOE xmm0
-..B19.54:                       # Preds ..B19.43
-        movdqa    %xmm0, -336(%rbp)                             #2685.22
-                                # LOE
-..B19.44:                       # Preds ..B19.54
-..LN2175:
-        movdqa    -336(%rbp), %xmm0                             #2685.13
-        movdqa    %xmm0, -304(%rbp)                             #2685.13
-..LN2177:
-        addq      $16, -104(%rbp)                               #2763.13
-..LN2179:
-        movq      -104(%rbp), %rax                              #2765.17
-..LN2181:
-        movq      %rax, -88(%rbp)                               #2765.13
-..LN2183:
-        movq      -104(%rbp), %rax                              #2766.18
-..LN2185:
-        movq      -96(%rbp), %rdx                               #2766.24
-        cmpq      %rdx, %rax                                    #2766.24
-        jae       ..B19.10      # Prob 50%                      #2766.24
-                                # LOE
-..B19.45:                       # Preds ..B19.44
-..LN2187:
-        movq      -104(%rbp), %rax                              #2767.32
-        movzbl    -1(%rax), %eax                                #2767.32
-        movzbl    %al, %eax                                     #2767.32
-..LN2189:
-        shll      $8, %eax                                      #2767.46
-..LN2191:
-        movl      %eax, -112(%rbp)                              #2767.17
-        jmp       ..B19.10      # Prob 100%                     #2767.17
-                                # LOE
-..B19.46:                       # Preds ..B19.42 ..B19.41 ..B19.10
-..LN2193:
-        xorl      %eax, %eax                                    #2776.12
-        leave                                                   #2776.12
-..___tag_value_eval_2na_16.271:                                 #
-        ret                                                     #2776.12
-        .align    2,0x90
-..___tag_value_eval_2na_16.272:                                 #
-                                # LOE
-# mark_end;
-	.type	eval_2na_16, at function
-	.size	eval_2na_16,.-eval_2na_16
-.LNeval_2na_16:
-	.data
-# -- End  eval_2na_16
-	.text
-# -- Begin  eval_2na_32
-# mark_begin;
-       .align    2,0x90
-eval_2na_32:
-# parameter 1(self): %rdi
-# parameter 2(ncbi2na): %rsi
-# parameter 3(pos): %edx
-# parameter 4(len): %ecx
-..B20.1:                        # Preds ..B20.0
-..___tag_value_eval_2na_32.275:                                 #
-..LN2195:
-        pushq     %rbp                                          #2782.1
-        movq      %rsp, %rbp                                    #2782.1
-..___tag_value_eval_2na_32.276:                                 #
-        subq      $336, %rsp                                    #2782.1
-        movq      %rdi, -48(%rbp)                               #2782.1
-        movq      %rsi, -40(%rbp)                               #2782.1
-        movl      %edx, -24(%rbp)                               #2782.1
-        movl      %ecx, -16(%rbp)                               #2782.1
-..LN2197:
-        movq      -48(%rbp), %rax                               #2812.25
-        movl      4(%rax), %eax                                 #2812.25
-..LN2199:
-        movl      %eax, -32(%rbp)                               #2812.23
-..LN2201:
-        movl      -16(%rbp), %eax                               #2815.5
-        movl      -32(%rbp), %edx                               #2815.5
-        cmpl      %edx, %eax                                    #2815.5
-        jae       ..B20.3       # Prob 50%                      #2815.5
-                                # LOE
-..B20.2:                        # Preds ..B20.1
-        lea       _2__STRING.9.0(%rip), %rax                    #2815.5
-        lea       _2__STRING.1.0(%rip), %rdx                    #2815.5
-        lea       __$U7.0(%rip), %rcx                           #2815.5
-        movq      %rax, %rdi                                    #2815.5
-        movq      %rdx, %rsi                                    #2815.5
-        movl      $2815, %edx                                   #2815.5
-        call      __assert_fail at PLT                             #2815.5
-                                # LOE
-..B20.3:                        # Preds ..B20.1
-..LN2203:
-        movl      -24(%rbp), %eax                               #2819.12
-..LN2205:
-        addl      -16(%rbp), %eax                               #2819.5
-        movl      %eax, -16(%rbp)                               #2819.5
-..LN2207:
-        movl      -24(%rbp), %eax                               #2822.42
-..LN2209:
-        shrl      $2, %eax                                      #2822.49
-..LN2211:
-        addq      -40(%rbp), %rax                               #2822.30
-..LN2213:
-        movq      %rax, -104(%rbp)                              #2822.5
-..LN2215:
-        movl      -32(%rbp), %eax                               #2825.18
-        negl      %eax                                          #2825.18
-        addl      -16(%rbp), %eax                               #2825.18
-..LN2217:
-        movl      %eax, -76(%rbp)                               #2825.5
-..LN2219:
-        movl      -16(%rbp), %eax                               #2828.44
-..LN2221:
-        addl      $3, %eax                                      #2828.50
-..LN2223:
-        shrl      $2, %eax                                      #2828.57
-..LN2225:
-        addq      -40(%rbp), %rax                               #2828.30
-..LN2227:
-        movq      %rax, -96(%rbp)                               #2828.5
-..LN2229:
-        movq      -104(%rbp), %rax                              #2831.33
-..LN2231:
-        movq      -96(%rbp), %rdx                               #2831.38
-..LN2233:
-        movq      %rax, %rdi                                    #2831.14
-        movq      %rdx, %rsi                                    #2831.14
-        call      prime_buffer_2na at PLT                          #2831.14
-                                # LOE xmm0
-..B20.49:                       # Preds ..B20.3
-        movdqa    %xmm0, -160(%rbp)                             #2831.14
-                                # LOE
-..B20.4:                        # Preds ..B20.49
-..LN2235:
-        movdqa    -160(%rbp), %xmm0                             #2831.5
-        movdqa    %xmm0, -304(%rbp)                             #2831.5
-..LN2237:
-        addq      $16, -104(%rbp)                               #2832.5
-..LN2239:
-        movq      -104(%rbp), %rax                              #2834.9
-..LN2241:
-        movq      %rax, -88(%rbp)                               #2834.5
-..LN2243:
-        movq      -104(%rbp), %rax                              #2837.10
-..LN2245:
-        movq      -96(%rbp), %rdx                               #2837.16
-        cmpq      %rdx, %rax                                    #2837.16
-        jae       ..B20.6       # Prob 50%                      #2837.16
-                                # LOE
-..B20.5:                        # Preds ..B20.4
-..LN2247:
-        movq      -104(%rbp), %rax                              #2838.24
-        movzbl    -1(%rax), %eax                                #2838.24
-        movzbl    %al, %eax                                     #2838.24
-..LN2249:
-        shll      $8, %eax                                      #2838.38
-..LN2251:
-        movl      %eax, -112(%rbp)                              #2838.9
-                                # LOE
-..B20.6:                        # Preds ..B20.5 ..B20.4
-..LN2253:
-        movq      -48(%rbp), %rax                               #2842.5
-        movdqa    16(%rax), %xmm0                               #2842.5
-        movdqa    %xmm0, -288(%rbp)                             #2842.5
-        movq      -48(%rbp), %rax                               #2842.5
-        movdqa    32(%rax), %xmm0                               #2842.5
-        movdqa    %xmm0, -272(%rbp)                             #2842.5
-        movq      -48(%rbp), %rax                               #2842.5
-        movdqa    48(%rax), %xmm0                               #2842.5
-        movdqa    %xmm0, -256(%rbp)                             #2842.5
-        movq      -48(%rbp), %rax                               #2842.5
-        movdqa    64(%rax), %xmm0                               #2842.5
-        movdqa    %xmm0, -240(%rbp)                             #2842.5
-        movq      -48(%rbp), %rax                               #2842.5
-        movdqa    80(%rax), %xmm0                               #2842.5
-        movdqa    %xmm0, -224(%rbp)                             #2842.5
-        movq      -48(%rbp), %rax                               #2842.5
-        movdqa    96(%rax), %xmm0                               #2842.5
-        movdqa    %xmm0, -208(%rbp)                             #2842.5
-        movq      -48(%rbp), %rax                               #2842.5
-        movdqa    112(%rax), %xmm0                              #2842.5
-        movdqa    %xmm0, -192(%rbp)                             #2842.5
-        movq      -48(%rbp), %rax                               #2842.5
-        movdqa    128(%rax), %xmm0                              #2842.5
-        movdqa    %xmm0, -176(%rbp)                             #2842.5
-..LN2255:
-        xorl      %eax, %eax                                    #2845.15
-        movl      %eax, -72(%rbp)                               #2845.15
-..LN2257:
-        movl      %eax, -68(%rbp)                               #2845.10
-..LN2259:
-        movl      %eax, -64(%rbp)                               #2845.5
-..LN2261:
-        movl      $4, -60(%rbp)                                 #2849.5
-..LN2263:
-        movl      -24(%rbp), %eax                               #2854.14
-..LN2265:
-        andl      $3, %eax                                      #2854.20
-        movl      %eax, -56(%rbp)                               #2854.20
-        je        ..B20.14      # Prob 50%                      #2854.20
-                                # LOE
-..B20.7:                        # Preds ..B20.6
-        movl      -56(%rbp), %eax                               #2854.20
-        cmpl      $1, %eax                                      #2854.20
-        je        ..B20.15      # Prob 50%                      #2854.20
-                                # LOE
-..B20.8:                        # Preds ..B20.7
-        movl      -56(%rbp), %eax                               #2854.20
-        cmpl      $2, %eax                                      #2854.20
-        je        ..B20.16      # Prob 50%                      #2854.20
-                                # LOE
-..B20.9:                        # Preds ..B20.8
-        movl      -56(%rbp), %eax                               #2854.20
-        cmpl      $3, %eax                                      #2854.20
-        je        ..B20.17      # Prob 50%                      #2854.20
-                                # LOE
-..B20.10:                       # Preds ..B20.45 ..B20.44 ..B20.9
-..LN2267:
-        movl      $1, %eax                                      #2859.9
-        testl     %eax, %eax                                    #2859.9
-        je        ..B20.46      # Prob 100%                     #2859.9
-                                # LOE
-..B20.11:                       # Preds ..B20.10
-..LN2269:
-        movl      $4, -60(%rbp)                                 #2861.13
-                                # LOE
-..B20.12:                       # Preds ..B20.39 ..B20.11
-..LN2271:
-        movl      $1, %eax                                      #2864.13
-        testl     %eax, %eax                                    #2864.13
-        je        ..B20.41      # Prob 100%                     #2864.13
-                                # LOE
-..B20.14:                       # Preds ..B20.6 ..B20.12
-..LN2273:
-        movdqa    -304(%rbp), %xmm0                             #2871.38
-..LN2275:
-        movdqa    -272(%rbp), %xmm1                             #2871.46
-..LN2277:
-        pand      %xmm1, %xmm0                                  #2871.22
-..LN2279:
-        movdqa    %xmm0, -320(%rbp)                             #2871.17
-..LN2281:
-        movdqa    -320(%rbp), %xmm0                             #2872.22
-        movdqa    -288(%rbp), %xmm1                             #2872.22
-        pcmpeqd   %xmm1, %xmm0                                  #2872.22
-..LN2283:
-        movdqa    %xmm0, -320(%rbp)                             #2872.17
-..LN2285:
-        movdqa    -320(%rbp), %xmm0                             #2873.42
-..LN2287:
-        pmovmskb  %xmm0, %eax                                   #2873.22
-..LN2289:
-        movl      %eax, -64(%rbp)                               #2873.17
-                                # LOE
-..B20.15:                       # Preds ..B20.7 ..B20.14
-..LN2291:
-        movdqa    -304(%rbp), %xmm0                             #2877.38
-..LN2293:
-        movdqa    -240(%rbp), %xmm1                             #2877.46
-..LN2295:
-        pand      %xmm1, %xmm0                                  #2877.22
-..LN2297:
-        movdqa    %xmm0, -320(%rbp)                             #2877.17
-..LN2299:
-        movdqa    -320(%rbp), %xmm0                             #2878.22
-        movdqa    -256(%rbp), %xmm1                             #2878.22
-        pcmpeqd   %xmm1, %xmm0                                  #2878.22
-..LN2301:
-        movdqa    %xmm0, -320(%rbp)                             #2878.17
-..LN2303:
-        movdqa    -320(%rbp), %xmm0                             #2879.42
-..LN2305:
-        pmovmskb  %xmm0, %eax                                   #2879.22
-..LN2307:
-        movl      %eax, -68(%rbp)                               #2879.17
-                                # LOE
-..B20.16:                       # Preds ..B20.8 ..B20.15
-..LN2309:
-        movdqa    -304(%rbp), %xmm0                             #2883.38
-..LN2311:
-        movdqa    -208(%rbp), %xmm1                             #2883.46
-..LN2313:
-        pand      %xmm1, %xmm0                                  #2883.22
-..LN2315:
-        movdqa    %xmm0, -320(%rbp)                             #2883.17
-..LN2317:
-        movdqa    -320(%rbp), %xmm0                             #2884.22
-        movdqa    -224(%rbp), %xmm1                             #2884.22
-        pcmpeqd   %xmm1, %xmm0                                  #2884.22
-..LN2319:
-        movdqa    %xmm0, -320(%rbp)                             #2884.17
-..LN2321:
-        movdqa    -320(%rbp), %xmm0                             #2885.42
-..LN2323:
-        pmovmskb  %xmm0, %eax                                   #2885.22
-..LN2325:
-        movl      %eax, -72(%rbp)                               #2885.17
-                                # LOE
-..B20.17:                       # Preds ..B20.9 ..B20.16
-..LN2327:
-        movdqa    -304(%rbp), %xmm0                             #2889.38
-..LN2329:
-        movdqa    -176(%rbp), %xmm1                             #2889.46
-..LN2331:
-        pand      %xmm1, %xmm0                                  #2889.22
-..LN2333:
-        movdqa    %xmm0, -320(%rbp)                             #2889.17
-..LN2335:
-        movdqa    -320(%rbp), %xmm0                             #2890.22
-        movdqa    -192(%rbp), %xmm1                             #2890.22
-        pcmpeqd   %xmm1, %xmm0                                  #2890.22
-..LN2337:
-        movdqa    %xmm0, -320(%rbp)                             #2890.17
-..LN2339:
-        movdqa    -320(%rbp), %xmm0                             #2891.42
-..LN2341:
-        pmovmskb  %xmm0, %eax                                   #2891.22
-..LN2343:
-        movl      %eax, -80(%rbp)                               #2891.17
-..LN2345:
-        andl      $-4, -24(%rbp)                                #2896.17
-..LN2347:
-        movl      -68(%rbp), %eax                               #2899.29
-        orl       -64(%rbp), %eax                               #2899.29
-..LN2349:
-        orl       -72(%rbp), %eax                               #2899.34
-..LN2351:
-        orl       -80(%rbp), %eax                               #2899.39
-..LN2353:
-        je        ..B20.34      # Prob 50%                      #2899.47
-                                # LOE
-..B20.18:                       # Preds ..B20.17
-..LN2355:
-        movl      -64(%rbp), %eax                               #2917.58
-..LN2357:
-        movl      %eax, %edi                                    #2917.30
-        call      uint16_lsbit at PLT                              #2917.30
-                                # LOE eax
-..B20.50:                       # Preds ..B20.18
-        movl      %eax, -128(%rbp)                              #2917.30
-                                # LOE
-..B20.19:                       # Preds ..B20.50
-        movl      -128(%rbp), %eax                              #2917.30
-        movswq    %ax, %rax                                     #2917.30
-..LN2359:
-        movl      %eax, -144(%rbp)                              #2917.28
-..LN2361:
-        movl      -68(%rbp), %eax                               #2918.58
-..LN2363:
-        movl      %eax, %edi                                    #2918.30
-        call      uint16_lsbit at PLT                              #2918.30
-                                # LOE eax
-..B20.51:                       # Preds ..B20.19
-        movl      %eax, -124(%rbp)                              #2918.30
-                                # LOE
-..B20.20:                       # Preds ..B20.51
-        movl      -124(%rbp), %eax                              #2918.30
-        movswq    %ax, %rax                                     #2918.30
-..LN2365:
-        movl      %eax, -140(%rbp)                              #2918.28
-..LN2367:
-        movl      -72(%rbp), %eax                               #2919.58
-..LN2369:
-        movl      %eax, %edi                                    #2919.30
-        call      uint16_lsbit at PLT                              #2919.30
-                                # LOE eax
-..B20.52:                       # Preds ..B20.20
-        movl      %eax, -120(%rbp)                              #2919.30
-                                # LOE
-..B20.21:                       # Preds ..B20.52
-        movl      -120(%rbp), %eax                              #2919.30
-        movswq    %ax, %rax                                     #2919.30
-..LN2371:
-        movl      %eax, -136(%rbp)                              #2919.28
-..LN2373:
-        movl      -80(%rbp), %eax                               #2920.58
-..LN2375:
-        movl      %eax, %edi                                    #2920.30
-        call      uint16_lsbit at PLT                              #2920.30
-                                # LOE eax
-..B20.53:                       # Preds ..B20.21
-        movl      %eax, -116(%rbp)                              #2920.30
-                                # LOE
-..B20.22:                       # Preds ..B20.53
-        movl      -116(%rbp), %eax                              #2920.30
-        movswq    %ax, %rax                                     #2920.30
-..LN2377:
-        movl      %eax, -132(%rbp)                              #2920.28
-..LN2379:
-        shll      $2, -144(%rbp)                                #2925.34
-..LN2381:
-        movl      -140(%rbp), %eax                              #2926.28
-..LN2383:
-        shll      $2, %eax                                      #2926.34
-..LN2385:
-        incl      %eax                                          #2926.40
-..LN2387:
-        movl      %eax, -140(%rbp)                              #2926.21
-..LN2389:
-        movl      -136(%rbp), %eax                              #2927.28
-..LN2391:
-        shll      $2, %eax                                      #2927.34
-..LN2393:
-        addl      $2, %eax                                      #2927.40
-..LN2395:
-        movl      %eax, -136(%rbp)                              #2927.21
-..LN2397:
-        movl      -132(%rbp), %eax                              #2928.28
-..LN2399:
-        shll      $2, %eax                                      #2928.34
-..LN2401:
-        addl      $3, %eax                                      #2928.40
-..LN2403:
-        movl      %eax, -132(%rbp)                              #2928.21
-..LN2405:
-        movl      -64(%rbp), %eax                               #2932.26
-..LN2407:
-        testl     %eax, %eax                                    #2932.32
-        je        ..B20.25      # Prob 50%                      #2932.32
-                                # LOE
-..B20.23:                       # Preds ..B20.22
-..LN2409:
-        movl      -144(%rbp), %eax                              #2932.43
-        addl      -24(%rbp), %eax                               #2932.43
-..LN2411:
-        movl      -76(%rbp), %edx                               #2932.49
-        cmpl      %edx, %eax                                    #2932.49
-        ja        ..B20.25      # Prob 50%                      #2932.49
-                                # LOE
-..B20.24:                       # Preds ..B20.23
-..LN2413:
-        movl      $1, %eax                                      #2932.63
-        leave                                                   #2932.63
-..___tag_value_eval_2na_32.280:                                 #
-        ret                                                     #2932.63
-..___tag_value_eval_2na_32.281:                                 #
-                                # LOE
-..B20.25:                       # Preds ..B20.23 ..B20.22
-..LN2415:
-        movl      -68(%rbp), %eax                               #2933.26
-..LN2417:
-        testl     %eax, %eax                                    #2933.32
-        je        ..B20.28      # Prob 50%                      #2933.32
-                                # LOE
-..B20.26:                       # Preds ..B20.25
-..LN2419:
-        movl      -140(%rbp), %eax                              #2933.43
-        addl      -24(%rbp), %eax                               #2933.43
-..LN2421:
-        movl      -76(%rbp), %edx                               #2933.49
-        cmpl      %edx, %eax                                    #2933.49
-        ja        ..B20.28      # Prob 50%                      #2933.49
-                                # LOE
-..B20.27:                       # Preds ..B20.26
-..LN2423:
-        movl      $1, %eax                                      #2933.63
-        leave                                                   #2933.63
-..___tag_value_eval_2na_32.283:                                 #
-        ret                                                     #2933.63
-..___tag_value_eval_2na_32.284:                                 #
-                                # LOE
-..B20.28:                       # Preds ..B20.26 ..B20.25
-..LN2425:
-        movl      -72(%rbp), %eax                               #2934.26
-..LN2427:
-        testl     %eax, %eax                                    #2934.32
-        je        ..B20.31      # Prob 50%                      #2934.32
-                                # LOE
-..B20.29:                       # Preds ..B20.28
-..LN2429:
-        movl      -136(%rbp), %eax                              #2934.43
-        addl      -24(%rbp), %eax                               #2934.43
-..LN2431:
-        movl      -76(%rbp), %edx                               #2934.49
-        cmpl      %edx, %eax                                    #2934.49
-        ja        ..B20.31      # Prob 50%                      #2934.49
-                                # LOE
-..B20.30:                       # Preds ..B20.29
-..LN2433:
-        movl      $1, %eax                                      #2934.63
-        leave                                                   #2934.63
-..___tag_value_eval_2na_32.286:                                 #
-        ret                                                     #2934.63
-..___tag_value_eval_2na_32.287:                                 #
-                                # LOE
-..B20.31:                       # Preds ..B20.29 ..B20.28
-..LN2435:
-        movl      -80(%rbp), %eax                               #2935.26
-..LN2437:
-        testl     %eax, %eax                                    #2935.32
-        je        ..B20.34      # Prob 50%                      #2935.32
-                                # LOE
-..B20.32:                       # Preds ..B20.31
-..LN2439:
-        movl      -132(%rbp), %eax                              #2935.43
-        addl      -24(%rbp), %eax                               #2935.43
-..LN2441:
-        movl      -76(%rbp), %edx                               #2935.49
-        cmpl      %edx, %eax                                    #2935.49
-        ja        ..B20.34      # Prob 50%                      #2935.49
-                                # LOE
-..B20.33:                       # Preds ..B20.32
-..LN2443:
-        movl      $1, %eax                                      #2935.63
-        leave                                                   #2935.63
-..___tag_value_eval_2na_32.289:                                 #
-        ret                                                     #2935.63
-..___tag_value_eval_2na_32.290:                                 #
-                                # LOE
-..B20.34:                       # Preds ..B20.32 ..B20.31 ..B20.17
-..LN2445:
-        addl      $4, -24(%rbp)                                 #2940.17
-..LN2447:
-        movl      -24(%rbp), %eax                               #2943.22
-..LN2449:
-        movl      -76(%rbp), %edx                               #2943.28
-        cmpl      %edx, %eax                                    #2943.28
-        jbe       ..B20.36      # Prob 50%                      #2943.28
-                                # LOE
-..B20.35:                       # Preds ..B20.34
-..LN2451:
-        xorl      %eax, %eax                                    #2944.28
-        leave                                                   #2944.28
-..___tag_value_eval_2na_32.292:                                 #
-        ret                                                     #2944.28
-..___tag_value_eval_2na_32.293:                                 #
-                                # LOE
-..B20.36:                       # Preds ..B20.34
-..LN2453:
-        movl      -60(%rbp), %eax                               #2947.25
-        decl      %eax                                          #2947.25
-        movl      %eax, -60(%rbp)                               #2947.25
-..LN2455:
-        je        ..B20.41      # Prob 50%                      #2947.39
-                                # LOE
-..B20.37:                       # Preds ..B20.36
-..LN2457:
-        movdqa    -304(%rbp), %xmm0                             #2952.43
-..LN2459:
-        psrldq    $1, %xmm0                                     #2952.26
-..LN2461:
-        movdqa    %xmm0, -304(%rbp)                             #2952.17
-..LN2463:
-        movq      -88(%rbp), %rax                               #2955.22
-..LN2465:
-        movq      -96(%rbp), %rdx                               #2955.26
-        cmpq      %rdx, %rax                                    #2955.26
-        jae       ..B20.39      # Prob 50%                      #2955.26
-                                # LOE
-..B20.38:                       # Preds ..B20.37
-..LN2467:
-        sarl      $8, -112(%rbp)                                #2957.21
-..LN2469:
-        movq      -88(%rbp), %rax                               #2958.37
-        movzbl    (%rax), %eax                                  #2958.37
-        movzbl    %al, %eax                                     #2958.37
-..LN2471:
-        shll      $8, %eax                                      #2958.48
-..LN2473:
-        orl       -112(%rbp), %eax                              #2958.21
-        movl      %eax, -112(%rbp)                              #2958.21
-..LN2475:
-        movdqa    -304(%rbp), %xmm0                             #2959.49
-..LN2477:
-        movl      -112(%rbp), %eax                              #2959.57
-..LN2479:
-        pinsrw    $7, %eax, %xmm0                               #2959.30
-..LN2481:
-        movdqa    %xmm0, -304(%rbp)                             #2959.21
-                                # LOE
-..B20.39:                       # Preds ..B20.38 ..B20.37
-..LN2483:
-        incq      -88(%rbp)                                     #2963.20
-        jmp       ..B20.12      # Prob 100%                     #2963.20
-                                # LOE
-..B20.41:                       # Preds ..B20.36 ..B20.12
-..LN2485:
-        movq      -104(%rbp), %rax                              #2968.18
-..LN2487:
-        movq      -96(%rbp), %rdx                               #2968.25
-        cmpq      %rdx, %rax                                    #2968.25
-        jae       ..B20.46      # Prob 50%                      #2968.25
-                                # LOE
-..B20.42:                       # Preds ..B20.41
-..LN2489:
-        addl      $48, -24(%rbp)                                #2972.13
-..LN2491:
-        movl      -24(%rbp), %eax                               #2973.18
-..LN2493:
-        movl      -76(%rbp), %edx                               #2973.24
-        cmpl      %edx, %eax                                    #2973.24
-        ja        ..B20.46      # Prob 50%                      #2973.24
-                                # LOE
-..B20.43:                       # Preds ..B20.42
-..LN2495:
-        movq      -104(%rbp), %rax                              #2978.41
-..LN2497:
-        movq      -96(%rbp), %rdx                               #2978.46
-..LN2499:
-        movq      %rax, %rdi                                    #2978.22
-        movq      %rdx, %rsi                                    #2978.22
-        call      prime_buffer_2na at PLT                          #2978.22
-                                # LOE xmm0
-..B20.54:                       # Preds ..B20.43
-        movdqa    %xmm0, -336(%rbp)                             #2978.22
-                                # LOE
-..B20.44:                       # Preds ..B20.54
-..LN2501:
-        movdqa    -336(%rbp), %xmm0                             #2978.13
-        movdqa    %xmm0, -304(%rbp)                             #2978.13
-..LN2503:
-        addq      $16, -104(%rbp)                               #3056.13
-..LN2505:
-        movq      -104(%rbp), %rax                              #3058.17
-..LN2507:
-        movq      %rax, -88(%rbp)                               #3058.13
-..LN2509:
-        movq      -104(%rbp), %rax                              #3059.18
-..LN2511:
-        movq      -96(%rbp), %rdx                               #3059.24
-        cmpq      %rdx, %rax                                    #3059.24
-        jae       ..B20.10      # Prob 50%                      #3059.24
-                                # LOE
-..B20.45:                       # Preds ..B20.44
-..LN2513:
-        movq      -104(%rbp), %rax                              #3060.32
-        movzbl    -1(%rax), %eax                                #3060.32
-        movzbl    %al, %eax                                     #3060.32
-..LN2515:
-        shll      $8, %eax                                      #3060.46
-..LN2517:
-        movl      %eax, -112(%rbp)                              #3060.17
-        jmp       ..B20.10      # Prob 100%                     #3060.17
-                                # LOE
-..B20.46:                       # Preds ..B20.42 ..B20.41 ..B20.10
-..LN2519:
-        xorl      %eax, %eax                                    #3069.12
-        leave                                                   #3069.12
-..___tag_value_eval_2na_32.295:                                 #
-        ret                                                     #3069.12
-        .align    2,0x90
-..___tag_value_eval_2na_32.296:                                 #
-                                # LOE
-# mark_end;
-	.type	eval_2na_32, at function
-	.size	eval_2na_32,.-eval_2na_32
-.LNeval_2na_32:
-	.data
-# -- End  eval_2na_32
-	.text
-# -- Begin  eval_2na_64
-# mark_begin;
-       .align    2,0x90
-eval_2na_64:
-# parameter 1(self): %rdi
-# parameter 2(ncbi2na): %rsi
-# parameter 3(pos): %edx
-# parameter 4(len): %ecx
-..B21.1:                        # Preds ..B21.0
-..___tag_value_eval_2na_64.299:                                 #
-..LN2521:
-        pushq     %rbp                                          #3075.1
-        movq      %rsp, %rbp                                    #3075.1
-..___tag_value_eval_2na_64.300:                                 #
-        subq      $336, %rsp                                    #3075.1
-        movq      %rdi, -48(%rbp)                               #3075.1
-        movq      %rsi, -40(%rbp)                               #3075.1
-        movl      %edx, -24(%rbp)                               #3075.1
-        movl      %ecx, -16(%rbp)                               #3075.1
-..LN2523:
-        movq      -48(%rbp), %rax                               #3106.25
-        movl      4(%rax), %eax                                 #3106.25
-..LN2525:
-        movl      %eax, -32(%rbp)                               #3106.23
-..LN2527:
-        movl      -16(%rbp), %eax                               #3109.5
-        movl      -32(%rbp), %edx                               #3109.5
-        cmpl      %edx, %eax                                    #3109.5
-        jae       ..B21.3       # Prob 50%                      #3109.5
-                                # LOE
-..B21.2:                        # Preds ..B21.1
-        lea       _2__STRING.9.0(%rip), %rax                    #3109.5
-        lea       _2__STRING.1.0(%rip), %rdx                    #3109.5
-        lea       __$U8.0(%rip), %rcx                           #3109.5
-        movq      %rax, %rdi                                    #3109.5
-        movq      %rdx, %rsi                                    #3109.5
-        movl      $3109, %edx                                   #3109.5
-        call      __assert_fail at PLT                             #3109.5
-                                # LOE
-..B21.3:                        # Preds ..B21.1
-..LN2529:
-        movl      -24(%rbp), %eax                               #3113.12
-..LN2531:
-        addl      -16(%rbp), %eax                               #3113.5
-        movl      %eax, -16(%rbp)                               #3113.5
-..LN2533:
-        movl      -24(%rbp), %eax                               #3116.42
-..LN2535:
-        shrl      $2, %eax                                      #3116.49
-..LN2537:
-        addq      -40(%rbp), %rax                               #3116.30
-..LN2539:
-        movq      %rax, -104(%rbp)                              #3116.5
-..LN2541:
-        movl      -32(%rbp), %eax                               #3119.18
-        negl      %eax                                          #3119.18
-        addl      -16(%rbp), %eax                               #3119.18
-..LN2543:
-        movl      %eax, -76(%rbp)                               #3119.5
-..LN2545:
-        movl      -16(%rbp), %eax                               #3122.44
-..LN2547:
-        addl      $3, %eax                                      #3122.50
-..LN2549:
-        shrl      $2, %eax                                      #3122.57
-..LN2551:
-        addq      -40(%rbp), %rax                               #3122.30
-..LN2553:
-        movq      %rax, -96(%rbp)                               #3122.5
-..LN2555:
-        movq      -104(%rbp), %rax                              #3125.33
-..LN2557:
-        movq      -96(%rbp), %rdx                               #3125.38
-..LN2559:
-        movq      %rax, %rdi                                    #3125.14
-        movq      %rdx, %rsi                                    #3125.14
-        call      prime_buffer_2na at PLT                          #3125.14
-                                # LOE xmm0
-..B21.49:                       # Preds ..B21.3
-        movdqa    %xmm0, -160(%rbp)                             #3125.14
-                                # LOE
-..B21.4:                        # Preds ..B21.49
-..LN2561:
-        movdqa    -160(%rbp), %xmm0                             #3125.5
-        movdqa    %xmm0, -304(%rbp)                             #3125.5
-..LN2563:
-        addq      $16, -104(%rbp)                               #3126.5
-..LN2565:
-        movq      -104(%rbp), %rax                              #3128.9
-..LN2567:
-        movq      %rax, -88(%rbp)                               #3128.5
-..LN2569:
-        movq      -104(%rbp), %rax                              #3131.10
-..LN2571:
-        movq      -96(%rbp), %rdx                               #3131.16
-        cmpq      %rdx, %rax                                    #3131.16
-        jae       ..B21.6       # Prob 50%                      #3131.16
-                                # LOE
-..B21.5:                        # Preds ..B21.4
-..LN2573:
-        movq      -104(%rbp), %rax                              #3132.24
-        movzbl    -1(%rax), %eax                                #3132.24
-        movzbl    %al, %eax                                     #3132.24
-..LN2575:
-        shll      $8, %eax                                      #3132.38
-..LN2577:
-        movl      %eax, -112(%rbp)                              #3132.9
-                                # LOE
-..B21.6:                        # Preds ..B21.5 ..B21.4
-..LN2579:
-        movq      -48(%rbp), %rax                               #3136.5
-        movdqa    16(%rax), %xmm0                               #3136.5
-        movdqa    %xmm0, -288(%rbp)                             #3136.5
-        movq      -48(%rbp), %rax                               #3136.5
-        movdqa    32(%rax), %xmm0                               #3136.5
-        movdqa    %xmm0, -272(%rbp)                             #3136.5
-        movq      -48(%rbp), %rax                               #3136.5
-        movdqa    48(%rax), %xmm0                               #3136.5
-        movdqa    %xmm0, -256(%rbp)                             #3136.5
-        movq      -48(%rbp), %rax                               #3136.5
-        movdqa    64(%rax), %xmm0                               #3136.5
-        movdqa    %xmm0, -240(%rbp)                             #3136.5
-        movq      -48(%rbp), %rax                               #3136.5
-        movdqa    80(%rax), %xmm0                               #3136.5
-        movdqa    %xmm0, -224(%rbp)                             #3136.5
-        movq      -48(%rbp), %rax                               #3136.5
-        movdqa    96(%rax), %xmm0                               #3136.5
-        movdqa    %xmm0, -208(%rbp)                             #3136.5
-        movq      -48(%rbp), %rax                               #3136.5
-        movdqa    112(%rax), %xmm0                              #3136.5
-        movdqa    %xmm0, -192(%rbp)                             #3136.5
-        movq      -48(%rbp), %rax                               #3136.5
-        movdqa    128(%rax), %xmm0                              #3136.5
-        movdqa    %xmm0, -176(%rbp)                             #3136.5
-..LN2581:
-        xorl      %eax, %eax                                    #3139.15
-        movl      %eax, -72(%rbp)                               #3139.15
-..LN2583:
-        movl      %eax, -68(%rbp)                               #3139.10
-..LN2585:
-        movl      %eax, -64(%rbp)                               #3139.5
-..LN2587:
-        movl      $8, -60(%rbp)                                 #3143.5
-..LN2589:
-        movl      -24(%rbp), %eax                               #3148.14
-..LN2591:
-        andl      $3, %eax                                      #3148.20
-        movl      %eax, -56(%rbp)                               #3148.20
-        je        ..B21.14      # Prob 50%                      #3148.20
-                                # LOE
-..B21.7:                        # Preds ..B21.6
-        movl      -56(%rbp), %eax                               #3148.20
-        cmpl      $1, %eax                                      #3148.20
-        je        ..B21.15      # Prob 50%                      #3148.20
-                                # LOE
-..B21.8:                        # Preds ..B21.7
-        movl      -56(%rbp), %eax                               #3148.20
-        cmpl      $2, %eax                                      #3148.20
-        je        ..B21.16      # Prob 50%                      #3148.20
-                                # LOE
-..B21.9:                        # Preds ..B21.8
-        movl      -56(%rbp), %eax                               #3148.20
-        cmpl      $3, %eax                                      #3148.20
-        je        ..B21.17      # Prob 50%                      #3148.20
-                                # LOE
-..B21.10:                       # Preds ..B21.45 ..B21.44 ..B21.9
-..LN2593:
-        movl      $1, %eax                                      #3153.9
-        testl     %eax, %eax                                    #3153.9
-        je        ..B21.46      # Prob 100%                     #3153.9
-                                # LOE
-..B21.11:                       # Preds ..B21.10
-..LN2595:
-        movl      $8, -60(%rbp)                                 #3155.13
-                                # LOE
-..B21.12:                       # Preds ..B21.39 ..B21.11
-..LN2597:
-        movl      $1, %eax                                      #3158.13
-        testl     %eax, %eax                                    #3158.13
-        je        ..B21.41      # Prob 100%                     #3158.13
-                                # LOE
-..B21.14:                       # Preds ..B21.6 ..B21.12
-..LN2599:
-        movdqa    -304(%rbp), %xmm0                             #3165.38
-..LN2601:
-        movdqa    -272(%rbp), %xmm1                             #3165.46
-..LN2603:
-        pand      %xmm1, %xmm0                                  #3165.22
-..LN2605:
-        movdqa    %xmm0, -320(%rbp)                             #3165.17
-..LN2607:
-        movdqa    -320(%rbp), %xmm0                             #3166.22
-        movdqa    -288(%rbp), %xmm1                             #3166.22
-        pcmpeqd   %xmm1, %xmm0                                  #3166.22
-..LN2609:
-        movdqa    %xmm0, -320(%rbp)                             #3166.17
-..LN2611:
-        movdqa    -320(%rbp), %xmm0                             #3167.42
-..LN2613:
-        pmovmskb  %xmm0, %eax                                   #3167.22
-..LN2615:
-        movl      %eax, -64(%rbp)                               #3167.17
-..LN2617:
-        movl      -64(%rbp), %eax                               #3168.17
-        andl      $3855, %eax                                   #3168.17
-        shll      $4, %eax                                      #3168.17
-        andl      -64(%rbp), %eax                               #3168.17
-        movl      %eax, -64(%rbp)                               #3168.17
-        movl      -64(%rbp), %eax                               #3168.17
-        sarl      $4, %eax                                      #3168.17
-        orl       -64(%rbp), %eax                               #3168.17
-        movl      %eax, -64(%rbp)                               #3168.17
-                                # LOE
-..B21.15:                       # Preds ..B21.7 ..B21.14
-..LN2619:
-        movdqa    -304(%rbp), %xmm0                             #3171.38
-..LN2621:
-        movdqa    -240(%rbp), %xmm1                             #3171.46
-..LN2623:
-        pand      %xmm1, %xmm0                                  #3171.22
-..LN2625:
-        movdqa    %xmm0, -320(%rbp)                             #3171.17
-..LN2627:
-        movdqa    -320(%rbp), %xmm0                             #3172.22
-        movdqa    -256(%rbp), %xmm1                             #3172.22
-        pcmpeqd   %xmm1, %xmm0                                  #3172.22
-..LN2629:
-        movdqa    %xmm0, -320(%rbp)                             #3172.17
-..LN2631:
-        movdqa    -320(%rbp), %xmm0                             #3173.42
-..LN2633:
-        pmovmskb  %xmm0, %eax                                   #3173.22
-..LN2635:
-        movl      %eax, -68(%rbp)                               #3173.17
-..LN2637:
-        movl      -68(%rbp), %eax                               #3174.17
-        andl      $3855, %eax                                   #3174.17
-        shll      $4, %eax                                      #3174.17
-        andl      -68(%rbp), %eax                               #3174.17
-        movl      %eax, -68(%rbp)                               #3174.17
-        movl      -68(%rbp), %eax                               #3174.17
-        sarl      $4, %eax                                      #3174.17
-        orl       -68(%rbp), %eax                               #3174.17
-        movl      %eax, -68(%rbp)                               #3174.17
-                                # LOE
-..B21.16:                       # Preds ..B21.8 ..B21.15
-..LN2639:
-        movdqa    -304(%rbp), %xmm0                             #3177.38
-..LN2641:
-        movdqa    -208(%rbp), %xmm1                             #3177.46
-..LN2643:
-        pand      %xmm1, %xmm0                                  #3177.22
-..LN2645:
-        movdqa    %xmm0, -320(%rbp)                             #3177.17
-..LN2647:
-        movdqa    -320(%rbp), %xmm0                             #3178.22
-        movdqa    -224(%rbp), %xmm1                             #3178.22
-        pcmpeqd   %xmm1, %xmm0                                  #3178.22
-..LN2649:
-        movdqa    %xmm0, -320(%rbp)                             #3178.17
-..LN2651:
-        movdqa    -320(%rbp), %xmm0                             #3179.42
-..LN2653:
-        pmovmskb  %xmm0, %eax                                   #3179.22
-..LN2655:
-        movl      %eax, -72(%rbp)                               #3179.17
-..LN2657:
-        movl      -72(%rbp), %eax                               #3180.17
-        andl      $3855, %eax                                   #3180.17
-        shll      $4, %eax                                      #3180.17
-        andl      -72(%rbp), %eax                               #3180.17
-        movl      %eax, -72(%rbp)                               #3180.17
-        movl      -72(%rbp), %eax                               #3180.17
-        sarl      $4, %eax                                      #3180.17
-        orl       -72(%rbp), %eax                               #3180.17
-        movl      %eax, -72(%rbp)                               #3180.17
-                                # LOE
-..B21.17:                       # Preds ..B21.9 ..B21.16
-..LN2659:
-        movdqa    -304(%rbp), %xmm0                             #3183.38
-..LN2661:
-        movdqa    -176(%rbp), %xmm1                             #3183.46
-..LN2663:
-        pand      %xmm1, %xmm0                                  #3183.22
-..LN2665:
-        movdqa    %xmm0, -320(%rbp)                             #3183.17
-..LN2667:
-        movdqa    -320(%rbp), %xmm0                             #3184.22
-        movdqa    -192(%rbp), %xmm1                             #3184.22
-        pcmpeqd   %xmm1, %xmm0                                  #3184.22
-..LN2669:
-        movdqa    %xmm0, -320(%rbp)                             #3184.17
-..LN2671:
-        movdqa    -320(%rbp), %xmm0                             #3185.42
-..LN2673:
-        pmovmskb  %xmm0, %eax                                   #3185.22
-..LN2675:
-        movl      %eax, -80(%rbp)                               #3185.17
-..LN2677:
-        movl      -80(%rbp), %eax                               #3186.17
-        andl      $3855, %eax                                   #3186.17
-        shll      $4, %eax                                      #3186.17
-        andl      -80(%rbp), %eax                               #3186.17
-        movl      %eax, -80(%rbp)                               #3186.17
-        movl      -80(%rbp), %eax                               #3186.17
-        sarl      $4, %eax                                      #3186.17
-        orl       -80(%rbp), %eax                               #3186.17
-        movl      %eax, -80(%rbp)                               #3186.17
-..LN2679:
-        andl      $-4, -24(%rbp)                                #3190.17
-..LN2681:
-        movl      -68(%rbp), %eax                               #3193.29
-        orl       -64(%rbp), %eax                               #3193.29
-..LN2683:
-        orl       -72(%rbp), %eax                               #3193.34
-..LN2685:
-        orl       -80(%rbp), %eax                               #3193.39
-..LN2687:
-        je        ..B21.34      # Prob 50%                      #3193.47
-                                # LOE
-..B21.18:                       # Preds ..B21.17
-..LN2689:
-        movl      -64(%rbp), %eax                               #3211.58
-..LN2691:
-        movl      %eax, %edi                                    #3211.30
-        call      uint16_lsbit at PLT                              #3211.30
-                                # LOE eax
-..B21.50:                       # Preds ..B21.18
-        movl      %eax, -128(%rbp)                              #3211.30
-                                # LOE
-..B21.19:                       # Preds ..B21.50
-        movl      -128(%rbp), %eax                              #3211.30
-        movswq    %ax, %rax                                     #3211.30
-..LN2693:
-        movl      %eax, -144(%rbp)                              #3211.28
-..LN2695:
-        movl      -68(%rbp), %eax                               #3212.58
-..LN2697:
-        movl      %eax, %edi                                    #3212.30
-        call      uint16_lsbit at PLT                              #3212.30
-                                # LOE eax
-..B21.51:                       # Preds ..B21.19
-        movl      %eax, -124(%rbp)                              #3212.30
-                                # LOE
-..B21.20:                       # Preds ..B21.51
-        movl      -124(%rbp), %eax                              #3212.30
-        movswq    %ax, %rax                                     #3212.30
-..LN2699:
-        movl      %eax, -140(%rbp)                              #3212.28
-..LN2701:
-        movl      -72(%rbp), %eax                               #3213.58
-..LN2703:
-        movl      %eax, %edi                                    #3213.30
-        call      uint16_lsbit at PLT                              #3213.30
-                                # LOE eax
-..B21.52:                       # Preds ..B21.20
-        movl      %eax, -120(%rbp)                              #3213.30
-                                # LOE
-..B21.21:                       # Preds ..B21.52
-        movl      -120(%rbp), %eax                              #3213.30
-        movswq    %ax, %rax                                     #3213.30
-..LN2705:
-        movl      %eax, -136(%rbp)                              #3213.28
-..LN2707:
-        movl      -80(%rbp), %eax                               #3214.58
-..LN2709:
-        movl      %eax, %edi                                    #3214.30
-        call      uint16_lsbit at PLT                              #3214.30
-                                # LOE eax
-..B21.53:                       # Preds ..B21.21
-        movl      %eax, -116(%rbp)                              #3214.30
-                                # LOE
-..B21.22:                       # Preds ..B21.53
-        movl      -116(%rbp), %eax                              #3214.30
-        movswq    %ax, %rax                                     #3214.30
-..LN2711:
-        movl      %eax, -132(%rbp)                              #3214.28
-..LN2713:
-        shll      $2, -144(%rbp)                                #3219.34
-..LN2715:
-        movl      -140(%rbp), %eax                              #3220.28
-..LN2717:
-        shll      $2, %eax                                      #3220.34
-..LN2719:
-        incl      %eax                                          #3220.40
-..LN2721:
-        movl      %eax, -140(%rbp)                              #3220.21
-..LN2723:
-        movl      -136(%rbp), %eax                              #3221.28
-..LN2725:
-        shll      $2, %eax                                      #3221.34
-..LN2727:
-        addl      $2, %eax                                      #3221.40
-..LN2729:
-        movl      %eax, -136(%rbp)                              #3221.21
-..LN2731:
-        movl      -132(%rbp), %eax                              #3222.28
-..LN2733:
-        shll      $2, %eax                                      #3222.34
-..LN2735:
-        addl      $3, %eax                                      #3222.40
-..LN2737:
-        movl      %eax, -132(%rbp)                              #3222.21
-..LN2739:
-        movl      -64(%rbp), %eax                               #3226.26
-..LN2741:
-        testl     %eax, %eax                                    #3226.32
-        je        ..B21.25      # Prob 50%                      #3226.32
-                                # LOE
-..B21.23:                       # Preds ..B21.22
-..LN2743:
-        movl      -144(%rbp), %eax                              #3226.43
-        addl      -24(%rbp), %eax                               #3226.43
-..LN2745:
-        movl      -76(%rbp), %edx                               #3226.49
-        cmpl      %edx, %eax                                    #3226.49
-        ja        ..B21.25      # Prob 50%                      #3226.49
-                                # LOE
-..B21.24:                       # Preds ..B21.23
-..LN2747:
-        movl      $1, %eax                                      #3226.63
-        leave                                                   #3226.63
-..___tag_value_eval_2na_64.304:                                 #
-        ret                                                     #3226.63
-..___tag_value_eval_2na_64.305:                                 #
-                                # LOE
-..B21.25:                       # Preds ..B21.23 ..B21.22
-..LN2749:
-        movl      -68(%rbp), %eax                               #3227.26
-..LN2751:
-        testl     %eax, %eax                                    #3227.32
-        je        ..B21.28      # Prob 50%                      #3227.32
-                                # LOE
-..B21.26:                       # Preds ..B21.25
-..LN2753:
-        movl      -140(%rbp), %eax                              #3227.43
-        addl      -24(%rbp), %eax                               #3227.43
-..LN2755:
-        movl      -76(%rbp), %edx                               #3227.49
-        cmpl      %edx, %eax                                    #3227.49
-        ja        ..B21.28      # Prob 50%                      #3227.49
-                                # LOE
-..B21.27:                       # Preds ..B21.26
-..LN2757:
-        movl      $1, %eax                                      #3227.63
-        leave                                                   #3227.63
-..___tag_value_eval_2na_64.307:                                 #
-        ret                                                     #3227.63
-..___tag_value_eval_2na_64.308:                                 #
-                                # LOE
-..B21.28:                       # Preds ..B21.26 ..B21.25
-..LN2759:
-        movl      -72(%rbp), %eax                               #3228.26
-..LN2761:
-        testl     %eax, %eax                                    #3228.32
-        je        ..B21.31      # Prob 50%                      #3228.32
-                                # LOE
-..B21.29:                       # Preds ..B21.28
-..LN2763:
-        movl      -136(%rbp), %eax                              #3228.43
-        addl      -24(%rbp), %eax                               #3228.43
-..LN2765:
-        movl      -76(%rbp), %edx                               #3228.49
-        cmpl      %edx, %eax                                    #3228.49
-        ja        ..B21.31      # Prob 50%                      #3228.49
-                                # LOE
-..B21.30:                       # Preds ..B21.29
-..LN2767:
-        movl      $1, %eax                                      #3228.63
-        leave                                                   #3228.63
-..___tag_value_eval_2na_64.310:                                 #
-        ret                                                     #3228.63
-..___tag_value_eval_2na_64.311:                                 #
-                                # LOE
-..B21.31:                       # Preds ..B21.29 ..B21.28
-..LN2769:
-        movl      -80(%rbp), %eax                               #3229.26
-..LN2771:
-        testl     %eax, %eax                                    #3229.32
-        je        ..B21.34      # Prob 50%                      #3229.32
-                                # LOE
-..B21.32:                       # Preds ..B21.31
-..LN2773:
-        movl      -132(%rbp), %eax                              #3229.43
-        addl      -24(%rbp), %eax                               #3229.43
-..LN2775:
-        movl      -76(%rbp), %edx                               #3229.49
-        cmpl      %edx, %eax                                    #3229.49
-        ja        ..B21.34      # Prob 50%                      #3229.49
-                                # LOE
-..B21.33:                       # Preds ..B21.32
-..LN2777:
-        movl      $1, %eax                                      #3229.63
-        leave                                                   #3229.63
-..___tag_value_eval_2na_64.313:                                 #
-        ret                                                     #3229.63
-..___tag_value_eval_2na_64.314:                                 #
-                                # LOE
-..B21.34:                       # Preds ..B21.32 ..B21.31 ..B21.17
-..LN2779:
-        addl      $4, -24(%rbp)                                 #3234.17
-..LN2781:
-        movl      -24(%rbp), %eax                               #3237.22
-..LN2783:
-        movl      -76(%rbp), %edx                               #3237.28
-        cmpl      %edx, %eax                                    #3237.28
-        jbe       ..B21.36      # Prob 50%                      #3237.28
-                                # LOE
-..B21.35:                       # Preds ..B21.34
-..LN2785:
-        xorl      %eax, %eax                                    #3238.28
-        leave                                                   #3238.28
-..___tag_value_eval_2na_64.316:                                 #
-        ret                                                     #3238.28
-..___tag_value_eval_2na_64.317:                                 #
-                                # LOE
-..B21.36:                       # Preds ..B21.34
-..LN2787:
-        movl      -60(%rbp), %eax                               #3241.25
-        decl      %eax                                          #3241.25
-        movl      %eax, -60(%rbp)                               #3241.25
-..LN2789:
-        je        ..B21.41      # Prob 50%                      #3241.39
-                                # LOE
-..B21.37:                       # Preds ..B21.36
-..LN2791:
-        movdqa    -304(%rbp), %xmm0                             #3246.43
-..LN2793:
-        psrldq    $1, %xmm0                                     #3246.26
-..LN2795:
-        movdqa    %xmm0, -304(%rbp)                             #3246.17
-..LN2797:
-        movq      -88(%rbp), %rax                               #3249.22
-..LN2799:
-        movq      -96(%rbp), %rdx                               #3249.26
-        cmpq      %rdx, %rax                                    #3249.26
-        jae       ..B21.39      # Prob 50%                      #3249.26
-                                # LOE
-..B21.38:                       # Preds ..B21.37
-..LN2801:
-        sarl      $8, -112(%rbp)                                #3251.21
-..LN2803:
-        movq      -88(%rbp), %rax                               #3252.37
-        movzbl    (%rax), %eax                                  #3252.37
-        movzbl    %al, %eax                                     #3252.37
-..LN2805:
-        shll      $8, %eax                                      #3252.48
-..LN2807:
-        orl       -112(%rbp), %eax                              #3252.21
-        movl      %eax, -112(%rbp)                              #3252.21
-..LN2809:
-        movdqa    -304(%rbp), %xmm0                             #3253.49
-..LN2811:
-        movl      -112(%rbp), %eax                              #3253.57
-..LN2813:
-        pinsrw    $7, %eax, %xmm0                               #3253.30
-..LN2815:
-        movdqa    %xmm0, -304(%rbp)                             #3253.21
-                                # LOE
-..B21.39:                       # Preds ..B21.38 ..B21.37
-..LN2817:
-        incq      -88(%rbp)                                     #3257.20
-        jmp       ..B21.12      # Prob 100%                     #3257.20
-                                # LOE
-..B21.41:                       # Preds ..B21.36 ..B21.12
-..LN2819:
-        movq      -104(%rbp), %rax                              #3262.18
-..LN2821:
-        movq      -96(%rbp), %rdx                               #3262.25
-        cmpq      %rdx, %rax                                    #3262.25
-        jae       ..B21.46      # Prob 50%                      #3262.25
-                                # LOE
-..B21.42:                       # Preds ..B21.41
-..LN2823:
-        addl      $32, -24(%rbp)                                #3266.13
-..LN2825:
-        movl      -24(%rbp), %eax                               #3267.18
-..LN2827:
-        movl      -76(%rbp), %edx                               #3267.24
-        cmpl      %edx, %eax                                    #3267.24
-        ja        ..B21.46      # Prob 50%                      #3267.24
-                                # LOE
-..B21.43:                       # Preds ..B21.42
-..LN2829:
-        movq      -104(%rbp), %rax                              #3272.41
-..LN2831:
-        movq      -96(%rbp), %rdx                               #3272.46
-..LN2833:
-        movq      %rax, %rdi                                    #3272.22
-        movq      %rdx, %rsi                                    #3272.22
-        call      prime_buffer_2na at PLT                          #3272.22
-                                # LOE xmm0
-..B21.54:                       # Preds ..B21.43
-        movdqa    %xmm0, -336(%rbp)                             #3272.22
-                                # LOE
-..B21.44:                       # Preds ..B21.54
-..LN2835:
-        movdqa    -336(%rbp), %xmm0                             #3272.13
-        movdqa    %xmm0, -304(%rbp)                             #3272.13
-..LN2837:
-        addq      $16, -104(%rbp)                               #3350.13
-..LN2839:
-        movq      -104(%rbp), %rax                              #3352.17
-..LN2841:
-        movq      %rax, -88(%rbp)                               #3352.13
-..LN2843:
-        movq      -104(%rbp), %rax                              #3353.18
-..LN2845:
-        movq      -96(%rbp), %rdx                               #3353.24
-        cmpq      %rdx, %rax                                    #3353.24
-        jae       ..B21.10      # Prob 50%                      #3353.24
-                                # LOE
-..B21.45:                       # Preds ..B21.44
-..LN2847:
-        movq      -104(%rbp), %rax                              #3354.32
-        movzbl    -1(%rax), %eax                                #3354.32
-        movzbl    %al, %eax                                     #3354.32
-..LN2849:
-        shll      $8, %eax                                      #3354.46
-..LN2851:
-        movl      %eax, -112(%rbp)                              #3354.17
-        jmp       ..B21.10      # Prob 100%                     #3354.17
-                                # LOE
-..B21.46:                       # Preds ..B21.42 ..B21.41 ..B21.10
-..LN2853:
-        xorl      %eax, %eax                                    #3363.12
-        leave                                                   #3363.12
-..___tag_value_eval_2na_64.319:                                 #
-        ret                                                     #3363.12
-        .align    2,0x90
-..___tag_value_eval_2na_64.320:                                 #
-                                # LOE
-# mark_end;
-	.type	eval_2na_64, at function
-	.size	eval_2na_64,.-eval_2na_64
-.LNeval_2na_64:
-	.data
-# -- End  eval_2na_64
-	.text
-# -- Begin  eval_2na_128
-# mark_begin;
-       .align    2,0x90
-eval_2na_128:
-# parameter 1(self): %rdi
-# parameter 2(ncbi2na): %rsi
-# parameter 3(pos): %edx
-# parameter 4(len): %ecx
-..B22.1:                        # Preds ..B22.0
-..___tag_value_eval_2na_128.323:                                #
-..LN2855:
-        pushq     %rbp                                          #3369.1
-        movq      %rsp, %rbp                                    #3369.1
-..___tag_value_eval_2na_128.324:                                #
-        subq      $304, %rsp                                    #3369.1
-        movq      %rdi, -40(%rbp)                               #3369.1
-        movq      %rsi, -32(%rbp)                               #3369.1
-        movl      %edx, -16(%rbp)                               #3369.1
-        movl      %ecx, -8(%rbp)                                #3369.1
-..LN2857:
-        movq      -40(%rbp), %rax                               #3399.25
-        movl      4(%rax), %eax                                 #3399.25
-..LN2859:
-        movl      %eax, -24(%rbp)                               #3399.23
-..LN2861:
-        movl      -8(%rbp), %eax                                #3402.5
-        movl      -24(%rbp), %edx                               #3402.5
-        cmpl      %edx, %eax                                    #3402.5
-        jae       ..B22.3       # Prob 50%                      #3402.5
-                                # LOE
-..B22.2:                        # Preds ..B22.1
-        lea       _2__STRING.9.0(%rip), %rax                    #3402.5
-        lea       _2__STRING.1.0(%rip), %rdx                    #3402.5
-        lea       __$U9.0(%rip), %rcx                           #3402.5
-        movq      %rax, %rdi                                    #3402.5
-        movq      %rdx, %rsi                                    #3402.5
-        movl      $3402, %edx                                   #3402.5
-        call      __assert_fail at PLT                             #3402.5
-                                # LOE
-..B22.3:                        # Preds ..B22.1
-..LN2863:
-        movl      -16(%rbp), %eax                               #3406.12
-..LN2865:
-        addl      -8(%rbp), %eax                                #3406.5
-        movl      %eax, -8(%rbp)                                #3406.5
-..LN2867:
-        movl      -16(%rbp), %eax                               #3409.42
-..LN2869:
-        shrl      $2, %eax                                      #3409.49
-..LN2871:
-        addq      -32(%rbp), %rax                               #3409.30
-..LN2873:
-        movq      %rax, -88(%rbp)                               #3409.5
-..LN2875:
-        movl      -24(%rbp), %eax                               #3412.18
-        negl      %eax                                          #3412.18
-        addl      -8(%rbp), %eax                                #3412.18
-..LN2877:
-        movl      %eax, -64(%rbp)                               #3412.5
-..LN2879:
-        movl      -8(%rbp), %eax                                #3415.44
-..LN2881:
-        addl      $3, %eax                                      #3415.50
-..LN2883:
-        shrl      $2, %eax                                      #3415.57
-..LN2885:
-        addq      -32(%rbp), %rax                               #3415.30
-..LN2887:
-        movq      %rax, -80(%rbp)                               #3415.5
-..LN2889:
-        movq      -88(%rbp), %rax                               #3418.33
-..LN2891:
-        movq      -80(%rbp), %rdx                               #3418.38
-..LN2893:
-        movq      %rax, %rdi                                    #3418.14
-        movq      %rdx, %rsi                                    #3418.14
-        call      prime_buffer_2na at PLT                          #3418.14
-                                # LOE xmm0
-..B22.44:                       # Preds ..B22.3
-        movdqa    %xmm0, -112(%rbp)                             #3418.14
-                                # LOE
-..B22.4:                        # Preds ..B22.44
-..LN2895:
-        movdqa    -112(%rbp), %xmm0                             #3418.5
-        movdqa    %xmm0, -256(%rbp)                             #3418.5
-..LN2897:
-        addq      $16, -88(%rbp)                                #3419.5
-..LN2899:
-        movq      -88(%rbp), %rax                               #3421.9
-..LN2901:
-        movq      %rax, -72(%rbp)                               #3421.5
-..LN2903:
-        movq      -88(%rbp), %rax                               #3424.10
-..LN2905:
-        movq      -80(%rbp), %rdx                               #3424.16
-        cmpq      %rdx, %rax                                    #3424.16
-        jae       ..B22.6       # Prob 50%                      #3424.16
-                                # LOE
-..B22.5:                        # Preds ..B22.4
-..LN2907:
-        movq      -88(%rbp), %rax                               #3425.24
-        movzbl    -1(%rax), %eax                                #3425.24
-        movzbl    %al, %eax                                     #3425.24
-..LN2909:
-        shll      $8, %eax                                      #3425.38
-..LN2911:
-        movl      %eax, -96(%rbp)                               #3425.9
-                                # LOE
-..B22.6:                        # Preds ..B22.5 ..B22.4
-..LN2913:
-        movq      -40(%rbp), %rax                               #3429.5
-        movdqa    16(%rax), %xmm0                               #3429.5
-        movdqa    %xmm0, -240(%rbp)                             #3429.5
-        movq      -40(%rbp), %rax                               #3429.5
-        movdqa    32(%rax), %xmm0                               #3429.5
-        movdqa    %xmm0, -224(%rbp)                             #3429.5
-        movq      -40(%rbp), %rax                               #3429.5
-        movdqa    48(%rax), %xmm0                               #3429.5
-        movdqa    %xmm0, -208(%rbp)                             #3429.5
-        movq      -40(%rbp), %rax                               #3429.5
-        movdqa    64(%rax), %xmm0                               #3429.5
-        movdqa    %xmm0, -192(%rbp)                             #3429.5
-        movq      -40(%rbp), %rax                               #3429.5
-        movdqa    80(%rax), %xmm0                               #3429.5
-        movdqa    %xmm0, -176(%rbp)                             #3429.5
-        movq      -40(%rbp), %rax                               #3429.5
-        movdqa    96(%rax), %xmm0                               #3429.5
-        movdqa    %xmm0, -160(%rbp)                             #3429.5
-        movq      -40(%rbp), %rax                               #3429.5
-        movdqa    112(%rax), %xmm0                              #3429.5
-        movdqa    %xmm0, -144(%rbp)                             #3429.5
-        movq      -40(%rbp), %rax                               #3429.5
-        movdqa    128(%rax), %xmm0                              #3429.5
-        movdqa    %xmm0, -128(%rbp)                             #3429.5
-..LN2915:
-        xorl      %eax, %eax                                    #3432.15
-        movl      %eax, -60(%rbp)                               #3432.15
-..LN2917:
-        movl      %eax, -56(%rbp)                               #3432.10
-..LN2919:
-        movl      %eax, -52(%rbp)                               #3432.5
-..LN2921:
-        movl      -16(%rbp), %eax                               #3434.27
-        negl      %eax                                          #3434.27
-..LN2923:
-        movl      -64(%rbp), %edx                               #3434.20
-..LN2925:
-        lea       7(%rdx,%rax), %eax                            #3434.33
-..LN2927:
-        shrl      $2, %eax                                      #3434.40
-..LN2929:
-        movl      %eax, -48(%rbp)                               #3434.5
-..LN2931:
-        movl      -16(%rbp), %eax                               #3441.14
-..LN2933:
-        andl      $3, %eax                                      #3441.20
-        movl      %eax, -44(%rbp)                               #3441.20
-        je        ..B22.14      # Prob 50%                      #3441.20
-                                # LOE
-..B22.7:                        # Preds ..B22.6
-        movl      -44(%rbp), %eax                               #3441.20
-        cmpl      $1, %eax                                      #3441.20
-        je        ..B22.15      # Prob 50%                      #3441.20
-                                # LOE
-..B22.8:                        # Preds ..B22.7
-        movl      -44(%rbp), %eax                               #3441.20
-        cmpl      $2, %eax                                      #3441.20
-        je        ..B22.16      # Prob 50%                      #3441.20
-                                # LOE
-..B22.9:                        # Preds ..B22.8
-        movl      -44(%rbp), %eax                               #3441.20
-        cmpl      $3, %eax                                      #3441.20
-        je        ..B22.17      # Prob 50%                      #3441.20
-                                # LOE
-..B22.10:                       # Preds ..B22.40 ..B22.39 ..B22.9
-..LN2935:
-        movl      $1, %eax                                      #3446.9
-        testl     %eax, %eax                                    #3446.9
-        je        ..B22.41      # Prob 100%                     #3446.9
-                                # LOE
-..B22.11:                       # Preds ..B22.10
-..LN2937:
-        movl      $16, -48(%rbp)                                #3448.13
-                                # LOE
-..B22.12:                       # Preds ..B22.34 ..B22.11
-..LN2939:
-        movl      $1, %eax                                      #3451.13
-        testl     %eax, %eax                                    #3451.13
-        je        ..B22.36      # Prob 100%                     #3451.13
-                                # LOE
-..B22.14:                       # Preds ..B22.6 ..B22.12
-..LN2941:
-        movdqa    -256(%rbp), %xmm0                             #3458.38
-..LN2943:
-        movdqa    -224(%rbp), %xmm1                             #3458.46
-..LN2945:
-        pand      %xmm1, %xmm0                                  #3458.22
-..LN2947:
-        movdqa    %xmm0, -288(%rbp)                             #3458.17
-..LN2949:
-        movdqa    -288(%rbp), %xmm0                             #3459.22
-        movdqa    -240(%rbp), %xmm1                             #3459.22
-        pcmpeqd   %xmm1, %xmm0                                  #3459.22
-..LN2951:
-        movdqa    %xmm0, -288(%rbp)                             #3459.17
-..LN2953:
-        movdqa    -288(%rbp), %xmm0                             #3460.42
-..LN2955:
-        pmovmskb  %xmm0, %eax                                   #3460.22
-..LN2957:
-        movl      %eax, -52(%rbp)                               #3460.17
-..LN2959:
-        movl      -52(%rbp), %eax                               #3461.17
-        incl      %eax                                          #3461.17
-        sarl      $16, %eax                                     #3461.17
-        negl      %eax                                          #3461.17
-        movl      %eax, -52(%rbp)                               #3461.17
-                                # LOE
-..B22.15:                       # Preds ..B22.7 ..B22.14
-..LN2961:
-        movdqa    -256(%rbp), %xmm0                             #3464.38
-..LN2963:
-        movdqa    -192(%rbp), %xmm1                             #3464.46
-..LN2965:
-        pand      %xmm1, %xmm0                                  #3464.22
-..LN2967:
-        movdqa    %xmm0, -288(%rbp)                             #3464.17
-..LN2969:
-        movdqa    -288(%rbp), %xmm0                             #3465.22
-        movdqa    -208(%rbp), %xmm1                             #3465.22
-        pcmpeqd   %xmm1, %xmm0                                  #3465.22
-..LN2971:
-        movdqa    %xmm0, -288(%rbp)                             #3465.17
-..LN2973:
-        movdqa    -288(%rbp), %xmm0                             #3466.42
-..LN2975:
-        pmovmskb  %xmm0, %eax                                   #3466.22
-..LN2977:
-        movl      %eax, -56(%rbp)                               #3466.17
-..LN2979:
-        movl      -56(%rbp), %eax                               #3467.17
-        incl      %eax                                          #3467.17
-        sarl      $16, %eax                                     #3467.17
-        negl      %eax                                          #3467.17
-        movl      %eax, -56(%rbp)                               #3467.17
-                                # LOE
-..B22.16:                       # Preds ..B22.8 ..B22.15
-..LN2981:
-        movdqa    -256(%rbp), %xmm0                             #3470.38
-..LN2983:
-        movdqa    -160(%rbp), %xmm1                             #3470.46
-..LN2985:
-        pand      %xmm1, %xmm0                                  #3470.22
-..LN2987:
-        movdqa    %xmm0, -288(%rbp)                             #3470.17
-..LN2989:
-        movdqa    -288(%rbp), %xmm0                             #3471.22
-        movdqa    -176(%rbp), %xmm1                             #3471.22
-        pcmpeqd   %xmm1, %xmm0                                  #3471.22
-..LN2991:
-        movdqa    %xmm0, -288(%rbp)                             #3471.17
-..LN2993:
-        movdqa    -288(%rbp), %xmm0                             #3472.42
-..LN2995:
-        pmovmskb  %xmm0, %eax                                   #3472.22
-..LN2997:
-        movl      %eax, -60(%rbp)                               #3472.17
-..LN2999:
-        movl      -60(%rbp), %eax                               #3473.17
-        incl      %eax                                          #3473.17
-        sarl      $16, %eax                                     #3473.17
-        negl      %eax                                          #3473.17
-        movl      %eax, -60(%rbp)                               #3473.17
-                                # LOE
-..B22.17:                       # Preds ..B22.9 ..B22.16
-..LN3001:
-        movdqa    -256(%rbp), %xmm0                             #3476.38
-..LN3003:
-        movdqa    -128(%rbp), %xmm1                             #3476.46
-..LN3005:
-        pand      %xmm1, %xmm0                                  #3476.22
-..LN3007:
-        movdqa    %xmm0, -288(%rbp)                             #3476.17
-..LN3009:
-        movdqa    -288(%rbp), %xmm0                             #3477.22
-        movdqa    -144(%rbp), %xmm1                             #3477.22
-        pcmpeqd   %xmm1, %xmm0                                  #3477.22
-..LN3011:
-        movdqa    %xmm0, -288(%rbp)                             #3477.17
-..LN3013:
-        movdqa    -288(%rbp), %xmm0                             #3478.42
-..LN3015:
-        pmovmskb  %xmm0, %eax                                   #3478.22
-..LN3017:
-        movl      %eax, -92(%rbp)                               #3478.17
-..LN3019:
-        movl      -92(%rbp), %eax                               #3479.17
-        incl      %eax                                          #3479.17
-        sarl      $16, %eax                                     #3479.17
-        negl      %eax                                          #3479.17
-        movl      %eax, -92(%rbp)                               #3479.17
-..LN3021:
-        andl      $-4, -16(%rbp)                                #3483.17
-..LN3023:
-        movl      -56(%rbp), %eax                               #3486.29
-        orl       -52(%rbp), %eax                               #3486.29
-..LN3025:
-        orl       -60(%rbp), %eax                               #3486.34
-..LN3027:
-        orl       -92(%rbp), %eax                               #3486.39
-..LN3029:
-        je        ..B22.29      # Prob 50%                      #3486.47
-                                # LOE
-..B22.18:                       # Preds ..B22.17
-..LN3031:
-        movl      -16(%rbp), %eax                               #3489.37
-        negl      %eax                                          #3489.37
-        addl      -64(%rbp), %eax                               #3489.37
-        movl      %eax, -272(%rbp)                              #3489.37
-        cmpl      $2, %eax                                      #3489.37
-        je        ..B22.22      # Prob 50%                      #3489.37
-                                # LOE
-..B22.19:                       # Preds ..B22.18
-        movl      -272(%rbp), %eax                              #3489.37
-        cmpl      $1, %eax                                      #3489.37
-        je        ..B22.24      # Prob 50%                      #3489.37
-                                # LOE
-..B22.20:                       # Preds ..B22.19
-        movl      -272(%rbp), %eax                              #3489.37
-        testl     %eax, %eax                                    #3489.37
-        je        ..B22.26      # Prob 50%                      #3489.37
-                                # LOE
-..B22.21:                       # Preds ..B22.20
-..LN3033:
-        movl      $1, %eax                                      #3492.32
-        leave                                                   #3492.32
-..___tag_value_eval_2na_128.328:                                #
-        ret                                                     #3492.32
-..___tag_value_eval_2na_128.329:                                #
-                                # LOE
-..B22.22:                       # Preds ..B22.18
-..LN3035:
-        movl      -60(%rbp), %eax                               #3494.30
-..LN3037:
-        testl     %eax, %eax                                    #3494.36
-        je        ..B22.24      # Prob 50%                      #3494.36
-                                # LOE
-..B22.23:                       # Preds ..B22.22
-..LN3039:
-        movl      $1, %eax                                      #3494.47
-        leave                                                   #3494.47
-..___tag_value_eval_2na_128.331:                                #
-        ret                                                     #3494.47
-..___tag_value_eval_2na_128.332:                                #
-                                # LOE
-..B22.24:                       # Preds ..B22.22 ..B22.19
-..LN3041:
-        movl      -56(%rbp), %eax                               #3496.30
-..LN3043:
-        testl     %eax, %eax                                    #3496.36
-        je        ..B22.26      # Prob 50%                      #3496.36
-                                # LOE
-..B22.25:                       # Preds ..B22.24
-..LN3045:
-        movl      $1, %eax                                      #3496.47
-        leave                                                   #3496.47
-..___tag_value_eval_2na_128.334:                                #
-        ret                                                     #3496.47
-..___tag_value_eval_2na_128.335:                                #
-                                # LOE
-..B22.26:                       # Preds ..B22.24 ..B22.20
-..LN3047:
-        movl      -52(%rbp), %eax                               #3498.30
-..LN3049:
-        testl     %eax, %eax                                    #3498.36
-        je        ..B22.28      # Prob 50%                      #3498.36
-                                # LOE
-..B22.27:                       # Preds ..B22.26
-..LN3051:
-        movl      $1, %eax                                      #3498.47
-        leave                                                   #3498.47
-..___tag_value_eval_2na_128.337:                                #
-        ret                                                     #3498.47
-..___tag_value_eval_2na_128.338:                                #
-                                # LOE
-..B22.28:                       # Preds ..B22.26
-..LN3053:
-        xorl      %eax, %eax                                    #3500.28
-        leave                                                   #3500.28
-..___tag_value_eval_2na_128.340:                                #
-        ret                                                     #3500.28
-..___tag_value_eval_2na_128.341:                                #
-                                # LOE
-..B22.29:                       # Preds ..B22.17
-..LN3055:
-        addl      $4, -16(%rbp)                                 #3527.17
-..LN3057:
-        movl      -16(%rbp), %eax                               #3530.22
-..LN3059:
-        movl      -64(%rbp), %edx                               #3530.28
-        cmpl      %edx, %eax                                    #3530.28
-        jbe       ..B22.31      # Prob 50%                      #3530.28
-                                # LOE
-..B22.30:                       # Preds ..B22.29
-..LN3061:
-        xorl      %eax, %eax                                    #3531.28
-        leave                                                   #3531.28
-..___tag_value_eval_2na_128.343:                                #
-        ret                                                     #3531.28
-..___tag_value_eval_2na_128.344:                                #
-                                # LOE
-..B22.31:                       # Preds ..B22.29
-..LN3063:
-        movl      -48(%rbp), %eax                               #3534.25
-        decl      %eax                                          #3534.25
-        movl      %eax, -48(%rbp)                               #3534.25
-..LN3065:
-        je        ..B22.36      # Prob 50%                      #3534.39
-                                # LOE
-..B22.32:                       # Preds ..B22.31
-..LN3067:
-        movdqa    -256(%rbp), %xmm0                             #3539.43
-..LN3069:
-        psrldq    $1, %xmm0                                     #3539.26
-..LN3071:
-        movdqa    %xmm0, -256(%rbp)                             #3539.17
-..LN3073:
-        movq      -72(%rbp), %rax                               #3542.22
-..LN3075:
-        movq      -80(%rbp), %rdx                               #3542.26
-        cmpq      %rdx, %rax                                    #3542.26
-        jae       ..B22.34      # Prob 50%                      #3542.26
-                                # LOE
-..B22.33:                       # Preds ..B22.32
-..LN3077:
-        sarl      $8, -96(%rbp)                                 #3544.21
-..LN3079:
-        movq      -72(%rbp), %rax                               #3545.37
-        movzbl    (%rax), %eax                                  #3545.37
-        movzbl    %al, %eax                                     #3545.37
-..LN3081:
-        shll      $8, %eax                                      #3545.48
-..LN3083:
-        orl       -96(%rbp), %eax                               #3545.21
-        movl      %eax, -96(%rbp)                               #3545.21
-..LN3085:
-        movdqa    -256(%rbp), %xmm0                             #3546.49
-..LN3087:
-        movl      -96(%rbp), %eax                               #3546.57
-..LN3089:
-        pinsrw    $7, %eax, %xmm0                               #3546.30
-..LN3091:
-        movdqa    %xmm0, -256(%rbp)                             #3546.21
-                                # LOE
-..B22.34:                       # Preds ..B22.33 ..B22.32
-..LN3093:
-        incq      -72(%rbp)                                     #3550.20
-        jmp       ..B22.12      # Prob 100%                     #3550.20
-                                # LOE
-..B22.36:                       # Preds ..B22.31 ..B22.12
-..LN3095:
-        movq      -88(%rbp), %rax                               #3555.18
-..LN3097:
-        movq      -80(%rbp), %rdx                               #3555.25
-        cmpq      %rdx, %rax                                    #3555.25
-        jae       ..B22.41      # Prob 50%                      #3555.25
-                                # LOE
-..B22.37:                       # Preds ..B22.36
-..LN3099:
-        movl      -16(%rbp), %eax                               #3560.18
-..LN3101:
-        movl      -64(%rbp), %edx                               #3560.24
-        cmpl      %edx, %eax                                    #3560.24
-        ja        ..B22.41      # Prob 50%                      #3560.24
-                                # LOE
-..B22.38:                       # Preds ..B22.37
-..LN3103:
-        movq      -88(%rbp), %rax                               #3565.41
-..LN3105:
-        movq      -80(%rbp), %rdx                               #3565.46
-..LN3107:
-        movq      %rax, %rdi                                    #3565.22
-        movq      %rdx, %rsi                                    #3565.22
-        call      prime_buffer_2na at PLT                          #3565.22
-                                # LOE xmm0
-..B22.45:                       # Preds ..B22.38
-        movdqa    %xmm0, -304(%rbp)                             #3565.22
-                                # LOE
-..B22.39:                       # Preds ..B22.45
-..LN3109:
-        movdqa    -304(%rbp), %xmm0                             #3565.13
-        movdqa    %xmm0, -256(%rbp)                             #3565.13
-..LN3111:
-        addq      $16, -88(%rbp)                                #3643.13
-..LN3113:
-        movq      -88(%rbp), %rax                               #3645.17
-..LN3115:
-        movq      %rax, -72(%rbp)                               #3645.13
-..LN3117:
-        movq      -88(%rbp), %rax                               #3646.18
-..LN3119:
-        movq      -80(%rbp), %rdx                               #3646.24
-        cmpq      %rdx, %rax                                    #3646.24
-        jae       ..B22.10      # Prob 50%                      #3646.24
-                                # LOE
-..B22.40:                       # Preds ..B22.39
-..LN3121:
-        movq      -88(%rbp), %rax                               #3647.32
-        movzbl    -1(%rax), %eax                                #3647.32
-        movzbl    %al, %eax                                     #3647.32
-..LN3123:
-        shll      $8, %eax                                      #3647.46
-..LN3125:
-        movl      %eax, -96(%rbp)                               #3647.17
-        jmp       ..B22.10      # Prob 100%                     #3647.17
-                                # LOE
-..B22.41:                       # Preds ..B22.37 ..B22.36 ..B22.10
-..LN3127:
-        xorl      %eax, %eax                                    #3656.12
-        leave                                                   #3656.12
-..___tag_value_eval_2na_128.346:                                #
-        ret                                                     #3656.12
-        .align    2,0x90
-..___tag_value_eval_2na_128.347:                                #
-                                # LOE
-# mark_end;
-	.type	eval_2na_128, at function
-	.size	eval_2na_128,.-eval_2na_128
-.LNeval_2na_128:
-	.data
-# -- End  eval_2na_128
-	.text
-# -- Begin  eval_2na_pos
-# mark_begin;
-       .align    2,0x90
-eval_2na_pos:
-# parameter 1(self): %rdi
-# parameter 2(ncbi2na): %rsi
-# parameter 3(pos): %edx
-# parameter 4(len): %ecx
-..B23.1:                        # Preds ..B23.0
-..___tag_value_eval_2na_pos.350:                                #
-..LN3129:
-        pushq     %rbp                                          #3662.1
-        movq      %rsp, %rbp                                    #3662.1
-..___tag_value_eval_2na_pos.351:                                #
-        subq      $320, %rsp                                    #3662.1
-        movq      %rdi, -48(%rbp)                               #3662.1
-        movq      %rsi, -40(%rbp)                               #3662.1
-        movl      %edx, -24(%rbp)                               #3662.1
-        movl      %ecx, -16(%rbp)                               #3662.1
-..LN3131:
-        movq      -48(%rbp), %rax                               #3698.25
-        movl      4(%rax), %eax                                 #3698.25
-..LN3133:
-        movl      %eax, -32(%rbp)                               #3698.23
-..LN3135:
-        movl      -16(%rbp), %eax                               #3701.5
-        movl      -32(%rbp), %edx                               #3701.5
-        cmpl      %edx, %eax                                    #3701.5
-        jae       ..B23.3       # Prob 50%                      #3701.5
-                                # LOE
-..B23.2:                        # Preds ..B23.1
-        lea       _2__STRING.9.0(%rip), %rax                    #3701.5
-        lea       _2__STRING.1.0(%rip), %rdx                    #3701.5
-        lea       __$Ua.0(%rip), %rcx                           #3701.5
-        movq      %rax, %rdi                                    #3701.5
-        movq      %rdx, %rsi                                    #3701.5
-        movl      $3701, %edx                                   #3701.5
-        call      __assert_fail at PLT                             #3701.5
-                                # LOE
-..B23.3:                        # Preds ..B23.1
-..LN3137:
-        movl      -24(%rbp), %eax                               #3705.12
-..LN3139:
-        addl      -16(%rbp), %eax                               #3705.5
-        movl      %eax, -16(%rbp)                               #3705.5
-..LN3141:
-        movl      -24(%rbp), %eax                               #3709.13
-..LN3143:
-        movl      %eax, -80(%rbp)                               #3709.5
-..LN3145:
-        movl      -24(%rbp), %eax                               #3713.42
-..LN3147:
-        shrl      $2, %eax                                      #3713.49
-..LN3149:
-        addq      -40(%rbp), %rax                               #3713.30
-..LN3151:
-        movq      %rax, -104(%rbp)                              #3713.5
-..LN3153:
-        movl      -32(%rbp), %eax                               #3716.18
-        negl      %eax                                          #3716.18
-        addl      -16(%rbp), %eax                               #3716.18
-..LN3155:
-        movl      %eax, -76(%rbp)                               #3716.5
-..LN3157:
-        movl      -16(%rbp), %eax                               #3719.44
-..LN3159:
-        addl      $3, %eax                                      #3719.50
-..LN3161:
-        shrl      $2, %eax                                      #3719.57
-..LN3163:
-        addq      -40(%rbp), %rax                               #3719.30
-..LN3165:
-        movq      %rax, -96(%rbp)                               #3719.5
-..LN3167:
-        movq      -104(%rbp), %rax                              #3722.33
-..LN3169:
-        movq      -96(%rbp), %rdx                               #3722.38
-..LN3171:
-        movq      %rax, %rdi                                    #3722.14
-        movq      %rdx, %rsi                                    #3722.14
-        call      prime_buffer_2na at PLT                          #3722.14
-                                # LOE xmm0
-..B23.57:                       # Preds ..B23.3
-        movdqa    %xmm0, -128(%rbp)                             #3722.14
-                                # LOE
-..B23.4:                        # Preds ..B23.57
-..LN3173:
-        movdqa    -128(%rbp), %xmm0                             #3722.5
-        movdqa    %xmm0, -272(%rbp)                             #3722.5
-..LN3175:
-        addq      $16, -104(%rbp)                               #3723.5
-..LN3177:
-        movq      -104(%rbp), %rax                              #3725.9
-..LN3179:
-        movq      %rax, -88(%rbp)                               #3725.5
-..LN3181:
-        movq      -104(%rbp), %rax                              #3728.10
-..LN3183:
-        movq      -96(%rbp), %rdx                               #3728.16
-        cmpq      %rdx, %rax                                    #3728.16
-        jae       ..B23.6       # Prob 50%                      #3728.16
-                                # LOE
-..B23.5:                        # Preds ..B23.4
-..LN3185:
-        movq      -104(%rbp), %rax                              #3729.24
-        movzbl    -1(%rax), %eax                                #3729.24
-        movzbl    %al, %eax                                     #3729.24
-..LN3187:
-        shll      $8, %eax                                      #3729.38
-..LN3189:
-        movl      %eax, -112(%rbp)                              #3729.9
-                                # LOE
-..B23.6:                        # Preds ..B23.5 ..B23.4
-..LN3191:
-        movq      -48(%rbp), %rax                               #3733.5
-        movdqa    16(%rax), %xmm0                               #3733.5
-        movdqa    %xmm0, -256(%rbp)                             #3733.5
-        movq      -48(%rbp), %rax                               #3733.5
-        movdqa    32(%rax), %xmm0                               #3733.5
-        movdqa    %xmm0, -240(%rbp)                             #3733.5
-        movq      -48(%rbp), %rax                               #3733.5
-        movdqa    48(%rax), %xmm0                               #3733.5
-        movdqa    %xmm0, -224(%rbp)                             #3733.5
-        movq      -48(%rbp), %rax                               #3733.5
-        movdqa    64(%rax), %xmm0                               #3733.5
-        movdqa    %xmm0, -208(%rbp)                             #3733.5
-        movq      -48(%rbp), %rax                               #3733.5
-        movdqa    80(%rax), %xmm0                               #3733.5
-        movdqa    %xmm0, -192(%rbp)                             #3733.5
-        movq      -48(%rbp), %rax                               #3733.5
-        movdqa    96(%rax), %xmm0                               #3733.5
-        movdqa    %xmm0, -176(%rbp)                             #3733.5
-        movq      -48(%rbp), %rax                               #3733.5
-        movdqa    112(%rax), %xmm0                              #3733.5
-        movdqa    %xmm0, -160(%rbp)                             #3733.5
-        movq      -48(%rbp), %rax                               #3733.5
-        movdqa    128(%rax), %xmm0                              #3733.5
-        movdqa    %xmm0, -144(%rbp)                             #3733.5
-..LN3193:
-        xorl      %eax, %eax                                    #3736.15
-        movl      %eax, -72(%rbp)                               #3736.15
-..LN3195:
-        movl      %eax, -68(%rbp)                               #3736.10
-..LN3197:
-        movl      %eax, -64(%rbp)                               #3736.5
-..LN3199:
-        movl      -24(%rbp), %eax                               #3738.27
-        negl      %eax                                          #3738.27
-..LN3201:
-        movl      -76(%rbp), %edx                               #3738.20
-..LN3203:
-        lea       7(%rdx,%rax), %eax                            #3738.33
-..LN3205:
-        shrl      $2, %eax                                      #3738.40
-..LN3207:
-        movl      %eax, -60(%rbp)                               #3738.5
-..LN3209:
-        movl      -24(%rbp), %eax                               #3745.14
-..LN3211:
-        andl      $3, %eax                                      #3745.20
-        movl      %eax, -56(%rbp)                               #3745.20
-        je        ..B23.14      # Prob 50%                      #3745.20
-                                # LOE
-..B23.7:                        # Preds ..B23.6
-        movl      -56(%rbp), %eax                               #3745.20
-        cmpl      $1, %eax                                      #3745.20
-        je        ..B23.15      # Prob 50%                      #3745.20
-                                # LOE
-..B23.8:                        # Preds ..B23.7
-        movl      -56(%rbp), %eax                               #3745.20
-        cmpl      $2, %eax                                      #3745.20
-        je        ..B23.16      # Prob 50%                      #3745.20
-                                # LOE
-..B23.9:                        # Preds ..B23.8
-        movl      -56(%rbp), %eax                               #3745.20
-        cmpl      $3, %eax                                      #3745.20
-        je        ..B23.17      # Prob 50%                      #3745.20
-                                # LOE
-..B23.10:                       # Preds ..B23.53 ..B23.52 ..B23.9
-..LN3213:
-        movl      $1, %eax                                      #3750.9
-        testl     %eax, %eax                                    #3750.9
-        je        ..B23.54      # Prob 100%                     #3750.9
-                                # LOE
-..B23.11:                       # Preds ..B23.10
-..LN3215:
-        movl      $16, -60(%rbp)                                #3752.13
-                                # LOE
-..B23.12:                       # Preds ..B23.47 ..B23.11
-..LN3217:
-        movl      $1, %eax                                      #3755.13
-        testl     %eax, %eax                                    #3755.13
-        je        ..B23.49      # Prob 100%                     #3755.13
-                                # LOE
-..B23.14:                       # Preds ..B23.6 ..B23.12
-..LN3219:
-        movdqa    -272(%rbp), %xmm0                             #3762.38
-..LN3221:
-        movdqa    -240(%rbp), %xmm1                             #3762.46
-..LN3223:
-        pand      %xmm1, %xmm0                                  #3762.22
-..LN3225:
-        movdqa    %xmm0, -304(%rbp)                             #3762.17
-..LN3227:
-        movdqa    -304(%rbp), %xmm0                             #3763.22
-        movdqa    -256(%rbp), %xmm1                             #3763.22
-        pcmpeqd   %xmm1, %xmm0                                  #3763.22
-..LN3229:
-        movdqa    %xmm0, -304(%rbp)                             #3763.17
-..LN3231:
-        movdqa    -304(%rbp), %xmm0                             #3764.42
-..LN3233:
-        pmovmskb  %xmm0, %eax                                   #3764.22
-..LN3235:
-        movl      %eax, -64(%rbp)                               #3764.17
-..LN3237:
-        movl      -64(%rbp), %eax                               #3765.17
-        incl      %eax                                          #3765.17
-        sarl      $16, %eax                                     #3765.17
-        negl      %eax                                          #3765.17
-        movl      %eax, -64(%rbp)                               #3765.17
-                                # LOE
-..B23.15:                       # Preds ..B23.7 ..B23.14
-..LN3239:
-        movdqa    -272(%rbp), %xmm0                             #3768.38
-..LN3241:
-        movdqa    -208(%rbp), %xmm1                             #3768.46
-..LN3243:
-        pand      %xmm1, %xmm0                                  #3768.22
-..LN3245:
-        movdqa    %xmm0, -304(%rbp)                             #3768.17
-..LN3247:
-        movdqa    -304(%rbp), %xmm0                             #3769.22
-        movdqa    -224(%rbp), %xmm1                             #3769.22
-        pcmpeqd   %xmm1, %xmm0                                  #3769.22
-..LN3249:
-        movdqa    %xmm0, -304(%rbp)                             #3769.17
-..LN3251:
-        movdqa    -304(%rbp), %xmm0                             #3770.42
-..LN3253:
-        pmovmskb  %xmm0, %eax                                   #3770.22
-..LN3255:
-        movl      %eax, -68(%rbp)                               #3770.17
-..LN3257:
-        movl      -68(%rbp), %eax                               #3771.17
-        incl      %eax                                          #3771.17
-        sarl      $16, %eax                                     #3771.17
-        negl      %eax                                          #3771.17
-        movl      %eax, -68(%rbp)                               #3771.17
-                                # LOE
-..B23.16:                       # Preds ..B23.8 ..B23.15
-..LN3259:
-        movdqa    -272(%rbp), %xmm0                             #3774.38
-..LN3261:
-        movdqa    -176(%rbp), %xmm1                             #3774.46
-..LN3263:
-        pand      %xmm1, %xmm0                                  #3774.22
-..LN3265:
-        movdqa    %xmm0, -304(%rbp)                             #3774.17
-..LN3267:
-        movdqa    -304(%rbp), %xmm0                             #3775.22
-        movdqa    -192(%rbp), %xmm1                             #3775.22
-        pcmpeqd   %xmm1, %xmm0                                  #3775.22
-..LN3269:
-        movdqa    %xmm0, -304(%rbp)                             #3775.17
-..LN3271:
-        movdqa    -304(%rbp), %xmm0                             #3776.42
-..LN3273:
-        pmovmskb  %xmm0, %eax                                   #3776.22
-..LN3275:
-        movl      %eax, -72(%rbp)                               #3776.17
-..LN3277:
-        movl      -72(%rbp), %eax                               #3777.17
-        incl      %eax                                          #3777.17
-        sarl      $16, %eax                                     #3777.17
-        negl      %eax                                          #3777.17
-        movl      %eax, -72(%rbp)                               #3777.17
-                                # LOE
-..B23.17:                       # Preds ..B23.9 ..B23.16
-..LN3279:
-        movdqa    -272(%rbp), %xmm0                             #3780.38
-..LN3281:
-        movdqa    -144(%rbp), %xmm1                             #3780.46
-..LN3283:
-        pand      %xmm1, %xmm0                                  #3780.22
-..LN3285:
-        movdqa    %xmm0, -304(%rbp)                             #3780.17
-..LN3287:
-        movdqa    -304(%rbp), %xmm0                             #3781.22
-        movdqa    -160(%rbp), %xmm1                             #3781.22
-        pcmpeqd   %xmm1, %xmm0                                  #3781.22
-..LN3289:
-        movdqa    %xmm0, -304(%rbp)                             #3781.17
-..LN3291:
-        movdqa    -304(%rbp), %xmm0                             #3782.42
-..LN3293:
-        pmovmskb  %xmm0, %eax                                   #3782.22
-..LN3295:
-        movl      %eax, -108(%rbp)                              #3782.17
-..LN3297:
-        movl      -108(%rbp), %eax                              #3783.17
-        incl      %eax                                          #3783.17
-        sarl      $16, %eax                                     #3783.17
-        negl      %eax                                          #3783.17
-        movl      %eax, -108(%rbp)                              #3783.17
-..LN3299:
-        andl      $-4, -24(%rbp)                                #3787.17
-..LN3301:
-        movl      -68(%rbp), %eax                               #3790.29
-        orl       -64(%rbp), %eax                               #3790.29
-..LN3303:
-        orl       -72(%rbp), %eax                               #3790.34
-..LN3305:
-        orl       -108(%rbp), %eax                              #3790.39
-..LN3307:
-        je        ..B23.42      # Prob 50%                      #3790.47
-                                # LOE
-..B23.18:                       # Preds ..B23.17
-..LN3309:
-        movl      -24(%rbp), %eax                               #3793.37
-        negl      %eax                                          #3793.37
-        addl      -76(%rbp), %eax                               #3793.37
-        movl      %eax, -288(%rbp)                              #3793.37
-        je        ..B23.21      # Prob 50%                      #3793.37
-                                # LOE
-..B23.19:                       # Preds ..B23.18
-        movl      -288(%rbp), %eax                              #3793.37
-        cmpl      $1, %eax                                      #3793.37
-        je        ..B23.23      # Prob 50%                      #3793.37
-                                # LOE
-..B23.20:                       # Preds ..B23.19
-        movl      -288(%rbp), %eax                              #3793.37
-        cmpl      $2, %eax                                      #3793.37
-        je        ..B23.27      # Prob 50%                      #3793.37
-        jmp       ..B23.33      # Prob 100%                     #3793.37
-                                # LOE
-..B23.21:                       # Preds ..B23.18
-..LN3311:
-        movl      -64(%rbp), %eax                               #3796.30
-..LN3313:
-        testl     %eax, %eax                                    #3796.36
-        je        ..B23.41      # Prob 50%                      #3796.36
-                                # LOE
-..B23.22:                       # Preds ..B23.21
-..LN3315:
-        movl      -80(%rbp), %eax                               #3796.53
-        negl      %eax                                          #3796.53
-..LN3317:
-        movl      -24(%rbp), %edx                               #3796.47
-..LN3319:
-        lea       1(%rdx,%rax), %eax                            #3796.61
-        leave                                                   #3796.61
-..___tag_value_eval_2na_pos.355:                                #
-        ret                                                     #3796.61
-..___tag_value_eval_2na_pos.356:                                #
-                                # LOE
-..B23.23:                       # Preds ..B23.19
-..LN3321:
-        movl      -64(%rbp), %eax                               #3799.30
-..LN3323:
-        testl     %eax, %eax                                    #3799.36
-        je        ..B23.25      # Prob 50%                      #3799.36
-                                # LOE
-..B23.24:                       # Preds ..B23.23
-..LN3325:
-        movl      -80(%rbp), %eax                               #3799.53
-        negl      %eax                                          #3799.53
-..LN3327:
-        movl      -24(%rbp), %edx                               #3799.47
-..LN3329:
-        lea       1(%rdx,%rax), %eax                            #3799.61
-        leave                                                   #3799.61
-..___tag_value_eval_2na_pos.358:                                #
-        ret                                                     #3799.61
-..___tag_value_eval_2na_pos.359:                                #
-                                # LOE
-..B23.25:                       # Preds ..B23.23
-..LN3331:
-        movl      -68(%rbp), %eax                               #3800.30
-..LN3333:
-        testl     %eax, %eax                                    #3800.36
-        je        ..B23.41      # Prob 50%                      #3800.36
-                                # LOE
-..B23.26:                       # Preds ..B23.25
-..LN3335:
-        movl      -80(%rbp), %eax                               #3800.53
-        negl      %eax                                          #3800.53
-..LN3337:
-        movl      -24(%rbp), %edx                               #3800.47
-..LN3339:
-        lea       2(%rdx,%rax), %eax                            #3800.61
-        leave                                                   #3800.61
-..___tag_value_eval_2na_pos.361:                                #
-        ret                                                     #3800.61
-..___tag_value_eval_2na_pos.362:                                #
-                                # LOE
-..B23.27:                       # Preds ..B23.20
-..LN3341:
-        movl      -64(%rbp), %eax                               #3803.30
-..LN3343:
-        testl     %eax, %eax                                    #3803.36
-        je        ..B23.29      # Prob 50%                      #3803.36
-                                # LOE
-..B23.28:                       # Preds ..B23.27
-..LN3345:
-        movl      -80(%rbp), %eax                               #3803.53
-        negl      %eax                                          #3803.53
-..LN3347:
-        movl      -24(%rbp), %edx                               #3803.47
-..LN3349:
-        lea       1(%rdx,%rax), %eax                            #3803.61
-        leave                                                   #3803.61
-..___tag_value_eval_2na_pos.364:                                #
-        ret                                                     #3803.61
-..___tag_value_eval_2na_pos.365:                                #
-                                # LOE
-..B23.29:                       # Preds ..B23.27
-..LN3351:
-        movl      -68(%rbp), %eax                               #3804.30
-..LN3353:
-        testl     %eax, %eax                                    #3804.36
-        je        ..B23.31      # Prob 50%                      #3804.36
-                                # LOE
-..B23.30:                       # Preds ..B23.29
-..LN3355:
-        movl      -80(%rbp), %eax                               #3804.53
-        negl      %eax                                          #3804.53
-..LN3357:
-        movl      -24(%rbp), %edx                               #3804.47
-..LN3359:
-        lea       2(%rdx,%rax), %eax                            #3804.61
-        leave                                                   #3804.61
-..___tag_value_eval_2na_pos.367:                                #
-        ret                                                     #3804.61
-..___tag_value_eval_2na_pos.368:                                #
-                                # LOE
-..B23.31:                       # Preds ..B23.29
-..LN3361:
-        movl      -72(%rbp), %eax                               #3805.30
-..LN3363:
-        testl     %eax, %eax                                    #3805.36
-        je        ..B23.41      # Prob 50%                      #3805.36
-                                # LOE
-..B23.32:                       # Preds ..B23.31
-..LN3365:
-        movl      -80(%rbp), %eax                               #3805.53
-        negl      %eax                                          #3805.53
-..LN3367:
-        movl      -24(%rbp), %edx                               #3805.47
-..LN3369:
-        lea       3(%rdx,%rax), %eax                            #3805.61
-        leave                                                   #3805.61
-..___tag_value_eval_2na_pos.370:                                #
-        ret                                                     #3805.61
-..___tag_value_eval_2na_pos.371:                                #
-                                # LOE
-..B23.33:                       # Preds ..B23.20
-..LN3371:
-        movl      -64(%rbp), %eax                               #3808.30
-..LN3373:
-        testl     %eax, %eax                                    #3808.36
-        je        ..B23.35      # Prob 50%                      #3808.36
-                                # LOE
-..B23.34:                       # Preds ..B23.33
-..LN3375:
-        movl      -80(%rbp), %eax                               #3808.53
-        negl      %eax                                          #3808.53
-..LN3377:
-        movl      -24(%rbp), %edx                               #3808.47
-..LN3379:
-        lea       1(%rdx,%rax), %eax                            #3808.61
-        leave                                                   #3808.61
-..___tag_value_eval_2na_pos.373:                                #
-        ret                                                     #3808.61
-..___tag_value_eval_2na_pos.374:                                #
-                                # LOE
-..B23.35:                       # Preds ..B23.33
-..LN3381:
-        movl      -68(%rbp), %eax                               #3809.30
-..LN3383:
-        testl     %eax, %eax                                    #3809.36
-        je        ..B23.37      # Prob 50%                      #3809.36
-                                # LOE
-..B23.36:                       # Preds ..B23.35
-..LN3385:
-        movl      -80(%rbp), %eax                               #3809.53
-        negl      %eax                                          #3809.53
-..LN3387:
-        movl      -24(%rbp), %edx                               #3809.47
-..LN3389:
-        lea       2(%rdx,%rax), %eax                            #3809.61
-        leave                                                   #3809.61
-..___tag_value_eval_2na_pos.376:                                #
-        ret                                                     #3809.61
-..___tag_value_eval_2na_pos.377:                                #
-                                # LOE
-..B23.37:                       # Preds ..B23.35
-..LN3391:
-        movl      -72(%rbp), %eax                               #3810.30
-..LN3393:
-        testl     %eax, %eax                                    #3810.36
-        je        ..B23.39      # Prob 50%                      #3810.36
-                                # LOE
-..B23.38:                       # Preds ..B23.37
-..LN3395:
-        movl      -80(%rbp), %eax                               #3810.53
-        negl      %eax                                          #3810.53
-..LN3397:
-        movl      -24(%rbp), %edx                               #3810.47
-..LN3399:
-        lea       3(%rdx,%rax), %eax                            #3810.61
-        leave                                                   #3810.61
-..___tag_value_eval_2na_pos.379:                                #
-        ret                                                     #3810.61
-..___tag_value_eval_2na_pos.380:                                #
-                                # LOE
-..B23.39:                       # Preds ..B23.37
-..LN3401:
-        movl      -108(%rbp), %eax                              #3811.30
-..LN3403:
-        testl     %eax, %eax                                    #3811.36
-        je        ..B23.41      # Prob 50%                      #3811.36
-                                # LOE
-..B23.40:                       # Preds ..B23.39
-..LN3405:
-        movl      -80(%rbp), %eax                               #3811.53
-        negl      %eax                                          #3811.53
-..LN3407:
-        movl      -24(%rbp), %edx                               #3811.47
-..LN3409:
-        lea       4(%rdx,%rax), %eax                            #3811.61
-        leave                                                   #3811.61
-..___tag_value_eval_2na_pos.382:                                #
-        ret                                                     #3811.61
-..___tag_value_eval_2na_pos.383:                                #
-                                # LOE
-..B23.41:                       # Preds ..B23.21 ..B23.25 ..B23.31 ..B23.39
-..LN3411:
-        xorl      %eax, %eax                                    #3813.28
-        leave                                                   #3813.28
-..___tag_value_eval_2na_pos.385:                                #
-        ret                                                     #3813.28
-..___tag_value_eval_2na_pos.386:                                #
-                                # LOE
-..B23.42:                       # Preds ..B23.17
-..LN3413:
-        addl      $4, -24(%rbp)                                 #3853.17
-..LN3415:
-        movl      -24(%rbp), %eax                               #3856.22
-..LN3417:
-        movl      -76(%rbp), %edx                               #3856.28
-        cmpl      %edx, %eax                                    #3856.28
-        jbe       ..B23.44      # Prob 50%                      #3856.28
-                                # LOE
-..B23.43:                       # Preds ..B23.42
-..LN3419:
-        xorl      %eax, %eax                                    #3857.28
-        leave                                                   #3857.28
-..___tag_value_eval_2na_pos.388:                                #
-        ret                                                     #3857.28
-..___tag_value_eval_2na_pos.389:                                #
-                                # LOE
-..B23.44:                       # Preds ..B23.42
-..LN3421:
-        movl      -60(%rbp), %eax                               #3860.25
-        decl      %eax                                          #3860.25
-        movl      %eax, -60(%rbp)                               #3860.25
-..LN3423:
-        je        ..B23.49      # Prob 50%                      #3860.39
-                                # LOE
-..B23.45:                       # Preds ..B23.44
-..LN3425:
-        movdqa    -272(%rbp), %xmm0                             #3865.43
-..LN3427:
-        psrldq    $1, %xmm0                                     #3865.26
-..LN3429:
-        movdqa    %xmm0, -272(%rbp)                             #3865.17
-..LN3431:
-        movq      -88(%rbp), %rax                               #3868.22
-..LN3433:
-        movq      -96(%rbp), %rdx                               #3868.26
-        cmpq      %rdx, %rax                                    #3868.26
-        jae       ..B23.47      # Prob 50%                      #3868.26
-                                # LOE
-..B23.46:                       # Preds ..B23.45
-..LN3435:
-        sarl      $8, -112(%rbp)                                #3870.21
-..LN3437:
-        movq      -88(%rbp), %rax                               #3871.37
-        movzbl    (%rax), %eax                                  #3871.37
-        movzbl    %al, %eax                                     #3871.37
-..LN3439:
-        shll      $8, %eax                                      #3871.48
-..LN3441:
-        orl       -112(%rbp), %eax                              #3871.21
-        movl      %eax, -112(%rbp)                              #3871.21
-..LN3443:
-        movdqa    -272(%rbp), %xmm0                             #3872.49
-..LN3445:
-        movl      -112(%rbp), %eax                              #3872.57
-..LN3447:
-        pinsrw    $7, %eax, %xmm0                               #3872.30
-..LN3449:
-        movdqa    %xmm0, -272(%rbp)                             #3872.21
-                                # LOE
-..B23.47:                       # Preds ..B23.46 ..B23.45
-..LN3451:
-        incq      -88(%rbp)                                     #3876.20
-        jmp       ..B23.12      # Prob 100%                     #3876.20
-                                # LOE
-..B23.49:                       # Preds ..B23.44 ..B23.12
-..LN3453:
-        movq      -104(%rbp), %rax                              #3881.18
-..LN3455:
-        movq      -96(%rbp), %rdx                               #3881.25
-        cmpq      %rdx, %rax                                    #3881.25
-        jae       ..B23.54      # Prob 50%                      #3881.25
-                                # LOE
-..B23.50:                       # Preds ..B23.49
-..LN3457:
-        movl      -24(%rbp), %eax                               #3886.18
-..LN3459:
-        movl      -76(%rbp), %edx                               #3886.24
-        cmpl      %edx, %eax                                    #3886.24
-        ja        ..B23.54      # Prob 50%                      #3886.24
-                                # LOE
-..B23.51:                       # Preds ..B23.50
-..LN3461:
-        movq      -104(%rbp), %rax                              #3891.41
-..LN3463:
-        movq      -96(%rbp), %rdx                               #3891.46
-..LN3465:
-        movq      %rax, %rdi                                    #3891.22
-        movq      %rdx, %rsi                                    #3891.22
-        call      prime_buffer_2na at PLT                          #3891.22
-                                # LOE xmm0
-..B23.58:                       # Preds ..B23.51
-        movdqa    %xmm0, -320(%rbp)                             #3891.22
-                                # LOE
-..B23.52:                       # Preds ..B23.58
-..LN3467:
-        movdqa    -320(%rbp), %xmm0                             #3891.13
-        movdqa    %xmm0, -272(%rbp)                             #3891.13
-..LN3469:
-        addq      $16, -104(%rbp)                               #3969.13
-..LN3471:
-        movq      -104(%rbp), %rax                              #3971.17
-..LN3473:
-        movq      %rax, -88(%rbp)                               #3971.13
-..LN3475:
-        movq      -104(%rbp), %rax                              #3972.18
-..LN3477:
-        movq      -96(%rbp), %rdx                               #3972.24
-        cmpq      %rdx, %rax                                    #3972.24
-        jae       ..B23.10      # Prob 50%                      #3972.24
-                                # LOE
-..B23.53:                       # Preds ..B23.52
-..LN3479:
-        movq      -104(%rbp), %rax                              #3973.32
-        movzbl    -1(%rax), %eax                                #3973.32
-        movzbl    %al, %eax                                     #3973.32
-..LN3481:
-        shll      $8, %eax                                      #3973.46
-..LN3483:
-        movl      %eax, -112(%rbp)                              #3973.17
-        jmp       ..B23.10      # Prob 100%                     #3973.17
-                                # LOE
-..B23.54:                       # Preds ..B23.50 ..B23.49 ..B23.10
-..LN3485:
-        xorl      %eax, %eax                                    #3983.12
-        leave                                                   #3983.12
-..___tag_value_eval_2na_pos.391:                                #
-        ret                                                     #3983.12
-        .align    2,0x90
-..___tag_value_eval_2na_pos.392:                                #
-                                # LOE
-# mark_end;
-	.type	eval_2na_pos, at function
-	.size	eval_2na_pos,.-eval_2na_pos
-.LNeval_2na_pos:
-	.data
-# -- End  eval_2na_pos
-	.text
-# -- Begin  prime_buffer_4na
-# mark_begin;
-       .align    2,0x90
-prime_buffer_4na:
-# parameter 1(src): %rdi
-# parameter 2(ignore): %rsi
-..B24.1:                        # Preds ..B24.0
-..___tag_value_prime_buffer_4na.395:                            #
-..LN3487:
-        pushq     %rbp                                          #3990.1
-        movq      %rsp, %rbp                                    #3990.1
-..___tag_value_prime_buffer_4na.396:                            #
-        subq      $48, %rsp                                     #3990.1
-        movq      %rdi, -16(%rbp)                               #3990.1
-        movq      %rsi, -8(%rbp)                                #3990.1
-..LN3489:
-        movq      -16(%rbp), %rax                               #3996.34
-        movzbl    (%rax), %eax                                  #3996.34
-        movzbl    %al, %eax                                     #3996.34
-..LN3491:
-        movslq    %eax, %rax                                    #3996.21
-        lea       expand_2na.0(%rip), %rdx                      #3996.21
-        movzwl    (%rdx,%rax,2), %eax                           #3996.21
-..LN3493:
-        movw      %ax, -48(%rbp)                                #3996.5
-..LN3495:
-        movq      -16(%rbp), %rax                               #3997.34
-        movzbl    1(%rax), %eax                                 #3997.34
-        movzbl    %al, %eax                                     #3997.34
-..LN3497:
-        movslq    %eax, %rax                                    #3997.21
-        lea       expand_2na.0(%rip), %rdx                      #3997.21
-        movzwl    (%rdx,%rax,2), %eax                           #3997.21
-..LN3499:
-        movw      %ax, -46(%rbp)                                #3997.5
-..LN3501:
-        movq      -16(%rbp), %rax                               #3998.34
-        movzbl    2(%rax), %eax                                 #3998.34
-        movzbl    %al, %eax                                     #3998.34
-..LN3503:
-        movslq    %eax, %rax                                    #3998.21
-        lea       expand_2na.0(%rip), %rdx                      #3998.21
-        movzwl    (%rdx,%rax,2), %eax                           #3998.21
-..LN3505:
-        movw      %ax, -44(%rbp)                                #3998.5
-..LN3507:
-        movq      -16(%rbp), %rax                               #3999.34
-        movzbl    3(%rax), %eax                                 #3999.34
-        movzbl    %al, %eax                                     #3999.34
-..LN3509:
-        movslq    %eax, %rax                                    #3999.21
-        lea       expand_2na.0(%rip), %rdx                      #3999.21
-        movzwl    (%rdx,%rax,2), %eax                           #3999.21
-..LN3511:
-        movw      %ax, -42(%rbp)                                #3999.5
-..LN3513:
-        movq      -16(%rbp), %rax                               #4000.34
-        movzbl    4(%rax), %eax                                 #4000.34
-        movzbl    %al, %eax                                     #4000.34
-..LN3515:
-        movslq    %eax, %rax                                    #4000.21
-        lea       expand_2na.0(%rip), %rdx                      #4000.21
-        movzwl    (%rdx,%rax,2), %eax                           #4000.21
-..LN3517:
-        movw      %ax, -40(%rbp)                                #4000.5
-..LN3519:
-        movq      -16(%rbp), %rax                               #4001.34
-        movzbl    5(%rax), %eax                                 #4001.34
-        movzbl    %al, %eax                                     #4001.34
-..LN3521:
-        movslq    %eax, %rax                                    #4001.21
-        lea       expand_2na.0(%rip), %rdx                      #4001.21
-        movzwl    (%rdx,%rax,2), %eax                           #4001.21
-..LN3523:
-        movw      %ax, -38(%rbp)                                #4001.5
-..LN3525:
-        movq      -16(%rbp), %rax                               #4002.34
-        movzbl    6(%rax), %eax                                 #4002.34
-        movzbl    %al, %eax                                     #4002.34
-..LN3527:
-        movslq    %eax, %rax                                    #4002.21
-        lea       expand_2na.0(%rip), %rdx                      #4002.21
-        movzwl    (%rdx,%rax,2), %eax                           #4002.21
-..LN3529:
-        movw      %ax, -36(%rbp)                                #4002.5
-..LN3531:
-        movq      -16(%rbp), %rax                               #4003.34
-        movzbl    7(%rax), %eax                                 #4003.34
-        movzbl    %al, %eax                                     #4003.34
-..LN3533:
-        movslq    %eax, %rax                                    #4003.21
-        lea       expand_2na.0(%rip), %rdx                      #4003.21
-        movzwl    (%rdx,%rax,2), %eax                           #4003.21
-..LN3535:
-        movw      %ax, -34(%rbp)                                #4003.5
-..LN3537:
-        movdqu    -48(%rbp), %xmm0                              #4005.51
-..LN3539:
-        movdqa    %xmm0, -32(%rbp)                              #4005.5
-..LN3541:
-        movdqa    -32(%rbp), %xmm0                              #4006.12
-        leave                                                   #4006.12
-..___tag_value_prime_buffer_4na.400:                            #
-        ret                                                     #4006.12
-        .align    2,0x90
-..___tag_value_prime_buffer_4na.401:                            #
-                                # LOE
-# mark_end;
-	.type	prime_buffer_4na, at function
-	.size	prime_buffer_4na,.-prime_buffer_4na
-.LNprime_buffer_4na:
-	.data
-# -- End  prime_buffer_4na
-	.text
-# -- Begin  eval_4na_16
-# mark_begin;
-       .align    2,0x90
-eval_4na_16:
-# parameter 1(self): %rdi
-# parameter 2(ncbi2na): %rsi
-# parameter 3(pos): %edx
-# parameter 4(len): %ecx
-..B25.1:                        # Preds ..B25.0
-..___tag_value_eval_4na_16.404:                                 #
-..LN3543:
-        pushq     %rbp                                          #4057.1
-        movq      %rsp, %rbp                                    #4057.1
-..___tag_value_eval_4na_16.405:                                 #
-        subq      $336, %rsp                                    #4057.1
-        movq      %rdi, -48(%rbp)                               #4057.1
-        movq      %rsi, -40(%rbp)                               #4057.1
-        movl      %edx, -24(%rbp)                               #4057.1
-        movl      %ecx, -16(%rbp)                               #4057.1
-..LN3545:
-        movq      -48(%rbp), %rax                               #4083.25
-        movl      4(%rax), %eax                                 #4083.25
-..LN3547:
-        movl      %eax, -32(%rbp)                               #4083.23
-..LN3549:
-        movl      -16(%rbp), %eax                               #4086.5
-        movl      -32(%rbp), %edx                               #4086.5
-        cmpl      %edx, %eax                                    #4086.5
-        jae       ..B25.3       # Prob 50%                      #4086.5
-                                # LOE
-..B25.2:                        # Preds ..B25.1
-        lea       _2__STRING.9.0(%rip), %rax                    #4086.5
-        lea       _2__STRING.1.0(%rip), %rdx                    #4086.5
-        lea       __$Ub.0(%rip), %rcx                           #4086.5
-        movq      %rax, %rdi                                    #4086.5
-        movq      %rdx, %rsi                                    #4086.5
-        movl      $4086, %edx                                   #4086.5
-        call      __assert_fail at PLT                             #4086.5
-                                # LOE
-..B25.3:                        # Preds ..B25.1
-..LN3551:
-        movl      -24(%rbp), %eax                               #4090.12
-..LN3553:
-        addl      -16(%rbp), %eax                               #4090.5
-        movl      %eax, -16(%rbp)                               #4090.5
-..LN3555:
-        movl      -24(%rbp), %eax                               #4093.42
-..LN3557:
-        shrl      $2, %eax                                      #4093.49
-..LN3559:
-        addq      -40(%rbp), %rax                               #4093.30
-..LN3561:
-        movq      %rax, -96(%rbp)                               #4093.5
-..LN3563:
-        movl      -32(%rbp), %eax                               #4096.18
-        negl      %eax                                          #4096.18
-        addl      -16(%rbp), %eax                               #4096.18
-..LN3565:
-        movl      %eax, -76(%rbp)                               #4096.5
-..LN3567:
-        movl      -16(%rbp), %eax                               #4099.44
-..LN3569:
-        addl      $3, %eax                                      #4099.50
-..LN3571:
-        shrl      $2, %eax                                      #4099.57
-..LN3573:
-        addq      -40(%rbp), %rax                               #4099.30
-..LN3575:
-        movq      %rax, -88(%rbp)                               #4099.5
-..LN3577:
-        movq      -96(%rbp), %rax                               #4102.33
-..LN3579:
-        movq      -88(%rbp), %rdx                               #4102.38
-..LN3581:
-        movq      %rax, %rdi                                    #4102.14
-        movq      %rdx, %rsi                                    #4102.14
-        call      prime_buffer_4na at PLT                          #4102.14
-                                # LOE xmm0
-..B25.43:                       # Preds ..B25.3
-        movdqa    %xmm0, -144(%rbp)                             #4102.14
-                                # LOE
-..B25.4:                        # Preds ..B25.43
-..LN3583:
-        movdqa    -144(%rbp), %xmm0                             #4102.5
-        movdqa    %xmm0, -288(%rbp)                             #4102.5
-..LN3585:
-        addq      $8, -96(%rbp)                                 #4103.5
-..LN3587:
-        movq      -48(%rbp), %rax                               #4109.5
-        movdqa    16(%rax), %xmm0                               #4109.5
-        movdqa    %xmm0, -272(%rbp)                             #4109.5
-        movq      -48(%rbp), %rax                               #4109.5
-        movdqa    32(%rax), %xmm0                               #4109.5
-        movdqa    %xmm0, -256(%rbp)                             #4109.5
-        movq      -48(%rbp), %rax                               #4109.5
-        movdqa    48(%rax), %xmm0                               #4109.5
-        movdqa    %xmm0, -240(%rbp)                             #4109.5
-        movq      -48(%rbp), %rax                               #4109.5
-        movdqa    64(%rax), %xmm0                               #4109.5
-        movdqa    %xmm0, -224(%rbp)                             #4109.5
-        movq      -48(%rbp), %rax                               #4109.5
-        movdqa    80(%rax), %xmm0                               #4109.5
-        movdqa    %xmm0, -208(%rbp)                             #4109.5
-        movq      -48(%rbp), %rax                               #4109.5
-        movdqa    96(%rax), %xmm0                               #4109.5
-        movdqa    %xmm0, -192(%rbp)                             #4109.5
-        movq      -48(%rbp), %rax                               #4109.5
-        movdqa    112(%rax), %xmm0                              #4109.5
-        movdqa    %xmm0, -176(%rbp)                             #4109.5
-        movq      -48(%rbp), %rax                               #4109.5
-        movdqa    128(%rax), %xmm0                              #4109.5
-        movdqa    %xmm0, -160(%rbp)                             #4109.5
-..LN3589:
-        xorl      %eax, %eax                                    #4112.15
-        movl      %eax, -72(%rbp)                               #4112.15
-..LN3591:
-        movl      %eax, -68(%rbp)                               #4112.10
-..LN3593:
-        movl      %eax, -64(%rbp)                               #4112.5
-..LN3595:
-        movl      $1, -60(%rbp)                                 #4118.5
-..LN3597:
-        movl      -24(%rbp), %eax                               #4123.14
-..LN3599:
-        andl      $3, %eax                                      #4123.20
-        movl      %eax, -56(%rbp)                               #4123.20
-        je        ..B25.12      # Prob 50%                      #4123.20
-                                # LOE
-..B25.5:                        # Preds ..B25.4
-        movl      -56(%rbp), %eax                               #4123.20
-        cmpl      $1, %eax                                      #4123.20
-        je        ..B25.13      # Prob 50%                      #4123.20
-                                # LOE
-..B25.6:                        # Preds ..B25.5
-        movl      -56(%rbp), %eax                               #4123.20
-        cmpl      $2, %eax                                      #4123.20
-        je        ..B25.14      # Prob 50%                      #4123.20
-                                # LOE
-..B25.7:                        # Preds ..B25.6
-        movl      -56(%rbp), %eax                               #4123.20
-        cmpl      $3, %eax                                      #4123.20
-        je        ..B25.15      # Prob 50%                      #4123.20
-                                # LOE
-..B25.8:                        # Preds ..B25.39 ..B25.7
-..LN3601:
-        movl      $1, %eax                                      #4128.9
-        testl     %eax, %eax                                    #4128.9
-        je        ..B25.40      # Prob 100%                     #4128.9
-                                # LOE
-..B25.9:                        # Preds ..B25.8
-..LN3603:
-        movl      $1, -60(%rbp)                                 #4130.13
-                                # LOE
-..B25.10:                       # Preds ..B25.34 ..B25.9
-..LN3605:
-        movl      $1, %eax                                      #4133.13
-        testl     %eax, %eax                                    #4133.13
-        je        ..B25.36      # Prob 100%                     #4133.13
-                                # LOE
-..B25.12:                       # Preds ..B25.4 ..B25.10
-..LN3607:
-        movdqa    -288(%rbp), %xmm0                             #4140.38
-..LN3609:
-        movdqa    -272(%rbp), %xmm1                             #4140.46
-..LN3611:
-        pand      %xmm1, %xmm0                                  #4140.22
-..LN3613:
-        movdqa    %xmm0, -320(%rbp)                             #4140.17
-..LN3615:
-        movdqa    -288(%rbp), %xmm0                             #4141.38
-..LN3617:
-        movdqa    -256(%rbp), %xmm1                             #4141.46
-..LN3619:
-        pand      %xmm1, %xmm0                                  #4141.22
-..LN3621:
-        movdqa    %xmm0, -304(%rbp)                             #4141.17
-..LN3623:
-        movdqa    -320(%rbp), %xmm0                             #4142.22
-        movdqa    -304(%rbp), %xmm1                             #4142.22
-        pcmpeqw   %xmm1, %xmm0                                  #4142.22
-..LN3625:
-        movdqa    %xmm0, -320(%rbp)                             #4142.17
-..LN3627:
-        movdqa    -320(%rbp), %xmm0                             #4143.42
-..LN3629:
-        pmovmskb  %xmm0, %eax                                   #4143.22
-..LN3631:
-        movl      %eax, -64(%rbp)                               #4143.17
-                                # LOE
-..B25.13:                       # Preds ..B25.5 ..B25.12
-..LN3633:
-        movdqa    -288(%rbp), %xmm0                             #4147.38
-..LN3635:
-        movdqa    -240(%rbp), %xmm1                             #4147.46
-..LN3637:
-        pand      %xmm1, %xmm0                                  #4147.22
-..LN3639:
-        movdqa    %xmm0, -320(%rbp)                             #4147.17
-..LN3641:
-        movdqa    -288(%rbp), %xmm0                             #4148.38
-..LN3643:
-        movdqa    -224(%rbp), %xmm1                             #4148.46
-..LN3645:
-        pand      %xmm1, %xmm0                                  #4148.22
-..LN3647:
-        movdqa    %xmm0, -304(%rbp)                             #4148.17
-..LN3649:
-        movdqa    -320(%rbp), %xmm0                             #4149.22
-        movdqa    -304(%rbp), %xmm1                             #4149.22
-        pcmpeqw   %xmm1, %xmm0                                  #4149.22
-..LN3651:
-        movdqa    %xmm0, -320(%rbp)                             #4149.17
-..LN3653:
-        movdqa    -320(%rbp), %xmm0                             #4150.42
-..LN3655:
-        pmovmskb  %xmm0, %eax                                   #4150.22
-..LN3657:
-        movl      %eax, -68(%rbp)                               #4150.17
-                                # LOE
-..B25.14:                       # Preds ..B25.6 ..B25.13
-..LN3659:
-        movdqa    -288(%rbp), %xmm0                             #4154.38
-..LN3661:
-        movdqa    -208(%rbp), %xmm1                             #4154.46
-..LN3663:
-        pand      %xmm1, %xmm0                                  #4154.22
-..LN3665:
-        movdqa    %xmm0, -320(%rbp)                             #4154.17
-..LN3667:
-        movdqa    -288(%rbp), %xmm0                             #4155.38
-..LN3669:
-        movdqa    -192(%rbp), %xmm1                             #4155.46
-..LN3671:
-        pand      %xmm1, %xmm0                                  #4155.22
-..LN3673:
-        movdqa    %xmm0, -304(%rbp)                             #4155.17
-..LN3675:
-        movdqa    -320(%rbp), %xmm0                             #4156.22
-        movdqa    -304(%rbp), %xmm1                             #4156.22
-        pcmpeqw   %xmm1, %xmm0                                  #4156.22
-..LN3677:
-        movdqa    %xmm0, -320(%rbp)                             #4156.17
-..LN3679:
-        movdqa    -320(%rbp), %xmm0                             #4157.42
-..LN3681:
-        pmovmskb  %xmm0, %eax                                   #4157.22
-..LN3683:
-        movl      %eax, -72(%rbp)                               #4157.17
-                                # LOE
-..B25.15:                       # Preds ..B25.7 ..B25.14
-..LN3685:
-        movdqa    -288(%rbp), %xmm0                             #4161.38
-..LN3687:
-        movdqa    -176(%rbp), %xmm1                             #4161.46
-..LN3689:
-        pand      %xmm1, %xmm0                                  #4161.22
-..LN3691:
-        movdqa    %xmm0, -320(%rbp)                             #4161.17
-..LN3693:
-        movdqa    -288(%rbp), %xmm0                             #4162.38
-..LN3695:
-        movdqa    -160(%rbp), %xmm1                             #4162.46
-..LN3697:
-        pand      %xmm1, %xmm0                                  #4162.22
-..LN3699:
-        movdqa    %xmm0, -304(%rbp)                             #4162.17
-..LN3701:
-        movdqa    -320(%rbp), %xmm0                             #4163.22
-        movdqa    -304(%rbp), %xmm1                             #4163.22
-        pcmpeqw   %xmm1, %xmm0                                  #4163.22
-..LN3703:
-        movdqa    %xmm0, -320(%rbp)                             #4163.17
-..LN3705:
-        movdqa    -320(%rbp), %xmm0                             #4164.42
-..LN3707:
-        pmovmskb  %xmm0, %eax                                   #4164.22
-..LN3709:
-        movl      %eax, -80(%rbp)                               #4164.17
-..LN3711:
-        andl      $-4, -24(%rbp)                                #4169.17
-..LN3713:
-        movl      -68(%rbp), %eax                               #4172.29
-        orl       -64(%rbp), %eax                               #4172.29
-..LN3715:
-        orl       -72(%rbp), %eax                               #4172.34
-..LN3717:
-        orl       -80(%rbp), %eax                               #4172.39
-..LN3719:
-        je        ..B25.32      # Prob 50%                      #4172.47
-                                # LOE
-..B25.16:                       # Preds ..B25.15
-..LN3721:
-        movl      -64(%rbp), %eax                               #4190.58
-..LN3723:
-        movl      %eax, %edi                                    #4190.30
-        call      uint16_lsbit at PLT                              #4190.30
-                                # LOE eax
-..B25.44:                       # Preds ..B25.16
-        movl      %eax, -112(%rbp)                              #4190.30
-                                # LOE
-..B25.17:                       # Preds ..B25.44
-        movl      -112(%rbp), %eax                              #4190.30
-        movswq    %ax, %rax                                     #4190.30
-..LN3725:
-        movl      %eax, -128(%rbp)                              #4190.28
-..LN3727:
-        movl      -68(%rbp), %eax                               #4191.58
-..LN3729:
-        movl      %eax, %edi                                    #4191.30
-        call      uint16_lsbit at PLT                              #4191.30
-                                # LOE eax
-..B25.45:                       # Preds ..B25.17
-        movl      %eax, -108(%rbp)                              #4191.30
-                                # LOE
-..B25.18:                       # Preds ..B25.45
-        movl      -108(%rbp), %eax                              #4191.30
-        movswq    %ax, %rax                                     #4191.30
-..LN3731:
-        movl      %eax, -124(%rbp)                              #4191.28
-..LN3733:
-        movl      -72(%rbp), %eax                               #4192.58
-..LN3735:
-        movl      %eax, %edi                                    #4192.30
-        call      uint16_lsbit at PLT                              #4192.30
-                                # LOE eax
-..B25.46:                       # Preds ..B25.18
-        movl      %eax, -104(%rbp)                              #4192.30
-                                # LOE
-..B25.19:                       # Preds ..B25.46
-        movl      -104(%rbp), %eax                              #4192.30
-        movswq    %ax, %rax                                     #4192.30
-..LN3737:
-        movl      %eax, -120(%rbp)                              #4192.28
-..LN3739:
-        movl      -80(%rbp), %eax                               #4193.58
-..LN3741:
-        movl      %eax, %edi                                    #4193.30
-        call      uint16_lsbit at PLT                              #4193.30
-                                # LOE eax
-..B25.47:                       # Preds ..B25.19
-        movl      %eax, -100(%rbp)                              #4193.30
-                                # LOE
-..B25.20:                       # Preds ..B25.47
-        movl      -100(%rbp), %eax                              #4193.30
-        movswq    %ax, %rax                                     #4193.30
-..LN3743:
-        movl      %eax, -116(%rbp)                              #4193.28
-..LN3745:
-        movl      -128(%rbp), %eax                              #4198.28
-..LN3747:
-        addl      %eax, %eax                                    #4198.34
-..LN3749:
-        movl      %eax, -128(%rbp)                              #4198.21
-..LN3751:
-        movl      -124(%rbp), %eax                              #4199.28
-..LN3753:
-        lea       1(%rax,%rax), %eax                            #4199.40
-..LN3755:
-        movl      %eax, -124(%rbp)                              #4199.21
-..LN3757:
-        movl      -120(%rbp), %eax                              #4200.28
-..LN3759:
-        lea       2(%rax,%rax), %eax                            #4200.40
-..LN3761:
-        movl      %eax, -120(%rbp)                              #4200.21
-..LN3763:
-        movl      -116(%rbp), %eax                              #4201.28
-..LN3765:
-        lea       3(%rax,%rax), %eax                            #4201.40
-..LN3767:
-        movl      %eax, -116(%rbp)                              #4201.21
-..LN3769:
-        movl      -64(%rbp), %eax                               #4205.26
-..LN3771:
-        testl     %eax, %eax                                    #4205.32
-        je        ..B25.23      # Prob 50%                      #4205.32
-                                # LOE
-..B25.21:                       # Preds ..B25.20
-..LN3773:
-        movl      -128(%rbp), %eax                              #4205.43
-        addl      -24(%rbp), %eax                               #4205.43
-..LN3775:
-        movl      -76(%rbp), %edx                               #4205.49
-        cmpl      %edx, %eax                                    #4205.49
-        ja        ..B25.23      # Prob 50%                      #4205.49
-                                # LOE
-..B25.22:                       # Preds ..B25.21
-..LN3777:
-        movl      $1, %eax                                      #4205.63
-        leave                                                   #4205.63
-..___tag_value_eval_4na_16.409:                                 #
-        ret                                                     #4205.63
-..___tag_value_eval_4na_16.410:                                 #
-                                # LOE
-..B25.23:                       # Preds ..B25.21 ..B25.20
-..LN3779:
-        movl      -68(%rbp), %eax                               #4206.26
-..LN3781:
-        testl     %eax, %eax                                    #4206.32
-        je        ..B25.26      # Prob 50%                      #4206.32
-                                # LOE
-..B25.24:                       # Preds ..B25.23
-..LN3783:
-        movl      -124(%rbp), %eax                              #4206.43
-        addl      -24(%rbp), %eax                               #4206.43
-..LN3785:
-        movl      -76(%rbp), %edx                               #4206.49
-        cmpl      %edx, %eax                                    #4206.49
-        ja        ..B25.26      # Prob 50%                      #4206.49
-                                # LOE
-..B25.25:                       # Preds ..B25.24
-..LN3787:
-        movl      $1, %eax                                      #4206.63
-        leave                                                   #4206.63
-..___tag_value_eval_4na_16.412:                                 #
-        ret                                                     #4206.63
-..___tag_value_eval_4na_16.413:                                 #
-                                # LOE
-..B25.26:                       # Preds ..B25.24 ..B25.23
-..LN3789:
-        movl      -72(%rbp), %eax                               #4207.26
-..LN3791:
-        testl     %eax, %eax                                    #4207.32
-        je        ..B25.29      # Prob 50%                      #4207.32
-                                # LOE
-..B25.27:                       # Preds ..B25.26
-..LN3793:
-        movl      -120(%rbp), %eax                              #4207.43
-        addl      -24(%rbp), %eax                               #4207.43
-..LN3795:
-        movl      -76(%rbp), %edx                               #4207.49
-        cmpl      %edx, %eax                                    #4207.49
-        ja        ..B25.29      # Prob 50%                      #4207.49
-                                # LOE
-..B25.28:                       # Preds ..B25.27
-..LN3797:
-        movl      $1, %eax                                      #4207.63
-        leave                                                   #4207.63
-..___tag_value_eval_4na_16.415:                                 #
-        ret                                                     #4207.63
-..___tag_value_eval_4na_16.416:                                 #
-                                # LOE
-..B25.29:                       # Preds ..B25.27 ..B25.26
-..LN3799:
-        movl      -80(%rbp), %eax                               #4208.26
-..LN3801:
-        testl     %eax, %eax                                    #4208.32
-        je        ..B25.32      # Prob 50%                      #4208.32
-                                # LOE
-..B25.30:                       # Preds ..B25.29
-..LN3803:
-        movl      -116(%rbp), %eax                              #4208.43
-        addl      -24(%rbp), %eax                               #4208.43
-..LN3805:
-        movl      -76(%rbp), %edx                               #4208.49
-        cmpl      %edx, %eax                                    #4208.49
-        ja        ..B25.32      # Prob 50%                      #4208.49
-                                # LOE
-..B25.31:                       # Preds ..B25.30
-..LN3807:
-        movl      $1, %eax                                      #4208.63
-        leave                                                   #4208.63
-..___tag_value_eval_4na_16.418:                                 #
-        ret                                                     #4208.63
-..___tag_value_eval_4na_16.419:                                 #
-                                # LOE
-..B25.32:                       # Preds ..B25.30 ..B25.29 ..B25.15
-..LN3809:
-        addl      $4, -24(%rbp)                                 #4213.17
-..LN3811:
-        movl      -24(%rbp), %eax                               #4216.22
-..LN3813:
-        movl      -76(%rbp), %edx                               #4216.28
-        cmpl      %edx, %eax                                    #4216.28
-        jbe       ..B25.34      # Prob 50%                      #4216.28
-                                # LOE
-..B25.33:                       # Preds ..B25.32
-..LN3815:
-        xorl      %eax, %eax                                    #4217.28
-        leave                                                   #4217.28
-..___tag_value_eval_4na_16.421:                                 #
-        ret                                                     #4217.28
-..___tag_value_eval_4na_16.422:                                 #
-                                # LOE
-..B25.34:                       # Preds ..B25.32
-..LN3817:
-        movl      -60(%rbp), %eax                               #4220.25
-        decl      %eax                                          #4220.25
-        movl      %eax, -60(%rbp)                               #4220.25
-..LN3819:
-        jne       ..B25.10      # Prob 50%                      #4220.39
-                                # LOE
-..B25.36:                       # Preds ..B25.34 ..B25.10
-..LN3821:
-        movq      -96(%rbp), %rax                               #4237.18
-..LN3823:
-        movq      -88(%rbp), %rdx                               #4237.25
-        cmpq      %rdx, %rax                                    #4237.25
-        jae       ..B25.40      # Prob 50%                      #4237.25
-                                # LOE
-..B25.37:                       # Preds ..B25.36
-..LN3825:
-        addl      $28, -24(%rbp)                                #4241.13
-..LN3827:
-        movl      -24(%rbp), %eax                               #4242.18
-..LN3829:
-        movl      -76(%rbp), %edx                               #4242.24
-        cmpl      %edx, %eax                                    #4242.24
-        ja        ..B25.40      # Prob 50%                      #4242.24
-                                # LOE
-..B25.38:                       # Preds ..B25.37
-..LN3831:
-        movq      -96(%rbp), %rax                               #4247.41
-..LN3833:
-        movq      -88(%rbp), %rdx                               #4247.46
-..LN3835:
-        movq      %rax, %rdi                                    #4247.22
-        movq      %rdx, %rsi                                    #4247.22
-        call      prime_buffer_4na at PLT                          #4247.22
-                                # LOE xmm0
-..B25.48:                       # Preds ..B25.38
-        movdqa    %xmm0, -336(%rbp)                             #4247.22
-                                # LOE
-..B25.39:                       # Preds ..B25.48
-..LN3837:
-        movdqa    -336(%rbp), %xmm0                             #4247.13
-        movdqa    %xmm0, -288(%rbp)                             #4247.13
-..LN3839:
-        addq      $8, -96(%rbp)                                 #4262.13
-        jmp       ..B25.8       # Prob 100%                     #4262.13
-                                # LOE
-..B25.40:                       # Preds ..B25.37 ..B25.36 ..B25.8
-..LN3841:
-        xorl      %eax, %eax                                    #4273.12
-        leave                                                   #4273.12
-..___tag_value_eval_4na_16.424:                                 #
-        ret                                                     #4273.12
-        .align    2,0x90
-..___tag_value_eval_4na_16.425:                                 #
-                                # LOE
-# mark_end;
-	.type	eval_4na_16, at function
-	.size	eval_4na_16,.-eval_4na_16
-.LNeval_4na_16:
-	.data
-# -- End  eval_4na_16
-	.text
-# -- Begin  eval_4na_32
-# mark_begin;
-       .align    2,0x90
-eval_4na_32:
-# parameter 1(self): %rdi
-# parameter 2(ncbi2na): %rsi
-# parameter 3(pos): %edx
-# parameter 4(len): %ecx
-..B26.1:                        # Preds ..B26.0
-..___tag_value_eval_4na_32.428:                                 #
-..LN3843:
-        pushq     %rbp                                          #4279.1
-        movq      %rsp, %rbp                                    #4279.1
-..___tag_value_eval_4na_32.429:                                 #
-        subq      $336, %rsp                                    #4279.1
-        movq      %rdi, -40(%rbp)                               #4279.1
-        movq      %rsi, -32(%rbp)                               #4279.1
-        movl      %edx, -16(%rbp)                               #4279.1
-        movl      %ecx, -8(%rbp)                                #4279.1
-..LN3845:
-        movq      -40(%rbp), %rax                               #4305.25
-        movl      4(%rax), %eax                                 #4305.25
-..LN3847:
-        movl      %eax, -24(%rbp)                               #4305.23
-..LN3849:
-        movl      -8(%rbp), %eax                                #4308.5
-        movl      -24(%rbp), %edx                               #4308.5
-        cmpl      %edx, %eax                                    #4308.5
-        jae       ..B26.3       # Prob 50%                      #4308.5
-                                # LOE
-..B26.2:                        # Preds ..B26.1
-        lea       _2__STRING.9.0(%rip), %rax                    #4308.5
-        lea       _2__STRING.1.0(%rip), %rdx                    #4308.5
-        lea       __$Uc.0(%rip), %rcx                           #4308.5
-        movq      %rax, %rdi                                    #4308.5
-        movq      %rdx, %rsi                                    #4308.5
-        movl      $4308, %edx                                   #4308.5
-        call      __assert_fail at PLT                             #4308.5
-                                # LOE
-..B26.3:                        # Preds ..B26.1
-..LN3851:
-        movl      -16(%rbp), %eax                               #4312.12
-..LN3853:
-        addl      -8(%rbp), %eax                                #4312.5
-        movl      %eax, -8(%rbp)                                #4312.5
-..LN3855:
-        movl      -16(%rbp), %eax                               #4315.42
-..LN3857:
-        shrl      $2, %eax                                      #4315.49
-..LN3859:
-        addq      -32(%rbp), %rax                               #4315.30
-..LN3861:
-        movq      %rax, -96(%rbp)                               #4315.5
-..LN3863:
-        movl      -24(%rbp), %eax                               #4318.18
-        negl      %eax                                          #4318.18
-        addl      -8(%rbp), %eax                                #4318.18
-..LN3865:
-        movl      %eax, -68(%rbp)                               #4318.5
-..LN3867:
-        movl      -8(%rbp), %eax                                #4321.44
-..LN3869:
-        addl      $3, %eax                                      #4321.50
-..LN3871:
-        shrl      $2, %eax                                      #4321.57
-..LN3873:
-        addq      -32(%rbp), %rax                               #4321.30
-..LN3875:
-        movq      %rax, -88(%rbp)                               #4321.5
-..LN3877:
-        movq      -96(%rbp), %rax                               #4324.33
-..LN3879:
-        movq      -88(%rbp), %rdx                               #4324.38
-..LN3881:
-        movq      %rax, %rdi                                    #4324.14
-        movq      %rdx, %rsi                                    #4324.14
-        call      prime_buffer_4na at PLT                          #4324.14
-                                # LOE xmm0
-..B26.46:                       # Preds ..B26.3
-        movdqa    %xmm0, -144(%rbp)                             #4324.14
-                                # LOE
-..B26.4:                        # Preds ..B26.46
-..LN3883:
-        movdqa    -144(%rbp), %xmm0                             #4324.5
-        movdqa    %xmm0, -288(%rbp)                             #4324.5
-..LN3885:
-        addq      $8, -96(%rbp)                                 #4325.5
-..LN3887:
-        movq      -96(%rbp), %rax                               #4327.9
-..LN3889:
-        movq      %rax, -80(%rbp)                               #4327.5
-..LN3891:
-        movq      -40(%rbp), %rax                               #4331.5
-        movdqa    16(%rax), %xmm0                               #4331.5
-        movdqa    %xmm0, -272(%rbp)                             #4331.5
-        movq      -40(%rbp), %rax                               #4331.5
-        movdqa    32(%rax), %xmm0                               #4331.5
-        movdqa    %xmm0, -256(%rbp)                             #4331.5
-        movq      -40(%rbp), %rax                               #4331.5
-        movdqa    48(%rax), %xmm0                               #4331.5
-        movdqa    %xmm0, -240(%rbp)                             #4331.5
-        movq      -40(%rbp), %rax                               #4331.5
-        movdqa    64(%rax), %xmm0                               #4331.5
-        movdqa    %xmm0, -224(%rbp)                             #4331.5
-        movq      -40(%rbp), %rax                               #4331.5
-        movdqa    80(%rax), %xmm0                               #4331.5
-        movdqa    %xmm0, -208(%rbp)                             #4331.5
-        movq      -40(%rbp), %rax                               #4331.5
-        movdqa    96(%rax), %xmm0                               #4331.5
-        movdqa    %xmm0, -192(%rbp)                             #4331.5
-        movq      -40(%rbp), %rax                               #4331.5
-        movdqa    112(%rax), %xmm0                              #4331.5
-        movdqa    %xmm0, -176(%rbp)                             #4331.5
-        movq      -40(%rbp), %rax                               #4331.5
-        movdqa    128(%rax), %xmm0                              #4331.5
-        movdqa    %xmm0, -160(%rbp)                             #4331.5
-..LN3893:
-        xorl      %eax, %eax                                    #4334.15
-        movl      %eax, -64(%rbp)                               #4334.15
-..LN3895:
-        movl      %eax, -60(%rbp)                               #4334.10
-..LN3897:
-        movl      %eax, -56(%rbp)                               #4334.5
-..LN3899:
-        movl      $2, -52(%rbp)                                 #4340.5
-..LN3901:
-        movl      -16(%rbp), %eax                               #4345.14
-..LN3903:
-        andl      $3, %eax                                      #4345.20
-        movl      %eax, -48(%rbp)                               #4345.20
-        je        ..B26.12      # Prob 50%                      #4345.20
-                                # LOE
-..B26.5:                        # Preds ..B26.4
-        movl      -48(%rbp), %eax                               #4345.20
-        cmpl      $1, %eax                                      #4345.20
-        je        ..B26.13      # Prob 50%                      #4345.20
-                                # LOE
-..B26.6:                        # Preds ..B26.5
-        movl      -48(%rbp), %eax                               #4345.20
-        cmpl      $2, %eax                                      #4345.20
-        je        ..B26.14      # Prob 50%                      #4345.20
-                                # LOE
-..B26.7:                        # Preds ..B26.6
-        movl      -48(%rbp), %eax                               #4345.20
-        cmpl      $3, %eax                                      #4345.20
-        je        ..B26.15      # Prob 50%                      #4345.20
-                                # LOE
-..B26.8:                        # Preds ..B26.42 ..B26.7
-..LN3905:
-        movl      $1, %eax                                      #4350.9
-        testl     %eax, %eax                                    #4350.9
-        je        ..B26.43      # Prob 100%                     #4350.9
-                                # LOE
-..B26.9:                        # Preds ..B26.8
-..LN3907:
-        movl      $2, -52(%rbp)                                 #4352.13
-                                # LOE
-..B26.10:                       # Preds ..B26.37 ..B26.9
-..LN3909:
-        movl      $1, %eax                                      #4355.13
-        testl     %eax, %eax                                    #4355.13
-        je        ..B26.39      # Prob 100%                     #4355.13
-                                # LOE
-..B26.12:                       # Preds ..B26.4 ..B26.10
-..LN3911:
-        movdqa    -288(%rbp), %xmm0                             #4362.38
-..LN3913:
-        movdqa    -272(%rbp), %xmm1                             #4362.46
-..LN3915:
-        pand      %xmm1, %xmm0                                  #4362.22
-..LN3917:
-        movdqa    %xmm0, -320(%rbp)                             #4362.17
-..LN3919:
-        movdqa    -288(%rbp), %xmm0                             #4363.38
-..LN3921:
-        movdqa    -256(%rbp), %xmm1                             #4363.46
-..LN3923:
-        pand      %xmm1, %xmm0                                  #4363.22
-..LN3925:
-        movdqa    %xmm0, -304(%rbp)                             #4363.17
-..LN3927:
-        movdqa    -320(%rbp), %xmm0                             #4364.22
-        movdqa    -304(%rbp), %xmm1                             #4364.22
-        pcmpeqd   %xmm1, %xmm0                                  #4364.22
-..LN3929:
-        movdqa    %xmm0, -320(%rbp)                             #4364.17
-..LN3931:
-        movdqa    -320(%rbp), %xmm0                             #4365.42
-..LN3933:
-        pmovmskb  %xmm0, %eax                                   #4365.22
-..LN3935:
-        movl      %eax, -56(%rbp)                               #4365.17
-                                # LOE
-..B26.13:                       # Preds ..B26.5 ..B26.12
-..LN3937:
-        movdqa    -288(%rbp), %xmm0                             #4369.38
-..LN3939:
-        movdqa    -240(%rbp), %xmm1                             #4369.46
-..LN3941:
-        pand      %xmm1, %xmm0                                  #4369.22
-..LN3943:
-        movdqa    %xmm0, -320(%rbp)                             #4369.17
-..LN3945:
-        movdqa    -288(%rbp), %xmm0                             #4370.38
-..LN3947:
-        movdqa    -224(%rbp), %xmm1                             #4370.46
-..LN3949:
-        pand      %xmm1, %xmm0                                  #4370.22
-..LN3951:
-        movdqa    %xmm0, -304(%rbp)                             #4370.17
-..LN3953:
-        movdqa    -320(%rbp), %xmm0                             #4371.22
-        movdqa    -304(%rbp), %xmm1                             #4371.22
-        pcmpeqd   %xmm1, %xmm0                                  #4371.22
-..LN3955:
-        movdqa    %xmm0, -320(%rbp)                             #4371.17
-..LN3957:
-        movdqa    -320(%rbp), %xmm0                             #4372.42
-..LN3959:
-        pmovmskb  %xmm0, %eax                                   #4372.22
-..LN3961:
-        movl      %eax, -60(%rbp)                               #4372.17
-                                # LOE
-..B26.14:                       # Preds ..B26.6 ..B26.13
-..LN3963:
-        movdqa    -288(%rbp), %xmm0                             #4376.38
-..LN3965:
-        movdqa    -208(%rbp), %xmm1                             #4376.46
-..LN3967:
-        pand      %xmm1, %xmm0                                  #4376.22
-..LN3969:
-        movdqa    %xmm0, -320(%rbp)                             #4376.17
-..LN3971:
-        movdqa    -288(%rbp), %xmm0                             #4377.38
-..LN3973:
-        movdqa    -192(%rbp), %xmm1                             #4377.46
-..LN3975:
-        pand      %xmm1, %xmm0                                  #4377.22
-..LN3977:
-        movdqa    %xmm0, -304(%rbp)                             #4377.17
-..LN3979:
-        movdqa    -320(%rbp), %xmm0                             #4378.22
-        movdqa    -304(%rbp), %xmm1                             #4378.22
-        pcmpeqd   %xmm1, %xmm0                                  #4378.22
-..LN3981:
-        movdqa    %xmm0, -320(%rbp)                             #4378.17
-..LN3983:
-        movdqa    -320(%rbp), %xmm0                             #4379.42
-..LN3985:
-        pmovmskb  %xmm0, %eax                                   #4379.22
-..LN3987:
-        movl      %eax, -64(%rbp)                               #4379.17
-                                # LOE
-..B26.15:                       # Preds ..B26.7 ..B26.14
-..LN3989:
-        movdqa    -288(%rbp), %xmm0                             #4383.38
-..LN3991:
-        movdqa    -176(%rbp), %xmm1                             #4383.46
-..LN3993:
-        pand      %xmm1, %xmm0                                  #4383.22
-..LN3995:
-        movdqa    %xmm0, -320(%rbp)                             #4383.17
-..LN3997:
-        movdqa    -288(%rbp), %xmm0                             #4384.38
-..LN3999:
-        movdqa    -160(%rbp), %xmm1                             #4384.46
-..LN4001:
-        pand      %xmm1, %xmm0                                  #4384.22
-..LN4003:
-        movdqa    %xmm0, -304(%rbp)                             #4384.17
-..LN4005:
-        movdqa    -320(%rbp), %xmm0                             #4385.22
-        movdqa    -304(%rbp), %xmm1                             #4385.22
-        pcmpeqd   %xmm1, %xmm0                                  #4385.22
-..LN4007:
-        movdqa    %xmm0, -320(%rbp)                             #4385.17
-..LN4009:
-        movdqa    -320(%rbp), %xmm0                             #4386.42
-..LN4011:
-        pmovmskb  %xmm0, %eax                                   #4386.22
-..LN4013:
-        movl      %eax, -72(%rbp)                               #4386.17
-..LN4015:
-        andl      $-4, -16(%rbp)                                #4391.17
-..LN4017:
-        movl      -60(%rbp), %eax                               #4394.29
-        orl       -56(%rbp), %eax                               #4394.29
-..LN4019:
-        orl       -64(%rbp), %eax                               #4394.34
-..LN4021:
-        orl       -72(%rbp), %eax                               #4394.39
-..LN4023:
-        je        ..B26.32      # Prob 50%                      #4394.47
-                                # LOE
-..B26.16:                       # Preds ..B26.15
-..LN4025:
-        movl      -56(%rbp), %eax                               #4412.58
-..LN4027:
-        movl      %eax, %edi                                    #4412.30
-        call      uint16_lsbit at PLT                              #4412.30
-                                # LOE eax
-..B26.47:                       # Preds ..B26.16
-        movl      %eax, -112(%rbp)                              #4412.30
-                                # LOE
-..B26.17:                       # Preds ..B26.47
-        movl      -112(%rbp), %eax                              #4412.30
-        movswq    %ax, %rax                                     #4412.30
-..LN4029:
-        movl      %eax, -128(%rbp)                              #4412.28
-..LN4031:
-        movl      -60(%rbp), %eax                               #4413.58
-..LN4033:
-        movl      %eax, %edi                                    #4413.30
-        call      uint16_lsbit at PLT                              #4413.30
-                                # LOE eax
-..B26.48:                       # Preds ..B26.17
-        movl      %eax, -108(%rbp)                              #4413.30
-                                # LOE
-..B26.18:                       # Preds ..B26.48
-        movl      -108(%rbp), %eax                              #4413.30
-        movswq    %ax, %rax                                     #4413.30
-..LN4035:
-        movl      %eax, -124(%rbp)                              #4413.28
-..LN4037:
-        movl      -64(%rbp), %eax                               #4414.58
-..LN4039:
-        movl      %eax, %edi                                    #4414.30
-        call      uint16_lsbit at PLT                              #4414.30
-                                # LOE eax
-..B26.49:                       # Preds ..B26.18
-        movl      %eax, -104(%rbp)                              #4414.30
-                                # LOE
-..B26.19:                       # Preds ..B26.49
-        movl      -104(%rbp), %eax                              #4414.30
-        movswq    %ax, %rax                                     #4414.30
-..LN4041:
-        movl      %eax, -120(%rbp)                              #4414.28
-..LN4043:
-        movl      -72(%rbp), %eax                               #4415.58
-..LN4045:
-        movl      %eax, %edi                                    #4415.30
-        call      uint16_lsbit at PLT                              #4415.30
-                                # LOE eax
-..B26.50:                       # Preds ..B26.19
-        movl      %eax, -100(%rbp)                              #4415.30
-                                # LOE
-..B26.20:                       # Preds ..B26.50
-        movl      -100(%rbp), %eax                              #4415.30
-        movswq    %ax, %rax                                     #4415.30
-..LN4047:
-        movl      %eax, -116(%rbp)                              #4415.28
-..LN4049:
-        movl      -128(%rbp), %eax                              #4420.28
-..LN4051:
-        addl      %eax, %eax                                    #4420.34
-..LN4053:
-        movl      %eax, -128(%rbp)                              #4420.21
-..LN4055:
-        movl      -124(%rbp), %eax                              #4421.28
-..LN4057:
-        lea       1(%rax,%rax), %eax                            #4421.40
-..LN4059:
-        movl      %eax, -124(%rbp)                              #4421.21
-..LN4061:
-        movl      -120(%rbp), %eax                              #4422.28
-..LN4063:
-        lea       2(%rax,%rax), %eax                            #4422.40
-..LN4065:
-        movl      %eax, -120(%rbp)                              #4422.21
-..LN4067:
-        movl      -116(%rbp), %eax                              #4423.28
-..LN4069:
-        lea       3(%rax,%rax), %eax                            #4423.40
-..LN4071:
-        movl      %eax, -116(%rbp)                              #4423.21
-..LN4073:
-        movl      -56(%rbp), %eax                               #4427.26
-..LN4075:
-        testl     %eax, %eax                                    #4427.32
-        je        ..B26.23      # Prob 50%                      #4427.32
-                                # LOE
-..B26.21:                       # Preds ..B26.20
-..LN4077:
-        movl      -128(%rbp), %eax                              #4427.43
-        addl      -16(%rbp), %eax                               #4427.43
-..LN4079:
-        movl      -68(%rbp), %edx                               #4427.49
-        cmpl      %edx, %eax                                    #4427.49
-        ja        ..B26.23      # Prob 50%                      #4427.49
-                                # LOE
-..B26.22:                       # Preds ..B26.21
-..LN4081:
-        movl      $1, %eax                                      #4427.63
-        leave                                                   #4427.63
-..___tag_value_eval_4na_32.433:                                 #
-        ret                                                     #4427.63
-..___tag_value_eval_4na_32.434:                                 #
-                                # LOE
-..B26.23:                       # Preds ..B26.21 ..B26.20
-..LN4083:
-        movl      -60(%rbp), %eax                               #4428.26
-..LN4085:
-        testl     %eax, %eax                                    #4428.32
-        je        ..B26.26      # Prob 50%                      #4428.32
-                                # LOE
-..B26.24:                       # Preds ..B26.23
-..LN4087:
-        movl      -124(%rbp), %eax                              #4428.43
-        addl      -16(%rbp), %eax                               #4428.43
-..LN4089:
-        movl      -68(%rbp), %edx                               #4428.49
-        cmpl      %edx, %eax                                    #4428.49
-        ja        ..B26.26      # Prob 50%                      #4428.49
-                                # LOE
-..B26.25:                       # Preds ..B26.24
-..LN4091:
-        movl      $1, %eax                                      #4428.63
-        leave                                                   #4428.63
-..___tag_value_eval_4na_32.436:                                 #
-        ret                                                     #4428.63
-..___tag_value_eval_4na_32.437:                                 #
-                                # LOE
-..B26.26:                       # Preds ..B26.24 ..B26.23
-..LN4093:
-        movl      -64(%rbp), %eax                               #4429.26
-..LN4095:
-        testl     %eax, %eax                                    #4429.32
-        je        ..B26.29      # Prob 50%                      #4429.32
-                                # LOE
-..B26.27:                       # Preds ..B26.26
-..LN4097:
-        movl      -120(%rbp), %eax                              #4429.43
-        addl      -16(%rbp), %eax                               #4429.43
-..LN4099:
-        movl      -68(%rbp), %edx                               #4429.49
-        cmpl      %edx, %eax                                    #4429.49
-        ja        ..B26.29      # Prob 50%                      #4429.49
-                                # LOE
-..B26.28:                       # Preds ..B26.27
-..LN4101:
-        movl      $1, %eax                                      #4429.63
-        leave                                                   #4429.63
-..___tag_value_eval_4na_32.439:                                 #
-        ret                                                     #4429.63
-..___tag_value_eval_4na_32.440:                                 #
-                                # LOE
-..B26.29:                       # Preds ..B26.27 ..B26.26
-..LN4103:
-        movl      -72(%rbp), %eax                               #4430.26
-..LN4105:
-        testl     %eax, %eax                                    #4430.32
-        je        ..B26.32      # Prob 50%                      #4430.32
-                                # LOE
-..B26.30:                       # Preds ..B26.29
-..LN4107:
-        movl      -116(%rbp), %eax                              #4430.43
-        addl      -16(%rbp), %eax                               #4430.43
-..LN4109:
-        movl      -68(%rbp), %edx                               #4430.49
-        cmpl      %edx, %eax                                    #4430.49
-        ja        ..B26.32      # Prob 50%                      #4430.49
-                                # LOE
-..B26.31:                       # Preds ..B26.30
-..LN4111:
-        movl      $1, %eax                                      #4430.63
-        leave                                                   #4430.63
-..___tag_value_eval_4na_32.442:                                 #
-        ret                                                     #4430.63
-..___tag_value_eval_4na_32.443:                                 #
-                                # LOE
-..B26.32:                       # Preds ..B26.30 ..B26.29 ..B26.15
-..LN4113:
-        addl      $4, -16(%rbp)                                 #4435.17
-..LN4115:
-        movl      -16(%rbp), %eax                               #4438.22
-..LN4117:
-        movl      -68(%rbp), %edx                               #4438.28
-        cmpl      %edx, %eax                                    #4438.28
-        jbe       ..B26.34      # Prob 50%                      #4438.28
-                                # LOE
-..B26.33:                       # Preds ..B26.32
-..LN4119:
-        xorl      %eax, %eax                                    #4439.28
-        leave                                                   #4439.28
-..___tag_value_eval_4na_32.445:                                 #
-        ret                                                     #4439.28
-..___tag_value_eval_4na_32.446:                                 #
-                                # LOE
-..B26.34:                       # Preds ..B26.32
-..LN4121:
-        movl      -52(%rbp), %eax                               #4442.25
-        decl      %eax                                          #4442.25
-        movl      %eax, -52(%rbp)                               #4442.25
-..LN4123:
-        je        ..B26.39      # Prob 50%                      #4442.39
-                                # LOE
-..B26.35:                       # Preds ..B26.34
-..LN4125:
-        movdqa    -288(%rbp), %xmm0                             #4447.43
-..LN4127:
-        psrldq    $2, %xmm0                                     #4447.26
-..LN4129:
-        movdqa    %xmm0, -288(%rbp)                             #4447.17
-..LN4131:
-        movq      -80(%rbp), %rax                               #4450.22
-..LN4133:
-        movq      -88(%rbp), %rdx                               #4450.26
-        cmpq      %rdx, %rax                                    #4450.26
-        jae       ..B26.37      # Prob 50%                      #4450.26
-                                # LOE
-..B26.36:                       # Preds ..B26.35
-..LN4135:
-        movdqa    -288(%rbp), %xmm0                             #4451.49
-..LN4137:
-        movq      -80(%rbp), %rax                               #4451.72
-        movzbl    (%rax), %eax                                  #4451.72
-        movzbl    %al, %eax                                     #4451.72
-..LN4139:
-        movslq    %eax, %rax                                    #4451.57
-        lea       expand_2na.0(%rip), %rdx                      #4451.57
-        movzwl    (%rdx,%rax,2), %eax                           #4451.57
-        movzwl    %ax, %eax                                     #4451.57
-..LN4141:
-        pinsrw    $7, %eax, %xmm0                               #4451.30
-..LN4143:
-        movdqa    %xmm0, -288(%rbp)                             #4451.21
-                                # LOE
-..B26.37:                       # Preds ..B26.36 ..B26.35
-..LN4145:
-        incq      -80(%rbp)                                     #4454.20
-        jmp       ..B26.10      # Prob 100%                     #4454.20
-                                # LOE
-..B26.39:                       # Preds ..B26.34 ..B26.10
-..LN4147:
-        movq      -96(%rbp), %rax                               #4459.18
-..LN4149:
-        movq      -88(%rbp), %rdx                               #4459.25
-        cmpq      %rdx, %rax                                    #4459.25
-        jae       ..B26.43      # Prob 50%                      #4459.25
-                                # LOE
-..B26.40:                       # Preds ..B26.39
-..LN4151:
-        addl      $24, -16(%rbp)                                #4463.13
-..LN4153:
-        movl      -16(%rbp), %eax                               #4464.18
-..LN4155:
-        movl      -68(%rbp), %edx                               #4464.24
-        cmpl      %edx, %eax                                    #4464.24
-        ja        ..B26.43      # Prob 50%                      #4464.24
-                                # LOE
-..B26.41:                       # Preds ..B26.40
-..LN4157:
-        movq      -96(%rbp), %rax                               #4469.41
-..LN4159:
-        movq      -88(%rbp), %rdx                               #4469.46
-..LN4161:
-        movq      %rax, %rdi                                    #4469.22
-        movq      %rdx, %rsi                                    #4469.22
-        call      prime_buffer_4na at PLT                          #4469.22
-                                # LOE xmm0
-..B26.51:                       # Preds ..B26.41
-        movdqa    %xmm0, -336(%rbp)                             #4469.22
-                                # LOE
-..B26.42:                       # Preds ..B26.51
-..LN4163:
-        movdqa    -336(%rbp), %xmm0                             #4469.13
-        movdqa    %xmm0, -288(%rbp)                             #4469.13
-..LN4165:
-        addq      $8, -96(%rbp)                                 #4484.13
-..LN4167:
-        movq      -96(%rbp), %rax                               #4486.17
-..LN4169:
-        movq      %rax, -80(%rbp)                               #4486.13
-        jmp       ..B26.8       # Prob 100%                     #4486.13
-                                # LOE
-..B26.43:                       # Preds ..B26.40 ..B26.39 ..B26.8
-..LN4171:
-        xorl      %eax, %eax                                    #4495.12
-        leave                                                   #4495.12
-..___tag_value_eval_4na_32.448:                                 #
-        ret                                                     #4495.12
-        .align    2,0x90
-..___tag_value_eval_4na_32.449:                                 #
-                                # LOE
-# mark_end;
-	.type	eval_4na_32, at function
-	.size	eval_4na_32,.-eval_4na_32
-.LNeval_4na_32:
-	.data
-# -- End  eval_4na_32
-	.text
-# -- Begin  eval_4na_64
-# mark_begin;
-       .align    2,0x90
-eval_4na_64:
-# parameter 1(self): %rdi
-# parameter 2(ncbi2na): %rsi
-# parameter 3(pos): %edx
-# parameter 4(len): %ecx
-..B27.1:                        # Preds ..B27.0
-..___tag_value_eval_4na_64.452:                                 #
-..LN4173:
-        pushq     %rbp                                          #4501.1
-        movq      %rsp, %rbp                                    #4501.1
-..___tag_value_eval_4na_64.453:                                 #
-        subq      $336, %rsp                                    #4501.1
-        movq      %rdi, -40(%rbp)                               #4501.1
-        movq      %rsi, -32(%rbp)                               #4501.1
-        movl      %edx, -16(%rbp)                               #4501.1
-        movl      %ecx, -8(%rbp)                                #4501.1
-..LN4175:
-        movq      -40(%rbp), %rax                               #4528.25
-        movl      4(%rax), %eax                                 #4528.25
-..LN4177:
-        movl      %eax, -24(%rbp)                               #4528.23
-..LN4179:
-        movl      -8(%rbp), %eax                                #4531.5
-        movl      -24(%rbp), %edx                               #4531.5
-        cmpl      %edx, %eax                                    #4531.5
-        jae       ..B27.3       # Prob 50%                      #4531.5
-                                # LOE
-..B27.2:                        # Preds ..B27.1
-        lea       _2__STRING.9.0(%rip), %rax                    #4531.5
-        lea       _2__STRING.1.0(%rip), %rdx                    #4531.5
-        lea       __$Ud.0(%rip), %rcx                           #4531.5
-        movq      %rax, %rdi                                    #4531.5
-        movq      %rdx, %rsi                                    #4531.5
-        movl      $4531, %edx                                   #4531.5
-        call      __assert_fail at PLT                             #4531.5
-                                # LOE
-..B27.3:                        # Preds ..B27.1
-..LN4181:
-        movl      -16(%rbp), %eax                               #4535.12
-..LN4183:
-        addl      -8(%rbp), %eax                                #4535.5
-        movl      %eax, -8(%rbp)                                #4535.5
-..LN4185:
-        movl      -16(%rbp), %eax                               #4538.42
-..LN4187:
-        shrl      $2, %eax                                      #4538.49
-..LN4189:
-        addq      -32(%rbp), %rax                               #4538.30
-..LN4191:
-        movq      %rax, -96(%rbp)                               #4538.5
-..LN4193:
-        movl      -24(%rbp), %eax                               #4541.18
-        negl      %eax                                          #4541.18
-        addl      -8(%rbp), %eax                                #4541.18
-..LN4195:
-        movl      %eax, -68(%rbp)                               #4541.5
-..LN4197:
-        movl      -8(%rbp), %eax                                #4544.44
-..LN4199:
-        addl      $3, %eax                                      #4544.50
-..LN4201:
-        shrl      $2, %eax                                      #4544.57
-..LN4203:
-        addq      -32(%rbp), %rax                               #4544.30
-..LN4205:
-        movq      %rax, -88(%rbp)                               #4544.5
-..LN4207:
-        movq      -96(%rbp), %rax                               #4547.33
-..LN4209:
-        movq      -88(%rbp), %rdx                               #4547.38
-..LN4211:
-        movq      %rax, %rdi                                    #4547.14
-        movq      %rdx, %rsi                                    #4547.14
-        call      prime_buffer_4na at PLT                          #4547.14
-                                # LOE xmm0
-..B27.46:                       # Preds ..B27.3
-        movdqa    %xmm0, -144(%rbp)                             #4547.14
-                                # LOE
-..B27.4:                        # Preds ..B27.46
-..LN4213:
-        movdqa    -144(%rbp), %xmm0                             #4547.5
-        movdqa    %xmm0, -288(%rbp)                             #4547.5
-..LN4215:
-        addq      $8, -96(%rbp)                                 #4548.5
-..LN4217:
-        movq      -96(%rbp), %rax                               #4550.9
-..LN4219:
-        movq      %rax, -80(%rbp)                               #4550.5
-..LN4221:
-        movq      -40(%rbp), %rax                               #4554.5
-        movdqa    16(%rax), %xmm0                               #4554.5
-        movdqa    %xmm0, -272(%rbp)                             #4554.5
-        movq      -40(%rbp), %rax                               #4554.5
-        movdqa    32(%rax), %xmm0                               #4554.5
-        movdqa    %xmm0, -256(%rbp)                             #4554.5
-        movq      -40(%rbp), %rax                               #4554.5
-        movdqa    48(%rax), %xmm0                               #4554.5
-        movdqa    %xmm0, -240(%rbp)                             #4554.5
-        movq      -40(%rbp), %rax                               #4554.5
-        movdqa    64(%rax), %xmm0                               #4554.5
-        movdqa    %xmm0, -224(%rbp)                             #4554.5
-        movq      -40(%rbp), %rax                               #4554.5
-        movdqa    80(%rax), %xmm0                               #4554.5
-        movdqa    %xmm0, -208(%rbp)                             #4554.5
-        movq      -40(%rbp), %rax                               #4554.5
-        movdqa    96(%rax), %xmm0                               #4554.5
-        movdqa    %xmm0, -192(%rbp)                             #4554.5
-        movq      -40(%rbp), %rax                               #4554.5
-        movdqa    112(%rax), %xmm0                              #4554.5
-        movdqa    %xmm0, -176(%rbp)                             #4554.5
-        movq      -40(%rbp), %rax                               #4554.5
-        movdqa    128(%rax), %xmm0                              #4554.5
-        movdqa    %xmm0, -160(%rbp)                             #4554.5
-..LN4223:
-        xorl      %eax, %eax                                    #4557.15
-        movl      %eax, -64(%rbp)                               #4557.15
-..LN4225:
-        movl      %eax, -60(%rbp)                               #4557.10
-..LN4227:
-        movl      %eax, -56(%rbp)                               #4557.5
-..LN4229:
-        movl      $4, -52(%rbp)                                 #4563.5
-..LN4231:
-        movl      -16(%rbp), %eax                               #4568.14
-..LN4233:
-        andl      $3, %eax                                      #4568.20
-        movl      %eax, -48(%rbp)                               #4568.20
-        je        ..B27.12      # Prob 50%                      #4568.20
-                                # LOE
-..B27.5:                        # Preds ..B27.4
-        movl      -48(%rbp), %eax                               #4568.20
-        cmpl      $1, %eax                                      #4568.20
-        je        ..B27.13      # Prob 50%                      #4568.20
-                                # LOE
-..B27.6:                        # Preds ..B27.5
-        movl      -48(%rbp), %eax                               #4568.20
-        cmpl      $2, %eax                                      #4568.20
-        je        ..B27.14      # Prob 50%                      #4568.20
-                                # LOE
-..B27.7:                        # Preds ..B27.6
-        movl      -48(%rbp), %eax                               #4568.20
-        cmpl      $3, %eax                                      #4568.20
-        je        ..B27.15      # Prob 50%                      #4568.20
-                                # LOE
-..B27.8:                        # Preds ..B27.42 ..B27.7
-..LN4235:
-        movl      $1, %eax                                      #4573.9
-        testl     %eax, %eax                                    #4573.9
-        je        ..B27.43      # Prob 100%                     #4573.9
-                                # LOE
-..B27.9:                        # Preds ..B27.8
-..LN4237:
-        movl      $4, -52(%rbp)                                 #4575.13
-                                # LOE
-..B27.10:                       # Preds ..B27.37 ..B27.9
-..LN4239:
-        movl      $1, %eax                                      #4578.13
-        testl     %eax, %eax                                    #4578.13
-        je        ..B27.39      # Prob 100%                     #4578.13
-                                # LOE
-..B27.12:                       # Preds ..B27.4 ..B27.10
-..LN4241:
-        movdqa    -288(%rbp), %xmm0                             #4585.38
-..LN4243:
-        movdqa    -272(%rbp), %xmm1                             #4585.46
-..LN4245:
-        pand      %xmm1, %xmm0                                  #4585.22
-..LN4247:
-        movdqa    %xmm0, -320(%rbp)                             #4585.17
-..LN4249:
-        movdqa    -288(%rbp), %xmm0                             #4586.38
-..LN4251:
-        movdqa    -256(%rbp), %xmm1                             #4586.46
-..LN4253:
-        pand      %xmm1, %xmm0                                  #4586.22
-..LN4255:
-        movdqa    %xmm0, -304(%rbp)                             #4586.17
-..LN4257:
-        movdqa    -320(%rbp), %xmm0                             #4587.22
-        movdqa    -304(%rbp), %xmm1                             #4587.22
-        pcmpeqd   %xmm1, %xmm0                                  #4587.22
-..LN4259:
-        movdqa    %xmm0, -320(%rbp)                             #4587.17
-..LN4261:
-        movdqa    -320(%rbp), %xmm0                             #4588.42
-..LN4263:
-        pmovmskb  %xmm0, %eax                                   #4588.22
-..LN4265:
-        movl      %eax, -56(%rbp)                               #4588.17
-..LN4267:
-        movl      -56(%rbp), %eax                               #4589.17
-        andl      $3855, %eax                                   #4589.17
-        shll      $4, %eax                                      #4589.17
-        andl      -56(%rbp), %eax                               #4589.17
-        movl      %eax, -56(%rbp)                               #4589.17
-        movl      -56(%rbp), %eax                               #4589.17
-        sarl      $4, %eax                                      #4589.17
-        orl       -56(%rbp), %eax                               #4589.17
-        movl      %eax, -56(%rbp)                               #4589.17
-                                # LOE
-..B27.13:                       # Preds ..B27.5 ..B27.12
-..LN4269:
-        movdqa    -288(%rbp), %xmm0                             #4592.38
-..LN4271:
-        movdqa    -240(%rbp), %xmm1                             #4592.46
-..LN4273:
-        pand      %xmm1, %xmm0                                  #4592.22
-..LN4275:
-        movdqa    %xmm0, -320(%rbp)                             #4592.17
-..LN4277:
-        movdqa    -288(%rbp), %xmm0                             #4593.38
-..LN4279:
-        movdqa    -224(%rbp), %xmm1                             #4593.46
-..LN4281:
-        pand      %xmm1, %xmm0                                  #4593.22
-..LN4283:
-        movdqa    %xmm0, -304(%rbp)                             #4593.17
-..LN4285:
-        movdqa    -320(%rbp), %xmm0                             #4594.22
-        movdqa    -304(%rbp), %xmm1                             #4594.22
-        pcmpeqd   %xmm1, %xmm0                                  #4594.22
-..LN4287:
-        movdqa    %xmm0, -320(%rbp)                             #4594.17
-..LN4289:
-        movdqa    -320(%rbp), %xmm0                             #4595.42
-..LN4291:
-        pmovmskb  %xmm0, %eax                                   #4595.22
-..LN4293:
-        movl      %eax, -60(%rbp)                               #4595.17
-..LN4295:
-        movl      -60(%rbp), %eax                               #4596.17
-        andl      $3855, %eax                                   #4596.17
-        shll      $4, %eax                                      #4596.17
-        andl      -60(%rbp), %eax                               #4596.17
-        movl      %eax, -60(%rbp)                               #4596.17
-        movl      -60(%rbp), %eax                               #4596.17
-        sarl      $4, %eax                                      #4596.17
-        orl       -60(%rbp), %eax                               #4596.17
-        movl      %eax, -60(%rbp)                               #4596.17
-                                # LOE
-..B27.14:                       # Preds ..B27.6 ..B27.13
-..LN4297:
-        movdqa    -288(%rbp), %xmm0                             #4599.38
-..LN4299:
-        movdqa    -208(%rbp), %xmm1                             #4599.46
-..LN4301:
-        pand      %xmm1, %xmm0                                  #4599.22
-..LN4303:
-        movdqa    %xmm0, -320(%rbp)                             #4599.17
-..LN4305:
-        movdqa    -288(%rbp), %xmm0                             #4600.38
-..LN4307:
-        movdqa    -192(%rbp), %xmm1                             #4600.46
-..LN4309:
-        pand      %xmm1, %xmm0                                  #4600.22
-..LN4311:
-        movdqa    %xmm0, -304(%rbp)                             #4600.17
-..LN4313:
-        movdqa    -320(%rbp), %xmm0                             #4601.22
-        movdqa    -304(%rbp), %xmm1                             #4601.22
-        pcmpeqd   %xmm1, %xmm0                                  #4601.22
-..LN4315:
-        movdqa    %xmm0, -320(%rbp)                             #4601.17
-..LN4317:
-        movdqa    -320(%rbp), %xmm0                             #4602.42
-..LN4319:
-        pmovmskb  %xmm0, %eax                                   #4602.22
-..LN4321:
-        movl      %eax, -64(%rbp)                               #4602.17
-..LN4323:
-        movl      -64(%rbp), %eax                               #4603.17
-        andl      $3855, %eax                                   #4603.17
-        shll      $4, %eax                                      #4603.17
-        andl      -64(%rbp), %eax                               #4603.17
-        movl      %eax, -64(%rbp)                               #4603.17
-        movl      -64(%rbp), %eax                               #4603.17
-        sarl      $4, %eax                                      #4603.17
-        orl       -64(%rbp), %eax                               #4603.17
-        movl      %eax, -64(%rbp)                               #4603.17
-                                # LOE
-..B27.15:                       # Preds ..B27.7 ..B27.14
-..LN4325:
-        movdqa    -288(%rbp), %xmm0                             #4606.38
-..LN4327:
-        movdqa    -176(%rbp), %xmm1                             #4606.46
-..LN4329:
-        pand      %xmm1, %xmm0                                  #4606.22
-..LN4331:
-        movdqa    %xmm0, -320(%rbp)                             #4606.17
-..LN4333:
-        movdqa    -288(%rbp), %xmm0                             #4607.38
-..LN4335:
-        movdqa    -160(%rbp), %xmm1                             #4607.46
-..LN4337:
-        pand      %xmm1, %xmm0                                  #4607.22
-..LN4339:
-        movdqa    %xmm0, -304(%rbp)                             #4607.17
-..LN4341:
-        movdqa    -320(%rbp), %xmm0                             #4608.22
-        movdqa    -304(%rbp), %xmm1                             #4608.22
-        pcmpeqd   %xmm1, %xmm0                                  #4608.22
-..LN4343:
-        movdqa    %xmm0, -320(%rbp)                             #4608.17
-..LN4345:
-        movdqa    -320(%rbp), %xmm0                             #4609.42
-..LN4347:
-        pmovmskb  %xmm0, %eax                                   #4609.22
-..LN4349:
-        movl      %eax, -72(%rbp)                               #4609.17
-..LN4351:
-        movl      -72(%rbp), %eax                               #4610.17
-        andl      $3855, %eax                                   #4610.17
-        shll      $4, %eax                                      #4610.17
-        andl      -72(%rbp), %eax                               #4610.17
-        movl      %eax, -72(%rbp)                               #4610.17
-        movl      -72(%rbp), %eax                               #4610.17
-        sarl      $4, %eax                                      #4610.17
-        orl       -72(%rbp), %eax                               #4610.17
-        movl      %eax, -72(%rbp)                               #4610.17
-..LN4353:
-        andl      $-4, -16(%rbp)                                #4614.17
-..LN4355:
-        movl      -60(%rbp), %eax                               #4617.29
-        orl       -56(%rbp), %eax                               #4617.29
-..LN4357:
-        orl       -64(%rbp), %eax                               #4617.34
-..LN4359:
-        orl       -72(%rbp), %eax                               #4617.39
-..LN4361:
-        je        ..B27.32      # Prob 50%                      #4617.47
-                                # LOE
-..B27.16:                       # Preds ..B27.15
-..LN4363:
-        movl      -56(%rbp), %eax                               #4635.58
-..LN4365:
-        movl      %eax, %edi                                    #4635.30
-        call      uint16_lsbit at PLT                              #4635.30
-                                # LOE eax
-..B27.47:                       # Preds ..B27.16
-        movl      %eax, -112(%rbp)                              #4635.30
-                                # LOE
-..B27.17:                       # Preds ..B27.47
-        movl      -112(%rbp), %eax                              #4635.30
-        movswq    %ax, %rax                                     #4635.30
-..LN4367:
-        movl      %eax, -128(%rbp)                              #4635.28
-..LN4369:
-        movl      -60(%rbp), %eax                               #4636.58
-..LN4371:
-        movl      %eax, %edi                                    #4636.30
-        call      uint16_lsbit at PLT                              #4636.30
-                                # LOE eax
-..B27.48:                       # Preds ..B27.17
-        movl      %eax, -108(%rbp)                              #4636.30
-                                # LOE
-..B27.18:                       # Preds ..B27.48
-        movl      -108(%rbp), %eax                              #4636.30
-        movswq    %ax, %rax                                     #4636.30
-..LN4373:
-        movl      %eax, -124(%rbp)                              #4636.28
-..LN4375:
-        movl      -64(%rbp), %eax                               #4637.58
-..LN4377:
-        movl      %eax, %edi                                    #4637.30
-        call      uint16_lsbit at PLT                              #4637.30
-                                # LOE eax
-..B27.49:                       # Preds ..B27.18
-        movl      %eax, -104(%rbp)                              #4637.30
-                                # LOE
-..B27.19:                       # Preds ..B27.49
-        movl      -104(%rbp), %eax                              #4637.30
-        movswq    %ax, %rax                                     #4637.30
-..LN4379:
-        movl      %eax, -120(%rbp)                              #4637.28
-..LN4381:
-        movl      -72(%rbp), %eax                               #4638.58
-..LN4383:
-        movl      %eax, %edi                                    #4638.30
-        call      uint16_lsbit at PLT                              #4638.30
-                                # LOE eax
-..B27.50:                       # Preds ..B27.19
-        movl      %eax, -100(%rbp)                              #4638.30
-                                # LOE
-..B27.20:                       # Preds ..B27.50
-        movl      -100(%rbp), %eax                              #4638.30
-        movswq    %ax, %rax                                     #4638.30
-..LN4385:
-        movl      %eax, -116(%rbp)                              #4638.28
-..LN4387:
-        movl      -128(%rbp), %eax                              #4643.28
-..LN4389:
-        addl      %eax, %eax                                    #4643.34
-..LN4391:
-        movl      %eax, -128(%rbp)                              #4643.21
-..LN4393:
-        movl      -124(%rbp), %eax                              #4644.28
-..LN4395:
-        lea       1(%rax,%rax), %eax                            #4644.40
-..LN4397:
-        movl      %eax, -124(%rbp)                              #4644.21
-..LN4399:
-        movl      -120(%rbp), %eax                              #4645.28
-..LN4401:
-        lea       2(%rax,%rax), %eax                            #4645.40
-..LN4403:
-        movl      %eax, -120(%rbp)                              #4645.21
-..LN4405:
-        movl      -116(%rbp), %eax                              #4646.28
-..LN4407:
-        lea       3(%rax,%rax), %eax                            #4646.40
-..LN4409:
-        movl      %eax, -116(%rbp)                              #4646.21
-..LN4411:
-        movl      -56(%rbp), %eax                               #4650.26
-..LN4413:
-        testl     %eax, %eax                                    #4650.32
-        je        ..B27.23      # Prob 50%                      #4650.32
-                                # LOE
-..B27.21:                       # Preds ..B27.20
-..LN4415:
-        movl      -128(%rbp), %eax                              #4650.43
-        addl      -16(%rbp), %eax                               #4650.43
-..LN4417:
-        movl      -68(%rbp), %edx                               #4650.49
-        cmpl      %edx, %eax                                    #4650.49
-        ja        ..B27.23      # Prob 50%                      #4650.49
-                                # LOE
-..B27.22:                       # Preds ..B27.21
-..LN4419:
-        movl      $1, %eax                                      #4650.63
-        leave                                                   #4650.63
-..___tag_value_eval_4na_64.457:                                 #
-        ret                                                     #4650.63
-..___tag_value_eval_4na_64.458:                                 #
-                                # LOE
-..B27.23:                       # Preds ..B27.21 ..B27.20
-..LN4421:
-        movl      -60(%rbp), %eax                               #4651.26
-..LN4423:
-        testl     %eax, %eax                                    #4651.32
-        je        ..B27.26      # Prob 50%                      #4651.32
-                                # LOE
-..B27.24:                       # Preds ..B27.23
-..LN4425:
-        movl      -124(%rbp), %eax                              #4651.43
-        addl      -16(%rbp), %eax                               #4651.43
-..LN4427:
-        movl      -68(%rbp), %edx                               #4651.49
-        cmpl      %edx, %eax                                    #4651.49
-        ja        ..B27.26      # Prob 50%                      #4651.49
-                                # LOE
-..B27.25:                       # Preds ..B27.24
-..LN4429:
-        movl      $1, %eax                                      #4651.63
-        leave                                                   #4651.63
-..___tag_value_eval_4na_64.460:                                 #
-        ret                                                     #4651.63
-..___tag_value_eval_4na_64.461:                                 #
-                                # LOE
-..B27.26:                       # Preds ..B27.24 ..B27.23
-..LN4431:
-        movl      -64(%rbp), %eax                               #4652.26
-..LN4433:
-        testl     %eax, %eax                                    #4652.32
-        je        ..B27.29      # Prob 50%                      #4652.32
-                                # LOE
-..B27.27:                       # Preds ..B27.26
-..LN4435:
-        movl      -120(%rbp), %eax                              #4652.43
-        addl      -16(%rbp), %eax                               #4652.43
-..LN4437:
-        movl      -68(%rbp), %edx                               #4652.49
-        cmpl      %edx, %eax                                    #4652.49
-        ja        ..B27.29      # Prob 50%                      #4652.49
-                                # LOE
-..B27.28:                       # Preds ..B27.27
-..LN4439:
-        movl      $1, %eax                                      #4652.63
-        leave                                                   #4652.63
-..___tag_value_eval_4na_64.463:                                 #
-        ret                                                     #4652.63
-..___tag_value_eval_4na_64.464:                                 #
-                                # LOE
-..B27.29:                       # Preds ..B27.27 ..B27.26
-..LN4441:
-        movl      -72(%rbp), %eax                               #4653.26
-..LN4443:
-        testl     %eax, %eax                                    #4653.32
-        je        ..B27.32      # Prob 50%                      #4653.32
-                                # LOE
-..B27.30:                       # Preds ..B27.29
-..LN4445:
-        movl      -116(%rbp), %eax                              #4653.43
-        addl      -16(%rbp), %eax                               #4653.43
-..LN4447:
-        movl      -68(%rbp), %edx                               #4653.49
-        cmpl      %edx, %eax                                    #4653.49
-        ja        ..B27.32      # Prob 50%                      #4653.49
-                                # LOE
-..B27.31:                       # Preds ..B27.30
-..LN4449:
-        movl      $1, %eax                                      #4653.63
-        leave                                                   #4653.63
-..___tag_value_eval_4na_64.466:                                 #
-        ret                                                     #4653.63
-..___tag_value_eval_4na_64.467:                                 #
-                                # LOE
-..B27.32:                       # Preds ..B27.30 ..B27.29 ..B27.15
-..LN4451:
-        addl      $4, -16(%rbp)                                 #4658.17
-..LN4453:
-        movl      -16(%rbp), %eax                               #4661.22
-..LN4455:
-        movl      -68(%rbp), %edx                               #4661.28
-        cmpl      %edx, %eax                                    #4661.28
-        jbe       ..B27.34      # Prob 50%                      #4661.28
-                                # LOE
-..B27.33:                       # Preds ..B27.32
-..LN4457:
-        xorl      %eax, %eax                                    #4662.28
-        leave                                                   #4662.28
-..___tag_value_eval_4na_64.469:                                 #
-        ret                                                     #4662.28
-..___tag_value_eval_4na_64.470:                                 #
-                                # LOE
-..B27.34:                       # Preds ..B27.32
-..LN4459:
-        movl      -52(%rbp), %eax                               #4665.25
-        decl      %eax                                          #4665.25
-        movl      %eax, -52(%rbp)                               #4665.25
-..LN4461:
-        je        ..B27.39      # Prob 50%                      #4665.39
-                                # LOE
-..B27.35:                       # Preds ..B27.34
-..LN4463:
-        movdqa    -288(%rbp), %xmm0                             #4670.43
-..LN4465:
-        psrldq    $2, %xmm0                                     #4670.26
-..LN4467:
-        movdqa    %xmm0, -288(%rbp)                             #4670.17
-..LN4469:
-        movq      -80(%rbp), %rax                               #4673.22
-..LN4471:
-        movq      -88(%rbp), %rdx                               #4673.26
-        cmpq      %rdx, %rax                                    #4673.26
-        jae       ..B27.37      # Prob 50%                      #4673.26
-                                # LOE
-..B27.36:                       # Preds ..B27.35
-..LN4473:
-        movdqa    -288(%rbp), %xmm0                             #4674.49
-..LN4475:
-        movq      -80(%rbp), %rax                               #4674.72
-        movzbl    (%rax), %eax                                  #4674.72
-        movzbl    %al, %eax                                     #4674.72
-..LN4477:
-        movslq    %eax, %rax                                    #4674.57
-        lea       expand_2na.0(%rip), %rdx                      #4674.57
-        movzwl    (%rdx,%rax,2), %eax                           #4674.57
-        movzwl    %ax, %eax                                     #4674.57
-..LN4479:
-        pinsrw    $7, %eax, %xmm0                               #4674.30
-..LN4481:
-        movdqa    %xmm0, -288(%rbp)                             #4674.21
-                                # LOE
-..B27.37:                       # Preds ..B27.36 ..B27.35
-..LN4483:
-        incq      -80(%rbp)                                     #4677.20
-        jmp       ..B27.10      # Prob 100%                     #4677.20
-                                # LOE
-..B27.39:                       # Preds ..B27.34 ..B27.10
-..LN4485:
-        movq      -96(%rbp), %rax                               #4682.18
-..LN4487:
-        movq      -88(%rbp), %rdx                               #4682.25
-        cmpq      %rdx, %rax                                    #4682.25
-        jae       ..B27.43      # Prob 50%                      #4682.25
-                                # LOE
-..B27.40:                       # Preds ..B27.39
-..LN4489:
-        addl      $16, -16(%rbp)                                #4686.13
-..LN4491:
-        movl      -16(%rbp), %eax                               #4687.18
-..LN4493:
-        movl      -68(%rbp), %edx                               #4687.24
-        cmpl      %edx, %eax                                    #4687.24
-        ja        ..B27.43      # Prob 50%                      #4687.24
-                                # LOE
-..B27.41:                       # Preds ..B27.40
-..LN4495:
-        movq      -96(%rbp), %rax                               #4692.41
-..LN4497:
-        movq      -88(%rbp), %rdx                               #4692.46
-..LN4499:
-        movq      %rax, %rdi                                    #4692.22
-        movq      %rdx, %rsi                                    #4692.22
-        call      prime_buffer_4na at PLT                          #4692.22
-                                # LOE xmm0
-..B27.51:                       # Preds ..B27.41
-        movdqa    %xmm0, -336(%rbp)                             #4692.22
-                                # LOE
-..B27.42:                       # Preds ..B27.51
-..LN4501:
-        movdqa    -336(%rbp), %xmm0                             #4692.13
-        movdqa    %xmm0, -288(%rbp)                             #4692.13
-..LN4503:
-        addq      $8, -96(%rbp)                                 #4707.13
-..LN4505:
-        movq      -96(%rbp), %rax                               #4709.17
-..LN4507:
-        movq      %rax, -80(%rbp)                               #4709.13
-        jmp       ..B27.8       # Prob 100%                     #4709.13
-                                # LOE
-..B27.43:                       # Preds ..B27.40 ..B27.39 ..B27.8
-..LN4509:
-        xorl      %eax, %eax                                    #4718.12
-        leave                                                   #4718.12
-..___tag_value_eval_4na_64.472:                                 #
-        ret                                                     #4718.12
-        .align    2,0x90
-..___tag_value_eval_4na_64.473:                                 #
-                                # LOE
-# mark_end;
-	.type	eval_4na_64, at function
-	.size	eval_4na_64,.-eval_4na_64
-.LNeval_4na_64:
-	.data
-# -- End  eval_4na_64
-	.text
-# -- Begin  eval_4na_128
-# mark_begin;
-       .align    2,0x90
-eval_4na_128:
-# parameter 1(self): %rdi
-# parameter 2(ncbi2na): %rsi
-# parameter 3(pos): %edx
-# parameter 4(len): %ecx
-..B28.1:                        # Preds ..B28.0
-..___tag_value_eval_4na_128.476:                                #
-..LN4511:
-        pushq     %rbp                                          #4724.1
-        movq      %rsp, %rbp                                    #4724.1
-..___tag_value_eval_4na_128.477:                                #
-        subq      $320, %rsp                                    #4724.1
-        movq      %rdi, -40(%rbp)                               #4724.1
-        movq      %rsi, -32(%rbp)                               #4724.1
-        movl      %edx, -16(%rbp)                               #4724.1
-        movl      %ecx, -8(%rbp)                                #4724.1
-..LN4513:
-        movq      -40(%rbp), %rax                               #4750.25
-        movl      4(%rax), %eax                                 #4750.25
-..LN4515:
-        movl      %eax, -24(%rbp)                               #4750.23
-..LN4517:
-        movl      -8(%rbp), %eax                                #4753.5
-        movl      -24(%rbp), %edx                               #4753.5
-        cmpl      %edx, %eax                                    #4753.5
-        jae       ..B28.3       # Prob 50%                      #4753.5
-                                # LOE
-..B28.2:                        # Preds ..B28.1
-        lea       _2__STRING.9.0(%rip), %rax                    #4753.5
-        lea       _2__STRING.1.0(%rip), %rdx                    #4753.5
-        lea       __$Ue.0(%rip), %rcx                           #4753.5
-        movq      %rax, %rdi                                    #4753.5
-        movq      %rdx, %rsi                                    #4753.5
-        movl      $4753, %edx                                   #4753.5
-        call      __assert_fail at PLT                             #4753.5
-                                # LOE
-..B28.3:                        # Preds ..B28.1
-..LN4519:
-        movl      -16(%rbp), %eax                               #4757.12
-..LN4521:
-        addl      -8(%rbp), %eax                                #4757.5
-        movl      %eax, -8(%rbp)                                #4757.5
-..LN4523:
-        movl      -16(%rbp), %eax                               #4760.42
-..LN4525:
-        shrl      $2, %eax                                      #4760.49
-..LN4527:
-        addq      -32(%rbp), %rax                               #4760.30
-..LN4529:
-        movq      %rax, -88(%rbp)                               #4760.5
-..LN4531:
-        movl      -24(%rbp), %eax                               #4763.18
-        negl      %eax                                          #4763.18
-        addl      -8(%rbp), %eax                                #4763.18
-..LN4533:
-        movl      %eax, -64(%rbp)                               #4763.5
-..LN4535:
-        movl      -8(%rbp), %eax                                #4766.44
-..LN4537:
-        addl      $3, %eax                                      #4766.50
-..LN4539:
-        shrl      $2, %eax                                      #4766.57
-..LN4541:
-        addq      -32(%rbp), %rax                               #4766.30
-..LN4543:
-        movq      %rax, -80(%rbp)                               #4766.5
-..LN4545:
-        movq      -88(%rbp), %rax                               #4769.33
-..LN4547:
-        movq      -80(%rbp), %rdx                               #4769.38
-..LN4549:
-        movq      %rax, %rdi                                    #4769.14
-        movq      %rdx, %rsi                                    #4769.14
-        call      prime_buffer_4na at PLT                          #4769.14
-                                # LOE xmm0
-..B28.41:                       # Preds ..B28.3
-        movdqa    %xmm0, -112(%rbp)                             #4769.14
-                                # LOE
-..B28.4:                        # Preds ..B28.41
-..LN4551:
-        movdqa    -112(%rbp), %xmm0                             #4769.5
-        movdqa    %xmm0, -256(%rbp)                             #4769.5
-..LN4553:
-        addq      $8, -88(%rbp)                                 #4770.5
-..LN4555:
-        movq      -88(%rbp), %rax                               #4772.9
-..LN4557:
-        movq      %rax, -72(%rbp)                               #4772.5
-..LN4559:
-        movq      -40(%rbp), %rax                               #4776.5
-        movdqa    16(%rax), %xmm0                               #4776.5
-        movdqa    %xmm0, -240(%rbp)                             #4776.5
-        movq      -40(%rbp), %rax                               #4776.5
-        movdqa    32(%rax), %xmm0                               #4776.5
-        movdqa    %xmm0, -224(%rbp)                             #4776.5
-        movq      -40(%rbp), %rax                               #4776.5
-        movdqa    48(%rax), %xmm0                               #4776.5
-        movdqa    %xmm0, -208(%rbp)                             #4776.5
-        movq      -40(%rbp), %rax                               #4776.5
-        movdqa    64(%rax), %xmm0                               #4776.5
-        movdqa    %xmm0, -192(%rbp)                             #4776.5
-        movq      -40(%rbp), %rax                               #4776.5
-        movdqa    80(%rax), %xmm0                               #4776.5
-        movdqa    %xmm0, -176(%rbp)                             #4776.5
-        movq      -40(%rbp), %rax                               #4776.5
-        movdqa    96(%rax), %xmm0                               #4776.5
-        movdqa    %xmm0, -160(%rbp)                             #4776.5
-        movq      -40(%rbp), %rax                               #4776.5
-        movdqa    112(%rax), %xmm0                              #4776.5
-        movdqa    %xmm0, -144(%rbp)                             #4776.5
-        movq      -40(%rbp), %rax                               #4776.5
-        movdqa    128(%rax), %xmm0                              #4776.5
-        movdqa    %xmm0, -128(%rbp)                             #4776.5
-..LN4561:
-        xorl      %eax, %eax                                    #4779.15
-        movl      %eax, -60(%rbp)                               #4779.15
-..LN4563:
-        movl      %eax, -56(%rbp)                               #4779.10
-..LN4565:
-        movl      %eax, -52(%rbp)                               #4779.5
-..LN4567:
-        movl      -16(%rbp), %eax                               #4781.27
-        negl      %eax                                          #4781.27
-..LN4569:
-        movl      -64(%rbp), %edx                               #4781.20
-..LN4571:
-        lea       7(%rdx,%rax), %eax                            #4781.33
-..LN4573:
-        shrl      $2, %eax                                      #4781.40
-..LN4575:
-        movl      %eax, -48(%rbp)                               #4781.5
-..LN4577:
-        movl      -16(%rbp), %eax                               #4790.14
-..LN4579:
-        andl      $3, %eax                                      #4790.20
-        movl      %eax, -44(%rbp)                               #4790.20
-        je        ..B28.12      # Prob 50%                      #4790.20
-                                # LOE
-..B28.5:                        # Preds ..B28.4
-        movl      -44(%rbp), %eax                               #4790.20
-        cmpl      $1, %eax                                      #4790.20
-        je        ..B28.13      # Prob 50%                      #4790.20
-                                # LOE
-..B28.6:                        # Preds ..B28.5
-        movl      -44(%rbp), %eax                               #4790.20
-        cmpl      $2, %eax                                      #4790.20
-        je        ..B28.14      # Prob 50%                      #4790.20
-                                # LOE
-..B28.7:                        # Preds ..B28.6
-        movl      -44(%rbp), %eax                               #4790.20
-        cmpl      $3, %eax                                      #4790.20
-        je        ..B28.15      # Prob 50%                      #4790.20
-                                # LOE
-..B28.8:                        # Preds ..B28.37 ..B28.7
-..LN4581:
-        movl      $1, %eax                                      #4795.9
-        testl     %eax, %eax                                    #4795.9
-        je        ..B28.38      # Prob 100%                     #4795.9
-                                # LOE
-..B28.9:                        # Preds ..B28.8
-..LN4583:
-        movl      $8, -48(%rbp)                                 #4797.13
-                                # LOE
-..B28.10:                       # Preds ..B28.32 ..B28.9
-..LN4585:
-        movl      $1, %eax                                      #4800.13
-        testl     %eax, %eax                                    #4800.13
-        je        ..B28.34      # Prob 100%                     #4800.13
-                                # LOE
-..B28.12:                       # Preds ..B28.4 ..B28.10
-..LN4587:
-        movdqa    -256(%rbp), %xmm0                             #4807.38
-..LN4589:
-        movdqa    -240(%rbp), %xmm1                             #4807.46
-..LN4591:
-        pand      %xmm1, %xmm0                                  #4807.22
-..LN4593:
-        movdqa    %xmm0, -304(%rbp)                             #4807.17
-..LN4595:
-        movdqa    -256(%rbp), %xmm0                             #4808.38
-..LN4597:
-        movdqa    -224(%rbp), %xmm1                             #4808.46
-..LN4599:
-        pand      %xmm1, %xmm0                                  #4808.22
-..LN4601:
-        movdqa    %xmm0, -288(%rbp)                             #4808.17
-..LN4603:
-        movdqa    -304(%rbp), %xmm0                             #4809.22
-        movdqa    -288(%rbp), %xmm1                             #4809.22
-        pcmpeqd   %xmm1, %xmm0                                  #4809.22
-..LN4605:
-        movdqa    %xmm0, -304(%rbp)                             #4809.17
-..LN4607:
-        movdqa    -304(%rbp), %xmm0                             #4810.42
-..LN4609:
-        pmovmskb  %xmm0, %eax                                   #4810.22
-..LN4611:
-        movl      %eax, -52(%rbp)                               #4810.17
-..LN4613:
-        movl      -52(%rbp), %eax                               #4811.17
-        incl      %eax                                          #4811.17
-        sarl      $16, %eax                                     #4811.17
-        negl      %eax                                          #4811.17
-        movl      %eax, -52(%rbp)                               #4811.17
-                                # LOE
-..B28.13:                       # Preds ..B28.5 ..B28.12
-..LN4615:
-        movdqa    -256(%rbp), %xmm0                             #4814.38
-..LN4617:
-        movdqa    -208(%rbp), %xmm1                             #4814.46
-..LN4619:
-        pand      %xmm1, %xmm0                                  #4814.22
-..LN4621:
-        movdqa    %xmm0, -304(%rbp)                             #4814.17
-..LN4623:
-        movdqa    -256(%rbp), %xmm0                             #4815.38
-..LN4625:
-        movdqa    -192(%rbp), %xmm1                             #4815.46
-..LN4627:
-        pand      %xmm1, %xmm0                                  #4815.22
-..LN4629:
-        movdqa    %xmm0, -288(%rbp)                             #4815.17
-..LN4631:
-        movdqa    -304(%rbp), %xmm0                             #4816.22
-        movdqa    -288(%rbp), %xmm1                             #4816.22
-        pcmpeqd   %xmm1, %xmm0                                  #4816.22
-..LN4633:
-        movdqa    %xmm0, -304(%rbp)                             #4816.17
-..LN4635:
-        movdqa    -304(%rbp), %xmm0                             #4817.42
-..LN4637:
-        pmovmskb  %xmm0, %eax                                   #4817.22
-..LN4639:
-        movl      %eax, -56(%rbp)                               #4817.17
-..LN4641:
-        movl      -56(%rbp), %eax                               #4818.17
-        incl      %eax                                          #4818.17
-        sarl      $16, %eax                                     #4818.17
-        negl      %eax                                          #4818.17
-        movl      %eax, -56(%rbp)                               #4818.17
-                                # LOE
-..B28.14:                       # Preds ..B28.6 ..B28.13
-..LN4643:
-        movdqa    -256(%rbp), %xmm0                             #4821.38
-..LN4645:
-        movdqa    -176(%rbp), %xmm1                             #4821.46
-..LN4647:
-        pand      %xmm1, %xmm0                                  #4821.22
-..LN4649:
-        movdqa    %xmm0, -304(%rbp)                             #4821.17
-..LN4651:
-        movdqa    -256(%rbp), %xmm0                             #4822.38
-..LN4653:
-        movdqa    -160(%rbp), %xmm1                             #4822.46
-..LN4655:
-        pand      %xmm1, %xmm0                                  #4822.22
-..LN4657:
-        movdqa    %xmm0, -288(%rbp)                             #4822.17
-..LN4659:
-        movdqa    -304(%rbp), %xmm0                             #4823.22
-        movdqa    -288(%rbp), %xmm1                             #4823.22
-        pcmpeqd   %xmm1, %xmm0                                  #4823.22
-..LN4661:
-        movdqa    %xmm0, -304(%rbp)                             #4823.17
-..LN4663:
-        movdqa    -304(%rbp), %xmm0                             #4824.42
-..LN4665:
-        pmovmskb  %xmm0, %eax                                   #4824.22
-..LN4667:
-        movl      %eax, -60(%rbp)                               #4824.17
-..LN4669:
-        movl      -60(%rbp), %eax                               #4825.17
-        incl      %eax                                          #4825.17
-        sarl      $16, %eax                                     #4825.17
-        negl      %eax                                          #4825.17
-        movl      %eax, -60(%rbp)                               #4825.17
-                                # LOE
-..B28.15:                       # Preds ..B28.7 ..B28.14
-..LN4671:
-        movdqa    -256(%rbp), %xmm0                             #4828.38
-..LN4673:
-        movdqa    -144(%rbp), %xmm1                             #4828.46
-..LN4675:
-        pand      %xmm1, %xmm0                                  #4828.22
-..LN4677:
-        movdqa    %xmm0, -304(%rbp)                             #4828.17
-..LN4679:
-        movdqa    -256(%rbp), %xmm0                             #4829.38
-..LN4681:
-        movdqa    -128(%rbp), %xmm1                             #4829.46
-..LN4683:
-        pand      %xmm1, %xmm0                                  #4829.22
-..LN4685:
-        movdqa    %xmm0, -288(%rbp)                             #4829.17
-..LN4687:
-        movdqa    -304(%rbp), %xmm0                             #4830.22
-        movdqa    -288(%rbp), %xmm1                             #4830.22
-        pcmpeqd   %xmm1, %xmm0                                  #4830.22
-..LN4689:
-        movdqa    %xmm0, -304(%rbp)                             #4830.17
-..LN4691:
-        movdqa    -304(%rbp), %xmm0                             #4831.42
-..LN4693:
-        pmovmskb  %xmm0, %eax                                   #4831.22
-..LN4695:
-        movl      %eax, -96(%rbp)                               #4831.17
-..LN4697:
-        movl      -96(%rbp), %eax                               #4832.17
-        incl      %eax                                          #4832.17
-        sarl      $16, %eax                                     #4832.17
-        negl      %eax                                          #4832.17
-        movl      %eax, -96(%rbp)                               #4832.17
-..LN4699:
-        andl      $-4, -16(%rbp)                                #4836.17
-..LN4701:
-        movl      -56(%rbp), %eax                               #4839.29
-        orl       -52(%rbp), %eax                               #4839.29
-..LN4703:
-        orl       -60(%rbp), %eax                               #4839.34
-..LN4705:
-        orl       -96(%rbp), %eax                               #4839.39
-..LN4707:
-        je        ..B28.27      # Prob 50%                      #4839.47
-                                # LOE
-..B28.16:                       # Preds ..B28.15
-..LN4709:
-        movl      -16(%rbp), %eax                               #4842.37
-        negl      %eax                                          #4842.37
-        addl      -64(%rbp), %eax                               #4842.37
-        movl      %eax, -272(%rbp)                              #4842.37
-        cmpl      $2, %eax                                      #4842.37
-        je        ..B28.20      # Prob 50%                      #4842.37
-                                # LOE
-..B28.17:                       # Preds ..B28.16
-        movl      -272(%rbp), %eax                              #4842.37
-        cmpl      $1, %eax                                      #4842.37
-        je        ..B28.22      # Prob 50%                      #4842.37
-                                # LOE
-..B28.18:                       # Preds ..B28.17
-        movl      -272(%rbp), %eax                              #4842.37
-        testl     %eax, %eax                                    #4842.37
-        je        ..B28.24      # Prob 50%                      #4842.37
-                                # LOE
-..B28.19:                       # Preds ..B28.18
-..LN4711:
-        movl      $1, %eax                                      #4845.32
-        leave                                                   #4845.32
-..___tag_value_eval_4na_128.481:                                #
-        ret                                                     #4845.32
-..___tag_value_eval_4na_128.482:                                #
-                                # LOE
-..B28.20:                       # Preds ..B28.16
-..LN4713:
-        movl      -60(%rbp), %eax                               #4847.30
-..LN4715:
-        testl     %eax, %eax                                    #4847.36
-        je        ..B28.22      # Prob 50%                      #4847.36
-                                # LOE
-..B28.21:                       # Preds ..B28.20
-..LN4717:
-        movl      $1, %eax                                      #4847.47
-        leave                                                   #4847.47
-..___tag_value_eval_4na_128.484:                                #
-        ret                                                     #4847.47
-..___tag_value_eval_4na_128.485:                                #
-                                # LOE
-..B28.22:                       # Preds ..B28.20 ..B28.17
-..LN4719:
-        movl      -56(%rbp), %eax                               #4849.30
-..LN4721:
-        testl     %eax, %eax                                    #4849.36
-        je        ..B28.24      # Prob 50%                      #4849.36
-                                # LOE
-..B28.23:                       # Preds ..B28.22
-..LN4723:
-        movl      $1, %eax                                      #4849.47
-        leave                                                   #4849.47
-..___tag_value_eval_4na_128.487:                                #
-        ret                                                     #4849.47
-..___tag_value_eval_4na_128.488:                                #
-                                # LOE
-..B28.24:                       # Preds ..B28.22 ..B28.18
-..LN4725:
-        movl      -52(%rbp), %eax                               #4851.30
-..LN4727:
-        testl     %eax, %eax                                    #4851.36
-        je        ..B28.26      # Prob 50%                      #4851.36
-                                # LOE
-..B28.25:                       # Preds ..B28.24
-..LN4729:
-        movl      $1, %eax                                      #4851.47
-        leave                                                   #4851.47
-..___tag_value_eval_4na_128.490:                                #
-        ret                                                     #4851.47
-..___tag_value_eval_4na_128.491:                                #
-                                # LOE
-..B28.26:                       # Preds ..B28.24
-..LN4731:
-        xorl      %eax, %eax                                    #4853.28
-        leave                                                   #4853.28
-..___tag_value_eval_4na_128.493:                                #
-        ret                                                     #4853.28
-..___tag_value_eval_4na_128.494:                                #
-                                # LOE
-..B28.27:                       # Preds ..B28.15
-..LN4733:
-        addl      $4, -16(%rbp)                                 #4880.17
-..LN4735:
-        movl      -16(%rbp), %eax                               #4883.22
-..LN4737:
-        movl      -64(%rbp), %edx                               #4883.28
-        cmpl      %edx, %eax                                    #4883.28
-        jbe       ..B28.29      # Prob 50%                      #4883.28
-                                # LOE
-..B28.28:                       # Preds ..B28.27
-..LN4739:
-        xorl      %eax, %eax                                    #4884.28
-        leave                                                   #4884.28
-..___tag_value_eval_4na_128.496:                                #
-        ret                                                     #4884.28
-..___tag_value_eval_4na_128.497:                                #
-                                # LOE
-..B28.29:                       # Preds ..B28.27
-..LN4741:
-        movl      -48(%rbp), %eax                               #4887.25
-        decl      %eax                                          #4887.25
-        movl      %eax, -48(%rbp)                               #4887.25
-..LN4743:
-        je        ..B28.34      # Prob 50%                      #4887.39
-                                # LOE
-..B28.30:                       # Preds ..B28.29
-..LN4745:
-        movdqa    -256(%rbp), %xmm0                             #4892.43
-..LN4747:
-        psrldq    $2, %xmm0                                     #4892.26
-..LN4749:
-        movdqa    %xmm0, -256(%rbp)                             #4892.17
-..LN4751:
-        movq      -72(%rbp), %rax                               #4895.22
-..LN4753:
-        movq      -80(%rbp), %rdx                               #4895.26
-        cmpq      %rdx, %rax                                    #4895.26
-        jae       ..B28.32      # Prob 50%                      #4895.26
-                                # LOE
-..B28.31:                       # Preds ..B28.30
-..LN4755:
-        movdqa    -256(%rbp), %xmm0                             #4896.49
-..LN4757:
-        movq      -72(%rbp), %rax                               #4896.72
-        movzbl    (%rax), %eax                                  #4896.72
-        movzbl    %al, %eax                                     #4896.72
-..LN4759:
-        movslq    %eax, %rax                                    #4896.57
-        lea       expand_2na.0(%rip), %rdx                      #4896.57
-        movzwl    (%rdx,%rax,2), %eax                           #4896.57
-        movzwl    %ax, %eax                                     #4896.57
-..LN4761:
-        pinsrw    $7, %eax, %xmm0                               #4896.30
-..LN4763:
-        movdqa    %xmm0, -256(%rbp)                             #4896.21
-                                # LOE
-..B28.32:                       # Preds ..B28.31 ..B28.30
-..LN4765:
-        incq      -72(%rbp)                                     #4899.20
-        jmp       ..B28.10      # Prob 100%                     #4899.20
-                                # LOE
-..B28.34:                       # Preds ..B28.29 ..B28.10
-..LN4767:
-        movq      -88(%rbp), %rax                               #4904.18
-..LN4769:
-        movq      -80(%rbp), %rdx                               #4904.25
-        cmpq      %rdx, %rax                                    #4904.25
-        jae       ..B28.38      # Prob 50%                      #4904.25
-                                # LOE
-..B28.35:                       # Preds ..B28.34
-..LN4771:
-        movl      -16(%rbp), %eax                               #4909.18
-..LN4773:
-        movl      -64(%rbp), %edx                               #4909.24
-        cmpl      %edx, %eax                                    #4909.24
-        ja        ..B28.38      # Prob 50%                      #4909.24
-                                # LOE
-..B28.36:                       # Preds ..B28.35
-..LN4775:
-        movq      -88(%rbp), %rax                               #4914.41
-..LN4777:
-        movq      -80(%rbp), %rdx                               #4914.46
-..LN4779:
-        movq      %rax, %rdi                                    #4914.22
-        movq      %rdx, %rsi                                    #4914.22
-        call      prime_buffer_4na at PLT                          #4914.22
-                                # LOE xmm0
-..B28.42:                       # Preds ..B28.36
-        movdqa    %xmm0, -320(%rbp)                             #4914.22
-                                # LOE
-..B28.37:                       # Preds ..B28.42
-..LN4781:
-        movdqa    -320(%rbp), %xmm0                             #4914.13
-        movdqa    %xmm0, -256(%rbp)                             #4914.13
-..LN4783:
-        addq      $8, -88(%rbp)                                 #4929.13
-..LN4785:
-        movq      -88(%rbp), %rax                               #4931.17
-..LN4787:
-        movq      %rax, -72(%rbp)                               #4931.13
-        jmp       ..B28.8       # Prob 100%                     #4931.13
-                                # LOE
-..B28.38:                       # Preds ..B28.35 ..B28.34 ..B28.8
-..LN4789:
-        xorl      %eax, %eax                                    #4940.12
-        leave                                                   #4940.12
-..___tag_value_eval_4na_128.499:                                #
-        ret                                                     #4940.12
-        .align    2,0x90
-..___tag_value_eval_4na_128.500:                                #
-                                # LOE
-# mark_end;
-	.type	eval_4na_128, at function
-	.size	eval_4na_128,.-eval_4na_128
-.LNeval_4na_128:
-	.data
-# -- End  eval_4na_128
-	.text
-# -- Begin  eval_4na_pos
-# mark_begin;
-       .align    2,0x90
-eval_4na_pos:
-# parameter 1(self): %rdi
-# parameter 2(ncbi2na): %rsi
-# parameter 3(pos): %edx
-# parameter 4(len): %ecx
-..B29.1:                        # Preds ..B29.0
-..___tag_value_eval_4na_pos.503:                                #
-..LN4791:
-        pushq     %rbp                                          #4946.1
-        movq      %rsp, %rbp                                    #4946.1
-..___tag_value_eval_4na_pos.504:                                #
-        subq      $336, %rsp                                    #4946.1
-        movq      %rdi, -48(%rbp)                               #4946.1
-        movq      %rsi, -40(%rbp)                               #4946.1
-        movl      %edx, -24(%rbp)                               #4946.1
-        movl      %ecx, -16(%rbp)                               #4946.1
-..LN4793:
-        movq      -48(%rbp), %rax                               #4978.25
-        movl      4(%rax), %eax                                 #4978.25
-..LN4795:
-        movl      %eax, -32(%rbp)                               #4978.23
-..LN4797:
-        movl      -16(%rbp), %eax                               #4981.5
-        movl      -32(%rbp), %edx                               #4981.5
-        cmpl      %edx, %eax                                    #4981.5
-        jae       ..B29.3       # Prob 50%                      #4981.5
-                                # LOE
-..B29.2:                        # Preds ..B29.1
-        lea       _2__STRING.9.0(%rip), %rax                    #4981.5
-        lea       _2__STRING.1.0(%rip), %rdx                    #4981.5
-        lea       __$Uf.0(%rip), %rcx                           #4981.5
-        movq      %rax, %rdi                                    #4981.5
-        movq      %rdx, %rsi                                    #4981.5
-        movl      $4981, %edx                                   #4981.5
-        call      __assert_fail at PLT                             #4981.5
-                                # LOE
-..B29.3:                        # Preds ..B29.1
-..LN4799:
-        movl      -24(%rbp), %eax                               #4985.12
-..LN4801:
-        addl      -16(%rbp), %eax                               #4985.5
-        movl      %eax, -16(%rbp)                               #4985.5
-..LN4803:
-        movl      -24(%rbp), %eax                               #4989.13
-..LN4805:
-        movl      %eax, -80(%rbp)                               #4989.5
-..LN4807:
-        movl      -24(%rbp), %eax                               #4993.42
-..LN4809:
-        shrl      $2, %eax                                      #4993.49
-..LN4811:
-        addq      -40(%rbp), %rax                               #4993.30
-..LN4813:
-        movq      %rax, -104(%rbp)                              #4993.5
-..LN4815:
-        movl      -32(%rbp), %eax                               #4996.18
-        negl      %eax                                          #4996.18
-        addl      -16(%rbp), %eax                               #4996.18
-..LN4817:
-        movl      %eax, -76(%rbp)                               #4996.5
-..LN4819:
-        movl      -16(%rbp), %eax                               #4999.44
-..LN4821:
-        addl      $3, %eax                                      #4999.50
-..LN4823:
-        shrl      $2, %eax                                      #4999.57
-..LN4825:
-        addq      -40(%rbp), %rax                               #4999.30
-..LN4827:
-        movq      %rax, -96(%rbp)                               #4999.5
-..LN4829:
-        movq      -104(%rbp), %rax                              #5002.33
-..LN4831:
-        movq      -96(%rbp), %rdx                               #5002.38
-..LN4833:
-        movq      %rax, %rdi                                    #5002.14
-        movq      %rdx, %rsi                                    #5002.14
-        call      prime_buffer_4na at PLT                          #5002.14
-                                # LOE xmm0
-..B29.54:                       # Preds ..B29.3
-        movdqa    %xmm0, -128(%rbp)                             #5002.14
-                                # LOE
-..B29.4:                        # Preds ..B29.54
-..LN4835:
-        movdqa    -128(%rbp), %xmm0                             #5002.5
-        movdqa    %xmm0, -272(%rbp)                             #5002.5
-..LN4837:
-        addq      $8, -104(%rbp)                                #5003.5
-..LN4839:
-        movq      -104(%rbp), %rax                              #5005.9
-..LN4841:
-        movq      %rax, -88(%rbp)                               #5005.5
-..LN4843:
-        movq      -48(%rbp), %rax                               #5009.5
-        movdqa    16(%rax), %xmm0                               #5009.5
-        movdqa    %xmm0, -256(%rbp)                             #5009.5
-        movq      -48(%rbp), %rax                               #5009.5
-        movdqa    32(%rax), %xmm0                               #5009.5
-        movdqa    %xmm0, -240(%rbp)                             #5009.5
-        movq      -48(%rbp), %rax                               #5009.5
-        movdqa    48(%rax), %xmm0                               #5009.5
-        movdqa    %xmm0, -224(%rbp)                             #5009.5
-        movq      -48(%rbp), %rax                               #5009.5
-        movdqa    64(%rax), %xmm0                               #5009.5
-        movdqa    %xmm0, -208(%rbp)                             #5009.5
-        movq      -48(%rbp), %rax                               #5009.5
-        movdqa    80(%rax), %xmm0                               #5009.5
-        movdqa    %xmm0, -192(%rbp)                             #5009.5
-        movq      -48(%rbp), %rax                               #5009.5
-        movdqa    96(%rax), %xmm0                               #5009.5
-        movdqa    %xmm0, -176(%rbp)                             #5009.5
-        movq      -48(%rbp), %rax                               #5009.5
-        movdqa    112(%rax), %xmm0                              #5009.5
-        movdqa    %xmm0, -160(%rbp)                             #5009.5
-        movq      -48(%rbp), %rax                               #5009.5
-        movdqa    128(%rax), %xmm0                              #5009.5
-        movdqa    %xmm0, -144(%rbp)                             #5009.5
-..LN4845:
-        xorl      %eax, %eax                                    #5012.15
-        movl      %eax, -72(%rbp)                               #5012.15
-..LN4847:
-        movl      %eax, -68(%rbp)                               #5012.10
-..LN4849:
-        movl      %eax, -64(%rbp)                               #5012.5
-..LN4851:
-        movl      -24(%rbp), %eax                               #5014.27
-        negl      %eax                                          #5014.27
-..LN4853:
-        movl      -76(%rbp), %edx                               #5014.20
-..LN4855:
-        lea       7(%rdx,%rax), %eax                            #5014.33
-..LN4857:
-        shrl      $2, %eax                                      #5014.40
-..LN4859:
-        movl      %eax, -60(%rbp)                               #5014.5
-..LN4861:
-        movl      -24(%rbp), %eax                               #5023.14
-..LN4863:
-        andl      $3, %eax                                      #5023.20
-        movl      %eax, -56(%rbp)                               #5023.20
-        je        ..B29.12      # Prob 50%                      #5023.20
-                                # LOE
-..B29.5:                        # Preds ..B29.4
-        movl      -56(%rbp), %eax                               #5023.20
-        cmpl      $1, %eax                                      #5023.20
-        je        ..B29.13      # Prob 50%                      #5023.20
-                                # LOE
-..B29.6:                        # Preds ..B29.5
-        movl      -56(%rbp), %eax                               #5023.20
-        cmpl      $2, %eax                                      #5023.20
-        je        ..B29.14      # Prob 50%                      #5023.20
-                                # LOE
-..B29.7:                        # Preds ..B29.6
-        movl      -56(%rbp), %eax                               #5023.20
-        cmpl      $3, %eax                                      #5023.20
-        je        ..B29.15      # Prob 50%                      #5023.20
-                                # LOE
-..B29.8:                        # Preds ..B29.50 ..B29.7
-..LN4865:
-        movl      $1, %eax                                      #5028.9
-        testl     %eax, %eax                                    #5028.9
-        je        ..B29.51      # Prob 100%                     #5028.9
-                                # LOE
-..B29.9:                        # Preds ..B29.8
-..LN4867:
-        movl      $8, -60(%rbp)                                 #5030.13
-                                # LOE
-..B29.10:                       # Preds ..B29.45 ..B29.9
-..LN4869:
-        movl      $1, %eax                                      #5033.13
-        testl     %eax, %eax                                    #5033.13
-        je        ..B29.47      # Prob 100%                     #5033.13
-                                # LOE
-..B29.12:                       # Preds ..B29.4 ..B29.10
-..LN4871:
-        movdqa    -272(%rbp), %xmm0                             #5040.38
-..LN4873:
-        movdqa    -256(%rbp), %xmm1                             #5040.46
-..LN4875:
-        pand      %xmm1, %xmm0                                  #5040.22
-..LN4877:
-        movdqa    %xmm0, -320(%rbp)                             #5040.17
-..LN4879:
-        movdqa    -272(%rbp), %xmm0                             #5041.38
-..LN4881:
-        movdqa    -240(%rbp), %xmm1                             #5041.46
-..LN4883:
-        pand      %xmm1, %xmm0                                  #5041.22
-..LN4885:
-        movdqa    %xmm0, -304(%rbp)                             #5041.17
-..LN4887:
-        movdqa    -320(%rbp), %xmm0                             #5042.22
-        movdqa    -304(%rbp), %xmm1                             #5042.22
-        pcmpeqd   %xmm1, %xmm0                                  #5042.22
-..LN4889:
-        movdqa    %xmm0, -320(%rbp)                             #5042.17
-..LN4891:
-        movdqa    -320(%rbp), %xmm0                             #5043.42
-..LN4893:
-        pmovmskb  %xmm0, %eax                                   #5043.22
-..LN4895:
-        movl      %eax, -64(%rbp)                               #5043.17
-..LN4897:
-        movl      -64(%rbp), %eax                               #5044.17
-        incl      %eax                                          #5044.17
-        sarl      $16, %eax                                     #5044.17
-        negl      %eax                                          #5044.17
-        movl      %eax, -64(%rbp)                               #5044.17
-                                # LOE
-..B29.13:                       # Preds ..B29.5 ..B29.12
-..LN4899:
-        movdqa    -272(%rbp), %xmm0                             #5047.38
-..LN4901:
-        movdqa    -224(%rbp), %xmm1                             #5047.46
-..LN4903:
-        pand      %xmm1, %xmm0                                  #5047.22
-..LN4905:
-        movdqa    %xmm0, -320(%rbp)                             #5047.17
-..LN4907:
-        movdqa    -272(%rbp), %xmm0                             #5048.38
-..LN4909:
-        movdqa    -208(%rbp), %xmm1                             #5048.46
-..LN4911:
-        pand      %xmm1, %xmm0                                  #5048.22
-..LN4913:
-        movdqa    %xmm0, -304(%rbp)                             #5048.17
-..LN4915:
-        movdqa    -320(%rbp), %xmm0                             #5049.22
-        movdqa    -304(%rbp), %xmm1                             #5049.22
-        pcmpeqd   %xmm1, %xmm0                                  #5049.22
-..LN4917:
-        movdqa    %xmm0, -320(%rbp)                             #5049.17
-..LN4919:
-        movdqa    -320(%rbp), %xmm0                             #5050.42
-..LN4921:
-        pmovmskb  %xmm0, %eax                                   #5050.22
-..LN4923:
-        movl      %eax, -68(%rbp)                               #5050.17
-..LN4925:
-        movl      -68(%rbp), %eax                               #5051.17
-        incl      %eax                                          #5051.17
-        sarl      $16, %eax                                     #5051.17
-        negl      %eax                                          #5051.17
-        movl      %eax, -68(%rbp)                               #5051.17
-                                # LOE
-..B29.14:                       # Preds ..B29.6 ..B29.13
-..LN4927:
-        movdqa    -272(%rbp), %xmm0                             #5054.38
-..LN4929:
-        movdqa    -192(%rbp), %xmm1                             #5054.46
-..LN4931:
-        pand      %xmm1, %xmm0                                  #5054.22
-..LN4933:
-        movdqa    %xmm0, -320(%rbp)                             #5054.17
-..LN4935:
-        movdqa    -272(%rbp), %xmm0                             #5055.38
-..LN4937:
-        movdqa    -176(%rbp), %xmm1                             #5055.46
-..LN4939:
-        pand      %xmm1, %xmm0                                  #5055.22
-..LN4941:
-        movdqa    %xmm0, -304(%rbp)                             #5055.17
-..LN4943:
-        movdqa    -320(%rbp), %xmm0                             #5056.22
-        movdqa    -304(%rbp), %xmm1                             #5056.22
-        pcmpeqd   %xmm1, %xmm0                                  #5056.22
-..LN4945:
-        movdqa    %xmm0, -320(%rbp)                             #5056.17
-..LN4947:
-        movdqa    -320(%rbp), %xmm0                             #5057.42
-..LN4949:
-        pmovmskb  %xmm0, %eax                                   #5057.22
-..LN4951:
-        movl      %eax, -72(%rbp)                               #5057.17
-..LN4953:
-        movl      -72(%rbp), %eax                               #5058.17
-        incl      %eax                                          #5058.17
-        sarl      $16, %eax                                     #5058.17
-        negl      %eax                                          #5058.17
-        movl      %eax, -72(%rbp)                               #5058.17
-                                # LOE
-..B29.15:                       # Preds ..B29.7 ..B29.14
-..LN4955:
-        movdqa    -272(%rbp), %xmm0                             #5061.38
-..LN4957:
-        movdqa    -160(%rbp), %xmm1                             #5061.46
-..LN4959:
-        pand      %xmm1, %xmm0                                  #5061.22
-..LN4961:
-        movdqa    %xmm0, -320(%rbp)                             #5061.17
-..LN4963:
-        movdqa    -272(%rbp), %xmm0                             #5062.38
-..LN4965:
-        movdqa    -144(%rbp), %xmm1                             #5062.46
-..LN4967:
-        pand      %xmm1, %xmm0                                  #5062.22
-..LN4969:
-        movdqa    %xmm0, -304(%rbp)                             #5062.17
-..LN4971:
-        movdqa    -320(%rbp), %xmm0                             #5063.22
-        movdqa    -304(%rbp), %xmm1                             #5063.22
-        pcmpeqd   %xmm1, %xmm0                                  #5063.22
-..LN4973:
-        movdqa    %xmm0, -320(%rbp)                             #5063.17
-..LN4975:
-        movdqa    -320(%rbp), %xmm0                             #5064.42
-..LN4977:
-        pmovmskb  %xmm0, %eax                                   #5064.22
-..LN4979:
-        movl      %eax, -112(%rbp)                              #5064.17
-..LN4981:
-        movl      -112(%rbp), %eax                              #5065.17
-        incl      %eax                                          #5065.17
-        sarl      $16, %eax                                     #5065.17
-        negl      %eax                                          #5065.17
-        movl      %eax, -112(%rbp)                              #5065.17
-..LN4983:
-        andl      $-4, -24(%rbp)                                #5069.17
-..LN4985:
-        movl      -68(%rbp), %eax                               #5072.29
-        orl       -64(%rbp), %eax                               #5072.29
-..LN4987:
-        orl       -72(%rbp), %eax                               #5072.34
-..LN4989:
-        orl       -112(%rbp), %eax                              #5072.39
-..LN4991:
-        je        ..B29.40      # Prob 50%                      #5072.47
-                                # LOE
-..B29.16:                       # Preds ..B29.15
-..LN4993:
-        movl      -24(%rbp), %eax                               #5075.37
-        negl      %eax                                          #5075.37
-        addl      -76(%rbp), %eax                               #5075.37
-        movl      %eax, -288(%rbp)                              #5075.37
-        je        ..B29.19      # Prob 50%                      #5075.37
-                                # LOE
-..B29.17:                       # Preds ..B29.16
-        movl      -288(%rbp), %eax                              #5075.37
-        cmpl      $1, %eax                                      #5075.37
-        je        ..B29.21      # Prob 50%                      #5075.37
-                                # LOE
-..B29.18:                       # Preds ..B29.17
-        movl      -288(%rbp), %eax                              #5075.37
-        cmpl      $2, %eax                                      #5075.37
-        je        ..B29.25      # Prob 50%                      #5075.37
-        jmp       ..B29.31      # Prob 100%                     #5075.37
-                                # LOE
-..B29.19:                       # Preds ..B29.16
-..LN4995:
-        movl      -64(%rbp), %eax                               #5078.30
-..LN4997:
-        testl     %eax, %eax                                    #5078.36
-        je        ..B29.39      # Prob 50%                      #5078.36
-                                # LOE
-..B29.20:                       # Preds ..B29.19
-..LN4999:
-        movl      -80(%rbp), %eax                               #5078.53
-        negl      %eax                                          #5078.53
-..LN5001:
-        movl      -24(%rbp), %edx                               #5078.47
-..LN5003:
-        lea       1(%rdx,%rax), %eax                            #5078.61
-        leave                                                   #5078.61
-..___tag_value_eval_4na_pos.508:                                #
-        ret                                                     #5078.61
-..___tag_value_eval_4na_pos.509:                                #
-                                # LOE
-..B29.21:                       # Preds ..B29.17
-..LN5005:
-        movl      -64(%rbp), %eax                               #5081.30
-..LN5007:
-        testl     %eax, %eax                                    #5081.36
-        je        ..B29.23      # Prob 50%                      #5081.36
-                                # LOE
-..B29.22:                       # Preds ..B29.21
-..LN5009:
-        movl      -80(%rbp), %eax                               #5081.53
-        negl      %eax                                          #5081.53
-..LN5011:
-        movl      -24(%rbp), %edx                               #5081.47
-..LN5013:
-        lea       1(%rdx,%rax), %eax                            #5081.61
-        leave                                                   #5081.61
-..___tag_value_eval_4na_pos.511:                                #
-        ret                                                     #5081.61
-..___tag_value_eval_4na_pos.512:                                #
-                                # LOE
-..B29.23:                       # Preds ..B29.21
-..LN5015:
-        movl      -68(%rbp), %eax                               #5082.30
-..LN5017:
-        testl     %eax, %eax                                    #5082.36
-        je        ..B29.39      # Prob 50%                      #5082.36
-                                # LOE
-..B29.24:                       # Preds ..B29.23
-..LN5019:
-        movl      -80(%rbp), %eax                               #5082.53
-        negl      %eax                                          #5082.53
-..LN5021:
-        movl      -24(%rbp), %edx                               #5082.47
-..LN5023:
-        lea       2(%rdx,%rax), %eax                            #5082.61
-        leave                                                   #5082.61
-..___tag_value_eval_4na_pos.514:                                #
-        ret                                                     #5082.61
-..___tag_value_eval_4na_pos.515:                                #
-                                # LOE
-..B29.25:                       # Preds ..B29.18
-..LN5025:
-        movl      -64(%rbp), %eax                               #5085.30
-..LN5027:
-        testl     %eax, %eax                                    #5085.36
-        je        ..B29.27      # Prob 50%                      #5085.36
-                                # LOE
-..B29.26:                       # Preds ..B29.25
-..LN5029:
-        movl      -80(%rbp), %eax                               #5085.53
-        negl      %eax                                          #5085.53
-..LN5031:
-        movl      -24(%rbp), %edx                               #5085.47
-..LN5033:
-        lea       1(%rdx,%rax), %eax                            #5085.61
-        leave                                                   #5085.61
-..___tag_value_eval_4na_pos.517:                                #
-        ret                                                     #5085.61
-..___tag_value_eval_4na_pos.518:                                #
-                                # LOE
-..B29.27:                       # Preds ..B29.25
-..LN5035:
-        movl      -68(%rbp), %eax                               #5086.30
-..LN5037:
-        testl     %eax, %eax                                    #5086.36
-        je        ..B29.29      # Prob 50%                      #5086.36
-                                # LOE
-..B29.28:                       # Preds ..B29.27
-..LN5039:
-        movl      -80(%rbp), %eax                               #5086.53
-        negl      %eax                                          #5086.53
-..LN5041:
-        movl      -24(%rbp), %edx                               #5086.47
-..LN5043:
-        lea       2(%rdx,%rax), %eax                            #5086.61
-        leave                                                   #5086.61
-..___tag_value_eval_4na_pos.520:                                #
-        ret                                                     #5086.61
-..___tag_value_eval_4na_pos.521:                                #
-                                # LOE
-..B29.29:                       # Preds ..B29.27
-..LN5045:
-        movl      -72(%rbp), %eax                               #5087.30
-..LN5047:
-        testl     %eax, %eax                                    #5087.36
-        je        ..B29.39      # Prob 50%                      #5087.36
-                                # LOE
-..B29.30:                       # Preds ..B29.29
-..LN5049:
-        movl      -80(%rbp), %eax                               #5087.53
-        negl      %eax                                          #5087.53
-..LN5051:
-        movl      -24(%rbp), %edx                               #5087.47
-..LN5053:
-        lea       3(%rdx,%rax), %eax                            #5087.61
-        leave                                                   #5087.61
-..___tag_value_eval_4na_pos.523:                                #
-        ret                                                     #5087.61
-..___tag_value_eval_4na_pos.524:                                #
-                                # LOE
-..B29.31:                       # Preds ..B29.18
-..LN5055:
-        movl      -64(%rbp), %eax                               #5090.30
-..LN5057:
-        testl     %eax, %eax                                    #5090.36
-        je        ..B29.33      # Prob 50%                      #5090.36
-                                # LOE
-..B29.32:                       # Preds ..B29.31
-..LN5059:
-        movl      -80(%rbp), %eax                               #5090.53
-        negl      %eax                                          #5090.53
-..LN5061:
-        movl      -24(%rbp), %edx                               #5090.47
-..LN5063:
-        lea       1(%rdx,%rax), %eax                            #5090.61
-        leave                                                   #5090.61
-..___tag_value_eval_4na_pos.526:                                #
-        ret                                                     #5090.61
-..___tag_value_eval_4na_pos.527:                                #
-                                # LOE
-..B29.33:                       # Preds ..B29.31
-..LN5065:
-        movl      -68(%rbp), %eax                               #5091.30
-..LN5067:
-        testl     %eax, %eax                                    #5091.36
-        je        ..B29.35      # Prob 50%                      #5091.36
-                                # LOE
-..B29.34:                       # Preds ..B29.33
-..LN5069:
-        movl      -80(%rbp), %eax                               #5091.53
-        negl      %eax                                          #5091.53
-..LN5071:
-        movl      -24(%rbp), %edx                               #5091.47
-..LN5073:
-        lea       2(%rdx,%rax), %eax                            #5091.61
-        leave                                                   #5091.61
-..___tag_value_eval_4na_pos.529:                                #
-        ret                                                     #5091.61
-..___tag_value_eval_4na_pos.530:                                #
-                                # LOE
-..B29.35:                       # Preds ..B29.33
-..LN5075:
-        movl      -72(%rbp), %eax                               #5092.30
-..LN5077:
-        testl     %eax, %eax                                    #5092.36
-        je        ..B29.37      # Prob 50%                      #5092.36
-                                # LOE
-..B29.36:                       # Preds ..B29.35
-..LN5079:
-        movl      -80(%rbp), %eax                               #5092.53
-        negl      %eax                                          #5092.53
-..LN5081:
-        movl      -24(%rbp), %edx                               #5092.47
-..LN5083:
-        lea       3(%rdx,%rax), %eax                            #5092.61
-        leave                                                   #5092.61
-..___tag_value_eval_4na_pos.532:                                #
-        ret                                                     #5092.61
-..___tag_value_eval_4na_pos.533:                                #
-                                # LOE
-..B29.37:                       # Preds ..B29.35
-..LN5085:
-        movl      -112(%rbp), %eax                              #5093.30
-..LN5087:
-        testl     %eax, %eax                                    #5093.36
-        je        ..B29.39      # Prob 50%                      #5093.36
-                                # LOE
-..B29.38:                       # Preds ..B29.37
-..LN5089:
-        movl      -80(%rbp), %eax                               #5093.53
-        negl      %eax                                          #5093.53
-..LN5091:
-        movl      -24(%rbp), %edx                               #5093.47
-..LN5093:
-        lea       4(%rdx,%rax), %eax                            #5093.61
-        leave                                                   #5093.61
-..___tag_value_eval_4na_pos.535:                                #
-        ret                                                     #5093.61
-..___tag_value_eval_4na_pos.536:                                #
-                                # LOE
-..B29.39:                       # Preds ..B29.19 ..B29.23 ..B29.29 ..B29.37
-..LN5095:
-        xorl      %eax, %eax                                    #5095.28
-        leave                                                   #5095.28
-..___tag_value_eval_4na_pos.538:                                #
-        ret                                                     #5095.28
-..___tag_value_eval_4na_pos.539:                                #
-                                # LOE
-..B29.40:                       # Preds ..B29.15
-..LN5097:
-        addl      $4, -24(%rbp)                                 #5135.17
-..LN5099:
-        movl      -24(%rbp), %eax                               #5138.22
-..LN5101:
-        movl      -76(%rbp), %edx                               #5138.28
-        cmpl      %edx, %eax                                    #5138.28
-        jbe       ..B29.42      # Prob 50%                      #5138.28
-                                # LOE
-..B29.41:                       # Preds ..B29.40
-..LN5103:
-        xorl      %eax, %eax                                    #5139.28
-        leave                                                   #5139.28
-..___tag_value_eval_4na_pos.541:                                #
-        ret                                                     #5139.28
-..___tag_value_eval_4na_pos.542:                                #
-                                # LOE
-..B29.42:                       # Preds ..B29.40
-..LN5105:
-        movl      -60(%rbp), %eax                               #5142.25
-        decl      %eax                                          #5142.25
-        movl      %eax, -60(%rbp)                               #5142.25
-..LN5107:
-        je        ..B29.47      # Prob 50%                      #5142.39
-                                # LOE
-..B29.43:                       # Preds ..B29.42
-..LN5109:
-        movdqa    -272(%rbp), %xmm0                             #5147.43
-..LN5111:
-        psrldq    $2, %xmm0                                     #5147.26
-..LN5113:
-        movdqa    %xmm0, -272(%rbp)                             #5147.17
-..LN5115:
-        movq      -88(%rbp), %rax                               #5150.22
-..LN5117:
-        movq      -96(%rbp), %rdx                               #5150.26
-        cmpq      %rdx, %rax                                    #5150.26
-        jae       ..B29.45      # Prob 50%                      #5150.26
-                                # LOE
-..B29.44:                       # Preds ..B29.43
-..LN5119:
-        movdqa    -272(%rbp), %xmm0                             #5151.49
-..LN5121:
-        movq      -88(%rbp), %rax                               #5151.72
-        movzbl    (%rax), %eax                                  #5151.72
-        movzbl    %al, %eax                                     #5151.72
-..LN5123:
-        movslq    %eax, %rax                                    #5151.57
-        lea       expand_2na.0(%rip), %rdx                      #5151.57
-        movzwl    (%rdx,%rax,2), %eax                           #5151.57
-        movzwl    %ax, %eax                                     #5151.57
-..LN5125:
-        pinsrw    $7, %eax, %xmm0                               #5151.30
-..LN5127:
-        movdqa    %xmm0, -272(%rbp)                             #5151.21
-                                # LOE
-..B29.45:                       # Preds ..B29.44 ..B29.43
-..LN5129:
-        incq      -88(%rbp)                                     #5154.20
-        jmp       ..B29.10      # Prob 100%                     #5154.20
-                                # LOE
-..B29.47:                       # Preds ..B29.42 ..B29.10
-..LN5131:
-        movq      -104(%rbp), %rax                              #5159.18
-..LN5133:
-        movq      -96(%rbp), %rdx                               #5159.25
-        cmpq      %rdx, %rax                                    #5159.25
-        jae       ..B29.51      # Prob 50%                      #5159.25
-                                # LOE
-..B29.48:                       # Preds ..B29.47
-..LN5135:
-        movl      -24(%rbp), %eax                               #5164.18
-..LN5137:
-        movl      -76(%rbp), %edx                               #5164.24
-        cmpl      %edx, %eax                                    #5164.24
-        ja        ..B29.51      # Prob 50%                      #5164.24
-                                # LOE
-..B29.49:                       # Preds ..B29.48
-..LN5139:
-        movq      -104(%rbp), %rax                              #5169.41
-..LN5141:
-        movq      -96(%rbp), %rdx                               #5169.46
-..LN5143:
-        movq      %rax, %rdi                                    #5169.22
-        movq      %rdx, %rsi                                    #5169.22
-        call      prime_buffer_4na at PLT                          #5169.22
-                                # LOE xmm0
-..B29.55:                       # Preds ..B29.49
-        movdqa    %xmm0, -336(%rbp)                             #5169.22
-                                # LOE
-..B29.50:                       # Preds ..B29.55
-..LN5145:
-        movdqa    -336(%rbp), %xmm0                             #5169.13
-        movdqa    %xmm0, -272(%rbp)                             #5169.13
-..LN5147:
-        addq      $8, -104(%rbp)                                #5184.13
-..LN5149:
-        movq      -104(%rbp), %rax                              #5186.17
-..LN5151:
-        movq      %rax, -88(%rbp)                               #5186.13
-        jmp       ..B29.8       # Prob 100%                     #5186.13
-                                # LOE
-..B29.51:                       # Preds ..B29.48 ..B29.47 ..B29.8
-..LN5153:
-        xorl      %eax, %eax                                    #5196.12
-        leave                                                   #5196.12
-..___tag_value_eval_4na_pos.544:                                #
-        ret                                                     #5196.12
-        .align    2,0x90
-..___tag_value_eval_4na_pos.545:                                #
-                                # LOE
-# mark_end;
-	.type	eval_4na_pos, at function
-	.size	eval_4na_pos,.-eval_4na_pos
-.LNeval_4na_pos:
-	.data
-# -- End  eval_4na_pos
-	.text
-# -- Begin  NucStrstrSearch
-# mark_begin;
-       .align    2,0x90
-	.globl NucStrstrSearch
-NucStrstrSearch:
-# parameter 1(self): %rdi
-# parameter 2(ncbi2na): %rsi
-# parameter 3(pos): %edx
-# parameter 4(len): %ecx
-# parameter 5(selflen): %r8
-..B30.1:                        # Preds ..B30.0
-..___tag_value_NucStrstrSearch.548:                             #
-..LN5155:
-        pushq     %rbp                                          #5217.1
-        movq      %rsp, %rbp                                    #5217.1
-..___tag_value_NucStrstrSearch.549:                             #
-        subq      $192, %rsp                                    #5217.1
-        movq      %rbx, -32(%rbp)                               #5217.1
-..___tag_value_NucStrstrSearch.552:                             #
-        movq      %rdi, -56(%rbp)                               #5217.1
-        movq      %rsi, -48(%rbp)                               #5217.1
-        movl      %edx, -24(%rbp)                               #5217.1
-        movl      %ecx, -16(%rbp)                               #5217.1
-        movq      %r8, -40(%rbp)                                #5217.1
-..LN5157:
-        movq      -56(%rbp), %rax                               #5218.10
-..LN5159:
-        testq     %rax, %rax                                    #5218.18
-        je        ..B30.111     # Prob 50%                      #5218.18
-                                # LOE
-..B30.2:                        # Preds ..B30.1
-..LN5161:
-        movq      -48(%rbp), %rax                               #5218.26
-..LN5163:
-        testq     %rax, %rax                                    #5218.37
-        je        ..B30.111     # Prob 50%                      #5218.37
-                                # LOE
-..B30.3:                        # Preds ..B30.2
-..LN5165:
-        movl      -16(%rbp), %eax                               #5218.45
-..LN5167:
-        testl     %eax, %eax                                    #5218.52
-        je        ..B30.111     # Prob 50%                      #5218.52
-                                # LOE
-..B30.4:                        # Preds ..B30.3
-..LN5169:
-        movq      -56(%rbp), %rax                               #5223.18
-        movl      (%rax), %eax                                  #5223.18
-        movl      %eax, -64(%rbp)                               #5223.18
-..LN5171:
-        cmpl      $12, %eax                                     #5223.9
-        ja        ..B30.111     # Prob 50%                      #5223.9
-                                # LOE
-..B30.5:                        # Preds ..B30.4
-        movl      -64(%rbp), %eax                               #5223.9
-        movl      %eax, %eax                                    #5223.9
-        lea       ..1..TPKT.30_0.0.1(%rip), %rdx                #5223.9
-        movq      (%rdx,%rax,8), %rax                           #5223.9
-        jmp       *%rax                                         #5223.9
-                                # LOE
-..1.30_0.TAG.00.0.1:
-..B30.7:                        # Preds ..B30.5
-..LN5173:
-        movq      -56(%rbp), %rax                               #5226.24
-..LN5175:
-        movl      -16(%rbp), %edx                               #5226.18
-..LN5177:
-        movl      4(%rax), %eax                                 #5226.24
-        cmpl      %eax, %edx                                    #5226.24
-        jae       ..B30.9       # Prob 50%                      #5226.24
-                                # LOE
-..B30.8:                        # Preds ..B30.7
-..LN5179:
-        xorl      %eax, %eax                                    #5226.54
-        movq      -32(%rbp), %rbx                               #5226.54
-..___tag_value_NucStrstrSearch.553:                             #
-        leave                                                   #5226.54
-..___tag_value_NucStrstrSearch.555:                             #
-        ret                                                     #5226.54
-..___tag_value_NucStrstrSearch.556:                             #
-                                # LOE
-..B30.9:                        # Preds ..B30.7
-..LN5181:
-        movq      -40(%rbp), %rax                               #5227.9
-        testq     %rax, %rax                                    #5227.9
-        je        ..B30.11      # Prob 50%                      #5227.9
-                                # LOE
-..B30.10:                       # Preds ..B30.9
-..LN5183:
-        movq      -56(%rbp), %rax                               #5227.27
-..LN5185:
-        movq      -40(%rbp), %rdx                               #5227.18
-..LN5187:
-        movl      4(%rax), %eax                                 #5227.27
-..LN5189:
-        movl      %eax, (%rdx)                                  #5227.18
-                                # LOE
-..B30.11:                       # Preds ..B30.10 ..B30.9
-..LN5191:
-        movq      -56(%rbp), %rax                               #5228.36
-..LN5193:
-        movq      -48(%rbp), %rdx                               #5228.51
-..LN5195:
-        movl      -24(%rbp), %ecx                               #5228.60
-..LN5197:
-        movl      -16(%rbp), %ebx                               #5228.65
-..LN5199:
-        movq      %rax, %rdi                                    #5228.20
-        movq      %rdx, %rsi                                    #5228.20
-        movl      %ecx, %edx                                    #5228.20
-        movl      %ebx, %ecx                                    #5228.20
-        call      eval_2na_64 at PLT                               #5228.20
-                                # LOE eax
-..B30.114:                      # Preds ..B30.11
-        movl      %eax, -144(%rbp)                              #5228.20
-                                # LOE
-..B30.12:                       # Preds ..B30.114
-        movl      -144(%rbp), %eax                              #5228.20
-        movq      -32(%rbp), %rbx                               #5228.20
-..___tag_value_NucStrstrSearch.558:                             #
-        leave                                                   #5228.20
-..___tag_value_NucStrstrSearch.560:                             #
-        ret                                                     #5228.20
-..___tag_value_NucStrstrSearch.561:                             #
-                                # LOE
-..1.30_0.TAG.01.0.1:
-..B30.14:                       # Preds ..B30.5
-..LN5201:
-        movq      -56(%rbp), %rax                               #5230.24
-..LN5203:
-        movl      -16(%rbp), %edx                               #5230.18
-..LN5205:
-        movl      4(%rax), %eax                                 #5230.24
-        cmpl      %eax, %edx                                    #5230.24
-        jae       ..B30.16      # Prob 50%                      #5230.24
-                                # LOE
-..B30.15:                       # Preds ..B30.14
-..LN5207:
-        xorl      %eax, %eax                                    #5230.54
-        movq      -32(%rbp), %rbx                               #5230.54
-..___tag_value_NucStrstrSearch.563:                             #
-        leave                                                   #5230.54
-..___tag_value_NucStrstrSearch.565:                             #
-        ret                                                     #5230.54
-..___tag_value_NucStrstrSearch.566:                             #
-                                # LOE
-..B30.16:                       # Preds ..B30.14
-..LN5209:
-        movq      -40(%rbp), %rax                               #5231.9
-        testq     %rax, %rax                                    #5231.9
-        je        ..B30.18      # Prob 50%                      #5231.9
-                                # LOE
-..B30.17:                       # Preds ..B30.16
-..LN5211:
-        movq      -56(%rbp), %rax                               #5231.27
-..LN5213:
-        movq      -40(%rbp), %rdx                               #5231.18
-..LN5215:
-        movl      4(%rax), %eax                                 #5231.27
-..LN5217:
-        movl      %eax, (%rdx)                                  #5231.18
-                                # LOE
-..B30.18:                       # Preds ..B30.17 ..B30.16
-..LN5219:
-        movq      -56(%rbp), %rax                               #5232.36
-..LN5221:
-        movq      -48(%rbp), %rdx                               #5232.51
-..LN5223:
-        movl      -24(%rbp), %ecx                               #5232.60
-..LN5225:
-        movl      -16(%rbp), %ebx                               #5232.65
-..LN5227:
-        movq      %rax, %rdi                                    #5232.20
-        movq      %rdx, %rsi                                    #5232.20
-        movl      %ecx, %edx                                    #5232.20
-        movl      %ebx, %ecx                                    #5232.20
-        call      eval_4na_64 at PLT                               #5232.20
-                                # LOE eax
-..B30.115:                      # Preds ..B30.18
-        movl      %eax, -140(%rbp)                              #5232.20
-                                # LOE
-..B30.19:                       # Preds ..B30.115
-        movl      -140(%rbp), %eax                              #5232.20
-        movq      -32(%rbp), %rbx                               #5232.20
-..___tag_value_NucStrstrSearch.568:                             #
-        leave                                                   #5232.20
-..___tag_value_NucStrstrSearch.570:                             #
-        ret                                                     #5232.20
-..___tag_value_NucStrstrSearch.571:                             #
-                                # LOE
-..1.30_0.TAG.02.0.1:
-..B30.21:                       # Preds ..B30.5
-..LN5229:
-        movq      -56(%rbp), %rax                               #5235.24
-..LN5231:
-        movl      -16(%rbp), %edx                               #5235.18
-..LN5233:
-        movl      4(%rax), %eax                                 #5235.24
-        cmpl      %eax, %edx                                    #5235.24
-        jae       ..B30.23      # Prob 50%                      #5235.24
-                                # LOE
-..B30.22:                       # Preds ..B30.21
-..LN5235:
-        xorl      %eax, %eax                                    #5235.54
-        movq      -32(%rbp), %rbx                               #5235.54
-..___tag_value_NucStrstrSearch.573:                             #
-        leave                                                   #5235.54
-..___tag_value_NucStrstrSearch.575:                             #
-        ret                                                     #5235.54
-..___tag_value_NucStrstrSearch.576:                             #
-                                # LOE
-..B30.23:                       # Preds ..B30.21
-..LN5237:
-        movq      -40(%rbp), %rax                               #5236.9
-        testq     %rax, %rax                                    #5236.9
-        je        ..B30.25      # Prob 50%                      #5236.9
-                                # LOE
-..B30.24:                       # Preds ..B30.23
-..LN5239:
-        movq      -56(%rbp), %rax                               #5236.27
-..LN5241:
-        movq      -40(%rbp), %rdx                               #5236.18
-..LN5243:
-        movl      4(%rax), %eax                                 #5236.27
-..LN5245:
-        movl      %eax, (%rdx)                                  #5236.18
-                                # LOE
-..B30.25:                       # Preds ..B30.24 ..B30.23
-..LN5247:
-        movq      -56(%rbp), %rax                               #5237.35
-..LN5249:
-        movq      -48(%rbp), %rdx                               #5237.50
-..LN5251:
-        movl      -24(%rbp), %ecx                               #5237.59
-..LN5253:
-        movl      -16(%rbp), %ebx                               #5237.64
-..LN5255:
-        movq      %rax, %rdi                                    #5237.20
-        movq      %rdx, %rsi                                    #5237.20
-        movl      %ecx, %edx                                    #5237.20
-        movl      %ebx, %ecx                                    #5237.20
-        call      eval_2na_8 at PLT                                #5237.20
-                                # LOE eax
-..B30.116:                      # Preds ..B30.25
-        movl      %eax, -136(%rbp)                              #5237.20
-                                # LOE
-..B30.26:                       # Preds ..B30.116
-        movl      -136(%rbp), %eax                              #5237.20
-        movq      -32(%rbp), %rbx                               #5237.20
-..___tag_value_NucStrstrSearch.578:                             #
-        leave                                                   #5237.20
-..___tag_value_NucStrstrSearch.580:                             #
-        ret                                                     #5237.20
-..___tag_value_NucStrstrSearch.581:                             #
-                                # LOE
-..1.30_0.TAG.03.0.1:
-..B30.28:                       # Preds ..B30.5
-..LN5257:
-        movq      -56(%rbp), %rax                               #5239.24
-..LN5259:
-        movl      -16(%rbp), %edx                               #5239.18
-..LN5261:
-        movl      4(%rax), %eax                                 #5239.24
-        cmpl      %eax, %edx                                    #5239.24
-        jae       ..B30.30      # Prob 50%                      #5239.24
-                                # LOE
-..B30.29:                       # Preds ..B30.28
-..LN5263:
-        xorl      %eax, %eax                                    #5239.54
-        movq      -32(%rbp), %rbx                               #5239.54
-..___tag_value_NucStrstrSearch.583:                             #
-        leave                                                   #5239.54
-..___tag_value_NucStrstrSearch.585:                             #
-        ret                                                     #5239.54
-..___tag_value_NucStrstrSearch.586:                             #
-                                # LOE
-..B30.30:                       # Preds ..B30.28
-..LN5265:
-        movq      -40(%rbp), %rax                               #5240.9
-        testq     %rax, %rax                                    #5240.9
-        je        ..B30.32      # Prob 50%                      #5240.9
-                                # LOE
-..B30.31:                       # Preds ..B30.30
-..LN5267:
-        movq      -56(%rbp), %rax                               #5240.27
-..LN5269:
-        movq      -40(%rbp), %rdx                               #5240.18
-..LN5271:
-        movl      4(%rax), %eax                                 #5240.27
-..LN5273:
-        movl      %eax, (%rdx)                                  #5240.18
-                                # LOE
-..B30.32:                       # Preds ..B30.31 ..B30.30
-..LN5275:
-        movq      -56(%rbp), %rax                               #5241.36
-..LN5277:
-        movq      -48(%rbp), %rdx                               #5241.51
-..LN5279:
-        movl      -24(%rbp), %ecx                               #5241.60
-..LN5281:
-        movl      -16(%rbp), %ebx                               #5241.65
-..LN5283:
-        movq      %rax, %rdi                                    #5241.20
-        movq      %rdx, %rsi                                    #5241.20
-        movl      %ecx, %edx                                    #5241.20
-        movl      %ebx, %ecx                                    #5241.20
-        call      eval_2na_16 at PLT                               #5241.20
-                                # LOE eax
-..B30.117:                      # Preds ..B30.32
-        movl      %eax, -132(%rbp)                              #5241.20
-                                # LOE
-..B30.33:                       # Preds ..B30.117
-        movl      -132(%rbp), %eax                              #5241.20
-        movq      -32(%rbp), %rbx                               #5241.20
-..___tag_value_NucStrstrSearch.588:                             #
-        leave                                                   #5241.20
-..___tag_value_NucStrstrSearch.590:                             #
-        ret                                                     #5241.20
-..___tag_value_NucStrstrSearch.591:                             #
-                                # LOE
-..1.30_0.TAG.04.0.1:
-..B30.35:                       # Preds ..B30.5
-..LN5285:
-        movq      -56(%rbp), %rax                               #5243.24
-..LN5287:
-        movl      -16(%rbp), %edx                               #5243.18
-..LN5289:
-        movl      4(%rax), %eax                                 #5243.24
-        cmpl      %eax, %edx                                    #5243.24
-        jae       ..B30.37      # Prob 50%                      #5243.24
-                                # LOE
-..B30.36:                       # Preds ..B30.35
-..LN5291:
-        xorl      %eax, %eax                                    #5243.54
-        movq      -32(%rbp), %rbx                               #5243.54
-..___tag_value_NucStrstrSearch.593:                             #
-        leave                                                   #5243.54
-..___tag_value_NucStrstrSearch.595:                             #
-        ret                                                     #5243.54
-..___tag_value_NucStrstrSearch.596:                             #
-                                # LOE
-..B30.37:                       # Preds ..B30.35
-..LN5293:
-        movq      -40(%rbp), %rax                               #5244.9
-        testq     %rax, %rax                                    #5244.9
-        je        ..B30.39      # Prob 50%                      #5244.9
-                                # LOE
-..B30.38:                       # Preds ..B30.37
-..LN5295:
-        movq      -56(%rbp), %rax                               #5244.27
-..LN5297:
-        movq      -40(%rbp), %rdx                               #5244.18
-..LN5299:
-        movl      4(%rax), %eax                                 #5244.27
-..LN5301:
-        movl      %eax, (%rdx)                                  #5244.18
-                                # LOE
-..B30.39:                       # Preds ..B30.38 ..B30.37
-..LN5303:
-        movq      -56(%rbp), %rax                               #5245.36
-..LN5305:
-        movq      -48(%rbp), %rdx                               #5245.51
-..LN5307:
-        movl      -24(%rbp), %ecx                               #5245.60
-..LN5309:
-        movl      -16(%rbp), %ebx                               #5245.65
-..LN5311:
-        movq      %rax, %rdi                                    #5245.20
-        movq      %rdx, %rsi                                    #5245.20
-        movl      %ecx, %edx                                    #5245.20
-        movl      %ebx, %ecx                                    #5245.20
-        call      eval_2na_32 at PLT                               #5245.20
-                                # LOE eax
-..B30.118:                      # Preds ..B30.39
-        movl      %eax, -128(%rbp)                              #5245.20
-                                # LOE
-..B30.40:                       # Preds ..B30.118
-        movl      -128(%rbp), %eax                              #5245.20
-        movq      -32(%rbp), %rbx                               #5245.20
-..___tag_value_NucStrstrSearch.598:                             #
-        leave                                                   #5245.20
-..___tag_value_NucStrstrSearch.600:                             #
-        ret                                                     #5245.20
-..___tag_value_NucStrstrSearch.601:                             #
-                                # LOE
-..1.30_0.TAG.05.0.1:
-..B30.42:                       # Preds ..B30.5
-..LN5313:
-        movq      -56(%rbp), %rax                               #5247.24
-..LN5315:
-        movl      -16(%rbp), %edx                               #5247.18
-..LN5317:
-        movl      4(%rax), %eax                                 #5247.24
-        cmpl      %eax, %edx                                    #5247.24
-        jae       ..B30.44      # Prob 50%                      #5247.24
-                                # LOE
-..B30.43:                       # Preds ..B30.42
-..LN5319:
-        xorl      %eax, %eax                                    #5247.54
-        movq      -32(%rbp), %rbx                               #5247.54
-..___tag_value_NucStrstrSearch.603:                             #
-        leave                                                   #5247.54
-..___tag_value_NucStrstrSearch.605:                             #
-        ret                                                     #5247.54
-..___tag_value_NucStrstrSearch.606:                             #
-                                # LOE
-..B30.44:                       # Preds ..B30.42
-..LN5321:
-        movq      -40(%rbp), %rax                               #5248.9
-        testq     %rax, %rax                                    #5248.9
-        je        ..B30.46      # Prob 50%                      #5248.9
-                                # LOE
-..B30.45:                       # Preds ..B30.44
-..LN5323:
-        movq      -56(%rbp), %rax                               #5248.27
-..LN5325:
-        movq      -40(%rbp), %rdx                               #5248.18
-..LN5327:
-        movl      4(%rax), %eax                                 #5248.27
-..LN5329:
-        movl      %eax, (%rdx)                                  #5248.18
-                                # LOE
-..B30.46:                       # Preds ..B30.45 ..B30.44
-..LN5331:
-        movq      -56(%rbp), %rax                               #5249.37
-..LN5333:
-        movq      -48(%rbp), %rdx                               #5249.52
-..LN5335:
-        movl      -24(%rbp), %ecx                               #5249.61
-..LN5337:
-        movl      -16(%rbp), %ebx                               #5249.66
-..LN5339:
-        movq      %rax, %rdi                                    #5249.20
-        movq      %rdx, %rsi                                    #5249.20
-        movl      %ecx, %edx                                    #5249.20
-        movl      %ebx, %ecx                                    #5249.20
-        call      eval_2na_128 at PLT                              #5249.20
-                                # LOE eax
-..B30.119:                      # Preds ..B30.46
-        movl      %eax, -124(%rbp)                              #5249.20
-                                # LOE
-..B30.47:                       # Preds ..B30.119
-        movl      -124(%rbp), %eax                              #5249.20
-        movq      -32(%rbp), %rbx                               #5249.20
-..___tag_value_NucStrstrSearch.608:                             #
-        leave                                                   #5249.20
-..___tag_value_NucStrstrSearch.610:                             #
-        ret                                                     #5249.20
-..___tag_value_NucStrstrSearch.611:                             #
-                                # LOE
-..1.30_0.TAG.06.0.1:
-..B30.49:                       # Preds ..B30.5
-..LN5341:
-        movq      -56(%rbp), %rax                               #5251.24
-..LN5343:
-        movl      -16(%rbp), %edx                               #5251.18
-..LN5345:
-        movl      4(%rax), %eax                                 #5251.24
-        cmpl      %eax, %edx                                    #5251.24
-        jae       ..B30.51      # Prob 50%                      #5251.24
-                                # LOE
-..B30.50:                       # Preds ..B30.49
-..LN5347:
-        xorl      %eax, %eax                                    #5251.54
-        movq      -32(%rbp), %rbx                               #5251.54
-..___tag_value_NucStrstrSearch.613:                             #
-        leave                                                   #5251.54
-..___tag_value_NucStrstrSearch.615:                             #
-        ret                                                     #5251.54
-..___tag_value_NucStrstrSearch.616:                             #
-                                # LOE
-..B30.51:                       # Preds ..B30.49
-..LN5349:
-        movq      -40(%rbp), %rax                               #5252.9
-        testq     %rax, %rax                                    #5252.9
-        je        ..B30.53      # Prob 50%                      #5252.9
-                                # LOE
-..B30.52:                       # Preds ..B30.51
-..LN5351:
-        movq      -56(%rbp), %rax                               #5252.27
-..LN5353:
-        movq      -40(%rbp), %rdx                               #5252.18
-..LN5355:
-        movl      4(%rax), %eax                                 #5252.27
-..LN5357:
-        movl      %eax, (%rdx)                                  #5252.18
-                                # LOE
-..B30.53:                       # Preds ..B30.52 ..B30.51
-..LN5359:
-        movq      -56(%rbp), %rax                               #5253.36
-..LN5361:
-        movq      -48(%rbp), %rdx                               #5253.51
-..LN5363:
-        movl      -24(%rbp), %ecx                               #5253.60
-..LN5365:
-        movl      -16(%rbp), %ebx                               #5253.65
-..LN5367:
-        movq      %rax, %rdi                                    #5253.20
-        movq      %rdx, %rsi                                    #5253.20
-        movl      %ecx, %edx                                    #5253.20
-        movl      %ebx, %ecx                                    #5253.20
-        call      eval_4na_16 at PLT                               #5253.20
-                                # LOE eax
-..B30.120:                      # Preds ..B30.53
-        movl      %eax, -120(%rbp)                              #5253.20
-                                # LOE
-..B30.54:                       # Preds ..B30.120
-        movl      -120(%rbp), %eax                              #5253.20
-        movq      -32(%rbp), %rbx                               #5253.20
-..___tag_value_NucStrstrSearch.618:                             #
-        leave                                                   #5253.20
-..___tag_value_NucStrstrSearch.620:                             #
-        ret                                                     #5253.20
-..___tag_value_NucStrstrSearch.621:                             #
-                                # LOE
-..1.30_0.TAG.07.0.1:
-..B30.56:                       # Preds ..B30.5
-..LN5369:
-        movq      -56(%rbp), %rax                               #5255.24
-..LN5371:
-        movl      -16(%rbp), %edx                               #5255.18
-..LN5373:
-        movl      4(%rax), %eax                                 #5255.24
-        cmpl      %eax, %edx                                    #5255.24
-        jae       ..B30.58      # Prob 50%                      #5255.24
-                                # LOE
-..B30.57:                       # Preds ..B30.56
-..LN5375:
-        xorl      %eax, %eax                                    #5255.54
-        movq      -32(%rbp), %rbx                               #5255.54
-..___tag_value_NucStrstrSearch.623:                             #
-        leave                                                   #5255.54
-..___tag_value_NucStrstrSearch.625:                             #
-        ret                                                     #5255.54
-..___tag_value_NucStrstrSearch.626:                             #
-                                # LOE
-..B30.58:                       # Preds ..B30.56
-..LN5377:
-        movq      -40(%rbp), %rax                               #5256.9
-        testq     %rax, %rax                                    #5256.9
-        je        ..B30.60      # Prob 50%                      #5256.9
-                                # LOE
-..B30.59:                       # Preds ..B30.58
-..LN5379:
-        movq      -56(%rbp), %rax                               #5256.27
-..LN5381:
-        movq      -40(%rbp), %rdx                               #5256.18
-..LN5383:
-        movl      4(%rax), %eax                                 #5256.27
-..LN5385:
-        movl      %eax, (%rdx)                                  #5256.18
-                                # LOE
-..B30.60:                       # Preds ..B30.59 ..B30.58
-..LN5387:
-        movq      -56(%rbp), %rax                               #5257.36
-..LN5389:
-        movq      -48(%rbp), %rdx                               #5257.51
-..LN5391:
-        movl      -24(%rbp), %ecx                               #5257.60
-..LN5393:
-        movl      -16(%rbp), %ebx                               #5257.65
-..LN5395:
-        movq      %rax, %rdi                                    #5257.20
-        movq      %rdx, %rsi                                    #5257.20
-        movl      %ecx, %edx                                    #5257.20
-        movl      %ebx, %ecx                                    #5257.20
-        call      eval_4na_32 at PLT                               #5257.20
-                                # LOE eax
-..B30.121:                      # Preds ..B30.60
-        movl      %eax, -116(%rbp)                              #5257.20
-                                # LOE
-..B30.61:                       # Preds ..B30.121
-        movl      -116(%rbp), %eax                              #5257.20
-        movq      -32(%rbp), %rbx                               #5257.20
-..___tag_value_NucStrstrSearch.628:                             #
-        leave                                                   #5257.20
-..___tag_value_NucStrstrSearch.630:                             #
-        ret                                                     #5257.20
-..___tag_value_NucStrstrSearch.631:                             #
-                                # LOE
-..1.30_0.TAG.08.0.1:
-..B30.63:                       # Preds ..B30.5
-..LN5397:
-        movq      -56(%rbp), %rax                               #5259.24
-..LN5399:
-        movl      -16(%rbp), %edx                               #5259.18
-..LN5401:
-        movl      4(%rax), %eax                                 #5259.24
-        cmpl      %eax, %edx                                    #5259.24
-        jae       ..B30.65      # Prob 50%                      #5259.24
-                                # LOE
-..B30.64:                       # Preds ..B30.63
-..LN5403:
-        xorl      %eax, %eax                                    #5259.54
-        movq      -32(%rbp), %rbx                               #5259.54
-..___tag_value_NucStrstrSearch.633:                             #
-        leave                                                   #5259.54
-..___tag_value_NucStrstrSearch.635:                             #
-        ret                                                     #5259.54
-..___tag_value_NucStrstrSearch.636:                             #
-                                # LOE
-..B30.65:                       # Preds ..B30.63
-..LN5405:
-        movq      -40(%rbp), %rax                               #5260.9
-        testq     %rax, %rax                                    #5260.9
-        je        ..B30.67      # Prob 50%                      #5260.9
-                                # LOE
-..B30.66:                       # Preds ..B30.65
-..LN5407:
-        movq      -56(%rbp), %rax                               #5260.27
-..LN5409:
-        movq      -40(%rbp), %rdx                               #5260.18
-..LN5411:
-        movl      4(%rax), %eax                                 #5260.27
-..LN5413:
-        movl      %eax, (%rdx)                                  #5260.18
-                                # LOE
-..B30.67:                       # Preds ..B30.66 ..B30.65
-..LN5415:
-        movq      -56(%rbp), %rax                               #5261.37
-..LN5417:
-        movq      -48(%rbp), %rdx                               #5261.52
-..LN5419:
-        movl      -24(%rbp), %ecx                               #5261.61
-..LN5421:
-        movl      -16(%rbp), %ebx                               #5261.66
-..LN5423:
-        movq      %rax, %rdi                                    #5261.20
-        movq      %rdx, %rsi                                    #5261.20
-        movl      %ecx, %edx                                    #5261.20
-        movl      %ebx, %ecx                                    #5261.20
-        call      eval_4na_128 at PLT                              #5261.20
-                                # LOE eax
-..B30.122:                      # Preds ..B30.67
-        movl      %eax, -112(%rbp)                              #5261.20
-                                # LOE
-..B30.68:                       # Preds ..B30.122
-        movl      -112(%rbp), %eax                              #5261.20
-        movq      -32(%rbp), %rbx                               #5261.20
-..___tag_value_NucStrstrSearch.638:                             #
-        leave                                                   #5261.20
-..___tag_value_NucStrstrSearch.640:                             #
-        ret                                                     #5261.20
-..___tag_value_NucStrstrSearch.641:                             #
-                                # LOE
-..1.30_0.TAG.09.0.1:
-..B30.70:                       # Preds ..B30.5
-..LN5425:
-        movq      -56(%rbp), %rax                               #5264.24
-..LN5427:
-        movl      -16(%rbp), %edx                               #5264.18
-..LN5429:
-        movl      4(%rax), %eax                                 #5264.24
-        cmpl      %eax, %edx                                    #5264.24
-        jae       ..B30.72      # Prob 50%                      #5264.24
-                                # LOE
-..B30.71:                       # Preds ..B30.70
-..LN5431:
-        xorl      %eax, %eax                                    #5264.54
-        movq      -32(%rbp), %rbx                               #5264.54
-..___tag_value_NucStrstrSearch.643:                             #
-        leave                                                   #5264.54
-..___tag_value_NucStrstrSearch.645:                             #
-        ret                                                     #5264.54
-..___tag_value_NucStrstrSearch.646:                             #
-                                # LOE
-..B30.72:                       # Preds ..B30.70
-..LN5433:
-        movq      -40(%rbp), %rax                               #5265.9
-        testq     %rax, %rax                                    #5265.9
-        je        ..B30.74      # Prob 50%                      #5265.9
-                                # LOE
-..B30.73:                       # Preds ..B30.72
-..LN5435:
-        movq      -56(%rbp), %rax                               #5265.27
-..LN5437:
-        movq      -40(%rbp), %rdx                               #5265.18
-..LN5439:
-        movl      4(%rax), %eax                                 #5265.27
-..LN5441:
-        movl      %eax, (%rdx)                                  #5265.18
-                                # LOE
-..B30.74:                       # Preds ..B30.73 ..B30.72
-..LN5443:
-        movq      -56(%rbp), %rax                               #5266.37
-..LN5445:
-        movq      -48(%rbp), %rdx                               #5266.52
-..LN5447:
-        movl      -24(%rbp), %ecx                               #5266.61
-..LN5449:
-        movl      -16(%rbp), %ebx                               #5266.66
-..LN5451:
-        movq      %rax, %rdi                                    #5266.20
-        movq      %rdx, %rsi                                    #5266.20
-        movl      %ecx, %edx                                    #5266.20
-        movl      %ebx, %ecx                                    #5266.20
-        call      eval_2na_pos at PLT                              #5266.20
-                                # LOE eax
-..B30.123:                      # Preds ..B30.74
-        movl      %eax, -108(%rbp)                              #5266.20
-                                # LOE
-..B30.75:                       # Preds ..B30.123
-        movl      -108(%rbp), %eax                              #5266.20
-        movq      -32(%rbp), %rbx                               #5266.20
-..___tag_value_NucStrstrSearch.648:                             #
-        leave                                                   #5266.20
-..___tag_value_NucStrstrSearch.650:                             #
-        ret                                                     #5266.20
-..___tag_value_NucStrstrSearch.651:                             #
-                                # LOE
-..1.30_0.TAG.0a.0.1:
-..B30.77:                       # Preds ..B30.5
-..LN5453:
-        movq      -56(%rbp), %rax                               #5268.24
-..LN5455:
-        movl      -16(%rbp), %edx                               #5268.18
-..LN5457:
-        movl      4(%rax), %eax                                 #5268.24
-        cmpl      %eax, %edx                                    #5268.24
-        jae       ..B30.79      # Prob 50%                      #5268.24
-                                # LOE
-..B30.78:                       # Preds ..B30.77
-..LN5459:
-        xorl      %eax, %eax                                    #5268.54
-        movq      -32(%rbp), %rbx                               #5268.54
-..___tag_value_NucStrstrSearch.653:                             #
-        leave                                                   #5268.54
-..___tag_value_NucStrstrSearch.655:                             #
-        ret                                                     #5268.54
-..___tag_value_NucStrstrSearch.656:                             #
-                                # LOE
-..B30.79:                       # Preds ..B30.77
-..LN5461:
-        movq      -40(%rbp), %rax                               #5269.9
-        testq     %rax, %rax                                    #5269.9
-        je        ..B30.81      # Prob 50%                      #5269.9
-                                # LOE
-..B30.80:                       # Preds ..B30.79
-..LN5463:
-        movq      -56(%rbp), %rax                               #5269.27
-..LN5465:
-        movq      -40(%rbp), %rdx                               #5269.18
-..LN5467:
-        movl      4(%rax), %eax                                 #5269.27
-..LN5469:
-        movl      %eax, (%rdx)                                  #5269.18
-                                # LOE
-..B30.81:                       # Preds ..B30.80 ..B30.79
-..LN5471:
-        movq      -56(%rbp), %rax                               #5270.37
-..LN5473:
-        movq      -48(%rbp), %rdx                               #5270.52
-..LN5475:
-        movl      -24(%rbp), %ecx                               #5270.61
-..LN5477:
-        movl      -16(%rbp), %ebx                               #5270.66
-..LN5479:
-        movq      %rax, %rdi                                    #5270.20
-        movq      %rdx, %rsi                                    #5270.20
-        movl      %ecx, %edx                                    #5270.20
-        movl      %ebx, %ecx                                    #5270.20
-        call      eval_4na_pos at PLT                              #5270.20
-                                # LOE eax
-..B30.124:                      # Preds ..B30.81
-        movl      %eax, -104(%rbp)                              #5270.20
-                                # LOE
-..B30.82:                       # Preds ..B30.124
-        movl      -104(%rbp), %eax                              #5270.20
-        movq      -32(%rbp), %rbx                               #5270.20
-..___tag_value_NucStrstrSearch.658:                             #
-        leave                                                   #5270.20
-..___tag_value_NucStrstrSearch.660:                             #
-        ret                                                     #5270.20
-..___tag_value_NucStrstrSearch.661:                             #
-                                # LOE
-..1.30_0.TAG.0b.0.1:
-..B30.84:                       # Preds ..B30.5
-..LN5481:
-        movq      -56(%rbp), %rax                               #5272.39
-        movq      8(%rax), %rax                                 #5272.39
-..LN5483:
-        movq      -48(%rbp), %rdx                               #5272.63
-..LN5485:
-        movl      -24(%rbp), %ecx                               #5272.72
-..LN5487:
-        movl      -16(%rbp), %ebx                               #5272.77
-..LN5489:
-        movq      -40(%rbp), %rsi                               #5272.82
-..LN5491:
-        movq      %rax, %rdi                                    #5272.21
-        movq      %rsi, -96(%rbp)                               #5272.21
-        movq      %rdx, %rsi                                    #5272.21
-        movl      %ecx, %edx                                    #5272.21
-        movl      %ebx, %ecx                                    #5272.21
-        movq      -96(%rbp), %rax                               #5272.21
-        movq      %rax, %r8                                     #5272.21
-        call      NucStrstrSearch at PLT                           #5272.21
-                                # LOE eax
-..B30.125:                      # Preds ..B30.84
-        movl      %eax, -76(%rbp)                               #5272.21
-                                # LOE
-..B30.85:                       # Preds ..B30.125
-..LN5493:
-        movl      -76(%rbp), %eax                               #5272.13
-        movl      %eax, -80(%rbp)                               #5272.13
-..LN5495:
-        movq      -56(%rbp), %rax                               #5273.22
-        movl      4(%rax), %eax                                 #5273.22
-        movl      %eax, -72(%rbp)                               #5273.22
-        cmpl      $17, %eax                                     #5273.22
-        je        ..B30.87      # Prob 50%                      #5273.22
-                                # LOE
-..B30.86:                       # Preds ..B30.85
-        movl      -72(%rbp), %eax                               #5273.22
-        cmpl      $16, %eax                                     #5273.22
-        je        ..B30.89      # Prob 50%                      #5273.22
-        jmp       ..B30.91      # Prob 100%                     #5273.22
-                                # LOE
-..B30.87:                       # Preds ..B30.85
-..LN5497:
-        movl      -80(%rbp), %eax                               #5276.22
-..LN5499:
-        testl     %eax, %eax                                    #5276.31
-        je        ..B30.91      # Prob 50%                      #5276.31
-                                # LOE
-..B30.88:                       # Preds ..B30.87
-..LN5501:
-        movl      -80(%rbp), %eax                               #5277.28
-        movq      -32(%rbp), %rbx                               #5277.28
-..___tag_value_NucStrstrSearch.663:                             #
-        leave                                                   #5277.28
-..___tag_value_NucStrstrSearch.665:                             #
-        ret                                                     #5277.28
-..___tag_value_NucStrstrSearch.666:                             #
-                                # LOE
-..B30.89:                       # Preds ..B30.86
-..LN5503:
-        movl      -80(%rbp), %eax                               #5280.22
-..LN5505:
-        testl     %eax, %eax                                    #5280.31
-        jne       ..B30.91      # Prob 50%                      #5280.31
-                                # LOE
-..B30.90:                       # Preds ..B30.89
-..LN5507:
-        movl      -80(%rbp), %eax                               #5281.28
-        movq      -32(%rbp), %rbx                               #5281.28
-..___tag_value_NucStrstrSearch.668:                             #
-        leave                                                   #5281.28
-..___tag_value_NucStrstrSearch.670:                             #
-        ret                                                     #5281.28
-..___tag_value_NucStrstrSearch.671:                             #
-                                # LOE
-..B30.91:                       # Preds ..B30.87 ..B30.89 ..B30.86
-..LN5509:
-        movq      -56(%rbp), %rax                               #5284.38
-        movq      16(%rax), %rax                                #5284.38
-..LN5511:
-        movq      -48(%rbp), %rdx                               #5284.63
-..LN5513:
-        movl      -24(%rbp), %ecx                               #5284.72
-..LN5515:
-        movl      -16(%rbp), %ebx                               #5284.77
-..LN5517:
-        movq      -40(%rbp), %rsi                               #5284.82
-..LN5519:
-        movq      %rax, %rdi                                    #5284.20
-        movq      %rsi, -160(%rbp)                              #5284.20
-        movq      %rdx, %rsi                                    #5284.20
-        movl      %ecx, %edx                                    #5284.20
-        movl      %ebx, %ecx                                    #5284.20
-        movq      -160(%rbp), %rax                              #5284.20
-        movq      %rax, %r8                                     #5284.20
-        call      NucStrstrSearch at PLT                           #5284.20
-                                # LOE eax
-..B30.126:                      # Preds ..B30.91
-        movl      %eax, -88(%rbp)                               #5284.20
-                                # LOE
-..B30.92:                       # Preds ..B30.126
-        movl      -88(%rbp), %eax                               #5284.20
-        movq      -32(%rbp), %rbx                               #5284.20
-..___tag_value_NucStrstrSearch.673:                             #
-        leave                                                   #5284.20
-..___tag_value_NucStrstrSearch.675:                             #
-        ret                                                     #5284.20
-..___tag_value_NucStrstrSearch.676:                             #
-                                # LOE
-..1.30_0.TAG.0c.0.1:
-..B30.94:                       # Preds ..B30.5
-..LN5521:
-        movq      -56(%rbp), %rax                               #5286.22
-        movl      4(%rax), %eax                                 #5286.22
-        movl      %eax, -68(%rbp)                               #5286.22
-        testl     %eax, %eax                                    #5286.22
-        je        ..B30.98      # Prob 50%                      #5286.22
-                                # LOE
-..B30.95:                       # Preds ..B30.94
-        movl      -68(%rbp), %eax                               #5286.22
-        cmpl      $13, %eax                                     #5286.22
-        je        ..B30.98      # Prob 50%                      #5286.22
-                                # LOE
-..B30.96:                       # Preds ..B30.95
-        movl      -68(%rbp), %eax                               #5286.22
-        cmpl      $14, %eax                                     #5286.22
-        je        ..B30.103     # Prob 50%                      #5286.22
-                                # LOE
-..B30.97:                       # Preds ..B30.96
-        movl      -68(%rbp), %eax                               #5286.22
-        cmpl      $15, %eax                                     #5286.22
-        je        ..B30.107     # Prob 50%                      #5286.22
-        jmp       ..B30.111     # Prob 100%                     #5286.22
-                                # LOE
-..B30.98:                       # Preds ..B30.94 ..B30.95
-..LN5523:
-        movq      -56(%rbp), %rax                               #5290.43
-        movq      8(%rax), %rax                                 #5290.43
-..LN5525:
-        movq      -48(%rbp), %rdx                               #5290.63
-..LN5527:
-        movl      -24(%rbp), %ecx                               #5290.72
-..LN5529:
-        movl      -16(%rbp), %ebx                               #5290.77
-..LN5531:
-        movq      -40(%rbp), %rsi                               #5290.82
-..LN5533:
-        movq      %rax, %rdi                                    #5290.25
-        movq      %rsi, -152(%rbp)                              #5290.25
-        movq      %rdx, %rsi                                    #5290.25
-        movl      %ecx, %edx                                    #5290.25
-        movl      %ebx, %ecx                                    #5290.25
-        movq      -152(%rbp), %rax                              #5290.25
-        movq      %rax, %r8                                     #5290.25
-        call      NucStrstrSearch at PLT                           #5290.25
-                                # LOE eax
-..B30.127:                      # Preds ..B30.98
-        movl      %eax, -84(%rbp)                               #5290.25
-                                # LOE
-..B30.99:                       # Preds ..B30.127
-..LN5535:
-        movl      -84(%rbp), %eax                               #5290.17
-        movl      %eax, -80(%rbp)                               #5290.17
-..LN5537:
-        movq      -56(%rbp), %rax                               #5291.22
-        movl      4(%rax), %eax                                 #5291.22
-..LN5539:
-        testl     %eax, %eax                                    #5291.42
-        jne       ..B30.101     # Prob 50%                      #5291.42
-                                # LOE
-..B30.100:                      # Preds ..B30.99
-..LN5541:
-        movl      -80(%rbp), %eax                               #5292.28
-        movq      -32(%rbp), %rbx                               #5292.28
-..___tag_value_NucStrstrSearch.678:                             #
-        leave                                                   #5292.28
-..___tag_value_NucStrstrSearch.680:                             #
-        ret                                                     #5292.28
-..___tag_value_NucStrstrSearch.681:                             #
-                                # LOE
-..B30.101:                      # Preds ..B30.99
-..LN5543:
-        movl      -80(%rbp), %eax                               #5293.22
-..LN5545:
-        testl     %eax, %eax                                    #5293.31
-        jne       ..B30.111     # Prob 50%                      #5293.31
-                                # LOE
-..B30.102:                      # Preds ..B30.101
-..LN5547:
-        movl      $1, %eax                                      #5294.28
-        movq      -32(%rbp), %rbx                               #5294.28
-..___tag_value_NucStrstrSearch.683:                             #
-        leave                                                   #5294.28
-..___tag_value_NucStrstrSearch.685:                             #
-        ret                                                     #5294.28
-..___tag_value_NucStrstrSearch.686:                             #
-                                # LOE
-..B30.103:                      # Preds ..B30.96
-..LN5549:
-        movq      -56(%rbp), %rax                               #5297.29
-        movq      8(%rax), %rax                                 #5297.29
-        movl      4(%rax), %eax                                 #5297.29
-..LN5551:
-        movl      %eax, -164(%rbp)                              #5297.17
-..LN5553:
-        movl      -164(%rbp), %eax                              #5298.22
-..LN5555:
-        movl      -16(%rbp), %edx                               #5298.34
-        cmpl      %edx, %eax                                    #5298.34
-        jbe       ..B30.105     # Prob 50%                      #5298.34
-                                # LOE
-..B30.104:                      # Preds ..B30.103
-..LN5557:
-        xorl      %eax, %eax                                    #5299.28
-        movq      -32(%rbp), %rbx                               #5299.28
-..___tag_value_NucStrstrSearch.688:                             #
-        leave                                                   #5299.28
-..___tag_value_NucStrstrSearch.690:                             #
-        ret                                                     #5299.28
-..___tag_value_NucStrstrSearch.691:                             #
-                                # LOE
-..B30.105:                      # Preds ..B30.103
-..LN5559:
-        movq      -56(%rbp), %rax                               #5300.42
-        movq      8(%rax), %rax                                 #5300.42
-..LN5561:
-        movq      -48(%rbp), %rdx                               #5300.62
-..LN5563:
-        movl      -24(%rbp), %ecx                               #5300.71
-..LN5565:
-        movl      -164(%rbp), %ebx                              #5300.76
-..LN5567:
-        movq      -40(%rbp), %rsi                               #5300.87
-..LN5569:
-        movq      %rax, %rdi                                    #5300.24
-        movq      %rsi, -176(%rbp)                              #5300.24
-        movq      %rdx, %rsi                                    #5300.24
-        movl      %ecx, %edx                                    #5300.24
-        movl      %ebx, %ecx                                    #5300.24
-        movq      -176(%rbp), %rax                              #5300.24
-        movq      %rax, %r8                                     #5300.24
-        call      NucStrstrSearch at PLT                           #5300.24
-                                # LOE eax
-..B30.128:                      # Preds ..B30.105
-        movl      %eax, -168(%rbp)                              #5300.24
-                                # LOE
-..B30.106:                      # Preds ..B30.128
-        movl      -168(%rbp), %eax                              #5300.24
-        movq      -32(%rbp), %rbx                               #5300.24
-..___tag_value_NucStrstrSearch.693:                             #
-        leave                                                   #5300.24
-..___tag_value_NucStrstrSearch.695:                             #
-        ret                                                     #5300.24
-..___tag_value_NucStrstrSearch.696:                             #
-                                # LOE
-..B30.107:                      # Preds ..B30.97
-..LN5571:
-        movq      -56(%rbp), %rax                               #5302.29
-        movq      8(%rax), %rax                                 #5302.29
-        movl      4(%rax), %eax                                 #5302.29
-..LN5573:
-        movl      %eax, -164(%rbp)                              #5302.17
-..LN5575:
-        movl      -164(%rbp), %eax                              #5303.22
-..LN5577:
-        movl      -16(%rbp), %edx                               #5303.34
-        cmpl      %edx, %eax                                    #5303.34
-        jbe       ..B30.109     # Prob 50%                      #5303.34
-                                # LOE
-..B30.108:                      # Preds ..B30.107
-..LN5579:
-        xorl      %eax, %eax                                    #5304.28
-        movq      -32(%rbp), %rbx                               #5304.28
-..___tag_value_NucStrstrSearch.698:                             #
-        leave                                                   #5304.28
-..___tag_value_NucStrstrSearch.700:                             #
-        ret                                                     #5304.28
-..___tag_value_NucStrstrSearch.701:                             #
-                                # LOE
-..B30.109:                      # Preds ..B30.107
-..LN5581:
-        movq      -56(%rbp), %rax                               #5305.42
-        movq      8(%rax), %rax                                 #5305.42
-..LN5583:
-        movq      -48(%rbp), %rdx                               #5305.62
-..LN5585:
-        movl      -16(%rbp), %ecx                               #5306.27
-        addl      -24(%rbp), %ecx                               #5306.27
-..LN5587:
-        movl      -164(%rbp), %ebx                              #5306.33
-        negl      %ebx                                          #5306.33
-        addl      %ebx, %ecx                                    #5306.33
-..LN5589:
-        movl      -164(%rbp), %ebx                              #5306.44
-..LN5591:
-        movq      -40(%rbp), %rsi                               #5306.55
-..LN5593:
-        movq      %rax, %rdi                                    #5305.24
-        movq      %rsi, -192(%rbp)                              #5305.24
-        movq      %rdx, %rsi                                    #5305.24
-        movl      %ecx, %edx                                    #5305.24
-        movl      %ebx, %ecx                                    #5305.24
-        movq      -192(%rbp), %rax                              #5305.24
-        movq      %rax, %r8                                     #5305.24
-        call      NucStrstrSearch at PLT                           #5305.24
-                                # LOE eax
-..B30.129:                      # Preds ..B30.109
-        movl      %eax, -184(%rbp)                              #5305.24
-                                # LOE
-..B30.110:                      # Preds ..B30.129
-        movl      -184(%rbp), %eax                              #5305.24
-        movq      -32(%rbp), %rbx                               #5305.24
-..___tag_value_NucStrstrSearch.703:                             #
-        leave                                                   #5305.24
-..___tag_value_NucStrstrSearch.705:                             #
-        ret                                                     #5305.24
-..___tag_value_NucStrstrSearch.706:                             #
-                                # LOE
-..B30.111:                      # Preds ..B30.101 ..B30.97 ..B30.4 ..B30.3 ..B30.2
-                                #       ..B30.1
-..LN5595:
-        xorl      %eax, %eax                                    #5311.12
-        movq      -32(%rbp), %rbx                               #5311.12
-..___tag_value_NucStrstrSearch.708:                             #
-        leave                                                   #5311.12
-..___tag_value_NucStrstrSearch.710:                             #
-        ret                                                     #5311.12
-        .align    2,0x90
-..___tag_value_NucStrstrSearch.711:                             #
-                                # LOE
-# mark_end;
-	.type	NucStrstrSearch, at function
-	.size	NucStrstrSearch,.-NucStrstrSearch
-.LNNucStrstrSearch:
-	.section .data1, "wa"
-	.space 24	# pad
-	.align 32
-..1..TPKT.30_0.0.1:
-	.quad	..1.30_0.TAG.00.0.1
-	.quad	..1.30_0.TAG.01.0.1
-	.quad	..1.30_0.TAG.02.0.1
-	.quad	..1.30_0.TAG.03.0.1
-	.quad	..1.30_0.TAG.04.0.1
-	.quad	..1.30_0.TAG.05.0.1
-	.quad	..1.30_0.TAG.06.0.1
-	.quad	..1.30_0.TAG.07.0.1
-	.quad	..1.30_0.TAG.08.0.1
-	.quad	..1.30_0.TAG.09.0.1
-	.quad	..1.30_0.TAG.0a.0.1
-	.quad	..1.30_0.TAG.0b.0.1
-	.quad	..1.30_0.TAG.0c.0.1
-	.data
-# -- End  NucStrstrSearch
-	.bss
-	.align 32
-	.align 32
-fasta_2na_map.0:
-	.type	fasta_2na_map.0, at object
-	.size	fasta_2na_map.0,128
-	.space 128	# pad
-	.align 32
-fasta_4na_map.0:
-	.type	fasta_4na_map.0, at object
-	.size	fasta_4na_map.0,128
-	.space 128	# pad
-	.data
-	.align 32
-	.align 32
-expand_2na.0:
-	.word	4369
-	.word	4370
-	.word	4372
-	.word	4376
-	.word	4385
-	.word	4386
-	.word	4388
-	.word	4392
-	.word	4417
-	.word	4418
-	.word	4420
-	.word	4424
-	.word	4481
-	.word	4482
-	.word	4484
-	.word	4488
-	.word	4625
-	.word	4626
-	.word	4628
-	.word	4632
-	.word	4641
-	.word	4642
-	.word	4644
-	.word	4648
-	.word	4673
-	.word	4674
-	.word	4676
-	.word	4680
-	.word	4737
-	.word	4738
-	.word	4740
-	.word	4744
-	.word	5137
-	.word	5138
-	.word	5140
-	.word	5144
-	.word	5153
-	.word	5154
-	.word	5156
-	.word	5160
-	.word	5185
-	.word	5186
-	.word	5188
-	.word	5192
-	.word	5249
-	.word	5250
-	.word	5252
-	.word	5256
-	.word	6161
-	.word	6162
-	.word	6164
-	.word	6168
-	.word	6177
-	.word	6178
-	.word	6180
-	.word	6184
-	.word	6209
-	.word	6210
-	.word	6212
-	.word	6216
-	.word	6273
-	.word	6274
-	.word	6276
-	.word	6280
-	.word	8465
-	.word	8466
-	.word	8468
-	.word	8472
-	.word	8481
-	.word	8482
-	.word	8484
-	.word	8488
-	.word	8513
-	.word	8514
-	.word	8516
-	.word	8520
-	.word	8577
-	.word	8578
-	.word	8580
-	.word	8584
-	.word	8721
-	.word	8722
-	.word	8724
-	.word	8728
-	.word	8737
-	.word	8738
-	.word	8740
-	.word	8744
-	.word	8769
-	.word	8770
-	.word	8772
-	.word	8776
-	.word	8833
-	.word	8834
-	.word	8836
-	.word	8840
-	.word	9233
-	.word	9234
-	.word	9236
-	.word	9240
-	.word	9249
-	.word	9250
-	.word	9252
-	.word	9256
-	.word	9281
-	.word	9282
-	.word	9284
-	.word	9288
-	.word	9345
-	.word	9346
-	.word	9348
-	.word	9352
-	.word	10257
-	.word	10258
-	.word	10260
-	.word	10264
-	.word	10273
-	.word	10274
-	.word	10276
-	.word	10280
-	.word	10305
-	.word	10306
-	.word	10308
-	.word	10312
-	.word	10369
-	.word	10370
-	.word	10372
-	.word	10376
-	.word	16657
-	.word	16658
-	.word	16660
-	.word	16664
-	.word	16673
-	.word	16674
-	.word	16676
-	.word	16680
-	.word	16705
-	.word	16706
-	.word	16708
-	.word	16712
-	.word	16769
-	.word	16770
-	.word	16772
-	.word	16776
-	.word	16913
-	.word	16914
-	.word	16916
-	.word	16920
-	.word	16929
-	.word	16930
-	.word	16932
-	.word	16936
-	.word	16961
-	.word	16962
-	.word	16964
-	.word	16968
-	.word	17025
-	.word	17026
-	.word	17028
-	.word	17032
-	.word	17425
-	.word	17426
-	.word	17428
-	.word	17432
-	.word	17441
-	.word	17442
-	.word	17444
-	.word	17448
-	.word	17473
-	.word	17474
-	.word	17476
-	.word	17480
-	.word	17537
-	.word	17538
-	.word	17540
-	.word	17544
-	.word	18449
-	.word	18450
-	.word	18452
-	.word	18456
-	.word	18465
-	.word	18466
-	.word	18468
-	.word	18472
-	.word	18497
-	.word	18498
-	.word	18500
-	.word	18504
-	.word	18561
-	.word	18562
-	.word	18564
-	.word	18568
-	.word	33041
-	.word	33042
-	.word	33044
-	.word	33048
-	.word	33057
-	.word	33058
-	.word	33060
-	.word	33064
-	.word	33089
-	.word	33090
-	.word	33092
-	.word	33096
-	.word	33153
-	.word	33154
-	.word	33156
-	.word	33160
-	.word	33297
-	.word	33298
-	.word	33300
-	.word	33304
-	.word	33313
-	.word	33314
-	.word	33316
-	.word	33320
-	.word	33345
-	.word	33346
-	.word	33348
-	.word	33352
-	.word	33409
-	.word	33410
-	.word	33412
-	.word	33416
-	.word	33809
-	.word	33810
-	.word	33812
-	.word	33816
-	.word	33825
-	.word	33826
-	.word	33828
-	.word	33832
-	.word	33857
-	.word	33858
-	.word	33860
-	.word	33864
-	.word	33921
-	.word	33922
-	.word	33924
-	.word	33928
-	.word	34833
-	.word	34834
-	.word	34836
-	.word	34840
-	.word	34849
-	.word	34850
-	.word	34852
-	.word	34856
-	.word	34881
-	.word	34882
-	.word	34884
-	.word	34888
-	.word	34945
-	.word	34946
-	.word	34948
-	.word	34952
-	.type	expand_2na.0, at object
-	.size	expand_2na.0,512
-	.section .rodata, "a"
-	.align 4
-	.align 4
-__$U0.0:
-	.byte	78
-	.byte	117
-	.byte	99
-	.byte	83
-	.byte	116
-	.byte	114
-	.byte	70
-	.byte	97
-	.byte	115
-	.byte	116
-	.byte	97
-	.byte	69
-	.byte	120
-	.byte	112
-	.byte	114
-	.byte	65
-	.byte	108
-	.byte	108
-	.byte	111
-	.byte	99
-	.byte	0
-	.type	__$U0.0, at object
-	.size	__$U0.0,21
-	.space 3	# pad
-	.align 4
-_2__STRING.1.0:
-	.byte	110
-	.byte	117
-	.byte	99
-	.byte	115
-	.byte	116
-	.byte	114
-	.byte	115
-	.byte	116
-	.byte	114
-	.byte	46
-	.byte	99
-	.byte	0
-	.type	_2__STRING.1.0, at object
-	.size	_2__STRING.1.0,12
-	.align 4
-_2__STRING.0.0:
-	.byte	40
-	.byte	32
-	.byte	40
-	.byte	32
-	.byte	115
-	.byte	105
-	.byte	122
-	.byte	101
-	.byte	95
-	.byte	116
-	.byte	32
-	.byte	41
-	.byte	32
-	.byte	38
-	.byte	32
-	.byte	101
-	.byte	32
-	.byte	45
-	.byte	62
-	.byte	32
-	.byte	113
-	.byte	117
-	.byte	101
-	.byte	114
-	.byte	121
-	.byte	32
-	.byte	91
-	.byte	32
-	.byte	48
-	.byte	32
-	.byte	93
-	.byte	32
-	.byte	46
-	.byte	32
-	.byte	112
-	.byte	97
-	.byte	116
-	.byte	116
-	.byte	101
-	.byte	114
-	.byte	110
-	.byte	32
-	.byte	38
-	.byte	32
-	.byte	49
-	.byte	53
-	.byte	32
-	.byte	41
-	.byte	32
-	.byte	61
-	.byte	61
-	.byte	32
-	.byte	48
-	.byte	0
-	.type	_2__STRING.0.0, at object
-	.size	_2__STRING.0.0,54
-	.space 2	# pad
-	.align 4
-_2__STRING.2.0:
-	.byte	40
-	.byte	32
-	.byte	40
-	.byte	32
-	.byte	115
-	.byte	105
-	.byte	122
-	.byte	101
-	.byte	95
-	.byte	116
-	.byte	32
-	.byte	41
-	.byte	32
-	.byte	38
-	.byte	32
-	.byte	101
-	.byte	32
-	.byte	45
-	.byte	62
-	.byte	32
-	.byte	113
-	.byte	117
-	.byte	101
-	.byte	114
-	.byte	121
-	.byte	32
-	.byte	91
-	.byte	32
-	.byte	48
-	.byte	32
-	.byte	93
-	.byte	32
-	.byte	46
-	.byte	32
-	.byte	109
-	.byte	97
-	.byte	115
-	.byte	107
-	.byte	32
-	.byte	38
-	.byte	32
-	.byte	49
-	.byte	53
-	.byte	32
-	.byte	41
-	.byte	32
-	.byte	61
-	.byte	61
-	.byte	32
-	.byte	48
-	.byte	0
-	.type	_2__STRING.2.0, at object
-	.size	_2__STRING.2.0,51
-	.space 1	# pad
-	.align 4
-__$U1.0:
-	.byte	110
-	.byte	115
-	.byte	115
-	.byte	95
-	.byte	102
-	.byte	97
-	.byte	115
-	.byte	116
-	.byte	97
-	.byte	95
-	.byte	101
-	.byte	120
-	.byte	112
-	.byte	114
-	.byte	0
-	.type	__$U1.0, at object
-	.size	__$U1.0,15
-	.space 1	# pad
-	.align 4
-_2__STRING.3.0:
-	.byte	112
-	.byte	32
-	.byte	60
-	.byte	32
-	.byte	101
-	.byte	110
-	.byte	100
-	.byte	0
-	.type	_2__STRING.3.0, at object
-	.size	_2__STRING.3.0,8
-	.align 4
-__$U2.0:
-	.byte	110
-	.byte	115
-	.byte	115
-	.byte	95
-	.byte	112
-	.byte	114
-	.byte	105
-	.byte	109
-	.byte	97
-	.byte	114
-	.byte	121
-	.byte	95
-	.byte	101
-	.byte	120
-	.byte	112
-	.byte	114
-	.byte	0
-	.type	__$U2.0, at object
-	.size	__$U2.0,17
-	.space 3	# pad
-	.align 4
-__$U3.0:
-	.byte	110
-	.byte	115
-	.byte	115
-	.byte	95
-	.byte	117
-	.byte	110
-	.byte	97
-	.byte	114
-	.byte	121
-	.byte	95
-	.byte	101
-	.byte	120
-	.byte	112
-	.byte	114
-	.byte	0
-	.type	__$U3.0, at object
-	.size	__$U3.0,15
-	.space 1	# pad
-	.align 4
-_2__STRING.4.0:
-	.byte	42
-	.byte	32
-	.byte	115
-	.byte	116
-	.byte	97
-	.byte	116
-	.byte	117
-	.byte	115
-	.byte	32
-	.byte	33
-	.byte	61
-	.byte	32
-	.byte	48
-	.byte	32
-	.byte	124
-	.byte	124
-	.byte	32
-	.byte	101
-	.byte	32
-	.byte	45
-	.byte	62
-	.byte	32
-	.byte	115
-	.byte	117
-	.byte	98
-	.byte	32
-	.byte	46
-	.byte	32
-	.byte	101
-	.byte	120
-	.byte	112
-	.byte	114
-	.byte	32
-	.byte	33
-	.byte	61
-	.byte	32
-	.byte	40
-	.byte	40
-	.byte	118
-	.byte	111
-	.byte	105
-	.byte	100
-	.byte	32
-	.byte	42
-	.byte	41
-	.byte	48
-	.byte	41
-	.byte	0
-	.type	_2__STRING.4.0, at object
-	.size	_2__STRING.4.0,48
-	.align 4
-__$U4.0:
-	.byte	110
-	.byte	115
-	.byte	115
-	.byte	95
-	.byte	101
-	.byte	120
-	.byte	112
-	.byte	114
-	.byte	0
-	.type	__$U4.0, at object
-	.size	__$U4.0,9
-	.space 3	# pad
-	.align 4
-_2__STRING.5.0:
-	.byte	42
-	.byte	32
-	.byte	101
-	.byte	120
-	.byte	112
-	.byte	114
-	.byte	32
-	.byte	33
-	.byte	61
-	.byte	32
-	.byte	40
-	.byte	40
-	.byte	118
-	.byte	111
-	.byte	105
-	.byte	100
-	.byte	32
-	.byte	42
-	.byte	41
-	.byte	48
-	.byte	41
-	.byte	0
-	.type	_2__STRING.5.0, at object
-	.size	_2__STRING.5.0,22
-	.space 2	# pad
-	.align 4
-_2__STRING.6.0:
-	.byte	42
-	.byte	32
-	.byte	115
-	.byte	116
-	.byte	97
-	.byte	116
-	.byte	117
-	.byte	115
-	.byte	32
-	.byte	33
-	.byte	61
-	.byte	32
-	.byte	48
-	.byte	32
-	.byte	124
-	.byte	124
-	.byte	32
-	.byte	101
-	.byte	32
-	.byte	45
-	.byte	62
-	.byte	32
-	.byte	98
-	.byte	111
-	.byte	111
-	.byte	108
-	.byte	101
-	.byte	97
-	.byte	110
-	.byte	32
-	.byte	46
-	.byte	32
-	.byte	114
-	.byte	105
-	.byte	103
-	.byte	104
-	.byte	116
-	.byte	32
-	.byte	33
-	.byte	61
-	.byte	32
-	.byte	40
-	.byte	40
-	.byte	118
-	.byte	111
-	.byte	105
-	.byte	100
-	.byte	32
-	.byte	42
-	.byte	41
-	.byte	48
-	.byte	41
-	.byte	0
-	.type	_2__STRING.6.0, at object
-	.size	_2__STRING.6.0,53
-	.space 3	# pad
-	.align 4
-_2__STRING.7.0:
-	.byte	65
-	.byte	67
-	.byte	71
-	.byte	84
-	.byte	0
-	.type	_2__STRING.7.0, at object
-	.size	_2__STRING.7.0,5
-	.space 3	# pad
-	.align 4
-_2__STRING.8.0:
-	.byte	45
-	.byte	65
-	.byte	67
-	.byte	77
-	.byte	71
-	.byte	82
-	.byte	83
-	.byte	86
-	.byte	84
-	.byte	87
-	.byte	89
-	.byte	72
-	.byte	75
-	.byte	68
-	.byte	66
-	.byte	78
-	.byte	0
-	.type	_2__STRING.8.0, at object
-	.size	_2__STRING.8.0,17
-	.space 3	# pad
-	.align 4
-__$U5.0:
-	.byte	101
-	.byte	118
-	.byte	97
-	.byte	108
-	.byte	95
-	.byte	50
-	.byte	110
-	.byte	97
-	.byte	95
-	.byte	56
-	.byte	0
-	.type	__$U5.0, at object
-	.size	__$U5.0,11
-	.space 1	# pad
-	.align 4
-_2__STRING.9.0:
-	.byte	108
-	.byte	101
-	.byte	110
-	.byte	32
-	.byte	62
-	.byte	61
-	.byte	32
-	.byte	113
-	.byte	108
-	.byte	101
-	.byte	110
-	.byte	0
-	.type	_2__STRING.9.0, at object
-	.size	_2__STRING.9.0,12
-	.align 4
-__$U6.0:
-	.byte	101
-	.byte	118
-	.byte	97
-	.byte	108
-	.byte	95
-	.byte	50
-	.byte	110
-	.byte	97
-	.byte	95
-	.byte	49
-	.byte	54
-	.byte	0
-	.type	__$U6.0, at object
-	.size	__$U6.0,12
-	.align 4
-__$U7.0:
-	.byte	101
-	.byte	118
-	.byte	97
-	.byte	108
-	.byte	95
-	.byte	50
-	.byte	110
-	.byte	97
-	.byte	95
-	.byte	51
-	.byte	50
-	.byte	0
-	.type	__$U7.0, at object
-	.size	__$U7.0,12
-	.align 4
-__$U8.0:
-	.byte	101
-	.byte	118
-	.byte	97
-	.byte	108
-	.byte	95
-	.byte	50
-	.byte	110
-	.byte	97
-	.byte	95
-	.byte	54
-	.byte	52
-	.byte	0
-	.type	__$U8.0, at object
-	.size	__$U8.0,12
-	.align 4
-__$U9.0:
-	.byte	101
-	.byte	118
-	.byte	97
-	.byte	108
-	.byte	95
-	.byte	50
-	.byte	110
-	.byte	97
-	.byte	95
-	.byte	49
-	.byte	50
-	.byte	56
-	.byte	0
-	.type	__$U9.0, at object
-	.size	__$U9.0,13
-	.space 3	# pad
-	.align 4
-__$Ua.0:
-	.byte	101
-	.byte	118
-	.byte	97
-	.byte	108
-	.byte	95
-	.byte	50
-	.byte	110
-	.byte	97
-	.byte	95
-	.byte	112
-	.byte	111
-	.byte	115
-	.byte	0
-	.type	__$Ua.0, at object
-	.size	__$Ua.0,13
-	.space 3	# pad
-	.align 4
-__$Ub.0:
-	.byte	101
-	.byte	118
-	.byte	97
-	.byte	108
-	.byte	95
-	.byte	52
-	.byte	110
-	.byte	97
-	.byte	95
-	.byte	49
-	.byte	54
-	.byte	0
-	.type	__$Ub.0, at object
-	.size	__$Ub.0,12
-	.align 4
-__$Uc.0:
-	.byte	101
-	.byte	118
-	.byte	97
-	.byte	108
-	.byte	95
-	.byte	52
-	.byte	110
-	.byte	97
-	.byte	95
-	.byte	51
-	.byte	50
-	.byte	0
-	.type	__$Uc.0, at object
-	.size	__$Uc.0,12
-	.align 4
-__$Ud.0:
-	.byte	101
-	.byte	118
-	.byte	97
-	.byte	108
-	.byte	95
-	.byte	52
-	.byte	110
-	.byte	97
-	.byte	95
-	.byte	54
-	.byte	52
-	.byte	0
-	.type	__$Ud.0, at object
-	.size	__$Ud.0,12
-	.align 4
-__$Ue.0:
-	.byte	101
-	.byte	118
-	.byte	97
-	.byte	108
-	.byte	95
-	.byte	52
-	.byte	110
-	.byte	97
-	.byte	95
-	.byte	49
-	.byte	50
-	.byte	56
-	.byte	0
-	.type	__$Ue.0, at object
-	.size	__$Ue.0,13
-	.space 3	# pad
-	.align 4
-__$Uf.0:
-	.byte	101
-	.byte	118
-	.byte	97
-	.byte	108
-	.byte	95
-	.byte	52
-	.byte	110
-	.byte	97
-	.byte	95
-	.byte	112
-	.byte	111
-	.byte	115
-	.byte	0
-	.type	__$Uf.0, at object
-	.size	__$Uf.0,13
-	.data
-	.section .note.GNU-stack, ""
-// -- Begin DWARF2 SEGMENT .debug_info
-	.section .debug_info
-.debug_info_seg:
-	.align 1
-	.4byte 0x00002915
-	.2byte 0x0002
-	.4byte .debug_abbrev_seg
-	.byte 0x08
-.DWinfo0:
-//	DW_TAG_compile_unit:
-	.byte 0x01
-//	DW_AT_comp_dir:
-	.8byte 0x6f722f656d6f682f
-	.8byte 0x642f72656d726164
-	.8byte 0x746e692f6c657665
-	.8byte 0x73612f6c616e7265
-	.8byte 0x2f65636172742d6d
-	.8byte 0x726165732f617273
-	.2byte 0x6863
-	.byte 0x00
-//	DW_AT_language:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x747372747363756e
-	.4byte 0x00632e72
-//	DW_AT_producer:
-	.8byte 0x2952286c65746e49
-	.8byte 0x6d6f43202b2b4320
-	.8byte 0x72502072656c6970
-	.8byte 0x6e6f69737365666f
-	.8byte 0x6120726f66206c61
-	.8byte 0x69746163696c7070
-	.8byte 0x6e6e757220736e6f
-	.8byte 0x49206e6f20676e69
-	.8byte 0x202952286c65746e
-	.8byte 0x73726556202c3436
-	.8byte 0x302e3131206e6f69
-	.8byte 0x6c69754220202020
-	.8byte 0x3130393030322064
-	.8byte 0x46200a7325203133
-	.8byte 0x6e61522073657869
-	.8byte 0x74616c6552736567
-	.4byte 0x0a657669
-	.byte 0x00
-//	DW_AT_stmt_list:
-	.4byte .debug_line_seg
-.DWinfo31:
-//	DW_TAG_typedef:
-	.byte 0x02
-//	DW_AT_decl_line:
-	.byte 0x26
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x02
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x00745f3631746e69
-//	DW_AT_type:
-	.4byte 0x00002266
-.DWinfo30:
-//	DW_TAG_subprogram:
-	.byte 0x03
-//	DW_AT_decl_line:
-	.2byte 0x145f
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x747372745363754e
-	.8byte 0x0068637261655372
-	.8byte 0x747372745363754e
-	.8byte 0x0068637261655372
-//	DW_AT_low_pc:
-	.8byte NucStrstrSearch
-//	DW_AT_high_pc:
-	.8byte .LNNucStrstrSearch
-//	DW_AT_external:
-	.byte 0x01
-.DWinfo32:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x145f
-//	DW_AT_decl_column:
-	.byte 0x28
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002889
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x48
-.DWinfo33:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x1460
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x0000286d
-//	DW_AT_name:
-	.8byte 0x00616e326962636e
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x50
-.DWinfo34:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x1460
-//	DW_AT_decl_column:
-	.byte 0x27
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_name:
-	.4byte 0x00736f70
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x68
-.DWinfo35:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x1460
-//	DW_AT_decl_column:
-	.byte 0x39
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_name:
-	.4byte 0x006e656c
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x70
-.DWinfo36:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x1460
-//	DW_AT_decl_column:
-	.byte 0x4e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002893
-//	DW_AT_name:
-	.8byte 0x006e656c666c6573
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x58
-.DWinfo37:
-//	DW_TAG_lexical_block:
-	.byte 0x05
-//	DW_AT_decl_line:
-	.2byte 0x1463
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.8byte ..LN5179
-//	DW_AT_high_pc:
-	.8byte ..LN5595
-.DWinfo38:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1464
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6e756f66
-	.2byte 0x0064
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7fb07603
-.DWinfo39:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1465
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x656c5f6174736166
-	.2byte 0x006e
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.4byte 0x7edc7603
-	.byte 0x00
-	.byte 0x00
-.DWinfo29:
-//	DW_TAG_subprogram:
-	.byte 0x03
-//	DW_AT_decl_line:
-	.2byte 0x1350
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x616e345f6c617665
-	.4byte 0x736f705f
-	.byte 0x00
-	.8byte 0x616e345f6c617665
-	.4byte 0x736f705f
-	.byte 0x00
-//	DW_AT_low_pc:
-	.8byte eval_4na_pos
-//	DW_AT_high_pc:
-	.8byte .LNeval_4na_pos
-//	DW_AT_external:
-	.byte 0x00
-.DWinfo40:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x1350
-//	DW_AT_decl_column:
-	.byte 0x2b
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002863
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x50
-.DWinfo41:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x1351
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x0000286d
-//	DW_AT_name:
-	.8byte 0x00616e326962636e
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x58
-.DWinfo42:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x1351
-//	DW_AT_decl_column:
-	.byte 0x27
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_name:
-	.4byte 0x00736f70
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x68
-.DWinfo43:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x1351
-//	DW_AT_decl_column:
-	.byte 0x39
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_name:
-	.4byte 0x006e656c
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x70
-.DWinfo44:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1360
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x66667562
-	.2byte 0x7265
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7df07603
-.DWinfo45:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1360
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6972
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7dc07603
-.DWinfo46:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1360
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6a72
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7dd07603
-.DWinfo47:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1361
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3070
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7e807603
-.DWinfo48:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1361
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3170
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ea07603
-.DWinfo49:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1361
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3270
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ec07603
-.DWinfo50:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1361
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3370
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ee07603
-.DWinfo51:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1361
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x306d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7e907603
-.DWinfo52:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1361
-//	DW_AT_decl_column:
-	.byte 0x22
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x316d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7eb07603
-.DWinfo53:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1361
-//	DW_AT_decl_column:
-	.byte 0x26
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x326d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ed07603
-.DWinfo54:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1361
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x336d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ef07603
-.DWinfo55:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1364
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6172
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x40
-.DWinfo56:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1364
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6272
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7fbc7603
-.DWinfo57:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1364
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6372
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7fb87603
-.DWinfo58:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1364
-//	DW_AT_decl_column:
-	.byte 0x15
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6472
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7f907603
-.DWinfo59:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1367
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x737361705f6d756e
-	.2byte 0x7365
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x44
-.DWinfo60:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1367
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x706f7473
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.4byte 0x7fb47603
-.DWinfo61:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x136b
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x72617473
-	.2byte 0x0074
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.4byte 0x7fb07603
-.DWinfo62:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x136f
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7fa87603
-.DWinfo63:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1371
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7fa07603
-.DWinfo64:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1371
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00637273
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7f987603
-.DWinfo65:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1372
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6e656c71
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x60
-	.byte 0x00
-.DWinfo28:
-//	DW_TAG_subprogram:
-	.byte 0x03
-//	DW_AT_decl_line:
-	.2byte 0x1272
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x616e345f6c617665
-	.4byte 0x3832315f
-	.byte 0x00
-	.8byte 0x616e345f6c617665
-	.4byte 0x3832315f
-	.byte 0x00
-//	DW_AT_low_pc:
-	.8byte eval_4na_128
-//	DW_AT_high_pc:
-	.8byte .LNeval_4na_128
-//	DW_AT_external:
-	.byte 0x00
-.DWinfo66:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x1272
-//	DW_AT_decl_column:
-	.byte 0x2b
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002863
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x58
-.DWinfo67:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x1273
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x0000286d
-//	DW_AT_name:
-	.8byte 0x00616e326962636e
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x60
-.DWinfo68:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x1273
-//	DW_AT_decl_column:
-	.byte 0x27
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_name:
-	.4byte 0x00736f70
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x70
-.DWinfo69:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x1273
-//	DW_AT_decl_column:
-	.byte 0x39
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_name:
-	.4byte 0x006e656c
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x78
-.DWinfo70:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1281
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x66667562
-	.2byte 0x7265
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7e807603
-.DWinfo71:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1281
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6972
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7dd07603
-.DWinfo72:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1281
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6a72
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7de07603
-.DWinfo73:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1282
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3070
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7e907603
-.DWinfo74:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1282
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3170
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7eb07603
-.DWinfo75:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1282
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3270
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ed07603
-.DWinfo76:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1282
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3370
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ef07603
-.DWinfo77:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1282
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x306d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ea07603
-.DWinfo78:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1282
-//	DW_AT_decl_column:
-	.byte 0x22
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x316d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ec07603
-.DWinfo79:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1282
-//	DW_AT_decl_column:
-	.byte 0x26
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x326d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ee07603
-.DWinfo80:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1282
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x336d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7f807603
-.DWinfo81:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1285
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6172
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x4c
-.DWinfo82:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1285
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6272
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x48
-.DWinfo83:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1285
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6372
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x44
-.DWinfo84:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1285
-//	DW_AT_decl_column:
-	.byte 0x15
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6472
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7fa07603
-.DWinfo85:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1288
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x737361705f6d756e
-	.2byte 0x7365
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x50
-.DWinfo86:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1288
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x706f7473
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x40
-.DWinfo87:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x128b
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7fb87603
-.DWinfo88:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x128d
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7fb07603
-.DWinfo89:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x128d
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00637273
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7fa87603
-.DWinfo90:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x128e
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6e656c71
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x68
-	.byte 0x00
-.DWinfo27:
-//	DW_TAG_subprogram:
-	.byte 0x03
-//	DW_AT_decl_line:
-	.2byte 0x1193
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x616e345f6c617665
-	.4byte 0x0034365f
-	.8byte 0x616e345f6c617665
-	.4byte 0x0034365f
-//	DW_AT_low_pc:
-	.8byte eval_4na_64
-//	DW_AT_high_pc:
-	.8byte .LNeval_4na_64
-//	DW_AT_external:
-	.byte 0x00
-.DWinfo91:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x1193
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002863
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x58
-.DWinfo92:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x1194
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x0000286d
-//	DW_AT_name:
-	.8byte 0x00616e326962636e
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x60
-.DWinfo93:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x1194
-//	DW_AT_decl_column:
-	.byte 0x27
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_name:
-	.4byte 0x00736f70
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x70
-.DWinfo94:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x1194
-//	DW_AT_decl_column:
-	.byte 0x39
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_name:
-	.4byte 0x006e656c
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x78
-.DWinfo95:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x11a3
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x66667562
-	.2byte 0x7265
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7de07603
-.DWinfo96:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x11a3
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6972
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7dc07603
-.DWinfo97:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x11a3
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6a72
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7dd07603
-.DWinfo98:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x11a4
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3070
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7df07603
-.DWinfo99:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x11a4
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3170
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7e907603
-.DWinfo100:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x11a4
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3270
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7eb07603
-.DWinfo101:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x11a4
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3370
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ed07603
-.DWinfo102:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x11a4
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x306d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7e807603
-.DWinfo103:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x11a4
-//	DW_AT_decl_column:
-	.byte 0x22
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x316d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ea07603
-.DWinfo104:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x11a4
-//	DW_AT_decl_column:
-	.byte 0x26
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x326d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ec07603
-.DWinfo105:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x11a4
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x336d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ee07603
-.DWinfo106:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x11a7
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6172
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x48
-.DWinfo107:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x11a7
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6272
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x44
-.DWinfo108:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x11a7
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6372
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x40
-.DWinfo109:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x11a7
-//	DW_AT_decl_column:
-	.byte 0x15
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6472
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7fb87603
-.DWinfo110:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x11aa
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x737361705f6d756e
-	.2byte 0x7365
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x4c
-.DWinfo111:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x11aa
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x706f7473
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.4byte 0x7fbc7603
-.DWinfo112:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x11ad
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7fb07603
-.DWinfo113:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x11af
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7fa87603
-.DWinfo114:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x11af
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00637273
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7fa07603
-.DWinfo115:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x11b0
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6e656c71
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x68
-.DWinfo116:
-//	DW_TAG_lexical_block:
-	.byte 0x05
-//	DW_AT_decl_line:
-	.2byte 0x120a
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.8byte ..LN4367
-//	DW_AT_high_pc:
-	.8byte ..LN4451
-.DWinfo117:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x121b
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6166
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7f807603
-.DWinfo118:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x121c
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6266
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7f847603
-.DWinfo119:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x121d
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6366
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7f887603
-.DWinfo120:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x121e
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6466
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7f8c7603
-	.byte 0x00
-	.byte 0x00
-.DWinfo26:
-//	DW_TAG_subprogram:
-	.byte 0x03
-//	DW_AT_decl_line:
-	.2byte 0x10b5
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x616e345f6c617665
-	.4byte 0x0032335f
-	.8byte 0x616e345f6c617665
-	.4byte 0x0032335f
-//	DW_AT_low_pc:
-	.8byte eval_4na_32
-//	DW_AT_high_pc:
-	.8byte .LNeval_4na_32
-//	DW_AT_external:
-	.byte 0x00
-.DWinfo121:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x10b5
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002863
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x58
-.DWinfo122:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x10b6
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x0000286d
-//	DW_AT_name:
-	.8byte 0x00616e326962636e
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x60
-.DWinfo123:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x10b6
-//	DW_AT_decl_column:
-	.byte 0x27
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_name:
-	.4byte 0x00736f70
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x70
-.DWinfo124:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x10b6
-//	DW_AT_decl_column:
-	.byte 0x39
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_name:
-	.4byte 0x006e656c
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x78
-.DWinfo125:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x10c4
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x66667562
-	.2byte 0x7265
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7de07603
-.DWinfo126:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x10c4
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6972
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7dc07603
-.DWinfo127:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x10c4
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6a72
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7dd07603
-.DWinfo128:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x10c5
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3070
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7df07603
-.DWinfo129:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x10c5
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3170
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7e907603
-.DWinfo130:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x10c5
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3270
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7eb07603
-.DWinfo131:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x10c5
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3370
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ed07603
-.DWinfo132:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x10c5
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x306d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7e807603
-.DWinfo133:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x10c5
-//	DW_AT_decl_column:
-	.byte 0x22
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x316d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ea07603
-.DWinfo134:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x10c5
-//	DW_AT_decl_column:
-	.byte 0x26
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x326d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ec07603
-.DWinfo135:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x10c5
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x336d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ee07603
-.DWinfo136:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x10c8
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6172
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x48
-.DWinfo137:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x10c8
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6272
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x44
-.DWinfo138:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x10c8
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6372
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x40
-.DWinfo139:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x10c8
-//	DW_AT_decl_column:
-	.byte 0x15
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6472
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7fb87603
-.DWinfo140:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x10cb
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x737361705f6d756e
-	.2byte 0x7365
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x4c
-.DWinfo141:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x10cb
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x706f7473
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.4byte 0x7fbc7603
-.DWinfo142:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x10ce
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7fb07603
-.DWinfo143:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x10d0
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7fa87603
-.DWinfo144:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x10d0
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00637273
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7fa07603
-.DWinfo145:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x10d1
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6e656c71
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x68
-.DWinfo146:
-//	DW_TAG_lexical_block:
-	.byte 0x05
-//	DW_AT_decl_line:
-	.2byte 0x112b
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.8byte ..LN4029
-//	DW_AT_high_pc:
-	.8byte ..LN4113
-.DWinfo147:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x113c
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6166
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7f807603
-.DWinfo148:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x113d
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6266
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7f847603
-.DWinfo149:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x113e
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6366
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7f887603
-.DWinfo150:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x113f
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6466
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7f8c7603
-	.byte 0x00
-	.byte 0x00
-.DWinfo25:
-//	DW_TAG_subprogram:
-	.byte 0x03
-//	DW_AT_decl_line:
-	.2byte 0x0fd7
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x616e345f6c617665
-	.4byte 0x0036315f
-	.8byte 0x616e345f6c617665
-	.4byte 0x0036315f
-//	DW_AT_low_pc:
-	.8byte eval_4na_16
-//	DW_AT_high_pc:
-	.8byte .LNeval_4na_16
-//	DW_AT_external:
-	.byte 0x00
-.DWinfo151:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0fd7
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002863
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x50
-.DWinfo152:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0fd8
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x0000286d
-//	DW_AT_name:
-	.8byte 0x00616e326962636e
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x58
-.DWinfo153:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0fd8
-//	DW_AT_decl_column:
-	.byte 0x27
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_name:
-	.4byte 0x00736f70
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x68
-.DWinfo154:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0fd8
-//	DW_AT_decl_column:
-	.byte 0x39
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_name:
-	.4byte 0x006e656c
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x70
-.DWinfo155:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0fe6
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x66667562
-	.2byte 0x7265
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7de07603
-.DWinfo156:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0fe6
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6972
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7dc07603
-.DWinfo157:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0fe6
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6a72
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7dd07603
-.DWinfo158:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0fe7
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3070
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7df07603
-.DWinfo159:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0fe7
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3170
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7e907603
-.DWinfo160:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0fe7
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3270
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7eb07603
-.DWinfo161:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0fe7
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3370
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ed07603
-.DWinfo162:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0fe7
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x306d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7e807603
-.DWinfo163:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0fe7
-//	DW_AT_decl_column:
-	.byte 0x22
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x316d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ea07603
-.DWinfo164:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0fe7
-//	DW_AT_decl_column:
-	.byte 0x26
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x326d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ec07603
-.DWinfo165:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0fe7
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x336d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ee07603
-.DWinfo166:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0fea
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6172
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x40
-.DWinfo167:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0fea
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6272
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7fbc7603
-.DWinfo168:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0fea
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6372
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7fb87603
-.DWinfo169:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0fea
-//	DW_AT_decl_column:
-	.byte 0x15
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6472
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7fb07603
-.DWinfo170:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0fed
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x737361705f6d756e
-	.2byte 0x7365
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x44
-.DWinfo171:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0fed
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x706f7473
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.4byte 0x7fb47603
-.DWinfo172:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0ff2
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7fa87603
-.DWinfo173:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0ff2
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00637273
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7fa07603
-.DWinfo174:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0ff3
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6e656c71
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x60
-.DWinfo175:
-//	DW_TAG_lexical_block:
-	.byte 0x05
-//	DW_AT_decl_line:
-	.2byte 0x104d
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.8byte ..LN3725
-//	DW_AT_high_pc:
-	.8byte ..LN3809
-.DWinfo176:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x105e
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6166
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7f807603
-.DWinfo177:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x105f
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6266
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7f847603
-.DWinfo178:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1060
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6366
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7f887603
-.DWinfo179:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x1061
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6466
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7f8c7603
-	.byte 0x00
-	.byte 0x00
-.DWinfo24:
-//	DW_TAG_subprogram:
-	.byte 0x03
-//	DW_AT_decl_line:
-	.2byte 0x0f95
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x02
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x0000279f
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x75625f656d697270
-	.8byte 0x616e345f72656666
-	.byte 0x00
-	.8byte 0x75625f656d697270
-	.8byte 0x616e345f72656666
-	.byte 0x00
-//	DW_AT_low_pc:
-	.8byte prime_buffer_4na
-//	DW_AT_high_pc:
-	.8byte .LNprime_buffer_4na
-//	DW_AT_external:
-	.byte 0x00
-.DWinfo180:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0f95
-//	DW_AT_decl_column:
-	.byte 0x2b
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_name:
-	.4byte 0x00637273
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x70
-.DWinfo181:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0f95
-//	DW_AT_decl_column:
-	.byte 0x3f
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_name:
-	.4byte 0x6f6e6769
-	.2byte 0x6572
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x78
-.DWinfo182:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0f97
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00706d74
-//	DW_AT_type:
-	.4byte 0x00002574
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x50
-.DWinfo183:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0f98
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x66667562
-	.2byte 0x7265
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x0000279f
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x60
-	.byte 0x00
-.DWinfo23:
-//	DW_TAG_subprogram:
-	.byte 0x03
-//	DW_AT_decl_line:
-	.2byte 0x0e4c
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x616e325f6c617665
-	.4byte 0x736f705f
-	.byte 0x00
-	.8byte 0x616e325f6c617665
-	.4byte 0x736f705f
-	.byte 0x00
-//	DW_AT_low_pc:
-	.8byte eval_2na_pos
-//	DW_AT_high_pc:
-	.8byte .LNeval_2na_pos
-//	DW_AT_external:
-	.byte 0x00
-.DWinfo184:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0e4c
-//	DW_AT_decl_column:
-	.byte 0x2b
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002863
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x50
-.DWinfo185:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0e4d
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x0000286d
-//	DW_AT_name:
-	.8byte 0x00616e326962636e
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x58
-.DWinfo186:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0e4d
-//	DW_AT_decl_column:
-	.byte 0x27
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_name:
-	.4byte 0x00736f70
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x68
-.DWinfo187:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0e4d
-//	DW_AT_decl_column:
-	.byte 0x39
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_name:
-	.4byte 0x006e656c
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x70
-.DWinfo188:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0e5c
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x66667562
-	.2byte 0x7265
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7df07603
-.DWinfo189:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0e5c
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6972
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7dd07603
-.DWinfo190:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0e5d
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3070
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7e807603
-.DWinfo191:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0e5d
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3170
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ea07603
-.DWinfo192:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0e5d
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3270
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ec07603
-.DWinfo193:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0e5d
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3370
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ee07603
-.DWinfo194:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0e5d
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x306d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7e907603
-.DWinfo195:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0e5d
-//	DW_AT_decl_column:
-	.byte 0x22
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x316d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7eb07603
-.DWinfo196:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0e5d
-//	DW_AT_decl_column:
-	.byte 0x26
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x326d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ed07603
-.DWinfo197:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0e5d
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x336d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ef07603
-.DWinfo198:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0e60
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6172
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x40
-.DWinfo199:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0e60
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6272
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7fbc7603
-.DWinfo200:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0e60
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6372
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7fb87603
-.DWinfo201:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0e60
-//	DW_AT_decl_column:
-	.byte 0x15
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6472
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7f947603
-.DWinfo202:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0e63
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x737361705f6d756e
-	.2byte 0x7365
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x44
-.DWinfo203:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0e63
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x706f7473
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.4byte 0x7fb47603
-.DWinfo204:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0e67
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x72617473
-	.2byte 0x0074
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.4byte 0x7fb07603
-.DWinfo205:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0e6d
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6d616c73
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7f907603
-.DWinfo206:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0e6e
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7fa87603
-.DWinfo207:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0e71
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7fa07603
-.DWinfo208:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0e71
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00637273
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7f987603
-.DWinfo209:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0e72
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6e656c71
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x60
-	.byte 0x00
-.DWinfo22:
-//	DW_TAG_subprogram:
-	.byte 0x03
-//	DW_AT_decl_line:
-	.2byte 0x0d27
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x616e325f6c617665
-	.4byte 0x3832315f
-	.byte 0x00
-	.8byte 0x616e325f6c617665
-	.4byte 0x3832315f
-	.byte 0x00
-//	DW_AT_low_pc:
-	.8byte eval_2na_128
-//	DW_AT_high_pc:
-	.8byte .LNeval_2na_128
-//	DW_AT_external:
-	.byte 0x00
-.DWinfo210:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0d27
-//	DW_AT_decl_column:
-	.byte 0x2b
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002863
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x58
-.DWinfo211:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0d28
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x0000286d
-//	DW_AT_name:
-	.8byte 0x00616e326962636e
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x60
-.DWinfo212:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0d28
-//	DW_AT_decl_column:
-	.byte 0x27
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_name:
-	.4byte 0x00736f70
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x70
-.DWinfo213:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0d28
-//	DW_AT_decl_column:
-	.byte 0x39
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_name:
-	.4byte 0x006e656c
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x78
-.DWinfo214:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0d36
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x66667562
-	.2byte 0x7265
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7e807603
-.DWinfo215:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0d36
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6972
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7de07603
-.DWinfo216:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0d37
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3070
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7e907603
-.DWinfo217:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0d37
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3170
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7eb07603
-.DWinfo218:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0d37
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3270
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ed07603
-.DWinfo219:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0d37
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3370
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ef07603
-.DWinfo220:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0d37
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x306d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ea07603
-.DWinfo221:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0d37
-//	DW_AT_decl_column:
-	.byte 0x22
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x316d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ec07603
-.DWinfo222:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0d37
-//	DW_AT_decl_column:
-	.byte 0x26
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x326d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ee07603
-.DWinfo223:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0d37
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x336d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7f807603
-.DWinfo224:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0d3a
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6172
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x4c
-.DWinfo225:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0d3a
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6272
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x48
-.DWinfo226:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0d3a
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6372
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x44
-.DWinfo227:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0d3a
-//	DW_AT_decl_column:
-	.byte 0x15
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6472
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7fa47603
-.DWinfo228:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0d3d
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x737361705f6d756e
-	.2byte 0x7365
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x50
-.DWinfo229:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0d3d
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x706f7473
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x40
-.DWinfo230:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0d42
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6d616c73
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7fa07603
-.DWinfo231:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0d43
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7fb87603
-.DWinfo232:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0d46
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7fb07603
-.DWinfo233:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0d46
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00637273
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7fa87603
-.DWinfo234:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0d47
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6e656c71
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x68
-	.byte 0x00
-.DWinfo21:
-//	DW_TAG_subprogram:
-	.byte 0x03
-//	DW_AT_decl_line:
-	.2byte 0x0c01
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x616e325f6c617665
-	.4byte 0x0034365f
-	.8byte 0x616e325f6c617665
-	.4byte 0x0034365f
-//	DW_AT_low_pc:
-	.8byte eval_2na_64
-//	DW_AT_high_pc:
-	.8byte .LNeval_2na_64
-//	DW_AT_external:
-	.byte 0x00
-.DWinfo235:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0c01
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002863
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x50
-.DWinfo236:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0c02
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x0000286d
-//	DW_AT_name:
-	.8byte 0x00616e326962636e
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x58
-.DWinfo237:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0c02
-//	DW_AT_decl_column:
-	.byte 0x27
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_name:
-	.4byte 0x00736f70
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x68
-.DWinfo238:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0c02
-//	DW_AT_decl_column:
-	.byte 0x39
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_name:
-	.4byte 0x006e656c
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x70
-.DWinfo239:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0c11
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x66667562
-	.2byte 0x7265
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7dd07603
-.DWinfo240:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0c11
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6972
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7dc07603
-.DWinfo241:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0c12
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3070
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7de07603
-.DWinfo242:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0c12
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3170
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7e807603
-.DWinfo243:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0c12
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3270
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ea07603
-.DWinfo244:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0c12
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3370
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ec07603
-.DWinfo245:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0c12
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x306d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7df07603
-.DWinfo246:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0c12
-//	DW_AT_decl_column:
-	.byte 0x22
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x316d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7e907603
-.DWinfo247:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0c12
-//	DW_AT_decl_column:
-	.byte 0x26
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x326d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7eb07603
-.DWinfo248:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0c12
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x336d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ed07603
-.DWinfo249:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0c15
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6172
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x40
-.DWinfo250:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0c15
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6272
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7fbc7603
-.DWinfo251:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0c15
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6372
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7fb87603
-.DWinfo252:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0c15
-//	DW_AT_decl_column:
-	.byte 0x15
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6472
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7fb07603
-.DWinfo253:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0c18
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x737361705f6d756e
-	.2byte 0x7365
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x44
-.DWinfo254:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0c18
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x706f7473
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.4byte 0x7fb47603
-.DWinfo255:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0c1d
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6d616c73
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7f907603
-.DWinfo256:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0c1e
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7fa87603
-.DWinfo257:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0c21
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7fa07603
-.DWinfo258:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0c21
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00637273
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7f987603
-.DWinfo259:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0c22
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6e656c71
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x60
-.DWinfo260:
-//	DW_TAG_lexical_block:
-	.byte 0x05
-//	DW_AT_decl_line:
-	.2byte 0x0c7a
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.8byte ..LN2693
-//	DW_AT_high_pc:
-	.8byte ..LN2779
-.DWinfo261:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0c8b
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6166
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7ef07603
-.DWinfo262:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0c8c
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6266
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7ef47603
-.DWinfo263:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0c8d
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6366
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7ef87603
-.DWinfo264:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0c8e
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6466
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7efc7603
-	.byte 0x00
-	.byte 0x00
-.DWinfo20:
-//	DW_TAG_subprogram:
-	.byte 0x03
-//	DW_AT_decl_line:
-	.2byte 0x0adc
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x616e325f6c617665
-	.4byte 0x0032335f
-	.8byte 0x616e325f6c617665
-	.4byte 0x0032335f
-//	DW_AT_low_pc:
-	.8byte eval_2na_32
-//	DW_AT_high_pc:
-	.8byte .LNeval_2na_32
-//	DW_AT_external:
-	.byte 0x00
-.DWinfo265:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0adc
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002863
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x50
-.DWinfo266:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0add
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x0000286d
-//	DW_AT_name:
-	.8byte 0x00616e326962636e
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x58
-.DWinfo267:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0add
-//	DW_AT_decl_column:
-	.byte 0x27
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_name:
-	.4byte 0x00736f70
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x68
-.DWinfo268:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0add
-//	DW_AT_decl_column:
-	.byte 0x39
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_name:
-	.4byte 0x006e656c
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x70
-.DWinfo269:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0aeb
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x66667562
-	.2byte 0x7265
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7dd07603
-.DWinfo270:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0aeb
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6972
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7dc07603
-.DWinfo271:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0aec
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3070
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7de07603
-.DWinfo272:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0aec
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3170
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7e807603
-.DWinfo273:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0aec
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3270
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ea07603
-.DWinfo274:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0aec
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3370
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ec07603
-.DWinfo275:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0aec
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x306d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7df07603
-.DWinfo276:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0aec
-//	DW_AT_decl_column:
-	.byte 0x22
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x316d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7e907603
-.DWinfo277:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0aec
-//	DW_AT_decl_column:
-	.byte 0x26
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x326d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7eb07603
-.DWinfo278:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0aec
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x336d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ed07603
-.DWinfo279:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0aef
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6172
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x40
-.DWinfo280:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0aef
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6272
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7fbc7603
-.DWinfo281:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0aef
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6372
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7fb87603
-.DWinfo282:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0aef
-//	DW_AT_decl_column:
-	.byte 0x15
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6472
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7fb07603
-.DWinfo283:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0af2
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x737361705f6d756e
-	.2byte 0x7365
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x44
-.DWinfo284:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0af2
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x706f7473
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.4byte 0x7fb47603
-.DWinfo285:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0af7
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6d616c73
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7f907603
-.DWinfo286:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0af8
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7fa87603
-.DWinfo287:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0afb
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7fa07603
-.DWinfo288:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0afb
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00637273
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7f987603
-.DWinfo289:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0afc
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6e656c71
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x60
-.DWinfo290:
-//	DW_TAG_lexical_block:
-	.byte 0x05
-//	DW_AT_decl_line:
-	.2byte 0x0b54
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.8byte ..LN2359
-//	DW_AT_high_pc:
-	.8byte ..LN2445
-.DWinfo291:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0b65
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6166
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7ef07603
-.DWinfo292:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0b66
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6266
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7ef47603
-.DWinfo293:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0b67
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6366
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7ef87603
-.DWinfo294:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0b68
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6466
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7efc7603
-	.byte 0x00
-	.byte 0x00
-.DWinfo19:
-//	DW_TAG_subprogram:
-	.byte 0x03
-//	DW_AT_decl_line:
-	.2byte 0x09b7
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x616e325f6c617665
-	.4byte 0x0036315f
-	.8byte 0x616e325f6c617665
-	.4byte 0x0036315f
-//	DW_AT_low_pc:
-	.8byte eval_2na_16
-//	DW_AT_high_pc:
-	.8byte .LNeval_2na_16
-//	DW_AT_external:
-	.byte 0x00
-.DWinfo295:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x09b7
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002863
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x50
-.DWinfo296:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x09b8
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x0000286d
-//	DW_AT_name:
-	.8byte 0x00616e326962636e
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x58
-.DWinfo297:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x09b8
-//	DW_AT_decl_column:
-	.byte 0x27
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_name:
-	.4byte 0x00736f70
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x68
-.DWinfo298:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x09b8
-//	DW_AT_decl_column:
-	.byte 0x39
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_name:
-	.4byte 0x006e656c
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x70
-.DWinfo299:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x09c6
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x66667562
-	.2byte 0x7265
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7dd07603
-.DWinfo300:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x09c6
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6972
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7dc07603
-.DWinfo301:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x09c7
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3070
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7de07603
-.DWinfo302:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x09c7
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3170
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7e807603
-.DWinfo303:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x09c7
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3270
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ea07603
-.DWinfo304:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x09c7
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3370
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ec07603
-.DWinfo305:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x09c7
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x306d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7df07603
-.DWinfo306:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x09c7
-//	DW_AT_decl_column:
-	.byte 0x22
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x316d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7e907603
-.DWinfo307:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x09c7
-//	DW_AT_decl_column:
-	.byte 0x26
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x326d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7eb07603
-.DWinfo308:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x09c7
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x336d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ed07603
-.DWinfo309:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x09ca
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6172
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x40
-.DWinfo310:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x09ca
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6272
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7fbc7603
-.DWinfo311:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x09ca
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6372
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7fb87603
-.DWinfo312:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x09ca
-//	DW_AT_decl_column:
-	.byte 0x15
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6472
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7fb07603
-.DWinfo313:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x09cd
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x737361705f6d756e
-	.2byte 0x7365
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x44
-.DWinfo314:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x09cd
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x706f7473
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.4byte 0x7fb47603
-.DWinfo315:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x09d2
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6d616c73
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7f907603
-.DWinfo316:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x09d3
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7fa87603
-.DWinfo317:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x09d6
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7fa07603
-.DWinfo318:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x09d6
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00637273
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7f987603
-.DWinfo319:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x09d7
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6e656c71
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x60
-.DWinfo320:
-//	DW_TAG_lexical_block:
-	.byte 0x05
-//	DW_AT_decl_line:
-	.2byte 0x0a2f
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.8byte ..LN2033
-//	DW_AT_high_pc:
-	.8byte ..LN2119
-.DWinfo321:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0a40
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6166
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7ef07603
-.DWinfo322:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0a41
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6266
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7ef47603
-.DWinfo323:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0a42
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6366
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7ef87603
-.DWinfo324:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0a43
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6466
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7efc7603
-	.byte 0x00
-	.byte 0x00
-.DWinfo18:
-//	DW_TAG_subprogram:
-	.byte 0x03
-//	DW_AT_decl_line:
-	.2byte 0x0892
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x616e325f6c617665
-	.2byte 0x385f
-	.byte 0x00
-	.8byte 0x616e325f6c617665
-	.2byte 0x385f
-	.byte 0x00
-//	DW_AT_low_pc:
-	.8byte eval_2na_8
-//	DW_AT_high_pc:
-	.8byte .LNeval_2na_8
-//	DW_AT_external:
-	.byte 0x00
-.DWinfo325:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0892
-//	DW_AT_decl_column:
-	.byte 0x29
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002863
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x50
-.DWinfo326:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0893
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x0000286d
-//	DW_AT_name:
-	.8byte 0x00616e326962636e
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x58
-.DWinfo327:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0893
-//	DW_AT_decl_column:
-	.byte 0x27
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_name:
-	.4byte 0x00736f70
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x68
-.DWinfo328:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0893
-//	DW_AT_decl_column:
-	.byte 0x39
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_name:
-	.4byte 0x006e656c
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x70
-.DWinfo329:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x08a1
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x66667562
-	.2byte 0x7265
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7de07603
-.DWinfo330:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x08a1
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6972
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7dd07603
-.DWinfo331:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x08a2
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3070
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7df07603
-.DWinfo332:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x08a2
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3170
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7e907603
-.DWinfo333:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x08a2
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3270
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7eb07603
-.DWinfo334:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x08a2
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x3370
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ed07603
-.DWinfo335:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x08a2
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x306d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7e807603
-.DWinfo336:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x08a2
-//	DW_AT_decl_column:
-	.byte 0x22
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x316d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ea07603
-.DWinfo337:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x08a2
-//	DW_AT_decl_column:
-	.byte 0x26
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x326d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ec07603
-.DWinfo338:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x08a2
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x336d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002877
-//	DW_AT_location:
-	.4byte 0x7ee07603
-.DWinfo339:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x08a5
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6172
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x40
-.DWinfo340:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x08a5
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6272
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7fbc7603
-.DWinfo341:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x08a5
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6372
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7fb87603
-.DWinfo342:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x08a5
-//	DW_AT_decl_column:
-	.byte 0x15
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6472
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7fb07603
-.DWinfo343:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x08a8
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x737361705f6d756e
-	.2byte 0x7365
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x44
-.DWinfo344:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x08a8
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x706f7473
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.4byte 0x7fb47603
-.DWinfo345:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x08b1
-//	DW_AT_decl_column:
-	.byte 0x14
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7fa87603
-.DWinfo346:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x08b1
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00637273
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_location:
-	.4byte 0x7fa07603
-.DWinfo347:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x08b2
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6e656c71
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x60
-.DWinfo348:
-//	DW_TAG_lexical_block:
-	.byte 0x05
-//	DW_AT_decl_line:
-	.2byte 0x090a
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.8byte ..LN1749
-//	DW_AT_high_pc:
-	.8byte ..LN1835
-.DWinfo349:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x091b
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6166
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7f807603
-.DWinfo350:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x091c
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6266
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7f847603
-.DWinfo351:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x091d
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6366
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7f887603
-.DWinfo352:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x091e
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6466
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.4byte 0x7f8c7603
-	.byte 0x00
-	.byte 0x00
-.DWinfo16:
-//	DW_TAG_subprogram:
-	.byte 0x03
-//	DW_AT_decl_line:
-	.2byte 0x0625
-//	DW_AT_decl_column:
-	.byte 0x06
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x000022ea
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x747372745363754e
-	.4byte 0x61685772
-	.2byte 0x6b63
-	.byte 0x00
-	.8byte 0x747372745363754e
-	.4byte 0x61685772
-	.2byte 0x6b63
-	.byte 0x00
-//	DW_AT_low_pc:
-	.8byte NucStrstrWhack
-//	DW_AT_high_pc:
-	.8byte .LNNucStrstrWhack
-//	DW_AT_external:
-	.byte 0x01
-.DWinfo353:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0625
-//	DW_AT_decl_column:
-	.byte 0x22
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x0000279a
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x78
-	.byte 0x00
-.DWinfo15:
-//	DW_TAG_subprogram:
-	.byte 0x03
-//	DW_AT_decl_line:
-	.2byte 0x0601
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x747372745363754e
-	.4byte 0x6b614d72
-	.2byte 0x0065
-	.8byte 0x747372745363754e
-	.4byte 0x6b614d72
-	.2byte 0x0065
-//	DW_AT_low_pc:
-	.8byte NucStrstrMake
-//	DW_AT_high_pc:
-	.8byte .LNNucStrstrMake
-//	DW_AT_external:
-	.byte 0x01
-.DWinfo354:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0601
-//	DW_AT_decl_column:
-	.byte 0x21
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002795
-//	DW_AT_name:
-	.4byte 0x0073736e
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x50
-.DWinfo355:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0601
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_name:
-	.8byte 0x6e6f697469736f70
-	.2byte 0x6c61
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x68
-.DWinfo356:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0602
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002764
-//	DW_AT_name:
-	.4byte 0x72657571
-	.2byte 0x0079
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x58
-.DWinfo357:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0602
-//	DW_AT_decl_column:
-	.byte 0x25
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_name:
-	.4byte 0x006e656c
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x70
-.DWinfo358:
-//	DW_TAG_lexical_block:
-	.byte 0x05
-//	DW_AT_decl_line:
-	.2byte 0x0607
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.8byte ..LN1497
-//	DW_AT_high_pc:
-	.8byte ..LN1545
-.DWinfo359:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0608
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x74617473
-	.2byte 0x7375
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x48
-.DWinfo360:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0609
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_type:
-	.4byte 0x00002764
-//	DW_AT_location:
-	.4byte 0x7fb07603
-	.byte 0x00
-	.byte 0x00
-.DWinfo14:
-//	DW_TAG_subprogram:
-	.byte 0x03
-//	DW_AT_decl_line:
-	.2byte 0x05cb
-//	DW_AT_decl_column:
-	.byte 0x06
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x000022ea
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x747372745363754e
-	.4byte 0x696e4972
-	.2byte 0x0074
-	.8byte 0x747372745363754e
-	.4byte 0x696e4972
-	.2byte 0x0074
-//	DW_AT_low_pc:
-	.8byte NucStrstrInit
-//	DW_AT_high_pc:
-	.8byte .LNNucStrstrInit
-//	DW_AT_external:
-	.byte 0x00
-.DWinfo361:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x05cd
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x6863
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x5c
-.DWinfo362:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x05ce
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0069
-//	DW_AT_type:
-	.4byte 0x000023c1
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x58
-.DWinfo363:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x05cf
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_type:
-	.4byte 0x00002764
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x50
-.DWinfo364:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x05cf
-//	DW_AT_decl_column:
-	.byte 0x15
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x00616e326962636e
-//	DW_AT_type:
-	.4byte 0x00002764
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x40
-.DWinfo365:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x05d0
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x00616e346962636e
-//	DW_AT_type:
-	.4byte 0x00002764
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x48
-.DWinfo366:
-//	DW_TAG_lexical_block:
-	.byte 0x05
-//	DW_AT_decl_line:
-	.2byte 0x05e7
-//	DW_AT_decl_column:
-	.byte 0x1c
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.8byte ..LN1463
-//	DW_AT_high_pc:
-	.8byte ..LN1481
-.DWinfo367:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x05e7
-//	DW_AT_decl_column:
-	.byte 0x1c
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00765f5f
-//	DW_AT_type:
-	.4byte 0x000022d8
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x74
-.DWinfo368:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x05e7
-//	DW_AT_decl_column:
-	.byte 0x1c
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x00785f5f
-//	DW_AT_type:
-	.4byte 0x000022d8
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x70
-	.byte 0x00
-	.byte 0x00
-.DWinfo13:
-//	DW_TAG_subprogram:
-	.byte 0x03
-//	DW_AT_decl_line:
-	.2byte 0x057c
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00002764
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x727078655f73736e
-	.byte 0x00
-	.8byte 0x727078655f73736e
-	.byte 0x00
-//	DW_AT_low_pc:
-	.8byte nss_expr
-//	DW_AT_high_pc:
-	.8byte .LNnss_expr
-//	DW_AT_external:
-	.byte 0x00
-.DWinfo369:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x057c
-//	DW_AT_decl_column:
-	.byte 0x24
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002764
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x40
-.DWinfo370:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x057c
-//	DW_AT_decl_column:
-	.byte 0x33
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002764
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x48
-.DWinfo371:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x057d
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002619
-//	DW_AT_name:
-	.4byte 0x72707865
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x50
-.DWinfo372:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x057d
-//	DW_AT_decl_column:
-	.byte 0x1d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002776
-//	DW_AT_name:
-	.4byte 0x74617473
-	.2byte 0x7375
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x58
-.DWinfo373:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x057d
-//	DW_AT_decl_column:
-	.byte 0x29
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_name:
-	.8byte 0x6e6f697469736f70
-	.2byte 0x6c61
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x70
-.DWinfo374:
-//	DW_TAG_lexical_block:
-	.byte 0x05
-//	DW_AT_decl_line:
-	.2byte 0x0589
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.8byte ..LN1277
-//	DW_AT_high_pc:
-	.8byte ..LN1371
-.DWinfo375:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x058a
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x706f
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000024f8
-//	DW_AT_location:
-	.4byte 0x7fa07603
-.DWinfo376:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x058b
-//	DW_AT_decl_column:
-	.byte 0x1d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0065
-//	DW_AT_type:
-	.4byte 0x0000261e
-//	DW_AT_location:
-	.4byte 0x7f907603
-	.byte 0x00
-	.byte 0x00
-.DWinfo12:
-//	DW_TAG_subprogram:
-	.byte 0x03
-//	DW_AT_decl_line:
-	.2byte 0x054f
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00002764
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x72616e755f73736e
-	.4byte 0x78655f79
-	.2byte 0x7270
-	.byte 0x00
-	.8byte 0x72616e755f73736e
-	.4byte 0x78655f79
-	.2byte 0x7270
-	.byte 0x00
-//	DW_AT_low_pc:
-	.8byte nss_unary_expr
-//	DW_AT_high_pc:
-	.8byte .LNnss_unary_expr
-//	DW_AT_external:
-	.byte 0x00
-.DWinfo377:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x054f
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002764
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x48
-.DWinfo378:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x054f
-//	DW_AT_decl_column:
-	.byte 0x39
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002764
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x50
-.DWinfo379:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0550
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002619
-//	DW_AT_name:
-	.4byte 0x72707865
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x58
-.DWinfo380:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0550
-//	DW_AT_decl_column:
-	.byte 0x1d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002776
-//	DW_AT_name:
-	.4byte 0x74617473
-	.2byte 0x7375
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x60
-.DWinfo381:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0550
-//	DW_AT_decl_column:
-	.byte 0x29
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_name:
-	.8byte 0x6e6f697469736f70
-	.2byte 0x6c61
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x70
-.DWinfo382:
-//	DW_TAG_lexical_block:
-	.byte 0x05
-//	DW_AT_decl_line:
-	.2byte 0x0562
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.8byte ..LN1187
-//	DW_AT_high_pc:
-	.8byte ..LN1229
-.DWinfo383:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0563
-//	DW_AT_decl_column:
-	.byte 0x15
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0065
-//	DW_AT_type:
-	.4byte 0x0000261e
-//	DW_AT_location:
-	.4byte 0x7fa07603
-	.byte 0x00
-	.byte 0x00
-.DWinfo11:
-//	DW_TAG_subprogram:
-	.byte 0x03
-//	DW_AT_decl_line:
-	.2byte 0x0509
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00002764
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x6d6972705f73736e
-	.8byte 0x727078655f797261
-	.byte 0x00
-	.8byte 0x6d6972705f73736e
-	.8byte 0x727078655f797261
-	.byte 0x00
-//	DW_AT_low_pc:
-	.8byte nss_primary_expr
-//	DW_AT_high_pc:
-	.8byte .LNnss_primary_expr
-//	DW_AT_external:
-	.byte 0x00
-.DWinfo384:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0509
-//	DW_AT_decl_column:
-	.byte 0x2c
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002764
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x50
-.DWinfo385:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0509
-//	DW_AT_decl_column:
-	.byte 0x3b
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002764
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x58
-.DWinfo386:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x050a
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002619
-//	DW_AT_name:
-	.4byte 0x72707865
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x60
-.DWinfo387:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x050a
-//	DW_AT_decl_column:
-	.byte 0x1d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002776
-//	DW_AT_name:
-	.4byte 0x74617473
-	.2byte 0x7375
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x68
-.DWinfo388:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x050a
-//	DW_AT_decl_column:
-	.byte 0x29
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_name:
-	.8byte 0x6e6f697469736f70
-	.2byte 0x6c61
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x78
-.DWinfo389:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x050c
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0065
-//	DW_AT_type:
-	.4byte 0x0000261e
-//	DW_AT_location:
-	.4byte 0x7fb87603
-	.byte 0x00
-.DWinfo10:
-//	DW_TAG_subprogram:
-	.byte 0x03
-//	DW_AT_decl_line:
-	.2byte 0x04d0
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00002764
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x747361665f73736e
-	.4byte 0x78655f61
-	.2byte 0x7270
-	.byte 0x00
-	.8byte 0x747361665f73736e
-	.4byte 0x78655f61
-	.2byte 0x7270
-	.byte 0x00
-//	DW_AT_low_pc:
-	.8byte nss_fasta_expr
-//	DW_AT_high_pc:
-	.8byte .LNnss_fasta_expr
-//	DW_AT_external:
-	.byte 0x00
-.DWinfo390:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x04d0
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002764
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x50
-.DWinfo391:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x04d0
-//	DW_AT_decl_column:
-	.byte 0x39
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002764
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x58
-.DWinfo392:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x04d1
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002619
-//	DW_AT_name:
-	.4byte 0x72707865
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x60
-.DWinfo393:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x04d1
-//	DW_AT_decl_column:
-	.byte 0x1d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002776
-//	DW_AT_name:
-	.4byte 0x74617473
-	.2byte 0x7375
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x68
-.DWinfo394:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x04d1
-//	DW_AT_decl_column:
-	.byte 0x29
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_name:
-	.8byte 0x6e6f697469736f70
-	.2byte 0x6c61
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x78
-	.byte 0x00
-.DWinfo9:
-//	DW_TAG_subprogram:
-	.byte 0x03
-//	DW_AT_decl_line:
-	.2byte 0x04a6
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00002764
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x545341465f73736e
-	.4byte 0x78655f41
-	.2byte 0x7270
-	.byte 0x00
-	.8byte 0x545341465f73736e
-	.4byte 0x78655f41
-	.2byte 0x7270
-	.byte 0x00
-//	DW_AT_low_pc:
-	.8byte nss_FASTA_expr
-//	DW_AT_high_pc:
-	.8byte .LNnss_FASTA_expr
-//	DW_AT_external:
-	.byte 0x00
-.DWinfo395:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x04a6
-//	DW_AT_decl_column:
-	.byte 0x2a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002764
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x50
-.DWinfo396:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x04a6
-//	DW_AT_decl_column:
-	.byte 0x39
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002764
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x58
-.DWinfo397:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x04a7
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002619
-//	DW_AT_name:
-	.4byte 0x72707865
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x60
-.DWinfo398:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x04a7
-//	DW_AT_decl_column:
-	.byte 0x1d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002776
-//	DW_AT_name:
-	.4byte 0x74617473
-	.2byte 0x7375
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x68
-.DWinfo399:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x04a7
-//	DW_AT_decl_column:
-	.byte 0x29
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_name:
-	.8byte 0x6e6f697469736f70
-	.2byte 0x6c61
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x78
-.DWinfo400:
-//	DW_TAG_lexical_block:
-	.byte 0x05
-//	DW_AT_decl_line:
-	.2byte 0x04ac
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.8byte ..LN817
-//	DW_AT_high_pc:
-	.8byte ..LN887
-.DWinfo401:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x04ad
-//	DW_AT_decl_column:
-	.byte 0x15
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x72617473
-	.2byte 0x0074
-//	DW_AT_type:
-	.4byte 0x00002764
-//	DW_AT_location:
-	.4byte 0x7fb87603
-.DWinfo402:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x04af
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x65707974
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000024f8
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x48
-.DWinfo403:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x04b0
-//	DW_AT_decl_column:
-	.byte 0x17
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x0070616d
-//	DW_AT_type:
-	.4byte 0x0000277b
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x40
-	.byte 0x00
-	.byte 0x00
-.DWinfo8:
-//	DW_TAG_subprogram:
-	.byte 0x03
-//	DW_AT_decl_line:
-	.2byte 0x049c
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00002764
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x00626f735f73736e
-	.8byte 0x00626f735f73736e
-//	DW_AT_low_pc:
-	.8byte nss_sob
-//	DW_AT_high_pc:
-	.8byte .LNnss_sob
-//	DW_AT_external:
-	.byte 0x00
-.DWinfo404:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x049c
-//	DW_AT_decl_column:
-	.byte 0x23
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002764
-//	DW_AT_name:
-	.2byte 0x0070
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x70
-.DWinfo405:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x049c
-//	DW_AT_decl_column:
-	.byte 0x32
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002764
-//	DW_AT_name:
-	.4byte 0x00646e65
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x78
-	.byte 0x00
-.DWinfo7:
-//	DW_TAG_subprogram:
-	.byte 0x03
-//	DW_AT_decl_line:
-	.2byte 0x03f7
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x614672745363754e
-	.8byte 0x4d72707845617473
-	.4byte 0x34656b61
-	.byte 0x00
-	.8byte 0x614672745363754e
-	.8byte 0x4d72707845617473
-	.4byte 0x34656b61
-	.byte 0x00
-//	DW_AT_low_pc:
-	.8byte NucStrFastaExprMake4
-//	DW_AT_high_pc:
-	.8byte .LNNucStrFastaExprMake4
-//	DW_AT_external:
-	.byte 0x00
-.DWinfo406:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x03f7
-//	DW_AT_decl_column:
-	.byte 0x29
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002619
-//	DW_AT_name:
-	.4byte 0x72707865
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x58
-.DWinfo407:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x03f7
-//	DW_AT_decl_column:
-	.byte 0x33
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_name:
-	.8byte 0x6e6f697469736f70
-	.2byte 0x6c61
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x70
-.DWinfo408:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x03f8
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002764
-//	DW_AT_name:
-	.4byte 0x74736166
-	.2byte 0x0061
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x60
-.DWinfo409:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x03f8
-//	DW_AT_decl_column:
-	.byte 0x1f
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x0000246f
-//	DW_AT_name:
-	.4byte 0x657a6973
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x68
-.DWinfo410:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x03fa
-//	DW_AT_decl_column:
-	.byte 0x0c
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0069
-//	DW_AT_type:
-	.4byte 0x0000246f
-//	DW_AT_location:
-	.4byte 0x7fb07603
-.DWinfo411:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x03fb
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0065
-//	DW_AT_type:
-	.4byte 0x0000261e
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x40
-.DWinfo412:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x03fc
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x006e726574746170
-//	DW_AT_type:
-	.4byte 0x00002574
-//	DW_AT_location:
-	.4byte 0x7f907603
-.DWinfo413:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x03fc
-//	DW_AT_decl_column:
-	.byte 0x17
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6b73616d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002574
-//	DW_AT_location:
-	.4byte 0x7fa07603
-.DWinfo414:
-//	DW_TAG_lexical_block:
-	.byte 0x05
-//	DW_AT_decl_line:
-	.2byte 0x040c
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.8byte ..LN493
-//	DW_AT_high_pc:
-	.8byte ..LN603
-.DWinfo415:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x040d
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x65736162
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000022c6
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x50
-	.byte 0x00
-	.byte 0x00
-.DWinfo6:
-//	DW_TAG_subprogram:
-	.byte 0x03
-//	DW_AT_decl_line:
-	.2byte 0x0344
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x614672745363754e
-	.8byte 0x4d72707845617473
-	.4byte 0x32656b61
-	.byte 0x00
-	.8byte 0x614672745363754e
-	.8byte 0x4d72707845617473
-	.4byte 0x32656b61
-	.byte 0x00
-//	DW_AT_low_pc:
-	.8byte NucStrFastaExprMake2
-//	DW_AT_high_pc:
-	.8byte .LNNucStrFastaExprMake2
-//	DW_AT_external:
-	.byte 0x00
-.DWinfo416:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0344
-//	DW_AT_decl_column:
-	.byte 0x29
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002619
-//	DW_AT_name:
-	.4byte 0x72707865
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x50
-.DWinfo417:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0344
-//	DW_AT_decl_column:
-	.byte 0x33
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002509
-//	DW_AT_name:
-	.8byte 0x6e6f697469736f70
-	.2byte 0x6c61
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x70
-.DWinfo418:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0345
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002764
-//	DW_AT_name:
-	.4byte 0x74736166
-	.2byte 0x0061
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x58
-.DWinfo419:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0345
-//	DW_AT_decl_column:
-	.byte 0x1f
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x0000246f
-//	DW_AT_name:
-	.4byte 0x657a6973
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x60
-.DWinfo420:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0347
-//	DW_AT_decl_column:
-	.byte 0x0c
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0069
-//	DW_AT_type:
-	.4byte 0x0000246f
-//	DW_AT_location:
-	.4byte 0x7fb07603
-.DWinfo421:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0348
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0065
-//	DW_AT_type:
-	.4byte 0x0000261e
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x40
-.DWinfo422:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0349
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x006e726574746170
-//	DW_AT_type:
-	.4byte 0x00002574
-//	DW_AT_location:
-	.4byte 0x7f907603
-.DWinfo423:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0349
-//	DW_AT_decl_column:
-	.byte 0x17
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6b73616d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002574
-//	DW_AT_location:
-	.4byte 0x7fa07603
-.DWinfo424:
-//	DW_TAG_lexical_block:
-	.byte 0x05
-//	DW_AT_decl_line:
-	.2byte 0x0359
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.8byte ..LN109
-//	DW_AT_high_pc:
-	.8byte ..LN219
-.DWinfo425:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x035a
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x65736162
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000025dc
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x68
-	.byte 0x00
-	.byte 0x00
-.DWinfo4:
-//	DW_TAG_subprogram:
-	.byte 0x03
-//	DW_AT_decl_line:
-	.2byte 0x0136
-//	DW_AT_decl_column:
-	.byte 0x06
-//	DW_AT_decl_file:
-	.byte 0x01
-//	DW_AT_inline:
-	.byte 0x02
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x000022ea
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x5f383231746e6975
-	.8byte 0x6f635f7061777362
-	.2byte 0x7970
-	.byte 0x00
-	.8byte 0x5f383231746e6975
-	.8byte 0x6f635f7061777362
-	.2byte 0x7970
-	.byte 0x00
-//	DW_AT_low_pc:
-	.8byte uint128_bswap_copy
-//	DW_AT_high_pc:
-	.8byte .LNuint128_bswap_copy
-//	DW_AT_external:
-	.byte 0x00
-.DWinfo426:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0136
-//	DW_AT_decl_column:
-	.byte 0x26
-//	DW_AT_decl_file:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00002347
-//	DW_AT_name:
-	.2byte 0x6f74
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x70
-.DWinfo427:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0136
-//	DW_AT_decl_column:
-	.byte 0x3b
-//	DW_AT_decl_file:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x000023d1
-//	DW_AT_name:
-	.4byte 0x6d6f7266
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x78
-	.byte 0x00
-.DWinfo3:
-//	DW_TAG_subprogram:
-	.byte 0x03
-//	DW_AT_decl_line:
-	.2byte 0x0125
-//	DW_AT_decl_column:
-	.byte 0x06
-//	DW_AT_decl_file:
-	.byte 0x01
-//	DW_AT_inline:
-	.byte 0x02
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x000022ea
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x5f383231746e6975
-	.4byte 0x61777362
-	.2byte 0x0070
-	.8byte 0x5f383231746e6975
-	.4byte 0x61777362
-	.2byte 0x0070
-//	DW_AT_low_pc:
-	.8byte uint128_bswap
-//	DW_AT_high_pc:
-	.8byte .LNuint128_bswap
-//	DW_AT_external:
-	.byte 0x00
-.DWinfo428:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0125
-//	DW_AT_decl_column:
-	.byte 0x21
-//	DW_AT_decl_file:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00002347
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x70
-	.byte 0x00
-.DWinfo429:
-//	DW_TAG_base_type:
-	.byte 0x07
-//	DW_AT_byte_size:
-	.byte 0x02
-//	DW_AT_encoding:
-	.byte 0x05
-//	DW_AT_name:
-	.4byte 0x726f6873
-	.2byte 0x0074
-.DWinfo1:
-//	DW_TAG_subprogram:
-	.byte 0x08
-//	DW_AT_decl_line:
-	.byte 0x25
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x01
-//	DW_AT_inline:
-	.byte 0x02
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x000000d5
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x6c5f3631746e6975
-	.4byte 0x74696273
-	.byte 0x00
-	.8byte 0x6c5f3631746e6975
-	.4byte 0x74696273
-	.byte 0x00
-//	DW_AT_low_pc:
-	.8byte uint16_lsbit
-//	DW_AT_high_pc:
-	.8byte .LNuint16_lsbit
-//	DW_AT_external:
-	.byte 0x00
-.DWinfo430:
-//	DW_TAG_formal_parameter:
-	.byte 0x09
-//	DW_AT_decl_line:
-	.byte 0x25
-//	DW_AT_decl_column:
-	.byte 0x21
-//	DW_AT_decl_file:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x000022c6
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x78
-.DWinfo431:
-//	DW_TAG_variable:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.byte 0x27
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x01
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x006e7472
-//	DW_AT_type:
-	.4byte 0x000000d5
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x70
-	.byte 0x00
-.DWinfo432:
-//	DW_TAG_typedef:
-	.byte 0x02
-//	DW_AT_decl_line:
-	.byte 0x32
-//	DW_AT_decl_column:
-	.byte 0x1c
-//	DW_AT_decl_file:
-	.byte 0x02
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x745f3631746e6975
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000022d8
-.DWinfo433:
-//	DW_TAG_base_type:
-	.byte 0x07
-//	DW_AT_byte_size:
-	.byte 0x02
-//	DW_AT_encoding:
-	.byte 0x07
-//	DW_AT_name:
-	.8byte 0x64656e6769736e75
-	.4byte 0x6f687320
-	.2byte 0x7472
-	.byte 0x00
-.DWinfo434:
-//	DW_TAG_base_type:
-	.byte 0x07
-//	DW_AT_byte_size:
-	.byte 0x00
-//	DW_AT_encoding:
-	.byte 0x05
-//	DW_AT_name:
-	.4byte 0x64696f76
-	.byte 0x00
-.DWinfo2:
-//	DW_TAG_subprogram:
-	.byte 0x03
-//	DW_AT_decl_line:
-	.2byte 0x0105
-//	DW_AT_decl_column:
-	.byte 0x06
-//	DW_AT_decl_file:
-	.byte 0x01
-//	DW_AT_inline:
-	.byte 0x02
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x000022ea
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x5f383231746e6975
-	.4byte 0x00726873
-	.8byte 0x5f383231746e6975
-	.4byte 0x00726873
-//	DW_AT_low_pc:
-	.8byte uint128_shr
-//	DW_AT_high_pc:
-	.8byte .LNuint128_shr
-//	DW_AT_external:
-	.byte 0x00
-.DWinfo435:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0105
-//	DW_AT_decl_column:
-	.byte 0x1f
-//	DW_AT_decl_file:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x00002347
-//	DW_AT_name:
-	.4byte 0x666c6573
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x70
-.DWinfo436:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0105
-//	DW_AT_decl_column:
-	.byte 0x2e
-//	DW_AT_decl_file:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x000023af
-//	DW_AT_name:
-	.2byte 0x0069
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x78
-	.byte 0x00
-.DWinfo437:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x0000234c
-.DWinfo438:
-//	DW_TAG_typedef:
-	.byte 0x02
-//	DW_AT_decl_line:
-	.byte 0x63
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x01
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x5f383231746e6975
-	.2byte 0x0074
-//	DW_AT_type:
-	.4byte 0x0000235f
-.DWinfo439:
-//	DW_TAG_structure_type:
-	.byte 0x0c
-//	DW_AT_decl_line:
-	.byte 0x64
-//	DW_AT_decl_column:
-	.byte 0x08
-//	DW_AT_decl_file:
-	.byte 0x01
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_byte_size:
-	.byte 0x10
-//	DW_AT_name:
-	.8byte 0x5f383231746e6975
-	.2byte 0x0074
-.DWinfo440:
-//	DW_TAG_member:
-	.byte 0x0d
-//	DW_AT_decl_line:
-	.byte 0x66
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x01
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x00
-//	DW_AT_name:
-	.2byte 0x6f6c
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x0000238c
-.DWinfo441:
-//	DW_TAG_member:
-	.byte 0x0d
-//	DW_AT_decl_line:
-	.byte 0x67
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x01
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x08
-//	DW_AT_name:
-	.2byte 0x6968
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x0000238c
-	.byte 0x00
-.DWinfo442:
-//	DW_TAG_typedef:
-	.byte 0x02
-//	DW_AT_decl_line:
-	.byte 0x38
-//	DW_AT_decl_column:
-	.byte 0x1b
-//	DW_AT_decl_file:
-	.byte 0x02
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x745f3436746e6975
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x0000239e
-.DWinfo443:
-//	DW_TAG_base_type:
-	.byte 0x07
-//	DW_AT_byte_size:
-	.byte 0x08
-//	DW_AT_encoding:
-	.byte 0x07
-//	DW_AT_name:
-	.8byte 0x64656e6769736e75
-	.4byte 0x6e6f6c20
-	.2byte 0x0067
-.DWinfo444:
-//	DW_TAG_typedef:
-	.byte 0x02
-//	DW_AT_decl_line:
-	.byte 0x34
-//	DW_AT_decl_column:
-	.byte 0x17
-//	DW_AT_decl_file:
-	.byte 0x02
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x745f3233746e6975
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023c1
-.DWinfo445:
-//	DW_TAG_base_type:
-	.byte 0x07
-//	DW_AT_byte_size:
-	.byte 0x04
-//	DW_AT_encoding:
-	.byte 0x07
-//	DW_AT_name:
-	.8byte 0x64656e6769736e75
-	.4byte 0x746e6920
-	.byte 0x00
-.DWinfo446:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x000023d6
-.DWinfo447:
-//	DW_TAG_const_type:
-	.byte 0x0e
-//	DW_AT_type:
-	.4byte 0x0000234c
-.DWinfo448:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x000022ea
-.DWinfo5:
-//	DW_TAG_subprogram:
-	.byte 0x03
-//	DW_AT_decl_line:
-	.2byte 0x0315
-//	DW_AT_decl_column:
-	.byte 0x07
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x00
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x000023db
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x614672745363754e
-	.8byte 0x4172707845617473
-	.4byte 0x636f6c6c
-	.byte 0x00
-	.8byte 0x614672745363754e
-	.8byte 0x4172707845617473
-	.4byte 0x636f6c6c
-	.byte 0x00
-//	DW_AT_low_pc:
-	.8byte NucStrFastaExprAlloc
-//	DW_AT_high_pc:
-	.8byte .LNNucStrFastaExprAlloc
-//	DW_AT_external:
-	.byte 0x00
-.DWinfo449:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0315
-//	DW_AT_decl_column:
-	.byte 0x25
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x0000246f
-//	DW_AT_name:
-	.2byte 0x7a73
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x68
-.DWinfo450:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0317
-//	DW_AT_decl_column:
-	.byte 0x0b
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x6574756f
-	.2byte 0x0072
-//	DW_AT_type:
-	.4byte 0x000023db
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x70
-.DWinfo451:
-//	DW_TAG_lexical_block:
-	.byte 0x05
-//	DW_AT_decl_line:
-	.2byte 0x0319
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_low_pc:
-	.8byte ..LN45
-//	DW_AT_high_pc:
-	.8byte ..LN59
-.DWinfo452:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x031a
-//	DW_AT_decl_column:
-	.byte 0x1a
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.2byte 0x0065
-//	DW_AT_type:
-	.4byte 0x0000247f
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x60
-	.byte 0x00
-	.byte 0x00
-.DWinfo453:
-//	DW_TAG_typedef:
-	.byte 0x02
-//	DW_AT_decl_line:
-	.byte 0x32
-//	DW_AT_decl_column:
-	.byte 0x17
-//	DW_AT_decl_file:
-	.byte 0x04
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x657a6973
-	.2byte 0x745f
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x0000239e
-.DWinfo454:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x00002484
-.DWinfo455:
-//	DW_TAG_typedef:
-	.byte 0x0f
-//	DW_AT_decl_line:
-	.2byte 0x02fa
-//	DW_AT_decl_column:
-	.byte 0x20
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x614672745363754e
-	.8byte 0x0072707845617473
-//	DW_AT_type:
-	.4byte 0x0000249e
-.DWinfo456:
-//	DW_TAG_structure_type:
-	.byte 0x10
-//	DW_AT_decl_line:
-	.2byte 0x02fb
-//	DW_AT_decl_column:
-	.byte 0x08
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_byte_size:
-	.byte 0x90
-//	DW_AT_name:
-	.8byte 0x614672745363754e
-	.8byte 0x0072707845617473
-.DWinfo457:
-//	DW_TAG_member:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x02fd
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x00
-//	DW_AT_name:
-	.4byte 0x65707974
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000024f8
-.DWinfo458:
-//	DW_TAG_member:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x02fe
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x04
-//	DW_AT_name:
-	.4byte 0x657a6973
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000023af
-.DWinfo459:
-//	DW_TAG_member:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0307
-//	DW_AT_decl_column:
-	.byte 0x07
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x08
-//	DW_AT_name:
-	.2byte 0x0075
-//	DW_AT_type:
-	.4byte 0x00002510
-.DWinfo460:
-//	DW_TAG_member:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x030d
-//	DW_AT_decl_column:
-	.byte 0x07
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x10
-//	DW_AT_name:
-	.4byte 0x72657571
-	.2byte 0x0079
-//	DW_AT_type:
-	.4byte 0x0000253e
-	.byte 0x00
-.DWinfo461:
-//	DW_TAG_typedef:
-	.byte 0x02
-//	DW_AT_decl_line:
-	.byte 0x27
-//	DW_AT_decl_column:
-	.byte 0x0f
-//	DW_AT_decl_file:
-	.byte 0x02
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x00745f3233746e69
-//	DW_AT_type:
-	.4byte 0x00002509
-.DWinfo462:
-//	DW_TAG_base_type:
-	.byte 0x07
-//	DW_AT_byte_size:
-	.byte 0x04
-//	DW_AT_encoding:
-	.byte 0x05
-//	DW_AT_name:
-	.4byte 0x00746e69
-.DWinfo463:
-//	DW_TAG_union_type:
-	.byte 0x12
-//	DW_AT_decl_line:
-	.2byte 0x0301
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_byte_size:
-	.byte 0x08
-.DWinfo464:
-//	DW_TAG_member:
-	.byte 0x13
-//	DW_AT_decl_line:
-	.2byte 0x0305
-//	DW_AT_decl_column:
-	.byte 0x0f
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x00
-//	DW_AT_name:
-	.4byte 0x6574756f
-	.2byte 0x0072
-//	DW_AT_type:
-	.4byte 0x000023db
-.DWinfo465:
-//	DW_TAG_member:
-	.byte 0x13
-//	DW_AT_decl_line:
-	.2byte 0x0306
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x00
-//	DW_AT_name:
-	.4byte 0x67696c61
-	.2byte 0x006e
-//	DW_AT_type:
-	.4byte 0x0000238c
-	.byte 0x00
-.DWinfo466:
-//	DW_TAG_array_type:
-	.byte 0x14
-//	DW_AT_type:
-	.4byte 0x00002547
-//	DW_AT_byte_size:
-	.byte 0x80
-.DWinfo467:
-//	DW_TAG_subrange_type:
-	.byte 0x15
-//	DW_AT_upper_bound:
-	.byte 0x03
-	.byte 0x00
-.DWinfo468:
-//	DW_TAG_structure_type:
-	.byte 0x16
-//	DW_AT_decl_line:
-	.2byte 0x030a
-//	DW_AT_decl_column:
-	.byte 0x05
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_byte_size:
-	.byte 0x20
-.DWinfo469:
-//	DW_TAG_member:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x030b
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x00
-//	DW_AT_name:
-	.8byte 0x006e726574746170
-//	DW_AT_type:
-	.4byte 0x00002574
-.DWinfo470:
-//	DW_TAG_member:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x030c
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x10
-//	DW_AT_name:
-	.4byte 0x6b73616d
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002574
-	.byte 0x00
-.DWinfo471:
-//	DW_TAG_typedef:
-	.byte 0x02
-//	DW_AT_decl_line:
-	.byte 0x48
-//	DW_AT_decl_column:
-	.byte 0x03
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x745f74617063756e
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002586
-.DWinfo472:
-//	DW_TAG_union_type:
-	.byte 0x17
-//	DW_AT_decl_line:
-	.byte 0x42
-//	DW_AT_decl_column:
-	.byte 0x01
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_byte_size:
-	.byte 0x10
-.DWinfo473:
-//	DW_TAG_member:
-	.byte 0x18
-//	DW_AT_decl_line:
-	.byte 0x43
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x00
-//	DW_AT_name:
-	.2byte 0x0062
-//	DW_AT_type:
-	.4byte 0x000025d3
-.DWinfo474:
-//	DW_TAG_member:
-	.byte 0x18
-//	DW_AT_decl_line:
-	.byte 0x44
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x00
-//	DW_AT_name:
-	.2byte 0x0077
-//	DW_AT_type:
-	.4byte 0x000025fe
-.DWinfo475:
-//	DW_TAG_member:
-	.byte 0x18
-//	DW_AT_decl_line:
-	.byte 0x45
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x00
-//	DW_AT_name:
-	.2byte 0x0069
-//	DW_AT_type:
-	.4byte 0x00002607
-.DWinfo476:
-//	DW_TAG_member:
-	.byte 0x18
-//	DW_AT_decl_line:
-	.byte 0x46
-//	DW_AT_decl_column:
-	.byte 0x0e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x00
-//	DW_AT_name:
-	.2byte 0x006c
-//	DW_AT_type:
-	.4byte 0x00002610
-.DWinfo477:
-//	DW_TAG_member:
-	.byte 0x18
-//	DW_AT_decl_line:
-	.byte 0x47
-//	DW_AT_decl_column:
-	.byte 0x0f
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x00
-//	DW_AT_name:
-	.2byte 0x0073
-//	DW_AT_type:
-	.4byte 0x0000234c
-	.byte 0x00
-.DWinfo478:
-//	DW_TAG_array_type:
-	.byte 0x14
-//	DW_AT_type:
-	.4byte 0x000025dc
-//	DW_AT_byte_size:
-	.byte 0x10
-.DWinfo479:
-//	DW_TAG_subrange_type:
-	.byte 0x15
-//	DW_AT_upper_bound:
-	.byte 0x0f
-	.byte 0x00
-.DWinfo480:
-//	DW_TAG_typedef:
-	.byte 0x02
-//	DW_AT_decl_line:
-	.byte 0x31
-//	DW_AT_decl_column:
-	.byte 0x18
-//	DW_AT_decl_file:
-	.byte 0x02
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x00745f38746e6975
-//	DW_AT_type:
-	.4byte 0x000025ed
-.DWinfo481:
-//	DW_TAG_base_type:
-	.byte 0x07
-//	DW_AT_byte_size:
-	.byte 0x01
-//	DW_AT_encoding:
-	.byte 0x08
-//	DW_AT_name:
-	.8byte 0x64656e6769736e75
-	.4byte 0x61686320
-	.2byte 0x0072
-.DWinfo482:
-//	DW_TAG_array_type:
-	.byte 0x14
-//	DW_AT_type:
-	.4byte 0x000022c6
-//	DW_AT_byte_size:
-	.byte 0x10
-.DWinfo483:
-//	DW_TAG_subrange_type:
-	.byte 0x15
-//	DW_AT_upper_bound:
-	.byte 0x07
-	.byte 0x00
-.DWinfo484:
-//	DW_TAG_array_type:
-	.byte 0x14
-//	DW_AT_type:
-	.4byte 0x000023af
-//	DW_AT_byte_size:
-	.byte 0x10
-.DWinfo485:
-//	DW_TAG_subrange_type:
-	.byte 0x15
-//	DW_AT_upper_bound:
-	.byte 0x03
-	.byte 0x00
-.DWinfo486:
-//	DW_TAG_array_type:
-	.byte 0x14
-//	DW_AT_type:
-	.4byte 0x0000238c
-//	DW_AT_byte_size:
-	.byte 0x10
-.DWinfo487:
-//	DW_TAG_subrange_type:
-	.byte 0x15
-//	DW_AT_upper_bound:
-	.byte 0x01
-	.byte 0x00
-.DWinfo488:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x0000261e
-.DWinfo489:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x00002623
-.DWinfo490:
-//	DW_TAG_typedef:
-	.byte 0x0f
-//	DW_AT_decl_line:
-	.2byte 0x02df
-//	DW_AT_decl_column:
-	.byte 0x13
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x784572745363754e
-	.2byte 0x7270
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x00002638
-.DWinfo491:
-//	DW_TAG_typedef:
-	.byte 0x02
-//	DW_AT_decl_line:
-	.byte 0x44
-//	DW_AT_decl_column:
-	.byte 0x19
-//	DW_AT_decl_file:
-	.byte 0x05
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x747372745363754e
-	.2byte 0x0072
-//	DW_AT_type:
-	.4byte 0x0000264b
-.DWinfo492:
-//	DW_TAG_union_type:
-	.byte 0x19
-//	DW_AT_decl_line:
-	.2byte 0x0339
-//	DW_AT_decl_column:
-	.byte 0x08
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_byte_size:
-	.byte 0x90
-//	DW_AT_name:
-	.8byte 0x747372745363754e
-	.2byte 0x0072
-.DWinfo493:
-//	DW_TAG_member:
-	.byte 0x13
-//	DW_AT_decl_line:
-	.2byte 0x033b
-//	DW_AT_decl_column:
-	.byte 0x15
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x00
-//	DW_AT_name:
-	.4byte 0x74736166
-	.2byte 0x0061
-//	DW_AT_type:
-	.4byte 0x00002484
-.DWinfo494:
-//	DW_TAG_member:
-	.byte 0x13
-//	DW_AT_decl_line:
-	.2byte 0x033c
-//	DW_AT_decl_column:
-	.byte 0x12
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x00
-//	DW_AT_name:
-	.8byte 0x006e61656c6f6f62
-//	DW_AT_type:
-	.4byte 0x00002696
-.DWinfo495:
-//	DW_TAG_member:
-	.byte 0x13
-//	DW_AT_decl_line:
-	.2byte 0x033d
-//	DW_AT_decl_column:
-	.byte 0x13
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x00
-//	DW_AT_name:
-	.4byte 0x00627573
-//	DW_AT_type:
-	.4byte 0x00002705
-	.byte 0x00
-.DWinfo496:
-//	DW_TAG_typedef:
-	.byte 0x0f
-//	DW_AT_decl_line:
-	.2byte 0x0328
-//	DW_AT_decl_column:
-	.byte 0x1d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x704f72745363754e
-	.4byte 0x72707845
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000026ad
-.DWinfo497:
-//	DW_TAG_structure_type:
-	.byte 0x10
-//	DW_AT_decl_line:
-	.2byte 0x0329
-//	DW_AT_decl_column:
-	.byte 0x08
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_byte_size:
-	.byte 0x18
-//	DW_AT_name:
-	.8byte 0x704f72745363754e
-	.4byte 0x72707845
-	.byte 0x00
-.DWinfo498:
-//	DW_TAG_member:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x032b
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x00
-//	DW_AT_name:
-	.4byte 0x65707974
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000024f8
-.DWinfo499:
-//	DW_TAG_member:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x032c
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x04
-//	DW_AT_name:
-	.2byte 0x706f
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000024f8
-.DWinfo500:
-//	DW_TAG_member:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x032d
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x08
-//	DW_AT_name:
-	.4byte 0x7466656c
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x0000261e
-.DWinfo501:
-//	DW_TAG_member:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x032e
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x10
-//	DW_AT_name:
-	.4byte 0x68676972
-	.2byte 0x0074
-//	DW_AT_type:
-	.4byte 0x0000261e
-	.byte 0x00
-.DWinfo502:
-//	DW_TAG_typedef:
-	.byte 0x0f
-//	DW_AT_decl_line:
-	.2byte 0x0331
-//	DW_AT_decl_column:
-	.byte 0x1e
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x755372745363754e
-	.4byte 0x70784562
-	.2byte 0x0072
-//	DW_AT_type:
-	.4byte 0x0000271d
-.DWinfo503:
-//	DW_TAG_structure_type:
-	.byte 0x10
-//	DW_AT_decl_line:
-	.2byte 0x0332
-//	DW_AT_decl_column:
-	.byte 0x08
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_byte_size:
-	.byte 0x10
-//	DW_AT_name:
-	.8byte 0x755372745363754e
-	.4byte 0x70784562
-	.2byte 0x0072
-.DWinfo504:
-//	DW_TAG_member:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0334
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x00
-//	DW_AT_name:
-	.4byte 0x65707974
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000024f8
-.DWinfo505:
-//	DW_TAG_member:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0335
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x04
-//	DW_AT_name:
-	.2byte 0x706f
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x000024f8
-.DWinfo506:
-//	DW_TAG_member:
-	.byte 0x11
-//	DW_AT_decl_line:
-	.2byte 0x0336
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_data_member_location:
-	.2byte 0x2302
-	.byte 0x08
-//	DW_AT_name:
-	.4byte 0x72707865
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x0000261e
-	.byte 0x00
-.DWinfo507:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x00002769
-.DWinfo508:
-//	DW_TAG_const_type:
-	.byte 0x0e
-//	DW_AT_type:
-	.4byte 0x0000276e
-.DWinfo509:
-//	DW_TAG_base_type:
-	.byte 0x07
-//	DW_AT_byte_size:
-	.byte 0x01
-//	DW_AT_encoding:
-	.byte 0x06
-//	DW_AT_name:
-	.4byte 0x72616863
-	.byte 0x00
-.DWinfo510:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x00002509
-.DWinfo511:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x00002780
-.DWinfo512:
-//	DW_TAG_const_type:
-	.byte 0x0e
-//	DW_AT_type:
-	.4byte 0x00002785
-.DWinfo513:
-//	DW_TAG_typedef:
-	.byte 0x02
-//	DW_AT_decl_line:
-	.byte 0x25
-//	DW_AT_decl_column:
-	.byte 0x16
-//	DW_AT_decl_file:
-	.byte 0x02
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x38746e69
-	.2byte 0x745f
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x0000276e
-.DWinfo514:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x0000279a
-.DWinfo515:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x00002638
-.DWinfo516:
-//	DW_TAG_typedef:
-	.byte 0x02
-//	DW_AT_decl_line:
-	.byte 0x2b
-//	DW_AT_decl_column:
-	.byte 0x36
-//	DW_AT_decl_file:
-	.byte 0x06
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x00693832316d5f5f
-//	DW_AT_type:
-	.4byte 0x000027b0
-.DWinfo517:
-//	DW_TAG_array_type:
-	.byte 0x1a
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x00693832316d5f5f
-//	DW_AT_type:
-	.4byte 0x000027cc
-//	DW_AT_byte_size:
-	.byte 0x10
-.DWinfo518:
-//	DW_TAG_subrange_type:
-	.byte 0x1b
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x00693832316d5f5f
-//	DW_AT_upper_bound:
-	.byte 0x01
-//	DW_AT_lower_bound:
-	.byte 0x00
-	.byte 0x00
-.DWinfo519:
-//	DW_TAG_base_type:
-	.byte 0x07
-//	DW_AT_byte_size:
-	.byte 0x08
-//	DW_AT_encoding:
-	.byte 0x07
-//	DW_AT_name:
-	.8byte 0x64656e6769736e75
-	.8byte 0x6f6c20676e6f6c20
-	.2byte 0x676e
-	.byte 0x00
-.DWinfo17:
-//	DW_TAG_subprogram:
-	.byte 0x03
-//	DW_AT_decl_line:
-	.2byte 0x0850
-//	DW_AT_decl_column:
-	.byte 0x09
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_inline:
-	.byte 0x02
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_type:
-	.4byte 0x0000279f
-//	DW_AT_prototyped:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x75625f656d697270
-	.8byte 0x616e325f72656666
-	.byte 0x00
-	.8byte 0x75625f656d697270
-	.8byte 0x616e325f72656666
-	.byte 0x00
-//	DW_AT_low_pc:
-	.8byte prime_buffer_2na
-//	DW_AT_high_pc:
-	.8byte .LNprime_buffer_2na
-//	DW_AT_external:
-	.byte 0x00
-.DWinfo520:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0850
-//	DW_AT_decl_column:
-	.byte 0x2b
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_name:
-	.4byte 0x00637273
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x70
-.DWinfo521:
-//	DW_TAG_formal_parameter:
-	.byte 0x04
-//	DW_AT_decl_line:
-	.2byte 0x0850
-//	DW_AT_decl_column:
-	.byte 0x3f
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_type:
-	.4byte 0x00002859
-//	DW_AT_name:
-	.4byte 0x6f6e6769
-	.2byte 0x6572
-	.byte 0x00
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x78
-.DWinfo522:
-//	DW_TAG_variable:
-	.byte 0x06
-//	DW_AT_decl_line:
-	.2byte 0x0852
-//	DW_AT_decl_column:
-	.byte 0x0d
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.4byte 0x66667562
-	.2byte 0x7265
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x0000279f
-//	DW_AT_location:
-	.2byte 0x7602
-	.byte 0x60
-	.byte 0x00
-.DWinfo523:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x0000285e
-.DWinfo524:
-//	DW_TAG_const_type:
-	.byte 0x0e
-//	DW_AT_type:
-	.4byte 0x000025dc
-.DWinfo525:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x00002868
-.DWinfo526:
-//	DW_TAG_const_type:
-	.byte 0x0e
-//	DW_AT_type:
-	.4byte 0x00002484
-.DWinfo527:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x00002872
-.DWinfo528:
-//	DW_TAG_const_type:
-	.byte 0x0e
-//	DW_AT_type:
-	.4byte 0x000022ea
-.DWinfo529:
-//	DW_TAG_typedef:
-	.byte 0x02
-//	DW_AT_decl_line:
-	.byte 0x40
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x745f67657263756e
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x0000279f
-.DWinfo530:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x0000288e
-.DWinfo531:
-//	DW_TAG_const_type:
-	.byte 0x0e
-//	DW_AT_type:
-	.4byte 0x00002638
-.DWinfo532:
-//	DW_TAG_pointer_type:
-	.byte 0x0b
-//	DW_AT_type:
-	.4byte 0x000023c1
-.DWinfo533:
-//	DW_TAG_variable:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.byte 0x5a
-//	DW_AT_decl_column:
-	.byte 0x0f
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x6e325f6174736166
-	.4byte 0x616d5f61
-	.2byte 0x0070
-//	DW_AT_type:
-	.4byte 0x000028b9
-//	DW_AT_location:
-	.2byte 0x0309
-	.8byte fasta_2na_map.0
-.DWinfo534:
-//	DW_TAG_array_type:
-	.byte 0x14
-//	DW_AT_type:
-	.4byte 0x00002785
-//	DW_AT_byte_size:
-	.byte 0x80
-.DWinfo535:
-//	DW_TAG_subrange_type:
-	.byte 0x15
-//	DW_AT_upper_bound:
-	.byte 0x7f
-	.byte 0x00
-.DWinfo536:
-//	DW_TAG_variable:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.byte 0x5b
-//	DW_AT_decl_column:
-	.byte 0x0f
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x6e345f6174736166
-	.4byte 0x616d5f61
-	.2byte 0x0070
-//	DW_AT_type:
-	.4byte 0x000028e3
-//	DW_AT_location:
-	.2byte 0x0309
-	.8byte fasta_4na_map.0
-.DWinfo537:
-//	DW_TAG_array_type:
-	.byte 0x14
-//	DW_AT_type:
-	.4byte 0x00002785
-//	DW_AT_byte_size:
-	.byte 0x80
-.DWinfo538:
-//	DW_TAG_subrange_type:
-	.byte 0x15
-//	DW_AT_upper_bound:
-	.byte 0x7f
-	.byte 0x00
-.DWinfo539:
-//	DW_TAG_variable:
-	.byte 0x0a
-//	DW_AT_decl_line:
-	.byte 0x5c
-//	DW_AT_decl_column:
-	.byte 0x11
-//	DW_AT_decl_file:
-	.byte 0x03
-//	DW_AT_accessibility:
-	.byte 0x01
-//	DW_AT_name:
-	.8byte 0x325f646e61707865
-	.2byte 0x616e
-	.byte 0x00
-//	DW_AT_type:
-	.4byte 0x0000290a
-//	DW_AT_location:
-	.2byte 0x0309
-	.8byte expand_2na.0
-.DWinfo540:
-//	DW_TAG_array_type:
-	.byte 0x1c
-//	DW_AT_type:
-	.4byte 0x000022c6
-//	DW_AT_byte_size:
-	.2byte 0x0200
-.DWinfo541:
-//	DW_TAG_subrange_type:
-	.byte 0x1d
-//	DW_AT_upper_bound:
-	.2byte 0x00ff
-	.byte 0x00
-	.byte 0x00
-	.byte 0x00
-	.byte 0x00
-	.byte 0x00
-// -- Begin DWARF2 SEGMENT .debug_line
-	.section .debug_line
-.debug_line_seg:
-	.align 1
-// -- Begin DWARF2 SEGMENT .debug_abbrev
-	.section .debug_abbrev
-.debug_abbrev_seg:
-	.align 1
-	.byte 0x01
-	.byte 0x11
-	.byte 0x01
-	.byte 0x1b
-	.byte 0x08
-	.byte 0x13
-	.byte 0x0b
-	.byte 0x03
-	.byte 0x08
-	.byte 0x25
-	.byte 0x08
-	.byte 0x10
-	.byte 0x06
-	.2byte 0x0000
-	.byte 0x02
-	.byte 0x16
-	.byte 0x00
-	.byte 0x3b
-	.byte 0x0b
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x03
-	.byte 0x08
-	.byte 0x49
-	.byte 0x13
-	.2byte 0x0000
-	.byte 0x03
-	.byte 0x2e
-	.byte 0x01
-	.byte 0x3b
-	.byte 0x05
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x20
-	.byte 0x0b
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x49
-	.byte 0x13
-	.byte 0x27
-	.byte 0x0c
-	.byte 0x03
-	.byte 0x08
-	.2byte 0x4087
-	.byte 0x08
-	.byte 0x11
-	.byte 0x01
-	.byte 0x12
-	.byte 0x01
-	.byte 0x3f
-	.byte 0x0c
-	.2byte 0x0000
-	.byte 0x04
-	.byte 0x05
-	.byte 0x00
-	.byte 0x3b
-	.byte 0x05
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x49
-	.byte 0x13
-	.byte 0x03
-	.byte 0x08
-	.byte 0x02
-	.byte 0x0a
-	.2byte 0x0000
-	.byte 0x05
-	.byte 0x0b
-	.byte 0x01
-	.byte 0x3b
-	.byte 0x05
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x11
-	.byte 0x01
-	.byte 0x12
-	.byte 0x01
-	.2byte 0x0000
-	.byte 0x06
-	.byte 0x34
-	.byte 0x00
-	.byte 0x3b
-	.byte 0x05
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x03
-	.byte 0x08
-	.byte 0x49
-	.byte 0x13
-	.byte 0x02
-	.byte 0x0a
-	.2byte 0x0000
-	.byte 0x07
-	.byte 0x24
-	.byte 0x00
-	.byte 0x0b
-	.byte 0x0b
-	.byte 0x3e
-	.byte 0x0b
-	.byte 0x03
-	.byte 0x08
-	.2byte 0x0000
-	.byte 0x08
-	.byte 0x2e
-	.byte 0x01
-	.byte 0x3b
-	.byte 0x0b
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x20
-	.byte 0x0b
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x49
-	.byte 0x13
-	.byte 0x27
-	.byte 0x0c
-	.byte 0x03
-	.byte 0x08
-	.2byte 0x4087
-	.byte 0x08
-	.byte 0x11
-	.byte 0x01
-	.byte 0x12
-	.byte 0x01
-	.byte 0x3f
-	.byte 0x0c
-	.2byte 0x0000
-	.byte 0x09
-	.byte 0x05
-	.byte 0x00
-	.byte 0x3b
-	.byte 0x0b
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x49
-	.byte 0x13
-	.byte 0x03
-	.byte 0x08
-	.byte 0x02
-	.byte 0x0a
-	.2byte 0x0000
-	.byte 0x0a
-	.byte 0x34
-	.byte 0x00
-	.byte 0x3b
-	.byte 0x0b
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x03
-	.byte 0x08
-	.byte 0x49
-	.byte 0x13
-	.byte 0x02
-	.byte 0x0a
-	.2byte 0x0000
-	.byte 0x0b
-	.byte 0x0f
-	.byte 0x00
-	.byte 0x49
-	.byte 0x13
-	.2byte 0x0000
-	.byte 0x0c
-	.byte 0x13
-	.byte 0x01
-	.byte 0x3b
-	.byte 0x0b
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x0b
-	.byte 0x0b
-	.byte 0x03
-	.byte 0x08
-	.2byte 0x0000
-	.byte 0x0d
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x3b
-	.byte 0x0b
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x38
-	.byte 0x0a
-	.byte 0x03
-	.byte 0x08
-	.byte 0x49
-	.byte 0x13
-	.2byte 0x0000
-	.byte 0x0e
-	.byte 0x26
-	.byte 0x00
-	.byte 0x49
-	.byte 0x13
-	.2byte 0x0000
-	.byte 0x0f
-	.byte 0x16
-	.byte 0x00
-	.byte 0x3b
-	.byte 0x05
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x03
-	.byte 0x08
-	.byte 0x49
-	.byte 0x13
-	.2byte 0x0000
-	.byte 0x10
-	.byte 0x13
-	.byte 0x01
-	.byte 0x3b
-	.byte 0x05
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x0b
-	.byte 0x0b
-	.byte 0x03
-	.byte 0x08
-	.2byte 0x0000
-	.byte 0x11
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x3b
-	.byte 0x05
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x38
-	.byte 0x0a
-	.byte 0x03
-	.byte 0x08
-	.byte 0x49
-	.byte 0x13
-	.2byte 0x0000
-	.byte 0x12
-	.byte 0x17
-	.byte 0x01
-	.byte 0x3b
-	.byte 0x05
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x0b
-	.byte 0x0b
-	.2byte 0x0000
-	.byte 0x13
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x3b
-	.byte 0x05
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x38
-	.byte 0x0a
-	.byte 0x03
-	.byte 0x08
-	.byte 0x49
-	.byte 0x13
-	.2byte 0x0000
-	.byte 0x14
-	.byte 0x01
-	.byte 0x01
-	.byte 0x49
-	.byte 0x13
-	.byte 0x0b
-	.byte 0x0b
-	.2byte 0x0000
-	.byte 0x15
-	.byte 0x21
-	.byte 0x00
-	.byte 0x2f
-	.byte 0x0b
-	.2byte 0x0000
-	.byte 0x16
-	.byte 0x13
-	.byte 0x01
-	.byte 0x3b
-	.byte 0x05
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x0b
-	.byte 0x0b
-	.2byte 0x0000
-	.byte 0x17
-	.byte 0x17
-	.byte 0x01
-	.byte 0x3b
-	.byte 0x0b
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x0b
-	.byte 0x0b
-	.2byte 0x0000
-	.byte 0x18
-	.byte 0x0d
-	.byte 0x00
-	.byte 0x3b
-	.byte 0x0b
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x38
-	.byte 0x0a
-	.byte 0x03
-	.byte 0x08
-	.byte 0x49
-	.byte 0x13
-	.2byte 0x0000
-	.byte 0x19
-	.byte 0x17
-	.byte 0x01
-	.byte 0x3b
-	.byte 0x05
-	.byte 0x39
-	.byte 0x0b
-	.byte 0x3a
-	.byte 0x0b
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x0b
-	.byte 0x0b
-	.byte 0x03
-	.byte 0x08
-	.2byte 0x0000
-	.byte 0x1a
-	.byte 0x01
-	.byte 0x01
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x03
-	.byte 0x08
-	.byte 0x49
-	.byte 0x13
-	.byte 0x0b
-	.byte 0x0b
-	.2byte 0x0000
-	.byte 0x1b
-	.byte 0x21
-	.byte 0x00
-	.byte 0x32
-	.byte 0x0b
-	.byte 0x03
-	.byte 0x08
-	.byte 0x2f
-	.byte 0x0b
-	.byte 0x22
-	.byte 0x0b
-	.2byte 0x0000
-	.byte 0x1c
-	.byte 0x01
-	.byte 0x01
-	.byte 0x49
-	.byte 0x13
-	.byte 0x0b
-	.byte 0x05
-	.2byte 0x0000
-	.byte 0x1d
-	.byte 0x21
-	.byte 0x00
-	.byte 0x2f
-	.byte 0x05
-	.2byte 0x0000
-	.byte 0x00
-// -- Begin DWARF2 SEGMENT .debug_frame
-	.section .debug_frame
-.debug_frame_seg:
-	.align 1
-	.4byte 0x00000014
-	.4byte 0xffffffff
-	.byte 0x01
-	.byte 0x00
-	.byte 0x01
-	.byte 0x78
-	.byte 0x10
-	.4byte 0x9008070c
-	.byte 0x01
-	.4byte 0x00000000
-	.2byte 0x0000
-	.4byte 0x00000024
-	.4byte .debug_frame_seg
-	.8byte ..___tag_value_uint16_lsbit.2
-	.4byte ..___tag_value_uint16_lsbit.8-..___tag_value_uint16_lsbit.2
-	.byte 0x04
-	.4byte ..___tag_value_uint16_lsbit.3-..___tag_value_uint16_lsbit.2
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_uint16_lsbit.7-..___tag_value_uint16_lsbit.3
-	.byte 0x09
-	.2byte 0x0606
-	.2byte 0x0000
-	.4byte 0x00000024
-	.4byte .debug_frame_seg
-	.8byte ..___tag_value_uint128_shr.11
-	.4byte ..___tag_value_uint128_shr.17-..___tag_value_uint128_shr.11
-	.byte 0x04
-	.4byte ..___tag_value_uint128_shr.12-..___tag_value_uint128_shr.11
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_uint128_shr.16-..___tag_value_uint128_shr.12
-	.byte 0x09
-	.2byte 0x0606
-	.2byte 0x0000
-	.4byte 0x00000024
-	.4byte .debug_frame_seg
-	.8byte ..___tag_value_uint128_bswap.20
-	.4byte ..___tag_value_uint128_bswap.26-..___tag_value_uint128_bswap.20
-	.byte 0x04
-	.4byte ..___tag_value_uint128_bswap.21-..___tag_value_uint128_bswap.20
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_uint128_bswap.25-..___tag_value_uint128_bswap.21
-	.byte 0x09
-	.2byte 0x0606
-	.2byte 0x0000
-	.4byte 0x00000024
-	.4byte .debug_frame_seg
-	.8byte ..___tag_value_uint128_bswap_copy.29
-	.4byte ..___tag_value_uint128_bswap_copy.35-..___tag_value_uint128_bswap_copy.29
-	.byte 0x04
-	.4byte ..___tag_value_uint128_bswap_copy.30-..___tag_value_uint128_bswap_copy.29
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_uint128_bswap_copy.34-..___tag_value_uint128_bswap_copy.30
-	.byte 0x09
-	.2byte 0x0606
-	.2byte 0x0000
-	.4byte 0x00000034
-	.4byte .debug_frame_seg
-	.8byte ..___tag_value_NucStrFastaExprAlloc.38
-	.4byte ..___tag_value_NucStrFastaExprAlloc.47-..___tag_value_NucStrFastaExprAlloc.38
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprAlloc.39-..___tag_value_NucStrFastaExprAlloc.38
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprAlloc.43-..___tag_value_NucStrFastaExprAlloc.39
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprAlloc.44-..___tag_value_NucStrFastaExprAlloc.43
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprAlloc.46-..___tag_value_NucStrFastaExprAlloc.44
-	.byte 0x09
-	.2byte 0x0606
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x00000044
-	.4byte .debug_frame_seg
-	.8byte ..___tag_value_NucStrFastaExprMake2.50
-	.4byte ..___tag_value_NucStrFastaExprMake2.62-..___tag_value_NucStrFastaExprMake2.50
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.51-..___tag_value_NucStrFastaExprMake2.50
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.55-..___tag_value_NucStrFastaExprMake2.51
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.56-..___tag_value_NucStrFastaExprMake2.55
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.58-..___tag_value_NucStrFastaExprMake2.56
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.59-..___tag_value_NucStrFastaExprMake2.58
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.61-..___tag_value_NucStrFastaExprMake2.59
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.4byte 0x00000044
-	.4byte .debug_frame_seg
-	.8byte ..___tag_value_NucStrFastaExprMake4.65
-	.4byte ..___tag_value_NucStrFastaExprMake4.77-..___tag_value_NucStrFastaExprMake4.65
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.66-..___tag_value_NucStrFastaExprMake4.65
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.70-..___tag_value_NucStrFastaExprMake4.66
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.71-..___tag_value_NucStrFastaExprMake4.70
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.73-..___tag_value_NucStrFastaExprMake4.71
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.74-..___tag_value_NucStrFastaExprMake4.73
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.76-..___tag_value_NucStrFastaExprMake4.74
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.4byte 0x00000024
-	.4byte .debug_frame_seg
-	.8byte ..___tag_value_nss_sob.80
-	.4byte ..___tag_value_nss_sob.86-..___tag_value_nss_sob.80
-	.byte 0x04
-	.4byte ..___tag_value_nss_sob.81-..___tag_value_nss_sob.80
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_sob.85-..___tag_value_nss_sob.81
-	.byte 0x09
-	.2byte 0x0606
-	.2byte 0x0000
-	.4byte 0x00000034
-	.4byte .debug_frame_seg
-	.8byte ..___tag_value_nss_FASTA_expr.89
-	.4byte ..___tag_value_nss_FASTA_expr.97-..___tag_value_nss_FASTA_expr.89
-	.byte 0x04
-	.4byte ..___tag_value_nss_FASTA_expr.90-..___tag_value_nss_FASTA_expr.89
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_FASTA_expr.93-..___tag_value_nss_FASTA_expr.90
-	.byte 0x83
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_nss_FASTA_expr.94-..___tag_value_nss_FASTA_expr.93
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_FASTA_expr.96-..___tag_value_nss_FASTA_expr.94
-	.byte 0x09
-	.2byte 0x0606
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x0000004c
-	.4byte .debug_frame_seg
-	.8byte ..___tag_value_nss_fasta_expr.100
-	.4byte ..___tag_value_nss_fasta_expr.113-..___tag_value_nss_fasta_expr.100
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.101-..___tag_value_nss_fasta_expr.100
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.104-..___tag_value_nss_fasta_expr.101
-	.byte 0x83
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.105-..___tag_value_nss_fasta_expr.104
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.107-..___tag_value_nss_fasta_expr.105
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.108-..___tag_value_nss_fasta_expr.107
-	.byte 0x83
-	.byte 0x04
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.110-..___tag_value_nss_fasta_expr.108
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.112-..___tag_value_nss_fasta_expr.110
-	.byte 0x09
-	.2byte 0x0606
-	.2byte 0x0000
-	.4byte 0x00000064
-	.4byte .debug_frame_seg
-	.8byte ..___tag_value_nss_primary_expr.116
-	.4byte ..___tag_value_nss_primary_expr.134-..___tag_value_nss_primary_expr.116
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.117-..___tag_value_nss_primary_expr.116
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.120-..___tag_value_nss_primary_expr.117
-	.byte 0x83
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.121-..___tag_value_nss_primary_expr.120
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.123-..___tag_value_nss_primary_expr.121
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.124-..___tag_value_nss_primary_expr.123
-	.byte 0x83
-	.byte 0x04
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.126-..___tag_value_nss_primary_expr.124
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.128-..___tag_value_nss_primary_expr.126
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.129-..___tag_value_nss_primary_expr.128
-	.byte 0x83
-	.byte 0x04
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.131-..___tag_value_nss_primary_expr.129
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.133-..___tag_value_nss_primary_expr.131
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x00
-	.4byte 0x0000004c
-	.4byte .debug_frame_seg
-	.8byte ..___tag_value_nss_unary_expr.137
-	.4byte ..___tag_value_nss_unary_expr.150-..___tag_value_nss_unary_expr.137
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.138-..___tag_value_nss_unary_expr.137
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.141-..___tag_value_nss_unary_expr.138
-	.byte 0x83
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.142-..___tag_value_nss_unary_expr.141
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.144-..___tag_value_nss_unary_expr.142
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.145-..___tag_value_nss_unary_expr.144
-	.byte 0x83
-	.byte 0x05
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.147-..___tag_value_nss_unary_expr.145
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.149-..___tag_value_nss_unary_expr.147
-	.byte 0x09
-	.2byte 0x0606
-	.2byte 0x0000
-	.4byte 0x0000007c
-	.4byte .debug_frame_seg
-	.8byte ..___tag_value_nss_expr.153
-	.4byte ..___tag_value_nss_expr.176-..___tag_value_nss_expr.153
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.154-..___tag_value_nss_expr.153
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.157-..___tag_value_nss_expr.154
-	.byte 0x83
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.158-..___tag_value_nss_expr.157
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.160-..___tag_value_nss_expr.158
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.161-..___tag_value_nss_expr.160
-	.byte 0x83
-	.byte 0x05
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.163-..___tag_value_nss_expr.161
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.165-..___tag_value_nss_expr.163
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.166-..___tag_value_nss_expr.165
-	.byte 0x83
-	.byte 0x05
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.168-..___tag_value_nss_expr.166
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.170-..___tag_value_nss_expr.168
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.171-..___tag_value_nss_expr.170
-	.byte 0x83
-	.byte 0x05
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.173-..___tag_value_nss_expr.171
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.175-..___tag_value_nss_expr.173
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000024
-	.4byte .debug_frame_seg
-	.8byte ..___tag_value_NucStrstrInit.179
-	.4byte ..___tag_value_NucStrstrInit.185-..___tag_value_NucStrstrInit.179
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrInit.180-..___tag_value_NucStrstrInit.179
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrInit.184-..___tag_value_NucStrstrInit.180
-	.byte 0x09
-	.2byte 0x0606
-	.2byte 0x0000
-	.4byte 0x00000064
-	.4byte .debug_frame_seg
-	.8byte ..___tag_value_NucStrstrMake.188
-	.4byte ..___tag_value_NucStrstrMake.206-..___tag_value_NucStrstrMake.188
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.189-..___tag_value_NucStrstrMake.188
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.192-..___tag_value_NucStrstrMake.189
-	.byte 0x83
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.193-..___tag_value_NucStrstrMake.192
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.195-..___tag_value_NucStrstrMake.193
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.196-..___tag_value_NucStrstrMake.195
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.198-..___tag_value_NucStrstrMake.196
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.200-..___tag_value_NucStrstrMake.198
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.201-..___tag_value_NucStrstrMake.200
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.203-..___tag_value_NucStrstrMake.201
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.205-..___tag_value_NucStrstrMake.203
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x00
-	.4byte 0x00000024
-	.4byte .debug_frame_seg
-	.8byte ..___tag_value_NucStrstrWhack.209
-	.4byte ..___tag_value_NucStrstrWhack.215-..___tag_value_NucStrstrWhack.209
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrWhack.210-..___tag_value_NucStrstrWhack.209
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrWhack.214-..___tag_value_NucStrstrWhack.210
-	.byte 0x09
-	.2byte 0x0606
-	.2byte 0x0000
-	.4byte 0x00000024
-	.4byte .debug_frame_seg
-	.8byte ..___tag_value_prime_buffer_2na.218
-	.4byte ..___tag_value_prime_buffer_2na.224-..___tag_value_prime_buffer_2na.218
-	.byte 0x04
-	.4byte ..___tag_value_prime_buffer_2na.219-..___tag_value_prime_buffer_2na.218
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_prime_buffer_2na.223-..___tag_value_prime_buffer_2na.219
-	.byte 0x09
-	.2byte 0x0606
-	.2byte 0x0000
-	.4byte 0x00000074
-	.4byte .debug_frame_seg
-	.8byte ..___tag_value_eval_2na_8.227
-	.4byte ..___tag_value_eval_2na_8.248-..___tag_value_eval_2na_8.227
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.228-..___tag_value_eval_2na_8.227
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.232-..___tag_value_eval_2na_8.228
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.233-..___tag_value_eval_2na_8.232
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.235-..___tag_value_eval_2na_8.233
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.236-..___tag_value_eval_2na_8.235
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.238-..___tag_value_eval_2na_8.236
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.239-..___tag_value_eval_2na_8.238
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.241-..___tag_value_eval_2na_8.239
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.242-..___tag_value_eval_2na_8.241
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.244-..___tag_value_eval_2na_8.242
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.245-..___tag_value_eval_2na_8.244
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.247-..___tag_value_eval_2na_8.245
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x00000074
-	.4byte .debug_frame_seg
-	.8byte ..___tag_value_eval_2na_16.251
-	.4byte ..___tag_value_eval_2na_16.272-..___tag_value_eval_2na_16.251
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.252-..___tag_value_eval_2na_16.251
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.256-..___tag_value_eval_2na_16.252
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.257-..___tag_value_eval_2na_16.256
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.259-..___tag_value_eval_2na_16.257
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.260-..___tag_value_eval_2na_16.259
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.262-..___tag_value_eval_2na_16.260
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.263-..___tag_value_eval_2na_16.262
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.265-..___tag_value_eval_2na_16.263
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.266-..___tag_value_eval_2na_16.265
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.268-..___tag_value_eval_2na_16.266
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.269-..___tag_value_eval_2na_16.268
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.271-..___tag_value_eval_2na_16.269
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x00000074
-	.4byte .debug_frame_seg
-	.8byte ..___tag_value_eval_2na_32.275
-	.4byte ..___tag_value_eval_2na_32.296-..___tag_value_eval_2na_32.275
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.276-..___tag_value_eval_2na_32.275
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.280-..___tag_value_eval_2na_32.276
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.281-..___tag_value_eval_2na_32.280
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.283-..___tag_value_eval_2na_32.281
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.284-..___tag_value_eval_2na_32.283
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.286-..___tag_value_eval_2na_32.284
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.287-..___tag_value_eval_2na_32.286
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.289-..___tag_value_eval_2na_32.287
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.290-..___tag_value_eval_2na_32.289
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.292-..___tag_value_eval_2na_32.290
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.293-..___tag_value_eval_2na_32.292
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.295-..___tag_value_eval_2na_32.293
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x00000074
-	.4byte .debug_frame_seg
-	.8byte ..___tag_value_eval_2na_64.299
-	.4byte ..___tag_value_eval_2na_64.320-..___tag_value_eval_2na_64.299
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.300-..___tag_value_eval_2na_64.299
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.304-..___tag_value_eval_2na_64.300
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.305-..___tag_value_eval_2na_64.304
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.307-..___tag_value_eval_2na_64.305
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.308-..___tag_value_eval_2na_64.307
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.310-..___tag_value_eval_2na_64.308
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.311-..___tag_value_eval_2na_64.310
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.313-..___tag_value_eval_2na_64.311
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.314-..___tag_value_eval_2na_64.313
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.316-..___tag_value_eval_2na_64.314
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.317-..___tag_value_eval_2na_64.316
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.319-..___tag_value_eval_2na_64.317
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x0000007c
-	.4byte .debug_frame_seg
-	.8byte ..___tag_value_eval_2na_128.323
-	.4byte ..___tag_value_eval_2na_128.347-..___tag_value_eval_2na_128.323
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.324-..___tag_value_eval_2na_128.323
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.328-..___tag_value_eval_2na_128.324
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.329-..___tag_value_eval_2na_128.328
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.331-..___tag_value_eval_2na_128.329
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.332-..___tag_value_eval_2na_128.331
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.334-..___tag_value_eval_2na_128.332
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.335-..___tag_value_eval_2na_128.334
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.337-..___tag_value_eval_2na_128.335
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.338-..___tag_value_eval_2na_128.337
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.340-..___tag_value_eval_2na_128.338
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.341-..___tag_value_eval_2na_128.340
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.343-..___tag_value_eval_2na_128.341
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.344-..___tag_value_eval_2na_128.343
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.346-..___tag_value_eval_2na_128.344
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x000000dc
-	.4byte .debug_frame_seg
-	.8byte ..___tag_value_eval_2na_pos.350
-	.4byte ..___tag_value_eval_2na_pos.392-..___tag_value_eval_2na_pos.350
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.351-..___tag_value_eval_2na_pos.350
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.355-..___tag_value_eval_2na_pos.351
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.356-..___tag_value_eval_2na_pos.355
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.358-..___tag_value_eval_2na_pos.356
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.359-..___tag_value_eval_2na_pos.358
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.361-..___tag_value_eval_2na_pos.359
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.362-..___tag_value_eval_2na_pos.361
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.364-..___tag_value_eval_2na_pos.362
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.365-..___tag_value_eval_2na_pos.364
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.367-..___tag_value_eval_2na_pos.365
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.368-..___tag_value_eval_2na_pos.367
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.370-..___tag_value_eval_2na_pos.368
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.371-..___tag_value_eval_2na_pos.370
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.373-..___tag_value_eval_2na_pos.371
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.374-..___tag_value_eval_2na_pos.373
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.376-..___tag_value_eval_2na_pos.374
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.377-..___tag_value_eval_2na_pos.376
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.379-..___tag_value_eval_2na_pos.377
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.380-..___tag_value_eval_2na_pos.379
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.382-..___tag_value_eval_2na_pos.380
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.383-..___tag_value_eval_2na_pos.382
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.385-..___tag_value_eval_2na_pos.383
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.386-..___tag_value_eval_2na_pos.385
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.388-..___tag_value_eval_2na_pos.386
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.389-..___tag_value_eval_2na_pos.388
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.391-..___tag_value_eval_2na_pos.389
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.2byte 0x0000
-	.4byte 0x00000024
-	.4byte .debug_frame_seg
-	.8byte ..___tag_value_prime_buffer_4na.395
-	.4byte ..___tag_value_prime_buffer_4na.401-..___tag_value_prime_buffer_4na.395
-	.byte 0x04
-	.4byte ..___tag_value_prime_buffer_4na.396-..___tag_value_prime_buffer_4na.395
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_prime_buffer_4na.400-..___tag_value_prime_buffer_4na.396
-	.byte 0x09
-	.2byte 0x0606
-	.2byte 0x0000
-	.4byte 0x00000074
-	.4byte .debug_frame_seg
-	.8byte ..___tag_value_eval_4na_16.404
-	.4byte ..___tag_value_eval_4na_16.425-..___tag_value_eval_4na_16.404
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.405-..___tag_value_eval_4na_16.404
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.409-..___tag_value_eval_4na_16.405
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.410-..___tag_value_eval_4na_16.409
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.412-..___tag_value_eval_4na_16.410
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.413-..___tag_value_eval_4na_16.412
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.415-..___tag_value_eval_4na_16.413
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.416-..___tag_value_eval_4na_16.415
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.418-..___tag_value_eval_4na_16.416
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.419-..___tag_value_eval_4na_16.418
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.421-..___tag_value_eval_4na_16.419
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.422-..___tag_value_eval_4na_16.421
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.424-..___tag_value_eval_4na_16.422
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x00000074
-	.4byte .debug_frame_seg
-	.8byte ..___tag_value_eval_4na_32.428
-	.4byte ..___tag_value_eval_4na_32.449-..___tag_value_eval_4na_32.428
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.429-..___tag_value_eval_4na_32.428
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.433-..___tag_value_eval_4na_32.429
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.434-..___tag_value_eval_4na_32.433
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.436-..___tag_value_eval_4na_32.434
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.437-..___tag_value_eval_4na_32.436
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.439-..___tag_value_eval_4na_32.437
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.440-..___tag_value_eval_4na_32.439
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.442-..___tag_value_eval_4na_32.440
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.443-..___tag_value_eval_4na_32.442
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.445-..___tag_value_eval_4na_32.443
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.446-..___tag_value_eval_4na_32.445
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.448-..___tag_value_eval_4na_32.446
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x00000074
-	.4byte .debug_frame_seg
-	.8byte ..___tag_value_eval_4na_64.452
-	.4byte ..___tag_value_eval_4na_64.473-..___tag_value_eval_4na_64.452
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.453-..___tag_value_eval_4na_64.452
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.457-..___tag_value_eval_4na_64.453
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.458-..___tag_value_eval_4na_64.457
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.460-..___tag_value_eval_4na_64.458
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.461-..___tag_value_eval_4na_64.460
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.463-..___tag_value_eval_4na_64.461
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.464-..___tag_value_eval_4na_64.463
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.466-..___tag_value_eval_4na_64.464
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.467-..___tag_value_eval_4na_64.466
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.469-..___tag_value_eval_4na_64.467
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.470-..___tag_value_eval_4na_64.469
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.472-..___tag_value_eval_4na_64.470
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x0000007c
-	.4byte .debug_frame_seg
-	.8byte ..___tag_value_eval_4na_128.476
-	.4byte ..___tag_value_eval_4na_128.500-..___tag_value_eval_4na_128.476
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.477-..___tag_value_eval_4na_128.476
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.481-..___tag_value_eval_4na_128.477
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.482-..___tag_value_eval_4na_128.481
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.484-..___tag_value_eval_4na_128.482
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.485-..___tag_value_eval_4na_128.484
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.487-..___tag_value_eval_4na_128.485
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.488-..___tag_value_eval_4na_128.487
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.490-..___tag_value_eval_4na_128.488
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.491-..___tag_value_eval_4na_128.490
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.493-..___tag_value_eval_4na_128.491
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.494-..___tag_value_eval_4na_128.493
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.496-..___tag_value_eval_4na_128.494
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.497-..___tag_value_eval_4na_128.496
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.499-..___tag_value_eval_4na_128.497
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x000000dc
-	.4byte .debug_frame_seg
-	.8byte ..___tag_value_eval_4na_pos.503
-	.4byte ..___tag_value_eval_4na_pos.545-..___tag_value_eval_4na_pos.503
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.504-..___tag_value_eval_4na_pos.503
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.508-..___tag_value_eval_4na_pos.504
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.509-..___tag_value_eval_4na_pos.508
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.511-..___tag_value_eval_4na_pos.509
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.512-..___tag_value_eval_4na_pos.511
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.514-..___tag_value_eval_4na_pos.512
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.515-..___tag_value_eval_4na_pos.514
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.517-..___tag_value_eval_4na_pos.515
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.518-..___tag_value_eval_4na_pos.517
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.520-..___tag_value_eval_4na_pos.518
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.521-..___tag_value_eval_4na_pos.520
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.523-..___tag_value_eval_4na_pos.521
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.524-..___tag_value_eval_4na_pos.523
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.526-..___tag_value_eval_4na_pos.524
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.527-..___tag_value_eval_4na_pos.526
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.529-..___tag_value_eval_4na_pos.527
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.530-..___tag_value_eval_4na_pos.529
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.532-..___tag_value_eval_4na_pos.530
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.533-..___tag_value_eval_4na_pos.532
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.535-..___tag_value_eval_4na_pos.533
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.536-..___tag_value_eval_4na_pos.535
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.538-..___tag_value_eval_4na_pos.536
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.539-..___tag_value_eval_4na_pos.538
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.541-..___tag_value_eval_4na_pos.539
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.542-..___tag_value_eval_4na_pos.541
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.544-..___tag_value_eval_4na_pos.542
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.2byte 0x0000
-	.4byte 0x0000033c
-	.4byte .debug_frame_seg
-	.8byte ..___tag_value_NucStrstrSearch.548
-	.4byte ..___tag_value_NucStrstrSearch.711-..___tag_value_NucStrstrSearch.548
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.549-..___tag_value_NucStrstrSearch.548
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.552-..___tag_value_NucStrstrSearch.549
-	.byte 0x83
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.553-..___tag_value_NucStrstrSearch.552
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.555-..___tag_value_NucStrstrSearch.553
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.556-..___tag_value_NucStrstrSearch.555
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.558-..___tag_value_NucStrstrSearch.556
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.560-..___tag_value_NucStrstrSearch.558
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.561-..___tag_value_NucStrstrSearch.560
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.563-..___tag_value_NucStrstrSearch.561
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.565-..___tag_value_NucStrstrSearch.563
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.566-..___tag_value_NucStrstrSearch.565
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.568-..___tag_value_NucStrstrSearch.566
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.570-..___tag_value_NucStrstrSearch.568
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.571-..___tag_value_NucStrstrSearch.570
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.573-..___tag_value_NucStrstrSearch.571
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.575-..___tag_value_NucStrstrSearch.573
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.576-..___tag_value_NucStrstrSearch.575
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.578-..___tag_value_NucStrstrSearch.576
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.580-..___tag_value_NucStrstrSearch.578
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.581-..___tag_value_NucStrstrSearch.580
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.583-..___tag_value_NucStrstrSearch.581
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.585-..___tag_value_NucStrstrSearch.583
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.586-..___tag_value_NucStrstrSearch.585
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.588-..___tag_value_NucStrstrSearch.586
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.590-..___tag_value_NucStrstrSearch.588
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.591-..___tag_value_NucStrstrSearch.590
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.593-..___tag_value_NucStrstrSearch.591
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.595-..___tag_value_NucStrstrSearch.593
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.596-..___tag_value_NucStrstrSearch.595
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.598-..___tag_value_NucStrstrSearch.596
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.600-..___tag_value_NucStrstrSearch.598
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.601-..___tag_value_NucStrstrSearch.600
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.603-..___tag_value_NucStrstrSearch.601
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.605-..___tag_value_NucStrstrSearch.603
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.606-..___tag_value_NucStrstrSearch.605
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.608-..___tag_value_NucStrstrSearch.606
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.610-..___tag_value_NucStrstrSearch.608
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.611-..___tag_value_NucStrstrSearch.610
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.613-..___tag_value_NucStrstrSearch.611
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.615-..___tag_value_NucStrstrSearch.613
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.616-..___tag_value_NucStrstrSearch.615
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.618-..___tag_value_NucStrstrSearch.616
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.620-..___tag_value_NucStrstrSearch.618
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.621-..___tag_value_NucStrstrSearch.620
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.623-..___tag_value_NucStrstrSearch.621
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.625-..___tag_value_NucStrstrSearch.623
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.626-..___tag_value_NucStrstrSearch.625
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.628-..___tag_value_NucStrstrSearch.626
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.630-..___tag_value_NucStrstrSearch.628
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.631-..___tag_value_NucStrstrSearch.630
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.633-..___tag_value_NucStrstrSearch.631
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.635-..___tag_value_NucStrstrSearch.633
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.636-..___tag_value_NucStrstrSearch.635
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.638-..___tag_value_NucStrstrSearch.636
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.640-..___tag_value_NucStrstrSearch.638
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.641-..___tag_value_NucStrstrSearch.640
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.643-..___tag_value_NucStrstrSearch.641
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.645-..___tag_value_NucStrstrSearch.643
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.646-..___tag_value_NucStrstrSearch.645
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.648-..___tag_value_NucStrstrSearch.646
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.650-..___tag_value_NucStrstrSearch.648
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.651-..___tag_value_NucStrstrSearch.650
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.653-..___tag_value_NucStrstrSearch.651
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.655-..___tag_value_NucStrstrSearch.653
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.656-..___tag_value_NucStrstrSearch.655
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.658-..___tag_value_NucStrstrSearch.656
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.660-..___tag_value_NucStrstrSearch.658
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.661-..___tag_value_NucStrstrSearch.660
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.663-..___tag_value_NucStrstrSearch.661
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.665-..___tag_value_NucStrstrSearch.663
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.666-..___tag_value_NucStrstrSearch.665
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.668-..___tag_value_NucStrstrSearch.666
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.670-..___tag_value_NucStrstrSearch.668
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.671-..___tag_value_NucStrstrSearch.670
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.673-..___tag_value_NucStrstrSearch.671
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.675-..___tag_value_NucStrstrSearch.673
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.676-..___tag_value_NucStrstrSearch.675
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.678-..___tag_value_NucStrstrSearch.676
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.680-..___tag_value_NucStrstrSearch.678
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.681-..___tag_value_NucStrstrSearch.680
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.683-..___tag_value_NucStrstrSearch.681
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.685-..___tag_value_NucStrstrSearch.683
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.686-..___tag_value_NucStrstrSearch.685
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.688-..___tag_value_NucStrstrSearch.686
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.690-..___tag_value_NucStrstrSearch.688
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.691-..___tag_value_NucStrstrSearch.690
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.693-..___tag_value_NucStrstrSearch.691
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.695-..___tag_value_NucStrstrSearch.693
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.696-..___tag_value_NucStrstrSearch.695
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.698-..___tag_value_NucStrstrSearch.696
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.700-..___tag_value_NucStrstrSearch.698
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.701-..___tag_value_NucStrstrSearch.700
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.703-..___tag_value_NucStrstrSearch.701
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.705-..___tag_value_NucStrstrSearch.703
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.706-..___tag_value_NucStrstrSearch.705
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.708-..___tag_value_NucStrstrSearch.706
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.710-..___tag_value_NucStrstrSearch.708
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-// -- Begin DWARF2 SEGMENT .eh_frame
-	.section .eh_frame,"a", at progbits
-.eh_frame_seg:
-	.align 1
-	.4byte 0x00000014
-	.4byte 0x00000000
-	.byte 0x01
-	.2byte 0x527a
-	.byte 0x00
-	.byte 0x01
-	.byte 0x78
-	.byte 0x10
-	.byte 0x01
-	.4byte 0x08070c1b
-	.2byte 0x0190
-	.2byte 0x0000
-	.4byte 0x00000024
-	.4byte 0x0000001c
-	.4byte ..___tag_value_uint16_lsbit.2-.
-	.4byte ..___tag_value_uint16_lsbit.8-..___tag_value_uint16_lsbit.2
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_uint16_lsbit.3-..___tag_value_uint16_lsbit.2
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_uint16_lsbit.7-..___tag_value_uint16_lsbit.3
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.byte 0x00
-	.4byte 0x00000024
-	.4byte 0x00000044
-	.4byte ..___tag_value_uint128_shr.11-.
-	.4byte ..___tag_value_uint128_shr.17-..___tag_value_uint128_shr.11
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_uint128_shr.12-..___tag_value_uint128_shr.11
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_uint128_shr.16-..___tag_value_uint128_shr.12
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.byte 0x00
-	.4byte 0x00000024
-	.4byte 0x0000006c
-	.4byte ..___tag_value_uint128_bswap.20-.
-	.4byte ..___tag_value_uint128_bswap.26-..___tag_value_uint128_bswap.20
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_uint128_bswap.21-..___tag_value_uint128_bswap.20
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_uint128_bswap.25-..___tag_value_uint128_bswap.21
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.byte 0x00
-	.4byte 0x00000024
-	.4byte 0x00000094
-	.4byte ..___tag_value_uint128_bswap_copy.29-.
-	.4byte ..___tag_value_uint128_bswap_copy.35-..___tag_value_uint128_bswap_copy.29
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_uint128_bswap_copy.30-..___tag_value_uint128_bswap_copy.29
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_uint128_bswap_copy.34-..___tag_value_uint128_bswap_copy.30
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.byte 0x00
-	.4byte 0x00000034
-	.4byte 0x000000bc
-	.4byte ..___tag_value_NucStrFastaExprAlloc.38-.
-	.4byte ..___tag_value_NucStrFastaExprAlloc.47-..___tag_value_NucStrFastaExprAlloc.38
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprAlloc.39-..___tag_value_NucStrFastaExprAlloc.38
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprAlloc.43-..___tag_value_NucStrFastaExprAlloc.39
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprAlloc.44-..___tag_value_NucStrFastaExprAlloc.43
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprAlloc.46-..___tag_value_NucStrFastaExprAlloc.44
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.2byte 0x0000
-	.4byte 0x00000044
-	.4byte 0x000000f4
-	.4byte ..___tag_value_NucStrFastaExprMake2.50-.
-	.4byte ..___tag_value_NucStrFastaExprMake2.62-..___tag_value_NucStrFastaExprMake2.50
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.51-..___tag_value_NucStrFastaExprMake2.50
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.55-..___tag_value_NucStrFastaExprMake2.51
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.56-..___tag_value_NucStrFastaExprMake2.55
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.58-..___tag_value_NucStrFastaExprMake2.56
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.59-..___tag_value_NucStrFastaExprMake2.58
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.61-..___tag_value_NucStrFastaExprMake2.59
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x00000044
-	.4byte 0x0000013c
-	.4byte ..___tag_value_NucStrFastaExprMake4.65-.
-	.4byte ..___tag_value_NucStrFastaExprMake4.77-..___tag_value_NucStrFastaExprMake4.65
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.66-..___tag_value_NucStrFastaExprMake4.65
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.70-..___tag_value_NucStrFastaExprMake4.66
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.71-..___tag_value_NucStrFastaExprMake4.70
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.73-..___tag_value_NucStrFastaExprMake4.71
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.74-..___tag_value_NucStrFastaExprMake4.73
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.76-..___tag_value_NucStrFastaExprMake4.74
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x00000024
-	.4byte 0x00000184
-	.4byte ..___tag_value_nss_sob.80-.
-	.4byte ..___tag_value_nss_sob.86-..___tag_value_nss_sob.80
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_nss_sob.81-..___tag_value_nss_sob.80
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_sob.85-..___tag_value_nss_sob.81
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.byte 0x00
-	.4byte 0x00000034
-	.4byte 0x000001ac
-	.4byte ..___tag_value_nss_FASTA_expr.89-.
-	.4byte ..___tag_value_nss_FASTA_expr.97-..___tag_value_nss_FASTA_expr.89
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_nss_FASTA_expr.90-..___tag_value_nss_FASTA_expr.89
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_FASTA_expr.93-..___tag_value_nss_FASTA_expr.90
-	.byte 0x83
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_nss_FASTA_expr.94-..___tag_value_nss_FASTA_expr.93
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_FASTA_expr.96-..___tag_value_nss_FASTA_expr.94
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.2byte 0x0000
-	.4byte 0x0000004c
-	.4byte 0x000001e4
-	.4byte ..___tag_value_nss_fasta_expr.100-.
-	.4byte ..___tag_value_nss_fasta_expr.113-..___tag_value_nss_fasta_expr.100
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.101-..___tag_value_nss_fasta_expr.100
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.104-..___tag_value_nss_fasta_expr.101
-	.byte 0x83
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.105-..___tag_value_nss_fasta_expr.104
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.107-..___tag_value_nss_fasta_expr.105
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.108-..___tag_value_nss_fasta_expr.107
-	.byte 0x83
-	.byte 0x04
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.110-..___tag_value_nss_fasta_expr.108
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.112-..___tag_value_nss_fasta_expr.110
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.byte 0x00
-	.4byte 0x00000064
-	.4byte 0x00000234
-	.4byte ..___tag_value_nss_primary_expr.116-.
-	.4byte ..___tag_value_nss_primary_expr.134-..___tag_value_nss_primary_expr.116
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.117-..___tag_value_nss_primary_expr.116
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.120-..___tag_value_nss_primary_expr.117
-	.byte 0x83
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.121-..___tag_value_nss_primary_expr.120
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.123-..___tag_value_nss_primary_expr.121
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.124-..___tag_value_nss_primary_expr.123
-	.byte 0x83
-	.byte 0x04
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.126-..___tag_value_nss_primary_expr.124
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.128-..___tag_value_nss_primary_expr.126
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.129-..___tag_value_nss_primary_expr.128
-	.byte 0x83
-	.byte 0x04
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.131-..___tag_value_nss_primary_expr.129
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.133-..___tag_value_nss_primary_expr.131
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.4byte 0x0000004c
-	.4byte 0x0000029c
-	.4byte ..___tag_value_nss_unary_expr.137-.
-	.4byte ..___tag_value_nss_unary_expr.150-..___tag_value_nss_unary_expr.137
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.138-..___tag_value_nss_unary_expr.137
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.141-..___tag_value_nss_unary_expr.138
-	.byte 0x83
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.142-..___tag_value_nss_unary_expr.141
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.144-..___tag_value_nss_unary_expr.142
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.145-..___tag_value_nss_unary_expr.144
-	.byte 0x83
-	.byte 0x05
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.147-..___tag_value_nss_unary_expr.145
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.149-..___tag_value_nss_unary_expr.147
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.byte 0x00
-	.4byte 0x0000007c
-	.4byte 0x000002ec
-	.4byte ..___tag_value_nss_expr.153-.
-	.4byte ..___tag_value_nss_expr.176-..___tag_value_nss_expr.153
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.154-..___tag_value_nss_expr.153
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.157-..___tag_value_nss_expr.154
-	.byte 0x83
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.158-..___tag_value_nss_expr.157
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.160-..___tag_value_nss_expr.158
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.161-..___tag_value_nss_expr.160
-	.byte 0x83
-	.byte 0x05
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.163-..___tag_value_nss_expr.161
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.165-..___tag_value_nss_expr.163
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.166-..___tag_value_nss_expr.165
-	.byte 0x83
-	.byte 0x05
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.168-..___tag_value_nss_expr.166
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.170-..___tag_value_nss_expr.168
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.171-..___tag_value_nss_expr.170
-	.byte 0x83
-	.byte 0x05
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.173-..___tag_value_nss_expr.171
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.175-..___tag_value_nss_expr.173
-	.byte 0x09
-	.2byte 0x0606
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x00000024
-	.4byte 0x0000036c
-	.4byte ..___tag_value_NucStrstrInit.179-.
-	.4byte ..___tag_value_NucStrstrInit.185-..___tag_value_NucStrstrInit.179
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrInit.180-..___tag_value_NucStrstrInit.179
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrInit.184-..___tag_value_NucStrstrInit.180
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.byte 0x00
-	.4byte 0x00000064
-	.4byte 0x00000394
-	.4byte ..___tag_value_NucStrstrMake.188-.
-	.4byte ..___tag_value_NucStrstrMake.206-..___tag_value_NucStrstrMake.188
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.189-..___tag_value_NucStrstrMake.188
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.192-..___tag_value_NucStrstrMake.189
-	.byte 0x83
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.193-..___tag_value_NucStrstrMake.192
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.195-..___tag_value_NucStrstrMake.193
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.196-..___tag_value_NucStrstrMake.195
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.198-..___tag_value_NucStrstrMake.196
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.200-..___tag_value_NucStrstrMake.198
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.201-..___tag_value_NucStrstrMake.200
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.203-..___tag_value_NucStrstrMake.201
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.205-..___tag_value_NucStrstrMake.203
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.4byte 0x00000024
-	.4byte 0x000003fc
-	.4byte ..___tag_value_NucStrstrWhack.209-.
-	.4byte ..___tag_value_NucStrstrWhack.215-..___tag_value_NucStrstrWhack.209
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrWhack.210-..___tag_value_NucStrstrWhack.209
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrWhack.214-..___tag_value_NucStrstrWhack.210
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.byte 0x00
-	.4byte 0x00000024
-	.4byte 0x00000424
-	.4byte ..___tag_value_prime_buffer_2na.218-.
-	.4byte ..___tag_value_prime_buffer_2na.224-..___tag_value_prime_buffer_2na.218
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_prime_buffer_2na.219-..___tag_value_prime_buffer_2na.218
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_prime_buffer_2na.223-..___tag_value_prime_buffer_2na.219
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.byte 0x00
-	.4byte 0x0000006c
-	.4byte 0x0000044c
-	.4byte ..___tag_value_eval_2na_8.227-.
-	.4byte ..___tag_value_eval_2na_8.248-..___tag_value_eval_2na_8.227
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.228-..___tag_value_eval_2na_8.227
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.232-..___tag_value_eval_2na_8.228
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.233-..___tag_value_eval_2na_8.232
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.235-..___tag_value_eval_2na_8.233
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.236-..___tag_value_eval_2na_8.235
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.238-..___tag_value_eval_2na_8.236
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.239-..___tag_value_eval_2na_8.238
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.241-..___tag_value_eval_2na_8.239
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.242-..___tag_value_eval_2na_8.241
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.244-..___tag_value_eval_2na_8.242
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.245-..___tag_value_eval_2na_8.244
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.247-..___tag_value_eval_2na_8.245
-	.byte 0x09
-	.2byte 0x0606
-	.2byte 0x0000
-	.4byte 0x0000006c
-	.4byte 0x000004bc
-	.4byte ..___tag_value_eval_2na_16.251-.
-	.4byte ..___tag_value_eval_2na_16.272-..___tag_value_eval_2na_16.251
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.252-..___tag_value_eval_2na_16.251
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.256-..___tag_value_eval_2na_16.252
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.257-..___tag_value_eval_2na_16.256
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.259-..___tag_value_eval_2na_16.257
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.260-..___tag_value_eval_2na_16.259
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.262-..___tag_value_eval_2na_16.260
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.263-..___tag_value_eval_2na_16.262
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.265-..___tag_value_eval_2na_16.263
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.266-..___tag_value_eval_2na_16.265
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.268-..___tag_value_eval_2na_16.266
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.269-..___tag_value_eval_2na_16.268
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.271-..___tag_value_eval_2na_16.269
-	.byte 0x09
-	.2byte 0x0606
-	.2byte 0x0000
-	.4byte 0x0000006c
-	.4byte 0x0000052c
-	.4byte ..___tag_value_eval_2na_32.275-.
-	.4byte ..___tag_value_eval_2na_32.296-..___tag_value_eval_2na_32.275
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.276-..___tag_value_eval_2na_32.275
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.280-..___tag_value_eval_2na_32.276
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.281-..___tag_value_eval_2na_32.280
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.283-..___tag_value_eval_2na_32.281
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.284-..___tag_value_eval_2na_32.283
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.286-..___tag_value_eval_2na_32.284
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.287-..___tag_value_eval_2na_32.286
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.289-..___tag_value_eval_2na_32.287
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.290-..___tag_value_eval_2na_32.289
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.292-..___tag_value_eval_2na_32.290
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.293-..___tag_value_eval_2na_32.292
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.295-..___tag_value_eval_2na_32.293
-	.byte 0x09
-	.2byte 0x0606
-	.2byte 0x0000
-	.4byte 0x0000006c
-	.4byte 0x0000059c
-	.4byte ..___tag_value_eval_2na_64.299-.
-	.4byte ..___tag_value_eval_2na_64.320-..___tag_value_eval_2na_64.299
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.300-..___tag_value_eval_2na_64.299
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.304-..___tag_value_eval_2na_64.300
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.305-..___tag_value_eval_2na_64.304
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.307-..___tag_value_eval_2na_64.305
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.308-..___tag_value_eval_2na_64.307
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.310-..___tag_value_eval_2na_64.308
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.311-..___tag_value_eval_2na_64.310
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.313-..___tag_value_eval_2na_64.311
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.314-..___tag_value_eval_2na_64.313
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.316-..___tag_value_eval_2na_64.314
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.317-..___tag_value_eval_2na_64.316
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.319-..___tag_value_eval_2na_64.317
-	.byte 0x09
-	.2byte 0x0606
-	.2byte 0x0000
-	.4byte 0x0000007c
-	.4byte 0x0000060c
-	.4byte ..___tag_value_eval_2na_128.323-.
-	.4byte ..___tag_value_eval_2na_128.347-..___tag_value_eval_2na_128.323
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.324-..___tag_value_eval_2na_128.323
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.328-..___tag_value_eval_2na_128.324
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.329-..___tag_value_eval_2na_128.328
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.331-..___tag_value_eval_2na_128.329
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.332-..___tag_value_eval_2na_128.331
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.334-..___tag_value_eval_2na_128.332
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.335-..___tag_value_eval_2na_128.334
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.337-..___tag_value_eval_2na_128.335
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.338-..___tag_value_eval_2na_128.337
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.340-..___tag_value_eval_2na_128.338
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.341-..___tag_value_eval_2na_128.340
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.343-..___tag_value_eval_2na_128.341
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.344-..___tag_value_eval_2na_128.343
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.346-..___tag_value_eval_2na_128.344
-	.byte 0x09
-	.2byte 0x0606
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x000000d4
-	.4byte 0x0000068c
-	.4byte ..___tag_value_eval_2na_pos.350-.
-	.4byte ..___tag_value_eval_2na_pos.392-..___tag_value_eval_2na_pos.350
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.351-..___tag_value_eval_2na_pos.350
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.355-..___tag_value_eval_2na_pos.351
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.356-..___tag_value_eval_2na_pos.355
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.358-..___tag_value_eval_2na_pos.356
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.359-..___tag_value_eval_2na_pos.358
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.361-..___tag_value_eval_2na_pos.359
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.362-..___tag_value_eval_2na_pos.361
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.364-..___tag_value_eval_2na_pos.362
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.365-..___tag_value_eval_2na_pos.364
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.367-..___tag_value_eval_2na_pos.365
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.368-..___tag_value_eval_2na_pos.367
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.370-..___tag_value_eval_2na_pos.368
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.371-..___tag_value_eval_2na_pos.370
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.373-..___tag_value_eval_2na_pos.371
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.374-..___tag_value_eval_2na_pos.373
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.376-..___tag_value_eval_2na_pos.374
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.377-..___tag_value_eval_2na_pos.376
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.379-..___tag_value_eval_2na_pos.377
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.380-..___tag_value_eval_2na_pos.379
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.382-..___tag_value_eval_2na_pos.380
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.383-..___tag_value_eval_2na_pos.382
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.385-..___tag_value_eval_2na_pos.383
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.386-..___tag_value_eval_2na_pos.385
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.388-..___tag_value_eval_2na_pos.386
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.389-..___tag_value_eval_2na_pos.388
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.391-..___tag_value_eval_2na_pos.389
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x00
-	.4byte 0x00000024
-	.4byte 0x00000764
-	.4byte ..___tag_value_prime_buffer_4na.395-.
-	.4byte ..___tag_value_prime_buffer_4na.401-..___tag_value_prime_buffer_4na.395
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_prime_buffer_4na.396-..___tag_value_prime_buffer_4na.395
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_prime_buffer_4na.400-..___tag_value_prime_buffer_4na.396
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.byte 0x00
-	.4byte 0x0000006c
-	.4byte 0x0000078c
-	.4byte ..___tag_value_eval_4na_16.404-.
-	.4byte ..___tag_value_eval_4na_16.425-..___tag_value_eval_4na_16.404
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.405-..___tag_value_eval_4na_16.404
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.409-..___tag_value_eval_4na_16.405
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.410-..___tag_value_eval_4na_16.409
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.412-..___tag_value_eval_4na_16.410
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.413-..___tag_value_eval_4na_16.412
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.415-..___tag_value_eval_4na_16.413
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.416-..___tag_value_eval_4na_16.415
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.418-..___tag_value_eval_4na_16.416
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.419-..___tag_value_eval_4na_16.418
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.421-..___tag_value_eval_4na_16.419
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.422-..___tag_value_eval_4na_16.421
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.424-..___tag_value_eval_4na_16.422
-	.byte 0x09
-	.2byte 0x0606
-	.2byte 0x0000
-	.4byte 0x0000006c
-	.4byte 0x000007fc
-	.4byte ..___tag_value_eval_4na_32.428-.
-	.4byte ..___tag_value_eval_4na_32.449-..___tag_value_eval_4na_32.428
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.429-..___tag_value_eval_4na_32.428
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.433-..___tag_value_eval_4na_32.429
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.434-..___tag_value_eval_4na_32.433
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.436-..___tag_value_eval_4na_32.434
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.437-..___tag_value_eval_4na_32.436
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.439-..___tag_value_eval_4na_32.437
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.440-..___tag_value_eval_4na_32.439
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.442-..___tag_value_eval_4na_32.440
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.443-..___tag_value_eval_4na_32.442
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.445-..___tag_value_eval_4na_32.443
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.446-..___tag_value_eval_4na_32.445
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.448-..___tag_value_eval_4na_32.446
-	.byte 0x09
-	.2byte 0x0606
-	.2byte 0x0000
-	.4byte 0x0000006c
-	.4byte 0x0000086c
-	.4byte ..___tag_value_eval_4na_64.452-.
-	.4byte ..___tag_value_eval_4na_64.473-..___tag_value_eval_4na_64.452
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.453-..___tag_value_eval_4na_64.452
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.457-..___tag_value_eval_4na_64.453
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.458-..___tag_value_eval_4na_64.457
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.460-..___tag_value_eval_4na_64.458
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.461-..___tag_value_eval_4na_64.460
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.463-..___tag_value_eval_4na_64.461
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.464-..___tag_value_eval_4na_64.463
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.466-..___tag_value_eval_4na_64.464
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.467-..___tag_value_eval_4na_64.466
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.469-..___tag_value_eval_4na_64.467
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.470-..___tag_value_eval_4na_64.469
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.472-..___tag_value_eval_4na_64.470
-	.byte 0x09
-	.2byte 0x0606
-	.2byte 0x0000
-	.4byte 0x0000007c
-	.4byte 0x000008dc
-	.4byte ..___tag_value_eval_4na_128.476-.
-	.4byte ..___tag_value_eval_4na_128.500-..___tag_value_eval_4na_128.476
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.477-..___tag_value_eval_4na_128.476
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.481-..___tag_value_eval_4na_128.477
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.482-..___tag_value_eval_4na_128.481
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.484-..___tag_value_eval_4na_128.482
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.485-..___tag_value_eval_4na_128.484
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.487-..___tag_value_eval_4na_128.485
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.488-..___tag_value_eval_4na_128.487
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.490-..___tag_value_eval_4na_128.488
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.491-..___tag_value_eval_4na_128.490
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.493-..___tag_value_eval_4na_128.491
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.494-..___tag_value_eval_4na_128.493
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.496-..___tag_value_eval_4na_128.494
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.497-..___tag_value_eval_4na_128.496
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.499-..___tag_value_eval_4na_128.497
-	.byte 0x09
-	.2byte 0x0606
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x000000d4
-	.4byte 0x0000095c
-	.4byte ..___tag_value_eval_4na_pos.503-.
-	.4byte ..___tag_value_eval_4na_pos.545-..___tag_value_eval_4na_pos.503
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.504-..___tag_value_eval_4na_pos.503
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.508-..___tag_value_eval_4na_pos.504
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.509-..___tag_value_eval_4na_pos.508
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.511-..___tag_value_eval_4na_pos.509
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.512-..___tag_value_eval_4na_pos.511
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.514-..___tag_value_eval_4na_pos.512
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.515-..___tag_value_eval_4na_pos.514
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.517-..___tag_value_eval_4na_pos.515
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.518-..___tag_value_eval_4na_pos.517
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.520-..___tag_value_eval_4na_pos.518
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.521-..___tag_value_eval_4na_pos.520
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.523-..___tag_value_eval_4na_pos.521
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.524-..___tag_value_eval_4na_pos.523
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.526-..___tag_value_eval_4na_pos.524
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.527-..___tag_value_eval_4na_pos.526
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.529-..___tag_value_eval_4na_pos.527
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.530-..___tag_value_eval_4na_pos.529
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.532-..___tag_value_eval_4na_pos.530
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.533-..___tag_value_eval_4na_pos.532
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.535-..___tag_value_eval_4na_pos.533
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.536-..___tag_value_eval_4na_pos.535
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.538-..___tag_value_eval_4na_pos.536
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.539-..___tag_value_eval_4na_pos.538
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.541-..___tag_value_eval_4na_pos.539
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.542-..___tag_value_eval_4na_pos.541
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.544-..___tag_value_eval_4na_pos.542
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x00
-	.4byte 0x0000033c
-	.4byte 0x00000a34
-	.4byte ..___tag_value_NucStrstrSearch.548-.
-	.4byte ..___tag_value_NucStrstrSearch.711-..___tag_value_NucStrstrSearch.548
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.549-..___tag_value_NucStrstrSearch.548
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.552-..___tag_value_NucStrstrSearch.549
-	.byte 0x83
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.553-..___tag_value_NucStrstrSearch.552
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.555-..___tag_value_NucStrstrSearch.553
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.556-..___tag_value_NucStrstrSearch.555
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.558-..___tag_value_NucStrstrSearch.556
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.560-..___tag_value_NucStrstrSearch.558
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.561-..___tag_value_NucStrstrSearch.560
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.563-..___tag_value_NucStrstrSearch.561
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.565-..___tag_value_NucStrstrSearch.563
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.566-..___tag_value_NucStrstrSearch.565
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.568-..___tag_value_NucStrstrSearch.566
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.570-..___tag_value_NucStrstrSearch.568
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.571-..___tag_value_NucStrstrSearch.570
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.573-..___tag_value_NucStrstrSearch.571
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.575-..___tag_value_NucStrstrSearch.573
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.576-..___tag_value_NucStrstrSearch.575
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.578-..___tag_value_NucStrstrSearch.576
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.580-..___tag_value_NucStrstrSearch.578
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.581-..___tag_value_NucStrstrSearch.580
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.583-..___tag_value_NucStrstrSearch.581
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.585-..___tag_value_NucStrstrSearch.583
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.586-..___tag_value_NucStrstrSearch.585
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.588-..___tag_value_NucStrstrSearch.586
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.590-..___tag_value_NucStrstrSearch.588
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.591-..___tag_value_NucStrstrSearch.590
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.593-..___tag_value_NucStrstrSearch.591
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.595-..___tag_value_NucStrstrSearch.593
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.596-..___tag_value_NucStrstrSearch.595
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.598-..___tag_value_NucStrstrSearch.596
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.600-..___tag_value_NucStrstrSearch.598
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.601-..___tag_value_NucStrstrSearch.600
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.603-..___tag_value_NucStrstrSearch.601
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.605-..___tag_value_NucStrstrSearch.603
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.606-..___tag_value_NucStrstrSearch.605
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.608-..___tag_value_NucStrstrSearch.606
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.610-..___tag_value_NucStrstrSearch.608
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.611-..___tag_value_NucStrstrSearch.610
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.613-..___tag_value_NucStrstrSearch.611
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.615-..___tag_value_NucStrstrSearch.613
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.616-..___tag_value_NucStrstrSearch.615
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.618-..___tag_value_NucStrstrSearch.616
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.620-..___tag_value_NucStrstrSearch.618
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.621-..___tag_value_NucStrstrSearch.620
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.623-..___tag_value_NucStrstrSearch.621
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.625-..___tag_value_NucStrstrSearch.623
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.626-..___tag_value_NucStrstrSearch.625
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.628-..___tag_value_NucStrstrSearch.626
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.630-..___tag_value_NucStrstrSearch.628
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.631-..___tag_value_NucStrstrSearch.630
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.633-..___tag_value_NucStrstrSearch.631
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.635-..___tag_value_NucStrstrSearch.633
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.636-..___tag_value_NucStrstrSearch.635
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.638-..___tag_value_NucStrstrSearch.636
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.640-..___tag_value_NucStrstrSearch.638
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.641-..___tag_value_NucStrstrSearch.640
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.643-..___tag_value_NucStrstrSearch.641
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.645-..___tag_value_NucStrstrSearch.643
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.646-..___tag_value_NucStrstrSearch.645
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.648-..___tag_value_NucStrstrSearch.646
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.650-..___tag_value_NucStrstrSearch.648
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.651-..___tag_value_NucStrstrSearch.650
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.653-..___tag_value_NucStrstrSearch.651
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.655-..___tag_value_NucStrstrSearch.653
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.656-..___tag_value_NucStrstrSearch.655
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.658-..___tag_value_NucStrstrSearch.656
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.660-..___tag_value_NucStrstrSearch.658
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.661-..___tag_value_NucStrstrSearch.660
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.663-..___tag_value_NucStrstrSearch.661
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.665-..___tag_value_NucStrstrSearch.663
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.666-..___tag_value_NucStrstrSearch.665
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.668-..___tag_value_NucStrstrSearch.666
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.670-..___tag_value_NucStrstrSearch.668
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.671-..___tag_value_NucStrstrSearch.670
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.673-..___tag_value_NucStrstrSearch.671
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.675-..___tag_value_NucStrstrSearch.673
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.676-..___tag_value_NucStrstrSearch.675
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.678-..___tag_value_NucStrstrSearch.676
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.680-..___tag_value_NucStrstrSearch.678
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.681-..___tag_value_NucStrstrSearch.680
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.683-..___tag_value_NucStrstrSearch.681
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.685-..___tag_value_NucStrstrSearch.683
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.686-..___tag_value_NucStrstrSearch.685
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.688-..___tag_value_NucStrstrSearch.686
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.690-..___tag_value_NucStrstrSearch.688
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.691-..___tag_value_NucStrstrSearch.690
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.693-..___tag_value_NucStrstrSearch.691
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.695-..___tag_value_NucStrstrSearch.693
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.696-..___tag_value_NucStrstrSearch.695
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.698-..___tag_value_NucStrstrSearch.696
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.700-..___tag_value_NucStrstrSearch.698
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.701-..___tag_value_NucStrstrSearch.700
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.703-..___tag_value_NucStrstrSearch.701
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.705-..___tag_value_NucStrstrSearch.703
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.706-..___tag_value_NucStrstrSearch.705
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.708-..___tag_value_NucStrstrSearch.706
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.710-..___tag_value_NucStrstrSearch.708
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.2byte 0x0000
-	.byte 0x00
-	.section .text
-.LNDBG_TXe:
-# End
diff --git a/libs/search/nucstrstr-icc-x86_64-prof.pic.s b/libs/search/nucstrstr-icc-x86_64-prof.pic.s
deleted file mode 100644
index c540857..0000000
--- a/libs/search/nucstrstr-icc-x86_64-prof.pic.s
+++ /dev/null
@@ -1,13651 +0,0 @@
-	.section .text
-.LNDBG_TX:
-# -- Machine type EFI2
-# mark_description "Intel(R) C++ Compiler Professional for applications running on Intel(R) 64, Version 11.0    Build 20090131 %";
-# mark_description "s";
-# mark_description "-I/home/yaschenk/devel/internal/asm-trace/sra/search/linux -I/home/yaschenk/devel/internal/asm-trace/sra/sea";
-# mark_description "rch/unix -I/home/yaschenk/devel/internal/asm-trace/sra/search -I/home/yaschenk/devel/internal/asm-trace/itf ";
-# mark_description "-I/home/yaschenk/devel/internal/asm-trace/inc/icc/x86_64 -I/home/yaschenk/devel/internal/asm-trace/inc/icc -";
-# mark_description "I/home/yaschenk/devel/internal/asm-trace/inc/gcc/x86_64 -I/home/yaschenk/devel/internal/asm-trace/inc/gcc -I";
-# mark_description "/home/yaschenk/devel/internal/asm-trace/inc/linux -I/home/yaschenk/devel/internal/asm-trace/inc/unix -I/home";
-# mark_description "/yaschenk/devel/internal/asm-trace/inc -c -S -o nucstrstr.pic.s -fPIC -O3 -unroll -xW -vec_report5 -DNDEBUG ";
-# mark_description "-D_PROFILING -p -DLINUX -DUNIX -D_GNU_SOURCE -D_REENTRANT -D_FILE_OFFSET_BITS=64 -MD";
-	.file "nucstrstr.c"
-	.text
-..TXTST0:
-# -- Begin  NucStrstrSearch
-# mark_begin;
-       .align    16,0x90
-	.globl NucStrstrSearch
-NucStrstrSearch:
-# parameter 1(self): %rdi
-# parameter 2(ncbi2na): %rsi
-# parameter 3(pos): %edx
-# parameter 4(len): %ecx
-# parameter 5(selflen): %r8
-..B1.1:                         # Preds ..B1.0
-..___tag_value_NucStrstrSearch.1:                               #5217.1
-..LN1:
-  .file   1 "nucstrstr.c"
-   .loc    1  5217
-        pushq     %rbp                                          #5217.1
-        movq      %rsp, %rbp                                    #5217.1
-..___tag_value_NucStrstrSearch.2:                               #
-        subq      $48, %rsp                                     #5217.1
-        movq      %r15, -32(%rbp)                               #5217.1
-..___tag_value_NucStrstrSearch.4:                               #
-        movq      %r14, -24(%rbp)                               #5217.1
-..___tag_value_NucStrstrSearch.5:                               #
-        movq      %r13, -16(%rbp)                               #5217.1
-..___tag_value_NucStrstrSearch.6:                               #
-        movq      %r12, -48(%rbp)                               #5217.1
-..___tag_value_NucStrstrSearch.7:                               #
-        movq      %rbx, -40(%rbp)                               #5217.1
-..___tag_value_NucStrstrSearch.8:                               #
-        movq      %r8, %r15                                     #5217.1
-        movl      %ecx, %r14d                                   #5217.1
-        movl      %edx, %r13d                                   #5217.1
-        movq      %rsi, %r12                                    #5217.1
-        movq      %rdi, %rbx                                    #5217.1
-        lea       _gprof_pack0(%rip), %rdx                      #5217.1
-        call      mcount at PLT                                    #5217.1
-                                # LOE rbx r12 r15 r13d r14d
-..B1.117:                       # Preds ..B1.1
-..LN3:
-   .loc    1  5218
-        testq     %rbx, %rbx                                    #5218.18
-        je        ..B1.107      # Prob 6%                       #5218.18
-                                # LOE rbx r12 r15 r13d r14d
-..B1.2:                         # Preds ..B1.117
-..LN5:
-        testq     %r12, %r12                                    #5218.37
-        je        ..B1.107      # Prob 6%                       #5218.37
-                                # LOE rbx r12 r15 r13d r14d
-..B1.4:                         # Preds ..B1.2 ..B1.14 ..B1.17
-..LN7:
-        testl     %r14d, %r14d                                  #5218.52
-        je        ..B1.107      # Prob 28%                      #5218.52
-                                # LOE rbx r12 r15 r13d r14d
-..B1.7:                         # Preds ..B1.4 ..B1.31
-..LN9:
-   .loc    1  5223
-        movl      (%rbx), %eax                                  #5223.18
-..LN11:
-        cmpl      $12, %eax                                     #5223.9
-        ja        ..B1.107      # Prob 28%                      #5223.9
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.8:                         # Preds ..B1.7
-        movl      %eax, %eax                                    #5223.9
-        lea       ..1..TPKT.30_0.0.1(%rip), %rdx                #5223.9
-        movq      (%rdx,%rax,8), %rcx                           #5223.9
-        jmp       *%rcx                                         #5223.9
-                                # LOE rbx r12 r15 r13d r14d
-..1.30_0.TAG.0c.0.1:
-..B1.10:                        # Preds ..B1.8
-..LN13:
-   .loc    1  5286
-        movl      4(%rbx), %eax                                 #5286.22
-        testl     %eax, %eax                                    #5286.22
-        je        ..B1.20       # Prob 20%                      #5286.22
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.11:                        # Preds ..B1.10
-        cmpl      $13, %eax                                     #5286.22
-        je        ..B1.20       # Prob 25%                      #5286.22
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.12:                        # Preds ..B1.11
-        cmpl      $14, %eax                                     #5286.22
-        jne       ..B1.15       # Prob 67%                      #5286.22
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.13:                        # Preds ..B1.12
-..LN15:
-   .loc    1  5297
-        movq      8(%rbx), %rbx                                 #5297.29
-        movl      4(%rbx), %eax                                 #5297.29
-..LN17:
-   .loc    1  5298
-        cmpl      %r14d, %eax                                   #5298.34
-        ja        ..B1.107      # Prob 12%                      #5298.34
-                                # LOE rbx r12 r15 eax r13d
-..B1.14:                        # Preds ..B1.13
-..LN19:
-   .loc    1  5297
-        movl      %eax, %r14d                                   #5297.17
-..LN21:
-   .loc    1  5218
-        testq     %rbx, %rbx                                    #5218.18
-        jne       ..B1.4        # Prob 94%                      #5218.18
-        jmp       ..B1.107      # Prob 100%                     #5218.18
-                                # LOE rbx r12 r15 r13d r14d
-..B1.15:                        # Preds ..B1.12
-..LN23:
-   .loc    1  5286
-        cmpl      $15, %eax                                     #5286.22
-        jne       ..B1.107      # Prob 50%                      #5286.22
-                                # LOE rbx r12 r15 r13d r14d
-..B1.16:                        # Preds ..B1.15
-..LN25:
-   .loc    1  5302
-        movq      8(%rbx), %rbx                                 #5302.29
-        movl      4(%rbx), %eax                                 #5302.29
-..LN27:
-   .loc    1  5303
-        cmpl      %r14d, %eax                                   #5303.34
-        ja        ..B1.107      # Prob 12%                      #5303.34
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.17:                        # Preds ..B1.16
-..LN29:
-   .loc    1  5306
-        addl      %r14d, %r13d                                  #5306.27
-..LN31:
-        subl      %eax, %r13d                                   #5306.33
-..LN33:
-   .loc    1  5302
-        movl      %eax, %r14d                                   #5302.17
-..LN35:
-   .loc    1  5218
-        testq     %rbx, %rbx                                    #5218.18
-        jne       ..B1.4        # Prob 94%                      #5218.18
-        jmp       ..B1.107      # Prob 100%                     #5218.18
-                                # LOE rbx r12 r15 r13d r14d
-..B1.20:                        # Preds ..B1.10 ..B1.11
-..LN37:
-   .loc    1  5290
-        movq      8(%rbx), %rdi                                 #5290.25
-        movq      %r12, %rsi                                    #5290.25
-        movl      %r13d, %edx                                   #5290.25
-        movl      %r14d, %ecx                                   #5290.25
-        movq      %r15, %r8                                     #5290.25
-        call      NucStrstrSearch at PLT                           #5290.25
-                                # LOE rbx eax
-..B1.21:                        # Preds ..B1.20
-..LN39:
-   .loc    1  5291
-        movl      4(%rbx), %edx                                 #5291.22
-..LN41:
-        testl     %edx, %edx                                    #5291.42
-        je        ..B1.56       # Prob 28%                      #5291.42
-                                # LOE eax
-..B1.22:                        # Preds ..B1.21
-..LN43:
-   .loc    1  5293
-        testl     %eax, %eax                                    #5293.31
-        jne       ..B1.107      # Prob 50%                      #5293.31
-                                # LOE
-..B1.23:                        # Preds ..B1.22
-..LN45:
-   .loc    1  5294
-        movq      -40(%rbp), %rbx                               #5294.28
-..___tag_value_NucStrstrSearch.9:                               #
-        movq      -48(%rbp), %r12                               #5294.28
-..___tag_value_NucStrstrSearch.10:                              #
-        movq      -16(%rbp), %r13                               #5294.28
-..___tag_value_NucStrstrSearch.11:                              #
-        movq      -24(%rbp), %r14                               #5294.28
-..___tag_value_NucStrstrSearch.12:                              #
-        movl      $1, %eax                                      #5294.28
-        movq      -32(%rbp), %r15                               #5294.28
-..___tag_value_NucStrstrSearch.13:                              #
-        movq      %rbp, %rsp                                    #5294.28
-        popq      %rbp                                          #5294.28
-..___tag_value_NucStrstrSearch.14:                              #
-        ret                                                     #5294.28
-..___tag_value_NucStrstrSearch.15:                              #
-                                # LOE
-..1.30_0.TAG.0b.0.1:
-..B1.26:                        # Preds ..B1.8
-..LN47:
-   .loc    1  5272
-        movq      8(%rbx), %rdi                                 #5272.21
-        movq      %r12, %rsi                                    #5272.21
-        movl      %r13d, %edx                                   #5272.21
-        movl      %r14d, %ecx                                   #5272.21
-        movq      %r15, %r8                                     #5272.21
-        call      NucStrstrSearch at PLT                           #5272.21
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.27:                        # Preds ..B1.26
-..LN49:
-   .loc    1  5273
-        movl      4(%rbx), %edx                                 #5273.22
-        cmpl      $17, %edx                                     #5273.22
-        jne       ..B1.29       # Prob 67%                      #5273.22
-                                # LOE rbx r12 r15 eax edx r13d r14d
-..B1.28:                        # Preds ..B1.27
-..LN51:
-   .loc    1  5276
-        testl     %eax, %eax                                    #5276.31
-        jne       ..B1.56       # Prob 12%                      #5276.31
-        jmp       ..B1.31       # Prob 100%                     #5276.31
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.29:                        # Preds ..B1.27
-..LN53:
-   .loc    1  5273
-        cmpl      $16, %edx                                     #5273.22
-        jne       ..B1.31       # Prob 50%                      #5273.22
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.30:                        # Preds ..B1.29
-..LN55:
-   .loc    1  5280
-        testl     %eax, %eax                                    #5280.31
-        je        ..B1.56       # Prob 12%                      #5280.31
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.31:                        # Preds ..B1.28 ..B1.30 ..B1.29
-..LN57:
-   .loc    1  5284
-        movq      16(%rbx), %rbx                                #5284.38
-..LN59:
-   .loc    1  5218
-        testq     %rbx, %rbx                                    #5218.18
-        jne       ..B1.7        # Prob 94%                      #5218.18
-        jmp       ..B1.107      # Prob 100%                     #5218.18
-                                # LOE rbx r12 r15 r13d r14d
-..1.30_0.TAG.0a.0.1:
-..B1.34:                        # Preds ..B1.8
-..LN61:
-   .loc    1  5268
-        movl      4(%rbx), %eax                                 #5268.24
-        cmpl      %eax, %r14d                                   #5268.24
-        jb        ..B1.107      # Prob 28%                      #5268.24
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.35:                        # Preds ..B1.34
-..LN63:
-   .loc    1  5269
-        testq     %r15, %r15                                    #5269.9
-        je        ..B1.37       # Prob 12%                      #5269.9
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.36:                        # Preds ..B1.35
-..LN65:
-        movl      %eax, (%r15)                                  #5269.18
-                                # LOE rbx r12 r13d r14d
-..B1.37:                        # Preds ..B1.35 ..B1.36
-..LN67:
-   .loc    1  5270
-        movq      %rbx, %rdi                                    #5270.20
-        movq      %r12, %rsi                                    #5270.20
-        movl      %r13d, %edx                                   #5270.20
-        movl      %r14d, %ecx                                   #5270.20
-        call      eval_4na_pos at PLT                              #5270.20
-                                # LOE eax
-..B1.120:                       # Preds ..B1.37
-        movq      -40(%rbp), %rbx                               #5270.20
-..___tag_value_NucStrstrSearch.21:                              #
-        movq      -48(%rbp), %r12                               #5270.20
-..___tag_value_NucStrstrSearch.22:                              #
-        movq      -16(%rbp), %r13                               #5270.20
-..___tag_value_NucStrstrSearch.23:                              #
-        movq      -24(%rbp), %r14                               #5270.20
-..___tag_value_NucStrstrSearch.24:                              #
-        movq      -32(%rbp), %r15                               #5270.20
-..___tag_value_NucStrstrSearch.25:                              #
-        movq      %rbp, %rsp                                    #5270.20
-        popq      %rbp                                          #5270.20
-..___tag_value_NucStrstrSearch.26:                              #
-        ret                                                     #5270.20
-..___tag_value_NucStrstrSearch.27:                              #
-                                # LOE
-..1.30_0.TAG.09.0.1:
-..B1.40:                        # Preds ..B1.8
-..LN69:
-   .loc    1  5264
-        movl      4(%rbx), %eax                                 #5264.24
-        cmpl      %eax, %r14d                                   #5264.24
-        jb        ..B1.107      # Prob 28%                      #5264.24
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.41:                        # Preds ..B1.40
-..LN71:
-   .loc    1  5265
-        testq     %r15, %r15                                    #5265.9
-        je        ..B1.43       # Prob 12%                      #5265.9
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.42:                        # Preds ..B1.41
-..LN73:
-        movl      %eax, (%r15)                                  #5265.18
-                                # LOE rbx r12 r13d r14d
-..B1.43:                        # Preds ..B1.41 ..B1.42
-..LN75:
-   .loc    1  5266
-        movq      %rbx, %rdi                                    #5266.20
-        movq      %r12, %rsi                                    #5266.20
-        movl      %r13d, %edx                                   #5266.20
-        movl      %r14d, %ecx                                   #5266.20
-        call      eval_2na_pos at PLT                              #5266.20
-                                # LOE eax
-..B1.121:                       # Preds ..B1.43
-        movq      -40(%rbp), %rbx                               #5266.20
-..___tag_value_NucStrstrSearch.33:                              #
-        movq      -48(%rbp), %r12                               #5266.20
-..___tag_value_NucStrstrSearch.34:                              #
-        movq      -16(%rbp), %r13                               #5266.20
-..___tag_value_NucStrstrSearch.35:                              #
-        movq      -24(%rbp), %r14                               #5266.20
-..___tag_value_NucStrstrSearch.36:                              #
-        movq      -32(%rbp), %r15                               #5266.20
-..___tag_value_NucStrstrSearch.37:                              #
-        movq      %rbp, %rsp                                    #5266.20
-        popq      %rbp                                          #5266.20
-..___tag_value_NucStrstrSearch.38:                              #
-        ret                                                     #5266.20
-..___tag_value_NucStrstrSearch.39:                              #
-                                # LOE
-..1.30_0.TAG.08.0.1:
-..B1.46:                        # Preds ..B1.8
-..LN77:
-   .loc    1  5259
-        movl      4(%rbx), %eax                                 #5259.24
-        cmpl      %eax, %r14d                                   #5259.24
-        jb        ..B1.107      # Prob 28%                      #5259.24
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.47:                        # Preds ..B1.46
-..LN79:
-   .loc    1  5260
-        testq     %r15, %r15                                    #5260.9
-        je        ..B1.49       # Prob 12%                      #5260.9
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.48:                        # Preds ..B1.47
-..LN81:
-        movl      %eax, (%r15)                                  #5260.18
-                                # LOE rbx r12 r13d r14d
-..B1.49:                        # Preds ..B1.47 ..B1.48
-..LN83:
-   .loc    1  5261
-        movq      %rbx, %rdi                                    #5261.20
-        movq      %r12, %rsi                                    #5261.20
-        movl      %r13d, %edx                                   #5261.20
-        movl      %r14d, %ecx                                   #5261.20
-        call      eval_4na_128 at PLT                              #5261.20
-                                # LOE eax
-..B1.122:                       # Preds ..B1.49
-        movq      -40(%rbp), %rbx                               #5261.20
-..___tag_value_NucStrstrSearch.45:                              #
-        movq      -48(%rbp), %r12                               #5261.20
-..___tag_value_NucStrstrSearch.46:                              #
-        movq      -16(%rbp), %r13                               #5261.20
-..___tag_value_NucStrstrSearch.47:                              #
-        movq      -24(%rbp), %r14                               #5261.20
-..___tag_value_NucStrstrSearch.48:                              #
-        movq      -32(%rbp), %r15                               #5261.20
-..___tag_value_NucStrstrSearch.49:                              #
-        movq      %rbp, %rsp                                    #5261.20
-        popq      %rbp                                          #5261.20
-..___tag_value_NucStrstrSearch.50:                              #
-        ret                                                     #5261.20
-..___tag_value_NucStrstrSearch.51:                              #
-                                # LOE
-..1.30_0.TAG.07.0.1:
-..B1.52:                        # Preds ..B1.8
-..LN85:
-   .loc    1  5255
-        movl      4(%rbx), %eax                                 #5255.24
-        cmpl      %eax, %r14d                                   #5255.24
-        jb        ..B1.107      # Prob 28%                      #5255.24
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.53:                        # Preds ..B1.52
-..LN87:
-   .loc    1  5256
-        testq     %r15, %r15                                    #5256.9
-        je        ..B1.55       # Prob 12%                      #5256.9
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.54:                        # Preds ..B1.53
-..LN89:
-        movl      %eax, (%r15)                                  #5256.18
-                                # LOE rbx r12 r13d r14d
-..B1.55:                        # Preds ..B1.53 ..B1.54
-..LN91:
-   .loc    1  5257
-        movq      %rbx, %rdi                                    #5257.20
-        movq      %r12, %rsi                                    #5257.20
-        movl      %r13d, %edx                                   #5257.20
-        movl      %r14d, %ecx                                   #5257.20
-        call      eval_4na_32 at PLT                               #5257.20
-                                # LOE eax
-..B1.56:                        # Preds ..B1.28 ..B1.30 ..B1.21 ..B1.55
-        movq      -40(%rbp), %rbx                               #5257.20
-..___tag_value_NucStrstrSearch.57:                              #
-        movq      -48(%rbp), %r12                               #5257.20
-..___tag_value_NucStrstrSearch.58:                              #
-        movq      -16(%rbp), %r13                               #5257.20
-..___tag_value_NucStrstrSearch.59:                              #
-        movq      -24(%rbp), %r14                               #5257.20
-..___tag_value_NucStrstrSearch.60:                              #
-        movq      -32(%rbp), %r15                               #5257.20
-..___tag_value_NucStrstrSearch.61:                              #
-        movq      %rbp, %rsp                                    #5257.20
-        popq      %rbp                                          #5257.20
-..___tag_value_NucStrstrSearch.62:                              #
-        ret                                                     #5257.20
-..___tag_value_NucStrstrSearch.63:                              #
-                                # LOE
-..1.30_0.TAG.06.0.1:
-..B1.59:                        # Preds ..B1.8
-..LN93:
-   .loc    1  5251
-        movl      4(%rbx), %eax                                 #5251.24
-        cmpl      %eax, %r14d                                   #5251.24
-        jb        ..B1.107      # Prob 28%                      #5251.24
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.60:                        # Preds ..B1.59
-..LN95:
-   .loc    1  5252
-        testq     %r15, %r15                                    #5252.9
-        je        ..B1.62       # Prob 12%                      #5252.9
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.61:                        # Preds ..B1.60
-..LN97:
-        movl      %eax, (%r15)                                  #5252.18
-                                # LOE rbx r12 r13d r14d
-..B1.62:                        # Preds ..B1.60 ..B1.61
-..LN99:
-   .loc    1  5253
-        movq      %rbx, %rdi                                    #5253.20
-        movq      %r12, %rsi                                    #5253.20
-        movl      %r13d, %edx                                   #5253.20
-        movl      %r14d, %ecx                                   #5253.20
-        call      eval_4na_16 at PLT                               #5253.20
-                                # LOE eax
-..B1.63:                        # Preds ..B1.62
-        movq      -40(%rbp), %rbx                               #5253.20
-..___tag_value_NucStrstrSearch.69:                              #
-        movq      -48(%rbp), %r12                               #5253.20
-..___tag_value_NucStrstrSearch.70:                              #
-        movq      -16(%rbp), %r13                               #5253.20
-..___tag_value_NucStrstrSearch.71:                              #
-        movq      -24(%rbp), %r14                               #5253.20
-..___tag_value_NucStrstrSearch.72:                              #
-        movq      -32(%rbp), %r15                               #5253.20
-..___tag_value_NucStrstrSearch.73:                              #
-        movq      %rbp, %rsp                                    #5253.20
-        popq      %rbp                                          #5253.20
-..___tag_value_NucStrstrSearch.74:                              #
-        ret                                                     #5253.20
-..___tag_value_NucStrstrSearch.75:                              #
-                                # LOE
-..1.30_0.TAG.05.0.1:
-..B1.66:                        # Preds ..B1.8
-..LN101:
-   .loc    1  5247
-        movl      4(%rbx), %eax                                 #5247.24
-        cmpl      %eax, %r14d                                   #5247.24
-        jb        ..B1.107      # Prob 28%                      #5247.24
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.67:                        # Preds ..B1.66
-..LN103:
-   .loc    1  5248
-        testq     %r15, %r15                                    #5248.9
-        je        ..B1.69       # Prob 12%                      #5248.9
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.68:                        # Preds ..B1.67
-..LN105:
-        movl      %eax, (%r15)                                  #5248.18
-                                # LOE rbx r12 r13d r14d
-..B1.69:                        # Preds ..B1.67 ..B1.68
-..LN107:
-   .loc    1  5249
-        movq      %rbx, %rdi                                    #5249.20
-        movq      %r12, %rsi                                    #5249.20
-        movl      %r13d, %edx                                   #5249.20
-        movl      %r14d, %ecx                                   #5249.20
-        call      eval_2na_128 at PLT                              #5249.20
-                                # LOE eax
-..B1.125:                       # Preds ..B1.69
-        movq      -40(%rbp), %rbx                               #5249.20
-..___tag_value_NucStrstrSearch.81:                              #
-        movq      -48(%rbp), %r12                               #5249.20
-..___tag_value_NucStrstrSearch.82:                              #
-        movq      -16(%rbp), %r13                               #5249.20
-..___tag_value_NucStrstrSearch.83:                              #
-        movq      -24(%rbp), %r14                               #5249.20
-..___tag_value_NucStrstrSearch.84:                              #
-        movq      -32(%rbp), %r15                               #5249.20
-..___tag_value_NucStrstrSearch.85:                              #
-        movq      %rbp, %rsp                                    #5249.20
-        popq      %rbp                                          #5249.20
-..___tag_value_NucStrstrSearch.86:                              #
-        ret                                                     #5249.20
-..___tag_value_NucStrstrSearch.87:                              #
-                                # LOE
-..1.30_0.TAG.04.0.1:
-..B1.72:                        # Preds ..B1.8
-..LN109:
-   .loc    1  5243
-        movl      4(%rbx), %eax                                 #5243.24
-        cmpl      %eax, %r14d                                   #5243.24
-        jb        ..B1.107      # Prob 28%                      #5243.24
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.73:                        # Preds ..B1.72
-..LN111:
-   .loc    1  5244
-        testq     %r15, %r15                                    #5244.9
-        je        ..B1.75       # Prob 12%                      #5244.9
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.74:                        # Preds ..B1.73
-..LN113:
-        movl      %eax, (%r15)                                  #5244.18
-                                # LOE rbx r12 r13d r14d
-..B1.75:                        # Preds ..B1.73 ..B1.74
-..LN115:
-   .loc    1  5245
-        movq      %rbx, %rdi                                    #5245.20
-        movq      %r12, %rsi                                    #5245.20
-        movl      %r13d, %edx                                   #5245.20
-        movl      %r14d, %ecx                                   #5245.20
-        call      eval_2na_32 at PLT                               #5245.20
-                                # LOE eax
-..B1.76:                        # Preds ..B1.75
-        movq      -40(%rbp), %rbx                               #5245.20
-..___tag_value_NucStrstrSearch.93:                              #
-        movq      -48(%rbp), %r12                               #5245.20
-..___tag_value_NucStrstrSearch.94:                              #
-        movq      -16(%rbp), %r13                               #5245.20
-..___tag_value_NucStrstrSearch.95:                              #
-        movq      -24(%rbp), %r14                               #5245.20
-..___tag_value_NucStrstrSearch.96:                              #
-        movq      -32(%rbp), %r15                               #5245.20
-..___tag_value_NucStrstrSearch.97:                              #
-        movq      %rbp, %rsp                                    #5245.20
-        popq      %rbp                                          #5245.20
-..___tag_value_NucStrstrSearch.98:                              #
-        ret                                                     #5245.20
-..___tag_value_NucStrstrSearch.99:                              #
-                                # LOE
-..1.30_0.TAG.03.0.1:
-..B1.79:                        # Preds ..B1.8
-..LN117:
-   .loc    1  5239
-        movl      4(%rbx), %eax                                 #5239.24
-        cmpl      %eax, %r14d                                   #5239.24
-        jb        ..B1.107      # Prob 28%                      #5239.24
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.80:                        # Preds ..B1.79
-..LN119:
-   .loc    1  5240
-        testq     %r15, %r15                                    #5240.9
-        je        ..B1.82       # Prob 12%                      #5240.9
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.81:                        # Preds ..B1.80
-..LN121:
-        movl      %eax, (%r15)                                  #5240.18
-                                # LOE rbx r12 r13d r14d
-..B1.82:                        # Preds ..B1.80 ..B1.81
-..LN123:
-   .loc    1  5241
-        movq      %rbx, %rdi                                    #5241.20
-        movq      %r12, %rsi                                    #5241.20
-        movl      %r13d, %edx                                   #5241.20
-        movl      %r14d, %ecx                                   #5241.20
-        call      eval_2na_16 at PLT                               #5241.20
-                                # LOE eax
-..B1.83:                        # Preds ..B1.82
-        movq      -40(%rbp), %rbx                               #5241.20
-..___tag_value_NucStrstrSearch.105:                             #
-        movq      -48(%rbp), %r12                               #5241.20
-..___tag_value_NucStrstrSearch.106:                             #
-        movq      -16(%rbp), %r13                               #5241.20
-..___tag_value_NucStrstrSearch.107:                             #
-        movq      -24(%rbp), %r14                               #5241.20
-..___tag_value_NucStrstrSearch.108:                             #
-        movq      -32(%rbp), %r15                               #5241.20
-..___tag_value_NucStrstrSearch.109:                             #
-        movq      %rbp, %rsp                                    #5241.20
-        popq      %rbp                                          #5241.20
-..___tag_value_NucStrstrSearch.110:                             #
-        ret                                                     #5241.20
-..___tag_value_NucStrstrSearch.111:                             #
-                                # LOE
-..1.30_0.TAG.02.0.1:
-..B1.86:                        # Preds ..B1.8
-..LN125:
-   .loc    1  5235
-        movl      4(%rbx), %eax                                 #5235.24
-        cmpl      %eax, %r14d                                   #5235.24
-        jb        ..B1.107      # Prob 28%                      #5235.24
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.87:                        # Preds ..B1.86
-..LN127:
-   .loc    1  5236
-        testq     %r15, %r15                                    #5236.9
-        je        ..B1.89       # Prob 12%                      #5236.9
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.88:                        # Preds ..B1.87
-..LN129:
-        movl      %eax, (%r15)                                  #5236.18
-                                # LOE rbx r12 r13d r14d
-..B1.89:                        # Preds ..B1.87 ..B1.88
-..LN131:
-   .loc    1  5237
-        movq      %rbx, %rdi                                    #5237.20
-        movq      %r12, %rsi                                    #5237.20
-        movl      %r13d, %edx                                   #5237.20
-        movl      %r14d, %ecx                                   #5237.20
-        call      eval_2na_8 at PLT                                #5237.20
-                                # LOE eax
-..B1.90:                        # Preds ..B1.89
-        movq      -40(%rbp), %rbx                               #5237.20
-..___tag_value_NucStrstrSearch.117:                             #
-        movq      -48(%rbp), %r12                               #5237.20
-..___tag_value_NucStrstrSearch.118:                             #
-        movq      -16(%rbp), %r13                               #5237.20
-..___tag_value_NucStrstrSearch.119:                             #
-        movq      -24(%rbp), %r14                               #5237.20
-..___tag_value_NucStrstrSearch.120:                             #
-        movq      -32(%rbp), %r15                               #5237.20
-..___tag_value_NucStrstrSearch.121:                             #
-        movq      %rbp, %rsp                                    #5237.20
-        popq      %rbp                                          #5237.20
-..___tag_value_NucStrstrSearch.122:                             #
-        ret                                                     #5237.20
-..___tag_value_NucStrstrSearch.123:                             #
-                                # LOE
-..1.30_0.TAG.01.0.1:
-..B1.93:                        # Preds ..B1.8
-..LN133:
-   .loc    1  5230
-        movl      4(%rbx), %eax                                 #5230.24
-        cmpl      %eax, %r14d                                   #5230.24
-        jb        ..B1.107      # Prob 28%                      #5230.24
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.94:                        # Preds ..B1.93
-..LN135:
-   .loc    1  5231
-        testq     %r15, %r15                                    #5231.9
-        je        ..B1.96       # Prob 12%                      #5231.9
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.95:                        # Preds ..B1.94
-..LN137:
-        movl      %eax, (%r15)                                  #5231.18
-                                # LOE rbx r12 r13d r14d
-..B1.96:                        # Preds ..B1.94 ..B1.95
-..LN139:
-   .loc    1  5232
-        movq      %rbx, %rdi                                    #5232.20
-        movq      %r12, %rsi                                    #5232.20
-        movl      %r13d, %edx                                   #5232.20
-        movl      %r14d, %ecx                                   #5232.20
-        call      eval_4na_64 at PLT                               #5232.20
-                                # LOE eax
-..B1.97:                        # Preds ..B1.96
-        movq      -40(%rbp), %rbx                               #5232.20
-..___tag_value_NucStrstrSearch.129:                             #
-        movq      -48(%rbp), %r12                               #5232.20
-..___tag_value_NucStrstrSearch.130:                             #
-        movq      -16(%rbp), %r13                               #5232.20
-..___tag_value_NucStrstrSearch.131:                             #
-        movq      -24(%rbp), %r14                               #5232.20
-..___tag_value_NucStrstrSearch.132:                             #
-        movq      -32(%rbp), %r15                               #5232.20
-..___tag_value_NucStrstrSearch.133:                             #
-        movq      %rbp, %rsp                                    #5232.20
-        popq      %rbp                                          #5232.20
-..___tag_value_NucStrstrSearch.134:                             #
-        ret                                                     #5232.20
-..___tag_value_NucStrstrSearch.135:                             #
-                                # LOE
-..1.30_0.TAG.00.0.1:
-..B1.100:                       # Preds ..B1.8
-..LN141:
-   .loc    1  5226
-        movl      4(%rbx), %eax                                 #5226.24
-        cmpl      %eax, %r14d                                   #5226.24
-        jb        ..B1.107      # Prob 28%                      #5226.24
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.101:                       # Preds ..B1.100
-..LN143:
-   .loc    1  5227
-        testq     %r15, %r15                                    #5227.9
-        je        ..B1.103      # Prob 12%                      #5227.9
-                                # LOE rbx r12 r15 eax r13d r14d
-..B1.102:                       # Preds ..B1.101
-..LN145:
-        movl      %eax, (%r15)                                  #5227.18
-                                # LOE rbx r12 r13d r14d
-..B1.103:                       # Preds ..B1.101 ..B1.102
-..LN147:
-   .loc    1  5228
-        movq      %rbx, %rdi                                    #5228.20
-        movq      %r12, %rsi                                    #5228.20
-        movl      %r13d, %edx                                   #5228.20
-        movl      %r14d, %ecx                                   #5228.20
-        call      eval_2na_64 at PLT                               #5228.20
-                                # LOE eax
-..B1.104:                       # Preds ..B1.103
-        movq      -40(%rbp), %rbx                               #5228.20
-..___tag_value_NucStrstrSearch.141:                             #
-        movq      -48(%rbp), %r12                               #5228.20
-..___tag_value_NucStrstrSearch.142:                             #
-        movq      -16(%rbp), %r13                               #5228.20
-..___tag_value_NucStrstrSearch.143:                             #
-        movq      -24(%rbp), %r14                               #5228.20
-..___tag_value_NucStrstrSearch.144:                             #
-        movq      -32(%rbp), %r15                               #5228.20
-..___tag_value_NucStrstrSearch.145:                             #
-        movq      %rbp, %rsp                                    #5228.20
-        popq      %rbp                                          #5228.20
-..___tag_value_NucStrstrSearch.146:                             #
-        ret                                                     #5228.20
-..___tag_value_NucStrstrSearch.147:                             #
-                                # LOE
-..B1.107:                       # Preds ..B1.13 ..B1.16 ..B1.17 ..B1.14 ..B1.7
-                                #       ..B1.31 ..B1.15 ..B1.4 ..B1.100 ..B1.93
-                                #       ..B1.86 ..B1.79 ..B1.72 ..B1.66 ..B1.59
-                                #       ..B1.52 ..B1.46 ..B1.40 ..B1.34 ..B1.22
-                                #       ..B1.2 ..B1.117
-..LN149:
-   .loc    1  5311
-        movq      -40(%rbp), %rbx                               #5311.12
-..___tag_value_NucStrstrSearch.153:                             #
-        movq      -48(%rbp), %r12                               #5311.12
-..___tag_value_NucStrstrSearch.154:                             #
-        movq      -16(%rbp), %r13                               #5311.12
-..___tag_value_NucStrstrSearch.155:                             #
-        movq      -24(%rbp), %r14                               #5311.12
-..___tag_value_NucStrstrSearch.156:                             #
-        xorl      %eax, %eax                                    #5311.12
-        movq      -32(%rbp), %r15                               #5311.12
-..___tag_value_NucStrstrSearch.157:                             #
-        movq      %rbp, %rsp                                    #5311.12
-        popq      %rbp                                          #5311.12
-..___tag_value_NucStrstrSearch.158:                             #
-        ret                                                     #5311.12
-        .align    16,0x90
-..___tag_value_NucStrstrSearch.159:                             #
-                                # LOE
-# mark_end;
-	.type	NucStrstrSearch, at function
-	.size	NucStrstrSearch,.-NucStrstrSearch
-.LNNucStrstrSearch:
-	.section .data1, "wa"
-	.align 32
-	.align 32
-..1..TPKT.30_0.0.1:
-	.quad	..1.30_0.TAG.00.0.1
-	.quad	..1.30_0.TAG.01.0.1
-	.quad	..1.30_0.TAG.02.0.1
-	.quad	..1.30_0.TAG.03.0.1
-	.quad	..1.30_0.TAG.04.0.1
-	.quad	..1.30_0.TAG.05.0.1
-	.quad	..1.30_0.TAG.06.0.1
-	.quad	..1.30_0.TAG.07.0.1
-	.quad	..1.30_0.TAG.08.0.1
-	.quad	..1.30_0.TAG.09.0.1
-	.quad	..1.30_0.TAG.0a.0.1
-	.quad	..1.30_0.TAG.0b.0.1
-	.quad	..1.30_0.TAG.0c.0.1
-	.data
-# -- End  NucStrstrSearch
-	.text
-# -- Begin  eval_4na_pos
-# mark_begin;
-       .align    16,0x90
-eval_4na_pos:
-# parameter 1(self): %rdi
-# parameter 2(ncbi2na): %rsi
-# parameter 3(pos): %edx
-# parameter 4(len): %ecx
-..B2.1:                         # Preds ..B2.0
-..___tag_value_eval_4na_pos.160:                                #4946.1
-..LN151:
-   .loc    1  4946
-        pushq     %rbp                                          #4946.1
-        movq      %rsp, %rbp                                    #4946.1
-..___tag_value_eval_4na_pos.161:                                #
-        subq      $176, %rsp                                    #4946.1
-        movq      %r15, -48(%rbp)                               #4946.1
-..___tag_value_eval_4na_pos.163:                                #
-        movq      %r14, -40(%rbp)                               #4946.1
-..___tag_value_eval_4na_pos.164:                                #
-        movq      %r13, -32(%rbp)                               #4946.1
-..___tag_value_eval_4na_pos.165:                                #
-        movq      %r12, -24(%rbp)                               #4946.1
-..___tag_value_eval_4na_pos.166:                                #
-        movq      %rbx, -16(%rbp)                               #4946.1
-..___tag_value_eval_4na_pos.167:                                #
-        movl      %edx, %r14d                                   #4946.1
-        movq      %rsi, %r15                                    #4946.1
-        movq      %rdi, %rbx                                    #4946.1
-        lea       _gprof_pack1(%rip), %rdx                      #4946.1
-        movl      %ecx, -168(%rbp)                              #4946.1
-        call      mcount at PLT                                    #4946.1
-                                # LOE rbx r15 r14d
-..B2.50:                        # Preds ..B2.1
-        movl      -168(%rbp), %ecx                              #
-        movl      %r14d, -8(%rbp)                               #4946.1
-..LN153:
-   .loc    1  4985
-        lea       (%r14,%rcx), %r12d                            #4985.5
-..LN155:
-   .loc    1  4993
-        movl      %r14d, %r13d                                  #4993.49
-        shrl      $2, %r13d                                     #4993.49
-..LN157:
-   .loc    1  4996
-        subl      4(%rbx), %r12d                                #4996.12
-..LN159:
-   .loc    1  4993
-        lea       (%r15,%r13), %rdi                             #4993.30
-..LN161:
-   .loc    1  4999
-        lea       3(%r14,%rcx), %esi                            #4999.50
-..LN163:
-        shrl      $2, %esi                                      #4999.57
-..LN165:
-        addq      %r15, %rsi                                    #4999.30
-        movq      %rsi, -176(%rbp)                              #4999.30
-..LN167:
-   .loc    1  5002
-        call      prime_buffer_4na at PLT                          #5002.14
-                                # LOE rbx r13 r14 r15 r12d r14d r14b xmm0
-..B2.51:                        # Preds ..B2.50
-..LN169:
-   .loc    1  5009
-        movdqa    16(%rbx), %xmm8                               #5009.5
-        movdqa    32(%rbx), %xmm7                               #5009.5
-        movdqa    48(%rbx), %xmm6                               #5009.5
-        movdqa    64(%rbx), %xmm5                               #5009.5
-        movdqa    80(%rbx), %xmm4                               #5009.5
-        movdqa    96(%rbx), %xmm3                               #5009.5
-        movdqa    112(%rbx), %xmm2                              #5009.5
-        movdqa    128(%rbx), %xmm1                              #5009.5
-..LN171:
-   .loc    1  5003
-        lea       8(%r15,%r13), %r13                            #5003.5
-        movq      %r13, %rdx                                    #5003.5
-..LN173:
-   .loc    1  5012
-        xorl      %edi, %edi                                    #5012.15
-..LN175:
-        xorl      %r8d, %r8d                                    #5012.10
-..LN177:
-        xorl      %esi, %esi                                    #5012.5
-..LN179:
-   .loc    1  5014
-        movl      %r12d, %eax                                   #5014.20
-        subl      %r14d, %eax                                   #5014.20
-..LN181:
-        addl      $7, %eax                                      #5014.33
-..LN183:
-        shrl      $2, %eax                                      #5014.40
-..LN185:
-   .loc    1  5023
-        movl      %r14d, %ecx                                   #5023.20
-        andl      $3, %ecx                                      #5023.20
-        je        ..B2.45       # Prob 20%                      #5023.20
-                                # LOE rdx r13 r14 eax ecx esi edi r8d r12d r14d r14b xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.2:                         # Preds ..B2.51
-        cmpl      $1, %ecx                                      #5023.20
-        je        ..B2.8        # Prob 25%                      #5023.20
-                                # LOE rdx r13 r14 eax ecx esi edi r8d r12d r14d r14b xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.3:                         # Preds ..B2.2
-        cmpl      $2, %ecx                                      #5023.20
-        je        ..B2.7        # Prob 33%                      #5023.20
-                                # LOE rdx r13 r14 eax ecx esi edi r8d r12d r14d r14b xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.4:                         # Preds ..B2.3
-        cmpl      $3, %ecx                                      #5023.20
-        je        ..B2.6        # Prob 50%                      #5023.20
-                                # LOE rdx r13 r14 eax esi edi r8d r12d r14d r14b xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.5:                         # Preds ..B2.4
-        movq      -176(%rbp), %rbx                              #
-        jmp       ..B2.16       # Prob 100%                     #
-                                # LOE rdx rbx r13 r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.6:                         # Preds ..B2.4
-        movq      -176(%rbp), %rbx                              #
-        jmp       ..B2.11       # Prob 100%                     #
-                                # LOE rdx rbx r13 eax esi edi r8d r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.7:                         # Preds ..B2.3
-        movq      -176(%rbp), %rbx                              #
-        jmp       ..B2.10       # Prob 100%                     #
-                                # LOE rdx rbx r13 eax esi r8d r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.8:                         # Preds ..B2.2
-        movq      -176(%rbp), %rbx                              #
-                                # LOE rdx rbx r13 eax esi r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.9:                         # Preds ..B2.8 ..B2.20
-..LN187:
-   .loc    1  5047
-        movdqa    %xmm0, %xmm10                                 #5047.22
-..LN189:
-   .loc    1  5048
-        movdqa    %xmm0, %xmm9                                  #5048.22
-..LN191:
-   .loc    1  5047
-        pand      %xmm6, %xmm10                                 #5047.22
-..LN193:
-   .loc    1  5048
-        pand      %xmm5, %xmm9                                  #5048.22
-..LN195:
-   .loc    1  5049
-        pcmpeqd   %xmm9, %xmm10                                 #5049.22
-..LN197:
-   .loc    1  5050
-        pmovmskb  %xmm10, %r8d                                  #5050.22
-..LN199:
-   .loc    1  5051
-        incl      %r8d                                          #5051.17
-        shrl      $16, %r8d                                     #5051.17
-        negl      %r8d                                          #5051.17
-                                # LOE rdx rbx r13 eax esi r8d r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.10:                        # Preds ..B2.7 ..B2.9
-..LN201:
-   .loc    1  5054
-        movdqa    %xmm0, %xmm10                                 #5054.22
-..LN203:
-   .loc    1  5055
-        movdqa    %xmm0, %xmm9                                  #5055.22
-..LN205:
-   .loc    1  5054
-        pand      %xmm4, %xmm10                                 #5054.22
-..LN207:
-   .loc    1  5055
-        pand      %xmm3, %xmm9                                  #5055.22
-..LN209:
-   .loc    1  5056
-        pcmpeqd   %xmm9, %xmm10                                 #5056.22
-..LN211:
-   .loc    1  5057
-        pmovmskb  %xmm10, %edi                                  #5057.22
-..LN213:
-   .loc    1  5058
-        incl      %edi                                          #5058.17
-        shrl      $16, %edi                                     #5058.17
-        negl      %edi                                          #5058.17
-                                # LOE rdx rbx r13 eax esi edi r8d r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.11:                        # Preds ..B2.6 ..B2.10
-..LN215:
-   .loc    1  5061
-        movdqa    %xmm0, %xmm10                                 #5061.22
-..LN217:
-   .loc    1  5062
-        movdqa    %xmm0, %xmm9                                  #5062.22
-..LN219:
-   .loc    1  5069
-        andl      $-4, %r14d                                    #5069.17
-..LN221:
-   .loc    1  5061
-        pand      %xmm2, %xmm10                                 #5061.22
-..LN223:
-   .loc    1  5062
-        pand      %xmm1, %xmm9                                  #5062.22
-..LN225:
-   .loc    1  5063
-        pcmpeqd   %xmm9, %xmm10                                 #5063.22
-..LN227:
-   .loc    1  5064
-        pmovmskb  %xmm10, %ecx                                  #5064.22
-..LN229:
-   .loc    1  5072
-        movl      %esi, %r9d                                    #5072.29
-        orl       %r8d, %r9d                                    #5072.29
-..LN231:
-   .loc    1  5065
-        incl      %ecx                                          #5065.17
-        shrl      $16, %ecx                                     #5065.17
-        negl      %ecx                                          #5065.17
-..LN233:
-   .loc    1  5072
-        orl       %edi, %r9d                                    #5072.34
-..LN235:
-        orl       %ecx, %r9d                                    #5072.39
-..LN237:
-        jne       ..B2.21       # Prob 20%                      #5072.47
-                                # LOE rdx rbx r13 eax ecx esi edi r8d r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.12:                        # Preds ..B2.11
-..LN239:
-   .loc    1  5135
-        addl      $4, %r14d                                     #5135.17
-..LN241:
-   .loc    1  5138
-        cmpl      %r12d, %r14d                                  #5138.28
-        ja        ..B2.44       # Prob 20%                      #5138.28
-                                # LOE rdx rbx r13 eax r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.13:                        # Preds ..B2.12
-..LN243:
-   .loc    1  5142
-        decl      %eax                                          #5142.25
-..LN245:
-        jne       ..B2.17       # Prob 50%                      #5142.39
-                                # LOE rdx rbx r13 eax r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.14:                        # Preds ..B2.13
-..LN247:
-   .loc    1  5159
-        cmpq      %rbx, %r13                                    #5159.25
-        jae       ..B2.44       # Prob 4%                       #5159.25
-                                # LOE rbx r13 r12d r14d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.15:                        # Preds ..B2.14
-..LN249:
-   .loc    1  5169
-        movdqa    %xmm1, -176(%rbp)                             #5169.22
-        movdqa    %xmm2, -160(%rbp)                             #5169.22
-        movdqa    %xmm3, -144(%rbp)                             #5169.22
-        movdqa    %xmm4, -128(%rbp)                             #5169.22
-        movdqa    %xmm5, -112(%rbp)                             #5169.22
-        movdqa    %xmm6, -96(%rbp)                              #5169.22
-        movdqa    %xmm7, -80(%rbp)                              #5169.22
-        movdqa    %xmm8, -64(%rbp)                              #5169.22
-        movq      %r13, %rdi                                    #5169.22
-        movq      %rbx, %rsi                                    #5169.22
-        call      prime_buffer_4na at PLT                          #5169.22
-                                # LOE rbx r13 r12d r14d xmm0
-..B2.52:                        # Preds ..B2.15
-        movdqa    -64(%rbp), %xmm8                              #
-        movdqa    -80(%rbp), %xmm7                              #
-        movdqa    -96(%rbp), %xmm6                              #
-        movdqa    -112(%rbp), %xmm5                             #
-..LN251:
-   .loc    1  5184
-        addq      $8, %r13                                      #5184.13
-        movq      %r13, %rdx                                    #5184.13
-        movdqa    -128(%rbp), %xmm4                             #
-        movdqa    -144(%rbp), %xmm3                             #
-        movdqa    -160(%rbp), %xmm2                             #
-        movdqa    -176(%rbp), %xmm1                             #
-                                # LOE rdx rbx r13 r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.16:                        # Preds ..B2.5 ..B2.52
-..LN253:
-   .loc    1  5030
-        movl      $8, %eax                                      #5030.13
-        jmp       ..B2.20       # Prob 100%                     #5030.13
-                                # LOE rdx rbx r13 eax r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.17:                        # Preds ..B2.13
-..LN255:
-   .loc    1  5147
-        psrldq    $2, %xmm0                                     #5147.26
-..LN257:
-   .loc    1  5150
-        cmpq      %rbx, %rdx                                    #5150.26
-        jae       ..B2.19       # Prob 19%                      #5150.26
-                                # LOE rdx rbx r13 eax r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.18:                        # Preds ..B2.17
-..LN259:
-   .loc    1  5151
-        movzbl    (%rdx), %esi                                  #5151.72
-..LN261:
-        lea       expand_2na.0(%rip), %rcx                      #5151.57
-        movzwl    (%rcx,%rsi,2), %edi                           #5151.57
-..LN263:
-        pinsrw    $7, %edi, %xmm0                               #5151.30
-                                # LOE rdx rbx r13 eax r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.19:                        # Preds ..B2.18 ..B2.17
-..LN265:
-   .loc    1  5154
-        incq      %rdx                                          #5154.20
-                                # LOE rdx rbx r13 eax r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.20:                        # Preds ..B2.16 ..B2.19 ..B2.45
-..LN267:
-   .loc    1  5040
-        movdqa    %xmm0, %xmm10                                 #5040.22
-..LN269:
-   .loc    1  5041
-        movdqa    %xmm0, %xmm9                                  #5041.22
-..LN271:
-   .loc    1  5040
-        pand      %xmm8, %xmm10                                 #5040.22
-..LN273:
-   .loc    1  5041
-        pand      %xmm7, %xmm9                                  #5041.22
-..LN275:
-   .loc    1  5042
-        pcmpeqd   %xmm9, %xmm10                                 #5042.22
-..LN277:
-   .loc    1  5043
-        pmovmskb  %xmm10, %esi                                  #5043.22
-..LN279:
-   .loc    1  5044
-        incl      %esi                                          #5044.17
-        shrl      $16, %esi                                     #5044.17
-        negl      %esi                                          #5044.17
-        jmp       ..B2.9        # Prob 100%                     #5044.17
-                                # LOE rdx rbx r13 eax esi r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.21:                        # Preds ..B2.11                 # Infreq
-..LN281:
-   .loc    1  5075
-        subl      %r14d, %r12d                                  #5075.30
-..LN283:
-        je        ..B2.42       # Prob 25%                      #5075.37
-                                # LOE ecx esi edi r8d r12d r14d
-..B2.22:                        # Preds ..B2.21                 # Infreq
-        cmpl      $1, %r12d                                     #5075.37
-        jne       ..B2.27       # Prob 67%                      #5075.37
-                                # LOE ecx esi edi r8d r12d r14d
-..B2.23:                        # Preds ..B2.22                 # Infreq
-..LN285:
-   .loc    1  5081
-        testl     %esi, %esi                                    #5081.36
-        jne       ..B2.43       # Prob 28%                      #5081.36
-                                # LOE r8d r14d
-..B2.24:                        # Preds ..B2.23                 # Infreq
-..LN287:
-   .loc    1  5082
-        testl     %r8d, %r8d                                    #5082.36
-        je        ..B2.44       # Prob 50%                      #5082.36
-                                # LOE r14d
-..B2.25:                        # Preds ..B2.35 ..B2.29 ..B2.24 # Infreq
-..LN289:
-        subl      -8(%rbp), %r14d                               #5082.47
-..LN291:
-        movq      -16(%rbp), %rbx                               #5082.61
-..___tag_value_eval_4na_pos.168:                                #
-        addl      $2, %r14d                                     #5082.61
-        movl      %r14d, %eax                                   #5082.61
-        movq      -24(%rbp), %r12                               #5082.61
-..___tag_value_eval_4na_pos.169:                                #
-        movq      -32(%rbp), %r13                               #5082.61
-..___tag_value_eval_4na_pos.170:                                #
-        movq      -40(%rbp), %r14                               #5082.61
-..___tag_value_eval_4na_pos.171:                                #
-        movq      -48(%rbp), %r15                               #5082.61
-..___tag_value_eval_4na_pos.172:                                #
-        movq      %rbp, %rsp                                    #5082.61
-        popq      %rbp                                          #5082.61
-..___tag_value_eval_4na_pos.173:                                #
-        ret                                                     #5082.61
-..___tag_value_eval_4na_pos.174:                                #
-                                # LOE
-..B2.27:                        # Preds ..B2.22                 # Infreq
-..LN293:
-   .loc    1  5075
-        cmpl      $2, %r12d                                     #5075.37
-        jne       ..B2.34       # Prob 50%                      #5075.37
-                                # LOE ecx esi edi r8d r14d
-..B2.28:                        # Preds ..B2.27                 # Infreq
-..LN295:
-   .loc    1  5085
-        testl     %esi, %esi                                    #5085.36
-        jne       ..B2.43       # Prob 28%                      #5085.36
-                                # LOE edi r8d r14d
-..B2.29:                        # Preds ..B2.28                 # Infreq
-..LN297:
-   .loc    1  5086
-        testl     %r8d, %r8d                                    #5086.36
-        jne       ..B2.25       # Prob 28%                      #5086.36
-                                # LOE edi r14d
-..B2.30:                        # Preds ..B2.29                 # Infreq
-..LN299:
-   .loc    1  5087
-        testl     %edi, %edi                                    #5087.36
-        je        ..B2.44       # Prob 50%                      #5087.36
-                                # LOE r14d
-..B2.31:                        # Preds ..B2.36 ..B2.30         # Infreq
-..LN301:
-        subl      -8(%rbp), %r14d                               #5087.47
-..LN303:
-        movq      -16(%rbp), %rbx                               #5087.61
-..___tag_value_eval_4na_pos.180:                                #
-        addl      $3, %r14d                                     #5087.61
-        movl      %r14d, %eax                                   #5087.61
-        movq      -24(%rbp), %r12                               #5087.61
-..___tag_value_eval_4na_pos.181:                                #
-        movq      -32(%rbp), %r13                               #5087.61
-..___tag_value_eval_4na_pos.182:                                #
-        movq      -40(%rbp), %r14                               #5087.61
-..___tag_value_eval_4na_pos.183:                                #
-        movq      -48(%rbp), %r15                               #5087.61
-..___tag_value_eval_4na_pos.184:                                #
-        movq      %rbp, %rsp                                    #5087.61
-        popq      %rbp                                          #5087.61
-..___tag_value_eval_4na_pos.185:                                #
-        ret                                                     #5087.61
-..___tag_value_eval_4na_pos.186:                                #
-                                # LOE
-..B2.34:                        # Preds ..B2.27                 # Infreq
-..LN305:
-   .loc    1  5090
-        testl     %esi, %esi                                    #5090.36
-        jne       ..B2.43       # Prob 28%                      #5090.36
-                                # LOE ecx edi r8d r14d
-..B2.35:                        # Preds ..B2.34                 # Infreq
-..LN307:
-   .loc    1  5091
-        testl     %r8d, %r8d                                    #5091.36
-        jne       ..B2.25       # Prob 28%                      #5091.36
-                                # LOE ecx edi r14d
-..B2.36:                        # Preds ..B2.35                 # Infreq
-..LN309:
-   .loc    1  5092
-        testl     %edi, %edi                                    #5092.36
-        jne       ..B2.31       # Prob 28%                      #5092.36
-                                # LOE ecx r14d
-..B2.37:                        # Preds ..B2.36                 # Infreq
-..LN311:
-   .loc    1  5093
-        testl     %ecx, %ecx                                    #5093.36
-        je        ..B2.44       # Prob 50%                      #5093.36
-                                # LOE r14d
-..B2.38:                        # Preds ..B2.37                 # Infreq
-..LN313:
-        subl      -8(%rbp), %r14d                               #5093.47
-..LN315:
-        movq      -16(%rbp), %rbx                               #5093.61
-..___tag_value_eval_4na_pos.192:                                #
-        addl      $4, %r14d                                     #5093.61
-        movl      %r14d, %eax                                   #5093.61
-        movq      -24(%rbp), %r12                               #5093.61
-..___tag_value_eval_4na_pos.193:                                #
-        movq      -32(%rbp), %r13                               #5093.61
-..___tag_value_eval_4na_pos.194:                                #
-        movq      -40(%rbp), %r14                               #5093.61
-..___tag_value_eval_4na_pos.195:                                #
-        movq      -48(%rbp), %r15                               #5093.61
-..___tag_value_eval_4na_pos.196:                                #
-        movq      %rbp, %rsp                                    #5093.61
-        popq      %rbp                                          #5093.61
-..___tag_value_eval_4na_pos.197:                                #
-        ret                                                     #5093.61
-..___tag_value_eval_4na_pos.198:                                #
-                                # LOE
-..B2.42:                        # Preds ..B2.21                 # Infreq
-..LN317:
-   .loc    1  5078
-        testl     %esi, %esi                                    #5078.36
-        je        ..B2.44       # Prob 50%                      #5078.36
-                                # LOE r14d
-..B2.43:                        # Preds ..B2.34 ..B2.28 ..B2.23 ..B2.42 # Infreq
-..LN319:
-        subl      -8(%rbp), %r14d                               #5078.47
-..LN321:
-        movq      -16(%rbp), %rbx                               #5078.61
-..___tag_value_eval_4na_pos.204:                                #
-        incl      %r14d                                         #5078.61
-        movl      %r14d, %eax                                   #5078.61
-        movq      -24(%rbp), %r12                               #5078.61
-..___tag_value_eval_4na_pos.205:                                #
-        movq      -32(%rbp), %r13                               #5078.61
-..___tag_value_eval_4na_pos.206:                                #
-        movq      -40(%rbp), %r14                               #5078.61
-..___tag_value_eval_4na_pos.207:                                #
-        movq      -48(%rbp), %r15                               #5078.61
-..___tag_value_eval_4na_pos.208:                                #
-        movq      %rbp, %rsp                                    #5078.61
-        popq      %rbp                                          #5078.61
-..___tag_value_eval_4na_pos.209:                                #
-        ret                                                     #5078.61
-..___tag_value_eval_4na_pos.210:                                #
-                                # LOE
-..B2.44:                        # Preds ..B2.14 ..B2.12 ..B2.37 ..B2.30 ..B2.24
-                                #       ..B2.42                 # Infreq
-..LN323:
-   .loc    1  5095
-        movq      -16(%rbp), %rbx                               #5095.28
-..___tag_value_eval_4na_pos.216:                                #
-        movq      -24(%rbp), %r12                               #5095.28
-..___tag_value_eval_4na_pos.217:                                #
-        movq      -32(%rbp), %r13                               #5095.28
-..___tag_value_eval_4na_pos.218:                                #
-        movq      -40(%rbp), %r14                               #5095.28
-..___tag_value_eval_4na_pos.219:                                #
-        xorl      %eax, %eax                                    #5095.28
-        movq      -48(%rbp), %r15                               #5095.28
-..___tag_value_eval_4na_pos.220:                                #
-        movq      %rbp, %rsp                                    #5095.28
-        popq      %rbp                                          #5095.28
-..___tag_value_eval_4na_pos.221:                                #
-        ret                                                     #5095.28
-..___tag_value_eval_4na_pos.222:                                #
-                                # LOE
-..B2.45:                        # Preds ..B2.51                 # Infreq
-        movq      -176(%rbp), %rbx                              #
-        jmp       ..B2.20       # Prob 100%                     #
-        .align    16,0x90
-..___tag_value_eval_4na_pos.228:                                #
-                                # LOE rdx rbx r13 eax r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-# mark_end;
-	.type	eval_4na_pos, at function
-	.size	eval_4na_pos,.-eval_4na_pos
-.LNeval_4na_pos:
-	.data
-# -- End  eval_4na_pos
-	.text
-# -- Begin  prime_buffer_4na
-# mark_begin;
-       .align    16,0x90
-prime_buffer_4na:
-# parameter 1(src): %rdi
-# parameter 2(ignore): %rsi
-..B3.1:                         # Preds ..B3.0
-..___tag_value_prime_buffer_4na.229:                            #3990.1
-..LN325:
-   .loc    1  3990
-        pushq     %rbp                                          #3990.1
-        movq      %rsp, %rbp                                    #3990.1
-..___tag_value_prime_buffer_4na.230:                            #
-        subq      $32, %rsp                                     #3990.1
-        movq      %r14, -16(%rbp)                               #3990.1
-..___tag_value_prime_buffer_4na.232:                            #
-        movq      %rdi, %r14                                    #3990.1
-        lea       _gprof_pack2(%rip), %rdx                      #3990.1
-        call      mcount at PLT                                    #3990.1
-                                # LOE rbx r12 r13 r14 r15
-..B3.4:                         # Preds ..B3.1
-..LN327:
-   .loc    1  3996
-        movzbl    (%r14), %edx                                  #3996.34
-..LN329:
-   .loc    1  3997
-        movzbl    1(%r14), %esi                                 #3997.34
-..LN331:
-   .loc    1  3998
-        movzbl    2(%r14), %r8d                                 #3998.34
-..LN333:
-   .loc    1  3999
-        movzbl    3(%r14), %r10d                                #3999.34
-..LN335:
-   .loc    1  3996
-        lea       expand_2na.0(%rip), %rax                      #3996.21
-        movzwl    (%rax,%rdx,2), %ecx                           #3996.21
-..LN337:
-   .loc    1  3997
-        movzwl    (%rax,%rsi,2), %edi                           #3997.21
-..LN339:
-   .loc    1  3998
-        movzwl    (%rax,%r8,2), %r9d                            #3998.21
-..LN341:
-   .loc    1  3999
-        movzwl    (%rax,%r10,2), %r11d                          #3999.21
-..LN343:
-   .loc    1  4000
-        movzbl    4(%r14), %edx                                 #4000.34
-..LN345:
-   .loc    1  4001
-        movzbl    5(%r14), %esi                                 #4001.34
-..LN347:
-   .loc    1  4002
-        movzbl    6(%r14), %r8d                                 #4002.34
-..LN349:
-   .loc    1  4003
-        movzbl    7(%r14), %r14d                                #4003.34
-..LN351:
-   .loc    1  3996
-        movw      %cx, -32(%rbp)                                #3996.5
-..LN353:
-   .loc    1  4000
-        movzwl    (%rax,%rdx,2), %ecx                           #4000.21
-..LN355:
-   .loc    1  3997
-        movw      %di, -30(%rbp)                                #3997.5
-..LN357:
-   .loc    1  4001
-        movzwl    (%rax,%rsi,2), %edi                           #4001.21
-..LN359:
-   .loc    1  3998
-        movw      %r9w, -28(%rbp)                               #3998.5
-..LN361:
-   .loc    1  4002
-        movzwl    (%rax,%r8,2), %r9d                            #4002.21
-..LN363:
-   .loc    1  4003
-        movzwl    (%rax,%r14,2), %eax                           #4003.21
-..LN365:
-   .loc    1  4006
-        movq      -16(%rbp), %r14                               #4006.12
-..___tag_value_prime_buffer_4na.233:                            #
-..LN367:
-   .loc    1  3999
-        movw      %r11w, -26(%rbp)                              #3999.5
-..LN369:
-   .loc    1  4000
-        movw      %cx, -24(%rbp)                                #4000.5
-..LN371:
-   .loc    1  4001
-        movw      %di, -22(%rbp)                                #4001.5
-..LN373:
-   .loc    1  4002
-        movw      %r9w, -20(%rbp)                               #4002.5
-..LN375:
-   .loc    1  4003
-        movw      %ax, -18(%rbp)                                #4003.5
-..LN377:
-   .loc    1  4005
-        movdqu    -32(%rbp), %xmm0                              #4005.51
-..LN379:
-   .loc    1  4006
-        movq      %rbp, %rsp                                    #4006.12
-        popq      %rbp                                          #4006.12
-..___tag_value_prime_buffer_4na.234:                            #
-        ret                                                     #4006.12
-        .align    16,0x90
-..___tag_value_prime_buffer_4na.235:                            #
-                                # LOE
-# mark_end;
-	.type	prime_buffer_4na, at function
-	.size	prime_buffer_4na,.-prime_buffer_4na
-.LNprime_buffer_4na:
-	.data
-# -- End  prime_buffer_4na
-	.text
-# -- Begin  eval_2na_pos
-# mark_begin;
-       .align    16,0x90
-eval_2na_pos:
-# parameter 1(self): %rdi
-# parameter 2(ncbi2na): %rsi
-# parameter 3(pos): %edx
-# parameter 4(len): %ecx
-..B4.1:                         # Preds ..B4.0
-..___tag_value_eval_2na_pos.236:                                #3662.1
-..LN381:
-   .loc    1  3662
-        pushq     %rbp                                          #3662.1
-        movq      %rsp, %rbp                                    #3662.1
-..___tag_value_eval_2na_pos.237:                                #
-        subq      $176, %rsp                                    #3662.1
-        movq      %r15, -48(%rbp)                               #3662.1
-..___tag_value_eval_2na_pos.239:                                #
-        movq      %r14, -40(%rbp)                               #3662.1
-..___tag_value_eval_2na_pos.240:                                #
-        movq      %r13, -32(%rbp)                               #3662.1
-..___tag_value_eval_2na_pos.241:                                #
-        movq      %r12, -24(%rbp)                               #3662.1
-..___tag_value_eval_2na_pos.242:                                #
-        movq      %rbx, -16(%rbp)                               #3662.1
-..___tag_value_eval_2na_pos.243:                                #
-        movl      %ecx, %r13d                                   #3662.1
-        movl      %edx, %r12d                                   #3662.1
-        movq      %rsi, %rbx                                    #3662.1
-        movq      %rdi, %r15                                    #3662.1
-        lea       _gprof_pack3(%rip), %rdx                      #3662.1
-        call      mcount at PLT                                    #3662.1
-                                # LOE rbx r15 r12d r13d
-..B4.53:                        # Preds ..B4.1
-        movl      %r12d, -8(%rbp)                               #3662.1
-..LN383:
-   .loc    1  3705
-        lea       (%r12,%r13), %r14d                            #3705.5
-..LN385:
-   .loc    1  3716
-        subl      4(%r15), %r14d                                #3716.12
-..LN387:
-   .loc    1  3713
-        movl      %r12d, %eax                                   #3713.49
-        shrl      $2, %eax                                      #3713.49
-..LN389:
-        movq      %rax, -176(%rbp)                              #3713.30
-        lea       (%rbx,%rax), %rdi                             #3713.30
-..LN391:
-   .loc    1  3719
-        lea       3(%r12,%r13), %r13d                           #3719.50
-..LN393:
-        shrl      $2, %r13d                                     #3719.57
-..LN395:
-        addq      %rbx, %r13                                    #3719.30
-..LN397:
-   .loc    1  3722
-        movq      %r13, %rsi                                    #3722.14
-        call      prime_buffer_2na at PLT                          #3722.14
-                                # LOE rbx r12 r13 r15 r12d r14d r12b xmm0
-..B4.54:                        # Preds ..B4.53
-..LN399:
-   .loc    1  3723
-        movq      -176(%rbp), %rax                              #3723.5
-        lea       16(%rbx,%rax), %r8                            #3723.5
-        movq      %r8, %rdi                                     #3723.5
-..LN401:
-   .loc    1  3728
-        cmpq      %r13, %r8                                     #3728.16
-..LN403:
-   .loc    1  3733
-..LN405:
-   .loc    1  3728
-        jae       ..B4.3        # Prob 12%                      #3728.16
-                                # LOE rdi r8 r12 r13 r15 ebx r12d r14d r12b xmm0
-..B4.2:                         # Preds ..B4.54
-..LN407:
-   .loc    1  3729
-        movzbl    -1(%r8), %ebx                                 #3729.24
-..LN409:
-        shll      $8, %ebx                                      #3729.38
-                                # LOE rdi r8 r12 r13 r15 ebx r12d r14d r12b xmm0
-..B4.3:                         # Preds ..B4.2 ..B4.54
-..LN411:
-   .loc    1  3733
-        movdqa    16(%r15), %xmm8                               #3733.5
-        movdqa    32(%r15), %xmm7                               #3733.5
-        movdqa    48(%r15), %xmm6                               #3733.5
-        movdqa    64(%r15), %xmm5                               #3733.5
-        movdqa    80(%r15), %xmm4                               #3733.5
-        movdqa    96(%r15), %xmm3                               #3733.5
-        movdqa    112(%r15), %xmm2                              #3733.5
-        movdqa    128(%r15), %xmm1                              #3733.5
-..LN413:
-   .loc    1  3736
-        xorl      %ecx, %ecx                                    #3736.15
-..LN415:
-        xorl      %esi, %esi                                    #3736.10
-..LN417:
-        xorl      %edx, %edx                                    #3736.5
-..LN419:
-   .loc    1  3738
-        movl      %r14d, %eax                                   #3738.20
-        subl      %r12d, %eax                                   #3738.20
-..LN421:
-        addl      $7, %eax                                      #3738.33
-..LN423:
-        shrl      $2, %eax                                      #3738.40
-..LN425:
-   .loc    1  3745
-        movl      %r12d, %r9d                                   #3745.20
-        andl      $3, %r9d                                      #3745.20
-        je        ..B4.48       # Prob 20%                      #3745.20
-                                # LOE rdi r8 r12 r13 eax edx ecx ebx esi r9d r12d r14d r12b xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.4:                         # Preds ..B4.3
-        cmpl      $1, %r9d                                      #3745.20
-        je        ..B4.10       # Prob 25%                      #3745.20
-                                # LOE rdi r8 r12 r13 eax edx ecx ebx esi r9d r12d r14d r12b xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.5:                         # Preds ..B4.4
-        cmpl      $2, %r9d                                      #3745.20
-        je        ..B4.9        # Prob 33%                      #3745.20
-                                # LOE rdi r8 r12 r13 eax edx ecx ebx esi r9d r12d r14d r12b xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.6:                         # Preds ..B4.5
-        cmpl      $3, %r9d                                      #3745.20
-        je        ..B4.8        # Prob 50%                      #3745.20
-                                # LOE rdi r8 r12 r13 eax edx ecx ebx esi r12d r14d r12b xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.7:                         # Preds ..B4.6
-        movq      %r13, %r15                                    #
-        movq      %r8, %r13                                     #
-        jmp       ..B4.19       # Prob 100%                     #
-                                # LOE rdi r13 r15 ebx r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.8:                         # Preds ..B4.6
-        movq      %r13, %r15                                    #
-        movq      %r8, %r13                                     #
-        jmp       ..B4.13       # Prob 100%                     #
-                                # LOE rdi r13 r15 eax edx ecx ebx esi r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.9:                         # Preds ..B4.5
-        movq      %r13, %r15                                    #
-        movq      %r8, %r13                                     #
-        jmp       ..B4.12       # Prob 100%                     #
-                                # LOE rdi r13 r15 eax edx ebx esi r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.10:                        # Preds ..B4.4
-        movq      %r13, %r15                                    #
-        movq      %r8, %r13                                     #
-                                # LOE rdi r13 r15 eax edx ebx r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.11:                        # Preds ..B4.10 ..B4.23
-..LN427:
-   .loc    1  3768
-        movdqa    %xmm0, %xmm9                                  #3768.22
-        pand      %xmm5, %xmm9                                  #3768.22
-..LN429:
-   .loc    1  3769
-        pcmpeqd   %xmm6, %xmm9                                  #3769.22
-..LN431:
-   .loc    1  3770
-        pmovmskb  %xmm9, %esi                                   #3770.22
-..LN433:
-   .loc    1  3771
-        incl      %esi                                          #3771.17
-        shrl      $16, %esi                                     #3771.17
-        negl      %esi                                          #3771.17
-                                # LOE rdi r13 r15 eax edx ebx esi r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.12:                        # Preds ..B4.9 ..B4.11
-..LN435:
-   .loc    1  3774
-        movdqa    %xmm0, %xmm9                                  #3774.22
-        pand      %xmm3, %xmm9                                  #3774.22
-..LN437:
-   .loc    1  3775
-        pcmpeqd   %xmm4, %xmm9                                  #3775.22
-..LN439:
-   .loc    1  3776
-        pmovmskb  %xmm9, %ecx                                   #3776.22
-..LN441:
-   .loc    1  3777
-        incl      %ecx                                          #3777.17
-        shrl      $16, %ecx                                     #3777.17
-        negl      %ecx                                          #3777.17
-                                # LOE rdi r13 r15 eax edx ecx ebx esi r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.13:                        # Preds ..B4.8 ..B4.12
-..LN443:
-   .loc    1  3780
-        movdqa    %xmm0, %xmm9                                  #3780.22
-..LN445:
-   .loc    1  3787
-        andl      $-4, %r12d                                    #3787.17
-..LN447:
-   .loc    1  3790
-        movl      %edx, %r9d                                    #3790.29
-..LN449:
-   .loc    1  3780
-        pand      %xmm1, %xmm9                                  #3780.22
-..LN451:
-   .loc    1  3781
-        pcmpeqd   %xmm2, %xmm9                                  #3781.22
-..LN453:
-   .loc    1  3782
-        pmovmskb  %xmm9, %r8d                                   #3782.22
-..LN455:
-   .loc    1  3790
-        orl       %esi, %r9d                                    #3790.29
-..LN457:
-        orl       %ecx, %r9d                                    #3790.34
-..LN459:
-   .loc    1  3783
-        incl      %r8d                                          #3783.17
-        shrl      $16, %r8d                                     #3783.17
-        negl      %r8d                                          #3783.17
-..LN461:
-   .loc    1  3790
-        orl       %r8d, %r9d                                    #3790.39
-..LN463:
-        jne       ..B4.24       # Prob 20%                      #3790.47
-                                # LOE rdi r13 r15 eax edx ecx ebx esi r8d r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.14:                        # Preds ..B4.13
-..LN465:
-   .loc    1  3853
-        addl      $4, %r12d                                     #3853.17
-..LN467:
-   .loc    1  3856
-        cmpl      %r14d, %r12d                                  #3856.28
-        ja        ..B4.47       # Prob 20%                      #3856.28
-                                # LOE rdi r13 r15 eax ebx r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.15:                        # Preds ..B4.14
-..LN469:
-   .loc    1  3860
-        decl      %eax                                          #3860.25
-..LN471:
-        jne       ..B4.20       # Prob 50%                      #3860.39
-                                # LOE rdi r13 r15 eax ebx r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.16:                        # Preds ..B4.15
-..LN473:
-   .loc    1  3881
-        cmpq      %r15, %r13                                    #3881.25
-        jae       ..B4.47       # Prob 4%                       #3881.25
-                                # LOE r13 r15 ebx r12d r14d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.17:                        # Preds ..B4.16
-..LN475:
-   .loc    1  3891
-        movdqa    %xmm1, -176(%rbp)                             #3891.22
-        movdqa    %xmm2, -160(%rbp)                             #3891.22
-        movdqa    %xmm3, -144(%rbp)                             #3891.22
-        movdqa    %xmm4, -128(%rbp)                             #3891.22
-        movdqa    %xmm5, -112(%rbp)                             #3891.22
-        movdqa    %xmm6, -96(%rbp)                              #3891.22
-        movdqa    %xmm7, -80(%rbp)                              #3891.22
-        movdqa    %xmm8, -64(%rbp)                              #3891.22
-        movq      %r13, %rdi                                    #3891.22
-        movq      %r15, %rsi                                    #3891.22
-        call      prime_buffer_2na at PLT                          #3891.22
-                                # LOE r13 r15 ebx r12d r14d xmm0
-..B4.55:                        # Preds ..B4.17
-        movdqa    -64(%rbp), %xmm8                              #
-        movdqa    -80(%rbp), %xmm7                              #
-        movdqa    -96(%rbp), %xmm6                              #
-        movdqa    -112(%rbp), %xmm5                             #
-..LN477:
-   .loc    1  3969
-        addq      $16, %r13                                     #3969.13
-        movq      %r13, %rdi                                    #3969.13
-        movdqa    -128(%rbp), %xmm4                             #
-        movdqa    -144(%rbp), %xmm3                             #
-        movdqa    -160(%rbp), %xmm2                             #
-        movdqa    -176(%rbp), %xmm1                             #
-..LN479:
-   .loc    1  3972
-        cmpq      %r15, %r13                                    #3972.24
-        jae       ..B4.19       # Prob 12%                      #3972.24
-                                # LOE rdi r13 r15 ebx r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.18:                        # Preds ..B4.55
-..LN481:
-   .loc    1  3973
-        movzbl    -1(%r13), %ebx                                #3973.32
-..LN483:
-        shll      $8, %ebx                                      #3973.46
-                                # LOE rdi r13 r15 ebx r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.19:                        # Preds ..B4.55 ..B4.7 ..B4.18
-..LN485:
-   .loc    1  3752
-        movl      $16, %eax                                     #3752.13
-        jmp       ..B4.23       # Prob 100%                     #3752.13
-                                # LOE rdi r13 r15 eax ebx r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.20:                        # Preds ..B4.15
-..LN487:
-   .loc    1  3865
-        psrldq    $1, %xmm0                                     #3865.26
-..LN489:
-   .loc    1  3868
-        cmpq      %r15, %rdi                                    #3868.26
-        jae       ..B4.22       # Prob 19%                      #3868.26
-                                # LOE rdi r13 r15 eax ebx r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.21:                        # Preds ..B4.20
-..LN491:
-   .loc    1  3871
-        movzbl    (%rdi), %edx                                  #3871.37
-..LN493:
-   .loc    1  3870
-        sarl      $8, %ebx                                      #3870.21
-..LN495:
-   .loc    1  3871
-        shll      $8, %edx                                      #3871.48
-..LN497:
-        orl       %edx, %ebx                                    #3871.21
-..LN499:
-   .loc    1  3872
-        pinsrw    $7, %ebx, %xmm0                               #3872.30
-                                # LOE rdi r13 r15 eax ebx r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.22:                        # Preds ..B4.21 ..B4.20
-..LN501:
-   .loc    1  3876
-        incq      %rdi                                          #3876.20
-                                # LOE rdi r13 r15 eax ebx r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.23:                        # Preds ..B4.19 ..B4.22 ..B4.48
-..LN503:
-   .loc    1  3762
-        movdqa    %xmm0, %xmm9                                  #3762.22
-        pand      %xmm7, %xmm9                                  #3762.22
-..LN505:
-   .loc    1  3763
-        pcmpeqd   %xmm8, %xmm9                                  #3763.22
-..LN507:
-   .loc    1  3764
-        pmovmskb  %xmm9, %edx                                   #3764.22
-..LN509:
-   .loc    1  3765
-        incl      %edx                                          #3765.17
-        shrl      $16, %edx                                     #3765.17
-        negl      %edx                                          #3765.17
-        jmp       ..B4.11       # Prob 100%                     #3765.17
-                                # LOE rdi r13 r15 eax edx ebx r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.24:                        # Preds ..B4.13                 # Infreq
-..LN511:
-   .loc    1  3793
-        subl      %r12d, %r14d                                  #3793.30
-..LN513:
-        je        ..B4.45       # Prob 25%                      #3793.37
-                                # LOE edx ecx esi r8d r12d r14d
-..B4.25:                        # Preds ..B4.24                 # Infreq
-        cmpl      $1, %r14d                                     #3793.37
-        jne       ..B4.30       # Prob 67%                      #3793.37
-                                # LOE edx ecx esi r8d r12d r14d
-..B4.26:                        # Preds ..B4.25                 # Infreq
-..LN515:
-   .loc    1  3799
-        testl     %edx, %edx                                    #3799.36
-        jne       ..B4.46       # Prob 28%                      #3799.36
-                                # LOE esi r12d
-..B4.27:                        # Preds ..B4.26                 # Infreq
-..LN517:
-   .loc    1  3800
-        testl     %esi, %esi                                    #3800.36
-        je        ..B4.47       # Prob 50%                      #3800.36
-                                # LOE r12d
-..B4.28:                        # Preds ..B4.38 ..B4.32 ..B4.27 # Infreq
-..LN519:
-        subl      -8(%rbp), %r12d                               #3800.47
-..LN521:
-        movq      -16(%rbp), %rbx                               #3800.61
-..___tag_value_eval_2na_pos.244:                                #
-        addl      $2, %r12d                                     #3800.61
-        movl      %r12d, %eax                                   #3800.61
-        movq      -24(%rbp), %r12                               #3800.61
-..___tag_value_eval_2na_pos.245:                                #
-        movq      -32(%rbp), %r13                               #3800.61
-..___tag_value_eval_2na_pos.246:                                #
-        movq      -40(%rbp), %r14                               #3800.61
-..___tag_value_eval_2na_pos.247:                                #
-        movq      -48(%rbp), %r15                               #3800.61
-..___tag_value_eval_2na_pos.248:                                #
-        movq      %rbp, %rsp                                    #3800.61
-        popq      %rbp                                          #3800.61
-..___tag_value_eval_2na_pos.249:                                #
-        ret                                                     #3800.61
-..___tag_value_eval_2na_pos.250:                                #
-                                # LOE
-..B4.30:                        # Preds ..B4.25                 # Infreq
-..LN523:
-   .loc    1  3793
-        cmpl      $2, %r14d                                     #3793.37
-        jne       ..B4.37       # Prob 50%                      #3793.37
-                                # LOE edx ecx esi r8d r12d
-..B4.31:                        # Preds ..B4.30                 # Infreq
-..LN525:
-   .loc    1  3803
-        testl     %edx, %edx                                    #3803.36
-        jne       ..B4.46       # Prob 28%                      #3803.36
-                                # LOE ecx esi r12d
-..B4.32:                        # Preds ..B4.31                 # Infreq
-..LN527:
-   .loc    1  3804
-        testl     %esi, %esi                                    #3804.36
-        jne       ..B4.28       # Prob 28%                      #3804.36
-                                # LOE ecx r12d
-..B4.33:                        # Preds ..B4.32                 # Infreq
-..LN529:
-   .loc    1  3805
-        testl     %ecx, %ecx                                    #3805.36
-        je        ..B4.47       # Prob 50%                      #3805.36
-                                # LOE r12d
-..B4.34:                        # Preds ..B4.39 ..B4.33         # Infreq
-..LN531:
-        subl      -8(%rbp), %r12d                               #3805.47
-..LN533:
-        movq      -16(%rbp), %rbx                               #3805.61
-..___tag_value_eval_2na_pos.256:                                #
-        addl      $3, %r12d                                     #3805.61
-        movl      %r12d, %eax                                   #3805.61
-        movq      -24(%rbp), %r12                               #3805.61
-..___tag_value_eval_2na_pos.257:                                #
-        movq      -32(%rbp), %r13                               #3805.61
-..___tag_value_eval_2na_pos.258:                                #
-        movq      -40(%rbp), %r14                               #3805.61
-..___tag_value_eval_2na_pos.259:                                #
-        movq      -48(%rbp), %r15                               #3805.61
-..___tag_value_eval_2na_pos.260:                                #
-        movq      %rbp, %rsp                                    #3805.61
-        popq      %rbp                                          #3805.61
-..___tag_value_eval_2na_pos.261:                                #
-        ret                                                     #3805.61
-..___tag_value_eval_2na_pos.262:                                #
-                                # LOE
-..B4.37:                        # Preds ..B4.30                 # Infreq
-..LN535:
-   .loc    1  3808
-        testl     %edx, %edx                                    #3808.36
-        jne       ..B4.46       # Prob 28%                      #3808.36
-                                # LOE ecx esi r8d r12d
-..B4.38:                        # Preds ..B4.37                 # Infreq
-..LN537:
-   .loc    1  3809
-        testl     %esi, %esi                                    #3809.36
-        jne       ..B4.28       # Prob 28%                      #3809.36
-                                # LOE ecx r8d r12d
-..B4.39:                        # Preds ..B4.38                 # Infreq
-..LN539:
-   .loc    1  3810
-        testl     %ecx, %ecx                                    #3810.36
-        jne       ..B4.34       # Prob 28%                      #3810.36
-                                # LOE r8d r12d
-..B4.40:                        # Preds ..B4.39                 # Infreq
-..LN541:
-   .loc    1  3811
-        testl     %r8d, %r8d                                    #3811.36
-        je        ..B4.47       # Prob 50%                      #3811.36
-                                # LOE r12d
-..B4.41:                        # Preds ..B4.40                 # Infreq
-..LN543:
-        subl      -8(%rbp), %r12d                               #3811.47
-..LN545:
-        movq      -16(%rbp), %rbx                               #3811.61
-..___tag_value_eval_2na_pos.268:                                #
-        addl      $4, %r12d                                     #3811.61
-        movl      %r12d, %eax                                   #3811.61
-        movq      -24(%rbp), %r12                               #3811.61
-..___tag_value_eval_2na_pos.269:                                #
-        movq      -32(%rbp), %r13                               #3811.61
-..___tag_value_eval_2na_pos.270:                                #
-        movq      -40(%rbp), %r14                               #3811.61
-..___tag_value_eval_2na_pos.271:                                #
-        movq      -48(%rbp), %r15                               #3811.61
-..___tag_value_eval_2na_pos.272:                                #
-        movq      %rbp, %rsp                                    #3811.61
-        popq      %rbp                                          #3811.61
-..___tag_value_eval_2na_pos.273:                                #
-        ret                                                     #3811.61
-..___tag_value_eval_2na_pos.274:                                #
-                                # LOE
-..B4.45:                        # Preds ..B4.24                 # Infreq
-..LN547:
-   .loc    1  3796
-        testl     %edx, %edx                                    #3796.36
-        je        ..B4.47       # Prob 50%                      #3796.36
-                                # LOE r12d
-..B4.46:                        # Preds ..B4.37 ..B4.31 ..B4.26 ..B4.45 # Infreq
-..LN549:
-        subl      -8(%rbp), %r12d                               #3796.47
-..LN551:
-        movq      -16(%rbp), %rbx                               #3796.61
-..___tag_value_eval_2na_pos.280:                                #
-        incl      %r12d                                         #3796.61
-        movl      %r12d, %eax                                   #3796.61
-        movq      -24(%rbp), %r12                               #3796.61
-..___tag_value_eval_2na_pos.281:                                #
-        movq      -32(%rbp), %r13                               #3796.61
-..___tag_value_eval_2na_pos.282:                                #
-        movq      -40(%rbp), %r14                               #3796.61
-..___tag_value_eval_2na_pos.283:                                #
-        movq      -48(%rbp), %r15                               #3796.61
-..___tag_value_eval_2na_pos.284:                                #
-        movq      %rbp, %rsp                                    #3796.61
-        popq      %rbp                                          #3796.61
-..___tag_value_eval_2na_pos.285:                                #
-        ret                                                     #3796.61
-..___tag_value_eval_2na_pos.286:                                #
-                                # LOE
-..B4.47:                        # Preds ..B4.14 ..B4.16 ..B4.40 ..B4.33 ..B4.27
-                                #       ..B4.45                 # Infreq
-..LN553:
-   .loc    1  3813
-        movq      -16(%rbp), %rbx                               #3813.28
-..___tag_value_eval_2na_pos.292:                                #
-        movq      -24(%rbp), %r12                               #3813.28
-..___tag_value_eval_2na_pos.293:                                #
-        movq      -32(%rbp), %r13                               #3813.28
-..___tag_value_eval_2na_pos.294:                                #
-        movq      -40(%rbp), %r14                               #3813.28
-..___tag_value_eval_2na_pos.295:                                #
-        xorl      %eax, %eax                                    #3813.28
-        movq      -48(%rbp), %r15                               #3813.28
-..___tag_value_eval_2na_pos.296:                                #
-        movq      %rbp, %rsp                                    #3813.28
-        popq      %rbp                                          #3813.28
-..___tag_value_eval_2na_pos.297:                                #
-        ret                                                     #3813.28
-..___tag_value_eval_2na_pos.298:                                #
-                                # LOE
-..B4.48:                        # Preds ..B4.3                  # Infreq
-        movq      %r13, %r15                                    #
-        movq      %r8, %r13                                     #
-        jmp       ..B4.23       # Prob 100%                     #
-        .align    16,0x90
-..___tag_value_eval_2na_pos.304:                                #
-                                # LOE rdi r13 r15 eax ebx r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-# mark_end;
-	.type	eval_2na_pos, at function
-	.size	eval_2na_pos,.-eval_2na_pos
-.LNeval_2na_pos:
-	.data
-# -- End  eval_2na_pos
-	.text
-# -- Begin  prime_buffer_2na
-# mark_begin;
-       .align    16,0x90
-prime_buffer_2na:
-# parameter 1(src): %rdi
-# parameter 2(ignore): %rsi
-..B5.1:                         # Preds ..B5.0
-..___tag_value_prime_buffer_2na.305:                            #2129.1
-..LN555:
-   .loc    1  2129
-        pushq     %rbp                                          #2129.1
-        movq      %rsp, %rbp                                    #2129.1
-..___tag_value_prime_buffer_2na.306:                            #
-        subq      $16, %rsp                                     #2129.1
-        movq      %r12, -16(%rbp)                               #2129.1
-..___tag_value_prime_buffer_2na.308:                            #
-        movq      %rdi, %r12                                    #2129.1
-        lea       _gprof_pack4(%rip), %rdx                      #2129.1
-        call      mcount at PLT                                    #2129.1
-                                # LOE rbx r12 r13 r14 r15
-..B5.7:                         # Preds ..B5.1
-..LN557:
-   .loc    1  2132
-        testq     $15, %r12                                     #2132.29
-..LN559:
-        jne       ..B5.3        # Prob 50%                      #2132.37
-                                # LOE rbx r12 r13 r14 r15
-..B5.2:                         # Preds ..B5.7
-..LN561:
-   .loc    1  2133
-        movdqa    (%r12), %xmm0                                 #2133.54
-        jmp       ..B5.4        # Prob 100%                     #2133.54
-                                # LOE rbx r13 r14 r15 xmm0
-..B5.3:                         # Preds ..B5.7
-..LN563:
-   .loc    1  2135
-        movdqu    (%r12), %xmm0                                 #2135.55
-                                # LOE rbx r13 r14 r15 xmm0
-..B5.4:                         # Preds ..B5.2 ..B5.3
-..LN565:
-   .loc    1  2136
-        movq      -16(%rbp), %r12                               #2136.12
-..___tag_value_prime_buffer_2na.309:                            #
-        movq      %rbp, %rsp                                    #2136.12
-        popq      %rbp                                          #2136.12
-..___tag_value_prime_buffer_2na.310:                            #
-        ret                                                     #2136.12
-        .align    16,0x90
-..___tag_value_prime_buffer_2na.311:                            #
-                                # LOE
-# mark_end;
-	.type	prime_buffer_2na, at function
-	.size	prime_buffer_2na,.-prime_buffer_2na
-.LNprime_buffer_2na:
-	.data
-# -- End  prime_buffer_2na
-	.text
-# -- Begin  eval_4na_128
-# mark_begin;
-       .align    16,0x90
-eval_4na_128:
-# parameter 1(self): %rdi
-# parameter 2(ncbi2na): %rsi
-# parameter 3(pos): %edx
-# parameter 4(len): %ecx
-..B6.1:                         # Preds ..B6.0
-..___tag_value_eval_4na_128.312:                                #4724.1
-..LN567:
-   .loc    1  4724
-        pushq     %rbp                                          #4724.1
-        movq      %rsp, %rbp                                    #4724.1
-..___tag_value_eval_4na_128.313:                                #
-        subq      $176, %rsp                                    #4724.1
-        movq      %r15, -16(%rbp)                               #4724.1
-..___tag_value_eval_4na_128.315:                                #
-        movq      %r14, -24(%rbp)                               #4724.1
-..___tag_value_eval_4na_128.316:                                #
-        movq      %r13, -32(%rbp)                               #4724.1
-..___tag_value_eval_4na_128.317:                                #
-        movq      %r12, -40(%rbp)                               #4724.1
-..___tag_value_eval_4na_128.318:                                #
-        movq      %rbx, -48(%rbp)                               #4724.1
-..___tag_value_eval_4na_128.319:                                #
-        movl      %edx, %r14d                                   #4724.1
-        movq      %rsi, %r15                                    #4724.1
-        movq      %rdi, %rbx                                    #4724.1
-        lea       _gprof_pack5(%rip), %rdx                      #4724.1
-        movl      %ecx, -168(%rbp)                              #4724.1
-        call      mcount at PLT                                    #4724.1
-                                # LOE rbx r15 r14d
-..B6.37:                        # Preds ..B6.1
-        movl      -168(%rbp), %ecx                              #
-..LN569:
-   .loc    1  4757
-        lea       (%r14,%rcx), %r12d                            #4757.5
-..LN571:
-   .loc    1  4763
-        subl      4(%rbx), %r12d                                #4763.12
-..LN573:
-   .loc    1  4760
-        movl      %r14d, %r13d                                  #4760.49
-        shrl      $2, %r13d                                     #4760.49
-..LN575:
-        lea       (%r15,%r13), %rdi                             #4760.30
-..LN577:
-   .loc    1  4766
-        lea       3(%r14,%rcx), %esi                            #4766.50
-..LN579:
-        shrl      $2, %esi                                      #4766.57
-..LN581:
-        addq      %r15, %rsi                                    #4766.30
-        movq      %rsi, -176(%rbp)                              #4766.30
-..LN583:
-   .loc    1  4769
-        call      prime_buffer_4na at PLT                          #4769.14
-                                # LOE rbx r13 r15 r12d r14d xmm0
-..B6.38:                        # Preds ..B6.37
-..LN585:
-   .loc    1  4776
-        movdqa    16(%rbx), %xmm8                               #4776.5
-        movdqa    32(%rbx), %xmm7                               #4776.5
-        movdqa    48(%rbx), %xmm6                               #4776.5
-        movdqa    64(%rbx), %xmm5                               #4776.5
-        movdqa    80(%rbx), %xmm4                               #4776.5
-        movdqa    96(%rbx), %xmm3                               #4776.5
-        movdqa    112(%rbx), %xmm2                              #4776.5
-        movdqa    128(%rbx), %xmm1                              #4776.5
-..LN587:
-   .loc    1  4770
-        lea       8(%r15,%r13), %r13                            #4770.5
-        movq      %r13, %rdx                                    #4770.5
-..LN589:
-   .loc    1  4779
-        xorl      %esi, %esi                                    #4779.15
-..LN591:
-        xorl      %edi, %edi                                    #4779.10
-..LN593:
-        xorl      %ecx, %ecx                                    #4779.5
-..LN595:
-   .loc    1  4781
-        movl      %r12d, %eax                                   #4781.20
-        subl      %r14d, %eax                                   #4781.20
-..LN597:
-        addl      $7, %eax                                      #4781.33
-..LN599:
-        shrl      $2, %eax                                      #4781.40
-..LN601:
-   .loc    1  4790
-        movl      %r14d, %ebx                                   #4790.20
-        andl      $3, %ebx                                      #4790.20
-        je        ..B6.32       # Prob 20%                      #4790.20
-                                # LOE rdx r13 eax ecx ebx esi edi r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.2:                         # Preds ..B6.38
-        cmpl      $1, %ebx                                      #4790.20
-        je        ..B6.8        # Prob 25%                      #4790.20
-                                # LOE rdx r13 eax ecx ebx esi edi r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.3:                         # Preds ..B6.2
-        cmpl      $2, %ebx                                      #4790.20
-        je        ..B6.7        # Prob 33%                      #4790.20
-                                # LOE rdx r13 eax ecx ebx esi edi r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.4:                         # Preds ..B6.3
-        cmpl      $3, %ebx                                      #4790.20
-        je        ..B6.6        # Prob 50%                      #4790.20
-                                # LOE rdx r13 eax ecx esi edi r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.5:                         # Preds ..B6.4
-        movq      -176(%rbp), %rbx                              #
-        jmp       ..B6.16       # Prob 100%                     #
-                                # LOE rdx rbx r13 r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.6:                         # Preds ..B6.4
-        movq      -176(%rbp), %rbx                              #
-        jmp       ..B6.11       # Prob 100%                     #
-                                # LOE rdx rbx r13 eax ecx esi edi r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.7:                         # Preds ..B6.3
-        movq      -176(%rbp), %rbx                              #
-        jmp       ..B6.10       # Prob 100%                     #
-                                # LOE rdx rbx r13 eax ecx edi r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.8:                         # Preds ..B6.2
-        movq      -176(%rbp), %rbx                              #
-                                # LOE rdx rbx r13 eax ecx r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.9:                         # Preds ..B6.8 ..B6.20
-..LN603:
-   .loc    1  4814
-        movdqa    %xmm0, %xmm10                                 #4814.22
-..LN605:
-   .loc    1  4815
-        movdqa    %xmm0, %xmm9                                  #4815.22
-..LN607:
-   .loc    1  4814
-        pand      %xmm6, %xmm10                                 #4814.22
-..LN609:
-   .loc    1  4815
-        pand      %xmm5, %xmm9                                  #4815.22
-..LN611:
-   .loc    1  4816
-        pcmpeqd   %xmm9, %xmm10                                 #4816.22
-..LN613:
-   .loc    1  4817
-        pmovmskb  %xmm10, %edi                                  #4817.22
-..LN615:
-   .loc    1  4818
-        incl      %edi                                          #4818.17
-        shrl      $16, %edi                                     #4818.17
-        negl      %edi                                          #4818.17
-                                # LOE rdx rbx r13 eax ecx edi r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.10:                        # Preds ..B6.7 ..B6.9
-..LN617:
-   .loc    1  4821
-        movdqa    %xmm0, %xmm10                                 #4821.22
-..LN619:
-   .loc    1  4822
-        movdqa    %xmm0, %xmm9                                  #4822.22
-..LN621:
-   .loc    1  4821
-        pand      %xmm4, %xmm10                                 #4821.22
-..LN623:
-   .loc    1  4822
-        pand      %xmm3, %xmm9                                  #4822.22
-..LN625:
-   .loc    1  4823
-        pcmpeqd   %xmm9, %xmm10                                 #4823.22
-..LN627:
-   .loc    1  4824
-        pmovmskb  %xmm10, %esi                                  #4824.22
-..LN629:
-   .loc    1  4825
-        incl      %esi                                          #4825.17
-        shrl      $16, %esi                                     #4825.17
-        negl      %esi                                          #4825.17
-                                # LOE rdx rbx r13 eax ecx esi edi r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.11:                        # Preds ..B6.6 ..B6.10
-..LN631:
-   .loc    1  4828
-        movdqa    %xmm0, %xmm10                                 #4828.22
-..LN633:
-   .loc    1  4829
-        movdqa    %xmm0, %xmm9                                  #4829.22
-..LN635:
-   .loc    1  4836
-        andl      $-4, %r14d                                    #4836.17
-..LN637:
-   .loc    1  4828
-        pand      %xmm2, %xmm10                                 #4828.22
-..LN639:
-   .loc    1  4829
-        pand      %xmm1, %xmm9                                  #4829.22
-..LN641:
-   .loc    1  4830
-        pcmpeqd   %xmm9, %xmm10                                 #4830.22
-..LN643:
-   .loc    1  4831
-        pmovmskb  %xmm10, %r8d                                  #4831.22
-..LN645:
-   .loc    1  4839
-        movl      %ecx, %r9d                                    #4839.29
-        orl       %edi, %r9d                                    #4839.29
-..LN647:
-   .loc    1  4832
-        incl      %r8d                                          #4832.17
-        shrl      $16, %r8d                                     #4832.17
-        negl      %r8d                                          #4832.17
-..LN649:
-   .loc    1  4839
-        orl       %esi, %r9d                                    #4839.34
-..LN651:
-        orl       %r8d, %r9d                                    #4839.39
-..LN653:
-        jne       ..B6.21       # Prob 20%                      #4839.47
-                                # LOE rdx rbx r13 eax ecx esi edi r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.12:                        # Preds ..B6.11
-..LN655:
-   .loc    1  4880
-        addl      $4, %r14d                                     #4880.17
-..LN657:
-   .loc    1  4883
-        cmpl      %r12d, %r14d                                  #4883.28
-        ja        ..B6.29       # Prob 20%                      #4883.28
-                                # LOE rdx rbx r13 eax r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.13:                        # Preds ..B6.12
-..LN659:
-   .loc    1  4887
-        decl      %eax                                          #4887.25
-..LN661:
-        jne       ..B6.17       # Prob 50%                      #4887.39
-                                # LOE rdx rbx r13 eax r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.14:                        # Preds ..B6.13
-..LN663:
-   .loc    1  4904
-        cmpq      %rbx, %r13                                    #4904.25
-        jae       ..B6.29       # Prob 4%                       #4904.25
-                                # LOE rbx r13 r12d r14d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.15:                        # Preds ..B6.14
-..LN665:
-   .loc    1  4914
-        movdqa    %xmm1, -176(%rbp)                             #4914.22
-        movdqa    %xmm2, -160(%rbp)                             #4914.22
-        movdqa    %xmm3, -144(%rbp)                             #4914.22
-        movdqa    %xmm4, -128(%rbp)                             #4914.22
-        movdqa    %xmm5, -112(%rbp)                             #4914.22
-        movdqa    %xmm6, -96(%rbp)                              #4914.22
-        movdqa    %xmm7, -80(%rbp)                              #4914.22
-        movdqa    %xmm8, -64(%rbp)                              #4914.22
-        movq      %r13, %rdi                                    #4914.22
-        movq      %rbx, %rsi                                    #4914.22
-        call      prime_buffer_4na at PLT                          #4914.22
-                                # LOE rbx r13 r12d r14d xmm0
-..B6.39:                        # Preds ..B6.15
-        movdqa    -64(%rbp), %xmm8                              #
-        movdqa    -80(%rbp), %xmm7                              #
-        movdqa    -96(%rbp), %xmm6                              #
-        movdqa    -112(%rbp), %xmm5                             #
-..LN667:
-   .loc    1  4929
-        addq      $8, %r13                                      #4929.13
-        movq      %r13, %rdx                                    #4929.13
-        movdqa    -128(%rbp), %xmm4                             #
-        movdqa    -144(%rbp), %xmm3                             #
-        movdqa    -160(%rbp), %xmm2                             #
-        movdqa    -176(%rbp), %xmm1                             #
-                                # LOE rdx rbx r13 r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.16:                        # Preds ..B6.5 ..B6.39
-..LN669:
-   .loc    1  4797
-        movl      $8, %eax                                      #4797.13
-        jmp       ..B6.20       # Prob 100%                     #4797.13
-                                # LOE rdx rbx r13 eax r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.17:                        # Preds ..B6.13
-..LN671:
-   .loc    1  4892
-        psrldq    $2, %xmm0                                     #4892.26
-..LN673:
-   .loc    1  4895
-        cmpq      %rbx, %rdx                                    #4895.26
-        jae       ..B6.19       # Prob 19%                      #4895.26
-                                # LOE rdx rbx r13 eax r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.18:                        # Preds ..B6.17
-..LN675:
-   .loc    1  4896
-        movzbl    (%rdx), %esi                                  #4896.72
-..LN677:
-        lea       expand_2na.0(%rip), %rcx                      #4896.57
-        movzwl    (%rcx,%rsi,2), %edi                           #4896.57
-..LN679:
-        pinsrw    $7, %edi, %xmm0                               #4896.30
-                                # LOE rdx rbx r13 eax r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.19:                        # Preds ..B6.18 ..B6.17
-..LN681:
-   .loc    1  4899
-        incq      %rdx                                          #4899.20
-                                # LOE rdx rbx r13 eax r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.20:                        # Preds ..B6.16 ..B6.19 ..B6.32
-..LN683:
-   .loc    1  4807
-        movdqa    %xmm0, %xmm10                                 #4807.22
-..LN685:
-   .loc    1  4808
-        movdqa    %xmm0, %xmm9                                  #4808.22
-..LN687:
-   .loc    1  4807
-        pand      %xmm8, %xmm10                                 #4807.22
-..LN689:
-   .loc    1  4808
-        pand      %xmm7, %xmm9                                  #4808.22
-..LN691:
-   .loc    1  4809
-        pcmpeqd   %xmm9, %xmm10                                 #4809.22
-..LN693:
-   .loc    1  4810
-        pmovmskb  %xmm10, %ecx                                  #4810.22
-..LN695:
-   .loc    1  4811
-        incl      %ecx                                          #4811.17
-        shrl      $16, %ecx                                     #4811.17
-        negl      %ecx                                          #4811.17
-        jmp       ..B6.9        # Prob 100%                     #4811.17
-                                # LOE rdx rbx r13 eax ecx r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.21:                        # Preds ..B6.11                 # Infreq
-..LN697:
-   .loc    1  4842
-        subl      %r14d, %r12d                                  #4842.30
-..LN699:
-        cmpl      $2, %r12d                                     #4842.37
-        je        ..B6.25       # Prob 25%                      #4842.37
-                                # LOE ecx esi edi r12d
-..B6.22:                        # Preds ..B6.21                 # Infreq
-        cmpl      $1, %r12d                                     #4842.37
-        je        ..B6.26       # Prob 33%                      #4842.37
-                                # LOE ecx edi r12d
-..B6.23:                        # Preds ..B6.22                 # Infreq
-        testl     %r12d, %r12d                                  #4842.37
-        je        ..B6.27       # Prob 50%                      #4842.37
-                                # LOE ecx
-..B6.24:                        # Preds ..B6.23                 # Infreq
-..LN701:
-   .loc    1  4845
-        movq      -48(%rbp), %rbx                               #4845.32
-..___tag_value_eval_4na_128.320:                                #
-        movq      -40(%rbp), %r12                               #4845.32
-..___tag_value_eval_4na_128.321:                                #
-        movq      -32(%rbp), %r13                               #4845.32
-..___tag_value_eval_4na_128.322:                                #
-        movq      -24(%rbp), %r14                               #4845.32
-..___tag_value_eval_4na_128.323:                                #
-        movl      $1, %eax                                      #4845.32
-        movq      -16(%rbp), %r15                               #4845.32
-..___tag_value_eval_4na_128.324:                                #
-        movq      %rbp, %rsp                                    #4845.32
-        popq      %rbp                                          #4845.32
-..___tag_value_eval_4na_128.325:                                #
-        ret                                                     #4845.32
-..___tag_value_eval_4na_128.326:                                #
-                                # LOE
-..B6.25:                        # Preds ..B6.21                 # Infreq
-..LN703:
-   .loc    1  4847
-        testl     %esi, %esi                                    #4847.36
-        jne       ..B6.28       # Prob 28%                      #4847.36
-                                # LOE ecx edi
-..B6.26:                        # Preds ..B6.22 ..B6.25         # Infreq
-..LN705:
-   .loc    1  4849
-        testl     %edi, %edi                                    #4849.36
-        jne       ..B6.28       # Prob 28%                      #4849.36
-                                # LOE ecx
-..B6.27:                        # Preds ..B6.26 ..B6.23         # Infreq
-..LN707:
-   .loc    1  4851
-        testl     %ecx, %ecx                                    #4851.36
-        je        ..B6.29       # Prob 50%                      #4851.36
-                                # LOE
-..B6.28:                        # Preds ..B6.25 ..B6.26 ..B6.27 # Infreq
-..LN709:
-        movq      -48(%rbp), %rbx                               #4851.47
-..___tag_value_eval_4na_128.332:                                #
-        movq      -40(%rbp), %r12                               #4851.47
-..___tag_value_eval_4na_128.333:                                #
-        movq      -32(%rbp), %r13                               #4851.47
-..___tag_value_eval_4na_128.334:                                #
-        movq      -24(%rbp), %r14                               #4851.47
-..___tag_value_eval_4na_128.335:                                #
-        movl      $1, %eax                                      #4851.47
-        movq      -16(%rbp), %r15                               #4851.47
-..___tag_value_eval_4na_128.336:                                #
-        movq      %rbp, %rsp                                    #4851.47
-        popq      %rbp                                          #4851.47
-..___tag_value_eval_4na_128.337:                                #
-        ret                                                     #4851.47
-..___tag_value_eval_4na_128.338:                                #
-                                # LOE
-..B6.29:                        # Preds ..B6.14 ..B6.12 ..B6.27 # Infreq
-..LN711:
-   .loc    1  4853
-        movq      -48(%rbp), %rbx                               #4853.28
-..___tag_value_eval_4na_128.344:                                #
-        movq      -40(%rbp), %r12                               #4853.28
-..___tag_value_eval_4na_128.345:                                #
-        movq      -32(%rbp), %r13                               #4853.28
-..___tag_value_eval_4na_128.346:                                #
-        movq      -24(%rbp), %r14                               #4853.28
-..___tag_value_eval_4na_128.347:                                #
-        xorl      %eax, %eax                                    #4853.28
-        movq      -16(%rbp), %r15                               #4853.28
-..___tag_value_eval_4na_128.348:                                #
-        movq      %rbp, %rsp                                    #4853.28
-        popq      %rbp                                          #4853.28
-..___tag_value_eval_4na_128.349:                                #
-        ret                                                     #4853.28
-..___tag_value_eval_4na_128.350:                                #
-                                # LOE
-..B6.32:                        # Preds ..B6.38                 # Infreq
-        movq      -176(%rbp), %rbx                              #
-        jmp       ..B6.20       # Prob 100%                     #
-        .align    16,0x90
-..___tag_value_eval_4na_128.356:                                #
-                                # LOE rdx rbx r13 eax r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-# mark_end;
-	.type	eval_4na_128, at function
-	.size	eval_4na_128,.-eval_4na_128
-.LNeval_4na_128:
-	.data
-# -- End  eval_4na_128
-	.text
-# -- Begin  eval_4na_32
-# mark_begin;
-       .align    16,0x90
-eval_4na_32:
-# parameter 1(self): %rdi
-# parameter 2(ncbi2na): %rsi
-# parameter 3(pos): %edx
-# parameter 4(len): %ecx
-..B7.1:                         # Preds ..B7.0
-..___tag_value_eval_4na_32.357:                                 #4279.1
-..LN713:
-   .loc    1  4279
-        pushq     %rbp                                          #4279.1
-        movq      %rsp, %rbp                                    #4279.1
-..___tag_value_eval_4na_32.358:                                 #
-        subq      $256, %rsp                                    #4279.1
-        movq      %r15, -184(%rbp)                              #4279.1
-..___tag_value_eval_4na_32.360:                                 #
-        movq      %r14, -24(%rbp)                               #4279.1
-..___tag_value_eval_4na_32.361:                                 #
-        movq      %r13, -32(%rbp)                               #4279.1
-..___tag_value_eval_4na_32.362:                                 #
-        movq      %r12, -48(%rbp)                               #4279.1
-..___tag_value_eval_4na_32.363:                                 #
-        movq      %rbx, -40(%rbp)                               #4279.1
-..___tag_value_eval_4na_32.364:                                 #
-        movl      %ecx, %r12d                                   #4279.1
-        movl      %edx, %r13d                                   #4279.1
-        movq      %rsi, %r15                                    #4279.1
-        movq      %rdi, %rbx                                    #4279.1
-        lea       _gprof_pack6(%rip), %rdx                      #4279.1
-        call      mcount at PLT                                    #4279.1
-                                # LOE rbx r15 r12d r13d
-..B7.45:                        # Preds ..B7.1
-..LN715:
-   .loc    1  4312
-        lea       (%r13,%r12), %eax                             #4312.5
-..LN717:
-   .loc    1  4318
-        subl      4(%rbx), %eax                                 #4318.12
-..LN719:
-   .loc    1  4324
-        movl      %eax, -8(%rbp)                                #4324.14
-..LN721:
-   .loc    1  4315
-        movl      %r13d, %r14d                                  #4315.49
-        shrl      $2, %r14d                                     #4315.49
-..LN723:
-        lea       (%r15,%r14), %rdi                             #4315.30
-..LN725:
-   .loc    1  4321
-        lea       3(%r13,%r12), %esi                            #4321.50
-..LN727:
-        shrl      $2, %esi                                      #4321.57
-..LN729:
-        addq      %r15, %rsi                                    #4321.30
-        movq      %rsi, -16(%rbp)                               #4321.30
-..LN731:
-   .loc    1  4324
-        call      prime_buffer_4na at PLT                          #4324.14
-                                # LOE rbx r14 r15 r13d xmm0
-..B7.46:                        # Preds ..B7.45
-        movl      -8(%rbp), %eax                                #
-..LN733:
-   .loc    1  4331
-        movdqa    16(%rbx), %xmm7                               #4331.5
-        movdqa    32(%rbx), %xmm6                               #4331.5
-        movdqa    48(%rbx), %xmm5                               #4331.5
-        movdqa    64(%rbx), %xmm4                               #4331.5
-        movdqa    80(%rbx), %xmm3                               #4331.5
-        movdqa    96(%rbx), %xmm2                               #4331.5
-        movdqa    112(%rbx), %xmm1                              #4331.5
-        movdqa    128(%rbx), %xmm8                              #4331.5
-..LN735:
-   .loc    1  4325
-        lea       8(%r15,%r14), %r12                            #4325.5
-        movq      %r12, %rsi                                    #4325.5
-..LN737:
-   .loc    1  4334
-        xorl      %r15d, %r15d                                  #4334.15
-..LN739:
-        xorl      %r14d, %r14d                                  #4334.10
-..LN741:
-        xorl      %ecx, %ecx                                    #4334.5
-..LN743:
-   .loc    1  4340
-        movl      $2, %ebx                                      #4340.5
-..LN745:
-   .loc    1  4345
-        movl      %r13d, %edx                                   #4345.20
-        andl      $3, %edx                                      #4345.20
-        je        ..B7.37       # Prob 20%                      #4345.20
-                                # LOE rax rsi r12 eax edx ecx ebx r13d r14d r15d al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B7.2:                         # Preds ..B7.46
-        cmpl      $1, %edx                                      #4345.20
-        je        ..B7.8        # Prob 25%                      #4345.20
-                                # LOE rax rsi r12 eax edx ecx ebx r13d r14d r15d al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B7.3:                         # Preds ..B7.2
-        cmpl      $2, %edx                                      #4345.20
-        je        ..B7.7        # Prob 33%                      #4345.20
-                                # LOE rax rsi r12 eax edx ecx ebx r13d r14d r15d al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B7.4:                         # Preds ..B7.3
-        cmpl      $3, %edx                                      #4345.20
-        je        ..B7.6        # Prob 50%                      #4345.20
-                                # LOE rax rsi r12 eax ecx ebx r13d r14d r15d al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B7.5:                         # Preds ..B7.4
-        movdqa    %xmm8, -80(%rbp)                              #
-        movdqa    %xmm1, -64(%rbp)                              #
-        movdqa    %xmm2, -176(%rbp)                             #
-        movdqa    %xmm3, -128(%rbp)                             #
-        movdqa    %xmm4, -112(%rbp)                             #
-        movdqa    %xmm5, -160(%rbp)                             #
-        movdqa    %xmm6, -144(%rbp)                             #
-        movdqa    %xmm7, -96(%rbp)                              #
-        movl      %eax, -8(%rbp)                                #
-        movl      %r13d, %eax                                   #
-        jmp       ..B7.29       # Prob 100%                     #
-                                # LOE rsi r12 eax xmm0
-..B7.6:                         # Preds ..B7.4
-        movdqa    %xmm8, -80(%rbp)                              #
-        movdqa    %xmm1, -64(%rbp)                              #
-        movdqa    %xmm2, -176(%rbp)                             #
-        movdqa    %xmm3, -128(%rbp)                             #
-        movdqa    %xmm4, -112(%rbp)                             #
-        movdqa    %xmm5, -160(%rbp)                             #
-        movdqa    %xmm6, -144(%rbp)                             #
-        movdqa    %xmm7, -96(%rbp)                              #
-        movl      %eax, -8(%rbp)                                #
-        movl      %r13d, %eax                                   #
-        jmp       ..B7.11       # Prob 100%                     #
-                                # LOE rsi r12 eax ecx ebx r14d r15d xmm0
-..B7.7:                         # Preds ..B7.3
-        movdqa    %xmm8, -80(%rbp)                              #
-        movdqa    %xmm1, -64(%rbp)                              #
-        movdqa    %xmm2, -176(%rbp)                             #
-        movdqa    %xmm3, -128(%rbp)                             #
-        movdqa    %xmm4, -112(%rbp)                             #
-        movdqa    %xmm5, -160(%rbp)                             #
-        movdqa    %xmm6, -144(%rbp)                             #
-        movdqa    %xmm7, -96(%rbp)                              #
-        movl      %eax, -8(%rbp)                                #
-        movl      %r13d, %eax                                   #
-        jmp       ..B7.10       # Prob 100%                     #
-                                # LOE rsi r12 eax ecx ebx r14d xmm0
-..B7.8:                         # Preds ..B7.2
-        movdqa    %xmm8, -80(%rbp)                              #
-        movdqa    %xmm1, -64(%rbp)                              #
-        movdqa    %xmm2, -176(%rbp)                             #
-        movdqa    %xmm3, -128(%rbp)                             #
-        movdqa    %xmm4, -112(%rbp)                             #
-        movdqa    %xmm5, -160(%rbp)                             #
-        movdqa    %xmm6, -144(%rbp)                             #
-        movdqa    %xmm7, -96(%rbp)                              #
-        movl      %eax, -8(%rbp)                                #
-        movl      %r13d, %eax                                   #
-                                # LOE rsi r12 eax ecx ebx xmm0
-..B7.9:                         # Preds ..B7.8 ..B7.33
-..LN747:
-   .loc    1  4369
-        movdqa    %xmm0, %xmm2                                  #4369.22
-..LN749:
-   .loc    1  4370
-        movdqa    %xmm0, %xmm1                                  #4370.22
-..LN751:
-   .loc    1  4369
-        pand      -160(%rbp), %xmm2                             #4369.22
-..LN753:
-   .loc    1  4370
-        pand      -112(%rbp), %xmm1                             #4370.22
-..LN755:
-   .loc    1  4371
-        pcmpeqd   %xmm1, %xmm2                                  #4371.22
-..LN757:
-   .loc    1  4372
-        pmovmskb  %xmm2, %r14d                                  #4372.22
-                                # LOE rsi r12 eax ecx ebx r14d xmm0
-..B7.10:                        # Preds ..B7.7 ..B7.9
-..LN759:
-   .loc    1  4376
-        movdqa    %xmm0, %xmm2                                  #4376.22
-..LN761:
-   .loc    1  4377
-        movdqa    %xmm0, %xmm1                                  #4377.22
-..LN763:
-   .loc    1  4376
-        pand      -128(%rbp), %xmm2                             #4376.22
-..LN765:
-   .loc    1  4377
-        pand      -176(%rbp), %xmm1                             #4377.22
-..LN767:
-   .loc    1  4378
-        pcmpeqd   %xmm1, %xmm2                                  #4378.22
-..LN769:
-   .loc    1  4379
-        pmovmskb  %xmm2, %r15d                                  #4379.22
-                                # LOE rsi r12 eax ecx ebx r14d r15d xmm0
-..B7.11:                        # Preds ..B7.6 ..B7.10
-..LN771:
-   .loc    1  4383
-        movdqa    %xmm0, %xmm2                                  #4383.22
-..LN773:
-   .loc    1  4384
-        movdqa    %xmm0, %xmm1                                  #4384.22
-..LN775:
-   .loc    1  4383
-        pand      -64(%rbp), %xmm2                              #4383.22
-..LN777:
-   .loc    1  4384
-        pand      -80(%rbp), %xmm1                              #4384.22
-..LN779:
-   .loc    1  4385
-        pcmpeqd   %xmm1, %xmm2                                  #4385.22
-..LN781:
-   .loc    1  4386
-        pmovmskb  %xmm2, %edx                                   #4386.22
-..LN783:
-   .loc    1  4391
-        movl      %eax, %r13d                                   #4391.17
-        andl      $-4, %r13d                                    #4391.17
-..LN785:
-   .loc    1  4394
-        movl      %ecx, %eax                                    #4394.29
-        orl       %r14d, %eax                                   #4394.29
-..LN787:
-        orl       %r15d, %eax                                   #4394.34
-..LN789:
-        orl       %edx, %eax                                    #4394.39
-..LN791:
-        je        ..B7.24       # Prob 78%                      #4394.47
-                                # LOE rsi r12 edx ecx ebx r13d r14d r15d xmm0
-..B7.12:                        # Preds ..B7.11
-..LN793:
-   .loc    1  4412
-        movdqa    %xmm0, -256(%rbp)                             #4412.30
-        movl      %ecx, %edi                                    #4412.30
-        movl      %edx, -216(%rbp)                              #4412.30
-        movl      %ecx, -208(%rbp)                              #4412.30
-        movq      %rsi, -200(%rbp)                              #4412.30
-        call      uint16_lsbit at PLT                              #4412.30
-                                # LOE r12 eax ebx r13d r14d r15d
-..B7.47:                        # Preds ..B7.12
-        movq      -200(%rbp), %rsi                              #
-        movdqa    -256(%rbp), %xmm0                             #
-        movl      -208(%rbp), %ecx                              #
-        movl      -216(%rbp), %edx                              #
-                                # LOE rdx rcx rsi r12 eax edx ecx ebx r13d r14d r15d dl cl dh ch xmm0
-..B7.13:                        # Preds ..B7.47
-..LN795:
-   .loc    1  4413
-        movdqa    %xmm0, -256(%rbp)                             #4413.30
-        movl      %r14d, %edi                                   #4413.30
-        movl      %edx, -216(%rbp)                              #4413.30
-..LN797:
-   .loc    1  4412
-        movswq    %ax, %rax                                     #4412.30
-        movl      %eax, -240(%rbp)                              #4412.30
-..LN799:
-   .loc    1  4413
-        movl      %ecx, -208(%rbp)                              #4413.30
-        movq      %rsi, -200(%rbp)                              #4413.30
-        call      uint16_lsbit at PLT                              #4413.30
-                                # LOE r12 eax ebx r13d r14d r15d
-..B7.48:                        # Preds ..B7.13
-        movq      -200(%rbp), %rsi                              #
-        movdqa    -256(%rbp), %xmm0                             #
-        movl      -208(%rbp), %ecx                              #
-        movl      -216(%rbp), %edx                              #
-                                # LOE rdx rcx rsi r12 eax edx ecx ebx r13d r14d r15d dl cl dh ch xmm0
-..B7.14:                        # Preds ..B7.48
-..LN801:
-   .loc    1  4414
-        movdqa    %xmm0, -256(%rbp)                             #4414.30
-        movl      %r15d, %edi                                   #4414.30
-        movl      %edx, -216(%rbp)                              #4414.30
-..LN803:
-   .loc    1  4413
-        movswq    %ax, %rax                                     #4413.30
-        movl      %eax, -224(%rbp)                              #4413.30
-..LN805:
-   .loc    1  4414
-        movl      %ecx, -208(%rbp)                              #4414.30
-        movq      %rsi, -200(%rbp)                              #4414.30
-        call      uint16_lsbit at PLT                              #4414.30
-                                # LOE r12 eax ebx r13d r14d r15d
-..B7.49:                        # Preds ..B7.14
-        movq      -200(%rbp), %rsi                              #
-        movdqa    -256(%rbp), %xmm0                             #
-        movl      -208(%rbp), %ecx                              #
-        movl      -216(%rbp), %edx                              #
-                                # LOE rdx rcx rsi r12 eax edx ecx ebx r13d r14d r15d dl cl dh ch xmm0
-..B7.15:                        # Preds ..B7.49
-..LN807:
-   .loc    1  4415
-        movdqa    %xmm0, -256(%rbp)                             #4415.30
-        movl      %edx, %edi                                    #4415.30
-        movl      %edx, -216(%rbp)                              #4415.30
-..LN809:
-   .loc    1  4414
-        movswq    %ax, %rax                                     #4414.30
-        movl      %eax, -232(%rbp)                              #4414.30
-..LN811:
-   .loc    1  4415
-        movl      %ecx, -208(%rbp)                              #4415.30
-        movq      %rsi, -200(%rbp)                              #4415.30
-        call      uint16_lsbit at PLT                              #4415.30
-                                # LOE r12 eax ebx r13d r14d r15d
-..B7.50:                        # Preds ..B7.15
-        movq      -200(%rbp), %rsi                              #
-        movdqa    -256(%rbp), %xmm0                             #
-        movl      -208(%rbp), %ecx                              #
-        movl      -216(%rbp), %edx                              #
-                                # LOE rdx rcx rsi r12 eax edx ecx ebx r13d r14d r15d dl cl dh ch xmm0
-..B7.16:                        # Preds ..B7.50
-..LN813:
-   .loc    1  4422
-        movl      -232(%rbp), %r9d                              #4422.40
-..LN815:
-   .loc    1  4415
-        movswq    %ax, %r8                                      #4415.30
-..LN817:
-   .loc    1  4421
-        movl      -224(%rbp), %eax                              #4421.40
-..LN819:
-   .loc    1  4415
-..LN821:
-   .loc    1  4421
-        lea       1(%rax,%rax), %eax                            #4421.40
-..LN823:
-   .loc    1  4422
-        lea       2(%r9,%r9), %r9d                              #4422.40
-..LN825:
-   .loc    1  4423
-        lea       3(%r8,%r8), %r10d                             #4423.40
-..LN827:
-   .loc    1  4427
-        testl     %ecx, %ecx                                    #4427.32
-        je        ..B7.18       # Prob 50%                      #4427.32
-                                # LOE rdx rsi r12 eax edx ebx r9d r10d r13d r14d r15d dl dh xmm0
-..B7.17:                        # Preds ..B7.16
-..LN829:
-        movl      -240(%rbp), %ecx                              #4427.43
-        lea       (%r13,%rcx,2), %r8d                           #4427.43
-..LN831:
-        cmpl      -8(%rbp), %r8d                                #4427.49
-        jbe       ..B7.38       # Prob 20%                      #4427.49
-                                # LOE rdx rsi r12 eax edx ebx r9d r10d r13d r14d r15d dl dh xmm0
-..B7.18:                        # Preds ..B7.17 ..B7.16
-..LN833:
-   .loc    1  4428
-        testl     %r14d, %r14d                                  #4428.32
-        je        ..B7.20       # Prob 50%                      #4428.32
-                                # LOE rdx rsi r12 eax edx ebx r9d r10d r13d r15d dl dh xmm0
-..B7.19:                        # Preds ..B7.18
-..LN835:
-        addl      %r13d, %eax                                   #4428.43
-..LN837:
-        cmpl      -8(%rbp), %eax                                #4428.49
-        jbe       ..B7.38       # Prob 20%                      #4428.49
-                                # LOE rdx rsi r12 edx ebx r9d r10d r13d r15d dl dh xmm0
-..B7.20:                        # Preds ..B7.19 ..B7.18
-..LN839:
-   .loc    1  4429
-        testl     %r15d, %r15d                                  #4429.32
-        je        ..B7.22       # Prob 50%                      #4429.32
-                                # LOE rdx rsi r12 edx ebx r9d r10d r13d dl dh xmm0
-..B7.21:                        # Preds ..B7.20
-..LN841:
-        addl      %r13d, %r9d                                   #4429.43
-..LN843:
-        cmpl      -8(%rbp), %r9d                                #4429.49
-        jbe       ..B7.38       # Prob 20%                      #4429.49
-                                # LOE rdx rsi r12 edx ebx r10d r13d dl dh xmm0
-..B7.22:                        # Preds ..B7.21 ..B7.20
-..LN845:
-   .loc    1  4430
-        testl     %edx, %edx                                    #4430.32
-        je        ..B7.24       # Prob 50%                      #4430.32
-                                # LOE rsi r12 ebx r10d r13d xmm0
-..B7.23:                        # Preds ..B7.22
-..LN847:
-        addl      %r13d, %r10d                                  #4430.43
-..LN849:
-        cmpl      -8(%rbp), %r10d                               #4430.49
-        jbe       ..B7.38       # Prob 20%                      #4430.49
-                                # LOE rsi r12 ebx r13d xmm0
-..B7.24:                        # Preds ..B7.23 ..B7.22 ..B7.11
-..LN851:
-   .loc    1  4435
-        lea       4(%r13), %eax                                 #4435.17
-..LN853:
-   .loc    1  4438
-        cmpl      -8(%rbp), %eax                                #4438.28
-        ja        ..B7.35       # Prob 20%                      #4438.28
-                                # LOE rsi r12 eax ebx r13d xmm0
-..B7.25:                        # Preds ..B7.24
-..LN855:
-   .loc    1  4442
-        decl      %ebx                                          #4442.25
-..LN857:
-        jne       ..B7.30       # Prob 50%                      #4442.39
-                                # LOE rsi r12 eax ebx r13d xmm0
-..B7.26:                        # Preds ..B7.25
-..LN859:
-   .loc    1  4459
-        cmpq      -16(%rbp), %r12                               #4459.25
-        jae       ..B7.35       # Prob 4%                       #4459.25
-                                # LOE r12 r13d
-..B7.27:                        # Preds ..B7.26
-..LN861:
-   .loc    1  4463
-        lea       28(%r13), %eax                                #4463.13
-..LN863:
-   .loc    1  4464
-        cmpl      -8(%rbp), %eax                                #4464.24
-        ja        ..B7.35       # Prob 4%                       #4464.24
-                                # LOE r12 eax
-..B7.28:                        # Preds ..B7.27
-..LN865:
-   .loc    1  4469
-        movq      -16(%rbp), %rsi                               #4469.22
-        movl      %eax, -192(%rbp)                              #4469.22
-        movq      %r12, %rdi                                    #4469.22
-        call      prime_buffer_4na at PLT                          #4469.22
-                                # LOE r12 xmm0
-..B7.51:                        # Preds ..B7.28
-        movl      -192(%rbp), %eax                              #
-..LN867:
-   .loc    1  4484
-        addq      $8, %r12                                      #4484.13
-        movq      %r12, %rsi                                    #4484.13
-                                # LOE rsi r12 eax xmm0
-..B7.29:                        # Preds ..B7.5 ..B7.51
-..LN869:
-   .loc    1  4352
-        movl      $2, %ebx                                      #4352.13
-        jmp       ..B7.33       # Prob 100%                     #4352.13
-                                # LOE rsi r12 eax ebx xmm0
-..B7.30:                        # Preds ..B7.25
-..LN871:
-   .loc    1  4450
-        cmpq      -16(%rbp), %rsi                               #4450.26
-..LN873:
-   .loc    1  4447
-        psrldq    $2, %xmm0                                     #4447.26
-..LN875:
-   .loc    1  4450
-        jae       ..B7.32       # Prob 19%                      #4450.26
-                                # LOE rsi r12 eax ebx xmm0
-..B7.31:                        # Preds ..B7.30
-..LN877:
-   .loc    1  4451
-        movzbl    (%rsi), %ecx                                  #4451.72
-..LN879:
-        lea       expand_2na.0(%rip), %rdx                      #4451.57
-        movzwl    (%rdx,%rcx,2), %edi                           #4451.57
-..LN881:
-        pinsrw    $7, %edi, %xmm0                               #4451.30
-                                # LOE rsi r12 eax ebx xmm0
-..B7.32:                        # Preds ..B7.31 ..B7.30
-..LN883:
-   .loc    1  4454
-        incq      %rsi                                          #4454.20
-                                # LOE rsi r12 eax ebx xmm0
-..B7.33:                        # Preds ..B7.29 ..B7.32 ..B7.37
-..LN885:
-   .loc    1  4362
-        movdqa    %xmm0, %xmm2                                  #4362.22
-..LN887:
-   .loc    1  4363
-        movdqa    %xmm0, %xmm1                                  #4363.22
-..LN889:
-   .loc    1  4362
-        pand      -96(%rbp), %xmm2                              #4362.22
-..LN891:
-   .loc    1  4363
-        pand      -144(%rbp), %xmm1                             #4363.22
-..LN893:
-   .loc    1  4364
-        pcmpeqd   %xmm1, %xmm2                                  #4364.22
-..LN895:
-   .loc    1  4365
-        pmovmskb  %xmm2, %ecx                                   #4365.22
-        jmp       ..B7.9        # Prob 100%                     #4365.22
-                                # LOE rsi r12 eax ecx ebx xmm0
-..B7.35:                        # Preds ..B7.24 ..B7.26 ..B7.27 # Infreq
-..LN897:
-   .loc    1  4495
-        movq      -40(%rbp), %rbx                               #4495.12
-..___tag_value_eval_4na_32.365:                                 #
-        movq      -48(%rbp), %r12                               #4495.12
-..___tag_value_eval_4na_32.366:                                 #
-        movq      -32(%rbp), %r13                               #4495.12
-..___tag_value_eval_4na_32.367:                                 #
-        movq      -24(%rbp), %r14                               #4495.12
-..___tag_value_eval_4na_32.368:                                 #
-        xorl      %eax, %eax                                    #4495.12
-        movq      -184(%rbp), %r15                              #4495.12
-..___tag_value_eval_4na_32.369:                                 #
-        movq      %rbp, %rsp                                    #4495.12
-        popq      %rbp                                          #4495.12
-..___tag_value_eval_4na_32.370:                                 #
-        ret                                                     #4495.12
-..___tag_value_eval_4na_32.371:                                 #
-                                # LOE
-..B7.37:                        # Preds ..B7.46                 # Infreq
-        movdqa    %xmm8, -80(%rbp)                              #
-        movdqa    %xmm1, -64(%rbp)                              #
-        movdqa    %xmm2, -176(%rbp)                             #
-        movdqa    %xmm3, -128(%rbp)                             #
-        movdqa    %xmm4, -112(%rbp)                             #
-        movdqa    %xmm5, -160(%rbp)                             #
-        movdqa    %xmm6, -144(%rbp)                             #
-        movdqa    %xmm7, -96(%rbp)                              #
-        movl      %eax, -8(%rbp)                                #
-        movl      %r13d, %eax                                   #
-        jmp       ..B7.33       # Prob 100%                     #
-                                # LOE rsi r12 eax ebx xmm0
-..B7.38:                        # Preds ..B7.17 ..B7.23 ..B7.21 ..B7.19 # Infreq
-..LN899:
-   .loc    1  4428
-        movq      -40(%rbp), %rbx                               #4428.63
-..___tag_value_eval_4na_32.377:                                 #
-        movq      -48(%rbp), %r12                               #4428.63
-..___tag_value_eval_4na_32.378:                                 #
-        movq      -32(%rbp), %r13                               #4428.63
-..___tag_value_eval_4na_32.379:                                 #
-        movq      -24(%rbp), %r14                               #4428.63
-..___tag_value_eval_4na_32.380:                                 #
-        movl      $1, %eax                                      #4428.63
-        movq      -184(%rbp), %r15                              #4428.63
-..___tag_value_eval_4na_32.381:                                 #
-        movq      %rbp, %rsp                                    #4428.63
-        popq      %rbp                                          #4428.63
-..___tag_value_eval_4na_32.382:                                 #
-        ret                                                     #4428.63
-        .align    16,0x90
-..___tag_value_eval_4na_32.383:                                 #
-                                # LOE
-# mark_end;
-	.type	eval_4na_32, at function
-	.size	eval_4na_32,.-eval_4na_32
-.LNeval_4na_32:
-	.data
-# -- End  eval_4na_32
-	.text
-# -- Begin  uint16_lsbit
-# mark_begin;
-       .align    16,0x90
-uint16_lsbit:
-# parameter 1(self): %edi
-..B8.1:                         # Preds ..B8.0
-..___tag_value_uint16_lsbit.384:                                #38.1
-..LN901:
-  .file   2 "/home/yaschenk/devel/internal/asm-trace/inc/gcc/x86_64/arch-impl.h"
-   .loc    2  38
-        pushq     %rbp                                          #38.1
-        movq      %rsp, %rbp                                    #38.1
-..___tag_value_uint16_lsbit.385:                                #
-        subq      $16, %rsp                                     #38.1
-        movq      %rbx, -16(%rbp)                               #38.1
-..___tag_value_uint16_lsbit.387:                                #
-        movl      %edi, %ebx                                    #38.1
-        lea       _gprof_pack7(%rip), %rdx                      #38.1
-        call      mcount at PLT                                    #38.1
-                                # LOE r12 r13 r14 r15 ebx
-..B8.4:                         # Preds ..B8.1
-..LN903:
-   .loc    2  40
-        movl      %ebx, %eax                                    #40.0
-# Begin ASM
-        bsf %ax, %ax;jnz .+6;xor %eax, %eax;dec %eax;
-# End ASM                                                       #40.0
-..LN905:
-   .loc    2  49
-        movq      -16(%rbp), %rbx                               #49.12
-..___tag_value_uint16_lsbit.388:                                #
-        movq      %rbp, %rsp                                    #49.12
-        popq      %rbp                                          #49.12
-..___tag_value_uint16_lsbit.389:                                #
-        ret                                                     #49.12
-        .align    16,0x90
-..___tag_value_uint16_lsbit.390:                                #
-                                # LOE
-# mark_end;
-	.type	uint16_lsbit, at function
-	.size	uint16_lsbit,.-uint16_lsbit
-.LNuint16_lsbit:
-	.data
-# -- End  uint16_lsbit
-	.text
-# -- Begin  eval_4na_16
-# mark_begin;
-       .align    16,0x90
-eval_4na_16:
-# parameter 1(self): %rdi
-# parameter 2(ncbi2na): %rsi
-# parameter 3(pos): %edx
-# parameter 4(len): %ecx
-..B9.1:                         # Preds ..B9.0
-..___tag_value_eval_4na_16.391:                                 #4057.1
-..LN907:
-   .loc    1  4057
-        pushq     %rbp                                          #4057.1
-        movq      %rsp, %rbp                                    #4057.1
-..___tag_value_eval_4na_16.392:                                 #
-        subq      $224, %rsp                                    #4057.1
-        movq      %r15, -48(%rbp)                               #4057.1
-..___tag_value_eval_4na_16.394:                                 #
-        movq      %r14, -40(%rbp)                               #4057.1
-..___tag_value_eval_4na_16.395:                                 #
-        movq      %r13, -32(%rbp)                               #4057.1
-..___tag_value_eval_4na_16.396:                                 #
-        movq      %r12, -24(%rbp)                               #4057.1
-..___tag_value_eval_4na_16.397:                                 #
-        movq      %rbx, -56(%rbp)                               #4057.1
-..___tag_value_eval_4na_16.398:                                 #
-        movl      %ecx, %ebx                                    #4057.1
-        movl      %edx, %r12d                                   #4057.1
-        movq      %rsi, %r15                                    #4057.1
-        movq      %rdi, %r13                                    #4057.1
-        lea       _gprof_pack8(%rip), %rdx                      #4057.1
-        call      mcount at PLT                                    #4057.1
-                                # LOE r13 r15 ebx r12d
-..B9.40:                        # Preds ..B9.1
-..LN909:
-   .loc    1  4090
-        lea       (%r12,%rbx), %eax                             #4090.5
-..LN911:
-   .loc    1  4096
-        subl      4(%r13), %eax                                 #4096.12
-..LN913:
-   .loc    1  4102
-        movl      %eax, -224(%rbp)                              #4102.14
-..LN915:
-   .loc    1  4093
-        movl      %r12d, %r14d                                  #4093.49
-        shrl      $2, %r14d                                     #4093.49
-..LN917:
-        lea       (%r15,%r14), %rdi                             #4093.30
-..LN919:
-   .loc    1  4099
-        lea       3(%r12,%rbx), %esi                            #4099.50
-..LN921:
-        shrl      $2, %esi                                      #4099.57
-..LN923:
-        addq      %r15, %rsi                                    #4099.30
-        movq      %rsi, -16(%rbp)                               #4099.30
-..LN925:
-   .loc    1  4102
-        call      prime_buffer_4na at PLT                          #4102.14
-                                # LOE r13 r14 r15 r12d xmm0
-..B9.41:                        # Preds ..B9.40
-        movl      -224(%rbp), %eax                              #
-..LN927:
-   .loc    1  4109
-        movdqa    16(%r13), %xmm7                               #4109.5
-        movdqa    32(%r13), %xmm6                               #4109.5
-        movdqa    48(%r13), %xmm5                               #4109.5
-        movdqa    64(%r13), %xmm4                               #4109.5
-        movdqa    80(%r13), %xmm3                               #4109.5
-        movdqa    96(%r13), %xmm2                               #4109.5
-        movdqa    112(%r13), %xmm1                              #4109.5
-        movdqa    128(%r13), %xmm8                              #4109.5
-..LN929:
-   .loc    1  4103
-        lea       8(%r15,%r14), %rbx                            #4103.5
-..LN931:
-   .loc    1  4112
-        xorl      %r14d, %r14d                                  #4112.15
-..LN933:
-        xorl      %r15d, %r15d                                  #4112.10
-..LN935:
-        xorl      %edx, %edx                                    #4112.5
-..LN937:
-   .loc    1  4123
-        movl      %r12d, %ecx                                   #4123.20
-        andl      $3, %ecx                                      #4123.20
-        je        ..B9.5        # Prob 20%                      #4123.20
-                                # LOE rax rbx eax edx ecx r12d r14d r15d al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.2:                         # Preds ..B9.41
-        cmpl      $1, %ecx                                      #4123.20
-        je        ..B9.8        # Prob 25%                      #4123.20
-                                # LOE rax rbx eax edx ecx r12d r14d r15d al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.3:                         # Preds ..B9.2
-        cmpl      $2, %ecx                                      #4123.20
-        je        ..B9.7        # Prob 33%                      #4123.20
-                                # LOE rax rbx eax edx ecx r12d r14d r15d al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.4:                         # Preds ..B9.3
-        cmpl      $3, %ecx                                      #4123.20
-        je        ..B9.6        # Prob 50%                      #4123.20
-                                # LOE rax rbx eax edx r12d r14d r15d al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.5:                         # Preds ..B9.41 ..B9.4
-        movdqa    %xmm8, -80(%rbp)                              #
-        movdqa    %xmm1, -144(%rbp)                             #
-        movdqa    %xmm2, -160(%rbp)                             #
-        movdqa    %xmm3, -112(%rbp)                             #
-        movdqa    %xmm4, -96(%rbp)                              #
-        movdqa    %xmm5, -128(%rbp)                             #
-        movdqa    %xmm6, -192(%rbp)                             #
-        movdqa    %xmm7, -176(%rbp)                             #
-        movl      %eax, %r13d                                   #
-        jmp       ..B9.28       # Prob 100%                     #
-                                # LOE rbx r12d r13d xmm0
-..B9.6:                         # Preds ..B9.4
-        movdqa    %xmm8, -80(%rbp)                              #
-        movdqa    %xmm1, -144(%rbp)                             #
-        movdqa    %xmm2, -160(%rbp)                             #
-        movdqa    %xmm3, -112(%rbp)                             #
-        movdqa    %xmm4, -96(%rbp)                              #
-        movdqa    %xmm5, -128(%rbp)                             #
-        movdqa    %xmm6, -192(%rbp)                             #
-        movdqa    %xmm7, -176(%rbp)                             #
-        movl      %eax, %r13d                                   #
-        jmp       ..B9.11       # Prob 100%                     #
-                                # LOE rbx edx r12d r13d r14d r15d xmm0
-..B9.7:                         # Preds ..B9.3
-        movdqa    %xmm8, -80(%rbp)                              #
-        movdqa    %xmm1, -144(%rbp)                             #
-        movdqa    %xmm2, -160(%rbp)                             #
-        movdqa    %xmm3, -112(%rbp)                             #
-        movdqa    %xmm4, -96(%rbp)                              #
-        movdqa    %xmm5, -128(%rbp)                             #
-        movdqa    %xmm6, -192(%rbp)                             #
-        movdqa    %xmm7, -176(%rbp)                             #
-        movl      %eax, %r13d                                   #
-        jmp       ..B9.10       # Prob 100%                     #
-                                # LOE rbx edx r12d r13d r15d xmm0
-..B9.8:                         # Preds ..B9.2
-        movdqa    %xmm8, -80(%rbp)                              #
-        movdqa    %xmm1, -144(%rbp)                             #
-        movdqa    %xmm2, -160(%rbp)                             #
-        movdqa    %xmm3, -112(%rbp)                             #
-        movdqa    %xmm4, -96(%rbp)                              #
-        movdqa    %xmm5, -128(%rbp)                             #
-        movdqa    %xmm6, -192(%rbp)                             #
-        movdqa    %xmm7, -176(%rbp)                             #
-        movl      %eax, %r13d                                   #
-                                # LOE rbx edx r12d r13d xmm0
-..B9.9:                         # Preds ..B9.8 ..B9.28
-..LN939:
-   .loc    1  4147
-        movdqa    %xmm0, %xmm2                                  #4147.22
-..LN941:
-   .loc    1  4148
-        movdqa    %xmm0, %xmm1                                  #4148.22
-..LN943:
-   .loc    1  4147
-        pand      -128(%rbp), %xmm2                             #4147.22
-..LN945:
-   .loc    1  4148
-        pand      -96(%rbp), %xmm1                              #4148.22
-..LN947:
-   .loc    1  4149
-        pcmpeqw   %xmm1, %xmm2                                  #4149.22
-..LN949:
-   .loc    1  4150
-        pmovmskb  %xmm2, %r15d                                  #4150.22
-                                # LOE rbx edx r12d r13d r15d xmm0
-..B9.10:                        # Preds ..B9.7 ..B9.9
-..LN951:
-   .loc    1  4154
-        movdqa    %xmm0, %xmm2                                  #4154.22
-..LN953:
-   .loc    1  4155
-        movdqa    %xmm0, %xmm1                                  #4155.22
-..LN955:
-   .loc    1  4154
-        pand      -112(%rbp), %xmm2                             #4154.22
-..LN957:
-   .loc    1  4155
-        pand      -160(%rbp), %xmm1                             #4155.22
-..LN959:
-   .loc    1  4156
-        pcmpeqw   %xmm1, %xmm2                                  #4156.22
-..LN961:
-   .loc    1  4157
-        pmovmskb  %xmm2, %r14d                                  #4157.22
-                                # LOE rbx edx r12d r13d r14d r15d xmm0
-..B9.11:                        # Preds ..B9.6 ..B9.10
-..LN963:
-   .loc    1  4161
-        movdqa    %xmm0, %xmm1                                  #4161.22
-..LN965:
-   .loc    1  4162
-        pand      -80(%rbp), %xmm0                              #4162.22
-..LN967:
-   .loc    1  4161
-        pand      -144(%rbp), %xmm1                             #4161.22
-..LN969:
-   .loc    1  4163
-        pcmpeqw   %xmm0, %xmm1                                  #4163.22
-..LN971:
-   .loc    1  4164
-        pmovmskb  %xmm1, %ecx                                   #4164.22
-        movl      %ecx, -64(%rbp)                               #4164.22
-..LN973:
-   .loc    1  4169
-        andl      $-4, %r12d                                    #4169.17
-..LN975:
-   .loc    1  4172
-        movl      %edx, %esi                                    #4172.29
-        orl       %r15d, %esi                                   #4172.29
-..LN977:
-        orl       %r14d, %esi                                   #4172.34
-..LN979:
-        orl       %ecx, %esi                                    #4172.39
-..LN981:
-        je        ..B9.24       # Prob 78%                      #4172.47
-                                # LOE rbx edx r12d r13d r14d r15d
-..B9.12:                        # Preds ..B9.11
-..LN983:
-   .loc    1  4190
-        movl      %edx, -200(%rbp)                              #4190.30
-        movl      %edx, %edi                                    #4190.30
-        call      uint16_lsbit at PLT                              #4190.30
-                                # LOE rbx eax r12d r13d r14d r15d
-..B9.42:                        # Preds ..B9.12
-        movl      -200(%rbp), %edx                              #
-                                # LOE rdx rbx eax edx r12d r13d r14d r15d dl dh
-..B9.13:                        # Preds ..B9.42
-..LN985:
-   .loc    1  4191
-        movl      %edx, -200(%rbp)                              #4191.30
-..LN987:
-   .loc    1  4190
-        movswq    %ax, %rcx                                     #4190.30
-        movl      %ecx, -224(%rbp)                              #4190.30
-..LN989:
-   .loc    1  4191
-        movl      %r15d, %edi                                   #4191.30
-        call      uint16_lsbit at PLT                              #4191.30
-                                # LOE rbx eax r12d r13d r14d r15d
-..B9.43:                        # Preds ..B9.13
-        movl      -200(%rbp), %edx                              #
-                                # LOE rdx rbx eax edx r12d r13d r14d r15d dl dh
-..B9.14:                        # Preds ..B9.43
-..LN991:
-   .loc    1  4192
-        movl      %edx, -200(%rbp)                              #4192.30
-..LN993:
-   .loc    1  4191
-        movswq    %ax, %rcx                                     #4191.30
-        movl      %ecx, -216(%rbp)                              #4191.30
-..LN995:
-   .loc    1  4192
-        movl      %r14d, %edi                                   #4192.30
-        call      uint16_lsbit at PLT                              #4192.30
-                                # LOE rbx eax r12d r13d r14d r15d
-..B9.44:                        # Preds ..B9.14
-        movl      -200(%rbp), %edx                              #
-                                # LOE rdx rbx eax edx r12d r13d r14d r15d dl dh
-..B9.15:                        # Preds ..B9.44
-..LN997:
-   .loc    1  4193
-        movl      -64(%rbp), %edi                               #4193.30
-        movl      %edx, -200(%rbp)                              #4193.30
-..LN999:
-   .loc    1  4192
-        movswq    %ax, %rcx                                     #4192.30
-        movl      %ecx, -208(%rbp)                              #4192.30
-..LN1001:
-   .loc    1  4193
-        call      uint16_lsbit at PLT                              #4193.30
-                                # LOE rbx eax r12d r13d r14d r15d
-..B9.45:                        # Preds ..B9.15
-        movl      -200(%rbp), %edx                              #
-                                # LOE rdx rbx eax edx r12d r13d r14d r15d dl dh
-..B9.16:                        # Preds ..B9.45
-..LN1003:
-   .loc    1  4199
-        movl      -216(%rbp), %esi                              #4199.40
-..LN1005:
-   .loc    1  4200
-        movl      -208(%rbp), %r8d                              #4200.40
-..LN1007:
-   .loc    1  4193
-        movswq    %ax, %rcx                                     #4193.30
-..LN1009:
-   .loc    1  4199
-        lea       1(%rsi,%rsi), %esi                            #4199.40
-..LN1011:
-   .loc    1  4200
-        lea       2(%r8,%r8), %r8d                              #4200.40
-..LN1013:
-   .loc    1  4201
-        lea       3(%rcx,%rcx), %r9d                            #4201.40
-..LN1015:
-   .loc    1  4205
-        testl     %edx, %edx                                    #4205.32
-        je        ..B9.18       # Prob 50%                      #4205.32
-                                # LOE rbx esi r8d r9d r12d r13d r14d r15d
-..B9.17:                        # Preds ..B9.16
-..LN1017:
-        movl      -224(%rbp), %edx                              #4205.43
-        lea       (%r12,%rdx,2), %ecx                           #4205.43
-..LN1019:
-        cmpl      %ecx, %r13d                                   #4205.49
-        jae       ..B9.33       # Prob 20%                      #4205.49
-                                # LOE rbx esi r8d r9d r12d r13d r14d r15d
-..B9.18:                        # Preds ..B9.17 ..B9.16
-..LN1021:
-   .loc    1  4206
-        testl     %r15d, %r15d                                  #4206.32
-        je        ..B9.20       # Prob 50%                      #4206.32
-                                # LOE rbx esi r8d r9d r12d r13d r14d
-..B9.19:                        # Preds ..B9.18
-..LN1023:
-        addl      %r12d, %esi                                   #4206.43
-..LN1025:
-        cmpl      %esi, %r13d                                   #4206.49
-        jae       ..B9.33       # Prob 20%                      #4206.49
-                                # LOE rbx r8d r9d r12d r13d r14d
-..B9.20:                        # Preds ..B9.19 ..B9.18
-..LN1027:
-   .loc    1  4207
-        testl     %r14d, %r14d                                  #4207.32
-        je        ..B9.22       # Prob 50%                      #4207.32
-                                # LOE rbx r8d r9d r12d r13d
-..B9.21:                        # Preds ..B9.20
-..LN1029:
-        addl      %r12d, %r8d                                   #4207.43
-..LN1031:
-        cmpl      %r8d, %r13d                                   #4207.49
-        jae       ..B9.33       # Prob 20%                      #4207.49
-                                # LOE rbx r9d r12d r13d
-..B9.22:                        # Preds ..B9.21 ..B9.20
-..LN1033:
-   .loc    1  4208
-        movl      -64(%rbp), %edx                               #4208.32
-        testl     %edx, %edx                                    #4208.32
-        je        ..B9.24       # Prob 50%                      #4208.32
-                                # LOE rbx r9d r12d r13d
-..B9.23:                        # Preds ..B9.22
-..LN1035:
-        addl      %r12d, %r9d                                   #4208.43
-..LN1037:
-        cmpl      %r9d, %r13d                                   #4208.49
-        jae       ..B9.33       # Prob 20%                      #4208.49
-                                # LOE rbx r12d r13d
-..B9.24:                        # Preds ..B9.23 ..B9.22 ..B9.11
-..LN1039:
-   .loc    1  4241
-        lea       4(%r12), %edx                                 #4241.13
-..LN1041:
-   .loc    1  4216
-        cmpl      %edx, %r13d                                   #4216.28
-        jb        ..B9.30       # Prob 20%                      #4216.28
-                                # LOE rbx r12d r13d
-..B9.25:                        # Preds ..B9.24
-..LN1043:
-   .loc    1  4237
-        cmpq      -16(%rbp), %rbx                               #4237.25
-        jae       ..B9.30       # Prob 4%                       #4237.25
-                                # LOE rbx r12d r13d
-..B9.26:                        # Preds ..B9.25
-..LN1045:
-   .loc    1  4241
-        addl      $32, %r12d                                    #4241.13
-..LN1047:
-   .loc    1  4242
-        cmpl      %r13d, %r12d                                  #4242.24
-        ja        ..B9.30       # Prob 4%                       #4242.24
-                                # LOE rbx r12d r13d
-..B9.27:                        # Preds ..B9.26
-..LN1049:
-   .loc    1  4247
-        movq      -16(%rbp), %rsi                               #4247.22
-        movq      %rbx, %rdi                                    #4247.22
-        call      prime_buffer_4na at PLT                          #4247.22
-                                # LOE rbx r12d r13d xmm0
-..B9.46:                        # Preds ..B9.27
-..LN1051:
-   .loc    1  4262
-        addq      $8, %rbx                                      #4262.13
-                                # LOE rbx r12d r13d xmm0
-..B9.28:                        # Preds ..B9.5 ..B9.46
-..LN1053:
-   .loc    1  4140
-        movdqa    %xmm0, %xmm2                                  #4140.22
-..LN1055:
-   .loc    1  4141
-        movdqa    %xmm0, %xmm1                                  #4141.22
-..LN1057:
-   .loc    1  4140
-        pand      -176(%rbp), %xmm2                             #4140.22
-..LN1059:
-   .loc    1  4141
-        pand      -192(%rbp), %xmm1                             #4141.22
-..LN1061:
-   .loc    1  4142
-        pcmpeqw   %xmm1, %xmm2                                  #4142.22
-..LN1063:
-   .loc    1  4143
-        pmovmskb  %xmm2, %edx                                   #4143.22
-        jmp       ..B9.9        # Prob 100%                     #4143.22
-                                # LOE rbx edx r12d r13d xmm0
-..B9.30:                        # Preds ..B9.24 ..B9.25 ..B9.26 # Infreq
-..LN1065:
-   .loc    1  4273
-        movq      -56(%rbp), %rbx                               #4273.12
-..___tag_value_eval_4na_16.399:                                 #
-        movq      -24(%rbp), %r12                               #4273.12
-..___tag_value_eval_4na_16.400:                                 #
-        movq      -32(%rbp), %r13                               #4273.12
-..___tag_value_eval_4na_16.401:                                 #
-        movq      -40(%rbp), %r14                               #4273.12
-..___tag_value_eval_4na_16.402:                                 #
-        xorl      %eax, %eax                                    #4273.12
-        movq      -48(%rbp), %r15                               #4273.12
-..___tag_value_eval_4na_16.403:                                 #
-        movq      %rbp, %rsp                                    #4273.12
-        popq      %rbp                                          #4273.12
-..___tag_value_eval_4na_16.404:                                 #
-        ret                                                     #4273.12
-..___tag_value_eval_4na_16.405:                                 #
-                                # LOE
-..B9.33:                        # Preds ..B9.23 ..B9.21 ..B9.19 ..B9.17 # Infreq
-..LN1067:
-   .loc    1  4205
-        movq      -56(%rbp), %rbx                               #4205.63
-..___tag_value_eval_4na_16.411:                                 #
-        movq      -24(%rbp), %r12                               #4205.63
-..___tag_value_eval_4na_16.412:                                 #
-        movq      -32(%rbp), %r13                               #4205.63
-..___tag_value_eval_4na_16.413:                                 #
-        movq      -40(%rbp), %r14                               #4205.63
-..___tag_value_eval_4na_16.414:                                 #
-        movl      $1, %eax                                      #4205.63
-        movq      -48(%rbp), %r15                               #4205.63
-..___tag_value_eval_4na_16.415:                                 #
-        movq      %rbp, %rsp                                    #4205.63
-        popq      %rbp                                          #4205.63
-..___tag_value_eval_4na_16.416:                                 #
-        ret                                                     #4205.63
-        .align    16,0x90
-..___tag_value_eval_4na_16.417:                                 #
-                                # LOE
-# mark_end;
-	.type	eval_4na_16, at function
-	.size	eval_4na_16,.-eval_4na_16
-.LNeval_4na_16:
-	.data
-# -- End  eval_4na_16
-	.text
-# -- Begin  eval_2na_128
-# mark_begin;
-       .align    16,0x90
-eval_2na_128:
-# parameter 1(self): %rdi
-# parameter 2(ncbi2na): %rsi
-# parameter 3(pos): %edx
-# parameter 4(len): %ecx
-..B10.1:                        # Preds ..B10.0
-..___tag_value_eval_2na_128.418:                                #3369.1
-..LN1069:
-   .loc    1  3369
-        pushq     %rbp                                          #3369.1
-        movq      %rsp, %rbp                                    #3369.1
-..___tag_value_eval_2na_128.419:                                #
-        subq      $176, %rsp                                    #3369.1
-        movq      %r15, -40(%rbp)                               #3369.1
-..___tag_value_eval_2na_128.421:                                #
-        movq      %r14, -24(%rbp)                               #3369.1
-..___tag_value_eval_2na_128.422:                                #
-        movq      %r13, -32(%rbp)                               #3369.1
-..___tag_value_eval_2na_128.423:                                #
-        movq      %r12, -16(%rbp)                               #3369.1
-..___tag_value_eval_2na_128.424:                                #
-        movq      %rbx, -48(%rbp)                               #3369.1
-..___tag_value_eval_2na_128.425:                                #
-        movl      %ecx, %r13d                                   #3369.1
-        movl      %edx, %r12d                                   #3369.1
-        movq      %rsi, %rbx                                    #3369.1
-        movq      %rdi, %r15                                    #3369.1
-        lea       _gprof_pack9(%rip), %rdx                      #3369.1
-        call      mcount at PLT                                    #3369.1
-                                # LOE rbx r15 r12d r13d
-..B10.40:                       # Preds ..B10.1
-..LN1071:
-   .loc    1  3406
-        lea       (%r12,%r13), %r14d                            #3406.5
-..LN1073:
-   .loc    1  3412
-        subl      4(%r15), %r14d                                #3412.12
-..LN1075:
-   .loc    1  3409
-        movl      %r12d, %eax                                   #3409.49
-        shrl      $2, %eax                                      #3409.49
-..LN1077:
-        movq      %rax, -176(%rbp)                              #3409.30
-        lea       (%rbx,%rax), %rdi                             #3409.30
-..LN1079:
-   .loc    1  3415
-        lea       3(%r12,%r13), %r13d                           #3415.50
-..LN1081:
-        shrl      $2, %r13d                                     #3415.57
-..LN1083:
-        addq      %rbx, %r13                                    #3415.30
-..LN1085:
-   .loc    1  3418
-        movq      %r13, %rsi                                    #3418.14
-        call      prime_buffer_2na at PLT                          #3418.14
-                                # LOE rbx r13 r15 r12d r14d xmm0
-..B10.41:                       # Preds ..B10.40
-..LN1087:
-   .loc    1  3419
-        movq      -176(%rbp), %rax                              #3419.5
-        lea       16(%rbx,%rax), %r8                            #3419.5
-        movq      %r8, %rdi                                     #3419.5
-..LN1089:
-   .loc    1  3424
-        cmpq      %r13, %r8                                     #3424.16
-..LN1091:
-   .loc    1  3429
-..LN1093:
-   .loc    1  3424
-        jae       ..B10.3       # Prob 12%                      #3424.16
-                                # LOE rdi r8 r13 r15 ebx r12d r14d xmm0
-..B10.2:                        # Preds ..B10.41
-..LN1095:
-   .loc    1  3425
-        movzbl    -1(%r8), %ebx                                 #3425.24
-..LN1097:
-        shll      $8, %ebx                                      #3425.38
-                                # LOE rdi r8 r13 r15 ebx r12d r14d xmm0
-..B10.3:                        # Preds ..B10.2 ..B10.41
-..LN1099:
-   .loc    1  3429
-        movdqa    16(%r15), %xmm8                               #3429.5
-        movdqa    32(%r15), %xmm7                               #3429.5
-        movdqa    48(%r15), %xmm6                               #3429.5
-        movdqa    64(%r15), %xmm5                               #3429.5
-        movdqa    80(%r15), %xmm4                               #3429.5
-        movdqa    96(%r15), %xmm3                               #3429.5
-        movdqa    112(%r15), %xmm2                              #3429.5
-        movdqa    128(%r15), %xmm1                              #3429.5
-..LN1101:
-   .loc    1  3432
-        xorl      %ecx, %ecx                                    #3432.15
-..LN1103:
-        xorl      %esi, %esi                                    #3432.10
-..LN1105:
-        xorl      %edx, %edx                                    #3432.5
-..LN1107:
-   .loc    1  3434
-        movl      %r14d, %eax                                   #3434.20
-        subl      %r12d, %eax                                   #3434.20
-..LN1109:
-        addl      $7, %eax                                      #3434.33
-..LN1111:
-        shrl      $2, %eax                                      #3434.40
-..LN1113:
-   .loc    1  3441
-        movl      %r12d, %r9d                                   #3441.20
-        andl      $3, %r9d                                      #3441.20
-        je        ..B10.35      # Prob 20%                      #3441.20
-                                # LOE rdi r8 r13 eax edx ecx ebx esi r9d r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.4:                        # Preds ..B10.3
-        cmpl      $1, %r9d                                      #3441.20
-        je        ..B10.10      # Prob 25%                      #3441.20
-                                # LOE rdi r8 r13 eax edx ecx ebx esi r9d r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.5:                        # Preds ..B10.4
-        cmpl      $2, %r9d                                      #3441.20
-        je        ..B10.9       # Prob 33%                      #3441.20
-                                # LOE rdi r8 r13 eax edx ecx ebx esi r9d r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.6:                        # Preds ..B10.5
-        cmpl      $3, %r9d                                      #3441.20
-        je        ..B10.8       # Prob 50%                      #3441.20
-                                # LOE rdi r8 r13 eax edx ecx ebx esi r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.7:                        # Preds ..B10.6
-        movq      %r13, %r15                                    #
-        movq      %r8, %r13                                     #
-        jmp       ..B10.19      # Prob 100%                     #
-                                # LOE rdi r13 r15 ebx r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.8:                        # Preds ..B10.6
-        movq      %r13, %r15                                    #
-        movq      %r8, %r13                                     #
-        jmp       ..B10.13      # Prob 100%                     #
-                                # LOE rdi r13 r15 eax edx ecx ebx esi r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.9:                        # Preds ..B10.5
-        movq      %r13, %r15                                    #
-        movq      %r8, %r13                                     #
-        jmp       ..B10.12      # Prob 100%                     #
-                                # LOE rdi r13 r15 eax edx ebx esi r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.10:                       # Preds ..B10.4
-        movq      %r13, %r15                                    #
-        movq      %r8, %r13                                     #
-                                # LOE rdi r13 r15 eax edx ebx r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.11:                       # Preds ..B10.10 ..B10.23
-..LN1115:
-   .loc    1  3464
-        movdqa    %xmm0, %xmm9                                  #3464.22
-        pand      %xmm5, %xmm9                                  #3464.22
-..LN1117:
-   .loc    1  3465
-        pcmpeqd   %xmm6, %xmm9                                  #3465.22
-..LN1119:
-   .loc    1  3466
-        pmovmskb  %xmm9, %esi                                   #3466.22
-..LN1121:
-   .loc    1  3467
-        incl      %esi                                          #3467.17
-        shrl      $16, %esi                                     #3467.17
-        negl      %esi                                          #3467.17
-                                # LOE rdi r13 r15 eax edx ebx esi r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.12:                       # Preds ..B10.9 ..B10.11
-..LN1123:
-   .loc    1  3470
-        movdqa    %xmm0, %xmm9                                  #3470.22
-        pand      %xmm3, %xmm9                                  #3470.22
-..LN1125:
-   .loc    1  3471
-        pcmpeqd   %xmm4, %xmm9                                  #3471.22
-..LN1127:
-   .loc    1  3472
-        pmovmskb  %xmm9, %ecx                                   #3472.22
-..LN1129:
-   .loc    1  3473
-        incl      %ecx                                          #3473.17
-        shrl      $16, %ecx                                     #3473.17
-        negl      %ecx                                          #3473.17
-                                # LOE rdi r13 r15 eax edx ecx ebx esi r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.13:                       # Preds ..B10.8 ..B10.12
-..LN1131:
-   .loc    1  3476
-        movdqa    %xmm0, %xmm9                                  #3476.22
-..LN1133:
-   .loc    1  3483
-        andl      $-4, %r12d                                    #3483.17
-..LN1135:
-   .loc    1  3486
-        movl      %edx, %r10d                                   #3486.29
-..LN1137:
-   .loc    1  3476
-        pand      %xmm1, %xmm9                                  #3476.22
-..LN1139:
-   .loc    1  3477
-        pcmpeqd   %xmm2, %xmm9                                  #3477.22
-..LN1141:
-   .loc    1  3478
-        pmovmskb  %xmm9, %r9d                                   #3478.22
-..LN1143:
-   .loc    1  3486
-        orl       %esi, %r10d                                   #3486.29
-..LN1145:
-        orl       %ecx, %r10d                                   #3486.34
-..LN1147:
-   .loc    1  3479
-        incl      %r9d                                          #3479.17
-        shrl      $16, %r9d                                     #3479.17
-        negl      %r9d                                          #3479.17
-..LN1149:
-   .loc    1  3486
-        orl       %r9d, %r10d                                   #3486.39
-..LN1151:
-        jne       ..B10.24      # Prob 20%                      #3486.47
-                                # LOE rdi r13 r15 eax edx ecx ebx esi r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.14:                       # Preds ..B10.13
-..LN1153:
-   .loc    1  3527
-        addl      $4, %r12d                                     #3527.17
-..LN1155:
-   .loc    1  3530
-        cmpl      %r14d, %r12d                                  #3530.28
-        ja        ..B10.32      # Prob 20%                      #3530.28
-                                # LOE rdi r13 r15 eax ebx r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.15:                       # Preds ..B10.14
-..LN1157:
-   .loc    1  3534
-        decl      %eax                                          #3534.25
-..LN1159:
-        jne       ..B10.20      # Prob 50%                      #3534.39
-                                # LOE rdi r13 r15 eax ebx r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.16:                       # Preds ..B10.15
-..LN1161:
-   .loc    1  3555
-        cmpq      %r15, %r13                                    #3555.25
-        jae       ..B10.32      # Prob 4%                       #3555.25
-                                # LOE r13 r15 ebx r12d r14d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.17:                       # Preds ..B10.16
-..LN1163:
-   .loc    1  3565
-        movdqa    %xmm1, -176(%rbp)                             #3565.22
-        movdqa    %xmm2, -160(%rbp)                             #3565.22
-        movdqa    %xmm3, -144(%rbp)                             #3565.22
-        movdqa    %xmm4, -128(%rbp)                             #3565.22
-        movdqa    %xmm5, -112(%rbp)                             #3565.22
-        movdqa    %xmm6, -96(%rbp)                              #3565.22
-        movdqa    %xmm7, -80(%rbp)                              #3565.22
-        movdqa    %xmm8, -64(%rbp)                              #3565.22
-        movq      %r13, %rdi                                    #3565.22
-        movq      %r15, %rsi                                    #3565.22
-        call      prime_buffer_2na at PLT                          #3565.22
-                                # LOE r13 r15 ebx r12d r14d xmm0
-..B10.42:                       # Preds ..B10.17
-        movdqa    -64(%rbp), %xmm8                              #
-        movdqa    -80(%rbp), %xmm7                              #
-        movdqa    -96(%rbp), %xmm6                              #
-        movdqa    -112(%rbp), %xmm5                             #
-..LN1165:
-   .loc    1  3643
-        addq      $16, %r13                                     #3643.13
-        movq      %r13, %rdi                                    #3643.13
-        movdqa    -128(%rbp), %xmm4                             #
-        movdqa    -144(%rbp), %xmm3                             #
-        movdqa    -160(%rbp), %xmm2                             #
-        movdqa    -176(%rbp), %xmm1                             #
-..LN1167:
-   .loc    1  3646
-        cmpq      %r15, %r13                                    #3646.24
-        jae       ..B10.19      # Prob 12%                      #3646.24
-                                # LOE rdi r13 r15 ebx r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.18:                       # Preds ..B10.42
-..LN1169:
-   .loc    1  3647
-        movzbl    -1(%r13), %ebx                                #3647.32
-..LN1171:
-        shll      $8, %ebx                                      #3647.46
-                                # LOE rdi r13 r15 ebx r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.19:                       # Preds ..B10.42 ..B10.7 ..B10.18
-..LN1173:
-   .loc    1  3448
-        movl      $16, %eax                                     #3448.13
-        jmp       ..B10.23      # Prob 100%                     #3448.13
-                                # LOE rdi r13 r15 eax ebx r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.20:                       # Preds ..B10.15
-..LN1175:
-   .loc    1  3539
-        psrldq    $1, %xmm0                                     #3539.26
-..LN1177:
-   .loc    1  3542
-        cmpq      %r15, %rdi                                    #3542.26
-        jae       ..B10.22      # Prob 19%                      #3542.26
-                                # LOE rdi r13 r15 eax ebx r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.21:                       # Preds ..B10.20
-..LN1179:
-   .loc    1  3545
-        movzbl    (%rdi), %edx                                  #3545.37
-..LN1181:
-   .loc    1  3544
-        sarl      $8, %ebx                                      #3544.21
-..LN1183:
-   .loc    1  3545
-        shll      $8, %edx                                      #3545.48
-..LN1185:
-        orl       %edx, %ebx                                    #3545.21
-..LN1187:
-   .loc    1  3546
-        pinsrw    $7, %ebx, %xmm0                               #3546.30
-                                # LOE rdi r13 r15 eax ebx r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.22:                       # Preds ..B10.21 ..B10.20
-..LN1189:
-   .loc    1  3550
-        incq      %rdi                                          #3550.20
-                                # LOE rdi r13 r15 eax ebx r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.23:                       # Preds ..B10.19 ..B10.22 ..B10.35
-..LN1191:
-   .loc    1  3458
-        movdqa    %xmm0, %xmm9                                  #3458.22
-        pand      %xmm7, %xmm9                                  #3458.22
-..LN1193:
-   .loc    1  3459
-        pcmpeqd   %xmm8, %xmm9                                  #3459.22
-..LN1195:
-   .loc    1  3460
-        pmovmskb  %xmm9, %edx                                   #3460.22
-..LN1197:
-   .loc    1  3461
-        incl      %edx                                          #3461.17
-        shrl      $16, %edx                                     #3461.17
-        negl      %edx                                          #3461.17
-        jmp       ..B10.11      # Prob 100%                     #3461.17
-                                # LOE rdi r13 r15 eax edx ebx r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.24:                       # Preds ..B10.13                # Infreq
-..LN1199:
-   .loc    1  3489
-        subl      %r12d, %r14d                                  #3489.30
-..LN1201:
-        cmpl      $2, %r14d                                     #3489.37
-        je        ..B10.28      # Prob 25%                      #3489.37
-                                # LOE edx ecx esi r14d
-..B10.25:                       # Preds ..B10.24                # Infreq
-        cmpl      $1, %r14d                                     #3489.37
-        je        ..B10.29      # Prob 33%                      #3489.37
-                                # LOE edx esi r14d
-..B10.26:                       # Preds ..B10.25                # Infreq
-        testl     %r14d, %r14d                                  #3489.37
-        je        ..B10.30      # Prob 50%                      #3489.37
-                                # LOE edx
-..B10.27:                       # Preds ..B10.26                # Infreq
-..LN1203:
-   .loc    1  3492
-        movq      -48(%rbp), %rbx                               #3492.32
-..___tag_value_eval_2na_128.426:                                #
-        movq      -16(%rbp), %r12                               #3492.32
-..___tag_value_eval_2na_128.427:                                #
-        movq      -32(%rbp), %r13                               #3492.32
-..___tag_value_eval_2na_128.428:                                #
-        movq      -24(%rbp), %r14                               #3492.32
-..___tag_value_eval_2na_128.429:                                #
-        movl      $1, %eax                                      #3492.32
-        movq      -40(%rbp), %r15                               #3492.32
-..___tag_value_eval_2na_128.430:                                #
-        movq      %rbp, %rsp                                    #3492.32
-        popq      %rbp                                          #3492.32
-..___tag_value_eval_2na_128.431:                                #
-        ret                                                     #3492.32
-..___tag_value_eval_2na_128.432:                                #
-                                # LOE
-..B10.28:                       # Preds ..B10.24                # Infreq
-..LN1205:
-   .loc    1  3494
-        testl     %ecx, %ecx                                    #3494.36
-        jne       ..B10.31      # Prob 28%                      #3494.36
-                                # LOE edx esi
-..B10.29:                       # Preds ..B10.28 ..B10.25       # Infreq
-..LN1207:
-   .loc    1  3496
-        testl     %esi, %esi                                    #3496.36
-        jne       ..B10.31      # Prob 28%                      #3496.36
-                                # LOE edx
-..B10.30:                       # Preds ..B10.29 ..B10.26       # Infreq
-..LN1209:
-   .loc    1  3498
-        testl     %edx, %edx                                    #3498.36
-        je        ..B10.32      # Prob 50%                      #3498.36
-                                # LOE
-..B10.31:                       # Preds ..B10.28 ..B10.29 ..B10.30 # Infreq
-..LN1211:
-        movq      -48(%rbp), %rbx                               #3498.47
-..___tag_value_eval_2na_128.438:                                #
-        movq      -16(%rbp), %r12                               #3498.47
-..___tag_value_eval_2na_128.439:                                #
-        movq      -32(%rbp), %r13                               #3498.47
-..___tag_value_eval_2na_128.440:                                #
-        movq      -24(%rbp), %r14                               #3498.47
-..___tag_value_eval_2na_128.441:                                #
-        movl      $1, %eax                                      #3498.47
-        movq      -40(%rbp), %r15                               #3498.47
-..___tag_value_eval_2na_128.442:                                #
-        movq      %rbp, %rsp                                    #3498.47
-        popq      %rbp                                          #3498.47
-..___tag_value_eval_2na_128.443:                                #
-        ret                                                     #3498.47
-..___tag_value_eval_2na_128.444:                                #
-                                # LOE
-..B10.32:                       # Preds ..B10.14 ..B10.16 ..B10.30 # Infreq
-..LN1213:
-   .loc    1  3500
-        movq      -48(%rbp), %rbx                               #3500.28
-..___tag_value_eval_2na_128.450:                                #
-        movq      -16(%rbp), %r12                               #3500.28
-..___tag_value_eval_2na_128.451:                                #
-        movq      -32(%rbp), %r13                               #3500.28
-..___tag_value_eval_2na_128.452:                                #
-        movq      -24(%rbp), %r14                               #3500.28
-..___tag_value_eval_2na_128.453:                                #
-        xorl      %eax, %eax                                    #3500.28
-        movq      -40(%rbp), %r15                               #3500.28
-..___tag_value_eval_2na_128.454:                                #
-        movq      %rbp, %rsp                                    #3500.28
-        popq      %rbp                                          #3500.28
-..___tag_value_eval_2na_128.455:                                #
-        ret                                                     #3500.28
-..___tag_value_eval_2na_128.456:                                #
-                                # LOE
-..B10.35:                       # Preds ..B10.3                 # Infreq
-        movq      %r13, %r15                                    #
-        movq      %r8, %r13                                     #
-        jmp       ..B10.23      # Prob 100%                     #
-        .align    16,0x90
-..___tag_value_eval_2na_128.462:                                #
-                                # LOE rdi r13 r15 eax ebx r12d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-# mark_end;
-	.type	eval_2na_128, at function
-	.size	eval_2na_128,.-eval_2na_128
-.LNeval_2na_128:
-	.data
-# -- End  eval_2na_128
-	.text
-# -- Begin  eval_2na_32
-# mark_begin;
-       .align    16,0x90
-eval_2na_32:
-# parameter 1(self): %rdi
-# parameter 2(ncbi2na): %rsi
-# parameter 3(pos): %edx
-# parameter 4(len): %ecx
-..B11.1:                        # Preds ..B11.0
-..___tag_value_eval_2na_32.463:                                 #2782.1
-..LN1215:
-   .loc    1  2782
-        pushq     %rbp                                          #2782.1
-        movq      %rsp, %rbp                                    #2782.1
-..___tag_value_eval_2na_32.464:                                 #
-        subq      $272, %rsp                                    #2782.1
-        movq      %r15, -56(%rbp)                               #2782.1
-..___tag_value_eval_2na_32.466:                                 #
-        movq      %r14, -48(%rbp)                               #2782.1
-..___tag_value_eval_2na_32.467:                                 #
-        movq      %r13, -24(%rbp)                               #2782.1
-..___tag_value_eval_2na_32.468:                                 #
-        movq      %r12, -40(%rbp)                               #2782.1
-..___tag_value_eval_2na_32.469:                                 #
-        movq      %rbx, -32(%rbp)                               #2782.1
-..___tag_value_eval_2na_32.470:                                 #
-        movl      %ecx, %r12d                                   #2782.1
-        movl      %edx, %ebx                                    #2782.1
-        movq      %rsi, %r14                                    #2782.1
-        movq      %rdi, %r13                                    #2782.1
-        lea       _gprof_pack10(%rip), %rdx                     #2782.1
-        call      mcount at PLT                                    #2782.1
-                                # LOE r13 r14 ebx r12d
-..B11.48:                       # Preds ..B11.1
-..LN1217:
-   .loc    1  2819
-        lea       (%rbx,%r12), %eax                             #2819.5
-..LN1219:
-   .loc    1  2825
-        subl      4(%r13), %eax                                 #2825.12
-..LN1221:
-   .loc    1  2831
-        movl      %eax, -16(%rbp)                               #2831.14
-..LN1223:
-   .loc    1  2822
-        movl      %ebx, %r15d                                   #2822.49
-        shrl      $2, %r15d                                     #2822.49
-..LN1225:
-        lea       (%r14,%r15), %rdi                             #2822.30
-..LN1227:
-   .loc    1  2828
-        lea       3(%rbx,%r12), %r12d                           #2828.50
-..LN1229:
-        shrl      $2, %r12d                                     #2828.57
-..LN1231:
-        addq      %r14, %r12                                    #2828.30
-..LN1233:
-   .loc    1  2831
-        movq      %r12, %rsi                                    #2831.14
-        call      prime_buffer_2na at PLT                          #2831.14
-                                # LOE r12 r13 r14 r15 ebx xmm0
-..B11.49:                       # Preds ..B11.48
-        movl      -16(%rbp), %eax                               #
-..LN1235:
-   .loc    1  2832
-        lea       16(%r14,%r15), %r15                           #2832.5
-        movq      %r15, %rsi                                    #2832.5
-..LN1237:
-   .loc    1  2837
-        cmpq      %r12, %r15                                    #2837.16
-..LN1239:
-   .loc    1  2842
-..LN1241:
-   .loc    1  2837
-        jae       ..B11.3       # Prob 12%                      #2837.16
-                                # LOE rax rsi r12 r13 r15 eax ebx r14d al ah xmm0
-..B11.2:                        # Preds ..B11.49
-..LN1243:
-   .loc    1  2838
-        movzbl    -1(%r15), %r14d                               #2838.24
-..LN1245:
-        shll      $8, %r14d                                     #2838.38
-                                # LOE rax rsi r12 r13 r15 eax ebx r14d al ah xmm0
-..B11.3:                        # Preds ..B11.2 ..B11.49
-..LN1247:
-   .loc    1  2842
-        movdqa    16(%r13), %xmm7                               #2842.5
-        movdqa    32(%r13), %xmm6                               #2842.5
-        movdqa    48(%r13), %xmm5                               #2842.5
-        movdqa    64(%r13), %xmm4                               #2842.5
-        movdqa    80(%r13), %xmm3                               #2842.5
-        movdqa    96(%r13), %xmm2                               #2842.5
-        movdqa    112(%r13), %xmm1                              #2842.5
-        movdqa    128(%r13), %xmm8                              #2842.5
-..LN1249:
-   .loc    1  2845
-        xorl      %edi, %edi                                    #2845.15
-..LN1251:
-        xorl      %ecx, %ecx                                    #2845.10
-..LN1253:
-        xorl      %edx, %edx                                    #2845.5
-..LN1255:
-   .loc    1  2849
-        movl      $4, %r13d                                     #2849.5
-..LN1257:
-   .loc    1  2854
-        movl      %ebx, %r8d                                    #2854.20
-        andl      $3, %r8d                                      #2854.20
-        je        ..B11.40      # Prob 20%                      #2854.20
-                                # LOE rax rsi r12 r15 eax edx ecx ebx edi r8d r13d r14d al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B11.4:                        # Preds ..B11.3
-        cmpl      $1, %r8d                                      #2854.20
-        je        ..B11.10      # Prob 25%                      #2854.20
-                                # LOE rax rsi r12 r15 eax edx ecx ebx edi r8d r13d r14d al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B11.5:                        # Preds ..B11.4
-        cmpl      $2, %r8d                                      #2854.20
-        je        ..B11.9       # Prob 33%                      #2854.20
-                                # LOE rax rsi r12 r15 eax edx ecx ebx edi r8d r13d r14d al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B11.6:                        # Preds ..B11.5
-        cmpl      $3, %r8d                                      #2854.20
-        je        ..B11.8       # Prob 50%                      #2854.20
-                                # LOE rax rsi r12 r15 eax edx ecx ebx edi r13d r14d al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B11.7:                        # Preds ..B11.6
-        movdqa    %xmm8, -112(%rbp)                             #
-        movdqa    %xmm1, -96(%rbp)                              #
-        movdqa    %xmm2, -176(%rbp)                             #
-        movdqa    %xmm3, -128(%rbp)                             #
-        movdqa    %xmm4, -80(%rbp)                              #
-        movdqa    %xmm5, -192(%rbp)                             #
-        movdqa    %xmm6, -160(%rbp)                             #
-        movdqa    %xmm7, -144(%rbp)                             #
-        movq      %r12, -64(%rbp)                               #
-        movl      %eax, -16(%rbp)                               #
-        movl      %ebx, %eax                                    #
-        jmp       ..B11.32      # Prob 100%                     #
-                                # LOE rsi r15 eax r14d xmm0
-..B11.8:                        # Preds ..B11.6
-        movdqa    %xmm8, -112(%rbp)                             #
-        movdqa    %xmm1, -96(%rbp)                              #
-        movdqa    %xmm2, -176(%rbp)                             #
-        movdqa    %xmm3, -128(%rbp)                             #
-        movdqa    %xmm4, -80(%rbp)                              #
-        movdqa    %xmm5, -192(%rbp)                             #
-        movdqa    %xmm6, -160(%rbp)                             #
-        movdqa    %xmm7, -144(%rbp)                             #
-        movq      %r12, -64(%rbp)                               #
-        movl      %eax, -16(%rbp)                               #
-        movl      %ebx, %eax                                    #
-        movl      %edi, %ebx                                    #
-        jmp       ..B11.13      # Prob 100%                     #
-                                # LOE rsi r15 eax edx ecx ebx r13d r14d xmm0
-..B11.9:                        # Preds ..B11.5
-        movdqa    %xmm8, -112(%rbp)                             #
-        movdqa    %xmm1, -96(%rbp)                              #
-        movdqa    %xmm2, -176(%rbp)                             #
-        movdqa    %xmm3, -128(%rbp)                             #
-        movdqa    %xmm4, -80(%rbp)                              #
-        movdqa    %xmm5, -192(%rbp)                             #
-        movdqa    %xmm6, -160(%rbp)                             #
-        movdqa    %xmm7, -144(%rbp)                             #
-        movq      %r12, -64(%rbp)                               #
-        movl      %eax, -16(%rbp)                               #
-        movl      %ebx, %eax                                    #
-        jmp       ..B11.12      # Prob 100%                     #
-                                # LOE rsi r15 eax edx ecx r13d r14d xmm0
-..B11.10:                       # Preds ..B11.4
-        movdqa    %xmm8, -112(%rbp)                             #
-        movdqa    %xmm1, -96(%rbp)                              #
-        movdqa    %xmm2, -176(%rbp)                             #
-        movdqa    %xmm3, -128(%rbp)                             #
-        movdqa    %xmm4, -80(%rbp)                              #
-        movdqa    %xmm5, -192(%rbp)                             #
-        movdqa    %xmm6, -160(%rbp)                             #
-        movdqa    %xmm7, -144(%rbp)                             #
-        movq      %r12, -64(%rbp)                               #
-        movl      %eax, -16(%rbp)                               #
-        movl      %ebx, %eax                                    #
-                                # LOE rsi r15 eax edx r13d r14d xmm0
-..B11.11:                       # Preds ..B11.10 ..B11.36
-..LN1259:
-   .loc    1  2877
-        movdqa    %xmm0, %xmm1                                  #2877.22
-        pand      -80(%rbp), %xmm1                              #2877.22
-..LN1261:
-   .loc    1  2878
-        pcmpeqd   -192(%rbp), %xmm1                             #2878.22
-..LN1263:
-   .loc    1  2879
-        pmovmskb  %xmm1, %ecx                                   #2879.22
-                                # LOE rsi r15 eax edx ecx r13d r14d xmm0
-..B11.12:                       # Preds ..B11.9 ..B11.11
-..LN1265:
-   .loc    1  2883
-        movdqa    %xmm0, %xmm1                                  #2883.22
-        pand      -176(%rbp), %xmm1                             #2883.22
-..LN1267:
-   .loc    1  2884
-        pcmpeqd   -128(%rbp), %xmm1                             #2884.22
-..LN1269:
-   .loc    1  2885
-        pmovmskb  %xmm1, %ebx                                   #2885.22
-                                # LOE rsi r15 eax edx ecx ebx r13d r14d xmm0
-..B11.13:                       # Preds ..B11.8 ..B11.12
-..LN1271:
-   .loc    1  2889
-        movdqa    %xmm0, %xmm1                                  #2889.22
-        pand      -112(%rbp), %xmm1                             #2889.22
-..LN1273:
-   .loc    1  2890
-        pcmpeqd   -96(%rbp), %xmm1                              #2890.22
-..LN1275:
-   .loc    1  2891
-        pmovmskb  %xmm1, %r8d                                   #2891.22
-..LN1277:
-   .loc    1  2896
-        movl      %eax, %r12d                                   #2896.17
-        andl      $-4, %r12d                                    #2896.17
-..LN1279:
-   .loc    1  2899
-        movl      %edx, %eax                                    #2899.29
-        orl       %ecx, %eax                                    #2899.29
-..LN1281:
-        orl       %ebx, %eax                                    #2899.34
-..LN1283:
-        orl       %r8d, %eax                                    #2899.39
-..LN1285:
-        je        ..B11.26      # Prob 78%                      #2899.47
-                                # LOE rsi r15 edx ecx ebx r8d r12d r13d r14d xmm0
-..B11.14:                       # Preds ..B11.13
-..LN1287:
-   .loc    1  2917
-        movdqa    %xmm0, -272(%rbp)                             #2917.30
-        movl      %edx, %edi                                    #2917.30
-        movl      %r8d, -232(%rbp)                              #2917.30
-        movl      %edx, -224(%rbp)                              #2917.30
-        movl      %ecx, -216(%rbp)                              #2917.30
-        movq      %rsi, -208(%rbp)                              #2917.30
-        call      uint16_lsbit at PLT                              #2917.30
-                                # LOE r15 eax ebx r12d r13d r14d
-..B11.50:                       # Preds ..B11.14
-        movq      -208(%rbp), %rsi                              #
-        movdqa    -272(%rbp), %xmm0                             #
-        movl      -216(%rbp), %ecx                              #
-        movl      -224(%rbp), %edx                              #
-        movl      -232(%rbp), %r8d                              #
-                                # LOE rdx rcx rsi r8 r15 eax edx ecx ebx r8d r12d r13d r14d dl cl r8b dh ch xmm0
-..B11.15:                       # Preds ..B11.50
-..LN1289:
-   .loc    1  2918
-        movdqa    %xmm0, -272(%rbp)                             #2918.30
-        movl      %ecx, %edi                                    #2918.30
-        movl      %r8d, -232(%rbp)                              #2918.30
-..LN1291:
-   .loc    1  2917
-        movswq    %ax, %rax                                     #2917.30
-        movl      %eax, -240(%rbp)                              #2917.30
-..LN1293:
-   .loc    1  2918
-        movl      %edx, -224(%rbp)                              #2918.30
-        movl      %ecx, -216(%rbp)                              #2918.30
-        movq      %rsi, -208(%rbp)                              #2918.30
-        call      uint16_lsbit at PLT                              #2918.30
-                                # LOE r15 eax ebx r12d r13d r14d
-..B11.51:                       # Preds ..B11.15
-        movq      -208(%rbp), %rsi                              #
-        movdqa    -272(%rbp), %xmm0                             #
-        movl      -216(%rbp), %ecx                              #
-        movl      -224(%rbp), %edx                              #
-        movl      -232(%rbp), %r8d                              #
-                                # LOE rdx rcx rsi r8 r15 eax edx ecx ebx r8d r12d r13d r14d dl cl r8b dh ch xmm0
-..B11.16:                       # Preds ..B11.51
-..LN1295:
-   .loc    1  2919
-        movdqa    %xmm0, -272(%rbp)                             #2919.30
-        movl      %ebx, %edi                                    #2919.30
-        movl      %r8d, -232(%rbp)                              #2919.30
-..LN1297:
-   .loc    1  2918
-        movswq    %ax, %rax                                     #2918.30
-        movl      %eax, -248(%rbp)                              #2918.30
-..LN1299:
-   .loc    1  2919
-        movl      %edx, -224(%rbp)                              #2919.30
-        movl      %ecx, -216(%rbp)                              #2919.30
-        movq      %rsi, -208(%rbp)                              #2919.30
-        call      uint16_lsbit at PLT                              #2919.30
-                                # LOE r15 eax ebx r12d r13d r14d
-..B11.52:                       # Preds ..B11.16
-        movq      -208(%rbp), %rsi                              #
-        movdqa    -272(%rbp), %xmm0                             #
-        movl      -216(%rbp), %ecx                              #
-        movl      -224(%rbp), %edx                              #
-        movl      -232(%rbp), %r8d                              #
-                                # LOE rdx rcx rsi r8 r15 eax edx ecx ebx r8d r12d r13d r14d dl cl r8b dh ch xmm0
-..B11.17:                       # Preds ..B11.52
-..LN1301:
-   .loc    1  2920
-        movdqa    %xmm0, -272(%rbp)                             #2920.30
-        movl      %r8d, %edi                                    #2920.30
-        movl      %r8d, -232(%rbp)                              #2920.30
-..LN1303:
-   .loc    1  2919
-        movswq    %ax, %rax                                     #2919.30
-        movl      %eax, -256(%rbp)                              #2919.30
-..LN1305:
-   .loc    1  2920
-        movl      %edx, -224(%rbp)                              #2920.30
-        movl      %ecx, -216(%rbp)                              #2920.30
-        movq      %rsi, -208(%rbp)                              #2920.30
-        call      uint16_lsbit at PLT                              #2920.30
-                                # LOE r15 eax ebx r12d r13d r14d
-..B11.53:                       # Preds ..B11.17
-        movq      -208(%rbp), %rsi                              #
-        movdqa    -272(%rbp), %xmm0                             #
-        movl      -216(%rbp), %ecx                              #
-        movl      -224(%rbp), %edx                              #
-        movl      -232(%rbp), %r8d                              #
-                                # LOE rdx rcx rsi r8 r15 eax edx ecx ebx r8d r12d r13d r14d dl cl r8b dh ch xmm0
-..B11.18:                       # Preds ..B11.53
-..LN1307:
-   .loc    1  2925
-        movl      -240(%rbp), %r9d                              #2925.34
-..LN1309:
-   .loc    1  2926
-        movl      -248(%rbp), %r10d                             #2926.34
-..LN1311:
-   .loc    1  2927
-        movl      -256(%rbp), %r11d                             #2927.34
-..LN1313:
-   .loc    1  2920
-        movswq    %ax, %rax                                     #2920.30
-..LN1315:
-   .loc    1  2925
-        shll      $2, %r9d                                      #2925.34
-        movl      %r9d, -240(%rbp)                              #2925.34
-..LN1317:
-   .loc    1  2926
-        shll      $2, %r10d                                     #2926.34
-        movl      %r10d, -248(%rbp)                             #2926.34
-..LN1319:
-   .loc    1  2927
-        shll      $2, %r11d                                     #2927.34
-        movl      %r11d, -256(%rbp)                             #2927.34
-..LN1321:
-   .loc    1  2928
-        shll      $2, %eax                                      #2928.34
-..LN1323:
-   .loc    1  2932
-        testl     %edx, %edx                                    #2932.32
-        je        ..B11.20      # Prob 50%                      #2932.32
-                                # LOE rcx rsi r8 r9 r10 r11 r15 eax ecx ebx r8d r9d r10d r11d r12d r13d r14d cl r8b r9b r10b r11b ch xmm0
-..B11.19:                       # Preds ..B11.18
-..LN1325:
-        movl      %r9d, %edx                                    #2932.43
-        addl      %r12d, %edx                                   #2932.43
-..LN1327:
-        cmpl      -16(%rbp), %edx                               #2932.49
-        jbe       ..B11.41      # Prob 20%                      #2932.49
-                                # LOE rcx rsi r8 r10 r11 r15 eax ecx ebx r8d r10d r11d r12d r13d r14d cl r8b r10b r11b ch xmm0
-..B11.20:                       # Preds ..B11.19 ..B11.18
-..LN1329:
-   .loc    1  2933
-        testl     %ecx, %ecx                                    #2933.32
-        je        ..B11.22      # Prob 50%                      #2933.32
-                                # LOE rsi r8 r10 r11 r15 eax ebx r8d r10d r11d r12d r13d r14d r8b r10b r11b xmm0
-..B11.21:                       # Preds ..B11.20
-..LN1331:
-        movl      %r10d, %edx                                   #2933.43
-        lea       1(%r12,%rdx), %ecx                            #2933.43
-..LN1333:
-        cmpl      -16(%rbp), %ecx                               #2933.49
-        jbe       ..B11.41      # Prob 20%                      #2933.49
-                                # LOE rsi r8 r11 r15 eax ebx r8d r11d r12d r13d r14d r8b r11b xmm0
-..B11.22:                       # Preds ..B11.21 ..B11.20
-..LN1335:
-   .loc    1  2934
-        testl     %ebx, %ebx                                    #2934.32
-        je        ..B11.24      # Prob 50%                      #2934.32
-                                # LOE rsi r8 r11 r15 eax r8d r11d r12d r13d r14d r8b r11b xmm0
-..B11.23:                       # Preds ..B11.22
-..LN1337:
-        movl      %r11d, %edx                                   #2934.43
-        lea       2(%r12,%rdx), %ecx                            #2934.43
-..LN1339:
-        cmpl      -16(%rbp), %ecx                               #2934.49
-        jbe       ..B11.41      # Prob 20%                      #2934.49
-                                # LOE rsi r8 r15 eax r8d r12d r13d r14d r8b xmm0
-..B11.24:                       # Preds ..B11.23 ..B11.22
-..LN1341:
-   .loc    1  2935
-        testl     %r8d, %r8d                                    #2935.32
-        je        ..B11.26      # Prob 50%                      #2935.32
-                                # LOE rsi r15 eax r12d r13d r14d xmm0
-..B11.25:                       # Preds ..B11.24
-..LN1343:
-        lea       3(%r12,%rax), %eax                            #2935.43
-..LN1345:
-        cmpl      -16(%rbp), %eax                               #2935.49
-        jbe       ..B11.41      # Prob 20%                      #2935.49
-                                # LOE rsi r15 r12d r13d r14d xmm0
-..B11.26:                       # Preds ..B11.25 ..B11.24 ..B11.13
-..LN1347:
-   .loc    1  2940
-        lea       4(%r12), %eax                                 #2940.17
-..LN1349:
-   .loc    1  2943
-        cmpl      -16(%rbp), %eax                               #2943.28
-        ja        ..B11.38      # Prob 20%                      #2943.28
-                                # LOE rsi r15 eax r12d r13d r14d xmm0
-..B11.27:                       # Preds ..B11.26
-..LN1351:
-   .loc    1  2947
-        decl      %r13d                                         #2947.25
-..LN1353:
-        jne       ..B11.33      # Prob 50%                      #2947.39
-                                # LOE rsi r15 eax r12d r13d r14d xmm0
-..B11.28:                       # Preds ..B11.27
-..LN1355:
-   .loc    1  2968
-        cmpq      -64(%rbp), %r15                               #2968.25
-        jae       ..B11.38      # Prob 4%                       #2968.25
-                                # LOE r15 r12d r14d
-..B11.29:                       # Preds ..B11.28
-..LN1357:
-   .loc    1  2972
-        lea       52(%r12), %eax                                #2972.13
-..LN1359:
-   .loc    1  2973
-        cmpl      -16(%rbp), %eax                               #2973.24
-        ja        ..B11.38      # Prob 4%                       #2973.24
-                                # LOE r15 eax r14d
-..B11.30:                       # Preds ..B11.29
-..LN1361:
-   .loc    1  2978
-        movq      -64(%rbp), %rsi                               #2978.22
-        movl      %eax, -200(%rbp)                              #2978.22
-        movq      %r15, %rdi                                    #2978.22
-        call      prime_buffer_2na at PLT                          #2978.22
-                                # LOE r15 r14d xmm0
-..B11.54:                       # Preds ..B11.30
-        movl      -200(%rbp), %eax                              #
-..LN1363:
-   .loc    1  3056
-        addq      $16, %r15                                     #3056.13
-..LN1365:
-   .loc    1  3059
-        cmpq      -64(%rbp), %r15                               #3059.24
-..LN1367:
-   .loc    1  3056
-        movq      %r15, %rsi                                    #3056.13
-..LN1369:
-   .loc    1  3059
-        jae       ..B11.32      # Prob 12%                      #3059.24
-                                # LOE rax rsi r15 eax r14d al ah xmm0
-..B11.31:                       # Preds ..B11.54
-..LN1371:
-   .loc    1  3060
-        movzbl    -1(%r15), %r14d                               #3060.32
-..LN1373:
-        shll      $8, %r14d                                     #3060.46
-                                # LOE rsi r15 eax r14d xmm0
-..B11.32:                       # Preds ..B11.54 ..B11.7 ..B11.31
-..LN1375:
-   .loc    1  2861
-        movl      $4, %r13d                                     #2861.13
-        jmp       ..B11.36      # Prob 100%                     #2861.13
-                                # LOE rsi r15 eax r13d r14d xmm0
-..B11.33:                       # Preds ..B11.27
-..LN1377:
-   .loc    1  2955
-        cmpq      -64(%rbp), %rsi                               #2955.26
-..LN1379:
-   .loc    1  2952
-        psrldq    $1, %xmm0                                     #2952.26
-..LN1381:
-   .loc    1  2955
-        jae       ..B11.35      # Prob 19%                      #2955.26
-                                # LOE rsi r15 eax r13d r14d xmm0
-..B11.34:                       # Preds ..B11.33
-..LN1383:
-   .loc    1  2958
-        movzbl    (%rsi), %edx                                  #2958.37
-..LN1385:
-   .loc    1  2957
-        sarl      $8, %r14d                                     #2957.21
-..LN1387:
-   .loc    1  2958
-        shll      $8, %edx                                      #2958.48
-..LN1389:
-        orl       %edx, %r14d                                   #2958.21
-..LN1391:
-   .loc    1  2959
-        pinsrw    $7, %r14d, %xmm0                              #2959.30
-                                # LOE rsi r15 eax r13d r14d xmm0
-..B11.35:                       # Preds ..B11.34 ..B11.33
-..LN1393:
-   .loc    1  2963
-        incq      %rsi                                          #2963.20
-                                # LOE rsi r15 eax r13d r14d xmm0
-..B11.36:                       # Preds ..B11.32 ..B11.35 ..B11.40
-..LN1395:
-   .loc    1  2871
-        movdqa    %xmm0, %xmm1                                  #2871.22
-        pand      -160(%rbp), %xmm1                             #2871.22
-..LN1397:
-   .loc    1  2872
-        pcmpeqd   -144(%rbp), %xmm1                             #2872.22
-..LN1399:
-   .loc    1  2873
-        pmovmskb  %xmm1, %edx                                   #2873.22
-        jmp       ..B11.11      # Prob 100%                     #2873.22
-                                # LOE rsi r15 eax edx r13d r14d xmm0
-..B11.38:                       # Preds ..B11.26 ..B11.28 ..B11.29 # Infreq
-..LN1401:
-   .loc    1  3069
-        movq      -32(%rbp), %rbx                               #3069.12
-..___tag_value_eval_2na_32.471:                                 #
-        movq      -40(%rbp), %r12                               #3069.12
-..___tag_value_eval_2na_32.472:                                 #
-        movq      -24(%rbp), %r13                               #3069.12
-..___tag_value_eval_2na_32.473:                                 #
-        movq      -48(%rbp), %r14                               #3069.12
-..___tag_value_eval_2na_32.474:                                 #
-        xorl      %eax, %eax                                    #3069.12
-        movq      -56(%rbp), %r15                               #3069.12
-..___tag_value_eval_2na_32.475:                                 #
-        movq      %rbp, %rsp                                    #3069.12
-        popq      %rbp                                          #3069.12
-..___tag_value_eval_2na_32.476:                                 #
-        ret                                                     #3069.12
-..___tag_value_eval_2na_32.477:                                 #
-                                # LOE
-..B11.40:                       # Preds ..B11.3                 # Infreq
-        movdqa    %xmm8, -112(%rbp)                             #
-        movdqa    %xmm1, -96(%rbp)                              #
-        movdqa    %xmm2, -176(%rbp)                             #
-        movdqa    %xmm3, -128(%rbp)                             #
-        movdqa    %xmm4, -80(%rbp)                              #
-        movdqa    %xmm5, -192(%rbp)                             #
-        movdqa    %xmm6, -160(%rbp)                             #
-        movdqa    %xmm7, -144(%rbp)                             #
-        movq      %r12, -64(%rbp)                               #
-        movl      %eax, -16(%rbp)                               #
-        movl      %ebx, %eax                                    #
-        jmp       ..B11.36      # Prob 100%                     #
-                                # LOE rsi r15 eax r13d r14d xmm0
-..B11.41:                       # Preds ..B11.23 ..B11.21 ..B11.19 ..B11.25 # Infreq
-..LN1403:
-   .loc    1  2935
-        movq      -32(%rbp), %rbx                               #2935.63
-..___tag_value_eval_2na_32.483:                                 #
-        movq      -40(%rbp), %r12                               #2935.63
-..___tag_value_eval_2na_32.484:                                 #
-        movq      -24(%rbp), %r13                               #2935.63
-..___tag_value_eval_2na_32.485:                                 #
-        movq      -48(%rbp), %r14                               #2935.63
-..___tag_value_eval_2na_32.486:                                 #
-        movl      $1, %eax                                      #2935.63
-        movq      -56(%rbp), %r15                               #2935.63
-..___tag_value_eval_2na_32.487:                                 #
-        movq      %rbp, %rsp                                    #2935.63
-        popq      %rbp                                          #2935.63
-..___tag_value_eval_2na_32.488:                                 #
-        ret                                                     #2935.63
-        .align    16,0x90
-..___tag_value_eval_2na_32.489:                                 #
-                                # LOE
-# mark_end;
-	.type	eval_2na_32, at function
-	.size	eval_2na_32,.-eval_2na_32
-.LNeval_2na_32:
-	.data
-# -- End  eval_2na_32
-	.text
-# -- Begin  eval_2na_16
-# mark_begin;
-       .align    16,0x90
-eval_2na_16:
-# parameter 1(self): %rdi
-# parameter 2(ncbi2na): %rsi
-# parameter 3(pos): %edx
-# parameter 4(len): %ecx
-..B12.1:                        # Preds ..B12.0
-..___tag_value_eval_2na_16.490:                                 #2489.1
-..LN1405:
-   .loc    1  2489
-        pushq     %rbp                                          #2489.1
-        movq      %rsp, %rbp                                    #2489.1
-..___tag_value_eval_2na_16.491:                                 #
-        subq      $272, %rsp                                    #2489.1
-        movq      %r15, -56(%rbp)                               #2489.1
-..___tag_value_eval_2na_16.493:                                 #
-        movq      %r14, -48(%rbp)                               #2489.1
-..___tag_value_eval_2na_16.494:                                 #
-        movq      %r13, -24(%rbp)                               #2489.1
-..___tag_value_eval_2na_16.495:                                 #
-        movq      %r12, -40(%rbp)                               #2489.1
-..___tag_value_eval_2na_16.496:                                 #
-        movq      %rbx, -32(%rbp)                               #2489.1
-..___tag_value_eval_2na_16.497:                                 #
-        movl      %ecx, %r12d                                   #2489.1
-        movl      %edx, %ebx                                    #2489.1
-        movq      %rsi, %r14                                    #2489.1
-        movq      %rdi, %r13                                    #2489.1
-        lea       _gprof_pack11(%rip), %rdx                     #2489.1
-        call      mcount at PLT                                    #2489.1
-                                # LOE r13 r14 ebx r12d
-..B12.48:                       # Preds ..B12.1
-..LN1407:
-   .loc    1  2526
-        lea       (%rbx,%r12), %eax                             #2526.5
-..LN1409:
-   .loc    1  2532
-        subl      4(%r13), %eax                                 #2532.12
-..LN1411:
-   .loc    1  2538
-        movl      %eax, -16(%rbp)                               #2538.14
-..LN1413:
-   .loc    1  2529
-        movl      %ebx, %r15d                                   #2529.49
-        shrl      $2, %r15d                                     #2529.49
-..LN1415:
-        lea       (%r14,%r15), %rdi                             #2529.30
-..LN1417:
-   .loc    1  2535
-        lea       3(%rbx,%r12), %r12d                           #2535.50
-..LN1419:
-        shrl      $2, %r12d                                     #2535.57
-..LN1421:
-        addq      %r14, %r12                                    #2535.30
-..LN1423:
-   .loc    1  2538
-        movq      %r12, %rsi                                    #2538.14
-        call      prime_buffer_2na at PLT                          #2538.14
-                                # LOE r12 r13 r14 r15 ebx xmm0
-..B12.49:                       # Preds ..B12.48
-        movl      -16(%rbp), %eax                               #
-..LN1425:
-   .loc    1  2539
-        lea       16(%r14,%r15), %r15                           #2539.5
-        movq      %r15, %rsi                                    #2539.5
-..LN1427:
-   .loc    1  2544
-        cmpq      %r12, %r15                                    #2544.16
-..LN1429:
-   .loc    1  2549
-..LN1431:
-   .loc    1  2544
-        jae       ..B12.3       # Prob 12%                      #2544.16
-                                # LOE rax rsi r12 r13 r15 eax ebx r14d al ah xmm0
-..B12.2:                        # Preds ..B12.49
-..LN1433:
-   .loc    1  2545
-        movzbl    -1(%r15), %r14d                               #2545.24
-..LN1435:
-        shll      $8, %r14d                                     #2545.38
-                                # LOE rax rsi r12 r13 r15 eax ebx r14d al ah xmm0
-..B12.3:                        # Preds ..B12.2 ..B12.49
-..LN1437:
-   .loc    1  2549
-        movdqa    16(%r13), %xmm7                               #2549.5
-        movdqa    32(%r13), %xmm6                               #2549.5
-        movdqa    48(%r13), %xmm5                               #2549.5
-        movdqa    64(%r13), %xmm4                               #2549.5
-        movdqa    80(%r13), %xmm3                               #2549.5
-        movdqa    96(%r13), %xmm2                               #2549.5
-        movdqa    112(%r13), %xmm1                              #2549.5
-        movdqa    128(%r13), %xmm8                              #2549.5
-..LN1439:
-   .loc    1  2552
-        xorl      %edi, %edi                                    #2552.15
-..LN1441:
-        xorl      %ecx, %ecx                                    #2552.10
-..LN1443:
-        xorl      %edx, %edx                                    #2552.5
-..LN1445:
-   .loc    1  2556
-        movl      $2, %r13d                                     #2556.5
-..LN1447:
-   .loc    1  2561
-        movl      %ebx, %r8d                                    #2561.20
-        andl      $3, %r8d                                      #2561.20
-        je        ..B12.40      # Prob 20%                      #2561.20
-                                # LOE rax rsi r12 r15 eax edx ecx ebx edi r8d r13d r14d al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.4:                        # Preds ..B12.3
-        cmpl      $1, %r8d                                      #2561.20
-        je        ..B12.10      # Prob 25%                      #2561.20
-                                # LOE rax rsi r12 r15 eax edx ecx ebx edi r8d r13d r14d al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.5:                        # Preds ..B12.4
-        cmpl      $2, %r8d                                      #2561.20
-        je        ..B12.9       # Prob 33%                      #2561.20
-                                # LOE rax rsi r12 r15 eax edx ecx ebx edi r8d r13d r14d al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.6:                        # Preds ..B12.5
-        cmpl      $3, %r8d                                      #2561.20
-        je        ..B12.8       # Prob 50%                      #2561.20
-                                # LOE rax rsi r12 r15 eax edx ecx ebx edi r13d r14d al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.7:                        # Preds ..B12.6
-        movdqa    %xmm8, -112(%rbp)                             #
-        movdqa    %xmm1, -96(%rbp)                              #
-        movdqa    %xmm2, -176(%rbp)                             #
-        movdqa    %xmm3, -128(%rbp)                             #
-        movdqa    %xmm4, -80(%rbp)                              #
-        movdqa    %xmm5, -192(%rbp)                             #
-        movdqa    %xmm6, -160(%rbp)                             #
-        movdqa    %xmm7, -144(%rbp)                             #
-        movq      %r12, -64(%rbp)                               #
-        movl      %eax, -16(%rbp)                               #
-        movl      %ebx, %eax                                    #
-        jmp       ..B12.32      # Prob 100%                     #
-                                # LOE rsi r15 eax r14d xmm0
-..B12.8:                        # Preds ..B12.6
-        movdqa    %xmm8, -112(%rbp)                             #
-        movdqa    %xmm1, -96(%rbp)                              #
-        movdqa    %xmm2, -176(%rbp)                             #
-        movdqa    %xmm3, -128(%rbp)                             #
-        movdqa    %xmm4, -80(%rbp)                              #
-        movdqa    %xmm5, -192(%rbp)                             #
-        movdqa    %xmm6, -160(%rbp)                             #
-        movdqa    %xmm7, -144(%rbp)                             #
-        movq      %r12, -64(%rbp)                               #
-        movl      %eax, -16(%rbp)                               #
-        movl      %ebx, %eax                                    #
-        movl      %edi, %ebx                                    #
-        jmp       ..B12.13      # Prob 100%                     #
-                                # LOE rsi r15 eax edx ecx ebx r13d r14d xmm0
-..B12.9:                        # Preds ..B12.5
-        movdqa    %xmm8, -112(%rbp)                             #
-        movdqa    %xmm1, -96(%rbp)                              #
-        movdqa    %xmm2, -176(%rbp)                             #
-        movdqa    %xmm3, -128(%rbp)                             #
-        movdqa    %xmm4, -80(%rbp)                              #
-        movdqa    %xmm5, -192(%rbp)                             #
-        movdqa    %xmm6, -160(%rbp)                             #
-        movdqa    %xmm7, -144(%rbp)                             #
-        movq      %r12, -64(%rbp)                               #
-        movl      %eax, -16(%rbp)                               #
-        movl      %ebx, %eax                                    #
-        jmp       ..B12.12      # Prob 100%                     #
-                                # LOE rsi r15 eax edx ecx r13d r14d xmm0
-..B12.10:                       # Preds ..B12.4
-        movdqa    %xmm8, -112(%rbp)                             #
-        movdqa    %xmm1, -96(%rbp)                              #
-        movdqa    %xmm2, -176(%rbp)                             #
-        movdqa    %xmm3, -128(%rbp)                             #
-        movdqa    %xmm4, -80(%rbp)                              #
-        movdqa    %xmm5, -192(%rbp)                             #
-        movdqa    %xmm6, -160(%rbp)                             #
-        movdqa    %xmm7, -144(%rbp)                             #
-        movq      %r12, -64(%rbp)                               #
-        movl      %eax, -16(%rbp)                               #
-        movl      %ebx, %eax                                    #
-                                # LOE rsi r15 eax edx r13d r14d xmm0
-..B12.11:                       # Preds ..B12.10 ..B12.36
-..LN1449:
-   .loc    1  2584
-        movdqa    %xmm0, %xmm1                                  #2584.22
-        pand      -80(%rbp), %xmm1                              #2584.22
-..LN1451:
-   .loc    1  2585
-        pcmpeqw   -192(%rbp), %xmm1                             #2585.22
-..LN1453:
-   .loc    1  2586
-        pmovmskb  %xmm1, %ecx                                   #2586.22
-                                # LOE rsi r15 eax edx ecx r13d r14d xmm0
-..B12.12:                       # Preds ..B12.9 ..B12.11
-..LN1455:
-   .loc    1  2590
-        movdqa    %xmm0, %xmm1                                  #2590.22
-        pand      -176(%rbp), %xmm1                             #2590.22
-..LN1457:
-   .loc    1  2591
-        pcmpeqw   -128(%rbp), %xmm1                             #2591.22
-..LN1459:
-   .loc    1  2592
-        pmovmskb  %xmm1, %ebx                                   #2592.22
-                                # LOE rsi r15 eax edx ecx ebx r13d r14d xmm0
-..B12.13:                       # Preds ..B12.8 ..B12.12
-..LN1461:
-   .loc    1  2596
-        movdqa    %xmm0, %xmm1                                  #2596.22
-        pand      -112(%rbp), %xmm1                             #2596.22
-..LN1463:
-   .loc    1  2597
-        pcmpeqw   -96(%rbp), %xmm1                              #2597.22
-..LN1465:
-   .loc    1  2598
-        pmovmskb  %xmm1, %r8d                                   #2598.22
-..LN1467:
-   .loc    1  2603
-        movl      %eax, %r12d                                   #2603.17
-        andl      $-4, %r12d                                    #2603.17
-..LN1469:
-   .loc    1  2606
-        movl      %edx, %eax                                    #2606.29
-        orl       %ecx, %eax                                    #2606.29
-..LN1471:
-        orl       %ebx, %eax                                    #2606.34
-..LN1473:
-        orl       %r8d, %eax                                    #2606.39
-..LN1475:
-        je        ..B12.26      # Prob 78%                      #2606.47
-                                # LOE rsi r15 edx ecx ebx r8d r12d r13d r14d xmm0
-..B12.14:                       # Preds ..B12.13
-..LN1477:
-   .loc    1  2624
-        movdqa    %xmm0, -272(%rbp)                             #2624.30
-        movl      %edx, %edi                                    #2624.30
-        movl      %r8d, -232(%rbp)                              #2624.30
-        movl      %edx, -224(%rbp)                              #2624.30
-        movl      %ecx, -216(%rbp)                              #2624.30
-        movq      %rsi, -208(%rbp)                              #2624.30
-        call      uint16_lsbit at PLT                              #2624.30
-                                # LOE r15 eax ebx r12d r13d r14d
-..B12.50:                       # Preds ..B12.14
-        movq      -208(%rbp), %rsi                              #
-        movdqa    -272(%rbp), %xmm0                             #
-        movl      -216(%rbp), %ecx                              #
-        movl      -224(%rbp), %edx                              #
-        movl      -232(%rbp), %r8d                              #
-                                # LOE rdx rcx rsi r8 r15 eax edx ecx ebx r8d r12d r13d r14d dl cl r8b dh ch xmm0
-..B12.15:                       # Preds ..B12.50
-..LN1479:
-   .loc    1  2625
-        movdqa    %xmm0, -272(%rbp)                             #2625.30
-        movl      %ecx, %edi                                    #2625.30
-        movl      %r8d, -232(%rbp)                              #2625.30
-..LN1481:
-   .loc    1  2624
-        movswq    %ax, %rax                                     #2624.30
-        movl      %eax, -240(%rbp)                              #2624.30
-..LN1483:
-   .loc    1  2625
-        movl      %edx, -224(%rbp)                              #2625.30
-        movl      %ecx, -216(%rbp)                              #2625.30
-        movq      %rsi, -208(%rbp)                              #2625.30
-        call      uint16_lsbit at PLT                              #2625.30
-                                # LOE r15 eax ebx r12d r13d r14d
-..B12.51:                       # Preds ..B12.15
-        movq      -208(%rbp), %rsi                              #
-        movdqa    -272(%rbp), %xmm0                             #
-        movl      -216(%rbp), %ecx                              #
-        movl      -224(%rbp), %edx                              #
-        movl      -232(%rbp), %r8d                              #
-                                # LOE rdx rcx rsi r8 r15 eax edx ecx ebx r8d r12d r13d r14d dl cl r8b dh ch xmm0
-..B12.16:                       # Preds ..B12.51
-..LN1485:
-   .loc    1  2626
-        movdqa    %xmm0, -272(%rbp)                             #2626.30
-        movl      %ebx, %edi                                    #2626.30
-        movl      %r8d, -232(%rbp)                              #2626.30
-..LN1487:
-   .loc    1  2625
-        movswq    %ax, %rax                                     #2625.30
-        movl      %eax, -248(%rbp)                              #2625.30
-..LN1489:
-   .loc    1  2626
-        movl      %edx, -224(%rbp)                              #2626.30
-        movl      %ecx, -216(%rbp)                              #2626.30
-        movq      %rsi, -208(%rbp)                              #2626.30
-        call      uint16_lsbit at PLT                              #2626.30
-                                # LOE r15 eax ebx r12d r13d r14d
-..B12.52:                       # Preds ..B12.16
-        movq      -208(%rbp), %rsi                              #
-        movdqa    -272(%rbp), %xmm0                             #
-        movl      -216(%rbp), %ecx                              #
-        movl      -224(%rbp), %edx                              #
-        movl      -232(%rbp), %r8d                              #
-                                # LOE rdx rcx rsi r8 r15 eax edx ecx ebx r8d r12d r13d r14d dl cl r8b dh ch xmm0
-..B12.17:                       # Preds ..B12.52
-..LN1491:
-   .loc    1  2627
-        movdqa    %xmm0, -272(%rbp)                             #2627.30
-        movl      %r8d, %edi                                    #2627.30
-        movl      %r8d, -232(%rbp)                              #2627.30
-..LN1493:
-   .loc    1  2626
-        movswq    %ax, %rax                                     #2626.30
-        movl      %eax, -256(%rbp)                              #2626.30
-..LN1495:
-   .loc    1  2627
-        movl      %edx, -224(%rbp)                              #2627.30
-        movl      %ecx, -216(%rbp)                              #2627.30
-        movq      %rsi, -208(%rbp)                              #2627.30
-        call      uint16_lsbit at PLT                              #2627.30
-                                # LOE r15 eax ebx r12d r13d r14d
-..B12.53:                       # Preds ..B12.17
-        movq      -208(%rbp), %rsi                              #
-        movdqa    -272(%rbp), %xmm0                             #
-        movl      -216(%rbp), %ecx                              #
-        movl      -224(%rbp), %edx                              #
-        movl      -232(%rbp), %r8d                              #
-                                # LOE rdx rcx rsi r8 r15 eax edx ecx ebx r8d r12d r13d r14d dl cl r8b dh ch xmm0
-..B12.18:                       # Preds ..B12.53
-..LN1497:
-   .loc    1  2632
-        movl      -240(%rbp), %r9d                              #2632.34
-..LN1499:
-   .loc    1  2633
-        movl      -248(%rbp), %r10d                             #2633.34
-..LN1501:
-   .loc    1  2634
-        movl      -256(%rbp), %r11d                             #2634.34
-..LN1503:
-   .loc    1  2627
-        movswq    %ax, %rax                                     #2627.30
-..LN1505:
-   .loc    1  2632
-        shll      $2, %r9d                                      #2632.34
-        movl      %r9d, -240(%rbp)                              #2632.34
-..LN1507:
-   .loc    1  2633
-        shll      $2, %r10d                                     #2633.34
-        movl      %r10d, -248(%rbp)                             #2633.34
-..LN1509:
-   .loc    1  2634
-        shll      $2, %r11d                                     #2634.34
-        movl      %r11d, -256(%rbp)                             #2634.34
-..LN1511:
-   .loc    1  2635
-        shll      $2, %eax                                      #2635.34
-..LN1513:
-   .loc    1  2639
-        testl     %edx, %edx                                    #2639.32
-        je        ..B12.20      # Prob 50%                      #2639.32
-                                # LOE rcx rsi r8 r9 r10 r11 r15 eax ecx ebx r8d r9d r10d r11d r12d r13d r14d cl r8b r9b r10b r11b ch xmm0
-..B12.19:                       # Preds ..B12.18
-..LN1515:
-        movl      %r9d, %edx                                    #2639.43
-        addl      %r12d, %edx                                   #2639.43
-..LN1517:
-        cmpl      -16(%rbp), %edx                               #2639.49
-        jbe       ..B12.41      # Prob 20%                      #2639.49
-                                # LOE rcx rsi r8 r10 r11 r15 eax ecx ebx r8d r10d r11d r12d r13d r14d cl r8b r10b r11b ch xmm0
-..B12.20:                       # Preds ..B12.19 ..B12.18
-..LN1519:
-   .loc    1  2640
-        testl     %ecx, %ecx                                    #2640.32
-        je        ..B12.22      # Prob 50%                      #2640.32
-                                # LOE rsi r8 r10 r11 r15 eax ebx r8d r10d r11d r12d r13d r14d r8b r10b r11b xmm0
-..B12.21:                       # Preds ..B12.20
-..LN1521:
-        movl      %r10d, %edx                                   #2640.43
-        lea       1(%r12,%rdx), %ecx                            #2640.43
-..LN1523:
-        cmpl      -16(%rbp), %ecx                               #2640.49
-        jbe       ..B12.41      # Prob 20%                      #2640.49
-                                # LOE rsi r8 r11 r15 eax ebx r8d r11d r12d r13d r14d r8b r11b xmm0
-..B12.22:                       # Preds ..B12.21 ..B12.20
-..LN1525:
-   .loc    1  2641
-        testl     %ebx, %ebx                                    #2641.32
-        je        ..B12.24      # Prob 50%                      #2641.32
-                                # LOE rsi r8 r11 r15 eax r8d r11d r12d r13d r14d r8b r11b xmm0
-..B12.23:                       # Preds ..B12.22
-..LN1527:
-        movl      %r11d, %edx                                   #2641.43
-        lea       2(%r12,%rdx), %ecx                            #2641.43
-..LN1529:
-        cmpl      -16(%rbp), %ecx                               #2641.49
-        jbe       ..B12.41      # Prob 20%                      #2641.49
-                                # LOE rsi r8 r15 eax r8d r12d r13d r14d r8b xmm0
-..B12.24:                       # Preds ..B12.23 ..B12.22
-..LN1531:
-   .loc    1  2642
-        testl     %r8d, %r8d                                    #2642.32
-        je        ..B12.26      # Prob 50%                      #2642.32
-                                # LOE rsi r15 eax r12d r13d r14d xmm0
-..B12.25:                       # Preds ..B12.24
-..LN1533:
-        lea       3(%r12,%rax), %eax                            #2642.43
-..LN1535:
-        cmpl      -16(%rbp), %eax                               #2642.49
-        jbe       ..B12.41      # Prob 20%                      #2642.49
-                                # LOE rsi r15 r12d r13d r14d xmm0
-..B12.26:                       # Preds ..B12.25 ..B12.24 ..B12.13
-..LN1537:
-   .loc    1  2647
-        lea       4(%r12), %eax                                 #2647.17
-..LN1539:
-   .loc    1  2650
-        cmpl      -16(%rbp), %eax                               #2650.28
-        ja        ..B12.38      # Prob 20%                      #2650.28
-                                # LOE rsi r15 eax r12d r13d r14d xmm0
-..B12.27:                       # Preds ..B12.26
-..LN1541:
-   .loc    1  2654
-        decl      %r13d                                         #2654.25
-..LN1543:
-        jne       ..B12.33      # Prob 50%                      #2654.39
-                                # LOE rsi r15 eax r12d r13d r14d xmm0
-..B12.28:                       # Preds ..B12.27
-..LN1545:
-   .loc    1  2675
-        cmpq      -64(%rbp), %r15                               #2675.25
-        jae       ..B12.38      # Prob 4%                       #2675.25
-                                # LOE r15 r12d r14d
-..B12.29:                       # Preds ..B12.28
-..LN1547:
-   .loc    1  2679
-        lea       60(%r12), %eax                                #2679.13
-..LN1549:
-   .loc    1  2680
-        cmpl      -16(%rbp), %eax                               #2680.24
-        ja        ..B12.38      # Prob 4%                       #2680.24
-                                # LOE r15 eax r14d
-..B12.30:                       # Preds ..B12.29
-..LN1551:
-   .loc    1  2685
-        movq      -64(%rbp), %rsi                               #2685.22
-        movl      %eax, -200(%rbp)                              #2685.22
-        movq      %r15, %rdi                                    #2685.22
-        call      prime_buffer_2na at PLT                          #2685.22
-                                # LOE r15 r14d xmm0
-..B12.54:                       # Preds ..B12.30
-        movl      -200(%rbp), %eax                              #
-..LN1553:
-   .loc    1  2763
-        addq      $16, %r15                                     #2763.13
-..LN1555:
-   .loc    1  2766
-        cmpq      -64(%rbp), %r15                               #2766.24
-..LN1557:
-   .loc    1  2763
-        movq      %r15, %rsi                                    #2763.13
-..LN1559:
-   .loc    1  2766
-        jae       ..B12.32      # Prob 12%                      #2766.24
-                                # LOE rax rsi r15 eax r14d al ah xmm0
-..B12.31:                       # Preds ..B12.54
-..LN1561:
-   .loc    1  2767
-        movzbl    -1(%r15), %r14d                               #2767.32
-..LN1563:
-        shll      $8, %r14d                                     #2767.46
-                                # LOE rsi r15 eax r14d xmm0
-..B12.32:                       # Preds ..B12.54 ..B12.7 ..B12.31
-..LN1565:
-   .loc    1  2568
-        movl      $2, %r13d                                     #2568.13
-        jmp       ..B12.36      # Prob 100%                     #2568.13
-                                # LOE rsi r15 eax r13d r14d xmm0
-..B12.33:                       # Preds ..B12.27
-..LN1567:
-   .loc    1  2662
-        cmpq      -64(%rbp), %rsi                               #2662.26
-..LN1569:
-   .loc    1  2659
-        psrldq    $1, %xmm0                                     #2659.26
-..LN1571:
-   .loc    1  2662
-        jae       ..B12.35      # Prob 19%                      #2662.26
-                                # LOE rsi r15 eax r13d r14d xmm0
-..B12.34:                       # Preds ..B12.33
-..LN1573:
-   .loc    1  2665
-        movzbl    (%rsi), %edx                                  #2665.37
-..LN1575:
-   .loc    1  2664
-        sarl      $8, %r14d                                     #2664.21
-..LN1577:
-   .loc    1  2665
-        shll      $8, %edx                                      #2665.48
-..LN1579:
-        orl       %edx, %r14d                                   #2665.21
-..LN1581:
-   .loc    1  2666
-        pinsrw    $7, %r14d, %xmm0                              #2666.30
-                                # LOE rsi r15 eax r13d r14d xmm0
-..B12.35:                       # Preds ..B12.34 ..B12.33
-..LN1583:
-   .loc    1  2670
-        incq      %rsi                                          #2670.20
-                                # LOE rsi r15 eax r13d r14d xmm0
-..B12.36:                       # Preds ..B12.32 ..B12.35 ..B12.40
-..LN1585:
-   .loc    1  2578
-        movdqa    %xmm0, %xmm1                                  #2578.22
-        pand      -160(%rbp), %xmm1                             #2578.22
-..LN1587:
-   .loc    1  2579
-        pcmpeqw   -144(%rbp), %xmm1                             #2579.22
-..LN1589:
-   .loc    1  2580
-        pmovmskb  %xmm1, %edx                                   #2580.22
-        jmp       ..B12.11      # Prob 100%                     #2580.22
-                                # LOE rsi r15 eax edx r13d r14d xmm0
-..B12.38:                       # Preds ..B12.26 ..B12.28 ..B12.29 # Infreq
-..LN1591:
-   .loc    1  2776
-        movq      -32(%rbp), %rbx                               #2776.12
-..___tag_value_eval_2na_16.498:                                 #
-        movq      -40(%rbp), %r12                               #2776.12
-..___tag_value_eval_2na_16.499:                                 #
-        movq      -24(%rbp), %r13                               #2776.12
-..___tag_value_eval_2na_16.500:                                 #
-        movq      -48(%rbp), %r14                               #2776.12
-..___tag_value_eval_2na_16.501:                                 #
-        xorl      %eax, %eax                                    #2776.12
-        movq      -56(%rbp), %r15                               #2776.12
-..___tag_value_eval_2na_16.502:                                 #
-        movq      %rbp, %rsp                                    #2776.12
-        popq      %rbp                                          #2776.12
-..___tag_value_eval_2na_16.503:                                 #
-        ret                                                     #2776.12
-..___tag_value_eval_2na_16.504:                                 #
-                                # LOE
-..B12.40:                       # Preds ..B12.3                 # Infreq
-        movdqa    %xmm8, -112(%rbp)                             #
-        movdqa    %xmm1, -96(%rbp)                              #
-        movdqa    %xmm2, -176(%rbp)                             #
-        movdqa    %xmm3, -128(%rbp)                             #
-        movdqa    %xmm4, -80(%rbp)                              #
-        movdqa    %xmm5, -192(%rbp)                             #
-        movdqa    %xmm6, -160(%rbp)                             #
-        movdqa    %xmm7, -144(%rbp)                             #
-        movq      %r12, -64(%rbp)                               #
-        movl      %eax, -16(%rbp)                               #
-        movl      %ebx, %eax                                    #
-        jmp       ..B12.36      # Prob 100%                     #
-                                # LOE rsi r15 eax r13d r14d xmm0
-..B12.41:                       # Preds ..B12.23 ..B12.21 ..B12.19 ..B12.25 # Infreq
-..LN1593:
-   .loc    1  2642
-        movq      -32(%rbp), %rbx                               #2642.63
-..___tag_value_eval_2na_16.510:                                 #
-        movq      -40(%rbp), %r12                               #2642.63
-..___tag_value_eval_2na_16.511:                                 #
-        movq      -24(%rbp), %r13                               #2642.63
-..___tag_value_eval_2na_16.512:                                 #
-        movq      -48(%rbp), %r14                               #2642.63
-..___tag_value_eval_2na_16.513:                                 #
-        movl      $1, %eax                                      #2642.63
-        movq      -56(%rbp), %r15                               #2642.63
-..___tag_value_eval_2na_16.514:                                 #
-        movq      %rbp, %rsp                                    #2642.63
-        popq      %rbp                                          #2642.63
-..___tag_value_eval_2na_16.515:                                 #
-        ret                                                     #2642.63
-        .align    16,0x90
-..___tag_value_eval_2na_16.516:                                 #
-                                # LOE
-# mark_end;
-	.type	eval_2na_16, at function
-	.size	eval_2na_16,.-eval_2na_16
-.LNeval_2na_16:
-	.data
-# -- End  eval_2na_16
-	.text
-# -- Begin  eval_2na_8
-# mark_begin;
-       .align    16,0x90
-eval_2na_8:
-# parameter 1(self): %rdi
-# parameter 2(ncbi2na): %rsi
-# parameter 3(pos): %edx
-# parameter 4(len): %ecx
-..B13.1:                        # Preds ..B13.0
-..___tag_value_eval_2na_8.517:                                  #2196.1
-..LN1595:
-   .loc    1  2196
-        pushq     %rbp                                          #2196.1
-        movq      %rsp, %rbp                                    #2196.1
-..___tag_value_eval_2na_8.518:                                  #
-        subq      $224, %rsp                                    #2196.1
-        movq      %r15, -48(%rbp)                               #2196.1
-..___tag_value_eval_2na_8.520:                                  #
-        movq      %r14, -40(%rbp)                               #2196.1
-..___tag_value_eval_2na_8.521:                                  #
-        movq      %r13, -32(%rbp)                               #2196.1
-..___tag_value_eval_2na_8.522:                                  #
-        movq      %r12, -24(%rbp)                               #2196.1
-..___tag_value_eval_2na_8.523:                                  #
-        movq      %rbx, -56(%rbp)                               #2196.1
-..___tag_value_eval_2na_8.524:                                  #
-        movl      %ecx, %ebx                                    #2196.1
-        movl      %edx, %r12d                                   #2196.1
-        movq      %rsi, %r15                                    #2196.1
-        movq      %rdi, %r13                                    #2196.1
-        lea       _gprof_pack12(%rip), %rdx                     #2196.1
-        call      mcount at PLT                                    #2196.1
-                                # LOE r13 r15 ebx r12d
-..B13.40:                       # Preds ..B13.1
-..LN1597:
-   .loc    1  2233
-        lea       (%r12,%rbx), %eax                             #2233.5
-..LN1599:
-   .loc    1  2239
-        subl      4(%r13), %eax                                 #2239.12
-..LN1601:
-   .loc    1  2245
-        movl      %eax, -224(%rbp)                              #2245.14
-..LN1603:
-   .loc    1  2236
-        movl      %r12d, %r14d                                  #2236.49
-        shrl      $2, %r14d                                     #2236.49
-..LN1605:
-        lea       (%r15,%r14), %rdi                             #2236.30
-..LN1607:
-   .loc    1  2242
-        lea       3(%r12,%rbx), %esi                            #2242.50
-..LN1609:
-        shrl      $2, %esi                                      #2242.57
-..LN1611:
-        addq      %r15, %rsi                                    #2242.30
-        movq      %rsi, -16(%rbp)                               #2242.30
-..LN1613:
-   .loc    1  2245
-        call      prime_buffer_2na at PLT                          #2245.14
-                                # LOE r13 r14 r15 r12d xmm0
-..B13.41:                       # Preds ..B13.40
-        movl      -224(%rbp), %eax                              #
-..LN1615:
-   .loc    1  2256
-        movdqa    16(%r13), %xmm7                               #2256.5
-        movdqa    32(%r13), %xmm6                               #2256.5
-        movdqa    48(%r13), %xmm5                               #2256.5
-        movdqa    64(%r13), %xmm4                               #2256.5
-        movdqa    80(%r13), %xmm3                               #2256.5
-        movdqa    96(%r13), %xmm2                               #2256.5
-        movdqa    112(%r13), %xmm1                              #2256.5
-        movdqa    128(%r13), %xmm8                              #2256.5
-..LN1617:
-   .loc    1  2246
-        lea       16(%r15,%r14), %rbx                           #2246.5
-..LN1619:
-   .loc    1  2259
-        xorl      %r15d, %r15d                                  #2259.15
-..LN1621:
-        xorl      %ecx, %ecx                                    #2259.10
-..LN1623:
-        xorl      %r14d, %r14d                                  #2259.5
-..LN1625:
-   .loc    1  2268
-        movl      %r12d, %edx                                   #2268.20
-        andl      $3, %edx                                      #2268.20
-        je        ..B13.5       # Prob 20%                      #2268.20
-                                # LOE rax rbx eax edx ecx r12d r14d r15d al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B13.2:                        # Preds ..B13.41
-        cmpl      $1, %edx                                      #2268.20
-        je        ..B13.8       # Prob 25%                      #2268.20
-                                # LOE rax rbx eax edx ecx r12d r14d r15d al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B13.3:                        # Preds ..B13.2
-        cmpl      $2, %edx                                      #2268.20
-        je        ..B13.7       # Prob 33%                      #2268.20
-                                # LOE rax rbx eax edx ecx r12d r14d r15d al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B13.4:                        # Preds ..B13.3
-        cmpl      $3, %edx                                      #2268.20
-        je        ..B13.6       # Prob 50%                      #2268.20
-                                # LOE rax rbx eax ecx r12d r14d r15d al ah xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B13.5:                        # Preds ..B13.41 ..B13.4
-        movdqa    %xmm8, -96(%rbp)                              #
-        movdqa    %xmm1, -112(%rbp)                             #
-        movdqa    %xmm2, -160(%rbp)                             #
-        movdqa    %xmm3, -176(%rbp)                             #
-        movdqa    %xmm4, -144(%rbp)                             #
-        movdqa    %xmm5, -128(%rbp)                             #
-        movdqa    %xmm6, -80(%rbp)                              #
-        movdqa    %xmm7, -192(%rbp)                             #
-        movl      %eax, %r13d                                   #
-        jmp       ..B13.28      # Prob 100%                     #
-                                # LOE rbx r12d r13d xmm0
-..B13.6:                        # Preds ..B13.4
-        movdqa    %xmm8, -96(%rbp)                              #
-        movdqa    %xmm1, -112(%rbp)                             #
-        movdqa    %xmm2, -160(%rbp)                             #
-        movdqa    %xmm3, -176(%rbp)                             #
-        movdqa    %xmm4, -144(%rbp)                             #
-        movdqa    %xmm5, -128(%rbp)                             #
-        movdqa    %xmm6, -80(%rbp)                              #
-        movdqa    %xmm7, -192(%rbp)                             #
-        movl      %eax, %r13d                                   #
-        jmp       ..B13.11      # Prob 100%                     #
-                                # LOE rbx ecx r12d r13d r14d r15d xmm0
-..B13.7:                        # Preds ..B13.3
-        movdqa    %xmm8, -96(%rbp)                              #
-        movdqa    %xmm1, -112(%rbp)                             #
-        movdqa    %xmm2, -160(%rbp)                             #
-        movdqa    %xmm3, -176(%rbp)                             #
-        movdqa    %xmm4, -144(%rbp)                             #
-        movdqa    %xmm5, -128(%rbp)                             #
-        movdqa    %xmm6, -80(%rbp)                              #
-        movdqa    %xmm7, -192(%rbp)                             #
-        movl      %eax, %r13d                                   #
-        jmp       ..B13.10      # Prob 100%                     #
-                                # LOE rbx ecx r12d r13d r14d xmm0
-..B13.8:                        # Preds ..B13.2
-        movdqa    %xmm8, -96(%rbp)                              #
-        movdqa    %xmm1, -112(%rbp)                             #
-        movdqa    %xmm2, -160(%rbp)                             #
-        movdqa    %xmm3, -176(%rbp)                             #
-        movdqa    %xmm4, -144(%rbp)                             #
-        movdqa    %xmm5, -128(%rbp)                             #
-        movdqa    %xmm6, -80(%rbp)                              #
-        movdqa    %xmm7, -192(%rbp)                             #
-        movl      %eax, %r13d                                   #
-                                # LOE rbx r12d r13d r14d xmm0
-..B13.9:                        # Preds ..B13.8 ..B13.28
-..LN1627:
-   .loc    1  2291
-        movdqa    %xmm0, %xmm1                                  #2291.22
-        pand      -144(%rbp), %xmm1                             #2291.22
-..LN1629:
-   .loc    1  2292
-        pcmpeqb   -128(%rbp), %xmm1                             #2292.22
-..LN1631:
-   .loc    1  2293
-        pmovmskb  %xmm1, %ecx                                   #2293.22
-                                # LOE rbx ecx r12d r13d r14d xmm0
-..B13.10:                       # Preds ..B13.7 ..B13.9
-..LN1633:
-   .loc    1  2297
-        movdqa    %xmm0, %xmm1                                  #2297.22
-        pand      -160(%rbp), %xmm1                             #2297.22
-..LN1635:
-   .loc    1  2298
-        pcmpeqb   -176(%rbp), %xmm1                             #2298.22
-..LN1637:
-   .loc    1  2299
-        pmovmskb  %xmm1, %r15d                                  #2299.22
-                                # LOE rbx ecx r12d r13d r14d r15d xmm0
-..B13.11:                       # Preds ..B13.6 ..B13.10
-..LN1639:
-   .loc    1  2303
-        pand      -96(%rbp), %xmm0                              #2303.22
-..LN1641:
-   .loc    1  2313
-        movl      %r14d, %esi                                   #2313.29
-..LN1643:
-   .loc    1  2304
-        pcmpeqb   -112(%rbp), %xmm0                             #2304.22
-..LN1645:
-   .loc    1  2305
-        pmovmskb  %xmm0, %edx                                   #2305.22
-..LN1647:
-   .loc    1  2310
-        andl      $-4, %r12d                                    #2310.17
-..LN1649:
-   .loc    1  2305
-        movl      %edx, -64(%rbp)                               #2305.22
-..LN1651:
-   .loc    1  2313
-        orl       %ecx, %esi                                    #2313.29
-..LN1653:
-        orl       %r15d, %esi                                   #2313.34
-..LN1655:
-        orl       %edx, %esi                                    #2313.39
-..LN1657:
-        je        ..B13.24      # Prob 78%                      #2313.47
-                                # LOE rbx ecx r12d r13d r14d r15d
-..B13.12:                       # Preds ..B13.11
-..LN1659:
-   .loc    1  2331
-        movl      %ecx, -208(%rbp)                              #2331.30
-        movl      %r14d, %edi                                   #2331.30
-        call      uint16_lsbit at PLT                              #2331.30
-                                # LOE rbx eax r12d r13d r14d r15d
-..B13.42:                       # Preds ..B13.12
-        movl      -208(%rbp), %ecx                              #
-                                # LOE rcx rbx eax ecx r12d r13d r14d r15d cl ch
-..B13.13:                       # Preds ..B13.42
-..LN1661:
-   .loc    1  2332
-        movl      %ecx, -208(%rbp)                              #2332.30
-..LN1663:
-   .loc    1  2331
-        movswq    %ax, %rdx                                     #2331.30
-        movl      %edx, -216(%rbp)                              #2331.30
-..LN1665:
-   .loc    1  2332
-        movl      %ecx, %edi                                    #2332.30
-        call      uint16_lsbit at PLT                              #2332.30
-                                # LOE rbx eax r12d r13d r14d r15d
-..B13.43:                       # Preds ..B13.13
-        movl      -208(%rbp), %ecx                              #
-                                # LOE rcx rbx eax ecx r12d r13d r14d r15d cl ch
-..B13.14:                       # Preds ..B13.43
-..LN1667:
-   .loc    1  2333
-        movl      %ecx, -208(%rbp)                              #2333.30
-..LN1669:
-   .loc    1  2332
-        movswq    %ax, %rdx                                     #2332.30
-        movl      %edx, -224(%rbp)                              #2332.30
-..LN1671:
-   .loc    1  2333
-        movl      %r15d, %edi                                   #2333.30
-        call      uint16_lsbit at PLT                              #2333.30
-                                # LOE rbx eax r12d r13d r14d r15d
-..B13.44:                       # Preds ..B13.14
-        movl      -208(%rbp), %ecx                              #
-                                # LOE rcx rbx eax ecx r12d r13d r14d r15d cl ch
-..B13.15:                       # Preds ..B13.44
-..LN1673:
-   .loc    1  2334
-        movl      -64(%rbp), %edi                               #2334.30
-        movl      %ecx, -208(%rbp)                              #2334.30
-..LN1675:
-   .loc    1  2333
-        movswq    %ax, %rdx                                     #2333.30
-..LN1677:
-   .loc    1  2334
-        movl      %edx, -200(%rbp)                              #2334.30
-        call      uint16_lsbit at PLT                              #2334.30
-                                # LOE rbx eax r12d r13d r14d r15d
-..B13.45:                       # Preds ..B13.15
-        movl      -208(%rbp), %ecx                              #
-        movl      -200(%rbp), %edx                              #
-                                # LOE rdx rcx rbx eax edx ecx r12d r13d r14d r15d dl cl dh ch
-..B13.16:                       # Preds ..B13.45
-..LN1679:
-   .loc    1  2339
-        movl      -216(%rbp), %esi                              #2339.34
-..LN1681:
-   .loc    1  2340
-        movl      -224(%rbp), %r8d                              #2340.34
-..LN1683:
-   .loc    1  2334
-        movswq    %ax, %rax                                     #2334.30
-..LN1685:
-   .loc    1  2339
-        shll      $2, %esi                                      #2339.34
-..LN1687:
-   .loc    1  2340
-        shll      $2, %r8d                                      #2340.34
-..LN1689:
-   .loc    1  2339
-        movl      %esi, -216(%rbp)                              #2339.34
-..LN1691:
-   .loc    1  2340
-        movl      %r8d, -224(%rbp)                              #2340.34
-..LN1693:
-   .loc    1  2341
-        shll      $2, %edx                                      #2341.34
-..LN1695:
-   .loc    1  2342
-        shll      $2, %eax                                      #2342.34
-..LN1697:
-   .loc    1  2346
-        testl     %r14d, %r14d                                  #2346.32
-        je        ..B13.18      # Prob 50%                      #2346.32
-                                # LOE rcx rbx rsi r8 eax edx ecx esi r8d r12d r13d r15d cl sil r8b ch
-..B13.17:                       # Preds ..B13.16
-..LN1699:
-        addl      %r12d, %esi                                   #2346.43
-..LN1701:
-        cmpl      %esi, %r13d                                   #2346.49
-        jae       ..B13.33      # Prob 20%                      #2346.49
-                                # LOE rcx rbx r8 eax edx ecx r8d r12d r13d r15d cl r8b ch
-..B13.18:                       # Preds ..B13.17 ..B13.16
-..LN1703:
-   .loc    1  2347
-        testl     %ecx, %ecx                                    #2347.32
-        je        ..B13.20      # Prob 50%                      #2347.32
-                                # LOE rbx r8 eax edx r8d r12d r13d r15d r8b
-..B13.19:                       # Preds ..B13.18
-..LN1705:
-        movl      %r8d, %ecx                                    #2347.43
-        lea       1(%r12,%rcx), %esi                            #2347.43
-..LN1707:
-        cmpl      %esi, %r13d                                   #2347.49
-        jae       ..B13.33      # Prob 20%                      #2347.49
-                                # LOE rbx eax edx r12d r13d r15d
-..B13.20:                       # Preds ..B13.19 ..B13.18
-..LN1709:
-   .loc    1  2348
-        testl     %r15d, %r15d                                  #2348.32
-        je        ..B13.22      # Prob 50%                      #2348.32
-                                # LOE rbx eax edx r12d r13d
-..B13.21:                       # Preds ..B13.20
-..LN1711:
-        lea       2(%r12,%rdx), %edx                            #2348.43
-..LN1713:
-        cmpl      %edx, %r13d                                   #2348.49
-        jae       ..B13.33      # Prob 20%                      #2348.49
-                                # LOE rbx eax r12d r13d
-..B13.22:                       # Preds ..B13.21 ..B13.20
-..LN1715:
-   .loc    1  2349
-        movl      -64(%rbp), %edx                               #2349.32
-        testl     %edx, %edx                                    #2349.32
-        je        ..B13.24      # Prob 50%                      #2349.32
-                                # LOE rbx eax r12d r13d
-..B13.23:                       # Preds ..B13.22
-..LN1717:
-        lea       3(%r12,%rax), %edx                            #2349.43
-..LN1719:
-        cmpl      %edx, %r13d                                   #2349.49
-        jae       ..B13.33      # Prob 20%                      #2349.49
-                                # LOE rbx r12d r13d
-..B13.24:                       # Preds ..B13.23 ..B13.22 ..B13.11
-..LN1721:
-   .loc    1  2386
-        lea       4(%r12), %edx                                 #2386.13
-..LN1723:
-   .loc    1  2357
-        cmpl      %edx, %r13d                                   #2357.28
-        jb        ..B13.30      # Prob 20%                      #2357.28
-                                # LOE rbx r12d r13d
-..B13.25:                       # Preds ..B13.24
-..LN1725:
-   .loc    1  2382
-        cmpq      -16(%rbp), %rbx                               #2382.25
-        jae       ..B13.30      # Prob 4%                       #2382.25
-                                # LOE rbx r12d r13d
-..B13.26:                       # Preds ..B13.25
-..LN1727:
-   .loc    1  2386
-        addl      $64, %r12d                                    #2386.13
-..LN1729:
-   .loc    1  2387
-        cmpl      %r13d, %r12d                                  #2387.24
-        ja        ..B13.30      # Prob 4%                       #2387.24
-                                # LOE rbx r12d r13d
-..B13.27:                       # Preds ..B13.26
-..LN1731:
-   .loc    1  2392
-        movq      -16(%rbp), %rsi                               #2392.22
-        movq      %rbx, %rdi                                    #2392.22
-        call      prime_buffer_2na at PLT                          #2392.22
-                                # LOE rbx r12d r13d xmm0
-..B13.46:                       # Preds ..B13.27
-..LN1733:
-   .loc    1  2470
-        addq      $16, %rbx                                     #2470.13
-                                # LOE rbx r12d r13d xmm0
-..B13.28:                       # Preds ..B13.5 ..B13.46
-..LN1735:
-   .loc    1  2285
-        movdqa    %xmm0, %xmm1                                  #2285.22
-        pand      -80(%rbp), %xmm1                              #2285.22
-..LN1737:
-   .loc    1  2286
-        pcmpeqb   -192(%rbp), %xmm1                             #2286.22
-..LN1739:
-   .loc    1  2287
-        pmovmskb  %xmm1, %r14d                                  #2287.22
-        jmp       ..B13.9       # Prob 100%                     #2287.22
-                                # LOE rbx r12d r13d r14d xmm0
-..B13.30:                       # Preds ..B13.24 ..B13.25 ..B13.26 # Infreq
-..LN1741:
-   .loc    1  2483
-        movq      -56(%rbp), %rbx                               #2483.12
-..___tag_value_eval_2na_8.525:                                  #
-        movq      -24(%rbp), %r12                               #2483.12
-..___tag_value_eval_2na_8.526:                                  #
-        movq      -32(%rbp), %r13                               #2483.12
-..___tag_value_eval_2na_8.527:                                  #
-        movq      -40(%rbp), %r14                               #2483.12
-..___tag_value_eval_2na_8.528:                                  #
-        xorl      %eax, %eax                                    #2483.12
-        movq      -48(%rbp), %r15                               #2483.12
-..___tag_value_eval_2na_8.529:                                  #
-        movq      %rbp, %rsp                                    #2483.12
-        popq      %rbp                                          #2483.12
-..___tag_value_eval_2na_8.530:                                  #
-        ret                                                     #2483.12
-..___tag_value_eval_2na_8.531:                                  #
-                                # LOE
-..B13.33:                       # Preds ..B13.23 ..B13.21 ..B13.19 ..B13.17 # Infreq
-..LN1743:
-   .loc    1  2346
-        movq      -56(%rbp), %rbx                               #2346.63
-..___tag_value_eval_2na_8.537:                                  #
-        movq      -24(%rbp), %r12                               #2346.63
-..___tag_value_eval_2na_8.538:                                  #
-        movq      -32(%rbp), %r13                               #2346.63
-..___tag_value_eval_2na_8.539:                                  #
-        movq      -40(%rbp), %r14                               #2346.63
-..___tag_value_eval_2na_8.540:                                  #
-        movl      $1, %eax                                      #2346.63
-        movq      -48(%rbp), %r15                               #2346.63
-..___tag_value_eval_2na_8.541:                                  #
-        movq      %rbp, %rsp                                    #2346.63
-        popq      %rbp                                          #2346.63
-..___tag_value_eval_2na_8.542:                                  #
-        ret                                                     #2346.63
-        .align    16,0x90
-..___tag_value_eval_2na_8.543:                                  #
-                                # LOE
-# mark_end;
-	.type	eval_2na_8, at function
-	.size	eval_2na_8,.-eval_2na_8
-.LNeval_2na_8:
-	.data
-# -- End  eval_2na_8
-	.text
-# -- Begin  eval_4na_64
-# mark_begin;
-       .align    16,0x90
-eval_4na_64:
-# parameter 1(self): %rdi
-# parameter 2(ncbi2na): %rsi
-# parameter 3(pos): %edx
-# parameter 4(len): %ecx
-..B14.1:                        # Preds ..B14.0
-..___tag_value_eval_4na_64.544:                                 #4501.1
-..LN1745:
-   .loc    1  4501
-        pushq     %rbp                                          #4501.1
-        movq      %rsp, %rbp                                    #4501.1
-..___tag_value_eval_4na_64.545:                                 #
-        subq      $256, %rsp                                    #4501.1
-        movq      %r15, -184(%rbp)                              #4501.1
-..___tag_value_eval_4na_64.547:                                 #
-        movq      %r14, -24(%rbp)                               #4501.1
-..___tag_value_eval_4na_64.548:                                 #
-        movq      %r13, -32(%rbp)                               #4501.1
-..___tag_value_eval_4na_64.549:                                 #
-        movq      %r12, -48(%rbp)                               #4501.1
-..___tag_value_eval_4na_64.550:                                 #
-        movq      %rbx, -40(%rbp)                               #4501.1
-..___tag_value_eval_4na_64.551:                                 #
-        movl      %ecx, %ebx                                    #4501.1
-        movl      %edx, %r12d                                   #4501.1
-        movq      %rsi, %r15                                    #4501.1
-        movq      %rdi, %r13                                    #4501.1
-        lea       _gprof_pack13(%rip), %rdx                     #4501.1
-        call      mcount at PLT                                    #4501.1
-                                # LOE r13 r15 ebx r12d
-..B14.45:                       # Preds ..B14.1
-..LN1747:
-   .loc    1  4535
-        lea       (%r12,%rbx), %ecx                             #4535.5
-..LN1749:
-   .loc    1  4541
-        subl      4(%r13), %ecx                                 #4541.12
-..LN1751:
-   .loc    1  4547
-        movl      %ecx, -8(%rbp)                                #4547.14
-..LN1753:
-   .loc    1  4538
-        movl      %r12d, %r14d                                  #4538.49
-        shrl      $2, %r14d                                     #4538.49
-..LN1755:
-        lea       (%r15,%r14), %rdi                             #4538.30
-..LN1757:
-   .loc    1  4544
-        lea       3(%r12,%rbx), %esi                            #4544.50
-..LN1759:
-        shrl      $2, %esi                                      #4544.57
-..LN1761:
-        addq      %r15, %rsi                                    #4544.30
-        movq      %rsi, -16(%rbp)                               #4544.30
-..LN1763:
-   .loc    1  4547
-        call      prime_buffer_4na at PLT                          #4547.14
-                                # LOE r13 r14 r15 r12d xmm0
-..B14.46:                       # Preds ..B14.45
-        movl      -8(%rbp), %ecx                                #
-..LN1765:
-   .loc    1  4554
-        movdqa    16(%r13), %xmm7                               #4554.5
-        movdqa    32(%r13), %xmm6                               #4554.5
-        movdqa    48(%r13), %xmm5                               #4554.5
-        movdqa    64(%r13), %xmm4                               #4554.5
-        movdqa    80(%r13), %xmm3                               #4554.5
-        movdqa    96(%r13), %xmm2                               #4554.5
-        movdqa    112(%r13), %xmm1                              #4554.5
-        movdqa    128(%r13), %xmm8                              #4554.5
-..LN1767:
-   .loc    1  4548
-        lea       8(%r15,%r14), %rbx                            #4548.5
-        movq      %rbx, %rdx                                    #4548.5
-..LN1769:
-   .loc    1  4557
-        xorl      %r15d, %r15d                                  #4557.15
-..LN1771:
-        xorl      %r14d, %r14d                                  #4557.10
-..LN1773:
-        xorl      %r13d, %r13d                                  #4557.5
-..LN1775:
-   .loc    1  4563
-        movl      $4, %esi                                      #4563.5
-..LN1777:
-   .loc    1  4568
-        movl      %r12d, %edi                                   #4568.20
-        andl      $3, %edi                                      #4568.20
-        je        ..B14.37      # Prob 20%                      #4568.20
-                                # LOE rdx rcx rbx ecx esi edi r12d r13d r14d r15d cl ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B14.2:                        # Preds ..B14.46
-        cmpl      $1, %edi                                      #4568.20
-        je        ..B14.8       # Prob 25%                      #4568.20
-                                # LOE rdx rcx rbx ecx esi edi r12d r13d r14d r15d cl ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B14.3:                        # Preds ..B14.2
-        cmpl      $2, %edi                                      #4568.20
-        je        ..B14.7       # Prob 33%                      #4568.20
-                                # LOE rdx rcx rbx ecx esi edi r12d r13d r14d r15d cl ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B14.4:                        # Preds ..B14.3
-        cmpl      $3, %edi                                      #4568.20
-        je        ..B14.6       # Prob 50%                      #4568.20
-                                # LOE rdx rcx rbx ecx esi r12d r13d r14d r15d cl ch xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B14.5:                        # Preds ..B14.4
-        movdqa    %xmm8, -80(%rbp)                              #
-        movdqa    %xmm1, -112(%rbp)                             #
-        movdqa    %xmm2, -96(%rbp)                              #
-        movdqa    %xmm3, -64(%rbp)                              #
-        movdqa    %xmm4, -176(%rbp)                             #
-        movdqa    %xmm5, -160(%rbp)                             #
-        movdqa    %xmm6, -144(%rbp)                             #
-        movdqa    %xmm7, -128(%rbp)                             #
-        movl      %r12d, %eax                                   #
-        movl      %ecx, -8(%rbp)                                #
-        jmp       ..B14.29      # Prob 100%                     #
-                                # LOE rdx rbx eax xmm0
-..B14.6:                        # Preds ..B14.4
-        movdqa    %xmm8, -80(%rbp)                              #
-        movdqa    %xmm1, -112(%rbp)                             #
-        movdqa    %xmm2, -96(%rbp)                              #
-        movdqa    %xmm3, -64(%rbp)                              #
-        movdqa    %xmm4, -176(%rbp)                             #
-        movdqa    %xmm5, -160(%rbp)                             #
-        movdqa    %xmm6, -144(%rbp)                             #
-        movdqa    %xmm7, -128(%rbp)                             #
-        movl      %r12d, %eax                                   #
-        movl      %ecx, -8(%rbp)                                #
-        jmp       ..B14.11      # Prob 100%                     #
-                                # LOE rdx rbx eax esi r13d r14d r15d xmm0
-..B14.7:                        # Preds ..B14.3
-        movdqa    %xmm8, -80(%rbp)                              #
-        movdqa    %xmm1, -112(%rbp)                             #
-        movdqa    %xmm2, -96(%rbp)                              #
-        movdqa    %xmm3, -64(%rbp)                              #
-        movdqa    %xmm4, -176(%rbp)                             #
-        movdqa    %xmm5, -160(%rbp)                             #
-        movdqa    %xmm6, -144(%rbp)                             #
-        movdqa    %xmm7, -128(%rbp)                             #
-        movl      %r12d, %eax                                   #
-        movl      %ecx, -8(%rbp)                                #
-        jmp       ..B14.10      # Prob 100%                     #
-                                # LOE rdx rbx eax esi r13d r14d xmm0
-..B14.8:                        # Preds ..B14.2
-        movdqa    %xmm8, -80(%rbp)                              #
-        movdqa    %xmm1, -112(%rbp)                             #
-        movdqa    %xmm2, -96(%rbp)                              #
-        movdqa    %xmm3, -64(%rbp)                              #
-        movdqa    %xmm4, -176(%rbp)                             #
-        movdqa    %xmm5, -160(%rbp)                             #
-        movdqa    %xmm6, -144(%rbp)                             #
-        movdqa    %xmm7, -128(%rbp)                             #
-        movl      %r12d, %eax                                   #
-        movl      %ecx, -8(%rbp)                                #
-                                # LOE rdx rbx eax esi r13d xmm0
-..B14.9:                        # Preds ..B14.8 ..B14.33
-..LN1779:
-   .loc    1  4592
-        movdqa    %xmm0, %xmm2                                  #4592.22
-..LN1781:
-   .loc    1  4593
-        movdqa    %xmm0, %xmm1                                  #4593.22
-..LN1783:
-   .loc    1  4592
-        pand      -160(%rbp), %xmm2                             #4592.22
-..LN1785:
-   .loc    1  4593
-        pand      -176(%rbp), %xmm1                             #4593.22
-..LN1787:
-   .loc    1  4594
-        pcmpeqd   %xmm1, %xmm2                                  #4594.22
-..LN1789:
-   .loc    1  4595
-        pmovmskb  %xmm2, %r14d                                  #4595.22
-..LN1791:
-   .loc    1  4596
-        movl      %r14d, %ecx                                   #4596.17
-        andl      $3855, %ecx                                   #4596.17
-        shll      $4, %ecx                                      #4596.17
-        andl      %ecx, %r14d                                   #4596.17
-        movl      %r14d, %edi                                   #4596.17
-        shrl      $4, %edi                                      #4596.17
-        orl       %edi, %r14d                                   #4596.17
-                                # LOE rdx rbx eax esi r13d r14d xmm0
-..B14.10:                       # Preds ..B14.7 ..B14.9
-..LN1793:
-   .loc    1  4599
-        movdqa    %xmm0, %xmm2                                  #4599.22
-..LN1795:
-   .loc    1  4600
-        movdqa    %xmm0, %xmm1                                  #4600.22
-..LN1797:
-   .loc    1  4599
-        pand      -64(%rbp), %xmm2                              #4599.22
-..LN1799:
-   .loc    1  4600
-        pand      -96(%rbp), %xmm1                              #4600.22
-..LN1801:
-   .loc    1  4601
-        pcmpeqd   %xmm1, %xmm2                                  #4601.22
-..LN1803:
-   .loc    1  4602
-        pmovmskb  %xmm2, %r15d                                  #4602.22
-..LN1805:
-   .loc    1  4603
-        movl      %r15d, %ecx                                   #4603.17
-        andl      $3855, %ecx                                   #4603.17
-        shll      $4, %ecx                                      #4603.17
-        andl      %ecx, %r15d                                   #4603.17
-        movl      %r15d, %edi                                   #4603.17
-        shrl      $4, %edi                                      #4603.17
-        orl       %edi, %r15d                                   #4603.17
-                                # LOE rdx rbx eax esi r13d r14d r15d xmm0
-..B14.11:                       # Preds ..B14.6 ..B14.10
-..LN1807:
-   .loc    1  4606
-        movdqa    %xmm0, %xmm2                                  #4606.22
-..LN1809:
-   .loc    1  4607
-        movdqa    %xmm0, %xmm1                                  #4607.22
-..LN1811:
-   .loc    1  4606
-        pand      -112(%rbp), %xmm2                             #4606.22
-..LN1813:
-   .loc    1  4607
-        pand      -80(%rbp), %xmm1                              #4607.22
-..LN1815:
-   .loc    1  4608
-        pcmpeqd   %xmm1, %xmm2                                  #4608.22
-..LN1817:
-   .loc    1  4609
-        pmovmskb  %xmm2, %r12d                                  #4609.22
-..LN1819:
-   .loc    1  4610
-        movl      %r12d, %ecx                                   #4610.17
-        andl      $3855, %ecx                                   #4610.17
-        shll      $4, %ecx                                      #4610.17
-        andl      %ecx, %r12d                                   #4610.17
-        movl      %r12d, %edi                                   #4610.17
-        shrl      $4, %edi                                      #4610.17
-        orl       %edi, %r12d                                   #4610.17
-..LN1821:
-   .loc    1  4614
-        movl      %eax, %ecx                                    #4614.17
-        andl      $-4, %ecx                                     #4614.17
-..LN1823:
-   .loc    1  4617
-        movl      %r13d, %eax                                   #4617.29
-        orl       %r14d, %eax                                   #4617.29
-..LN1825:
-        orl       %r15d, %eax                                   #4617.34
-..LN1827:
-        orl       %r12d, %eax                                   #4617.39
-..LN1829:
-        je        ..B14.24      # Prob 78%                      #4617.47
-                                # LOE rdx rbx ecx esi r12d r13d r14d r15d xmm0
-..B14.12:                       # Preds ..B14.11
-..LN1831:
-   .loc    1  4635
-        movdqa    %xmm0, -256(%rbp)                             #4635.30
-        movl      %r13d, %edi                                   #4635.30
-        movl      %esi, -216(%rbp)                              #4635.30
-        movl      %ecx, -208(%rbp)                              #4635.30
-        movq      %rdx, -200(%rbp)                              #4635.30
-        call      uint16_lsbit at PLT                              #4635.30
-                                # LOE rbx eax r12d r13d r14d r15d
-..B14.47:                       # Preds ..B14.12
-        movq      -200(%rbp), %rdx                              #
-        movdqa    -256(%rbp), %xmm0                             #
-        movl      -208(%rbp), %ecx                              #
-        movl      -216(%rbp), %esi                              #
-                                # LOE rdx rcx rbx rsi eax ecx esi r12d r13d r14d r15d cl sil ch xmm0
-..B14.13:                       # Preds ..B14.47
-..LN1833:
-   .loc    1  4636
-        movdqa    %xmm0, -256(%rbp)                             #4636.30
-        movl      %r14d, %edi                                   #4636.30
-        movl      %esi, -216(%rbp)                              #4636.30
-..LN1835:
-   .loc    1  4635
-        movswq    %ax, %rax                                     #4635.30
-        movl      %eax, -240(%rbp)                              #4635.30
-..LN1837:
-   .loc    1  4636
-        movl      %ecx, -208(%rbp)                              #4636.30
-        movq      %rdx, -200(%rbp)                              #4636.30
-        call      uint16_lsbit at PLT                              #4636.30
-                                # LOE rbx eax r12d r13d r14d r15d
-..B14.48:                       # Preds ..B14.13
-        movq      -200(%rbp), %rdx                              #
-        movdqa    -256(%rbp), %xmm0                             #
-        movl      -208(%rbp), %ecx                              #
-        movl      -216(%rbp), %esi                              #
-                                # LOE rdx rcx rbx rsi eax ecx esi r12d r13d r14d r15d cl sil ch xmm0
-..B14.14:                       # Preds ..B14.48
-..LN1839:
-   .loc    1  4637
-        movdqa    %xmm0, -256(%rbp)                             #4637.30
-        movl      %r15d, %edi                                   #4637.30
-        movl      %esi, -216(%rbp)                              #4637.30
-..LN1841:
-   .loc    1  4636
-        movswq    %ax, %rax                                     #4636.30
-        movl      %eax, -232(%rbp)                              #4636.30
-..LN1843:
-   .loc    1  4637
-        movl      %ecx, -208(%rbp)                              #4637.30
-        movq      %rdx, -200(%rbp)                              #4637.30
-        call      uint16_lsbit at PLT                              #4637.30
-                                # LOE rbx eax r12d r13d r14d r15d
-..B14.49:                       # Preds ..B14.14
-        movq      -200(%rbp), %rdx                              #
-        movdqa    -256(%rbp), %xmm0                             #
-        movl      -208(%rbp), %ecx                              #
-        movl      -216(%rbp), %esi                              #
-                                # LOE rdx rcx rbx rsi eax ecx esi r12d r13d r14d r15d cl sil ch xmm0
-..B14.15:                       # Preds ..B14.49
-..LN1845:
-   .loc    1  4638
-        movdqa    %xmm0, -256(%rbp)                             #4638.30
-        movl      %r12d, %edi                                   #4638.30
-        movl      %esi, -216(%rbp)                              #4638.30
-..LN1847:
-   .loc    1  4637
-        movswq    %ax, %rax                                     #4637.30
-        movl      %eax, -224(%rbp)                              #4637.30
-..LN1849:
-   .loc    1  4638
-        movl      %ecx, -208(%rbp)                              #4638.30
-        movq      %rdx, -200(%rbp)                              #4638.30
-        call      uint16_lsbit at PLT                              #4638.30
-                                # LOE rbx eax r12d r13d r14d r15d
-..B14.50:                       # Preds ..B14.15
-        movq      -200(%rbp), %rdx                              #
-        movdqa    -256(%rbp), %xmm0                             #
-        movl      -208(%rbp), %ecx                              #
-        movl      -216(%rbp), %esi                              #
-                                # LOE rdx rcx rbx rsi eax ecx esi r12d r13d r14d r15d cl sil ch xmm0
-..B14.16:                       # Preds ..B14.50
-..LN1851:
-   .loc    1  4645
-        movl      -224(%rbp), %r8d                              #4645.40
-..LN1853:
-   .loc    1  4638
-        movswq    %ax, %rdi                                     #4638.30
-..LN1855:
-   .loc    1  4644
-        movl      -232(%rbp), %eax                              #4644.40
-..LN1857:
-   .loc    1  4638
-..LN1859:
-   .loc    1  4644
-        lea       1(%rax,%rax), %eax                            #4644.40
-..LN1861:
-   .loc    1  4645
-        lea       2(%r8,%r8), %r9d                              #4645.40
-..LN1863:
-   .loc    1  4646
-        lea       3(%rdi,%rdi), %r10d                           #4646.40
-..LN1865:
-   .loc    1  4650
-        testl     %r13d, %r13d                                  #4650.32
-        je        ..B14.18      # Prob 50%                      #4650.32
-                                # LOE rdx rcx rbx rsi eax ecx esi r9d r10d r12d r14d r15d cl sil ch xmm0
-..B14.17:                       # Preds ..B14.16
-..LN1867:
-        movl      -240(%rbp), %edi                              #4650.43
-        lea       (%rcx,%rdi,2), %r8d                           #4650.43
-..LN1869:
-        cmpl      -8(%rbp), %r8d                                #4650.49
-        jbe       ..B14.38      # Prob 20%                      #4650.49
-                                # LOE rdx rcx rbx rsi eax ecx esi r9d r10d r12d r14d r15d cl sil ch xmm0
-..B14.18:                       # Preds ..B14.17 ..B14.16
-..LN1871:
-   .loc    1  4651
-        testl     %r14d, %r14d                                  #4651.32
-        je        ..B14.20      # Prob 50%                      #4651.32
-                                # LOE rdx rcx rbx rsi eax ecx esi r9d r10d r12d r15d cl sil ch xmm0
-..B14.19:                       # Preds ..B14.18
-..LN1873:
-        addl      %ecx, %eax                                    #4651.43
-..LN1875:
-        cmpl      -8(%rbp), %eax                                #4651.49
-        jbe       ..B14.38      # Prob 20%                      #4651.49
-                                # LOE rdx rcx rbx rsi ecx esi r9d r10d r12d r15d cl sil ch xmm0
-..B14.20:                       # Preds ..B14.19 ..B14.18
-..LN1877:
-   .loc    1  4652
-        testl     %r15d, %r15d                                  #4652.32
-        je        ..B14.22      # Prob 50%                      #4652.32
-                                # LOE rdx rcx rbx rsi ecx esi r9d r10d r12d cl sil ch xmm0
-..B14.21:                       # Preds ..B14.20
-..LN1879:
-        addl      %ecx, %r9d                                    #4652.43
-..LN1881:
-        cmpl      -8(%rbp), %r9d                                #4652.49
-        jbe       ..B14.38      # Prob 20%                      #4652.49
-                                # LOE rdx rcx rbx rsi ecx esi r10d r12d cl sil ch xmm0
-..B14.22:                       # Preds ..B14.21 ..B14.20
-..LN1883:
-   .loc    1  4653
-        testl     %r12d, %r12d                                  #4653.32
-        je        ..B14.24      # Prob 50%                      #4653.32
-                                # LOE rdx rcx rbx rsi ecx esi r10d cl sil ch xmm0
-..B14.23:                       # Preds ..B14.22
-..LN1885:
-        addl      %ecx, %r10d                                   #4653.43
-..LN1887:
-        cmpl      -8(%rbp), %r10d                               #4653.49
-        jbe       ..B14.38      # Prob 20%                      #4653.49
-                                # LOE rdx rbx ecx esi xmm0
-..B14.24:                       # Preds ..B14.23 ..B14.22 ..B14.11
-..LN1889:
-   .loc    1  4658
-        lea       4(%rcx), %eax                                 #4658.17
-..LN1891:
-   .loc    1  4661
-        cmpl      -8(%rbp), %eax                                #4661.28
-        ja        ..B14.35      # Prob 20%                      #4661.28
-                                # LOE rdx rbx eax ecx esi xmm0
-..B14.25:                       # Preds ..B14.24
-..LN1893:
-   .loc    1  4665
-        decl      %esi                                          #4665.25
-..LN1895:
-        jne       ..B14.30      # Prob 50%                      #4665.39
-                                # LOE rdx rbx eax ecx esi xmm0
-..B14.26:                       # Preds ..B14.25
-..LN1897:
-   .loc    1  4682
-        cmpq      -16(%rbp), %rbx                               #4682.25
-        jae       ..B14.35      # Prob 4%                       #4682.25
-                                # LOE rbx ecx
-..B14.27:                       # Preds ..B14.26
-..LN1899:
-   .loc    1  4686
-        lea       20(%rcx), %eax                                #4686.13
-..LN1901:
-   .loc    1  4687
-        cmpl      -8(%rbp), %eax                                #4687.24
-        ja        ..B14.35      # Prob 4%                       #4687.24
-                                # LOE rbx eax
-..B14.28:                       # Preds ..B14.27
-..LN1903:
-   .loc    1  4692
-        movq      -16(%rbp), %rsi                               #4692.22
-        movl      %eax, -192(%rbp)                              #4692.22
-        movq      %rbx, %rdi                                    #4692.22
-        call      prime_buffer_4na at PLT                          #4692.22
-                                # LOE rbx xmm0
-..B14.51:                       # Preds ..B14.28
-        movl      -192(%rbp), %eax                              #
-..LN1905:
-   .loc    1  4707
-        addq      $8, %rbx                                      #4707.13
-        movq      %rbx, %rdx                                    #4707.13
-                                # LOE rdx rbx eax xmm0
-..B14.29:                       # Preds ..B14.5 ..B14.51
-..LN1907:
-   .loc    1  4575
-        movl      $4, %esi                                      #4575.13
-        jmp       ..B14.33      # Prob 100%                     #4575.13
-                                # LOE rdx rbx eax esi xmm0
-..B14.30:                       # Preds ..B14.25
-..LN1909:
-   .loc    1  4673
-        cmpq      -16(%rbp), %rdx                               #4673.26
-..LN1911:
-   .loc    1  4670
-        psrldq    $2, %xmm0                                     #4670.26
-..LN1913:
-   .loc    1  4673
-        jae       ..B14.32      # Prob 19%                      #4673.26
-                                # LOE rdx rbx eax esi xmm0
-..B14.31:                       # Preds ..B14.30
-..LN1915:
-   .loc    1  4674
-        movzbl    (%rdx), %edi                                  #4674.72
-..LN1917:
-        lea       expand_2na.0(%rip), %rcx                      #4674.57
-        movzwl    (%rcx,%rdi,2), %r8d                           #4674.57
-..LN1919:
-        pinsrw    $7, %r8d, %xmm0                               #4674.30
-                                # LOE rdx rbx eax esi xmm0
-..B14.32:                       # Preds ..B14.31 ..B14.30
-..LN1921:
-   .loc    1  4677
-        incq      %rdx                                          #4677.20
-                                # LOE rdx rbx eax esi xmm0
-..B14.33:                       # Preds ..B14.29 ..B14.32 ..B14.37
-..LN1923:
-   .loc    1  4585
-        movdqa    %xmm0, %xmm2                                  #4585.22
-..LN1925:
-   .loc    1  4586
-        movdqa    %xmm0, %xmm1                                  #4586.22
-..LN1927:
-   .loc    1  4585
-        pand      -128(%rbp), %xmm2                             #4585.22
-..LN1929:
-   .loc    1  4586
-        pand      -144(%rbp), %xmm1                             #4586.22
-..LN1931:
-   .loc    1  4587
-        pcmpeqd   %xmm1, %xmm2                                  #4587.22
-..LN1933:
-   .loc    1  4588
-        pmovmskb  %xmm2, %r13d                                  #4588.22
-..LN1935:
-   .loc    1  4589
-        movl      %r13d, %ecx                                   #4589.17
-        andl      $3855, %ecx                                   #4589.17
-        shll      $4, %ecx                                      #4589.17
-        andl      %ecx, %r13d                                   #4589.17
-        movl      %r13d, %edi                                   #4589.17
-        shrl      $4, %edi                                      #4589.17
-        orl       %edi, %r13d                                   #4589.17
-        jmp       ..B14.9       # Prob 100%                     #4589.17
-                                # LOE rdx rbx eax esi r13d xmm0
-..B14.35:                       # Preds ..B14.24 ..B14.26 ..B14.27 # Infreq
-..LN1937:
-   .loc    1  4718
-        movq      -40(%rbp), %rbx                               #4718.12
-..___tag_value_eval_4na_64.552:                                 #
-        movq      -48(%rbp), %r12                               #4718.12
-..___tag_value_eval_4na_64.553:                                 #
-        movq      -32(%rbp), %r13                               #4718.12
-..___tag_value_eval_4na_64.554:                                 #
-        movq      -24(%rbp), %r14                               #4718.12
-..___tag_value_eval_4na_64.555:                                 #
-        xorl      %eax, %eax                                    #4718.12
-        movq      -184(%rbp), %r15                              #4718.12
-..___tag_value_eval_4na_64.556:                                 #
-        movq      %rbp, %rsp                                    #4718.12
-        popq      %rbp                                          #4718.12
-..___tag_value_eval_4na_64.557:                                 #
-        ret                                                     #4718.12
-..___tag_value_eval_4na_64.558:                                 #
-                                # LOE
-..B14.37:                       # Preds ..B14.46                # Infreq
-        movdqa    %xmm8, -80(%rbp)                              #
-        movdqa    %xmm1, -112(%rbp)                             #
-        movdqa    %xmm2, -96(%rbp)                              #
-        movdqa    %xmm3, -64(%rbp)                              #
-        movdqa    %xmm4, -176(%rbp)                             #
-        movdqa    %xmm5, -160(%rbp)                             #
-        movdqa    %xmm6, -144(%rbp)                             #
-        movdqa    %xmm7, -128(%rbp)                             #
-        movl      %r12d, %eax                                   #
-        movl      %ecx, -8(%rbp)                                #
-        jmp       ..B14.33      # Prob 100%                     #
-                                # LOE rdx rbx eax esi xmm0
-..B14.38:                       # Preds ..B14.17 ..B14.23 ..B14.21 ..B14.19 # Infreq
-..LN1939:
-   .loc    1  4651
-        movq      -40(%rbp), %rbx                               #4651.63
-..___tag_value_eval_4na_64.564:                                 #
-        movq      -48(%rbp), %r12                               #4651.63
-..___tag_value_eval_4na_64.565:                                 #
-        movq      -32(%rbp), %r13                               #4651.63
-..___tag_value_eval_4na_64.566:                                 #
-        movq      -24(%rbp), %r14                               #4651.63
-..___tag_value_eval_4na_64.567:                                 #
-        movl      $1, %eax                                      #4651.63
-        movq      -184(%rbp), %r15                              #4651.63
-..___tag_value_eval_4na_64.568:                                 #
-        movq      %rbp, %rsp                                    #4651.63
-        popq      %rbp                                          #4651.63
-..___tag_value_eval_4na_64.569:                                 #
-        ret                                                     #4651.63
-        .align    16,0x90
-..___tag_value_eval_4na_64.570:                                 #
-                                # LOE
-# mark_end;
-	.type	eval_4na_64, at function
-	.size	eval_4na_64,.-eval_4na_64
-.LNeval_4na_64:
-	.data
-# -- End  eval_4na_64
-	.text
-# -- Begin  eval_2na_64
-# mark_begin;
-       .align    16,0x90
-eval_2na_64:
-# parameter 1(self): %rdi
-# parameter 2(ncbi2na): %rsi
-# parameter 3(pos): %edx
-# parameter 4(len): %ecx
-..B15.1:                        # Preds ..B15.0
-..___tag_value_eval_2na_64.571:                                 #3075.1
-..LN1941:
-   .loc    1  3075
-        pushq     %rbp                                          #3075.1
-        movq      %rsp, %rbp                                    #3075.1
-..___tag_value_eval_2na_64.572:                                 #
-        subq      $272, %rsp                                    #3075.1
-        movq      %r15, -56(%rbp)                               #3075.1
-..___tag_value_eval_2na_64.574:                                 #
-        movq      %r14, -48(%rbp)                               #3075.1
-..___tag_value_eval_2na_64.575:                                 #
-        movq      %r13, -24(%rbp)                               #3075.1
-..___tag_value_eval_2na_64.576:                                 #
-        movq      %r12, -40(%rbp)                               #3075.1
-..___tag_value_eval_2na_64.577:                                 #
-        movq      %rbx, -32(%rbp)                               #3075.1
-..___tag_value_eval_2na_64.578:                                 #
-        movl      %ecx, %r13d                                   #3075.1
-        movl      %edx, %ebx                                    #3075.1
-        movq      %rsi, %r14                                    #3075.1
-        movq      %rdi, %r12                                    #3075.1
-        lea       _gprof_pack14(%rip), %rdx                     #3075.1
-        call      mcount at PLT                                    #3075.1
-                                # LOE r12 r14 ebx r13d
-..B15.48:                       # Preds ..B15.1
-..LN1943:
-   .loc    1  3113
-        lea       (%rbx,%r13), %r8d                             #3113.5
-..LN1945:
-   .loc    1  3119
-        subl      4(%r12), %r8d                                 #3119.12
-..LN1947:
-   .loc    1  3125
-        movl      %r8d, -16(%rbp)                               #3125.14
-..LN1949:
-   .loc    1  3116
-        movl      %ebx, %r15d                                   #3116.49
-        shrl      $2, %r15d                                     #3116.49
-..LN1951:
-        lea       (%r14,%r15), %rdi                             #3116.30
-..LN1953:
-   .loc    1  3122
-        lea       3(%rbx,%r13), %r13d                           #3122.50
-..LN1955:
-        shrl      $2, %r13d                                     #3122.57
-..LN1957:
-        addq      %r14, %r13                                    #3122.30
-..LN1959:
-   .loc    1  3125
-        movq      %r13, %rsi                                    #3125.14
-        call      prime_buffer_2na at PLT                          #3125.14
-                                # LOE r12 r13 r14 r15 ebx xmm0
-..B15.49:                       # Preds ..B15.48
-        movl      -16(%rbp), %r8d                               #
-..LN1961:
-   .loc    1  3126
-        lea       16(%r14,%r15), %r14                           #3126.5
-        movq      %r14, %rcx                                    #3126.5
-..LN1963:
-   .loc    1  3131
-        cmpq      %r13, %r14                                    #3131.16
-..LN1965:
-   .loc    1  3136
-..LN1967:
-   .loc    1  3131
-        jae       ..B15.3       # Prob 12%                      #3131.16
-                                # LOE rcx r8 r12 r13 r14 ebx r8d r15d r8b xmm0
-..B15.2:                        # Preds ..B15.49
-..LN1969:
-   .loc    1  3132
-        movzbl    -1(%r14), %r15d                               #3132.24
-..LN1971:
-        shll      $8, %r15d                                     #3132.38
-                                # LOE rcx r8 r12 r13 r14 ebx r8d r15d r8b xmm0
-..B15.3:                        # Preds ..B15.2 ..B15.49
-..LN1973:
-   .loc    1  3136
-        movdqa    16(%r12), %xmm7                               #3136.5
-        movdqa    32(%r12), %xmm6                               #3136.5
-        movdqa    48(%r12), %xmm5                               #3136.5
-        movdqa    64(%r12), %xmm4                               #3136.5
-        movdqa    80(%r12), %xmm3                               #3136.5
-        movdqa    96(%r12), %xmm2                               #3136.5
-        movdqa    112(%r12), %xmm1                              #3136.5
-        movdqa    128(%r12), %xmm8                              #3136.5
-..LN1975:
-   .loc    1  3139
-        xorl      %esi, %esi                                    #3139.15
-..LN1977:
-        xorl      %eax, %eax                                    #3139.10
-..LN1979:
-        xorl      %r12d, %r12d                                  #3139.5
-..LN1981:
-   .loc    1  3143
-        movl      $8, %edx                                      #3143.5
-..LN1983:
-   .loc    1  3148
-        movl      %ebx, %edi                                    #3148.20
-        andl      $3, %edi                                      #3148.20
-        je        ..B15.40      # Prob 20%                      #3148.20
-                                # LOE rcx r8 r13 r14 eax edx ebx esi edi r8d r12d r15d r8b xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B15.4:                        # Preds ..B15.3
-        cmpl      $1, %edi                                      #3148.20
-        je        ..B15.10      # Prob 25%                      #3148.20
-                                # LOE rcx r8 r13 r14 eax edx ebx esi edi r8d r12d r15d r8b xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B15.5:                        # Preds ..B15.4
-        cmpl      $2, %edi                                      #3148.20
-        je        ..B15.9       # Prob 33%                      #3148.20
-                                # LOE rcx r8 r13 r14 eax edx ebx esi edi r8d r12d r15d r8b xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B15.6:                        # Preds ..B15.5
-        cmpl      $3, %edi                                      #3148.20
-        je        ..B15.8       # Prob 50%                      #3148.20
-                                # LOE rcx r8 r13 r14 eax edx ebx esi r8d r12d r15d r8b xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B15.7:                        # Preds ..B15.6
-        movdqa    %xmm8, -128(%rbp)                             #
-        movdqa    %xmm1, -112(%rbp)                             #
-        movdqa    %xmm2, -96(%rbp)                              #
-        movdqa    %xmm3, -160(%rbp)                             #
-        movdqa    %xmm4, -192(%rbp)                             #
-        movdqa    %xmm5, -176(%rbp)                             #
-        movdqa    %xmm6, -144(%rbp)                             #
-        movdqa    %xmm7, -80(%rbp)                              #
-        movl      %ebx, %eax                                    #
-        movq      %r13, -64(%rbp)                               #
-        movl      %r8d, -16(%rbp)                               #
-        jmp       ..B15.32      # Prob 100%                     #
-                                # LOE rcx r14 eax r15d xmm0
-..B15.8:                        # Preds ..B15.6
-        movdqa    %xmm8, -128(%rbp)                             #
-        movdqa    %xmm1, -112(%rbp)                             #
-        movdqa    %xmm2, -96(%rbp)                              #
-        movdqa    %xmm3, -160(%rbp)                             #
-        movdqa    %xmm4, -192(%rbp)                             #
-        movdqa    %xmm5, -176(%rbp)                             #
-        movdqa    %xmm6, -144(%rbp)                             #
-        movdqa    %xmm7, -80(%rbp)                              #
-        movl      %eax, %edi                                    #
-        movq      %r13, -64(%rbp)                               #
-        movl      %r8d, -16(%rbp)                               #
-        movl      %ebx, %eax                                    #
-        movl      %edi, %ebx                                    #
-        movl      %esi, %r13d                                   #
-        jmp       ..B15.13      # Prob 100%                     #
-                                # LOE rcx r14 eax edx ebx r12d r13d r15d xmm0
-..B15.9:                        # Preds ..B15.5
-        movdqa    %xmm8, -128(%rbp)                             #
-        movdqa    %xmm1, -112(%rbp)                             #
-        movdqa    %xmm2, -96(%rbp)                              #
-        movdqa    %xmm3, -160(%rbp)                             #
-        movdqa    %xmm4, -192(%rbp)                             #
-        movdqa    %xmm5, -176(%rbp)                             #
-        movdqa    %xmm6, -144(%rbp)                             #
-        movdqa    %xmm7, -80(%rbp)                              #
-        movl      %eax, %esi                                    #
-        movq      %r13, -64(%rbp)                               #
-        movl      %r8d, -16(%rbp)                               #
-        movl      %ebx, %eax                                    #
-        movl      %esi, %ebx                                    #
-        jmp       ..B15.12      # Prob 100%                     #
-                                # LOE rcx r14 eax edx ebx r12d r15d xmm0
-..B15.10:                       # Preds ..B15.4
-        movdqa    %xmm8, -128(%rbp)                             #
-        movdqa    %xmm1, -112(%rbp)                             #
-        movdqa    %xmm2, -96(%rbp)                              #
-        movdqa    %xmm3, -160(%rbp)                             #
-        movdqa    %xmm4, -192(%rbp)                             #
-        movdqa    %xmm5, -176(%rbp)                             #
-        movdqa    %xmm6, -144(%rbp)                             #
-        movdqa    %xmm7, -80(%rbp)                              #
-        movl      %ebx, %eax                                    #
-        movq      %r13, -64(%rbp)                               #
-        movl      %r8d, -16(%rbp)                               #
-                                # LOE rcx r14 eax edx r12d r15d xmm0
-..B15.11:                       # Preds ..B15.10 ..B15.36
-..LN1985:
-   .loc    1  3171
-        movdqa    %xmm0, %xmm1                                  #3171.22
-        pand      -192(%rbp), %xmm1                             #3171.22
-..LN1987:
-   .loc    1  3172
-        pcmpeqd   -176(%rbp), %xmm1                             #3172.22
-..LN1989:
-   .loc    1  3173
-        pmovmskb  %xmm1, %ebx                                   #3173.22
-..LN1991:
-   .loc    1  3174
-        movl      %ebx, %esi                                    #3174.17
-        andl      $3855, %esi                                   #3174.17
-        shll      $4, %esi                                      #3174.17
-        andl      %esi, %ebx                                    #3174.17
-        movl      %ebx, %edi                                    #3174.17
-        shrl      $4, %edi                                      #3174.17
-        orl       %edi, %ebx                                    #3174.17
-                                # LOE rcx r14 eax edx ebx r12d r15d xmm0
-..B15.12:                       # Preds ..B15.9 ..B15.11
-..LN1993:
-   .loc    1  3177
-        movdqa    %xmm0, %xmm1                                  #3177.22
-        pand      -96(%rbp), %xmm1                              #3177.22
-..LN1995:
-   .loc    1  3178
-        pcmpeqd   -160(%rbp), %xmm1                             #3178.22
-..LN1997:
-   .loc    1  3179
-        pmovmskb  %xmm1, %r13d                                  #3179.22
-..LN1999:
-   .loc    1  3180
-        movl      %r13d, %edi                                   #3180.17
-        andl      $3855, %edi                                   #3180.17
-        shll      $4, %edi                                      #3180.17
-        andl      %edi, %r13d                                   #3180.17
-        movl      %r13d, %r8d                                   #3180.17
-        shrl      $4, %r8d                                      #3180.17
-        orl       %r8d, %r13d                                   #3180.17
-                                # LOE rcx r14 eax edx ebx r12d r13d r15d xmm0
-..B15.13:                       # Preds ..B15.8 ..B15.12
-..LN2001:
-   .loc    1  3183
-        movdqa    %xmm0, %xmm1                                  #3183.22
-        pand      -128(%rbp), %xmm1                             #3183.22
-..LN2003:
-   .loc    1  3184
-        pcmpeqd   -112(%rbp), %xmm1                             #3184.22
-..LN2005:
-   .loc    1  3185
-        pmovmskb  %xmm1, %r8d                                   #3185.22
-..LN2007:
-   .loc    1  3190
-        movl      %eax, %esi                                    #3190.17
-        andl      $-4, %esi                                     #3190.17
-..LN2009:
-   .loc    1  3186
-        movl      %r8d, %r9d                                    #3186.17
-        andl      $3855, %r9d                                   #3186.17
-        shll      $4, %r9d                                      #3186.17
-        andl      %r9d, %r8d                                    #3186.17
-        movl      %r8d, %r10d                                   #3186.17
-        shrl      $4, %r10d                                     #3186.17
-        orl       %r10d, %r8d                                   #3186.17
-..LN2011:
-   .loc    1  3193
-        movl      %r12d, %r11d                                  #3193.29
-        orl       %ebx, %r11d                                   #3193.29
-..LN2013:
-        orl       %r13d, %r11d                                  #3193.34
-..LN2015:
-        orl       %r8d, %r11d                                   #3193.39
-..LN2017:
-        je        ..B15.26      # Prob 78%                      #3193.47
-                                # LOE rcx r14 edx ebx esi r8d r12d r13d r15d xmm0
-..B15.14:                       # Preds ..B15.13
-..LN2019:
-   .loc    1  3211
-        movdqa    %xmm0, -272(%rbp)                             #3211.30
-        movl      %r12d, %edi                                   #3211.30
-        movl      %edx, -232(%rbp)                              #3211.30
-        movl      %esi, -224(%rbp)                              #3211.30
-        movl      %r8d, -216(%rbp)                              #3211.30
-        movq      %rcx, -208(%rbp)                              #3211.30
-        call      uint16_lsbit at PLT                              #3211.30
-                                # LOE r14 eax ebx r12d r13d r15d
-..B15.50:                       # Preds ..B15.14
-        movq      -208(%rbp), %rcx                              #
-        movdqa    -272(%rbp), %xmm0                             #
-        movl      -216(%rbp), %r8d                              #
-        movl      -224(%rbp), %esi                              #
-        movl      -232(%rbp), %edx                              #
-                                # LOE rdx rcx rsi r8 r14 eax edx ebx esi r8d r12d r13d r15d dl sil r8b dh xmm0
-..B15.15:                       # Preds ..B15.50
-..LN2021:
-   .loc    1  3212
-        movdqa    %xmm0, -272(%rbp)                             #3212.30
-        movl      %ebx, %edi                                    #3212.30
-        movl      %edx, -232(%rbp)                              #3212.30
-..LN2023:
-   .loc    1  3211
-        movswq    %ax, %r9                                      #3211.30
-        movl      %r9d, -240(%rbp)                              #3211.30
-..LN2025:
-   .loc    1  3212
-        movl      %esi, -224(%rbp)                              #3212.30
-        movl      %r8d, -216(%rbp)                              #3212.30
-        movq      %rcx, -208(%rbp)                              #3212.30
-        call      uint16_lsbit at PLT                              #3212.30
-                                # LOE r14 eax ebx r12d r13d r15d
-..B15.51:                       # Preds ..B15.15
-        movq      -208(%rbp), %rcx                              #
-        movdqa    -272(%rbp), %xmm0                             #
-        movl      -216(%rbp), %r8d                              #
-        movl      -224(%rbp), %esi                              #
-        movl      -232(%rbp), %edx                              #
-                                # LOE rdx rcx rsi r8 r14 eax edx ebx esi r8d r12d r13d r15d dl sil r8b dh xmm0
-..B15.16:                       # Preds ..B15.51
-..LN2027:
-   .loc    1  3213
-        movdqa    %xmm0, -272(%rbp)                             #3213.30
-        movl      %r13d, %edi                                   #3213.30
-        movl      %edx, -232(%rbp)                              #3213.30
-..LN2029:
-   .loc    1  3212
-        movswq    %ax, %r9                                      #3212.30
-        movl      %r9d, -248(%rbp)                              #3212.30
-..LN2031:
-   .loc    1  3213
-        movl      %esi, -224(%rbp)                              #3213.30
-        movl      %r8d, -216(%rbp)                              #3213.30
-        movq      %rcx, -208(%rbp)                              #3213.30
-        call      uint16_lsbit at PLT                              #3213.30
-                                # LOE r14 eax ebx r12d r13d r15d
-..B15.52:                       # Preds ..B15.16
-        movq      -208(%rbp), %rcx                              #
-        movdqa    -272(%rbp), %xmm0                             #
-        movl      -216(%rbp), %r8d                              #
-        movl      -224(%rbp), %esi                              #
-        movl      -232(%rbp), %edx                              #
-                                # LOE rdx rcx rsi r8 r14 eax edx ebx esi r8d r12d r13d r15d dl sil r8b dh xmm0
-..B15.17:                       # Preds ..B15.52
-..LN2033:
-   .loc    1  3214
-        movdqa    %xmm0, -272(%rbp)                             #3214.30
-        movl      %r8d, %edi                                    #3214.30
-        movl      %edx, -232(%rbp)                              #3214.30
-..LN2035:
-   .loc    1  3213
-        movswq    %ax, %r9                                      #3213.30
-        movl      %r9d, -256(%rbp)                              #3213.30
-..LN2037:
-   .loc    1  3214
-        movl      %esi, -224(%rbp)                              #3214.30
-        movl      %r8d, -216(%rbp)                              #3214.30
-        movq      %rcx, -208(%rbp)                              #3214.30
-        call      uint16_lsbit at PLT                              #3214.30
-                                # LOE r14 eax ebx r12d r13d r15d
-..B15.53:                       # Preds ..B15.17
-        movq      -208(%rbp), %rcx                              #
-        movdqa    -272(%rbp), %xmm0                             #
-        movl      -216(%rbp), %r8d                              #
-        movl      -224(%rbp), %esi                              #
-        movl      -232(%rbp), %edx                              #
-                                # LOE rdx rcx rsi r8 r14 eax edx ebx esi r8d r12d r13d r15d dl sil r8b dh xmm0
-..B15.18:                       # Preds ..B15.53
-..LN2039:
-   .loc    1  3219
-        movl      -240(%rbp), %r9d                              #3219.34
-..LN2041:
-   .loc    1  3220
-        movl      -248(%rbp), %r10d                             #3220.34
-..LN2043:
-   .loc    1  3221
-        movl      -256(%rbp), %r11d                             #3221.34
-..LN2045:
-   .loc    1  3214
-        movswq    %ax, %rax                                     #3214.30
-..LN2047:
-   .loc    1  3219
-        shll      $2, %r9d                                      #3219.34
-        movl      %r9d, -240(%rbp)                              #3219.34
-..LN2049:
-   .loc    1  3220
-        shll      $2, %r10d                                     #3220.34
-        movl      %r10d, -248(%rbp)                             #3220.34
-..LN2051:
-   .loc    1  3221
-        shll      $2, %r11d                                     #3221.34
-        movl      %r11d, -256(%rbp)                             #3221.34
-..LN2053:
-   .loc    1  3222
-        shll      $2, %eax                                      #3222.34
-..LN2055:
-   .loc    1  3226
-        testl     %r12d, %r12d                                  #3226.32
-        je        ..B15.20      # Prob 50%                      #3226.32
-                                # LOE rdx rcx rsi r8 r9 r10 r11 r14 eax edx ebx esi r8d r9d r10d r11d r13d r15d dl sil r8b r9b r10b r11b dh xmm0
-..B15.19:                       # Preds ..B15.18
-..LN2057:
-        addl      %esi, %r9d                                    #3226.43
-..LN2059:
-        cmpl      -16(%rbp), %r9d                               #3226.49
-        jbe       ..B15.41      # Prob 20%                      #3226.49
-                                # LOE rdx rcx rsi r8 r10 r11 r14 eax edx ebx esi r8d r10d r11d r13d r15d dl sil r8b r10b r11b dh xmm0
-..B15.20:                       # Preds ..B15.19 ..B15.18
-..LN2061:
-   .loc    1  3227
-        testl     %ebx, %ebx                                    #3227.32
-        je        ..B15.22      # Prob 50%                      #3227.32
-                                # LOE rdx rcx rsi r8 r10 r11 r14 eax edx esi r8d r10d r11d r13d r15d dl sil r8b r10b r11b dh xmm0
-..B15.21:                       # Preds ..B15.20
-..LN2063:
-        movl      %r10d, %ebx                                   #3227.43
-        lea       1(%rsi,%rbx), %r9d                            #3227.43
-..LN2065:
-        cmpl      -16(%rbp), %r9d                               #3227.49
-        jbe       ..B15.41      # Prob 20%                      #3227.49
-                                # LOE rdx rcx rsi r8 r11 r14 eax edx esi r8d r11d r13d r15d dl sil r8b r11b dh xmm0
-..B15.22:                       # Preds ..B15.21 ..B15.20
-..LN2067:
-   .loc    1  3228
-        testl     %r13d, %r13d                                  #3228.32
-        je        ..B15.24      # Prob 50%                      #3228.32
-                                # LOE rdx rcx rsi r8 r11 r14 eax edx esi r8d r11d r15d dl sil r8b r11b dh xmm0
-..B15.23:                       # Preds ..B15.22
-..LN2069:
-        movl      %r11d, %ebx                                   #3228.43
-        lea       2(%rsi,%rbx), %r9d                            #3228.43
-..LN2071:
-        cmpl      -16(%rbp), %r9d                               #3228.49
-        jbe       ..B15.41      # Prob 20%                      #3228.49
-                                # LOE rdx rcx rsi r8 r14 eax edx esi r8d r15d dl sil r8b dh xmm0
-..B15.24:                       # Preds ..B15.23 ..B15.22
-..LN2073:
-   .loc    1  3229
-        testl     %r8d, %r8d                                    #3229.32
-        je        ..B15.26      # Prob 50%                      #3229.32
-                                # LOE rdx rcx rsi r14 eax edx esi r15d dl sil dh xmm0
-..B15.25:                       # Preds ..B15.24
-..LN2075:
-        lea       3(%rsi,%rax), %eax                            #3229.43
-..LN2077:
-        cmpl      -16(%rbp), %eax                               #3229.49
-        jbe       ..B15.41      # Prob 20%                      #3229.49
-                                # LOE rcx r14 edx esi r15d xmm0
-..B15.26:                       # Preds ..B15.25 ..B15.24 ..B15.13
-..LN2079:
-   .loc    1  3234
-        lea       4(%rsi), %eax                                 #3234.17
-..LN2081:
-   .loc    1  3237
-        cmpl      -16(%rbp), %eax                               #3237.28
-        ja        ..B15.38      # Prob 20%                      #3237.28
-                                # LOE rcx r14 eax edx esi r15d xmm0
-..B15.27:                       # Preds ..B15.26
-..LN2083:
-   .loc    1  3241
-        decl      %edx                                          #3241.25
-..LN2085:
-        jne       ..B15.33      # Prob 50%                      #3241.39
-                                # LOE rcx r14 eax edx esi r15d xmm0
-..B15.28:                       # Preds ..B15.27
-..LN2087:
-   .loc    1  3262
-        cmpq      -64(%rbp), %r14                               #3262.25
-        jae       ..B15.38      # Prob 4%                       #3262.25
-                                # LOE r14 esi r15d
-..B15.29:                       # Preds ..B15.28
-..LN2089:
-   .loc    1  3266
-        lea       36(%rsi), %eax                                #3266.13
-..LN2091:
-   .loc    1  3267
-        cmpl      -16(%rbp), %eax                               #3267.24
-        ja        ..B15.38      # Prob 4%                       #3267.24
-                                # LOE r14 eax r15d
-..B15.30:                       # Preds ..B15.29
-..LN2093:
-   .loc    1  3272
-        movq      -64(%rbp), %rsi                               #3272.22
-        movl      %eax, -200(%rbp)                              #3272.22
-        movq      %r14, %rdi                                    #3272.22
-        call      prime_buffer_2na at PLT                          #3272.22
-                                # LOE r14 r15d xmm0
-..B15.54:                       # Preds ..B15.30
-        movl      -200(%rbp), %eax                              #
-..LN2095:
-   .loc    1  3350
-        addq      $16, %r14                                     #3350.13
-..LN2097:
-   .loc    1  3353
-        cmpq      -64(%rbp), %r14                               #3353.24
-..LN2099:
-   .loc    1  3350
-        movq      %r14, %rcx                                    #3350.13
-..LN2101:
-   .loc    1  3353
-        jae       ..B15.32      # Prob 12%                      #3353.24
-                                # LOE rax rcx r14 eax r15d al ah xmm0
-..B15.31:                       # Preds ..B15.54
-..LN2103:
-   .loc    1  3354
-        movzbl    -1(%r14), %r15d                               #3354.32
-..LN2105:
-        shll      $8, %r15d                                     #3354.46
-                                # LOE rcx r14 eax r15d xmm0
-..B15.32:                       # Preds ..B15.54 ..B15.7 ..B15.31
-..LN2107:
-   .loc    1  3155
-        movl      $8, %edx                                      #3155.13
-        jmp       ..B15.36      # Prob 100%                     #3155.13
-                                # LOE rcx r14 eax edx r15d xmm0
-..B15.33:                       # Preds ..B15.27
-..LN2109:
-   .loc    1  3249
-        cmpq      -64(%rbp), %rcx                               #3249.26
-..LN2111:
-   .loc    1  3246
-        psrldq    $1, %xmm0                                     #3246.26
-..LN2113:
-   .loc    1  3249
-        jae       ..B15.35      # Prob 19%                      #3249.26
-                                # LOE rcx r14 eax edx r15d xmm0
-..B15.34:                       # Preds ..B15.33
-..LN2115:
-   .loc    1  3252
-        movzbl    (%rcx), %esi                                  #3252.37
-..LN2117:
-   .loc    1  3251
-        sarl      $8, %r15d                                     #3251.21
-..LN2119:
-   .loc    1  3252
-        shll      $8, %esi                                      #3252.48
-..LN2121:
-        orl       %esi, %r15d                                   #3252.21
-..LN2123:
-   .loc    1  3253
-        pinsrw    $7, %r15d, %xmm0                              #3253.30
-                                # LOE rcx r14 eax edx r15d xmm0
-..B15.35:                       # Preds ..B15.34 ..B15.33
-..LN2125:
-   .loc    1  3257
-        incq      %rcx                                          #3257.20
-                                # LOE rcx r14 eax edx r15d xmm0
-..B15.36:                       # Preds ..B15.32 ..B15.35 ..B15.40
-..LN2127:
-   .loc    1  3165
-        movdqa    %xmm0, %xmm1                                  #3165.22
-        pand      -144(%rbp), %xmm1                             #3165.22
-..LN2129:
-   .loc    1  3166
-        pcmpeqd   -80(%rbp), %xmm1                              #3166.22
-..LN2131:
-   .loc    1  3167
-        pmovmskb  %xmm1, %r12d                                  #3167.22
-..LN2133:
-   .loc    1  3168
-        movl      %r12d, %esi                                   #3168.17
-        andl      $3855, %esi                                   #3168.17
-        shll      $4, %esi                                      #3168.17
-        andl      %esi, %r12d                                   #3168.17
-        movl      %r12d, %edi                                   #3168.17
-        shrl      $4, %edi                                      #3168.17
-        orl       %edi, %r12d                                   #3168.17
-        jmp       ..B15.11      # Prob 100%                     #3168.17
-                                # LOE rcx r14 eax edx r12d r15d xmm0
-..B15.38:                       # Preds ..B15.26 ..B15.28 ..B15.29 # Infreq
-..LN2135:
-   .loc    1  3363
-        movq      -32(%rbp), %rbx                               #3363.12
-..___tag_value_eval_2na_64.579:                                 #
-        movq      -40(%rbp), %r12                               #3363.12
-..___tag_value_eval_2na_64.580:                                 #
-        movq      -24(%rbp), %r13                               #3363.12
-..___tag_value_eval_2na_64.581:                                 #
-        movq      -48(%rbp), %r14                               #3363.12
-..___tag_value_eval_2na_64.582:                                 #
-        xorl      %eax, %eax                                    #3363.12
-        movq      -56(%rbp), %r15                               #3363.12
-..___tag_value_eval_2na_64.583:                                 #
-        movq      %rbp, %rsp                                    #3363.12
-        popq      %rbp                                          #3363.12
-..___tag_value_eval_2na_64.584:                                 #
-        ret                                                     #3363.12
-..___tag_value_eval_2na_64.585:                                 #
-                                # LOE
-..B15.40:                       # Preds ..B15.3                 # Infreq
-        movdqa    %xmm8, -128(%rbp)                             #
-        movdqa    %xmm1, -112(%rbp)                             #
-        movdqa    %xmm2, -96(%rbp)                              #
-        movdqa    %xmm3, -160(%rbp)                             #
-        movdqa    %xmm4, -192(%rbp)                             #
-        movdqa    %xmm5, -176(%rbp)                             #
-        movdqa    %xmm6, -144(%rbp)                             #
-        movdqa    %xmm7, -80(%rbp)                              #
-        movl      %ebx, %eax                                    #
-        movq      %r13, -64(%rbp)                               #
-        movl      %r8d, -16(%rbp)                               #
-        jmp       ..B15.36      # Prob 100%                     #
-                                # LOE rcx r14 eax edx r15d xmm0
-..B15.41:                       # Preds ..B15.23 ..B15.21 ..B15.19 ..B15.25 # Infreq
-..LN2137:
-   .loc    1  3229
-        movq      -32(%rbp), %rbx                               #3229.63
-..___tag_value_eval_2na_64.591:                                 #
-        movq      -40(%rbp), %r12                               #3229.63
-..___tag_value_eval_2na_64.592:                                 #
-        movq      -24(%rbp), %r13                               #3229.63
-..___tag_value_eval_2na_64.593:                                 #
-        movq      -48(%rbp), %r14                               #3229.63
-..___tag_value_eval_2na_64.594:                                 #
-        movl      $1, %eax                                      #3229.63
-        movq      -56(%rbp), %r15                               #3229.63
-..___tag_value_eval_2na_64.595:                                 #
-        movq      %rbp, %rsp                                    #3229.63
-        popq      %rbp                                          #3229.63
-..___tag_value_eval_2na_64.596:                                 #
-        ret                                                     #3229.63
-        .align    16,0x90
-..___tag_value_eval_2na_64.597:                                 #
-                                # LOE
-# mark_end;
-	.type	eval_2na_64, at function
-	.size	eval_2na_64,.-eval_2na_64
-.LNeval_2na_64:
-	.data
-# -- End  eval_2na_64
-	.text
-# -- Begin  NucStrstrMake
-# mark_begin;
-       .align    16,0x90
-	.globl NucStrstrMake
-NucStrstrMake:
-# parameter 1(nss): %rdi
-# parameter 2(positional): %esi
-# parameter 3(query): %rdx
-# parameter 4(len): %ecx
-..B16.1:                        # Preds ..B16.0
-..___tag_value_NucStrstrMake.598:                               #1539.1
-..LN2139:
-   .loc    1  1539
-        pushq     %rbp                                          #1539.1
-        movq      %rsp, %rbp                                    #1539.1
-..___tag_value_NucStrstrMake.599:                               #
-        subq      $48, %rsp                                     #1539.1
-        movq      %r15, -48(%rbp)                               #1539.1
-..___tag_value_NucStrstrMake.601:                               #
-        movq      %r14, -40(%rbp)                               #1539.1
-..___tag_value_NucStrstrMake.602:                               #
-        movq      %r13, -32(%rbp)                               #1539.1
-..___tag_value_NucStrstrMake.603:                               #
-        movq      %r12, -24(%rbp)                               #1539.1
-..___tag_value_NucStrstrMake.604:                               #
-        movl      %ecx, %r15d                                   #1539.1
-        movq      %rdx, %r12                                    #1539.1
-        movl      %esi, %r13d                                   #1539.1
-        movq      %rdi, %r14                                    #1539.1
-        lea       _gprof_pack15(%rip), %rdx                     #1539.1
-        call      mcount at PLT                                    #1539.1
-                                # LOE rbx r12 r14 r13d r15d
-..B16.17:                       # Preds ..B16.1
-..LN2141:
-   .loc    1  1540
-        testq     %r14, %r14                                    #1540.17
-        je        ..B16.12      # Prob 6%                       #1540.17
-                                # LOE rbx r12 r14 r13d r15d
-..B16.2:                        # Preds ..B16.17
-..LN2143:
-   .loc    1  1542
-        testq     %r12, %r12                                    #1542.23
-        je        ..B16.11      # Prob 6%                       #1542.23
-                                # LOE rbx r12 r14 r13d r15d
-..B16.3:                        # Preds ..B16.2
-..LN2145:
-        testl     %r15d, %r15d                                  #1542.38
-        je        ..B16.11      # Prob 28%                      #1542.38
-                                # LOE rbx r12 r14 r13d r15d
-..B16.4:                        # Preds ..B16.3
-..LN2147:
-   .loc    1  1544
-        movl      $0, -16(%rbp)                                 #1544.24
-..LN2149:
-   .loc    1  1547
-        lea       fasta_2na_map.0(%rip), %rax                   #1547.18
-        movsbl    (%rax), %edx                                  #1547.18
-..LN2151:
-        testl     %edx, %edx                                    #1547.41
-        je        ..B16.13      # Prob 5%                       #1547.41
-                                # LOE rbx r12 r14 r13d r15d
-..B16.5:                        # Preds ..B16.13 ..B16.4
-..LN2153:
-   .loc    1  1551
-        lea       -16(%rbp), %rcx                               #1551.21
-..LN2155:
-   .loc    1  1550
-        movl      %r15d, %r15d                                  #1550.19
-        addq      %r12, %r15                                    #1550.19
-..LN2157:
-   .loc    1  1551
-        movq      %r12, %rdi                                    #1551.21
-        movq      %r15, %rsi                                    #1551.21
-        movq      %r14, %rdx                                    #1551.21
-        movl      %r13d, %r8d                                   #1551.21
-        call      nss_expr at PLT                                  #1551.21
-                                # LOE rax rbx r14 r15
-..B16.6:                        # Preds ..B16.5
-..LN2159:
-   .loc    1  1552
-        movl      -16(%rbp), %r12d                              #1552.18
-..LN2161:
-        testl     %r12d, %r12d                                  #1552.28
-        jne       ..B16.9       # Prob 10%                      #1552.28
-                                # LOE rax rbx r14 r15 r12d
-..B16.7:                        # Preds ..B16.6
-..LN2163:
-   .loc    1  1554
-        cmpq      %r15, %rax                                    #1554.31
-        je        ..B16.14      # Prob 12%                      #1554.31
-                                # LOE rbx r14
-..B16.8:                        # Preds ..B16.7
-..LN2165:
-   .loc    1  1557
-        movl      $22, -16(%rbp)                                #1557.17
-        movl      $22, %r12d                                    #1557.17
-                                # LOE rbx r14 r12d
-..B16.9:                        # Preds ..B16.8 ..B16.6
-..LN2167:
-   .loc    1  1560
-        movq      (%r14), %rdi                                  #1560.13
-        call      NucStrstrWhack at PLT                            #1560.13
-                                # LOE rbx r14 r12d
-..B16.10:                       # Preds ..B16.9
-..LN2169:
-   .loc    1  1562
-        movq      -32(%rbp), %r13                               #1562.20
-..___tag_value_NucStrstrMake.605:                               #
-        movq      -48(%rbp), %r15                               #1562.20
-..___tag_value_NucStrstrMake.606:                               #
-..LN2171:
-   .loc    1  1561
-        movq      $0, (%r14)                                    #1561.13
-..LN2173:
-   .loc    1  1562
-        movl      %r12d, %eax                                   #1562.20
-        movq      -24(%rbp), %r12                               #1562.20
-..___tag_value_NucStrstrMake.607:                               #
-        movq      -40(%rbp), %r14                               #1562.20
-..___tag_value_NucStrstrMake.608:                               #
-        movq      %rbp, %rsp                                    #1562.20
-        popq      %rbp                                          #1562.20
-..___tag_value_NucStrstrMake.609:                               #
-        ret                                                     #1562.20
-..___tag_value_NucStrstrMake.610:                               #
-                                # LOE
-..B16.11:                       # Preds ..B16.3 ..B16.2
-..LN2175:
-   .loc    1  1565
-        movq      $0, (%r14)                                    #1565.9
-                                # LOE rbx
-..B16.12:                       # Preds ..B16.17 ..B16.11
-..LN2177:
-   .loc    1  1567
-        movq      -24(%rbp), %r12                               #1567.12
-..___tag_value_NucStrstrMake.615:                               #
-        movq      -32(%rbp), %r13                               #1567.12
-..___tag_value_NucStrstrMake.616:                               #
-        movq      -40(%rbp), %r14                               #1567.12
-..___tag_value_NucStrstrMake.617:                               #
-        movq      -48(%rbp), %r15                               #1567.12
-..___tag_value_NucStrstrMake.618:                               #
-        movl      $22, %eax                                     #1567.12
-        movq      %rbp, %rsp                                    #1567.12
-        popq      %rbp                                          #1567.12
-..___tag_value_NucStrstrMake.619:                               #
-        ret                                                     #1567.12
-..___tag_value_NucStrstrMake.620:                               #
-                                # LOE
-..B16.13:                       # Preds ..B16.4                 # Infreq
-..LN2179:
-   .loc    1  1548
-        call      NucStrstrInit at PLT                             #1548.17
-        jmp       ..B16.5       # Prob 100%                     #1548.17
-                                # LOE rbx r12 r14 r13d r15d
-..B16.14:                       # Preds ..B16.7                 # Infreq
-..LN2181:
-   .loc    1  1555
-        movq      -24(%rbp), %r12                               #1555.28
-..___tag_value_NucStrstrMake.625:                               #
-        movq      -32(%rbp), %r13                               #1555.28
-..___tag_value_NucStrstrMake.626:                               #
-        movq      -40(%rbp), %r14                               #1555.28
-..___tag_value_NucStrstrMake.627:                               #
-        movq      -48(%rbp), %r15                               #1555.28
-..___tag_value_NucStrstrMake.628:                               #
-        xorl      %eax, %eax                                    #1555.28
-        movq      %rbp, %rsp                                    #1555.28
-        popq      %rbp                                          #1555.28
-..___tag_value_NucStrstrMake.629:                               #
-        ret                                                     #1555.28
-        .align    16,0x90
-..___tag_value_NucStrstrMake.630:                               #
-                                # LOE
-# mark_end;
-	.type	NucStrstrMake, at function
-	.size	NucStrstrMake,.-NucStrstrMake
-.LNNucStrstrMake:
-	.data
-# -- End  NucStrstrMake
-	.text
-# -- Begin  nss_expr
-# mark_begin;
-       .align    16,0x90
-nss_expr:
-# parameter 1(p): %rdi
-# parameter 2(end): %rsi
-# parameter 3(expr): %rdx
-# parameter 4(status): %rcx
-# parameter 5(positional): %r8d
-..B17.1:                        # Preds ..B17.0
-..___tag_value_nss_expr.631:                                    #1406.1
-..LN2183:
-   .loc    1  1406
-        pushq     %rbp                                          #1406.1
-        movq      %rsp, %rbp                                    #1406.1
-..___tag_value_nss_expr.632:                                    #
-        subq      $48, %rsp                                     #1406.1
-        movq      %r14, -24(%rbp)                               #1406.1
-..___tag_value_nss_expr.634:                                    #
-        movq      %r13, -32(%rbp)                               #1406.1
-..___tag_value_nss_expr.635:                                    #
-        movq      %r12, -40(%rbp)                               #1406.1
-..___tag_value_nss_expr.636:                                    #
-        movq      %rbx, -48(%rbp)                               #1406.1
-..___tag_value_nss_expr.637:                                    #
-        movq      %rcx, %r14                                    #1406.1
-        movl      %r8d, -8(%rbp)                                #1406.1
-        movq      %rdx, %r13                                    #1406.1
-        lea       _gprof_pack16(%rip), %rdx                     #1406.1
-        movq      %rsi, %r12                                    #1406.1
-        movq      %rdi, %rbx                                    #1406.1
-        call      mcount at PLT                                    #1406.1
-                                # LOE rbx r12 r13 r14 r15
-..B17.34:                       # Preds ..B17.1
-        movq      %r15, -16(%rbp)                               #
-..___tag_value_nss_expr.638:                                    #
-                                # LOE rbx r12 r13 r14
-..B17.2:                        # Preds ..B17.17 ..B17.34
-..LN2185:
-   .loc    1  1407
-        movq      $0, (%r13)                                    #1407.5
-..LN2187:
-   .loc    1  1409
-        movq      %rbx, %rdi                                    #1409.9
-        movq      %r12, %rsi                                    #1409.9
-        call      nss_sob at PLT                                   #1409.9
-                                # LOE rax r12 r13 r14
-..B17.27:                       # Preds ..B17.2
-..LN2189:
-   .loc    1  1410
-        cmpq      %r12, %rax                                    #1410.15
-        je        ..B17.33      # Prob 16%                      #1410.15
-                                # LOE rax r12 r13 r14
-..B17.3:                        # Preds ..B17.27
-..LN2191:
-   .loc    1  1412
-        movl      -8(%rbp), %r8d                                #1412.13
-        movq      %rax, %rdi                                    #1412.13
-        movq      %r12, %rsi                                    #1412.13
-        movq      %r13, %rdx                                    #1412.13
-        movq      %r14, %rcx                                    #1412.13
-        call      nss_unary_expr at PLT                            #1412.13
-                                # LOE rax r12 r13 r14
-..B17.4:                        # Preds ..B17.3
-..LN2193:
-   .loc    1  1413
-        movl      (%r14), %edx                                  #1413.16
-..LN2195:
-        testl     %edx, %edx                                    #1413.26
-        jne       ..B17.20      # Prob 58%                      #1413.26
-                                # LOE rax r12 r13 r14
-..B17.5:                        # Preds ..B17.4
-..LN2197:
-   .loc    1  1415
-        movq      %rax, %rdi                                    #1415.17
-        movq      %r12, %rsi                                    #1415.17
-        call      nss_sob at PLT                                   #1415.17
-                                # LOE rax r12 r13 r14
-..B17.29:                       # Preds ..B17.5
-..LN2199:
-   .loc    1  1416
-        cmpq      %r12, %rax                                    #1416.23
-        je        ..B17.33      # Prob 4%                       #1416.23
-                                # LOE rax r12 r13 r14
-..B17.6:                        # Preds ..B17.29
-..LN2201:
-   .loc    1  1422
-        movsbl    (%rax), %edx                                  #1422.28
-        lea       1(%rax), %rbx                                 #1422.28
-        cmpl      $41, %edx                                     #1422.28
-        je        ..B17.19      # Prob 25%                      #1422.28
-                                # LOE rax rbx r12 r13 r14 edx
-..B17.7:                        # Preds ..B17.6
-        cmpl      $38, %edx                                     #1422.28
-        jne       ..B17.11      # Prob 67%                      #1422.28
-                                # LOE rax rbx r12 r13 r14 edx
-..B17.8:                        # Preds ..B17.7
-..LN2203:
-   .loc    1  1427
-        cmpq      %r12, %rbx                                    #1427.30
-        jae       ..B17.10      # Prob 12%                      #1427.30
-                                # LOE rax rbx r12 r13 r14
-..B17.9:                        # Preds ..B17.8
-..LN2205:
-        movsbl    (%rbx), %edx                                  #1427.39
-..LN2207:
-   .loc    1  1428
-        addq      $2, %rax                                      #1428.28
-        cmpl      $38, %edx                                     #1428.28
-        cmove     %rax, %rbx                                    #1428.28
-                                # LOE rbx r12 r13 r14
-..B17.10:                       # Preds ..B17.9 ..B17.8
-..LN2209:
-   .loc    1  1429
-        movl      $16, %r15d                                    #1429.21
-        jmp       ..B17.15      # Prob 100%                     #1429.21
-                                # LOE rbx r12 r13 r14 r15d
-..B17.11:                       # Preds ..B17.7
-..LN2211:
-   .loc    1  1422
-        cmpl      $124, %edx                                    #1422.28
-        jne       ..B17.18      # Prob 50%                      #1422.28
-                                # LOE rax rbx r12 r13 r14
-..B17.12:                       # Preds ..B17.11
-..LN2213:
-   .loc    1  1432
-        cmpq      %r12, %rbx                                    #1432.30
-        jae       ..B17.14      # Prob 12%                      #1432.30
-                                # LOE rax rbx r12 r13 r14
-..B17.13:                       # Preds ..B17.12
-..LN2215:
-        movsbl    (%rbx), %edx                                  #1432.39
-..LN2217:
-   .loc    1  1433
-        addq      $2, %rax                                      #1433.28
-        cmpl      $124, %edx                                    #1433.28
-        cmove     %rax, %rbx                                    #1433.28
-                                # LOE rbx r12 r13 r14
-..B17.14:                       # Preds ..B17.13 ..B17.12
-..LN2219:
-   .loc    1  1434
-        movl      $17, %r15d                                    #1434.21
-                                # LOE rbx r12 r13 r14 r15d
-..B17.15:                       # Preds ..B17.10 ..B17.14
-..LN2221:
-   .loc    1  1451
-        movl      $24, %edi                                     #1451.21
-        call      malloc at PLT                                    #1451.21
-                                # LOE rax rbx r12 r13 r14 r15d
-..B17.16:                       # Preds ..B17.15
-..LN2223:
-   .loc    1  1452
-        testq     %rax, %rax                                    #1452.27
-        je        ..B17.24      # Prob 1%                       #1452.27
-                                # LOE rax rbx r12 r13 r14 r15d
-..B17.17:                       # Preds ..B17.16
-..LN2225:
-   .loc    1  1458
-        movl      $11, (%rax)                                   #1458.17
-..LN2227:
-   .loc    1  1459
-        movl      %r15d, 4(%rax)                                #1459.17
-..LN2229:
-   .loc    1  1460
-        movq      (%r13), %rdx                                  #1460.41
-..LN2231:
-        movq      %rdx, 8(%rax)                                 #1460.17
-..LN2233:
-   .loc    1  1461
-        movq      %rax, (%r13)                                  #1461.17
-..LN2235:
-   .loc    1  1464
-        lea       16(%rax), %r13                                #1464.42
-        jmp       ..B17.2       # Prob 100%                     #1464.42
-                                # LOE rbx r12 r13 r14
-..B17.18:                       # Preds ..B17.11
-        movq      -16(%rbp), %r15                               #
-..___tag_value_nss_expr.639:                                    #
-..LN2237:
-   .loc    1  1439
-        movq      -48(%rbp), %rbx                               #1439.32
-..___tag_value_nss_expr.640:                                    #
-        movq      -40(%rbp), %r12                               #1439.32
-..___tag_value_nss_expr.641:                                    #
-        movq      -32(%rbp), %r13                               #1439.32
-..___tag_value_nss_expr.642:                                    #
-..LN2239:
-   .loc    1  1438
-        movl      $22, (%r14)                                   #1438.21
-..LN2241:
-   .loc    1  1439
-        movq      -24(%rbp), %r14                               #1439.32
-..___tag_value_nss_expr.643:                                    #
-        movq      %rbp, %rsp                                    #1439.32
-        popq      %rbp                                          #1439.32
-..___tag_value_nss_expr.644:                                    #
-        ret                                                     #1439.32
-..___tag_value_nss_expr.645:                                    #
-                                # LOE
-..B17.19:                       # Preds ..B17.6
-        movq      -16(%rbp), %r15                               #
-..___tag_value_nss_expr.651:                                    #
-..LN2243:
-   .loc    1  1425
-        movq      -48(%rbp), %rbx                               #1425.32
-..___tag_value_nss_expr.652:                                    #
-        movq      -40(%rbp), %r12                               #1425.32
-..___tag_value_nss_expr.653:                                    #
-        movq      -32(%rbp), %r13                               #1425.32
-..___tag_value_nss_expr.654:                                    #
-        movq      -24(%rbp), %r14                               #1425.32
-..___tag_value_nss_expr.655:                                    #
-        movq      %rbp, %rsp                                    #1425.32
-        popq      %rbp                                          #1425.32
-..___tag_value_nss_expr.656:                                    #
-        ret                                                     #1425.32
-..___tag_value_nss_expr.657:                                    #
-                                # LOE
-..B17.20:                       # Preds ..B17.4
-        movq      -16(%rbp), %r15                               #
-..___tag_value_nss_expr.663:                                    #
-                                # LOE rax r15
-..B17.21:                       # Preds ..B17.33 ..B17.20
-..LN2245:
-   .loc    1  1470
-        movq      -48(%rbp), %rbx                               #1470.12
-..___tag_value_nss_expr.665:                                    #
-        movq      -40(%rbp), %r12                               #1470.12
-..___tag_value_nss_expr.666:                                    #
-        movq      -32(%rbp), %r13                               #1470.12
-..___tag_value_nss_expr.667:                                    #
-        movq      -24(%rbp), %r14                               #1470.12
-..___tag_value_nss_expr.668:                                    #
-        movq      %rbp, %rsp                                    #1470.12
-        popq      %rbp                                          #1470.12
-..___tag_value_nss_expr.669:                                    #
-        ret                                                     #1470.12
-..___tag_value_nss_expr.670:                                    #
-                                # LOE
-..B17.33:                       # Preds ..B17.29 ..B17.27
-        movq      -16(%rbp), %r15                               #
-..___tag_value_nss_expr.675:                                    #
-        jmp       ..B17.21      # Prob 100%                     #
-..___tag_value_nss_expr.676:                                    #
-                                # LOE rax r15
-..B17.24:                       # Preds ..B17.16                # Infreq
-        movq      -16(%rbp), %r15                               #
-..___tag_value_nss_expr.677:                                    #
-..LN2247:
-   .loc    1  1454
-        call      __errno_location at PLT                          #1454.32
-..___tag_value_nss_expr.678:                                    #
-                                # LOE rax rbx r14 r15
-..B17.31:                       # Preds ..B17.24                # Infreq
-..LN2249:
-   .loc    1  1455
-        movq      -40(%rbp), %r12                               #1455.28
-..___tag_value_nss_expr.679:                                    #
-        movq      -32(%rbp), %r13                               #1455.28
-..___tag_value_nss_expr.680:                                    #
-..LN2251:
-   .loc    1  1454
-        movl      (%rax), %edx                                  #1454.32
-..LN2253:
-        movl      %edx, (%r14)                                  #1454.21
-..LN2255:
-   .loc    1  1455
-        movq      %rbx, %rax                                    #1455.28
-        movq      -48(%rbp), %rbx                               #1455.28
-..___tag_value_nss_expr.681:                                    #
-        movq      -24(%rbp), %r14                               #1455.28
-..___tag_value_nss_expr.682:                                    #
-        movq      %rbp, %rsp                                    #1455.28
-        popq      %rbp                                          #1455.28
-..___tag_value_nss_expr.683:                                    #
-        ret                                                     #1455.28
-        .align    16,0x90
-..___tag_value_nss_expr.684:                                    #
-                                # LOE
-# mark_end;
-	.type	nss_expr, at function
-	.size	nss_expr,.-nss_expr
-.LNnss_expr:
-	.data
-# -- End  nss_expr
-	.text
-# -- Begin  nss_unary_expr
-# mark_begin;
-       .align    16,0x90
-nss_unary_expr:
-# parameter 1(p): %rdi
-# parameter 2(end): %rsi
-# parameter 3(expr): %rdx
-# parameter 4(status): %rcx
-# parameter 5(positional): %r8d
-..B18.1:                        # Preds ..B18.0
-..___tag_value_nss_unary_expr.685:                              #1361.1
-..LN2257:
-   .loc    1  1361
-        pushq     %rbp                                          #1361.1
-        movq      %rsp, %rbp                                    #1361.1
-..___tag_value_nss_unary_expr.686:                              #
-        subq      $48, %rsp                                     #1361.1
-        movq      %r15, -48(%rbp)                               #1361.1
-..___tag_value_nss_unary_expr.688:                              #
-        movq      %r14, -40(%rbp)                               #1361.1
-..___tag_value_nss_unary_expr.689:                              #
-        movq      %r13, -32(%rbp)                               #1361.1
-..___tag_value_nss_unary_expr.690:                              #
-        movq      %r12, -24(%rbp)                               #1361.1
-..___tag_value_nss_unary_expr.691:                              #
-        movq      %rbx, -16(%rbp)                               #1361.1
-..___tag_value_nss_unary_expr.692:                              #
-        movl      %r8d, %r13d                                   #1361.1
-        movq      %rcx, %r15                                    #1361.1
-        movq      %rdx, %r12                                    #1361.1
-        movq      %rsi, %rbx                                    #1361.1
-        movq      %rdi, %r14                                    #1361.1
-        lea       _gprof_pack17(%rip), %rdx                     #1361.1
-        call      mcount at PLT                                    #1361.1
-        jmp       ..B18.2       # Prob 100%                     #1361.1
-                                # LOE rbx r12 r14 r15 r13d
-..B18.10:                       # Preds ..B18.9
-..LN2259:
-   .loc    1  1384
-        movl      $12, (%rax)                                   #1384.13
-..LN2261:
-   .loc    1  1385
-        movl      $13, 4(%rax)                                  #1385.13
-..LN2263:
-   .loc    1  1386
-        movq      $0, 8(%rax)                                   #1386.13
-..LN2265:
-   .loc    1  1387
-        movq      %rax, (%r12)                                  #1387.13
-..LN2267:
-   .loc    1  1389
-        lea       8(%rax), %r12                                 #1389.44
-                                # LOE rbx r12 r14 r15 r13d
-..B18.2:                        # Preds ..B18.10 ..B18.1
-..LN2269:
-   .loc    1  1363
-        movsbl    (%r14), %eax                                  #1363.12
-..LN2271:
-        cmpl      $33, %eax                                     #1363.17
-        je        ..B18.5       # Prob 33%                      #1363.17
-                                # LOE rbx r12 r14 r15 r13d
-..B18.3:                        # Preds ..B18.2
-..LN2273:
-   .loc    1  1364
-        movq      %r14, %rdi                                    #1364.16
-        movq      %rbx, %rsi                                    #1364.16
-        movq      %r12, %rdx                                    #1364.16
-        movq      %r15, %rcx                                    #1364.16
-        movl      %r13d, %r8d                                   #1364.16
-        call      nss_primary_expr at PLT                          #1364.16
-                                # LOE rax
-..B18.4:                        # Preds ..B18.3
-        movq      -16(%rbp), %rbx                               #1364.16
-..___tag_value_nss_unary_expr.693:                              #
-        movq      -24(%rbp), %r12                               #1364.16
-..___tag_value_nss_unary_expr.694:                              #
-        movq      -32(%rbp), %r13                               #1364.16
-..___tag_value_nss_unary_expr.695:                              #
-        movq      -40(%rbp), %r14                               #1364.16
-..___tag_value_nss_unary_expr.696:                              #
-        movq      -48(%rbp), %r15                               #1364.16
-..___tag_value_nss_unary_expr.697:                              #
-        movq      %rbp, %rsp                                    #1364.16
-        popq      %rbp                                          #1364.16
-..___tag_value_nss_unary_expr.698:                              #
-        ret                                                     #1364.16
-..___tag_value_nss_unary_expr.699:                              #
-                                # LOE
-..B18.5:                        # Preds ..B18.2
-..LN2275:
-   .loc    1  1374
-        incq      %r14                                          #1374.19
-..LN2277:
-        movq      %r14, %rdi                                    #1374.9
-        movq      %rbx, %rsi                                    #1374.9
-        call      nss_sob at PLT                                   #1374.9
-                                # LOE rax rbx r12 r15 r13d
-..B18.15:                       # Preds ..B18.5
-        movq      %rax, %r14                                    #1374.9
-..LN2279:
-   .loc    1  1375
-        cmpq      %rbx, %r14                                    #1375.15
-        jne       ..B18.8       # Prob 68%                      #1375.15
-                                # LOE rbx r12 r14 r15 r13d
-..B18.6:                        # Preds ..B18.15
-..LN2281:
-   .loc    1  1376
-        movl      $22, (%r15)                                   #1376.9
-                                # LOE r14
-..B18.7:                        # Preds ..B18.6 ..B18.17
-..LN2283:
-   .loc    1  1393
-        movq      -16(%rbp), %rbx                               #1393.12
-..___tag_value_nss_unary_expr.705:                              #
-        movq      -24(%rbp), %r12                               #1393.12
-..___tag_value_nss_unary_expr.706:                              #
-        movq      -32(%rbp), %r13                               #1393.12
-..___tag_value_nss_unary_expr.707:                              #
-        movq      -48(%rbp), %r15                               #1393.12
-..___tag_value_nss_unary_expr.708:                              #
-        movq      %r14, %rax                                    #1393.12
-        movq      -40(%rbp), %r14                               #1393.12
-..___tag_value_nss_unary_expr.709:                              #
-        movq      %rbp, %rsp                                    #1393.12
-        popq      %rbp                                          #1393.12
-..___tag_value_nss_unary_expr.710:                              #
-        ret                                                     #1393.12
-..___tag_value_nss_unary_expr.711:                              #
-                                # LOE
-..B18.8:                        # Preds ..B18.15
-..LN2285:
-   .loc    1  1379
-        movl      $16, %edi                                     #1379.25
-        call      malloc at PLT                                    #1379.25
-                                # LOE rax rbx r12 r14 r15 r13d
-..B18.9:                        # Preds ..B18.8
-..LN2287:
-   .loc    1  1380
-        testq     %rax, %rax                                    #1380.19
-        jne       ..B18.10      # Prob 99%                      #1380.19
-                                # LOE rax rbx r12 r14 r15 r13d
-..B18.11:                       # Preds ..B18.9                 # Infreq
-..LN2289:
-   .loc    1  1381
-        call      __errno_location at PLT                          #1381.24
-                                # LOE rax r14 r15
-..B18.17:                       # Preds ..B18.11                # Infreq
-        movl      (%rax), %edx                                  #1381.24
-..LN2291:
-        movl      %edx, (%r15)                                  #1381.13
-        jmp       ..B18.7       # Prob 100%                     #1381.13
-        .align    16,0x90
-..___tag_value_nss_unary_expr.717:                              #
-                                # LOE r14
-# mark_end;
-	.type	nss_unary_expr, at function
-	.size	nss_unary_expr,.-nss_unary_expr
-.LNnss_unary_expr:
-	.data
-# -- End  nss_unary_expr
-	.text
-# -- Begin  nss_primary_expr
-# mark_begin;
-       .align    16,0x90
-nss_primary_expr:
-# parameter 1(p): %rdi
-# parameter 2(end): %rsi
-# parameter 3(expr): %rdx
-# parameter 4(status): %rcx
-# parameter 5(positional): %r8d
-..B19.1:                        # Preds ..B19.0
-..___tag_value_nss_primary_expr.718:                            #1291.1
-..LN2293:
-   .loc    1  1291
-        pushq     %rbp                                          #1291.1
-        movq      %rsp, %rbp                                    #1291.1
-..___tag_value_nss_primary_expr.719:                            #
-        subq      $48, %rsp                                     #1291.1
-        movq      %r15, -40(%rbp)                               #1291.1
-..___tag_value_nss_primary_expr.721:                            #
-        movq      %r14, -32(%rbp)                               #1291.1
-..___tag_value_nss_primary_expr.722:                            #
-        movq      %r13, -24(%rbp)                               #1291.1
-..___tag_value_nss_primary_expr.723:                            #
-        movq      %r12, -16(%rbp)                               #1291.1
-..___tag_value_nss_primary_expr.724:                            #
-        movq      %rbx, -8(%rbp)                                #1291.1
-..___tag_value_nss_primary_expr.725:                            #
-        movl      %r8d, %ebx                                    #1291.1
-        movq      %rcx, %r15                                    #1291.1
-        movq      %rdx, %r14                                    #1291.1
-        movq      %rsi, %r13                                    #1291.1
-        movq      %rdi, %r12                                    #1291.1
-        lea       _gprof_pack18(%rip), %rdx                     #1291.1
-        call      mcount at PLT                                    #1291.1
-                                # LOE r12 r13 r14 r15 ebx
-..B19.32:                       # Preds ..B19.1
-..LN2295:
-   .loc    1  1295
-        movsbl    (%r12), %eax                                  #1295.16
-        cmpl      $94, %eax                                     #1295.16
-        jne       ..B19.8       # Prob 67%                      #1295.16
-                                # LOE r12 r13 r14 r15 eax ebx
-..B19.2:                        # Preds ..B19.32
-..LN2297:
-   .loc    1  1298
-        movl      $16, %edi                                     #1298.13
-        call      malloc at PLT                                    #1298.13
-                                # LOE rax r12 r13 r14 r15 ebx
-..B19.33:                       # Preds ..B19.2
-        movq      %rax, %rdx                                    #1298.13
-                                # LOE rdx r12 r13 r14 r15 ebx
-..B19.3:                        # Preds ..B19.33
-..LN2299:
-   .loc    1  1299
-        testq     %rdx, %rdx                                    #1299.19
-        jne       ..B19.5       # Prob 68%                      #1299.19
-                                # LOE rdx r12 r13 r14 r15 ebx
-..B19.4:                        # Preds ..B19.3
-..LN2301:
-   .loc    1  1300
-        call      __errno_location at PLT                          #1300.24
-                                # LOE rax r12 r15
-..B19.34:                       # Preds ..B19.4
-        movl      (%rax), %edx                                  #1300.24
-..LN2303:
-        movl      %edx, (%r15)                                  #1300.13
-        jmp       ..B19.7       # Prob 100%                     #1300.13
-                                # LOE r12
-..B19.5:                        # Preds ..B19.3
-..LN2305:
-   .loc    1  1303
-        movl      $12, (%rdx)                                   #1303.13
-..LN2307:
-   .loc    1  1308
-        movq      %rdx, -48(%rbp)                               #1308.17
-..LN2309:
-   .loc    1  1306
-        movq      %rdx, (%r14)                                  #1306.13
-..LN2311:
-   .loc    1  1308
-        incq      %r12                                          #1308.27
-..LN2313:
-   .loc    1  1304
-        movl      $14, 4(%rdx)                                  #1304.13
-..LN2315:
-   .loc    1  1308
-        movq      %r12, %rdi                                    #1308.17
-        movq      %r13, %rsi                                    #1308.17
-..LN2317:
-   .loc    1  1305
-        movq      $0, 8(%rdx)                                   #1305.13
-..LN2319:
-   .loc    1  1308
-        call      nss_sob at PLT                                   #1308.17
-                                # LOE rax r13 r15 ebx
-..B19.35:                       # Preds ..B19.5
-        movq      -48(%rbp), %rdx                               #
-..LN2321:
-   .loc    1  1309
-        addq      $8, %rdx                                      #1309.17
-        movq      %rax, %rdi                                    #1309.17
-        movq      %r13, %rsi                                    #1309.17
-        movq      %r15, %rcx                                    #1309.17
-        movl      %ebx, %r8d                                    #1309.17
-        call      nss_fasta_expr at PLT                            #1309.17
-                                # LOE rax
-..B19.36:                       # Preds ..B19.35
-        movq      %rax, %r12                                    #1309.17
-                                # LOE r12
-..B19.7:                        # Preds ..B19.36 ..B19.34
-..LN2323:
-   .loc    1  1311
-        movq      -8(%rbp), %rbx                                #1311.16
-..___tag_value_nss_primary_expr.726:                            #
-        movq      -24(%rbp), %r13                               #1311.16
-..___tag_value_nss_primary_expr.727:                            #
-        movq      -32(%rbp), %r14                               #1311.16
-..___tag_value_nss_primary_expr.728:                            #
-        movq      -40(%rbp), %r15                               #1311.16
-..___tag_value_nss_primary_expr.729:                            #
-        movq      %r12, %rax                                    #1311.16
-        movq      -16(%rbp), %r12                               #1311.16
-..___tag_value_nss_primary_expr.730:                            #
-        movq      %rbp, %rsp                                    #1311.16
-        popq      %rbp                                          #1311.16
-..___tag_value_nss_primary_expr.731:                            #
-        ret                                                     #1311.16
-..___tag_value_nss_primary_expr.732:                            #
-                                # LOE
-..B19.8:                        # Preds ..B19.32
-..LN2325:
-   .loc    1  1295
-        cmpl      $40, %eax                                     #1295.16
-        jne       ..B19.19      # Prob 50%                      #1295.16
-                                # LOE r12 r13 r14 r15 ebx
-..B19.9:                        # Preds ..B19.8
-..LN2327:
-   .loc    1  1313
-        movl      $16, %edi                                     #1313.13
-        call      malloc at PLT                                    #1313.13
-                                # LOE rax r12 r13 r14 r15 ebx
-..B19.37:                       # Preds ..B19.9
-        movq      %rax, %r9                                     #1313.13
-                                # LOE r9 r12 r13 r14 r15 ebx
-..B19.10:                       # Preds ..B19.37
-..LN2329:
-   .loc    1  1314
-        testq     %r9, %r9                                      #1314.19
-        jne       ..B19.12      # Prob 68%                      #1314.19
-                                # LOE r9 r12 r13 r14 r15 ebx
-..B19.11:                       # Preds ..B19.10
-..LN2331:
-   .loc    1  1315
-        call      __errno_location at PLT                          #1315.24
-                                # LOE rax r12 r15
-..B19.38:                       # Preds ..B19.11
-        movl      (%rax), %edx                                  #1315.24
-..LN2333:
-        movl      %edx, (%r15)                                  #1315.13
-        jmp       ..B19.18      # Prob 100%                     #1315.13
-                                # LOE r12
-..B19.12:                       # Preds ..B19.10
-..LN2335:
-   .loc    1  1318
-        movl      $12, (%r9)                                    #1318.13
-..LN2337:
-   .loc    1  1322
-        movq      %r9, -48(%rbp)                                #1322.17
-..LN2339:
-   .loc    1  1320
-        movq      %r9, (%r14)                                   #1320.13
-..LN2341:
-   .loc    1  1322
-        incq      %r12                                          #1322.28
-..LN2343:
-   .loc    1  1319
-        movl      $0, 4(%r9)                                    #1319.13
-..LN2345:
-   .loc    1  1322
-        lea       8(%r9), %rdx                                  #1322.42
-..LN2347:
-        movq      %r12, %rdi                                    #1322.17
-        movq      %r13, %rsi                                    #1322.17
-        movq      %r15, %rcx                                    #1322.17
-        movl      %ebx, %r8d                                    #1322.17
-        call      nss_expr at PLT                                  #1322.17
-                                # LOE rax r13 r15
-..B19.39:                       # Preds ..B19.12
-        movq      -48(%rbp), %r9                                #
-                                # LOE rax r9 r13 r15
-..B19.13:                       # Preds ..B19.39
-..LN2349:
-   .loc    1  1323
-        movl      (%r15), %edx                                  #1323.20
-..LN2351:
-   .loc    1  1322
-        movq      %rax, %r12                                    #1322.17
-..LN2353:
-   .loc    1  1323
-        testl     %edx, %edx                                    #1323.30
-        jne       ..B19.18      # Prob 50%                      #1323.30
-                                # LOE rax r9 r12 r13 r15
-..B19.14:                       # Preds ..B19.13
-..LN2355:
-   .loc    1  1325
-        movq      8(%r9), %rdx                                  #1325.22
-..LN2357:
-        testq     %rdx, %rdx                                    #1325.41
-        je        ..B19.17      # Prob 12%                      #1325.41
-                                # LOE rax r12 r13 r15
-..B19.15:                       # Preds ..B19.14
-..LN2359:
-        cmpq      %r13, %rax                                    #1325.54
-        je        ..B19.17      # Prob 12%                      #1325.54
-                                # LOE rax r12 r15
-..B19.16:                       # Preds ..B19.15
-..LN2361:
-        lea       1(%rax), %r12                                 #1325.63
-        movsbl    (%rax), %eax                                  #1325.63
-..LN2363:
-        cmpl      $41, %eax                                     #1325.71
-        je        ..B19.18      # Prob 16%                      #1325.71
-                                # LOE r12 r15
-..B19.17:                       # Preds ..B19.15 ..B19.14 ..B19.16
-..LN2365:
-   .loc    1  1326
-        movl      $22, (%r15)                                   #1326.21
-                                # LOE r12
-..B19.18:                       # Preds ..B19.17 ..B19.16 ..B19.38 ..B19.13
-..LN2367:
-   .loc    1  1329
-        movq      -8(%rbp), %rbx                                #1329.16
-..___tag_value_nss_primary_expr.738:                            #
-        movq      -24(%rbp), %r13                               #1329.16
-..___tag_value_nss_primary_expr.739:                            #
-        movq      -32(%rbp), %r14                               #1329.16
-..___tag_value_nss_primary_expr.740:                            #
-        movq      -40(%rbp), %r15                               #1329.16
-..___tag_value_nss_primary_expr.741:                            #
-        movq      %r12, %rax                                    #1329.16
-        movq      -16(%rbp), %r12                               #1329.16
-..___tag_value_nss_primary_expr.742:                            #
-        movq      %rbp, %rsp                                    #1329.16
-        popq      %rbp                                          #1329.16
-..___tag_value_nss_primary_expr.743:                            #
-        ret                                                     #1329.16
-..___tag_value_nss_primary_expr.744:                            #
-                                # LOE
-..B19.19:                       # Preds ..B19.8
-..LN2369:
-   .loc    1  1332
-        movq      %r12, %rdi                                    #1332.9
-        movq      %r13, %rsi                                    #1332.9
-        movq      %r14, %rdx                                    #1332.9
-        movq      %r15, %rcx                                    #1332.9
-        movl      %ebx, %r8d                                    #1332.9
-        call      nss_fasta_expr at PLT                            #1332.9
-                                # LOE rax r13 r14 r15
-..B19.40:                       # Preds ..B19.19
-        movq      %rax, %rbx                                    #1332.9
-                                # LOE rbx r13 r14 r15
-..B19.20:                       # Preds ..B19.40
-..LN2371:
-   .loc    1  1333
-        movl      (%r15), %eax                                  #1333.12
-..LN2373:
-        testl     %eax, %eax                                    #1333.22
-        jne       ..B19.24      # Prob 50%                      #1333.22
-                                # LOE rbx r13 r14 r15
-..B19.21:                       # Preds ..B19.20
-..LN2375:
-        cmpq      %r13, %rbx                                    #1333.31
-        jae       ..B19.24      # Prob 33%                      #1333.31
-                                # LOE rbx r13 r14 r15
-..B19.22:                       # Preds ..B19.21
-..LN2377:
-   .loc    1  1335
-        movq      %rbx, %rdi                                    #1335.13
-        movq      %r13, %rsi                                    #1335.13
-        call      nss_sob at PLT                                   #1335.13
-                                # LOE rax r13 r14 r15
-..B19.41:                       # Preds ..B19.22
-        movq      %rax, %rbx                                    #1335.13
-..LN2379:
-   .loc    1  1336
-        cmpq      %r13, %rbx                                    #1336.18
-        jae       ..B19.24      # Prob 12%                      #1336.18
-                                # LOE rbx r14 r15
-..B19.23:                       # Preds ..B19.41
-..LN2381:
-        movsbl    (%rbx), %eax                                  #1336.27
-..LN2383:
-        cmpl      $36, %eax                                     #1336.32
-        je        ..B19.26      # Prob 5%                       #1336.32
-                                # LOE rbx r14 r15
-..B19.24:                       # Preds ..B19.43 ..B19.28 ..B19.23 ..B19.41 ..B19.21
-                                #       ..B19.20
-..LN2385:
-   .loc    1  1353
-        movq      -16(%rbp), %r12                               #1353.12
-..___tag_value_nss_primary_expr.750:                            #
-        movq      -24(%rbp), %r13                               #1353.12
-..___tag_value_nss_primary_expr.751:                            #
-        movq      -32(%rbp), %r14                               #1353.12
-..___tag_value_nss_primary_expr.752:                            #
-        movq      -40(%rbp), %r15                               #1353.12
-..___tag_value_nss_primary_expr.753:                            #
-        movq      %rbx, %rax                                    #1353.12
-        movq      -8(%rbp), %rbx                                #1353.12
-..___tag_value_nss_primary_expr.754:                            #
-        movq      %rbp, %rsp                                    #1353.12
-        popq      %rbp                                          #1353.12
-..___tag_value_nss_primary_expr.755:                            #
-        ret                                                     #1353.12
-..___tag_value_nss_primary_expr.756:                            #
-                                # LOE
-..B19.26:                       # Preds ..B19.23                # Infreq
-..LN2387:
-   .loc    1  1338
-        incq      %rbx                                          #1338.16
-..LN2389:
-   .loc    1  1340
-        movl      $16, %edi                                     #1340.17
-        call      malloc at PLT                                    #1340.17
-                                # LOE rax rbx r14 r15
-..B19.27:                       # Preds ..B19.26                # Infreq
-..LN2391:
-   .loc    1  1341
-        testq     %rax, %rax                                    #1341.23
-        je        ..B19.29      # Prob 12%                      #1341.23
-                                # LOE rax rbx r14 r15
-..B19.28:                       # Preds ..B19.27                # Infreq
-..LN2393:
-   .loc    1  1347
-        movq      (%r14), %rdx                                  #1347.37
-..LN2395:
-   .loc    1  1345
-        movl      $12, (%rax)                                   #1345.17
-..LN2397:
-   .loc    1  1347
-        movq      %rdx, 8(%rax)                                 #1347.17
-..LN2399:
-   .loc    1  1348
-        movq      %rax, (%r14)                                  #1348.17
-..LN2401:
-   .loc    1  1346
-        movl      $15, 4(%rax)                                  #1346.17
-        jmp       ..B19.24      # Prob 100%                     #1346.17
-                                # LOE rbx
-..B19.29:                       # Preds ..B19.27                # Infreq
-..LN2403:
-   .loc    1  1342
-        call      __errno_location at PLT                          #1342.28
-                                # LOE rax rbx r15
-..B19.43:                       # Preds ..B19.29                # Infreq
-        movl      (%rax), %edx                                  #1342.28
-..LN2405:
-        movl      %edx, (%r15)                                  #1342.17
-        jmp       ..B19.24      # Prob 100%                     #1342.17
-        .align    16,0x90
-..___tag_value_nss_primary_expr.762:                            #
-                                # LOE rbx
-# mark_end;
-	.type	nss_primary_expr, at function
-	.size	nss_primary_expr,.-nss_primary_expr
-.LNnss_primary_expr:
-	.data
-# -- End  nss_primary_expr
-	.text
-# -- Begin  nss_sob
-# mark_begin;
-       .align    16,0x90
-nss_sob:
-# parameter 1(p): %rdi
-# parameter 2(end): %rsi
-..B20.1:                        # Preds ..B20.0
-..___tag_value_nss_sob.763:                                     #1181.1
-..LN2407:
-   .loc    1  1181
-        pushq     %rbp                                          #1181.1
-        movq      %rsp, %rbp                                    #1181.1
-..___tag_value_nss_sob.764:                                     #
-        subq      $32, %rsp                                     #1181.1
-        movq      %r15, -24(%rbp)                               #1181.1
-..___tag_value_nss_sob.766:                                     #
-        movq      %r14, -16(%rbp)                               #1181.1
-..___tag_value_nss_sob.767:                                     #
-        movq      %r13, -8(%rbp)                                #1181.1
-..___tag_value_nss_sob.768:                                     #
-        movq      %rbx, -32(%rbp)                               #1181.1
-..___tag_value_nss_sob.769:                                     #
-        movq      %rsi, %rbx                                    #1181.1
-        movq      %rdi, %r15                                    #1181.1
-        lea       _gprof_pack19(%rip), %rdx                     #1181.1
-        call      mcount at PLT                                    #1181.1
-                                # LOE rbx r12 r15
-..B20.10:                       # Preds ..B20.1
-        movq      %r15, %r14                                    #1181.1
-..LN2409:
-   .loc    1  1182
-        xorl      %r13d, %r13d                                  #1182.5
-..LN2411:
-        cmpq      %rbx, %r15                                    #1182.17
-        jae       ..B20.6       # Prob 2%                       #1182.17
-                                # LOE rbx r12 r13 r14 r15
-..B20.2:                        # Preds ..B20.10
-..LN2413:
-        call      __ctype_b_loc at PLT                             #1182.24
-                                # LOE rax rbx r12 r13 r14 r15
-..B20.11:                       # Preds ..B20.2
-        movq      (%rax), %rax                                  #1182.24
-..LN2415:
-   .loc    1  1181
-        subq      %r15, %rbx                                    #1181.1
-                                # LOE rax rbx r12 r13 r14 r15
-..B20.3:                        # Preds ..B20.4 ..B20.11
-..LN2417:
-   .loc    1  1182
-        movzbl    (%r13,%r14), %edx                             #1182.24
-        movzwl    (%rax,%rdx,2), %ecx                           #1182.24
-        testl     $8192, %ecx                                   #1182.24
-        je        ..B20.6       # Prob 20%                      #1182.24
-                                # LOE rax rbx r12 r13 r14 r15
-..B20.4:                        # Preds ..B20.3
-..LN2419:
-   .loc    1  1183
-        lea       1(%r13,%r14), %r15                            #1183.12
-..LN2421:
-   .loc    1  1182
-        incq      %r13                                          #1182.5
-        cmpq      %rbx, %r13                                    #1182.5
-        jb        ..B20.3       # Prob 82%                      #1182.5
-                                # LOE rax rbx r12 r13 r14 r15
-..B20.6:                        # Preds ..B20.3 ..B20.4 ..B20.10
-..LN2423:
-   .loc    1  1184
-        movq      -32(%rbp), %rbx                               #1184.12
-..___tag_value_nss_sob.770:                                     #
-        movq      -8(%rbp), %r13                                #1184.12
-..___tag_value_nss_sob.771:                                     #
-        movq      -16(%rbp), %r14                               #1184.12
-..___tag_value_nss_sob.772:                                     #
-        movq      %r15, %rax                                    #1184.12
-        movq      -24(%rbp), %r15                               #1184.12
-..___tag_value_nss_sob.773:                                     #
-        movq      %rbp, %rsp                                    #1184.12
-        popq      %rbp                                          #1184.12
-..___tag_value_nss_sob.774:                                     #
-        ret                                                     #1184.12
-        .align    16,0x90
-..___tag_value_nss_sob.775:                                     #
-                                # LOE
-# mark_end;
-	.type	nss_sob, at function
-	.size	nss_sob,.-nss_sob
-.LNnss_sob:
-	.data
-# -- End  nss_sob
-	.text
-# -- Begin  nss_fasta_expr
-# mark_begin;
-       .align    16,0x90
-nss_fasta_expr:
-# parameter 1(p): %rdi
-# parameter 2(end): %rsi
-# parameter 3(expr): %rdx
-# parameter 4(status): %rcx
-# parameter 5(positional): %r8d
-..B21.1:                        # Preds ..B21.0
-..___tag_value_nss_fasta_expr.776:                              #1234.1
-..LN2425:
-   .loc    1  1234
-        pushq     %rbp                                          #1234.1
-        movq      %rsp, %rbp                                    #1234.1
-..___tag_value_nss_fasta_expr.777:                              #
-        subq      $48, %rsp                                     #1234.1
-        movq      %r15, -24(%rbp)                               #1234.1
-..___tag_value_nss_fasta_expr.779:                              #
-        movq      %r14, -16(%rbp)                               #1234.1
-..___tag_value_nss_fasta_expr.780:                              #
-        movq      %r13, -48(%rbp)                               #1234.1
-..___tag_value_nss_fasta_expr.781:                              #
-        movq      %r12, -40(%rbp)                               #1234.1
-..___tag_value_nss_fasta_expr.782:                              #
-        movq      %rbx, -32(%rbp)                               #1234.1
-..___tag_value_nss_fasta_expr.783:                              #
-        movl      %r8d, %r13d                                   #1234.1
-        movq      %rcx, %r15                                    #1234.1
-        movq      %rdx, %r12                                    #1234.1
-        movq      %rsi, %r14                                    #1234.1
-        movq      %rdi, %rbx                                    #1234.1
-        lea       _gprof_pack20(%rip), %rdx                     #1234.1
-        call      mcount at PLT                                    #1234.1
-                                # LOE rbx r12 r14 r15 r13d
-..B21.20:                       # Preds ..B21.1
-..LN2427:
-   .loc    1  1236
-        movsbl    (%rbx), %eax                                  #1236.16
-        cmpl      $39, %eax                                     #1236.16
-        jne       ..B21.7       # Prob 67%                      #1236.16
-                                # LOE rbx r12 r14 r15 eax r13d
-..B21.2:                        # Preds ..B21.20
-..LN2429:
-   .loc    1  1239
-        incq      %rbx                                          #1239.30
-..LN2431:
-        movq      %rbx, %rdi                                    #1239.13
-        movq      %r14, %rsi                                    #1239.13
-        movq      %r12, %rdx                                    #1239.13
-        movq      %r15, %rcx                                    #1239.13
-        movl      %r13d, %r8d                                   #1239.13
-        call      nss_FASTA_expr at PLT                            #1239.13
-                                # LOE rax r14 r15
-..B21.3:                        # Preds ..B21.2
-..LN2433:
-   .loc    1  1240
-        movl      (%r15), %edx                                  #1240.16
-..LN2435:
-   .loc    1  1239
-        movq      %rax, %rcx                                    #1239.13
-..LN2437:
-   .loc    1  1240
-        testl     %edx, %edx                                    #1240.26
-        jne       ..B21.13      # Prob 50%                      #1240.26
-                                # LOE rax rcx r14 r15
-..B21.4:                        # Preds ..B21.3
-..LN2439:
-        cmpq      %r14, %rax                                    #1240.38
-        je        ..B21.12      # Prob 12%                      #1240.38
-                                # LOE rax rcx r15
-..B21.5:                        # Preds ..B21.4
-..LN2441:
-        movsbl    (%rax), %edx                                  #1240.47
-        lea       1(%rax), %rcx                                 #1240.47
-..LN2443:
-        cmpl      $39, %edx                                     #1240.55
-        jne       ..B21.12      # Prob 84%                      #1240.55
-        jmp       ..B21.13      # Prob 100%                     #1240.55
-                                # LOE rcx r15
-..B21.7:                        # Preds ..B21.20
-..LN2445:
-   .loc    1  1236
-        cmpl      $34, %eax                                     #1236.16
-        jne       ..B21.14      # Prob 50%                      #1236.16
-                                # LOE rbx r12 r14 r15 r13d
-..B21.8:                        # Preds ..B21.7
-..LN2447:
-   .loc    1  1244
-        incq      %rbx                                          #1244.30
-..LN2449:
-        movq      %rbx, %rdi                                    #1244.13
-        movq      %r14, %rsi                                    #1244.13
-        movq      %r12, %rdx                                    #1244.13
-        movq      %r15, %rcx                                    #1244.13
-        movl      %r13d, %r8d                                   #1244.13
-        call      nss_FASTA_expr at PLT                            #1244.13
-                                # LOE rax r14 r15
-..B21.9:                        # Preds ..B21.8
-..LN2451:
-   .loc    1  1245
-        movl      (%r15), %edx                                  #1245.16
-..LN2453:
-   .loc    1  1244
-        movq      %rax, %rcx                                    #1244.13
-..LN2455:
-   .loc    1  1245
-        testl     %edx, %edx                                    #1245.26
-        jne       ..B21.13      # Prob 50%                      #1245.26
-                                # LOE rax rcx r14 r15
-..B21.10:                       # Preds ..B21.9
-..LN2457:
-        cmpq      %r14, %rax                                    #1245.38
-        je        ..B21.12      # Prob 12%                      #1245.38
-                                # LOE rax rcx r15
-..B21.11:                       # Preds ..B21.10
-..LN2459:
-        movsbl    (%rax), %edx                                  #1245.47
-        lea       1(%rax), %rcx                                 #1245.47
-..LN2461:
-        cmpl      $34, %edx                                     #1245.55
-        je        ..B21.13      # Prob 16%                      #1245.55
-                                # LOE rcx r15
-..B21.12:                       # Preds ..B21.10 ..B21.4 ..B21.5 ..B21.11
-..LN2463:
-   .loc    1  1246
-        movl      $22, (%r15)                                   #1246.13
-                                # LOE rcx
-..B21.13:                       # Preds ..B21.5 ..B21.12 ..B21.11 ..B21.3 ..B21.9
-                                #      
-..LN2465:
-   .loc    1  1252
-        movq      -32(%rbp), %rbx                               #1252.12
-..___tag_value_nss_fasta_expr.784:                              #
-        movq      -40(%rbp), %r12                               #1252.12
-..___tag_value_nss_fasta_expr.785:                              #
-        movq      -48(%rbp), %r13                               #1252.12
-..___tag_value_nss_fasta_expr.786:                              #
-        movq      -16(%rbp), %r14                               #1252.12
-..___tag_value_nss_fasta_expr.787:                              #
-        movq      %rcx, %rax                                    #1252.12
-        movq      -24(%rbp), %r15                               #1252.12
-..___tag_value_nss_fasta_expr.788:                              #
-        movq      %rbp, %rsp                                    #1252.12
-        popq      %rbp                                          #1252.12
-..___tag_value_nss_fasta_expr.789:                              #
-        ret                                                     #1252.12
-..___tag_value_nss_fasta_expr.790:                              #
-                                # LOE
-..B21.14:                       # Preds ..B21.7
-..LN2467:
-   .loc    1  1249
-        movq      %rbx, %rdi                                    #1249.16
-        movq      %r14, %rsi                                    #1249.16
-        movq      %r12, %rdx                                    #1249.16
-        movq      %r15, %rcx                                    #1249.16
-        movl      %r13d, %r8d                                   #1249.16
-        call      nss_FASTA_expr at PLT                            #1249.16
-                                # LOE rax
-..B21.15:                       # Preds ..B21.14
-        movq      -32(%rbp), %rbx                               #1249.16
-..___tag_value_nss_fasta_expr.796:                              #
-        movq      -40(%rbp), %r12                               #1249.16
-..___tag_value_nss_fasta_expr.797:                              #
-        movq      -48(%rbp), %r13                               #1249.16
-..___tag_value_nss_fasta_expr.798:                              #
-        movq      -16(%rbp), %r14                               #1249.16
-..___tag_value_nss_fasta_expr.799:                              #
-        movq      -24(%rbp), %r15                               #1249.16
-..___tag_value_nss_fasta_expr.800:                              #
-        movq      %rbp, %rsp                                    #1249.16
-        popq      %rbp                                          #1249.16
-..___tag_value_nss_fasta_expr.801:                              #
-        ret                                                     #1249.16
-        .align    16,0x90
-..___tag_value_nss_fasta_expr.802:                              #
-                                # LOE
-# mark_end;
-	.type	nss_fasta_expr, at function
-	.size	nss_fasta_expr,.-nss_fasta_expr
-.LNnss_fasta_expr:
-	.data
-# -- End  nss_fasta_expr
-	.text
-# -- Begin  nss_FASTA_expr
-# mark_begin;
-       .align    16,0x90
-nss_FASTA_expr:
-# parameter 1(p): %rdi
-# parameter 2(end): %rsi
-# parameter 3(expr): %rdx
-# parameter 4(status): %rcx
-# parameter 5(positional): %r8d
-..B22.1:                        # Preds ..B22.0
-..___tag_value_nss_FASTA_expr.803:                              #1192.1
-..LN2469:
-   .loc    1  1192
-        pushq     %rbp                                          #1192.1
-        movq      %rsp, %rbp                                    #1192.1
-..___tag_value_nss_FASTA_expr.804:                              #
-        subq      $48, %rsp                                     #1192.1
-        movq      %r15, -48(%rbp)                               #1192.1
-..___tag_value_nss_FASTA_expr.806:                              #
-        movq      %r14, -40(%rbp)                               #1192.1
-..___tag_value_nss_FASTA_expr.807:                              #
-        movq      %r13, -32(%rbp)                               #1192.1
-..___tag_value_nss_FASTA_expr.808:                              #
-        movq      %r12, -24(%rbp)                               #1192.1
-..___tag_value_nss_FASTA_expr.809:                              #
-        movq      %rbx, -16(%rbp)                               #1192.1
-..___tag_value_nss_FASTA_expr.810:                              #
-        movl      %r8d, %r15d                                   #1192.1
-        movq      %rcx, %r14                                    #1192.1
-        movq      %rdx, %r13                                    #1192.1
-        movq      %rsi, %rbx                                    #1192.1
-        movq      %rdi, %r12                                    #1192.1
-        lea       _gprof_pack21(%rip), %rdx                     #1192.1
-        call      mcount at PLT                                    #1192.1
-                                # LOE rbx r12 r13 r14 r15d
-..B22.24:                       # Preds ..B22.1
-..LN2471:
-   .loc    1  1193
-        cmpq      %rbx, %r12                                    #1193.15
-        jae       ..B22.9       # Prob 44%                      #1193.15
-                                # LOE rbx r12 r13 r14 r15d
-..B22.3:                        # Preds ..B22.24
-..LN2473:
-   .loc    1  1192
-        movq      %r12, %rdx                                    #1192.1
-..LN2475:
-   .loc    1  1199
-        xorl      %eax, %eax                                    #1199.22
-..LN2477:
-   .loc    1  1200
-        lea       fasta_2na_map.0(%rip), %rcx                   #1200.27
-                                # LOE rdx rcx rbx r12 r13 r14 eax r15d
-..B22.4:                        # Preds ..B22.6 ..B22.3
-..LN2479:
-   .loc    1  1203
-        movsbl    (%r12), %esi                                  #1203.20
-..LN2481:
-        testl     %esi, %esi                                    #1203.24
-        jl        ..B22.8       # Prob 20%                      #1203.24
-                                # LOE rdx rcx rbx r12 r13 r14 eax r15d
-..B22.5:                        # Preds ..B22.4
-..LN2483:
-   .loc    1  1206
-        movzbl    (%r12), %esi                                  #1206.45
-..LN2485:
-        movsbl    (%rsi,%rcx), %edi                             #1206.18
-..LN2487:
-        testl     %edi, %edi                                    #1206.51
-        jl        ..B22.16      # Prob 16%                      #1206.51
-                                # LOE rdx rcx rbx r12 r13 r14 eax esi r15d
-..B22.6:                        # Preds ..B22.18 ..B22.5
-..LN2489:
-   .loc    1  1216
-        incq      %r12                                          #1216.20
-..LN2491:
-        cmpq      %rbx, %r12                                    #1216.24
-        jb        ..B22.4       # Prob 82%                      #1216.24
-                                # LOE rdx rcx rbx r12 r13 r14 eax r15d
-..B22.8:                        # Preds ..B22.17 ..B22.16 ..B22.4 ..B22.6
-..LN2493:
-   .loc    1  1218
-        cmpq      %rdx, %r12                                    #1218.19
-        ja        ..B22.11      # Prob 12%                      #1218.19
-                                # LOE rdx r12 r13 r14 eax r15d
-..B22.9:                        # Preds ..B22.24 ..B22.8
-..LN2495:
-   .loc    1  1219
-        movl      $22, (%r14)                                   #1219.13
-                                # LOE r12
-..B22.10:                       # Preds ..B22.9 ..B22.13 ..B22.15
-..LN2497:
-   .loc    1  1226
-        movq      -16(%rbp), %rbx                               #1226.12
-..___tag_value_nss_FASTA_expr.811:                              #
-        movq      -32(%rbp), %r13                               #1226.12
-..___tag_value_nss_FASTA_expr.812:                              #
-        movq      -40(%rbp), %r14                               #1226.12
-..___tag_value_nss_FASTA_expr.813:                              #
-        movq      -48(%rbp), %r15                               #1226.12
-..___tag_value_nss_FASTA_expr.814:                              #
-        movq      %r12, %rax                                    #1226.12
-        movq      -24(%rbp), %r12                               #1226.12
-..___tag_value_nss_FASTA_expr.815:                              #
-        movq      %rbp, %rsp                                    #1226.12
-        popq      %rbp                                          #1226.12
-..___tag_value_nss_FASTA_expr.816:                              #
-        ret                                                     #1226.12
-..___tag_value_nss_FASTA_expr.817:                              #
-                                # LOE
-..B22.11:                       # Preds ..B22.8                 # Infreq
-..LN2499:
-   .loc    1  1220
-        testl     %eax, %eax                                    #1220.27
-        jne       ..B22.14      # Prob 50%                      #1220.27
-                                # LOE rdx r12 r13 r14 r15d
-..B22.12:                       # Preds ..B22.11                # Infreq
-..LN2501:
-   .loc    1  1221
-        movq      %r12, %rcx                                    #1221.72
-        subq      %rdx, %rcx                                    #1221.72
-..LN2503:
-        movq      %r13, %rdi                                    #1221.24
-        movl      %r15d, %esi                                   #1221.24
-        call      NucStrFastaExprMake2 at PLT                      #1221.24
-                                # LOE r12 r14 eax
-..B22.13:                       # Preds ..B22.12                # Infreq
-..LN2505:
-        movl      %eax, (%r14)                                  #1221.13
-        jmp       ..B22.10      # Prob 100%                     #1221.13
-                                # LOE r12
-..B22.14:                       # Preds ..B22.11                # Infreq
-..LN2507:
-   .loc    1  1223
-        movq      %r12, %rcx                                    #1223.72
-        subq      %rdx, %rcx                                    #1223.72
-..LN2509:
-        movq      %r13, %rdi                                    #1223.24
-        movl      %r15d, %esi                                   #1223.24
-        call      NucStrFastaExprMake4 at PLT                      #1223.24
-                                # LOE r12 r14 eax
-..B22.15:                       # Preds ..B22.14                # Infreq
-..LN2511:
-        movl      %eax, (%r14)                                  #1223.13
-        jmp       ..B22.10      # Prob 100%                     #1223.13
-                                # LOE r12
-..B22.16:                       # Preds ..B22.5                 # Infreq
-..LN2513:
-   .loc    1  1208
-        lea       fasta_4na_map.0(%rip), %rdi                   #1208.29
-        cmpq      %rdi, %rcx                                    #1208.29
-        je        ..B22.8       # Prob 20%                      #1208.29
-                                # LOE rdx rbx r12 r13 r14 eax esi r15d
-..B22.17:                       # Preds ..B22.16                # Infreq
-..LN2515:
-   .loc    1  1210
-        movl      %esi, %esi                                    #1210.22
-        lea       fasta_4na_map.0(%rip), %rcx                   #1210.22
-        movsbl    (%rcx,%rsi), %edi                             #1210.22
-..LN2517:
-        testl     %edi, %edi                                    #1210.65
-        jl        ..B22.8       # Prob 20%                      #1210.65
-                                # LOE rdx rbx r12 r13 r14 eax r15d
-..B22.18:                       # Preds ..B22.17                # Infreq
-..LN2519:
-   .loc    1  1212
-        movl      $1, %eax                                      #1212.17
-..LN2521:
-   .loc    1  1213
-        lea       fasta_4na_map.0(%rip), %rcx                   #1213.23
-        jmp       ..B22.6       # Prob 100%                     #1213.23
-        .align    16,0x90
-..___tag_value_nss_FASTA_expr.823:                              #
-                                # LOE rdx rcx rbx r12 r13 r14 eax r15d
-# mark_end;
-	.type	nss_FASTA_expr, at function
-	.size	nss_FASTA_expr,.-nss_FASTA_expr
-.LNnss_FASTA_expr:
-	.data
-# -- End  nss_FASTA_expr
-	.text
-# -- Begin  NucStrFastaExprMake2
-# mark_begin;
-       .align    16,0x90
-NucStrFastaExprMake2:
-# parameter 1(expr): %rdi
-# parameter 2(positional): %esi
-# parameter 3(fasta): %rdx
-# parameter 4(size): %rcx
-..B23.1:                        # Preds ..B23.0
-..___tag_value_NucStrFastaExprMake2.824:                        #838.1
-..LN2523:
-   .loc    1  838
-        pushq     %rbp                                          #838.1
-        movq      %rsp, %rbp                                    #838.1
-..___tag_value_NucStrFastaExprMake2.825:                        #
-        subq      $80, %rsp                                     #838.1
-        movq      %r15, -32(%rbp)                               #838.1
-..___tag_value_NucStrFastaExprMake2.827:                        #
-        movq      %r14, -48(%rbp)                               #838.1
-..___tag_value_NucStrFastaExprMake2.828:                        #
-        movq      %r13, -40(%rbp)                               #838.1
-..___tag_value_NucStrFastaExprMake2.829:                        #
-        movq      %r12, -16(%rbp)                               #838.1
-..___tag_value_NucStrFastaExprMake2.830:                        #
-        movq      %rbx, -24(%rbp)                               #838.1
-..___tag_value_NucStrFastaExprMake2.831:                        #
-        movq      %rcx, %r13                                    #838.1
-        movq      %rdx, %r14                                    #838.1
-        movl      %esi, %r12d                                   #838.1
-        movq      %rdi, %r15                                    #838.1
-        lea       _gprof_pack22(%rip), %rdx                     #838.1
-        call      mcount at PLT                                    #838.1
-                                # LOE r13 r14 r15 r12d
-..B23.60:                       # Preds ..B23.1
-..LN2525:
-   .loc    1  844
-        cmpq      $61, %r13                                     #844.17
-        jbe       ..B23.3       # Prob 43%                      #844.17
-                                # LOE r13 r14 r15 r12d
-..B23.2:                        # Preds ..B23.60
-..LN2527:
-   .loc    1  845
-        movq      -24(%rbp), %rbx                               #845.16
-..___tag_value_NucStrFastaExprMake2.832:                        #
-        movq      -16(%rbp), %r12                               #845.16
-..___tag_value_NucStrFastaExprMake2.833:                        #
-        movq      -40(%rbp), %r13                               #845.16
-..___tag_value_NucStrFastaExprMake2.834:                        #
-        movq      -48(%rbp), %r14                               #845.16
-..___tag_value_NucStrFastaExprMake2.835:                        #
-        movl      $7, %eax                                      #845.16
-        movq      -32(%rbp), %r15                               #845.16
-..___tag_value_NucStrFastaExprMake2.836:                        #
-        movq      %rbp, %rsp                                    #845.16
-        popq      %rbp                                          #845.16
-..___tag_value_NucStrFastaExprMake2.837:                        #
-        ret                                                     #845.16
-..___tag_value_NucStrFastaExprMake2.838:                        #
-                                # LOE
-..B23.3:                        # Preds ..B23.60
-..LN2529:
-   .loc    1  847
-        movl      $144, %edi                                    #847.9
-        call      NucStrFastaExprAlloc at PLT                      #847.9
-                                # LOE rax r13 r14 r15 r12d
-..B23.61:                       # Preds ..B23.3
-        movq      %rax, %rbx                                    #847.9
-                                # LOE rbx r13 r14 r15 r12d
-..B23.4:                        # Preds ..B23.61
-..LN2531:
-   .loc    1  848
-        testq     %rbx, %rbx                                    #848.15
-        je        ..B23.57      # Prob 5%                       #848.15
-                                # LOE rbx r13 r14 r15 r12d
-..B23.5:                        # Preds ..B23.4
-..LN2533:
-   .loc    1  851
-        movq      %rbx, (%r15)                                  #851.5
-..LN2535:
-   .loc    1  852
-        movl      %r13d, 4(%rbx)                                #852.5
-..LN2537:
-   .loc    1  856
-        xorl      %edi, %edi                                    #856.11
-..LN2539:
-        testq     %r13, %r13                                    #856.22
-        jbe       ..B23.16      # Prob 16%                      #856.22
-                                # LOE rbx rdi r13 r14 r12d
-..B23.7:                        # Preds ..B23.5 ..B23.14
-..LN2541:
-   .loc    1  858
-        movsbq    (%rdi,%r14), %rdx                             #858.48
-..LN2543:
-        lea       fasta_2na_map.0(%rip), %rax                   #858.24
-        movzbl    (%rax,%rdx), %edx                             #858.24
-..LN2545:
-   .loc    1  859
-        movq      %rdi, %rax                                    #859.22
-        andq      $3, %rax                                      #859.22
-        je        ..B23.56      # Prob 20%                      #859.22
-                                # LOE rax rbx rdi r13 r14 edx r12d
-..B23.8:                        # Preds ..B23.7
-        cmpq      $1, %rax                                      #859.22
-        je        ..B23.13      # Prob 25%                      #859.22
-                                # LOE rax rbx rdi r13 r14 edx r12d
-..B23.9:                        # Preds ..B23.8
-        cmpq      $2, %rax                                      #859.22
-        jne       ..B23.11      # Prob 67%                      #859.22
-                                # LOE rax rbx rdi r13 r14 edx r12d
-..B23.10:                       # Preds ..B23.9
-..LN2547:
-   .loc    1  870
-        movq      %rdi, %rax                                    #870.32
-        shrq      $2, %rax                                      #870.32
-..LN2549:
-        shll      $2, %edx                                      #870.47
-..LN2551:
-        orb       %dl, -80(%rbp,%rax)                           #870.13
-..LN2553:
-   .loc    1  871
-        orb       $12, -64(%rbp,%rax)                           #871.13
-        jmp       ..B23.14      # Prob 100%                     #871.13
-                                # LOE rbx rdi r13 r14 r12d
-..B23.11:                       # Preds ..B23.9
-..LN2555:
-   .loc    1  859
-        cmpq      $3, %rax                                      #859.22
-        jne       ..B23.14      # Prob 50%                      #859.22
-                                # LOE rbx rdi r13 r14 edx r12d
-..B23.12:                       # Preds ..B23.11
-..LN2557:
-   .loc    1  874
-        movq      %rdi, %rax                                    #874.32
-        shrq      $2, %rax                                      #874.32
-..LN2559:
-        orb       %dl, -80(%rbp,%rax)                           #874.13
-..LN2561:
-   .loc    1  875
-        orb       $3, -64(%rbp,%rax)                            #875.13
-        jmp       ..B23.14      # Prob 100%                     #875.13
-                                # LOE rbx rdi r13 r14 r12d
-..B23.13:                       # Preds ..B23.8
-..LN2563:
-   .loc    1  866
-        movq      %rdi, %rax                                    #866.32
-        shrq      $2, %rax                                      #866.32
-..LN2565:
-        shll      $4, %edx                                      #866.47
-..LN2567:
-        orb       %dl, -80(%rbp,%rax)                           #866.13
-..LN2569:
-   .loc    1  867
-        orb       $48, -64(%rbp,%rax)                           #867.13
-                                # LOE rbx rdi r13 r14 r12d
-..B23.14:                       # Preds ..B23.11 ..B23.56 ..B23.13 ..B23.10 ..B23.12
-                                #      
-..LN2571:
-   .loc    1  856
-        incq      %rdi                                          #856.31
-..LN2573:
-        cmpq      %r13, %rdi                                    #856.22
-        jb        ..B23.7       # Prob 82%                      #856.22
-                                # LOE rbx rdi r13 r14 r12d
-..B23.16:                       # Preds ..B23.14 ..B23.5
-..LN2575:
-   .loc    1  881
-        addq      $3, %rdi                                      #881.21
-..LN2577:
-        shrq      $2, %rdi                                      #881.28
-..LN2579:
-        cmpq      $16, %rdi                                     #881.35
-        jae       ..B23.29      # Prob 50%                      #881.35
-                                # LOE rbx rdi r13 r12d
-..B23.17:                       # Preds ..B23.16
-..LN2581:
-   .loc    1  883
-        lea       -80(%rbp), %rdx                               #883.9
-..LN2583:
-   .loc    1  881
-        movq      %rdi, %rsi                                    #881.5
-        negq      %rsi                                          #881.5
-        addq      $16, %rsi                                     #881.5
-        lea       (%rdx,%rdi), %rcx                             #881.5
-        movq      %rcx, %rdx                                    #881.5
-        andq      $15, %rdx                                     #881.5
-        movq      %rdx, %rax                                    #881.5
-        negq      %rax                                          #881.5
-        addq      $16, %rax                                     #881.5
-        cmpq      $0, %rdx                                      #881.5
-        cmovne    %rax, %rdx                                    #881.5
-        lea       16(%rdx), %r8                                 #881.5
-        cmpq      %r8, %rsi                                     #881.5
-        jl        ..B23.55      # Prob 10%                      #881.5
-                                # LOE rdx rcx rbx rsi rdi r13 r12d
-..B23.18:                       # Preds ..B23.17
-        movq      %rsi, %rax                                    #881.5
-        subq      %rdx, %rax                                    #881.5
-        andq      $15, %rax                                     #881.5
-        negq      %rax                                          #881.5
-        addq      %rsi, %rax                                    #881.5
-        xorl      %r9d, %r9d                                    #881.5
-        testq     %rdx, %rdx                                    #881.5
-        jbe       ..B23.22      # Prob 10%                      #881.5
-                                # LOE rax rdx rcx rbx rsi rdi r9 r13 r12d
-..B23.19:                       # Preds ..B23.18
-..LN2585:
-   .loc    1  884
-        lea       -64(%rbp), %r8                                #884.9
-        addq      %rdi, %r8                                     #
-                                # LOE rax rdx rcx rbx rsi rdi r8 r9 r13 r12d
-..B23.20:                       # Preds ..B23.20 ..B23.19
-..LN2587:
-   .loc    1  883
-        xorl      %r10d, %r10d                                  #883.9
-        movb      %r10b, (%r9,%rcx)                             #883.9
-..LN2589:
-   .loc    1  884
-        movb      %r10b, (%r9,%r8)                              #884.9
-..LN2591:
-   .loc    1  881
-        incq      %r9                                           #881.5
-        cmpq      %rdx, %r9                                     #881.5
-        jb        ..B23.20      # Prob 82%                      #881.5
-                                # LOE rax rdx rcx rbx rsi rdi r8 r9 r13 r12d
-..B23.22:                       # Preds ..B23.20 ..B23.18
-..LN2593:
-   .loc    1  883
-        lea       -80(%rbp), %r9                                #883.9
-..LN2595:
-   .loc    1  884
-        lea       -64(%rbp), %r8                                #884.9
-        addq      %rdi, %r9                                     #
-        addq      %rdi, %r8                                     #
-..LN2597:
-   .loc    1  883
-        pxor      %xmm0, %xmm0                                  #883.29
-                                # LOE rax rdx rcx rbx rsi rdi r8 r9 r13 r12d xmm0
-..B23.23:                       # Preds ..B23.23 ..B23.22
-..LN2599:
-        movdqa    %xmm0, (%rdx,%r9)                             #883.9
-..LN2601:
-   .loc    1  884
-        movdqa    %xmm0, (%rdx,%r8)                             #884.9
-..LN2603:
-   .loc    1  881
-        addq      $16, %rdx                                     #881.5
-        cmpq      %rax, %rdx                                    #881.5
-        jb        ..B23.23      # Prob 82%                      #881.5
-                                # LOE rax rdx rcx rbx rsi rdi r8 r9 r13 r12d xmm0
-..B23.25:                       # Preds ..B23.23 ..B23.55
-        cmpq      %rsi, %rax                                    #881.5
-        jae       ..B23.29      # Prob 10%                      #881.5
-                                # LOE rax rcx rbx rsi rdi r13 r12d
-..B23.26:                       # Preds ..B23.25
-..LN2605:
-   .loc    1  884
-        lea       -64(%rbp), %rdx                               #884.9
-        addq      %rdx, %rdi                                    #
-                                # LOE rax rcx rbx rsi rdi r13 r12d
-..B23.27:                       # Preds ..B23.27 ..B23.26
-..LN2607:
-   .loc    1  883
-        xorl      %edx, %edx                                    #883.9
-        movb      %dl, (%rax,%rcx)                              #883.9
-..LN2609:
-   .loc    1  884
-        movb      %dl, (%rax,%rdi)                              #884.9
-..LN2611:
-   .loc    1  881
-        incq      %rax                                          #881.5
-        cmpq      %rsi, %rax                                    #881.5
-        jb        ..B23.27      # Prob 82%                      #881.5
-                                # LOE rax rcx rbx rsi rdi r13 r12d
-..B23.29:                       # Preds ..B23.27 ..B23.25 ..B23.16
-..LN2613:
-   .loc    1  890
-        testl     %r12d, %r12d                                  #890.10
-        je        ..B23.31      # Prob 50%                      #890.10
-                                # LOE rbx r13
-..B23.30:                       # Preds ..B23.29
-..LN2615:
-   .loc    1  892
-        movl      $9, (%rbx)                                    #892.9
-        jmp       ..B23.40      # Prob 100%                     #892.9
-                                # LOE rbx
-..B23.31:                       # Preds ..B23.29
-..LN2617:
-   .loc    1  896
-        cmpq      $2, %r13                                      #896.22
-        jae       ..B23.33      # Prob 50%                      #896.22
-                                # LOE rbx r13
-..B23.32:                       # Preds ..B23.31
-..LN2619:
-   .loc    1  898
-        movzbl    -80(%rbp), %eax                               #898.29
-..LN2621:
-   .loc    1  903
-        movzbl    -64(%rbp), %edi                               #903.26
-..LN2623:
-   .loc    1  908
-        movl      $2, (%rbx)                                    #908.9
-..LN2625:
-   .loc    1  898
-        movb      %al, -79(%rbp)                                #898.9
-..LN2627:
-   .loc    1  899
-        movzwl    -80(%rbp), %edx                               #899.29
-..LN2629:
-        movw      %dx, -78(%rbp)                                #899.9
-..LN2631:
-   .loc    1  900
-        movl      -80(%rbp), %ecx                               #900.29
-..LN2633:
-   .loc    1  901
-        movl      -80(%rbp), %esi                               #901.29
-..LN2635:
-   .loc    1  900
-        movl      %ecx, -76(%rbp)                               #900.9
-..LN2637:
-   .loc    1  903
-        movb      %dil, -63(%rbp)                               #903.9
-..LN2639:
-   .loc    1  904
-        movzwl    -64(%rbp), %r8d                               #904.26
-..LN2641:
-        movw      %r8w, -62(%rbp)                               #904.9
-..LN2643:
-   .loc    1  905
-        movl      -64(%rbp), %r9d                               #905.26
-..LN2645:
-   .loc    1  906
-        movl      -64(%rbp), %r10d                              #906.26
-..LN2647:
-   .loc    1  905
-        movl      %r9d, -60(%rbp)                               #905.9
-..LN2649:
-   .loc    1  900
-        movl      %ecx, %ecx                                    #900.9
-..LN2651:
-   .loc    1  901
-        shlq      $32, %rcx                                     #901.29
-..LN2653:
-   .loc    1  905
-        movl      %r9d, %r9d                                    #905.9
-..LN2655:
-   .loc    1  906
-        shlq      $32, %r9                                      #906.26
-..LN2657:
-   .loc    1  901
-        orq       %rsi, %rcx                                    #901.29
-..LN2659:
-        movq      %rcx, -72(%rbp)                               #901.9
-..LN2661:
-   .loc    1  906
-        orq       %r10, %r9                                     #906.26
-..LN2663:
-        movq      %r9, -56(%rbp)                                #906.9
-        jmp       ..B23.40      # Prob 100%                     #906.9
-                                # LOE rbx
-..B23.33:                       # Preds ..B23.31
-..LN2665:
-   .loc    1  910
-        cmpq      $6, %r13                                      #910.22
-        jae       ..B23.35      # Prob 50%                      #910.22
-                                # LOE rbx r13
-..B23.34:                       # Preds ..B23.33
-..LN2667:
-   .loc    1  912
-        movzwl    -80(%rbp), %eax                               #912.29
-..LN2669:
-   .loc    1  916
-        movzwl    -64(%rbp), %esi                               #916.26
-..LN2671:
-   .loc    1  920
-        movl      $3, (%rbx)                                    #920.9
-..LN2673:
-   .loc    1  912
-        movw      %ax, -78(%rbp)                                #912.9
-..LN2675:
-   .loc    1  913
-        movl      -80(%rbp), %edx                               #913.29
-..LN2677:
-   .loc    1  914
-        movl      -80(%rbp), %ecx                               #914.29
-..LN2679:
-   .loc    1  913
-        movl      %edx, -76(%rbp)                               #913.9
-..LN2681:
-   .loc    1  916
-        movw      %si, -62(%rbp)                                #916.9
-..LN2683:
-   .loc    1  917
-        movl      -64(%rbp), %edi                               #917.26
-..LN2685:
-   .loc    1  918
-        movl      -64(%rbp), %r8d                               #918.26
-..LN2687:
-   .loc    1  917
-        movl      %edi, -60(%rbp)                               #917.9
-..LN2689:
-   .loc    1  913
-        movl      %edx, %edx                                    #913.9
-..LN2691:
-   .loc    1  914
-        shlq      $32, %rdx                                     #914.29
-..LN2693:
-   .loc    1  917
-        movl      %edi, %edi                                    #917.9
-..LN2695:
-   .loc    1  918
-        shlq      $32, %rdi                                     #918.26
-..LN2697:
-   .loc    1  914
-        orq       %rcx, %rdx                                    #914.29
-..LN2699:
-        movq      %rdx, -72(%rbp)                               #914.9
-..LN2701:
-   .loc    1  918
-        orq       %r8, %rdi                                     #918.26
-..LN2703:
-        movq      %rdi, -56(%rbp)                               #918.9
-        jmp       ..B23.40      # Prob 100%                     #918.9
-                                # LOE rbx
-..B23.35:                       # Preds ..B23.33
-..LN2705:
-   .loc    1  922
-        cmpq      $14, %r13                                     #922.22
-        jae       ..B23.37      # Prob 50%                      #922.22
-                                # LOE rbx r13
-..B23.36:                       # Preds ..B23.35
-..LN2707:
-   .loc    1  924
-        movl      -80(%rbp), %eax                               #924.29
-..LN2709:
-   .loc    1  925
-        movl      -80(%rbp), %edx                               #925.29
-..LN2711:
-   .loc    1  927
-        movl      -64(%rbp), %ecx                               #927.26
-..LN2713:
-   .loc    1  928
-        movl      -64(%rbp), %esi                               #928.26
-..LN2715:
-   .loc    1  924
-        movl      %eax, -76(%rbp)                               #924.9
-..LN2717:
-   .loc    1  930
-        movl      $4, (%rbx)                                    #930.9
-..LN2719:
-   .loc    1  924
-        movl      %eax, %eax                                    #924.9
-..LN2721:
-   .loc    1  925
-        shlq      $32, %rax                                     #925.29
-..LN2723:
-   .loc    1  927
-        movl      %ecx, -60(%rbp)                               #927.9
-        movl      %ecx, %ecx                                    #927.9
-..LN2725:
-   .loc    1  928
-        shlq      $32, %rcx                                     #928.26
-..LN2727:
-   .loc    1  925
-        orq       %rdx, %rax                                    #925.29
-..LN2729:
-        movq      %rax, -72(%rbp)                               #925.9
-..LN2731:
-   .loc    1  928
-        orq       %rsi, %rcx                                    #928.26
-..LN2733:
-        movq      %rcx, -56(%rbp)                               #928.9
-        jmp       ..B23.40      # Prob 100%                     #928.9
-                                # LOE rbx
-..B23.37:                       # Preds ..B23.35
-..LN2735:
-   .loc    1  932
-        cmpq      $30, %r13                                     #932.22
-        jae       ..B23.39      # Prob 50%                      #932.22
-                                # LOE rbx
-..B23.38:                       # Preds ..B23.37
-..LN2737:
-   .loc    1  934
-        movq      -80(%rbp), %rax                               #934.29
-..LN2739:
-   .loc    1  935
-        movq      -64(%rbp), %rdx                               #935.26
-..LN2741:
-   .loc    1  937
-        movl      $0, (%rbx)                                    #937.9
-..LN2743:
-   .loc    1  934
-        movq      %rax, -72(%rbp)                               #934.9
-..LN2745:
-   .loc    1  935
-        movq      %rdx, -56(%rbp)                               #935.9
-        jmp       ..B23.40      # Prob 100%                     #935.9
-                                # LOE rbx
-..B23.39:                       # Preds ..B23.37
-..LN2747:
-   .loc    1  941
-        movl      $5, (%rbx)                                    #941.9
-                                # LOE rbx
-..B23.40:                       # Preds ..B23.30 ..B23.32 ..B23.34 ..B23.36 ..B23.38
-                                #       ..B23.39
-..LN2749:
-   .loc    1  944
-        movq      -80(%rbp), %rax                               #944.42
-..LN2751:
-   .loc    1  948
-        lea       -80(%rbp), %rdi                               #948.5
-..LN2753:
-   .loc    1  944
-        movq      %rax, 16(%rbx)                                #944.42
-        movq      -72(%rbp), %rdx                               #944.42
-        movq      %rdx, 24(%rbx)                                #944.42
-..LN2755:
-   .loc    1  945
-        movq      -64(%rbp), %rcx                               #945.39
-        movq      %rcx, 32(%rbx)                                #945.39
-        movq      -56(%rbp), %rsi                               #945.39
-        movq      %rsi, 40(%rbx)                                #945.39
-..LN2757:
-   .loc    1  948
-        call      uint128_bswap at PLT                             #948.5
-                                # LOE rbx
-..B23.41:                       # Preds ..B23.40
-..LN2759:
-   .loc    1  949
-        lea       -64(%rbp), %rdi                               #949.5
-        call      uint128_bswap at PLT                             #949.5
-                                # LOE rbx
-..B23.42:                       # Preds ..B23.41
-..LN2761:
-   .loc    1  952
-        lea       -80(%rbp), %rdi                               #952.5
-        movl      $2, %esi                                      #952.5
-        call      uint128_shr at PLT                               #952.5
-                                # LOE rbx
-..B23.43:                       # Preds ..B23.42
-..LN2763:
-   .loc    1  953
-        lea       -64(%rbp), %rdi                               #953.5
-        movl      $2, %esi                                      #953.5
-        call      uint128_shr at PLT                               #953.5
-                                # LOE rbx
-..B23.44:                       # Preds ..B23.43
-..LN2765:
-   .loc    1  956
-        lea       -80(%rbp), %rsi                               #956.5
-        lea       48(%rbx), %rdi                                #956.5
-        call      uint128_bswap_copy at PLT                        #956.5
-                                # LOE rbx
-..B23.45:                       # Preds ..B23.44
-..LN2767:
-   .loc    1  957
-        lea       -64(%rbp), %rsi                               #957.5
-        lea       64(%rbx), %rdi                                #957.5
-        call      uint128_bswap_copy at PLT                        #957.5
-                                # LOE rbx
-..B23.46:                       # Preds ..B23.45
-..LN2769:
-   .loc    1  959
-        lea       -80(%rbp), %rdi                               #959.5
-        movl      $2, %esi                                      #959.5
-        call      uint128_shr at PLT                               #959.5
-                                # LOE rbx
-..B23.47:                       # Preds ..B23.46
-..LN2771:
-   .loc    1  960
-        lea       -64(%rbp), %rdi                               #960.5
-        movl      $2, %esi                                      #960.5
-        call      uint128_shr at PLT                               #960.5
-                                # LOE rbx
-..B23.48:                       # Preds ..B23.47
-..LN2773:
-   .loc    1  962
-        lea       -80(%rbp), %rsi                               #962.5
-        lea       80(%rbx), %rdi                                #962.5
-        call      uint128_bswap_copy at PLT                        #962.5
-                                # LOE rbx
-..B23.49:                       # Preds ..B23.48
-..LN2775:
-   .loc    1  963
-        lea       -64(%rbp), %rsi                               #963.5
-        lea       96(%rbx), %rdi                                #963.5
-        call      uint128_bswap_copy at PLT                        #963.5
-                                # LOE rbx
-..B23.50:                       # Preds ..B23.49
-..LN2777:
-   .loc    1  965
-        lea       -80(%rbp), %rdi                               #965.5
-        movl      $2, %esi                                      #965.5
-        call      uint128_shr at PLT                               #965.5
-                                # LOE rbx
-..B23.51:                       # Preds ..B23.50
-..LN2779:
-   .loc    1  966
-        lea       -64(%rbp), %rdi                               #966.5
-        movl      $2, %esi                                      #966.5
-        call      uint128_shr at PLT                               #966.5
-                                # LOE rbx
-..B23.52:                       # Preds ..B23.51
-..LN2781:
-   .loc    1  968
-        lea       -80(%rbp), %rsi                               #968.5
-        lea       112(%rbx), %rdi                               #968.5
-        call      uint128_bswap_copy at PLT                        #968.5
-                                # LOE rbx
-..B23.53:                       # Preds ..B23.52
-..LN2783:
-   .loc    1  969
-        lea       -64(%rbp), %rsi                               #969.5
-        addq      $128, %rbx                                    #969.5
-        movq      %rbx, %rdi                                    #969.5
-        call      uint128_bswap_copy at PLT                        #969.5
-                                # LOE
-..B23.54:                       # Preds ..B23.53
-..LN2785:
-   .loc    1  1011
-        movq      -24(%rbp), %rbx                               #1011.12
-..___tag_value_NucStrFastaExprMake2.844:                        #
-        movq      -16(%rbp), %r12                               #1011.12
-..___tag_value_NucStrFastaExprMake2.845:                        #
-        movq      -40(%rbp), %r13                               #1011.12
-..___tag_value_NucStrFastaExprMake2.846:                        #
-        movq      -48(%rbp), %r14                               #1011.12
-..___tag_value_NucStrFastaExprMake2.847:                        #
-        xorl      %eax, %eax                                    #1011.12
-        movq      -32(%rbp), %r15                               #1011.12
-..___tag_value_NucStrFastaExprMake2.848:                        #
-        movq      %rbp, %rsp                                    #1011.12
-        popq      %rbp                                          #1011.12
-..___tag_value_NucStrFastaExprMake2.849:                        #
-        ret                                                     #1011.12
-..___tag_value_NucStrFastaExprMake2.850:                        #
-                                # LOE
-..B23.55:                       # Preds ..B23.17                # Infreq
-..LN2787:
-   .loc    1  881
-        xorl      %eax, %eax                                    #881.5
-        jmp       ..B23.25      # Prob 100%                     #881.5
-                                # LOE rax rcx rbx rsi rdi r13 r12d
-..B23.56:                       # Preds ..B23.7                 # Infreq
-..LN2789:
-   .loc    1  862
-        movq      %rdi, %rax                                    #862.32
-        shrq      $2, %rax                                      #862.32
-..LN2791:
-        shll      $6, %edx                                      #862.46
-..LN2793:
-        movb      %dl, -80(%rbp,%rax)                           #862.13
-..LN2795:
-   .loc    1  863
-        movb      $192, -64(%rbp,%rax)                          #863.13
-        jmp       ..B23.14      # Prob 100%                     #863.13
-                                # LOE rbx rdi r13 r14 r12d
-..B23.57:                       # Preds ..B23.4                 # Infreq
-..LN2797:
-   .loc    1  849
-        call      __errno_location at PLT                          #849.16
-                                # LOE rax
-..B23.62:                       # Preds ..B23.57                # Infreq
-        movq      -24(%rbp), %rbx                               #849.16
-..___tag_value_NucStrFastaExprMake2.856:                        #
-        movq      -16(%rbp), %r12                               #849.16
-..___tag_value_NucStrFastaExprMake2.857:                        #
-        movq      -40(%rbp), %r13                               #849.16
-..___tag_value_NucStrFastaExprMake2.858:                        #
-        movq      -48(%rbp), %r14                               #849.16
-..___tag_value_NucStrFastaExprMake2.859:                        #
-        movl      (%rax), %eax                                  #849.16
-        movq      -32(%rbp), %r15                               #849.16
-..___tag_value_NucStrFastaExprMake2.860:                        #
-        movq      %rbp, %rsp                                    #849.16
-        popq      %rbp                                          #849.16
-..___tag_value_NucStrFastaExprMake2.861:                        #
-        ret                                                     #849.16
-        .align    16,0x90
-..___tag_value_NucStrFastaExprMake2.862:                        #
-                                # LOE
-# mark_end;
-	.type	NucStrFastaExprMake2, at function
-	.size	NucStrFastaExprMake2,.-NucStrFastaExprMake2
-.LNNucStrFastaExprMake2:
-	.data
-# -- End  NucStrFastaExprMake2
-	.text
-# -- Begin  uint128_bswap_copy
-# mark_begin;
-       .align    16,0x90
-uint128_bswap_copy:
-# parameter 1(to): %rdi
-# parameter 2(from): %rsi
-..B24.1:                        # Preds ..B24.0
-..___tag_value_uint128_bswap_copy.863:                          #311.1
-..LN2799:
-   .loc    2  311
-        pushq     %rbp                                          #311.1
-        movq      %rsp, %rbp                                    #311.1
-..___tag_value_uint128_bswap_copy.864:                          #
-        subq      $16, %rsp                                     #311.1
-        movq      %r13, -16(%rbp)                               #311.1
-..___tag_value_uint128_bswap_copy.866:                          #
-        movq      %r12, -8(%rbp)                                #311.1
-..___tag_value_uint128_bswap_copy.867:                          #
-        movq      %rsi, %r13                                    #311.1
-        movq      %rdi, %r12                                    #311.1
-        lea       _gprof_pack23(%rip), %rdx                     #311.1
-        call      mcount at PLT                                    #311.1
-                                # LOE rbx r12 r13 r14 r15
-..B24.4:                        # Preds ..B24.1
-..LN2801:
-   .loc    2  312
-        movq      %r12, %rdi                                    #312.0
-        movq      %r13, %rsi                                    #312.0
-        movq      (%rsi), %rax                                  #312.0
-        movq      8(%rsi), %rcx                                 #312.0
-        bswap     %rax                                          #312.0
-        bswap     %rcx                                          #312.0
-        movq      %rax, 8(%rdi)                                 #312.0
-        movq      %rcx, (%rdi)                                  #312.0
-..LN2803:
-   .loc    2  324
-        movq      -8(%rbp), %r12                                #324.1
-..___tag_value_uint128_bswap_copy.868:                          #
-        movq      -16(%rbp), %r13                               #324.1
-..___tag_value_uint128_bswap_copy.869:                          #
-        movq      %rbp, %rsp                                    #324.1
-        popq      %rbp                                          #324.1
-..___tag_value_uint128_bswap_copy.870:                          #
-        ret                                                     #324.1
-        .align    16,0x90
-..___tag_value_uint128_bswap_copy.871:                          #
-                                # LOE
-# mark_end;
-	.type	uint128_bswap_copy, at function
-	.size	uint128_bswap_copy,.-uint128_bswap_copy
-.LNuint128_bswap_copy:
-	.data
-# -- End  uint128_bswap_copy
-	.text
-# -- Begin  uint128_shr
-# mark_begin;
-       .align    16,0x90
-uint128_shr:
-# parameter 1(self): %rdi
-# parameter 2(i): %esi
-..B25.1:                        # Preds ..B25.0
-..___tag_value_uint128_shr.872:                                 #262.1
-..LN2805:
-   .loc    2  262
-        pushq     %rbp                                          #262.1
-        movq      %rsp, %rbp                                    #262.1
-..___tag_value_uint128_shr.873:                                 #
-        subq      $16, %rsp                                     #262.1
-        movq      %r13, -16(%rbp)                               #262.1
-..___tag_value_uint128_shr.875:                                 #
-        movq      %r12, -8(%rbp)                                #262.1
-..___tag_value_uint128_shr.876:                                 #
-        movl      %esi, %r13d                                   #262.1
-        movq      %rdi, %r12                                    #262.1
-        lea       _gprof_pack24(%rip), %rdx                     #262.1
-        call      mcount at PLT                                    #262.1
-                                # LOE rbx r12 r14 r15 r13d
-..B25.4:                        # Preds ..B25.1
-..LN2807:
-   .loc    2  263
-        movq      %r12, %rdi                                    #263.0
-        movl      %r13d, %esi                                   #263.0
-        movl      %esi, %ecx                                    #263.0
-        movq      8(%rdi), %rax                                 #263.0
-        shrdq     %cl, %rax, (%rdi)                             #263.0
-        shrq      %cl, %rax                                     #263.0
-        movq      %rax, 8(%rdi)                                 #263.0
-..LN2809:
-   .loc    2  274
-        movq      -8(%rbp), %r12                                #274.1
-..___tag_value_uint128_shr.877:                                 #
-        movq      -16(%rbp), %r13                               #274.1
-..___tag_value_uint128_shr.878:                                 #
-        movq      %rbp, %rsp                                    #274.1
-        popq      %rbp                                          #274.1
-..___tag_value_uint128_shr.879:                                 #
-        ret                                                     #274.1
-        .align    16,0x90
-..___tag_value_uint128_shr.880:                                 #
-                                # LOE
-# mark_end;
-	.type	uint128_shr, at function
-	.size	uint128_shr,.-uint128_shr
-.LNuint128_shr:
-	.data
-# -- End  uint128_shr
-	.text
-# -- Begin  uint128_bswap
-# mark_begin;
-       .align    16,0x90
-uint128_bswap:
-# parameter 1(self): %rdi
-..B26.1:                        # Preds ..B26.0
-..___tag_value_uint128_bswap.881:                               #294.1
-..LN2811:
-   .loc    2  294
-        pushq     %rbp                                          #294.1
-        movq      %rsp, %rbp                                    #294.1
-..___tag_value_uint128_bswap.882:                               #
-        subq      $16, %rsp                                     #294.1
-        movq      %r13, -16(%rbp)                               #294.1
-..___tag_value_uint128_bswap.884:                               #
-        movq      %rdi, %r13                                    #294.1
-        lea       _gprof_pack25(%rip), %rdx                     #294.1
-        call      mcount at PLT                                    #294.1
-                                # LOE rbx r12 r13 r14 r15
-..B26.4:                        # Preds ..B26.1
-..LN2813:
-   .loc    2  295
-        movq      %r13, %rdi                                    #295.0
-        movq      (%rdi), %rax                                  #295.0
-        movq      8(%rdi), %rcx                                 #295.0
-        bswap     %rax                                          #295.0
-        bswap     %rcx                                          #295.0
-        movq      %rax, 8(%rdi)                                 #295.0
-        movq      %rcx, (%rdi)                                  #295.0
-..LN2815:
-   .loc    2  307
-        movq      -16(%rbp), %r13                               #307.1
-..___tag_value_uint128_bswap.885:                               #
-        movq      %rbp, %rsp                                    #307.1
-        popq      %rbp                                          #307.1
-..___tag_value_uint128_bswap.886:                               #
-        ret                                                     #307.1
-        .align    16,0x90
-..___tag_value_uint128_bswap.887:                               #
-                                # LOE
-# mark_end;
-	.type	uint128_bswap, at function
-	.size	uint128_bswap,.-uint128_bswap
-.LNuint128_bswap:
-	.data
-# -- End  uint128_bswap
-	.text
-# -- Begin  NucStrFastaExprAlloc
-# mark_begin;
-       .align    16,0x90
-NucStrFastaExprAlloc:
-# parameter 1(sz): %rdi
-..B27.1:                        # Preds ..B27.0
-..___tag_value_NucStrFastaExprAlloc.888:                        #790.1
-..LN2817:
-   .loc    1  790
-        pushq     %rbp                                          #790.1
-        movq      %rsp, %rbp                                    #790.1
-..___tag_value_NucStrFastaExprAlloc.889:                        #
-        lea       _gprof_pack26(%rip), %rdx                     #790.1
-        call      mcount at PLT                                    #790.1
-                                # LOE rbx r12 r13 r14 r15
-..B27.7:                        # Preds ..B27.1
-..LN2819:
-   .loc    1  791
-        movl      $160, %edi                                    #791.19
-        call      malloc at PLT                                    #791.19
-                                # LOE rax rbx r12 r13 r14 r15
-..B27.2:                        # Preds ..B27.7
-..LN2821:
-   .loc    1  792
-        testq     %rax, %rax                                    #792.19
-        je        ..B27.4       # Prob 12%                      #792.19
-                                # LOE rax rbx r12 r13 r14 r15
-..B27.3:                        # Preds ..B27.2
-..LN2823:
-   .loc    1  795
-        lea       15(%rax), %rdx                                #795.36
-..LN2825:
-        andq      $-16, %rdx                                    #795.43
-..LN2827:
-   .loc    1  796
-        movq      %rax, 8(%rdx)                                 #796.9
-..LN2829:
-   .loc    1  799
-        movq      %rdx, %rax                                    #799.16
-        movq      %rbp, %rsp                                    #799.16
-        popq      %rbp                                          #799.16
-..___tag_value_NucStrFastaExprAlloc.891:                        #
-        ret                                                     #799.16
-..___tag_value_NucStrFastaExprAlloc.892:                        #
-                                # LOE
-..B27.4:                        # Preds ..B27.2
-..LN2831:
-   .loc    1  801
-        xorl      %eax, %eax                                    #801.12
-        movq      %rbp, %rsp                                    #801.12
-        popq      %rbp                                          #801.12
-..___tag_value_NucStrFastaExprAlloc.893:                        #
-        ret                                                     #801.12
-        .align    16,0x90
-..___tag_value_NucStrFastaExprAlloc.894:                        #
-                                # LOE
-# mark_end;
-	.type	NucStrFastaExprAlloc, at function
-	.size	NucStrFastaExprAlloc,.-NucStrFastaExprAlloc
-.LNNucStrFastaExprAlloc:
-	.data
-# -- End  NucStrFastaExprAlloc
-	.text
-# -- Begin  NucStrFastaExprMake4
-# mark_begin;
-       .align    16,0x90
-NucStrFastaExprMake4:
-# parameter 1(expr): %rdi
-# parameter 2(positional): %esi
-# parameter 3(fasta): %rdx
-# parameter 4(size): %rcx
-..B28.1:                        # Preds ..B28.0
-..___tag_value_NucStrFastaExprMake4.895:                        #1017.1
-..LN2833:
-   .loc    1  1017
-        pushq     %rbp                                          #1017.1
-        movq      %rsp, %rbp                                    #1017.1
-..___tag_value_NucStrFastaExprMake4.896:                        #
-        subq      $80, %rsp                                     #1017.1
-        movq      %r15, -24(%rbp)                               #1017.1
-..___tag_value_NucStrFastaExprMake4.898:                        #
-        movq      %r14, -16(%rbp)                               #1017.1
-..___tag_value_NucStrFastaExprMake4.899:                        #
-        movq      %r13, -40(%rbp)                               #1017.1
-..___tag_value_NucStrFastaExprMake4.900:                        #
-        movq      %r12, -48(%rbp)                               #1017.1
-..___tag_value_NucStrFastaExprMake4.901:                        #
-        movq      %rbx, -32(%rbp)                               #1017.1
-..___tag_value_NucStrFastaExprMake4.902:                        #
-        movq      %rcx, %r13                                    #1017.1
-        movq      %rdx, %r14                                    #1017.1
-        movl      %esi, %r12d                                   #1017.1
-        movq      %rdi, %r15                                    #1017.1
-        lea       _gprof_pack27(%rip), %rdx                     #1017.1
-        call      mcount at PLT                                    #1017.1
-                                # LOE r13 r14 r15 r12d
-..B28.58:                       # Preds ..B28.1
-..LN2835:
-   .loc    1  1023
-        cmpq      $29, %r13                                     #1023.17
-        jbe       ..B28.3       # Prob 43%                      #1023.17
-                                # LOE r13 r14 r15 r12d
-..B28.2:                        # Preds ..B28.58
-..LN2837:
-   .loc    1  1024
-        movq      -32(%rbp), %rbx                               #1024.16
-..___tag_value_NucStrFastaExprMake4.903:                        #
-        movq      -48(%rbp), %r12                               #1024.16
-..___tag_value_NucStrFastaExprMake4.904:                        #
-        movq      -40(%rbp), %r13                               #1024.16
-..___tag_value_NucStrFastaExprMake4.905:                        #
-        movq      -16(%rbp), %r14                               #1024.16
-..___tag_value_NucStrFastaExprMake4.906:                        #
-        movl      $7, %eax                                      #1024.16
-        movq      -24(%rbp), %r15                               #1024.16
-..___tag_value_NucStrFastaExprMake4.907:                        #
-        movq      %rbp, %rsp                                    #1024.16
-        popq      %rbp                                          #1024.16
-..___tag_value_NucStrFastaExprMake4.908:                        #
-        ret                                                     #1024.16
-..___tag_value_NucStrFastaExprMake4.909:                        #
-                                # LOE
-..B28.3:                        # Preds ..B28.58
-..LN2839:
-   .loc    1  1026
-        movl      $144, %edi                                    #1026.9
-        call      NucStrFastaExprAlloc at PLT                      #1026.9
-                                # LOE rax r13 r14 r15 r12d
-..B28.59:                       # Preds ..B28.3
-        movq      %rax, %rbx                                    #1026.9
-                                # LOE rbx r13 r14 r15 r12d
-..B28.4:                        # Preds ..B28.59
-..LN2841:
-   .loc    1  1027
-        testq     %rbx, %rbx                                    #1027.15
-        je        ..B28.55      # Prob 5%                       #1027.15
-                                # LOE rbx r13 r14 r15 r12d
-..B28.5:                        # Preds ..B28.4
-..LN2843:
-   .loc    1  1030
-        movq      %rbx, (%r15)                                  #1030.5
-..LN2845:
-   .loc    1  1031
-        movl      %r13d, 4(%rbx)                                #1031.5
-..LN2847:
-   .loc    1  1035
-        xorl      %edx, %edx                                    #1035.11
-..LN2849:
-        testq     %r13, %r13                                    #1035.22
-        jbe       ..B28.16      # Prob 16%                      #1035.22
-                                # LOE rdx rbx r13 r14 r12d
-..B28.7:                        # Preds ..B28.5 ..B28.14
-..LN2851:
-   .loc    1  1037
-        movsbq    (%rdx,%r14), %rcx                             #1037.49
-..LN2853:
-        lea       fasta_4na_map.0(%rip), %rax                   #1037.25
-        movsbl    (%rax,%rcx), %esi                             #1037.25
-..LN2855:
-   .loc    1  1038
-        movq      %rdx, %rax                                    #1038.22
-        andq      $3, %rax                                      #1038.22
-        je        ..B28.54      # Prob 20%                      #1038.22
-                                # LOE rax rdx rbx r13 r14 esi r12d
-..B28.8:                        # Preds ..B28.7
-        cmpq      $1, %rax                                      #1038.22
-        je        ..B28.13      # Prob 25%                      #1038.22
-                                # LOE rax rdx rbx r13 r14 esi r12d
-..B28.9:                        # Preds ..B28.8
-        cmpq      $2, %rax                                      #1038.22
-        jne       ..B28.11      # Prob 67%                      #1038.22
-                                # LOE rax rdx rbx r13 r14 esi r12d
-..B28.10:                       # Preds ..B28.9
-..LN2857:
-   .loc    1  1049
-        movq      %rdx, %rcx                                    #1049.32
-        shrq      $2, %rcx                                      #1049.32
-..LN2859:
-   .loc    1  1050
-        movzwl    -64(%rbp,%rcx,2), %eax                        #1050.13
-..LN2861:
-   .loc    1  1049
-        shll      $12, %esi                                     #1049.47
-..LN2863:
-   .loc    1  1050
-        orl       $-4096, %eax                                  #1050.13
-..LN2865:
-   .loc    1  1049
-        orw       %si, -80(%rbp,%rcx,2)                         #1049.13
-..LN2867:
-   .loc    1  1050
-        movw      %ax, -64(%rbp,%rcx,2)                         #1050.13
-        jmp       ..B28.14      # Prob 100%                     #1050.13
-                                # LOE rdx rbx r13 r14 r12d
-..B28.11:                       # Preds ..B28.9
-..LN2869:
-   .loc    1  1038
-        cmpq      $3, %rax                                      #1038.22
-        jne       ..B28.14      # Prob 50%                      #1038.22
-                                # LOE rdx rbx r13 r14 esi r12d
-..B28.12:                       # Preds ..B28.11
-..LN2871:
-   .loc    1  1053
-        movq      %rdx, %rcx                                    #1053.32
-        shrq      $2, %rcx                                      #1053.32
-..LN2873:
-   .loc    1  1054
-        movzwl    -64(%rbp,%rcx,2), %eax                        #1054.13
-..LN2875:
-   .loc    1  1053
-        shll      $8, %esi                                      #1053.47
-..LN2877:
-   .loc    1  1054
-        orl       $-61696, %eax                                 #1054.13
-..LN2879:
-   .loc    1  1053
-        orw       %si, -80(%rbp,%rcx,2)                         #1053.13
-..LN2881:
-   .loc    1  1054
-        movw      %ax, -64(%rbp,%rcx,2)                         #1054.13
-        jmp       ..B28.14      # Prob 100%                     #1054.13
-                                # LOE rdx rbx r13 r14 r12d
-..B28.13:                       # Preds ..B28.8
-..LN2883:
-   .loc    1  1045
-        movq      %rdx, %rcx                                    #1045.32
-        shrq      $2, %rcx                                      #1045.32
-..LN2885:
-   .loc    1  1046
-        movzwl    -64(%rbp,%rcx,2), %eax                        #1046.13
-        orl       $15, %eax                                     #1046.13
-..LN2887:
-   .loc    1  1045
-        orw       %si, -80(%rbp,%rcx,2)                         #1045.13
-..LN2889:
-   .loc    1  1046
-        movw      %ax, -64(%rbp,%rcx,2)                         #1046.13
-                                # LOE rdx rbx r13 r14 r12d
-..B28.14:                       # Preds ..B28.11 ..B28.54 ..B28.13 ..B28.10 ..B28.12
-                                #      
-..LN2891:
-   .loc    1  1035
-        incq      %rdx                                          #1035.31
-..LN2893:
-        cmpq      %r13, %rdx                                    #1035.22
-        jb        ..B28.7       # Prob 82%                      #1035.22
-                                # LOE rdx rbx r13 r14 r12d
-..B28.16:                       # Preds ..B28.14 ..B28.5
-..LN2895:
-   .loc    1  1060
-        addq      $3, %rdx                                      #1060.21
-..LN2897:
-        shrq      $2, %rdx                                      #1060.28
-..LN2899:
-        cmpq      $8, %rdx                                      #1060.35
-        jae       ..B28.29      # Prob 50%                      #1060.35
-                                # LOE rdx rbx r13 r12d
-..B28.17:                       # Preds ..B28.16
-..LN2901:
-        lea       -80(%rbp,%rdx,2), %rsi                        #1060.5
-        movq      %rdx, %rdi                                    #1060.5
-        negq      %rdi                                          #1060.5
-        addq      $8, %rdi                                      #1060.5
-        movq      %rsi, %rax                                    #1060.5
-        andq      $15, %rax                                     #1060.5
-        movq      %rax, %rcx                                    #1060.5
-        negq      %rcx                                          #1060.5
-        addq      $16, %rcx                                     #1060.5
-        shrq      $1, %rcx                                      #1060.5
-        cmpq      $0, %rax                                      #1060.5
-        cmovne    %rcx, %rax                                    #1060.5
-        lea       8(%rax), %r8                                  #1060.5
-        cmpq      %r8, %rdi                                     #1060.5
-        jl        ..B28.53      # Prob 10%                      #1060.5
-                                # LOE rax rdx rbx rsi rdi r13 r12d
-..B28.18:                       # Preds ..B28.17
-        movq      %rdi, %rcx                                    #1060.5
-        subq      %rax, %rcx                                    #1060.5
-        andq      $7, %rcx                                      #1060.5
-        negq      %rcx                                          #1060.5
-        addq      %rdi, %rcx                                    #1060.5
-        xorl      %r9d, %r9d                                    #1060.5
-        testq     %rax, %rax                                    #1060.5
-        jbe       ..B28.22      # Prob 10%                      #1060.5
-                                # LOE rax rdx rcx rbx rsi rdi r9 r13 r12d
-..B28.19:                       # Preds ..B28.18
-        lea       -64(%rbp,%rdx,2), %r8                         #
-                                # LOE rax rdx rcx rbx rsi rdi r8 r9 r13 r12d
-..B28.20:                       # Preds ..B28.20 ..B28.19
-..LN2903:
-   .loc    1  1062
-        xorl      %r10d, %r10d                                  #1062.9
-        movw      %r10w, (%rsi,%r9,2)                           #1062.9
-..LN2905:
-   .loc    1  1063
-        movw      %r10w, (%r8,%r9,2)                            #1063.9
-..LN2907:
-   .loc    1  1060
-        incq      %r9                                           #1060.5
-        cmpq      %rax, %r9                                     #1060.5
-        jb        ..B28.20      # Prob 82%                      #1060.5
-                                # LOE rax rdx rcx rbx rsi rdi r8 r9 r13 r12d
-..B28.22:                       # Preds ..B28.20 ..B28.18
-        lea       -64(%rbp,%rdx,2), %r9                         #
-        lea       -80(%rbp,%rdx,2), %r8                         #
-..LN2909:
-   .loc    1  1062
-        pxor      %xmm0, %xmm0                                  #1062.29
-                                # LOE rax rdx rcx rbx rsi rdi r8 r9 r13 r12d xmm0
-..B28.23:                       # Preds ..B28.23 ..B28.22
-..LN2911:
-        movdqa    %xmm0, (%r8,%rax,2)                           #1062.9
-..LN2913:
-   .loc    1  1063
-        movdqa    %xmm0, (%r9,%rax,2)                           #1063.9
-..LN2915:
-   .loc    1  1060
-        addq      $8, %rax                                      #1060.5
-        cmpq      %rcx, %rax                                    #1060.5
-        jb        ..B28.23      # Prob 82%                      #1060.5
-                                # LOE rax rdx rcx rbx rsi rdi r8 r9 r13 r12d xmm0
-..B28.25:                       # Preds ..B28.23 ..B28.53
-        cmpq      %rdi, %rcx                                    #1060.5
-        jae       ..B28.29      # Prob 10%                      #1060.5
-                                # LOE rdx rcx rbx rsi rdi r13 r12d
-..B28.26:                       # Preds ..B28.25
-        lea       -64(%rbp,%rdx,2), %rax                        #
-                                # LOE rax rcx rbx rsi rdi r13 r12d
-..B28.27:                       # Preds ..B28.27 ..B28.26
-..LN2917:
-   .loc    1  1062
-        xorl      %edx, %edx                                    #1062.9
-        movw      %dx, (%rsi,%rcx,2)                            #1062.9
-..LN2919:
-   .loc    1  1063
-        movw      %dx, (%rax,%rcx,2)                            #1063.9
-..LN2921:
-   .loc    1  1060
-        incq      %rcx                                          #1060.5
-        cmpq      %rdi, %rcx                                    #1060.5
-        jb        ..B28.27      # Prob 82%                      #1060.5
-                                # LOE rax rcx rbx rsi rdi r13 r12d
-..B28.29:                       # Preds ..B28.27 ..B28.25 ..B28.16
-..LN2923:
-   .loc    1  1068
-        testl     %r12d, %r12d                                  #1068.10
-        je        ..B28.31      # Prob 50%                      #1068.10
-                                # LOE rbx r13
-..B28.30:                       # Preds ..B28.29
-..LN2925:
-   .loc    1  1070
-        movl      $10, (%rbx)                                   #1070.9
-        jmp       ..B28.38      # Prob 100%                     #1070.9
-                                # LOE rbx
-..B28.31:                       # Preds ..B28.29
-..LN2927:
-   .loc    1  1072
-        cmpq      $2, %r13                                      #1072.22
-        jae       ..B28.33      # Prob 50%                      #1072.22
-                                # LOE rbx r13
-..B28.32:                       # Preds ..B28.31
-..LN2929:
-   .loc    1  1074
-        movzwl    -80(%rbp), %eax                               #1074.29
-..LN2931:
-   .loc    1  1078
-        movzwl    -64(%rbp), %esi                               #1078.26
-..LN2933:
-   .loc    1  1082
-        movl      $6, (%rbx)                                    #1082.9
-..LN2935:
-   .loc    1  1074
-        movw      %ax, -78(%rbp)                                #1074.9
-..LN2937:
-   .loc    1  1075
-        movl      -80(%rbp), %edx                               #1075.29
-..LN2939:
-   .loc    1  1076
-        movl      -80(%rbp), %ecx                               #1076.29
-..LN2941:
-   .loc    1  1075
-        movl      %edx, -76(%rbp)                               #1075.9
-..LN2943:
-   .loc    1  1078
-        movw      %si, -62(%rbp)                                #1078.9
-..LN2945:
-   .loc    1  1079
-        movl      -64(%rbp), %edi                               #1079.26
-..LN2947:
-   .loc    1  1080
-        movl      -64(%rbp), %r8d                               #1080.26
-..LN2949:
-   .loc    1  1079
-        movl      %edi, -60(%rbp)                               #1079.9
-..LN2951:
-   .loc    1  1075
-        movl      %edx, %edx                                    #1075.9
-..LN2953:
-   .loc    1  1076
-        shlq      $32, %rdx                                     #1076.29
-..LN2955:
-   .loc    1  1079
-        movl      %edi, %edi                                    #1079.9
-..LN2957:
-   .loc    1  1080
-        shlq      $32, %rdi                                     #1080.26
-..LN2959:
-   .loc    1  1076
-        orq       %rcx, %rdx                                    #1076.29
-..LN2961:
-        movq      %rdx, -72(%rbp)                               #1076.9
-..LN2963:
-   .loc    1  1080
-        orq       %r8, %rdi                                     #1080.26
-..LN2965:
-        movq      %rdi, -56(%rbp)                               #1080.9
-        jmp       ..B28.38      # Prob 100%                     #1080.9
-                                # LOE rbx
-..B28.33:                       # Preds ..B28.31
-..LN2967:
-   .loc    1  1084
-        cmpq      $6, %r13                                      #1084.22
-        jae       ..B28.35      # Prob 50%                      #1084.22
-                                # LOE rbx r13
-..B28.34:                       # Preds ..B28.33
-..LN2969:
-   .loc    1  1086
-        movl      -80(%rbp), %eax                               #1086.29
-..LN2971:
-   .loc    1  1087
-        movl      -80(%rbp), %edx                               #1087.29
-..LN2973:
-   .loc    1  1089
-        movl      -64(%rbp), %ecx                               #1089.26
-..LN2975:
-   .loc    1  1090
-        movl      -64(%rbp), %esi                               #1090.26
-..LN2977:
-   .loc    1  1086
-        movl      %eax, -76(%rbp)                               #1086.9
-..LN2979:
-   .loc    1  1092
-        movl      $7, (%rbx)                                    #1092.9
-..LN2981:
-   .loc    1  1086
-        movl      %eax, %eax                                    #1086.9
-..LN2983:
-   .loc    1  1087
-        shlq      $32, %rax                                     #1087.29
-..LN2985:
-   .loc    1  1089
-        movl      %ecx, -60(%rbp)                               #1089.9
-        movl      %ecx, %ecx                                    #1089.9
-..LN2987:
-   .loc    1  1090
-        shlq      $32, %rcx                                     #1090.26
-..LN2989:
-   .loc    1  1087
-        orq       %rdx, %rax                                    #1087.29
-..LN2991:
-        movq      %rax, -72(%rbp)                               #1087.9
-..LN2993:
-   .loc    1  1090
-        orq       %rsi, %rcx                                    #1090.26
-..LN2995:
-        movq      %rcx, -56(%rbp)                               #1090.9
-        jmp       ..B28.38      # Prob 100%                     #1090.9
-                                # LOE rbx
-..B28.35:                       # Preds ..B28.33
-..LN2997:
-   .loc    1  1094
-        cmpq      $14, %r13                                     #1094.22
-        jae       ..B28.37      # Prob 50%                      #1094.22
-                                # LOE rbx
-..B28.36:                       # Preds ..B28.35
-..LN2999:
-   .loc    1  1096
-        movq      -80(%rbp), %rax                               #1096.29
-..LN3001:
-   .loc    1  1097
-        movq      -64(%rbp), %rdx                               #1097.26
-..LN3003:
-   .loc    1  1099
-        movl      $1, (%rbx)                                    #1099.9
-..LN3005:
-   .loc    1  1096
-        movq      %rax, -72(%rbp)                               #1096.9
-..LN3007:
-   .loc    1  1097
-        movq      %rdx, -56(%rbp)                               #1097.9
-        jmp       ..B28.38      # Prob 100%                     #1097.9
-                                # LOE rbx
-..B28.37:                       # Preds ..B28.35
-..LN3009:
-   .loc    1  1103
-        movl      $8, (%rbx)                                    #1103.9
-                                # LOE rbx
-..B28.38:                       # Preds ..B28.30 ..B28.32 ..B28.34 ..B28.36 ..B28.37
-                                #      
-..LN3011:
-   .loc    1  1106
-        movq      -80(%rbp), %rax                               #1106.42
-..LN3013:
-   .loc    1  1110
-        lea       -80(%rbp), %rdi                               #1110.5
-..LN3015:
-   .loc    1  1106
-        movq      %rax, 16(%rbx)                                #1106.42
-        movq      -72(%rbp), %rdx                               #1106.42
-        movq      %rdx, 24(%rbx)                                #1106.42
-..LN3017:
-   .loc    1  1107
-        movq      -64(%rbp), %rcx                               #1107.39
-        movq      %rcx, 32(%rbx)                                #1107.39
-        movq      -56(%rbp), %rsi                               #1107.39
-        movq      %rsi, 40(%rbx)                                #1107.39
-..LN3019:
-   .loc    1  1110
-        call      uint128_bswap at PLT                             #1110.5
-                                # LOE rbx
-..B28.39:                       # Preds ..B28.38
-..LN3021:
-   .loc    1  1111
-        lea       -64(%rbp), %rdi                               #1111.5
-        call      uint128_bswap at PLT                             #1111.5
-                                # LOE rbx
-..B28.40:                       # Preds ..B28.39
-..LN3023:
-   .loc    1  1114
-        lea       -80(%rbp), %rdi                               #1114.5
-        movl      $4, %esi                                      #1114.5
-        call      uint128_shr at PLT                               #1114.5
-                                # LOE rbx
-..B28.41:                       # Preds ..B28.40
-..LN3025:
-   .loc    1  1115
-        lea       -64(%rbp), %rdi                               #1115.5
-        movl      $4, %esi                                      #1115.5
-        call      uint128_shr at PLT                               #1115.5
-                                # LOE rbx
-..B28.42:                       # Preds ..B28.41
-..LN3027:
-   .loc    1  1118
-        lea       -80(%rbp), %rsi                               #1118.5
-        lea       48(%rbx), %rdi                                #1118.5
-        call      uint128_bswap_copy at PLT                        #1118.5
-                                # LOE rbx
-..B28.43:                       # Preds ..B28.42
-..LN3029:
-   .loc    1  1119
-        lea       -64(%rbp), %rsi                               #1119.5
-        lea       64(%rbx), %rdi                                #1119.5
-        call      uint128_bswap_copy at PLT                        #1119.5
-                                # LOE rbx
-..B28.44:                       # Preds ..B28.43
-..LN3031:
-   .loc    1  1121
-        lea       -80(%rbp), %rdi                               #1121.5
-        movl      $4, %esi                                      #1121.5
-        call      uint128_shr at PLT                               #1121.5
-                                # LOE rbx
-..B28.45:                       # Preds ..B28.44
-..LN3033:
-   .loc    1  1122
-        lea       -64(%rbp), %rdi                               #1122.5
-        movl      $4, %esi                                      #1122.5
-        call      uint128_shr at PLT                               #1122.5
-                                # LOE rbx
-..B28.46:                       # Preds ..B28.45
-..LN3035:
-   .loc    1  1124
-        lea       -80(%rbp), %rsi                               #1124.5
-        lea       80(%rbx), %rdi                                #1124.5
-        call      uint128_bswap_copy at PLT                        #1124.5
-                                # LOE rbx
-..B28.47:                       # Preds ..B28.46
-..LN3037:
-   .loc    1  1125
-        lea       -64(%rbp), %rsi                               #1125.5
-        lea       96(%rbx), %rdi                                #1125.5
-        call      uint128_bswap_copy at PLT                        #1125.5
-                                # LOE rbx
-..B28.48:                       # Preds ..B28.47
-..LN3039:
-   .loc    1  1127
-        lea       -80(%rbp), %rdi                               #1127.5
-        movl      $4, %esi                                      #1127.5
-        call      uint128_shr at PLT                               #1127.5
-                                # LOE rbx
-..B28.49:                       # Preds ..B28.48
-..LN3041:
-   .loc    1  1128
-        lea       -64(%rbp), %rdi                               #1128.5
-        movl      $4, %esi                                      #1128.5
-        call      uint128_shr at PLT                               #1128.5
-                                # LOE rbx
-..B28.50:                       # Preds ..B28.49
-..LN3043:
-   .loc    1  1130
-        lea       -80(%rbp), %rsi                               #1130.5
-        lea       112(%rbx), %rdi                               #1130.5
-        call      uint128_bswap_copy at PLT                        #1130.5
-                                # LOE rbx
-..B28.51:                       # Preds ..B28.50
-..LN3045:
-   .loc    1  1131
-        lea       -64(%rbp), %rsi                               #1131.5
-        addq      $128, %rbx                                    #1131.5
-        movq      %rbx, %rdi                                    #1131.5
-        call      uint128_bswap_copy at PLT                        #1131.5
-                                # LOE
-..B28.52:                       # Preds ..B28.51
-..LN3047:
-   .loc    1  1173
-        movq      -32(%rbp), %rbx                               #1173.12
-..___tag_value_NucStrFastaExprMake4.915:                        #
-        movq      -48(%rbp), %r12                               #1173.12
-..___tag_value_NucStrFastaExprMake4.916:                        #
-        movq      -40(%rbp), %r13                               #1173.12
-..___tag_value_NucStrFastaExprMake4.917:                        #
-        movq      -16(%rbp), %r14                               #1173.12
-..___tag_value_NucStrFastaExprMake4.918:                        #
-        xorl      %eax, %eax                                    #1173.12
-        movq      -24(%rbp), %r15                               #1173.12
-..___tag_value_NucStrFastaExprMake4.919:                        #
-        movq      %rbp, %rsp                                    #1173.12
-        popq      %rbp                                          #1173.12
-..___tag_value_NucStrFastaExprMake4.920:                        #
-        ret                                                     #1173.12
-..___tag_value_NucStrFastaExprMake4.921:                        #
-                                # LOE
-..B28.53:                       # Preds ..B28.17                # Infreq
-..LN3049:
-   .loc    1  1060
-        xorl      %ecx, %ecx                                    #1060.5
-        jmp       ..B28.25      # Prob 100%                     #1060.5
-                                # LOE rdx rcx rbx rsi rdi r13 r12d
-..B28.54:                       # Preds ..B28.7                 # Infreq
-..LN3051:
-   .loc    1  1041
-        movq      %rdx, %rax                                    #1041.32
-        shrq      $2, %rax                                      #1041.32
-..LN3053:
-        shll      $4, %esi                                      #1041.46
-..LN3055:
-        movw      %si, -80(%rbp,%rax,2)                         #1041.13
-..LN3057:
-   .loc    1  1042
-        movl      $240, %esi                                    #1042.13
-        movw      %si, -64(%rbp,%rax,2)                         #1042.13
-        jmp       ..B28.14      # Prob 100%                     #1042.13
-                                # LOE rdx rbx r13 r14 r12d
-..B28.55:                       # Preds ..B28.4                 # Infreq
-..LN3059:
-   .loc    1  1028
-        call      __errno_location at PLT                          #1028.16
-                                # LOE rax
-..B28.60:                       # Preds ..B28.55                # Infreq
-        movq      -32(%rbp), %rbx                               #1028.16
-..___tag_value_NucStrFastaExprMake4.927:                        #
-        movq      -48(%rbp), %r12                               #1028.16
-..___tag_value_NucStrFastaExprMake4.928:                        #
-        movq      -40(%rbp), %r13                               #1028.16
-..___tag_value_NucStrFastaExprMake4.929:                        #
-        movq      -16(%rbp), %r14                               #1028.16
-..___tag_value_NucStrFastaExprMake4.930:                        #
-        movl      (%rax), %eax                                  #1028.16
-        movq      -24(%rbp), %r15                               #1028.16
-..___tag_value_NucStrFastaExprMake4.931:                        #
-        movq      %rbp, %rsp                                    #1028.16
-        popq      %rbp                                          #1028.16
-..___tag_value_NucStrFastaExprMake4.932:                        #
-        ret                                                     #1028.16
-        .align    16,0x90
-..___tag_value_NucStrFastaExprMake4.933:                        #
-                                # LOE
-# mark_end;
-	.type	NucStrFastaExprMake4, at function
-	.size	NucStrFastaExprMake4,.-NucStrFastaExprMake4
-.LNNucStrFastaExprMake4:
-	.data
-# -- End  NucStrFastaExprMake4
-	.text
-# -- Begin  NucStrstrWhack
-# mark_begin;
-       .align    16,0x90
-	.globl NucStrstrWhack
-NucStrstrWhack:
-# parameter 1(self): %rdi
-..B29.1:                        # Preds ..B29.0
-..___tag_value_NucStrstrWhack.934:                              #1574.1
-..LN3061:
-   .loc    1  1574
-        pushq     %rbp                                          #1574.1
-        movq      %rsp, %rbp                                    #1574.1
-..___tag_value_NucStrstrWhack.935:                              #
-        subq      $16, %rsp                                     #1574.1
-        movq      %r13, -16(%rbp)                               #1574.1
-..___tag_value_NucStrstrWhack.937:                              #
-        movq      %rdi, %r13                                    #1574.1
-        lea       _gprof_pack28(%rip), %rdx                     #1574.1
-        call      mcount at PLT                                    #1574.1
-                                # LOE rbx r12 r13 r14 r15
-..B29.25:                       # Preds ..B29.1
-..LN3063:
-   .loc    1  1575
-        testq     %r13, %r13                                    #1575.18
-        je        ..B29.22      # Prob 12%                      #1575.18
-                                # LOE rbx r12 r13 r14 r15
-..B29.2:                        # Preds ..B29.25
-..LN3065:
-   .loc    1  1577
-        movl      (%r13), %eax                                  #1577.18
-..LN3067:
-        cmpl      $12, %eax                                     #1577.9
-        ja        ..B29.21      # Prob 50%                      #1577.9
-                                # LOE rbx r12 r13 r14 r15 eax
-..B29.3:                        # Preds ..B29.2
-        movl      %eax, %eax                                    #1577.9
-        lea       ..1..TPKT.18_0.0.13(%rip), %rdx               #1577.9
-        movq      (%rdx,%rax,8), %rcx                           #1577.9
-        jmp       *%rcx                                         #1577.9
-                                # LOE rbx r12 r13 r14 r15
-..1.18_0.TAG.0c.0.13:
-..B29.5:                        # Preds ..B29.3
-..LN3069:
-   .loc    1  1601
-        movq      8(%r13), %rdi                                 #1601.13
-        call      NucStrstrWhack at PLT                            #1601.13
-        jmp       ..B29.21      # Prob 100%                     #1601.13
-                                # LOE rbx r12 r13 r14 r15
-..1.18_0.TAG.0b.0.13:
-..B29.7:                        # Preds ..B29.3
-..LN3071:
-   .loc    1  1597
-        movq      8(%r13), %rdi                                 #1597.13
-        call      NucStrstrWhack at PLT                            #1597.13
-                                # LOE rbx r12 r13 r14 r15
-..B29.8:                        # Preds ..B29.7
-..LN3073:
-   .loc    1  1598
-        movq      16(%r13), %rdi                                #1598.13
-        call      NucStrstrWhack at PLT                            #1598.13
-        jmp       ..B29.21      # Prob 100%                     #1598.13
-                                # LOE rbx r12 r13 r14 r15
-..1.18_0.TAG.0a.0.13:
-..1.18_0.TAG.09.0.13:
-..1.18_0.TAG.08.0.13:
-..1.18_0.TAG.07.0.13:
-..1.18_0.TAG.06.0.13:
-..1.18_0.TAG.05.0.13:
-..1.18_0.TAG.04.0.13:
-..1.18_0.TAG.03.0.13:
-..1.18_0.TAG.02.0.13:
-..1.18_0.TAG.01.0.13:
-..1.18_0.TAG.00.0.13:
-..B29.20:                       # Preds ..B29.3 ..B29.3 ..B29.3 ..B29.3 ..B29.3
-                                #       ..B29.3 ..B29.3 ..B29.3 ..B29.3 ..B29.3
-                                #       ..B29.3
-..LN3075:
-   .loc    1  1593
-        movq      8(%r13), %r13                                 #1593.20
-                                # LOE rbx r12 r13 r14 r15
-..B29.21:                       # Preds ..B29.5 ..B29.8 ..B29.20 ..B29.2
-..LN3077:
-   .loc    1  1604
-        movq      %r13, %rdi                                    #1604.9
-        xorl      %eax, %eax                                    #1604.9
-        call      free at PLT                                      #1604.9
-                                # LOE rbx r12 r14 r15
-..B29.22:                       # Preds ..B29.21 ..B29.25
-..LN3079:
-   .loc    1  1606
-        movq      -16(%rbp), %r13                               #1606.1
-..___tag_value_NucStrstrWhack.938:                              #
-        movq      %rbp, %rsp                                    #1606.1
-        popq      %rbp                                          #1606.1
-..___tag_value_NucStrstrWhack.939:                              #
-        ret                                                     #1606.1
-        .align    16,0x90
-..___tag_value_NucStrstrWhack.940:                              #
-                                # LOE
-# mark_end;
-	.type	NucStrstrWhack, at function
-	.size	NucStrstrWhack,.-NucStrstrWhack
-.LNNucStrstrWhack:
-	.section .data1, "wa"
-	.space 24	# pad
-	.align 32
-..1..TPKT.18_0.0.13:
-	.quad	..1.18_0.TAG.00.0.13
-	.quad	..1.18_0.TAG.01.0.13
-	.quad	..1.18_0.TAG.02.0.13
-	.quad	..1.18_0.TAG.03.0.13
-	.quad	..1.18_0.TAG.04.0.13
-	.quad	..1.18_0.TAG.05.0.13
-	.quad	..1.18_0.TAG.06.0.13
-	.quad	..1.18_0.TAG.07.0.13
-	.quad	..1.18_0.TAG.08.0.13
-	.quad	..1.18_0.TAG.09.0.13
-	.quad	..1.18_0.TAG.0a.0.13
-	.quad	..1.18_0.TAG.0b.0.13
-	.quad	..1.18_0.TAG.0c.0.13
-	.data
-# -- End  NucStrstrWhack
-	.text
-# -- Begin  NucStrstrInit
-# mark_begin;
-       .align    16,0x90
-NucStrstrInit:
-..B30.1:                        # Preds ..B30.0
-..___tag_value_NucStrstrInit.941:                               #1484.1
-..LN3081:
-   .loc    1  1484
-        pushq     %rbp                                          #1484.1
-        movq      %rsp, %rbp                                    #1484.1
-..___tag_value_NucStrstrInit.942:                               #
-        subq      $32, %rsp                                     #1484.1
-        movq      %r15, -32(%rbp)                               #1484.1
-..___tag_value_NucStrstrInit.944:                               #
-        movq      %r12, -16(%rbp)                               #1484.1
-..___tag_value_NucStrstrInit.945:                               #
-        movq      %rbx, -24(%rbp)                               #1484.1
-..___tag_value_NucStrstrInit.946:                               #
-        lea       _gprof_pack29(%rip), %rdx                     #1484.1
-        call      mcount at PLT                                    #1484.1
-                                # LOE r13 r14
-..B30.27:                       # Preds ..B30.1
-..LN3083:
-   .loc    1  1491
-        lea       fasta_2na_map.0(%rip), %rdx                   #1491.14
-..LN3085:
-        movl      $-1, %eax                                     #1491.5
-        movd      %eax, %xmm0                                   #1491.5
-        pshufd    $0, %xmm0, %xmm1                              #1491.5
-        movaps    %xmm1, (%rdx)                                 #1491.5
-        movaps    %xmm1, 16(%rdx)                               #1491.5
-        movaps    %xmm1, 32(%rdx)                               #1491.5
-        movaps    %xmm1, 48(%rdx)                               #1491.5
-        movaps    %xmm1, 64(%rdx)                               #1491.5
-        movaps    %xmm1, 80(%rdx)                               #1491.5
-        movaps    %xmm1, 96(%rdx)                               #1491.5
-        movaps    %xmm1, 112(%rdx)                              #1491.5
-                                # LOE r13 r14
-..B30.2:                        # Preds ..B30.27
-..LN3087:
-   .loc    1  1492
-        lea       fasta_4na_map.0(%rip), %rdx                   #1492.14
-..LN3089:
-        movl      $-1, %eax                                     #1492.5
-        movd      %eax, %xmm0                                   #1492.5
-        pshufd    $0, %xmm0, %xmm1                              #1492.5
-        movaps    %xmm1, (%rdx)                                 #1492.5
-        movaps    %xmm1, 16(%rdx)                               #1492.5
-        movaps    %xmm1, 32(%rdx)                               #1492.5
-        movaps    %xmm1, 48(%rdx)                               #1492.5
-        movaps    %xmm1, 64(%rdx)                               #1492.5
-        movaps    %xmm1, 80(%rdx)                               #1492.5
-        movaps    %xmm1, 96(%rdx)                               #1492.5
-        movaps    %xmm1, 112(%rdx)                              #1492.5
-                                # LOE r13 r14
-..B30.3:                        # Preds ..B30.2
-..LN3091:
-   .loc    1  1495
-        xorl      %r15d, %r15d                                  #1495.11
-..LN3093:
-   .loc    1  1487
-        lea       _2__STRING.0.0(%rip), %rax                    #1487.29
-..LN3095:
-   .loc    1  1497
-        movsbl    (%rax), %ebx                                  #1497.14
-        lea       1+_2__STRING.0.0(%rip), %r12                  #
-..LN3097:
-   .loc    1  1498
-        call      __ctype_tolower_loc at PLT                       #1498.48
-                                # LOE r12 r13 r14 ebx r15d
-..B30.9:                        # Preds ..B30.3 ..B30.10
-        movl      %ebx, %edi                                    #1498.48
-        call      tolower at PLT                                   #1498.48
-                                # LOE r12 r13 r14 eax ebx r15d
-..B30.28:                       # Preds ..B30.9
-        movslq    %eax, %rdx                                    #1498.48
-                                # LOE rdx r12 r13 r14 ebx r15d
-..B30.10:                       # Preds ..B30.28
-..LN3099:
-        lea       fasta_2na_map.0(%rip), %rax                   #1498.32
-        movb      %r15b, (%rax,%rdx)                            #1498.32
-..LN3101:
-        movslq    %ebx, %rdx                                    #1498.9
-        movb      %r15b, (%rax,%rdx)                            #1498.9
-..LN3103:
-   .loc    1  1495
-        movsbl    (%r12), %ebx                                  #1495.31
-..LN3105:
-        incl      %r15d                                         #1495.48
-..LN3107:
-        incq      %r12                                          #1495.54
-..LN3109:
-        testl     %ebx, %ebx                                    #1495.42
-        jne       ..B30.9       # Prob 82%                      #1495.42
-                                # LOE r12 r13 r14 ebx r15d
-..B30.11:                       # Preds ..B30.10
-..LN3111:
-   .loc    1  1502
-        xorl      %r15d, %r15d                                  #1502.11
-..LN3113:
-   .loc    1  1488
-        lea       _2__STRING.1.0(%rip), %rax                    #1488.25
-..LN3115:
-   .loc    1  1504
-        movsbl    (%rax), %ebx                                  #1504.14
-        lea       1+_2__STRING.1.0(%rip), %r12                  #
-                                # LOE r12 r13 r14 ebx r15d
-..B30.17:                       # Preds ..B30.11 ..B30.18
-..LN3117:
-   .loc    1  1505
-        movl      %ebx, %edi                                    #1505.48
-        call      tolower at PLT                                   #1505.48
-                                # LOE r12 r13 r14 eax ebx r15d
-..B30.29:                       # Preds ..B30.17
-        movslq    %eax, %rdx                                    #1505.48
-                                # LOE rdx r12 r13 r14 ebx r15d
-..B30.18:                       # Preds ..B30.29
-..LN3119:
-        lea       fasta_4na_map.0(%rip), %rax                   #1505.32
-        movb      %r15b, (%rax,%rdx)                            #1505.32
-..LN3121:
-        movslq    %ebx, %rdx                                    #1505.9
-        movb      %r15b, (%rax,%rdx)                            #1505.9
-..LN3123:
-   .loc    1  1502
-        movsbl    (%r12), %ebx                                  #1502.31
-..LN3125:
-        incl      %r15d                                         #1502.48
-..LN3127:
-        incq      %r12                                          #1502.54
-..LN3129:
-        testl     %ebx, %ebx                                    #1502.42
-        jne       ..B30.17      # Prob 82%                      #1502.42
-                                # LOE r12 r13 r14 ebx r15d
-..B30.19:                       # Preds ..B30.18
-..LN3131:
-   .loc    1  1510
-        xorl      %edx, %edx                                    #1510.11
-..LN3133:
-        xorl      %eax, %eax                                    #1510.30
-                                # LOE rdx r13 r14 eax
-..B30.20:                       # Preds ..B30.23 ..B30.19
-..LN3135:
-   .loc    1  1511
-        lea       expand_2na.0(%rip), %rcx                      #1511.28
-        movzwl    (%rcx,%rdx,2), %ecx                           #1511.28
-                                # LOE rdx r13 r14 eax ecx
-..B30.22:                       # Preds ..B30.20
-..LN3137:
-        rorw      $8, %cx                                       #1511.0
-                                # LOE rdx r13 r14 eax ecx
-..B30.23:                       # Preds ..B30.22
-..LN3139:
-        lea       expand_2na.0(%rip), %rbx                      #1511.9
-        movw      %cx, (%rbx,%rdx,2)                            #1511.9
-..LN3141:
-   .loc    1  1510
-        incl      %eax                                          #1510.30
-        movl      %eax, %edx                                    #1510.30
-..LN3143:
-        movl      %edx, %eax                                    #1510.5
-..LN3145:
-        cmpl      $256, %eax                                    #1510.22
-        jb        ..B30.20      # Prob 99%                      #1510.22
-                                # LOE rdx r13 r14 eax
-..B30.24:                       # Preds ..B30.23
-..LN3147:
-   .loc    1  1513
-        movq      -24(%rbp), %rbx                               #1513.1
-..___tag_value_NucStrstrInit.947:                               #
-        movq      -16(%rbp), %r12                               #1513.1
-..___tag_value_NucStrstrInit.948:                               #
-        movq      -32(%rbp), %r15                               #1513.1
-..___tag_value_NucStrstrInit.949:                               #
-        movq      %rbp, %rsp                                    #1513.1
-        popq      %rbp                                          #1513.1
-..___tag_value_NucStrstrInit.950:                               #
-        ret                                                     #1513.1
-        .align    16,0x90
-..___tag_value_NucStrstrInit.951:                               #
-                                # LOE
-# mark_end;
-	.type	NucStrstrInit, at function
-	.size	NucStrstrInit,.-NucStrstrInit
-.LNNucStrstrInit:
-	.data
-# -- End  NucStrstrInit
-	.bss
-	.align 32
-	.align 32
-fasta_2na_map.0:
-	.type	fasta_2na_map.0, at object
-	.size	fasta_2na_map.0,128
-	.space 128	# pad
-	.align 32
-fasta_4na_map.0:
-	.type	fasta_4na_map.0, at object
-	.size	fasta_4na_map.0,128
-	.space 128	# pad
-	.data
-	.align 32
-	.align 32
-expand_2na.0:
-	.word	4369
-	.word	4370
-	.word	4372
-	.word	4376
-	.word	4385
-	.word	4386
-	.word	4388
-	.word	4392
-	.word	4417
-	.word	4418
-	.word	4420
-	.word	4424
-	.word	4481
-	.word	4482
-	.word	4484
-	.word	4488
-	.word	4625
-	.word	4626
-	.word	4628
-	.word	4632
-	.word	4641
-	.word	4642
-	.word	4644
-	.word	4648
-	.word	4673
-	.word	4674
-	.word	4676
-	.word	4680
-	.word	4737
-	.word	4738
-	.word	4740
-	.word	4744
-	.word	5137
-	.word	5138
-	.word	5140
-	.word	5144
-	.word	5153
-	.word	5154
-	.word	5156
-	.word	5160
-	.word	5185
-	.word	5186
-	.word	5188
-	.word	5192
-	.word	5249
-	.word	5250
-	.word	5252
-	.word	5256
-	.word	6161
-	.word	6162
-	.word	6164
-	.word	6168
-	.word	6177
-	.word	6178
-	.word	6180
-	.word	6184
-	.word	6209
-	.word	6210
-	.word	6212
-	.word	6216
-	.word	6273
-	.word	6274
-	.word	6276
-	.word	6280
-	.word	8465
-	.word	8466
-	.word	8468
-	.word	8472
-	.word	8481
-	.word	8482
-	.word	8484
-	.word	8488
-	.word	8513
-	.word	8514
-	.word	8516
-	.word	8520
-	.word	8577
-	.word	8578
-	.word	8580
-	.word	8584
-	.word	8721
-	.word	8722
-	.word	8724
-	.word	8728
-	.word	8737
-	.word	8738
-	.word	8740
-	.word	8744
-	.word	8769
-	.word	8770
-	.word	8772
-	.word	8776
-	.word	8833
-	.word	8834
-	.word	8836
-	.word	8840
-	.word	9233
-	.word	9234
-	.word	9236
-	.word	9240
-	.word	9249
-	.word	9250
-	.word	9252
-	.word	9256
-	.word	9281
-	.word	9282
-	.word	9284
-	.word	9288
-	.word	9345
-	.word	9346
-	.word	9348
-	.word	9352
-	.word	10257
-	.word	10258
-	.word	10260
-	.word	10264
-	.word	10273
-	.word	10274
-	.word	10276
-	.word	10280
-	.word	10305
-	.word	10306
-	.word	10308
-	.word	10312
-	.word	10369
-	.word	10370
-	.word	10372
-	.word	10376
-	.word	16657
-	.word	16658
-	.word	16660
-	.word	16664
-	.word	16673
-	.word	16674
-	.word	16676
-	.word	16680
-	.word	16705
-	.word	16706
-	.word	16708
-	.word	16712
-	.word	16769
-	.word	16770
-	.word	16772
-	.word	16776
-	.word	16913
-	.word	16914
-	.word	16916
-	.word	16920
-	.word	16929
-	.word	16930
-	.word	16932
-	.word	16936
-	.word	16961
-	.word	16962
-	.word	16964
-	.word	16968
-	.word	17025
-	.word	17026
-	.word	17028
-	.word	17032
-	.word	17425
-	.word	17426
-	.word	17428
-	.word	17432
-	.word	17441
-	.word	17442
-	.word	17444
-	.word	17448
-	.word	17473
-	.word	17474
-	.word	17476
-	.word	17480
-	.word	17537
-	.word	17538
-	.word	17540
-	.word	17544
-	.word	18449
-	.word	18450
-	.word	18452
-	.word	18456
-	.word	18465
-	.word	18466
-	.word	18468
-	.word	18472
-	.word	18497
-	.word	18498
-	.word	18500
-	.word	18504
-	.word	18561
-	.word	18562
-	.word	18564
-	.word	18568
-	.word	33041
-	.word	33042
-	.word	33044
-	.word	33048
-	.word	33057
-	.word	33058
-	.word	33060
-	.word	33064
-	.word	33089
-	.word	33090
-	.word	33092
-	.word	33096
-	.word	33153
-	.word	33154
-	.word	33156
-	.word	33160
-	.word	33297
-	.word	33298
-	.word	33300
-	.word	33304
-	.word	33313
-	.word	33314
-	.word	33316
-	.word	33320
-	.word	33345
-	.word	33346
-	.word	33348
-	.word	33352
-	.word	33409
-	.word	33410
-	.word	33412
-	.word	33416
-	.word	33809
-	.word	33810
-	.word	33812
-	.word	33816
-	.word	33825
-	.word	33826
-	.word	33828
-	.word	33832
-	.word	33857
-	.word	33858
-	.word	33860
-	.word	33864
-	.word	33921
-	.word	33922
-	.word	33924
-	.word	33928
-	.word	34833
-	.word	34834
-	.word	34836
-	.word	34840
-	.word	34849
-	.word	34850
-	.word	34852
-	.word	34856
-	.word	34881
-	.word	34882
-	.word	34884
-	.word	34888
-	.word	34945
-	.word	34946
-	.word	34948
-	.word	34952
-	.type	expand_2na.0, at object
-	.size	expand_2na.0,512
-	.section .rodata, "a"
-	.align 4
-	.align 4
-_gprof_pack0:
-	.long	0
-	.type	_gprof_pack0, at object
-	.size	_gprof_pack0,4
-	.align 4
-_gprof_pack1:
-	.long	0
-	.type	_gprof_pack1, at object
-	.size	_gprof_pack1,4
-	.align 4
-_gprof_pack2:
-	.long	0
-	.type	_gprof_pack2, at object
-	.size	_gprof_pack2,4
-	.align 4
-_gprof_pack3:
-	.long	0
-	.type	_gprof_pack3, at object
-	.size	_gprof_pack3,4
-	.align 4
-_gprof_pack4:
-	.long	0
-	.type	_gprof_pack4, at object
-	.size	_gprof_pack4,4
-	.align 4
-_gprof_pack5:
-	.long	0
-	.type	_gprof_pack5, at object
-	.size	_gprof_pack5,4
-	.align 4
-_gprof_pack6:
-	.long	0
-	.type	_gprof_pack6, at object
-	.size	_gprof_pack6,4
-	.align 4
-_gprof_pack7:
-	.long	0
-	.type	_gprof_pack7, at object
-	.size	_gprof_pack7,4
-	.align 4
-_gprof_pack8:
-	.long	0
-	.type	_gprof_pack8, at object
-	.size	_gprof_pack8,4
-	.align 4
-_gprof_pack9:
-	.long	0
-	.type	_gprof_pack9, at object
-	.size	_gprof_pack9,4
-	.align 4
-_gprof_pack10:
-	.long	0
-	.type	_gprof_pack10, at object
-	.size	_gprof_pack10,4
-	.align 4
-_gprof_pack11:
-	.long	0
-	.type	_gprof_pack11, at object
-	.size	_gprof_pack11,4
-	.align 4
-_gprof_pack12:
-	.long	0
-	.type	_gprof_pack12, at object
-	.size	_gprof_pack12,4
-	.align 4
-_gprof_pack13:
-	.long	0
-	.type	_gprof_pack13, at object
-	.size	_gprof_pack13,4
-	.align 4
-_gprof_pack14:
-	.long	0
-	.type	_gprof_pack14, at object
-	.size	_gprof_pack14,4
-	.align 4
-_gprof_pack15:
-	.long	0
-	.type	_gprof_pack15, at object
-	.size	_gprof_pack15,4
-	.align 4
-_gprof_pack16:
-	.long	0
-	.type	_gprof_pack16, at object
-	.size	_gprof_pack16,4
-	.align 4
-_gprof_pack17:
-	.long	0
-	.type	_gprof_pack17, at object
-	.size	_gprof_pack17,4
-	.align 4
-_gprof_pack18:
-	.long	0
-	.type	_gprof_pack18, at object
-	.size	_gprof_pack18,4
-	.align 4
-_gprof_pack19:
-	.long	0
-	.type	_gprof_pack19, at object
-	.size	_gprof_pack19,4
-	.align 4
-_gprof_pack20:
-	.long	0
-	.type	_gprof_pack20, at object
-	.size	_gprof_pack20,4
-	.align 4
-_gprof_pack21:
-	.long	0
-	.type	_gprof_pack21, at object
-	.size	_gprof_pack21,4
-	.align 4
-_gprof_pack22:
-	.long	0
-	.type	_gprof_pack22, at object
-	.size	_gprof_pack22,4
-	.align 4
-_gprof_pack23:
-	.long	0
-	.type	_gprof_pack23, at object
-	.size	_gprof_pack23,4
-	.align 4
-_gprof_pack24:
-	.long	0
-	.type	_gprof_pack24, at object
-	.size	_gprof_pack24,4
-	.align 4
-_gprof_pack25:
-	.long	0
-	.type	_gprof_pack25, at object
-	.size	_gprof_pack25,4
-	.align 4
-_gprof_pack26:
-	.long	0
-	.type	_gprof_pack26, at object
-	.size	_gprof_pack26,4
-	.align 4
-_gprof_pack27:
-	.long	0
-	.type	_gprof_pack27, at object
-	.size	_gprof_pack27,4
-	.align 4
-_gprof_pack28:
-	.long	0
-	.type	_gprof_pack28, at object
-	.size	_gprof_pack28,4
-	.align 4
-_gprof_pack29:
-	.long	0
-	.type	_gprof_pack29, at object
-	.size	_gprof_pack29,4
-	.section .rodata.str1.4, "aMS", at progbits,1
-	.align 4
-	.align 4
-_2__STRING.0.0:
-	.byte	65
-	.byte	67
-	.byte	71
-	.byte	84
-	.byte	0
-	.type	_2__STRING.0.0, at object
-	.size	_2__STRING.0.0,5
-	.space 3	# pad
-	.align 4
-_2__STRING.1.0:
-	.byte	45
-	.byte	65
-	.byte	67
-	.byte	77
-	.byte	71
-	.byte	82
-	.byte	83
-	.byte	86
-	.byte	84
-	.byte	87
-	.byte	89
-	.byte	72
-	.byte	75
-	.byte	68
-	.byte	66
-	.byte	78
-	.byte	0
-	.type	_2__STRING.1.0, at object
-	.size	_2__STRING.1.0,17
-	.data
-	.section .note.GNU-stack, ""
-// -- Begin DWARF2 SEGMENT .debug_info
-	.section .debug_info
-.debug_info_seg:
-	.align 1
-// -- Begin DWARF2 SEGMENT .debug_line
-	.section .debug_line
-.debug_line_seg:
-	.align 1
-// -- Begin DWARF2 SEGMENT .debug_abbrev
-	.section .debug_abbrev
-.debug_abbrev_seg:
-	.align 1
-// -- Begin DWARF2 SEGMENT .eh_frame
-	.section .eh_frame,"a", at progbits
-.eh_frame_seg:
-	.align 1
-	.4byte 0x00000014
-	.4byte 0x00000000
-	.byte 0x01
-	.2byte 0x527a
-	.byte 0x00
-	.byte 0x01
-	.byte 0x78
-	.byte 0x10
-	.byte 0x01
-	.4byte 0x08070c1b
-	.2byte 0x0190
-	.2byte 0x0000
-	.4byte 0x0000037c
-	.4byte 0x0000001c
-	.4byte ..___tag_value_NucStrstrSearch.1-.
-	.4byte ..___tag_value_NucStrstrSearch.159-..___tag_value_NucStrstrSearch.1
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.2-..___tag_value_NucStrstrSearch.1
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.4-..___tag_value_NucStrstrSearch.2
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.5-..___tag_value_NucStrstrSearch.4
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.6-..___tag_value_NucStrstrSearch.5
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.7-..___tag_value_NucStrstrSearch.6
-	.byte 0x8c
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.8-..___tag_value_NucStrstrSearch.7
-	.byte 0x83
-	.byte 0x07
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.9-..___tag_value_NucStrstrSearch.8
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.10-..___tag_value_NucStrstrSearch.9
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.11-..___tag_value_NucStrstrSearch.10
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.12-..___tag_value_NucStrstrSearch.11
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.13-..___tag_value_NucStrstrSearch.12
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.14-..___tag_value_NucStrstrSearch.13
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.15-..___tag_value_NucStrstrSearch.14
-	.byte 0x83
-	.byte 0x07
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x08
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.21-..___tag_value_NucStrstrSearch.15
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.22-..___tag_value_NucStrstrSearch.21
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.23-..___tag_value_NucStrstrSearch.22
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.24-..___tag_value_NucStrstrSearch.23
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.25-..___tag_value_NucStrstrSearch.24
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.26-..___tag_value_NucStrstrSearch.25
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.27-..___tag_value_NucStrstrSearch.26
-	.byte 0x83
-	.byte 0x07
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x08
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.33-..___tag_value_NucStrstrSearch.27
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.34-..___tag_value_NucStrstrSearch.33
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.35-..___tag_value_NucStrstrSearch.34
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.36-..___tag_value_NucStrstrSearch.35
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.37-..___tag_value_NucStrstrSearch.36
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.38-..___tag_value_NucStrstrSearch.37
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.39-..___tag_value_NucStrstrSearch.38
-	.byte 0x83
-	.byte 0x07
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x08
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.45-..___tag_value_NucStrstrSearch.39
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.46-..___tag_value_NucStrstrSearch.45
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.47-..___tag_value_NucStrstrSearch.46
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.48-..___tag_value_NucStrstrSearch.47
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.49-..___tag_value_NucStrstrSearch.48
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.50-..___tag_value_NucStrstrSearch.49
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.51-..___tag_value_NucStrstrSearch.50
-	.byte 0x83
-	.byte 0x07
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x08
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.57-..___tag_value_NucStrstrSearch.51
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.58-..___tag_value_NucStrstrSearch.57
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.59-..___tag_value_NucStrstrSearch.58
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.60-..___tag_value_NucStrstrSearch.59
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.61-..___tag_value_NucStrstrSearch.60
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.62-..___tag_value_NucStrstrSearch.61
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.63-..___tag_value_NucStrstrSearch.62
-	.byte 0x83
-	.byte 0x07
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x08
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.69-..___tag_value_NucStrstrSearch.63
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.70-..___tag_value_NucStrstrSearch.69
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.71-..___tag_value_NucStrstrSearch.70
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.72-..___tag_value_NucStrstrSearch.71
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.73-..___tag_value_NucStrstrSearch.72
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.74-..___tag_value_NucStrstrSearch.73
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.75-..___tag_value_NucStrstrSearch.74
-	.byte 0x83
-	.byte 0x07
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x08
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.81-..___tag_value_NucStrstrSearch.75
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.82-..___tag_value_NucStrstrSearch.81
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.83-..___tag_value_NucStrstrSearch.82
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.84-..___tag_value_NucStrstrSearch.83
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.85-..___tag_value_NucStrstrSearch.84
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.86-..___tag_value_NucStrstrSearch.85
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.87-..___tag_value_NucStrstrSearch.86
-	.byte 0x83
-	.byte 0x07
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x08
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.93-..___tag_value_NucStrstrSearch.87
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.94-..___tag_value_NucStrstrSearch.93
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.95-..___tag_value_NucStrstrSearch.94
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.96-..___tag_value_NucStrstrSearch.95
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.97-..___tag_value_NucStrstrSearch.96
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.98-..___tag_value_NucStrstrSearch.97
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.99-..___tag_value_NucStrstrSearch.98
-	.byte 0x83
-	.byte 0x07
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x08
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.105-..___tag_value_NucStrstrSearch.99
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.106-..___tag_value_NucStrstrSearch.105
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.107-..___tag_value_NucStrstrSearch.106
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.108-..___tag_value_NucStrstrSearch.107
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.109-..___tag_value_NucStrstrSearch.108
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.110-..___tag_value_NucStrstrSearch.109
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.111-..___tag_value_NucStrstrSearch.110
-	.byte 0x83
-	.byte 0x07
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x08
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.117-..___tag_value_NucStrstrSearch.111
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.118-..___tag_value_NucStrstrSearch.117
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.119-..___tag_value_NucStrstrSearch.118
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.120-..___tag_value_NucStrstrSearch.119
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.121-..___tag_value_NucStrstrSearch.120
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.122-..___tag_value_NucStrstrSearch.121
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.123-..___tag_value_NucStrstrSearch.122
-	.byte 0x83
-	.byte 0x07
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x08
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.129-..___tag_value_NucStrstrSearch.123
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.130-..___tag_value_NucStrstrSearch.129
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.131-..___tag_value_NucStrstrSearch.130
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.132-..___tag_value_NucStrstrSearch.131
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.133-..___tag_value_NucStrstrSearch.132
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.134-..___tag_value_NucStrstrSearch.133
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.135-..___tag_value_NucStrstrSearch.134
-	.byte 0x83
-	.byte 0x07
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x08
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.141-..___tag_value_NucStrstrSearch.135
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.142-..___tag_value_NucStrstrSearch.141
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.143-..___tag_value_NucStrstrSearch.142
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.144-..___tag_value_NucStrstrSearch.143
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.145-..___tag_value_NucStrstrSearch.144
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.146-..___tag_value_NucStrstrSearch.145
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.147-..___tag_value_NucStrstrSearch.146
-	.byte 0x83
-	.byte 0x07
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x08
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.153-..___tag_value_NucStrstrSearch.147
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.154-..___tag_value_NucStrstrSearch.153
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.155-..___tag_value_NucStrstrSearch.154
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.156-..___tag_value_NucStrstrSearch.155
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.157-..___tag_value_NucStrstrSearch.156
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.158-..___tag_value_NucStrstrSearch.157
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.2byte 0x0000
-	.4byte 0x00000184
-	.4byte 0x0000039c
-	.4byte ..___tag_value_eval_4na_pos.160-.
-	.4byte ..___tag_value_eval_4na_pos.228-..___tag_value_eval_4na_pos.160
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.161-..___tag_value_eval_4na_pos.160
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.163-..___tag_value_eval_4na_pos.161
-	.byte 0x8f
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.164-..___tag_value_eval_4na_pos.163
-	.byte 0x8e
-	.byte 0x07
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.165-..___tag_value_eval_4na_pos.164
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.166-..___tag_value_eval_4na_pos.165
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.167-..___tag_value_eval_4na_pos.166
-	.byte 0x83
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.168-..___tag_value_eval_4na_pos.167
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.169-..___tag_value_eval_4na_pos.168
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.170-..___tag_value_eval_4na_pos.169
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.171-..___tag_value_eval_4na_pos.170
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.172-..___tag_value_eval_4na_pos.171
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.173-..___tag_value_eval_4na_pos.172
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.174-..___tag_value_eval_4na_pos.173
-	.byte 0x83
-	.byte 0x04
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x8e
-	.byte 0x07
-	.byte 0x8f
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.180-..___tag_value_eval_4na_pos.174
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.181-..___tag_value_eval_4na_pos.180
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.182-..___tag_value_eval_4na_pos.181
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.183-..___tag_value_eval_4na_pos.182
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.184-..___tag_value_eval_4na_pos.183
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.185-..___tag_value_eval_4na_pos.184
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.186-..___tag_value_eval_4na_pos.185
-	.byte 0x83
-	.byte 0x04
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x8e
-	.byte 0x07
-	.byte 0x8f
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.192-..___tag_value_eval_4na_pos.186
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.193-..___tag_value_eval_4na_pos.192
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.194-..___tag_value_eval_4na_pos.193
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.195-..___tag_value_eval_4na_pos.194
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.196-..___tag_value_eval_4na_pos.195
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.197-..___tag_value_eval_4na_pos.196
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.198-..___tag_value_eval_4na_pos.197
-	.byte 0x83
-	.byte 0x04
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x8e
-	.byte 0x07
-	.byte 0x8f
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.204-..___tag_value_eval_4na_pos.198
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.205-..___tag_value_eval_4na_pos.204
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.206-..___tag_value_eval_4na_pos.205
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.207-..___tag_value_eval_4na_pos.206
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.208-..___tag_value_eval_4na_pos.207
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.209-..___tag_value_eval_4na_pos.208
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.210-..___tag_value_eval_4na_pos.209
-	.byte 0x83
-	.byte 0x04
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x8e
-	.byte 0x07
-	.byte 0x8f
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.216-..___tag_value_eval_4na_pos.210
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.217-..___tag_value_eval_4na_pos.216
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.218-..___tag_value_eval_4na_pos.217
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.219-..___tag_value_eval_4na_pos.218
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.220-..___tag_value_eval_4na_pos.219
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.221-..___tag_value_eval_4na_pos.220
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.222-..___tag_value_eval_4na_pos.221
-	.byte 0x83
-	.byte 0x04
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x8e
-	.byte 0x07
-	.byte 0x8f
-	.byte 0x08
-	.4byte 0x00000000
-	.byte 0x00
-	.4byte 0x00000034
-	.4byte 0x00000524
-	.4byte ..___tag_value_prime_buffer_4na.229-.
-	.4byte ..___tag_value_prime_buffer_4na.235-..___tag_value_prime_buffer_4na.229
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_prime_buffer_4na.230-..___tag_value_prime_buffer_4na.229
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_prime_buffer_4na.232-..___tag_value_prime_buffer_4na.230
-	.byte 0x8e
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_prime_buffer_4na.233-..___tag_value_prime_buffer_4na.232
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_prime_buffer_4na.234-..___tag_value_prime_buffer_4na.233
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.2byte 0x0000
-	.4byte 0x00000184
-	.4byte 0x0000055c
-	.4byte ..___tag_value_eval_2na_pos.236-.
-	.4byte ..___tag_value_eval_2na_pos.304-..___tag_value_eval_2na_pos.236
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.237-..___tag_value_eval_2na_pos.236
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.239-..___tag_value_eval_2na_pos.237
-	.byte 0x8f
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.240-..___tag_value_eval_2na_pos.239
-	.byte 0x8e
-	.byte 0x07
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.241-..___tag_value_eval_2na_pos.240
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.242-..___tag_value_eval_2na_pos.241
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.243-..___tag_value_eval_2na_pos.242
-	.byte 0x83
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.244-..___tag_value_eval_2na_pos.243
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.245-..___tag_value_eval_2na_pos.244
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.246-..___tag_value_eval_2na_pos.245
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.247-..___tag_value_eval_2na_pos.246
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.248-..___tag_value_eval_2na_pos.247
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.249-..___tag_value_eval_2na_pos.248
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.250-..___tag_value_eval_2na_pos.249
-	.byte 0x83
-	.byte 0x04
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x8e
-	.byte 0x07
-	.byte 0x8f
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.256-..___tag_value_eval_2na_pos.250
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.257-..___tag_value_eval_2na_pos.256
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.258-..___tag_value_eval_2na_pos.257
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.259-..___tag_value_eval_2na_pos.258
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.260-..___tag_value_eval_2na_pos.259
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.261-..___tag_value_eval_2na_pos.260
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.262-..___tag_value_eval_2na_pos.261
-	.byte 0x83
-	.byte 0x04
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x8e
-	.byte 0x07
-	.byte 0x8f
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.268-..___tag_value_eval_2na_pos.262
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.269-..___tag_value_eval_2na_pos.268
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.270-..___tag_value_eval_2na_pos.269
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.271-..___tag_value_eval_2na_pos.270
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.272-..___tag_value_eval_2na_pos.271
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.273-..___tag_value_eval_2na_pos.272
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.274-..___tag_value_eval_2na_pos.273
-	.byte 0x83
-	.byte 0x04
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x8e
-	.byte 0x07
-	.byte 0x8f
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.280-..___tag_value_eval_2na_pos.274
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.281-..___tag_value_eval_2na_pos.280
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.282-..___tag_value_eval_2na_pos.281
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.283-..___tag_value_eval_2na_pos.282
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.284-..___tag_value_eval_2na_pos.283
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.285-..___tag_value_eval_2na_pos.284
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.286-..___tag_value_eval_2na_pos.285
-	.byte 0x83
-	.byte 0x04
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x8e
-	.byte 0x07
-	.byte 0x8f
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.292-..___tag_value_eval_2na_pos.286
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.293-..___tag_value_eval_2na_pos.292
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.294-..___tag_value_eval_2na_pos.293
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.295-..___tag_value_eval_2na_pos.294
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.296-..___tag_value_eval_2na_pos.295
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.297-..___tag_value_eval_2na_pos.296
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.298-..___tag_value_eval_2na_pos.297
-	.byte 0x83
-	.byte 0x04
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x8e
-	.byte 0x07
-	.byte 0x8f
-	.byte 0x08
-	.4byte 0x00000000
-	.byte 0x00
-	.4byte 0x00000034
-	.4byte 0x000006e4
-	.4byte ..___tag_value_prime_buffer_2na.305-.
-	.4byte ..___tag_value_prime_buffer_2na.311-..___tag_value_prime_buffer_2na.305
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_prime_buffer_2na.306-..___tag_value_prime_buffer_2na.305
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_prime_buffer_2na.308-..___tag_value_prime_buffer_2na.306
-	.byte 0x8c
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_prime_buffer_2na.309-..___tag_value_prime_buffer_2na.308
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_prime_buffer_2na.310-..___tag_value_prime_buffer_2na.309
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.2byte 0x0000
-	.4byte 0x00000104
-	.4byte 0x0000071c
-	.4byte ..___tag_value_eval_4na_128.312-.
-	.4byte ..___tag_value_eval_4na_128.356-..___tag_value_eval_4na_128.312
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.313-..___tag_value_eval_4na_128.312
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.315-..___tag_value_eval_4na_128.313
-	.byte 0x8f
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.316-..___tag_value_eval_4na_128.315
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.317-..___tag_value_eval_4na_128.316
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.318-..___tag_value_eval_4na_128.317
-	.byte 0x8c
-	.byte 0x07
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.319-..___tag_value_eval_4na_128.318
-	.byte 0x83
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.320-..___tag_value_eval_4na_128.319
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.321-..___tag_value_eval_4na_128.320
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.322-..___tag_value_eval_4na_128.321
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.323-..___tag_value_eval_4na_128.322
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.324-..___tag_value_eval_4na_128.323
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.325-..___tag_value_eval_4na_128.324
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.326-..___tag_value_eval_4na_128.325
-	.byte 0x83
-	.byte 0x08
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x07
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.332-..___tag_value_eval_4na_128.326
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.333-..___tag_value_eval_4na_128.332
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.334-..___tag_value_eval_4na_128.333
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.335-..___tag_value_eval_4na_128.334
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.336-..___tag_value_eval_4na_128.335
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.337-..___tag_value_eval_4na_128.336
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.338-..___tag_value_eval_4na_128.337
-	.byte 0x83
-	.byte 0x08
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x07
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.344-..___tag_value_eval_4na_128.338
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.345-..___tag_value_eval_4na_128.344
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.346-..___tag_value_eval_4na_128.345
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.347-..___tag_value_eval_4na_128.346
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.348-..___tag_value_eval_4na_128.347
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.349-..___tag_value_eval_4na_128.348
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.350-..___tag_value_eval_4na_128.349
-	.byte 0x83
-	.byte 0x08
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x07
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x04
-	.4byte 0x00000000
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x000000ac
-	.4byte 0x00000824
-	.4byte ..___tag_value_eval_4na_32.357-.
-	.4byte ..___tag_value_eval_4na_32.383-..___tag_value_eval_4na_32.357
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.358-..___tag_value_eval_4na_32.357
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.360-..___tag_value_eval_4na_32.358
-	.byte 0x8f
-	.byte 0x19
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.361-..___tag_value_eval_4na_32.360
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.362-..___tag_value_eval_4na_32.361
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.363-..___tag_value_eval_4na_32.362
-	.byte 0x8c
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.364-..___tag_value_eval_4na_32.363
-	.byte 0x83
-	.byte 0x07
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.365-..___tag_value_eval_4na_32.364
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.366-..___tag_value_eval_4na_32.365
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.367-..___tag_value_eval_4na_32.366
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.368-..___tag_value_eval_4na_32.367
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.369-..___tag_value_eval_4na_32.368
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.370-..___tag_value_eval_4na_32.369
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.371-..___tag_value_eval_4na_32.370
-	.byte 0x83
-	.byte 0x07
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x08
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x19
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.377-..___tag_value_eval_4na_32.371
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.378-..___tag_value_eval_4na_32.377
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.379-..___tag_value_eval_4na_32.378
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.380-..___tag_value_eval_4na_32.379
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.381-..___tag_value_eval_4na_32.380
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.382-..___tag_value_eval_4na_32.381
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x00
-	.4byte 0x00000034
-	.4byte 0x000008d4
-	.4byte ..___tag_value_uint16_lsbit.384-.
-	.4byte ..___tag_value_uint16_lsbit.390-..___tag_value_uint16_lsbit.384
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_uint16_lsbit.385-..___tag_value_uint16_lsbit.384
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_uint16_lsbit.387-..___tag_value_uint16_lsbit.385
-	.byte 0x83
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_uint16_lsbit.388-..___tag_value_uint16_lsbit.387
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_uint16_lsbit.389-..___tag_value_uint16_lsbit.388
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.2byte 0x0000
-	.4byte 0x000000ac
-	.4byte 0x0000090c
-	.4byte ..___tag_value_eval_4na_16.391-.
-	.4byte ..___tag_value_eval_4na_16.417-..___tag_value_eval_4na_16.391
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.392-..___tag_value_eval_4na_16.391
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.394-..___tag_value_eval_4na_16.392
-	.byte 0x8f
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.395-..___tag_value_eval_4na_16.394
-	.byte 0x8e
-	.byte 0x07
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.396-..___tag_value_eval_4na_16.395
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.397-..___tag_value_eval_4na_16.396
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.398-..___tag_value_eval_4na_16.397
-	.byte 0x83
-	.byte 0x09
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.399-..___tag_value_eval_4na_16.398
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.400-..___tag_value_eval_4na_16.399
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.401-..___tag_value_eval_4na_16.400
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.402-..___tag_value_eval_4na_16.401
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.403-..___tag_value_eval_4na_16.402
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.404-..___tag_value_eval_4na_16.403
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.405-..___tag_value_eval_4na_16.404
-	.byte 0x83
-	.byte 0x09
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x8e
-	.byte 0x07
-	.byte 0x8f
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.411-..___tag_value_eval_4na_16.405
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.412-..___tag_value_eval_4na_16.411
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.413-..___tag_value_eval_4na_16.412
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.414-..___tag_value_eval_4na_16.413
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.415-..___tag_value_eval_4na_16.414
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.416-..___tag_value_eval_4na_16.415
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x00
-	.4byte 0x00000104
-	.4byte 0x000009bc
-	.4byte ..___tag_value_eval_2na_128.418-.
-	.4byte ..___tag_value_eval_2na_128.462-..___tag_value_eval_2na_128.418
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.419-..___tag_value_eval_2na_128.418
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.421-..___tag_value_eval_2na_128.419
-	.byte 0x8f
-	.byte 0x07
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.422-..___tag_value_eval_2na_128.421
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.423-..___tag_value_eval_2na_128.422
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.424-..___tag_value_eval_2na_128.423
-	.byte 0x8c
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.425-..___tag_value_eval_2na_128.424
-	.byte 0x83
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.426-..___tag_value_eval_2na_128.425
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.427-..___tag_value_eval_2na_128.426
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.428-..___tag_value_eval_2na_128.427
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.429-..___tag_value_eval_2na_128.428
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.430-..___tag_value_eval_2na_128.429
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.431-..___tag_value_eval_2na_128.430
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.432-..___tag_value_eval_2na_128.431
-	.byte 0x83
-	.byte 0x08
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x04
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x07
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.438-..___tag_value_eval_2na_128.432
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.439-..___tag_value_eval_2na_128.438
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.440-..___tag_value_eval_2na_128.439
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.441-..___tag_value_eval_2na_128.440
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.442-..___tag_value_eval_2na_128.441
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.443-..___tag_value_eval_2na_128.442
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.444-..___tag_value_eval_2na_128.443
-	.byte 0x83
-	.byte 0x08
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x04
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x07
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.450-..___tag_value_eval_2na_128.444
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.451-..___tag_value_eval_2na_128.450
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.452-..___tag_value_eval_2na_128.451
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.453-..___tag_value_eval_2na_128.452
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.454-..___tag_value_eval_2na_128.453
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.455-..___tag_value_eval_2na_128.454
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.456-..___tag_value_eval_2na_128.455
-	.byte 0x83
-	.byte 0x08
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x04
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x07
-	.4byte 0x00000000
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x000000ac
-	.4byte 0x00000ac4
-	.4byte ..___tag_value_eval_2na_32.463-.
-	.4byte ..___tag_value_eval_2na_32.489-..___tag_value_eval_2na_32.463
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.464-..___tag_value_eval_2na_32.463
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.466-..___tag_value_eval_2na_32.464
-	.byte 0x8f
-	.byte 0x09
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.467-..___tag_value_eval_2na_32.466
-	.byte 0x8e
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.468-..___tag_value_eval_2na_32.467
-	.byte 0x8d
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.469-..___tag_value_eval_2na_32.468
-	.byte 0x8c
-	.byte 0x07
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.470-..___tag_value_eval_2na_32.469
-	.byte 0x83
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.471-..___tag_value_eval_2na_32.470
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.472-..___tag_value_eval_2na_32.471
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.473-..___tag_value_eval_2na_32.472
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.474-..___tag_value_eval_2na_32.473
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.475-..___tag_value_eval_2na_32.474
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.476-..___tag_value_eval_2na_32.475
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.477-..___tag_value_eval_2na_32.476
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x07
-	.byte 0x8d
-	.byte 0x05
-	.byte 0x8e
-	.byte 0x08
-	.byte 0x8f
-	.byte 0x09
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.483-..___tag_value_eval_2na_32.477
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.484-..___tag_value_eval_2na_32.483
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.485-..___tag_value_eval_2na_32.484
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.486-..___tag_value_eval_2na_32.485
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.487-..___tag_value_eval_2na_32.486
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.488-..___tag_value_eval_2na_32.487
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x00
-	.4byte 0x000000ac
-	.4byte 0x00000b74
-	.4byte ..___tag_value_eval_2na_16.490-.
-	.4byte ..___tag_value_eval_2na_16.516-..___tag_value_eval_2na_16.490
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.491-..___tag_value_eval_2na_16.490
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.493-..___tag_value_eval_2na_16.491
-	.byte 0x8f
-	.byte 0x09
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.494-..___tag_value_eval_2na_16.493
-	.byte 0x8e
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.495-..___tag_value_eval_2na_16.494
-	.byte 0x8d
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.496-..___tag_value_eval_2na_16.495
-	.byte 0x8c
-	.byte 0x07
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.497-..___tag_value_eval_2na_16.496
-	.byte 0x83
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.498-..___tag_value_eval_2na_16.497
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.499-..___tag_value_eval_2na_16.498
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.500-..___tag_value_eval_2na_16.499
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.501-..___tag_value_eval_2na_16.500
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.502-..___tag_value_eval_2na_16.501
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.503-..___tag_value_eval_2na_16.502
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.504-..___tag_value_eval_2na_16.503
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x07
-	.byte 0x8d
-	.byte 0x05
-	.byte 0x8e
-	.byte 0x08
-	.byte 0x8f
-	.byte 0x09
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.510-..___tag_value_eval_2na_16.504
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.511-..___tag_value_eval_2na_16.510
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.512-..___tag_value_eval_2na_16.511
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.513-..___tag_value_eval_2na_16.512
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.514-..___tag_value_eval_2na_16.513
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.515-..___tag_value_eval_2na_16.514
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x00
-	.4byte 0x000000ac
-	.4byte 0x00000c24
-	.4byte ..___tag_value_eval_2na_8.517-.
-	.4byte ..___tag_value_eval_2na_8.543-..___tag_value_eval_2na_8.517
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.518-..___tag_value_eval_2na_8.517
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.520-..___tag_value_eval_2na_8.518
-	.byte 0x8f
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.521-..___tag_value_eval_2na_8.520
-	.byte 0x8e
-	.byte 0x07
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.522-..___tag_value_eval_2na_8.521
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.523-..___tag_value_eval_2na_8.522
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.524-..___tag_value_eval_2na_8.523
-	.byte 0x83
-	.byte 0x09
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.525-..___tag_value_eval_2na_8.524
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.526-..___tag_value_eval_2na_8.525
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.527-..___tag_value_eval_2na_8.526
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.528-..___tag_value_eval_2na_8.527
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.529-..___tag_value_eval_2na_8.528
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.530-..___tag_value_eval_2na_8.529
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.531-..___tag_value_eval_2na_8.530
-	.byte 0x83
-	.byte 0x09
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x8e
-	.byte 0x07
-	.byte 0x8f
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.537-..___tag_value_eval_2na_8.531
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.538-..___tag_value_eval_2na_8.537
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.539-..___tag_value_eval_2na_8.538
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.540-..___tag_value_eval_2na_8.539
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.541-..___tag_value_eval_2na_8.540
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.542-..___tag_value_eval_2na_8.541
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x00
-	.4byte 0x000000ac
-	.4byte 0x00000cd4
-	.4byte ..___tag_value_eval_4na_64.544-.
-	.4byte ..___tag_value_eval_4na_64.570-..___tag_value_eval_4na_64.544
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.545-..___tag_value_eval_4na_64.544
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.547-..___tag_value_eval_4na_64.545
-	.byte 0x8f
-	.byte 0x19
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.548-..___tag_value_eval_4na_64.547
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.549-..___tag_value_eval_4na_64.548
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.550-..___tag_value_eval_4na_64.549
-	.byte 0x8c
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.551-..___tag_value_eval_4na_64.550
-	.byte 0x83
-	.byte 0x07
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.552-..___tag_value_eval_4na_64.551
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.553-..___tag_value_eval_4na_64.552
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.554-..___tag_value_eval_4na_64.553
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.555-..___tag_value_eval_4na_64.554
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.556-..___tag_value_eval_4na_64.555
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.557-..___tag_value_eval_4na_64.556
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.558-..___tag_value_eval_4na_64.557
-	.byte 0x83
-	.byte 0x07
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x08
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x19
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.564-..___tag_value_eval_4na_64.558
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.565-..___tag_value_eval_4na_64.564
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.566-..___tag_value_eval_4na_64.565
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.567-..___tag_value_eval_4na_64.566
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.568-..___tag_value_eval_4na_64.567
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.569-..___tag_value_eval_4na_64.568
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x00
-	.4byte 0x000000ac
-	.4byte 0x00000d84
-	.4byte ..___tag_value_eval_2na_64.571-.
-	.4byte ..___tag_value_eval_2na_64.597-..___tag_value_eval_2na_64.571
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.572-..___tag_value_eval_2na_64.571
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.574-..___tag_value_eval_2na_64.572
-	.byte 0x8f
-	.byte 0x09
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.575-..___tag_value_eval_2na_64.574
-	.byte 0x8e
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.576-..___tag_value_eval_2na_64.575
-	.byte 0x8d
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.577-..___tag_value_eval_2na_64.576
-	.byte 0x8c
-	.byte 0x07
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.578-..___tag_value_eval_2na_64.577
-	.byte 0x83
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.579-..___tag_value_eval_2na_64.578
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.580-..___tag_value_eval_2na_64.579
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.581-..___tag_value_eval_2na_64.580
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.582-..___tag_value_eval_2na_64.581
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.583-..___tag_value_eval_2na_64.582
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.584-..___tag_value_eval_2na_64.583
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.585-..___tag_value_eval_2na_64.584
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x07
-	.byte 0x8d
-	.byte 0x05
-	.byte 0x8e
-	.byte 0x08
-	.byte 0x8f
-	.byte 0x09
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.591-..___tag_value_eval_2na_64.585
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.592-..___tag_value_eval_2na_64.591
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.593-..___tag_value_eval_2na_64.592
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.594-..___tag_value_eval_2na_64.593
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.595-..___tag_value_eval_2na_64.594
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.596-..___tag_value_eval_2na_64.595
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x00
-	.4byte 0x000000cc
-	.4byte 0x00000e34
-	.4byte ..___tag_value_NucStrstrMake.598-.
-	.4byte ..___tag_value_NucStrstrMake.630-..___tag_value_NucStrstrMake.598
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.599-..___tag_value_NucStrstrMake.598
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.601-..___tag_value_NucStrstrMake.599
-	.byte 0x8f
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.602-..___tag_value_NucStrstrMake.601
-	.byte 0x8e
-	.byte 0x07
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.603-..___tag_value_NucStrstrMake.602
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.604-..___tag_value_NucStrstrMake.603
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.605-..___tag_value_NucStrstrMake.604
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.606-..___tag_value_NucStrstrMake.605
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.607-..___tag_value_NucStrstrMake.606
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.608-..___tag_value_NucStrstrMake.607
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.609-..___tag_value_NucStrstrMake.608
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.610-..___tag_value_NucStrstrMake.609
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x8e
-	.byte 0x07
-	.byte 0x8f
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.615-..___tag_value_NucStrstrMake.610
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.616-..___tag_value_NucStrstrMake.615
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.617-..___tag_value_NucStrstrMake.616
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.618-..___tag_value_NucStrstrMake.617
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.619-..___tag_value_NucStrstrMake.618
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.620-..___tag_value_NucStrstrMake.619
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x8e
-	.byte 0x07
-	.byte 0x8f
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.625-..___tag_value_NucStrstrMake.620
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.626-..___tag_value_NucStrstrMake.625
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.627-..___tag_value_NucStrstrMake.626
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.628-..___tag_value_NucStrstrMake.627
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.629-..___tag_value_NucStrstrMake.628
-	.byte 0x09
-	.2byte 0x0606
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x00000144
-	.4byte 0x00000f04
-	.4byte ..___tag_value_nss_expr.631-.
-	.4byte ..___tag_value_nss_expr.684-..___tag_value_nss_expr.631
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.632-..___tag_value_nss_expr.631
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.634-..___tag_value_nss_expr.632
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.635-..___tag_value_nss_expr.634
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.636-..___tag_value_nss_expr.635
-	.byte 0x8c
-	.byte 0x07
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.637-..___tag_value_nss_expr.636
-	.byte 0x83
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.638-..___tag_value_nss_expr.637
-	.byte 0x8f
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.639-..___tag_value_nss_expr.638
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.640-..___tag_value_nss_expr.639
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.641-..___tag_value_nss_expr.640
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.642-..___tag_value_nss_expr.641
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.643-..___tag_value_nss_expr.642
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.644-..___tag_value_nss_expr.643
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.645-..___tag_value_nss_expr.644
-	.byte 0x83
-	.byte 0x08
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x07
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.651-..___tag_value_nss_expr.645
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.652-..___tag_value_nss_expr.651
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.653-..___tag_value_nss_expr.652
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.654-..___tag_value_nss_expr.653
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.655-..___tag_value_nss_expr.654
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.656-..___tag_value_nss_expr.655
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.657-..___tag_value_nss_expr.656
-	.byte 0x83
-	.byte 0x08
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x07
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.663-..___tag_value_nss_expr.657
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x8f
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.665-..___tag_value_nss_expr.663
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.666-..___tag_value_nss_expr.665
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.667-..___tag_value_nss_expr.666
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.668-..___tag_value_nss_expr.667
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.669-..___tag_value_nss_expr.668
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.670-..___tag_value_nss_expr.669
-	.byte 0x83
-	.byte 0x08
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x07
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.675-..___tag_value_nss_expr.670
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.676-..___tag_value_nss_expr.675
-	.byte 0x8f
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.677-..___tag_value_nss_expr.676
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.678-..___tag_value_nss_expr.677
-	.byte 0x8f
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.679-..___tag_value_nss_expr.678
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.680-..___tag_value_nss_expr.679
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.681-..___tag_value_nss_expr.680
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.682-..___tag_value_nss_expr.681
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.683-..___tag_value_nss_expr.682
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x00
-	.4byte 0x000000bc
-	.4byte 0x0000104c
-	.4byte ..___tag_value_nss_unary_expr.685-.
-	.4byte ..___tag_value_nss_unary_expr.717-..___tag_value_nss_unary_expr.685
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.686-..___tag_value_nss_unary_expr.685
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.688-..___tag_value_nss_unary_expr.686
-	.byte 0x8f
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.689-..___tag_value_nss_unary_expr.688
-	.byte 0x8e
-	.byte 0x07
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.690-..___tag_value_nss_unary_expr.689
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.691-..___tag_value_nss_unary_expr.690
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.692-..___tag_value_nss_unary_expr.691
-	.byte 0x83
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.693-..___tag_value_nss_unary_expr.692
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.694-..___tag_value_nss_unary_expr.693
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.695-..___tag_value_nss_unary_expr.694
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.696-..___tag_value_nss_unary_expr.695
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.697-..___tag_value_nss_unary_expr.696
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.698-..___tag_value_nss_unary_expr.697
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.699-..___tag_value_nss_unary_expr.698
-	.byte 0x83
-	.byte 0x04
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x8e
-	.byte 0x07
-	.byte 0x8f
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.705-..___tag_value_nss_unary_expr.699
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.706-..___tag_value_nss_unary_expr.705
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.707-..___tag_value_nss_unary_expr.706
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.708-..___tag_value_nss_unary_expr.707
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.709-..___tag_value_nss_unary_expr.708
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.710-..___tag_value_nss_unary_expr.709
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.711-..___tag_value_nss_unary_expr.710
-	.byte 0x83
-	.byte 0x04
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x8e
-	.byte 0x07
-	.byte 0x8f
-	.byte 0x08
-	.4byte 0x00000104
-	.4byte 0x0000110c
-	.4byte ..___tag_value_nss_primary_expr.718-.
-	.4byte ..___tag_value_nss_primary_expr.762-..___tag_value_nss_primary_expr.718
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.719-..___tag_value_nss_primary_expr.718
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.721-..___tag_value_nss_primary_expr.719
-	.byte 0x8f
-	.byte 0x07
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.722-..___tag_value_nss_primary_expr.721
-	.byte 0x8e
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.723-..___tag_value_nss_primary_expr.722
-	.byte 0x8d
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.724-..___tag_value_nss_primary_expr.723
-	.byte 0x8c
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.725-..___tag_value_nss_primary_expr.724
-	.byte 0x83
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.726-..___tag_value_nss_primary_expr.725
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.727-..___tag_value_nss_primary_expr.726
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.728-..___tag_value_nss_primary_expr.727
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.729-..___tag_value_nss_primary_expr.728
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.730-..___tag_value_nss_primary_expr.729
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.731-..___tag_value_nss_primary_expr.730
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.732-..___tag_value_nss_primary_expr.731
-	.byte 0x83
-	.byte 0x03
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x04
-	.byte 0x8d
-	.byte 0x05
-	.byte 0x8e
-	.byte 0x06
-	.byte 0x8f
-	.byte 0x07
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.738-..___tag_value_nss_primary_expr.732
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.739-..___tag_value_nss_primary_expr.738
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.740-..___tag_value_nss_primary_expr.739
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.741-..___tag_value_nss_primary_expr.740
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.742-..___tag_value_nss_primary_expr.741
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.743-..___tag_value_nss_primary_expr.742
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.744-..___tag_value_nss_primary_expr.743
-	.byte 0x83
-	.byte 0x03
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x04
-	.byte 0x8d
-	.byte 0x05
-	.byte 0x8e
-	.byte 0x06
-	.byte 0x8f
-	.byte 0x07
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.750-..___tag_value_nss_primary_expr.744
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.751-..___tag_value_nss_primary_expr.750
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.752-..___tag_value_nss_primary_expr.751
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.753-..___tag_value_nss_primary_expr.752
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.754-..___tag_value_nss_primary_expr.753
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.755-..___tag_value_nss_primary_expr.754
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_nss_primary_expr.756-..___tag_value_nss_primary_expr.755
-	.byte 0x83
-	.byte 0x03
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x04
-	.byte 0x8d
-	.byte 0x05
-	.byte 0x8e
-	.byte 0x06
-	.byte 0x8f
-	.byte 0x07
-	.4byte 0x00000000
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x0000005c
-	.4byte 0x00001214
-	.4byte ..___tag_value_nss_sob.763-.
-	.4byte ..___tag_value_nss_sob.775-..___tag_value_nss_sob.763
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_nss_sob.764-..___tag_value_nss_sob.763
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_sob.766-..___tag_value_nss_sob.764
-	.byte 0x8f
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_nss_sob.767-..___tag_value_nss_sob.766
-	.byte 0x8e
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_nss_sob.768-..___tag_value_nss_sob.767
-	.byte 0x8d
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_nss_sob.769-..___tag_value_nss_sob.768
-	.byte 0x83
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_nss_sob.770-..___tag_value_nss_sob.769
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_sob.771-..___tag_value_nss_sob.770
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_nss_sob.772-..___tag_value_nss_sob.771
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_nss_sob.773-..___tag_value_nss_sob.772
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_nss_sob.774-..___tag_value_nss_sob.773
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x00
-	.4byte 0x000000ac
-	.4byte 0x00001274
-	.4byte ..___tag_value_nss_fasta_expr.776-.
-	.4byte ..___tag_value_nss_fasta_expr.802-..___tag_value_nss_fasta_expr.776
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.777-..___tag_value_nss_fasta_expr.776
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.779-..___tag_value_nss_fasta_expr.777
-	.byte 0x8f
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.780-..___tag_value_nss_fasta_expr.779
-	.byte 0x8e
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.781-..___tag_value_nss_fasta_expr.780
-	.byte 0x8d
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.782-..___tag_value_nss_fasta_expr.781
-	.byte 0x8c
-	.byte 0x07
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.783-..___tag_value_nss_fasta_expr.782
-	.byte 0x83
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.784-..___tag_value_nss_fasta_expr.783
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.785-..___tag_value_nss_fasta_expr.784
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.786-..___tag_value_nss_fasta_expr.785
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.787-..___tag_value_nss_fasta_expr.786
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.788-..___tag_value_nss_fasta_expr.787
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.789-..___tag_value_nss_fasta_expr.788
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.790-..___tag_value_nss_fasta_expr.789
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x07
-	.byte 0x8d
-	.byte 0x08
-	.byte 0x8e
-	.byte 0x04
-	.byte 0x8f
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.796-..___tag_value_nss_fasta_expr.790
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.797-..___tag_value_nss_fasta_expr.796
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.798-..___tag_value_nss_fasta_expr.797
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.799-..___tag_value_nss_fasta_expr.798
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.800-..___tag_value_nss_fasta_expr.799
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.801-..___tag_value_nss_fasta_expr.800
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x00
-	.4byte 0x0000007c
-	.4byte 0x00001324
-	.4byte ..___tag_value_nss_FASTA_expr.803-.
-	.4byte ..___tag_value_nss_FASTA_expr.823-..___tag_value_nss_FASTA_expr.803
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_nss_FASTA_expr.804-..___tag_value_nss_FASTA_expr.803
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_FASTA_expr.806-..___tag_value_nss_FASTA_expr.804
-	.byte 0x8f
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_nss_FASTA_expr.807-..___tag_value_nss_FASTA_expr.806
-	.byte 0x8e
-	.byte 0x07
-	.byte 0x04
-	.4byte ..___tag_value_nss_FASTA_expr.808-..___tag_value_nss_FASTA_expr.807
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_nss_FASTA_expr.809-..___tag_value_nss_FASTA_expr.808
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_nss_FASTA_expr.810-..___tag_value_nss_FASTA_expr.809
-	.byte 0x83
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_nss_FASTA_expr.811-..___tag_value_nss_FASTA_expr.810
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_FASTA_expr.812-..___tag_value_nss_FASTA_expr.811
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_nss_FASTA_expr.813-..___tag_value_nss_FASTA_expr.812
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_nss_FASTA_expr.814-..___tag_value_nss_FASTA_expr.813
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_nss_FASTA_expr.815-..___tag_value_nss_FASTA_expr.814
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_nss_FASTA_expr.816-..___tag_value_nss_FASTA_expr.815
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_nss_FASTA_expr.817-..___tag_value_nss_FASTA_expr.816
-	.byte 0x83
-	.byte 0x04
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x8d
-	.byte 0x06
-	.byte 0x8e
-	.byte 0x07
-	.byte 0x8f
-	.byte 0x08
-	.byte 0x00
-	.4byte 0x000000ec
-	.4byte 0x000013a4
-	.4byte ..___tag_value_NucStrFastaExprMake2.824-.
-	.4byte ..___tag_value_NucStrFastaExprMake2.862-..___tag_value_NucStrFastaExprMake2.824
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.825-..___tag_value_NucStrFastaExprMake2.824
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.827-..___tag_value_NucStrFastaExprMake2.825
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.828-..___tag_value_NucStrFastaExprMake2.827
-	.byte 0x8e
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.829-..___tag_value_NucStrFastaExprMake2.828
-	.byte 0x8d
-	.byte 0x07
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.830-..___tag_value_NucStrFastaExprMake2.829
-	.byte 0x8c
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.831-..___tag_value_NucStrFastaExprMake2.830
-	.byte 0x83
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.832-..___tag_value_NucStrFastaExprMake2.831
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.833-..___tag_value_NucStrFastaExprMake2.832
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.834-..___tag_value_NucStrFastaExprMake2.833
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.835-..___tag_value_NucStrFastaExprMake2.834
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.836-..___tag_value_NucStrFastaExprMake2.835
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.837-..___tag_value_NucStrFastaExprMake2.836
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.838-..___tag_value_NucStrFastaExprMake2.837
-	.byte 0x83
-	.byte 0x05
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x04
-	.byte 0x8d
-	.byte 0x07
-	.byte 0x8e
-	.byte 0x08
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.844-..___tag_value_NucStrFastaExprMake2.838
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.845-..___tag_value_NucStrFastaExprMake2.844
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.846-..___tag_value_NucStrFastaExprMake2.845
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.847-..___tag_value_NucStrFastaExprMake2.846
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.848-..___tag_value_NucStrFastaExprMake2.847
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.849-..___tag_value_NucStrFastaExprMake2.848
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.850-..___tag_value_NucStrFastaExprMake2.849
-	.byte 0x83
-	.byte 0x05
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x04
-	.byte 0x8d
-	.byte 0x07
-	.byte 0x8e
-	.byte 0x08
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.856-..___tag_value_NucStrFastaExprMake2.850
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.857-..___tag_value_NucStrFastaExprMake2.856
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.858-..___tag_value_NucStrFastaExprMake2.857
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.859-..___tag_value_NucStrFastaExprMake2.858
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.860-..___tag_value_NucStrFastaExprMake2.859
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.861-..___tag_value_NucStrFastaExprMake2.860
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000044
-	.4byte 0x00001494
-	.4byte ..___tag_value_uint128_bswap_copy.863-.
-	.4byte ..___tag_value_uint128_bswap_copy.871-..___tag_value_uint128_bswap_copy.863
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_uint128_bswap_copy.864-..___tag_value_uint128_bswap_copy.863
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_uint128_bswap_copy.866-..___tag_value_uint128_bswap_copy.864
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_uint128_bswap_copy.867-..___tag_value_uint128_bswap_copy.866
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_uint128_bswap_copy.868-..___tag_value_uint128_bswap_copy.867
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_uint128_bswap_copy.869-..___tag_value_uint128_bswap_copy.868
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_uint128_bswap_copy.870-..___tag_value_uint128_bswap_copy.869
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x00000044
-	.4byte 0x000014dc
-	.4byte ..___tag_value_uint128_shr.872-.
-	.4byte ..___tag_value_uint128_shr.880-..___tag_value_uint128_shr.872
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_uint128_shr.873-..___tag_value_uint128_shr.872
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_uint128_shr.875-..___tag_value_uint128_shr.873
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_uint128_shr.876-..___tag_value_uint128_shr.875
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_uint128_shr.877-..___tag_value_uint128_shr.876
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_uint128_shr.878-..___tag_value_uint128_shr.877
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_uint128_shr.879-..___tag_value_uint128_shr.878
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x00000034
-	.4byte 0x00001524
-	.4byte ..___tag_value_uint128_bswap.881-.
-	.4byte ..___tag_value_uint128_bswap.887-..___tag_value_uint128_bswap.881
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_uint128_bswap.882-..___tag_value_uint128_bswap.881
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_uint128_bswap.884-..___tag_value_uint128_bswap.882
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_uint128_bswap.885-..___tag_value_uint128_bswap.884
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_uint128_bswap.886-..___tag_value_uint128_bswap.885
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.2byte 0x0000
-	.4byte 0x00000034
-	.4byte 0x0000155c
-	.4byte ..___tag_value_NucStrFastaExprAlloc.888-.
-	.4byte ..___tag_value_NucStrFastaExprAlloc.894-..___tag_value_NucStrFastaExprAlloc.888
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprAlloc.889-..___tag_value_NucStrFastaExprAlloc.888
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprAlloc.891-..___tag_value_NucStrFastaExprAlloc.889
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprAlloc.892-..___tag_value_NucStrFastaExprAlloc.891
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprAlloc.893-..___tag_value_NucStrFastaExprAlloc.892
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.2byte 0x0000
-	.4byte 0x000000ec
-	.4byte 0x00001594
-	.4byte ..___tag_value_NucStrFastaExprMake4.895-.
-	.4byte ..___tag_value_NucStrFastaExprMake4.933-..___tag_value_NucStrFastaExprMake4.895
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.896-..___tag_value_NucStrFastaExprMake4.895
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.898-..___tag_value_NucStrFastaExprMake4.896
-	.byte 0x8f
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.899-..___tag_value_NucStrFastaExprMake4.898
-	.byte 0x8e
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.900-..___tag_value_NucStrFastaExprMake4.899
-	.byte 0x8d
-	.byte 0x07
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.901-..___tag_value_NucStrFastaExprMake4.900
-	.byte 0x8c
-	.byte 0x08
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.902-..___tag_value_NucStrFastaExprMake4.901
-	.byte 0x83
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.903-..___tag_value_NucStrFastaExprMake4.902
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.904-..___tag_value_NucStrFastaExprMake4.903
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.905-..___tag_value_NucStrFastaExprMake4.904
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.906-..___tag_value_NucStrFastaExprMake4.905
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.907-..___tag_value_NucStrFastaExprMake4.906
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.908-..___tag_value_NucStrFastaExprMake4.907
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.909-..___tag_value_NucStrFastaExprMake4.908
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x08
-	.byte 0x8d
-	.byte 0x07
-	.byte 0x8e
-	.byte 0x04
-	.byte 0x8f
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.915-..___tag_value_NucStrFastaExprMake4.909
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.916-..___tag_value_NucStrFastaExprMake4.915
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.917-..___tag_value_NucStrFastaExprMake4.916
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.918-..___tag_value_NucStrFastaExprMake4.917
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.919-..___tag_value_NucStrFastaExprMake4.918
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.920-..___tag_value_NucStrFastaExprMake4.919
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.921-..___tag_value_NucStrFastaExprMake4.920
-	.byte 0x83
-	.byte 0x06
-	.byte 0x86
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x08
-	.byte 0x8d
-	.byte 0x07
-	.byte 0x8e
-	.byte 0x04
-	.byte 0x8f
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.927-..___tag_value_NucStrFastaExprMake4.921
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.928-..___tag_value_NucStrFastaExprMake4.927
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.929-..___tag_value_NucStrFastaExprMake4.928
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.930-..___tag_value_NucStrFastaExprMake4.929
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.931-..___tag_value_NucStrFastaExprMake4.930
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.932-..___tag_value_NucStrFastaExprMake4.931
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000034
-	.4byte 0x00001684
-	.4byte ..___tag_value_NucStrstrWhack.934-.
-	.4byte ..___tag_value_NucStrstrWhack.940-..___tag_value_NucStrstrWhack.934
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrWhack.935-..___tag_value_NucStrstrWhack.934
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrWhack.937-..___tag_value_NucStrstrWhack.935
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrWhack.938-..___tag_value_NucStrstrWhack.937
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrWhack.939-..___tag_value_NucStrstrWhack.938
-	.byte 0x09
-	.2byte 0x0606
-	.4byte 0x00000000
-	.2byte 0x0000
-	.4byte 0x0000004c
-	.4byte 0x000016bc
-	.4byte ..___tag_value_NucStrstrInit.941-.
-	.4byte ..___tag_value_NucStrstrInit.951-..___tag_value_NucStrstrInit.941
-	.byte 0x00
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrInit.942-..___tag_value_NucStrstrInit.941
-	.byte 0x0c
-	.2byte 0x1006
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrInit.944-..___tag_value_NucStrstrInit.942
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrInit.945-..___tag_value_NucStrstrInit.944
-	.byte 0x8c
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrInit.946-..___tag_value_NucStrstrInit.945
-	.byte 0x83
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrInit.947-..___tag_value_NucStrstrInit.946
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrInit.948-..___tag_value_NucStrstrInit.947
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrInit.949-..___tag_value_NucStrstrInit.948
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrInit.950-..___tag_value_NucStrstrInit.949
-	.byte 0x09
-	.2byte 0x0606
-	.section .text
-.LNDBG_TXe:
-# End
diff --git a/libs/search/nucstrstr-icc-x86_64-rel.pic.s b/libs/search/nucstrstr-icc-x86_64-rel.pic.s
deleted file mode 100644
index a133692..0000000
--- a/libs/search/nucstrstr-icc-x86_64-rel.pic.s
+++ /dev/null
@@ -1,9908 +0,0 @@
-# -- Machine type EFI2
-# mark_description "Intel(R) C++ Compiler Professional for applications running on Intel(R) 64, Version 11.0    Build 20090131 %";
-# mark_description "s";
-# mark_description "-I/home/yaschenk/devel/internal/asm-trace/sra/search/linux -I/home/yaschenk/devel/internal/asm-trace/sra/sea";
-# mark_description "rch/unix -I/home/yaschenk/devel/internal/asm-trace/sra/search -I/home/yaschenk/devel/internal/asm-trace/itf ";
-# mark_description "-I/home/yaschenk/devel/internal/asm-trace/inc/icc/x86_64 -I/home/yaschenk/devel/internal/asm-trace/inc/icc -";
-# mark_description "I/home/yaschenk/devel/internal/asm-trace/inc/gcc/x86_64 -I/home/yaschenk/devel/internal/asm-trace/inc/gcc -I";
-# mark_description "/home/yaschenk/devel/internal/asm-trace/inc/linux -I/home/yaschenk/devel/internal/asm-trace/inc/unix -I/home";
-# mark_description "/yaschenk/devel/internal/asm-trace/inc -c -S -o nucstrstr.pic.s -fPIC -O3 -unroll -xW -DNDEBUG -DLINUX -DUNI";
-# mark_description "X -D_GNU_SOURCE -D_REENTRANT -D_FILE_OFFSET_BITS=64 -MD";
-	.file "nucstrstr.c"
-	.text
-..TXTST0:
-# -- Begin  NucStrstrSearch
-# mark_begin;
-       .align    16,0x90
-	.globl NucStrstrSearch
-NucStrstrSearch:
-# parameter 1: %rdi
-# parameter 2: %rsi
-# parameter 3: %edx
-# parameter 4: %ecx
-# parameter 5: %r8
-..B1.1:                         # Preds ..B1.0
-..___tag_value_NucStrstrSearch.1:                               #5217.1
-        pushq     %rbx                                          #5217.1
-..___tag_value_NucStrstrSearch.3:                               #
-        subq      $32, %rsp                                     #5217.1
-..___tag_value_NucStrstrSearch.5:                               #
-        movq      %rdi, %rbx                                    #5217.1
-        testq     %rbx, %rbx                                    #5218.18
-        je        ..B1.107      # Prob 6%                       #5218.18
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 edx ecx
-..B1.2:                         # Preds ..B1.1
-        testq     %rsi, %rsi                                    #5218.37
-        je        ..B1.107      # Prob 6%                       #5218.37
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 edx ecx
-..B1.4:                         # Preds ..B1.2 ..B1.14 ..B1.17
-        testl     %ecx, %ecx                                    #5218.52
-        je        ..B1.107      # Prob 28%                      #5218.52
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 edx ecx
-..B1.6:                         # Preds ..B1.4
-        movq      %r12, 24(%rsp)                                #
-..___tag_value_NucStrstrSearch.6:                               #
-        movq      %rsi, %r12                                    #
-        movq      %r13, 16(%rsp)                                #
-..___tag_value_NucStrstrSearch.7:                               #
-        movq      %r14, 8(%rsp)                                 #
-..___tag_value_NucStrstrSearch.8:                               #
-        movq      %r15, (%rsp)                                  #
-..___tag_value_NucStrstrSearch.9:                               #
-        movl      %edx, %r13d                                   #
-        movl      %ecx, %r14d                                   #
-        movq      %r8, %r15                                     #
-                                # LOE rbx rbp r12 r15 r13d r14d
-..B1.7:                         # Preds ..B1.31 ..B1.6
-        movl      (%rbx), %eax                                  #5223.18
-        cmpl      $12, %eax                                     #5223.9
-        ja        ..B1.32       # Prob 28%                      #5223.9
-                                # LOE rbx rbp r12 r15 eax r13d r14d
-..B1.8:                         # Preds ..B1.7
-        movl      %eax, %eax                                    #5223.9
-        lea       ..1..TPKT.30_0.0.1(%rip), %rdi                #5223.9
-        movq      (%rdi,%rax,8), %r9                            #5223.9
-        jmp       *%r9                                          #5223.9
-                                # LOE rbx rbp r12 r15 r13d r14d
-..1.30_0.TAG.0c.0.1:
-..B1.9:                         # Preds ..B1.8
-        movq      %r12, %rsi                                    #
-        movq      24(%rsp), %r12                                #
-..___tag_value_NucStrstrSearch.10:                              #
-        movl      %r13d, %edx                                   #
-        movq      16(%rsp), %r13                                #
-..___tag_value_NucStrstrSearch.11:                              #
-        movl      %r14d, %ecx                                   #
-        movq      %r15, %r8                                     #
-        movq      8(%rsp), %r14                                 #
-..___tag_value_NucStrstrSearch.12:                              #
-        movq      (%rsp), %r15                                  #
-..___tag_value_NucStrstrSearch.13:                              #
-..___tag_value_NucStrstrSearch.14:                              #
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 edx ecx
-..B1.10:                        # Preds ..B1.9
-        movl      4(%rbx), %eax                                 #5286.22
-        testl     %eax, %eax                                    #5286.22
-        je        ..B1.20       # Prob 20%                      #5286.22
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 eax edx ecx
-..B1.11:                        # Preds ..B1.10
-        cmpl      $13, %eax                                     #5286.22
-        je        ..B1.20       # Prob 25%                      #5286.22
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 eax edx ecx
-..B1.12:                        # Preds ..B1.11
-        cmpl      $14, %eax                                     #5286.22
-        jne       ..B1.15       # Prob 67%                      #5286.22
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 eax edx ecx
-..B1.13:                        # Preds ..B1.12
-        movq      8(%rbx), %rbx                                 #5297.29
-        movl      4(%rbx), %eax                                 #5297.29
-        cmpl      %ecx, %eax                                    #5298.34
-        ja        ..B1.107      # Prob 12%                      #5298.34
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 eax edx
-..B1.14:                        # Preds ..B1.13
-        movl      %eax, %ecx                                    #5297.17
-        testq     %rbx, %rbx                                    #5218.18
-        jne       ..B1.4        # Prob 94%                      #5218.18
-        jmp       ..B1.107      # Prob 100%                     #5218.18
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 edx ecx
-..B1.15:                        # Preds ..B1.12
-        cmpl      $15, %eax                                     #5286.22
-        jne       ..B1.107      # Prob 50%                      #5286.22
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 edx ecx
-..B1.16:                        # Preds ..B1.15
-        movq      8(%rbx), %rbx                                 #5302.29
-        movl      4(%rbx), %eax                                 #5302.29
-        cmpl      %ecx, %eax                                    #5303.34
-        ja        ..B1.107      # Prob 12%                      #5303.34
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 eax edx ecx
-..B1.17:                        # Preds ..B1.16
-        addl      %ecx, %edx                                    #5306.27
-        subl      %eax, %edx                                    #5306.33
-        movl      %eax, %ecx                                    #5302.17
-        testq     %rbx, %rbx                                    #5218.18
-        jne       ..B1.4        # Prob 94%                      #5218.18
-        jmp       ..B1.107      # Prob 100%                     #5218.18
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 edx ecx
-..B1.20:                        # Preds ..B1.10 ..B1.11
-        movq      8(%rbx), %rdi                                 #5290.25
-        call      NucStrstrSearch at PLT                           #5290.25
-                                # LOE rbx rbp r12 r13 r14 r15 eax
-..B1.21:                        # Preds ..B1.20
-        movl      4(%rbx), %edx                                 #5291.22
-        testl     %edx, %edx                                    #5291.42
-        je        ..B1.56       # Prob 28%                      #5291.42
-                                # LOE rbp r12 r13 r14 r15 eax
-..B1.22:                        # Preds ..B1.21
-        testl     %eax, %eax                                    #5293.31
-        jne       ..B1.107      # Prob 50%                      #5293.31
-                                # LOE rbp r12 r13 r14 r15
-..B1.23:                        # Preds ..B1.22
-        movl      $1, %eax                                      #5294.28
-        addq      $32, %rsp                                     #5294.28
-..___tag_value_NucStrstrSearch.18:                              #
-        popq      %rbx                                          #5294.28
-..___tag_value_NucStrstrSearch.20:                              #
-        ret                                                     #5294.28
-..___tag_value_NucStrstrSearch.21:                              #
-                                # LOE
-..1.30_0.TAG.0b.0.1:
-..B1.26:                        # Preds ..B1.8
-        movq      8(%rbx), %rdi                                 #5272.21
-        movq      %r12, %rsi                                    #5272.21
-        movl      %r13d, %edx                                   #5272.21
-        movl      %r14d, %ecx                                   #5272.21
-        movq      %r15, %r8                                     #5272.21
-        call      NucStrstrSearch at PLT                           #5272.21
-                                # LOE rbx rbp r12 r15 eax r13d r14d
-..B1.27:                        # Preds ..B1.26
-        movl      4(%rbx), %edi                                 #5273.22
-        cmpl      $17, %edi                                     #5273.22
-        jne       ..B1.29       # Prob 67%                      #5273.22
-                                # LOE rbx rbp r12 r15 eax edi r13d r14d
-..B1.28:                        # Preds ..B1.27
-        testl     %eax, %eax                                    #5276.31
-        jne       ..B1.111      # Prob 12%                      #5276.31
-        jmp       ..B1.31       # Prob 100%                     #5276.31
-                                # LOE rbx rbp r12 r15 eax r13d r14d
-..B1.29:                        # Preds ..B1.27
-        cmpl      $16, %edi                                     #5273.22
-        jne       ..B1.31       # Prob 50%                      #5273.22
-                                # LOE rbx rbp r12 r15 eax r13d r14d
-..B1.30:                        # Preds ..B1.29
-        testl     %eax, %eax                                    #5280.31
-        je        ..B1.111      # Prob 12%                      #5280.31
-                                # LOE rbx rbp r12 r15 eax r13d r14d
-..B1.31:                        # Preds ..B1.28 ..B1.30 ..B1.29
-        movq      16(%rbx), %rbx                                #5284.38
-        testq     %rbx, %rbx                                    #5218.18
-        jne       ..B1.7        # Prob 94%                      #5218.18
-                                # LOE rbx rbp r12 r15 r13d r14d
-..B1.32:                        # Preds ..B1.7 ..B1.31
-        movq      24(%rsp), %r12                                #
-..___tag_value_NucStrstrSearch.23:                              #
-        movq      16(%rsp), %r13                                #
-..___tag_value_NucStrstrSearch.24:                              #
-        movq      8(%rsp), %r14                                 #
-..___tag_value_NucStrstrSearch.25:                              #
-        movq      (%rsp), %r15                                  #
-..___tag_value_NucStrstrSearch.26:                              #
-        jmp       ..B1.107      # Prob 100%                     #
-..___tag_value_NucStrstrSearch.27:                              #
-                                # LOE rbp r12 r13 r14 r15
-..1.30_0.TAG.0a.0.1:
-..B1.33:                        # Preds ..B1.8
-        movq      %r12, %rsi                                    #
-        movq      24(%rsp), %r12                                #
-..___tag_value_NucStrstrSearch.31:                              #
-        movl      %r13d, %edx                                   #
-        movq      16(%rsp), %r13                                #
-..___tag_value_NucStrstrSearch.32:                              #
-        movl      %r14d, %ecx                                   #
-        movq      %r15, %r8                                     #
-        movq      8(%rsp), %r14                                 #
-..___tag_value_NucStrstrSearch.33:                              #
-        movq      (%rsp), %r15                                  #
-..___tag_value_NucStrstrSearch.34:                              #
-..___tag_value_NucStrstrSearch.35:                              #
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 edx ecx
-..B1.34:                        # Preds ..B1.33
-        movl      4(%rbx), %eax                                 #5268.24
-        cmpl      %eax, %ecx                                    #5268.24
-        jb        ..B1.107      # Prob 28%                      #5268.24
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 eax edx ecx
-..B1.35:                        # Preds ..B1.34
-        testq     %r8, %r8                                      #5269.9
-        je        ..B1.37       # Prob 12%                      #5269.9
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 eax edx ecx
-..B1.36:                        # Preds ..B1.35
-        movl      %eax, (%r8)                                   #5269.18
-                                # LOE rbx rbp rsi r12 r13 r14 r15 edx ecx
-..B1.37:                        # Preds ..B1.35 ..B1.36
-        movq      %rbx, %rdi                                    #5270.20
-        call      eval_4na_pos at PLT                              #5270.20
-                                # LOE rbp r12 r13 r14 r15 eax
-..B1.119:                       # Preds ..B1.37
-        addq      $32, %rsp                                     #5270.20
-..___tag_value_NucStrstrSearch.39:                              #
-        popq      %rbx                                          #5270.20
-..___tag_value_NucStrstrSearch.41:                              #
-        ret                                                     #5270.20
-..___tag_value_NucStrstrSearch.42:                              #
-                                # LOE
-..1.30_0.TAG.09.0.1:
-..B1.39:                        # Preds ..B1.8
-        movq      %r12, %rsi                                    #
-        movq      24(%rsp), %r12                                #
-..___tag_value_NucStrstrSearch.44:                              #
-        movl      %r13d, %edx                                   #
-        movq      16(%rsp), %r13                                #
-..___tag_value_NucStrstrSearch.45:                              #
-        movl      %r14d, %ecx                                   #
-        movq      %r15, %r8                                     #
-        movq      8(%rsp), %r14                                 #
-..___tag_value_NucStrstrSearch.46:                              #
-        movq      (%rsp), %r15                                  #
-..___tag_value_NucStrstrSearch.47:                              #
-..___tag_value_NucStrstrSearch.48:                              #
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 edx ecx
-..B1.40:                        # Preds ..B1.39
-        movl      4(%rbx), %eax                                 #5264.24
-        cmpl      %eax, %ecx                                    #5264.24
-        jb        ..B1.107      # Prob 28%                      #5264.24
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 eax edx ecx
-..B1.41:                        # Preds ..B1.40
-        testq     %r8, %r8                                      #5265.9
-        je        ..B1.43       # Prob 12%                      #5265.9
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 eax edx ecx
-..B1.42:                        # Preds ..B1.41
-        movl      %eax, (%r8)                                   #5265.18
-                                # LOE rbx rbp rsi r12 r13 r14 r15 edx ecx
-..B1.43:                        # Preds ..B1.41 ..B1.42
-        movq      %rbx, %rdi                                    #5266.20
-        call      eval_2na_pos at PLT                              #5266.20
-                                # LOE rbp r12 r13 r14 r15 eax
-..B1.120:                       # Preds ..B1.43
-        addq      $32, %rsp                                     #5266.20
-..___tag_value_NucStrstrSearch.52:                              #
-        popq      %rbx                                          #5266.20
-..___tag_value_NucStrstrSearch.54:                              #
-        ret                                                     #5266.20
-..___tag_value_NucStrstrSearch.55:                              #
-                                # LOE
-..1.30_0.TAG.08.0.1:
-..B1.45:                        # Preds ..B1.8
-        movq      %r12, %rsi                                    #
-        movq      24(%rsp), %r12                                #
-..___tag_value_NucStrstrSearch.57:                              #
-        movl      %r13d, %edx                                   #
-        movq      16(%rsp), %r13                                #
-..___tag_value_NucStrstrSearch.58:                              #
-        movl      %r14d, %ecx                                   #
-        movq      %r15, %r8                                     #
-        movq      8(%rsp), %r14                                 #
-..___tag_value_NucStrstrSearch.59:                              #
-        movq      (%rsp), %r15                                  #
-..___tag_value_NucStrstrSearch.60:                              #
-..___tag_value_NucStrstrSearch.61:                              #
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 edx ecx
-..B1.46:                        # Preds ..B1.45
-        movl      4(%rbx), %eax                                 #5259.24
-        cmpl      %eax, %ecx                                    #5259.24
-        jb        ..B1.107      # Prob 28%                      #5259.24
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 eax edx ecx
-..B1.47:                        # Preds ..B1.46
-        testq     %r8, %r8                                      #5260.9
-        je        ..B1.49       # Prob 12%                      #5260.9
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 eax edx ecx
-..B1.48:                        # Preds ..B1.47
-        movl      %eax, (%r8)                                   #5260.18
-                                # LOE rbx rbp rsi r12 r13 r14 r15 edx ecx
-..B1.49:                        # Preds ..B1.47 ..B1.48
-        movq      %rbx, %rdi                                    #5261.20
-        call      eval_4na_128 at PLT                              #5261.20
-                                # LOE rbp r12 r13 r14 r15 eax
-..B1.121:                       # Preds ..B1.49
-        addq      $32, %rsp                                     #5261.20
-..___tag_value_NucStrstrSearch.65:                              #
-        popq      %rbx                                          #5261.20
-..___tag_value_NucStrstrSearch.67:                              #
-        ret                                                     #5261.20
-..___tag_value_NucStrstrSearch.68:                              #
-                                # LOE
-..1.30_0.TAG.07.0.1:
-..B1.51:                        # Preds ..B1.8
-        movq      %r12, %rsi                                    #
-        movq      24(%rsp), %r12                                #
-..___tag_value_NucStrstrSearch.70:                              #
-        movl      %r13d, %edx                                   #
-        movq      16(%rsp), %r13                                #
-..___tag_value_NucStrstrSearch.71:                              #
-        movl      %r14d, %ecx                                   #
-        movq      %r15, %r8                                     #
-        movq      8(%rsp), %r14                                 #
-..___tag_value_NucStrstrSearch.72:                              #
-        movq      (%rsp), %r15                                  #
-..___tag_value_NucStrstrSearch.73:                              #
-..___tag_value_NucStrstrSearch.74:                              #
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 edx ecx
-..B1.52:                        # Preds ..B1.51
-        movl      4(%rbx), %eax                                 #5255.24
-        cmpl      %eax, %ecx                                    #5255.24
-        jb        ..B1.107      # Prob 28%                      #5255.24
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 eax edx ecx
-..B1.53:                        # Preds ..B1.52
-        testq     %r8, %r8                                      #5256.9
-        je        ..B1.55       # Prob 12%                      #5256.9
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 eax edx ecx
-..B1.54:                        # Preds ..B1.53
-        movl      %eax, (%r8)                                   #5256.18
-                                # LOE rbx rbp rsi r12 r13 r14 r15 edx ecx
-..B1.55:                        # Preds ..B1.53 ..B1.54
-        movq      %rbx, %rdi                                    #5257.20
-        call      eval_4na_32 at PLT                               #5257.20
-                                # LOE rbp r12 r13 r14 r15 eax
-..B1.56:                        # Preds ..B1.21 ..B1.55
-        addq      $32, %rsp                                     #5257.20
-..___tag_value_NucStrstrSearch.78:                              #
-        popq      %rbx                                          #5257.20
-..___tag_value_NucStrstrSearch.80:                              #
-        ret                                                     #5257.20
-..___tag_value_NucStrstrSearch.81:                              #
-                                # LOE
-..1.30_0.TAG.06.0.1:
-..B1.58:                        # Preds ..B1.8
-        movq      %r12, %rsi                                    #
-        movq      24(%rsp), %r12                                #
-..___tag_value_NucStrstrSearch.83:                              #
-        movl      %r13d, %edx                                   #
-        movq      16(%rsp), %r13                                #
-..___tag_value_NucStrstrSearch.84:                              #
-        movl      %r14d, %ecx                                   #
-        movq      %r15, %r8                                     #
-        movq      8(%rsp), %r14                                 #
-..___tag_value_NucStrstrSearch.85:                              #
-        movq      (%rsp), %r15                                  #
-..___tag_value_NucStrstrSearch.86:                              #
-..___tag_value_NucStrstrSearch.87:                              #
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 edx ecx
-..B1.59:                        # Preds ..B1.58
-        movl      4(%rbx), %eax                                 #5251.24
-        cmpl      %eax, %ecx                                    #5251.24
-        jb        ..B1.107      # Prob 28%                      #5251.24
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 eax edx ecx
-..B1.60:                        # Preds ..B1.59
-        testq     %r8, %r8                                      #5252.9
-        je        ..B1.62       # Prob 12%                      #5252.9
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 eax edx ecx
-..B1.61:                        # Preds ..B1.60
-        movl      %eax, (%r8)                                   #5252.18
-                                # LOE rbx rbp rsi r12 r13 r14 r15 edx ecx
-..B1.62:                        # Preds ..B1.60 ..B1.61
-        movq      %rbx, %rdi                                    #5253.20
-        call      eval_4na_16 at PLT                               #5253.20
-                                # LOE rbp r12 r13 r14 r15 eax
-..B1.63:                        # Preds ..B1.62
-        addq      $32, %rsp                                     #5253.20
-..___tag_value_NucStrstrSearch.91:                              #
-        popq      %rbx                                          #5253.20
-..___tag_value_NucStrstrSearch.93:                              #
-        ret                                                     #5253.20
-..___tag_value_NucStrstrSearch.94:                              #
-                                # LOE
-..1.30_0.TAG.05.0.1:
-..B1.65:                        # Preds ..B1.8
-        movq      %r12, %rsi                                    #
-        movq      24(%rsp), %r12                                #
-..___tag_value_NucStrstrSearch.96:                              #
-        movl      %r13d, %edx                                   #
-        movq      16(%rsp), %r13                                #
-..___tag_value_NucStrstrSearch.97:                              #
-        movl      %r14d, %ecx                                   #
-        movq      %r15, %r8                                     #
-        movq      8(%rsp), %r14                                 #
-..___tag_value_NucStrstrSearch.98:                              #
-        movq      (%rsp), %r15                                  #
-..___tag_value_NucStrstrSearch.99:                              #
-..___tag_value_NucStrstrSearch.100:                             #
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 edx ecx
-..B1.66:                        # Preds ..B1.65
-        movl      4(%rbx), %eax                                 #5247.24
-        cmpl      %eax, %ecx                                    #5247.24
-        jb        ..B1.107      # Prob 28%                      #5247.24
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 eax edx ecx
-..B1.67:                        # Preds ..B1.66
-        testq     %r8, %r8                                      #5248.9
-        je        ..B1.69       # Prob 12%                      #5248.9
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 eax edx ecx
-..B1.68:                        # Preds ..B1.67
-        movl      %eax, (%r8)                                   #5248.18
-                                # LOE rbx rbp rsi r12 r13 r14 r15 edx ecx
-..B1.69:                        # Preds ..B1.67 ..B1.68
-        movq      %rbx, %rdi                                    #5249.20
-        call      eval_2na_128 at PLT                              #5249.20
-                                # LOE rbp r12 r13 r14 r15 eax
-..B1.124:                       # Preds ..B1.69
-        addq      $32, %rsp                                     #5249.20
-..___tag_value_NucStrstrSearch.104:                             #
-        popq      %rbx                                          #5249.20
-..___tag_value_NucStrstrSearch.106:                             #
-        ret                                                     #5249.20
-..___tag_value_NucStrstrSearch.107:                             #
-                                # LOE
-..1.30_0.TAG.04.0.1:
-..B1.71:                        # Preds ..B1.8
-        movq      %r12, %rsi                                    #
-        movq      24(%rsp), %r12                                #
-..___tag_value_NucStrstrSearch.109:                             #
-        movl      %r13d, %edx                                   #
-        movq      16(%rsp), %r13                                #
-..___tag_value_NucStrstrSearch.110:                             #
-        movl      %r14d, %ecx                                   #
-        movq      %r15, %r8                                     #
-        movq      8(%rsp), %r14                                 #
-..___tag_value_NucStrstrSearch.111:                             #
-        movq      (%rsp), %r15                                  #
-..___tag_value_NucStrstrSearch.112:                             #
-..___tag_value_NucStrstrSearch.113:                             #
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 edx ecx
-..B1.72:                        # Preds ..B1.71
-        movl      4(%rbx), %eax                                 #5243.24
-        cmpl      %eax, %ecx                                    #5243.24
-        jb        ..B1.107      # Prob 28%                      #5243.24
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 eax edx ecx
-..B1.73:                        # Preds ..B1.72
-        testq     %r8, %r8                                      #5244.9
-        je        ..B1.75       # Prob 12%                      #5244.9
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 eax edx ecx
-..B1.74:                        # Preds ..B1.73
-        movl      %eax, (%r8)                                   #5244.18
-                                # LOE rbx rbp rsi r12 r13 r14 r15 edx ecx
-..B1.75:                        # Preds ..B1.73 ..B1.74
-        movq      %rbx, %rdi                                    #5245.20
-        call      eval_2na_32 at PLT                               #5245.20
-                                # LOE rbp r12 r13 r14 r15 eax
-..B1.76:                        # Preds ..B1.75
-        addq      $32, %rsp                                     #5245.20
-..___tag_value_NucStrstrSearch.117:                             #
-        popq      %rbx                                          #5245.20
-..___tag_value_NucStrstrSearch.119:                             #
-        ret                                                     #5245.20
-..___tag_value_NucStrstrSearch.120:                             #
-                                # LOE
-..1.30_0.TAG.03.0.1:
-..B1.78:                        # Preds ..B1.8
-        movq      %r12, %rsi                                    #
-        movq      24(%rsp), %r12                                #
-..___tag_value_NucStrstrSearch.122:                             #
-        movl      %r13d, %edx                                   #
-        movq      16(%rsp), %r13                                #
-..___tag_value_NucStrstrSearch.123:                             #
-        movl      %r14d, %ecx                                   #
-        movq      %r15, %r8                                     #
-        movq      8(%rsp), %r14                                 #
-..___tag_value_NucStrstrSearch.124:                             #
-        movq      (%rsp), %r15                                  #
-..___tag_value_NucStrstrSearch.125:                             #
-..___tag_value_NucStrstrSearch.126:                             #
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 edx ecx
-..B1.79:                        # Preds ..B1.78
-        movl      4(%rbx), %eax                                 #5239.24
-        cmpl      %eax, %ecx                                    #5239.24
-        jb        ..B1.107      # Prob 28%                      #5239.24
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 eax edx ecx
-..B1.80:                        # Preds ..B1.79
-        testq     %r8, %r8                                      #5240.9
-        je        ..B1.82       # Prob 12%                      #5240.9
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 eax edx ecx
-..B1.81:                        # Preds ..B1.80
-        movl      %eax, (%r8)                                   #5240.18
-                                # LOE rbx rbp rsi r12 r13 r14 r15 edx ecx
-..B1.82:                        # Preds ..B1.80 ..B1.81
-        movq      %rbx, %rdi                                    #5241.20
-        call      eval_2na_16 at PLT                               #5241.20
-                                # LOE rbp r12 r13 r14 r15 eax
-..B1.83:                        # Preds ..B1.82
-        addq      $32, %rsp                                     #5241.20
-..___tag_value_NucStrstrSearch.130:                             #
-        popq      %rbx                                          #5241.20
-..___tag_value_NucStrstrSearch.132:                             #
-        ret                                                     #5241.20
-..___tag_value_NucStrstrSearch.133:                             #
-                                # LOE
-..1.30_0.TAG.02.0.1:
-..B1.85:                        # Preds ..B1.8
-        movq      %r12, %rsi                                    #
-        movq      24(%rsp), %r12                                #
-..___tag_value_NucStrstrSearch.135:                             #
-        movl      %r13d, %edx                                   #
-        movq      16(%rsp), %r13                                #
-..___tag_value_NucStrstrSearch.136:                             #
-        movl      %r14d, %ecx                                   #
-        movq      %r15, %r8                                     #
-        movq      8(%rsp), %r14                                 #
-..___tag_value_NucStrstrSearch.137:                             #
-        movq      (%rsp), %r15                                  #
-..___tag_value_NucStrstrSearch.138:                             #
-..___tag_value_NucStrstrSearch.139:                             #
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 edx ecx
-..B1.86:                        # Preds ..B1.85
-        movl      4(%rbx), %eax                                 #5235.24
-        cmpl      %eax, %ecx                                    #5235.24
-        jb        ..B1.107      # Prob 28%                      #5235.24
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 eax edx ecx
-..B1.87:                        # Preds ..B1.86
-        testq     %r8, %r8                                      #5236.9
-        je        ..B1.89       # Prob 12%                      #5236.9
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 eax edx ecx
-..B1.88:                        # Preds ..B1.87
-        movl      %eax, (%r8)                                   #5236.18
-                                # LOE rbx rbp rsi r12 r13 r14 r15 edx ecx
-..B1.89:                        # Preds ..B1.87 ..B1.88
-        movq      %rbx, %rdi                                    #5237.20
-        call      eval_2na_8 at PLT                                #5237.20
-                                # LOE rbp r12 r13 r14 r15 eax
-..B1.90:                        # Preds ..B1.89
-        addq      $32, %rsp                                     #5237.20
-..___tag_value_NucStrstrSearch.143:                             #
-        popq      %rbx                                          #5237.20
-..___tag_value_NucStrstrSearch.145:                             #
-        ret                                                     #5237.20
-..___tag_value_NucStrstrSearch.146:                             #
-                                # LOE
-..1.30_0.TAG.01.0.1:
-..B1.92:                        # Preds ..B1.8
-        movq      %r12, %rsi                                    #
-        movq      24(%rsp), %r12                                #
-..___tag_value_NucStrstrSearch.148:                             #
-        movl      %r13d, %edx                                   #
-        movq      16(%rsp), %r13                                #
-..___tag_value_NucStrstrSearch.149:                             #
-        movl      %r14d, %ecx                                   #
-        movq      %r15, %r8                                     #
-        movq      8(%rsp), %r14                                 #
-..___tag_value_NucStrstrSearch.150:                             #
-        movq      (%rsp), %r15                                  #
-..___tag_value_NucStrstrSearch.151:                             #
-..___tag_value_NucStrstrSearch.152:                             #
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 edx ecx
-..B1.93:                        # Preds ..B1.92
-        movl      4(%rbx), %eax                                 #5230.24
-        cmpl      %eax, %ecx                                    #5230.24
-        jb        ..B1.107      # Prob 28%                      #5230.24
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 eax edx ecx
-..B1.94:                        # Preds ..B1.93
-        testq     %r8, %r8                                      #5231.9
-        je        ..B1.96       # Prob 12%                      #5231.9
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 eax edx ecx
-..B1.95:                        # Preds ..B1.94
-        movl      %eax, (%r8)                                   #5231.18
-                                # LOE rbx rbp rsi r12 r13 r14 r15 edx ecx
-..B1.96:                        # Preds ..B1.94 ..B1.95
-        movq      %rbx, %rdi                                    #5232.20
-        call      eval_4na_64 at PLT                               #5232.20
-                                # LOE rbp r12 r13 r14 r15 eax
-..B1.97:                        # Preds ..B1.96
-        addq      $32, %rsp                                     #5232.20
-..___tag_value_NucStrstrSearch.156:                             #
-        popq      %rbx                                          #5232.20
-..___tag_value_NucStrstrSearch.158:                             #
-        ret                                                     #5232.20
-..___tag_value_NucStrstrSearch.159:                             #
-                                # LOE
-..1.30_0.TAG.00.0.1:
-..B1.99:                        # Preds ..B1.8
-        movq      %r12, %rsi                                    #
-        movq      24(%rsp), %r12                                #
-..___tag_value_NucStrstrSearch.161:                             #
-        movl      %r13d, %edx                                   #
-        movq      16(%rsp), %r13                                #
-..___tag_value_NucStrstrSearch.162:                             #
-        movl      %r14d, %ecx                                   #
-        movq      %r15, %r8                                     #
-        movq      8(%rsp), %r14                                 #
-..___tag_value_NucStrstrSearch.163:                             #
-        movq      (%rsp), %r15                                  #
-..___tag_value_NucStrstrSearch.164:                             #
-..___tag_value_NucStrstrSearch.165:                             #
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 edx ecx
-..B1.100:                       # Preds ..B1.99
-        movl      4(%rbx), %eax                                 #5226.24
-        cmpl      %eax, %ecx                                    #5226.24
-        jb        ..B1.107      # Prob 28%                      #5226.24
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 eax edx ecx
-..B1.101:                       # Preds ..B1.100
-        testq     %r8, %r8                                      #5227.9
-        je        ..B1.103      # Prob 12%                      #5227.9
-                                # LOE rbx rbp rsi r8 r12 r13 r14 r15 eax edx ecx
-..B1.102:                       # Preds ..B1.101
-        movl      %eax, (%r8)                                   #5227.18
-                                # LOE rbx rbp rsi r12 r13 r14 r15 edx ecx
-..B1.103:                       # Preds ..B1.101 ..B1.102
-        movq      %rbx, %rdi                                    #5228.20
-        call      eval_2na_64 at PLT                               #5228.20
-                                # LOE rbp r12 r13 r14 r15 eax
-..B1.104:                       # Preds ..B1.103
-        addq      $32, %rsp                                     #5228.20
-..___tag_value_NucStrstrSearch.169:                             #
-        popq      %rbx                                          #5228.20
-..___tag_value_NucStrstrSearch.171:                             #
-        ret                                                     #5228.20
-..___tag_value_NucStrstrSearch.172:                             #
-                                # LOE
-..B1.107:                       # Preds ..B1.13 ..B1.16 ..B1.17 ..B1.14 ..B1.15
-                                #       ..B1.4 ..B1.100 ..B1.93 ..B1.86 ..B1.79
-                                #       ..B1.72 ..B1.66 ..B1.59 ..B1.52 ..B1.46
-                                #       ..B1.40 ..B1.34 ..B1.32 ..B1.22 ..B1.2
-                                #       ..B1.1
-        xorl      %eax, %eax                                    #5311.12
-        addq      $32, %rsp                                     #5311.12
-..___tag_value_NucStrstrSearch.178:                             #
-        popq      %rbx                                          #5311.12
-..___tag_value_NucStrstrSearch.180:                             #
-        ret                                                     #5311.12
-..___tag_value_NucStrstrSearch.181:                             #
-                                # LOE
-..B1.111:                       # Preds ..B1.28 ..B1.30         # Infreq
-        movq      24(%rsp), %r12                                #
-..___tag_value_NucStrstrSearch.187:                             #
-        movq      16(%rsp), %r13                                #
-..___tag_value_NucStrstrSearch.188:                             #
-        movq      8(%rsp), %r14                                 #
-..___tag_value_NucStrstrSearch.189:                             #
-        movq      (%rsp), %r15                                  #
-..___tag_value_NucStrstrSearch.190:                             #
-        addq      $32, %rsp                                     #5281.28
-..___tag_value_NucStrstrSearch.191:                             #
-        popq      %rbx                                          #5281.28
-..___tag_value_NucStrstrSearch.193:                             #
-        ret                                                     #5281.28
-        .align    16,0x90
-..___tag_value_NucStrstrSearch.194:                             #
-                                # LOE
-# mark_end;
-	.type	NucStrstrSearch, at function
-	.size	NucStrstrSearch,.-NucStrstrSearch
-	.section .data1, "wa"
-	.align 32
-	.align 32
-..1..TPKT.30_0.0.1:
-	.quad	..1.30_0.TAG.00.0.1
-	.quad	..1.30_0.TAG.01.0.1
-	.quad	..1.30_0.TAG.02.0.1
-	.quad	..1.30_0.TAG.03.0.1
-	.quad	..1.30_0.TAG.04.0.1
-	.quad	..1.30_0.TAG.05.0.1
-	.quad	..1.30_0.TAG.06.0.1
-	.quad	..1.30_0.TAG.07.0.1
-	.quad	..1.30_0.TAG.08.0.1
-	.quad	..1.30_0.TAG.09.0.1
-	.quad	..1.30_0.TAG.0a.0.1
-	.quad	..1.30_0.TAG.0b.0.1
-	.quad	..1.30_0.TAG.0c.0.1
-	.data
-# -- End  NucStrstrSearch
-	.text
-# -- Begin  eval_4na_pos
-# mark_begin;
-       .align    16,0x90
-eval_4na_pos:
-# parameter 1: %rdi
-# parameter 2: %rsi
-# parameter 3: %edx
-# parameter 4: %ecx
-..B2.1:                         # Preds ..B2.0
-..___tag_value_eval_4na_pos.195:                                #4946.1
-        pushq     %r12                                          #4946.1
-..___tag_value_eval_4na_pos.197:                                #
-        pushq     %rbp                                          #4946.1
-..___tag_value_eval_4na_pos.199:                                #
-        pushq     %rbx                                          #4946.1
-..___tag_value_eval_4na_pos.201:                                #
-        movdqa    16(%rdi), %xmm8                               #5009.5
-        movdqa    32(%rdi), %xmm7                               #5009.5
-        movdqa    48(%rdi), %xmm6                               #5009.5
-        movdqa    64(%rdi), %xmm5                               #5009.5
-        movdqa    80(%rdi), %xmm4                               #5009.5
-        movdqa    96(%rdi), %xmm3                               #5009.5
-        movdqa    112(%rdi), %xmm2                              #5009.5
-        movdqa    128(%rdi), %xmm1                              #5009.5
-        lea       (%rdx,%rcx), %ebx                             #4985.5
-        subl      4(%rdi), %ebx                                 #4996.12
-        movl      %edx, %r9d                                    #4946.1
-        movl      %edx, %ebp                                    #4993.49
-        shrl      $2, %ebp                                      #4993.49
-        movzbl    (%rbp,%rsi), %r10d                            #5002.14
-        lea       3(%rdx,%rcx), %r8d                            #4999.50
-        shrl      $2, %r8d                                      #4999.57
-        addq      %rsi, %r8                                     #4999.30
-        lea       expand_2na.0(%rip), %rcx                      #5002.14
-        movzwl    (%rcx,%r10,2), %r11d                          #5002.14
-        movzbl    1(%rbp,%rsi), %r10d                           #5002.14
-        movzwl    (%rcx,%r10,2), %r10d                          #5002.14
-        movw      %r11w, -16(%rsp)                              #5002.14
-        movl      %ebx, %edi                                    #5014.20
-        xorl      %r11d, %r11d                                  #5012.15
-        movw      %r10w, -14(%rsp)                              #5002.14
-        movzbl    2(%rbp,%rsi), %r10d                           #5002.14
-        movzwl    (%rcx,%r10,2), %r10d                          #5002.14
-        xorl      %eax, %eax                                    #5012.10
-        subl      %edx, %edi                                    #5014.20
-        movw      %r10w, -12(%rsp)                              #5002.14
-        movzbl    3(%rbp,%rsi), %r10d                           #5002.14
-        movzwl    (%rcx,%r10,2), %r10d                          #5002.14
-        movw      %r10w, -10(%rsp)                              #5002.14
-        movzbl    4(%rbp,%rsi), %r10d                           #5002.14
-        movzwl    (%rcx,%r10,2), %r10d                          #5002.14
-        movw      %r10w, -8(%rsp)                               #5002.14
-        movzbl    5(%rbp,%rsi), %r10d                           #5002.14
-        movzwl    (%rcx,%r10,2), %r10d                          #5002.14
-        addl      $7, %edi                                      #5014.33
-        shrl      $2, %edi                                      #5014.40
-        movw      %r10w, -6(%rsp)                               #5002.14
-        movzbl    6(%rbp,%rsi), %r10d                           #5002.14
-        movzwl    (%rcx,%r10,2), %r10d                          #5002.14
-        movw      %r10w, -4(%rsp)                               #5002.14
-        movzbl    7(%rbp,%rsi), %r10d                           #5002.14
-        movzwl    (%rcx,%r10,2), %ecx                           #5002.14
-        movw      %cx, -2(%rsp)                                 #5002.14
-        movdqu    -16(%rsp), %xmm0                              #5002.14
-        lea       8(%rsi,%rbp), %rbp                            #5003.5
-        movq      %rbp, %rcx                                    #5003.5
-        xorl      %r10d, %r10d                                  #5012.5
-        movl      %edx, %esi                                    #5023.20
-        andl      $3, %esi                                      #5023.20
-        je        ..B2.20       # Prob 20%                      #5023.20
-                                # LOE rcx rbp r8 r12 r13 r14 r15 eax edx ebx esi edi r9d r10d r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.2:                         # Preds ..B2.1
-        cmpl      $1, %esi                                      #5023.20
-        je        ..B2.9        # Prob 25%                      #5023.20
-                                # LOE rcx rbp r8 r12 r13 r14 r15 eax edx ebx esi edi r9d r10d r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.3:                         # Preds ..B2.2
-        cmpl      $2, %esi                                      #5023.20
-        je        ..B2.10       # Prob 33%                      #5023.20
-                                # LOE rcx rbp r8 r12 r13 r14 r15 eax edx ebx esi edi r9d r10d r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.4:                         # Preds ..B2.3
-        cmpl      $3, %esi                                      #5023.20
-        je        ..B2.11       # Prob 50%                      #5023.20
-        jmp       ..B2.16       # Prob 100%                     #5023.20
-                                # LOE rcx rbp r8 r12 r13 r14 r15 eax edx ebx edi r9d r10d r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.9:                         # Preds ..B2.2 ..B2.20
-        movdqa    %xmm0, %xmm10                                 #5047.22
-        movdqa    %xmm0, %xmm9                                  #5048.22
-        pand      %xmm6, %xmm10                                 #5047.22
-        pand      %xmm5, %xmm9                                  #5048.22
-        pcmpeqd   %xmm9, %xmm10                                 #5049.22
-        pmovmskb  %xmm10, %eax                                  #5050.22
-        incl      %eax                                          #5051.17
-        shrl      $16, %eax                                     #5051.17
-        negl      %eax                                          #5051.17
-                                # LOE rcx rbp r8 r13 r14 r15 eax edx ebx edi r9d r10d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.10:                        # Preds ..B2.3 ..B2.9
-        movdqa    %xmm0, %xmm10                                 #5054.22
-        movdqa    %xmm0, %xmm9                                  #5055.22
-        pand      %xmm4, %xmm10                                 #5054.22
-        pand      %xmm3, %xmm9                                  #5055.22
-        pcmpeqd   %xmm9, %xmm10                                 #5056.22
-        pmovmskb  %xmm10, %r11d                                 #5057.22
-        incl      %r11d                                         #5058.17
-        shrl      $16, %r11d                                    #5058.17
-        negl      %r11d                                         #5058.17
-                                # LOE rcx rbp r8 r13 r14 r15 eax edx ebx edi r9d r10d r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.11:                        # Preds ..B2.4 ..B2.10
-        movdqa    %xmm0, %xmm10                                 #5061.22
-        movdqa    %xmm0, %xmm9                                  #5062.22
-        andl      $-4, %edx                                     #5069.17
-        pand      %xmm2, %xmm10                                 #5061.22
-        pand      %xmm1, %xmm9                                  #5062.22
-        pcmpeqd   %xmm9, %xmm10                                 #5063.22
-        pmovmskb  %xmm10, %esi                                  #5064.22
-        movl      %r10d, %r12d                                  #5072.29
-        orl       %eax, %r12d                                   #5072.29
-        incl      %esi                                          #5065.17
-        shrl      $16, %esi                                     #5065.17
-        negl      %esi                                          #5065.17
-        orl       %r11d, %r12d                                  #5072.34
-        orl       %esi, %r12d                                   #5072.39
-        jne       ..B2.21       # Prob 20%                      #5072.47
-                                # LOE rcx rbp r8 r13 r14 r15 eax edx ebx esi edi r9d r10d r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.12:                        # Preds ..B2.11
-        addl      $4, %edx                                      #5135.17
-        cmpl      %ebx, %edx                                    #5138.28
-        ja        ..B2.44       # Prob 20%                      #5138.28
-                                # LOE rcx rbp r8 r13 r14 r15 edx ebx edi r9d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.13:                        # Preds ..B2.12
-        decl      %edi                                          #5142.25
-        jne       ..B2.17       # Prob 50%                      #5142.39
-                                # LOE rcx rbp r8 r13 r14 r15 edx ebx edi r9d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.14:                        # Preds ..B2.13
-        cmpq      %r8, %rbp                                     #5159.25
-        jae       ..B2.44       # Prob 4%                       #5159.25
-                                # LOE rbp r8 r13 r14 r15 edx ebx r9d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.15:                        # Preds ..B2.14
-        movzbl    (%rbp), %esi                                  #5169.22
-        movzbl    1(%rbp), %r10d                                #5169.22
-        movzbl    2(%rbp), %r12d                                #5169.22
-        lea       expand_2na.0(%rip), %rcx                      #5169.22
-        movzwl    (%rcx,%rsi,2), %edi                           #5169.22
-        movzwl    (%rcx,%r10,2), %r11d                          #5169.22
-        movzwl    (%rcx,%r12,2), %esi                           #5169.22
-        movw      %di, -16(%rsp)                                #5169.22
-        movw      %r11w, -14(%rsp)                              #5169.22
-        movw      %si, -12(%rsp)                                #5169.22
-        movzbl    3(%rbp), %esi                                 #5169.22
-        movzwl    (%rcx,%rsi,2), %esi                           #5169.22
-        movw      %si, -10(%rsp)                                #5169.22
-        movzbl    4(%rbp), %esi                                 #5169.22
-        movzwl    (%rcx,%rsi,2), %esi                           #5169.22
-        movw      %si, -8(%rsp)                                 #5169.22
-        movzbl    5(%rbp), %esi                                 #5169.22
-        movzwl    (%rcx,%rsi,2), %esi                           #5169.22
-        movw      %si, -6(%rsp)                                 #5169.22
-        movzbl    6(%rbp), %esi                                 #5169.22
-        movzwl    (%rcx,%rsi,2), %esi                           #5169.22
-        movw      %si, -4(%rsp)                                 #5169.22
-        movzbl    7(%rbp), %esi                                 #5169.22
-        movzwl    (%rcx,%rsi,2), %ecx                           #5169.22
-        addq      $8, %rbp                                      #5184.13
-        movw      %cx, -2(%rsp)                                 #5169.22
-        movdqu    -16(%rsp), %xmm0                              #5169.22
-        movq      %rbp, %rcx                                    #5184.13
-                                # LOE rcx rbp r8 r13 r14 r15 edx ebx r9d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.16:                        # Preds ..B2.4 ..B2.15
-        movl      $8, %edi                                      #5030.13
-        jmp       ..B2.20       # Prob 100%                     #5030.13
-                                # LOE rcx rbp r8 r13 r14 r15 edx ebx edi r9d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.17:                        # Preds ..B2.13
-        psrldq    $2, %xmm0                                     #5147.26
-        cmpq      %r8, %rcx                                     #5150.26
-        jae       ..B2.19       # Prob 19%                      #5150.26
-                                # LOE rcx rbp r8 r13 r14 r15 edx ebx edi r9d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.18:                        # Preds ..B2.17
-        movzbl    (%rcx), %r10d                                 #5151.72
-        lea       expand_2na.0(%rip), %rsi                      #5151.57
-        movzwl    (%rsi,%r10,2), %r11d                          #5151.57
-        pinsrw    $7, %r11d, %xmm0                              #5151.30
-                                # LOE rcx rbp r8 r13 r14 r15 edx ebx edi r9d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.19:                        # Preds ..B2.18 ..B2.17
-        incq      %rcx                                          #5154.20
-                                # LOE rcx rbp r8 r13 r14 r15 edx ebx edi r9d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.20:                        # Preds ..B2.1 ..B2.16 ..B2.19
-        movdqa    %xmm0, %xmm10                                 #5040.22
-        movdqa    %xmm0, %xmm9                                  #5041.22
-        pand      %xmm8, %xmm10                                 #5040.22
-        pand      %xmm7, %xmm9                                  #5041.22
-        pcmpeqd   %xmm9, %xmm10                                 #5042.22
-        pmovmskb  %xmm10, %r10d                                 #5043.22
-        incl      %r10d                                         #5044.17
-        shrl      $16, %r10d                                    #5044.17
-        negl      %r10d                                         #5044.17
-        jmp       ..B2.9        # Prob 100%                     #5044.17
-                                # LOE rcx rbp r8 r13 r14 r15 edx ebx edi r9d r10d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B2.21:                        # Preds ..B2.11                 # Infreq
-        subl      %edx, %ebx                                    #5075.30
-        je        ..B2.42       # Prob 25%                      #5075.37
-                                # LOE r12 r13 r14 r15 eax edx ebx esi r9d r10d r11d
-..B2.22:                        # Preds ..B2.21                 # Infreq
-        cmpl      $1, %ebx                                      #5075.37
-        jne       ..B2.27       # Prob 67%                      #5075.37
-                                # LOE r12 r13 r14 r15 eax edx ebx esi r9d r10d r11d
-..B2.23:                        # Preds ..B2.22                 # Infreq
-        testl     %r10d, %r10d                                  #5081.36
-        jne       ..B2.43       # Prob 28%                      #5081.36
-                                # LOE r12 r13 r14 r15 eax edx r9d
-..B2.24:                        # Preds ..B2.23                 # Infreq
-        testl     %eax, %eax                                    #5082.36
-        je        ..B2.44       # Prob 50%                      #5082.36
-                                # LOE r12 r13 r14 r15 edx r9d
-..B2.25:                        # Preds ..B2.35 ..B2.29 ..B2.24 # Infreq
-        subl      %r9d, %edx                                    #5082.47
-        addl      $2, %edx                                      #5082.61
-        movl      %edx, %eax                                    #5082.61
-..___tag_value_eval_4na_pos.204:                                #5082.61
-        popq      %rbx                                          #5082.61
-..___tag_value_eval_4na_pos.206:                                #
-        popq      %rbp                                          #5082.61
-..___tag_value_eval_4na_pos.208:                                #
-        popq      %r12                                          #5082.61
-..___tag_value_eval_4na_pos.210:                                #
-        ret                                                     #5082.61
-..___tag_value_eval_4na_pos.211:                                #
-                                # LOE
-..B2.27:                        # Preds ..B2.22                 # Infreq
-        cmpl      $2, %ebx                                      #5075.37
-        jne       ..B2.34       # Prob 50%                      #5075.37
-                                # LOE r12 r13 r14 r15 eax edx esi r9d r10d r11d
-..B2.28:                        # Preds ..B2.27                 # Infreq
-        testl     %r10d, %r10d                                  #5085.36
-        jne       ..B2.43       # Prob 28%                      #5085.36
-                                # LOE r12 r13 r14 r15 eax edx r9d r11d
-..B2.29:                        # Preds ..B2.28                 # Infreq
-        testl     %eax, %eax                                    #5086.36
-        jne       ..B2.25       # Prob 28%                      #5086.36
-                                # LOE r12 r13 r14 r15 edx r9d r11d
-..B2.30:                        # Preds ..B2.29                 # Infreq
-        testl     %r11d, %r11d                                  #5087.36
-        je        ..B2.44       # Prob 50%                      #5087.36
-                                # LOE r12 r13 r14 r15 edx r9d
-..B2.31:                        # Preds ..B2.36 ..B2.30         # Infreq
-        subl      %r9d, %edx                                    #5087.47
-        addl      $3, %edx                                      #5087.61
-        movl      %edx, %eax                                    #5087.61
-..___tag_value_eval_4na_pos.215:                                #5087.61
-        popq      %rbx                                          #5087.61
-..___tag_value_eval_4na_pos.217:                                #
-        popq      %rbp                                          #5087.61
-..___tag_value_eval_4na_pos.219:                                #
-        popq      %r12                                          #5087.61
-..___tag_value_eval_4na_pos.221:                                #
-        ret                                                     #5087.61
-..___tag_value_eval_4na_pos.222:                                #
-                                # LOE
-..B2.34:                        # Preds ..B2.27                 # Infreq
-        testl     %r10d, %r10d                                  #5090.36
-        jne       ..B2.43       # Prob 28%                      #5090.36
-                                # LOE r12 r13 r14 r15 eax edx esi r9d r11d
-..B2.35:                        # Preds ..B2.34                 # Infreq
-        testl     %eax, %eax                                    #5091.36
-        jne       ..B2.25       # Prob 28%                      #5091.36
-                                # LOE r12 r13 r14 r15 edx esi r9d r11d
-..B2.36:                        # Preds ..B2.35                 # Infreq
-        testl     %r11d, %r11d                                  #5092.36
-        jne       ..B2.31       # Prob 28%                      #5092.36
-                                # LOE r12 r13 r14 r15 edx esi r9d
-..B2.37:                        # Preds ..B2.36                 # Infreq
-        testl     %esi, %esi                                    #5093.36
-        je        ..B2.44       # Prob 50%                      #5093.36
-                                # LOE r12 r13 r14 r15 edx r9d
-..B2.38:                        # Preds ..B2.37                 # Infreq
-        subl      %r9d, %edx                                    #5093.47
-        addl      $4, %edx                                      #5093.61
-        movl      %edx, %eax                                    #5093.61
-..___tag_value_eval_4na_pos.226:                                #5093.61
-        popq      %rbx                                          #5093.61
-..___tag_value_eval_4na_pos.228:                                #
-        popq      %rbp                                          #5093.61
-..___tag_value_eval_4na_pos.230:                                #
-        popq      %r12                                          #5093.61
-..___tag_value_eval_4na_pos.232:                                #
-        ret                                                     #5093.61
-..___tag_value_eval_4na_pos.233:                                #
-                                # LOE
-..B2.42:                        # Preds ..B2.21                 # Infreq
-        testl     %r10d, %r10d                                  #5078.36
-        je        ..B2.44       # Prob 50%                      #5078.36
-                                # LOE r12 r13 r14 r15 edx r9d
-..B2.43:                        # Preds ..B2.34 ..B2.28 ..B2.23 ..B2.42 # Infreq
-        subl      %r9d, %edx                                    #5078.47
-        incl      %edx                                          #5078.61
-        movl      %edx, %eax                                    #5078.61
-..___tag_value_eval_4na_pos.237:                                #5078.61
-        popq      %rbx                                          #5078.61
-..___tag_value_eval_4na_pos.239:                                #
-        popq      %rbp                                          #5078.61
-..___tag_value_eval_4na_pos.241:                                #
-        popq      %r12                                          #5078.61
-..___tag_value_eval_4na_pos.243:                                #
-        ret                                                     #5078.61
-..___tag_value_eval_4na_pos.244:                                #
-                                # LOE
-..B2.44:                        # Preds ..B2.14 ..B2.12 ..B2.37 ..B2.30 ..B2.24
-                                #       ..B2.42                 # Infreq
-        xorl      %eax, %eax                                    #5095.28
-..___tag_value_eval_4na_pos.248:                                #5095.28
-        popq      %rbx                                          #5095.28
-..___tag_value_eval_4na_pos.250:                                #
-        popq      %rbp                                          #5095.28
-..___tag_value_eval_4na_pos.252:                                #
-        popq      %r12                                          #5095.28
-..___tag_value_eval_4na_pos.254:                                #
-        ret                                                     #5095.28
-        .align    16,0x90
-..___tag_value_eval_4na_pos.255:                                #
-                                # LOE
-# mark_end;
-	.type	eval_4na_pos, at function
-	.size	eval_4na_pos,.-eval_4na_pos
-	.data
-# -- End  eval_4na_pos
-	.text
-# -- Begin  eval_2na_pos
-# mark_begin;
-       .align    16,0x90
-eval_2na_pos:
-# parameter 1: %rdi
-# parameter 2: %rsi
-# parameter 3: %edx
-# parameter 4: %ecx
-..B3.1:                         # Preds ..B3.0
-..___tag_value_eval_2na_pos.256:                                #3662.1
-        pushq     %r15                                          #3662.1
-..___tag_value_eval_2na_pos.258:                                #
-        pushq     %r12                                          #3662.1
-..___tag_value_eval_2na_pos.260:                                #
-        pushq     %rbp                                          #3662.1
-..___tag_value_eval_2na_pos.262:                                #
-        pushq     %rbx                                          #3662.1
-..___tag_value_eval_2na_pos.264:                                #
-        lea       (%rdx,%rcx), %ebx                             #3705.5
-        subl      4(%rdi), %ebx                                 #3716.12
-        movl      %edx, %r9d                                    #3662.1
-        movl      %edx, %r10d                                   #3713.49
-        shrl      $2, %r10d                                     #3713.49
-        lea       (%rsi,%r10), %rbp                             #3713.30
-        lea       3(%rdx,%rcx), %r8d                            #3719.50
-        shrl      $2, %r8d                                      #3719.57
-        addq      %rsi, %r8                                     #3719.30
-        testq     $15, %rbp                                     #3722.14
-        jne       ..B3.3        # Prob 50%                      #3722.14
-                                # LOE rbp rsi rdi r8 r10 r12 r13 r14 edx ebx r9d
-..B3.2:                         # Preds ..B3.1
-        movdqa    (%rbp), %xmm0                                 #3722.14
-        jmp       ..B3.4        # Prob 100%                     #3722.14
-                                # LOE rsi rdi r8 r10 r12 r13 r14 edx ebx r9d xmm0
-..B3.3:                         # Preds ..B3.1
-        movdqu    (%rbp), %xmm0                                 #3722.14
-                                # LOE rsi rdi r8 r10 r12 r13 r14 edx ebx r9d xmm0
-..B3.4:                         # Preds ..B3.2 ..B3.3
-        lea       16(%rsi,%r10), %rsi                           #3723.5
-        movq      %rsi, %rbp                                    #3723.5
-        cmpq      %r8, %rsi                                     #3728.16
-        jae       ..B3.6        # Prob 12%                      #3728.16
-                                # LOE rbp rsi rdi r8 r12 r13 r14 edx ecx ebx r9d xmm0
-..B3.5:                         # Preds ..B3.4
-        movzbl    -1(%rsi), %ecx                                #3729.24
-        shll      $8, %ecx                                      #3729.38
-                                # LOE rbp rsi rdi r8 r12 r13 r14 edx ecx ebx r9d xmm0
-..B3.6:                         # Preds ..B3.5 ..B3.4
-        movdqa    16(%rdi), %xmm8                               #3733.5
-        movdqa    32(%rdi), %xmm7                               #3733.5
-        movdqa    48(%rdi), %xmm6                               #3733.5
-        movdqa    64(%rdi), %xmm5                               #3733.5
-        movdqa    80(%rdi), %xmm4                               #3733.5
-        movdqa    96(%rdi), %xmm3                               #3733.5
-        movdqa    112(%rdi), %xmm2                              #3733.5
-        movdqa    128(%rdi), %xmm1                              #3733.5
-        xorl      %r15d, %r15d                                  #3736.15
-        xorl      %eax, %eax                                    #3736.10
-        xorl      %r11d, %r11d                                  #3736.5
-        movl      %ebx, %r10d                                   #3738.20
-        subl      %edx, %r10d                                   #3738.20
-        addl      $7, %r10d                                     #3738.33
-        shrl      $2, %r10d                                     #3738.40
-        movl      %edx, %edi                                    #3745.20
-        andl      $3, %edi                                      #3745.20
-        je        ..B3.29       # Prob 20%                      #3745.20
-                                # LOE rbp rsi r8 r12 r13 r14 eax edx ecx ebx edi r9d r10d r11d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B3.7:                         # Preds ..B3.6
-        cmpl      $1, %edi                                      #3745.20
-        je        ..B3.14       # Prob 25%                      #3745.20
-                                # LOE rbp rsi r8 r12 r13 r14 eax edx ecx ebx edi r9d r10d r11d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B3.8:                         # Preds ..B3.7
-        cmpl      $2, %edi                                      #3745.20
-        je        ..B3.15       # Prob 33%                      #3745.20
-                                # LOE rbp rsi r8 r12 r13 r14 eax edx ecx ebx edi r9d r10d r11d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B3.9:                         # Preds ..B3.8
-        cmpl      $3, %edi                                      #3745.20
-        je        ..B3.16       # Prob 50%                      #3745.20
-        jmp       ..B3.25       # Prob 100%                     #3745.20
-                                # LOE rbp rsi r8 r12 r13 r14 eax edx ecx ebx r9d r10d r11d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B3.14:                        # Preds ..B3.7 ..B3.29
-        movdqa    %xmm0, %xmm9                                  #3768.22
-        pand      %xmm5, %xmm9                                  #3768.22
-        pcmpeqd   %xmm6, %xmm9                                  #3769.22
-        pmovmskb  %xmm9, %eax                                   #3770.22
-        incl      %eax                                          #3771.17
-        shrl      $16, %eax                                     #3771.17
-        negl      %eax                                          #3771.17
-                                # LOE rbp rsi r8 r13 r14 eax edx ecx ebx r9d r10d r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B3.15:                        # Preds ..B3.8 ..B3.14
-        movdqa    %xmm0, %xmm9                                  #3774.22
-        pand      %xmm3, %xmm9                                  #3774.22
-        pcmpeqd   %xmm4, %xmm9                                  #3775.22
-        pmovmskb  %xmm9, %r15d                                  #3776.22
-        incl      %r15d                                         #3777.17
-        shrl      $16, %r15d                                    #3777.17
-        negl      %r15d                                         #3777.17
-                                # LOE rbp rsi r8 r13 r14 eax edx ecx ebx r9d r10d r11d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B3.16:                        # Preds ..B3.9 ..B3.15
-        movdqa    %xmm0, %xmm9                                  #3780.22
-        andl      $-4, %edx                                     #3787.17
-        movl      %r11d, %r12d                                  #3790.29
-        pand      %xmm1, %xmm9                                  #3780.22
-        pcmpeqd   %xmm2, %xmm9                                  #3781.22
-        pmovmskb  %xmm9, %edi                                   #3782.22
-        orl       %eax, %r12d                                   #3790.29
-        orl       %r15d, %r12d                                  #3790.34
-        incl      %edi                                          #3783.17
-        shrl      $16, %edi                                     #3783.17
-        negl      %edi                                          #3783.17
-        orl       %edi, %r12d                                   #3790.39
-        jne       ..B3.30       # Prob 20%                      #3790.47
-                                # LOE rbp rsi r8 r13 r14 eax edx ecx ebx edi r9d r10d r11d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B3.17:                        # Preds ..B3.16
-        addl      $4, %edx                                      #3853.17
-        cmpl      %ebx, %edx                                    #3856.28
-        ja        ..B3.53       # Prob 20%                      #3856.28
-                                # LOE rbp rsi r8 r13 r14 edx ecx ebx r9d r10d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B3.18:                        # Preds ..B3.17
-        decl      %r10d                                         #3860.25
-        jne       ..B3.26       # Prob 50%                      #3860.39
-                                # LOE rbp rsi r8 r13 r14 edx ecx ebx r9d r10d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B3.19:                        # Preds ..B3.18
-        cmpq      %r8, %rsi                                     #3881.25
-        jae       ..B3.53       # Prob 4%                       #3881.25
-                                # LOE rsi r8 r13 r14 edx ecx ebx r9d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B3.20:                        # Preds ..B3.19
-        testq     $15, %rsi                                     #3891.22
-        jne       ..B3.22       # Prob 50%                      #3891.22
-                                # LOE rsi r8 r13 r14 edx ecx ebx r9d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B3.21:                        # Preds ..B3.20
-        movdqa    (%rsi), %xmm0                                 #3891.22
-        jmp       ..B3.23       # Prob 100%                     #3891.22
-                                # LOE rsi r8 r13 r14 edx ecx ebx r9d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B3.22:                        # Preds ..B3.20
-        movdqu    (%rsi), %xmm0                                 #3891.22
-                                # LOE rsi r8 r13 r14 edx ecx ebx r9d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B3.23:                        # Preds ..B3.21 ..B3.22
-        addq      $16, %rsi                                     #3969.13
-        movq      %rsi, %rbp                                    #3969.13
-        cmpq      %r8, %rsi                                     #3972.24
-        jae       ..B3.25       # Prob 12%                      #3972.24
-                                # LOE rbp rsi r8 r13 r14 edx ecx ebx r9d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B3.24:                        # Preds ..B3.23
-        movzbl    -1(%rsi), %ecx                                #3973.32
-        shll      $8, %ecx                                      #3973.46
-                                # LOE rbp rsi r8 r13 r14 edx ecx ebx r9d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B3.25:                        # Preds ..B3.9 ..B3.23 ..B3.24
-        movl      $16, %r10d                                    #3752.13
-        jmp       ..B3.29       # Prob 100%                     #3752.13
-                                # LOE rbp rsi r8 r13 r14 edx ecx ebx r9d r10d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B3.26:                        # Preds ..B3.18
-        psrldq    $1, %xmm0                                     #3865.26
-        cmpq      %r8, %rbp                                     #3868.26
-        jae       ..B3.28       # Prob 19%                      #3868.26
-                                # LOE rbp rsi r8 r13 r14 edx ecx ebx r9d r10d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B3.27:                        # Preds ..B3.26
-        movzbl    (%rbp), %edi                                  #3871.37
-        sarl      $8, %ecx                                      #3870.21
-        shll      $8, %edi                                      #3871.48
-        orl       %edi, %ecx                                    #3871.21
-        pinsrw    $7, %ecx, %xmm0                               #3872.30
-                                # LOE rbp rsi r8 r13 r14 edx ecx ebx r9d r10d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B3.28:                        # Preds ..B3.27 ..B3.26
-        incq      %rbp                                          #3876.20
-                                # LOE rbp rsi r8 r13 r14 edx ecx ebx r9d r10d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B3.29:                        # Preds ..B3.6 ..B3.25 ..B3.28
-        movdqa    %xmm0, %xmm9                                  #3762.22
-        pand      %xmm7, %xmm9                                  #3762.22
-        pcmpeqd   %xmm8, %xmm9                                  #3763.22
-        pmovmskb  %xmm9, %r11d                                  #3764.22
-        incl      %r11d                                         #3765.17
-        shrl      $16, %r11d                                    #3765.17
-        negl      %r11d                                         #3765.17
-        jmp       ..B3.14       # Prob 100%                     #3765.17
-                                # LOE rbp rsi r8 r13 r14 edx ecx ebx r9d r10d r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B3.30:                        # Preds ..B3.16                 # Infreq
-        subl      %edx, %ebx                                    #3793.30
-        je        ..B3.51       # Prob 25%                      #3793.37
-                                # LOE r12 r13 r14 eax edx ebx edi r9d r11d r15d
-..B3.31:                        # Preds ..B3.30                 # Infreq
-        cmpl      $1, %ebx                                      #3793.37
-        jne       ..B3.36       # Prob 67%                      #3793.37
-                                # LOE r12 r13 r14 eax edx ebx edi r9d r11d r15d
-..B3.32:                        # Preds ..B3.31                 # Infreq
-        testl     %r11d, %r11d                                  #3799.36
-        jne       ..B3.52       # Prob 28%                      #3799.36
-                                # LOE r12 r13 r14 eax edx r9d
-..B3.33:                        # Preds ..B3.32                 # Infreq
-        testl     %eax, %eax                                    #3800.36
-        je        ..B3.53       # Prob 50%                      #3800.36
-                                # LOE r12 r13 r14 edx r9d
-..B3.34:                        # Preds ..B3.44 ..B3.38 ..B3.33 # Infreq
-        subl      %r9d, %edx                                    #3800.47
-        addl      $2, %edx                                      #3800.61
-        movl      %edx, %eax                                    #3800.61
-..___tag_value_eval_2na_pos.267:                                #3800.61
-        popq      %rbx                                          #3800.61
-..___tag_value_eval_2na_pos.269:                                #
-        popq      %rbp                                          #3800.61
-..___tag_value_eval_2na_pos.271:                                #
-        popq      %r12                                          #3800.61
-..___tag_value_eval_2na_pos.273:                                #
-        popq      %r15                                          #3800.61
-..___tag_value_eval_2na_pos.275:                                #
-        ret                                                     #3800.61
-..___tag_value_eval_2na_pos.276:                                #
-                                # LOE
-..B3.36:                        # Preds ..B3.31                 # Infreq
-        cmpl      $2, %ebx                                      #3793.37
-        jne       ..B3.43       # Prob 50%                      #3793.37
-                                # LOE r12 r13 r14 eax edx edi r9d r11d r15d
-..B3.37:                        # Preds ..B3.36                 # Infreq
-        testl     %r11d, %r11d                                  #3803.36
-        jne       ..B3.52       # Prob 28%                      #3803.36
-                                # LOE r12 r13 r14 eax edx r9d r15d
-..B3.38:                        # Preds ..B3.37                 # Infreq
-        testl     %eax, %eax                                    #3804.36
-        jne       ..B3.34       # Prob 28%                      #3804.36
-                                # LOE r12 r13 r14 edx r9d r15d
-..B3.39:                        # Preds ..B3.38                 # Infreq
-        testl     %r15d, %r15d                                  #3805.36
-        je        ..B3.53       # Prob 50%                      #3805.36
-                                # LOE r12 r13 r14 edx r9d
-..B3.40:                        # Preds ..B3.45 ..B3.39         # Infreq
-        subl      %r9d, %edx                                    #3805.47
-        addl      $3, %edx                                      #3805.61
-        movl      %edx, %eax                                    #3805.61
-..___tag_value_eval_2na_pos.281:                                #3805.61
-        popq      %rbx                                          #3805.61
-..___tag_value_eval_2na_pos.283:                                #
-        popq      %rbp                                          #3805.61
-..___tag_value_eval_2na_pos.285:                                #
-        popq      %r12                                          #3805.61
-..___tag_value_eval_2na_pos.287:                                #
-        popq      %r15                                          #3805.61
-..___tag_value_eval_2na_pos.289:                                #
-        ret                                                     #3805.61
-..___tag_value_eval_2na_pos.290:                                #
-                                # LOE
-..B3.43:                        # Preds ..B3.36                 # Infreq
-        testl     %r11d, %r11d                                  #3808.36
-        jne       ..B3.52       # Prob 28%                      #3808.36
-                                # LOE r12 r13 r14 eax edx edi r9d r15d
-..B3.44:                        # Preds ..B3.43                 # Infreq
-        testl     %eax, %eax                                    #3809.36
-        jne       ..B3.34       # Prob 28%                      #3809.36
-                                # LOE r12 r13 r14 edx edi r9d r15d
-..B3.45:                        # Preds ..B3.44                 # Infreq
-        testl     %r15d, %r15d                                  #3810.36
-        jne       ..B3.40       # Prob 28%                      #3810.36
-                                # LOE r12 r13 r14 edx edi r9d
-..B3.46:                        # Preds ..B3.45                 # Infreq
-        testl     %edi, %edi                                    #3811.36
-        je        ..B3.53       # Prob 50%                      #3811.36
-                                # LOE r12 r13 r14 edx r9d
-..B3.47:                        # Preds ..B3.46                 # Infreq
-        subl      %r9d, %edx                                    #3811.47
-        addl      $4, %edx                                      #3811.61
-        movl      %edx, %eax                                    #3811.61
-..___tag_value_eval_2na_pos.295:                                #3811.61
-        popq      %rbx                                          #3811.61
-..___tag_value_eval_2na_pos.297:                                #
-        popq      %rbp                                          #3811.61
-..___tag_value_eval_2na_pos.299:                                #
-        popq      %r12                                          #3811.61
-..___tag_value_eval_2na_pos.301:                                #
-        popq      %r15                                          #3811.61
-..___tag_value_eval_2na_pos.303:                                #
-        ret                                                     #3811.61
-..___tag_value_eval_2na_pos.304:                                #
-                                # LOE
-..B3.51:                        # Preds ..B3.30                 # Infreq
-        testl     %r11d, %r11d                                  #3796.36
-        je        ..B3.53       # Prob 50%                      #3796.36
-                                # LOE r12 r13 r14 edx r9d
-..B3.52:                        # Preds ..B3.43 ..B3.37 ..B3.32 ..B3.51 # Infreq
-        subl      %r9d, %edx                                    #3796.47
-        incl      %edx                                          #3796.61
-        movl      %edx, %eax                                    #3796.61
-..___tag_value_eval_2na_pos.309:                                #3796.61
-        popq      %rbx                                          #3796.61
-..___tag_value_eval_2na_pos.311:                                #
-        popq      %rbp                                          #3796.61
-..___tag_value_eval_2na_pos.313:                                #
-        popq      %r12                                          #3796.61
-..___tag_value_eval_2na_pos.315:                                #
-        popq      %r15                                          #3796.61
-..___tag_value_eval_2na_pos.317:                                #
-        ret                                                     #3796.61
-..___tag_value_eval_2na_pos.318:                                #
-                                # LOE
-..B3.53:                        # Preds ..B3.17 ..B3.19 ..B3.46 ..B3.39 ..B3.33
-                                #       ..B3.51                 # Infreq
-        xorl      %eax, %eax                                    #3813.28
-..___tag_value_eval_2na_pos.323:                                #3813.28
-        popq      %rbx                                          #3813.28
-..___tag_value_eval_2na_pos.325:                                #
-        popq      %rbp                                          #3813.28
-..___tag_value_eval_2na_pos.327:                                #
-        popq      %r12                                          #3813.28
-..___tag_value_eval_2na_pos.329:                                #
-        popq      %r15                                          #3813.28
-..___tag_value_eval_2na_pos.331:                                #
-        ret                                                     #3813.28
-        .align    16,0x90
-..___tag_value_eval_2na_pos.332:                                #
-                                # LOE
-# mark_end;
-	.type	eval_2na_pos, at function
-	.size	eval_2na_pos,.-eval_2na_pos
-	.data
-# -- End  eval_2na_pos
-	.text
-# -- Begin  eval_4na_128
-# mark_begin;
-       .align    16,0x90
-eval_4na_128:
-# parameter 1: %rdi
-# parameter 2: %rsi
-# parameter 3: %edx
-# parameter 4: %ecx
-..B4.1:                         # Preds ..B4.0
-..___tag_value_eval_4na_128.333:                                #4724.1
-        pushq     %rbp                                          #4724.1
-..___tag_value_eval_4na_128.335:                                #
-        pushq     %rbx                                          #4724.1
-..___tag_value_eval_4na_128.337:                                #
-        movdqa    16(%rdi), %xmm8                               #4776.5
-        movdqa    32(%rdi), %xmm7                               #4776.5
-        movdqa    48(%rdi), %xmm6                               #4776.5
-        movdqa    64(%rdi), %xmm5                               #4776.5
-        movdqa    80(%rdi), %xmm4                               #4776.5
-        movdqa    96(%rdi), %xmm3                               #4776.5
-        movdqa    112(%rdi), %xmm2                              #4776.5
-        movdqa    128(%rdi), %xmm1                              #4776.5
-        lea       (%rdx,%rcx), %ebp                             #4757.5
-        movl      %edx, %r10d                                   #4760.49
-        shrl      $2, %r10d                                     #4760.49
-        subl      4(%rdi), %ebp                                 #4763.12
-        movzbl    (%r10,%rsi), %r8d                             #4769.14
-        movzbl    1(%r10,%rsi), %r11d                           #4769.14
-        lea       3(%rdx,%rcx), %ecx                            #4766.50
-        shrl      $2, %ecx                                      #4766.57
-        addq      %rsi, %rcx                                    #4766.30
-        lea       expand_2na.0(%rip), %rax                      #4769.14
-        movzwl    (%rax,%r8,2), %r9d                            #4769.14
-        movzwl    (%rax,%r11,2), %r8d                           #4769.14
-        movw      %r9w, -24(%rsp)                               #4769.14
-        movzbl    2(%r10,%rsi), %r9d                            #4769.14
-        movzwl    (%rax,%r9,2), %r11d                           #4769.14
-        movw      %r8w, -22(%rsp)                               #4769.14
-        movzbl    3(%r10,%rsi), %r8d                            #4769.14
-        movzwl    (%rax,%r8,2), %r9d                            #4769.14
-        movw      %r11w, -20(%rsp)                              #4769.14
-        movzbl    4(%r10,%rsi), %r11d                           #4769.14
-        movzwl    (%rax,%r11,2), %r8d                           #4769.14
-        movw      %r9w, -18(%rsp)                               #4769.14
-        movzbl    5(%r10,%rsi), %r9d                            #4769.14
-        movzwl    (%rax,%r9,2), %r11d                           #4769.14
-        movw      %r8w, -16(%rsp)                               #4769.14
-        movzbl    6(%r10,%rsi), %r8d                            #4769.14
-        movzwl    (%rax,%r8,2), %r9d                            #4769.14
-        xorl      %r8d, %r8d                                    #4779.15
-        movw      %r11w, -14(%rsp)                              #4769.14
-        movzbl    7(%r10,%rsi), %r11d                           #4769.14
-        movzwl    (%rax,%r11,2), %eax                           #4769.14
-        movw      %r9w, -12(%rsp)                               #4769.14
-        xorl      %r9d, %r9d                                    #4779.10
-        movw      %ax, -10(%rsp)                                #4769.14
-        movdqu    -24(%rsp), %xmm0                              #4769.14
-        lea       8(%rsi,%r10), %rax                            #4770.5
-        movq      %rax, %r10                                    #4770.5
-        xorl      %edi, %edi                                    #4779.5
-        movl      %ebp, %esi                                    #4781.20
-        subl      %edx, %esi                                    #4781.20
-        addl      $7, %esi                                      #4781.33
-        shrl      $2, %esi                                      #4781.40
-        movl      %edx, %r11d                                   #4790.20
-        andl      $3, %r11d                                     #4790.20
-        je        ..B4.20       # Prob 20%                      #4790.20
-                                # LOE rax rcx rbx r10 r12 r13 r14 r15 edx ebp esi edi r8d r9d r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.2:                         # Preds ..B4.1
-        cmpl      $1, %r11d                                     #4790.20
-        je        ..B4.9        # Prob 25%                      #4790.20
-                                # LOE rax rcx rbx r10 r12 r13 r14 r15 edx ebp esi edi r8d r9d r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.3:                         # Preds ..B4.2
-        cmpl      $2, %r11d                                     #4790.20
-        je        ..B4.10       # Prob 33%                      #4790.20
-                                # LOE rax rcx rbx r10 r12 r13 r14 r15 edx ebp esi edi r8d r9d r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.4:                         # Preds ..B4.3
-        cmpl      $3, %r11d                                     #4790.20
-        je        ..B4.11       # Prob 50%                      #4790.20
-        jmp       ..B4.16       # Prob 100%                     #4790.20
-                                # LOE rax rcx rbx r10 r12 r13 r14 r15 edx ebp esi edi r8d r9d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.9:                         # Preds ..B4.2 ..B4.20
-        movdqa    %xmm0, %xmm10                                 #4814.22
-        movdqa    %xmm0, %xmm9                                  #4815.22
-        pand      %xmm6, %xmm10                                 #4814.22
-        pand      %xmm5, %xmm9                                  #4815.22
-        pcmpeqd   %xmm9, %xmm10                                 #4816.22
-        pmovmskb  %xmm10, %r9d                                  #4817.22
-        incl      %r9d                                          #4818.17
-        shrl      $16, %r9d                                     #4818.17
-        negl      %r9d                                          #4818.17
-                                # LOE rax rcx r10 r12 r13 r14 r15 edx ebp esi edi r9d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.10:                        # Preds ..B4.3 ..B4.9
-        movdqa    %xmm0, %xmm10                                 #4821.22
-        movdqa    %xmm0, %xmm9                                  #4822.22
-        pand      %xmm4, %xmm10                                 #4821.22
-        pand      %xmm3, %xmm9                                  #4822.22
-        pcmpeqd   %xmm9, %xmm10                                 #4823.22
-        pmovmskb  %xmm10, %r8d                                  #4824.22
-        incl      %r8d                                          #4825.17
-        shrl      $16, %r8d                                     #4825.17
-        negl      %r8d                                          #4825.17
-                                # LOE rax rcx r10 r12 r13 r14 r15 edx ebp esi edi r8d r9d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.11:                        # Preds ..B4.4 ..B4.10
-        movdqa    %xmm0, %xmm10                                 #4828.22
-        movdqa    %xmm0, %xmm9                                  #4829.22
-        andl      $-4, %edx                                     #4836.17
-        pand      %xmm2, %xmm10                                 #4828.22
-        pand      %xmm1, %xmm9                                  #4829.22
-        pcmpeqd   %xmm9, %xmm10                                 #4830.22
-        pmovmskb  %xmm10, %ebx                                  #4831.22
-        movl      %edi, %r11d                                   #4839.29
-        orl       %r9d, %r11d                                   #4839.29
-        incl      %ebx                                          #4832.17
-        shrl      $16, %ebx                                     #4832.17
-        negl      %ebx                                          #4832.17
-        orl       %r8d, %r11d                                   #4839.34
-        orl       %ebx, %r11d                                   #4839.39
-        jne       ..B4.21       # Prob 20%                      #4839.47
-                                # LOE rax rcx r10 r12 r13 r14 r15 edx ebp esi edi r8d r9d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.12:                        # Preds ..B4.11
-        addl      $4, %edx                                      #4880.17
-        cmpl      %ebp, %edx                                    #4883.28
-        ja        ..B4.29       # Prob 20%                      #4883.28
-                                # LOE rax rcx r10 r12 r13 r14 r15 edx ebp esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.13:                        # Preds ..B4.12
-        decl      %esi                                          #4887.25
-        jne       ..B4.17       # Prob 50%                      #4887.39
-                                # LOE rax rcx r10 r12 r13 r14 r15 edx ebp esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.14:                        # Preds ..B4.13
-        cmpq      %rcx, %rax                                    #4904.25
-        jae       ..B4.29       # Prob 4%                       #4904.25
-                                # LOE rax rcx r12 r13 r14 r15 edx ebp xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.15:                        # Preds ..B4.14
-        movzbl    (%rax), %esi                                  #4914.22
-        movzbl    1(%rax), %r8d                                 #4914.22
-        movzbl    2(%rax), %r10d                                #4914.22
-        lea       expand_2na.0(%rip), %rbx                      #4914.22
-        movzwl    (%rbx,%rsi,2), %edi                           #4914.22
-        movzwl    (%rbx,%r8,2), %r9d                            #4914.22
-        movzwl    (%rbx,%r10,2), %r11d                          #4914.22
-        movzbl    3(%rax), %esi                                 #4914.22
-        movzbl    4(%rax), %r8d                                 #4914.22
-        movzbl    5(%rax), %r10d                                #4914.22
-        movw      %di, -24(%rsp)                                #4914.22
-        movzwl    (%rbx,%rsi,2), %edi                           #4914.22
-        movzbl    6(%rax), %esi                                 #4914.22
-        movw      %r9w, -22(%rsp)                               #4914.22
-        movzwl    (%rbx,%r8,2), %r9d                            #4914.22
-        movzbl    7(%rax), %r8d                                 #4914.22
-        movw      %r11w, -20(%rsp)                              #4914.22
-        movzwl    (%rbx,%r10,2), %r11d                          #4914.22
-        addq      $8, %rax                                      #4929.13
-        movq      %rax, %r10                                    #4929.13
-        movw      %di, -18(%rsp)                                #4914.22
-        movzwl    (%rbx,%rsi,2), %edi                           #4914.22
-        movzwl    (%rbx,%r8,2), %ebx                            #4914.22
-        movw      %r9w, -16(%rsp)                               #4914.22
-        movw      %r11w, -14(%rsp)                              #4914.22
-        movw      %di, -12(%rsp)                                #4914.22
-        movw      %bx, -10(%rsp)                                #4914.22
-        movdqu    -24(%rsp), %xmm0                              #4914.22
-                                # LOE rax rcx r10 r12 r13 r14 r15 edx ebp xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.16:                        # Preds ..B4.4 ..B4.15
-        movl      $8, %esi                                      #4797.13
-        jmp       ..B4.20       # Prob 100%                     #4797.13
-                                # LOE rax rcx r10 r12 r13 r14 r15 edx ebp esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.17:                        # Preds ..B4.13
-        psrldq    $2, %xmm0                                     #4892.26
-        cmpq      %rcx, %r10                                    #4895.26
-        jae       ..B4.19       # Prob 19%                      #4895.26
-                                # LOE rax rcx r10 r12 r13 r14 r15 edx ebp esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.18:                        # Preds ..B4.17
-        movzbl    (%r10), %edi                                  #4896.72
-        lea       expand_2na.0(%rip), %rbx                      #4896.57
-        movzwl    (%rbx,%rdi,2), %r8d                           #4896.57
-        pinsrw    $7, %r8d, %xmm0                               #4896.30
-                                # LOE rax rcx r10 r12 r13 r14 r15 edx ebp esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.19:                        # Preds ..B4.18 ..B4.17
-        incq      %r10                                          #4899.20
-                                # LOE rax rcx r10 r12 r13 r14 r15 edx ebp esi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.20:                        # Preds ..B4.1 ..B4.16 ..B4.19
-        movdqa    %xmm0, %xmm10                                 #4807.22
-        movdqa    %xmm0, %xmm9                                  #4808.22
-        pand      %xmm8, %xmm10                                 #4807.22
-        pand      %xmm7, %xmm9                                  #4808.22
-        pcmpeqd   %xmm9, %xmm10                                 #4809.22
-        pmovmskb  %xmm10, %edi                                  #4810.22
-        incl      %edi                                          #4811.17
-        shrl      $16, %edi                                     #4811.17
-        negl      %edi                                          #4811.17
-        jmp       ..B4.9        # Prob 100%                     #4811.17
-                                # LOE rax rcx r10 r12 r13 r14 r15 edx ebp esi edi xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B4.21:                        # Preds ..B4.11                 # Infreq
-        subl      %edx, %ebp                                    #4842.30
-        cmpl      $2, %ebp                                      #4842.37
-        je        ..B4.25       # Prob 25%                      #4842.37
-                                # LOE rbx r12 r13 r14 r15 ebp edi r8d r9d
-..B4.22:                        # Preds ..B4.21                 # Infreq
-        cmpl      $1, %ebp                                      #4842.37
-        je        ..B4.26       # Prob 33%                      #4842.37
-                                # LOE rbx r12 r13 r14 r15 ebp edi r9d
-..B4.23:                        # Preds ..B4.22                 # Infreq
-        testl     %ebp, %ebp                                    #4842.37
-        je        ..B4.27       # Prob 50%                      #4842.37
-                                # LOE rbx r12 r13 r14 r15 edi
-..B4.24:                        # Preds ..B4.23                 # Infreq
-        movl      $1, %eax                                      #4845.32
-..___tag_value_eval_4na_128.340:                                #4845.32
-        popq      %rbx                                          #4845.32
-..___tag_value_eval_4na_128.342:                                #
-        popq      %rbp                                          #4845.32
-..___tag_value_eval_4na_128.344:                                #
-        ret                                                     #4845.32
-..___tag_value_eval_4na_128.345:                                #
-                                # LOE
-..B4.25:                        # Preds ..B4.21                 # Infreq
-        testl     %r8d, %r8d                                    #4847.36
-        jne       ..B4.28       # Prob 28%                      #4847.36
-                                # LOE rbx r12 r13 r14 r15 edi r9d
-..B4.26:                        # Preds ..B4.22 ..B4.25         # Infreq
-        testl     %r9d, %r9d                                    #4849.36
-        jne       ..B4.28       # Prob 28%                      #4849.36
-                                # LOE rbx r12 r13 r14 r15 edi
-..B4.27:                        # Preds ..B4.26 ..B4.23         # Infreq
-        testl     %edi, %edi                                    #4851.36
-        je        ..B4.29       # Prob 50%                      #4851.36
-                                # LOE rbx r12 r13 r14 r15
-..B4.28:                        # Preds ..B4.25 ..B4.26 ..B4.27 # Infreq
-        movl      $1, %eax                                      #4851.47
-..___tag_value_eval_4na_128.348:                                #4851.47
-        popq      %rbx                                          #4851.47
-..___tag_value_eval_4na_128.350:                                #
-        popq      %rbp                                          #4851.47
-..___tag_value_eval_4na_128.352:                                #
-        ret                                                     #4851.47
-..___tag_value_eval_4na_128.353:                                #
-                                # LOE
-..B4.29:                        # Preds ..B4.14 ..B4.12 ..B4.27 # Infreq
-        xorl      %eax, %eax                                    #4853.28
-..___tag_value_eval_4na_128.356:                                #4853.28
-        popq      %rbx                                          #4853.28
-..___tag_value_eval_4na_128.358:                                #
-        popq      %rbp                                          #4853.28
-..___tag_value_eval_4na_128.360:                                #
-        ret                                                     #4853.28
-        .align    16,0x90
-..___tag_value_eval_4na_128.361:                                #
-                                # LOE
-# mark_end;
-	.type	eval_4na_128, at function
-	.size	eval_4na_128,.-eval_4na_128
-	.data
-# -- End  eval_4na_128
-	.text
-# -- Begin  eval_4na_32
-# mark_begin;
-       .align    16,0x90
-eval_4na_32:
-# parameter 1: %rdi
-# parameter 2: %rsi
-# parameter 3: %edx
-# parameter 4: %ecx
-..B5.1:                         # Preds ..B5.0
-..___tag_value_eval_4na_32.362:                                 #4279.1
-        pushq     %r15                                          #4279.1
-..___tag_value_eval_4na_32.364:                                 #
-        pushq     %r14                                          #4279.1
-..___tag_value_eval_4na_32.366:                                 #
-        pushq     %r13                                          #4279.1
-..___tag_value_eval_4na_32.368:                                 #
-        pushq     %r12                                          #4279.1
-..___tag_value_eval_4na_32.370:                                 #
-        pushq     %rbx                                          #4279.1
-..___tag_value_eval_4na_32.372:                                 #
-        movdqa    16(%rdi), %xmm8                               #4331.5
-        movdqa    32(%rdi), %xmm7                               #4331.5
-        movdqa    48(%rdi), %xmm6                               #4331.5
-        movdqa    64(%rdi), %xmm5                               #4331.5
-        movdqa    80(%rdi), %xmm4                               #4331.5
-        movdqa    96(%rdi), %xmm3                               #4331.5
-        movdqa    112(%rdi), %xmm2                              #4331.5
-        movdqa    128(%rdi), %xmm1                              #4331.5
-        lea       (%rdx,%rcx), %r11d                            #4312.5
-        movl      %edx, %ebx                                    #4315.49
-        shrl      $2, %ebx                                      #4315.49
-        subl      4(%rdi), %r11d                                #4318.12
-        movzbl    (%rbx,%rsi), %eax                             #4324.14
-        movzbl    1(%rbx,%rsi), %r9d                            #4324.14
-        lea       3(%rdx,%rcx), %r10d                           #4321.50
-        shrl      $2, %r10d                                     #4321.57
-        addq      %rsi, %r10                                    #4321.30
-        lea       expand_2na.0(%rip), %rcx                      #4324.14
-        movzwl    (%rcx,%rax,2), %r8d                           #4324.14
-        movzwl    (%rcx,%r9,2), %eax                            #4324.14
-        movw      %r8w, -16(%rsp)                               #4324.14
-        movzbl    2(%rbx,%rsi), %r8d                            #4324.14
-        movzwl    (%rcx,%r8,2), %r9d                            #4324.14
-        movw      %ax, -14(%rsp)                                #4324.14
-        movzbl    3(%rbx,%rsi), %eax                            #4324.14
-        movzwl    (%rcx,%rax,2), %r8d                           #4324.14
-        movw      %r9w, -12(%rsp)                               #4324.14
-        movzbl    4(%rbx,%rsi), %r9d                            #4324.14
-        movzwl    (%rcx,%r9,2), %eax                            #4324.14
-        movw      %r8w, -10(%rsp)                               #4324.14
-        movzbl    5(%rbx,%rsi), %r8d                            #4324.14
-        movzwl    (%rcx,%r8,2), %r9d                            #4324.14
-        movw      %ax, -8(%rsp)                                 #4324.14
-        movzbl    6(%rbx,%rsi), %eax                            #4324.14
-        movzwl    (%rcx,%rax,2), %r8d                           #4324.14
-        movw      %r9w, -6(%rsp)                                #4324.14
-        movzbl    7(%rbx,%rsi), %r9d                            #4324.14
-        movzwl    (%rcx,%r9,2), %ecx                            #4324.14
-        movw      %r8w, -4(%rsp)                                #4324.14
-        movl      %edx, %eax                                    #4345.20
-        lea       8(%rsi,%rbx), %rbx                            #4325.5
-        movw      %cx, -2(%rsp)                                 #4324.14
-        movdqu    -16(%rsp), %xmm0                              #4324.14
-        movq      %rbx, %rcx                                    #4325.5
-        xorl      %r8d, %r8d                                    #4334.15
-        xorl      %r9d, %r9d                                    #4334.10
-        xorl      %edi, %edi                                    #4334.5
-        movl      $2, %esi                                      #4340.5
-        andl      $3, %eax                                      #4345.20
-        je        ..B5.29       # Prob 20%                      #4345.20
-                                # LOE rcx rbx rbp r10 r12 r13 r14 r15 eax edx esi edi r8d r9d r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B5.2:                         # Preds ..B5.1
-        cmpl      $1, %eax                                      #4345.20
-        je        ..B5.9        # Prob 25%                      #4345.20
-                                # LOE rcx rbx rbp r10 r12 r13 r14 r15 eax edx esi edi r8d r9d r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B5.3:                         # Preds ..B5.2
-        cmpl      $2, %eax                                      #4345.20
-        je        ..B5.10       # Prob 33%                      #4345.20
-                                # LOE rcx rbx rbp r10 r12 r13 r14 r15 eax edx esi edi r8d r9d r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B5.4:                         # Preds ..B5.3
-        cmpl      $3, %eax                                      #4345.20
-        je        ..B5.11       # Prob 50%                      #4345.20
-        jmp       ..B5.25       # Prob 100%                     #4345.20
-                                # LOE rcx rbx rbp r10 r12 r13 r14 r15 edx esi edi r8d r9d r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B5.9:                         # Preds ..B5.2 ..B5.29
-        movdqa    %xmm0, %xmm10                                 #4369.22
-        movdqa    %xmm0, %xmm9                                  #4370.22
-        pand      %xmm6, %xmm10                                 #4369.22
-        pand      %xmm5, %xmm9                                  #4370.22
-        pcmpeqd   %xmm9, %xmm10                                 #4371.22
-        pmovmskb  %xmm10, %r9d                                  #4372.22
-                                # LOE rcx rbx rbp r10 edx esi edi r9d r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B5.10:                        # Preds ..B5.3 ..B5.9
-        movdqa    %xmm0, %xmm10                                 #4376.22
-        movdqa    %xmm0, %xmm9                                  #4377.22
-        pand      %xmm4, %xmm10                                 #4376.22
-        pand      %xmm3, %xmm9                                  #4377.22
-        pcmpeqd   %xmm9, %xmm10                                 #4378.22
-        pmovmskb  %xmm10, %r8d                                  #4379.22
-                                # LOE rcx rbx rbp r10 edx esi edi r8d r9d r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B5.11:                        # Preds ..B5.4 ..B5.10
-        movdqa    %xmm0, %xmm10                                 #4383.22
-        movdqa    %xmm0, %xmm9                                  #4384.22
-        movl      %edx, %r13d                                   #4391.17
-        pand      %xmm2, %xmm10                                 #4383.22
-        pand      %xmm1, %xmm9                                  #4384.22
-        pcmpeqd   %xmm9, %xmm10                                 #4385.22
-        pmovmskb  %xmm10, %r12d                                 #4386.22
-        andl      $-4, %r13d                                    #4391.17
-        movl      %edi, %edx                                    #4394.29
-        orl       %r9d, %edx                                    #4394.29
-        orl       %r8d, %edx                                    #4394.34
-        orl       %r12d, %edx                                   #4394.39
-        je        ..B5.20       # Prob 78%                      #4394.47
-                                # LOE rcx rbx rbp r10 esi edi r8d r9d r11d r12d r13d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B5.12:                        # Preds ..B5.11
-        movl      %edi, %eax                                    #4412.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+6;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4412.30
-        movswq    %ax, %r15                                     #4412.30
-        movl      %r9d, %eax                                    #4413.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+6;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4413.30
-        movswq    %ax, %rdx                                     #4413.30
-        movl      %r8d, %eax                                    #4414.30
-        lea       1(%rdx,%rdx), %edx                            #4421.40
-# Begin ASM
-        bsf %ax, %ax;jnz .+6;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4414.30
-        movswq    %ax, %r14                                     #4414.30
-        movl      %r12d, %eax                                   #4415.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+6;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4415.30
-        movswq    %ax, %rax                                     #4415.30
-        lea       2(%r14,%r14), %r14d                           #4422.40
-        lea       3(%rax,%rax), %eax                            #4423.40
-        testl     %edi, %edi                                    #4427.32
-        je        ..B5.14       # Prob 50%                      #4427.32
-                                # LOE rcx rbx rbp r10 eax edx esi r8d r9d r11d r12d r13d r14d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B5.13:                        # Preds ..B5.12
-        lea       (%r13,%r15,2), %edi                           #4427.43
-        cmpl      %edi, %r11d                                   #4427.49
-        jae       ..B5.34       # Prob 20%                      #4427.49
-                                # LOE rcx rbx rbp r10 eax edx esi r8d r9d r11d r12d r13d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B5.14:                        # Preds ..B5.13 ..B5.12
-        testl     %r9d, %r9d                                    #4428.32
-        je        ..B5.16       # Prob 50%                      #4428.32
-                                # LOE rcx rbx rbp r10 eax edx esi r8d r11d r12d r13d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B5.15:                        # Preds ..B5.14
-        addl      %r13d, %edx                                   #4428.43
-        cmpl      %edx, %r11d                                   #4428.49
-        jae       ..B5.34       # Prob 20%                      #4428.49
-                                # LOE rcx rbx rbp r10 eax esi r8d r11d r12d r13d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B5.16:                        # Preds ..B5.15 ..B5.14
-        testl     %r8d, %r8d                                    #4429.32
-        je        ..B5.18       # Prob 50%                      #4429.32
-                                # LOE rcx rbx rbp r10 eax esi r11d r12d r13d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B5.17:                        # Preds ..B5.16
-        addl      %r13d, %r14d                                  #4429.43
-        cmpl      %r14d, %r11d                                  #4429.49
-        jae       ..B5.34       # Prob 20%                      #4429.49
-                                # LOE rcx rbx rbp r10 eax esi r11d r12d r13d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B5.18:                        # Preds ..B5.17 ..B5.16
-        testl     %r12d, %r12d                                  #4430.32
-        je        ..B5.20       # Prob 50%                      #4430.32
-                                # LOE rcx rbx rbp r10 eax esi r11d r13d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B5.19:                        # Preds ..B5.18
-        addl      %r13d, %eax                                   #4430.43
-        cmpl      %eax, %r11d                                   #4430.49
-        jae       ..B5.34       # Prob 20%                      #4430.49
-                                # LOE rcx rbx rbp r10 esi r11d r13d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B5.20:                        # Preds ..B5.19 ..B5.18 ..B5.11
-        lea       4(%r13), %edx                                 #4435.17
-        cmpl      %r11d, %edx                                   #4438.28
-        ja        ..B5.31       # Prob 20%                      #4438.28
-                                # LOE rcx rbx rbp r10 edx esi r11d r13d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B5.21:                        # Preds ..B5.20
-        decl      %esi                                          #4442.25
-        jne       ..B5.26       # Prob 50%                      #4442.39
-                                # LOE rcx rbx rbp r10 edx esi r11d r13d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B5.22:                        # Preds ..B5.21
-        cmpq      %r10, %rbx                                    #4459.25
-        jae       ..B5.31       # Prob 4%                       #4459.25
-                                # LOE rbx rbp r10 r11d r13d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B5.23:                        # Preds ..B5.22
-        lea       28(%r13), %edx                                #4463.13
-        cmpl      %r11d, %edx                                   #4464.24
-        ja        ..B5.31       # Prob 4%                       #4464.24
-                                # LOE rbx rbp r10 edx r11d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B5.24:                        # Preds ..B5.23
-        movzbl    (%rbx), %ecx                                  #4469.22
-        movzbl    1(%rbx), %edi                                 #4469.22
-        movzbl    2(%rbx), %r9d                                 #4469.22
-        movzbl    3(%rbx), %r13d                                #4469.22
-        movzbl    4(%rbx), %r15d                                #4469.22
-        lea       expand_2na.0(%rip), %rax                      #4469.22
-        movzwl    (%rax,%rcx,2), %esi                           #4469.22
-        movzwl    (%rax,%rdi,2), %r8d                           #4469.22
-        movzwl    (%rax,%r9,2), %r12d                           #4469.22
-        movzwl    (%rax,%r13,2), %r14d                          #4469.22
-        movzwl    (%rax,%r15,2), %ecx                           #4469.22
-        movw      %si, -16(%rsp)                                #4469.22
-        movzbl    5(%rbx), %esi                                 #4469.22
-        movzwl    (%rax,%rsi,2), %edi                           #4469.22
-        movw      %r8w, -14(%rsp)                               #4469.22
-        movzbl    6(%rbx), %r8d                                 #4469.22
-        movzwl    (%rax,%r8,2), %r9d                            #4469.22
-        movw      %r12w, -12(%rsp)                              #4469.22
-        movzbl    7(%rbx), %r12d                                #4469.22
-        movzwl    (%rax,%r12,2), %eax                           #4469.22
-        movw      %r14w, -10(%rsp)                              #4469.22
-        movw      %cx, -8(%rsp)                                 #4469.22
-        addq      $8, %rbx                                      #4484.13
-        movw      %di, -6(%rsp)                                 #4469.22
-        movq      %rbx, %rcx                                    #4484.13
-        movw      %r9w, -4(%rsp)                                #4469.22
-        movw      %ax, -2(%rsp)                                 #4469.22
-        movdqu    -16(%rsp), %xmm0                              #4469.22
-                                # LOE rcx rbx rbp r10 edx r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B5.25:                        # Preds ..B5.4 ..B5.24
-        movl      $2, %esi                                      #4352.13
-        jmp       ..B5.29       # Prob 100%                     #4352.13
-                                # LOE rcx rbx rbp r10 edx esi r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B5.26:                        # Preds ..B5.21
-        psrldq    $2, %xmm0                                     #4447.26
-        cmpq      %r10, %rcx                                    #4450.26
-        jae       ..B5.28       # Prob 19%                      #4450.26
-                                # LOE rcx rbx rbp r10 edx esi r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B5.27:                        # Preds ..B5.26
-        movzbl    (%rcx), %edi                                  #4451.72
-        lea       expand_2na.0(%rip), %rax                      #4451.57
-        movzwl    (%rax,%rdi,2), %r8d                           #4451.57
-        pinsrw    $7, %r8d, %xmm0                               #4451.30
-                                # LOE rcx rbx rbp r10 edx esi r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B5.28:                        # Preds ..B5.27 ..B5.26
-        incq      %rcx                                          #4454.20
-                                # LOE rcx rbx rbp r10 edx esi r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B5.29:                        # Preds ..B5.1 ..B5.25 ..B5.28
-        movdqa    %xmm0, %xmm10                                 #4362.22
-        movdqa    %xmm0, %xmm9                                  #4363.22
-        pand      %xmm8, %xmm10                                 #4362.22
-        pand      %xmm7, %xmm9                                  #4363.22
-        pcmpeqd   %xmm9, %xmm10                                 #4364.22
-        pmovmskb  %xmm10, %edi                                  #4365.22
-        jmp       ..B5.9        # Prob 100%                     #4365.22
-                                # LOE rcx rbx rbp r10 edx esi edi r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B5.31:                        # Preds ..B5.20 ..B5.22 ..B5.23 # Infreq
-        xorl      %eax, %eax                                    #4495.12
-..___tag_value_eval_4na_32.375:                                 #4495.12
-        popq      %rbx                                          #4495.12
-..___tag_value_eval_4na_32.377:                                 #
-        popq      %r12                                          #4495.12
-..___tag_value_eval_4na_32.379:                                 #
-        popq      %r13                                          #4495.12
-..___tag_value_eval_4na_32.381:                                 #
-        popq      %r14                                          #4495.12
-..___tag_value_eval_4na_32.383:                                 #
-        popq      %r15                                          #4495.12
-..___tag_value_eval_4na_32.385:                                 #
-        ret                                                     #4495.12
-..___tag_value_eval_4na_32.386:                                 #
-                                # LOE
-..B5.34:                        # Preds ..B5.13 ..B5.19 ..B5.17 ..B5.15 # Infreq
-        movl      $1, %eax                                      #4428.63
-..___tag_value_eval_4na_32.392:                                 #4428.63
-        popq      %rbx                                          #4428.63
-..___tag_value_eval_4na_32.394:                                 #
-        popq      %r12                                          #4428.63
-..___tag_value_eval_4na_32.396:                                 #
-        popq      %r13                                          #4428.63
-..___tag_value_eval_4na_32.398:                                 #
-        popq      %r14                                          #4428.63
-..___tag_value_eval_4na_32.400:                                 #
-        popq      %r15                                          #4428.63
-..___tag_value_eval_4na_32.402:                                 #
-        ret                                                     #4428.63
-        .align    16,0x90
-..___tag_value_eval_4na_32.403:                                 #
-                                # LOE
-# mark_end;
-	.type	eval_4na_32, at function
-	.size	eval_4na_32,.-eval_4na_32
-	.data
-# -- End  eval_4na_32
-	.text
-# -- Begin  eval_4na_16
-# mark_begin;
-       .align    16,0x90
-eval_4na_16:
-# parameter 1: %rdi
-# parameter 2: %rsi
-# parameter 3: %edx
-# parameter 4: %ecx
-..B6.1:                         # Preds ..B6.0
-..___tag_value_eval_4na_16.404:                                 #4057.1
-        pushq     %r13                                          #4057.1
-..___tag_value_eval_4na_16.406:                                 #
-        pushq     %r12                                          #4057.1
-..___tag_value_eval_4na_16.408:                                 #
-        pushq     %rbx                                          #4057.1
-..___tag_value_eval_4na_16.410:                                 #
-        movdqa    16(%rdi), %xmm8                               #4109.5
-        movdqa    32(%rdi), %xmm7                               #4109.5
-        movdqa    48(%rdi), %xmm6                               #4109.5
-        movdqa    64(%rdi), %xmm5                               #4109.5
-        movdqa    80(%rdi), %xmm4                               #4109.5
-        movdqa    96(%rdi), %xmm3                               #4109.5
-        movdqa    112(%rdi), %xmm2                              #4109.5
-        movdqa    128(%rdi), %xmm1                              #4109.5
-        lea       (%rdx,%rcx), %r10d                            #4090.5
-        subl      4(%rdi), %r10d                                #4096.12
-        movl      %edx, %eax                                    #4093.49
-        shrl      $2, %eax                                      #4093.49
-        movzbl    (%rax,%rsi), %r8d                             #4102.14
-        lea       3(%rdx,%rcx), %r9d                            #4099.50
-        shrl      $2, %r9d                                      #4099.57
-        addq      %rsi, %r9                                     #4099.30
-        lea       expand_2na.0(%rip), %rcx                      #4102.14
-        movzwl    (%rcx,%r8,2), %r11d                           #4102.14
-        movzbl    1(%rax,%rsi), %r8d                            #4102.14
-        movw      %r11w, -16(%rsp)                              #4102.14
-        movzwl    (%rcx,%r8,2), %r11d                           #4102.14
-        movzbl    2(%rax,%rsi), %r8d                            #4102.14
-        xorl      %edi, %edi                                    #4112.15
-        movw      %r11w, -14(%rsp)                              #4102.14
-        movzwl    (%rcx,%r8,2), %r11d                           #4102.14
-        movzbl    3(%rax,%rsi), %r8d                            #4102.14
-        movw      %r11w, -12(%rsp)                              #4102.14
-        movzwl    (%rcx,%r8,2), %r11d                           #4102.14
-        movzbl    4(%rax,%rsi), %r8d                            #4102.14
-        movw      %r11w, -10(%rsp)                              #4102.14
-        movzwl    (%rcx,%r8,2), %r11d                           #4102.14
-        movzbl    5(%rax,%rsi), %r8d                            #4102.14
-        movw      %r11w, -8(%rsp)                               #4102.14
-        movzwl    (%rcx,%r8,2), %r11d                           #4102.14
-        movzbl    6(%rax,%rsi), %r8d                            #4102.14
-        movw      %r11w, -6(%rsp)                               #4102.14
-        movzwl    (%rcx,%r8,2), %r11d                           #4102.14
-        movzbl    7(%rax,%rsi), %r8d                            #4102.14
-        movzwl    (%rcx,%r8,2), %ecx                            #4102.14
-        xorl      %r8d, %r8d                                    #4112.10
-        movw      %r11w, -4(%rsp)                               #4102.14
-        movw      %cx, -2(%rsp)                                 #4102.14
-        movdqu    -16(%rsp), %xmm0                              #4102.14
-        lea       8(%rsi,%rax), %rcx                            #4103.5
-        xorl      %esi, %esi                                    #4112.5
-        movl      %edx, %r11d                                   #4123.20
-        andl      $3, %r11d                                     #4123.20
-        je        ..B6.24       # Prob 20%                      #4123.20
-                                # LOE rcx rbx rbp r9 r12 r13 r14 r15 edx esi edi r8d r10d r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.2:                         # Preds ..B6.1
-        cmpl      $1, %r11d                                     #4123.20
-        je        ..B6.9        # Prob 25%                      #4123.20
-                                # LOE rcx rbx rbp r9 r12 r13 r14 r15 edx esi edi r8d r10d r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.3:                         # Preds ..B6.2
-        cmpl      $2, %r11d                                     #4123.20
-        je        ..B6.10       # Prob 33%                      #4123.20
-                                # LOE rcx rbx rbp r9 r12 r13 r14 r15 edx esi edi r8d r10d r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.4:                         # Preds ..B6.3
-        cmpl      $3, %r11d                                     #4123.20
-        je        ..B6.11       # Prob 50%                      #4123.20
-        jmp       ..B6.24       # Prob 100%                     #4123.20
-                                # LOE rcx rbx rbp r9 r12 r13 r14 r15 edx esi edi r8d r10d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.9:                         # Preds ..B6.2 ..B6.24
-        movdqa    %xmm0, %xmm10                                 #4147.22
-        movdqa    %xmm0, %xmm9                                  #4148.22
-        pand      %xmm6, %xmm10                                 #4147.22
-        pand      %xmm5, %xmm9                                  #4148.22
-        pcmpeqw   %xmm9, %xmm10                                 #4149.22
-        pmovmskb  %xmm10, %r8d                                  #4150.22
-                                # LOE rcx rbp r9 r14 r15 edx esi r8d r10d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.10:                        # Preds ..B6.3 ..B6.9
-        movdqa    %xmm0, %xmm10                                 #4154.22
-        movdqa    %xmm0, %xmm9                                  #4155.22
-        pand      %xmm4, %xmm10                                 #4154.22
-        pand      %xmm3, %xmm9                                  #4155.22
-        pcmpeqw   %xmm9, %xmm10                                 #4156.22
-        pmovmskb  %xmm10, %edi                                  #4157.22
-                                # LOE rcx rbp r9 r14 r15 edx esi edi r8d r10d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.11:                        # Preds ..B6.4 ..B6.10
-        movdqa    %xmm0, %xmm9                                  #4161.22
-        pand      %xmm1, %xmm0                                  #4162.22
-        andl      $-4, %edx                                     #4169.17
-        pand      %xmm2, %xmm9                                  #4161.22
-        pcmpeqw   %xmm0, %xmm9                                  #4163.22
-        pmovmskb  %xmm9, %r13d                                  #4164.22
-        movl      %esi, %ebx                                    #4172.29
-        orl       %r8d, %ebx                                    #4172.29
-        orl       %edi, %ebx                                    #4172.34
-        orl       %r13d, %ebx                                   #4172.39
-        je        ..B6.20       # Prob 78%                      #4172.47
-                                # LOE rcx rbp r9 r14 r15 edx esi edi r8d r10d r13d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.12:                        # Preds ..B6.11
-        movl      %esi, %eax                                    #4190.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+6;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4190.30
-        movswq    %ax, %r12                                     #4190.30
-        movl      %r8d, %eax                                    #4191.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+6;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4191.30
-        movswq    %ax, %rbx                                     #4191.30
-        movl      %edi, %eax                                    #4192.30
-        lea       1(%rbx,%rbx), %ebx                            #4199.40
-# Begin ASM
-        bsf %ax, %ax;jnz .+6;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4192.30
-        movswq    %ax, %r11                                     #4192.30
-        movl      %r13d, %eax                                   #4193.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+6;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4193.30
-        movswq    %ax, %rax                                     #4193.30
-        lea       2(%r11,%r11), %r11d                           #4200.40
-        lea       3(%rax,%rax), %eax                            #4201.40
-        testl     %esi, %esi                                    #4205.32
-        je        ..B6.14       # Prob 50%                      #4205.32
-                                # LOE rcx rbp r9 r14 r15 eax edx ebx edi r8d r10d r11d r12d r13d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.13:                        # Preds ..B6.12
-        lea       (%rdx,%r12,2), %esi                           #4205.43
-        cmpl      %esi, %r10d                                   #4205.49
-        jae       ..B6.29       # Prob 20%                      #4205.49
-                                # LOE rcx rbp r9 r14 r15 eax edx ebx edi r8d r10d r11d r13d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.14:                        # Preds ..B6.13 ..B6.12
-        testl     %r8d, %r8d                                    #4206.32
-        je        ..B6.16       # Prob 50%                      #4206.32
-                                # LOE rcx rbp r9 r14 r15 eax edx ebx edi r10d r11d r13d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.15:                        # Preds ..B6.14
-        addl      %edx, %ebx                                    #4206.43
-        cmpl      %ebx, %r10d                                   #4206.49
-        jae       ..B6.29       # Prob 20%                      #4206.49
-                                # LOE rcx rbp r9 r14 r15 eax edx edi r10d r11d r13d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.16:                        # Preds ..B6.15 ..B6.14
-        testl     %edi, %edi                                    #4207.32
-        je        ..B6.18       # Prob 50%                      #4207.32
-                                # LOE rcx rbp r9 r14 r15 eax edx r10d r11d r13d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.17:                        # Preds ..B6.16
-        addl      %edx, %r11d                                   #4207.43
-        cmpl      %r11d, %r10d                                  #4207.49
-        jae       ..B6.29       # Prob 20%                      #4207.49
-                                # LOE rcx rbp r9 r14 r15 eax edx r10d r13d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.18:                        # Preds ..B6.17 ..B6.16
-        testl     %r13d, %r13d                                  #4208.32
-        je        ..B6.20       # Prob 50%                      #4208.32
-                                # LOE rcx rbp r9 r14 r15 eax edx r10d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.19:                        # Preds ..B6.18
-        addl      %edx, %eax                                    #4208.43
-        cmpl      %eax, %r10d                                   #4208.49
-        jae       ..B6.29       # Prob 20%                      #4208.49
-                                # LOE rcx rbp r9 r14 r15 edx r10d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.20:                        # Preds ..B6.19 ..B6.18 ..B6.11
-        lea       4(%rdx), %eax                                 #4241.13
-        cmpl      %eax, %r10d                                   #4216.28
-        jb        ..B6.26       # Prob 20%                      #4216.28
-                                # LOE rcx rbp r9 r14 r15 edx r10d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.21:                        # Preds ..B6.20
-        cmpq      %r9, %rcx                                     #4237.25
-        jae       ..B6.26       # Prob 4%                       #4237.25
-                                # LOE rcx rbp r9 r14 r15 edx r10d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.22:                        # Preds ..B6.21
-        addl      $32, %edx                                     #4241.13
-        cmpl      %r10d, %edx                                   #4242.24
-        ja        ..B6.26       # Prob 4%                       #4242.24
-                                # LOE rcx rbp r9 r14 r15 edx r10d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.23:                        # Preds ..B6.22
-        movzbl    (%rcx), %ebx                                  #4247.22
-        movzbl    1(%rcx), %edi                                 #4247.22
-        movzbl    2(%rcx), %r11d                                #4247.22
-        movzbl    3(%rcx), %r13d                                #4247.22
-        lea       expand_2na.0(%rip), %rax                      #4247.22
-        movzwl    (%rax,%rbx,2), %esi                           #4247.22
-        movzwl    (%rax,%rdi,2), %r8d                           #4247.22
-        movzwl    (%rax,%r11,2), %r12d                          #4247.22
-        movzwl    (%rax,%r13,2), %ebx                           #4247.22
-        movw      %si, -16(%rsp)                                #4247.22
-        movzbl    4(%rcx), %esi                                 #4247.22
-        movzwl    (%rax,%rsi,2), %edi                           #4247.22
-        movw      %r8w, -14(%rsp)                               #4247.22
-        movzbl    5(%rcx), %r8d                                 #4247.22
-        movzwl    (%rax,%r8,2), %r11d                           #4247.22
-        movw      %r12w, -12(%rsp)                              #4247.22
-        movzbl    6(%rcx), %r12d                                #4247.22
-        movzwl    (%rax,%r12,2), %r13d                          #4247.22
-        movw      %bx, -10(%rsp)                                #4247.22
-        movzbl    7(%rcx), %ebx                                 #4247.22
-        movzwl    (%rax,%rbx,2), %eax                           #4247.22
-        movw      %di, -8(%rsp)                                 #4247.22
-        addq      $8, %rcx                                      #4262.13
-        movw      %r11w, -6(%rsp)                               #4247.22
-        movw      %r13w, -4(%rsp)                               #4247.22
-        movw      %ax, -2(%rsp)                                 #4247.22
-        movdqu    -16(%rsp), %xmm0                              #4247.22
-                                # LOE rcx rbp r9 r14 r15 edx r10d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.24:                        # Preds ..B6.1 ..B6.4 ..B6.23
-        movdqa    %xmm0, %xmm10                                 #4140.22
-        movdqa    %xmm0, %xmm9                                  #4141.22
-        pand      %xmm8, %xmm10                                 #4140.22
-        pand      %xmm7, %xmm9                                  #4141.22
-        pcmpeqw   %xmm9, %xmm10                                 #4142.22
-        pmovmskb  %xmm10, %esi                                  #4143.22
-        jmp       ..B6.9        # Prob 100%                     #4143.22
-                                # LOE rcx rbp r9 r14 r15 edx esi r10d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B6.26:                        # Preds ..B6.20 ..B6.21 ..B6.22 # Infreq
-        xorl      %eax, %eax                                    #4273.12
-..___tag_value_eval_4na_16.413:                                 #4273.12
-        popq      %rbx                                          #4273.12
-..___tag_value_eval_4na_16.415:                                 #
-        popq      %r12                                          #4273.12
-..___tag_value_eval_4na_16.417:                                 #
-        popq      %r13                                          #4273.12
-..___tag_value_eval_4na_16.419:                                 #
-        ret                                                     #4273.12
-..___tag_value_eval_4na_16.420:                                 #
-                                # LOE
-..B6.29:                        # Preds ..B6.19 ..B6.17 ..B6.15 ..B6.13 # Infreq
-        movl      $1, %eax                                      #4205.63
-..___tag_value_eval_4na_16.424:                                 #4205.63
-        popq      %rbx                                          #4205.63
-..___tag_value_eval_4na_16.426:                                 #
-        popq      %r12                                          #4205.63
-..___tag_value_eval_4na_16.428:                                 #
-        popq      %r13                                          #4205.63
-..___tag_value_eval_4na_16.430:                                 #
-        ret                                                     #4205.63
-        .align    16,0x90
-..___tag_value_eval_4na_16.431:                                 #
-                                # LOE
-# mark_end;
-	.type	eval_4na_16, at function
-	.size	eval_4na_16,.-eval_4na_16
-	.data
-# -- End  eval_4na_16
-	.text
-# -- Begin  eval_2na_128
-# mark_begin;
-       .align    16,0x90
-eval_2na_128:
-# parameter 1: %rdi
-# parameter 2: %rsi
-# parameter 3: %edx
-# parameter 4: %ecx
-..B7.1:                         # Preds ..B7.0
-..___tag_value_eval_2na_128.432:                                #3369.1
-        pushq     %r15                                          #3369.1
-..___tag_value_eval_2na_128.434:                                #
-        pushq     %r12                                          #3369.1
-..___tag_value_eval_2na_128.436:                                #
-        pushq     %rbx                                          #3369.1
-..___tag_value_eval_2na_128.438:                                #
-        lea       (%rdx,%rcx), %r15d                            #3406.5
-        movl      %edx, %eax                                    #3409.49
-        shrl      $2, %eax                                      #3409.49
-        subl      4(%rdi), %r15d                                #3412.12
-        lea       (%rsi,%rax), %rbx                             #3409.30
-        lea       3(%rdx,%rcx), %r11d                           #3415.50
-        shrl      $2, %r11d                                     #3415.57
-        addq      %rsi, %r11                                    #3415.30
-        testq     $15, %rbx                                     #3418.14
-        jne       ..B7.3        # Prob 50%                      #3418.14
-                                # LOE rax rbx rbp rsi rdi r11 r12 r13 r14 edx r15d
-..B7.2:                         # Preds ..B7.1
-        movdqa    (%rbx), %xmm0                                 #3418.14
-        jmp       ..B7.4        # Prob 100%                     #3418.14
-                                # LOE rax rbp rsi rdi r11 r12 r13 r14 edx r15d xmm0
-..B7.3:                         # Preds ..B7.1
-        movdqu    (%rbx), %xmm0                                 #3418.14
-                                # LOE rax rbp rsi rdi r11 r12 r13 r14 edx r15d xmm0
-..B7.4:                         # Preds ..B7.2 ..B7.3
-        lea       16(%rsi,%rax), %r10                           #3419.5
-        movq      %r10, %r9                                     #3419.5
-        cmpq      %r11, %r10                                    #3424.16
-        jae       ..B7.6        # Prob 12%                      #3424.16
-                                # LOE rbp rdi r9 r10 r11 r12 r13 r14 edx r8d r15d xmm0
-..B7.5:                         # Preds ..B7.4
-        movzbl    -1(%r10), %r8d                                #3425.24
-        shll      $8, %r8d                                      #3425.38
-                                # LOE rbp rdi r9 r10 r11 r12 r13 r14 edx r8d r15d xmm0
-..B7.6:                         # Preds ..B7.5 ..B7.4
-        movdqa    16(%rdi), %xmm8                               #3429.5
-        movdqa    32(%rdi), %xmm7                               #3429.5
-        movdqa    48(%rdi), %xmm6                               #3429.5
-        movdqa    64(%rdi), %xmm5                               #3429.5
-        movdqa    80(%rdi), %xmm4                               #3429.5
-        movdqa    96(%rdi), %xmm3                               #3429.5
-        movdqa    112(%rdi), %xmm2                              #3429.5
-        movdqa    128(%rdi), %xmm1                              #3429.5
-        xorl      %ebx, %ebx                                    #3432.15
-        xorl      %esi, %esi                                    #3432.10
-        xorl      %ecx, %ecx                                    #3432.5
-        movl      %r15d, %eax                                   #3434.20
-        subl      %edx, %eax                                    #3434.20
-        addl      $7, %eax                                      #3434.33
-        shrl      $2, %eax                                      #3434.40
-        movl      %edx, %edi                                    #3441.20
-        andl      $3, %edi                                      #3441.20
-        je        ..B7.29       # Prob 20%                      #3441.20
-                                # LOE rbp r9 r10 r11 r12 r13 r14 eax edx ecx ebx esi edi r8d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B7.7:                         # Preds ..B7.6
-        cmpl      $1, %edi                                      #3441.20
-        je        ..B7.14       # Prob 25%                      #3441.20
-                                # LOE rbp r9 r10 r11 r12 r13 r14 eax edx ecx ebx esi edi r8d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B7.8:                         # Preds ..B7.7
-        cmpl      $2, %edi                                      #3441.20
-        je        ..B7.15       # Prob 33%                      #3441.20
-                                # LOE rbp r9 r10 r11 r12 r13 r14 eax edx ecx ebx esi edi r8d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B7.9:                         # Preds ..B7.8
-        cmpl      $3, %edi                                      #3441.20
-        je        ..B7.16       # Prob 50%                      #3441.20
-        jmp       ..B7.25       # Prob 100%                     #3441.20
-                                # LOE rbp r9 r10 r11 r12 r13 r14 eax edx ecx ebx esi r8d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B7.14:                        # Preds ..B7.7 ..B7.29
-        movdqa    %xmm0, %xmm9                                  #3464.22
-        pand      %xmm5, %xmm9                                  #3464.22
-        pcmpeqd   %xmm6, %xmm9                                  #3465.22
-        pmovmskb  %xmm9, %esi                                   #3466.22
-        incl      %esi                                          #3467.17
-        shrl      $16, %esi                                     #3467.17
-        negl      %esi                                          #3467.17
-                                # LOE rbp r9 r10 r11 r13 r14 eax edx ecx esi r8d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B7.15:                        # Preds ..B7.8 ..B7.14
-        movdqa    %xmm0, %xmm9                                  #3470.22
-        pand      %xmm3, %xmm9                                  #3470.22
-        pcmpeqd   %xmm4, %xmm9                                  #3471.22
-        pmovmskb  %xmm9, %ebx                                   #3472.22
-        incl      %ebx                                          #3473.17
-        shrl      $16, %ebx                                     #3473.17
-        negl      %ebx                                          #3473.17
-                                # LOE rbp r9 r10 r11 r13 r14 eax edx ecx ebx esi r8d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B7.16:                        # Preds ..B7.9 ..B7.15
-        movdqa    %xmm0, %xmm9                                  #3476.22
-        andl      $-4, %edx                                     #3483.17
-        movl      %ecx, %r12d                                   #3486.29
-        pand      %xmm1, %xmm9                                  #3476.22
-        pcmpeqd   %xmm2, %xmm9                                  #3477.22
-        pmovmskb  %xmm9, %edi                                   #3478.22
-        orl       %esi, %r12d                                   #3486.29
-        orl       %ebx, %r12d                                   #3486.34
-        incl      %edi                                          #3479.17
-        shrl      $16, %edi                                     #3479.17
-        negl      %edi                                          #3479.17
-        orl       %edi, %r12d                                   #3486.39
-        jne       ..B7.30       # Prob 20%                      #3486.47
-                                # LOE rbp r9 r10 r11 r13 r14 eax edx ecx ebx esi r8d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B7.17:                        # Preds ..B7.16
-        addl      $4, %edx                                      #3527.17
-        cmpl      %r15d, %edx                                   #3530.28
-        ja        ..B7.38       # Prob 20%                      #3530.28
-                                # LOE rbp r9 r10 r11 r13 r14 eax edx r8d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B7.18:                        # Preds ..B7.17
-        decl      %eax                                          #3534.25
-        jne       ..B7.26       # Prob 50%                      #3534.39
-                                # LOE rbp r9 r10 r11 r13 r14 eax edx r8d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B7.19:                        # Preds ..B7.18
-        cmpq      %r11, %r10                                    #3555.25
-        jae       ..B7.38       # Prob 4%                       #3555.25
-                                # LOE rbp r10 r11 r13 r14 edx r8d r15d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B7.20:                        # Preds ..B7.19
-        testq     $15, %r10                                     #3565.22
-        jne       ..B7.22       # Prob 50%                      #3565.22
-                                # LOE rbp r10 r11 r13 r14 edx r8d r15d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B7.21:                        # Preds ..B7.20
-        movdqa    (%r10), %xmm0                                 #3565.22
-        jmp       ..B7.23       # Prob 100%                     #3565.22
-                                # LOE rbp r10 r11 r13 r14 edx r8d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B7.22:                        # Preds ..B7.20
-        movdqu    (%r10), %xmm0                                 #3565.22
-                                # LOE rbp r10 r11 r13 r14 edx r8d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B7.23:                        # Preds ..B7.21 ..B7.22
-        addq      $16, %r10                                     #3643.13
-        movq      %r10, %r9                                     #3643.13
-        cmpq      %r11, %r10                                    #3646.24
-        jae       ..B7.25       # Prob 12%                      #3646.24
-                                # LOE rbp r9 r10 r11 r13 r14 edx r8d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B7.24:                        # Preds ..B7.23
-        movzbl    -1(%r10), %r8d                                #3647.32
-        shll      $8, %r8d                                      #3647.46
-                                # LOE rbp r9 r10 r11 r13 r14 edx r8d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B7.25:                        # Preds ..B7.9 ..B7.23 ..B7.24
-        movl      $16, %eax                                     #3448.13
-        jmp       ..B7.29       # Prob 100%                     #3448.13
-                                # LOE rbp r9 r10 r11 r13 r14 eax edx r8d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B7.26:                        # Preds ..B7.18
-        psrldq    $1, %xmm0                                     #3539.26
-        cmpq      %r11, %r9                                     #3542.26
-        jae       ..B7.28       # Prob 19%                      #3542.26
-                                # LOE rbp r9 r10 r11 r13 r14 eax edx r8d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B7.27:                        # Preds ..B7.26
-        movzbl    (%r9), %ecx                                   #3545.37
-        sarl      $8, %r8d                                      #3544.21
-        shll      $8, %ecx                                      #3545.48
-        orl       %ecx, %r8d                                    #3545.21
-        pinsrw    $7, %r8d, %xmm0                               #3546.30
-                                # LOE rbp r9 r10 r11 r13 r14 eax edx r8d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B7.28:                        # Preds ..B7.27 ..B7.26
-        incq      %r9                                           #3550.20
-                                # LOE rbp r9 r10 r11 r13 r14 eax edx r8d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B7.29:                        # Preds ..B7.6 ..B7.25 ..B7.28
-        movdqa    %xmm0, %xmm9                                  #3458.22
-        pand      %xmm7, %xmm9                                  #3458.22
-        pcmpeqd   %xmm8, %xmm9                                  #3459.22
-        pmovmskb  %xmm9, %ecx                                   #3460.22
-        incl      %ecx                                          #3461.17
-        shrl      $16, %ecx                                     #3461.17
-        negl      %ecx                                          #3461.17
-        jmp       ..B7.14       # Prob 100%                     #3461.17
-                                # LOE rbp r9 r10 r11 r13 r14 eax edx ecx r8d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B7.30:                        # Preds ..B7.16                 # Infreq
-        subl      %edx, %r15d                                   #3489.30
-        cmpl      $2, %r15d                                     #3489.37
-        je        ..B7.34       # Prob 25%                      #3489.37
-                                # LOE rbp r12 r13 r14 ecx ebx esi r15d
-..B7.31:                        # Preds ..B7.30                 # Infreq
-        cmpl      $1, %r15d                                     #3489.37
-        je        ..B7.35       # Prob 33%                      #3489.37
-                                # LOE rbp r12 r13 r14 ecx esi r15d
-..B7.32:                        # Preds ..B7.31                 # Infreq
-        testl     %r15d, %r15d                                  #3489.37
-        je        ..B7.36       # Prob 50%                      #3489.37
-                                # LOE rbp r12 r13 r14 ecx
-..B7.33:                        # Preds ..B7.32                 # Infreq
-        movl      $1, %eax                                      #3492.32
-..___tag_value_eval_2na_128.441:                                #3492.32
-        popq      %rbx                                          #3492.32
-..___tag_value_eval_2na_128.442:                                #
-        popq      %r12                                          #3492.32
-..___tag_value_eval_2na_128.444:                                #
-        popq      %r15                                          #3492.32
-..___tag_value_eval_2na_128.446:                                #
-        ret                                                     #3492.32
-..___tag_value_eval_2na_128.447:                                #
-                                # LOE
-..B7.34:                        # Preds ..B7.30                 # Infreq
-        testl     %ebx, %ebx                                    #3494.36
-        jne       ..B7.37       # Prob 28%                      #3494.36
-                                # LOE rbp r12 r13 r14 ecx esi
-..B7.35:                        # Preds ..B7.34 ..B7.31         # Infreq
-        testl     %esi, %esi                                    #3496.36
-        jne       ..B7.37       # Prob 28%                      #3496.36
-                                # LOE rbp r12 r13 r14 ecx
-..B7.36:                        # Preds ..B7.35 ..B7.32         # Infreq
-        testl     %ecx, %ecx                                    #3498.36
-        je        ..B7.38       # Prob 50%                      #3498.36
-                                # LOE rbp r12 r13 r14
-..B7.37:                        # Preds ..B7.34 ..B7.35 ..B7.36 # Infreq
-        movl      $1, %eax                                      #3498.47
-..___tag_value_eval_2na_128.451:                                #3498.47
-        popq      %rbx                                          #3498.47
-..___tag_value_eval_2na_128.452:                                #
-        popq      %r12                                          #3498.47
-..___tag_value_eval_2na_128.454:                                #
-        popq      %r15                                          #3498.47
-..___tag_value_eval_2na_128.456:                                #
-        ret                                                     #3498.47
-..___tag_value_eval_2na_128.457:                                #
-                                # LOE
-..B7.38:                        # Preds ..B7.17 ..B7.19 ..B7.36 # Infreq
-        xorl      %eax, %eax                                    #3500.28
-..___tag_value_eval_2na_128.461:                                #3500.28
-        popq      %rbx                                          #3500.28
-..___tag_value_eval_2na_128.462:                                #
-        popq      %r12                                          #3500.28
-..___tag_value_eval_2na_128.464:                                #
-        popq      %r15                                          #3500.28
-..___tag_value_eval_2na_128.466:                                #
-        ret                                                     #3500.28
-        .align    16,0x90
-..___tag_value_eval_2na_128.467:                                #
-                                # LOE
-# mark_end;
-	.type	eval_2na_128, at function
-	.size	eval_2na_128,.-eval_2na_128
-	.data
-# -- End  eval_2na_128
-	.text
-# -- Begin  eval_2na_32
-# mark_begin;
-       .align    16,0x90
-eval_2na_32:
-# parameter 1: %rdi
-# parameter 2: %rsi
-# parameter 3: %edx
-# parameter 4: %ecx
-..B8.1:                         # Preds ..B8.0
-..___tag_value_eval_2na_32.468:                                 #2782.1
-        pushq     %r15                                          #2782.1
-..___tag_value_eval_2na_32.470:                                 #
-        pushq     %r14                                          #2782.1
-..___tag_value_eval_2na_32.472:                                 #
-        pushq     %r13                                          #2782.1
-..___tag_value_eval_2na_32.474:                                 #
-        pushq     %r12                                          #2782.1
-..___tag_value_eval_2na_32.476:                                 #
-        pushq     %rbp                                          #2782.1
-..___tag_value_eval_2na_32.478:                                 #
-        pushq     %rbx                                          #2782.1
-..___tag_value_eval_2na_32.480:                                 #
-        lea       (%rdx,%rcx), %r15d                            #2819.5
-        movl      %edx, %eax                                    #2822.49
-        shrl      $2, %eax                                      #2822.49
-        subl      4(%rdi), %r15d                                #2825.12
-        lea       (%rsi,%rax), %r8                              #2822.30
-        lea       3(%rdx,%rcx), %r14d                           #2828.50
-        shrl      $2, %r14d                                     #2828.57
-        addq      %rsi, %r14                                    #2828.30
-        testq     $15, %r8                                      #2831.14
-        jne       ..B8.3        # Prob 50%                      #2831.14
-                                # LOE rax rbx rbp rsi rdi r8 r12 r13 r14 edx r15d
-..B8.2:                         # Preds ..B8.1
-        movdqa    (%r8), %xmm0                                  #2831.14
-        jmp       ..B8.4        # Prob 100%                     #2831.14
-                                # LOE rax rbx rbp rsi rdi r12 r13 r14 edx r15d xmm0
-..B8.3:                         # Preds ..B8.1
-        movdqu    (%r8), %xmm0                                  #2831.14
-                                # LOE rax rbx rbp rsi rdi r12 r13 r14 edx r15d xmm0
-..B8.4:                         # Preds ..B8.2 ..B8.3
-        lea       16(%rsi,%rax), %r8                            #2832.5
-        movq      %r8, %rsi                                     #2832.5
-        cmpq      %r14, %r8                                     #2837.16
-        jae       ..B8.6        # Prob 12%                      #2837.16
-                                # LOE rbx rbp rsi rdi r8 r12 r13 r14 edx ecx r15d xmm0
-..B8.5:                         # Preds ..B8.4
-        movzbl    -1(%r8), %ecx                                 #2838.24
-        shll      $8, %ecx                                      #2838.38
-                                # LOE rbx rbp rsi rdi r8 r12 r13 r14 edx ecx r15d xmm0
-..B8.6:                         # Preds ..B8.5 ..B8.4
-        movdqa    16(%rdi), %xmm8                               #2842.5
-        movdqa    32(%rdi), %xmm7                               #2842.5
-        movdqa    48(%rdi), %xmm6                               #2842.5
-        movdqa    64(%rdi), %xmm5                               #2842.5
-        movdqa    80(%rdi), %xmm4                               #2842.5
-        movdqa    96(%rdi), %xmm3                               #2842.5
-        movdqa    112(%rdi), %xmm2                              #2842.5
-        movdqa    128(%rdi), %xmm1                              #2842.5
-        xorl      %r10d, %r10d                                  #2845.15
-        xorl      %r11d, %r11d                                  #2845.10
-        xorl      %r9d, %r9d                                    #2845.5
-        movl      $4, %edi                                      #2849.5
-        movl      %edx, %eax                                    #2854.20
-        andl      $3, %eax                                      #2854.20
-        je        ..B8.38       # Prob 20%                      #2854.20
-                                # LOE rbx rbp rsi r8 r12 r13 r14 eax edx ecx edi r9d r10d r11d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B8.7:                         # Preds ..B8.6
-        cmpl      $1, %eax                                      #2854.20
-        je        ..B8.14       # Prob 25%                      #2854.20
-                                # LOE rbx rbp rsi r8 r12 r13 r14 eax edx ecx edi r9d r10d r11d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B8.8:                         # Preds ..B8.7
-        cmpl      $2, %eax                                      #2854.20
-        je        ..B8.15       # Prob 33%                      #2854.20
-                                # LOE rbx rbp rsi r8 r12 r13 r14 eax edx ecx edi r9d r10d r11d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B8.9:                         # Preds ..B8.8
-        cmpl      $3, %eax                                      #2854.20
-        je        ..B8.16       # Prob 50%                      #2854.20
-        jmp       ..B8.34       # Prob 100%                     #2854.20
-                                # LOE rbx rbp rsi r8 r12 r13 r14 edx ecx edi r9d r10d r11d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B8.14:                        # Preds ..B8.7 ..B8.38
-        movdqa    %xmm0, %xmm9                                  #2877.22
-        pand      %xmm5, %xmm9                                  #2877.22
-        pcmpeqd   %xmm6, %xmm9                                  #2878.22
-        pmovmskb  %xmm9, %r11d                                  #2879.22
-                                # LOE rsi r8 r14 edx ecx edi r9d r11d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B8.15:                        # Preds ..B8.8 ..B8.14
-        movdqa    %xmm0, %xmm9                                  #2883.22
-        pand      %xmm3, %xmm9                                  #2883.22
-        pcmpeqd   %xmm4, %xmm9                                  #2884.22
-        pmovmskb  %xmm9, %r10d                                  #2885.22
-                                # LOE rsi r8 r14 edx ecx edi r9d r10d r11d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B8.16:                        # Preds ..B8.9 ..B8.15
-        movdqa    %xmm0, %xmm9                                  #2889.22
-        movl      %edx, %ebx                                    #2896.17
-        andl      $-4, %ebx                                     #2896.17
-        pand      %xmm1, %xmm9                                  #2889.22
-        pcmpeqd   %xmm2, %xmm9                                  #2890.22
-        pmovmskb  %xmm9, %ebp                                   #2891.22
-        movl      %r9d, %edx                                    #2899.29
-        orl       %r11d, %edx                                   #2899.29
-        orl       %r10d, %edx                                   #2899.34
-        orl       %ebp, %edx                                    #2899.39
-        je        ..B8.25       # Prob 78%                      #2899.47
-                                # LOE rsi r8 r14 ecx ebx ebp edi r9d r10d r11d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B8.17:                        # Preds ..B8.16
-        movl      %r9d, %eax                                    #2917.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+6;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2917.30
-        movswq    %ax, %r13                                     #2917.30
-        movl      %r11d, %eax                                   #2918.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+6;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2918.30
-        movswq    %ax, %r12                                     #2918.30
-        movl      %r10d, %eax                                   #2919.30
-        shll      $2, %r13d                                     #2925.34
-        shll      $2, %r12d                                     #2926.34
-# Begin ASM
-        bsf %ax, %ax;jnz .+6;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2919.30
-        movswq    %ax, %rdx                                     #2919.30
-        movl      %ebp, %eax                                    #2920.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+6;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2920.30
-        movswq    %ax, %rax                                     #2920.30
-        shll      $2, %edx                                      #2927.34
-        shll      $2, %eax                                      #2928.34
-        testl     %r9d, %r9d                                    #2932.32
-        je        ..B8.19       # Prob 50%                      #2932.32
-                                # LOE rsi r8 r14 eax edx ecx ebx ebp edi r10d r11d r12d r13d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B8.18:                        # Preds ..B8.17
-        addl      %ebx, %r13d                                   #2932.43
-        cmpl      %r13d, %r15d                                  #2932.49
-        jae       ..B8.43       # Prob 20%                      #2932.49
-                                # LOE rsi r8 r14 eax edx ecx ebx ebp edi r10d r11d r12d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B8.19:                        # Preds ..B8.18 ..B8.17
-        testl     %r11d, %r11d                                  #2933.32
-        je        ..B8.21       # Prob 50%                      #2933.32
-                                # LOE rsi r8 r14 eax edx ecx ebx ebp edi r10d r12d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B8.20:                        # Preds ..B8.19
-        lea       1(%rbx,%r12), %r9d                            #2933.43
-        cmpl      %r9d, %r15d                                   #2933.49
-        jae       ..B8.43       # Prob 20%                      #2933.49
-                                # LOE rsi r8 r14 eax edx ecx ebx ebp edi r10d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B8.21:                        # Preds ..B8.20 ..B8.19
-        testl     %r10d, %r10d                                  #2934.32
-        je        ..B8.23       # Prob 50%                      #2934.32
-                                # LOE rsi r8 r14 eax edx ecx ebx ebp edi r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B8.22:                        # Preds ..B8.21
-        lea       2(%rbx,%rdx), %edx                            #2934.43
-        cmpl      %edx, %r15d                                   #2934.49
-        jae       ..B8.43       # Prob 20%                      #2934.49
-                                # LOE rsi r8 r14 eax ecx ebx ebp edi r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B8.23:                        # Preds ..B8.22 ..B8.21
-        testl     %ebp, %ebp                                    #2935.32
-        je        ..B8.25       # Prob 50%                      #2935.32
-                                # LOE rsi r8 r14 eax ecx ebx edi r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B8.24:                        # Preds ..B8.23
-        lea       3(%rbx,%rax), %eax                            #2935.43
-        cmpl      %eax, %r15d                                   #2935.49
-        jae       ..B8.43       # Prob 20%                      #2935.49
-                                # LOE rsi r8 r14 ecx ebx edi r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B8.25:                        # Preds ..B8.24 ..B8.23 ..B8.16
-        lea       4(%rbx), %edx                                 #2940.17
-        cmpl      %r15d, %edx                                   #2943.28
-        ja        ..B8.40       # Prob 20%                      #2943.28
-                                # LOE rsi r8 r14 edx ecx ebx edi r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B8.26:                        # Preds ..B8.25
-        decl      %edi                                          #2947.25
-        jne       ..B8.35       # Prob 50%                      #2947.39
-                                # LOE rsi r8 r14 edx ecx ebx edi r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B8.27:                        # Preds ..B8.26
-        cmpq      %r14, %r8                                     #2968.25
-        jae       ..B8.40       # Prob 4%                       #2968.25
-                                # LOE r8 r14 ecx ebx r15d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B8.28:                        # Preds ..B8.27
-        lea       52(%rbx), %edx                                #2972.13
-        cmpl      %r15d, %edx                                   #2973.24
-        ja        ..B8.40       # Prob 4%                       #2973.24
-                                # LOE r8 r14 edx ecx r15d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B8.29:                        # Preds ..B8.28
-        testq     $15, %r8                                      #2978.22
-        jne       ..B8.31       # Prob 50%                      #2978.22
-                                # LOE r8 r14 edx ecx r15d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B8.30:                        # Preds ..B8.29
-        movdqa    (%r8), %xmm0                                  #2978.22
-        jmp       ..B8.32       # Prob 100%                     #2978.22
-                                # LOE r8 r14 edx ecx r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B8.31:                        # Preds ..B8.29
-        movdqu    (%r8), %xmm0                                  #2978.22
-                                # LOE r8 r14 edx ecx r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B8.32:                        # Preds ..B8.30 ..B8.31
-        addq      $16, %r8                                      #3056.13
-        movq      %r8, %rsi                                     #3056.13
-        cmpq      %r14, %r8                                     #3059.24
-        jae       ..B8.34       # Prob 12%                      #3059.24
-                                # LOE rsi r8 r14 edx ecx r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B8.33:                        # Preds ..B8.32
-        movzbl    -1(%r8), %ecx                                 #3060.32
-        shll      $8, %ecx                                      #3060.46
-                                # LOE rsi r8 r14 edx ecx r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B8.34:                        # Preds ..B8.9 ..B8.32 ..B8.33
-        movl      $4, %edi                                      #2861.13
-        jmp       ..B8.38       # Prob 100%                     #2861.13
-                                # LOE rsi r8 r14 edx ecx edi r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B8.35:                        # Preds ..B8.26
-        psrldq    $1, %xmm0                                     #2952.26
-        cmpq      %r14, %rsi                                    #2955.26
-        jae       ..B8.37       # Prob 19%                      #2955.26
-                                # LOE rsi r8 r14 edx ecx edi r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B8.36:                        # Preds ..B8.35
-        movzbl    (%rsi), %eax                                  #2958.37
-        sarl      $8, %ecx                                      #2957.21
-        shll      $8, %eax                                      #2958.48
-        orl       %eax, %ecx                                    #2958.21
-        pinsrw    $7, %ecx, %xmm0                               #2959.30
-                                # LOE rsi r8 r14 edx ecx edi r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B8.37:                        # Preds ..B8.36 ..B8.35
-        incq      %rsi                                          #2963.20
-                                # LOE rsi r8 r14 edx ecx edi r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B8.38:                        # Preds ..B8.6 ..B8.34 ..B8.37
-        movdqa    %xmm0, %xmm9                                  #2871.22
-        pand      %xmm7, %xmm9                                  #2871.22
-        pcmpeqd   %xmm8, %xmm9                                  #2872.22
-        pmovmskb  %xmm9, %r9d                                   #2873.22
-        jmp       ..B8.14       # Prob 100%                     #2873.22
-                                # LOE rsi r8 r14 edx ecx edi r9d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B8.40:                        # Preds ..B8.25 ..B8.27 ..B8.28 # Infreq
-        xorl      %eax, %eax                                    #3069.12
-..___tag_value_eval_2na_32.483:                                 #3069.12
-        popq      %rbx                                          #3069.12
-..___tag_value_eval_2na_32.485:                                 #
-        popq      %rbp                                          #3069.12
-..___tag_value_eval_2na_32.487:                                 #
-        popq      %r12                                          #3069.12
-..___tag_value_eval_2na_32.489:                                 #
-        popq      %r13                                          #3069.12
-..___tag_value_eval_2na_32.491:                                 #
-        popq      %r14                                          #3069.12
-..___tag_value_eval_2na_32.493:                                 #
-        popq      %r15                                          #3069.12
-..___tag_value_eval_2na_32.495:                                 #
-        ret                                                     #3069.12
-..___tag_value_eval_2na_32.496:                                 #
-                                # LOE
-..B8.43:                        # Preds ..B8.22 ..B8.20 ..B8.18 ..B8.24 # Infreq
-        movl      $1, %eax                                      #2935.63
-..___tag_value_eval_2na_32.503:                                 #2935.63
-        popq      %rbx                                          #2935.63
-..___tag_value_eval_2na_32.505:                                 #
-        popq      %rbp                                          #2935.63
-..___tag_value_eval_2na_32.507:                                 #
-        popq      %r12                                          #2935.63
-..___tag_value_eval_2na_32.509:                                 #
-        popq      %r13                                          #2935.63
-..___tag_value_eval_2na_32.511:                                 #
-        popq      %r14                                          #2935.63
-..___tag_value_eval_2na_32.513:                                 #
-        popq      %r15                                          #2935.63
-..___tag_value_eval_2na_32.515:                                 #
-        ret                                                     #2935.63
-        .align    16,0x90
-..___tag_value_eval_2na_32.516:                                 #
-                                # LOE
-# mark_end;
-	.type	eval_2na_32, at function
-	.size	eval_2na_32,.-eval_2na_32
-	.data
-# -- End  eval_2na_32
-	.text
-# -- Begin  eval_2na_16
-# mark_begin;
-       .align    16,0x90
-eval_2na_16:
-# parameter 1: %rdi
-# parameter 2: %rsi
-# parameter 3: %edx
-# parameter 4: %ecx
-..B9.1:                         # Preds ..B9.0
-..___tag_value_eval_2na_16.517:                                 #2489.1
-        pushq     %r15                                          #2489.1
-..___tag_value_eval_2na_16.519:                                 #
-        pushq     %r14                                          #2489.1
-..___tag_value_eval_2na_16.521:                                 #
-        pushq     %r13                                          #2489.1
-..___tag_value_eval_2na_16.523:                                 #
-        pushq     %r12                                          #2489.1
-..___tag_value_eval_2na_16.525:                                 #
-        pushq     %rbp                                          #2489.1
-..___tag_value_eval_2na_16.527:                                 #
-        pushq     %rbx                                          #2489.1
-..___tag_value_eval_2na_16.529:                                 #
-        lea       (%rdx,%rcx), %r15d                            #2526.5
-        movl      %edx, %eax                                    #2529.49
-        shrl      $2, %eax                                      #2529.49
-        subl      4(%rdi), %r15d                                #2532.12
-        lea       (%rsi,%rax), %r8                              #2529.30
-        lea       3(%rdx,%rcx), %r14d                           #2535.50
-        shrl      $2, %r14d                                     #2535.57
-        addq      %rsi, %r14                                    #2535.30
-        testq     $15, %r8                                      #2538.14
-        jne       ..B9.3        # Prob 50%                      #2538.14
-                                # LOE rax rbx rbp rsi rdi r8 r12 r13 r14 edx r15d
-..B9.2:                         # Preds ..B9.1
-        movdqa    (%r8), %xmm0                                  #2538.14
-        jmp       ..B9.4        # Prob 100%                     #2538.14
-                                # LOE rax rbx rbp rsi rdi r12 r13 r14 edx r15d xmm0
-..B9.3:                         # Preds ..B9.1
-        movdqu    (%r8), %xmm0                                  #2538.14
-                                # LOE rax rbx rbp rsi rdi r12 r13 r14 edx r15d xmm0
-..B9.4:                         # Preds ..B9.2 ..B9.3
-        lea       16(%rsi,%rax), %r8                            #2539.5
-        movq      %r8, %rsi                                     #2539.5
-        cmpq      %r14, %r8                                     #2544.16
-        jae       ..B9.6        # Prob 12%                      #2544.16
-                                # LOE rbx rbp rsi rdi r8 r12 r13 r14 edx ecx r15d xmm0
-..B9.5:                         # Preds ..B9.4
-        movzbl    -1(%r8), %ecx                                 #2545.24
-        shll      $8, %ecx                                      #2545.38
-                                # LOE rbx rbp rsi rdi r8 r12 r13 r14 edx ecx r15d xmm0
-..B9.6:                         # Preds ..B9.5 ..B9.4
-        movdqa    16(%rdi), %xmm8                               #2549.5
-        movdqa    32(%rdi), %xmm7                               #2549.5
-        movdqa    48(%rdi), %xmm6                               #2549.5
-        movdqa    64(%rdi), %xmm5                               #2549.5
-        movdqa    80(%rdi), %xmm4                               #2549.5
-        movdqa    96(%rdi), %xmm3                               #2549.5
-        movdqa    112(%rdi), %xmm2                              #2549.5
-        movdqa    128(%rdi), %xmm1                              #2549.5
-        xorl      %r10d, %r10d                                  #2552.15
-        xorl      %r11d, %r11d                                  #2552.10
-        xorl      %r9d, %r9d                                    #2552.5
-        movl      $2, %edi                                      #2556.5
-        movl      %edx, %eax                                    #2561.20
-        andl      $3, %eax                                      #2561.20
-        je        ..B9.38       # Prob 20%                      #2561.20
-                                # LOE rbx rbp rsi r8 r12 r13 r14 eax edx ecx edi r9d r10d r11d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.7:                         # Preds ..B9.6
-        cmpl      $1, %eax                                      #2561.20
-        je        ..B9.14       # Prob 25%                      #2561.20
-                                # LOE rbx rbp rsi r8 r12 r13 r14 eax edx ecx edi r9d r10d r11d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.8:                         # Preds ..B9.7
-        cmpl      $2, %eax                                      #2561.20
-        je        ..B9.15       # Prob 33%                      #2561.20
-                                # LOE rbx rbp rsi r8 r12 r13 r14 eax edx ecx edi r9d r10d r11d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.9:                         # Preds ..B9.8
-        cmpl      $3, %eax                                      #2561.20
-        je        ..B9.16       # Prob 50%                      #2561.20
-        jmp       ..B9.34       # Prob 100%                     #2561.20
-                                # LOE rbx rbp rsi r8 r12 r13 r14 edx ecx edi r9d r10d r11d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.14:                        # Preds ..B9.7 ..B9.38
-        movdqa    %xmm0, %xmm9                                  #2584.22
-        pand      %xmm5, %xmm9                                  #2584.22
-        pcmpeqw   %xmm6, %xmm9                                  #2585.22
-        pmovmskb  %xmm9, %r11d                                  #2586.22
-                                # LOE rsi r8 r14 edx ecx edi r9d r11d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.15:                        # Preds ..B9.8 ..B9.14
-        movdqa    %xmm0, %xmm9                                  #2590.22
-        pand      %xmm3, %xmm9                                  #2590.22
-        pcmpeqw   %xmm4, %xmm9                                  #2591.22
-        pmovmskb  %xmm9, %r10d                                  #2592.22
-                                # LOE rsi r8 r14 edx ecx edi r9d r10d r11d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.16:                        # Preds ..B9.9 ..B9.15
-        movdqa    %xmm0, %xmm9                                  #2596.22
-        movl      %edx, %ebx                                    #2603.17
-        andl      $-4, %ebx                                     #2603.17
-        pand      %xmm1, %xmm9                                  #2596.22
-        pcmpeqw   %xmm2, %xmm9                                  #2597.22
-        pmovmskb  %xmm9, %ebp                                   #2598.22
-        movl      %r9d, %edx                                    #2606.29
-        orl       %r11d, %edx                                   #2606.29
-        orl       %r10d, %edx                                   #2606.34
-        orl       %ebp, %edx                                    #2606.39
-        je        ..B9.25       # Prob 78%                      #2606.47
-                                # LOE rsi r8 r14 ecx ebx ebp edi r9d r10d r11d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.17:                        # Preds ..B9.16
-        movl      %r9d, %eax                                    #2624.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+6;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2624.30
-        movswq    %ax, %r13                                     #2624.30
-        movl      %r11d, %eax                                   #2625.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+6;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2625.30
-        movswq    %ax, %r12                                     #2625.30
-        movl      %r10d, %eax                                   #2626.30
-        shll      $2, %r13d                                     #2632.34
-        shll      $2, %r12d                                     #2633.34
-# Begin ASM
-        bsf %ax, %ax;jnz .+6;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2626.30
-        movswq    %ax, %rdx                                     #2626.30
-        movl      %ebp, %eax                                    #2627.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+6;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2627.30
-        movswq    %ax, %rax                                     #2627.30
-        shll      $2, %edx                                      #2634.34
-        shll      $2, %eax                                      #2635.34
-        testl     %r9d, %r9d                                    #2639.32
-        je        ..B9.19       # Prob 50%                      #2639.32
-                                # LOE rsi r8 r14 eax edx ecx ebx ebp edi r10d r11d r12d r13d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.18:                        # Preds ..B9.17
-        addl      %ebx, %r13d                                   #2639.43
-        cmpl      %r13d, %r15d                                  #2639.49
-        jae       ..B9.43       # Prob 20%                      #2639.49
-                                # LOE rsi r8 r14 eax edx ecx ebx ebp edi r10d r11d r12d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.19:                        # Preds ..B9.18 ..B9.17
-        testl     %r11d, %r11d                                  #2640.32
-        je        ..B9.21       # Prob 50%                      #2640.32
-                                # LOE rsi r8 r14 eax edx ecx ebx ebp edi r10d r12d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.20:                        # Preds ..B9.19
-        lea       1(%rbx,%r12), %r9d                            #2640.43
-        cmpl      %r9d, %r15d                                   #2640.49
-        jae       ..B9.43       # Prob 20%                      #2640.49
-                                # LOE rsi r8 r14 eax edx ecx ebx ebp edi r10d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.21:                        # Preds ..B9.20 ..B9.19
-        testl     %r10d, %r10d                                  #2641.32
-        je        ..B9.23       # Prob 50%                      #2641.32
-                                # LOE rsi r8 r14 eax edx ecx ebx ebp edi r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.22:                        # Preds ..B9.21
-        lea       2(%rbx,%rdx), %edx                            #2641.43
-        cmpl      %edx, %r15d                                   #2641.49
-        jae       ..B9.43       # Prob 20%                      #2641.49
-                                # LOE rsi r8 r14 eax ecx ebx ebp edi r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.23:                        # Preds ..B9.22 ..B9.21
-        testl     %ebp, %ebp                                    #2642.32
-        je        ..B9.25       # Prob 50%                      #2642.32
-                                # LOE rsi r8 r14 eax ecx ebx edi r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.24:                        # Preds ..B9.23
-        lea       3(%rbx,%rax), %eax                            #2642.43
-        cmpl      %eax, %r15d                                   #2642.49
-        jae       ..B9.43       # Prob 20%                      #2642.49
-                                # LOE rsi r8 r14 ecx ebx edi r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.25:                        # Preds ..B9.24 ..B9.23 ..B9.16
-        lea       4(%rbx), %edx                                 #2647.17
-        cmpl      %r15d, %edx                                   #2650.28
-        ja        ..B9.40       # Prob 20%                      #2650.28
-                                # LOE rsi r8 r14 edx ecx ebx edi r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.26:                        # Preds ..B9.25
-        decl      %edi                                          #2654.25
-        jne       ..B9.35       # Prob 50%                      #2654.39
-                                # LOE rsi r8 r14 edx ecx ebx edi r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.27:                        # Preds ..B9.26
-        cmpq      %r14, %r8                                     #2675.25
-        jae       ..B9.40       # Prob 4%                       #2675.25
-                                # LOE r8 r14 ecx ebx r15d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.28:                        # Preds ..B9.27
-        lea       60(%rbx), %edx                                #2679.13
-        cmpl      %r15d, %edx                                   #2680.24
-        ja        ..B9.40       # Prob 4%                       #2680.24
-                                # LOE r8 r14 edx ecx r15d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.29:                        # Preds ..B9.28
-        testq     $15, %r8                                      #2685.22
-        jne       ..B9.31       # Prob 50%                      #2685.22
-                                # LOE r8 r14 edx ecx r15d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.30:                        # Preds ..B9.29
-        movdqa    (%r8), %xmm0                                  #2685.22
-        jmp       ..B9.32       # Prob 100%                     #2685.22
-                                # LOE r8 r14 edx ecx r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.31:                        # Preds ..B9.29
-        movdqu    (%r8), %xmm0                                  #2685.22
-                                # LOE r8 r14 edx ecx r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.32:                        # Preds ..B9.30 ..B9.31
-        addq      $16, %r8                                      #2763.13
-        movq      %r8, %rsi                                     #2763.13
-        cmpq      %r14, %r8                                     #2766.24
-        jae       ..B9.34       # Prob 12%                      #2766.24
-                                # LOE rsi r8 r14 edx ecx r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.33:                        # Preds ..B9.32
-        movzbl    -1(%r8), %ecx                                 #2767.32
-        shll      $8, %ecx                                      #2767.46
-                                # LOE rsi r8 r14 edx ecx r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.34:                        # Preds ..B9.9 ..B9.32 ..B9.33
-        movl      $2, %edi                                      #2568.13
-        jmp       ..B9.38       # Prob 100%                     #2568.13
-                                # LOE rsi r8 r14 edx ecx edi r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.35:                        # Preds ..B9.26
-        psrldq    $1, %xmm0                                     #2659.26
-        cmpq      %r14, %rsi                                    #2662.26
-        jae       ..B9.37       # Prob 19%                      #2662.26
-                                # LOE rsi r8 r14 edx ecx edi r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.36:                        # Preds ..B9.35
-        movzbl    (%rsi), %eax                                  #2665.37
-        sarl      $8, %ecx                                      #2664.21
-        shll      $8, %eax                                      #2665.48
-        orl       %eax, %ecx                                    #2665.21
-        pinsrw    $7, %ecx, %xmm0                               #2666.30
-                                # LOE rsi r8 r14 edx ecx edi r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.37:                        # Preds ..B9.36 ..B9.35
-        incq      %rsi                                          #2670.20
-                                # LOE rsi r8 r14 edx ecx edi r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.38:                        # Preds ..B9.6 ..B9.34 ..B9.37
-        movdqa    %xmm0, %xmm9                                  #2578.22
-        pand      %xmm7, %xmm9                                  #2578.22
-        pcmpeqw   %xmm8, %xmm9                                  #2579.22
-        pmovmskb  %xmm9, %r9d                                   #2580.22
-        jmp       ..B9.14       # Prob 100%                     #2580.22
-                                # LOE rsi r8 r14 edx ecx edi r9d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B9.40:                        # Preds ..B9.25 ..B9.27 ..B9.28 # Infreq
-        xorl      %eax, %eax                                    #2776.12
-..___tag_value_eval_2na_16.532:                                 #2776.12
-        popq      %rbx                                          #2776.12
-..___tag_value_eval_2na_16.534:                                 #
-        popq      %rbp                                          #2776.12
-..___tag_value_eval_2na_16.536:                                 #
-        popq      %r12                                          #2776.12
-..___tag_value_eval_2na_16.538:                                 #
-        popq      %r13                                          #2776.12
-..___tag_value_eval_2na_16.540:                                 #
-        popq      %r14                                          #2776.12
-..___tag_value_eval_2na_16.542:                                 #
-        popq      %r15                                          #2776.12
-..___tag_value_eval_2na_16.544:                                 #
-        ret                                                     #2776.12
-..___tag_value_eval_2na_16.545:                                 #
-                                # LOE
-..B9.43:                        # Preds ..B9.22 ..B9.20 ..B9.18 ..B9.24 # Infreq
-        movl      $1, %eax                                      #2642.63
-..___tag_value_eval_2na_16.552:                                 #2642.63
-        popq      %rbx                                          #2642.63
-..___tag_value_eval_2na_16.554:                                 #
-        popq      %rbp                                          #2642.63
-..___tag_value_eval_2na_16.556:                                 #
-        popq      %r12                                          #2642.63
-..___tag_value_eval_2na_16.558:                                 #
-        popq      %r13                                          #2642.63
-..___tag_value_eval_2na_16.560:                                 #
-        popq      %r14                                          #2642.63
-..___tag_value_eval_2na_16.562:                                 #
-        popq      %r15                                          #2642.63
-..___tag_value_eval_2na_16.564:                                 #
-        ret                                                     #2642.63
-        .align    16,0x90
-..___tag_value_eval_2na_16.565:                                 #
-                                # LOE
-# mark_end;
-	.type	eval_2na_16, at function
-	.size	eval_2na_16,.-eval_2na_16
-	.data
-# -- End  eval_2na_16
-	.text
-# -- Begin  eval_2na_8
-# mark_begin;
-       .align    16,0x90
-eval_2na_8:
-# parameter 1: %rdi
-# parameter 2: %rsi
-# parameter 3: %edx
-# parameter 4: %ecx
-..B10.1:                        # Preds ..B10.0
-..___tag_value_eval_2na_8.566:                                  #2196.1
-        pushq     %r13                                          #2196.1
-..___tag_value_eval_2na_8.568:                                  #
-        pushq     %r12                                          #2196.1
-..___tag_value_eval_2na_8.570:                                  #
-        pushq     %rbx                                          #2196.1
-..___tag_value_eval_2na_8.572:                                  #
-        lea       (%rdx,%rcx), %r10d                            #2233.5
-        movl      %edx, %eax                                    #2236.49
-        shrl      $2, %eax                                      #2236.49
-        subl      4(%rdi), %r10d                                #2239.12
-        lea       (%rsi,%rax), %r8                              #2236.30
-        lea       3(%rdx,%rcx), %r9d                            #2242.50
-        shrl      $2, %r9d                                      #2242.57
-        addq      %rsi, %r9                                     #2242.30
-        testq     $15, %r8                                      #2245.14
-        jne       ..B10.3       # Prob 50%                      #2245.14
-                                # LOE rax rbx rbp rsi rdi r8 r9 r12 r13 r14 r15 edx r10d
-..B10.2:                        # Preds ..B10.1
-        movdqa    (%r8), %xmm0                                  #2245.14
-        jmp       ..B10.4       # Prob 100%                     #2245.14
-                                # LOE rax rbx rbp rsi rdi r9 r12 r13 r14 r15 edx r10d xmm0
-..B10.3:                        # Preds ..B10.1
-        movdqu    (%r8), %xmm0                                  #2245.14
-                                # LOE rax rbx rbp rsi rdi r9 r12 r13 r14 r15 edx r10d xmm0
-..B10.4:                        # Preds ..B10.2 ..B10.3
-        movdqa    16(%rdi), %xmm8                               #2256.5
-        movdqa    32(%rdi), %xmm7                               #2256.5
-        movdqa    48(%rdi), %xmm6                               #2256.5
-        movdqa    64(%rdi), %xmm5                               #2256.5
-        movdqa    80(%rdi), %xmm4                               #2256.5
-        movdqa    96(%rdi), %xmm3                               #2256.5
-        movdqa    112(%rdi), %xmm2                              #2256.5
-        movdqa    128(%rdi), %xmm1                              #2256.5
-        lea       16(%rsi,%rax), %rcx                           #2246.5
-        xorl      %edi, %edi                                    #2259.15
-        xorl      %r8d, %r8d                                    #2259.10
-        xorl      %esi, %esi                                    #2259.5
-        movl      %edx, %r11d                                   #2268.20
-        andl      $3, %r11d                                     #2268.20
-        je        ..B10.30      # Prob 20%                      #2268.20
-                                # LOE rcx rbx rbp r9 r12 r13 r14 r15 edx esi edi r8d r10d r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.5:                        # Preds ..B10.4
-        cmpl      $1, %r11d                                     #2268.20
-        je        ..B10.12      # Prob 25%                      #2268.20
-                                # LOE rcx rbx rbp r9 r12 r13 r14 r15 edx esi edi r8d r10d r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.6:                        # Preds ..B10.5
-        cmpl      $2, %r11d                                     #2268.20
-        je        ..B10.13      # Prob 33%                      #2268.20
-                                # LOE rcx rbx rbp r9 r12 r13 r14 r15 edx esi edi r8d r10d r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.7:                        # Preds ..B10.6
-        cmpl      $3, %r11d                                     #2268.20
-        je        ..B10.14      # Prob 50%                      #2268.20
-        jmp       ..B10.30      # Prob 100%                     #2268.20
-                                # LOE rcx rbx rbp r9 r12 r13 r14 r15 edx esi edi r8d r10d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.12:                       # Preds ..B10.5 ..B10.30
-        movdqa    %xmm0, %xmm9                                  #2291.22
-        pand      %xmm5, %xmm9                                  #2291.22
-        pcmpeqb   %xmm6, %xmm9                                  #2292.22
-        pmovmskb  %xmm9, %r8d                                   #2293.22
-                                # LOE rcx rbp r9 r14 r15 edx esi r8d r10d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.13:                       # Preds ..B10.6 ..B10.12
-        movdqa    %xmm0, %xmm9                                  #2297.22
-        pand      %xmm3, %xmm9                                  #2297.22
-        pcmpeqb   %xmm4, %xmm9                                  #2298.22
-        pmovmskb  %xmm9, %edi                                   #2299.22
-                                # LOE rcx rbp r9 r14 r15 edx esi edi r8d r10d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.14:                       # Preds ..B10.7 ..B10.13
-        pand      %xmm1, %xmm0                                  #2303.22
-        pcmpeqb   %xmm2, %xmm0                                  #2304.22
-        pmovmskb  %xmm0, %r12d                                  #2305.22
-        andl      $-4, %edx                                     #2310.17
-        movl      %esi, %ebx                                    #2313.29
-        orl       %r8d, %ebx                                    #2313.29
-        orl       %edi, %ebx                                    #2313.34
-        orl       %r12d, %ebx                                   #2313.39
-        je        ..B10.23      # Prob 78%                      #2313.47
-                                # LOE rcx rbp r9 r14 r15 edx esi edi r8d r10d r12d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.15:                       # Preds ..B10.14
-        movl      %esi, %eax                                    #2331.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+6;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2331.30
-        movswq    %ax, %r13                                     #2331.30
-        movl      %r8d, %eax                                    #2332.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+6;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2332.30
-        movswq    %ax, %r11                                     #2332.30
-        movl      %edi, %eax                                    #2333.30
-        shll      $2, %r13d                                     #2339.34
-        shll      $2, %r11d                                     #2340.34
-# Begin ASM
-        bsf %ax, %ax;jnz .+6;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2333.30
-        movswq    %ax, %rbx                                     #2333.30
-        movl      %r12d, %eax                                   #2334.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+6;xor %eax, %eax;dec %eax;
-# End ASM                                                       #2334.30
-        movswq    %ax, %rax                                     #2334.30
-        shll      $2, %ebx                                      #2341.34
-        shll      $2, %eax                                      #2342.34
-        testl     %esi, %esi                                    #2346.32
-        je        ..B10.17      # Prob 50%                      #2346.32
-                                # LOE rcx rbp r9 r14 r15 eax edx ebx edi r8d r10d r11d r12d r13d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.16:                       # Preds ..B10.15
-        addl      %edx, %r13d                                   #2346.43
-        cmpl      %r13d, %r10d                                  #2346.49
-        jae       ..B10.35      # Prob 20%                      #2346.49
-                                # LOE rcx rbp r9 r14 r15 eax edx ebx edi r8d r10d r11d r12d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.17:                       # Preds ..B10.16 ..B10.15
-        testl     %r8d, %r8d                                    #2347.32
-        je        ..B10.19      # Prob 50%                      #2347.32
-                                # LOE rcx rbp r9 r14 r15 eax edx ebx edi r10d r11d r12d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.18:                       # Preds ..B10.17
-        lea       1(%rdx,%r11), %esi                            #2347.43
-        cmpl      %esi, %r10d                                   #2347.49
-        jae       ..B10.35      # Prob 20%                      #2347.49
-                                # LOE rcx rbp r9 r14 r15 eax edx ebx edi r10d r12d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.19:                       # Preds ..B10.18 ..B10.17
-        testl     %edi, %edi                                    #2348.32
-        je        ..B10.21      # Prob 50%                      #2348.32
-                                # LOE rcx rbp r9 r14 r15 eax edx ebx r10d r12d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.20:                       # Preds ..B10.19
-        lea       2(%rdx,%rbx), %ebx                            #2348.43
-        cmpl      %ebx, %r10d                                   #2348.49
-        jae       ..B10.35      # Prob 20%                      #2348.49
-                                # LOE rcx rbp r9 r14 r15 eax edx r10d r12d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.21:                       # Preds ..B10.20 ..B10.19
-        testl     %r12d, %r12d                                  #2349.32
-        je        ..B10.23      # Prob 50%                      #2349.32
-                                # LOE rcx rbp r9 r14 r15 eax edx r10d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.22:                       # Preds ..B10.21
-        lea       3(%rdx,%rax), %eax                            #2349.43
-        cmpl      %eax, %r10d                                   #2349.49
-        jae       ..B10.35      # Prob 20%                      #2349.49
-                                # LOE rcx rbp r9 r14 r15 edx r10d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.23:                       # Preds ..B10.22 ..B10.21 ..B10.14
-        lea       4(%rdx), %eax                                 #2386.13
-        cmpl      %eax, %r10d                                   #2357.28
-        jb        ..B10.32      # Prob 20%                      #2357.28
-                                # LOE rcx rbp r9 r14 r15 edx r10d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.24:                       # Preds ..B10.23
-        cmpq      %r9, %rcx                                     #2382.25
-        jae       ..B10.32      # Prob 4%                       #2382.25
-                                # LOE rcx rbp r9 r14 r15 edx r10d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.25:                       # Preds ..B10.24
-        addl      $64, %edx                                     #2386.13
-        cmpl      %r10d, %edx                                   #2387.24
-        ja        ..B10.32      # Prob 4%                       #2387.24
-                                # LOE rcx rbp r9 r14 r15 edx r10d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.26:                       # Preds ..B10.25
-        testq     $15, %rcx                                     #2392.22
-        jne       ..B10.28      # Prob 50%                      #2392.22
-                                # LOE rcx rbp r9 r14 r15 edx r10d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.27:                       # Preds ..B10.26
-        movdqa    (%rcx), %xmm0                                 #2392.22
-        jmp       ..B10.29      # Prob 100%                     #2392.22
-                                # LOE rcx rbp r9 r14 r15 edx r10d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.28:                       # Preds ..B10.26
-        movdqu    (%rcx), %xmm0                                 #2392.22
-                                # LOE rcx rbp r9 r14 r15 edx r10d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.29:                       # Preds ..B10.27 ..B10.28
-        addq      $16, %rcx                                     #2470.13
-                                # LOE rcx rbp r9 r14 r15 edx r10d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.30:                       # Preds ..B10.4 ..B10.7 ..B10.29
-        movdqa    %xmm0, %xmm9                                  #2285.22
-        pand      %xmm7, %xmm9                                  #2285.22
-        pcmpeqb   %xmm8, %xmm9                                  #2286.22
-        pmovmskb  %xmm9, %esi                                   #2287.22
-        jmp       ..B10.12      # Prob 100%                     #2287.22
-                                # LOE rcx rbp r9 r14 r15 edx esi r10d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B10.32:                       # Preds ..B10.23 ..B10.24 ..B10.25 # Infreq
-        xorl      %eax, %eax                                    #2483.12
-..___tag_value_eval_2na_8.575:                                  #2483.12
-        popq      %rbx                                          #2483.12
-..___tag_value_eval_2na_8.576:                                  #
-        popq      %r12                                          #2483.12
-..___tag_value_eval_2na_8.578:                                  #
-        popq      %r13                                          #2483.12
-..___tag_value_eval_2na_8.580:                                  #
-        ret                                                     #2483.12
-..___tag_value_eval_2na_8.581:                                  #
-                                # LOE
-..B10.35:                       # Preds ..B10.22 ..B10.20 ..B10.18 ..B10.16 # Infreq
-        movl      $1, %eax                                      #2346.63
-..___tag_value_eval_2na_8.585:                                  #2346.63
-        popq      %rbx                                          #2346.63
-..___tag_value_eval_2na_8.586:                                  #
-        popq      %r12                                          #2346.63
-..___tag_value_eval_2na_8.588:                                  #
-        popq      %r13                                          #2346.63
-..___tag_value_eval_2na_8.590:                                  #
-        ret                                                     #2346.63
-        .align    16,0x90
-..___tag_value_eval_2na_8.591:                                  #
-                                # LOE
-# mark_end;
-	.type	eval_2na_8, at function
-	.size	eval_2na_8,.-eval_2na_8
-	.data
-# -- End  eval_2na_8
-	.text
-# -- Begin  eval_4na_64
-# mark_begin;
-       .align    16,0x90
-eval_4na_64:
-# parameter 1: %rdi
-# parameter 2: %rsi
-# parameter 3: %edx
-# parameter 4: %ecx
-..B11.1:                        # Preds ..B11.0
-..___tag_value_eval_4na_64.592:                                 #4501.1
-        pushq     %r15                                          #4501.1
-..___tag_value_eval_4na_64.594:                                 #
-        pushq     %r14                                          #4501.1
-..___tag_value_eval_4na_64.596:                                 #
-        pushq     %r13                                          #4501.1
-..___tag_value_eval_4na_64.598:                                 #
-        pushq     %r12                                          #4501.1
-..___tag_value_eval_4na_64.600:                                 #
-        pushq     %rbx                                          #4501.1
-..___tag_value_eval_4na_64.602:                                 #
-        movdqa    16(%rdi), %xmm8                               #4554.5
-        movdqa    32(%rdi), %xmm7                               #4554.5
-        movdqa    48(%rdi), %xmm6                               #4554.5
-        movdqa    64(%rdi), %xmm5                               #4554.5
-        movdqa    80(%rdi), %xmm4                               #4554.5
-        movdqa    96(%rdi), %xmm3                               #4554.5
-        movdqa    112(%rdi), %xmm2                              #4554.5
-        movdqa    128(%rdi), %xmm1                              #4554.5
-        lea       (%rdx,%rcx), %r11d                            #4535.5
-        movl      %edx, %ebx                                    #4538.49
-        shrl      $2, %ebx                                      #4538.49
-        subl      4(%rdi), %r11d                                #4541.12
-        movzbl    (%rbx,%rsi), %eax                             #4547.14
-        movzbl    1(%rbx,%rsi), %r9d                            #4547.14
-        lea       3(%rdx,%rcx), %r10d                           #4544.50
-        shrl      $2, %r10d                                     #4544.57
-        addq      %rsi, %r10                                    #4544.30
-        lea       expand_2na.0(%rip), %rcx                      #4547.14
-        movzwl    (%rcx,%rax,2), %r8d                           #4547.14
-        movzwl    (%rcx,%r9,2), %eax                            #4547.14
-        movw      %r8w, -16(%rsp)                               #4547.14
-        movzbl    2(%rbx,%rsi), %r8d                            #4547.14
-        movzwl    (%rcx,%r8,2), %r9d                            #4547.14
-        movw      %ax, -14(%rsp)                                #4547.14
-        movzbl    3(%rbx,%rsi), %eax                            #4547.14
-        movzwl    (%rcx,%rax,2), %r8d                           #4547.14
-        movw      %r9w, -12(%rsp)                               #4547.14
-        movzbl    4(%rbx,%rsi), %r9d                            #4547.14
-        movzwl    (%rcx,%r9,2), %eax                            #4547.14
-        movw      %r8w, -10(%rsp)                               #4547.14
-        movzbl    5(%rbx,%rsi), %r8d                            #4547.14
-        movzwl    (%rcx,%r8,2), %r9d                            #4547.14
-        movw      %ax, -8(%rsp)                                 #4547.14
-        movzbl    6(%rbx,%rsi), %eax                            #4547.14
-        movzwl    (%rcx,%rax,2), %r8d                           #4547.14
-        movw      %r9w, -6(%rsp)                                #4547.14
-        movzbl    7(%rbx,%rsi), %r9d                            #4547.14
-        movzwl    (%rcx,%r9,2), %ecx                            #4547.14
-        movw      %r8w, -4(%rsp)                                #4547.14
-        movl      %edx, %eax                                    #4568.20
-        lea       8(%rsi,%rbx), %rbx                            #4548.5
-        movw      %cx, -2(%rsp)                                 #4547.14
-        movdqu    -16(%rsp), %xmm0                              #4547.14
-        movq      %rbx, %rcx                                    #4548.5
-        xorl      %r8d, %r8d                                    #4557.15
-        xorl      %r9d, %r9d                                    #4557.10
-        xorl      %edi, %edi                                    #4557.5
-        movl      $4, %esi                                      #4563.5
-        andl      $3, %eax                                      #4568.20
-        je        ..B11.29      # Prob 20%                      #4568.20
-                                # LOE rcx rbx rbp r10 r12 r13 r14 r15 eax edx esi edi r8d r9d r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B11.2:                        # Preds ..B11.1
-        cmpl      $1, %eax                                      #4568.20
-        je        ..B11.9       # Prob 25%                      #4568.20
-                                # LOE rcx rbx rbp r10 r12 r13 r14 r15 eax edx esi edi r8d r9d r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B11.3:                        # Preds ..B11.2
-        cmpl      $2, %eax                                      #4568.20
-        je        ..B11.10      # Prob 33%                      #4568.20
-                                # LOE rcx rbx rbp r10 r12 r13 r14 r15 eax edx esi edi r8d r9d r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B11.4:                        # Preds ..B11.3
-        cmpl      $3, %eax                                      #4568.20
-        je        ..B11.11      # Prob 50%                      #4568.20
-        jmp       ..B11.25      # Prob 100%                     #4568.20
-                                # LOE rcx rbx rbp r10 r12 r13 r14 r15 edx esi edi r8d r9d r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B11.9:                        # Preds ..B11.2 ..B11.29
-        movdqa    %xmm0, %xmm10                                 #4592.22
-        movdqa    %xmm0, %xmm9                                  #4593.22
-        pand      %xmm6, %xmm10                                 #4592.22
-        pand      %xmm5, %xmm9                                  #4593.22
-        pcmpeqd   %xmm9, %xmm10                                 #4594.22
-        pmovmskb  %xmm10, %r9d                                  #4595.22
-        movl      %r9d, %r8d                                    #4596.17
-        andl      $3855, %r8d                                   #4596.17
-        shll      $4, %r8d                                      #4596.17
-        andl      %r8d, %r9d                                    #4596.17
-        movl      %r9d, %r12d                                   #4596.17
-        shrl      $4, %r12d                                     #4596.17
-        orl       %r12d, %r9d                                   #4596.17
-                                # LOE rcx rbx rbp r10 edx esi edi r9d r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B11.10:                       # Preds ..B11.3 ..B11.9
-        movdqa    %xmm0, %xmm10                                 #4599.22
-        movdqa    %xmm0, %xmm9                                  #4600.22
-        pand      %xmm4, %xmm10                                 #4599.22
-        pand      %xmm3, %xmm9                                  #4600.22
-        pcmpeqd   %xmm9, %xmm10                                 #4601.22
-        pmovmskb  %xmm10, %r8d                                  #4602.22
-        movl      %r8d, %r12d                                   #4603.17
-        andl      $3855, %r12d                                  #4603.17
-        shll      $4, %r12d                                     #4603.17
-        andl      %r12d, %r8d                                   #4603.17
-        movl      %r8d, %r13d                                   #4603.17
-        shrl      $4, %r13d                                     #4603.17
-        orl       %r13d, %r8d                                   #4603.17
-                                # LOE rcx rbx rbp r10 edx esi edi r8d r9d r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B11.11:                       # Preds ..B11.4 ..B11.10
-        movdqa    %xmm0, %xmm10                                 #4606.22
-        movdqa    %xmm0, %xmm9                                  #4607.22
-        pand      %xmm2, %xmm10                                 #4606.22
-        pand      %xmm1, %xmm9                                  #4607.22
-        pcmpeqd   %xmm9, %xmm10                                 #4608.22
-        pmovmskb  %xmm10, %r12d                                 #4609.22
-        movl      %r12d, %r13d                                  #4610.17
-        andl      $3855, %r13d                                  #4610.17
-        shll      $4, %r13d                                     #4610.17
-        andl      %r13d, %r12d                                  #4610.17
-        movl      %r12d, %r14d                                  #4610.17
-        shrl      $4, %r14d                                     #4610.17
-        orl       %r14d, %r12d                                  #4610.17
-        movl      %edx, %r13d                                   #4614.17
-        andl      $-4, %r13d                                    #4614.17
-        movl      %edi, %edx                                    #4617.29
-        orl       %r9d, %edx                                    #4617.29
-        orl       %r8d, %edx                                    #4617.34
-        orl       %r12d, %edx                                   #4617.39
-        je        ..B11.20      # Prob 78%                      #4617.47
-                                # LOE rcx rbx rbp r10 esi edi r8d r9d r11d r12d r13d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B11.12:                       # Preds ..B11.11
-        movl      %edi, %eax                                    #4635.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+6;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4635.30
-        movswq    %ax, %r15                                     #4635.30
-        movl      %r9d, %eax                                    #4636.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+6;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4636.30
-        movswq    %ax, %rdx                                     #4636.30
-        movl      %r8d, %eax                                    #4637.30
-        lea       1(%rdx,%rdx), %edx                            #4644.40
-# Begin ASM
-        bsf %ax, %ax;jnz .+6;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4637.30
-        movswq    %ax, %r14                                     #4637.30
-        movl      %r12d, %eax                                   #4638.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+6;xor %eax, %eax;dec %eax;
-# End ASM                                                       #4638.30
-        movswq    %ax, %rax                                     #4638.30
-        lea       2(%r14,%r14), %r14d                           #4645.40
-        lea       3(%rax,%rax), %eax                            #4646.40
-        testl     %edi, %edi                                    #4650.32
-        je        ..B11.14      # Prob 50%                      #4650.32
-                                # LOE rcx rbx rbp r10 eax edx esi r8d r9d r11d r12d r13d r14d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B11.13:                       # Preds ..B11.12
-        lea       (%r13,%r15,2), %edi                           #4650.43
-        cmpl      %edi, %r11d                                   #4650.49
-        jae       ..B11.34      # Prob 20%                      #4650.49
-                                # LOE rcx rbx rbp r10 eax edx esi r8d r9d r11d r12d r13d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B11.14:                       # Preds ..B11.13 ..B11.12
-        testl     %r9d, %r9d                                    #4651.32
-        je        ..B11.16      # Prob 50%                      #4651.32
-                                # LOE rcx rbx rbp r10 eax edx esi r8d r11d r12d r13d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B11.15:                       # Preds ..B11.14
-        addl      %r13d, %edx                                   #4651.43
-        cmpl      %edx, %r11d                                   #4651.49
-        jae       ..B11.34      # Prob 20%                      #4651.49
-                                # LOE rcx rbx rbp r10 eax esi r8d r11d r12d r13d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B11.16:                       # Preds ..B11.15 ..B11.14
-        testl     %r8d, %r8d                                    #4652.32
-        je        ..B11.18      # Prob 50%                      #4652.32
-                                # LOE rcx rbx rbp r10 eax esi r11d r12d r13d r14d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B11.17:                       # Preds ..B11.16
-        addl      %r13d, %r14d                                  #4652.43
-        cmpl      %r14d, %r11d                                  #4652.49
-        jae       ..B11.34      # Prob 20%                      #4652.49
-                                # LOE rcx rbx rbp r10 eax esi r11d r12d r13d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B11.18:                       # Preds ..B11.17 ..B11.16
-        testl     %r12d, %r12d                                  #4653.32
-        je        ..B11.20      # Prob 50%                      #4653.32
-                                # LOE rcx rbx rbp r10 eax esi r11d r13d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B11.19:                       # Preds ..B11.18
-        addl      %r13d, %eax                                   #4653.43
-        cmpl      %eax, %r11d                                   #4653.49
-        jae       ..B11.34      # Prob 20%                      #4653.49
-                                # LOE rcx rbx rbp r10 esi r11d r13d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B11.20:                       # Preds ..B11.19 ..B11.18 ..B11.11
-        lea       4(%r13), %edx                                 #4658.17
-        cmpl      %r11d, %edx                                   #4661.28
-        ja        ..B11.31      # Prob 20%                      #4661.28
-                                # LOE rcx rbx rbp r10 edx esi r11d r13d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B11.21:                       # Preds ..B11.20
-        decl      %esi                                          #4665.25
-        jne       ..B11.26      # Prob 50%                      #4665.39
-                                # LOE rcx rbx rbp r10 edx esi r11d r13d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B11.22:                       # Preds ..B11.21
-        cmpq      %r10, %rbx                                    #4682.25
-        jae       ..B11.31      # Prob 4%                       #4682.25
-                                # LOE rbx rbp r10 r11d r13d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B11.23:                       # Preds ..B11.22
-        lea       20(%r13), %edx                                #4686.13
-        cmpl      %r11d, %edx                                   #4687.24
-        ja        ..B11.31      # Prob 4%                       #4687.24
-                                # LOE rbx rbp r10 edx r11d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B11.24:                       # Preds ..B11.23
-        movzbl    (%rbx), %ecx                                  #4692.22
-        movzbl    1(%rbx), %edi                                 #4692.22
-        movzbl    2(%rbx), %r9d                                 #4692.22
-        movzbl    3(%rbx), %r13d                                #4692.22
-        movzbl    4(%rbx), %r15d                                #4692.22
-        lea       expand_2na.0(%rip), %rax                      #4692.22
-        movzwl    (%rax,%rcx,2), %esi                           #4692.22
-        movzwl    (%rax,%rdi,2), %r8d                           #4692.22
-        movzwl    (%rax,%r9,2), %r12d                           #4692.22
-        movzwl    (%rax,%r13,2), %r14d                          #4692.22
-        movzwl    (%rax,%r15,2), %ecx                           #4692.22
-        movw      %si, -16(%rsp)                                #4692.22
-        movzbl    5(%rbx), %esi                                 #4692.22
-        movzwl    (%rax,%rsi,2), %edi                           #4692.22
-        movw      %r8w, -14(%rsp)                               #4692.22
-        movzbl    6(%rbx), %r8d                                 #4692.22
-        movzwl    (%rax,%r8,2), %r9d                            #4692.22
-        movw      %r12w, -12(%rsp)                              #4692.22
-        movzbl    7(%rbx), %r12d                                #4692.22
-        movzwl    (%rax,%r12,2), %eax                           #4692.22
-        movw      %r14w, -10(%rsp)                              #4692.22
-        movw      %cx, -8(%rsp)                                 #4692.22
-        addq      $8, %rbx                                      #4707.13
-        movw      %di, -6(%rsp)                                 #4692.22
-        movq      %rbx, %rcx                                    #4707.13
-        movw      %r9w, -4(%rsp)                                #4692.22
-        movw      %ax, -2(%rsp)                                 #4692.22
-        movdqu    -16(%rsp), %xmm0                              #4692.22
-                                # LOE rcx rbx rbp r10 edx r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B11.25:                       # Preds ..B11.4 ..B11.24
-        movl      $4, %esi                                      #4575.13
-        jmp       ..B11.29      # Prob 100%                     #4575.13
-                                # LOE rcx rbx rbp r10 edx esi r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B11.26:                       # Preds ..B11.21
-        psrldq    $2, %xmm0                                     #4670.26
-        cmpq      %r10, %rcx                                    #4673.26
-        jae       ..B11.28      # Prob 19%                      #4673.26
-                                # LOE rcx rbx rbp r10 edx esi r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B11.27:                       # Preds ..B11.26
-        movzbl    (%rcx), %edi                                  #4674.72
-        lea       expand_2na.0(%rip), %rax                      #4674.57
-        movzwl    (%rax,%rdi,2), %r8d                           #4674.57
-        pinsrw    $7, %r8d, %xmm0                               #4674.30
-                                # LOE rcx rbx rbp r10 edx esi r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B11.28:                       # Preds ..B11.27 ..B11.26
-        incq      %rcx                                          #4677.20
-                                # LOE rcx rbx rbp r10 edx esi r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B11.29:                       # Preds ..B11.1 ..B11.25 ..B11.28
-        movdqa    %xmm0, %xmm10                                 #4585.22
-        movdqa    %xmm0, %xmm9                                  #4586.22
-        pand      %xmm8, %xmm10                                 #4585.22
-        pand      %xmm7, %xmm9                                  #4586.22
-        pcmpeqd   %xmm9, %xmm10                                 #4587.22
-        pmovmskb  %xmm10, %edi                                  #4588.22
-        movl      %edi, %r8d                                    #4589.17
-        andl      $3855, %r8d                                   #4589.17
-        shll      $4, %r8d                                      #4589.17
-        andl      %r8d, %edi                                    #4589.17
-        movl      %edi, %r9d                                    #4589.17
-        shrl      $4, %r9d                                      #4589.17
-        orl       %r9d, %edi                                    #4589.17
-        jmp       ..B11.9       # Prob 100%                     #4589.17
-                                # LOE rcx rbx rbp r10 edx esi edi r11d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B11.31:                       # Preds ..B11.20 ..B11.22 ..B11.23 # Infreq
-        xorl      %eax, %eax                                    #4718.12
-..___tag_value_eval_4na_64.605:                                 #4718.12
-        popq      %rbx                                          #4718.12
-..___tag_value_eval_4na_64.607:                                 #
-        popq      %r12                                          #4718.12
-..___tag_value_eval_4na_64.609:                                 #
-        popq      %r13                                          #4718.12
-..___tag_value_eval_4na_64.611:                                 #
-        popq      %r14                                          #4718.12
-..___tag_value_eval_4na_64.613:                                 #
-        popq      %r15                                          #4718.12
-..___tag_value_eval_4na_64.615:                                 #
-        ret                                                     #4718.12
-..___tag_value_eval_4na_64.616:                                 #
-                                # LOE
-..B11.34:                       # Preds ..B11.13 ..B11.19 ..B11.17 ..B11.15 # Infreq
-        movl      $1, %eax                                      #4651.63
-..___tag_value_eval_4na_64.622:                                 #4651.63
-        popq      %rbx                                          #4651.63
-..___tag_value_eval_4na_64.624:                                 #
-        popq      %r12                                          #4651.63
-..___tag_value_eval_4na_64.626:                                 #
-        popq      %r13                                          #4651.63
-..___tag_value_eval_4na_64.628:                                 #
-        popq      %r14                                          #4651.63
-..___tag_value_eval_4na_64.630:                                 #
-        popq      %r15                                          #4651.63
-..___tag_value_eval_4na_64.632:                                 #
-        ret                                                     #4651.63
-        .align    16,0x90
-..___tag_value_eval_4na_64.633:                                 #
-                                # LOE
-# mark_end;
-	.type	eval_4na_64, at function
-	.size	eval_4na_64,.-eval_4na_64
-	.data
-# -- End  eval_4na_64
-	.text
-# -- Begin  eval_2na_64
-# mark_begin;
-       .align    16,0x90
-eval_2na_64:
-# parameter 1: %rdi
-# parameter 2: %rsi
-# parameter 3: %edx
-# parameter 4: %ecx
-..B12.1:                        # Preds ..B12.0
-..___tag_value_eval_2na_64.634:                                 #3075.1
-        pushq     %r15                                          #3075.1
-..___tag_value_eval_2na_64.636:                                 #
-        pushq     %r14                                          #3075.1
-..___tag_value_eval_2na_64.638:                                 #
-        pushq     %r13                                          #3075.1
-..___tag_value_eval_2na_64.640:                                 #
-        pushq     %r12                                          #3075.1
-..___tag_value_eval_2na_64.642:                                 #
-        pushq     %rbp                                          #3075.1
-..___tag_value_eval_2na_64.644:                                 #
-        pushq     %rbx                                          #3075.1
-..___tag_value_eval_2na_64.646:                                 #
-        lea       (%rdx,%rcx), %r15d                            #3113.5
-        movl      %edx, %eax                                    #3116.49
-        shrl      $2, %eax                                      #3116.49
-        subl      4(%rdi), %r15d                                #3119.12
-        lea       (%rsi,%rax), %r8                              #3116.30
-        lea       3(%rdx,%rcx), %r14d                           #3122.50
-        shrl      $2, %r14d                                     #3122.57
-        addq      %rsi, %r14                                    #3122.30
-        testq     $15, %r8                                      #3125.14
-        jne       ..B12.3       # Prob 50%                      #3125.14
-                                # LOE rax rbx rbp rsi rdi r8 r12 r13 r14 edx r15d
-..B12.2:                        # Preds ..B12.1
-        movdqa    (%r8), %xmm0                                  #3125.14
-        jmp       ..B12.4       # Prob 100%                     #3125.14
-                                # LOE rax rbx rbp rsi rdi r12 r13 r14 edx r15d xmm0
-..B12.3:                        # Preds ..B12.1
-        movdqu    (%r8), %xmm0                                  #3125.14
-                                # LOE rax rbx rbp rsi rdi r12 r13 r14 edx r15d xmm0
-..B12.4:                        # Preds ..B12.2 ..B12.3
-        lea       16(%rsi,%rax), %r8                            #3126.5
-        movq      %r8, %rsi                                     #3126.5
-        cmpq      %r14, %r8                                     #3131.16
-        jae       ..B12.6       # Prob 12%                      #3131.16
-                                # LOE rbx rbp rsi rdi r8 r12 r13 r14 edx ecx r15d xmm0
-..B12.5:                        # Preds ..B12.4
-        movzbl    -1(%r8), %ecx                                 #3132.24
-        shll      $8, %ecx                                      #3132.38
-                                # LOE rbx rbp rsi rdi r8 r12 r13 r14 edx ecx r15d xmm0
-..B12.6:                        # Preds ..B12.5 ..B12.4
-        movdqa    16(%rdi), %xmm8                               #3136.5
-        movdqa    32(%rdi), %xmm7                               #3136.5
-        movdqa    48(%rdi), %xmm6                               #3136.5
-        movdqa    64(%rdi), %xmm5                               #3136.5
-        movdqa    80(%rdi), %xmm4                               #3136.5
-        movdqa    96(%rdi), %xmm3                               #3136.5
-        movdqa    112(%rdi), %xmm2                              #3136.5
-        movdqa    128(%rdi), %xmm1                              #3136.5
-        xorl      %r10d, %r10d                                  #3139.15
-        xorl      %r11d, %r11d                                  #3139.10
-        xorl      %r9d, %r9d                                    #3139.5
-        movl      $8, %edi                                      #3143.5
-        movl      %edx, %eax                                    #3148.20
-        andl      $3, %eax                                      #3148.20
-        je        ..B12.38      # Prob 20%                      #3148.20
-                                # LOE rbx rbp rsi r8 r12 r13 r14 eax edx ecx edi r9d r10d r11d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.7:                        # Preds ..B12.6
-        cmpl      $1, %eax                                      #3148.20
-        je        ..B12.14      # Prob 25%                      #3148.20
-                                # LOE rbx rbp rsi r8 r12 r13 r14 eax edx ecx edi r9d r10d r11d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.8:                        # Preds ..B12.7
-        cmpl      $2, %eax                                      #3148.20
-        je        ..B12.15      # Prob 33%                      #3148.20
-                                # LOE rbx rbp rsi r8 r12 r13 r14 eax edx ecx edi r9d r10d r11d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.9:                        # Preds ..B12.8
-        cmpl      $3, %eax                                      #3148.20
-        je        ..B12.16      # Prob 50%                      #3148.20
-        jmp       ..B12.34      # Prob 100%                     #3148.20
-                                # LOE rbx rbp rsi r8 r12 r13 r14 edx ecx edi r9d r10d r11d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.14:                       # Preds ..B12.7 ..B12.38
-        movdqa    %xmm0, %xmm9                                  #3171.22
-        pand      %xmm5, %xmm9                                  #3171.22
-        pcmpeqd   %xmm6, %xmm9                                  #3172.22
-        pmovmskb  %xmm9, %r11d                                  #3173.22
-        movl      %r11d, %ebx                                   #3174.17
-        andl      $3855, %ebx                                   #3174.17
-        shll      $4, %ebx                                      #3174.17
-        andl      %ebx, %r11d                                   #3174.17
-        movl      %r11d, %ebp                                   #3174.17
-        shrl      $4, %ebp                                      #3174.17
-        orl       %ebp, %r11d                                   #3174.17
-                                # LOE rsi r8 r14 edx ecx edi r9d r11d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.15:                       # Preds ..B12.8 ..B12.14
-        movdqa    %xmm0, %xmm9                                  #3177.22
-        pand      %xmm3, %xmm9                                  #3177.22
-        pcmpeqd   %xmm4, %xmm9                                  #3178.22
-        pmovmskb  %xmm9, %r10d                                  #3179.22
-        movl      %r10d, %ebx                                   #3180.17
-        andl      $3855, %ebx                                   #3180.17
-        shll      $4, %ebx                                      #3180.17
-        andl      %ebx, %r10d                                   #3180.17
-        movl      %r10d, %ebp                                   #3180.17
-        shrl      $4, %ebp                                      #3180.17
-        orl       %ebp, %r10d                                   #3180.17
-                                # LOE rsi r8 r14 edx ecx edi r9d r10d r11d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.16:                       # Preds ..B12.9 ..B12.15
-        movdqa    %xmm0, %xmm9                                  #3183.22
-        pand      %xmm1, %xmm9                                  #3183.22
-        pcmpeqd   %xmm2, %xmm9                                  #3184.22
-        pmovmskb  %xmm9, %ebp                                   #3185.22
-        movl      %ebp, %ebx                                    #3186.17
-        andl      $3855, %ebx                                   #3186.17
-        shll      $4, %ebx                                      #3186.17
-        andl      %ebx, %ebp                                    #3186.17
-        movl      %ebp, %r12d                                   #3186.17
-        shrl      $4, %r12d                                     #3186.17
-        orl       %r12d, %ebp                                   #3186.17
-        movl      %edx, %ebx                                    #3190.17
-        andl      $-4, %ebx                                     #3190.17
-        movl      %r9d, %edx                                    #3193.29
-        orl       %r11d, %edx                                   #3193.29
-        orl       %r10d, %edx                                   #3193.34
-        orl       %ebp, %edx                                    #3193.39
-        je        ..B12.25      # Prob 78%                      #3193.47
-                                # LOE rsi r8 r14 ecx ebx ebp edi r9d r10d r11d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.17:                       # Preds ..B12.16
-        movl      %r9d, %eax                                    #3211.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+6;xor %eax, %eax;dec %eax;
-# End ASM                                                       #3211.30
-        movswq    %ax, %r13                                     #3211.30
-        movl      %r11d, %eax                                   #3212.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+6;xor %eax, %eax;dec %eax;
-# End ASM                                                       #3212.30
-        movswq    %ax, %r12                                     #3212.30
-        movl      %r10d, %eax                                   #3213.30
-        shll      $2, %r13d                                     #3219.34
-        shll      $2, %r12d                                     #3220.34
-# Begin ASM
-        bsf %ax, %ax;jnz .+6;xor %eax, %eax;dec %eax;
-# End ASM                                                       #3213.30
-        movswq    %ax, %rdx                                     #3213.30
-        movl      %ebp, %eax                                    #3214.30
-# Begin ASM
-        bsf %ax, %ax;jnz .+6;xor %eax, %eax;dec %eax;
-# End ASM                                                       #3214.30
-        movswq    %ax, %rax                                     #3214.30
-        shll      $2, %edx                                      #3221.34
-        shll      $2, %eax                                      #3222.34
-        testl     %r9d, %r9d                                    #3226.32
-        je        ..B12.19      # Prob 50%                      #3226.32
-                                # LOE rsi r8 r14 eax edx ecx ebx ebp edi r10d r11d r12d r13d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.18:                       # Preds ..B12.17
-        addl      %ebx, %r13d                                   #3226.43
-        cmpl      %r13d, %r15d                                  #3226.49
-        jae       ..B12.43      # Prob 20%                      #3226.49
-                                # LOE rsi r8 r14 eax edx ecx ebx ebp edi r10d r11d r12d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.19:                       # Preds ..B12.18 ..B12.17
-        testl     %r11d, %r11d                                  #3227.32
-        je        ..B12.21      # Prob 50%                      #3227.32
-                                # LOE rsi r8 r14 eax edx ecx ebx ebp edi r10d r12d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.20:                       # Preds ..B12.19
-        lea       1(%rbx,%r12), %r9d                            #3227.43
-        cmpl      %r9d, %r15d                                   #3227.49
-        jae       ..B12.43      # Prob 20%                      #3227.49
-                                # LOE rsi r8 r14 eax edx ecx ebx ebp edi r10d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.21:                       # Preds ..B12.20 ..B12.19
-        testl     %r10d, %r10d                                  #3228.32
-        je        ..B12.23      # Prob 50%                      #3228.32
-                                # LOE rsi r8 r14 eax edx ecx ebx ebp edi r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.22:                       # Preds ..B12.21
-        lea       2(%rbx,%rdx), %edx                            #3228.43
-        cmpl      %edx, %r15d                                   #3228.49
-        jae       ..B12.43      # Prob 20%                      #3228.49
-                                # LOE rsi r8 r14 eax ecx ebx ebp edi r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.23:                       # Preds ..B12.22 ..B12.21
-        testl     %ebp, %ebp                                    #3229.32
-        je        ..B12.25      # Prob 50%                      #3229.32
-                                # LOE rsi r8 r14 eax ecx ebx edi r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.24:                       # Preds ..B12.23
-        lea       3(%rbx,%rax), %eax                            #3229.43
-        cmpl      %eax, %r15d                                   #3229.49
-        jae       ..B12.43      # Prob 20%                      #3229.49
-                                # LOE rsi r8 r14 ecx ebx edi r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.25:                       # Preds ..B12.24 ..B12.23 ..B12.16
-        lea       4(%rbx), %edx                                 #3234.17
-        cmpl      %r15d, %edx                                   #3237.28
-        ja        ..B12.40      # Prob 20%                      #3237.28
-                                # LOE rsi r8 r14 edx ecx ebx edi r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.26:                       # Preds ..B12.25
-        decl      %edi                                          #3241.25
-        jne       ..B12.35      # Prob 50%                      #3241.39
-                                # LOE rsi r8 r14 edx ecx ebx edi r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.27:                       # Preds ..B12.26
-        cmpq      %r14, %r8                                     #3262.25
-        jae       ..B12.40      # Prob 4%                       #3262.25
-                                # LOE r8 r14 ecx ebx r15d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.28:                       # Preds ..B12.27
-        lea       36(%rbx), %edx                                #3266.13
-        cmpl      %r15d, %edx                                   #3267.24
-        ja        ..B12.40      # Prob 4%                       #3267.24
-                                # LOE r8 r14 edx ecx r15d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.29:                       # Preds ..B12.28
-        testq     $15, %r8                                      #3272.22
-        jne       ..B12.31      # Prob 50%                      #3272.22
-                                # LOE r8 r14 edx ecx r15d xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.30:                       # Preds ..B12.29
-        movdqa    (%r8), %xmm0                                  #3272.22
-        jmp       ..B12.32      # Prob 100%                     #3272.22
-                                # LOE r8 r14 edx ecx r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.31:                       # Preds ..B12.29
-        movdqu    (%r8), %xmm0                                  #3272.22
-                                # LOE r8 r14 edx ecx r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.32:                       # Preds ..B12.30 ..B12.31
-        addq      $16, %r8                                      #3350.13
-        movq      %r8, %rsi                                     #3350.13
-        cmpq      %r14, %r8                                     #3353.24
-        jae       ..B12.34      # Prob 12%                      #3353.24
-                                # LOE rsi r8 r14 edx ecx r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.33:                       # Preds ..B12.32
-        movzbl    -1(%r8), %ecx                                 #3354.32
-        shll      $8, %ecx                                      #3354.46
-                                # LOE rsi r8 r14 edx ecx r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.34:                       # Preds ..B12.9 ..B12.32 ..B12.33
-        movl      $8, %edi                                      #3155.13
-        jmp       ..B12.38      # Prob 100%                     #3155.13
-                                # LOE rsi r8 r14 edx ecx edi r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.35:                       # Preds ..B12.26
-        psrldq    $1, %xmm0                                     #3246.26
-        cmpq      %r14, %rsi                                    #3249.26
-        jae       ..B12.37      # Prob 19%                      #3249.26
-                                # LOE rsi r8 r14 edx ecx edi r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.36:                       # Preds ..B12.35
-        movzbl    (%rsi), %eax                                  #3252.37
-        sarl      $8, %ecx                                      #3251.21
-        shll      $8, %eax                                      #3252.48
-        orl       %eax, %ecx                                    #3252.21
-        pinsrw    $7, %ecx, %xmm0                               #3253.30
-                                # LOE rsi r8 r14 edx ecx edi r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.37:                       # Preds ..B12.36 ..B12.35
-        incq      %rsi                                          #3257.20
-                                # LOE rsi r8 r14 edx ecx edi r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.38:                       # Preds ..B12.6 ..B12.34 ..B12.37
-        movdqa    %xmm0, %xmm9                                  #3165.22
-        pand      %xmm7, %xmm9                                  #3165.22
-        pcmpeqd   %xmm8, %xmm9                                  #3166.22
-        pmovmskb  %xmm9, %r9d                                   #3167.22
-        movl      %r9d, %ebx                                    #3168.17
-        andl      $3855, %ebx                                   #3168.17
-        shll      $4, %ebx                                      #3168.17
-        andl      %ebx, %r9d                                    #3168.17
-        movl      %r9d, %ebp                                    #3168.17
-        shrl      $4, %ebp                                      #3168.17
-        orl       %ebp, %r9d                                    #3168.17
-        jmp       ..B12.14      # Prob 100%                     #3168.17
-                                # LOE rsi r8 r14 edx ecx edi r9d r15d xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8
-..B12.40:                       # Preds ..B12.25 ..B12.27 ..B12.28 # Infreq
-        xorl      %eax, %eax                                    #3363.12
-..___tag_value_eval_2na_64.649:                                 #3363.12
-        popq      %rbx                                          #3363.12
-..___tag_value_eval_2na_64.651:                                 #
-        popq      %rbp                                          #3363.12
-..___tag_value_eval_2na_64.653:                                 #
-        popq      %r12                                          #3363.12
-..___tag_value_eval_2na_64.655:                                 #
-        popq      %r13                                          #3363.12
-..___tag_value_eval_2na_64.657:                                 #
-        popq      %r14                                          #3363.12
-..___tag_value_eval_2na_64.659:                                 #
-        popq      %r15                                          #3363.12
-..___tag_value_eval_2na_64.661:                                 #
-        ret                                                     #3363.12
-..___tag_value_eval_2na_64.662:                                 #
-                                # LOE
-..B12.43:                       # Preds ..B12.22 ..B12.20 ..B12.18 ..B12.24 # Infreq
-        movl      $1, %eax                                      #3229.63
-..___tag_value_eval_2na_64.669:                                 #3229.63
-        popq      %rbx                                          #3229.63
-..___tag_value_eval_2na_64.671:                                 #
-        popq      %rbp                                          #3229.63
-..___tag_value_eval_2na_64.673:                                 #
-        popq      %r12                                          #3229.63
-..___tag_value_eval_2na_64.675:                                 #
-        popq      %r13                                          #3229.63
-..___tag_value_eval_2na_64.677:                                 #
-        popq      %r14                                          #3229.63
-..___tag_value_eval_2na_64.679:                                 #
-        popq      %r15                                          #3229.63
-..___tag_value_eval_2na_64.681:                                 #
-        ret                                                     #3229.63
-        .align    16,0x90
-..___tag_value_eval_2na_64.682:                                 #
-                                # LOE
-# mark_end;
-	.type	eval_2na_64, at function
-	.size	eval_2na_64,.-eval_2na_64
-	.data
-# -- End  eval_2na_64
-	.text
-# -- Begin  NucStrstrMake
-# mark_begin;
-       .align    16,0x90
-	.globl NucStrstrMake
-NucStrstrMake:
-# parameter 1: %rdi
-# parameter 2: %esi
-# parameter 3: %rdx
-# parameter 4: %ecx
-..B13.1:                        # Preds ..B13.0
-..___tag_value_NucStrstrMake.683:                               #1539.1
-        pushq     %r15                                          #1539.1
-..___tag_value_NucStrstrMake.685:                               #
-        pushq     %r14                                          #1539.1
-..___tag_value_NucStrstrMake.687:                               #
-        pushq     %r13                                          #1539.1
-..___tag_value_NucStrstrMake.689:                               #
-        pushq     %r12                                          #1539.1
-..___tag_value_NucStrstrMake.691:                               #
-        pushq     %rbp                                          #1539.1
-..___tag_value_NucStrstrMake.693:                               #
-        pushq     %rbx                                          #1539.1
-..___tag_value_NucStrstrMake.695:                               #
-        subq      $24, %rsp                                     #1539.1
-..___tag_value_NucStrstrMake.697:                               #
-        movl      %ecx, %r13d                                   #1539.1
-        movq      %rdx, %r12                                    #1539.1
-        movl      %esi, %ebp                                    #1539.1
-        movq      %rdi, %rbx                                    #1539.1
-        testq     %rbx, %rbx                                    #1540.17
-        je        ..B13.12      # Prob 6%                       #1540.17
-                                # LOE rbx r12 ebp r13d
-..B13.2:                        # Preds ..B13.1
-        testq     %r12, %r12                                    #1542.23
-        je        ..B13.11      # Prob 6%                       #1542.23
-                                # LOE rbx r12 ebp r13d
-..B13.3:                        # Preds ..B13.2
-        testl     %r13d, %r13d                                  #1542.38
-        je        ..B13.11      # Prob 28%                      #1542.38
-                                # LOE rbx r12 ebp r13d
-..B13.4:                        # Preds ..B13.3
-        movl      $0, 16(%rsp)                                  #1544.24
-        lea       fasta_2na_map.0(%rip), %rax                   #1547.18
-        movsbl    (%rax), %edx                                  #1547.18
-        testl     %edx, %edx                                    #1547.41
-        je        ..B13.13      # Prob 5%                       #1547.41
-                                # LOE rbx r12 ebp r13d
-..B13.5:                        # Preds ..B13.35 ..B13.4
-        lea       16(%rsp), %rcx                                #1551.21
-        movl      %r13d, %r13d                                  #1550.19
-        addq      %r12, %r13                                    #1550.19
-        movq      %r12, %rdi                                    #1551.21
-        movq      %r13, %rsi                                    #1551.21
-        movq      %rbx, %rdx                                    #1551.21
-        movl      %ebp, %r8d                                    #1551.21
-        call      nss_expr at PLT                                  #1551.21
-                                # LOE rax rbx r13
-..B13.6:                        # Preds ..B13.5
-        movl      16(%rsp), %ebp                                #1552.18
-        testl     %ebp, %ebp                                    #1552.28
-        jne       ..B13.9       # Prob 10%                      #1552.28
-                                # LOE rax rbx r13 ebp
-..B13.7:                        # Preds ..B13.6
-        cmpq      %r13, %rax                                    #1554.31
-        je        ..B13.37      # Prob 12%                      #1554.31
-                                # LOE rbx
-..B13.8:                        # Preds ..B13.7
-        movl      $22, 16(%rsp)                                 #1557.17
-        movl      $22, %ebp                                     #1557.17
-                                # LOE rbx ebp
-..B13.9:                        # Preds ..B13.6 ..B13.8
-        movq      (%rbx), %rdi                                  #1560.13
-        call      NucStrstrWhack at PLT                            #1560.13
-                                # LOE rbx ebp
-..B13.10:                       # Preds ..B13.9
-        movq      $0, (%rbx)                                    #1561.13
-        movl      %ebp, %eax                                    #1562.20
-        addq      $24, %rsp                                     #1562.20
-..___tag_value_NucStrstrMake.698:                               #
-        popq      %rbx                                          #1562.20
-..___tag_value_NucStrstrMake.700:                               #
-        popq      %rbp                                          #1562.20
-..___tag_value_NucStrstrMake.702:                               #
-        popq      %r12                                          #1562.20
-..___tag_value_NucStrstrMake.704:                               #
-        popq      %r13                                          #1562.20
-..___tag_value_NucStrstrMake.706:                               #
-        popq      %r14                                          #1562.20
-..___tag_value_NucStrstrMake.708:                               #
-        popq      %r15                                          #1562.20
-..___tag_value_NucStrstrMake.710:                               #
-        ret                                                     #1562.20
-..___tag_value_NucStrstrMake.711:                               #
-                                # LOE
-..B13.11:                       # Preds ..B13.3 ..B13.2
-        movq      $0, (%rbx)                                    #1565.9
-                                # LOE
-..B13.12:                       # Preds ..B13.1 ..B13.11
-        movl      $22, %eax                                     #1567.12
-        addq      $24, %rsp                                     #1567.12
-..___tag_value_NucStrstrMake.718:                               #
-        popq      %rbx                                          #1567.12
-..___tag_value_NucStrstrMake.720:                               #
-        popq      %rbp                                          #1567.12
-..___tag_value_NucStrstrMake.722:                               #
-        popq      %r12                                          #1567.12
-..___tag_value_NucStrstrMake.724:                               #
-        popq      %r13                                          #1567.12
-..___tag_value_NucStrstrMake.726:                               #
-        popq      %r14                                          #1567.12
-..___tag_value_NucStrstrMake.728:                               #
-        popq      %r15                                          #1567.12
-..___tag_value_NucStrstrMake.730:                               #
-        ret                                                     #1567.12
-..___tag_value_NucStrstrMake.731:                               #
-                                # LOE
-..B13.13:                       # Preds ..B13.4                 # Infreq
-        lea       fasta_2na_map.0(%rip), %rdx                   #1548.17
-        movl      $-1, %eax                                     #1548.17
-        movd      %eax, %xmm0                                   #1548.17
-        pshufd    $0, %xmm0, %xmm1                              #1548.17
-        movaps    %xmm1, (%rdx)                                 #1548.17
-        movaps    %xmm1, 16(%rdx)                               #1548.17
-        movaps    %xmm1, 32(%rdx)                               #1548.17
-        movaps    %xmm1, 48(%rdx)                               #1548.17
-        movaps    %xmm1, 64(%rdx)                               #1548.17
-        movaps    %xmm1, 80(%rdx)                               #1548.17
-        movaps    %xmm1, 96(%rdx)                               #1548.17
-        movaps    %xmm1, 112(%rdx)                              #1548.17
-                                # LOE rbx r12 ebp r13d
-..B13.14:                       # Preds ..B13.13                # Infreq
-        lea       fasta_4na_map.0(%rip), %rdx                   #1548.17
-        movl      $-1, %eax                                     #1548.17
-        movd      %eax, %xmm0                                   #1548.17
-        pshufd    $0, %xmm0, %xmm1                              #1548.17
-        movaps    %xmm1, (%rdx)                                 #1548.17
-        movaps    %xmm1, 16(%rdx)                               #1548.17
-        movaps    %xmm1, 32(%rdx)                               #1548.17
-        movaps    %xmm1, 48(%rdx)                               #1548.17
-        movaps    %xmm1, 64(%rdx)                               #1548.17
-        movaps    %xmm1, 80(%rdx)                               #1548.17
-        movaps    %xmm1, 96(%rdx)                               #1548.17
-        movaps    %xmm1, 112(%rdx)                              #1548.17
-                                # LOE rbx r12 ebp r13d
-..B13.15:                       # Preds ..B13.14                # Infreq
-        xorl      %r15d, %r15d                                  #1548.17
-        lea       _2__STRING.0.0(%rip), %rax                    #1548.17
-        movsbl    (%rax), %edx                                  #1548.17
-        movl      %edx, (%rsp)                                  #1548.17
-        lea       1+_2__STRING.0.0(%rip), %r14                  #
-        call      __ctype_tolower_loc at PLT                       #1548.17
-                                # LOE rbx r12 r14 ebp r13d r15d
-..B13.43:                       # Preds ..B13.15                # Infreq
-        movl      %r13d, 8(%rsp)                                #
-        movl      (%rsp), %r13d                                 #
-                                # LOE rbx r12 r14 ebp r13d r15d
-..B13.21:                       # Preds ..B13.43 ..B13.22       # Infreq
-        movl      %r13d, %edi                                   #1548.17
-        call      tolower at PLT                                   #1548.17
-                                # LOE rbx r12 r14 eax ebp r13d r15d
-..B13.41:                       # Preds ..B13.21                # Infreq
-        movslq    %eax, %rdx                                    #1548.17
-                                # LOE rdx rbx r12 r14 ebp r13d r15d
-..B13.22:                       # Preds ..B13.41                # Infreq
-        lea       fasta_2na_map.0(%rip), %rax                   #1548.17
-        movb      %r15b, (%rax,%rdx)                            #1548.17
-        movslq    %r13d, %rdx                                   #1548.17
-        movb      %r15b, (%rax,%rdx)                            #1548.17
-        movsbl    (%r14), %r13d                                 #1548.17
-        incl      %r15d                                         #1548.17
-        incq      %r14                                          #1548.17
-        testl     %r13d, %r13d                                  #1548.17
-        jne       ..B13.21      # Prob 82%                      #1548.17
-                                # LOE rbx r12 r14 ebp r13d r15d
-..B13.23:                       # Preds ..B13.22                # Infreq
-        xorl      %eax, %eax                                    #1548.17
-        lea       _2__STRING.1.0(%rip), %rdx                    #1548.17
-        movsbl    (%rdx), %r14d                                 #1548.17
-        lea       1+_2__STRING.1.0(%rip), %r15                  #
-        movl      %eax, %r13d                                   #1548.17
-                                # LOE rbx r12 r15 ebp r13d r14d
-..B13.29:                       # Preds ..B13.23 ..B13.30       # Infreq
-        movl      %r14d, %edi                                   #1548.17
-        call      tolower at PLT                                   #1548.17
-                                # LOE rbx r12 r15 eax ebp r13d r14d
-..B13.42:                       # Preds ..B13.29                # Infreq
-        movslq    %eax, %rcx                                    #1548.17
-                                # LOE rcx rbx r12 r15 ebp r13d r14d
-..B13.30:                       # Preds ..B13.42                # Infreq
-        lea       fasta_4na_map.0(%rip), %rdx                   #1548.17
-        movb      %r13b, (%rdx,%rcx)                            #1548.17
-        movslq    %r14d, %rcx                                   #1548.17
-        movb      %r13b, (%rdx,%rcx)                            #1548.17
-        movsbl    (%r15), %r14d                                 #1548.17
-        incl      %r13d                                         #1548.17
-        incq      %r15                                          #1548.17
-        testl     %r14d, %r14d                                  #1548.17
-        jne       ..B13.29      # Prob 82%                      #1548.17
-                                # LOE rbx r12 r15 ebp r13d r14d
-..B13.31:                       # Preds ..B13.30                # Infreq
-        movl      8(%rsp), %r13d                                #
-        xorl      %edx, %edx                                    #1548.17
-        xorl      %eax, %eax                                    #1548.17
-                                # LOE rdx rbx r12 eax ebp r13d
-..B13.32:                       # Preds ..B13.35 ..B13.31       # Infreq
-        lea       expand_2na.0(%rip), %rcx                      #1548.17
-        movzwl    (%rcx,%rdx,2), %ecx                           #1548.17
-                                # LOE rdx rbx r12 eax ecx ebp r13d
-..B13.34:                       # Preds ..B13.32                # Infreq
-        rorw      $8, %cx                                       #1548.17
-                                # LOE rdx rbx r12 eax ecx ebp r13d
-..B13.35:                       # Preds ..B13.34                # Infreq
-        lea       expand_2na.0(%rip), %rsi                      #1548.17
-        movw      %cx, (%rsi,%rdx,2)                            #1548.17
-        incl      %eax                                          #1548.17
-        movl      %eax, %edx                                    #1548.17
-        movl      %edx, %eax                                    #1548.17
-        cmpl      $256, %eax                                    #1548.17
-        jb        ..B13.32      # Prob 99%                      #1548.17
-        jmp       ..B13.5       # Prob 100%                     #1548.17
-                                # LOE rdx rbx r12 eax ebp r13d
-..B13.37:                       # Preds ..B13.7                 # Infreq
-        xorl      %eax, %eax                                    #1555.28
-        addq      $24, %rsp                                     #1555.28
-..___tag_value_NucStrstrMake.738:                               #
-        popq      %rbx                                          #1555.28
-..___tag_value_NucStrstrMake.740:                               #
-        popq      %rbp                                          #1555.28
-..___tag_value_NucStrstrMake.742:                               #
-        popq      %r12                                          #1555.28
-..___tag_value_NucStrstrMake.744:                               #
-        popq      %r13                                          #1555.28
-..___tag_value_NucStrstrMake.746:                               #
-        popq      %r14                                          #1555.28
-..___tag_value_NucStrstrMake.748:                               #
-        popq      %r15                                          #1555.28
-..___tag_value_NucStrstrMake.750:                               #
-        ret                                                     #1555.28
-        .align    16,0x90
-..___tag_value_NucStrstrMake.751:                               #
-                                # LOE
-# mark_end;
-	.type	NucStrstrMake, at function
-	.size	NucStrstrMake,.-NucStrstrMake
-	.data
-# -- End  NucStrstrMake
-	.text
-# -- Begin  NucStrstrWhack
-# mark_begin;
-       .align    16,0x90
-	.globl NucStrstrWhack
-NucStrstrWhack:
-# parameter 1: %rdi
-..B14.1:                        # Preds ..B14.0
-..___tag_value_NucStrstrWhack.752:                              #1574.1
-        pushq     %r14                                          #1574.1
-..___tag_value_NucStrstrWhack.754:                              #
-        movq      %rdi, %r14                                    #1574.1
-        testq     %r14, %r14                                    #1575.18
-        je        ..B14.22      # Prob 12%                      #1575.18
-                                # LOE rbx rbp r12 r13 r14 r15
-..B14.2:                        # Preds ..B14.1
-        movl      (%r14), %eax                                  #1577.18
-        cmpl      $12, %eax                                     #1577.9
-        ja        ..B14.21      # Prob 50%                      #1577.9
-                                # LOE rbx rbp r12 r13 r14 r15 eax
-..B14.3:                        # Preds ..B14.2
-        movl      %eax, %eax                                    #1577.9
-        lea       ..1..TPKT.18_0.0.16(%rip), %rdx               #1577.9
-        movq      (%rdx,%rax,8), %rcx                           #1577.9
-        jmp       *%rcx                                         #1577.9
-                                # LOE rbx rbp r12 r13 r14 r15
-..1.18_0.TAG.0c.0.16:
-..B14.5:                        # Preds ..B14.3
-        movq      8(%r14), %rdi                                 #1601.13
-        call      NucStrstrWhack at PLT                            #1601.13
-        jmp       ..B14.21      # Prob 100%                     #1601.13
-                                # LOE rbx rbp r12 r13 r14 r15
-..1.18_0.TAG.0b.0.16:
-..B14.7:                        # Preds ..B14.3
-        movq      8(%r14), %rdi                                 #1597.13
-        call      NucStrstrWhack at PLT                            #1597.13
-                                # LOE rbx rbp r12 r13 r14 r15
-..B14.8:                        # Preds ..B14.7
-        movq      16(%r14), %rdi                                #1598.13
-        call      NucStrstrWhack at PLT                            #1598.13
-        jmp       ..B14.21      # Prob 100%                     #1598.13
-                                # LOE rbx rbp r12 r13 r14 r15
-..1.18_0.TAG.0a.0.16:
-..1.18_0.TAG.09.0.16:
-..1.18_0.TAG.08.0.16:
-..1.18_0.TAG.07.0.16:
-..1.18_0.TAG.06.0.16:
-..1.18_0.TAG.05.0.16:
-..1.18_0.TAG.04.0.16:
-..1.18_0.TAG.03.0.16:
-..1.18_0.TAG.02.0.16:
-..1.18_0.TAG.01.0.16:
-..1.18_0.TAG.00.0.16:
-..B14.20:                       # Preds ..B14.3 ..B14.3 ..B14.3 ..B14.3 ..B14.3
-                                #       ..B14.3 ..B14.3 ..B14.3 ..B14.3 ..B14.3
-                                #       ..B14.3
-        movq      8(%r14), %r14                                 #1593.20
-                                # LOE rbx rbp r12 r13 r14 r15
-..B14.21:                       # Preds ..B14.5 ..B14.8 ..B14.20 ..B14.2
-        movq      %r14, %rdi                                    #1604.9
-        xorl      %eax, %eax                                    #1604.9
-        call      free at PLT                                      #1604.9
-                                # LOE rbx rbp r12 r13 r15
-..B14.22:                       # Preds ..B14.21 ..B14.1
-..___tag_value_NucStrstrWhack.757:                              #1606.1
-        popq      %r14                                          #1606.1
-..___tag_value_NucStrstrWhack.758:                              #
-        ret                                                     #1606.1
-        .align    16,0x90
-..___tag_value_NucStrstrWhack.759:                              #
-                                # LOE
-# mark_end;
-	.type	NucStrstrWhack, at function
-	.size	NucStrstrWhack,.-NucStrstrWhack
-	.section .data1, "wa"
-	.space 24	# pad
-	.align 32
-..1..TPKT.18_0.0.16:
-	.quad	..1.18_0.TAG.00.0.16
-	.quad	..1.18_0.TAG.01.0.16
-	.quad	..1.18_0.TAG.02.0.16
-	.quad	..1.18_0.TAG.03.0.16
-	.quad	..1.18_0.TAG.04.0.16
-	.quad	..1.18_0.TAG.05.0.16
-	.quad	..1.18_0.TAG.06.0.16
-	.quad	..1.18_0.TAG.07.0.16
-	.quad	..1.18_0.TAG.08.0.16
-	.quad	..1.18_0.TAG.09.0.16
-	.quad	..1.18_0.TAG.0a.0.16
-	.quad	..1.18_0.TAG.0b.0.16
-	.quad	..1.18_0.TAG.0c.0.16
-	.data
-# -- End  NucStrstrWhack
-	.text
-# -- Begin  nss_unary_expr
-# mark_begin;
-       .align    16,0x90
-nss_unary_expr:
-# parameter 1: %rdi
-# parameter 2: %rsi
-# parameter 3: %rdx
-# parameter 4: %rcx
-# parameter 5: %r8d
-..B15.1:                        # Preds ..B15.0
-..___tag_value_nss_unary_expr.760:                              #1361.1
-        pushq     %r15                                          #1361.1
-..___tag_value_nss_unary_expr.762:                              #
-        pushq     %r14                                          #1361.1
-..___tag_value_nss_unary_expr.764:                              #
-        pushq     %r13                                          #1361.1
-..___tag_value_nss_unary_expr.766:                              #
-        pushq     %r12                                          #1361.1
-..___tag_value_nss_unary_expr.768:                              #
-        pushq     %rbp                                          #1361.1
-..___tag_value_nss_unary_expr.770:                              #
-        pushq     %rbx                                          #1361.1
-..___tag_value_nss_unary_expr.772:                              #
-        pushq     %rsi                                          #1361.1
-..___tag_value_nss_unary_expr.774:                              #
-        movl      %r8d, %r14d                                   #1361.1
-        movq      %rcx, %r13                                    #1361.1
-        movq      %rdx, %r12                                    #1361.1
-        movq      %rsi, %rbp                                    #1361.1
-        movq      %rdi, %rbx                                    #1361.1
-        call      __ctype_b_loc at PLT                             #1364.16
-                                # LOE rax rbx rbp r12 r13 r14d
-..B15.60:                       # Preds ..B15.1
-        movq      %rax, %r15                                    #1364.16
-        jmp       ..B15.2       # Prob 100%                     #1364.16
-                                # LOE rbx rbp r12 r13 r15 r14d
-..B15.48:                       # Preds ..B15.47
-        movl      $12, (%rax)                                   #1384.13
-        movl      $13, 4(%rax)                                  #1385.13
-        movq      $0, 8(%rax)                                   #1386.13
-        movq      %rax, (%r12)                                  #1387.13
-        lea       8(%rax), %r12                                 #1389.44
-                                # LOE rbx rbp r12 r13 r15 r14d
-..B15.2:                        # Preds ..B15.48 ..B15.60
-        movsbl    (%rbx), %eax                                  #1363.12
-        cmpl      $33, %eax                                     #1363.17
-        je        ..B15.38      # Prob 33%                      #1363.17
-                                # LOE rbx rbp r12 r13 r15 eax r14d
-..B15.3:                        # Preds ..B15.2
-        cmpl      $94, %eax                                     #1364.16
-        jne       ..B15.15      # Prob 67%                      #1364.16
-                                # LOE rbx rbp r12 r13 r15 eax r14d
-..B15.4:                        # Preds ..B15.3
-        movl      $16, %edi                                     #1364.16
-        call      malloc at PLT                                    #1364.16
-                                # LOE rax rbx rbp r12 r13 r15 r14d
-..B15.5:                        # Preds ..B15.4
-        testq     %rax, %rax                                    #1364.16
-        jne       ..B15.7       # Prob 68%                      #1364.16
-                                # LOE rax rbx rbp r12 r13 r15 r14d
-..B15.6:                        # Preds ..B15.5
-        call      __errno_location at PLT                          #1364.16
-                                # LOE rax rbx r13
-..B15.62:                       # Preds ..B15.6
-        movl      (%rax), %edx                                  #1364.16
-        movl      %edx, (%r13)                                  #1364.16
-        jmp       ..B15.37      # Prob 100%                     #1364.16
-                                # LOE rbx
-..B15.7:                        # Preds ..B15.5
-        movl      $12, (%rax)                                   #1364.16
-        lea       1(%rbx), %rdi                                 #1364.16
-        xorl      %r8d, %r8d                                    #1364.16
-        cmpq      %rbp, %rdi                                    #1364.16
-        movl      $14, 4(%rax)                                  #1364.16
-        movq      $0, 8(%rax)                                   #1364.16
-        movq      %rax, (%r12)                                  #1364.16
-        jae       ..B15.12      # Prob 2%                       #1364.16
-                                # LOE rax rbx rbp rdi r8 r13 r15 r14d
-..B15.8:                        # Preds ..B15.7
-        movq      (%r15), %rsi                                  #1364.16
-        movq      %rbp, %rcx                                    #1361.1
-        subq      %rbx, %rcx                                    #1361.1
-        decq      %rcx                                          #1361.1
-                                # LOE rax rcx rbx rbp rsi rdi r8 r13 r14d
-..B15.9:                        # Preds ..B15.10 ..B15.8
-        movzbl    1(%r8,%rbx), %r9d                             #1364.16
-        movzwl    (%rsi,%r9,2), %r10d                           #1364.16
-        testl     $8192, %r10d                                  #1364.16
-        je        ..B15.12      # Prob 20%                      #1364.16
-                                # LOE rax rcx rbx rbp rsi rdi r8 r13 r14d
-..B15.10:                       # Preds ..B15.9
-        lea       2(%r8,%rbx), %rdi                             #1364.16
-        incq      %r8                                           #1364.16
-        cmpq      %rcx, %r8                                     #1364.16
-        jb        ..B15.9       # Prob 1%                       #1364.16
-                                # LOE rax rcx rbx rbp rsi rdi r8 r13 r14d
-..B15.12:                       # Preds ..B15.9 ..B15.10 ..B15.7
-        addq      $8, %rax                                      #1364.16
-        movq      %rbp, %rsi                                    #1364.16
-        movq      %rax, %rdx                                    #1364.16
-        movq      %r13, %rcx                                    #1364.16
-        movl      %r14d, %r8d                                   #1364.16
-        call      nss_fasta_expr at PLT                            #1364.16
-                                # LOE rax
-..B15.63:                       # Preds ..B15.12
-        movq      %rax, %rbx                                    #1364.16
-        jmp       ..B15.37      # Prob 100%                     #1364.16
-                                # LOE rbx
-..B15.15:                       # Preds ..B15.3
-        cmpl      $40, %eax                                     #1364.16
-        jne       ..B15.27      # Prob 50%                      #1364.16
-                                # LOE rbx rbp r12 r13 r15 r14d
-..B15.16:                       # Preds ..B15.15
-        movl      $16, %edi                                     #1364.16
-        call      malloc at PLT                                    #1364.16
-                                # LOE rax rbx rbp r12 r13 r14d
-..B15.64:                       # Preds ..B15.16
-        movq      %rax, %r15                                    #1364.16
-                                # LOE rbx rbp r12 r13 r15 r14d
-..B15.17:                       # Preds ..B15.64
-        testq     %r15, %r15                                    #1364.16
-        jne       ..B15.19      # Prob 68%                      #1364.16
-                                # LOE rbx rbp r12 r13 r15 r14d
-..B15.18:                       # Preds ..B15.17
-        call      __errno_location at PLT                          #1364.16
-                                # LOE rax rbx r13
-..B15.65:                       # Preds ..B15.18
-        movl      (%rax), %edx                                  #1364.16
-        movl      %edx, (%r13)                                  #1364.16
-        jmp       ..B15.37      # Prob 100%                     #1364.16
-                                # LOE rbx
-..B15.19:                       # Preds ..B15.17
-        movl      $12, (%r15)                                   #1364.16
-        incq      %rbx                                          #1364.16
-        lea       8(%r15), %rdx                                 #1364.16
-        movq      %rbx, %rdi                                    #1364.16
-        movl      $0, 4(%r15)                                   #1364.16
-        movq      %r15, (%r12)                                  #1364.16
-        movq      %rbp, %rsi                                    #1364.16
-        movq      %r13, %rcx                                    #1364.16
-        movl      %r14d, %r8d                                   #1364.16
-        call      nss_expr at PLT                                  #1364.16
-                                # LOE rax rbp r13 r15
-..B15.66:                       # Preds ..B15.19
-        movq      %rax, %rbx                                    #1364.16
-                                # LOE rbx rbp r13 r15
-..B15.20:                       # Preds ..B15.66
-        movl      (%r13), %eax                                  #1364.16
-        testl     %eax, %eax                                    #1364.16
-        jne       ..B15.37      # Prob 50%                      #1364.16
-                                # LOE rbx rbp r13 r15
-..B15.21:                       # Preds ..B15.20
-        movq      8(%r15), %rax                                 #1364.16
-        testq     %rax, %rax                                    #1364.16
-        je        ..B15.50      # Prob 12%                      #1364.16
-                                # LOE rbx rbp r13
-..B15.22:                       # Preds ..B15.21
-        cmpq      %rbp, %rbx                                    #1364.16
-        je        ..B15.50      # Prob 12%                      #1364.16
-                                # LOE rbx r13
-..B15.23:                       # Preds ..B15.22
-        movsbl    (%rbx), %eax                                  #1364.16
-        cmpl      $41, %eax                                     #1364.16
-        je        ..B15.25      # Prob 16%                      #1364.16
-                                # LOE rbx r13
-..B15.24:                       # Preds ..B15.23
-        movl      $22, (%r13)                                   #1364.16
-        incq      %rbx                                          #1364.16
-        jmp       ..B15.37      # Prob 100%                     #1364.16
-                                # LOE rbx
-..B15.25:                       # Preds ..B15.23
-        incq      %rbx                                          #1364.16
-        jmp       ..B15.37      # Prob 100%                     #1364.16
-                                # LOE rbx
-..B15.27:                       # Preds ..B15.15
-        movq      %rbx, %rdi                                    #1364.16
-        movq      %rbp, %rsi                                    #1364.16
-        movq      %r12, %rdx                                    #1364.16
-        movq      %r13, %rcx                                    #1364.16
-        movl      %r14d, %r8d                                   #1364.16
-        call      nss_fasta_expr at PLT                            #1364.16
-                                # LOE rax rbp r12 r13 r15
-..B15.28:                       # Preds ..B15.27
-        movl      (%r13), %edx                                  #1364.16
-        movq      %rax, %rbx                                    #1364.16
-        testl     %edx, %edx                                    #1364.16
-        jne       ..B15.37      # Prob 50%                      #1364.16
-                                # LOE rax rbx rbp r12 r13 r15
-..B15.29:                       # Preds ..B15.28
-        cmpq      %rbp, %rax                                    #1364.16
-        jae       ..B15.37      # Prob 33%                      #1364.16
-                                # LOE rax rbx rbp r12 r13 r15
-..B15.30:                       # Preds ..B15.29
-        movq      (%r15), %rsi                                  #1364.16
-        movq      %rax, %rbx                                    #1364.16
-        xorl      %edx, %edx                                    #1364.16
-        movq      %rbp, %rcx                                    #1361.1
-        subq      %rax, %rcx                                    #1361.1
-                                # LOE rax rdx rcx rbx rbp rsi r12 r13
-..B15.31:                       # Preds ..B15.30 ..B15.32
-        movzbl    (%rdx,%rax), %edi                             #1364.16
-        movzwl    (%rsi,%rdi,2), %r8d                           #1364.16
-        testl     $8192, %r8d                                   #1364.16
-        je        ..B15.34      # Prob 20%                      #1364.16
-                                # LOE rax rdx rcx rbx rbp rsi r12 r13
-..B15.32:                       # Preds ..B15.31
-        lea       1(%rdx,%rax), %rbx                            #1364.16
-        incq      %rdx                                          #1364.16
-        cmpq      %rcx, %rdx                                    #1364.16
-        jb        ..B15.31      # Prob 1%                       #1364.16
-                                # LOE rax rdx rcx rbx rbp rsi r12 r13
-..B15.34:                       # Preds ..B15.31 ..B15.32
-        cmpq      %rbp, %rbx                                    #1364.16
-        jae       ..B15.37      # Prob 12%                      #1364.16
-                                # LOE rbx r12 r13
-..B15.35:                       # Preds ..B15.34
-        movsbl    (%rbx), %eax                                  #1364.16
-        cmpl      $36, %eax                                     #1364.16
-        je        ..B15.51      # Prob 5%                       #1364.16
-                                # LOE rbx r12 r13
-..B15.37:                       # Preds ..B15.28 ..B15.29 ..B15.34 ..B15.35 ..B15.53
-                                #       ..B15.70 ..B15.20 ..B15.50 ..B15.65 ..B15.62
-                                #       ..B15.63 ..B15.24 ..B15.25
-        movq      %rbx, %rax                                    #1364.16
-        popq      %rcx                                          #1364.16
-..___tag_value_nss_unary_expr.775:                              #
-        popq      %rbx                                          #1364.16
-..___tag_value_nss_unary_expr.777:                              #
-        popq      %rbp                                          #1364.16
-..___tag_value_nss_unary_expr.779:                              #
-        popq      %r12                                          #1364.16
-..___tag_value_nss_unary_expr.781:                              #
-        popq      %r13                                          #1364.16
-..___tag_value_nss_unary_expr.783:                              #
-        popq      %r14                                          #1364.16
-..___tag_value_nss_unary_expr.785:                              #
-        popq      %r15                                          #1364.16
-..___tag_value_nss_unary_expr.787:                              #
-        ret                                                     #1364.16
-..___tag_value_nss_unary_expr.788:                              #
-                                # LOE
-..B15.38:                       # Preds ..B15.2
-        incq      %rbx                                          #1374.19
-        movq      %rbx, %rsi                                    #1374.9
-        xorl      %ecx, %ecx                                    #1374.9
-        cmpq      %rbp, %rbx                                    #1374.9
-        jae       ..B15.43      # Prob 2%                       #1374.9
-                                # LOE rcx rbx rbp rsi r12 r13 r15 r14d
-..B15.39:                       # Preds ..B15.38
-        movq      (%r15), %rdx                                  #1374.9
-        movq      %rbp, %rax                                    #1361.1
-        subq      %rbx, %rax                                    #1361.1
-                                # LOE rax rdx rcx rbx rbp rsi r12 r13 r15 r14d
-..B15.40:                       # Preds ..B15.41 ..B15.39
-        movzbl    (%rcx,%rsi), %edi                             #1374.9
-        movzwl    (%rdx,%rdi,2), %r8d                           #1374.9
-        testl     $8192, %r8d                                   #1374.9
-        je        ..B15.43      # Prob 20%                      #1374.9
-                                # LOE rax rdx rcx rbx rbp rsi r12 r13 r15 r14d
-..B15.41:                       # Preds ..B15.40
-        lea       1(%rcx,%rsi), %rbx                            #1374.9
-        incq      %rcx                                          #1374.9
-        cmpq      %rax, %rcx                                    #1374.9
-        jb        ..B15.40      # Prob 16%                      #1374.9
-                                # LOE rax rdx rcx rbx rbp rsi r12 r13 r15 r14d
-..B15.43:                       # Preds ..B15.40 ..B15.41 ..B15.38
-        cmpq      %rbp, %rbx                                    #1375.15
-        jne       ..B15.46      # Prob 68%                      #1375.15
-                                # LOE rbx rbp r12 r13 r15 r14d
-..B15.44:                       # Preds ..B15.43
-        movl      $22, (%r13)                                   #1376.9
-                                # LOE rbx
-..B15.45:                       # Preds ..B15.44 ..B15.71
-        movq      %rbx, %rax                                    #1393.12
-        popq      %rcx                                          #1393.12
-..___tag_value_nss_unary_expr.795:                              #
-        popq      %rbx                                          #1393.12
-..___tag_value_nss_unary_expr.797:                              #
-        popq      %rbp                                          #1393.12
-..___tag_value_nss_unary_expr.799:                              #
-        popq      %r12                                          #1393.12
-..___tag_value_nss_unary_expr.801:                              #
-        popq      %r13                                          #1393.12
-..___tag_value_nss_unary_expr.803:                              #
-        popq      %r14                                          #1393.12
-..___tag_value_nss_unary_expr.805:                              #
-        popq      %r15                                          #1393.12
-..___tag_value_nss_unary_expr.807:                              #
-        ret                                                     #1393.12
-..___tag_value_nss_unary_expr.808:                              #
-                                # LOE
-..B15.46:                       # Preds ..B15.43
-        movl      $16, %edi                                     #1379.25
-        call      malloc at PLT                                    #1379.25
-                                # LOE rax rbx rbp r12 r13 r15 r14d
-..B15.47:                       # Preds ..B15.46
-        testq     %rax, %rax                                    #1380.19
-        je        ..B15.56      # Prob 1%                       #1380.19
-        jmp       ..B15.48      # Prob 100%                     #1380.19
-                                # LOE rax rbx rbp r12 r13 r15 r14d
-..B15.50:                       # Preds ..B15.21 ..B15.22       # Infreq
-        movl      $22, (%r13)                                   #1364.16
-        jmp       ..B15.37      # Prob 100%                     #1364.16
-                                # LOE rbx
-..B15.51:                       # Preds ..B15.35                # Infreq
-        incq      %rbx                                          #1364.16
-        movl      $16, %edi                                     #1364.16
-        call      malloc at PLT                                    #1364.16
-                                # LOE rax rbx r12 r13
-..B15.52:                       # Preds ..B15.51                # Infreq
-        testq     %rax, %rax                                    #1364.16
-        je        ..B15.54      # Prob 12%                      #1364.16
-                                # LOE rax rbx r12 r13
-..B15.53:                       # Preds ..B15.52                # Infreq
-        movl      $12, (%rax)                                   #1364.16
-        movl      $15, 4(%rax)                                  #1364.16
-        movq      (%r12), %rdx                                  #1364.16
-        movq      %rdx, 8(%rax)                                 #1364.16
-        movq      %rax, (%r12)                                  #1364.16
-        jmp       ..B15.37      # Prob 100%                     #1364.16
-                                # LOE rbx
-..B15.54:                       # Preds ..B15.52                # Infreq
-        call      __errno_location at PLT                          #1364.16
-                                # LOE rax rbx r13
-..B15.70:                       # Preds ..B15.54                # Infreq
-        movl      (%rax), %edx                                  #1364.16
-        movl      %edx, (%r13)                                  #1364.16
-        jmp       ..B15.37      # Prob 100%                     #1364.16
-                                # LOE rbx
-..B15.56:                       # Preds ..B15.47                # Infreq
-        call      __errno_location at PLT                          #1381.24
-                                # LOE rax rbx r13
-..B15.71:                       # Preds ..B15.56                # Infreq
-        movl      (%rax), %edx                                  #1381.24
-        movl      %edx, (%r13)                                  #1381.13
-        jmp       ..B15.45      # Prob 100%                     #1381.13
-        .align    16,0x90
-..___tag_value_nss_unary_expr.815:                              #
-                                # LOE rbx
-# mark_end;
-	.type	nss_unary_expr, at function
-	.size	nss_unary_expr,.-nss_unary_expr
-	.data
-# -- End  nss_unary_expr
-	.text
-# -- Begin  nss_fasta_expr
-# mark_begin;
-       .align    16,0x90
-nss_fasta_expr:
-# parameter 1: %rdi
-# parameter 2: %rsi
-# parameter 3: %rdx
-# parameter 4: %rcx
-# parameter 5: %r8d
-..B16.1:                        # Preds ..B16.0
-..___tag_value_nss_fasta_expr.816:                              #1234.1
-        pushq     %r14                                          #1234.1
-..___tag_value_nss_fasta_expr.818:                              #
-        pushq     %r12                                          #1234.1
-..___tag_value_nss_fasta_expr.820:                              #
-        pushq     %rbx                                          #1234.1
-..___tag_value_nss_fasta_expr.822:                              #
-        movq      %rcx, %r12                                    #1234.1
-        movq      %rsi, %rbx                                    #1234.1
-        movq      %rdi, %rax                                    #1234.1
-        movsbl    (%rax), %ecx                                  #1236.16
-        cmpl      $39, %ecx                                     #1236.16
-        jne       ..B16.11      # Prob 67%                      #1236.16
-                                # LOE rax rdx rbx rbp r12 r13 r15 ecx r8d
-..B16.2:                        # Preds ..B16.1
-        incq      %rax                                          #1239.30
-        movq      %rax, %r14                                    #1239.30
-        cmpq      %rbx, %rax                                    #1239.13
-        jb        ..B16.4       # Prob 56%                      #1239.13
-                                # LOE rax rdx rbx rbp r12 r13 r14 r15 r8d
-..B16.3:                        # Preds ..B16.56 ..B16.38 ..B16.2
-        movl      $22, (%r12)                                   #1239.13
-..___tag_value_nss_fasta_expr.825:                              #1239.13
-        popq      %rbx                                          #1239.13
-..___tag_value_nss_fasta_expr.826:                              #
-        popq      %r12                                          #1239.13
-..___tag_value_nss_fasta_expr.828:                              #
-        popq      %r14                                          #1239.13
-..___tag_value_nss_fasta_expr.830:                              #
-        ret                                                     #1239.13
-..___tag_value_nss_fasta_expr.831:                              #
-                                # LOE rax rbp r13 r15
-..B16.4:                        # Preds ..B16.2
-        xorl      %r9d, %r9d                                    #1239.13
-        lea       fasta_2na_map.0(%rip), %rcx                   #1239.13
-                                # LOE rax rdx rcx rbx rbp r12 r13 r14 r15 r8d r9d
-..B16.5:                        # Preds ..B16.7 ..B16.4
-        movsbl    (%r14), %r10d                                 #1239.13
-        testl     %r10d, %r10d                                  #1239.13
-        jl        ..B16.9       # Prob 20%                      #1239.13
-                                # LOE rax rdx rcx rbx rbp r12 r13 r14 r15 r8d r9d
-..B16.6:                        # Preds ..B16.5
-        movzbl    (%r14), %r10d                                 #1239.13
-        movsbl    (%r10,%rcx), %r11d                            #1239.13
-        testl     %r11d, %r11d                                  #1239.13
-        jl        ..B16.44      # Prob 16%                      #1239.13
-                                # LOE rax rdx rcx rbx rbp r12 r13 r14 r15 r8d r9d r10d
-..B16.7:                        # Preds ..B16.46 ..B16.6
-        incq      %r14                                          #1239.13
-        cmpq      %rbx, %r14                                    #1239.13
-        jb        ..B16.5       # Prob 82%                      #1239.13
-                                # LOE rax rdx rcx rbx rbp r12 r13 r14 r15 r8d r9d
-..B16.9:                        # Preds ..B16.45 ..B16.44 ..B16.5 ..B16.7
-        cmpq      %rax, %r14                                    #1239.13
-        ja        ..B16.32      # Prob 12%                      #1239.13
-                                # LOE rax rdx rbx rbp r12 r13 r14 r15 r8d r9d
-..B16.10:                       # Preds ..B16.9
-        movl      $22, (%r12)                                   #1239.13
-        movq      %r14, %rax                                    #1239.13
-..___tag_value_nss_fasta_expr.835:                              #1239.13
-        popq      %rbx                                          #1239.13
-..___tag_value_nss_fasta_expr.836:                              #
-        popq      %r12                                          #1239.13
-..___tag_value_nss_fasta_expr.838:                              #
-        popq      %r14                                          #1239.13
-..___tag_value_nss_fasta_expr.840:                              #
-        ret                                                     #1239.13
-..___tag_value_nss_fasta_expr.841:                              #
-                                # LOE rax rbp r13 r15
-..B16.11:                       # Preds ..B16.1
-        cmpl      $34, %ecx                                     #1236.16
-        jne       ..B16.22      # Prob 50%                      #1236.16
-                                # LOE rax rdx rbx rbp r12 r13 r15 r8d
-..B16.12:                       # Preds ..B16.11
-        incq      %rax                                          #1244.30
-        movq      %rax, %r14                                    #1244.30
-        cmpq      %rbx, %rax                                    #1244.13
-        jb        ..B16.14      # Prob 56%                      #1244.13
-                                # LOE rax rdx rbx rbp r12 r13 r14 r15 r8d
-..B16.13:                       # Preds ..B16.12
-        movl      $22, (%r12)                                   #1244.13
-..___tag_value_nss_fasta_expr.845:                              #1244.13
-        popq      %rbx                                          #1244.13
-..___tag_value_nss_fasta_expr.846:                              #
-        popq      %r12                                          #1244.13
-..___tag_value_nss_fasta_expr.848:                              #
-        popq      %r14                                          #1244.13
-..___tag_value_nss_fasta_expr.850:                              #
-        ret                                                     #1244.13
-..___tag_value_nss_fasta_expr.851:                              #
-                                # LOE rax rbp r13 r15
-..B16.14:                       # Preds ..B16.12
-        xorl      %r9d, %r9d                                    #1244.13
-        lea       fasta_2na_map.0(%rip), %rcx                   #1244.13
-                                # LOE rax rdx rcx rbx rbp r12 r13 r14 r15 r8d r9d
-..B16.15:                       # Preds ..B16.17 ..B16.14
-        movsbl    (%r14), %r10d                                 #1244.13
-        testl     %r10d, %r10d                                  #1244.13
-        jl        ..B16.19      # Prob 20%                      #1244.13
-                                # LOE rax rdx rcx rbx rbp r12 r13 r14 r15 r8d r9d
-..B16.16:                       # Preds ..B16.15
-        movzbl    (%r14), %r10d                                 #1244.13
-        movsbl    (%r10,%rcx), %r11d                            #1244.13
-        testl     %r11d, %r11d                                  #1244.13
-        jl        ..B16.62      # Prob 16%                      #1244.13
-                                # LOE rax rdx rcx rbx rbp r12 r13 r14 r15 r8d r9d r10d
-..B16.17:                       # Preds ..B16.64 ..B16.16
-        incq      %r14                                          #1244.13
-        cmpq      %rbx, %r14                                    #1244.13
-        jb        ..B16.15      # Prob 82%                      #1244.13
-                                # LOE rax rdx rcx rbx rbp r12 r13 r14 r15 r8d r9d
-..B16.19:                       # Preds ..B16.63 ..B16.62 ..B16.15 ..B16.17
-        cmpq      %rax, %r14                                    #1244.13
-        ja        ..B16.50      # Prob 12%                      #1244.13
-                                # LOE rax rdx rbx rbp r12 r13 r14 r15 r8d r9d
-..B16.20:                       # Preds ..B16.19
-        movl      $22, (%r12)                                   #1244.13
-        movq      %r14, %rax                                    #1244.13
-                                # LOE rax rbp r13 r15
-..B16.21:                       # Preds ..B16.20
-..___tag_value_nss_fasta_expr.855:                              #1252.12
-        popq      %rbx                                          #1252.12
-..___tag_value_nss_fasta_expr.856:                              #
-        popq      %r12                                          #1252.12
-..___tag_value_nss_fasta_expr.858:                              #
-        popq      %r14                                          #1252.12
-..___tag_value_nss_fasta_expr.860:                              #
-        ret                                                     #1252.12
-..___tag_value_nss_fasta_expr.861:                              #
-                                # LOE
-..B16.22:                       # Preds ..B16.11
-        movq      %rax, %r14                                    #1234.1
-        cmpq      %rbx, %rax                                    #1249.16
-        jae       ..B16.30      # Prob 44%                      #1249.16
-                                # LOE rax rdx rbx rbp r12 r13 r14 r15 r8d
-..B16.24:                       # Preds ..B16.22
-        xorl      %r9d, %r9d                                    #1249.16
-        lea       fasta_2na_map.0(%rip), %rcx                   #1249.16
-                                # LOE rax rdx rcx rbx rbp r12 r13 r14 r15 r8d r9d
-..B16.25:                       # Preds ..B16.27 ..B16.24
-        movsbl    (%r14), %r10d                                 #1249.16
-        testl     %r10d, %r10d                                  #1249.16
-        jl        ..B16.29      # Prob 20%                      #1249.16
-                                # LOE rax rdx rcx rbx rbp r12 r13 r14 r15 r8d r9d
-..B16.26:                       # Preds ..B16.25
-        movzbl    (%r14), %r10d                                 #1249.16
-        movsbl    (%r10,%rcx), %r11d                            #1249.16
-        testl     %r11d, %r11d                                  #1249.16
-        jl        ..B16.73      # Prob 16%                      #1249.16
-                                # LOE rax rdx rcx rbx rbp r12 r13 r14 r15 r8d r9d r10d
-..B16.27:                       # Preds ..B16.75 ..B16.26
-        incq      %r14                                          #1249.16
-        cmpq      %rbx, %r14                                    #1249.16
-        jb        ..B16.25      # Prob 82%                      #1249.16
-                                # LOE rax rdx rcx rbx rbp r12 r13 r14 r15 r8d r9d
-..B16.29:                       # Preds ..B16.74 ..B16.73 ..B16.25 ..B16.27
-        cmpq      %rax, %r14                                    #1249.16
-        ja        ..B16.68      # Prob 12%                      #1249.16
-                                # LOE rax rdx rbp r12 r13 r14 r15 r8d r9d
-..B16.30:                       # Preds ..B16.22 ..B16.29
-        movl      $22, (%r12)                                   #1249.16
-                                # LOE rbp r13 r14 r15
-..B16.31:                       # Preds ..B16.30 ..B16.70 ..B16.72
-        movq      %r14, %rax                                    #1249.16
-..___tag_value_nss_fasta_expr.865:                              #1249.16
-        popq      %rbx                                          #1249.16
-..___tag_value_nss_fasta_expr.866:                              #
-        popq      %r12                                          #1249.16
-..___tag_value_nss_fasta_expr.868:                              #
-        popq      %r14                                          #1249.16
-..___tag_value_nss_fasta_expr.870:                              #
-        ret                                                     #1249.16
-..___tag_value_nss_fasta_expr.871:                              #
-                                # LOE
-..B16.32:                       # Preds ..B16.9                 # Infreq
-        testl     %r9d, %r9d                                    #1239.13
-        jne       ..B16.35      # Prob 50%                      #1239.13
-                                # LOE rax rdx rbx rbp r12 r13 r14 r15 r8d
-..B16.33:                       # Preds ..B16.32                # Infreq
-        movq      %r14, %rcx                                    #1239.13
-        subq      %rax, %rcx                                    #1239.13
-        movq      %rdx, %rdi                                    #1239.13
-        movl      %r8d, %esi                                    #1239.13
-        movq      %rax, %rdx                                    #1239.13
-        call      NucStrFastaExprMake2 at PLT                      #1239.13
-        jmp       ..B16.82      # Prob 100%                     #1239.13
-                                # LOE rbx rbp r12 r13 r14 r15 eax
-..B16.35:                       # Preds ..B16.32                # Infreq
-        movq      %r14, %rcx                                    #1239.13
-        subq      %rax, %rcx                                    #1239.13
-        movq      %rdx, %rdi                                    #1239.13
-        movl      %r8d, %esi                                    #1239.13
-        movq      %rax, %rdx                                    #1239.13
-        call      NucStrFastaExprMake4 at PLT                      #1239.13
-                                # LOE rbx rbp r12 r13 r14 r15 eax
-..B16.82:                       # Preds ..B16.33 ..B16.35       # Infreq
-        movl      %eax, %esi                                    #1239.13
-                                # LOE rbx rbp r12 r13 r14 r15 esi
-..B16.37:                       # Preds ..B16.82                # Infreq
-        movq      %r14, %rax                                    #1239.13
-        testl     %esi, %esi                                    #1240.26
-        jne       ..B16.41      # Prob 50%                      #1240.26
-                                # LOE rax rbx rbp r12 r13 r14 r15 esi
-..B16.38:                       # Preds ..B16.37                # Infreq
-        cmpq      %rbx, %r14                                    #1240.38
-        je        ..B16.3       # Prob 12%                      #1240.38
-                                # LOE rax rbp r12 r13 r14 r15 esi
-..B16.39:                       # Preds ..B16.38                # Infreq
-        movsbl    (%r14), %ecx                                  #1240.47
-        lea       1(%r14), %rax                                 #1240.47
-        cmpl      $39, %ecx                                     #1240.55
-        je        ..B16.41      # Prob 16%                      #1240.55
-                                # LOE rax rbp r12 r13 r15 esi
-..B16.40:                       # Preds ..B16.39                # Infreq
-        movl      $22, (%r12)                                   #1241.13
-..___tag_value_nss_fasta_expr.875:                              #1241.13
-        popq      %rbx                                          #1241.13
-..___tag_value_nss_fasta_expr.876:                              #
-        popq      %r12                                          #1241.13
-..___tag_value_nss_fasta_expr.878:                              #
-        popq      %r14                                          #1241.13
-..___tag_value_nss_fasta_expr.880:                              #
-        ret                                                     #1241.13
-..___tag_value_nss_fasta_expr.881:                              #
-                                # LOE rax rbp r13 r15
-..B16.41:                       # Preds ..B16.55 ..B16.57 ..B16.37 ..B16.39 # Infreq
-        movl      %esi, (%r12)                                  #1241.13
-..___tag_value_nss_fasta_expr.885:                              #1241.13
-        popq      %rbx                                          #1241.13
-..___tag_value_nss_fasta_expr.886:                              #
-        popq      %r12                                          #1241.13
-..___tag_value_nss_fasta_expr.888:                              #
-        popq      %r14                                          #1241.13
-..___tag_value_nss_fasta_expr.890:                              #
-        ret                                                     #1241.13
-..___tag_value_nss_fasta_expr.891:                              #
-                                # LOE rax rbp r13 r15
-..B16.44:                       # Preds ..B16.6                 # Infreq
-        lea       fasta_4na_map.0(%rip), %r11                   #1239.13
-        cmpq      %r11, %rcx                                    #1239.13
-        je        ..B16.9       # Prob 20%                      #1239.13
-                                # LOE rax rdx rbx rbp r12 r13 r14 r15 r8d r9d r10d
-..B16.45:                       # Preds ..B16.44                # Infreq
-        movl      %r10d, %r10d                                  #1239.13
-        lea       fasta_4na_map.0(%rip), %rcx                   #1239.13
-        movsbl    (%rcx,%r10), %r11d                            #1239.13
-        testl     %r11d, %r11d                                  #1239.13
-        jl        ..B16.9       # Prob 20%                      #1239.13
-                                # LOE rax rdx rbx rbp r12 r13 r14 r15 r8d r9d
-..B16.46:                       # Preds ..B16.45                # Infreq
-        movl      $1, %r9d                                      #1239.13
-        lea       fasta_4na_map.0(%rip), %rcx                   #1239.13
-        jmp       ..B16.7       # Prob 100%                     #1239.13
-                                # LOE rax rdx rcx rbx rbp r12 r13 r14 r15 r8d r9d
-..B16.50:                       # Preds ..B16.19                # Infreq
-        testl     %r9d, %r9d                                    #1244.13
-        jne       ..B16.53      # Prob 50%                      #1244.13
-                                # LOE rax rdx rbx rbp r12 r13 r14 r15 r8d
-..B16.51:                       # Preds ..B16.50                # Infreq
-        movq      %r14, %rcx                                    #1244.13
-        subq      %rax, %rcx                                    #1244.13
-        movq      %rdx, %rdi                                    #1244.13
-        movl      %r8d, %esi                                    #1244.13
-        movq      %rax, %rdx                                    #1244.13
-        call      NucStrFastaExprMake2 at PLT                      #1244.13
-        jmp       ..B16.84      # Prob 100%                     #1244.13
-                                # LOE rbx rbp r12 r13 r14 r15 eax
-..B16.53:                       # Preds ..B16.50                # Infreq
-        movq      %r14, %rcx                                    #1244.13
-        subq      %rax, %rcx                                    #1244.13
-        movq      %rdx, %rdi                                    #1244.13
-        movl      %r8d, %esi                                    #1244.13
-        movq      %rax, %rdx                                    #1244.13
-        call      NucStrFastaExprMake4 at PLT                      #1244.13
-                                # LOE rbx rbp r12 r13 r14 r15 eax
-..B16.84:                       # Preds ..B16.51 ..B16.53       # Infreq
-        movl      %eax, %esi                                    #1244.13
-                                # LOE rbx rbp r12 r13 r14 r15 esi
-..B16.55:                       # Preds ..B16.84                # Infreq
-        movq      %r14, %rax                                    #1244.13
-        testl     %esi, %esi                                    #1245.26
-        jne       ..B16.41      # Prob 50%                      #1245.26
-                                # LOE rax rbx rbp r12 r13 r14 r15 esi
-..B16.56:                       # Preds ..B16.55                # Infreq
-        cmpq      %rbx, %r14                                    #1245.38
-        je        ..B16.3       # Prob 12%                      #1245.38
-                                # LOE rax rbp r12 r13 r14 r15 esi
-..B16.57:                       # Preds ..B16.56                # Infreq
-        movsbl    (%r14), %ecx                                  #1245.47
-        lea       1(%r14), %rax                                 #1245.47
-        cmpl      $34, %ecx                                     #1245.55
-        je        ..B16.41      # Prob 16%                      #1245.55
-                                # LOE rax rbp r12 r13 r15 esi
-..B16.58:                       # Preds ..B16.57                # Infreq
-        movl      $22, (%r12)                                   #1246.13
-..___tag_value_nss_fasta_expr.895:                              #1246.13
-        popq      %rbx                                          #1246.13
-..___tag_value_nss_fasta_expr.896:                              #
-        popq      %r12                                          #1246.13
-..___tag_value_nss_fasta_expr.898:                              #
-        popq      %r14                                          #1246.13
-..___tag_value_nss_fasta_expr.900:                              #
-        ret                                                     #1246.13
-..___tag_value_nss_fasta_expr.901:                              #
-                                # LOE rax rbp r13 r15
-..B16.62:                       # Preds ..B16.16                # Infreq
-        lea       fasta_4na_map.0(%rip), %r11                   #1244.13
-        cmpq      %r11, %rcx                                    #1244.13
-        je        ..B16.19      # Prob 20%                      #1244.13
-                                # LOE rax rdx rbx rbp r12 r13 r14 r15 r8d r9d r10d
-..B16.63:                       # Preds ..B16.62                # Infreq
-        movl      %r10d, %r10d                                  #1244.13
-        lea       fasta_4na_map.0(%rip), %rcx                   #1244.13
-        movsbl    (%rcx,%r10), %r11d                            #1244.13
-        testl     %r11d, %r11d                                  #1244.13
-        jl        ..B16.19      # Prob 20%                      #1244.13
-                                # LOE rax rdx rbx rbp r12 r13 r14 r15 r8d r9d
-..B16.64:                       # Preds ..B16.63                # Infreq
-        movl      $1, %r9d                                      #1244.13
-        lea       fasta_4na_map.0(%rip), %rcx                   #1244.13
-        jmp       ..B16.17      # Prob 100%                     #1244.13
-                                # LOE rax rdx rcx rbx rbp r12 r13 r14 r15 r8d r9d
-..B16.68:                       # Preds ..B16.29                # Infreq
-        testl     %r9d, %r9d                                    #1249.16
-        jne       ..B16.71      # Prob 50%                      #1249.16
-                                # LOE rax rdx rbp r12 r13 r14 r15 r8d
-..B16.69:                       # Preds ..B16.68                # Infreq
-        movq      %r14, %rcx                                    #1249.16
-        subq      %rax, %rcx                                    #1249.16
-        movq      %rdx, %rdi                                    #1249.16
-        movl      %r8d, %esi                                    #1249.16
-        movq      %rax, %rdx                                    #1249.16
-        call      NucStrFastaExprMake2 at PLT                      #1249.16
-                                # LOE rbp r12 r13 r14 r15 eax
-..B16.70:                       # Preds ..B16.69                # Infreq
-        movl      %eax, (%r12)                                  #1249.16
-        jmp       ..B16.31      # Prob 100%                     #1249.16
-                                # LOE rbp r13 r14 r15
-..B16.71:                       # Preds ..B16.68                # Infreq
-        movq      %r14, %rcx                                    #1249.16
-        subq      %rax, %rcx                                    #1249.16
-        movq      %rdx, %rdi                                    #1249.16
-        movl      %r8d, %esi                                    #1249.16
-        movq      %rax, %rdx                                    #1249.16
-        call      NucStrFastaExprMake4 at PLT                      #1249.16
-                                # LOE rbp r12 r13 r14 r15 eax
-..B16.72:                       # Preds ..B16.71                # Infreq
-        movl      %eax, (%r12)                                  #1249.16
-        jmp       ..B16.31      # Prob 100%                     #1249.16
-                                # LOE rbp r13 r14 r15
-..B16.73:                       # Preds ..B16.26                # Infreq
-        lea       fasta_4na_map.0(%rip), %r11                   #1249.16
-        cmpq      %r11, %rcx                                    #1249.16
-        je        ..B16.29      # Prob 20%                      #1249.16
-                                # LOE rax rdx rbx rbp r12 r13 r14 r15 r8d r9d r10d
-..B16.74:                       # Preds ..B16.73                # Infreq
-        movl      %r10d, %r10d                                  #1249.16
-        lea       fasta_4na_map.0(%rip), %rcx                   #1249.16
-        movsbl    (%rcx,%r10), %r11d                            #1249.16
-        testl     %r11d, %r11d                                  #1249.16
-        jl        ..B16.29      # Prob 20%                      #1249.16
-                                # LOE rax rdx rbx rbp r12 r13 r14 r15 r8d r9d
-..B16.75:                       # Preds ..B16.74                # Infreq
-        movl      $1, %r9d                                      #1249.16
-        lea       fasta_4na_map.0(%rip), %rcx                   #1249.16
-        jmp       ..B16.27      # Prob 100%                     #1249.16
-        .align    16,0x90
-..___tag_value_nss_fasta_expr.905:                              #
-                                # LOE rax rdx rcx rbx rbp r12 r13 r14 r15 r8d r9d
-# mark_end;
-	.type	nss_fasta_expr, at function
-	.size	nss_fasta_expr,.-nss_fasta_expr
-	.data
-# -- End  nss_fasta_expr
-	.text
-# -- Begin  NucStrFastaExprMake2
-# mark_begin;
-       .align    16,0x90
-NucStrFastaExprMake2:
-# parameter 1: %rdi
-# parameter 2: %esi
-# parameter 3: %rdx
-# parameter 4: %rcx
-..B17.1:                        # Preds ..B17.0
-..___tag_value_NucStrFastaExprMake2.906:                        #838.1
-        pushq     %r13                                          #838.1
-..___tag_value_NucStrFastaExprMake2.908:                        #
-        pushq     %r12                                          #838.1
-..___tag_value_NucStrFastaExprMake2.910:                        #
-        pushq     %rbp                                          #838.1
-..___tag_value_NucStrFastaExprMake2.912:                        #
-        pushq     %rbx                                          #838.1
-..___tag_value_NucStrFastaExprMake2.914:                        #
-        subq      $40, %rsp                                     #838.1
-..___tag_value_NucStrFastaExprMake2.916:                        #
-        movq      %rcx, %r12                                    #838.1
-        movq      %rdx, %rbp                                    #838.1
-        movl      %esi, %r13d                                   #838.1
-        movq      %rdi, %rbx                                    #838.1
-        cmpq      $61, %r12                                     #844.17
-        jbe       ..B17.3       # Prob 43%                      #844.17
-                                # LOE rbx rbp r12 r14 r15 r13d
-..B17.2:                        # Preds ..B17.1
-        movl      $7, %eax                                      #845.16
-        addq      $40, %rsp                                     #845.16
-..___tag_value_NucStrFastaExprMake2.917:                        #
-        popq      %rbx                                          #845.16
-..___tag_value_NucStrFastaExprMake2.919:                        #
-        popq      %rbp                                          #845.16
-..___tag_value_NucStrFastaExprMake2.921:                        #
-        popq      %r12                                          #845.16
-..___tag_value_NucStrFastaExprMake2.923:                        #
-        popq      %r13                                          #845.16
-..___tag_value_NucStrFastaExprMake2.925:                        #
-        ret                                                     #845.16
-..___tag_value_NucStrFastaExprMake2.926:                        #
-                                # LOE
-..B17.3:                        # Preds ..B17.1
-        movl      $160, %edi                                    #847.9
-        call      malloc at PLT                                    #847.9
-                                # LOE rax rbx rbp r12 r14 r15 r13d
-..B17.4:                        # Preds ..B17.3
-        testq     %rax, %rax                                    #847.9
-        je        ..B17.44      # Prob 12%                      #847.9
-                                # LOE rax rbx rbp r12 r14 r15 r13d
-..B17.5:                        # Preds ..B17.4
-        lea       15(%rax), %rdx                                #847.9
-        andq      $-16, %rdx                                    #847.9
-        movq      %rax, 8(%rdx)                                 #847.9
-        je        ..B17.44      # Prob 5%                       #848.15
-                                # LOE rdx rbx rbp r12 r14 r15 r13d
-..B17.6:                        # Preds ..B17.5
-        movq      %rdx, (%rbx)                                  #851.5
-        movl      %r12d, 4(%rdx)                                #852.5
-        xorl      %esi, %esi                                    #856.11
-        testq     %r12, %r12                                    #856.22
-        jbe       ..B17.17      # Prob 16%                      #856.22
-                                # LOE rdx rbp rsi r12 r14 r15 r13d
-..B17.8:                        # Preds ..B17.6 ..B17.15
-        movsbq    (%rsi,%rbp), %rcx                             #858.48
-        lea       fasta_2na_map.0(%rip), %rax                   #858.24
-        movzbl    (%rax,%rcx), %ecx                             #858.24
-        movq      %rsi, %rax                                    #859.22
-        andq      $3, %rax                                      #859.22
-        je        ..B17.43      # Prob 20%                      #859.22
-                                # LOE rax rdx rbp rsi r12 r14 r15 ecx r13d
-..B17.9:                        # Preds ..B17.8
-        cmpq      $1, %rax                                      #859.22
-        je        ..B17.14      # Prob 25%                      #859.22
-                                # LOE rax rdx rbp rsi r12 r14 r15 ecx r13d
-..B17.10:                       # Preds ..B17.9
-        cmpq      $2, %rax                                      #859.22
-        jne       ..B17.12      # Prob 67%                      #859.22
-                                # LOE rax rdx rbp rsi r12 r14 r15 ecx r13d
-..B17.11:                       # Preds ..B17.10
-        movq      %rsi, %rax                                    #870.32
-        shrq      $2, %rax                                      #870.32
-        shll      $2, %ecx                                      #870.47
-        orb       %cl, (%rsp,%rax)                              #870.13
-        orb       $12, 16(%rsp,%rax)                            #871.13
-        jmp       ..B17.15      # Prob 100%                     #871.13
-                                # LOE rdx rbp rsi r12 r14 r15 r13d
-..B17.12:                       # Preds ..B17.10
-        cmpq      $3, %rax                                      #859.22
-        jne       ..B17.15      # Prob 50%                      #859.22
-                                # LOE rdx rbp rsi r12 r14 r15 ecx r13d
-..B17.13:                       # Preds ..B17.12
-        movq      %rsi, %rax                                    #874.32
-        shrq      $2, %rax                                      #874.32
-        orb       %cl, (%rsp,%rax)                              #874.13
-        orb       $3, 16(%rsp,%rax)                             #875.13
-        jmp       ..B17.15      # Prob 100%                     #875.13
-                                # LOE rdx rbp rsi r12 r14 r15 r13d
-..B17.14:                       # Preds ..B17.9
-        movq      %rsi, %rax                                    #866.32
-        shrq      $2, %rax                                      #866.32
-        shll      $4, %ecx                                      #866.47
-        orb       %cl, (%rsp,%rax)                              #866.13
-        orb       $48, 16(%rsp,%rax)                            #867.13
-                                # LOE rdx rbp rsi r12 r14 r15 r13d
-..B17.15:                       # Preds ..B17.12 ..B17.43 ..B17.14 ..B17.11 ..B17.13
-                                #      
-        incq      %rsi                                          #856.31
-        cmpq      %r12, %rsi                                    #856.22
-        jb        ..B17.8       # Prob 82%                      #856.22
-                                # LOE rdx rbp rsi r12 r14 r15 r13d
-..B17.17:                       # Preds ..B17.15 ..B17.6
-        addq      $3, %rsi                                      #881.21
-        shrq      $2, %rsi                                      #881.28
-        cmpq      $16, %rsi                                     #881.35
-        jae       ..B17.30      # Prob 50%                      #881.35
-                                # LOE rdx rsi r12 r14 r15 r13d
-..B17.18:                       # Preds ..B17.17
-        lea       (%rsp), %rax                                  #883.9
-        movq      %rsi, %rbp                                    #881.5
-        negq      %rbp                                          #881.5
-        addq      $16, %rbp                                     #881.5
-        lea       (%rax,%rsi), %rbx                             #881.5
-        movq      %rbx, %rax                                    #881.5
-        andq      $15, %rax                                     #881.5
-        movq      %rax, %rcx                                    #881.5
-        negq      %rcx                                          #881.5
-        addq      $16, %rcx                                     #881.5
-        cmpq      $0, %rax                                      #881.5
-        cmovne    %rcx, %rax                                    #881.5
-        lea       16(%rax), %r8                                 #881.5
-        cmpq      %r8, %rbp                                     #881.5
-        jl        ..B17.42      # Prob 10%                      #881.5
-                                # LOE rax rdx rbx rbp rsi r12 r14 r15 r13d
-..B17.19:                       # Preds ..B17.18
-        movq      %rbp, %rcx                                    #881.5
-        subq      %rax, %rcx                                    #881.5
-        andq      $15, %rcx                                     #881.5
-        negq      %rcx                                          #881.5
-        addq      %rbp, %rcx                                    #881.5
-        xorl      %r9d, %r9d                                    #881.5
-        testq     %rax, %rax                                    #881.5
-        jbe       ..B17.23      # Prob 10%                      #881.5
-                                # LOE rax rdx rcx rbx rbp rsi r9 r12 r14 r15 r13d
-..B17.20:                       # Preds ..B17.19
-        lea       16(%rsp), %r8                                 #884.9
-        addq      %rsi, %r8                                     #
-                                # LOE rax rdx rcx rbx rbp rsi r8 r9 r12 r14 r15 r13d
-..B17.21:                       # Preds ..B17.21 ..B17.20
-        xorl      %r10d, %r10d                                  #883.9
-        movb      %r10b, (%r9,%rbx)                             #883.9
-        movb      %r10b, (%r9,%r8)                              #884.9
-        incq      %r9                                           #881.5
-        cmpq      %rax, %r9                                     #881.5
-        jb        ..B17.21      # Prob 82%                      #881.5
-                                # LOE rax rdx rcx rbx rbp rsi r8 r9 r12 r14 r15 r13d
-..B17.23:                       # Preds ..B17.21 ..B17.19
-        lea       (%rsp), %r9                                   #883.9
-        lea       16(%rsp), %r8                                 #884.9
-        addq      %rsi, %r9                                     #
-        addq      %rsi, %r8                                     #
-        pxor      %xmm0, %xmm0                                  #883.29
-                                # LOE rax rdx rcx rbx rbp rsi r8 r9 r12 r14 r15 r13d xmm0
-..B17.24:                       # Preds ..B17.24 ..B17.23
-        movdqa    %xmm0, (%rax,%r9)                             #883.9
-        movdqa    %xmm0, (%rax,%r8)                             #884.9
-        addq      $16, %rax                                     #881.5
-        cmpq      %rcx, %rax                                    #881.5
-        jb        ..B17.24      # Prob 82%                      #881.5
-                                # LOE rax rdx rcx rbx rbp rsi r8 r9 r12 r14 r15 r13d xmm0
-..B17.26:                       # Preds ..B17.24 ..B17.42
-        cmpq      %rbp, %rcx                                    #881.5
-        jae       ..B17.30      # Prob 10%                      #881.5
-                                # LOE rdx rcx rbx rbp rsi r12 r14 r15 r13d
-..B17.27:                       # Preds ..B17.26
-        lea       16(%rsp), %rax                                #884.9
-        addq      %rax, %rsi                                    #
-                                # LOE rdx rcx rbx rbp rsi r12 r14 r15 r13d
-..B17.28:                       # Preds ..B17.28 ..B17.27
-        xorl      %eax, %eax                                    #883.9
-        movb      %al, (%rcx,%rbx)                              #883.9
-        movb      %al, (%rcx,%rsi)                              #884.9
-        incq      %rcx                                          #881.5
-        cmpq      %rbp, %rcx                                    #881.5
-        jb        ..B17.28      # Prob 82%                      #881.5
-                                # LOE rdx rcx rbx rbp rsi r12 r14 r15 r13d
-..B17.30:                       # Preds ..B17.28 ..B17.26 ..B17.17
-        testl     %r13d, %r13d                                  #890.10
-        je        ..B17.32      # Prob 50%                      #890.10
-                                # LOE rdx r12 r14 r15
-..B17.31:                       # Preds ..B17.30
-        movl      $9, (%rdx)                                    #892.9
-        jmp       ..B17.41      # Prob 100%                     #892.9
-                                # LOE rdx r14 r15
-..B17.32:                       # Preds ..B17.30
-        cmpq      $2, %r12                                      #896.22
-        jae       ..B17.34      # Prob 50%                      #896.22
-                                # LOE rdx r12 r14 r15
-..B17.33:                       # Preds ..B17.32
-        movzbl    (%rsp), %eax                                  #898.29
-        movzbl    16(%rsp), %esi                                #903.26
-        movl      $2, (%rdx)                                    #908.9
-        movb      %al, 1(%rsp)                                  #898.9
-        movzwl    (%rsp), %ecx                                  #899.29
-        movw      %cx, 2(%rsp)                                  #899.9
-        movl      (%rsp), %ebx                                  #900.29
-        movl      (%rsp), %ebp                                  #901.29
-        movl      %ebx, 4(%rsp)                                 #900.9
-        movb      %sil, 17(%rsp)                                #903.9
-        movzwl    16(%rsp), %r8d                                #904.26
-        movw      %r8w, 18(%rsp)                                #904.9
-        movl      16(%rsp), %r9d                                #905.26
-        movl      16(%rsp), %r10d                               #906.26
-        movl      %r9d, 20(%rsp)                                #905.9
-        movl      %ebx, %ebx                                    #900.9
-        shlq      $32, %rbx                                     #901.29
-        movl      %r9d, %r9d                                    #905.9
-        shlq      $32, %r9                                      #906.26
-        orq       %rbp, %rbx                                    #901.29
-        movq      %rbx, 8(%rsp)                                 #901.9
-        orq       %r10, %r9                                     #906.26
-        movq      %r9, 24(%rsp)                                 #906.9
-        jmp       ..B17.41      # Prob 100%                     #906.9
-                                # LOE rdx r14 r15
-..B17.34:                       # Preds ..B17.32
-        cmpq      $6, %r12                                      #910.22
-        jae       ..B17.36      # Prob 50%                      #910.22
-                                # LOE rdx r12 r14 r15
-..B17.35:                       # Preds ..B17.34
-        movzwl    (%rsp), %eax                                  #912.29
-        movzwl    16(%rsp), %ebp                                #916.26
-        movl      $3, (%rdx)                                    #920.9
-        movw      %ax, 2(%rsp)                                  #912.9
-        movl      (%rsp), %ecx                                  #913.29
-        movl      (%rsp), %ebx                                  #914.29
-        movl      %ecx, 4(%rsp)                                 #913.9
-        movw      %bp, 18(%rsp)                                 #916.9
-        movl      16(%rsp), %esi                                #917.26
-        movl      16(%rsp), %r8d                                #918.26
-        movl      %esi, 20(%rsp)                                #917.9
-        movl      %ecx, %ecx                                    #913.9
-        shlq      $32, %rcx                                     #914.29
-        movl      %esi, %esi                                    #917.9
-        shlq      $32, %rsi                                     #918.26
-        orq       %rbx, %rcx                                    #914.29
-        movq      %rcx, 8(%rsp)                                 #914.9
-        orq       %r8, %rsi                                     #918.26
-        movq      %rsi, 24(%rsp)                                #918.9
-        jmp       ..B17.41      # Prob 100%                     #918.9
-                                # LOE rdx r14 r15
-..B17.36:                       # Preds ..B17.34
-        cmpq      $14, %r12                                     #922.22
-        jae       ..B17.38      # Prob 50%                      #922.22
-                                # LOE rdx r12 r14 r15
-..B17.37:                       # Preds ..B17.36
-        movl      (%rsp), %eax                                  #924.29
-        movl      (%rsp), %ecx                                  #925.29
-        movl      16(%rsp), %ebx                                #927.26
-        movl      16(%rsp), %ebp                                #928.26
-        movl      %eax, 4(%rsp)                                 #924.9
-        movl      $4, (%rdx)                                    #930.9
-        movl      %eax, %eax                                    #924.9
-        shlq      $32, %rax                                     #925.29
-        movl      %ebx, 20(%rsp)                                #927.9
-        movl      %ebx, %ebx                                    #927.9
-        shlq      $32, %rbx                                     #928.26
-        orq       %rcx, %rax                                    #925.29
-        movq      %rax, 8(%rsp)                                 #925.9
-        orq       %rbp, %rbx                                    #928.26
-        movq      %rbx, 24(%rsp)                                #928.9
-        jmp       ..B17.41      # Prob 100%                     #928.9
-                                # LOE rdx r14 r15
-..B17.38:                       # Preds ..B17.36
-        cmpq      $30, %r12                                     #932.22
-        jae       ..B17.40      # Prob 50%                      #932.22
-                                # LOE rdx r14 r15
-..B17.39:                       # Preds ..B17.38
-        movq      (%rsp), %rax                                  #934.29
-        movq      16(%rsp), %rcx                                #935.26
-        movl      $0, (%rdx)                                    #937.9
-        movq      %rax, 8(%rsp)                                 #934.9
-        movq      %rcx, 24(%rsp)                                #935.9
-        jmp       ..B17.41      # Prob 100%                     #935.9
-                                # LOE rdx r14 r15
-..B17.40:                       # Preds ..B17.38
-        movl      $5, (%rdx)                                    #941.9
-                                # LOE rdx r14 r15
-..B17.41:                       # Preds ..B17.31 ..B17.33 ..B17.35 ..B17.37 ..B17.39
-                                #       ..B17.40
-        movq      (%rsp), %rcx                                  #944.42
-        lea       (%rsp), %rdi                                  #948.5
-        movq      %rcx, 16(%rdx)                                #944.42
-        movq      8(%rsp), %r8                                  #944.42
-        movq      %r8, 24(%rdx)                                 #944.42
-        movl      $2, %esi                                      #952.5
-        movq      16(%rsp), %r9                                 #945.39
-        movq      %r9, 32(%rdx)                                 #945.39
-        movq      24(%rsp), %r10                                #945.39
-        movq      %r10, 40(%rdx)                                #945.39
-        movq      (%rdi), %rax                                  #948.5
-        movq      8(%rdi), %rcx                                 #948.5
-        bswap     %rax                                          #948.5
-        bswap     %rcx                                          #948.5
-        movq      %rax, 8(%rdi)                                 #948.5
-        movq      %rcx, (%rdi)                                  #948.5
-        lea       16(%rsp), %rdi                                #949.5
-        movq      (%rdi), %rax                                  #949.5
-        movq      8(%rdi), %rcx                                 #949.5
-        bswap     %rax                                          #949.5
-        bswap     %rcx                                          #949.5
-        movq      %rax, 8(%rdi)                                 #949.5
-        movq      %rcx, (%rdi)                                  #949.5
-        lea       (%rsp), %rdi                                  #952.5
-        movl      %esi, %ecx                                    #952.5
-        movq      8(%rdi), %rax                                 #952.5
-        shrdq     %cl, %rax, (%rdi)                             #952.5
-        shrq      %cl, %rax                                     #952.5
-        movq      %rax, 8(%rdi)                                 #952.5
-        lea       16(%rsp), %rdi                                #953.5
-        movl      %esi, %ecx                                    #953.5
-        movq      8(%rdi), %rax                                 #953.5
-        shrdq     %cl, %rax, (%rdi)                             #953.5
-        shrq      %cl, %rax                                     #953.5
-        movq      %rax, 8(%rdi)                                 #953.5
-        lea       (%rsp), %rsi                                  #956.5
-        lea       48(%rdx), %rdi                                #956.5
-        movq      (%rsi), %rax                                  #956.5
-        movq      8(%rsi), %rcx                                 #956.5
-        bswap     %rax                                          #956.5
-        bswap     %rcx                                          #956.5
-        movq      %rax, 8(%rdi)                                 #956.5
-        movq      %rcx, (%rdi)                                  #956.5
-        lea       16(%rsp), %rsi                                #957.5
-        lea       64(%rdx), %rdi                                #957.5
-        movq      (%rsi), %rax                                  #957.5
-        movq      8(%rsi), %rcx                                 #957.5
-        bswap     %rax                                          #957.5
-        bswap     %rcx                                          #957.5
-        movq      %rax, 8(%rdi)                                 #957.5
-        movq      %rcx, (%rdi)                                  #957.5
-        lea       (%rsp), %rdi                                  #959.5
-        movl      $2, %esi                                      #959.5
-        movl      %esi, %ecx                                    #959.5
-        movq      8(%rdi), %rax                                 #959.5
-        shrdq     %cl, %rax, (%rdi)                             #959.5
-        shrq      %cl, %rax                                     #959.5
-        movq      %rax, 8(%rdi)                                 #959.5
-        lea       16(%rsp), %rdi                                #960.5
-        movl      %esi, %ecx                                    #960.5
-        movq      8(%rdi), %rax                                 #960.5
-        shrdq     %cl, %rax, (%rdi)                             #960.5
-        shrq      %cl, %rax                                     #960.5
-        movq      %rax, 8(%rdi)                                 #960.5
-        lea       (%rsp), %rsi                                  #962.5
-        lea       80(%rdx), %rdi                                #962.5
-        movq      (%rsi), %rax                                  #962.5
-        movq      8(%rsi), %rcx                                 #962.5
-        bswap     %rax                                          #962.5
-        bswap     %rcx                                          #962.5
-        movq      %rax, 8(%rdi)                                 #962.5
-        movq      %rcx, (%rdi)                                  #962.5
-        lea       16(%rsp), %rsi                                #963.5
-        lea       96(%rdx), %rdi                                #963.5
-        movq      (%rsi), %rax                                  #963.5
-        movq      8(%rsi), %rcx                                 #963.5
-        bswap     %rax                                          #963.5
-        bswap     %rcx                                          #963.5
-        movq      %rax, 8(%rdi)                                 #963.5
-        movq      %rcx, (%rdi)                                  #963.5
-        lea       (%rsp), %rdi                                  #965.5
-        movl      $2, %esi                                      #965.5
-        movl      %esi, %ecx                                    #965.5
-        movq      8(%rdi), %rax                                 #965.5
-        shrdq     %cl, %rax, (%rdi)                             #965.5
-        shrq      %cl, %rax                                     #965.5
-        movq      %rax, 8(%rdi)                                 #965.5
-        lea       16(%rsp), %rdi                                #966.5
-        movl      %esi, %ecx                                    #966.5
-        movq      8(%rdi), %rax                                 #966.5
-        shrdq     %cl, %rax, (%rdi)                             #966.5
-        shrq      %cl, %rax                                     #966.5
-        movq      %rax, 8(%rdi)                                 #966.5
-        lea       (%rsp), %rsi                                  #968.5
-        lea       112(%rdx), %rdi                               #968.5
-        addq      $128, %rdx                                    #969.5
-        movq      (%rsi), %rax                                  #968.5
-        movq      8(%rsi), %rcx                                 #968.5
-        bswap     %rax                                          #968.5
-        bswap     %rcx                                          #968.5
-        movq      %rax, 8(%rdi)                                 #968.5
-        movq      %rcx, (%rdi)                                  #968.5
-        lea       16(%rsp), %rsi                                #969.5
-        movq      %rdx, %rdi                                    #969.5
-        movq      (%rsi), %rax                                  #969.5
-        movq      8(%rsi), %rcx                                 #969.5
-        bswap     %rax                                          #969.5
-        bswap     %rcx                                          #969.5
-        movq      %rax, 8(%rdi)                                 #969.5
-        movq      %rcx, (%rdi)                                  #969.5
-        xorl      %eax, %eax                                    #1011.12
-        addq      $40, %rsp                                     #1011.12
-..___tag_value_NucStrFastaExprMake2.931:                        #
-        popq      %rbx                                          #1011.12
-..___tag_value_NucStrFastaExprMake2.933:                        #
-        popq      %rbp                                          #1011.12
-..___tag_value_NucStrFastaExprMake2.935:                        #
-        popq      %r12                                          #1011.12
-..___tag_value_NucStrFastaExprMake2.937:                        #
-        popq      %r13                                          #1011.12
-..___tag_value_NucStrFastaExprMake2.939:                        #
-        ret                                                     #1011.12
-..___tag_value_NucStrFastaExprMake2.940:                        #
-                                # LOE
-..B17.42:                       # Preds ..B17.18                # Infreq
-        xorl      %ecx, %ecx                                    #881.5
-        jmp       ..B17.26      # Prob 100%                     #881.5
-                                # LOE rdx rcx rbx rbp rsi r12 r14 r15 r13d
-..B17.43:                       # Preds ..B17.8                 # Infreq
-        movq      %rsi, %rax                                    #862.32
-        shrq      $2, %rax                                      #862.32
-        shll      $6, %ecx                                      #862.46
-        movb      %cl, (%rsp,%rax)                              #862.13
-        movb      $192, 16(%rsp,%rax)                           #863.13
-        jmp       ..B17.15      # Prob 100%                     #863.13
-                                # LOE rdx rbp rsi r12 r14 r15 r13d
-..B17.44:                       # Preds ..B17.4 ..B17.5         # Infreq
-        call      __errno_location at PLT                          #849.16
-                                # LOE rax r14 r15
-..B17.48:                       # Preds ..B17.44                # Infreq
-        movl      (%rax), %eax                                  #849.16
-        addq      $40, %rsp                                     #849.16
-..___tag_value_NucStrFastaExprMake2.945:                        #
-        popq      %rbx                                          #849.16
-..___tag_value_NucStrFastaExprMake2.947:                        #
-        popq      %rbp                                          #849.16
-..___tag_value_NucStrFastaExprMake2.949:                        #
-        popq      %r12                                          #849.16
-..___tag_value_NucStrFastaExprMake2.951:                        #
-        popq      %r13                                          #849.16
-..___tag_value_NucStrFastaExprMake2.953:                        #
-        ret                                                     #849.16
-        .align    16,0x90
-..___tag_value_NucStrFastaExprMake2.954:                        #
-                                # LOE
-# mark_end;
-	.type	NucStrFastaExprMake2, at function
-	.size	NucStrFastaExprMake2,.-NucStrFastaExprMake2
-	.data
-# -- End  NucStrFastaExprMake2
-	.text
-# -- Begin  NucStrFastaExprMake4
-# mark_begin;
-       .align    16,0x90
-NucStrFastaExprMake4:
-# parameter 1: %rdi
-# parameter 2: %esi
-# parameter 3: %rdx
-# parameter 4: %rcx
-..B18.1:                        # Preds ..B18.0
-..___tag_value_NucStrFastaExprMake4.955:                        #1017.1
-        pushq     %r15                                          #1017.1
-..___tag_value_NucStrFastaExprMake4.957:                        #
-        pushq     %r14                                          #1017.1
-..___tag_value_NucStrFastaExprMake4.959:                        #
-        pushq     %r13                                          #1017.1
-..___tag_value_NucStrFastaExprMake4.961:                        #
-        pushq     %rbx                                          #1017.1
-..___tag_value_NucStrFastaExprMake4.963:                        #
-        subq      $40, %rsp                                     #1017.1
-..___tag_value_NucStrFastaExprMake4.965:                        #
-        movq      %rcx, %r14                                    #1017.1
-        movq      %rdx, %r13                                    #1017.1
-        movl      %esi, %r15d                                   #1017.1
-        movq      %rdi, %rbx                                    #1017.1
-        cmpq      $29, %r14                                     #1023.17
-        jbe       ..B18.3       # Prob 43%                      #1023.17
-                                # LOE rbx rbp r12 r13 r14 r15d
-..B18.2:                        # Preds ..B18.1
-        movl      $7, %eax                                      #1024.16
-        addq      $40, %rsp                                     #1024.16
-..___tag_value_NucStrFastaExprMake4.966:                        #
-        popq      %rbx                                          #1024.16
-..___tag_value_NucStrFastaExprMake4.968:                        #
-        popq      %r13                                          #1024.16
-..___tag_value_NucStrFastaExprMake4.970:                        #
-        popq      %r14                                          #1024.16
-..___tag_value_NucStrFastaExprMake4.972:                        #
-        popq      %r15                                          #1024.16
-..___tag_value_NucStrFastaExprMake4.974:                        #
-        ret                                                     #1024.16
-..___tag_value_NucStrFastaExprMake4.975:                        #
-                                # LOE
-..B18.3:                        # Preds ..B18.1
-        movl      $160, %edi                                    #1026.9
-        call      malloc at PLT                                    #1026.9
-                                # LOE rax rbx rbp r12 r13 r14 r15d
-..B18.4:                        # Preds ..B18.3
-        testq     %rax, %rax                                    #1026.9
-        je        ..B18.42      # Prob 12%                      #1026.9
-                                # LOE rax rbx rbp r12 r13 r14 r15d
-..B18.5:                        # Preds ..B18.4
-        lea       15(%rax), %rdx                                #1026.9
-        andq      $-16, %rdx                                    #1026.9
-        movq      %rax, 8(%rdx)                                 #1026.9
-        je        ..B18.42      # Prob 5%                       #1027.15
-                                # LOE rdx rbx rbp r12 r13 r14 r15d
-..B18.6:                        # Preds ..B18.5
-        movq      %rdx, (%rbx)                                  #1030.5
-        movl      %r14d, 4(%rdx)                                #1031.5
-        xorl      %r8d, %r8d                                    #1035.11
-        testq     %r14, %r14                                    #1035.22
-        jbe       ..B18.17      # Prob 16%                      #1035.22
-                                # LOE rdx rbp r8 r12 r13 r14 r15d
-..B18.8:                        # Preds ..B18.6 ..B18.15
-        movsbq    (%r8,%r13), %rcx                              #1037.49
-        lea       fasta_4na_map.0(%rip), %rax                   #1037.25
-        movsbl    (%rax,%rcx), %ebx                             #1037.25
-        movq      %r8, %rax                                     #1038.22
-        andq      $3, %rax                                      #1038.22
-        je        ..B18.41      # Prob 20%                      #1038.22
-                                # LOE rax rdx rbp r8 r12 r13 r14 ebx r15d
-..B18.9:                        # Preds ..B18.8
-        cmpq      $1, %rax                                      #1038.22
-        je        ..B18.14      # Prob 25%                      #1038.22
-                                # LOE rax rdx rbp r8 r12 r13 r14 ebx r15d
-..B18.10:                       # Preds ..B18.9
-        cmpq      $2, %rax                                      #1038.22
-        jne       ..B18.12      # Prob 67%                      #1038.22
-                                # LOE rax rdx rbp r8 r12 r13 r14 ebx r15d
-..B18.11:                       # Preds ..B18.10
-        movq      %r8, %rcx                                     #1049.32
-        shrq      $2, %rcx                                      #1049.32
-        movzwl    16(%rsp,%rcx,2), %eax                         #1050.13
-        shll      $12, %ebx                                     #1049.47
-        orl       $-4096, %eax                                  #1050.13
-        orw       %bx, (%rsp,%rcx,2)                            #1049.13
-        movw      %ax, 16(%rsp,%rcx,2)                          #1050.13
-        jmp       ..B18.15      # Prob 100%                     #1050.13
-                                # LOE rdx rbp r8 r12 r13 r14 r15d
-..B18.12:                       # Preds ..B18.10
-        cmpq      $3, %rax                                      #1038.22
-        jne       ..B18.15      # Prob 50%                      #1038.22
-                                # LOE rdx rbp r8 r12 r13 r14 ebx r15d
-..B18.13:                       # Preds ..B18.12
-        movq      %r8, %rcx                                     #1053.32
-        shrq      $2, %rcx                                      #1053.32
-        movzwl    16(%rsp,%rcx,2), %eax                         #1054.13
-        shll      $8, %ebx                                      #1053.47
-        orl       $-61696, %eax                                 #1054.13
-        orw       %bx, (%rsp,%rcx,2)                            #1053.13
-        movw      %ax, 16(%rsp,%rcx,2)                          #1054.13
-        jmp       ..B18.15      # Prob 100%                     #1054.13
-                                # LOE rdx rbp r8 r12 r13 r14 r15d
-..B18.14:                       # Preds ..B18.9
-        movq      %r8, %rcx                                     #1045.32
-        shrq      $2, %rcx                                      #1045.32
-        movzwl    16(%rsp,%rcx,2), %eax                         #1046.13
-        orl       $15, %eax                                     #1046.13
-        orw       %bx, (%rsp,%rcx,2)                            #1045.13
-        movw      %ax, 16(%rsp,%rcx,2)                          #1046.13
-                                # LOE rdx rbp r8 r12 r13 r14 r15d
-..B18.15:                       # Preds ..B18.12 ..B18.41 ..B18.14 ..B18.11 ..B18.13
-                                #      
-        incq      %r8                                           #1035.31
-        cmpq      %r14, %r8                                     #1035.22
-        jb        ..B18.8       # Prob 82%                      #1035.22
-                                # LOE rdx rbp r8 r12 r13 r14 r15d
-..B18.17:                       # Preds ..B18.15 ..B18.6
-        addq      $3, %r8                                       #1060.21
-        shrq      $2, %r8                                       #1060.28
-        cmpq      $8, %r8                                       #1060.35
-        jae       ..B18.30      # Prob 50%                      #1060.35
-                                # LOE rdx rbp r8 r12 r14 r15d
-..B18.18:                       # Preds ..B18.17
-        lea       (%rsp,%r8,2), %rbx                            #1060.5
-        movq      %r8, %rsi                                     #1060.5
-        negq      %rsi                                          #1060.5
-        addq      $8, %rsi                                      #1060.5
-        movq      %rbx, %rax                                    #1060.5
-        andq      $15, %rax                                     #1060.5
-        movq      %rax, %rcx                                    #1060.5
-        negq      %rcx                                          #1060.5
-        addq      $16, %rcx                                     #1060.5
-        shrq      $1, %rcx                                      #1060.5
-        cmpq      $0, %rax                                      #1060.5
-        cmovne    %rcx, %rax                                    #1060.5
-        lea       8(%rax), %r9                                  #1060.5
-        cmpq      %r9, %rsi                                     #1060.5
-        jl        ..B18.40      # Prob 10%                      #1060.5
-                                # LOE rax rdx rbx rbp rsi r8 r12 r14 r15d
-..B18.19:                       # Preds ..B18.18
-        movq      %rsi, %rcx                                    #1060.5
-        subq      %rax, %rcx                                    #1060.5
-        andq      $7, %rcx                                      #1060.5
-        negq      %rcx                                          #1060.5
-        addq      %rsi, %rcx                                    #1060.5
-        xorl      %r10d, %r10d                                  #1060.5
-        testq     %rax, %rax                                    #1060.5
-        jbe       ..B18.23      # Prob 10%                      #1060.5
-                                # LOE rax rdx rcx rbx rbp rsi r8 r10 r12 r14 r15d
-..B18.20:                       # Preds ..B18.19
-        lea       16(%rsp,%r8,2), %r9                           #
-                                # LOE rax rdx rcx rbx rbp rsi r8 r9 r10 r12 r14 r15d
-..B18.21:                       # Preds ..B18.21 ..B18.20
-        xorl      %r11d, %r11d                                  #1062.9
-        movw      %r11w, (%rbx,%r10,2)                          #1062.9
-        movw      %r11w, (%r9,%r10,2)                           #1063.9
-        incq      %r10                                          #1060.5
-        cmpq      %rax, %r10                                    #1060.5
-        jb        ..B18.21      # Prob 82%                      #1060.5
-                                # LOE rax rdx rcx rbx rbp rsi r8 r9 r10 r12 r14 r15d
-..B18.23:                       # Preds ..B18.21 ..B18.19
-        lea       16(%rsp,%r8,2), %r10                          #
-        lea       (%rsp,%r8,2), %r9                             #
-        pxor      %xmm0, %xmm0                                  #1062.29
-                                # LOE rax rdx rcx rbx rbp rsi r8 r9 r10 r12 r14 r15d xmm0
-..B18.24:                       # Preds ..B18.24 ..B18.23
-        movdqa    %xmm0, (%r9,%rax,2)                           #1062.9
-        movdqa    %xmm0, (%r10,%rax,2)                          #1063.9
-        addq      $8, %rax                                      #1060.5
-        cmpq      %rcx, %rax                                    #1060.5
-        jb        ..B18.24      # Prob 82%                      #1060.5
-                                # LOE rax rdx rcx rbx rbp rsi r8 r9 r10 r12 r14 r15d xmm0
-..B18.26:                       # Preds ..B18.24 ..B18.40
-        cmpq      %rsi, %rcx                                    #1060.5
-        jae       ..B18.30      # Prob 10%                      #1060.5
-                                # LOE rdx rcx rbx rbp rsi r8 r12 r14 r15d
-..B18.27:                       # Preds ..B18.26
-        lea       16(%rsp,%r8,2), %rax                          #
-                                # LOE rax rdx rcx rbx rbp rsi r12 r14 r15d
-..B18.28:                       # Preds ..B18.28 ..B18.27
-        xorl      %r8d, %r8d                                    #1062.9
-        movw      %r8w, (%rbx,%rcx,2)                           #1062.9
-        movw      %r8w, (%rax,%rcx,2)                           #1063.9
-        incq      %rcx                                          #1060.5
-        cmpq      %rsi, %rcx                                    #1060.5
-        jb        ..B18.28      # Prob 82%                      #1060.5
-                                # LOE rax rdx rcx rbx rbp rsi r12 r14 r15d
-..B18.30:                       # Preds ..B18.28 ..B18.26 ..B18.17
-        testl     %r15d, %r15d                                  #1068.10
-        je        ..B18.32      # Prob 50%                      #1068.10
-                                # LOE rdx rbp r12 r14
-..B18.31:                       # Preds ..B18.30
-        movl      $10, (%rdx)                                   #1070.9
-        jmp       ..B18.39      # Prob 100%                     #1070.9
-                                # LOE rdx rbp r12
-..B18.32:                       # Preds ..B18.30
-        cmpq      $2, %r14                                      #1072.22
-        jae       ..B18.34      # Prob 50%                      #1072.22
-                                # LOE rdx rbp r12 r14
-..B18.33:                       # Preds ..B18.32
-        movzwl    (%rsp), %eax                                  #1074.29
-        movzwl    16(%rsp), %esi                                #1078.26
-        movl      $6, (%rdx)                                    #1082.9
-        movw      %ax, 2(%rsp)                                  #1074.9
-        movl      (%rsp), %ecx                                  #1075.29
-        movl      (%rsp), %ebx                                  #1076.29
-        movl      %ecx, 4(%rsp)                                 #1075.9
-        movw      %si, 18(%rsp)                                 #1078.9
-        movl      16(%rsp), %r8d                                #1079.26
-        movl      16(%rsp), %r9d                                #1080.26
-        movl      %r8d, 20(%rsp)                                #1079.9
-        movl      %ecx, %ecx                                    #1075.9
-        shlq      $32, %rcx                                     #1076.29
-        movl      %r8d, %r8d                                    #1079.9
-        shlq      $32, %r8                                      #1080.26
-        orq       %rbx, %rcx                                    #1076.29
-        movq      %rcx, 8(%rsp)                                 #1076.9
-        orq       %r9, %r8                                      #1080.26
-        movq      %r8, 24(%rsp)                                 #1080.9
-        jmp       ..B18.39      # Prob 100%                     #1080.9
-                                # LOE rdx rbp r12
-..B18.34:                       # Preds ..B18.32
-        cmpq      $6, %r14                                      #1084.22
-        jae       ..B18.36      # Prob 50%                      #1084.22
-                                # LOE rdx rbp r12 r14
-..B18.35:                       # Preds ..B18.34
-        movl      (%rsp), %eax                                  #1086.29
-        movl      (%rsp), %ecx                                  #1087.29
-        movl      16(%rsp), %ebx                                #1089.26
-        movl      16(%rsp), %esi                                #1090.26
-        movl      %eax, 4(%rsp)                                 #1086.9
-        movl      $7, (%rdx)                                    #1092.9
-        movl      %eax, %eax                                    #1086.9
-        shlq      $32, %rax                                     #1087.29
-        movl      %ebx, 20(%rsp)                                #1089.9
-        movl      %ebx, %ebx                                    #1089.9
-        shlq      $32, %rbx                                     #1090.26
-        orq       %rcx, %rax                                    #1087.29
-        movq      %rax, 8(%rsp)                                 #1087.9
-        orq       %rsi, %rbx                                    #1090.26
-        movq      %rbx, 24(%rsp)                                #1090.9
-        jmp       ..B18.39      # Prob 100%                     #1090.9
-                                # LOE rdx rbp r12
-..B18.36:                       # Preds ..B18.34
-        cmpq      $14, %r14                                     #1094.22
-        jae       ..B18.38      # Prob 50%                      #1094.22
-                                # LOE rdx rbp r12
-..B18.37:                       # Preds ..B18.36
-        movq      (%rsp), %rax                                  #1096.29
-        movq      16(%rsp), %rcx                                #1097.26
-        movl      $1, (%rdx)                                    #1099.9
-        movq      %rax, 8(%rsp)                                 #1096.9
-        movq      %rcx, 24(%rsp)                                #1097.9
-        jmp       ..B18.39      # Prob 100%                     #1097.9
-                                # LOE rdx rbp r12
-..B18.38:                       # Preds ..B18.36
-        movl      $8, (%rdx)                                    #1103.9
-                                # LOE rdx rbp r12
-..B18.39:                       # Preds ..B18.31 ..B18.33 ..B18.35 ..B18.37 ..B18.38
-                                #      
-        movq      (%rsp), %rcx                                  #1106.42
-        lea       (%rsp), %rdi                                  #1110.5
-        movq      %rcx, 16(%rdx)                                #1106.42
-        movq      8(%rsp), %r8                                  #1106.42
-        movq      %r8, 24(%rdx)                                 #1106.42
-        movl      $4, %esi                                      #1114.5
-        movq      16(%rsp), %r9                                 #1107.39
-        movq      %r9, 32(%rdx)                                 #1107.39
-        movq      24(%rsp), %r10                                #1107.39
-        movq      %r10, 40(%rdx)                                #1107.39
-        movq      (%rdi), %rax                                  #1110.5
-        movq      8(%rdi), %rcx                                 #1110.5
-        bswap     %rax                                          #1110.5
-        bswap     %rcx                                          #1110.5
-        movq      %rax, 8(%rdi)                                 #1110.5
-        movq      %rcx, (%rdi)                                  #1110.5
-        lea       16(%rsp), %rdi                                #1111.5
-        movq      (%rdi), %rax                                  #1111.5
-        movq      8(%rdi), %rcx                                 #1111.5
-        bswap     %rax                                          #1111.5
-        bswap     %rcx                                          #1111.5
-        movq      %rax, 8(%rdi)                                 #1111.5
-        movq      %rcx, (%rdi)                                  #1111.5
-        lea       (%rsp), %rdi                                  #1114.5
-        movl      %esi, %ecx                                    #1114.5
-        movq      8(%rdi), %rax                                 #1114.5
-        shrdq     %cl, %rax, (%rdi)                             #1114.5
-        shrq      %cl, %rax                                     #1114.5
-        movq      %rax, 8(%rdi)                                 #1114.5
-        lea       16(%rsp), %rdi                                #1115.5
-        movl      %esi, %ecx                                    #1115.5
-        movq      8(%rdi), %rax                                 #1115.5
-        shrdq     %cl, %rax, (%rdi)                             #1115.5
-        shrq      %cl, %rax                                     #1115.5
-        movq      %rax, 8(%rdi)                                 #1115.5
-        lea       (%rsp), %rsi                                  #1118.5
-        lea       48(%rdx), %rdi                                #1118.5
-        movq      (%rsi), %rax                                  #1118.5
-        movq      8(%rsi), %rcx                                 #1118.5
-        bswap     %rax                                          #1118.5
-        bswap     %rcx                                          #1118.5
-        movq      %rax, 8(%rdi)                                 #1118.5
-        movq      %rcx, (%rdi)                                  #1118.5
-        lea       16(%rsp), %rsi                                #1119.5
-        lea       64(%rdx), %rdi                                #1119.5
-        movq      (%rsi), %rax                                  #1119.5
-        movq      8(%rsi), %rcx                                 #1119.5
-        bswap     %rax                                          #1119.5
-        bswap     %rcx                                          #1119.5
-        movq      %rax, 8(%rdi)                                 #1119.5
-        movq      %rcx, (%rdi)                                  #1119.5
-        lea       (%rsp), %rdi                                  #1121.5
-        movl      $4, %esi                                      #1121.5
-        movl      %esi, %ecx                                    #1121.5
-        movq      8(%rdi), %rax                                 #1121.5
-        shrdq     %cl, %rax, (%rdi)                             #1121.5
-        shrq      %cl, %rax                                     #1121.5
-        movq      %rax, 8(%rdi)                                 #1121.5
-        lea       16(%rsp), %rdi                                #1122.5
-        movl      %esi, %ecx                                    #1122.5
-        movq      8(%rdi), %rax                                 #1122.5
-        shrdq     %cl, %rax, (%rdi)                             #1122.5
-        shrq      %cl, %rax                                     #1122.5
-        movq      %rax, 8(%rdi)                                 #1122.5
-        lea       (%rsp), %rsi                                  #1124.5
-        lea       80(%rdx), %rdi                                #1124.5
-        movq      (%rsi), %rax                                  #1124.5
-        movq      8(%rsi), %rcx                                 #1124.5
-        bswap     %rax                                          #1124.5
-        bswap     %rcx                                          #1124.5
-        movq      %rax, 8(%rdi)                                 #1124.5
-        movq      %rcx, (%rdi)                                  #1124.5
-        lea       16(%rsp), %rsi                                #1125.5
-        lea       96(%rdx), %rdi                                #1125.5
-        movq      (%rsi), %rax                                  #1125.5
-        movq      8(%rsi), %rcx                                 #1125.5
-        bswap     %rax                                          #1125.5
-        bswap     %rcx                                          #1125.5
-        movq      %rax, 8(%rdi)                                 #1125.5
-        movq      %rcx, (%rdi)                                  #1125.5
-        lea       (%rsp), %rdi                                  #1127.5
-        movl      $4, %esi                                      #1127.5
-        movl      %esi, %ecx                                    #1127.5
-        movq      8(%rdi), %rax                                 #1127.5
-        shrdq     %cl, %rax, (%rdi)                             #1127.5
-        shrq      %cl, %rax                                     #1127.5
-        movq      %rax, 8(%rdi)                                 #1127.5
-        lea       16(%rsp), %rdi                                #1128.5
-        movl      %esi, %ecx                                    #1128.5
-        movq      8(%rdi), %rax                                 #1128.5
-        shrdq     %cl, %rax, (%rdi)                             #1128.5
-        shrq      %cl, %rax                                     #1128.5
-        movq      %rax, 8(%rdi)                                 #1128.5
-        lea       (%rsp), %rsi                                  #1130.5
-        lea       112(%rdx), %rdi                               #1130.5
-        addq      $128, %rdx                                    #1131.5
-        movq      (%rsi), %rax                                  #1130.5
-        movq      8(%rsi), %rcx                                 #1130.5
-        bswap     %rax                                          #1130.5
-        bswap     %rcx                                          #1130.5
-        movq      %rax, 8(%rdi)                                 #1130.5
-        movq      %rcx, (%rdi)                                  #1130.5
-        lea       16(%rsp), %rsi                                #1131.5
-        movq      %rdx, %rdi                                    #1131.5
-        movq      (%rsi), %rax                                  #1131.5
-        movq      8(%rsi), %rcx                                 #1131.5
-        bswap     %rax                                          #1131.5
-        bswap     %rcx                                          #1131.5
-        movq      %rax, 8(%rdi)                                 #1131.5
-        movq      %rcx, (%rdi)                                  #1131.5
-        xorl      %eax, %eax                                    #1173.12
-        addq      $40, %rsp                                     #1173.12
-..___tag_value_NucStrFastaExprMake4.980:                        #
-        popq      %rbx                                          #1173.12
-..___tag_value_NucStrFastaExprMake4.982:                        #
-        popq      %r13                                          #1173.12
-..___tag_value_NucStrFastaExprMake4.984:                        #
-        popq      %r14                                          #1173.12
-..___tag_value_NucStrFastaExprMake4.986:                        #
-        popq      %r15                                          #1173.12
-..___tag_value_NucStrFastaExprMake4.988:                        #
-        ret                                                     #1173.12
-..___tag_value_NucStrFastaExprMake4.989:                        #
-                                # LOE
-..B18.40:                       # Preds ..B18.18                # Infreq
-        xorl      %ecx, %ecx                                    #1060.5
-        jmp       ..B18.26      # Prob 100%                     #1060.5
-                                # LOE rdx rcx rbx rbp rsi r8 r12 r14 r15d
-..B18.41:                       # Preds ..B18.8                 # Infreq
-        movq      %r8, %rax                                     #1041.32
-        shrq      $2, %rax                                      #1041.32
-        shll      $4, %ebx                                      #1041.46
-        movw      %bx, (%rsp,%rax,2)                            #1041.13
-        movl      $240, %ebx                                    #1042.13
-        movw      %bx, 16(%rsp,%rax,2)                          #1042.13
-        jmp       ..B18.15      # Prob 100%                     #1042.13
-                                # LOE rdx rbp r8 r12 r13 r14 r15d
-..B18.42:                       # Preds ..B18.4 ..B18.5         # Infreq
-        call      __errno_location at PLT                          #1028.16
-                                # LOE rax rbp r12
-..B18.46:                       # Preds ..B18.42                # Infreq
-        movl      (%rax), %eax                                  #1028.16
-        addq      $40, %rsp                                     #1028.16
-..___tag_value_NucStrFastaExprMake4.994:                        #
-        popq      %rbx                                          #1028.16
-..___tag_value_NucStrFastaExprMake4.996:                        #
-        popq      %r13                                          #1028.16
-..___tag_value_NucStrFastaExprMake4.998:                        #
-        popq      %r14                                          #1028.16
-..___tag_value_NucStrFastaExprMake4.1000:                       #
-        popq      %r15                                          #1028.16
-..___tag_value_NucStrFastaExprMake4.1002:                       #
-        ret                                                     #1028.16
-        .align    16,0x90
-..___tag_value_NucStrFastaExprMake4.1003:                       #
-                                # LOE
-# mark_end;
-	.type	NucStrFastaExprMake4, at function
-	.size	NucStrFastaExprMake4,.-NucStrFastaExprMake4
-	.data
-# -- End  NucStrFastaExprMake4
-	.text
-# -- Begin  nss_expr
-# mark_begin;
-       .align    16,0x90
-nss_expr:
-# parameter 1: %rdi
-# parameter 2: %rsi
-# parameter 3: %rdx
-# parameter 4: %rcx
-# parameter 5: %r8d
-..B19.1:                        # Preds ..B19.0
-..___tag_value_nss_expr.1004:                                   #1406.1
-        pushq     %r15                                          #1406.1
-..___tag_value_nss_expr.1006:                                   #
-        pushq     %r14                                          #1406.1
-..___tag_value_nss_expr.1008:                                   #
-        pushq     %r13                                          #1406.1
-..___tag_value_nss_expr.1010:                                   #
-        pushq     %r12                                          #1406.1
-..___tag_value_nss_expr.1012:                                   #
-        pushq     %rbp                                          #1406.1
-..___tag_value_nss_expr.1014:                                   #
-        pushq     %rbx                                          #1406.1
-..___tag_value_nss_expr.1016:                                   #
-        subq      $24, %rsp                                     #1406.1
-..___tag_value_nss_expr.1018:                                   #
-        movl      %r8d, (%rsp)                                  #1406.1
-        movq      %rcx, %rbx                                    #1406.1
-        movq      %rdx, %r14                                    #1406.1
-        movq      %rsi, %r15                                    #1406.1
-        movq      %rdi, %r12                                    #1406.1
-        call      __errno_location at PLT                          #1454.32
-                                # LOE rax rbx r12 r13 r14 r15
-..B19.95:                       # Preds ..B19.1
-        movq      %rax, %rbp                                    #1454.32
-        call      __ctype_b_loc at PLT                             #1409.9
-                                # LOE rax rbx rbp r12 r13 r14 r15
-..B19.96:                       # Preds ..B19.95
-        movq      %rbp, 8(%rsp)                                 #1409.9
-        movq      %r14, %r13                                    #1409.9
-        movq      %rax, %r14                                    #1409.9
-        jmp       ..B19.2       # Prob 100%                     #1409.9
-                                # LOE rbx r12 r13 r14 r15
-..B19.74:                       # Preds ..B19.73
-        movl      $11, (%rax)                                   #1458.17
-        movl      %ebp, 4(%rax)                                 #1459.17
-        movq      (%r13), %rdx                                  #1460.41
-        movq      %rdx, 8(%rax)                                 #1460.17
-        movq      %rax, (%r13)                                  #1461.17
-        lea       16(%rax), %r13                                #1464.42
-                                # LOE rbx r12 r13 r14 r15
-..B19.2:                        # Preds ..B19.74 ..B19.96
-        movq      $0, (%r13)                                    #1407.5
-        movq      %r12, %rbp                                    #1407.5
-        xorl      %esi, %esi                                    #1409.9
-        cmpq      %r15, %r12                                    #1409.9
-        jae       ..B19.7       # Prob 2%                       #1409.9
-                                # LOE rbx rbp rsi r12 r13 r14 r15
-..B19.3:                        # Preds ..B19.2
-        movq      (%r14), %rcx                                  #1409.9
-        movq      %r15, %rdx                                    #1406.1
-        subq      %r12, %rdx                                    #1406.1
-                                # LOE rdx rcx rbx rbp rsi r12 r13 r14 r15
-..B19.4:                        # Preds ..B19.5 ..B19.3
-        movzbl    (%rsi,%r12), %edi                             #1409.9
-        movzwl    (%rcx,%rdi,2), %r8d                           #1409.9
-        testl     $8192, %r8d                                   #1409.9
-        je        ..B19.7       # Prob 20%                      #1409.9
-                                # LOE rdx rcx rbx rbp rsi r12 r13 r14 r15
-..B19.5:                        # Preds ..B19.4
-        lea       1(%rsi,%r12), %rbp                            #1409.9
-        incq      %rsi                                          #1409.9
-        cmpq      %rdx, %rsi                                    #1409.9
-        jb        ..B19.4       # Prob 82%                      #1409.9
-                                # LOE rdx rcx rbx rbp rsi r12 r13 r14 r15
-..B19.7:                        # Preds ..B19.4 ..B19.5 ..B19.2
-        cmpq      %r15, %rbp                                    #1410.15
-        je        ..B19.78      # Prob 16%                      #1410.15
-                                # LOE rbx rbp r13 r14 r15
-..B19.8:                        # Preds ..B19.7
-        movsbl    (%rbp), %edx                                  #1412.13
-        cmpl      $33, %edx                                     #1412.13
-        je        ..B19.44      # Prob 33%                      #1412.13
-                                # LOE rbx rbp r13 r14 r15 edx
-..B19.9:                        # Preds ..B19.8
-        cmpl      $94, %edx                                     #1412.13
-        jne       ..B19.21      # Prob 67%                      #1412.13
-                                # LOE rbx rbp r13 r14 r15 edx
-..B19.10:                       # Preds ..B19.9
-        movl      $16, %edi                                     #1412.13
-        call      malloc at PLT                                    #1412.13
-                                # LOE rax rbx rbp r13 r14 r15
-..B19.11:                       # Preds ..B19.10
-        testq     %rax, %rax                                    #1412.13
-        jne       ..B19.13      # Prob 68%                      #1412.13
-                                # LOE rax rbx rbp r13 r14 r15
-..B19.12:                       # Preds ..B19.82 ..B19.11
-        movq      8(%rsp), %rdx                                 #1412.13
-        movl      (%rdx), %edx                                  #1412.13
-        movl      %edx, (%rbx)                                  #1412.13
-        jmp       ..B19.43      # Prob 100%                     #1412.13
-                                # LOE rbx rbp r13 r14 r15 edx
-..B19.13:                       # Preds ..B19.11
-        movl      $12, (%rax)                                   #1412.13
-        incq      %rbp                                          #1412.13
-        movq      %rbp, %r8                                     #1412.13
-        xorl      %edi, %edi                                    #1412.13
-        movl      $14, 4(%rax)                                  #1412.13
-        cmpq      %r15, %r8                                     #1412.13
-        movq      $0, 8(%rax)                                   #1412.13
-        movq      %rax, (%r13)                                  #1412.13
-        jae       ..B19.18      # Prob 2%                       #1412.13
-                                # LOE rax rbx rbp rdi r8 r13 r14 r15
-..B19.14:                       # Preds ..B19.13
-        movq      (%r14), %rsi                                  #1412.13
-        movq      %r15, %rcx                                    #1406.1
-        subq      %rbp, %rcx                                    #1406.1
-                                # LOE rax rcx rbx rbp rsi rdi r8 r13 r14 r15
-..B19.15:                       # Preds ..B19.16 ..B19.14
-        movzbl    (%rdi,%r8), %r9d                              #1412.13
-        movzwl    (%rsi,%r9,2), %r10d                           #1412.13
-        testl     $8192, %r10d                                  #1412.13
-        je        ..B19.18      # Prob 20%                      #1412.13
-                                # LOE rax rcx rbx rbp rsi rdi r8 r13 r14 r15
-..B19.16:                       # Preds ..B19.15
-        lea       1(%rdi,%r8), %rbp                             #1412.13
-        incq      %rdi                                          #1412.13
-        cmpq      %rcx, %rdi                                    #1412.13
-        jb        ..B19.15      # Prob 1%                       #1412.13
-                                # LOE rax rcx rbx rbp rsi rdi r8 r13 r14 r15
-..B19.18:                       # Preds ..B19.15 ..B19.16 ..B19.13
-        movl      (%rsp), %r8d                                  #1412.13
-        addq      $8, %rax                                      #1412.13
-        movq      %rbp, %rdi                                    #1412.13
-        movq      %r15, %rsi                                    #1412.13
-        movq      %rax, %rdx                                    #1412.13
-        movq      %rbx, %rcx                                    #1412.13
-        call      nss_fasta_expr at PLT                            #1412.13
-                                # LOE rax rbx r13 r14 r15
-..B19.98:                       # Preds ..B19.18
-        movq      %rax, %rbp                                    #1412.13
-                                # LOE rbx rbp r13 r14 r15
-..B19.19:                       # Preds ..B19.98
-        movl      (%rbx), %edx                                  #1413.16
-        jmp       ..B19.43      # Prob 100%                     #1413.16
-                                # LOE rbx rbp r13 r14 r15 edx
-..B19.21:                       # Preds ..B19.9
-        cmpl      $40, %edx                                     #1412.13
-        jne       ..B19.33      # Prob 50%                      #1412.13
-                                # LOE rbx rbp r13 r14 r15
-..B19.22:                       # Preds ..B19.21
-        movl      $16, %edi                                     #1412.13
-        call      malloc at PLT                                    #1412.13
-                                # LOE rax rbx rbp r13 r14 r15
-..B19.99:                       # Preds ..B19.22
-        movq      %rax, %r12                                    #1412.13
-                                # LOE rbx rbp r12 r13 r14 r15
-..B19.23:                       # Preds ..B19.99
-        testq     %r12, %r12                                    #1412.13
-        jne       ..B19.25      # Prob 68%                      #1412.13
-                                # LOE rbx rbp r12 r13 r14 r15
-..B19.24:                       # Preds ..B19.23
-        movq      8(%rsp), %rdx                                 #1412.13
-        movl      (%rdx), %edx                                  #1412.13
-        movl      %edx, (%rbx)                                  #1412.13
-        jmp       ..B19.43      # Prob 100%                     #1412.13
-                                # LOE rbx rbp r13 r14 r15 edx
-..B19.25:                       # Preds ..B19.23
-        movl      (%rsp), %r8d                                  #1412.13
-        movl      $12, (%r12)                                   #1412.13
-        incq      %rbp                                          #1412.13
-        lea       8(%r12), %rdx                                 #1412.13
-        movl      $0, 4(%r12)                                   #1412.13
-        movq      %r12, (%r13)                                  #1412.13
-        movq      %rbp, %rdi                                    #1412.13
-        movq      %r15, %rsi                                    #1412.13
-        movq      %rbx, %rcx                                    #1412.13
-        call      nss_expr at PLT                                  #1412.13
-                                # LOE rax rbx r12 r13 r14 r15
-..B19.100:                      # Preds ..B19.25
-        movq      %rax, %rbp                                    #1412.13
-                                # LOE rbx rbp r12 r13 r14 r15
-..B19.26:                       # Preds ..B19.100
-        movl      (%rbx), %edx                                  #1412.13
-        testl     %edx, %edx                                    #1412.13
-        jne       ..B19.43      # Prob 50%                      #1412.13
-                                # LOE rbx rbp r12 r13 r14 r15 edx
-..B19.27:                       # Preds ..B19.26
-        movq      8(%r12), %rcx                                 #1412.13
-        testq     %rcx, %rcx                                    #1412.13
-        je        ..B19.31      # Prob 12%                      #1412.13
-                                # LOE rbx rbp r13 r14 r15 edx
-..B19.28:                       # Preds ..B19.27
-        cmpq      %r15, %rbp                                    #1412.13
-        je        ..B19.31      # Prob 12%                      #1412.13
-                                # LOE rbx rbp r13 r14 r15 edx
-..B19.29:                       # Preds ..B19.28
-        movsbl    (%rbp), %ecx                                  #1412.13
-        cmpl      $41, %ecx                                     #1412.13
-        je        ..B19.80      # Prob 16%                      #1412.13
-                                # LOE rbx rbp r13 r14 r15 edx
-..B19.30:                       # Preds ..B19.29
-        incq      %rbp                                          #1412.13
-                                # LOE rbx rbp r13 r14 r15
-..B19.31:                       # Preds ..B19.30 ..B19.28 ..B19.27
-        movl      $22, (%rbx)                                   #1412.13
-        movl      $22, %edx                                     #1412.13
-        jmp       ..B19.43      # Prob 100%                     #1412.13
-                                # LOE rbx rbp r13 r14 r15 edx
-..B19.33:                       # Preds ..B19.21
-        movl      (%rsp), %r8d                                  #1412.13
-        movq      %rbp, %rdi                                    #1412.13
-        movq      %r15, %rsi                                    #1412.13
-        movq      %r13, %rdx                                    #1412.13
-        movq      %rbx, %rcx                                    #1412.13
-        call      nss_fasta_expr at PLT                            #1412.13
-                                # LOE rax rbx r13 r14 r15
-..B19.34:                       # Preds ..B19.33
-        movl      (%rbx), %edx                                  #1412.13
-        movq      %rax, %rbp                                    #1412.13
-        testl     %edx, %edx                                    #1412.13
-        jne       ..B19.43      # Prob 50%                      #1412.13
-                                # LOE rax rbx rbp r13 r14 r15 edx
-..B19.35:                       # Preds ..B19.34
-        cmpq      %r15, %rax                                    #1412.13
-        jae       ..B19.43      # Prob 33%                      #1412.13
-                                # LOE rax rbx rbp r13 r14 r15 edx
-..B19.36:                       # Preds ..B19.35
-        movq      (%r14), %rdi                                  #1412.13
-        movq      %rax, %rbp                                    #1412.13
-        xorl      %ecx, %ecx                                    #1412.13
-        movq      %r15, %rsi                                    #1406.1
-        subq      %rax, %rsi                                    #1406.1
-                                # LOE rax rcx rbx rbp rsi rdi r13 r14 r15 edx
-..B19.37:                       # Preds ..B19.36 ..B19.38
-        movzbl    (%rcx,%rax), %r8d                             #1412.13
-        movzwl    (%rdi,%r8,2), %r9d                            #1412.13
-        testl     $8192, %r9d                                   #1412.13
-        je        ..B19.40      # Prob 20%                      #1412.13
-                                # LOE rax rcx rbx rbp rsi rdi r13 r14 r15 edx
-..B19.38:                       # Preds ..B19.37
-        lea       1(%rcx,%rax), %rbp                            #1412.13
-        incq      %rcx                                          #1412.13
-        cmpq      %rsi, %rcx                                    #1412.13
-        jb        ..B19.37      # Prob 1%                       #1412.13
-                                # LOE rax rcx rbx rbp rsi rdi r13 r14 r15 edx
-..B19.40:                       # Preds ..B19.37 ..B19.38
-        cmpq      %r15, %rbp                                    #1412.13
-        jae       ..B19.43      # Prob 12%                      #1412.13
-                                # LOE rbx rbp r13 r14 r15 edx
-..B19.41:                       # Preds ..B19.40
-        movsbl    (%rbp), %ecx                                  #1412.13
-        cmpl      $36, %ecx                                     #1412.13
-        je        ..B19.81      # Prob 5%                       #1412.13
-                                # LOE rbx rbp r13 r14 r15 edx
-..B19.43:                       # Preds ..B19.34 ..B19.35 ..B19.40 ..B19.41 ..B19.83
-                                #       ..B19.26 ..B19.31 ..B19.24 ..B19.19 ..B19.12
-                                #       ..B19.80
-        movq      %rbp, %r12                                    #1412.13
-        jmp       ..B19.56      # Prob 100%                     #1412.13
-                                # LOE rbx r12 r13 r14 r15 edx
-..B19.44:                       # Preds ..B19.8
-        lea       1(%rbp), %r12                                 #1412.13
-        xorl      %ecx, %ecx                                    #1412.13
-        cmpq      %r15, %r12                                    #1412.13
-        jae       ..B19.49      # Prob 2%                       #1412.13
-                                # LOE rcx rbx rbp r12 r13 r14 r15
-..B19.45:                       # Preds ..B19.44
-        movq      (%r14), %rdx                                  #1412.13
-        movq      %r15, %rax                                    #1406.1
-        subq      %rbp, %rax                                    #1406.1
-        decq      %rax                                          #1406.1
-                                # LOE rax rdx rcx rbx rbp r12 r13 r14 r15
-..B19.46:                       # Preds ..B19.47 ..B19.45
-        movzbl    1(%rcx,%rbp), %esi                            #1412.13
-        movzwl    (%rdx,%rsi,2), %edi                           #1412.13
-        testl     $8192, %edi                                   #1412.13
-        je        ..B19.49      # Prob 20%                      #1412.13
-                                # LOE rax rdx rcx rbx rbp r12 r13 r14 r15
-..B19.47:                       # Preds ..B19.46
-        lea       2(%rcx,%rbp), %r12                            #1412.13
-        incq      %rcx                                          #1412.13
-        cmpq      %rax, %rcx                                    #1412.13
-        jb        ..B19.46      # Prob 1%                       #1412.13
-                                # LOE rax rdx rcx rbx rbp r12 r13 r14 r15
-..B19.49:                       # Preds ..B19.46 ..B19.47 ..B19.44
-        cmpq      %r15, %r12                                    #1412.13
-        jne       ..B19.51      # Prob 68%                      #1412.13
-                                # LOE rbx r12 r13 r14 r15
-..B19.50:                       # Preds ..B19.49
-        movl      $22, (%rbx)                                   #1412.13
-        movl      $22, %edx                                     #1412.13
-        jmp       ..B19.56      # Prob 100%                     #1412.13
-                                # LOE rbx r12 r13 r14 r15 edx
-..B19.51:                       # Preds ..B19.49
-        movl      $16, %edi                                     #1412.13
-        call      malloc at PLT                                    #1412.13
-                                # LOE rax rbx r12 r13 r14 r15
-..B19.52:                       # Preds ..B19.51
-        testq     %rax, %rax                                    #1412.13
-        je        ..B19.88      # Prob 1%                       #1412.13
-                                # LOE rax rbx r12 r13 r14 r15
-..B19.53:                       # Preds ..B19.52
-        movl      (%rsp), %r8d                                  #1412.13
-        movl      $12, (%rax)                                   #1412.13
-        movq      %r12, %rdi                                    #1412.13
-        movq      %r15, %rsi                                    #1412.13
-        movl      $13, 4(%rax)                                  #1412.13
-        movq      %rbx, %rcx                                    #1412.13
-        movq      $0, 8(%rax)                                   #1412.13
-        movq      %rax, (%r13)                                  #1412.13
-        addq      $8, %rax                                      #1412.13
-        movq      %rax, %rdx                                    #1412.13
-        call      nss_unary_expr at PLT                            #1412.13
-                                # LOE rax rbx r13 r14 r15
-..B19.103:                      # Preds ..B19.53
-        movq      %rax, %r12                                    #1412.13
-                                # LOE rbx r12 r13 r14 r15
-..B19.54:                       # Preds ..B19.103
-        movl      (%rbx), %edx                                  #1413.16
-                                # LOE rbx r12 r13 r14 r15 edx
-..B19.56:                       # Preds ..B19.54 ..B19.88 ..B19.50 ..B19.43
-        testl     %edx, %edx                                    #1413.26
-        jne       ..B19.77      # Prob 58%                      #1413.26
-                                # LOE rbx r12 r13 r14 r15
-..B19.57:                       # Preds ..B19.56
-        movq      %r12, %rbp                                    #1413.9
-        xorl      %ecx, %ecx                                    #1415.17
-        cmpq      %r15, %r12                                    #1415.17
-        jae       ..B19.62      # Prob 2%                       #1415.17
-                                # LOE rcx rbx rbp r12 r13 r14 r15
-..B19.58:                       # Preds ..B19.57
-        movq      (%r14), %rdx                                  #1415.17
-        movq      %r15, %rax                                    #1406.1
-        subq      %r12, %rax                                    #1406.1
-                                # LOE rax rdx rcx rbx rbp r12 r13 r14 r15
-..B19.59:                       # Preds ..B19.60 ..B19.58
-        movzbl    (%rcx,%r12), %esi                             #1415.17
-        movzwl    (%rdx,%rsi,2), %edi                           #1415.17
-        testl     $8192, %edi                                   #1415.17
-        je        ..B19.62      # Prob 20%                      #1415.17
-                                # LOE rax rdx rcx rbx rbp r12 r13 r14 r15
-..B19.60:                       # Preds ..B19.59
-        lea       1(%rcx,%r12), %rbp                            #1415.17
-        incq      %rcx                                          #1415.17
-        cmpq      %rax, %rcx                                    #1415.17
-        jb        ..B19.59      # Prob 17%                      #1415.17
-                                # LOE rax rdx rcx rbx rbp r12 r13 r14 r15
-..B19.62:                       # Preds ..B19.59 ..B19.60 ..B19.57
-        cmpq      %r15, %rbp                                    #1416.23
-        je        ..B19.78      # Prob 4%                       #1416.23
-                                # LOE rbx rbp r13 r14 r15
-..B19.63:                       # Preds ..B19.62
-        movsbl    (%rbp), %edx                                  #1422.28
-        lea       1(%rbp), %r12                                 #1422.28
-        cmpl      $41, %edx                                     #1422.28
-        je        ..B19.78      # Prob 25%                      #1422.28
-                                # LOE rbx rbp r12 r13 r14 r15 edx
-..B19.64:                       # Preds ..B19.63
-        cmpl      $38, %edx                                     #1422.28
-        jne       ..B19.68      # Prob 67%                      #1422.28
-                                # LOE rbx rbp r12 r13 r14 r15 edx
-..B19.65:                       # Preds ..B19.64
-        cmpq      %r15, %r12                                    #1427.30
-        jae       ..B19.67      # Prob 12%                      #1427.30
-                                # LOE rbx rbp r12 r13 r14 r15
-..B19.66:                       # Preds ..B19.65
-        movsbl    (%r12), %edx                                  #1427.39
-        addq      $2, %rbp                                      #1428.28
-        cmpl      $38, %edx                                     #1428.28
-        cmove     %rbp, %r12                                    #1428.28
-                                # LOE rbx r12 r13 r14 r15
-..B19.67:                       # Preds ..B19.66 ..B19.65
-        movl      $16, %ebp                                     #1429.21
-        jmp       ..B19.72      # Prob 100%                     #1429.21
-                                # LOE rbx r12 r13 r14 r15 ebp
-..B19.68:                       # Preds ..B19.64
-        cmpl      $124, %edx                                    #1422.28
-        jne       ..B19.75      # Prob 50%                      #1422.28
-                                # LOE rbx rbp r12 r13 r14 r15
-..B19.69:                       # Preds ..B19.68
-        cmpq      %r15, %r12                                    #1432.30
-        jae       ..B19.71      # Prob 12%                      #1432.30
-                                # LOE rbx rbp r12 r13 r14 r15
-..B19.70:                       # Preds ..B19.69
-        movsbl    (%r12), %edx                                  #1432.39
-        addq      $2, %rbp                                      #1433.28
-        cmpl      $124, %edx                                    #1433.28
-        cmove     %rbp, %r12                                    #1433.28
-                                # LOE rbx r12 r13 r14 r15
-..B19.71:                       # Preds ..B19.70 ..B19.69
-        movl      $17, %ebp                                     #1434.21
-                                # LOE rbx r12 r13 r14 r15 ebp
-..B19.72:                       # Preds ..B19.67 ..B19.71
-        movl      $24, %edi                                     #1451.21
-        call      malloc at PLT                                    #1451.21
-                                # LOE rax rbx r12 r13 r14 r15 ebp
-..B19.73:                       # Preds ..B19.72
-        testq     %rax, %rax                                    #1452.27
-        je        ..B19.92      # Prob 1%                       #1452.27
-        jmp       ..B19.74      # Prob 100%                     #1452.27
-                                # LOE rax rbx r12 r13 r14 r15 ebp
-..B19.75:                       # Preds ..B19.68
-        movl      $22, (%rbx)                                   #1438.21
-        movq      %rbp, %rax                                    #1439.32
-        addq      $24, %rsp                                     #1439.32
-..___tag_value_nss_expr.1019:                                   #
-        popq      %rbx                                          #1439.32
-..___tag_value_nss_expr.1021:                                   #
-        popq      %rbp                                          #1439.32
-..___tag_value_nss_expr.1023:                                   #
-        popq      %r12                                          #1439.32
-..___tag_value_nss_expr.1025:                                   #
-        popq      %r13                                          #1439.32
-..___tag_value_nss_expr.1027:                                   #
-        popq      %r14                                          #1439.32
-..___tag_value_nss_expr.1029:                                   #
-        popq      %r15                                          #1439.32
-..___tag_value_nss_expr.1031:                                   #
-        ret                                                     #1439.32
-..___tag_value_nss_expr.1032:                                   #
-                                # LOE
-..B19.77:                       # Preds ..B19.56
-        movq      %r12, %rbp                                    #1413.9
-                                # LOE rbp r13
-..B19.78:                       # Preds ..B19.63 ..B19.7 ..B19.62 ..B19.77
-        movq      %rbp, %rax                                    #1470.12
-        addq      $24, %rsp                                     #1470.12
-..___tag_value_nss_expr.1039:                                   #
-        popq      %rbx                                          #1470.12
-..___tag_value_nss_expr.1041:                                   #
-        popq      %rbp                                          #1470.12
-..___tag_value_nss_expr.1043:                                   #
-        popq      %r12                                          #1470.12
-..___tag_value_nss_expr.1045:                                   #
-        popq      %r13                                          #1470.12
-..___tag_value_nss_expr.1047:                                   #
-        popq      %r14                                          #1470.12
-..___tag_value_nss_expr.1049:                                   #
-        popq      %r15                                          #1470.12
-..___tag_value_nss_expr.1051:                                   #
-        ret                                                     #1470.12
-..___tag_value_nss_expr.1052:                                   #
-                                # LOE
-..B19.80:                       # Preds ..B19.29                # Infreq
-        incq      %rbp                                          #1412.13
-        jmp       ..B19.43      # Prob 100%                     #1412.13
-                                # LOE rbx rbp r13 r14 r15 edx
-..B19.81:                       # Preds ..B19.41                # Infreq
-        incq      %rbp                                          #1412.13
-        movl      $16, %edi                                     #1412.13
-        call      malloc at PLT                                    #1412.13
-                                # LOE rax rbx rbp r13 r14 r15
-..B19.82:                       # Preds ..B19.81                # Infreq
-        testq     %rax, %rax                                    #1412.13
-        je        ..B19.12      # Prob 12%                      #1412.13
-                                # LOE rax rbx rbp r13 r14 r15
-..B19.83:                       # Preds ..B19.82                # Infreq
-        movl      $12, (%rax)                                   #1412.13
-        movl      $15, 4(%rax)                                  #1412.13
-        movq      (%r13), %rdx                                  #1412.13
-        movq      %rdx, 8(%rax)                                 #1412.13
-        movl      (%rbx), %edx                                  #1413.16
-        movq      %rax, (%r13)                                  #1412.13
-        jmp       ..B19.43      # Prob 100%                     #1412.13
-                                # LOE rbx rbp r13 r14 r15 edx
-..B19.88:                       # Preds ..B19.52                # Infreq
-        movq      8(%rsp), %rdx                                 #1412.13
-        movl      (%rdx), %edx                                  #1412.13
-        movl      %edx, (%rbx)                                  #1412.13
-        jmp       ..B19.56      # Prob 100%                     #1412.13
-                                # LOE rbx r12 r13 r14 r15 edx
-..B19.92:                       # Preds ..B19.73                # Infreq
-        movq      8(%rsp), %rbp                                 #
-        movl      (%rbp), %edx                                  #1454.32
-        movl      %edx, (%rbx)                                  #1454.21
-        movq      %r12, %rax                                    #1455.28
-        addq      $24, %rsp                                     #1455.28
-..___tag_value_nss_expr.1059:                                   #
-        popq      %rbx                                          #1455.28
-..___tag_value_nss_expr.1061:                                   #
-        popq      %rbp                                          #1455.28
-..___tag_value_nss_expr.1063:                                   #
-        popq      %r12                                          #1455.28
-..___tag_value_nss_expr.1065:                                   #
-        popq      %r13                                          #1455.28
-..___tag_value_nss_expr.1067:                                   #
-        popq      %r14                                          #1455.28
-..___tag_value_nss_expr.1069:                                   #
-        popq      %r15                                          #1455.28
-..___tag_value_nss_expr.1071:                                   #
-        ret                                                     #1455.28
-        .align    16,0x90
-..___tag_value_nss_expr.1072:                                   #
-                                # LOE
-# mark_end;
-	.type	nss_expr, at function
-	.size	nss_expr,.-nss_expr
-	.data
-# -- End  nss_expr
-	.bss
-	.align 32
-	.align 32
-fasta_2na_map.0:
-	.type	fasta_2na_map.0, at object
-	.size	fasta_2na_map.0,128
-	.space 128	# pad
-	.align 32
-fasta_4na_map.0:
-	.type	fasta_4na_map.0, at object
-	.size	fasta_4na_map.0,128
-	.space 128	# pad
-	.data
-	.align 32
-	.align 32
-expand_2na.0:
-	.word	4369
-	.word	4370
-	.word	4372
-	.word	4376
-	.word	4385
-	.word	4386
-	.word	4388
-	.word	4392
-	.word	4417
-	.word	4418
-	.word	4420
-	.word	4424
-	.word	4481
-	.word	4482
-	.word	4484
-	.word	4488
-	.word	4625
-	.word	4626
-	.word	4628
-	.word	4632
-	.word	4641
-	.word	4642
-	.word	4644
-	.word	4648
-	.word	4673
-	.word	4674
-	.word	4676
-	.word	4680
-	.word	4737
-	.word	4738
-	.word	4740
-	.word	4744
-	.word	5137
-	.word	5138
-	.word	5140
-	.word	5144
-	.word	5153
-	.word	5154
-	.word	5156
-	.word	5160
-	.word	5185
-	.word	5186
-	.word	5188
-	.word	5192
-	.word	5249
-	.word	5250
-	.word	5252
-	.word	5256
-	.word	6161
-	.word	6162
-	.word	6164
-	.word	6168
-	.word	6177
-	.word	6178
-	.word	6180
-	.word	6184
-	.word	6209
-	.word	6210
-	.word	6212
-	.word	6216
-	.word	6273
-	.word	6274
-	.word	6276
-	.word	6280
-	.word	8465
-	.word	8466
-	.word	8468
-	.word	8472
-	.word	8481
-	.word	8482
-	.word	8484
-	.word	8488
-	.word	8513
-	.word	8514
-	.word	8516
-	.word	8520
-	.word	8577
-	.word	8578
-	.word	8580
-	.word	8584
-	.word	8721
-	.word	8722
-	.word	8724
-	.word	8728
-	.word	8737
-	.word	8738
-	.word	8740
-	.word	8744
-	.word	8769
-	.word	8770
-	.word	8772
-	.word	8776
-	.word	8833
-	.word	8834
-	.word	8836
-	.word	8840
-	.word	9233
-	.word	9234
-	.word	9236
-	.word	9240
-	.word	9249
-	.word	9250
-	.word	9252
-	.word	9256
-	.word	9281
-	.word	9282
-	.word	9284
-	.word	9288
-	.word	9345
-	.word	9346
-	.word	9348
-	.word	9352
-	.word	10257
-	.word	10258
-	.word	10260
-	.word	10264
-	.word	10273
-	.word	10274
-	.word	10276
-	.word	10280
-	.word	10305
-	.word	10306
-	.word	10308
-	.word	10312
-	.word	10369
-	.word	10370
-	.word	10372
-	.word	10376
-	.word	16657
-	.word	16658
-	.word	16660
-	.word	16664
-	.word	16673
-	.word	16674
-	.word	16676
-	.word	16680
-	.word	16705
-	.word	16706
-	.word	16708
-	.word	16712
-	.word	16769
-	.word	16770
-	.word	16772
-	.word	16776
-	.word	16913
-	.word	16914
-	.word	16916
-	.word	16920
-	.word	16929
-	.word	16930
-	.word	16932
-	.word	16936
-	.word	16961
-	.word	16962
-	.word	16964
-	.word	16968
-	.word	17025
-	.word	17026
-	.word	17028
-	.word	17032
-	.word	17425
-	.word	17426
-	.word	17428
-	.word	17432
-	.word	17441
-	.word	17442
-	.word	17444
-	.word	17448
-	.word	17473
-	.word	17474
-	.word	17476
-	.word	17480
-	.word	17537
-	.word	17538
-	.word	17540
-	.word	17544
-	.word	18449
-	.word	18450
-	.word	18452
-	.word	18456
-	.word	18465
-	.word	18466
-	.word	18468
-	.word	18472
-	.word	18497
-	.word	18498
-	.word	18500
-	.word	18504
-	.word	18561
-	.word	18562
-	.word	18564
-	.word	18568
-	.word	33041
-	.word	33042
-	.word	33044
-	.word	33048
-	.word	33057
-	.word	33058
-	.word	33060
-	.word	33064
-	.word	33089
-	.word	33090
-	.word	33092
-	.word	33096
-	.word	33153
-	.word	33154
-	.word	33156
-	.word	33160
-	.word	33297
-	.word	33298
-	.word	33300
-	.word	33304
-	.word	33313
-	.word	33314
-	.word	33316
-	.word	33320
-	.word	33345
-	.word	33346
-	.word	33348
-	.word	33352
-	.word	33409
-	.word	33410
-	.word	33412
-	.word	33416
-	.word	33809
-	.word	33810
-	.word	33812
-	.word	33816
-	.word	33825
-	.word	33826
-	.word	33828
-	.word	33832
-	.word	33857
-	.word	33858
-	.word	33860
-	.word	33864
-	.word	33921
-	.word	33922
-	.word	33924
-	.word	33928
-	.word	34833
-	.word	34834
-	.word	34836
-	.word	34840
-	.word	34849
-	.word	34850
-	.word	34852
-	.word	34856
-	.word	34881
-	.word	34882
-	.word	34884
-	.word	34888
-	.word	34945
-	.word	34946
-	.word	34948
-	.word	34952
-	.type	expand_2na.0, at object
-	.size	expand_2na.0,512
-	.section .rodata.str1.4, "aMS", at progbits,1
-	.align 4
-	.align 4
-_2__STRING.0.0:
-	.byte	65
-	.byte	67
-	.byte	71
-	.byte	84
-	.byte	0
-	.type	_2__STRING.0.0, at object
-	.size	_2__STRING.0.0,5
-	.space 3	# pad
-	.align 4
-_2__STRING.1.0:
-	.byte	45
-	.byte	65
-	.byte	67
-	.byte	77
-	.byte	71
-	.byte	82
-	.byte	83
-	.byte	86
-	.byte	84
-	.byte	87
-	.byte	89
-	.byte	72
-	.byte	75
-	.byte	68
-	.byte	66
-	.byte	78
-	.byte	0
-	.type	_2__STRING.1.0, at object
-	.size	_2__STRING.1.0,17
-	.data
-	.section .note.GNU-stack, ""
-// -- Begin DWARF2 SEGMENT .eh_frame
-	.section .eh_frame,"a", at progbits
-.eh_frame_seg:
-	.align 1
-	.4byte 0x00000014
-	.4byte 0x00000000
-	.byte 0x01
-	.2byte 0x527a
-	.byte 0x00
-	.byte 0x01
-	.byte 0x78
-	.byte 0x10
-	.byte 0x01
-	.4byte 0x08070c1b
-	.2byte 0x0190
-	.2byte 0x0000
-	.4byte 0x0000045c
-	.4byte 0x0000001c
-	.4byte ..___tag_value_NucStrstrSearch.1-.
-	.4byte ..___tag_value_NucStrstrSearch.194-..___tag_value_NucStrstrSearch.1
-	.byte 0x00
-	.byte 0x0c
-	.8byte 0xffffffffffffe007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.3-..___tag_value_NucStrstrSearch.1
-	.byte 0x83
-	.byte 0x02
-	.byte 0x0c
-	.8byte 0xffffffffffffe807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.5-..___tag_value_NucStrstrSearch.3
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.6-..___tag_value_NucStrstrSearch.5
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.7-..___tag_value_NucStrstrSearch.6
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.8-..___tag_value_NucStrstrSearch.7
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.9-..___tag_value_NucStrstrSearch.8
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.10-..___tag_value_NucStrstrSearch.9
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.11-..___tag_value_NucStrstrSearch.10
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.12-..___tag_value_NucStrstrSearch.11
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.13-..___tag_value_NucStrstrSearch.12
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.14-..___tag_value_NucStrstrSearch.13
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.18-..___tag_value_NucStrstrSearch.14
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.20-..___tag_value_NucStrstrSearch.18
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.21-..___tag_value_NucStrstrSearch.20
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.23-..___tag_value_NucStrstrSearch.21
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.24-..___tag_value_NucStrstrSearch.23
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.25-..___tag_value_NucStrstrSearch.24
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.26-..___tag_value_NucStrstrSearch.25
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.27-..___tag_value_NucStrstrSearch.26
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.31-..___tag_value_NucStrstrSearch.27
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.32-..___tag_value_NucStrstrSearch.31
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.33-..___tag_value_NucStrstrSearch.32
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.34-..___tag_value_NucStrstrSearch.33
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.35-..___tag_value_NucStrstrSearch.34
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.39-..___tag_value_NucStrstrSearch.35
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.41-..___tag_value_NucStrstrSearch.39
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.42-..___tag_value_NucStrstrSearch.41
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.44-..___tag_value_NucStrstrSearch.42
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.45-..___tag_value_NucStrstrSearch.44
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.46-..___tag_value_NucStrstrSearch.45
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.47-..___tag_value_NucStrstrSearch.46
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.48-..___tag_value_NucStrstrSearch.47
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.52-..___tag_value_NucStrstrSearch.48
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.54-..___tag_value_NucStrstrSearch.52
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.55-..___tag_value_NucStrstrSearch.54
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.57-..___tag_value_NucStrstrSearch.55
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.58-..___tag_value_NucStrstrSearch.57
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.59-..___tag_value_NucStrstrSearch.58
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.60-..___tag_value_NucStrstrSearch.59
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.61-..___tag_value_NucStrstrSearch.60
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.65-..___tag_value_NucStrstrSearch.61
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.67-..___tag_value_NucStrstrSearch.65
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.68-..___tag_value_NucStrstrSearch.67
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.70-..___tag_value_NucStrstrSearch.68
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.71-..___tag_value_NucStrstrSearch.70
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.72-..___tag_value_NucStrstrSearch.71
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.73-..___tag_value_NucStrstrSearch.72
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.74-..___tag_value_NucStrstrSearch.73
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.78-..___tag_value_NucStrstrSearch.74
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.80-..___tag_value_NucStrstrSearch.78
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.81-..___tag_value_NucStrstrSearch.80
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.83-..___tag_value_NucStrstrSearch.81
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.84-..___tag_value_NucStrstrSearch.83
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.85-..___tag_value_NucStrstrSearch.84
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.86-..___tag_value_NucStrstrSearch.85
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.87-..___tag_value_NucStrstrSearch.86
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.91-..___tag_value_NucStrstrSearch.87
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.93-..___tag_value_NucStrstrSearch.91
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.94-..___tag_value_NucStrstrSearch.93
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.96-..___tag_value_NucStrstrSearch.94
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.97-..___tag_value_NucStrstrSearch.96
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.98-..___tag_value_NucStrstrSearch.97
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.99-..___tag_value_NucStrstrSearch.98
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.100-..___tag_value_NucStrstrSearch.99
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.104-..___tag_value_NucStrstrSearch.100
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.106-..___tag_value_NucStrstrSearch.104
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.107-..___tag_value_NucStrstrSearch.106
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.109-..___tag_value_NucStrstrSearch.107
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.110-..___tag_value_NucStrstrSearch.109
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.111-..___tag_value_NucStrstrSearch.110
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.112-..___tag_value_NucStrstrSearch.111
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.113-..___tag_value_NucStrstrSearch.112
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.117-..___tag_value_NucStrstrSearch.113
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.119-..___tag_value_NucStrstrSearch.117
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.120-..___tag_value_NucStrstrSearch.119
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.122-..___tag_value_NucStrstrSearch.120
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.123-..___tag_value_NucStrstrSearch.122
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.124-..___tag_value_NucStrstrSearch.123
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.125-..___tag_value_NucStrstrSearch.124
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.126-..___tag_value_NucStrstrSearch.125
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.130-..___tag_value_NucStrstrSearch.126
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.132-..___tag_value_NucStrstrSearch.130
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.133-..___tag_value_NucStrstrSearch.132
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.135-..___tag_value_NucStrstrSearch.133
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.136-..___tag_value_NucStrstrSearch.135
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.137-..___tag_value_NucStrstrSearch.136
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.138-..___tag_value_NucStrstrSearch.137
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.139-..___tag_value_NucStrstrSearch.138
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.143-..___tag_value_NucStrstrSearch.139
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.145-..___tag_value_NucStrstrSearch.143
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.146-..___tag_value_NucStrstrSearch.145
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.148-..___tag_value_NucStrstrSearch.146
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.149-..___tag_value_NucStrstrSearch.148
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.150-..___tag_value_NucStrstrSearch.149
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.151-..___tag_value_NucStrstrSearch.150
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.152-..___tag_value_NucStrstrSearch.151
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.156-..___tag_value_NucStrstrSearch.152
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.158-..___tag_value_NucStrstrSearch.156
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.159-..___tag_value_NucStrstrSearch.158
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x83
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.161-..___tag_value_NucStrstrSearch.159
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.162-..___tag_value_NucStrstrSearch.161
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.163-..___tag_value_NucStrstrSearch.162
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.164-..___tag_value_NucStrstrSearch.163
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.165-..___tag_value_NucStrstrSearch.164
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.169-..___tag_value_NucStrstrSearch.165
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.171-..___tag_value_NucStrstrSearch.169
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.172-..___tag_value_NucStrstrSearch.171
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x83
-	.byte 0x02
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.178-..___tag_value_NucStrstrSearch.172
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.180-..___tag_value_NucStrstrSearch.178
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.181-..___tag_value_NucStrstrSearch.180
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x83
-	.byte 0x02
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x05
-	.byte 0x8f
-	.byte 0x06
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.187-..___tag_value_NucStrstrSearch.181
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.188-..___tag_value_NucStrstrSearch.187
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.189-..___tag_value_NucStrstrSearch.188
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.190-..___tag_value_NucStrstrSearch.189
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.191-..___tag_value_NucStrstrSearch.190
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrSearch.193-..___tag_value_NucStrstrSearch.191
-	.byte 0x0c
-	.2byte 0x0807
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x0000018c
-	.4byte 0x0000047c
-	.4byte ..___tag_value_eval_4na_pos.195-.
-	.4byte ..___tag_value_eval_4na_pos.255-..___tag_value_eval_4na_pos.195
-	.byte 0x00
-	.byte 0x0c
-	.8byte 0xffffffffffffe007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.197-..___tag_value_eval_4na_pos.195
-	.byte 0x8c
-	.byte 0x02
-	.byte 0x0c
-	.8byte 0xffffffffffffe807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.199-..___tag_value_eval_4na_pos.197
-	.byte 0x86
-	.byte 0x03
-	.byte 0x0c
-	.8byte 0xfffffffffffff007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.201-..___tag_value_eval_4na_pos.199
-	.byte 0x83
-	.byte 0x04
-	.byte 0x0c
-	.8byte 0xfffffffffffff807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.204-..___tag_value_eval_4na_pos.201
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.206-..___tag_value_eval_4na_pos.204
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.208-..___tag_value_eval_4na_pos.206
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.210-..___tag_value_eval_4na_pos.208
-	.byte 0x0c
-	.8byte 0xfffffffffffff807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.211-..___tag_value_eval_4na_pos.210
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x83
-	.byte 0x04
-	.byte 0x86
-	.byte 0x03
-	.byte 0x8c
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.215-..___tag_value_eval_4na_pos.211
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.217-..___tag_value_eval_4na_pos.215
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.219-..___tag_value_eval_4na_pos.217
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.221-..___tag_value_eval_4na_pos.219
-	.byte 0x0c
-	.8byte 0xfffffffffffff807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.222-..___tag_value_eval_4na_pos.221
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x83
-	.byte 0x04
-	.byte 0x86
-	.byte 0x03
-	.byte 0x8c
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.226-..___tag_value_eval_4na_pos.222
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.228-..___tag_value_eval_4na_pos.226
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.230-..___tag_value_eval_4na_pos.228
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.232-..___tag_value_eval_4na_pos.230
-	.byte 0x0c
-	.8byte 0xfffffffffffff807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.233-..___tag_value_eval_4na_pos.232
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x83
-	.byte 0x04
-	.byte 0x86
-	.byte 0x03
-	.byte 0x8c
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.237-..___tag_value_eval_4na_pos.233
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.239-..___tag_value_eval_4na_pos.237
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.241-..___tag_value_eval_4na_pos.239
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.243-..___tag_value_eval_4na_pos.241
-	.byte 0x0c
-	.8byte 0xfffffffffffff807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.244-..___tag_value_eval_4na_pos.243
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x83
-	.byte 0x04
-	.byte 0x86
-	.byte 0x03
-	.byte 0x8c
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.248-..___tag_value_eval_4na_pos.244
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.250-..___tag_value_eval_4na_pos.248
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.252-..___tag_value_eval_4na_pos.250
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_pos.254-..___tag_value_eval_4na_pos.252
-	.byte 0x0c
-	.8byte 0xfffffffffffff807
-	.2byte 0xffff
-	.byte 0x01
-	.4byte 0x00000000
-	.byte 0x00
-	.4byte 0x000001a4
-	.4byte 0x0000060c
-	.4byte ..___tag_value_eval_2na_pos.256-.
-	.4byte ..___tag_value_eval_2na_pos.332-..___tag_value_eval_2na_pos.256
-	.byte 0x00
-	.byte 0x0c
-	.8byte 0xffffffffffffe007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.258-..___tag_value_eval_2na_pos.256
-	.byte 0x8f
-	.byte 0x02
-	.byte 0x0c
-	.8byte 0xffffffffffffe807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.260-..___tag_value_eval_2na_pos.258
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x0c
-	.8byte 0xfffffffffffff007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.262-..___tag_value_eval_2na_pos.260
-	.byte 0x86
-	.byte 0x04
-	.byte 0x0c
-	.8byte 0xfffffffffffff807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.264-..___tag_value_eval_2na_pos.262
-	.byte 0x83
-	.byte 0x05
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x0c
-	.2byte 0x2807
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.267-..___tag_value_eval_2na_pos.264
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.269-..___tag_value_eval_2na_pos.267
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.271-..___tag_value_eval_2na_pos.269
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.273-..___tag_value_eval_2na_pos.271
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.275-..___tag_value_eval_2na_pos.273
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.276-..___tag_value_eval_2na_pos.275
-	.byte 0x0c
-	.2byte 0x2807
-	.byte 0x83
-	.byte 0x05
-	.byte 0x86
-	.byte 0x04
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8f
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.281-..___tag_value_eval_2na_pos.276
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.283-..___tag_value_eval_2na_pos.281
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.285-..___tag_value_eval_2na_pos.283
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.287-..___tag_value_eval_2na_pos.285
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.289-..___tag_value_eval_2na_pos.287
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.290-..___tag_value_eval_2na_pos.289
-	.byte 0x0c
-	.2byte 0x2807
-	.byte 0x83
-	.byte 0x05
-	.byte 0x86
-	.byte 0x04
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8f
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.295-..___tag_value_eval_2na_pos.290
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.297-..___tag_value_eval_2na_pos.295
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.299-..___tag_value_eval_2na_pos.297
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.301-..___tag_value_eval_2na_pos.299
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.303-..___tag_value_eval_2na_pos.301
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.304-..___tag_value_eval_2na_pos.303
-	.byte 0x0c
-	.2byte 0x2807
-	.byte 0x83
-	.byte 0x05
-	.byte 0x86
-	.byte 0x04
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8f
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.309-..___tag_value_eval_2na_pos.304
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.311-..___tag_value_eval_2na_pos.309
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.313-..___tag_value_eval_2na_pos.311
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.315-..___tag_value_eval_2na_pos.313
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.317-..___tag_value_eval_2na_pos.315
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.318-..___tag_value_eval_2na_pos.317
-	.byte 0x0c
-	.2byte 0x2807
-	.byte 0x83
-	.byte 0x05
-	.byte 0x86
-	.byte 0x04
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8f
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.323-..___tag_value_eval_2na_pos.318
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.325-..___tag_value_eval_2na_pos.323
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.327-..___tag_value_eval_2na_pos.325
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.329-..___tag_value_eval_2na_pos.327
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_pos.331-..___tag_value_eval_2na_pos.329
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x00
-	.4byte 0x000000ec
-	.4byte 0x000007b4
-	.4byte ..___tag_value_eval_4na_128.333-.
-	.4byte ..___tag_value_eval_4na_128.361-..___tag_value_eval_4na_128.333
-	.byte 0x00
-	.byte 0x0c
-	.8byte 0xffffffffffffe007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.335-..___tag_value_eval_4na_128.333
-	.byte 0x86
-	.byte 0x02
-	.byte 0x0c
-	.8byte 0xffffffffffffe807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.337-..___tag_value_eval_4na_128.335
-	.byte 0x83
-	.byte 0x03
-	.byte 0x0c
-	.8byte 0xfffffffffffff007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.340-..___tag_value_eval_4na_128.337
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.342-..___tag_value_eval_4na_128.340
-	.byte 0x0c
-	.8byte 0xfffffffffffff807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.344-..___tag_value_eval_4na_128.342
-	.byte 0x0c
-	.8byte 0xfffffffffffff007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.345-..___tag_value_eval_4na_128.344
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x83
-	.byte 0x03
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.348-..___tag_value_eval_4na_128.345
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.350-..___tag_value_eval_4na_128.348
-	.byte 0x0c
-	.8byte 0xfffffffffffff807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.352-..___tag_value_eval_4na_128.350
-	.byte 0x0c
-	.8byte 0xfffffffffffff007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.353-..___tag_value_eval_4na_128.352
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x83
-	.byte 0x03
-	.byte 0x86
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.356-..___tag_value_eval_4na_128.353
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.358-..___tag_value_eval_4na_128.356
-	.byte 0x0c
-	.8byte 0xfffffffffffff807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_128.360-..___tag_value_eval_4na_128.358
-	.byte 0x0c
-	.8byte 0xfffffffffffff007
-	.2byte 0xffff
-	.byte 0x01
-	.2byte 0x0000
-	.4byte 0x00000124
-	.4byte 0x000008a4
-	.4byte ..___tag_value_eval_4na_32.362-.
-	.4byte ..___tag_value_eval_4na_32.403-..___tag_value_eval_4na_32.362
-	.byte 0x00
-	.byte 0x0c
-	.8byte 0xffffffffffffd007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.364-..___tag_value_eval_4na_32.362
-	.byte 0x8f
-	.byte 0x02
-	.byte 0x0c
-	.8byte 0xffffffffffffd807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.366-..___tag_value_eval_4na_32.364
-	.byte 0x8e
-	.byte 0x03
-	.byte 0x0c
-	.8byte 0xffffffffffffe007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.368-..___tag_value_eval_4na_32.366
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x0c
-	.8byte 0xffffffffffffe807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.370-..___tag_value_eval_4na_32.368
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x0c
-	.8byte 0xfffffffffffff007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.372-..___tag_value_eval_4na_32.370
-	.byte 0x83
-	.byte 0x06
-	.byte 0x0c
-	.8byte 0xfffffffffffff807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.375-..___tag_value_eval_4na_32.372
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.377-..___tag_value_eval_4na_32.375
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.379-..___tag_value_eval_4na_32.377
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.381-..___tag_value_eval_4na_32.379
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.383-..___tag_value_eval_4na_32.381
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.385-..___tag_value_eval_4na_32.383
-	.byte 0x0c
-	.8byte 0xfffffffffffff807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.386-..___tag_value_eval_4na_32.385
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x83
-	.byte 0x06
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x03
-	.byte 0x8f
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.392-..___tag_value_eval_4na_32.386
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.394-..___tag_value_eval_4na_32.392
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.396-..___tag_value_eval_4na_32.394
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.398-..___tag_value_eval_4na_32.396
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.400-..___tag_value_eval_4na_32.398
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_32.402-..___tag_value_eval_4na_32.400
-	.byte 0x0c
-	.8byte 0xfffffffffffff807
-	.2byte 0xffff
-	.byte 0x01
-	.4byte 0x00000000
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x000000cc
-	.4byte 0x000009cc
-	.4byte ..___tag_value_eval_4na_16.404-.
-	.4byte ..___tag_value_eval_4na_16.431-..___tag_value_eval_4na_16.404
-	.byte 0x00
-	.byte 0x0c
-	.8byte 0xffffffffffffe007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.406-..___tag_value_eval_4na_16.404
-	.byte 0x8d
-	.byte 0x02
-	.byte 0x0c
-	.8byte 0xffffffffffffe807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.408-..___tag_value_eval_4na_16.406
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x0c
-	.8byte 0xfffffffffffff007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.410-..___tag_value_eval_4na_16.408
-	.byte 0x83
-	.byte 0x04
-	.byte 0x0c
-	.8byte 0xfffffffffffff807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.413-..___tag_value_eval_4na_16.410
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.415-..___tag_value_eval_4na_16.413
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.417-..___tag_value_eval_4na_16.415
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.419-..___tag_value_eval_4na_16.417
-	.byte 0x0c
-	.8byte 0xfffffffffffff807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.420-..___tag_value_eval_4na_16.419
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x83
-	.byte 0x04
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8d
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.424-..___tag_value_eval_4na_16.420
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.426-..___tag_value_eval_4na_16.424
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.428-..___tag_value_eval_4na_16.426
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_16.430-..___tag_value_eval_4na_16.428
-	.byte 0x0c
-	.8byte 0xfffffffffffff807
-	.2byte 0xffff
-	.byte 0x01
-	.4byte 0x00000000
-	.byte 0x00
-	.4byte 0x000000d4
-	.4byte 0x00000a9c
-	.4byte ..___tag_value_eval_2na_128.432-.
-	.4byte ..___tag_value_eval_2na_128.467-..___tag_value_eval_2na_128.432
-	.byte 0x00
-	.byte 0x0c
-	.8byte 0xfffffffffffff007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.434-..___tag_value_eval_2na_128.432
-	.byte 0x8f
-	.byte 0x02
-	.byte 0x0c
-	.8byte 0xfffffffffffff807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.436-..___tag_value_eval_2na_128.434
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.438-..___tag_value_eval_2na_128.436
-	.byte 0x83
-	.byte 0x04
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.441-..___tag_value_eval_2na_128.438
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.442-..___tag_value_eval_2na_128.441
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.444-..___tag_value_eval_2na_128.442
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.446-..___tag_value_eval_2na_128.444
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.447-..___tag_value_eval_2na_128.446
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x83
-	.byte 0x04
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8f
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.451-..___tag_value_eval_2na_128.447
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.452-..___tag_value_eval_2na_128.451
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.454-..___tag_value_eval_2na_128.452
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.456-..___tag_value_eval_2na_128.454
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.457-..___tag_value_eval_2na_128.456
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x83
-	.byte 0x04
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8f
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.461-..___tag_value_eval_2na_128.457
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.462-..___tag_value_eval_2na_128.461
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.464-..___tag_value_eval_2na_128.462
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_128.466-..___tag_value_eval_2na_128.464
-	.byte 0x0c
-	.2byte 0x0807
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x00000134
-	.4byte 0x00000b74
-	.4byte ..___tag_value_eval_2na_32.468-.
-	.4byte ..___tag_value_eval_2na_32.516-..___tag_value_eval_2na_32.468
-	.byte 0x00
-	.byte 0x0c
-	.8byte 0xffffffffffffd007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.470-..___tag_value_eval_2na_32.468
-	.byte 0x8f
-	.byte 0x02
-	.byte 0x0c
-	.8byte 0xffffffffffffd807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.472-..___tag_value_eval_2na_32.470
-	.byte 0x8e
-	.byte 0x03
-	.byte 0x0c
-	.8byte 0xffffffffffffe007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.474-..___tag_value_eval_2na_32.472
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x0c
-	.8byte 0xffffffffffffe807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.476-..___tag_value_eval_2na_32.474
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x0c
-	.8byte 0xfffffffffffff007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.478-..___tag_value_eval_2na_32.476
-	.byte 0x86
-	.byte 0x06
-	.byte 0x0c
-	.8byte 0xfffffffffffff807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.480-..___tag_value_eval_2na_32.478
-	.byte 0x83
-	.byte 0x07
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x0c
-	.2byte 0x3807
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.483-..___tag_value_eval_2na_32.480
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.485-..___tag_value_eval_2na_32.483
-	.byte 0x0c
-	.2byte 0x2807
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.487-..___tag_value_eval_2na_32.485
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.489-..___tag_value_eval_2na_32.487
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.491-..___tag_value_eval_2na_32.489
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.493-..___tag_value_eval_2na_32.491
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.495-..___tag_value_eval_2na_32.493
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.496-..___tag_value_eval_2na_32.495
-	.byte 0x0c
-	.2byte 0x3807
-	.byte 0x83
-	.byte 0x07
-	.byte 0x86
-	.byte 0x06
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x03
-	.byte 0x8f
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.503-..___tag_value_eval_2na_32.496
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.505-..___tag_value_eval_2na_32.503
-	.byte 0x0c
-	.2byte 0x2807
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.507-..___tag_value_eval_2na_32.505
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.509-..___tag_value_eval_2na_32.507
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.511-..___tag_value_eval_2na_32.509
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.513-..___tag_value_eval_2na_32.511
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_32.515-..___tag_value_eval_2na_32.513
-	.byte 0x0c
-	.2byte 0x0007
-	.4byte 0x00000000
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x00000134
-	.4byte 0x00000cac
-	.4byte ..___tag_value_eval_2na_16.517-.
-	.4byte ..___tag_value_eval_2na_16.565-..___tag_value_eval_2na_16.517
-	.byte 0x00
-	.byte 0x0c
-	.8byte 0xffffffffffffd007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.519-..___tag_value_eval_2na_16.517
-	.byte 0x8f
-	.byte 0x02
-	.byte 0x0c
-	.8byte 0xffffffffffffd807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.521-..___tag_value_eval_2na_16.519
-	.byte 0x8e
-	.byte 0x03
-	.byte 0x0c
-	.8byte 0xffffffffffffe007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.523-..___tag_value_eval_2na_16.521
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x0c
-	.8byte 0xffffffffffffe807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.525-..___tag_value_eval_2na_16.523
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x0c
-	.8byte 0xfffffffffffff007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.527-..___tag_value_eval_2na_16.525
-	.byte 0x86
-	.byte 0x06
-	.byte 0x0c
-	.8byte 0xfffffffffffff807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.529-..___tag_value_eval_2na_16.527
-	.byte 0x83
-	.byte 0x07
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x0c
-	.2byte 0x3807
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.532-..___tag_value_eval_2na_16.529
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.534-..___tag_value_eval_2na_16.532
-	.byte 0x0c
-	.2byte 0x2807
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.536-..___tag_value_eval_2na_16.534
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.538-..___tag_value_eval_2na_16.536
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.540-..___tag_value_eval_2na_16.538
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.542-..___tag_value_eval_2na_16.540
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.544-..___tag_value_eval_2na_16.542
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.545-..___tag_value_eval_2na_16.544
-	.byte 0x0c
-	.2byte 0x3807
-	.byte 0x83
-	.byte 0x07
-	.byte 0x86
-	.byte 0x06
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x03
-	.byte 0x8f
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.552-..___tag_value_eval_2na_16.545
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.554-..___tag_value_eval_2na_16.552
-	.byte 0x0c
-	.2byte 0x2807
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.556-..___tag_value_eval_2na_16.554
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.558-..___tag_value_eval_2na_16.556
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.560-..___tag_value_eval_2na_16.558
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.562-..___tag_value_eval_2na_16.560
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_16.564-..___tag_value_eval_2na_16.562
-	.byte 0x0c
-	.2byte 0x0007
-	.4byte 0x00000000
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x000000a4
-	.4byte 0x00000de4
-	.4byte ..___tag_value_eval_2na_8.566-.
-	.4byte ..___tag_value_eval_2na_8.591-..___tag_value_eval_2na_8.566
-	.byte 0x00
-	.byte 0x0c
-	.8byte 0xfffffffffffff007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.568-..___tag_value_eval_2na_8.566
-	.byte 0x8d
-	.byte 0x02
-	.byte 0x0c
-	.8byte 0xfffffffffffff807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.570-..___tag_value_eval_2na_8.568
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.572-..___tag_value_eval_2na_8.570
-	.byte 0x83
-	.byte 0x04
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.575-..___tag_value_eval_2na_8.572
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.576-..___tag_value_eval_2na_8.575
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.578-..___tag_value_eval_2na_8.576
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.580-..___tag_value_eval_2na_8.578
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.581-..___tag_value_eval_2na_8.580
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x83
-	.byte 0x04
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8d
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.585-..___tag_value_eval_2na_8.581
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.586-..___tag_value_eval_2na_8.585
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.588-..___tag_value_eval_2na_8.586
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_8.590-..___tag_value_eval_2na_8.588
-	.byte 0x0c
-	.2byte 0x0807
-	.4byte 0x00000000
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x00000124
-	.4byte 0x00000e8c
-	.4byte ..___tag_value_eval_4na_64.592-.
-	.4byte ..___tag_value_eval_4na_64.633-..___tag_value_eval_4na_64.592
-	.byte 0x00
-	.byte 0x0c
-	.8byte 0xffffffffffffd007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.594-..___tag_value_eval_4na_64.592
-	.byte 0x8f
-	.byte 0x02
-	.byte 0x0c
-	.8byte 0xffffffffffffd807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.596-..___tag_value_eval_4na_64.594
-	.byte 0x8e
-	.byte 0x03
-	.byte 0x0c
-	.8byte 0xffffffffffffe007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.598-..___tag_value_eval_4na_64.596
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x0c
-	.8byte 0xffffffffffffe807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.600-..___tag_value_eval_4na_64.598
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x0c
-	.8byte 0xfffffffffffff007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.602-..___tag_value_eval_4na_64.600
-	.byte 0x83
-	.byte 0x06
-	.byte 0x0c
-	.8byte 0xfffffffffffff807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.605-..___tag_value_eval_4na_64.602
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.607-..___tag_value_eval_4na_64.605
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.609-..___tag_value_eval_4na_64.607
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.611-..___tag_value_eval_4na_64.609
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.613-..___tag_value_eval_4na_64.611
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.615-..___tag_value_eval_4na_64.613
-	.byte 0x0c
-	.8byte 0xfffffffffffff807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.616-..___tag_value_eval_4na_64.615
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x83
-	.byte 0x06
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x03
-	.byte 0x8f
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.622-..___tag_value_eval_4na_64.616
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.624-..___tag_value_eval_4na_64.622
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.626-..___tag_value_eval_4na_64.624
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.628-..___tag_value_eval_4na_64.626
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.630-..___tag_value_eval_4na_64.628
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_4na_64.632-..___tag_value_eval_4na_64.630
-	.byte 0x0c
-	.8byte 0xfffffffffffff807
-	.2byte 0xffff
-	.byte 0x01
-	.4byte 0x00000000
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x00000134
-	.4byte 0x00000fb4
-	.4byte ..___tag_value_eval_2na_64.634-.
-	.4byte ..___tag_value_eval_2na_64.682-..___tag_value_eval_2na_64.634
-	.byte 0x00
-	.byte 0x0c
-	.8byte 0xffffffffffffd007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.636-..___tag_value_eval_2na_64.634
-	.byte 0x8f
-	.byte 0x02
-	.byte 0x0c
-	.8byte 0xffffffffffffd807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.638-..___tag_value_eval_2na_64.636
-	.byte 0x8e
-	.byte 0x03
-	.byte 0x0c
-	.8byte 0xffffffffffffe007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.640-..___tag_value_eval_2na_64.638
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x0c
-	.8byte 0xffffffffffffe807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.642-..___tag_value_eval_2na_64.640
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x0c
-	.8byte 0xfffffffffffff007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.644-..___tag_value_eval_2na_64.642
-	.byte 0x86
-	.byte 0x06
-	.byte 0x0c
-	.8byte 0xfffffffffffff807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.646-..___tag_value_eval_2na_64.644
-	.byte 0x83
-	.byte 0x07
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x0c
-	.2byte 0x3807
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.649-..___tag_value_eval_2na_64.646
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.651-..___tag_value_eval_2na_64.649
-	.byte 0x0c
-	.2byte 0x2807
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.653-..___tag_value_eval_2na_64.651
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.655-..___tag_value_eval_2na_64.653
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.657-..___tag_value_eval_2na_64.655
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.659-..___tag_value_eval_2na_64.657
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.661-..___tag_value_eval_2na_64.659
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.662-..___tag_value_eval_2na_64.661
-	.byte 0x0c
-	.2byte 0x3807
-	.byte 0x83
-	.byte 0x07
-	.byte 0x86
-	.byte 0x06
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x03
-	.byte 0x8f
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.669-..___tag_value_eval_2na_64.662
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.671-..___tag_value_eval_2na_64.669
-	.byte 0x0c
-	.2byte 0x2807
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.673-..___tag_value_eval_2na_64.671
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.675-..___tag_value_eval_2na_64.673
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.677-..___tag_value_eval_2na_64.675
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.679-..___tag_value_eval_2na_64.677
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_eval_2na_64.681-..___tag_value_eval_2na_64.679
-	.byte 0x0c
-	.2byte 0x0007
-	.4byte 0x00000000
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x0000019c
-	.4byte 0x000010ec
-	.4byte ..___tag_value_NucStrstrMake.683-.
-	.4byte ..___tag_value_NucStrstrMake.751-..___tag_value_NucStrstrMake.683
-	.byte 0x00
-	.byte 0x0c
-	.8byte 0xffffffffffffc007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.685-..___tag_value_NucStrstrMake.683
-	.byte 0x8f
-	.byte 0x02
-	.byte 0x0c
-	.8byte 0xffffffffffffc807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.687-..___tag_value_NucStrstrMake.685
-	.byte 0x8e
-	.byte 0x03
-	.byte 0x0c
-	.8byte 0xffffffffffffd007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.689-..___tag_value_NucStrstrMake.687
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x0c
-	.8byte 0xffffffffffffd807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.691-..___tag_value_NucStrstrMake.689
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x0c
-	.8byte 0xffffffffffffe007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.693-..___tag_value_NucStrstrMake.691
-	.byte 0x86
-	.byte 0x06
-	.byte 0x0c
-	.8byte 0xffffffffffffe807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.695-..___tag_value_NucStrstrMake.693
-	.byte 0x83
-	.byte 0x07
-	.byte 0x0c
-	.8byte 0xfffffffffffff007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.697-..___tag_value_NucStrstrMake.695
-	.byte 0x0c
-	.2byte 0x5007
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.698-..___tag_value_NucStrstrMake.697
-	.byte 0x0c
-	.2byte 0x3807
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.700-..___tag_value_NucStrstrMake.698
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.702-..___tag_value_NucStrstrMake.700
-	.byte 0x0c
-	.2byte 0x2807
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.704-..___tag_value_NucStrstrMake.702
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.706-..___tag_value_NucStrstrMake.704
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.708-..___tag_value_NucStrstrMake.706
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.710-..___tag_value_NucStrstrMake.708
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.711-..___tag_value_NucStrstrMake.710
-	.byte 0x0c
-	.2byte 0x5007
-	.byte 0x83
-	.byte 0x07
-	.byte 0x86
-	.byte 0x06
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x03
-	.byte 0x8f
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.718-..___tag_value_NucStrstrMake.711
-	.byte 0x0c
-	.2byte 0x3807
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.720-..___tag_value_NucStrstrMake.718
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.722-..___tag_value_NucStrstrMake.720
-	.byte 0x0c
-	.2byte 0x2807
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.724-..___tag_value_NucStrstrMake.722
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.726-..___tag_value_NucStrstrMake.724
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.728-..___tag_value_NucStrstrMake.726
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.730-..___tag_value_NucStrstrMake.728
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.731-..___tag_value_NucStrstrMake.730
-	.byte 0x0c
-	.2byte 0x5007
-	.byte 0x83
-	.byte 0x07
-	.byte 0x86
-	.byte 0x06
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x03
-	.byte 0x8f
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.738-..___tag_value_NucStrstrMake.731
-	.byte 0x0c
-	.2byte 0x3807
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.740-..___tag_value_NucStrstrMake.738
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.742-..___tag_value_NucStrstrMake.740
-	.byte 0x0c
-	.2byte 0x2807
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.744-..___tag_value_NucStrstrMake.742
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.746-..___tag_value_NucStrstrMake.744
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.748-..___tag_value_NucStrstrMake.746
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrMake.750-..___tag_value_NucStrstrMake.748
-	.byte 0x0c
-	.2byte 0x0807
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x00000034
-	.4byte 0x0000128c
-	.4byte ..___tag_value_NucStrstrWhack.752-.
-	.4byte ..___tag_value_NucStrstrWhack.759-..___tag_value_NucStrstrWhack.752
-	.byte 0x00
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrWhack.754-..___tag_value_NucStrstrWhack.752
-	.byte 0x8e
-	.byte 0x02
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrWhack.757-..___tag_value_NucStrstrWhack.754
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrstrWhack.758-..___tag_value_NucStrstrWhack.757
-	.byte 0x0c
-	.2byte 0x0807
-	.4byte 0x00000000
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x0000014c
-	.4byte 0x000012c4
-	.4byte ..___tag_value_nss_unary_expr.760-.
-	.4byte ..___tag_value_nss_unary_expr.815-..___tag_value_nss_unary_expr.760
-	.byte 0x00
-	.byte 0x0c
-	.8byte 0xffffffffffffd007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.762-..___tag_value_nss_unary_expr.760
-	.byte 0x8f
-	.byte 0x02
-	.byte 0x0c
-	.8byte 0xffffffffffffd807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.764-..___tag_value_nss_unary_expr.762
-	.byte 0x8e
-	.byte 0x03
-	.byte 0x0c
-	.8byte 0xffffffffffffe007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.766-..___tag_value_nss_unary_expr.764
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x0c
-	.8byte 0xffffffffffffe807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.768-..___tag_value_nss_unary_expr.766
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x0c
-	.8byte 0xfffffffffffff007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.770-..___tag_value_nss_unary_expr.768
-	.byte 0x86
-	.byte 0x06
-	.byte 0x0c
-	.8byte 0xfffffffffffff807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.772-..___tag_value_nss_unary_expr.770
-	.byte 0x83
-	.byte 0x07
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.774-..___tag_value_nss_unary_expr.772
-	.byte 0x0c
-	.2byte 0x4007
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.775-..___tag_value_nss_unary_expr.774
-	.byte 0x0c
-	.2byte 0x3807
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.777-..___tag_value_nss_unary_expr.775
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.779-..___tag_value_nss_unary_expr.777
-	.byte 0x0c
-	.2byte 0x2807
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.781-..___tag_value_nss_unary_expr.779
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.783-..___tag_value_nss_unary_expr.781
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.785-..___tag_value_nss_unary_expr.783
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.787-..___tag_value_nss_unary_expr.785
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.788-..___tag_value_nss_unary_expr.787
-	.byte 0x0c
-	.2byte 0x4007
-	.byte 0x83
-	.byte 0x07
-	.byte 0x86
-	.byte 0x06
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x03
-	.byte 0x8f
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.795-..___tag_value_nss_unary_expr.788
-	.byte 0x0c
-	.2byte 0x3807
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.797-..___tag_value_nss_unary_expr.795
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.799-..___tag_value_nss_unary_expr.797
-	.byte 0x0c
-	.2byte 0x2807
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.801-..___tag_value_nss_unary_expr.799
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.803-..___tag_value_nss_unary_expr.801
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.805-..___tag_value_nss_unary_expr.803
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.807-..___tag_value_nss_unary_expr.805
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_nss_unary_expr.808-..___tag_value_nss_unary_expr.807
-	.byte 0x0c
-	.2byte 0x4007
-	.byte 0x83
-	.byte 0x07
-	.byte 0x86
-	.byte 0x06
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x03
-	.byte 0x8f
-	.byte 0x02
-	.4byte 0x00000000
-	.2byte 0x0000
-	.4byte 0x000001e4
-	.4byte 0x00001414
-	.4byte ..___tag_value_nss_fasta_expr.816-.
-	.4byte ..___tag_value_nss_fasta_expr.905-..___tag_value_nss_fasta_expr.816
-	.byte 0x00
-	.byte 0x0c
-	.8byte 0xfffffffffffff007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.818-..___tag_value_nss_fasta_expr.816
-	.byte 0x8e
-	.byte 0x02
-	.byte 0x0c
-	.8byte 0xfffffffffffff807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.820-..___tag_value_nss_fasta_expr.818
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x0c
-	.2byte 0x0007
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.822-..___tag_value_nss_fasta_expr.820
-	.byte 0x83
-	.byte 0x04
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.825-..___tag_value_nss_fasta_expr.822
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.826-..___tag_value_nss_fasta_expr.825
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.828-..___tag_value_nss_fasta_expr.826
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.830-..___tag_value_nss_fasta_expr.828
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.831-..___tag_value_nss_fasta_expr.830
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x83
-	.byte 0x04
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8e
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.835-..___tag_value_nss_fasta_expr.831
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.836-..___tag_value_nss_fasta_expr.835
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.838-..___tag_value_nss_fasta_expr.836
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.840-..___tag_value_nss_fasta_expr.838
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.841-..___tag_value_nss_fasta_expr.840
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x83
-	.byte 0x04
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8e
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.845-..___tag_value_nss_fasta_expr.841
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.846-..___tag_value_nss_fasta_expr.845
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.848-..___tag_value_nss_fasta_expr.846
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.850-..___tag_value_nss_fasta_expr.848
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.851-..___tag_value_nss_fasta_expr.850
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x83
-	.byte 0x04
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8e
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.855-..___tag_value_nss_fasta_expr.851
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.856-..___tag_value_nss_fasta_expr.855
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.858-..___tag_value_nss_fasta_expr.856
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.860-..___tag_value_nss_fasta_expr.858
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.861-..___tag_value_nss_fasta_expr.860
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x83
-	.byte 0x04
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8e
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.865-..___tag_value_nss_fasta_expr.861
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.866-..___tag_value_nss_fasta_expr.865
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.868-..___tag_value_nss_fasta_expr.866
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.870-..___tag_value_nss_fasta_expr.868
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.871-..___tag_value_nss_fasta_expr.870
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x83
-	.byte 0x04
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8e
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.875-..___tag_value_nss_fasta_expr.871
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.876-..___tag_value_nss_fasta_expr.875
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.878-..___tag_value_nss_fasta_expr.876
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.880-..___tag_value_nss_fasta_expr.878
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.881-..___tag_value_nss_fasta_expr.880
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x83
-	.byte 0x04
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8e
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.885-..___tag_value_nss_fasta_expr.881
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.886-..___tag_value_nss_fasta_expr.885
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.888-..___tag_value_nss_fasta_expr.886
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.890-..___tag_value_nss_fasta_expr.888
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.891-..___tag_value_nss_fasta_expr.890
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x83
-	.byte 0x04
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8e
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.895-..___tag_value_nss_fasta_expr.891
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.896-..___tag_value_nss_fasta_expr.895
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.898-..___tag_value_nss_fasta_expr.896
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.900-..___tag_value_nss_fasta_expr.898
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_nss_fasta_expr.901-..___tag_value_nss_fasta_expr.900
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x83
-	.byte 0x04
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8e
-	.byte 0x02
-	.byte 0x00
-	.4byte 0x0000012c
-	.4byte 0x000015fc
-	.4byte ..___tag_value_NucStrFastaExprMake2.906-.
-	.4byte ..___tag_value_NucStrFastaExprMake2.954-..___tag_value_NucStrFastaExprMake2.906
-	.byte 0x00
-	.byte 0x0c
-	.8byte 0xffffffffffffc007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.908-..___tag_value_NucStrFastaExprMake2.906
-	.byte 0x8d
-	.byte 0x02
-	.byte 0x0c
-	.8byte 0xffffffffffffc807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.910-..___tag_value_NucStrFastaExprMake2.908
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x0c
-	.8byte 0xffffffffffffd007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.912-..___tag_value_NucStrFastaExprMake2.910
-	.byte 0x86
-	.byte 0x04
-	.byte 0x0c
-	.8byte 0xffffffffffffd807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.914-..___tag_value_NucStrFastaExprMake2.912
-	.byte 0x83
-	.byte 0x05
-	.byte 0x0c
-	.8byte 0xffffffffffffe007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.916-..___tag_value_NucStrFastaExprMake2.914
-	.byte 0x0c
-	.2byte 0x5007
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.917-..___tag_value_NucStrFastaExprMake2.916
-	.byte 0x0c
-	.2byte 0x2807
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.919-..___tag_value_NucStrFastaExprMake2.917
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.921-..___tag_value_NucStrFastaExprMake2.919
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.923-..___tag_value_NucStrFastaExprMake2.921
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.925-..___tag_value_NucStrFastaExprMake2.923
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.926-..___tag_value_NucStrFastaExprMake2.925
-	.byte 0x0c
-	.2byte 0x5007
-	.byte 0x83
-	.byte 0x05
-	.byte 0x86
-	.byte 0x04
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8d
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.931-..___tag_value_NucStrFastaExprMake2.926
-	.byte 0x0c
-	.2byte 0x2807
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.933-..___tag_value_NucStrFastaExprMake2.931
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.935-..___tag_value_NucStrFastaExprMake2.933
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.937-..___tag_value_NucStrFastaExprMake2.935
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.939-..___tag_value_NucStrFastaExprMake2.937
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.940-..___tag_value_NucStrFastaExprMake2.939
-	.byte 0x0c
-	.2byte 0x5007
-	.byte 0x83
-	.byte 0x05
-	.byte 0x86
-	.byte 0x04
-	.byte 0x8c
-	.byte 0x03
-	.byte 0x8d
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.945-..___tag_value_NucStrFastaExprMake2.940
-	.byte 0x0c
-	.2byte 0x2807
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.947-..___tag_value_NucStrFastaExprMake2.945
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.949-..___tag_value_NucStrFastaExprMake2.947
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.951-..___tag_value_NucStrFastaExprMake2.949
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake2.953-..___tag_value_NucStrFastaExprMake2.951
-	.byte 0x0c
-	.2byte 0x0807
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x0000012c
-	.4byte 0x0000172c
-	.4byte ..___tag_value_NucStrFastaExprMake4.955-.
-	.4byte ..___tag_value_NucStrFastaExprMake4.1003-..___tag_value_NucStrFastaExprMake4.955
-	.byte 0x00
-	.byte 0x0c
-	.8byte 0xffffffffffffc007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.957-..___tag_value_NucStrFastaExprMake4.955
-	.byte 0x8f
-	.byte 0x02
-	.byte 0x0c
-	.8byte 0xffffffffffffc807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.959-..___tag_value_NucStrFastaExprMake4.957
-	.byte 0x8e
-	.byte 0x03
-	.byte 0x0c
-	.8byte 0xffffffffffffd007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.961-..___tag_value_NucStrFastaExprMake4.959
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x0c
-	.8byte 0xffffffffffffd807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.963-..___tag_value_NucStrFastaExprMake4.961
-	.byte 0x83
-	.byte 0x05
-	.byte 0x0c
-	.8byte 0xffffffffffffe007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.965-..___tag_value_NucStrFastaExprMake4.963
-	.byte 0x0c
-	.2byte 0x5007
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.966-..___tag_value_NucStrFastaExprMake4.965
-	.byte 0x0c
-	.2byte 0x2807
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.968-..___tag_value_NucStrFastaExprMake4.966
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.970-..___tag_value_NucStrFastaExprMake4.968
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.972-..___tag_value_NucStrFastaExprMake4.970
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.974-..___tag_value_NucStrFastaExprMake4.972
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.975-..___tag_value_NucStrFastaExprMake4.974
-	.byte 0x0c
-	.2byte 0x5007
-	.byte 0x83
-	.byte 0x05
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x03
-	.byte 0x8f
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.980-..___tag_value_NucStrFastaExprMake4.975
-	.byte 0x0c
-	.2byte 0x2807
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.982-..___tag_value_NucStrFastaExprMake4.980
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.984-..___tag_value_NucStrFastaExprMake4.982
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.986-..___tag_value_NucStrFastaExprMake4.984
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.988-..___tag_value_NucStrFastaExprMake4.986
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.989-..___tag_value_NucStrFastaExprMake4.988
-	.byte 0x0c
-	.2byte 0x5007
-	.byte 0x83
-	.byte 0x05
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x03
-	.byte 0x8f
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.994-..___tag_value_NucStrFastaExprMake4.989
-	.byte 0x0c
-	.2byte 0x2807
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.996-..___tag_value_NucStrFastaExprMake4.994
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.998-..___tag_value_NucStrFastaExprMake4.996
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.1000-..___tag_value_NucStrFastaExprMake4.998
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_NucStrFastaExprMake4.1002-..___tag_value_NucStrFastaExprMake4.1000
-	.byte 0x0c
-	.2byte 0x0807
-	.2byte 0x0000
-	.byte 0x00
-	.4byte 0x0000019c
-	.4byte 0x0000185c
-	.4byte ..___tag_value_nss_expr.1004-.
-	.4byte ..___tag_value_nss_expr.1072-..___tag_value_nss_expr.1004
-	.byte 0x00
-	.byte 0x0c
-	.8byte 0xffffffffffffc007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.1006-..___tag_value_nss_expr.1004
-	.byte 0x8f
-	.byte 0x02
-	.byte 0x0c
-	.8byte 0xffffffffffffc807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.1008-..___tag_value_nss_expr.1006
-	.byte 0x8e
-	.byte 0x03
-	.byte 0x0c
-	.8byte 0xffffffffffffd007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.1010-..___tag_value_nss_expr.1008
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x0c
-	.8byte 0xffffffffffffd807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.1012-..___tag_value_nss_expr.1010
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x0c
-	.8byte 0xffffffffffffe007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.1014-..___tag_value_nss_expr.1012
-	.byte 0x86
-	.byte 0x06
-	.byte 0x0c
-	.8byte 0xffffffffffffe807
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.1016-..___tag_value_nss_expr.1014
-	.byte 0x83
-	.byte 0x07
-	.byte 0x0c
-	.8byte 0xfffffffffffff007
-	.2byte 0xffff
-	.byte 0x01
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.1018-..___tag_value_nss_expr.1016
-	.byte 0x0c
-	.2byte 0x5007
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.1019-..___tag_value_nss_expr.1018
-	.byte 0x0c
-	.2byte 0x3807
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.1021-..___tag_value_nss_expr.1019
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.1023-..___tag_value_nss_expr.1021
-	.byte 0x0c
-	.2byte 0x2807
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.1025-..___tag_value_nss_expr.1023
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.1027-..___tag_value_nss_expr.1025
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.1029-..___tag_value_nss_expr.1027
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.1031-..___tag_value_nss_expr.1029
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.1032-..___tag_value_nss_expr.1031
-	.byte 0x0c
-	.2byte 0x5007
-	.byte 0x83
-	.byte 0x07
-	.byte 0x86
-	.byte 0x06
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x03
-	.byte 0x8f
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.1039-..___tag_value_nss_expr.1032
-	.byte 0x0c
-	.2byte 0x3807
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.1041-..___tag_value_nss_expr.1039
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.1043-..___tag_value_nss_expr.1041
-	.byte 0x0c
-	.2byte 0x2807
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.1045-..___tag_value_nss_expr.1043
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.1047-..___tag_value_nss_expr.1045
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.1049-..___tag_value_nss_expr.1047
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.1051-..___tag_value_nss_expr.1049
-	.byte 0x0c
-	.2byte 0x0807
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.1052-..___tag_value_nss_expr.1051
-	.byte 0x0c
-	.2byte 0x5007
-	.byte 0x83
-	.byte 0x07
-	.byte 0x86
-	.byte 0x06
-	.byte 0x8c
-	.byte 0x05
-	.byte 0x8d
-	.byte 0x04
-	.byte 0x8e
-	.byte 0x03
-	.byte 0x8f
-	.byte 0x02
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.1059-..___tag_value_nss_expr.1052
-	.byte 0x0c
-	.2byte 0x3807
-	.byte 0x09
-	.2byte 0x0303
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.1061-..___tag_value_nss_expr.1059
-	.byte 0x0c
-	.2byte 0x3007
-	.byte 0x09
-	.2byte 0x0606
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.1063-..___tag_value_nss_expr.1061
-	.byte 0x0c
-	.2byte 0x2807
-	.byte 0x09
-	.2byte 0x0c0c
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.1065-..___tag_value_nss_expr.1063
-	.byte 0x0c
-	.2byte 0x2007
-	.byte 0x09
-	.2byte 0x0d0d
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.1067-..___tag_value_nss_expr.1065
-	.byte 0x0c
-	.2byte 0x1807
-	.byte 0x09
-	.2byte 0x0e0e
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.1069-..___tag_value_nss_expr.1067
-	.byte 0x0c
-	.2byte 0x1007
-	.byte 0x09
-	.2byte 0x0f0f
-	.byte 0x04
-	.4byte ..___tag_value_nss_expr.1071-..___tag_value_nss_expr.1069
-	.byte 0x0c
-	.2byte 0x0807
-	.2byte 0x0000
-	.byte 0x00
-# End
diff --git a/libs/search/nucstrstr.c b/libs/search/nucstrstr.c
deleted file mode 100644
index 0d2e3e6..0000000
--- a/libs/search/nucstrstr.c
+++ /dev/null
@@ -1,5313 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <search/extern.h>
-#include <search/nucstrstr.h>
-#include <arch-impl.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <errno.h>
-#include <assert.h>
-#include <stdio.h>
-#include <byteswap.h>
-
-#define TRACE_OPERATIONS 0
-#define TRACE_PARSE 1
-#define TRACE_HEADER 1
-#define TRACE_RESULT 1
-#define TRACE_PATMASK 1
-
-#if __INTEL_COMPILER || defined __SSE2__
-
-#include <emmintrin.h>
-#define INTEL_INTRINSICS 1
-#define NEVER_MATCH 0
-#define RETURN_LOCATION 1
-#define USE_MEMALIGN 0
-
-#endif
-
-#if INTEL_INTRINSICS
-
-#if USE_MEMALIGN
-#include <malloc.h>
-#endif
-
-#define RELOAD_BUFFER 1
-#define NA2_LIMIT 61
-#define NA4_LIMIT 29
-typedef __m128i nucreg_t;
-typedef union
-{
-    uint8_t b [ 16 ];
-    uint16_t w [ 8 ];
-    uint32_t i [ 4 ];
-    uint64_t l [ 2 ];
-    uint128_t s;
-} nucpat_t;
-
-#else
-
-#define NA2_LIMIT 29
-#define NA4_LIMIT 13
-typedef uint64_t nucreg_t;
-typedef union
-{
-    uint8_t b [ 8 ];
-    uint16_t w [ 4 ];
-    uint32_t i [ 2 ];
-    uint64_t l;
-} nucpat_t;
-
-#endif
-
-
-static int8_t fasta_2na_map [ 128 ];
-static int8_t fasta_4na_map [ 128 ];
-static uint16_t expand_2na [ 256 ] =
-   /* AAAA    AAAC    AAAG    AAAT    AACA    AACC    AACG    AACT */
-{   0x1111, 0x1112, 0x1114, 0x1118, 0x1121, 0x1122, 0x1124, 0x1128,
-   /* AAGA    AAGC    AAGG    AAGT    AATA    AATC    AATG    AATT */
-    0x1141, 0x1142, 0x1144, 0x1148, 0x1181, 0x1182, 0x1184, 0x1188,
-   /* ACAA    ACAC    ACAG    ACAT    ACCA    ACCC    ACCG    ACCT */
-    0x1211, 0x1212, 0x1214, 0x1218, 0x1221, 0x1222, 0x1224, 0x1228,
-   /* ACGA    ACGC    ACGG    ACGT    ACTA    ACTC    ACTG    ACTT */
-    0x1241, 0x1242, 0x1244, 0x1248, 0x1281, 0x1282, 0x1284, 0x1288,
-   /* AGAA    AGAC    AGAG    AGAT    AGCA    AGCC    AGCG    AGCT */
-    0x1411, 0x1412, 0x1414, 0x1418, 0x1421, 0x1422, 0x1424, 0x1428,
-   /* AGGA    AGGC    AGGG    AGGT    AGTA    AGTC    AGTG    AGTT */
-    0x1441, 0x1442, 0x1444, 0x1448, 0x1481, 0x1482, 0x1484, 0x1488,
-   /* ATAA    ATAC    ATAG    ATAT    ATCA    ATCC    ATCG    ATCT */
-    0x1811, 0x1812, 0x1814, 0x1818, 0x1821, 0x1822, 0x1824, 0x1828,
-   /* ATGA    ATGC    ATGG    ATGT    ATTA    ATTC    ATTG    ATTT */
-    0x1841, 0x1842, 0x1844, 0x1848, 0x1881, 0x1882, 0x1884, 0x1888,
-   /* CAAA    CAAC    CAAG    CAAT    CACA    CACC    CACG    CACT */
-    0x2111, 0x2112, 0x2114, 0x2118, 0x2121, 0x2122, 0x2124, 0x2128,
-   /* CAGA    CAGC    CAGG    CAGT    CATA    CATC    CATG    CATT */
-    0x2141, 0x2142, 0x2144, 0x2148, 0x2181, 0x2182, 0x2184, 0x2188,
-   /* CCAA    CCAC    CCAG    CCAT    CCCA    CCCC    CCCG    CCCT */
-    0x2211, 0x2212, 0x2214, 0x2218, 0x2221, 0x2222, 0x2224, 0x2228,
-   /* CCGA    CCGC    CCGG    CCGT    CCTA    CCTC    CCTG    CCTT */
-    0x2241, 0x2242, 0x2244, 0x2248, 0x2281, 0x2282, 0x2284, 0x2288,
-   /* CGAA    CGAC    CGAG    CGAT    CGCA    CGCC    CGCG    CGCT */
-    0x2411, 0x2412, 0x2414, 0x2418, 0x2421, 0x2422, 0x2424, 0x2428,
-   /* CGGA    CGGC    CGGG    CGGT    CGTA    CGTC    CGTG    CGTT */
-    0x2441, 0x2442, 0x2444, 0x2448, 0x2481, 0x2482, 0x2484, 0x2488,
-   /* CTAA    CTAC    CTAG    CTAT    CTCA    CTCC    CTCG    CTCT */
-    0x2811, 0x2812, 0x2814, 0x2818, 0x2821, 0x2822, 0x2824, 0x2828,
-   /* CTGA    CTGC    CTGG    CTGT    CTTA    CTTC    CTTG    CTTT */
-    0x2841, 0x2842, 0x2844, 0x2848, 0x2881, 0x2882, 0x2884, 0x2888,
-   /* GAAA    GAAC    GAAG    GAAT    GACA    GACC    GACG    GACT */
-    0x4111, 0x4112, 0x4114, 0x4118, 0x4121, 0x4122, 0x4124, 0x4128,
-   /* GAGA    GAGC    GAGG    GAGT    GATA    GATC    GATG    GATT */
-    0x4141, 0x4142, 0x4144, 0x4148, 0x4181, 0x4182, 0x4184, 0x4188,
-   /* GCAA    GCAC    GCAG    GCAT    GCCA    GCCC    GCCG    GCCT */
-    0x4211, 0x4212, 0x4214, 0x4218, 0x4221, 0x4222, 0x4224, 0x4228,
-   /* GCGA    GCGC    GCGG    GCGT    GCTA    GCTC    GCTG    GCTT */
-    0x4241, 0x4242, 0x4244, 0x4248, 0x4281, 0x4282, 0x4284, 0x4288,
-   /* GGAA    GGAC    GGAG    GGAT    GGCA    GGCC    GGCG    GGCT */
-    0x4411, 0x4412, 0x4414, 0x4418, 0x4421, 0x4422, 0x4424, 0x4428,
-   /* GGGA    GGGC    GGGG    GGGT    GGTA    GGTC    GGTG    GGTT */
-    0x4441, 0x4442, 0x4444, 0x4448, 0x4481, 0x4482, 0x4484, 0x4488,
-   /* GTAA    GTAC    GTAG    GTAT    GTCA    GTCC    GTCG    GTCT */
-    0x4811, 0x4812, 0x4814, 0x4818, 0x4821, 0x4822, 0x4824, 0x4828,
-   /* GTGA    GTGC    GTGG    GTGT    GTTA    GTTC    GTTG    GTTT */
-    0x4841, 0x4842, 0x4844, 0x4848, 0x4881, 0x4882, 0x4884, 0x4888,
-   /* TAAA    TAAC    TAAG    TAAT    TACA    TACC    TACG    TACT */
-    0x8111, 0x8112, 0x8114, 0x8118, 0x8121, 0x8122, 0x8124, 0x8128,
-   /* TAGA    TAGC    TAGG    TAGT    TATA    TATC    TATG    TATT */
-    0x8141, 0x8142, 0x8144, 0x8148, 0x8181, 0x8182, 0x8184, 0x8188,
-   /* TCAA    TCAC    TCAG    TCAT    TCCA    TCCC    TCCG    TCCT */
-    0x8211, 0x8212, 0x8214, 0x8218, 0x8221, 0x8222, 0x8224, 0x8228,
-   /* TCGA    TCGC    TCGG    TCGT    TCTA    TCTC    TCTG    TCTT */
-    0x8241, 0x8242, 0x8244, 0x8248, 0x8281, 0x8282, 0x8284, 0x8288,
-   /* TGAA    TGAC    TGAG    TGAT    TGCA    TGCC    TGCG    TGCT */
-    0x8411, 0x8412, 0x8414, 0x8418, 0x8421, 0x8422, 0x8424, 0x8428,
-   /* TGGA    TGGC    TGGG    TGGT    TGTA    TGTC    TGTG    TGTT */
-    0x8441, 0x8442, 0x8444, 0x8448, 0x8481, 0x8482, 0x8484, 0x8488,
-   /* TTAA    TTAC    TTAG    TTAT    TTCA    TTCC    TTCG    TTCT */
-    0x8811, 0x8812, 0x8814, 0x8818, 0x8821, 0x8822, 0x8824, 0x8828,
-   /* TTGA    TTGC    TTGG    TTGT    TTTA    TTTC    TTTG    TTTT */
-    0x8841, 0x8842, 0x8844, 0x8848, 0x8881, 0x8882, 0x8884, 0x8888
-};
-
-
-/*--------------------------------------------------------------------------
- * debugging printf
- */
-#if TRACE_OPERATIONS
-
-#if INTEL_INTRINSICS
-
-#define COPY_NUCREG( to, from ) \
-    _mm_storeu_si128 ( ( __m128i* ) ( to ) . b, ( from ) )
-
-#else
-
-#define COPY_NUCREG( to, from ) \
-    ( ( to ) . b [ 0 ] = ( uint8_t ) ( ( from ) >> 56 ), \
-      ( to ) . b [ 1 ] = ( uint8_t ) ( ( from ) >> 48 ), \
-      ( to ) . b [ 2 ] = ( uint8_t ) ( ( from ) >> 40 ), \
-      ( to ) . b [ 3 ] = ( uint8_t ) ( ( from ) >> 32 ), \
-      ( to ) . b [ 4 ] = ( uint8_t ) ( ( from ) >> 24 ), \
-      ( to ) . b [ 5 ] = ( uint8_t ) ( ( from ) >> 16 ), \
-      ( to ) . b [ 6 ] = ( uint8_t ) ( ( from ) >>  8 ), \
-      ( to ) . b [ 7 ] = ( uint8_t ) ( ( from ) >>  0 ) )
-
-#endif
-
-/* sprintf_2na
- *  print 2na sequence
- */
-static
-const char *sprintf_2na ( char *str, size_t ssize, nucreg_t nr )
-{
-    int b, i, j;
-    nucpat_t np;
-    const char *ncbi2na = "ACGT";
-
-    if ( ssize <= sizeof np * 4 )
-        return "** BUFFER TOO SMALL **";
-
-    COPY_NUCREG ( np, nr );
-
-    for ( i = j = 0; i < sizeof np . b; j += 4, ++ i )
-    {
-        b = np . b [ i ];
-        str [ j + 0 ] = ncbi2na [ ( b >> 6 ) & 3 ];
-        str [ j + 1 ] = ncbi2na [ ( b >> 4 ) & 3 ];
-        str [ j + 2 ] = ncbi2na [ ( b >> 2 ) & 3 ];
-        str [ j + 3 ] = ncbi2na [ ( b >> 0 ) & 3 ];
-    }
-
-    str [ sizeof np * 4 ] = 0;
-
-    return str;
-}
-
-/* sprintf_4na
- *  print 4na sequence
- */
-static
-const char *sprintf_4na ( char *str, size_t ssize, nucreg_t nr )
-{
-    int b, i, j;
-    nucpat_t np;
-    const char *ncbi4na = "-ACMGRSVTWYHKDBN";
-
-    if ( ssize <= sizeof np * 2 )
-        return "** BUFFER TOO SMALL **";
-
-    COPY_NUCREG ( np, nr );
-
-    for ( i = j = 0; i < sizeof np . b; j += 2, ++ i )
-    {
-        b = np . b [ i ];
-        str [ j + 0 ] = ncbi4na [ ( b >> 4 ) & 15 ];
-        str [ j + 1 ] = ncbi4na [ ( b >> 0 ) & 15 ];
-    }
-
-    str [ sizeof np * 2 ] = 0;
-
-    return str;
-}
-
-/* sprintf_m2na
- *  print 2na mask
- */
-static
-const char *sprintf_m2na ( char *str, size_t ssize, nucreg_t mask )
-{
-    int b, i, j;
-    nucpat_t mp;
-    const char *amask = " ??x";
-
-    if ( ssize <= sizeof mp * 4 )
-        return "** BUFFER TOO SMALL **";
-
-    COPY_NUCREG ( mp, mask );
-
-    for ( i = j = 0; i < mp . b; j += 4, ++ i )
-    {
-        b = mp . b [ i ];
-        str [ j + 0 ] = amask [ ( b >> 6 ) & 3 ];
-        str [ j + 1 ] = amask [ ( b >> 4 ) & 3 ];
-        str [ j + 2 ] = amask [ ( b >> 2 ) & 3 ];
-        str [ j + 3 ] = amask [ ( b >> 0 ) & 3 ];
-    }
-
-    str [ sizeof mp * 4 ] = 0;
-
-    return str;
-}
-
-/* sprintf_m4na
- *  print 4na mask
- */
-static
-const char *sprintf_m4na ( char *str, size_t ssize, nucreg_t mask )
-{
-    int b, i, j;
-    nucpat_t mp;
-    const char *amask = " ??????????????x";
-
-    if ( ssize <= sizeof mp * 2 )
-        return "** BUFFER TOO SMALL **";
-
-    COPY_NUCREG ( mp, mask );
-
-    for ( i = j = 0; i < sizeof mp . b; j += 2, ++ i )
-    {
-        b = mp . b [ i ];
-        str [ j + 0 ] = amask [ ( b >> 4 ) & 15 ];
-        str [ j + 1 ] = amask [ ( b >> 0 ) & 15 ];
-    }
-
-    str [ sizeof mp * 2 ] = 0;
-
-    return str;
-}
-
-/* sprintf_a2na
- *  print 2na alignment, where buffer has source,
- *  pattern has some set of valid pattern bases,
- *  and mask defines which parts are valid
- */
-static
-const char *sprintf_a2na ( char *str, size_t ssize,
-    nucreg_t buffer, nucreg_t pattern, nucreg_t mask )
-{
-    nucpat_t bp, pp, mp;
-    int s, b, m, i, j, k, l, s_ch, b_ch;
-    const char *ncbi2na = "    ????????ACGT";
-
-    if ( ssize <= sizeof bp * 4 )
-        return "** BUFFER TOO SMALL **";
-
-    COPY_NUCREG ( bp, buffer );
-    COPY_NUCREG ( pp, pattern );
-    COPY_NUCREG ( mp, mask );
-
-    for ( i = j = 0; i < sizeof bp . b; j += 4, ++ i )
-    {
-        s = bp . b [ i ];
-        b = pp . b [ i ];
-        m = ( int ) mp . b [ i ] << 2;
-
-        for ( k = 0, l = 6; k < 4; l -= 2, ++ k )
-        {
-            s_ch = ncbi2na [ 12 | ( ( s >> l ) & 3 ) ];
-            b_ch = ncbi2na [ ( ( m >> l ) & 12 ) | ( ( b >> l ) & 3 ) ];
-            str [ j + k ] = ( s_ch == b_ch ) ? ( char ) b_ch : ( char ) tolower ( b_ch );
-        }
-    }
-
-    str [ sizeof bp * 4 ] = 0;
-
-    return str;
-}
-
-/* sprintf_a4na
- *  print 4na alignment, where buffer has source,
- *  pattern has some set of valid pattern bases,
- *  and mask defines which parts are valid
- */
-static
-const char *sprintf_a4na ( char *str, size_t ssize,
-    nucreg_t buffer, nucreg_t pattern, nucreg_t mask )
-{
-    nucpat_t bp, pp, mp;
-    int s, b, m, i, j, k, l, s_ch, b_ch;
-    const char *ncbi4na =
-        "                ????????????????????????????????????????????????"
-        "????????????????????????????????????????????????????????????????"
-        "????????????????????????????????????????????????????????????????"
-        "????????????????????????????????????????????????""-ACMGRSVTWYHKDBN";
-    /* the odd ??""- is to prevent a ??- trigraph for ~ */
-
-    if ( ssize <= sizeof bp * 2 )
-        return "** BUFFER TOO SMALL **";
-
-    COPY_NUCREG ( bp, buffer );
-    COPY_NUCREG ( pp, pattern );
-    COPY_NUCREG ( mp, mask );
-
-    for ( i = j = 0; i < sizeof bp . b; j += 2, ++ i )
-    {
-        s = bp . b [ i ];
-        b = pp . b [ i ];
-        m = ( int ) mp . b [ i ] << 4;
-
-        for ( k = 0, l = 4; k < 2; l -= 4, ++ k )
-        {
-#if INTEL_INTRINSICS
-            s_ch = ncbi4na [ ( ( m >> l ) & 0xF0 ) | ( ( s >> l ) & 15 ) ];
-#else
-            s_ch = ncbi4na [ 0xF0 | ( ( s >> l ) & 15 ) ];
-#endif
-            b_ch = ncbi4na [ ( ( m >> l ) & 0xF0 ) | ( ( b >> l ) & 15 ) ];
-            str [ j + k ] =
-                ( ( fasta_4na_map [ s_ch ] & fasta_4na_map [ b_ch ] ) != 0 ) ?
-                ( char ) s_ch : ( char ) tolower ( b_ch );
-        }
-    }
-
-    str [ sizeof bp * 2 ] = 0;
-
-    return str;
-}
-
-/* sprintf_r2na
- *  print results of 2na comparison
- */
-static
-const char *sprintf_r2na ( char *str, size_t ssize, nucreg_t result, nucreg_t mask )
-{
-    nucpat_t rp;
-    int b, i, j;
-    const char *amask = " ??x";
-
-    if ( ssize <= sizeof rp * 4 )
-        return "** BUFFER TOO SMALL **";
-
-    COPY_NUCREG ( rp, result );
-
-    for ( i = j = 0; i < sizeof rp . b; j += 4, ++ i )
-    {
-        b = rp . b [ i ];
-        str [ j + 0 ] = amask [ ( b >> 6 ) & 3 ];
-        str [ j + 1 ] = amask [ ( b >> 4 ) & 3 ];
-        str [ j + 2 ] = amask [ ( b >> 2 ) & 3 ];
-        str [ j + 3 ] = amask [ ( b >> 0 ) & 3 ];
-    }
-
-    str [ sizeof rp * 4 ] = 0;
-
-    return str;
-}
-
-static
-const char *sprintf_r4na ( char *str, size_t ssize, nucreg_t result, nucreg_t mask )
-{
-    int b, i, j;
-    nucpat_t rp;
-    const char *amask = " ??????????????x";
-
-    if ( ssize <= sizeof rp * 2 )
-        return "** BUFFER TOO SMALL **";
-
-    COPY_NUCREG ( rp, result );
-
-    for ( i = j = 0; i < sizeof rp . b; j += 2, ++ i )
-    {
-        b = rp . b [ i ];
-        str [ j + 0 ] = amask [ ( b >> 4 ) & 15 ];
-        str [ j + 1 ] = amask [ ( b >> 0 ) & 15 ];
-    }
-
-    str [ sizeof rp * 2 ] = 0;
-
-    return str;
-}
-
-#endif
-
-#if TRACE_OPERATIONS && TRACE_PARSE
-static
-void PARSE_2NA_PATTERN ( const char *fasta, size_t size,
-    nucpat_t pattern, nucpat_t mask )
-{
-#if INTEL_INTRINSICS
-    char str [ 65 ];
-    nucreg_t nr = _mm_loadu_si128 ( ( const __m128i* ) pattern . b );
-    nucreg_t nm = _mm_loadu_si128 ( ( const __m128i* ) mask . b );
-#else
-    char str [ 33 ];
-    nucreg_t nr = pattern;
-    nucreg_t nm = mask;
-#endif
-
-    assert ( size < sizeof str );
-    memcpy ( str, fasta, size );
-    str [ size ] = 0;
-
-    printf ( "  %s - original FASTA\n", str );
-    printf ( "  %s - pattern\n", sprintf_2na ( str, sizeof str, nr ) );
-    printf ( "  %s - mask\n", sprintf_m2na ( str, sizeof str, nm ) );
-}
-
-static
-void PARSE_4NA_PATTERN ( const char *fasta, size_t size,
-    nucpat_t pattern, nucpat_t mask )
-{
-#if INTEL_INTRINSICS
-    char str [ 33 ];
-    nucreg_t nr = _mm_loadu_si128 ( ( const __m128i* ) pattern . b );
-    nucreg_t nm = _mm_loadu_si128 ( ( const __m128i* ) mask . b );
-#else
-    char str [ 17 ];
-    nucreg_t nr = pattern;
-    nucreg_t nm = mask;
-#endif
-
-    assert ( size < sizeof str );
-    memcpy ( str, fasta, size );
-    str [ size ] = 0;
-
-    printf ( "  %s - original FASTA\n", str );
-    printf ( "  %s - pattern\n", sprintf_4na ( str, sizeof str, nr ) );
-    printf ( "  %s - mask\n", sprintf_m4na ( str, sizeof str, nm ) );
-}
-
-static
-void PARSE_2NA_SHIFT ( unsigned int idx, nucpat_t pattern, nucpat_t mask )
-{
-#if INTEL_INTRINSICS
-    char str [ 65 ];
-    nucreg_t nr = _mm_loadu_si128 ( ( const __m128i* ) pattern . b );
-    nucreg_t nm = _mm_loadu_si128 ( ( const __m128i* ) mask . b );
-#else
-    char str [ 33 ];
-    nucreg_t nr = pattern;
-    nucreg_t nm = mask;
-#endif
-
-    printf ( "  %s - pattern [ %u ]\n", sprintf_2na ( str, sizeof str, nr ), idx );
-    printf ( "  %s - mask [ %u ]\n", sprintf_m2na ( str, sizeof str, nm ), idx );
-}
-
-static
-void PARSE_4NA_SHIFT ( unsigned int idx, nucpat_t pattern, nucpat_t mask )
-{
-#if INTEL_INTRINSICS
-    char str [ 33 ];
-    nucreg_t nr = _mm_loadu_si128 ( ( const __m128i* ) pattern . b );
-    nucreg_t nm = _mm_loadu_si128 ( ( const __m128i* ) mask . b );
-#else
-    char str [ 17 ];
-    nucreg_t nr = pattern;
-    nucreg_t nm = mask;
-#endif
-
-    printf ( "  %s - pattern [ %u ]\n", sprintf_4na ( str, sizeof str, nr ), idx );
-    printf ( "  %s - mask [ %u ]\n", sprintf_m4na ( str, sizeof str, nm ), idx );
-}
-#else
-
-#define PARSE_2NA_PATTERN( fasta, size, pattern, mask ) \
-    ( void ) 0
-
-#define PARSE_4NA_PATTERN( fasta, size, pattern, mask ) \
-    ( void ) 0
-
-#define PARSE_2NA_SHIFT( idx, pattern, mask ) \
-    ( void ) 0
-
-#define PARSE_4NA_SHIFT( idx, pattern, mask ) \
-    ( void ) 0
-
-#endif
-
-#if TRACE_OPERATIONS && TRACE_HEADER
-
-static
-void ALIGN_2NA_HEADER ( nucreg_t buffer, unsigned int pos, unsigned int len )
-{
-    unsigned int i, j;
-#if INTEL_INTRINSICS
-    char str [ 65 ];
-    unsigned int end = pos + 63;
-    str [ 64 ] = 0;
-#else
-    char str [ 33 ];
-    unsigned int end = pos + 31;
-    str [ 32 ] = 0;
-#endif
-
-    /* line separator */
-    putchar ( '\n' );
-
-    /* print a position with vertical numerals */
-    if ( end >= 1000 )
-    {
-        for ( i = pos, j = 0; i <= end; ++ j, ++ i )
-            str [ j ] = '0' + ( char) ( i / 1000 );
-        printf ( "  %s\n", str );
-    }
-    if ( end >= 100 )
-    {
-        for ( i = pos, j = 0; i <= end; ++ j, ++ i )
-            str [ j ] = '0' + ( char) ( ( i / 100 ) % 10 );
-        printf ( "  %s\n", str );
-    }
-    if ( end >= 10 )
-    {
-        for ( i = pos, j = 0; i <= end; ++ j, ++ i )
-            str [ j ] = '0' + ( char) ( ( i / 10 ) % 10 );
-        printf ( "  %s\n", str );
-    }
-
-    for ( i = pos, j = 0; i <= end; ++ j, ++ i )
-        str [ j ] = '0' + ( char) ( i % 10 );
-    printf ( "  %s\n", str );
-
-    /* now dump the buffer */
-    printf ( "  %s - buffer\n", sprintf_2na ( str, sizeof str, buffer ) );
-}
-
-static
-void ALIGN_4NA_HEADER ( nucreg_t buffer, unsigned int pos, unsigned int len )
-{
-    unsigned int i, j;
-#if INTEL_INTRINSICS
-    char str [ 33 ];
-    unsigned int end = pos + 31;
-    str [ 32 ] = 0;
-#else
-    char str [ 17 ];
-    unsigned int end = pos + 15;
-    str [ 16 ] = 0;
-#endif
-
-    /* line separator */
-    putchar ( '\n' );
-
-    /* print a position with vertical numerals */
-    if ( end >= 1000 )
-    {
-        for ( i = pos, j = 0; i <= end; ++ j, ++ i )
-            str [ j ] = '0' + ( char) ( i / 1000 );
-        printf ( "  %s\n", str );
-    }
-    if ( end >= 100 )
-    {
-        for ( i = pos, j = 0; i <= end; ++ j, ++ i )
-            str [ j ] = '0' + ( char) ( ( i / 100 ) % 10 );
-        printf ( "  %s\n", str );
-    }
-    if ( end >= 10 )
-    {
-        for ( i = pos, j = 0; i <= end; ++ j, ++ i )
-            str [ j ] = '0' + ( char) ( ( i / 10 ) % 10 );
-        printf ( "  %s\n", str );
-    }
-
-    for ( i = pos, j = 0; i <= end; ++ j, ++ i )
-        str [ j ] = '0' + ( char) ( i % 10 );
-    printf ( "  %s\n", str );
-
-    /* now dump the buffer */
-    printf ( "  %s - buffer\n", sprintf_4na ( str, sizeof str, buffer ) );
-}
-
-#else
-
-#define ALIGN_2NA_HEADER( buffer, pos, len ) \
-    ( void ) 0
-
-#define ALIGN_4NA_HEADER( buffer, pos, len ) \
-    ( void ) 0
-
-#endif
-
-#if TRACE_OPERATIONS && TRACE_RESULT
-
-#if INTEL_INTRINSICS
-static
-void ALIGN_2NA_RESULT ( nucreg_t buffer, nucreg_t pat, nucreg_t mask,
-    nucreg_t cmp, int bits )
-{
-    unsigned int i;
-    char str [ 65 ];
-
-    char bstr [ 17 ];
-    for ( i = 0; i < 16; bits >>= 1, ++ i )
-        bstr [ i ] = '0' + ( bits & 1 );
-    bstr [ 16 ] = 0;
-
-#if TRACE_PATMASK
-    printf ( "  %s - pattern\n", sprintf_2na ( str, sizeof str, pat ) );
-    printf ( "  %s - mask\n", sprintf_m2na ( str, sizeof str, mask ) );
-#endif
-
-    /* dump alignment and re-compare */
-    printf ( "  %s - alignment\n", sprintf_a2na ( str, sizeof str, buffer, pat, mask ) );
-    printf ( "  %s ( 0b%s )\n", sprintf_r2na ( str, sizeof str, cmp, mask ), bstr );
-}
-
-static
-void ALIGN_4NA_RESULT ( nucreg_t buffer, nucreg_t pat, nucreg_t mask,
-    nucreg_t cmp, int bits )
-{
-    unsigned int i;
-    char str [ 33 ];
-
-    char bstr [ 17 ];
-    for ( i = 0; i < 16; bits >>= 1, ++ i )
-        bstr [ i ] = '0' + ( bits & 1 );
-    bstr [ 16 ] = 0;
-
-#if TRACE_PATMASK
-    printf ( "  %s - pattern\n", sprintf_4na ( str, sizeof str, pat ) );
-    printf ( "  %s - mask\n", sprintf_m4na ( str, sizeof str, mask ) );
-#endif
-
-    /* dump alignment and re-compare */
-    printf ( "  %s - alignment\n", sprintf_a4na ( str, sizeof str, buffer, pat, mask ) );
-    printf ( "  %s ( 0b%s )\n", sprintf_r4na ( str, sizeof str, cmp, mask ), bstr );
-}
-#else
-static
-void ALIGN_2NA_RESULT ( nucreg_t buffer, nucreg_t pat, nucreg_t mask, nucreg_t bits )
-{
-    char str [ 33 ];
-
-#if TRACE_PATMASK
-    printf ( "  %s - pattern\n", sprintf_2na ( str, sizeof str, pat ) );
-    printf ( "  %s - mask\n", sprintf_m2na ( str, sizeof str, mask ) );
-#endif
-
-    printf ( "  %s\n", sprintf_a2na ( str, sizeof str, buffer, pat, mask ) );
-    printf ( "  %s\n", sprintf_r2na ( str, sizeof str, bits, mask ) );
-}
-
-static
-void ALIGN_4NA_RESULT ( nucreg_t buffer, nucreg_t pat, nucreg_t mask, nucreg_t bits )
-{
-    char str [ 17 ];
-
-#if TRACE_PATMASK
-    printf ( "  %s - pattern\n", sprintf_4na ( str, sizeof str, pat ) );
-    printf ( "  %s - mask\n", sprintf_m4na ( str, sizeof str, mask ) );
-#endif
-
-    printf ( "  %s\n", sprintf_a4na ( str, sizeof str, buffer, pat, mask ) );
-    printf ( "  %s\n", sprintf_r4na ( str, sizeof str, bits, mask ) );
-}
-#endif
-
-#else
-
-#if INTEL_INTRINSICS
-#define ALIGN_2NA_RESULT( buffer, pat, mask, cmp, bits ) \
-    ( void ) 0
-#define ALIGN_4NA_RESULT( buffer, pat, mask, cmp, bits ) \
-    ( void ) 0
-#else
-#define ALIGN_2NA_RESULT( buffer, pat, mask, bits ) \
-    ( void ) 0
-#define ALIGN_4NA_RESULT( buffer, pat, mask, bits ) \
-    ( void ) 0
-#endif
-
-#endif
-
-
-/*--------------------------------------------------------------------------
- * NucStrExpr
- *  an expression
- */
-typedef NucStrstr NucStrExpr;
-
-enum
-{
-    type_2na_64,
-    type_4na_64,
-#if INTEL_INTRINSICS
-    type_2na_8,
-    type_2na_16,
-    type_2na_32,
-    type_2na_128,
-    type_4na_16,
-    type_4na_32,
-    type_4na_128,
-#endif
-    type_2na_pos,
-    type_4na_pos,
-    type_OP,
-    type_EXPR,
-
-    op_NOT,
-    op_HEAD,
-    op_TAIL,
-    op_AND,
-    op_OR
-};
-
-typedef struct NucStrFastaExpr NucStrFastaExpr;
-struct NucStrFastaExpr
-{
-    int32_t type;
-    uint32_t size;
-#if INTEL_INTRINSICS && ! USE_MEMALIGN
-    union
-    {
-        /* actual allocation for freeing
-           since struct pointer will be
-           16 byte aligned by code */
-        void *outer;
-        uint64_t align;
-    } u;
-#endif
-    struct
-    {
-        nucpat_t pattern;
-        nucpat_t mask;
-    } query [ 4 ];
-};
-
-#if USE_MEMALIGN
-#define NucStrFastaExprAlloc( sz ) \
-    memalign ( 16, sz )
-#elif INTEL_INTRINSICS
-static
-void *NucStrFastaExprAlloc ( size_t sz )
-{
-    void *outer = malloc ( sz + 16 );
-    if ( outer != NULL )
-    {
-        NucStrFastaExpr *e = ( void* )
-            ( ( ( size_t ) outer + 15 ) & ~ ( size_t ) 15 );
-        e -> u . outer = outer;
-        assert ( ( ( size_t ) & e -> query [ 0 ] . pattern & 15 ) == 0 );
-        assert ( ( ( size_t ) & e -> query [ 0 ] . mask & 15 ) == 0 );
-        return e;
-    }
-    return NULL;
-}
-#else
-#define NucStrFastaExprAlloc( sz ) \
-    malloc ( sz )
-#endif
-
-typedef struct NucStrOpExpr NucStrOpExpr;
-struct NucStrOpExpr
-{
-    int32_t type;
-    int32_t op;
-    NucStrExpr *left;
-    NucStrExpr *right;
-};
-
-typedef struct NucStrSubExpr NucStrSubExpr;
-struct NucStrSubExpr
-{
-    int32_t type;
-    int32_t op;
-    NucStrExpr *expr;
-};
-
-union  NucStrstr
-{
-    NucStrFastaExpr fasta;
-    NucStrOpExpr boolean;
-    NucStrSubExpr sub;
-};
-
-/* NucStrFastaExprMake
- *  initializes for comparison based upon type
- */
-static
-int NucStrFastaExprMake2 ( NucStrExpr **expr, int positional,
-    const char *fasta, size_t size )
-{
-    size_t i;
-    NucStrExpr *e;
-    nucpat_t pattern, mask;
-
-    /* still limiting bases */
-    if ( size > NA2_LIMIT )
-        return E2BIG;
-
-    e = NucStrFastaExprAlloc ( sizeof * e );
-    if ( e == NULL )
-        return errno;
-
-    * expr = e;
-    e -> fasta . size = ( uint32_t ) size;
-
-#if INTEL_INTRINSICS
-    /* translate FASTA to 2na */
-    for ( i = 0; i < size; ++ i )
-    {
-        uint8_t base = fasta_2na_map [ ( int ) fasta [ i ] ];
-        switch ( i & 3 )
-        {
-        case 0:
-            pattern . b [ i >> 2 ] = base << 6;
-            mask . b [ i >> 2 ] = 3 << 6;
-            break;
-        case 1:
-            pattern . b [ i >> 2 ] |= base << 4;
-            mask . b [ i >> 2 ] |= 3 << 4;
-            break;
-        case 2:
-            pattern . b [ i >> 2 ] |= base << 2;
-            mask . b [ i >> 2 ] |= 3 << 2;
-            break;
-        case 3:
-            pattern . b [ i >> 2 ] |= base;
-            mask . b [ i >> 2 ] |= 3;
-            break;
-        }
-    }
-
-    /* fill trailing with zeros */
-    for ( i = ( i + 3 ) >> 2; i < 16; ++ i )
-    {
-        pattern . b [ i ] = 0;
-        mask . b [ i ] = 0;
-    }
-
-    PARSE_2NA_PATTERN ( fasta, size, pattern, mask );
-
-    /* treat positional types specially */
-    if ( positional )
-    {
-        e -> fasta . type = type_2na_pos;
-    }
-
-    /* replicate for shorter queries */
-    else if ( size < 2 )
-    {
-        pattern . b [ 1 ] = pattern . b [ 0 ];
-        pattern . w [ 1 ] = pattern . w [ 0 ];
-        pattern . i [ 1 ] = pattern . i [ 0 ];
-        pattern . l [ 1 ] = pattern . l [ 0 ];
-            
-        mask . b [ 1 ] = mask . b [ 0 ];
-        mask . w [ 1 ] = mask . w [ 0 ];
-        mask . i [ 1 ] = mask . i [ 0 ];
-        mask . l [ 1 ] = mask . l [ 0 ];
-            
-        e -> fasta . type = type_2na_8;
-    }
-    else if ( size < 6 )
-    {
-        pattern . w [ 1 ] = pattern . w [ 0 ];
-        pattern . i [ 1 ] = pattern . i [ 0 ];
-        pattern . l [ 1 ] = pattern . l [ 0 ];
-            
-        mask . w [ 1 ] = mask . w [ 0 ];
-        mask . i [ 1 ] = mask . i [ 0 ];
-        mask . l [ 1 ] = mask . l [ 0 ];
-            
-        e -> fasta . type = type_2na_16;
-    }
-    else if ( size < 14 )
-    {
-        pattern . i [ 1 ] = pattern . i [ 0 ];
-        pattern . l [ 1 ] = pattern . l [ 0 ];
-            
-        mask . i [ 1 ] = mask . i [ 0 ];
-        mask . l [ 1 ] = mask . l [ 0 ];
-            
-        e -> fasta . type = type_2na_32;
-    }
-    else if ( size < 30 )
-    {
-        pattern . l [ 1 ] = pattern . l [ 0 ];
-        mask . l [ 1 ] = mask . l [ 0 ];
-            
-        e -> fasta . type = type_2na_64;
-    }
-    else
-    {
-        e -> fasta . type = type_2na_128;
-    }
-
-    e -> fasta . query [ 0 ] . pattern = pattern;
-    e -> fasta . query [ 0 ] . mask = mask;
-
-    /* byte swap the pattern and mask */
-    uint128_bswap ( & pattern . s );
-    uint128_bswap ( & mask . s );
-
-    /* now shifts should work as imagined */
-    uint128_shr ( & pattern . s, 2 );
-    uint128_shr ( & mask . s, 2 );
-        
-    /* restore the byte order for sse */
-    uint128_bswap_copy ( & e -> fasta . query [ 1 ] . pattern . s, & pattern . s );
-    uint128_bswap_copy ( & e -> fasta . query [ 1 ] . mask . s, & mask . s );
-
-    uint128_shr ( & pattern . s, 2 );
-    uint128_shr ( & mask . s, 2 );
-        
-    uint128_bswap_copy ( & e -> fasta . query [ 2 ] . pattern . s, & pattern . s );
-    uint128_bswap_copy ( & e -> fasta . query [ 2 ] . mask . s, & mask . s );
-
-    uint128_shr ( & pattern . s, 2 );
-    uint128_shr ( & mask . s, 2 );
-        
-    uint128_bswap_copy ( & e -> fasta . query [ 3 ] . pattern . s, & pattern . s );
-    uint128_bswap_copy ( & e -> fasta . query [ 3 ] . mask . s, & mask . s );
-        
-#else
-    e -> fasta . type = positional ? type_2na_pos : type_2na_64;
-
-    for ( pattern . l = 0, i = 0; i < size; ++ i )
-    {
-        pattern . l <<= 2;
-
-        assert ( fasta [ i ] >= 0 );
-        assert ( fasta_2na_map [ ( int ) fasta [ i ] ] >= 0 );
-
-        pattern . l |= fasta_2na_map [ ( int ) fasta [ i ] ];
-    }
-
-    mask . l = ~ 0;
-    pattern . l <<= 64 - size - size;
-    mask . l <<= 64 - size - size;
-
-    PARSE_2NA_PATTERN ( fasta, size, pattern, mask );
-
-    e -> fasta . query [ 0 ] . pattern = pattern;
-    e -> fasta . query [ 1 ] . pattern . l = pattern . l >> 2;
-    e -> fasta . query [ 2 ] . pattern . l = pattern . l >> 4;
-    e -> fasta . query [ 3 ] . pattern . l = pattern . l >> 6;
-
-    e -> fasta . query [ 0 ] . mask = mask;
-    e -> fasta . query [ 1 ] . mask . l = mask . l >> 2;
-    e -> fasta . query [ 2 ] . mask . l = mask . l >> 4;
-    e -> fasta . query [ 3 ] . mask . l = mask . l >> 6;
-
-#endif
-
-    PARSE_2NA_SHIFT ( 0, e -> fasta . query [ 0 ] . pattern,
-        e -> fasta . query [ 0 ] . mask );
-    PARSE_2NA_SHIFT ( 1, e -> fasta . query [ 1 ] . pattern,
-        e -> fasta . query [ 1 ] . mask );
-    PARSE_2NA_SHIFT ( 2, e -> fasta . query [ 2 ] . pattern,
-        e -> fasta . query [ 2 ] . mask );
-    PARSE_2NA_SHIFT ( 3, e -> fasta . query [ 3 ] . pattern,
-        e -> fasta . query [ 3 ] . mask );
-
-    return 0;
-}
-
-static
-int NucStrFastaExprMake4 ( NucStrExpr **expr, int positional,
-    const char *fasta, size_t size )
-{
-    size_t i;
-    NucStrExpr *e;
-    nucpat_t pattern, mask;
-
-    /* still limiting bases */
-    if ( size > NA4_LIMIT )
-        return E2BIG;
-
-    e = NucStrFastaExprAlloc ( sizeof * e );
-    if ( e == NULL )
-        return errno;
-
-    * expr = e;
-    e -> fasta . size = ( uint32_t ) size;
-
-#if INTEL_INTRINSICS
-    /* translate FASTA to 4na */
-    for ( i = 0; i < size; ++ i )
-    {
-        uint16_t base = fasta_4na_map [ ( int ) fasta [ i ] ];
-        switch ( i & 3 )
-        {
-        case 0:
-            pattern . w [ i >> 2 ] = base << 4;
-            mask . w [ i >> 2 ] = 15 << 4;
-            break;
-        case 1:
-            pattern . w [ i >> 2 ] |= base << 0;
-            mask . w [ i >> 2 ] |= 15 << 0;
-            break;
-        case 2:
-            pattern . w [ i >> 2 ] |= base << 12;
-            mask . w [ i >> 2 ] |= 15 << 12;
-            break;
-        case 3:
-            pattern . w [ i >> 2 ] |= base << 8;
-            mask . w [ i >> 2 ] |= 15 << 8;
-            break;
-        }
-    }
-
-    /* fill trailing with zeros */
-    for ( i = ( i + 3 ) >> 2; i < 8; ++ i )
-    {
-        pattern . w [ i ] = 0;
-        mask . w [ i ] = 0;
-    }
-
-    PARSE_4NA_PATTERN ( fasta, size, pattern, mask );
-
-    if ( positional )
-    {
-        e -> fasta . type = type_4na_pos;
-    }
-    else if ( size < 2 )
-    {
-        pattern . w [ 1 ] = pattern . w [ 0 ];
-        pattern . i [ 1 ] = pattern . i [ 0 ];
-        pattern . l [ 1 ] = pattern . l [ 0 ];
-            
-        mask . w [ 1 ] = mask . w [ 0 ];
-        mask . i [ 1 ] = mask . i [ 0 ];
-        mask . l [ 1 ] = mask . l [ 0 ];
-
-        e -> fasta . type = type_4na_16;
-    }
-    else if ( size < 6 )
-    {
-        pattern . i [ 1 ] = pattern . i [ 0 ];
-        pattern . l [ 1 ] = pattern . l [ 0 ];
-            
-        mask . i [ 1 ] = mask . i [ 0 ];
-        mask . l [ 1 ] = mask . l [ 0 ];
-
-        e -> fasta . type = type_4na_32;
-    }
-    else if ( size < 14 )
-    {
-        pattern . l [ 1 ] = pattern . l [ 0 ];
-        mask . l [ 1 ] = mask . l [ 0 ];
-
-        e -> fasta . type = type_4na_64;
-    }
-    else
-    {
-        e -> fasta . type = type_4na_128;
-    }
-
-    e -> fasta . query [ 0 ] . pattern = pattern;
-    e -> fasta . query [ 0 ] . mask = mask;
-
-    /* byte swap the pattern and mask */
-    uint128_bswap ( & pattern . s );
-    uint128_bswap ( & mask . s );
-
-    /* now shifts should work as imagined */
-    uint128_shr ( & pattern . s, 4 );
-    uint128_shr ( & mask . s, 4 );
-        
-    /* restore the byte order for sse */
-    uint128_bswap_copy ( & e -> fasta . query [ 1 ] . pattern . s, & pattern . s );
-    uint128_bswap_copy ( & e -> fasta . query [ 1 ] . mask . s, & mask . s );
-
-    uint128_shr ( & pattern . s, 4 );
-    uint128_shr ( & mask . s, 4 );
-        
-    uint128_bswap_copy ( & e -> fasta . query [ 2 ] . pattern . s, & pattern . s );
-    uint128_bswap_copy ( & e -> fasta . query [ 2 ] . mask . s, & mask . s );
-
-    uint128_shr ( & pattern . s, 4 );
-    uint128_shr ( & mask . s, 4 );
-        
-    uint128_bswap_copy ( & e -> fasta . query [ 3 ] . pattern . s, & pattern . s );
-    uint128_bswap_copy ( & e -> fasta . query [ 3 ] . mask . s, & mask . s );
-
-#else
-    e -> fasta . type = positional ? type_4na_pos : type_4na_64;
-
-    for ( pattern . l = 0, i = 0; i < size; ++ i )
-    {
-        pattern . l <<= 4;
-
-        assert ( fasta [ i ] >= 0 );
-        assert ( fasta_4na_map [ ( int ) fasta [ i ] ] >= 0 );
-
-        pattern . l |= fasta_4na_map [ ( int ) fasta [ i ] ];
-    }
-
-    mask . l = ~ 0;
-    pattern . l <<= 64 - ( size << 2 );
-    mask . l <<= 64 - ( size << 2 );
-
-    PARSE_4NA_PATTERN ( fasta, size, pattern, mask );
-
-    e -> fasta . query [ 0 ] . pattern = pattern;
-    e -> fasta . query [ 1 ] . pattern . l = pattern . l >> 4;
-    e -> fasta . query [ 2 ] . pattern . l = pattern . l >> 8;
-    e -> fasta . query [ 3 ] . pattern . l = pattern . l >> 12;
-
-    e -> fasta . query [ 0 ] . mask = mask;
-    e -> fasta . query [ 1 ] . mask . l = mask . l >> 4;
-    e -> fasta . query [ 2 ] . mask . l = mask . l >> 8;
-    e -> fasta . query [ 3 ] . mask . l = mask . l >> 12;
-
-#endif
-
-    PARSE_4NA_SHIFT ( 0, e -> fasta . query [ 0 ] . pattern,
-        e -> fasta . query [ 0 ] . mask );
-    PARSE_4NA_SHIFT ( 1, e -> fasta . query [ 1 ] . pattern,
-        e -> fasta . query [ 1 ] . mask );
-    PARSE_4NA_SHIFT ( 2, e -> fasta . query [ 2 ] . pattern,
-        e -> fasta . query [ 2 ] . mask );
-    PARSE_4NA_SHIFT ( 3, e -> fasta . query [ 3 ] . pattern,
-        e -> fasta . query [ 3 ] . mask );
-
-    return 0;
-}
-
-
-/* nss_sob
- */
-static
-const char *nss_sob ( const char *p, const char *end )
-{
-    while ( p < end && isspace ( * ( const uint8_t* ) p ) )
-        ++ p;
-    return p;
-}
-
-/* nss_FASTA_expr
- */
-static
-const char *nss_FASTA_expr ( const char *p, const char *end,
-    NucStrExpr **expr, int *status, int positional )
-{
-    if ( p >= end )
-        * status = EINVAL;
-    else
-    {
-        const char *start = p;
-
-        int32_t type = type_2na_64;
-        const int8_t *map = fasta_2na_map;
-        do
-        {
-            if ( * p < 0 )
-                break;
-
-            if ( map [ * ( const uint8_t* ) p ] < 0 )
-            {
-                if ( map == fasta_4na_map )
-                    break;
-                if ( fasta_4na_map [ * ( const uint8_t* ) p ] < 0 )
-                    break;
-                type = type_4na_64;
-                map = fasta_4na_map;
-            }
-        }
-        while ( ++ p < end );
-
-        if ( p <= start )
-            * status = EINVAL;
-        else if ( type == type_2na_64 )
-            * status = NucStrFastaExprMake2 ( expr, positional, start, p - start );
-        else
-            * status = NucStrFastaExprMake4 ( expr, positional, start, p - start );
-    }
-
-    return p;
-}
-
-/* nss_fasta_expr
- */
-static
-const char *nss_fasta_expr ( const char *p, const char *end,
-    NucStrExpr **expr, int *status, int positional )
-{
-    assert ( p < end );
-    switch ( * p )
-    {
-    case '\'':
-        p = nss_FASTA_expr ( p + 1, end, expr, status, positional );
-        if ( * status == 0 && ( p == end || * p ++ != '\'' ) )
-            * status = EINVAL;
-        break;
-    case '"':
-        p = nss_FASTA_expr ( p + 1, end, expr, status, positional );
-        if ( * status == 0 && ( p == end || * p ++ != '"' ) )
-            * status = EINVAL;
-        break;
-    default:
-        return nss_FASTA_expr ( p, end, expr, status, positional );
-    }
-
-    return p;
-}
-
-/* nss_position_expr
- */
-#if ENABLE_AT_EXPR
-static
-const char *nss_position_expr ( const char *p, const char *end,
-    NucStrExpr **expr, int *status, int positional )
-{
-    assert ( p < end );
-    if ( * p == '@' )
-    {
-        p = nss_sob ( p + 1, end );
-        if ( p == end )
-        {
-            * status = EINVAL;
-            return p;
-        }
-        positional = 1;
-    }
-
-    return nss_fasta_expr ( p, end, expr, status, positional );
-}
-#else
-#define nss_position_expr( p, end, expr, status, positional ) \
-    nss_fasta_expr ( p, end, expr, status, positional )
-#endif
-
-/* forward */
-static
-const char *nss_expr ( const char *p, const char *end,
-    NucStrExpr **expr, int *status, int positional );
-
-/* nss_primary_expr
- */
-static
-const char *nss_primary_expr ( const char *p, const char *end,
-    NucStrExpr **expr, int *status, int positional )
-{
-    NucStrExpr *e;
-
-    assert ( p < end );
-    switch ( * p )
-    {
-    case '^':
-        e = malloc ( sizeof e -> sub );
-        if ( e == NULL )
-            * status = errno;
-        else
-        {
-            e -> sub . type = type_EXPR;
-            e -> sub . op = op_HEAD;
-            e -> sub . expr = NULL;
-            * expr = e;
-
-            p = nss_sob ( p + 1, end );
-            p = nss_position_expr ( p, end, & e -> sub . expr, status, positional );
-        }
-        return p;
-    case '(':
-        e = malloc ( sizeof e -> sub );
-        if ( e == NULL )
-            * status = errno;
-        else
-        {
-            e -> sub . type = type_EXPR;
-            e -> sub . op = 0;
-            * expr = e;
-
-            p = nss_expr ( p + 1, end, & e -> sub . expr, status, positional );
-            if ( * status == 0 )
-            {
-                if ( e -> sub . expr == NULL || p == end || * p ++ != ')' )
-                    * status = EINVAL;
-            }
-        }
-        return p;
-    }
-
-    p = nss_position_expr ( p, end, expr, status, positional );
-    if ( * status == 0 && p < end )
-    {
-        p = nss_sob ( p, end );
-        if ( p < end && * p == '$' )
-        {
-            ++ p;
-
-            e = malloc ( sizeof e -> sub );
-            if ( e == NULL )
-                * status = errno;
-            else
-            {
-                e -> sub . type = type_EXPR;
-                e -> sub . op = op_TAIL;
-                e -> sub . expr = * expr;
-                * expr = e;
-            }
-        }
-    }
-
-    return p;
-}
-
-/* nss_unary_expr
- */
-static
-const char *nss_unary_expr ( const char *p, const char *end,
-    NucStrExpr **expr, int *status, int positional )
-{
-    assert ( p < end );
-    if ( * p != '!' )
-        return nss_primary_expr ( p, end, expr, status, positional );
-
-#if ! ALLOW_POSITIONAL_OPERATOR_MIX
-    if ( positional )
-    {
-        * status = EINVAL;
-        return p;
-    }
-#endif
-
-    p = nss_sob ( p + 1, end );
-    if ( p == end )
-        * status = EINVAL;
-    else
-    {
-        NucStrExpr *e = malloc ( sizeof e -> sub );
-        if ( e == NULL )
-            * status = errno;
-        else
-        {
-            e -> sub . type = type_EXPR;
-            e -> sub . op = op_NOT;
-            e -> sub . expr = NULL;
-            * expr = e;
-            
-            p = nss_unary_expr ( p, end, & e -> sub . expr, status, positional );
-            assert ( * status != 0 || e -> sub . expr != NULL );
-        }
-    }
-    return p;
-}
-
-/* nss_expr
- *
- *   expr        : <unary_expr>
- *               | <unary_expr> <boolean_op> <expr>
- *
- *   boolean_op  : '&', '|', '&&', '||'
- */
-static
-const char *nss_expr ( const char *p, const char *end,
-    NucStrExpr **expr, int *status, int positional )
-{
-    * expr = NULL;
-
-    p = nss_sob ( p, end );
-    if ( p != end )
-    {
-        p = nss_unary_expr ( p, end, expr, status, positional );
-        if ( * status == 0 )
-        {
-            p = nss_sob ( p, end );
-            if ( p != end )
-            {
-                int32_t op;
-                NucStrExpr *e;
-                assert ( * expr != NULL );
-
-                switch ( * p ++ )
-                {
-                case ')':
-                    return p - 1;
-                case '&':
-                    if ( p < end && * p == '&' )
-                        ++ p;
-                    op = op_AND;
-                    break;
-                case '|':
-                    if ( p < end && * p == '|' )
-                        ++ p;
-                    op = op_OR;
-                    break;
-                default:
-                    /* unrecognized or missing operator */
-                    * status = EINVAL;
-                    return p - 1;
-                }
-
-#if ! ALLOW_POSITIONAL_OPERATOR_MIX
-                /* boolean operators do not work in positional mode */
-                if ( positional )
-                {
-                    * status = EINVAL;
-                    return p - 1;
-                }
-#endif
-
-                e = malloc ( sizeof e -> boolean );
-                if ( e == NULL )
-                {
-                    * status = errno;
-                    return p;
-                }
-
-                e -> boolean . type = type_OP;
-                e -> boolean . op = op;
-                e -> boolean . left = * expr;
-                * expr = e;
-
-                /* evaluate right-hand */
-                p = nss_expr ( p, end, & e -> boolean . right, status, positional );
-                assert ( * status != 0 || e -> boolean . right != NULL );
-            }
-        }
-    }
-
-    return p;
-}
-
-
-
-/*--------------------------------------------------------------------------
- * NucStrstr
- *  prepared handle for nucleotide k-mer strstr expression
- */
-
-/* NucStrstrInit
- */
-static
-void NucStrstrInit ( void )
-{
-    int ch;
-    unsigned int i;
-    const char *p, *ncbi2na = "ACGT";
-    const char *ncbi4na = "-ACMGRSVTWYHKDBN";
-
-    /* illegal under most conditions */
-    memset ( fasta_2na_map, -1, sizeof fasta_2na_map );
-    memset ( fasta_4na_map, -1, sizeof fasta_4na_map );
-        
-    /* legal ncbi2na alphabet */
-    for ( i = 0, p = ncbi2na; p [ 0 ] != 0; ++ i, ++ p )
-    {
-        ch = p [ 0 ];
-        fasta_2na_map [ ch ] = fasta_2na_map [ tolower ( ch ) ] = ( int8_t ) i;
-    }
-        
-    /* legal ncbi4na alphabet */
-    for ( i = 0, p = ncbi4na; p [ 0 ] != 0; ++ i, ++ p )
-    {
-        ch = p [ 0 ];
-        fasta_4na_map [ ch ] = fasta_4na_map [ tolower ( ch ) ] = ( int8_t ) i;
-    }
-
-#if INTEL_INTRINSICS
-    /* byte swap the 2na expand map */
-    for ( i = 0; i < 256; ++ i )
-        expand_2na [ i ] = bswap_16 ( expand_2na [ i ] );
-#endif
-}
-
-/* NucStrstrMake
- *  prepares search by parsing expression query string
- *  returns error if conversion was not possible.
- *
- *  "nss" [ OUT ] - return parameter for one-time search handle
- *
- *  "positional" [ IN ] - if non-zero, build an expression tree
- *  to return found position rather than simply a Boolean found.
- *  see NucStrstrSearch.
- *
- *  "query" [ IN ] and "len" [ IN ] - query string expression, such that:
- *       expr           : <primary_expr>
- *                      | <primary_expr> <boolean_op> <expr>
- *       primary_expr   : FASTA
- *                      | "'" FASTA "'"
- *                      | '"' FASTA '"'
- *                      | '(' <expr> ')'
- *       boolean_op     : '&', '|', '&&', '||'
- *
- *  return values:
- *    EINVAL - invalid parameter or invalid expression
- */
-LIB_EXPORT int CC NucStrstrMake ( NucStrstr **nss, int positional,
-    const char *query, unsigned int len )
-{
-    if ( nss != NULL )
-    {
-        if ( query != NULL && len != 0 )
-        {
-            int status = 0;
-            const char *end;
-
-            if ( fasta_2na_map [ 0 ] == 0 )
-                NucStrstrInit ();
-
-            end = query + len;
-            query = nss_expr ( query, end, nss, & status, positional );
-            if ( status == 0 )
-            {
-                if ( query == end )
-                    return 0;
-
-                status = EINVAL;
-            }
-
-            NucStrstrWhack ( * nss );
-            * nss = NULL;
-            return status;
-        }
-
-        * nss = NULL;
-    }
-    return EINVAL;
-}
-
-/* NucStrstrWhack
- *  discard structure when no longer needed
- */
-LIB_EXPORT void CC NucStrstrWhack ( NucStrstr *self )
-{
-    if ( self != NULL )
-    {
-        switch ( self -> fasta . type )
-        {
-        case type_2na_64:
-        case type_4na_64:
-#if INTEL_INTRINSICS
-        case type_2na_8:
-        case type_2na_16:
-        case type_2na_32:
-        case type_2na_128:
-        case type_4na_16:
-        case type_4na_32:
-        case type_4na_128:
-#endif
-        case type_2na_pos:
-        case type_4na_pos:
-#if INTEL_INTRINSICS && ! USE_MEMALIGN
-            self = self -> fasta . u . outer;
-#endif
-            break;
-        case type_OP:
-            NucStrstrWhack ( self -> boolean . left );
-            NucStrstrWhack ( self -> boolean . right );
-            break;
-        case type_EXPR:
-            NucStrstrWhack ( self -> sub . expr );
-        }
-
-        free ( self );
-    }
-}
-
-
-                        
-/*--------------------------------------------------------------------------
- * expression evaluation
- */
-#if ! INTEL_INTRINSICS
-static
-int eval_2na_64 ( const NucStrFastaExpr *self,
-    const void *ncbi2na, unsigned int pos, unsigned int len )
-{
-    int count;
-    uint64_t ra, rb, rc, rd;
-
-#if ENDLESS_BUFFER
-    uint64_t buffer;
-#else
-    nucpat_t bp;
-#define buffer bp.l
-    const uint8_t *end;
-#endif
-    const uint8_t *src = ( const uint8_t* ) ncbi2na + ( pos >> 2 );
-
-#if TRACE_OPERATIONS
-    unsigned int tpos = pos & ~ 3;
-    unsigned int align_len = len + ( pos & 3 );
-#endif
-
-    if ( len < self -> size )
-        return 0;
-
-#if ENDLESS_BUFFER
-    /* prime source buffer */
-    buffer = bswap_64 ( * ( const uint64_t* ) src );
-#else
-    /* accumulate entry position into length */
-    end = src + ( ( len + ( pos & 3 ) + 3 ) >> 2 );
-
-    /* prime source buffer */
-    bp . l = 0; /* defined above as "buffer" */
-    switch ( end - src )
-    {
-    default:
-        bp . b [ 0 ] = src [ 7 ];
-    case 7:
-        bp . b [ 1 ] = src [ 6 ];
-    case 6:
-        bp . b [ 2 ] = src [ 5 ];
-    case 5:
-        bp . b [ 3 ] = src [ 4 ];
-    case 4:
-        bp . b [ 4 ] = src [ 3 ];
-    case 3:
-        bp . b [ 5 ] = src [ 2 ];
-    case 2:
-        bp . b [ 6 ] = src [ 1 ];
-    case 1:
-        bp . b [ 7 ] = src [ 0 ];
-    }
-#endif
-
-    /* prime compare results */
-    ra = rb = rc = ~ 0;
-
-    /* position src at buffer end for loop */
-    src += 8;
-
-    /* evaluate at initial position */
-    ALIGN_2NA_HEADER ( buffer, tpos, align_len );
-    switch ( pos & 3 )
-    {
-    case 0:
-        ra = ( buffer ^ self -> query [ 0 ] . pattern . l ) & self -> query [ 0 ] . mask . l;
-        ALIGN_2NA_RESULT ( buffer, self -> query [ 0 ] . pattern . l, self -> query [ 0 ] . mask . l, ra );
-    case 1:
-        rb = ( buffer ^ self -> query [ 1 ] . pattern . l ) & self -> query [ 1 ] . mask . l;
-        ALIGN_2NA_RESULT ( buffer, self -> query [ 1 ] . pattern . l, self -> query [ 1 ] . mask . l, rb );
-    case 2:
-        rc = ( buffer ^ self -> query [ 2 ] . pattern . l ) & self -> query [ 2 ] . mask . l;
-        ALIGN_2NA_RESULT ( buffer, self -> query [ 2 ] . pattern . l, self -> query [ 2 ] . mask . l, rc );
-    case 3:
-        rd = ( buffer ^ self -> query [ 3 ] . pattern . l ) & self -> query [ 3 ] . mask . l;
-        ALIGN_2NA_RESULT ( buffer, self -> query [ 3 ] . pattern . l, self -> query [ 3 ] . mask . l, rd );
-    }
-
-    /* loop on the number of shifts */
-    for ( count = ( int ) ( len - self -> size ); count >= 3; count -= 4 )
-    {
-        /* exit condition within sequence */
-        if ( ( ra & rb & rc & rd ) == 0 )
-            return 1;
-
-        /* get next 2na byte */
-        buffer <<= 8;
-#if ENDLESS_BUFFER
-        buffer |= * src ++;
-#else
-        if ( src < end )
-            bp . b [ 0 ] = * src ++;
-#endif
-
-#if TRACE_OPERATIONS
-        tpos = ( tpos + 4 ) & ~ 3;
-        ALIGN_2NA_HEADER ( buffer, tpos, align_len );
-#endif
-
-        /* test at this position */
-        ra = ( buffer ^ self -> query [ 0 ] . pattern . l ) & self -> query [ 0 ] . mask . l;
-        ALIGN_2NA_RESULT ( buffer, self -> query [ 0 ] . pattern . l, self -> query [ 0 ] . mask . l, ra );
-        rb = ( buffer ^ self -> query [ 1 ] . pattern . l ) & self -> query [ 1 ] . mask . l;
-        ALIGN_2NA_RESULT ( buffer, self -> query [ 1 ] . pattern . l, self -> query [ 1 ] . mask . l, rb );
-        rc = ( buffer ^ self -> query [ 2 ] . pattern . l ) & self -> query [ 2 ] . mask . l;
-        ALIGN_2NA_RESULT ( buffer, self -> query [ 2 ] . pattern . l, self -> query [ 2 ] . mask . l, rc );
-        rd = ( buffer ^ self -> query [ 3 ] . pattern . l ) & self -> query [ 3 ] . mask . l;
-        ALIGN_2NA_RESULT ( buffer, self -> query [ 3 ] . pattern . l, self -> query [ 3 ] . mask . l, rd );
-    }
-
-    switch ( ( pos + count ) & 3 )
-    {
-    case 2:
-        if ( ! rc ) return 1;
-    case 1:
-        if ( ! rb ) return 1;
-    case 0:
-        if ( ! ra ) return 1;
-    }
-
-    return 0;
-
-#undef buffer
-}
-
-static
-int eval_2na_pos ( const NucStrFastaExpr *self,
-    const void *ncbi2na, unsigned int pos, unsigned int len )
-{
-    int i, count;
-    uint64_t ra, rb, rc, rd;
-
-#if ENDLESS_BUFFER
-    uint64_t buffer;
-#else
-    nucpat_t bp;
-#define buffer bp.l
-    const uint8_t *end;
-#endif
-    const uint8_t *src = ( const uint8_t* ) ncbi2na + ( pos >> 2 );
-
-#if TRACE_OPERATIONS
-    unsigned int tpos = pos & ~ 3;
-    unsigned int align_len = len + ( pos & 3 );
-#endif
-
-    if ( len < self -> size )
-        return 0;
-
-#if ENDLESS_BUFFER
-    /* prime source buffer */
-    buffer = bswap_64 ( * ( const uint64_t* ) src );
-#else
-    /* accumulate entry position into length */
-    end = src + ( ( len + ( pos & 3 ) + 3 ) >> 2 );
-
-    /* prime source buffer */
-    bp . l = 0; /* defined above as "buffer" */
-    switch ( end - src )
-    {
-    default:
-        bp . b [ 0 ] = src [ 7 ];
-    case 7:
-        bp . b [ 1 ] = src [ 6 ];
-    case 6:
-        bp . b [ 2 ] = src [ 5 ];
-    case 5:
-        bp . b [ 3 ] = src [ 4 ];
-    case 4:
-        bp . b [ 4 ] = src [ 3 ];
-    case 3:
-        bp . b [ 5 ] = src [ 2 ];
-    case 2:
-        bp . b [ 6 ] = src [ 1 ];
-    case 1:
-        bp . b [ 7 ] = src [ 0 ];
-    }
-#endif
-
-    /* prime compare results */
-    ra = rb = rc = ~ 0;
-
-    /* position src at buffer end for loop */
-    src += 8;
-
-    /* evaluate at initial position */
-    ALIGN_2NA_HEADER ( buffer, tpos, align_len );
-    i = 0 - ( int ) ( pos & 3 );
-    switch ( pos & 3 )
-    {
-    case 0:
-        ra = ( buffer ^ self -> query [ 0 ] . pattern . l ) & self -> query [ 0 ] . mask . l;
-        ALIGN_2NA_RESULT ( buffer, self -> query [ 0 ] . pattern . l, self -> query [ 0 ] . mask . l, ra );
-    case 1:
-        rb = ( buffer ^ self -> query [ 1 ] . pattern . l ) & self -> query [ 1 ] . mask . l;
-        ALIGN_2NA_RESULT ( buffer, self -> query [ 1 ] . pattern . l, self -> query [ 1 ] . mask . l, rb );
-    case 2:
-        rc = ( buffer ^ self -> query [ 2 ] . pattern . l ) & self -> query [ 2 ] . mask . l;
-        ALIGN_2NA_RESULT ( buffer, self -> query [ 2 ] . pattern . l, self -> query [ 2 ] . mask . l, rc );
-    case 3:
-        rd = ( buffer ^ self -> query [ 3 ] . pattern . l ) & self -> query [ 3 ] . mask . l;
-        ALIGN_2NA_RESULT ( buffer, self -> query [ 3 ] . pattern . l, self -> query [ 3 ] . mask . l, rd );
-    }
-
-    /* loop on the number of shifts */
-    for ( count = ( int ) ( len - self -> size ); count >= 3; i += 4, count -= 4 )
-    {
-        /* exit condition within sequence */
-        if ( ! ra )
-            return i + 1;
-        if ( ! rb )
-            return i + 2;
-        if ( ! rc )
-            return i + 3;
-        if ( ! rd )
-            return i + 4;
-
-        /* get next 2na byte */
-        buffer <<= 8;
-#if ENDLESS_BUFFER
-        buffer |= * src ++;
-#else
-        if ( src < end )
-            bp . b [ 0 ] = * src ++;
-#endif
-
-#if TRACE_OPERATIONS
-        tpos = ( tpos + 4 ) & ~ 3;
-        ALIGN_2NA_HEADER ( buffer, tpos, align_len );
-#endif
-
-        /* test at this position */
-        ra = ( buffer ^ self -> query [ 0 ] . pattern . l ) & self -> query [ 0 ] . mask . l;
-        ALIGN_2NA_RESULT ( buffer, self -> query [ 0 ] . pattern . l, self -> query [ 0 ] . mask . l, ra );
-        rb = ( buffer ^ self -> query [ 1 ] . pattern . l ) & self -> query [ 1 ] . mask . l;
-        ALIGN_2NA_RESULT ( buffer, self -> query [ 1 ] . pattern . l, self -> query [ 1 ] . mask . l, rb );
-        rc = ( buffer ^ self -> query [ 2 ] . pattern . l ) & self -> query [ 2 ] . mask . l;
-        ALIGN_2NA_RESULT ( buffer, self -> query [ 2 ] . pattern . l, self -> query [ 2 ] . mask . l, rc );
-        rd = ( buffer ^ self -> query [ 3 ] . pattern . l ) & self -> query [ 3 ] . mask . l;
-        ALIGN_2NA_RESULT ( buffer, self -> query [ 3 ] . pattern . l, self -> query [ 3 ] . mask . l, rd );
-    }
-
-    switch ( ( pos + count ) & 3 )
-    {
-    case 0:
-        if ( ! ra ) return i + 1;
-        break;
-    case 1:
-        if ( ! ra ) return i + 1;
-        if ( ! rb ) return i + 2;
-        break;
-    case 2:
-        if ( ! ra ) return i + 1;
-        if ( ! rb ) return i + 2;
-        if ( ! rc ) return i + 3;
-    }
-
-    return 0;
-
-#undef buffer
-}
-
-static
-int eval_4na_64 ( const NucStrFastaExpr *self,
-    const void *ncbi2na, unsigned int pos, unsigned int len )
-{
-    int count;
-    uint64_t buffer;
-    uint64_t ra, rb, rc, rd;
-#if ! ENDLESS_BUFFER
-    const uint8_t *end;
-#endif
-    const uint8_t *src = ( const uint8_t* ) ncbi2na + ( pos >> 2 );
-
-#if TRACE_OPERATIONS
-    unsigned int tpos = pos & ~ 3;
-    unsigned int align_len = len + ( pos & 3 );
-#endif
-
-    if ( len < self -> size )
-        return 0;
-
-#if ENDLESS_BUFFER
-    buffer = expand_2na [ src [ 3 ] ];
-    buffer |= ( uint32_t ) expand_2na [ src [ 2 ] ] << 16;
-    buffer |= ( uint64_t ) expand_2na [ src [ 1 ] ] << 32;
-    buffer |= ( uint64_t ) expand_2na [ src [ 0 ] ] << 48;
-#else
-    /* accumulate entry position into length */
-    end = src + ( ( len + ( pos & 3 ) + 3 ) >> 2 );
-
-    /* prime source buffer */
-    buffer = 0;
-    switch ( end - src )
-    {
-    default:
-        buffer |= expand_2na [ src [ 3 ] ];
-    case 3:
-        buffer |= ( uint32_t ) expand_2na [ src [ 2 ] ] << 16;
-    case 2:
-        buffer |= ( uint64_t ) expand_2na [ src [ 1 ] ] << 32;
-    case 1:
-        buffer |= ( uint64_t ) expand_2na [ src [ 0 ] ] << 48;
-    }
-#endif
-
-    /* prime compare results */
-    ra = rb = rc = rd = ~ 0;
-
-    /* position src at buffer end for loop */
-    src += 4;
-
-    /* evaluate at initial position */
-    ALIGN_4NA_HEADER ( buffer, tpos, align_len );
-    switch ( pos & 3 )
-    {
-    case 0:
-        ra = ( buffer & self -> query [ 0 ] . pattern . l )
-            ^ ( buffer & self -> query [ 0 ] . mask . l );
-        ALIGN_4NA_RESULT ( buffer, self -> query [ 0 ] . pattern . l, self -> query [ 0 ] . mask . l, ra );
-    case 1:
-        rb = ( buffer & self -> query [ 1 ] . pattern . l )
-            ^ ( buffer & self -> query [ 1 ] . mask . l );
-        ALIGN_4NA_RESULT ( buffer, self -> query [ 1 ] . pattern . l, self -> query [ 1 ] . mask . l, rb );
-    case 2:
-        rc = ( buffer & self -> query [ 2 ] . pattern . l )
-            ^ ( buffer & self -> query [ 2 ] . mask . l ) ;
-        ALIGN_4NA_RESULT ( buffer, self -> query [ 2 ] . pattern . l, self -> query [ 2 ] . mask . l, rc );
-    case 3:
-        rd = ( buffer & self -> query [ 3 ] . pattern . l )
-            ^ ( buffer & self -> query [ 3 ] . mask . l );
-        ALIGN_4NA_RESULT ( buffer, self -> query [ 3 ] . pattern . l, self -> query [ 3 ] . mask . l, rd );
-    }
-
-    for ( count = ( int ) ( len - self -> size ); count >= 3; count -= 4 )
-    {
-        /* exit condition within sequence */
-        if ( ( ra & rb & rc & rd ) == 0 )
-            return 1;
-
-        /* shuffle in next byte in 4na */
-        buffer <<= 16;
-#if ! ENDLESS_BUFFER
-        if ( src < end )
-#endif
-            buffer |= expand_2na [ * src ++ ];
-
-#if TRACE_OPERATIONS
-        tpos = ( tpos + 4 ) & ~ 3;
-        ALIGN_4NA_HEADER ( buffer, tpos, align_len );
-#endif
-
-        /* test at this position */
-        ra = ( buffer & self -> query [ 0 ] . pattern . l )
-            ^ ( buffer & self -> query [ 0 ] . mask . l );
-        ALIGN_4NA_RESULT ( buffer, self -> query [ 0 ] . pattern . l, self -> query [ 0 ] . mask . l, ra );
-        rb = ( buffer & self -> query [ 1 ] . pattern . l )
-            ^ ( buffer & self -> query [ 1 ] . mask . l );
-        ALIGN_4NA_RESULT ( buffer, self -> query [ 1 ] . pattern . l, self -> query [ 1 ] . mask . l, rb );
-        rc = ( buffer & self -> query [ 2 ] . pattern . l )
-            ^ ( buffer & self -> query [ 2 ] . mask . l );
-        ALIGN_4NA_RESULT ( buffer, self -> query [ 2 ] . pattern . l, self -> query [ 2 ] . mask . l, rc );
-        rd = ( buffer & self -> query [ 3 ] . pattern . l )
-            ^ ( buffer & self -> query [ 3 ] . mask . l );
-        ALIGN_4NA_RESULT ( buffer, self -> query [ 3 ] . pattern . l, self -> query [ 3 ] . mask . l, rd );
-    }
-
-    switch ( ( pos + count ) & 3 )
-    {
-    case 2:
-        if ( ! rc ) return 1;
-    case 1:
-        if ( ! rb ) return 1;
-    case 0:
-        if ( ! ra ) return 1;
-    }
-
-    return 0;
-}
-
-static
-int eval_4na_pos ( const NucStrFastaExpr *self,
-    const void *ncbi2na, unsigned int pos, unsigned int len )
-{
-    int i, count;
-    uint64_t buffer;
-    uint64_t ra, rb, rc, rd;
-#if ! ENDLESS_BUFFER
-    const uint8_t *end;
-#endif
-    const uint8_t *src = ( const uint8_t* ) ncbi2na + ( pos >> 2 );
-
-#if TRACE_OPERATIONS
-    unsigned int tpos = pos & ~ 3;
-    unsigned int align_len = len + ( pos & 3 );
-#endif
-
-    if ( len < self -> size )
-        return 0;
-
-#if ENDLESS_BUFFER
-    buffer = expand_2na [ src [ 3 ] ];
-    buffer |= ( uint32_t ) expand_2na [ src [ 2 ] ] << 16;
-    buffer |= ( uint64_t ) expand_2na [ src [ 1 ] ] << 32;
-    buffer |= ( uint64_t ) expand_2na [ src [ 0 ] ] << 48;
-#else
-    /* accumulate entry position into length */
-    end = src + ( ( len + ( pos & 3 ) + 3 ) >> 2 );
-
-    /* prime source buffer */
-    buffer = 0;
-    switch ( end - src )
-    {
-    default:
-        buffer |= expand_2na [ src [ 3 ] ];
-    case 3:
-        buffer |= ( uint32_t ) expand_2na [ src [ 2 ] ] << 16;
-    case 2:
-        buffer |= ( uint64_t ) expand_2na [ src [ 1 ] ] << 32;
-    case 1:
-        buffer |= ( uint64_t ) expand_2na [ src [ 0 ] ] << 48;
-    }
-#endif
-
-    /* prime compare results */
-    ra = rb = rc = rd = ~ 0;
-
-    /* position src at buffer end for loop */
-    src += 4;
-
-    /* evaluate at initial position */
-    ALIGN_4NA_HEADER ( buffer, tpos, align_len );
-    i = 0 - ( int ) ( pos & 3 );
-    switch ( pos & 3 )
-    {
-    case 0:
-        ra = ( buffer & self -> query [ 0 ] . pattern . l )
-            ^ ( buffer & self -> query [ 0 ] . mask . l );
-        ALIGN_4NA_RESULT ( buffer, self -> query [ 0 ] . pattern . l, self -> query [ 0 ] . mask . l, ra );
-    case 1:
-        rb = ( buffer & self -> query [ 1 ] . pattern . l )
-            ^ ( buffer & self -> query [ 1 ] . mask . l );
-        ALIGN_4NA_RESULT ( buffer, self -> query [ 1 ] . pattern . l, self -> query [ 1 ] . mask . l, rb );
-    case 2:
-        rc = ( buffer & self -> query [ 2 ] . pattern . l )
-            ^ ( buffer & self -> query [ 2 ] . mask . l ) ;
-        ALIGN_4NA_RESULT ( buffer, self -> query [ 2 ] . pattern . l, self -> query [ 2 ] . mask . l, rc );
-    case 3:
-        rd = ( buffer & self -> query [ 3 ] . pattern . l )
-            ^ ( buffer & self -> query [ 3 ] . mask . l );
-        ALIGN_4NA_RESULT ( buffer, self -> query [ 3 ] . pattern . l, self -> query [ 3 ] . mask . l, rd );
-    }
-
-    for ( count = ( int ) ( len - self -> size ); count >= 3; i += 4, count -= 4 )
-    {
-        /* exit condition within sequence */
-        if ( ! ra )
-            return i + 1;
-        if ( ! rb )
-            return i + 2;
-        if ( ! rc )
-            return i + 3;
-        if ( ! rd )
-            return i + 4;
-
-        /* shuffle in next byte in 4na */
-        buffer <<= 16;
-#if ! ENDLESS_BUFFER
-        if ( src < end )
-#endif
-            buffer |= expand_2na [ * src ++ ];
-
-#if TRACE_OPERATIONS
-        tpos = ( tpos + 4 ) & ~ 3;
-        ALIGN_4NA_HEADER ( buffer, tpos, align_len );
-#endif
-
-        /* test at this position */
-        ra = ( buffer & self -> query [ 0 ] . pattern . l )
-            ^ ( buffer & self -> query [ 0 ] . mask . l );
-        ALIGN_4NA_RESULT ( buffer, self -> query [ 0 ] . pattern . l, self -> query [ 0 ] . mask . l, ra );
-        rb = ( buffer & self -> query [ 1 ] . pattern . l )
-            ^ ( buffer & self -> query [ 1 ] . mask . l );
-        ALIGN_4NA_RESULT ( buffer, self -> query [ 1 ] . pattern . l, self -> query [ 1 ] . mask . l, rb );
-        rc = ( buffer & self -> query [ 2 ] . pattern . l )
-            ^ ( buffer & self -> query [ 2 ] . mask . l );
-        ALIGN_4NA_RESULT ( buffer, self -> query [ 2 ] . pattern . l, self -> query [ 2 ] . mask . l, rc );
-        rd = ( buffer & self -> query [ 3 ] . pattern . l )
-            ^ ( buffer & self -> query [ 3 ] . mask . l );
-        ALIGN_4NA_RESULT ( buffer, self -> query [ 3 ] . pattern . l, self -> query [ 3 ] . mask . l, rd );
-    }
-
-    switch ( ( pos + count ) & 3 )
-    {
-    case 0:
-        if ( ! ra ) return i + 1;
-        break;
-    case 1:
-        if ( ! ra ) return i + 1;
-        if ( ! rb ) return i + 2;
-        break;
-    case 2:
-        if ( ! ra ) return i + 1;
-        if ( ! rb ) return i + 2;
-        if ( ! rc ) return i + 3;
-    }
-
-    return 0;
-}
-
-#else /* INTEL_INTRINSICS */
-
-#if ENDLESS_BUFFER
-static __inline__
-__m128i prime_buffer_2na ( const uint8_t *src, const uint8_t *ignore )
-{
-    __m128i buffer;
-    ( void ) ignore;
-    if ( ( ( size_t ) src & 15 ) == 0 )
-        buffer = _mm_load_si128 ( ( const __m128i* ) src );
-    else
-        buffer = _mm_loadu_si128 ( ( const __m128i* ) src );
-    return buffer;
-}
-#else
-static __inline__
-__m128i prime_buffer_2na ( const uint8_t *src, const uint8_t *end )
-{
-    size_t bytes;
-    __m128i buffer;
-
-    if ( ( bytes = end - src ) >= 16 )
-    {
-        if ( ( ( size_t ) src & 15 ) == 0 )
-            buffer = _mm_load_si128 ( ( const __m128i* ) src );
-        else
-            buffer = _mm_loadu_si128 ( ( const __m128i* ) src );
-    }
-    else
-    {
-        nucpat_t tmp;
-
-        /* common for Solexa */
-        if ( bytes == 7 )
-        {
-            tmp . b [ 0 ] = src [ 0 ];
-            tmp . b [ 1 ] = src [ 1 ];
-            tmp . b [ 2 ] = src [ 2 ];
-            tmp . b [ 3 ] = src [ 3 ];
-            tmp . b [ 4 ] = src [ 4 ];
-            tmp . b [ 5 ] = src [ 5 ];
-            tmp . b [ 6 ] = src [ 6 ];
-            tmp . b [ 7 ] = 0;
-            tmp . l [ 1 ] = 0;
-        }
-
-        /* currently only seen for 454 */
-        else
-        {
-            memcpy ( tmp . b, src, bytes );
-            memset ( & tmp . b [ bytes ], 0, sizeof tmp . b - bytes );
-        }
-
-        buffer = _mm_loadu_si128 ( ( const __m128i* ) tmp . b );
-    }
-    return buffer;
-}
-#endif
-
-#define prime_registers( self ) \
-    p0 = _mm_load_si128 ( ( const __m128i* ) self -> query [ 0 ] . pattern . b ); \
-    m0 = _mm_load_si128 ( ( const __m128i* ) self -> query [ 0 ] . mask . b ); \
-    p1 = _mm_load_si128 ( ( const __m128i* ) self -> query [ 1 ] . pattern . b ); \
-    m1 = _mm_load_si128 ( ( const __m128i* ) self -> query [ 1 ] . mask . b ); \
-    p2 = _mm_load_si128 ( ( const __m128i* ) self -> query [ 2 ] . pattern . b ); \
-    m2 = _mm_load_si128 ( ( const __m128i* ) self -> query [ 2 ] . mask . b ); \
-    p3 = _mm_load_si128 ( ( const __m128i* ) self -> query [ 3 ] . pattern . b ); \
-    m3 = _mm_load_si128 ( ( const __m128i* ) self -> query [ 3 ] . mask . b )
-
-static
-int eval_2na_8 ( const NucStrFastaExpr *self,
-    const void *ncbi2na, unsigned int pos, unsigned int len )
-{
-#define qbytes 1
-#define _mm_cmpeq_epi( a, b ) \
-    _mm_cmpeq_epi8 ( a, b )
-#if NEVER_MATCH
-#define res_adj( res ) \
-    res = 0
-#else
-#define res_adj( res ) \
-    ( ( void ) 0 )
-#endif
-
-    /* SSE registers */
-    nucreg_t buffer, ri;
-    nucreg_t p0, p1, p2, p3, m0, m1, m2, m3;
-
-    /* result registers */
-    int ra, rb, rc, rd;
-
-    /* used for shifting buffer, testing exit */
-    unsigned int num_passes, stop;
-
-    /* kludge for streaming in a byte at a time
-       only needed when qbytes > 1 */
-#if qbytes > 1
-    int slam;
-    const uint8_t *p;
-#endif
-
-    const uint8_t *end, *src;
-    unsigned int qlen = self -> size;
-
-    /* this test is performed outside */
-    assert ( len >= qlen );
-
-    /* the effective length of the sequence,
-       including leading bases we'll ignore */
-    len += pos;
-
-    /* convert source pointer */
-    src = ( const uint8_t* ) ncbi2na + ( pos >> 2 );
-
-    /* stop testing when position passes this point */
-    stop = len - qlen;
-
-    /* the sequence end pointer */
-    end = ( const uint8_t* ) ncbi2na + ( ( len + 3 ) >> 2 );
-
-    /* prime the buffer */
-    buffer = prime_buffer_2na ( src, end );
-    src += 16;
-#if qbytes > 1
-    p = src;
-
-    /* pre-load slam for single byte streaming */
-    if ( src < end )
-        slam = ( int ) src [ -1 ] << 8;
-#endif
-
-    /* prime the registers */
-    prime_registers ( self );
-
-    /* enter the loop at an appropriate offset */
-    ra = rb = rc = 0;
-#if qbytes == 16
-    num_passes = ( stop - pos + 7 ) >> 2;
-#else
-    num_passes = qbytes;
-#endif
-
-    /* for reporting - give a buffer alignment */
-    ALIGN_2NA_HEADER ( buffer, pos & ~ 3, len );
-    switch ( pos & 3 )
-    {
-    default:
-
-        /* outer loop - performs whole buffer loads */
-        while ( 1 )
-        {
-            num_passes = qbytes;
-
-            /* inner loop - shifts in one byte at a time */
-            while ( 1 )
-            {
-                /* for reporting - give a buffer alignment */
-                ALIGN_2NA_HEADER ( buffer, pos, len );
-
-                /* perform comparisons */
-    case 0:
-                ri = _mm_and_si128 ( buffer, m0 );
-                ri = _mm_cmpeq_epi ( ri, p0 );
-                ra = _mm_movemask_epi8 ( ri );
-                res_adj ( ra );
-                ALIGN_2NA_RESULT ( buffer, p0, m0, ri, ra );
-    case 1:
-                ri = _mm_and_si128 ( buffer, m1 );
-                ri = _mm_cmpeq_epi ( ri, p1 );
-                rb = _mm_movemask_epi8 ( ri );
-                res_adj ( rb );
-                ALIGN_2NA_RESULT ( buffer, p1, m1, ri, rb );
-    case 2:
-                ri = _mm_and_si128 ( buffer, m2 );
-                ri = _mm_cmpeq_epi ( ri, p2 );
-                rc = _mm_movemask_epi8 ( ri );
-                res_adj ( rc );
-                ALIGN_2NA_RESULT ( buffer, p2, m2, ri, rc );
-    case 3:
-                ri = _mm_and_si128 ( buffer, m3 );
-                ri = _mm_cmpeq_epi ( ri, p3 );
-                rd = _mm_movemask_epi8 ( ri );
-                res_adj ( rd );
-                ALIGN_2NA_RESULT ( buffer, p3, m3, ri, rd );
-
-                /* adjust pos */
-                pos &= ~ 3;
-
-                /* test for any promising results */
-                if ( ( ra | rb | rc | rd ) != 0 )
-                {
-#if qbytes == 16
-                    switch ( stop - pos )
-                    {
-                    default:
-                        return 1;
-                    case 2:
-                        if ( rc != 0 ) return 1;
-                    case 1:
-                        if ( rb != 0 ) return 1;
-                    case 0:
-                        if ( ra != 0 ) return 1;
-                    }
-                    return 0;
-#else
-                    /* extract first non-zero bit from results
-                       where result is all zeros, bit will be -1 */
-                    int fa = uint16_lsbit ( ( uint16_t ) ra );
-                    int fb = uint16_lsbit ( ( uint16_t ) rb );
-                    int fc = uint16_lsbit ( ( uint16_t ) rc );
-                    int fd = uint16_lsbit ( ( uint16_t ) rd );
-
-                    /* convert bit number into number of bases
-                       from current position. undefined where
-                       bit is negative, but unimportant also */
-                    fa = ( fa << 2 ) + 0;
-                    fb = ( fb << 2 ) + 1;
-                    fc = ( fc << 2 ) + 2;
-                    fd = ( fd << 2 ) + 3;
-
-                    /* test for any case where result was non-zero
-                       and the resultant base index is within range */
-                    if ( ra != 0 && pos + fa <= stop ) return 1;
-                    if ( rb != 0 && pos + fb <= stop ) return 1;
-                    if ( rc != 0 && pos + fc <= stop ) return 1;
-                    if ( rd != 0 && pos + fd <= stop ) return 1;
-#endif
-                }
-
-                /* advance pos */
-                pos += 4;
-
-                /* if no further comparisons are possible */
-                if ( pos > stop )
-                    return 0;
-
-                /* if all shifting passes are complete */
-                if ( -- num_passes == 0 )
-                    break;
-
-#if qbytes > 1
-                /* shift buffer */
-                buffer = _mm_srli_si128 ( buffer, 1 );
-
-                /* bring in new byte */
-                if ( p < end )
-                {
-                    slam >>= 8;
-                    slam |= ( int ) p [ 0 ] << 8;
-                    buffer = _mm_insert_epi16 ( buffer, slam, 7 );
-                }
-                
-                /* always increment source */
-                ++ p;
-#endif
-            }
-
-            /* want to reload buffer */
-            if ( src >= end )
-                break;
-
-            /* advance position */
-            pos += ( 16 - qbytes ) << 2;
-            if ( pos > stop )
-                break;
-
-            /* reload buffer */
-#if RELOAD_BUFFER || qbytes == 1
-            buffer = prime_buffer_2na ( src, end );
-#elif qbytes == 16
-            assert ( 0 );
-#else
-            if ( p - src < 3 )
-                buffer = prime_buffer_2na ( src, end );
-            else
-            {
-                if ( ( ( size_t ) ( p - src ) & 1 ) != 0 )
-                {
-                    buffer = _mm_srli_si128 ( buffer, 1 );
-                    if ( p < end )
-                    {
-                        slam >>= 8;
-                        slam |= ( int ) p [ 0 ] << 8;
-                        buffer = _mm_insert_epi16 ( buffer, slam, 7 );
-                    }
-                    ++ p;
-                }
-
-                if ( src + 16 <= end ) switch ( p - src )
-                {
-                case 4:
-                    buffer = _mm_srli_si128 ( buffer, 12 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 2 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 1 ], 3 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 2 ], 4 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 3 ], 5 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 4 ], 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 5 ], 7 );
-                    break;
-                case 6:
-                    buffer = _mm_srli_si128 ( buffer, 10 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 3 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 1 ], 4 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 2 ], 5 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 3 ], 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 4 ], 7 );
-                    break;
-                case 8:
-                    buffer = _mm_srli_si128 ( buffer, 8 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 4 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 1 ], 5 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 2 ], 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 3 ], 7 );
-                    break;
-                case 10:
-                    buffer = _mm_srli_si128 ( buffer, 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 5 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 1 ], 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 2 ], 7 );
-                    break;
-                case 12:
-                    buffer = _mm_srli_si128 ( buffer, 4 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 1 ], 7 );
-                    break;
-                case 14:
-                    buffer = _mm_srli_si128 ( buffer, 2 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 7 );
-                    break;
-                }
-
-                else for ( ; p - src < 16; p += 2 )
-                {
-                    buffer = _mm_srli_si128 ( buffer, 2 );
-                    if ( p < end )
-                    {
-                        slam = p [ 0 ];
-                        if ( p + 1 < end )
-                            slam |= ( int ) p [ 1 ] << 8;
-                        buffer = _mm_insert_epi16 ( buffer, slam, 7 );
-                    }
-                }
-            }
-#endif
-
-            /* adjust pointers */
-            src += 16;
-#if qbytes > 1
-            p = src;
-            if ( src < end )
-                slam = ( int ) src [ -1 ] << 8;
-#endif
-        }
-    }
-
-#undef qbytes
-#undef _mm_cmpeq_epi
-#undef res_adj
-
-    return 0;
-}
-
-static
-int eval_2na_16 ( const NucStrFastaExpr *self,
-    const void *ncbi2na, unsigned int pos, unsigned int len )
-{
-#define qbytes 2
-#define _mm_cmpeq_epi( a, b ) \
-    _mm_cmpeq_epi16 ( a, b )
-#if NEVER_MATCH
-#define res_adj( res ) \
-    res = 0
-#else
-#define res_adj( res ) \
-    ( ( void ) 0 )
-#endif
-
-    /* SSE registers */
-    nucreg_t buffer, ri;
-    nucreg_t p0, p1, p2, p3, m0, m1, m2, m3;
-
-    /* result registers */
-    int ra, rb, rc, rd;
-
-    /* used for shifting buffer, testing exit */
-    unsigned int num_passes, stop;
-
-    /* kludge for streaming in a byte at a time
-       only needed when qbytes > 1 */
-#if qbytes > 1
-    int slam;
-    const uint8_t *p;
-#endif
-
-    const uint8_t *end, *src;
-    unsigned int qlen = self -> size;
-
-    /* this test is performed outside */
-    assert ( len >= qlen );
-
-    /* the effective length of the sequence,
-       including leading bases we'll ignore */
-    len += pos;
-
-    /* convert source pointer */
-    src = ( const uint8_t* ) ncbi2na + ( pos >> 2 );
-
-    /* stop testing when position passes this point */
-    stop = len - qlen;
-
-    /* the sequence end pointer */
-    end = ( const uint8_t* ) ncbi2na + ( ( len + 3 ) >> 2 );
-
-    /* prime the buffer */
-    buffer = prime_buffer_2na ( src, end );
-    src += 16;
-#if qbytes > 1
-    p = src;
-
-    /* pre-load slam for single byte streaming */
-    if ( src < end )
-        slam = ( int ) src [ -1 ] << 8;
-#endif
-
-    /* prime the registers */
-    prime_registers ( self );
-
-    /* enter the loop at an appropriate offset */
-    ra = rb = rc = 0;
-#if qbytes == 16
-    num_passes = ( stop - pos + 7 ) >> 2;
-#else
-    num_passes = qbytes;
-#endif
-
-    /* for reporting - give a buffer alignment */
-    ALIGN_2NA_HEADER ( buffer, pos & ~ 3, len );
-    switch ( pos & 3 )
-    {
-    default:
-
-        /* outer loop - performs whole buffer loads */
-        while ( 1 )
-        {
-            num_passes = qbytes;
-
-            /* inner loop - shifts in one byte at a time */
-            while ( 1 )
-            {
-                /* for reporting - give a buffer alignment */
-                ALIGN_2NA_HEADER ( buffer, pos, len );
-
-                /* perform comparisons */
-    case 0:
-                ri = _mm_and_si128 ( buffer, m0 );
-                ri = _mm_cmpeq_epi ( ri, p0 );
-                ra = _mm_movemask_epi8 ( ri );
-                res_adj ( ra );
-                ALIGN_2NA_RESULT ( buffer, p0, m0, ri, ra );
-    case 1:
-                ri = _mm_and_si128 ( buffer, m1 );
-                ri = _mm_cmpeq_epi ( ri, p1 );
-                rb = _mm_movemask_epi8 ( ri );
-                res_adj ( rb );
-                ALIGN_2NA_RESULT ( buffer, p1, m1, ri, rb );
-    case 2:
-                ri = _mm_and_si128 ( buffer, m2 );
-                ri = _mm_cmpeq_epi ( ri, p2 );
-                rc = _mm_movemask_epi8 ( ri );
-                res_adj ( rc );
-                ALIGN_2NA_RESULT ( buffer, p2, m2, ri, rc );
-    case 3:
-                ri = _mm_and_si128 ( buffer, m3 );
-                ri = _mm_cmpeq_epi ( ri, p3 );
-                rd = _mm_movemask_epi8 ( ri );
-                res_adj ( rd );
-                ALIGN_2NA_RESULT ( buffer, p3, m3, ri, rd );
-
-                /* adjust pos */
-                pos &= ~ 3;
-
-                /* test for any promising results */
-                if ( ( ra | rb | rc | rd ) != 0 )
-                {
-#if qbytes == 16
-                    switch ( stop - pos )
-                    {
-                    default:
-                        return 1;
-                    case 2:
-                        if ( rc != 0 ) return 1;
-                    case 1:
-                        if ( rb != 0 ) return 1;
-                    case 0:
-                        if ( ra != 0 ) return 1;
-                    }
-                    return 0;
-#else
-                    /* extract first non-zero bit from results
-                       where result is all zeros, bit will be -1 */
-                    int fa = uint16_lsbit ( ( uint16_t ) ra );
-                    int fb = uint16_lsbit ( ( uint16_t ) rb );
-                    int fc = uint16_lsbit ( ( uint16_t ) rc );
-                    int fd = uint16_lsbit ( ( uint16_t ) rd );
-
-                    /* convert bit number into number of bases
-                       from current position. undefined where
-                       bit is negative, but unimportant also */
-                    fa = ( fa << 2 ) + 0;
-                    fb = ( fb << 2 ) + 1;
-                    fc = ( fc << 2 ) + 2;
-                    fd = ( fd << 2 ) + 3;
-
-                    /* test for any case where result was non-zero
-                       and the resultant base index is within range */
-                    if ( ra != 0 && pos + fa <= stop ) return 1;
-                    if ( rb != 0 && pos + fb <= stop ) return 1;
-                    if ( rc != 0 && pos + fc <= stop ) return 1;
-                    if ( rd != 0 && pos + fd <= stop ) return 1;
-#endif
-                }
-
-                /* advance pos */
-                pos += 4;
-
-                /* if no further comparisons are possible */
-                if ( pos > stop )
-                    return 0;
-
-                /* if all shifting passes are complete */
-                if ( -- num_passes == 0 )
-                    break;
-
-#if qbytes > 1
-                /* shift buffer */
-                buffer = _mm_srli_si128 ( buffer, 1 );
-
-                /* bring in new byte */
-                if ( p < end )
-                {
-                    slam >>= 8;
-                    slam |= ( int ) p [ 0 ] << 8;
-                    buffer = _mm_insert_epi16 ( buffer, slam, 7 );
-                }
-                
-                /* always increment source */
-                ++ p;
-#endif
-            }
-
-            /* want to reload buffer */
-            if ( src >= end )
-                break;
-
-            /* advance position */
-            pos += ( 16 - qbytes ) << 2;
-            if ( pos > stop )
-                break;
-
-            /* reload buffer */
-#if RELOAD_BUFFER || qbytes == 1
-            buffer = prime_buffer_2na ( src, end );
-#elif qbytes == 16
-            assert ( 0 );
-#else
-            if ( p - src < 3 )
-                buffer = prime_buffer_2na ( src, end );
-            else
-            {
-                if ( ( ( size_t ) ( p - src ) & 1 ) != 0 )
-                {
-                    buffer = _mm_srli_si128 ( buffer, 1 );
-                    if ( p < end )
-                    {
-                        slam >>= 8;
-                        slam |= ( int ) p [ 0 ] << 8;
-                        buffer = _mm_insert_epi16 ( buffer, slam, 7 );
-                    }
-                    ++ p;
-                }
-
-                if ( src + 16 <= end ) switch ( p - src )
-                {
-                case 4:
-                    buffer = _mm_srli_si128 ( buffer, 12 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 2 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 1 ], 3 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 2 ], 4 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 3 ], 5 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 4 ], 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 5 ], 7 );
-                    break;
-                case 6:
-                    buffer = _mm_srli_si128 ( buffer, 10 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 3 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 1 ], 4 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 2 ], 5 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 3 ], 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 4 ], 7 );
-                    break;
-                case 8:
-                    buffer = _mm_srli_si128 ( buffer, 8 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 4 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 1 ], 5 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 2 ], 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 3 ], 7 );
-                    break;
-                case 10:
-                    buffer = _mm_srli_si128 ( buffer, 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 5 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 1 ], 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 2 ], 7 );
-                    break;
-                case 12:
-                    buffer = _mm_srli_si128 ( buffer, 4 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 1 ], 7 );
-                    break;
-                case 14:
-                    buffer = _mm_srli_si128 ( buffer, 2 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 7 );
-                    break;
-                }
-
-                else for ( ; p - src < 16; p += 2 )
-                {
-                    buffer = _mm_srli_si128 ( buffer, 2 );
-                    if ( p < end )
-                    {
-                        slam = p [ 0 ];
-                        if ( p + 1 < end )
-                            slam |= ( int ) p [ 1 ] << 8;
-                        buffer = _mm_insert_epi16 ( buffer, slam, 7 );
-                    }
-                }
-            }
-#endif
-
-            /* adjust pointers */
-            src += 16;
-#if qbytes > 1
-            p = src;
-            if ( src < end )
-                slam = ( int ) src [ -1 ] << 8;
-#endif
-        }
-    }
-
-#undef qbytes
-#undef _mm_cmpeq_epi
-#undef res_adj
-
-    return 0;
-}
-
-static
-int eval_2na_32 ( const NucStrFastaExpr *self,
-    const void *ncbi2na, unsigned int pos, unsigned int len )
-{
-#define qbytes 4
-#define _mm_cmpeq_epi( a, b ) \
-    _mm_cmpeq_epi32 ( a, b )
-#if NEVER_MATCH
-#define res_adj( res ) \
-    res = 0
-#else
-#define res_adj( res ) \
-    ( ( void ) 0 )
-#endif
-
-    /* SSE registers */
-    nucreg_t buffer, ri;
-    nucreg_t p0, p1, p2, p3, m0, m1, m2, m3;
-
-    /* result registers */
-    int ra, rb, rc, rd;
-
-    /* used for shifting buffer, testing exit */
-    unsigned int num_passes, stop;
-
-    /* kludge for streaming in a byte at a time
-       only needed when qbytes > 1 */
-#if qbytes > 1
-    int slam;
-    const uint8_t *p;
-#endif
-
-    const uint8_t *end, *src;
-    unsigned int qlen = self -> size;
-
-    /* this test is performed outside */
-    assert ( len >= qlen );
-
-    /* the effective length of the sequence,
-       including leading bases we'll ignore */
-    len += pos;
-
-    /* convert source pointer */
-    src = ( const uint8_t* ) ncbi2na + ( pos >> 2 );
-
-    /* stop testing when position passes this point */
-    stop = len - qlen;
-
-    /* the sequence end pointer */
-    end = ( const uint8_t* ) ncbi2na + ( ( len + 3 ) >> 2 );
-
-    /* prime the buffer */
-    buffer = prime_buffer_2na ( src, end );
-    src += 16;
-#if qbytes > 1
-    p = src;
-
-    /* pre-load slam for single byte streaming */
-    if ( src < end )
-        slam = ( int ) src [ -1 ] << 8;
-#endif
-
-    /* prime the registers */
-    prime_registers ( self );
-
-    /* enter the loop at an appropriate offset */
-    ra = rb = rc = 0;
-#if qbytes == 16
-    num_passes = ( stop - pos + 7 ) >> 2;
-#else
-    num_passes = qbytes;
-#endif
-
-    /* for reporting - give a buffer alignment */
-    ALIGN_2NA_HEADER ( buffer, pos & ~ 3, len );
-    switch ( pos & 3 )
-    {
-    default:
-
-        /* outer loop - performs whole buffer loads */
-        while ( 1 )
-        {
-            num_passes = qbytes;
-
-            /* inner loop - shifts in one byte at a time */
-            while ( 1 )
-            {
-                /* for reporting - give a buffer alignment */
-                ALIGN_2NA_HEADER ( buffer, pos, len );
-
-                /* perform comparisons */
-    case 0:
-                ri = _mm_and_si128 ( buffer, m0 );
-                ri = _mm_cmpeq_epi ( ri, p0 );
-                ra = _mm_movemask_epi8 ( ri );
-                res_adj ( ra );
-                ALIGN_2NA_RESULT ( buffer, p0, m0, ri, ra );
-    case 1:
-                ri = _mm_and_si128 ( buffer, m1 );
-                ri = _mm_cmpeq_epi ( ri, p1 );
-                rb = _mm_movemask_epi8 ( ri );
-                res_adj ( rb );
-                ALIGN_2NA_RESULT ( buffer, p1, m1, ri, rb );
-    case 2:
-                ri = _mm_and_si128 ( buffer, m2 );
-                ri = _mm_cmpeq_epi ( ri, p2 );
-                rc = _mm_movemask_epi8 ( ri );
-                res_adj ( rc );
-                ALIGN_2NA_RESULT ( buffer, p2, m2, ri, rc );
-    case 3:
-                ri = _mm_and_si128 ( buffer, m3 );
-                ri = _mm_cmpeq_epi ( ri, p3 );
-                rd = _mm_movemask_epi8 ( ri );
-                res_adj ( rd );
-                ALIGN_2NA_RESULT ( buffer, p3, m3, ri, rd );
-
-                /* adjust pos */
-                pos &= ~ 3;
-
-                /* test for any promising results */
-                if ( ( ra | rb | rc | rd ) != 0 )
-                {
-#if qbytes == 16
-                    switch ( stop - pos )
-                    {
-                    default:
-                        return 1;
-                    case 2:
-                        if ( rc != 0 ) return 1;
-                    case 1:
-                        if ( rb != 0 ) return 1;
-                    case 0:
-                        if ( ra != 0 ) return 1;
-                    }
-                    return 0;
-#else
-                    /* extract first non-zero bit from results
-                       where result is all zeros, bit will be -1 */
-                    int fa = uint16_lsbit ( ( uint16_t ) ra );
-                    int fb = uint16_lsbit ( ( uint16_t ) rb );
-                    int fc = uint16_lsbit ( ( uint16_t ) rc );
-                    int fd = uint16_lsbit ( ( uint16_t ) rd );
-
-                    /* convert bit number into number of bases
-                       from current position. undefined where
-                       bit is negative, but unimportant also */
-                    fa = ( fa << 2 ) + 0;
-                    fb = ( fb << 2 ) + 1;
-                    fc = ( fc << 2 ) + 2;
-                    fd = ( fd << 2 ) + 3;
-
-                    /* test for any case where result was non-zero
-                       and the resultant base index is within range */
-                    if ( ra != 0 && pos + fa <= stop ) return 1;
-                    if ( rb != 0 && pos + fb <= stop ) return 1;
-                    if ( rc != 0 && pos + fc <= stop ) return 1;
-                    if ( rd != 0 && pos + fd <= stop ) return 1;
-#endif
-                }
-
-                /* advance pos */
-                pos += 4;
-
-                /* if no further comparisons are possible */
-                if ( pos > stop )
-                    return 0;
-
-                /* if all shifting passes are complete */
-                if ( -- num_passes == 0 )
-                    break;
-
-#if qbytes > 1
-                /* shift buffer */
-                buffer = _mm_srli_si128 ( buffer, 1 );
-
-                /* bring in new byte */
-                if ( p < end )
-                {
-                    slam >>= 8;
-                    slam |= ( int ) p [ 0 ] << 8;
-                    buffer = _mm_insert_epi16 ( buffer, slam, 7 );
-                }
-                
-                /* always increment source */
-                ++ p;
-#endif
-            }
-
-            /* want to reload buffer */
-            if ( src >= end )
-                break;
-
-            /* advance position */
-            pos += ( 16 - qbytes ) << 2;
-            if ( pos > stop )
-                break;
-
-            /* reload buffer */
-#if RELOAD_BUFFER || qbytes == 1
-            buffer = prime_buffer_2na ( src, end );
-#elif qbytes == 16
-            assert ( 0 );
-#else
-            if ( p - src < 3 )
-                buffer = prime_buffer_2na ( src, end );
-            else
-            {
-                if ( ( ( size_t ) ( p - src ) & 1 ) != 0 )
-                {
-                    buffer = _mm_srli_si128 ( buffer, 1 );
-                    if ( p < end )
-                    {
-                        slam >>= 8;
-                        slam |= ( int ) p [ 0 ] << 8;
-                        buffer = _mm_insert_epi16 ( buffer, slam, 7 );
-                    }
-                    ++ p;
-                }
-
-                if ( src + 16 <= end ) switch ( p - src )
-                {
-                case 4:
-                    buffer = _mm_srli_si128 ( buffer, 12 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 2 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 1 ], 3 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 2 ], 4 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 3 ], 5 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 4 ], 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 5 ], 7 );
-                    break;
-                case 6:
-                    buffer = _mm_srli_si128 ( buffer, 10 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 3 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 1 ], 4 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 2 ], 5 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 3 ], 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 4 ], 7 );
-                    break;
-                case 8:
-                    buffer = _mm_srli_si128 ( buffer, 8 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 4 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 1 ], 5 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 2 ], 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 3 ], 7 );
-                    break;
-                case 10:
-                    buffer = _mm_srli_si128 ( buffer, 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 5 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 1 ], 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 2 ], 7 );
-                    break;
-                case 12:
-                    buffer = _mm_srli_si128 ( buffer, 4 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 1 ], 7 );
-                    break;
-                case 14:
-                    buffer = _mm_srli_si128 ( buffer, 2 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 7 );
-                    break;
-                }
-
-                else for ( ; p - src < 16; p += 2 )
-                {
-                    buffer = _mm_srli_si128 ( buffer, 2 );
-                    if ( p < end )
-                    {
-                        slam = p [ 0 ];
-                        if ( p + 1 < end )
-                            slam |= ( int ) p [ 1 ] << 8;
-                        buffer = _mm_insert_epi16 ( buffer, slam, 7 );
-                    }
-                }
-            }
-#endif
-
-            /* adjust pointers */
-            src += 16;
-#if qbytes > 1
-            p = src;
-            if ( src < end )
-                slam = ( int ) src [ -1 ] << 8;
-#endif
-        }
-    }
-
-#undef qbytes
-#undef _mm_cmpeq_epi
-#undef res_adj
-
-    return 0;
-}
-
-static
-int eval_2na_64 ( const NucStrFastaExpr *self,
-    const void *ncbi2na, unsigned int pos, unsigned int len )
-{
-#define qbytes 8
-#define _mm_cmpeq_epi( a, b ) \
-    _mm_cmpeq_epi32 ( a, b )
-#if NEVER_MATCH
-#define res_adj( res ) \
-    res = 0
-#else
-#define res_adj( res ) \
-    ( ( res ) &= ( ( res ) & 0x0F0F ) << 4, \
-      ( res ) |= ( res ) >> 4 )
-#endif
-
-    /* SSE registers */
-    nucreg_t buffer, ri;
-    nucreg_t p0, p1, p2, p3, m0, m1, m2, m3;
-
-    /* result registers */
-    int ra, rb, rc, rd;
-
-    /* used for shifting buffer, testing exit */
-    unsigned int num_passes, stop;
-
-    /* kludge for streaming in a byte at a time
-       only needed when qbytes > 1 */
-#if qbytes > 1
-    int slam;
-    const uint8_t *p;
-#endif
-
-    const uint8_t *end, *src;
-    unsigned int qlen = self -> size;
-
-    /* this test is performed outside */
-    assert ( len >= qlen );
-
-    /* the effective length of the sequence,
-       including leading bases we'll ignore */
-    len += pos;
-
-    /* convert source pointer */
-    src = ( const uint8_t* ) ncbi2na + ( pos >> 2 );
-
-    /* stop testing when position passes this point */
-    stop = len - qlen;
-
-    /* the sequence end pointer */
-    end = ( const uint8_t* ) ncbi2na + ( ( len + 3 ) >> 2 );
-
-    /* prime the buffer */
-    buffer = prime_buffer_2na ( src, end );
-    src += 16;
-#if qbytes > 1
-    p = src;
-
-    /* pre-load slam for single byte streaming */
-    if ( src < end )
-        slam = ( int ) src [ -1 ] << 8;
-#endif
-
-    /* prime the registers */
-    prime_registers ( self );
-
-    /* enter the loop at an appropriate offset */
-    ra = rb = rc = 0;
-#if qbytes == 16
-    num_passes = ( stop - pos + 7 ) >> 2;
-#else
-    num_passes = qbytes;
-#endif
-
-    /* for reporting - give a buffer alignment */
-    ALIGN_2NA_HEADER ( buffer, pos & ~ 3, len );
-    switch ( pos & 3 )
-    {
-    default:
-
-        /* outer loop - performs whole buffer loads */
-        while ( 1 )
-        {
-            num_passes = qbytes;
-
-            /* inner loop - shifts in one byte at a time */
-            while ( 1 )
-            {
-                /* for reporting - give a buffer alignment */
-                ALIGN_2NA_HEADER ( buffer, pos, len );
-
-                /* perform comparisons */
-    case 0:
-                ri = _mm_and_si128 ( buffer, m0 );
-                ri = _mm_cmpeq_epi ( ri, p0 );
-                ra = _mm_movemask_epi8 ( ri );
-                res_adj ( ra );
-                ALIGN_2NA_RESULT ( buffer, p0, m0, ri, ra );
-    case 1:
-                ri = _mm_and_si128 ( buffer, m1 );
-                ri = _mm_cmpeq_epi ( ri, p1 );
-                rb = _mm_movemask_epi8 ( ri );
-                res_adj ( rb );
-                ALIGN_2NA_RESULT ( buffer, p1, m1, ri, rb );
-    case 2:
-                ri = _mm_and_si128 ( buffer, m2 );
-                ri = _mm_cmpeq_epi ( ri, p2 );
-                rc = _mm_movemask_epi8 ( ri );
-                res_adj ( rc );
-                ALIGN_2NA_RESULT ( buffer, p2, m2, ri, rc );
-    case 3:
-                ri = _mm_and_si128 ( buffer, m3 );
-                ri = _mm_cmpeq_epi ( ri, p3 );
-                rd = _mm_movemask_epi8 ( ri );
-                res_adj ( rd );
-                ALIGN_2NA_RESULT ( buffer, p3, m3, ri, rd );
-
-                /* adjust pos */
-                pos &= ~ 3;
-
-                /* test for any promising results */
-                if ( ( ra | rb | rc | rd ) != 0 )
-                {
-#if qbytes == 16
-                    switch ( stop - pos )
-                    {
-                    default:
-                        return 1;
-                    case 2:
-                        if ( rc != 0 ) return 1;
-                    case 1:
-                        if ( rb != 0 ) return 1;
-                    case 0:
-                        if ( ra != 0 ) return 1;
-                    }
-                    return 0;
-#else
-                    /* extract first non-zero bit from results
-                       where result is all zeros, bit will be -1 */
-                    int fa = uint16_lsbit ( ( uint16_t ) ra );
-                    int fb = uint16_lsbit ( ( uint16_t ) rb );
-                    int fc = uint16_lsbit ( ( uint16_t ) rc );
-                    int fd = uint16_lsbit ( ( uint16_t ) rd );
-
-                    /* convert bit number into number of bases
-                       from current position. undefined where
-                       bit is negative, but unimportant also */
-                    fa = ( fa << 2 ) + 0;
-                    fb = ( fb << 2 ) + 1;
-                    fc = ( fc << 2 ) + 2;
-                    fd = ( fd << 2 ) + 3;
-
-                    /* test for any case where result was non-zero
-                       and the resultant base index is within range */
-                    if ( ra != 0 && pos + fa <= stop ) return 1;
-                    if ( rb != 0 && pos + fb <= stop ) return 1;
-                    if ( rc != 0 && pos + fc <= stop ) return 1;
-                    if ( rd != 0 && pos + fd <= stop ) return 1;
-#endif
-                }
-
-                /* advance pos */
-                pos += 4;
-
-                /* if no further comparisons are possible */
-                if ( pos > stop )
-                    return 0;
-
-                /* if all shifting passes are complete */
-                if ( -- num_passes == 0 )
-                    break;
-
-#if qbytes > 1
-                /* shift buffer */
-                buffer = _mm_srli_si128 ( buffer, 1 );
-
-                /* bring in new byte */
-                if ( p < end )
-                {
-                    slam >>= 8;
-                    slam |= ( int ) p [ 0 ] << 8;
-                    buffer = _mm_insert_epi16 ( buffer, slam, 7 );
-                }
-                
-                /* always increment source */
-                ++ p;
-#endif
-            }
-
-            /* want to reload buffer */
-            if ( src >= end )
-                break;
-
-            /* advance position */
-            pos += ( 16 - qbytes ) << 2;
-            if ( pos > stop )
-                break;
-
-            /* reload buffer */
-#if RELOAD_BUFFER || qbytes == 1
-            buffer = prime_buffer_2na ( src, end );
-#elif qbytes == 16
-            assert ( 0 );
-#else
-            if ( p - src < 3 )
-                buffer = prime_buffer_2na ( src, end );
-            else
-            {
-                if ( ( ( size_t ) ( p - src ) & 1 ) != 0 )
-                {
-                    buffer = _mm_srli_si128 ( buffer, 1 );
-                    if ( p < end )
-                    {
-                        slam >>= 8;
-                        slam |= ( int ) p [ 0 ] << 8;
-                        buffer = _mm_insert_epi16 ( buffer, slam, 7 );
-                    }
-                    ++ p;
-                }
-
-                if ( src + 16 <= end ) switch ( p - src )
-                {
-                case 4:
-                    buffer = _mm_srli_si128 ( buffer, 12 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 2 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 1 ], 3 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 2 ], 4 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 3 ], 5 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 4 ], 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 5 ], 7 );
-                    break;
-                case 6:
-                    buffer = _mm_srli_si128 ( buffer, 10 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 3 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 1 ], 4 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 2 ], 5 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 3 ], 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 4 ], 7 );
-                    break;
-                case 8:
-                    buffer = _mm_srli_si128 ( buffer, 8 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 4 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 1 ], 5 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 2 ], 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 3 ], 7 );
-                    break;
-                case 10:
-                    buffer = _mm_srli_si128 ( buffer, 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 5 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 1 ], 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 2 ], 7 );
-                    break;
-                case 12:
-                    buffer = _mm_srli_si128 ( buffer, 4 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 1 ], 7 );
-                    break;
-                case 14:
-                    buffer = _mm_srli_si128 ( buffer, 2 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 7 );
-                    break;
-                }
-
-                else for ( ; p - src < 16; p += 2 )
-                {
-                    buffer = _mm_srli_si128 ( buffer, 2 );
-                    if ( p < end )
-                    {
-                        slam = p [ 0 ];
-                        if ( p + 1 < end )
-                            slam |= ( int ) p [ 1 ] << 8;
-                        buffer = _mm_insert_epi16 ( buffer, slam, 7 );
-                    }
-                }
-            }
-#endif
-
-            /* adjust pointers */
-            src += 16;
-#if qbytes > 1
-            p = src;
-            if ( src < end )
-                slam = ( int ) src [ -1 ] << 8;
-#endif
-        }
-    }
-
-#undef qbytes
-#undef _mm_cmpeq_epi
-#undef res_adj
-
-    return 0;
-}
-
-static
-int eval_2na_128 ( const NucStrFastaExpr *self,
-    const void *ncbi2na, unsigned int pos, unsigned int len )
-{
-#define qbytes 16
-#define _mm_cmpeq_epi( a, b ) \
-    _mm_cmpeq_epi32 ( a, b )
-#if NEVER_MATCH
-#define res_adj( res ) \
-    res = 0
-#else
-#define res_adj( res ) \
-    ( ( res ) = - ( ( ( res ) + 1 ) >> 16 ) )
-#endif
-
-    /* SSE registers */
-    nucreg_t buffer, ri;
-    nucreg_t p0, p1, p2, p3, m0, m1, m2, m3;
-
-    /* result registers */
-    int ra, rb, rc, rd;
-
-    /* used for shifting buffer, testing exit */
-    unsigned int num_passes, stop;
-
-    /* kludge for streaming in a byte at a time
-       only needed when qbytes > 1 */
-#if qbytes > 1
-    int slam;
-    const uint8_t *p;
-#endif
-
-    const uint8_t *end, *src;
-    unsigned int qlen = self -> size;
-
-    /* this test is performed outside */
-    assert ( len >= qlen );
-
-    /* the effective length of the sequence,
-       including leading bases we'll ignore */
-    len += pos;
-
-    /* convert source pointer */
-    src = ( const uint8_t* ) ncbi2na + ( pos >> 2 );
-
-    /* stop testing when position passes this point */
-    stop = len - qlen;
-
-    /* the sequence end pointer */
-    end = ( const uint8_t* ) ncbi2na + ( ( len + 3 ) >> 2 );
-
-    /* prime the buffer */
-    buffer = prime_buffer_2na ( src, end );
-    src += 16;
-#if qbytes > 1
-    p = src;
-
-    /* pre-load slam for single byte streaming */
-    if ( src < end )
-        slam = ( int ) src [ -1 ] << 8;
-#endif
-
-    /* prime the registers */
-    prime_registers ( self );
-
-    /* enter the loop at an appropriate offset */
-    ra = rb = rc = 0;
-#if qbytes == 16
-    num_passes = ( stop - pos + 7 ) >> 2;
-#else
-    num_passes = qbytes;
-#endif
-
-    /* for reporting - give a buffer alignment */
-    ALIGN_2NA_HEADER ( buffer, pos & ~ 3, len );
-    switch ( pos & 3 )
-    {
-    default:
-
-        /* outer loop - performs whole buffer loads */
-        while ( 1 )
-        {
-            num_passes = qbytes;
-
-            /* inner loop - shifts in one byte at a time */
-            while ( 1 )
-            {
-                /* for reporting - give a buffer alignment */
-                ALIGN_2NA_HEADER ( buffer, pos, len );
-
-                /* perform comparisons */
-    case 0:
-                ri = _mm_and_si128 ( buffer, m0 );
-                ri = _mm_cmpeq_epi ( ri, p0 );
-                ra = _mm_movemask_epi8 ( ri );
-                res_adj ( ra );
-                ALIGN_2NA_RESULT ( buffer, p0, m0, ri, ra );
-    case 1:
-                ri = _mm_and_si128 ( buffer, m1 );
-                ri = _mm_cmpeq_epi ( ri, p1 );
-                rb = _mm_movemask_epi8 ( ri );
-                res_adj ( rb );
-                ALIGN_2NA_RESULT ( buffer, p1, m1, ri, rb );
-    case 2:
-                ri = _mm_and_si128 ( buffer, m2 );
-                ri = _mm_cmpeq_epi ( ri, p2 );
-                rc = _mm_movemask_epi8 ( ri );
-                res_adj ( rc );
-                ALIGN_2NA_RESULT ( buffer, p2, m2, ri, rc );
-    case 3:
-                ri = _mm_and_si128 ( buffer, m3 );
-                ri = _mm_cmpeq_epi ( ri, p3 );
-                rd = _mm_movemask_epi8 ( ri );
-                res_adj ( rd );
-                ALIGN_2NA_RESULT ( buffer, p3, m3, ri, rd );
-
-                /* adjust pos */
-                pos &= ~ 3;
-
-                /* test for any promising results */
-                if ( ( ra | rb | rc | rd ) != 0 )
-                {
-#if qbytes == 16
-                    switch ( stop - pos )
-                    {
-                    default:
-                        return 1;
-                    case 2:
-                        if ( rc != 0 ) return 1;
-                    case 1:
-                        if ( rb != 0 ) return 1;
-                    case 0:
-                        if ( ra != 0 ) return 1;
-                    }
-                    return 0;
-#else
-                    /* extract first non-zero bit from results
-                       where result is all zeros, bit will be -1 */
-                    int fa = uint16_lsbit ( ( uint16_t ) ra );
-                    int fb = uint16_lsbit ( ( uint16_t ) rb );
-                    int fc = uint16_lsbit ( ( uint16_t ) rc );
-                    int fd = uint16_lsbit ( ( uint16_t ) rd );
-
-                    /* convert bit number into number of bases
-                       from current position. undefined where
-                       bit is negative, but unimportant also */
-                    fa = ( fa << 2 ) + 0;
-                    fb = ( fb << 2 ) + 1;
-                    fc = ( fc << 2 ) + 2;
-                    fd = ( fd << 2 ) + 3;
-
-                    /* test for any case where result was non-zero
-                       and the resultant base index is within range */
-                    if ( ra != 0 && pos + fa <= stop ) return 1;
-                    if ( rb != 0 && pos + fb <= stop ) return 1;
-                    if ( rc != 0 && pos + fc <= stop ) return 1;
-                    if ( rd != 0 && pos + fd <= stop ) return 1;
-#endif
-                }
-
-                /* advance pos */
-                pos += 4;
-
-                /* if no further comparisons are possible */
-                if ( pos > stop )
-                    return 0;
-
-                /* if all shifting passes are complete */
-                if ( -- num_passes == 0 )
-                    break;
-
-#if qbytes > 1
-                /* shift buffer */
-                buffer = _mm_srli_si128 ( buffer, 1 );
-
-                /* bring in new byte */
-                if ( p < end )
-                {
-                    slam >>= 8;
-                    slam |= ( int ) p [ 0 ] << 8;
-                    buffer = _mm_insert_epi16 ( buffer, slam, 7 );
-                }
-                
-                /* always increment source */
-                ++ p;
-#endif
-            }
-
-            /* want to reload buffer */
-            if ( src >= end )
-                break;
-
-            /* advance position */
-            pos += ( 16 - qbytes ) << 2;
-            if ( pos > stop )
-                break;
-
-            /* reload buffer */
-#if RELOAD_BUFFER || qbytes == 1
-            buffer = prime_buffer_2na ( src, end );
-#elif qbytes == 16
-            assert ( 0 );
-#else
-            if ( p - src < 3 )
-                buffer = prime_buffer_2na ( src, end );
-            else
-            {
-                if ( ( ( size_t ) ( p - src ) & 1 ) != 0 )
-                {
-                    buffer = _mm_srli_si128 ( buffer, 1 );
-                    if ( p < end )
-                    {
-                        slam >>= 8;
-                        slam |= ( int ) p [ 0 ] << 8;
-                        buffer = _mm_insert_epi16 ( buffer, slam, 7 );
-                    }
-                    ++ p;
-                }
-
-                if ( src + 16 <= end ) switch ( p - src )
-                {
-                case 4:
-                    buffer = _mm_srli_si128 ( buffer, 12 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 2 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 1 ], 3 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 2 ], 4 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 3 ], 5 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 4 ], 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 5 ], 7 );
-                    break;
-                case 6:
-                    buffer = _mm_srli_si128 ( buffer, 10 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 3 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 1 ], 4 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 2 ], 5 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 3 ], 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 4 ], 7 );
-                    break;
-                case 8:
-                    buffer = _mm_srli_si128 ( buffer, 8 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 4 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 1 ], 5 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 2 ], 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 3 ], 7 );
-                    break;
-                case 10:
-                    buffer = _mm_srli_si128 ( buffer, 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 5 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 1 ], 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 2 ], 7 );
-                    break;
-                case 12:
-                    buffer = _mm_srli_si128 ( buffer, 4 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 1 ], 7 );
-                    break;
-                case 14:
-                    buffer = _mm_srli_si128 ( buffer, 2 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 7 );
-                    break;
-                }
-
-                else for ( ; p - src < 16; p += 2 )
-                {
-                    buffer = _mm_srli_si128 ( buffer, 2 );
-                    if ( p < end )
-                    {
-                        slam = p [ 0 ];
-                        if ( p + 1 < end )
-                            slam |= ( int ) p [ 1 ] << 8;
-                        buffer = _mm_insert_epi16 ( buffer, slam, 7 );
-                    }
-                }
-            }
-#endif
-
-            /* adjust pointers */
-            src += 16;
-#if qbytes > 1
-            p = src;
-            if ( src < end )
-                slam = ( int ) src [ -1 ] << 8;
-#endif
-        }
-    }
-
-#undef qbytes
-#undef _mm_cmpeq_epi
-#undef res_adj
-
-    return 0;
-}
-
-static
-int eval_2na_pos ( const NucStrFastaExpr *self,
-    const void *ncbi2na, unsigned int pos, unsigned int len )
-{
-#define positional 1
-#define qbytes 16
-#define _mm_cmpeq_epi( a, b ) \
-    _mm_cmpeq_epi32 ( a, b )
-#if NEVER_MATCH
-#define res_adj( res ) \
-    res = 0
-#else
-#define res_adj( res ) \
-    ( ( res ) = - ( ( ( res ) + 1 ) >> 16 ) )
-#endif
-
-    /* SSE registers */
-    nucreg_t buffer, ri;
-    nucreg_t p0, p1, p2, p3, m0, m1, m2, m3;
-
-    /* result registers */
-    int ra, rb, rc, rd;
-
-    /* used for shifting buffer, testing exit */
-    unsigned int num_passes, stop;
-
-    /* used to hold entry position */
-#if positional
-    unsigned int start;
-#endif
-
-    /* kludge for streaming in a byte at a time
-       only needed when qbytes > 1 */
-#if qbytes > 1
-    int slam;
-    const uint8_t *p;
-#endif
-
-    const uint8_t *end, *src;
-    unsigned int qlen = self -> size;
-
-    /* this test is performed outside */
-    assert ( len >= qlen );
-
-    /* the effective length of the sequence,
-       including leading bases we'll ignore */
-    len += pos;
-
-    /* hold starting position */
-#if positional
-    start = pos;
-#endif
-
-    /* convert source pointer */
-    src = ( const uint8_t* ) ncbi2na + ( pos >> 2 );
-
-    /* stop testing when position passes this point */
-    stop = len - qlen;
-
-    /* the sequence end pointer */
-    end = ( const uint8_t* ) ncbi2na + ( ( len + 3 ) >> 2 );
-
-    /* prime the buffer */
-    buffer = prime_buffer_2na ( src, end );
-    src += 16;
-#if qbytes > 1
-    p = src;
-
-    /* pre-load slam for single byte streaming */
-    if ( src < end )
-        slam = ( int ) src [ -1 ] << 8;
-#endif
-
-    /* prime the registers */
-    prime_registers ( self );
-
-    /* enter the loop at an appropriate offset */
-    ra = rb = rc = 0;
-#if qbytes == 16
-    num_passes = ( stop - pos + 7 ) >> 2;
-#else
-    num_passes = qbytes;
-#endif
-
-    /* for reporting - give a buffer alignment */
-    ALIGN_2NA_HEADER ( buffer, pos & ~ 3, len );
-    switch ( pos & 3 )
-    {
-    default:
-
-        /* outer loop - performs whole buffer loads */
-        while ( 1 )
-        {
-            num_passes = qbytes;
-
-            /* inner loop - shifts in one byte at a time */
-            while ( 1 )
-            {
-                /* for reporting - give a buffer alignment */
-                ALIGN_2NA_HEADER ( buffer, pos, len );
-
-                /* perform comparisons */
-    case 0:
-                ri = _mm_and_si128 ( buffer, m0 );
-                ri = _mm_cmpeq_epi ( ri, p0 );
-                ra = _mm_movemask_epi8 ( ri );
-                res_adj ( ra );
-                ALIGN_2NA_RESULT ( buffer, p0, m0, ri, ra );
-    case 1:
-                ri = _mm_and_si128 ( buffer, m1 );
-                ri = _mm_cmpeq_epi ( ri, p1 );
-                rb = _mm_movemask_epi8 ( ri );
-                res_adj ( rb );
-                ALIGN_2NA_RESULT ( buffer, p1, m1, ri, rb );
-    case 2:
-                ri = _mm_and_si128 ( buffer, m2 );
-                ri = _mm_cmpeq_epi ( ri, p2 );
-                rc = _mm_movemask_epi8 ( ri );
-                res_adj ( rc );
-                ALIGN_2NA_RESULT ( buffer, p2, m2, ri, rc );
-    case 3:
-                ri = _mm_and_si128 ( buffer, m3 );
-                ri = _mm_cmpeq_epi ( ri, p3 );
-                rd = _mm_movemask_epi8 ( ri );
-                res_adj ( rd );
-                ALIGN_2NA_RESULT ( buffer, p3, m3, ri, rd );
-
-                /* adjust pos */
-                pos &= ~ 3;
-
-                /* test for any promising results */
-                if ( ( ra | rb | rc | rd ) != 0 )
-                {
-#if positional
-                    switch ( stop - pos )
-                    {
-                    case 0:
-                        if ( ra != 0 ) return pos - start + 1;
-                        break;
-                    case 1:
-                        if ( ra != 0 ) return pos - start + 1;
-                        if ( rb != 0 ) return pos - start + 2;
-                        break;
-                    case 2:
-                        if ( ra != 0 ) return pos - start + 1;
-                        if ( rb != 0 ) return pos - start + 2;
-                        if ( rc != 0 ) return pos - start + 3;
-                        break;
-                    default:
-                        if ( ra != 0 ) return pos - start + 1;
-                        if ( rb != 0 ) return pos - start + 2;
-                        if ( rc != 0 ) return pos - start + 3;
-                        if ( rd != 0 ) return pos - start + 4;
-                    }
-                    return 0;
-#elif qbytes == 16
-                    switch ( stop - pos )
-                    {
-                    default:
-                        return 1;
-                    case 2:
-                        if ( rc != 0 ) return 1;
-                    case 1:
-                        if ( rb != 0 ) return 1;
-                    case 0:
-                        if ( ra != 0 ) return 1;
-                    }
-                    return 0;
-#else
-                    /* extract first non-zero bit from results
-                       where result is all zeros, bit will be -1 */
-                    int fa = uint16_lsbit ( ( uint16_t ) ra );
-                    int fb = uint16_lsbit ( ( uint16_t ) rb );
-                    int fc = uint16_lsbit ( ( uint16_t ) rc );
-                    int fd = uint16_lsbit ( ( uint16_t ) rd );
-
-                    /* convert bit number into number of bases
-                       from current position. undefined where
-                       bit is negative, but unimportant also */
-                    fa = ( fa << 2 ) + 0;
-                    fb = ( fb << 2 ) + 1;
-                    fc = ( fc << 2 ) + 2;
-                    fd = ( fd << 2 ) + 3;
-
-                    /* test for any case where result was non-zero
-                       and the resultant base index is within range */
-                    if ( ra != 0 && pos + fa <= stop ) return 1;
-                    if ( rb != 0 && pos + fb <= stop ) return 1;
-                    if ( rc != 0 && pos + fc <= stop ) return 1;
-                    if ( rd != 0 && pos + fd <= stop ) return 1;
-#endif
-                }
-
-                /* advance pos */
-                pos += 4;
-
-                /* if no further comparisons are possible */
-                if ( pos > stop )
-                    return 0;
-
-                /* if all shifting passes are complete */
-                if ( -- num_passes == 0 )
-                    break;
-
-#if qbytes > 1
-                /* shift buffer */
-                buffer = _mm_srli_si128 ( buffer, 1 );
-
-                /* bring in new byte */
-                if ( p < end )
-                {
-                    slam >>= 8;
-                    slam |= ( int ) p [ 0 ] << 8;
-                    buffer = _mm_insert_epi16 ( buffer, slam, 7 );
-                }
-                
-                /* always increment source */
-                ++ p;
-#endif
-            }
-
-            /* want to reload buffer */
-            if ( src >= end )
-                break;
-
-            /* advance position */
-            pos += ( 16 - qbytes ) << 2;
-            if ( pos > stop )
-                break;
-
-            /* reload buffer */
-#if RELOAD_BUFFER || qbytes == 1
-            buffer = prime_buffer_2na ( src, end );
-#elif qbytes == 16
-            assert ( 0 );
-#else
-            if ( p - src < 3 )
-                buffer = prime_buffer_2na ( src, end );
-            else
-            {
-                if ( ( ( size_t ) ( p - src ) & 1 ) != 0 )
-                {
-                    buffer = _mm_srli_si128 ( buffer, 1 );
-                    if ( p < end )
-                    {
-                        slam >>= 8;
-                        slam |= ( int ) p [ 0 ] << 8;
-                        buffer = _mm_insert_epi16 ( buffer, slam, 7 );
-                    }
-                    ++ p;
-                }
-
-                if ( src + 16 <= end ) switch ( p - src )
-                {
-                case 4:
-                    buffer = _mm_srli_si128 ( buffer, 12 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 2 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 1 ], 3 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 2 ], 4 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 3 ], 5 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 4 ], 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 5 ], 7 );
-                    break;
-                case 6:
-                    buffer = _mm_srli_si128 ( buffer, 10 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 3 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 1 ], 4 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 2 ], 5 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 3 ], 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 4 ], 7 );
-                    break;
-                case 8:
-                    buffer = _mm_srli_si128 ( buffer, 8 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 4 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 1 ], 5 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 2 ], 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 3 ], 7 );
-                    break;
-                case 10:
-                    buffer = _mm_srli_si128 ( buffer, 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 5 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 1 ], 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 2 ], 7 );
-                    break;
-                case 12:
-                    buffer = _mm_srli_si128 ( buffer, 4 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 6 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 1 ], 7 );
-                    break;
-                case 14:
-                    buffer = _mm_srli_si128 ( buffer, 2 );
-                    buffer = _mm_insert_epi16 ( buffer, ( ( const uint16_t* ) p ) [ 0 ], 7 );
-                    break;
-                }
-
-                else for ( ; p - src < 16; p += 2 )
-                {
-                    buffer = _mm_srli_si128 ( buffer, 2 );
-                    if ( p < end )
-                    {
-                        slam = p [ 0 ];
-                        if ( p + 1 < end )
-                            slam |= ( int ) p [ 1 ] << 8;
-                        buffer = _mm_insert_epi16 ( buffer, slam, 7 );
-                    }
-                }
-            }
-#endif
-
-            /* adjust pointers */
-            src += 16;
-#if qbytes > 1
-            p = src;
-            if ( src < end )
-                slam = ( int ) src [ -1 ] << 8;
-#endif
-        }
-    }
-
-#undef positional
-#undef qbytes
-#undef _mm_cmpeq_epi
-#undef res_adj
-
-    return 0;
-}
-
-
-#if ENDLESS_BUFFER
-static __inline__
-__m128i prime_buffer_4na ( const uint8_t *src, const uint8_t *ignore )
-{
-    nucpat_t tmp;
-    __m128i buffer;
-
-    ( void ) ignore;
-
-    tmp . w [ 0 ] = expand_2na [ src [ 0 ] ];
-    tmp . w [ 1 ] = expand_2na [ src [ 1 ] ];
-    tmp . w [ 2 ] = expand_2na [ src [ 2 ] ];
-    tmp . w [ 3 ] = expand_2na [ src [ 3 ] ];
-    tmp . w [ 4 ] = expand_2na [ src [ 4 ] ];
-    tmp . w [ 5 ] = expand_2na [ src [ 5 ] ];
-    tmp . w [ 6 ] = expand_2na [ src [ 6 ] ];
-    tmp . w [ 7 ] = expand_2na [ src [ 7 ] ];
-
-    buffer = _mm_loadu_si128 ( ( const __m128i* ) tmp . b );
-    return buffer;
-}
-#else
-static __inline__
-__m128i prime_buffer_4na ( const uint8_t *src, const uint8_t *end )
-{
-    nucpat_t tmp;
-    __m128i buffer;
-
-    if ( end - src >= 8 )
-    {
-        tmp . w [ 0 ] = expand_2na [ src [ 0 ] ];
-        tmp . w [ 1 ] = expand_2na [ src [ 1 ] ];
-        tmp . w [ 2 ] = expand_2na [ src [ 2 ] ];
-        tmp . w [ 3 ] = expand_2na [ src [ 3 ] ];
-        tmp . w [ 4 ] = expand_2na [ src [ 4 ] ];
-        tmp . w [ 5 ] = expand_2na [ src [ 5 ] ];
-        tmp . w [ 6 ] = expand_2na [ src [ 6 ] ];
-        tmp . w [ 7 ] = expand_2na [ src [ 7 ] ];
-    }
-    else
-    {
-        tmp . l [ 0 ] = tmp . l [ 1 ] = 0;
-        switch ( end - src )
-        {
-        default:
-            tmp . w [ 6 ] = expand_2na [ src [ 6 ] ];
-        case 6:
-            tmp . w [ 5 ] = expand_2na [ src [ 5 ] ];
-        case 5:
-            tmp . w [ 4 ] = expand_2na [ src [ 4 ] ];
-        case 4:
-            tmp . w [ 3 ] = expand_2na [ src [ 3 ] ];
-        case 3:
-            tmp . w [ 2 ] = expand_2na [ src [ 2 ] ];
-        case 2:
-            tmp . w [ 1 ] = expand_2na [ src [ 1 ] ];
-        case 1:
-            tmp . w [ 0 ] = expand_2na [ src [ 0 ] ];
-            break;
-        }
-    }
-
-    buffer = _mm_loadu_si128 ( ( const __m128i* ) tmp . b );
-    return buffer;
-}
-#endif
-
-static
-int eval_4na_16 ( const NucStrFastaExpr *self,
-    const void *ncbi2na, unsigned int pos, unsigned int len )
-{
-#define qbytes 2
-#define _mm_cmpeq_epi( a, b ) \
-    _mm_cmpeq_epi16 ( a, b )
-#if NEVER_MATCH
-#define res_adj( res ) \
-    res = 0
-#else
-#define res_adj( res ) \
-    ( ( void ) 0 )
-#endif
-
-    /* SSE registers */
-    nucreg_t buffer, ri, rj;
-    nucreg_t p0, p1, p2, p3, m0, m1, m2, m3;
-
-    /* result registers */
-    int ra, rb, rc, rd;
-
-    /* used for shifting buffer, testing exit */
-    unsigned int num_passes, stop;
-
-#if qbytes > 2
-    const uint8_t *p;
-#endif
-    const uint8_t *end, *src;
-    unsigned int qlen = self -> size;
-
-    /* this test is performed outside */
-    assert ( len >= qlen );
-
-    /* the effective length of the sequence,
-       including leading bases we'll ignore */
-    len += pos;
-
-    /* convert source pointer */
-    src = ( const uint8_t* ) ncbi2na + ( pos >> 2 );
-
-    /* stop testing when position passes this point */
-    stop = len - qlen;
-
-    /* the sequence end pointer */
-    end = ( const uint8_t* ) ncbi2na + ( ( len + 3 ) >> 2 );
-
-    /* prime the buffer */
-    buffer = prime_buffer_4na ( src, end );
-    src += 8;
-#if qbytes > 2
-    p = src;
-#endif
-
-    /* prime the registers */
-    prime_registers ( self );
-
-    /* enter the loop at an appropriate offset */
-    ra = rb = rc = 0;
-#if qbytes == 16
-    num_passes = ( stop - pos + 7 ) >> 2;
-#elif qbytes == 1
-#error "4na requires at least 2 qbytes"
-#else
-    num_passes = qbytes / 2;
-#endif
-
-    /* for reporting - give a buffer alignment */
-    ALIGN_4NA_HEADER ( buffer, pos & ~ 3, len );
-    switch ( pos & 3 )
-    {
-    default:
-
-        /* outer loop - performs whole buffer loads */
-        while ( 1 )
-        {
-            num_passes = qbytes / 2;
-
-            /* inner loop - shifts in one byte at a time */
-            while ( 1 )
-            {
-                /* for reporting - give a buffer alignment */
-                ALIGN_4NA_HEADER ( buffer, pos, len );
-
-                /* perform comparisons */
-    case 0:
-                ri = _mm_and_si128 ( buffer, p0 );
-                rj = _mm_and_si128 ( buffer, m0 );
-                ri = _mm_cmpeq_epi ( ri, rj );
-                ra = _mm_movemask_epi8 ( ri );
-                res_adj ( ra );
-                ALIGN_4NA_RESULT ( buffer, p0, m0, ri, ra );
-    case 1:
-                ri = _mm_and_si128 ( buffer, p1 );
-                rj = _mm_and_si128 ( buffer, m1 );
-                ri = _mm_cmpeq_epi ( ri, rj );
-                rb = _mm_movemask_epi8 ( ri );
-                res_adj ( rb );
-                ALIGN_4NA_RESULT ( buffer, p1, m1, ri, rb );
-    case 2:
-                ri = _mm_and_si128 ( buffer, p2 );
-                rj = _mm_and_si128 ( buffer, m2 );
-                ri = _mm_cmpeq_epi ( ri, rj );
-                rc = _mm_movemask_epi8 ( ri );
-                res_adj ( rc );
-                ALIGN_4NA_RESULT ( buffer, p2, m2, ri, rc );
-    case 3:
-                ri = _mm_and_si128 ( buffer, p3 );
-                rj = _mm_and_si128 ( buffer, m3 );
-                ri = _mm_cmpeq_epi ( ri, rj );
-                rd = _mm_movemask_epi8 ( ri );
-                res_adj ( rd );
-                ALIGN_4NA_RESULT ( buffer, p3, m3, ri, rd );
-
-                /* adjust pos */
-                pos &= ~ 3;
-
-                /* test for any promising results */
-                if ( ( ra | rb | rc | rd ) != 0 )
-                {
-#if qbytes == 16
-                    switch ( stop - pos )
-                    {
-                    default:
-                        return 1;
-                    case 2:
-                        if ( rc != 0 ) return 1;
-                    case 1:
-                        if ( rb != 0 ) return 1;
-                    case 0:
-                        if ( ra != 0 ) return 1;
-                    }
-                    return 0;
-#else
-                    /* extract first non-zero bit from results
-                       where result is all zeros, bit will be -1 */
-                    int fa = uint16_lsbit ( ( uint16_t ) ra );
-                    int fb = uint16_lsbit ( ( uint16_t ) rb );
-                    int fc = uint16_lsbit ( ( uint16_t ) rc );
-                    int fd = uint16_lsbit ( ( uint16_t ) rd );
-
-                    /* convert bit number into number of bases
-                       from current position. undefined where
-                       bit is negative, but unimportant also */
-                    fa = ( fa << 1 ) + 0;
-                    fb = ( fb << 1 ) + 1;
-                    fc = ( fc << 1 ) + 2;
-                    fd = ( fd << 1 ) + 3;
-
-                    /* test for any case where result was non-zero
-                       and the resultant base index is within range */
-                    if ( ra != 0 && pos + fa <= stop ) return 1;
-                    if ( rb != 0 && pos + fb <= stop ) return 1;
-                    if ( rc != 0 && pos + fc <= stop ) return 1;
-                    if ( rd != 0 && pos + fd <= stop ) return 1;
-#endif
-                }
-
-                /* advance pos */
-                pos += 4;
-
-                /* if no further comparisons are possible */
-                if ( pos > stop )
-                    return 0;
-
-                /* if all shifting passes are complete */
-                if ( -- num_passes == 0 )
-                    break;
-
-#if qbytes > 2
-                /* shift buffer */
-                buffer = _mm_srli_si128 ( buffer, 2 );
-
-                /* bring in new byte */
-                if ( p < end )
-                    buffer = _mm_insert_epi16 ( buffer, expand_2na [ * p ], 7 );
-                
-                /* always increment source */
-                ++ p;
-#endif
-            }
-
-            /* want to reload buffer */
-            if ( src >= end )
-                break;
-
-            /* advance position */
-            pos += ( 8 - qbytes / 2 ) << 2;
-            if ( pos > stop )
-                break;
-
-            /* reload buffer */
-#if ENDLESS_BUFFER || qbytes == 2
-            buffer = prime_buffer_4na ( src, end );
-#elif qbytes == 16
-            assert ( 0 );
-#else
-            if ( p - src < 3 )
-                buffer = prime_buffer_4na ( src, end );
-            else for ( ; p - src < 8; ++ p )
-            {
-                buffer = _mm_srli_si128 ( buffer, 2 );
-                if ( p < end )
-                    buffer = _mm_insert_epi16 ( buffer, expand_2na [ * p ], 7 );
-            }
-#endif
-
-            /* adjust pointers */
-            src += 8;
-#if qbytes > 2
-            p = src;
-#endif
-        }
-    }
-
-#undef qbytes
-#undef _mm_cmpeq_epi
-#undef res_adj
-
-    return 0;
-}
-
-static
-int eval_4na_32 ( const NucStrFastaExpr *self,
-    const void *ncbi2na, unsigned int pos, unsigned int len )
-{
-#define qbytes 4
-#define _mm_cmpeq_epi( a, b ) \
-    _mm_cmpeq_epi32 ( a, b )
-#if NEVER_MATCH
-#define res_adj( res ) \
-    res = 0
-#else
-#define res_adj( res ) \
-    ( ( void ) 0 )
-#endif
-
-    /* SSE registers */
-    nucreg_t buffer, ri, rj;
-    nucreg_t p0, p1, p2, p3, m0, m1, m2, m3;
-
-    /* result registers */
-    int ra, rb, rc, rd;
-
-    /* used for shifting buffer, testing exit */
-    unsigned int num_passes, stop;
-
-#if qbytes > 2
-    const uint8_t *p;
-#endif
-    const uint8_t *end, *src;
-    unsigned int qlen = self -> size;
-
-    /* this test is performed outside */
-    assert ( len >= qlen );
-
-    /* the effective length of the sequence,
-       including leading bases we'll ignore */
-    len += pos;
-
-    /* convert source pointer */
-    src = ( const uint8_t* ) ncbi2na + ( pos >> 2 );
-
-    /* stop testing when position passes this point */
-    stop = len - qlen;
-
-    /* the sequence end pointer */
-    end = ( const uint8_t* ) ncbi2na + ( ( len + 3 ) >> 2 );
-
-    /* prime the buffer */
-    buffer = prime_buffer_4na ( src, end );
-    src += 8;
-#if qbytes > 2
-    p = src;
-#endif
-
-    /* prime the registers */
-    prime_registers ( self );
-
-    /* enter the loop at an appropriate offset */
-    ra = rb = rc = 0;
-#if qbytes == 16
-    num_passes = ( stop - pos + 7 ) >> 2;
-#elif qbytes == 1
-#error "4na requires at least 2 qbytes"
-#else
-    num_passes = qbytes / 2;
-#endif
-
-    /* for reporting - give a buffer alignment */
-    ALIGN_4NA_HEADER ( buffer, pos & ~ 3, len );
-    switch ( pos & 3 )
-    {
-    default:
-
-        /* outer loop - performs whole buffer loads */
-        while ( 1 )
-        {
-            num_passes = qbytes / 2;
-
-            /* inner loop - shifts in one byte at a time */
-            while ( 1 )
-            {
-                /* for reporting - give a buffer alignment */
-                ALIGN_4NA_HEADER ( buffer, pos, len );
-
-                /* perform comparisons */
-    case 0:
-                ri = _mm_and_si128 ( buffer, p0 );
-                rj = _mm_and_si128 ( buffer, m0 );
-                ri = _mm_cmpeq_epi ( ri, rj );
-                ra = _mm_movemask_epi8 ( ri );
-                res_adj ( ra );
-                ALIGN_4NA_RESULT ( buffer, p0, m0, ri, ra );
-    case 1:
-                ri = _mm_and_si128 ( buffer, p1 );
-                rj = _mm_and_si128 ( buffer, m1 );
-                ri = _mm_cmpeq_epi ( ri, rj );
-                rb = _mm_movemask_epi8 ( ri );
-                res_adj ( rb );
-                ALIGN_4NA_RESULT ( buffer, p1, m1, ri, rb );
-    case 2:
-                ri = _mm_and_si128 ( buffer, p2 );
-                rj = _mm_and_si128 ( buffer, m2 );
-                ri = _mm_cmpeq_epi ( ri, rj );
-                rc = _mm_movemask_epi8 ( ri );
-                res_adj ( rc );
-                ALIGN_4NA_RESULT ( buffer, p2, m2, ri, rc );
-    case 3:
-                ri = _mm_and_si128 ( buffer, p3 );
-                rj = _mm_and_si128 ( buffer, m3 );
-                ri = _mm_cmpeq_epi ( ri, rj );
-                rd = _mm_movemask_epi8 ( ri );
-                res_adj ( rd );
-                ALIGN_4NA_RESULT ( buffer, p3, m3, ri, rd );
-
-                /* adjust pos */
-                pos &= ~ 3;
-
-                /* test for any promising results */
-                if ( ( ra | rb | rc | rd ) != 0 )
-                {
-#if qbytes == 16
-                    switch ( stop - pos )
-                    {
-                    default:
-                        return 1;
-                    case 2:
-                        if ( rc != 0 ) return 1;
-                    case 1:
-                        if ( rb != 0 ) return 1;
-                    case 0:
-                        if ( ra != 0 ) return 1;
-                    }
-                    return 0;
-#else
-                    /* extract first non-zero bit from results
-                       where result is all zeros, bit will be -1 */
-                    int fa = uint16_lsbit ( ( uint16_t ) ra );
-                    int fb = uint16_lsbit ( ( uint16_t ) rb );
-                    int fc = uint16_lsbit ( ( uint16_t ) rc );
-                    int fd = uint16_lsbit ( ( uint16_t ) rd );
-
-                    /* convert bit number into number of bases
-                       from current position. undefined where
-                       bit is negative, but unimportant also */
-                    fa = ( fa << 1 ) + 0;
-                    fb = ( fb << 1 ) + 1;
-                    fc = ( fc << 1 ) + 2;
-                    fd = ( fd << 1 ) + 3;
-
-                    /* test for any case where result was non-zero
-                       and the resultant base index is within range */
-                    if ( ra != 0 && pos + fa <= stop ) return 1;
-                    if ( rb != 0 && pos + fb <= stop ) return 1;
-                    if ( rc != 0 && pos + fc <= stop ) return 1;
-                    if ( rd != 0 && pos + fd <= stop ) return 1;
-#endif
-                }
-
-                /* advance pos */
-                pos += 4;
-
-                /* if no further comparisons are possible */
-                if ( pos > stop )
-                    return 0;
-
-                /* if all shifting passes are complete */
-                if ( -- num_passes == 0 )
-                    break;
-
-#if qbytes > 2
-                /* shift buffer */
-                buffer = _mm_srli_si128 ( buffer, 2 );
-
-                /* bring in new byte */
-                if ( p < end )
-                    buffer = _mm_insert_epi16 ( buffer, expand_2na [ * p ], 7 );
-                
-                /* always increment source */
-                ++ p;
-#endif
-            }
-
-            /* want to reload buffer */
-            if ( src >= end )
-                break;
-
-            /* advance position */
-            pos += ( 8 - qbytes / 2 ) << 2;
-            if ( pos > stop )
-                break;
-
-            /* reload buffer */
-#if ENDLESS_BUFFER || qbytes == 2
-            buffer = prime_buffer_4na ( src, end );
-#elif qbytes == 16
-            assert ( 0 );
-#else
-            if ( p - src < 3 )
-                buffer = prime_buffer_4na ( src, end );
-            else for ( ; p - src < 8; ++ p )
-            {
-                buffer = _mm_srli_si128 ( buffer, 2 );
-                if ( p < end )
-                    buffer = _mm_insert_epi16 ( buffer, expand_2na [ * p ], 7 );
-            }
-#endif
-
-            /* adjust pointers */
-            src += 8;
-#if qbytes > 2
-            p = src;
-#endif
-        }
-    }
-
-#undef qbytes
-#undef _mm_cmpeq_epi
-#undef res_adj
-
-    return 0;
-}
-
-static
-int eval_4na_64 ( const NucStrFastaExpr *self,
-    const void *ncbi2na, unsigned int pos, unsigned int len )
-{
-#define qbytes 8
-#define _mm_cmpeq_epi( a, b ) \
-    _mm_cmpeq_epi32 ( a, b )
-#if NEVER_MATCH
-#define res_adj( res ) \
-    res = 0
-#else
-#define res_adj( res ) \
-    ( ( res ) &= ( ( res ) & 0x0F0F ) << 4, \
-      ( res ) |= ( res ) >> 4 )
-#endif
-
-    /* SSE registers */
-    nucreg_t buffer, ri, rj;
-    nucreg_t p0, p1, p2, p3, m0, m1, m2, m3;
-
-    /* result registers */
-    int ra, rb, rc, rd;
-
-    /* used for shifting buffer, testing exit */
-    unsigned int num_passes, stop;
-
-#if qbytes > 2
-    const uint8_t *p;
-#endif
-    const uint8_t *end, *src;
-    unsigned int qlen = self -> size;
-
-    /* this test is performed outside */
-    assert ( len >= qlen );
-
-    /* the effective length of the sequence,
-       including leading bases we'll ignore */
-    len += pos;
-
-    /* convert source pointer */
-    src = ( const uint8_t* ) ncbi2na + ( pos >> 2 );
-
-    /* stop testing when position passes this point */
-    stop = len - qlen;
-
-    /* the sequence end pointer */
-    end = ( const uint8_t* ) ncbi2na + ( ( len + 3 ) >> 2 );
-
-    /* prime the buffer */
-    buffer = prime_buffer_4na ( src, end );
-    src += 8;
-#if qbytes > 2
-    p = src;
-#endif
-
-    /* prime the registers */
-    prime_registers ( self );
-
-    /* enter the loop at an appropriate offset */
-    ra = rb = rc = 0;
-#if qbytes == 16
-    num_passes = ( stop - pos + 7 ) >> 2;
-#elif qbytes == 1
-#error "4na requires at least 2 qbytes"
-#else
-    num_passes = qbytes / 2;
-#endif
-
-    /* for reporting - give a buffer alignment */
-    ALIGN_4NA_HEADER ( buffer, pos & ~ 3, len );
-    switch ( pos & 3 )
-    {
-    default:
-
-        /* outer loop - performs whole buffer loads */
-        while ( 1 )
-        {
-            num_passes = qbytes / 2;
-
-            /* inner loop - shifts in one byte at a time */
-            while ( 1 )
-            {
-                /* for reporting - give a buffer alignment */
-                ALIGN_4NA_HEADER ( buffer, pos, len );
-
-                /* perform comparisons */
-    case 0:
-                ri = _mm_and_si128 ( buffer, p0 );
-                rj = _mm_and_si128 ( buffer, m0 );
-                ri = _mm_cmpeq_epi ( ri, rj );
-                ra = _mm_movemask_epi8 ( ri );
-                res_adj ( ra );
-                ALIGN_4NA_RESULT ( buffer, p0, m0, ri, ra );
-    case 1:
-                ri = _mm_and_si128 ( buffer, p1 );
-                rj = _mm_and_si128 ( buffer, m1 );
-                ri = _mm_cmpeq_epi ( ri, rj );
-                rb = _mm_movemask_epi8 ( ri );
-                res_adj ( rb );
-                ALIGN_4NA_RESULT ( buffer, p1, m1, ri, rb );
-    case 2:
-                ri = _mm_and_si128 ( buffer, p2 );
-                rj = _mm_and_si128 ( buffer, m2 );
-                ri = _mm_cmpeq_epi ( ri, rj );
-                rc = _mm_movemask_epi8 ( ri );
-                res_adj ( rc );
-                ALIGN_4NA_RESULT ( buffer, p2, m2, ri, rc );
-    case 3:
-                ri = _mm_and_si128 ( buffer, p3 );
-                rj = _mm_and_si128 ( buffer, m3 );
-                ri = _mm_cmpeq_epi ( ri, rj );
-                rd = _mm_movemask_epi8 ( ri );
-                res_adj ( rd );
-                ALIGN_4NA_RESULT ( buffer, p3, m3, ri, rd );
-
-                /* adjust pos */
-                pos &= ~ 3;
-
-                /* test for any promising results */
-                if ( ( ra | rb | rc | rd ) != 0 )
-                {
-#if qbytes == 16
-                    switch ( stop - pos )
-                    {
-                    default:
-                        return 1;
-                    case 2:
-                        if ( rc != 0 ) return 1;
-                    case 1:
-                        if ( rb != 0 ) return 1;
-                    case 0:
-                        if ( ra != 0 ) return 1;
-                    }
-                    return 0;
-#else
-                    /* extract first non-zero bit from results
-                       where result is all zeros, bit will be -1 */
-                    int fa = uint16_lsbit ( ( uint16_t ) ra );
-                    int fb = uint16_lsbit ( ( uint16_t ) rb );
-                    int fc = uint16_lsbit ( ( uint16_t ) rc );
-                    int fd = uint16_lsbit ( ( uint16_t ) rd );
-
-                    /* convert bit number into number of bases
-                       from current position. undefined where
-                       bit is negative, but unimportant also */
-                    fa = ( fa << 1 ) + 0;
-                    fb = ( fb << 1 ) + 1;
-                    fc = ( fc << 1 ) + 2;
-                    fd = ( fd << 1 ) + 3;
-
-                    /* test for any case where result was non-zero
-                       and the resultant base index is within range */
-                    if ( ra != 0 && pos + fa <= stop ) return 1;
-                    if ( rb != 0 && pos + fb <= stop ) return 1;
-                    if ( rc != 0 && pos + fc <= stop ) return 1;
-                    if ( rd != 0 && pos + fd <= stop ) return 1;
-#endif
-                }
-
-                /* advance pos */
-                pos += 4;
-
-                /* if no further comparisons are possible */
-                if ( pos > stop )
-                    return 0;
-
-                /* if all shifting passes are complete */
-                if ( -- num_passes == 0 )
-                    break;
-
-#if qbytes > 2
-                /* shift buffer */
-                buffer = _mm_srli_si128 ( buffer, 2 );
-
-                /* bring in new byte */
-                if ( p < end )
-                    buffer = _mm_insert_epi16 ( buffer, expand_2na [ * p ], 7 );
-                
-                /* always increment source */
-                ++ p;
-#endif
-            }
-
-            /* want to reload buffer */
-            if ( src >= end )
-                break;
-
-            /* advance position */
-            pos += ( 8 - qbytes / 2 ) << 2;
-            if ( pos > stop )
-                break;
-
-            /* reload buffer */
-#if ENDLESS_BUFFER || qbytes == 2
-            buffer = prime_buffer_4na ( src, end );
-#elif qbytes == 16
-            assert ( 0 );
-#else
-            if ( p - src < 3 )
-                buffer = prime_buffer_4na ( src, end );
-            else for ( ; p - src < 8; ++ p )
-            {
-                buffer = _mm_srli_si128 ( buffer, 2 );
-                if ( p < end )
-                    buffer = _mm_insert_epi16 ( buffer, expand_2na [ * p ], 7 );
-            }
-#endif
-
-            /* adjust pointers */
-            src += 8;
-#if qbytes > 2
-            p = src;
-#endif
-        }
-    }
-
-#undef qbytes
-#undef _mm_cmpeq_epi
-#undef res_adj
-
-    return 0;
-}
-
-static
-int eval_4na_128 ( const NucStrFastaExpr *self,
-    const void *ncbi2na, unsigned int pos, unsigned int len )
-{
-#define qbytes 16
-#define _mm_cmpeq_epi( a, b ) \
-    _mm_cmpeq_epi32 ( a, b )
-#if NEVER_MATCH
-#define res_adj( res ) \
-    res = 0
-#else
-#define res_adj( res ) \
-    ( ( res ) = - ( ( ( res ) + 1 ) >> 16 ) )
-#endif
-
-    /* SSE registers */
-    nucreg_t buffer, ri, rj;
-    nucreg_t p0, p1, p2, p3, m0, m1, m2, m3;
-
-    /* result registers */
-    int ra, rb, rc, rd;
-
-    /* used for shifting buffer, testing exit */
-    unsigned int num_passes, stop;
-
-#if qbytes > 2
-    const uint8_t *p;
-#endif
-    const uint8_t *end, *src;
-    unsigned int qlen = self -> size;
-
-    /* this test is performed outside */
-    assert ( len >= qlen );
-
-    /* the effective length of the sequence,
-       including leading bases we'll ignore */
-    len += pos;
-
-    /* convert source pointer */
-    src = ( const uint8_t* ) ncbi2na + ( pos >> 2 );
-
-    /* stop testing when position passes this point */
-    stop = len - qlen;
-
-    /* the sequence end pointer */
-    end = ( const uint8_t* ) ncbi2na + ( ( len + 3 ) >> 2 );
-
-    /* prime the buffer */
-    buffer = prime_buffer_4na ( src, end );
-    src += 8;
-#if qbytes > 2
-    p = src;
-#endif
-
-    /* prime the registers */
-    prime_registers ( self );
-
-    /* enter the loop at an appropriate offset */
-    ra = rb = rc = 0;
-#if qbytes == 16
-    num_passes = ( stop - pos + 7 ) >> 2;
-#elif qbytes == 1
-#error "4na requires at least 2 qbytes"
-#else
-    num_passes = qbytes / 2;
-#endif
-
-    /* for reporting - give a buffer alignment */
-    ALIGN_4NA_HEADER ( buffer, pos & ~ 3, len );
-    switch ( pos & 3 )
-    {
-    default:
-
-        /* outer loop - performs whole buffer loads */
-        while ( 1 )
-        {
-            num_passes = qbytes / 2;
-
-            /* inner loop - shifts in one byte at a time */
-            while ( 1 )
-            {
-                /* for reporting - give a buffer alignment */
-                ALIGN_4NA_HEADER ( buffer, pos, len );
-
-                /* perform comparisons */
-    case 0:
-                ri = _mm_and_si128 ( buffer, p0 );
-                rj = _mm_and_si128 ( buffer, m0 );
-                ri = _mm_cmpeq_epi ( ri, rj );
-                ra = _mm_movemask_epi8 ( ri );
-                res_adj ( ra );
-                ALIGN_4NA_RESULT ( buffer, p0, m0, ri, ra );
-    case 1:
-                ri = _mm_and_si128 ( buffer, p1 );
-                rj = _mm_and_si128 ( buffer, m1 );
-                ri = _mm_cmpeq_epi ( ri, rj );
-                rb = _mm_movemask_epi8 ( ri );
-                res_adj ( rb );
-                ALIGN_4NA_RESULT ( buffer, p1, m1, ri, rb );
-    case 2:
-                ri = _mm_and_si128 ( buffer, p2 );
-                rj = _mm_and_si128 ( buffer, m2 );
-                ri = _mm_cmpeq_epi ( ri, rj );
-                rc = _mm_movemask_epi8 ( ri );
-                res_adj ( rc );
-                ALIGN_4NA_RESULT ( buffer, p2, m2, ri, rc );
-    case 3:
-                ri = _mm_and_si128 ( buffer, p3 );
-                rj = _mm_and_si128 ( buffer, m3 );
-                ri = _mm_cmpeq_epi ( ri, rj );
-                rd = _mm_movemask_epi8 ( ri );
-                res_adj ( rd );
-                ALIGN_4NA_RESULT ( buffer, p3, m3, ri, rd );
-
-                /* adjust pos */
-                pos &= ~ 3;
-
-                /* test for any promising results */
-                if ( ( ra | rb | rc | rd ) != 0 )
-                {
-#if qbytes == 16
-                    switch ( stop - pos )
-                    {
-                    default:
-                        return 1;
-                    case 2:
-                        if ( rc != 0 ) return 1;
-                    case 1:
-                        if ( rb != 0 ) return 1;
-                    case 0:
-                        if ( ra != 0 ) return 1;
-                    }
-                    return 0;
-#else
-                    /* extract first non-zero bit from results
-                       where result is all zeros, bit will be -1 */
-                    int fa = uint16_lsbit ( ( uint16_t ) ra );
-                    int fb = uint16_lsbit ( ( uint16_t ) rb );
-                    int fc = uint16_lsbit ( ( uint16_t ) rc );
-                    int fd = uint16_lsbit ( ( uint16_t ) rd );
-
-                    /* convert bit number into number of bases
-                       from current position. undefined where
-                       bit is negative, but unimportant also */
-                    fa = ( fa << 1 ) + 0;
-                    fb = ( fb << 1 ) + 1;
-                    fc = ( fc << 1 ) + 2;
-                    fd = ( fd << 1 ) + 3;
-
-                    /* test for any case where result was non-zero
-                       and the resultant base index is within range */
-                    if ( ra != 0 && pos + fa <= stop ) return 1;
-                    if ( rb != 0 && pos + fb <= stop ) return 1;
-                    if ( rc != 0 && pos + fc <= stop ) return 1;
-                    if ( rd != 0 && pos + fd <= stop ) return 1;
-#endif
-                }
-
-                /* advance pos */
-                pos += 4;
-
-                /* if no further comparisons are possible */
-                if ( pos > stop )
-                    return 0;
-
-                /* if all shifting passes are complete */
-                if ( -- num_passes == 0 )
-                    break;
-
-#if qbytes > 2
-                /* shift buffer */
-                buffer = _mm_srli_si128 ( buffer, 2 );
-
-                /* bring in new byte */
-                if ( p < end )
-                    buffer = _mm_insert_epi16 ( buffer, expand_2na [ * p ], 7 );
-                
-                /* always increment source */
-                ++ p;
-#endif
-            }
-
-            /* want to reload buffer */
-            if ( src >= end )
-                break;
-
-            /* advance position */
-            pos += ( 8 - qbytes / 2 ) << 2;
-            if ( pos > stop )
-                break;
-
-            /* reload buffer */
-#if ENDLESS_BUFFER || qbytes == 2
-            buffer = prime_buffer_4na ( src, end );
-#elif qbytes == 16
-            assert ( 0 );
-#else
-            if ( p - src < 3 )
-                buffer = prime_buffer_4na ( src, end );
-            else for ( ; p - src < 8; ++ p )
-            {
-                buffer = _mm_srli_si128 ( buffer, 2 );
-                if ( p < end )
-                    buffer = _mm_insert_epi16 ( buffer, expand_2na [ * p ], 7 );
-            }
-#endif
-
-            /* adjust pointers */
-            src += 8;
-#if qbytes > 2
-            p = src;
-#endif
-        }
-    }
-
-#undef qbytes
-#undef _mm_cmpeq_epi
-#undef res_adj
-
-    return 0;
-}
-
-static
-int eval_4na_pos ( const NucStrFastaExpr *self,
-    const void *ncbi2na, unsigned int pos, unsigned int len )
-{
-#define positional 1
-#define qbytes 16
-#define _mm_cmpeq_epi( a, b ) \
-    _mm_cmpeq_epi32 ( a, b )
-#if NEVER_MATCH
-#define res_adj( res ) \
-    res = 0
-#else
-#define res_adj( res ) \
-    ( ( res ) = - ( ( ( res ) + 1 ) >> 16 ) )
-#endif
-
-    /* SSE registers */
-    nucreg_t buffer, ri, rj;
-    nucreg_t p0, p1, p2, p3, m0, m1, m2, m3;
-
-    /* result registers */
-    int ra, rb, rc, rd;
-
-    /* used for shifting buffer, testing exit */
-    unsigned int num_passes, stop;
-
-    /* used to hold entry position */
-#if positional
-    unsigned int start;
-#endif
-
-#if qbytes > 2
-    const uint8_t *p;
-#endif
-    const uint8_t *end, *src;
-    unsigned int qlen = self -> size;
-
-    /* this test is performed outside */
-    assert ( len >= qlen );
-
-    /* the effective length of the sequence,
-       including leading bases we'll ignore */
-    len += pos;
-
-    /* hold starting position */
-#if positional
-    start = pos;
-#endif
-
-    /* convert source pointer */
-    src = ( const uint8_t* ) ncbi2na + ( pos >> 2 );
-
-    /* stop testing when position passes this point */
-    stop = len - qlen;
-
-    /* the sequence end pointer */
-    end = ( const uint8_t* ) ncbi2na + ( ( len + 3 ) >> 2 );
-
-    /* prime the buffer */
-    buffer = prime_buffer_4na ( src, end );
-    src += 8;
-#if qbytes > 2
-    p = src;
-#endif
-
-    /* prime the registers */
-    prime_registers ( self );
-
-    /* enter the loop at an appropriate offset */
-    ra = rb = rc = 0;
-#if qbytes == 16
-    num_passes = ( stop - pos + 7 ) >> 2;
-#elif qbytes == 1
-#error "4na requires at least 2 qbytes"
-#else
-    num_passes = qbytes / 2;
-#endif
-
-    /* for reporting - give a buffer alignment */
-    ALIGN_4NA_HEADER ( buffer, pos & ~ 3, len );
-    switch ( pos & 3 )
-    {
-    default:
-
-        /* outer loop - performs whole buffer loads */
-        while ( 1 )
-        {
-            num_passes = qbytes / 2;
-
-            /* inner loop - shifts in one byte at a time */
-            while ( 1 )
-            {
-                /* for reporting - give a buffer alignment */
-                ALIGN_4NA_HEADER ( buffer, pos, len );
-
-                /* perform comparisons */
-    case 0:
-                ri = _mm_and_si128 ( buffer, p0 );
-                rj = _mm_and_si128 ( buffer, m0 );
-                ri = _mm_cmpeq_epi ( ri, rj );
-                ra = _mm_movemask_epi8 ( ri );
-                res_adj ( ra );
-                ALIGN_4NA_RESULT ( buffer, p0, m0, ri, ra );
-    case 1:
-                ri = _mm_and_si128 ( buffer, p1 );
-                rj = _mm_and_si128 ( buffer, m1 );
-                ri = _mm_cmpeq_epi ( ri, rj );
-                rb = _mm_movemask_epi8 ( ri );
-                res_adj ( rb );
-                ALIGN_4NA_RESULT ( buffer, p1, m1, ri, rb );
-    case 2:
-                ri = _mm_and_si128 ( buffer, p2 );
-                rj = _mm_and_si128 ( buffer, m2 );
-                ri = _mm_cmpeq_epi ( ri, rj );
-                rc = _mm_movemask_epi8 ( ri );
-                res_adj ( rc );
-                ALIGN_4NA_RESULT ( buffer, p2, m2, ri, rc );
-    case 3:
-                ri = _mm_and_si128 ( buffer, p3 );
-                rj = _mm_and_si128 ( buffer, m3 );
-                ri = _mm_cmpeq_epi ( ri, rj );
-                rd = _mm_movemask_epi8 ( ri );
-                res_adj ( rd );
-                ALIGN_4NA_RESULT ( buffer, p3, m3, ri, rd );
-
-                /* adjust pos */
-                pos &= ~ 3;
-
-                /* test for any promising results */
-                if ( ( ra | rb | rc | rd ) != 0 )
-                {
-#if positional
-                    switch ( stop - pos )
-                    {
-                    case 0:
-                        if ( ra != 0 ) return pos - start + 1;
-                        break;
-                    case 1:
-                        if ( ra != 0 ) return pos - start + 1;
-                        if ( rb != 0 ) return pos - start + 2;
-                        break;
-                    case 2:
-                        if ( ra != 0 ) return pos - start + 1;
-                        if ( rb != 0 ) return pos - start + 2;
-                        if ( rc != 0 ) return pos - start + 3;
-                        break;
-                    default:
-                        if ( ra != 0 ) return pos - start + 1;
-                        if ( rb != 0 ) return pos - start + 2;
-                        if ( rc != 0 ) return pos - start + 3;
-                        if ( rd != 0 ) return pos - start + 4;
-                    }
-                    return 0;
-#elif qbytes == 16
-                    switch ( stop - pos )
-                    {
-                    default:
-                        return 1;
-                    case 2:
-                        if ( rc != 0 ) return 1;
-                    case 1:
-                        if ( rb != 0 ) return 1;
-                    case 0:
-                        if ( ra != 0 ) return 1;
-                    }
-                    return 0;
-#else
-                    /* extract first non-zero bit from results
-                       where result is all zeros, bit will be -1 */
-                    int fa = uint16_lsbit ( ( uint16_t ) ra );
-                    int fb = uint16_lsbit ( ( uint16_t ) rb );
-                    int fc = uint16_lsbit ( ( uint16_t ) rc );
-                    int fd = uint16_lsbit ( ( uint16_t ) rd );
-
-                    /* convert bit number into number of bases
-                       from current position. undefined where
-                       bit is negative, but unimportant also */
-                    fa = ( fa << 1 ) + 0;
-                    fb = ( fb << 1 ) + 1;
-                    fc = ( fc << 1 ) + 2;
-                    fd = ( fd << 1 ) + 3;
-
-                    /* test for any case where result was non-zero
-                       and the resultant base index is within range */
-                    if ( ra != 0 && pos + fa <= stop ) return 1;
-                    if ( rb != 0 && pos + fb <= stop ) return 1;
-                    if ( rc != 0 && pos + fc <= stop ) return 1;
-                    if ( rd != 0 && pos + fd <= stop ) return 1;
-#endif
-                }
-
-                /* advance pos */
-                pos += 4;
-
-                /* if no further comparisons are possible */
-                if ( pos > stop )
-                    return 0;
-
-                /* if all shifting passes are complete */
-                if ( -- num_passes == 0 )
-                    break;
-
-#if qbytes > 2
-                /* shift buffer */
-                buffer = _mm_srli_si128 ( buffer, 2 );
-
-                /* bring in new byte */
-                if ( p < end )
-                    buffer = _mm_insert_epi16 ( buffer, expand_2na [ * p ], 7 );
-                
-                /* always increment source */
-                ++ p;
-#endif
-            }
-
-            /* want to reload buffer */
-            if ( src >= end )
-                break;
-
-            /* advance position */
-            pos += ( 8 - qbytes / 2 ) << 2;
-            if ( pos > stop )
-                break;
-
-            /* reload buffer */
-#if ENDLESS_BUFFER || qbytes == 2
-            buffer = prime_buffer_4na ( src, end );
-#elif qbytes == 16
-            assert ( 0 );
-#else
-            if ( p - src < 3 )
-                buffer = prime_buffer_4na ( src, end );
-            else for ( ; p - src < 8; ++ p )
-            {
-                buffer = _mm_srli_si128 ( buffer, 2 );
-                if ( p < end )
-                    buffer = _mm_insert_epi16 ( buffer, expand_2na [ * p ], 7 );
-            }
-#endif
-
-            /* adjust pointers */
-            src += 8;
-#if qbytes > 2
-            p = src;
-#endif
-        }
-    }
-
-#undef positional
-#undef qbytes
-#undef _mm_cmpeq_epi
-#undef res_adj
-
-    return 0;
-}
-#endif /* INTEL_INTRINSICS */
-
-
-/* NucStrstrSearch
- *  search buffer from starting position
- *
- *  "ncbi2na" [ IN ] - pointer to 2na data
- *
- *  "pos" [ IN ] - starting base position for search,
- *  relative to "ncbi2na". may be >= 4.
- *
- *  "len" [ IN ] - the number of bases to include in
- *  the search, relative to "pos".
- *
- *  return values:
- *    ! 0 if the pattern was found
- */
-LIB_EXPORT int CC NucStrstrSearch ( const NucStrstr *self,
-    const void *ncbi2na, unsigned int pos, unsigned int len , unsigned int * selflen )
-{
-    if ( self != NULL && ncbi2na != NULL && len != 0 )
-    {
-        int found;
-        unsigned int fasta_len;
-
-        switch ( self -> fasta . type )
-        {
-        case type_2na_64:
-            if ( len < self -> fasta . size ) return 0;
-	    if(selflen) *selflen=self -> fasta . size;
-            return eval_2na_64 ( & self -> fasta, ncbi2na, pos, len );
-        case type_4na_64:
-            if ( len < self -> fasta . size ) return 0;
-	    if(selflen) *selflen=self -> fasta . size;
-            return eval_4na_64 ( & self -> fasta, ncbi2na, pos, len );
-#if INTEL_INTRINSICS
-        case type_2na_8:
-            if ( len < self -> fasta . size ) return 0;
-	    if(selflen) *selflen=self -> fasta . size;
-            return eval_2na_8 ( & self -> fasta, ncbi2na, pos, len );
-        case type_2na_16:
-            if ( len < self -> fasta . size ) return 0;
-	    if(selflen) *selflen=self -> fasta . size;
-            return eval_2na_16 ( & self -> fasta, ncbi2na, pos, len );
-        case type_2na_32:
-            if ( len < self -> fasta . size ) return 0;
-	    if(selflen) *selflen=self -> fasta . size;
-            return eval_2na_32 ( & self -> fasta, ncbi2na, pos, len );
-        case type_2na_128:
-            if ( len < self -> fasta . size ) return 0;
-	    if(selflen) *selflen=self -> fasta . size;
-            return eval_2na_128 ( & self -> fasta, ncbi2na, pos, len );
-        case type_4na_16:
-            if ( len < self -> fasta . size ) return 0;
-	    if(selflen) *selflen=self -> fasta . size;
-            return eval_4na_16 ( & self -> fasta, ncbi2na, pos, len );
-        case type_4na_32:
-            if ( len < self -> fasta . size ) return 0;
-	    if(selflen) *selflen=self -> fasta . size;
-            return eval_4na_32 ( & self -> fasta, ncbi2na, pos, len );
-        case type_4na_128:
-            if ( len < self -> fasta . size ) return 0;
-	    if(selflen) *selflen=self -> fasta . size;
-            return eval_4na_128 ( & self -> fasta, ncbi2na, pos, len );
-#endif
-        case type_2na_pos:
-            if ( len < self -> fasta . size ) return 0;
-	    if(selflen) *selflen=self -> fasta . size;
-            return eval_2na_pos ( & self -> fasta, ncbi2na, pos, len );
-        case type_4na_pos:
-            if ( len < self -> fasta . size ) return 0;
-	    if(selflen) *selflen=self -> fasta . size;
-            return eval_4na_pos ( & self -> fasta, ncbi2na, pos, len );
-        case type_OP:
-            found = NucStrstrSearch ( self -> boolean . left, ncbi2na, pos, len, selflen);
-            switch ( self -> boolean . op )
-            {
-            case op_OR:
-                if ( found != 0 )
-                    return found;
-                break;
-            case op_AND:
-                if ( found == 0 )
-                    return found;
-                break;
-            }
-            return NucStrstrSearch ( self -> boolean . right, ncbi2na, pos, len, selflen);
-        case type_EXPR:
-            switch ( self -> sub . op )
-            {
-            case 0:
-            case op_NOT:
-                found = NucStrstrSearch ( self -> sub . expr, ncbi2na, pos, len, selflen);
-                if ( self -> sub . op == 0 )
-                    return found;
-                if ( found == 0 )
-                    return 1;
-                break;
-            case op_HEAD:
-                fasta_len = self -> sub . expr -> fasta . size;
-                if ( fasta_len > len )
-                    return 0;
-                return NucStrstrSearch ( self -> sub . expr, ncbi2na, pos, fasta_len, selflen );
-            case op_TAIL:
-                fasta_len = self -> sub . expr -> fasta . size;
-                if ( fasta_len > len )
-                    return 0;
-                return NucStrstrSearch ( self -> sub . expr, ncbi2na,
-                    pos + len - fasta_len, fasta_len, selflen );
-            }
-            break;
-        }
-    }
-    return 0;
-}
diff --git a/libs/search/search-priv.h b/libs/search/search-priv.h
deleted file mode 100644
index b1a7dc8..0000000
--- a/libs/search/search-priv.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_search_priv_
-#define _h_search_priv_
-
-#include <search/grep.h>
-#include <arch-impl.h>
-#include <klib/rc.h>
-#include <os-native.h>
-#include <compiler.h>
-
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct FgrepDumbParams FgrepDumbParams;
-typedef struct FgrepBoyerParams FgrepBoyerParams;
-typedef struct FgrepAhoParams FgrepAhoParams;
-typedef struct AgrepWuParams AgrepWuParams;
-typedef struct DPParams DPParams;
-typedef struct MyersSearch MyersSearch;
-typedef struct MyersUnlimitedSearch MyersUnlimitedSearch;
-
-void FgrepDumbSearchMake(FgrepDumbParams **self, const char *strings[], uint32_t numstrings);
-void FgrepDumbSearchFree(FgrepDumbParams *self);
-
-void FgrepBoyerSearchMake(FgrepBoyerParams **self, const char *strings[], uint32_t numstrings);
-void FgrepBoyerSearchFree(FgrepBoyerParams *self);
-
-void FgrepAhoMake(FgrepAhoParams **self, const char *strings[], uint32_t numstrings);
-void FgrepAhoFree(FgrepAhoParams *self);
-
-uint32_t FgrepDumbFindFirst(FgrepDumbParams *self, const char *buf, size_t len, FgrepMatch *match);
-uint32_t FgrepBoyerFindFirst( FgrepBoyerParams *self, const char *buf, size_t len, FgrepMatch *match);
-uint32_t FgrepAhoFindFirst( FgrepAhoParams *self, const char *buf, size_t len, FgrepMatch *match);
-
-void AgrepWuFree(AgrepWuParams *self);
-void MyersUnlimitedFree(MyersUnlimitedSearch *self);
-void AgrepDPFree(DPParams *self);
-void AgrepMyersFree(MyersSearch *self);
-
-uint32_t MyersUnlimitedFindFirst(MyersUnlimitedSearch *self, int32_t threshold, const char* text, size_t n, AgrepMatch *match);
-uint32_t MyersFindFirst(MyersSearch *self, int32_t threshold, 
-                   const char* text, size_t n,
-                       AgrepMatch *match);
-uint32_t AgrepWuFindFirst(const AgrepWuParams *self, int32_t threshold, const char *buf, int32_t buflen, AgrepMatch *match);
-uint32_t AgrepDPFindFirst(const DPParams *self, int32_t threshold, AgrepFlags mode, const char *buf, int32_t buflen, AgrepMatch *match);
-
-void AgrepDPFindAll(const AgrepCallArgs *args);
-void MyersFindAll(const AgrepCallArgs *args);
-void MyersUnlimitedFindAll(const AgrepCallArgs *args);
-void AgrepWuFindAll(const AgrepCallArgs *args);
-int32_t FgrepAhoFindAll(FgrepAhoParams *self, char *buf, int32_t len, int32_t *whichpattern);
-void FgrepBoyerFindAll(FgrepBoyerParams *self, char *buf, int32_t len, FgrepMatchCallback cb, void *cbinfo);
-void FgrepDumbFindAll(FgrepDumbParams *self, char *buf, int32_t len, 
-                      FgrepMatchCallback cb, void *cbinfo);
-
-
-rc_t AgrepDPMake(DPParams **self, AgrepFlags mode, const char *pattern);
-rc_t AgrepMyersMake(MyersSearch **self, AgrepFlags mode, const char *pattern);
-rc_t MyersUnlimitedMake(MyersUnlimitedSearch **self, AgrepFlags mode, const char *pattern);
-rc_t AgrepWuMake(AgrepWuParams **self, AgrepFlags mode, const char *pattern);
-
-
-struct Fgrep {
-    struct FgrepDumbParams *dumb;
-    struct FgrepBoyerParams *boyer;
-    struct FgrepAhoParams *aho;
-    FgrepFlags mode;
-};
-
-typedef struct Fgrep FgrepParams;
-
-/* 
-We actually need to have multiple (non-union) for Myers and DP parameters,
-since the myers code uses the DP parameters.
-Some of the others could be unioned.
-*/
-struct Agrep
-{
-    struct AgrepWuParams *wu;
-    struct MyersSearch *myers;
-    struct MyersUnlimitedSearch *myersunltd;
-    struct DPParams *dp;
-    AgrepFlags mode;
-};
-
-typedef struct Agrep AgrepParams;
-
-extern const unsigned char* IUPAC_decode[256];
-rc_t na4_set_bits(const AgrepFlags mode, uint64_t* arr, const unsigned char c, const uint64_t val);
-
-/* Internal definitions */
-
-rc_t CC dp_end_callback( const void *cbinfo, const AgrepMatch *match, AgrepContinueFlag *flag );
-
-static __inline__
-char *create_substring ( const char *src, uint32_t sz )
-{
-    char *ret = (char*)malloc( sz + 1 );
-    strncpy ( ret, src, sz );
-    ret [ sz ] = 0;
-    return ret;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_search_priv_ */
diff --git a/libs/search/search.c b/libs/search/search.c
deleted file mode 100644
index 4f6661f..0000000
--- a/libs/search/search.c
+++ /dev/null
@@ -1,285 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <search/extern.h>
-#include <sysalloc.h>
-#include "search-priv.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-const unsigned char * IUPAC_decode [ 256 ];
-
-static
-void IUPAC_init ( void )
-{
-    static bool initialized;
-    if ( ! initialized )
-    {
-        const char ** t = ( const char** ) IUPAC_decode;
-
-        t['A'] = t['a'] = "Aa";
-        t['C'] = t['c'] = "Cc";
-        t['G'] = t['g'] = "Gg";
-        t['T'] = t['t'] = "Tt";
-        t['U'] = t['u'] = "Uu";
-        t['M'] = t['m'] = "AaCc";
-        t['R'] = t['r'] = "AaGg";
-        t['S'] = t['s'] = "CcGg";
-        t['V'] = t['v'] = "AaCcGg";
-        t['W'] = t['w'] = "AaTtUu";
-        t['Y'] = t['y'] = "CcTtUu";
-        t['K'] = t['k'] = "GgTtUu";
-        t['B'] = t['b'] = "CcGgTtUu";
-        t['D'] = t['d'] = "AaGgTtUu";
-        t['H'] = t['h'] = "AaCcTtUu";
-        t['N'] = t['n'] = t [ '.' ] = "AaCcGgTtUuNn.-";
-        initialized = true;
-    }
-}
-
-rc_t na4_set_bits(const AgrepFlags mode, uint64_t* arr, const unsigned char c, const uint64_t val)
-{
-    if( mode & AGREP_PATTERN_4NA ) {
-        const unsigned char* tr;
-        tr = IUPAC_decode[c];
-        if( tr == NULL ) {
-            if( (mode & AGREP_ANYTHING_ELSE_IS_N) && (c == '.' || c == '-') ) {
-                tr = IUPAC_decode['N'];
-            }
-            if( tr == NULL ) {
-                return RC(rcText, rcString, rcSearching, rcConstraint, rcOutofrange);
-            }
-        }
-        while( *tr != '\0' ) {
-            if( mode & AGREP_TEXT_EXPANDED_2NA ) {
-                switch(*tr) {
-                    case 'A':
-                        arr[0] |= val;
-                        break;
-                    case 'C':
-                        arr[1] |= val;
-                        break;
-                    case 'G':
-                        arr[2] |= val;
-                        break;
-                    case 'T':
-                    case 'U':
-                        arr[3] |= val;
-                        break;
-                    case 'N':
-                        arr[4] |= val;
-                        break;
-                }
-            }
-            arr[*tr++] |= val;
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT void CC FgrepFree( FgrepParams *self )
-{
-    if (self->dumb != NULL)
-        FgrepDumbSearchFree(self->dumb);
-    if (self->boyer != NULL)
-        FgrepBoyerSearchFree(self->boyer);
-    if (self->aho != NULL)
-        FgrepAhoFree(self->aho);
-    free(self);
-}
-
-
-LIB_EXPORT rc_t CC FgrepMake( FgrepParams **self, FgrepFlags mode, const char *strings[], uint32_t numstrings )
-{
-    *self = malloc(sizeof(FgrepParams));
-    memset(*self, 0, sizeof(FgrepParams));
-    (*self)->mode = mode;
-    if (mode & FGREP_ALG_DUMB) {
-        FgrepDumbSearchMake(&(*self)->dumb, strings, numstrings);
-    }
-    if (mode & FGREP_ALG_BOYERMOORE) {
-        FgrepBoyerSearchMake(&(*self)->boyer, strings, numstrings);
-    }
-    if (mode & FGREP_ALG_AHOCORASICK) {
-        FgrepAhoMake(&(*self)->aho, strings, numstrings);
-    }
-    return 0;
-}
-
-LIB_EXPORT uint32_t CC FgrepFindFirst( const FgrepParams *self, const char *buf, size_t len, FgrepMatch *match )
-{
-    if (self->mode & FGREP_ALG_DUMB) {
-        return FgrepDumbFindFirst(self->dumb, buf, len, match);
-    }
-    if (self->mode & FGREP_ALG_BOYERMOORE) {
-        return FgrepBoyerFindFirst(self->boyer, buf, len, match);
-    }
-    if (self->mode & FGREP_ALG_AHOCORASICK) {
-        return FgrepAhoFindFirst(self->aho, buf, len, match);
-    }
-    /* Should maybe return error code, not 1/0 */
-    return 0;
-}
-
-LIB_EXPORT rc_t CC AgrepMake( AgrepParams **self, AgrepFlags mode, const char *pattern )
-{
-    rc_t rc = 0;
-
-    if( self == NULL || pattern == NULL ) {
-        rc = RC(rcText, rcString, rcSearching, rcParam, rcNull);
-    } else if( (*self = malloc(sizeof(AgrepParams))) == NULL ) {
-        rc = RC(rcText, rcString, rcSearching, rcMemory, rcExhausted);
-    } else {
-        memset((*self), 0, sizeof(**self));
-        (*self)->mode = mode;
-        if( mode & AGREP_PATTERN_4NA ) {
-            size_t i, l = strlen(pattern);
-            IUPAC_init();
-            if( l == 0 ) {
-                rc = RC(rcText, rcString, rcSearching, rcParam, rcOutofrange);
-            }
-            for(i = 0; rc == 0 && i < l; i++) {
-                if( IUPAC_decode[(signed char)(pattern[i])] == NULL ) {
-                    rc = RC(rcText, rcString, rcSearching, rcParam, rcOutofrange);
-                }
-            }
-        } else if( !(mode & AGREP_MODE_ASCII) ) {
-            rc = RC(rcText, rcString, rcSearching, rcParam, rcUnsupported);
-        }
-        if( rc == 0 ) {
-            if(mode & AGREP_ALG_WUMANBER) {
-                if( (rc = AgrepWuMake(&(*self)->wu, mode, pattern)) == 0 ) {
-                    rc = AgrepDPMake(&(*self)->dp, mode, pattern);
-                }
-            } else if(mode & AGREP_ALG_MYERS) {
-                if( (rc = AgrepMyersMake(&(*self)->myers, mode, pattern)) == 0 ) {
-                    rc = AgrepDPMake(&(*self)->dp, mode, pattern);
-                }
-            } else if(mode & AGREP_ALG_MYERS_UNLTD) {
-                if( (rc = MyersUnlimitedMake(&(*self)->myersunltd, mode, pattern)) == 0 ) {
-                    rc = AgrepDPMake(&(*self)->dp, mode, pattern);
-                }
-            } else if(mode & AGREP_ALG_DP) {
-                rc = AgrepDPMake(&(*self)->dp, mode, pattern);
-            } else {
-                rc = RC(rcText, rcString, rcSearching, rcParam, rcInvalid);
-            }
-        }
-    }
-    if( rc != 0 ) {
-        AgrepWhack(*self);
-    }
-    return rc;
-}
-
-LIB_EXPORT void CC AgrepWhack( AgrepParams *self )
-{
-    if( self != NULL ) {
-        if( self->wu ) {
-            AgrepWuFree(self->wu);
-        }
-        if( self->myers ) {
-            AgrepMyersFree(self->myers);
-        }
-        if( self->myersunltd ) {
-            MyersUnlimitedFree(self->myersunltd);
-        }
-        if( self->dp ) {
-            AgrepDPFree(self->dp);
-        }
-        free(self);
-    }
-}
-
-LIB_EXPORT void CC AgrepFindAll( const AgrepCallArgs *args )
-{
-    if( args != NULL ) {
-        const AgrepParams *self = args->self;
-
-        if(self->mode & AGREP_ALG_WUMANBER) {
-            AgrepWuFindAll(args);
-        } else if(self->mode & AGREP_ALG_MYERS) {
-            MyersFindAll(args);
-        } else if(self->mode & AGREP_ALG_MYERS_UNLTD) {
-            MyersUnlimitedFindAll(args);
-        } else if (self->mode & AGREP_ALG_DP) {
-            AgrepDPFindAll(args);
-        }
-    }
-}
-
-LIB_EXPORT uint32_t CC AgrepFindFirst( const AgrepParams *self, int32_t threshold, const char *buf, size_t len, AgrepMatch *match )
-{
-    if( self != NULL && buf != NULL && match != NULL ) {
-        if (self->mode & AGREP_ALG_WUMANBER) {
-            return AgrepWuFindFirst(self->wu, threshold, buf, (int32_t)len, match);
-        }
-        if (self->mode & AGREP_ALG_MYERS) {
-            return MyersFindFirst(self->myers, threshold, buf, len, match);
-        }
-        if (self->mode & AGREP_ALG_MYERS_UNLTD) {
-            return MyersUnlimitedFindFirst(self->myersunltd, threshold, buf, len, match);
-        }
-        if (self->mode & AGREP_ALG_DP) {
-            return AgrepDPFindFirst(self->dp, threshold, self->mode, buf, (int32_t)len, match);
-        }
-    }
-    /* Not sure this is the right thing to return. */
-    return 0;
-}
-
-static 
-rc_t CC AgrepFindBestCallback(const void *cbinfo, const AgrepMatch *matchinfo, AgrepContinueFlag *flag)
-{
-    AgrepMatch *best = (AgrepMatch *)cbinfo;
-    if (best->score == -1 || best->score > matchinfo->score) {
-        *best = *matchinfo;
-    }
-    return 0;
-}
-
-LIB_EXPORT uint32_t CC AgrepFindBest( const AgrepParams *self, int32_t threshold, const char *buf, int32_t len, AgrepMatch *match )
-{
-    if( self != NULL && buf != NULL && match != NULL ) {
-        AgrepCallArgs args;
-
-        args.self = self;
-        args.threshold = threshold;
-        args.buf = buf;
-        args.buflen = len;
-        args.cb = AgrepFindBestCallback;
-        args.cbinfo = match;
-
-        match->score = -1;
-        
-        AgrepFindAll(&args);
-        if (match->score != -1) {
-            return 1;
-        }
-    }
-    return 0;
-}
diff --git a/libs/sra/Makefile b/libs/sra/Makefile
deleted file mode 100644
index 0dee0e4..0000000
--- a/libs/sra/Makefile
+++ /dev/null
@@ -1,234 +0,0 @@
-# ===========================================================================
-#
-#                            PUBLIC DOMAIN NOTICE
-#               National Center for Biotechnology Information
-#
-#  This software/database is a "United States Government Work" under the
-#  terms of the United States Copyright Act.  It was written as part of
-#  the author's official duties as a United States Government employee and
-#  thus cannot be copyrighted.  This software/database is freely available
-#  to the public for use. The National Library of Medicine and the U.S.
-#  Government have not placed any restriction on its use or reproduction.
-#
-#  Although all reasonable efforts have been taken to ensure the accuracy
-#  and reliability of the software and data, the NLM and the U.S.
-#  Government do not and cannot warrant the performance or results that
-#  may be obtained by using this software or data. The NLM and the U.S.
-#  Government disclaim all warranties, express or implied, including
-#  warranties of performance, merchantability or fitness for any particular
-#  purpose.
-#
-#  Please cite the author in any work or product based on this material.
-#
-# ===========================================================================
-
-
-default: std
-
-TOP ?= $(shell ../../build/abspath.sh ../..)
-MODULE = libs/sra
-
-INT_LIBS = \
-	libsraschema \
-	libwsraschema \
-	libsradb \
-	libwsradb \
-	libsrareader
-
-ALL_LIBS = \
-	$(INT_LIBS)
-
-include $(TOP)/build/Makefile.env
-
-VPATH += $(OBJDIR)
-
-#-------------------------------------------------------------------------------
-# outer targets
-#
-all std: makedirs
-	@ $(MAKE_CMD) $(TARGDIR)/std
-
-$(INT_LIBS): makedirs
-	@ $(MAKE_CMD) $(ILIBDIR)/$@
-
-.PHONY: all std $(ALL_LIBS)
-
-#-------------------------------------------------------------------------------
-# std
-#
-$(TARGDIR)/std: \
-	$(addprefix $(ILIBDIR)/,$(INT_LIBS))
-
-.PHONY: $(TARGDIR)/all $(TARGDIR)/std
-
-#-------------------------------------------------------------------------------
-# clean
-#
-clean: stdclean
-	@ rm -f $(ILIBDIR)/libsra-schema.* $(ILIBDIR)/libwsra-schema.* $(ILIBDIR)/sra-dflt-schema*
-	@ rm -f $(BINDIR)/libsra-schema.* $(BINDIR)/libwsra-schema.*
-
-.PHONY: clean
-
-
-#-------------------------------------------------------------------------------
-# sradb embedded schema
-#
-$(ILIBDIR)/libsraschema: $(ILIBDIR)/libsraschema.$(LIBX)
-
-$(ILIBDIR)/libwsraschema: $(ILIBDIR)/libwsraschema.$(LIBX)
-
-SRA_DFLT_SCHEMA_LIBS = \
-	-skapp \
-	-svdb \
-	$(ALWAYS_STATIC_SCHEMA_LIBS) \
-	-salign-reader \
-	-skdb \
-	-svfs \
-	-skns \
-	-sksrch \
-	-skrypto \
-	-skfg \
-	-skfs \
-	-sksproc \
-	-sklib
-
-SRA_DFLT_SCHEMA_OS_LIBS = \
-	-ldl \
-	-sz \
-	-sbz2 \
-	-lm
-
-# set workdir for RUN_REMOTELY in rwin mode 
-RWORKDIR=$(OBJDIR)
-
-$(ILIBDIR)/sra-dflt-schema: sra-dflt-schema.$(OBJX)
-	$(LD) --exe -o $@ $^ $(SRA_DFLT_SCHEMA_LIBS) $(SRA_DFLT_SCHEMA_OS_LIBS)
-
-sra-schema.c: $(ILIBDIR)/sra-dflt-schema $(SRCDIR)/built-in.vschema $(TOP)/build/sra-dflt-schema.sh
-	@ $(TOP)/build/sra-dflt-schema.sh $(BUILD_OS) "$(RUN_REMOTELY) $(ILIBDIR)/sra-dflt-schema" -o$@ -I$(TOP)/interfaces -T$(OBJDIR)/$@.d $(SRCDIR)/built-in.vschema
-	cp $@ $(SRCDIR)
-    
-SRA_SCHEMA_SRC = \
-	sraschema \
-	sra-schema
-
-SRA_SCHEMA_OBJ = \
-	$(addsuffix .$(LOBX),$(SRA_SCHEMA_SRC))
-
-WSRA_SCHEMA_OBJ = \
-	$(addsuffix .$(LOBX),$(SRA_SCHEMA_SRC))
-
-SRA_SCHEMA_LIB = \
-	-dvdb \
-	-dklib
-
-WSRA_SCHEMA_LIB = \
-	-dwvdb \
-	-dklib
-
-SRASCHEMA_SRC = \
-	sraschema-stub \
-
-WSRASCHEMA_SRC = \
-	wsraschema-stub
-
-SRASCHEMA_SRC += $(SRA_SCHEMA_SRC)
-WSRASCHEMA_SRC += $(SRA_SCHEMA_SRC)
-
-SRASCHEMA_OBJ = \
-	$(addsuffix .$(LOBX),$(SRASCHEMA_SRC))
-
-WSRASCHEMA_OBJ = \
-	$(addsuffix .$(LOBX),$(WSRASCHEMA_SRC))
-
-$(ILIBDIR)/libsraschema.$(LIBX): $(SRASCHEMA_OBJ) $(SRASCHEMA_DEPS)
-	$(LD) --slib -o $@ $(SRASCHEMA_OBJ) $(SRA_SCHEMA_LIB)
-
-$(ILIBDIR)/libwsraschema.$(LIBX): $(WSRASCHEMA_OBJ) $(WSRASCHEMA_DEPS)
-	$(LD) --slib -o $@ $(WSRASCHEMA_OBJ) $(WSRA_SCHEMA_LIB)
-
-
-#-------------------------------------------------------------------------------
-# sradb library
-#
-$(ILIBDIR)/libsradb: $(addprefix $(ILIBDIR)/libsradb.,$(ILIBEXT))
-
-SRADBCMN_SRC = \
-	sramgr-cmn \
-	sratbl-cmn \
-	sracol \
-	types \
-    sracache
-
-SRADB_SRC = \
-	$(SRADBCMN_SRC) \
-	sramgr \
-	sratbl
-
-SRADB_OBJ = \
-	$(addsuffix .$(LOBX),$(SRADB_SRC))
-
-SRADB_LIB = \
-	-ssraschema \
-	-dvdb \
-	-dkdb \
-	-dvfs \
-	-dkfs \
-	-lkfg \
-	-dkproc \
-	-dklib
-
-$(ILIBDIR)/libsradb.$(LIBX): $(SRADB_OBJ)
-	$(LD) --slib -o $@ $^ $(SRADB_LIB)
-
-
-#-------------------------------------------------------------------------------
-# update version
-#
-$(ILIBDIR)/libwsradb: $(addprefix $(ILIBDIR)/libwsradb.,$(ILIBEXT))
-
-WSRADB_SRC = \
-	$(SRADBCMN_SRC) \
-	wsramgr \
-	wsratbl
-
-WSRADB_OBJ = \
-	$(addsuffix .$(LOBX),$(WSRADB_SRC))
-
-WSRADB_LIB = \
-	-swsraschema \
-	-dwvdb \
-	-dwkdb \
-	-dvfs \
-	-dkfs \
-	-lkfg \
-	-dkproc \
-	-dklib
-
-$(ILIBDIR)/libwsradb.$(LIBX): $(WSRADB_OBJ)
-	$(LD) --slib -o $@ $^ $(WSRADB_LIB)
-
-
-#-------------------------------------------------------------------------------
-# libsrareader
-#
-$(ILIBDIR)/libsrareader: $(addprefix $(ILIBDIR)/libsrareader.,$(ILIBEXT))
-
-SRAREADER_SRC = \
-	reader-cmn \
-	reader-fastq \
-	reader-sff \
-	reader-illumina \
-	reader-abi
-
-SRAREADER_OBJ = \
-	$(addsuffix .$(LOBX),$(SRAREADER_SRC))
-
-SRAREADER_LIB = \
-	-dsradb \
-	-dkdb \
-	-dklib
-
-$(ILIBDIR)/libsrareader.$(LIBX): $(SRAREADER_OBJ)
-	$(LD) --slib -o $@ $^ $(SRAREADER_LIB)
diff --git a/libs/sra/built-in.vschema b/libs/sra/built-in.vschema
deleted file mode 100644
index 3250879..0000000
--- a/libs/sra/built-in.vschema
+++ /dev/null
@@ -1,580 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/*==========================================================================
- * libsradb (and libwsradb) built-in schema
- */
-version 1;
-
-include 'ncbi/ncbi.vschema';
-include 'sra/454.vschema';
-include 'sra/illumina.vschema';
-include 'sra/abi.vschema';
-include 'sra/helicos.vschema';
-include 'sra/ion-torrent.vschema';
-
-/*--------------------------------------------------------------------------
- * functions
- */
-
-/* read_seg_from_readn
- *  reads in old READ_<N> read descriptors
- *  returns segmentation information for both reads and label in vector
- *
- *  "nreads" [ DATA ] - a per-spot value that should generally equal
- *  the number of READ_N descriptors found during function instantiation
- *
- *  "spot_len" [ DATA ] - calculated length of spot, used for dynamic
- *  read-length calculations
- */
-const U32 NCBI:SRA:readn:read_type   = 0;
-const U32 NCBI:SRA:readn:read_start  = 1;
-const U32 NCBI:SRA:readn:read_len    = 2;
-const U32 NCBI:SRA:readn:label_start = 3;
-const U32 NCBI:SRA:readn:label_len   = 4;
-
-extern function
-U32 [ 5 ] NCBI:SRA:read_seg_from_readn #1 ( U8 nreads, U32 spot_len );
-
-
-/* rewrite_spot_name
- *  given an old spotname directly from skey
- *  write according to platform rules, optionally with a prefix
- *
- *  "platform" [ CONST ] - which platform rules to use
- *
- *  "skey" [ DATA ] - skey string for row
- *
- *  "prefix" [ DATA, OPTIONAL ] - prefix for spot
- */
-extern function
-ascii NCBI:SRA:rewrite_spot_name #1 < INSDC:SRA:platform_id platform > ( ascii skey * ascii prefix );
-
-/* extract coordinates
- *  given a spotname with encoded coordinates
- *  extract them in reverse order into a vector
- *
- *  "platform" [ CONST ] - which platform rules to use
- *
- *  "skey" [ DATA ] - skey string for row
- */
-const U32 NCBI:SRA:coord:y      = 0;
-const U32 NCBI:SRA:coord:x      = 1;
-const U32 NCBI:SRA:coord:tile   = 2;
-const U32 NCBI:SRA:coord:lane   = 3;
-const U32 NCBI:SRA:coord:region = 2;
-const U32 NCBI:SRA:coord:panel  = 2;
-
-extern function
-INSDC:coord:val [ * ] NCBI:SRA:extract_coordinates #1 < INSDC:SRA:platform_id platform > ( ascii skey );
-
-/*--------------------------------------------------------------------------
- * NCBI:SRA:_454_:legacy
- *  produced by all loaders prior to v2
- */
-table NCBI:SRA:_454_:legacy #1 = NCBI:SRA:tbl:sra_nopos #1,
-    NCBI:tbl:base_space_nocol #1, NCBI:tbl:phred_quality_nocol #1,
-    NCBI:SRA:tbl:skeyname #1, NCBI:SRA:_454_:common #1
-{
-    /* COORDINATES
-     *  in addition to X and Y,
-     *  454 has REGION
-     */
-    INSDC:coord:val out_y_coord = ( INSDC:coord:val )
-        < I32 > cut < NCBI:SRA:coord:y > ( coords_from_skey );
-    INSDC:coord:val out_x_coord = ( INSDC:coord:val )
-        < I32 > cut < NCBI:SRA:coord:x > ( coords_from_skey );
-    readonly column INSDC:coord:val REGION = ( INSDC:coord:val )
-        < I32 > cut < NCBI:SRA:coord:region > ( coords_from_skey );
-    I32 [ 3 ] coords_from_skey
-        = NCBI:SRA:extract_coordinates < SRA_PLATFORM_454 > ( out_skey );
-}
-
-
-/*--------------------------------------------------------------------------
- * NCBI:SRA:_454_:tbl:v0
- *  produced by original loader before the days of schema
- */
-extern function
-__untyped NCBI:SRA:_454_:untyped_0 ();
-
-extern function U16 NCBI:SRA:decode:CLIP #1 ( opaque in );
-physical __no_header U16 NCBI:SRA:_454_:encoding:CLIP #1 =
-{ return NCBI:SRA:decode:CLIP #1 ( @ ); }
-
-extern function NCBI:SRA:pos16 NCBI:SRA:decode:POSITION #1 ( opaque in );
-physical __no_header NCBI:SRA:pos16 NCBI:SRA:_454_:encoding:POSITION #1 =
-{ return NCBI:SRA:decode:POSITION #1 ( @ ); }
-
-extern function INSDC:2na:packed NCBI:SRA:decode:READ #1 < INSDC:SRA:platform_id platform > ( opaque in );
-physical __no_header INSDC:2na:packed NCBI:SRA:_454_:encoding:READ #1 =
-{ return NCBI:SRA:decode:READ #1 < SRA_PLATFORM_454 > ( @ ); }
-
-extern function any NCBI:SRA:decode:QUALITY #1 < INSDC:SRA:platform_id platform > ( opaque in );
-physical __no_header NCBI:quality:n_encoded:phred NCBI:SRA:_454_:encoding:QUALITY #1 =
-{ return NCBI:SRA:decode:QUALITY #1 < SRA_PLATFORM_454 > ( @ ); }
-
-extern function any NCBI:SRA:decode:SIGNAL #1 < INSDC:SRA:platform_id platform > ( opaque in );
-physical __no_header NCBI:isamp1 NCBI:SRA:_454_:encoding:SIGNAL #1 =
-{ return NCBI:SRA:decode:SIGNAL #1 < SRA_PLATFORM_454 > ( @ ); }
-
-extern function
-NCBI:SRA:pos16 NCBI:SRA:_454_:process_position #1 ( U16 position,
-    * INSDC:SRA:read_filter rd_filt, NCBI:isamp1 sig );
-
-table NCBI:SRA:_454_:tbl:v0 #1 = NCBI:SRA:_454_:legacy #1
-{
-    // recognize original loader
-    __untyped = NCBI:SRA:_454_:untyped_0 ();
-
-    // platform in binary
-    INSDC:SRA:platform_id out_platform
-        = < INSDC:SRA:platform_id > echo < SRA_PLATFORM_454 > ();
-
-    // bases and quality
-    INSDC:2na:packed out_2na_packed = .READ;
-    INSDC:quality:phred out_qual_phred = .QUALITY;
-
-    // synthesized label
-    ascii out_label
-        = < ascii > exists < "AdapterMate1LinkerMate2" > ( out_linker_sequence )
-        | < ascii > echo < "AdapterFragment" > ();
-    INSDC:coord:zero out_label_start
-        = < INSDC:coord:zero > exists < [ 0, 7, 12, 18 ] > ( out_linker_sequence )
-        | < INSDC:coord:zero > echo < [ 0, 7 ] > ();
-    INSDC:coord:len out_label_len
-        = < INSDC:coord:len > exists < [ 7, 5, 6, 5 ] > ( out_linker_sequence )
-        | < INSDC:coord:len > echo < [ 7, 8 ] > ();
-
-    // special sequences
-    INSDC:dna:text out_flow_chars
-        = < INSDC:dna:text > meta:read < "MSC454_FLOW_CHARS" > ();
-    INSDC:dna:text out_key_sequence
-        = < INSDC:dna:text > meta:read < "MSC454_KEY_SEQUENCE" > ();
-    INSDC:dna:text out_linker_sequence
-        = < INSDC:dna:text > meta:read < "MSC454_LINKER_SEQUENCE" > ();
-
-    // position column may be read directly
-    NCBI:SRA:pos16 out_position16
-        = NCBI:SRA:_454_:process_position #1 ( .POSITION, .RD_FILTER, .SIGNAL )
-        | NCBI:SRA:_454_:process_position #1 ( .POSITION, .RD_FILTER )
-        | NCBI:SRA:_454_:process_position #1 ( .POSITION );
-    INSDC:position:one out_position
-        = cast ( out_position16 );
-
-
-    /* READ DESCRIPTION
-     *  this version of 454 always has a key sequence
-     *  and may or may not have a linker
-     *  in the former case, the spot is well defined
-     *  in the latter, the linker must be dynamically located
-     */
-
-    // special function to generate reads
-    U32 [ 3 ] dynamic_read_desc
-        = NCBI:SRA:_454_:dynamic_read_desc < 4 > ( out_2na_bin, out_key_sequence, out_linker_sequence )
-        | NCBI:SRA:_454_:dynamic_read_desc ( out_2na_bin, out_key_sequence );
-
-    // fabricate nreads
-    U8 out_nreads
-        = < U8 > exists < 4 > ( out_linker_sequence )
-        | < U8 > echo < 2 > ();
-
-
-    // read_type
-    U32 read_type32
-        = < U32 > cut < NCBI:SRA:_454_:dyn_read_type > ( dynamic_read_desc );
-    INSDC:SRA:read_type out_read_type = cast ( read_type32 );
-
-    // read_seg and read_len
-    U32 uread_start
-        = < U32 > cut < NCBI:SRA:_454_:dyn_read_start > ( dynamic_read_desc );
-    INSDC:coord:zero out_read_start
-        = ( INSDC:coord:zero ) uread_start;
-    INSDC:coord:len out_read_len = ( INSDC:coord:len )
-        < U32 > cut < NCBI:SRA:_454_:dyn_read_len > ( dynamic_read_desc );
-
-    // read_filter
-    INSDC:SRA:read_filter out_rd_filter
-        = .RD_FILTER
-        | < INSDC:SRA:read_filter > echo < SRA_READ_FILTER_PASS > ( dynamic_read_desc );
-
-
-    /* clips - all may be absent although CQR is expected */
-    physical column NCBI:SRA:_454_:encoding:CLIP #1 .CLIP_ADAPTER_LEFT;
-    physical column NCBI:SRA:_454_:encoding:CLIP #1 .CLIP_ADAPTER_RIGHT;
-    physical column NCBI:SRA:_454_:encoding:CLIP #1 .CLIP_QUALITY_LEFT;
-    physical column NCBI:SRA:_454_:encoding:CLIP #1 .CLIP_QUALITY_RIGHT;
-
-    /* bases */
-    physical column NCBI:SRA:_454_:encoding:READ #1 .READ;
-    physical column NCBI:SRA:_454_:encoding:QUALITY #1 .QUALITY;
-
-    /* signal and base position */
-    physical column NCBI:SRA:_454_:encoding:SIGNAL #1 .SIGNAL;
-    physical column NCBI:SRA:_454_:encoding:POSITION #1 .POSITION;
-};
-
-
-/* NCBI:SRA:_454_:tbl:v1 #1
- *  written with implicit table schema
- *  columns have stored schema
- */
-table NCBI:SRA:_454_:tbl:v1 #1 = NCBI:SRA:_454_:legacy #1, NCBI:SRA:tbl:spotdesc_nophys #1
-{
-    // platform in binary
-    INSDC:SRA:platform_id out_platform
-        = .PLATFORM
-        | < INSDC:SRA:platform_id > echo < SRA_PLATFORM_454 > ();
-
-    // bases and quality
-    INSDC:2na:packed out_2na_packed = .READ;
-    INSDC:quality:phred out_qual_phred = .QUALITY;
-
-    // special sequences
-    INSDC:dna:text out_flow_chars = .FLOW_CHARS;
-    INSDC:dna:text out_key_sequence = .KEY_SEQUENCE;
-    // linker handled by sub-table
-
-    // position needs special processing
-    NCBI:SRA:pos16 out_position16
-        = NCBI:SRA:_454_:process_position #1 ( .POSITION, .RD_FILTER, .SIGNAL )
-        | NCBI:SRA:_454_:process_position #1 ( .POSITION, .RD_FILTER )
-        | NCBI:SRA:_454_:process_position #1 ( .POSITION );
-    INSDC:position:one out_position
-        = cast ( out_position16 );
-};
-
-
-/* NCBI:SRA:_454_:tbl:v1_2 #1
- *  no stored schema
- *  linker ignored if present
- */
-extern function
-__untyped NCBI:SRA:_454_:untyped_1_2a ();
-
-table NCBI:SRA:_454_:tbl:v1_2a #1 = NCBI:SRA:_454_:tbl:v1 #1
-{
-    // single linker present
-    __untyped = NCBI:SRA:_454_:untyped_1_2a ();
-
-    INSDC:dna:text out_linker_sequence = .LINKER_SEQUENCE;
-};
-
-extern function
-__untyped NCBI:SRA:_454_:untyped_1_2b ();
-
-table NCBI:SRA:_454_:tbl:v1_2b #1 = NCBI:SRA:_454_:tbl:v1 #1
-{
-    // linker missing or empty
-    __untyped = NCBI:SRA:_454_:untyped_1_2b ();
-};
-
-
-/*--------------------------------------------------------------------------
- * NCBI:SRA:Illumina:legacy
- *  produced by all loaders prior to v2
- */
-table NCBI:SRA:Illumina:legacy #1 = NCBI:SRA:tbl:sra #1,
-    NCBI:tbl:base_space_nocol #1, NCBI:SRA:Illumina:common #1
-{
-    // signal
-    column NCBI:fsamp4 SIGNAL
-        = ( NCBI:fsamp4 ) < NCBI:SRA:swapped_fsamp4 > NCBI:SRA:swap ( out_signal, out_x2na_bin )
-        | ( NCBI:fsamp4 ) < NCBI:SRA:rotated_fsamp4 > NCBI:SRA:rotate < false > ( out_signal, out_x2na_bin );
-
-    // intensity
-    column NCBI:fsamp4 INTENSITY
-        = < NCBI:fsamp4 > NCBI:SRA:denormalize ( out_norm_intensity, out_x2na_bin );
-    NCBI:fsamp4 out_norm_intensity
-        = ( NCBI:fsamp4 ) < NCBI:SRA:swapped_fsamp4 > NCBI:SRA:swap ( out_intensity, out_x2na_bin )
-        | ( NCBI:fsamp4 ) < NCBI:SRA:rotated_fsamp4 > NCBI:SRA:rotate < false > ( out_intensity, out_x2na_bin );
-
-    // noise
-    column NCBI:fsamp4 NOISE = out_noise;
-};
-
-/* NCBI:SRA:Illumina:tbl:v0
- *  produced by original loader before the days of schema
- */
-extern function INSDC:2na:packed NCBI:SRA:decode:READ #1 < INSDC:SRA:platform_id platform > ( opaque in );
-physical __no_header INSDC:2na:packed NCBI:SRA:Illumina:encoding:READ #1 =
-{ return NCBI:SRA:decode:READ #1 < SRA_PLATFORM_ILLUMINA > ( @ ); }
-
-extern function any NCBI:SRA:decode:QUALITY #1 < INSDC:SRA:platform_id platform > ( opaque in );
-physical __no_header NCBI:SRA:rotated_qual4 NCBI:SRA:Illumina:encoding:QUALITY #1 =
-{ return NCBI:SRA:decode:QUALITY #1 < SRA_PLATFORM_ILLUMINA > ( @ ); }
-physical __no_header NCBI:qual1 NCBI:SRA:Illumina:encoding:QUALITY2 #1 =
-{ return NCBI:SRA:decode:QUALITY #1 < SRA_PLATFORM_ILLUMINA > ( @ ); }
-
-extern function any NCBI:SRA:decode:SIGNAL #1 < INSDC:SRA:platform_id platform > ( opaque in );
-physical __no_header NCBI:SRA:rotated_fsamp4 NCBI:SRA:Illumina:encoding:SIGNAL #1 =
-{ return NCBI:SRA:decode:SIGNAL #1 < SRA_PLATFORM_ILLUMINA > ( @ ); }
-
-extern function any NCBI:SRA:decode:INTENSITY #1 ( opaque in );
-physical __no_header NCBI:SRA:rotated_fsamp4 NCBI:SRA:Illumina:encoding:INTENSITY #1 =
-{ return NCBI:SRA:decode:INTENSITY #1 ( @ ); }
-
-extern function any NCBI:SRA:decode:NOISE #1 ( opaque in );
-physical __no_header NCBI:fsamp4 NCBI:SRA:Illumina:encoding:NOISE #1 =
-{ return NCBI:SRA:decode:NOISE #1 ( @ ); }
-
-table NCBI:SRA:Illumina:tbl:v0 #1 = NCBI:SRA:Illumina:legacy #1, NCBI:SRA:tbl:skeyname #1
-{
-    // platform in binary
-    INSDC:SRA:platform_id out_platform
-        = < INSDC:SRA:platform_id > echo < SRA_PLATFORM_ILLUMINA > ();
-
-    // generate rewritten spot_name
-    ascii out_slx_prefix
-        = < ascii > meta:read < 'SLX_PREFIX' > ()
-        | < ascii > echo < '' > ();
-    ascii rewritten_spot_name
-        = NCBI:SRA:rewrite_spot_name < SRA_PLATFORM_ILLUMINA > ( out_skey, out_slx_prefix );
-
-    // coordinates
-    INSDC:coord:val out_y_coord = ( INSDC:coord:val )
-        < I32 > cut < NCBI:SRA:coord:y > ( coords_from_skey );
-    INSDC:coord:val out_x_coord = ( INSDC:coord:val )
-        < I32 > cut < NCBI:SRA:coord:x > ( coords_from_skey );
-    INSDC:coord:val out_tile_coord = ( INSDC:coord:val )
-        < I32 > cut < NCBI:SRA:coord:tile > ( coords_from_skey );
-    INSDC:coord:val out_lane_coord = ( INSDC:coord:val )
-        < I32 > cut < NCBI:SRA:coord:lane > ( coords_from_skey );
-    I32 [ 4 ] coords_from_skey
-        = NCBI:SRA:extract_coordinates < SRA_PLATFORM_ILLUMINA > ( out_skey );
-
-    // bases
-    INSDC:2na:packed out_2na_packed = .READ;
-
-    // fixed_spot_len
-    INSDC:coord:len static_fixed_spot_len = spot_len;
-
-    // nreads
-    U8 out_nreads
-        = < U8 > meta:value < 'NREADS' > ()
-        | < U8 > echo < 1 > ();
-
-    // read_start, read_len
-    INSDC:coord:zero out_read_start
-        = ( INSDC:coord:zero ) < U32 > cut < NCBI:SRA:readn:read_start > ( read_seg_from_readn )
-        | < INSDC:coord:zero > echo < 0 > ();
-    INSDC:coord:len out_read_len
-        = ( INSDC:coord:len ) < U32 > cut < NCBI:SRA:readn:read_len > ( read_seg_from_readn )
-        | spot_len;
-    U32 [ 5 ] read_seg_from_readn
-        = NCBI:SRA:read_seg_from_readn ( out_nreads, spot_len );
-
-    // read_type
-    U32 read_type_from_read_seg
-        = < U32 > cut < NCBI:SRA:readn:read_type > ( read_seg_from_readn );
-    INSDC:SRA:read_type out_read_type
-        = cast ( read_type_from_read_seg )
-        | ( INSDC:SRA:read_type ) < INSDC:SRA:xread_type > echo < SRA_READ_TYPE_BIOLOGICAL > ();
-
-    NCBI:SRA:rotated_fsamp4 out_signal = .SIGNAL;
-    NCBI:SRA:rotated_fsamp4 out_intensity = .INTENSITY;
-    NCBI:fsamp4 out_noise = .NOISE;
-
-    /* bases */
-    physical column NCBI:SRA:Illumina:encoding:READ #1 .READ;
-
-    /* signal, intensity and noise */
-    physical column NCBI:SRA:Illumina:encoding:SIGNAL #1 .SIGNAL;
-    physical column NCBI:SRA:Illumina:encoding:INTENSITY #1 .INTENSITY;
-    physical column NCBI:SRA:Illumina:encoding:NOISE #1 .NOISE;
-};
-
-
-extern function
-__untyped NCBI:SRA:Illumina:untyped_0a ();
-
-table NCBI:SRA:Illumina:tbl:v0a #1 = NCBI:SRA:Illumina:tbl:v0 #1, NCBI:SRA:Illumina:qual4_nocol #1
-{
-    __untyped = NCBI:SRA:Illumina:untyped_0a ();
-
-    // quality
-    NCBI:SRA:rotated_qual4 out_qual4_rotated = .QUALITY;
-    physical column NCBI:SRA:Illumina:encoding:QUALITY #1 .QUALITY;
-
-    INSDC:quality:phred out_qual2_phred = .QUALITY2;
-    physical column NCBI:SRA:Illumina:encoding:QUALITY2 #1 .QUALITY2;
-
-	/* INSDC:SRA:tbl:spotname inherited virtual productions
-	 *  virtual out_name_fmt = 0;
-	 */
-
-	/* INSDC:SRA:tbl:spotdesc inherited virtual productions
-	 *  virtual out_label = 0;
-	 *  virtual out_label_len = 0;
-	 *  virtual out_rd_filter = 0;
-	 *  virtual out_label_start = 0;
-	 */
-};
-
-extern function
-__untyped NCBI:SRA:Illumina:untyped_0b ();
-
-table NCBI:SRA:Illumina:tbl:v0b #1 = NCBI:SRA:Illumina:tbl:v0 #1, NCBI:tbl:phred_quality_nocol #1
-{
-    __untyped = NCBI:SRA:Illumina:untyped_0b ();
-
-    // quality
-    INSDC:quality:phred out_qual_phred
-        = .QUALITY
-        | .QUALITY2;
-
-    physical column NCBI:SRA:Illumina:encoding:QUALITY2 #1 .QUALITY;
-    physical column NCBI:SRA:Illumina:encoding:QUALITY2 #1 .QUALITY2;
-
-	/* INSDC:SRA:tbl:spotname inherited virtual productions
-	 *  virtual out_name_fmt = 0;
-	 */
-
-	/* INSDC:SRA:tbl:spotdesc inherited virtual productions
-	 *  virtual out_label = 0;
-	 *  virtual out_label_len = 0;
-	 *  virtual out_rd_filter = 0;
-	 *  virtual out_label_start = 0;
-	 */
-
-	/* INSDC:SRA:tbl:stats inherited virtual productions
-	 *  virtual max_spot_id = 0;
-	 *  virtual min_spot_id = 0;
-	 *  virtual in_stats_bin = 0;
-	 *  virtual bio_base_count = 0;
-	 */
-};
-
-table NCBI:SRA:Illumina:tbl:v1 #1 = NCBI:SRA:Illumina:legacy #1,
-    NCBI:SRA:tbl:spotdesc_nophys #1, NCBI:SRA:tbl:skeyname_nocol #2
-{
-    // platform in binary
-    INSDC:SRA:platform_id out_platform
-        = .PLATFORM
-        | < INSDC:SRA:platform_id > echo < SRA_PLATFORM_ILLUMINA > ();
-
-    // coordinates
-    INSDC:coord:val out_tile_coord = ( INSDC:coord:val )
-        < I32 > cut < NCBI:SRA:coord:tile > ( coords_from_spotname );
-    INSDC:coord:val out_lane_coord = ( INSDC:coord:val )
-        < I32 > cut < NCBI:SRA:coord:lane > ( coords_from_spotname );
-    I32 [ 4 ] coords_from_spotname
-        = NCBI:SRA:extract_coordinates < SRA_PLATFORM_ILLUMINA > ( _out_name );
-
-    // bases
-    INSDC:2na:packed out_2na_packed = .READ;
-
-    // quality2
-    INSDC:quality:phred out_qual2_phred = .QUALITY2;
-
-    // fixed_spot_len
-    INSDC:coord:len static_fixed_spot_len = spot_len;
-
-    NCBI:SRA:swapped_fsamp4 out_signal = .SIGNAL;
-    NCBI:SRA:swapped_fsamp4 out_intensity = .INTENSITY;
-    NCBI:fsamp4 out_noise = .NOISE;
-
-    // stray compatibility columns
-    physical column INSDC:dna:text .FLOW_CHARS;
-    physical column INSDC:dna:text .KEY_SEQUENCE;
-    physical column INSDC:dna:text .LINKER_SEQUENCE;
-};
-
-extern function
-__untyped NCBI:SRA:Illumina:untyped_1a ();
-
-alias NCBI:SRA:encoded_qual4 NCBI:SRA:comp_qual4;
-
-extern function
-NCBI:SRA:swapped_qual4 NCBI:SRA:qual4_decompress_v1 #1 ( any in );
-
-table NCBI:SRA:Illumina:tbl:v1a #1 = NCBI:SRA:Illumina:tbl:v1 #1, NCBI:SRA:Illumina:qual4_nocol #1
-{
-    __untyped = NCBI:SRA:Illumina:untyped_1a ();
-
-    // 4-channel quality
-    NCBI:SRA:swapped_qual4 out_qual4_swapped = .QUALITY;
-};
-
-extern function
-__untyped NCBI:SRA:Illumina:untyped_1b ();
-
-table NCBI:SRA:Illumina:tbl:v1b #1 = NCBI:SRA:Illumina:tbl:v1 #1, NCBI:tbl:phred_quality_nocol #1
-{
-    __untyped = NCBI:SRA:Illumina:untyped_1b ();
-
-    // single-channel quality
-    INSDC:quality:phred out_qual_phred = .QUALITY;
-};
-
-
-/*--------------------------------------------------------------------------
- * NCBI:SRA:ABI:legacy
- *  produced by all loaders prior to v2
- */
-table NCBI:SRA:ABI:legacy #1 = NCBI:SRA:tbl:sra #1,
-    NCBI:tbl:phred_quality_nocol #1, NCBI:SRA:ABI:common #1
-{
-};
-
-extern function
-__untyped NCBI:SRA:ABI:untyped_1 ();
-
-table NCBI:SRA:ABI:tbl:v1 #1 = NCBI:SRA:ABI:legacy #1,
-    NCBI:tbl:color_space_nocol #1, NCBI:SRA:tbl:spotdesc_nophys #1,
-    NCBI:SRA:tbl:skeyname_nocol #2
-{
-    __untyped = NCBI:SRA:ABI:untyped_1 ();
-
-    // platform in binary
-    INSDC:SRA:platform_id out_platform
-        = .PLATFORM
-        | < INSDC:SRA:platform_id > echo < SRA_PLATFORM_ABSOLID > ();
-
-    // coordinates
-    INSDC:coord:val out_panel_coord = ( INSDC:coord:val )
-        < I32 > cut < NCBI:SRA:coord:panel > ( coords_from_spotname );
-    I32 [ 4 ] coords_from_spotname
-        = NCBI:SRA:extract_coordinates < SRA_PLATFORM_ABSOLID > ( out_spot_name );
-    ascii out_spot_name
-        = INSDC:SRA:format_spot_name ( out_name_fmt, out_x_coord, out_y_coord );
-
-    // bases and quality
-    INSDC:2cs:packed out_2cs_packed = .CSREAD;
-    INSDC:dna:text out_cs_key = .CS_KEY;
-    INSDC:quality:phred out_qual_phred = .QUALITY;
-
-    // fixed_spot_len
-    INSDC:coord:len static_fixed_spot_len = spot_len;
-
-    NCBI:SRA:swapped_fsamp4 out_signal_swapped = .SIGNAL;
-
-    // stray compatibility columns
-    physical column INSDC:dna:text .FLOW_CHARS;
-    physical column INSDC:dna:text .KEY_SEQUENCE;
-    physical column INSDC:dna:text .LINKER_SEQUENCE;
-};
diff --git a/libs/sra/libsradb.vers.h b/libs/sra/libsradb.vers.h
deleted file mode 100644
index 5c564cb..0000000
--- a/libs/sra/libsradb.vers.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#define LIBSRADB_VERS 0x0301000D
diff --git a/libs/sra/reader-abi.c b/libs/sra/reader-abi.c
deleted file mode 100644
index 6482e2b..0000000
--- a/libs/sra/reader-abi.c
+++ /dev/null
@@ -1,473 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <sra/rd-extern.h>
-
-#include <klib/rc.h>
-#include <sra/types.h>
-#include <sra/abi.h>
-#include <os-native.h>
-#include <sysalloc.h>
-#include <klib/text.h>
-
-#include "reader-cmn.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-
-typedef enum AbsolidReaderOptions_enum {
-    eOrigFormat  = 0x02,
-    eSignal      = 0x04,
-    eClipQual    = 0x08
-} AbsolidReaderOptions;
-
-/* column order is important here: see Init function below!!! */
-static
-const SRAReaderColumn AbsolidReader_master_columns_desc[] = {
-    {SRAREADER_COL_MANDATORY, "CSREAD", insdc_csfasta_t, NULL, NULL, 0},
-    {SRAREADER_COL_MANDATORY, "CS_KEY", insdc_fasta_t, NULL, NULL, 0},
-    {SRAREADER_COL_MANDATORY, "QUALITY", insdc_phred_t, NULL, NULL, 0},
-    {eClipQual, "TRIM_START", "INSDC:coord:zero", NULL, NULL, 0},
-    {eClipQual, "TRIM_LEN", "INSDC:coord:len", NULL, NULL, 0},
-    {eSignal | SRAREADER_COL_OPTIONAL, "SIGNAL", ncbi_fsamp4_t, NULL, NULL, 0},
-    {SRAREADER_COL_MANDATORY, NULL, NULL, NULL, NULL, 0} /* terminator */
-};
-
-struct AbsolidReader {
-    /* SRAReader always must be a first member! */
-    SRAReader dad;
-    uint32_t minReadLen;
-    /* current spot data shortcuts */
-    const SRAReaderColumn* csread;
-    const char** cs_key;
-    const SRAReaderColumn* qual1;
-    const INSDC_coord_zero** trim_start;
-    const INSDC_coord_len** trim_len;
-    const float** signal;
-    char prefix_buf[1024];
-    size_t prefix_sz;
-};
-
-static
-rc_t AbsolidReaderInit(const AbsolidReader* self,
-                       bool origFormat, bool noClip, uint32_t minReadLen, bool signal)
-{
-    rc_t rc = 0;
-    int options = origFormat ? eOrigFormat : 0;
-
-    CHECK_SELF(AbsolidReader);
-
-    options |= signal ? eSignal : 0;
-    options |= noClip ? 0 : eClipQual;
-    me->minReadLen = minReadLen;
-
-    if( (rc = SRAReaderInit(&self->dad, options, AbsolidReader_master_columns_desc)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &AbsolidReader_master_columns_desc[0], &me->csread, NULL)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &AbsolidReader_master_columns_desc[1], NULL, (const void***)&self->cs_key)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &AbsolidReader_master_columns_desc[2], &me->qual1, NULL)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &AbsolidReader_master_columns_desc[3], NULL, (const void***)&self->trim_start)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &AbsolidReader_master_columns_desc[4], NULL, (const void***)&self->trim_len)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &AbsolidReader_master_columns_desc[5], NULL, (const void***)&self->signal)) == 0 ) {
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC AbsolidReaderMake(const AbsolidReader** self, const SRATable* table,
-                                     const char* accession, bool origFormat,
-                                     bool noClip, uint32_t minReadLen,
-                                     spotid_t minSpotId, spotid_t maxSpotId, bool signal)
-{
-    rc_t rc = SRAReaderMake((const SRAReader**)self, sizeof **self, table, accession, minSpotId, maxSpotId);
-
-    if( rc == 0 ) {
-        rc = AbsolidReaderInit(*self, origFormat, noClip, minReadLen, signal);
-    }
-    if( rc != 0 ) {
-        AbsolidReaderWhack(*self);
-        *self = NULL;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC AbsolidReaderWhack(const AbsolidReader* self)
-{
-    return SRAReaderWhack(&self->dad);
-}
-
-LIB_EXPORT rc_t CC AbsolidReaderFirstSpot(const AbsolidReader* self)
-{
-    return SRAReaderFirstSpot(&self->dad);
-}
-
-LIB_EXPORT rc_t CC AbsolidReaderSeekSpot(const AbsolidReader* self, spotid_t spot)
-{
-    return SRAReaderSeekSpot(&self->dad, spot);
-}
-
-LIB_EXPORT rc_t CC AbsolidReaderNextSpot(const AbsolidReader* self)
-{
-    return SRAReaderNextSpot(&self->dad);
-}
-
-LIB_EXPORT rc_t CC AbsolidReaderCurrentSpot(const AbsolidReader* self, spotid_t* spot)
-{
-    return SRAReaderCurrentSpot(&self->dad, spot);
-}
-
-LIB_EXPORT rc_t CC AbsolidReader_SpotInfo(const AbsolidReader* self,
-                                          const char** spotname, size_t* spotname_sz,
-                                          uint32_t* spot_len, uint32_t* num_reads)
-{
-    rc_t rc = SRAReader_SpotInfo(&self->dad, spotname, spotname_sz, spot_len, num_reads);
-    if( rc == 0 ) {
-        if( spot_len ) {
-            if( self->dad.options & eClipQual ) {
-                *spot_len = **self->trim_len;
-            }
-            if( *spot_len < self->minReadLen ) {
-                *spot_len = 0;
-            }
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC AbsolidReaderSpotName(const AbsolidReader* self,
-                                         const char** prefix, size_t* prefix_sz,
-                                         const char** suffix, size_t* suffix_sz)
-{
-    rc_t rc = 0;
-    const char* spotname;
-    size_t spotname_sz;
-
-    CHECK_SELF(AbsolidReader);
-
-    rc = SRAReader_SpotInfo(&self->dad, &spotname, &spotname_sz, NULL, NULL);
-    if( rc == 0 ) {
-        if( !self->prefix_sz || self->prefix_sz > spotname_sz || strncmp(spotname, self->prefix_buf, self->prefix_sz) != 0 ) {
-            if( spotname_sz == 0 ) {
-                me->prefix_sz = 0;
-            } else {
-                int k = 0;
-                size_t psz = spotname_sz;
-                while( psz > 0 && k < 3 ) {
-                    /* take out PLATE_X_Y and optional label _(F|R)3 */
-                    while( psz > 0 && isdigit( *(spotname + psz - 1)) ) {
-                        psz--;
-                    }
-
-                    if( *(spotname + psz - 1) == 'F' || *(spotname + psz - 1) == 'R') {
-                        /* Discard F|R and preceding underscore */
-                        if( --psz > 0 && !isdigit(*(spotname + psz - 1)) ) {
-                            psz--;
-                        }
-                        continue;
-                    } else if( psz > 0 ) {
-                        /* Discard underscore */
-                        psz--;
-                        k++;
-                    }
-                }
-                if( psz > 0 ) {
-                    /* Add one to restore underscore at end of prefix */
-                    me->prefix_sz = psz + 1;
-                    string_copy(me->prefix_buf, sizeof(me->prefix_buf), spotname, me->prefix_sz);
-                } else {
-                    me->prefix_sz = 0;
-                }
-            }
-            me->prefix_buf[me->prefix_sz] = '\0';
-        }
-        if( suffix ) {
-            *suffix = &spotname[self->prefix_sz];
-        }
-        if( suffix_sz ) {
-            *suffix_sz = spotname_sz - self->prefix_sz;
-        }
-        if( prefix ) {
-            *prefix = self->prefix_buf;
-        }
-        if( prefix_sz ) {
-            *prefix_sz = self->prefix_sz;
-        }
-    }
-    return rc;
-
-}
-
-LIB_EXPORT rc_t CC AbsolidReader_SpotReadInfo(const AbsolidReader* self, uint32_t readId, SRAReadTypes* read_type, 
-                                              const char** read_label, INSDC_coord_len* read_label_sz,
-                                              INSDC_coord_zero* read_start, INSDC_coord_len* read_len)
-{
-    INSDC_coord_zero rs;
-    INSDC_coord_len rl;
-
-    rc_t rc = SRAReader_SpotReadInfo(&self->dad, readId, read_type, read_label, read_label_sz, &rs, &rl);
-    if( rc == 0 ) {
-        if( read_start || read_len ) {
-            if( self->dad.options & eClipQual ) {
-                INSDC_coord_zero end = rs + rl - 1;
-                INSDC_coord_zero trim_end = ((**self->trim_start) + (**self->trim_len)) - 1;
-                if( end < (**self->trim_start) || rs > trim_end ) {
-                    rl = 0;
-                } else {
-                    if( (**self->trim_start) > rs && (**self->trim_start) <= end ) {
-                        rl -= (**self->trim_start) - rs;
-                        rs = (**self->trim_start);
-                    }
-                    if( end > trim_end ) {
-                        rl = trim_end - rs + 1;
-                    }
-                }
-            }
-            if( rl < self->minReadLen ) {
-                rl = 0;
-            }
-            if( read_start ) {
-                *read_start = rl ? rs : 0;
-            }
-            if( read_len ) {
-                *read_len = rl;
-            }
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC AbsolidReaderHeader(const AbsolidReader* self, uint32_t readId, char* data, size_t dsize, size_t* written)
-{
-    rc_t rc = 0;
-    int ret = 0;
-
-    const char* spotname;
-    size_t x;
-    int spotname_sz;
-    INSDC_coord_len read_label_sz = 0;
-    const char* read_label;
-
-    CHECK_SELF(AbsolidReader);
-    CHECK_SPOT(self->dad);
-
-    if( (rc = AbsolidReaderSpotName(me, NULL, NULL, &spotname, &x)) != 0 ) {
-        return rc;
-    }
-    spotname_sz = (int)x;
-    if( readId > 0 ) {
-        if( (rc = AbsolidReader_SpotReadInfo(self, readId, NULL, &read_label, &read_label_sz, NULL, NULL)) != 0 ) {
-            return rc;
-        }
-    }
-    if( self->dad.options & eOrigFormat ) {
-        char tmp[1024];
-        if( spotname_sz == 0 ) {
-            spotname_sz = snprintf(tmp, sizeof(tmp) - 1, "%s.%u", self->dad.accession, self->dad.spot);
-            if ( spotname_sz < 0 )
-                return RC ( rcSRA, rcString, rcConstructing, rcData, rcCorrupt );
-            spotname = tmp;
-        }
-        if( readId > 0 && read_label_sz > 0 ) {
-            ret = snprintf(data, dsize, ">%.*s%s%.*s", spotname_sz, spotname, spotname_sz ? "_" : "", read_label_sz, read_label);
-        } else {
-            ret = snprintf(data, dsize, ">%.*s", spotname_sz, spotname);
-        }
-    } else {
-        if( readId > 0 && read_label_sz > 0 ) {
-            ret = snprintf(data, dsize, ">%s.%u %.*s%s%.*s",
-                self->dad.accession, self->dad.spot, spotname_sz, spotname, spotname_sz ? "_" : "", read_label_sz, read_label);
-        } else {
-            ret = snprintf(data, dsize, ">%s.%u %.*s",
-                           self->dad.accession, self->dad.spot, spotname_sz, spotname);
-        }
-    }
-#if SNPRINTF_ACTUALLY_WORKED_THE_WAY_YOU_THINK
-    if( ret < 0 ) {
-        ret = 0;
-        rc = RC(rcSRA, rcString, rcConstructing, rcMessage, rcUnknown);
-    } else if( ret >= (int)dsize ) {
-#else
-    if( ret < 0 || ret >= (int)dsize ) {
-#endif
-        rc = RC(rcSRA, rcString, rcConstructing, rcMemory, rcInsufficient);
-    }
-    if( written != NULL ) {
-        *written = ret;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC AbsolidReaderBase(const AbsolidReader* self, uint32_t readId, char* data, size_t dsize, size_t* written)
-{
-    rc_t rc = 0;
-    INSDC_coord_zero read_start = 0;
-    INSDC_coord_len read_len = 0;
-
-    CHECK_SELF(AbsolidReader);
-    CHECK_SPOT(self->dad);
-
-    if( readId > 0 ) {
-        if( (rc = AbsolidReader_SpotReadInfo(self, readId--, NULL, NULL, NULL, &read_start, &read_len)) != 0 ) {
-            return rc;
-        }
-    } else {
-        return RC(rcSRA, rcFormatter, rcConstructing, rcFormat, rcUnsupported);
-    }
-    if( read_len < self->minReadLen ) {
-        read_len = 0;
-    }
-    /* for cs_key */
-    read_len++;
-    if( written != NULL ) {
-        *written = read_len;
-    }
-    if( read_len >= dsize ) {
-        return RC(rcSRA, rcString, rcConstructing, rcMemory, rcInsufficient);
-    } else {
-        const char* b = self->csread->base;
-        data[0] = (*me->cs_key)[readId];
-        memcpy(&data[1], &b[read_start], read_len - 1);
-    }
-    data[read_len] = '\0';
-    return rc;
-}
-
-LIB_EXPORT rc_t CC AbsolidReaderQuality(const AbsolidReader* self, uint32_t readId, char* data, size_t dsize, size_t* written)
-{
-    rc_t rc = 0;
-    INSDC_coord_zero read_start = 0;
-    INSDC_coord_len j = 0, read_len = 0;
-
-    CHECK_SELF(AbsolidReader);
-    CHECK_SPOT(self->dad);
-
-    if( readId > 0 ) {
-        if( (rc = AbsolidReader_SpotReadInfo(self, readId, NULL, NULL, NULL, &read_start, &read_len)) != 0 ) {
-            return rc;
-        }
-    } else {
-        return RC(rcSRA, rcFormatter, rcConstructing, rcFormat, rcUnsupported);
-    }
-    if( read_len >= self->minReadLen && me->qual1->size ) {
-        const int8_t* q = me->qual1->base;
-        char* d = data;
-        INSDC_coord_len i;
-
-        /* read end */
-        read_len += read_start;
-        for(i = read_start; i < read_len; i++) {
-            int x;
-            if( j + 2 > dsize ) {
-                /* do not overflow buffer in case it's too small */
-                d = data;
-            }
-            x = snprintf(d, dsize - j, "%i ", (int)(q[i]));
-            if ( x < 0 )
-                return RC(rcSRA, rcString, rcConstructing, rcMemory, rcInsufficient);
-            d += x;
-            j += x;
-        }
-        j--;
-        d[j] = '\0';
-    }
-    if( written != NULL ) {
-        *written = j;
-    }
-    if( j >= dsize ) {
-        rc = RC(rcSRA, rcString, rcConstructing, rcMemory, rcInsufficient);
-    }
-    return rc;
-}
-
-static
-rc_t AbsolidReaderSignal(const AbsolidReader* self, uint32_t readId, int idx, char* data, size_t dsize, size_t* written)
-{
-    rc_t rc = 0;
-    INSDC_coord_len j = 0;
-
-    CHECK_SELF(AbsolidReader);
-    CHECK_SPOT(self->dad);
-
-    if( me->signal != NULL ) {
-        INSDC_coord_zero read_start = 0;
-        INSDC_coord_len read_len = 0;
-        if( readId > 0 ) {
-            if( (rc = AbsolidReader_SpotReadInfo(self, readId, NULL, NULL, NULL, &read_start, &read_len)) != 0 ) {
-                return rc;
-            }
-        } else {
-            return RC(rcSRA, rcFormatter, rcConstructing, rcFormat, rcUnsupported);
-        }
-        if( read_len >= self->minReadLen ) {
-            const float* s = *me->signal;
-            char* d = data;
-            INSDC_coord_len i;
-
-            /* read end */
-            read_len += read_start;
-            for(i = read_start; i < read_len; i++) {
-                int x;
-                if( j + 9 > dsize ) {
-                    /* do not overflow buffer in case it's too small */
-                    d = data;
-                }
-                x = snprintf(d, dsize - j, "%.6g ", s[i * 4 + idx]);
-                if ( x < 0 )
-                    return RC(rcSRA, rcString, rcConstructing, rcMemory, rcInsufficient);
-                d += x;
-                j += x;
-            }
-            *d = '\0';
-            --j;
-        }
-    }
-    if( written != NULL ) {
-        *written = j;
-    }
-    if( j >= dsize ) {
-        rc = RC(rcSRA, rcString, rcConstructing, rcMemory, rcInsufficient);
-    }
-    return rc;
-
-}
-
-LIB_EXPORT rc_t CC AbsolidReaderSignalFTC(const AbsolidReader* self, uint32_t readId, char* data, size_t dsize, size_t* written)
-{
-    return AbsolidReaderSignal(self, readId, 0, data, dsize, written);
-}
-
-LIB_EXPORT rc_t CC AbsolidReaderSignalCY3(const AbsolidReader* self, uint32_t readId, char* data, size_t dsize, size_t* written)
-{
-    return AbsolidReaderSignal(self, readId, 1, data, dsize, written);
-}
-
-LIB_EXPORT rc_t CC AbsolidReaderSignalTXR(const AbsolidReader* self, uint32_t readId, char* data, size_t dsize, size_t* written)
-{
-    return AbsolidReaderSignal(self, readId, 2, data, dsize, written);
-}
-
-LIB_EXPORT rc_t CC AbsolidReaderSignalCY5(const AbsolidReader* self, uint32_t readId, char* data, size_t dsize, size_t* written)
-{
-    return AbsolidReaderSignal(self, readId, 3, data, dsize, written);
-}
diff --git a/libs/sra/reader-cmn.c b/libs/sra/reader-cmn.c
deleted file mode 100644
index dff7544..0000000
--- a/libs/sra/reader-cmn.c
+++ /dev/null
@@ -1,379 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <sra/extern.h>
-#include <klib/rc.h>
-#include <klib/log.h>
-#include <sra/types.h>
-#include <os-native.h>
-#include <sysalloc.h>
-
-#include "sra-debug.h"
-#include "reader-cmn.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-/* mandatory columns used by generic reader */
-/* column order is IMPORTANT here: see Init function below!!! */
-static
-const SRAReaderColumn SRAReader_mandatory_cols[] = {
-    {SRAREADER_COL_OPTIONAL, "NAME", "ascii", NULL, NULL, 0},
-    {SRAREADER_COL_MANDATORY, "SPOT_LEN", "INSDC:coord:len", NULL, NULL, 0},
-    {SRAREADER_COL_MANDATORY, "READ_START", "INSDC:coord:zero", NULL, NULL, 0},
-    {SRAREADER_COL_MANDATORY, "READ_LEN", "INSDC:coord:len", NULL, NULL, 0},
-    {SRAREADER_COL_MANDATORY, "READ_TYPE", sra_read_type_t, NULL, NULL, 0},
-    {SRAREADER_COL_OPTIONAL, "LABEL", vdb_ascii_t, NULL, NULL, 0},
-    {SRAREADER_COL_OPTIONAL, "LABEL_START", "INSDC:coord:zero", NULL, NULL, 0},
-    {SRAREADER_COL_OPTIONAL, "LABEL_LEN", "INSDC:coord:len", NULL, NULL, 0},
-};
-
-static
-rc_t SRAReader_ColumnsOpen(SRAReader *self)
-{
-    rc_t rc = 0;
-    int i = 0;
-
-    while(self->cols[i].name != NULL) {
-        if( self->cols[i].opt == SRAREADER_COL_MANDATORY || (self->options & self->cols[i].opt) ) {
-            rc = SRATableOpenColumnRead(self->table, &self->cols[i].col, self->cols[i].name, self->cols[i].datatype);
-            if( rc != 0 ) {
-                if( ((self->cols[i].opt & SRAREADER_COL_OPTIONAL) && GetRCState(rc) == rcNotFound) ) {
-                    PLOGERR(klogInfo, (klogWarn, rc, "column $(c)", PLOG_S(c), self->cols[i].name));
-                    rc = 0;
-                } else if( GetRCState(rc) == rcExists ) {
-                    rc = 0;
-                } else {
-                    PLOGERR(klogInfo, (klogErr, rc, "column $(c)", PLOG_S(c), self->cols[i].name));
-                    break;
-                }
-            }
-        }
-        i++;
-    }
-    return rc;
-}
-
-static rc_t SRAReader_ColumnsRead( SRAReader * self )
-{
-    rc_t rc = 0;
-    int i = 0;
-
-    while ( self->cols[ i ].name != NULL )
-    {
-        if ( self->cols[ i ].col != NULL )
-        {
-            bitsz_t bitofs = 0;
-            rc = SRAColumnRead( self->cols[ i ].col, self->spot, &self->cols[ i ].base, &bitofs, &self->cols[ i ].size );
-            if ( rc != 0 || bitofs != 0 )
-            {
-                SRADBG (( "%s: read column %s spot %u %R\n", __func__, self->cols[i].name, self->spot, rc ));
-                break;
-            }
-        }
-        self->cols[ i ].size /= 8;
-        i++;
-    }
-    return rc;
-}
-
-static
-void SRAReader_ColumnsRelease(SRAReader *self)
-{
-    rc_t rc = 0;
-    int i = 0;
-
-    while(self->cols[i].name != NULL) {
-        if(self->cols[i].col != NULL && (rc = SRAColumnRelease(self->cols[i].col)) != 0) {
-            SRADBG (("%s: release column %s %R\n",
-                     __func__, self->cols[i].name, rc));
-        }
-        self->cols[i++].col = NULL;
-    }
-}
-
-static
-rc_t SRAReaderAlloc(SRAReader** reader, size_t size, const char* accession)
-{
-    if( reader == NULL || size < sizeof(**reader) || accession == NULL || accession[0] == '\0' ) {
-        return RC(rcSRA, rcFormatter, rcConstructing, rcParam, rcNull);
-    }
-    *reader = calloc(1, size);
-    if( *reader == NULL ) {
-        return RC(rcSRA, rcFormatter, rcConstructing, rcMemory, rcExhausted);
-    } else {
-		(*reader)->accession = strdup(accession);
-        if( (*reader)->accession == NULL ) {
-            free(*reader);
-            *reader = NULL;
-            return RC(rcSRA, rcFormatter, rcConstructing, rcMemory, rcExhausted);
-        }
-    }
-    return 0;
-}
-
-rc_t SRAReaderInit(const SRAReader* self, int options, const SRAReaderColumn* const cols)
-{
-    rc_t rc = 0;
-    int i = 0, j = 0, m = sizeof(SRAReader_mandatory_cols) / sizeof(SRAReaderColumn);
-    const SRAReaderColumn* col_read_len;
-
-    CHECK_SELF(SRAReader);
-    if( cols == NULL ) {
-        return RC(rcSRA, rcFormatter, rcConstructing, rcParam, rcNull);
-    }
-    me->options = SRAREADER_COL_OPTIONAL | options; /* always try to open optional cols */
-    /* copy mandatory columns */
-    memcpy(me->cols, SRAReader_mandatory_cols, sizeof(SRAReader_mandatory_cols));
-    /* copy reader specific columns */
-    for(i = 0; cols[i].name != NULL && m < 64; i++, m++) {
-        for(j = 0; j < m; j++) {
-            if( strcmp(cols[i].name, self->cols[j].name) == 0 &&
-                strcmp(cols[i].datatype, self->cols[j].datatype) == 0 ) {
-                return RC(rcSRA, rcFormatter, rcConstructing, rcData, rcDuplicate);
-            }
-        }
-        memcpy(&me->cols[m], &cols[i], sizeof(SRAReaderColumn));
-    }
-    if( (rc = SRAReader_ColumnsOpen(me)) == 0 &&
-        (rc = SRAReader_FindColData(me, &SRAReader_mandatory_cols[0], &me->spot_name, NULL)) == 0 &&
-        (rc = SRAReader_FindColData(me, &SRAReader_mandatory_cols[1], NULL, (const void***)&self->spot_len)) == 0 &&
-        (rc = SRAReader_FindColData(me, &SRAReader_mandatory_cols[2], NULL, (const void***)&self->read_start)) == 0 &&
-        (rc = SRAReader_FindColData(me, &SRAReader_mandatory_cols[3], NULL, (const void***)&self->read_len)) == 0 &&
-        (rc = SRAReader_FindColData(me, &SRAReader_mandatory_cols[3], &col_read_len, NULL)) == 0 &&
-        (rc = SRAReader_FindColData(me, &SRAReader_mandatory_cols[4], NULL, (const void***)&self->read_type)) == 0 &&
-        (rc = SRAReader_FindColData(me, &SRAReader_mandatory_cols[5], NULL, (const void***)&self->label)) == 0 &&
-        (rc = SRAReader_FindColData(me, &SRAReader_mandatory_cols[6], NULL, (const void***)&self->label_start)) == 0 &&
-        (rc = SRAReader_FindColData(me, &SRAReader_mandatory_cols[7], NULL, (const void***)&self->label_len)) == 0 ) {
-        ((SRAReader*)self)->read_len_size = &col_read_len->size;
-    }
-    return rc;
-}
-
-rc_t SRAReaderMake(const SRAReader** self, size_t size, const SRATable* table,
-                   const char* accession, spotid_t minSpotId, spotid_t maxSpotId)
-{
-    rc_t rc = 0;
-    SRAReader* me = NULL;
-
-    if( table == NULL ) {
-        rc = RC(rcSRA, rcFormatter, rcConstructing, rcParam, rcNull);
-    } else {
-        if( (rc = SRAReaderAlloc(&me, size, accession)) == 0 ) {
-            me->table = table;
-            if( (rc = SRATableMinSpotId(me->table, &me->minSpotId)) == 0 &&
-                (rc = SRATableMaxSpotId(me->table, &me->maxSpotId)) == 0 ) {
-                if( rc == 0 && minSpotId > 0 && (rc = SRAReaderSeekSpot(me, minSpotId)) == 0 ) {
-                    me->minSpotId = minSpotId;
-                }
-                if( rc == 0 && maxSpotId > 0 && (rc = SRAReaderSeekSpot(me, maxSpotId)) == 0 ) {
-                    me->maxSpotId = maxSpotId;
-                }
-            }
-            /* reset after seekspot to initial state */
-            me->spot = 0;
-        }
-    }
-    if( rc != 0 ) {
-        SRAReaderWhack(me);
-    } else {
-        *self = me;
-    }
-    return rc;
-}
-
-rc_t SRAReaderWhack ( const SRAReader* self )
-{
-    if( self != NULL) {
-        SRAReader* me = (SRAReader*)self;
-        SRAReader_ColumnsRelease(me);
-        free(me->accession);
-        free(me);
-    }
-    return 0;
-}
-
-rc_t SRAReader_FindColData ( const SRAReader* self,
-        const SRAReaderColumn* definition, const SRAReaderColumn** col, const void*** base )
-{
-    int i;
-
-    CHECK_SELF(SRAReader);
-    if( definition == NULL || (col == NULL && base == NULL) ) {
-        return RC(rcSRA, rcFormatter, rcAccessing, rcParam, rcNull);
-    }
-    if( definition->opt != 0 && !(self->options & definition->opt) ) {
-        return 0;
-    }
-    for(i = 0; me->cols[i].name != NULL; i++) {
-        if( self->cols[i].col != NULL &&
-            strcmp(self->cols[i].name, definition->name) == 0 &&
-            strcmp(self->cols[i].datatype, definition->datatype) == 0 ) {
-            if( col != NULL ) {
-                *col = &self->cols[i];
-            } else {
-                *base = (const void**)&self->cols[i].base;
-            }
-            return 0;
-        }
-    }
-    return (definition->opt & SRAREADER_COL_OPTIONAL) ? 0 : RC(rcSRA, rcFormatter, rcAccessing, rcColumn, rcNotFound);
-}
-
-rc_t SRAReaderFirstSpot ( const SRAReader* self )
-{
-    CHECK_SELF(SRAReader);
-    return SRAReaderSeekSpot(me, self->minSpotId);
-}
-
-rc_t SRAReaderSeekSpot ( const SRAReader* self, spotid_t spot )
-{
-    rc_t rc = 0;
-
-    CHECK_SELF(SRAReader);
-
-    if( spot < self->minSpotId ) {
-        return RC(rcSRA, rcFormatter, rcAccessing, rcRow, rcTooShort);
-    }
-    if( spot > self->maxSpotId ) {
-        return RC(rcSRA, rcFormatter, rcAccessing, rcRow, rcTooBig);
-    }
-    if( me->spot != spot ) {
-        me->spot = spot;
-        if( (rc = SRAReader_ColumnsRead(me)) != 0 ) {
-            me->spot = 0;
-        }
-    }
-    return rc;
-}
-
-rc_t SRAReaderNextSpot( const SRAReader* self )
-{
-    rc_t rc = 0;
-
-    CHECK_SELF(SRAReader);
-    CHECK_SPOT(*self);
-
-    me->spot++;
-    while( me->spot <= self->maxSpotId ) {
-        if( (rc = SRAReader_ColumnsRead(me)) == 0 ) {
-            return 0;
-        }
-        if( GetRCState(rc) != rcNotFound ) {
-            me->spot = 0;
-            return rc;
-        }
-        me->spot++;
-    }
-    CHECK_SPOT(*self);
-    return 0;
-}
-
-rc_t SRAReaderCurrentSpot( const SRAReader* self, spotid_t* spot)
-{
-    CHECK_SELF(SRAReader);
-    if( spot == NULL ) {
-        return RC(rcSRA, rcFormatter, rcAccessing, rcParam, rcNull);
-    }
-    CHECK_SPOT(*self);
-    *spot = me->spot;
-    return 0;
-}
-
-rc_t SRAReader_SpotInfo( const SRAReader* self, const char** spotname, size_t* spotname_sz,
-                                                uint32_t* spot_len, uint32_t* num_reads )
-{
-    CHECK_SELF(SRAReader);
-    CHECK_SPOT(*self);
-
-    if( spotname && !spotname_sz ) {
-        return RC(rcSRA, rcFormatter, rcAccessing, rcParam, rcInvalid);
-    }
-    if( spotname ) {
-        if( me->spot_name ) {
-            *spotname = me->spot_name->base;
-            *spotname_sz = me->spot_name->size;
-	        if( *spotname && *spotname_sz && (*spotname)[*spotname_sz - 1] == '\0' ) {
-	            /* Consider zero-padded spotname */
-	            *spotname_sz = strlen(*spotname);
-	        }
-        } else {
-            *spotname = "";
-            *spotname_sz = 0;
-        }
-    }
-    if( spot_len ) {
-        *spot_len = **self->spot_len;
-    }
-    if( num_reads ) {
-        *num_reads = (*self->read_len_size) / sizeof(**self->read_len);
-    }
-    return 0;
-}
-
-rc_t SRAReader_SpotReadInfo( const SRAReader* self, uint32_t readId, SRAReadTypes* read_type,
-                             const char** read_label, INSDC_coord_len* read_label_sz,
-                             INSDC_coord_zero* read_start, INSDC_coord_len* read_len )
-{
-    CHECK_SELF(SRAReader);
-    CHECK_SPOT(*self);
-
-    if( read_label && !read_label_sz ) {
-        return RC(rcSRA, rcFormatter, rcAccessing, rcParam, rcInvalid);
-    }
-    if( readId < 1 || readId > ((*(me->read_len_size)) / sizeof(**self->read_len)) ) {
-        return RC(rcSRA, rcTable, rcReading, rcId, rcInvalid);
-    }
-    --readId;
-    if( read_start ) {
-        *read_start = (*self->read_start)[readId];
-    }
-    if( read_len ) {
-        *read_len = (*self->read_len)[readId];
-    }
-    if( read_type ) {
-        *read_type = (*self->read_type)[readId];
-    }
-    if( read_label ) {
-        if( self->label && self->label_start && self->label_len ) {
-            *read_label = &((*self->label)[(*self->label_start)[readId]]);
-            *read_label_sz = (*self->label_len)[readId];
-        } else {
-            *read_label = "";
-            *read_label_sz = 0;
-        }
-    }
-    return 0;
-}
-
-rc_t SRAReader_GetCurrentSpotData( const SRAReader* self, char *data, size_t dsize, size_t* written )
-{
-    return RC(rcSRA, rcFormatter, rcReading, rcInterface, rcIncomplete);
-}
-
-rc_t SRAReader_GetNextSpotData( const SRAReader* self, char *data, size_t dsize, size_t* written )
-{
-    return RC(rcSRA, rcFormatter, rcReading, rcInterface, rcIncomplete);
-}
diff --git a/libs/sra/reader-cmn.h b/libs/sra/reader-cmn.h
deleted file mode 100644
index 21a5b9e..0000000
--- a/libs/sra/reader-cmn.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifndef _h_sra_reader_
-#define _h_sra_reader_
-
-#ifndef _h_sra_sradb_
-#include <sra/sradb.h>
-#endif
-
-#define SRAREADER_COL_MANDATORY 0x00
-#define SRAREADER_COL_OPTIONAL 0x01
-
-typedef struct SRAReaderColumn_struct {
-    uint32_t opt;
-    const char* name;
-    const char* datatype;
-    const SRAColumn* col;
-    const void* base;
-    bitsz_t size;
-} SRAReaderColumn;
-
-typedef struct SRAReader_struct {
-    char* accession;
-    const SRATable* table;
-    spotid_t minSpotId;
-    spotid_t maxSpotId;
-    uint32_t options;
-    SRAReaderColumn cols[64]; /* max of 64 columns, must be enough, last one must have NULL name */
-    /* current spot data */
-    spotid_t spot;
-    const SRAReaderColumn* spot_name;
-    const INSDC_coord_len** spot_len;
-    const INSDC_coord_zero** read_start;
-    const INSDC_coord_len** read_len;
-    const bitsz_t* read_len_size;
-    const SRAReadTypes** read_type;
-    const char** label;
-    const INSDC_coord_zero** label_start;
-    const INSDC_coord_len** label_len;
-} SRAReader;
-
-/* Common macro for self pointer and current spot state validation */
-#define CHECK_SELF(ObjType) \
-                   ObjType* me = (ObjType*)self; \
-                   if(self == NULL) { \
-                       return RC(rcSRA, rcFormatter, rcAccessing, rcSelf, rcNull); \
-                   }
-
-#define CHECK_SPOT(Obj) \
-                   if( (Obj).spot < (Obj).minSpotId ) { \
-                       return RC(rcSRA, rcFormatter, rcAccessing, rcRow, rcUnknown); \
-                   } \
-                   if( (Obj).spot > (Obj).maxSpotId ) { \
-                       return RC(rcSRA, rcFormatter, rcAccessing, rcRow, rcExhausted); \
-                   }
-
-rc_t SRAReaderMake(const SRAReader** self, size_t size, const SRATable* table,
-                   const char* accession, spotid_t minSpotId, spotid_t maxSpotId);
-
-rc_t SRAReaderInit(const SRAReader* self, int options, const SRAReaderColumn* const cols);
-
-/* Whack
- *  releases object obtained from SRAReaderMake
- *  or AddRef ( see above )
- */
-rc_t SRAReaderWhack(const SRAReader *self);
-
-/* FindColData
- * find OPENED column by it's definition and return it's base pointer or col struct
- */
-rc_t SRAReader_FindColData(const SRAReader* self, const SRAReaderColumn* definition, const SRAReaderColumn** col, const void*** base);
-
-/* FirstSpot
- *  set current spot to first in the run
- */
-rc_t SRAReaderFirstSpot(const SRAReader* self);
-
-/* SeekSpot
- *  set current spot
- * if error occured current spot position becomes 0
- */
-rc_t SRAReaderSeekSpot(const SRAReader* self, spotid_t spot);
-
-/* NextSpot
- *  Seek to next spot from current
- */
-rc_t SRAReaderNextSpot(const SRAReader* self);
-
-/* CurrentSpot
- *  Get current spot
- *  sopt [OUT] - pointer to assign value of the current spot
- * returns GetRCState(rc) == rcExhausted when out of spots
- */
-rc_t SRAReaderCurrentSpot(const SRAReader* self, spotid_t* spot);
-
-/* SpotInfo
- *  Get current spot information
- *  spotname [OUT] - pointer to assign value of the current spot name (can be NULL)
- *  spotname_sz [OUT] - pointer to assign value of the length of the spot name (can be NULL)
- *  spot_len [OUT] - pointer to assign value of the current spot length (can be NULL)
- *  num_reads[OUT] - pointer to assign value of the number of reads in current spot (can be NULL)
- */
-rc_t SRAReader_SpotInfo(const SRAReader* self, const char** spotname, size_t* spotname_sz,
-                                               uint32_t* spot_len, uint32_t* num_reads);
-
-/* SpotReadInfo
- *  Get read information for current spot
- *  readid    [IN]  - 1-based read id
- *  read_type [OUT] - pointer to assign value of the read type (can be NULL)
- *  read_label[OUT] - pointer to assign value of the read label (can be NULL)
- *  read_label_sz [OUT] - pointer to assign value of the length of the read label (can be NULL)
- *  read_start[OUT] - pointer to assign value of the read start in spot (can be NULL)
- *  read_len  [OUT] - pointer to assign value of the read length (can be NULL)
- *  if start and len is == 0 read is empty
- */
-rc_t SRAReader_SpotReadInfo(const SRAReader* self, uint32_t readId, SRAReadTypes* read_type,
-                            const char** read_label, INSDC_coord_len* read_label_sz,
-                            INSDC_coord_zero* read_start, INSDC_coord_len* read_len);
-
-/* GetCurrentSpotData
- *  retrieve current spot data as a blob
- *  data   [IN] - pointer to buffer for printing
- *  dsize  [IN] - data buffer size
- *  written [IN,OUT] - optional number of bytes occupied by buffer, may by more than dsize
- *  MUST BE SEPARATELY DEFINED for each reader format
- */
-rc_t SRAReader_GetCurrentSpotData(const SRAReader* self, char *data, size_t dsize, size_t* written);
-
-/* GetNextSpotData (streaming function)
- *  move to the next spot and retrieve current spot data as a blob
- *  data   [IN] - pointer to buffer for printing
- *  dsize  [IN] - data buffer size
- *  written [IN,OUT] - optional number of bytes occupied by buffer, may by more than dsize
- *  MUST BE SEPARATELY DEFINED for each reader format
- */
-rc_t SRAReader_GetNextSpotData(const SRAReader* self, char *data, size_t dsize, size_t* written);
-
-#endif /* _h_sra_reader_ */
diff --git a/libs/sra/reader-fastq.c b/libs/sra/reader-fastq.c
deleted file mode 100644
index 6a59a6b..0000000
--- a/libs/sra/reader-fastq.c
+++ /dev/null
@@ -1,622 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <sra/rd-extern.h>
-
-#include <klib/rc.h>
-#include <sra/types.h>
-#include <sra/fastq.h>
-#include <os-native.h>
-#include <sysalloc.h>
-
-#include "reader-cmn.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-
-typedef enum FastqReaderOptions_enum {
-    eBaseSpace   = 0x02,
-    eColorSpace  = 0x04,
-    eOrigFormat  = 0x08,
-    ePrintLabel  = 0x10,
-    ePrintReadId = 0x20,
-    eClipQual    = 0x40,
-    eUseQual     = 0x80,
-    eSuppressQualForCSKey   = 0x100     /* added Jan 15th 2014 ( a new fastq-variation! ) */
-} FastqReaderOptions;
-
-/* column order is important here: see Init function below!!! */
-static
-const SRAReaderColumn FastqReader_master_columns_desc[] = {
-    {eBaseSpace, "READ", insdc_fasta_t, NULL, NULL, 0},
-    {eColorSpace, "CSREAD", insdc_csfasta_t, NULL, NULL, 0},
-    {eColorSpace, "CS_KEY", insdc_fasta_t, NULL, NULL, 0},
-    {eUseQual, "QUALITY", insdc_phred_t, NULL, NULL, 0},
-    {SRAREADER_COL_OPTIONAL, "SPOT_GROUP", vdb_ascii_t, NULL, NULL, 0},
-    {eClipQual, "TRIM_START", "INSDC:coord:zero", NULL, NULL, 0},
-    {eClipQual, "TRIM_LEN", "INSDC:coord:len", NULL, NULL, 0},
-    {SRAREADER_COL_MANDATORY, NULL, NULL, NULL, NULL, 0} /* terminator */
-};
-
-struct FastqReader {
-    /* SRAReader always must be a first member! */
-    SRAReader dad;
-    uint32_t minReadLen;
-    int offset;
-    char csKey;
-    /* current spot data shortcuts */
-    const SRAReaderColumn* read;
-    const SRAReaderColumn* csread;
-    const char** cs_key;
-    const uint8_t** qual1;
-    const SRAReaderColumn* spot_group;
-    const INSDC_coord_zero** trim_start;
-    const INSDC_coord_len** trim_len;
-    /* quality conversion table */
-    char q2ascii[256];
-};
-
-static
-rc_t FastqReaderInit(const FastqReader* self,
-                     bool colorSpace, bool origFormat, bool fasta, bool printLabel, bool printReadId,
-                     bool noClip, bool SuppressQualForCSKey, uint32_t minReadLen, int offset, char csKey)
-{
-    rc_t rc = 0;
-    int options = colorSpace ? eColorSpace : eBaseSpace;
-
-    CHECK_SELF(FastqReader);
-
-    options |= origFormat ? eOrigFormat : 0;
-    options |= printLabel ? ePrintLabel : 0;
-    options |= printReadId ? ePrintReadId : 0;
-    options |= noClip ? 0 : eClipQual;
-    options |= fasta ? 0 : eUseQual;
-    options |= SuppressQualForCSKey ? eSuppressQualForCSKey : 0; /* added Jan 15th 2014 ( a new fastq-variation! ) */
-
-    me->minReadLen = minReadLen;
-    me->offset = offset > 0 ? offset : 33;
-    me->csKey = csKey;
-
-    if( (rc = SRAReaderInit(&self->dad, options, FastqReader_master_columns_desc)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &FastqReader_master_columns_desc[0], &me->read, NULL)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &FastqReader_master_columns_desc[1], &me->csread, NULL)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &FastqReader_master_columns_desc[2], NULL, (const void***)&self->cs_key)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &FastqReader_master_columns_desc[3], NULL, (const void***)&self->qual1)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &FastqReader_master_columns_desc[4], &me->spot_group, NULL)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &FastqReader_master_columns_desc[5], NULL, (const void***)&self->trim_start)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &FastqReader_master_columns_desc[6], NULL, (const void***)&self->trim_len)) == 0 ) {
-        memset(me->q2ascii, '~', sizeof(self->q2ascii));
-        for(options = 0; options < 256; options++) {
-            me->q2ascii[options] = options + self->offset;
-            if( self->q2ascii[options] == '~' ) {
-                break;
-            }
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC FastqReaderMake(const FastqReader** self, const SRATable* table, const char* accession,
-                                   bool colorSpace, bool origFormat, bool fasta, bool printLabel, bool printReadId,
-                                   bool noClip, bool SuppressQualForCSKey, uint32_t minReadLen, char offset, char csKey,
-                                   spotid_t minSpotId, spotid_t maxSpotId)
-{
-    rc_t rc = SRAReaderMake((const SRAReader**)self, sizeof **self, table, accession, minSpotId, maxSpotId);
-
-    if( rc == 0 ) {
-        rc = FastqReaderInit(*self, colorSpace, origFormat, fasta,
-                             printLabel, printReadId, noClip, SuppressQualForCSKey, minReadLen, offset, csKey);
-    }
-    if( rc != 0 ) {
-        FastqReaderWhack(*self);
-        *self = NULL;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC FastqReaderWhack(const FastqReader* self)
-{
-    return SRAReaderWhack(&self->dad);
-}
-
-LIB_EXPORT rc_t CC FastqReaderFirstSpot(const FastqReader* self)
-{
-    return SRAReaderFirstSpot(&self->dad);
-}
-
-LIB_EXPORT rc_t CC FastqReaderSeekSpot(const FastqReader* self, spotid_t spot)
-{
-    return SRAReaderSeekSpot(&self->dad, spot);
-}
-
-LIB_EXPORT rc_t CC FastqReaderNextSpot(const FastqReader* self)
-{
-    return SRAReaderNextSpot(&self->dad);
-}
-
-LIB_EXPORT rc_t CC FastqReaderCurrentSpot(const FastqReader* self, spotid_t* spot)
-{
-    return SRAReaderCurrentSpot(&self->dad, spot);
-}
-
-LIB_EXPORT rc_t CC FastqReader_SpotInfo(const FastqReader* self,
-                                        const char** spotname, size_t* spotname_sz,
-                                        const char** spotgroup, size_t* spotgroup_sz,
-                                        uint32_t* spot_len, uint32_t* num_reads)
-{
-    rc_t rc = SRAReader_SpotInfo(&self->dad, spotname, spotname_sz, spot_len, num_reads);
-    if( rc == 0 ) {
-        if( spotgroup && !spotgroup_sz ) {
-            return RC(rcSRA, rcFormatter, rcAccessing, rcParam, rcInvalid);
-        }
-        if( spot_len ) {
-            if( self->dad.options & eClipQual ) {
-                *spot_len = **self->trim_len;
-            }
-            if( *spot_len < self->minReadLen ) {
-                *spot_len = 0;
-            }
-        }
-        if( spotgroup ) {
-            if( self->spot_group != NULL ) {
-                *spotgroup = self->spot_group->base;
-                *spotgroup_sz = self->spot_group->size;
-                if(*spotgroup && *spotgroup_sz && (*spotgroup)[*spotgroup_sz - 1] == '\0' ) {
-                    /* Consider zero-padded spotgroup */
-                    *spotgroup_sz = strlen(*spotgroup);
-                }
-            } else {
-                *spotgroup = NULL;
-                *spotgroup_sz = 0;
-            }
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC FastqReader_SpotReadInfo(const FastqReader* self, uint32_t readId, SRAReadTypes* read_type, 
-                                            const char** read_label, INSDC_coord_len* read_label_sz,
-                                            INSDC_coord_zero* read_start, INSDC_coord_len* read_len)
-{
-    INSDC_coord_zero rs;
-    INSDC_coord_len rl;
-
-    rc_t rc = SRAReader_SpotReadInfo(&self->dad, readId, read_type, read_label, read_label_sz, &rs, &rl);
-    if( rc == 0 ) {
-        if( read_start || read_len ) {
-            if( self->dad.options & eClipQual ) {
-                INSDC_coord_zero end = rs + rl - 1;
-                INSDC_coord_zero trim_end = ((**self->trim_start) + (**self->trim_len)) - 1;
-                if( end < (**self->trim_start) || rs > trim_end ) {
-                    rl = 0;
-                } else {
-                    if( (**self->trim_start) > rs && (**self->trim_start) <= end ) {
-                        rl -= (**self->trim_start) - rs;
-                        rs = (**self->trim_start);
-                    }
-                    if( end > trim_end ) {
-                        rl = trim_end - rs + 1;
-                    }
-                }
-            }
-            if( rl < self->minReadLen ) {
-                rl = 0;
-            }
-            if( read_start ) {
-                *read_start = rl ? rs : 0;
-            }
-            if( read_len ) {
-                *read_len = rl;
-            }
-        }
-    }
-    return rc;
-}
-
-static
-rc_t FastqReader_Header(const FastqReader* self, bool* label, 
-                        char* buf, size_t maxlen, size_t* written,
-                        char prefix, int readId)
-{
-    rc_t rc = 0;
-    int ret = 0;
-
-    const char* spotname;
-    size_t x;
-    int spotname_sz;
-    uint32_t spot_len;
-    uint32_t num_reads;
-    INSDC_coord_len read_len, read_label_sz = 0;
-    const char* read_label;
-    bool addLabel = label ? *label : (self->dad.options & ePrintLabel);
-
-    if( (rc = FastqReader_SpotInfo(self, &spotname, &x, NULL, NULL, &spot_len, &num_reads)) != 0 ) {
-        return rc;
-    }
-    spotname_sz = (int)x;
-    if( readId > 0 ) {
-        if( (rc = FastqReader_SpotReadInfo(self, readId, NULL, &read_label, &read_label_sz, NULL, &read_len)) != 0 ) {
-            return rc;
-        }
-    }
-    /* do not add empty labels */
-    addLabel = read_label_sz > 0 ? addLabel : false;
-
-    if( self->dad.options & eOrigFormat ) {
-        char tmp[1024];
-        if( spotname_sz == 0 ) {
-            ret = snprintf(tmp, sizeof(tmp) - 1, "%s.%u", self->dad.accession, self->dad.spot);
-            if ( ret < 0 )
-                return RC ( rcSRA, rcString, rcConstructing, rcData, rcCorrupt );
-            spotname = tmp;
-            spotname_sz = ret;
-        }
-        if( addLabel && readId > 0 ) {
-            ret = snprintf(buf, maxlen, "%c%.*s_%.*s", prefix, spotname_sz, spotname, read_label_sz, read_label);
-        } else {
-            ret = snprintf(buf, maxlen, "%c%.*s", prefix, spotname_sz, spotname);
-        }
-    } else {
-        const char* sep = spotname_sz ? " " : "";
-        if( addLabel && readId > 0 ) {
-            sep = spotname_sz ? "_" : "";
-            if( self->dad.options & ePrintReadId ) {
-                ret = snprintf(buf, maxlen, "%c%s.%u.%d %.*s%s%.*s length=%d",
-                    prefix, self->dad.accession, self->dad.spot, readId, spotname_sz, spotname, sep, read_label_sz, read_label, read_len);
-            } else {
-                ret = snprintf(buf, maxlen, "%c%s.%u %.*s%s%.*s length=%d",
-                    prefix, self->dad.accession, self->dad.spot, spotname_sz, spotname, sep, read_label_sz, read_label, read_len);
-            }
-        } else if( readId > 0 ) {
-            if( self->dad.options & ePrintReadId ) {
-                ret = snprintf(buf, maxlen, "%c%s.%u.%d %.*s%slength=%d",
-                    prefix, self->dad.accession, self->dad.spot, readId, spotname_sz, spotname, sep, read_len);
-            } else {
-                ret = snprintf(buf, maxlen, "%c%s.%u %.*s%slength=%d",
-                    prefix, self->dad.accession, self->dad.spot, spotname_sz, spotname, sep, read_len);
-            }
-        } else {
-            ret = snprintf(buf, maxlen, "%c%s.%u %.*s%slength=%u",
-                prefix, self->dad.accession, self->dad.spot, spotname_sz, spotname, sep, spot_len);
-        }
-    }
-
-#if SNPRINTF_ACTUALLY_WORKED_THE_WAY_YOU_THINK
-    if( ret < 0 ) {
-        ret = 0;
-        rc = RC(rcSRA, rcString, rcConstructing, rcMessage, rcUnknown);
-    } else if( ret >= (int)maxlen ) {
-#else
-    if( ret < 0 || ret >= (int)maxlen ) {
-#endif
-        rc = RC(rcSRA, rcString, rcConstructing, rcMemory, rcInsufficient);
-    }
-    if( written != NULL ) {
-        *written = ret;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC FastqReaderBaseName(const FastqReader* self, uint32_t readId,
-                                       bool* label, char* data, size_t dsize, size_t* written)
-{
-    rc_t rc = 0;
-
-    CHECK_SELF(FastqReader);
-    CHECK_SPOT(self->dad);
-    rc = FastqReader_Header(me, label, data, dsize, written, '@', readId);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC FastqReaderQualityName(const FastqReader* self, uint32_t readId,
-                                          bool* label, char* data, size_t dsize, size_t* written)
-{
-    rc_t rc = 0;
-
-    CHECK_SELF(FastqReader);
-    CHECK_SPOT(self->dad);
-    if( self->qual1 == NULL ) {
-        rc = RC(rcSRA, rcString, rcConstructing, rcMode, rcNotAvailable);
-    } else {
-        rc = FastqReader_Header(me, label, data, dsize, written, '+', readId);
-    }
-    return rc;
-}
-
-
-#if _DEBUGGING && defined __GNUC__
-#pragma message "TBD determine if we need conversions between color spaces at all"
-#endif
-
-static
-rc_t FastqReader_CSconvert(char from, char to, char* first)
-{
-#define CSKEY2IDX(k) (k == 'A' ? 0 : (k == 'C' ? 1 : (k == 'G' ? 2 : (k == 'T' ? 3 : -1))))
-
-    const char* x[4][4] = {
-        /*   TO:      A       C       G       T   */
-        /* F: A */ {"0123", "1032", "2301", "3210"},
-        /* R: C */ {"1032", "0123", "3210", "2301"},
-        /* O: G */ {"2301", "3210", "0123", "1032"},
-        /* M: T */ {"3210", "2301", "1032", "0123"}};
-
-    if( to != '\0' && *first != '.' && toupper(*first) != 'N' ) {
-        int ifrom = CSKEY2IDX(toupper(from));
-        int ito = CSKEY2IDX(toupper(to));
-        int ifirst = *first - '0';
-
-        if( ifrom < 0 || ito < 0 || ifirst < 0 || ifirst > 3 ) {
-            return RC(rcSRA, rcString, rcConverting, rcParam, rcInvalid);
-        }
-        *first = x[ifrom][ito][ifirst];
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC FastqReaderBase(const FastqReader* self, uint32_t readId, char* data, size_t dsize, size_t* written)
-{
-    rc_t rc = 0;
-    uint32_t num_reads;
-    INSDC_coord_zero read_start = 0;
-    INSDC_coord_len read_len = 0;
-
-    CHECK_SELF(FastqReader);
-    CHECK_SPOT(self->dad);
-
-    if( readId > 0 ) {
-        if( (rc = FastqReader_SpotReadInfo(self, readId--, NULL, NULL, NULL, &read_start, &read_len)) != 0 ) {
-            return rc;
-        }
-    } else if( (rc = FastqReader_SpotInfo(self, NULL, NULL, NULL, NULL, &read_len, &num_reads)) != 0 ) {
-        return rc;
-    } else if( (me->dad.options & eColorSpace) && num_reads > 2 ) {
-        return RC(rcSRA, rcFormatter, rcConstructing, rcFormat, rcUnsupported);
-    }
-    if( me->dad.options & eColorSpace ) {
-        read_len++;
-    }
-    if( written != NULL ) {
-        *written = read_len;
-    }
-    if( read_len >= dsize ) {
-        return RC(rcSRA, rcString, rcConstructing, rcMemory, rcInsufficient);
-    }
-    if( me->dad.options & eColorSpace ) {
-        const char* b = self->csread->base;
-        data[0] = me->csKey == '\0' ? (*self->cs_key)[readId] : me->csKey;
-        memcpy(&data[1], &b[read_start], read_len - 1);
-        if( read_len > 1 ) {
-            rc = FastqReader_CSconvert((*self->cs_key)[readId], data[0], &data[1]);
-        }
-    } else {
-        const char* b = self->read->base;
-        memcpy(data, &b[read_start], read_len);
-    }
-    data[read_len] = '\0';
-    return rc;
-}
-
-LIB_EXPORT rc_t CC FastqReaderQuality(const FastqReader* self, uint32_t readId, char* data, size_t dsize, size_t* written)
-{
-    rc_t rc = 0;
-    INSDC_coord_zero read_start = 0;
-    INSDC_coord_len read_len = 0;
-    bool print_quality_for_cskey = false; /* added Jan 15th 2014 ( a new fastq-variation! )*/
-
-    CHECK_SELF(FastqReader);
-    CHECK_SPOT(self->dad);
-
-    if( self->qual1 == NULL ) {
-        return RC(rcSRA, rcString, rcConstructing, rcMode, rcNotAvailable);
-    }
-    if( readId > 0 ) {
-        if( (rc = FastqReader_SpotReadInfo(self, readId, NULL, NULL, NULL, &read_start, &read_len)) != 0 ) {
-            return rc;
-        }
-    } else if( (rc = FastqReader_SpotInfo(self, NULL, NULL, NULL, NULL, &read_len, NULL)) != 0 ) {
-        return rc;
-    }
-
-    /* added Jan 15th 2014 ( a new fastq-variation! )*/
-    print_quality_for_cskey = ( ( me->dad.options & eColorSpace )&&( ( me->dad.options & eSuppressQualForCSKey ) == 0 ) );
-
-    if( read_len < self->minReadLen ) {
-        read_len = 0;
-    }
-    if( print_quality_for_cskey ) { /* changed Jan 15th 2014 ( a new fastq-variation! ) */
-        read_len++;
-    }
-    if( written != NULL ) {
-        *written = read_len;
-    }
-    if( read_len >= dsize ) {
-        rc = RC(rcSRA, rcString, rcConstructing, rcMemory, rcInsufficient);
-    } else {
-        const uint8_t* q = *self->qual1;
-        char* d = data;
-        INSDC_coord_len i, j;
-
-        if ( print_quality_for_cskey ) /* changed Jan 15th 2014 ( a new fastq-variation! ) */
-        {
-            *d++ = me->offset;
-            --read_len;
-        }
-        /* read end */
-        read_len += read_start;
-        for(j = 0, i = read_start; i < read_len; i++, j++) {
-            d[j] = self->q2ascii[q[i]];
-        }
-        d[j] = '\0';
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC FastqReader_GetCurrentSpotData(const FastqReader* self, char* data, size_t dsize, size_t* written)
-{
-    rc_t rc = 0;
-    size_t len = 0, left = dsize, w = 0;
-    char* b = data;
-
-    CHECK_SELF(FastqReader);
-    CHECK_SPOT(me->dad);
-
-    rc = FastqReaderBaseName(self, 0, NULL, b, left, &w);
-    len += ++w;
-    if( rc != 0 ) {
-        if( rc != 0 && !(GetRCObject(rc) == rcMemory && GetRCState(rc) == rcInsufficient) ) {
-            return rc;
-        }
-        b = data, left = dsize;
-    } else {
-        b[w - 1] = '\n'; b += w; left -= w;
-    }
-
-    rc = FastqReaderBase(self, 0, b, left, &w);
-    len += ++w;
-    if( rc != 0 ) {
-        if( rc != 0 && !(GetRCObject(rc) == rcMemory && GetRCState(rc) == rcInsufficient) ) {
-            return rc;
-        }
-        b = data, left = dsize;
-    } else {
-        b[w - 1] = '\n'; b += w; left -= w;
-    }
-    if( self->qual1 != NULL ) {
-        rc = FastqReaderQualityName(self, 0, NULL, b, left, &w);
-        len += ++w;
-        if( rc != 0 ) {
-            if( rc != 0 && !(GetRCObject(rc) == rcMemory && GetRCState(rc) == rcInsufficient) ) {
-                return rc;
-            }
-            b = data, left = dsize;
-        } else {
-            b[w - 1] = '\n'; b += w; left -= w;
-        }
-        rc = FastqReaderQuality(self, 0, b, left, &w);
-        len += ++w; b[w - 1] = '\n';
-        if( rc != 0 && !(GetRCObject(rc) == rcMemory && GetRCState(rc) == rcInsufficient) ) {
-            return rc;
-        }
-    }
-    if( written != NULL ) {
-        *written = len;
-    }
-    if( len > dsize ) {
-        rc = RC(rcSRA, rcString, rcConstructing, rcMemory, rcInsufficient);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC FastqReader_GetCurrentSpotSplitData(const FastqReader* self, char* data, size_t dsize, size_t* written)
-{
-    rc_t rc = 0;
-    size_t len = 0, left = dsize, w = 0;
-    char* b = data;
-    uint32_t r, num_reads;
-
-    CHECK_SELF(FastqReader);
-    CHECK_SPOT(me->dad);
-
-    if( (rc = FastqReader_SpotInfo(self, NULL, NULL, NULL, NULL, NULL, &num_reads)) != 0 ) {
-        return rc;
-    }
-    for(r = 1; r <= num_reads; r++) {
-        rc = FastqReaderBaseName(self, r, NULL, b, left, &w);
-        len += ++w;
-        if( rc != 0 ) {
-            if( rc != 0 && !(GetRCObject(rc) == rcMemory && GetRCState(rc) == rcInsufficient) ) {
-                return rc;
-            }
-            b = data, left = dsize;
-        } else {
-            b[w - 1] = '\n'; b += w; left -= w;
-        }
-        rc = FastqReaderBase(self, r, b, left, &w);
-        len += ++w;
-        if( rc != 0 ) {
-            if( rc != 0 && !(GetRCObject(rc) == rcMemory && GetRCState(rc) == rcInsufficient) ) {
-                return rc;
-            }
-            b = data, left = dsize;
-        } else {
-            b[w - 1] = '\n'; b += w; left -= w;
-        }
-        if( self->qual1 != NULL ) {
-            rc = FastqReaderQualityName(self, r, NULL, b, left, &w);
-            len += ++w;
-            if( rc != 0 ) {
-                if( rc != 0 && !(GetRCObject(rc) == rcMemory && GetRCState(rc) == rcInsufficient) ) {
-                    return rc;
-                }
-                b = data, left = dsize;
-            } else {
-                b[w - 1] = '\n'; b += w; left -= w;
-            }
-            rc = FastqReaderQuality(self, r, b, left, &w);
-            len += ++w;
-            if( rc != 0 ) {
-                if( rc != 0 && !(GetRCObject(rc) == rcMemory && GetRCState(rc) == rcInsufficient) ) {
-                    return rc;
-                }
-                b = data, left = dsize;
-            } else {
-                b[w - 1] = '\n'; b += w; left -= w;
-            }
-        }
-    }
-
-    if( written != NULL ) {
-        *written = len;
-    }
-    if( len > dsize ) {
-        rc = RC(rcSRA, rcString, rcConstructing, rcMemory, rcInsufficient);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC FastqReader_GetNextSpotData(const FastqReader* self, char* data, size_t dsize, size_t* written)
-{
-    rc_t rc = FastqReaderNextSpot(self);
-    if( GetRCObject(rc) == rcRow && GetRCState(rc) == rcUnknown ) {
-        rc = FastqReaderFirstSpot(self);
-    }
-    if( rc == 0 ) {
-        rc = FastqReader_GetCurrentSpotData(self, data, dsize, written);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC FastqReader_GetNextSpotSplitData(const FastqReader* self, char* data, size_t dsize, size_t* written)
-{
-    rc_t rc = FastqReaderNextSpot(self);
-    if( GetRCObject(rc) == rcRow && GetRCState(rc) == rcUnknown ) {
-        rc = FastqReaderFirstSpot(self);
-    }
-    if( rc == 0 ) {
-        rc = FastqReader_GetCurrentSpotSplitData(self, data, dsize, written);
-    }
-    return rc;
-}
diff --git a/libs/sra/reader-illumina.c b/libs/sra/reader-illumina.c
deleted file mode 100644
index 4c4e6d3..0000000
--- a/libs/sra/reader-illumina.c
+++ /dev/null
@@ -1,565 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <sra/rd-extern.h>
-
-#include <klib/rc.h>
-#include <sra/types.h>
-#include <sra/illumina.h>
-#include <os-native.h>
-#include <sysalloc.h>
-#include <va_copy.h>
-
-#include "reader-cmn.h"
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-typedef enum IlluminaReaderOptions_enum {
-    eRead = 0x02,
-    eQual1 = 0x04,
-    eQual4 = 0x08,
-    eIntensity = 0x10,
-    eNoise = 0x20,
-    eSignal = 0x40,
-    eQSeq  = 0x80
-} IlluminaReaderOptions;
-
-/* column order is important here: see Init function below!!! */
-static
-const SRAReaderColumn IlluminaReader_master_columns_desc[] = {
-    {SRAREADER_COL_OPTIONAL, "LANE", vdb_int32_t, NULL, NULL, 0},
-    {SRAREADER_COL_OPTIONAL, "TILE", vdb_int32_t, NULL, NULL, 0},
-    {SRAREADER_COL_OPTIONAL, "X", vdb_int32_t, NULL, NULL, 0},
-    {SRAREADER_COL_OPTIONAL, "Y", vdb_int32_t, NULL, NULL, 0},
-    {eRead | eQSeq, "READ", insdc_fasta_t, NULL, NULL, 0},
-    {eQual1 | eQSeq, "QUALITY", insdc_phred_t, NULL, NULL, 0},
-    {SRAREADER_COL_OPTIONAL | eQual4, "QUALITY", ncbi_qual4_t, NULL, NULL, 0},
-    {SRAREADER_COL_OPTIONAL | eSignal, "SIGNAL", ncbi_fsamp4_t, NULL, NULL, 0},
-    {SRAREADER_COL_OPTIONAL | eNoise, "NOISE", ncbi_fsamp4_t, NULL, NULL, 0},
-    {SRAREADER_COL_OPTIONAL | eIntensity, "INTENSITY", ncbi_fsamp4_t, NULL, NULL, 0},
-    {SRAREADER_COL_OPTIONAL | eQSeq, "READ_FILTER", sra_read_filter_t, NULL, NULL, 0},
-    {SRAREADER_COL_OPTIONAL | eQSeq , "SPOT_GROUP", vdb_ascii_t, NULL, NULL, 0},
-    {0, NULL, NULL, NULL, NULL, 0} /* terminator */
-};
-
-struct IlluminaReader {
-    /* SRAReader always must be a first member! */
-    SRAReader dad;
-    unsigned char phred2logodds_printable[256];
-    /* current spot data shortcuts */
-    const int32_t** lane;
-    const int32_t** tile;
-    const int32_t** x;
-    const int32_t** y;
-    const SRAReaderColumn* read;
-    const SRAReaderColumn* qual1;
-    const signed char** qual4;
-    const float** signal;
-    const float** noise;
-    const float** intensity;
-    const uint8_t** rfilter;
-    const SRAReaderColumn* spot_group;
-};
-
-static
-rc_t IlluminaReaderInit(const IlluminaReader* self, bool read, bool qual1, bool qual4, bool intensity, bool noise, bool signal, bool qseq)
-{
-    rc_t rc = 0;
-    int options = read ? eRead : 0;
-
-    CHECK_SELF(IlluminaReader);
-
-    options |= qual1 ? eQual1 : 0;
-    options |= qual4 ? eQual4 : 0;
-    options |= intensity ? eIntensity : 0;
-    options |= noise ? eNoise : 0;
-    options |= signal ? eSignal : 0;
-    options |= qseq ? eQSeq : 0;
-
-    if( (rc = SRAReaderInit(&self->dad, options, IlluminaReader_master_columns_desc)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &IlluminaReader_master_columns_desc[0], NULL, (const void***)&self->lane)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &IlluminaReader_master_columns_desc[1], NULL, (const void***)&self->tile)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &IlluminaReader_master_columns_desc[2], NULL, (const void***)&self->x)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &IlluminaReader_master_columns_desc[3], NULL, (const void***)&self->y)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &IlluminaReader_master_columns_desc[4], &me->read, NULL)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &IlluminaReader_master_columns_desc[5], &me->qual1, NULL)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &IlluminaReader_master_columns_desc[6], NULL, (const void***)&self->qual4)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &IlluminaReader_master_columns_desc[7], NULL, (const void***)&self->signal)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &IlluminaReader_master_columns_desc[8], NULL, (const void***)&self->noise)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &IlluminaReader_master_columns_desc[9], NULL, (const void***)&self->intensity)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &IlluminaReader_master_columns_desc[10], NULL, (const void***)&self->rfilter)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &IlluminaReader_master_columns_desc[11], &me->spot_group, NULL)) == 0) {
-    }
-    if( self->qual1 != NULL ) {
-        int i;
-        const float offset = (float)64.499;
-        me->phred2logodds_printable[0] = (unsigned char)offset;
-        for(i = 1; i < 256; i++) {
-            me->phred2logodds_printable[i] = (unsigned char)(10 * log(pow(10, i / 10.0) - 1) / log(10) + offset);
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC IlluminaReaderMake(const IlluminaReader** self, const SRATable* table, const char* accession,
-                          bool read, bool qual1, bool qual4, bool intensity, bool noise, bool signal, bool qseq,
-                          spotid_t minSpotId, spotid_t maxSpotId)
-{
-    rc_t rc = SRAReaderMake((const SRAReader**)self, sizeof **self, table, accession, minSpotId, maxSpotId);
-    if( rc == 0 ) {
-        rc = IlluminaReaderInit(*self, read, qual1, qual4, intensity, noise, signal, qseq);
-    }
-    if( rc != 0 ) {
-        IlluminaReaderWhack(*self);
-        *self = NULL;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC IlluminaReaderWhack(const IlluminaReader* self)
-{
-    return SRAReaderWhack( &self->dad );
-}
-
-LIB_EXPORT rc_t CC IlluminaReaderFirstSpot(const IlluminaReader* self)
-{
-    return SRAReaderFirstSpot( &self->dad );
-}
-
-LIB_EXPORT rc_t CC IlluminaReaderSeekSpot(const IlluminaReader* self, spotid_t spot)
-{
-    return SRAReaderSeekSpot( &self->dad, spot );
-}
-
-LIB_EXPORT rc_t CC IlluminaReaderNextSpot(const IlluminaReader* self)
-{
-    return SRAReaderNextSpot( &self->dad );
-}
-
-LIB_EXPORT rc_t CC IlluminaReaderCurrentSpot(const IlluminaReader* self, spotid_t* spot)
-{
-    return SRAReaderCurrentSpot( &self->dad, spot );
-}
-
-LIB_EXPORT rc_t CC IlluminaReader_SpotInfo(const IlluminaReader* self,
-                                           const char** spotname, size_t* spotname_sz,
-                                           INSDC_coord_val* lane, INSDC_coord_val* tile, 
-                                           INSDC_coord_val* x, INSDC_coord_val* y,
-                                           uint32_t* spot_len, uint32_t* num_reads)
-{
-    rc_t rc = SRAReader_SpotInfo(&self->dad, spotname, spotname_sz, spot_len, num_reads);
-    if( rc == 0 ) {
-        if( lane ) {
-            *lane = (self->lane && *self->lane) ? **self->lane : 0;
-        }
-        if( tile ) {
-            *tile = (self->tile && *self->tile) ? **self->tile : ((self->dad.spot / 10001) + 1);
-        }
-        if( x ) {
-            *x = (self->x && *self->x) ? **self->x : 0;
-        }
-        if( y ) {
-            *y = (self->y && *self->y) ? **self->y : self->dad.spot;
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC IlluminaReader_SpotReadInfo(const IlluminaReader* self, uint32_t readId, SRAReadTypes* read_type,
-                                               const char** read_label, INSDC_coord_len* read_label_sz,
-                                               INSDC_coord_zero* read_start, INSDC_coord_len* read_len)
-{
-    return SRAReader_SpotReadInfo(&self->dad, readId, read_type,
-                                  read_label, read_label_sz, read_start, read_len);
-}
-
-static
-int kludge_snprintf ( char *buff, size_t bsize, const char *fmt, ... )
-{
-    int status;
-    va_list args, args2;
-
-    va_start ( args, fmt );
-    va_copy ( args2, args );
-
-    status = vsnprintf ( buff, bsize, fmt, args );
-    if ( status < 0 )
-    {
-        size_t kludge_size = 64 * 1024;
-        void *kludge = malloc ( kludge_size );
-        if ( kludge != NULL )
-        {
-            status = vsnprintf ( kludge, kludge_size, fmt, args2 );
-            if ( status >= 0 )
-            {
-                memcpy ( buff, kludge, ( size_t ) status > bsize ? bsize : ( size_t ) status );
-                if ( ( size_t ) status < bsize )
-                    buff [ status ] = 0;
-            }
-            free ( kludge );
-        }
-    }
-
-    va_end ( args2 );
-    va_end ( args );
-
-    return status;
-}
-
-LIB_EXPORT rc_t CC IlluminaReaderBase(const IlluminaReader* self, char* data, size_t dsize, size_t* written)
-{
-    rc_t rc = 0;
-    int sz = 0;
-    uint32_t spot_len;
-    INSDC_coord_val lane, tile, x, y;
-
-    CHECK_SELF(IlluminaReader);
-    CHECK_SPOT(me->dad);
-
-    if( data == NULL ) {
-        rc = RC(rcSRA, rcString, rcConstructing, rcMemory, rcNull);
-    } else if( !(self->dad.options & eRead) ) {
-        rc = RC(rcSRA, rcString, rcConstructing, rcMessage, rcUnexpected);
-    } else if( (rc = IlluminaReader_SpotInfo(self, NULL, NULL, &lane, &tile, &x, &y, &spot_len, NULL)) == 0 ) {
-        sz = snprintf(data, dsize, "%d\t%d\t%d\t%d\t", lane, tile, x, y);
-        if( sz < 0 ) {
-#if SNPRINTF_ACTUALLY_WORKED_THE_WAY_YOU_THINK
-            rc = RC(rcSRA, rcString, rcConstructing, rcNoObj, rcUnknown);
-#else
-            /* both approaches are wrong - the error code is rcBuffer, rcInsufficient */
-            rc = RC(rcSRA, rcString, rcConstructing, rcMemory, rcInsufficient);
-#endif
-        } else {
-            sz += spot_len;
-            if( sz >= (int)dsize ) {
-                rc = RC(rcSRA, rcString, rcConstructing, rcMemory, rcInsufficient);
-            } else {
-                size_t len = 0;
-                sz -= spot_len;
-                while(len < spot_len) {
-                    const char* b = self->read->base;
-                    data[sz + len] = b[len];
-                    if( data[sz + len] == 'N' ) {
-                        data[sz + len] = '.';
-                    }
-                    ++len;
-                }
-                sz += spot_len;
-                data[sz] = '\0';
-            }
-        }
-    }
-    if( written != NULL ) {
-        *written = sz;
-    }
-    return rc;
-}
-
-static
-rc_t IlluminaReader_4floats(const IlluminaReader* self, const float** col_data, char* data, size_t dsize, size_t* written)
-{
-    rc_t rc = 0;
-    int sz = 0;
-    const float* f = NULL;
-    uint32_t i, spot_len;
-    INSDC_coord_val lane, tile, x, y;
-
-    CHECK_SELF(IlluminaReader);
-    CHECK_SPOT(me->dad);
-
-    if( data == NULL ) {
-        rc = RC(rcSRA, rcString, rcConstructing, rcMemory, rcNull);
-    } else if( (rc = IlluminaReader_SpotInfo(self, NULL, NULL, &lane, &tile, &x, &y, &spot_len, NULL)) == 0 ) {
-        if( col_data == NULL || *col_data == NULL ) {
-            /* optional column is missing */
-            if( written != NULL ) {
-                *written = 0;
-            }
-            data[0] = '\0';
-        } else {
-            f = *col_data;
-            sz = snprintf(data, dsize, "%d\t%d\t%d\t%d", lane, tile, x, y);
-            if( sz < 0 ) {
-#if SNPRINTF_ACTUALLY_WORKED_THE_WAY_YOU_THINK
-                rc = RC(rcSRA, rcString, rcConstructing, rcNoObj, rcUnknown);
-#else
-                rc = RC(rcSRA, rcString, rcConstructing, rcMemory, rcInsufficient);
-#endif
-            } else {
-                for(i = 0; rc == 0 && i < spot_len; i++, f += 4) {
-                    int x = sz >= (int)dsize ? 0 : sz;
-                    x = snprintf(&data[x], dsize - x, "\t%.*f %.*f %.*f %.*f", f[0] ? 1 : 0, f[0], f[1] ? 1 : 0, f[1],
-                                 f[2] ? 1 : 0,  f[2], f[3] ? 1 : 0,  f[3]);
-                    if( x < 0 ) {
-#if SNPRINTF_ACTUALLY_WORKED_THE_WAY_YOU_THINK
-                        rc = RC(rcSRA, rcString, rcConstructing, rcNoObj, rcUnknown);
-#else
-                        rc = RC(rcSRA, rcString, rcConstructing, rcMemory, rcInsufficient);
-#endif
-                    }
-                    sz += x;
-                }
-                if( rc == 0 && written != NULL ) {
-                    *written = sz;
-                }
-            }
-        }
-    }
-    if( rc == 0 && sz >= (int)dsize ) {
-        rc = RC(rcSRA, rcString, rcConstructing, rcMemory, rcInsufficient);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC IlluminaReaderNoise(const IlluminaReader* self, char* data, size_t dsize, size_t* written)
-{
-    return IlluminaReader_4floats(self, self->noise, data, dsize, written);
-}
-
-LIB_EXPORT rc_t CC IlluminaReaderIntensity(const IlluminaReader* self, char* data, size_t dsize, size_t* written)
-{
-    return IlluminaReader_4floats(self, self->intensity, data, dsize, written);
-}
-
-LIB_EXPORT rc_t CC IlluminaReaderSignal(const IlluminaReader* self, char* data, size_t dsize, size_t* written)
-{
-    return IlluminaReader_4floats(self, self->signal, data, dsize, written);
-}
-
-LIB_EXPORT rc_t CC IlluminaReaderQuality1(const IlluminaReader* self, uint32_t readId, char* data, size_t dsize, size_t* written)
-{
-    rc_t rc = 0;
-    size_t sz = 0;
-    const uint8_t* p = NULL;
-
-    CHECK_SELF(IlluminaReader);
-    CHECK_SPOT(me->dad);
-
-    if( data == NULL ) {
-        rc = RC(rcSRA, rcString, rcConstructing, rcMemory, rcNull);
-    } else if( !(self->dad.options & eQual1) ) {
-        rc = RC(rcSRA, rcString, rcConstructing, rcMessage, rcUnexpected);
-    } else if( self->qual1 == NULL || self->qual1->size == 0 ) {
-        /* empty value */
-    } else if( readId > 0 ) {
-        INSDC_coord_zero read_start;
-        INSDC_coord_len read_len;
-        if( (rc = IlluminaReader_SpotReadInfo(self, readId, NULL, NULL, NULL, &read_start, &read_len)) == 0 ) {
-            sz = read_len;
-            p = self->qual1->base;
-            p += read_start;
-        }
-    } else {
-        uint32_t spot_len;
-        if( (rc = IlluminaReader_SpotInfo(self, NULL, NULL, NULL, NULL, NULL, NULL, &spot_len, NULL)) == 0 ) {
-            sz = spot_len;
-            p = self->qual1->base;
-        }
-    }
-    if( rc == 0 ) {
-        if( sz >= dsize ) {
-            rc = RC(rcSRA, rcString, rcConstructing, rcMemory, rcInsufficient);
-        } else {
-            size_t i;
-            for(i = 0; i < sz; i++) {
-                data[i] = self->phred2logodds_printable[p[i]];
-            }
-            data[sz] = '\0';
-        }
-    }
-    if( written != NULL ) {
-        *written = sz;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC IlluminaReaderQuality4(const IlluminaReader* self, char* data, size_t dsize, size_t* written)
-{
-    rc_t rc = 0;
-    uint32_t spot_len;
-
-    CHECK_SELF(IlluminaReader);
-    CHECK_SPOT(me->dad);
-
-    if( data == NULL ) {
-        rc = RC(rcSRA, rcString, rcConstructing, rcMemory, rcNull);
-    } else if( self->qual4 == NULL ) {
-        /* optional column is missing */
-        if( written != NULL ) {
-            *written = 0;
-        }
-        data[0] = '\0';
-    } else if( (rc = IlluminaReader_SpotInfo(self, NULL, NULL, NULL, NULL, NULL, NULL, &spot_len, NULL)) == 0 ) {
-        int sz = spot_len * 20 - 1; /* no \t at line start */
-        if( written != NULL ) {
-            *written = sz;
-        }
-        if( sz >= (int)dsize ) {
-            rc = RC(rcSRA, rcString, rcConstructing, rcMemory, rcInsufficient);
-        } else {
-            const signed char* q4 = *self->qual4;
-            int x;
-            uint32_t len = 0;
-            for(sz = 0; rc == 0 && len < spot_len; len++, q4 += 4) {
-                x = snprintf(&data[sz], dsize - sz, "%s%4d %4d %4d %4d", len > 0 ? "\t" : "", q4[0], q4[1], q4[2], q4[3]);
-#if SNPRINTF_ACTUALLY_WORKED_THE_WAY_YOU_THINK
-                if( x < 0 ) {
-                    rc = RC(rcSRA, rcString, rcConstructing, rcNoObj, rcUnknown);
-#else
-                if( x < 0 || ( size_t ) sz + x >= dsize ) {
-                    rc = RC(rcSRA, rcString, rcConstructing, rcMemory, rcInsufficient);
-#endif
-                }
-                sz += x;
-            }
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC IlluminaReaderQSeq(const IlluminaReader* self, uint32_t readId, bool spot_group,
-                                      char* data, size_t dsize, size_t* written)
-{
-    rc_t rc = 0;
-    const char* spotname;
-    size_t spotname_sz;
-    uint32_t nreads, spotlen;
-    INSDC_coord_val lane, tile, x, y;
-    int sz = 0;
-
-    CHECK_SELF(IlluminaReader);
-    CHECK_SPOT(me->dad);
-
-    if( data == NULL ) {
-        rc = RC(rcSRA, rcString, rcConstructing, rcMemory, rcNull);
-    } else if( !(self->dad.options & eQSeq) ) {
-        rc = RC(rcSRA, rcString, rcConstructing, rcMessage, rcUnexpected);
-    } else if( (rc = IlluminaReader_SpotInfo(self, &spotname, &spotname_sz, &lane, &tile, &x, &y, &spotlen, &nreads)) == 0 ) {
-        INSDC_coord_zero read_start = 0;
-        INSDC_coord_len read_len = spotlen;
-        if( readId > 0 ) {
-            rc = IlluminaReader_SpotReadInfo(self, readId, NULL, NULL, NULL, &read_start, &read_len);
-        }
-        if( rc == 0 ) {
-            const char* sg = "0";
-            int sg_sz = 1;
-            const char* runid = "0";
-            size_t runid_sz = 1;
-            int i = 0;
-
-            if( spotname_sz > 0 ) {
-                const char* c = spotname + spotname_sz;
-                while( i < 4 && c != NULL ) {
-                    c = memrchr(spotname, ':', c - spotname);
-                    if( c != NULL ) {
-                        i++;
-                    }
-                }
-                if( i == 4 ) {
-                    spotname_sz = c - spotname;
-                    c = memrchr(spotname, '_', spotname_sz);
-                    if( c != NULL ) {
-                        runid = c + 1;
-                        runid_sz = spotname_sz - (c - spotname) - 1;
-                        spotname_sz = c - spotname;
-                    }
-                } else {
-                    spotname_sz = 0;
-                }
-            }
-            if( spotname_sz == 0 ) {
-                spotname = self->dad.accession;
-                spotname_sz = strlen(spotname);
-            }
-            if( spot_group && self->spot_group && self->spot_group->size > 0 ) {
-                sg = self->spot_group->base;
-                sg_sz = self->spot_group->size;
-            }
-            i = snprintf(data, dsize, "%.*s\t%.*s\t%d\t%d\t%d\t%d\t%.*s\t%d\t",
-                (int)spotname_sz, spotname, (int)runid_sz, runid, lane, tile, x, y, sg_sz, sg, readId > 0 ? readId : 1);
-#if SNPRINTF_ACTUALLY_WORKED_THE_WAY_YOU_THINK
-            if( i < 0 ) {
-                rc = RC(rcSRA, rcString, rcConstructing, rcNoObj, rcUnknown);
-#else
-            if( i < 0 || ( size_t ) i >= dsize ) {
-                rc = RC(rcSRA, rcString, rcConstructing, rcMemory, rcInsufficient);
-#endif
-            } else {
-                sz += i;
-                i = sz; /* save length of initial part */
-
-                /* precalc full line length: seq\tqual\tflt */
-                sz += 2 * (read_len + 1) + 1;
-                if( sz >= (int)dsize ) {
-                    rc = RC(rcSRA, rcString, rcConstructing, rcMemory, rcInsufficient);
-                } else {
-                    char flt = '1';
-                    const char* b = self->read->base;
-
-                    /* reverse back to initial part length */
-                    sz = i;
-                    if( *self->rfilter != NULL ) {
-                        if( readId > 0 && (*self->rfilter)[readId - 1] != SRA_READ_FILTER_PASS ) {
-                            flt = '0';
-                        } else {
-                            for(i = 0; i < nreads; i++) {
-                                if( (*self->rfilter)[i] != SRA_READ_FILTER_PASS ) {
-                                    flt = '0';
-                                    break;
-                                }
-                            }
-                        }
-                    }
-                    for(i = 0; i < read_len; i++) {
-                        data[sz + i] = b[read_start + i];
-                        if( data[sz + i] == 'N' ) {
-                            data[sz + i] = '.';
-                        }
-                    }
-                    sz += read_len;
-                    data[sz++] = '\t';
-                    if( self->qual1 && self->qual1->size ) {
-                        const uint8_t* p = self->qual1->base;
-                        for(i = 0; i < read_len; i++) {
-                            data[sz + i] = p[read_start + i] + 64;
-                        }
-                        sz += read_len;
-                    }
-                    data[sz++] = '\t';
-                    data[sz++] = flt;
-                    data[sz] = '\0';
-                }
-            }
-        }
-    }
-    if( written != NULL ) {
-        *written = sz;
-    }
-    return rc;
-}
diff --git a/libs/sra/reader-sff.c b/libs/sra/reader-sff.c
deleted file mode 100644
index eba2632..0000000
--- a/libs/sra/reader-sff.c
+++ /dev/null
@@ -1,380 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <sra/rd-extern.h>
-
-#include <klib/rc.h>
-#include <sra/types.h>
-#include <sra/sff.h>
-#include <sra/sff-file.h>
-#include <sysalloc.h>
-
-#include "reader-cmn.h"
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#   include <byteswap.h>
-#else
-#   define bswap_16(x) (x)
-#   define bswap_32(x) (x)
-#endif
-#include <string.h>
-
-/* column order is important here: see Init function below!!! */
-static
-const SRAReaderColumn SFFReader_master_columns_desc[] = {
-    {SRAREADER_COL_MANDATORY, "FLOW_CHARS", insdc_fasta_t, NULL, NULL, 0},
-    {SRAREADER_COL_MANDATORY, "KEY_SEQUENCE", insdc_fasta_t, NULL, NULL, 0},
-    {SRAREADER_COL_MANDATORY, "READ", insdc_fasta_t, NULL, NULL, 0},
-    {SRAREADER_COL_MANDATORY, "QUALITY", insdc_phred_t, NULL, NULL, 0},
-    {SRAREADER_COL_MANDATORY, "SIGNAL", ncbi_isamp1_t, NULL, NULL, 0},
-    {SRAREADER_COL_MANDATORY, "POSITION", "INSDC:position:one", NULL, NULL, 0},
-    {SRAREADER_COL_OPTIONAL, "CLIP_QUALITY_LEFT", "INSDC:coord:one", NULL, NULL, 0},
-    {SRAREADER_COL_OPTIONAL, "CLIP_QUALITY_RIGHT", "INSDC:coord:one", NULL, NULL, 0},
-    {SRAREADER_COL_OPTIONAL, "CLIP_ADAPTER_LEFT", "INSDC:coord:one", NULL, NULL, 0},
-    {SRAREADER_COL_OPTIONAL, "CLIP_ADAPTER_RIGHT", "INSDC:coord:one", NULL, NULL, 0},
-    {0, NULL, NULL, NULL, NULL, 0} /* terminator */
-};
-
-struct SFFReader {
-    /* SRAReader always must be a first member! */
-    SRAReader dad;
-    /* current spot data shortcuts */
-    const SRAReaderColumn* flow_chars;
-    const SRAReaderColumn* key_seq;
-    const SRAReaderColumn* read;
-    const SRAReaderColumn* qual1;
-    const SRAReaderColumn* signal;
-    const SRAReaderColumn* position;
-    const INSDC_coord_one** clip_q_left;
-    const INSDC_coord_one** clip_q_right;
-    const INSDC_coord_one** clip_adapter_left;
-    const INSDC_coord_one** clip_adapter_right;
-};
-
-static
-rc_t SFFReaderInit(const SFFReader* self)
-{
-    rc_t rc = 0;
-
-    CHECK_SELF(SFFReader);
-    rc = SRAReaderInit(&self->dad, 0, SFFReader_master_columns_desc);
-    if( GetRCState(rc) == rcNotFound && GetRCObject(rc) == rcColumn ) {
-        rc = RC(rcSRA, rcFormatter, rcConstructing, rcData, rcUnsupported);
-    } else if( rc == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &SFFReader_master_columns_desc[0], &me->flow_chars, NULL)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &SFFReader_master_columns_desc[1], &me->key_seq, NULL)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &SFFReader_master_columns_desc[2], &me->read, NULL)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &SFFReader_master_columns_desc[3], &me->qual1, NULL)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &SFFReader_master_columns_desc[4], &me->signal, NULL)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &SFFReader_master_columns_desc[5], &me->position, NULL)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &SFFReader_master_columns_desc[6], NULL, (const void***)&self->clip_q_left)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &SFFReader_master_columns_desc[7], NULL, (const void***)&self->clip_q_right)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &SFFReader_master_columns_desc[8], NULL, (const void***)&self->clip_adapter_left)) == 0 &&
-        (rc = SRAReader_FindColData(&self->dad, &SFFReader_master_columns_desc[9], NULL, (const void***)&self->clip_adapter_right)) == 0 ) {
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SFFReaderMake(const SFFReader** self, const SRATable* table,
-                   const char* accession, spotid_t minSpotId, spotid_t maxSpotId )
-{
-    rc_t rc = SRAReaderMake((const SRAReader**)self, sizeof **self, table, accession, minSpotId, maxSpotId);
-
-    if( rc == 0 ) {
-        rc = SFFReaderInit(*self);
-    }
-    if( rc != 0 ) {
-        SFFReaderWhack(*self);
-        *self = NULL;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SFFReaderWhack(const SFFReader *self)
-{
-    return SRAReaderWhack( &self->dad );
-}
-
-LIB_EXPORT rc_t CC SFFReaderFirstSpot(const SFFReader* self)
-{
-    return SRAReaderFirstSpot( &self->dad );
-}
-
-LIB_EXPORT rc_t CC SFFReaderSeekSpot(const SFFReader* self, spotid_t spot)
-{
-    return SRAReaderSeekSpot( &self->dad, spot );
-}
-
-LIB_EXPORT rc_t CC SFFReaderNextSpot(const SFFReader* self)
-{
-    return SRAReaderNextSpot( &self->dad );
-}
-
-LIB_EXPORT rc_t CC SFFReaderCurrentSpot(const SFFReader* self, spotid_t* spot)
-{
-    return SRAReaderCurrentSpot( &self->dad, spot );
-}
-
-LIB_EXPORT rc_t CC SFFReader_SpotInfo(const SFFReader* self, const char** spotname, size_t* spotname_sz,
-                                      uint32_t* spot_len, uint32_t* num_reads)
-{
-    return SRAReader_SpotInfo( &self->dad, spotname, spotname_sz, spot_len, num_reads );
-}
-
-LIB_EXPORT rc_t CC SFFReader_SpotReadInfo(const SFFReader* self, uint32_t readId, SRAReadTypes* read_type,
-                                          const char** read_label, INSDC_coord_len* read_label_sz,
-                                          INSDC_coord_zero* read_start, INSDC_coord_len* read_len)
-{
-    return SRAReader_SpotReadInfo(&self->dad, readId, read_type,
-                                  read_label, read_label_sz, read_start, read_len);
-}
-
-LIB_EXPORT rc_t CC SFFReaderHeader(const SFFReader* self, spotid_t spots, char* data, size_t dsize, size_t* written)
-{
-    rc_t rc = 0;
-    SFFCommonHeader h;
-
-    CHECK_SELF(SFFReader);
-
-    /* we need to read 1st spot in order to get to flow and key seq col data */
-    if( me->dad.spot == 0 && (rc = SFFReaderSeekSpot(self, me->dad.minSpotId)) != 0 ) {
-        return rc;
-    }
-    memset(&h, 0, sizeof(SFFCommonHeader));
-    memcpy(&h, ".sff\0\0\0\1", 8);
-    h.number_of_reads = spots != 0 ? spots : (self->dad.maxSpotId - me->dad.minSpotId + 1);
-    h.key_length = (uint16_t)self->key_seq->size;
-    h.num_flows_per_read = (uint16_t)self->flow_chars->size;
-    h.flowgram_format_code = SFFFormatCodeUI16Hundreths;
-
-    h.header_length = SFFCommonHeader_size + h.key_length + h.num_flows_per_read;
-    /* 8-byte pad */
-    h.header_length += (h.header_length % 8) ? (8 - (h.header_length % 8)) : 0;
-    if( written != NULL ) {
-        *written = h.header_length;
-    }
-    if( h.header_length > dsize ) {
-        rc = RC(rcSRA, rcString, rcConstructing, rcMemory, rcInsufficient);
-    } else {
-        uint16_t len = h.header_length;
-
-        h.number_of_reads = bswap_32( h.number_of_reads );
-        h.header_length = bswap_16( h.header_length );
-        h.key_length = bswap_16( h.key_length );
-        h.num_flows_per_read = bswap_16( h.num_flows_per_read );
-
-        memset(data, 0, len);
-        memcpy(data, &h, SFFCommonHeader_size);
-        memcpy(&data[SFFCommonHeader_size], self->flow_chars->base, self->flow_chars->size);
-        memcpy(&data[SFFCommonHeader_size + self->flow_chars->size], self->key_seq->base, self->key_seq->size);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SFFReaderReadHeader(const SFFReader* self, char* data, size_t dsize, size_t* written)
-{
-    rc_t rc = 0;
-    size_t spotname_sz;
-    const char* spotname;
-    uint32_t spot_len;
-    SFFReadHeader h;
-
-    CHECK_SELF(SFFReader);
-    CHECK_SPOT(me->dad);
-
-    memset(&h, 0, sizeof(SFFReadHeader));
-
-    if( (rc = SFFReader_SpotInfo(self, &spotname, &spotname_sz, &spot_len, NULL)) != 0 ) {
-        return rc;
-    }
-    if( self->clip_q_left != NULL && *self->clip_q_left != NULL ) {
-        h.clip_quality_left = **self->clip_q_left;
-    }
-    if( self->clip_q_right != NULL && *self->clip_q_right != NULL ) {
-        h.clip_quality_right = **self->clip_q_right;
-    }
-    if( self->clip_adapter_left != NULL && *self->clip_adapter_left != NULL ) {
-        h.clip_adapter_left = **self->clip_adapter_left;
-    }
-    if( self->clip_adapter_right != NULL && *self->clip_adapter_right != NULL ) {
-        h.clip_adapter_right = **self->clip_adapter_right;
-    }
-    if( spotname_sz == 0 ) {
-        spotname = self->dad.accession;
-        spotname_sz = strlen(spotname);
-    }
-    h.name_length = (uint16_t)spotname_sz;
-    h.number_of_bases = spot_len;
-    h.header_length = (uint16_t)( SFFReadHeader_size + spotname_sz );
-    /* 8-byte pad */
-    h.header_length += (h.header_length % 8) ? (8 - (h.header_length % 8)) : 0;
-    if( written != NULL ) {
-        *written = h.header_length;
-    }
-    if( h.header_length > dsize ) {
-        rc = RC(rcSRA, rcString, rcConstructing, rcMemory, rcInsufficient);
-    } else {
-        uint16_t len = h.header_length;
-
-        h.header_length = bswap_16(h.header_length);
-        h.name_length = bswap_16(h.name_length);
-        h.number_of_bases = bswap_32(h.number_of_bases);
-        h.clip_quality_right = bswap_16(h.clip_quality_right);
-        h.clip_quality_left = bswap_16(h.clip_quality_left);
-        h.clip_adapter_left = bswap_16(h.clip_adapter_left);
-        h.clip_adapter_right = bswap_16(h.clip_adapter_right);
-
-        memset(data, 0, len);
-        memcpy(data, &h, SFFReadHeader_size);
-        memcpy(&data[SFFReadHeader_size], spotname, spotname_sz);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SFFReaderReadData(const SFFReader* self, char* data, size_t dsize, size_t* written)
-{
-    rc_t rc = 0;
-    size_t flows, len, padding;
-    uint32_t spot_len;
-    /* SFF type defining vars, not used */
-    const uint16_t sff_signal;
-    const uint8_t sff_position;
-    const char sff_bases;
-    const uint8_t sff_quality;
-
-    CHECK_SELF(SFFReader);
-    CHECK_SPOT(me->dad);
-
-    /* if for some reason READ, QUAL and POSITION rows are uneqaul in size,
-       base their length on actual READ size */
-    spot_len = self->read->size / sizeof(INSDC_dna_text);
-    /* this size if fixed across the file */
-    flows = self->flow_chars->size / sizeof(INSDC_dna_text);
-
-    /* read data section size: per SFF spec types sizes + 8-byte padding */
-    len = flows * sizeof(sff_signal) + spot_len * (sizeof(sff_position) + sizeof(sff_bases) + sizeof(sff_quality));
-    padding = (len % 8) ? (8 - (len % 8)) : 0;
-    len += padding;
-
-    if( written != NULL ) {
-        *written = len;
-    }
-    if( len > dsize ) {
-        rc = RC(rcSRA, rcString, rcConstructing, rcMemory, rcInsufficient);
-    } else {
-        size_t qty;
-        INSDC_position_one ppos;
-        const uint16_t* signal = self->signal->base;
-        uint16_t* dst_sig = (uint16_t*)data;
-        const INSDC_position_one* position = self->position->base;
-
-        qty = self->signal->size / sizeof(*signal);
-        if( qty > flows ) {
-            qty = flows;
-        }
-        for(len = 0; len < qty; len++) {
-            dst_sig[len] = bswap_16(signal[len]);
-        }
-        if( qty < flows ) {
-            memset(&data[qty * sizeof(sff_signal)], 0, (flows - qty) * sizeof(sff_signal));
-        }
-        data += flows * sizeof(sff_signal);
-
-        qty = self->position->size / sizeof(*position);
-        if( qty > spot_len ) {
-            qty = spot_len;
-        }
-        for(ppos = 0, len = 0; len < qty; len++) {
-            data[len] = (uint8_t)(position[len] - ppos);
-            ppos = position[len];
-        }
-        if( qty < spot_len ) {
-            memset(&data[qty], 0, (spot_len - qty) * sizeof(sff_position));
-        }
-        data += spot_len;
-
-        /* this are guaranteed above to be same length */
-        memcpy(data, self->read->base, spot_len);
-        data += spot_len;
-
-        qty = self->qual1->size / sizeof(INSDC_quality_phred);
-        if( qty > spot_len ) {
-            qty = spot_len;
-        }
-        memcpy(data, self->qual1->base, qty);
-        if( qty < spot_len ) {
-            memset(&data[qty], 0, (spot_len - qty) * sizeof(sff_quality));
-        }
-        if( padding > 0 ) {
-            memset(&data[spot_len], 0, padding);
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SFFReader_GetCurrentSpotData(const SFFReader* self, char* data, size_t dsize, size_t* written)
-{
-    rc_t rc = 0;
-    size_t len = 0, left = dsize, w = 0;
-    char* b = data;
-
-    CHECK_SELF(SFFReader);
-    CHECK_SPOT(me->dad);
-
-    rc = SFFReaderReadHeader(me, b, left, &w);
-    len += w, b += w, left -= w;
-    if( rc != 0 ) {
-        if( !(GetRCObject(rc) == rcMemory && GetRCState(rc) == rcInsufficient) ) {
-            return rc;
-        }
-        b = data, left = dsize;
-    }
-    rc = SFFReaderReadData(self, b, left, &w);
-    len += w, b += w, left -= w;
-    if( rc != 0 ) {
-        if( !(GetRCObject(rc) == rcMemory && GetRCState(rc) == rcInsufficient) ) {
-            return rc;
-        }
-    }
-    if( written != NULL ) {
-        *written = len;
-    }
-    if( len > dsize ) {
-        rc = RC(rcSRA, rcString, rcConstructing, rcMemory, rcInsufficient);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SFFReader_GetNextSpotData(const SFFReader* self, char* data, size_t dsize, size_t* written)
-{
-    rc_t rc = SFFReaderNextSpot(self);
-    if( GetRCObject(rc) == rcRow && GetRCState(rc) == rcUnknown ) {
-        rc = SFFReaderFirstSpot(self);
-    }
-    if( rc == 0 ) {
-        rc = SFFReader_GetCurrentSpotData(self, data, dsize, written);
-    }
-    return rc;
-}
diff --git a/libs/sra/sra-debug.h b/libs/sra/sra-debug.h
deleted file mode 100644
index bfb7de4..0000000
--- a/libs/sra/sra-debug.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#ifndef _h_sra_debug_
-#define _h_sra_debug_
-
-#include <klib/debug.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define SRADBG(msg) DBGMSG(DBG_SRA,DBG_FLAG(DBG_SRA_INFO),msg)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _sra_debug_ */
diff --git a/libs/sra/sra-dflt-schema.c b/libs/sra/sra-dflt-schema.c
deleted file mode 100644
index cbaacf7..0000000
--- a/libs/sra/sra-dflt-schema.c
+++ /dev/null
@@ -1,550 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/manager.h>
-#include <vdb/schema.h>
-#include <kfs/directory.h>
-#include <kfs/file.h>
-#include <kapp/main.h>
-#include <kapp/args.h>
-#include <klib/container.h>
-#include <klib/vector.h>
-#include <klib/log.h>
-#include <klib/out.h>
-#include <klib/rc.h>
-#include <klib/namelist.h>
-#include <os-native.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-#define WITH_DNA
-
-#define DEPENDENCY_EXTENSION "d"
-
-ver_t CC KAppVersion ( void )
-{
-    return 0x1000000;
-}
-
-
-/********************************************************************
-helper function to display failure or success message
-********************************************************************/
-static void display_rescode( const rc_t rc, const char* failure, const char* success )
-{
-    if ( rc != 0 )
-        LOGERR( klogInt, rc, failure );
-    else
-        if ( success ) LOGMSG( klogInfo, success );
-}
-
-typedef struct context
-{
-    const char *output_file;
-    char *dependency_file;
-    VNamelist *include_files;
-    VNamelist *src_files;
-} context;
-typedef context* p_context;
-
-static void context_set_str( char **dst, const char *src )
-{
-    size_t len;
-    if ( dst == NULL ) return;
-    if ( *dst != NULL ) free( *dst );
-    if ( src == NULL ) return;
-    len = strlen( src );
-    if ( len == 0 ) return;
-    *dst = (char*)malloc( len + 1 );
-    strcpy( *dst, src );
-}
-
-static bool context_init( context **ctx )
-{
-    bool res = false;
-    if ( ctx != NULL )
-    {
-        (*ctx) = malloc( sizeof( context ) );
-        if ( *ctx )
-        {
-            (*ctx)->output_file = NULL;
-            (*ctx)->dependency_file = NULL;
-            VNamelistMake( &( (*ctx)->include_files ), 5 );
-            VNamelistMake( &( (*ctx)->src_files ), 5 );
-            res = true;
-        }
-    }
-    return res;
-}
-
-static void context_destroy( p_context ctx )
-{
-    if ( ctx == NULL ) return;
-    free( (char*)ctx->output_file );
-    free( (char*)ctx->dependency_file );
-    VNamelistRelease( ctx->include_files );
-    VNamelistRelease( ctx->src_files );
-    free( ctx );
-}
-
-const char UsageDefaultName [] = "sra-dflt-schema";
-
-
-rc_t CC UsageSummary (const char * progname)
-{
-    return KOutMsg ("\n"
-                    "Usage:\n"
-                    "  %s src1 src2 -Iinclude1 -Iinclude2 -ooutput -Tdependency\n",
-                    progname);
-}
-
-rc_t CC Usage ( const Args * args )
-{
-    const char * progname = UsageDefaultName;
-    const char * fullpath = UsageDefaultName;
-    rc_t rc;
-
-    if (args == NULL)
-        rc = RC (rcApp, rcArgv, rcAccessing, rcSelf, rcNull);
-    else
-        rc = ArgsProgram (args, &fullpath, &progname);
-
-    UsageSummary (progname);
-
-    KOutMsg ("%s src1 src2 -Iinclude1 -Iinclude2 -ooutput -Tdependency\n"
-             "    src1, src2 ..........schema source-files  (mandatory))\n"
-             " -I include1, include2 ..schema include-files (optional))\n"
-             " -o output-file .........schema output (optional)) if none --> stdout\n"
-             " -T dependency-file .....list of includes in make-syntax (optional))\n",
-             progname);
-
-    HelpVersion (fullpath, KAppVersion());
-
-    return 0;
-}
-
-
-/* pass the new extension without a leading dot!
-   assumes that the filename is not static, but made via malloc */
-void change_extension( char **filename, const char *new_extension )
-{
-    char *temp, *buf;
-    size_t src_len, ext_len;
-
-    if ( filename == NULL ) return;
-    if ( (*filename) == NULL ) return;
-    if ( new_extension == NULL ) return;
-    src_len = strlen( *filename );
-    if ( src_len < 1 ) return;
-    ext_len = strlen( new_extension );
-    if ( ext_len < 1 ) return;
-    buf = malloc( src_len + ext_len + 2 );
-    temp = strrchr( *filename, '.' );
-    if ( temp != NULL ) *temp = 0; /* terminate */
-    sprintf( buf, "%s.%s", *filename, new_extension );
-    temp = *filename;
-    *filename = buf;
-    free( temp );
-}
-
-#define OPTION_INCLUDE "include"
-#define OPTION_DEPENDENCY "dependency"
-#define OPTION_OUTPUT "output"
-#define ALIAS_INCLUDE "I"
-#define ALIAS_DEPENDENCY "T"
-#define ALIAS_OUTPUT "o"
-
-const char * include_usage[] = { "include schema", NULL };
-const char * dependency_usage[] = { "dependency", NULL };
-const char * output_usage[] = { "output", NULL };
-
-OptDef Options[] =
-{
-/* is their a real reason for a limit of 10? */
-    { OPTION_INCLUDE, ALIAS_INCLUDE, NULL, include_usage, 10, true, false },
-    { OPTION_DEPENDENCY, ALIAS_DEPENDENCY, NULL, dependency_usage, 1, true, false },
-    { OPTION_OUTPUT, ALIAS_OUTPUT, NULL, output_usage, 1, true, false }
-};
-
-static const char* get_str_option( const Args *my_args, const char *name )
-{
-    const char* res = NULL;
-    uint32_t count;
-    rc_t rc = ArgsOptionCount( my_args, name, &count );
-    if ( ( rc == 0 )&&( count > 0 ) )
-    {
-        ArgsOptionValue( my_args, name, 0, &res );
-    }
-    return res;
-}
-
-static void append_str_options( const Args *my_args, const char *name, VNamelist *dst )
-{
-    uint32_t count;
-    rc_t rc = ArgsOptionCount( my_args, name, &count );
-    if ( ( rc == 0 )&&( count > 0 ) )
-    {
-        uint32_t idx;
-        for ( idx=0; idx<count; ++idx )
-        {
-            const char* s;
-            if ( ArgsOptionValue( my_args, name, idx, &s ) == 0 )
-                VNamelistAppend( dst, s );
-        }
-    }
-}
-
-static void append_str_arguments( const Args *my_args, VNamelist *dst )
-{
-    uint32_t count;
-    rc_t rc = ArgsParamCount( my_args, &count );
-    if ( ( rc == 0 )&&( count > 0 ) )
-    {
-        uint32_t idx;
-        for ( idx=0; idx<count; ++idx )
-        {
-            const char* s;
-            if ( ArgsParamValue( my_args, idx, &s ) == 0 )
-                VNamelistAppend( dst, s );
-        }
-    }
-}
-
-static void evaluate_options( const Args *my_args, context *ctx )
-{
-    context_set_str( (char**)&(ctx->output_file),
-                     get_str_option( my_args, OPTION_OUTPUT ) );
-    context_set_str( (char**)&(ctx->dependency_file),
-                     get_str_option( my_args, OPTION_DEPENDENCY ) );
-    append_str_options( my_args, OPTION_INCLUDE, ctx->include_files );
-    append_str_arguments( my_args, ctx->src_files );
-}
-
-static rc_t capture_arguments_and_options( Args * args, context *ctx )
-{
-    evaluate_options( args, ctx );
-    change_extension( &(ctx->dependency_file), DEPENDENCY_EXTENSION );
-
-    return 0;
-}
-
-typedef rc_t (*name_fkt)( void *data, const char *my_name );
-
-static rc_t for_each_v_name( VNamelist *names, void *data, const name_fkt f )
-{
-    KNamelist *knames;
-    uint32_t count, idx;
-    rc_t rc = VNamelistToNamelist( names, (KNamelist **)&knames );
-    display_rescode( rc, "VNamelistToNamelist failed", NULL );
-    if ( rc == 0 )
-    {
-        rc = KNamelistCount( knames, &count );
-        display_rescode( rc, "KNamelistCount failed", NULL );
-        if ( rc == 0 )
-        {
-            for ( idx=0; idx<count; ++idx )
-            {
-                const char *my_path;
-                rc = KNamelistGet( knames, idx, &my_path );
-                display_rescode( rc, "KNamelistGet failed", NULL );
-                if ( rc == 0 )
-                    rc = f( data, my_path );
-            }
-        }
-        KNamelistRelease( knames );
-    }
-    return rc;
-}
-
-static rc_t for_each_k_name( KNamelist *names, void *data, const name_fkt f )
-{
-    uint32_t count, idx;
-    rc_t rc = KNamelistCount( names, &count );
-    display_rescode( rc, "KNamelistCount failed", NULL );
-    if ( rc == 0 )
-    {
-        for ( idx=0; idx<count; ++idx )
-        {
-            const char *my_path;
-            rc = KNamelistGet( names, idx, &my_path );
-            display_rescode( rc, "KNamelistGet failed", NULL );
-            if ( rc == 0 )
-                rc = f( data, my_path );
-        }
-    }
-    return rc;
-}
-
-static uint32_t namelistcount( VNamelist *names )
-{
-    KNamelist *knames;
-    uint32_t count = 0;
-
-    if ( VNamelistToNamelist( names, (KNamelist **)&knames ) == 0 )
-        KNamelistCount( knames, &count );
-    return count;
-}
-
-static rc_t add_include( void *data, const char *my_name )
-{
-    VSchema *my_schema = (VSchema*)data;
-    rc_t rc = VSchemaAddIncludePath( my_schema, my_name );
-    display_rescode( rc, "VSchemaAddIncludePath failed", NULL );
-    return rc;
-}
-
-static rc_t add_source( void *data, const char *my_name )
-{
-    VSchema *my_schema = (VSchema*)data;
-    rc_t rc = VSchemaParseFile( my_schema, my_name );
-    display_rescode( rc, "VSchemaParseFile failed", NULL );
-    return rc;
-}
-
-struct schema_dumper_state_t {
-    FILE *fp;
-    unsigned line_pos;
-    uint32_t out_size;
-    char line_buf[255];
-};
-
-static void schema_dumper_state_write_line(struct schema_dumper_state_t *st) {
-    st->line_buf[st->line_pos] = '\n';
-    fwrite(st->line_buf, 1, st->line_pos + 1, st->fp);
-    st->line_pos = 0;
-}
-
-/********************************************************************
-helper function needed by schema-dump
-********************************************************************/
-static rc_t CC my_flush ( void *dst, const void *buffer, size_t bsize )
-{
-    struct schema_dumper_state_t *st = (struct schema_dumper_state_t *)dst;
-    size_t i;
-    
-    st->out_size += bsize;
-    for (i = 0; i != bsize; ++i) {
-        int n;
-        int c = ((const char *)buffer)[i];
-        
-        if (st->line_pos > 80)
-            schema_dumper_state_write_line(st);
-
-        if (c == '\'' || c == '\\')
-            n = sprintf(st->line_buf + st->line_pos, " '\\%c',", c);
-        else
-            n = sprintf(st->line_buf + st->line_pos, " '%c',", c);
-        st->line_pos += n;
-    }
-    return 0;
-}
-
-static rc_t Write1Dependency( void* data, const char* name )
-{
-    FILE *my_file = (FILE*)data;
-    char prefix[] = { " \\\n  " };
-    size_t to_write;
-
-    if ( my_file == NULL ) return 0;
-    if ( name == NULL ) return 0;
-    to_write = strlen( name );
-    if ( to_write == 0 ) return 0;
-    fwrite( prefix, sizeof(char), strlen(prefix), my_file );
-    fwrite( name, sizeof(char), to_write, my_file );
-    return 0;
-}
-
-static rc_t WriteDependency( VSchema *my_schema, const context *ctx )
-{
-    rc_t rc = 0;
-    FILE *my_file;
-    const KNamelist *knames;
-
-    if ( ctx->dependency_file == NULL ) return rc;
-    if ( ctx->output_file == NULL ) return rc;
-    rc = VSchemaIncludeFiles( my_schema, &knames );
-    display_rescode( rc, "VSchemaIncludeFiles failed", NULL );
-    if ( rc == 0 )
-    {
-        my_file = fopen( ctx->dependency_file, "w" );
-        if ( my_file != NULL )
-        {
-            char buf[512];
-            int len = snprintf( buf, sizeof(buf), "%s:", ctx->output_file );
-            if ( ( len < 0 )||( len >= sizeof(buf) ) )
-            {
-                rc = -1;
-            }
-            else
-            {
-                fwrite( buf, sizeof(char), len, my_file );
-                for_each_k_name( (void*)knames, my_file, Write1Dependency );
-            }
-            fclose( my_file );
-        }
-        KNamelistRelease( knames );
-    }
-    return rc;
-}
-
-static rc_t DumpSchema_to( VSchema *my_schema, const context *ctx )
-{
-    struct schema_dumper_state_t st;
-    rc_t rc = 0;
-    unsigned i;
-
-    static const char *preamble[] = {
-        "/*===========================================================================",
-        "*",
-        "*                             PUBLIC DOMAIN NOTICE",
-        "*                National Center for Biotechnology Information",
-        "*",
-        "*   This software/database is a \"United States Government Work\" under the",
-        "*   terms of the United States Copyright Act.  It was written as part of",
-        "*   the author's official duties as a United States Government employee and",
-        "*   thus cannot be copyrighted.  This software/database is freely available",
-        "*   to the public for use. The National Library of Medicine and the U.S.",
-        "*   Government have not placed any restriction on its use or reproduction.",
-        "*",
-        "*   Although all reasonable efforts have been taken to ensure the accuracy",
-        "*   and reliability of the software and data, the NLM and the U.S.",
-        "*   Government do not and cannot warrant the performance or results that",
-        "*   may be obtained by using this software or data. The NLM and the U.S.",
-        "*   Government disclaim all warranties, express or implied, including",
-        "*   warranties of performance, merchantability or fitness for any particular",
-        "*   purpose.",
-        "*",
-        "*   Please cite the author in any work or product based on this material.",
-        "*",
-        "* ===========================================================================",
-        "*",
-        "* THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT",
-        "*/",
-
-        "#include \"sraschema-priv.h\"",
-        "const char sra_schema_text[] = {"
-    };
-    static const char *postamble[] = {
-        "};",
-        "const size_t sra_schema_size =",
-    };
-    
-    memset(&st, 0, sizeof(st));
-    
-    st.fp = ctx->output_file ? fopen(ctx->output_file, "w") : stdout;
-    
-    if (st.fp == NULL)
-        return RC(rcSRA, rcSchema, rcFormatting, rcFile, rcNotOpen);
-
-    for ( i = 0; i != sizeof(preamble) / sizeof(preamble[0]); ++i)
-        fprintf(st.fp, "%s\n", preamble[i]);
-    
-    rc = VSchemaDump( my_schema, sdmCompact, NULL, my_flush, &st );
-    if (rc == 0) {
-        if (st.line_pos != 0)
-            schema_dumper_state_write_line(&st);
-        fprintf(st.fp, "%s\n", postamble[0]);
-        fprintf(st.fp, "%s %u;\n", postamble[1], st.out_size);
-    }
-    if (st.fp != stdout)
-        fclose(st.fp);
-    return rc;
-}
-
-static rc_t DumpSchema( const context *ctx )
-{
-    KDirectory *my_dir;
-    rc_t rc = KDirectoryNativeDir ( &my_dir );
-    display_rescode( rc, "failed to open native dir", NULL );
-    if ( rc == 0 )
-    {
-        const VDBManager *my_manager;
-        rc = VDBManagerMakeRead ( &my_manager, my_dir );
-        display_rescode( rc, "failed to make manager", NULL );
-        if ( rc == 0 )
-        {
-            VSchema *my_schema;
-            rc = VDBManagerMakeSchema( my_manager, &my_schema );
-            display_rescode( rc, "failed to make schema", NULL );
-            if ( rc == 0 )
-            {
-                rc = for_each_v_name( ctx->include_files, my_schema, add_include );
-                if ( rc == 0 )
-                {
-                    rc = for_each_v_name( ctx->src_files, my_schema, add_source );
-                    if ( rc == 0 )
-                    {
-                        rc = DumpSchema_to( my_schema, ctx );
-                        if ( rc == 0 )
-                            rc = WriteDependency( my_schema, ctx );
-                    }
-                }
-                VSchemaRelease( my_schema );
-            }
-            VDBManagerRelease( my_manager );
-        }
-        KDirectoryRelease( my_dir );
-    }
-    return rc;
-}
-
-/****************************************************************************************
- ***************************************************************************************/
-rc_t CC KMain ( int argc, char *argv [] )
-{
-    Args * my_args;
-    rc_t rc;
-
-    rc = ArgsMakeAndHandle (&my_args, argc, argv, 1, 
-                            Options, sizeof (Options) / sizeof (OptDef));
-    if (rc == 0)
-    {
-        context *ctx;
-
-        context_init( &ctx );
-
-        rc = capture_arguments_and_options( my_args, ctx );
-        if ( rc == 0 )
-        {
-            if ( namelistcount( ctx->src_files ) > 0 )
-            {
-                rc = DumpSchema( ctx );
-            }
-            else
-            {
-                MiniUsage (my_args);
-            }
-        }
-        context_destroy( ctx );
-
-        ArgsWhack( my_args );
-    }
-    return rc;
-}
diff --git a/libs/sra/sra-priv.h b/libs/sra/sra-priv.h
deleted file mode 100644
index c5798c5..0000000
--- a/libs/sra/sra-priv.h
+++ /dev/null
@@ -1,183 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#ifndef _h_sra_priv_
-#define _h_sra_priv_
-
-#ifndef _h_sra_sradb_
-#include <sra/sradb.h>
-#endif
-
-#ifndef _h_klib_vector_
-#include <klib/vector.h>
-#endif
-
-#ifndef _h_klib_refcount_
-#include <klib/refcount.h>
-#endif
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef KONST
-#define KONST const
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KMetadata;
-struct VDBManager;
-struct VSchema;
-struct VTable;
-struct VCursor;
-struct VTypedecl;
-struct VTypedef;
-struct VResolver;
-struct SRACache;
-
-#define CSRA_EXT(lite) (lite ? ".lite.sra" : ".sra")
-#define SRA_EXT(lite) (lite ? ".lite.sra" : ".sra")
-
-/*--------------------------------------------------------------------------
- * SRAMgr
- */
-struct SRAMgr
-{
-    struct VDBManager KONST *vmgr;
-    struct VSchema const *schema;
-#if OLD_SRAPATH_MGR
-    struct SRAPath volatile *_pmgr;
-#else
-    struct VResolver volatile *_pmgr;
-#endif
-    struct SRACache* cache;
-    KRefcount refcount;
-    KCreateMode mode;
-    bool read_only;
-};
-
-/* SRAMgrMake
- */
-rc_t SRAMgrMake ( SRAMgr **mgr,
-    struct VDBManager const *vmgr, struct KDirectory const *wd );
-
-/* Attach
- * Sever
- */
-SRAMgr *SRAMgrAttach ( const SRAMgr *self );
-rc_t SRAMgrSever ( const SRAMgr *self );
-
-
-/* AccessSRAPath
- *  returns a new reference to SRAPath
- *  do NOT access "pmgr" directly
- */
-struct SRAPath *SRAMgrAccessSRAPath ( const SRAMgr *self );
-
-/*--------------------------------------------------------------------------
- * SRATable
- */
-struct SRATable
-{
-    KONST SRAMgr *mgr;
-    struct VTable KONST *vtbl;
-    struct VCursor KONST *curs;
-    struct KMetadata KONST *meta;
-
-    Vector wcol;
-
-    KRefcount refcount;
-
-    uint32_t metavers;
-
-    KCreateMode mode;
-    bool curs_open;
-    bool read_only;
-
-    uint64_t spot_count;
-    uint64_t base_count;
-    int64_t min_spot_id;
-    int64_t max_spot_id;
-};
-
-/* Whack
- * Destroy
- */
-rc_t SRATableWhack ( SRATable *self );
-void SRATableDestroy ( SRATable *self );
-
-/* Attach
- * Sever
- */
-SRATable *SRATableAttach ( const SRATable *self );
-rc_t SRATableSever ( const SRATable *self );
-
-/* SRATableRead
- */
-rc_t SRATableRead ( const SRATable *self, spotid_t id,
-    uint32_t cid, const void **base, bitsz_t *offset, bitsz_t *size );
-
-/* SRATableColDatatype
- */
-rc_t SRATableColDatatype ( const SRATable *self, uint32_t idx,
-    struct VTypedecl *type, struct VTypedef *def );
-
-/* SRATableGetIdRange
- */
-rc_t SRATableGetIdRange ( const SRATable *self, uint32_t idx,
-    spotid_t id, spotid_t *pfirst, spotid_t *last );
-
-rc_t ResolveTablePath ( const SRAMgr *mgr, char *path, size_t psize, const char *spec, va_list args );
-
-rc_t SRATableFillOut ( SRATable *self, bool update );
-    
-/*--------------------------------------------------------------------------
- * SRAColumn
- */
-struct SRAColumn
-{
-    const SRATable *tbl;
-    KRefcount refcount;
-    uint32_t idx;
-    uint32_t elem_bits;
-    bool read_only;
-};
-
-
-/* Whackity whack
- */
-rc_t SRAColumnWhack ( SRAColumn *self );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _sra_priv_ */
diff --git a/libs/sra/sra-schema.c b/libs/sra/sra-schema.c
deleted file mode 100644
index 8833cdd..0000000
--- a/libs/sra/sra-schema.c
+++ /dev/null
@@ -1,4095 +0,0 @@
-/*===========================================================================
-*
-*                             PUBLIC DOMAIN NOTICE
-*                National Center for Biotechnology Information
-*
-*   This software/database is a "United States Government Work" under the
-*   terms of the United States Copyright Act.  It was written as part of
-*   the author's official duties as a United States Government employee and
-*   thus cannot be copyrighted.  This software/database is freely available
-*   to the public for use. The National Library of Medicine and the U.S.
-*   Government have not placed any restriction on its use or reproduction.
-*
-*   Although all reasonable efforts have been taken to ensure the accuracy
-*   and reliability of the software and data, the NLM and the U.S.
-*   Government do not and cannot warrant the performance or results that
-*   may be obtained by using this software or data. The NLM and the U.S.
-*   Government disclaim all warranties, express or implied, including
-*   warranties of performance, merchantability or fitness for any particular
-*   purpose.
-*
-*   Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-* THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT
-*/
-#include "sraschema-priv.h"
-const char sra_schema_text[] = {
- 'v', 'e', 'r', 's', 'i', 'o', 'n', ' ', '1', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f',
- ' ', 'I', '6', '4', ' ', 'v', 'd', 'b', ':', 'r', 'o', 'w', '_', 'i', 'd', '_', 'r',
- 'a', 'n', 'g', 'e', '[', '2', ']', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f', ' ', 'U',
- '1', '6', ' ', 't', 'e', 'x', 't', ':', 't', 'o', 'k', 'e', 'n', '[', '3', ']', ';',
- 'a', 'l', 'i', 'a', 's', ' ', 't', 'e', 'x', 't', ':', 't', 'o', 'k', 'e', 'n', ' ',
- 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'p', 'o', 't', '_', 'n', 'a', 'm',
- 'e', '_', 't', 'o', 'k', 'e', 'n', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f', ' ', 'a',
- 's', 'c', 'i', 'i', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e',
- 'x', 't', ';', 'a', 'l', 'i', 'a', 's', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n',
- 'a', ':', 't', 'e', 'x', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'f', 'a', 's', 't',
- 'a', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f', ' ', 'U', '8', ' ', 'I', 'N', 'S', 'D',
- 'C', ':', '4', 'n', 'a', ':', 'b', 'i', 'n', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f',
- ' ', 'B', '1', ' ', 'I', 'N', 'S', 'D', 'C', ':', '4', 'n', 'a', ':', 'p', 'a', 'c',
- 'k', 'e', 'd', '[', '4', ']', ';', 'a', 'l', 'i', 'a', 's', ' ', 'I', 'N', 'S', 'D',
- 'C', ':', '4', 'n', 'a', ':', 'p', 'a', 'c', 'k', 'e', 'd', ' ', 'I', 'N', 'S', 'D',
- 'C', ':', 'd', 'n', 'a', ':', '4', 'n', 'a', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f',
- ' ', 'U', '8', ' ', 'I', 'N', 'S', 'D', 'C', ':', '2', 'n', 'a', ':', 'b', 'i', 'n',
- ';', 't', 'y', 'p', 'e', 'd', 'e', 'f', ' ', 'U', '8', ' ', 'I', 'N', 'S', 'D', 'C',
- ':', 'x', '2', 'n', 'a', ':', 'b', 'i', 'n', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f',
- ' ', 'B', '1', ' ', 'I', 'N', 'S', 'D', 'C', ':', '2', 'n', 'a', ':', 'p', 'a', 'c',
- 'k', 'e', 'd', '[', '2', ']', ';', 'a', 'l', 'i', 'a', 's', ' ', 'I', 'N', 'S', 'D',
- 'C', ':', '2', 'n', 'a', ':', 'p', 'a', 'c', 'k', 'e', 'd', ' ', 'I', 'N', 'S', 'D',
- 'C', ':', 'd', 'n', 'a', ':', '2', 'n', 'a', ';', 'a', 'l', 'i', 'a', 's', ' ', 'I',
- 'N', 'S', 'D', 'C', ':', '2', 'n', 'a', ':', 'p', 'a', 'c', 'k', 'e', 'd', ' ', 'N',
- 'C', 'B', 'I', ':', '2', 'n', 'a', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f', ' ', 'a',
- 's', 'c', 'i', 'i', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'l', 'o', 'r', ':',
- 't', 'e', 'x', 't', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f', ' ', 'U', '8', ' ', 'I',
- 'N', 'S', 'D', 'C', ':', '2', 'c', 's', ':', 'b', 'i', 'n', ';', 't', 'y', 'p', 'e',
- 'd', 'e', 'f', ' ', 'U', '8', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'c', 's',
- ':', 'b', 'i', 'n', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f', ' ', 'B', '1', ' ', 'I',
- 'N', 'S', 'D', 'C', ':', '2', 'c', 's', ':', 'p', 'a', 'c', 'k', 'e', 'd', '[', '2',
- ']', ';', 'a', 'l', 'i', 'a', 's', ' ', 'I', 'N', 'S', 'D', 'C', ':', '2', 'c', 's',
- ':', 'p', 'a', 'c', 'k', 'e', 'd', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'l',
- 'o', 'r', ':', '2', 'c', 's', ';', 'a', 'l', 'i', 'a', 's', ' ', 'I', 'N', 'S', 'D',
- 'C', ':', '2', 'c', 's', ':', 'p', 'a', 'c', 'k', 'e', 'd', ' ', 'N', 'C', 'B', 'I',
- ':', '2', 'c', 's', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f', ' ', 'a', 's', 'c', 'i',
- 'i', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'p', 'r', 'o', 't', 'e', 'i', 'n', ':', 't',
- 'e', 'x', 't', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f', ' ', 'U', '8', ' ', 'I', 'N',
- 'S', 'D', 'C', ':', 'a', 'a', ':', 'b', 'i', 'n', ';', 't', 'y', 'p', 'e', 'd', 'e',
- 'f', ' ', 'U', '8', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't',
- 'y', ':', 'p', 'h', 'r', 'e', 'd', ';', 'a', 'l', 'i', 'a', 's', ' ', 'I', 'N', 'S',
- 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'p', 'h', 'r', 'e', 'd', ' ',
- 'N', 'C', 'B', 'I', ':', 'q', 'u', 'a', 'l', '1', ';', 't', 'y', 'p', 'e', 'd', 'e',
- 'f', ' ', 'I', '8', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't',
- 'y', ':', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', ';', 't', 'y', 'p', 'e', 'd', 'e',
- 'f', ' ', 'a', 's', 'c', 'i', 'i', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a',
- 'l', 'i', 't', 'y', ':', 't', 'e', 'x', 't', ':', 'p', 'h', 'r', 'e', 'd', '_', '3',
- '3', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f', ' ', 'a', 's', 'c', 'i', 'i', ' ', 'I',
- 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 't', 'e', 'x', 't',
- ':', 'p', 'h', 'r', 'e', 'd', '_', '6', '4', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f',
- ' ', 'a', 's', 'c', 'i', 'i', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l',
- 'i', 't', 'y', ':', 't', 'e', 'x', 't', ':', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's',
- '_', '6', '4', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f', ' ', 'I', '3', '2', ' ', 'I',
- 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', ';', 't', 'y',
- 'p', 'e', 'd', 'e', 'f', ' ', 'U', '3', '2', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c',
- 'o', 'o', 'r', 'd', ':', 'l', 'e', 'n', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f', ' ',
- 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', ' ', 'I',
- 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o', ';', 't',
- 'y', 'p', 'e', 'd', 'e', 'f', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r',
- 'd', ':', 'v', 'a', 'l', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd',
- ':', 'o', 'n', 'e', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f', ' ', 'I', 'N', 'S', 'D',
- 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o', ' ', 'I', 'N', 'S', 'D',
- 'C', ':', 'p', 'o', 's', 'i', 't', 'i', 'o', 'n', ':', 'z', 'e', 'r', 'o', ';', 't',
- 'y', 'p', 'e', 'd', 'e', 'f', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r',
- 'd', ':', 'o', 'n', 'e', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'p', 'o', 's', 'i', 't',
- 'i', 'o', 'n', ':', 'o', 'n', 'e', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f', ' ', 'I',
- 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'p', 'h', 'r', 'e',
- 'd', ' ', 'N', 'C', 'B', 'I', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'n', '_',
- 'e', 'n', 'c', 'o', 'd', 'e', 'd', ':', 'p', 'h', 'r', 'e', 'd', ';', 'a', 'l', 'i',
- 'a', 's', ' ', 'N', 'C', 'B', 'I', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'n',
- '_', 'e', 'n', 'c', 'o', 'd', 'e', 'd', ':', 'p', 'h', 'r', 'e', 'd', ' ', 'N', 'C',
- 'B', 'I', ':', 'S', 'R', 'A', ':', 'e', 'n', 'c', '_', 'q', 'u', 'a', 'l', '1', ';',
- 't', 'y', 'p', 'e', 'd', 'e', 'f', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a',
- 'l', 'i', 't', 'y', ':', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', ' ', 'N', 'C', 'B',
- 'I', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'n', '_', 'e', 'n', 'c', 'o', 'd',
- 'e', 'd', ':', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', ';', 't', 'y', 'p', 'e', 'd',
- 'e', 'f', ' ', 'I', '1', '6', ' ', 'N', 'C', 'B', 'I', ':', 'i', 's', 'a', 'm', 'p',
- '1', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f', ' ', 'F', '3', '2', ' ', 'N', 'C', 'B',
- 'I', ':', 'f', 's', 'a', 'm', 'p', '1', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f', ' ',
- 'F', '3', '2', ' ', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p', '4', '[', '4',
- ']', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f', ' ', 'B', '8', ' ', 'N', 'C', 'B', 'I',
- ':', 'a', 's', 'n', ':', 'b', 'i', 'n', 'a', 'r', 'y', ';', 't', 'y', 'p', 'e', 'd',
- 'e', 'f', ' ', 'a', 's', 'c', 'i', 'i', ' ', 'N', 'C', 'B', 'I', ':', 'a', 's', 'n',
- ':', 't', 'e', 'x', 't', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f', ' ', 'U', '6', '4',
- ' ', 'N', 'C', 'B', 'I', ':', 'g', 'i', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f', ' ',
- 'U', '3', '2', ' ', 'N', 'C', 'B', 'I', ':', 't', 'a', 'x', 'i', 'd', ';', 't', 'y',
- 'p', 'e', 'd', 'e', 'f', ' ', 'U', '3', '2', ' ', 'N', 'C', 'B', 'I', ':', 'g', 'b',
- '_', 's', 't', 'a', 't', 'e', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f', ' ', 'U', '3',
- '2', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 's', 'p', 'o', 't', 'i',
- 'd', '_', 't', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f', ' ', 'U', '6', '4', ' ', 'I',
- 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 's', 'p', 'o', 't', '_', 'i', 'd', 's',
- '_', 'f', 'o', 'u', 'n', 'd', '[', '4', ']', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f',
- ' ', 'U', '8', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'r', 'e', 'a',
- 'd', '_', 'f', 'i', 'l', 't', 'e', 'r', ';', 'a', 'l', 'i', 'a', 's', ' ', 'I', 'N',
- 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'r', 'e', 'a', 'd', '_', 'f', 'i', 'l', 't',
- 'e', 'r', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'r', 'e', 'a', 'd', '_',
- 'f', 'i', 'l', 't', 'e', 'r', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f', ' ', 'U', '8',
- ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'x', 'r', 'e', 'a', 'd', '_',
- 't', 'y', 'p', 'e', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f', ' ', 'I', 'N', 'S', 'D',
- 'C', ':', 'S', 'R', 'A', ':', 'x', 'r', 'e', 'a', 'd', '_', 't', 'y', 'p', 'e', ' ',
- 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'r', 'e', 'a', 'd', '_', 't', 'y',
- 'p', 'e', ';', 'a', 'l', 'i', 'a', 's', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R',
- 'A', ':', 'r', 'e', 'a', 'd', '_', 't', 'y', 'p', 'e', ' ', 'N', 'C', 'B', 'I', ':',
- 'S', 'R', 'A', ':', 'r', 'e', 'a', 'd', '_', 't', 'y', 'p', 'e', ';', 't', 'y', 'p',
- 'e', 'd', 'e', 'f', ' ', 'U', '8', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A',
- ':', 'p', 'l', 'a', 't', 'f', 'o', 'r', 'm', '_', 'i', 'd', ';', 'a', 'l', 'i', 'a',
- 's', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'p', 'l', 'a', 't', 'f',
- 'o', 'r', 'm', '_', 'i', 'd', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'p',
- 'l', 'a', 't', 'f', 'o', 'r', 'm', '_', 'i', 'd', ';', 't', 'y', 'p', 'e', 'd', 'e',
- 'f', ' ', 'U', '1', '6', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'S', 'e',
- 'g', 'm', 'e', 'n', 't', '[', '2', ']', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f', ' ',
- 'B', '8', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'S', 'p', 'o', 't', 'D',
- 'e', 's', 'c', '[', '1', '6', ']', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f', ' ', 'B',
- '8', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'R', 'e', 'a', 'd', 'D', 'e',
- 's', 'c', '[', '8', '0', ']', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f', ' ', 'N', 'C',
- 'B', 'I', ':', 'f', 's', 'a', 'm', 'p', '4', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R',
- 'A', ':', 'r', 'o', 't', 'a', 't', 'e', 'd', '_', 'f', 's', 'a', 'm', 'p', '4', ';',
- 't', 'y', 'p', 'e', 'd', 'e', 'f', ' ', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm',
- 'p', '4', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p', 'p',
- 'e', 'd', '_', 'f', 's', 'a', 'm', 'p', '4', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f',
- ' ', 'U', '1', '6', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'p', 'o', 's',
- '1', '6', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f', ' ', 'I', 'N', 'S', 'D', 'C', ':',
- 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', ' ',
- 'N', 'C', 'B', 'I', ':', 'q', 'u', 'a', 'l', '4', '[', '4', ']', ';', 't', 'y', 'p',
- 'e', 'd', 'e', 'f', ' ', 'N', 'C', 'B', 'I', ':', 'q', 'u', 'a', 'l', '4', ' ', 'N',
- 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'r', 'o', 't', 'a', 't', 'e', 'd', '_', 'q',
- 'u', 'a', 'l', '4', ';', 't', 'y', 'p', 'e', 'd', 'e', 'f', ' ', 'N', 'C', 'B', 'I',
- ':', 'q', 'u', 'a', 'l', '4', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's',
- 'w', 'a', 'p', 'p', 'e', 'd', '_', 'q', 'u', 'a', 'l', '4', ';', 't', 'y', 'p', 'e',
- 'd', 'e', 'f', ' ', 'B', '8', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'e',
- 'n', 'c', 'o', 'd', 'e', 'd', '_', 'q', 'u', 'a', 'l', '4', ';', 'a', 'l', 'i', 'a',
- 's', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'e', 'n', 'c', 'o', 'd', 'e',
- 'd', '_', 'q', 'u', 'a', 'l', '4', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':',
- 'c', 'o', 'm', 'p', '_', 'q', 'u', 'a', 'l', '4', ';', 't', 'y', 'p', 'e', 's', 'e',
- 't', ' ', 'i', 'n', 't', 'e', 'g', 'e', 'r', '_', 's', 'e', 't', '{', 'U', '8', ',',
- 'U', '1', '6', ',', 'U', '3', '2', ',', 'U', '6', '4', ',', 'I', '8', ',', 'I', '1',
- '6', ',', 'I', '3', '2', ',', 'I', '6', '4', '}', ';', 't', 'y', 'p', 'e', 's', 'e',
- 't', ' ', 'f', 'l', 'o', 'a', 't', '_', 's', 'e', 't', '{', 'F', '3', '2', ',', 'F',
- '6', '4', '}', ';', 't', 'y', 'p', 'e', 's', 'e', 't', ' ', 'n', 'u', 'm', 'e', 'r',
- 'i', 'c', '_', 's', 'e', 't', '{', 'U', '8', ',', 'U', '1', '6', ',', 'U', '3', '2',
- ',', 'U', '6', '4', ',', 'I', '8', ',', 'I', '1', '6', ',', 'I', '3', '2', ',', 'I',
- '6', '4', ',', 'F', '3', '2', ',', 'F', '6', '4', '}', ';', 't', 'y', 'p', 'e', 's',
- 'e', 't', ' ', 't', 'e', 'x', 't', '_', 's', 'e', 't', '{', 'u', 't', 'f', '8', ',',
- 'u', 't', 'f', '1', '6', ',', 'u', 't', 'f', '3', '2', ',', 'a', 's', 'c', 'i', 'i',
- '}', ';', 't', 'y', 'p', 'e', 's', 'e', 't', ' ', 't', 'e', 'x', 't', '8', '_', 's',
- 'e', 't', '{', 'u', 't', 'f', '8', ',', 'a', 's', 'c', 'i', 'i', '}', ';', 't', 'y',
- 'p', 'e', 's', 'e', 't', ' ', 't', 'r', 'a', 'n', 's', 'p', 'o', 's', 'e', '_', 's',
- 'e', 't', '{', 'B', '8', ',', 'B', '1', '6', ',', 'B', '3', '2', ',', 'B', '6', '4',
- '}', ';', 't', 'y', 'p', 'e', 's', 'e', 't', ' ', 'p', 'a', 'c', 'k', '_', 's', 'e',
- 't', '{', 'B', '8', ',', 'B', '1', '6', ',', 'B', '3', '2', ',', 'B', '6', '4', ',',
- 'U', '8', ',', 'U', '1', '6', ',', 'U', '3', '2', ',', 'U', '6', '4', ',', 'I', '8',
- ',', 'I', '1', '6', ',', 'I', '3', '2', ',', 'I', '6', '4', '}', ';', 't', 'y', 'p',
- 'e', 's', 'e', 't', ' ', 'i', 'z', 'i', 'p', '_', 's', 'e', 't', '{', 'U', '8', ',',
- 'U', '1', '6', ',', 'U', '3', '2', ',', 'U', '6', '4', ',', 'I', '8', ',', 'I', '1',
- '6', ',', 'I', '3', '2', ',', 'I', '6', '4', '}', ';', 't', 'y', 'p', 'e', 's', 'e',
- 't', ' ', 'f', 'z', 'i', 'p', '_', 's', 'e', 't', '{', 'F', '3', '2', '}', ';', 't',
- 'y', 'p', 'e', 's', 'e', 't', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's',
- 't', 'a', 't', 's', ':', 'q', 'u', 'a', 'l', '_', 't', 'y', 'p', 'e', '{', 'I', 'N',
- 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'p', 'h', 'r', 'e', 'd',
- ',', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'l', 'o',
- 'g', '_', 'o', 'd', 'd', 's', ',', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l',
- 'i', 't', 'y', ':', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', '[', '4', ']', '}', ';',
- 't', 'y', 'p', 'e', 's', 'e', 't', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':',
- '_', '4', '5', '4', '_', ':', 'd', 'r', 'd', 'p', 'a', 'r', 'a', 'm', '_', 's', 'e',
- 't', '{', 'U', '8', ',', 'a', 's', 'c', 'i', 'i', ',', 'I', 'N', 'S', 'D', 'C', ':',
- '2', 'n', 'a', ':', 'p', 'a', 'c', 'k', 'e', 'd', '}', ';', 'f', 'm', 't', 'd', 'e',
- 'f', ' ', 'm', 'e', 'r', 'g', 'e', 'd', '_', 'f', 'm', 't', ';', 'f', 'm', 't', 'd',
- 'e', 'f', ' ', 't', 'r', 'a', 'n', 's', 'p', 'o', 's', 'e', 'd', '_', 'f', 'm', 't',
- ';', 'f', 'm', 't', 'd', 'e', 'f', ' ', 'd', 'e', 'l', 't', 'a', '_', 'a', 'v', 'e',
- 'r', 'a', 'g', 'e', 'd', '_', 'f', 'm', 't', ';', 'f', 'm', 't', 'd', 'e', 'f', ' ',
- 'i', 'z', 'i', 'p', '_', 'f', 'm', 't', ';', 'f', 'm', 't', 'd', 'e', 'f', ' ', 'f',
- 'z', 'i', 'p', '_', 'f', 'm', 't', ';', 'f', 'm', 't', 'd', 'e', 'f', ' ', 'r', 'l',
- 'e', '_', 'f', 'm', 't', ';', 'f', 'm', 't', 'd', 'e', 'f', ' ', 'z', 'l', 'i', 'b',
- '_', 'f', 'm', 't', ';', 'f', 'm', 't', 'd', 'e', 'f', ' ', 'b', 'z', 'i', 'p', '2',
- '_', 'f', 'm', 't', ';', 'f', 'm', 't', 'd', 'e', 'f', ' ', 'm', 'e', 'r', 'g', 'e',
- 'd', '_', 't', ';', 'f', 'm', 't', 'd', 'e', 'f', ' ', 'f', 'p', '_', 'e', 'n', 'c',
- 'o', 'd', 'e', 'd', '_', 't', ';', 'f', 'm', 't', 'd', 'e', 'f', ' ', 'r', 'l', '_',
- 'e', 'n', 'c', 'o', 'd', 'e', 'd', '_', 't', ';', 'f', 'm', 't', 'd', 'e', 'f', ' ',
- 'N', 'C', 'B', 'I', ':', 'z', 'l', 'i', 'b', '_', 'e', 'n', 'c', 'o', 'd', 'e', 'd',
- '_', 't', ';', 'f', 'm', 't', 'd', 'e', 'f', ' ', 'N', 'C', 'B', 'I', ':', 'f', 'p',
- '_', 'e', 'n', 'c', 'o', 'd', 'e', 'd', '_', 't', ';', 'c', 'o', 'n', 's', 't', ' ',
- 'U', '8', ' ', 'A', 'L', 'I', 'G', 'N', '_', 'L', 'E', 'F', 'T', '=', '0', ';', 'c',
- 'o', 'n', 's', 't', ' ', 'U', '8', ' ', 'A', 'L', 'I', 'G', 'N', '_', 'R', 'I', 'G',
- 'H', 'T', '=', '1', ';', 'c', 'o', 'n', 's', 't', ' ', 'I', '3', '2', ' ', 'Z', '_',
- 'F', 'I', 'L', 'T', 'E', 'R', 'E', 'D', '=', '1', ';', 'c', 'o', 'n', 's', 't', ' ',
- 'I', '3', '2', ' ', 'Z', '_', 'H', 'U', 'F', 'F', 'M', 'A', 'N', '_', 'O', 'N', 'L',
- 'Y', '=', '2', ';', 'c', 'o', 'n', 's', 't', ' ', 'I', '3', '2', ' ', 'Z', '_', 'R',
- 'L', 'E', '=', '3', ';', 'c', 'o', 'n', 's', 't', ' ', 'I', '3', '2', ' ', 'Z', '_',
- 'D', 'E', 'F', 'A', 'U', 'L', 'T', '_', 'S', 'T', 'R', 'A', 'T', 'E', 'G', 'Y', '=',
- '0', ';', 'c', 'o', 'n', 's', 't', ' ', 'I', '3', '2', ' ', 'Z', '_', 'N', 'O', '_',
- 'C', 'O', 'M', 'P', 'R', 'E', 'S', 'S', 'I', 'O', 'N', '=', '0', ';', 'c', 'o', 'n',
- 's', 't', ' ', 'I', '3', '2', ' ', 'Z', '_', 'B', 'E', 'S', 'T', '_', 'S', 'P', 'E',
- 'E', 'D', '=', '1', ';', 'c', 'o', 'n', 's', 't', ' ', 'I', '3', '2', ' ', 'Z', '_',
- 'B', 'E', 'S', 'T', '_', 'C', 'O', 'M', 'P', 'R', 'E', 'S', 'S', 'I', 'O', 'N', '=',
- '9', ';', 'c', 'o', 'n', 's', 't', ' ', 'I', '3', '2', ' ', 'Z', '_', 'D', 'E', 'F',
- 'A', 'U', 'L', 'T', '_', 'C', 'O', 'M', 'P', 'R', 'E', 'S', 'S', 'I', 'O', 'N', '=',
- '-', '1', ';', 'c', 'o', 'n', 's', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', '4', 'n',
- 'a', ':', 'b', 'i', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', '4', 'n', 'a', ':', 'm',
- 'a', 'p', ':', 'B', 'I', 'N', 'S', 'E', 'T', '=', '[', '0', ',', '1', ',', '2', ',',
- '3', ',', '4', ',', '5', ',', '6', ',', '7', ',', '8', ',', '9', ',', '1', '0', ',',
- '1', '1', ',', '1', '2', ',', '1', '3', ',', '1', '4', ',', '1', '5', ']', ';', 'c',
- 'o', 'n', 's', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e',
- 'x', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', '4', 'n', 'a', ':', 'm', 'a', 'p', ':',
- 'C', 'H', 'A', 'R', 'S', 'E', 'T', '=', '\'', '.', 'A', 'C', 'M', 'G', 'R', 'S',
- 'V', 'T', 'W', 'Y', 'H', 'K', 'D', 'B', 'N', '\'', ';', 'c', 'o', 'n', 's', 't',
- ' ', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ' ', 'I',
- 'N', 'S', 'D', 'C', ':', '4', 'n', 'a', ':', 'a', 'c', 'c', 'e', 'p', 't', ':', 'C',
- 'H', 'A', 'R', 'S', 'E', 'T', '=', '\'', '.', 'A', 'C', 'M', 'G', 'R', 'S', 'V',
- 'T', 'W', 'Y', 'H', 'K', 'D', 'B', 'N', 'a', 'c', 'm', 'g', 'r', 's', 'v', 't', 'w',
- 'y', 'h', 'k', 'd', 'b', 'n', '\'', ';', 'c', 'o', 'n', 's', 't', ' ', 'I', 'N',
- 'S', 'D', 'C', ':', '2', 'n', 'a', ':', 'b', 'i', 'n', ' ', 'I', 'N', 'S', 'D', 'C',
- ':', '2', 'n', 'a', ':', 'm', 'a', 'p', ':', 'B', 'I', 'N', 'S', 'E', 'T', '=', '[',
- '0', ',', '1', ',', '2', ',', '3', ']', ';', 'c', 'o', 'n', 's', 't', ' ', 'I', 'N',
- 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ' ', 'I', 'N', 'S', 'D',
- 'C', ':', '2', 'n', 'a', ':', 'm', 'a', 'p', ':', 'C', 'H', 'A', 'R', 'S', 'E', 'T',
- '=', '\'', 'A', 'C', 'G', 'T', '\'', ';', 'c', 'o', 'n', 's', 't', ' ', 'I', 'N',
- 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ' ', 'I', 'N', 'S', 'D',
- 'C', ':', '2', 'n', 'a', ':', 'a', 'c', 'c', 'e', 'p', 't', ':', 'C', 'H', 'A', 'R',
- 'S', 'E', 'T', '=', '\'', 'A', 'C', 'G', 'T', 'a', 'c', 'g', 't', '\'', ';', 'c',
- 'o', 'n', 's', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'n', 'a', ':', 'b',
- 'i', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'n', 'a', ':', 'm', 'a', 'p',
- ':', 'B', 'I', 'N', 'S', 'E', 'T', '=', '[', '0', ',', '1', ',', '2', ',', '3', ',',
- '4', ']', ';', 'c', 'o', 'n', 's', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n',
- 'a', ':', 't', 'e', 'x', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'n', 'a',
- ':', 'm', 'a', 'p', ':', 'C', 'H', 'A', 'R', 'S', 'E', 'T', '=', '\'', 'A', 'C',
- 'G', 'T', 'N', '\'', ';', 'c', 'o', 'n', 's', 't', ' ', 'I', 'N', 'S', 'D', 'C',
- ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'x',
- '2', 'n', 'a', ':', 'a', 'c', 'c', 'e', 'p', 't', ':', 'C', 'H', 'A', 'R', 'S', 'E',
- 'T', '=', '\'', 'A', 'C', 'G', 'T', 'N', 'a', 'c', 'g', 't', 'n', '.', '\'', ';',
- 'c', 'o', 'n', 's', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', '2', 'c', 's', ':', 'b',
- 'i', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', '2', 'c', 's', ':', 'm', 'a', 'p', ':',
- 'B', 'I', 'N', 'S', 'E', 'T', '=', '[', '0', ',', '1', ',', '2', ',', '3', ']', ';',
- 'c', 'o', 'n', 's', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'l', 'o', 'r',
- ':', 't', 'e', 'x', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', '2', 'c', 's', ':', 'm',
- 'a', 'p', ':', 'C', 'H', 'A', 'R', 'S', 'E', 'T', '=', '\'', '0', '1', '2', '3',
- '\'', ';', 'c', 'o', 'n', 's', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o',
- 'l', 'o', 'r', ':', 't', 'e', 'x', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', '2', 'c',
- 's', ':', 'a', 'c', 'c', 'e', 'p', 't', ':', 'C', 'H', 'A', 'R', 'S', 'E', 'T', '=',
- '\'', '0', '1', '2', '3', '\'', ';', 'c', 'o', 'n', 's', 't', ' ', 'I', 'N', 'S',
- 'D', 'C', ':', 'x', '2', 'c', 's', ':', 'b', 'i', 'n', ' ', 'I', 'N', 'S', 'D', 'C',
- ':', 'x', '2', 'c', 's', ':', 'm', 'a', 'p', ':', 'B', 'I', 'N', 'S', 'E', 'T', '=',
- '[', '0', ',', '1', ',', '2', ',', '3', ',', '4', ']', ';', 'c', 'o', 'n', 's', 't',
- ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'l', 'o', 'r', ':', 't', 'e', 'x', 't',
- ' ', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'c', 's', ':', 'm', 'a', 'p', ':', 'C',
- 'H', 'A', 'R', 'S', 'E', 'T', '=', '\'', '0', '1', '2', '3', '.', '\'', ';', 'c',
- 'o', 'n', 's', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'l', 'o', 'r', ':',
- 't', 'e', 'x', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'c', 's', ':', 'a',
- 'c', 'c', 'e', 'p', 't', ':', 'C', 'H', 'A', 'R', 'S', 'E', 'T', '=', '\'', '0',
- '1', '2', '3', '.', '\'', ';', 'c', 'o', 'n', 's', 't', ' ', 'U', '8', ' ', 'I',
- 'N', 'S', 'D', 'C', ':', 'c', 'o', 'l', 'o', 'r', ':', 'd', 'e', 'f', 'a', 'u', 'l',
- 't', '_', 'm', 'a', 't', 'r', 'i', 'x', '=', '[', '0', ',', '1', ',', '2', ',', '3',
- ',', '4', ',', '1', ',', '0', ',', '3', ',', '2', ',', '4', ',', '2', ',', '3', ',',
- '0', ',', '1', ',', '4', ',', '3', ',', '2', ',', '1', ',', '0', ',', '4', ',', '4',
- ',', '4', ',', '4', ',', '4', ',', '4', ']', ';', 'c', 'o', 'n', 's', 't', ' ', 'I',
- 'N', 'S', 'D', 'C', ':', 'a', 'a', ':', 'b', 'i', 'n', ' ', 'I', 'N', 'S', 'D', 'C',
- ':', 'a', 'a', ':', 'm', 'a', 'p', ':', 'B', 'I', 'N', 'S', 'E', 'T', '=', '[', '1',
- ',', '2', ',', '3', ',', '4', ',', '5', ',', '6', ',', '7', ',', '8', ',', '9', ',',
- '1', '0', ',', '1', '1', ',', '1', '2', ',', '1', '3', ',', '1', '4', ',', '1', '5',
- ',', '1', '6', ',', '1', '7', ',', '1', '8', ',', '1', '9', ',', '2', '0', ',', '2',
- '1', ',', '2', '2', ',', '2', '3', ',', '2', '4', ',', '2', '5', ']', ';', 'c', 'o',
- 'n', 's', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'p', 'r', 'o', 't', 'e', 'i', 'n',
- ':', 't', 'e', 'x', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'a', 'a', ':', 'm', 'a',
- 'p', ':', 'C', 'H', 'A', 'R', 'S', 'E', 'T', '=', '\'', 'A', 'B', 'C', 'D', 'E',
- 'F', 'G', 'H', 'I', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'X', 'Y',
- 'Z', 'U', '*', '\'', ';', 'c', 'o', 'n', 's', 't', ' ', 'I', 'N', 'S', 'D', 'C',
- ':', 'p', 'r', 'o', 't', 'e', 'i', 'n', ':', 't', 'e', 'x', 't', ' ', 'I', 'N', 'S',
- 'D', 'C', ':', 'a', 'a', ':', 'a', 'c', 'c', 'e', 'p', 't', ':', 'C', 'H', 'A', 'R',
- 'S', 'E', 'T', '=', '\'', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'K', 'L',
- 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'X', 'Y', 'Z', 'U', '*', 'a', 'b', 'c',
- 'd', 'e', 'f', 'g', 'h', 'i', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w',
- 'x', 'y', 'z', 'u', '\'', ';', 'c', 'o', 'n', 's', 't', ' ', 'I', 'N', 'S', 'D',
- 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'o', 'n', 'e', ' ', 'I', 'N', 'S', 'D', 'C',
- ':', 'c', 'o', 'o', 'r', 'd', ':', 'm', 'i', 'n', ':', 'o', 'n', 'e', '=', '2', '1',
- '4', '7', '4', '8', '3', '6', '4', '9', ';', 'c', 'o', 'n', 's', 't', ' ', 'I', 'N',
- 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'o', 'n', 'e', ' ', 'I', 'N', 'S',
- 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'm', 'a', 'x', ':', 'o', 'n', 'e', '=',
- '1', '0', '7', '3', '7', '4', '1', '8', '2', '3', ';', 'c', 'o', 'n', 's', 't', ' ',
- 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o', ' ',
- 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'm', 'i', 'n', ':', 'z',
- 'e', 'r', 'o', '=', '2', '1', '4', '7', '4', '8', '3', '6', '4', '8', ';', 'c', 'o',
- 'n', 's', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'z',
- 'e', 'r', 'o', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'm',
- 'a', 'x', ':', 'z', 'e', 'r', 'o', '=', '1', '0', '7', '3', '7', '4', '1', '8', '2',
- '2', ';', 'c', 'o', 'n', 's', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A',
- ':', 'r', 'e', 'a', 'd', '_', 'f', 'i', 'l', 't', 'e', 'r', ' ', 'S', 'R', 'A', '_',
- 'R', 'E', 'A', 'D', '_', 'F', 'I', 'L', 'T', 'E', 'R', '_', 'P', 'A', 'S', 'S', '=',
- '0', ';', 'c', 'o', 'n', 's', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A',
- ':', 'r', 'e', 'a', 'd', '_', 'f', 'i', 'l', 't', 'e', 'r', ' ', 'S', 'R', 'A', '_',
- 'R', 'E', 'A', 'D', '_', 'F', 'I', 'L', 'T', 'E', 'R', '_', 'R', 'E', 'J', 'E', 'C',
- 'T', '=', '1', ';', 'c', 'o', 'n', 's', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S',
- 'R', 'A', ':', 'r', 'e', 'a', 'd', '_', 'f', 'i', 'l', 't', 'e', 'r', ' ', 'S', 'R',
- 'A', '_', 'R', 'E', 'A', 'D', '_', 'F', 'I', 'L', 'T', 'E', 'R', '_', 'C', 'R', 'I',
- 'T', 'E', 'R', 'I', 'A', '=', '2', ';', 'c', 'o', 'n', 's', 't', ' ', 'I', 'N', 'S',
- 'D', 'C', ':', 'S', 'R', 'A', ':', 'r', 'e', 'a', 'd', '_', 'f', 'i', 'l', 't', 'e',
- 'r', ' ', 'S', 'R', 'A', '_', 'R', 'E', 'A', 'D', '_', 'F', 'I', 'L', 'T', 'E', 'R',
- '_', 'R', 'E', 'D', 'A', 'C', 'T', 'E', 'D', '=', '3', ';', 'c', 'o', 'n', 's', 't',
- ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'x', 'r', 'e', 'a', 'd', '_',
- 't', 'y', 'p', 'e', ' ', 'S', 'R', 'A', '_', 'R', 'E', 'A', 'D', '_', 'T', 'Y', 'P',
- 'E', '_', 'T', 'E', 'C', 'H', 'N', 'I', 'C', 'A', 'L', '=', '0', ';', 'c', 'o', 'n',
- 's', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'x', 'r', 'e', 'a',
- 'd', '_', 't', 'y', 'p', 'e', ' ', 'S', 'R', 'A', '_', 'R', 'E', 'A', 'D', '_', 'T',
- 'Y', 'P', 'E', '_', 'B', 'I', 'O', 'L', 'O', 'G', 'I', 'C', 'A', 'L', '=', '1', ';',
- 'c', 'o', 'n', 's', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'x',
- 'r', 'e', 'a', 'd', '_', 't', 'y', 'p', 'e', ' ', 'S', 'R', 'A', '_', 'R', 'E', 'A',
- 'D', '_', 'T', 'Y', 'P', 'E', '_', 'F', 'O', 'R', 'W', 'A', 'R', 'D', '=', '2', ';',
- 'c', 'o', 'n', 's', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'x',
- 'r', 'e', 'a', 'd', '_', 't', 'y', 'p', 'e', ' ', 'S', 'R', 'A', '_', 'R', 'E', 'A',
- 'D', '_', 'T', 'Y', 'P', 'E', '_', 'R', 'E', 'V', 'E', 'R', 'S', 'E', '=', '4', ';',
- 'c', 'o', 'n', 's', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'p',
- 'l', 'a', 't', 'f', 'o', 'r', 'm', '_', 'i', 'd', ' ', 'S', 'R', 'A', '_', 'P', 'L',
- 'A', 'T', 'F', 'O', 'R', 'M', '_', 'U', 'N', 'D', 'E', 'F', 'I', 'N', 'E', 'D', '=',
- '0', ';', 'c', 'o', 'n', 's', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A',
- ':', 'p', 'l', 'a', 't', 'f', 'o', 'r', 'm', '_', 'i', 'd', ' ', 'S', 'R', 'A', '_',
- 'P', 'L', 'A', 'T', 'F', 'O', 'R', 'M', '_', '4', '5', '4', '=', '1', ';', 'c', 'o',
- 'n', 's', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'p', 'l', 'a',
- 't', 'f', 'o', 'r', 'm', '_', 'i', 'd', ' ', 'S', 'R', 'A', '_', 'P', 'L', 'A', 'T',
- 'F', 'O', 'R', 'M', '_', 'I', 'L', 'L', 'U', 'M', 'I', 'N', 'A', '=', '2', ';', 'c',
- 'o', 'n', 's', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'p', 'l',
- 'a', 't', 'f', 'o', 'r', 'm', '_', 'i', 'd', ' ', 'S', 'R', 'A', '_', 'P', 'L', 'A',
- 'T', 'F', 'O', 'R', 'M', '_', 'A', 'B', 'S', 'O', 'L', 'I', 'D', '=', '3', ';', 'c',
- 'o', 'n', 's', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'p', 'l',
- 'a', 't', 'f', 'o', 'r', 'm', '_', 'i', 'd', ' ', 'S', 'R', 'A', '_', 'P', 'L', 'A',
- 'T', 'F', 'O', 'R', 'M', '_', 'C', 'O', 'M', 'P', 'L', 'E', 'T', 'E', '_', 'G', 'E',
- 'N', 'O', 'M', 'I', 'C', 'S', '=', '4', ';', 'c', 'o', 'n', 's', 't', ' ', 'I', 'N',
- 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'p', 'l', 'a', 't', 'f', 'o', 'r', 'm', '_',
- 'i', 'd', ' ', 'S', 'R', 'A', '_', 'P', 'L', 'A', 'T', 'F', 'O', 'R', 'M', '_', 'H',
- 'E', 'L', 'I', 'C', 'O', 'S', '=', '5', ';', 'c', 'o', 'n', 's', 't', ' ', 'I', 'N',
- 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'p', 'l', 'a', 't', 'f', 'o', 'r', 'm', '_',
- 'i', 'd', ' ', 'S', 'R', 'A', '_', 'P', 'L', 'A', 'T', 'F', 'O', 'R', 'M', '_', 'P',
- 'A', 'C', 'B', 'I', 'O', '_', 'S', 'M', 'R', 'T', '=', '6', ';', 'c', 'o', 'n', 's',
- 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'p', 'l', 'a', 't', 'f',
- 'o', 'r', 'm', '_', 'i', 'd', ' ', 'S', 'R', 'A', '_', 'P', 'L', 'A', 'T', 'F', 'O',
- 'R', 'M', '_', 'I', 'O', 'N', '_', 'T', 'O', 'R', 'R', 'E', 'N', 'T', '=', '7', ';',
- 'c', 'o', 'n', 's', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'p',
- 'l', 'a', 't', 'f', 'o', 'r', 'm', '_', 'i', 'd', ' ', 'S', 'R', 'A', '_', 'P', 'L',
- 'A', 'T', 'F', 'O', 'R', 'M', '_', 'S', 'A', 'N', 'G', 'E', 'R', '=', '8', ';', 'c',
- 'o', 'n', 's', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't',
- 'y', ':', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', ' ', 'N', 'C', 'B', 'I', ':', 'q',
- 'u', 'a', 'l', 'i', 't', 'y', ':', 'f', 'r', 'o', 'm', ':', 'l', 'o', 'g', '_', 'o',
- 'd', 'd', 's', '=', '[', '-', '6', ',', '-', '5', ',', '-', '4', ',', '-', '3', ',',
- '-', '2', ',', '-', '1', ',', '0', ',', '1', ',', '2', ',', '3', ',', '4', ',', '5',
- ',', '6', ',', '7', ',', '8', ',', '9', ',', '1', '0', ',', '1', '1', ',', '1', '2',
- ',', '1', '3', ',', '1', '4', ',', '1', '5', ',', '1', '6', ',', '1', '7', ',', '1',
- '8', ',', '1', '9', ',', '2', '0', ',', '2', '1', ',', '2', '2', ',', '2', '3', ',',
- '2', '4', ',', '2', '5', ',', '2', '6', ',', '2', '7', ',', '2', '8', ',', '2', '9',
- ',', '3', '0', ',', '3', '1', ',', '3', '2', ',', '3', '3', ',', '3', '4', ',', '3',
- '5', ',', '3', '6', ',', '3', '7', ',', '3', '8', ',', '3', '9', ',', '4', '0', ']',
- ';', 'c', 'o', 'n', 's', 't', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l',
- 'i', 't', 'y', ':', 'p', 'h', 'r', 'e', 'd', ' ', 'N', 'C', 'B', 'I', ':', 'q', 'u',
- 'a', 'l', 'i', 't', 'y', ':', 't', 'o', ':', 'p', 'h', 'r', 'e', 'd', '=', '[', '0',
- ',', '1', ',', '1', ',', '2', ',', '2', ',', '3', ',', '3', ',', '4', ',', '4', ',',
- '5', ',', '5', ',', '6', ',', '7', ',', '8', ',', '9', ',', '1', '0', ',', '1', '0',
- ',', '1', '1', ',', '1', '2', ',', '1', '3', ',', '1', '4', ',', '1', '5', ',', '1',
- '6', ',', '1', '7', ',', '1', '8', ',', '1', '9', ',', '2', '0', ',', '2', '1', ',',
- '2', '2', ',', '2', '3', ',', '2', '4', ',', '2', '5', ',', '2', '6', ',', '2', '7',
- ',', '2', '8', ',', '2', '9', ',', '3', '0', ',', '3', '1', ',', '3', '2', ',', '3',
- '3', ',', '3', '4', ',', '3', '5', ',', '3', '6', ',', '3', '7', ',', '3', '8', ',',
- '3', '9', ',', '4', '0', ']', ';', 'c', 'o', 'n', 's', 't', ' ', 'U', '1', '6', ' ',
- 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'n', 'a', 'm', 'e', '_', 't', 'o', 'k',
- 'e', 'n', ':', 'u', 'n', 'r', 'e', 'c', 'o', 'g', 'n', 'i', 'z', 'e', 'd', '=', '1',
- ';', 'c', 'o', 'n', 's', 't', ' ', 'U', '1', '6', ' ', 'N', 'C', 'B', 'I', ':', 'S',
- 'R', 'A', ':', 'n', 'a', 'm', 'e', '_', 't', 'o', 'k', 'e', 'n', ':', 'r', 'e', 'c',
- 'o', 'g', 'n', 'i', 'z', 'e', 'd', '=', '2', ';', 'c', 'o', 'n', 's', 't', ' ', 'U',
- '1', '6', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'n', 'a', 'm', 'e', '_',
- 't', 'o', 'k', 'e', 'n', ':', 'Q', '=', '3', ';', 'c', 'o', 'n', 's', 't', ' ', 'U',
- '1', '6', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'n', 'a', 'm', 'e', '_',
- 't', 'o', 'k', 'e', 'n', ':', 'X', '=', '4', ';', 'c', 'o', 'n', 's', 't', ' ', 'U',
- '1', '6', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'n', 'a', 'm', 'e', '_',
- 't', 'o', 'k', 'e', 'n', ':', 'Y', '=', '5', ';', 'c', 'o', 'n', 's', 't', ' ', 'U',
- '1', '6', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'n', 'a', 'm', 'e', '_',
- 't', 'o', 'k', 'e', 'n', ':', 'T', '=', '6', ';', 'c', 'o', 'n', 's', 't', ' ', 'U',
- '1', '6', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'n', 'a', 'm', 'e', '_',
- 't', 'o', 'k', 'e', 'n', ':', 'L', '=', '7', ';', 'c', 'o', 'n', 's', 't', ' ', 'U',
- '1', '6', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'n', 'a', 'm', 'e', '_',
- 't', 'o', 'k', 'e', 'n', ':', 's', 'i', 'g', 'n', 'e', 'd', ':', 'X', '=', '8', ';',
- 'c', 'o', 'n', 's', 't', ' ', 'U', '1', '6', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R',
- 'A', ':', 'n', 'a', 'm', 'e', '_', 't', 'o', 'k', 'e', 'n', ':', 's', 'i', 'g', 'n',
- 'e', 'd', ':', 'Y', '=', '9', ';', 'c', 'o', 'n', 's', 't', ' ', 'U', '1', '6', ' ',
- 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'n', 'a', 'm', 'e', '_', 't', 'o', 'k',
- 'e', 'n', ':', 's', 'i', 'g', 'n', 'e', 'd', ':', 'T', '=', '1', '0', ';', 'c', 'o',
- 'n', 's', 't', ' ', 'U', '1', '6', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':',
- 'n', 'a', 'm', 'e', '_', 't', 'o', 'k', 'e', 'n', ':', 's', 'i', 'g', 'n', 'e', 'd',
- ':', 'L', '=', '1', '1', ';', 'c', 'o', 'n', 's', 't', ' ', 'U', '1', '6', ' ', 'N',
- 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'n', 'a', 'm', 'e', '_', 't', 'o', 'k', 'e',
- 'n', ':', 'o', 'c', 't', 'a', 'l', ':', 'X', '=', '1', '2', ';', 'c', 'o', 'n', 's',
- 't', ' ', 'U', '1', '6', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'n', 'a',
- 'm', 'e', '_', 't', 'o', 'k', 'e', 'n', ':', 'o', 'c', 't', 'a', 'l', ':', 'Y', '=',
- '1', '3', ';', 'c', 'o', 'n', 's', 't', ' ', 'U', '1', '6', ' ', 'N', 'C', 'B', 'I',
- ':', 'S', 'R', 'A', ':', 'n', 'a', 'm', 'e', '_', 't', 'o', 'k', 'e', 'n', ':', 'o',
- 'c', 't', 'a', 'l', ':', 'T', '=', '1', '4', ';', 'c', 'o', 'n', 's', 't', ' ', 'U',
- '1', '6', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'n', 'a', 'm', 'e', '_',
- 't', 'o', 'k', 'e', 'n', ':', 'o', 'c', 't', 'a', 'l', ':', 'L', '=', '1', '5', ';',
- 'c', 'o', 'n', 's', 't', ' ', 'U', '1', '6', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R',
- 'A', ':', 'n', 'a', 'm', 'e', '_', 't', 'o', 'k', 'e', 'n', ':', 'h', 'e', 'x', ':',
- 'u', 'p', 'p', 'e', 'r', ':', 'X', '=', '1', '6', ';', 'c', 'o', 'n', 's', 't', ' ',
- 'U', '1', '6', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'n', 'a', 'm', 'e',
- '_', 't', 'o', 'k', 'e', 'n', ':', 'h', 'e', 'x', ':', 'u', 'p', 'p', 'e', 'r', ':',
- 'Y', '=', '1', '7', ';', 'c', 'o', 'n', 's', 't', ' ', 'U', '1', '6', ' ', 'N', 'C',
- 'B', 'I', ':', 'S', 'R', 'A', ':', 'n', 'a', 'm', 'e', '_', 't', 'o', 'k', 'e', 'n',
- ':', 'h', 'e', 'x', ':', 'u', 'p', 'p', 'e', 'r', ':', 'T', '=', '1', '8', ';', 'c',
- 'o', 'n', 's', 't', ' ', 'U', '1', '6', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A',
- ':', 'n', 'a', 'm', 'e', '_', 't', 'o', 'k', 'e', 'n', ':', 'h', 'e', 'x', ':', 'u',
- 'p', 'p', 'e', 'r', ':', 'L', '=', '1', '9', ';', 'c', 'o', 'n', 's', 't', ' ', 'U',
- '1', '6', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'n', 'a', 'm', 'e', '_',
- 't', 'o', 'k', 'e', 'n', ':', 'h', 'e', 'x', ':', 'l', 'o', 'w', 'e', 'r', ':', 'X',
- '=', '2', '0', ';', 'c', 'o', 'n', 's', 't', ' ', 'U', '1', '6', ' ', 'N', 'C', 'B',
- 'I', ':', 'S', 'R', 'A', ':', 'n', 'a', 'm', 'e', '_', 't', 'o', 'k', 'e', 'n', ':',
- 'h', 'e', 'x', ':', 'l', 'o', 'w', 'e', 'r', ':', 'Y', '=', '2', '1', ';', 'c', 'o',
- 'n', 's', 't', ' ', 'U', '1', '6', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':',
- 'n', 'a', 'm', 'e', '_', 't', 'o', 'k', 'e', 'n', ':', 'h', 'e', 'x', ':', 'l', 'o',
- 'w', 'e', 'r', ':', 'T', '=', '2', '2', ';', 'c', 'o', 'n', 's', 't', ' ', 'U', '1',
- '6', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'n', 'a', 'm', 'e', '_', 't',
- 'o', 'k', 'e', 'n', ':', 'h', 'e', 'x', ':', 'l', 'o', 'w', 'e', 'r', ':', 'L', '=',
- '2', '3', ';', 'c', 'o', 'n', 's', 't', ' ', 'a', 's', 'c', 'i', 'i', ' ', 'N', 'C',
- 'B', 'I', ':', 'S', 'R', 'A', ':', 'n', 'a', 'm', 'e', '_', 's', 'y', 'm', 'b', 'o',
- 'l', ':', 'Q', '=', '\'', '$', 'Q', '\'', ';', 'c', 'o', 'n', 's', 't', ' ', 'a',
- 's', 'c', 'i', 'i', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'n', 'a', 'm',
- 'e', '_', 's', 'y', 'm', 'b', 'o', 'l', ':', 'X', '=', '\'', '$', 'X', '\'', ';',
- 'c', 'o', 'n', 's', 't', ' ', 'a', 's', 'c', 'i', 'i', ' ', 'N', 'C', 'B', 'I', ':',
- 'S', 'R', 'A', ':', 'n', 'a', 'm', 'e', '_', 's', 'y', 'm', 'b', 'o', 'l', ':', 'Y',
- '=', '\'', '$', 'Y', '\'', ';', 'c', 'o', 'n', 's', 't', ' ', 'a', 's', 'c', 'i',
- 'i', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'n', 'a', 'm', 'e', '_', 's',
- 'y', 'm', 'b', 'o', 'l', ':', 'T', '=', '\'', '$', 'T', '\'', ';', 'c', 'o', 'n',
- 's', 't', ' ', 'a', 's', 'c', 'i', 'i', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A',
- ':', 'n', 'a', 'm', 'e', '_', 's', 'y', 'm', 'b', 'o', 'l', ':', 'L', '=', '\'',
- '$', 'L', '\'', ';', 'c', 'o', 'n', 's', 't', ' ', 'a', 's', 'c', 'i', 'i', ' ',
- 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'n', 'a', 'm', 'e', '_', 's', 'y', 'm',
- 'b', 'o', 'l', ':', 'o', 'c', 't', 'a', 'l', ':', 'X', '=', '\'', '$', 'a', '\'',
- ';', 'c', 'o', 'n', 's', 't', ' ', 'a', 's', 'c', 'i', 'i', ' ', 'N', 'C', 'B', 'I',
- ':', 'S', 'R', 'A', ':', 'n', 'a', 'm', 'e', '_', 's', 'y', 'm', 'b', 'o', 'l', ':',
- 'o', 'c', 't', 'a', 'l', ':', 'Y', '=', '\'', '$', 'b', '\'', ';', 'c', 'o', 'n',
- 's', 't', ' ', 'a', 's', 'c', 'i', 'i', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A',
- ':', 'n', 'a', 'm', 'e', '_', 's', 'y', 'm', 'b', 'o', 'l', ':', 'o', 'c', 't', 'a',
- 'l', ':', 'T', '=', '\'', '$', 'c', '\'', ';', 'c', 'o', 'n', 's', 't', ' ', 'a',
- 's', 'c', 'i', 'i', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'n', 'a', 'm',
- 'e', '_', 's', 'y', 'm', 'b', 'o', 'l', ':', 'o', 'c', 't', 'a', 'l', ':', 'L', '=',
- '\'', '$', 'd', '\'', ';', 'c', 'o', 'n', 's', 't', ' ', 'a', 's', 'c', 'i', 'i',
- ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'n', 'a', 'm', 'e', '_', 's', 'y',
- 'm', 'b', 'o', 'l', ':', 'h', 'e', 'x', ':', 'u', 'p', 'p', 'e', 'r', ':', 'X', '=',
- '\'', '$', 'e', '\'', ';', 'c', 'o', 'n', 's', 't', ' ', 'a', 's', 'c', 'i', 'i',
- ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'n', 'a', 'm', 'e', '_', 's', 'y',
- 'm', 'b', 'o', 'l', ':', 'h', 'e', 'x', ':', 'u', 'p', 'p', 'e', 'r', ':', 'Y', '=',
- '\'', '$', 'f', '\'', ';', 'c', 'o', 'n', 's', 't', ' ', 'a', 's', 'c', 'i', 'i',
- ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'n', 'a', 'm', 'e', '_', 's', 'y',
- 'm', 'b', 'o', 'l', ':', 'h', 'e', 'x', ':', 'u', 'p', 'p', 'e', 'r', ':', 'T', '=',
- '\'', '$', 'g', '\'', ';', 'c', 'o', 'n', 's', 't', ' ', 'a', 's', 'c', 'i', 'i',
- ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'n', 'a', 'm', 'e', '_', 's', 'y',
- 'm', 'b', 'o', 'l', ':', 'h', 'e', 'x', ':', 'u', 'p', 'p', 'e', 'r', ':', 'L', '=',
- '\'', '$', 'h', '\'', ';', 'c', 'o', 'n', 's', 't', ' ', 'a', 's', 'c', 'i', 'i',
- ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'n', 'a', 'm', 'e', '_', 's', 'y',
- 'm', 'b', 'o', 'l', ':', 'h', 'e', 'x', ':', 'l', 'o', 'w', 'e', 'r', ':', 'X', '=',
- '\'', '$', 'x', '\'', ';', 'c', 'o', 'n', 's', 't', ' ', 'a', 's', 'c', 'i', 'i',
- ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'n', 'a', 'm', 'e', '_', 's', 'y',
- 'm', 'b', 'o', 'l', ':', 'h', 'e', 'x', ':', 'l', 'o', 'w', 'e', 'r', ':', 'Y', '=',
- '\'', '$', 'y', '\'', ';', 'c', 'o', 'n', 's', 't', ' ', 'a', 's', 'c', 'i', 'i',
- ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'n', 'a', 'm', 'e', '_', 's', 'y',
- 'm', 'b', 'o', 'l', ':', 'h', 'e', 'x', ':', 'l', 'o', 'w', 'e', 'r', ':', 'T', '=',
- '\'', '$', 't', '\'', ';', 'c', 'o', 'n', 's', 't', ' ', 'a', 's', 'c', 'i', 'i',
- ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'n', 'a', 'm', 'e', '_', 's', 'y',
- 'm', 'b', 'o', 'l', ':', 'h', 'e', 'x', ':', 'l', 'o', 'w', 'e', 'r', ':', 'L', '=',
- '\'', '$', 'l', '\'', ';', 'c', 'o', 'n', 's', 't', ' ', 'U', '3', '2', ' ', 'N',
- 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_', '4', '5', '4', '_', ':', 'd', 'y', 'n',
- '_', 'r', 'e', 'a', 'd', '_', 't', 'y', 'p', 'e', '=', '0', ';', 'c', 'o', 'n', 's',
- 't', ' ', 'U', '3', '2', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_', '4',
- '5', '4', '_', ':', 'd', 'y', 'n', '_', 'r', 'e', 'a', 'd', '_', 's', 't', 'a', 'r',
- 't', '=', '1', ';', 'c', 'o', 'n', 's', 't', ' ', 'U', '3', '2', ' ', 'N', 'C', 'B',
- 'I', ':', 'S', 'R', 'A', ':', '_', '4', '5', '4', '_', ':', 'd', 'y', 'n', '_', 'r',
- 'e', 'a', 'd', '_', 'l', 'e', 'n', '=', '2', ';', 'c', 'o', 'n', 's', 't', ' ', 'U',
- '3', '2', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'r', 'e', 'a', 'd', 'n',
- ':', 'r', 'e', 'a', 'd', '_', 't', 'y', 'p', 'e', '=', '0', ';', 'c', 'o', 'n', 's',
- 't', ' ', 'U', '3', '2', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'r', 'e',
- 'a', 'd', 'n', ':', 'r', 'e', 'a', 'd', '_', 's', 't', 'a', 'r', 't', '=', '1', ';',
- 'c', 'o', 'n', 's', 't', ' ', 'U', '3', '2', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R',
- 'A', ':', 'r', 'e', 'a', 'd', 'n', ':', 'r', 'e', 'a', 'd', '_', 'l', 'e', 'n', '=',
- '2', ';', 'c', 'o', 'n', 's', 't', ' ', 'U', '3', '2', ' ', 'N', 'C', 'B', 'I', ':',
- 'S', 'R', 'A', ':', 'r', 'e', 'a', 'd', 'n', ':', 'l', 'a', 'b', 'e', 'l', '_', 's',
- 't', 'a', 'r', 't', '=', '3', ';', 'c', 'o', 'n', 's', 't', ' ', 'U', '3', '2', ' ',
- 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'r', 'e', 'a', 'd', 'n', ':', 'l', 'a',
- 'b', 'e', 'l', '_', 'l', 'e', 'n', '=', '4', ';', 'c', 'o', 'n', 's', 't', ' ', 'U',
- '3', '2', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'c', 'o', 'o', 'r', 'd',
- ':', 'y', '=', '0', ';', 'c', 'o', 'n', 's', 't', ' ', 'U', '3', '2', ' ', 'N', 'C',
- 'B', 'I', ':', 'S', 'R', 'A', ':', 'c', 'o', 'o', 'r', 'd', ':', 'x', '=', '1', ';',
- 'c', 'o', 'n', 's', 't', ' ', 'U', '3', '2', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R',
- 'A', ':', 'c', 'o', 'o', 'r', 'd', ':', 't', 'i', 'l', 'e', '=', '2', ';', 'c', 'o',
- 'n', 's', 't', ' ', 'U', '3', '2', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':',
- 'c', 'o', 'o', 'r', 'd', ':', 'l', 'a', 'n', 'e', '=', '3', ';', 'c', 'o', 'n', 's',
- 't', ' ', 'U', '3', '2', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'c', 'o',
- 'o', 'r', 'd', ':', 'r', 'e', 'g', 'i', 'o', 'n', '=', '2', ';', 'c', 'o', 'n', 's',
- 't', ' ', 'U', '3', '2', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'c', 'o',
- 'o', 'r', 'd', ':', 'p', 'a', 'n', 'e', 'l', '=', '2', ';', 'e', 'x', 't', 'e', 'r',
- 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'a', 'n', 'y', ' ', 'c', 'a',
- 's', 't', '#', '1', '(', 'a', 'n', 'y', ' ', 'i', 'n', ')', '=', 'v', 'd', 'b', ':',
- 'c', 'a', 's', 't', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't',
- 'i', 'o', 'n', ' ', '<', 't', 'y', 'p', 'e', ' ', 'T', '>', 'T', ' ', 'b', 'i', 't',
- '_', 'o', 'r', '#', '1', '<', 'U', '8', ' ', 'a', 'l', 'i', 'g', 'n', '>', '(', 'T',
- ' ', 'A', ',', 'T', ' ', 'B', ')', '=', 'v', 'd', 'b', ':', 'b', 'i', 't', '_', 'o',
- 'r', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n',
- ' ', '<', 't', 'y', 'p', 'e', ' ', 'T', '>', 'T', ' ', 't', 'r', 'i', 'm', '#', '1',
- '<', 'U', '8', ' ', 'a', 'l', 'i', 'g', 'n', ',', 'T', ' ', 'v', 'a', 'l', '>', '(',
- 'T', ' ', 'A', ')', '=', 'v', 'd', 'b', ':', 't', 'r', 'i', 'm', ';', 'e', 'x', 't',
- 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'a', 'n', 'y', ' ',
- 'r', 'e', 'd', 'i', 'm', 'e', 'n', 's', 'i', 'o', 'n', '#', '1', '(', 'a', 'n', 'y',
- ' ', 'i', 'n', ')', '=', 'v', 'd', 'b', ':', 'r', 'e', 'd', 'i', 'm', 'e', 'n', 's',
- 'i', 'o', 'n', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i',
- 'o', 'n', ' ', 'I', '6', '4', ' ', 'r', 'o', 'w', '_', 'i', 'd', '#', '1', '(', ')',
- '=', 'v', 'd', 'b', ':', 'r', 'o', 'w', '_', 'i', 'd', ';', 'e', 'x', 't', 'e', 'r',
- 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'U', '3', '2', ' ', 'r', 'o',
- 'w', '_', 'l', 'e', 'n', '#', '1', '(', 'a', 'n', 'y', ' ', 'i', 'n', ')', '=', 'v',
- 'd', 'b', ':', 'r', 'o', 'w', '_', 'l', 'e', 'n', ';', 'e', 'x', 't', 'e', 'r', 'n',
- ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'U', '3', '2', ' ', 'f', 'i', 'x',
- 'e', 'd', '_', 'r', 'o', 'w', '_', 'l', 'e', 'n', '#', '1', '(', 'a', 'n', 'y', ' ',
- 'i', 'n', ')', '=', 'v', 'd', 'b', ':', 'f', 'i', 'x', 'e', 'd', '_', 'r', 'o', 'w',
- '_', 'l', 'e', 'n', ';', 'v', 'a', 'l', 'i', 'd', 'a', 't', 'e', ' ', 'f', 'u', 'n',
- 'c', 't', 'i', 'o', 'n', ' ', '<', 't', 'y', 'p', 'e', ' ', 'T', '>', 'v', 'o', 'i',
- 'd', ' ', 'c', 'o', 'm', 'p', 'a', 'r', 'e', '#', '1', '<', '*', 'U', '3', '2', ' ',
- 's', 'i', 'g', '_', 'b', 'i', 't', 's', '>', '(', 'T', ' ', 's', 'r', 'c', ',', 'T',
- ' ', 'c', 'm', 'p', ')', '=', 'v', 'd', 'b', ':', 'c', 'o', 'm', 'p', 'a', 'r', 'e',
- ';', 'v', 'a', 'l', 'i', 'd', 'a', 't', 'e', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o',
- 'n', ' ', '<', 't', 'y', 'p', 'e', ' ', 'T', '>', 'v', 'o', 'i', 'd', ' ', 'n', 'o',
- '_', 'c', 'o', 'm', 'p', 'a', 'r', 'e', '#', '1', '(', 'T', ' ', 's', 'r', 'c', ',',
- 'T', ' ', 'c', 'm', 'p', ')', '=', 'v', 'd', 'b', ':', 'n', 'o', '_', 'c', 'o', 'm',
- 'p', 'a', 'r', 'e', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't',
- 'i', 'o', 'n', ' ', '<', 't', 'y', 'p', 'e', ' ', 'T', '>', 'T', ' ', 'r', 'a', 'n',
- 'g', 'e', '_', 'v', 'a', 'l', 'i', 'd', 'a', 't', 'e', '#', '1', '<', 'T', ' ', 'l',
- 'o', 'w', 'e', 'r', ',', 'T', ' ', 'u', 'p', 'p', 'e', 'r', '>', '(', 'T', ' ', 'i',
- 'n', ')', '=', 'v', 'd', 'b', ':', 'r', 'a', 'n', 'g', 'e', '_', 'v', 'a', 'l', 'i',
- 'd', 'a', 't', 'e', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't',
- 'i', 'o', 'n', ' ', '<', 't', 'y', 'p', 'e', ' ', 'T', '>', 'T', ' ', 's', 'e', 'l',
- 'e', 'c', 't', '#', '1', '(', 'T', ' ', 'f', 'i', 'r', 's', 't', ',', 'T', ' ', 's',
- 'e', 'c', 'o', 'n', 'd', ',', '.', '.', '.', ')', '=', 'v', 'd', 'b', ':', 's', 'e',
- 'l', 'e', 'c', 't', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't',
- 'i', 'o', 'n', ' ', 't', 'r', 'a', 'n', 's', 'p', 'o', 's', 'e', 'd', '_', 'f', 'm',
- 't', ' ', 't', 'r', 'a', 'n', 's', 'p', 'o', 's', 'e', '#', '1', '(', 't', 'r', 'a',
- 'n', 's', 'p', 'o', 's', 'e', '_', 's', 'e', 't', ' ', 'i', 'n', ')', '=', 'v', 'd',
- 'b', ':', 't', 'r', 'a', 'n', 's', 'p', 'o', 's', 'e', ';', 'e', 'x', 't', 'e', 'r',
- 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 't', 'r', 'a', 'n', 's', 'p',
- 'o', 's', 'e', '_', 's', 'e', 't', ' ', 'd', 'e', 't', 'r', 'a', 'n', 's', 'p', 'o',
- 's', 'e', '#', '1', '(', 't', 'r', 'a', 'n', 's', 'p', 'o', 's', 'e', 'd', '_', 'f',
- 'm', 't', ' ', 'i', 'n', ')', '=', 'v', 'd', 'b', ':', 'd', 'e', 't', 'r', 'a', 'n',
- 's', 'p', 'o', 's', 'e', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c',
- 't', 'i', 'o', 'n', ' ', 'd', 'e', 'l', 't', 'a', '_', 'a', 'v', 'e', 'r', 'a', 'g',
- 'e', 'd', '_', 'f', 'm', 't', ' ', 'd', 'e', 'l', 't', 'a', '_', 'a', 'v', 'e', 'r',
- 'a', 'g', 'e', '#', '1', '(', 'a', 'n', 'y', ' ', 'i', 'n', ')', '=', 'v', 'd', 'b',
- ':', 'd', 'e', 'l', 't', 'a', '_', 'a', 'v', 'e', 'r', 'a', 'g', 'e', ';', 'e', 'x',
- 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'a', 'n', 'y',
- ' ', 'u', 'n', 'd', 'e', 'l', 't', 'a', '_', 'a', 'v', 'e', 'r', 'a', 'g', 'e', '#',
- '1', '(', 'd', 'e', 'l', 't', 'a', '_', 'a', 'v', 'e', 'r', 'a', 'g', 'e', 'd', '_',
- 'f', 'm', 't', ' ', 'i', 'n', ')', '=', 'v', 'd', 'b', ':', 'u', 'n', 'd', 'e', 'l',
- 't', 'a', '_', 'a', 'v', 'e', 'r', 'a', 'g', 'e', ';', 'e', 'x', 't', 'e', 'r', 'n',
- ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'm', 'e', 'r', 'g', 'e', 'd', '_',
- 'f', 'm', 't', ' ', 'm', 'e', 'r', 'g', 'e', '#', '1', '(', 'a', 'n', 'y', ' ', 'i',
- 'n', ',', '.', '.', '.', ')', '=', 'v', 'd', 'b', ':', 'm', 'e', 'r', 'g', 'e', ';',
- 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'a',
- 'n', 'y', ' ', 's', 'p', 'l', 'i', 't', '#', '1', '<', 'U', '3', '2', ' ', 'i', 'd',
- 'x', '>', '(', 'm', 'e', 'r', 'g', 'e', 'd', '_', 'f', 'm', 't', ' ', 'i', 'n', ')',
- '=', 'v', 'd', 'b', ':', 's', 'p', 'l', 'i', 't', ';', 'e', 'x', 't', 'e', 'r', 'n',
- ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', '<', 't', 'y', 'p', 'e', ' ', 'T',
- '>', 'T', ' ', 'm', 'e', 't', 'a', ':', 'r', 'e', 'a', 'd', '#', '1', '<', 'a', 's',
- 'c', 'i', 'i', ' ', 'n', 'o', 'd', 'e', '*', 'b', 'o', 'o', 'l', ' ', 'd', 'e', 't',
- 'e', 'r', 'm', 'i', 'n', 'i', 's', 't', 'i', 'c', '>', '(', ')', ';', 'e', 'x', 't',
- 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', '<', 't', 'y', 'p',
- 'e', ' ', 'T', '>', 'T', ' ', 'm', 'e', 't', 'a', ':', 'v', 'a', 'l', 'u', 'e', '#',
- '1', '<', 'a', 's', 'c', 'i', 'i', ' ', 'n', 'o', 'd', 'e', '*', 'b', 'o', 'o', 'l',
- ' ', 'd', 'e', 't', 'e', 'r', 'm', 'i', 'n', 'i', 's', 't', 'i', 'c', '>', '(', ')',
- ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ',
- '<', 't', 'y', 'p', 'e', ' ', 'T', '>', 'T', ' ', 'm', 'e', 't', 'a', ':', 'w', 'r',
- 'i', 't', 'e', '#', '1', '<', 'a', 's', 'c', 'i', 'i', ' ', 'n', 'o', 'd', 'e', '>',
- '(', 'T', ' ', 'i', 'n', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n',
- 'c', 't', 'i', 'o', 'n', ' ', 'a', 's', 'c', 'i', 'i', ' ', 'm', 'e', 't', 'a', ':',
- 'a', 't', 't', 'r', ':', 'r', 'e', 'a', 'd', '#', '1', '<', 'a', 's', 'c', 'i', 'i',
- ' ', 'n', 'o', 'd', 'e', ',', 'a', 's', 'c', 'i', 'i', ' ', 'a', 't', 't', 'r', '*',
- 'b', 'o', 'o', 'l', ' ', 'd', 'e', 't', 'e', 'r', 'm', 'i', 'n', 'i', 's', 't', 'i',
- 'c', '>', '(', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't',
- 'i', 'o', 'n', ' ', 'a', 's', 'c', 'i', 'i', ' ', 'm', 'e', 't', 'a', ':', 'a', 't',
- 't', 'r', ':', 'w', 'r', 'i', 't', 'e', '#', '1', '<', 'a', 's', 'c', 'i', 'i', ' ',
- 'n', 'o', 'd', 'e', ',', 'a', 's', 'c', 'i', 'i', ' ', 'a', 't', 't', 'r', '>', '(',
- 'a', 's', 'c', 'i', 'i', ' ', 'i', 'n', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ',
- 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 't', 'e', 'x', 't', '8', '_', 's', 'e',
- 't', ' ', 'p', 'a', 'r', 'a', 'm', 'e', 't', 'e', 'r', ':', 'r', 'e', 'a', 'd', '#',
- '1', '<', 'a', 's', 'c', 'i', 'i', ' ', 'n', 'a', 'm', 'e', '*', 'b', 'o', 'o', 'l',
- ' ', 'd', 'e', 't', 'e', 'r', 'm', 'i', 'n', 'i', 's', 't', 'i', 'c', '>', '(', ')',
- ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ',
- 't', 'e', 'x', 't', '8', '_', 's', 'e', 't', ' ', 'e', 'n', 'v', 'i', 'r', 'o', 'n',
- 'm', 'e', 'n', 't', ':', 'r', 'e', 'a', 'd', '#', '1', '<', 'a', 's', 'c', 'i', 'i',
- ' ', 'n', 'a', 'm', 'e', '>', '(', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f',
- 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 't', 'e', 'x', 't', '8', '_', 's', 'e', 't',
- ' ', 'i', 'd', 'x', ':', 't', 'e', 'x', 't', ':', 'p', 'r', 'o', 'j', 'e', 'c', 't',
- '#', '1', '<', 'a', 's', 'c', 'i', 'i', ' ', 'i', 'n', 'd', 'e', 'x', '_', 'n', 'a',
- 'm', 'e', '>', '(', '*', 't', 'e', 'x', 't', '8', '_', 's', 'e', 't', ' ', 's', 'u',
- 'b', 's', 't', 'i', 't', 'u', 't', 'e', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ',
- 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 't', 'e', 'x', 't', '8', '_', 's', 'e',
- 't', ' ', 'i', 'd', 'x', ':', 't', 'e', 'x', 't', ':', 'i', 'n', 's', 'e', 'r', 't',
- '#', '1', '<', 'a', 's', 'c', 'i', 'i', ' ', 'i', 'n', 'd', 'e', 'x', '_', 'n', 'a',
- 'm', 'e', '>', '(', 't', 'e', 'x', 't', '8', '_', 's', 'e', 't', ' ', 'k', 'e', 'y',
- ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n',
- ' ', 'v', 'd', 'b', ':', 'r', 'o', 'w', '_', 'i', 'd', '_', 'r', 'a', 'n', 'g', 'e',
- ' ', 'i', 'd', 'x', ':', 't', 'e', 'x', 't', ':', 'l', 'o', 'o', 'k', 'u', 'p', '#',
- '1', '<', 'a', 's', 'c', 'i', 'i', ' ', 'i', 'n', 'd', 'e', 'x', '_', 'n', 'a', 'm',
- 'e', ',', 'a', 's', 'c', 'i', 'i', ' ', 'q', 'u', 'e', 'r', 'y', '_', 'b', 'y', '_',
- 'n', 'a', 'm', 'e', '>', '(', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u',
- 'n', 'c', 't', 'i', 'o', 'n', ' ', '<', 't', 'y', 'p', 'e', ' ', 'T', '>', 'T', ' ',
- 'e', 'c', 'h', 'o', '#', '1', '<', 'T', ' ', 'v', 'a', 'l', '>', '(', '*', 'a', 'n',
- 'y', ' ', 'r', 'o', 'w', '_', 'l', 'e', 'n', ')', '=', 'v', 'd', 'b', ':', 'e', 'c',
- 'h', 'o', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o',
- 'n', ' ', '<', 't', 'y', 'p', 'e', ' ', 'T', '>', 'T', ' ', 'e', 'x', 'i', 's', 't',
- 's', '#', '1', '<', '*', 'T', ' ', 'c', 'v', 'a', 'l', '>', '(', 'a', 'n', 'y', ' ',
- 'p', 'r', 'e', 'd', 'i', 'c', 'a', 't', 'e', '*', 'T', ' ', 'd', 'v', 'a', 'l', ')',
- '=', 'v', 'd', 'b', ':', 'e', 'x', 'i', 's', 't', 's', ';', 'e', 'x', 't', 'e', 'r',
- 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', '<', 't', 'y', 'p', 'e', ' ',
- 'A', ',', 't', 'y', 'p', 'e', ' ', 'B', '>', 'B', ' ', 'm', 'a', 'p', '#', '1', '<',
- 'A', ' ', 'f', 'r', 'o', 'm', ',', 'B', ' ', 't', 'o', '>', '(', 'A', ' ', 'i', 'n',
- '*', 'B', ' ', 's', 'r', 'c', ')', '=', 'v', 'd', 'b', ':', 'm', 'a', 'p', ';', 'e',
- 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', '<', 't',
- 'y', 'p', 'e', ' ', 'T', '>', 'T', ' ', 'c', 'l', 'i', 'p', '#', '1', '<', 'T', ' ',
- 'l', 'o', 'w', 'e', 'r', ',', 'T', ' ', 'u', 'p', 'p', 'e', 'r', '>', '(', 'T', ' ',
- 'i', 'n', ')', '=', 'v', 'd', 'b', ':', 'c', 'l', 'i', 'p', ';', 'e', 'x', 't', 'e',
- 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', '<', 't', 'y', 'p', 'e',
- ' ', 'T', ',', 'U', '3', '2', ' ', 'd', 'i', 'm', '>', 'T', '[', 'd', 'i', 'm', ']',
- ' ', 'v', 'c', 'l', 'i', 'p', '#', '1', '<', 'T', ' ', 'l', 'o', 'w', 'e', 'r', ',',
- 'T', ' ', 'u', 'p', 'p', 'e', 'r', '>', '(', 'T', '[', 'd', 'i', 'm', ']', ' ', 'i',
- 'n', ')', '=', 'v', 'd', 'b', ':', 'c', 'l', 'i', 'p', ';', 'e', 'x', 't', 'e', 'r',
- 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'n', 'u', 'm', 'e', 'r', 'i',
- 'c', '_', 's', 'e', 't', ' ', 'c', 'e', 'i', 'l', '#', '1', '(', 'f', 'l', 'o', 'a',
- 't', '_', 's', 'e', 't', ' ', 'i', 'n', ')', '=', 'v', 'd', 'b', ':', 'c', 'e', 'i',
- 'l', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n',
- ' ', 'n', 'u', 'm', 'e', 'r', 'i', 'c', '_', 's', 'e', 't', ' ', 'f', 'l', 'o', 'o',
- 'r', '#', '1', '(', 'f', 'l', 'o', 'a', 't', '_', 's', 'e', 't', ' ', 'i', 'n', ')',
- '=', 'v', 'd', 'b', ':', 'f', 'l', 'o', 'o', 'r', ';', 'e', 'x', 't', 'e', 'r', 'n',
- ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'n', 'u', 'm', 'e', 'r', 'i', 'c',
- '_', 's', 'e', 't', ' ', 'r', 'o', 'u', 'n', 'd', '#', '1', '(', 'f', 'l', 'o', 'a',
- 't', '_', 's', 'e', 't', ' ', 'i', 'n', ')', '=', 'v', 'd', 'b', ':', 'r', 'o', 'u',
- 'n', 'd', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o',
- 'n', ' ', 'n', 'u', 'm', 'e', 'r', 'i', 'c', '_', 's', 'e', 't', ' ', 't', 'r', 'u',
- 'n', 'c', '#', '1', '(', 'f', 'l', 'o', 'a', 't', '_', 's', 'e', 't', ' ', 'i', 'n',
- ')', '=', 'v', 'd', 'b', ':', 't', 'r', 'u', 'n', 'c', ';', 'e', 'x', 't', 'e', 'r',
- 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', '<', 't', 'y', 'p', 'e', ' ',
- 'T', '>', 'T', ' ', 'm', 'i', 'n', '#', '1', '(', 'T', ' ', 'a', ',', 'T', ' ', 'b',
- ')', '=', 'v', 'd', 'b', ':', 'm', 'i', 'n', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ',
- 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', '<', 't', 'y', 'p', 'e', ' ', 'T', '>',
- 'T', ' ', 'm', 'a', 'x', '#', '1', '(', 'T', ' ', 'a', ',', 'T', ' ', 'b', ')', '=',
- 'v', 'd', 'b', ':', 'm', 'a', 'x', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u',
- 'n', 'c', 't', 'i', 'o', 'n', ' ', '<', 't', 'y', 'p', 'e', ' ', 'T', '>', 'T', ' ',
- 's', 'u', 'm', '#', '1', '<', '*', 'T', ' ', 'k', '>', '(', 'T', ' ', 'a', ',', '.',
- '.', '.', ')', '=', 'v', 'd', 'b', ':', 's', 'u', 'm', ';', 'e', 'x', 't', 'e', 'r',
- 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', '<', 't', 'y', 'p', 'e', ' ',
- 'T', '>', 'T', ' ', 'd', 'i', 'f', 'f', '#', '1', '<', '*', 'T', ' ', 'k', '>', '(',
- 'T', ' ', 'a', '*', 'T', ' ', 'b', ')', '=', 'v', 'd', 'b', ':', 'd', 'i', 'f', 'f',
- ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ',
- '<', 't', 'y', 'p', 'e', ' ', 'T', '>', 'T', ' ', 'd', 'e', 'r', 'i', 'v', '#', '1',
- '(', 'T', ' ', 'i', 'n', ')', '=', 'v', 'd', 'b', ':', 'd', 'e', 'r', 'i', 'v', ';',
- 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', '<',
- 't', 'y', 'p', 'e', ' ', 'T', '>', 'T', ' ', 'i', 'n', 't', 'e', 'g', 'r', 'a', 'l',
- '#', '1', '(', 'T', ' ', 'i', 'n', ')', '=', 'v', 'd', 'b', ':', 'i', 'n', 't', 'e',
- 'g', 'r', 'a', 'l', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't',
- 'i', 'o', 'n', ' ', '<', 't', 'y', 'p', 'e', ' ', 'T', '>', 'T', ' ', 'i', 'n', 't',
- 'e', 'g', 'r', 'a', 'l', '_', '0', '#', '1', '(', 'T', ' ', 'i', 'n', ')', '=', 'v',
- 'd', 'b', ':', 'i', 'n', 't', 'e', 'g', 'r', 'a', 'l', '_', '0', ';', 'e', 'x', 't',
- 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', '<', 't', 'y', 'p',
- 'e', ' ', 'T', '>', 'T', ' ', 'd', 'e', 'l', 't', 'a', '#', '1', '(', 'T', ' ', 'i',
- 'n', ')', '=', 'v', 'd', 'b', ':', 'd', 'e', 'l', 't', 'a', ';', 'e', 'x', 't', 'e',
- 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', '<', 't', 'y', 'p', 'e',
- ' ', 'T', '>', 'T', ' ', 'u', 'n', 'd', 'e', 'l', 't', 'a', '#', '1', '(', 'T', ' ',
- 'i', 'n', ')', '=', 'v', 'd', 'b', ':', 'u', 'n', 'd', 'e', 'l', 't', 'a', ';', 'e',
- 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', '<', 't',
- 'y', 'p', 'e', ' ', 'T', '>', 'T', ' ', 'o', 'u', 't', 'l', 'i', 'e', 'r', '_', 'e',
- 'n', 'c', 'o', 'd', 'e', '#', '1', '<', 'T', ' ', 'o', 'u', 't', 'l', 'i', 'e', 'r',
- '>', '(', 'T', ' ', 'i', 'n', ')', '=', 'v', 'd', 'b', ':', 'o', 'u', 't', 'l', 'i',
- 'e', 'r', '_', 'e', 'n', 'c', 'o', 'd', 'e', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ',
- 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', '<', 't', 'y', 'p', 'e', ' ', 'T', '>',
- 'T', ' ', 'o', 'u', 't', 'l', 'i', 'e', 'r', '_', 'd', 'e', 'c', 'o', 'd', 'e', '#',
- '1', '<', 'T', ' ', 'o', 'u', 't', 'l', 'i', 'e', 'r', '>', '(', 'T', ' ', 'i', 'n',
- ')', '=', 'v', 'd', 'b', ':', 'o', 'u', 't', 'l', 'i', 'e', 'r', '_', 'd', 'e', 'c',
- 'o', 'd', 'e', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i',
- 'o', 'n', ' ', '<', 't', 'y', 'p', 'e', ' ', 'T', '>', 'T', ' ', 'a', 'd', 'd', '_',
- 'r', 'o', 'w', '_', 'i', 'd', '#', '1', '(', 'T', ' ', 'i', 'n', ')', '=', 'v', 'd',
- 'b', ':', 'a', 'd', 'd', '_', 'r', 'o', 'w', '_', 'i', 'd', ';', 'e', 'x', 't', 'e',
- 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', '<', 't', 'y', 'p', 'e',
- ' ', 'T', '>', 'T', ' ', 's', 'u', 'b', '_', 'r', 'o', 'w', '_', 'i', 'd', '#', '1',
- '(', 'T', ' ', 'i', 'n', ')', '=', 'v', 'd', 'b', ':', 's', 'u', 'b', '_', 'r', 'o',
- 'w', '_', 'i', 'd', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't',
- 'i', 'o', 'n', ' ', '<', 't', 'y', 'p', 'e', ' ', 'T', '>', 'T', '[', '*', ']', ' ',
- 'c', 'u', 't', '#', '1', '<', 'U', '3', '2', ' ', 'i', 'd', 'x', ',', '.', '.', '.',
- '>', '(', 'T', '[', '*', ']', ' ', 'i', 'n', ')', '=', 'v', 'd', 'b', ':', 'c', 'u',
- 't', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n',
- ' ', '<', 't', 'y', 'p', 'e', ' ', 'T', '>', 'T', '[', '*', ']', ' ', 'p', 'a', 's',
- 't', 'e', '#', '1', '(', 'T', '[', '*', ']', ' ', 'i', 'n', ',', '.', '.', '.', ')',
- '=', 'v', 'd', 'b', ':', 'p', 'a', 's', 't', 'e', ';', 'e', 'x', 't', 'e', 'r', 'n',
- ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', '<', 't', 'y', 'p', 'e', ' ', 'T',
- '>', 'T', ' ', 'v', 'e', 'c', '_', 's', 'u', 'm', '#', '1', '(', 'T', '[', '*', ']',
- ' ', 'i', 'n', ')', '=', 'v', 'd', 'b', ':', 'v', 'e', 'c', '_', 's', 'u', 'm', ';',
- 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', '<',
- 't', 'y', 'p', 'e', ' ', 'T', '>', 'T', ' ', 'f', 'i', 'x', 'e', 'd', '_', 'v', 'e',
- 'c', '_', 's', 'u', 'm', '#', '1', '(', 'T', '[', '*', ']', ' ', 'i', 'n', ')', '=',
- 'v', 'd', 'b', ':', 'f', 'i', 'x', 'e', 'd', '_', 'v', 'e', 'c', '_', 's', 'u', 'm',
- ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ',
- 'b', 'o', 'o', 'l', ' ', 'c', 'h', 'e', 'c', 'k', 's', 'u', 'm', '#', '1', '<', 'a',
- 's', 'c', 'i', 'i', ' ', 'n', 'o', 'd', 'e', ',', 'a', 's', 'c', 'i', 'i', ' ', 'a',
- 'l', 'g', 'o', 'r', 'i', 't', 'h', 'm', '>', '(', 'B', '8', ' ', 'i', 'n', ')', '=',
- 'v', 'd', 'b', ':', 'c', 'h', 'e', 'c', 'k', 's', 'u', 'm', ';', 's', 'c', 'h', 'e',
- 'm', 'a', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'b', 'o', 'o', 'l', ' ',
- 'm', 'd', '5', 's', 'u', 'm', '#', '1', '<', 'a', 's', 'c', 'i', 'i', ' ', 'n', 'o',
- 'd', 'e', '>', '(', 'B', '8', ' ', 'i', 'n', ')', '{', 'r', 'e', 't', 'u', 'r', 'n',
- ' ', 'c', 'h', 'e', 'c', 'k', 's', 'u', 'm', '#', '1', '<', 'n', 'o', 'd', 'e', ',',
- '\'', 'm', 'd', '5', '\'', '>', '(', 'i', 'n', ')', ';', '}', 'e', 'x', 't', 'e',
- 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'B', '1', '[', '*', ']',
- ' ', 'p', 'a', 'c', 'k', '#', '1', '(', 'p', 'a', 'c', 'k', '_', 's', 'e', 't', ' ',
- 'i', 'n', ')', '=', 'v', 'd', 'b', ':', 'p', 'a', 'c', 'k', ';', 'e', 'x', 't', 'e',
- 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'p', 'a', 'c', 'k', '_',
- 's', 'e', 't', ' ', 'u', 'n', 'p', 'a', 'c', 'k', '#', '1', '(', 'B', '1', '[', '*',
- ']', ' ', 'i', 'n', ')', '=', 'v', 'd', 'b', ':', 'u', 'n', 'p', 'a', 'c', 'k', ';',
- 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'i',
- 'z', 'i', 'p', '_', 'f', 'm', 't', ' ', 'i', 'z', 'i', 'p', '#', '2', '.', '1', '(',
- 'i', 'z', 'i', 'p', '_', 's', 'e', 't', ' ', 'i', 'n', ')', '=', 'v', 'd', 'b', ':',
- 'i', 'z', 'i', 'p', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't',
- 'i', 'o', 'n', ' ', 'i', 'z', 'i', 'p', '_', 's', 'e', 't', ' ', 'i', 'u', 'n', 'z',
- 'i', 'p', '#', '2', '.', '1', '(', 'i', 'z', 'i', 'p', '_', 'f', 'm', 't', ' ', 'i',
- 'n', ')', '=', 'v', 'd', 'b', ':', 'i', 'u', 'n', 'z', 'i', 'p', ';', 'e', 'x', 't',
- 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'f', 'z', 'i', 'p',
- '_', 'f', 'm', 't', ' ', 'f', 'z', 'i', 'p', '#', '1', '<', 'U', '3', '2', ' ', 'm',
- 'a', 'n', 't', 'i', 's', 's', 'a', '>', '(', 'f', 'z', 'i', 'p', '_', 's', 'e', 't',
- ' ', 'i', 'n', ')', '=', 'v', 'd', 'b', ':', 'f', 'z', 'i', 'p', ';', 'e', 'x', 't',
- 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'f', 'z', 'i', 'p',
- '_', 's', 'e', 't', ' ', 'f', 'u', 'n', 'z', 'i', 'p', '#', '1', '(', 'f', 'z', 'i',
- 'p', '_', 'f', 'm', 't', ' ', 'i', 'n', ')', '=', 'v', 'd', 'b', ':', 'f', 'u', 'n',
- 'z', 'i', 'p', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i',
- 'o', 'n', ' ', 'r', 'l', 'e', '_', 'f', 'm', 't', ' ', 'r', 'l', 'e', 'n', 'c', 'o',
- 'd', 'e', '#', '1', '(', 'a', 'n', 'y', ' ', 'i', 'n', ')', '=', 'v', 'd', 'b', ':',
- 'r', 'l', 'e', 'n', 'c', 'o', 'd', 'e', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f',
- 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'a', 'n', 'y', ' ', 'r', 'l', 'd', 'e', 'c',
- 'o', 'd', 'e', '#', '1', '(', 'r', 'l', 'e', '_', 'f', 'm', 't', ' ', 'i', 'n', ')',
- '=', 'v', 'd', 'b', ':', 'r', 'l', 'd', 'e', 'c', 'o', 'd', 'e', ';', 'e', 'x', 't',
- 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'z', 'l', 'i', 'b',
- '_', 'f', 'm', 't', ' ', 'z', 'i', 'p', '#', '1', '<', '*', 'I', '3', '2', ' ', 's',
- 't', 'r', 'a', 't', 'e', 'g', 'y', ',', 'I', '3', '2', ' ', 'l', 'e', 'v', 'e', 'l',
- '>', '(', 'a', 'n', 'y', ' ', 'i', 'n', ')', '=', 'v', 'd', 'b', ':', 'z', 'i', 'p',
- ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ',
- 'a', 'n', 'y', ' ', 'u', 'n', 'z', 'i', 'p', '#', '1', '(', 'z', 'l', 'i', 'b', '_',
- 'f', 'm', 't', ' ', 'i', 'n', ')', '=', 'v', 'd', 'b', ':', 'u', 'n', 'z', 'i', 'p',
- ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ',
- 'b', 'z', 'i', 'p', '2', '_', 'f', 'm', 't', ' ', 'b', 'z', 'i', 'p', '#', '1', '<',
- '*', 'U', '3', '2', ' ', 'b', 'l', 'o', 'c', 'k', 'S', 'i', 'z', 'e', '1', '0', '0',
- 'k', ',', 'U', '3', '2', ' ', 'w', 'o', 'r', 'k', 'F', 'a', 'c', 't', 'o', 'r', '>',
- '(', 'a', 'n', 'y', ' ', 'i', 'n', ')', '=', 'v', 'd', 'b', ':', 'b', 'z', 'i', 'p',
- ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ',
- 'a', 'n', 'y', ' ', 'b', 'u', 'n', 'z', 'i', 'p', '#', '1', '(', 'b', 'z', 'i', 'p',
- '2', '_', 'f', 'm', 't', ' ', 'i', 'n', ')', '=', 'v', 'd', 'b', ':', 'b', 'u', 'n',
- 'z', 'i', 'p', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i',
- 'o', 'n', ' ', '<', 't', 'y', 'p', 'e', ' ', 'T', '>', 'T', ' ', 's', 'i', 'm', 'p',
- 'l', 'e', '_', 's', 'u', 'b', '_', 's', 'e', 'l', 'e', 'c', 't', '#', '1', '<', 'a',
- 's', 'c', 'i', 'i', ' ', 't', 'b', 'l', ',', 'a', 's', 'c', 'i', 'i', ' ', 'c', 'o',
- 'l', '>', '(', 'I', '6', '4', ' ', 'r', 'o', 'w', '*', 'I', '3', '2', ' ', 'i', 'd',
- 'x', ')', '=', 'v', 'd', 'b', ':', 's', 'i', 'm', 'p', 'l', 'e', '_', 's', 'u', 'b',
- '_', 's', 'e', 'l', 'e', 'c', 't', '_', '1', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ',
- 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 't', 'e', 'x', 't', '_', 's', 'e', 't',
- ' ', 'e', 'x', 't', 'r', 'a', 'c', 't', '_', 't', 'o', 'k', 'e', 'n', '#', '1', '<',
- 'U', '3', '2', ' ', 'i', 'd', 'x', '>', '(', 't', 'e', 'x', 't', '_', 's', 'e', 't',
- ' ', 's', 't', 'r', ',', 't', 'e', 'x', 't', ':', 't', 'o', 'k', 'e', 'n', ' ', 't',
- 'o', 'k', ')', '=', 'v', 'd', 'b', ':', 'e', 'x', 't', 'r', 'a', 'c', 't', '_', 't',
- 'o', 'k', 'e', 'n', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't',
- 'i', 'o', 'n', ' ', 'n', 'u', 'm', 'e', 'r', 'i', 'c', '_', 's', 'e', 't', ' ', 's',
- 't', 'r', 't', 'o', 'n', 'u', 'm', '#', '1', '<', '*', 'U', '3', '2', ' ', 'r', 'a',
- 'd', 'i', 'x', '>', '(', 't', 'e', 'x', 't', '_', 's', 'e', 't', ' ', 's', 't', 'r',
- ')', '=', 'v', 'd', 'b', ':', 's', 't', 'r', 't', 'o', 'n', 'u', 'm', ';', 'e', 'x',
- 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 't', 'e', 'x',
- 't', '_', 's', 'e', 't', ' ', 's', 'p', 'r', 'i', 'n', 't', 'f', '#', '1', '<', 'a',
- 's', 'c', 'i', 'i', ' ', 'f', 'm', 't', '>', '(', 'a', 'n', 'y', ' ', 'p', '1', ',',
- '.', '.', '.', ')', '=', 'v', 'd', 'b', ':', 's', 'p', 'r', 'i', 'n', 't', 'f', ';',
- 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'm',
- 'e', 'r', 'g', 'e', 'd', '_', 't', ' ', 'N', 'C', 'B', 'I', ':', 'm', 'e', 'r', 'g',
- 'e', '#', '1', '(', 'a', 'n', 'y', ' ', 'i', 'n', ',', '.', '.', '.', ')', ';', 'e',
- 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'a', 'n',
- 'y', ' ', 'N', 'C', 'B', 'I', ':', 's', 'p', 'l', 'i', 't', '#', '1', '<', 'U', '3',
- '2', ' ', 'i', 'd', 'x', '>', '(', 'm', 'e', 'r', 'g', 'e', 'd', '_', 't', ' ', 'i',
- 'n', ')', '=', 'v', 'd', 'b', ':', 's', 'p', 'l', 'i', 't', ';', 'e', 'x', 't', 'e',
- 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'a', 'n', 'y', ' ', 'N',
- 'C', 'B', 'I', ':', 'c', 'u', 't', '#', '1', '<', 'U', '3', '2', ' ', 'i', 'd', 'x',
- ',', '.', '.', '.', '>', '(', 'a', 'n', 'y', ' ', 'i', 'n', ')', '=', 'v', 'd', 'b',
- ':', 'c', 'u', 't', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't',
- 'i', 'o', 'n', ' ', 'a', 'n', 'y', ' ', 'N', 'C', 'B', 'I', ':', 'p', 'a', 's', 't',
- 'e', '#', '1', '(', 'a', 'n', 'y', ' ', 'i', 'n', ',', '.', '.', '.', ')', '=', 'v',
- 'd', 'b', ':', 'p', 'a', 's', 't', 'e', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f',
- 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'a', 'n', 'y', ' ', 'N', 'C', 'B', 'I', ':',
- 'p', 'a', 'c', 'k', '#', '1', '<', 'U', '3', '2', ' ', 'f', 'r', 'o', 'm', ',', 'U',
- '3', '2', ' ', 't', 'o', '>', '(', 'a', 'n', 'y', ' ', 'i', 'n', ')', ';', 'e', 'x',
- 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'a', 'n', 'y',
- ' ', 'N', 'C', 'B', 'I', ':', 'u', 'n', 'p', 'a', 'c', 'k', '#', '1', '<', 'U', '3',
- '2', ' ', 'f', 'r', 'o', 'm', ',', 'U', '3', '2', ' ', 't', 'o', '>', '(', 'a', 'n',
- 'y', ' ', 'i', 'n', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c',
- 't', 'i', 'o', 'n', ' ', 'a', 'n', 'y', ' ', 'N', 'C', 'B', 'I', ':', 'f', 'p', '_',
- 'd', 'e', 'c', 'o', 'd', 'e', '#', '1', '(', 'f', 'p', '_', 'e', 'n', 'c', 'o', 'd',
- 'e', 'd', '_', 't', ' ', 'i', 'n', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f',
- 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'a', 'n', 'y', ' ', 'N', 'C', 'B', 'I', ':',
- 'f', 'p', '_', 'e', 'x', 't', 'e', 'n', 'd', '#', '1', '<', 'U', '3', '2', ' ', 'b',
- 'i', 't', 's', '>', '(', 'N', 'C', 'B', 'I', ':', 'f', 'p', '_', 'e', 'n', 'c', 'o',
- 'd', 'e', 'd', '_', 't', ' ', 'i', 'n', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ',
- 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'r', 'l', '_', 'e', 'n', 'c', 'o', 'd',
- 'e', 'd', '_', 't', ' ', 'N', 'C', 'B', 'I', ':', 'r', 'u', 'n', '_', 'l', 'e', 'n',
- 'g', 't', 'h', '_', 'e', 'n', 'c', 'o', 'd', 'e', '#', '1', '(', 'a', 'n', 'y', ' ',
- 'i', 'n', ')', '=', 'v', 'd', 'b', ':', 'r', 'l', 'e', 'n', 'c', 'o', 'd', 'e', ';',
- 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'a',
- 'n', 'y', ' ', 'N', 'C', 'B', 'I', ':', 'r', 'u', 'n', '_', 'l', 'e', 'n', 'g', 't',
- 'h', '_', 'd', 'e', 'c', 'o', 'd', 'e', '#', '1', '(', 'r', 'l', '_', 'e', 'n', 'c',
- 'o', 'd', 'e', 'd', '_', 't', ' ', 'i', 'n', ')', '=', 'v', 'd', 'b', ':', 'r', 'l',
- 'd', 'e', 'c', 'o', 'd', 'e', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n',
- 'c', 't', 'i', 'o', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'z', 'l', 'i', 'b', '_', 'e',
- 'n', 'c', 'o', 'd', 'e', 'd', '_', 't', ' ', 'N', 'C', 'B', 'I', ':', 'z', 'l', 'i',
- 'b', '#', '1', '<', '*', 'I', '3', '2', ' ', 's', 't', 'r', 'a', 't', 'e', 'g', 'y',
- ',', 'I', '3', '2', ' ', 'l', 'e', 'v', 'e', 'l', '>', '(', 'a', 'n', 'y', ' ', 'i',
- 'n', ')', '=', 'v', 'd', 'b', ':', 'z', 'i', 'p', ';', 'e', 'x', 't', 'e', 'r', 'n',
- ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'a', 'n', 'y', ' ', 'N', 'C', 'B',
- 'I', ':', 'u', 'n', 'z', 'i', 'p', '#', '1', '(', 'N', 'C', 'B', 'I', ':', 'z', 'l',
- 'i', 'b', '_', 'e', 'n', 'c', 'o', 'd', 'e', 'd', '_', 't', ' ', 'i', 'n', ')', ';',
- 'a', 'l', 'i', 'a', 's', ' ', 'N', 'C', 'B', 'I', ':', 'u', 'n', 'z', 'i', 'p', ' ',
- 'N', 'C', 'B', 'I', ':', 'z', 'l', 'i', 'b', '_', 'd', 'e', 'c', 'o', 'm', 'p', 'r',
- 'e', 's', 's', ';', 's', 'c', 'h', 'e', 'm', 'a', ' ', 'f', 'u', 'n', 'c', 't', 'i',
- 'o', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'z', 'l', 'i', 'b', '_', 'e', 'n', 'c', 'o',
- 'd', 'e', 'd', '_', 't', ' ', 'N', 'C', 'B', 'I', ':', 'z', 'l', 'i', 'b', '_', 'h',
- 'u', 'f', 'f', 'm', 'a', 'n', '_', 'c', 'o', 'm', 'p', 'r', 'e', 's', 's', '#', '1',
- '(', 'a', 'n', 'y', ' ', 'i', 'n', ')', '{', 'r', 'e', 't', 'u', 'r', 'n', ' ', 'N',
- 'C', 'B', 'I', ':', 'z', 'l', 'i', 'b', '#', '1', '<', '3', '>', '(', 'i', 'n', ')',
- ';', '}', 's', 'c', 'h', 'e', 'm', 'a', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n',
- ' ', 'N', 'C', 'B', 'I', ':', 'z', 'l', 'i', 'b', '_', 'e', 'n', 'c', 'o', 'd', 'e',
- 'd', '_', 't', ' ', 'N', 'C', 'B', 'I', ':', 'z', 'l', 'i', 'b', '_', 'c', 'o', 'm',
- 'p', 'r', 'e', 's', 's', '#', '1', '(', 'a', 'n', 'y', ' ', 'i', 'n', ')', '{', 'r',
- 'e', 't', 'u', 'r', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'z', 'l', 'i', 'b', '#', '1',
- '<', '0', '>', '(', 'i', 'n', ')', ';', '}', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f',
- 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', '2', 'n', 'a',
- ':', 'b', 'i', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'E', 'Q', ':', 'r', 'a',
- 'n', 'd', '_', '4', 'n', 'a', '_', '2', 'n', 'a', '#', '1', '(', 'I', 'N', 'S', 'D',
- 'C', ':', '4', 'n', 'a', ':', 'b', 'i', 'n', ' ', 'r', 'd', '_', 'b', 'i', 'n', ')',
- ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ',
- 'a', 's', 'c', 'i', 'i', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'f',
- 'o', 'r', 'm', 'a', 't', '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '#', '1',
- '(', 'a', 's', 'c', 'i', 'i', ' ', 'n', 'a', 'm', 'e', '_', 'f', 'm', 't', ',', 'I',
- '3', '2', ' ', 'X', ',', 'I', '3', '2', ' ', 'Y', '*', 'a', 's', 'c', 'i', 'i', ' ',
- 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', ')', ';', 'e', 'x', 't', 'e', 'r', 'n',
- ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'a', 's', 'c', 'i', 'i', ' ', 'I',
- 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'f', 'o', 'r', 'm', 'a', 't', '_', 's',
- 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '_', 'n', 'o', '_', 'c', 'o', 'o', 'r', 'd',
- '#', '1', '(', 'a', 's', 'c', 'i', 'i', ' ', 'n', 'a', 'm', 'e', '_', 'f', 'm', 't',
- '*', 'a', 's', 'c', 'i', 'i', ' ', 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', ')',
- ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ',
- 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'c', 's', ':', 'b', 'i', 'n', ' ', 'N', 'C',
- 'B', 'I', ':', 'c', 'o', 'l', 'o', 'r', '_', 'f', 'r', 'o', 'm', '_', 'd', 'n', 'a',
- '#', '1', '(', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'n', 'a', ':', 'b', 'i', 'n',
- ' ', 'b', 'i', 'n', '_', 'x', '2', 'n', 'a', ',', 'I', 'N', 'S', 'D', 'C', ':', 'c',
- 'o', 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o', ' ', 'r', 'e', 'a', 'd', '_', 's', 't',
- 'a', 'r', 't', ',', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l',
- 'e', 'n', ' ', 'r', 'e', 'a', 'd', '_', 'l', 'e', 'n', ',', 'I', 'N', 'S', 'D', 'C',
- ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ' ', 'c', 's', '_', 'k', 'e', 'y', ',',
- 'U', '8', ' ', 'c', 'o', 'l', 'o', 'r', '_', 'm', 'a', 't', 'r', 'i', 'x', ')', ';',
- 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'I',
- 'N', 'S', 'D', 'C', ':', 'x', '2', 'n', 'a', ':', 'b', 'i', 'n', ' ', 'N', 'C', 'B',
- 'I', ':', 'd', 'n', 'a', '_', 'f', 'r', 'o', 'm', '_', 'c', 'o', 'l', 'o', 'r', '#',
- '1', '(', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'c', 's', ':', 'b', 'i', 'n', ' ',
- 'c', 'o', 'l', 'o', 'r', '_', 'b', 'i', 'n', ',', 'I', 'N', 'S', 'D', 'C', ':', 'c',
- 'o', 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o', ' ', 'r', 'e', 'a', 'd', '_', 's', 't',
- 'a', 'r', 't', ',', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l',
- 'e', 'n', ' ', 'r', 'e', 'a', 'd', '_', 'l', 'e', 'n', ',', 'I', 'N', 'S', 'D', 'C',
- ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ' ', 'c', 's', '_', 'k', 'e', 'y', ',',
- 'U', '8', ' ', 'c', 'o', 'l', 'o', 'r', '_', 'm', 'a', 't', 'r', 'i', 'x', ')', ';',
- 's', 'c', 'h', 'e', 'm', 'a', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'I',
- 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'p', 'h', 'r', 'e',
- 'd', ' ', 'N', 'C', 'B', 'I', ':', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', '_', 't',
- 'o', '_', 'p', 'h', 'r', 'e', 'd', '#', '1', '(', 'I', 'N', 'S', 'D', 'C', ':', 'q',
- 'u', 'a', 'l', 'i', 't', 'y', ':', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', ' ', 'q',
- 'u', 'a', 'l', '_', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', ')', '{', 'I', 'N', 'S',
- 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'l', 'o', 'g', '_', 'o', 'd',
- 'd', 's', ' ', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', '_', 'c', 'l', 'i', 'p', '=',
- '<', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'l', 'o',
- 'g', '_', 'o', 'd', 'd', 's', '>', 'c', 'l', 'i', 'p', '#', '1', '<', '-', '6', ',',
- '4', '0', '>', '(', 'q', 'u', 'a', 'l', '_', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's',
- ')', ';', 'r', 'e', 't', 'u', 'r', 'n', ' ', '<', 'I', 'N', 'S', 'D', 'C', ':', 'q',
- 'u', 'a', 'l', 'i', 't', 'y', ':', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', ',', 'I',
- 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'p', 'h', 'r', 'e',
- 'd', '>', 'm', 'a', 'p', '#', '1', '<', '[', '-', '6', ',', '-', '5', ',', '-', '4',
- ',', '-', '3', ',', '-', '2', ',', '-', '1', ',', '0', ',', '1', ',', '2', ',', '3',
- ',', '4', ',', '5', ',', '6', ',', '7', ',', '8', ',', '9', ',', '1', '0', ',', '1',
- '1', ',', '1', '2', ',', '1', '3', ',', '1', '4', ',', '1', '5', ',', '1', '6', ',',
- '1', '7', ',', '1', '8', ',', '1', '9', ',', '2', '0', ',', '2', '1', ',', '2', '2',
- ',', '2', '3', ',', '2', '4', ',', '2', '5', ',', '2', '6', ',', '2', '7', ',', '2',
- '8', ',', '2', '9', ',', '3', '0', ',', '3', '1', ',', '3', '2', ',', '3', '3', ',',
- '3', '4', ',', '3', '5', ',', '3', '6', ',', '3', '7', ',', '3', '8', ',', '3', '9',
- ',', '4', '0', ']', ',', '[', '0', ',', '1', ',', '1', ',', '2', ',', '2', ',', '3',
- ',', '3', ',', '4', ',', '4', ',', '5', ',', '5', ',', '6', ',', '7', ',', '8', ',',
- '9', ',', '1', '0', ',', '1', '0', ',', '1', '1', ',', '1', '2', ',', '1', '3', ',',
- '1', '4', ',', '1', '5', ',', '1', '6', ',', '1', '7', ',', '1', '8', ',', '1', '9',
- ',', '2', '0', ',', '2', '1', ',', '2', '2', ',', '2', '3', ',', '2', '4', ',', '2',
- '5', ',', '2', '6', ',', '2', '7', ',', '2', '8', ',', '2', '9', ',', '3', '0', ',',
- '3', '1', ',', '3', '2', ',', '3', '3', ',', '3', '4', ',', '3', '5', ',', '3', '6',
- ',', '3', '7', ',', '3', '8', ',', '3', '9', ',', '4', '0', ']', '>', '(', 'l', 'o',
- 'g', '_', 'o', 'd', 'd', 's', '_', 'c', 'l', 'i', 'p', ')', ';', '}', 'e', 'x', 't',
- 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'a', 's', 'c', 'i',
- 'i', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'e', 'x', 't', 'r', 'a', 'c',
- 't', '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '#', '1', '(', 'a', 's', 'c',
- 'i', 'i', ' ', 'n', 'a', 'm', 'e', ',', 't', 'e', 'x', 't', ':', 't', 'o', 'k', 'e',
- 'n', ' ', 't', 'o', 'k', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n',
- 'c', 't', 'i', 'o', 'n', ' ', 'a', 's', 'c', 'i', 'i', ' ', 'N', 'C', 'B', 'I', ':',
- 'S', 'R', 'A', ':', 'e', 'x', 't', 'r', 'a', 'c', 't', '_', 'n', 'a', 'm', 'e', '_',
- 'f', 'm', 't', '#', '1', '<', 'a', 's', 'c', 'i', 'i', ' ', 'i', 'd', 'x', '>', '(',
- 'a', 's', 'c', 'i', 'i', ' ', 'n', 'a', 'm', 'e', ',', 't', 'e', 'x', 't', ':', 't',
- 'o', 'k', 'e', 'n', ' ', 't', 'o', 'k', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ',
- 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o',
- 'o', 'r', 'd', ':', 'v', 'a', 'l', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':',
- 'e', 'x', 't', 'r', 'a', 'c', 't', '_', 'n', 'a', 'm', 'e', '_', 'c', 'o', 'o', 'r',
- 'd', '#', '1', '<', 'U', '1', '6', ' ', 'c', 'o', 'o', 'r', 'd', '>', '(', 'a', 's',
- 'c', 'i', 'i', ' ', 'n', 'a', 'm', 'e', ',', 't', 'e', 'x', 't', ':', 't', 'o', 'k',
- 'e', 'n', ' ', 't', 'o', 'k', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u',
- 'n', 'c', 't', 'i', 'o', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':',
- 's', 'p', 'o', 't', '_', 'i', 'd', 's', '_', 'f', 'o', 'u', 'n', 'd', ' ', 'N', 'C',
- 'B', 'I', ':', 'S', 'R', 'A', ':', 'l', 'o', 'o', 'k', 'u', 'p', '#', '1', '<', 'a',
- 's', 'c', 'i', 'i', ' ', 'i', 'n', 'd', 'e', 'x', '_', 'n', 'a', 'm', 'e', ',', 'a',
- 's', 'c', 'i', 'i', ' ', 'q', 'u', 'e', 'r', 'y', '_', 'b', 'y', '_', 'n', 'a', 'm',
- 'e', ',', 'U', '8', ' ', 'n', 'a', 'm', 'e', '_', 'f', 'm', 't', '_', 'v', 'e', 'r',
- 's', 'i', 'o', 'n', '>', '(', '*', 'a', 's', 'c', 'i', 'i', ' ', 'n', 'a', 'm', 'e',
- '_', 'p', 'r', 'e', 'f', 'i', 'x', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f',
- 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'U', '8', ' ', 'N', 'C', 'B', 'I', ':', 'S',
- 'R', 'A', ':', 's', 't', 'a', 't', 's', '_', 't', 'r', 'i', 'g', 'g', 'e', 'r', '#',
- '1', '(', 'U', '8', ' ', 'r', 'e', 'a', 'd', '_', 'b', 'i', 'n', ',', 'U', '3', '2',
- ' ', 'r', 'e', 'a', 'd', '_', 'l', 'e', 'n', ',', 'I', 'N', 'S', 'D', 'C', ':', 'S',
- 'R', 'A', ':', 'x', 'r', 'e', 'a', 'd', '_', 't', 'y', 'p', 'e', ' ', 'r', 'e', 'a',
- 'd', '_', 't', 'y', 'p', 'e', '*', 'a', 's', 'c', 'i', 'i', ' ', 's', 'p', 'o', 't',
- '_', 'g', 'r', 'o', 'u', 'p', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u',
- 'n', 'c', 't', 'i', 'o', 'n', ' ', 'U', '8', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R',
- 'A', ':', 'c', 'm', 'p', '_', 's', 't', 'a', 't', 's', '_', 't', 'r', 'i', 'g', 'g',
- 'e', 'r', '#', '1', '(', 'B', '8', ' ', 'c', 'm', 'p', '_', 'r', 'e', 'a', 'd', '_',
- 'b', 'i', 'n', ',', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 't', 'a', 't',
- 's', ':', 'q', 'u', 'a', 'l', '_', 't', 'y', 'p', 'e', ' ', 'q', 'u', 'a', 'l', '_',
- 'b', 'i', 'n', ',', 'U', '3', '2', ' ', 'r', 'e', 'a', 'd', '_', 'l', 'e', 'n', ',',
- 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'x', 'r', 'e', 'a', 'd', '_', 't',
- 'y', 'p', 'e', ' ', 'r', 'e', 'a', 'd', '_', 't', 'y', 'p', 'e', '*', 'a', 's', 'c',
- 'i', 'i', ' ', 's', 'p', 'o', 't', '_', 'g', 'r', 'o', 'u', 'p', ')', ';', 'e', 'x',
- 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'U', '8', ' ',
- 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'c', 'm', 'p', 'f', '_', 's', 't', 'a',
- 't', 's', '_', 't', 'r', 'i', 'g', 'g', 'e', 'r', '#', '1', '(', 'B', '8', ' ', 'c',
- 'm', 'p', '_', 'r', 'e', 'a', 'd', '_', 'b', 'i', 'n', ',', 'U', '3', '2', ' ', 's',
- 'p', 'o', 't', '_', 'l', 'e', 'n', ',', 'U', '3', '2', ' ', 'r', 'e', 'a', 'd', '_',
- 'l', 'e', 'n', ',', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'x', 'r', 'e',
- 'a', 'd', '_', 't', 'y', 'p', 'e', ' ', 'r', 'e', 'a', 'd', '_', 't', 'y', 'p', 'e',
- '*', 'a', 's', 'c', 'i', 'i', ' ', 's', 'p', 'o', 't', '_', 'g', 'r', 'o', 'u', 'p',
- ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n',
- ' ', 'U', '8', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'p', 'h', 'r', 'e',
- 'd', '_', 's', 't', 'a', 't', 's', '_', 't', 'r', 'i', 'g', 'g', 'e', 'r', '#', '1',
- '(', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'p', 'h',
- 'r', 'e', 'd', ' ', 'q', 'u', 'a', 'l', '_', 'b', 'i', 'n', ')', ';', 'e', 'x', 't',
- 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'I', 'N', 'S', 'D',
- 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o', ' ', 'N', 'C', 'B', 'I',
- ':', 'S', 'R', 'A', ':', 'b', 'i', 'o', '_', 's', 't', 'a', 'r', 't', '#', '1', '(',
- 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o', ' ',
- 'r', 'e', 'a', 'd', '_', 's', 't', 'a', 'r', 't', ',', 'I', 'N', 'S', 'D', 'C', ':',
- 'S', 'R', 'A', ':', 'x', 'r', 'e', 'a', 'd', '_', 't', 'y', 'p', 'e', ' ', 'r', 'e',
- 'a', 'd', '_', 't', 'y', 'p', 'e', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f',
- 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o',
- 'r', 'd', ':', 'l', 'e', 'n', '[', '2', ']', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R',
- 'A', ':', 'f', 'i', 'x', '_', 'r', 'e', 'a', 'd', '_', 's', 'e', 'g', '#', '1', '(',
- 'U', '1', '6', '[', '2', ']', ' ', 'r', 'd', '_', 's', 'e', 'g', ',', 'I', 'N', 'S',
- 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l', 'e', 'n', ' ', 's', 'p', 'o', 't',
- '_', 'l', 'e', 'n', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c',
- 't', 'i', 'o', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'S', 'p', 'o',
- 't', 'D', 'e', 's', 'c', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'm', 'a',
- 'k', 'e', '_', 's', 'p', 'o', 't', '_', 'd', 'e', 's', 'c', '#', '1', '(', 'I', 'N',
- 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l', 'e', 'n', ' ', 's', 'p', 'o',
- 't', '_', 'l', 'e', 'n', ',', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd',
- ':', 'l', 'e', 'n', ' ', 'f', 'i', 'x', 'e', 'd', '_', 'l', 'e', 'n', ',', 'I', 'N',
- 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l', 'e', 'n', ' ', 's', 'i', 'g',
- '_', 'l', 'e', 'n', ',', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':',
- 'z', 'e', 'r', 'o', ' ', 't', 'r', 'i', 'm', '_', 's', 't', 'a', 'r', 't', ',', 'I',
- 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l', 'e', 'n', ' ', 't', 'r',
- 'i', 'm', '_', 'l', 'e', 'n', ',', 'U', '8', ' ', 'n', 'u', 'm', '_', 'r', 'e', 'a',
- 'd', 's', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i',
- 'o', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'R', 'e', 'a', 'd', 'D',
- 'e', 's', 'c', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'm', 'a', 'k', 'e',
- '_', 'r', 'e', 'a', 'd', '_', 'd', 'e', 's', 'c', '#', '1', '(', 'U', '8', ' ', 'n',
- 'u', 'm', '_', 'r', 'e', 'a', 'd', 's', ',', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o',
- 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o', ' ', 'r', 'e', 'a', 'd', '_', 's', 't', 'a',
- 'r', 't', ',', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l', 'e',
- 'n', ' ', 'r', 'e', 'a', 'd', '_', 'l', 'e', 'n', ',', 'I', 'N', 'S', 'D', 'C', ':',
- 'S', 'R', 'A', ':', 'x', 'r', 'e', 'a', 'd', '_', 't', 'y', 'p', 'e', ' ', 'r', 'e',
- 'a', 'd', '_', 't', 'y', 'p', 'e', ',', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A',
- ':', 'r', 'e', 'a', 'd', '_', 'f', 'i', 'l', 't', 'e', 'r', ' ', 'r', 'e', 'a', 'd',
- '_', 'f', 'i', 'l', 't', ',', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't',
- 'e', 'x', 't', ' ', 'c', 's', '_', 'k', 'e', 'y', ',', 'I', 'N', 'S', 'D', 'C', ':',
- 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o', ' ', 'l', 'a', 'b', 'e', 'l', '_',
- 's', 't', 'a', 'r', 't', ',', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd',
- ':', 'l', 'e', 'n', ' ', 'l', 'a', 'b', 'e', 'l', '_', 'l', 'e', 'n', ',', 'a', 's',
- 'c', 'i', 'i', ' ', 'l', 'a', 'b', 'e', 'l', ')', ';', 'e', 'x', 't', 'e', 'r', 'n',
- ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', '<', 't', 'y', 'p', 'e', ' ', 'T',
- '>', 'T', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'r', 'o', 't', 'a', 't',
- 'e', '#', '1', '<', 'b', 'o', 'o', 'l', ' ', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g',
- '>', '(', 'T', ' ', 'i', 'n', ',', 'U', '8', ' ', 'c', 'a', 'l', 'l', 'e', 'd', ')',
- ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ',
- '<', 't', 'y', 'p', 'e', ' ', 'T', '>', 'T', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R',
- 'A', ':', 's', 'w', 'a', 'p', '#', '1', '(', 'T', ' ', 'i', 'n', ',', 'U', '8', ' ',
- 'c', 'a', 'l', 'l', 'e', 'd', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u',
- 'n', 'c', 't', 'i', 'o', 'n', ' ', '<', 't', 'y', 'p', 'e', ' ', 'T', '>', 'T', ' ',
- 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'n', 'o', 'r', 'm', 'a', 'l', 'i', 'z',
- 'e', '#', '1', '(', 'T', ' ', 'i', 'n', 't', 'e', 'n', 's', 'i', 't', 'y', ',', 'U',
- '8', ' ', 'c', 'a', 'l', 'l', 'e', 'd', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ',
- 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', '<', 't', 'y', 'p', 'e', ' ', 'T', '>',
- 'T', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'd', 'e', 'n', 'o', 'r', 'm',
- 'a', 'l', 'i', 'z', 'e', '#', '1', '(', 'T', ' ', 'i', 'n', 't', 'e', 'n', 's', 'i',
- 't', 'y', ',', 'U', '8', ' ', 'c', 'a', 'l', 'l', 'e', 'd', ')', ';', 'e', 'x', 't',
- 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', '<', 't', 'y', 'p',
- 'e', ' ', 'T', '>', 'T', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'm', 'a',
- 'k', 'e', '_', 'p', 'o', 's', 'i', 't', 'i', 'o', 'n', '#', '1', '<', 'T', ' ', 's',
- 't', 'a', 'r', 't', '>', '(', 'a', 'n', 'y', ' ', 'b', 'a', 's', 'e', 's', ')', ';',
- 's', 'c', 'h', 'e', 'm', 'a', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'N',
- 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p', 'p', 'e', 'd', '_', 'f',
- 's', 'a', 'm', 'p', '4', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'f', 's',
- 'a', 'm', 'p', '4', ':', 'd', 'e', 'c', 'o', 'd', 'e', '#', '2', '(', 'm', 'e', 'r',
- 'g', 'e', 'd', '_', 'f', 'm', 't', ' ', 'i', 'n', ')', '{', 'f', 'z', 'i', 'p', '_',
- 'f', 'm', 't', ' ', 'c', 'm', 'p', '0', '=', 's', 'p', 'l', 'i', 't', '#', '1', '<',
- '0', '>', '(', 'i', 'n', ')', ';', 'f', 'z', 'i', 'p', '_', 'f', 'm', 't', ' ', 'c',
- 'm', 'p', '1', '2', '3', '=', 's', 'p', 'l', 'i', 't', '#', '1', '<', '1', '>', '(',
- 'i', 'n', ')', ';', 'F', '3', '2', ' ', 'c', 'h', '0', '=', 'f', 'u', 'n', 'z', 'i',
- 'p', '#', '1', '(', 'c', 'm', 'p', '0', ')', ';', 'F', '3', '2', ' ', 'c', 'h', '1',
- '2', '3', 'a', '=', 'f', 'u', 'n', 'z', 'i', 'p', '#', '1', '(', 'c', 'm', 'p', '1',
- '2', '3', ')', ';', 'F', '3', '2', '[', '3', ']', ' ', 'c', 'h', '1', '2', '3', '=',
- 'r', 'e', 'd', 'i', 'm', 'e', 'n', 's', 'i', 'o', 'n', '#', '1', '(', 'c', 'h', '1',
- '2', '3', 'a', ')', ';', 'r', 'e', 't', 'u', 'r', 'n', ' ', '(', 'N', 'C', 'B', 'I',
- ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p', 'p', 'e', 'd', '_', 'f', 's', 'a', 'm',
- 'p', '4', ')', '<', 'F', '3', '2', '>', 'p', 'a', 's', 't', 'e', '#', '1', '(', 'c',
- 'h', '0', ',', 'c', 'h', '1', '2', '3', ')', ';', '}', 's', 'c', 'h', 'e', 'm', 'a',
- ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'm', 'e', 'r', 'g', 'e', 'd', '_',
- 'f', 'm', 't', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'f', 's', 'a', 'm',
- 'p', '4', ':', 'e', 'n', 'c', 'o', 'd', 'e', '#', '2', '<', 'U', '3', '2', ' ', 'c',
- 'a', 'l', 'l', 'e', 'd', ',', 'U', '3', '2', ' ', 'a', 'l', 't', '>', '(', 'N', 'C',
- 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p', 'p', 'e', 'd', '_', 'f', 's',
- 'a', 'm', 'p', '4', ' ', 'i', 'n', ')', '{', 'F', '3', '2', ' ', 'c', 'h', '0', '=',
- '<', 'F', '3', '2', '>', 'c', 'u', 't', '#', '1', '<', '0', '>', '(', 'i', 'n', ')',
- ';', 'F', '3', '2', '[', '3', ']', ' ', 'c', 'h', '1', '2', '3', '=', '<', 'F', '3',
- '2', '>', 'c', 'u', 't', '#', '1', '<', '1', ',', '2', ',', '3', '>', '(', 'i', 'n',
- ')', ';', 'f', 'z', 'i', 'p', '_', 'f', 'm', 't', ' ', 'c', 'm', 'p', '0', '=', 'f',
- 'z', 'i', 'p', '#', '1', '<', 'c', 'a', 'l', 'l', 'e', 'd', '>', '(', 'c', 'h', '0',
- ')', ';', 'F', '3', '2', ' ', 'c', 'h', '1', '2', '3', 'a', '=', 'r', 'e', 'd', 'i',
- 'm', 'e', 'n', 's', 'i', 'o', 'n', '#', '1', '(', 'c', 'h', '1', '2', '3', ')', ';',
- 'f', 'z', 'i', 'p', '_', 'f', 'm', 't', ' ', 'c', 'm', 'p', '1', '2', '3', '=', 'f',
- 'z', 'i', 'p', '#', '1', '<', 'a', 'l', 't', '>', '(', 'c', 'h', '1', '2', '3', 'a',
- ')', ';', 'r', 'e', 't', 'u', 'r', 'n', ' ', 'm', 'e', 'r', 'g', 'e', '#', '1', '(',
- 'c', 'm', 'p', '0', ',', 'c', 'm', 'p', '1', '2', '3', ')', ';', '}', 'e', 'x', 't',
- 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'U', '3', '2', '[',
- '3', ']', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_', '4', '5', '4', '_',
- ':', 'd', 'y', 'n', 'a', 'm', 'i', 'c', '_', 'r', 'e', 'a', 'd', '_', 'd', 'e', 's',
- 'c', '#', '1', '<', '*', 'U', '3', '2', ' ', 'e', 'd', 'i', 't', '_', 'd', 'i', 's',
- 't', 'a', 'n', 'c', 'e', '>', '(', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_',
- '4', '5', '4', '_', ':', 'd', 'r', 'd', 'p', 'a', 'r', 'a', 'm', '_', 's', 'e', 't',
- ' ', 's', 'p', 'o', 't', ',', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_', '4',
- '5', '4', '_', ':', 'd', 'r', 'd', 'p', 'a', 'r', 'a', 'm', '_', 's', 'e', 't', ' ',
- 'k', 'e', 'y', '*', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_', '4', '5', '4',
- '_', ':', 'd', 'r', 'd', 'p', 'a', 'r', 'a', 'm', '_', 's', 'e', 't', ' ', 'l', 'i',
- 'n', 'k', 'e', 'r', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c',
- 't', 'i', 'o', 'n', ' ', 't', 'e', 'x', 't', ':', 't', 'o', 'k', 'e', 'n', ' ', 'N',
- 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_', '4', '5', '4', '_', ':', 't', 'o', 'k',
- 'e', 'n', 'i', 'z', 'e', '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '#', '1',
- '(', 'a', 's', 'c', 'i', 'i', ' ', 'n', 'a', 'm', 'e', ')', ';', 'e', 'x', 't', 'e',
- 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 't', 'e', 'x', 't', ':',
- 't', 'o', 'k', 'e', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l',
- 'l', 'u', 'm', 'i', 'n', 'a', ':', 't', 'o', 'k', 'e', 'n', 'i', 'z', 'e', '_', 's',
- 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '#', '1', '(', 'a', 's', 'c', 'i', 'i', ' ',
- 'n', 'a', 'm', 'e', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c',
- 't', 'i', 'o', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a',
- 'p', 'p', 'e', 'd', '_', 'q', 'u', 'a', 'l', '4', ' ', 'N', 'C', 'B', 'I', ':', 'S',
- 'R', 'A', ':', 'q', 'u', 'a', 'l', '4', '_', 'd', 'e', 'c', 'o', 'd', 'e', '#', '1',
- '(', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'e', 'n', 'c', 'o', 'd', 'e', 'd',
- '_', 'q', 'u', 'a', 'l', '4', ' ', 'i', 'n', ')', ';', 'e', 'x', 't', 'e', 'r', 'n',
- ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R',
- 'A', ':', 'e', 'n', 'c', 'o', 'd', 'e', 'd', '_', 'q', 'u', 'a', 'l', '4', ' ', 'N',
- 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'q', 'u', 'a', 'l', '4', '_', 'e', 'n', 'c',
- 'o', 'd', 'e', '#', '1', '(', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w',
- 'a', 'p', 'p', 'e', 'd', '_', 'q', 'u', 'a', 'l', '4', ' ', 'i', 'n', ')', ';', 'e',
- 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 't', 'e',
- 'x', 't', ':', 't', 'o', 'k', 'e', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A',
- ':', 'A', 'B', 'I', ':', 't', 'o', 'k', 'e', 'n', 'i', 'z', 'e', '_', 's', 'p', 'o',
- 't', '_', 'n', 'a', 'm', 'e', '#', '1', '(', 'a', 's', 'c', 'i', 'i', ' ', 'n', 'a',
- 'm', 'e', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i',
- 'o', 'n', ' ', 't', 'e', 'x', 't', ':', 't', 'o', 'k', 'e', 'n', ' ', 'N', 'C', 'B',
- 'I', ':', 'S', 'R', 'A', ':', 'H', 'e', 'l', 'i', 'c', 'o', 's', ':', 't', 'o', 'k',
- 'e', 'n', 'i', 'z', 'e', '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '#', '1',
- '(', 'a', 's', 'c', 'i', 'i', ' ', 'n', 'a', 'm', 'e', ')', ';', 'e', 'x', 't', 'e',
- 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 't', 'e', 'x', 't', ':',
- 't', 'o', 'k', 'e', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'o',
- 'n', 'T', 'o', 'r', 'r', 'e', 'n', 't', ':', 't', 'o', 'k', 'e', 'n', 'i', 'z', 'e',
- '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '#', '1', '(', 'a', 's', 'c', 'i',
- 'i', ' ', 'n', 'a', 'm', 'e', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u',
- 'n', 'c', 't', 'i', 'o', 'n', ' ', 'U', '3', '2', '[', '5', ']', ' ', 'N', 'C', 'B',
- 'I', ':', 'S', 'R', 'A', ':', 'r', 'e', 'a', 'd', '_', 's', 'e', 'g', '_', 'f', 'r',
- 'o', 'm', '_', 'r', 'e', 'a', 'd', 'n', '#', '1', '(', 'U', '8', ' ', 'n', 'r', 'e',
- 'a', 'd', 's', ',', 'U', '3', '2', ' ', 's', 'p', 'o', 't', '_', 'l', 'e', 'n', ')',
- ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ',
- 'a', 's', 'c', 'i', 'i', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'r', 'e',
- 'w', 'r', 'i', 't', 'e', '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '#', '1',
- '<', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'p', 'l', 'a', 't', 'f', 'o',
- 'r', 'm', '_', 'i', 'd', ' ', 'p', 'l', 'a', 't', 'f', 'o', 'r', 'm', '>', '(', 'a',
- 's', 'c', 'i', 'i', ' ', 's', 'k', 'e', 'y', '*', 'a', 's', 'c', 'i', 'i', ' ', 'p',
- 'r', 'e', 'f', 'i', 'x', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n',
- 'c', 't', 'i', 'o', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd',
- ':', 'v', 'a', 'l', '[', '*', ']', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':',
- 'e', 'x', 't', 'r', 'a', 'c', 't', '_', 'c', 'o', 'o', 'r', 'd', 'i', 'n', 'a', 't',
- 'e', 's', '#', '1', '<', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'p', 'l',
- 'a', 't', 'f', 'o', 'r', 'm', '_', 'i', 'd', ' ', 'p', 'l', 'a', 't', 'f', 'o', 'r',
- 'm', '>', '(', 'a', 's', 'c', 'i', 'i', ' ', 's', 'k', 'e', 'y', ')', ';', 'e', 'x',
- 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', '_', '_', 'u',
- 'n', 't', 'y', 'p', 'e', 'd', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_',
- '4', '5', '4', '_', ':', 'u', 'n', 't', 'y', 'p', 'e', 'd', '_', '0', '(', ')', ';',
- 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'U',
- '1', '6', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'd', 'e', 'c', 'o', 'd',
- 'e', ':', 'C', 'L', 'I', 'P', '#', '1', '(', 'o', 'p', 'a', 'q', 'u', 'e', ' ', 'i',
- 'n', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o',
- 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'p', 'o', 's', '1', '6', ' ',
- 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'd', 'e', 'c', 'o', 'd', 'e', ':', 'P',
- 'O', 'S', 'I', 'T', 'I', 'O', 'N', '#', '1', '(', 'o', 'p', 'a', 'q', 'u', 'e', ' ',
- 'i', 'n', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i',
- 'o', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', '2', 'n', 'a', ':', 'p', 'a', 'c', 'k',
- 'e', 'd', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'd', 'e', 'c', 'o', 'd',
- 'e', ':', 'R', 'E', 'A', 'D', '#', '1', '<', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R',
- 'A', ':', 'p', 'l', 'a', 't', 'f', 'o', 'r', 'm', '_', 'i', 'd', ' ', 'p', 'l', 'a',
- 't', 'f', 'o', 'r', 'm', '>', '(', 'o', 'p', 'a', 'q', 'u', 'e', ' ', 'i', 'n', ')',
- ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ',
- 'a', 'n', 'y', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'd', 'e', 'c', 'o',
- 'd', 'e', ':', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', '#', '1', '<', 'I', 'N', 'S', 'D',
- 'C', ':', 'S', 'R', 'A', ':', 'p', 'l', 'a', 't', 'f', 'o', 'r', 'm', '_', 'i', 'd',
- ' ', 'p', 'l', 'a', 't', 'f', 'o', 'r', 'm', '>', '(', 'o', 'p', 'a', 'q', 'u', 'e',
- ' ', 'i', 'n', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't',
- 'i', 'o', 'n', ' ', 'a', 'n', 'y', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':',
- 'd', 'e', 'c', 'o', 'd', 'e', ':', 'S', 'I', 'G', 'N', 'A', 'L', '#', '1', '<', 'I',
- 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'p', 'l', 'a', 't', 'f', 'o', 'r', 'm',
- '_', 'i', 'd', ' ', 'p', 'l', 'a', 't', 'f', 'o', 'r', 'm', '>', '(', 'o', 'p', 'a',
- 'q', 'u', 'e', ' ', 'i', 'n', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u',
- 'n', 'c', 't', 'i', 'o', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'p',
- 'o', 's', '1', '6', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_', '4', '5',
- '4', '_', ':', 'p', 'r', 'o', 'c', 'e', 's', 's', '_', 'p', 'o', 's', 'i', 't', 'i',
- 'o', 'n', '#', '1', '(', 'U', '1', '6', ' ', 'p', 'o', 's', 'i', 't', 'i', 'o', 'n',
- '*', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'r', 'e', 'a', 'd', '_', 'f',
- 'i', 'l', 't', 'e', 'r', ' ', 'r', 'd', '_', 'f', 'i', 'l', 't', ',', 'N', 'C', 'B',
- 'I', ':', 'i', 's', 'a', 'm', 'p', '1', ' ', 's', 'i', 'g', ')', ';', 'e', 'x', 't',
- 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', '_', '_', 'u', 'n',
- 't', 'y', 'p', 'e', 'd', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_', '4',
- '5', '4', '_', ':', 'u', 'n', 't', 'y', 'p', 'e', 'd', '_', '1', '_', '2', 'a', '(',
- ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n',
- ' ', '_', '_', 'u', 'n', 't', 'y', 'p', 'e', 'd', ' ', 'N', 'C', 'B', 'I', ':', 'S',
- 'R', 'A', ':', '_', '4', '5', '4', '_', ':', 'u', 'n', 't', 'y', 'p', 'e', 'd', '_',
- '1', '_', '2', 'b', '(', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n',
- 'c', 't', 'i', 'o', 'n', ' ', 'a', 'n', 'y', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R',
- 'A', ':', 'd', 'e', 'c', 'o', 'd', 'e', ':', 'I', 'N', 'T', 'E', 'N', 'S', 'I', 'T',
- 'Y', '#', '1', '(', 'o', 'p', 'a', 'q', 'u', 'e', ' ', 'i', 'n', ')', ';', 'e', 'x',
- 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', 'a', 'n', 'y',
- ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'd', 'e', 'c', 'o', 'd', 'e', ':',
- 'N', 'O', 'I', 'S', 'E', '#', '1', '(', 'o', 'p', 'a', 'q', 'u', 'e', ' ', 'i', 'n',
- ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n',
- ' ', '_', '_', 'u', 'n', 't', 'y', 'p', 'e', 'd', ' ', 'N', 'C', 'B', 'I', ':', 'S',
- 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a', ':', 'u', 'n', 't', 'y', 'p',
- 'e', 'd', '_', '0', 'a', '(', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u',
- 'n', 'c', 't', 'i', 'o', 'n', ' ', '_', '_', 'u', 'n', 't', 'y', 'p', 'e', 'd', ' ',
- 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a',
- ':', 'u', 'n', 't', 'y', 'p', 'e', 'd', '_', '0', 'b', '(', ')', ';', 'e', 'x', 't',
- 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', '_', '_', 'u', 'n',
- 't', 'y', 'p', 'e', 'd', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l',
- 'l', 'u', 'm', 'i', 'n', 'a', ':', 'u', 'n', 't', 'y', 'p', 'e', 'd', '_', '1', 'a',
- '(', ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o',
- 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p', 'p', 'e',
- 'd', '_', 'q', 'u', 'a', 'l', '4', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':',
- 'q', 'u', 'a', 'l', '4', '_', 'd', 'e', 'c', 'o', 'm', 'p', 'r', 'e', 's', 's', '_',
- 'v', '1', '#', '1', '(', 'a', 'n', 'y', ' ', 'i', 'n', ')', ';', 'e', 'x', 't', 'e',
- 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', '_', '_', 'u', 'n', 't',
- 'y', 'p', 'e', 'd', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l',
- 'u', 'm', 'i', 'n', 'a', ':', 'u', 'n', 't', 'y', 'p', 'e', 'd', '_', '1', 'b', '(',
- ')', ';', 'e', 'x', 't', 'e', 'r', 'n', ' ', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n',
- ' ', '_', '_', 'u', 'n', 't', 'y', 'p', 'e', 'd', ' ', 'N', 'C', 'B', 'I', ':', 'S',
- 'R', 'A', ':', 'A', 'B', 'I', ':', 'u', 'n', 't', 'y', 'p', 'e', 'd', '_', '1', '(',
- ')', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', '<', 't', 'y', 'p', 'e', ' ',
- 'T', '>', 'T', ' ', 'i', 'z', 'i', 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g',
- '#', '1', '{', 'e', 'n', 'c', 'o', 'd', 'e', '{', 'r', 'e', 't', 'u', 'r', 'n', ' ',
- 'i', 'z', 'i', 'p', '#', '2', '.', '1', '(', '@', ')', ';', '}', 'd', 'e', 'c', 'o',
- 'd', 'e', '{', 'r', 'e', 't', 'u', 'r', 'n', ' ', '(', 'T', ')', 'i', 'u', 'n', 'z',
- 'i', 'p', '#', '2', '.', '1', '(', '@', ')', ';', '}', '}', 'p', 'h', 'y', 's', 'i',
- 'c', 'a', 'l', ' ', '<', 't', 'y', 'p', 'e', ' ', 'T', '>', 'T', ' ', 'f', 'z', 'i',
- 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '#', '1', '<', 'U', '3', '2', ' ',
- 'm', 'a', 'n', 't', 'i', 's', 's', 'a', '>', '{', 'e', 'n', 'c', 'o', 'd', 'e', '{',
- 'r', 'e', 't', 'u', 'r', 'n', ' ', 'f', 'z', 'i', 'p', '#', '1', '<', 'm', 'a', 'n',
- 't', 'i', 's', 's', 'a', '>', '(', '@', ')', ';', '}', 'd', 'e', 'c', 'o', 'd', 'e',
- '{', 'r', 'e', 't', 'u', 'r', 'n', ' ', 'f', 'u', 'n', 'z', 'i', 'p', '#', '1', '(',
- '@', ')', ';', '}', '}', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', '<', 't', 'y',
- 'p', 'e', ' ', 'T', '>', 'T', ' ', 'z', 'i', 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i',
- 'n', 'g', '#', '1', '<', '*', 'I', '3', '2', ' ', 's', 't', 'r', 'a', 't', 'e', 'g',
- 'y', ',', 'I', '3', '2', ' ', 'l', 'e', 'v', 'e', 'l', '>', '{', 'e', 'n', 'c', 'o',
- 'd', 'e', '{', 'r', 'e', 't', 'u', 'r', 'n', ' ', 'z', 'i', 'p', '#', '1', '<', 's',
- 't', 'r', 'a', 't', 'e', 'g', 'y', ',', 'l', 'e', 'v', 'e', 'l', '>', '(', '@', ')',
- ';', '}', 'd', 'e', 'c', 'o', 'd', 'e', '{', 'r', 'e', 't', 'u', 'r', 'n', ' ', 'u',
- 'n', 'z', 'i', 'p', '#', '1', '(', '@', ')', ';', '}', '}', 'p', 'h', 'y', 's', 'i',
- 'c', 'a', 'l', ' ', 'b', 'o', 'o', 'l', ' ', 'b', 'o', 'o', 'l', '_', 'e', 'n', 'c',
- 'o', 'd', 'i', 'n', 'g', '#', '1', '{', 'e', 'n', 'c', 'o', 'd', 'e', '{', 'U', '8',
- ' ', 'l', 'i', 'm', '=', '<', 'U', '8', '>', 'c', 'l', 'i', 'p', '#', '1', '<', '0',
- ',', '1', '>', '(', '@', ')', ';', 'B', '1', ' ', 'b', 'i', 't', '=', 'p', 'a', 'c',
- 'k', '#', '1', '(', 'l', 'i', 'm', ')', ';', 'r', 'e', 't', 'u', 'r', 'n', ' ', 'z',
- 'i', 'p', '#', '1', '<', '3', ',', '1', '>', '(', 'b', 'i', 't', ')', ';', '}', 'd',
- 'e', 'c', 'o', 'd', 'e', '{', 'B', '1', ' ', 'b', 'i', 't', '=', 'u', 'n', 'z', 'i',
- 'p', '#', '1', '(', '@', ')', ';', 'r', 'e', 't', 'u', 'r', 'n', ' ', '(', 'b', 'o',
- 'o', 'l', ')', 'u', 'n', 'p', 'a', 'c', 'k', '#', '1', '(', 'b', 'i', 't', ')', ';',
- '}', '}', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', '<', 't', 'y', 'p', 'e', ' ',
- 'T', '>', 'T', ' ', 'd', 'e', 'l', 't', 'a', '_', 'i', 'z', 'i', 'p', '_', 'e', 'n',
- 'c', 'o', 'd', 'i', 'n', 'g', '#', '1', '{', 'e', 'n', 'c', 'o', 'd', 'e', '{', 'T',
- ' ', 'd', 'l', 't', '=', '<', 'T', '>', 'd', 'e', 'l', 't', 'a', '#', '1', '(', '@',
- ')', ';', 'r', 'e', 't', 'u', 'r', 'n', ' ', 'i', 'z', 'i', 'p', '#', '2', '.', '1',
- '(', 'd', 'l', 't', ')', ';', '}', 'd', 'e', 'c', 'o', 'd', 'e', '{', 'T', ' ', 'd',
- 'l', 't', '=', 'i', 'u', 'n', 'z', 'i', 'p', '#', '2', '.', '1', '(', '@', ')', ';',
- 'r', 'e', 't', 'u', 'r', 'n', ' ', '<', 'T', '>', 'u', 'n', 'd', 'e', 'l', 't', 'a',
- '#', '1', '(', 'd', 'l', 't', ')', ';', '}', '}', 'p', 'h', 'y', 's', 'i', 'c', 'a',
- 'l', ' ', '<', 't', 'y', 'p', 'e', ' ', 'T', '>', 'T', ' ', 'd', 'e', 'l', 't', 'a',
- '_', 'z', 'i', 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '#', '1', '{', 'e',
- 'n', 'c', 'o', 'd', 'e', '{', 'T', ' ', 'd', 'l', 't', '=', '<', 'T', '>', 'd', 'e',
- 'l', 't', 'a', '#', '1', '(', '@', ')', ';', 'r', 'e', 't', 'u', 'r', 'n', ' ', 'z',
- 'i', 'p', '#', '1', '<', '3', ',', '1', '>', '(', 'd', 'l', 't', ')', ';', '}', 'd',
- 'e', 'c', 'o', 'd', 'e', '{', 'T', ' ', 'd', 'l', 't', '=', 'u', 'n', 'z', 'i', 'p',
- '#', '1', '(', '@', ')', ';', 'r', 'e', 't', 'u', 'r', 'n', ' ', '<', 'T', '>', 'u',
- 'n', 'd', 'e', 'l', 't', 'a', '#', '1', '(', 'd', 'l', 't', ')', ';', '}', '}', 'p',
- 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', '<', 't', 'y', 'p', 'e', ' ', 'T', '>', 'T',
- ' ', 'd', 'e', 'l', 't', 'a', '_', 'a', 'v', 'e', 'r', 'a', 'g', 'e', '_', 'z', 'i',
- 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '#', '1', '{', 'e', 'n', 'c', 'o',
- 'd', 'e', '{', 'd', 'e', 'l', 't', 'a', '_', 'a', 'v', 'e', 'r', 'a', 'g', 'e', 'd',
- '_', 'f', 'm', 't', ' ', 't', '=', 'd', 'e', 'l', 't', 'a', '_', 'a', 'v', 'e', 'r',
- 'a', 'g', 'e', '#', '1', '(', '@', ')', ';', 'r', 'e', 't', 'u', 'r', 'n', ' ', 'z',
- 'i', 'p', '#', '1', '<', '3', ',', '1', '>', '(', 't', ')', ';', '}', 'd', 'e', 'c',
- 'o', 'd', 'e', '{', 'd', 'e', 'l', 't', 'a', '_', 'a', 'v', 'e', 'r', 'a', 'g', 'e',
- 'd', '_', 'f', 'm', 't', ' ', 't', '=', 'u', 'n', 'z', 'i', 'p', '#', '1', '(', '@',
- ')', ';', 'r', 'e', 't', 'u', 'r', 'n', ' ', 'u', 'n', 'd', 'e', 'l', 't', 'a', '_',
- 'a', 'v', 'e', 'r', 'a', 'g', 'e', '#', '1', '(', 't', ')', ';', '}', '}', 'p', 'h',
- 'y', 's', 'i', 'c', 'a', 'l', ' ', '<', 't', 'y', 'p', 'e', ' ', 'T', '>', 'T', ' ',
- 'b', 'z', 'i', 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '#', '1', '<', '*',
- 'U', '3', '2', ' ', 'b', 'l', 'o', 'c', 'k', 'S', 'i', 'z', 'e', '1', '0', '0', 'k',
- ',', 'U', '3', '2', ' ', 'w', 'o', 'r', 'k', 'F', 'a', 'c', 't', 'o', 'r', '>', '{',
- 'e', 'n', 'c', 'o', 'd', 'e', '{', 'r', 'e', 't', 'u', 'r', 'n', ' ', 'b', 'z', 'i',
- 'p', '#', '1', '<', 'b', 'l', 'o', 'c', 'k', 'S', 'i', 'z', 'e', '1', '0', '0', 'k',
- ',', 'w', 'o', 'r', 'k', 'F', 'a', 'c', 't', 'o', 'r', '>', '(', '@', ')', ';', '}',
- 'd', 'e', 'c', 'o', 'd', 'e', '{', 'r', 'e', 't', 'u', 'r', 'n', ' ', 'b', 'u', 'n',
- 'z', 'i', 'p', '#', '1', '(', '@', ')', ';', '}', '}', 'p', 'h', 'y', 's', 'i', 'c',
- 'a', 'l', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'o', 'n',
- 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_', '4', '5', '4', '_', ':',
- 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':', 'C', 'L', 'I', 'P', '#', '2', '{', 'e',
- 'n', 'c', 'o', 'd', 'e', '{', 'r', 'e', 't', 'u', 'r', 'n', ' ', 'i', 'z', 'i', 'p',
- '#', '2', '.', '1', '(', '@', ')', ';', '}', 'd', 'e', 'c', 'o', 'd', 'e', '{', 'r',
- 'e', 't', 'u', 'r', 'n', ' ', '(', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r',
- 'd', ':', 'o', 'n', 'e', ')', 'i', 'u', 'n', 'z', 'i', 'p', '#', '2', '.', '1', '(',
- '@', ')', ';', '}', '}', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'N', 'C', 'B',
- 'I', ':', 'i', 's', 'a', 'm', 'p', '1', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A',
- ':', '_', '4', '5', '4', '_', ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':', 'S',
- 'I', 'G', 'N', 'A', 'L', '#', '2', '{', 'e', 'n', 'c', 'o', 'd', 'e', '{', 'r', 'e',
- 't', 'u', 'r', 'n', ' ', 'i', 'z', 'i', 'p', '#', '2', '.', '1', '(', '@', ')', ';',
- '}', 'd', 'e', 'c', 'o', 'd', 'e', '{', 'r', 'e', 't', 'u', 'r', 'n', ' ', '(', 'N',
- 'C', 'B', 'I', ':', 'i', 's', 'a', 'm', 'p', '1', ')', 'i', 'u', 'n', 'z', 'i', 'p',
- '#', '2', '.', '1', '(', '@', ')', ';', '}', '}', 'p', 'h', 'y', 's', 'i', 'c', 'a',
- 'l', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'p', 'o', 's', 'i', 't', 'i', 'o', 'n', ':',
- 'o', 'n', 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_', '4', '5', '4',
- '_', ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':', 'P', 'O', 'S', 'I', 'T', 'I',
- 'O', 'N', '#', '2', '{', 'e', 'n', 'c', 'o', 'd', 'e', '{', 'I', '3', '2', ' ', 'p',
- 'o', 's', '_', '1', 's', 't', '_', 'd', 'e', 'r', 'i', 'v', '=', '<', 'I', '3', '2',
- '>', 'd', 'e', 'r', 'i', 'v', '#', '1', '(', '@', ')', ';', 'r', 'e', 't', 'u', 'r',
- 'n', ' ', 'i', 'z', 'i', 'p', '#', '2', '.', '1', '(', 'p', 'o', 's', '_', '1', 's',
- 't', '_', 'd', 'e', 'r', 'i', 'v', ')', ';', '}', 'd', 'e', 'c', 'o', 'd', 'e', '{',
- 'I', '3', '2', ' ', 'p', 'o', 's', '_', '1', 's', 't', '_', 'd', 'e', 'r', 'i', 'v',
- '=', 'i', 'u', 'n', 'z', 'i', 'p', '#', '2', '.', '1', '(', '@', ')', ';', 'r', 'e',
- 't', 'u', 'r', 'n', ' ', '(', 'I', 'N', 'S', 'D', 'C', ':', 'p', 'o', 's', 'i', 't',
- 'i', 'o', 'n', ':', 'o', 'n', 'e', ')', '<', 'I', '3', '2', '>', 'i', 'n', 't', 'e',
- 'g', 'r', 'a', 'l', '#', '1', '(', 'p', 'o', 's', '_', '1', 's', 't', '_', 'd', 'e',
- 'r', 'i', 'v', ')', ';', '}', '}', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'N',
- 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p', 'p', 'e', 'd', '_', 'q',
- 'u', 'a', 'l', '4', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'q', 'u', 'a',
- 'l', '4', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '#', '1', '{', 'e', 'n', 'c',
- 'o', 'd', 'e', '{', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'e', 'n', 'c', 'o',
- 'd', 'e', 'd', '_', 'q', 'u', 'a', 'l', '4', ' ', 'e', 'n', 'c', 'o', 'd', 'e', 'd',
- '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'q', 'u', 'a', 'l', '4', '_', 'e',
- 'n', 'c', 'o', 'd', 'e', '#', '1', '(', '@', ')', ';', 'r', 'e', 't', 'u', 'r', 'n',
- ' ', 'z', 'i', 'p', '#', '1', '<', '3', ',', '1', '>', '(', 'e', 'n', 'c', 'o', 'd',
- 'e', 'd', ')', ';', '}', 'd', 'e', 'c', 'o', 'd', 'e', '{', 'N', 'C', 'B', 'I', ':',
- 'S', 'R', 'A', ':', 'e', 'n', 'c', 'o', 'd', 'e', 'd', '_', 'q', 'u', 'a', 'l', '4',
- ' ', 'u', 'n', 'z', 'i', 'p', 'p', 'e', 'd', '=', 'u', 'n', 'z', 'i', 'p', '#', '1',
- '(', '@', ')', ';', 'r', 'e', 't', 'u', 'r', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S',
- 'R', 'A', ':', 'q', 'u', 'a', 'l', '4', '_', 'd', 'e', 'c', 'o', 'd', 'e', '#', '1',
- '(', 'u', 'n', 'z', 'i', 'p', 'p', 'e', 'd', ')', ';', '}', '}', 'p', 'h', 'y', 's',
- 'i', 'c', 'a', 'l', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a',
- 'p', 'p', 'e', 'd', '_', 'f', 's', 'a', 'm', 'p', '4', ' ', 'N', 'C', 'B', 'I', ':',
- 'S', 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a', ':', 'e', 'n', 'c', 'o',
- 'd', 'i', 'n', 'g', ':', 'S', 'I', 'G', 'N', 'A', 'L', '#', '2', '{', 'e', 'n', 'c',
- 'o', 'd', 'e', '{', 'r', 'e', 't', 'u', 'r', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S',
- 'R', 'A', ':', 'f', 's', 'a', 'm', 'p', '4', ':', 'e', 'n', 'c', 'o', 'd', 'e', '#',
- '2', '<', '1', '4', ',', '1', '0', '>', '(', '@', ')', ';', '}', 'd', 'e', 'c', 'o',
- 'd', 'e', '{', 'r', 'e', 't', 'u', 'r', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R',
- 'A', ':', 'f', 's', 'a', 'm', 'p', '4', ':', 'd', 'e', 'c', 'o', 'd', 'e', '#', '2',
- '(', '@', ')', ';', '}', '}', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'N', 'C',
- 'B', 'I', ':', 'f', 's', 'a', 'm', 'p', '4', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R',
- 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a', ':', 'e', 'n', 'c', 'o', 'd', 'i',
- 'n', 'g', ':', 'N', 'O', 'I', 'S', 'E', '#', '2', '{', 'e', 'n', 'c', 'o', 'd', 'e',
- '{', 'F', '3', '2', ' ', 'n', 'c', 'm', 'p', '=', 'r', 'e', 'd', 'i', 'm', 'e', 'n',
- 's', 'i', 'o', 'n', '#', '1', '(', '@', ')', ';', 'r', 'e', 't', 'u', 'r', 'n', ' ',
- 'f', 'z', 'i', 'p', '#', '1', '<', '1', '0', '>', '(', 'n', 'c', 'm', 'p', ')', ';',
- '}', 'd', 'e', 'c', 'o', 'd', 'e', '{', 'F', '3', '2', ' ', 'd', 'c', 'm', 'p', '=',
- 'f', 'u', 'n', 'z', 'i', 'p', '#', '1', '(', '@', ')', ';', 'r', 'e', 't', 'u', 'r',
- 'n', ' ', 'r', 'e', 'd', 'i', 'm', 'e', 'n', 's', 'i', 'o', 'n', '#', '1', '(', 'd',
- 'c', 'm', 'p', ')', ';', '}', '}', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'N',
- 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p', 'p', 'e', 'd', '_', 'f',
- 's', 'a', 'm', 'p', '4', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l',
- 'l', 'u', 'm', 'i', 'n', 'a', ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':', 'I',
- 'N', 'T', 'E', 'N', 'S', 'I', 'T', 'Y', '#', '2', '{', 'e', 'n', 'c', 'o', 'd', 'e',
- '{', 'r', 'e', 't', 'u', 'r', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':',
- 'f', 's', 'a', 'm', 'p', '4', ':', 'e', 'n', 'c', 'o', 'd', 'e', '#', '2', '<', '1',
- '4', ',', '1', '0', '>', '(', '@', ')', ';', '}', 'd', 'e', 'c', 'o', 'd', 'e', '{',
- 'r', 'e', 't', 'u', 'r', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'f',
- 's', 'a', 'm', 'p', '4', ':', 'd', 'e', 'c', 'o', 'd', 'e', '#', '2', '(', '@', ')',
- ';', '}', '}', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'N', 'C', 'B', 'I', ':',
- 'S', 'R', 'A', ':', 's', 'w', 'a', 'p', 'p', 'e', 'd', '_', 'f', 's', 'a', 'm', 'p',
- '4', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'A', 'B', 'I', ':', 'e', 'n',
- 'c', 'o', 'd', 'i', 'n', 'g', ':', 'S', 'I', 'G', 'N', 'A', 'L', '#', '2', '{', 'e',
- 'n', 'c', 'o', 'd', 'e', '{', 'r', 'e', 't', 'u', 'r', 'n', ' ', 'N', 'C', 'B', 'I',
- ':', 'S', 'R', 'A', ':', 'f', 's', 'a', 'm', 'p', '4', ':', 'e', 'n', 'c', 'o', 'd',
- 'e', '#', '2', '<', '1', '4', ',', '1', '0', '>', '(', '@', ')', ';', '}', 'd', 'e',
- 'c', 'o', 'd', 'e', '{', 'r', 'e', 't', 'u', 'r', 'n', ' ', 'N', 'C', 'B', 'I', ':',
- 'S', 'R', 'A', ':', 'f', 's', 'a', 'm', 'p', '4', ':', 'd', 'e', 'c', 'o', 'd', 'e',
- '#', '2', '(', '@', ')', ';', '}', '}', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ',
- 'I', 'N', 'S', 'D', 'C', ':', 'p', 'o', 's', 'i', 't', 'i', 'o', 'n', ':', 'o', 'n',
- 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'o', 'n', 'T', 'o', 'r',
- 'r', 'e', 'n', 't', ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':', 'P', 'O', 'S',
- 'I', 'T', 'I', 'O', 'N', '#', '1', '{', 'e', 'n', 'c', 'o', 'd', 'e', '{', 'I', '3',
- '2', ' ', 'p', 'o', 's', '_', '1', 's', 't', '_', 'd', 'e', 'r', 'i', 'v', '=', '<',
- 'I', '3', '2', '>', 'd', 'e', 'r', 'i', 'v', '#', '1', '(', '@', ')', ';', 'r', 'e',
- 't', 'u', 'r', 'n', ' ', 'i', 'z', 'i', 'p', '#', '2', '.', '1', '(', 'p', 'o', 's',
- '_', '1', 's', 't', '_', 'd', 'e', 'r', 'i', 'v', ')', ';', '}', 'd', 'e', 'c', 'o',
- 'd', 'e', '{', 'I', '3', '2', ' ', 'p', 'o', 's', '_', '1', 's', 't', '_', 'd', 'e',
- 'r', 'i', 'v', '=', 'i', 'u', 'n', 'z', 'i', 'p', '#', '2', '.', '1', '(', '@', ')',
- ';', 'r', 'e', 't', 'u', 'r', 'n', ' ', '(', 'I', 'N', 'S', 'D', 'C', ':', 'p', 'o',
- 's', 'i', 't', 'i', 'o', 'n', ':', 'o', 'n', 'e', ')', '<', 'I', '3', '2', '>', 'i',
- 'n', 't', 'e', 'g', 'r', 'a', 'l', '#', '1', '(', 'p', 'o', 's', '_', '1', 's', 't',
- '_', 'd', 'e', 'r', 'i', 'v', ')', ';', '}', '}', 'p', 'h', 'y', 's', 'i', 'c', 'a',
- 'l', ' ', '_', '_', 'n', 'o', '_', 'h', 'e', 'a', 'd', 'e', 'r', ' ', 'U', '1', '6',
- ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_', '4', '5', '4', '_', ':', 'e',
- 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':', 'C', 'L', 'I', 'P', '#', '1', '{', 'd', 'e',
- 'c', 'o', 'd', 'e', '{', 'r', 'e', 't', 'u', 'r', 'n', ' ', 'N', 'C', 'B', 'I', ':',
- 'S', 'R', 'A', ':', 'd', 'e', 'c', 'o', 'd', 'e', ':', 'C', 'L', 'I', 'P', '#', '1',
- '(', '@', ')', ';', '}', '}', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', '_', '_',
- 'n', 'o', '_', 'h', 'e', 'a', 'd', 'e', 'r', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R',
- 'A', ':', 'p', 'o', 's', '1', '6', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':',
- '_', '4', '5', '4', '_', ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':', 'P', 'O',
- 'S', 'I', 'T', 'I', 'O', 'N', '#', '1', '{', 'd', 'e', 'c', 'o', 'd', 'e', '{', 'r',
- 'e', 't', 'u', 'r', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'd', 'e',
- 'c', 'o', 'd', 'e', ':', 'P', 'O', 'S', 'I', 'T', 'I', 'O', 'N', '#', '1', '(', '@',
- ')', ';', '}', '}', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', '_', '_', 'n', 'o',
- '_', 'h', 'e', 'a', 'd', 'e', 'r', ' ', 'I', 'N', 'S', 'D', 'C', ':', '2', 'n', 'a',
- ':', 'p', 'a', 'c', 'k', 'e', 'd', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':',
- '_', '4', '5', '4', '_', ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':', 'R', 'E',
- 'A', 'D', '#', '1', '{', 'd', 'e', 'c', 'o', 'd', 'e', '{', 'r', 'e', 't', 'u', 'r',
- 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'd', 'e', 'c', 'o', 'd', 'e',
- ':', 'R', 'E', 'A', 'D', '#', '1', '<', '1', '>', '(', '@', ')', ';', '}', '}', 'p',
- 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', '_', '_', 'n', 'o', '_', 'h', 'e', 'a', 'd',
- 'e', 'r', ' ', 'N', 'C', 'B', 'I', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'n',
- '_', 'e', 'n', 'c', 'o', 'd', 'e', 'd', ':', 'p', 'h', 'r', 'e', 'd', ' ', 'N', 'C',
- 'B', 'I', ':', 'S', 'R', 'A', ':', '_', '4', '5', '4', '_', ':', 'e', 'n', 'c', 'o',
- 'd', 'i', 'n', 'g', ':', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', '#', '1', '{', 'd', 'e',
- 'c', 'o', 'd', 'e', '{', 'r', 'e', 't', 'u', 'r', 'n', ' ', 'N', 'C', 'B', 'I', ':',
- 'S', 'R', 'A', ':', 'd', 'e', 'c', 'o', 'd', 'e', ':', 'Q', 'U', 'A', 'L', 'I', 'T',
- 'Y', '#', '1', '<', '1', '>', '(', '@', ')', ';', '}', '}', 'p', 'h', 'y', 's', 'i',
- 'c', 'a', 'l', ' ', '_', '_', 'n', 'o', '_', 'h', 'e', 'a', 'd', 'e', 'r', ' ', 'N',
- 'C', 'B', 'I', ':', 'i', 's', 'a', 'm', 'p', '1', ' ', 'N', 'C', 'B', 'I', ':', 'S',
- 'R', 'A', ':', '_', '4', '5', '4', '_', ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g',
- ':', 'S', 'I', 'G', 'N', 'A', 'L', '#', '1', '{', 'd', 'e', 'c', 'o', 'd', 'e', '{',
- 'r', 'e', 't', 'u', 'r', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'd',
- 'e', 'c', 'o', 'd', 'e', ':', 'S', 'I', 'G', 'N', 'A', 'L', '#', '1', '<', '1', '>',
- '(', '@', ')', ';', '}', '}', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', '_', '_',
- 'n', 'o', '_', 'h', 'e', 'a', 'd', 'e', 'r', ' ', 'I', 'N', 'S', 'D', 'C', ':', '2',
- 'n', 'a', ':', 'p', 'a', 'c', 'k', 'e', 'd', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R',
- 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a', ':', 'e', 'n', 'c', 'o', 'd', 'i',
- 'n', 'g', ':', 'R', 'E', 'A', 'D', '#', '1', '{', 'd', 'e', 'c', 'o', 'd', 'e', '{',
- 'r', 'e', 't', 'u', 'r', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'd',
- 'e', 'c', 'o', 'd', 'e', ':', 'R', 'E', 'A', 'D', '#', '1', '<', '2', '>', '(', '@',
- ')', ';', '}', '}', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', '_', '_', 'n', 'o',
- '_', 'h', 'e', 'a', 'd', 'e', 'r', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':',
- 'r', 'o', 't', 'a', 't', 'e', 'd', '_', 'q', 'u', 'a', 'l', '4', ' ', 'N', 'C', 'B',
- 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a', ':', 'e', 'n',
- 'c', 'o', 'd', 'i', 'n', 'g', ':', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', '#', '1', '{',
- 'd', 'e', 'c', 'o', 'd', 'e', '{', 'r', 'e', 't', 'u', 'r', 'n', ' ', 'N', 'C', 'B',
- 'I', ':', 'S', 'R', 'A', ':', 'd', 'e', 'c', 'o', 'd', 'e', ':', 'Q', 'U', 'A', 'L',
- 'I', 'T', 'Y', '#', '1', '<', '2', '>', '(', '@', ')', ';', '}', '}', 'p', 'h', 'y',
- 's', 'i', 'c', 'a', 'l', ' ', '_', '_', 'n', 'o', '_', 'h', 'e', 'a', 'd', 'e', 'r',
- ' ', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'p', 'h',
- 'r', 'e', 'd', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l', 'u',
- 'm', 'i', 'n', 'a', ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':', 'Q', 'U', 'A',
- 'L', 'I', 'T', 'Y', '2', '#', '1', '{', 'd', 'e', 'c', 'o', 'd', 'e', '{', 'r', 'e',
- 't', 'u', 'r', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'd', 'e', 'c',
- 'o', 'd', 'e', ':', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', '#', '1', '<', '2', '>', '(',
- '@', ')', ';', '}', '}', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', '_', '_', 'n',
- 'o', '_', 'h', 'e', 'a', 'd', 'e', 'r', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A',
- ':', 'r', 'o', 't', 'a', 't', 'e', 'd', '_', 'f', 's', 'a', 'm', 'p', '4', ' ', 'N',
- 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a', ':',
- 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':', 'S', 'I', 'G', 'N', 'A', 'L', '#', '1',
- '{', 'd', 'e', 'c', 'o', 'd', 'e', '{', 'r', 'e', 't', 'u', 'r', 'n', ' ', 'N', 'C',
- 'B', 'I', ':', 'S', 'R', 'A', ':', 'd', 'e', 'c', 'o', 'd', 'e', ':', 'S', 'I', 'G',
- 'N', 'A', 'L', '#', '1', '<', '2', '>', '(', '@', ')', ';', '}', '}', 'p', 'h', 'y',
- 's', 'i', 'c', 'a', 'l', ' ', '_', '_', 'n', 'o', '_', 'h', 'e', 'a', 'd', 'e', 'r',
- ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'r', 'o', 't', 'a', 't', 'e', 'd',
- '_', 'f', 's', 'a', 'm', 'p', '4', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':',
- 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a', ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g',
- ':', 'I', 'N', 'T', 'E', 'N', 'S', 'I', 'T', 'Y', '#', '1', '{', 'd', 'e', 'c', 'o',
- 'd', 'e', '{', 'r', 'e', 't', 'u', 'r', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R',
- 'A', ':', 'd', 'e', 'c', 'o', 'd', 'e', ':', 'I', 'N', 'T', 'E', 'N', 'S', 'I', 'T',
- 'Y', '#', '1', '(', '@', ')', ';', '}', '}', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l',
- ' ', '_', '_', 'n', 'o', '_', 'h', 'e', 'a', 'd', 'e', 'r', ' ', 'N', 'C', 'B', 'I',
- ':', 'f', 's', 'a', 'm', 'p', '4', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':',
- 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a', ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g',
- ':', 'N', 'O', 'I', 'S', 'E', '#', '1', '{', 'd', 'e', 'c', 'o', 'd', 'e', '{', 'r',
- 'e', 't', 'u', 'r', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'd', 'e',
- 'c', 'o', 'd', 'e', ':', 'N', 'O', 'I', 'S', 'E', '#', '1', '(', '@', ')', ';', '}',
- '}', 't', 'a', 'b', 'l', 'e', ' ', 'I', 'N', 'S', 'D', 'C', ':', 't', 'b', 'l', ':',
- 's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', '#', '1', '.', '0', '.', '1', '{', 'd', 'e',
- 'f', 'a', 'u', 'l', 't', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D',
- 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ' ', 'R', 'E', 'A', 'D', '{', 'r',
- 'e', 'a', 'd', '=', 'o', 'u', 't', '_', 'd', 'n', 'a', '_', 't', 'e', 'x', 't', ';',
- 'v', 'a', 'l', 'i', 'd', 'a', 't', 'e', '=', '<', 'I', 'N', 'S', 'D', 'C', ':', 'd',
- 'n', 'a', ':', 't', 'e', 'x', 't', '>', 'c', 'o', 'm', 'p', 'a', 'r', 'e', '#', '1',
- '(', 'i', 'n', '_', 'd', 'n', 'a', '_', 't', 'e', 'x', 't', ',', 'o', 'u', 't', '_',
- 'd', 'n', 'a', '_', 't', 'e', 'x', 't', ')', ';', '}', 'c', 'o', 'l', 'u', 'm', 'n',
- ' ', 'I', 'N', 'S', 'D', 'C', ':', '4', 'n', 'a', ':', 'b', 'i', 'n', ' ', 'R', 'E',
- 'A', 'D', ' ', '=', ' ', 'o', 'u', 't', '_', '4', 'n', 'a', '_', 'b', 'i', 'n', ';',
- 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', '4', 'n', 'a', ':',
- 'p', 'a', 'c', 'k', 'e', 'd', ' ', 'R', 'E', 'A', 'D', ' ', '=', ' ', 'o', 'u', 't',
- '_', '4', 'n', 'a', '_', 'p', 'a', 'c', 'k', 'e', 'd', ';', 'c', 'o', 'l', 'u', 'm',
- 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'n', 'a', ':', 'b', 'i', 'n', ' ',
- 'R', 'E', 'A', 'D', ' ', '=', ' ', 'o', 'u', 't', '_', 'x', '2', 'n', 'a', '_', 'b',
- 'i', 'n', ';', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', '2',
- 'n', 'a', ':', 'b', 'i', 'n', ' ', 'R', 'E', 'A', 'D', ' ', '=', ' ', 'o', 'u', 't',
- '_', '2', 'n', 'a', '_', 'b', 'i', 'n', ';', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I',
- 'N', 'S', 'D', 'C', ':', '2', 'n', 'a', ':', 'p', 'a', 'c', 'k', 'e', 'd', ' ', 'R',
- 'E', 'A', 'D', ' ', '=', ' ', 'o', 'u', 't', '_', '2', 'n', 'a', '_', 'p', 'a', 'c',
- 'k', 'e', 'd', ';', 'd', 'e', 'f', 'a', 'u', 'l', 't', ' ', 'c', 'o', 'l', 'u', 'm',
- 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'l', 'o', 'r', ':', 't', 'e', 'x',
- 't', ' ', 'C', 'S', 'R', 'E', 'A', 'D', '{', 'r', 'e', 'a', 'd', '=', 'o', 'u', 't',
- '_', 'c', 'o', 'l', 'o', 'r', '_', 't', 'e', 'x', 't', ';', 'v', 'a', 'l', 'i', 'd',
- 'a', 't', 'e', '=', '<', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'l', 'o', 'r', ':',
- 't', 'e', 'x', 't', '>', 'c', 'o', 'm', 'p', 'a', 'r', 'e', '#', '1', '(', 'i', 'n',
- '_', 'c', 'o', 'l', 'o', 'r', '_', 't', 'e', 'x', 't', ',', 'o', 'u', 't', '_', 'c',
- 'o', 'l', 'o', 'r', '_', 't', 'e', 'x', 't', ')', ';', '}', 'c', 'o', 'l', 'u', 'm',
- 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'c', 's', ':', 'b', 'i', 'n', ' ',
- 'C', 'S', 'R', 'E', 'A', 'D', ' ', '=', ' ', 'o', 'u', 't', '_', 'x', '2', 'c', 's',
- '_', 'b', 'i', 'n', ';', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C',
- ':', '2', 'c', 's', ':', 'b', 'i', 'n', ' ', 'C', 'S', 'R', 'E', 'A', 'D', ' ', '=',
- ' ', 'o', 'u', 't', '_', '2', 'c', 's', '_', 'b', 'i', 'n', ';', 'c', 'o', 'l', 'u',
- 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', '2', 'c', 's', ':', 'p', 'a', 'c', 'k',
- 'e', 'd', ' ', 'C', 'S', 'R', 'E', 'A', 'D', ' ', '=', ' ', 'o', 'u', 't', '_', '2',
- 'c', 's', '_', 'p', 'a', 'c', 'k', 'e', 'd', ';', 'r', 'e', 'a', 'd', 'o', 'n', 'l',
- 'y', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'b', 'o', 'o', 'l', ' ', 'C', 'S', '_',
- 'N', 'A', 'T', 'I', 'V', 'E', ' ', '=', ' ', 'c', 's', '_', 'n', 'a', 't', 'i', 'v',
- 'e', ';', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n',
- 'a', ':', 't', 'e', 'x', 't', ' ', 'C', 'S', '_', 'K', 'E', 'Y', '{', 'r', 'e', 'a',
- 'd', '=', 'o', 'u', 't', '_', 'c', 's', '_', 'k', 'e', 'y', ';', 'v', 'a', 'l', 'i',
- 'd', 'a', 't', 'e', '=', '<', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't',
- 'e', 'x', 't', '>', 'c', 'o', 'm', 'p', 'a', 'r', 'e', '#', '1', '(', 'i', 'n', '_',
- 'c', 's', '_', 'k', 'e', 'y', ',', 'o', 'u', 't', '_', 'c', 's', '_', 'k', 'e', 'y',
- ')', ';', '}', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'U', '8', ' ', 'C', 'O', 'L', 'O',
- 'R', '_', 'M', 'A', 'T', 'R', 'I', 'X', ' ', '=', ' ', 'o', 'u', 't', '_', 'c', 'o',
- 'l', 'o', 'r', '_', 'm', 'a', 't', 'r', 'i', 'x', ';', 'd', 'e', 'f', 'a', 'u', 'l',
- 't', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u',
- 'a', 'l', 'i', 't', 'y', ':', 'p', 'h', 'r', 'e', 'd', ' ', 'Q', 'U', 'A', 'L', 'I',
- 'T', 'Y', ' ', '=', ' ', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '_', 'p', 'h', 'r',
- 'e', 'd', ';', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'q',
- 'u', 'a', 'l', 'i', 't', 'y', ':', 't', 'e', 'x', 't', ':', 'p', 'h', 'r', 'e', 'd',
- '_', '3', '3', ' ', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', ' ', '=', ' ', 'o', 'u', 't',
- '_', 'q', 'u', 'a', 'l', '_', 't', 'e', 'x', 't', '_', 'p', 'h', 'r', 'e', 'd', '_',
- '3', '3', '|', '(', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y',
- ':', 't', 'e', 'x', 't', ':', 'p', 'h', 'r', 'e', 'd', '_', '3', '3', ')', '<', 'B',
- '8', '>', 's', 'u', 'm', '#', '1', '<', '3', '3', '>', '(', 'o', 'u', 't', '_', 'q',
- 'u', 'a', 'l', '_', 'p', 'h', 'r', 'e', 'd', ')', ';', 'c', 'o', 'l', 'u', 'm', 'n',
- ' ', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 't', 'e',
- 'x', 't', ':', 'p', 'h', 'r', 'e', 'd', '_', '6', '4', ' ', 'Q', 'U', 'A', 'L', 'I',
- 'T', 'Y', ' ', '=', ' ', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '_', 't', 'e', 'x',
- 't', '_', 'p', 'h', 'r', 'e', 'd', '_', '6', '4', '|', '(', 'I', 'N', 'S', 'D', 'C',
- ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 't', 'e', 'x', 't', ':', 'p', 'h', 'r',
- 'e', 'd', '_', '6', '4', ')', '<', 'B', '8', '>', 's', 'u', 'm', '#', '1', '<', '6',
- '4', '>', '(', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '_', 'p', 'h', 'r', 'e', 'd',
- ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l', 'e', 'n',
- ' ', 's', 'i', 'g', 'n', 'a', 'l', '_', 'l', 'e', 'n', '=', '(', 'I', 'N', 'S', 'D',
- 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l', 'e', 'n', ')', 'r', 'o', 'w', '_', 'l',
- 'e', 'n', '#', '1', '(', 'o', 'u', 't', '_', 's', 'i', 'g', 'n', 'a', 'l', ')', '|',
- '<', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l', 'e', 'n', '>',
- 'e', 'c', 'h', 'o', '#', '1', '<', '0', '>', '(', ')', ';', '}', 't', 'a', 'b', 'l',
- 'e', ' ', 'I', 'N', 'S', 'D', 'C', ':', 't', 'b', 'l', ':', 'p', 'r', 'o', 't', 'e',
- 'i', 'n', '#', '1', '{', 'd', 'e', 'f', 'a', 'u', 'l', 't', ' ', 'c', 'o', 'l', 'u',
- 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'p', 'r', 'o', 't', 'e', 'i', 'n', ':',
- 't', 'e', 'x', 't', ' ', 'P', 'R', 'O', 'T', 'E', 'I', 'N', '{', 'r', 'e', 'a', 'd',
- '=', 'o', 'u', 't', '_', 'p', 'r', 'o', 't', 'e', 'i', 'n', '_', 't', 'e', 'x', 't',
- ';', 'v', 'a', 'l', 'i', 'd', 'a', 't', 'e', '=', '<', 'I', 'N', 'S', 'D', 'C', ':',
- 'p', 'r', 'o', 't', 'e', 'i', 'n', ':', 't', 'e', 'x', 't', '>', 'c', 'o', 'm', 'p',
- 'a', 'r', 'e', '#', '1', '(', 'i', 'n', '_', 'p', 'r', 'o', 't', 'e', 'i', 'n', '_',
- 't', 'e', 'x', 't', ',', 'o', 'u', 't', '_', 'p', 'r', 'o', 't', 'e', 'i', 'n', '_',
- 't', 'e', 'x', 't', ')', ';', '}', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S',
- 'D', 'C', ':', 'a', 'a', ':', 'b', 'i', 'n', ' ', 'P', 'R', 'O', 'T', 'E', 'I', 'N',
- ' ', '=', ' ', 'o', 'u', 't', '_', 'a', 'a', '_', 'b', 'i', 'n', ';', '}', 't', 'a',
- 'b', 'l', 'e', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 't', 'b', 'l',
- ':', 's', 'p', 'o', 't', 'c', 'o', 'o', 'r', 'd', '#', '1', '{', 'd', 'e', 'f', 'a',
- 'u', 'l', 't', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':',
- 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', ' ', 'X', ' ', '=', ' ', 'o', 'u', 't',
- '_', 'x', '_', 'c', 'o', 'o', 'r', 'd', ';', 'd', 'e', 'f', 'a', 'u', 'l', 't', ' ',
- 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r',
- 'd', ':', 'v', 'a', 'l', ' ', 'Y', ' ', '=', ' ', 'o', 'u', 't', '_', 'y', '_', 'c',
- 'o', 'o', 'r', 'd', ';', 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o', 'l',
- 'u', 'm', 'n', ' ', 'U', '1', '6', ' ', 'X', ' ', '=', ' ', 'c', 'a', 's', 't', '#',
- '1', '(', 'x', '_', 'c', 'l', 'i', 'p', '_', 'U', '1', '6', ')', ';', 'r', 'e', 'a',
- 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'U', '1', '6', ' ',
- 'Y', ' ', '=', ' ', 'c', 'a', 's', 't', '#', '1', '(', 'y', '_', 'c', 'l', 'i', 'p',
- '_', 'U', '1', '6', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd',
- ':', 'v', 'a', 'l', ' ', 'x', '_', 'c', 'l', 'i', 'p', '_', 'U', '1', '6', '=', '<',
- 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', '>', 'c',
- 'l', 'i', 'p', '#', '1', '<', '0', ',', '6', '5', '5', '3', '5', '>', '(', 'o', 'u',
- 't', '_', 'x', '_', 'c', 'o', 'o', 'r', 'd', ')', ';', 'I', 'N', 'S', 'D', 'C', ':',
- 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', ' ', 'y', '_', 'c', 'l', 'i', 'p', '_',
- 'U', '1', '6', '=', '<', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':',
- 'v', 'a', 'l', '>', 'c', 'l', 'i', 'p', '#', '1', '<', '0', ',', '6', '5', '5', '3',
- '5', '>', '(', 'o', 'u', 't', '_', 'y', '_', 'c', 'o', 'o', 'r', 'd', ')', ';', '}',
- 't', 'a', 'b', 'l', 'e', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 't',
- 'b', 'l', ':', 's', 'p', 'o', 't', 'n', 'a', 'm', 'e', '#', '1', '.', '0', '.', '1',
- '=', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'p',
- 'o', 't', 'c', 'o', 'o', 'r', 'd', '#', '1', '{', 'c', 'o', 'l', 'u', 'm', 'n', ' ',
- 'a', 's', 'c', 'i', 'i', ' ', 'N', 'A', 'M', 'E', ' ', '=', ' ', '_', 'o', 'u', 't',
- '_', 'n', 'a', 'm', 'e', ';', 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o',
- 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 's', 'p',
- 'o', 't', '_', 'i', 'd', 's', '_', 'f', 'o', 'u', 'n', 'd', ' ', 'S', 'P', 'O', 'T',
- '_', 'I', 'D', 'S', '_', 'F', 'O', 'U', 'N', 'D', ' ', '=', ' ', 's', 'p', 'o', 't',
- '_', 'i', 'd', 's', '_', 'f', 'o', 'u', 'n', 'd', ';', 'a', 's', 'c', 'i', 'i', ' ',
- '_', 'o', 'u', 't', '_', 'n', 'a', 'm', 'e', '=', 'I', 'N', 'S', 'D', 'C', ':', 'S',
- 'R', 'A', ':', 'f', 'o', 'r', 'm', 'a', 't', '_', 's', 'p', 'o', 't', '_', 'n', 'a',
- 'm', 'e', '#', '1', '(', 'o', 'u', 't', '_', 'n', 'a', 'm', 'e', '_', 'f', 'm', 't',
- ',', 'o', 'u', 't', '_', 'x', '_', 'c', 'o', 'o', 'r', 'd', ',', 'o', 'u', 't', '_',
- 'y', '_', 'c', 'o', 'o', 'r', 'd', ',', 'o', 'u', 't', '_', 's', 'p', 'o', 't', '_',
- 'n', 'a', 'm', 'e', ')', '|', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'f',
- 'o', 'r', 'm', 'a', 't', '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '#', '1',
- '(', 'o', 'u', 't', '_', 'n', 'a', 'm', 'e', '_', 'f', 'm', 't', ',', 'o', 'u', 't',
- '_', 'x', '_', 'c', 'o', 'o', 'r', 'd', ',', 'o', 'u', 't', '_', 'y', '_', 'c', 'o',
- 'o', 'r', 'd', ')', '|', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'f', 'o',
- 'r', 'm', 'a', 't', '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '_', 'n', 'o',
- '_', 'c', 'o', 'o', 'r', 'd', '#', '1', '(', 'o', 'u', 't', '_', 'n', 'a', 'm', 'e',
- '_', 'f', 'm', 't', ')', '|', 'o', 'u', 't', '_', 's', 'p', 'o', 't', '_', 'n', 'a',
- 'm', 'e', ';', '}', 't', 'a', 'b', 'l', 'e', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S',
- 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'p', 'o', 't', 'd', 'e', 's', 'c', '#', '1',
- '.', '0', '.', '2', '=', 'I', 'N', 'S', 'D', 'C', ':', 't', 'b', 'l', ':', 's', 'e',
- 'q', 'u', 'e', 'n', 'c', 'e', '#', '1', '.', '0', '.', '1', '{', 'c', 'o', 'l', 'u',
- 'm', 'n', ' ', 'U', '8', ' ', 'N', 'R', 'E', 'A', 'D', 'S', ' ', '=', ' ', 'o', 'u',
- 't', '_', 'n', 'r', 'e', 'a', 'd', 's', ';', 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y',
- ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o',
- 'r', 'd', ':', 'l', 'e', 'n', ' ', 'S', 'P', 'O', 'T', '_', 'L', 'E', 'N', ' ', '=',
- ' ', 's', 'p', 'o', 't', '_', 'l', 'e', 'n', ';', 'r', 'e', 'a', 'd', 'o', 'n', 'l',
- 'y', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o',
- 'o', 'r', 'd', ':', 'l', 'e', 'n', ' ', 'F', 'I', 'X', 'E', 'D', '_', 'S', 'P', 'O',
- 'T', '_', 'L', 'E', 'N', ' ', '=', ' ', 'f', 'i', 'x', 'e', 'd', '_', 's', 'p', 'o',
- 't', '_', 'l', 'e', 'n', ';', 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o',
- 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':',
- 'z', 'e', 'r', 'o', ' ', 'T', 'R', 'I', 'M', '_', 'S', 'T', 'A', 'R', 'T', ' ', '=',
- ' ', 't', 'r', 'i', 'm', '_', 's', 't', 'a', 'r', 't', '|', '<', 'I', 'N', 'S', 'D',
- 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o', '>', 'e', 'c', 'h', 'o',
- '#', '1', '<', '0', '>', '(', ')', ';', 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y', ' ',
- 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r',
- 'd', ':', 'o', 'n', 'e', ' ', 'T', 'R', 'I', 'M', '_', 'S', 'T', 'A', 'R', 'T', ' ',
- '=', ' ', '(', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'o', 'n',
- 'e', ')', '<', 'I', '3', '2', '>', 's', 'u', 'm', '#', '1', '<', '1', '>', '(', 't',
- 'r', 'i', 'm', '_', 's', 't', 'a', 'r', 't', ')', '|', '<', 'I', 'N', 'S', 'D', 'C',
- ':', 'c', 'o', 'o', 'r', 'd', ':', 'o', 'n', 'e', '>', 'e', 'c', 'h', 'o', '#', '1',
- '<', '1', '>', '(', ')', ';', 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o',
- 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':',
- 'l', 'e', 'n', ' ', 'T', 'R', 'I', 'M', '_', 'L', 'E', 'N', ' ', '=', ' ', 't', 'r',
- 'i', 'm', '_', 'l', 'e', 'n', '|', 's', 'p', 'o', 't', '_', 'l', 'e', 'n', ';', 'c',
- 'o', 'l', 'u', 'm', 'n', ' ', 'a', 's', 'c', 'i', 'i', ' ', 'L', 'A', 'B', 'E', 'L',
- ' ', '=', ' ', 'o', 'u', 't', '_', 'l', 'a', 'b', 'e', 'l', ';', 'c', 'o', 'l', 'u',
- 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e',
- 'r', 'o', ' ', 'L', 'A', 'B', 'E', 'L', '_', 'S', 'T', 'A', 'R', 'T', ' ', '=', ' ',
- 'o', 'u', 't', '_', 'l', 'a', 'b', 'e', 'l', '_', 's', 't', 'a', 'r', 't', ';', 'c',
- 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd',
- ':', 'l', 'e', 'n', ' ', 'L', 'A', 'B', 'E', 'L', '_', 'L', 'E', 'N', ' ', '=', ' ',
- 'o', 'u', 't', '_', 'l', 'a', 'b', 'e', 'l', '_', 'l', 'e', 'n', ';', 'r', 'e', 'a',
- 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'U', '1', '6', ' ',
- 'L', 'A', 'B', 'E', 'L', '_', 'S', 'T', 'A', 'R', 'T', ' ', '=', ' ', 'c', 'a', 's',
- 't', '#', '1', '(', 'o', 'u', 't', '_', 'l', 'a', 'b', 'e', 'l', '_', 's', 't', 'a',
- 'r', 't', ')', ';', 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o', 'l', 'u',
- 'm', 'n', ' ', 'U', '1', '6', ' ', 'L', 'A', 'B', 'E', 'L', '_', 'L', 'E', 'N', ' ',
- '=', ' ', 'c', 'a', 's', 't', '#', '1', '(', 'o', 'u', 't', '_', 'l', 'a', 'b', 'e',
- 'l', '_', 'l', 'e', 'n', ')', ';', 'd', 'e', 'f', 'a', 'u', 'l', 't', ' ', 'c', 'o',
- 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'x', 'r',
- 'e', 'a', 'd', '_', 't', 'y', 'p', 'e', ' ', 'R', 'E', 'A', 'D', '_', 'T', 'Y', 'P',
- 'E', ' ', '=', ' ', 'o', 'u', 't', '_', 'r', 'e', 'a', 'd', '_', 't', 'y', 'p', 'e',
- ';', 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ',
- 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'r', 'e', 'a', 'd', '_', 't', 'y',
- 'p', 'e', ' ', 'R', 'E', 'A', 'D', '_', 'T', 'Y', 'P', 'E', ' ', '=', ' ', 'o', 'u',
- 't', '_', 'r', 'e', 'a', 'd', '_', 't', 'y', 'p', 'e', '|', '<', 'I', 'N', 'S', 'D',
- 'C', ':', 'S', 'R', 'A', ':', 'x', 'r', 'e', 'a', 'd', '_', 't', 'y', 'p', 'e', ',',
- 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'r', 'e', 'a', 'd', '_', 't', 'y',
- 'p', 'e', '>', 'm', 'a', 'p', '#', '1', '<', '[', '0', ',', '1', ',', '2', ',', '3',
- ',', '4', ',', '5', ',', '6', ',', '7', ']', ',', '[', '0', ',', '1', ',', '0', ',',
- '1', ',', '0', ',', '1', ',', '0', ',', '1', ']', '>', '(', 'o', 'u', 't', '_', 'r',
- 'e', 'a', 'd', '_', 't', 'y', 'p', 'e', ')', ';', 'd', 'e', 'f', 'a', 'u', 'l', 't',
- ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o',
- 'r', 'd', ':', 'z', 'e', 'r', 'o', ' ', 'R', 'E', 'A', 'D', '_', 'S', 'T', 'A', 'R',
- 'T', ' ', '=', ' ', 'o', 'u', 't', '_', 'r', 'e', 'a', 'd', '_', 's', 't', 'a', 'r',
- 't', ';', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o',
- 'o', 'r', 'd', ':', 'o', 'n', 'e', ' ', 'R', 'E', 'A', 'D', '_', 'S', 'T', 'A', 'R',
- 'T', ' ', '=', ' ', '(', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':',
- 'o', 'n', 'e', ')', '<', 'I', '3', '2', '>', 's', 'u', 'm', '#', '1', '<', '1', '>',
- '(', 'o', 'u', 't', '_', 'r', 'e', 'a', 'd', '_', 's', 't', 'a', 'r', 't', ')', ';',
- 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r',
- 'd', ':', 'l', 'e', 'n', ' ', 'R', 'E', 'A', 'D', '_', 'L', 'E', 'N', ' ', '=', ' ',
- 'o', 'u', 't', '_', 'r', 'e', 'a', 'd', '_', 'l', 'e', 'n', ';', 'r', 'e', 'a', 'd',
- 'o', 'n', 'l', 'y', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'U', '1', '6', ' ', 'R',
- 'E', 'A', 'D', '_', 'S', 'T', 'A', 'R', 'T', ' ', '=', ' ', 'c', 'a', 's', 't', '#',
- '1', '(', 'o', 'u', 't', '_', 'r', 'e', 'a', 'd', '_', 's', 't', 'a', 'r', 't', ')',
- ';', 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ',
- 'U', '1', '6', ' ', 'R', 'E', 'A', 'D', '_', 'L', 'E', 'N', ' ', '=', ' ', 'c', 'a',
- 's', 't', '#', '1', '(', 'o', 'u', 't', '_', 'r', 'e', 'a', 'd', '_', 'l', 'e', 'n',
- ')', ';', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R',
- 'A', ':', 'r', 'e', 'a', 'd', '_', 'f', 'i', 'l', 't', 'e', 'r', ' ', 'R', 'E', 'A',
- 'D', '_', 'F', 'I', 'L', 'T', 'E', 'R', ' ', '=', ' ', 'o', 'u', 't', '_', 'r', 'd',
- '_', 'f', 'i', 'l', 't', 'e', 'r', '|', '<', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R',
- 'A', ':', 'r', 'e', 'a', 'd', '_', 'f', 'i', 'l', 't', 'e', 'r', '>', 'e', 'c', 'h',
- 'o', '#', '1', '<', '0', '>', '(', 'o', 'u', 't', '_', 'r', 'e', 'a', 'd', '_', 's',
- 't', 'a', 'r', 't', ')', ';', 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o',
- 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'r', 'e',
- 'a', 'd', '_', 'f', 'i', 'l', 't', 'e', 'r', ' ', 'R', 'D', '_', 'F', 'I', 'L', 'T',
- 'E', 'R', ' ', '=', ' ', 'o', 'u', 't', '_', 'r', 'd', '_', 'f', 'i', 'l', 't', 'e',
- 'r', ';', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'x', 'r', 'e', 'a', 'd',
- '_', 't', 'y', 'p', 'e', ' ', 'i', 'n', '_', 'r', 'e', 'a', 'd', '_', 't', 'y', 'p',
- 'e', '=', 'R', 'E', 'A', 'D', '_', 'T', 'Y', 'P', 'E', '|', '_', 'a', 'l', 't', '_',
- 'i', 'n', '_', 'r', 'e', 'a', 'd', '_', 't', 'y', 'p', 'e', ';', 'I', 'N', 'S', 'D',
- 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l', 'e', 'n', ' ', 'i', 'n', '_', 'r', 'e',
- 'a', 'd', '_', 'l', 'e', 'n', '=', 'R', 'E', 'A', 'D', '_', 'L', 'E', 'N', '|', '_',
- 'a', 'l', 't', '_', 'i', 'n', '_', 'r', 'e', 'a', 'd', '_', 'l', 'e', 'n', ';', 'I',
- 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l', 'e', 'n', ' ', 's', 'p',
- 'o', 't', '_', 'l', 'e', 'n', '=', 'b', 'a', 's', 'e', '_', 's', 'p', 'a', 'c', 'e',
- '_', 's', 'p', 'o', 't', '_', 'l', 'e', 'n', '|', 'c', 'o', 'l', 'o', 'r', '_', 's',
- 'p', 'a', 'c', 'e', '_', 's', 'p', 'o', 't', '_', 'l', 'e', 'n', '|', 'a', 'l', 'i',
- 'g', 'n', '_', 's', 'p', 'o', 't', '_', 'l', 'e', 'n', ';', 'I', 'N', 'S', 'D', 'C',
- ':', 'c', 'o', 'o', 'r', 'd', ':', 'l', 'e', 'n', ' ', 'f', 'i', 'x', 'e', 'd', '_',
- 's', 'p', 'o', 't', '_', 'l', 'e', 'n', '=', 's', 't', 'a', 't', 'i', 'c', '_', 'f',
- 'i', 'x', 'e', 'd', '_', 's', 'p', 'o', 't', '_', 'l', 'e', 'n', '|', 'b', 'a', 's',
- 'e', '_', 's', 'p', 'a', 'c', 'e', '_', 'f', 'i', 'x', 'e', 'd', '_', 's', 'p', 'o',
- 't', '_', 'l', 'e', 'n', '|', 'c', 'o', 'l', 'o', 'r', '_', 's', 'p', 'a', 'c', 'e',
- '_', 'f', 'i', 'x', 'e', 'd', '_', 's', 'p', 'o', 't', '_', 'l', 'e', 'n', ';', '}',
- 't', 'a', 'b', 'l', 'e', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 't',
- 'b', 'l', ':', 's', 't', 'a', 't', 's', '#', '1', '.', '1', '{', 'r', 'e', 'a', 'd',
- 'o', 'n', 'l', 'y', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C',
- ':', 'S', 'R', 'A', ':', 's', 'p', 'o', 't', 'i', 'd', '_', 't', ' ', 'M', 'I', 'N',
- '_', 'S', 'P', 'O', 'T', '_', 'I', 'D', ' ', '=', ' ', 'm', 'i', 'n', '_', 's', 'p',
- 'o', 't', '_', 'i', 'd', '|', '<', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':',
- 's', 'p', 'o', 't', 'i', 'd', '_', 't', '>', 'e', 'c', 'h', 'o', '#', '1', '<', '1',
- '>', '(', ')', ';', 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o', 'l', 'u',
- 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 's', 'p', 'o', 't',
- 'i', 'd', '_', 't', ' ', 'M', 'A', 'X', '_', 'S', 'P', 'O', 'T', '_', 'I', 'D', ' ',
- '=', ' ', 'm', 'a', 'x', '_', 's', 'p', 'o', 't', '_', 'i', 'd', '|', 'c', 'a', 's',
- 't', '#', '1', '(', 's', 'p', 'o', 't', '_', 'c', 'o', 'u', 'n', 't', ')', ';', 'r',
- 'e', 'a', 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'U', '6',
- '4', ' ', 'S', 'P', 'O', 'T', '_', 'C', 'O', 'U', 'N', 'T', ' ', '=', ' ', 's', 'p',
- 'o', 't', '_', 'c', 'o', 'u', 'n', 't', ';', 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y',
- ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'U', '6', '4', ' ', 'B', 'A', 'S', 'E', '_',
- 'C', 'O', 'U', 'N', 'T', ' ', '=', ' ', 'b', 'a', 's', 'e', '_', 'c', 'o', 'u', 'n',
- 't', ';', 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o', 'l', 'u', 'm', 'n',
- ' ', 'U', '6', '4', ' ', 'B', 'I', 'O', '_', 'B', 'A', 'S', 'E', '_', 'C', 'O', 'U',
- 'N', 'T', ' ', '=', ' ', 'b', 'i', 'o', '_', 'b', 'a', 's', 'e', '_', 'c', 'o', 'u',
- 'n', 't', ';', 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o', 'l', 'u', 'm',
- 'n', ' ', 'U', '6', '4', ' ', 'C', 'M', 'P', '_', 'B', 'A', 'S', 'E', '_', 'C', 'O',
- 'U', 'N', 'T', ' ', '=', ' ', 'c', 'm', 'p', '_', 'b', 'a', 's', 'e', '_', 'c', 'o',
- 'u', 'n', 't', '|', 'b', 'a', 's', 'e', '_', 'c', 'o', 'u', 'n', 't', ';', 'U', '8',
- ' ', 's', 't', 'a', 't', 's', '_', 'd', 'u', 'm', 'm', 'y', '=', 'i', 'n', '_', 's',
- 't', 'a', 't', 's', '_', 'b', 'i', 'n', ';', '}', 't', 'a', 'b', 'l', 'e', ' ', 'I',
- 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'r', 'a', '#',
- '1', '.', '0', '.', '3', '=', 'I', 'N', 'S', 'D', 'C', ':', 't', 'b', 'l', ':', 's',
- 'e', 'q', 'u', 'e', 'n', 'c', 'e', '#', '1', '.', '0', '.', '1', ',', 'I', 'N', 'S',
- 'D', 'C', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'p', 'o', 't', 'n', 'a',
- 'm', 'e', '#', '1', '.', '0', '.', '1', ',', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R',
- 'A', ':', 't', 'b', 'l', ':', 's', 'p', 'o', 't', 'd', 'e', 's', 'c', '#', '1', '.',
- '0', '.', '2', ',', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 't', 'b', 'l',
- ':', 's', 't', 'a', 't', 's', '#', '1', '.', '1', '{', 'c', 'o', 'l', 'u', 'm', 'n',
- ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'p', 'l', 'a', 't', 'f', 'o',
- 'r', 'm', '_', 'i', 'd', ' ', 'P', 'L', 'A', 'T', 'F', 'O', 'R', 'M', ' ', '=', ' ',
- '.', 'P', 'L', 'A', 'T', 'F', 'O', 'R', 'M', '|', 'o', 'u', 't', '_', 'p', 'l', 'a',
- 't', 'f', 'o', 'r', 'm', ';', 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o',
- 'l', 'u', 'm', 'n', ' ', 'a', 's', 'c', 'i', 'i', ' ', 'P', 'L', 'A', 'T', 'F', 'O',
- 'R', 'M', ' ', '=', ' ', 'p', 'l', 'a', 't', 'f', 'o', 'r', 'm', '_', 'n', 'a', 'm',
- 'e', ';', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R',
- 'A', ':', 's', 'p', 'o', 't', 'i', 'd', '_', 't', ' ', 'S', 'P', 'O', 'T', '_', 'I',
- 'D', ' ', '=', ' ', '<', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 's', 'p',
- 'o', 't', 'i', 'd', '_', 't', '>', 'a', 'd', 'd', '_', 'r', 'o', 'w', '_', 'i', 'd',
- '#', '1', '(', '.', 'S', 'P', 'O', 'T', '_', 'I', 'D', ')', '|', 'c', 'a', 's', 't',
- '#', '1', '(', 'r', 'o', 'w', 'i', 'd', '_', '6', '4', ')', ';', 'c', 'o', 'l', 'u',
- 'm', 'n', ' ', 'a', 's', 'c', 'i', 'i', ' ', 'S', 'P', 'O', 'T', '_', 'G', 'R', 'O',
- 'U', 'P', ' ', '=', ' ', 'o', 'u', 't', '_', 's', 'p', 'o', 't', '_', 'g', 'r', 'o',
- 'u', 'p', '|', '.', 'S', 'P', 'O', 'T', '_', 'G', 'R', 'O', 'U', 'P', '|', '<', 'a',
- 's', 'c', 'i', 'i', '>', 'e', 'c', 'h', 'o', '#', '1', '<', '\'', '\'', '>', '(',
- ')', ';', 'I', '6', '4', ' ', 'r', 'o', 'w', 'i', 'd', '_', '6', '4', '=', 'r', 'o',
- 'w', '_', 'i', 'd', '#', '1', '(', ')', ';', 'a', 's', 'c', 'i', 'i', ' ', 'i', 'n',
- '_', 's', 'p', 'o', 't', '_', 'g', 'r', 'o', 'u', 'p', '=', 'S', 'P', 'O', 'T', '_',
- 'G', 'R', 'O', 'U', 'P', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o',
- 'l', 'u', 'm', 'n', ' ', '<', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'p',
- 'l', 'a', 't', 'f', 'o', 'r', 'm', '_', 'i', 'd', '>', 'z', 'i', 'p', '_', 'e', 'n',
- 'c', 'o', 'd', 'i', 'n', 'g', '#', '1', ' ', '.', 'P', 'L', 'A', 'T', 'F', 'O', 'R',
- 'M', '=', 'P', 'L', 'A', 'T', 'F', 'O', 'R', 'M', ';', 'p', 'h', 'y', 's', 'i', 'c',
- 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', '<', 'I', 'N', 'S', 'D', 'C', ':',
- 'S', 'R', 'A', ':', 's', 'p', 'o', 't', 'i', 'd', '_', 't', '>', 'i', 'z', 'i', 'p',
- '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '#', '1', ' ', '.', 'S', 'P', 'O', 'T',
- '_', 'I', 'D', '=', '<', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 's', 'p',
- 'o', 't', 'i', 'd', '_', 't', '>', 's', 'u', 'b', '_', 'r', 'o', 'w', '_', 'i', 'd',
- '#', '1', '(', 'S', 'P', 'O', 'T', '_', 'I', 'D', ')', ';', 'p', 'h', 'y', 's', 'i',
- 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', '<', 'a', 's', 'c', 'i', 'i',
- '>', 'z', 'i', 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '#', '1', '<', '0',
- ',', '1', '>', ' ', '.', 'S', 'P', 'O', 'T', '_', 'G', 'R', 'O', 'U', 'P', '=', 'i',
- 'n', '_', 's', 'p', 'o', 't', '_', 'g', 'r', 'o', 'u', 'p', ';', '}', 't', 'a', 'b',
- 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':', 'n', '_', 'e', 'n', 'c',
- 'o', 'd', 'i', 'n', 'g', '#', '1', '{', 'U', '8', ' ', 'n', '_', 'e', 'n', 'c', 'o',
- 'd', 'i', 'n', 'g', '_', 'd', 'u', 'm', 'm', 'y', '=', 'r', 'e', 'a', 'd', '_', 'u',
- 'n', 'p', 'a', 'c', 'k', '|', 'r', 'e', 'a', 'd', '_', 'n', 'd', 'e', 'c', 'o', 'd',
- 'e', ';', '}', 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l',
- ':', 's', 'e', 'q', 'l', 'o', 'c', '#', '1', '{', 'c', 'o', 'l', 'u', 'm', 'n', ' ',
- '<', 'a', 's', 'c', 'i', 'i', '>', 'z', 'i', 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i',
- 'n', 'g', '#', '1', ' ', 'S', 'E', 'Q', '_', 'I', 'D', ';', 'c', 'o', 'l', 'u', 'm',
- 'n', ' ', '<', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'o', 'n',
- 'e', '>', 'i', 'z', 'i', 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '#', '1',
- ' ', 'S', 'E', 'Q', '_', 'S', 'T', 'A', 'R', 'T', ';', 'r', 'e', 'a', 'd', 'o', 'n',
- 'l', 'y', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c',
- 'o', 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o', ' ', 'S', 'E', 'Q', '_', 'S', 'T', 'A',
- 'R', 'T', ' ', '=', ' ', '(', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd',
- ':', 'z', 'e', 'r', 'o', ')', '<', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r',
- 'd', ':', 'o', 'n', 'e', '>', 'd', 'i', 'f', 'f', '#', '1', '<', '1', '>', '(', '.',
- 'S', 'E', 'Q', '_', 'S', 'T', 'A', 'R', 'T', ')', ';', 'c', 'o', 'l', 'u', 'm', 'n',
- ' ', '<', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l', 'e', 'n',
- '>', 'i', 'z', 'i', 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '#', '1', ' ',
- 'S', 'E', 'Q', '_', 'L', 'E', 'N', ';', '}', 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C',
- 'B', 'I', ':', 't', 'b', 'l', ':', 'd', 'c', 'm', 'p', '_', 'b', 'a', 's', 'e', '_',
- 's', 'p', 'a', 'c', 'e', '#', '1', '{', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a',
- ':', 't', 'e', 'x', 't', ' ', 'd', 'c', 'm', 'p', '_', 'v', 'i', 'r', 't', 'u', 'a',
- 'l', '_', 'p', 'r', 'o', 'd', 'u', 'c', 't', 'i', 'o', 'n', 's', '=', 'o', 'u', 't',
- '_', 'd', 'c', 'm', 'p', '_', '4', 'n', 'a', '_', 'b', 'i', 'n', '|', 'o', 'u', 't',
- '_', 'd', 'c', 'm', 'p', '_', 'x', '2', 'n', 'a', '_', 'b', 'i', 'n', '|', 'o', 'u',
- 't', '_', 'd', 'c', 'm', 'p', '_', '2', 'n', 'a', '_', 'b', 'i', 'n', '|', 'o', 'u',
- 't', '_', 'd', 'c', 'm', 'p', '_', '2', 'n', 'a', '_', 'p', 'a', 'c', 'k', 'e', 'd',
- ';', '}', 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':',
- 'b', 'a', 's', 'e', '_', 's', 'p', 'a', 'c', 'e', '_', 'c', 'o', 'm', 'm', 'o', 'n',
- '#', '1', '.', '0', '.', '3', '=', 'I', 'N', 'S', 'D', 'C', ':', 't', 'b', 'l', ':',
- 's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', '#', '1', '.', '0', '.', '1', ',', 'I', 'N',
- 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'p', 'o', 't', 'd',
- 'e', 's', 'c', '#', '1', '.', '0', '.', '2', ',', 'I', 'N', 'S', 'D', 'C', ':', 'S',
- 'R', 'A', ':', 't', 'b', 'l', ':', 's', 't', 'a', 't', 's', '#', '1', '.', '1', ',',
- 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':', 'd', 'c', 'm', 'p', '_', 'b', 'a', 's',
- 'e', '_', 's', 'p', 'a', 'c', 'e', '#', '1', '{', 'b', 'o', 'o', 'l', ' ', 'c', 's',
- '_', 'n', 'a', 't', 'i', 'v', 'e', '=', '<', 'b', 'o', 'o', 'l', '>', 'e', 'c', 'h',
- 'o', '#', '1', '<', 'f', 'a', 'l', 's', 'e', '>', '(', ')', ';', 'I', 'N', 'S', 'D',
- 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ' ', 'o', 'u', 't', '_', 'c', 's',
- '_', 'k', 'e', 'y', '=', '.', 'C', 'S', '_', 'K', 'E', 'Y', '|', '<', 'I', 'N', 'S',
- 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', '>', 'e', 'c', 'h', 'o', '#',
- '1', '<', '\'', 'T', '\'', '>', '(', 'o', 'u', 't', '_', 'r', 'e', 'a', 'd', '_',
- 't', 'y', 'p', 'e', ')', '|', '<', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':',
- 't', 'e', 'x', 't', '>', 'e', 'c', 'h', 'o', '#', '1', '<', '\'', 'T', '\'', '>',
- '(', 'o', 'u', 't', '_', 'r', 'e', 'a', 'd', '_', 'l', 'e', 'n', ')', '|', '<', 'I',
- 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', '>', 'e', 'c', 'h',
- 'o', '#', '1', '<', '\'', 'T', '\'', '>', '(', ')', ';', 'I', 'N', 'S', 'D', 'C',
- ':', '2', 'c', 's', ':', 'b', 'i', 'n', ' ', 'o', 'u', 't', '_', '2', 'c', 's', '_',
- 'b', 'i', 'n', '=', '<', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'c', 's', ':', 'b',
- 'i', 'n', ',', 'I', 'N', 'S', 'D', 'C', ':', '2', 'c', 's', ':', 'b', 'i', 'n', '>',
- 'm', 'a', 'p', '#', '1', '<', '[', '0', ',', '1', ',', '2', ',', '3', ',', '4', ']',
- ',', '[', '0', ',', '1', ',', '2', ',', '3', ',', '0', ']', '>', '(', 'o', 'u', 't',
- '_', 'x', '2', 'c', 's', '_', 'b', 'i', 'n', ')', ';', 'I', 'N', 'S', 'D', 'C', ':',
- '2', 'n', 'a', ':', 'b', 'i', 'n', ' ', 'o', 'u', 't', '_', '2', 'n', 'a', '_', 'b',
- 'i', 'n', '=', 'o', 'u', 't', '_', 'd', 'c', 'm', 'p', '_', '2', 'n', 'a', '_', 'b',
- 'i', 'n', '|', '(', 'I', 'N', 'S', 'D', 'C', ':', '2', 'n', 'a', ':', 'b', 'i', 'n',
- ')', 'u', 'n', 'p', 'a', 'c', 'k', '#', '1', '(', 'o', 'u', 't', '_', '2', 'n', 'a',
- '_', 'p', 'a', 'c', 'k', 'e', 'd', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2',
- 'c', 's', ':', 'b', 'i', 'n', ' ', 'o', 'u', 't', '_', 'x', '2', 'c', 's', '_', 'b',
- 'i', 'n', '=', 'N', 'C', 'B', 'I', ':', 'c', 'o', 'l', 'o', 'r', '_', 'f', 'r', 'o',
- 'm', '_', 'd', 'n', 'a', '#', '1', '(', 'o', 'u', 't', '_', 'x', '2', 'n', 'a', '_',
- 'b', 'i', 'n', ',', 'o', 'u', 't', '_', 'r', 'e', 'a', 'd', '_', 's', 't', 'a', 'r',
- 't', ',', 'o', 'u', 't', '_', 'r', 'e', 'a', 'd', '_', 'l', 'e', 'n', ',', 'o', 'u',
- 't', '_', 'c', 's', '_', 'k', 'e', 'y', ',', 'o', 'u', 't', '_', 'c', 'o', 'l', 'o',
- 'r', '_', 'm', 'a', 't', 'r', 'i', 'x', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', '2',
- 'c', 's', ':', 'p', 'a', 'c', 'k', 'e', 'd', ' ', 'o', 'u', 't', '_', '2', 'c', 's',
- '_', 'p', 'a', 'c', 'k', 'e', 'd', '=', '(', 'I', 'N', 'S', 'D', 'C', ':', '2', 'c',
- 's', ':', 'p', 'a', 'c', 'k', 'e', 'd', ')', 'p', 'a', 'c', 'k', '#', '1', '(', 'o',
- 'u', 't', '_', '2', 'c', 's', '_', 'b', 'i', 'n', ')', ';', 'I', 'N', 'S', 'D', 'C',
- ':', '4', 'n', 'a', ':', 'p', 'a', 'c', 'k', 'e', 'd', ' ', 'o', 'u', 't', '_', '4',
- 'n', 'a', '_', 'p', 'a', 'c', 'k', 'e', 'd', '=', '(', 'I', 'N', 'S', 'D', 'C', ':',
- '4', 'n', 'a', ':', 'p', 'a', 'c', 'k', 'e', 'd', ')', 'p', 'a', 'c', 'k', '#', '1',
- '(', 'o', 'u', 't', '_', '4', 'n', 'a', '_', 'b', 'i', 'n', ')', ';', 'I', 'N', 'S',
- 'D', 'C', ':', 'c', 'o', 'l', 'o', 'r', ':', 't', 'e', 'x', 't', ' ', 'o', 'u', 't',
- '_', 'c', 'o', 'l', 'o', 'r', '_', 't', 'e', 'x', 't', '=', '<', 'I', 'N', 'S', 'D',
- 'C', ':', 'x', '2', 'c', 's', ':', 'b', 'i', 'n', ',', 'I', 'N', 'S', 'D', 'C', ':',
- 'c', 'o', 'l', 'o', 'r', ':', 't', 'e', 'x', 't', '>', 'm', 'a', 'p', '#', '1', '<',
- '[', '0', ',', '1', ',', '2', ',', '3', ',', '4', ']', ',', '\'', '0', '1', '2',
- '3', '.', '\'', '>', '(', 'o', 'u', 't', '_', 'x', '2', 'c', 's', '_', 'b', 'i',
- 'n', ')', ';', 'U', '8', ' ', 'o', 'u', 't', '_', 'c', 'o', 'l', 'o', 'r', '_', 'm',
- 'a', 't', 'r', 'i', 'x', '=', '<', 'U', '8', '>', 'e', 'c', 'h', 'o', '#', '1', '<',
- '[', '0', ',', '1', ',', '2', ',', '3', ',', '4', ',', '1', ',', '0', ',', '3', ',',
- '2', ',', '4', ',', '2', ',', '3', ',', '0', ',', '1', ',', '4', ',', '3', ',', '2',
- ',', '1', ',', '0', ',', '4', ',', '4', ',', '4', ',', '4', ',', '4', ',', '4', ']',
- '>', '(', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l',
- 'e', 'n', ' ', 'b', 'a', 's', 'e', '_', 's', 'p', 'a', 'c', 'e', '_', 's', 'p', 'o',
- 't', '_', 'l', 'e', 'n', '=', '(', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r',
- 'd', ':', 'l', 'e', 'n', ')', 'r', 'o', 'w', '_', 'l', 'e', 'n', '#', '1', '(', 'o',
- 'u', 't', '_', '2', 'n', 'a', '_', 'p', 'a', 'c', 'k', 'e', 'd', ')', ';', 'I', 'N',
- 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l', 'e', 'n', ' ', 'b', 'a', 's',
- 'e', '_', 's', 'p', 'a', 'c', 'e', '_', 'f', 'i', 'x', 'e', 'd', '_', 's', 'p', 'o',
- 't', '_', 'l', 'e', 'n', '=', '(', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r',
- 'd', ':', 'l', 'e', 'n', ')', 'f', 'i', 'x', 'e', 'd', '_', 'r', 'o', 'w', '_', 'l',
- 'e', 'n', '#', '1', '(', 'o', 'u', 't', '_', '2', 'n', 'a', '_', 'p', 'a', 'c', 'k',
- 'e', 'd', ')', ';', '}', 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 't',
- 'b', 'l', ':', 'b', 'a', 's', 'e', '_', 's', 'p', 'a', 'c', 'e', '_', 'n', 'o', 'c',
- 'o', 'l', '#', '1', '.', '0', '.', '3', '=', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l',
- ':', 'b', 'a', 's', 'e', '_', 's', 'p', 'a', 'c', 'e', '_', 'c', 'o', 'm', 'm', 'o',
- 'n', '#', '1', '.', '0', '.', '3', ',', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':',
- 'n', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '#', '1', '{', 'I', 'N', 'S', 'D',
- 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ' ', 'o', 'u', 't', '_', 'd', 'n',
- 'a', '_', 't', 'e', 'x', 't', '=', '<', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'n',
- 'a', ':', 'b', 'i', 'n', ',', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't',
- 'e', 'x', 't', '>', 'm', 'a', 'p', '#', '1', '<', '[', '0', ',', '1', ',', '2', ',',
- '3', ',', '4', ']', ',', '\'', 'A', 'C', 'G', 'T', 'N', '\'', '>', '(', 'o', 'u',
- 't', '_', 'x', '2', 'n', 'a', '_', 'b', 'i', 'n', ')', ';', 'I', 'N', 'S', 'D', 'C',
- ':', '4', 'n', 'a', ':', 'b', 'i', 'n', ' ', 'o', 'u', 't', '_', '4', 'n', 'a', '_',
- 'b', 'i', 'n', '=', '<', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'n', 'a', ':', 'b',
- 'i', 'n', ',', 'I', 'N', 'S', 'D', 'C', ':', '4', 'n', 'a', ':', 'b', 'i', 'n', '>',
- 'm', 'a', 'p', '#', '1', '<', '[', '0', ',', '1', ',', '2', ',', '3', ',', '4', ']',
- ',', '[', '1', ',', '2', ',', '4', ',', '8', ',', '1', '5', ']', '>', '(', 'o', 'u',
- 't', '_', 'x', '2', 'n', 'a', '_', 'b', 'i', 'n', ')', ';', 'I', 'N', 'S', 'D', 'C',
- ':', 'x', '2', 'n', 'a', ':', 'b', 'i', 'n', ' ', 'o', 'u', 't', '_', 'x', '2', 'n',
- 'a', '_', 'b', 'i', 'n', '=', '(', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'n', 'a',
- ':', 'b', 'i', 'n', ')', 'r', 'e', 'a', 'd', '_', 'n', 'd', 'e', 'c', 'o', 'd', 'e',
- ';', 'U', '8', ' ', 'r', 'e', 'a', 'd', '_', 'u', 'n', 'p', 'a', 'c', 'k', '=', 'o',
- 'u', 't', '_', '2', 'n', 'a', '_', 'b', 'i', 'n', ';', '}', 't', 'a', 'b', 'l', 'e',
- ' ', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':', 'b', 'a', 's', 'e', '_', 's', 'p',
- 'a', 'c', 'e', '#', '1', '.', '0', '.', '3', '=', 'N', 'C', 'B', 'I', ':', 't', 'b',
- 'l', ':', 'b', 'a', 's', 'e', '_', 's', 'p', 'a', 'c', 'e', '_', 'n', 'o', 'c', 'o',
- 'l', '#', '1', '.', '0', '.', '3', '{', 'I', 'N', 'S', 'D', 'C', ':', '2', 'n', 'a',
- ':', 'p', 'a', 'c', 'k', 'e', 'd', ' ', 'o', 'u', 't', '_', '2', 'n', 'a', '_', 'p',
- 'a', 'c', 'k', 'e', 'd', '=', '.', 'R', 'E', 'A', 'D', ';', '}', 't', 'a', 'b', 'l',
- 'e', ' ', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':', 'b', 'a', 's', 'e', '_', 's',
- 'p', 'a', 'c', 'e', '#', '2', '.', '0', '.', '3', '=', 'N', 'C', 'B', 'I', ':', 't',
- 'b', 'l', ':', 'b', 'a', 's', 'e', '_', 's', 'p', 'a', 'c', 'e', '_', 'c', 'o', 'm',
- 'm', 'o', 'n', '#', '1', '.', '0', '.', '3', ',', 'N', 'C', 'B', 'I', ':', 't', 'b',
- 'l', ':', 'd', 'c', 'm', 'p', '_', 'b', 'a', 's', 'e', '_', 's', 'p', 'a', 'c', 'e',
- '#', '1', '{', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't',
- ' ', 'i', 'n', '_', 'd', 'n', 'a', '_', 't', 'e', 'x', 't', '=', '<', 'I', 'N', 'S',
- 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ',', 'I', 'N', 'S', 'D', 'C',
- ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', '>', 'm', 'a', 'p', '#', '1', '<', '\'',
- '.', 'a', 'c', 'm', 'g', 'r', 's', 'v', 't', 'w', 'y', 'h', 'k', 'd', 'b', 'n', '\'',
- ',', '\'', 'N', 'A', 'C', 'M', 'G', 'R', 'S', 'V', 'T', 'W', 'Y', 'H', 'K', 'D',
- 'B', 'N', '\'', '>', '(', 'R', 'E', 'A', 'D', ')', ';', 'I', 'N', 'S', 'D', 'C',
- ':', '4', 'n', 'a', ':', 'b', 'i', 'n', ' ', 'i', 'n', '_', '4', 'n', 'a', '_', 'b',
- 'i', 'n', '=', '<', 'I', 'N', 'S', 'D', 'C', ':', '4', 'n', 'a', ':', 'b', 'i', 'n',
- '>', 'r', 'a', 'n', 'g', 'e', '_', 'v', 'a', 'l', 'i', 'd', 'a', 't', 'e', '#', '1',
- '<', '0', ',', '1', '5', '>', '(', 'R', 'E', 'A', 'D', ')', '|', '(', 'I', 'N', 'S',
- 'D', 'C', ':', '4', 'n', 'a', ':', 'b', 'i', 'n', ')', 'u', 'n', 'p', 'a', 'c', 'k',
- '#', '1', '(', 'i', 'n', '_', '4', 'n', 'a', '_', 'p', 'a', 'c', 'k', 'e', 'd', ')',
- '|', '<', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ',',
- 'I', 'N', 'S', 'D', 'C', ':', '4', 'n', 'a', ':', 'b', 'i', 'n', '>', 'm', 'a', 'p',
- '#', '1', '<', '\'', '.', 'A', 'C', 'M', 'G', 'R', 'S', 'V', 'T', 'W', 'Y', 'H',
- 'K', 'D', 'B', 'N', '\'', ',', '[', '0', ',', '1', ',', '2', ',', '3', ',', '4',
- ',', '5', ',', '6', ',', '7', ',', '8', ',', '9', ',', '1', '0', ',', '1', '1', ',',
- '1', '2', ',', '1', '3', ',', '1', '4', ',', '1', '5', ']', '>', '(', 'i', 'n', '_',
- 'd', 'n', 'a', '_', 't', 'e', 'x', 't', ')', '|', '<', 'I', 'N', 'S', 'D', 'C', ':',
- 'x', '2', 'n', 'a', ':', 'b', 'i', 'n', ',', 'I', 'N', 'S', 'D', 'C', ':', '4', 'n',
- 'a', ':', 'b', 'i', 'n', '>', 'm', 'a', 'p', '#', '1', '<', '[', '0', ',', '1', ',',
- '2', ',', '3', ',', '4', ']', ',', '[', '1', ',', '2', ',', '4', ',', '8', ',', '1',
- '5', ']', '>', '(', 'i', 'n', '_', 'x', '2', 'n', 'a', '_', 'b', 'i', 'n', ')', ';',
- 'I', 'N', 'S', 'D', 'C', ':', '4', 'n', 'a', ':', 'p', 'a', 'c', 'k', 'e', 'd', ' ',
- 'i', 'n', '_', '4', 'n', 'a', '_', 'p', 'a', 'c', 'k', 'e', 'd', '=', 'R', 'E', 'A',
- 'D', ';', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'n', 'a', ':', 'b', 'i', 'n', ' ',
- 'i', 'n', '_', 'x', '2', 'n', 'a', '_', 'b', 'i', 'n', '=', '<', 'I', 'N', 'S', 'D',
- 'C', ':', 'x', '2', 'n', 'a', ':', 'b', 'i', 'n', '>', 'r', 'a', 'n', 'g', 'e', '_',
- 'v', 'a', 'l', 'i', 'd', 'a', 't', 'e', '#', '1', '<', '0', ',', '4', '>', '(', 'R',
- 'E', 'A', 'D', ')', '|', '<', 'I', 'N', 'S', 'D', 'C', ':', '4', 'n', 'a', ':', 'b',
- 'i', 'n', ',', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'n', 'a', ':', 'b', 'i', 'n',
- '>', 'm', 'a', 'p', '#', '1', '<', '[', '0', ',', '1', ',', '2', ',', '3', ',', '4',
- ',', '5', ',', '6', ',', '7', ',', '8', ',', '9', ',', '1', '0', ',', '1', '1', ',',
- '1', '2', ',', '1', '3', ',', '1', '4', ',', '1', '5', ']', ',', '[', '4', ',', '0',
- ',', '1', ',', '4', ',', '2', ',', '4', ',', '4', ',', '4', ',', '3', ',', '4', ',',
- '4', ',', '4', ',', '4', ',', '4', ',', '4', ',', '4', ']', '>', '(', 'i', 'n', '_',
- '4', 'n', 'a', '_', 'b', 'i', 'n', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', '2', 'n',
- 'a', ':', 'b', 'i', 'n', ' ', 'i', 'n', '_', '2', 'n', 'a', '_', 'b', 'i', 'n', '=',
- '<', 'I', 'N', 'S', 'D', 'C', ':', '2', 'n', 'a', ':', 'b', 'i', 'n', '>', 'r', 'a',
- 'n', 'g', 'e', '_', 'v', 'a', 'l', 'i', 'd', 'a', 't', 'e', '#', '1', '<', '0', ',',
- '3', '>', '(', 'R', 'E', 'A', 'D', ')', '|', '(', 'I', 'N', 'S', 'D', 'C', ':', '2',
- 'n', 'a', ':', 'b', 'i', 'n', ')', 'u', 'n', 'p', 'a', 'c', 'k', '#', '1', '(', 'i',
- 'n', '_', '2', 'n', 'a', '_', 'p', 'a', 'c', 'k', 'e', 'd', ')', '|', 'I', 'N', 'S',
- 'D', 'C', ':', 'S', 'E', 'Q', ':', 'r', 'a', 'n', 'd', '_', '4', 'n', 'a', '_', '2',
- 'n', 'a', '#', '1', '(', 'i', 'n', '_', '4', 'n', 'a', '_', 'b', 'i', 'n', ')', ';',
- 'I', 'N', 'S', 'D', 'C', ':', '2', 'n', 'a', ':', 'p', 'a', 'c', 'k', 'e', 'd', ' ',
- 'i', 'n', '_', '2', 'n', 'a', '_', 'p', 'a', 'c', 'k', 'e', 'd', '=', 'R', 'E', 'A',
- 'D', ';', 'I', 'N', 'S', 'D', 'C', ':', '4', 'n', 'a', ':', 'b', 'i', 'n', ' ', 'i',
- 'n', '_', 'a', 'l', 't', '_', '4', 'n', 'a', '_', 'b', 'i', 'n', '=', '<', 'I', 'N',
- 'S', 'D', 'C', ':', '4', 'n', 'a', ':', 'b', 'i', 'n', ',', 'I', 'N', 'S', 'D', 'C',
- ':', '4', 'n', 'a', ':', 'b', 'i', 'n', '>', 'm', 'a', 'p', '#', '1', '<', '[', '0',
- ',', '1', ',', '2', ',', '3', ',', '4', ',', '5', ',', '6', ',', '7', ',', '8', ',',
- '9', ',', '1', '0', ',', '1', '1', ',', '1', '2', ',', '1', '3', ',', '1', '4', ',',
- '1', '5', ']', ',', '[', '1', '5', ',', '0', ',', '0', ',', '3', ',', '0', ',', '5',
- ',', '6', ',', '7', ',', '0', ',', '9', ',', '1', '0', ',', '1', '1', ',', '1', '2',
- ',', '1', '3', ',', '1', '4', ',', '1', '5', ']', '>', '(', 'i', 'n', '_', '4', 'n',
- 'a', '_', 'b', 'i', 'n', ')', ';', 'U', '8', ' ', 'i', 'n', '_', 's', 't', 'a', 't',
- 's', '_', 'b', 'i', 'n', '=', 'i', 'n', '_', '2', 'n', 'a', '_', 'b', 'i', 'n', ';',
- 'I', 'N', 'S', 'D', 'C', ':', '2', 'n', 'a', ':', 'p', 'a', 'c', 'k', 'e', 'd', ' ',
- 'o', 'u', 't', '_', '2', 'n', 'a', '_', 'p', 'a', 'c', 'k', 'e', 'd', '=', '.', 'R',
- 'E', 'A', 'D', '|', 'o', 'u', 't', '_', 'd', 'c', 'm', 'p', '_', '2', 'n', 'a', '_',
- 'p', 'a', 'c', 'k', 'e', 'd', ';', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'n', 'a',
- ':', 'b', 'i', 'n', ' ', 'o', 'u', 't', '_', 'x', '2', 'n', 'a', '_', 'b', 'i', 'n',
- '=', 'o', 'u', 't', '_', 'd', 'c', 'm', 'p', '_', 'x', '2', 'n', 'a', '_', 'b', 'i',
- 'n', '|', '<', 'I', 'N', 'S', 'D', 'C', ':', '4', 'n', 'a', ':', 'b', 'i', 'n', ',',
- 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'n', 'a', ':', 'b', 'i', 'n', '>', 'm', 'a',
- 'p', '#', '1', '<', '[', '0', ',', '1', ',', '2', ',', '3', ',', '4', ',', '5', ',',
- '6', ',', '7', ',', '8', ',', '9', ',', '1', '0', ',', '1', '1', ',', '1', '2', ',',
- '1', '3', ',', '1', '4', ',', '1', '5', ']', ',', '[', '4', ',', '0', ',', '1', ',',
- '4', ',', '2', ',', '4', ',', '4', ',', '4', ',', '3', ',', '4', ',', '4', ',', '4',
- ',', '4', ',', '4', ',', '4', ',', '4', ']', '>', '(', 'o', 'u', 't', '_', '4', 'n',
- 'a', '_', 'b', 'i', 'n', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', '4', 'n', 'a', ':',
- 'b', 'i', 'n', ' ', 'o', 'u', 't', '_', '2', 'n', 'a', '_', '4', 'n', 'a', '_', 'b',
- 'i', 'n', '=', '<', 'I', 'N', 'S', 'D', 'C', ':', '2', 'n', 'a', ':', 'b', 'i', 'n',
- ',', 'I', 'N', 'S', 'D', 'C', ':', '4', 'n', 'a', ':', 'b', 'i', 'n', '>', 'm', 'a',
- 'p', '#', '1', '<', '[', '0', ',', '1', ',', '2', ',', '3', ']', ',', '[', '1', ',',
- '2', ',', '4', ',', '8', ']', '>', '(', 'o', 'u', 't', '_', '2', 'n', 'a', '_', 'b',
- 'i', 'n', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', '4', 'n', 'a', ':', 'b', 'i', 'n',
- ' ', 'o', 'u', 't', '_', '4', 'n', 'a', '_', 'b', 'i', 'n', '=', '<', 'I', 'N', 'S',
- 'D', 'C', ':', '4', 'n', 'a', ':', 'b', 'i', 'n', '>', 'b', 'i', 't', '_', 'o', 'r',
- '#', '1', '<', '1', '>', '(', 'o', 'u', 't', '_', '2', 'n', 'a', '_', '4', 'n', 'a',
- '_', 'b', 'i', 'n', ',', '.', 'A', 'L', 'T', 'R', 'E', 'A', 'D', ')', '|', 'o', 'u',
- 't', '_', 'd', 'c', 'm', 'p', '_', '4', 'n', 'a', '_', 'b', 'i', 'n', '|', 'o', 'u',
- 't', '_', '2', 'n', 'a', '_', '4', 'n', 'a', '_', 'b', 'i', 'n', ';', 'I', 'N', 'S',
- 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ' ', 'o', 'u', 't', '_', 'd',
- 'n', 'a', '_', 't', 'e', 'x', 't', '=', '<', 'I', 'N', 'S', 'D', 'C', ':', '4', 'n',
- 'a', ':', 'b', 'i', 'n', ',', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't',
- 'e', 'x', 't', '>', 'm', 'a', 'p', '#', '1', '<', '[', '0', ',', '1', ',', '2', ',',
- '3', ',', '4', ',', '5', ',', '6', ',', '7', ',', '8', ',', '9', ',', '1', '0', ',',
- '1', '1', ',', '1', '2', ',', '1', '3', ',', '1', '4', ',', '1', '5', ']', ',', '\'',
- '.', 'A', 'C', 'M', 'G', 'R', 'S', 'V', 'T', 'W', 'Y', 'H', 'K', 'D', 'B', 'N', '\'',
- '>', '(', 'o', 'u', 't', '_', '4', 'n', 'a', '_', 'b', 'i', 'n', ')', ';', 'p', 'h',
- 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S',
- 'D', 'C', ':', '2', 'n', 'a', ':', 'p', 'a', 'c', 'k', 'e', 'd', ' ', '.', 'R', 'E',
- 'A', 'D', '=', 'i', 'n', '_', '2', 'n', 'a', '_', 'p', 'a', 'c', 'k', 'e', 'd', '|',
- '(', 'I', 'N', 'S', 'D', 'C', ':', '2', 'n', 'a', ':', 'p', 'a', 'c', 'k', 'e', 'd',
- ')', 'p', 'a', 'c', 'k', '#', '1', '(', 'i', 'n', '_', '2', 'n', 'a', '_', 'b', 'i',
- 'n', ')', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm',
- 'n', ' ', '<', 'I', 'N', 'S', 'D', 'C', ':', '4', 'n', 'a', ':', 'b', 'i', 'n', '>',
- 'z', 'i', 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '#', '1', ' ', '.', 'A',
- 'L', 'T', 'R', 'E', 'A', 'D', '=', '<', 'I', 'N', 'S', 'D', 'C', ':', '4', 'n', 'a',
- ':', 'b', 'i', 'n', '>', 't', 'r', 'i', 'm', '#', '1', '<', '0', ',', '0', '>', '(',
- 'i', 'n', '_', 'a', 'l', 't', '_', '4', 'n', 'a', '_', 'b', 'i', 'n', ')', ';', '}',
- 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':', 'd', 'c',
- 'm', 'p', '_', 'c', 'o', 'l', 'o', 'r', '_', 's', 'p', 'a', 'c', 'e', '#', '1', '{',
- 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ' ', 'd', 'c',
- 'm', 'p', '_', 'v', 'i', 'r', 't', 'u', 'a', 'l', '_', 'p', 'r', 'o', 'd', 'u', 'c',
- 't', 'i', 'o', 'n', 's', '=', 'o', 'u', 't', '_', 'd', 'c', 'm', 'p', '_', 'x', '2',
- 'c', 's', '_', 'b', 'i', 'n', '|', 'o', 'u', 't', '_', 'd', 'c', 'm', 'p', '_', '2',
- 'c', 's', '_', 'b', 'i', 'n', '|', 'o', 'u', 't', '_', 'd', 'c', 'm', 'p', '_', '2',
- 'c', 's', '_', 'p', 'a', 'c', 'k', 'e', 'd', ';', '}', 't', 'a', 'b', 'l', 'e', ' ',
- 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':', 'c', 'o', 'l', 'o', 'r', '_', 's', 'p',
- 'a', 'c', 'e', '_', 'c', 'o', 'm', 'm', 'o', 'n', '#', '1', '.', '0', '.', '3', '=',
- 'I', 'N', 'S', 'D', 'C', ':', 't', 'b', 'l', ':', 's', 'e', 'q', 'u', 'e', 'n', 'c',
- 'e', '#', '1', '.', '0', '.', '1', ',', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A',
- ':', 't', 'b', 'l', ':', 's', 'p', 'o', 't', 'd', 'e', 's', 'c', '#', '1', '.', '0',
- '.', '2', ',', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':',
- 's', 't', 'a', 't', 's', '#', '1', '.', '1', ',', 'N', 'C', 'B', 'I', ':', 't', 'b',
- 'l', ':', 'd', 'c', 'm', 'p', '_', 'c', 'o', 'l', 'o', 'r', '_', 's', 'p', 'a', 'c',
- 'e', '#', '1', '{', 'b', 'o', 'o', 'l', ' ', 'c', 's', '_', 'n', 'a', 't', 'i', 'v',
- 'e', '=', '<', 'b', 'o', 'o', 'l', '>', 'e', 'c', 'h', 'o', '#', '1', '<', 't', 'r',
- 'u', 'e', '>', '(', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', '2', 'c', 's', ':', 'b',
- 'i', 'n', ' ', 'o', 'u', 't', '_', '2', 'c', 's', '_', 'b', 'i', 'n', '=', 'o', 'u',
- 't', '_', 'd', 'c', 'm', 'p', '_', '2', 'c', 's', '_', 'b', 'i', 'n', '|', '(', 'I',
- 'N', 'S', 'D', 'C', ':', '2', 'c', 's', ':', 'b', 'i', 'n', ')', 'u', 'n', 'p', 'a',
- 'c', 'k', '#', '1', '(', 'o', 'u', 't', '_', '2', 'c', 's', '_', 'p', 'a', 'c', 'k',
- 'e', 'd', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', '2', 'n', 'a', ':', 'b', 'i', 'n',
- ' ', 'o', 'u', 't', '_', '2', 'n', 'a', '_', 'b', 'i', 'n', '=', '<', 'I', 'N', 'S',
- 'D', 'C', ':', 'x', '2', 'n', 'a', ':', 'b', 'i', 'n', ',', 'I', 'N', 'S', 'D', 'C',
- ':', '2', 'n', 'a', ':', 'b', 'i', 'n', '>', 'm', 'a', 'p', '#', '1', '<', '[', '0',
- ',', '1', ',', '2', ',', '3', ',', '4', ']', ',', '[', '0', ',', '1', ',', '2', ',',
- '3', ',', '0', ']', '>', '(', 'o', 'u', 't', '_', 'x', '2', 'n', 'a', '_', 'b', 'i',
- 'n', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', '4', 'n', 'a', ':', 'b', 'i', 'n', ' ',
- 'o', 'u', 't', '_', '4', 'n', 'a', '_', 'b', 'i', 'n', '=', '<', 'I', 'N', 'S', 'D',
- 'C', ':', 'x', '2', 'n', 'a', ':', 'b', 'i', 'n', ',', 'I', 'N', 'S', 'D', 'C', ':',
- '4', 'n', 'a', ':', 'b', 'i', 'n', '>', 'm', 'a', 'p', '#', '1', '<', '[', '0', ',',
- '1', ',', '2', ',', '3', ',', '4', ']', ',', '[', '1', ',', '2', ',', '4', ',', '8',
- ',', '1', '5', ']', '>', '(', 'o', 'u', 't', '_', 'x', '2', 'n', 'a', '_', 'b', 'i',
- 'n', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't',
- ' ', 'o', 'u', 't', '_', 'd', 'n', 'a', '_', 't', 'e', 'x', 't', '=', '<', 'I', 'N',
- 'S', 'D', 'C', ':', 'x', '2', 'n', 'a', ':', 'b', 'i', 'n', ',', 'I', 'N', 'S', 'D',
- 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', '>', 'm', 'a', 'p', '#', '1', '<',
- '[', '0', ',', '1', ',', '2', ',', '3', ',', '4', ']', ',', '\'', 'A', 'C', 'G',
- 'T', 'N', '\'', '>', '(', 'o', 'u', 't', '_', 'x', '2', 'n', 'a', '_', 'b', 'i',
- 'n', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'n', 'a', ':', 'b', 'i', 'n',
- ' ', 'o', 'u', 't', '_', 'x', '2', 'n', 'a', '_', 'b', 'i', 'n', '=', 'N', 'C', 'B',
- 'I', ':', 'd', 'n', 'a', '_', 'f', 'r', 'o', 'm', '_', 'c', 'o', 'l', 'o', 'r', '#',
- '1', '(', 'o', 'u', 't', '_', 'x', '2', 'c', 's', '_', 'b', 'i', 'n', ',', 'o', 'u',
- 't', '_', 'r', 'e', 'a', 'd', '_', 's', 't', 'a', 'r', 't', ',', 'o', 'u', 't', '_',
- 'r', 'e', 'a', 'd', '_', 'l', 'e', 'n', ',', 'o', 'u', 't', '_', 'c', 's', '_', 'k',
- 'e', 'y', ',', 'o', 'u', 't', '_', 'c', 'o', 'l', 'o', 'r', '_', 'm', 'a', 't', 'r',
- 'i', 'x', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', '2', 'n', 'a', ':', 'p', 'a', 'c',
- 'k', 'e', 'd', ' ', 'o', 'u', 't', '_', '2', 'n', 'a', '_', 'p', 'a', 'c', 'k', 'e',
- 'd', '=', '(', 'I', 'N', 'S', 'D', 'C', ':', '2', 'n', 'a', ':', 'p', 'a', 'c', 'k',
- 'e', 'd', ')', 'p', 'a', 'c', 'k', '#', '1', '(', 'o', 'u', 't', '_', '2', 'n', 'a',
- '_', 'b', 'i', 'n', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', '4', 'n', 'a', ':', 'p',
- 'a', 'c', 'k', 'e', 'd', ' ', 'o', 'u', 't', '_', '4', 'n', 'a', '_', 'p', 'a', 'c',
- 'k', 'e', 'd', '=', '(', 'I', 'N', 'S', 'D', 'C', ':', '4', 'n', 'a', ':', 'p', 'a',
- 'c', 'k', 'e', 'd', ')', 'p', 'a', 'c', 'k', '#', '1', '(', 'o', 'u', 't', '_', '4',
- 'n', 'a', '_', 'b', 'i', 'n', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'l',
- 'o', 'r', ':', 't', 'e', 'x', 't', ' ', 'o', 'u', 't', '_', 'c', 'o', 'l', 'o', 'r',
- '_', 't', 'e', 'x', 't', '=', '<', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'c', 's',
- ':', 'b', 'i', 'n', ',', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'l', 'o', 'r', ':',
- 't', 'e', 'x', 't', '>', 'm', 'a', 'p', '#', '1', '<', '[', '0', ',', '1', ',', '2',
- ',', '3', ',', '4', ']', ',', '\'', '0', '1', '2', '3', '.', '\'', '>', '(', 'o',
- 'u', 't', '_', 'x', '2', 'c', 's', '_', 'b', 'i', 'n', ')', ';', 'I', 'N', 'S', 'D',
- 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l', 'e', 'n', ' ', 'c', 'o', 'l', 'o', 'r',
- '_', 's', 'p', 'a', 'c', 'e', '_', 's', 'p', 'o', 't', '_', 'l', 'e', 'n', '=', '(',
- 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l', 'e', 'n', ')', 'r',
- 'o', 'w', '_', 'l', 'e', 'n', '#', '1', '(', 'o', 'u', 't', '_', '2', 'c', 's', '_',
- 'p', 'a', 'c', 'k', 'e', 'd', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o',
- 'r', 'd', ':', 'l', 'e', 'n', ' ', 'c', 'o', 'l', 'o', 'r', '_', 's', 'p', 'a', 'c',
- 'e', '_', 'f', 'i', 'x', 'e', 'd', '_', 's', 'p', 'o', 't', '_', 'l', 'e', 'n', '=',
- '(', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l', 'e', 'n', ')',
- 'f', 'i', 'x', 'e', 'd', '_', 'r', 'o', 'w', '_', 'l', 'e', 'n', '#', '1', '(', 'o',
- 'u', 't', '_', '2', 'c', 's', '_', 'p', 'a', 'c', 'k', 'e', 'd', ')', ';', '}', 't',
- 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':', 'c', 'o', 'l',
- 'o', 'r', '_', 's', 'p', 'a', 'c', 'e', '_', 'n', 'o', 'c', 'o', 'l', '#', '1', '.',
- '0', '.', '3', '=', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':', 'c', 'o', 'l', 'o',
- 'r', '_', 's', 'p', 'a', 'c', 'e', '_', 'c', 'o', 'm', 'm', 'o', 'n', '#', '1', '.',
- '0', '.', '3', ',', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':', 'n', '_', 'e', 'n',
- 'c', 'o', 'd', 'i', 'n', 'g', '#', '1', '{', 'U', '8', ' ', 'o', 'u', 't', '_', 'c',
- 'o', 'l', 'o', 'r', '_', 'm', 'a', 't', 'r', 'i', 'x', '=', '<', 'U', '8', '>', 'm',
- 'e', 't', 'a', ':', 'r', 'e', 'a', 'd', '#', '1', '<', '\'', 'C', 'O', 'L', 'O',
- 'R', '_', 'M', 'A', 'T', 'R', 'I', 'X', '\'', '>', '(', ')', '|', '<', 'U', '8',
- '>', 'e', 'c', 'h', 'o', '#', '1', '<', '[', '0', ',', '1', ',', '2', ',', '3', ',',
- '4', ',', '1', ',', '0', ',', '3', ',', '2', ',', '4', ',', '2', ',', '3', ',', '0',
- ',', '1', ',', '4', ',', '3', ',', '2', ',', '1', ',', '0', ',', '4', ',', '4', ',',
- '4', ',', '4', ',', '4', ',', '4', ']', '>', '(', ')', ';', 'I', 'N', 'S', 'D', 'C',
- ':', 'x', '2', 'c', 's', ':', 'b', 'i', 'n', ' ', 'o', 'u', 't', '_', 'x', '2', 'c',
- 's', '_', 'b', 'i', 'n', '=', '(', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'c', 's',
- ':', 'b', 'i', 'n', ')', 'r', 'e', 'a', 'd', '_', 'n', 'd', 'e', 'c', 'o', 'd', 'e',
- ';', 'U', '8', ' ', 'r', 'e', 'a', 'd', '_', 'u', 'n', 'p', 'a', 'c', 'k', '=', 'o',
- 'u', 't', '_', '2', 'c', 's', '_', 'b', 'i', 'n', ';', '}', 't', 'a', 'b', 'l', 'e',
- ' ', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':', 'c', 'o', 'l', 'o', 'r', '_', 's',
- 'p', 'a', 'c', 'e', '#', '1', '.', '0', '.', '3', '=', 'N', 'C', 'B', 'I', ':', 't',
- 'b', 'l', ':', 'c', 'o', 'l', 'o', 'r', '_', 's', 'p', 'a', 'c', 'e', '_', 'n', 'o',
- 'c', 'o', 'l', '#', '1', '.', '0', '.', '3', '{', 'I', 'N', 'S', 'D', 'C', ':', 'd',
- 'n', 'a', ':', 't', 'e', 'x', 't', ' ', 'o', 'u', 't', '_', 'c', 's', '_', 'k', 'e',
- 'y', '=', '.', 'C', 'S', '_', 'K', 'E', 'Y', ';', 'I', 'N', 'S', 'D', 'C', ':', '2',
- 'c', 's', ':', 'p', 'a', 'c', 'k', 'e', 'd', ' ', 'o', 'u', 't', '_', '2', 'c', 's',
- '_', 'p', 'a', 'c', 'k', 'e', 'd', '=', '.', 'C', 'S', 'R', 'E', 'A', 'D', ';', '}',
- 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':', 'c', 'o',
- 'l', 'o', 'r', '_', 's', 'p', 'a', 'c', 'e', '#', '2', '.', '1', '=', 'N', 'C', 'B',
- 'I', ':', 't', 'b', 'l', ':', 'c', 'o', 'l', 'o', 'r', '_', 's', 'p', 'a', 'c', 'e',
- '_', 'c', 'o', 'm', 'm', 'o', 'n', '#', '1', '.', '0', '.', '3', ',', 'N', 'C', 'B',
- 'I', ':', 't', 'b', 'l', ':', 'd', 'c', 'm', 'p', '_', 'c', 'o', 'l', 'o', 'r', '_',
- 's', 'p', 'a', 'c', 'e', '#', '1', '{', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'l',
- 'o', 'r', ':', 't', 'e', 'x', 't', ' ', 'i', 'n', '_', 'c', 'o', 'l', 'o', 'r', '_',
- 't', 'e', 'x', 't', '=', 'C', 'S', 'R', 'E', 'A', 'D', ';', 'I', 'N', 'S', 'D', 'C',
- ':', 'x', '2', 'c', 's', ':', 'b', 'i', 'n', ' ', 'i', 'n', '_', 'x', '2', 'c', 's',
- '_', 'b', 'i', 'n', '=', '<', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'c', 's', ':',
- 'b', 'i', 'n', '>', 'r', 'a', 'n', 'g', 'e', '_', 'v', 'a', 'l', 'i', 'd', 'a', 't',
- 'e', '#', '1', '<', '0', ',', '4', '>', '(', 'C', 'S', 'R', 'E', 'A', 'D', ')', '|',
- '<', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'l', 'o', 'r', ':', 't', 'e', 'x', 't',
- ',', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'c', 's', ':', 'b', 'i', 'n', '>', 'm',
- 'a', 'p', '#', '1', '<', '\'', '0', '1', '2', '3', '.', '\'', ',', '[', '0', ',',
- '1', ',', '2', ',', '3', ',', '4', ']', '>', '(', 'i', 'n', '_', 'c', 'o', 'l', 'o',
- 'r', '_', 't', 'e', 'x', 't', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', '2', 'c', 's',
- ':', 'b', 'i', 'n', ' ', 'i', 'n', '_', '2', 'c', 's', '_', 'b', 'i', 'n', '=', '<',
- 'I', 'N', 'S', 'D', 'C', ':', '2', 'c', 's', ':', 'b', 'i', 'n', '>', 'r', 'a', 'n',
- 'g', 'e', '_', 'v', 'a', 'l', 'i', 'd', 'a', 't', 'e', '#', '1', '<', '0', ',', '3',
- '>', '(', 'C', 'S', 'R', 'E', 'A', 'D', ')', '|', '(', 'I', 'N', 'S', 'D', 'C', ':',
- '2', 'c', 's', ':', 'b', 'i', 'n', ')', 'u', 'n', 'p', 'a', 'c', 'k', '#', '1', '(',
- 'i', 'n', '_', '2', 'c', 's', '_', 'p', 'a', 'c', 'k', 'e', 'd', ')', '|', '<', 'I',
- 'N', 'S', 'D', 'C', ':', 'x', '2', 'c', 's', ':', 'b', 'i', 'n', ',', 'I', 'N', 'S',
- 'D', 'C', ':', '2', 'c', 's', ':', 'b', 'i', 'n', '>', 'm', 'a', 'p', '#', '1', '<',
- '[', '0', ',', '1', ',', '2', ',', '3', ',', '4', ']', ',', '[', '0', ',', '1', ',',
- '2', ',', '3', ',', '0', ']', '>', '(', 'i', 'n', '_', 'x', '2', 'c', 's', '_', 'b',
- 'i', 'n', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', '2', 'c', 's', ':', 'p', 'a', 'c',
- 'k', 'e', 'd', ' ', 'i', 'n', '_', '2', 'c', 's', '_', 'p', 'a', 'c', 'k', 'e', 'd',
- '=', 'C', 'S', 'R', 'E', 'A', 'D', ';', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'c',
- 's', ':', 'b', 'i', 'n', ' ', 'i', 'n', '_', 'a', 'l', 't', '_', 'x', '2', 'c', 's',
- '_', 'b', 'i', 'n', '=', '<', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'c', 's', ':',
- 'b', 'i', 'n', ',', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'c', 's', ':', 'b', 'i',
- 'n', '>', 'm', 'a', 'p', '#', '1', '<', '[', '0', ',', '1', ',', '2', ',', '3', ',',
- '4', ']', ',', '[', '0', ',', '0', ',', '0', ',', '0', ',', '4', ']', '>', '(', 'i',
- 'n', '_', 'x', '2', 'c', 's', '_', 'b', 'i', 'n', ')', ';', 'I', 'N', 'S', 'D', 'C',
- ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ' ', 'i', 'n', '_', 'c', 's', '_', 'k',
- 'e', 'y', '=', '<', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x',
- 't', ',', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', '>',
- 'm', 'a', 'p', '#', '1', '<', '\'', 'a', 'c', 'g', 't', '\'', ',', '\'', 'A', 'C',
- 'G', 'T', '\'', '>', '(', 'C', 'S', '_', 'K', 'E', 'Y', ')', ';', 'U', '8', ' ',
- 'i', 'n', '_', 'c', 'o', 'l', 'o', 'r', '_', 'm', 'a', 't', 'r', 'i', 'x', '=', '<',
- 'U', '8', '>', 'r', 'a', 'n', 'g', 'e', '_', 'v', 'a', 'l', 'i', 'd', 'a', 't', 'e',
- '#', '1', '<', '0', ',', '4', '>', '(', 'C', 'O', 'L', 'O', 'R', '_', 'M', 'A', 'T',
- 'R', 'I', 'X', ')', ';', 'U', '8', ' ', 'i', 'n', '_', 's', 't', 'a', 't', 's', '_',
- 'b', 'i', 'n', '=', 'i', 'n', '_', '2', 'c', 's', '_', 'b', 'i', 'n', ';', 'I', 'N',
- 'S', 'D', 'C', ':', '2', 'c', 's', ':', 'p', 'a', 'c', 'k', 'e', 'd', ' ', 'o', 'u',
- 't', '_', '2', 'c', 's', '_', 'p', 'a', 'c', 'k', 'e', 'd', '=', '.', 'C', 'S', 'R',
- 'E', 'A', 'D', '|', 'o', 'u', 't', '_', 'd', 'c', 'm', 'p', '_', '2', 'c', 's', '_',
- 'p', 'a', 'c', 'k', 'e', 'd', ';', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'c', 's',
- ':', 'b', 'i', 'n', ' ', 'o', 'u', 't', '_', 'x', '2', 'c', 's', '_', 'b', 'i', 'n',
- '=', '(', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'c', 's', ':', 'b', 'i', 'n', ')',
- '<', 'U', '8', '>', 'b', 'i', 't', '_', 'o', 'r', '#', '1', '<', '1', '>', '(', 'o',
- 'u', 't', '_', '2', 'c', 's', '_', 'b', 'i', 'n', ',', '.', 'A', 'L', 'T', 'C', 'S',
- 'R', 'E', 'A', 'D', ')', '|', 'o', 'u', 't', '_', 'd', 'c', 'm', 'p', '_', 'x', '2',
- 'c', 's', '_', 'b', 'i', 'n', '|', '(', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'c',
- 's', ':', 'b', 'i', 'n', ')', 'o', 'u', 't', '_', '2', 'c', 's', '_', 'b', 'i', 'n',
- ';', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ' ', 'o',
- 'u', 't', '_', 'c', 's', '_', 'k', 'e', 'y', '=', '.', 'C', 'S', '_', 'K', 'E', 'Y',
- ';', 'U', '8', ' ', 'o', 'u', 't', '_', 'c', 'o', 'l', 'o', 'r', '_', 'm', 'a', 't',
- 'r', 'i', 'x', '=', '.', 'C', 'O', 'L', 'O', 'R', '_', 'M', 'A', 'T', 'R', 'I', 'X',
- '|', '<', 'U', '8', '>', 'e', 'c', 'h', 'o', '#', '1', '<', '[', '0', ',', '1', ',',
- '2', ',', '3', ',', '4', ',', '1', ',', '0', ',', '3', ',', '2', ',', '4', ',', '2',
- ',', '3', ',', '0', ',', '1', ',', '4', ',', '3', ',', '2', ',', '1', ',', '0', ',',
- '4', ',', '4', ',', '4', ',', '4', ',', '4', ',', '4', ']', '>', '(', ')', ';', 'p',
- 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N',
- 'S', 'D', 'C', ':', '2', 'c', 's', ':', 'p', 'a', 'c', 'k', 'e', 'd', ' ', '.', 'C',
- 'S', 'R', 'E', 'A', 'D', '=', 'i', 'n', '_', '2', 'c', 's', '_', 'p', 'a', 'c', 'k',
- 'e', 'd', '|', '(', 'I', 'N', 'S', 'D', 'C', ':', '2', 'c', 's', ':', 'p', 'a', 'c',
- 'k', 'e', 'd', ')', 'p', 'a', 'c', 'k', '#', '1', '(', 'i', 'n', '_', '2', 'c', 's',
- '_', 'b', 'i', 'n', ')', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o',
- 'l', 'u', 'm', 'n', ' ', '<', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'c', 's', ':',
- 'b', 'i', 'n', '>', 'z', 'i', 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '#',
- '1', ' ', '.', 'A', 'L', 'T', 'C', 'S', 'R', 'E', 'A', 'D', '=', '<', 'I', 'N', 'S',
- 'D', 'C', ':', 'x', '2', 'c', 's', ':', 'b', 'i', 'n', '>', 't', 'r', 'i', 'm', '#',
- '1', '<', '0', ',', '0', '>', '(', 'i', 'n', '_', 'a', 'l', 't', '_', 'x', '2', 'c',
- 's', '_', 'b', 'i', 'n', ')', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c',
- 'o', 'l', 'u', 'm', 'n', ' ', '<', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':',
- 't', 'e', 'x', 't', '>', 'z', 'i', 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g',
- '#', '1', ' ', '.', 'C', 'S', '_', 'K', 'E', 'Y', '=', 'i', 'n', '_', 'c', 's', '_',
- 'k', 'e', 'y', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u',
- 'm', 'n', ' ', '<', 'U', '8', '>', 'z', 'i', 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i',
- 'n', 'g', '#', '1', ' ', '.', 'C', 'O', 'L', 'O', 'R', '_', 'M', 'A', 'T', 'R', 'I',
- 'X', '=', 'i', 'n', '_', 'c', 'o', 'l', 'o', 'r', '_', 'm', 'a', 't', 'r', 'i', 'x',
- ';', '}', 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':',
- 'p', 'r', 'o', 't', 'e', 'i', 'n', '#', '1', '=', 'I', 'N', 'S', 'D', 'C', ':', 't',
- 'b', 'l', ':', 'p', 'r', 'o', 't', 'e', 'i', 'n', '#', '1', '{', 'I', 'N', 'S', 'D',
- 'C', ':', 'p', 'r', 'o', 't', 'e', 'i', 'n', ':', 't', 'e', 'x', 't', ' ', 'i', 'n',
- '_', 'p', 'r', 'o', 't', 'e', 'i', 'n', '_', 't', 'e', 'x', 't', '=', '<', 'I', 'N',
- 'S', 'D', 'C', ':', 'p', 'r', 'o', 't', 'e', 'i', 'n', ':', 't', 'e', 'x', 't', ',',
- 'I', 'N', 'S', 'D', 'C', ':', 'p', 'r', 'o', 't', 'e', 'i', 'n', ':', 't', 'e', 'x',
- 't', '>', 'm', 'a', 'p', '#', '1', '<', '\'', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
- 'h', 'i', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z', 'u',
- '\'', ',', '\'', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'K', 'L', 'M', 'N',
- 'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'X', 'Y', 'Z', 'U', '\'', '>', '(', 'P', 'R',
- 'O', 'T', 'E', 'I', 'N', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'a', 'a', ':', 'b',
- 'i', 'n', ' ', 'i', 'n', '_', 'a', 'a', '_', 'b', 'i', 'n', '=', '<', 'I', 'N', 'S',
- 'D', 'C', ':', 'a', 'a', ':', 'b', 'i', 'n', '>', 'r', 'a', 'n', 'g', 'e', '_', 'v',
- 'a', 'l', 'i', 'd', 'a', 't', 'e', '#', '1', '<', '1', ',', '2', '5', '>', '(', 'P',
- 'R', 'O', 'T', 'E', 'I', 'N', ')', '|', '<', 'I', 'N', 'S', 'D', 'C', ':', 'p', 'r',
- 'o', 't', 'e', 'i', 'n', ':', 't', 'e', 'x', 't', ',', 'I', 'N', 'S', 'D', 'C', ':',
- 'a', 'a', ':', 'b', 'i', 'n', '>', 'm', 'a', 'p', '#', '1', '<', '\'', 'A', 'B',
- 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'V',
- 'W', 'X', 'Y', 'Z', 'U', '*', '\'', ',', '[', '1', ',', '2', ',', '3', ',', '4',
- ',', '5', ',', '6', ',', '7', ',', '8', ',', '9', ',', '1', '0', ',', '1', '1', ',',
- '1', '2', ',', '1', '3', ',', '1', '4', ',', '1', '5', ',', '1', '6', ',', '1', '7',
- ',', '1', '8', ',', '1', '9', ',', '2', '0', ',', '2', '1', ',', '2', '2', ',', '2',
- '3', ',', '2', '4', ',', '2', '5', ']', '>', '(', 'i', 'n', '_', 'p', 'r', 'o', 't',
- 'e', 'i', 'n', '_', 't', 'e', 'x', 't', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'a',
- 'a', ':', 'b', 'i', 'n', ' ', 'o', 'u', 't', '_', 'a', 'a', '_', 'b', 'i', 'n', '=',
- '.', 'P', 'R', 'O', 'T', 'E', 'I', 'N', ';', 'I', 'N', 'S', 'D', 'C', ':', 'p', 'r',
- 'o', 't', 'e', 'i', 'n', ':', 't', 'e', 'x', 't', ' ', 'o', 'u', 't', '_', 'p', 'r',
- 'o', 't', 'e', 'i', 'n', '_', 't', 'e', 'x', 't', '=', '<', 'I', 'N', 'S', 'D', 'C',
- ':', 'a', 'a', ':', 'b', 'i', 'n', ',', 'I', 'N', 'S', 'D', 'C', ':', 'p', 'r', 'o',
- 't', 'e', 'i', 'n', ':', 't', 'e', 'x', 't', '>', 'm', 'a', 'p', '#', '1', '<', '[',
- '1', ',', '2', ',', '3', ',', '4', ',', '5', ',', '6', ',', '7', ',', '8', ',', '9',
- ',', '1', '0', ',', '1', '1', ',', '1', '2', ',', '1', '3', ',', '1', '4', ',', '1',
- '5', ',', '1', '6', ',', '1', '7', ',', '1', '8', ',', '1', '9', ',', '2', '0', ',',
- '2', '1', ',', '2', '2', ',', '2', '3', ',', '2', '4', ',', '2', '5', ']', ',', '\'',
- 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S',
- 'T', 'V', 'W', 'X', 'Y', 'Z', 'U', '*', '\'', '>', '(', 'o', 'u', 't', '_', 'a',
- 'a', '_', 'b', 'i', 'n', ')', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c',
- 'o', 'l', 'u', 'm', 'n', ' ', '<', 'I', 'N', 'S', 'D', 'C', ':', 'a', 'a', ':', 'b',
- 'i', 'n', '>', 'z', 'i', 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '#', '1',
- ' ', '.', 'P', 'R', 'O', 'T', 'E', 'I', 'N', '=', 'i', 'n', '_', 'a', 'a', '_', 'b',
- 'i', 'n', ';', '}', 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 't', 'b',
- 'l', ':', 'p', 'h', 'r', 'e', 'd', '_', 'q', 'u', 'a', 'l', 'i', 't', 'y', '_', 'n',
- 'o', 'c', 'o', 'l', '#', '1', '.', '0', '.', '1', '=', 'I', 'N', 'S', 'D', 'C', ':',
- 't', 'b', 'l', ':', 's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', '#', '1', '.', '0', '.',
- '1', ',', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':', 'n', '_', 'e', 'n', 'c', 'o',
- 'd', 'i', 'n', 'g', '#', '1', '{', 'U', '8', ' ', 'r', 'e', 'a', 'd', '_', 'n', 'd',
- 'e', 'c', 'o', 'd', 'e', '=', '<', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l',
- 'i', 't', 'y', ':', 'p', 'h', 'r', 'e', 'd', ',', 'U', '8', '>', 'm', 'a', 'p', '#',
- '1', '<', '0', ',', '4', '>', '(', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '_', 'p',
- 'h', 'r', 'e', 'd', ',', 'r', 'e', 'a', 'd', '_', 'u', 'n', 'p', 'a', 'c', 'k', ')',
- ';', '}', 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':',
- 'p', 'h', 'r', 'e', 'd', '_', 'q', 'u', 'a', 'l', 'i', 't', 'y', '#', '1', '.', '0',
- '.', '1', '=', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':', 'p', 'h', 'r', 'e', 'd',
- '_', 'q', 'u', 'a', 'l', 'i', 't', 'y', '_', 'n', 'o', 'c', 'o', 'l', '#', '1', '.',
- '0', '.', '1', '{', 'N', 'C', 'B', 'I', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':',
- 'n', '_', 'e', 'n', 'c', 'o', 'd', 'e', 'd', ':', 'p', 'h', 'r', 'e', 'd', ' ', 'o',
- 'u', 't', '_', 'q', 'u', 'a', 'l', '_', 'p', 'h', 'r', 'e', 'd', '=', '.', 'Q', 'U',
- 'A', 'L', 'I', 'T', 'Y', ';', '}', 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I',
- ':', 't', 'b', 'l', ':', 'p', 'h', 'r', 'e', 'd', '_', 'q', 'u', 'a', 'l', 'i', 't',
- 'y', '#', '2', '.', '0', '.', '4', '=', 'I', 'N', 'S', 'D', 'C', ':', 't', 'b', 'l',
- ':', 's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', '#', '1', '.', '0', '.', '1', '{', 'I',
- 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'p', 'h', 'r', 'e',
- 'd', ' ', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '_', 'p', 'h', 'r', 'e', 'd', '=',
- '.', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', ';', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u',
- 'a', 'l', 'i', 't', 'y', ':', 't', 'e', 'x', 't', ':', 'p', 'h', 'r', 'e', 'd', '_',
- '3', '3', ' ', 'i', 'n', '_', 'q', 'u', 'a', 'l', '_', 't', 'e', 'x', 't', '_', 'p',
- 'h', 'r', 'e', 'd', '_', '3', '3', '=', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', ';', 'I',
- 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 't', 'e', 'x', 't',
- ':', 'p', 'h', 'r', 'e', 'd', '_', '6', '4', ' ', 'i', 'n', '_', 'q', 'u', 'a', 'l',
- '_', 't', 'e', 'x', 't', '_', 'p', 'h', 'r', 'e', 'd', '_', '6', '4', '=', 'Q', 'U',
- 'A', 'L', 'I', 'T', 'Y', ';', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i',
- 't', 'y', ':', 'p', 'h', 'r', 'e', 'd', ' ', 'i', 'n', '_', 'q', 'u', 'a', 'l', '_',
- 'p', 'h', 'r', 'e', 'd', '=', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', '|', '(', 'I', 'N',
- 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'p', 'h', 'r', 'e', 'd',
- ')', '<', 'B', '8', '>', 'd', 'i', 'f', 'f', '#', '1', '<', '3', '3', '>', '(', 'i',
- 'n', '_', 'q', 'u', 'a', 'l', '_', 't', 'e', 'x', 't', '_', 'p', 'h', 'r', 'e', 'd',
- '_', '3', '3', ')', '|', '(', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i',
- 't', 'y', ':', 'p', 'h', 'r', 'e', 'd', ')', '<', 'B', '8', '>', 'd', 'i', 'f', 'f',
- '#', '1', '<', '6', '4', '>', '(', 'i', 'n', '_', 'q', 'u', 'a', 'l', '_', 't', 'e',
- 'x', 't', '_', 'p', 'h', 'r', 'e', 'd', '_', '6', '4', ')', ';', 'I', 'N', 'S', 'D',
- 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'p', 'h', 'r', 'e', 'd', ' ', 'i',
- 'n', '_', 's', 't', 'a', 't', 's', '_', 'q', 'u', 'a', 'l', '=', 'i', 'n', '_', 'q',
- 'u', 'a', 'l', '_', 'p', 'h', 'r', 'e', 'd', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a',
- 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', '<', 'I', 'N', 'S', 'D', 'C', ':', 'q',
- 'u', 'a', 'l', 'i', 't', 'y', ':', 'p', 'h', 'r', 'e', 'd', '>', 'z', 'i', 'p', '_',
- 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '#', '1', ' ', '.', 'Q', 'U', 'A', 'L', 'I',
- 'T', 'Y', '=', 'i', 'n', '_', 'q', 'u', 'a', 'l', '_', 'p', 'h', 'r', 'e', 'd', ';',
- '}', 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':', 'l',
- 'o', 'g', '_', 'o', 'd', 'd', 's', '_', 'q', 'u', 'a', 'l', 'i', 't', 'y', '_', 'n',
- 'o', 'c', 'o', 'l', '#', '1', '.', '0', '.', '1', '=', 'I', 'N', 'S', 'D', 'C', ':',
- 't', 'b', 'l', ':', 's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', '#', '1', '.', '0', '.',
- '1', ',', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':', 'n', '_', 'e', 'n', 'c', 'o',
- 'd', 'i', 'n', 'g', '#', '1', '{', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S',
- 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'l', 'o', 'g', '_', 'o', 'd',
- 'd', 's', ' ', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', ' ', '=', ' ', 'o', 'u', 't', '_',
- 'q', 'u', 'a', 'l', '_', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', ';', 'U', '8', ' ',
- 'r', 'e', 'a', 'd', '_', 'n', 'd', 'e', 'c', 'o', 'd', 'e', '=', '<', 'I', 'N', 'S',
- 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'l', 'o', 'g', '_', 'o', 'd',
- 'd', 's', ',', 'U', '8', '>', 'm', 'a', 'p', '#', '1', '<', '-', '6', ',', '4', '>',
- '(', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '_', 'l', 'o', 'g', '_', 'o', 'd', 'd',
- 's', ',', 'r', 'e', 'a', 'd', '_', 'u', 'n', 'p', 'a', 'c', 'k', ')', ';', 'I', 'N',
- 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'p', 'h', 'r', 'e', 'd',
- ' ', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '_', 'p', 'h', 'r', 'e', 'd', '=', 'o',
- 'u', 't', '_', 'q', 'u', 'a', 'l', '2', '_', 'p', 'h', 'r', 'e', 'd', '|', 'N', 'C',
- 'B', 'I', ':', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', '_', 't', 'o', '_', 'p', 'h',
- 'r', 'e', 'd', '#', '1', '(', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '_', 'l', 'o',
- 'g', '_', 'o', 'd', 'd', 's', ')', ';', '}', 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C',
- 'B', 'I', ':', 't', 'b', 'l', ':', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', '_', 'q',
- 'u', 'a', 'l', 'i', 't', 'y', '#', '1', '.', '0', '.', '1', '=', 'N', 'C', 'B', 'I',
- ':', 't', 'b', 'l', ':', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', '_', 'q', 'u', 'a',
- 'l', 'i', 't', 'y', '_', 'n', 'o', 'c', 'o', 'l', '#', '1', '.', '0', '.', '1', '{',
- 'N', 'C', 'B', 'I', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'n', '_', 'e', 'n',
- 'c', 'o', 'd', 'e', 'd', ':', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', ' ', 'o', 'u',
- 't', '_', 'q', 'u', 'a', 'l', '_', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', '=', '.',
- 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', ';', '}', 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C',
- 'B', 'I', ':', 't', 'b', 'l', ':', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', '_', 'q',
- 'u', 'a', 'l', 'i', 't', 'y', '_', 'n', 'o', 'c', 'o', 'l', '#', '2', '.', '0', '.',
- '1', '=', 'I', 'N', 'S', 'D', 'C', ':', 't', 'b', 'l', ':', 's', 'e', 'q', 'u', 'e',
- 'n', 'c', 'e', '#', '1', '.', '0', '.', '1', '{', 'c', 'o', 'l', 'u', 'm', 'n', ' ',
- 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'l', 'o', 'g',
- '_', 'o', 'd', 'd', 's', ' ', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', ' ', '=', ' ', 'o',
- 'u', 't', '_', 'q', 'u', 'a', 'l', '_', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', ';',
- 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'p', 'h', 'r',
- 'e', 'd', ' ', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '_', 'p', 'h', 'r', 'e', 'd',
- '=', 'N', 'C', 'B', 'I', ':', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', '_', 't', 'o',
- '_', 'p', 'h', 'r', 'e', 'd', '#', '1', '(', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l',
- '_', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', ')', ';', '}', 't', 'a', 'b', 'l', 'e',
- ' ', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':', 'l', 'o', 'g', '_', 'o', 'd', 'd',
- 's', '_', 'q', 'u', 'a', 'l', 'i', 't', 'y', '#', '2', '.', '0', '.', '4', '=', 'N',
- 'C', 'B', 'I', ':', 't', 'b', 'l', ':', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', '_',
- 'q', 'u', 'a', 'l', 'i', 't', 'y', '_', 'n', 'o', 'c', 'o', 'l', '#', '2', '.', '0',
- '.', '1', '{', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'q',
- 'u', 'a', 'l', 'i', 't', 'y', ':', 't', 'e', 'x', 't', ':', 'l', 'o', 'g', '_', 'o',
- 'd', 'd', 's', '_', '6', '4', ' ', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', ' ', '=', ' ',
- 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '_', 't', 'e', 'x', 't', '_', 'l', 'o', 'g',
- '_', 'o', 'd', 'd', 's', '_', '6', '4', '|', '(', 'I', 'N', 'S', 'D', 'C', ':', 'q',
- 'u', 'a', 'l', 'i', 't', 'y', ':', 't', 'e', 'x', 't', ':', 'l', 'o', 'g', '_', 'o',
- 'd', 'd', 's', '_', '6', '4', ')', '<', 'B', '8', '>', 's', 'u', 'm', '#', '1', '<',
- '6', '4', '>', '(', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '_', 'l', 'o', 'g', '_',
- 'o', 'd', 'd', 's', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i',
- 't', 'y', ':', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', ' ', 'o', 'u', 't', '_', 'q',
- 'u', 'a', 'l', '_', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', '=', '.', 'Q', 'U', 'A',
- 'L', 'I', 'T', 'Y', ';', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't',
- 'y', ':', 't', 'e', 'x', 't', ':', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', '_', '6',
- '4', ' ', 'i', 'n', '_', 'q', 'u', 'a', 'l', '_', 't', 'e', 'x', 't', '_', 'l', 'o',
- 'g', '_', 'o', 'd', 'd', 's', '_', '6', '4', '=', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y',
- ';', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'l', 'o',
- 'g', '_', 'o', 'd', 'd', 's', ' ', 'i', 'n', '_', 'q', 'u', 'a', 'l', '_', 'l', 'o',
- 'g', '_', 'o', 'd', 'd', 's', '=', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', '|', '(', 'I',
- 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'l', 'o', 'g', '_',
- 'o', 'd', 'd', 's', ')', '<', 'B', '8', '>', 'd', 'i', 'f', 'f', '#', '1', '<', '6',
- '4', '>', '(', 'i', 'n', '_', 'q', 'u', 'a', 'l', '_', 't', 'e', 'x', 't', '_', 'l',
- 'o', 'g', '_', 'o', 'd', 'd', 's', '_', '6', '4', ')', ';', 'I', 'N', 'S', 'D', 'C',
- ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's',
- ' ', 'i', 'n', '_', 's', 't', 'a', 't', 's', '_', 'q', 'u', 'a', 'l', '=', 'i', 'n',
- '_', 'q', 'u', 'a', 'l', '_', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', ';', 'p', 'h',
- 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', '<', 'I', 'N',
- 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'l', 'o', 'g', '_', 'o',
- 'd', 'd', 's', '>', 'z', 'i', 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '#',
- '1', ' ', '.', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', '=', 'i', 'n', '_', 'q', 'u', 'a',
- 'l', '_', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', ';', '}', 't', 'a', 'b', 'l', 'e',
- ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'p', 'o',
- 't', 'c', 'o', 'o', 'r', 'd', '#', '1', '=', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R',
- 'A', ':', 't', 'b', 'l', ':', 's', 'p', 'o', 't', 'c', 'o', 'o', 'r', 'd', '#', '1',
- '{', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', ' ',
- 'o', 'u', 't', '_', 'x', '_', 'c', 'o', 'o', 'r', 'd', '=', '.', 'X', ';', 'I', 'N',
- 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', ' ', 'o', 'u', 't',
- '_', 'y', '_', 'c', 'o', 'o', 'r', 'd', '=', '.', 'Y', ';', 'I', 'N', 'S', 'D', 'C',
- ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', ' ', 'o', 'u', 't', '_', 't', '_',
- 'c', 'o', 'o', 'r', 'd', '=', '.', 'T', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o',
- 'o', 'r', 'd', ':', 'v', 'a', 'l', ' ', 'o', 'u', 't', '_', 'l', '_', 'c', 'o', 'o',
- 'r', 'd', '=', '.', 'L', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o',
- 'l', 'u', 'm', 'n', ' ', '<', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd',
- ':', 'v', 'a', 'l', '>', 'i', 'z', 'i', 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n',
- 'g', '#', '1', ' ', '.', 'X', '=', 'i', 'n', '_', 'x', '_', 'c', 'o', 'o', 'r', 'd',
- '|', 'i', 'n', '_', 'n', 'a', 'm', 'e', '_', 'x', '_', 'c', 'o', 'o', 'r', 'd', ';',
- 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', '<',
- 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', '>', 'i',
- 'z', 'i', 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '#', '1', ' ', '.', 'Y',
- '=', 'i', 'n', '_', 'y', '_', 'c', 'o', 'o', 'r', 'd', '|', 'i', 'n', '_', 'n', 'a',
- 'm', 'e', '_', 'y', '_', 'c', 'o', 'o', 'r', 'd', ';', 'p', 'h', 'y', 's', 'i', 'c',
- 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', '<', 'I', 'N', 'S', 'D', 'C', ':',
- 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', '>', 'i', 'z', 'i', 'p', '_', 'e', 'n',
- 'c', 'o', 'd', 'i', 'n', 'g', '#', '1', ' ', '.', 'T', '=', 'i', 'n', '_', 't', '_',
- 'c', 'o', 'o', 'r', 'd', '|', 'i', 'n', '_', 'n', 'a', 'm', 'e', '_', 't', '_', 'c',
- 'o', 'o', 'r', 'd', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o', 'l',
- 'u', 'm', 'n', ' ', '<', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':',
- 'v', 'a', 'l', '>', 'i', 'z', 'i', 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g',
- '#', '1', ' ', '.', 'L', '=', 'i', 'n', '_', 'l', '_', 'c', 'o', 'o', 'r', 'd', '|',
- 'i', 'n', '_', 'n', 'a', 'm', 'e', '_', 'l', '_', 'c', 'o', 'o', 'r', 'd', ';', '}',
- 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b',
- 'l', ':', 's', 'k', 'e', 'y', 'n', 'a', 'm', 'e', '#', '1', '.', '0', '.', '1', '=',
- 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'p', 'o',
- 't', 'n', 'a', 'm', 'e', '#', '1', '.', '0', '.', '1', '{', 'a', 's', 'c', 'i', 'i',
- ' ', 'o', 'u', 't', '_', 's', 'k', 'e', 'y', '=', '(', 'a', 's', 'c', 'i', 'i', ')',
- 'i', 'd', 'x', ':', 't', 'e', 'x', 't', ':', 'p', 'r', 'o', 'j', 'e', 'c', 't', '#',
- '1', '<', '\'', 's', 'k', 'e', 'y', '\'', '>', '(', ')', ';', 'a', 's', 'c', 'i',
- 'i', ' ', 'o', 'u', 't', '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '=', 'r',
- 'e', 'w', 'r', 'i', 't', 't', 'e', 'n', '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm',
- 'e', '|', 'o', 'u', 't', '_', 's', 'k', 'e', 'y', ';', 'I', 'N', 'S', 'D', 'C', ':',
- 'S', 'R', 'A', ':', 's', 'p', 'o', 't', '_', 'i', 'd', 's', '_', 'f', 'o', 'u', 'n',
- 'd', ' ', 's', 'p', 'o', 't', '_', 'i', 'd', 's', '_', 'f', 'o', 'u', 'n', 'd', '=',
- '(', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 's', 'p', 'o', 't', '_', 'i',
- 'd', 's', '_', 'f', 'o', 'u', 'n', 'd', ')', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A',
- ':', 'l', 'o', 'o', 'k', 'u', 'p', '#', '1', '<', '\'', 's', 'k', 'e', 'y', '\'',
- ',', '\'', 'Q', 'U', 'E', 'R', 'Y', '_', 'B', 'Y', '_', 'N', 'A', 'M', 'E', '\'',
- ',', '1', '>', '(', 'o', 'u', 't', '_', 's', 'l', 'x', '_', 'p', 'r', 'e', 'f', 'i',
- 'x', ')', '|', '(', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 's', 'p', 'o',
- 't', '_', 'i', 'd', 's', '_', 'f', 'o', 'u', 'n', 'd', ')', 'N', 'C', 'B', 'I', ':',
- 'S', 'R', 'A', ':', 'l', 'o', 'o', 'k', 'u', 'p', '#', '1', '<', '\'', 's', 'k',
- 'e', 'y', '\'', ',', '\'', 'Q', 'U', 'E', 'R', 'Y', '_', 'B', 'Y', '_', 'N', 'A',
- 'M', 'E', '\'', ',', '0', '>', '(', ')', ';', '}', 't', 'a', 'b', 'l', 'e', ' ',
- 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'k', 'e', 'y',
- 'n', 'a', 'm', 'e', '_', 'n', 'o', 'c', 'o', 'l', '#', '2', '.', '0', '.', '1', '=',
- 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'p', 'o',
- 't', 'n', 'a', 'm', 'e', '#', '1', '.', '0', '.', '1', '{', 'a', 's', 'c', 'i', 'i',
- ' ', 'o', 'u', 't', '_', 'n', 'a', 'm', 'e', '_', 'f', 'm', 't', '=', '(', 'a', 's',
- 'c', 'i', 'i', ')', 'i', 'd', 'x', ':', 't', 'e', 'x', 't', ':', 'p', 'r', 'o', 'j',
- 'e', 'c', 't', '#', '1', '<', '\'', 's', 'k', 'e', 'y', '\'', '>', '(', ')', ';',
- 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 's', 'p', 'o', 't', '_', 'i', 'd',
- 's', '_', 'f', 'o', 'u', 'n', 'd', ' ', 's', 'p', 'o', 't', '_', 'i', 'd', 's', '_',
- 'f', 'o', 'u', 'n', 'd', '=', '(', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':',
- 's', 'p', 'o', 't', '_', 'i', 'd', 's', '_', 'f', 'o', 'u', 'n', 'd', ')', 'N', 'C',
- 'B', 'I', ':', 'S', 'R', 'A', ':', 'l', 'o', 'o', 'k', 'u', 'p', '#', '1', '<', '\'',
- 's', 'k', 'e', 'y', '\'', ',', '\'', 'Q', 'U', 'E', 'R', 'Y', '_', 'B', 'Y', '_',
- 'N', 'A', 'M', 'E', '\'', ',', '2', '>', '(', 'o', 'u', 't', '_', 's', 'l', 'x',
- '_', 'p', 'r', 'e', 'f', 'i', 'x', ')', '|', '(', 'I', 'N', 'S', 'D', 'C', ':', 'S',
- 'R', 'A', ':', 's', 'p', 'o', 't', '_', 'i', 'd', 's', '_', 'f', 'o', 'u', 'n', 'd',
- ')', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'l', 'o', 'o', 'k', 'u', 'p', '#',
- '1', '<', '\'', 's', 'k', 'e', 'y', '\'', ',', '\'', 'Q', 'U', 'E', 'R', 'Y', '_',
- 'B', 'Y', '_', 'N', 'A', 'M', 'E', '\'', ',', '2', '>', '(', ')', ';', 'I', 'N',
- 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', ' ', 'o', 'u', 't',
- '_', 'x', '_', 'c', 'o', 'o', 'r', 'd', '=', 'c', 'a', 's', 't', '#', '1', '(', '.',
- 'X', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a',
- 'l', ' ', 'o', 'u', 't', '_', 'y', '_', 'c', 'o', 'o', 'r', 'd', '=', 'c', 'a', 's',
- 't', '#', '1', '(', '.', 'Y', ')', ';', '}', 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C',
- 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'k', 'e', 'y', 'n', 'a',
- 'm', 'e', '#', '2', '.', '0', '.', '1', '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A',
- ':', 't', 'b', 'l', ':', 's', 'k', 'e', 'y', 'n', 'a', 'm', 'e', '_', 'n', 'o', 'c',
- 'o', 'l', '#', '2', '.', '0', '.', '1', '{', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l',
- ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', '<', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o',
- 'o', 'r', 'd', ':', 'v', 'a', 'l', '>', 'i', 'z', 'i', 'p', '_', 'e', 'n', 'c', 'o',
- 'd', 'i', 'n', 'g', '#', '1', ' ', '.', 'X', '=', 'N', 'C', 'B', 'I', ':', 'S', 'R',
- 'A', ':', 'e', 'x', 't', 'r', 'a', 'c', 't', '_', 'n', 'a', 'm', 'e', '_', 'c', 'o',
- 'o', 'r', 'd', '#', '1', '<', '4', '>', '(', 'N', 'A', 'M', 'E', ',', 'i', 'n', '_',
- 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '_', 't', 'o', 'k', ')', ';', 'p', 'h',
- 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', '<', 'I', 'N',
- 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', '>', 'i', 'z', 'i',
- 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '#', '1', ' ', '.', 'Y', '=', 'N',
- 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'e', 'x', 't', 'r', 'a', 'c', 't', '_', 'n',
- 'a', 'm', 'e', '_', 'c', 'o', 'o', 'r', 'd', '#', '1', '<', '5', '>', '(', 'N', 'A',
- 'M', 'E', ',', 'i', 'n', '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '_', 't',
- 'o', 'k', ')', ';', '}', 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S',
- 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'k', 'e', 'y', 'n', 'a', 'm', 'e', '#', '3',
- '.', '0', '.', '1', '=', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 't', 'b',
- 'l', ':', 's', 'p', 'o', 't', 'n', 'a', 'm', 'e', '#', '1', '.', '0', '.', '1', ',',
- 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'p', 'o', 't',
- 'c', 'o', 'o', 'r', 'd', '#', '1', '{', 'a', 's', 'c', 'i', 'i', ' ', 'o', 'u', 't',
- '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '=', '.', 'S', 'P', 'O', 'T', '_',
- 'N', 'A', 'M', 'E', ';', 'a', 's', 'c', 'i', 'i', ' ', 'o', 'u', 't', '_', 'n', 'a',
- 'm', 'e', '_', 'f', 'm', 't', '=', '(', 'a', 's', 'c', 'i', 'i', ')', 'i', 'd', 'x',
- ':', 't', 'e', 'x', 't', ':', 'p', 'r', 'o', 'j', 'e', 'c', 't', '#', '1', '<', '\'',
- 's', 'k', 'e', 'y', '\'', '>', '(', '.', 'N', 'A', 'M', 'E', '_', 'F', 'M', 'T',
- ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 's', 'p', 'o', 't', '_',
- 'i', 'd', 's', '_', 'f', 'o', 'u', 'n', 'd', ' ', 's', 'p', 'o', 't', '_', 'i', 'd',
- 's', '_', 'f', 'o', 'u', 'n', 'd', '=', '(', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R',
- 'A', ':', 's', 'p', 'o', 't', '_', 'i', 'd', 's', '_', 'f', 'o', 'u', 'n', 'd', ')',
- 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'l', 'o', 'o', 'k', 'u', 'p', '#', '1',
- '<', '\'', 's', 'k', 'e', 'y', '\'', ',', '\'', 'Q', 'U', 'E', 'R', 'Y', '_', 'B',
- 'Y', '_', 'N', 'A', 'M', 'E', '\'', ',', '2', '>', '(', ')', ';', 'I', 'N', 'S',
- 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', ' ', 'i', 'n', '_', 'n',
- 'a', 'm', 'e', '_', 'x', '_', 'c', 'o', 'o', 'r', 'd', '=', 'N', 'C', 'B', 'I', ':',
- 'S', 'R', 'A', ':', 'e', 'x', 't', 'r', 'a', 'c', 't', '_', 'n', 'a', 'm', 'e', '_',
- 'c', 'o', 'o', 'r', 'd', '#', '1', '<', '4', '>', '(', 'N', 'A', 'M', 'E', ',', 'i',
- 'n', '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '_', 't', 'o', 'k', ')', ';',
- 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', ' ', 'i',
- 'n', '_', 'n', 'a', 'm', 'e', '_', 'y', '_', 'c', 'o', 'o', 'r', 'd', '=', 'N', 'C',
- 'B', 'I', ':', 'S', 'R', 'A', ':', 'e', 'x', 't', 'r', 'a', 'c', 't', '_', 'n', 'a',
- 'm', 'e', '_', 'c', 'o', 'o', 'r', 'd', '#', '1', '<', '5', '>', '(', 'N', 'A', 'M',
- 'E', ',', 'i', 'n', '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '_', 't', 'o',
- 'k', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a',
- 'l', ' ', 'i', 'n', '_', 'n', 'a', 'm', 'e', '_', 't', '_', 'c', 'o', 'o', 'r', 'd',
- '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'e', 'x', 't', 'r', 'a', 'c', 't',
- '_', 'n', 'a', 'm', 'e', '_', 'c', 'o', 'o', 'r', 'd', '#', '1', '<', '6', '>', '(',
- 'N', 'A', 'M', 'E', ',', 'i', 'n', '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e',
- '_', 't', 'o', 'k', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd',
- ':', 'v', 'a', 'l', ' ', 'i', 'n', '_', 'n', 'a', 'm', 'e', '_', 'l', '_', 'c', 'o',
- 'o', 'r', 'd', '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'e', 'x', 't', 'r',
- 'a', 'c', 't', '_', 'n', 'a', 'm', 'e', '_', 'c', 'o', 'o', 'r', 'd', '#', '1', '<',
- '7', '>', '(', 'N', 'A', 'M', 'E', ',', 'i', 'n', '_', 's', 'p', 'o', 't', '_', 'n',
- 'a', 'm', 'e', '_', 't', 'o', 'k', ')', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l',
- ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', '<', 'a', 's', 'c', 'i', 'i', '>', 'z', 'i',
- 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '#', '1', ' ', '.', 'S', 'P', 'O',
- 'T', '_', 'N', 'A', 'M', 'E', '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'e',
- 'x', 't', 'r', 'a', 'c', 't', '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '#',
- '1', '(', 'N', 'A', 'M', 'E', ',', 'i', 'n', '_', 's', 'p', 'o', 't', '_', 'n', 'a',
- 'm', 'e', '_', 't', 'o', 'k', ')', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ',
- 'c', 'o', 'l', 'u', 'm', 'n', ' ', '<', 'a', 's', 'c', 'i', 'i', '>', 'z', 'i', 'p',
- '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '#', '1', ' ', '.', 'N', 'A', 'M', 'E',
- '_', 'F', 'M', 'T', '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'e', 'x', 't',
- 'r', 'a', 'c', 't', '_', 'n', 'a', 'm', 'e', '_', 'f', 'm', 't', '#', '1', '<', '\'',
- 's', 'k', 'e', 'y', '\'', '>', '(', 'N', 'A', 'M', 'E', ',', 'i', 'n', '_', 's',
- 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '_', 't', 'o', 'k', ')', ';', '}', 't', 'a',
- 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':',
- 's', 't', 'a', 't', 's', '#', '1', '.', '2', '=', 'I', 'N', 'S', 'D', 'C', ':', 'S',
- 'R', 'A', ':', 't', 'b', 'l', ':', 's', 't', 'a', 't', 's', '#', '1', '.', '1', ',',
- 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'r', 'a',
- '#', '1', '.', '0', '.', '3', '{', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':',
- 's', 'p', 'o', 't', 'i', 'd', '_', 't', ' ', 'm', 'i', 'n', '_', 's', 'p', 'o', 't',
- '_', 'i', 'd', '=', '<', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 's', 'p',
- 'o', 't', 'i', 'd', '_', 't', '>', 'm', 'e', 't', 'a', ':', 'v', 'a', 'l', 'u', 'e',
- '#', '1', '<', '\'', 'S', 'T', 'A', 'T', 'S', '/', 'T', 'A', 'B', 'L', 'E', '/',
- 'S', 'P', 'O', 'T', '_', 'M', 'I', 'N', '\'', '>', '(', ')', ';', 'I', 'N', 'S',
- 'D', 'C', ':', 'S', 'R', 'A', ':', 's', 'p', 'o', 't', 'i', 'd', '_', 't', ' ', 'm',
- 'a', 'x', '_', 's', 'p', 'o', 't', '_', 'i', 'd', '=', '<', 'I', 'N', 'S', 'D', 'C',
- ':', 'S', 'R', 'A', ':', 's', 'p', 'o', 't', 'i', 'd', '_', 't', '>', 'm', 'e', 't',
- 'a', ':', 'v', 'a', 'l', 'u', 'e', '#', '1', '<', '\'', 'S', 'T', 'A', 'T', 'S',
- '/', 'T', 'A', 'B', 'L', 'E', '/', 'S', 'P', 'O', 'T', '_', 'M', 'A', 'X', '\'',
- '>', '(', ')', ';', 'U', '6', '4', ' ', 's', 'p', 'o', 't', '_', 'c', 'o', 'u', 'n',
- 't', '=', '<', 'U', '6', '4', '>', 'm', 'e', 't', 'a', ':', 'v', 'a', 'l', 'u', 'e',
- '#', '1', '<', '\'', 'S', 'T', 'A', 'T', 'S', '/', 'T', 'A', 'B', 'L', 'E', '/',
- 'S', 'P', 'O', 'T', '_', 'C', 'O', 'U', 'N', 'T', '\'', '>', '(', ')', ';', 'U',
- '6', '4', ' ', 'b', 'a', 's', 'e', '_', 'c', 'o', 'u', 'n', 't', '=', '<', 'U', '6',
- '4', '>', 'm', 'e', 't', 'a', ':', 'v', 'a', 'l', 'u', 'e', '#', '1', '<', '\'',
- 'S', 'T', 'A', 'T', 'S', '/', 'T', 'A', 'B', 'L', 'E', '/', 'B', 'A', 'S', 'E', '_',
- 'C', 'O', 'U', 'N', 'T', '\'', '>', '(', ')', ';', 'U', '6', '4', ' ', 'b', 'i',
- 'o', '_', 'b', 'a', 's', 'e', '_', 'c', 'o', 'u', 'n', 't', '=', '<', 'U', '6', '4',
- '>', 'm', 'e', 't', 'a', ':', 'v', 'a', 'l', 'u', 'e', '#', '1', '<', '\'', 'S',
- 'T', 'A', 'T', 'S', '/', 'T', 'A', 'B', 'L', 'E', '/', 'B', 'I', 'O', '_', 'B', 'A',
- 'S', 'E', '_', 'C', 'O', 'U', 'N', 'T', '\'', '>', '(', ')', ';', 'U', '6', '4',
- ' ', 'c', 'm', 'p', '_', 'b', 'a', 's', 'e', '_', 'c', 'o', 'u', 'n', 't', '=', '<',
- 'U', '6', '4', '>', 'm', 'e', 't', 'a', ':', 'v', 'a', 'l', 'u', 'e', '#', '1', '<',
- '\'', 'S', 'T', 'A', 'T', 'S', '/', 'T', 'A', 'B', 'L', 'E', '/', 'C', 'M', 'P',
- '_', 'B', 'A', 'S', 'E', '_', 'C', 'O', 'U', 'N', 'T', '\'', '>', '(', ')', '|',
- 'b', 'a', 's', 'e', '_', 'c', 'o', 'u', 'n', 't', ';', 't', 'r', 'i', 'g', 'g', 'e',
- 'r', ' ', 'm', 'e', 't', 'a', '_', 's', 't', 'a', 't', 's', '=', 'N', 'C', 'B', 'I',
- ':', 'S', 'R', 'A', ':', 's', 't', 'a', 't', 's', '_', 't', 'r', 'i', 'g', 'g', 'e',
- 'r', '#', '1', '(', 'i', 'n', '_', 's', 't', 'a', 't', 's', '_', 'b', 'i', 'n', ',',
- 'i', 'n', '_', 'r', 'e', 'a', 'd', '_', 'l', 'e', 'n', ',', 'i', 'n', '_', 'r', 'e',
- 'a', 'd', '_', 't', 'y', 'p', 'e', ',', 'i', 'n', '_', 's', 'p', 'o', 't', '_', 'g',
- 'r', 'o', 'u', 'p', ')', '|', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 't',
- 'a', 't', 's', '_', 't', 'r', 'i', 'g', 'g', 'e', 'r', '#', '1', '(', 'i', 'n', '_',
- 's', 't', 'a', 't', 's', '_', 'b', 'i', 'n', ',', 'i', 'n', '_', 'r', 'e', 'a', 'd',
- '_', 'l', 'e', 'n', ',', 'i', 'n', '_', 'r', 'e', 'a', 'd', '_', 't', 'y', 'p', 'e',
- ')', '|', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'c', 'm', 'p', '_', 's', 't',
- 'a', 't', 's', '_', 't', 'r', 'i', 'g', 'g', 'e', 'r', '#', '1', '(', 'i', 'n', '_',
- 'c', 'm', 'p', '_', 's', 't', 'a', 't', 's', '_', 'b', 'i', 'n', ',', 'i', 'n', '_',
- 's', 't', 'a', 't', 's', '_', 'q', 'u', 'a', 'l', ',', 'i', 'n', '_', 'r', 'e', 'a',
- 'd', '_', 'l', 'e', 'n', ',', 'i', 'n', '_', 'r', 'e', 'a', 'd', '_', 't', 'y', 'p',
- 'e', ',', 'i', 'n', '_', 's', 'p', 'o', 't', '_', 'g', 'r', 'o', 'u', 'p', ')', '|',
- 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'c', 'm', 'p', '_', 's', 't', 'a', 't',
- 's', '_', 't', 'r', 'i', 'g', 'g', 'e', 'r', '#', '1', '(', 'i', 'n', '_', 'c', 'm',
- 'p', '_', 's', 't', 'a', 't', 's', '_', 'b', 'i', 'n', ',', 'i', 'n', '_', 's', 't',
- 'a', 't', 's', '_', 'q', 'u', 'a', 'l', ',', 'i', 'n', '_', 'r', 'e', 'a', 'd', '_',
- 'l', 'e', 'n', ',', 'i', 'n', '_', 'r', 'e', 'a', 'd', '_', 't', 'y', 'p', 'e', ')',
- '|', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'c', 'm', 'p', 'f', '_', 's', 't',
- 'a', 't', 's', '_', 't', 'r', 'i', 'g', 'g', 'e', 'r', '#', '1', '(', 'i', 'n', '_',
- 'c', 'm', 'p', '_', 's', 't', 'a', 't', 's', '_', 'b', 'i', 'n', ',', 'i', 'n', '_',
- 's', 'p', 'o', 't', '_', 'l', 'e', 'n', ',', 'i', 'n', '_', 'r', 'e', 'a', 'd', '_',
- 'l', 'e', 'n', ',', 'i', 'n', '_', 'r', 'e', 'a', 'd', '_', 't', 'y', 'p', 'e', ',',
- 'i', 'n', '_', 's', 'p', 'o', 't', '_', 'g', 'r', 'o', 'u', 'p', ')', '|', 'N', 'C',
- 'B', 'I', ':', 'S', 'R', 'A', ':', 'c', 'm', 'p', 'f', '_', 's', 't', 'a', 't', 's',
- '_', 't', 'r', 'i', 'g', 'g', 'e', 'r', '#', '1', '(', 'i', 'n', '_', 'c', 'm', 'p',
- '_', 's', 't', 'a', 't', 's', '_', 'b', 'i', 'n', ',', 'i', 'n', '_', 's', 'p', 'o',
- 't', '_', 'l', 'e', 'n', ',', 'i', 'n', '_', 'r', 'e', 'a', 'd', '_', 'l', 'e', 'n',
- ',', 'i', 'n', '_', 'r', 'e', 'a', 'd', '_', 't', 'y', 'p', 'e', ')', ';', 't', 'r',
- 'i', 'g', 'g', 'e', 'r', ' ', 'q', 'u', 'a', 'l', '_', 's', 't', 'a', 't', 's', '=',
- 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'p', 'h', 'r', 'e', 'd', '_', 's', 't',
- 'a', 't', 's', '_', 't', 'r', 'i', 'g', 'g', 'e', 'r', '#', '1', '(', 'i', 'n', '_',
- 'q', 'u', 'a', 'l', '_', 'p', 'h', 'r', 'e', 'd', ')', ';', '}', 't', 'a', 'b', 'l',
- 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'p',
- 'o', 't', 'd', 'e', 's', 'c', '_', 'n', 'o', 'c', 'o', 'l', '#', '1', '.', '0', '.',
- '2', '=', 'I', 'N', 'S', 'D', 'C', ':', 't', 'b', 'l', ':', 's', 'e', 'q', 'u', 'e',
- 'n', 'c', 'e', '#', '1', '.', '0', '.', '1', ',', 'I', 'N', 'S', 'D', 'C', ':', 'S',
- 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'p', 'o', 't', 'd', 'e', 's', 'c', '#', '1',
- '.', '0', '.', '2', '{', 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o', 'l',
- 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'S', 'e', 'g', 'm',
- 'e', 'n', 't', ' ', 'L', 'A', 'B', 'E', 'L', '_', 'S', 'E', 'G', ' ', '=', ' ', 'o',
- 'u', 't', '_', 'l', 'a', 'b', 'e', 'l', '_', 's', 'e', 'g', '|', 'c', 'a', 's', 't',
- '#', '1', '(', 'o', 'u', 't', '_', 'l', 'a', 'b', 'e', 'l', '_', 's', 'e', 'g', '3',
- '2', ')', '|', 'c', 'a', 's', 't', '#', '1', '(', '_', 'o', 'u', 't', '_', 'l', 'a',
- 'b', 'e', 'l', '_', 's', 'e', 'g', '3', '2', ')', ';', 'r', 'e', 'a', 'd', 'o', 'n',
- 'l', 'y', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R',
- 'A', ':', 'S', 'e', 'g', 'm', 'e', 'n', 't', ' ', 'R', 'E', 'A', 'D', '_', 'S', 'E',
- 'G', ' ', '=', ' ', 'o', 'u', 't', '_', 'r', 'e', 'a', 'd', '_', 's', 'e', 'g', '|',
- 'c', 'a', 's', 't', '#', '1', '(', 'o', 'u', 't', '_', 'r', 'e', 'a', 'd', '_', 's',
- 'e', 'g', '3', '2', ')', '|', 'c', 'a', 's', 't', '#', '1', '(', '_', 'o', 'u', 't',
- '_', 'r', 'e', 'a', 'd', '_', 's', 'e', 'g', '3', '2', ')', ';', 'r', 'e', 'a', 'd',
- 'o', 'n', 'l', 'y', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':',
- 'S', 'R', 'A', ':', 'R', 'e', 'a', 'd', 'D', 'e', 's', 'c', ' ', 'R', 'E', 'A', 'D',
- '_', 'D', 'E', 'S', 'C', ' ', '=', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':',
- 'm', 'a', 'k', 'e', '_', 'r', 'e', 'a', 'd', '_', 'd', 'e', 's', 'c', '#', '1', '(',
- 'o', 'u', 't', '_', 'n', 'r', 'e', 'a', 'd', 's', ',', 'o', 'u', 't', '_', 'r', 'e',
- 'a', 'd', '_', 's', 't', 'a', 'r', 't', ',', 'o', 'u', 't', '_', 'r', 'e', 'a', 'd',
- '_', 'l', 'e', 'n', ',', 'o', 'u', 't', '_', 'r', 'e', 'a', 'd', '_', 't', 'y', 'p',
- 'e', ',', '_', 'o', 'u', 't', '_', 'r', 'd', '_', 'f', 'i', 'l', 't', 'e', 'r', ',',
- 'o', 'u', 't', '_', 'c', 's', '_', 'k', 'e', 'y', ',', '_', 'o', 'u', 't', '_', 'l',
- 'a', 'b', 'e', 'l', '_', 's', 't', 'a', 'r', 't', ',', '_', 'o', 'u', 't', '_', 'l',
- 'a', 'b', 'e', 'l', '_', 'l', 'e', 'n', ',', '_', 'o', 'u', 't', '_', 'l', 'a', 'b',
- 'e', 'l', ')', ';', 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o', 'l', 'u',
- 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'S', 'p', 'o', 't', 'D',
- 'e', 's', 'c', ' ', 'S', 'P', 'O', 'T', '_', 'D', 'E', 'S', 'C', ' ', '=', ' ', 'N',
- 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'm', 'a', 'k', 'e', '_', 's', 'p', 'o', 't',
- '_', 'd', 'e', 's', 'c', '#', '1', '(', 's', 'p', 'o', 't', '_', 'l', 'e', 'n', ',',
- 'f', 'i', 'x', 'e', 'd', '_', 's', 'p', 'o', 't', '_', 'l', 'e', 'n', ',', 's', 'i',
- 'g', 'n', 'a', 'l', '_', 'l', 'e', 'n', ',', 't', 'r', 'i', 'm', '_', 's', 't', 'a',
- 'r', 't', ',', 't', 'r', 'i', 'm', '_', 'l', 'e', 'n', ',', 'o', 'u', 't', '_', 'n',
- 'r', 'e', 'a', 'd', 's', ')', ';', 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y', ' ', 'c',
- 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd',
- ':', 'l', 'e', 'n', ' ', 'S', 'I', 'G', 'N', 'A', 'L', '_', 'L', 'E', 'N', ' ', '=',
- ' ', 's', 'i', 'g', 'n', 'a', 'l', '_', 'l', 'e', 'n', ';', 'r', 'e', 'a', 'd', 'o',
- 'n', 'l', 'y', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'U', '1', '6', ' ', 'S', 'I',
- 'G', 'N', 'A', 'L', '_', 'L', 'E', 'N', ' ', '=', ' ', 'c', 'a', 's', 't', '#', '1',
- '(', 's', 'i', 'g', 'n', 'a', 'l', '_', 'l', 'e', 'n', ')', ';', 'U', '3', '2', ' ',
- '_', 'o', 'u', 't', '_', 'l', 'a', 'b', 'e', 'l', '_', 's', 't', 'a', 'r', 't', 'U',
- '3', '2', '=', '(', 'U', '3', '2', ')', 'o', 'u', 't', '_', 'l', 'a', 'b', 'e', 'l',
- '_', 's', 't', 'a', 'r', 't', ';', 'U', '3', '2', '[', '2', ']', ' ', '_', 'o', 'u',
- 't', '_', 'l', 'a', 'b', 'e', 'l', '_', 's', 'e', 'g', '3', '2', '=', '<', 'U', '3',
- '2', '>', 'p', 'a', 's', 't', 'e', '#', '1', '(', '_', 'o', 'u', 't', '_', 'l', 'a',
- 'b', 'e', 'l', '_', 's', 't', 'a', 'r', 't', 'U', '3', '2', ',', 'o', 'u', 't', '_',
- 'l', 'a', 'b', 'e', 'l', '_', 'l', 'e', 'n', ')', ';', 'U', '3', '2', ' ', '_', 'o',
- 'u', 't', '_', 'r', 'e', 'a', 'd', '_', 's', 't', 'a', 'r', 't', 'U', '3', '2', '=',
- '(', 'U', '3', '2', ')', 'o', 'u', 't', '_', 'r', 'e', 'a', 'd', '_', 's', 't', 'a',
- 'r', 't', ';', 'U', '3', '2', '[', '2', ']', ' ', '_', 'o', 'u', 't', '_', 'r', 'e',
- 'a', 'd', '_', 's', 'e', 'g', '3', '2', '=', '<', 'U', '3', '2', '>', 'p', 'a', 's',
- 't', 'e', '#', '1', '(', '_', 'o', 'u', 't', '_', 'r', 'e', 'a', 'd', '_', 's', 't',
- 'a', 'r', 't', 'U', '3', '2', ',', 'o', 'u', 't', '_', 'r', 'e', 'a', 'd', '_', 'l',
- 'e', 'n', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'r', 'e', 'a',
- 'd', '_', 'f', 'i', 'l', 't', 'e', 'r', ' ', '_', 'o', 'u', 't', '_', 'r', 'd', '_',
- 'f', 'i', 'l', 't', 'e', 'r', '=', 'o', 'u', 't', '_', 'r', 'd', '_', 'f', 'i', 'l',
- 't', 'e', 'r', '|', '<', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'r', 'e',
- 'a', 'd', '_', 'f', 'i', 'l', 't', 'e', 'r', '>', 'e', 'c', 'h', 'o', '#', '1', '<',
- '0', '>', '(', 'o', 'u', 't', '_', 'r', 'e', 'a', 'd', '_', 's', 't', 'a', 'r', 't',
- ')', ';', 'a', 's', 'c', 'i', 'i', ' ', '_', 'o', 'u', 't', '_', 'l', 'a', 'b', 'e',
- 'l', '=', 'o', 'u', 't', '_', 'l', 'a', 'b', 'e', 'l', '|', '<', 'a', 's', 'c', 'i',
- 'i', '>', 'e', 'c', 'h', 'o', '#', '1', '<', '\'', '\'', '>', '(', ')', ';', 'I',
- 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o', ' ', '_',
- 'o', 'u', 't', '_', 'l', 'a', 'b', 'e', 'l', '_', 's', 't', 'a', 'r', 't', '=', 'o',
- 'u', 't', '_', 'l', 'a', 'b', 'e', 'l', '_', 's', 't', 'a', 'r', 't', '|', '<', 'I',
- 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o', '>', 'e',
- 'c', 'h', 'o', '#', '1', '<', '0', '>', '(', 'o', 'u', 't', '_', 'r', 'e', 'a', 'd',
- '_', 's', 't', 'a', 'r', 't', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o',
- 'r', 'd', ':', 'l', 'e', 'n', ' ', '_', 'o', 'u', 't', '_', 'l', 'a', 'b', 'e', 'l',
- '_', 'l', 'e', 'n', '=', 'o', 'u', 't', '_', 'l', 'a', 'b', 'e', 'l', '_', 'l', 'e',
- 'n', '|', '<', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l', 'e',
- 'n', '>', 'e', 'c', 'h', 'o', '#', '1', '<', '0', '>', '(', 'o', 'u', 't', '_', 'r',
- 'e', 'a', 'd', '_', 's', 't', 'a', 'r', 't', ')', ';', '}', 't', 'a', 'b', 'l', 'e',
- ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'p', 'o',
- 't', 'd', 'e', 's', 'c', '_', 'n', 'o', 'p', 'h', 'y', 's', '#', '1', '.', '0', '.',
- '2', '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'p',
- 'o', 't', 'd', 'e', 's', 'c', '_', 'n', 'o', 'c', 'o', 'l', '#', '1', '.', '0', '.',
- '2', '{', 'U', '8', ' ', 'o', 'u', 't', '_', 'n', 'r', 'e', 'a', 'd', 's', '=', '.',
- 'N', 'R', 'E', 'A', 'D', 'S', ';', 'a', 's', 'c', 'i', 'i', ' ', 'o', 'u', 't', '_',
- 'l', 'a', 'b', 'e', 'l', '=', '.', 'L', 'A', 'B', 'E', 'L', ';', 'I', 'N', 'S', 'D',
- 'C', ':', 'S', 'R', 'A', ':', 'x', 'r', 'e', 'a', 'd', '_', 't', 'y', 'p', 'e', ' ',
- 'o', 'u', 't', '_', 'r', 'e', 'a', 'd', '_', 't', 'y', 'p', 'e', '=', '.', 'R', 'E',
- 'A', 'D', '_', 'T', 'Y', 'P', 'E', ';', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A',
- ':', 'r', 'e', 'a', 'd', '_', 'f', 'i', 'l', 't', 'e', 'r', ' ', 'o', 'u', 't', '_',
- 'r', 'd', '_', 'f', 'i', 'l', 't', 'e', 'r', '=', '.', 'R', 'D', '_', 'F', 'I', 'L',
- 'T', 'E', 'R', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'z',
- 'e', 'r', 'o', ' ', 'o', 'u', 't', '_', 'l', 'a', 'b', 'e', 'l', '_', 's', 't', 'a',
- 'r', 't', '=', '.', 'L', 'A', 'B', 'E', 'L', '_', 'S', 'T', 'A', 'R', 'T', '|', '(',
- 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o', ')',
- '<', 'U', '3', '2', '>', 'c', 'u', 't', '#', '1', '<', '0', '>', '(', 'o', 'u', 't',
- '_', 'l', 'a', 'b', 'e', 'l', '_', 's', 'e', 'g', '3', '2', ')', ';', 'I', 'N', 'S',
- 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l', 'e', 'n', ' ', 'o', 'u', 't', '_',
- 'l', 'a', 'b', 'e', 'l', '_', 'l', 'e', 'n', '=', '.', 'L', 'A', 'B', 'E', 'L', '_',
- 'L', 'E', 'N', '|', '(', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':',
- 'l', 'e', 'n', ')', '<', 'U', '3', '2', '>', 'c', 'u', 't', '#', '1', '<', '1', '>',
- '(', 'o', 'u', 't', '_', 'l', 'a', 'b', 'e', 'l', '_', 's', 'e', 'g', '3', '2', ')',
- ';', 'U', '3', '2', '[', '2', ']', ' ', 'o', 'u', 't', '_', 'l', 'a', 'b', 'e', 'l',
- '_', 's', 'e', 'g', '3', '2', '=', 'c', 'a', 's', 't', '#', '1', '(', '.', 'L', 'A',
- 'B', 'E', 'L', '_', 'S', 'E', 'G', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o',
- 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o', ' ', 'o', 'u', 't', '_', 'r', 'e', 'a', 'd',
- '_', 's', 't', 'a', 'r', 't', '=', '.', 'R', 'E', 'A', 'D', '_', 'S', 'T', 'A', 'R',
- 'T', '|', '(', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e',
- 'r', 'o', ')', '<', 'U', '3', '2', '>', 'c', 'u', 't', '#', '1', '<', '0', '>', '(',
- 'o', 'u', 't', '_', 'r', 'e', 'a', 'd', '_', 's', 'e', 'g', '3', '2', ')', ';', 'I',
- 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l', 'e', 'n', ' ', 'o', 'u',
- 't', '_', 'r', 'e', 'a', 'd', '_', 'l', 'e', 'n', '=', '.', 'R', 'E', 'A', 'D', '_',
- 'L', 'E', 'N', '|', '(', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':',
- 'l', 'e', 'n', ')', '<', 'U', '3', '2', '>', 'c', 'u', 't', '#', '1', '<', '1', '>',
- '(', 'o', 'u', 't', '_', 'r', 'e', 'a', 'd', '_', 's', 'e', 'g', '3', '2', ')', ';',
- 'U', '3', '2', '[', '2', ']', ' ', 'o', 'u', 't', '_', 'r', 'e', 'a', 'd', '_', 's',
- 'e', 'g', '3', '2', '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'f', 'i', 'x',
- '_', 'r', 'e', 'a', 'd', '_', 's', 'e', 'g', '#', '1', '(', '.', 'R', 'E', 'A', 'D',
- '_', 'S', 'E', 'G', ',', 's', 'p', 'o', 't', '_', 'l', 'e', 'n', ')', ';', '}', 't',
- 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l',
- ':', 's', 'p', 'o', 't', 'd', 'e', 's', 'c', '#', '1', '.', '0', '.', '2', '=', 'N',
- 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'p', 'o', 't', 'd',
- 'e', 's', 'c', '_', 'n', 'o', 'p', 'h', 'y', 's', '#', '1', '.', '0', '.', '2', '{',
- 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', '<',
- 'U', '8', '>', 'z', 'i', 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '#', '1',
- ' ', '.', 'N', 'R', 'E', 'A', 'D', 'S', '=', 'N', 'R', 'E', 'A', 'D', 'S', ';', 'p',
- 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', '<', 'a',
- 's', 'c', 'i', 'i', '>', 'z', 'i', 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g',
- '#', '1', ' ', '.', 'L', 'A', 'B', 'E', 'L', '=', 'L', 'A', 'B', 'E', 'L', ';', 'p',
- 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', '<', 'I',
- 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o', '>', 'i',
- 'z', 'i', 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '#', '1', ' ', '.', 'L',
- 'A', 'B', 'E', 'L', '_', 'S', 'T', 'A', 'R', 'T', '=', 'L', 'A', 'B', 'E', 'L', '_',
- 'S', 'T', 'A', 'R', 'T', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o',
- 'l', 'u', 'm', 'n', ' ', '<', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd',
- ':', 'l', 'e', 'n', '>', 'i', 'z', 'i', 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n',
- 'g', '#', '1', ' ', '.', 'L', 'A', 'B', 'E', 'L', '_', 'L', 'E', 'N', '=', 'L', 'A',
- 'B', 'E', 'L', '_', 'L', 'E', 'N', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ',
- 'c', 'o', 'l', 'u', 'm', 'n', ' ', '<', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o',
- 'r', 'd', ':', 'z', 'e', 'r', 'o', '>', 'i', 'z', 'i', 'p', '_', 'e', 'n', 'c', 'o',
- 'd', 'i', 'n', 'g', '#', '1', ' ', '.', 'R', 'E', 'A', 'D', '_', 'S', 'T', 'A', 'R',
- 'T', '=', 'R', 'E', 'A', 'D', '_', 'S', 'T', 'A', 'R', 'T', ';', 'p', 'h', 'y', 's',
- 'i', 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', '<', 'I', 'N', 'S', 'D',
- 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l', 'e', 'n', '>', 'i', 'z', 'i', 'p', '_',
- 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '#', '1', ' ', '.', 'R', 'E', 'A', 'D', '_',
- 'L', 'E', 'N', '=', 'i', 'n', '_', 'r', 'e', 'a', 'd', '_', 'l', 'e', 'n', ';', 'p',
- 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', '<', 'I',
- 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'x', 'r', 'e', 'a', 'd', '_', 't', 'y',
- 'p', 'e', '>', 'z', 'i', 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '#', '1',
- ' ', '.', 'R', 'E', 'A', 'D', '_', 'T', 'Y', 'P', 'E', '=', 'i', 'n', '_', 'r', 'e',
- 'a', 'd', '_', 't', 'y', 'p', 'e', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ',
- 'c', 'o', 'l', 'u', 'm', 'n', ' ', '<', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A',
- ':', 'r', 'e', 'a', 'd', '_', 'f', 'i', 'l', 't', 'e', 'r', '>', 'z', 'i', 'p', '_',
- 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '#', '1', ' ', '.', 'R', 'D', '_', 'F', 'I',
- 'L', 'T', 'E', 'R', '=', 'R', 'E', 'A', 'D', '_', 'F', 'I', 'L', 'T', 'E', 'R', ';',
- '}', 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 't',
- 'b', 'l', ':', 'p', 'o', 's', '#', '1', '.', '0', '.', '1', '=', 'I', 'N', 'S', 'D',
- 'C', ':', 't', 'b', 'l', ':', 's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', '#', '1', '.',
- '0', '.', '1', '{', 'I', 'N', 'S', 'D', 'C', ':', 'p', 'o', 's', 'i', 't', 'i', 'o',
- 'n', ':', 'o', 'n', 'e', ' ', 'o', 'u', 't', '_', 'p', 'o', 's', 'i', 't', 'i', 'o',
- 'n', '=', '<', 'I', 'N', 'S', 'D', 'C', ':', 'p', 'o', 's', 'i', 't', 'i', 'o', 'n',
- ':', 'o', 'n', 'e', '>', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'm', 'a', 'k',
- 'e', '_', 'p', 'o', 's', 'i', 't', 'i', 'o', 'n', '#', '1', '<', '1', '>', '(', 'o',
- 'u', 't', '_', '2', 'n', 'a', '_', 'p', 'a', 'c', 'k', 'e', 'd', ')', '|', '<', 'I',
- 'N', 'S', 'D', 'C', ':', 'p', 'o', 's', 'i', 't', 'i', 'o', 'n', ':', 'o', 'n', 'e',
- '>', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'm', 'a', 'k', 'e', '_', 'p', 'o',
- 's', 'i', 't', 'i', 'o', 'n', '#', '1', '<', '1', '>', '(', 'o', 'u', 't', '_', '2',
- 'c', 's', '_', 'p', 'a', 'c', 'k', 'e', 'd', ')', ';', 'N', 'C', 'B', 'I', ':', 'S',
- 'R', 'A', ':', 'p', 'o', 's', '1', '6', ' ', 'o', 'u', 't', '_', 'p', 'o', 's', 'i',
- 't', 'i', 'o', 'n', '1', '6', '=', '<', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':',
- 'p', 'o', 's', '1', '6', '>', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'm', 'a',
- 'k', 'e', '_', 'p', 'o', 's', 'i', 't', 'i', 'o', 'n', '#', '1', '<', '1', '>', '(',
- 'o', 'u', 't', '_', '2', 'n', 'a', '_', 'p', 'a', 'c', 'k', 'e', 'd', ')', '|', '<',
- 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'p', 'o', 's', '1', '6', '>', 'N', 'C',
- 'B', 'I', ':', 'S', 'R', 'A', ':', 'm', 'a', 'k', 'e', '_', 'p', 'o', 's', 'i', 't',
- 'i', 'o', 'n', '#', '1', '<', '1', '>', '(', 'o', 'u', 't', '_', '2', 'c', 's', '_',
- 'p', 'a', 'c', 'k', 'e', 'd', ')', ';', '}', 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C',
- 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'r', 'a', '_', 'n', 'o',
- 'p', 'o', 's', '#', '1', '.', '0', '.', '3', '=', 'I', 'N', 'S', 'D', 'C', ':', 'S',
- 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'r', 'a', '#', '1', '.', '0', '.', '3', ',',
- 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'p', 'o', 't',
- 'd', 'e', 's', 'c', '_', 'n', 'o', 'c', 'o', 'l', '#', '1', '.', '0', '.', '2', '{',
- 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'p', 'o', 's', 'i',
- 't', 'i', 'o', 'n', ':', 'o', 'n', 'e', ' ', 'P', 'O', 'S', 'I', 'T', 'I', 'O', 'N',
- ' ', '=', ' ', 'o', 'u', 't', '_', 'p', 'o', 's', 'i', 't', 'i', 'o', 'n', ';', 'r',
- 'e', 'a', 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'N', 'C',
- 'B', 'I', ':', 'S', 'R', 'A', ':', 'p', 'o', 's', '1', '6', ' ', 'P', 'O', 'S', 'I',
- 'T', 'I', 'O', 'N', ' ', '=', ' ', 'o', 'u', 't', '_', 'p', 'o', 's', 'i', 't', 'i',
- 'o', 'n', '1', '6', ';', 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o', 'l',
- 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'p', 'o', 's', 'i', 't', 'i', 'o',
- 'n', ':', 'z', 'e', 'r', 'o', ' ', 'P', 'O', 'S', 'I', 'T', 'I', 'O', 'N', ' ', '=',
- ' ', '(', 'I', 'N', 'S', 'D', 'C', ':', 'p', 'o', 's', 'i', 't', 'i', 'o', 'n', ':',
- 'z', 'e', 'r', 'o', ')', '<', 'I', '3', '2', '>', 'd', 'i', 'f', 'f', '#', '1', '<',
- '1', '>', '(', 'o', 'u', 't', '_', 'p', 'o', 's', 'i', 't', 'i', 'o', 'n', ')', ';',
- 'U', '6', '4', ' ', 'b', 'a', 's', 'e', '_', 'c', 'o', 'u', 'n', 't', '=', '<', 'U',
- '6', '4', '>', 'm', 'e', 't', 'a', ':', 'v', 'a', 'l', 'u', 'e', '#', '1', '<', '\'',
- 'B', 'A', 'S', 'E', '_', 'C', 'O', 'U', 'N', 'T', '\'', '>', '(', ')', ';', 'U',
- '6', '4', ' ', 's', 'p', 'o', 't', '_', 'c', 'o', 'u', 'n', 't', '=', '<', 'U', '6',
- '4', '>', 'm', 'e', 't', 'a', ':', 'v', 'a', 'l', 'u', 'e', '#', '1', '<', '\'',
- '.', 's', 'e', 'q', '/', 's', 'p', 'o', 't', '\'', '>', '(', ')', '|', '<', 'U',
- '6', '4', '>', 'm', 'e', 't', 'a', ':', 'v', 'a', 'l', 'u', 'e', '#', '1', '<', '\'',
- '.', 's', 'e', 'q', '\'', '>', '(', ')', ';', '}', 't', 'a', 'b', 'l', 'e', ' ',
- 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'r', 'a', '#',
- '1', '.', '0', '.', '3', '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b',
- 'l', ':', 's', 'r', 'a', '_', 'n', 'o', 'p', 'o', 's', '#', '1', '.', '0', '.', '3',
- ',', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 'p', 'o', 's',
- '#', '1', '.', '0', '.', '1', '{', '}', 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B',
- 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'r', 'a', '_', 'n', 'o', 'p',
- 'o', 's', '#', '2', '.', '1', '.', '3', '=', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R',
- 'A', ':', 't', 'b', 'l', ':', 's', 'r', 'a', '#', '1', '.', '0', '.', '3', ',', 'N',
- 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'k', 'e', 'y', 'n',
- 'a', 'm', 'e', '#', '3', '.', '0', '.', '1', ',', 'N', 'C', 'B', 'I', ':', 'S', 'R',
- 'A', ':', 't', 'b', 'l', ':', 's', 'p', 'o', 't', 'd', 'e', 's', 'c', '#', '1', '.',
- '0', '.', '2', ',', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':',
- 's', 't', 'a', 't', 's', '#', '1', '.', '2', '{', 'c', 'o', 'l', 'u', 'm', 'n', ' ',
- 'I', 'N', 'S', 'D', 'C', ':', 'p', 'o', 's', 'i', 't', 'i', 'o', 'n', ':', 'o', 'n',
- 'e', ' ', 'P', 'O', 'S', 'I', 'T', 'I', 'O', 'N', ' ', '=', ' ', 'o', 'u', 't', '_',
- 'p', 'o', 's', 'i', 't', 'i', 'o', 'n', ';', 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y',
- ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':',
- 'p', 'o', 's', '1', '6', ' ', 'P', 'O', 'S', 'I', 'T', 'I', 'O', 'N', ' ', '=', ' ',
- 'c', 'a', 's', 't', '#', '1', '(', '_', 'c', 'l', 'i', 'p', '_', 'p', 'o', 's', 'i',
- 't', 'i', 'o', 'n', ')', ';', 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o',
- 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'p', 'o', 's', 'i', 't', 'i',
- 'o', 'n', ':', 'z', 'e', 'r', 'o', ' ', 'P', 'O', 'S', 'I', 'T', 'I', 'O', 'N', ' ',
- '=', ' ', '(', 'I', 'N', 'S', 'D', 'C', ':', 'p', 'o', 's', 'i', 't', 'i', 'o', 'n',
- ':', 'z', 'e', 'r', 'o', ')', '<', 'I', '3', '2', '>', 'd', 'i', 'f', 'f', '#', '1',
- '<', '1', '>', '(', 'o', 'u', 't', '_', 'p', 'o', 's', 'i', 't', 'i', 'o', 'n', ')',
- ';', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'p', 'l', 'a', 't', 'f', 'o',
- 'r', 'm', '_', 'i', 'd', ' ', 'o', 'u', 't', '_', 'p', 'l', 'a', 't', 'f', 'o', 'r',
- 'm', '=', '.', 'P', 'L', 'A', 'T', 'F', 'O', 'R', 'M', ';', 'I', 'N', 'S', 'D', 'C',
- ':', 'p', 'o', 's', 'i', 't', 'i', 'o', 'n', ':', 'o', 'n', 'e', ' ', '_', 'c', 'l',
- 'i', 'p', '_', 'p', 'o', 's', 'i', 't', 'i', 'o', 'n', '=', '<', 'I', 'N', 'S', 'D',
- 'C', ':', 'p', 'o', 's', 'i', 't', 'i', 'o', 'n', ':', 'o', 'n', 'e', '>', 'c', 'l',
- 'i', 'p', '#', '1', '<', '0', ',', '6', '5', '5', '3', '5', '>', '(', 'o', 'u', 't',
- '_', 'p', 'o', 's', 'i', 't', 'i', 'o', 'n', ')', ';', '}', 't', 'a', 'b', 'l', 'e',
- ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'r', 'a',
- '#', '2', '.', '1', '.', '3', '=', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':',
- 't', 'b', 'l', ':', 's', 'r', 'a', '#', '1', '.', '0', '.', '3', ',', 'N', 'C', 'B',
- 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'k', 'e', 'y', 'n', 'a', 'm',
- 'e', '#', '3', '.', '0', '.', '1', ',', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':',
- 't', 'b', 'l', ':', 's', 'p', 'o', 't', 'd', 'e', 's', 'c', '#', '1', '.', '0', '.',
- '2', ',', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's', 't',
- 'a', 't', 's', '#', '1', '.', '2', ',', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':',
- 't', 'b', 'l', ':', 'p', 'o', 's', '#', '1', '.', '0', '.', '1', '{', 'r', 'e', 'a',
- 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D',
- 'C', ':', 'p', 'o', 's', 'i', 't', 'i', 'o', 'n', ':', 'o', 'n', 'e', ' ', 'P', 'O',
- 'S', 'I', 'T', 'I', 'O', 'N', ' ', '=', ' ', 'o', 'u', 't', '_', 'p', 'o', 's', 'i',
- 't', 'i', 'o', 'n', ';', 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o', 'l',
- 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'p', 'o', 's', '1',
- '6', ' ', 'P', 'O', 'S', 'I', 'T', 'I', 'O', 'N', ' ', '=', ' ', 'o', 'u', 't', '_',
- 'p', 'o', 's', 'i', 't', 'i', 'o', 'n', '1', '6', ';', 'r', 'e', 'a', 'd', 'o', 'n',
- 'l', 'y', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'p',
- 'o', 's', 'i', 't', 'i', 'o', 'n', ':', 'z', 'e', 'r', 'o', ' ', 'P', 'O', 'S', 'I',
- 'T', 'I', 'O', 'N', ' ', '=', ' ', '(', 'I', 'N', 'S', 'D', 'C', ':', 'p', 'o', 's',
- 'i', 't', 'i', 'o', 'n', ':', 'z', 'e', 'r', 'o', ')', '<', 'I', '3', '2', '>', 'd',
- 'i', 'f', 'f', '#', '1', '<', '1', '>', '(', 'o', 'u', 't', '_', 'p', 'o', 's', 'i',
- 't', 'i', 'o', 'n', ')', ';', '}', 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I',
- ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 'c', 'l', 'i', 'p', '#', '1', '.', '0',
- '.', '2', '=', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':',
- 's', 'p', 'o', 't', 'd', 'e', 's', 'c', '#', '1', '.', '0', '.', '2', '{', 'c', 'o',
- 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':',
- 'o', 'n', 'e', ' ', 'C', 'L', 'I', 'P', '_', 'A', 'D', 'A', 'P', 'T', 'E', 'R', '_',
- 'L', 'E', 'F', 'T', ' ', '=', ' ', 'o', 'u', 't', '_', 'c', 'l', 'i', 'p', '_', 'a',
- 'd', 'a', 'p', 't', '_', 'l', 'e', 'f', 't', ';', 'c', 'o', 'l', 'u', 'm', 'n', ' ',
- 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'o', 'n', 'e', ' ', 'C',
- 'L', 'I', 'P', '_', 'A', 'D', 'A', 'P', 'T', 'E', 'R', '_', 'R', 'I', 'G', 'H', 'T',
- ' ', '=', ' ', 'o', 'u', 't', '_', 'c', 'l', 'i', 'p', '_', 'a', 'd', 'a', 'p', 't',
- '_', 'r', 'i', 'g', 'h', 't', ';', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S',
- 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'o', 'n', 'e', ' ', 'C', 'L', 'I', 'P',
- '_', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', '_', 'L', 'E', 'F', 'T', ' ', '=', ' ', 'o',
- 'u', 't', '_', 'c', 'l', 'i', 'p', '_', 'q', 'u', 'a', 'l', '_', 'l', 'e', 'f', 't',
- ';', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o',
- 'r', 'd', ':', 'o', 'n', 'e', ' ', 'C', 'L', 'I', 'P', '_', 'Q', 'U', 'A', 'L', 'I',
- 'T', 'Y', '_', 'R', 'I', 'G', 'H', 'T', ' ', '=', ' ', 'o', 'u', 't', '_', 'c', 'l',
- 'i', 'p', '_', 'q', 'u', 'a', 'l', '_', 'r', 'i', 'g', 'h', 't', ';', 'r', 'e', 'a',
- 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'U', '1', '6', ' ',
- 'C', 'L', 'I', 'P', '_', 'A', 'D', 'A', 'P', 'T', 'E', 'R', '_', 'L', 'E', 'F', 'T',
- ' ', '=', ' ', '.', 'C', 'L', 'I', 'P', '_', 'A', 'D', 'A', 'P', 'T', 'E', 'R', '_',
- 'L', 'E', 'F', 'T', '|', 'c', 'a', 's', 't', '#', '1', '(', 'o', 'u', 't', '_', 'c',
- 'l', 'i', 'p', '_', 'a', 'd', 'a', 'p', 't', '_', 'l', 'e', 'f', 't', ')', ';', 'r',
- 'e', 'a', 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'U', '1',
- '6', ' ', 'C', 'L', 'I', 'P', '_', 'A', 'D', 'A', 'P', 'T', 'E', 'R', '_', 'R', 'I',
- 'G', 'H', 'T', ' ', '=', ' ', '.', 'C', 'L', 'I', 'P', '_', 'A', 'D', 'A', 'P', 'T',
- 'E', 'R', '_', 'R', 'I', 'G', 'H', 'T', '|', 'c', 'a', 's', 't', '#', '1', '(', 'o',
- 'u', 't', '_', 'c', 'l', 'i', 'p', '_', 'a', 'd', 'a', 'p', 't', '_', 'r', 'i', 'g',
- 'h', 't', ')', ';', 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o', 'l', 'u',
- 'm', 'n', ' ', 'U', '1', '6', ' ', 'C', 'L', 'I', 'P', '_', 'Q', 'U', 'A', 'L', 'I',
- 'T', 'Y', '_', 'L', 'E', 'F', 'T', ' ', '=', ' ', 'c', 'a', 's', 't', '#', '1', '(',
- 'o', 'u', 't', '_', 'c', 'l', 'i', 'p', '_', 'q', 'u', 'a', 'l', '_', 'l', 'e', 'f',
- 't', ')', ';', 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o', 'l', 'u', 'm',
- 'n', ' ', 'U', '1', '6', ' ', 'C', 'L', 'I', 'P', '_', 'Q', 'U', 'A', 'L', 'I', 'T',
- 'Y', '_', 'R', 'I', 'G', 'H', 'T', ' ', '=', ' ', 'c', 'a', 's', 't', '#', '1', '(',
- 'o', 'u', 't', '_', 'c', 'l', 'i', 'p', '_', 'q', 'u', 'a', 'l', '_', 'r', 'i', 'g',
- 'h', 't', ')', ';', 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o', 'l', 'u',
- 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e',
- 'r', 'o', ' ', 'C', 'L', 'I', 'P', '_', 'A', 'D', 'A', 'P', 'T', 'E', 'R', '_', 'L',
- 'E', 'F', 'T', ' ', '=', ' ', '(', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r',
- 'd', ':', 'z', 'e', 'r', 'o', ')', '<', 'I', '3', '2', '>', 'd', 'i', 'f', 'f', '#',
- '1', '<', '1', '>', '(', 'l', 'i', 'm', '_', 'c', 'l', 'i', 'p', '_', 'a', 'd', 'a',
- 'p', 't', '_', 'l', 'e', 'f', 't', ')', ';', 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y',
- ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o',
- 'r', 'd', ':', 'z', 'e', 'r', 'o', ' ', 'C', 'L', 'I', 'P', '_', 'A', 'D', 'A', 'P',
- 'T', 'E', 'R', '_', 'R', 'I', 'G', 'H', 'T', ' ', '=', ' ', '(', 'I', 'N', 'S', 'D',
- 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o', ')', '<', 'I', '3', '2',
- '>', 'd', 'i', 'f', 'f', '#', '1', '<', '1', '>', '(', 'l', 'i', 'm', '_', 'c', 'l',
- 'i', 'p', '_', 'a', 'd', 'a', 'p', 't', '_', 'r', 'i', 'g', 'h', 't', ')', ';', 'r',
- 'e', 'a', 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N',
- 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o', ' ', 'C', 'L',
- 'I', 'P', '_', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', '_', 'L', 'E', 'F', 'T', ' ', '=',
- ' ', '(', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e', 'r',
- 'o', ')', '<', 'I', '3', '2', '>', 'd', 'i', 'f', 'f', '#', '1', '<', '1', '>', '(',
- 'l', 'i', 'm', '_', 'c', 'l', 'i', 'p', '_', 'q', 'u', 'a', 'l', '_', 'l', 'e', 'f',
- 't', ')', ';', 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o', 'l', 'u', 'm',
- 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e', 'r',
- 'o', ' ', 'C', 'L', 'I', 'P', '_', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', '_', 'R', 'I',
- 'G', 'H', 'T', ' ', '=', ' ', '(', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r',
- 'd', ':', 'z', 'e', 'r', 'o', ')', '<', 'I', '3', '2', '>', 'd', 'i', 'f', 'f', '#',
- '1', '<', '1', '>', '(', 'l', 'i', 'm', '_', 'c', 'l', 'i', 'p', '_', 'q', 'u', 'a',
- 'l', '_', 'r', 'i', 'g', 'h', 't', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o',
- 'o', 'r', 'd', ':', 'o', 'n', 'e', ' ', 'o', 'u', 't', '_', 'c', 'l', 'i', 'p', '_',
- 'a', 'd', 'a', 'p', 't', '_', 'l', 'e', 'f', 't', '=', 'c', 'a', 's', 't', '#', '1',
- '(', '.', 'C', 'L', 'I', 'P', '_', 'A', 'D', 'A', 'P', 'T', 'E', 'R', '_', 'L', 'E',
- 'F', 'T', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'o',
- 'n', 'e', ' ', 'o', 'u', 't', '_', 'c', 'l', 'i', 'p', '_', 'a', 'd', 'a', 'p', 't',
- '_', 'r', 'i', 'g', 'h', 't', '=', 'c', 'a', 's', 't', '#', '1', '(', '.', 'C', 'L',
- 'I', 'P', '_', 'A', 'D', 'A', 'P', 'T', 'E', 'R', '_', 'R', 'I', 'G', 'H', 'T', ')',
- ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'o', 'n', 'e', ' ',
- 'o', 'u', 't', '_', 'c', 'l', 'i', 'p', '_', 'q', 'u', 'a', 'l', '_', 'l', 'e', 'f',
- 't', '=', 'c', 'a', 's', 't', '#', '1', '(', '.', 'C', 'L', 'I', 'P', '_', 'Q', 'U',
- 'A', 'L', 'I', 'T', 'Y', '_', 'L', 'E', 'F', 'T', ')', '|', '<', 'I', 'N', 'S', 'D',
- 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'o', 'n', 'e', '>', 'e', 'c', 'h', 'o', '#',
- '1', '<', '1', '>', '(', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r',
- 'd', ':', 'o', 'n', 'e', ' ', 'o', 'u', 't', '_', 'c', 'l', 'i', 'p', '_', 'q', 'u',
- 'a', 'l', '_', 'r', 'i', 'g', 'h', 't', '=', 'c', 'a', 's', 't', '#', '1', '(', '.',
- 'C', 'L', 'I', 'P', '_', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', '_', 'R', 'I', 'G', 'H',
- 'T', ')', '|', 'c', 'a', 's', 't', '#', '1', '(', 's', 'p', 'o', 't', '_', 'l', 'e',
- 'n', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'o', 'n',
- 'e', ' ', 's', 'p', 'o', 't', '_', 'r', 'i', 'g', 'h', 't', '=', '(', 'I', 'N', 'S',
- 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'o', 'n', 'e', ')', 's', 'p', 'o', 't',
- '_', 'l', 'e', 'n', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':',
- 'o', 'n', 'e', ' ', 'l', 'i', 'm', '_', 'c', 'l', 'i', 'p', '_', 'a', 'd', 'a', 'p',
- 't', '_', 'l', 'e', 'f', 't', '=', '<', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o',
- 'r', 'd', ':', 'o', 'n', 'e', '>', 'c', 'l', 'i', 'p', '#', '1', '<', '1', ',', '2',
- '1', '4', '7', '4', '8', '3', '6', '4', '7', '>', '(', 'o', 'u', 't', '_', 'c', 'l',
- 'i', 'p', '_', 'a', 'd', 'a', 'p', 't', '_', 'l', 'e', 'f', 't', ')', ';', 'I', 'N',
- 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'o', 'n', 'e', ' ', 'm', 'a', 'x',
- '_', 'c', 'l', 'i', 'p', '_', 'a', 'd', 'a', 'p', 't', '_', 'r', 'i', 'g', 'h', 't',
- '=', '<', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'o', 'n', 'e',
- ',', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'o', 'n', 'e', '>',
- 'm', 'a', 'p', '#', '1', '<', '0', ',', '2', '1', '4', '7', '4', '8', '3', '6', '4',
- '7', '>', '(', 'o', 'u', 't', '_', 'c', 'l', 'i', 'p', '_', 'a', 'd', 'a', 'p', 't',
- '_', 'r', 'i', 'g', 'h', 't', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o',
- 'r', 'd', ':', 'o', 'n', 'e', ' ', 'l', 'i', 'm', '_', 'c', 'l', 'i', 'p', '_', 'a',
- 'd', 'a', 'p', 't', '_', 'r', 'i', 'g', 'h', 't', '=', '<', 'I', 'N', 'S', 'D', 'C',
- ':', 'c', 'o', 'o', 'r', 'd', ':', 'o', 'n', 'e', '>', 'm', 'i', 'n', '#', '1', '(',
- 's', 'p', 'o', 't', '_', 'r', 'i', 'g', 'h', 't', ',', 'm', 'a', 'x', '_', 'c', 'l',
- 'i', 'p', '_', 'a', 'd', 'a', 'p', 't', '_', 'r', 'i', 'g', 'h', 't', ')', ';', 'I',
- 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'o', 'n', 'e', ' ', 'l', 'i',
- 'm', '_', 'c', 'l', 'i', 'p', '_', 'q', 'u', 'a', 'l', '_', 'l', 'e', 'f', 't', '=',
- '<', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'o', 'n', 'e', '>',
- 'c', 'l', 'i', 'p', '#', '1', '<', '1', ',', '2', '1', '4', '7', '4', '8', '3', '6',
- '4', '7', '>', '(', 'o', 'u', 't', '_', 'c', 'l', 'i', 'p', '_', 'q', 'u', 'a', 'l',
- '_', 'l', 'e', 'f', 't', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r',
- 'd', ':', 'o', 'n', 'e', ' ', 'm', 'a', 'x', '_', 'c', 'l', 'i', 'p', '_', 'q', 'u',
- 'a', 'l', '_', 'r', 'i', 'g', 'h', 't', '=', '<', 'I', 'N', 'S', 'D', 'C', ':', 'c',
- 'o', 'o', 'r', 'd', ':', 'o', 'n', 'e', ',', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o',
- 'o', 'r', 'd', ':', 'o', 'n', 'e', '>', 'm', 'a', 'p', '#', '1', '<', '0', ',', '2',
- '1', '4', '7', '4', '8', '3', '6', '4', '7', '>', '(', 'o', 'u', 't', '_', 'c', 'l',
- 'i', 'p', '_', 'q', 'u', 'a', 'l', '_', 'r', 'i', 'g', 'h', 't', ')', ';', 'I', 'N',
- 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'o', 'n', 'e', ' ', 'l', 'i', 'm',
- '_', 'c', 'l', 'i', 'p', '_', 'q', 'u', 'a', 'l', '_', 'r', 'i', 'g', 'h', 't', '=',
- '<', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'o', 'n', 'e', '>',
- 'm', 'i', 'n', '#', '1', '(', 's', 'p', 'o', 't', '_', 'r', 'i', 'g', 'h', 't', ',',
- 'm', 'a', 'x', '_', 'c', 'l', 'i', 'p', '_', 'q', 'u', 'a', 'l', '_', 'r', 'i', 'g',
- 'h', 't', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'o',
- 'n', 'e', ' ', 'm', 'a', 'x', '_', 'c', 'l', 'i', 'p', '_', 'l', 'e', 'f', 't', '=',
- '<', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'o', 'n', 'e', '>',
- 'm', 'a', 'x', '#', '1', '(', 'l', 'i', 'm', '_', 'c', 'l', 'i', 'p', '_', 'a', 'd',
- 'a', 'p', 't', '_', 'l', 'e', 'f', 't', ',', 'l', 'i', 'm', '_', 'c', 'l', 'i', 'p',
- '_', 'q', 'u', 'a', 'l', '_', 'l', 'e', 'f', 't', ')', '|', 'l', 'i', 'm', '_', 'c',
- 'l', 'i', 'p', '_', 'a', 'd', 'a', 'p', 't', '_', 'l', 'e', 'f', 't', '|', 'l', 'i',
- 'm', '_', 'c', 'l', 'i', 'p', '_', 'q', 'u', 'a', 'l', '_', 'l', 'e', 'f', 't', ';',
- 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o', ' ',
- 'm', 'a', 'x', '_', 'z', 'c', 'l', 'i', 'p', '_', 'l', 'e', 'f', 't', '=', '(', 'I',
- 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o', ')', '<',
- 'I', '3', '2', '>', 'd', 'i', 'f', 'f', '#', '1', '<', '1', '>', '(', 'm', 'a', 'x',
- '_', 'c', 'l', 'i', 'p', '_', 'l', 'e', 'f', 't', ')', ';', 'I', 'N', 'S', 'D', 'C',
- ':', 'c', 'o', 'o', 'r', 'd', ':', 'o', 'n', 'e', ' ', 'm', 'i', 'n', '_', 'c', 'l',
- 'i', 'p', '_', 'r', 'i', 'g', 'h', 't', '=', '<', 'I', 'N', 'S', 'D', 'C', ':', 'c',
- 'o', 'o', 'r', 'd', ':', 'o', 'n', 'e', '>', 'm', 'i', 'n', '#', '1', '(', 'l', 'i',
- 'm', '_', 'c', 'l', 'i', 'p', '_', 'a', 'd', 'a', 'p', 't', '_', 'r', 'i', 'g', 'h',
- 't', ',', 'l', 'i', 'm', '_', 'c', 'l', 'i', 'p', '_', 'q', 'u', 'a', 'l', '_', 'r',
- 'i', 'g', 'h', 't', ')', '|', 'l', 'i', 'm', '_', 'c', 'l', 'i', 'p', '_', 'a', 'd',
- 'a', 'p', 't', '_', 'r', 'i', 'g', 'h', 't', '|', 'l', 'i', 'm', '_', 'c', 'l', 'i',
- 'p', '_', 'q', 'u', 'a', 'l', '_', 'r', 'i', 'g', 'h', 't', ';', 'I', 'N', 'S', 'D',
- 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o', ' ', 'b', 'i', 'o', '_',
- 's', 't', 'a', 'r', 't', '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'b', 'i',
- 'o', '_', 's', 't', 'a', 'r', 't', '#', '1', '(', 'o', 'u', 't', '_', 'r', 'e', 'a',
- 'd', '_', 's', 't', 'a', 'r', 't', ',', 'o', 'u', 't', '_', 'r', 'e', 'a', 'd', '_',
- 't', 'y', 'p', 'e', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd',
- ':', 'z', 'e', 'r', 'o', ' ', 't', 'r', 'i', 'm', '_', 's', 't', 'a', 'r', 't', '=',
- '<', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o',
- '>', 'm', 'a', 'x', '#', '1', '(', 'b', 'i', 'o', '_', 's', 't', 'a', 'r', 't', ',',
- 'm', 'a', 'x', '_', 'z', 'c', 'l', 'i', 'p', '_', 'l', 'e', 'f', 't', ')', '|', 'b',
- 'i', 'o', '_', 's', 't', 'a', 'r', 't', ';', 'I', '3', '2', ' ', 't', 'r', 'i', 'm',
- '_', 's', 't', 'o', 'p', '=', '<', 'I', '3', '2', '>', 'm', 'a', 'x', '#', '1', '(',
- 'm', 'i', 'n', '_', 'c', 'l', 'i', 'p', '_', 'r', 'i', 'g', 'h', 't', ',', 't', 'r',
- 'i', 'm', '_', 's', 't', 'a', 'r', 't', ')', '|', 's', 'p', 'o', 't', '_', 'r', 'i',
- 'g', 'h', 't', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l',
- 'e', 'n', ' ', 't', 'r', 'i', 'm', '_', 'l', 'e', 'n', '=', '(', 'I', 'N', 'S', 'D',
- 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l', 'e', 'n', ')', '<', 'I', '3', '2', '>',
- 'd', 'i', 'f', 'f', '#', '1', '(', 't', 'r', 'i', 'm', '_', 's', 't', 'o', 'p', ',',
- 't', 'r', 'i', 'm', '_', 's', 't', 'a', 'r', 't', ')', ';', '}', 't', 'a', 'b', 'l',
- 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_', '4', '5', '4', '_', ':',
- 'c', 'o', 'm', 'm', 'o', 'n', '#', '1', '.', '0', '.', '4', '=', 'I', 'N', 'S', 'D',
- 'C', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'r', 'a', '#', '1', '.', '0',
- '.', '3', ',', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 'c',
- 'l', 'i', 'p', '#', '1', '.', '0', '.', '2', '{', 'c', 'o', 'l', 'u', 'm', 'n', ' ',
- 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ' ', 'F', 'L',
- 'O', 'W', '_', 'C', 'H', 'A', 'R', 'S', ' ', '=', ' ', 'o', 'u', 't', '_', 'f', 'l',
- 'o', 'w', '_', 'c', 'h', 'a', 'r', 's', ';', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I',
- 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ' ', 'K', 'E', 'Y',
- '_', 'S', 'E', 'Q', 'U', 'E', 'N', 'C', 'E', ' ', '=', ' ', 'o', 'u', 't', '_', 'k',
- 'e', 'y', '_', 's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', ';', 'c', 'o', 'l', 'u', 'm',
- 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ' ',
- 'L', 'I', 'N', 'K', 'E', 'R', '_', 'S', 'E', 'Q', 'U', 'E', 'N', 'C', 'E', ' ', '=',
- ' ', 'o', 'u', 't', '_', 'l', 'i', 'n', 'k', 'e', 'r', '_', 's', 'e', 'q', 'u', 'e',
- 'n', 'c', 'e', ';', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'i',
- 's', 'a', 'm', 'p', '1', ' ', 'S', 'I', 'G', 'N', 'A', 'L', ' ', '=', ' ', 'o', 'u',
- 't', '_', 's', 'i', 'g', 'n', 'a', 'l', ';', 'a', 's', 'c', 'i', 'i', ' ', 'p', 'l',
- 'a', 't', 'f', 'o', 'r', 'm', '_', 'n', 'a', 'm', 'e', '=', '<', 'a', 's', 'c', 'i',
- 'i', '>', 'e', 'c', 'h', 'o', '#', '1', '<', '\'', '4', '5', '4', '\'', '>', '(',
- ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ' ',
- 'i', 'n', '_', 'f', 'l', 'o', 'w', '_', 'c', 'h', 'a', 'r', 's', '=', '<', 'I', 'N',
- 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ',', 'I', 'N', 'S', 'D',
- 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', '>', 'm', 'a', 'p', '#', '1', '<',
- '\'', 'a', 'c', 'g', 't', 'n', '.', '\'', ',', '\'', 'A', 'C', 'G', 'T', 'N', 'N',
- '\'', '>', '(', 'F', 'L', 'O', 'W', '_', 'C', 'H', 'A', 'R', 'S', ')', ';', 'I',
- 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ' ', 'i', 'n', '_',
- 'k', 'e', 'y', '_', 's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', '=', '<', 'I', 'N', 'S',
- 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ',', 'I', 'N', 'S', 'D', 'C',
- ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', '>', 'm', 'a', 'p', '#', '1', '<', '\'',
- 'a', 'c', 'g', 't', 'n', '.', '\'', ',', '\'', 'A', 'C', 'G', 'T', 'N', 'N', '\'',
- '>', '(', 'K', 'E', 'Y', '_', 'S', 'E', 'Q', 'U', 'E', 'N', 'C', 'E', ')', ';', 'I',
- 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ' ', 'i', 'n', '_',
- 'l', 'i', 'n', 'k', 'e', 'r', '_', 's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', '=', '<',
- 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ',', 'I', 'N',
- 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', '>', 'm', 'a', 'p', '#',
- '1', '<', '\'', 'a', 'c', 'g', 't', 'n', '.', '\'', ',', '\'', 'A', 'C', 'G', 'T',
- 'N', 'N', '\'', '>', '(', 'L', 'I', 'N', 'K', 'E', 'R', '_', 'S', 'E', 'Q', 'U',
- 'E', 'N', 'C', 'E', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'n', 'a', ':',
- 'b', 'i', 'n', ' ', 'o', 'u', 't', '_', 'f', 'l', 'o', 'w', '_', 'b', 'i', 'n', '=',
- '<', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ',', 'I',
- 'N', 'S', 'D', 'C', ':', 'x', '2', 'n', 'a', ':', 'b', 'i', 'n', '>', 'm', 'a', 'p',
- '#', '1', '<', '\'', 'A', 'C', 'G', 'T', 'N', '\'', ',', '[', '0', ',', '1', ',',
- '2', ',', '3', ',', '4', ']', '>', '(', 'o', 'u', 't', '_', 'f', 'l', 'o', 'w', '_',
- 'c', 'h', 'a', 'r', 's', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'n', 'a',
- ':', 'b', 'i', 'n', ' ', 'o', 'u', 't', '_', 'k', 'e', 'y', '_', 'b', 'i', 'n', '=',
- '<', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ',', 'I',
- 'N', 'S', 'D', 'C', ':', 'x', '2', 'n', 'a', ':', 'b', 'i', 'n', '>', 'm', 'a', 'p',
- '#', '1', '<', '\'', 'A', 'C', 'G', 'T', 'N', '\'', ',', '[', '0', ',', '1', ',',
- '2', ',', '3', ',', '4', ']', '>', '(', 'o', 'u', 't', '_', 'k', 'e', 'y', '_', 's',
- 'e', 'q', 'u', 'e', 'n', 'c', 'e', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2',
- 'n', 'a', ':', 'b', 'i', 'n', ' ', 'o', 'u', 't', '_', 'l', 'i', 'n', 'k', 'e', 'r',
- '_', 'b', 'i', 'n', '=', '<', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't',
- 'e', 'x', 't', ',', 'I', 'N', 'S', 'D', 'C', ':', 'x', '2', 'n', 'a', ':', 'b', 'i',
- 'n', '>', 'm', 'a', 'p', '#', '1', '<', '\'', 'A', 'C', 'G', 'T', 'N', '\'', ',',
- '[', '0', ',', '1', ',', '2', ',', '3', ',', '4', ']', '>', '(', 'o', 'u', 't', '_',
- 'l', 'i', 'n', 'k', 'e', 'r', '_', 's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', ')', ';',
- 'N', 'C', 'B', 'I', ':', 'i', 's', 'a', 'm', 'p', '1', ' ', 'o', 'u', 't', '_', 's',
- 'i', 'g', 'n', 'a', 'l', '=', '.', 'S', 'I', 'G', 'N', 'A', 'L', ';', '}', 't', 'a',
- 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_', '4', '5', '4',
- '_', ':', 't', 'b', 'l', ':', 'v', '2', '#', '1', '.', '0', '.', '7', '=', 'N', 'C',
- 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'r', 'a', '_', 'n', 'o',
- 'p', 'o', 's', '#', '2', '.', '1', '.', '3', ',', 'N', 'C', 'B', 'I', ':', 't', 'b',
- 'l', ':', 'b', 'a', 's', 'e', '_', 's', 'p', 'a', 'c', 'e', '#', '2', '.', '0', '.',
- '3', ',', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':', 'p', 'h', 'r', 'e', 'd', '_',
- 'q', 'u', 'a', 'l', 'i', 't', 'y', '#', '2', '.', '0', '.', '4', ',', 'N', 'C', 'B',
- 'I', ':', 'S', 'R', 'A', ':', '_', '4', '5', '4', '_', ':', 'c', 'o', 'm', 'm', 'o',
- 'n', '#', '1', '.', '0', '.', '4', '{', 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y', ' ',
- 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r',
- 'd', ':', 'v', 'a', 'l', ' ', 'R', 'E', 'G', 'I', 'O', 'N', ' ', '=', ' ', '(', 'I',
- 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', ')', 'N', 'C',
- 'B', 'I', ':', 'S', 'R', 'A', ':', 'e', 'x', 't', 'r', 'a', 'c', 't', '_', 'n', 'a',
- 'm', 'e', '_', 'c', 'o', 'o', 'r', 'd', '#', '1', '<', '6', '>', '(', '_', 'o', 'u',
- 't', '_', 'n', 'a', 'm', 'e', ',', 'o', 'u', 't', '_', 's', 'p', 'o', 't', '_', 'n',
- 'a', 'm', 'e', '_', 't', 'o', 'k', ')', ';', 't', 'e', 'x', 't', ':', 't', 'o', 'k',
- 'e', 'n', ' ', 'o', 'u', 't', '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '_',
- 't', 'o', 'k', '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_', '4', '5', '4',
- '_', ':', 't', 'o', 'k', 'e', 'n', 'i', 'z', 'e', '_', 's', 'p', 'o', 't', '_', 'n',
- 'a', 'm', 'e', '#', '1', '(', '_', 'o', 'u', 't', '_', 'n', 'a', 'm', 'e', ')', ';',
- 't', 'e', 'x', 't', ':', 't', 'o', 'k', 'e', 'n', ' ', 'i', 'n', '_', 's', 'p', 'o',
- 't', '_', 'n', 'a', 'm', 'e', '_', 't', 'o', 'k', '=', 'N', 'C', 'B', 'I', ':', 'S',
- 'R', 'A', ':', '_', '4', '5', '4', '_', ':', 't', 'o', 'k', 'e', 'n', 'i', 'z', 'e',
- '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '#', '1', '(', 'N', 'A', 'M', 'E',
- ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ' ',
- 'o', 'u', 't', '_', 'f', 'l', 'o', 'w', '_', 'c', 'h', 'a', 'r', 's', '=', '.', 'F',
- 'L', 'O', 'W', '_', 'C', 'H', 'A', 'R', 'S', '|', '<', 'I', 'N', 'S', 'D', 'C', ':',
- 'd', 'n', 'a', ':', 't', 'e', 'x', 't', '>', 'e', 'c', 'h', 'o', '#', '1', '<', '\'',
- 'T', 'A', 'C', 'G', '\'', '>', '(', '.', 'S', 'I', 'G', 'N', 'A', 'L', ')', '|',
- '<', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', '>', 'e',
- 'c', 'h', 'o', '#', '1', '<', '\'', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T',
- 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A',
- 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C',
- 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G',
- 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T',
- 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A',
- 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C',
- 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G',
- 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T',
- 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A',
- 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C',
- 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G',
- 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T',
- 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A',
- 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C',
- 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G',
- 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T',
- 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A',
- 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C',
- 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G',
- 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T',
- 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A',
- 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C',
- 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G', 'T', 'A', 'C', 'G',
- '\'', '>', '(', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't',
- 'e', 'x', 't', ' ', 'o', 'u', 't', '_', 'k', 'e', 'y', '_', 's', 'e', 'q', 'u', 'e',
- 'n', 'c', 'e', '=', '.', 'K', 'E', 'Y', '_', 'S', 'E', 'Q', 'U', 'E', 'N', 'C', 'E',
- '|', '<', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', '>',
- 'e', 'c', 'h', 'o', '#', '1', '<', '\'', 'T', 'C', 'A', 'G', '\'', '>', '(', ')',
- ';', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ' ', 'o',
- 'u', 't', '_', 'l', 'i', 'n', 'k', 'e', 'r', '_', 's', 'e', 'q', 'u', 'e', 'n', 'c',
- 'e', '=', '.', 'L', 'I', 'N', 'K', 'E', 'R', '_', 'S', 'E', 'Q', 'U', 'E', 'N', 'C',
- 'E', ';', 'I', 'N', 'S', 'D', 'C', ':', 'p', 'o', 's', 'i', 't', 'i', 'o', 'n', ':',
- 'o', 'n', 'e', ' ', 'o', 'u', 't', '_', 'p', 'o', 's', 'i', 't', 'i', 'o', 'n', '=',
- '.', 'P', 'O', 'S', 'I', 'T', 'I', 'O', 'N', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a',
- 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', '<', 'I', 'N', 'S', 'D', 'C', ':', 'd',
- 'n', 'a', ':', 't', 'e', 'x', 't', '>', 'z', 'i', 'p', '_', 'e', 'n', 'c', 'o', 'd',
- 'i', 'n', 'g', '#', '1', ' ', '.', 'F', 'L', 'O', 'W', '_', 'C', 'H', 'A', 'R', 'S',
- '=', 'i', 'n', '_', 'f', 'l', 'o', 'w', '_', 'c', 'h', 'a', 'r', 's', ';', 'p', 'h',
- 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', '<', 'I', 'N',
- 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', '>', 'z', 'i', 'p', '_',
- 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '#', '1', ' ', '.', 'K', 'E', 'Y', '_', 'S',
- 'E', 'Q', 'U', 'E', 'N', 'C', 'E', '=', 'i', 'n', '_', 'k', 'e', 'y', '_', 's', 'e',
- 'q', 'u', 'e', 'n', 'c', 'e', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c',
- 'o', 'l', 'u', 'm', 'n', ' ', '<', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':',
- 't', 'e', 'x', 't', '>', 'z', 'i', 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g',
- '#', '1', ' ', '.', 'L', 'I', 'N', 'K', 'E', 'R', '_', 'S', 'E', 'Q', 'U', 'E', 'N',
- 'C', 'E', '=', 'i', 'n', '_', 'l', 'i', 'n', 'k', 'e', 'r', '_', 's', 'e', 'q', 'u',
- 'e', 'n', 'c', 'e', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o', 'l',
- 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_', '4', '5', '4',
- '_', ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':', 'P', 'O', 'S', 'I', 'T', 'I',
- 'O', 'N', '#', '2', ' ', '.', 'P', 'O', 'S', 'I', 'T', 'I', 'O', 'N', '=', 'P', 'O',
- 'S', 'I', 'T', 'I', 'O', 'N', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c',
- 'o', 'l', 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_', '4',
- '5', '4', '_', ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':', 'C', 'L', 'I', 'P',
- '#', '2', ' ', '.', 'C', 'L', 'I', 'P', '_', 'A', 'D', 'A', 'P', 'T', 'E', 'R', '_',
- 'L', 'E', 'F', 'T', '=', 'C', 'L', 'I', 'P', '_', 'A', 'D', 'A', 'P', 'T', 'E', 'R',
- '_', 'L', 'E', 'F', 'T', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o',
- 'l', 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_', '4', '5',
- '4', '_', ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':', 'C', 'L', 'I', 'P', '#',
- '2', ' ', '.', 'C', 'L', 'I', 'P', '_', 'A', 'D', 'A', 'P', 'T', 'E', 'R', '_', 'R',
- 'I', 'G', 'H', 'T', '=', 'C', 'L', 'I', 'P', '_', 'A', 'D', 'A', 'P', 'T', 'E', 'R',
- '_', 'R', 'I', 'G', 'H', 'T', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c',
- 'o', 'l', 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_', '4',
- '5', '4', '_', ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':', 'C', 'L', 'I', 'P',
- '#', '2', ' ', '.', 'C', 'L', 'I', 'P', '_', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', '_',
- 'L', 'E', 'F', 'T', '=', 'C', 'L', 'I', 'P', '_', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y',
- '_', 'L', 'E', 'F', 'T', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o',
- 'l', 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_', '4', '5',
- '4', '_', ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':', 'C', 'L', 'I', 'P', '#',
- '2', ' ', '.', 'C', 'L', 'I', 'P', '_', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', '_', 'R',
- 'I', 'G', 'H', 'T', '=', 'C', 'L', 'I', 'P', '_', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y',
- '_', 'R', 'I', 'G', 'H', 'T', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c',
- 'o', 'l', 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_', '4',
- '5', '4', '_', ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':', 'S', 'I', 'G', 'N',
- 'A', 'L', '#', '2', ' ', '.', 'S', 'I', 'G', 'N', 'A', 'L', '=', 'S', 'I', 'G', 'N',
- 'A', 'L', ';', '}', 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R',
- 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a', ':', 'q', 'u', 'a', 'l', '4', '_',
- 'n', 'o', 'c', 'o', 'l', '#', '1', '.', '0', '.', '1', '=', 'I', 'N', 'S', 'D', 'C',
- ':', 't', 'b', 'l', ':', 's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', '#', '1', '.', '0',
- '.', '1', ',', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':', 'l', 'o', 'g', '_', 'o',
- 'd', 'd', 's', '_', 'q', 'u', 'a', 'l', 'i', 't', 'y', '_', 'n', 'o', 'c', 'o', 'l',
- '#', '1', '.', '0', '.', '1', '{', 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y', ' ', 'c',
- 'o', 'l', 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'q', 'u', 'a', 'l', '4', ' ',
- 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', ' ', '=', ' ', 'o', 'u', 't', '_', 'q', 'u', 'a',
- 'l', '4', ';', 'N', 'C', 'B', 'I', ':', 'q', 'u', 'a', 'l', '4', ' ', 'o', 'u', 't',
- '_', 'q', 'u', 'a', 'l', '4', '=', '<', 'N', 'C', 'B', 'I', ':', 'q', 'u', 'a', 'l',
- '4', '>', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p', '#', '1',
- '(', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '4', '_', 's', 'w', 'a', 'p', 'p', 'e',
- 'd', ',', 'r', 'e', 'a', 'd', '_', 'u', 'n', 'p', 'a', 'c', 'k', ')', '|', '<', 'N',
- 'C', 'B', 'I', ':', 'q', 'u', 'a', 'l', '4', '>', 'N', 'C', 'B', 'I', ':', 'S', 'R',
- 'A', ':', 'r', 'o', 't', 'a', 't', 'e', '#', '1', '<', 'f', 'a', 'l', 's', 'e', '>',
- '(', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '4', '_', 'r', 'o', 't', 'a', 't', 'e',
- 'd', ',', 'r', 'e', 'a', 'd', '_', 'u', 'n', 'p', 'a', 'c', 'k', ')', ';', 'I', 'N',
- 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'l', 'o', 'g', '_', 'o',
- 'd', 'd', 's', ' ', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '1', '_', 'c', 'h', '0',
- '=', '<', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'l',
- 'o', 'g', '_', 'o', 'd', 'd', 's', '>', 'c', 'u', 't', '#', '1', '<', '0', '>', '(',
- 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '4', '_', 's', 'w', 'a', 'p', 'p', 'e', 'd',
- ')', '|', '<', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':',
- 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', '>', 'c', 'u', 't', '#', '1', '<', '0', '>',
- '(', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '4', '_', 'r', 'o', 't', 'a', 't', 'e',
- 'd', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':',
- 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', ' ', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l',
- '1', '_', 'c', 'l', 'i', 'p', '=', '<', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a',
- 'l', 'i', 't', 'y', ':', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', '>', 'c', 'l', 'i',
- 'p', '#', '1', '<', '-', '5', ',', '1', '2', '7', '>', '(', 'o', 'u', 't', '_', 'q',
- 'u', 'a', 'l', '1', '_', 'c', 'h', '0', ')', ';', 'U', '3', '2', ' ', 'o', 'u', 't',
- '_', 'q', 'u', 'a', 'l', '4', '_', '3', '2', '=', 'r', 'e', 'd', 'i', 'm', 'e', 'n',
- 's', 'i', 'o', 'n', '#', '1', '(', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '4', '_',
- 's', 'w', 'a', 'p', 'p', 'e', 'd', ')', '|', 'r', 'e', 'd', 'i', 'm', 'e', 'n', 's',
- 'i', 'o', 'n', '#', '1', '(', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '4', '_', 'r',
- 'o', 't', 'a', 't', 'e', 'd', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a',
- 'l', 'i', 't', 'y', ':', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', ' ', 'o', 'u', 't',
- '_', 'q', 'u', 'a', 'l', '1', '_', 'f', 'i', 'v', 'e', 's', '=', '<', 'U', '3', '2',
- ',', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'l', 'o',
- 'g', '_', 'o', 'd', 'd', 's', '>', 'm', 'a', 'p', '#', '1', '<', '4', '2', '2', '7',
- '5', '9', '5', '2', '5', '9', ',', '-', '6', '>', '(', 'o', 'u', 't', '_', 'q', 'u',
- 'a', 'l', '4', '_', '3', '2', ',', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '1', '_',
- 'c', 'l', 'i', 'p', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i',
- 't', 'y', ':', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', ' ', 'o', 'u', 't', '_', 'q',
- 'u', 'a', 'l', '1', '_', 'n', '=', '<', 'U', '8', ',', 'I', 'N', 'S', 'D', 'C', ':',
- 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', '>',
- 'm', 'a', 'p', '#', '1', '<', '[', '1', ',', '2', ',', '3', ']', ',', '[', '0', ',',
- '0', ',', '0', ']', '>', '(', 'r', 'e', 'a', 'd', '_', 'u', 'n', 'p', 'a', 'c', 'k',
- ',', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '1', '_', 'f', 'i', 'v', 'e', 's', ')',
- ';', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'l', 'o',
- 'g', '_', 'o', 'd', 'd', 's', ' ', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '_', 'l',
- 'o', 'g', '_', 'o', 'd', 'd', 's', '=', '<', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u',
- 'a', 'l', 'i', 't', 'y', ':', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', ',', 'I', 'N',
- 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'l', 'o', 'g', '_', 'o',
- 'd', 'd', 's', '>', 'm', 'a', 'p', '#', '1', '<', '-', '6', ',', '-', '6', '>', '(',
- 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '1', '_', 'n', ',', 'o', 'u', 't', '_', 'q',
- 'u', 'a', 'l', '1', '_', 'c', 'l', 'i', 'p', ')', ';', '}', 't', 'a', 'b', 'l', 'e',
- ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n',
- 'a', ':', 'q', 'u', 'a', 'l', '4', '#', '1', '.', '0', '.', '1', '=', 'N', 'C', 'B',
- 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a', ':', 'q', 'u',
- 'a', 'l', '4', '_', 'n', 'o', 'c', 'o', 'l', '#', '1', '.', '0', '.', '1', '{', 'N',
- 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p', 'p', 'e', 'd', '_', 'q',
- 'u', 'a', 'l', '4', ' ', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '4', '_', 's', 'w',
- 'a', 'p', 'p', 'e', 'd', '=', '.', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', ';', '}', 't',
- 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l',
- 'u', 'm', 'i', 'n', 'a', ':', 'q', 'u', 'a', 'l', '4', '#', '2', '.', '0', '.', '4',
- '=', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':', 'b', 'a', 's', 'e', '_', 's', 'p',
- 'a', 'c', 'e', '#', '2', '.', '0', '.', '3', ',', 'N', 'C', 'B', 'I', ':', 't', 'b',
- 'l', ':', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', '_', 'q', 'u', 'a', 'l', 'i', 't',
- 'y', '_', 'n', 'o', 'c', 'o', 'l', '#', '2', '.', '0', '.', '1', '{', 'c', 'o', 'l',
- 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'q', 'u', 'a', 'l', '4', ' ', 'Q', 'U',
- 'A', 'L', 'I', 'T', 'Y', ' ', '=', ' ', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '4',
- ';', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p', 'p', 'e', 'd',
- '_', 'q', 'u', 'a', 'l', '4', ' ', 'i', 'n', '_', 'q', 'u', 'a', 'l', '4', '=', '(',
- 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p', 'p', 'e', 'd', '_',
- 'q', 'u', 'a', 'l', '4', ')', '<', 'N', 'C', 'B', 'I', ':', 'q', 'u', 'a', 'l', '4',
- '>', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p', '#', '1', '(',
- 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', ',', 'i', 'n', '_', 'x', '2', 'n', 'a', '_', 'b',
- 'i', 'n', ')', '|', '(', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a',
- 'p', 'p', 'e', 'd', '_', 'q', 'u', 'a', 'l', '4', ')', '<', 'N', 'C', 'B', 'I', ':',
- 'q', 'u', 'a', 'l', '4', '>', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w',
- 'a', 'p', '#', '1', '(', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', ',', 'i', 'n', '_', '2',
- 'n', 'a', '_', 'b', 'i', 'n', ')', ';', 'N', 'C', 'B', 'I', ':', 'q', 'u', 'a', 'l',
- '4', ' ', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '4', '=', '<', 'N', 'C', 'B', 'I',
- ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p', 'p', 'e', 'd', '_', 'q', 'u', 'a', 'l',
- '4', '>', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p', '#', '1',
- '(', '.', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', ',', 'o', 'u', 't', '_', 'x', '2', 'n',
- 'a', '_', 'b', 'i', 'n', ')', ';', 'N', 'C', 'B', 'I', ':', 'q', 'u', 'a', 'l', '4',
- ' ', 'i', 'n', '_', 's', 't', 'a', 't', 's', '_', 'q', 'u', 'a', 'l', '=', 'i', 'n',
- '_', 'q', 'u', 'a', 'l', '4', ';', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l',
- 'i', 't', 'y', ':', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', ' ', 'o', 'u', 't', '_',
- 'q', 'u', 'a', 'l', '_', 'l', 'o', 'g', '_', 'o', 'd', 'd', 's', '=', '<', 'I', 'N',
- 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'l', 'o', 'g', '_', 'o',
- 'd', 'd', 's', '>', 'c', 'u', 't', '#', '1', '<', '0', '>', '(', '.', 'Q', 'U', 'A',
- 'L', 'I', 'T', 'Y', ')', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o',
- 'l', 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'q', 'u', 'a',
- 'l', '4', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '#', '1', ' ', '.', 'Q', 'U',
- 'A', 'L', 'I', 'T', 'Y', '=', 'i', 'n', '_', 'q', 'u', 'a', 'l', '4', ';', '}', 't',
- 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l',
- 'u', 'm', 'i', 'n', 'a', ':', 'c', 'o', 'm', 'm', 'o', 'n', '#', '1', '.', '0', '.',
- '3', '=', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's',
- 'r', 'a', '#', '1', '.', '0', '.', '3', '{', 'r', 'e', 'a', 'd', 'o', 'n', 'l', 'y',
- ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o',
- 'r', 'd', ':', 'v', 'a', 'l', ' ', 'L', 'A', 'N', 'E', ' ', '=', ' ', 'o', 'u', 't',
- '_', 'l', 'a', 'n', 'e', '_', 'c', 'o', 'o', 'r', 'd', ';', 'r', 'e', 'a', 'd', 'o',
- 'n', 'l', 'y', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':',
- 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', ' ', 'T', 'I', 'L', 'E', ' ', '=', ' ',
- 'o', 'u', 't', '_', 't', 'i', 'l', 'e', '_', 'c', 'o', 'o', 'r', 'd', ';', 'a', 's',
- 'c', 'i', 'i', ' ', 'p', 'l', 'a', 't', 'f', 'o', 'r', 'm', '_', 'n', 'a', 'm', 'e',
- '=', '<', 'a', 's', 'c', 'i', 'i', '>', 'e', 'c', 'h', 'o', '#', '1', '<', '\'',
- 'I', 'L', 'L', 'U', 'M', 'I', 'N', 'A', '\'', '>', '(', ')', ';', 'I', 'N', 'S',
- 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o', ' ', 'b', 'i', 'o',
- '_', 's', 't', 'a', 'r', 't', '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'b',
- 'i', 'o', '_', 's', 't', 'a', 'r', 't', '#', '1', '(', 'o', 'u', 't', '_', 'r', 'e',
- 'a', 'd', '_', 's', 't', 'a', 'r', 't', ',', 'o', 'u', 't', '_', 'r', 'e', 'a', 'd',
- '_', 't', 'y', 'p', 'e', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r',
- 'd', ':', 'z', 'e', 'r', 'o', ' ', 't', 'r', 'i', 'm', '_', 's', 't', 'a', 'r', 't',
- '=', 'b', 'i', 'o', '_', 's', 't', 'a', 'r', 't', ';', 'U', '3', '2', ' ', 't', 'r',
- 'i', 'm', '_', 'l', 'e', 'f', 't', '=', '(', 'U', '3', '2', ')', 't', 'r', 'i', 'm',
- '_', 's', 't', 'a', 'r', 't', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r',
- 'd', ':', 'l', 'e', 'n', ' ', 't', 'r', 'i', 'm', '_', 'l', 'e', 'n', '=', '(', 'I',
- 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l', 'e', 'n', ')', '<', 'U',
- '3', '2', '>', 'd', 'i', 'f', 'f', '#', '1', '(', 's', 'p', 'o', 't', '_', 'l', 'e',
- 'n', ',', 't', 'r', 'i', 'm', '_', 'l', 'e', 'f', 't', ')', ';', '}', 't', 'a', 'b',
- 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm',
- 'i', 'n', 'a', ':', 't', 'b', 'l', ':', 'v', '2', '#', '1', '.', '0', '.', '4', '=',
- 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'r', 'a', '#',
- '2', '.', '1', '.', '3', ',', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':', 'b', 'a',
- 's', 'e', '_', 's', 'p', 'a', 'c', 'e', '#', '2', '.', '0', '.', '3', ',', 'N', 'C',
- 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a', ':', 'c',
- 'o', 'm', 'm', 'o', 'n', '#', '1', '.', '0', '.', '3', '{', 'c', 'o', 'l', 'u', 'm',
- 'n', ' ', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p', '4', ' ', 'S', 'I', 'G',
- 'N', 'A', 'L', '{', 'r', 'e', 'a', 'd', '=', 'o', 'u', 't', '_', 's', 'i', 'g', 'n',
- 'a', 'l', ';', 'v', 'a', 'l', 'i', 'd', 'a', 't', 'e', '=', '<', 'N', 'C', 'B', 'I',
- ':', 'f', 's', 'a', 'm', 'p', '4', '>', 'n', 'o', '_', 'c', 'o', 'm', 'p', 'a', 'r',
- 'e', '#', '1', '(', 'i', 'n', '_', 's', 'i', 'g', 'n', 'a', 'l', ',', 'o', 'u', 't',
- '_', 's', 'i', 'g', 'n', 'a', 'l', ')', ';', '}', 'c', 'o', 'l', 'u', 'm', 'n', ' ',
- 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p', '4', ' ', 'N', 'O', 'I', 'S', 'E',
- '{', 'r', 'e', 'a', 'd', '=', 'o', 'u', 't', '_', 'n', 'o', 'i', 's', 'e', ';', 'v',
- 'a', 'l', 'i', 'd', 'a', 't', 'e', '=', '<', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a',
- 'm', 'p', '4', '>', 'n', 'o', '_', 'c', 'o', 'm', 'p', 'a', 'r', 'e', '#', '1', '(',
- 'i', 'n', '_', 'n', 'o', 'i', 's', 'e', ',', 'o', 'u', 't', '_', 'n', 'o', 'i', 's',
- 'e', ')', ';', '}', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'f',
- 's', 'a', 'm', 'p', '4', ' ', 'I', 'N', 'T', 'E', 'N', 'S', 'I', 'T', 'Y', '{', 'r',
- 'e', 'a', 'd', '=', 'o', 'u', 't', '_', 'i', 'n', 't', 'e', 'n', 's', 'i', 't', 'y',
- ';', 'v', 'a', 'l', 'i', 'd', 'a', 't', 'e', '=', '<', 'N', 'C', 'B', 'I', ':', 'f',
- 's', 'a', 'm', 'p', '4', '>', 'n', 'o', '_', 'c', 'o', 'm', 'p', 'a', 'r', 'e', '#',
- '1', '(', 'i', 'n', '_', 'i', 'n', 't', 'e', 'n', 's', 'i', 't', 'y', ',', 'o', 'u',
- 't', '_', 'i', 'n', 't', 'e', 'n', 's', 'i', 't', 'y', ')', ';', '}', 'I', 'N', 'S',
- 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', ' ', 'o', 'u', 't', '_',
- 'l', 'a', 'n', 'e', '_', 'c', 'o', 'o', 'r', 'd', '=', '(', 'I', 'N', 'S', 'D', 'C',
- ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', ')', 'N', 'C', 'B', 'I', ':', 'S',
- 'R', 'A', ':', 'e', 'x', 't', 'r', 'a', 'c', 't', '_', 'n', 'a', 'm', 'e', '_', 'c',
- 'o', 'o', 'r', 'd', '#', '1', '<', '7', '>', '(', '_', 'o', 'u', 't', '_', 'n', 'a',
- 'm', 'e', ',', 'o', 'u', 't', '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '_',
- 't', 'o', 'k', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':',
- 'v', 'a', 'l', ' ', 'o', 'u', 't', '_', 't', 'i', 'l', 'e', '_', 'c', 'o', 'o', 'r',
- 'd', '=', '(', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a',
- 'l', ')', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'e', 'x', 't', 'r', 'a', 'c',
- 't', '_', 'n', 'a', 'm', 'e', '_', 'c', 'o', 'o', 'r', 'd', '#', '1', '<', '6', '>',
- '(', '_', 'o', 'u', 't', '_', 'n', 'a', 'm', 'e', ',', 'o', 'u', 't', '_', 's', 'p',
- 'o', 't', '_', 'n', 'a', 'm', 'e', '_', 't', 'o', 'k', ')', ';', 't', 'e', 'x', 't',
- ':', 't', 'o', 'k', 'e', 'n', ' ', 'o', 'u', 't', '_', 's', 'p', 'o', 't', '_', 'n',
- 'a', 'm', 'e', '_', 't', 'o', 'k', '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':',
- 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a', ':', 't', 'o', 'k', 'e', 'n', 'i', 'z', 'e',
- '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '#', '1', '(', '_', 'o', 'u', 't',
- '_', 'n', 'a', 'm', 'e', ')', ';', 't', 'e', 'x', 't', ':', 't', 'o', 'k', 'e', 'n',
- ' ', 'i', 'n', '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '_', 't', 'o', 'k',
- '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n',
- 'a', ':', 't', 'o', 'k', 'e', 'n', 'i', 'z', 'e', '_', 's', 'p', 'o', 't', '_', 'n',
- 'a', 'm', 'e', '#', '1', '(', 'N', 'A', 'M', 'E', ')', ';', 'N', 'C', 'B', 'I', ':',
- 'f', 's', 'a', 'm', 'p', '4', ' ', 'i', 'n', '_', 's', 'i', 'g', 'n', 'a', 'l', '=',
- 'S', 'I', 'G', 'N', 'A', 'L', ';', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p',
- '4', ' ', 'o', 'u', 't', '_', 's', 'i', 'g', 'n', 'a', 'l', '=', '<', 'N', 'C', 'B',
- 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p', 'p', 'e', 'd', '_', 'f', 's', 'a',
- 'm', 'p', '4', '>', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p',
- '#', '1', '(', '.', 'S', 'I', 'G', 'N', 'A', 'L', ',', 'o', 'u', 't', '_', 'x', '2',
- 'n', 'a', '_', 'b', 'i', 'n', ')', ';', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm',
- 'p', '4', ' ', 'i', 'n', '_', 'n', 'o', 'i', 's', 'e', '=', 'N', 'O', 'I', 'S', 'E',
- ';', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p', '4', ' ', 'o', 'u', 't', '_',
- 'n', 'o', 'i', 's', 'e', '=', '.', 'N', 'O', 'I', 'S', 'E', ';', 'N', 'C', 'B', 'I',
- ':', 'f', 's', 'a', 'm', 'p', '4', ' ', 'i', 'n', '_', 'i', 'n', 't', 'e', 'n', 's',
- 'i', 't', 'y', '=', 'I', 'N', 'T', 'E', 'N', 'S', 'I', 'T', 'Y', ';', 'N', 'C', 'B',
- 'I', ':', 'f', 's', 'a', 'm', 'p', '4', ' ', 'o', 'u', 't', '_', 'i', 'n', 't', 'e',
- 'n', 's', 'i', 't', 'y', '=', '<', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p',
- '4', '>', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'd', 'e', 'n', 'o', 'r', 'm',
- 'a', 'l', 'i', 'z', 'e', '#', '1', '(', 'o', 'u', 't', '_', 'n', 'o', 'r', 'm', '_',
- 'i', 'n', 't', 'e', 'n', 's', 'i', 't', 'y', ',', 'o', 'u', 't', '_', 'x', '2', 'n',
- 'a', '_', 'b', 'i', 'n', ')', ';', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p',
- '4', ' ', 'o', 'u', 't', '_', 'n', 'o', 'r', 'm', '_', 'i', 'n', 't', 'e', 'n', 's',
- 'i', 't', 'y', '=', '(', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p', '4', ')',
- '<', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p', 'p', 'e', 'd',
- '_', 'f', 's', 'a', 'm', 'p', '4', '>', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':',
- 's', 'w', 'a', 'p', '#', '1', '(', '.', 'I', 'N', 'T', 'E', 'N', 'S', 'I', 'T', 'Y',
- ',', 'o', 'u', 't', '_', 'x', '2', 'n', 'a', '_', 'b', 'i', 'n', ')', ';', 'N', 'C',
- 'B', 'I', ':', 'f', 's', 'a', 'm', 'p', '4', ' ', 'i', 'n', '_', 'n', 'o', 'r', 'm',
- '_', 'i', 'n', 't', 'e', 'n', 's', 'i', 't', 'y', '=', '<', 'N', 'C', 'B', 'I', ':',
- 'f', 's', 'a', 'm', 'p', '4', '>', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'n',
- 'o', 'r', 'm', 'a', 'l', 'i', 'z', 'e', '#', '1', '(', 'i', 'n', '_', 'i', 'n', 't',
- 'e', 'n', 's', 'i', 't', 'y', ',', 'i', 'n', '_', 'x', '2', 'n', 'a', '_', 'b', 'i',
- 'n', ')', '|', '<', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p', '4', '>', 'N',
- 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'n', 'o', 'r', 'm', 'a', 'l', 'i', 'z', 'e',
- '#', '1', '(', 'i', 'n', '_', 'i', 'n', 't', 'e', 'n', 's', 'i', 't', 'y', ',', 'i',
- 'n', '_', '2', 'n', 'a', '_', 'b', 'i', 'n', ')', ';', 'p', 'h', 'y', 's', 'i', 'c',
- 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R',
- 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a', ':', 'e', 'n', 'c', 'o', 'd', 'i',
- 'n', 'g', ':', 'S', 'I', 'G', 'N', 'A', 'L', '#', '2', ' ', '.', 'S', 'I', 'G', 'N',
- 'A', 'L', '=', '(', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p',
- 'p', 'e', 'd', '_', 'f', 's', 'a', 'm', 'p', '4', ')', '<', 'N', 'C', 'B', 'I', ':',
- 'f', 's', 'a', 'm', 'p', '4', '>', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's',
- 'w', 'a', 'p', '#', '1', '(', 'i', 'n', '_', 's', 'i', 'g', 'n', 'a', 'l', ',', 'i',
- 'n', '_', 'x', '2', 'n', 'a', '_', 'b', 'i', 'n', ')', '|', '(', 'N', 'C', 'B', 'I',
- ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p', 'p', 'e', 'd', '_', 'f', 's', 'a', 'm',
- 'p', '4', ')', '<', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p', '4', '>', 'N',
- 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p', '#', '1', '(', 'i', 'n',
- '_', 's', 'i', 'g', 'n', 'a', 'l', ',', 'i', 'n', '_', '2', 'n', 'a', '_', 'b', 'i',
- 'n', ')', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm',
- 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i',
- 'n', 'a', ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':', 'N', 'O', 'I', 'S', 'E',
- '#', '2', ' ', '.', 'N', 'O', 'I', 'S', 'E', '=', 'i', 'n', '_', 'n', 'o', 'i', 's',
- 'e', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n',
- ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n',
- 'a', ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':', 'I', 'N', 'T', 'E', 'N', 'S',
- 'I', 'T', 'Y', '#', '2', ' ', '.', 'I', 'N', 'T', 'E', 'N', 'S', 'I', 'T', 'Y', '=',
- '(', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p', 'p', 'e', 'd',
- '_', 'f', 's', 'a', 'm', 'p', '4', ')', '<', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a',
- 'm', 'p', '4', '>', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p',
- '#', '1', '(', 'i', 'n', '_', 'n', 'o', 'r', 'm', '_', 'i', 'n', 't', 'e', 'n', 's',
- 'i', 't', 'y', ',', 'i', 'n', '_', 'x', '2', 'n', 'a', '_', 'b', 'i', 'n', ')', '|',
- '(', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p', 'p', 'e', 'd',
- '_', 'f', 's', 'a', 'm', 'p', '4', ')', '<', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a',
- 'm', 'p', '4', '>', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p',
- '#', '1', '(', 'i', 'n', '_', 'n', 'o', 'r', 'm', '_', 'i', 'n', 't', 'e', 'n', 's',
- 'i', 't', 'y', ',', 'i', 'n', '_', '2', 'n', 'a', '_', 'b', 'i', 'n', ')', ';', '}',
- 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l',
- 'l', 'u', 'm', 'i', 'n', 'a', ':', 't', 'b', 'l', ':', 'q', '4', ':', 'v', '2', '#',
- '1', '.', '0', '.', '4', '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l',
- 'l', 'u', 'm', 'i', 'n', 'a', ':', 't', 'b', 'l', ':', 'v', '2', '#', '1', '.', '0',
- '.', '4', ',', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm',
- 'i', 'n', 'a', ':', 'q', 'u', 'a', 'l', '4', '#', '2', '.', '0', '.', '4', '{', '}',
- 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l',
- 'l', 'u', 'm', 'i', 'n', 'a', ':', 't', 'b', 'l', ':', 'q', '1', ':', 'v', '2', '#',
- '1', '.', '0', '.', '4', '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l',
- 'l', 'u', 'm', 'i', 'n', 'a', ':', 't', 'b', 'l', ':', 'v', '2', '#', '1', '.', '0',
- '.', '4', ',', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':', 'l', 'o', 'g', '_', 'o',
- 'd', 'd', 's', '_', 'q', 'u', 'a', 'l', 'i', 't', 'y', '#', '2', '.', '0', '.', '4',
- '{', '}', 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':',
- 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a', ':', 't', 'b', 'l', ':', 'p', 'h', 'r', 'e',
- 'd', ':', 'v', '2', '#', '1', '.', '0', '.', '4', '=', 'N', 'C', 'B', 'I', ':', 'S',
- 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a', ':', 't', 'b', 'l', ':', 'v',
- '2', '#', '1', '.', '0', '.', '4', ',', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':',
- 'p', 'h', 'r', 'e', 'd', '_', 'q', 'u', 'a', 'l', 'i', 't', 'y', '#', '2', '.', '0',
- '.', '4', '{', '}', 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R',
- 'A', ':', 'A', 'B', 'I', ':', 'c', 'o', 'm', 'm', 'o', 'n', '#', '1', '.', '0', '.',
- '3', '=', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's',
- 'r', 'a', '#', '1', '.', '0', '.', '3', '{', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I',
- 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', ' ', 'P', 'A',
- 'N', 'E', 'L', ' ', '=', ' ', 'o', 'u', 't', '_', 'p', 'a', 'n', 'e', 'l', '_', 'c',
- 'o', 'o', 'r', 'd', ';', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':',
- 'f', 's', 'a', 'm', 'p', '4', ' ', 'S', 'I', 'G', 'N', 'A', 'L', ' ', '=', ' ', 'o',
- 'u', 't', '_', 's', 'i', 'g', 'n', 'a', 'l', ';', 'a', 's', 'c', 'i', 'i', ' ', 'p',
- 'l', 'a', 't', 'f', 'o', 'r', 'm', '_', 'n', 'a', 'm', 'e', '=', '<', 'a', 's', 'c',
- 'i', 'i', '>', 'e', 'c', 'h', 'o', '#', '1', '<', '\'', 'A', 'B', 'S', 'O', 'L',
- 'I', 'D', '\'', '>', '(', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o',
- 'r', 'd', ':', 'z', 'e', 'r', 'o', ' ', 'b', 'i', 'o', '_', 's', 't', 'a', 'r', 't',
- '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'b', 'i', 'o', '_', 's', 't', 'a',
- 'r', 't', '#', '1', '(', 'o', 'u', 't', '_', 'r', 'e', 'a', 'd', '_', 's', 't', 'a',
- 'r', 't', ',', 'o', 'u', 't', '_', 'r', 'e', 'a', 'd', '_', 't', 'y', 'p', 'e', ')',
- ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o',
- ' ', 't', 'r', 'i', 'm', '_', 's', 't', 'a', 'r', 't', '=', 'b', 'i', 'o', '_', 's',
- 't', 'a', 'r', 't', ';', 'U', '3', '2', ' ', 't', 'r', 'i', 'm', '_', 'l', 'e', 'f',
- 't', '=', '(', 'U', '3', '2', ')', 't', 'r', 'i', 'm', '_', 's', 't', 'a', 'r', 't',
- ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l', 'e', 'n', ' ',
- 't', 'r', 'i', 'm', '_', 'l', 'e', 'n', '=', '(', 'I', 'N', 'S', 'D', 'C', ':', 'c',
- 'o', 'o', 'r', 'd', ':', 'l', 'e', 'n', ')', '<', 'U', '3', '2', '>', 'd', 'i', 'f',
- 'f', '#', '1', '(', 's', 'p', 'o', 't', '_', 'l', 'e', 'n', ',', 't', 'r', 'i', 'm',
- '_', 'l', 'e', 'f', 't', ')', ';', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p',
- '4', ' ', 'o', 'u', 't', '_', 's', 'i', 'g', 'n', 'a', 'l', '=', '(', 'N', 'C', 'B',
- 'I', ':', 'f', 's', 'a', 'm', 'p', '4', ')', '<', 'N', 'C', 'B', 'I', ':', 'S', 'R',
- 'A', ':', 's', 'w', 'a', 'p', 'p', 'e', 'd', '_', 'f', 's', 'a', 'm', 'p', '4', '>',
- 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p', '#', '1', '(', 'o',
- 'u', 't', '_', 's', 'i', 'g', 'n', 'a', 'l', '_', 's', 'w', 'a', 'p', 'p', 'e', 'd',
- ',', 'o', 'u', 't', '_', 'x', '2', 'c', 's', '_', 'b', 'i', 'n', ')', ';', '}', 't',
- 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'A', 'B', 'I',
- ':', 't', 'b', 'l', ':', 'v', '2', '#', '1', '.', '0', '.', '4', '=', 'N', 'C', 'B',
- 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'r', 'a', '#', '2', '.', '1',
- '.', '3', ',', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':', 'c', 'o', 'l', 'o', 'r',
- '_', 's', 'p', 'a', 'c', 'e', '#', '2', '.', '1', ',', 'N', 'C', 'B', 'I', ':', 't',
- 'b', 'l', ':', 'p', 'h', 'r', 'e', 'd', '_', 'q', 'u', 'a', 'l', 'i', 't', 'y', '#',
- '2', '.', '0', '.', '4', ',', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'A', 'B',
- 'I', ':', 'c', 'o', 'm', 'm', 'o', 'n', '#', '1', '.', '0', '.', '3', '{', 'c', 'o',
- 'l', 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p', '1', ' ',
- 'F', 'T', 'C', '{', 'r', 'e', 'a', 'd', '=', 'o', 'u', 't', '_', 'f', 't', 'c', ';',
- 'v', 'a', 'l', 'i', 'd', 'a', 't', 'e', '=', '<', 'F', '3', '2', '>', 'n', 'o', '_',
- 'c', 'o', 'm', 'p', 'a', 'r', 'e', '#', '1', '(', 'i', 'n', '_', 'f', 't', 'c', ',',
- 'o', 'u', 't', '_', 'f', 't', 'c', ')', ';', '}', 'c', 'o', 'l', 'u', 'm', 'n', ' ',
- 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p', '1', ' ', 'F', 'A', 'M', '{', 'r',
- 'e', 'a', 'd', '=', 'o', 'u', 't', '_', 'f', 'a', 'm', ';', 'v', 'a', 'l', 'i', 'd',
- 'a', 't', 'e', '=', '<', 'F', '3', '2', '>', 'n', 'o', '_', 'c', 'o', 'm', 'p', 'a',
- 'r', 'e', '#', '1', '(', 'i', 'n', '_', 'f', 'a', 'm', ',', 'o', 'u', 't', '_', 'f',
- 'a', 'm', ')', ';', '}', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':',
- 'f', 's', 'a', 'm', 'p', '1', ' ', 'C', 'Y', '3', '{', 'r', 'e', 'a', 'd', '=', 'o',
- 'u', 't', '_', 'c', 'y', '3', ';', 'v', 'a', 'l', 'i', 'd', 'a', 't', 'e', '=', '<',
- 'F', '3', '2', '>', 'n', 'o', '_', 'c', 'o', 'm', 'p', 'a', 'r', 'e', '#', '1', '(',
- 'i', 'n', '_', 'c', 'y', '3', ',', 'o', 'u', 't', '_', 'c', 'y', '3', ')', ';', '}',
- 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p',
- '1', ' ', 'T', 'X', 'R', '{', 'r', 'e', 'a', 'd', '=', 'o', 'u', 't', '_', 't', 'x',
- 'r', ';', 'v', 'a', 'l', 'i', 'd', 'a', 't', 'e', '=', '<', 'F', '3', '2', '>', 'n',
- 'o', '_', 'c', 'o', 'm', 'p', 'a', 'r', 'e', '#', '1', '(', 'i', 'n', '_', 't', 'x',
- 'r', ',', 'o', 'u', 't', '_', 't', 'x', 'r', ')', ';', '}', 'c', 'o', 'l', 'u', 'm',
- 'n', ' ', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p', '1', ' ', 'C', 'Y', '5',
- '{', 'r', 'e', 'a', 'd', '=', 'o', 'u', 't', '_', 'c', 'y', '5', ';', 'v', 'a', 'l',
- 'i', 'd', 'a', 't', 'e', '=', '<', 'F', '3', '2', '>', 'n', 'o', '_', 'c', 'o', 'm',
- 'p', 'a', 'r', 'e', '#', '1', '(', 'i', 'n', '_', 'c', 'y', '5', ',', 'o', 'u', 't',
- '_', 'c', 'y', '5', ')', ';', '}', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r',
- 'd', ':', 'v', 'a', 'l', ' ', 'o', 'u', 't', '_', 'p', 'a', 'n', 'e', 'l', '_', 'c',
- 'o', 'o', 'r', 'd', '=', '(', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd',
- ':', 'v', 'a', 'l', ')', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'e', 'x', 't',
- 'r', 'a', 'c', 't', '_', 'n', 'a', 'm', 'e', '_', 'c', 'o', 'o', 'r', 'd', '#', '1',
- '<', '6', '>', '(', '_', 'o', 'u', 't', '_', 'n', 'a', 'm', 'e', ',', 'o', 'u', 't',
- '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '_', 't', 'o', 'k', ')', ';', 't',
- 'e', 'x', 't', ':', 't', 'o', 'k', 'e', 'n', ' ', 'o', 'u', 't', '_', 's', 'p', 'o',
- 't', '_', 'n', 'a', 'm', 'e', '_', 't', 'o', 'k', '=', 'N', 'C', 'B', 'I', ':', 'S',
- 'R', 'A', ':', 'A', 'B', 'I', ':', 't', 'o', 'k', 'e', 'n', 'i', 'z', 'e', '_', 's',
- 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '#', '1', '(', '_', 'o', 'u', 't', '_', 'n',
- 'a', 'm', 'e', ')', ';', 't', 'e', 'x', 't', ':', 't', 'o', 'k', 'e', 'n', ' ', 'i',
- 'n', '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '_', 't', 'o', 'k', '=', 'N',
- 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'A', 'B', 'I', ':', 't', 'o', 'k', 'e', 'n',
- 'i', 'z', 'e', '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '#', '1', '(', 'N',
- 'A', 'M', 'E', ')', ';', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p', '1', ' ',
- 'i', 'n', '_', 'f', 't', 'c', '=', 'F', 'T', 'C', ';', 'N', 'C', 'B', 'I', ':', 'f',
- 's', 'a', 'm', 'p', '1', ' ', 'o', 'u', 't', '_', 'f', 't', 'c', '=', '(', 'N', 'C',
- 'B', 'I', ':', 'f', 's', 'a', 'm', 'p', '1', ')', '<', 'F', '3', '2', '>', 'c', 'u',
- 't', '#', '1', '<', '0', '>', '(', 'o', 'u', 't', '_', 's', 'i', 'g', 'n', 'a', 'l',
- ')', ';', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p', '1', ' ', 'i', 'n', '_',
- 'f', 'a', 'm', '=', 'F', 'A', 'M', ';', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm',
- 'p', '1', ' ', 'o', 'u', 't', '_', 'f', 'a', 'm', '=', '(', 'N', 'C', 'B', 'I', ':',
- 'f', 's', 'a', 'm', 'p', '1', ')', '<', 'F', '3', '2', '>', 'c', 'u', 't', '#', '1',
- '<', '0', '>', '(', 'o', 'u', 't', '_', 's', 'i', 'g', 'n', 'a', 'l', ')', ';', 'N',
- 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p', '1', ' ', 'i', 'n', '_', 'c', 'y', '3',
- '=', 'C', 'Y', '3', ';', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p', '1', ' ',
- 'o', 'u', 't', '_', 'c', 'y', '3', '=', '(', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a',
- 'm', 'p', '1', ')', '<', 'F', '3', '2', '>', 'c', 'u', 't', '#', '1', '<', '1', '>',
- '(', 'o', 'u', 't', '_', 's', 'i', 'g', 'n', 'a', 'l', ')', ';', 'N', 'C', 'B', 'I',
- ':', 'f', 's', 'a', 'm', 'p', '1', ' ', 'i', 'n', '_', 't', 'x', 'r', '=', 'T', 'X',
- 'R', ';', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p', '1', ' ', 'o', 'u', 't',
- '_', 't', 'x', 'r', '=', '(', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p', '1',
- ')', '<', 'F', '3', '2', '>', 'c', 'u', 't', '#', '1', '<', '2', '>', '(', 'o', 'u',
- 't', '_', 's', 'i', 'g', 'n', 'a', 'l', ')', ';', 'N', 'C', 'B', 'I', ':', 'f', 's',
- 'a', 'm', 'p', '1', ' ', 'i', 'n', '_', 'c', 'y', '5', '=', 'C', 'Y', '5', ';', 'N',
- 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p', '1', ' ', 'o', 'u', 't', '_', 'c', 'y',
- '5', '=', '(', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p', '1', ')', '<', 'F',
- '3', '2', '>', 'c', 'u', 't', '#', '1', '<', '3', '>', '(', 'o', 'u', 't', '_', 's',
- 'i', 'g', 'n', 'a', 'l', ')', ';', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p',
- '4', ' ', 'i', 'n', '_', 's', 'i', 'g', 'n', 'a', 'l', '=', 'S', 'I', 'G', 'N', 'A',
- 'L', '|', '(', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p', '4', ')', '<', 'F',
- '3', '2', '>', 'p', 'a', 's', 't', 'e', '#', '1', '(', 'i', 'n', '_', 'f', 't', 'c',
- ',', 'i', 'n', '_', 'c', 'y', '3', ',', 'i', 'n', '_', 't', 'x', 'r', ',', 'i', 'n',
- '_', 'c', 'y', '5', ')', '|', '(', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p',
- '4', ')', '<', 'F', '3', '2', '>', 'p', 'a', 's', 't', 'e', '#', '1', '(', 'i', 'n',
- '_', 'f', 'a', 'm', ',', 'i', 'n', '_', 'c', 'y', '3', ',', 'i', 'n', '_', 't', 'x',
- 'r', ',', 'i', 'n', '_', 'c', 'y', '5', ')', ';', 'N', 'C', 'B', 'I', ':', 'S', 'R',
- 'A', ':', 's', 'w', 'a', 'p', 'p', 'e', 'd', '_', 'f', 's', 'a', 'm', 'p', '4', ' ',
- 'o', 'u', 't', '_', 's', 'i', 'g', 'n', 'a', 'l', '_', 's', 'w', 'a', 'p', 'p', 'e',
- 'd', '=', '.', 'S', 'I', 'G', 'N', 'A', 'L', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a',
- 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A',
- ':', 'A', 'B', 'I', ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':', 'S', 'I', 'G',
- 'N', 'A', 'L', '#', '2', ' ', '.', 'S', 'I', 'G', 'N', 'A', 'L', '=', '(', 'N', 'C',
- 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p', 'p', 'e', 'd', '_', 'f', 's',
- 'a', 'm', 'p', '4', ')', '<', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p', '4',
- '>', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p', '#', '1', '(',
- 'i', 'n', '_', 's', 'i', 'g', 'n', 'a', 'l', ',', 'i', 'n', '_', 'x', '2', 'c', 's',
- '_', 'b', 'i', 'n', ')', '|', '(', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's',
- 'w', 'a', 'p', 'p', 'e', 'd', '_', 'f', 's', 'a', 'm', 'p', '4', ')', '<', 'N', 'C',
- 'B', 'I', ':', 'f', 's', 'a', 'm', 'p', '4', '>', 'N', 'C', 'B', 'I', ':', 'S', 'R',
- 'A', ':', 's', 'w', 'a', 'p', '#', '1', '(', 'i', 'n', '_', 's', 'i', 'g', 'n', 'a',
- 'l', ',', 'i', 'n', '_', '2', 'c', 's', '_', 'b', 'i', 'n', ')', ';', '}', 't', 'a',
- 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'H', 'e', 'l', 'i',
- 'c', 'o', 's', ':', 't', 'b', 'l', ':', 'v', '2', '#', '1', '.', '0', '.', '4', '=',
- 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'r', 'a', '#',
- '2', '.', '1', '.', '3', ',', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':', 'b', 'a',
- 's', 'e', '_', 's', 'p', 'a', 'c', 'e', '#', '2', '.', '0', '.', '3', ',', 'N', 'C',
- 'B', 'I', ':', 't', 'b', 'l', ':', 'p', 'h', 'r', 'e', 'd', '_', 'q', 'u', 'a', 'l',
- 'i', 't', 'y', '#', '2', '.', '0', '.', '4', '{', 'r', 'e', 'a', 'd', 'o', 'n', 'l',
- 'y', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o',
- 'o', 'r', 'd', ':', 'v', 'a', 'l', ' ', 'C', 'H', 'A', 'N', 'N', 'E', 'L', ' ', '=',
- ' ', '(', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l',
- ')', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'e', 'x', 't', 'r', 'a', 'c', 't',
- '_', 'n', 'a', 'm', 'e', '_', 'c', 'o', 'o', 'r', 'd', '#', '1', '<', '7', '>', '(',
- '_', 'o', 'u', 't', '_', 'n', 'a', 'm', 'e', ',', 'o', 'u', 't', '_', 's', 'p', 'o',
- 't', '_', 'n', 'a', 'm', 'e', '_', 't', 'o', 'k', ')', ';', 'r', 'e', 'a', 'd', 'o',
- 'n', 'l', 'y', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':',
- 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', ' ', 'F', 'I', 'E', 'L', 'D', ' ', '=',
- ' ', '(', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l',
- ')', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'e', 'x', 't', 'r', 'a', 'c', 't',
- '_', 'n', 'a', 'm', 'e', '_', 'c', 'o', 'o', 'r', 'd', '#', '1', '<', '6', '>', '(',
- '_', 'o', 'u', 't', '_', 'n', 'a', 'm', 'e', ',', 'o', 'u', 't', '_', 's', 'p', 'o',
- 't', '_', 'n', 'a', 'm', 'e', '_', 't', 'o', 'k', ')', ';', 'r', 'e', 'a', 'd', 'o',
- 'n', 'l', 'y', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':',
- 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', ' ', 'C', 'A', 'M', 'E', 'R', 'A', ' ',
- '=', ' ', 'o', 'u', 't', '_', 'x', '_', 'c', 'o', 'o', 'r', 'd', ';', 'r', 'e', 'a',
- 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D',
- 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', ' ', 'P', 'O', 'S', ' ', '=',
- ' ', 'o', 'u', 't', '_', 'y', '_', 'c', 'o', 'o', 'r', 'd', ';', 'a', 's', 'c', 'i',
- 'i', ' ', 'p', 'l', 'a', 't', 'f', 'o', 'r', 'm', '_', 'n', 'a', 'm', 'e', '=', '<',
- 'a', 's', 'c', 'i', 'i', '>', 'e', 'c', 'h', 'o', '#', '1', '<', '\'', 'H', 'E',
- 'L', 'I', 'C', 'O', 'S', '\'', '>', '(', ')', ';', 't', 'e', 'x', 't', ':', 't',
- 'o', 'k', 'e', 'n', ' ', 'o', 'u', 't', '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm',
- 'e', '_', 't', 'o', 'k', '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'H', 'e',
- 'l', 'i', 'c', 'o', 's', ':', 't', 'o', 'k', 'e', 'n', 'i', 'z', 'e', '_', 's', 'p',
- 'o', 't', '_', 'n', 'a', 'm', 'e', '#', '1', '(', '_', 'o', 'u', 't', '_', 'n', 'a',
- 'm', 'e', ')', ';', 't', 'e', 'x', 't', ':', 't', 'o', 'k', 'e', 'n', ' ', 'i', 'n',
- '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '_', 't', 'o', 'k', '=', 'N', 'C',
- 'B', 'I', ':', 'S', 'R', 'A', ':', 'H', 'e', 'l', 'i', 'c', 'o', 's', ':', 't', 'o',
- 'k', 'e', 'n', 'i', 'z', 'e', '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '#',
- '1', '(', 'N', 'A', 'M', 'E', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o',
- 'r', 'd', ':', 'z', 'e', 'r', 'o', ' ', 't', 'r', 'i', 'm', '_', 's', 't', 'a', 'r',
- 't', '=', '<', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e',
- 'r', 'o', '>', 'e', 'c', 'h', 'o', '#', '1', '<', '0', '>', '(', ')', ';', 'I', 'N',
- 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l', 'e', 'n', ' ', 't', 'r', 'i',
- 'm', '_', 'l', 'e', 'n', '=', 's', 'p', 'o', 't', '_', 'l', 'e', 'n', ';', '}', 't',
- 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'o', 'n',
- 'T', 'o', 'r', 'r', 'e', 'n', 't', ':', 't', 'b', 'l', ':', 'v', '2', '#', '1', '.',
- '0', '.', '3', '=', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 't', 'b', 'l',
- ':', 's', 'r', 'a', '#', '1', '.', '0', '.', '3', ',', 'N', 'C', 'B', 'I', ':', 'S',
- 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'r', 'a', '_', 'n', 'o', 'p', 'o', 's', '#',
- '2', '.', '1', '.', '3', ',', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':', 'b', 'a',
- 's', 'e', '_', 's', 'p', 'a', 'c', 'e', '#', '2', '.', '0', '.', '3', ',', 'N', 'C',
- 'B', 'I', ':', 't', 'b', 'l', ':', 'p', 'h', 'r', 'e', 'd', '_', 'q', 'u', 'a', 'l',
- 'i', 't', 'y', '#', '2', '.', '0', '.', '4', ',', 'N', 'C', 'B', 'I', ':', 'S', 'R',
- 'A', ':', 't', 'b', 'l', ':', 'c', 'l', 'i', 'p', '#', '1', '.', '0', '.', '2', '{',
- 'c', 'o', 'l', 'u', 'm', 'n', ' ', '<', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a',
- ':', 't', 'e', 'x', 't', '>', 'z', 'i', 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n',
- 'g', '#', '1', ' ', 'F', 'L', 'O', 'W', '_', 'C', 'H', 'A', 'R', 'S', ';', 'c', 'o',
- 'l', 'u', 'm', 'n', ' ', '<', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't',
- 'e', 'x', 't', '>', 'z', 'i', 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '#',
- '1', ' ', 'K', 'E', 'Y', '_', 'S', 'E', 'Q', 'U', 'E', 'N', 'C', 'E', ';', 'c', 'o',
- 'l', 'u', 'm', 'n', ' ', '<', 'N', 'C', 'B', 'I', ':', 'i', 's', 'a', 'm', 'p', '1',
- '>', 'i', 'z', 'i', 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '#', '1', ' ',
- 'S', 'I', 'G', 'N', 'A', 'L', ';', 'a', 's', 'c', 'i', 'i', ' ', 'p', 'l', 'a', 't',
- 'f', 'o', 'r', 'm', '_', 'n', 'a', 'm', 'e', '=', '<', 'a', 's', 'c', 'i', 'i', '>',
- 'e', 'c', 'h', 'o', '#', '1', '<', '\'', 'I', 'O', 'N', '_', 'T', 'O', 'R', 'R',
- 'E', 'N', 'T', '\'', '>', '(', ')', ';', 't', 'e', 'x', 't', ':', 't', 'o', 'k',
- 'e', 'n', ' ', 'o', 'u', 't', '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '_',
- 't', 'o', 'k', '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'o', 'n', 'T',
- 'o', 'r', 'r', 'e', 'n', 't', ':', 't', 'o', 'k', 'e', 'n', 'i', 'z', 'e', '_', 's',
- 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '#', '1', '(', '_', 'o', 'u', 't', '_', 'n',
- 'a', 'm', 'e', ')', ';', 't', 'e', 'x', 't', ':', 't', 'o', 'k', 'e', 'n', ' ', 'i',
- 'n', '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '_', 't', 'o', 'k', '=', 'N',
- 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'o', 'n', 'T', 'o', 'r', 'r', 'e', 'n',
- 't', ':', 't', 'o', 'k', 'e', 'n', 'i', 'z', 'e', '_', 's', 'p', 'o', 't', '_', 'n',
- 'a', 'm', 'e', '#', '1', '(', 'N', 'A', 'M', 'E', ')', ';', 'I', 'N', 'S', 'D', 'C',
- ':', 'p', 'o', 's', 'i', 't', 'i', 'o', 'n', ':', 'o', 'n', 'e', ' ', 'o', 'u', 't',
- '_', 'p', 'o', 's', 'i', 't', 'i', 'o', 'n', '=', '.', 'P', 'O', 'S', 'I', 'T', 'I',
- 'O', 'N', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm',
- 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'o', 'n', 'T', 'o', 'r',
- 'r', 'e', 'n', 't', ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':', 'P', 'O', 'S',
- 'I', 'T', 'I', 'O', 'N', '#', '1', ' ', '.', 'P', 'O', 'S', 'I', 'T', 'I', 'O', 'N',
- '=', 'P', 'O', 'S', 'I', 'T', 'I', 'O', 'N', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a',
- 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', '<', 'I', 'N', 'S', 'D', 'C', ':', 'c',
- 'o', 'o', 'r', 'd', ':', 'o', 'n', 'e', '>', 'i', 'z', 'i', 'p', '_', 'e', 'n', 'c',
- 'o', 'd', 'i', 'n', 'g', '#', '1', ' ', '.', 'C', 'L', 'I', 'P', '_', 'A', 'D', 'A',
- 'P', 'T', 'E', 'R', '_', 'L', 'E', 'F', 'T', '=', 'C', 'L', 'I', 'P', '_', 'A', 'D',
- 'A', 'P', 'T', 'E', 'R', '_', 'L', 'E', 'F', 'T', ';', 'p', 'h', 'y', 's', 'i', 'c',
- 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', '<', 'I', 'N', 'S', 'D', 'C', ':',
- 'c', 'o', 'o', 'r', 'd', ':', 'o', 'n', 'e', '>', 'i', 'z', 'i', 'p', '_', 'e', 'n',
- 'c', 'o', 'd', 'i', 'n', 'g', '#', '1', ' ', '.', 'C', 'L', 'I', 'P', '_', 'A', 'D',
- 'A', 'P', 'T', 'E', 'R', '_', 'R', 'I', 'G', 'H', 'T', '=', 'C', 'L', 'I', 'P', '_',
- 'A', 'D', 'A', 'P', 'T', 'E', 'R', '_', 'R', 'I', 'G', 'H', 'T', ';', 'p', 'h', 'y',
- 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', '<', 'I', 'N', 'S',
- 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'o', 'n', 'e', '>', 'i', 'z', 'i', 'p',
- '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '#', '1', ' ', '.', 'C', 'L', 'I', 'P',
- '_', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', '_', 'L', 'E', 'F', 'T', '=', 'C', 'L', 'I',
- 'P', '_', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', '_', 'L', 'E', 'F', 'T', ';', 'p', 'h',
- 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', '<', 'I', 'N',
- 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'o', 'n', 'e', '>', 'i', 'z', 'i',
- 'p', '_', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '#', '1', ' ', '.', 'C', 'L', 'I',
- 'P', '_', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', '_', 'R', 'I', 'G', 'H', 'T', '=', 'C',
- 'L', 'I', 'P', '_', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', '_', 'R', 'I', 'G', 'H', 'T',
- ';', '}', 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':',
- '_', '4', '5', '4', '_', ':', 'l', 'e', 'g', 'a', 'c', 'y', '#', '1', '=', 'N', 'C',
- 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'r', 'a', '_', 'n', 'o',
- 'p', 'o', 's', '#', '1', '.', '0', '.', '3', ',', 'N', 'C', 'B', 'I', ':', 't', 'b',
- 'l', ':', 'b', 'a', 's', 'e', '_', 's', 'p', 'a', 'c', 'e', '_', 'n', 'o', 'c', 'o',
- 'l', '#', '1', '.', '0', '.', '3', ',', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':',
- 'p', 'h', 'r', 'e', 'd', '_', 'q', 'u', 'a', 'l', 'i', 't', 'y', '_', 'n', 'o', 'c',
- 'o', 'l', '#', '1', '.', '0', '.', '1', ',', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A',
- ':', 't', 'b', 'l', ':', 's', 'k', 'e', 'y', 'n', 'a', 'm', 'e', '#', '1', '.', '0',
- '.', '1', ',', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_', '4', '5', '4', '_',
- ':', 'c', 'o', 'm', 'm', 'o', 'n', '#', '1', '.', '0', '.', '4', '{', 'r', 'e', 'a',
- 'd', 'o', 'n', 'l', 'y', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D',
- 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', ' ', 'R', 'E', 'G', 'I', 'O',
- 'N', ' ', '=', ' ', '(', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':',
- 'v', 'a', 'l', ')', '<', 'I', '3', '2', '>', 'c', 'u', 't', '#', '1', '<', '2', '>',
- '(', 'c', 'o', 'o', 'r', 'd', 's', '_', 'f', 'r', 'o', 'm', '_', 's', 'k', 'e', 'y',
- ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l',
- ' ', 'o', 'u', 't', '_', 'y', '_', 'c', 'o', 'o', 'r', 'd', '=', '(', 'I', 'N', 'S',
- 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', ')', '<', 'I', '3', '2',
- '>', 'c', 'u', 't', '#', '1', '<', '0', '>', '(', 'c', 'o', 'o', 'r', 'd', 's', '_',
- 'f', 'r', 'o', 'm', '_', 's', 'k', 'e', 'y', ')', ';', 'I', 'N', 'S', 'D', 'C', ':',
- 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', ' ', 'o', 'u', 't', '_', 'x', '_', 'c',
- 'o', 'o', 'r', 'd', '=', '(', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd',
- ':', 'v', 'a', 'l', ')', '<', 'I', '3', '2', '>', 'c', 'u', 't', '#', '1', '<', '1',
- '>', '(', 'c', 'o', 'o', 'r', 'd', 's', '_', 'f', 'r', 'o', 'm', '_', 's', 'k', 'e',
- 'y', ')', ';', 'I', '3', '2', '[', '3', ']', ' ', 'c', 'o', 'o', 'r', 'd', 's', '_',
- 'f', 'r', 'o', 'm', '_', 's', 'k', 'e', 'y', '=', 'N', 'C', 'B', 'I', ':', 'S', 'R',
- 'A', ':', 'e', 'x', 't', 'r', 'a', 'c', 't', '_', 'c', 'o', 'o', 'r', 'd', 'i', 'n',
- 'a', 't', 'e', 's', '#', '1', '<', '1', '>', '(', 'o', 'u', 't', '_', 's', 'k', 'e',
- 'y', ')', ';', '}', 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R',
- 'A', ':', '_', '4', '5', '4', '_', ':', 't', 'b', 'l', ':', 'v', '0', '#', '1', '=',
- 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_', '4', '5', '4', '_', ':', 'l', 'e',
- 'g', 'a', 'c', 'y', '#', '1', '{', '_', '_', 'u', 'n', 't', 'y', 'p', 'e', 'd', '=',
- 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_', '4', '5', '4', '_', ':', 'u', 'n',
- 't', 'y', 'p', 'e', 'd', '_', '0', '(', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'S',
- 'R', 'A', ':', 'p', 'l', 'a', 't', 'f', 'o', 'r', 'm', '_', 'i', 'd', ' ', 'o', 'u',
- 't', '_', 'p', 'l', 'a', 't', 'f', 'o', 'r', 'm', '=', '<', 'I', 'N', 'S', 'D', 'C',
- ':', 'S', 'R', 'A', ':', 'p', 'l', 'a', 't', 'f', 'o', 'r', 'm', '_', 'i', 'd', '>',
- 'e', 'c', 'h', 'o', '#', '1', '<', '1', '>', '(', ')', ';', 'I', 'N', 'S', 'D', 'C',
- ':', '2', 'n', 'a', ':', 'p', 'a', 'c', 'k', 'e', 'd', ' ', 'o', 'u', 't', '_', '2',
- 'n', 'a', '_', 'p', 'a', 'c', 'k', 'e', 'd', '=', '.', 'R', 'E', 'A', 'D', ';', 'I',
- 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'p', 'h', 'r', 'e',
- 'd', ' ', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '_', 'p', 'h', 'r', 'e', 'd', '=',
- '.', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', ';', 'a', 's', 'c', 'i', 'i', ' ', 'o', 'u',
- 't', '_', 'l', 'a', 'b', 'e', 'l', '=', '<', 'a', 's', 'c', 'i', 'i', '>', 'e', 'x',
- 'i', 's', 't', 's', '#', '1', '<', '\'', 'A', 'd', 'a', 'p', 't', 'e', 'r', 'M',
- 'a', 't', 'e', '1', 'L', 'i', 'n', 'k', 'e', 'r', 'M', 'a', 't', 'e', '2', '\'',
- '>', '(', 'o', 'u', 't', '_', 'l', 'i', 'n', 'k', 'e', 'r', '_', 's', 'e', 'q', 'u',
- 'e', 'n', 'c', 'e', ')', '|', '<', 'a', 's', 'c', 'i', 'i', '>', 'e', 'c', 'h', 'o',
- '#', '1', '<', '\'', 'A', 'd', 'a', 'p', 't', 'e', 'r', 'F', 'r', 'a', 'g', 'm',
- 'e', 'n', 't', '\'', '>', '(', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o',
- 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o', ' ', 'o', 'u', 't', '_', 'l', 'a', 'b', 'e',
- 'l', '_', 's', 't', 'a', 'r', 't', '=', '<', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o',
- 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o', '>', 'e', 'x', 'i', 's', 't', 's', '#', '1',
- '<', '[', '0', ',', '7', ',', '1', '2', ',', '1', '8', ']', '>', '(', 'o', 'u', 't',
- '_', 'l', 'i', 'n', 'k', 'e', 'r', '_', 's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', ')',
- '|', '<', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e', 'r',
- 'o', '>', 'e', 'c', 'h', 'o', '#', '1', '<', '[', '0', ',', '7', ']', '>', '(', ')',
- ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l', 'e', 'n', ' ',
- 'o', 'u', 't', '_', 'l', 'a', 'b', 'e', 'l', '_', 'l', 'e', 'n', '=', '<', 'I', 'N',
- 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l', 'e', 'n', '>', 'e', 'x', 'i',
- 's', 't', 's', '#', '1', '<', '[', '7', ',', '5', ',', '6', ',', '5', ']', '>', '(',
- 'o', 'u', 't', '_', 'l', 'i', 'n', 'k', 'e', 'r', '_', 's', 'e', 'q', 'u', 'e', 'n',
- 'c', 'e', ')', '|', '<', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':',
- 'l', 'e', 'n', '>', 'e', 'c', 'h', 'o', '#', '1', '<', '[', '7', ',', '8', ']', '>',
- '(', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't',
- ' ', 'o', 'u', 't', '_', 'f', 'l', 'o', 'w', '_', 'c', 'h', 'a', 'r', 's', '=', '<',
- 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', '>', 'm', 'e',
- 't', 'a', ':', 'r', 'e', 'a', 'd', '#', '1', '<', '\'', 'M', 'S', 'C', '4', '5',
- '4', '_', 'F', 'L', 'O', 'W', '_', 'C', 'H', 'A', 'R', 'S', '\'', '>', '(', ')',
- ';', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ' ', 'o',
- 'u', 't', '_', 'k', 'e', 'y', '_', 's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', '=', '<',
- 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', '>', 'm', 'e',
- 't', 'a', ':', 'r', 'e', 'a', 'd', '#', '1', '<', '\'', 'M', 'S', 'C', '4', '5',
- '4', '_', 'K', 'E', 'Y', '_', 'S', 'E', 'Q', 'U', 'E', 'N', 'C', 'E', '\'', '>',
- '(', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't',
- ' ', 'o', 'u', 't', '_', 'l', 'i', 'n', 'k', 'e', 'r', '_', 's', 'e', 'q', 'u', 'e',
- 'n', 'c', 'e', '=', '<', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e',
- 'x', 't', '>', 'm', 'e', 't', 'a', ':', 'r', 'e', 'a', 'd', '#', '1', '<', '\'',
- 'M', 'S', 'C', '4', '5', '4', '_', 'L', 'I', 'N', 'K', 'E', 'R', '_', 'S', 'E', 'Q',
- 'U', 'E', 'N', 'C', 'E', '\'', '>', '(', ')', ';', 'N', 'C', 'B', 'I', ':', 'S',
- 'R', 'A', ':', 'p', 'o', 's', '1', '6', ' ', 'o', 'u', 't', '_', 'p', 'o', 's', 'i',
- 't', 'i', 'o', 'n', '1', '6', '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_',
- '4', '5', '4', '_', ':', 'p', 'r', 'o', 'c', 'e', 's', 's', '_', 'p', 'o', 's', 'i',
- 't', 'i', 'o', 'n', '#', '1', '(', '.', 'P', 'O', 'S', 'I', 'T', 'I', 'O', 'N', ',',
- '.', 'R', 'D', '_', 'F', 'I', 'L', 'T', 'E', 'R', ',', '.', 'S', 'I', 'G', 'N', 'A',
- 'L', ')', '|', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_', '4', '5', '4', '_',
- ':', 'p', 'r', 'o', 'c', 'e', 's', 's', '_', 'p', 'o', 's', 'i', 't', 'i', 'o', 'n',
- '#', '1', '(', '.', 'P', 'O', 'S', 'I', 'T', 'I', 'O', 'N', ',', '.', 'R', 'D', '_',
- 'F', 'I', 'L', 'T', 'E', 'R', ')', '|', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':',
- '_', '4', '5', '4', '_', ':', 'p', 'r', 'o', 'c', 'e', 's', 's', '_', 'p', 'o', 's',
- 'i', 't', 'i', 'o', 'n', '#', '1', '(', '.', 'P', 'O', 'S', 'I', 'T', 'I', 'O', 'N',
- ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'p', 'o', 's', 'i', 't', 'i', 'o', 'n', ':',
- 'o', 'n', 'e', ' ', 'o', 'u', 't', '_', 'p', 'o', 's', 'i', 't', 'i', 'o', 'n', '=',
- 'c', 'a', 's', 't', '#', '1', '(', 'o', 'u', 't', '_', 'p', 'o', 's', 'i', 't', 'i',
- 'o', 'n', '1', '6', ')', ';', 'U', '3', '2', '[', '3', ']', ' ', 'd', 'y', 'n', 'a',
- 'm', 'i', 'c', '_', 'r', 'e', 'a', 'd', '_', 'd', 'e', 's', 'c', '=', 'N', 'C', 'B',
- 'I', ':', 'S', 'R', 'A', ':', '_', '4', '5', '4', '_', ':', 'd', 'y', 'n', 'a', 'm',
- 'i', 'c', '_', 'r', 'e', 'a', 'd', '_', 'd', 'e', 's', 'c', '#', '1', '<', '4', '>',
- '(', 'o', 'u', 't', '_', '2', 'n', 'a', '_', 'b', 'i', 'n', ',', 'o', 'u', 't', '_',
- 'k', 'e', 'y', '_', 's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', ',', 'o', 'u', 't', '_',
- 'l', 'i', 'n', 'k', 'e', 'r', '_', 's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', ')', '|',
- 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_', '4', '5', '4', '_', ':', 'd', 'y',
- 'n', 'a', 'm', 'i', 'c', '_', 'r', 'e', 'a', 'd', '_', 'd', 'e', 's', 'c', '#', '1',
- '(', 'o', 'u', 't', '_', '2', 'n', 'a', '_', 'b', 'i', 'n', ',', 'o', 'u', 't', '_',
- 'k', 'e', 'y', '_', 's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', ')', ';', 'U', '8', ' ',
- 'o', 'u', 't', '_', 'n', 'r', 'e', 'a', 'd', 's', '=', '<', 'U', '8', '>', 'e', 'x',
- 'i', 's', 't', 's', '#', '1', '<', '4', '>', '(', 'o', 'u', 't', '_', 'l', 'i', 'n',
- 'k', 'e', 'r', '_', 's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', ')', '|', '<', 'U', '8',
- '>', 'e', 'c', 'h', 'o', '#', '1', '<', '2', '>', '(', ')', ';', 'U', '3', '2', ' ',
- 'r', 'e', 'a', 'd', '_', 't', 'y', 'p', 'e', '3', '2', '=', '<', 'U', '3', '2', '>',
- 'c', 'u', 't', '#', '1', '<', '0', '>', '(', 'd', 'y', 'n', 'a', 'm', 'i', 'c', '_',
- 'r', 'e', 'a', 'd', '_', 'd', 'e', 's', 'c', ')', ';', 'I', 'N', 'S', 'D', 'C', ':',
- 'S', 'R', 'A', ':', 'r', 'e', 'a', 'd', '_', 't', 'y', 'p', 'e', ' ', 'o', 'u', 't',
- '_', 'r', 'e', 'a', 'd', '_', 't', 'y', 'p', 'e', '=', 'c', 'a', 's', 't', '#', '1',
- '(', 'r', 'e', 'a', 'd', '_', 't', 'y', 'p', 'e', '3', '2', ')', ';', 'U', '3', '2',
- ' ', 'u', 'r', 'e', 'a', 'd', '_', 's', 't', 'a', 'r', 't', '=', '<', 'U', '3', '2',
- '>', 'c', 'u', 't', '#', '1', '<', '1', '>', '(', 'd', 'y', 'n', 'a', 'm', 'i', 'c',
- '_', 'r', 'e', 'a', 'd', '_', 'd', 'e', 's', 'c', ')', ';', 'I', 'N', 'S', 'D', 'C',
- ':', 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o', ' ', 'o', 'u', 't', '_', 'r',
- 'e', 'a', 'd', '_', 's', 't', 'a', 'r', 't', '=', '(', 'I', 'N', 'S', 'D', 'C', ':',
- 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o', ')', 'u', 'r', 'e', 'a', 'd', '_',
- 's', 't', 'a', 'r', 't', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd',
- ':', 'l', 'e', 'n', ' ', 'o', 'u', 't', '_', 'r', 'e', 'a', 'd', '_', 'l', 'e', 'n',
- '=', '(', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l', 'e', 'n',
- ')', '<', 'U', '3', '2', '>', 'c', 'u', 't', '#', '1', '<', '2', '>', '(', 'd', 'y',
- 'n', 'a', 'm', 'i', 'c', '_', 'r', 'e', 'a', 'd', '_', 'd', 'e', 's', 'c', ')', ';',
- 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'r', 'e', 'a', 'd', '_', 'f', 'i',
- 'l', 't', 'e', 'r', ' ', 'o', 'u', 't', '_', 'r', 'd', '_', 'f', 'i', 'l', 't', 'e',
- 'r', '=', '.', 'R', 'D', '_', 'F', 'I', 'L', 'T', 'E', 'R', '|', '<', 'I', 'N', 'S',
- 'D', 'C', ':', 'S', 'R', 'A', ':', 'r', 'e', 'a', 'd', '_', 'f', 'i', 'l', 't', 'e',
- 'r', '>', 'e', 'c', 'h', 'o', '#', '1', '<', '0', '>', '(', 'd', 'y', 'n', 'a', 'm',
- 'i', 'c', '_', 'r', 'e', 'a', 'd', '_', 'd', 'e', 's', 'c', ')', ';', 'p', 'h', 'y',
- 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I',
- ':', 'S', 'R', 'A', ':', '_', '4', '5', '4', '_', ':', 'e', 'n', 'c', 'o', 'd', 'i',
- 'n', 'g', ':', 'C', 'L', 'I', 'P', '#', '1', ' ', '.', 'C', 'L', 'I', 'P', '_', 'A',
- 'D', 'A', 'P', 'T', 'E', 'R', '_', 'L', 'E', 'F', 'T', ';', 'p', 'h', 'y', 's', 'i',
- 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S',
- 'R', 'A', ':', '_', '4', '5', '4', '_', ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g',
- ':', 'C', 'L', 'I', 'P', '#', '1', ' ', '.', 'C', 'L', 'I', 'P', '_', 'A', 'D', 'A',
- 'P', 'T', 'E', 'R', '_', 'R', 'I', 'G', 'H', 'T', ';', 'p', 'h', 'y', 's', 'i', 'c',
- 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R',
- 'A', ':', '_', '4', '5', '4', '_', ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':',
- 'C', 'L', 'I', 'P', '#', '1', ' ', '.', 'C', 'L', 'I', 'P', '_', 'Q', 'U', 'A', 'L',
- 'I', 'T', 'Y', '_', 'L', 'E', 'F', 'T', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l',
- ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':',
- '_', '4', '5', '4', '_', ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':', 'C', 'L',
- 'I', 'P', '#', '1', ' ', '.', 'C', 'L', 'I', 'P', '_', 'Q', 'U', 'A', 'L', 'I', 'T',
- 'Y', '_', 'R', 'I', 'G', 'H', 'T', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ',
- 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_',
- '4', '5', '4', '_', ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':', 'R', 'E', 'A',
- 'D', '#', '1', ' ', '.', 'R', 'E', 'A', 'D', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a',
- 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A',
- ':', '_', '4', '5', '4', '_', ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':', 'Q',
- 'U', 'A', 'L', 'I', 'T', 'Y', '#', '1', ' ', '.', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y',
- ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ',
- 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_', '4', '5', '4', '_', ':', 'e', 'n',
- 'c', 'o', 'd', 'i', 'n', 'g', ':', 'S', 'I', 'G', 'N', 'A', 'L', '#', '1', ' ', '.',
- 'S', 'I', 'G', 'N', 'A', 'L', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c',
- 'o', 'l', 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_', '4',
- '5', '4', '_', ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':', 'P', 'O', 'S', 'I',
- 'T', 'I', 'O', 'N', '#', '1', ' ', '.', 'P', 'O', 'S', 'I', 'T', 'I', 'O', 'N', ';',
- '}', 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_',
- '4', '5', '4', '_', ':', 't', 'b', 'l', ':', 'v', '1', '#', '1', '=', 'N', 'C', 'B',
- 'I', ':', 'S', 'R', 'A', ':', '_', '4', '5', '4', '_', ':', 'l', 'e', 'g', 'a', 'c',
- 'y', '#', '1', ',', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':',
- 's', 'p', 'o', 't', 'd', 'e', 's', 'c', '_', 'n', 'o', 'p', 'h', 'y', 's', '#', '1',
- '.', '0', '.', '2', '{', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'p', 'l',
- 'a', 't', 'f', 'o', 'r', 'm', '_', 'i', 'd', ' ', 'o', 'u', 't', '_', 'p', 'l', 'a',
- 't', 'f', 'o', 'r', 'm', '=', '.', 'P', 'L', 'A', 'T', 'F', 'O', 'R', 'M', '|', '<',
- 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'p', 'l', 'a', 't', 'f', 'o', 'r',
- 'm', '_', 'i', 'd', '>', 'e', 'c', 'h', 'o', '#', '1', '<', '1', '>', '(', ')', ';',
- 'I', 'N', 'S', 'D', 'C', ':', '2', 'n', 'a', ':', 'p', 'a', 'c', 'k', 'e', 'd', ' ',
- 'o', 'u', 't', '_', '2', 'n', 'a', '_', 'p', 'a', 'c', 'k', 'e', 'd', '=', '.', 'R',
- 'E', 'A', 'D', ';', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y',
- ':', 'p', 'h', 'r', 'e', 'd', ' ', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '_', 'p',
- 'h', 'r', 'e', 'd', '=', '.', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', ';', 'I', 'N', 'S',
- 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ' ', 'o', 'u', 't', '_', 'f',
- 'l', 'o', 'w', '_', 'c', 'h', 'a', 'r', 's', '=', '.', 'F', 'L', 'O', 'W', '_', 'C',
- 'H', 'A', 'R', 'S', ';', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e',
- 'x', 't', ' ', 'o', 'u', 't', '_', 'k', 'e', 'y', '_', 's', 'e', 'q', 'u', 'e', 'n',
- 'c', 'e', '=', '.', 'K', 'E', 'Y', '_', 'S', 'E', 'Q', 'U', 'E', 'N', 'C', 'E', ';',
- 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'p', 'o', 's', '1', '6', ' ', 'o', 'u',
- 't', '_', 'p', 'o', 's', 'i', 't', 'i', 'o', 'n', '1', '6', '=', 'N', 'C', 'B', 'I',
- ':', 'S', 'R', 'A', ':', '_', '4', '5', '4', '_', ':', 'p', 'r', 'o', 'c', 'e', 's',
- 's', '_', 'p', 'o', 's', 'i', 't', 'i', 'o', 'n', '#', '1', '(', '.', 'P', 'O', 'S',
- 'I', 'T', 'I', 'O', 'N', ',', '.', 'R', 'D', '_', 'F', 'I', 'L', 'T', 'E', 'R', ',',
- '.', 'S', 'I', 'G', 'N', 'A', 'L', ')', '|', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A',
- ':', '_', '4', '5', '4', '_', ':', 'p', 'r', 'o', 'c', 'e', 's', 's', '_', 'p', 'o',
- 's', 'i', 't', 'i', 'o', 'n', '#', '1', '(', '.', 'P', 'O', 'S', 'I', 'T', 'I', 'O',
- 'N', ',', '.', 'R', 'D', '_', 'F', 'I', 'L', 'T', 'E', 'R', ')', '|', 'N', 'C', 'B',
- 'I', ':', 'S', 'R', 'A', ':', '_', '4', '5', '4', '_', ':', 'p', 'r', 'o', 'c', 'e',
- 's', 's', '_', 'p', 'o', 's', 'i', 't', 'i', 'o', 'n', '#', '1', '(', '.', 'P', 'O',
- 'S', 'I', 'T', 'I', 'O', 'N', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'p', 'o', 's',
- 'i', 't', 'i', 'o', 'n', ':', 'o', 'n', 'e', ' ', 'o', 'u', 't', '_', 'p', 'o', 's',
- 'i', 't', 'i', 'o', 'n', '=', 'c', 'a', 's', 't', '#', '1', '(', 'o', 'u', 't', '_',
- 'p', 'o', 's', 'i', 't', 'i', 'o', 'n', '1', '6', ')', ';', '}', 't', 'a', 'b', 'l',
- 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_', '4', '5', '4', '_', ':',
- 't', 'b', 'l', ':', 'v', '1', '_', '2', 'a', '#', '1', '=', 'N', 'C', 'B', 'I', ':',
- 'S', 'R', 'A', ':', '_', '4', '5', '4', '_', ':', 't', 'b', 'l', ':', 'v', '1', '#',
- '1', '{', '_', '_', 'u', 'n', 't', 'y', 'p', 'e', 'd', '=', 'N', 'C', 'B', 'I', ':',
- 'S', 'R', 'A', ':', '_', '4', '5', '4', '_', ':', 'u', 'n', 't', 'y', 'p', 'e', 'd',
- '_', '1', '_', '2', 'a', '(', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a',
- ':', 't', 'e', 'x', 't', ' ', 'o', 'u', 't', '_', 'l', 'i', 'n', 'k', 'e', 'r', '_',
- 's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', '=', '.', 'L', 'I', 'N', 'K', 'E', 'R', '_',
- 'S', 'E', 'Q', 'U', 'E', 'N', 'C', 'E', ';', '}', 't', 'a', 'b', 'l', 'e', ' ', 'N',
- 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', '_', '4', '5', '4', '_', ':', 't', 'b', 'l',
- ':', 'v', '1', '_', '2', 'b', '#', '1', '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A',
- ':', '_', '4', '5', '4', '_', ':', 't', 'b', 'l', ':', 'v', '1', '#', '1', '{', '_',
- '_', 'u', 'n', 't', 'y', 'p', 'e', 'd', '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A',
- ':', '_', '4', '5', '4', '_', ':', 'u', 'n', 't', 'y', 'p', 'e', 'd', '_', '1', '_',
- '2', 'b', '(', ')', ';', '}', 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':',
- 'S', 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a', ':', 'l', 'e', 'g', 'a',
- 'c', 'y', '#', '1', '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l',
- ':', 's', 'r', 'a', '#', '1', '.', '0', '.', '3', ',', 'N', 'C', 'B', 'I', ':', 't',
- 'b', 'l', ':', 'b', 'a', 's', 'e', '_', 's', 'p', 'a', 'c', 'e', '_', 'n', 'o', 'c',
- 'o', 'l', '#', '1', '.', '0', '.', '3', ',', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A',
- ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a', ':', 'c', 'o', 'm', 'm', 'o', 'n', '#',
- '1', '.', '0', '.', '3', '{', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I',
- ':', 'f', 's', 'a', 'm', 'p', '4', ' ', 'S', 'I', 'G', 'N', 'A', 'L', ' ', '=', ' ',
- '(', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p', '4', ')', '<', 'N', 'C', 'B',
- 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p', 'p', 'e', 'd', '_', 'f', 's', 'a',
- 'm', 'p', '4', '>', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p',
- '#', '1', '(', 'o', 'u', 't', '_', 's', 'i', 'g', 'n', 'a', 'l', ',', 'o', 'u', 't',
- '_', 'x', '2', 'n', 'a', '_', 'b', 'i', 'n', ')', '|', '(', 'N', 'C', 'B', 'I', ':',
- 'f', 's', 'a', 'm', 'p', '4', ')', '<', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':',
- 'r', 'o', 't', 'a', 't', 'e', 'd', '_', 'f', 's', 'a', 'm', 'p', '4', '>', 'N', 'C',
- 'B', 'I', ':', 'S', 'R', 'A', ':', 'r', 'o', 't', 'a', 't', 'e', '#', '1', '<', 'f',
- 'a', 'l', 's', 'e', '>', '(', 'o', 'u', 't', '_', 's', 'i', 'g', 'n', 'a', 'l', ',',
- 'o', 'u', 't', '_', 'x', '2', 'n', 'a', '_', 'b', 'i', 'n', ')', ';', 'c', 'o', 'l',
- 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p', '4', ' ', 'I',
- 'N', 'T', 'E', 'N', 'S', 'I', 'T', 'Y', ' ', '=', ' ', '<', 'N', 'C', 'B', 'I', ':',
- 'f', 's', 'a', 'm', 'p', '4', '>', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'd',
- 'e', 'n', 'o', 'r', 'm', 'a', 'l', 'i', 'z', 'e', '#', '1', '(', 'o', 'u', 't', '_',
- 'n', 'o', 'r', 'm', '_', 'i', 'n', 't', 'e', 'n', 's', 'i', 't', 'y', ',', 'o', 'u',
- 't', '_', 'x', '2', 'n', 'a', '_', 'b', 'i', 'n', ')', ';', 'c', 'o', 'l', 'u', 'm',
- 'n', ' ', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p', '4', ' ', 'N', 'O', 'I',
- 'S', 'E', ' ', '=', ' ', 'o', 'u', 't', '_', 'n', 'o', 'i', 's', 'e', ';', 'N', 'C',
- 'B', 'I', ':', 'f', 's', 'a', 'm', 'p', '4', ' ', 'o', 'u', 't', '_', 'n', 'o', 'r',
- 'm', '_', 'i', 'n', 't', 'e', 'n', 's', 'i', 't', 'y', '=', '(', 'N', 'C', 'B', 'I',
- ':', 'f', 's', 'a', 'm', 'p', '4', ')', '<', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A',
- ':', 's', 'w', 'a', 'p', 'p', 'e', 'd', '_', 'f', 's', 'a', 'm', 'p', '4', '>', 'N',
- 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p', '#', '1', '(', 'o', 'u',
- 't', '_', 'i', 'n', 't', 'e', 'n', 's', 'i', 't', 'y', ',', 'o', 'u', 't', '_', 'x',
- '2', 'n', 'a', '_', 'b', 'i', 'n', ')', '|', '(', 'N', 'C', 'B', 'I', ':', 'f', 's',
- 'a', 'm', 'p', '4', ')', '<', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'r', 'o',
- 't', 'a', 't', 'e', 'd', '_', 'f', 's', 'a', 'm', 'p', '4', '>', 'N', 'C', 'B', 'I',
- ':', 'S', 'R', 'A', ':', 'r', 'o', 't', 'a', 't', 'e', '#', '1', '<', 'f', 'a', 'l',
- 's', 'e', '>', '(', 'o', 'u', 't', '_', 'i', 'n', 't', 'e', 'n', 's', 'i', 't', 'y',
- ',', 'o', 'u', 't', '_', 'x', '2', 'n', 'a', '_', 'b', 'i', 'n', ')', ';', '}', 't',
- 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l',
- 'u', 'm', 'i', 'n', 'a', ':', 't', 'b', 'l', ':', 'v', '0', '#', '1', '=', 'N', 'C',
- 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a', ':', 'l',
- 'e', 'g', 'a', 'c', 'y', '#', '1', ',', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':',
- 't', 'b', 'l', ':', 's', 'k', 'e', 'y', 'n', 'a', 'm', 'e', '#', '1', '.', '0', '.',
- '1', '{', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'p', 'l', 'a', 't', 'f',
- 'o', 'r', 'm', '_', 'i', 'd', ' ', 'o', 'u', 't', '_', 'p', 'l', 'a', 't', 'f', 'o',
- 'r', 'm', '=', '<', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'p', 'l', 'a',
- 't', 'f', 'o', 'r', 'm', '_', 'i', 'd', '>', 'e', 'c', 'h', 'o', '#', '1', '<', '2',
- '>', '(', ')', ';', 'a', 's', 'c', 'i', 'i', ' ', 'o', 'u', 't', '_', 's', 'l', 'x',
- '_', 'p', 'r', 'e', 'f', 'i', 'x', '=', '<', 'a', 's', 'c', 'i', 'i', '>', 'm', 'e',
- 't', 'a', ':', 'r', 'e', 'a', 'd', '#', '1', '<', '\'', 'S', 'L', 'X', '_', 'P',
- 'R', 'E', 'F', 'I', 'X', '\'', '>', '(', ')', '|', '<', 'a', 's', 'c', 'i', 'i',
- '>', 'e', 'c', 'h', 'o', '#', '1', '<', '\'', '\'', '>', '(', ')', ';', 'a', 's',
- 'c', 'i', 'i', ' ', 'r', 'e', 'w', 'r', 'i', 't', 't', 'e', 'n', '_', 's', 'p', 'o',
- 't', '_', 'n', 'a', 'm', 'e', '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'r',
- 'e', 'w', 'r', 'i', 't', 'e', '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '#',
- '1', '<', '2', '>', '(', 'o', 'u', 't', '_', 's', 'k', 'e', 'y', ',', 'o', 'u', 't',
- '_', 's', 'l', 'x', '_', 'p', 'r', 'e', 'f', 'i', 'x', ')', ';', 'I', 'N', 'S', 'D',
- 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', ' ', 'o', 'u', 't', '_', 'y',
- '_', 'c', 'o', 'o', 'r', 'd', '=', '(', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o',
- 'r', 'd', ':', 'v', 'a', 'l', ')', '<', 'I', '3', '2', '>', 'c', 'u', 't', '#', '1',
- '<', '0', '>', '(', 'c', 'o', 'o', 'r', 'd', 's', '_', 'f', 'r', 'o', 'm', '_', 's',
- 'k', 'e', 'y', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':',
- 'v', 'a', 'l', ' ', 'o', 'u', 't', '_', 'x', '_', 'c', 'o', 'o', 'r', 'd', '=', '(',
- 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', ')', '<',
- 'I', '3', '2', '>', 'c', 'u', 't', '#', '1', '<', '1', '>', '(', 'c', 'o', 'o', 'r',
- 'd', 's', '_', 'f', 'r', 'o', 'm', '_', 's', 'k', 'e', 'y', ')', ';', 'I', 'N', 'S',
- 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', ' ', 'o', 'u', 't', '_',
- 't', 'i', 'l', 'e', '_', 'c', 'o', 'o', 'r', 'd', '=', '(', 'I', 'N', 'S', 'D', 'C',
- ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', ')', '<', 'I', '3', '2', '>', 'c',
- 'u', 't', '#', '1', '<', '2', '>', '(', 'c', 'o', 'o', 'r', 'd', 's', '_', 'f', 'r',
- 'o', 'm', '_', 's', 'k', 'e', 'y', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o',
- 'o', 'r', 'd', ':', 'v', 'a', 'l', ' ', 'o', 'u', 't', '_', 'l', 'a', 'n', 'e', '_',
- 'c', 'o', 'o', 'r', 'd', '=', '(', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r',
- 'd', ':', 'v', 'a', 'l', ')', '<', 'I', '3', '2', '>', 'c', 'u', 't', '#', '1', '<',
- '3', '>', '(', 'c', 'o', 'o', 'r', 'd', 's', '_', 'f', 'r', 'o', 'm', '_', 's', 'k',
- 'e', 'y', ')', ';', 'I', '3', '2', '[', '4', ']', ' ', 'c', 'o', 'o', 'r', 'd', 's',
- '_', 'f', 'r', 'o', 'm', '_', 's', 'k', 'e', 'y', '=', 'N', 'C', 'B', 'I', ':', 'S',
- 'R', 'A', ':', 'e', 'x', 't', 'r', 'a', 'c', 't', '_', 'c', 'o', 'o', 'r', 'd', 'i',
- 'n', 'a', 't', 'e', 's', '#', '1', '<', '2', '>', '(', 'o', 'u', 't', '_', 's', 'k',
- 'e', 'y', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', '2', 'n', 'a', ':', 'p', 'a', 'c',
- 'k', 'e', 'd', ' ', 'o', 'u', 't', '_', '2', 'n', 'a', '_', 'p', 'a', 'c', 'k', 'e',
- 'd', '=', '.', 'R', 'E', 'A', 'D', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o',
- 'r', 'd', ':', 'l', 'e', 'n', ' ', 's', 't', 'a', 't', 'i', 'c', '_', 'f', 'i', 'x',
- 'e', 'd', '_', 's', 'p', 'o', 't', '_', 'l', 'e', 'n', '=', 's', 'p', 'o', 't', '_',
- 'l', 'e', 'n', ';', 'U', '8', ' ', 'o', 'u', 't', '_', 'n', 'r', 'e', 'a', 'd', 's',
- '=', '<', 'U', '8', '>', 'm', 'e', 't', 'a', ':', 'v', 'a', 'l', 'u', 'e', '#', '1',
- '<', '\'', 'N', 'R', 'E', 'A', 'D', 'S', '\'', '>', '(', ')', '|', '<', 'U', '8',
- '>', 'e', 'c', 'h', 'o', '#', '1', '<', '1', '>', '(', ')', ';', 'I', 'N', 'S', 'D',
- 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o', ' ', 'o', 'u', 't', '_',
- 'r', 'e', 'a', 'd', '_', 's', 't', 'a', 'r', 't', '=', '(', 'I', 'N', 'S', 'D', 'C',
- ':', 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o', ')', '<', 'U', '3', '2', '>',
- 'c', 'u', 't', '#', '1', '<', '1', '>', '(', 'r', 'e', 'a', 'd', '_', 's', 'e', 'g',
- '_', 'f', 'r', 'o', 'm', '_', 'r', 'e', 'a', 'd', 'n', ')', '|', '<', 'I', 'N', 'S',
- 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'z', 'e', 'r', 'o', '>', 'e', 'c', 'h',
- 'o', '#', '1', '<', '0', '>', '(', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o',
- 'o', 'r', 'd', ':', 'l', 'e', 'n', ' ', 'o', 'u', 't', '_', 'r', 'e', 'a', 'd', '_',
- 'l', 'e', 'n', '=', '(', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':',
- 'l', 'e', 'n', ')', '<', 'U', '3', '2', '>', 'c', 'u', 't', '#', '1', '<', '2', '>',
- '(', 'r', 'e', 'a', 'd', '_', 's', 'e', 'g', '_', 'f', 'r', 'o', 'm', '_', 'r', 'e',
- 'a', 'd', 'n', ')', '|', 's', 'p', 'o', 't', '_', 'l', 'e', 'n', ';', 'U', '3', '2',
- '[', '5', ']', ' ', 'r', 'e', 'a', 'd', '_', 's', 'e', 'g', '_', 'f', 'r', 'o', 'm',
- '_', 'r', 'e', 'a', 'd', 'n', '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'r',
- 'e', 'a', 'd', '_', 's', 'e', 'g', '_', 'f', 'r', 'o', 'm', '_', 'r', 'e', 'a', 'd',
- 'n', '#', '1', '(', 'o', 'u', 't', '_', 'n', 'r', 'e', 'a', 'd', 's', ',', 's', 'p',
- 'o', 't', '_', 'l', 'e', 'n', ')', ';', 'U', '3', '2', ' ', 'r', 'e', 'a', 'd', '_',
- 't', 'y', 'p', 'e', '_', 'f', 'r', 'o', 'm', '_', 'r', 'e', 'a', 'd', '_', 's', 'e',
- 'g', '=', '<', 'U', '3', '2', '>', 'c', 'u', 't', '#', '1', '<', '0', '>', '(', 'r',
- 'e', 'a', 'd', '_', 's', 'e', 'g', '_', 'f', 'r', 'o', 'm', '_', 'r', 'e', 'a', 'd',
- 'n', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'r', 'e', 'a', 'd',
- '_', 't', 'y', 'p', 'e', ' ', 'o', 'u', 't', '_', 'r', 'e', 'a', 'd', '_', 't', 'y',
- 'p', 'e', '=', 'c', 'a', 's', 't', '#', '1', '(', 'r', 'e', 'a', 'd', '_', 't', 'y',
- 'p', 'e', '_', 'f', 'r', 'o', 'm', '_', 'r', 'e', 'a', 'd', '_', 's', 'e', 'g', ')',
- '|', '(', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'r', 'e', 'a', 'd', '_',
- 't', 'y', 'p', 'e', ')', '<', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'x',
- 'r', 'e', 'a', 'd', '_', 't', 'y', 'p', 'e', '>', 'e', 'c', 'h', 'o', '#', '1', '<',
- '1', '>', '(', ')', ';', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'r', 'o', 't',
- 'a', 't', 'e', 'd', '_', 'f', 's', 'a', 'm', 'p', '4', ' ', 'o', 'u', 't', '_', 's',
- 'i', 'g', 'n', 'a', 'l', '=', '.', 'S', 'I', 'G', 'N', 'A', 'L', ';', 'N', 'C', 'B',
- 'I', ':', 'S', 'R', 'A', ':', 'r', 'o', 't', 'a', 't', 'e', 'd', '_', 'f', 's', 'a',
- 'm', 'p', '4', ' ', 'o', 'u', 't', '_', 'i', 'n', 't', 'e', 'n', 's', 'i', 't', 'y',
- '=', '.', 'I', 'N', 'T', 'E', 'N', 'S', 'I', 'T', 'Y', ';', 'N', 'C', 'B', 'I', ':',
- 'f', 's', 'a', 'm', 'p', '4', ' ', 'o', 'u', 't', '_', 'n', 'o', 'i', 's', 'e', '=',
- '.', 'N', 'O', 'I', 'S', 'E', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c',
- 'o', 'l', 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l',
- 'l', 'u', 'm', 'i', 'n', 'a', ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':', 'R',
- 'E', 'A', 'D', '#', '1', ' ', '.', 'R', 'E', 'A', 'D', ';', 'p', 'h', 'y', 's', 'i',
- 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S',
- 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a', ':', 'e', 'n', 'c', 'o', 'd',
- 'i', 'n', 'g', ':', 'S', 'I', 'G', 'N', 'A', 'L', '#', '1', ' ', '.', 'S', 'I', 'G',
- 'N', 'A', 'L', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u',
- 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm',
- 'i', 'n', 'a', ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':', 'I', 'N', 'T', 'E',
- 'N', 'S', 'I', 'T', 'Y', '#', '1', ' ', '.', 'I', 'N', 'T', 'E', 'N', 'S', 'I', 'T',
- 'Y', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n',
- ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n',
- 'a', ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':', 'N', 'O', 'I', 'S', 'E', '#',
- '1', ' ', '.', 'N', 'O', 'I', 'S', 'E', ';', '}', 't', 'a', 'b', 'l', 'e', ' ', 'N',
- 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a', ':',
- 't', 'b', 'l', ':', 'v', '0', 'a', '#', '1', '=', 'N', 'C', 'B', 'I', ':', 'S', 'R',
- 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a', ':', 't', 'b', 'l', ':', 'v', '0',
- '#', '1', ',', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm',
- 'i', 'n', 'a', ':', 'q', 'u', 'a', 'l', '4', '_', 'n', 'o', 'c', 'o', 'l', '#', '1',
- '.', '0', '.', '1', '{', '_', '_', 'u', 'n', 't', 'y', 'p', 'e', 'd', '=', 'N', 'C',
- 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a', ':', 'u',
- 'n', 't', 'y', 'p', 'e', 'd', '_', '0', 'a', '(', ')', ';', 'N', 'C', 'B', 'I', ':',
- 'S', 'R', 'A', ':', 'r', 'o', 't', 'a', 't', 'e', 'd', '_', 'q', 'u', 'a', 'l', '4',
- ' ', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '4', '_', 'r', 'o', 't', 'a', 't', 'e',
- 'd', '=', '.', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', ';', 'I', 'N', 'S', 'D', 'C', ':',
- 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'p', 'h', 'r', 'e', 'd', ' ', 'o', 'u', 't',
- '_', 'q', 'u', 'a', 'l', '2', '_', 'p', 'h', 'r', 'e', 'd', '=', '.', 'Q', 'U', 'A',
- 'L', 'I', 'T', 'Y', '2', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o',
- 'l', 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l',
- 'u', 'm', 'i', 'n', 'a', ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':', 'Q', 'U',
- 'A', 'L', 'I', 'T', 'Y', '#', '1', ' ', '.', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', ';',
- 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'N',
- 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a', ':',
- 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', '2',
- '#', '1', ' ', '.', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', '2', ';', '}', 't', 'a', 'b',
- 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm',
- 'i', 'n', 'a', ':', 't', 'b', 'l', ':', 'v', '0', 'b', '#', '1', '=', 'N', 'C', 'B',
- 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a', ':', 't', 'b',
- 'l', ':', 'v', '0', '#', '1', ',', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':', 'p',
- 'h', 'r', 'e', 'd', '_', 'q', 'u', 'a', 'l', 'i', 't', 'y', '_', 'n', 'o', 'c', 'o',
- 'l', '#', '1', '.', '0', '.', '1', '{', '_', '_', 'u', 'n', 't', 'y', 'p', 'e', 'd',
- '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n',
- 'a', ':', 'u', 'n', 't', 'y', 'p', 'e', 'd', '_', '0', 'b', '(', ')', ';', 'I', 'N',
- 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'p', 'h', 'r', 'e', 'd',
- ' ', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '_', 'p', 'h', 'r', 'e', 'd', '=', '.',
- 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', '|', '.', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', '2',
- ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ',
- 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a',
- ':', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ':', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y',
- '2', '#', '1', ' ', '.', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', ';', 'p', 'h', 'y', 's',
- 'i', 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'N', 'C', 'B', 'I', ':',
- 'S', 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a', ':', 'e', 'n', 'c', 'o',
- 'd', 'i', 'n', 'g', ':', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', '2', '#', '1', ' ', '.',
- 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', '2', ';', '}', 't', 'a', 'b', 'l', 'e', ' ', 'N',
- 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a', ':',
- 't', 'b', 'l', ':', 'v', '1', '#', '1', '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A',
- ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a', ':', 'l', 'e', 'g', 'a', 'c', 'y', '#',
- '1', ',', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's', 'p',
- 'o', 't', 'd', 'e', 's', 'c', '_', 'n', 'o', 'p', 'h', 'y', 's', '#', '1', '.', '0',
- '.', '2', ',', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l', ':', 's',
- 'k', 'e', 'y', 'n', 'a', 'm', 'e', '_', 'n', 'o', 'c', 'o', 'l', '#', '2', '.', '0',
- '.', '1', '{', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'p', 'l', 'a', 't',
- 'f', 'o', 'r', 'm', '_', 'i', 'd', ' ', 'o', 'u', 't', '_', 'p', 'l', 'a', 't', 'f',
- 'o', 'r', 'm', '=', '.', 'P', 'L', 'A', 'T', 'F', 'O', 'R', 'M', '|', '<', 'I', 'N',
- 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'p', 'l', 'a', 't', 'f', 'o', 'r', 'm', '_',
- 'i', 'd', '>', 'e', 'c', 'h', 'o', '#', '1', '<', '2', '>', '(', ')', ';', 'I', 'N',
- 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', ' ', 'o', 'u', 't',
- '_', 't', 'i', 'l', 'e', '_', 'c', 'o', 'o', 'r', 'd', '=', '(', 'I', 'N', 'S', 'D',
- 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', ')', '<', 'I', '3', '2', '>',
- 'c', 'u', 't', '#', '1', '<', '2', '>', '(', 'c', 'o', 'o', 'r', 'd', 's', '_', 'f',
- 'r', 'o', 'm', '_', 's', 'p', 'o', 't', 'n', 'a', 'm', 'e', ')', ';', 'I', 'N', 'S',
- 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', ' ', 'o', 'u', 't', '_',
- 'l', 'a', 'n', 'e', '_', 'c', 'o', 'o', 'r', 'd', '=', '(', 'I', 'N', 'S', 'D', 'C',
- ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', ')', '<', 'I', '3', '2', '>', 'c',
- 'u', 't', '#', '1', '<', '3', '>', '(', 'c', 'o', 'o', 'r', 'd', 's', '_', 'f', 'r',
- 'o', 'm', '_', 's', 'p', 'o', 't', 'n', 'a', 'm', 'e', ')', ';', 'I', '3', '2', '[',
- '4', ']', ' ', 'c', 'o', 'o', 'r', 'd', 's', '_', 'f', 'r', 'o', 'm', '_', 's', 'p',
- 'o', 't', 'n', 'a', 'm', 'e', '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'e',
- 'x', 't', 'r', 'a', 'c', 't', '_', 'c', 'o', 'o', 'r', 'd', 'i', 'n', 'a', 't', 'e',
- 's', '#', '1', '<', '2', '>', '(', '_', 'o', 'u', 't', '_', 'n', 'a', 'm', 'e', ')',
- ';', 'I', 'N', 'S', 'D', 'C', ':', '2', 'n', 'a', ':', 'p', 'a', 'c', 'k', 'e', 'd',
- ' ', 'o', 'u', 't', '_', '2', 'n', 'a', '_', 'p', 'a', 'c', 'k', 'e', 'd', '=', '.',
- 'R', 'E', 'A', 'D', ';', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't',
- 'y', ':', 'p', 'h', 'r', 'e', 'd', ' ', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '2',
- '_', 'p', 'h', 'r', 'e', 'd', '=', '.', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', '2', ';',
- 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'l', 'e', 'n', ' ', 's',
- 't', 'a', 't', 'i', 'c', '_', 'f', 'i', 'x', 'e', 'd', '_', 's', 'p', 'o', 't', '_',
- 'l', 'e', 'n', '=', 's', 'p', 'o', 't', '_', 'l', 'e', 'n', ';', 'N', 'C', 'B', 'I',
- ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p', 'p', 'e', 'd', '_', 'f', 's', 'a', 'm',
- 'p', '4', ' ', 'o', 'u', 't', '_', 's', 'i', 'g', 'n', 'a', 'l', '=', '.', 'S', 'I',
- 'G', 'N', 'A', 'L', ';', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a',
- 'p', 'p', 'e', 'd', '_', 'f', 's', 'a', 'm', 'p', '4', ' ', 'o', 'u', 't', '_', 'i',
- 'n', 't', 'e', 'n', 's', 'i', 't', 'y', '=', '.', 'I', 'N', 'T', 'E', 'N', 'S', 'I',
- 'T', 'Y', ';', 'N', 'C', 'B', 'I', ':', 'f', 's', 'a', 'm', 'p', '4', ' ', 'o', 'u',
- 't', '_', 'n', 'o', 'i', 's', 'e', '=', '.', 'N', 'O', 'I', 'S', 'E', ';', 'p', 'h',
- 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S',
- 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ' ', '.', 'F', 'L', 'O', 'W',
- '_', 'C', 'H', 'A', 'R', 'S', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c',
- 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't',
- 'e', 'x', 't', ' ', '.', 'K', 'E', 'Y', '_', 'S', 'E', 'Q', 'U', 'E', 'N', 'C', 'E',
- ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ',
- 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ' ', '.', 'L',
- 'I', 'N', 'K', 'E', 'R', '_', 'S', 'E', 'Q', 'U', 'E', 'N', 'C', 'E', ';', '}', 't',
- 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l',
- 'u', 'm', 'i', 'n', 'a', ':', 't', 'b', 'l', ':', 'v', '1', 'a', '#', '1', '=', 'N',
- 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a', ':',
- 't', 'b', 'l', ':', 'v', '1', '#', '1', ',', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A',
- ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n', 'a', ':', 'q', 'u', 'a', 'l', '4', '_', 'n',
- 'o', 'c', 'o', 'l', '#', '1', '.', '0', '.', '1', '{', '_', '_', 'u', 'n', 't', 'y',
- 'p', 'e', 'd', '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l', 'u',
- 'm', 'i', 'n', 'a', ':', 'u', 'n', 't', 'y', 'p', 'e', 'd', '_', '1', 'a', '(', ')',
- ';', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 's', 'w', 'a', 'p', 'p', 'e', 'd',
- '_', 'q', 'u', 'a', 'l', '4', ' ', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '4', '_',
- 's', 'w', 'a', 'p', 'p', 'e', 'd', '=', '.', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', ';',
- '}', 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I',
- 'l', 'l', 'u', 'm', 'i', 'n', 'a', ':', 't', 'b', 'l', ':', 'v', '1', 'b', '#', '1',
- '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l', 'u', 'm', 'i', 'n',
- 'a', ':', 't', 'b', 'l', ':', 'v', '1', '#', '1', ',', 'N', 'C', 'B', 'I', ':', 't',
- 'b', 'l', ':', 'p', 'h', 'r', 'e', 'd', '_', 'q', 'u', 'a', 'l', 'i', 't', 'y', '_',
- 'n', 'o', 'c', 'o', 'l', '#', '1', '.', '0', '.', '1', '{', '_', '_', 'u', 'n', 't',
- 'y', 'p', 'e', 'd', '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'I', 'l', 'l',
- 'u', 'm', 'i', 'n', 'a', ':', 'u', 'n', 't', 'y', 'p', 'e', 'd', '_', '1', 'b', '(',
- ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'p',
- 'h', 'r', 'e', 'd', ' ', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '_', 'p', 'h', 'r',
- 'e', 'd', '=', '.', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', ';', '}', 't', 'a', 'b', 'l',
- 'e', ' ', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'A', 'B', 'I', ':', 'l', 'e',
- 'g', 'a', 'c', 'y', '#', '1', '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 't',
- 'b', 'l', ':', 's', 'r', 'a', '#', '1', '.', '0', '.', '3', ',', 'N', 'C', 'B', 'I',
- ':', 't', 'b', 'l', ':', 'p', 'h', 'r', 'e', 'd', '_', 'q', 'u', 'a', 'l', 'i', 't',
- 'y', '_', 'n', 'o', 'c', 'o', 'l', '#', '1', '.', '0', '.', '1', ',', 'N', 'C', 'B',
- 'I', ':', 'S', 'R', 'A', ':', 'A', 'B', 'I', ':', 'c', 'o', 'm', 'm', 'o', 'n', '#',
- '1', '.', '0', '.', '3', '{', '}', 't', 'a', 'b', 'l', 'e', ' ', 'N', 'C', 'B', 'I',
- ':', 'S', 'R', 'A', ':', 'A', 'B', 'I', ':', 't', 'b', 'l', ':', 'v', '1', '#', '1',
- '=', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'A', 'B', 'I', ':', 'l', 'e', 'g',
- 'a', 'c', 'y', '#', '1', ',', 'N', 'C', 'B', 'I', ':', 't', 'b', 'l', ':', 'c', 'o',
- 'l', 'o', 'r', '_', 's', 'p', 'a', 'c', 'e', '_', 'n', 'o', 'c', 'o', 'l', '#', '1',
- '.', '0', '.', '3', ',', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b', 'l',
- ':', 's', 'p', 'o', 't', 'd', 'e', 's', 'c', '_', 'n', 'o', 'p', 'h', 'y', 's', '#',
- '1', '.', '0', '.', '2', ',', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 't', 'b',
- 'l', ':', 's', 'k', 'e', 'y', 'n', 'a', 'm', 'e', '_', 'n', 'o', 'c', 'o', 'l', '#',
- '2', '.', '0', '.', '1', '{', '_', '_', 'u', 'n', 't', 'y', 'p', 'e', 'd', '=', 'N',
- 'C', 'B', 'I', ':', 'S', 'R', 'A', ':', 'A', 'B', 'I', ':', 'u', 'n', 't', 'y', 'p',
- 'e', 'd', '_', '1', '(', ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':',
- 'p', 'l', 'a', 't', 'f', 'o', 'r', 'm', '_', 'i', 'd', ' ', 'o', 'u', 't', '_', 'p',
- 'l', 'a', 't', 'f', 'o', 'r', 'm', '=', '.', 'P', 'L', 'A', 'T', 'F', 'O', 'R', 'M',
- '|', '<', 'I', 'N', 'S', 'D', 'C', ':', 'S', 'R', 'A', ':', 'p', 'l', 'a', 't', 'f',
- 'o', 'r', 'm', '_', 'i', 'd', '>', 'e', 'c', 'h', 'o', '#', '1', '<', '3', '>', '(',
- ')', ';', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l',
- ' ', 'o', 'u', 't', '_', 'p', 'a', 'n', 'e', 'l', '_', 'c', 'o', 'o', 'r', 'd', '=',
- '(', 'I', 'N', 'S', 'D', 'C', ':', 'c', 'o', 'o', 'r', 'd', ':', 'v', 'a', 'l', ')',
- '<', 'I', '3', '2', '>', 'c', 'u', 't', '#', '1', '<', '2', '>', '(', 'c', 'o', 'o',
- 'r', 'd', 's', '_', 'f', 'r', 'o', 'm', '_', 's', 'p', 'o', 't', 'n', 'a', 'm', 'e',
- ')', ';', 'I', '3', '2', '[', '4', ']', ' ', 'c', 'o', 'o', 'r', 'd', 's', '_', 'f',
- 'r', 'o', 'm', '_', 's', 'p', 'o', 't', 'n', 'a', 'm', 'e', '=', 'N', 'C', 'B', 'I',
- ':', 'S', 'R', 'A', ':', 'e', 'x', 't', 'r', 'a', 'c', 't', '_', 'c', 'o', 'o', 'r',
- 'd', 'i', 'n', 'a', 't', 'e', 's', '#', '1', '<', '3', '>', '(', 'o', 'u', 't', '_',
- 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', ')', ';', 'a', 's', 'c', 'i', 'i', ' ',
- 'o', 'u', 't', '_', 's', 'p', 'o', 't', '_', 'n', 'a', 'm', 'e', '=', 'I', 'N', 'S',
- 'D', 'C', ':', 'S', 'R', 'A', ':', 'f', 'o', 'r', 'm', 'a', 't', '_', 's', 'p', 'o',
- 't', '_', 'n', 'a', 'm', 'e', '#', '1', '(', 'o', 'u', 't', '_', 'n', 'a', 'm', 'e',
- '_', 'f', 'm', 't', ',', 'o', 'u', 't', '_', 'x', '_', 'c', 'o', 'o', 'r', 'd', ',',
- 'o', 'u', 't', '_', 'y', '_', 'c', 'o', 'o', 'r', 'd', ')', ';', 'I', 'N', 'S', 'D',
- 'C', ':', '2', 'c', 's', ':', 'p', 'a', 'c', 'k', 'e', 'd', ' ', 'o', 'u', 't', '_',
- '2', 'c', 's', '_', 'p', 'a', 'c', 'k', 'e', 'd', '=', '.', 'C', 'S', 'R', 'E', 'A',
- 'D', ';', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ' ',
- 'o', 'u', 't', '_', 'c', 's', '_', 'k', 'e', 'y', '=', '.', 'C', 'S', '_', 'K', 'E',
- 'Y', ';', 'I', 'N', 'S', 'D', 'C', ':', 'q', 'u', 'a', 'l', 'i', 't', 'y', ':', 'p',
- 'h', 'r', 'e', 'd', ' ', 'o', 'u', 't', '_', 'q', 'u', 'a', 'l', '_', 'p', 'h', 'r',
- 'e', 'd', '=', '.', 'Q', 'U', 'A', 'L', 'I', 'T', 'Y', ';', 'I', 'N', 'S', 'D', 'C',
- ':', 'c', 'o', 'o', 'r', 'd', ':', 'l', 'e', 'n', ' ', 's', 't', 'a', 't', 'i', 'c',
- '_', 'f', 'i', 'x', 'e', 'd', '_', 's', 'p', 'o', 't', '_', 'l', 'e', 'n', '=', 's',
- 'p', 'o', 't', '_', 'l', 'e', 'n', ';', 'N', 'C', 'B', 'I', ':', 'S', 'R', 'A', ':',
- 's', 'w', 'a', 'p', 'p', 'e', 'd', '_', 'f', 's', 'a', 'm', 'p', '4', ' ', 'o', 'u',
- 't', '_', 's', 'i', 'g', 'n', 'a', 'l', '_', 's', 'w', 'a', 'p', 'p', 'e', 'd', '=',
- '.', 'S', 'I', 'G', 'N', 'A', 'L', ';', 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ',
- 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':',
- 't', 'e', 'x', 't', ' ', '.', 'F', 'L', 'O', 'W', '_', 'C', 'H', 'A', 'R', 'S', ';',
- 'p', 'h', 'y', 's', 'i', 'c', 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I',
- 'N', 'S', 'D', 'C', ':', 'd', 'n', 'a', ':', 't', 'e', 'x', 't', ' ', '.', 'K', 'E',
- 'Y', '_', 'S', 'E', 'Q', 'U', 'E', 'N', 'C', 'E', ';', 'p', 'h', 'y', 's', 'i', 'c',
- 'a', 'l', ' ', 'c', 'o', 'l', 'u', 'm', 'n', ' ', 'I', 'N', 'S', 'D', 'C', ':', 'd',
- 'n', 'a', ':', 't', 'e', 'x', 't', ' ', '.', 'L', 'I', 'N', 'K', 'E', 'R', '_', 'S',
- 'E', 'Q', 'U', 'E', 'N', 'C', 'E', ';', '}',
-};
-const size_t sra_schema_size = 68967;
diff --git a/libs/sra/sracache.c b/libs/sra/sracache.c
deleted file mode 100644
index b33db0e..0000000
--- a/libs/sra/sracache.c
+++ /dev/null
@@ -1,559 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <sra/extern.h>
-#include <sra/sradb-priv.h>
-
-#include <klib/rc.h>
-#include <kproc/lock.h>
-#include <klib/refcount.h>
-#include <kfg/config.h>
-
-#include <sysalloc.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
-#include <strtol.h>
-
-#include "sra-priv.h"
-
-/* some of the above #defines index on sun */
-#ifdef index
-    #undef index
-#endif
-
-/*================================== SRACacheMetrics ==================================*/
-static
-void 
-MetricsInit(SRACacheMetrics* self, const SRATable* table)
-{
-    self->bytes     = 0;/* TBD */
-    self->elements  = 1;
-    self->threads   = 0;/* TBD */
-    self->fds       = 0;/* TBD */
-}
-
-LIB_EXPORT
-bool CC
-SRACacheMetricsLessThan(const SRACacheMetrics* a, const SRACacheMetrics* b)
-{
-    if (a->bytes >= 0 && b->bytes >= 0 && a->bytes > b->bytes)
-        return false;
-    if (a->elements >= 0 && b->elements >= 0 && a->elements > b->elements)
-        return false;
-    if (a->threads >= 0 && b->threads >= 0 && a->threads > b->threads)
-        return false;
-    if (a->fds >= 0 && b->fds >= 0 && a->fds > b->fds)
-        return false;
-        
-    if (a->bytes    >= 0 && b->bytes    >= 0 && a->bytes    == b->bytes && 
-        a->elements >= 0 && b->elements >= 0 && a->elements == b->elements &&
-        a->threads  >= 0 && b->threads  >= 0 && a->threads  == b->threads &&
-        a->fds      >= 0 && b->fds      >= 0 && a->fds      == b->fds)
-        return false;
-        
-    return true;
-}
-
-static
-void 
-MetricsAdd(SRACacheMetrics* a, const SRACacheMetrics* b)
-{
-    a->bytes    += b->bytes;
-    a->elements += b->elements;
-    a->threads  += b->threads;
-    a->fds      += b->fds;
-}
-
-static
-void 
-MetricsSubtract(SRACacheMetrics* a, const SRACacheMetrics* b)
-{
-    a->bytes    -= b->bytes;
-    a->elements -= b->elements;
-    a->threads  -= b->threads;
-    a->fds      -= b->fds;
-}
-
-/*================================== SRACacheElement ==================================*/
-LIB_EXPORT rc_t CC SRACacheElementMake(SRACacheElement**        self, 
-                                       SRATable*                object, 
-                                       struct SRACacheIndex*    index, 
-                                       uint32_t                 key, 
-                                       const SRACacheMetrics*   metrics)
-{
-    rc_t rc = 0;
-    if ( self == NULL || object == NULL || index == NULL || metrics == NULL )
-        return RC( rcSRA, rcNode, rcConstructing, rcParam, rcNull );
-        
-    *self = malloc(sizeof(**self));
-    if (self == NULL)
-        rc = RC ( rcSRA, rcNode, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        (*self)->dad.next = NULL;
-        (*self)->dad.prev = NULL;
-        
-        (*self)->object = object;
-        rc = SRATableAddRef(object);
-        if ( rc != 0 )
-        {
-            free (*self);
-        }
-        else
-        {
-            (*self)->index = index;
-        
-            (*self)->key = key;
-        
-            memcpy(&(*self)->metrics, metrics, sizeof((*self)->metrics));
-        }
-    }
-        
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SRACacheElementDestroy(SRACacheElement* self)
-{
-    rc_t rc = 0;
-    if ( self == NULL )
-        return RC( rcSRA, rcNode, rcDestroying, rcSelf, rcNull );
-        
-    rc = SRATableRelease(self->object);
-    
-    free(self);
-    
-    return rc;
-}
-
-/*================================== SRACacheIndex ==================================*/
-LIB_EXPORT rc_t CC SRACacheIndexMake(SRACacheIndex** self, String* prefix)
-{
-    rc_t rc = 0;
-    if ( self == NULL || prefix == NULL )
-        return RC( rcSRA, rcIndex, rcConstructing, rcParam, rcNull );
-        
-    *self = malloc(sizeof(**self));
-    if (self == NULL)
-        rc = RC ( rcSRA, rcIndex, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        memset(*self, 0, sizeof(**self));
-        rc = StringCopy((const String**)&(*self)->prefix, prefix);
-        if (rc == 0)
-        {
-            rc = KVectorMake(&(*self)->body);
-            if (rc != 0)
-                StringWhack((*self)->prefix);
-        }
-        
-        if (rc != 0)
-        {
-            free(*self);
-            *self = NULL;
-        }
-    }
-    
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SRACacheIndexDestroy(SRACacheIndex* self)
-{
-    rc_t rc;
-    if ( self == NULL  )
-        return RC( rcSRA, rcIndex, rcDestroying, rcSelf, rcNull );
-        
-    rc = KVectorRelease(self->body);
-    StringWhack(self->prefix);
-    free(self);
-    return rc;
-}
-
-/*================================== SRACache ==================================*/
-static
-rc_t
-ReadValue(struct KConfig* kfg, const char* path, uint64_t* value, uint64_t dflt)
-{
-    rc_t rc = 0;
-    *value = dflt;
-    if ( kfg )
-    {   /* read configuration values */
-        const KConfigNode* node;
-        rc = KConfigOpenNodeRead( kfg, &node, path );
-        if (rc == 0)
-        {
-            uint64_t temp;
-            rc = KConfigNodeReadU64( node, &temp );
-            if (rc == 0)
-                *value = temp;
-            rc = KConfigNodeRelease ( node );
-        }
-        else if (rc == RC ( rcKFG, rcNode, rcOpening, rcPath, rcNotFound ))
-            rc = 0;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SRACacheInit(SRACache** self, struct KConfig* kfg)
-{
-    rc_t rc = 0;
-    if (self == NULL)
-        return RC( rcSRA, rcData, rcConstructing, rcSelf, rcNull );
-        
-    *self = malloc(sizeof(**self));
-    if (*self == NULL)
-        rc = RC ( rcSRA, rcData, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        uint64_t v;
-#define LOAD_VALUE(target, path, default)                       \
-        if (rc == 0)                                            \
-        {                                                       \
-            rc = ReadValue(kfg, path, &v, default);             \
-            if ( rc == 0 )                                      \
-                target = v;                                    \
-        }
-
-        LOAD_VALUE((*self)->softThreshold.bytes,    "/openserver/thresholds/soft/bytes",    SRACacheThresholdSoftBytesDefault);
-        LOAD_VALUE((*self)->softThreshold.elements, "/openserver/thresholds/soft/elements", SRACacheThresholdSoftElementsDefault);
-        LOAD_VALUE((*self)->softThreshold.threads,  "/openserver/thresholds/soft/threads",  SRACacheThresholdSoftThreadsDefault);
-        LOAD_VALUE((*self)->softThreshold.fds,      "/openserver/thresholds/soft/fds",      SRACacheThresholdSoftFdsDefault);
-            
-        LOAD_VALUE((*self)->hardThreshold.bytes,    "/openserver/thresholds/hard/bytes",    SRACacheThresholdHardBytesDefault);
-        LOAD_VALUE((*self)->hardThreshold.elements, "/openserver/thresholds/hard/elements", SRACacheThresholdHardElementsDefault);
-        LOAD_VALUE((*self)->hardThreshold.threads,  "/openserver/thresholds/hard/threads",  SRACacheThresholdHardThreadsDefault);
-        LOAD_VALUE((*self)->hardThreshold.fds,      "/openserver/thresholds/hard/fds",      SRACacheThresholdHardFdsDefault);
-#undef LOAD_VALUE
-    
-        if (rc == 0)
-        {
-            BSTreeInit( & (*self)->indexes );
-            DLListInit( & (*self)->lru );
-            
-            memset(&(*self)->current, 0, sizeof(*self)->current);
-            
-            (*self)->requests         = 0;
-            (*self)->hits             = 0;
-            (*self)->misses           = 0;
-            (*self)->busy             = 0;
-            
-            rc = KLockMake(&(*self)->mutex);
-        }
-    }        
-    
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SRACacheGetSoftThreshold(SRACache* self, SRACacheMetrics* metrics)
-{
-    if (self == NULL)
-        return RC( rcSRA, rcData, rcAccessing, rcSelf, rcNull );
-    if (metrics == NULL)
-        return RC( rcSRA, rcData, rcAccessing, rcParam, rcNull );
-    memcpy(metrics, &self->softThreshold, sizeof(self->softThreshold));
-    return 0;
-}
-
-LIB_EXPORT rc_t CC SRACacheSetSoftThreshold(SRACache* self, const SRACacheMetrics* metrics)
-{
-    if (self == NULL)
-        return RC( rcSRA, rcData, rcUpdating, rcSelf, rcNull );
-    if (metrics == NULL)
-        return RC( rcSRA, rcData, rcUpdating, rcParam, rcNull );
-    memcpy(&self->softThreshold, metrics, sizeof(self->softThreshold));
-    return 0;
-}
-
-LIB_EXPORT rc_t CC SRACacheGetHardThreshold(SRACache* self, SRACacheMetrics* metrics)
-{
-    if (self == NULL)
-        return RC( rcSRA, rcData, rcAccessing, rcSelf, rcNull );
-    if (metrics == NULL)
-        return RC( rcSRA, rcData, rcAccessing, rcParam, rcNull );
-    memcpy(metrics, &self->hardThreshold, sizeof(self->hardThreshold));
-    return 0;
-}
-
-LIB_EXPORT rc_t CC SRACacheSetHardThreshold(SRACache* self, const SRACacheMetrics* metrics)
-{
-    if (self == NULL)
-        return RC( rcSRA, rcData, rcUpdating, rcSelf, rcNull );
-    if (metrics == NULL)
-        return RC( rcSRA, rcData, rcUpdating, rcParam, rcNull );
-    memcpy(&self->hardThreshold, metrics, sizeof(self->hardThreshold));
-    return 0;
-}
-
-static void CC SRACacheIndexDestructor(BSTNode *n, void *data)
-{
-    SRACacheIndexDestroy((SRACacheIndex*)n);
-}
-static void CC SRACacheElementDestructor(DLNode *n, void *data)
-{
-    SRACacheElementDestroy((SRACacheElement*)n);
-}
-
-LIB_EXPORT rc_t CC SRACacheWhack(SRACache* self)
-{
-    rc_t rc = 0;
-    if (self == NULL)
-        return RC( rcSRA, rcData, rcDestroying, rcSelf, rcNull );
-
-    BSTreeWhack(&self->indexes, SRACacheIndexDestructor, NULL);
-    DLListWhack(&self->lru, SRACacheElementDestructor, NULL);
-    
-    rc = KLockRelease(self->mutex);
-    free(self);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SRACacheGetUsage(SRACache* self, SRACacheUsage* usage)
-{
-    if (self == NULL)
-        return RC( rcSRA, rcData, rcAccessing, rcSelf, rcNull );
-    if (usage == NULL)
-        return RC( rcSRA, rcData, rcAccessing, rcParam, rcNull );
-    usage->soft_threshold   = self->softThreshold.elements;
-    usage->hard_threshold   = self->hardThreshold.elements;
-    usage->elements         = self->current.elements;
-    usage->requests         = self->requests;
-    usage->hits             = self->hits;
-    usage->misses           = self->misses;
-    usage->busy             = self->busy;
-    return 0;
-}
-
-static
-int CC IndexCmp (const BSTNode * item, const BSTNode * n)
-{
-    return StringCompare( ((const SRACacheIndex *)item)->prefix, ((const SRACacheIndex *)n)->prefix );
-}
-    
-static
-int CC PrefixCmp (const void * item, const BSTNode * n)
-{
-    return StringCompare( (const String*)item, ((const SRACacheIndex *)n)->prefix );
-}
-    
-static
-rc_t
-AddNewIndex(BSTree* indexes, String* prefix, SRACacheIndex** newIdx)
-{
-    rc_t rc = SRACacheIndexMake(newIdx, prefix);
-    if (rc == 0)
-    {
-        rc = BSTreeInsert(indexes, &(*newIdx)->dad, IndexCmp);
-        if (rc != 0)
-            SRACacheIndexDestroy(*newIdx);
-    }
-    return rc;
-}
-
-static
-rc_t
-ParseAccessionName(const char *acc, String* prefix, uint32_t* key)
-{
-    rc_t rc = 0;
-    
-    /*  extract the alphabetic prefix from the accession's name */
-    size_t prefLen = 0;
-    while (acc[prefLen] != 0 && isalpha(acc[prefLen]))
-        ++prefLen;
-    StringInit(prefix, acc, prefLen, prefLen);
-    
-    {   /* the numeric key will be the rest of the accession's name, if fully numeric */
-        char *end;
-        *key = strtou32 ( acc + prefLen, & end, 10 );
-        if ( end [ 0 ] != 0 )
-            rc = RC( rcSRA, rcData, rcAccessing, rcName, rcInvalid );
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SRACacheAddTable(SRACache* self, const char* acc, SRATable* table)
-{ /* if crosses soft threshold, signal BG thread to wake up */
-    rc_t rc = 0;
-    String prefix;
-    uint32_t key;
-    
-    if (self == NULL)
-        return RC( rcSRA, rcData, rcAccessing, rcSelf, rcNull );
-    if (acc == NULL || acc[0] == 0 || table == NULL)
-        return RC( rcSRA, rcData, rcAccessing, rcParam, rcNull );
-
-    rc = ParseAccessionName(acc, &prefix, &key);
-    if (rc == 0)
-    {
-        rc = KLockAcquire(self->mutex);
-        if (rc == 0)
-        {
-            SRACacheIndex* index = (SRACacheIndex*) BSTreeFind ( &self->indexes, &prefix, PrefixCmp );
-            if (index == NULL)
-                rc = AddNewIndex( &self->indexes, &prefix, &index );
-                
-            if (rc == 0)
-            {
-                SRACacheElement* elem = NULL;
-                rc = KVectorGetPtr ( index->body, key, (void**)&elem );   
-                if (rc == 0 && elem != NULL) /* table already in cache */
-                    rc = RC( rcSRA, rcData, rcInserting, rcParam, rcExists );
-                else if (GetRCState(rc) == rcNotFound)
-                {
-                    SRACacheMetrics metrics;
-                    MetricsInit(&metrics, table);
-                    rc = SRACacheElementMake(&elem, table, index, key, &metrics);
-                    if (rc == 0)
-                    {
-                        rc = KVectorSetPtr( index->body, key, elem );
-                        if (rc != 0)
-                            SRACacheElementDestroy(elem);
-                        else
-                        {   /* success - update global usage and time-sorted list */
-                            MetricsAdd(&self->current, &metrics);
-                            DLListPushTail( &self->lru, (DLNode*)elem );
-                        }
-                    }
-                }
-            }
-                
-            {
-                rc_t rc2 = KLockUnlock(self->mutex);
-                if (rc == 0)
-                    rc = rc2;
-            }
-        }
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SRACacheGetTable(SRACache* self, const char* acc, const SRATable** object)
-{
-    rc_t rc = 0;
-    String prefix;
-    uint32_t key;
-    
-    if (self == NULL)
-        return RC( rcSRA, rcData, rcAccessing, rcSelf, rcNull );
-    if (acc == NULL || acc[0] == 0 || object == NULL)
-        return RC( rcSRA, rcData, rcAccessing, rcParam, rcNull );
-
-    *object = NULL;
-    
-    rc = ParseAccessionName(acc, &prefix, &key);
-    if (rc == 0)
-    {
-        ++ self->requests;
-        
-        rc = KLockAcquire(self->mutex);
-        if (rc == 0)
-        {
-            SRACacheIndex* index = (SRACacheIndex*) BSTreeFind ( &self->indexes, &prefix, PrefixCmp );
-            if (index != NULL)
-            {
-                SRACacheElement* elem = NULL;
-                rc = KVectorGetPtr ( index->body, key, (void**)&elem );   
-                if (rc == 0 && elem != NULL) 
-                {   
-                    if (atomic32_read(&elem->object->refcount) == 1)    /* owned by cache, not used elsewhere */
-                    {
-                        ++ self->hits;
-                        
-                        /* move to the least recently used position */
-                        DLListUnlink    ( &self->lru, &elem->dad );
-                        DLListPushTail  ( &self->lru, &elem->dad );
-                        
-                        *object = elem->object;
-                        rc = SRATableAddRef(*object);
-                    }
-                    else
-                    {
-                        ++ self->busy;
-                        rc = RC( rcSRA, rcData, rcAccessing, rcParam, rcBusy);
-                    }
-                }
-                else if (GetRCState(rc) == rcNotFound || elem == NULL)
-                {
-                    ++ self->misses;
-                    rc = 0;
-                }
-            }
-            else
-                ++ self->misses;
-                
-            {
-                rc_t rc2 = KLockUnlock(self->mutex);
-                if (rc == 0)
-                {
-                    rc = rc2;
-                    if (rc != 0)
-                        SRATableRelease(*object);
-                }
-            }
-        }
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SRACacheFlush(SRACache* self)
-{
-    rc_t rc = 0;
-    if (self == NULL)
-        return RC( rcSRA, rcData, rcAccessing, rcSelf, rcNull );
-        
-    rc = KLockAcquire(self->mutex);
-    if (rc == 0)
-    {
-        /* use the lower of the two thresholds */
-        const SRACacheMetrics* thr = &self->softThreshold;
-        if ( SRACacheMetricsLessThan( &self->hardThreshold, thr ) )
-            thr = &self->hardThreshold;
-            
-        while ( ! SRACacheMetricsLessThan( &self->current, thr ) )
-        {
-            SRACacheElement* toFlush = (SRACacheElement*) DLListPopHead( &self->lru );
-            if (toFlush == NULL)
-                break;
-            rc = KVectorUnset( toFlush->index->body, toFlush->key );
-            if (rc != 0)
-                break; /* something is badly wrong */
-            MetricsSubtract( &self->current, &toFlush->metrics );
-            rc = SRACacheElementDestroy(toFlush);
-            if (rc != 0)
-                break;
-        }
-        
-        {
-            rc_t rc2 = KLockUnlock(self->mutex);
-            if (rc == 0)
-                rc = rc2;
-        }
-    }
-
-    return rc;
-}
diff --git a/libs/sra/sracol.c b/libs/sra/sracol.c
deleted file mode 100644
index ea931de..0000000
--- a/libs/sra/sracol.c
+++ /dev/null
@@ -1,235 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <sra/extern.h>
-#include <sra/sradb.h>
-#include <sra/types.h>
-#include <vdb/schema.h>
-#include <vdb/cursor.h>
-#include <klib/refcount.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include "sra-priv.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-
-#define RC_MODULE (rcSRA)
-#define RC_TARGET (rcColumn)
-#define CLASS "SRAColumn"
-
-/* AddRef
- * Release
- *  see REFERENCE COUNTING, above
- */
-LIB_EXPORT rc_t CC SRAColumnAddRef( const SRAColumn *self ) {
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, CLASS ) )
-        {
-        case krefLimit:
-            return RC ( RC_MODULE, RC_TARGET, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-rc_t SRAColumnWhack ( SRAColumn *self )
-{
-    if ( self -> tbl != NULL )
-    {
-        rc_t rc = SRATableSever ( self -> tbl );
-        if ( ! self -> read_only )
-        {
-            self -> tbl = NULL;
-            return rc;
-        }
-    }
-
-    free ( self );
-    return 0;
-}
-
-LIB_EXPORT rc_t CC SRAColumnRelease ( const SRAColumn *self )
-{
-    if ( self != NULL )
-    {
-        rc_t rc;
-
-        switch ( KRefcountDrop ( & self -> refcount, "SRAColumn" ) )
-        {
-        case krefWhack:
-            return SRAColumnWhack ( ( SRAColumn* ) self );
-
-        case krefNegative:
-            rc = RC ( RC_MODULE, RC_TARGET, rcDestroying, rcSelf, rcDestroyed );
-            PLOGERR (klogInt,(klogInt, rc, "Released a SRAColumn $(B) with no more references",
-                      PLOG_P(self)));
-            return rc;
-        }
-    }
-
-    return 0;
-}
-
-
-/* OpenColumnRead
- *  open a column for read
- *
- *  "col" [ OUT ] - return parameter for newly opened column
- *
- *  "name" [ IN ] - NUL terminated string in UTF-8 giving column name
- *
- *  "datatype" [ IN, NULL OKAY ] - optional NUL terminated typedecl
- *  string describing fully qualified column data type, or if NULL
- *  the default type for column.
- */
-LIB_EXPORT rc_t CC SRATableOpenColumnRead( const SRATable *self,
-        const SRAColumn **rslt, const char *name, const char *datatype )
-{
-    rc_t rc;
-
-    if ( rslt == NULL )
-        rc = RC(RC_MODULE, rcColumn, rcOpening, rcParam, rcNull);
-    else
-    {
-        if ( self == NULL )
-            rc = RC(RC_MODULE, rcTable, rcAccessing, rcSelf, rcNull);
-        else if ( name == NULL )
-            rc = RC(RC_MODULE, rcColumn, rcOpening, rcName, rcNull);
-        else if ( name [ 0 ] == 0 )
-            rc = RC(RC_MODULE, rcColumn, rcOpening, rcName, rcEmpty);
-        else
-        {
-            SRAColumn *col = malloc ( sizeof * col );
-            if ( col == NULL )
-                rc = RC(RC_MODULE, RC_TARGET, rcConstructing, rcMemory, rcExhausted);
-            else
-            {
-                rc = ( datatype != NULL && datatype [ 0 ] != 0 ) ?
-                    VCursorAddColumn ( self -> curs, & col -> idx, "(%s)%s", datatype, name ):
-                    VCursorAddColumn ( self -> curs, & col -> idx, name );
-                if ( rc == 0 || GetRCState ( rc ) == rcExists )
-                {
-                    KRefcountInit ( & col -> refcount, 1, CLASS, "OpenColumnRead", name );
-                    col -> tbl = SRATableAttach ( self );
-                    col -> read_only = true;
-                    *rslt = col;
-                    return 0;
-                }
-                else if ( GetRCState ( rc ) == rcUndefined )
-                {
-                    rc = RC ( rcSRA, rcTable, rcOpening, rcColumn, rcNotFound );
-                }
-
-                free ( col );
-            }
-        }
-
-        * rslt = NULL;
-    }
-
-    return rc;
-}
-
-
-/* Datatype
- *  access data type
- *
- *  "type" [ OUT, NULL OKAY ] - returns the column type declaration
- *
- *  "def" [ OUT, NULL OKAY ] - returns the definition of the type
- *  returned in "type_decl"
- *
- * NB - one of "type" and "def" must be non-NULL
- */
-LIB_EXPORT rc_t CC SRAColumnDatatype( const SRAColumn *self,
-        VTypedecl *type, VTypedef *def )
-{
-    if (self != NULL)
-        return SRATableColDatatype(self->tbl, self->idx, type, def);
-
-    if ( type != NULL )
-        memset ( type, 0, sizeof * type );
-    if ( def != NULL )
-        memset ( def, 0, sizeof * def );
-
-    return RC(RC_MODULE, RC_TARGET, rcAccessing, rcSelf, rcNull);
-}
-
-
-/* GetRange
- *  get a contiguous range around a spot id, e.g. tile for Illumina
- *
- *  "id" [ IN ] - return parameter for 1-based spot id
- *
- *  "first" [ OUT, NULL OKAY ] and "last" [ OUT, NULL OKAY ] -
- *  id range is returned in these output parameters, where
- *  at least ONE must be NOT-NULL
- */
-LIB_EXPORT rc_t CC SRAColumnGetRange( const SRAColumn *self,
-        spotid_t id, spotid_t *first, spotid_t *last )
-{
-    if (self != NULL)
-        return SRATableGetIdRange(self->tbl, self->idx, id, first, last);
-
-    if ( first != NULL )
-        * first = 0;
-    if ( last != NULL )
-        * last = 0;
-
-    return RC(RC_MODULE, RC_TARGET, rcAccessing, rcSelf, rcNull);
-}
-
-
-/* Read
- *  read row data
- *
- *  "id" [ IN ] - spot row id between 1 and max(spot id)
- *
- *  "base" [ OUT ] and "offset" [ OUT ] - pointer and bit offset
- *  to start of spot row data.
- *
- *  "size" [ OUT ] - size in bits of row data
- */
-LIB_EXPORT rc_t CC SRAColumnRead( const SRAColumn *self,
-        spotid_t id, const void **base, bitsz_t *offset, bitsz_t *size )
-{
-    if (self != NULL)
-        return SRATableRead(self->tbl, id, self->idx, base, offset, size);
-
-    if ( base != NULL )
-        * base = NULL;
-    if ( offset != NULL )
-        * offset = 0;
-    if ( size != NULL )
-        * size = 0;
-
-    return RC(RC_MODULE, RC_TARGET, rcAccessing, rcSelf, rcNull);
-}
diff --git a/libs/sra/sramgr-cmn.c b/libs/sra/sramgr-cmn.c
deleted file mode 100644
index dbce4b6..0000000
--- a/libs/sra/sramgr-cmn.c
+++ /dev/null
@@ -1,572 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <sra/extern.h>
-
-#include <klib/namelist.h>
-#include <klib/refcount.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <kfs/directory.h>
-#include <kfg/config.h>
-#include <vfs/manager.h>
-#include <vfs/resolver.h>
-#include <vfs/path.h>
-#include <kdb/manager.h>
-#include <kdb/kdb-priv.h>
-#include <vdb/manager.h>
-#include <vdb/schema.h>
-#include <vdb/vdb-priv.h>
-#include <sra/sradb.h>
-#include <sra/sraschema.h>
-#include <sra/srapath.h>
-#include <sra/sradb-priv.h>
-#include <sysalloc.h>
-#include <atomic.h>
-
-#include "sra-priv.h"
-
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <assert.h>
-
-
-/* Whack
- *  will not refuse request, and ignores errors
- */
-static
-rc_t SRAMgrWhack ( const SRAMgr *that )
-{
-    SRAMgr *self = ( SRAMgr* ) that;
-
-    VSchemaRelease ( self -> schema );
-    VDBManagerRelease ( self -> vmgr );
-    SRACacheWhack ( self -> cache );
-    
-    /* must check here for NULL because
-       SRAPathRelease is weak-linked */
-    if ( self -> _pmgr != NULL )
-    {
-#if OLD_SRAPATH_MGR
-        SRAPathRelease ( self -> _pmgr );
-#else
-        VResolverRelease ( ( const VResolver* ) self -> _pmgr );
-#endif
-    }
-
-    free ( self );
-    return 0;
-}
-
-
-/* Release
- *  releases reference to object
- *  obtained from MakeRead, MakeUpdate,
- *  or AddRef(see above)
- */
-LIB_EXPORT rc_t CC SRAMgrRelease ( const SRAMgr *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "SRAMgr" ) )
-        {
-        case krefWhack:
-            return SRAMgrWhack ( ( SRAMgr* ) self );
-        case krefNegative:
-            return RC ( rcSRA, rcMgr, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/* AddRef
- *  attach a new reference to an existing object
- *  ( see above)
- */
-LIB_EXPORT rc_t CC SRAMgrAddRef ( const SRAMgr *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "SRAMgr" ) )
-        {
-        case krefLimit:
-            return RC ( rcSRA, rcMgr, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-/* Attach
- * Sever
- */
-SRAMgr *SRAMgrAttach ( const SRAMgr *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAddDep ( & self -> refcount, "SRAMgr" ) )
-        {
-        case krefLimit:
-            return NULL;
-        }
-    }
-    return ( SRAMgr* ) self;
-}
-
-rc_t SRAMgrSever ( const SRAMgr *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDropDep ( & self -> refcount, "SRAMgr" ) )
-        {
-        case krefWhack:
-            return SRAMgrWhack ( ( SRAMgr* ) self );
-        case krefNegative:
-            return RC ( rcSRA, rcMgr, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/* Make
- */
-static
-rc_t SRAMgrInitPath ( SRAMgr *mgr, KConfig *kfg, const KDirectory *wd )
-{
-    VFSManager *vfs;
-    rc_t rc = VFSManagerMake ( & vfs );
-    if ( rc == 0 )
-    {
-        rc = VFSManagerMakeResolver ( vfs, ( VResolver** ) & mgr -> _pmgr, kfg );
-        VFSManagerRelease ( vfs );
-    }
-
-    if ( rc != 0 )
-        mgr -> _pmgr = NULL;
-
-    return 0;
-}
-
-rc_t SRAMgrMake ( SRAMgr **mgrp,
-    const VDBManager *vmgr, const KDirectory *wd )
-{
-    rc_t rc;
-
-    /* require sraschema object */
-    SRAMgr *mgr = malloc ( sizeof * mgr );
-    if ( mgr == NULL )
-        rc = RC ( rcSRA, rcMgr, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        VSchema *schema;
-        rc = VDBManagerMakeSRASchema ( vmgr, & schema );
-        if ( rc == 0 )
-        {
-            KConfig* kfg;
-            rc = KConfigMake ( & kfg, wd );
-            if ( rc == 0 )
-            {
-                rc = SRAMgrInitPath ( mgr, kfg, wd );
-                if ( rc == 0 )
-                {
-                    rc = SRACacheInit ( & mgr -> cache, kfg );
-                    if ( rc == 0 )
-                    {
-                        KRefcountInit ( & mgr -> refcount, 1, "SRAMgr", "SRAMgrMake", "sramgr" );
-                        mgr -> vmgr = vmgr;
-                        mgr -> schema = schema;
-                        mgr -> mode = kcmCreate; /* TBD - should this include parents? */
-                        mgr -> read_only = true;
-                        * mgrp = mgr;
-                        KConfigRelease ( kfg );
-                        return 0;
-                    }
-                }
-                KConfigRelease ( kfg );
-            }
-
-            VSchemaRelease ( schema );
-        }
-
-        free ( mgr );
-    }
-
-    * mgrp = NULL;
-    return rc;
-}
-
-
-/* Writable
- *  returns 0 if table is writable
- *  rcLocked if locked, rcReadonly if read-only
- *  other code upon error
- *
- *  "path" [ IN ] - NUL terminated table path
- */
-LIB_EXPORT rc_t CC SRAMgrVWritable ( const SRAMgr *self,
-        const char *path, va_list args )
-{
-    if ( self == NULL )
-        return RC ( rcSRA, rcMgr, rcAccessing, rcSelf, rcNull );
-    return VDBManagerVWritable ( self -> vmgr, path, args );
-}
-
-LIB_EXPORT rc_t CC SRAMgrWritable ( const SRAMgr *self,
-        const char *path, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, path );
-
-    rc = SRAMgrVWritable ( self, path, args );
-
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SRAMgrResolve( const SRAMgr *self, const char* acc, char* buf, size_t buf_size )
-{
-    if ( self == NULL )
-        return RC ( rcSRA, rcMgr, rcResolving, rcSelf, rcNull );
-    if ( acc == NULL || buf == NULL)
-        return RC ( rcSRA, rcMgr, rcResolving, rcParam, rcNull );
-    else
-    {
-        VFSManager *vfs;
-        rc_t rc = VFSManagerMake ( & vfs );
-        if (rc == 0)
-        {
-			rc_t rc2;
-            VPath* path;
-            rc = VFSManagerMakePath(vfs, &path, "ncbi-acc:%s", acc);
-            if (rc == 0)
-            {
-                const VPath* resolved;
-                rc = VResolverQuery ( (const struct VResolver*)self->_pmgr, eProtocolHttp, path, &resolved, NULL, NULL );
-                if (rc == 0)
-                {
-                    rc = VPathReadPath ( resolved, buf, buf_size, NULL );
-                    rc2 = VPathRelease(resolved);
-                    if (rc == 0)
-                        rc = rc2;
-                }
-                
-                rc2 = VPathRelease(path);
-                if (rc == 0)
-                    rc = rc2;
-            }
-            rc2 = VFSManagerRelease(vfs);
-            if (rc == 0)
-                rc = rc2;
-        }
-        
-        return rc;
-    }
-}
-
-LIB_EXPORT rc_t CC SRAMgrConfigReload( const SRAMgr *cself, const KDirectory *wd )
-{
-#if OLD_SRAPATH_MGR
-    SRAMgr *self = cself;
-
-    /* create a new SRAPath object */
-    SRAPath *pnew;
-    rc_t rc = SRAPathMake ( & pnew, wd );
-    if ( rc == 0 )
-    {
-        /* swap with the old guy */
-        SRAPath *pold = self -> _pmgr;
-        if ( atomic_test_and_set_ptr ( ( void *volatile* ) & self -> _pmgr, pnew, pold ) == ( void* ) pold )
-            SRAPathRelease ( pold );
-        else
-            SRAPathRelease ( pnew );
-    }
-
-    return rc;
-#else
-    return 0;
-#endif
-
-#if 0
-
-
-    /* do not reload VDBManager config for now
-       it cannot reload properly and grows in memory */
-    rc_t rc = 0;
-    /* (not thread) safely re-instanciate sra path config */
-    SRAMgr *self = (SRAMgr*)cself;
-    SRAPath* p = cself->_pmgr;
-    self->_pmgr = NULL;
-    if( (rc = SRAMgrInitPath(self, wd)) == 0 ) {
-        SRAPathRelease(p);
-    } else {
-        /* roll back */
-        self->_pmgr = p;
-    }
-    return rc;
-#endif
-
-}
-
-/* GetVDBManager
- *  returns a new reference to VDBManager used by SRAMgr
- */
-LIB_EXPORT rc_t CC SRAMgrGetVDBManagerRead ( const SRAMgr *self, const VDBManager **vmgr )
-{
-    rc_t rc;
-
-    if ( vmgr == NULL )
-        rc = RC ( rcSRA, rcMgr, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcSRA, rcMgr, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            * vmgr = self -> vmgr;
-            return VDBManagerAddRef ( * vmgr );
-        }
-
-        * vmgr = NULL;
-    }
-
-    return rc;
-}
-
-/* GetKDBManager
- *  returns a new reference to KDBManager used indirectly by SRAMgr
- */
-LIB_EXPORT rc_t CC SRAMgrGetKDBManagerRead ( const SRAMgr *self,
-        struct KDBManager const **kmgr )
-{
-    rc_t rc;
-
-    if ( kmgr == NULL )
-        rc = RC ( rcSRA, rcMgr, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcSRA, rcMgr, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            return VDBManagerGetKDBManagerRead ( self -> vmgr, kmgr );
-        }
-
-        * kmgr = NULL;
-    }
-
-    return rc;
-}
-
-
-/* ModDate
- *  return a modification timestamp for table
- */
-LIB_EXPORT rc_t CC SRAMgrVGetTableModDate ( const SRAMgr *self,
-    KTime_t *mtime, const char *spec, va_list args )
-{
-    rc_t rc;
-
-    if ( mtime == NULL )
-        rc = RC ( rcSRA, rcMgr, rcAccessing, rcParam, rcNull );
-    else
-    {
-        * mtime = 0;
-        if ( self == NULL )
-            rc = RC ( rcSRA, rcMgr, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            char path[4096];
-            rc = ResolveTablePath(self, path, sizeof path, spec, args);
-            if( rc == 0 ) {
-                struct KDBManager const *kmgr;
-                rc = VDBManagerGetKDBManagerRead ( self -> vmgr, & kmgr );
-                if ( rc == 0 )
-                {
-                    rc = KDBManagerGetTableModDate(kmgr, mtime, path);
-                    KDBManagerRelease ( kmgr );
-                }
-            }
-        }
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SRAMgrGetTableModDate ( const SRAMgr *self,
-    KTime_t *mtime, const char *spec, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, spec );
-    rc = SRAMgrVGetTableModDate ( self, mtime, spec, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SRAMgrSingleFileArchiveExt(const SRAMgr *self, const char* spec, const bool lightweight, const char** ext)
-{
-    rc_t rc;
-
-    if( self == NULL || spec == NULL || ext == NULL ) {
-        rc = RC(rcSRA, rcFile, rcConstructing, rcParam, rcNull);
-    } else {
-        char buf[4096];
-        va_list args;
-
-        if( (rc = ResolveTablePath(self, buf, sizeof(buf), spec, args)) == 0 ) {
-            const KDBManager* kmgr;
-            if( (rc = SRAMgrGetKDBManagerRead(self, &kmgr)) == 0 ) {
-                int type = KDBManagerPathType(kmgr, buf) & ~kptAlias;
-                if( type == kptDatabase ) {
-                    *ext = CSRA_EXT(lightweight);
-                } else if( type == kptTable ) {
-                    *ext = SRA_EXT(lightweight);
-                } else {
-                    rc = RC(rcSRA, rcPath, rcResolving, rcType, rcUnknown);        
-                }
-                KDBManagerRelease(kmgr);
-            }
-        }
-    }
-    return rc;
-}
-
-/* 
- * FlushPath
- * FlushRun
- * RunBGTasks
- *  stubbed functions to manipulate a cache, if implemented
- */
-LIB_EXPORT rc_t CC SRAMgrGetCacheUsage( const SRAMgr *self, struct SRACacheUsage* stats )
-{
-    rc_t rc = 0;
-    if ( self == NULL || stats == NULL || self->cache == NULL)
-        rc = RC(rcSRA, rcMgr, rcAccessing, rcParam, rcNull);
-    else
-        rc = SRACacheGetUsage(self->cache, stats);
-    return rc;
-}
- 
-LIB_EXPORT rc_t CC SRAMgrFlush ( struct SRAMgr const *self, const struct SRACacheMetrics* thr )
-{
-    rc_t rc = 0;
-    if( self == NULL  || self->cache == NULL)
-        rc = RC(rcSRA, rcFile, rcProcessing, rcSelf, rcNull);
-    else if( thr == NULL )
-        rc = RC(rcSRA, rcFile, rcProcessing, rcParam, rcNull);
-    else 
-    {
-        SRACacheMetrics saved;
-        rc = SRACacheGetSoftThreshold(self->cache, &saved);
-        if (rc == 0)
-        {
-            rc = SRACacheSetSoftThreshold(self->cache, thr);
-            if (rc == 0)
-            {
-                rc_t rc2;
-                rc = SRACacheFlush(self->cache);
-                rc2 = SRACacheSetSoftThreshold(self->cache, &saved);
-                if (rc == 0)
-                    rc = rc2;
-            }
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SRAMgrRunBGTasks ( const SRAMgr *self )
-{
-    rc_t rc;
-
-    if( self == NULL  )
-        rc = RC(rcSRA, rcMgr, rcProcessing, rcSelf, rcNull);
-        
-    rc = SRACacheFlush(self->cache);
-    
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SRAMgrConfigureCache( const SRAMgr *self,  int32_t soft_threshold, int32_t hard_threshold )
-{
-    rc_t rc = 0;
-    if( self == NULL  || self->cache == NULL)
-        rc = RC(rcSRA, rcFile, rcProcessing, rcSelf, rcNull);
-    else if( soft_threshold < -1  || hard_threshold < -1 )
-        rc = RC(rcSRA, rcFile, rcProcessing, rcParam, rcNull);
-    else 
-    {
-        if ( soft_threshold > -1 )
-        {
-            SRACacheMetrics metrics;
-            memset(&metrics, 0, sizeof(metrics));
-            metrics.elements = soft_threshold;
-            rc = SRACacheSetSoftThreshold(self->cache, &metrics);
-        }
-        if ( rc == 0 && hard_threshold > -1 )
-        {
-            SRACacheMetrics metrics;
-            memset(&metrics, 0, sizeof(metrics));
-            metrics.elements = hard_threshold;
-            rc = SRACacheSetHardThreshold(self->cache, &metrics);
-        }
-        /* if a new threshold is low enough to cause a flush, do it right away */
-        rc = SRACacheFlush(self->cache);
-    }
-    return rc;
-}
-
-/*--------------------------------------------------------------------------
- * SRANamelist
- *  redirecting functions
- */
-
-
-LIB_EXPORT rc_t CC SRANamelistAddRef ( const SRANamelist *self )
-{
-    return KNamelistAddRef ( ( const KNamelist* ) self );
-}
-
-LIB_EXPORT rc_t CC SRANamelistRelease ( const SRANamelist *self )
-{
-    return KNamelistRelease ( ( const KNamelist* ) self );
-}
-
-LIB_EXPORT rc_t CC SRANamelistCount ( const SRANamelist *self, uint32_t *count )
-{
-    return KNamelistCount ( ( const KNamelist* ) self, count );
-}
-
-LIB_EXPORT rc_t CC SRANamelistGet ( const SRANamelist *self, uint32_t idx, const char **name )
-{
-    return KNamelistGet ( ( const KNamelist* ) self, idx, name );
-}
diff --git a/libs/sra/sramgr.c b/libs/sra/sramgr.c
deleted file mode 100644
index 912697d..0000000
--- a/libs/sra/sramgr.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <sra/extern.h>
-#include <sra/sradb.h>
-#include <vdb/manager.h>
-#include <vdb/schema.h>
-#include <klib/refcount.h>
-#include <klib/log.h>
-
-#include <klib/out.h>
-
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include "libsradb.vers.h"
-#include "sra-priv.h"
-
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <assert.h>
-
-
-/* MakeRead
- *  create library reference for read-only access
- *
- *  "wd" [ IN, NULL OKAY ] - optional working directory for
- *  accessing the file system. mgr will attach its own reference
- *
- *  NB - not implemented in update libary
- *  and the read-only library may not be mixed with read/write
- */
-LIB_EXPORT rc_t CC SRAMgrMakeRead ( const SRAMgr **mgr )
-{
-    return SRAMgrMakeReadWithDir ( mgr, NULL );
-}
-
-LIB_EXPORT rc_t CC SRAMgrMakeReadWithDir ( const SRAMgr **mgrp,
-        struct KDirectory const *wd )
-{
-    rc_t rc;
-
-    if ( mgrp == NULL )
-        rc = RC ( rcSRA, rcMgr, rcConstructing, rcParam, rcNull );
-    else
-    {
-        const VDBManager *vmgr;
-        rc = VDBManagerMakeRead ( & vmgr, wd );
-        if ( rc == 0 )
-        {
-            SRAMgr *mgr;
-            rc = SRAMgrMake ( & mgr, vmgr, wd );
-            if ( rc == 0 )
-            {
-                * mgrp = mgr;
-                return 0;
-            }
-
-            VDBManagerRelease ( vmgr );
-        }
-
-        * mgrp = NULL;
-    }
-
-    return rc;
-}
-
-
-/* GetSchema
- *  get a reference to the schema used to create new tables
- *
- *  "schema" [ OUT ] - return parameter for reference to SRA schema
- *
- * NB - returns a new reference that must be released via VSchemaRelease
- */
-LIB_EXPORT rc_t CC SRAMgrGetSchemaRead ( const SRAMgr *self,
-        const VSchema **schema )
-{
-    rc_t rc;
-
-    if ( schema == NULL )
-        rc = RC ( rcSRA, rcSchema, rcOpening, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcSRA, rcMgr, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = VSchemaAddRef ( self -> schema );
-            if ( rc == 0 )
-            {
-                * schema = self -> schema;
-                return 0;
-            }
-        }
-
-        * schema = NULL;
-    }
-
-    return rc;
-}
-
-/* OpenDatatypes
- *  open datatype registry object for requested access
- *
- *  "dt" [ OUT ] - return parameter for datatypes object
- */
-LIB_EXPORT rc_t CC SRAMgrOpenDatatypesRead ( const SRAMgr *self,
-        struct VDatatypes const **dt )
-{
-    return SRAMgrGetSchemaRead ( self, ( const VSchema** ) dt );
-}
-
-
-/* UseSchema
- *  allows SRA schema to be entirely replaced
- *  affects creation/update of all subsequent tables
- *
- *  "schema" [ IN ] - new schema to be applied
- *
- * NB - manager will attach a new reference to schema object,
- *  you are still responsible for releasing it via VSchemaRelease
- */
-LIB_EXPORT rc_t CC SRAMgrUseSchemaRead ( const SRAMgr *self,
-        const VSchema *schema )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcSRA, rcMgr, rcUpdating, rcSelf, rcNull );
-    else if ( schema == NULL )
-        rc = RC ( rcSRA, rcMgr, rcUpdating, rcSchema, rcNull );
-    else if ( schema == self -> schema )
-        rc = 0;
-    else
-    {
-        rc = VSchemaAddRef ( schema );
-        if ( rc == 0 )
-        {
-            VSchemaRelease ( self -> schema );
-            ( ( SRAMgr* ) self ) -> schema = schema;
-        }
-    }
-
-    return rc;
-}
-
-
-/* Version
- *  returns the library version
- */
-LIB_EXPORT rc_t CC SRAMgrVersion ( const SRAMgr *self,
-        uint32_t *version )
-{
-    if ( version == NULL )
-        return RC ( rcSRA, rcMgr, rcAccessing, rcParam, rcNull );
-    if ( self == NULL )
-        return RC ( rcSRA, rcMgr, rcAccessing, rcSelf, rcNull );
-
-    * version = LIBSRADB_VERS;
-    return 0;
-}
diff --git a/libs/sra/sraschema-priv.h b/libs/sra/sraschema-priv.h
deleted file mode 100644
index aec84f9..0000000
--- a/libs/sra/sraschema-priv.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#ifndef _h_sraschema_priv_
-#define _h_sraschema_priv_
-
-#include <stddef.h>
-
-/* schema is built-in */
-extern const char sra_schema_text [];
-extern const size_t sra_schema_size;
-
-#endif /* _h_sraschema_priv_ */
diff --git a/libs/sra/sraschema-stub.c b/libs/sra/sraschema-stub.c
deleted file mode 100644
index 2cfdc97..0000000
--- a/libs/sra/sraschema-stub.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <sra/sraschema.h>
-#include <sra/sradb-priv.h>
-#include <klib/rc.h>
-
-#include "sra-priv.h"
-
-/*--------------------------------------------------------------------------
- * SRASchema
- *  a schema object pre-loaded with default SRA schema
- */
-
-/* Make
- *  create an instance of the default SRA schema
- */
-rc_t CC VDBManagerMakeSRASchema ( struct VDBManager const *self, struct VSchema **schema )
-{
-    return SRASchemaMake ( schema, self );
-}
-
-rc_t CC SRAMgrMakeSRASchema ( const SRAMgr *self, struct VSchema **schema )
-{
-    if ( self != NULL )
-        return VDBManagerMakeSRASchema ( self -> vmgr, schema );
-    return RC ( rcSRA, rcMgr, rcAccessing, rcSelf, rcNull );
-}
diff --git a/libs/sra/sraschema.c b/libs/sra/sraschema.c
deleted file mode 100644
index 3d73cc6..0000000
--- a/libs/sra/sraschema.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <sra/sch-extern.h>
-#include <sra/sradb-priv.h>
-#include <sra/sraschema.h>
-#include <vdb/manager.h>
-#include <vdb/schema.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include "sraschema-priv.h"
-#include "sra-priv.h"
-
-
-/*--------------------------------------------------------------------------
- * SRASchema
- *  a schema object pre-loaded with default SRA schema
- */
-
-/* Make
- *  create an instance of the default SRA schema
- */
-
-LIB_EXPORT rc_t CC SRASchemaMake ( VSchema **schema, const VDBManager *mgr )
-{
-    rc_t rc;
-
-    if ( schema == NULL )
-        rc = RC ( rcVDB, rcMgr, rcCreating, rcParam, rcNull );
-    else
-    {
-        if ( mgr == NULL )
-            rc = RC ( rcVDB, rcMgr, rcCreating, rcSelf, rcNull );
-        else
-        {
-            rc = VDBManagerMakeSchema ( mgr, schema );
-            if ( rc == 0 )
-            {
-                rc = VSchemaParseText ( * schema, "sra-schema", sra_schema_text, sra_schema_size );
-                if ( rc == 0 )
-                    return 0;
-
-                VSchemaRelease ( * schema );
-            }
-        }
-
-        * schema = NULL;
-    }
-    return rc;
-}
diff --git a/libs/sra/sratbl-cmn.c b/libs/sra/sratbl-cmn.c
deleted file mode 100644
index 399660b..0000000
--- a/libs/sra/sratbl-cmn.c
+++ /dev/null
@@ -1,1397 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <sra/extern.h>
-
-#include <sra/sradb.h>
-#include <sra/srapath.h>
-#include <sra/types.h>
-#include <sra/sraschema.h>
-#include <sra/sradb-priv.h>
-#include <vdb/database.h>
-#include <vdb/schema.h>
-#include <vdb/table.h>
-#include <vdb/cursor.h>
-#include <vdb/vdb-priv.h>
-#include <vdb/dependencies.h>
-#include <kdb/meta.h>
-#include <kdb/manager.h>
-#include <kdb/table.h>
-#include <kdb/database.h>
-#include <kdb/kdb-priv.h>
-#include <vfs/manager.h>
-#include <vfs/path.h>
-#include <vfs/path-priv.h>
-#include <vfs/resolver.h>
-#include <klib/refcount.h>
-#include <klib/log.h>
-#include <klib/debug.h>
-#include <klib/rc.h>
-#include <klib/text.h>
-#include <klib/printf.h>
-#include <kfs/toc.h>
-#include <kfs/file.h>
-#include <sysalloc.h>
-
-#include "sra-priv.h"
-
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <stdio.h>
-#include <assert.h>
-#include <va_copy.h>
-
-/* Destroy
- */
-static
-void CC column_release ( void *item, void *ignore )
-{
-    SRAColumn *self = item;
-    self -> tbl = NULL;
-    SRAColumnWhack ( self );
-}
-
-void SRATableDestroy ( SRATable *self )
-{
-    VectorWhack ( & self -> wcol, column_release, NULL );
-    VCursorRelease(self->curs);
-    KMetadataRelease ( self -> meta );
-    VTableRelease ( self -> vtbl );
-    SRAMgrSever ( self -> mgr );
-
-    memset(self, 0, sizeof *self);
-
-    free ( self );
-}
-
-/* AddRef
- * Release
- *  see REFERENCE COUNTING, above
- */
-LIB_EXPORT rc_t CC SRATableAddRef( const SRATable *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "SRATable" ) )
-        {
-        case krefLimit:
-            return RC ( rcSRA, rcTable, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC SRATableRelease( const SRATable *self )
-{
-    rc_t rc = 0;
-    
-    if (self)
-    {
-        switch (KRefcountDrop(&self->refcount, "SRATable"))
-        {
-        case krefWhack:
-            return SRATableWhack ( ( SRATable* ) self );
-        case krefNegative:
-            rc = RC (rcSRA, rcTable, rcDestroying, rcSelf, rcDestroyed);
-            PLOGERR (klogInt,(klogInt, rc, "Released an SRATable $(B) with no more references",
-                      PLOG_P(self)));
-            break;
-        }
-    }
-    return rc;
-}
-
-/* Attach
- * Sever
- */
-SRATable *SRATableAttach ( const SRATable *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAddDep ( & self -> refcount, "SRATable" ) )
-        {
-        case krefLimit:
-            return NULL;
-        }
-    }
-    return ( SRATable* ) self;
-}
-
-rc_t SRATableSever ( const SRATable *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDropDep ( & self -> refcount, "SRATable" ) )
-        {
-        case krefWhack:
-            return SRATableWhack ( ( SRATable* ) self );
-        case krefNegative:
-            return RC ( rcSRA, rcTable, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/* FillOutTableRead
- *  creates an empty cursor
- *  accesses metadata
- */
-static rc_t ReadSpotSequence_v1(SRATable *self)
-{
-    const KMDataNode *n;
-    rc_t rc = KMetadataOpenNodeRead(self->meta, &n, ".seq");
-    if (rc == 0)
-    {
-        rc = KMDataNodeReadAsU64(n, &self->spot_count);
-        KMDataNodeRelease(n);
-    }
-    return rc;
-}
-
-typedef enum {
-    eNotRead,
-    eNotFound,
-    eFailed,
-    eRead
-} EState;
-typedef struct {
-    EState state;
-    rc_t rc;
-} State;
-typedef struct {
-    uint64_t value;
-    State state;
-} U64;
-typedef struct {
-    uint32_t value;
-    State state;
-} U32;
-typedef struct {
-    U64 BASE_COUNT;
-    U32 MAX_SPOT_ID;
-    U32 MIN_SPOT_ID;
-    U64 SPOT_COUNT;
-} PseudoMeta;
-static
-rc_t VCursor_ReadPseudoMeta(rc_t rc, const VCursor *self,
-    const char *name, void *buffer, uint32_t blen, State *state)
-{
-    uint32_t idx = ~0;
-    uint32_t row_len = ~0;
-
-    assert(state);
-    state->rc = 0;
-
-    if (rc != 0)
-    {   return rc; }
-
-    state->state = eNotRead;
-
-    rc = VCursorAddColumn(self, &idx, name);
-
-    if (rc != 0) {
-        state->rc = rc;
-
-        if (GetRCObject(rc) == rcColumn && GetRCState(rc) == rcNotFound) {
-            rc = 0;
-            state->state = eNotFound;
-        }
-        else {
-            state->state = eFailed;
-        }
-    }
-
-    if (state->rc == 0) {
-        rc = VCursorReadDirect(self, 1, idx, blen * 8, buffer, blen, &row_len);
-
-        state->rc = rc;
-
-        if (rc != 0)
-        {   state->state = eFailed; }
-        else
-        {   state->state = eRead; }
-
-    }
-
-    return rc;
-}
-
-static
-rc_t VCursor_ReadPseudoMetaU32(rc_t rc, const VCursor *self,
-    const char *name, U32 *val)
-{
-    assert(val);
-    return VCursor_ReadPseudoMeta(rc, self,
-        name, &val->value, sizeof val->value, &val->state);
-}
-
-static
-rc_t VCursor_ReadPseudoMetaU64(rc_t rc, const VCursor *self,
-    const char *name, U64 *val)
-{
-    assert(val);
-    return VCursor_ReadPseudoMeta(rc, self,
-        name, &val->value, sizeof val->value, &val->state);
-}
-
-static
-rc_t PseudoMetaInit(PseudoMeta *self, const VCursor *curs,
-    bool readSpotCount, uint64_t spot_count)
-{
-    rc_t rc = 0;
-
-    assert(self);
-
-    memset(self, 0, sizeof *self);
-
-    if (readSpotCount) {
-        rc =
-         VCursor_ReadPseudoMetaU64(rc, curs, "SPOT_COUNT", &self->SPOT_COUNT);
-    }
-    else {
-        self->SPOT_COUNT.value = spot_count;
-        self->SPOT_COUNT.state.state = eRead;
-    }
-
-    rc = VCursor_ReadPseudoMetaU64(rc, curs, "BASE_COUNT", &self->BASE_COUNT);
-
-    rc = VCursor_ReadPseudoMetaU32(rc, curs, "MIN_SPOT_ID", &self->MIN_SPOT_ID);
-
-    rc = VCursor_ReadPseudoMetaU32(rc, curs, "MAX_SPOT_ID", &self->MAX_SPOT_ID);
-
-    return rc;
-}
-
-static
-rc_t PseudoMetaFix(PseudoMeta *self)
-{
-    rc_t rc = 0;
-
-    assert(self);
-
-    if (self->MIN_SPOT_ID.state.state != eRead)
-    {   self->MIN_SPOT_ID.value = 1; }
-
-    if (self->SPOT_COUNT.state.state != eRead &&
-        self->MAX_SPOT_ID.state.state != eRead)
-    {
-        return self->SPOT_COUNT.state.rc;
-    }
-    else if (self->SPOT_COUNT.state.state == eRead) {
-        if (self->MAX_SPOT_ID.state.state != eRead) {
-            self->MAX_SPOT_ID.value
-                = self->MIN_SPOT_ID.value + self->SPOT_COUNT.value - 1;
-        }
-        else if (self->MAX_SPOT_ID.value >= self->MIN_SPOT_ID.value) {
-            if (self->SPOT_COUNT.value
-                > self->MAX_SPOT_ID.value - self->MIN_SPOT_ID.value + 1)
-            {
-                self->SPOT_COUNT.value
-                    = self->MAX_SPOT_ID.value - self->MIN_SPOT_ID.value + 1;
-            }
-        }
-    }
-    else {
-            self->SPOT_COUNT.value
-                = self->MAX_SPOT_ID.value - self->MIN_SPOT_ID.value - 1;
-    }
-
-    return rc;
-}
-
-static
-rc_t SRATableLoadMetadata(SRATable * self)
-{
-    rc_t rc = 0;
-    PseudoMeta meta;
-    bool readSpotCount = true;
-
-    assert(self && self->curs != NULL);
-    assert(self->curs_open == true);
-
-    readSpotCount = self->metavers > 1;
-    if (!readSpotCount) {
-        rc = ReadSpotSequence_v1(self);
-        if (rc != 0)
-        {   return rc; }
-    }
-
-    rc = PseudoMetaInit(&meta, self->curs, readSpotCount, self->spot_count);
-    if (rc != 0)
-    {   return rc; }
-
-    rc = PseudoMetaFix(&meta);
-    if (rc != 0)
-    {   return rc; }
-
-    self->spot_count = meta.SPOT_COUNT.value;
-    self->base_count = meta.BASE_COUNT.value;
-    self->min_spot_id = meta.MIN_SPOT_ID.value;
-    self->max_spot_id = meta.MAX_SPOT_ID.value;
-
-    return rc;
-}
-
-/* detect min and max spot-id from a temp. cursor */
-static rc_t SRATableGetMinMax( SRATable * self )
-{
-    const VCursor *temp_cursor;
-    rc_t rc;
-
-    assert( self != NULL );
-    assert( self->vtbl != NULL);
-    rc = VTableCreateCursorRead( self->vtbl, &temp_cursor );
-    if ( rc == 0 )
-    {
-        uint32_t idx;
-        rc = VCursorAddColumn ( temp_cursor, &idx, "READ" );
-        if ( rc == 0 )
-        {
-            rc = VCursorOpen( temp_cursor );
-            if ( rc == 0 )
-            {
-                int64_t  first;
-                uint64_t count;
-                rc = VCursorIdRange( temp_cursor, 0, &first, &count );
-                if ( rc == 0 )
-                {
-                    self->min_spot_id = first;
-                    self->max_spot_id = first + count;
-                    self->spot_count = count;
-                }
-            }
-        }
-        VCursorRelease( temp_cursor );
-    }
-    return rc;
-}
-
-rc_t SRATableFillOut ( SRATable *self, bool update )
-{
-    rc_t rc;
-    
-    /* require these operations to succeed */
-    rc = VCursorPermitPostOpenAdd( self->curs );
-    if ( rc != 0 )
-        return rc;
-    rc = VCursorOpen( self->curs );
-    if ( rc != 0 )
-        return rc;
-    self -> curs_open = true;
-    if ( ! update )
-    {
-        rc = SRATableLoadMetadata( self );
-        if ( rc != 0 )
-            rc = SRATableGetMinMax( self );
-    }
-    return rc;
-}
-
-
-/* ResolveTablePath
- *  takes either an accession or path
- *  substitutes any arguments
- *  resolves via SRAPath mgr if present
- */
-rc_t ResolveTablePath ( const SRAMgr *mgr,
-    char *path, size_t psize, const char *spec, va_list args )
-{
-#if OLD_SRAPATH_MGR
-    int len;
-    char tblpath [ 4096 ];
-    const SRAPath *pmgr = mgr -> _pmgr;
-
-    /* if no path manager or if the spec string has embedded path separators,
-       then this can't be an accession - just print it out */
-    if ( mgr -> _pmgr == NULL || strchr( spec, '/' ) != NULL )
-    {
-        len = vsnprintf ( path, psize, spec, args );
-        if ( len < 0 || ( size_t ) len >= psize )
-            return RC ( rcSRA, rcTable, rcOpening, rcPath, rcExcessive );
-        return 0;
-    }
-
-    /* create a copy - not likely to be too large */
-    len = vsnprintf ( tblpath, sizeof tblpath, spec, args );
-    if ( len < 0 || ( size_t ) len >= sizeof tblpath )
-        return RC ( rcSRA, rcTable, rcOpening, rcPath, rcExcessive );
-
-    /* test if the path exists in current directory, i.e. with assumed dot */
-    if ( ! SRAPathTest ( pmgr, tblpath ) )
-    {
-        rc_t rc = SRAPathFind ( pmgr, tblpath, path, psize );
-        if ( rc == 0 )
-            return 0;
-    }
-
-    /* use the path given */
-    if ( ( size_t ) len >= psize )
-        return RC ( rcSRA, rcTable, rcOpening, rcBuffer, rcInsufficient );
-    strcpy ( path, tblpath );
-
-    return 0;
-#else
-    VFSManager *vfs;
-    rc_t rc = VFSManagerMake ( & vfs );
-    if ( rc == 0 )
-    {
-        VPath *accession;
-        const VPath *tblpath = NULL;
-        rc = VFSManagerMakePath ( vfs, & accession, spec, args );
-        if ( rc == 0 )
-        {
-            rc = VResolverLocal ( ( const VResolver* ) mgr -> _pmgr, accession, & tblpath );
-            if ( rc == 0 )
-            {
-                size_t size;
-                rc = VPathReadPath ( tblpath, path, psize, & size );
-                VPathRelease ( tblpath );
-            }
-            VPathRelease ( accession );
-        }
-
-        VFSManagerRelease ( vfs );
-    }
-    return rc;
-#endif
-}
-
-/* OpenRead
- *  open an existing table
- *
- *  "tbl" [ OUT ] - return parameter for table
- *
- *  "spec" [ IN ] - NUL terminated UTF-8 string giving path
- *  to table.
- */
-static
-rc_t CC SRAMgrVOpenAltTableRead ( const SRAMgr *self,
-    const SRATable **rslt, const char *altname, const char *spec, va_list args )
-{
-    rc_t rc;
-
-    if ( rslt == NULL )
-        rc = RC ( rcSRA, rcTable, rcOpening, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcSRA, rcMgr, rcAccessing, rcSelf, rcNull );
-        else if ( spec == NULL )
-            rc = RC ( rcSRA, rcTable, rcOpening, rcName, rcNull );
-        else if ( spec [ 0 ] == 0 )
-            rc = RC ( rcSRA, rcTable, rcOpening, rcName, rcEmpty );
-        else
-        {
-            SRATable *tbl = calloc ( 1, sizeof *tbl );
-            if ( tbl == NULL )
-                rc = RC ( rcSRA, rcTable, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                VSchema *schema = NULL;
-
-                rc = VDBManagerMakeSRASchema(self -> vmgr, & schema);
-                if ( rc == 0 ) 
-                {
-                    va_list args_copy;
-                    va_copy ( args_copy, args );
-                    rc = VDBManagerVOpenTableRead ( self -> vmgr, & tbl -> vtbl, schema, spec, args );
-                    if ( rc != 0 && GetRCObject ( rc ) == rcTable && GetRCState ( rc ) == rcIncorrect )
-                    {
-                        const VDatabase *db;
-                        rc_t rc2 = VDBManagerVOpenDBRead ( self -> vmgr, & db, schema, spec, args_copy );
-                        if ( rc2 == 0 )
-                        {
-                            rc2 = VDatabaseOpenTableRead ( db, & tbl -> vtbl, altname );
-                            if ( rc2 == 0 )
-                                rc = 0;
-
-                            VDatabaseRelease ( db );
-                        }
-                    }
-                    va_end ( args_copy );
-
-                    VSchemaRelease(schema);
-
-                    if ( rc == 0 )
-                    {
-                        rc = VTableOpenMetadataRead ( tbl -> vtbl, & tbl -> meta );
-                        if ( rc == 0 )
-                        {
-                            rc = KMetadataVersion ( tbl -> meta, & tbl -> metavers );
-                            if ( rc == 0 )
-                            {
-                                rc = VTableCreateCursorRead ( tbl -> vtbl, & tbl -> curs );
-                                if ( rc == 0 )
-                                {
-                                    tbl -> mode = self -> mode;
-                                    tbl -> read_only = true;
-                                    KRefcountInit ( & tbl -> refcount, 1, "SRATable", "OpenTableRead", spec );
-                                        
-                                    rc = SRATableFillOut ( tbl, false );
-                                    if ( rc == 0 )
-                                    {
-                                        * rslt = tbl;
-                                        return 0;
-                                    }
-                                }
-                            }
-                        }
-                    }
-                    
-                }
-                SRATableWhack ( tbl );
-            }
-        }
-
-        * rslt = NULL;
-    }
-    return rc;
-}
-
-/* OpenRead
- *  open an existing table
- *
- *  "tbl" [ OUT ] - return parameter for table
- *
- *  "spec" [ IN ] - NUL terminated UTF-8 string giving path
- *  to table.
- */
-LIB_EXPORT rc_t CC SRAMgrVOpenTableRead ( const SRAMgr *self,
-        const SRATable **crslt, const char *spec, va_list args )
-{
-    rc_t rc;
-    char tblpath [ 4096 ];
-    int num_writ = vsnprintf ( tblpath, sizeof tblpath, spec, args );
-    if ( num_writ < 0 || ( size_t ) num_writ >= sizeof tblpath )
-        rc = RC ( rcSRA, rcMgr, rcOpening, rcPath, rcExcessive );
-    else
-    {
-        SRATable **rslt = (SRATable **)crslt; /* to avoid "const_casts" below */
-        rc = SRACacheGetTable( self->cache, tblpath, crslt );
-        if  (rc == 0 )
-        {
-            if ( *crslt == NULL )
-            {
-                rc = SRAMgrOpenAltTableRead ( self, crslt, "SEQUENCE", tblpath );
-                if ( rc == 0 )
-                {
-                    rc = SRACacheAddTable( self->cache, tblpath, *rslt);
-                    if ( GetRCObject(rc) == rcParam && GetRCState(rc) == rcExists )
-                    {           /* the same object has appeared in the cache since our call to SRACacheGetTable above;  */
-                       rc = 0;  /* return the new object, never mind the cache */
-                    }
-                    else if ( ! SRACacheMetricsLessThan(&self->cache->current, &self->cache->hardThreshold) )
-                       rc = SRACacheFlush(self->cache);
-                }
-            }
-        }
-        else if ( (GetRCObject(rc) == rcName && GetRCState(rc) == rcInvalid) ||   /* accessions with irregular names are not cached */
-                  (GetRCObject(rc) == rcParam && GetRCState(rc) == rcBusy)    )   /* in cache but in use */
-        {    
-            rc = SRAMgrOpenAltTableRead ( self, crslt, "SEQUENCE", tblpath );
-            if (rc == 0)
-                (*rslt)->mgr = SRAMgrAttach(self);
-        }
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SRAMgrOpenTableRead ( const SRAMgr *self,
-        const SRATable **tbl, const char *spec, ... )
-{
-    rc_t rc;
-    
-    va_list args;
-    va_start ( args, spec );
-
-    rc = SRAMgrVOpenTableRead ( self, tbl, spec, args );
-
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* Read - PRIVATE
- *  column message sent via table
- */
-rc_t SRATableRead ( const SRATable *self, spotid_t id, uint32_t idx,
-    const void **base, bitsz_t *offset, bitsz_t *size )
-{
-    rc_t rc;
-
-    if ( base == NULL || offset == NULL || size == NULL )
-        rc = RC ( rcSRA, rcColumn, rcReading, rcParam, rcNull );
-    else if ( self == NULL )
-        rc = RC ( rcSRA, rcTable, rcAccessing, rcSelf, rcNull );
-    else
-    {
-        rc = 0;
-
-        /* open cursor */
-        if ( ! self -> curs_open )
-        {
-            rc = VCursorOpen(self->curs);
-            if ( rc == 0 )
-                ((SRATable *)self)->curs_open = true;
-        }
-
-        if ( rc == 0 )
-        {
-            uint32_t elem_bits, elem_off, elem_cnt;
-            rc = VCursorCellDataDirect ( self -> curs, id, idx,
-                & elem_bits, base, & elem_off, & elem_cnt );
-            if ( rc == 0 )
-            {
-                * offset = elem_off * elem_bits;
-                * size   = elem_cnt * elem_bits;
-                return 0;
-            } else if( UIError(rc, NULL, self->vtbl) ) {
-                UITableLOGError(rc, self->vtbl, true);
-            }
-        }
-    }
-
-    if ( base != NULL )
-        * base = NULL;
-    if ( offset != NULL )
-        * offset = 0;
-    if ( size != NULL )
-        * size = 0;
-
-    return rc;
-}
-
-/* GetSpotId
- *  convert spot name to spot id
- *
- *  "id" [ OUT ] - return parameter for min(spot_id)-max(spot_id)
- *
- *  "spot_name" [ IN ] - external spot name string
- *  in platform canonical format.
- */
-LIB_EXPORT rc_t CC SRATableGetSpotId ( const SRATable *self,
-        spotid_t *rslt, const char *spot_name )
-{
-    rc_t rc;
-    if( self == NULL || spot_name == NULL){
-        rc=RC(rcSRA, rcTable, rcListing, rcSelf, rcName);
-    } else {
-        rc=VCursorParamsSet((struct VCursorParams*)self->curs,"QUERY_BY_NAME" ,spot_name);
-        if( rc == 0) {
-            struct {
-                uint64_t start_id;
-                uint64_t id_count;
-                int64_t x;
-                int64_t y;
-            } out;
-            uint32_t idx,len;
-            rc = VCursorAddColumn(self->curs, &idx, "SPOT_IDS_FOUND");
-            if( rc == 0 || GetRCState(rc) == rcExists){
-                rc = VCursorReadDirect(self->curs,1,idx,sizeof(out) * 8,&out, 1 , &len);
-                if ( rc == 0 ) {
-                    if(out.id_count==1) {
-                        if(rslt) *rslt=out.start_id;
-                        return 0;
-                    } else if(out.id_count > 1) { /*** doing table range scan in Name space - not relying on X and Y***/
-                        uint32_t x_idx;
-                        rc = VCursorAddColumn(self->curs, &x_idx, "X");
-                        if( rc == 0 || GetRCState(rc) == rcExists){
-                            uint32_t y_idx;
-                            rc = VCursorAddColumn(self->curs, &y_idx, "Y");
-                            if(rc == 0 || GetRCState(rc) == rcExists){
-                                spotid_t rowid;
-                                for(rowid = out.start_id; rowid < out.start_id + out.id_count; rowid ++){
-                                    int32_t x,y;
-                                    rc = VCursorReadDirect(self->curs,rowid,x_idx,32,&x,1, &len);
-                                    if(rc == 0){
-                                        rc = VCursorReadDirect(self->curs,rowid,y_idx,32,&y,1, &len);
-                                        if(rc == 0 && x==out.x && y==out.y){
-                                            if(rslt) *rslt=rowid;
-                                            return 0;
-                                        }
-                                    }
-                                }
-                            }
-                        }
-                    }
-                    rc = RC ( rcSRA, rcIndex, rcSearching, rcColumn, rcNotFound );
-                }
-            }
-        }
-    }
-    return rc;
-}
-
-
-/* ListCol
- *  returns a list of simple column names
- *  each name represents at least one typed column
- *
- *  "names" [ out ] - return parameter for names list
- */
-LIB_EXPORT rc_t CC SRATableListCol( const SRATable *self, SRANamelist **rslt ) {
-    if ( self != NULL )
-        return VTableListCol ( self -> vtbl, (KNamelist **)rslt );
-    return RC(rcSRA, rcTable, rcListing, rcSelf, rcName);
-}
-
-
-/* ColDatatypes
- *  returns list of typedecls for named column
- *
- *  "col" [ IN ] - column name
- *
- *  "dflt_idx" [ OUT, NULL OKAY ] - returns the zero-based index
- *  into "typedecls" of the default datatype for the named column
- *
- *  "typedecls" [ OUT ] - list of datatypes available for named column
- */
-LIB_EXPORT rc_t CC SRATableColDatatypes( const SRATable *self,
-        const char *col, uint32_t *dflt_idx, SRANamelist **rslt ) {
-    if ( self != NULL )
-        return VTableColumnDatatypes ( self -> vtbl, col, dflt_idx, (KNamelist **)rslt );
-    return RC(rcSRA, rcTable, rcListing, rcSelf, rcName);
-}
-
-rc_t SRATableColDatatype ( const SRATable *self,
-        uint32_t idx, VTypedecl *type, VTypedef *def )
-{
-    rc_t rc;
-    if ( type == NULL && def == NULL )
-        rc = RC ( rcSRA, rcColumn, rcAccessing, rcParam, rcNull );
-    else
-    {
-        union { VTypedecl td; VTypedef def; } dummy;
-        if ( type == NULL )
-            type = & dummy . td;
-        else if ( def == NULL )
-            def = & dummy . def;
-
-        if ( idx == 0 )
-            rc = RC ( rcSRA, rcColumn, rcAccessing, rcSelf, rcNull );
-        else if ( self == NULL )
-            rc = RC ( rcSRA, rcTable, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            VTypedesc desc;
-            rc = VCursorDatatype ( self -> curs, idx, type, & desc );
-            if ( rc == 0 )
-            {
-                rc = VSchemaDescribeTypedef ( VCursorGetSchema(self -> curs), def, type -> type_id );
-                if ( rc == 0 )
-                    return 0;
-            }
-        }
-
-        memset ( type, 0, sizeof * type );
-        memset ( def, 0, sizeof * def );
-    }
-    return rc;
-}
-
-/* MetaRevision
- *  returns current revision number
- *  where 0(zero) means tip
- */
-LIB_EXPORT rc_t CC SRATableMetaRevision( const SRATable *self, uint32_t *rslt )
-{
-    if (self == NULL)
-        return RC(rcSRA, rcTable, rcAccessing, rcSelf, rcNull);
-    return KMetadataRevision (self->meta,rslt);
-}
-
-
-/* MaxRevision
- *  returns the maximum revision available
- */
-LIB_EXPORT rc_t CC SRATableMaxMetaRevision( const SRATable *self, uint32_t *rslt )
-{
-    if (self == NULL)
-        return RC(rcSRA, rcTable, rcAccessing, rcSelf, rcNull);
-    return KMetadataMaxRevision(self->meta,rslt);
-}
-
-/* UseMetaRevision
- *  opens indicated revision of metadata
- *  all non-zero revisions are read-only
- */
-LIB_EXPORT rc_t CC SRATableUseMetaRevision ( const SRATable *cself, uint32_t revision )
-{
-    rc_t rc;
-
-    if ( cself == NULL )
-        rc = RC ( rcSRA, rcTable, rcUpdating, rcSelf, rcNull );
-    else if ( cself -> read_only == false )
-        rc = RC ( rcSRA, rcTable, rcUpdating, rcMetadata, rcBusy );
-    else
-    {
-        uint32_t cur;
-        rc = KMetadataRevision ( cself -> meta, & cur );
-        if ( rc == 0 && cur != revision )
-        {
-            SRATable *self = ( SRATable* ) cself;
-            const KMetadata *meta;
-            rc = KMetadataOpenRevision ( self -> meta, & meta, revision );
-            if ( rc == 0 )
-            {
-                KMetadataRelease ( self -> meta );
-                self -> meta = meta;
-            }
-        }
-    }
-
-    return rc;
-}
-
-/* OpenMDataNode
- *  open a metadata node
- *
- *  "node" [ OUT ] - return parameter for metadata node
- *
- *  "path" [ IN ] - simple or hierarchical NUL terminated
- *  path to node
- */
-LIB_EXPORT rc_t CC SRATableOpenMDataNodeRead( const SRATable *self, 
-        struct KMDataNode const **node, const char *path, ... ) {
-    va_list va;
-    rc_t rc;
-    
-    va_start(va, path);
-    rc = SRATableVOpenMDataNodeRead(self, node, path, va);
-    va_end(va);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SRATableVOpenMDataNodeRead( const SRATable *self,
-        struct KMDataNode const **rslt, const char *path, va_list args ) {
-    if (self == NULL)
-        return RC(rcSRA, rcTable, rcAccessing, rcSelf, rcNull);
-    
-    return KMetadataVOpenNodeRead(self->meta, rslt, path, args);
-}
-
-/* private */
-rc_t SRATableGetIdRange ( const SRATable *self,
-        uint32_t idx, spotid_t id, spotid_t *pfirst, spotid_t *plast )
-{
-    rc_t rc;
-
-    if ( pfirst == NULL && plast == NULL )
-        rc = RC ( rcSRA, rcColumn, rcAccessing, rcParam, rcNull );
-    else
-    {
-        spotid_t dummy;
-        if ( pfirst == NULL )
-            pfirst = & dummy;
-        else if ( plast == NULL )
-            plast = & dummy;
-
-        if ( idx == 0 )
-            rc = RC ( rcSRA, rcColumn, rcAccessing, rcSelf, rcNull );
-        else if ( self == NULL )
-            rc = RC ( rcSRA, rcTable, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            int64_t first, last;
-            rc = VCursorPageIdRange ( self -> curs, idx, id, & first, & last );
-            if ( rc == 0 )
-            {
-                * pfirst = ( spotid_t ) first;
-                * plast = ( spotid_t ) last;
-
-                if ( ( int64_t ) * pfirst == first && ( int64_t ) * plast == last )
-                    return 0;
-
-                rc = RC ( rcSRA, rcColumn, rcAccessing, rcRange, rcExcessive );
-            }
-        }
-
-        * pfirst = * plast = 0;
-    }
-
-    return rc;
-}
-
-/* semi-private for sra-dbcc */
-LIB_EXPORT rc_t CC SRATableGetVTableRead( const SRATable *self, const VTable **rslt )
-{
-    if (rslt == NULL)
-        return RC(rcSRA, rcTable, rcAccessing, rcParam, rcNull);
-    
-    if (self == NULL)
-    {
-        * rslt = NULL;
-        return RC(rcSRA, rcTable, rcAccessing, rcSelf, rcNull);
-    }
-
-    *rslt = self->vtbl;
-    return VTableAddRef(*rslt);
-}
-
-LIB_EXPORT rc_t CC SRATableGetKTableRead ( const SRATable *self, struct KTable const **ktbl )
-{
-    rc_t rc;
-
-    if ( ktbl == NULL )
-        rc = RC ( rcSRA, rcTable, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcSRA, rcTable, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            return VTableGetKTableRead ( self -> vtbl, ktbl );
-        }
-
-        * ktbl = NULL;
-    }
-
-    return rc;
-}
-
-/* Locked
- *  returns true if locked
- */
-LIB_EXPORT bool CC SRATableLocked( const SRATable *self )
-{
-    return self ? VTableLocked(self->vtbl) : false;
-}
-
-LIB_EXPORT struct VSchema const* CC SRATableGetSchema ( struct SRATable const *self )
-{
-        return self ? VCursorGetSchema( self->curs ) : NULL;
-}
-
-/* sfa_filter
- *  if a name is found in list, exclude it
- */
-#define DEBUG_SORT(msg) DBGMSG (DBG_SRA, DBG_FLAG(DBG_SRA_SORT), msg)
-
-/* sfa_sort
- *  reorders list
- */
-enum sfa_path_type_id
-{
-    sfa_not_set = -1,
-    sfa_exclude,
-    sfa_non_column,
-    sfa_required,
-    sfa_preferred,
-    sfa_optional
-};
-
-#if _DEBUGGING
-const char* sfa_path_type_id[] = {
-    "not_set",
-    "exclude",
-    "non_column",
-    "required",
-    "preferred",
-    "optional"
-};
-#endif
-
-typedef struct reorder_t_struct {
-    const char * path;
-    uint64_t     size;
-    enum sfa_path_type_id type_id;
-} reorder_t;
-
-typedef enum sfa_path_type_id (CC *sfa_path_type_func)( const char *path );
-
-static
-bool CC sfa_filter(const KDirectory *dir, const char *leaf, void* func)
-{
-    bool ret = true;
-    sfa_path_type_func f = (sfa_path_type_func)func;
-    enum sfa_path_type_id type = f(leaf);
-
-    ret = type >= sfa_non_column;
-    DEBUG_SORT(("%s: %s %s %s\n", __func__, leaf, sfa_path_type_id[type + 1], ret ? "keep" : "drop"));
-    return ret;
-}
-
-static
-bool CC sfa_filter_light(const KDirectory *dir, const char *leaf, void* func)
-{
-    bool ret = true;
-    sfa_path_type_func f = (sfa_path_type_func)func;
-
-    enum sfa_path_type_id type = f(leaf);
-
-    ret = type >= sfa_non_column && type < sfa_optional;
-    DEBUG_SORT(("%s: %s %s %s\n", __func__, leaf, sfa_path_type_id[type + 1], ret ? "keep" : "drop"));
-    return ret;
-}
-
-#define MATCH( ptr, str ) \
-    ( (memcmp(ptr, str, sizeof(str) - 2) == 0 && \
-       ((ptr)[sizeof(str) - 2] == '\0' || (ptr)[sizeof(str) - 2] == '/')) ? \
-        (ptr) += sizeof(str) - (((ptr)[sizeof(str) - 2] == '/') ? 1 : 2) : (const char*) 0)
-
-static
-enum sfa_path_type_id CC sfa_path_type_tbl( const char *path )
-{
-    /* use first character as distinguisher for match */
-    switch ( path [ 0 ] )
-    {
-    case 'c':
-        /* perhaps it's a column */
-        if ( MATCH ( path, "col/" ) )
-        {
-            switch ( path [ 0 ] )
-            {
-            case 'D':
-                if ( MATCH ( path, "DELETION_QV/" ) )
-                    return sfa_optional;
-                if ( MATCH ( path, "DELETION_TAG/" ) )
-                    return sfa_optional;
-                break;
-            case 'H':
-                if ( MATCH ( path, "HOLE_NUMBER/" ) )
-                    return sfa_optional;
-                if ( MATCH ( path, "HOLE_STATUS/" ) )
-                    return sfa_optional;
-                break;
-            case 'I':
-                if ( MATCH ( path, "INTENSITY/" ) )
-                    return sfa_optional;
-                if ( MATCH ( path, "INSERTION_QV/" ) )
-                    return sfa_optional;
-                break;
-            case 'N':
-                if ( MATCH ( path, "NAME_FMT/" ) )
-                    return sfa_preferred;
-                if ( MATCH ( path, "NAME/" ) )
-                    return sfa_preferred;
-                if ( MATCH ( path, "NOISE/" ) )
-                    return sfa_optional;
-                if ( MATCH ( path, "NUM_PASSES/" ) )
-                    return sfa_optional;
-                break;
-            case 'P':
-                if ( MATCH ( path, "POSITION/" ) )
-                    return sfa_optional;
-                if ( MATCH ( path, "PRE_BASE_FRAMES/" ) )
-                    return sfa_optional;
-                if ( MATCH ( path, "PULSE_INDEX/" ) )
-                    return sfa_optional;
-                break;
-            case 'Q':
-                if ( MATCH ( path, "QUALITY2/" ) )
-                    return sfa_optional;
-                break;
-            case 'S':
-                if ( MATCH ( path, "SIGNAL/" ) )
-                    return sfa_optional;
-                if ( MATCH ( path, "SPOT_NAME/" ) )
-                    return sfa_preferred;
-                if ( MATCH ( path, "SUBSTITUTION_QV/" ) )
-                    return sfa_optional;
-                if ( MATCH ( path, "SUBSTITUTION_TAG/" ) )
-                    return sfa_optional;
-                break;
-            case 'W':
-                if ( MATCH ( path, "WIDTH_IN_FRAMES/" ) )
-                    return sfa_optional;
-                break;
-            case 'X':
-            case 'Y':
-                if ( path [ 1 ] == '/' )
-                    return sfa_preferred;
-                break;
-            }
-        }
-        return sfa_required;
-
-    case 'i':
-        /* look for skey index */
-        if ( MATCH ( path, "idx/skey" ) )
-            if ( path [ 0 ] == 0 || strcmp ( path, ".md5" ) == 0 )
-                return sfa_preferred;
-        if ( MATCH ( path, "idx/fuse-" ) )
-            return sfa_exclude;
-        break;
-
-    case 's':
-        /* look for old skey index */
-        if ( MATCH ( path, "skey" ) )
-            if ( path [ 0 ] == 0 || strcmp ( path, ".md5" ) == 0 )
-                return sfa_preferred;
-        break;
-    }
-    /* anything not recognized is non-column required */
-    return sfa_non_column;
-}
-
-static
-enum sfa_path_type_id CC sfa_path_type_db ( const char *path )
-{
-    /* use first character as distinguisher for match */
-    switch ( path [ 0 ] )
-    {
-    case 't':
-        /* perhaps it's a table */
-        if ( MATCH ( path, "tbl/" ) )
-        {
-            switch ( path [ 0 ] )
-            {
-            case 0:
-                return sfa_non_column;
-            case 'S':
-                if ( MATCH ( path, "SEQUENCE/" ) )
-                    return sfa_path_type_tbl(path);
-                break;
-            case 'C':
-                if ( MATCH ( path, "CONSENSUS/" ) )
-                    return sfa_path_type_tbl(path);
-                break;
-            case 'P':
-                if ( MATCH ( path, "PRIMARY_ALIGNMENT/" ) )
-                    return sfa_path_type_tbl(path);
-                break;
-            case 'R':
-                if ( MATCH ( path, "REFERENCE/" ) )
-                    return sfa_path_type_tbl(path);
-                break;
-            }
-            /* all other tables are optional */
-            return sfa_optional;
-        }
-    }
-    /* anything not recognized is non-column required */
-    return sfa_non_column;
-}
-#undef MATCH
-
-static
-int CC sfa_path_cmp ( const void **_a, const void **_b, void * ignored )
-{
-    const reorder_t * a = *_a;
-    const reorder_t * b = *_b;
-    int ret;
-
-    DEBUG_SORT(("%s enter\t%s %s %lu \t%s %s %lu", __func__, 
-                a->path, sfa_path_type_id[a->type_id + 1], a->size,
-                b->path, sfa_path_type_id[b->type_id + 1], b->size));
-
-    ret = a->type_id - b->type_id;
-    if (ret == 0)
-    {
-        if (a->size > b->size)
-            ret = 1;
-        else if (a->size < b->size)
-            ret = -1;
-        else
-            ret = strcmp (a->path, b->path);
-    }
-    DEBUG_SORT(("\t%d\n", ret));
-    return ret;
-}
-
-typedef
-struct to_nv_data_struct
-{
-    const KDirectory * d;
-    Vector * v;
-    rc_t rc;
-    sfa_path_type_func path_type;
-} to_nv_data;
-
-static
-void CC to_nv (void * _item, void * _data)
-{
-    const char* path = _item;
-    to_nv_data* data = _data;
-    reorder_t* obj;
-
-    if (data->rc == 0)
-    {
-        obj = malloc (sizeof (*obj));
-        if (obj == NULL)
-            data->rc = RC (rcSRA, rcVector, rcConstructing, rcMemory, rcExhausted);
-        else
-        {
-            rc_t rc = KDirectoryFileSize (data->d, &obj->size, path);
-            if (rc == 0)
-            {
-                obj->path = path;
-                obj->type_id = data->path_type(path);
-                rc = VectorAppend (data->v, NULL, obj);
-            }
-
-            if (rc)
-            {
-                free (obj);
-                data->rc = rc;
-            }
-        }
-    }
-}
-
-static
-void CC item_whack (void * item, void * ignored)
-{
-    free (item);
-}
-
-static
-rc_t CC sfa_sort( const KDirectory *dir, Vector *v, sfa_path_type_func func )
-{
-    /* assume "v" is a vector of paths - hopefully relative to "dir" */
-    Vector nv;
-    to_nv_data data;
-    uint32_t base;
-
-    DEBUG_SORT(("%s enter\n", __func__));
-
-    base = VectorStart (v);
-    VectorInit (&nv, base, VectorLength (v));
-    data.d = dir;
-    data.v = &nv;
-    data.rc = 0;
-    data.path_type = func;
-
-    VectorForEach (v, false, to_nv, &data);
-
-    if(data.rc == 0) {
-        uint32_t idx = 0;
-        uint32_t limit = VectorLength (v) + base;
-
-        VectorReorder(&nv, sfa_path_cmp, NULL);
-
-        for (idx = base; idx < limit; ++idx) {
-            const reorder_t * tmp;
-            void * ignore;
-
-            tmp = VectorGet (&nv, idx);
-            data.rc = VectorSwap (v, idx + base, tmp->path, &ignore);
-            if(data.rc) {
-                break;
-            }
-        }
-    }
-    VectorWhack (&nv, item_whack, NULL);
-    DEBUG_SORT(("%s exit %d %R\n", __func__, data.rc, data.rc));
-    return data.rc;
-}
-
-static
-rc_t CC sfa_sort_db( const KDirectory *dir, Vector *v )
-{
-    return sfa_sort(dir, v, sfa_path_type_db);
-}
-
-static
-rc_t CC sfa_sort_tbl( const KDirectory *dir, Vector *v )
-{
-    return sfa_sort(dir, v, sfa_path_type_tbl);
-}
-
-/* MakeSingleFileArchive
- *  makes a single-file-archive file from an SRA table
- *
- *  contents are ordered by frequency and necessity of access
- *
- *  "lightweight" [ IN ] - when true, include only those components
- *  required for read and quality operations.
- *
- *  "ext" [OUT,NULL] - optional file name extension to use for file
- */
-LIB_EXPORT rc_t CC SRATableMakeSingleFileArchive ( const SRATable *self, const KFile **sfa, bool lightweight, const char** ext)
-{
-    rc_t rc;
-
-    if( sfa == NULL ) {
-        rc = RC(rcSRA, rcFile, rcConstructing, rcParam, rcNull);
-    } else {
-        *sfa = NULL;
-        if( self == NULL ) {
-            rc = RC(rcSRA, rcTable, rcAccessing, rcSelf, rcNull);
-        } else {
-            const VDatabase *db;
-            if( (rc = VTableOpenParentRead(self->vtbl, &db)) == 0 && db != NULL ) {
-                const KDatabase *kdb;
-                if ((rc = VDatabaseOpenKDatabaseRead(db, &kdb)) == 0) {
-                    const KDirectory *db_dir;
-                    if( (rc = KDatabaseOpenDirectoryRead(kdb, &db_dir)) == 0 ) {
-                        rc = KDirectoryOpenTocFileRead(db_dir, sfa,
-                            sraAlign4Byte,
-                            lightweight ? sfa_filter_light : sfa_filter,
-                            (void*)sfa_path_type_db, sfa_sort_db);
-                        KDirectoryRelease(db_dir);
-                        if( ext != NULL ) {
-                            *ext = CSRA_EXT(lightweight);
-                        }
-                    }
-                    KDatabaseRelease(kdb);
-                }
-                VDatabaseRelease(db);
-            } else {
-                const KTable *ktbl;
-                rc = SRATableGetKTableRead(self, &ktbl);
-                if( rc == 0 ) {
-                    const KDirectory *tbl_dir;
-                    rc = KTableGetDirectoryRead(ktbl, &tbl_dir);
-                    if( rc == 0 ) {
-                        rc = KDirectoryOpenTocFileRead(tbl_dir, sfa, sraAlign4Byte,
-                            lightweight ? sfa_filter_light : sfa_filter, (void*)sfa_path_type_tbl, sfa_sort_tbl);
-                        KDirectoryRelease(tbl_dir);
-                        if( ext != NULL ) {
-                            *ext = SRA_EXT(lightweight);
-                        }
-                    }
-                    KTableRelease(ktbl);
-                }
-            }
-        }
-    }
-    return rc;
-}
-
-/* OpenAltTableRead
- *  opens a table within a database structure with a specific name
- */
-SRA_EXTERN rc_t CC SRAMgrOpenAltTableRead ( const SRAMgr *self,
-    const SRATable **tbl, const char *altname, const char *spec, ... )
-{
-    rc_t rc;
-    
-    va_list args;
-    va_start ( args, spec );
-
-    if ( altname == NULL || altname [ 0 ] == 0 ) {
-        altname = "SEQUENCE";
-    }
-    rc = SRAMgrVOpenAltTableRead ( self, tbl, altname, spec, args );
-
-    va_end ( args );
-    return rc;
-}
diff --git a/libs/sra/sratbl.c b/libs/sra/sratbl.c
deleted file mode 100644
index 3f474d2..0000000
--- a/libs/sra/sratbl.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <sra/extern.h>
-#include <vdb/cursor.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include "sra-priv.h"
-
-rc_t SRATableWhack ( SRATable *self )
-{
-    SRATableDestroy ( self );
-    return 0;
-}
-
-LIB_EXPORT rc_t CC SRATableBaseCount ( const SRATable *self, uint64_t *rslt )
-{
-    rc_t rc;
-
-    if ( rslt == NULL )
-        rc = RC ( rcSRA, rcTable, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcSRA, rcTable, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            *rslt = self->base_count;
-            return 0;
-        }
-        *rslt = 0;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SRATableSpotCount ( const SRATable *self, uint64_t *rslt )
-{
-    rc_t rc;
-
-    if ( rslt == NULL )
-        rc = RC ( rcSRA, rcTable, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcSRA, rcTable, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            *rslt = self->spot_count;
-            return 0;
-        }
-        *rslt = 0;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SRATableMinSpotId ( const SRATable *self, spotid_t *rslt )
-{
-    rc_t rc;
-
-    if ( rslt == NULL )
-        rc = RC ( rcSRA, rcTable, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcSRA, rcTable, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            *rslt = self->min_spot_id;
-            return 0;
-        }
-        *rslt = 0;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SRATableMaxSpotId ( const SRATable *self, spotid_t *rslt )
-{
-    rc_t rc;
-
-    if ( rslt == NULL )
-        rc = RC ( rcSRA, rcTable, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcSRA, rcTable, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            *rslt = self->max_spot_id;
-            return 0;
-        }
-        *rslt = 0;
-    }
-    return rc;
-}
diff --git a/libs/sra/types.c b/libs/sra/types.c
deleted file mode 100644
index d40152d..0000000
--- a/libs/sra/types.c
+++ /dev/null
@@ -1,298 +0,0 @@
-/*=======================================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <sra/extern.h>
-#include <klib/defs.h>
-#include <sra/types.h>
-#include <vdb/schema.h>
-#include <vdb/vdb-priv.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <string.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * VTypedef
- */
-
-
-/* Sizeof
- *  returns the bit size of declared type
- *
- *  technically, this is self -> size * self -> dim.
- */
-#ifndef VTypedefSizeof
-LIB_EXPORT bitsz_t CC VTypedefSizeof ( const VTypedef *self )
-{
-    if ( self == NULL )
-        return 0;
-    return ( bitsz_t ) self -> type_size * self -> dim;
-}
-#endif
-
-/*--------------------------------------------------------------------------
- * VDatatypes
- */
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC VDatatypesAddRef ( const VDatatypes *self )
-{
-    return VSchemaAddRef ( ( const VSchema* ) self );
-}
-
-LIB_EXPORT rc_t CC VDatatypesRelease ( const VDatatypes *self )
-{
-    return VSchemaRelease ( ( const VSchema* ) self );
-}
-
-
-/* ResolveTypedecl
- *  converts a typedecl string to type id and vector dimension
- *
- *  "resolved" [ OUT ] - resolved type declaration
- *
- *  "typedecl" [ IN ] - type declaration
- */
-LIB_EXPORT rc_t CC VDatatypesVResolveTypedecl ( const VDatatypes *self,
-    VTypedecl *resolved, const char *typedecl, va_list args )
-{
-    return VSchemaVResolveTypedecl ( ( const VSchema* ) self, resolved, typedecl, args );
-}
-
-LIB_EXPORT rc_t CC VDatatypesResolveTypedecl ( const VDatatypes *self,
-    VTypedecl *resolved, const char *typedecl, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, typedecl );
-    rc = VSchemaVResolveTypedecl ( ( const VSchema* ) self, resolved, typedecl, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-
-/* ResolveTypename
- *  convert a type id into its type definition
- *
- *  "resolved" [ OUT ] - resolved type definition
- *
- *  "typname" [ IN ] - NUL-terminated type name
- */
-LIB_EXPORT rc_t CC VDatatypesResolveTypename ( const VDatatypes *self,
-    VTypedef *resolved, const char *typname )
-{
-    rc_t rc;
-
-    if ( resolved == NULL )
-        rc = RC ( rcSRA, rcSchema, rcResolving, rcParam, rcNull );
-    else
-    {
-        VTypedecl td;
-        rc = VSchemaResolveTypedecl ( ( const VSchema* ) self, & td, typname );
-        if ( rc == 0 )
-        {
-            rc = VSchemaDescribeTypedef ( ( const VSchema* ) self, resolved, td . type_id );
-            if ( rc == 0 )
-                return rc;
-        }
-
-        memset ( resolved, 0, sizeof * resolved );
-    }
-    return rc;
-}
-
-
-/* ResolveTypeid
- *  convert a type id into its type definition
- *
- *  "resolved" [ OUT ] - resolved type definition
- *
- *  "type_id" [ IN ] - 1-based runtime type id
- */
-LIB_EXPORT rc_t CC VDatatypesResolveTypeid ( const VDatatypes *self,
-    VTypedef *resolved, uint32_t type_id )
-{
-    return VSchemaDescribeTypedef ( ( const VSchema* ) self, resolved, type_id );
-}
-
-
-/* SizeofTypedecl
- *  returns the bit size of type declaration
- */
-LIB_EXPORT rc_t CC VDatatypesSizeofTypedecl ( const VDatatypes *self,
-    bitsz_t *type_size, const VTypedecl *td )
-{
-    rc_t rc;
-    if ( type_size == NULL )
-        rc = RC ( rcSRA, rcSchema, rcAccessing, rcParam, rcNull );
-    else
-    {
-        VTypedesc desc;
-        rc = VSchemaDescribeTypedecl ( ( const VSchema* ) self, & desc, td );
-        if ( rc == 0 )
-        {
-            * type_size = VTypedescSizeof ( & desc );
-            return 0;
-        }
-
-        * type_size = 0;
-    }
-    return rc;
-}
-
-
-/* SizeofTypeid
- *  returns the bit size of typeid
- *
- *  "type_size" [ OUT ] - bit size of a type
- *
- *  "type_id" [ IN ] - numerical index of a type
- *
- *  "all_elements" [ IN ] - for multi-dimesional types
- *  return the sum of sizes, otherwise - only for a single element
- */
-LIB_EXPORT rc_t CC VDatatypesSizeofTypeid ( const VDatatypes *self,
-    bitsz_t *type_size, uint32_t type_id, bool all_elements )
-{
-    rc_t rc;
-
-    if ( type_size == NULL )
-        rc = RC ( rcVDB, rcType, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcType, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            VTypedef td;
-            rc = VDatatypesResolveTypeid ( self, & td, type_id );
-            if ( rc == 0 )
-            {
-                * type_size = td . type_size;
-                if ( all_elements )
-                    * type_size *=  td . dim;
-            }
-        }
-    }
-
-    return rc;
-}
-
-
-/* MakeTypedecl
- *  convert a VTypedecl into canonical text
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - output buffer for
- *  NUL terminated type declaration string
- *
- *  "typedecl" [ IN ] - binary representation of typedecl
- */
-LIB_EXPORT rc_t CC VDatatypesMakeTypedecl ( const VDatatypes *self,
-    char *buffer, size_t bsize, const VTypedecl *typedecl )
-{
-    return VTypedeclToText ( typedecl, ( const VSchema* ) self, buffer, bsize );
-}
-
-
-/* ToSupertype
- *  cast a typedecl to a size-equivalent supertype decl
- *  returns not-found and leaves "typedecl" unchanged
- *  if no supertype exists
- *
- *  "typedecl" [ IN, OUT ] - populated with a correct
- *  type id and vector dimension on input, will be updated
- *  to contain a supertype and equivalent dimension on
- *  output. e.g.:
- *
- *    IN -  { type_id NCBI:qual4, dim 1 }
- *    OUT - { type_id I8, dim 4 }
- */
-LIB_EXPORT rc_t CC VDatatypesToSupertype ( const VDatatypes *self, VTypedecl *typedecl )
-{
-    return VTypedeclToSupertype ( typedecl, ( const VSchema* ) self, typedecl );
-}
-
-
-/* ToIntrinsic - DEPRECATED
- *  cast a typedecl ( if necessary ) to a size-equivalent
- *  intrinsic typedecl.
- *
- *  returns not-found and leaves "typedecl" unchanged
- *  if no intrinsic supertype exists
- *
- *  leaves "typedecl" unchanged if it is already intrinsic.
- *
- *  "typedecl" [ IN, OUT ] - populated with a correct
- *  type id and vector dimension on input, will be updated
- *  to contain a supertype and equivalent dimension on
- *  output. e.g.:
- *
- *    IN -  { type_id NCBI:qual4, dim 1 }
- *    OUT - { type_id I8, dim 4 }
- */
-LIB_EXPORT rc_t CC VDatatypesToIntrinsic ( const VDatatypes *self, VTypedecl *typedecl )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcSRA, rcType, rcCasting, rcSelf, rcNull );
-    else if ( typedecl == NULL )
-        rc = RC ( rcSRA, rcType, rcCasting, rcParam, rcNull );
-    else
-    {
-        const VSchema *schema = ( const VSchema* ) self;
-        uint32_t last_intrinsic = VSchemaLastIntrinsicTypeId ( schema );
-        if ( last_intrinsic == 0 )
-            rc = RC ( rcSRA, rcType, rcCasting, rcSelf, rcInvalid );
-        else for ( rc = 0; typedecl -> type_id > last_intrinsic; )
-        {
-            if ( ! VTypedeclToSupertype ( typedecl, schema, typedecl ) )
-                break;
-        }
-    }
-
-    return rc;
-}
-
-
-/* ToAncestor
- *  cast a typedecl to a size-equivalent ancestor decl
- *  returns true if cast can be performed
- */
-LIB_EXPORT bool CC VDatatypesToAncestor ( const VDatatypes *self,
-    const VTypedecl *to, const VTypedecl *from )
-{
-    VTypedecl cast;
-    return VTypedeclToTypedecl ( from, ( const VSchema* ) self, to, & cast, NULL );
-}
diff --git a/libs/sra/wsramgr.c b/libs/sra/wsramgr.c
deleted file mode 100644
index 6c430bc..0000000
--- a/libs/sra/wsramgr.c
+++ /dev/null
@@ -1,165 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <sra/extern.h>
-
-#include <sra/wsradb.h>
-#include <os-native.h>
-
-#define KONST
-#include "sra-priv.h"
-#include <sra/types.h>
-#include <vdb/manager.h>
-#include <vdb/schema.h>
-#include <vdb/table.h>
-#include <vdb/cursor.h>
-#include <vdb/vdb-priv.h>
-#include <kdb/manager.h>
-#include <klib/refcount.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <klib/text.h>
-
-#include <stdlib.h>
-#include <sysalloc.h>
-
-#define RC_MODULE (rcSRA)
-#define RC_TARGET (rcMgr)
-#define CLASS "SRAMgr"
-
-
-/* MakeUpdate
- *  create library handle for read/write access
- *
- *  "wd" [ IN, NULL OKAY ] - optional working directory for
- *  accessing the file system. mgr will attach its own reference.
- *
- *  NB - not implemented in read-only library,
- *  and the read-only library may not be mixed with read/write
- */
-LIB_EXPORT rc_t CC SRAMgrMakeUpdate ( SRAMgr **mgrp, struct KDirectory *wd )
-{
-    rc_t rc;
-
-    if ( mgrp == NULL )
-        rc = RC ( rcSRA, rcMgr, rcConstructing, rcParam, rcNull );
-    else
-    {
-        VDBManager *vmgr;
-        rc = VDBManagerMakeUpdate ( & vmgr, wd );
-        if ( rc == 0 )
-        {
-            SRAMgr *mgr;
-            rc = SRAMgrMake ( & mgr, vmgr , NULL );
-            if ( rc == 0 )
-            {
-                mgr -> read_only = false;
-                * mgrp = mgr;
-                return 0;
-            }
-
-            VDBManagerRelease ( vmgr );
-        }
-
-        * mgrp = NULL;
-    }
-
-    return rc;
-}
-
-
-/* Drop
- *  drop an existing table
- *
- *  "force" [ IN ] - if true, make every attempt to remove table
- *
- *  "path" [ IN ]  - NUL terminated table name
- */
-LIB_EXPORT rc_t CC SRAMgrDropTable( SRAMgr *self, bool force, const char *path, ... ) {
-    va_list va;
-    rc_t rc;
-    
-    va_start(va, path);
-    rc = SRAMgrVDropTable(self, force, path, va);
-    va_end(va);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SRAMgrVDropTable( SRAMgr *self, bool force, const char *path, va_list args ) {
-    if (self == NULL)
-        return RC(RC_MODULE, RC_TARGET, rcRemoving, rcSelf, rcNull);
-    if (path == NULL)
-        return RC(RC_MODULE, RC_TARGET, rcRemoving, rcParam, rcNull);
-    return VDBManagerVDrop(self->vmgr, kptTable, path, args);
-}
-
-LIB_EXPORT rc_t CC SRAMgrVLock ( SRAMgr *self, const char *path, va_list args ) {
-    if (self == NULL)
-        return RC(RC_MODULE, RC_TARGET, rcRemoving, rcSelf, rcNull);
-    if (path == NULL)
-        return RC(RC_MODULE, RC_TARGET, rcRemoving, rcParam, rcNull);
-    return VDBManagerVLock(self->vmgr, path, args);
-}
-
-LIB_EXPORT rc_t CC SRAMgrLock ( SRAMgr *self, const char *path, ... ) {
-    va_list va;
-    rc_t rc;
-    
-    va_start(va, path);
-    rc = SRAMgrVLock(self, path, va);
-    va_end(va);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SRAMgrVUnlock ( SRAMgr *self, const char *path, va_list args ) {
-    if (self == NULL)
-        return RC(RC_MODULE, RC_TARGET, rcRemoving, rcSelf, rcNull);
-    if (path == NULL)
-        return RC(RC_MODULE, RC_TARGET, rcRemoving, rcParam, rcNull);
-    return VDBManagerVUnlock(self->vmgr, path, args);
-}
-
-LIB_EXPORT rc_t CC SRAMgrUnlock ( SRAMgr *self, const char *path, ... ) {
-    va_list va;
-    rc_t rc;
-    
-    va_start(va, path);
-    rc = SRAMgrVUnlock(self, path, va);
-    va_end(va);
-    return rc;
-}
-
-
-/* SetMD5Mode
- *  sets default MD5 file mode for all objects
- *  opened for update under table
- */
-LIB_EXPORT rc_t CC SRAMgrSetMD5Mode( SRAMgr *self, bool useMD5 ) {
-    if (self == NULL)
-        return RC(RC_MODULE, RC_TARGET, rcUpdating, rcSelf, rcNull);
-    self->mode = useMD5 ? (self->mode | kcmMD5) : (self->mode & ~kcmMD5);
-    return 0;
-}
diff --git a/libs/sra/wsraschema-stub.c b/libs/sra/wsraschema-stub.c
deleted file mode 100644
index 2cfdc97..0000000
--- a/libs/sra/wsraschema-stub.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <sra/sraschema.h>
-#include <sra/sradb-priv.h>
-#include <klib/rc.h>
-
-#include "sra-priv.h"
-
-/*--------------------------------------------------------------------------
- * SRASchema
- *  a schema object pre-loaded with default SRA schema
- */
-
-/* Make
- *  create an instance of the default SRA schema
- */
-rc_t CC VDBManagerMakeSRASchema ( struct VDBManager const *self, struct VSchema **schema )
-{
-    return SRASchemaMake ( schema, self );
-}
-
-rc_t CC SRAMgrMakeSRASchema ( const SRAMgr *self, struct VSchema **schema )
-{
-    if ( self != NULL )
-        return VDBManagerMakeSRASchema ( self -> vmgr, schema );
-    return RC ( rcSRA, rcMgr, rcAccessing, rcSelf, rcNull );
-}
diff --git a/libs/sra/wsratbl.c b/libs/sra/wsratbl.c
deleted file mode 100644
index 945ae68..0000000
--- a/libs/sra/wsratbl.c
+++ /dev/null
@@ -1,649 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <sra/extern.h>
-#include <sra/wsradb.h>
-#include <sra/types.h>
-#include <vdb/schema.h>
-#include <vdb/table.h>
-#include <vdb/cursor.h>
-#include <vdb/vdb-priv.h>
-#include <kdb/meta.h>
-#include <klib/printf.h> /* string_vprintf */
-#include <klib/refcount.h>
-#include <klib/log.h>
-#include <klib/debug.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <assert.h>
-
-#include "sra-debug.h"
-
-#define KONST
-#include "sra-priv.h"
-
-#define RC_MODULE (rcSRA)
-#define RC_TARGET (rcTable)
-#define CLASS "SRATable"
-
-/* Whack
- */
-
-rc_t SRATableWhack ( SRATable *self )
-{
-    SRATableDestroy( self );
-    return 0;
-}
-
-/* Create
- *  creates a new table
- *
- *  "tbl" [ OUT ] - return parameter for table
- *
- *  "path" [ IN ] - NUL terminated table name
- */
-LIB_EXPORT rc_t CC SRAMgrCreateTable(SRAMgr *self, SRATable **tbl, const char *typespec, const char *path, ...) {
-    va_list va;
-    rc_t rc;
-    
-    va_start(va, path);
-    rc = SRAMgrVCreateTable(self, tbl, typespec, path, va);
-    va_end(va);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SRAMgrVCreateTable ( SRAMgr *self, SRATable **rslt,
-    const char *typespec, const char *spec, va_list args )
-{
-    rc_t rc;
-
-    if ( rslt == NULL )
-        rc = RC ( rcSRA, rcTable, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcSRA, rcTable, rcConstructing, rcSelf, rcNull );
-        else if ( spec == NULL )
-            rc = RC ( rcSRA, rcTable, rcConstructing, rcString, rcNull );
-        else if ( spec [ 0 ] == 0 )
-            rc = RC ( rcSRA, rcTable, rcConstructing, rcString, rcEmpty );
-        else
-        {
-            char path [ 4097 ];
-            size_t act_size = 0;
-            
-            rc = string_vprintf(path, 4097, &act_size, spec, args);
-            path[act_size] = '\0';
-            if ( rc == 0 )
-            {
-                VTable *vtbl;
-                rc = VDBManagerCreateTable ( self -> vmgr, & vtbl, self -> schema,
-                    typespec, ( self -> mode & kcmBitMask ) | kcmCreate, path );
-                if ( rc == 0 )
-                {
-                    rc = VTableColumnCreateParams ( vtbl, kcmCreate, kcsCRC32, 0 );
-                    if ( rc == 0 )
-                    {
-                        SRATable *tbl = calloc ( 1, sizeof * tbl );
-                        if ( tbl == NULL )
-                            rc = RC ( rcSRA, rcTable, rcConstructing, rcMemory, rcExhausted );
-                        else
-                        {
-                            tbl -> vtbl = vtbl;
-
-                            rc = VTableOpenMetadataUpdate ( vtbl, & tbl -> meta );
-                            if ( rc == 0 )
-                                rc = KMetadataVersion ( tbl -> meta, & tbl -> metavers );
-                            if ( rc == 0 )
-                                rc = VTableCreateCursorWrite ( vtbl, & tbl -> curs, kcmInsert );
-                            if ( rc == 0 )
-                            {
-                                tbl -> mgr = SRAMgrAttach ( self );
-                                tbl -> mode = self -> mode;
-                                tbl -> read_only = false;
-                                KRefcountInit ( & tbl -> refcount, 1, "SRATable", "OpenTableUpdate", path );
-                                VectorInit ( & tbl -> wcol, 0, 16 );
-                                * rslt = tbl;
-                                return 0;
-                            }
-
-                            vtbl = NULL;
-                            SRATableWhack ( tbl );
-                        }
-                    }
-
-                    VTableRelease ( vtbl );
-                }
-            }
-        }
-
-        * rslt = NULL;
-    }
-
-    return rc;
-}
-
-
-/* OpenUpdate
- *  open an existing table
- *
- *  "run" [ OUT ] - return parameter for table
- *
- *  "path" [ IN ] - NUL terminated table name
- */
-LIB_EXPORT rc_t CC SRAMgrOpenTableUpdate(SRAMgr *self, SRATable **tbl, const char *path, ...) {
-    va_list va;
-    rc_t rc;
-    
-    va_start(va, path);
-    rc = SRAMgrVOpenTableUpdate(self, tbl, path, va);
-    va_end(va);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SRAMgrVOpenTableUpdate(SRAMgr *mgr, SRATable **rslt, const char *spec, va_list args) {
-    SRATable *self;
-    char path[4096];
-    rc_t rc;
-    
-    if (mgr == NULL)
-        return RC(RC_MODULE, RC_TARGET, rcConstructing, rcSelf, rcNull);
-    if (spec == NULL || rslt == NULL)
-        return RC(RC_MODULE, RC_TARGET, rcConstructing, rcParam, rcNull);
-    
-    *rslt = NULL;
-    
-    rc = ResolveTablePath(mgr, path, sizeof(path), spec, args);
-    if (rc)
-        return rc;
-    
-    self = calloc(1, sizeof(*self));
-    if (self == NULL)
-        return RC(RC_MODULE, RC_TARGET, rcConstructing, rcMemory, rcExhausted);
-    
-    rc = VDBManagerOpenTableUpdate(mgr->vmgr, &self->vtbl, mgr->schema, path);
-    if (rc == 0) {
-        rc = VTableOpenMetadataUpdate(self->vtbl, &self->meta);
-        if (rc == 0) {
-            rc = KMetadataVersion(self->meta, &self->metavers);
-            if (rc == 0) {
-                rc = VTableCreateCursorWrite(self->vtbl, &self->curs, kcmInsert);
-                if (rc == 0) {
-                    self->mgr = SRAMgrAttach(mgr);
-                    self->mode = mgr->mode;
-                    self->read_only = false;
-                    KRefcountInit(&self->refcount, 1, "SRATable", "OpenTableUpdate", path);
-                    
-                    rc = SRATableFillOut ( self, true );
-                    if ( rc == 0 )
-                    {
-                        VectorInit ( & self -> wcol, 0, 16 );
-                    
-                        *rslt = self;
-                        return 0;
-                    }
-                }
-            }
-        }
-    }
-    SRATableWhack(self);
-    return rc;
-}
-
-/* NewSpot
- *  creates a new spot record,
- *  returning spot id.
- *
- *  "id" [ OUT ] - return parameter for id of newly created spot
- */
-LIB_EXPORT rc_t CC SRATableNewSpot( SRATable *self, spotid_t *id ) {
-    rc_t rc;
-    
-    if (self == NULL)
-        return RC(RC_MODULE, RC_TARGET, rcInserting, rcSelf, rcNull);
-    if (id == NULL)
-        return RC(RC_MODULE, RC_TARGET, rcInserting, rcParam, rcNull);
-    
-    if (self->curs_open == false) {
-        SRADBG(("opening cursor\n"));
-        rc = VCursorOpen(self->curs);
-        if (rc)
-            return rc;
-        self->curs_open = true;
-    }
-    
-    rc = VCursorOpenRow(self->curs);
-    if (rc == 0) {
-        int64_t rowid;
-        if( (rc = VCursorRowId(self->curs, &rowid)) == 0 ) {
-            *id = rowid;
-        }
-    }
-    return rc;
-}
-
-/* OpenSpot
- *  opens an existing spot record from id
- *
- *  "id" [ IN ] - 1-based spot id
- */
-LIB_EXPORT rc_t CC SRATableOpenSpot( SRATable *self, spotid_t id ) {
-    rc_t rc;
-    
-    if (self == NULL)
-        return RC(RC_MODULE, RC_TARGET, rcOpening, rcSelf, rcNull);
-#if 0
-    /* TODO: translate spot id to row id */
-    rc = VCursorSetRowId(self->curs, id);
-    if (rc == 0) {
-        rc = VCursorOpenRow(self->curs);
-    }
-#else
-    rc = RC(RC_MODULE, RC_TARGET, rcOpening, rcFunction, rcUnsupported);
-#endif
-    return rc;
-}
-
-
-/* CloseSpot
- *  closes a spot opened with either NewSpot or OpenSpot
- */
-LIB_EXPORT rc_t CC SRATableCloseSpot( SRATable *self ) {
-    rc_t rc;
-    
-    if (self == NULL)
-        return RC(RC_MODULE, RC_TARGET, rcClosing, rcSelf, rcNull);
-    
-    rc = VCursorCommitRow(self->curs);
-    if (rc == 0)
-        return VCursorCloseRow(self->curs);
-    VCursorCloseRow(self->curs);
-    return rc;
-}
-
-
-/* Commit
- *  commit all changes
- */
-LIB_EXPORT rc_t CC SRATableCommit( SRATable *self ) {
-    rc_t rc;
-    
-    if (self == NULL)
-        return RC(RC_MODULE, RC_TARGET, rcCommitting, rcSelf, rcNull);
-    rc = VCursorCommit(self->curs);
-    VCursorRelease(self->curs);
-    self->curs = NULL;
-    if (rc == 0)
-        rc = VTableReindex(self->vtbl);
-    return rc;
-}
-
-static int CC cmp_index( const void *A, const void *B ) {
-    return *(const uint32_t *)A - ((const SRAColumn *)B)->idx;
-}
-
-static bool find_by_index(const Vector *vec, uint32_t idx, uint32_t *cndx) {
-    uint32_t found;
-    
-    if ( VectorFind(vec, &idx, &found, cmp_index ) != NULL ) {
-        *cndx = found;
-        return true;
-    }
-    return false;
-}
-
-/* OpenColumnWrite
- *  open a column for write
- *
- *  "idx" [ OUT ] - return parameter for 1-based column index.
- *
- *  "col" [ OUT, NULL OKAY ] - optional return parameter for
- *  newly opened column.
- *
- *  "name" [ IN ] - NUL terminated string in UTF-8 giving column name
- *
- *  "datatype" [ IN ] - NUL terminated string in ASCII
- *   describing fully qualified column data type
- */
-LIB_EXPORT rc_t CC SRATableOpenColumnWrite ( SRATable *self,
-    uint32_t *idx, SRAColumn **col, const char *name, const char *datatype )
-{
-    rc_t rc;
-    SRAColumn *rslt;
-    uint32_t ndx, cndx;
-    
-    if (self == NULL)
-        return RC(RC_MODULE, RC_TARGET, rcOpening, rcSelf, rcNull);
-    
-    if (name == NULL || idx == NULL)
-        return RC(RC_MODULE, RC_TARGET, rcOpening, rcParam, rcNull);
-    
-    *idx = 0;
-    
-    if (datatype && datatype[0])
-    {
-        SRADBG(("adding column (%s)%s\n", datatype, name));
-        rc = VCursorAddColumn(self->curs, &ndx, "(%s)%s", datatype, name);
-    }
-    else
-    {
-        SRADBG(("adding column %s\n", name));
-        rc = VCursorAddColumn(self->curs, &ndx, name);
-    }
-    
-    if (rc != 0)
-    {
-        /* it's okay if the column is already there
-           any other rc is a hard error */
-        if (GetRCState ( rc ) != rcExists)
-            return rc;
-        
-        if ( ! find_by_index(&self->wcol, ndx, &cndx) )
-        {
-            /* severe internal error */
-            return RC ( RC_MODULE, RC_TARGET, rcOpening, rcNoObj, rcNotFound );
-        }
-
-        /* get the uncounted reference to column from table */
-        rslt = VectorGet(&self->wcol, cndx);
-    }
-    else
-    {
-        VTypedecl type;
-        VTypedesc desc;
-        
-        rslt = malloc(sizeof *rslt );
-        if (rslt == NULL)
-            return RC(RC_MODULE, rcColumn, rcConstructing, rcMemory, rcExhausted);
-        
-        rc = VCursorDatatype(self->curs, ndx, &type, &desc);
-        if (rc == 0)
-        {
-            /* this object will sit uncounted within the table
-               when the table goes away, it will douse the columns
-               without regard to their reference count. see below */
-            KRefcountInit(&rslt->refcount, 0, "SRAColumn", "OpenColumnWrite", name);
-
-            /* the column has no reference to the table, so after this
-               there will only be an uncounted reference from table to column */
-            rslt->tbl = NULL;
-            rslt->idx = ndx;
-            rslt->read_only = false;
-            rslt->elem_bits = VTypedescSizeof(&desc);
-
-            rc = VectorAppend(&self->wcol, &cndx, rslt);
-        }
-
-        if ( rc != 0 )
-        {
-            free ( rslt );
-            return rc;
-        }
-    }
-
-    /* see if user wants a reference */
-    if ( col != NULL )
-    {
-        /* the first column reference exported will take
-           the refcount from zero to one */
-        SRAColumnAddRef ( rslt );
-
-        /* the first exported reference will need to be reflected
-           to the table. this will ensure that the table never tries
-           to whack its columns as long as they are held externally,
-           because the table itself will be kept alive. when the last
-           column reference is released, it will also release the table */
-        if ( rslt -> tbl == NULL )
-            rslt -> tbl = SRATableAttach ( self );
-
-        *col = rslt;
-    }
-
-    *idx = cndx + 1;
-    return rc;
-}
-
-static
-rc_t lookup_and_validate(SRATable *self, const SRAColumn **rslt, uint32_t idx, const void *base, bitsz_t offset, bitsz_t size) {
-    const SRAColumn *col;
-    
-    if (self == NULL)
-        return RC(RC_MODULE, RC_TARGET, rcWriting, rcSelf, rcNull);
-    
-    col = VectorGet(&self->wcol, idx - 1);
-    if (col == NULL)
-        return RC(RC_MODULE, RC_TARGET, rcWriting, rcParam, rcInvalid);
-    
-    if (size % col->elem_bits != 0)
-        return RC(RC_MODULE, RC_TARGET, rcWriting, rcParam, rcInvalid);
-    
-    if (offset % col->elem_bits != 0)
-        return RC(RC_MODULE, RC_TARGET, rcWriting, rcParam, rcInvalid);
-    
-    *rslt = col;
-    return 0;
-}
-
-/* SetIdxColumnDefault
- *  give a default value for column
- *
- *  if no value gets written to a column within an open spot,
- *  this value is substituted.
- *
- *  "idx" [ IN ] - 1-based column index
- *
- *  "base" [ IN ] and "offset" [ IN ] - pointer and bit offset
- *  to start of row data
- *
- *  "size" [ IN ] - size in bits of row data
- */
-LIB_EXPORT rc_t CC SRATableSetIdxColumnDefault ( SRATable *self,
-        uint32_t idx, const void *base, bitsz_t offset, bitsz_t size ) {
-    const SRAColumn *col;
-    rc_t rc;
-    
-    rc = lookup_and_validate(self, &col, idx, base, offset, size);
-    if (rc == 0)
-        rc = VCursorDefault(self->curs, col->idx, col->elem_bits, base, offset / col->elem_bits, size / col->elem_bits);
-    return rc;
-}
-
-
-/* WriteIdxColumn
- *  write row data to an indexed column
- *
- *  "idx" [ IN ] - 1-based column index
- *
- *  "base" [ IN ] and "offset" [ IN ] - pointer and bit offset
- *  to start of row data
- *
- *  "size" [ IN ] - size in bits of row data
- */
-LIB_EXPORT rc_t CC SRATableWriteIdxColumn ( SRATable *self,
-        uint32_t idx, const void *base, bitsz_t offset, bitsz_t size ) {
-    const SRAColumn *col;
-    rc_t rc;
-    
-    rc = lookup_and_validate(self, &col, idx, base, offset, size);
-    if (rc == 0)
-        rc = VCursorWrite(self->curs, col->idx, col->elem_bits, base, offset / col->elem_bits, size / col->elem_bits);
-    return rc;
-}
-
-
-/* MetaFreeze
- *  freezes current metadata revision
- *  further modification will begin on a copy
- */
-LIB_EXPORT rc_t CC SRATableMetaFreeze ( SRATable *self ) {
-    if (self == NULL)
-        return RC(RC_MODULE, RC_TARGET, rcOpening, rcSelf, rcNull);
-    
-    return KMetadataFreeze(self->meta);
-}
-
-
-/* OpenMDataNode
- *  open a metadata node
- */
-LIB_EXPORT rc_t CC SRATableOpenMDataNodeUpdate ( SRATable *self, struct KMDataNode **node, const char *path, ... ) {
-    va_list va;
-    rc_t rc;
-    
-    va_start(va, path);
-    rc = SRATableVOpenMDataNodeUpdate(self, node, path, va);
-    va_end(va);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SRATableVOpenMDataNodeUpdate ( SRATable *self, struct KMDataNode **node, const char *spec, va_list args ) {
-    rc_t rc;
-    char path[4096];
-    int n;
-    
-    if (self == NULL)
-        return RC(RC_MODULE, RC_TARGET, rcOpening, rcSelf, rcNull);
-    if (spec == NULL)
-        return RC(RC_MODULE, RC_TARGET, rcOpening, rcParam, rcNull);
-    
-    n = vsnprintf(path, sizeof(path), spec, args);
-    if (n >= sizeof(path))
-        return RC(RC_MODULE, RC_TARGET, rcOpening, rcName, rcTooLong);
-    
-    rc = KMetadataOpenNodeUpdate(self->meta, node, path);
-    if (rc)
-    {
-        SRADBG(("failed to open table metadata node '%s' %R", path, rc));
-    }
-    return rc;
-}
-
-#define RD_COLVALUE(tbl, nm, var) \
-                SRATable_ReadColBack(tbl, nm, sizeof(var) * 8, (void*)&var, sizeof(var))
-
-static
-rc_t SRATable_ReadColBack(const VTable* tbl, const char* col_name, uint32_t elem_bits, void *buffer, uint32_t blen)
-{
-    rc_t rc = 0;
-    uint32_t idx;
-    const VCursor* curs = NULL;
-   
-    if( (rc = VTableCreateCursorRead(tbl, &curs)) == 0 &&
-        (rc = VCursorAddColumn(curs, &idx, col_name)) == 0 &&
-        (rc = VCursorOpen(curs)) == 0 ) {
-        uint32_t len;
-        rc = VCursorReadDirect(curs, 1, idx, elem_bits, buffer, blen, &len);
-    }
-    VCursorRelease(curs);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SRATableBaseCount ( const SRATable *self, uint64_t *rslt )
-{
-    rc_t rc;
-
-    if ( rslt == NULL )
-        rc = RC ( rcSRA, rcTable, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcSRA, rcTable, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            RD_COLVALUE(self->vtbl, "BASE_COUNT", self->base_count);
-            *rslt = self->base_count;
-            return 0;
-        }
-        *rslt = 0;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SRATableSpotCount ( const SRATable *self, uint64_t *rslt )
-{
-    rc_t rc;
-
-    if ( rslt == NULL )
-        rc = RC ( rcSRA, rcTable, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcSRA, rcTable, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            RD_COLVALUE(self->vtbl, "SPOT_COUNT", self->spot_count);
-            *rslt = self->spot_count;
-            return 0;
-        }
-        *rslt = 0;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SRATableMinSpotId ( const SRATable *self, spotid_t *rslt )
-{
-    rc_t rc;
-
-    if ( rslt == NULL )
-        rc = RC ( rcSRA, rcTable, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcSRA, rcTable, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            RD_COLVALUE(self->vtbl, "MIN_SPOT_ID", self->min_spot_id);
-            *rslt = self->min_spot_id;
-            return 0;
-        }
-        *rslt = 0;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC SRATableMaxSpotId ( const SRATable *self, spotid_t *rslt )
-{
-    rc_t rc;
-
-    if ( rslt == NULL )
-        rc = RC ( rcSRA, rcTable, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcSRA, rcTable, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            RD_COLVALUE(self->vtbl, "MAX_SPOT_ID", self->max_spot_id);
-            *rslt = self->max_spot_id;
-            return 0;
-        }
-        *rslt = 0;
-    }
-    return rc;
-}
diff --git a/libs/sraxf/Makefile b/libs/sraxf/Makefile
deleted file mode 100644
index f070061..0000000
--- a/libs/sraxf/Makefile
+++ /dev/null
@@ -1,143 +0,0 @@
-# ===========================================================================
-#
-#                            PUBLIC DOMAIN NOTICE
-#               National Center for Biotechnology Information
-#
-#  This software/database is a "United States Government Work" under the
-#  terms of the United States Copyright Act.  It was written as part of
-#  the author's official duties as a United States Government employee and
-#  thus cannot be copyrighted.  This software/database is freely available
-#  to the public for use. The National Library of Medicine and the U.S.
-#  Government have not placed any restriction on its use or reproduction.
-#
-#  Although all reasonable efforts have been taken to ensure the accuracy
-#  and reliability of the software and data, the NLM and the U.S.
-#  Government do not and cannot warrant the performance or results that
-#  may be obtained by using this software or data. The NLM and the U.S.
-#  Government disclaim all warranties, express or implied, including
-#  warranties of performance, merchantability or fitness for any particular
-#  purpose.
-#
-#  Please cite the author in any work or product based on this material.
-#
-# ===========================================================================
-
-
-default: std
-
-TOP ?= $(shell ../../build/abspath.sh ../..)
-MODULE = libs/sraxf
-
-INT_LIBS = \
-	libsraxf \
-	libwsraxf
-
-ALL_LIBS = \
-	$(INT_LIBS)
-
-include $(TOP)/build/Makefile.env
-
-#-------------------------------------------------------------------------------
-# outer targets
-#
-all std: makedirs
-	@ $(MAKE_CMD) $(TARGDIR)/std
-
-$(ALL_LIBS): makedirs
-	@ $(MAKE_CMD) $(TARGDIR)/$@
-
-.PHONY: all std $(ALL_LIBS)
-
-#-------------------------------------------------------------------------------
-# std
-#
-$(TARGDIR)/std: \
-	$(addprefix $(TARGDIR)/,$(ALL_LIBS))
-
-.PHONY: $(TARGDIR)/all $(TARGDIR)/std
-
-#-------------------------------------------------------------------------------
-# clean
-#
-clean: stdclean
-
-.PHONY: clean
-
-#-------------------------------------------------------------------------------
-# sra transform library
-#
-$(TARGDIR)/libsraxf: $(addprefix $(ILIBDIR)/libsraxf.,$(ILIBEXT))
-
-SRAXF_SRC = \
-	untyped \
-	v0-decompress-init \
-	v0-decompress \
-	v0-funcs \
-	bio-start \
-	dynamic-454-read-descriptor \
-	format-spot-name \
-	extract-name_coord \
-	tokenize-spot_name-454 \
-	tokenize-spot_name-illumina \
-	tokenize-spot_name-abi \
-	tokenize-spot_name-helicos \
-	tokenize-spot_name-ion-torrent \
-	color-from-dna \
-	dna-from-color \
-	spot-desc \
-	read-desc \
-	rotate \
-	swap \
-	denormalize \
-	normalize \
-	qual4_decode \
-	read-seg-from-readn \
-	rewrite-spot-name \
-	make-position \
-	process-position \
-	extract-coordinates \
-	fpcodec \
-	index_lookup \
-	varloc
-
-SRAXF_OBJ = \
-	$(addsuffix .$(LOBX),$(SRAXF_SRC))
-
-SRAXF_LIB = \
-	-dksrch \
-	-dvdb \
-	-dkdb \
-	-dklib \
-	-dm \
-	-dz
-
-$(ILIBDIR)/libsraxf.$(LIBX): $(SRAXF_OBJ)
-	$(LD) --slib -o $@ $^ $(SRAXF_LIB)
-
-
-#-------------------------------------------------------------------------------
-# sra transform update library
-#
-$(TARGDIR)/libwsraxf: $(addprefix $(ILIBDIR)/libwsraxf.,$(ILIBEXT))
-
-WSRAXF_SRC = \
-	$(SRAXF_SRC) \
-	extract-name_fmt \
-	extract-spot_name \
-	stats \
-	stats_quality \
-	qual4_encode
-
-WSRAXF_OBJ = \
-	$(addsuffix .$(LOBX),$(WSRAXF_SRC))
-
-WSRAXF_LIB = \
-	-dwvdb \
-	-dwkdb \
-	-dksrch \
-	-dklib \
-	-dm \
-	-dz
-
-$(ILIBDIR)/libwsraxf.$(LIBX): $(WSRAXF_OBJ)
-	$(LD) --slib -o $@ $^ $(WSRAXF_LIB)
diff --git a/libs/sraxf/bio-start.c b/libs/sraxf/bio-start.c
deleted file mode 100644
index a3d41b0..0000000
--- a/libs/sraxf/bio-start.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include <sra/sradb.h>
-#include <vdb/xform.h>
-#include <klib/data-buffer.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <assert.h>
-
-/* INSDC:coord:zero NCBI:SRA:bio_start #1
- *   ( INSDC:coord:zero read_start, INSDC:SRA:xread_type read_type );
- *
- *  searches through read_type vector
- *  returns the 0-based starting coordinate of first biological read
- *
- *  "read_start" [ DATA ] - vector of read start coordinates
- *
- *  "read_type" [ DATA ] - vector of read types
- */
-static
-rc_t CC sra_bio_start ( void *self, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    const uint8_t *src = argv [ 1 ] . u . data . base;
-    uint32_t i;
-    uint64_t count = argv [ 1 ] . u . data . elem_count;
-    for ( i = 0, src += argv [ 1 ] . u . data . first_elem; i < count; ++ i )
-    {
-        if ( ( src [ i ] & SRA_READ_TYPE_BIOLOGICAL ) != 0 )
-        {
-            rc_t rc;
-            int32_t bio_start;
-            KDataBuffer *dst = rslt -> data;
-
-            assert ( argv [ 0 ] . u . data . elem_count == argv [ 1 ] . u . data . elem_count );
-            assert ( argv [ 0 ] . u . data . elem_bits == sizeof bio_start * 8 );
-            bio_start = ( ( const int32_t* ) argv [ 0 ] . u . data . base )
-                [ argv [ 0 ] . u . data . first_elem + i ];
-
-            if ( dst -> elem_bits != sizeof bio_start * 8 )
-            {
-                rc = KDataBufferCast ( dst, dst, sizeof bio_start * 8, true );
-                if ( rc != 0 )
-                    return rc;
-            }
-
-            if ( dst -> elem_count != 1 )
-            {
-                rc = KDataBufferResize ( dst, 1 );
-                if ( rc != 0 )
-                    return rc;
-            }
-
-            * ( int32_t* ) dst -> base = bio_start;
-            rslt -> elem_count = 1;
-            return 0;
-        }
-    }
-
-    return RC ( rcSRA, rcFunction, rcSearching, rcData, rcNotFound );
-}
-
-VTRANSFACT_IMPL( NCBI_SRA_bio_start, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt -> u . rf = sra_bio_start;
-    rslt -> variant = vftRow;
-    return 0;
-}
diff --git a/libs/sraxf/color-from-dna.c b/libs/sraxf/color-from-dna.c
deleted file mode 100644
index 435985c..0000000
--- a/libs/sraxf/color-from-dna.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/table.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <bitstr.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-static
-void color_from_dna(uint8_t csbin[], const uint8_t dnabin[], size_t n, uint8_t primer, const uint8_t conversion_matrix[]) {
-    uint8_t st;
-    size_t i;
-	
-    switch (primer) {
-    case 'A':
-        st = 0;
-        break;
-    case 'C':
-        st = 1;
-        break;
-    case 'G':
-        st = 2;
-        break;
-    case 'T':
-        st = 3;
-        break;
-    default:
-        st = 4;
-        break;
-    }
-	
-    for (i = 0; i != n; ++i) {
-        uint8_t tr = dnabin[i];
-		
-        csbin[i] = conversion_matrix[st * 5 + tr];
-        st = tr;
-    }
-}
-
-static
-rc_t CC color_from_dna_drvr ( void *self, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    uint8_t *csbin;
-
-    uint32_t i;
-    uint64_t row_len = argv [ 0 ] . u . data . elem_count;
-    uint64_t out_len, nreads = argv [ 1 ] . u . data . elem_count;
-
-    const uint8_t *dnabin = argv [ 0 ] . u . data . base;
-    const uint32_t *read_start = argv [ 1 ] . u . data . base;
-    const uint32_t *read_len = argv [ 2 ] . u . data . base;
-    const uint8_t *cskey = argv [ 3 ] . u . data . base;
-    const uint8_t *cmatrx = argv [ 4 ] . u . data . base;
-    
-    assert(argv[0].u.data.elem_bits == 8);
-    assert(argv[1].u.data.elem_bits == 32);
-    assert(argv[2].u.data.elem_bits == 32);
-    assert(argv[3].u.data.elem_bits == 8);
-    assert(argv[4].u.data.elem_bits == 8);
-
-    assert(argv[2].u.data.elem_count == nreads);
-    assert(argv[3].u.data.elem_count == nreads);
-
-    dnabin += argv [ 0 ] . u . data . first_elem;
-    read_start += argv [ 1 ] . u . data . first_elem;
-    read_len += argv [ 2 ] . u . data . first_elem;
-    cskey += argv [ 3 ] . u . data . first_elem;
-    cmatrx += argv [ 4 ] . u . data . first_elem;
-
-    /* safety check that read structure is within bounds */
-    for ( i = 0, out_len = 0; i < nreads; ++i )
-    {
-        if ( read_start [ i ] + read_len [ i ] > row_len )
-            return RC ( rcXF, rcFunction, rcExecuting, rcData, rcInvalid );
-        out_len += read_len [ i ];
-    }
-    
-    /* resize output row for the total number of reads */    
-    rslt -> data -> elem_bits = 8;
-    rc = KDataBufferResize ( rslt -> data, out_len );
-    if ( rc != 0 )
-        return rc;
-
-    /* huh? */
-    rslt -> data -> bit_offset = 0;
-
-    rslt -> elem_count = out_len;
-    csbin = rslt -> data -> base;
-
-    for ( i = 0, out_len = 0; i < nreads; ++i )
-    {
-        color_from_dna ( & csbin [ out_len ],
-            & dnabin [ read_start [ i ] ], read_len [ i ],
-            cskey [ i ], cmatrx );
-
-        out_len += read_len [ i ];
-    }
-    
-    return 0;
-}
-
-/* 
- * function
- * INSDC:color:bin NCBI:color_from_dna #1 ( INSDC:dna:bin dna_bin,
- *     INSDC:coord:zero read_start, U32 read_len,
- *     INSDC:dna:text cs_key, U8 color_matrix )
- */
-VTRANSFACT_IMPL ( NCBI_color_from_dna, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->u.rf = color_from_dna_drvr;
-    rslt->variant = vftRow;
-    
-    return 0;
-}
diff --git a/libs/sraxf/denormalize.c b/libs/sraxf/denormalize.c
deleted file mode 100644
index 68acb2a..0000000
--- a/libs/sraxf/denormalize.c
+++ /dev/null
@@ -1,231 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/table.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <bitstr.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-typedef void (*denorm_f)(void *dst, const void *src, const void *Cntrl, uint64_t vec_count);
-typedef struct self_t {
-    denorm_f f;
-} self_t;
-
-#define DENORM_0(A, B) do { (A).data[0] = (B).data[0]; (A).data[1] = (B).data[0] + (B).data[1]; (A).data[2] = (B).data[2]; (A).data[3] = (B).data[3]; } while (0)
-#define DENORM_1(A, B) A = B
-#define DENORM_2(A, B) do { (A).data[0] = (B).data[0]; (A).data[1] = (B).data[1]; (A).data[2] = (B).data[2]; (A).data[3] = (B).data[2] + (B).data[3]; } while (0)
-#define DENORM_3(A, B) A = B
-
-#define FUNC(VALTYPE) F_ ## VALTYPE
-
-#define FUNC_DEF(VALTYPE) \
-static void FUNC(VALTYPE)(void *Dst, const void *Src, const void *Cntrl, uint64_t count) { \
-    typedef struct { VALTYPE data[4]; } data4_t; \
-    data4_t *dst = (data4_t *)Dst; \
-    const data4_t *src = (const data4_t *)Src; \
-    const uint8_t *cntrl = (const uint8_t *)Cntrl; \
-    uint64_t i; \
-    \
-    for (i = 0; i != count; ++i) { \
-        switch(cntrl[i]) { \
-        default: \
-        case 0: \
-            DENORM_0(dst[i], src[i]); \
-            break; \
-        case 1: \
-            DENORM_1(dst[i], src[i]); \
-            break; \
-        case 2: \
-            DENORM_2(dst[i], src[i]); \
-            break; \
-        case 3: \
-            DENORM_3(dst[i], src[i]); \
-            break; \
-        }\
-    } \
-}
-
-FUNC_DEF(float)
-FUNC_DEF(double)
-FUNC_DEF(uint8_t)
-FUNC_DEF(uint16_t)
-FUNC_DEF(uint32_t)
-FUNC_DEF(uint64_t)
-FUNC_DEF(int8_t)
-FUNC_DEF(int16_t)
-FUNC_DEF(int32_t)
-FUNC_DEF(int64_t)
-
-static
-rc_t CC denormal_drvr (
-                void *Self,
-                const VXformInfo *info,
-                int64_t row_id,
-                VRowResult *rslt,
-                uint32_t argc,
-                const VRowData argv []
-) {
-    rc_t rc = 0;
-    const void *src;
-    const void *cntrl;
-    const self_t *self = (const self_t *)Self;
-    
-    assert(argv[0].u.data.elem_bits % 8 == 0);
-    assert(argv[1].u.data.elem_bits % 8 == 0);
-    
-    src   = &((const uint8_t *)argv[0].u.data.base)[(argv[0].u.data.first_elem * argv[0].u.data.elem_bits) / 8];
-    cntrl = &((const uint8_t *)argv[1].u.data.base)[(argv[1].u.data.first_elem * argv[1].u.data.elem_bits) / 8];
-    
-    rslt->elem_bits = rslt->data->elem_bits = argv[0].u.data.elem_bits;
-    rc = KDataBufferResize(rslt->data, argv[0].u.data.elem_count);
-    if (rc)
-        return rc;
-    rslt->elem_count = rslt->data->elem_count;
-    rslt->data->bit_offset = 0;
-    
-    self->f(rslt->data->base, src, cntrl, rslt->elem_count);
-    
-    return 0;
-}
-
-static
-void CC sraxf_denormalize_free_wrapper( void *ptr )
-{
-	free( ptr );
-}
-
-/* 
- * function < type T > T [ 4 ] NCBI:SRA:denormalize #1 ( T [ 4 ] intensities, U8 called );
- */
-VTRANSFACT_IMPL ( NCBI_SRA_denormalize, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    self_t *self;
-    
-    switch (info->fdesc.desc.domain) {
-    case vtdInt:
-    case vtdUint:
-        switch (info->fdesc.desc.intrinsic_bits) {
-        case 8:
-        case 16:
-        case 32:
-        case 64:
-            break;
-        default:
-            return RC(rcXF, rcFunction, rcConstructing, rcType, rcInvalid);
-            break;
-        }
-        break;
-    case vtdFloat:
-        switch (info->fdesc.desc.intrinsic_bits) {
-        case 32:
-        case 64:
-            break;
-        default:
-            return RC(rcXF, rcFunction, rcConstructing, rcType, rcInvalid);
-            break;
-        }
-        break;
-    default:
-        return RC(rcXF, rcFunction, rcConstructing, rcType, rcInvalid);
-        break;
-    }
-    
-    self = malloc(sizeof(*self));
-    if (self) {
-        switch (info->fdesc.desc.domain) {
-        case vtdInt:
-            switch (info->fdesc.desc.intrinsic_bits) {
-            case 8:
-                self->f = FUNC(int8_t);
-                break;
-            case 16:
-                self->f = FUNC(int16_t);
-                break;
-            case 32:
-                self->f = FUNC(int32_t);
-                break;
-            case 64:
-                self->f = FUNC(int64_t);
-                break;
-            default:
-                break;
-            }
-            break;
-        case vtdUint:
-            switch (info->fdesc.desc.intrinsic_bits) {
-            case 8:
-                self->f = FUNC(uint8_t);
-                break;
-            case 16:
-                self->f = FUNC(uint16_t);
-                break;
-            case 32:
-                self->f = FUNC(uint32_t);
-                break;
-            case 64:
-                self->f = FUNC(uint64_t);
-                break;
-            default:
-                break;
-            }
-            break;
-        case vtdFloat:
-            switch (info->fdesc.desc.intrinsic_bits) {
-            case 32:
-                self->f = FUNC(float);
-                break;
-            case 64:
-                self->f = FUNC(double);
-                break;
-            default:
-                break;
-            }
-            break;
-        default:
-            break;
-        }
-        
-        rslt->self = self;
-        rslt->whack = sraxf_denormalize_free_wrapper;
-        rslt->u.rf = denormal_drvr;
-        rslt->variant = vftRow;
-        
-        return 0;
-    }
-    return RC(rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted);
-}
diff --git a/libs/sraxf/dna-from-color.c b/libs/sraxf/dna-from-color.c
deleted file mode 100644
index 7caee94..0000000
--- a/libs/sraxf/dna-from-color.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/table.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <bitstr.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-static
-void dna_from_color(uint8_t dnabin[], const uint8_t csbin[], size_t n, uint8_t primer, const uint8_t conversion_matrix[]) {
-    uint8_t st;
-    size_t i;
-	
-    switch (primer) {
-    case 'A':
-        st = 0;
-        break;
-    case 'C':
-        st = 1;
-        break;
-    case 'G':
-        st = 2;
-        break;
-    case 'T':
-        st = 3;
-        break;
-    default:
-        st = 4;
-        break;
-    }
-	
-    for (i = 0; i != n && st !=4; ++i) { /*** interrupt translation after the first ambiguity in color space ***/
-        uint8_t tr = csbin[i];
-		
-        st = dnabin[i] = conversion_matrix[st * 5 + tr];
-    }
-    if(i<n) memset(dnabin+i,4,n-i); /*** translation was interrupted - the remainder is ambiguity in base space ***/
-}
-
-static
-rc_t CC dna_from_color_drvr ( void *self, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    uint8_t *dnabin;
-
-    uint32_t i, row_len = argv [ 0 ] . u . data . elem_count;
-    uint32_t out_len, nreads = argv [ 1 ] . u . data . elem_count;
-
-    const uint8_t *csbin = argv [ 0 ] . u . data . base;
-    const uint32_t *read_start = argv [ 1 ] . u . data . base;
-    const uint32_t *read_len = argv [ 2 ] . u . data . base;
-    const uint8_t *cskey = argv [ 3 ] . u . data . base;
-    const uint8_t *cmatrx = argv [ 4 ] . u . data . base;
-    
-    assert(argv[0].u.data.elem_bits == 8);
-    assert(argv[1].u.data.elem_bits == 32);
-    assert(argv[2].u.data.elem_bits == 32);
-    assert(argv[3].u.data.elem_bits == 8);
-    assert(argv[4].u.data.elem_bits == 8);
-
-    assert(argv[2].u.data.elem_count == nreads);
-    assert(argv[3].u.data.elem_count == nreads);
-
-    csbin += argv [ 0 ] . u . data . first_elem;
-    read_start += argv [ 1 ] . u . data . first_elem;
-    read_len += argv [ 2 ] . u . data . first_elem;
-    cskey += argv [ 3 ] . u . data . first_elem;
-    cmatrx += argv [ 4 ] . u . data . first_elem;
-
-    /* safety check that read structure is within bounds */
-    for ( i = out_len = 0; i < nreads; ++i )
-    {
-        if ( read_start [ i ] + read_len [ i ] > row_len )
-            return RC ( rcXF, rcFunction, rcExecuting, rcData, rcInvalid );
-        out_len += read_len [ i ];
-    }
-    
-    /* resize output row for the total number of reads */    
-    rslt -> data -> elem_bits = 8;
-    rc = KDataBufferResize ( rslt -> data, out_len );
-    if ( rc != 0 )
-        return rc;
-
-    /* huh? */
-    rslt -> data -> bit_offset = 0;
-
-    rslt -> elem_count = out_len;
-    dnabin = rslt -> data -> base;
-
-    for ( i = out_len = 0; i < nreads; ++i )
-    {
-        dna_from_color ( & dnabin [ out_len ],
-            & csbin [ read_start [ i ] ], read_len [ i ],
-            cskey [ i ], cmatrx );
-
-        out_len += read_len [ i ];
-    }
-    
-    return 0;
-}
-
-/* 
- * function
- * INSDC:color:bin NCBI:dna_from_color #1 ( INSDC:dna:bin dna_bin,
- *     INSDC:coord:zero read_start, U32 read_len,
- *     INSDC:dna:text cs_key, U8 color_matrix )
- */
-VTRANSFACT_IMPL ( NCBI_dna_from_color, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->u.rf = dna_from_color_drvr;
-    rslt->variant = vftRow;
-    
-    return 0;
-}
diff --git a/libs/sraxf/dynamic-454-read-descriptor.c b/libs/sraxf/dynamic-454-read-descriptor.c
deleted file mode 100644
index 2520eed..0000000
--- a/libs/sraxf/dynamic-454-read-descriptor.c
+++ /dev/null
@@ -1,303 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include <sra/sradb.h>
-#include <vdb/xform.h>
-#include <vdb/table.h>
-#include <kdb/index.h>
-#include <klib/data-buffer.h>
-#include <klib/text.h>
-#include <klib/rc.h>
-#include <search/grep.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-
-/* dynamic_read_desc
- *  uses inputs to determine read type and segmentation
- *
- *  "spot" [ DATA ] - bases for entire spot
- *
- *  "key" [ DATA, CONTROL ] - bases for key sequence. for version 1,
- *  the first base following key is taken as biological start
- *
- *  "linker" [ DATA, CONTROL, OPTIONAL ] - if present, is used to separate
- *  all bases following "key" into mate pair biological reads
- *
- *  returns a trio for each identified read, with read type, start and length
- */
-enum { dyn_read_type, dyn_read_start, dyn_read_len };
-
-typedef uint32_t dynamic_read_desc [ 3 ];
-
-static
-rc_t CC dynamic_read_desc_static ( void *self, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    dynamic_read_desc *p;
-    KDataBuffer *dst = rslt -> data;
-
-    /* severe error if adapter is longer than spot */
-    if ( argv [ 0 ] . u . data . elem_count < argv [ 1 ] . u . data . elem_count )
-        return RC ( rcSRA, rcFunction, rcExecuting, rcData, rcCorrupt );
-
-    /* the buffer should have already been given the correct element size */
-    if ( dst -> elem_bits != 32 * 3 )
-    {
-        rc = KDataBufferCast ( dst, dst, 32 * 3, true );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    /* we always produce 2 reads */
-    if ( dst -> elem_count != 2 )
-    {
-        rc = KDataBufferResize ( dst, 2 );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    p = dst -> base;
-
-    /* adapter */
-    p [ 0 ] [ dyn_read_type ] = SRA_READ_TYPE_TECHNICAL;
-    p [ 0 ] [ dyn_read_start ] = 0;
-    assert(argv [ 1 ] . u . data . elem_count >> 32 == 0);
-    p [ 0 ] [ dyn_read_len ] = (uint32_t)argv [ 1 ] . u . data . elem_count;
-
-    /* fragment */
-    p [ 1 ] [ dyn_read_type ] = SRA_READ_TYPE_BIOLOGICAL;
-    p [ 1 ] [ dyn_read_start ] = p [ 0 ] [ dyn_read_len ];
-    assert(argv [ 0 ] . u . data . elem_count >> 32 == 0);
-    p [ 1 ] [ dyn_read_len ] = (uint32_t)(argv [ 0 ] . u . data . elem_count) - p [ 0 ] [ dyn_read_len ];
-
-    rslt -> elem_count = 2;
-    return 0;
-}
-
-
-/* dynamic_read_desc_with_linker
- */
-typedef struct linker_agrep linker_agrep;
-struct linker_agrep
-{
-    /* I suspect this should be unsigned... */
-    int32_t edit_distance;
-};
-
-int32_t debug_callback(void *cbinfo, AgrepMatch *match, AgrepContinueFlag *cont)
-{
-    printf("Match: pos %d len %d score %d\n", match->position, match->length,
-           match->score);
-    return 0;
-}
-
-
-static
-rc_t CC dynamic_read_desc_with_linker ( void *xself, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    dynamic_read_desc *p;
-    KDataBuffer *dst = rslt -> data;
-    const linker_agrep *self = ( const void* ) xself;
-
-    AgrepMatch match;
-    int32_t found;
-    AgrepFlags agrepflags;
-    Agrep *agrep;
-    /* AgrepCallArgs args; */
-    
-    const char *agreppattern;
-    char buf[4096];
-    const char *text;
-    uint32_t textlen;
-
-    /* severe error if adapter is longer than spot */
-    if ( argv [ 0 ] . u . data . elem_count < argv [ 1 ] . u . data . elem_count )
-        return RC ( rcSRA, rcFunction, rcExecuting, rcData, rcCorrupt );
-
-    /* the buffer should have already been given the correct element size */
-    if ( dst -> elem_bits != 32 * 3 )
-    {
-        rc = KDataBufferCast ( dst, dst, 32 * 3, true );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    /* we always produce 4 reads for when the linker is present */
-    if ( dst -> elem_count != 4 )
-    {
-        rc = KDataBufferResize ( dst, 4 );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    /* TBD - a mechanism for detecting when this has not changed
-       since typically it will be identical for every row in a table
-       but not necessarily so */
-    agreppattern = argv[2].u.data.base;
-    agreppattern += argv[2].u.data.first_elem; 
-    textlen = (uint32_t)string_copy(buf, sizeof buf, agreppattern, argv[2].u.data.elem_count);
-    if ( textlen >= sizeof buf )
-        return RC ( rcSRA, rcFunction, rcExecuting, rcData, rcExcessive );
-
-    text = argv[0].u.data.base;
-    text += argv[0].u.data.first_elem;
-
-    assert(argv[0].u.data.elem_count >> 32 == 0);
-    textlen = (uint32_t)argv[0].u.data.elem_count;
-
-    text += argv[1].u.data.elem_count;
-    textlen -= argv[1].u.data.elem_count;
-
-    agrepflags = AGREP_TEXT_EXPANDED_2NA 
-        | AGREP_PATTERN_4NA
-        | AGREP_EXTEND_BETTER
-        | AGREP_LEFT_MAINTAIN_SCORE
-        | AGREP_ANYTHING_ELSE_IS_N;
-
-    /* This might fail due to size restrictions. */
-    rc = AgrepMake(&agrep, agrepflags | AGREP_ALG_MYERS, buf);
-    if (rc == 0) {
-        /* fprintf(stderr, "Using myers.\n"); */
-    } else {
-        rc = AgrepMake(&agrep, agrepflags | AGREP_ALG_MYERS_UNLTD, buf);
-        /* Try one more time. */
-        if (rc) {
-            rc = AgrepMake(&agrep, agrepflags | AGREP_ALG_DP, buf);
-        }
-        if (rc)
-            return rc;
-    }
-
-    found = AgrepFindBest(agrep, self->edit_distance, text, textlen, &match);
-
-    if (found) {
-
-        p = dst -> base;
-        
-        /* adapter */
-        p [ 0 ] [ dyn_read_type ] = SRA_READ_TYPE_TECHNICAL;
-        p [ 0 ] [ dyn_read_start ] = 0;
-        assert(argv [ 1 ] . u . data . elem_count >> 32 == 0);
-        p [ 0 ] [ dyn_read_len ] = (uint32_t)argv [ 1 ] . u . data . elem_count;
-        
-        /* fragment */
-        p [ 1 ] [ dyn_read_type ] = SRA_READ_TYPE_BIOLOGICAL;
-        p [ 1 ] [ dyn_read_start ] = (uint32_t)argv [ 1 ] . u . data . elem_count;
-        p [ 1 ] [ dyn_read_len ] = match.position;
-
-        /* linker */
-        p [ 2 ] [ dyn_read_type ] = SRA_READ_TYPE_TECHNICAL;
-        p [ 2 ] [ dyn_read_start ] = match.position + (uint32_t)argv[1].u.data.elem_count;
-        p [ 2 ] [ dyn_read_len ] = match.length;
-        
-        /* fragment */
-        p [ 3 ] [ dyn_read_type ] = SRA_READ_TYPE_BIOLOGICAL;
-        p [ 3 ] [ dyn_read_start ] = match.position + match.length + (uint32_t)argv[1].u.data.elem_count;
-        p [ 3 ] [ dyn_read_len ] = (uint32_t)argv [ 0 ] . u . data . elem_count - match.position - match.length - (uint32_t)argv[1].u.data.elem_count;
-        
-        rslt -> elem_count = 4;
-
-    } else {
-
-        
-        p = dst -> base;
-        
-        /* adapter */
-        p [ 0 ] [ dyn_read_type ] = SRA_READ_TYPE_TECHNICAL;
-        p [ 0 ] [ dyn_read_start ] = 0;
-        assert(argv [ 1 ] . u . data . elem_count >> 32 == 0);
-        p [ 0 ] [ dyn_read_len ] = (uint32_t)argv [ 1 ] . u . data . elem_count;
-        
-        /* fragment */
-        p [ 1 ] [ dyn_read_type ] = SRA_READ_TYPE_BIOLOGICAL;
-        p [ 1 ] [ dyn_read_start ] = (uint32_t)argv [ 1 ] . u . data . elem_count;
-        p [ 1 ] [ dyn_read_len ] = (uint32_t)argv [ 0 ] . u . data . elem_count - (uint32_t)argv [ 1 ] . u . data . elem_count;
-
-        /* linker */
-        p [ 2 ] [ dyn_read_type ] = SRA_READ_TYPE_TECHNICAL;
-        p [ 2 ] [ dyn_read_start ] = (uint32_t)argv [ 0 ] . u . data . elem_count;
-        p [ 2 ] [ dyn_read_len ] = 0;
-        
-        /* fragment */
-        p [ 3 ] [ dyn_read_type ] = SRA_READ_TYPE_BIOLOGICAL;
-        p [ 3 ] [ dyn_read_start ] = (uint32_t)argv [ 0 ] . u . data . elem_count;
-        p [ 3 ] [ dyn_read_len ] = 0;
-
-        rslt -> elem_count = 4;
-
-    }
-
-    AgrepWhack(agrep);
-
-    return 0;
-}
-
-static
-void CC dyn_454_read_desc_free_wrapper( void *ptr )
-{
-	free( ptr );
-}
-
-/*
- extern function U32 [ 3 ] NCBI:SRA:_454_:dynamic_read_desc #1 < * U32 edit_distance >
-    ( NCBI:SRA:_454_:drdparam_set spot, NCBI:SRA:_454_:drdparam_set key * NCBI:SRA:_454_:drdparam_set linker );
- */
-VTRANSFACT_IMPL ( NCBI_SRA__454__dynamic_read_desc, 1, 0, 0 ) ( const void *self,
-    const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    linker_agrep *xself;
-
-    if ( dp -> argc == 2 )
-    {
-        rslt -> u . ndf = dynamic_read_desc_static;
-        rslt -> variant = vftNonDetRow;
-        return 0;
-    }
-
-    xself = malloc ( sizeof * xself );
-    if ( xself == NULL )
-        return RC ( rcSRA, rcFunction, rcConstructing, rcMemory, rcExhausted );
-
-    /* NB - this should be changed to unsigned */
-    xself -> edit_distance = 5;
-    if ( cp -> argc == 1 )
-        xself -> edit_distance = cp -> argv [ 0 ] . data . i32 [ 0 ];
-
-    rslt -> self = xself;
-    rslt -> whack = dyn_454_read_desc_free_wrapper;
-    rslt -> u . rf = dynamic_read_desc_with_linker;
-    rslt -> variant = vftRow;
-    return 0;
-}
diff --git a/libs/sraxf/extract-coordinates.c b/libs/sraxf/extract-coordinates.c
deleted file mode 100644
index 9dd71e8..0000000
--- a/libs/sraxf/extract-coordinates.c
+++ /dev/null
@@ -1,353 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include <sra/sradb.h>
-#include <vdb/xform.h>
-#include <klib/data-buffer.h>
-#include <klib/text.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-
-#define SLX_COORD_LEN 10
-
-static
-int non_braindead_atoi ( const char *start, const char *end )
-{
-    int val = start [ 0 ] - '0';
-    uint32_t i, count = (uint32_t)( end - start );
-    for ( i = 1; i < count; ++ i )
-    {
-        val *= 10;
-        val += start [ i ] - '0';
-    }
-    return val;
-}
-
-static
-int scan_hex ( const char *str, int count )
-{
-    int i, val = str [ 0 ] - '0';
-    if ( val > 9 )
-        val = toupper ( str [ 0 ] ) - 'A' + 10;
-    for ( i = 1; i < count; ++ i )
-    {
-        int d = str [ i ] - '0';
-        if ( d > 9 )
-            d = toupper ( str [ i ] ) - 'A' + 10;
-        val = val << 4 | d;
-    }
-    return val;
-}
-
-static
-void common_extract_coordinates ( const char *skey, uint32_t slen, uint32_t coords [ 4 ] )
-{
-    unsigned int a, b, c, d;
-    uint32_t i, j, count = slen;
-
-    /* scan hex digits */
-    for ( i = count; i > 0; )
-    {
-        if ( ! isxdigit ( skey [ -- i ] ) )
-            break;
-    }
-
-    /* detect newer format */
-    if ( count - i < ( SLX_COORD_LEN - 1 ) )
-    {
-        const char *end = skey + count;
-
-        /* new format */
-        for ( d = 0, j = 0, i = count; i > 0; )
-        {
-            if ( ! isdigit ( skey [ -- i ] ) )
-            {
-                j = i + 1;
-                break;
-            }
-        }
-        d = non_braindead_atoi ( & skey [ j ], end );
-        for ( c = 0, j = 0; i > 0; )
-        {
-            if ( ! isdigit ( skey [ -- i ] ) )
-            {
-                j = i + 1;
-                break;
-            }
-        }
-        c = atoi ( & skey [ j ] );
-        for ( b = 0, j = 0; i > 0; )
-        {
-            if ( ! isdigit ( skey [ -- i ] ) )
-            {
-                j = i + 1;
-                break;
-            }
-        }
-        b = atoi ( & skey [ j ] );
-        for ( a = 0, j = 0; i > 0; )
-        {
-            if ( ! isdigit ( skey [ -- i ] ) )
-            {
-                j = i + 1;
-                break;
-            }
-        }
-        a = atoi ( & skey [ j ] );
-        if ( j > 0 )
-        {
-            if ( i > 0 )
-                -- i;
-            while ( isalpha ( skey [ i ] ) )
-                ++ i;
-        }
-    }
-    else
-    {
-        /* original format */
-        a = scan_hex ( skey, 1 );
-        b = scan_hex ( & skey [ 1 ], 3 );
-        c = scan_hex ( & skey [ 4 ], 3 );
-        d = scan_hex ( & skey [ 7 ], 3 );
-        if ( count > SLX_COORD_LEN )
-        {
-            i = count - SLX_COORD_LEN;
-        }
-    }
-
-    coords [ 3 ] = a;
-    coords [ 2 ] = b;
-    coords [ 1 ] = c;
-    coords [ 0 ] = d;
-}
-
-static
-rc_t CC illumina_extract_coordinates ( void *self, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    uint32_t *out;
-    KDataBuffer *dst = rslt -> data;
-
-    uint32_t coords [ 4 ];
-
-    const char *skey = argv [ 0 ] . u . data . base;
-    uint32_t i, count = argv [ 0 ] . u . data . elem_count;
-    skey += argv [ 0 ] . u . data . first_elem;
-
-    common_extract_coordinates ( skey, count, coords );
-
-    /* count the number of output coordinates */
-    count = ( uint32_t ) ( size_t ) self;
-
-    /* produce however many elements are requested */
-    dst -> elem_bits = 32 * count;
-    rc = KDataBufferResize ( dst, 1 );
-    if ( rc != 0 )
-        return rc;
-
-    out = dst -> base;
-    switch ( count )
-    {
-    default:
-        for ( i = 4; i < count; ++ i )
-            out [ i ] = 0;
-    case 4:
-        out [ 3 ] = coords [ 3 ];
-    case 3:
-        out [ 2 ] = coords [ 2 ];
-    case 2:
-        out [ 1 ] = coords [ 1 ];
-    case 1:
-        out [ 0 ] = coords [ 0 ];
-    case 0:
-        break;
-    }
-
-    rslt -> elem_count = 1;
-
-    return 0;
-}
-
-static
-rc_t CC abi_extract_coordinates ( void *self, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    uint32_t *out;
-    KDataBuffer *dst = rslt -> data;
-
-    uint32_t coords [ 4 ];
-
-    const char *skey = argv [ 0 ] . u . data . base;
-    uint32_t i, count = argv [ 0 ] . u . data . elem_count;
-    skey += argv [ 0 ] . u . data . first_elem;
-
-    common_extract_coordinates ( skey, count, coords );
-
-    /* count the number of output coordinates */
-    count = ( uint32_t ) ( size_t ) self;
-
-    /* produce however many elements are requested */
-    dst -> elem_bits = 32 * count;
-    rc = KDataBufferResize ( dst, 1 );
-    if ( rc != 0 )
-        return rc;
-
-    out = dst -> base;
-    switch ( count )
-    {
-    default:
-        for ( i = 3; i < count; ++ i )
-            out [ i ] = 0;
-    case 3:
-        out [ 2 ] = coords [ 2 ];
-    case 2:
-        out [ 1 ] = coords [ 1 ];
-    case 1:
-        out [ 0 ] = coords [ 0 ];
-    case 0:
-        break;
-    }
-
-    rslt -> elem_count = 1;
-
-    return 0;
-}
-
-static
-rc_t CC _454_extract_coordinates ( void *self, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    uint32_t *out;
-    unsigned int a, b, c;
-    KDataBuffer *dst = rslt -> data;
-
-    const char *skey = argv [ 0 ] . u . data . base;
-    uint32_t i, count = argv [ 0 ] . u . data . elem_count;
-    skey += argv [ 0 ] . u . data . first_elem;
-
-    /* advance skey to coordinates */
-    if ( count < 7 )
-        return RC ( rcSRA, rcName, rcParsing, rcString, rcInsufficient );
-    skey += count - 7;
-
-    /* get region */
-    if ( ! isdigit ( skey [ 0 ] ) || ! isdigit ( skey [ 1 ] ) )
-        return RC ( rcSRA, rcName, rcParsing, rcString, rcCorrupt );
-    a = ( skey [ 0 ] - '0' ) * 10 + ( skey [ 1 ] - '0' );
-
-    /* get 'Q' - base-36 encoded x/y */
-    for ( c = 0, i = 2; i < 7; ++ i )
-    {
-        c *= 36;
-        if ( isdigit ( skey [ i ] ) )
-            c += skey [ i ] - '0' + 26;
-        else if ( ! isalpha ( skey [ i ] ) )
-            return RC ( rcSRA, rcName, rcParsing, rcString, rcCorrupt );
-        else
-        {
-            /* yes, the alphabetic symbols come BEFORE the numeric */
-            c += toupper ( skey [ i ] ) - 'A';
-        }
-    }
-
-    /* convert 'Q' to x and y */
-    b = c >> 12;
-    c &= 0xFFF;
-
-    /* count the number of output coordinates */
-    count = ( uint32_t ) ( size_t ) self;
-
-    /* produce however many elements are requested */
-    dst -> elem_bits = 32 * count;
-    rc = KDataBufferResize ( dst, 1 );
-    if ( rc != 0 )
-        return rc;
-
-    out = dst -> base;
-    switch ( count )
-    {
-    default:
-        for ( i = 3; i < count; ++ i )
-            out [ i ] = 0;
-    case 3:
-        out [ 2 ] = a;
-    case 2:
-        out [ 1 ] = b;
-    case 1:
-        out [ 0 ] = c;
-    case 0:
-        break;
-    }
-
-    rslt -> elem_count = 1;
-
-    return 0;
-}
-
-/* extract coordinates
- *  given a spotname with encoded coordinates
- *  extract them in reverse order into a vector
- *
- *  "platform" [ CONST ] - which platform rules to use
- *
- *  "skey" [ DATA ] - skey string for row
- */
-VTRANSFACT_IMPL ( NCBI_SRA_extract_coordinates, 1, 0, 0 ) ( const void *self,
-    const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    const uint8_t *platform = cp -> argv [ 0 ] . data . u8;
-    switch ( platform [ 0 ] )
-    {
-    case SRA_PLATFORM_454:
-        rslt -> u . rf = _454_extract_coordinates;
-        break;
-    case SRA_PLATFORM_ILLUMINA:
-    case SRA_PLATFORM_HELICOS:
-        rslt -> u . rf = illumina_extract_coordinates;
-        break;
-    case SRA_PLATFORM_ABSOLID:
-        rslt -> u . rf = abi_extract_coordinates;
-        break;
-    default:
-        return RC ( rcSRA, rcFunction, rcConstructing, rcType, rcUnsupported );
-    }
-
-    assert ( info -> fdesc . desc . intrinsic_bits == 32 );
-    rslt -> self = ( void* ) ( size_t ) info -> fdesc . desc . intrinsic_dim;
-    rslt -> variant = vftRow;
-    return 0;
-}
diff --git a/libs/sraxf/extract-name_coord.c b/libs/sraxf/extract-name_coord.c
deleted file mode 100644
index f8058a5..0000000
--- a/libs/sraxf/extract-name_coord.c
+++ /dev/null
@@ -1,242 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include <sra/sradb.h>
-#include <vdb/xform.h>
-#include <klib/data-buffer.h>
-#include <klib/text.h>
-#include <klib/rc.h>
-#include "name-tokenizer.h"
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-
-/* extract_name_coord
- *  generates inputs to .X and .Y and possibly other columns
- *
- *  if no tokens match "coord" constant, produces an empty row
- *  otherwise, produces binary coordinate value
- *  if multiple tokens match criteria, all values must be equivalent
- *  because only a single value will be output per row
- *
- *  "coord" [ CONST ] - either NCBI:SRA:name_token:X or NCBI:SRA:name_token:Y
- *  both of these values also match the token NCBI:SRA:name_token:Q and extract
- *  contents appropriately.
- *
- *  "name" [ DATA ] - raw spot names from NAME column
- *
- *  "tok" [ DATA ] - delimiting tokens produced by sub-table
-function INSDC:coord:zero
-    NCBI:SRA:extract_name_coord #1 < U16 coord > ( ascii name, NCBI:SRA:spot_name_token tok );
-*/
-
-typedef struct self_t {
-    uint16_t coordinate;
-    int position;
-} self_t;
-
-/* return 0...failed, 1...success */
-
-MOD_EXPORT uint32_t CC parse_decimal ( int32_t* base, const char* src, const uint32_t length )
-{
-    /* coordinates are normally unsigned */
-    bool negate = false;
-
-    /* fetch initial character */
-    int32_t val = src [ 0 ];
-
-    /* assume loop starts with following character */
-    uint32_t i = 1;
-
-    /* detect explicit sign */
-    switch ( val )
-    {
-    case '-':
-        negate = true;
-    case '+':
-        val = src [ 1 ];
-        i = 2;
-        break;
-    }
-
-    if ( ! isdigit ( val ) )
-        return 0;
-
-    for ( val -= '0'; i < length; ++ i )
-    {
-        val *= 10;
-        if ( ! isdigit ( src [ i ] ) )
-            return 0;
-        val += src [ i ] - '0';
-    }
-
-    * base = negate ? - val : val;
-
-    return 1;
-}
-
-MOD_EXPORT uint32_t CC parse_Q ( uint32_t* base, const char* src,
-    const uint32_t length, const uint16_t what )
-{
-    uint32_t xy, i;
-    
-    if( length != 5 ) {
-        return 0;
-    }
-    for( xy = i = 0; i < length; ++ i )
-    {
-        char n = src[i];
-        xy *= 36;
-        if( isdigit ( n ) )
-        {
-            xy += n - '0' + 26;
-        }
-        else if ( isalpha ( n ) )
-        {
-            xy += toupper ( n ) - 'A';
-        } 
-        else
-        {
-            return 0;
-        }
-    }
-    if ( what == nt_X )
-    {
-        *base = xy >> 12;
-        return 1;
-    }
-    if ( what == nt_Y )
-    {
-        *base = xy & 0xFFF;
-        return 1;
-    }
-
-    return 0;
-}
- 
-static
-rc_t CC extract_name_coordinate ( void *Self, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    uint32_t i, j;
-    self_t* self = Self;
-
-    const char *name;
-    const spot_name_token_t* token;
-    uint32_t name_len, num_tokens;
-
-    assert( argc == 2 );
-
-    /* name string */
-    name = argv [ 0 ] . u . data . base;
-    name_len = argv [ 0 ] . u . data . elem_count;
-    name += argv [ 0 ] . u . data . first_elem;
-
-    /* tokens */
-    token = argv [ 1 ] . u . data . base;
-    num_tokens = argv [ 1 ] . u . data . elem_count;
-    token += argv [ 1 ] . u . data . first_elem;
-
-    for ( i = j = 0; i < num_tokens; ++ i )
-    {
-        if ( token [ i ] . s . token_type != self -> coordinate )
-        {
-            if ( token [ i ] . s . token_type != nt_Q )
-                continue;
-            switch ( self -> coordinate )
-            {
-            case nt_X:
-            case nt_Y:
-                break;
-            default:
-                continue;
-            }
-        }
-
-        if ( ++ j == self->position )
-        {
-            /* check bounds */
-            if ( (uint32_t)( token [ i ] . s . position + token [ i ] . s . length ) > name_len )
-                return 0;
-
-            /* convert token */
-            rc = KDataBufferResize( rslt->data, 1 );
-            if ( rc )
-                return rc;
-
-            switch ( token [ i ] . s . token_type )
-            {
-            case nt_X:
-            case nt_Y:
-            case nt_T:
-            case nt_L:
-                rslt->elem_count = parse_decimal ( rslt -> data -> base,
-                    name + token [ i ] . s . position, token [ i ] . s . length );
-                return 0;
-            case nt_Q : rslt->elem_count = parse_Q ( rslt -> data -> base,
-                    name + token [ i ] . s . position, token [ i ] . s . length,
-                    self -> coordinate );
-                return 0;
-            }
-        }
-    }
-
-    rslt->elem_count = 0;
-    return 0;
-}
-
-static
-void CC sraxf_extract_name_coord_wrapper( void *ptr )
-{
-	free( ptr );
-}
-
-VTRANSFACT_IMPL ( NCBI_SRA_extract_name_coord, 1, 0, 0 ) ( const void *self,
-    const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    self_t* Self;
-
-    assert( cp->argc >= 1 );
-
-    Self = malloc( sizeof( self_t ) );
-    if ( Self == NULL ) return RC( rcSRA, rcFunction, rcConstructing, rcMemory, rcExhausted );
-    Self->coordinate = cp->argv[0].data.u16[0];
-    Self->position = 1;
-    rslt->self = Self;
-    rslt->whack = sraxf_extract_name_coord_wrapper;
-
-    rslt->variant = vftRow;
-    rslt->u.rf = extract_name_coordinate;
-
-    return 0;
-}
diff --git a/libs/sraxf/extract-name_fmt.c b/libs/sraxf/extract-name_fmt.c
deleted file mode 100644
index b32a54a..0000000
--- a/libs/sraxf/extract-name_fmt.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include <sra/sradb.h>
-#include <vdb/xform.h>
-#include <vdb/table.h>
-#include <kdb/index.h>
-#include <klib/data-buffer.h>
-#include <klib/text.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-#include "name-tokenizer.h"
-
-#include <string.h>
-
-/* extract_name_fmt
- *  generates input to .NAME_FMT column and/or updates skey index
- *
- *  on NCBI:SRA:name_token:unrecognized, produces an empty row
- *  otherwise, it creates a temporary "name_fmt" string from name row
- *
- *  an attempt is made to insert name_fmt into indicated text index
- *  ( normally 'skey' ). if the insert succeeds, i.e. associates "name_fmt"
- *  with a row_id, then the output for the row is empty.
- *
- *  if the insert fails due to key duplication, an attempt is made to
- *  extend the id range of associated rows. depending upon the type of index,
- *  this may succeed or fail, e.g. if the existing row range for "name_fmt" is
- *  n..m where m = row_id - 1, the range can be extended to n..row_id and
- *  the update succeeds. if the index supports discontiguous id ranges, the
- *  update will also succeed. upon any success updating the index, the output
- *  row will be empty.
- *
- *  finally, if the temporary "name_fmt" cannot be inserted into the index
- *  nor the existing id range updated, the output for the row will be "name_fmt".
- *
- *  "name" [ DATA ] - raw spot names from NAME column
- *
- *  "tok" [ DATA ] - delimiting tokens produced by sub-table
-function ascii
-    NCBI:SRA:extract_name_fmt #1 < ascii skey > ( ascii name, NCBI:SRA:spot_name_token tok );
- */
-
-static
-rc_t extract_name_fmt_2 (KIndex *ndx, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, const char *name, uint32_t namelen, const spot_name_token_t *tokens, uint32_t N )
-{
-    rc_t rc;
-    bool recognized;
-    uint32_t i, j, toksize, fmtsize, numtok;
-    char sbuf[4096], *name_fmt = sbuf;
-
-    for ( recognized = false, i = j = numtok = toksize = 0; i != N; ++i)
-    {
-        switch (tokens[i].s.token_type)
-        {
-        case nt_unrecognized:
-            /* should be a single token, but in any event we don't care */
-            return 0;
-        case nt_recognized:
-            /* should be a single token, but we'll check below */
-            recognized = true;
-            break;
-	case nt_Q:
-	case nt_X:
-	case nt_Y:
-            /* we should recognize the token */
-            if ( tokens [ i ] . s . token_type >= nt_max_token )
-                return RC ( rcSRA, rcToken, rcPositioning, rcName, rcOutofrange );
-
-            /* enforce serial order of tokens */
-            if ( tokens [ i ] . s . position < j )
-                return RC ( rcSRA, rcToken, rcPositioning, rcName, rcInvalid );
-            j = tokens [ i ] . s . position + tokens [ i ] . s . length;
-
-            /* accumulate total size to be removed */
-            toksize += tokens [ i ] . s . length;
-	    numtok++;
-
-            /* enforce that no token extends beyond end of name */
-            if ( j > namelen )
-                return RC ( rcSRA, rcToken, rcPositioning, rcName, rcOutofrange );
-	    break;
-        default: /*** exclude from computation ***/
-		break;
-        }
-    }
-
-    /* token stream cannot contain BOTH recognized and coordinates */
-    if ( recognized && toksize != 0 )
-        return RC ( rcSRA, rcToken, rcPositioning, rcName, rcInvalid );
-
-    /* token stream must contain at least recognized or a non-empty coordinate */
-    if ( ! recognized && toksize == 0 )
-        return RC ( rcSRA, rcToken, rcPositioning, rcName, rcInvalid );
-
-    /* calculate name_fmt buffer size */
-    fmtsize = ( recognized ? namelen : namelen - toksize + numtok + numtok ) + 1;
-
-    /* if local buffer is insufficient, allocate directly in output KDataBuffer */
-    rslt -> data -> elem_bits = 8;
-    if ( fmtsize > sizeof sbuf )
-    {
-        rc = KDataBufferResize ( rslt -> data, fmtsize );
-        if ( rc != 0 )
-            return rc;
-        name_fmt = rslt -> data -> base;
-    }
-
-    /* create NUL-terminated formatted string */
-    if ( recognized )
-        string_copy ( name_fmt, fmtsize --, name, namelen );
-    else
-    {
-        uint32_t total;
-        for ( i = j = total = 0; i < N; ++i )
-        {
-            switch( tokens[i].s.token_type ) {
-                case nt_Q:
-                case nt_X:
-                case nt_Y:
-                    {{
-                    uint32_t pos = tokens [ i ] . s . position;
-                    toksize = tokens [ i ] . s . length;
-
-                    /* detect unrecognized tokens to left */
-                    if ( pos > j )
-                    {
-                        /* copy them in, NUL-terminating */
-                        total += (uint32_t)string_copy ( & name_fmt [ total ],
-                            fmtsize - total, & name [ j ], pos - j );
-                    }
-
-                    /* move marker along */
-                    j = pos + toksize;
-
-                    /* insert symbol */
-                    name_fmt[total + 0] = '$';
-                    name_fmt[total + 1] = TOK_ALPHABET[tokens[i].s.token_type];
-                    name_fmt[total + 2] = 0;
-                    total += 2;
-                    }}
-                    break;
-                default:
-                    break;
-            }
-        }
-
-        /* detect unrecognized tokens to right */
-        if ( j < namelen )
-        {
-            string_copy ( & name_fmt [ total ],
-                fmtsize - total, & name [ j ], namelen - j );
-        }
-    }
-
-    /* attempt to insert into index */
-    rc = KIndexInsertText ( ndx, false, name_fmt, row_id );
-    if ( rc != 0 )
-    {
-        /* insert failed for whatever reason - return name_fmt */
-        fmtsize = strlen(name_fmt);
-        if ( name_fmt == sbuf )
-        {
-            rc = KDataBufferResize ( rslt -> data, fmtsize );
-            if ( rc != 0 )
-                return rc;
-            memcpy ( rslt -> data -> base, name_fmt, fmtsize );
-        }
-
-        rslt -> elem_count = fmtsize;
-    }
-
-    return 0;
-}
-
-static
-rc_t CC extract_name_fmt( void *self, const VXformInfo *info, int64_t row_id,
-                       VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    const char *name;
-    uint32_t num_tokens, name_len;
-    const spot_name_token_t *tokens;
-
-    tokens = argv [ 1 ] . u . data . base;
-    num_tokens = argv [ 1 ] . u . data . elem_count;
-    tokens += argv [ 1 ] . u . data . first_elem;
-
-    rslt -> elem_count = 0;
-    if ( num_tokens == 0 )
-        return 0;
-
-    name = argv [ 0 ] . u . data . base;
-    name_len = argv [ 0 ] . u . data . elem_count;
-    name += argv [ 0 ] . u . data . first_elem;
-
-    return extract_name_fmt_2(self, info, row_id, rslt,
-        name, name_len, tokens, num_tokens);
-}    
-
-VTRANSFACT_IMPL ( NCBI_SRA_extract_name_fmt, 1, 0, 0 ) ( const void *self,
-    const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rc_t rc;
-    KIndex *ndx;
-    
-    rc = VTableCreateIndex ( ( VTable* ) info -> tbl, &ndx, kitText | kitProj, kcmOpen,
-                             "%.*s", cp->argv[0].count, cp->argv[0].data.ascii );
-    if( rc == 0 ) {
-        rslt->self = ndx;
-        rslt->whack = ( void ( CC * ) ( void* ) ) KIndexRelease;
-        rslt->variant = vftNonDetRow;
-        rslt->u.ndf = extract_name_fmt;
-    }    
-    return rc;
-}
diff --git a/libs/sraxf/extract-spot_name.c b/libs/sraxf/extract-spot_name.c
deleted file mode 100644
index 9e53524..0000000
--- a/libs/sraxf/extract-spot_name.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include <sra/sradb.h>
-#include <vdb/xform.h>
-#include <klib/data-buffer.h>
-#include <klib/text.h>
-#include <klib/rc.h>
-#include "name-tokenizer.h"
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-
-/* extract_spot_name
- *  generates input to .SPOT_NAME column
- *
- *  on NCBI:SRA:name_token:unrecognized, produces the entire spot name row
- *  otherwise, produces an empty row
- *
- *  "name" [ DATA ] - raw spot names from NAME column
- *
- *  "tok" [ DATA ] - delimiting tokens produced by sub-table
-function ascii
-    NCBI:SRA:extract_spot_name #1 ( ascii name, NCBI:SRA:spot_name_token tok );
- */
-
-#define NAM 0
-#define TOK 1
-
-static
-rc_t CC extract_spot_name ( void *self, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    uint32_t i;
-    bool name_copy;
-
-    const spot_name_token_t *token = argv [ TOK ] . u . data . base;
-    uint32_t num_tokens = argv [ TOK ] . u . data . elem_count;
-    token += argv [ TOK ] . u . data . first_elem;
-
-    for ( name_copy = false, i = 0; i < num_tokens; ++ i )
-    {
-        if ( token [ i ] . s . token_type == nt_unrecognized )
-        {
-            name_copy = true;
-            break;
-        }
-    }
-
-    rslt -> elem_count = 0;
-    rslt -> data -> elem_bits = 8;
-
-    if ( name_copy || num_tokens == 0 )
-    {
-        const char *name = argv [ NAM ] . u . data . base;
-        uint32_t name_len = argv [ NAM ] . u . data . elem_count;
-
-        rc_t rc = KDataBufferResize ( rslt -> data, name_len );
-        if ( rc != 0 )
-            return rc;
-
-        memcpy ( rslt -> data -> base, name += argv [ NAM ] . u . data . first_elem, name_len );
-        rslt -> elem_count = name_len;
-    }
-
-    return 0;
-}
-
-VTRANSFACT_IMPL ( NCBI_SRA_extract_spot_name, 1, 0, 0 ) ( const void *self,
-    const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->variant = vftRow;
-    rslt->u.rf = extract_spot_name;
-    
-    return 0;
-}
diff --git a/libs/sraxf/fix_read_seg_impl.h b/libs/sraxf/fix_read_seg_impl.h
deleted file mode 100644
index 977485f..0000000
--- a/libs/sraxf/fix_read_seg_impl.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-/* READ_SEG was engineered to be capable of holding
-   any sort of read description, including out-of-order,
-   non-contiguous, gapped or overlapped segments.
-
-   This property was never used, and READ_SEG is by now
-   obsolete, so we can count on it being used as a sort
-   of READ_LEN where the starts represent an integration
-   of the lengths, i.e. all segments are in order and
-   contiguous. */
-#define READ_SEGS_ALWAYS_CONTIGUOUS 1
-
-static void fix_read_seg_impl(const uint16_t *rs_src, uint32_t nreads,
-    uint32_t spot_len, uint32_t * rs_dst)
-{
-    const uint32_t nreads2 = nreads + nreads;
-        uint32_t i, total;
-
-        assert(rs_src && rs_dst);
-
-#if READ_SEGS_ALWAYS_CONTIGUOUS
-        /* first, check the stated bases within the read-seg */
-        for ( i = 1, total = 0; i < nreads2; i += 2 )
-            total += rs_src [ i ];
-
-        /* if there are no bases reported, just divide the
-           spot_len by the number of reads and rewrite */
-        if ( total == 0 )
-        {
-            /* if there is a single read, fix it */
-            if ( nreads == 1 )
-            {
-                rs_dst [ 0 ] = 0;
-                rs_dst [ 1 ] = spot_len;
-            }
-            else
-            {
-                double fstart = 0;
-                double flen = ( double ) spot_len / nreads;
-                for ( i = total = 0; i < nreads2; fstart += flen, i += 2 )
-                {
-                    long int start = lround ( fstart );
-                    long int end = lround ( fstart + flen );
-                    if ( start >= ( long int ) spot_len )
-                    {
-                        rs_dst [ i ] = spot_len;
-                        rs_dst [ i + 1 ] = 0;
-                    }
-                    else
-                    {
-                        if ( end > ( long int ) spot_len )
-                            end = ( long int ) spot_len - start;
-                        else
-                            end -= start;
-
-                        rs_dst [ i ] = ( uint32_t ) start;
-                        rs_dst [ i + 1 ] = ( uint32_t ) end;
-                    }
-
-                    total += rs_dst [ i + 1 ];
-                }
-
-                assert ( total == spot_len );
-            }
-        }
-
-        /* have the right number of bases - just rewrite starts */
-        else if ( total == spot_len )
-        {
-            for ( i = total = 0; i < nreads2; i += 2 )
-            {
-                rs_dst [ i ] = total;
-                total += ( rs_dst [ i + 1 ] = rs_src [ i + 1 ] );
-            }
-        }
-
-        /* have too many bases - trust all up to limit */
-        else if ( total > spot_len )
-        {
-            for ( i = total = 0; i < nreads2; i += 2 )
-            {
-                rs_dst [ i ] = total;
-                total += ( rs_dst [ i + 1 ] = rs_src [ i + 1 ] );
-                if ( total > spot_len )
-                {
-                    total = spot_len;
-                    rs_dst [ i + 1 ] = total - rs_dst [ i ];
-                }
-            }
-        }
-
-        /* too few bases - trust all but last */
-        else
-        {
-            for ( i = 0; i < nreads2; i += 2 )
-                rs_dst [ i + 1 ] = rs_src [ i + 1 ];
-
-            for ( ; total < spot_len && i != 0; )
-            {
-                uint32_t remaining = spot_len - total;
-                i -= 2;
-                rs_dst [ i + 1 ] += remaining;
-                total += remaining;
-            }
-
-            for ( i = 0, total = 0; i < nreads2; i += 2 )
-            {
-                rs_dst [ i ] = total;
-                total += rs_dst [ i + 1 ];
-            }
-        }
-#else
-        /* loop increments by 2
-           where the read start is even, read length odd */
-        for ( i = total = 0; i < nreads2; i += 2 )
-        {
-            /* is start greater than max? */
-            if ( rs_src [ i ] >= spot_len )
-            {
-                /* clip start to end */
-                rs_dst [ i ] = spot_len;
-                /* zero length read */
-                rs_dst [ i + 1 ] = 0;
-            }
-            /* is end greater than max? */
-            else if ( rs_src [ i ] + rs_src [ i + 1 ] > spot_len )
-            {
-                /* keep start */
-                rs_dst [ i ] = rs_src [ i ];
-                /* clip length to end */
-                rs_dst [ i + 1 ] = spot_len - rs_src [ i ];
-            }
-            else
-            {
-                /* copy existing segment */
-                rs_dst [ i ]   = rs_src [ i ];
-                rs_dst [ i + 1 ] = rs_src [ i + 1 ];
-            }
-
-            /* sum total length */
-            total += rs_src [ i + 1 ];
-        }
-#endif
-}
diff --git a/libs/sraxf/format-spot-name.c b/libs/sraxf/format-spot-name.c
deleted file mode 100644
index 9859ed5..0000000
--- a/libs/sraxf/format-spot-name.c
+++ /dev/null
@@ -1,332 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include <vdb/xform.h>
-#include <klib/data-buffer.h>
-#include <klib/text.h>
-#include <klib/printf.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-#include "name-tokenizer.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-#include <ctype.h>
-
-/* format_spot_name ( ascii name_fmt, I32 X, I32 Y * ascii spot_name );
- *  given a name format string, X, and Y
- *  produce a reconstructed spot name string
- *
- *  "name_fmt" [ DATA ] - name format string ( see format explanation below )
- *
- *  "X" [ DATA ] - X coordinate for spot
- *
- *  "Y" [ DATA ] - Y coordinate for spot
- *
- *  "spot_name" [ DATA, OPTIONAL ] - potential source of unformatted names
- *
- * SYNOPSIS:
- *  "name_fmt" may have any ASCII characters
- *  the special character '$' is an escape symbol
- *  when followed by a recognized format character,
- *  both the '$' and its format character will be
- *  replaced with a numeral generated from X and/or Y.
- *
- *  when "spot_name" is present and the "name_fmt" row is empty,
- *  output is taken verbatim from "spot_name"
- *
- * FORMAT:
- *  'X' ( or 'x' ) = substitute with a decimal representation for X
- *  'Y' ( or 'y' ) = substitute with a decimal representation for Y
- *  'Q' ( or 'q' ) = calculate 454-style base-36 representation
- *                   for both X and Y
- */
-static
-rc_t CC format_spot_name ( void *self,
-    const VXformInfo *info, int64_t row_id, VRowResult *rslt,
-    uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    char *name;
-    uint32_t elem_count;
-    KDataBuffer *dst = rslt -> data;
-
-    if ( dst -> elem_bits != 8 )
-    {
-        rc = KDataBufferCast ( dst, dst, 8, true );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    /* check for NAME_FMT */
-    if ( argv [ 0 ] . u. data . elem_count != 0 )
-    {
-        size_t num_writ;
-        char sname[1024]; /** name on stack **/
-        const char *name_fmt = ((char*)argv[0].u.data.base) + argv[0].u.data.first_elem;
-        uint32_t i, j, x, y;
-        const uint32_t fmt_size = argv [ 0 ] . u . data . elem_count;
-
-        /* the coordinates to substitute */
-        x = ( ( const int32_t* ) argv [ 1 ] . u . data . base )
-            [ argv [ 1 ] . u . data . first_elem ];
-        y = ( ( const int32_t* ) argv [ 2 ] . u . data . base )
-            [ argv [ 2 ] . u . data . first_elem ];
-
-        for ( i=j=0; i < fmt_size -1;){
-            if( name_fmt [ i ] == '$' ){
-                switch( name_fmt [ i+1 ]){
-                case 'x': case 'X':
-                    if( j > sizeof(sname) - 11){
-    					return RC ( rcXF, rcFunction, rcDecoding, rcBuffer, rcInsufficient );
-                    } else {
-                        i+=2;
-                        if( i < fmt_size -1 && name_fmt [ i ] == '%' && isdigit(name_fmt [ i+1 ])) {
-                            x += 24*1024*(name_fmt [ i+1 ]-'0');
-                            i+=2;
-                        }
-                        j+=sprintf(sname+j,"%d",x);
-                    }
-                    break;
-                case 'y': case 'Y':
-                    if( j > sizeof(sname) - 11){
-    					return RC ( rcXF, rcFunction, rcDecoding, rcBuffer, rcInsufficient );
-                    } else {
-                        i+=2;
-                        if( i < fmt_size -1 && name_fmt [ i ] == '%' && isdigit(name_fmt [ i+1 ])) {
-                            y += 24*1024*(name_fmt [ i+1 ]-'0');
-                            i+=2;
-                        }
-                        j+=sprintf(sname+j,"%d",y);
-                    }
-                    break;
-                case 'q': case 'Q':
-                    if( j > sizeof(sname) - 5) {
-    					return RC ( rcXF, rcFunction, rcDecoding, rcBuffer, rcInsufficient );
-                    } else if( y > 0xFFF) {
-                        return RC ( rcXF, rcFunction, rcDecoding, rcRange, rcTooBig);
-                    } else {
-                        uint32_t q= x << 12 | y;
-                        sname[j+4]=Q_ALPHABET[q % 36]; q /= 36;
-                        sname[j+3]=Q_ALPHABET[q % 36]; q /= 36;
-                        sname[j+2]=Q_ALPHABET[q % 36]; q /= 36;
-                        sname[j+1]=Q_ALPHABET[q % 36]; q /= 36;
-                        sname[j]  =Q_ALPHABET[q];
-                        j+=5;
-                        i+=2;
-                    }
-                    break;
-		 case 'r': case 'R':
-            rc = string_printf ( & sname [ j ], sizeof sname - j, & num_writ, "%ld", row_id );
-            assert ( rc == 0 );
-            j += ( uint32_t ) num_writ;
-		    i+=2;
-		    break;
-                default:
-                    sname[j++]=name_fmt[i++];
-                    break;
-                }
-            } else {
-                if(j < sizeof(sname)){
-                    sname[j++]=name_fmt[i++];
-                } else {
-                    return RC ( rcXF, rcFunction, rcDecoding, rcBuffer, rcInsufficient );
-                }
-            }
-            if( j > sizeof(sname)-1){	
-                return RC ( rcXF, rcFunction, rcDecoding, rcBuffer, rcInsufficient );
-            }
-        }
-        if(i==fmt_size -1) {
-            if(j < sizeof(sname)){
-                sname[j++]=name_fmt[i++];
-            } else {
-                return RC ( rcXF, rcFunction, rcDecoding, rcBuffer, rcInsufficient );
-            }
-        }
-        
-        /* j is our new element count **/
-        elem_count = j;
-
-        /* resize output */
-        if ( dst -> elem_count <= elem_count )
-        {
-            rc = KDataBufferResize ( dst, elem_count);
-            if ( rc != 0 )
-                return rc;
-        }
-        
-        /* the output name */
-        name = dst -> base;
-        
-        memcpy ( name, sname, elem_count );
-        rslt -> elem_count = elem_count;
-        return 0;
-    }
-
-    /* check for NAME */
-    if( argc == 4 && argv[3].u.data.elem_count != 0 ) {
-        const char *sname = ((char*)argv[3].u.data.base) + argv[3].u.data.first_elem;
-        /* output size */
-        elem_count = argv[3].u.data.elem_count;
-
-        /* resize output */
-        if( dst -> elem_count <= elem_count ) {
-            rc = KDataBufferResize( dst, elem_count + 1 );
-            if( rc != 0 )
-                return rc;
-        }
-        name = dst->base;
-        memcpy(dst->base, sname, elem_count);
-        rslt->elem_count = elem_count;
-        name[elem_count] = 0;
-        return 0;
-    }
-
-    /* spot has no name */
-    return RC ( rcSRA, rcColumn, rcReading, rcRow, rcNull );
-}
-static
-rc_t CC format_spot_name_no_coord ( void *self,
-    const VXformInfo *info, int64_t row_id, VRowResult *rslt,
-    uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    char *name;
-    uint32_t elem_count;
-    KDataBuffer *dst = rslt -> data;
-
-    if ( dst -> elem_bits != 8 )
-    {
-        rc = KDataBufferCast ( dst, dst, 8, true );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    /* check for NAME_FMT */
-    if ( argv [ 0 ] . u. data . elem_count != 0 )
-    {
-        size_t num_writ;
-        char sname[1024]; /** name on stack **/
-        const char *name_fmt = ((char*)argv[0].u.data.base) + argv[0].u.data.first_elem;
-        uint32_t i, j;
-        const uint32_t fmt_size = argv [ 0 ] . u . data . elem_count;
-
-        for ( i=j=0; i < fmt_size -1;){
-            if( name_fmt [ i ] == '$' ){
-                switch( name_fmt [ i+1 ]){
-		 case 'r': case 'R':
-            rc = string_printf ( & sname [ j ], sizeof sname - j, & num_writ, "%ld", row_id );
-            assert ( rc == 0 );
-		    j += ( uint32_t ) num_writ;
-		    i+=2;
-		    break;
-                default:
-                    sname[j++]=name_fmt[i++];
-                    break;
-                }
-            } else {
-                if(j < sizeof(sname)){
-                    sname[j++]=name_fmt[i++];
-                } else {
-                    return RC ( rcXF, rcFunction, rcDecoding, rcBuffer, rcInsufficient );
-                }
-            }
-            if( j > sizeof(sname)-1){	
-                return RC ( rcXF, rcFunction, rcDecoding, rcBuffer, rcInsufficient );
-            }
-        }
-        if(i==fmt_size -1) {
-            if(j < sizeof(sname)){
-                sname[j++]=name_fmt[i++];
-            } else {
-                return RC ( rcXF, rcFunction, rcDecoding, rcBuffer, rcInsufficient );
-            }
-        }
-        
-        /* j is our new element count **/
-        elem_count = j;
-
-        /* resize output */
-        if ( dst -> elem_count <= elem_count )
-        {
-            rc = KDataBufferResize ( dst, elem_count);
-            if ( rc != 0 )
-                return rc;
-        }
-        
-        /* the output name */
-        name = dst -> base;
-        
-        memcpy ( name, sname, elem_count );
-        rslt -> elem_count = elem_count;
-        return 0;
-    }
-
-    /* check for NAME */
-    if( argc == 2 && argv[1].u.data.elem_count != 0 ) {
-        const char *sname = ((char*)argv[1].u.data.base) + argv[1].u.data.first_elem;
-        /* output size */
-        elem_count = argv[1].u.data.elem_count;
-
-        /* resize output */
-        if( dst -> elem_count <= elem_count ) {
-            rc = KDataBufferResize( dst, elem_count + 1 );
-            if( rc != 0 )
-                return rc;
-        }
-        name = dst->base;
-        memcpy(dst->base, sname, elem_count);
-        rslt->elem_count = elem_count;
-        name[elem_count] = 0;
-        return 0;
-    }
-
-    /* spot has no name */
-    return RC ( rcSRA, rcColumn, rcReading, rcRow, rcNull );
-}
-/*
- * extern function ascii INSDC:SRA:format_spot_name #1 ( ascii name_fmt, I32 X, I32 Y * ascii spot_name );
- */
-VTRANSFACT_IMPL ( INSDC_SRA_format_spot_name, 1, 0, 0 ) ( const void *self,
-    const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt -> u . rf = format_spot_name;
-    rslt -> variant = vftRow;
-    return 0;
-}
-
-
-VTRANSFACT_IMPL ( INSDC_SRA_format_spot_name_no_coord, 1, 0, 0 ) ( const void *self,
-    const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt -> u . rf = format_spot_name_no_coord;
-    rslt -> variant = vftRow;
-    return 0;
-}
-
diff --git a/libs/sraxf/fpcodec.c b/libs/sraxf/fpcodec.c
deleted file mode 100644
index 8cd643a..0000000
--- a/libs/sraxf/fpcodec.c
+++ /dev/null
@@ -1,267 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <vdb/vdb-priv.h>
-#include <klib/data-buffer.h>
-#include <klib/pack.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <endian.h>
-#include <byteswap.h>
-#include <string.h>
-#include <zlib.h>
-#include <assert.h>
-#include <math.h>
-
-static
-rc_t
-hufDecodeBytes_zlib(void *dst, size_t dsize, bitsz_t *psize, const void *src, bitsz_t ssize)
-{
-    int result;
-    rc_t rc;
-	z_stream c_stream; /* decompression stream */
-
-	memset(&c_stream,0,sizeof(c_stream));
-
-	c_stream.next_in   = (Bytef*)src;
-	c_stream.next_out  = (Bytef*)dst;
-	c_stream.avail_in  = (uInt)( ( ssize + 7 ) >> 3 );
-	c_stream.avail_out = (uInt)dsize;
-
-	if (psize)
-        *psize = 0;
-
-    result = inflateInit(&c_stream);
-    switch (result)
-    {
-    case Z_OK:
-            
-        result = inflate ( & c_stream, Z_FINISH );
-        switch (result)
-        {
-        case Z_STREAM_END:
-                
-            result = inflateEnd ( & c_stream );
-            if ( result == Z_OK )
-            {
-                if ( psize != NULL )
-                    * psize = c_stream.total_out << 3;
-                return 0;
-            }
-            return RC ( rcXF, rcFunction, rcDecoding, rcParam, rcInvalid );
-                
-        case Z_OK:
-        case Z_BUF_ERROR:
-            rc = RC (rcXF, rcFunction, rcDecoding, rcBuffer, rcInsufficient );
-            break;
-
-        case Z_NEED_DICT:
-        case Z_DATA_ERROR:
-            rc = RC (rcXF, rcFunction, rcDecoding, rcData, rcCorrupt);
-            break;
-        
-        case Z_MEM_ERROR:
-            rc = RC(rcXF, rcFunction, rcDecoding, rcMemory, rcExhausted);
-            break;
-        
-        case Z_STREAM_ERROR:
-        default:
-            rc = RC (rcXF, rcFunction, rcDecoding, rcNoObj, rcUnexpected);
-            break;
-        }
-
-        inflateEnd ( & c_stream );
-        break;
-            
-    case Z_MEM_ERROR:
-        rc = RC(rcXF, rcFunction, rcDecoding, rcMemory, rcExhausted);
-        break;
-            
-    case Z_VERSION_ERROR:
-    default:
-        rc = RC (rcXF, rcFunction, rcDecoding, rcNoObj, rcUnexpected);
-        break;
-    }
-
-    return rc;
-}
-
-
-typedef struct {
-	uint8_t 	mbits;/* mantissa bits to keep */
-	uint8_t		sign; /* if set then mantissa is signed */
-	uint8_t		version;
-    uint8_t     exp_not_compressed;
-} fp_trunc_key;
-
-typedef struct {
-	uint32_t	count;
-	fp_trunc_key cmn;
-} fp_trunc_key_v0;
-
-typedef struct {
-	uint64_t	count;
-	fp_trunc_key cmn;
-} fp_trunc_key_v1;
-
-static
-rc_t CC fp_extend ( void *self, const VXformInfo *info,
-    VLegacyBlobResult *rslt, const KDataBuffer *in )
-{
-    rc_t rc;
-    bitsz_t bsize;
-    uint64_t i, count;
-    uint32_t count32;
-    size_t tmpsize, psize;
-
-    int32_t *dst;
-    int8_t  *dexp;
-
-    KDataBuffer *out = rslt -> dst;
-    uint32_t keep = ( uint32_t ) ( size_t ) self;
-
-    fp_trunc_key tkey;
-    size_t ssize = KDataBufferBytes ( in );
-    const uint8_t *src = in -> base;
-
-    if(ssize < sizeof(tkey))
-        return RC(rcXF, rcFunction, rcUnpacking, rcData, rcUnexpected);
-    ssize -= sizeof(tkey); 
-    memcpy(&tkey,src+ssize,sizeof(tkey));
-
-    if(tkey.mbits > 24 || tkey.mbits > keep) 
-        return RC(rcXF, rcFunction, rcUnpacking, rcData, rcUnexpected);
-
-    switch ( tkey . version )
-    {
-    case 0:
-        if ( ssize < sizeof count32 )
-            return RC(rcXF, rcFunction, rcUnpacking, rcData, rcUnexpected);
-        ssize -= sizeof count32;
-        memcpy ( & count32, src+ssize, sizeof count32 );
-        count = count32;
-        break;
-    case 1:
-        if ( ssize < sizeof count )
-            return RC(rcXF, rcFunction, rcUnpacking, rcData, rcUnexpected);
-        ssize -= sizeof count;
-        memcpy ( & count, src+ssize, sizeof count );
-        break;
-    default:
-        return RC ( rcXF, rcFunction, rcUnpacking, rcBlob, rcBadVersion );
-    }
-
-    psize = ( ( (size_t)count * tkey.mbits + 7 ) >> 3 );
-    if(psize > ssize)
-        return RC(rcXF, rcFunction, rcUnpacking, rcData, rcUnexpected);
-
-    out -> elem_bits = 32;
-    rc = KDataBufferResize ( out, (uint32_t)count );
-    if ( rc != 0 )
-        return rc;
-
-    dst = out -> base;    
-
-    /* unpack mantissa */
-    rc = Unpack ( tkey.mbits, 32, src, 0, (bitsz_t)( count * tkey.mbits ), 
-		          NULL, dst, KDataBufferBytes ( out ), & tmpsize );
-    if ( rc != 0 )
-        return rc;
-
-    assert ( KDataBufferBytes ( out ) == tmpsize );
-
-    rslt -> byte_order = vboNative;
-    ssize -= psize;
-        
-    dexp = malloc( (size_t)count );
-    if(dexp==NULL)
-        return RC(rcXF, rcFunction, rcUnpacking, rcMemory, rcExhausted);
-
-    if ( tkey.exp_not_compressed )
-        memcpy( dexp, src+psize, (size_t)count );
-    else
-        /*** uncompress the exponent ***/
-        rc = hufDecodeBytes_zlib( dexp, (size_t)count, &bsize, src+psize, ssize << 3 );
-
-    if(rc == 0)
-    {
-        float *fdst;
-
-        /* combine mantissa and exponent */
-        if(tkey.sign==0)
-        {
-            for (fdst=(float*)dst, i = 0; i < count; ++ i )
-                fdst[i]=ldexpf(dst[i],dexp[i]-tkey.mbits);/*** the highest bit is not a sign ***/
-        }
-        else
-        {
-            uint32_t sign_extend= ~((1<<(tkey.mbits-1))-1);
-            for (fdst=(float*)dst, i = 0; i < count; ++ i )
-            {
-                if(dst[i]&sign_extend)
-                {
-                    float m=(float)(int)(dst[i]|sign_extend);
-                    fdst[i]=ldexpf(m,dexp[i]-tkey.mbits+1);
-                }
-                else
-                {
-                    float m=(float)dst[i];
-                    fdst[i]=ldexpf(m,dexp[i]-tkey.mbits+1);
-                }
-            }
-        }
-    }
-
-    free(dexp);
-    
-    return rc;
-}
-
-/* F32 NCBI:fp_extend #1.0 < U32 bits > ( NCBI:fp_encoded_t in );
- */
-VTRANSFACT_IMPL ( NCBI_fp_extend, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    VNoHdrBlobFunc f = fp_extend;
-
-    /* test bit range */
-    uint32_t bits = cp -> argv [ 0 ] . data . u32 [ 0 ];
-    if ( bits < 1 || bits > 23 )
-        return RC ( rcVDB, rcFunction, rcConstructing, rcRange, rcIncorrect );
-
-    /* pass bits to function */
-    rslt -> self = ( void* ) ( size_t ) bits;
-    rslt -> u . bf = ( VBlobFunc ) f;
-    rslt -> variant = vftLegacyBlob;
-
-    return 0;
-}
diff --git a/libs/sraxf/index_lookup.c b/libs/sraxf/index_lookup.c
deleted file mode 100644
index fbafa89..0000000
--- a/libs/sraxf/index_lookup.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-
-#include <vdb/xform.h>
-#include <vdb/table.h>
-#include <vdb/vdb-priv.h>
-#include <kdb/index.h>
-#include <klib/data-buffer.h>
-#include <klib/rc.h>
-#include <klib/text.h>
-#include <klib/pbstree.h>
-#include <klib/log.h>
-#include <sysalloc.h>
-#include <atomic32.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-
-#include <assert.h>
-
-typedef struct tag_self_t {
-    const       KIndex *ndx;
-    char        query_key[1024];
-    uint32_t    query_key_len;
-    uint8_t     name_fmt_version;
-    const struct VCursorParams * parms;
-    uint32_t    elem_bits;
-} self_t;
-
-static void CC self_whack( void *Self )
-{
-    self_t *self = Self;
-    
-    KIndexRelease( self->ndx );
-    free( self );
-}
-
-typedef struct FindFmtDataXtra{
-        int32_t x;
-        int32_t y;
-}FindFmtDataXtra;
-
-static int CC SRAPTNodeFindFmt ( const void *item, const struct PBSTNode *n, void *data )
-{
-    int i,j;
-    FindFmtDataXtra *u=(FindFmtDataXtra *)data;
-    /* compare the remainder of the key */
-    const String *rem = item;
-    const char* q=rem->addr; /** query **/
-    const char* db=n->data.addr; /** database **/
-
-    for(i=j=0;q[i]!=0 && db[j]!= 0;){
-        if(q[i] == db[j]){
-                i++;j++;
-        } else if(db[j] == '$'){
-                switch(db[j+1]){
-		 case 'q':
-                 case 'Q':
-		 {
-			int k;
-			uint32_t xy=0;
-			j+=2;
-			for(k=0;k<5 && q[i]!=0;k++,i++){
-				xy *= 36;
-				if(isdigit(q[i])){
-					xy += q[i] - '0' + 26;
-				} else if(isalpha(q[i])){
-					xy += toupper(q[i]) - 'A';
-				}
-			}
-			if(u){
-				u->x = xy >> 12;
-				u->y = xy &0xFFF;
-			}
-	       		break;
-		 }
-                 case 'x':
-                 case 'X':
-                        if(u) u->x=atoi(q+i);
-                        j+=2;
-                        while(isdigit(q[i]))i++;
-			if(q[i]=='%' && isdigit(q[i+1])){
-				u->x += 24*1024*(q[i+1]-'0');
-				j+=2;
-			}
-                        break;
-                 case 'y':
-                 case 'Y':
-                        if(u) u->y=atoi(q+i);
-                        j+=2;
-                        while(isdigit(q[i]))i++;
-			if(q[i]=='%' && isdigit(q[i+1])){
-				u->y += 24*1024*(q[i+1]-'0');
-				j+=2;
-			}
-                        break;
-                 default:
-                        return  q[i]-db[j];
-                        break;
-                }
-        } else {
-                break;
-        }
-    }
-    return  q[i]-db[j];
-}
-
-
-static
-rc_t CC index_lookup_impl(
-                          void *Self,
-                          const VXformInfo *info,
-                          int64_t row_id,
-                          VRowResult *rslt,
-                          uint32_t argc,
-                          const VRowData argv[]
-                          )
-{
-    rc_t rc;
-    const self_t *self = Self;
-    KDataBuffer *query_buf=NULL;
-    char	query[1024];
-    uint64_t id_count;
-    int64_t start_id;
-    FindFmtDataXtra fxdata={0,0};
-    struct {
-        uint64_t start_id;
-        uint64_t id_count;
-        uint64_t x;
-        uint64_t y;
-    } out;
-    
-    rc = VCursorParamsGet(self->parms,self->query_key,&query_buf);
-    if (GetRCState(rc) == rcNotFound && GetRCObject(rc) == rcName) {
-	rslt->elem_count = 0;
-	rslt->no_cache = 1;
-	return 0;
-    }
-    if(rc == 0){
-        char    *qptr=((char*)query_buf->base)+(query_buf->bit_offset >>3);
-        uint32_t qlen=query_buf->elem_count;
-        
-        if(argc > 0){
-            char *   pptr=((char*)argv[0].u.data.base) + argv[0].u.data.first_elem;
-            uint32_t plen=argv[0].u.data.elem_count;
-            while(plen > 0 &&  qlen > 0 && *pptr == *qptr){
-                pptr++;
-                qptr++;
-                plen--;
-                qlen--;
-            }
-            if(plen > 0) rc = RC ( rcVDB,rcIndex,rcSearching,rcData,rcNotFound);
-        }
-        if( rc == 0){
-            memcpy(query,qptr,qlen);
-            query[query_buf->elem_count]='\0';
-            if( self -> name_fmt_version == 1){ /*** this is a strange slx format name - very first implementation ***/
-                int lane=-1,tile=-1,x=-1,y=-1;
-                qptr=query;
-                if(*qptr == ':'){ qptr++;qlen--;}
-                sscanf(qptr,"%d:%d:%d:%d",&lane,&tile,&x,&y);
-                if(lane < 0 || lane > 0xF || tile < 0 || tile > 0xFFF || x < 0 || x > 0xFFF || y < 0 || y > 0xFFF){
-                    rc = RC ( rcVDB,rcIndex,rcSearching,rcData,rcNotFound);
-                } else {
-                    sprintf(query,"%1X%03X%03X%03X",lane,tile,x,y);
-                }
-            }
-            if(rc == 0 ) {
-                if( self -> name_fmt_version  >= 2) /*** X and Y are present ***/
-                    rc = KIndexFindText(self->ndx, query, &start_id, &id_count,SRAPTNodeFindFmt,&fxdata);
-                else
-                    rc = KIndexFindText(self->ndx, query, &start_id, &id_count,NULL,NULL);
-                if(rc == 0){
-                    KDataBuffer *dst = rslt -> data;
-                    rc = KDataBufferResize ( dst, 1 );
-                    if( rc == 0) {
-                        out.start_id = start_id;
-                        out.id_count = id_count;
-                        out.x        = fxdata.x;
-                        out.y        = fxdata.y;
-                        memcpy(dst -> base,&out,sizeof(out));
-                        rslt -> elem_count = 1;
-                        rslt -> no_cache = 1; /***** This row should never be cached **/
-                    }
-                }
-            }
-        }
-    }
-    return rc;
-}
-
-VTRANSFACT_IMPL(NCBI_SRA_lookup, 1, 0, 0) (
-                                           const void *Self,
-                                           const VXfactInfo *info,
-                                           VFuncDesc *rslt,
-                                           const VFactoryParams *cp,
-                                           const VFunctionParams *dp
-) {
-    rc_t rc;
-    const KIndex *ndx;
-    KIdxType type;
-    
-    rc = VTableOpenIndexRead(info->tbl, &ndx, "%.*s", (int)cp->argv[0].count, cp->argv[0].data.ascii);
-    if ( rc != 0 )
-    {
-        if ( GetRCState ( rc ) != rcNotFound )
-            PLOGERR (klogErr, (klogErr, rc, "Failed to open index '$(index)'", "index=%.*s", (int)cp->argv[0].count, cp->argv[0].data.ascii));
-        return rc;
-    }
-    
-    rc = KIndexType(ndx, &type);
-    if (rc == 0) {
-        if (type == kitProj + kitText) {
-            self_t *self;
-            
-            self = malloc(sizeof(*self));
-            if (self) {
-                self->ndx = ndx;
-                self->elem_bits = VTypedescSizeof(&info->fdesc.desc);
-		memcpy(self->query_key,cp->argv[1].data.ascii,cp->argv[1].count);
-		self->query_key_len = cp->argv[1].count;
-		self->query_key[self->query_key_len]='\0';
-		self->parms=info->parms;
-		self->name_fmt_version = *cp->argv[2].data.u8;
-/*** testing::: VCursorParamsSet(self->parms,"QUERY_BY_NAME" ,"EM7LVYS01C1LWG");***/
-		
-                rslt->self = self;
-                rslt->whack = self_whack;
-                rslt->variant = vftNonDetRow;
-                rslt->u.ndf = index_lookup_impl;
-                return 0;
-            }
-            rc = RC(rcVDB, rcFunction, rcConstructing, rcMemory, rcExhausted);
-        }
-        else
-            rc = RC(rcVDB, rcFunction, rcConstructing, rcIndex, rcIncorrect);
-    }
-    KIndexRelease(ndx);
-    return rc;
-}
diff --git a/libs/sraxf/make-position.c b/libs/sraxf/make-position.c
deleted file mode 100644
index 4159911..0000000
--- a/libs/sraxf/make-position.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include <sra/sradb.h>
-#include <vdb/xform.h>
-#include <klib/data-buffer.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <assert.h>
-
-/* make_position
- *  return a synthesized position row with 1-1 correspondence
- *
- *  "T" [ TYPE ] - position type being generated
- *
- *  "start" [ CONST ] - either 0 or 1, depending upon the coordinate system
- *
- *  "read" [ DATA ] - the actual row of bases. the output row
- *  will be the same length, but with synthesized data
- */
-static
-rc_t CC make_position ( void *self, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt,  uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    KDataBuffer *dst = self;
-
-    if ( argv [ 0 ] . u . data . elem_count > dst -> elem_count )
-    {
-        uint32_t old = dst -> elem_count;
-        rc = KDataBufferResize ( dst, argv [ 0 ] . u . data . elem_count );
-        if ( rc != 0 )
-            return rc;
-        if ( dst -> elem_bits == 16 )
-        {
-            uint16_t i, *p = dst -> base;
-            uint16_t offset = p [ 0 ];
-            for ( i = old; i < dst -> elem_count; ++ i )
-                p [ i ] = i + offset;
-        }
-        else
-        {
-            int32_t i, *p = dst -> base;
-            int32_t offset = p [ 0 ];
-            for ( i = old; i < (int32_t)dst -> elem_count; ++ i )
-                p [ i ] = i + offset;
-        }
-    }
-
-    KDataBufferWhack ( rslt -> data );
-    rc = KDataBufferSub ( dst, rslt -> data, 0, argv [ 0 ] . u . data . elem_count );
-    if ( rc == 0 )
-        rslt -> elem_count = argv [ 0 ] . u . data . elem_count;
-
-    return rc;
-}
-
-static
-void CC whack_data_buffer ( void *data )
-{
-    KDataBufferWhack ( data );
-    free ( data );
-}
-
-VTRANSFACT_IMPL( NCBI_SRA_make_position, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rc_t rc;
-    KDataBuffer *b = malloc ( sizeof * b );
-    if ( b == NULL )
-        return RC ( rcSRA, rcFunction, rcConstructing, rcMemory, rcExhausted );
-
-    rc = KDataBufferMake ( b, info -> fdesc . desc . intrinsic_bits, 4096 );
-    if ( rc != 0 )
-    {
-        free ( b );
-        return rc;
-    }
-
-    if ( info -> fdesc . desc . intrinsic_bits == 16 )
-    {
-        uint16_t i, *dst = b -> base;
-        uint16_t offset = cp -> argv [ 0 ] . data . u16 [ 0 ];
-        for ( i = 0; i < 4096; ++ i )
-            dst [ i ] = i + offset;
-    }
-    else if ( info -> fdesc . desc . intrinsic_bits == 32 )
-    {
-        int32_t i, *dst = b -> base;
-        int32_t offset = cp -> argv [ 0 ] . data . i32 [ 0 ];
-        for ( i = 0; i < 4096; ++ i )
-            dst [ i ] = i + offset;
-    }
-    else
-    {
-        /* this shouldn't really be needed */
-        whack_data_buffer ( b );
-        return RC ( rcSRA, rcFunction, rcConstructing, rcType, rcUnsupported );
-    }
-
-    rslt -> self = b;
-    rslt -> whack = whack_data_buffer;
-    rslt -> u . rf = make_position;
-    rslt -> variant = vftRow;
-
-    return 0;
-}
diff --git a/libs/sraxf/name-tokenizer.h b/libs/sraxf/name-tokenizer.h
deleted file mode 100644
index dcebc27..0000000
--- a/libs/sraxf/name-tokenizer.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_name_tokenizer_
-#define _h_name_tokenizer_
-
-/* spot_name_token_t
- *  represents a single token
- *  the tokenizer should emit a row of zero or more of these
- */
-typedef union spot_name_token_t spot_name_token_t;
-union spot_name_token_t
-{
-    struct
-    {
-        uint16_t token_type;
-        uint16_t position;
-        uint16_t length;
-    } s;
-    uint16_t raw [ 3 ];
-};
-
-/* name_token
- *  token ids
- */
-enum name_token
-{
-    nt_unrecognized = 1,
-    nt_recognized,
-
-    nt_Q,
-
-    nt_X,
-    nt_Y,
-    nt_T,
-    nt_L,
-
-    nt_signed_X,
-    nt_signed_Y,
-    nt_signed_T,
-    nt_signed_L,
-
-    nt_octal_X,
-    nt_octal_Y,
-    nt_octal_T,
-    nt_octal_L,
-
-    nt_hex_upper_X,
-    nt_hex_upper_Y,
-    nt_hex_upper_T,
-    nt_hex_upper_L,
-
-    nt_hex_lower_X,
-    nt_hex_lower_Y,
-    nt_hex_lower_T,
-    nt_hex_lower_L,
-
-    nt_max_token
-};
-
-/* token_symbol
- *  substitution symbols
- */
-#define TOK_ALPHABET ("---QXYTLXYTLabcdefghxytl")
-
-enum token_symbol
-{
-    ts_Q          = 'Q',
-
-    ts_X          = 'X',
-    ts_Y          = 'Y',
-    ts_T          = 'T',
-    ts_L          = 'L',
-
-    ts_signed_X   = 'X',
-    ts_signed_Y   = 'Y',
-    ts_signed_T   = 'T',
-    ts_signed_L   = 'L',
-
-    ts_oct_X      = 'a',
-    ts_oct_Y      = 'b',
-    ts_oct_T      = 'c',
-    ts_oct_L      = 'd',
-
-    ts_hex_upr_X  = 'e',
-    ts_hex_upr_Y  = 'f',
-    ts_hex_upr_T  = 'g',
-    ts_hex_upr_L  = 'h',
-
-    ts_hex_lwr_X  = 'x',
-    ts_hex_lwr_Y  = 'y',
-    ts_hex_lwr_T  = 't',
-    ts_hex_lwr_L  = 'l'
-};
-
-#define Q_ALPHABET ("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
-
-#endif /* _h_name_tokenizer_ */
diff --git a/libs/sraxf/normalize.c b/libs/sraxf/normalize.c
deleted file mode 100644
index 8c40dc1..0000000
--- a/libs/sraxf/normalize.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <sysalloc.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/table.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <bitstr.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-typedef void (*norm_f)(void *dst, const void *src, const void *Cntrl, uint32_t vec_count);
-typedef struct self_t {
-    norm_f f;
-} self_t;
-
-#define NORM_0(A, B) do { \
-                            (A).data[0] = (B).data[0]; \
-                            (A).data[1] = (B).data[1] - (B).data[0]; \
-                            (A).data[2] = (B).data[2]; \
-                            (A).data[3] = (B).data[3]; \
-                        } while (0)
-#define NORM_1(A, B) A = B
-#define NORM_2(A, B) do { \
-                            (A).data[0] = (B).data[0]; \
-                            (A).data[1] = (B).data[1]; \
-                            (A).data[2] = (B).data[2]; \
-                            (A).data[3] = (B).data[3] - (B).data[2]; \
-                        } while (0)
-#define NORM_3(A, B) A = B
-
-#define FUNC(VALTYPE) F_ ## VALTYPE
-
-#define FUNC_DEF(VALTYPE) \
-static void FUNC(VALTYPE)(void *Dst, const void *Src, const void *Cntrl, uint32_t count) { \
-    typedef struct { VALTYPE data[4]; } data4_t; \
-    data4_t *dst = (data4_t *)Dst; \
-    const data4_t *src = (const data4_t *)Src; \
-    const uint8_t *cntrl = (const uint8_t *)Cntrl; \
-    uint32_t i; \
-    \
-    for (i = 0; i != count; ++i) { \
-        switch(cntrl[i]) { \
-        default: \
-        case 0: \
-            NORM_0(dst[i], src[i]); \
-            break; \
-        case 1: \
-            NORM_1(dst[i], src[i]); \
-            break; \
-        case 2: \
-            NORM_2(dst[i], src[i]); \
-            break; \
-        case 3: \
-            NORM_3(dst[i], src[i]); \
-            break; \
-        }\
-    } \
-}
-
-FUNC_DEF(float)
-FUNC_DEF(double)
-FUNC_DEF(uint8_t)
-FUNC_DEF(uint16_t)
-FUNC_DEF(uint32_t)
-FUNC_DEF(uint64_t)
-FUNC_DEF(int8_t)
-FUNC_DEF(int16_t)
-FUNC_DEF(int32_t)
-FUNC_DEF(int64_t)
-
-static
-rc_t CC normal_drvr (
-                void *Self,
-                const VXformInfo *info,
-                int64_t row_id,
-                VRowResult *rslt,
-                uint32_t argc,
-                const VRowData argv []
-) {
-    rc_t rc = 0;
-    const void *src;
-    const void *cntrl;
-    const self_t *self = (const self_t *)Self;
-    
-    assert(argv[0].u.data.elem_bits % 8 == 0);
-    assert(argv[1].u.data.elem_bits % 8 == 0);
-    
-    src   = &((const uint8_t *)argv[0].u.data.base)[(argv[0].u.data.first_elem * argv[0].u.data.elem_bits) / 8];
-    cntrl = &((const uint8_t *)argv[1].u.data.base)[(argv[1].u.data.first_elem * argv[1].u.data.elem_bits) / 8];
-    
-    rslt->elem_bits = rslt->data->elem_bits = argv[0].u.data.elem_bits;
-    rc = KDataBufferResize(rslt->data, argv[0].u.data.elem_count);
-    if (rc)
-        return rc;
-    rslt->elem_count = rslt->data->elem_count;
-    rslt->data->bit_offset = 0;
-    
-    self->f(rslt->data->base, src, cntrl, rslt->elem_count);
-    
-    return 0;
-}
-
-static
-void CC sraxf_normalize_free_wrapper( void *ptr )
-{
-	free( ptr );
-}
-
-/* 
- * function < type T > T [ 4 ] NCBI:SRA:normalize #1 ( T [ 4 ] intensities, U8 called );
- */
-VTRANSFACT_IMPL ( NCBI_SRA_normalize, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    self_t *self;
-    
-    switch (info->fdesc.desc.domain) {
-    case vtdInt:
-    case vtdUint:
-        switch (info->fdesc.desc.intrinsic_bits) {
-        case 8:
-        case 16:
-        case 32:
-        case 64:
-            break;
-        default:
-            return RC(rcXF, rcFunction, rcConstructing, rcType, rcInvalid);
-            break;
-        }
-        break;
-    case vtdFloat:
-        switch (info->fdesc.desc.intrinsic_bits) {
-        case 32:
-        case 64:
-            break;
-        default:
-            return RC(rcXF, rcFunction, rcConstructing, rcType, rcInvalid);
-            break;
-        }
-        break;
-    default:
-        return RC(rcXF, rcFunction, rcConstructing, rcType, rcInvalid);
-        break;
-    }
-    
-    self = malloc(sizeof(*self));
-    if (self) {
-        switch (info->fdesc.desc.domain) {
-        case vtdInt:
-            switch (info->fdesc.desc.intrinsic_bits) {
-            case 8:
-                self->f = FUNC(int8_t);
-                break;
-            case 16:
-                self->f = FUNC(int16_t);
-                break;
-            case 32:
-                self->f = FUNC(int32_t);
-                break;
-            case 64:
-                self->f = FUNC(int64_t);
-                break;
-            default:
-                break;
-            }
-            break;
-        case vtdUint:
-            switch (info->fdesc.desc.intrinsic_bits) {
-            case 8:
-                self->f = FUNC(uint8_t);
-                break;
-            case 16:
-                self->f = FUNC(uint16_t);
-                break;
-            case 32:
-                self->f = FUNC(uint32_t);
-                break;
-            case 64:
-                self->f = FUNC(uint64_t);
-                break;
-            default:
-                break;
-            }
-            break;
-        case vtdFloat:
-            switch (info->fdesc.desc.intrinsic_bits) {
-            case 32:
-                self->f = FUNC(float);
-                break;
-            case 64:
-                self->f = FUNC(double);
-                break;
-            default:
-                break;
-            }
-            break;
-        default:
-            break;
-        }
-        
-        rslt->self = self;
-        rslt->whack = sraxf_normalize_free_wrapper;
-        rslt->u.rf = normal_drvr;
-        rslt->variant = vftRow;
-        
-        return 0;
-    }
-    return RC(rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted);
-}
diff --git a/libs/sraxf/prefix-tree-to-name.c b/libs/sraxf/prefix-tree-to-name.c
deleted file mode 100644
index 06a2e1b..0000000
--- a/libs/sraxf/prefix-tree-to-name.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <sysalloc.h>
-#include <sra/sradb.h>
-#include <vdb/xform.h>
-#include <vdb/table.h>
-#include <kdb/index.h>
-#include <klib/data-buffer.h>
-#include <klib/text.h>
-#include <klib/rc.h>
-
-#include <string.h>
-#include <assert.h>
-
-/* ascii NCBI:SRA:prefix_tree_to_name #1 < ascii idx > ( * ascii name );
- *  use prefix tree index data in reverse lookup
- *  as a substitute for physical NAME column
- *
- *  "idx" [ CONST ] - name of prefix-tree text index
- *
- *  "name" [ DATA, OPTIONAL ] - source of unindexed names
- *  when a reverse lookup on "idx" fails and this input is
- *  present, its row is returned.
- */
-static
-rc_t prefix_tree_to_name ( void *self, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    const KIndex *idx = ( const void* ) self;
-    KDataBuffer *dst = rslt -> data;
-
-    /* the buffer should have already been given the correct element size */
-    if ( dst -> elem_bits != 8 )
-    {
-        rc = KDataBufferCast ( dst, dst, 8, true );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    /* the actual size depends upon whether the buffer is new or was resized very small */
-    if ( dst -> elem_count < 8 )
-    {
-        rc = KDataBufferResize ( dst, 4 * 1024 );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    /* try to get the text with current size */
-    rc = KIndexProjectText ( idx, row_id, NULL, NULL, dst -> base, dst -> elem_count, NULL );
-    if ( GetRCState ( rc ) == rcInsufficient && GetRCObject ( rc ) == rcBuffer )
-    {
-        /* go to 4K buffer - should never fail */
-        rc = KDataBufferResize ( dst, 4 * 1024 );
-        if ( rc == 0 )
-        {
-            rc = KIndexProjectText ( idx, row_id, NULL, NULL, dst -> base, dst -> elem_count, NULL );
-            if ( GetRCState ( rc ) == rcInsufficient && GetRCObject ( rc ) == rcBuffer )
-            {
-                /* go to 16K buffer - this is absurd */
-                rc = KDataBufferResize ( dst, 16 * 1024 );
-                if ( rc == 0 )
-                {
-                    rc = KIndexProjectText ( idx, row_id, NULL, NULL, dst -> base, dst -> elem_count, NULL );
-                    if ( GetRCState ( rc ) == rcInsufficient && GetRCObject ( rc ) == rcBuffer )
-
-                        /* reject this name, it is likely garbage */
-                        rc = RC ( rcSRA, rcIndex, rcProjecting, rcName, rcExcessive );
-                }
-            }
-        }
-    }
-
-    /* test to see if we got the name */
-    if ( rc == 0 )
-    {
-        rslt -> elem_count = (uint32_t)strlen ( ( const char* ) dst -> base );
-        return 0;
-    }
-
-    /* if id was not found, check for alternate input */
-    if ( GetRCState ( rc ) == rcNotFound && argc == 1 && argv [ 0 ] . u . data . elem_count != 0 )
-    {
-        if ( dst -> elem_count < argv [ 0 ] . u . data . elem_count )
-        {
-            rc = KDataBufferResize ( dst, argv [ 0 ] . u . data . elem_count );
-            if ( rc != 0 )
-                return rc;
-        }
-
-        rc = 0;
-
-        string_copy ( dst -> base, dst -> elem_count,
-            argv [ 0 ] . u . data . base, argv [ 0 ] . u . data . elem_count );
-    }
-
-    return rc;
-}
-
-static
-void release_prefix_tree ( void *item )
-{
-    KIndexRelease ( ( const void* ) item );
-}
-
-VTRANSFACT_IMPL( NCBI_SRA_prefix_tree_to_name, 1, 0, 0 ) ( const void *self,
-    const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    /* the first thing to do is to open the prefix tree */
-    const KIndex *idx;
-    rc_t rc = VTableOpenIndexRead ( info -> tbl, & idx, "%.*s",
-        ( int ) cp -> argv [ 0 ] . count, cp -> argv [ 0 ] . data . ascii );
-    if ( rc == 0 )
-    {
-        KIdxType type;
-        rc = KIndexType ( idx, & type );
-        if ( rc == 0 )
-        {
-            if ( type == ( kitText | kitProj ) )
-            {
-                rslt -> self = ( void* ) idx;
-                rslt -> whack = release_prefix_tree;
-                rslt -> u . rf = prefix_tree_to_name;
-                rslt -> variant = vftRow;
-                return 0;
-            }
-
-            rc = RC ( rcSRA, rcFunction, rcConstructing, rcIndex, rcIncorrect );
-        }
-
-        KIndexRelease ( idx );
-    }
-    else {
-        OUTMSG("VTableOpenIndexRead failed: %R", rc);
-    }
-
-    return rc;
-}
diff --git a/libs/sraxf/process-position.c b/libs/sraxf/process-position.c
deleted file mode 100644
index e135ab7..0000000
--- a/libs/sraxf/process-position.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <sysalloc.h>
-#include <sra/sradb.h>
-#include <vdb/xform.h>
-#include <klib/data-buffer.h>
-#include <klib/rc.h>
-
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-static
-void process_position ( uint16_t *dst, const uint16_t *src, uint32_t count )
-{
-    uint32_t i, cur, prev;
-
-    for ( prev = i = 0; i < count; prev = cur, ++ i )
-    {
-        cur = src [ i ];
-        if ( cur > 0x7FFF )
-            cur = ( uint8_t ) cur;
-        while ( prev > cur )
-            cur += 256;
-        dst [ i ] = cur;
-    }
-}
-
-static
-rc_t CC process_position1 ( void *self, const VXformInfo *info,
-    int64_t row_id, const VFixedRowResult *rslt,
-    uint32_t argc, const VRowData argv [] )
-{
-    uint16_t *dst = rslt -> base;
-    const uint16_t *src = argv [ 0 ] . u . data . base;
-    uint32_t count = argv [ 0 ] . u . data . elem_count;
-
-    dst += rslt -> first_elem;
-    src += argv [ 0 ] . u . data . first_elem;
-
-    process_position ( dst, src, count );
-
-    return 0;
-}
-
-static
-rc_t CC process_position2 ( void *self, const VXformInfo *info,
-    int64_t row_id, VRowResult *rslt,
-    uint32_t argc, const VRowData argv [] )
-{
-    /* position row data */
-    const uint16_t *src = argv [ 0 ] . u . data . base;
-    uint32_t count = argv [ 0 ] . u . data . elem_count;
-
-    /* filter row data */
-    const SRAReadFilter *rd_filt = argv [ 1 ] . u . data . base;
-    uint32_t i, nreads = argv [ 1 ] . u . data . elem_count;
-
-    /* output buffer */
-    uint16_t *dst;
-    rc_t rc = KDataBufferCast ( rslt -> data, rslt -> data, 16, true );
-    if ( rc == 0 )
-        rc = KDataBufferResize ( rslt -> data, count );
-    if ( rc != 0 )
-        return rc;
-
-    /* adjust all pointers to start of row */
-    src += argv [ 0 ] . u . data . first_elem;
-    rd_filt += argv [ 1 ] . u . data . first_elem;
-    dst = rslt -> data -> base;
-
-    /* set output size */
-    rslt -> elem_count = count;
-    rslt -> elem_bits = 16;
-
-    /* walk input */
-    for ( i = 0; i < nreads; ++ i )
-    {
-        if ( rd_filt [ i ] == SRA_READ_FILTER_REDACTED )
-        {
-            memset ( dst, 0, count * sizeof * dst );
-            return 0;
-        }
-    }
-
-    process_position ( dst, src, count );
-
-    return 0;
-}
-
-static
-rc_t CC process_position3 ( void *self, const VXformInfo *info,
-    int64_t row_id, VRowResult *rslt,
-    uint32_t argc, const VRowData argv [] )
-{
-    /* position row data */
-    const uint16_t *src = argv [ 0 ] . u . data . base;
-    uint32_t count = argv [ 0 ] . u . data . elem_count;
-
-    /* filter row data */
-    const SRAReadFilter *rd_filt = argv [ 1 ] . u . data . base;
-    uint32_t i, nreads = argv [ 1 ] . u . data . elem_count;
-
-    /* signal row data */
-    const uint16_t *sig = argv [ 2 ] . u . data . base;
-
-    /* output buffer */
-    uint16_t *dst;
-    rc_t rc = KDataBufferCast ( rslt -> data, rslt -> data, 16, true );
-    if ( rc == 0 )
-        rc = KDataBufferResize ( rslt -> data, count );
-    if ( rc != 0 )
-        return rc;
-
-    /* adjust all pointers to start of row */
-    src += argv [ 0 ] . u . data . first_elem;
-    rd_filt += argv [ 1 ] . u . data . first_elem;
-    sig += argv [ 2 ] . u . data . first_elem;
-    dst = rslt -> data -> base;
-
-    /* set output size */
-    rslt -> elem_count = count;
-    rslt -> elem_bits = 16;
-
-    /* walk input */
-    for ( i = 0; i < nreads; ++ i )
-    {
-        if ( rd_filt [ i ] == SRA_READ_FILTER_REDACTED )
-        {
-            uint32_t scount = argv [ 2 ] . u . data . elem_count;
-            for ( i = 0; i < scount; ++ i )
-            {
-                if ( sig [ i ] != 0 )
-                    break;
-            }
-            if ( i == scount )
-            {
-                memset ( dst, 0, count * sizeof * dst );
-                return 0;
-            }
-            break;
-        }
-    }
-
-    process_position ( dst, src, count );
-
-    return 0;
-}
-
-
-/* process_position
- *  convert 8 bit integration into 16 bit
- */
-VTRANSFACT_IMPL ( NCBI_SRA__454__process_position, 1, 0, 0 ) ( const void *fself, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    if ( dp -> argc == 3 )
-    {
-        rslt -> u . rf = process_position3;
-        rslt -> variant = vftRow;
-        return 0;
-    }
-
-    if ( dp -> argc == 2 )
-    {
-        rslt -> u . rf = process_position2;
-        rslt -> variant = vftRow;
-        return 0;
-    }
-
-    rslt -> u . pf = process_position1;
-    rslt -> variant = vftFixedRow;
-    return 0;
-}
diff --git a/libs/sraxf/qual4_codec.h b/libs/sraxf/qual4_codec.h
deleted file mode 100644
index 9d2fd3f..0000000
--- a/libs/sraxf/qual4_codec.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-typedef int8_t qual4[4];
-
-enum code_book {
-	known_bad = 81,
-	known_good,
-	pattern_a_1, /* val, -val, min, min */
-	pattern_a_2, /* val, min, -val, min */
-	pattern_a_3, /* val, min, min, -val */
-	pattern_b_1, /* val, -val + 1, min, min */
-	pattern_b_2, /* val, min, -val + 1, min */
-	pattern_b_3, /* val, min, min, -val + 1 */
-	pattern_c_1, /* val, -val - 1, min, min */
-	pattern_c_2, /* val, min, -val - 1, min */
-	pattern_c_3, /* val, min, min, -val - 1 */
-	cb_last
-};
-
diff --git a/libs/sraxf/qual4_decode.c b/libs/sraxf/qual4_decode.c
deleted file mode 100644
index b2ee301..0000000
--- a/libs/sraxf/qual4_decode.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <vdb/vdb-priv.h>
-#include <klib/data-buffer.h>
-#include "qual4_codec.h"
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <endian.h>
-#include <byteswap.h>
-
-#include <assert.h>
-
-static size_t qual4_decode(
-                           qual4 *dst,
-                           size_t dcount,
-                           const uint8_t *src,
-                           size_t ssize,
-                           const int8_t qmin,
-                           const int8_t qmax
-) {
-	int st;
-	int st2;
-    size_t i;
-    size_t j;
-
-	static const qual4 all_bad = { -5,  -5,  -5,  -5 };
-
-    qual4 is_good;
-    is_good [ 0 ] = qmax;
-    is_good [ 1 ] = qmin;
-    is_good [ 2 ] = qmin;
-    is_good [ 3 ] = qmin;
-	
-	for (st = st2 = 0, j = i = 0; i != ssize && j < dcount; ++i) {
-        int val = src[i] - 40;
-        
-		switch (st) {
-		case 0:
-            if (src[i] < known_bad) {
-                dst[j][0] = val;
-                st = 1;
-            }
-            else if (src[i] == known_bad)
-                memcpy(&dst[j][0], all_bad, 4);
-            else if (src[i] == known_good)
-                memcpy(&dst[j][0], is_good, 4);
-            else {
-                st2 = src[i];
-                st = 4;
-            }
-			break;
-		case 1:
-			dst[j][1] = val;
-			++st;
-			break;
-		case 2:
-			dst[j][2] = val;
-			++st;
-			break;
-		case 3:
-			dst[j][3] = val;
-			st = 0;
-			break;
-        case 4:
-            switch (st2) {
-            case pattern_a_1:
-                dst[j][0] = val;
-				dst[j][1] = -val;
-				dst[j][2] = qmin;
-				dst[j][3] = qmin;
-                break;
-            case pattern_a_2:
-                dst[j][0] = val;
-				dst[j][1] = qmin;
-				dst[j][2] = -val;
-				dst[j][3] = qmin;
-                break;
-            case pattern_a_3:
-                dst[j][0] = val;
-				dst[j][1] = qmin;
-				dst[j][2] = qmin;
-				dst[j][3] = -val;
-                break;
-            case pattern_b_1:
-                dst[j][0] = val;
-				dst[j][1] = -val + 1;
-				dst[j][2] = qmin;
-				dst[j][3] = qmin;
-                break;
-            case pattern_b_2:
-                dst[j][0] = val;
-				dst[j][1] = qmin;
-				dst[j][2] = -val + 1;
-				dst[j][3] = qmin;
-                break;
-            case pattern_b_3:
-                dst[j][0] = val;
-				dst[j][1] = qmin;
-				dst[j][2] = qmin;
-				dst[j][3] = -val + 1;
-                break;
-            case pattern_c_1:
-                dst[j][0] = val;
-				dst[j][1] = -val - 1;
-				dst[j][2] = qmin;
-				dst[j][3] = qmin;
-                break;
-            case pattern_c_2:
-                dst[j][0] = val;
-				dst[j][1] = qmin;
-				dst[j][2] = -val - 1;
-				dst[j][3] = qmin;
-                break;
-            case pattern_c_3:
-                dst[j][0] = val;
-				dst[j][1] = qmin;
-				dst[j][2] = qmin;
-				dst[j][3] = -val - 1;
-                break;
-            default:
-                return 0;
-            }
-            st = 0;
-            break;
-		}
-        if (st == 0)
-            ++j;
-	}
-	return j;
-}
-
-static
-rc_t CC qual4_decode_func(
-                       void *Self,
-                       const VXformInfo *info,
-                       VBlobResult *dst,
-                       const VBlobData *src,
-                       VBlobHeader *hdr
-) {
-    size_t rcount;
-    int qmin = -40;
-    int qmax = 40;
-    
-    if (hdr) {
-        rc_t rc;
-        uint8_t val;
-        
-        rc = VBlobHeaderOpPopHead(hdr, &val);
-        if (rc == 0) {
-            qmin = val - 40;
-            rc = VBlobHeaderOpPopHead(hdr, &val);
-            if (rc == 0) {
-                qmax = val - 40;
-            }
-        }
-    }
-    
-    rcount = qual4_decode( dst->data, dst->elem_count,
-                           src->data, 
-						   ( ( (size_t)src->elem_count * src->elem_bits + 7 ) >> 3 ),
-                           qmin, qmax );
-    
-    if (rcount == dst->elem_count) {
-        dst->byte_order = vboNone;
-        return 0;
-    }
-    return RC(rcSRA, rcFunction, rcExecuting, rcData, rcInvalid);
-}
-
-/*
- * function NCBI:SRA:swapped_qual4 NCBI:SRA:qual4_decode ( NCBI:SRA:encoded_qual4 in );
- */
-VTRANSFACT_IMPL(NCBI_SRA_qual4_decode, 1, 0, 0) (const void *self, const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->variant = vftBlob;
-    rslt->u.bf = qual4_decode_func;
-
-    return 0;
-}
-
-static
-rc_t CC legacy_qual4_decode_func ( void *self, const VXformInfo *info, VLegacyBlobResult *rslt, const KDataBuffer *src )
-{
-    unsigned dbytes = *(uint32_t *)src->base;
-    
-#if __BYTE_ORDER == __BIG_ENDIAN
-    dbytes = bswap_32 (dbytes);
-#endif
-    if ((dbytes & 3) == 0) {
-        rc_t rc;
-        unsigned rcount;
-        
-        rslt->dst->elem_bits = 32;
-        rc = KDataBufferResize(rslt->dst, dbytes >> 2);
-        if (rc)
-            return rc;
-
-        rcount = (unsigned int)qual4_decode( rslt->dst->base, rslt->dst->elem_count,
-                               ( ( const uint8_t * )src->base ) + 4, 
-							   (unsigned int)( KDataBufferBytes( src ) - 4 ),
-                               -40, 40);
-        if (rcount == rslt->dst->elem_count) {
-            rslt->byte_order = vboNone;
-            return 0;
-        }
-    }
-    return RC(rcSRA, rcFunction, rcExecuting, rcData, rcInvalid);
-}
-
-VTRANSFACT_IMPL ( NCBI_SRA_qual4_decompress_v1, 1, 0, 0) (const void *self, const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    VNoHdrBlobFunc f = legacy_qual4_decode_func;
-    rslt->variant = vftLegacyBlob;
-    rslt->u.bf = ( VBlobFunc ) f;
-
-    return 0;
-}
-
-#if TESTING
-int test_decode(const uint8_t src[], unsigned ssize, int8_t Y[], unsigned N) {
-    size_t n = qual4_decode(Y, N / 4, src, ssize, -40, 40);
-    
-    return 0;
-}
-#endif
diff --git a/libs/sraxf/qual4_encode.c b/libs/sraxf/qual4_encode.c
deleted file mode 100644
index 14fa16a..0000000
--- a/libs/sraxf/qual4_encode.c
+++ /dev/null
@@ -1,232 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <vdb/vdb-priv.h>
-#include <klib/data-buffer.h>
-#include "qual4_codec.h"
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <endian.h>
-#include <byteswap.h>
-
-#include <assert.h>
-
-static size_t qual4_encode(
-						   uint8_t *Dst,
-                           size_t dsize,
-						   const qual4 src [],
-						   size_t count,
-                           int8_t qmin,
-                           int8_t qmax
-                           )
-{
-	static const qual4 all_bad = { -5, -5, -5, -5 };
-	uint8_t *dst = Dst;
-    const uint8_t * const dend = & ( ( uint8_t* ) Dst ) [ dsize ];
-	int i;
-	qual4 
-        pat_a_1, pat_a_2, pat_a_3,
-        pat_b_1, pat_b_2, pat_b_3,
-        pat_c_1, pat_c_2, pat_c_3;
-    qual4 is_good;
-
-    is_good[0] = qmax;
-    is_good[1] = is_good[2] = is_good[3] = qmin;
-	
-	pat_a_1[2] = pat_a_1[3] = pat_a_2[1] = pat_a_2[3] = pat_a_3[1] = pat_a_3[2] = qmin;
-	pat_b_1[2] = pat_b_1[3] = pat_b_2[1] = pat_b_2[3] = pat_b_3[1] = pat_b_3[2] = qmin;
-	pat_c_1[2] = pat_c_1[3] = pat_c_2[1] = pat_c_2[3] = pat_c_3[1] = pat_c_3[2] = qmin;
-	
-	for (i = 0; i != count; ++i) {
-		qual4 in_val;
-		qual4 out_val;
-		int codes;
-		
-        memcpy(in_val, src + i, 4);
-		if (in_val[0] > qmax || in_val[0] < qmin ||
-            in_val[1] > qmax || in_val[1] < qmin ||
-            in_val[2] > qmax || in_val[2] < qmin ||
-            in_val[3] > qmax || in_val[3] < qmin)
-        {
-			if (in_val[0] + 40 < 0 || in_val[0] + 40 >= cb_last)
-				goto IS_BAD;
-			else
-				goto QUOTE_IT;
-		}
-		
-		do {
-			if (*(uint32_t *)in_val == *(uint32_t *)all_bad) {
-			IS_BAD:
-				codes = 1;
-				out_val[0] = known_bad;
-				break;
-			}
-			if (*(uint32_t *)in_val == *(uint32_t *)is_good) {
-				codes = 1;
-				out_val[0] = known_good;
-				break;
-			}
-			
-			codes = 2;
-			out_val[1] = in_val[0] + 40;
-			
-			pat_a_3[3] = pat_a_2[2] = pat_a_1[1] = -(pat_a_1[0] = pat_a_2[0] = pat_a_3[0] = in_val[0]);
-			if (*(uint32_t *)in_val == *(uint32_t *)pat_a_1) {
-				out_val[0] = pattern_a_1;
-				break;
-			}
-			if (*(uint32_t *)in_val == *(uint32_t *)pat_a_2) {
-				out_val[0] = pattern_a_2;
-				break;
-			}
-			if (*(uint32_t *)in_val == *(uint32_t *)pat_a_3) {
-				out_val[0] = pattern_a_3;
-				break;
-			}
-			
-			pat_b_3[3] = pat_b_2[2] = pat_b_1[1] = -(pat_b_1[0] = pat_b_2[0] = pat_b_3[0] = in_val[0]) + 1;
-			if (*(uint32_t *)in_val == *(uint32_t *)pat_b_1) {
-				out_val[0] = pattern_b_1;
-				break;
-			}
-			if (*(uint32_t *)in_val == *(uint32_t *)pat_b_2) {
-				out_val[0] = pattern_b_2;
-				break;
-			}
-			if (*(uint32_t *)in_val == *(uint32_t *)pat_b_3) {
-				out_val[0] = pattern_b_3;
-				break;
-			}
-			
-			pat_c_3[3] = pat_c_2[2] = pat_c_1[1] = -(pat_c_1[0] = pat_c_2[0] = pat_c_3[0] = in_val[0]) - 1;
-			if (*(uint32_t *)in_val == *(uint32_t *)pat_c_1) {
-				out_val[0] = pattern_c_1;
-				break;
-			}
-			if (*(uint32_t *)in_val == *(uint32_t *)pat_c_2) {
-				out_val[0] = pattern_c_2;
-				break;
-			}
-			if (*(uint32_t *)in_val == *(uint32_t *)pat_c_3) {
-				out_val[0] = pattern_c_3;
-				break;
-			}
-		QUOTE_IT:
-			codes = 4;
-			out_val[0] = in_val[0] + 40;
-			out_val[1] = in_val[1] + 40;
-			out_val[2] = in_val[2] + 40;
-			out_val[3] = in_val[3] + 40;
-		} while (0);
-        
-        if (dst + codes > dend)
-            return dst + codes - Dst;
-        
-        memcpy(dst, out_val, codes);
-		dst += codes;
-	}
-	return dst - Dst;
-}
-
-static
-rc_t CC qual4_encode_func(
-                       void *Self,
-                       const VXformInfo *info,
-                       VBlobResult *dst,
-                       const VBlobData *Src,
-                       VBlobHeader *hdr
-) {
-    size_t n;
-    unsigned i;
-    const int8_t *src = Src->data;
-    int qmin = src[0];
-    int qmax = src[0];
-    rc_t rc;
-    
-    n = ((size_t)Src->elem_count * Src->elem_bits + 7) >> 3;
-    for (i = 1; i < n; ++i) {
-        int val = src[i];
-        
-        if (val < -40 || val > 40)
-            continue;
-        
-        if (qmax < val)
-            qmax = val;
-        if (qmin > val)
-            qmin = val;
-    }
-    if (qmax > 40)
-        qmax = 40;
-    if (qmin < -40)
-        qmin = -40;
-    
-    rc = VBlobHeaderOpPushTail(hdr, qmin + 40);
-    if (rc == 0) {
-        rc = VBlobHeaderOpPushTail(hdr, qmax + 40);
-        if (rc == 0) {
-            n = qual4_encode(dst->data, (dst->elem_count * dst->elem_bits + 7) >> 3,
-                             (const qual4 *)src, 
-                             n / 4,
-                             qmin, qmax );
-            
-            if (n > (dst->elem_count * dst->elem_bits + 7) >> 3)
-                return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-
-            dst->elem_count = n * 8 / dst->elem_bits;
-            dst->byte_order = vboNone;
-            
-            return 0;
-        }
-    }
-    return rc;
-}
-
-/*
- * function NCBI:SRA:encoded_qual4 NCBI:SRA:qual4_encode #1 ( NCBI:SRA:swapped_qual4 in )
- */
-VTRANSFACT_IMPL(NCBI_SRA_qual4_encode, 1, 0, 0) (const void *self, const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->variant = vftBlob;
-    rslt->u.bf = qual4_encode_func;
-
-    return 0;
-}
-
-#if TESTING
-int test_encode(const int8_t Y[], unsigned N, uint8_t dst[], unsigned dsize) {
-    size_t n = qual4_encode(dst, dsize, Y, N / 4, -40, 40);
-
-    return n <= N ? n : 0;
-}
-#endif
diff --git a/libs/sraxf/read-desc.c b/libs/sraxf/read-desc.c
deleted file mode 100644
index d3ce922..0000000
--- a/libs/sraxf/read-desc.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include <sra/sradb.h>
-#include <vdb/xform.h>
-#include <klib/data-buffer.h>
-#include <klib/rc.h>
-#include <klib/text.h>
-#include <sysalloc.h>
-
-#include <assert.h>
-#include <string.h>
-
-static
-rc_t CC make_read_desc ( void *self, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    SRAReadDesc *dst;
-
-    const uint8_t *num_reads              = argv[0].u.data.base;
-    const INSDC_coord_zero *read_start    = argv[1].u.data.base;
-    const INSDC_coord_len *read_len       = argv[2].u.data.base;
-    const INSDC_SRA_xread_type *read_type = argv[3].u.data.base;
-    const INSDC_SRA_read_filter *read_flt = argv[4].u.data.base;
-    const INSDC_dna_text *cs_key          = argv[5].u.data.base;
-    const INSDC_coord_zero *lbl_start     = argv[6].u.data.base;
-    const INSDC_coord_len *lbl_len        = argv[7].u.data.base;
-    const char *label                     = argv[8].u.data.base;
-    uint32_t label_max                    = argv[8].u.data.elem_count;
-
-    num_reads += argv[0].u.data.first_elem; /* valid for argv[0].u.data.elem_count */
-    assert( argv[0].u.data.elem_bits == (sizeof( *num_reads ) * 8 ) );
-
-    read_start += argv[1].u.data.first_elem; /* valid for argv[1].u.data.elem_count */
-    assert( argv[1].u.data.elem_bits == (sizeof( *read_start ) * 8 ) );
-    assert( argv[1].u.data.elem_count >= *num_reads ); /*** some old bug overspecified metadata **/
-
-    read_len += argv[2].u.data.first_elem; /* valid for argv[2].u.data.elem_count */
-    assert( argv[2].u.data.elem_bits == (sizeof( *read_len ) * 8 ) );
-    assert( argv[2].u.data.elem_count >= *num_reads );  /*** some old bug overspecified metadata **/
-
-    read_type += argv[3].u.data.first_elem; /* valid for argv[3].u.data.elem_count */
-    assert( argv[3].u.data.elem_bits == (sizeof( *read_type ) * 8 ) );
-    assert( argv[3].u.data.elem_count >= *num_reads );  /*** some old bug overspecified metadata **/
-
-    read_flt += argv[4].u.data.first_elem; /* valid for argv[4].u.data.elem_count */
-    assert( argv[4].u.data.elem_bits == (sizeof( *read_flt ) * 8 ) );
-    assert( argv[4].u.data.elem_count >= *num_reads );
-
-    cs_key += argv[5].u.data.first_elem; /* valid for argv[5].u.data.elem_count */
-    assert( argv[5].u.data.elem_bits == (sizeof( *cs_key ) * 8 ) );
-    assert( argv[5].u.data.elem_count >= *num_reads );
-
-    lbl_start += argv[6].u.data.first_elem; /* valid for argv[6].u.data.elem_count */
-    assert( argv[6].u.data.elem_bits == (sizeof( *lbl_start ) * 8 ) );
-    assert( argv[6].u.data.elem_count >= *num_reads );
-
-    lbl_len += argv[7].u.data.first_elem; /* valid for argv[7].u.data.elem_count */
-    assert( argv[7].u.data.elem_bits == (sizeof( *lbl_len ) * 8 ) );
-    assert( argv[7].u.data.elem_count >= *num_reads );
-
-    label += argv[8].u.data.first_elem; /* valid for argv[8].u.data.elem_count */
-    assert( argv[8].u.data.elem_bits >= (sizeof( *label ) * 8 ) );
-
-    rslt->data->elem_bits = sizeof(*dst) * 8;
-
-    rc = KDataBufferResize( rslt->data, *num_reads );
-    if ( rc == 0 )
-    {
-        uint32_t idx;
-        dst = rslt->data->base;
-        for ( idx = 0; idx < *num_reads; ++idx )
-        {
-            uint32_t label_start = lbl_start [ idx ];
-            uint32_t label_len = lbl_len [ idx ];
-            size_t   label_used;
-            if ( label_start + label_len > label_max )
-            {
-                if ( label_start > label_max )
-                    label_start = label_len = 0;
-                else
-                    label_len = label_max - label_start;
-            }
-
-            dst[idx].seg.start = (uint16_t)read_start[idx];
-            dst[idx].seg.len = (uint16_t)read_len[idx];
-            dst[idx].type = read_type[idx] & SRA_READ_TYPE_BIOLOGICAL;
-            dst[idx].cs_key = cs_key[idx];
-
-            label_used = string_copy( dst[idx].label, sizeof(dst[idx].label), 
-                                      & label [ label_start ], label_len );
-            /* Pad with NULs so that bitcmp sees fully initialized data */
-            memset( dst[idx].label + label_used, '\0',
-                    sizeof(dst[idx].label) - label_used );        
-        }
-
-        rslt->elem_bits = sizeof(*dst) * 8;
-        rslt->elem_count = *num_reads;
-
-    }
-
-    return rc;
-}
-
-/*
- * function NCBI:SRA:ReadDesc NCBI:SRA:make_read_desc #1.0 ( U8 num_reads,
-    INSDC:coord:zero read_start, U32 read_len, INSDC:SRA:read_type read_type,
-    INSDC:SRA:read_filter read_filt, INSDC:dna:text cs_key,
-    INSDC:coord:zero label_start, U32 label_len, ascii label );
-
- */
-VTRANSFACT_IMPL( NCBI_SRA_make_read_desc, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt -> u . rf = make_read_desc;
-    rslt -> variant = vftRow;
-    return 0;
-}
diff --git a/libs/sraxf/read-seg-from-readn.c b/libs/sraxf/read-seg-from-readn.c
deleted file mode 100644
index 99bdf68..0000000
--- a/libs/sraxf/read-seg-from-readn.c
+++ /dev/null
@@ -1,361 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include <sra/sradb.h>
-#include <vdb/xform.h>
-#include <vdb/table.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <klib/text.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <os-native.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include <assert.h>
-
-#include "fix_read_seg_impl.h"
-
-/* readn_read_desc
- *  "nreads" [ DATA ] - bases for entire spot
- */
-typedef struct readn_read_desc readn_read_desc;
-struct readn_read_desc
-{
-    uint32_t read_type;
-    uint32_t read_start;
-    uint32_t read_len;
-    uint32_t label_start;
-    uint32_t label_len;
-};
-
-static
-rc_t CC equal_reads_from_spot ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    uint32_t i, end;
-    readn_read_desc *rdesc;
-    KDataBuffer *dst = rslt -> data;
-
-    const uint8_t *nreads = argv [ 0 ] . u . data . base;
-    const uint32_t *spot_len = argv [ 1 ] . u . data . base;
-    nreads += argv [ 0 ] . u . data . first_elem;
-    spot_len += argv [ 1 ] . u . data . first_elem;
-
-    dst -> elem_bits = sizeof * rdesc * 8;
-    rc = KDataBufferResize ( dst, * nreads );
-    if ( rc != 0 )
-        return rc;
-
-    rdesc = dst -> base;
-
-    assert ( * spot_len > 0 );
-    assert ( * nreads != 0 );
-
-    for ( i = end = 0; i < * nreads; ++ i )
-    {
-        uint32_t rem = * nreads - i;
-        uint32_t len = ( * spot_len - end + rem - 1 ) / rem;
-
-        rdesc [ i ] . read_type = SRA_READ_TYPE_BIOLOGICAL;
-        rdesc [ i ] . read_start = end;
-        rdesc [ i ] . read_len = len;
-        rdesc [ i ] . label_start = 0;
-        rdesc [ i ] . label_len = 0;
-
-        end += len;
-    }
-
-    rslt -> elem_count = * nreads;
-
-    return 0;
-}
-
-static
-rc_t CC read_seg_from_meta ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    uint8_t nreads;	
-    uint32_t spot_len;
-    const KDataBuffer *self = ( const void* ) data;
-    const readn_read_desc *rd_src = self->base;
-    KDataBuffer *dst = rslt -> data;
-    readn_read_desc *rd_dst;;
-
-    nreads   = ((uint8_t*) argv[0].u.data.base)[argv[0].u.data.first_elem];
-    spot_len = ((uint32_t*)argv[1].u.data.base)[argv[1].u.data.first_elem];
-    assert ( spot_len > 0 );
-    assert ( nreads > 0 );
-
-    rc = KDataBufferResize ( dst, nreads );
-    if(rc != 0)
-        return rc;
-
-    rd_dst = dst->base;
-
-    memcpy(rd_dst,rd_src,nreads*sizeof(*rd_dst));
-
-    /*** if not covered by equal_reads_from_spot() - valid for illumina consisting of bio reads only **/
-    if ( rd_dst[nreads-1].read_start+rd_dst[nreads-1].read_len==0)
-    {
-        int i;
-        rd_dst[0].read_start=0;
-        rd_dst[0].read_len=spot_len;
-        for(i=1;i<nreads;i++)
-        {
-            rd_dst[i].read_start=spot_len;
-            rd_dst[i].read_len=0;
-        }
-    }
-    /*** illumina stop reads before reaching designed cycles ***/
-    else if(rd_dst[nreads-1].read_start+rd_dst[nreads-1].read_len > spot_len)
-    {
-        int i;
-        for(i=0;i<nreads;i++)
-        {
-            if(rd_dst[i].read_start > spot_len)
-            {
-                rd_dst[i].read_start = spot_len;
-                rd_dst[i].read_len = 0;
-            }
-            else if(rd_dst[i].read_start + rd_dst[i].read_len > spot_len)
-            {
-                rd_dst[i].read_len = spot_len - rd_dst[i].read_start;
-            }
-        }
-    }
-    rslt -> elem_count = nreads;
-    return 0;
-}
-
-static
-rc_t parse_read_structure ( uint32_t idx, char *buf_val, readn_read_desc *rdesc )
-{
-    char    *rtype;
-    char    *pos;
-    int     fseqlen=0;
-    char    *ptr;
-    rc_t     rc;
-
-    memset(rdesc,0,sizeof(*rdesc));
-
-    pos = buf_val;
-
-    rtype = strsep( &pos, "|" );
-    if ( pos == NULL )
-    {
-        rc = RC ( rcSRA, rcTable, rcOpening, rcMetadata, rcCorrupt );
-        PLOGERR ( klogErr, ( klogErr, rc, "bad read struct '$(name)' = '$(value)'",
-                             "name=READ_%u,value=%s", idx, buf_val ));
-        return rc;
-    }
-
-    rdesc -> read_len = atoi ( pos );
-    strsep(&pos,"|");
-    if ( pos == NULL )
-    {
-        rc = RC ( rcSRA, rcTable, rcOpening, rcMetadata, rcCorrupt );
-        PLOGERR ( klogErr, ( klogErr, rc, "bad read struct '$(name)' = '$(value)'",
-                             "name=READ_%u,value=%s", idx, buf_val ));
-        return rc;
-    }
-
-    fseqlen = (int)strlen( pos );
-    if(fseqlen > 0)
-    {
-        if(pos[fseqlen-1]=='|') fseqlen--;
-        /* linker sequence is here */
-    }
-
-    switch ( rtype [ 0 ] )
-    {
-    case 'B':
-        rdesc -> read_type = SRA_READ_TYPE_BIOLOGICAL;
-        break;
-    case 'T':
-        rdesc -> read_type = SRA_READ_TYPE_TECHNICAL;
-        break;
-    default:
-        rc = RC ( rcSRA, rcTable, rcOpening, rcMetadata, rcCorrupt );
-        PLOGERR ( klogErr, ( klogErr, rc, "bad read struct '$(name)' = '$(value)'",
-                             "name=READ_%u,value=%s", idx, buf_val ));
-        return rc;
-    }
-    
-    pos=rtype;
-    ptr=strsep(&pos,":");
-    if( pos != NULL )
-    {
-        ptr=strsep(&pos,":");
-        /* label text is in ptr */
-        rdesc -> label_len = (uint32_t)strlen ( ptr );
-    }
-
-    return 0;
-}
-
-static
-void CC whack_data_buffer ( void *data )
-{
-    KDataBufferWhack ( data );
-    free ( data );
-}
-
-VTRANSFACT_IMPL ( NCBI_SRA_read_seg_from_readn, 1, 0, 0 ) ( const void *self,
-    const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    const KMetadata *meta;
-    rc_t rc = VTableOpenMetadataRead ( info -> tbl, & meta );
-    if ( rc == 0 )
-    {
-        KDataBuffer *fself;
-        readn_read_desc rd [ 16 ];
-        int32_t i, last, tech_read_cnt;
-
-        /* scan all metadata READ_N nodes */
-        for ( last = -1, i = 0; i < sizeof rd / sizeof rd [ 0 ] && rc ==0; ++ i )
-        {
-            const KMDataNode *node;
-
-            /* look for metadata descriptor */
-            rc = KMetadataOpenNodeRead ( meta, & node, "READ_%u", i );
-            if ( rc == 0 )
-            {
-                size_t bytes;
-                char str [ 4096 ];
-                rc = KMDataNodeReadCString ( node, str, sizeof str, & bytes );
-                KMDataNodeRelease ( node );
-                if ( rc == 0 )
-                {
-                    rc = parse_read_structure ( i, str, & rd [ i ] );
-                    if ( rc != 0 )
-                        break;
-                    last = i;
-                }
-            }
-
-        }
-
-        /* ignore all other errors */
-        rc = 0;
-
-        KMetadataRelease ( meta );
-
-        /* initial starts are always at 0 */
-        rd [ 0 ] . read_start = 0;
-        rd [ 0 ] . label_start = 0;
-
-        /* handle case when none-exist */
-        if ( last < 0 )
-        {
-            rslt -> u . ndf = equal_reads_from_spot;
-            rslt -> variant = vftNonDetRow;
-            return 0;
-        }
-
-        /* integrate lengths and count technical reads*/
-        for ( i = tech_read_cnt = 0; i < last; ++ i )
-        {
-            if ( rd [ i ] . read_type == SRA_READ_TYPE_TECHNICAL)
-                ++ tech_read_cnt;
-
-            rd [ i + 1 ] . read_start = rd [ i ] . read_start + rd [ i ] . read_len;
-            rd [ i + 1 ] . label_start = rd [ i ] . label_start + rd [ i ] . label_len;
-        }
-
-        /* temporary for cases where no read length has been given */
-        if ( tech_read_cnt == 0 && rd [ last ] . read_start + rd [ last ] . read_len == 0 )
-        {
-            rslt -> u . ndf = equal_reads_from_spot;
-            rslt -> variant = vftNonDetRow;
-            return 0;
-        }
-
-        /* now produce a static row */
-        fself = malloc ( sizeof * fself );
-        if ( fself == NULL )
-            rc = RC ( rcSRA, rcFunction, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            rc = KDataBufferMake ( fself, sizeof rd [ 0 ] * 8, ++ last );
-            if ( rc == 0 )
-            {
-                memcpy ( fself -> base, rd, last * sizeof rd [ 0 ] );
-                rslt -> self = fself;
-                rslt -> whack = whack_data_buffer;
-                rslt -> u . ndf = read_seg_from_meta;
-                rslt -> variant = vftNonDetRow;
-                return 0;
-            }
-
-            free ( fself );
-        }
-    }
-
-    return rc;
-}
-
-
-static
-rc_t CC fix_read_seg ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-
-    const uint16_t *rs_src = argv [ 0 ] . u . data . base;
-    const uint32_t nreads = argv [ 0 ] . u . data . elem_count;
-    const uint32_t *spot_lenp = argv [ 1 ] . u . data . base;
-    const uint32_t spot_len = spot_lenp [ argv [ 1 ] . u . data . first_elem ];
-
-    rs_src += argv [ 0 ] . u . data . first_elem;
-
-    assert ( spot_len > 0 );
-    assert ( nreads > 0);
-    
-    rc = KDataBufferResize ( rslt -> data, nreads );
-    if ( rc == 0 )
-    {
-        uint32_t * rs_dst = rslt -> data -> base;
-        fix_read_seg_impl(rs_src, nreads, spot_len, rs_dst);
-        rslt -> elem_count = nreads;
-    }
-    return rc;
-}
-
-VTRANSFACT_IMPL ( NCBI_SRA_fix_read_seg, 1, 0, 0 ) ( const void *self,
-    const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt -> variant = vftRow;
-    rslt -> u . rf = fix_read_seg;
-    return 0;
-}
diff --git a/libs/sraxf/rewrite-spot-name.c b/libs/sraxf/rewrite-spot-name.c
deleted file mode 100644
index 7a20402..0000000
--- a/libs/sraxf/rewrite-spot-name.c
+++ /dev/null
@@ -1,222 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include <sra/sradb.h>
-#include <vdb/xform.h>
-#include <vdb/table.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <klib/text.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-
-#define SLX_COORD_LEN 10
-
-static
-int non_braindead_atoi ( const char *start, const char *end )
-{
-    int val = start [ 0 ] - '0';
-    uint32_t i, count = (uint32_t)( end - start );
-    for ( i = 1; i < count; ++ i )
-    {
-        val *= 10;
-        val += start [ i ] - '0';
-    }
-    return val;
-}
-
-static
-int scan_hex ( const char *str, int count )
-{
-    int i, val = str [ 0 ] - '0';
-    if ( val > 9 )
-        val = toupper ( str [ 0 ] ) - 'A' + 10;
-    for ( i = 1; i < count; ++ i )
-    {
-        int d = str [ i ] - '0';
-        if ( d > 9 )
-            d = toupper ( str [ i ] ) - 'A' + 10;
-        val = val << 4 | d;
-    }
-    return val;
-}
-
-static
-rc_t CC illumina_rewrite_spot_name ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    char buffer [ 64];
-    uint32_t coord_len;
-    uint32_t prefix_len;
-    unsigned int a, b, c, d;
-    KDataBuffer *dst = rslt -> data;
-
-    const char *prefix;
-    const char *skey = argv [ 0 ] . u . data . base;
-    uint64_t i, j, count = argv [ 0 ] . u . data . elem_count;
-    
-    skey += argv [ 0 ] . u . data . first_elem;
-
-    /* find last hex portion */
-    for ( i = count; i > 0; )
-    {
-        if ( ! isxdigit ( skey [ -- i ] ) )
-            break;
-    }
-
-    if ( count - i < ( SLX_COORD_LEN - 1 ) )
-    {
-        const char *end = skey + count;
-
-        /* new format */
-        for ( d = 0, j = 0, i = count; i > 0; )
-        {
-            if ( ! isdigit ( skey [ -- i ] ) )
-            {
-                j = i + 1;
-                break;
-            }
-        }
-        d = non_braindead_atoi ( & skey [ j ], end );
-        for ( c = 0, j = 0; i > 0; )
-        {
-            if ( ! isdigit ( skey [ -- i ] ) )
-            {
-                j = i + 1;
-                break;
-            }
-        }
-        c = atoi ( & skey [ j ] );
-        for ( b = 0, j = 0; i > 0; )
-        {
-            if ( ! isdigit ( skey [ -- i ] ) )
-            {
-                j = i + 1;
-                break;
-            }
-        }
-        b = atoi ( & skey [ j ] );
-        for ( a = 0, j = 0; i > 0; )
-        {
-            if ( ! isdigit ( skey [ -- i ] ) )
-            {
-                j = i + 1;
-                break;
-            }
-        }
-        a = atoi ( & skey [ j ] );
-        if ( j > 0 )
-        {
-            if ( i > 0 )
-                -- i;
-            while ( isalpha ( skey [ i ] ) )
-                ++ i;
-        }
-    }
-    else
-    {
-        a = scan_hex ( skey, 1 );
-        b = scan_hex ( & skey [ 1 ], 3 );
-        c = scan_hex ( & skey [ 4 ], 3 );
-        d = scan_hex ( & skey [ 7 ], 3 );
-        if ( count > SLX_COORD_LEN )
-        {
-            i = count - SLX_COORD_LEN;
-        }
-    }
-
-    /* generate coordinates */
-    coord_len = sprintf ( buffer, ":%d:%d:%d:%d", a, b, c, d );
-
-    /* get size of prefix */
-    if ( argc == 1 )
-    {
-        prefix = "";
-        prefix_len = 0;
-    }
-    else
-    {
-        prefix = argv [ 1 ] . u . data . base;
-        assert(argv [ 1 ] . u . data . elem_count >> 32 == 0);
-        prefix_len = (uint32_t)argv [ 1 ] . u . data . elem_count;
-        prefix += argv [ 1 ] . u . data . first_elem;
-    }
-
-    /* resize output buffer for prefix, name stuff, coordinates */
-    if ( dst -> elem_bits != 8 )
-    {
-        rc = KDataBufferCast ( dst, dst, 8, true );
-        if ( rc != 0 )
-            return rc;
-    }
-    rc = KDataBufferResize ( dst, prefix_len + i + coord_len + 1 );
-    if ( rc != 0 )
-        return rc;
-
-    /* copy in prefix, name prefix, coordinates */
-    rslt -> elem_count = sprintf ( dst -> base, "%.*s%.*s%s"
-        , ( int ) prefix_len, prefix
-        , ( int ) i, skey
-        , buffer );
-
-    return 0;
-}
-
-/* rewrite_spot_name
- *  given an old spotname directly from skey
- *  write according to platform rules, optionally with a prefix
- *
- *  "platform" [ CONST ] - which platform rules to use
- *
- *  "skey" [ DATA ] - skey string for row
- *
- *  "prefix" [ DATA, OPTIONAL ] - prefix for spot
- */
-VTRANSFACT_IMPL ( NCBI_SRA_rewrite_spot_name, 1, 0, 0 ) ( const void *self,
-    const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    const uint8_t *platform = cp -> argv [ 0 ] . data . u8;
-    switch ( platform [ 0 ] )
-    {
-    case SRA_PLATFORM_ILLUMINA:
-        break;
-    default:
-        return RC ( rcSRA, rcFunction, rcConstructing, rcType, rcUnsupported );
-    }
-
-    rslt -> u . ndf = illumina_rewrite_spot_name;
-    rslt -> variant = vftNonDetRow;
-    return 0;
-}
diff --git a/libs/sraxf/rotate.c b/libs/sraxf/rotate.c
deleted file mode 100644
index bf9e0a7..0000000
--- a/libs/sraxf/rotate.c
+++ /dev/null
@@ -1,271 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/table.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <bitstr.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-
-typedef void (*rotate_f)(void *dst, uint64_t offset, const void *src, const void *Cntrl, uint64_t vec_count);
-typedef struct self_t {
-    rotate_f f;
-} self_t;
-
-#define ROT_0(A, B) A = B
-#define ROT_1(A, B) do { (A).data[0] = (B).data[1]; (A).data[1] = (B).data[2]; (A).data[2] = (B).data[3]; (A).data[3] = (B).data[0]; } while (0)
-#define ROT_2(A, B) do { (A).data[0] = (B).data[2]; (A).data[1] = (B).data[3]; (A).data[2] = (B).data[0]; (A).data[3] = (B).data[1]; } while (0)
-#define ROT_3(A, B) do { (A).data[0] = (B).data[3]; (A).data[1] = (B).data[0]; (A).data[2] = (B).data[1]; (A).data[3] = (B).data[2]; } while (0)
-
-#define UNFUNC(VALTYPE) UNF_ ## VALTYPE
-
-#define UNFUNC_DEF(VALTYPE) \
-static void UNFUNC(VALTYPE)(void *Dst, uint64_t offset, const void *Src, const void *Cntrl, uint64_t count) { \
-    typedef struct { VALTYPE data[4]; } data4_t; \
-    data4_t *dst = (data4_t *)Dst; \
-    const data4_t *src = (const data4_t *)Src; \
-    const uint8_t *cntrl = (const uint8_t *)Cntrl; \
-    uint64_t i; \
-    dst += offset; \
-    for (i = 0; i != count; ++i) { \
-        switch(cntrl[i]) { \
-        default: \
-        case 0: \
-            ROT_0(dst[i], src[i]); \
-            break; \
-        case 1: \
-            ROT_3(dst[i], src[i]); \
-            break; \
-        case 2: \
-            ROT_2(dst[i], src[i]); \
-            break; \
-        case 3: \
-            ROT_1(dst[i], src[i]); \
-            break; \
-        }\
-    } \
-}
-
-#define FUNC(VALTYPE) F_ ## VALTYPE
-
-#define FUNC_DEF(VALTYPE) \
-static void FUNC(VALTYPE)(void *Dst, uint64_t offset, const void *Src, const void *Cntrl, uint64_t count) { \
-    typedef struct { VALTYPE data[4]; } data4_t; \
-    data4_t *dst = (data4_t *)Dst; \
-    const data4_t *src = (const data4_t *)Src; \
-    const uint8_t *cntrl = (const uint8_t *)Cntrl; \
-    uint64_t i; \
-    dst += offset; \
-    for (i = 0; i != count; ++i) { \
-        switch(cntrl[i]) { \
-        default: \
-        case 0: \
-            ROT_0(dst[i], src[i]); \
-            break; \
-        case 1: \
-            ROT_1(dst[i], src[i]); \
-            break; \
-        case 2: \
-            ROT_2(dst[i], src[i]); \
-            break; \
-        case 3: \
-            ROT_3(dst[i], src[i]); \
-            break; \
-        }\
-    } \
-}
-
-FUNC_DEF(float)
-FUNC_DEF(double)
-FUNC_DEF(uint8_t)
-FUNC_DEF(uint16_t)
-FUNC_DEF(uint32_t)
-FUNC_DEF(uint64_t)
-FUNC_DEF(int8_t)
-FUNC_DEF(int16_t)
-FUNC_DEF(int32_t)
-FUNC_DEF(int64_t)
-
-UNFUNC_DEF(float)
-UNFUNC_DEF(double)
-UNFUNC_DEF(uint8_t)
-UNFUNC_DEF(uint16_t)
-UNFUNC_DEF(uint32_t)
-UNFUNC_DEF(uint64_t)
-UNFUNC_DEF(int8_t)
-UNFUNC_DEF(int16_t)
-UNFUNC_DEF(int32_t)
-UNFUNC_DEF(int64_t)
-
-static
-rc_t CC rotate_drvr (
-                     void *Self,
-                     const VXformInfo *info,
-                     int64_t row_id,
-                     const VFixedRowResult *rslt,
-                     uint32_t argc,
-                     const VRowData argv []
-                     )
-{
-    const void *src;
-    const void *cntrl;
-    const self_t *self = (const self_t *)Self;
-    
-    assert(argv[0].u.data.elem_bits % 8 == 0);
-    assert(argv[1].u.data.elem_bits % 8 == 0);
-    
-    src   = &((const uint8_t *)argv[0].u.data.base)[(argv[0].u.data.first_elem * argv[0].u.data.elem_bits) / 8];
-    cntrl = &((const uint8_t *)argv[1].u.data.base)[(argv[1].u.data.first_elem * argv[1].u.data.elem_bits) / 8];
-    
-    self->f(rslt->base, rslt->first_elem, src, cntrl, rslt->elem_count);
-    
-    return 0;
-}
-
-static
-void CC sraxf_rotate_free_wrapper( void *ptr )
-{
-	free( ptr );
-}
-
-/* 
- * function < type T > T [ 4 ] NCBI:SRA:rotate #1 < bool encode > ( T [ 4 ] in, U8 called );
- */
-VTRANSFACT_IMPL ( NCBI_SRA_rotate, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    self_t *self;
-    bool encode;
-    
-    assert(cp->argc == 1);
-    assert(cp->argv[0].desc.domain == vtdBool);
-    assert(cp->argv[0].count == 1);
-    encode = cp->argv[0].data.b[0];
-    
-    switch (info->fdesc.desc.domain) {
-    case vtdInt:
-    case vtdUint:
-        switch (info->fdesc.desc.intrinsic_bits) {
-        case 8:
-        case 16:
-        case 32:
-        case 64:
-            break;
-        default:
-            return RC(rcXF, rcFunction, rcConstructing, rcType, rcInvalid);
-            break;
-        }
-        break;
-    case vtdFloat:
-        switch (info->fdesc.desc.intrinsic_bits) {
-        case 32:
-        case 64:
-            break;
-        default:
-            return RC(rcXF, rcFunction, rcConstructing, rcType, rcInvalid);
-            break;
-        }
-        break;
-    default:
-        return RC(rcXF, rcFunction, rcConstructing, rcType, rcInvalid);
-        break;
-    }
-    
-    self = malloc(sizeof(*self));
-    if (self) {
-        switch (info->fdesc.desc.domain) {
-        case vtdInt:
-            switch (info->fdesc.desc.intrinsic_bits) {
-            case 8:
-                self->f = encode ? FUNC(int8_t) : UNFUNC(int8_t);
-                break;
-            case 16:
-                self->f = encode ? FUNC(int16_t) : UNFUNC(int16_t);
-                break;
-            case 32:
-                self->f = encode ? FUNC(int32_t) : UNFUNC(int32_t);
-                break;
-            case 64:
-                self->f = encode ? FUNC(int64_t) : UNFUNC(int64_t);
-                break;
-            default:
-                break;
-            }
-            break;
-        case vtdUint:
-            switch (info->fdesc.desc.intrinsic_bits) {
-            case 8:
-                self->f = encode ? FUNC(uint8_t) : UNFUNC(uint8_t);
-                break;
-            case 16:
-                self->f = encode ? FUNC(uint16_t) : UNFUNC(uint16_t);
-                break;
-            case 32:
-                self->f = encode ? FUNC(uint32_t) : UNFUNC(uint32_t);
-                break;
-            case 64:
-                self->f = encode ? FUNC(uint64_t) : UNFUNC(uint64_t);
-                break;
-            default:
-                break;
-            }
-            break;
-        case vtdFloat:
-            switch (info->fdesc.desc.intrinsic_bits) {
-            case 32:
-                self->f = encode ? FUNC(float) : UNFUNC(float);
-                break;
-            case 64:
-                self->f = encode ? FUNC(double) : UNFUNC(double);
-                break;
-            default:
-                break;
-            }
-            break;
-        default:
-            break;
-        }
-        
-        rslt->self = self;
-        rslt->whack = sraxf_rotate_free_wrapper;
-        rslt->u.pf = rotate_drvr;
-        rslt->variant = vftFixedRow;
-        
-        return 0;
-    }
-    return RC(rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted);
-}
diff --git a/libs/sraxf/spot-desc.c b/libs/sraxf/spot-desc.c
deleted file mode 100644
index 9a98fd0..0000000
--- a/libs/sraxf/spot-desc.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include <sra/sradb.h>
-#include <vdb/xform.h>
-#include <klib/data-buffer.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <string.h>
-#include <assert.h>
-
-static
-rc_t CC make_spot_desc ( void *self, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    const uint32_t *spot_len   = argv[0].u.data.base;
-    const uint32_t *fixed_len  = argv[1].u.data.base;
-    const uint32_t *sig_len    = argv[2].u.data.base;
-    const int32_t *trim_start  = argv[3].u.data.base;
-    const uint32_t *trim_len   = argv[4].u.data.base;
-    const uint8_t *num_reads   = argv[5].u.data.base;
-
-    SRASpotDesc *dst;
-
-    num_reads += argv[5].u.data.first_elem; /* valid for argv[0].u.data.elem_count */
-    assert( argv[5].u.data.elem_bits == (sizeof( *num_reads ) * 8 ) );
-
-    spot_len += argv[0].u.data.first_elem;
-    assert( argv[0].u.data.elem_bits == (sizeof( *spot_len ) * 8 ) );
-
-    fixed_len += argv[1].u.data.first_elem;
-    assert( argv[1].u.data.elem_bits == (sizeof( *fixed_len ) * 8 ) );
-
-    sig_len += argv[2].u.data.first_elem;
-    assert( argv[2].u.data.elem_bits == (sizeof( *sig_len ) * 8 ) );
-
-    trim_start += argv[3].u.data.first_elem;
-    assert( argv[3].u.data.elem_bits == (sizeof( *trim_start ) * 8 ) );
-
-    trim_len += argv[4].u.data.first_elem;
-    assert( argv[4].u.data.elem_bits == (sizeof( *trim_len ) * 8 ) );
-
-    rslt->data->elem_bits = sizeof(*dst) * 8;
-
-    rc = KDataBufferResize( rslt->data, 1 );
-    if ( rc == 0 )
-    {
-        dst = rslt->data->base;
-        dst->spot_len = (uint16_t)spot_len[0];
-        dst->fixed_len = (uint16_t)fixed_len[0];
-        dst->signal_len = (uint16_t)sig_len[0];
-        dst->clip_qual_right = (uint16_t)( trim_start[0]+trim_len[0] );
-        dst->num_reads = num_reads[0];
-
-        memset( dst->align, 0, sizeof( dst->align ) );
-        
-        rslt->elem_bits = sizeof(*dst) * 8;
-        rslt->elem_count = 1;
-    }
-
-    return rc;
-}
-
-/*
-  function NCBI:SRA:SpotDesc NCBI:SRA:make_spot_desc
-       ( U32 spot_len, U32 fixed_len,  U32 sig_len,
-        INSDC:coord:zero trim_start, U32 trim_len, U8 num_reads )
-
- */
-VTRANSFACT_IMPL( NCBI_SRA_make_spot_desc, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt -> u . rf = make_spot_desc;
-    rslt -> variant = vftRow;
-    return 0;
-}
diff --git a/libs/sraxf/stats.c b/libs/sraxf/stats.c
deleted file mode 100644
index 0b53093..0000000
--- a/libs/sraxf/stats.c
+++ /dev/null
@@ -1,501 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include <sra/sradb.h>
-#include <vdb/xform.h>
-#include <vdb/table.h>
-#include <klib/data-buffer.h>
-#include <klib/text.h>
-#include <klib/printf.h>
-#include <klib/rc.h>
-#include <kdb/meta.h>
-#include <os-native.h> /* strncasecmp */
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-typedef struct sra_meta_stats_node_group_struct
-{
-    KMDataNode* node_spot_count;
-    KMDataNode* node_base_count;
-    KMDataNode* node_bio_base_count;
-    KMDataNode* node_cmp_base_count;
-    KMDataNode* node_spot_min;
-    KMDataNode* node_spot_max;
-} sra_meta_stats_node_group;
-
-typedef struct sra_meta_stats_data_struct
-{
-    KMetadata *meta;
-    bool compressed;
-    sra_meta_stats_node_group table;
-    sra_meta_stats_node_group dflt_grp;
-    char* last_grp_name;
-    uint64_t last_grp_name_len; /* strlen */
-    uint64_t last_grp_name_sz; /* buffer size */
-    sra_meta_stats_node_group last_grp;
-    uint32_t grp_qty;
-} sra_meta_stats_data;
-
-static
-rc_t sra_meta_stats_node_read(KMDataNode* node, void* value)
-{
-    rc_t rc = KMDataNodeReadAsU64(node, value);
-    if ( rc != 0 )
-    {
-        if ( GetRCState ( rc ) == rcIncomplete && GetRCObject ( rc ) == rcTransfer )
-        {
-            * ( uint64_t* ) value = 0;
-            rc = 0;
-        }
-    }
-    return rc;
-}
-
-static
-rc_t sra_meta_stats_node_group_update(sra_meta_stats_node_group* g,
-    const int64_t spot_id, const uint32_t spot_len,
-    const uint32_t bio_spot_len, const uint32_t cmp_spot_len)
-{
-    rc_t rc = 0;
-    uint64_t u64;
-    int64_t i64;
-
-    if( (rc = sra_meta_stats_node_read(g->node_spot_count, &u64)) == 0 ) {
-        if( u64 + 1 < u64 ) {
-            rc = RC(rcVDB, rcFunction, rcUpdating, rcMetadata, rcOutofrange);
-        } else {
-            if( spot_id != 0 ) {
-                ++u64;
-            }
-            rc = KMDataNodeWriteB64(g->node_spot_count, &u64);
-        }
-    }
-    if( (rc = sra_meta_stats_node_read(g->node_base_count, &u64)) == 0 ) {
-        if( u64 + 1 < u64 ) {
-            rc = RC(rcVDB, rcFunction, rcUpdating, rcMetadata, rcOutofrange);
-        } else {
-            u64 += spot_len;
-            rc = KMDataNodeWriteB64(g->node_base_count, &u64);
-        }
-    }
-    if( (rc = sra_meta_stats_node_read(g->node_bio_base_count, &u64)) == 0 ) {
-        if( u64 + bio_spot_len < u64 ) {
-            rc = RC(rcVDB, rcFunction, rcUpdating, rcMetadata, rcOutofrange);
-        } else {
-            u64 += bio_spot_len;
-            rc = KMDataNodeWriteB64(g->node_bio_base_count, &u64);
-        }
-    }
-    if( g->node_cmp_base_count != NULL ) {
-        if( (rc = sra_meta_stats_node_read(g->node_cmp_base_count, &u64)) == 0 ) {
-            if( u64 + cmp_spot_len < u64 ) {
-                rc = RC(rcVDB, rcFunction, rcUpdating, rcMetadata, rcOutofrange);
-            } else {
-                u64 += cmp_spot_len;
-                rc = KMDataNodeWriteB64(g->node_cmp_base_count, &u64);
-            }
-        }
-    }
-    if( (rc = sra_meta_stats_node_read(g->node_spot_max, &i64)) == 0 ) {
-        if( i64 == 0 || i64 < spot_id ) {
-            i64 = spot_id;
-            rc = KMDataNodeWriteB64(g->node_spot_max, &i64);
-        }
-    }
-    if( (rc = sra_meta_stats_node_read(g->node_spot_min, &i64)) == 0 ) {
-        if( i64 == 0 || i64 > spot_id ) {
-            i64 = spot_id;
-            rc = KMDataNodeWriteB64(g->node_spot_min, &i64);
-        }
-    }
-    return rc;
-}
-
-static
-rc_t sra_meta_stats_node_group_open(KMDataNode* parent, sra_meta_stats_node_group* g, bool compressed)
-{
-    rc_t rc = 0;
-    assert(parent && g);
-
-    if( (rc = KMDataNodeOpenNodeUpdate(parent, &g->node_spot_count, "SPOT_COUNT")) == 0 &&
-        (rc = KMDataNodeOpenNodeUpdate(parent, &g->node_base_count, "BASE_COUNT")) == 0 &&
-        (rc = KMDataNodeOpenNodeUpdate(parent, &g->node_bio_base_count, "BIO_BASE_COUNT")) == 0 &&
-        (rc = KMDataNodeOpenNodeUpdate(parent, &g->node_spot_min, "SPOT_MIN")) == 0 &&
-        (rc = KMDataNodeOpenNodeUpdate(parent, &g->node_spot_max, "SPOT_MAX")) == 0 ) {
-        if( compressed ) { 
-            rc = KMDataNodeOpenNodeUpdate(parent, &g->node_cmp_base_count, "CMP_BASE_COUNT");
-        }
-    }
-    return rc;
-}
-
-static
-void sra_meta_stats_node_group_release(sra_meta_stats_node_group* g)
-{
-    if ( g != NULL )
-    {
-        KMDataNodeRelease(g->node_spot_count);
-        KMDataNodeRelease(g->node_base_count);
-        KMDataNodeRelease(g->node_bio_base_count);
-        KMDataNodeRelease(g->node_cmp_base_count);
-        KMDataNodeRelease(g->node_spot_min);
-        KMDataNodeRelease(g->node_spot_max);
-        memset ( g, 0, sizeof * g );
-    }
-}
-
-static
-void CC sra_meta_stats_whack( void *data )
-{
-    sra_meta_stats_data *self = data;
-    sra_meta_stats_node_group_release(&self->table);
-    sra_meta_stats_node_group_release(&self->dflt_grp);
-    free(self->last_grp_name);
-    sra_meta_stats_node_group_release(&self->last_grp);
-    KMetadataRelease(self->meta);
-    free(self);
-}
-
-static
-rc_t sra_meta_stats_make(sra_meta_stats_data** self, VTable* vtbl, bool has_spot_group, bool compressed)
-{
-    rc_t rc = 0;
-    sra_meta_stats_data* data = calloc(1, sizeof(*data));
-
-    assert(self != NULL && vtbl != NULL);
-
-    if( data == NULL ) {
-        rc = RC(rcVDB, rcFunction, rcConstructing, rcMemory, rcExhausted);
-    } else if( (rc = VTableOpenMetadataUpdate(vtbl, &data->meta)) == 0 ) {
-        KMDataNode* node;
-        data->compressed = compressed;
-        if( (rc = KMetadataOpenNodeUpdate(data->meta, &node, "STATS/TABLE")) == 0 ) {
-            rc = sra_meta_stats_node_group_open(node, &data->table, compressed);
-            KMDataNodeRelease(node);
-        }
-        if( rc == 0 && has_spot_group ) {
-            if( (rc = KMetadataOpenNodeUpdate(data->meta, &node, "STATS/SPOT_GROUP/default")) == 0 ) {
-                rc = sra_meta_stats_node_group_open(node, &data->dflt_grp, compressed);
-                KMDataNodeRelease(node);
-            }
-        }
-    }
-    if( rc == 0 ) {
-        *self = data;
-    } else {
-        sra_meta_stats_whack(data);
-    }
-    return rc;
-}
-
-static
-rc_t CC sra_meta_stats_update(sra_meta_stats_data* self,
-    const int64_t spot_id, const uint32_t spot_len,
-    const uint32_t bio_spot_len, const uint32_t cmp_spot_len,
-    bool has_grp, const char* grp, uint64_t grp_len)
-{
-    rc_t rc = 0;
-    const uint32_t max_grp_qty = 10000;
-
-    assert(self != NULL);
-
-    rc = sra_meta_stats_node_group_update(&self->table, spot_id, spot_len, bio_spot_len, cmp_spot_len);
-    if( has_grp && self->grp_qty <= max_grp_qty && rc == 0 )
-    {
-        /* an empty group is considered default */
-        if( grp_len == 0 || grp == NULL || grp[0] == '\0' ||
-            (grp_len == 7 && strncasecmp("default", grp, grp_len) == 0 ) )
-        {
-            rc = sra_meta_stats_node_group_update(&self->dflt_grp, spot_id, spot_len, bio_spot_len, cmp_spot_len);
-        }
-        else
-        {
-            size_t i;
-            KMDataNode* n;
-            const KMDataNode *cn;
-            bool new_group, unsafe;
-
-            /* look for cached node */
-            if ( self->last_grp_name != NULL &&
-                 self->last_grp_name_len == grp_len &&
-                 strncmp(self->last_grp_name, grp, grp_len) == 0 )
-            {
-                return sra_meta_stats_node_group_update(&self->last_grp, spot_id, spot_len, bio_spot_len, cmp_spot_len);
-            }
-
-            /* release cached group */
-            sra_meta_stats_node_group_release(&self->last_grp);
-
-            /* realloc cached name */
-            if ( self->last_grp_name == NULL || grp_len >= self->last_grp_name_sz )
-            {
-                char *p = realloc ( self -> last_grp_name, grp_len + 1 );
-                if ( p == NULL )
-                    return RC ( rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted );
-    
-                self -> last_grp_name = p;
-                self -> last_grp_name_sz = grp_len + 1;
-            }
-
-            /* sanitize name */
-            for ( unsafe = false, i = 0; i < grp_len; ++ i )
-            {
-                if ( ( self -> last_grp_name [ i ] = grp [ i ] ) == '/' )
-                {
-                    unsafe = true;
-                    self -> last_grp_name [ i ] = '\\';
-                }
-            }
-            self -> last_grp_name_len = i;
-            self -> last_grp_name [ i ] = 0;
-
-            /* look for new group */
-            new_group = true;
-            rc = KMetadataOpenNodeRead(self->meta, &cn, "STATS/SPOT_GROUP/%s", self->last_grp_name );
-            if ( rc == 0 )
-            {
-                new_group = false;
-                KMDataNodeRelease ( cn );
-            }
-
-            /* detect abusive quantity of nodes */
-            if ( new_group && ++self->grp_qty > max_grp_qty )
-            {
-                rc = KMetadataOpenNodeUpdate(self->meta, &n, "STATS");
-                if( rc == 0 )
-                {
-                    sra_meta_stats_node_group_release(&self->dflt_grp);
-                    KMDataNodeDropChild(n, "SPOT_GROUP");
-                    KMDataNodeRelease(n);
-                    free(self->last_grp_name);
-                    self->last_grp_name = NULL;
-                }
-                return rc;
-            }
-
-            /* create new or cache existing group */
-            rc = KMetadataOpenNodeUpdate(self->meta, &n, "STATS/SPOT_GROUP/%s", self->last_grp_name );
-            if ( rc == 0 )
-            {
-                rc = sra_meta_stats_node_group_open(n, &self->last_grp, self->compressed);
-                if (rc == 0 && new_group) {
-                    if (unsafe)
-                    {
-                        char value [ 512 ], *v = value;
-                        if ( grp_len >= sizeof value )
-                            v = malloc ( grp_len + 1 );
-                        if ( v == NULL )
-                            rc = RC ( rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted );
-                        else
-                        {
-                            rc = string_printf ( v, grp_len + 1, NULL, "%.*s", ( uint32_t ) grp_len, grp );
-                            assert ( rc == 0 );
-                            rc = KMDataNodeWriteAttr(n, "name", v);
-                            if ( rc == 0 )
-                                memcpy ( self->last_grp_name, grp, grp_len );
-                            if ( v != value )
-                                free ( v );
-                        }
-                    }
-                    if ( rc == 0 )
-                        rc = sra_meta_stats_node_group_update(&self->last_grp, 0, 0, 0, 0);
-                }
-                KMDataNodeRelease(n);
-
-                if( rc == 0 )
-                    rc = sra_meta_stats_node_group_update(&self->last_grp, spot_id, spot_len, bio_spot_len, cmp_spot_len);
-            }
-        }
-    }
-    return rc;
-}
-
-static
-rc_t CC sra_meta_stats_trigger(void *data, const VXformInfo *info, int64_t row_id,
-                               VRowResult *rslt, uint32_t argc, const VRowData argv[])
-{
-    uint32_t i, bio_spot_len;
-    const char* grp = NULL;
-    uint64_t len = 0;
-
-    uint32_t spot_len = argv[0].u.data.elem_count;
-    /* take nreads from read_len */
-    uint32_t nreads = argv[1].u.data.elem_count;
-    /* get read_len and read_type */
-    const INSDC_coord_len *read_len = argv[1].u.data.base;
-    const INSDC_SRA_xread_type *read_type = argv[2].u.data.base;
-    read_len += argv[1].u.data.first_elem;
-    read_type += argv[2].u.data.first_elem;
-
-    assert(argc >= 3 && argc <= 4);
-    assert(nreads == argv[2].u.data.elem_count);
-
-    for(i = bio_spot_len = 0; i < nreads; i++) {
-        if( (read_type[i] & SRA_READ_TYPE_BIOLOGICAL) != 0 ) {
-            bio_spot_len += read_len[i];
-        }
-    }
-    if( argc == 4 ) {
-        /* get group name and length */
-        grp = argv[3].u.data.base;
-        len = argv[3].u.data.elem_count;
-        grp += argv[3].u.data.first_elem;
-    }
-    return sra_meta_stats_update(data, row_id, spot_len, bio_spot_len, 0, argc == 4, grp, len);
-}
-
-static
-rc_t CC sra_meta_stats_cmp_trigger(void *data, const VXformInfo *info, int64_t row_id,
-                                   VRowResult *rslt, uint32_t argc, const VRowData argv[])
-{
-    uint32_t i, bio_spot_len;
-    const char* grp = NULL;
-    uint64_t len = 0;
-
-    uint32_t cmp_spot_len = argv[0].u.data.elem_count;
-    uint32_t spot_len = argv[1].u.data.elem_count;
-    /* take nreads from read_len */
-    uint32_t nreads = argv[2].u.data.elem_count;
-    /* get read_len and read_type */
-    const INSDC_coord_len *read_len = argv[2].u.data.base;
-    const INSDC_SRA_xread_type *read_type = argv[3].u.data.base;
-    read_len += argv[2].u.data.first_elem;
-    read_type += argv[3].u.data.first_elem;
-
-    assert(data != NULL);
-    assert(argc >= 4 && argc <= 5);
-    assert(nreads == argv[3].u.data.elem_count);
-
-    for(i = bio_spot_len = 0; i < nreads; i++) {
-        if( (read_type[i] & SRA_READ_TYPE_BIOLOGICAL) != 0 ) {
-            bio_spot_len += read_len[i];
-        }
-    }
-    if( argc == 5 ) {
-        /* get group name and length */
-        grp = argv[4].u.data.base;
-        len = argv[4].u.data.elem_count;
-        grp += argv[4].u.data.first_elem;
-    }
-    return sra_meta_stats_update(data, row_id, spot_len, bio_spot_len, cmp_spot_len, argc == 5, grp, len);
-}
-
-static
-rc_t CC sra_meta_stats_cmpf_trigger(void *data, const VXformInfo *info, int64_t row_id,
-                                   VRowResult *rslt, uint32_t argc, const VRowData argv[])
-{
-    uint32_t i, bio_spot_len;
-    const char* grp = NULL;
-    uint64_t len = 0;
-
-    uint32_t cmp_spot_len = argv[0].u.data.elem_count;
-    const uint32_t* spot_len = argv[1].u.data.base;
-    /* take nreads from read_len */
-    uint32_t nreads = argv[2].u.data.elem_count;
-    /* get read_len and read_type */
-    const INSDC_coord_len *read_len = argv[2].u.data.base;
-    const INSDC_SRA_xread_type *read_type = argv[3].u.data.base;
-    spot_len += argv[1].u.data.first_elem;
-    read_len += argv[2].u.data.first_elem;
-    read_type += argv[3].u.data.first_elem;
-
-    assert(data != NULL);
-    assert(argc >= 4 && argc <= 5);
-    assert(nreads == argv[3].u.data.elem_count);
-
-    for(i = bio_spot_len = 0; i < nreads; i++) {
-        if( (read_type[i] & SRA_READ_TYPE_BIOLOGICAL) != 0 ) {
-            bio_spot_len += read_len[i];
-        }
-    }
-    if( argc == 5 ) {
-        /* get group name and length */
-        grp = argv[4].u.data.base;
-        len = argv[4].u.data.elem_count;
-        grp += argv[4].u.data.first_elem;
-    }
-    return sra_meta_stats_update(data, row_id, *spot_len, bio_spot_len, cmp_spot_len, argc == 5, grp, len);
-}
-
-VTRANSFACT_IMPL ( NCBI_SRA_stats_trigger, 1, 0, 0 )
-    ( const void *self, const VXfactInfo *info, VFuncDesc *rslt,
-      const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rc_t rc;
-    sra_meta_stats_data *data;
-
-    assert(dp->argc >= 3 && dp->argc <= 4);
-
-    if( (rc = sra_meta_stats_make(&data, (VTable*)info->tbl, dp->argc > 3, false)) == 0 ) {
-        rslt->self = data;
-        rslt->whack = sra_meta_stats_whack;
-        rslt->variant = vftNonDetRow;
-        rslt->u.rf = sra_meta_stats_trigger;
-    }
-    return rc;
-}
-
-VTRANSFACT_IMPL ( NCBI_SRA_cmp_stats_trigger, 1, 0, 0 )
-    ( const void *self, const VXfactInfo *info, VFuncDesc *rslt,
-      const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rc_t rc;
-    sra_meta_stats_data *data;
-
-    assert(dp->argc >= 4 && dp->argc <= 5);
-
-    if( (rc = sra_meta_stats_make(&data, (VTable*)info->tbl, dp->argc > 4, true)) == 0 ) {
-        rslt->self = data;
-        rslt->whack = sra_meta_stats_whack;
-        rslt->variant = vftNonDetRow;
-        rslt->u.rf = sra_meta_stats_cmp_trigger;
-    }
-    return rc;
-}
-
-VTRANSFACT_IMPL ( NCBI_SRA_cmpf_stats_trigger, 1, 0, 0 )
-    ( const void *self, const VXfactInfo *info, VFuncDesc *rslt,
-      const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rc_t rc;
-    sra_meta_stats_data *data;
-
-    assert(dp->argc >= 4 && dp->argc <= 5);
-
-    if( (rc = sra_meta_stats_make(&data, (VTable*)info->tbl, dp->argc > 4, true)) == 0 ) {
-        rslt->self = data;
-        rslt->whack = sra_meta_stats_whack;
-        rslt->variant = vftNonDetRow;
-        rslt->u.rf = sra_meta_stats_cmpf_trigger;
-    }
-    return rc;
-}
diff --git a/libs/sraxf/stats_quality.c b/libs/sraxf/stats_quality.c
deleted file mode 100644
index ddc42a3..0000000
--- a/libs/sraxf/stats_quality.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include <sra/sradb.h>
-#include <vdb/xform.h>
-#include <vdb/table.h>
-#include <klib/data-buffer.h>
-#include <klib/text.h>
-#include <klib/rc.h>
-#include <kdb/meta.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-#define MAX_QUALITY (256)
-
-typedef struct phred_stats_data_struct {
-    KMetadata* meta;
-    KMDataNode* root;
-    uint64_t count[MAX_QUALITY];
-} phred_stats_data;
-
-static
-void CC phred_stats_whack( void *data )
-{
-    uint32_t i;
-    phred_stats_data* self = data;
-
-    for(i = 0; i < MAX_QUALITY; i++) {
-        if( self->count[i] > 0 ) {
-            KMDataNode* node;
-            if( KMDataNodeOpenNodeUpdate(self->root, &node, "PHRED_%u", i) == 0 ) {
-                KMDataNodeWriteB64(node, &self->count[i]);
-                KMDataNodeRelease(node);
-            }
-        }
-    }
-    KMDataNodeRelease(self->root);
-    KMetadataRelease(self->meta);
-    free(self);
-}
-
-static
-rc_t phred_stats_make(phred_stats_data** self, VTable* vtbl)
-{
-    rc_t rc = 0;
-    phred_stats_data* data = calloc(1, sizeof(*data));
-
-    assert(self != NULL && vtbl != NULL);
-
-    if( data == NULL ) {
-        rc = RC(rcVDB, rcFunction, rcConstructing, rcMemory, rcExhausted);
-    } else if( (rc = VTableOpenMetadataUpdate(vtbl, &data->meta)) == 0 ) {
-        rc = KMetadataOpenNodeUpdate(data->meta, &data->root, "STATS/QUALITY");
-    }
-    if( rc == 0 ) {
-        *self = data;
-    } else {
-        phred_stats_whack(data);
-    }
-    return rc;
-}
-
-static
-rc_t CC phred_stats_trigger(void *data, const VXformInfo *info, int64_t row_id,
-                              VRowResult *rslt, uint32_t argc, const VRowData argv[])
-{
-    rc_t rc = 0;
-    phred_stats_data* self = data;
-    uint64_t len;
-
-    assert(self != NULL);
-    assert(argc == 1);
-    assert(argv[0].u.data.elem_bits == (sizeof(INSDC_quality_phred) * 8));
-
-    len = argv[0].u.data.elem_count;
-    if( len > 0 ) {
-        const INSDC_quality_phred* q = argv[0].u.data.base;
-        assert(argv[0].u.data.base != NULL);
-        q += argv[0].u.data.first_elem;
-        do {
-            self->count[q[--len]]++;
-        } while( len > 0 );
-    }
-    return rc;
-}
-
-VTRANSFACT_IMPL ( NCBI_SRA_phred_stats_trigger, 1, 0, 0 )
-    ( const void *self, const VXfactInfo *info, VFuncDesc *rslt,
-      const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rc_t rc;
-    phred_stats_data *data;
-
-    assert(dp->argc == 1);
-
-    if( (rc = phred_stats_make(&data, (VTable*)info->tbl)) == 0 ) {
-        rslt->self = data;
-        rslt->whack = phred_stats_whack;
-        rslt->variant = vftNonDetRow;
-        rslt->u.rf = phred_stats_trigger;
-    }
-    return rc;
-}
diff --git a/libs/sraxf/swap.c b/libs/sraxf/swap.c
deleted file mode 100644
index 221c195..0000000
--- a/libs/sraxf/swap.c
+++ /dev/null
@@ -1,228 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/table.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <bitstr.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-
-typedef void (*swap_f)(void *dst, uint64_t offset, const void *src, const void *Cntrl, uint64_t vec_count);
-typedef struct self_t {
-    swap_f f;
-} self_t;
-
-#define SWAP_0(A, B) A = B
-#define SWAP_1(A, B) do { (A).data[0] = (B).data[1]; (A).data[1] = (B).data[0]; (A).data[2] = (B).data[2]; (A).data[3] = (B).data[3]; } while (0)
-#define SWAP_2(A, B) do { (A).data[0] = (B).data[2]; (A).data[1] = (B).data[1]; (A).data[2] = (B).data[0]; (A).data[3] = (B).data[3]; } while (0)
-#define SWAP_3(A, B) do { (A).data[0] = (B).data[3]; (A).data[1] = (B).data[1]; (A).data[2] = (B).data[2]; (A).data[3] = (B).data[0]; } while (0)
-
-#define FUNC(VALTYPE) F_ ## VALTYPE
-
-#define FUNC_DEF(VALTYPE)                                               \
-    static void FUNC(VALTYPE)(void *Dst, uint64_t offset, const void *Src, const void *Cntrl, uint64_t count) { \
-        typedef struct { VALTYPE data[4]; } data4_t;                    \
-        data4_t *dst = (data4_t *)Dst;                                  \
-        const data4_t *src = (const data4_t *)Src;                      \
-        const uint8_t *cntrl = (const uint8_t *)Cntrl;                  \
-        uint64_t i;                                                     \
-                                                                        \
-        dst += offset;                                                  \
-        for (i = 0; i != count; ++i) {                                  \
-            switch(cntrl[i]) {                                          \
-            default:                                                    \
-            case 0:                                                     \
-                SWAP_0(dst[i], src[i]);                                 \
-                break;                                                  \
-            case 1:                                                     \
-                SWAP_1(dst[i], src[i]);                                 \
-                break;                                                  \
-            case 2:                                                     \
-                SWAP_2(dst[i], src[i]);                                 \
-                break;                                                  \
-            case 3:                                                     \
-                SWAP_3(dst[i], src[i]);                                 \
-                break;                                                  \
-            }                                                           \
-        }                                                               \
-    }
-
-FUNC_DEF(float)
-FUNC_DEF(double)
-FUNC_DEF(uint8_t)
-FUNC_DEF(uint16_t)
-FUNC_DEF(uint32_t)
-FUNC_DEF(uint64_t)
-FUNC_DEF(int8_t)
-FUNC_DEF(int16_t)
-FUNC_DEF(int32_t)
-FUNC_DEF(int64_t)
-
-static
-rc_t CC swap_drvr (
-                void *Self,
-                const VXformInfo *info,
-                int64_t row_id,
-                const VFixedRowResult *rslt,
-                uint32_t argc,
-                const VRowData argv []
-) {
-    const uint8_t *src;
-    const uint8_t *cntrl;
-    const self_t *self = (const self_t *)Self;
-    
-    assert(argv[0].u.data.elem_bits % 8 == 0);
-    assert(argv[1].u.data.elem_bits % 8 == 0);
-    
-    src    = argv[0].u.data.base;
-    src   += (argv[0].u.data.first_elem * argv[0].u.data.elem_bits) / 8;
-
-    cntrl  = argv[1].u.data.base;
-    cntrl += (argv[1].u.data.first_elem * argv[1].u.data.elem_bits) / 8;
-    
-    self->f(rslt->base, rslt->first_elem, src, cntrl, rslt->elem_count);
-    
-    return 0;
-}
-
-static
-void CC sraxf_swap_free_wrapper( void *ptr )
-{
-	free( ptr );
-}
-
-/* 
- * function < type T > T [ 4 ] NCBI:SRA:swap #1 ( T [ 4 ] in, U8 called );
- */
-VTRANSFACT_IMPL ( NCBI_SRA_swap, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    self_t *self;
-    
-    switch (info->fdesc.desc.domain) {
-    case vtdInt:
-    case vtdUint:
-        switch (info->fdesc.desc.intrinsic_bits) {
-        case 8:
-        case 16:
-        case 32:
-        case 64:
-            break;
-        default:
-            return RC(rcXF, rcFunction, rcConstructing, rcType, rcInvalid);
-            break;
-        }
-        break;
-    case vtdFloat:
-        switch (info->fdesc.desc.intrinsic_bits) {
-        case 32:
-        case 64:
-            break;
-        default:
-            return RC(rcXF, rcFunction, rcConstructing, rcType, rcInvalid);
-            break;
-        }
-        break;
-    default:
-        return RC(rcXF, rcFunction, rcConstructing, rcType, rcInvalid);
-        break;
-    }
-    
-    self = malloc(sizeof(*self));
-    if (self) {
-        switch (info->fdesc.desc.domain) {
-        case vtdInt:
-            switch (info->fdesc.desc.intrinsic_bits) {
-            case 8:
-                self->f = FUNC(int8_t);
-                break;
-            case 16:
-                self->f = FUNC(int16_t);
-                break;
-            case 32:
-                self->f = FUNC(int32_t);
-                break;
-            case 64:
-                self->f = FUNC(int64_t);
-                break;
-            default:
-                break;
-            }
-            break;
-        case vtdUint:
-            switch (info->fdesc.desc.intrinsic_bits) {
-            case 8:
-                self->f = FUNC(uint8_t);
-                break;
-            case 16:
-                self->f = FUNC(uint16_t);
-                break;
-            case 32:
-                self->f = FUNC(uint32_t);
-                break;
-            case 64:
-                self->f = FUNC(uint64_t);
-                break;
-            default:
-                break;
-            }
-            break;
-        case vtdFloat:
-            switch (info->fdesc.desc.intrinsic_bits) {
-            case 32:
-                self->f = FUNC(float);
-                break;
-            case 64:
-                self->f = FUNC(double);
-                break;
-            default:
-                break;
-            }
-            break;
-        default:
-            break;
-        }
-        
-        rslt->self = self;
-        rslt->whack = sraxf_swap_free_wrapper;
-        rslt->u.pf = swap_drvr;
-        rslt->variant = vftFixedRow;
-        
-        return 0;
-    }
-    return RC(rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted);
-}
diff --git a/libs/sraxf/tokenize-spot_name-454.c b/libs/sraxf/tokenize-spot_name-454.c
deleted file mode 100644
index a801272..0000000
--- a/libs/sraxf/tokenize-spot_name-454.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include <sra/sradb.h>
-#include <vdb/xform.h>
-#include <klib/data-buffer.h>
-#include <klib/text.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-#include "name-tokenizer.h"
-
-static
-rc_t CC tokenize_spot_name_454 ( void *self, const VXformInfo *info, int64_t row_id,
-                              VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    const char *name;
-    unsigned region_start;
-    unsigned q_start;
-    unsigned i;
-    spot_name_token_t *spot_name_tok;
-    const int EXPECTED_NUMBER_OF_TOKENS = 2;
-    
-    assert(rslt->elem_bits == sizeof(spot_name_tok[0]) * 8);
-    rslt->data->elem_bits = sizeof(spot_name_tok[0]) * 8;
-    if( (rc = KDataBufferResize(rslt->data, EXPECTED_NUMBER_OF_TOKENS)) != 0 ) {
-        return rc;
-    }
-    
-    spot_name_tok = rslt->data->base;
-    
-    spot_name_tok[0].s.token_type = nt_unrecognized;
-    spot_name_tok[0].s.position = 0;
-    spot_name_tok[0].s.length = argv[0].u.data.elem_count;
-    rslt->elem_count = 1;
-    
-    /* /^(.{7})([0-9]{2})([A-Z0-9]{5})$/ = (name, region, XY_q) = ($1, $2, $3); */
-    if (argv[0].u.data.elem_count != 14 ) {
-        return 0;
-    }
-    
-    name = &((const char *)argv[0].u.data.base)[argv[0].u.data.first_elem];
-    q_start = argv[0].u.data.elem_count - 5;
-    region_start = q_start - 2;
-    
-    /* validate that XY_q =~ /[A-Z0-9]{5}/ */
-    for(i = 0; i != 5; i++) {
-        if(!((name[i + q_start] >= 'A' && name[i + q_start] <= 'Z') || (name[i + q_start] >= '0' && name[i + q_start] <= '9'))) {
-            return 0;
-        }
-    }
-    /* validate that region =~ /[0-9]{2}/ */
-    if( !(name[region_start] >= '0' && name[region_start] <= '9') ||
-        !(name[region_start + 1] >= '0' && name[region_start + 1] <= '9') ) {
-        return 0;
-    }
-    spot_name_tok[0].s.token_type = nt_T;
-    spot_name_tok[0].s.position = region_start;
-    spot_name_tok[0].s.length = 2;
-    
-    spot_name_tok[1].s.token_type = nt_Q;
-    spot_name_tok[1].s.position = q_start;
-    spot_name_tok[1].s.length = 5;
-
-    rslt->elem_count = EXPECTED_NUMBER_OF_TOKENS;
-    return 0;
-}
-
-/* tokenize_spot_name
- *  scans name on input
- *  tokenizes into parts
-
-typedef U16 NCBI:SRA:spot_name_token [ 3 ];
-const U16 NCBI:SRA:name_token:unrecognized = 1;
-const U16 NCBI:SRA:name_token:X            = 2;
-const U16 NCBI:SRA:name_token:Y            = 3;
-const U16 NCBI:SRA:name_token:Q            = 4;
-const U16 NCBI:SRA:name_token:T            = 5;
-const U16 NCBI:SRA:name_token:L            = 6;
-
-extern function NCBI:SRA:spot_name_token
-    NCBI:SRA:_454_:tokenize_spot_name #1 ( ascii name );
- */
-VTRANSFACT_IMPL ( NCBI_SRA__454__tokenize_spot_name, 1, 0, 0 ) ( const void *self,
-                  const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->variant = vftRow;
-    rslt->u.rf = tokenize_spot_name_454;
-    
-    return 0;
-}
diff --git a/libs/sraxf/tokenize-spot_name-abi.c b/libs/sraxf/tokenize-spot_name-abi.c
deleted file mode 100644
index f9b459b..0000000
--- a/libs/sraxf/tokenize-spot_name-abi.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include <sra/sradb.h>
-#include <vdb/xform.h>
-#include <klib/data-buffer.h>
-#include <klib/text.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-#include "name-tokenizer.h"
-
-static
-rc_t CC tokenize_spot_name_ABI ( void *self, const VXformInfo *info, int64_t row_id,
-                              VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    const char *name, *end;
-    spot_name_token_t *spot_name_tok;
-    const int EXPECTED_NUMBER_OF_TOKENS = 3;
-    int tok = EXPECTED_NUMBER_OF_TOKENS;
-    const uint16_t types[3] = {nt_T, nt_X, nt_Y};
-    
-    assert(rslt->elem_bits == sizeof(spot_name_tok[0]) * 8);
-    rslt->data->elem_bits = sizeof(spot_name_tok[0]) * 8;
-    if( (rc = KDataBufferResize(rslt->data, EXPECTED_NUMBER_OF_TOKENS)) != 0 ) {
-        return rc;
-    }
-    
-    spot_name_tok = rslt->data->base;
-    
-    /* reverse line parse by format:
-     Dig is -> [-+0-9]
-       /^(.*+)(Dig+)!Dig+(Dig+)!Dig+(Dig+)$/ = (run_name, panel, x, y) = ($1, $2, $3, $4)
-    */
-#define is_signum(a) (isdigit(a) || a == '-' || a == '+')
-
-    name = &((const char *)argv[0].u.data.base)[argv[0].u.data.first_elem];
-    end = name + argv[0].u.data.elem_count;
-    while(rc == 0 && end > name && tok > 0) {
-        const char* c, *last_end;
-        do {
-            last_end = end--;
-        } while( tok != EXPECTED_NUMBER_OF_TOKENS && end != name && !is_signum(*end) );
-        while( end != name && is_signum(*end) ) {
-            end--;
-        }
-        c = end;
-        if( !is_signum(*c) ) {
-            c++;
-        }
-        if( c >= last_end ) {
-            /* empty token */
-            break;
-        } else if( *c == '-' ) {
-            /* keep explicit - '-000' */
-            if( last_end - c >= 2 && *(c + 1) == '0' ) {
-                c++;
-                while( *c == '0' && (c + 1) < last_end ) { c++; }
-                if( *c != '0' ) {
-                    /* cannot tokenize -0004 */
-                    break;
-                }
-            }
-        } else {
-            if( *c == '+' ) {
-                /* keep explicit + */
-                c++;
-            }
-            /* keep leading zeroes */
-            while(*c == '0' && (c + 1) < last_end ) { c++; }
-        }
-        tok--;
-        spot_name_tok[tok].s.token_type = types[tok];
-        spot_name_tok[tok].s.position = c - name;
-        spot_name_tok[tok].s.length = last_end - c;
-        if( spot_name_tok[tok].s.length == 0 ) {
-            rc = RC(rcSRA, rcFormatter, rcReading, rcName, rcInvalid);
-        }
-        while(rc == 0 && c < last_end) {
-            if( *c < '0' || *c > '9' ) {
-                rc = RC(rcSRA, rcFormatter, rcReading, rcId, rcOutofrange);
-            }
-            c++;
-        }
-    }
-    if( rc == 0 && tok != 0 ) {
-        rc = RC(rcSRA, rcFormatter, rcReading, rcName, rcInvalid);
-    }
-    if( rc != 0 ) {
-        spot_name_tok[0].s.token_type = nt_unrecognized;
-        spot_name_tok[0].s.position = 0;
-        spot_name_tok[0].s.length = argv[0].u.data.elem_count;
-        rslt->elem_count = 1;
-    } else {
-        rslt->elem_count = EXPECTED_NUMBER_OF_TOKENS;
-    }
-    return 0;
-}
-
-/* tokenize_spot_name
- *  scans name on input
- *  tokenizes into parts
-
- extern function NCBI:SRA:spot_name_token
-    NCBI:SRA:ABI:tokenize_spot_name #1 ( ascii name );
- */
-VTRANSFACT_IMPL ( NCBI_SRA_ABI_tokenize_spot_name, 1, 0, 0 ) ( const void *self,
-                  const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->variant = vftRow;
-    rslt->u.rf = tokenize_spot_name_ABI;
-    
-    return 0;
-}
diff --git a/libs/sraxf/tokenize-spot_name-helicos.c b/libs/sraxf/tokenize-spot_name-helicos.c
deleted file mode 100644
index 7c5054d..0000000
--- a/libs/sraxf/tokenize-spot_name-helicos.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include <sra/sradb.h>
-#include <vdb/xform.h>
-#include <klib/data-buffer.h>
-#include <klib/text.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-#include "name-tokenizer.h"
-
-static
-rc_t CC tokenize_spot_name_Helicos( void *self, const VXformInfo *info, int64_t row_id,
-                                    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    const char *name, *end;
-    spot_name_token_t *spot_name_tok;
-    const int EXPECTED_NUMBER_OF_TOKENS = 4;
-    int tok = EXPECTED_NUMBER_OF_TOKENS;
-    const uint16_t types[4] = {nt_L, nt_T, nt_X, nt_Y };
-    
-    assert(rslt->elem_bits == sizeof(spot_name_tok[0]) * 8);
-    rslt->data->elem_bits = sizeof(spot_name_tok[0]) * 8;
-    if( (rc = KDataBufferResize(rslt->data, EXPECTED_NUMBER_OF_TOKENS)) != 0 ) {
-        return rc;
-    }
-    
-    spot_name_tok = rslt->data->base;
-    
-    /* reverse line parse by format:
-       /^(.+)-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)$/ = 
-        (name, channel, field, camera, position) = ($1, $2, $3, $4, $5)
-    */
-    name = &((const char *)argv[0].u.data.base)[argv[0].u.data.first_elem];
-    end = name + argv[0].u.data.elem_count;
-
-    while(rc == 0 && end > name && tok > 0 ) {
-        size_t l = 0;
-        while( isdigit(*--end) && end > name ) {
-            l++;
-        }
-        if( *end != '-' || l == 0 ) {
-            rc = RC(rcSRA, rcFormatter, rcReading, rcName, rcUnrecognized);
-        } else {
-            tok--;
-            spot_name_tok[tok].s.token_type = types[tok];
-            spot_name_tok[tok].s.position = end - name + 1;
-            spot_name_tok[tok].s.length = l;
-        }
-    }
-    if( rc == 0 && tok != 0 ) {
-        rc = RC(rcSRA, rcFormatter, rcReading, rcName, rcInvalid);
-    }
-    if( rc != 0 ) {
-        spot_name_tok[0].s.token_type = nt_unrecognized;
-        spot_name_tok[0].s.position = 0;
-        spot_name_tok[0].s.length = argv[0].u.data.elem_count;
-        rslt->elem_count = 1;
-    } else {
-        rslt->elem_count = EXPECTED_NUMBER_OF_TOKENS;
-    }
-    return 0;
-}
-
-/* tokenize_spot_name
- *  scans name on input
- *  tokenizes into parts
-
- extern function NCBI:SRA:spot_name_token
-    NCBI:SRA:Helicos:tokenize_spot_name #1 ( ascii name );
- */
-VTRANSFACT_IMPL ( NCBI_SRA_Helicos_tokenize_spot_name, 1, 0, 0 ) ( const void *self,
-                  const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->variant = vftRow;
-    rslt->u.rf = tokenize_spot_name_Helicos;
-    
-    return 0;
-}
diff --git a/libs/sraxf/tokenize-spot_name-illumina.c b/libs/sraxf/tokenize-spot_name-illumina.c
deleted file mode 100644
index c408592..0000000
--- a/libs/sraxf/tokenize-spot_name-illumina.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include <sra/sradb.h>
-#include <vdb/xform.h>
-#include <klib/data-buffer.h>
-#include <klib/text.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-#include "name-tokenizer.h"
-
-static
-rc_t CC tokenize_spot_name_Illumina ( void *self, const VXformInfo *info, int64_t row_id,
-                                   VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    const char *name, *end;
-    spot_name_token_t *spot_name_tok;
-    bool saw_end_float = false;
-    const int EXPECTED_NUMBER_OF_TOKENS = 4;
-    int tok = EXPECTED_NUMBER_OF_TOKENS;
-    const uint16_t types[4] = {nt_L, nt_T, nt_X, nt_Y };
-    
-    assert(rslt->elem_bits == sizeof(spot_name_tok[0]) * 8);
-    rslt->data->elem_bits = sizeof(spot_name_tok[0]) * 8;
-    if( (rc = KDataBufferResize(rslt->data, EXPECTED_NUMBER_OF_TOKENS)) != 0 ) {
-        return rc;
-    }
-    
-    spot_name_tok = rslt->data->base;
-    
-    /* reverse line parse by format:
-       /^(.+)[_:|]([0-9]+)[_:|]([0-9]+)[_:|]([+-0-9]+)[_:|]([+-0-9]+)([_:|][0-9]+?\.[0-9]+)?$/ = 
-        (name, lane, tile, x, y, float?) = ($1, $2, $3, $4, $5, $6?)
-    */
-    name = &((const char *)argv[0].u.data.base)[argv[0].u.data.first_elem];
-    end = name + argv[0].u.data.elem_count;
-    while(rc == 0 && end > name && tok > 0 ) {
-        const char* last_end = end--;
-        bool not_numeric = false;
-        char has_sign = 0;
-        while( end >= name && strchr(":|_", *end) == NULL ) {
-            if( !isdigit(*end) ) {
-                not_numeric = true;
-                if( (*end == '-' || *end == '+') && !has_sign ) {
-                    has_sign = *end;
-                    not_numeric = false;
-                }
-            }
-            end--;
-        }
-        end++;
-        if( not_numeric ) {
-            if( !saw_end_float ) {
-                /* skip optional trailing not integer number */
-                saw_end_float = true;
-            } else {
-                rc = RC(rcSRA, rcFormatter, rcReading, rcName, rcInvalid);
-            }
-        } else {
-            const char* c = end;
-            if( *c == '-' ) {
-                /* keep explicit - '-000' */
-                if( last_end - c >= 2 && *(c + 1) == '0' ) {
-                    c++;
-                    while( *c == '0' && (c + 1) < last_end ) { c++; }
-                    if( *c != '0' ) {
-                        /* cannot tokenize -0004 */
-                        break;
-                    }
-                }
-            } else {
-                if( *c == '+' ) {
-                    /* keep explicit + */
-                    c++;
-                }
-                /* keep leading zeroes */
-                while(*c == '0' && (c + 1) < last_end ) { c++; }
-            }
-            tok--;
-            spot_name_tok[tok].s.token_type = types[tok];
-            spot_name_tok[tok].s.position = c - name;
-            spot_name_tok[tok].s.length = last_end - c;
-            if( spot_name_tok[tok].s.length == 0 ) {
-                rc = RC(rcSRA, rcFormatter, rcReading, rcName, rcInvalid);
-            }
-        }
-        /* back up to separator */
-        end--;
-    }
-    if( rc == 0 && tok != 0 ) {
-        rc = RC(rcSRA, rcFormatter, rcReading, rcName, rcInvalid);
-    }
-    if( rc != 0 ) {
-        spot_name_tok[0].s.token_type = nt_unrecognized;
-        spot_name_tok[0].s.position = 0;
-        spot_name_tok[0].s.length = argv[0].u.data.elem_count;
-        rslt->elem_count = 1;
-    } else {
-        rslt->elem_count = EXPECTED_NUMBER_OF_TOKENS;
-    }
-    return 0;
-}
-
-/* tokenize_spot_name
- *  scans name on input
- *  tokenizes into parts
-
- extern function NCBI:SRA:spot_name_token
-    NCBI:SRA:Illumina:tokenize_spot_name #1 ( ascii name );
- */
-VTRANSFACT_IMPL ( NCBI_SRA_Illumina_tokenize_spot_name, 1, 0, 0 ) ( const void *self,
-                  const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->variant = vftRow;
-    rslt->u.rf = tokenize_spot_name_Illumina;
-    
-    return 0;
-}
diff --git a/libs/sraxf/tokenize-spot_name-ion-torrent.c b/libs/sraxf/tokenize-spot_name-ion-torrent.c
deleted file mode 100644
index b7f6e98..0000000
--- a/libs/sraxf/tokenize-spot_name-ion-torrent.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include <sra/sradb.h>
-#include <vdb/xform.h>
-#include <klib/data-buffer.h>
-#include <klib/text.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-#include "name-tokenizer.h"
-
-static
-rc_t CC tokenize_spot_name_IonTorrent( void *self, const VXformInfo *info, int64_t row_id,
-                                       VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    const char *name, *end;
-    spot_name_token_t *spot_name_tok;
-    const int EXPECTED_NUMBER_OF_TOKENS = 2;
-    int tok = EXPECTED_NUMBER_OF_TOKENS;
-    const uint16_t types[4] = {nt_X, nt_Y};
-    
-    assert(rslt->elem_bits == sizeof(spot_name_tok[0]) * 8);
-    rslt->data->elem_bits = sizeof(spot_name_tok[0]) * 8;
-    rc = KDataBufferResize(rslt->data, EXPECTED_NUMBER_OF_TOKENS);
-    if( rc != 0 )
-        return rc;
-    
-    spot_name_tok = rslt->data->base;
-    
-    /* reverse line parse by format:
-       /^(.+):([0-9]+):([0-9]+)$/ = (name, x, x) = ($1, $2, $3)
-    */
-    name = argv[0].u.data.base;
-    name += argv[0].u.data.first_elem;
-    end = name + argv[0].u.data.elem_count;
-
-    while ( end > name && tok > 0 )
-    {
-        const char *num_start, *num_end = end;
-
-        /* examine least significant digit */
-        -- end;
-        if ( ! isdigit ( * end ) )
-            break;
-
-        /* any digit 0-9 is okay as least significant */
-        num_start = end;
-
-        /* examine remaining digits */
-        while ( end > name )
-        {
-            /* require 0-9 to stay within parse */
-            -- end;
-            if ( ! isdigit ( * end ) )
-                break;
-
-            /* only reset numeric start if not 0 */
-            if ( * end != '0' )
-                num_start = end;
-        }
-
-        /* should have stopped on ':' */
-        if ( *end != ':' )
-            break;
-
-        /* we have a numeric token
-           due to oddities, exclude leading zeros from numeral */
-        -- tok;
-        spot_name_tok[tok].s.token_type = types[tok];
-        spot_name_tok[tok].s.position = num_start - name;
-        spot_name_tok[tok].s.length = num_end - num_start;
-    }
-
-    /* if all tokens were seen, the parse was good */
-    if( tok == 0 )
-        rslt->elem_count = EXPECTED_NUMBER_OF_TOKENS;
-    else
-    {
-        /* otherwise, treat entire string as unrecognized */
-        spot_name_tok[0].s.token_type = nt_unrecognized;
-        spot_name_tok[0].s.position = 0;
-        spot_name_tok[0].s.length = argv[0].u.data.elem_count;
-        rslt->elem_count = 1;
-    }
-
-    return 0;
-}
-
-/* tokenize_spot_name
- *  scans name on input
- *  tokenizes into parts
-
- extern function NCBI:SRA:spot_name_token
-    NCBI:SRA:IonTorrent:tokenize_spot_name #1 ( ascii name );
- */
-VTRANSFACT_IMPL ( NCBI_SRA_IonTorrent_tokenize_spot_name, 1, 0, 0 ) ( const void *self,
-                  const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->variant = vftRow;
-    rslt->u.rf = tokenize_spot_name_IonTorrent;
-    
-    return 0;
-}
diff --git a/libs/sraxf/untyped-priv.h b/libs/sraxf/untyped-priv.h
deleted file mode 100644
index d0c9ea2..0000000
--- a/libs/sraxf/untyped-priv.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_untyped_priv
-#define _h_untyped_priv
-
-/* 454_untyped_0
- *  recognizes all runs produced with v0 loader
- */
-bool NCBI_SRA__454__untyped_0 ( const KTable *tbl, const KMetadata *meta );
-
-
-/* 454_untyped_1_2a
- *  recognizes runs produced with v1.2 loader
- *  where the linker is present
- *  and a physical READ_SEG is present
- */
-bool NCBI_SRA__454__untyped_1_2a ( const KTable *tbl, const KMetadata *meta );
-
-
-/* 454_untyped_1_2b
- *  recognizes runs produced with v1.2 loader
- *  where the linker is missing or empty
- *  and a physical READ_SEG is present
- */
-bool NCBI_SRA__454__untyped_1_2b ( const KTable *tbl, const KMetadata *meta );
-
-
-/* Illumina_untyped_0a
- *  recognizes runs produced with v0 loader with 4-channel QUALITY
- */
-bool NCBI_SRA_Illumina_untyped_0a ( const KTable *tbl, const KMetadata *meta );
-
-
-/* Illumina_untyped_0b
- *  recognizes runs produced with v0 loader with single-channel QUALITY or QUALITY2
- */
-bool NCBI_SRA_Illumina_untyped_0b ( const KTable *tbl, const KMetadata *meta );
-
-
-/* Illumina_untyped_1a
- *  recognizes runs produced with v1 srf and native loaders
- *  having 4-channel qualities
- */
-bool NCBI_SRA_Illumina_untyped_1a ( const KTable *tbl, const KMetadata *meta );
-
-
-/* Illumina_untyped_1b
- *  recognizes runs produced with all v1 loaders
- *  having single-channel qualities
- */
-bool NCBI_SRA_Illumina_untyped_1b ( const KTable *tbl, const KMetadata *meta );
-
-
-/* ABI_untyped_1
- *  recognizes runs produced with all v1 loaders
- */
-bool NCBI_SRA_ABI_untyped_1 ( const KTable *tbl, const KMetadata *meta );
-
-#endif
diff --git a/libs/sraxf/untyped.c b/libs/sraxf/untyped.c
deleted file mode 100644
index 4b62869..0000000
--- a/libs/sraxf/untyped.c
+++ /dev/null
@@ -1,378 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include <sra/sradb.h>
-#include <vdb/xform.h>
-#include <vdb/vdb-priv.h>
-#include <kdb/manager.h>
-#include <kdb/table.h>
-#include <kdb/column.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-static
-bool KMetadataStrEqual ( const KMetadata *meta, const char *path, const char *str )
-{
-    const KMDataNode *node;
-    rc_t rc = KMetadataOpenNodeRead ( meta, & node, path );
-    if ( rc == 0 )
-    {
-        size_t num_read;
-        char buff [ 4096 ];
-        rc = KMDataNodeReadCString ( node, buff, sizeof buff, & num_read );
-        KMDataNodeRelease ( node );
-        if ( rc == 0 )
-        {
-            if ( strcmp ( buff, str ) == 0 )
-                return true;
-        }
-    }
-
-    return false;
-}
-
-static
-bool KMetadataNumEqual ( const KMetadata *meta, const char *path, int64_t num )
-{
-    const KMDataNode *node;
-    rc_t rc = KMetadataOpenNodeRead ( meta, & node, path );
-    if ( rc == 0 )
-    {
-        int64_t i;
-        rc = KMDataNodeReadAsI64 ( node, & i );
-        KMDataNodeRelease ( node );
-        if ( rc == 0 )
-        {
-            if ( i == num )
-                return true;
-        }
-    }
-
-    return false;
-}
-
-static
-bool KMetadataVersEqual ( const KMetadata *meta, const char *name, const char *vers )
-{
-    bool equal = false;
-    const KMDataNode *node;
-    rc_t rc = KMetadataOpenNodeRead ( meta, & node, "SOFTWARE/loader" );
-    if ( rc == 0 )
-    {
-        size_t num_read;
-        char attr [ 256 ];
-        rc = KMDataNodeReadAttr ( node, "name", attr, sizeof attr, & num_read );
-        if ( rc == 0 )
-        {
-            if ( memcmp ( attr, name, strlen ( name ) ) == 0 )
-            {
-                if ( vers == NULL || vers [ 0 ] == 0 )
-                    equal = true;
-                else
-                {
-                    rc = KMDataNodeReadAttr ( node, "vers", attr, sizeof attr, & num_read );
-                    if ( rc == 0 )
-                    {
-                        if ( memcmp ( attr, vers, strlen ( vers ) ) == 0 )
-                            equal = true;
-                    }
-                }
-            }
-        }
-
-        KMDataNodeRelease ( node );
-    }
-
-    return equal;
-}
-
-static
-bool KMetadataExists ( const KMetadata *meta, const char *path )
-{
-    const KMDataNode *node;
-    rc_t rc = KMetadataOpenNodeRead ( meta, & node, path );
-    if ( rc != 0 )
-        return false;
-    KMDataNodeRelease ( node );
-    return true;
-}
-
-static
-bool KMetadataEmpty ( const KMetadata *meta, const char *path )
-{
-    size_t num_read, remaining;
-    const KMDataNode *node;
-    rc_t rc = KMetadataOpenNodeRead ( meta, & node, path );
-    if ( rc != 0 )
-        return true;
-    rc = KMDataNodeRead ( node, 0, & num_read, 0, & num_read, & remaining );
-    KMDataNodeRelease ( node );
-    if ( rc == 0 && remaining != 0 )
-        return false;
-    return true;
-}
-
-static
-bool KColumnTypeEqual ( const KTable *tbl, const char *col, const char *type )
-{
-    /* TBD - this operation is expensive
-       should be addressed either by caching opened columns on table
-       or by introducing a path to open column metadata from table */
-    const KColumn *kcol;
-    rc_t rc = KTableOpenColumnRead ( tbl, & kcol, col );
-    if ( rc == 0 )
-    {
-        const KMetadata *meta;
-        rc = KColumnOpenMetadataRead ( kcol, & meta );
-        KColumnRelease ( kcol );
-        if ( rc == 0 )
-        {
-            /* this is a expected to be a v1 column
-               open its decoding node */
-            const KMDataNode *node;
-            rc = KMetadataOpenNodeRead ( meta, & node, "decoding" );
-            KMetadataRelease ( meta );
-            if ( rc == 0 )
-            {
-                /* read its type */
-                size_t size;
-                char type_expr [ 256 ];
-                rc = KMDataNodeReadAttr ( node, "type",
-                    type_expr, sizeof type_expr, & size );
-                KMDataNodeRelease ( node );
-                if ( rc == 0 )
-                {
-                    if ( memcmp ( type_expr, type, strlen ( type ) ) == 0 )
-                        return true;
-                }
-            }
-        }
-    }
-    return false;
-}
-
-
-/* accept_untyped
- *  recognizes any table at all
- *  used by admin to correct corrupt tables
- */
-MOD_EXPORT
-bool CC NCBI_SRA_accept_untyped ( const KTable *tbl, const KMetadata *meta )
-{
-    return true;
-}
-
-
-/* 454_untyped_0
- *  recognizes all runs produced with v0 loader
- */
-MOD_EXPORT
-bool CC NCBI_SRA__454__untyped_0 ( const KTable *tbl, const KMetadata *meta )
-{
-    if ( KMetadataStrEqual ( meta, "PLATFORM", "454" ) )
-    {
-        if ( ! KMetadataExists ( meta, "SOFTWARE" ) )
-        {
-            if ( KMetadataExists ( meta, "MSC454_FLOW_CHARS" ) &&
-                 KMetadataExists ( meta, "MSC454_KEY_SEQUENCE" ) )
-            {
-                /* don't bother looking at columns */
-                return true;
-            }
-        }
-    }
-    return false;
-}
-
-
-/* 454_untyped_1_2a
- *  recognizes runs produced with v1.2 loader
- *  where the linker is present
- *  and a physical READ_SEG is present
- */
-MOD_EXPORT
-bool CC NCBI_SRA__454__untyped_1_2a ( const KTable *tbl, const KMetadata *meta )
-{
-    if ( KMetadataVersEqual ( meta, "sff-load", "1" ) ||
-         KMetadataVersEqual ( meta, "sff-load", "0" ) )
-    {
-        if ( KMetadataExists ( meta, "col/NREADS" ) )
-        {
-            if ( ! KMetadataEmpty ( meta, "col/LINKER_SEQUENCE/row" ) )
-                return KTableExists ( tbl, kptColumn, "READ_SEG" );
-        }
-    }
-    return false;
-}
-
-
-/* 454_untyped_1_2b
- *  recognizes runs produced with v1.2 loader
- *  where the linker is missing or empty
- *  and a physical READ_SEG is present
- */
-MOD_EXPORT
-bool CC NCBI_SRA__454__untyped_1_2b ( const KTable *tbl, const KMetadata *meta )
-{
-    if ( KMetadataVersEqual ( meta, "sff-load", "1" ) ||
-         KMetadataVersEqual ( meta, "sff-load", "0" ) )
-    {
-        if ( KMetadataExists ( meta, "col/NREADS" ) )
-        {
-            if ( KMetadataEmpty ( meta, "col/LINKER_SEQUENCE/row" ) )
-                return KTableExists ( tbl, kptColumn, "READ_SEG" );
-        }
-    }
-    return false;
-}
-
-
-/* Illumina_untyped_0a
- *  recognizes runs produced with v0 loader with 4-channel QUALITY
- */
-MOD_EXPORT
-bool CC NCBI_SRA_Illumina_untyped_0a ( const KTable *tbl, const KMetadata *meta )
-{
-    if ( KMetadataStrEqual ( meta, "PLATFORM", "SOLEXA" ) )
-    {
-        if ( ! KMetadataExists ( meta, "SOFTWARE" ) )
-        {
-            if ( KMetadataNumEqual ( meta, "NUMBER_PRB_CHANNELS", 4 ) ||
-                 KMetadataNumEqual ( meta, "NUMBER_PRB_CHANNELS_1", 4 ) )
-            {
-                return true;
-            }
-        }
-    }
-    return false;
-}
-
-
-/* Illumina_untyped_0b
- *  recognizes runs produced with v0 loader with single-channel QUALITY or QUALITY2
- */
-MOD_EXPORT
-bool CC NCBI_SRA_Illumina_untyped_0b ( const KTable *tbl, const KMetadata *meta )
-{
-    if ( KMetadataStrEqual ( meta, "PLATFORM", "SOLEXA" ) )
-    {
-        if ( ! KMetadataExists ( meta, "SOFTWARE" ) )
-        {
-            if ( KMetadataNumEqual ( meta, "NUMBER_PRB_CHANNELS", 1 ) ||
-                 KMetadataNumEqual ( meta, "NUMBER_PRB_CHANNELS_1", 1 ) ||
-                 KMetadataNumEqual ( meta, "NUMBER_PRB_CHANNELS_2", 1 ) )
-            {
-                return true;
-            }
-        }
-    }
-    return false;
-}
-
-
-/* Illumina_untyped_1a
- *  recognizes runs produced with v1 srf and native loaders
- *  having 4-channel qualities
- */
-MOD_EXPORT
-bool CC NCBI_SRA_Illumina_untyped_1a ( const KTable *tbl, const KMetadata *meta )
-{
-    if ( KMetadataStrEqual ( meta, "PLATFORM", "ILLUMINA" ) )
-    {
-        if ( KMetadataVersEqual ( meta, "illumina-load", "1" ) ||
-             KMetadataVersEqual ( meta, "srf-load", "1" ) )
-        {
-            return KColumnTypeEqual ( tbl, "QUALITY", "NCBI:SRA:swapped_qual4" );
-        }
-    }
-    return false;
-}
-
-
-/* Illumina_untyped_1b
- *  recognizes runs produced with all v1 loaders
- *  having single-channel qualities
- */
-MOD_EXPORT
-bool CC NCBI_SRA_Illumina_untyped_1b ( const KTable *tbl, const KMetadata *meta )
-{
-    if ( KMetadataStrEqual ( meta, "PLATFORM", "ILLUMINA" ) )
-    {
-        if ( KMetadataVersEqual ( meta, "fastq-load", "1" ) ||
-             KMetadataVersEqual ( meta, "fastq-load", "0" ) )
-            return true;
-        if ( KMetadataVersEqual ( meta, "illumina-load", "1" ) ||
-             KMetadataVersEqual ( meta, "srf-load", "1" ) )
-        {
-            return ! KColumnTypeEqual ( tbl, "QUALITY", "NCBI:SRA:swapped_qual4" );
-        }
-    }
-    return false;
-}
-
-
-/* ABI_untyped_1
- *  recognizes runs produced with all v1 loaders
- */
-MOD_EXPORT
-bool CC NCBI_SRA_ABI_untyped_1 ( const KTable *tbl, const KMetadata *meta )
-{
-    if ( KMetadataStrEqual ( meta, "PLATFORM", "ABSOLID" ) )
-    {
-        if ( ! KMetadataExists ( meta, "SOFTWARE" ) ||
-             KMetadataVersEqual ( meta, "abi-load", "1" ) ||
-             KMetadataVersEqual ( meta, "srf-load", "1" ) )
-        {
-            return true;
-        }
-    }
-    return false;
-}
-
-
-/* this is here simply to force the compiler to check
-   the function signatures listed above against a
-   typedef for the function used by vdb. */
-#if _DEBUGGING
-VUntypedFunc test_signature [] =
-{
-    NCBI_SRA__454__untyped_0,
-    NCBI_SRA__454__untyped_1_2a,
-    NCBI_SRA__454__untyped_1_2b,
-    NCBI_SRA_Illumina_untyped_0a,
-    NCBI_SRA_Illumina_untyped_0b,
-    NCBI_SRA_Illumina_untyped_1a,
-    NCBI_SRA_Illumina_untyped_1b,
-    NCBI_SRA_ABI_untyped_1
-};
-#endif
diff --git a/libs/sraxf/v0-decompress-init.c b/libs/sraxf/v0-decompress-init.c
deleted file mode 100644
index 94a19b9..0000000
--- a/libs/sraxf/v0-decompress-init.c
+++ /dev/null
@@ -1,2841 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include "v0-decompress.h"
-#include "v0-decompress-local.h"
-#include <sra/sradb.h> /* SRA_PLATFORM_... */
-#include <klib/sort.h>
-#include <sysalloc.h>
-
-/* globals
- */
-extern SRALocal     gv_local;
-extern SRALookup_t  gp_lookup;
-
-/* local prototypes
- */
-
-static void _s_init_sig_454_default (void);
-static void _s_init_prb_454_default (void);
-static void _s_init_pos_454_default (void);
-
-static void _s_init_seq_default     (void);
-
-static void _s_init_sig_slx_default (void);
-static void _s_init_int_slx_default (void);
-static void _s_init_nse_slx_default (void);
-static void _s_init_prb_slx_default (void);
-
-static void _s_init_slx_convqs4to1_default (void);
-
-
-/* initialize tables with default values
- */
-void sra_decompress_init (void)
-{ 
-  memset (&gv_local, 0, sizeof(struct SRALocal));
-
-  _s_init_sig_454_default (); 
-  _s_init_prb_454_default ();
-  _s_init_pos_454_default ();
-
-  _s_init_seq_default     ();
-
-  _s_init_sig_slx_default ();
-  _s_init_int_slx_default ();
-  _s_init_nse_slx_default ();
-  _s_init_prb_slx_default ();
-
-  _s_init_slx_convqs4to1_default ();
-}   
-
-/* local routines
- */
-static int CC _s_cmp_indexes (const void* a1, const void* a2, void *data)
-{
-  SRALookup_t plook = data;
-  uint32_t bits1    = plook[*(uint16_t*)a1].bits;
-  uint32_t bits2    = plook[*(uint16_t*)a2].bits;
-
-  if (bits1 < bits2) return -1;
-  if (bits1 > bits2) return  1;
-
-  return 0;
-}
-/*
- */
-static void _s_sort_lookup (const SRALookup_t plook, uint16_t* idx, uint16_t size)
-{
-  uint16_t i;
-  for (i=0; i<size; i++) *(idx+i) = i;
-
-  /* make sure it will sort a corect table
-   */
-  ksort ( idx, size, sizeof(uint16_t), _s_cmp_indexes, plook );
-}
-/*
- */
-/*
- */
-static void _s_init_slx_convqs4to1_default (void)
-{
-  gv_local.convqs4to1 [ 0] =  0;  gv_local.convqs4to1 [ 1] =  0;
-  gv_local.convqs4to1 [ 2] =  0;  gv_local.convqs4to1 [ 3] =  0;
-  gv_local.convqs4to1 [ 4] =  0;  gv_local.convqs4to1 [ 5] =  0;
-  gv_local.convqs4to1 [ 6] =  0;  gv_local.convqs4to1 [ 7] =  0;
-  gv_local.convqs4to1 [ 8] =  0;  gv_local.convqs4to1 [ 9] =  0;
-  gv_local.convqs4to1 [10] =  0;  gv_local.convqs4to1 [11] =  0;
-  gv_local.convqs4to1 [12] =  0;  gv_local.convqs4to1 [13] =  0;
-  gv_local.convqs4to1 [14] =  0;  gv_local.convqs4to1 [15] =  0;
-  gv_local.convqs4to1 [16] =  0;  gv_local.convqs4to1 [17] =  0;
-  gv_local.convqs4to1 [18] =  0;  gv_local.convqs4to1 [19] =  0;
-  gv_local.convqs4to1 [20] =  0;  gv_local.convqs4to1 [21] =  0;
-  gv_local.convqs4to1 [22] =  0;  gv_local.convqs4to1 [23] =  0;
-  gv_local.convqs4to1 [24] =  0;  gv_local.convqs4to1 [25] =  0;
-  gv_local.convqs4to1 [26] =  0;  gv_local.convqs4to1 [27] =  0;
-  gv_local.convqs4to1 [28] =  0;  gv_local.convqs4to1 [29] =  0;
-  gv_local.convqs4to1 [30] =  0;  gv_local.convqs4to1 [31] =  1;
-  gv_local.convqs4to1 [32] =  1;  gv_local.convqs4to1 [33] =  1;
-  gv_local.convqs4to1 [34] =  1;  gv_local.convqs4to1 [35] =  1;
-  gv_local.convqs4to1 [36] =  1;  gv_local.convqs4to1 [37] =  2;
-  gv_local.convqs4to1 [38] =  2;  gv_local.convqs4to1 [39] =  3;
-  gv_local.convqs4to1 [40] =  3;  gv_local.convqs4to1 [41] =  4;
-  gv_local.convqs4to1 [42] =  4;  gv_local.convqs4to1 [43] =  5;
-  gv_local.convqs4to1 [44] =  5;  gv_local.convqs4to1 [45] =  6;
-  gv_local.convqs4to1 [46] =  7;  gv_local.convqs4to1 [47] =  8;
-  gv_local.convqs4to1 [48] =  9;  gv_local.convqs4to1 [49] = 10;
-  gv_local.convqs4to1 [50] = 10;  gv_local.convqs4to1 [51] = 11;
-  gv_local.convqs4to1 [52] = 12;  gv_local.convqs4to1 [53] = 13;
-  gv_local.convqs4to1 [54] = 14;  gv_local.convqs4to1 [55] = 15;
-  gv_local.convqs4to1 [56] = 16;  gv_local.convqs4to1 [57] = 17;
-  gv_local.convqs4to1 [58] = 18;  gv_local.convqs4to1 [59] = 19;
-  gv_local.convqs4to1 [60] = 20;  gv_local.convqs4to1 [61] = 21;
-  gv_local.convqs4to1 [62] = 22;  gv_local.convqs4to1 [63] = 23;
-  gv_local.convqs4to1 [64] = 24;  gv_local.convqs4to1 [65] = 25;
-  gv_local.convqs4to1 [66] = 26;  gv_local.convqs4to1 [67] = 27;
-  gv_local.convqs4to1 [68] = 28;  gv_local.convqs4to1 [69] = 29;
-  gv_local.convqs4to1 [70] = 30;  gv_local.convqs4to1 [71] = 31;
-  gv_local.convqs4to1 [72] = 32;  gv_local.convqs4to1 [73] = 33;
-  gv_local.convqs4to1 [74] = 34;  gv_local.convqs4to1 [75] = 35;
-  gv_local.convqs4to1 [76] = 36;  gv_local.convqs4to1 [77] = 37;
-  gv_local.convqs4to1 [78] = 38;  gv_local.convqs4to1 [79] = 39;
-  gv_local.convqs4to1 [80] = 40;
-}
-/*
- */
-static void _s_init_prb_slx_default (void)
-{
-#if SRA_DECOMPRESS_USE_REVERSE_LOOKUP
-  int      i, j;
-  uchar_t  val;
-#endif
-
-  memset (gv_local.lookup_slx_prb, 0, sizeof(SRALookup)*PRB_SLX_HUFF_TREESIZE);
-
-  /*
-  // each bit is represented by two slashes or backslashes
-  //
-  // where / is 0
-  //      /
-  //
-  // and  \  is 1
-  //       \
-  //             1                   0 - 0000
-  //              \  /\              1 - 0100
-  //               \/  \    6        4 - 1000
-  //               /   /\  /         5 - 1010
-  //              /   /  \/   14     6 - 1100
-  //             0   /\   \  /      14 - 1110
-  //                /  \   \/       15 - 1111
-  //               4    5   \
-  //                         \
-  //                         15
-  //
-  */
-
-  gv_local.lookup_slx_prb[0].nbits = 2; gv_local.lookup_slx_prb[0].bits = 0x00000000;  /* 0: m_qmax  m_qmin  m_qmin m_qmin */
-  gv_local.lookup_slx_prb[1].nbits = 2; gv_local.lookup_slx_prb[1].bits = 0x40000000;  /* 1:     -5      -5      -5     -5 */
-  gv_local.lookup_slx_prb[2].nbits = 3; gv_local.lookup_slx_prb[2].bits = 0x80000000;  /* 2:      A      -A  m_qmin m_qmin */
-  gv_local.lookup_slx_prb[3].nbits = 3; gv_local.lookup_slx_prb[3].bits = 0xA0000000;  /* 3:      A  m_qmin      -A m_qmin */
-  gv_local.lookup_slx_prb[4].nbits = 3; gv_local.lookup_slx_prb[4].bits = 0xC0000000;  /* 4:      A  m_qmin  m_qmin     -A */
-  gv_local.lookup_slx_prb[5].nbits = 4; gv_local.lookup_slx_prb[5].bits = 0xE0000000;  /* 5: escape                        */
-  gv_local.lookup_slx_prb[6].nbits = 4; gv_local.lookup_slx_prb[6].bits = 0xF0000000;  /* 6: UNUSED                        */
-
-   _s_sort_lookup (gv_local.lookup_slx_prb, gv_local.idx_slx_prb, PRB_SLX_HUFF_TREESIZE);
-
-#if SRA_DECOMPRESS_USE_REVERSE_LOOKUP
-  /* reverse huffman lookup table
-   */
-  memset (gv_local.rlookup_slx_prb, 0, sizeof(uchar_t)*REV_HUFF_TREESIZE_08);
-
-  for (i=0; i<PRB_SLX_HUFF_TREESIZE; i++)
-  {
-    val = gv_local.lookup_slx_prb[i].bits >> 24;
-    gv_local.rlookup_slx_prb [val] = (uchar_t) i;
-
-    for (j=1; j<=(0xFF>>gv_local.lookup_slx_prb[i].nbits); j++)
-      gv_local.rlookup_slx_prb [val+j] = (uchar_t) i;
-  }
-#endif
-
-  gv_local.lookup_slx_prb_initialized = 1;
-}
-/*
- */
-static void _s_init_sig_slx_default (void)
-{
-#if SRA_DECOMPRESS_USE_REVERSE_LOOKUP
-  int      i, j;
-  uint16_t val;
-#endif
-
-  memset (gv_local.lookup_slx_sig,  0, sizeof(SRALookup)*SIG_HUFF_TREESIZE);
-
-  gv_local.lookup_slx_sig[  0].nbits = 13; gv_local.lookup_slx_sig[  0].bits = 0xB5180000;
-  gv_local.lookup_slx_sig[  1].nbits = 13; gv_local.lookup_slx_sig[  1].bits = 0x3D680000;
-  gv_local.lookup_slx_sig[  2].nbits = 13; gv_local.lookup_slx_sig[  2].bits = 0xBAA00000;
-  gv_local.lookup_slx_sig[  3].nbits = 13; gv_local.lookup_slx_sig[  3].bits = 0xB7D80000;
-  gv_local.lookup_slx_sig[  4].nbits = 13; gv_local.lookup_slx_sig[  4].bits = 0x59500000;
-  gv_local.lookup_slx_sig[  5].nbits = 13; gv_local.lookup_slx_sig[  5].bits = 0xB7080000;
-  gv_local.lookup_slx_sig[  6].nbits = 13; gv_local.lookup_slx_sig[  6].bits = 0xB8180000;
-  gv_local.lookup_slx_sig[  7].nbits = 13; gv_local.lookup_slx_sig[  7].bits = 0x8B980000;
-  gv_local.lookup_slx_sig[  8].nbits = 13; gv_local.lookup_slx_sig[  8].bits = 0xB7880000;
-  gv_local.lookup_slx_sig[  9].nbits = 13; gv_local.lookup_slx_sig[  9].bits = 0x5EE80000;
-  gv_local.lookup_slx_sig[ 10].nbits = 13; gv_local.lookup_slx_sig[ 10].bits = 0xC0A00000;
-  gv_local.lookup_slx_sig[ 11].nbits = 13; gv_local.lookup_slx_sig[ 11].bits = 0xB7980000;
-  gv_local.lookup_slx_sig[ 12].nbits = 13; gv_local.lookup_slx_sig[ 12].bits = 0x8B880000;
-  gv_local.lookup_slx_sig[ 13].nbits = 13; gv_local.lookup_slx_sig[ 13].bits = 0x8B900000;
-  gv_local.lookup_slx_sig[ 14].nbits = 13; gv_local.lookup_slx_sig[ 14].bits = 0xB7900000;
-  gv_local.lookup_slx_sig[ 15].nbits = 13; gv_local.lookup_slx_sig[ 15].bits = 0xC4400000;
-  gv_local.lookup_slx_sig[ 16].nbits = 13; gv_local.lookup_slx_sig[ 16].bits = 0xBA480000;
-  gv_local.lookup_slx_sig[ 17].nbits = 13; gv_local.lookup_slx_sig[ 17].bits = 0xC0A80000;
-  gv_local.lookup_slx_sig[ 18].nbits = 13; gv_local.lookup_slx_sig[ 18].bits = 0xBD700000;
-  gv_local.lookup_slx_sig[ 19].nbits = 13; gv_local.lookup_slx_sig[ 19].bits = 0xB8100000;
-  gv_local.lookup_slx_sig[ 20].nbits = 13; gv_local.lookup_slx_sig[ 20].bits = 0xC1A00000;
-  gv_local.lookup_slx_sig[ 21].nbits = 13; gv_local.lookup_slx_sig[ 21].bits = 0xBC700000;
-  gv_local.lookup_slx_sig[ 22].nbits = 13; gv_local.lookup_slx_sig[ 22].bits = 0xC4500000;
-  gv_local.lookup_slx_sig[ 23].nbits = 13; gv_local.lookup_slx_sig[ 23].bits = 0xC5200000;
-  gv_local.lookup_slx_sig[ 24].nbits = 13; gv_local.lookup_slx_sig[ 24].bits = 0xC5780000;
-  gv_local.lookup_slx_sig[ 25].nbits = 13; gv_local.lookup_slx_sig[ 25].bits = 0xC5380000;
-  gv_local.lookup_slx_sig[ 26].nbits = 13; gv_local.lookup_slx_sig[ 26].bits = 0xC9A00000;
-  gv_local.lookup_slx_sig[ 27].nbits = 13; gv_local.lookup_slx_sig[ 27].bits = 0xCBA00000;
-  gv_local.lookup_slx_sig[ 28].nbits = 13; gv_local.lookup_slx_sig[ 28].bits = 0xC5300000;
-  gv_local.lookup_slx_sig[ 29].nbits = 13; gv_local.lookup_slx_sig[ 29].bits = 0xC0B80000;
-  gv_local.lookup_slx_sig[ 30].nbits = 13; gv_local.lookup_slx_sig[ 30].bits = 0xC5700000;
-  gv_local.lookup_slx_sig[ 31].nbits = 13; gv_local.lookup_slx_sig[ 31].bits = 0xD6280000;
-  gv_local.lookup_slx_sig[ 32].nbits = 13; gv_local.lookup_slx_sig[ 32].bits = 0xC4480000;
-  gv_local.lookup_slx_sig[ 33].nbits = 13; gv_local.lookup_slx_sig[ 33].bits = 0xD6180000;
-  gv_local.lookup_slx_sig[ 34].nbits = 13; gv_local.lookup_slx_sig[ 34].bits = 0xC9C00000;
-  gv_local.lookup_slx_sig[ 35].nbits = 13; gv_local.lookup_slx_sig[ 35].bits = 0xCA680000;
-  gv_local.lookup_slx_sig[ 36].nbits = 13; gv_local.lookup_slx_sig[ 36].bits = 0xCEF80000;
-  gv_local.lookup_slx_sig[ 37].nbits = 13; gv_local.lookup_slx_sig[ 37].bits = 0xCCD00000;
-  gv_local.lookup_slx_sig[ 38].nbits = 12; gv_local.lookup_slx_sig[ 38].bits = 0x1AA00000;
-  gv_local.lookup_slx_sig[ 39].nbits = 12; gv_local.lookup_slx_sig[ 39].bits = 0x18800000;
-  gv_local.lookup_slx_sig[ 40].nbits = 13; gv_local.lookup_slx_sig[ 40].bits = 0xD6300000;
-  gv_local.lookup_slx_sig[ 41].nbits = 12; gv_local.lookup_slx_sig[ 41].bits = 0x18900000;
-  gv_local.lookup_slx_sig[ 42].nbits = 13; gv_local.lookup_slx_sig[ 42].bits = 0xCBA80000;
-  gv_local.lookup_slx_sig[ 43].nbits = 13; gv_local.lookup_slx_sig[ 43].bits = 0xD7E80000;
-  gv_local.lookup_slx_sig[ 44].nbits = 13; gv_local.lookup_slx_sig[ 44].bits = 0xC9C80000;
-  gv_local.lookup_slx_sig[ 45].nbits = 13; gv_local.lookup_slx_sig[ 45].bits = 0xD4F80000;
-  gv_local.lookup_slx_sig[ 46].nbits = 12; gv_local.lookup_slx_sig[ 46].bits = 0x1AB00000;
-  gv_local.lookup_slx_sig[ 47].nbits = 12; gv_local.lookup_slx_sig[ 47].bits = 0x2A800000;
-  gv_local.lookup_slx_sig[ 48].nbits = 12; gv_local.lookup_slx_sig[ 48].bits = 0x2F100000;
-  gv_local.lookup_slx_sig[ 49].nbits = 12; gv_local.lookup_slx_sig[ 49].bits = 0x1B600000;
-  gv_local.lookup_slx_sig[ 50].nbits = 12; gv_local.lookup_slx_sig[ 50].bits = 0x1C500000;
-  gv_local.lookup_slx_sig[ 51].nbits = 12; gv_local.lookup_slx_sig[ 51].bits = 0x29D00000;
-  gv_local.lookup_slx_sig[ 52].nbits = 12; gv_local.lookup_slx_sig[ 52].bits = 0x2A200000;
-  gv_local.lookup_slx_sig[ 53].nbits = 12; gv_local.lookup_slx_sig[ 53].bits = 0x39400000;
-  gv_local.lookup_slx_sig[ 54].nbits = 12; gv_local.lookup_slx_sig[ 54].bits = 0x33100000;
-  gv_local.lookup_slx_sig[ 55].nbits = 12; gv_local.lookup_slx_sig[ 55].bits = 0x29C00000;
-  gv_local.lookup_slx_sig[ 56].nbits = 12; gv_local.lookup_slx_sig[ 56].bits = 0x28700000;
-  gv_local.lookup_slx_sig[ 57].nbits = 12; gv_local.lookup_slx_sig[ 57].bits = 0x32200000;
-  gv_local.lookup_slx_sig[ 58].nbits = 12; gv_local.lookup_slx_sig[ 58].bits = 0x39700000;
-  gv_local.lookup_slx_sig[ 59].nbits = 12; gv_local.lookup_slx_sig[ 59].bits = 0x39500000;
-  gv_local.lookup_slx_sig[ 60].nbits = 12; gv_local.lookup_slx_sig[ 60].bits = 0x32800000;
-  gv_local.lookup_slx_sig[ 61].nbits = 12; gv_local.lookup_slx_sig[ 61].bits = 0x34300000;
-  gv_local.lookup_slx_sig[ 62].nbits = 12; gv_local.lookup_slx_sig[ 62].bits = 0x32300000;
-  gv_local.lookup_slx_sig[ 63].nbits = 12; gv_local.lookup_slx_sig[ 63].bits = 0x2A900000;
-  gv_local.lookup_slx_sig[ 64].nbits = 12; gv_local.lookup_slx_sig[ 64].bits = 0x3FA00000;
-  gv_local.lookup_slx_sig[ 65].nbits = 12; gv_local.lookup_slx_sig[ 65].bits = 0x39B00000;
-  gv_local.lookup_slx_sig[ 66].nbits = 12; gv_local.lookup_slx_sig[ 66].bits = 0x3F900000;
-  gv_local.lookup_slx_sig[ 67].nbits = 12; gv_local.lookup_slx_sig[ 67].bits = 0x3C300000;
-  gv_local.lookup_slx_sig[ 68].nbits = 12; gv_local.lookup_slx_sig[ 68].bits = 0x5E300000;
-  gv_local.lookup_slx_sig[ 69].nbits = 12; gv_local.lookup_slx_sig[ 69].bits = 0x3E800000;
-  gv_local.lookup_slx_sig[ 70].nbits = 12; gv_local.lookup_slx_sig[ 70].bits = 0x39E00000;
-  gv_local.lookup_slx_sig[ 71].nbits = 12; gv_local.lookup_slx_sig[ 71].bits = 0x3E500000;
-  gv_local.lookup_slx_sig[ 72].nbits = 12; gv_local.lookup_slx_sig[ 72].bits = 0x88F00000;
-  gv_local.lookup_slx_sig[ 73].nbits = 12; gv_local.lookup_slx_sig[ 73].bits = 0x88000000;
-  gv_local.lookup_slx_sig[ 74].nbits = 12; gv_local.lookup_slx_sig[ 74].bits = 0x88D00000;
-  gv_local.lookup_slx_sig[ 75].nbits = 12; gv_local.lookup_slx_sig[ 75].bits = 0x5EB00000;
-  gv_local.lookup_slx_sig[ 76].nbits = 12; gv_local.lookup_slx_sig[ 76].bits = 0x3FB00000;
-  gv_local.lookup_slx_sig[ 77].nbits = 12; gv_local.lookup_slx_sig[ 77].bits = 0x59100000;
-  gv_local.lookup_slx_sig[ 78].nbits = 12; gv_local.lookup_slx_sig[ 78].bits = 0x88C00000;
-  gv_local.lookup_slx_sig[ 79].nbits = 12; gv_local.lookup_slx_sig[ 79].bits = 0x88E00000;
-  gv_local.lookup_slx_sig[ 80].nbits = 12; gv_local.lookup_slx_sig[ 80].bits = 0x88100000;
-  gv_local.lookup_slx_sig[ 81].nbits = 12; gv_local.lookup_slx_sig[ 81].bits = 0xB6800000;
-  gv_local.lookup_slx_sig[ 82].nbits = 12; gv_local.lookup_slx_sig[ 82].bits = 0xB5200000;
-  gv_local.lookup_slx_sig[ 83].nbits = 12; gv_local.lookup_slx_sig[ 83].bits = 0x5E200000;
-  gv_local.lookup_slx_sig[ 84].nbits = 12; gv_local.lookup_slx_sig[ 84].bits = 0xB7C00000;
-  gv_local.lookup_slx_sig[ 85].nbits = 12; gv_local.lookup_slx_sig[ 85].bits = 0xB8000000;
-  gv_local.lookup_slx_sig[ 86].nbits = 12; gv_local.lookup_slx_sig[ 86].bits = 0xB9200000;
-  gv_local.lookup_slx_sig[ 87].nbits = 12; gv_local.lookup_slx_sig[ 87].bits = 0xB7300000;
-  gv_local.lookup_slx_sig[ 88].nbits = 12; gv_local.lookup_slx_sig[ 88].bits = 0xC1100000;
-  gv_local.lookup_slx_sig[ 89].nbits = 12; gv_local.lookup_slx_sig[ 89].bits = 0xBA500000;
-  gv_local.lookup_slx_sig[ 90].nbits = 12; gv_local.lookup_slx_sig[ 90].bits = 0xC0900000;
-  gv_local.lookup_slx_sig[ 91].nbits = 12; gv_local.lookup_slx_sig[ 91].bits = 0xC1900000;
-  gv_local.lookup_slx_sig[ 92].nbits = 12; gv_local.lookup_slx_sig[ 92].bits = 0xB8500000;
-  gv_local.lookup_slx_sig[ 93].nbits = 12; gv_local.lookup_slx_sig[ 93].bits = 0xC1800000;
-  gv_local.lookup_slx_sig[ 94].nbits = 12; gv_local.lookup_slx_sig[ 94].bits = 0xBAE00000;
-  gv_local.lookup_slx_sig[ 95].nbits = 12; gv_local.lookup_slx_sig[ 95].bits = 0xC9B00000;
-  gv_local.lookup_slx_sig[ 96].nbits = 12; gv_local.lookup_slx_sig[ 96].bits = 0xC0800000;
-  gv_local.lookup_slx_sig[ 97].nbits = 12; gv_local.lookup_slx_sig[ 97].bits = 0xC5D00000;
-  gv_local.lookup_slx_sig[ 98].nbits = 12; gv_local.lookup_slx_sig[ 98].bits = 0xC1000000;
-  gv_local.lookup_slx_sig[ 99].nbits = 12; gv_local.lookup_slx_sig[ 99].bits = 0xC0500000;
-  gv_local.lookup_slx_sig[100].nbits = 12; gv_local.lookup_slx_sig[100].bits = 0xC8100000;
-  gv_local.lookup_slx_sig[101].nbits = 12; gv_local.lookup_slx_sig[101].bits = 0xC1C00000;
-  gv_local.lookup_slx_sig[102].nbits = 12; gv_local.lookup_slx_sig[102].bits = 0xC8600000;
-  gv_local.lookup_slx_sig[103].nbits = 12; gv_local.lookup_slx_sig[103].bits = 0xCED00000;
-  gv_local.lookup_slx_sig[104].nbits = 12; gv_local.lookup_slx_sig[104].bits = 0xCC900000;
-  gv_local.lookup_slx_sig[105].nbits = 12; gv_local.lookup_slx_sig[105].bits = 0xCE400000;
-  gv_local.lookup_slx_sig[106].nbits = 12; gv_local.lookup_slx_sig[106].bits = 0xCC500000;
-  gv_local.lookup_slx_sig[107].nbits = 12; gv_local.lookup_slx_sig[107].bits = 0xCC400000;
-  gv_local.lookup_slx_sig[108].nbits = 12; gv_local.lookup_slx_sig[108].bits = 0xCBB00000;
-  gv_local.lookup_slx_sig[109].nbits = 12; gv_local.lookup_slx_sig[109].bits = 0xCA700000;
-  gv_local.lookup_slx_sig[110].nbits = 12; gv_local.lookup_slx_sig[110].bits = 0xD6000000;
-  gv_local.lookup_slx_sig[111].nbits = 12; gv_local.lookup_slx_sig[111].bits = 0xD5D00000;
-  gv_local.lookup_slx_sig[112].nbits = 12; gv_local.lookup_slx_sig[112].bits = 0xD4E00000;
-  gv_local.lookup_slx_sig[113].nbits = 12; gv_local.lookup_slx_sig[113].bits = 0xD5C00000;
-  gv_local.lookup_slx_sig[114].nbits = 12; gv_local.lookup_slx_sig[114].bits = 0xC9E00000;
-  gv_local.lookup_slx_sig[115].nbits = 12; gv_local.lookup_slx_sig[115].bits = 0xD5700000;
-  gv_local.lookup_slx_sig[116].nbits = 11; gv_local.lookup_slx_sig[116].bits = 0x1B400000;
-  gv_local.lookup_slx_sig[117].nbits = 12; gv_local.lookup_slx_sig[117].bits = 0xD7F00000;
-  gv_local.lookup_slx_sig[118].nbits = 11; gv_local.lookup_slx_sig[118].bits = 0x1CC00000;
-  gv_local.lookup_slx_sig[119].nbits = 11; gv_local.lookup_slx_sig[119].bits = 0x18A00000;
-  gv_local.lookup_slx_sig[120].nbits = 11; gv_local.lookup_slx_sig[120].bits = 0x19000000;
-  gv_local.lookup_slx_sig[121].nbits = 11; gv_local.lookup_slx_sig[121].bits = 0x1C600000;
-  gv_local.lookup_slx_sig[122].nbits = 11; gv_local.lookup_slx_sig[122].bits = 0x1E000000;
-  gv_local.lookup_slx_sig[123].nbits = 11; gv_local.lookup_slx_sig[123].bits = 0x1E200000;
-  gv_local.lookup_slx_sig[124].nbits = 11; gv_local.lookup_slx_sig[124].bits = 0x32A00000;
-  gv_local.lookup_slx_sig[125].nbits = 11; gv_local.lookup_slx_sig[125].bits = 0x32E00000;
-  gv_local.lookup_slx_sig[126].nbits = 11; gv_local.lookup_slx_sig[126].bits = 0x33400000;
-  gv_local.lookup_slx_sig[127].nbits = 11; gv_local.lookup_slx_sig[127].bits = 0x2E200000;
-  gv_local.lookup_slx_sig[128].nbits = 11; gv_local.lookup_slx_sig[128].bits = 0x2F200000;
-  gv_local.lookup_slx_sig[129].nbits = 11; gv_local.lookup_slx_sig[129].bits = 0x2E400000;
-  gv_local.lookup_slx_sig[130].nbits = 11; gv_local.lookup_slx_sig[130].bits = 0x2F400000;
-  gv_local.lookup_slx_sig[131].nbits = 11; gv_local.lookup_slx_sig[131].bits = 0x35A00000;
-  gv_local.lookup_slx_sig[132].nbits = 11; gv_local.lookup_slx_sig[132].bits = 0x3B400000;
-  gv_local.lookup_slx_sig[133].nbits = 11; gv_local.lookup_slx_sig[133].bits = 0x33200000;
-  gv_local.lookup_slx_sig[134].nbits = 11; gv_local.lookup_slx_sig[134].bits = 0x34A00000;
-  gv_local.lookup_slx_sig[135].nbits = 11; gv_local.lookup_slx_sig[135].bits = 0x33A00000;
-  gv_local.lookup_slx_sig[136].nbits = 11; gv_local.lookup_slx_sig[136].bits = 0x35C00000;
-  gv_local.lookup_slx_sig[137].nbits = 11; gv_local.lookup_slx_sig[137].bits = 0x3DA00000;
-  gv_local.lookup_slx_sig[138].nbits = 11; gv_local.lookup_slx_sig[138].bits = 0x39800000;
-  gv_local.lookup_slx_sig[139].nbits = 11; gv_local.lookup_slx_sig[139].bits = 0x3E600000;
-  gv_local.lookup_slx_sig[140].nbits = 11; gv_local.lookup_slx_sig[140].bits = 0x3F000000;
-  gv_local.lookup_slx_sig[141].nbits = 11; gv_local.lookup_slx_sig[141].bits = 0x3D000000;
-  gv_local.lookup_slx_sig[142].nbits = 11; gv_local.lookup_slx_sig[142].bits = 0x59200000;
-  gv_local.lookup_slx_sig[143].nbits = 11; gv_local.lookup_slx_sig[143].bits = 0x3D400000;
-  gv_local.lookup_slx_sig[144].nbits = 11; gv_local.lookup_slx_sig[144].bits = 0x88200000;
-  gv_local.lookup_slx_sig[145].nbits = 11; gv_local.lookup_slx_sig[145].bits = 0x5E000000;
-  gv_local.lookup_slx_sig[146].nbits = 11; gv_local.lookup_slx_sig[146].bits = 0x5E800000;
-  gv_local.lookup_slx_sig[147].nbits = 11; gv_local.lookup_slx_sig[147].bits = 0x8BA00000;
-  gv_local.lookup_slx_sig[148].nbits = 11; gv_local.lookup_slx_sig[148].bits = 0x5EC00000;
-  gv_local.lookup_slx_sig[149].nbits = 11; gv_local.lookup_slx_sig[149].bits = 0x5F400000;
-  gv_local.lookup_slx_sig[150].nbits = 11; gv_local.lookup_slx_sig[150].bits = 0x5E600000;
-  gv_local.lookup_slx_sig[151].nbits = 11; gv_local.lookup_slx_sig[151].bits = 0x5F600000;
-  gv_local.lookup_slx_sig[152].nbits = 11; gv_local.lookup_slx_sig[152].bits = 0xB6C00000;
-  gv_local.lookup_slx_sig[153].nbits = 11; gv_local.lookup_slx_sig[153].bits = 0xB6400000;
-  gv_local.lookup_slx_sig[154].nbits = 11; gv_local.lookup_slx_sig[154].bits = 0xB8200000;
-  gv_local.lookup_slx_sig[155].nbits = 11; gv_local.lookup_slx_sig[155].bits = 0xB6600000;
-  gv_local.lookup_slx_sig[156].nbits = 11; gv_local.lookup_slx_sig[156].bits = 0xBAC00000;
-  gv_local.lookup_slx_sig[157].nbits = 11; gv_local.lookup_slx_sig[157].bits = 0xBA600000;
-  gv_local.lookup_slx_sig[158].nbits = 11; gv_local.lookup_slx_sig[158].bits = 0xBCA00000;
-  gv_local.lookup_slx_sig[159].nbits = 11; gv_local.lookup_slx_sig[159].bits = 0xC0600000;
-  gv_local.lookup_slx_sig[160].nbits = 11; gv_local.lookup_slx_sig[160].bits = 0xC0200000;
-  gv_local.lookup_slx_sig[161].nbits = 11; gv_local.lookup_slx_sig[161].bits = 0xBD400000;
-  gv_local.lookup_slx_sig[162].nbits = 11; gv_local.lookup_slx_sig[162].bits = 0xC1200000;
-  gv_local.lookup_slx_sig[163].nbits = 11; gv_local.lookup_slx_sig[163].bits = 0xBBC00000;
-  gv_local.lookup_slx_sig[164].nbits = 11; gv_local.lookup_slx_sig[164].bits = 0xC1600000;
-  gv_local.lookup_slx_sig[165].nbits = 11; gv_local.lookup_slx_sig[165].bits = 0xC0000000;
-  gv_local.lookup_slx_sig[166].nbits = 11; gv_local.lookup_slx_sig[166].bits = 0xC5000000;
-  gv_local.lookup_slx_sig[167].nbits = 11; gv_local.lookup_slx_sig[167].bits = 0xC4600000;
-  gv_local.lookup_slx_sig[168].nbits = 11; gv_local.lookup_slx_sig[168].bits = 0xBCE00000;
-  gv_local.lookup_slx_sig[169].nbits = 11; gv_local.lookup_slx_sig[169].bits = 0xC0E00000;
-  gv_local.lookup_slx_sig[170].nbits = 11; gv_local.lookup_slx_sig[170].bits = 0xC5E00000;
-  gv_local.lookup_slx_sig[171].nbits = 11; gv_local.lookup_slx_sig[171].bits = 0xC9600000;
-  gv_local.lookup_slx_sig[172].nbits = 11; gv_local.lookup_slx_sig[172].bits = 0xC8400000;
-  gv_local.lookup_slx_sig[173].nbits = 11; gv_local.lookup_slx_sig[173].bits = 0xC9800000;
-  gv_local.lookup_slx_sig[174].nbits = 11; gv_local.lookup_slx_sig[174].bits = 0xCC600000;
-  gv_local.lookup_slx_sig[175].nbits = 11; gv_local.lookup_slx_sig[175].bits = 0xCB000000;
-  gv_local.lookup_slx_sig[176].nbits = 11; gv_local.lookup_slx_sig[176].bits = 0xCA400000;
-  gv_local.lookup_slx_sig[177].nbits = 11; gv_local.lookup_slx_sig[177].bits = 0xD4C00000;
-  gv_local.lookup_slx_sig[178].nbits = 11; gv_local.lookup_slx_sig[178].bits = 0xCCA00000;
-  gv_local.lookup_slx_sig[179].nbits = 11; gv_local.lookup_slx_sig[179].bits = 0xD5400000;
-  gv_local.lookup_slx_sig[180].nbits = 11; gv_local.lookup_slx_sig[180].bits = 0xD4800000;
-  gv_local.lookup_slx_sig[181].nbits = 11; gv_local.lookup_slx_sig[181].bits = 0xD5200000;
-  gv_local.lookup_slx_sig[182].nbits = 11; gv_local.lookup_slx_sig[182].bits = 0xD7600000;
-  gv_local.lookup_slx_sig[183].nbits = 10; gv_local.lookup_slx_sig[183].bits = 0x18400000;
-  gv_local.lookup_slx_sig[184].nbits = 11; gv_local.lookup_slx_sig[184].bits = 0xD5800000;
-  gv_local.lookup_slx_sig[185].nbits = 11; gv_local.lookup_slx_sig[185].bits = 0xD5E00000;
-  gv_local.lookup_slx_sig[186].nbits = 11; gv_local.lookup_slx_sig[186].bits = 0xD7C00000;
-  gv_local.lookup_slx_sig[187].nbits = 10; gv_local.lookup_slx_sig[187].bits = 0x1C000000;
-  gv_local.lookup_slx_sig[188].nbits = 10; gv_local.lookup_slx_sig[188].bits = 0x18C00000;
-  gv_local.lookup_slx_sig[189].nbits = 10; gv_local.lookup_slx_sig[189].bits = 0x1A400000;
-  gv_local.lookup_slx_sig[190].nbits = 10; gv_local.lookup_slx_sig[190].bits = 0x1B000000;
-  gv_local.lookup_slx_sig[191].nbits = 10; gv_local.lookup_slx_sig[191].bits = 0x28000000;
-  gv_local.lookup_slx_sig[192].nbits = 10; gv_local.lookup_slx_sig[192].bits = 0x29400000;
-  gv_local.lookup_slx_sig[193].nbits = 10; gv_local.lookup_slx_sig[193].bits = 0x29000000;
-  gv_local.lookup_slx_sig[194].nbits = 10; gv_local.lookup_slx_sig[194].bits = 0x1F400000;
-  gv_local.lookup_slx_sig[195].nbits = 10; gv_local.lookup_slx_sig[195].bits = 0x2EC00000;
-  gv_local.lookup_slx_sig[196].nbits = 10; gv_local.lookup_slx_sig[196].bits = 0x1F000000;
-  gv_local.lookup_slx_sig[197].nbits = 10; gv_local.lookup_slx_sig[197].bits = 0x29800000;
-  gv_local.lookup_slx_sig[198].nbits = 10; gv_local.lookup_slx_sig[198].bits = 0x32400000;
-  gv_local.lookup_slx_sig[199].nbits = 10; gv_local.lookup_slx_sig[199].bits = 0x33C00000;
-  gv_local.lookup_slx_sig[200].nbits = 10; gv_local.lookup_slx_sig[200].bits = 0x2E800000;
-  gv_local.lookup_slx_sig[201].nbits = 10; gv_local.lookup_slx_sig[201].bits = 0x34C00000;
-  gv_local.lookup_slx_sig[202].nbits = 10; gv_local.lookup_slx_sig[202].bits = 0x37C00000;
-  gv_local.lookup_slx_sig[203].nbits = 10; gv_local.lookup_slx_sig[203].bits = 0x37800000;
-  gv_local.lookup_slx_sig[204].nbits = 10; gv_local.lookup_slx_sig[204].bits = 0x37400000;
-  gv_local.lookup_slx_sig[205].nbits = 10; gv_local.lookup_slx_sig[205].bits = 0x39000000;
-  gv_local.lookup_slx_sig[206].nbits = 10; gv_local.lookup_slx_sig[206].bits = 0x3C400000;
-  gv_local.lookup_slx_sig[207].nbits = 10; gv_local.lookup_slx_sig[207].bits = 0x3FC00000;
-  gv_local.lookup_slx_sig[208].nbits = 10; gv_local.lookup_slx_sig[208].bits = 0x58400000;
-  gv_local.lookup_slx_sig[209].nbits = 10; gv_local.lookup_slx_sig[209].bits = 0x3EC00000;
-  gv_local.lookup_slx_sig[210].nbits = 10; gv_local.lookup_slx_sig[210].bits = 0x3E000000;
-  gv_local.lookup_slx_sig[211].nbits = 10; gv_local.lookup_slx_sig[211].bits = 0x3F400000;
-  gv_local.lookup_slx_sig[212].nbits = 10; gv_local.lookup_slx_sig[212].bits = 0x59800000;
-  gv_local.lookup_slx_sig[213].nbits = 10; gv_local.lookup_slx_sig[213].bits = 0x59C00000;
-  gv_local.lookup_slx_sig[214].nbits = 10; gv_local.lookup_slx_sig[214].bits = 0x8B400000;
-  gv_local.lookup_slx_sig[215].nbits = 10; gv_local.lookup_slx_sig[215].bits = 0x88400000;
-  gv_local.lookup_slx_sig[216].nbits = 10; gv_local.lookup_slx_sig[216].bits = 0xB4000000;
-  gv_local.lookup_slx_sig[217].nbits = 10; gv_local.lookup_slx_sig[217].bits = 0xB6000000;
-  gv_local.lookup_slx_sig[218].nbits = 10; gv_local.lookup_slx_sig[218].bits = 0xB9800000;
-  gv_local.lookup_slx_sig[219].nbits = 10; gv_local.lookup_slx_sig[219].bits = 0xB9C00000;
-  gv_local.lookup_slx_sig[220].nbits = 10; gv_local.lookup_slx_sig[220].bits = 0xBC000000;
-  gv_local.lookup_slx_sig[221].nbits = 10; gv_local.lookup_slx_sig[221].bits = 0xBDC00000;
-  gv_local.lookup_slx_sig[222].nbits = 10; gv_local.lookup_slx_sig[222].bits = 0xBD000000;
-  gv_local.lookup_slx_sig[223].nbits = 10; gv_local.lookup_slx_sig[223].bits = 0xC9000000;
-  gv_local.lookup_slx_sig[224].nbits = 10; gv_local.lookup_slx_sig[224].bits = 0xC5800000;
-  gv_local.lookup_slx_sig[225].nbits = 10; gv_local.lookup_slx_sig[225].bits = 0xCA000000;
-  gv_local.lookup_slx_sig[226].nbits = 10; gv_local.lookup_slx_sig[226].bits = 0xCB400000;
-  gv_local.lookup_slx_sig[227].nbits = 10; gv_local.lookup_slx_sig[227].bits = 0xCE000000;
-  gv_local.lookup_slx_sig[228].nbits = 10; gv_local.lookup_slx_sig[228].bits = 0xD7000000;
-  gv_local.lookup_slx_sig[229].nbits =  9; gv_local.lookup_slx_sig[229].bits = 0x1B800000;
-  gv_local.lookup_slx_sig[230].nbits =  9; gv_local.lookup_slx_sig[230].bits = 0x28800000;
-  gv_local.lookup_slx_sig[231].nbits =  9; gv_local.lookup_slx_sig[231].bits = 0x2F800000;
-  gv_local.lookup_slx_sig[232].nbits =  9; gv_local.lookup_slx_sig[232].bits = 0x36000000;
-  gv_local.lookup_slx_sig[233].nbits =  9; gv_local.lookup_slx_sig[233].bits = 0x3C800000;
-  gv_local.lookup_slx_sig[234].nbits =  9; gv_local.lookup_slx_sig[234].bits = 0x58800000;
-  gv_local.lookup_slx_sig[235].nbits =  9; gv_local.lookup_slx_sig[235].bits = 0xB4800000;
-  gv_local.lookup_slx_sig[236].nbits =  9; gv_local.lookup_slx_sig[236].bits = 0xB8800000;
-  gv_local.lookup_slx_sig[237].nbits =  9; gv_local.lookup_slx_sig[237].bits = 0xC4800000;
-  gv_local.lookup_slx_sig[238].nbits =  9; gv_local.lookup_slx_sig[238].bits = 0xCA800000;
-  gv_local.lookup_slx_sig[239].nbits =  9; gv_local.lookup_slx_sig[239].bits = 0xD6800000;
-  gv_local.lookup_slx_sig[240].nbits =  8; gv_local.lookup_slx_sig[240].bits = 0x2B000000;
-  gv_local.lookup_slx_sig[241].nbits =  8; gv_local.lookup_slx_sig[241].bits = 0x3A000000;
-  gv_local.lookup_slx_sig[242].nbits =  8; gv_local.lookup_slx_sig[242].bits = 0x8A000000;
-  gv_local.lookup_slx_sig[243].nbits =  8; gv_local.lookup_slx_sig[243].bits = 0xBE000000;
-  gv_local.lookup_slx_sig[244].nbits =  8; gv_local.lookup_slx_sig[244].bits = 0xCF000000;
-  gv_local.lookup_slx_sig[245].nbits =  7; gv_local.lookup_slx_sig[245].bits = 0x30000000;
-  gv_local.lookup_slx_sig[246].nbits =  7; gv_local.lookup_slx_sig[246].bits = 0x5A000000;
-  gv_local.lookup_slx_sig[247].nbits =  7; gv_local.lookup_slx_sig[247].bits = 0xC2000000;
-  gv_local.lookup_slx_sig[248].nbits =  6; gv_local.lookup_slx_sig[248].bits = 0x20000000;
-  gv_local.lookup_slx_sig[249].nbits =  6; gv_local.lookup_slx_sig[249].bits = 0x8C000000;
-  gv_local.lookup_slx_sig[250].nbits =  6; gv_local.lookup_slx_sig[250].bits = 0xD0000000;
-  gv_local.lookup_slx_sig[251].nbits =  5; gv_local.lookup_slx_sig[251].bits = 0x50000000;
-  gv_local.lookup_slx_sig[252].nbits =  5; gv_local.lookup_slx_sig[252].bits = 0xD8000000;
-  gv_local.lookup_slx_sig[253].nbits =  4; gv_local.lookup_slx_sig[253].bits = 0x90000000;
-  gv_local.lookup_slx_sig[254].nbits =  4; gv_local.lookup_slx_sig[254].bits = 0xF0000000;
-  gv_local.lookup_slx_sig[255].nbits =  3; gv_local.lookup_slx_sig[255].bits = 0x60000000;
-  gv_local.lookup_slx_sig[256].nbits =  4; gv_local.lookup_slx_sig[256].bits = 0xE0000000;
-  gv_local.lookup_slx_sig[257].nbits =  4; gv_local.lookup_slx_sig[257].bits = 0xA0000000;
-  gv_local.lookup_slx_sig[258].nbits =  4; gv_local.lookup_slx_sig[258].bits = 0x00000000;
-  gv_local.lookup_slx_sig[259].nbits =  5; gv_local.lookup_slx_sig[259].bits = 0x80000000;
-  gv_local.lookup_slx_sig[260].nbits =  5; gv_local.lookup_slx_sig[260].bits = 0x10000000;
-  gv_local.lookup_slx_sig[261].nbits =  6; gv_local.lookup_slx_sig[261].bits = 0xB0000000;
-  gv_local.lookup_slx_sig[262].nbits =  6; gv_local.lookup_slx_sig[262].bits = 0x24000000;
-  gv_local.lookup_slx_sig[263].nbits =  7; gv_local.lookup_slx_sig[263].bits = 0xC6000000;
-  gv_local.lookup_slx_sig[264].nbits =  7; gv_local.lookup_slx_sig[264].bits = 0x5C000000;
-  gv_local.lookup_slx_sig[265].nbits =  7; gv_local.lookup_slx_sig[265].bits = 0x2C000000;
-  gv_local.lookup_slx_sig[266].nbits =  8; gv_local.lookup_slx_sig[266].bits = 0xCD000000;
-  gv_local.lookup_slx_sig[267].nbits =  8; gv_local.lookup_slx_sig[267].bits = 0xBF000000;
-  gv_local.lookup_slx_sig[268].nbits =  8; gv_local.lookup_slx_sig[268].bits = 0x89000000;
-  gv_local.lookup_slx_sig[269].nbits =  8; gv_local.lookup_slx_sig[269].bits = 0x38000000;
-  gv_local.lookup_slx_sig[270].nbits =  8; gv_local.lookup_slx_sig[270].bits = 0x1D000000;
-  gv_local.lookup_slx_sig[271].nbits =  9; gv_local.lookup_slx_sig[271].bits = 0xD4000000;
-  gv_local.lookup_slx_sig[272].nbits =  9; gv_local.lookup_slx_sig[272].bits = 0xC8800000;
-  gv_local.lookup_slx_sig[273].nbits =  9; gv_local.lookup_slx_sig[273].bits = 0xBB000000;
-  gv_local.lookup_slx_sig[274].nbits =  9; gv_local.lookup_slx_sig[274].bits = 0xB5800000;
-  gv_local.lookup_slx_sig[275].nbits =  9; gv_local.lookup_slx_sig[275].bits = 0x5F800000;
-  gv_local.lookup_slx_sig[276].nbits =  9; gv_local.lookup_slx_sig[276].bits = 0x3B800000;
-  gv_local.lookup_slx_sig[277].nbits =  9; gv_local.lookup_slx_sig[277].bits = 0x35000000;
-  gv_local.lookup_slx_sig[278].nbits =  9; gv_local.lookup_slx_sig[278].bits = 0x1F800000;
-  gv_local.lookup_slx_sig[279].nbits =  9; gv_local.lookup_slx_sig[279].bits = 0x19800000;
-  gv_local.lookup_slx_sig[280].nbits = 10; gv_local.lookup_slx_sig[280].bits = 0xD6400000;
-  gv_local.lookup_slx_sig[281].nbits = 10; gv_local.lookup_slx_sig[281].bits = 0xCE800000;
-  gv_local.lookup_slx_sig[282].nbits = 10; gv_local.lookup_slx_sig[282].bits = 0xCBC00000;
-  gv_local.lookup_slx_sig[283].nbits = 10; gv_local.lookup_slx_sig[283].bits = 0xC4000000;
-  gv_local.lookup_slx_sig[284].nbits = 10; gv_local.lookup_slx_sig[284].bits = 0xBD800000;
-  gv_local.lookup_slx_sig[285].nbits = 10; gv_local.lookup_slx_sig[285].bits = 0xBB800000;
-  gv_local.lookup_slx_sig[286].nbits = 10; gv_local.lookup_slx_sig[286].bits = 0xB9400000;
-  gv_local.lookup_slx_sig[287].nbits = 10; gv_local.lookup_slx_sig[287].bits = 0xB5400000;
-  gv_local.lookup_slx_sig[288].nbits = 10; gv_local.lookup_slx_sig[288].bits = 0x88800000;
-  gv_local.lookup_slx_sig[289].nbits = 10; gv_local.lookup_slx_sig[289].bits = 0x5F000000;
-  gv_local.lookup_slx_sig[290].nbits = 10; gv_local.lookup_slx_sig[290].bits = 0x3DC00000;
-  gv_local.lookup_slx_sig[291].nbits = 10; gv_local.lookup_slx_sig[291].bits = 0x3B000000;
-  gv_local.lookup_slx_sig[292].nbits = 10; gv_local.lookup_slx_sig[292].bits = 0x36C00000;
-  gv_local.lookup_slx_sig[293].nbits = 10; gv_local.lookup_slx_sig[293].bits = 0x34400000;
-  gv_local.lookup_slx_sig[294].nbits = 10; gv_local.lookup_slx_sig[294].bits = 0x36800000;
-  gv_local.lookup_slx_sig[295].nbits = 10; gv_local.lookup_slx_sig[295].bits = 0x2A400000;
-  gv_local.lookup_slx_sig[296].nbits = 10; gv_local.lookup_slx_sig[296].bits = 0x1EC00000;
-  gv_local.lookup_slx_sig[297].nbits = 10; gv_local.lookup_slx_sig[297].bits = 0x2AC00000;
-  gv_local.lookup_slx_sig[298].nbits = 10; gv_local.lookup_slx_sig[298].bits = 0x1AC00000;
-  gv_local.lookup_slx_sig[299].nbits = 10; gv_local.lookup_slx_sig[299].bits = 0x1E400000;
-  gv_local.lookup_slx_sig[300].nbits = 11; gv_local.lookup_slx_sig[300].bits = 0xD7400000;
-  gv_local.lookup_slx_sig[301].nbits = 11; gv_local.lookup_slx_sig[301].bits = 0xD5A00000;
-  gv_local.lookup_slx_sig[302].nbits = 11; gv_local.lookup_slx_sig[302].bits = 0xD7A00000;
-  gv_local.lookup_slx_sig[303].nbits = 10; gv_local.lookup_slx_sig[303].bits = 0x18000000;
-  gv_local.lookup_slx_sig[304].nbits = 11; gv_local.lookup_slx_sig[304].bits = 0xCCE00000;
-  gv_local.lookup_slx_sig[305].nbits = 11; gv_local.lookup_slx_sig[305].bits = 0xC9400000;
-  gv_local.lookup_slx_sig[306].nbits = 11; gv_local.lookup_slx_sig[306].bits = 0xCB800000;
-  gv_local.lookup_slx_sig[307].nbits = 11; gv_local.lookup_slx_sig[307].bits = 0xCC200000;
-  gv_local.lookup_slx_sig[308].nbits = 11; gv_local.lookup_slx_sig[308].bits = 0xCC000000;
-  gv_local.lookup_slx_sig[309].nbits = 11; gv_local.lookup_slx_sig[309].bits = 0xC8200000;
-  gv_local.lookup_slx_sig[310].nbits = 11; gv_local.lookup_slx_sig[310].bits = 0xC5400000;
-  gv_local.lookup_slx_sig[311].nbits = 11; gv_local.lookup_slx_sig[311].bits = 0xC0C00000;
-  gv_local.lookup_slx_sig[312].nbits = 11; gv_local.lookup_slx_sig[312].bits = 0xC1E00000;
-  gv_local.lookup_slx_sig[313].nbits = 11; gv_local.lookup_slx_sig[313].bits = 0xBA800000;
-  gv_local.lookup_slx_sig[314].nbits = 11; gv_local.lookup_slx_sig[314].bits = 0xBCC00000;
-  gv_local.lookup_slx_sig[315].nbits = 11; gv_local.lookup_slx_sig[315].bits = 0xBC400000;
-  gv_local.lookup_slx_sig[316].nbits = 11; gv_local.lookup_slx_sig[316].bits = 0xBC800000;
-  gv_local.lookup_slx_sig[317].nbits = 11; gv_local.lookup_slx_sig[317].bits = 0xB9000000;
-  gv_local.lookup_slx_sig[318].nbits = 11; gv_local.lookup_slx_sig[318].bits = 0xB8600000;
-  gv_local.lookup_slx_sig[319].nbits = 11; gv_local.lookup_slx_sig[319].bits = 0xB7E00000;
-  gv_local.lookup_slx_sig[320].nbits = 11; gv_local.lookup_slx_sig[320].bits = 0xBA200000;
-  gv_local.lookup_slx_sig[321].nbits = 11; gv_local.lookup_slx_sig[321].bits = 0xB7600000;
-  gv_local.lookup_slx_sig[322].nbits = 11; gv_local.lookup_slx_sig[322].bits = 0xB7400000;
-  gv_local.lookup_slx_sig[323].nbits = 11; gv_local.lookup_slx_sig[323].bits = 0xB4600000;
-  gv_local.lookup_slx_sig[324].nbits = 11; gv_local.lookup_slx_sig[324].bits = 0x8BC00000;
-  gv_local.lookup_slx_sig[325].nbits = 11; gv_local.lookup_slx_sig[325].bits = 0xB6E00000;
-  gv_local.lookup_slx_sig[326].nbits = 11; gv_local.lookup_slx_sig[326].bits = 0xB4400000;
-  gv_local.lookup_slx_sig[327].nbits = 11; gv_local.lookup_slx_sig[327].bits = 0x8BE00000;
-  gv_local.lookup_slx_sig[328].nbits = 11; gv_local.lookup_slx_sig[328].bits = 0x58000000;
-  gv_local.lookup_slx_sig[329].nbits = 11; gv_local.lookup_slx_sig[329].bits = 0x58200000;
-  gv_local.lookup_slx_sig[330].nbits = 11; gv_local.lookup_slx_sig[330].bits = 0x3D800000;
-  gv_local.lookup_slx_sig[331].nbits = 11; gv_local.lookup_slx_sig[331].bits = 0x3EA00000;
-  gv_local.lookup_slx_sig[332].nbits = 11; gv_local.lookup_slx_sig[332].bits = 0x3F200000;
-  gv_local.lookup_slx_sig[333].nbits = 11; gv_local.lookup_slx_sig[333].bits = 0x59600000;
-  gv_local.lookup_slx_sig[334].nbits = 11; gv_local.lookup_slx_sig[334].bits = 0x37000000;
-  gv_local.lookup_slx_sig[335].nbits = 11; gv_local.lookup_slx_sig[335].bits = 0x3D200000;
-  gv_local.lookup_slx_sig[336].nbits = 11; gv_local.lookup_slx_sig[336].bits = 0x33800000;
-  gv_local.lookup_slx_sig[337].nbits = 11; gv_local.lookup_slx_sig[337].bits = 0x2E000000;
-  gv_local.lookup_slx_sig[338].nbits = 11; gv_local.lookup_slx_sig[338].bits = 0x3C000000;
-  gv_local.lookup_slx_sig[339].nbits = 11; gv_local.lookup_slx_sig[339].bits = 0x2AA00000;
-  gv_local.lookup_slx_sig[340].nbits = 11; gv_local.lookup_slx_sig[340].bits = 0x34800000;
-  gv_local.lookup_slx_sig[341].nbits = 11; gv_local.lookup_slx_sig[341].bits = 0x32C00000;
-  gv_local.lookup_slx_sig[342].nbits = 11; gv_local.lookup_slx_sig[342].bits = 0x34000000;
-  gv_local.lookup_slx_sig[343].nbits = 11; gv_local.lookup_slx_sig[343].bits = 0x2E600000;
-  gv_local.lookup_slx_sig[344].nbits = 11; gv_local.lookup_slx_sig[344].bits = 0x35E00000;
-  gv_local.lookup_slx_sig[345].nbits = 11; gv_local.lookup_slx_sig[345].bits = 0x32000000;
-  gv_local.lookup_slx_sig[346].nbits = 11; gv_local.lookup_slx_sig[346].bits = 0x2A000000;
-  gv_local.lookup_slx_sig[347].nbits = 11; gv_local.lookup_slx_sig[347].bits = 0x29E00000;
-  gv_local.lookup_slx_sig[348].nbits = 11; gv_local.lookup_slx_sig[348].bits = 0x1CA00000;
-  gv_local.lookup_slx_sig[349].nbits = 11; gv_local.lookup_slx_sig[349].bits = 0x1A200000;
-  gv_local.lookup_slx_sig[350].nbits = 11; gv_local.lookup_slx_sig[350].bits = 0x19400000;
-  gv_local.lookup_slx_sig[351].nbits = 12; gv_local.lookup_slx_sig[351].bits = 0xD5100000;
-  gv_local.lookup_slx_sig[352].nbits = 11; gv_local.lookup_slx_sig[352].bits = 0x1C800000;
-  gv_local.lookup_slx_sig[353].nbits = 11; gv_local.lookup_slx_sig[353].bits = 0x19600000;
-  gv_local.lookup_slx_sig[354].nbits = 12; gv_local.lookup_slx_sig[354].bits = 0xD7900000;
-  gv_local.lookup_slx_sig[355].nbits = 12; gv_local.lookup_slx_sig[355].bits = 0xD7800000;
-  gv_local.lookup_slx_sig[356].nbits = 12; gv_local.lookup_slx_sig[356].bits = 0xCEE00000;
-  gv_local.lookup_slx_sig[357].nbits = 12; gv_local.lookup_slx_sig[357].bits = 0xD5000000;
-  gv_local.lookup_slx_sig[358].nbits = 12; gv_local.lookup_slx_sig[358].bits = 0xCC800000;
-  gv_local.lookup_slx_sig[359].nbits = 12; gv_local.lookup_slx_sig[359].bits = 0xD4A00000;
-  gv_local.lookup_slx_sig[360].nbits = 12; gv_local.lookup_slx_sig[360].bits = 0xCB300000;
-  gv_local.lookup_slx_sig[361].nbits = 12; gv_local.lookup_slx_sig[361].bits = 0xCE700000;
-  gv_local.lookup_slx_sig[362].nbits = 12; gv_local.lookup_slx_sig[362].bits = 0xCE600000;
-  gv_local.lookup_slx_sig[363].nbits = 12; gv_local.lookup_slx_sig[363].bits = 0xCCC00000;
-  gv_local.lookup_slx_sig[364].nbits = 12; gv_local.lookup_slx_sig[364].bits = 0xC1D00000;
-  gv_local.lookup_slx_sig[365].nbits = 12; gv_local.lookup_slx_sig[365].bits = 0xC5600000;
-  gv_local.lookup_slx_sig[366].nbits = 12; gv_local.lookup_slx_sig[366].bits = 0xC8000000;
-  gv_local.lookup_slx_sig[367].nbits = 12; gv_local.lookup_slx_sig[367].bits = 0xC9F00000;
-  gv_local.lookup_slx_sig[368].nbits = 12; gv_local.lookup_slx_sig[368].bits = 0xC9D00000;
-  gv_local.lookup_slx_sig[369].nbits = 12; gv_local.lookup_slx_sig[369].bits = 0xC5C00000;
-  gv_local.lookup_slx_sig[370].nbits = 12; gv_local.lookup_slx_sig[370].bits = 0xBC600000;
-  gv_local.lookup_slx_sig[371].nbits = 12; gv_local.lookup_slx_sig[371].bits = 0xC1B00000;
-  gv_local.lookup_slx_sig[372].nbits = 12; gv_local.lookup_slx_sig[372].bits = 0xBBE00000;
-  gv_local.lookup_slx_sig[373].nbits = 12; gv_local.lookup_slx_sig[373].bits = 0xC1500000;
-  gv_local.lookup_slx_sig[374].nbits = 12; gv_local.lookup_slx_sig[374].bits = 0xBAB00000;
-  gv_local.lookup_slx_sig[375].nbits = 12; gv_local.lookup_slx_sig[375].bits = 0xC1400000;
-  gv_local.lookup_slx_sig[376].nbits = 12; gv_local.lookup_slx_sig[376].bits = 0xB8400000;
-  gv_local.lookup_slx_sig[377].nbits = 12; gv_local.lookup_slx_sig[377].bits = 0xBA000000;
-  gv_local.lookup_slx_sig[378].nbits = 12; gv_local.lookup_slx_sig[378].bits = 0xB7B00000;
-  gv_local.lookup_slx_sig[379].nbits = 12; gv_local.lookup_slx_sig[379].bits = 0xC0400000;
-  gv_local.lookup_slx_sig[380].nbits = 12; gv_local.lookup_slx_sig[380].bits = 0x59400000;
-  gv_local.lookup_slx_sig[381].nbits = 12; gv_local.lookup_slx_sig[381].bits = 0x8B300000;
-  gv_local.lookup_slx_sig[382].nbits = 12; gv_local.lookup_slx_sig[382].bits = 0xB6B00000;
-  gv_local.lookup_slx_sig[383].nbits = 12; gv_local.lookup_slx_sig[383].bits = 0xBA100000;
-  gv_local.lookup_slx_sig[384].nbits = 12; gv_local.lookup_slx_sig[384].bits = 0x5EF00000;
-  gv_local.lookup_slx_sig[385].nbits = 12; gv_local.lookup_slx_sig[385].bits = 0xB5000000;
-  gv_local.lookup_slx_sig[386].nbits = 12; gv_local.lookup_slx_sig[386].bits = 0xB7200000;
-  gv_local.lookup_slx_sig[387].nbits = 12; gv_local.lookup_slx_sig[387].bits = 0xB7A00000;
-  gv_local.lookup_slx_sig[388].nbits = 12; gv_local.lookup_slx_sig[388].bits = 0x8B200000;
-  gv_local.lookup_slx_sig[389].nbits = 12; gv_local.lookup_slx_sig[389].bits = 0x3F800000;
-  gv_local.lookup_slx_sig[390].nbits = 12; gv_local.lookup_slx_sig[390].bits = 0xB7100000;
-  gv_local.lookup_slx_sig[391].nbits = 12; gv_local.lookup_slx_sig[391].bits = 0x3E400000;
-  gv_local.lookup_slx_sig[392].nbits = 12; gv_local.lookup_slx_sig[392].bits = 0x5EA00000;
-  gv_local.lookup_slx_sig[393].nbits = 12; gv_local.lookup_slx_sig[393].bits = 0xB6A00000;
-  gv_local.lookup_slx_sig[394].nbits = 12; gv_local.lookup_slx_sig[394].bits = 0x39C00000;
-  gv_local.lookup_slx_sig[395].nbits = 12; gv_local.lookup_slx_sig[395].bits = 0x3E900000;
-  gv_local.lookup_slx_sig[396].nbits = 12; gv_local.lookup_slx_sig[396].bits = 0x8B100000;
-  gv_local.lookup_slx_sig[397].nbits = 12; gv_local.lookup_slx_sig[397].bits = 0x39D00000;
-  gv_local.lookup_slx_sig[398].nbits = 12; gv_local.lookup_slx_sig[398].bits = 0x3B600000;
-  gv_local.lookup_slx_sig[399].nbits = 12; gv_local.lookup_slx_sig[399].bits = 0x3C200000;
-  gv_local.lookup_slx_sig[400].nbits = 12; gv_local.lookup_slx_sig[400].bits = 0x39600000;
-  gv_local.lookup_slx_sig[401].nbits = 12; gv_local.lookup_slx_sig[401].bits = 0x3D700000;
-  gv_local.lookup_slx_sig[402].nbits = 12; gv_local.lookup_slx_sig[402].bits = 0x35900000;
-  gv_local.lookup_slx_sig[403].nbits = 12; gv_local.lookup_slx_sig[403].bits = 0x1E900000;
-  gv_local.lookup_slx_sig[404].nbits = 12; gv_local.lookup_slx_sig[404].bits = 0x34200000;
-  gv_local.lookup_slx_sig[405].nbits = 12; gv_local.lookup_slx_sig[405].bits = 0x2F700000;
-  gv_local.lookup_slx_sig[406].nbits = 12; gv_local.lookup_slx_sig[406].bits = 0x33700000;
-  gv_local.lookup_slx_sig[407].nbits = 12; gv_local.lookup_slx_sig[407].bits = 0x33000000;
-  gv_local.lookup_slx_sig[408].nbits = 12; gv_local.lookup_slx_sig[408].bits = 0x2F000000;
-  gv_local.lookup_slx_sig[409].nbits = 12; gv_local.lookup_slx_sig[409].bits = 0x37200000;
-  gv_local.lookup_slx_sig[410].nbits = 12; gv_local.lookup_slx_sig[410].bits = 0x1C400000;
-  gv_local.lookup_slx_sig[411].nbits = 12; gv_local.lookup_slx_sig[411].bits = 0x28500000;
-  gv_local.lookup_slx_sig[412].nbits = 12; gv_local.lookup_slx_sig[412].bits = 0x1CE00000;
-  gv_local.lookup_slx_sig[413].nbits = 12; gv_local.lookup_slx_sig[413].bits = 0x1A800000;
-  gv_local.lookup_slx_sig[414].nbits = 12; gv_local.lookup_slx_sig[414].bits = 0x1EB00000;
-  gv_local.lookup_slx_sig[415].nbits = 13; gv_local.lookup_slx_sig[415].bits = 0xCEC80000;
-  gv_local.lookup_slx_sig[416].nbits = 13; gv_local.lookup_slx_sig[416].bits = 0xD6100000;
-  gv_local.lookup_slx_sig[417].nbits = 13; gv_local.lookup_slx_sig[417].bits = 0xD7E00000;
-  gv_local.lookup_slx_sig[418].nbits = 12; gv_local.lookup_slx_sig[418].bits = 0x1A100000;
-  gv_local.lookup_slx_sig[419].nbits = 12; gv_local.lookup_slx_sig[419].bits = 0x19300000;
-  gv_local.lookup_slx_sig[420].nbits = 12; gv_local.lookup_slx_sig[420].bits = 0x1CF00000;
-  gv_local.lookup_slx_sig[421].nbits = 12; gv_local.lookup_slx_sig[421].bits = 0x2A300000;
-  gv_local.lookup_slx_sig[422].nbits = 13; gv_local.lookup_slx_sig[422].bits = 0xD4B00000;
-  gv_local.lookup_slx_sig[423].nbits = 13; gv_local.lookup_slx_sig[423].bits = 0xD6380000;
-  gv_local.lookup_slx_sig[424].nbits = 12; gv_local.lookup_slx_sig[424].bits = 0x1A000000;
-  gv_local.lookup_slx_sig[425].nbits = 13; gv_local.lookup_slx_sig[425].bits = 0xCB280000;
-  gv_local.lookup_slx_sig[426].nbits = 13; gv_local.lookup_slx_sig[426].bits = 0xD4F00000;
-  gv_local.lookup_slx_sig[427].nbits = 13; gv_local.lookup_slx_sig[427].bits = 0xD4B80000;
-  gv_local.lookup_slx_sig[428].nbits = 12; gv_local.lookup_slx_sig[428].bits = 0x1B700000;
-  gv_local.lookup_slx_sig[429].nbits = 13; gv_local.lookup_slx_sig[429].bits = 0xD5680000;
-  gv_local.lookup_slx_sig[430].nbits = 13; gv_local.lookup_slx_sig[430].bits = 0xCCD80000;
-  gv_local.lookup_slx_sig[431].nbits = 13; gv_local.lookup_slx_sig[431].bits = 0xCE500000;
-  gv_local.lookup_slx_sig[432].nbits = 13; gv_local.lookup_slx_sig[432].bits = 0xCEC00000;
-  gv_local.lookup_slx_sig[433].nbits = 13; gv_local.lookup_slx_sig[433].bits = 0xC9A80000;
-  gv_local.lookup_slx_sig[434].nbits = 13; gv_local.lookup_slx_sig[434].bits = 0xCB200000;
-  gv_local.lookup_slx_sig[435].nbits = 13; gv_local.lookup_slx_sig[435].bits = 0xBD780000;
-  gv_local.lookup_slx_sig[436].nbits = 13; gv_local.lookup_slx_sig[436].bits = 0xC8780000;
-  gv_local.lookup_slx_sig[437].nbits = 13; gv_local.lookup_slx_sig[437].bits = 0xBBF00000;
-  gv_local.lookup_slx_sig[438].nbits = 13; gv_local.lookup_slx_sig[438].bits = 0xBD600000;
-  gv_local.lookup_slx_sig[439].nbits = 13; gv_local.lookup_slx_sig[439].bits = 0xC8700000;
-  gv_local.lookup_slx_sig[440].nbits = 13; gv_local.lookup_slx_sig[440].bits = 0xB7D00000;
-  gv_local.lookup_slx_sig[441].nbits = 13; gv_local.lookup_slx_sig[441].bits = 0xC4580000;
-  gv_local.lookup_slx_sig[442].nbits = 13; gv_local.lookup_slx_sig[442].bits = 0xC5280000;
-  gv_local.lookup_slx_sig[443].nbits = 13; gv_local.lookup_slx_sig[443].bits = 0xC0B00000;
-  gv_local.lookup_slx_sig[444].nbits = 13; gv_local.lookup_slx_sig[444].bits = 0xB9300000;
-  gv_local.lookup_slx_sig[445].nbits = 13; gv_local.lookup_slx_sig[445].bits = 0xBC780000;
-  gv_local.lookup_slx_sig[446].nbits = 13; gv_local.lookup_slx_sig[446].bits = 0xB7000000;
-  gv_local.lookup_slx_sig[447].nbits = 13; gv_local.lookup_slx_sig[447].bits = 0xBD680000;
-  gv_local.lookup_slx_sig[448].nbits = 13; gv_local.lookup_slx_sig[448].bits = 0xC1A80000;
-  gv_local.lookup_slx_sig[449].nbits = 13; gv_local.lookup_slx_sig[449].bits = 0xBAA80000;
-  gv_local.lookup_slx_sig[450].nbits = 13; gv_local.lookup_slx_sig[450].bits = 0xB7800000;
-  gv_local.lookup_slx_sig[451].nbits = 13; gv_local.lookup_slx_sig[451].bits = 0xB9380000;
-  gv_local.lookup_slx_sig[452].nbits = 13; gv_local.lookup_slx_sig[452].bits = 0x5E480000;
-  gv_local.lookup_slx_sig[453].nbits = 13; gv_local.lookup_slx_sig[453].bits = 0xB6980000;
-  gv_local.lookup_slx_sig[454].nbits = 13; gv_local.lookup_slx_sig[454].bits = 0xBBF80000;
-  gv_local.lookup_slx_sig[455].nbits = 13; gv_local.lookup_slx_sig[455].bits = 0x8B000000;
-  gv_local.lookup_slx_sig[456].nbits = 13; gv_local.lookup_slx_sig[456].bits = 0xB6900000;
-  gv_local.lookup_slx_sig[457].nbits = 13; gv_local.lookup_slx_sig[457].bits = 0x8B800000;
-  gv_local.lookup_slx_sig[458].nbits = 13; gv_local.lookup_slx_sig[458].bits = 0x5E400000;
-  gv_local.lookup_slx_sig[459].nbits = 13; gv_local.lookup_slx_sig[459].bits = 0xB5100000;
-  gv_local.lookup_slx_sig[460].nbits = 13; gv_local.lookup_slx_sig[460].bits = 0xB5380000;
-  gv_local.lookup_slx_sig[461].nbits = 13; gv_local.lookup_slx_sig[461].bits = 0xBA400000;
-  gv_local.lookup_slx_sig[462].nbits = 13; gv_local.lookup_slx_sig[462].bits = 0xBAF00000;
-  gv_local.lookup_slx_sig[463].nbits = 13; gv_local.lookup_slx_sig[463].bits = 0xB5300000;
-  gv_local.lookup_slx_sig[464].nbits = 13; gv_local.lookup_slx_sig[464].bits = 0x3B700000;
-  gv_local.lookup_slx_sig[465].nbits = 13; gv_local.lookup_slx_sig[465].bits = 0xBAF80000;
-  gv_local.lookup_slx_sig[466].nbits = 13; gv_local.lookup_slx_sig[466].bits = 0x8B080000;
-  gv_local.lookup_slx_sig[467].nbits = 13; gv_local.lookup_slx_sig[467].bits = 0x5EE00000;
-  gv_local.lookup_slx_sig[468].nbits = 13; gv_local.lookup_slx_sig[468].bits = 0x59580000;
-  gv_local.lookup_slx_sig[469].nbits = 13; gv_local.lookup_slx_sig[469].bits = 0x5E580000;
-  gv_local.lookup_slx_sig[470].nbits = 13; gv_local.lookup_slx_sig[470].bits = 0x59080000;
-  gv_local.lookup_slx_sig[471].nbits = 13; gv_local.lookup_slx_sig[471].bits = 0x39A00000;
-  gv_local.lookup_slx_sig[472].nbits = 13; gv_local.lookup_slx_sig[472].bits = 0x39F00000;
-  gv_local.lookup_slx_sig[473].nbits = 13; gv_local.lookup_slx_sig[473].bits = 0x37300000;
-  gv_local.lookup_slx_sig[474].nbits = 13; gv_local.lookup_slx_sig[474].bits = 0x3D600000;
-  gv_local.lookup_slx_sig[475].nbits = 13; gv_local.lookup_slx_sig[475].bits = 0x39F80000;
-  gv_local.lookup_slx_sig[476].nbits = 13; gv_local.lookup_slx_sig[476].bits = 0x28480000;
-  gv_local.lookup_slx_sig[477].nbits = 13; gv_local.lookup_slx_sig[477].bits = 0x5E500000;
-  gv_local.lookup_slx_sig[478].nbits = 13; gv_local.lookup_slx_sig[478].bits = 0x28680000;
-  gv_local.lookup_slx_sig[479].nbits = 13; gv_local.lookup_slx_sig[479].bits = 0x3B780000;
-  gv_local.lookup_slx_sig[480].nbits = 13; gv_local.lookup_slx_sig[480].bits = 0x32980000;
-  gv_local.lookup_slx_sig[481].nbits = 13; gv_local.lookup_slx_sig[481].bits = 0x2F600000;
-  gv_local.lookup_slx_sig[482].nbits = 13; gv_local.lookup_slx_sig[482].bits = 0x37380000;
-  gv_local.lookup_slx_sig[483].nbits = 13; gv_local.lookup_slx_sig[483].bits = 0x39A80000;
-  gv_local.lookup_slx_sig[484].nbits = 13; gv_local.lookup_slx_sig[484].bits = 0x35880000;
-  gv_local.lookup_slx_sig[485].nbits = 13; gv_local.lookup_slx_sig[485].bits = 0x35800000;
-  gv_local.lookup_slx_sig[486].nbits = 13; gv_local.lookup_slx_sig[486].bits = 0x1E800000;
-  gv_local.lookup_slx_sig[487].nbits = 13; gv_local.lookup_slx_sig[487].bits = 0x1EA80000;
-  gv_local.lookup_slx_sig[488].nbits = 13; gv_local.lookup_slx_sig[488].bits = 0x33680000;
-  gv_local.lookup_slx_sig[489].nbits = 13; gv_local.lookup_slx_sig[489].bits = 0x1E880000;
-  gv_local.lookup_slx_sig[490].nbits = 13; gv_local.lookup_slx_sig[490].bits = 0x2F680000;
-  gv_local.lookup_slx_sig[491].nbits = 13; gv_local.lookup_slx_sig[491].bits = 0x33600000;
-  gv_local.lookup_slx_sig[492].nbits = 14; gv_local.lookup_slx_sig[492].bits = 0xCEF40000;
-  gv_local.lookup_slx_sig[493].nbits = 13; gv_local.lookup_slx_sig[493].bits = 0x59000000;
-  gv_local.lookup_slx_sig[494].nbits = 13; gv_local.lookup_slx_sig[494].bits = 0x19200000;
-  gv_local.lookup_slx_sig[495].nbits = 13; gv_local.lookup_slx_sig[495].bits = 0x1EA00000;
-  gv_local.lookup_slx_sig[496].nbits = 13; gv_local.lookup_slx_sig[496].bits = 0x1A900000;
-  gv_local.lookup_slx_sig[497].nbits = 13; gv_local.lookup_slx_sig[497].bits = 0x32900000;
-  gv_local.lookup_slx_sig[498].nbits = 13; gv_local.lookup_slx_sig[498].bits = 0x28600000;
-  gv_local.lookup_slx_sig[499].nbits = 14; gv_local.lookup_slx_sig[499].bits = 0xCE580000;
-  gv_local.lookup_slx_sig[500].nbits = 13; gv_local.lookup_slx_sig[500].bits = 0x1A980000;
-  gv_local.lookup_slx_sig[501].nbits = 14; gv_local.lookup_slx_sig[501].bits = 0xCA640000;
-  gv_local.lookup_slx_sig[502].nbits = 13; gv_local.lookup_slx_sig[502].bits = 0x19280000;
-  gv_local.lookup_slx_sig[503].nbits = 14; gv_local.lookup_slx_sig[503].bits = 0xD6240000;
-  gv_local.lookup_slx_sig[504].nbits = 14; gv_local.lookup_slx_sig[504].bits = 0xD5600000;
-  gv_local.lookup_slx_sig[505].nbits = 13; gv_local.lookup_slx_sig[505].bits = 0x28400000;
-  gv_local.lookup_slx_sig[506].nbits = 14; gv_local.lookup_slx_sig[506].bits = 0xD6200000;
-  gv_local.lookup_slx_sig[507].nbits = 14; gv_local.lookup_slx_sig[507].bits = 0xCE5C0000;
-  gv_local.lookup_slx_sig[508].nbits = 14; gv_local.lookup_slx_sig[508].bits = 0xD5640000;
-  gv_local.lookup_slx_sig[509].nbits = 14; gv_local.lookup_slx_sig[509].bits = 0xCEF00000;
-  gv_local.lookup_slx_sig[510].nbits = 14; gv_local.lookup_slx_sig[510].bits = 0xCA600000;
-  gv_local.lookup_slx_sig[511].nbits =  4; gv_local.lookup_slx_sig[511].bits = 0x40000000;
-
-#if SRA_DECOMPRESS_USE_REVERSE_LOOKUP
-  /* reverse huffman lookup table
-   */
-  memset (gv_local.rlookup_slx_sig, 0, sizeof(uint16_t)*REV_HUFF_TREESIZE_16);
-
-  for (i=0; i<SIG_HUFF_TREESIZE; i++)
-  {
-    val = gv_local.lookup_slx_sig[i].bits >> 16;
-    gv_local.rlookup_slx_sig [val] = (uint16_t) i;
-    for (j=1; j<=(0xFFFF>>gv_local.lookup_slx_sig[i].nbits); j++)
-      gv_local.rlookup_slx_sig [val+j] = (uint16_t) i;
-  }
-#endif
-
-  _s_sort_lookup (gv_local.lookup_slx_sig, gv_local.idx_slx_sig, SIG_HUFF_TREESIZE);
-
-  gv_local.lookup_slx_sig_initialized = 1;
-}
-/*
- */
-static void _s_init_int_slx_default (void)
-{
-#if SRA_DECOMPRESS_USE_REVERSE_LOOKUP
-  int      i, j;
-  uint16_t val;
-#endif
-
-  memset (gv_local.lookup_slx_int,  0, sizeof(SRALookup)*INT_HUFF_TREESIZE);
-
-  gv_local.lookup_slx_int[   0].nbits = 13; gv_local.lookup_slx_int[   0].bits = 0x9DF80000;
-  gv_local.lookup_slx_int[   1].nbits = 13; gv_local.lookup_slx_int[   1].bits = 0x9DF00000;
-  gv_local.lookup_slx_int[   2].nbits = 13; gv_local.lookup_slx_int[   2].bits = 0xA4A00000;
-  gv_local.lookup_slx_int[   3].nbits = 13; gv_local.lookup_slx_int[   3].bits = 0xA7C00000;
-  gv_local.lookup_slx_int[   4].nbits = 13; gv_local.lookup_slx_int[   4].bits = 0xA4A80000;
-  gv_local.lookup_slx_int[   5].nbits = 13; gv_local.lookup_slx_int[   5].bits = 0xA7C80000;
-  gv_local.lookup_slx_int[   6].nbits = 13; gv_local.lookup_slx_int[   6].bits = 0xB6000000;
-  gv_local.lookup_slx_int[   7].nbits = 13; gv_local.lookup_slx_int[   7].bits = 0xAF600000;
-  gv_local.lookup_slx_int[   8].nbits = 13; gv_local.lookup_slx_int[   8].bits = 0xAF680000;
-  gv_local.lookup_slx_int[   9].nbits = 13; gv_local.lookup_slx_int[   9].bits = 0xBBA00000;
-  gv_local.lookup_slx_int[  10].nbits = 13; gv_local.lookup_slx_int[  10].bits = 0xB6080000;
-  gv_local.lookup_slx_int[  11].nbits = 13; gv_local.lookup_slx_int[  11].bits = 0xBBA80000;
-  gv_local.lookup_slx_int[  12].nbits = 13; gv_local.lookup_slx_int[  12].bits = 0xBDC80000;
-  gv_local.lookup_slx_int[  13].nbits = 13; gv_local.lookup_slx_int[  13].bits = 0xBDC00000;
-  gv_local.lookup_slx_int[  14].nbits = 13; gv_local.lookup_slx_int[  14].bits = 0xCA400000;
-  gv_local.lookup_slx_int[  15].nbits = 13; gv_local.lookup_slx_int[  15].bits = 0xC1F80000;
-  gv_local.lookup_slx_int[  16].nbits = 13; gv_local.lookup_slx_int[  16].bits = 0xC1F00000;
-  gv_local.lookup_slx_int[  17].nbits = 13; gv_local.lookup_slx_int[  17].bits = 0xCA480000;
-  gv_local.lookup_slx_int[  18].nbits = 13; gv_local.lookup_slx_int[  18].bits = 0xCF600000;
-  gv_local.lookup_slx_int[  19].nbits = 13; gv_local.lookup_slx_int[  19].bits = 0xD2C00000;
-  gv_local.lookup_slx_int[  20].nbits = 13; gv_local.lookup_slx_int[  20].bits = 0xCF680000;
-  gv_local.lookup_slx_int[  21].nbits = 13; gv_local.lookup_slx_int[  21].bits = 0xD2C80000;
-  gv_local.lookup_slx_int[  22].nbits = 13; gv_local.lookup_slx_int[  22].bits = 0xDA200000;
-  gv_local.lookup_slx_int[  23].nbits = 13; gv_local.lookup_slx_int[  23].bits = 0xDE900000;
-  gv_local.lookup_slx_int[  24].nbits = 13; gv_local.lookup_slx_int[  24].bits = 0xDA280000;
-  gv_local.lookup_slx_int[  25].nbits = 12; gv_local.lookup_slx_int[  25].bits = 0x02C00000;
-  gv_local.lookup_slx_int[  26].nbits = 13; gv_local.lookup_slx_int[  26].bits = 0xDE980000;
-  gv_local.lookup_slx_int[  27].nbits = 12; gv_local.lookup_slx_int[  27].bits = 0x02D00000;
-  gv_local.lookup_slx_int[  28].nbits = 12; gv_local.lookup_slx_int[  28].bits = 0x0C400000;
-  gv_local.lookup_slx_int[  29].nbits = 12; gv_local.lookup_slx_int[  29].bits = 0x0C500000;
-  gv_local.lookup_slx_int[  30].nbits = 12; gv_local.lookup_slx_int[  30].bits = 0x1A800000;
-  gv_local.lookup_slx_int[  31].nbits = 12; gv_local.lookup_slx_int[  31].bits = 0x1A900000;
-  gv_local.lookup_slx_int[  32].nbits = 12; gv_local.lookup_slx_int[  32].bits = 0x21300000;
-  gv_local.lookup_slx_int[  33].nbits = 12; gv_local.lookup_slx_int[  33].bits = 0x21100000;
-  gv_local.lookup_slx_int[  34].nbits = 12; gv_local.lookup_slx_int[  34].bits = 0x29900000;
-  gv_local.lookup_slx_int[  35].nbits = 12; gv_local.lookup_slx_int[  35].bits = 0x3C200000;
-  gv_local.lookup_slx_int[  36].nbits = 12; gv_local.lookup_slx_int[  36].bits = 0x3C000000;
-  gv_local.lookup_slx_int[  37].nbits = 12; gv_local.lookup_slx_int[  37].bits = 0x3E600000;
-  gv_local.lookup_slx_int[  38].nbits = 12; gv_local.lookup_slx_int[  38].bits = 0x4C000000;
-  gv_local.lookup_slx_int[  39].nbits = 12; gv_local.lookup_slx_int[  39].bits = 0x4F000000;
-  gv_local.lookup_slx_int[  40].nbits = 12; gv_local.lookup_slx_int[  40].bits = 0x4C400000;
-  gv_local.lookup_slx_int[  41].nbits = 12; gv_local.lookup_slx_int[  41].bits = 0x4F300000;
-  gv_local.lookup_slx_int[  42].nbits = 12; gv_local.lookup_slx_int[  42].bits = 0x58D00000;
-  gv_local.lookup_slx_int[  43].nbits = 12; gv_local.lookup_slx_int[  43].bits = 0x4F100000;
-  gv_local.lookup_slx_int[  44].nbits = 12; gv_local.lookup_slx_int[  44].bits = 0x5BA00000;
-  gv_local.lookup_slx_int[  45].nbits = 12; gv_local.lookup_slx_int[  45].bits = 0x6D000000;
-  gv_local.lookup_slx_int[  46].nbits = 12; gv_local.lookup_slx_int[  46].bits = 0x6F200000;
-  gv_local.lookup_slx_int[  47].nbits = 12; gv_local.lookup_slx_int[  47].bits = 0x7D800000;
-  gv_local.lookup_slx_int[  48].nbits = 12; gv_local.lookup_slx_int[  48].bits = 0x84800000;
-  gv_local.lookup_slx_int[  49].nbits = 12; gv_local.lookup_slx_int[  49].bits = 0x86600000;
-  gv_local.lookup_slx_int[  50].nbits = 12; gv_local.lookup_slx_int[  50].bits = 0x8DC00000;
-  gv_local.lookup_slx_int[  51].nbits = 12; gv_local.lookup_slx_int[  51].bits = 0x8DD00000;
-  gv_local.lookup_slx_int[  52].nbits = 12; gv_local.lookup_slx_int[  52].bits = 0x91100000;
-  gv_local.lookup_slx_int[  53].nbits = 12; gv_local.lookup_slx_int[  53].bits = 0x95000000;
-  gv_local.lookup_slx_int[  54].nbits = 12; gv_local.lookup_slx_int[  54].bits = 0x9CA00000;
-  gv_local.lookup_slx_int[  55].nbits = 12; gv_local.lookup_slx_int[  55].bits = 0x9DE00000;
-  gv_local.lookup_slx_int[  56].nbits = 12; gv_local.lookup_slx_int[  56].bits = 0x9CB00000;
-  gv_local.lookup_slx_int[  57].nbits = 12; gv_local.lookup_slx_int[  57].bits = 0xA3200000;
-  gv_local.lookup_slx_int[  58].nbits = 12; gv_local.lookup_slx_int[  58].bits = 0xA5E00000;
-  gv_local.lookup_slx_int[  59].nbits = 12; gv_local.lookup_slx_int[  59].bits = 0xA9500000;
-  gv_local.lookup_slx_int[  60].nbits = 12; gv_local.lookup_slx_int[  60].bits = 0xAF400000;
-  gv_local.lookup_slx_int[  61].nbits = 12; gv_local.lookup_slx_int[  61].bits = 0xAF700000;
-  gv_local.lookup_slx_int[  62].nbits = 12; gv_local.lookup_slx_int[  62].bits = 0xB6900000;
-  gv_local.lookup_slx_int[  63].nbits = 12; gv_local.lookup_slx_int[  63].bits = 0xB6100000;
-  gv_local.lookup_slx_int[  64].nbits = 12; gv_local.lookup_slx_int[  64].bits = 0xBBB00000;
-  gv_local.lookup_slx_int[  65].nbits = 12; gv_local.lookup_slx_int[  65].bits = 0xBD900000;
-  gv_local.lookup_slx_int[  66].nbits = 12; gv_local.lookup_slx_int[  66].bits = 0xC1A00000;
-  gv_local.lookup_slx_int[  67].nbits = 12; gv_local.lookup_slx_int[  67].bits = 0xC1E00000;
-  gv_local.lookup_slx_int[  68].nbits = 12; gv_local.lookup_slx_int[  68].bits = 0xC9400000;
-  gv_local.lookup_slx_int[  69].nbits = 12; gv_local.lookup_slx_int[  69].bits = 0xCA500000;
-  gv_local.lookup_slx_int[  70].nbits = 12; gv_local.lookup_slx_int[  70].bits = 0xCB600000;
-  gv_local.lookup_slx_int[  71].nbits = 12; gv_local.lookup_slx_int[  71].bits = 0xCB700000;
-  gv_local.lookup_slx_int[  72].nbits = 12; gv_local.lookup_slx_int[  72].bits = 0xCFF00000;
-  gv_local.lookup_slx_int[  73].nbits = 12; gv_local.lookup_slx_int[  73].bits = 0xD9900000;
-  gv_local.lookup_slx_int[  74].nbits = 12; gv_local.lookup_slx_int[  74].bits = 0xD9800000;
-  gv_local.lookup_slx_int[  75].nbits = 12; gv_local.lookup_slx_int[  75].bits = 0xDA300000;
-  gv_local.lookup_slx_int[  76].nbits = 11; gv_local.lookup_slx_int[  76].bits = 0x02800000;
-  gv_local.lookup_slx_int[  77].nbits = 11; gv_local.lookup_slx_int[  77].bits = 0x02A00000;
-  gv_local.lookup_slx_int[  78].nbits = 11; gv_local.lookup_slx_int[  78].bits = 0x0C600000;
-  gv_local.lookup_slx_int[  79].nbits = 11; gv_local.lookup_slx_int[  79].bits = 0x09800000;
-  gv_local.lookup_slx_int[  80].nbits = 11; gv_local.lookup_slx_int[  80].bits = 0x0D600000;
-  gv_local.lookup_slx_int[  81].nbits = 11; gv_local.lookup_slx_int[  81].bits = 0x11200000;
-  gv_local.lookup_slx_int[  82].nbits = 11; gv_local.lookup_slx_int[  82].bits = 0x1AA00000;
-  gv_local.lookup_slx_int[  83].nbits = 11; gv_local.lookup_slx_int[  83].bits = 0x27800000;
-  gv_local.lookup_slx_int[  84].nbits = 11; gv_local.lookup_slx_int[  84].bits = 0x29400000;
-  gv_local.lookup_slx_int[  85].nbits = 11; gv_local.lookup_slx_int[  85].bits = 0x29A00000;
-  gv_local.lookup_slx_int[  86].nbits = 11; gv_local.lookup_slx_int[  86].bits = 0x32800000;
-  gv_local.lookup_slx_int[  87].nbits = 11; gv_local.lookup_slx_int[  87].bits = 0x3C600000;
-  gv_local.lookup_slx_int[  88].nbits = 11; gv_local.lookup_slx_int[  88].bits = 0x42000000;
-  gv_local.lookup_slx_int[  89].nbits = 11; gv_local.lookup_slx_int[  89].bits = 0x42E00000;
-  gv_local.lookup_slx_int[  90].nbits = 11; gv_local.lookup_slx_int[  90].bits = 0x4C200000;
-  gv_local.lookup_slx_int[  91].nbits = 11; gv_local.lookup_slx_int[  91].bits = 0x4E400000;
-  gv_local.lookup_slx_int[  92].nbits = 11; gv_local.lookup_slx_int[  92].bits = 0x58600000;
-  gv_local.lookup_slx_int[  93].nbits = 11; gv_local.lookup_slx_int[  93].bits = 0x58400000;
-  gv_local.lookup_slx_int[  94].nbits = 11; gv_local.lookup_slx_int[  94].bits = 0x58A00000;
-  gv_local.lookup_slx_int[  95].nbits = 11; gv_local.lookup_slx_int[  95].bits = 0x63E00000;
-  gv_local.lookup_slx_int[  96].nbits = 11; gv_local.lookup_slx_int[  96].bits = 0x65800000;
-  gv_local.lookup_slx_int[  97].nbits = 11; gv_local.lookup_slx_int[  97].bits = 0x6D200000;
-  gv_local.lookup_slx_int[  98].nbits = 11; gv_local.lookup_slx_int[  98].bits = 0x6D400000;
-  gv_local.lookup_slx_int[  99].nbits = 11; gv_local.lookup_slx_int[  99].bits = 0x75C00000;
-  gv_local.lookup_slx_int[ 100].nbits = 11; gv_local.lookup_slx_int[ 100].bits = 0x75E00000;
-  gv_local.lookup_slx_int[ 101].nbits = 11; gv_local.lookup_slx_int[ 101].bits = 0x84A00000;
-  gv_local.lookup_slx_int[ 102].nbits = 11; gv_local.lookup_slx_int[ 102].bits = 0x87200000;
-  gv_local.lookup_slx_int[ 103].nbits = 11; gv_local.lookup_slx_int[ 103].bits = 0x87E00000;
-  gv_local.lookup_slx_int[ 104].nbits = 11; gv_local.lookup_slx_int[ 104].bits = 0x8DE00000;
-  gv_local.lookup_slx_int[ 105].nbits = 11; gv_local.lookup_slx_int[ 105].bits = 0x90400000;
-  gv_local.lookup_slx_int[ 106].nbits = 11; gv_local.lookup_slx_int[ 106].bits = 0x91E00000;
-  gv_local.lookup_slx_int[ 107].nbits = 11; gv_local.lookup_slx_int[ 107].bits = 0x9CC00000;
-  gv_local.lookup_slx_int[ 108].nbits = 11; gv_local.lookup_slx_int[ 108].bits = 0x9CE00000;
-  gv_local.lookup_slx_int[ 109].nbits = 11; gv_local.lookup_slx_int[ 109].bits = 0xA3000000;
-  gv_local.lookup_slx_int[ 110].nbits = 11; gv_local.lookup_slx_int[ 110].bits = 0xA3A00000;
-  gv_local.lookup_slx_int[ 111].nbits = 11; gv_local.lookup_slx_int[ 111].bits = 0xA4800000;
-  gv_local.lookup_slx_int[ 112].nbits = 11; gv_local.lookup_slx_int[ 112].bits = 0xA4E00000;
-  gv_local.lookup_slx_int[ 113].nbits = 11; gv_local.lookup_slx_int[ 113].bits = 0xA7E00000;
-  gv_local.lookup_slx_int[ 114].nbits = 11; gv_local.lookup_slx_int[ 114].bits = 0xAE000000;
-  gv_local.lookup_slx_int[ 115].nbits = 11; gv_local.lookup_slx_int[ 115].bits = 0xB1A00000;
-  gv_local.lookup_slx_int[ 116].nbits = 11; gv_local.lookup_slx_int[ 116].bits = 0xB3A00000;
-  gv_local.lookup_slx_int[ 117].nbits = 11; gv_local.lookup_slx_int[ 117].bits = 0xB6A00000;
-  gv_local.lookup_slx_int[ 118].nbits = 11; gv_local.lookup_slx_int[ 118].bits = 0xBD000000;
-  gv_local.lookup_slx_int[ 119].nbits = 11; gv_local.lookup_slx_int[ 119].bits = 0xBA600000;
-  gv_local.lookup_slx_int[ 120].nbits = 11; gv_local.lookup_slx_int[ 120].bits = 0xBF000000;
-  gv_local.lookup_slx_int[ 121].nbits = 11; gv_local.lookup_slx_int[ 121].bits = 0xBF200000;
-  gv_local.lookup_slx_int[ 122].nbits = 11; gv_local.lookup_slx_int[ 122].bits = 0xC1800000;
-  gv_local.lookup_slx_int[ 123].nbits = 11; gv_local.lookup_slx_int[ 123].bits = 0xC1C00000;
-  gv_local.lookup_slx_int[ 124].nbits = 11; gv_local.lookup_slx_int[ 124].bits = 0xC9600000;
-  gv_local.lookup_slx_int[ 125].nbits = 11; gv_local.lookup_slx_int[ 125].bits = 0xCA600000;
-  gv_local.lookup_slx_int[ 126].nbits = 11; gv_local.lookup_slx_int[ 126].bits = 0xCD000000;
-  gv_local.lookup_slx_int[ 127].nbits = 11; gv_local.lookup_slx_int[ 127].bits = 0xCF800000;
-  gv_local.lookup_slx_int[ 128].nbits = 11; gv_local.lookup_slx_int[ 128].bits = 0xCF400000;
-  gv_local.lookup_slx_int[ 129].nbits = 11; gv_local.lookup_slx_int[ 129].bits = 0xD2200000;
-  gv_local.lookup_slx_int[ 130].nbits = 11; gv_local.lookup_slx_int[ 130].bits = 0xD6800000;
-  gv_local.lookup_slx_int[ 131].nbits = 11; gv_local.lookup_slx_int[ 131].bits = 0xD6A00000;
-  gv_local.lookup_slx_int[ 132].nbits = 11; gv_local.lookup_slx_int[ 132].bits = 0xD9A00000;
-  gv_local.lookup_slx_int[ 133].nbits = 11; gv_local.lookup_slx_int[ 133].bits = 0xDBA00000;
-  gv_local.lookup_slx_int[ 134].nbits = 11; gv_local.lookup_slx_int[ 134].bits = 0xDBE00000;
-  gv_local.lookup_slx_int[ 135].nbits = 10; gv_local.lookup_slx_int[ 135].bits = 0x08400000;
-  gv_local.lookup_slx_int[ 136].nbits = 10; gv_local.lookup_slx_int[ 136].bits = 0x08C00000;
-  gv_local.lookup_slx_int[ 137].nbits = 10; gv_local.lookup_slx_int[ 137].bits = 0x0A000000;
-  gv_local.lookup_slx_int[ 138].nbits = 10; gv_local.lookup_slx_int[ 138].bits = 0x0C000000;
-  gv_local.lookup_slx_int[ 139].nbits = 10; gv_local.lookup_slx_int[ 139].bits = 0x0D000000;
-  gv_local.lookup_slx_int[ 140].nbits = 10; gv_local.lookup_slx_int[ 140].bits = 0x18000000;
-  gv_local.lookup_slx_int[ 141].nbits = 10; gv_local.lookup_slx_int[ 141].bits = 0x1AC00000;
-  gv_local.lookup_slx_int[ 142].nbits = 10; gv_local.lookup_slx_int[ 142].bits = 0x21400000;
-  gv_local.lookup_slx_int[ 143].nbits = 10; gv_local.lookup_slx_int[ 143].bits = 0x21800000;
-  gv_local.lookup_slx_int[ 144].nbits = 10; gv_local.lookup_slx_int[ 144].bits = 0x26000000;
-  gv_local.lookup_slx_int[ 145].nbits = 10; gv_local.lookup_slx_int[ 145].bits = 0x2B800000;
-  gv_local.lookup_slx_int[ 146].nbits = 10; gv_local.lookup_slx_int[ 146].bits = 0x32C00000;
-  gv_local.lookup_slx_int[ 147].nbits = 10; gv_local.lookup_slx_int[ 147].bits = 0x34800000;
-  gv_local.lookup_slx_int[ 148].nbits = 10; gv_local.lookup_slx_int[ 148].bits = 0x3CC00000;
-  gv_local.lookup_slx_int[ 149].nbits = 10; gv_local.lookup_slx_int[ 149].bits = 0x3E800000;
-  gv_local.lookup_slx_int[ 150].nbits = 10; gv_local.lookup_slx_int[ 150].bits = 0x49C00000;
-  gv_local.lookup_slx_int[ 151].nbits = 10; gv_local.lookup_slx_int[ 151].bits = 0x48C00000;
-  gv_local.lookup_slx_int[ 152].nbits = 10; gv_local.lookup_slx_int[ 152].bits = 0x49800000;
-  gv_local.lookup_slx_int[ 153].nbits = 10; gv_local.lookup_slx_int[ 153].bits = 0x4E800000;
-  gv_local.lookup_slx_int[ 154].nbits = 10; gv_local.lookup_slx_int[ 154].bits = 0x56400000;
-  gv_local.lookup_slx_int[ 155].nbits = 10; gv_local.lookup_slx_int[ 155].bits = 0x5BC00000;
-  gv_local.lookup_slx_int[ 156].nbits = 10; gv_local.lookup_slx_int[ 156].bits = 0x59400000;
-  gv_local.lookup_slx_int[ 157].nbits = 10; gv_local.lookup_slx_int[ 157].bits = 0x63800000;
-  gv_local.lookup_slx_int[ 158].nbits = 10; gv_local.lookup_slx_int[ 158].bits = 0x64C00000;
-  gv_local.lookup_slx_int[ 159].nbits = 10; gv_local.lookup_slx_int[ 159].bits = 0x6F400000;
-  gv_local.lookup_slx_int[ 160].nbits = 10; gv_local.lookup_slx_int[ 160].bits = 0x6FC00000;
-  gv_local.lookup_slx_int[ 161].nbits = 10; gv_local.lookup_slx_int[ 161].bits = 0x75400000;
-  gv_local.lookup_slx_int[ 162].nbits = 10; gv_local.lookup_slx_int[ 162].bits = 0x84C00000;
-  gv_local.lookup_slx_int[ 163].nbits = 10; gv_local.lookup_slx_int[ 163].bits = 0x86800000;
-  gv_local.lookup_slx_int[ 164].nbits = 10; gv_local.lookup_slx_int[ 164].bits = 0x87400000;
-  gv_local.lookup_slx_int[ 165].nbits = 10; gv_local.lookup_slx_int[ 165].bits = 0x87800000;
-  gv_local.lookup_slx_int[ 166].nbits = 10; gv_local.lookup_slx_int[ 166].bits = 0x8D800000;
-  gv_local.lookup_slx_int[ 167].nbits = 10; gv_local.lookup_slx_int[ 167].bits = 0x93C00000;
-  gv_local.lookup_slx_int[ 168].nbits = 10; gv_local.lookup_slx_int[ 168].bits = 0x95400000;
-  gv_local.lookup_slx_int[ 169].nbits = 10; gv_local.lookup_slx_int[ 169].bits = 0x9C000000;
-  gv_local.lookup_slx_int[ 170].nbits = 10; gv_local.lookup_slx_int[ 170].bits = 0xA2400000;
-  gv_local.lookup_slx_int[ 171].nbits = 10; gv_local.lookup_slx_int[ 171].bits = 0xA3C00000;
-  gv_local.lookup_slx_int[ 172].nbits = 10; gv_local.lookup_slx_int[ 172].bits = 0xA5000000;
-  gv_local.lookup_slx_int[ 173].nbits = 10; gv_local.lookup_slx_int[ 173].bits = 0xA7800000;
-  gv_local.lookup_slx_int[ 174].nbits = 10; gv_local.lookup_slx_int[ 174].bits = 0xAF000000;
-  gv_local.lookup_slx_int[ 175].nbits = 10; gv_local.lookup_slx_int[ 175].bits = 0xAF800000;
-  gv_local.lookup_slx_int[ 176].nbits = 10; gv_local.lookup_slx_int[ 176].bits = 0xB3C00000;
-  gv_local.lookup_slx_int[ 177].nbits = 10; gv_local.lookup_slx_int[ 177].bits = 0xB6C00000;
-  gv_local.lookup_slx_int[ 178].nbits = 10; gv_local.lookup_slx_int[ 178].bits = 0xBA000000;
-  gv_local.lookup_slx_int[ 179].nbits = 10; gv_local.lookup_slx_int[ 179].bits = 0xBF400000;
-  gv_local.lookup_slx_int[ 180].nbits = 10; gv_local.lookup_slx_int[ 180].bits = 0xC1000000;
-  gv_local.lookup_slx_int[ 181].nbits = 10; gv_local.lookup_slx_int[ 181].bits = 0xC5000000;
-  gv_local.lookup_slx_int[ 182].nbits = 10; gv_local.lookup_slx_int[ 182].bits = 0xCA000000;
-  gv_local.lookup_slx_int[ 183].nbits = 10; gv_local.lookup_slx_int[ 183].bits = 0xCB000000;
-  gv_local.lookup_slx_int[ 184].nbits = 10; gv_local.lookup_slx_int[ 184].bits = 0xD2400000;
-  gv_local.lookup_slx_int[ 185].nbits = 10; gv_local.lookup_slx_int[ 185].bits = 0xD3800000;
-  gv_local.lookup_slx_int[ 186].nbits = 10; gv_local.lookup_slx_int[ 186].bits = 0xD6C00000;
-  gv_local.lookup_slx_int[ 187].nbits = 10; gv_local.lookup_slx_int[ 187].bits = 0xDB000000;
-  gv_local.lookup_slx_int[ 188].nbits = 10; gv_local.lookup_slx_int[ 188].bits = 0xDEC00000;
-  gv_local.lookup_slx_int[ 189].nbits =  9; gv_local.lookup_slx_int[ 189].bits = 0x09000000;
-  gv_local.lookup_slx_int[ 190].nbits =  9; gv_local.lookup_slx_int[ 190].bits = 0x0C800000;
-  gv_local.lookup_slx_int[ 191].nbits =  9; gv_local.lookup_slx_int[ 191].bits = 0x18800000;
-  gv_local.lookup_slx_int[ 192].nbits =  9; gv_local.lookup_slx_int[ 192].bits = 0x1B800000;
-  gv_local.lookup_slx_int[ 193].nbits =  9; gv_local.lookup_slx_int[ 193].bits = 0x27000000;
-  gv_local.lookup_slx_int[ 194].nbits =  9; gv_local.lookup_slx_int[ 194].bits = 0x32000000;
-  gv_local.lookup_slx_int[ 195].nbits =  9; gv_local.lookup_slx_int[ 195].bits = 0x3D000000;
-  gv_local.lookup_slx_int[ 196].nbits =  9; gv_local.lookup_slx_int[ 196].bits = 0x49000000;
-  gv_local.lookup_slx_int[ 197].nbits =  9; gv_local.lookup_slx_int[ 197].bits = 0x4C800000;
-  gv_local.lookup_slx_int[ 198].nbits =  9; gv_local.lookup_slx_int[ 198].bits = 0x56800000;
-  gv_local.lookup_slx_int[ 199].nbits =  9; gv_local.lookup_slx_int[ 199].bits = 0x5B000000;
-  gv_local.lookup_slx_int[ 200].nbits =  9; gv_local.lookup_slx_int[ 200].bits = 0x64000000;
-  gv_local.lookup_slx_int[ 201].nbits =  9; gv_local.lookup_slx_int[ 201].bits = 0x74800000;
-  gv_local.lookup_slx_int[ 202].nbits =  9; gv_local.lookup_slx_int[ 202].bits = 0x7D000000;
-  gv_local.lookup_slx_int[ 203].nbits =  9; gv_local.lookup_slx_int[ 203].bits = 0x89000000;
-  gv_local.lookup_slx_int[ 204].nbits =  9; gv_local.lookup_slx_int[ 204].bits = 0x90800000;
-  gv_local.lookup_slx_int[ 205].nbits =  9; gv_local.lookup_slx_int[ 205].bits = 0x95800000;
-  gv_local.lookup_slx_int[ 206].nbits =  9; gv_local.lookup_slx_int[ 206].bits = 0xA2800000;
-  gv_local.lookup_slx_int[ 207].nbits =  9; gv_local.lookup_slx_int[ 207].bits = 0xA7000000;
-  gv_local.lookup_slx_int[ 208].nbits =  9; gv_local.lookup_slx_int[ 208].bits = 0xAE800000;
-  gv_local.lookup_slx_int[ 209].nbits =  9; gv_local.lookup_slx_int[ 209].bits = 0xB3000000;
-  gv_local.lookup_slx_int[ 210].nbits =  9; gv_local.lookup_slx_int[ 210].bits = 0xBB000000;
-  gv_local.lookup_slx_int[ 211].nbits =  9; gv_local.lookup_slx_int[ 211].bits = 0xBF800000;
-  gv_local.lookup_slx_int[ 212].nbits =  9; gv_local.lookup_slx_int[ 212].bits = 0xC5800000;
-  gv_local.lookup_slx_int[ 213].nbits =  9; gv_local.lookup_slx_int[ 213].bits = 0xCB800000;
-  gv_local.lookup_slx_int[ 214].nbits =  9; gv_local.lookup_slx_int[ 214].bits = 0xD3000000;
-  gv_local.lookup_slx_int[ 215].nbits =  9; gv_local.lookup_slx_int[ 215].bits = 0xD9000000;
-  gv_local.lookup_slx_int[ 216].nbits =  9; gv_local.lookup_slx_int[ 216].bits = 0xDE000000;
-  gv_local.lookup_slx_int[ 217].nbits =  8; gv_local.lookup_slx_int[ 217].bits = 0x0B000000;
-  gv_local.lookup_slx_int[ 218].nbits =  8; gv_local.lookup_slx_int[ 218].bits = 0x19000000;
-  gv_local.lookup_slx_int[ 219].nbits =  8; gv_local.lookup_slx_int[ 219].bits = 0x28000000;
-  gv_local.lookup_slx_int[ 220].nbits =  8; gv_local.lookup_slx_int[ 220].bits = 0x33000000;
-  gv_local.lookup_slx_int[ 221].nbits =  8; gv_local.lookup_slx_int[ 221].bits = 0x3F000000;
-  gv_local.lookup_slx_int[ 222].nbits =  8; gv_local.lookup_slx_int[ 222].bits = 0x4D000000;
-  gv_local.lookup_slx_int[ 223].nbits =  8; gv_local.lookup_slx_int[ 223].bits = 0x5A000000;
-  gv_local.lookup_slx_int[ 224].nbits =  8; gv_local.lookup_slx_int[ 224].bits = 0x6C000000;
-  gv_local.lookup_slx_int[ 225].nbits =  8; gv_local.lookup_slx_int[ 225].bits = 0x7C000000;
-  gv_local.lookup_slx_int[ 226].nbits =  8; gv_local.lookup_slx_int[ 226].bits = 0x88000000;
-  gv_local.lookup_slx_int[ 227].nbits =  8; gv_local.lookup_slx_int[ 227].bits = 0x94000000;
-  gv_local.lookup_slx_int[ 228].nbits =  8; gv_local.lookup_slx_int[ 228].bits = 0xA1000000;
-  gv_local.lookup_slx_int[ 229].nbits =  8; gv_local.lookup_slx_int[ 229].bits = 0xA8000000;
-  gv_local.lookup_slx_int[ 230].nbits =  8; gv_local.lookup_slx_int[ 230].bits = 0xB2000000;
-  gv_local.lookup_slx_int[ 231].nbits =  8; gv_local.lookup_slx_int[ 231].bits = 0xBC000000;
-  gv_local.lookup_slx_int[ 232].nbits =  8; gv_local.lookup_slx_int[ 232].bits = 0xC4000000;
-  gv_local.lookup_slx_int[ 233].nbits =  8; gv_local.lookup_slx_int[ 233].bits = 0xCC000000;
-  gv_local.lookup_slx_int[ 234].nbits =  8; gv_local.lookup_slx_int[ 234].bits = 0xD7000000;
-  gv_local.lookup_slx_int[ 235].nbits =  7; gv_local.lookup_slx_int[ 235].bits = 0x00000000;
-  gv_local.lookup_slx_int[ 236].nbits =  7; gv_local.lookup_slx_int[ 236].bits = 0x12000000;
-  gv_local.lookup_slx_int[ 237].nbits =  7; gv_local.lookup_slx_int[ 237].bits = 0x24000000;
-  gv_local.lookup_slx_int[ 238].nbits =  7; gv_local.lookup_slx_int[ 238].bits = 0x36000000;
-  gv_local.lookup_slx_int[ 239].nbits =  7; gv_local.lookup_slx_int[ 239].bits = 0x4A000000;
-  gv_local.lookup_slx_int[ 240].nbits =  7; gv_local.lookup_slx_int[ 240].bits = 0x60000000;
-  gv_local.lookup_slx_int[ 241].nbits =  7; gv_local.lookup_slx_int[ 241].bits = 0x76000000;
-  gv_local.lookup_slx_int[ 242].nbits =  7; gv_local.lookup_slx_int[ 242].bits = 0x8A000000;
-  gv_local.lookup_slx_int[ 243].nbits =  7; gv_local.lookup_slx_int[ 243].bits = 0x96000000;
-  gv_local.lookup_slx_int[ 244].nbits =  7; gv_local.lookup_slx_int[ 244].bits = 0xAA000000;
-  gv_local.lookup_slx_int[ 245].nbits =  7; gv_local.lookup_slx_int[ 245].bits = 0xB4000000;
-  gv_local.lookup_slx_int[ 246].nbits =  7; gv_local.lookup_slx_int[ 246].bits = 0xC2000000;
-  gv_local.lookup_slx_int[ 247].nbits =  7; gv_local.lookup_slx_int[ 247].bits = 0xD0000000;
-  gv_local.lookup_slx_int[ 248].nbits =  7; gv_local.lookup_slx_int[ 248].bits = 0xDC000000;
-  gv_local.lookup_slx_int[ 249].nbits =  6; gv_local.lookup_slx_int[ 249].bits = 0x14000000;
-  gv_local.lookup_slx_int[ 250].nbits =  6; gv_local.lookup_slx_int[ 250].bits = 0x2C000000;
-  gv_local.lookup_slx_int[ 251].nbits =  6; gv_local.lookup_slx_int[ 251].bits = 0x44000000;
-  gv_local.lookup_slx_int[ 252].nbits =  6; gv_local.lookup_slx_int[ 252].bits = 0x5C000000;
-  gv_local.lookup_slx_int[ 253].nbits =  6; gv_local.lookup_slx_int[ 253].bits = 0x70000000;
-  gv_local.lookup_slx_int[ 254].nbits =  6; gv_local.lookup_slx_int[ 254].bits = 0x80000000;
-  gv_local.lookup_slx_int[ 255].nbits =  6; gv_local.lookup_slx_int[ 255].bits = 0x98000000;
-  gv_local.lookup_slx_int[ 256].nbits =  6; gv_local.lookup_slx_int[ 256].bits = 0x78000000;
-  gv_local.lookup_slx_int[ 257].nbits =  6; gv_local.lookup_slx_int[ 257].bits = 0x68000000;
-  gv_local.lookup_slx_int[ 258].nbits =  6; gv_local.lookup_slx_int[ 258].bits = 0x50000000;
-  gv_local.lookup_slx_int[ 259].nbits =  6; gv_local.lookup_slx_int[ 259].bits = 0x38000000;
-  gv_local.lookup_slx_int[ 260].nbits =  6; gv_local.lookup_slx_int[ 260].bits = 0x1C000000;
-  gv_local.lookup_slx_int[ 261].nbits =  6; gv_local.lookup_slx_int[ 261].bits = 0x04000000;
-  gv_local.lookup_slx_int[ 262].nbits =  7; gv_local.lookup_slx_int[ 262].bits = 0xD4000000;
-  gv_local.lookup_slx_int[ 263].nbits =  7; gv_local.lookup_slx_int[ 263].bits = 0xC6000000;
-  gv_local.lookup_slx_int[ 264].nbits =  7; gv_local.lookup_slx_int[ 264].bits = 0xB8000000;
-  gv_local.lookup_slx_int[ 265].nbits =  7; gv_local.lookup_slx_int[ 265].bits = 0xAC000000;
-  gv_local.lookup_slx_int[ 266].nbits =  7; gv_local.lookup_slx_int[ 266].bits = 0x9E000000;
-  gv_local.lookup_slx_int[ 267].nbits =  7; gv_local.lookup_slx_int[ 267].bits = 0x8E000000;
-  gv_local.lookup_slx_int[ 268].nbits =  7; gv_local.lookup_slx_int[ 268].bits = 0x7E000000;
-  gv_local.lookup_slx_int[ 269].nbits =  7; gv_local.lookup_slx_int[ 269].bits = 0x66000000;
-  gv_local.lookup_slx_int[ 270].nbits =  7; gv_local.lookup_slx_int[ 270].bits = 0x54000000;
-  gv_local.lookup_slx_int[ 271].nbits =  7; gv_local.lookup_slx_int[ 271].bits = 0x40000000;
-  gv_local.lookup_slx_int[ 272].nbits =  7; gv_local.lookup_slx_int[ 272].bits = 0x30000000;
-  gv_local.lookup_slx_int[ 273].nbits =  7; gv_local.lookup_slx_int[ 273].bits = 0x22000000;
-  gv_local.lookup_slx_int[ 274].nbits =  7; gv_local.lookup_slx_int[ 274].bits = 0x0E000000;
-  gv_local.lookup_slx_int[ 275].nbits =  8; gv_local.lookup_slx_int[ 275].bits = 0xDF000000;
-  gv_local.lookup_slx_int[ 276].nbits =  8; gv_local.lookup_slx_int[ 276].bits = 0xD8000000;
-  gv_local.lookup_slx_int[ 277].nbits =  8; gv_local.lookup_slx_int[ 277].bits = 0xCE000000;
-  gv_local.lookup_slx_int[ 278].nbits =  8; gv_local.lookup_slx_int[ 278].bits = 0xC8000000;
-  gv_local.lookup_slx_int[ 279].nbits =  8; gv_local.lookup_slx_int[ 279].bits = 0xBE000000;
-  gv_local.lookup_slx_int[ 280].nbits =  8; gv_local.lookup_slx_int[ 280].bits = 0xB7000000;
-  gv_local.lookup_slx_int[ 281].nbits =  8; gv_local.lookup_slx_int[ 281].bits = 0xB0000000;
-  gv_local.lookup_slx_int[ 282].nbits =  8; gv_local.lookup_slx_int[ 282].bits = 0xA6000000;
-  gv_local.lookup_slx_int[ 283].nbits =  8; gv_local.lookup_slx_int[ 283].bits = 0xA0000000;
-  gv_local.lookup_slx_int[ 284].nbits =  8; gv_local.lookup_slx_int[ 284].bits = 0x92000000;
-  gv_local.lookup_slx_int[ 285].nbits =  8; gv_local.lookup_slx_int[ 285].bits = 0x8C000000;
-  gv_local.lookup_slx_int[ 286].nbits =  8; gv_local.lookup_slx_int[ 286].bits = 0x85000000;
-  gv_local.lookup_slx_int[ 287].nbits =  8; gv_local.lookup_slx_int[ 287].bits = 0x6E000000;
-  gv_local.lookup_slx_int[ 288].nbits =  8; gv_local.lookup_slx_int[ 288].bits = 0x62000000;
-  gv_local.lookup_slx_int[ 289].nbits =  8; gv_local.lookup_slx_int[ 289].bits = 0x57000000;
-  gv_local.lookup_slx_int[ 290].nbits =  8; gv_local.lookup_slx_int[ 290].bits = 0x43000000;
-  gv_local.lookup_slx_int[ 291].nbits =  8; gv_local.lookup_slx_int[ 291].bits = 0x35000000;
-  gv_local.lookup_slx_int[ 292].nbits =  8; gv_local.lookup_slx_int[ 292].bits = 0x2A000000;
-  gv_local.lookup_slx_int[ 293].nbits =  8; gv_local.lookup_slx_int[ 293].bits = 0x20000000;
-  gv_local.lookup_slx_int[ 294].nbits =  8; gv_local.lookup_slx_int[ 294].bits = 0x10000000;
-  gv_local.lookup_slx_int[ 295].nbits =  8; gv_local.lookup_slx_int[ 295].bits = 0x03000000;
-  gv_local.lookup_slx_int[ 296].nbits =  9; gv_local.lookup_slx_int[ 296].bits = 0xDA800000;
-  gv_local.lookup_slx_int[ 297].nbits =  9; gv_local.lookup_slx_int[ 297].bits = 0xD6000000;
-  gv_local.lookup_slx_int[ 298].nbits =  9; gv_local.lookup_slx_int[ 298].bits = 0xCD800000;
-  gv_local.lookup_slx_int[ 299].nbits =  9; gv_local.lookup_slx_int[ 299].bits = 0xC9800000;
-  gv_local.lookup_slx_int[ 300].nbits =  9; gv_local.lookup_slx_int[ 300].bits = 0xC0800000;
-  gv_local.lookup_slx_int[ 301].nbits =  9; gv_local.lookup_slx_int[ 301].bits = 0xBA800000;
-  gv_local.lookup_slx_int[ 302].nbits =  9; gv_local.lookup_slx_int[ 302].bits = 0xB1000000;
-  gv_local.lookup_slx_int[ 303].nbits =  9; gv_local.lookup_slx_int[ 303].bits = 0xA9800000;
-  gv_local.lookup_slx_int[ 304].nbits =  9; gv_local.lookup_slx_int[ 304].bits = 0xA4000000;
-  gv_local.lookup_slx_int[ 305].nbits =  9; gv_local.lookup_slx_int[ 305].bits = 0x9D000000;
-  gv_local.lookup_slx_int[ 306].nbits =  9; gv_local.lookup_slx_int[ 306].bits = 0x93000000;
-  gv_local.lookup_slx_int[ 307].nbits =  9; gv_local.lookup_slx_int[ 307].bits = 0x8D000000;
-  gv_local.lookup_slx_int[ 308].nbits =  9; gv_local.lookup_slx_int[ 308].bits = 0x84000000;
-  gv_local.lookup_slx_int[ 309].nbits =  9; gv_local.lookup_slx_int[ 309].bits = 0x74000000;
-  gv_local.lookup_slx_int[ 310].nbits =  9; gv_local.lookup_slx_int[ 310].bits = 0x65000000;
-  gv_local.lookup_slx_int[ 311].nbits =  9; gv_local.lookup_slx_int[ 311].bits = 0x59800000;
-  gv_local.lookup_slx_int[ 312].nbits =  9; gv_local.lookup_slx_int[ 312].bits = 0x4F800000;
-  gv_local.lookup_slx_int[ 313].nbits =  9; gv_local.lookup_slx_int[ 313].bits = 0x48000000;
-  gv_local.lookup_slx_int[ 314].nbits =  9; gv_local.lookup_slx_int[ 314].bits = 0x3D800000;
-  gv_local.lookup_slx_int[ 315].nbits =  9; gv_local.lookup_slx_int[ 315].bits = 0x34000000;
-  gv_local.lookup_slx_int[ 316].nbits =  9; gv_local.lookup_slx_int[ 316].bits = 0x26800000;
-  gv_local.lookup_slx_int[ 317].nbits =  9; gv_local.lookup_slx_int[ 317].bits = 0x1B000000;
-  gv_local.lookup_slx_int[ 318].nbits =  9; gv_local.lookup_slx_int[ 318].bits = 0x11800000;
-  gv_local.lookup_slx_int[ 319].nbits =  9; gv_local.lookup_slx_int[ 319].bits = 0x0A800000;
-  gv_local.lookup_slx_int[ 320].nbits =  9; gv_local.lookup_slx_int[ 320].bits = 0x02000000;
-  gv_local.lookup_slx_int[ 321].nbits = 10; gv_local.lookup_slx_int[ 321].bits = 0xDB400000;
-  gv_local.lookup_slx_int[ 322].nbits = 10; gv_local.lookup_slx_int[ 322].bits = 0xD9C00000;
-  gv_local.lookup_slx_int[ 323].nbits = 10; gv_local.lookup_slx_int[ 323].bits = 0xD2800000;
-  gv_local.lookup_slx_int[ 324].nbits = 10; gv_local.lookup_slx_int[ 324].bits = 0xCF000000;
-  gv_local.lookup_slx_int[ 325].nbits = 10; gv_local.lookup_slx_int[ 325].bits = 0xCD400000;
-  gv_local.lookup_slx_int[ 326].nbits = 10; gv_local.lookup_slx_int[ 326].bits = 0xCA800000;
-  gv_local.lookup_slx_int[ 327].nbits = 10; gv_local.lookup_slx_int[ 327].bits = 0xC5400000;
-  gv_local.lookup_slx_int[ 328].nbits = 10; gv_local.lookup_slx_int[ 328].bits = 0xC0000000;
-  gv_local.lookup_slx_int[ 329].nbits = 10; gv_local.lookup_slx_int[ 329].bits = 0xBD400000;
-  gv_local.lookup_slx_int[ 330].nbits = 10; gv_local.lookup_slx_int[ 330].bits = 0xBBC00000;
-  gv_local.lookup_slx_int[ 331].nbits = 10; gv_local.lookup_slx_int[ 331].bits = 0xB6400000;
-  gv_local.lookup_slx_int[ 332].nbits = 10; gv_local.lookup_slx_int[ 332].bits = 0xB1C00000;
-  gv_local.lookup_slx_int[ 333].nbits = 10; gv_local.lookup_slx_int[ 333].bits = 0xAFC00000;
-  gv_local.lookup_slx_int[ 334].nbits = 10; gv_local.lookup_slx_int[ 334].bits = 0xAE400000;
-  gv_local.lookup_slx_int[ 335].nbits = 10; gv_local.lookup_slx_int[ 335].bits = 0xA9000000;
-  gv_local.lookup_slx_int[ 336].nbits = 10; gv_local.lookup_slx_int[ 336].bits = 0xA5800000;
-  gv_local.lookup_slx_int[ 337].nbits = 10; gv_local.lookup_slx_int[ 337].bits = 0xA3400000;
-  gv_local.lookup_slx_int[ 338].nbits = 10; gv_local.lookup_slx_int[ 338].bits = 0xA2000000;
-  gv_local.lookup_slx_int[ 339].nbits = 10; gv_local.lookup_slx_int[ 339].bits = 0x9C400000;
-  gv_local.lookup_slx_int[ 340].nbits = 10; gv_local.lookup_slx_int[ 340].bits = 0x93800000;
-  gv_local.lookup_slx_int[ 341].nbits = 10; gv_local.lookup_slx_int[ 341].bits = 0x91800000;
-  gv_local.lookup_slx_int[ 342].nbits = 10; gv_local.lookup_slx_int[ 342].bits = 0x91400000;
-  gv_local.lookup_slx_int[ 343].nbits = 10; gv_local.lookup_slx_int[ 343].bits = 0x90000000;
-  gv_local.lookup_slx_int[ 344].nbits = 10; gv_local.lookup_slx_int[ 344].bits = 0x89800000;
-  gv_local.lookup_slx_int[ 345].nbits = 10; gv_local.lookup_slx_int[ 345].bits = 0x86C00000;
-  gv_local.lookup_slx_int[ 346].nbits = 10; gv_local.lookup_slx_int[ 346].bits = 0x86000000;
-  gv_local.lookup_slx_int[ 347].nbits = 10; gv_local.lookup_slx_int[ 347].bits = 0x7DC00000;
-  gv_local.lookup_slx_int[ 348].nbits = 10; gv_local.lookup_slx_int[ 348].bits = 0x75000000;
-  gv_local.lookup_slx_int[ 349].nbits = 10; gv_local.lookup_slx_int[ 349].bits = 0x6F800000;
-  gv_local.lookup_slx_int[ 350].nbits = 10; gv_local.lookup_slx_int[ 350].bits = 0x6DC00000;
-  gv_local.lookup_slx_int[ 351].nbits = 10; gv_local.lookup_slx_int[ 351].bits = 0x6D800000;
-  gv_local.lookup_slx_int[ 352].nbits = 10; gv_local.lookup_slx_int[ 352].bits = 0x65C00000;
-  gv_local.lookup_slx_int[ 353].nbits = 10; gv_local.lookup_slx_int[ 353].bits = 0x64800000;
-  gv_local.lookup_slx_int[ 354].nbits = 10; gv_local.lookup_slx_int[ 354].bits = 0x63000000;
-  gv_local.lookup_slx_int[ 355].nbits = 10; gv_local.lookup_slx_int[ 355].bits = 0x59000000;
-  gv_local.lookup_slx_int[ 356].nbits = 10; gv_local.lookup_slx_int[ 356].bits = 0x58000000;
-  gv_local.lookup_slx_int[ 357].nbits = 10; gv_local.lookup_slx_int[ 357].bits = 0x4F400000;
-  gv_local.lookup_slx_int[ 358].nbits = 10; gv_local.lookup_slx_int[ 358].bits = 0x4EC00000;
-  gv_local.lookup_slx_int[ 359].nbits = 10; gv_local.lookup_slx_int[ 359].bits = 0x56000000;
-  gv_local.lookup_slx_int[ 360].nbits = 10; gv_local.lookup_slx_int[ 360].bits = 0x4E000000;
-  gv_local.lookup_slx_int[ 361].nbits = 10; gv_local.lookup_slx_int[ 361].bits = 0x42800000;
-  gv_local.lookup_slx_int[ 362].nbits = 10; gv_local.lookup_slx_int[ 362].bits = 0x42400000;
-  gv_local.lookup_slx_int[ 363].nbits = 10; gv_local.lookup_slx_int[ 363].bits = 0x3EC00000;
-  gv_local.lookup_slx_int[ 364].nbits = 10; gv_local.lookup_slx_int[ 364].bits = 0x3E000000;
-  gv_local.lookup_slx_int[ 365].nbits = 10; gv_local.lookup_slx_int[ 365].bits = 0x3C800000;
-  gv_local.lookup_slx_int[ 366].nbits = 10; gv_local.lookup_slx_int[ 366].bits = 0x34C00000;
-  gv_local.lookup_slx_int[ 367].nbits = 10; gv_local.lookup_slx_int[ 367].bits = 0x2BC00000;
-  gv_local.lookup_slx_int[ 368].nbits = 10; gv_local.lookup_slx_int[ 368].bits = 0x2B400000;
-  gv_local.lookup_slx_int[ 369].nbits = 10; gv_local.lookup_slx_int[ 369].bits = 0x29000000;
-  gv_local.lookup_slx_int[ 370].nbits = 10; gv_local.lookup_slx_int[ 370].bits = 0x26400000;
-  gv_local.lookup_slx_int[ 371].nbits = 10; gv_local.lookup_slx_int[ 371].bits = 0x27C00000;
-  gv_local.lookup_slx_int[ 372].nbits = 10; gv_local.lookup_slx_int[ 372].bits = 0x21C00000;
-  gv_local.lookup_slx_int[ 373].nbits = 10; gv_local.lookup_slx_int[ 373].bits = 0x18400000;
-  gv_local.lookup_slx_int[ 374].nbits = 10; gv_local.lookup_slx_int[ 374].bits = 0x1A000000;
-  gv_local.lookup_slx_int[ 375].nbits = 10; gv_local.lookup_slx_int[ 375].bits = 0x11400000;
-  gv_local.lookup_slx_int[ 376].nbits = 10; gv_local.lookup_slx_int[ 376].bits = 0x0DC00000;
-  gv_local.lookup_slx_int[ 377].nbits = 10; gv_local.lookup_slx_int[ 377].bits = 0x0D800000;
-  gv_local.lookup_slx_int[ 378].nbits = 10; gv_local.lookup_slx_int[ 378].bits = 0x0A400000;
-  gv_local.lookup_slx_int[ 379].nbits = 10; gv_local.lookup_slx_int[ 379].bits = 0x09C00000;
-  gv_local.lookup_slx_int[ 380].nbits = 10; gv_local.lookup_slx_int[ 380].bits = 0x08800000;
-  gv_local.lookup_slx_int[ 381].nbits = 10; gv_local.lookup_slx_int[ 381].bits = 0x08000000;
-  gv_local.lookup_slx_int[ 382].nbits = 11; gv_local.lookup_slx_int[ 382].bits = 0xDEA00000;
-  gv_local.lookup_slx_int[ 383].nbits = 11; gv_local.lookup_slx_int[ 383].bits = 0xDBC00000;
-  gv_local.lookup_slx_int[ 384].nbits = 11; gv_local.lookup_slx_int[ 384].bits = 0xDA400000;
-  gv_local.lookup_slx_int[ 385].nbits = 11; gv_local.lookup_slx_int[ 385].bits = 0xDA600000;
-  gv_local.lookup_slx_int[ 386].nbits = 11; gv_local.lookup_slx_int[ 386].bits = 0xDA000000;
-  gv_local.lookup_slx_int[ 387].nbits = 11; gv_local.lookup_slx_int[ 387].bits = 0xD3C00000;
-  gv_local.lookup_slx_int[ 388].nbits = 11; gv_local.lookup_slx_int[ 388].bits = 0xD2E00000;
-  gv_local.lookup_slx_int[ 389].nbits = 11; gv_local.lookup_slx_int[ 389].bits = 0xD2000000;
-  gv_local.lookup_slx_int[ 390].nbits = 11; gv_local.lookup_slx_int[ 390].bits = 0xCFC00000;
-  gv_local.lookup_slx_int[ 391].nbits = 11; gv_local.lookup_slx_int[ 391].bits = 0xCD200000;
-  gv_local.lookup_slx_int[ 392].nbits = 11; gv_local.lookup_slx_int[ 392].bits = 0xCFA00000;
-  gv_local.lookup_slx_int[ 393].nbits = 11; gv_local.lookup_slx_int[ 393].bits = 0xCB400000;
-  gv_local.lookup_slx_int[ 394].nbits = 11; gv_local.lookup_slx_int[ 394].bits = 0xCAC00000;
-  gv_local.lookup_slx_int[ 395].nbits = 11; gv_local.lookup_slx_int[ 395].bits = 0xC9000000;
-  gv_local.lookup_slx_int[ 396].nbits = 11; gv_local.lookup_slx_int[ 396].bits = 0xC9200000;
-  gv_local.lookup_slx_int[ 397].nbits = 11; gv_local.lookup_slx_int[ 397].bits = 0xC1600000;
-  gv_local.lookup_slx_int[ 398].nbits = 11; gv_local.lookup_slx_int[ 398].bits = 0xC1400000;
-  gv_local.lookup_slx_int[ 399].nbits = 11; gv_local.lookup_slx_int[ 399].bits = 0xC0600000;
-  gv_local.lookup_slx_int[ 400].nbits = 11; gv_local.lookup_slx_int[ 400].bits = 0xBDE00000;
-  gv_local.lookup_slx_int[ 401].nbits = 11; gv_local.lookup_slx_int[ 401].bits = 0xBDA00000;
-  gv_local.lookup_slx_int[ 402].nbits = 11; gv_local.lookup_slx_int[ 402].bits = 0xBD200000;
-  gv_local.lookup_slx_int[ 403].nbits = 11; gv_local.lookup_slx_int[ 403].bits = 0xBB800000;
-  gv_local.lookup_slx_int[ 404].nbits = 11; gv_local.lookup_slx_int[ 404].bits = 0xBA400000;
-  gv_local.lookup_slx_int[ 405].nbits = 11; gv_local.lookup_slx_int[ 405].bits = 0xB3800000;
-  gv_local.lookup_slx_int[ 406].nbits = 11; gv_local.lookup_slx_int[ 406].bits = 0xB1800000;
-  gv_local.lookup_slx_int[ 407].nbits = 11; gv_local.lookup_slx_int[ 407].bits = 0xAE200000;
-  gv_local.lookup_slx_int[ 408].nbits = 11; gv_local.lookup_slx_int[ 408].bits = 0xA9600000;
-  gv_local.lookup_slx_int[ 409].nbits = 11; gv_local.lookup_slx_int[ 409].bits = 0xA5400000;
-  gv_local.lookup_slx_int[ 410].nbits = 11; gv_local.lookup_slx_int[ 410].bits = 0xA5C00000;
-  gv_local.lookup_slx_int[ 411].nbits = 11; gv_local.lookup_slx_int[ 411].bits = 0xA5600000;
-  gv_local.lookup_slx_int[ 412].nbits = 11; gv_local.lookup_slx_int[ 412].bits = 0xA4C00000;
-  gv_local.lookup_slx_int[ 413].nbits = 11; gv_local.lookup_slx_int[ 413].bits = 0xA3800000;
-  gv_local.lookup_slx_int[ 414].nbits = 11; gv_local.lookup_slx_int[ 414].bits = 0x9DA00000;
-  gv_local.lookup_slx_int[ 415].nbits = 11; gv_local.lookup_slx_int[ 415].bits = 0x9D800000;
-  gv_local.lookup_slx_int[ 416].nbits = 11; gv_local.lookup_slx_int[ 416].bits = 0x95200000;
-  gv_local.lookup_slx_int[ 417].nbits = 11; gv_local.lookup_slx_int[ 417].bits = 0x9C800000;
-  gv_local.lookup_slx_int[ 418].nbits = 11; gv_local.lookup_slx_int[ 418].bits = 0x90600000;
-  gv_local.lookup_slx_int[ 419].nbits = 11; gv_local.lookup_slx_int[ 419].bits = 0x91C00000;
-  gv_local.lookup_slx_int[ 420].nbits = 11; gv_local.lookup_slx_int[ 420].bits = 0x89E00000;
-  gv_local.lookup_slx_int[ 421].nbits = 11; gv_local.lookup_slx_int[ 421].bits = 0x89C00000;
-  gv_local.lookup_slx_int[ 422].nbits = 11; gv_local.lookup_slx_int[ 422].bits = 0x87000000;
-  gv_local.lookup_slx_int[ 423].nbits = 11; gv_local.lookup_slx_int[ 423].bits = 0x86400000;
-  gv_local.lookup_slx_int[ 424].nbits = 11; gv_local.lookup_slx_int[ 424].bits = 0x7DA00000;
-  gv_local.lookup_slx_int[ 425].nbits = 11; gv_local.lookup_slx_int[ 425].bits = 0x75A00000;
-  gv_local.lookup_slx_int[ 426].nbits = 11; gv_local.lookup_slx_int[ 426].bits = 0x75800000;
-  gv_local.lookup_slx_int[ 427].nbits = 11; gv_local.lookup_slx_int[ 427].bits = 0x6F000000;
-  gv_local.lookup_slx_int[ 428].nbits = 11; gv_local.lookup_slx_int[ 428].bits = 0x65A00000;
-  gv_local.lookup_slx_int[ 429].nbits = 11; gv_local.lookup_slx_int[ 429].bits = 0x63600000;
-  gv_local.lookup_slx_int[ 430].nbits = 11; gv_local.lookup_slx_int[ 430].bits = 0x63C00000;
-  gv_local.lookup_slx_int[ 431].nbits = 11; gv_local.lookup_slx_int[ 431].bits = 0x5B800000;
-  gv_local.lookup_slx_int[ 432].nbits = 11; gv_local.lookup_slx_int[ 432].bits = 0x58E00000;
-  gv_local.lookup_slx_int[ 433].nbits = 11; gv_local.lookup_slx_int[ 433].bits = 0x58800000;
-  gv_local.lookup_slx_int[ 434].nbits = 11; gv_local.lookup_slx_int[ 434].bits = 0x4E600000;
-  gv_local.lookup_slx_int[ 435].nbits = 11; gv_local.lookup_slx_int[ 435].bits = 0x4C600000;
-  gv_local.lookup_slx_int[ 436].nbits = 11; gv_local.lookup_slx_int[ 436].bits = 0x48A00000;
-  gv_local.lookup_slx_int[ 437].nbits = 11; gv_local.lookup_slx_int[ 437].bits = 0x42200000;
-  gv_local.lookup_slx_int[ 438].nbits = 11; gv_local.lookup_slx_int[ 438].bits = 0x42C00000;
-  gv_local.lookup_slx_int[ 439].nbits = 11; gv_local.lookup_slx_int[ 439].bits = 0x3E400000;
-  gv_local.lookup_slx_int[ 440].nbits = 11; gv_local.lookup_slx_int[ 440].bits = 0x3C400000;
-  gv_local.lookup_slx_int[ 441].nbits = 11; gv_local.lookup_slx_int[ 441].bits = 0x32A00000;
-  gv_local.lookup_slx_int[ 442].nbits = 11; gv_local.lookup_slx_int[ 442].bits = 0x29E00000;
-  gv_local.lookup_slx_int[ 443].nbits = 11; gv_local.lookup_slx_int[ 443].bits = 0x29C00000;
-  gv_local.lookup_slx_int[ 444].nbits = 11; gv_local.lookup_slx_int[ 444].bits = 0x29600000;
-  gv_local.lookup_slx_int[ 445].nbits = 11; gv_local.lookup_slx_int[ 445].bits = 0x27A00000;
-  gv_local.lookup_slx_int[ 446].nbits = 11; gv_local.lookup_slx_int[ 446].bits = 0x1A600000;
-  gv_local.lookup_slx_int[ 447].nbits = 11; gv_local.lookup_slx_int[ 447].bits = 0x1A400000;
-  gv_local.lookup_slx_int[ 448].nbits = 11; gv_local.lookup_slx_int[ 448].bits = 0x11000000;
-  gv_local.lookup_slx_int[ 449].nbits = 11; gv_local.lookup_slx_int[ 449].bits = 0x0D400000;
-  gv_local.lookup_slx_int[ 450].nbits = 11; gv_local.lookup_slx_int[ 450].bits = 0x09A00000;
-  gv_local.lookup_slx_int[ 451].nbits = 11; gv_local.lookup_slx_int[ 451].bits = 0x02E00000;
-  gv_local.lookup_slx_int[ 452].nbits = 12; gv_local.lookup_slx_int[ 452].bits = 0xDE800000;
-  gv_local.lookup_slx_int[ 453].nbits = 12; gv_local.lookup_slx_int[ 453].bits = 0xDB900000;
-  gv_local.lookup_slx_int[ 454].nbits = 12; gv_local.lookup_slx_int[ 454].bits = 0xDB800000;
-  gv_local.lookup_slx_int[ 455].nbits = 12; gv_local.lookup_slx_int[ 455].bits = 0xD3E00000;
-  gv_local.lookup_slx_int[ 456].nbits = 12; gv_local.lookup_slx_int[ 456].bits = 0xD3F00000;
-  gv_local.lookup_slx_int[ 457].nbits = 12; gv_local.lookup_slx_int[ 457].bits = 0xCFE00000;
-  gv_local.lookup_slx_int[ 458].nbits = 12; gv_local.lookup_slx_int[ 458].bits = 0xD2D00000;
-  gv_local.lookup_slx_int[ 459].nbits = 12; gv_local.lookup_slx_int[ 459].bits = 0xCF700000;
-  gv_local.lookup_slx_int[ 460].nbits = 12; gv_local.lookup_slx_int[ 460].bits = 0xCAF00000;
-  gv_local.lookup_slx_int[ 461].nbits = 12; gv_local.lookup_slx_int[ 461].bits = 0xCAE00000;
-  gv_local.lookup_slx_int[ 462].nbits = 12; gv_local.lookup_slx_int[ 462].bits = 0xC9500000;
-  gv_local.lookup_slx_int[ 463].nbits = 12; gv_local.lookup_slx_int[ 463].bits = 0xC1B00000;
-  gv_local.lookup_slx_int[ 464].nbits = 12; gv_local.lookup_slx_int[ 464].bits = 0xC0500000;
-  gv_local.lookup_slx_int[ 465].nbits = 12; gv_local.lookup_slx_int[ 465].bits = 0xC0400000;
-  gv_local.lookup_slx_int[ 466].nbits = 12; gv_local.lookup_slx_int[ 466].bits = 0xBDD00000;
-  gv_local.lookup_slx_int[ 467].nbits = 12; gv_local.lookup_slx_int[ 467].bits = 0xBD800000;
-  gv_local.lookup_slx_int[ 468].nbits = 12; gv_local.lookup_slx_int[ 468].bits = 0xB6800000;
-  gv_local.lookup_slx_int[ 469].nbits = 12; gv_local.lookup_slx_int[ 469].bits = 0xB6300000;
-  gv_local.lookup_slx_int[ 470].nbits = 12; gv_local.lookup_slx_int[ 470].bits = 0xB6200000;
-  gv_local.lookup_slx_int[ 471].nbits = 12; gv_local.lookup_slx_int[ 471].bits = 0xAF500000;
-  gv_local.lookup_slx_int[ 472].nbits = 12; gv_local.lookup_slx_int[ 472].bits = 0xA7D00000;
-  gv_local.lookup_slx_int[ 473].nbits = 12; gv_local.lookup_slx_int[ 473].bits = 0xA5F00000;
-  gv_local.lookup_slx_int[ 474].nbits = 12; gv_local.lookup_slx_int[ 474].bits = 0xA9400000;
-  gv_local.lookup_slx_int[ 475].nbits = 12; gv_local.lookup_slx_int[ 475].bits = 0xA4B00000;
-  gv_local.lookup_slx_int[ 476].nbits = 12; gv_local.lookup_slx_int[ 476].bits = 0xA3300000;
-  gv_local.lookup_slx_int[ 477].nbits = 12; gv_local.lookup_slx_int[ 477].bits = 0x9DD00000;
-  gv_local.lookup_slx_int[ 478].nbits = 12; gv_local.lookup_slx_int[ 478].bits = 0x9DC00000;
-  gv_local.lookup_slx_int[ 479].nbits = 12; gv_local.lookup_slx_int[ 479].bits = 0x95100000;
-  gv_local.lookup_slx_int[ 480].nbits = 12; gv_local.lookup_slx_int[ 480].bits = 0x91300000;
-  gv_local.lookup_slx_int[ 481].nbits = 12; gv_local.lookup_slx_int[ 481].bits = 0x91000000;
-  gv_local.lookup_slx_int[ 482].nbits = 12; gv_local.lookup_slx_int[ 482].bits = 0x91200000;
-  gv_local.lookup_slx_int[ 483].nbits = 12; gv_local.lookup_slx_int[ 483].bits = 0x87D00000;
-  gv_local.lookup_slx_int[ 484].nbits = 12; gv_local.lookup_slx_int[ 484].bits = 0x87C00000;
-  gv_local.lookup_slx_int[ 485].nbits = 12; gv_local.lookup_slx_int[ 485].bits = 0x86700000;
-  gv_local.lookup_slx_int[ 486].nbits = 12; gv_local.lookup_slx_int[ 486].bits = 0x7D900000;
-  gv_local.lookup_slx_int[ 487].nbits = 12; gv_local.lookup_slx_int[ 487].bits = 0x84900000;
-  gv_local.lookup_slx_int[ 488].nbits = 12; gv_local.lookup_slx_int[ 488].bits = 0x6F300000;
-  gv_local.lookup_slx_int[ 489].nbits = 12; gv_local.lookup_slx_int[ 489].bits = 0x6D700000;
-  gv_local.lookup_slx_int[ 490].nbits = 12; gv_local.lookup_slx_int[ 490].bits = 0x6D100000;
-  gv_local.lookup_slx_int[ 491].nbits = 12; gv_local.lookup_slx_int[ 491].bits = 0x6D600000;
-  gv_local.lookup_slx_int[ 492].nbits = 12; gv_local.lookup_slx_int[ 492].bits = 0x5BB00000;
-  gv_local.lookup_slx_int[ 493].nbits = 12; gv_local.lookup_slx_int[ 493].bits = 0x63500000;
-  gv_local.lookup_slx_int[ 494].nbits = 12; gv_local.lookup_slx_int[ 494].bits = 0x63400000;
-  gv_local.lookup_slx_int[ 495].nbits = 12; gv_local.lookup_slx_int[ 495].bits = 0x4C500000;
-  gv_local.lookup_slx_int[ 496].nbits = 12; gv_local.lookup_slx_int[ 496].bits = 0x58C00000;
-  gv_local.lookup_slx_int[ 497].nbits = 12; gv_local.lookup_slx_int[ 497].bits = 0x4F200000;
-  gv_local.lookup_slx_int[ 498].nbits = 12; gv_local.lookup_slx_int[ 498].bits = 0x48900000;
-  gv_local.lookup_slx_int[ 499].nbits = 12; gv_local.lookup_slx_int[ 499].bits = 0x48800000;
-  gv_local.lookup_slx_int[ 500].nbits = 12; gv_local.lookup_slx_int[ 500].bits = 0x3E700000;
-  gv_local.lookup_slx_int[ 501].nbits = 12; gv_local.lookup_slx_int[ 501].bits = 0x4C100000;
-  gv_local.lookup_slx_int[ 502].nbits = 12; gv_local.lookup_slx_int[ 502].bits = 0x3C100000;
-  gv_local.lookup_slx_int[ 503].nbits = 12; gv_local.lookup_slx_int[ 503].bits = 0x2B200000;
-  gv_local.lookup_slx_int[ 504].nbits = 12; gv_local.lookup_slx_int[ 504].bits = 0x3C300000;
-  gv_local.lookup_slx_int[ 505].nbits = 12; gv_local.lookup_slx_int[ 505].bits = 0x2B300000;
-  gv_local.lookup_slx_int[ 506].nbits = 12; gv_local.lookup_slx_int[ 506].bits = 0x2B000000;
-  gv_local.lookup_slx_int[ 507].nbits = 12; gv_local.lookup_slx_int[ 507].bits = 0x2B100000;
-  gv_local.lookup_slx_int[ 508].nbits = 12; gv_local.lookup_slx_int[ 508].bits = 0x29800000;
-  gv_local.lookup_slx_int[ 509].nbits = 12; gv_local.lookup_slx_int[ 509].bits = 0x21000000;
-  gv_local.lookup_slx_int[ 510].nbits = 12; gv_local.lookup_slx_int[ 510].bits = 0x21200000;
-  gv_local.lookup_slx_int[ 511].nbits =  3; gv_local.lookup_slx_int[ 511].bits = 0xE0000000;
-
-#if SRA_DECOMPRESS_USE_REVERSE_LOOKUP
-  /* reverse huffman lookup table
-   */
-  memset (gv_local.rlookup_slx_int, 0, sizeof(uint16_t)*REV_HUFF_TREESIZE_16);
-
-  for (i=0; i<INT_HUFF_TREESIZE; i++)
-  {
-    val = gv_local.lookup_slx_int[i].bits >> 16;
-    gv_local.rlookup_slx_int [val] = (uint16_t) i;
-    for (j=1; j<=(0xFFFF>>gv_local.lookup_slx_int[i].nbits); j++)
-      gv_local.rlookup_slx_int [val+j] = (uint16_t) i;
-  }
-#endif
-
-  _s_sort_lookup (gv_local.lookup_slx_int, gv_local.idx_slx_int, INT_HUFF_TREESIZE);
-
-  gv_local.lookup_slx_int_initialized = 1;
-}
-/*
- */
-static void _s_init_nse_slx_default (void)
-{
-#if SRA_DECOMPRESS_USE_REVERSE_LOOKUP
-  int      i, j;
-  uint16_t val;
-#endif
-
-  memset (gv_local.lookup_slx_nse,  0, sizeof(SRALookup)*NSE_HUFF_TREESIZE);
-
-  gv_local.lookup_slx_nse[   0].nbits = 11; gv_local.lookup_slx_nse[   0].bits = 0x6FE00000;
-  gv_local.lookup_slx_nse[   1].nbits = 11; gv_local.lookup_slx_nse[   1].bits = 0x7AC00000;
-  gv_local.lookup_slx_nse[   2].nbits = 11; gv_local.lookup_slx_nse[   2].bits = 0x6FC00000;
-  gv_local.lookup_slx_nse[   3].nbits = 11; gv_local.lookup_slx_nse[   3].bits = 0x7AE00000;
-  gv_local.lookup_slx_nse[   4].nbits = 11; gv_local.lookup_slx_nse[   4].bits = 0xC6A00000;
-  gv_local.lookup_slx_nse[   5].nbits = 11; gv_local.lookup_slx_nse[   5].bits = 0xDFC00000;
-  gv_local.lookup_slx_nse[   6].nbits = 11; gv_local.lookup_slx_nse[   6].bits = 0xD7200000;
-  gv_local.lookup_slx_nse[   7].nbits = 11; gv_local.lookup_slx_nse[   7].bits = 0xE4E00000;
-  gv_local.lookup_slx_nse[   8].nbits = 11; gv_local.lookup_slx_nse[   8].bits = 0xDA000000;
-  gv_local.lookup_slx_nse[   9].nbits = 11; gv_local.lookup_slx_nse[   9].bits = 0xD0000000;
-  gv_local.lookup_slx_nse[  10].nbits = 11; gv_local.lookup_slx_nse[  10].bits = 0xE8000000;
-  gv_local.lookup_slx_nse[  11].nbits = 11; gv_local.lookup_slx_nse[  11].bits = 0xCE400000;
-  gv_local.lookup_slx_nse[  12].nbits = 11; gv_local.lookup_slx_nse[  12].bits = 0xD7000000;
-  gv_local.lookup_slx_nse[  13].nbits = 11; gv_local.lookup_slx_nse[  13].bits = 0xD5000000;
-  gv_local.lookup_slx_nse[  14].nbits = 11; gv_local.lookup_slx_nse[  14].bits = 0xDDE00000;
-  gv_local.lookup_slx_nse[  15].nbits = 11; gv_local.lookup_slx_nse[  15].bits = 0xF2C00000;
-  gv_local.lookup_slx_nse[  16].nbits = 11; gv_local.lookup_slx_nse[  16].bits = 0xF6600000;
-  gv_local.lookup_slx_nse[  17].nbits = 11; gv_local.lookup_slx_nse[  17].bits = 0xEE400000;
-  gv_local.lookup_slx_nse[  18].nbits = 11; gv_local.lookup_slx_nse[  18].bits = 0xE4C00000;
-  gv_local.lookup_slx_nse[  19].nbits = 10; gv_local.lookup_slx_nse[  19].bits = 0x0F000000;
-  gv_local.lookup_slx_nse[  20].nbits = 11; gv_local.lookup_slx_nse[  20].bits = 0xEBC00000;
-  gv_local.lookup_slx_nse[  21].nbits = 11; gv_local.lookup_slx_nse[  21].bits = 0xF7E00000;
-  gv_local.lookup_slx_nse[  22].nbits = 11; gv_local.lookup_slx_nse[  22].bits = 0xF7C00000;
-  gv_local.lookup_slx_nse[  23].nbits = 10; gv_local.lookup_slx_nse[  23].bits = 0x18000000;
-  gv_local.lookup_slx_nse[  24].nbits = 10; gv_local.lookup_slx_nse[  24].bits = 0x22800000;
-  gv_local.lookup_slx_nse[  25].nbits = 10; gv_local.lookup_slx_nse[  25].bits = 0x0A000000;
-  gv_local.lookup_slx_nse[  26].nbits = 10; gv_local.lookup_slx_nse[  26].bits = 0x0F400000;
-  gv_local.lookup_slx_nse[  27].nbits = 10; gv_local.lookup_slx_nse[  27].bits = 0x18400000;
-  gv_local.lookup_slx_nse[  28].nbits = 10; gv_local.lookup_slx_nse[  28].bits = 0x1D800000;
-  gv_local.lookup_slx_nse[  29].nbits = 10; gv_local.lookup_slx_nse[  29].bits = 0x3CC00000;
-  gv_local.lookup_slx_nse[  30].nbits = 10; gv_local.lookup_slx_nse[  30].bits = 0x46C00000;
-  gv_local.lookup_slx_nse[  31].nbits = 10; gv_local.lookup_slx_nse[  31].bits = 0x1DC00000;
-  gv_local.lookup_slx_nse[  32].nbits = 10; gv_local.lookup_slx_nse[  32].bits = 0x42C00000;
-  gv_local.lookup_slx_nse[  33].nbits = 10; gv_local.lookup_slx_nse[  33].bits = 0x3F800000;
-  gv_local.lookup_slx_nse[  34].nbits = 10; gv_local.lookup_slx_nse[  34].bits = 0x3FC00000;
-  gv_local.lookup_slx_nse[  35].nbits = 10; gv_local.lookup_slx_nse[  35].bits = 0x4B800000;
-  gv_local.lookup_slx_nse[  36].nbits = 10; gv_local.lookup_slx_nse[  36].bits = 0x4BC00000;
-  gv_local.lookup_slx_nse[  37].nbits = 10; gv_local.lookup_slx_nse[  37].bits = 0x27C00000;
-  gv_local.lookup_slx_nse[  38].nbits = 10; gv_local.lookup_slx_nse[  38].bits = 0x46400000;
-  gv_local.lookup_slx_nse[  39].nbits = 10; gv_local.lookup_slx_nse[  39].bits = 0x52000000;
-  gv_local.lookup_slx_nse[  40].nbits = 10; gv_local.lookup_slx_nse[  40].bits = 0x58400000;
-  gv_local.lookup_slx_nse[  41].nbits = 10; gv_local.lookup_slx_nse[  41].bits = 0x50800000;
-  gv_local.lookup_slx_nse[  42].nbits = 10; gv_local.lookup_slx_nse[  42].bits = 0x56800000;
-  gv_local.lookup_slx_nse[  43].nbits = 10; gv_local.lookup_slx_nse[  43].bits = 0x56000000;
-  gv_local.lookup_slx_nse[  44].nbits = 10; gv_local.lookup_slx_nse[  44].bits = 0x57000000;
-  gv_local.lookup_slx_nse[  45].nbits = 10; gv_local.lookup_slx_nse[  45].bits = 0x62400000;
-  gv_local.lookup_slx_nse[  46].nbits = 10; gv_local.lookup_slx_nse[  46].bits = 0x56C00000;
-  gv_local.lookup_slx_nse[  47].nbits = 10; gv_local.lookup_slx_nse[  47].bits = 0x57400000;
-  gv_local.lookup_slx_nse[  48].nbits = 10; gv_local.lookup_slx_nse[  48].bits = 0x63800000;
-  gv_local.lookup_slx_nse[  49].nbits = 10; gv_local.lookup_slx_nse[  49].bits = 0x62000000;
-  gv_local.lookup_slx_nse[  50].nbits = 10; gv_local.lookup_slx_nse[  50].bits = 0x5C000000;
-  gv_local.lookup_slx_nse[  51].nbits = 10; gv_local.lookup_slx_nse[  51].bits = 0x60800000;
-  gv_local.lookup_slx_nse[  52].nbits = 10; gv_local.lookup_slx_nse[  52].bits = 0x6B000000;
-  gv_local.lookup_slx_nse[  53].nbits = 10; gv_local.lookup_slx_nse[  53].bits = 0x6B400000;
-  gv_local.lookup_slx_nse[  54].nbits = 10; gv_local.lookup_slx_nse[  54].bits = 0x67C00000;
-  gv_local.lookup_slx_nse[  55].nbits = 10; gv_local.lookup_slx_nse[  55].bits = 0x66400000;
-  gv_local.lookup_slx_nse[  56].nbits = 10; gv_local.lookup_slx_nse[  56].bits = 0x6A400000;
-  gv_local.lookup_slx_nse[  57].nbits = 10; gv_local.lookup_slx_nse[  57].bits = 0x6F800000;
-  gv_local.lookup_slx_nse[  58].nbits = 10; gv_local.lookup_slx_nse[  58].bits = 0x77000000;
-  gv_local.lookup_slx_nse[  59].nbits = 10; gv_local.lookup_slx_nse[  59].bits = 0x76400000;
-  gv_local.lookup_slx_nse[  60].nbits = 10; gv_local.lookup_slx_nse[  60].bits = 0x69800000;
-  gv_local.lookup_slx_nse[  61].nbits = 10; gv_local.lookup_slx_nse[  61].bits = 0x70000000;
-  gv_local.lookup_slx_nse[  62].nbits = 10; gv_local.lookup_slx_nse[  62].bits = 0x6A000000;
-  gv_local.lookup_slx_nse[  63].nbits = 10; gv_local.lookup_slx_nse[  63].bits = 0x76000000;
-  gv_local.lookup_slx_nse[  64].nbits = 10; gv_local.lookup_slx_nse[  64].bits = 0x79400000;
-  gv_local.lookup_slx_nse[  65].nbits = 10; gv_local.lookup_slx_nse[  65].bits = 0x7CC00000;
-  gv_local.lookup_slx_nse[  66].nbits = 10; gv_local.lookup_slx_nse[  66].bits = 0x74800000;
-  gv_local.lookup_slx_nse[  67].nbits = 10; gv_local.lookup_slx_nse[  67].bits = 0x78C00000;
-  gv_local.lookup_slx_nse[  68].nbits = 10; gv_local.lookup_slx_nse[  68].bits = 0x7B000000;
-  gv_local.lookup_slx_nse[  69].nbits = 10; gv_local.lookup_slx_nse[  69].bits = 0x6C000000;
-  gv_local.lookup_slx_nse[  70].nbits = 10; gv_local.lookup_slx_nse[  70].bits = 0xC2000000;
-  gv_local.lookup_slx_nse[  71].nbits = 10; gv_local.lookup_slx_nse[  71].bits = 0x79000000;
-  gv_local.lookup_slx_nse[  72].nbits = 10; gv_local.lookup_slx_nse[  72].bits = 0x77800000;
-  gv_local.lookup_slx_nse[  73].nbits = 10; gv_local.lookup_slx_nse[  73].bits = 0xC4C00000;
-  gv_local.lookup_slx_nse[  74].nbits = 10; gv_local.lookup_slx_nse[  74].bits = 0x78800000;
-  gv_local.lookup_slx_nse[  75].nbits = 10; gv_local.lookup_slx_nse[  75].bits = 0x7C400000;
-  gv_local.lookup_slx_nse[  76].nbits = 10; gv_local.lookup_slx_nse[  76].bits = 0xC7C00000;
-  gv_local.lookup_slx_nse[  77].nbits = 10; gv_local.lookup_slx_nse[  77].bits = 0x7A800000;
-  gv_local.lookup_slx_nse[  78].nbits = 10; gv_local.lookup_slx_nse[  78].bits = 0xC1400000;
-  gv_local.lookup_slx_nse[  79].nbits = 10; gv_local.lookup_slx_nse[  79].bits = 0x7F400000;
-  gv_local.lookup_slx_nse[  80].nbits = 10; gv_local.lookup_slx_nse[  80].bits = 0xC9C00000;
-  gv_local.lookup_slx_nse[  81].nbits = 10; gv_local.lookup_slx_nse[  81].bits = 0xCC800000;
-  gv_local.lookup_slx_nse[  82].nbits = 10; gv_local.lookup_slx_nse[  82].bits = 0xC6C00000;
-  gv_local.lookup_slx_nse[  83].nbits = 10; gv_local.lookup_slx_nse[  83].bits = 0xC0C00000;
-  gv_local.lookup_slx_nse[  84].nbits = 10; gv_local.lookup_slx_nse[  84].bits = 0xC9000000;
-  gv_local.lookup_slx_nse[  85].nbits = 10; gv_local.lookup_slx_nse[  85].bits = 0xD2800000;
-  gv_local.lookup_slx_nse[  86].nbits = 10; gv_local.lookup_slx_nse[  86].bits = 0xD0C00000;
-  gv_local.lookup_slx_nse[  87].nbits = 10; gv_local.lookup_slx_nse[  87].bits = 0xC6400000;
-  gv_local.lookup_slx_nse[  88].nbits = 10; gv_local.lookup_slx_nse[  88].bits = 0xC1800000;
-  gv_local.lookup_slx_nse[  89].nbits = 10; gv_local.lookup_slx_nse[  89].bits = 0xCE000000;
-  gv_local.lookup_slx_nse[  90].nbits = 10; gv_local.lookup_slx_nse[  90].bits = 0xC3800000;
-  gv_local.lookup_slx_nse[  91].nbits = 10; gv_local.lookup_slx_nse[  91].bits = 0xCD400000;
-  gv_local.lookup_slx_nse[  92].nbits = 10; gv_local.lookup_slx_nse[  92].bits = 0xD3000000;
-  gv_local.lookup_slx_nse[  93].nbits = 10; gv_local.lookup_slx_nse[  93].bits = 0xD7800000;
-  gv_local.lookup_slx_nse[  94].nbits = 10; gv_local.lookup_slx_nse[  94].bits = 0xD8800000;
-  gv_local.lookup_slx_nse[  95].nbits = 10; gv_local.lookup_slx_nse[  95].bits = 0xCB400000;
-  gv_local.lookup_slx_nse[  96].nbits = 10; gv_local.lookup_slx_nse[  96].bits = 0xCE800000;
-  gv_local.lookup_slx_nse[  97].nbits = 10; gv_local.lookup_slx_nse[  97].bits = 0xCB800000;
-  gv_local.lookup_slx_nse[  98].nbits = 10; gv_local.lookup_slx_nse[  98].bits = 0xE1400000;
-  gv_local.lookup_slx_nse[  99].nbits = 10; gv_local.lookup_slx_nse[  99].bits = 0xD8400000;
-  gv_local.lookup_slx_nse[ 100].nbits = 10; gv_local.lookup_slx_nse[ 100].bits = 0xE1800000;
-  gv_local.lookup_slx_nse[ 101].nbits = 10; gv_local.lookup_slx_nse[ 101].bits = 0xDD400000;
-  gv_local.lookup_slx_nse[ 102].nbits = 10; gv_local.lookup_slx_nse[ 102].bits = 0xDF400000;
-  gv_local.lookup_slx_nse[ 103].nbits = 10; gv_local.lookup_slx_nse[ 103].bits = 0xCEC00000;
-  gv_local.lookup_slx_nse[ 104].nbits = 10; gv_local.lookup_slx_nse[ 104].bits = 0xDA800000;
-  gv_local.lookup_slx_nse[ 105].nbits = 10; gv_local.lookup_slx_nse[ 105].bits = 0xD7C00000;
-  gv_local.lookup_slx_nse[ 106].nbits = 10; gv_local.lookup_slx_nse[ 106].bits = 0xE3800000;
-  gv_local.lookup_slx_nse[ 107].nbits = 10; gv_local.lookup_slx_nse[ 107].bits = 0xDB000000;
-  gv_local.lookup_slx_nse[ 108].nbits = 10; gv_local.lookup_slx_nse[ 108].bits = 0xE0400000;
-  gv_local.lookup_slx_nse[ 109].nbits = 10; gv_local.lookup_slx_nse[ 109].bits = 0xE3C00000;
-  gv_local.lookup_slx_nse[ 110].nbits = 10; gv_local.lookup_slx_nse[ 110].bits = 0xDF800000;
-  gv_local.lookup_slx_nse[ 111].nbits = 10; gv_local.lookup_slx_nse[ 111].bits = 0xD9800000;
-  gv_local.lookup_slx_nse[ 112].nbits = 10; gv_local.lookup_slx_nse[ 112].bits = 0xDE000000;
-  gv_local.lookup_slx_nse[ 113].nbits = 10; gv_local.lookup_slx_nse[ 113].bits = 0xE5800000;
-  gv_local.lookup_slx_nse[ 114].nbits = 10; gv_local.lookup_slx_nse[ 114].bits = 0xD2C00000;
-  gv_local.lookup_slx_nse[ 115].nbits = 10; gv_local.lookup_slx_nse[ 115].bits = 0xED400000;
-  gv_local.lookup_slx_nse[ 116].nbits = 10; gv_local.lookup_slx_nse[ 116].bits = 0xE7C00000;
-  gv_local.lookup_slx_nse[ 117].nbits = 10; gv_local.lookup_slx_nse[ 117].bits = 0xD3800000;
-  gv_local.lookup_slx_nse[ 118].nbits = 10; gv_local.lookup_slx_nse[ 118].bits = 0xE9800000;
-  gv_local.lookup_slx_nse[ 119].nbits = 10; gv_local.lookup_slx_nse[ 119].bits = 0xDBC00000;
-  gv_local.lookup_slx_nse[ 120].nbits = 10; gv_local.lookup_slx_nse[ 120].bits = 0xEC800000;
-  gv_local.lookup_slx_nse[ 121].nbits = 10; gv_local.lookup_slx_nse[ 121].bits = 0xED000000;
-  gv_local.lookup_slx_nse[ 122].nbits = 10; gv_local.lookup_slx_nse[ 122].bits = 0xEF800000;
-  gv_local.lookup_slx_nse[ 123].nbits = 10; gv_local.lookup_slx_nse[ 123].bits = 0xEC000000;
-  gv_local.lookup_slx_nse[ 124].nbits = 10; gv_local.lookup_slx_nse[ 124].bits = 0xF0400000;
-  gv_local.lookup_slx_nse[ 125].nbits = 10; gv_local.lookup_slx_nse[ 125].bits = 0xE1000000;
-  gv_local.lookup_slx_nse[ 126].nbits = 10; gv_local.lookup_slx_nse[ 126].bits = 0xEE000000;
-  gv_local.lookup_slx_nse[ 127].nbits = 10; gv_local.lookup_slx_nse[ 127].bits = 0xEAC00000;
-  gv_local.lookup_slx_nse[ 128].nbits = 10; gv_local.lookup_slx_nse[ 128].bits = 0xF8800000;
-  gv_local.lookup_slx_nse[ 129].nbits = 10; gv_local.lookup_slx_nse[ 129].bits = 0xE6800000;
-  gv_local.lookup_slx_nse[ 130].nbits = 10; gv_local.lookup_slx_nse[ 130].bits = 0xE6C00000;
-  gv_local.lookup_slx_nse[ 131].nbits = 10; gv_local.lookup_slx_nse[ 131].bits = 0xEB800000;
-  gv_local.lookup_slx_nse[ 132].nbits = 10; gv_local.lookup_slx_nse[ 132].bits = 0xECC00000;
-  gv_local.lookup_slx_nse[ 133].nbits = 10; gv_local.lookup_slx_nse[ 133].bits = 0xF2400000;
-  gv_local.lookup_slx_nse[ 134].nbits = 10; gv_local.lookup_slx_nse[ 134].bits = 0xF0000000;
-  gv_local.lookup_slx_nse[ 135].nbits = 10; gv_local.lookup_slx_nse[ 135].bits = 0xF5C00000;
-  gv_local.lookup_slx_nse[ 136].nbits = 10; gv_local.lookup_slx_nse[ 136].bits = 0xF7000000;
-  gv_local.lookup_slx_nse[ 137].nbits = 10; gv_local.lookup_slx_nse[ 137].bits = 0xEDC00000;
-  gv_local.lookup_slx_nse[ 138].nbits = 10; gv_local.lookup_slx_nse[ 138].bits = 0xF2800000;
-  gv_local.lookup_slx_nse[ 139].nbits = 10; gv_local.lookup_slx_nse[ 139].bits = 0xE9000000;
-  gv_local.lookup_slx_nse[ 140].nbits = 10; gv_local.lookup_slx_nse[ 140].bits = 0xF9400000;
-  gv_local.lookup_slx_nse[ 141].nbits = 10; gv_local.lookup_slx_nse[ 141].bits = 0xFF400000;
-  gv_local.lookup_slx_nse[ 142].nbits = 10; gv_local.lookup_slx_nse[ 142].bits = 0xFA800000;
-  gv_local.lookup_slx_nse[ 143].nbits = 10; gv_local.lookup_slx_nse[ 143].bits = 0xF8400000;
-  gv_local.lookup_slx_nse[ 144].nbits = 10; gv_local.lookup_slx_nse[ 144].bits = 0xEFC00000;
-  gv_local.lookup_slx_nse[ 145].nbits = 10; gv_local.lookup_slx_nse[ 145].bits = 0xEF400000;
-  gv_local.lookup_slx_nse[ 146].nbits = 10; gv_local.lookup_slx_nse[ 146].bits = 0xF9000000;
-  gv_local.lookup_slx_nse[ 147].nbits =  9; gv_local.lookup_slx_nse[ 147].bits = 0x07000000;
-  gv_local.lookup_slx_nse[ 148].nbits = 10; gv_local.lookup_slx_nse[ 148].bits = 0xF7800000;
-  gv_local.lookup_slx_nse[ 149].nbits = 10; gv_local.lookup_slx_nse[ 149].bits = 0xFF000000;
-  gv_local.lookup_slx_nse[ 150].nbits =  9; gv_local.lookup_slx_nse[ 150].bits = 0x04800000;
-  gv_local.lookup_slx_nse[ 151].nbits =  9; gv_local.lookup_slx_nse[ 151].bits = 0x08800000;
-  gv_local.lookup_slx_nse[ 152].nbits = 10; gv_local.lookup_slx_nse[ 152].bits = 0xFEC00000;
-  gv_local.lookup_slx_nse[ 153].nbits = 10; gv_local.lookup_slx_nse[ 153].bits = 0xFC000000;
-  gv_local.lookup_slx_nse[ 154].nbits =  9; gv_local.lookup_slx_nse[ 154].bits = 0x16000000;
-  gv_local.lookup_slx_nse[ 155].nbits = 10; gv_local.lookup_slx_nse[ 155].bits = 0xFB400000;
-  gv_local.lookup_slx_nse[ 156].nbits =  9; gv_local.lookup_slx_nse[ 156].bits = 0x01000000;
-  gv_local.lookup_slx_nse[ 157].nbits =  9; gv_local.lookup_slx_nse[ 157].bits = 0x08000000;
-  gv_local.lookup_slx_nse[ 158].nbits =  9; gv_local.lookup_slx_nse[ 158].bits = 0x18800000;
-  gv_local.lookup_slx_nse[ 159].nbits =  9; gv_local.lookup_slx_nse[ 159].bits = 0x0C000000;
-  gv_local.lookup_slx_nse[ 160].nbits =  9; gv_local.lookup_slx_nse[ 160].bits = 0x10800000;
-  gv_local.lookup_slx_nse[ 161].nbits =  9; gv_local.lookup_slx_nse[ 161].bits = 0x15000000;
-  gv_local.lookup_slx_nse[ 162].nbits =  9; gv_local.lookup_slx_nse[ 162].bits = 0x0A800000;
-  gv_local.lookup_slx_nse[ 163].nbits =  9; gv_local.lookup_slx_nse[ 163].bits = 0x04000000;
-  gv_local.lookup_slx_nse[ 164].nbits =  9; gv_local.lookup_slx_nse[ 164].bits = 0x22000000;
-  gv_local.lookup_slx_nse[ 165].nbits =  9; gv_local.lookup_slx_nse[ 165].bits = 0x17000000;
-  gv_local.lookup_slx_nse[ 166].nbits =  9; gv_local.lookup_slx_nse[ 166].bits = 0x1E800000;
-  gv_local.lookup_slx_nse[ 167].nbits =  9; gv_local.lookup_slx_nse[ 167].bits = 0x26000000;
-  gv_local.lookup_slx_nse[ 168].nbits =  9; gv_local.lookup_slx_nse[ 168].bits = 0x0D800000;
-  gv_local.lookup_slx_nse[ 169].nbits =  9; gv_local.lookup_slx_nse[ 169].bits = 0x10000000;
-  gv_local.lookup_slx_nse[ 170].nbits =  9; gv_local.lookup_slx_nse[ 170].bits = 0x31800000;
-  gv_local.lookup_slx_nse[ 171].nbits =  9; gv_local.lookup_slx_nse[ 171].bits = 0x29000000;
-  gv_local.lookup_slx_nse[ 172].nbits =  9; gv_local.lookup_slx_nse[ 172].bits = 0x15800000;
-  gv_local.lookup_slx_nse[ 173].nbits =  9; gv_local.lookup_slx_nse[ 173].bits = 0x29800000;
-  gv_local.lookup_slx_nse[ 174].nbits =  9; gv_local.lookup_slx_nse[ 174].bits = 0x26800000;
-  gv_local.lookup_slx_nse[ 175].nbits =  9; gv_local.lookup_slx_nse[ 175].bits = 0x1F800000;
-  gv_local.lookup_slx_nse[ 176].nbits =  9; gv_local.lookup_slx_nse[ 176].bits = 0x2E800000;
-  gv_local.lookup_slx_nse[ 177].nbits =  9; gv_local.lookup_slx_nse[ 177].bits = 0x3E000000;
-  gv_local.lookup_slx_nse[ 178].nbits =  9; gv_local.lookup_slx_nse[ 178].bits = 0x1F000000;
-  gv_local.lookup_slx_nse[ 179].nbits =  9; gv_local.lookup_slx_nse[ 179].bits = 0x34000000;
-  gv_local.lookup_slx_nse[ 180].nbits =  9; gv_local.lookup_slx_nse[ 180].bits = 0x2E000000;
-  gv_local.lookup_slx_nse[ 181].nbits =  9; gv_local.lookup_slx_nse[ 181].bits = 0x40800000;
-  gv_local.lookup_slx_nse[ 182].nbits =  9; gv_local.lookup_slx_nse[ 182].bits = 0x28000000;
-  gv_local.lookup_slx_nse[ 183].nbits =  9; gv_local.lookup_slx_nse[ 183].bits = 0x49800000;
-  gv_local.lookup_slx_nse[ 184].nbits =  9; gv_local.lookup_slx_nse[ 184].bits = 0x4A000000;
-  gv_local.lookup_slx_nse[ 185].nbits =  9; gv_local.lookup_slx_nse[ 185].bits = 0x4A800000;
-  gv_local.lookup_slx_nse[ 186].nbits =  9; gv_local.lookup_slx_nse[ 186].bits = 0x45000000;
-  gv_local.lookup_slx_nse[ 187].nbits =  9; gv_local.lookup_slx_nse[ 187].bits = 0x51000000;
-  gv_local.lookup_slx_nse[ 188].nbits =  9; gv_local.lookup_slx_nse[ 188].bits = 0x48000000;
-  gv_local.lookup_slx_nse[ 189].nbits =  9; gv_local.lookup_slx_nse[ 189].bits = 0x49000000;
-  gv_local.lookup_slx_nse[ 190].nbits =  9; gv_local.lookup_slx_nse[ 190].bits = 0x4E000000;
-  gv_local.lookup_slx_nse[ 191].nbits =  9; gv_local.lookup_slx_nse[ 191].bits = 0x4E800000;
-  gv_local.lookup_slx_nse[ 192].nbits =  9; gv_local.lookup_slx_nse[ 192].bits = 0x53000000;
-  gv_local.lookup_slx_nse[ 193].nbits =  9; gv_local.lookup_slx_nse[ 193].bits = 0x4C800000;
-  gv_local.lookup_slx_nse[ 194].nbits =  9; gv_local.lookup_slx_nse[ 194].bits = 0x57800000;
-  gv_local.lookup_slx_nse[ 195].nbits =  9; gv_local.lookup_slx_nse[ 195].bits = 0x4F800000;
-  gv_local.lookup_slx_nse[ 196].nbits =  9; gv_local.lookup_slx_nse[ 196].bits = 0x54800000;
-  gv_local.lookup_slx_nse[ 197].nbits =  9; gv_local.lookup_slx_nse[ 197].bits = 0x52800000;
-  gv_local.lookup_slx_nse[ 198].nbits =  9; gv_local.lookup_slx_nse[ 198].bits = 0x59800000;
-  gv_local.lookup_slx_nse[ 199].nbits =  9; gv_local.lookup_slx_nse[ 199].bits = 0x5A000000;
-  gv_local.lookup_slx_nse[ 200].nbits =  9; gv_local.lookup_slx_nse[ 200].bits = 0x58800000;
-  gv_local.lookup_slx_nse[ 201].nbits =  9; gv_local.lookup_slx_nse[ 201].bits = 0x5E000000;
-  gv_local.lookup_slx_nse[ 202].nbits =  9; gv_local.lookup_slx_nse[ 202].bits = 0x5E800000;
-  gv_local.lookup_slx_nse[ 203].nbits =  9; gv_local.lookup_slx_nse[ 203].bits = 0x61800000;
-  gv_local.lookup_slx_nse[ 204].nbits =  9; gv_local.lookup_slx_nse[ 204].bits = 0x6A800000;
-  gv_local.lookup_slx_nse[ 205].nbits =  9; gv_local.lookup_slx_nse[ 205].bits = 0x65800000;
-  gv_local.lookup_slx_nse[ 206].nbits =  9; gv_local.lookup_slx_nse[ 206].bits = 0x68000000;
-  gv_local.lookup_slx_nse[ 207].nbits =  9; gv_local.lookup_slx_nse[ 207].bits = 0x64000000;
-  gv_local.lookup_slx_nse[ 208].nbits =  9; gv_local.lookup_slx_nse[ 208].bits = 0x5D800000;
-  gv_local.lookup_slx_nse[ 209].nbits =  9; gv_local.lookup_slx_nse[ 209].bits = 0x6F000000;
-  gv_local.lookup_slx_nse[ 210].nbits =  9; gv_local.lookup_slx_nse[ 210].bits = 0x6D000000;
-  gv_local.lookup_slx_nse[ 211].nbits =  9; gv_local.lookup_slx_nse[ 211].bits = 0x6D800000;
-  gv_local.lookup_slx_nse[ 212].nbits =  9; gv_local.lookup_slx_nse[ 212].bits = 0x71000000;
-  gv_local.lookup_slx_nse[ 213].nbits =  9; gv_local.lookup_slx_nse[ 213].bits = 0x76800000;
-  gv_local.lookup_slx_nse[ 214].nbits =  9; gv_local.lookup_slx_nse[ 214].bits = 0x74000000;
-  gv_local.lookup_slx_nse[ 215].nbits =  9; gv_local.lookup_slx_nse[ 215].bits = 0x72000000;
-  gv_local.lookup_slx_nse[ 216].nbits =  9; gv_local.lookup_slx_nse[ 216].bits = 0x78000000;
-  gv_local.lookup_slx_nse[ 217].nbits =  9; gv_local.lookup_slx_nse[ 217].bits = 0x7D800000;
-  gv_local.lookup_slx_nse[ 218].nbits =  9; gv_local.lookup_slx_nse[ 218].bits = 0x7E800000;
-  gv_local.lookup_slx_nse[ 219].nbits =  9; gv_local.lookup_slx_nse[ 219].bits = 0xC2800000;
-  gv_local.lookup_slx_nse[ 220].nbits =  9; gv_local.lookup_slx_nse[ 220].bits = 0x7D000000;
-  gv_local.lookup_slx_nse[ 221].nbits =  9; gv_local.lookup_slx_nse[ 221].bits = 0xC4000000;
-  gv_local.lookup_slx_nse[ 222].nbits =  9; gv_local.lookup_slx_nse[ 222].bits = 0xC3000000;
-  gv_local.lookup_slx_nse[ 223].nbits =  9; gv_local.lookup_slx_nse[ 223].bits = 0xCD800000;
-  gv_local.lookup_slx_nse[ 224].nbits =  9; gv_local.lookup_slx_nse[ 224].bits = 0xE2000000;
-  gv_local.lookup_slx_nse[ 225].nbits =  9; gv_local.lookup_slx_nse[ 225].bits = 0xD4000000;
-  gv_local.lookup_slx_nse[ 226].nbits =  9; gv_local.lookup_slx_nse[ 226].bits = 0xDC800000;
-  gv_local.lookup_slx_nse[ 227].nbits =  9; gv_local.lookup_slx_nse[ 227].bits = 0xD6000000;
-  gv_local.lookup_slx_nse[ 228].nbits =  9; gv_local.lookup_slx_nse[ 228].bits = 0xDE800000;
-  gv_local.lookup_slx_nse[ 229].nbits =  9; gv_local.lookup_slx_nse[ 229].bits = 0xE2800000;
-  gv_local.lookup_slx_nse[ 230].nbits =  9; gv_local.lookup_slx_nse[ 230].bits = 0xE0800000;
-  gv_local.lookup_slx_nse[ 231].nbits =  9; gv_local.lookup_slx_nse[ 231].bits = 0xE7000000;
-  gv_local.lookup_slx_nse[ 232].nbits =  9; gv_local.lookup_slx_nse[ 232].bits = 0xEB000000;
-  gv_local.lookup_slx_nse[ 233].nbits =  9; gv_local.lookup_slx_nse[ 233].bits = 0xF3000000;
-  gv_local.lookup_slx_nse[ 234].nbits =  9; gv_local.lookup_slx_nse[ 234].bits = 0xF5000000;
-  gv_local.lookup_slx_nse[ 235].nbits =  9; gv_local.lookup_slx_nse[ 235].bits = 0xF0800000;
-  gv_local.lookup_slx_nse[ 236].nbits =  9; gv_local.lookup_slx_nse[ 236].bits = 0xFA000000;
-  gv_local.lookup_slx_nse[ 237].nbits =  9; gv_local.lookup_slx_nse[ 237].bits = 0xF4000000;
-  gv_local.lookup_slx_nse[ 238].nbits =  9; gv_local.lookup_slx_nse[ 238].bits = 0xFF800000;
-  gv_local.lookup_slx_nse[ 239].nbits =  9; gv_local.lookup_slx_nse[ 239].bits = 0xFC800000;
-  gv_local.lookup_slx_nse[ 240].nbits =  8; gv_local.lookup_slx_nse[ 240].bits = 0x03000000;
-  gv_local.lookup_slx_nse[ 241].nbits =  8; gv_local.lookup_slx_nse[ 241].bits = 0x0E000000;
-  gv_local.lookup_slx_nse[ 242].nbits =  8; gv_local.lookup_slx_nse[ 242].bits = 0x11000000;
-  gv_local.lookup_slx_nse[ 243].nbits =  8; gv_local.lookup_slx_nse[ 243].bits = 0x1B000000;
-  gv_local.lookup_slx_nse[ 244].nbits =  8; gv_local.lookup_slx_nse[ 244].bits = 0x1A000000;
-  gv_local.lookup_slx_nse[ 245].nbits =  8; gv_local.lookup_slx_nse[ 245].bits = 0x19000000;
-  gv_local.lookup_slx_nse[ 246].nbits =  8; gv_local.lookup_slx_nse[ 246].bits = 0x2C000000;
-  gv_local.lookup_slx_nse[ 247].nbits =  8; gv_local.lookup_slx_nse[ 247].bits = 0x35000000;
-  gv_local.lookup_slx_nse[ 248].nbits =  8; gv_local.lookup_slx_nse[ 248].bits = 0x37000000;
-  gv_local.lookup_slx_nse[ 249].nbits =  8; gv_local.lookup_slx_nse[ 249].bits = 0x32000000;
-  gv_local.lookup_slx_nse[ 250].nbits =  8; gv_local.lookup_slx_nse[ 250].bits = 0x39000000;
-  gv_local.lookup_slx_nse[ 251].nbits =  8; gv_local.lookup_slx_nse[ 251].bits = 0x47000000;
-  gv_local.lookup_slx_nse[ 252].nbits =  8; gv_local.lookup_slx_nse[ 252].bits = 0x2F000000;
-  gv_local.lookup_slx_nse[ 253].nbits =  8; gv_local.lookup_slx_nse[ 253].bits = 0x3D000000;
-  gv_local.lookup_slx_nse[ 254].nbits =  8; gv_local.lookup_slx_nse[ 254].bits = 0x21000000;
-  gv_local.lookup_slx_nse[ 255].nbits =  8; gv_local.lookup_slx_nse[ 255].bits = 0xD1000000;
-  gv_local.lookup_slx_nse[ 256].nbits =  8; gv_local.lookup_slx_nse[ 256].bits = 0x25000000;
-  gv_local.lookup_slx_nse[ 257].nbits =  8; gv_local.lookup_slx_nse[ 257].bits = 0x2D000000;
-  gv_local.lookup_slx_nse[ 258].nbits =  8; gv_local.lookup_slx_nse[ 258].bits = 0x30000000;
-  gv_local.lookup_slx_nse[ 259].nbits =  8; gv_local.lookup_slx_nse[ 259].bits = 0x36000000;
-  gv_local.lookup_slx_nse[ 260].nbits =  8; gv_local.lookup_slx_nse[ 260].bits = 0x33000000;
-  gv_local.lookup_slx_nse[ 261].nbits =  8; gv_local.lookup_slx_nse[ 261].bits = 0x41000000;
-  gv_local.lookup_slx_nse[ 262].nbits =  8; gv_local.lookup_slx_nse[ 262].bits = 0x2B000000;
-  gv_local.lookup_slx_nse[ 263].nbits =  8; gv_local.lookup_slx_nse[ 263].bits = 0x43000000;
-  gv_local.lookup_slx_nse[ 264].nbits =  8; gv_local.lookup_slx_nse[ 264].bits = 0x3B000000;
-  gv_local.lookup_slx_nse[ 265].nbits =  8; gv_local.lookup_slx_nse[ 265].bits = 0x2A000000;
-  gv_local.lookup_slx_nse[ 266].nbits =  8; gv_local.lookup_slx_nse[ 266].bits = 0x38000000;
-  gv_local.lookup_slx_nse[ 267].nbits =  8; gv_local.lookup_slx_nse[ 267].bits = 0x20000000;
-  gv_local.lookup_slx_nse[ 268].nbits =  8; gv_local.lookup_slx_nse[ 268].bits = 0x24000000;
-  gv_local.lookup_slx_nse[ 269].nbits =  8; gv_local.lookup_slx_nse[ 269].bits = 0x09000000;
-  gv_local.lookup_slx_nse[ 270].nbits =  8; gv_local.lookup_slx_nse[ 270].bits = 0x13000000;
-  gv_local.lookup_slx_nse[ 271].nbits =  8; gv_local.lookup_slx_nse[ 271].bits = 0x02000000;
-  gv_local.lookup_slx_nse[ 272].nbits =  8; gv_local.lookup_slx_nse[ 272].bits = 0x12000000;
-  gv_local.lookup_slx_nse[ 273].nbits =  8; gv_local.lookup_slx_nse[ 273].bits = 0x1C000000;
-  gv_local.lookup_slx_nse[ 274].nbits =  8; gv_local.lookup_slx_nse[ 274].bits = 0x05000000;
-  gv_local.lookup_slx_nse[ 275].nbits =  8; gv_local.lookup_slx_nse[ 275].bits = 0x06000000;
-  gv_local.lookup_slx_nse[ 276].nbits =  9; gv_local.lookup_slx_nse[ 276].bits = 0xFD000000;
-  gv_local.lookup_slx_nse[ 277].nbits =  8; gv_local.lookup_slx_nse[ 277].bits = 0x00000000;
-  gv_local.lookup_slx_nse[ 278].nbits =  9; gv_local.lookup_slx_nse[ 278].bits = 0xFB800000;
-  gv_local.lookup_slx_nse[ 279].nbits =  9; gv_local.lookup_slx_nse[ 279].bits = 0xF9800000;
-  gv_local.lookup_slx_nse[ 280].nbits =  9; gv_local.lookup_slx_nse[ 280].bits = 0xF6800000;
-  gv_local.lookup_slx_nse[ 281].nbits =  9; gv_local.lookup_slx_nse[ 281].bits = 0xEE800000;
-  gv_local.lookup_slx_nse[ 282].nbits =  9; gv_local.lookup_slx_nse[ 282].bits = 0xF4800000;
-  gv_local.lookup_slx_nse[ 283].nbits =  9; gv_local.lookup_slx_nse[ 283].bits = 0xE5000000;
-  gv_local.lookup_slx_nse[ 284].nbits =  9; gv_local.lookup_slx_nse[ 284].bits = 0xEA000000;
-  gv_local.lookup_slx_nse[ 285].nbits =  9; gv_local.lookup_slx_nse[ 285].bits = 0xE4000000;
-  gv_local.lookup_slx_nse[ 286].nbits =  9; gv_local.lookup_slx_nse[ 286].bits = 0xE6000000;
-  gv_local.lookup_slx_nse[ 287].nbits =  9; gv_local.lookup_slx_nse[ 287].bits = 0xDC000000;
-  gv_local.lookup_slx_nse[ 288].nbits =  9; gv_local.lookup_slx_nse[ 288].bits = 0xD5800000;
-  gv_local.lookup_slx_nse[ 289].nbits =  9; gv_local.lookup_slx_nse[ 289].bits = 0xD4800000;
-  gv_local.lookup_slx_nse[ 290].nbits =  9; gv_local.lookup_slx_nse[ 290].bits = 0xC8800000;
-  gv_local.lookup_slx_nse[ 291].nbits =  9; gv_local.lookup_slx_nse[ 291].bits = 0xCA800000;
-  gv_local.lookup_slx_nse[ 292].nbits =  9; gv_local.lookup_slx_nse[ 292].bits = 0xCA000000;
-  gv_local.lookup_slx_nse[ 293].nbits =  9; gv_local.lookup_slx_nse[ 293].bits = 0xCF000000;
-  gv_local.lookup_slx_nse[ 294].nbits =  9; gv_local.lookup_slx_nse[ 294].bits = 0xC7000000;
-  gv_local.lookup_slx_nse[ 295].nbits =  9; gv_local.lookup_slx_nse[ 295].bits = 0xC0000000;
-  gv_local.lookup_slx_nse[ 296].nbits =  9; gv_local.lookup_slx_nse[ 296].bits = 0x7F800000;
-  gv_local.lookup_slx_nse[ 297].nbits =  9; gv_local.lookup_slx_nse[ 297].bits = 0x7B800000;
-  gv_local.lookup_slx_nse[ 298].nbits =  9; gv_local.lookup_slx_nse[ 298].bits = 0x75800000;
-  gv_local.lookup_slx_nse[ 299].nbits =  9; gv_local.lookup_slx_nse[ 299].bits = 0x75000000;
-  gv_local.lookup_slx_nse[ 300].nbits =  9; gv_local.lookup_slx_nse[ 300].bits = 0x79800000;
-  gv_local.lookup_slx_nse[ 301].nbits =  9; gv_local.lookup_slx_nse[ 301].bits = 0x70800000;
-  gv_local.lookup_slx_nse[ 302].nbits =  9; gv_local.lookup_slx_nse[ 302].bits = 0x73800000;
-  gv_local.lookup_slx_nse[ 303].nbits =  9; gv_local.lookup_slx_nse[ 303].bits = 0x72800000;
-  gv_local.lookup_slx_nse[ 304].nbits =  9; gv_local.lookup_slx_nse[ 304].bits = 0x64800000;
-  gv_local.lookup_slx_nse[ 305].nbits =  9; gv_local.lookup_slx_nse[ 305].bits = 0x6C800000;
-  gv_local.lookup_slx_nse[ 306].nbits =  9; gv_local.lookup_slx_nse[ 306].bits = 0x6B800000;
-  gv_local.lookup_slx_nse[ 307].nbits =  9; gv_local.lookup_slx_nse[ 307].bits = 0x6E000000;
-  gv_local.lookup_slx_nse[ 308].nbits =  9; gv_local.lookup_slx_nse[ 308].bits = 0x67000000;
-  gv_local.lookup_slx_nse[ 309].nbits =  9; gv_local.lookup_slx_nse[ 309].bits = 0x69000000;
-  gv_local.lookup_slx_nse[ 310].nbits =  9; gv_local.lookup_slx_nse[ 310].bits = 0x5F800000;
-  gv_local.lookup_slx_nse[ 311].nbits =  9; gv_local.lookup_slx_nse[ 311].bits = 0x61000000;
-  gv_local.lookup_slx_nse[ 312].nbits =  9; gv_local.lookup_slx_nse[ 312].bits = 0x62800000;
-  gv_local.lookup_slx_nse[ 313].nbits =  9; gv_local.lookup_slx_nse[ 313].bits = 0x66800000;
-  gv_local.lookup_slx_nse[ 314].nbits =  9; gv_local.lookup_slx_nse[ 314].bits = 0x60000000;
-  gv_local.lookup_slx_nse[ 315].nbits =  9; gv_local.lookup_slx_nse[ 315].bits = 0x5F000000;
-  gv_local.lookup_slx_nse[ 316].nbits =  9; gv_local.lookup_slx_nse[ 316].bits = 0x5C800000;
-  gv_local.lookup_slx_nse[ 317].nbits =  9; gv_local.lookup_slx_nse[ 317].bits = 0x5D000000;
-  gv_local.lookup_slx_nse[ 318].nbits =  9; gv_local.lookup_slx_nse[ 318].bits = 0x5B800000;
-  gv_local.lookup_slx_nse[ 319].nbits =  9; gv_local.lookup_slx_nse[ 319].bits = 0x5B000000;
-  gv_local.lookup_slx_nse[ 320].nbits =  9; gv_local.lookup_slx_nse[ 320].bits = 0x55800000;
-  gv_local.lookup_slx_nse[ 321].nbits =  9; gv_local.lookup_slx_nse[ 321].bits = 0x59000000;
-  gv_local.lookup_slx_nse[ 322].nbits =  9; gv_local.lookup_slx_nse[ 322].bits = 0x54000000;
-  gv_local.lookup_slx_nse[ 323].nbits =  9; gv_local.lookup_slx_nse[ 323].bits = 0x50000000;
-  gv_local.lookup_slx_nse[ 324].nbits =  9; gv_local.lookup_slx_nse[ 324].bits = 0x4F000000;
-  gv_local.lookup_slx_nse[ 325].nbits =  9; gv_local.lookup_slx_nse[ 325].bits = 0x51800000;
-  gv_local.lookup_slx_nse[ 326].nbits =  9; gv_local.lookup_slx_nse[ 326].bits = 0x53800000;
-  gv_local.lookup_slx_nse[ 327].nbits =  9; gv_local.lookup_slx_nse[ 327].bits = 0x4D800000;
-  gv_local.lookup_slx_nse[ 328].nbits =  9; gv_local.lookup_slx_nse[ 328].bits = 0x45800000;
-  gv_local.lookup_slx_nse[ 329].nbits =  9; gv_local.lookup_slx_nse[ 329].bits = 0x48800000;
-  gv_local.lookup_slx_nse[ 330].nbits =  9; gv_local.lookup_slx_nse[ 330].bits = 0x4B000000;
-  gv_local.lookup_slx_nse[ 331].nbits =  9; gv_local.lookup_slx_nse[ 331].bits = 0x3E800000;
-  gv_local.lookup_slx_nse[ 332].nbits =  9; gv_local.lookup_slx_nse[ 332].bits = 0x44000000;
-  gv_local.lookup_slx_nse[ 333].nbits =  9; gv_local.lookup_slx_nse[ 333].bits = 0x3A800000;
-  gv_local.lookup_slx_nse[ 334].nbits =  9; gv_local.lookup_slx_nse[ 334].bits = 0x40000000;
-  gv_local.lookup_slx_nse[ 335].nbits =  9; gv_local.lookup_slx_nse[ 335].bits = 0x3C000000;
-  gv_local.lookup_slx_nse[ 336].nbits =  9; gv_local.lookup_slx_nse[ 336].bits = 0x27000000;
-  gv_local.lookup_slx_nse[ 337].nbits =  9; gv_local.lookup_slx_nse[ 337].bits = 0x3F000000;
-  gv_local.lookup_slx_nse[ 338].nbits =  9; gv_local.lookup_slx_nse[ 338].bits = 0x1E000000;
-  gv_local.lookup_slx_nse[ 339].nbits =  9; gv_local.lookup_slx_nse[ 339].bits = 0x3A000000;
-  gv_local.lookup_slx_nse[ 340].nbits =  9; gv_local.lookup_slx_nse[ 340].bits = 0x31000000;
-  gv_local.lookup_slx_nse[ 341].nbits =  9; gv_local.lookup_slx_nse[ 341].bits = 0x28800000;
-  gv_local.lookup_slx_nse[ 342].nbits =  9; gv_local.lookup_slx_nse[ 342].bits = 0x1D000000;
-  gv_local.lookup_slx_nse[ 343].nbits =  9; gv_local.lookup_slx_nse[ 343].bits = 0x34800000;
-  gv_local.lookup_slx_nse[ 344].nbits =  9; gv_local.lookup_slx_nse[ 344].bits = 0x14000000;
-  gv_local.lookup_slx_nse[ 345].nbits =  9; gv_local.lookup_slx_nse[ 345].bits = 0x23000000;
-  gv_local.lookup_slx_nse[ 346].nbits =  9; gv_local.lookup_slx_nse[ 346].bits = 0x23800000;
-  gv_local.lookup_slx_nse[ 347].nbits =  9; gv_local.lookup_slx_nse[ 347].bits = 0x0F800000;
-  gv_local.lookup_slx_nse[ 348].nbits =  9; gv_local.lookup_slx_nse[ 348].bits = 0x0B000000;
-  gv_local.lookup_slx_nse[ 349].nbits =  9; gv_local.lookup_slx_nse[ 349].bits = 0x0D000000;
-  gv_local.lookup_slx_nse[ 350].nbits = 10; gv_local.lookup_slx_nse[ 350].bits = 0xFE400000;
-  gv_local.lookup_slx_nse[ 351].nbits = 10; gv_local.lookup_slx_nse[ 351].bits = 0xFD800000;
-  gv_local.lookup_slx_nse[ 352].nbits =  9; gv_local.lookup_slx_nse[ 352].bits = 0x16800000;
-  gv_local.lookup_slx_nse[ 353].nbits =  9; gv_local.lookup_slx_nse[ 353].bits = 0x17800000;
-  gv_local.lookup_slx_nse[ 354].nbits = 10; gv_local.lookup_slx_nse[ 354].bits = 0xF7400000;
-  gv_local.lookup_slx_nse[ 355].nbits =  9; gv_local.lookup_slx_nse[ 355].bits = 0x0C800000;
-  gv_local.lookup_slx_nse[ 356].nbits =  9; gv_local.lookup_slx_nse[ 356].bits = 0x07800000;
-  gv_local.lookup_slx_nse[ 357].nbits = 10; gv_local.lookup_slx_nse[ 357].bits = 0xFB000000;
-  gv_local.lookup_slx_nse[ 358].nbits = 10; gv_local.lookup_slx_nse[ 358].bits = 0xFC400000;
-  gv_local.lookup_slx_nse[ 359].nbits =  9; gv_local.lookup_slx_nse[ 359].bits = 0x0B800000;
-  gv_local.lookup_slx_nse[ 360].nbits = 10; gv_local.lookup_slx_nse[ 360].bits = 0xFAC00000;
-  gv_local.lookup_slx_nse[ 361].nbits = 10; gv_local.lookup_slx_nse[ 361].bits = 0xFE800000;
-  gv_local.lookup_slx_nse[ 362].nbits = 10; gv_local.lookup_slx_nse[ 362].bits = 0xF3800000;
-  gv_local.lookup_slx_nse[ 363].nbits = 10; gv_local.lookup_slx_nse[ 363].bits = 0xF5800000;
-  gv_local.lookup_slx_nse[ 364].nbits = 10; gv_local.lookup_slx_nse[ 364].bits = 0xF3C00000;
-  gv_local.lookup_slx_nse[ 365].nbits = 10; gv_local.lookup_slx_nse[ 365].bits = 0xF1400000;
-  gv_local.lookup_slx_nse[ 366].nbits = 10; gv_local.lookup_slx_nse[ 366].bits = 0xF8C00000;
-  gv_local.lookup_slx_nse[ 367].nbits = 10; gv_local.lookup_slx_nse[ 367].bits = 0xF8000000;
-  gv_local.lookup_slx_nse[ 368].nbits = 10; gv_local.lookup_slx_nse[ 368].bits = 0xF2000000;
-  gv_local.lookup_slx_nse[ 369].nbits = 10; gv_local.lookup_slx_nse[ 369].bits = 0xED800000;
-  gv_local.lookup_slx_nse[ 370].nbits = 10; gv_local.lookup_slx_nse[ 370].bits = 0xF1C00000;
-  gv_local.lookup_slx_nse[ 371].nbits = 10; gv_local.lookup_slx_nse[ 371].bits = 0xF1800000;
-  gv_local.lookup_slx_nse[ 372].nbits = 10; gv_local.lookup_slx_nse[ 372].bits = 0xEC400000;
-  gv_local.lookup_slx_nse[ 373].nbits = 10; gv_local.lookup_slx_nse[ 373].bits = 0xDE400000;
-  gv_local.lookup_slx_nse[ 374].nbits = 10; gv_local.lookup_slx_nse[ 374].bits = 0xF1000000;
-  gv_local.lookup_slx_nse[ 375].nbits = 10; gv_local.lookup_slx_nse[ 375].bits = 0xE9400000;
-  gv_local.lookup_slx_nse[ 376].nbits = 10; gv_local.lookup_slx_nse[ 376].bits = 0xE8800000;
-  gv_local.lookup_slx_nse[ 377].nbits = 10; gv_local.lookup_slx_nse[ 377].bits = 0xEA800000;
-  gv_local.lookup_slx_nse[ 378].nbits = 10; gv_local.lookup_slx_nse[ 378].bits = 0xEF000000;
-  gv_local.lookup_slx_nse[ 379].nbits = 10; gv_local.lookup_slx_nse[ 379].bits = 0xE1C00000;
-  gv_local.lookup_slx_nse[ 380].nbits = 10; gv_local.lookup_slx_nse[ 380].bits = 0xE8C00000;
-  gv_local.lookup_slx_nse[ 381].nbits = 10; gv_local.lookup_slx_nse[ 381].bits = 0xE7800000;
-  gv_local.lookup_slx_nse[ 382].nbits = 10; gv_local.lookup_slx_nse[ 382].bits = 0xF6000000;
-  gv_local.lookup_slx_nse[ 383].nbits = 10; gv_local.lookup_slx_nse[ 383].bits = 0xDB800000;
-  gv_local.lookup_slx_nse[ 384].nbits = 10; gv_local.lookup_slx_nse[ 384].bits = 0xDAC00000;
-  gv_local.lookup_slx_nse[ 385].nbits = 10; gv_local.lookup_slx_nse[ 385].bits = 0xD9C00000;
-  gv_local.lookup_slx_nse[ 386].nbits = 10; gv_local.lookup_slx_nse[ 386].bits = 0xDD000000;
-  gv_local.lookup_slx_nse[ 387].nbits = 10; gv_local.lookup_slx_nse[ 387].bits = 0xE8400000;
-  gv_local.lookup_slx_nse[ 388].nbits = 10; gv_local.lookup_slx_nse[ 388].bits = 0xE5C00000;
-  gv_local.lookup_slx_nse[ 389].nbits = 10; gv_local.lookup_slx_nse[ 389].bits = 0xE0000000;
-  gv_local.lookup_slx_nse[ 390].nbits = 10; gv_local.lookup_slx_nse[ 390].bits = 0xE3000000;
-  gv_local.lookup_slx_nse[ 391].nbits = 10; gv_local.lookup_slx_nse[ 391].bits = 0xD8C00000;
-  gv_local.lookup_slx_nse[ 392].nbits = 10; gv_local.lookup_slx_nse[ 392].bits = 0xCCC00000;
-  gv_local.lookup_slx_nse[ 393].nbits = 10; gv_local.lookup_slx_nse[ 393].bits = 0xD9000000;
-  gv_local.lookup_slx_nse[ 394].nbits = 10; gv_local.lookup_slx_nse[ 394].bits = 0xE4800000;
-  gv_local.lookup_slx_nse[ 395].nbits = 10; gv_local.lookup_slx_nse[ 395].bits = 0xE9C00000;
-  gv_local.lookup_slx_nse[ 396].nbits = 10; gv_local.lookup_slx_nse[ 396].bits = 0xE3400000;
-  gv_local.lookup_slx_nse[ 397].nbits = 10; gv_local.lookup_slx_nse[ 397].bits = 0xD7400000;
-  gv_local.lookup_slx_nse[ 398].nbits = 10; gv_local.lookup_slx_nse[ 398].bits = 0xD6800000;
-  gv_local.lookup_slx_nse[ 399].nbits = 10; gv_local.lookup_slx_nse[ 399].bits = 0xC9800000;
-  gv_local.lookup_slx_nse[ 400].nbits = 10; gv_local.lookup_slx_nse[ 400].bits = 0xCF800000;
-  gv_local.lookup_slx_nse[ 401].nbits = 10; gv_local.lookup_slx_nse[ 401].bits = 0xD0400000;
-  gv_local.lookup_slx_nse[ 402].nbits = 10; gv_local.lookup_slx_nse[ 402].bits = 0xD5400000;
-  gv_local.lookup_slx_nse[ 403].nbits = 10; gv_local.lookup_slx_nse[ 403].bits = 0xD0800000;
-  gv_local.lookup_slx_nse[ 404].nbits = 10; gv_local.lookup_slx_nse[ 404].bits = 0xDA400000;
-  gv_local.lookup_slx_nse[ 405].nbits = 10; gv_local.lookup_slx_nse[ 405].bits = 0xD2000000;
-  gv_local.lookup_slx_nse[ 406].nbits = 10; gv_local.lookup_slx_nse[ 406].bits = 0xD3400000;
-  gv_local.lookup_slx_nse[ 407].nbits = 10; gv_local.lookup_slx_nse[ 407].bits = 0xD3C00000;
-  gv_local.lookup_slx_nse[ 408].nbits = 10; gv_local.lookup_slx_nse[ 408].bits = 0xD8000000;
-  gv_local.lookup_slx_nse[ 409].nbits = 10; gv_local.lookup_slx_nse[ 409].bits = 0xC5000000;
-  gv_local.lookup_slx_nse[ 410].nbits = 10; gv_local.lookup_slx_nse[ 410].bits = 0xC9400000;
-  gv_local.lookup_slx_nse[ 411].nbits = 10; gv_local.lookup_slx_nse[ 411].bits = 0xD6C00000;
-  gv_local.lookup_slx_nse[ 412].nbits = 10; gv_local.lookup_slx_nse[ 412].bits = 0xCD000000;
-  gv_local.lookup_slx_nse[ 413].nbits = 10; gv_local.lookup_slx_nse[ 413].bits = 0xDF000000;
-  gv_local.lookup_slx_nse[ 414].nbits = 10; gv_local.lookup_slx_nse[ 414].bits = 0xC8400000;
-  gv_local.lookup_slx_nse[ 415].nbits = 10; gv_local.lookup_slx_nse[ 415].bits = 0xC4800000;
-  gv_local.lookup_slx_nse[ 416].nbits = 10; gv_local.lookup_slx_nse[ 416].bits = 0xD2400000;
-  gv_local.lookup_slx_nse[ 417].nbits = 10; gv_local.lookup_slx_nse[ 417].bits = 0xCC400000;
-  gv_local.lookup_slx_nse[ 418].nbits = 10; gv_local.lookup_slx_nse[ 418].bits = 0xC5800000;
-  gv_local.lookup_slx_nse[ 419].nbits = 10; gv_local.lookup_slx_nse[ 419].bits = 0xDD800000;
-  gv_local.lookup_slx_nse[ 420].nbits = 10; gv_local.lookup_slx_nse[ 420].bits = 0xC8000000;
-  gv_local.lookup_slx_nse[ 421].nbits = 10; gv_local.lookup_slx_nse[ 421].bits = 0xCFC00000;
-  gv_local.lookup_slx_nse[ 422].nbits = 10; gv_local.lookup_slx_nse[ 422].bits = 0xC3C00000;
-  gv_local.lookup_slx_nse[ 423].nbits = 10; gv_local.lookup_slx_nse[ 423].bits = 0xC6000000;
-  gv_local.lookup_slx_nse[ 424].nbits = 10; gv_local.lookup_slx_nse[ 424].bits = 0xD9400000;
-  gv_local.lookup_slx_nse[ 425].nbits = 10; gv_local.lookup_slx_nse[ 425].bits = 0xCB000000;
-  gv_local.lookup_slx_nse[ 426].nbits = 10; gv_local.lookup_slx_nse[ 426].bits = 0xCC000000;
-  gv_local.lookup_slx_nse[ 427].nbits = 10; gv_local.lookup_slx_nse[ 427].bits = 0x7C000000;
-  gv_local.lookup_slx_nse[ 428].nbits = 10; gv_local.lookup_slx_nse[ 428].bits = 0xCBC00000;
-  gv_local.lookup_slx_nse[ 429].nbits = 10; gv_local.lookup_slx_nse[ 429].bits = 0x77400000;
-  gv_local.lookup_slx_nse[ 430].nbits = 10; gv_local.lookup_slx_nse[ 430].bits = 0xC2400000;
-  gv_local.lookup_slx_nse[ 431].nbits = 10; gv_local.lookup_slx_nse[ 431].bits = 0xC7800000;
-  gv_local.lookup_slx_nse[ 432].nbits = 10; gv_local.lookup_slx_nse[ 432].bits = 0xC1C00000;
-  gv_local.lookup_slx_nse[ 433].nbits = 10; gv_local.lookup_slx_nse[ 433].bits = 0xC0800000;
-  gv_local.lookup_slx_nse[ 434].nbits = 10; gv_local.lookup_slx_nse[ 434].bits = 0xC5400000;
-  gv_local.lookup_slx_nse[ 435].nbits = 10; gv_local.lookup_slx_nse[ 435].bits = 0x7E400000;
-  gv_local.lookup_slx_nse[ 436].nbits = 10; gv_local.lookup_slx_nse[ 436].bits = 0x7E000000;
-  gv_local.lookup_slx_nse[ 437].nbits = 10; gv_local.lookup_slx_nse[ 437].bits = 0xC1000000;
-  gv_local.lookup_slx_nse[ 438].nbits = 10; gv_local.lookup_slx_nse[ 438].bits = 0xC5C00000;
-  gv_local.lookup_slx_nse[ 439].nbits = 10; gv_local.lookup_slx_nse[ 439].bits = 0x7A400000;
-  gv_local.lookup_slx_nse[ 440].nbits = 10; gv_local.lookup_slx_nse[ 440].bits = 0x7A000000;
-  gv_local.lookup_slx_nse[ 441].nbits = 10; gv_local.lookup_slx_nse[ 441].bits = 0x70400000;
-  gv_local.lookup_slx_nse[ 442].nbits = 10; gv_local.lookup_slx_nse[ 442].bits = 0x7F000000;
-  gv_local.lookup_slx_nse[ 443].nbits = 10; gv_local.lookup_slx_nse[ 443].bits = 0x73400000;
-  gv_local.lookup_slx_nse[ 444].nbits = 10; gv_local.lookup_slx_nse[ 444].bits = 0x7C800000;
-  gv_local.lookup_slx_nse[ 445].nbits = 10; gv_local.lookup_slx_nse[ 445].bits = 0x7B400000;
-  gv_local.lookup_slx_nse[ 446].nbits = 10; gv_local.lookup_slx_nse[ 446].bits = 0x74C00000;
-  gv_local.lookup_slx_nse[ 447].nbits = 10; gv_local.lookup_slx_nse[ 447].bits = 0x6E800000;
-  gv_local.lookup_slx_nse[ 448].nbits = 10; gv_local.lookup_slx_nse[ 448].bits = 0x77C00000;
-  gv_local.lookup_slx_nse[ 449].nbits = 10; gv_local.lookup_slx_nse[ 449].bits = 0x73000000;
-  gv_local.lookup_slx_nse[ 450].nbits = 10; gv_local.lookup_slx_nse[ 450].bits = 0x71800000;
-  gv_local.lookup_slx_nse[ 451].nbits = 10; gv_local.lookup_slx_nse[ 451].bits = 0x6C400000;
-  gv_local.lookup_slx_nse[ 452].nbits = 10; gv_local.lookup_slx_nse[ 452].bits = 0x68C00000;
-  gv_local.lookup_slx_nse[ 453].nbits = 10; gv_local.lookup_slx_nse[ 453].bits = 0x71C00000;
-  gv_local.lookup_slx_nse[ 454].nbits = 10; gv_local.lookup_slx_nse[ 454].bits = 0x68800000;
-  gv_local.lookup_slx_nse[ 455].nbits = 10; gv_local.lookup_slx_nse[ 455].bits = 0x69C00000;
-  gv_local.lookup_slx_nse[ 456].nbits = 10; gv_local.lookup_slx_nse[ 456].bits = 0x6EC00000;
-  gv_local.lookup_slx_nse[ 457].nbits = 10; gv_local.lookup_slx_nse[ 457].bits = 0x65000000;
-  gv_local.lookup_slx_nse[ 458].nbits = 10; gv_local.lookup_slx_nse[ 458].bits = 0x67800000;
-  gv_local.lookup_slx_nse[ 459].nbits = 10; gv_local.lookup_slx_nse[ 459].bits = 0x5C400000;
-  gv_local.lookup_slx_nse[ 460].nbits = 10; gv_local.lookup_slx_nse[ 460].bits = 0x56400000;
-  gv_local.lookup_slx_nse[ 461].nbits = 10; gv_local.lookup_slx_nse[ 461].bits = 0x63400000;
-  gv_local.lookup_slx_nse[ 462].nbits = 10; gv_local.lookup_slx_nse[ 462].bits = 0x60C00000;
-  gv_local.lookup_slx_nse[ 463].nbits = 10; gv_local.lookup_slx_nse[ 463].bits = 0x65400000;
-  gv_local.lookup_slx_nse[ 464].nbits = 10; gv_local.lookup_slx_nse[ 464].bits = 0x66000000;
-  gv_local.lookup_slx_nse[ 465].nbits = 10; gv_local.lookup_slx_nse[ 465].bits = 0x63C00000;
-  gv_local.lookup_slx_nse[ 466].nbits = 10; gv_local.lookup_slx_nse[ 466].bits = 0x5AC00000;
-  gv_local.lookup_slx_nse[ 467].nbits = 10; gv_local.lookup_slx_nse[ 467].bits = 0x55400000;
-  gv_local.lookup_slx_nse[ 468].nbits = 10; gv_local.lookup_slx_nse[ 468].bits = 0x63000000;
-  gv_local.lookup_slx_nse[ 469].nbits = 10; gv_local.lookup_slx_nse[ 469].bits = 0x5A800000;
-  gv_local.lookup_slx_nse[ 470].nbits = 10; gv_local.lookup_slx_nse[ 470].bits = 0x55000000;
-  gv_local.lookup_slx_nse[ 471].nbits = 10; gv_local.lookup_slx_nse[ 471].bits = 0x58000000;
-  gv_local.lookup_slx_nse[ 472].nbits = 10; gv_local.lookup_slx_nse[ 472].bits = 0x4D000000;
-  gv_local.lookup_slx_nse[ 473].nbits = 10; gv_local.lookup_slx_nse[ 473].bits = 0x50C00000;
-  gv_local.lookup_slx_nse[ 474].nbits = 10; gv_local.lookup_slx_nse[ 474].bits = 0x46800000;
-  gv_local.lookup_slx_nse[ 475].nbits = 10; gv_local.lookup_slx_nse[ 475].bits = 0x44800000;
-  gv_local.lookup_slx_nse[ 476].nbits = 10; gv_local.lookup_slx_nse[ 476].bits = 0x4C000000;
-  gv_local.lookup_slx_nse[ 477].nbits = 10; gv_local.lookup_slx_nse[ 477].bits = 0x52400000;
-  gv_local.lookup_slx_nse[ 478].nbits = 10; gv_local.lookup_slx_nse[ 478].bits = 0x4D400000;
-  gv_local.lookup_slx_nse[ 479].nbits = 10; gv_local.lookup_slx_nse[ 479].bits = 0x42400000;
-  gv_local.lookup_slx_nse[ 480].nbits = 10; gv_local.lookup_slx_nse[ 480].bits = 0x42000000;
-  gv_local.lookup_slx_nse[ 481].nbits = 10; gv_local.lookup_slx_nse[ 481].bits = 0x42800000;
-  gv_local.lookup_slx_nse[ 482].nbits = 10; gv_local.lookup_slx_nse[ 482].bits = 0x27800000;
-  gv_local.lookup_slx_nse[ 483].nbits = 10; gv_local.lookup_slx_nse[ 483].bits = 0x46000000;
-  gv_local.lookup_slx_nse[ 484].nbits = 10; gv_local.lookup_slx_nse[ 484].bits = 0x44C00000;
-  gv_local.lookup_slx_nse[ 485].nbits = 10; gv_local.lookup_slx_nse[ 485].bits = 0x3C800000;
-  gv_local.lookup_slx_nse[ 486].nbits = 10; gv_local.lookup_slx_nse[ 486].bits = 0x4C400000;
-  gv_local.lookup_slx_nse[ 487].nbits = 10; gv_local.lookup_slx_nse[ 487].bits = 0x14800000;
-  gv_local.lookup_slx_nse[ 488].nbits = 10; gv_local.lookup_slx_nse[ 488].bits = 0x22C00000;
-  gv_local.lookup_slx_nse[ 489].nbits = 11; gv_local.lookup_slx_nse[ 489].bits = 0xFE000000;
-  gv_local.lookup_slx_nse[ 490].nbits = 10; gv_local.lookup_slx_nse[ 490].bits = 0x0A400000;
-  gv_local.lookup_slx_nse[ 491].nbits = 11; gv_local.lookup_slx_nse[ 491].bits = 0xFDC00000;
-  gv_local.lookup_slx_nse[ 492].nbits = 10; gv_local.lookup_slx_nse[ 492].bits = 0x14C00000;
-  gv_local.lookup_slx_nse[ 493].nbits = 10; gv_local.lookup_slx_nse[ 493].bits = 0x01C00000;
-  gv_local.lookup_slx_nse[ 494].nbits = 11; gv_local.lookup_slx_nse[ 494].bits = 0xFE200000;
-  gv_local.lookup_slx_nse[ 495].nbits = 11; gv_local.lookup_slx_nse[ 495].bits = 0xFDE00000;
-  gv_local.lookup_slx_nse[ 496].nbits = 10; gv_local.lookup_slx_nse[ 496].bits = 0x01800000;
-  gv_local.lookup_slx_nse[ 497].nbits = 11; gv_local.lookup_slx_nse[ 497].bits = 0xF6400000;
-  gv_local.lookup_slx_nse[ 498].nbits = 11; gv_local.lookup_slx_nse[ 498].bits = 0xF2E00000;
-  gv_local.lookup_slx_nse[ 499].nbits = 11; gv_local.lookup_slx_nse[ 499].bits = 0xEE600000;
-  gv_local.lookup_slx_nse[ 500].nbits = 11; gv_local.lookup_slx_nse[ 500].bits = 0xEBE00000;
-  gv_local.lookup_slx_nse[ 501].nbits = 11; gv_local.lookup_slx_nse[ 501].bits = 0xCE600000;
-  gv_local.lookup_slx_nse[ 502].nbits = 11; gv_local.lookup_slx_nse[ 502].bits = 0xE8200000;
-  gv_local.lookup_slx_nse[ 503].nbits = 11; gv_local.lookup_slx_nse[ 503].bits = 0xDA200000;
-  gv_local.lookup_slx_nse[ 504].nbits = 11; gv_local.lookup_slx_nse[ 504].bits = 0xD0200000;
-  gv_local.lookup_slx_nse[ 505].nbits = 11; gv_local.lookup_slx_nse[ 505].bits = 0xDFE00000;
-  gv_local.lookup_slx_nse[ 506].nbits = 11; gv_local.lookup_slx_nse[ 506].bits = 0xDB600000;
-  gv_local.lookup_slx_nse[ 507].nbits = 11; gv_local.lookup_slx_nse[ 507].bits = 0xD5200000;
-  gv_local.lookup_slx_nse[ 508].nbits = 11; gv_local.lookup_slx_nse[ 508].bits = 0xDB400000;
-  gv_local.lookup_slx_nse[ 509].nbits = 11; gv_local.lookup_slx_nse[ 509].bits = 0xDDC00000;
-  gv_local.lookup_slx_nse[ 510].nbits = 11; gv_local.lookup_slx_nse[ 510].bits = 0xC6800000;
-  gv_local.lookup_slx_nse[ 511].nbits =  2; gv_local.lookup_slx_nse[ 511].bits = 0x80000000;
-
-#if SRA_DECOMPRESS_USE_REVERSE_LOOKUP
-  /* reverse huffman lookup table
-   */
-  memset (gv_local.rlookup_slx_nse, 0, sizeof(uint16_t)*REV_HUFF_TREESIZE_16);
-
-  for (i=0; i<NSE_HUFF_TREESIZE; i++)
-  {
-    val = gv_local.lookup_slx_nse[i].bits >> 16;
-    gv_local.rlookup_slx_nse [val] = (uint16_t) i;
-    for (j=1; j<=(0xFFFF>>gv_local.lookup_slx_nse[i].nbits); j++)
-      gv_local.rlookup_slx_nse [val+j] = (uint16_t) i;
-  }
-#endif
-
-  _s_sort_lookup (gv_local.lookup_slx_nse, gv_local.idx_slx_nse, NSE_HUFF_TREESIZE);
-
-  gv_local.lookup_slx_nse_initialized = 1;
-}
-
-/*
- */
-static void _s_init_seq_default (void)
-{
-  memcpy (gv_local.conv2to4na[  0], "AAAA", 4);  memcpy (gv_local.conv2to4na[  1], "AAAC", 4);
-  memcpy (gv_local.conv2to4na[  2], "AAAG", 4);  memcpy (gv_local.conv2to4na[  3], "AAAT", 4);
-  memcpy (gv_local.conv2to4na[  4], "AACA", 4);  memcpy (gv_local.conv2to4na[  5], "AACC", 4);
-  memcpy (gv_local.conv2to4na[  6], "AACG", 4);  memcpy (gv_local.conv2to4na[  7], "AACT", 4);
-  memcpy (gv_local.conv2to4na[  8], "AAGA", 4);  memcpy (gv_local.conv2to4na[  9], "AAGC", 4);
-  memcpy (gv_local.conv2to4na[ 10], "AAGG", 4);  memcpy (gv_local.conv2to4na[ 11], "AAGT", 4);
-  memcpy (gv_local.conv2to4na[ 12], "AATA", 4);  memcpy (gv_local.conv2to4na[ 13], "AATC", 4);
-  memcpy (gv_local.conv2to4na[ 14], "AATG", 4);  memcpy (gv_local.conv2to4na[ 15], "AATT", 4);
-  memcpy (gv_local.conv2to4na[ 16], "ACAA", 4);  memcpy (gv_local.conv2to4na[ 17], "ACAC", 4);
-  memcpy (gv_local.conv2to4na[ 18], "ACAG", 4);  memcpy (gv_local.conv2to4na[ 19], "ACAT", 4);
-  memcpy (gv_local.conv2to4na[ 20], "ACCA", 4);  memcpy (gv_local.conv2to4na[ 21], "ACCC", 4);
-  memcpy (gv_local.conv2to4na[ 22], "ACCG", 4);  memcpy (gv_local.conv2to4na[ 23], "ACCT", 4);
-  memcpy (gv_local.conv2to4na[ 24], "ACGA", 4);  memcpy (gv_local.conv2to4na[ 25], "ACGC", 4);
-  memcpy (gv_local.conv2to4na[ 26], "ACGG", 4);  memcpy (gv_local.conv2to4na[ 27], "ACGT", 4);
-  memcpy (gv_local.conv2to4na[ 28], "ACTA", 4);  memcpy (gv_local.conv2to4na[ 29], "ACTC", 4);
-  memcpy (gv_local.conv2to4na[ 30], "ACTG", 4);  memcpy (gv_local.conv2to4na[ 31], "ACTT", 4);
-  memcpy (gv_local.conv2to4na[ 32], "AGAA", 4);  memcpy (gv_local.conv2to4na[ 33], "AGAC", 4);
-  memcpy (gv_local.conv2to4na[ 34], "AGAG", 4);  memcpy (gv_local.conv2to4na[ 35], "AGAT", 4);
-  memcpy (gv_local.conv2to4na[ 36], "AGCA", 4);  memcpy (gv_local.conv2to4na[ 37], "AGCC", 4);
-  memcpy (gv_local.conv2to4na[ 38], "AGCG", 4);  memcpy (gv_local.conv2to4na[ 39], "AGCT", 4);
-  memcpy (gv_local.conv2to4na[ 40], "AGGA", 4);  memcpy (gv_local.conv2to4na[ 41], "AGGC", 4);
-  memcpy (gv_local.conv2to4na[ 42], "AGGG", 4);  memcpy (gv_local.conv2to4na[ 43], "AGGT", 4);
-  memcpy (gv_local.conv2to4na[ 44], "AGTA", 4);  memcpy (gv_local.conv2to4na[ 45], "AGTC", 4);
-  memcpy (gv_local.conv2to4na[ 46], "AGTG", 4);  memcpy (gv_local.conv2to4na[ 47], "AGTT", 4);
-  memcpy (gv_local.conv2to4na[ 48], "ATAA", 4);  memcpy (gv_local.conv2to4na[ 49], "ATAC", 4);
-  memcpy (gv_local.conv2to4na[ 50], "ATAG", 4);  memcpy (gv_local.conv2to4na[ 51], "ATAT", 4);
-  memcpy (gv_local.conv2to4na[ 52], "ATCA", 4);  memcpy (gv_local.conv2to4na[ 53], "ATCC", 4);
-  memcpy (gv_local.conv2to4na[ 54], "ATCG", 4);  memcpy (gv_local.conv2to4na[ 55], "ATCT", 4);
-  memcpy (gv_local.conv2to4na[ 56], "ATGA", 4);  memcpy (gv_local.conv2to4na[ 57], "ATGC", 4);
-  memcpy (gv_local.conv2to4na[ 58], "ATGG", 4);  memcpy (gv_local.conv2to4na[ 59], "ATGT", 4);
-  memcpy (gv_local.conv2to4na[ 60], "ATTA", 4);  memcpy (gv_local.conv2to4na[ 61], "ATTC", 4);
-  memcpy (gv_local.conv2to4na[ 62], "ATTG", 4);  memcpy (gv_local.conv2to4na[ 63], "ATTT", 4);
-  memcpy (gv_local.conv2to4na[ 64], "CAAA", 4);  memcpy (gv_local.conv2to4na[ 65], "CAAC", 4);
-  memcpy (gv_local.conv2to4na[ 66], "CAAG", 4);  memcpy (gv_local.conv2to4na[ 67], "CAAT", 4);
-  memcpy (gv_local.conv2to4na[ 68], "CACA", 4);  memcpy (gv_local.conv2to4na[ 69], "CACC", 4);
-  memcpy (gv_local.conv2to4na[ 70], "CACG", 4);  memcpy (gv_local.conv2to4na[ 71], "CACT", 4);
-  memcpy (gv_local.conv2to4na[ 72], "CAGA", 4);  memcpy (gv_local.conv2to4na[ 73], "CAGC", 4);
-  memcpy (gv_local.conv2to4na[ 74], "CAGG", 4);  memcpy (gv_local.conv2to4na[ 75], "CAGT", 4);
-  memcpy (gv_local.conv2to4na[ 76], "CATA", 4);  memcpy (gv_local.conv2to4na[ 77], "CATC", 4);
-  memcpy (gv_local.conv2to4na[ 78], "CATG", 4);  memcpy (gv_local.conv2to4na[ 79], "CATT", 4);
-  memcpy (gv_local.conv2to4na[ 80], "CCAA", 4);  memcpy (gv_local.conv2to4na[ 81], "CCAC", 4);
-  memcpy (gv_local.conv2to4na[ 82], "CCAG", 4);  memcpy (gv_local.conv2to4na[ 83], "CCAT", 4);
-  memcpy (gv_local.conv2to4na[ 84], "CCCA", 4);  memcpy (gv_local.conv2to4na[ 85], "CCCC", 4);
-  memcpy (gv_local.conv2to4na[ 86], "CCCG", 4);  memcpy (gv_local.conv2to4na[ 87], "CCCT", 4);
-  memcpy (gv_local.conv2to4na[ 88], "CCGA", 4);  memcpy (gv_local.conv2to4na[ 89], "CCGC", 4);
-  memcpy (gv_local.conv2to4na[ 90], "CCGG", 4);  memcpy (gv_local.conv2to4na[ 91], "CCGT", 4);
-  memcpy (gv_local.conv2to4na[ 92], "CCTA", 4);  memcpy (gv_local.conv2to4na[ 93], "CCTC", 4);
-  memcpy (gv_local.conv2to4na[ 94], "CCTG", 4);  memcpy (gv_local.conv2to4na[ 95], "CCTT", 4);
-  memcpy (gv_local.conv2to4na[ 96], "CGAA", 4);  memcpy (gv_local.conv2to4na[ 97], "CGAC", 4);
-  memcpy (gv_local.conv2to4na[ 98], "CGAG", 4);  memcpy (gv_local.conv2to4na[ 99], "CGAT", 4);
-  memcpy (gv_local.conv2to4na[100], "CGCA", 4);  memcpy (gv_local.conv2to4na[101], "CGCC", 4);
-  memcpy (gv_local.conv2to4na[102], "CGCG", 4);  memcpy (gv_local.conv2to4na[103], "CGCT", 4);
-  memcpy (gv_local.conv2to4na[104], "CGGA", 4);  memcpy (gv_local.conv2to4na[105], "CGGC", 4);
-  memcpy (gv_local.conv2to4na[106], "CGGG", 4);  memcpy (gv_local.conv2to4na[107], "CGGT", 4);
-  memcpy (gv_local.conv2to4na[108], "CGTA", 4);  memcpy (gv_local.conv2to4na[109], "CGTC", 4);
-  memcpy (gv_local.conv2to4na[110], "CGTG", 4);  memcpy (gv_local.conv2to4na[111], "CGTT", 4);
-  memcpy (gv_local.conv2to4na[112], "CTAA", 4);  memcpy (gv_local.conv2to4na[113], "CTAC", 4);
-  memcpy (gv_local.conv2to4na[114], "CTAG", 4);  memcpy (gv_local.conv2to4na[115], "CTAT", 4);
-  memcpy (gv_local.conv2to4na[116], "CTCA", 4);  memcpy (gv_local.conv2to4na[117], "CTCC", 4);
-  memcpy (gv_local.conv2to4na[118], "CTCG", 4);  memcpy (gv_local.conv2to4na[119], "CTCT", 4);
-  memcpy (gv_local.conv2to4na[120], "CTGA", 4);  memcpy (gv_local.conv2to4na[121], "CTGC", 4);
-  memcpy (gv_local.conv2to4na[122], "CTGG", 4);  memcpy (gv_local.conv2to4na[123], "CTGT", 4);
-  memcpy (gv_local.conv2to4na[124], "CTTA", 4);  memcpy (gv_local.conv2to4na[125], "CTTC", 4);
-  memcpy (gv_local.conv2to4na[126], "CTTG", 4);  memcpy (gv_local.conv2to4na[127], "CTTT", 4);
-  memcpy (gv_local.conv2to4na[128], "GAAA", 4);  memcpy (gv_local.conv2to4na[129], "GAAC", 4);
-  memcpy (gv_local.conv2to4na[130], "GAAG", 4);  memcpy (gv_local.conv2to4na[131], "GAAT", 4);
-  memcpy (gv_local.conv2to4na[132], "GACA", 4);  memcpy (gv_local.conv2to4na[133], "GACC", 4);
-  memcpy (gv_local.conv2to4na[134], "GACG", 4);  memcpy (gv_local.conv2to4na[135], "GACT", 4);
-  memcpy (gv_local.conv2to4na[136], "GAGA", 4);  memcpy (gv_local.conv2to4na[137], "GAGC", 4);
-  memcpy (gv_local.conv2to4na[138], "GAGG", 4);  memcpy (gv_local.conv2to4na[139], "GAGT", 4);
-  memcpy (gv_local.conv2to4na[140], "GATA", 4);  memcpy (gv_local.conv2to4na[141], "GATC", 4);
-  memcpy (gv_local.conv2to4na[142], "GATG", 4);  memcpy (gv_local.conv2to4na[143], "GATT", 4);
-  memcpy (gv_local.conv2to4na[144], "GCAA", 4);  memcpy (gv_local.conv2to4na[145], "GCAC", 4);
-  memcpy (gv_local.conv2to4na[146], "GCAG", 4);  memcpy (gv_local.conv2to4na[147], "GCAT", 4);
-  memcpy (gv_local.conv2to4na[148], "GCCA", 4);  memcpy (gv_local.conv2to4na[149], "GCCC", 4);
-  memcpy (gv_local.conv2to4na[150], "GCCG", 4);  memcpy (gv_local.conv2to4na[151], "GCCT", 4);
-  memcpy (gv_local.conv2to4na[152], "GCGA", 4);  memcpy (gv_local.conv2to4na[153], "GCGC", 4);
-  memcpy (gv_local.conv2to4na[154], "GCGG", 4);  memcpy (gv_local.conv2to4na[155], "GCGT", 4);
-  memcpy (gv_local.conv2to4na[156], "GCTA", 4);  memcpy (gv_local.conv2to4na[157], "GCTC", 4);
-  memcpy (gv_local.conv2to4na[158], "GCTG", 4);  memcpy (gv_local.conv2to4na[159], "GCTT", 4);
-  memcpy (gv_local.conv2to4na[160], "GGAA", 4);  memcpy (gv_local.conv2to4na[161], "GGAC", 4);
-  memcpy (gv_local.conv2to4na[162], "GGAG", 4);  memcpy (gv_local.conv2to4na[163], "GGAT", 4);
-  memcpy (gv_local.conv2to4na[164], "GGCA", 4);  memcpy (gv_local.conv2to4na[165], "GGCC", 4);
-  memcpy (gv_local.conv2to4na[166], "GGCG", 4);  memcpy (gv_local.conv2to4na[167], "GGCT", 4);
-  memcpy (gv_local.conv2to4na[168], "GGGA", 4);  memcpy (gv_local.conv2to4na[169], "GGGC", 4);
-  memcpy (gv_local.conv2to4na[170], "GGGG", 4);  memcpy (gv_local.conv2to4na[171], "GGGT", 4);
-  memcpy (gv_local.conv2to4na[172], "GGTA", 4);  memcpy (gv_local.conv2to4na[173], "GGTC", 4);
-  memcpy (gv_local.conv2to4na[174], "GGTG", 4);  memcpy (gv_local.conv2to4na[175], "GGTT", 4);
-  memcpy (gv_local.conv2to4na[176], "GTAA", 4);  memcpy (gv_local.conv2to4na[177], "GTAC", 4);
-  memcpy (gv_local.conv2to4na[178], "GTAG", 4);  memcpy (gv_local.conv2to4na[179], "GTAT", 4);
-  memcpy (gv_local.conv2to4na[180], "GTCA", 4);  memcpy (gv_local.conv2to4na[181], "GTCC", 4);
-  memcpy (gv_local.conv2to4na[182], "GTCG", 4);  memcpy (gv_local.conv2to4na[183], "GTCT", 4);
-  memcpy (gv_local.conv2to4na[184], "GTGA", 4);  memcpy (gv_local.conv2to4na[185], "GTGC", 4);
-  memcpy (gv_local.conv2to4na[186], "GTGG", 4);  memcpy (gv_local.conv2to4na[187], "GTGT", 4);
-  memcpy (gv_local.conv2to4na[188], "GTTA", 4);  memcpy (gv_local.conv2to4na[189], "GTTC", 4);
-  memcpy (gv_local.conv2to4na[190], "GTTG", 4);  memcpy (gv_local.conv2to4na[191], "GTTT", 4);
-  memcpy (gv_local.conv2to4na[192], "TAAA", 4);  memcpy (gv_local.conv2to4na[193], "TAAC", 4);
-  memcpy (gv_local.conv2to4na[194], "TAAG", 4);  memcpy (gv_local.conv2to4na[195], "TAAT", 4);
-  memcpy (gv_local.conv2to4na[196], "TACA", 4);  memcpy (gv_local.conv2to4na[197], "TACC", 4);
-  memcpy (gv_local.conv2to4na[198], "TACG", 4);  memcpy (gv_local.conv2to4na[199], "TACT", 4);
-  memcpy (gv_local.conv2to4na[200], "TAGA", 4);  memcpy (gv_local.conv2to4na[201], "TAGC", 4);
-  memcpy (gv_local.conv2to4na[202], "TAGG", 4);  memcpy (gv_local.conv2to4na[203], "TAGT", 4);
-  memcpy (gv_local.conv2to4na[204], "TATA", 4);  memcpy (gv_local.conv2to4na[205], "TATC", 4);
-  memcpy (gv_local.conv2to4na[206], "TATG", 4);  memcpy (gv_local.conv2to4na[207], "TATT", 4);
-  memcpy (gv_local.conv2to4na[208], "TCAA", 4);  memcpy (gv_local.conv2to4na[209], "TCAC", 4);
-  memcpy (gv_local.conv2to4na[210], "TCAG", 4);  memcpy (gv_local.conv2to4na[211], "TCAT", 4);
-  memcpy (gv_local.conv2to4na[212], "TCCA", 4);  memcpy (gv_local.conv2to4na[213], "TCCC", 4);
-  memcpy (gv_local.conv2to4na[214], "TCCG", 4);  memcpy (gv_local.conv2to4na[215], "TCCT", 4);
-  memcpy (gv_local.conv2to4na[216], "TCGA", 4);  memcpy (gv_local.conv2to4na[217], "TCGC", 4);
-  memcpy (gv_local.conv2to4na[218], "TCGG", 4);  memcpy (gv_local.conv2to4na[219], "TCGT", 4);
-  memcpy (gv_local.conv2to4na[220], "TCTA", 4);  memcpy (gv_local.conv2to4na[221], "TCTC", 4);
-  memcpy (gv_local.conv2to4na[222], "TCTG", 4);  memcpy (gv_local.conv2to4na[223], "TCTT", 4);
-  memcpy (gv_local.conv2to4na[224], "TGAA", 4);  memcpy (gv_local.conv2to4na[225], "TGAC", 4);
-  memcpy (gv_local.conv2to4na[226], "TGAG", 4);  memcpy (gv_local.conv2to4na[227], "TGAT", 4);
-  memcpy (gv_local.conv2to4na[228], "TGCA", 4);  memcpy (gv_local.conv2to4na[229], "TGCC", 4);
-  memcpy (gv_local.conv2to4na[230], "TGCG", 4);  memcpy (gv_local.conv2to4na[231], "TGCT", 4);
-  memcpy (gv_local.conv2to4na[232], "TGGA", 4);  memcpy (gv_local.conv2to4na[233], "TGGC", 4);
-  memcpy (gv_local.conv2to4na[234], "TGGG", 4);  memcpy (gv_local.conv2to4na[235], "TGGT", 4);
-  memcpy (gv_local.conv2to4na[236], "TGTA", 4);  memcpy (gv_local.conv2to4na[237], "TGTC", 4);
-  memcpy (gv_local.conv2to4na[238], "TGTG", 4);  memcpy (gv_local.conv2to4na[239], "TGTT", 4);
-  memcpy (gv_local.conv2to4na[240], "TTAA", 4);  memcpy (gv_local.conv2to4na[241], "TTAC", 4);
-  memcpy (gv_local.conv2to4na[242], "TTAG", 4);  memcpy (gv_local.conv2to4na[243], "TTAT", 4);
-  memcpy (gv_local.conv2to4na[244], "TTCA", 4);  memcpy (gv_local.conv2to4na[245], "TTCC", 4);
-  memcpy (gv_local.conv2to4na[246], "TTCG", 4);  memcpy (gv_local.conv2to4na[247], "TTCT", 4);
-  memcpy (gv_local.conv2to4na[248], "TTGA", 4);  memcpy (gv_local.conv2to4na[249], "TTGC", 4);
-  memcpy (gv_local.conv2to4na[250], "TTGG", 4);  memcpy (gv_local.conv2to4na[251], "TTGT", 4);
-  memcpy (gv_local.conv2to4na[252], "TTTA", 4);  memcpy (gv_local.conv2to4na[253], "TTTC", 4);
-  memcpy (gv_local.conv2to4na[254], "TTTG", 4);  memcpy (gv_local.conv2to4na[255], "TTTT", 4);
-
-  memcpy (gv_local.conv2to4cs[  0], "0000", 4);  memcpy (gv_local.conv2to4cs[  1], "0001", 4);
-  memcpy (gv_local.conv2to4cs[  2], "0002", 4);  memcpy (gv_local.conv2to4cs[  3], "0003", 4);
-  memcpy (gv_local.conv2to4cs[  4], "0010", 4);  memcpy (gv_local.conv2to4cs[  5], "0011", 4);
-  memcpy (gv_local.conv2to4cs[  6], "0012", 4);  memcpy (gv_local.conv2to4cs[  7], "0013", 4);
-  memcpy (gv_local.conv2to4cs[  8], "0020", 4);  memcpy (gv_local.conv2to4cs[  9], "0021", 4);
-  memcpy (gv_local.conv2to4cs[ 10], "0022", 4);  memcpy (gv_local.conv2to4cs[ 11], "0023", 4);
-  memcpy (gv_local.conv2to4cs[ 12], "0030", 4);  memcpy (gv_local.conv2to4cs[ 13], "0031", 4);
-  memcpy (gv_local.conv2to4cs[ 14], "0032", 4);  memcpy (gv_local.conv2to4cs[ 15], "0033", 4);
-  memcpy (gv_local.conv2to4cs[ 16], "0100", 4);  memcpy (gv_local.conv2to4cs[ 17], "0101", 4);
-  memcpy (gv_local.conv2to4cs[ 18], "0102", 4);  memcpy (gv_local.conv2to4cs[ 19], "0103", 4);
-  memcpy (gv_local.conv2to4cs[ 20], "0110", 4);  memcpy (gv_local.conv2to4cs[ 21], "0111", 4);
-  memcpy (gv_local.conv2to4cs[ 22], "0112", 4);  memcpy (gv_local.conv2to4cs[ 23], "0113", 4);
-  memcpy (gv_local.conv2to4cs[ 24], "0120", 4);  memcpy (gv_local.conv2to4cs[ 25], "0121", 4);
-  memcpy (gv_local.conv2to4cs[ 26], "0122", 4);  memcpy (gv_local.conv2to4cs[ 27], "0123", 4);
-  memcpy (gv_local.conv2to4cs[ 28], "0130", 4);  memcpy (gv_local.conv2to4cs[ 29], "0131", 4);
-  memcpy (gv_local.conv2to4cs[ 30], "0132", 4);  memcpy (gv_local.conv2to4cs[ 31], "0133", 4);
-  memcpy (gv_local.conv2to4cs[ 32], "0200", 4);  memcpy (gv_local.conv2to4cs[ 33], "0201", 4);
-  memcpy (gv_local.conv2to4cs[ 34], "0202", 4);  memcpy (gv_local.conv2to4cs[ 35], "0203", 4);
-  memcpy (gv_local.conv2to4cs[ 36], "0210", 4);  memcpy (gv_local.conv2to4cs[ 37], "0211", 4);
-  memcpy (gv_local.conv2to4cs[ 38], "0212", 4);  memcpy (gv_local.conv2to4cs[ 39], "0213", 4);
-  memcpy (gv_local.conv2to4cs[ 40], "0220", 4);  memcpy (gv_local.conv2to4cs[ 41], "0221", 4);
-  memcpy (gv_local.conv2to4cs[ 42], "0222", 4);  memcpy (gv_local.conv2to4cs[ 43], "0223", 4);
-  memcpy (gv_local.conv2to4cs[ 44], "0230", 4);  memcpy (gv_local.conv2to4cs[ 45], "0231", 4);
-  memcpy (gv_local.conv2to4cs[ 46], "0232", 4);  memcpy (gv_local.conv2to4cs[ 47], "0233", 4);
-  memcpy (gv_local.conv2to4cs[ 48], "0300", 4);  memcpy (gv_local.conv2to4cs[ 49], "0301", 4);
-  memcpy (gv_local.conv2to4cs[ 50], "0302", 4);  memcpy (gv_local.conv2to4cs[ 51], "0303", 4);
-  memcpy (gv_local.conv2to4cs[ 52], "0310", 4);  memcpy (gv_local.conv2to4cs[ 53], "0311", 4);
-  memcpy (gv_local.conv2to4cs[ 54], "0312", 4);  memcpy (gv_local.conv2to4cs[ 55], "0313", 4);
-  memcpy (gv_local.conv2to4cs[ 56], "0320", 4);  memcpy (gv_local.conv2to4cs[ 57], "0321", 4);
-  memcpy (gv_local.conv2to4cs[ 58], "0322", 4);  memcpy (gv_local.conv2to4cs[ 59], "0323", 4);
-  memcpy (gv_local.conv2to4cs[ 60], "0330", 4);  memcpy (gv_local.conv2to4cs[ 61], "0331", 4);
-  memcpy (gv_local.conv2to4cs[ 62], "0332", 4);  memcpy (gv_local.conv2to4cs[ 63], "0333", 4);
-  memcpy (gv_local.conv2to4cs[ 64], "1000", 4);  memcpy (gv_local.conv2to4cs[ 65], "1001", 4);
-  memcpy (gv_local.conv2to4cs[ 66], "1002", 4);  memcpy (gv_local.conv2to4cs[ 67], "1003", 4);
-  memcpy (gv_local.conv2to4cs[ 68], "1010", 4);  memcpy (gv_local.conv2to4cs[ 69], "1011", 4);
-  memcpy (gv_local.conv2to4cs[ 70], "1012", 4);  memcpy (gv_local.conv2to4cs[ 71], "1013", 4);
-  memcpy (gv_local.conv2to4cs[ 72], "1020", 4);  memcpy (gv_local.conv2to4cs[ 73], "1021", 4);
-  memcpy (gv_local.conv2to4cs[ 74], "1022", 4);  memcpy (gv_local.conv2to4cs[ 75], "1023", 4);
-  memcpy (gv_local.conv2to4cs[ 76], "1030", 4);  memcpy (gv_local.conv2to4cs[ 77], "1031", 4);
-  memcpy (gv_local.conv2to4cs[ 78], "1032", 4);  memcpy (gv_local.conv2to4cs[ 79], "1033", 4);
-  memcpy (gv_local.conv2to4cs[ 80], "1100", 4);  memcpy (gv_local.conv2to4cs[ 81], "1101", 4);
-  memcpy (gv_local.conv2to4cs[ 82], "1102", 4);  memcpy (gv_local.conv2to4cs[ 83], "1103", 4);
-  memcpy (gv_local.conv2to4cs[ 84], "1110", 4);  memcpy (gv_local.conv2to4cs[ 85], "1111", 4);
-  memcpy (gv_local.conv2to4cs[ 86], "1112", 4);  memcpy (gv_local.conv2to4cs[ 87], "1113", 4);
-  memcpy (gv_local.conv2to4cs[ 88], "1120", 4);  memcpy (gv_local.conv2to4cs[ 89], "1121", 4);
-  memcpy (gv_local.conv2to4cs[ 90], "1122", 4);  memcpy (gv_local.conv2to4cs[ 91], "1123", 4);
-  memcpy (gv_local.conv2to4cs[ 92], "1130", 4);  memcpy (gv_local.conv2to4cs[ 93], "1131", 4);
-  memcpy (gv_local.conv2to4cs[ 94], "1132", 4);  memcpy (gv_local.conv2to4cs[ 95], "1133", 4);
-  memcpy (gv_local.conv2to4cs[ 96], "1200", 4);  memcpy (gv_local.conv2to4cs[ 97], "1201", 4);
-  memcpy (gv_local.conv2to4cs[ 98], "1202", 4);  memcpy (gv_local.conv2to4cs[ 99], "1203", 4);
-  memcpy (gv_local.conv2to4cs[100], "1210", 4);  memcpy (gv_local.conv2to4cs[101], "1211", 4);
-  memcpy (gv_local.conv2to4cs[102], "1212", 4);  memcpy (gv_local.conv2to4cs[103], "1213", 4);
-  memcpy (gv_local.conv2to4cs[104], "1220", 4);  memcpy (gv_local.conv2to4cs[105], "1221", 4);
-  memcpy (gv_local.conv2to4cs[106], "1222", 4);  memcpy (gv_local.conv2to4cs[107], "1223", 4);
-  memcpy (gv_local.conv2to4cs[108], "1230", 4);  memcpy (gv_local.conv2to4cs[109], "1231", 4);
-  memcpy (gv_local.conv2to4cs[110], "1232", 4);  memcpy (gv_local.conv2to4cs[111], "1233", 4);
-  memcpy (gv_local.conv2to4cs[112], "1300", 4);  memcpy (gv_local.conv2to4cs[113], "1301", 4);
-  memcpy (gv_local.conv2to4cs[114], "1302", 4);  memcpy (gv_local.conv2to4cs[115], "1303", 4);
-  memcpy (gv_local.conv2to4cs[116], "1310", 4);  memcpy (gv_local.conv2to4cs[117], "1311", 4);
-  memcpy (gv_local.conv2to4cs[118], "1312", 4);  memcpy (gv_local.conv2to4cs[119], "1313", 4);
-  memcpy (gv_local.conv2to4cs[120], "1320", 4);  memcpy (gv_local.conv2to4cs[121], "1321", 4);
-  memcpy (gv_local.conv2to4cs[122], "1322", 4);  memcpy (gv_local.conv2to4cs[123], "1323", 4);
-  memcpy (gv_local.conv2to4cs[124], "1330", 4);  memcpy (gv_local.conv2to4cs[125], "1331", 4);
-  memcpy (gv_local.conv2to4cs[126], "1332", 4);  memcpy (gv_local.conv2to4cs[127], "1333", 4);
-  memcpy (gv_local.conv2to4cs[128], "2000", 4);  memcpy (gv_local.conv2to4cs[129], "2001", 4);
-  memcpy (gv_local.conv2to4cs[130], "2002", 4);  memcpy (gv_local.conv2to4cs[131], "2003", 4);
-  memcpy (gv_local.conv2to4cs[132], "2010", 4);  memcpy (gv_local.conv2to4cs[133], "2011", 4);
-  memcpy (gv_local.conv2to4cs[134], "2012", 4);  memcpy (gv_local.conv2to4cs[135], "2013", 4);
-  memcpy (gv_local.conv2to4cs[136], "2020", 4);  memcpy (gv_local.conv2to4cs[137], "2021", 4);
-  memcpy (gv_local.conv2to4cs[138], "2022", 4);  memcpy (gv_local.conv2to4cs[139], "2023", 4);
-  memcpy (gv_local.conv2to4cs[140], "2030", 4);  memcpy (gv_local.conv2to4cs[141], "2031", 4);
-  memcpy (gv_local.conv2to4cs[142], "2032", 4);  memcpy (gv_local.conv2to4cs[143], "2033", 4);
-  memcpy (gv_local.conv2to4cs[144], "2100", 4);  memcpy (gv_local.conv2to4cs[145], "2101", 4);
-  memcpy (gv_local.conv2to4cs[146], "2102", 4);  memcpy (gv_local.conv2to4cs[147], "2103", 4);
-  memcpy (gv_local.conv2to4cs[148], "2110", 4);  memcpy (gv_local.conv2to4cs[149], "2111", 4);
-  memcpy (gv_local.conv2to4cs[150], "2112", 4);  memcpy (gv_local.conv2to4cs[151], "2113", 4);
-  memcpy (gv_local.conv2to4cs[152], "2120", 4);  memcpy (gv_local.conv2to4cs[153], "2121", 4);
-  memcpy (gv_local.conv2to4cs[154], "2122", 4);  memcpy (gv_local.conv2to4cs[155], "2123", 4);
-  memcpy (gv_local.conv2to4cs[156], "2130", 4);  memcpy (gv_local.conv2to4cs[157], "2131", 4);
-  memcpy (gv_local.conv2to4cs[158], "2132", 4);  memcpy (gv_local.conv2to4cs[159], "2133", 4);
-  memcpy (gv_local.conv2to4cs[160], "2200", 4);  memcpy (gv_local.conv2to4cs[161], "2201", 4);
-  memcpy (gv_local.conv2to4cs[162], "2202", 4);  memcpy (gv_local.conv2to4cs[163], "2203", 4);
-  memcpy (gv_local.conv2to4cs[164], "2210", 4);  memcpy (gv_local.conv2to4cs[165], "2211", 4);
-  memcpy (gv_local.conv2to4cs[166], "2212", 4);  memcpy (gv_local.conv2to4cs[167], "2213", 4);
-  memcpy (gv_local.conv2to4cs[168], "2220", 4);  memcpy (gv_local.conv2to4cs[169], "2221", 4);
-  memcpy (gv_local.conv2to4cs[170], "2222", 4);  memcpy (gv_local.conv2to4cs[171], "2223", 4);
-  memcpy (gv_local.conv2to4cs[172], "2230", 4);  memcpy (gv_local.conv2to4cs[173], "2231", 4);
-  memcpy (gv_local.conv2to4cs[174], "2232", 4);  memcpy (gv_local.conv2to4cs[175], "2233", 4);
-  memcpy (gv_local.conv2to4cs[176], "2300", 4);  memcpy (gv_local.conv2to4cs[177], "2301", 4);
-  memcpy (gv_local.conv2to4cs[178], "2302", 4);  memcpy (gv_local.conv2to4cs[179], "2303", 4);
-  memcpy (gv_local.conv2to4cs[180], "2310", 4);  memcpy (gv_local.conv2to4cs[181], "2311", 4);
-  memcpy (gv_local.conv2to4cs[182], "2312", 4);  memcpy (gv_local.conv2to4cs[183], "2313", 4);
-  memcpy (gv_local.conv2to4cs[184], "2320", 4);  memcpy (gv_local.conv2to4cs[185], "2321", 4);
-  memcpy (gv_local.conv2to4cs[186], "2322", 4);  memcpy (gv_local.conv2to4cs[187], "2323", 4);
-  memcpy (gv_local.conv2to4cs[188], "2330", 4);  memcpy (gv_local.conv2to4cs[189], "2331", 4);
-  memcpy (gv_local.conv2to4cs[190], "2332", 4);  memcpy (gv_local.conv2to4cs[191], "2333", 4);
-  memcpy (gv_local.conv2to4cs[192], "3000", 4);  memcpy (gv_local.conv2to4cs[193], "3001", 4);
-  memcpy (gv_local.conv2to4cs[194], "3002", 4);  memcpy (gv_local.conv2to4cs[195], "3003", 4);
-  memcpy (gv_local.conv2to4cs[196], "3010", 4);  memcpy (gv_local.conv2to4cs[197], "3011", 4);
-  memcpy (gv_local.conv2to4cs[198], "3012", 4);  memcpy (gv_local.conv2to4cs[199], "3013", 4);
-  memcpy (gv_local.conv2to4cs[200], "3020", 4);  memcpy (gv_local.conv2to4cs[201], "3021", 4);
-  memcpy (gv_local.conv2to4cs[202], "3022", 4);  memcpy (gv_local.conv2to4cs[203], "3023", 4);
-  memcpy (gv_local.conv2to4cs[204], "3030", 4);  memcpy (gv_local.conv2to4cs[205], "3031", 4);
-  memcpy (gv_local.conv2to4cs[206], "3032", 4);  memcpy (gv_local.conv2to4cs[207], "3033", 4);
-  memcpy (gv_local.conv2to4cs[208], "3100", 4);  memcpy (gv_local.conv2to4cs[209], "3101", 4);
-  memcpy (gv_local.conv2to4cs[210], "3102", 4);  memcpy (gv_local.conv2to4cs[211], "3103", 4);
-  memcpy (gv_local.conv2to4cs[212], "3110", 4);  memcpy (gv_local.conv2to4cs[213], "3111", 4);
-  memcpy (gv_local.conv2to4cs[214], "3112", 4);  memcpy (gv_local.conv2to4cs[215], "3113", 4);
-  memcpy (gv_local.conv2to4cs[216], "3120", 4);  memcpy (gv_local.conv2to4cs[217], "3121", 4);
-  memcpy (gv_local.conv2to4cs[218], "3122", 4);  memcpy (gv_local.conv2to4cs[219], "3123", 4);
-  memcpy (gv_local.conv2to4cs[220], "3130", 4);  memcpy (gv_local.conv2to4cs[221], "3131", 4);
-  memcpy (gv_local.conv2to4cs[222], "3132", 4);  memcpy (gv_local.conv2to4cs[223], "3133", 4);
-  memcpy (gv_local.conv2to4cs[224], "3200", 4);  memcpy (gv_local.conv2to4cs[225], "3201", 4);
-  memcpy (gv_local.conv2to4cs[226], "3202", 4);  memcpy (gv_local.conv2to4cs[227], "3203", 4);
-  memcpy (gv_local.conv2to4cs[228], "3210", 4);  memcpy (gv_local.conv2to4cs[229], "3211", 4);
-  memcpy (gv_local.conv2to4cs[230], "3212", 4);  memcpy (gv_local.conv2to4cs[231], "3213", 4);
-  memcpy (gv_local.conv2to4cs[232], "3220", 4);  memcpy (gv_local.conv2to4cs[233], "3221", 4);
-  memcpy (gv_local.conv2to4cs[234], "3222", 4);  memcpy (gv_local.conv2to4cs[235], "3223", 4);
-  memcpy (gv_local.conv2to4cs[236], "3230", 4);  memcpy (gv_local.conv2to4cs[237], "3231", 4);
-  memcpy (gv_local.conv2to4cs[238], "3232", 4);  memcpy (gv_local.conv2to4cs[239], "3233", 4);
-  memcpy (gv_local.conv2to4cs[240], "3300", 4);  memcpy (gv_local.conv2to4cs[241], "3301", 4);
-  memcpy (gv_local.conv2to4cs[242], "3302", 4);  memcpy (gv_local.conv2to4cs[243], "3303", 4);
-  memcpy (gv_local.conv2to4cs[244], "3310", 4);  memcpy (gv_local.conv2to4cs[245], "3311", 4);
-  memcpy (gv_local.conv2to4cs[246], "3312", 4);  memcpy (gv_local.conv2to4cs[247], "3313", 4);
-  memcpy (gv_local.conv2to4cs[248], "3320", 4);  memcpy (gv_local.conv2to4cs[249], "3321", 4);
-  memcpy (gv_local.conv2to4cs[250], "3322", 4);  memcpy (gv_local.conv2to4cs[251], "3323", 4);
-  memcpy (gv_local.conv2to4cs[252], "3330", 4);  memcpy (gv_local.conv2to4cs[253], "3331", 4);
-  memcpy (gv_local.conv2to4cs[254], "3332", 4);  memcpy (gv_local.conv2to4cs[255], "3333", 4);
-  gv_local.lookup_454_seq_initialized = 1;
-}
-/*
- */
-static void _s_init_pos_454_default (void)
-{
-  memset (gv_local.lookup_454_pos, 0, sizeof(SRALookup)*POS_454_HUFF_TREESIZE);
-
-  gv_local.lookup_454_pos[  0].nbits =  2; gv_local.lookup_454_pos[  0].bits = 0xC0000000;
-  gv_local.lookup_454_pos[  1].nbits =  3; gv_local.lookup_454_pos[  1].bits = 0x20000000;
-  gv_local.lookup_454_pos[  2].nbits =  2; gv_local.lookup_454_pos[  2].bits = 0x40000000;
-  gv_local.lookup_454_pos[  3].nbits =  2; gv_local.lookup_454_pos[  3].bits = 0x80000000;
-  gv_local.lookup_454_pos[  4].nbits =  4; gv_local.lookup_454_pos[  4].bits = 0x10000000;
-  gv_local.lookup_454_pos[  5].nbits =  6; gv_local.lookup_454_pos[  5].bits = 0x04000000;
-  gv_local.lookup_454_pos[  6].nbits = 11; gv_local.lookup_454_pos[  6].bits = 0x0E400000;
-  gv_local.lookup_454_pos[  7].nbits =  8; gv_local.lookup_454_pos[  7].bits = 0x0F000000;
-  gv_local.lookup_454_pos[  8].nbits =  7; gv_local.lookup_454_pos[  8].bits = 0x0C000000;
-  gv_local.lookup_454_pos[  9].nbits =  9; gv_local.lookup_454_pos[  9].bits = 0x08800000;
-  gv_local.lookup_454_pos[ 10].nbits = 12; gv_local.lookup_454_pos[ 10].bits = 0x0A000000;
-  gv_local.lookup_454_pos[ 11].nbits =  6; gv_local.lookup_454_pos[ 11].bits = 0x00000000;
-  gv_local.lookup_454_pos[ 12].nbits =  8; gv_local.lookup_454_pos[ 12].bits = 0x09000000;
-  gv_local.lookup_454_pos[ 13].nbits = 11; gv_local.lookup_454_pos[ 13].bits = 0x0AC00000;
-  gv_local.lookup_454_pos[ 14].nbits = 14; gv_local.lookup_454_pos[ 14].bits = 0x0E240000;
-  gv_local.lookup_454_pos[ 15].nbits =  9; gv_local.lookup_454_pos[ 15].bits = 0x0E800000;
-  gv_local.lookup_454_pos[ 16].nbits =  9; gv_local.lookup_454_pos[ 16].bits = 0x0B000000;
-  gv_local.lookup_454_pos[ 17].nbits = 12; gv_local.lookup_454_pos[ 17].bits = 0x0A300000;
-  gv_local.lookup_454_pos[ 18].nbits = 13; gv_local.lookup_454_pos[ 18].bits = 0x08580000;
-  gv_local.lookup_454_pos[ 19].nbits = 12; gv_local.lookup_454_pos[ 19].bits = 0x0E600000;
-  gv_local.lookup_454_pos[ 20].nbits = 10; gv_local.lookup_454_pos[ 20].bits = 0x0B800000;
-  gv_local.lookup_454_pos[ 21].nbits = 13; gv_local.lookup_454_pos[ 21].bits = 0x08400000;
-  gv_local.lookup_454_pos[ 22].nbits = 14; gv_local.lookup_454_pos[ 22].bits = 0x08540000;
-  gv_local.lookup_454_pos[ 23].nbits = 13; gv_local.lookup_454_pos[ 23].bits = 0x0E280000;
-  gv_local.lookup_454_pos[ 24].nbits = 10; gv_local.lookup_454_pos[ 24].bits = 0x0A400000;
-  gv_local.lookup_454_pos[ 25].nbits = 13; gv_local.lookup_454_pos[ 25].bits = 0x0E000000;
-  gv_local.lookup_454_pos[ 26].nbits = 14; gv_local.lookup_454_pos[ 26].bits = 0x0E180000;
-  gv_local.lookup_454_pos[ 27].nbits = 13; gv_local.lookup_454_pos[ 27].bits = 0x0E380000;
-  gv_local.lookup_454_pos[ 28].nbits = 10; gv_local.lookup_454_pos[ 28].bits = 0x08000000;
-  gv_local.lookup_454_pos[ 29].nbits = 14; gv_local.lookup_454_pos[ 29].bits = 0x0E0C0000;
-  gv_local.lookup_454_pos[ 30].nbits = 15; gv_local.lookup_454_pos[ 30].bits = 0x0AB40000;
-  gv_local.lookup_454_pos[ 31].nbits = 13; gv_local.lookup_454_pos[ 31].bits = 0x0AA00000;
-  gv_local.lookup_454_pos[ 32].nbits = 11; gv_local.lookup_454_pos[ 32].bits = 0x0A800000;
-  gv_local.lookup_454_pos[ 33].nbits = 14; gv_local.lookup_454_pos[ 33].bits = 0x084C0000;
-  gv_local.lookup_454_pos[ 34].nbits = 16; gv_local.lookup_454_pos[ 34].bits = 0x0AB60000;
-  gv_local.lookup_454_pos[ 35].nbits = 14; gv_local.lookup_454_pos[ 35].bits = 0x0E200000;
-  gv_local.lookup_454_pos[ 36].nbits = 12; gv_local.lookup_454_pos[ 36].bits = 0x0E700000;
-  gv_local.lookup_454_pos[ 37].nbits = 14; gv_local.lookup_454_pos[ 37].bits = 0x0ABC0000;
-  gv_local.lookup_454_pos[ 38].nbits = 15; gv_local.lookup_454_pos[ 38].bits = 0x0E080000;
-  gv_local.lookup_454_pos[ 39].nbits = 13; gv_local.lookup_454_pos[ 39].bits = 0x0AA80000;
-  gv_local.lookup_454_pos[ 40].nbits = 11; gv_local.lookup_454_pos[ 40].bits = 0x08600000;
-  gv_local.lookup_454_pos[ 41].nbits = 14; gv_local.lookup_454_pos[ 41].bits = 0x0AB00000;
-  gv_local.lookup_454_pos[ 42].nbits = 16; gv_local.lookup_454_pos[ 42].bits = 0x0E1E0000;
-  gv_local.lookup_454_pos[ 43].nbits = 14; gv_local.lookup_454_pos[ 43].bits = 0x08500000;
-  gv_local.lookup_454_pos[ 44].nbits = 12; gv_local.lookup_454_pos[ 44].bits = 0x0AF00000;
-  gv_local.lookup_454_pos[ 45].nbits = 14; gv_local.lookup_454_pos[ 45].bits = 0x0A1C0000;
-  gv_local.lookup_454_pos[ 46].nbits = 14; gv_local.lookup_454_pos[ 46].bits = 0x08480000;
-  gv_local.lookup_454_pos[ 47].nbits = 13; gv_local.lookup_454_pos[ 47].bits = 0x0E300000;
-  gv_local.lookup_454_pos[ 48].nbits = 12; gv_local.lookup_454_pos[ 48].bits = 0x0AE00000;
-  gv_local.lookup_454_pos[ 49].nbits = 14; gv_local.lookup_454_pos[ 49].bits = 0x0AB80000;
-  gv_local.lookup_454_pos[ 50].nbits = 16; gv_local.lookup_454_pos[ 50].bits = 0x0A1B0000;
-  gv_local.lookup_454_pos[ 51].nbits = 15; gv_local.lookup_454_pos[ 51].bits = 0x0A180000;
-  gv_local.lookup_454_pos[ 52].nbits = 12; gv_local.lookup_454_pos[ 52].bits = 0x0A200000;
-  gv_local.lookup_454_pos[ 53].nbits = 15; gv_local.lookup_454_pos[ 53].bits = 0x0E1C0000;
-  gv_local.lookup_454_pos[ 54].nbits = 16; gv_local.lookup_454_pos[ 54].bits = 0x0A1A0000;
-  gv_local.lookup_454_pos[ 55].nbits = 16; gv_local.lookup_454_pos[ 55].bits = 0x0E1F0000;
-  gv_local.lookup_454_pos[ 56].nbits = 13; gv_local.lookup_454_pos[ 56].bits = 0x0E100000;
-  gv_local.lookup_454_pos[ 57].nbits = 17; gv_local.lookup_454_pos[ 57].bits = 0x0AB78000;
-  gv_local.lookup_454_pos[ 58].nbits = 18; gv_local.lookup_454_pos[ 58].bits = 0x0AB70000;
-  gv_local.lookup_454_pos[ 59].nbits = 15; gv_local.lookup_454_pos[ 59].bits = 0x0E0A0000;
-  gv_local.lookup_454_pos[ 60].nbits = 13; gv_local.lookup_454_pos[ 60].bits = 0x0A100000;
-  gv_local.lookup_454_pos[ 61].nbits = 19; gv_local.lookup_454_pos[ 61].bits = 0x0AB76000;
-  gv_local.lookup_454_pos[ 62].nbits = 19; gv_local.lookup_454_pos[ 62].bits = 0x0AB74000;
-  gv_local.lookup_454_pos[ 63].nbits = 10; gv_local.lookup_454_pos[ 63].bits = 0x0BC00000;
-
-  _s_sort_lookup (gv_local.lookup_454_pos, gv_local.idx_454_pos, POS_454_HUFF_TREESIZE);
-
-  gv_local.lookup_454_pos_initialized = 1;
-}
-/*
- */
-static void _s_init_prb_454_default (void)
-{
-#if SRA_DECOMPRESS_USE_REVERSE_LOOKUP
-  int      i, j;
-  uint16_t val;
-#endif
-
-  memset (gv_local.lookup_454_prb, 0, sizeof(SRALookup)*PRB_454_HUFF_TREESIZE);
-  
-  gv_local.lookup_454_prb[  0].nbits = 10; gv_local.lookup_454_prb[  0].bits = 0xA0400000;
-  gv_local.lookup_454_prb[  1].nbits =  9; gv_local.lookup_454_prb[  1].bits = 0xA0800000;
-  gv_local.lookup_454_prb[  2].nbits =  9; gv_local.lookup_454_prb[  2].bits = 0xA8800000;
-  gv_local.lookup_454_prb[  3].nbits =  9; gv_local.lookup_454_prb[  3].bits = 0xA8000000;
-  gv_local.lookup_454_prb[  4].nbits =  9; gv_local.lookup_454_prb[  4].bits = 0xDA000000;
-  gv_local.lookup_454_prb[  5].nbits =  9; gv_local.lookup_454_prb[  5].bits = 0xDA800000;
-  gv_local.lookup_454_prb[  6].nbits =  8; gv_local.lookup_454_prb[  6].bits = 0xA4000000;
-  gv_local.lookup_454_prb[  7].nbits =  8; gv_local.lookup_454_prb[  7].bits = 0xBA000000;
-  gv_local.lookup_454_prb[  8].nbits =  8; gv_local.lookup_454_prb[  8].bits = 0xA5000000;
-  gv_local.lookup_454_prb[  9].nbits =  8; gv_local.lookup_454_prb[  9].bits = 0xD4000000;
-  gv_local.lookup_454_prb[ 10].nbits =  8; gv_local.lookup_454_prb[ 10].bits = 0xA9000000;
-  gv_local.lookup_454_prb[ 11].nbits =  8; gv_local.lookup_454_prb[ 11].bits = 0xBB000000;
-  gv_local.lookup_454_prb[ 12].nbits =  8; gv_local.lookup_454_prb[ 12].bits = 0xDB000000;
-  gv_local.lookup_454_prb[ 13].nbits =  8; gv_local.lookup_454_prb[ 13].bits = 0xD5000000;
-  gv_local.lookup_454_prb[ 14].nbits =  7; gv_local.lookup_454_prb[ 14].bits = 0x2A000000;
-  gv_local.lookup_454_prb[ 15].nbits =  7; gv_local.lookup_454_prb[ 15].bits = 0xD0000000;
-  gv_local.lookup_454_prb[ 16].nbits =  7; gv_local.lookup_454_prb[ 16].bits = 0xD6000000;
-  gv_local.lookup_454_prb[ 17].nbits =  6; gv_local.lookup_454_prb[ 17].bits = 0xAC000000;
-  gv_local.lookup_454_prb[ 18].nbits =  7; gv_local.lookup_454_prb[ 18].bits = 0xAA000000;
-  gv_local.lookup_454_prb[ 19].nbits =  7; gv_local.lookup_454_prb[ 19].bits = 0xA2000000;
-  gv_local.lookup_454_prb[ 20].nbits =  6; gv_local.lookup_454_prb[ 20].bits = 0x80000000;
-  gv_local.lookup_454_prb[ 21].nbits =  6; gv_local.lookup_454_prb[ 21].bits = 0x84000000;
-  gv_local.lookup_454_prb[ 22].nbits =  6; gv_local.lookup_454_prb[ 22].bits = 0xBC000000;
-  gv_local.lookup_454_prb[ 23].nbits =  5; gv_local.lookup_454_prb[ 23].bits = 0x88000000;
-  gv_local.lookup_454_prb[ 24].nbits =  5; gv_local.lookup_454_prb[ 24].bits = 0xB0000000;
-  gv_local.lookup_454_prb[ 25].nbits =  4; gv_local.lookup_454_prb[ 25].bits = 0x90000000;
-  gv_local.lookup_454_prb[ 26].nbits =  3; gv_local.lookup_454_prb[ 26].bits = 0x00000000;
-  gv_local.lookup_454_prb[ 27].nbits =  2; gv_local.lookup_454_prb[ 27].bits = 0x40000000;
-  gv_local.lookup_454_prb[ 28].nbits =  3; gv_local.lookup_454_prb[ 28].bits = 0xE0000000;
-  gv_local.lookup_454_prb[ 29].nbits =  8; gv_local.lookup_454_prb[ 29].bits = 0xA1000000;
-  gv_local.lookup_454_prb[ 30].nbits =  7; gv_local.lookup_454_prb[ 30].bits = 0xD2000000;
-  gv_local.lookup_454_prb[ 31].nbits =  6; gv_local.lookup_454_prb[ 31].bits = 0x2C000000;
-  gv_local.lookup_454_prb[ 32].nbits =  5; gv_local.lookup_454_prb[ 32].bits = 0x20000000;
-  gv_local.lookup_454_prb[ 33].nbits =  4; gv_local.lookup_454_prb[ 33].bits = 0x30000000;
-  gv_local.lookup_454_prb[ 34].nbits =  4; gv_local.lookup_454_prb[ 34].bits = 0xC0000000;
-  gv_local.lookup_454_prb[ 35].nbits =  7; gv_local.lookup_454_prb[ 35].bits = 0xD8000000;
-  gv_local.lookup_454_prb[ 36].nbits =  7; gv_local.lookup_454_prb[ 36].bits = 0xB8000000;
-  gv_local.lookup_454_prb[ 37].nbits =  6; gv_local.lookup_454_prb[ 37].bits = 0xDC000000;
-  gv_local.lookup_454_prb[ 38].nbits =  7; gv_local.lookup_454_prb[ 38].bits = 0x28000000;
-  gv_local.lookup_454_prb[ 39].nbits =  7; gv_local.lookup_454_prb[ 39].bits = 0xA6000000;
-  gv_local.lookup_454_prb[ 40].nbits = 15; gv_local.lookup_454_prb[ 40].bits = 0xA0000000;
-  gv_local.lookup_454_prb[ 41].nbits = 14; gv_local.lookup_454_prb[ 41].bits = 0xA03C0000;
-  gv_local.lookup_454_prb[ 42].nbits = 16; gv_local.lookup_454_prb[ 42].bits = 0xA0030000;
-  gv_local.lookup_454_prb[ 43].nbits = 16; gv_local.lookup_454_prb[ 43].bits = 0xA0020000;
-  gv_local.lookup_454_prb[ 44].nbits = 16; gv_local.lookup_454_prb[ 44].bits = 0xA0390000;
-  gv_local.lookup_454_prb[ 45].nbits = 16; gv_local.lookup_454_prb[ 45].bits = 0xA0380000;
-  gv_local.lookup_454_prb[ 46].nbits = 16; gv_local.lookup_454_prb[ 46].bits = 0xA03B0000;
-  gv_local.lookup_454_prb[ 47].nbits = 16; gv_local.lookup_454_prb[ 47].bits = 0xA03A0000;
-  gv_local.lookup_454_prb[ 48].nbits = 16; gv_local.lookup_454_prb[ 48].bits = 0xA00D0000;
-  gv_local.lookup_454_prb[ 49].nbits = 16; gv_local.lookup_454_prb[ 49].bits = 0xA00C0000;
-  gv_local.lookup_454_prb[ 50].nbits = 16; gv_local.lookup_454_prb[ 50].bits = 0xA00F0000;
-  gv_local.lookup_454_prb[ 51].nbits = 16; gv_local.lookup_454_prb[ 51].bits = 0xA00E0000;
-  gv_local.lookup_454_prb[ 52].nbits = 16; gv_local.lookup_454_prb[ 52].bits = 0xA0090000;
-  gv_local.lookup_454_prb[ 53].nbits = 16; gv_local.lookup_454_prb[ 53].bits = 0xA0080000;
-  gv_local.lookup_454_prb[ 54].nbits = 16; gv_local.lookup_454_prb[ 54].bits = 0xA00B0000;
-  gv_local.lookup_454_prb[ 55].nbits = 16; gv_local.lookup_454_prb[ 55].bits = 0xA00A0000;
-  gv_local.lookup_454_prb[ 56].nbits = 16; gv_local.lookup_454_prb[ 56].bits = 0xA0250000;
-  gv_local.lookup_454_prb[ 57].nbits = 16; gv_local.lookup_454_prb[ 57].bits = 0xA0240000;
-  gv_local.lookup_454_prb[ 58].nbits = 16; gv_local.lookup_454_prb[ 58].bits = 0xA0270000;
-  gv_local.lookup_454_prb[ 59].nbits = 16; gv_local.lookup_454_prb[ 59].bits = 0xA0260000;
-  gv_local.lookup_454_prb[ 60].nbits = 16; gv_local.lookup_454_prb[ 60].bits = 0xA0210000;
-  gv_local.lookup_454_prb[ 61].nbits = 16; gv_local.lookup_454_prb[ 61].bits = 0xA0200000;
-  gv_local.lookup_454_prb[ 62].nbits = 16; gv_local.lookup_454_prb[ 62].bits = 0xA0230000;
-  gv_local.lookup_454_prb[ 63].nbits = 16; gv_local.lookup_454_prb[ 63].bits = 0xA0220000;
-  gv_local.lookup_454_prb[ 64].nbits = 16; gv_local.lookup_454_prb[ 64].bits = 0xA02D0000;
-  gv_local.lookup_454_prb[ 65].nbits = 16; gv_local.lookup_454_prb[ 65].bits = 0xA02C0000;
-  gv_local.lookup_454_prb[ 66].nbits = 16; gv_local.lookup_454_prb[ 66].bits = 0xA02F0000;
-  gv_local.lookup_454_prb[ 67].nbits = 16; gv_local.lookup_454_prb[ 67].bits = 0xA02E0000;
-  gv_local.lookup_454_prb[ 68].nbits = 16; gv_local.lookup_454_prb[ 68].bits = 0xA0290000;
-  gv_local.lookup_454_prb[ 69].nbits = 16; gv_local.lookup_454_prb[ 69].bits = 0xA0280000;
-  gv_local.lookup_454_prb[ 70].nbits = 16; gv_local.lookup_454_prb[ 70].bits = 0xA02B0000;
-  gv_local.lookup_454_prb[ 71].nbits = 16; gv_local.lookup_454_prb[ 71].bits = 0xA02A0000;
-  gv_local.lookup_454_prb[ 72].nbits = 16; gv_local.lookup_454_prb[ 72].bits = 0xA0150000;
-  gv_local.lookup_454_prb[ 73].nbits = 16; gv_local.lookup_454_prb[ 73].bits = 0xA0140000;
-  gv_local.lookup_454_prb[ 74].nbits = 16; gv_local.lookup_454_prb[ 74].bits = 0xA0170000;
-  gv_local.lookup_454_prb[ 75].nbits = 16; gv_local.lookup_454_prb[ 75].bits = 0xA0160000;
-  gv_local.lookup_454_prb[ 76].nbits = 16; gv_local.lookup_454_prb[ 76].bits = 0xA0110000;
-  gv_local.lookup_454_prb[ 77].nbits = 16; gv_local.lookup_454_prb[ 77].bits = 0xA0100000;
-  gv_local.lookup_454_prb[ 78].nbits = 16; gv_local.lookup_454_prb[ 78].bits = 0xA0130000;
-  gv_local.lookup_454_prb[ 79].nbits = 16; gv_local.lookup_454_prb[ 79].bits = 0xA0120000;
-  gv_local.lookup_454_prb[ 80].nbits = 16; gv_local.lookup_454_prb[ 80].bits = 0xA01D0000;
-  gv_local.lookup_454_prb[ 81].nbits = 16; gv_local.lookup_454_prb[ 81].bits = 0xA01C0000;
-  gv_local.lookup_454_prb[ 82].nbits = 16; gv_local.lookup_454_prb[ 82].bits = 0xA01F0000;
-  gv_local.lookup_454_prb[ 83].nbits = 16; gv_local.lookup_454_prb[ 83].bits = 0xA01E0000;
-  gv_local.lookup_454_prb[ 84].nbits = 16; gv_local.lookup_454_prb[ 84].bits = 0xA0190000;
-  gv_local.lookup_454_prb[ 85].nbits = 16; gv_local.lookup_454_prb[ 85].bits = 0xA0180000;
-  gv_local.lookup_454_prb[ 86].nbits = 16; gv_local.lookup_454_prb[ 86].bits = 0xA01B0000;
-  gv_local.lookup_454_prb[ 87].nbits = 16; gv_local.lookup_454_prb[ 87].bits = 0xA01A0000;
-  gv_local.lookup_454_prb[ 88].nbits = 16; gv_local.lookup_454_prb[ 88].bits = 0xA0350000;
-  gv_local.lookup_454_prb[ 89].nbits = 16; gv_local.lookup_454_prb[ 89].bits = 0xA0340000;
-  gv_local.lookup_454_prb[ 90].nbits = 16; gv_local.lookup_454_prb[ 90].bits = 0xA0370000;
-  gv_local.lookup_454_prb[ 91].nbits = 16; gv_local.lookup_454_prb[ 91].bits = 0xA0360000;
-  gv_local.lookup_454_prb[ 92].nbits = 16; gv_local.lookup_454_prb[ 92].bits = 0xA0310000;
-  gv_local.lookup_454_prb[ 93].nbits = 16; gv_local.lookup_454_prb[ 93].bits = 0xA0300000;
-  gv_local.lookup_454_prb[ 94].nbits = 16; gv_local.lookup_454_prb[ 94].bits = 0xA0330000;
-  gv_local.lookup_454_prb[ 95].nbits = 16; gv_local.lookup_454_prb[ 95].bits = 0xA0320000;
-  gv_local.lookup_454_prb[ 96].nbits = 16; gv_local.lookup_454_prb[ 96].bits = 0xA0050000;
-  gv_local.lookup_454_prb[ 97].nbits = 16; gv_local.lookup_454_prb[ 97].bits = 0xA0040000;
-  gv_local.lookup_454_prb[ 98].nbits = 16; gv_local.lookup_454_prb[ 98].bits = 0xA0070000;
-  gv_local.lookup_454_prb[ 99].nbits = 16; gv_local.lookup_454_prb[ 99].bits = 0xA0060000;
-
-#if SRA_DECOMPRESS_USE_REVERSE_LOOKUP
-  /* reverse huffman lookup table
-   */
-  memset (gv_local.rlookup_454_prb, 0, sizeof(uint16_t)*REV_HUFF_TREESIZE_16);
-
-  for (i=0; i<PRB_454_HUFF_TREESIZE; i++)
-  {
-    val = gv_local.lookup_454_prb[i].bits >> 16;
-    gv_local.rlookup_454_prb [val] = (uint16_t) i;
-    for (j=1; j<=(0xFFFF>>gv_local.lookup_454_prb[i].nbits); j++)
-      gv_local.rlookup_454_prb [val+j] = (uint16_t) i;
-  }
-#endif
-  _s_sort_lookup (gv_local.lookup_454_prb, gv_local.idx_454_prb, PRB_454_HUFF_TREESIZE);
-
-  gv_local.lookup_454_prb_initialized = 1;
-}
-/*
- */
-static void _s_init_sig_454_default (void)
-{
-#if SRA_DECOMPRESS_USE_REVERSE_LOOKUP
-  int      i, j;
-  uint16_t val;
-#endif
-
-  memset (gv_local.lookup_454_sig, 0, sizeof(SRALookup)*SIG_HUFF_TREESIZE);
-
-  gv_local.lookup_454_sig[  0].nbits =  7; gv_local.lookup_454_sig[  0].bits = 0x8C000000;
-  gv_local.lookup_454_sig[  1].nbits =  8; gv_local.lookup_454_sig[  1].bits = 0x65000000;
-  gv_local.lookup_454_sig[  2].nbits =  8; gv_local.lookup_454_sig[  2].bits = 0xCA000000;
-  gv_local.lookup_454_sig[  3].nbits =  7; gv_local.lookup_454_sig[  3].bits = 0x5A000000;
-  gv_local.lookup_454_sig[  4].nbits =  7; gv_local.lookup_454_sig[  4].bits = 0xBC000000;
-  gv_local.lookup_454_sig[  5].nbits =  6; gv_local.lookup_454_sig[  5].bits = 0x48000000;
-  gv_local.lookup_454_sig[  6].nbits =  6; gv_local.lookup_454_sig[  6].bits = 0x98000000;
-  gv_local.lookup_454_sig[  7].nbits =  6; gv_local.lookup_454_sig[  7].bits = 0xFC000000;
-  gv_local.lookup_454_sig[  8].nbits =  5; gv_local.lookup_454_sig[  8].bits = 0x68000000;
-  gv_local.lookup_454_sig[  9].nbits =  5; gv_local.lookup_454_sig[  9].bits = 0xA8000000;
-  gv_local.lookup_454_sig[ 10].nbits =  5; gv_local.lookup_454_sig[ 10].bits = 0xE0000000;
-  gv_local.lookup_454_sig[ 11].nbits =  4; gv_local.lookup_454_sig[ 11].bits = 0x00000000;
-  gv_local.lookup_454_sig[ 12].nbits =  4; gv_local.lookup_454_sig[ 12].bits = 0x10000000;
-  gv_local.lookup_454_sig[ 13].nbits =  5; gv_local.lookup_454_sig[ 13].bits = 0xE8000000;
-  gv_local.lookup_454_sig[ 14].nbits =  5; gv_local.lookup_454_sig[ 14].bits = 0xC0000000;
-  gv_local.lookup_454_sig[ 15].nbits =  5; gv_local.lookup_454_sig[ 15].bits = 0x78000000;
-  gv_local.lookup_454_sig[ 16].nbits =  5; gv_local.lookup_454_sig[ 16].bits = 0x38000000;
-  gv_local.lookup_454_sig[ 17].nbits =  6; gv_local.lookup_454_sig[ 17].bits = 0xCC000000;
-  gv_local.lookup_454_sig[ 18].nbits =  6; gv_local.lookup_454_sig[ 18].bits = 0x80000000;
-  gv_local.lookup_454_sig[ 19].nbits =  6; gv_local.lookup_454_sig[ 19].bits = 0x4C000000;
-  gv_local.lookup_454_sig[ 20].nbits =  7; gv_local.lookup_454_sig[ 20].bits = 0xDE000000;
-  gv_local.lookup_454_sig[ 21].nbits =  7; gv_local.lookup_454_sig[ 21].bits = 0xB0000000;
-  gv_local.lookup_454_sig[ 22].nbits =  7; gv_local.lookup_454_sig[ 22].bits = 0x76000000;
-  gv_local.lookup_454_sig[ 23].nbits =  7; gv_local.lookup_454_sig[ 23].bits = 0x52000000;
-  gv_local.lookup_454_sig[ 24].nbits =  8; gv_local.lookup_454_sig[ 24].bits = 0xF4000000;
-  gv_local.lookup_454_sig[ 25].nbits =  8; gv_local.lookup_454_sig[ 25].bits = 0xBB000000;
-  gv_local.lookup_454_sig[ 26].nbits =  8; gv_local.lookup_454_sig[ 26].bits = 0x8F000000;
-  gv_local.lookup_454_sig[ 27].nbits =  8; gv_local.lookup_454_sig[ 27].bits = 0x64000000;
-  gv_local.lookup_454_sig[ 28].nbits =  8; gv_local.lookup_454_sig[ 28].bits = 0x31000000;
-  gv_local.lookup_454_sig[ 29].nbits =  9; gv_local.lookup_454_sig[ 29].bits = 0xDD000000;
-  gv_local.lookup_454_sig[ 30].nbits =  9; gv_local.lookup_454_sig[ 30].bits = 0xC8000000;
-  gv_local.lookup_454_sig[ 31].nbits =  9; gv_local.lookup_454_sig[ 31].bits = 0x95000000;
-  gv_local.lookup_454_sig[ 32].nbits =  9; gv_local.lookup_454_sig[ 32].bits = 0x74800000;
-  gv_local.lookup_454_sig[ 33].nbits =  9; gv_local.lookup_454_sig[ 33].bits = 0x57800000;
-  gv_local.lookup_454_sig[ 34].nbits =  9; gv_local.lookup_454_sig[ 34].bits = 0x30000000;
-  gv_local.lookup_454_sig[ 35].nbits = 10; gv_local.lookup_454_sig[ 35].bits = 0xF0C00000;
-  gv_local.lookup_454_sig[ 36].nbits = 10; gv_local.lookup_454_sig[ 36].bits = 0xCB000000;
-  gv_local.lookup_454_sig[ 37].nbits = 10; gv_local.lookup_454_sig[ 37].bits = 0xA5400000;
-  gv_local.lookup_454_sig[ 38].nbits = 10; gv_local.lookup_454_sig[ 38].bits = 0x8E000000;
-  gv_local.lookup_454_sig[ 39].nbits = 10; gv_local.lookup_454_sig[ 39].bits = 0x70C00000;
-  gv_local.lookup_454_sig[ 40].nbits = 10; gv_local.lookup_454_sig[ 40].bits = 0x56400000;
-  gv_local.lookup_454_sig[ 41].nbits = 10; gv_local.lookup_454_sig[ 41].bits = 0x30C00000;
-  gv_local.lookup_454_sig[ 42].nbits = 11; gv_local.lookup_454_sig[ 42].bits = 0xF5400000;
-  gv_local.lookup_454_sig[ 43].nbits = 11; gv_local.lookup_454_sig[ 43].bits = 0xD0600000;
-  gv_local.lookup_454_sig[ 44].nbits = 11; gv_local.lookup_454_sig[ 44].bits = 0xB3800000;
-  gv_local.lookup_454_sig[ 45].nbits = 11; gv_local.lookup_454_sig[ 45].bits = 0x97400000;
-  gv_local.lookup_454_sig[ 46].nbits = 11; gv_local.lookup_454_sig[ 46].bits = 0x86200000;
-  gv_local.lookup_454_sig[ 47].nbits = 11; gv_local.lookup_454_sig[ 47].bits = 0x70600000;
-  gv_local.lookup_454_sig[ 48].nbits = 11; gv_local.lookup_454_sig[ 48].bits = 0x66400000;
-  gv_local.lookup_454_sig[ 49].nbits = 11; gv_local.lookup_454_sig[ 49].bits = 0x5DE00000;
-  gv_local.lookup_454_sig[ 50].nbits = 12; gv_local.lookup_454_sig[ 50].bits = 0xF0000000;
-  gv_local.lookup_454_sig[ 51].nbits = 12; gv_local.lookup_454_sig[ 51].bits = 0x75000000;
-  gv_local.lookup_454_sig[ 52].nbits = 12; gv_local.lookup_454_sig[ 52].bits = 0x74500000;
-  gv_local.lookup_454_sig[ 53].nbits = 12; gv_local.lookup_454_sig[ 53].bits = 0x74200000;
-  gv_local.lookup_454_sig[ 54].nbits = 12; gv_local.lookup_454_sig[ 54].bits = 0x70A00000;
-  gv_local.lookup_454_sig[ 55].nbits = 12; gv_local.lookup_454_sig[ 55].bits = 0x70500000;
-  gv_local.lookup_454_sig[ 56].nbits = 12; gv_local.lookup_454_sig[ 56].bits = 0x66700000;
-  gv_local.lookup_454_sig[ 57].nbits = 12; gv_local.lookup_454_sig[ 57].bits = 0x66100000;
-  gv_local.lookup_454_sig[ 58].nbits = 12; gv_local.lookup_454_sig[ 58].bits = 0x5DB00000;
-  gv_local.lookup_454_sig[ 59].nbits = 12; gv_local.lookup_454_sig[ 59].bits = 0x5D400000;
-  gv_local.lookup_454_sig[ 60].nbits = 12; gv_local.lookup_454_sig[ 60].bits = 0x5D100000;
-  gv_local.lookup_454_sig[ 61].nbits = 12; gv_local.lookup_454_sig[ 61].bits = 0x58600000;
-  gv_local.lookup_454_sig[ 62].nbits = 12; gv_local.lookup_454_sig[ 62].bits = 0x58300000;
-  gv_local.lookup_454_sig[ 63].nbits = 12; gv_local.lookup_454_sig[ 63].bits = 0x58700000;
-  gv_local.lookup_454_sig[ 64].nbits = 12; gv_local.lookup_454_sig[ 64].bits = 0x59800000;
-  gv_local.lookup_454_sig[ 65].nbits = 12; gv_local.lookup_454_sig[ 65].bits = 0x5D900000;
-  gv_local.lookup_454_sig[ 66].nbits = 12; gv_local.lookup_454_sig[ 66].bits = 0x70400000;
-  gv_local.lookup_454_sig[ 67].nbits = 12; gv_local.lookup_454_sig[ 67].bits = 0x84100000;
-  gv_local.lookup_454_sig[ 68].nbits = 12; gv_local.lookup_454_sig[ 68].bits = 0x94C00000;
-  gv_local.lookup_454_sig[ 69].nbits = 12; gv_local.lookup_454_sig[ 69].bits = 0xB3F00000;
-  gv_local.lookup_454_sig[ 70].nbits = 12; gv_local.lookup_454_sig[ 70].bits = 0xDBD00000;
-  gv_local.lookup_454_sig[ 71].nbits = 11; gv_local.lookup_454_sig[ 71].bits = 0x2A400000;
-  gv_local.lookup_454_sig[ 72].nbits = 11; gv_local.lookup_454_sig[ 72].bits = 0x5D600000;
-  gv_local.lookup_454_sig[ 73].nbits = 11; gv_local.lookup_454_sig[ 73].bits = 0x87200000;
-  gv_local.lookup_454_sig[ 74].nbits = 11; gv_local.lookup_454_sig[ 74].bits = 0xB2E00000;
-  gv_local.lookup_454_sig[ 75].nbits = 11; gv_local.lookup_454_sig[ 75].bits = 0xDA400000;
-  gv_local.lookup_454_sig[ 76].nbits = 10; gv_local.lookup_454_sig[ 76].bits = 0x28C00000;
-  gv_local.lookup_454_sig[ 77].nbits = 10; gv_local.lookup_454_sig[ 77].bits = 0x59C00000;
-  gv_local.lookup_454_sig[ 78].nbits = 10; gv_local.lookup_454_sig[ 78].bits = 0x84400000;
-  gv_local.lookup_454_sig[ 79].nbits = 10; gv_local.lookup_454_sig[ 79].bits = 0xB2800000;
-  gv_local.lookup_454_sig[ 80].nbits = 10; gv_local.lookup_454_sig[ 80].bits = 0xDA000000;
-  gv_local.lookup_454_sig[ 81].nbits =  9; gv_local.lookup_454_sig[ 81].bits = 0x28000000;
-  gv_local.lookup_454_sig[ 82].nbits =  9; gv_local.lookup_454_sig[ 82].bits = 0x59000000;
-  gv_local.lookup_454_sig[ 83].nbits =  9; gv_local.lookup_454_sig[ 83].bits = 0x84800000;
-  gv_local.lookup_454_sig[ 84].nbits =  9; gv_local.lookup_454_sig[ 84].bits = 0xA7800000;
-  gv_local.lookup_454_sig[ 85].nbits =  9; gv_local.lookup_454_sig[ 85].bits = 0xDA800000;
-  gv_local.lookup_454_sig[ 86].nbits =  8; gv_local.lookup_454_sig[ 86].bits = 0x29000000;
-  gv_local.lookup_454_sig[ 87].nbits =  8; gv_local.lookup_454_sig[ 87].bits = 0x5C000000;
-  gv_local.lookup_454_sig[ 88].nbits =  8; gv_local.lookup_454_sig[ 88].bits = 0x85000000;
-  gv_local.lookup_454_sig[ 89].nbits =  8; gv_local.lookup_454_sig[ 89].bits = 0xA6000000;
-  gv_local.lookup_454_sig[ 90].nbits =  8; gv_local.lookup_454_sig[ 90].bits = 0xD3000000;
-  gv_local.lookup_454_sig[ 91].nbits =  7; gv_local.lookup_454_sig[ 91].bits = 0x22000000;
-  gv_local.lookup_454_sig[ 92].nbits =  7; gv_local.lookup_454_sig[ 92].bits = 0x54000000;
-  gv_local.lookup_454_sig[ 93].nbits =  7; gv_local.lookup_454_sig[ 93].bits = 0x72000000;
-  gv_local.lookup_454_sig[ 94].nbits =  7; gv_local.lookup_454_sig[ 94].bits = 0x92000000;
-  gv_local.lookup_454_sig[ 95].nbits =  7; gv_local.lookup_454_sig[ 95].bits = 0xB8000000;
-  gv_local.lookup_454_sig[ 96].nbits =  7; gv_local.lookup_454_sig[ 96].bits = 0xD8000000;
-  gv_local.lookup_454_sig[ 97].nbits =  7; gv_local.lookup_454_sig[ 97].bits = 0xF6000000;
-  gv_local.lookup_454_sig[ 98].nbits =  6; gv_local.lookup_454_sig[ 98].bits = 0x2C000000;
-  gv_local.lookup_454_sig[ 99].nbits =  6; gv_local.lookup_454_sig[ 99].bits = 0x44000000;
-  gv_local.lookup_454_sig[100].nbits =  6; gv_local.lookup_454_sig[100].bits = 0xA0000000;
-  gv_local.lookup_454_sig[101].nbits =  6; gv_local.lookup_454_sig[101].bits = 0xF8000000;
-  gv_local.lookup_454_sig[102].nbits =  6; gv_local.lookup_454_sig[102].bits = 0xD4000000;
-  gv_local.lookup_454_sig[103].nbits =  6; gv_local.lookup_454_sig[103].bits = 0xB4000000;
-  gv_local.lookup_454_sig[104].nbits =  6; gv_local.lookup_454_sig[104].bits = 0x9C000000;
-  gv_local.lookup_454_sig[105].nbits =  6; gv_local.lookup_454_sig[105].bits = 0x88000000;
-  gv_local.lookup_454_sig[106].nbits =  6; gv_local.lookup_454_sig[106].bits = 0x60000000;
-  gv_local.lookup_454_sig[107].nbits =  6; gv_local.lookup_454_sig[107].bits = 0x40000000;
-  gv_local.lookup_454_sig[108].nbits =  7; gv_local.lookup_454_sig[108].bits = 0xF2000000;
-  gv_local.lookup_454_sig[109].nbits =  7; gv_local.lookup_454_sig[109].bits = 0xBE000000;
-  gv_local.lookup_454_sig[110].nbits =  7; gv_local.lookup_454_sig[110].bits = 0x90000000;
-  gv_local.lookup_454_sig[111].nbits =  7; gv_local.lookup_454_sig[111].bits = 0x5E000000;
-  gv_local.lookup_454_sig[112].nbits =  7; gv_local.lookup_454_sig[112].bits = 0x26000000;
-  gv_local.lookup_454_sig[113].nbits =  8; gv_local.lookup_454_sig[113].bits = 0xD1000000;
-  gv_local.lookup_454_sig[114].nbits =  8; gv_local.lookup_454_sig[114].bits = 0x96000000;
-  gv_local.lookup_454_sig[115].nbits =  8; gv_local.lookup_454_sig[115].bits = 0x67000000;
-  gv_local.lookup_454_sig[116].nbits =  8; gv_local.lookup_454_sig[116].bits = 0x34000000;
-  gv_local.lookup_454_sig[117].nbits =  9; gv_local.lookup_454_sig[117].bits = 0xDC000000;
-  gv_local.lookup_454_sig[118].nbits =  9; gv_local.lookup_454_sig[118].bits = 0xA5800000;
-  gv_local.lookup_454_sig[119].nbits =  9; gv_local.lookup_454_sig[119].bits = 0x75800000;
-  gv_local.lookup_454_sig[120].nbits =  9; gv_local.lookup_454_sig[120].bits = 0x51000000;
-  gv_local.lookup_454_sig[121].nbits = 10; gv_local.lookup_454_sig[121].bits = 0xF5800000;
-  gv_local.lookup_454_sig[122].nbits = 10; gv_local.lookup_454_sig[122].bits = 0xBA000000;
-  gv_local.lookup_454_sig[123].nbits = 10; gv_local.lookup_454_sig[123].bits = 0x86400000;
-  gv_local.lookup_454_sig[124].nbits = 10; gv_local.lookup_454_sig[124].bits = 0x56000000;
-  gv_local.lookup_454_sig[125].nbits = 11; gv_local.lookup_454_sig[125].bits = 0xF5200000;
-  gv_local.lookup_454_sig[126].nbits = 11; gv_local.lookup_454_sig[126].bits = 0xB3400000;
-  gv_local.lookup_454_sig[127].nbits = 11; gv_local.lookup_454_sig[127].bits = 0x87000000;
-  gv_local.lookup_454_sig[128].nbits = 11; gv_local.lookup_454_sig[128].bits = 0x58400000;
-  gv_local.lookup_454_sig[129].nbits = 11; gv_local.lookup_454_sig[129].bits = 0x2AA00000;
-  gv_local.lookup_454_sig[130].nbits = 12; gv_local.lookup_454_sig[130].bits = 0xF1800000;
-  gv_local.lookup_454_sig[131].nbits = 12; gv_local.lookup_454_sig[131].bits = 0xDBB00000;
-  gv_local.lookup_454_sig[132].nbits = 12; gv_local.lookup_454_sig[132].bits = 0xCBA00000;
-  gv_local.lookup_454_sig[133].nbits = 12; gv_local.lookup_454_sig[133].bits = 0xC9900000;
-  gv_local.lookup_454_sig[134].nbits = 12; gv_local.lookup_454_sig[134].bits = 0xB3700000;
-  gv_local.lookup_454_sig[135].nbits = 12; gv_local.lookup_454_sig[135].bits = 0xA5000000;
-  gv_local.lookup_454_sig[136].nbits = 12; gv_local.lookup_454_sig[136].bits = 0x94500000;
-  gv_local.lookup_454_sig[137].nbits = 12; gv_local.lookup_454_sig[137].bits = 0x8E500000;
-  gv_local.lookup_454_sig[138].nbits = 12; gv_local.lookup_454_sig[138].bits = 0x75700000;
-  gv_local.lookup_454_sig[139].nbits = 12; gv_local.lookup_454_sig[139].bits = 0x70B00000;
-  gv_local.lookup_454_sig[140].nbits = 12; gv_local.lookup_454_sig[140].bits = 0x66D00000;
-  gv_local.lookup_454_sig[141].nbits = 12; gv_local.lookup_454_sig[141].bits = 0x5D300000;
-  gv_local.lookup_454_sig[142].nbits = 12; gv_local.lookup_454_sig[142].bits = 0x51F00000;
-  gv_local.lookup_454_sig[143].nbits = 12; gv_local.lookup_454_sig[143].bits = 0x36B00000;
-  gv_local.lookup_454_sig[144].nbits = 12; gv_local.lookup_454_sig[144].bits = 0x33A00000;
-  gv_local.lookup_454_sig[145].nbits = 12; gv_local.lookup_454_sig[145].bits = 0x2A700000;
-  gv_local.lookup_454_sig[146].nbits = 12; gv_local.lookup_454_sig[146].bits = 0x24D00000;
-  gv_local.lookup_454_sig[147].nbits = 13; gv_local.lookup_454_sig[147].bits = 0xF5D00000;
-  gv_local.lookup_454_sig[148].nbits = 13; gv_local.lookup_454_sig[148].bits = 0xF1980000;
-  gv_local.lookup_454_sig[149].nbits = 13; gv_local.lookup_454_sig[149].bits = 0xF0600000;
-  gv_local.lookup_454_sig[150].nbits = 13; gv_local.lookup_454_sig[150].bits = 0xCB480000;
-  gv_local.lookup_454_sig[151].nbits = 13; gv_local.lookup_454_sig[151].bits = 0xA5300000;
-  gv_local.lookup_454_sig[152].nbits = 13; gv_local.lookup_454_sig[152].bits = 0xA7600000;
-  gv_local.lookup_454_sig[153].nbits = 13; gv_local.lookup_454_sig[153].bits = 0xA7680000;
-  gv_local.lookup_454_sig[154].nbits = 13; gv_local.lookup_454_sig[154].bits = 0xB3600000;
-  gv_local.lookup_454_sig[155].nbits = 13; gv_local.lookup_454_sig[155].bits = 0xA7700000;
-  gv_local.lookup_454_sig[156].nbits = 13; gv_local.lookup_454_sig[156].bits = 0xB3E00000;
-  gv_local.lookup_454_sig[157].nbits = 13; gv_local.lookup_454_sig[157].bits = 0xC9800000;
-  gv_local.lookup_454_sig[158].nbits = 13; gv_local.lookup_454_sig[158].bits = 0xC9E80000;
-  gv_local.lookup_454_sig[159].nbits = 13; gv_local.lookup_454_sig[159].bits = 0xCBB00000;
-  gv_local.lookup_454_sig[160].nbits = 13; gv_local.lookup_454_sig[160].bits = 0xDA680000;
-  gv_local.lookup_454_sig[161].nbits = 13; gv_local.lookup_454_sig[161].bits = 0xF0680000;
-  gv_local.lookup_454_sig[162].nbits = 13; gv_local.lookup_454_sig[162].bits = 0xF5E80000;
-  gv_local.lookup_454_sig[163].nbits = 12; gv_local.lookup_454_sig[163].bits = 0x28B00000;
-  gv_local.lookup_454_sig[164].nbits = 12; gv_local.lookup_454_sig[164].bits = 0x33B00000;
-  gv_local.lookup_454_sig[165].nbits = 12; gv_local.lookup_454_sig[165].bits = 0x51C00000;
-  gv_local.lookup_454_sig[166].nbits = 12; gv_local.lookup_454_sig[166].bits = 0x5DA00000;
-  gv_local.lookup_454_sig[167].nbits = 12; gv_local.lookup_454_sig[167].bits = 0x74600000;
-  gv_local.lookup_454_sig[168].nbits = 12; gv_local.lookup_454_sig[168].bits = 0x94000000;
-  gv_local.lookup_454_sig[169].nbits = 12; gv_local.lookup_454_sig[169].bits = 0x97700000;
-  gv_local.lookup_454_sig[170].nbits = 12; gv_local.lookup_454_sig[170].bits = 0xB3C00000;
-  gv_local.lookup_454_sig[171].nbits = 12; gv_local.lookup_454_sig[171].bits = 0xD0400000;
-  gv_local.lookup_454_sig[172].nbits = 12; gv_local.lookup_454_sig[172].bits = 0xF0200000;
-  gv_local.lookup_454_sig[173].nbits = 11; gv_local.lookup_454_sig[173].bits = 0x24E00000;
-  gv_local.lookup_454_sig[174].nbits = 11; gv_local.lookup_454_sig[174].bits = 0x36C00000;
-  gv_local.lookup_454_sig[175].nbits = 11; gv_local.lookup_454_sig[175].bits = 0x5DC00000;
-  gv_local.lookup_454_sig[176].nbits = 11; gv_local.lookup_454_sig[176].bits = 0x75400000;
-  gv_local.lookup_454_sig[177].nbits = 11; gv_local.lookup_454_sig[177].bits = 0x94A00000;
-  gv_local.lookup_454_sig[178].nbits = 11; gv_local.lookup_454_sig[178].bits = 0xB3200000;
-  gv_local.lookup_454_sig[179].nbits = 11; gv_local.lookup_454_sig[179].bits = 0xD0200000;
-  gv_local.lookup_454_sig[180].nbits = 11; gv_local.lookup_454_sig[180].bits = 0xF5000000;
-  gv_local.lookup_454_sig[181].nbits = 10; gv_local.lookup_454_sig[181].bits = 0x2AC00000;
-  gv_local.lookup_454_sig[182].nbits = 10; gv_local.lookup_454_sig[182].bits = 0x56800000;
-  gv_local.lookup_454_sig[183].nbits = 10; gv_local.lookup_454_sig[183].bits = 0x70000000;
-  gv_local.lookup_454_sig[184].nbits = 10; gv_local.lookup_454_sig[184].bits = 0x87800000;
-  gv_local.lookup_454_sig[185].nbits = 10; gv_local.lookup_454_sig[185].bits = 0xA4400000;
-  gv_local.lookup_454_sig[186].nbits = 10; gv_local.lookup_454_sig[186].bits = 0xC8C00000;
-  gv_local.lookup_454_sig[187].nbits = 10; gv_local.lookup_454_sig[187].bits = 0xDB400000;
-  gv_local.lookup_454_sig[188].nbits =  9; gv_local.lookup_454_sig[188].bits = 0x24000000;
-  gv_local.lookup_454_sig[189].nbits =  9; gv_local.lookup_454_sig[189].bits = 0x36000000;
-  gv_local.lookup_454_sig[190].nbits =  9; gv_local.lookup_454_sig[190].bits = 0x58800000;
-  gv_local.lookup_454_sig[191].nbits =  9; gv_local.lookup_454_sig[191].bits = 0x71000000;
-  gv_local.lookup_454_sig[192].nbits =  9; gv_local.lookup_454_sig[192].bits = 0x86800000;
-  gv_local.lookup_454_sig[193].nbits =  9; gv_local.lookup_454_sig[193].bits = 0x95800000;
-  gv_local.lookup_454_sig[194].nbits =  9; gv_local.lookup_454_sig[194].bits = 0xB2000000;
-  gv_local.lookup_454_sig[195].nbits =  9; gv_local.lookup_454_sig[195].bits = 0xC9000000;
-  gv_local.lookup_454_sig[196].nbits =  9; gv_local.lookup_454_sig[196].bits = 0xD2000000;
-  gv_local.lookup_454_sig[197].nbits =  9; gv_local.lookup_454_sig[197].bits = 0xDC800000;
-  gv_local.lookup_454_sig[198].nbits =  9; gv_local.lookup_454_sig[198].bits = 0xF1000000;
-  gv_local.lookup_454_sig[199].nbits =  8; gv_local.lookup_454_sig[199].bits = 0x20000000;
-  gv_local.lookup_454_sig[200].nbits =  8; gv_local.lookup_454_sig[200].bits = 0x2B000000;
-  gv_local.lookup_454_sig[201].nbits =  8; gv_local.lookup_454_sig[201].bits = 0x37000000;
-  gv_local.lookup_454_sig[202].nbits =  8; gv_local.lookup_454_sig[202].bits = 0x50000000;
-  gv_local.lookup_454_sig[203].nbits =  8; gv_local.lookup_454_sig[203].bits = 0x35000000;
-  gv_local.lookup_454_sig[204].nbits =  8; gv_local.lookup_454_sig[204].bits = 0x32000000;
-  gv_local.lookup_454_sig[205].nbits =  8; gv_local.lookup_454_sig[205].bits = 0x25000000;
-  gv_local.lookup_454_sig[206].nbits =  8; gv_local.lookup_454_sig[206].bits = 0x21000000;
-  gv_local.lookup_454_sig[207].nbits =  9; gv_local.lookup_454_sig[207].bits = 0xDD800000;
-  gv_local.lookup_454_sig[208].nbits =  9; gv_local.lookup_454_sig[208].bits = 0xD0800000;
-  gv_local.lookup_454_sig[209].nbits =  9; gv_local.lookup_454_sig[209].bits = 0xBA800000;
-  gv_local.lookup_454_sig[210].nbits =  9; gv_local.lookup_454_sig[210].bits = 0xA4800000;
-  gv_local.lookup_454_sig[211].nbits =  9; gv_local.lookup_454_sig[211].bits = 0x8E800000;
-  gv_local.lookup_454_sig[212].nbits =  9; gv_local.lookup_454_sig[212].bits = 0x71800000;
-  gv_local.lookup_454_sig[213].nbits =  9; gv_local.lookup_454_sig[213].bits = 0x57000000;
-  gv_local.lookup_454_sig[214].nbits =  9; gv_local.lookup_454_sig[214].bits = 0x33000000;
-  gv_local.lookup_454_sig[215].nbits = 10; gv_local.lookup_454_sig[215].bits = 0xF1C00000;
-  gv_local.lookup_454_sig[216].nbits = 10; gv_local.lookup_454_sig[216].bits = 0xCBC00000;
-  gv_local.lookup_454_sig[217].nbits = 10; gv_local.lookup_454_sig[217].bits = 0xA7000000;
-  gv_local.lookup_454_sig[218].nbits = 10; gv_local.lookup_454_sig[218].bits = 0x87C00000;
-  gv_local.lookup_454_sig[219].nbits = 10; gv_local.lookup_454_sig[219].bits = 0x66800000;
-  gv_local.lookup_454_sig[220].nbits = 10; gv_local.lookup_454_sig[220].bits = 0x51800000;
-  gv_local.lookup_454_sig[221].nbits = 10; gv_local.lookup_454_sig[221].bits = 0x24800000;
-  gv_local.lookup_454_sig[222].nbits = 11; gv_local.lookup_454_sig[222].bits = 0xD2E00000;
-  gv_local.lookup_454_sig[223].nbits = 11; gv_local.lookup_454_sig[223].bits = 0xB3A00000;
-  gv_local.lookup_454_sig[224].nbits = 11; gv_local.lookup_454_sig[224].bits = 0x94600000;
-  gv_local.lookup_454_sig[225].nbits = 11; gv_local.lookup_454_sig[225].bits = 0x74000000;
-  gv_local.lookup_454_sig[226].nbits = 11; gv_local.lookup_454_sig[226].bits = 0x56E00000;
-  gv_local.lookup_454_sig[227].nbits = 11; gv_local.lookup_454_sig[227].bits = 0x2A800000;
-  gv_local.lookup_454_sig[228].nbits = 12; gv_local.lookup_454_sig[228].bits = 0xF0700000;
-  gv_local.lookup_454_sig[229].nbits = 12; gv_local.lookup_454_sig[229].bits = 0xCB800000;
-  gv_local.lookup_454_sig[230].nbits = 12; gv_local.lookup_454_sig[230].bits = 0xA5100000;
-  gv_local.lookup_454_sig[231].nbits = 12; gv_local.lookup_454_sig[231].bits = 0x8E600000;
-  gv_local.lookup_454_sig[232].nbits = 12; gv_local.lookup_454_sig[232].bits = 0x70900000;
-  gv_local.lookup_454_sig[233].nbits = 12; gv_local.lookup_454_sig[233].bits = 0x58200000;
-  gv_local.lookup_454_sig[234].nbits = 12; gv_local.lookup_454_sig[234].bits = 0x30A00000;
-  gv_local.lookup_454_sig[235].nbits = 13; gv_local.lookup_454_sig[235].bits = 0xF5D80000;
-  gv_local.lookup_454_sig[236].nbits = 13; gv_local.lookup_454_sig[236].bits = 0xDA600000;
-  gv_local.lookup_454_sig[237].nbits = 13; gv_local.lookup_454_sig[237].bits = 0xC8980000;
-  gv_local.lookup_454_sig[238].nbits = 13; gv_local.lookup_454_sig[238].bits = 0xA4200000;
-  gv_local.lookup_454_sig[239].nbits = 13; gv_local.lookup_454_sig[239].bits = 0x8E480000;
-  gv_local.lookup_454_sig[240].nbits = 13; gv_local.lookup_454_sig[240].bits = 0x75600000;
-  gv_local.lookup_454_sig[241].nbits = 13; gv_local.lookup_454_sig[241].bits = 0x5D200000;
-  gv_local.lookup_454_sig[242].nbits = 13; gv_local.lookup_454_sig[242].bits = 0x36F00000;
-  gv_local.lookup_454_sig[243].nbits = 13; gv_local.lookup_454_sig[243].bits = 0x30880000;
-  gv_local.lookup_454_sig[244].nbits = 13; gv_local.lookup_454_sig[244].bits = 0x28800000;
-  gv_local.lookup_454_sig[245].nbits = 14; gv_local.lookup_454_sig[245].bits = 0xF5780000;
-  gv_local.lookup_454_sig[246].nbits = 14; gv_local.lookup_454_sig[246].bits = 0xF1900000;
-  gv_local.lookup_454_sig[247].nbits = 14; gv_local.lookup_454_sig[247].bits = 0xDA700000;
-  gv_local.lookup_454_sig[248].nbits = 14; gv_local.lookup_454_sig[248].bits = 0xDA780000;
-  gv_local.lookup_454_sig[249].nbits = 14; gv_local.lookup_454_sig[249].bits = 0xD2C80000;
-  gv_local.lookup_454_sig[250].nbits = 14; gv_local.lookup_454_sig[250].bits = 0xCB9C0000;
-  gv_local.lookup_454_sig[251].nbits = 14; gv_local.lookup_454_sig[251].bits = 0xC8B80000;
-  gv_local.lookup_454_sig[252].nbits = 14; gv_local.lookup_454_sig[252].bits = 0xCB500000;
-  gv_local.lookup_454_sig[253].nbits = 14; gv_local.lookup_454_sig[253].bits = 0xC9E40000;
-  gv_local.lookup_454_sig[254].nbits = 14; gv_local.lookup_454_sig[254].bits = 0xC8BC0000;
-  gv_local.lookup_454_sig[255].nbits = 14; gv_local.lookup_454_sig[255].bits = 0xCB740000;
-  gv_local.lookup_454_sig[256].nbits = 14; gv_local.lookup_454_sig[256].bits = 0xD0540000;
-  gv_local.lookup_454_sig[257].nbits = 14; gv_local.lookup_454_sig[257].bits = 0xD2C40000;
-  gv_local.lookup_454_sig[258].nbits = 14; gv_local.lookup_454_sig[258].bits = 0xDA7C0000;
-  gv_local.lookup_454_sig[259].nbits = 14; gv_local.lookup_454_sig[259].bits = 0xF0380000;
-  gv_local.lookup_454_sig[260].nbits = 14; gv_local.lookup_454_sig[260].bits = 0xF5700000;
-  gv_local.lookup_454_sig[261].nbits = 14; gv_local.lookup_454_sig[261].bits = 0xF5F00000;
-  gv_local.lookup_454_sig[262].nbits = 13; gv_local.lookup_454_sig[262].bits = 0x2A680000;
-  gv_local.lookup_454_sig[263].nbits = 13; gv_local.lookup_454_sig[263].bits = 0x33C00000;
-  gv_local.lookup_454_sig[264].nbits = 13; gv_local.lookup_454_sig[264].bits = 0x36F80000;
-  gv_local.lookup_454_sig[265].nbits = 13; gv_local.lookup_454_sig[265].bits = 0x5D280000;
-  gv_local.lookup_454_sig[266].nbits = 13; gv_local.lookup_454_sig[266].bits = 0x66680000;
-  gv_local.lookup_454_sig[267].nbits = 13; gv_local.lookup_454_sig[267].bits = 0x75100000;
-  gv_local.lookup_454_sig[268].nbits = 13; gv_local.lookup_454_sig[268].bits = 0x86180000;
-  gv_local.lookup_454_sig[269].nbits = 13; gv_local.lookup_454_sig[269].bits = 0x97200000;
-  gv_local.lookup_454_sig[270].nbits = 13; gv_local.lookup_454_sig[270].bits = 0xA7780000;
-  gv_local.lookup_454_sig[271].nbits = 13; gv_local.lookup_454_sig[271].bits = 0xB3E80000;
-  gv_local.lookup_454_sig[272].nbits = 13; gv_local.lookup_454_sig[272].bits = 0xCBB80000;
-  gv_local.lookup_454_sig[273].nbits = 13; gv_local.lookup_454_sig[273].bits = 0xF0100000;
-  gv_local.lookup_454_sig[274].nbits = 13; gv_local.lookup_454_sig[274].bits = 0xF5F80000;
-  gv_local.lookup_454_sig[275].nbits = 12; gv_local.lookup_454_sig[275].bits = 0x30B00000;
-  gv_local.lookup_454_sig[276].nbits = 12; gv_local.lookup_454_sig[276].bits = 0x51E00000;
-  gv_local.lookup_454_sig[277].nbits = 12; gv_local.lookup_454_sig[277].bits = 0x5D800000;
-  gv_local.lookup_454_sig[278].nbits = 12; gv_local.lookup_454_sig[278].bits = 0x74400000;
-  gv_local.lookup_454_sig[279].nbits = 12; gv_local.lookup_454_sig[279].bits = 0x87700000;
-  gv_local.lookup_454_sig[280].nbits = 12; gv_local.lookup_454_sig[280].bits = 0x97600000;
-  gv_local.lookup_454_sig[281].nbits = 12; gv_local.lookup_454_sig[281].bits = 0xB3100000;
-  gv_local.lookup_454_sig[282].nbits = 12; gv_local.lookup_454_sig[282].bits = 0xC9F00000;
-  gv_local.lookup_454_sig[283].nbits = 12; gv_local.lookup_454_sig[283].bits = 0xDBA00000;
-  gv_local.lookup_454_sig[284].nbits = 12; gv_local.lookup_454_sig[284].bits = 0xF5600000;
-  gv_local.lookup_454_sig[285].nbits = 11; gv_local.lookup_454_sig[285].bits = 0x2A200000;
-  gv_local.lookup_454_sig[286].nbits = 11; gv_local.lookup_454_sig[286].bits = 0x33E00000;
-  gv_local.lookup_454_sig[287].nbits = 11; gv_local.lookup_454_sig[287].bits = 0x58000000;
-  gv_local.lookup_454_sig[288].nbits = 11; gv_local.lookup_454_sig[288].bits = 0x66200000;
-  gv_local.lookup_454_sig[289].nbits = 11; gv_local.lookup_454_sig[289].bits = 0x75200000;
-  gv_local.lookup_454_sig[290].nbits = 11; gv_local.lookup_454_sig[290].bits = 0x87400000;
-  gv_local.lookup_454_sig[291].nbits = 11; gv_local.lookup_454_sig[291].bits = 0x94800000;
-  gv_local.lookup_454_sig[292].nbits = 11; gv_local.lookup_454_sig[292].bits = 0xA4000000;
-  gv_local.lookup_454_sig[293].nbits = 11; gv_local.lookup_454_sig[293].bits = 0xA7400000;
-  gv_local.lookup_454_sig[294].nbits = 11; gv_local.lookup_454_sig[294].bits = 0xBA600000;
-  gv_local.lookup_454_sig[295].nbits = 11; gv_local.lookup_454_sig[295].bits = 0xC9A00000;
-  gv_local.lookup_454_sig[296].nbits = 11; gv_local.lookup_454_sig[296].bits = 0xD0000000;
-  gv_local.lookup_454_sig[297].nbits = 11; gv_local.lookup_454_sig[297].bits = 0xD2A00000;
-  gv_local.lookup_454_sig[298].nbits = 11; gv_local.lookup_454_sig[298].bits = 0xDB000000;
-  gv_local.lookup_454_sig[299].nbits = 11; gv_local.lookup_454_sig[299].bits = 0xDB800000;
-  gv_local.lookup_454_sig[300].nbits = 11; gv_local.lookup_454_sig[300].bits = 0xF0400000;
-  gv_local.lookup_454_sig[301].nbits = 11; gv_local.lookup_454_sig[301].bits = 0xF1A00000;
-  gv_local.lookup_454_sig[302].nbits = 11; gv_local.lookup_454_sig[302].bits = 0xF0A00000;
-  gv_local.lookup_454_sig[303].nbits = 11; gv_local.lookup_454_sig[303].bits = 0xF0800000;
-  gv_local.lookup_454_sig[304].nbits = 11; gv_local.lookup_454_sig[304].bits = 0xDBE00000;
-  gv_local.lookup_454_sig[305].nbits = 11; gv_local.lookup_454_sig[305].bits = 0xDB200000;
-  gv_local.lookup_454_sig[306].nbits = 11; gv_local.lookup_454_sig[306].bits = 0xD2800000;
-  gv_local.lookup_454_sig[307].nbits = 11; gv_local.lookup_454_sig[307].bits = 0xC9C00000;
-  gv_local.lookup_454_sig[308].nbits = 11; gv_local.lookup_454_sig[308].bits = 0xBA400000;
-  gv_local.lookup_454_sig[309].nbits = 11; gv_local.lookup_454_sig[309].bits = 0xB2C00000;
-  gv_local.lookup_454_sig[310].nbits = 11; gv_local.lookup_454_sig[310].bits = 0x97000000;
-  gv_local.lookup_454_sig[311].nbits = 11; gv_local.lookup_454_sig[311].bits = 0x94200000;
-  gv_local.lookup_454_sig[312].nbits = 11; gv_local.lookup_454_sig[312].bits = 0x84200000;
-  gv_local.lookup_454_sig[313].nbits = 11; gv_local.lookup_454_sig[313].bits = 0x66E00000;
-  gv_local.lookup_454_sig[314].nbits = 11; gv_local.lookup_454_sig[314].bits = 0x59A00000;
-  gv_local.lookup_454_sig[315].nbits = 11; gv_local.lookup_454_sig[315].bits = 0x36800000;
-  gv_local.lookup_454_sig[316].nbits = 11; gv_local.lookup_454_sig[316].bits = 0x2A000000;
-  gv_local.lookup_454_sig[317].nbits = 12; gv_local.lookup_454_sig[317].bits = 0xF5C00000;
-  gv_local.lookup_454_sig[318].nbits = 12; gv_local.lookup_454_sig[318].bits = 0xD2D00000;
-  gv_local.lookup_454_sig[319].nbits = 12; gv_local.lookup_454_sig[319].bits = 0xC8800000;
-  gv_local.lookup_454_sig[320].nbits = 12; gv_local.lookup_454_sig[320].bits = 0xA4300000;
-  gv_local.lookup_454_sig[321].nbits = 12; gv_local.lookup_454_sig[321].bits = 0x8E700000;
-  gv_local.lookup_454_sig[322].nbits = 12; gv_local.lookup_454_sig[322].bits = 0x74700000;
-  gv_local.lookup_454_sig[323].nbits = 12; gv_local.lookup_454_sig[323].bits = 0x5D000000;
-  gv_local.lookup_454_sig[324].nbits = 12; gv_local.lookup_454_sig[324].bits = 0x33D00000;
-  gv_local.lookup_454_sig[325].nbits = 12; gv_local.lookup_454_sig[325].bits = 0x24C00000;
-  gv_local.lookup_454_sig[326].nbits = 13; gv_local.lookup_454_sig[326].bits = 0xF0300000;
-  gv_local.lookup_454_sig[327].nbits = 13; gv_local.lookup_454_sig[327].bits = 0xCB400000;
-  gv_local.lookup_454_sig[328].nbits = 13; gv_local.lookup_454_sig[328].bits = 0xA5280000;
-  gv_local.lookup_454_sig[329].nbits = 13; gv_local.lookup_454_sig[329].bits = 0x94E80000;
-  gv_local.lookup_454_sig[330].nbits = 13; gv_local.lookup_454_sig[330].bits = 0x84080000;
-  gv_local.lookup_454_sig[331].nbits = 13; gv_local.lookup_454_sig[331].bits = 0x66600000;
-  gv_local.lookup_454_sig[332].nbits = 13; gv_local.lookup_454_sig[332].bits = 0x51D80000;
-  gv_local.lookup_454_sig[333].nbits = 13; gv_local.lookup_454_sig[333].bits = 0x33900000;
-  gv_local.lookup_454_sig[334].nbits = 14; gv_local.lookup_454_sig[334].bits = 0xF5E40000;
-  gv_local.lookup_454_sig[335].nbits = 14; gv_local.lookup_454_sig[335].bits = 0xD2CC0000;
-  gv_local.lookup_454_sig[336].nbits = 14; gv_local.lookup_454_sig[336].bits = 0xC98C0000;
-  gv_local.lookup_454_sig[337].nbits = 14; gv_local.lookup_454_sig[337].bits = 0xB3000000;
-  gv_local.lookup_454_sig[338].nbits = 14; gv_local.lookup_454_sig[338].bits = 0x94F00000;
-  gv_local.lookup_454_sig[339].nbits = 14; gv_local.lookup_454_sig[339].bits = 0x87600000;
-  gv_local.lookup_454_sig[340].nbits = 14; gv_local.lookup_454_sig[340].bits = 0x66080000;
-  gv_local.lookup_454_sig[341].nbits = 14; gv_local.lookup_454_sig[341].bits = 0x66040000;
-  gv_local.lookup_454_sig[342].nbits = 14; gv_local.lookup_454_sig[342].bits = 0x51D40000;
-  gv_local.lookup_454_sig[343].nbits = 14; gv_local.lookup_454_sig[343].bits = 0x33CC0000;
-  gv_local.lookup_454_sig[344].nbits = 14; gv_local.lookup_454_sig[344].bits = 0x28AC0000;
-  gv_local.lookup_454_sig[345].nbits = 14; gv_local.lookup_454_sig[345].bits = 0x28A00000;
-  gv_local.lookup_454_sig[346].nbits = 15; gv_local.lookup_454_sig[346].bits = 0xF03E0000;
-  gv_local.lookup_454_sig[347].nbits = 15; gv_local.lookup_454_sig[347].bits = 0xF1940000;
-  gv_local.lookup_454_sig[348].nbits = 15; gv_local.lookup_454_sig[348].bits = 0xDBCA0000;
-  gv_local.lookup_454_sig[349].nbits = 15; gv_local.lookup_454_sig[349].bits = 0xDBC00000;
-  gv_local.lookup_454_sig[350].nbits = 15; gv_local.lookup_454_sig[350].bits = 0xC9E20000;
-  gv_local.lookup_454_sig[351].nbits = 15; gv_local.lookup_454_sig[351].bits = 0xA42C0000;
-  gv_local.lookup_454_sig[352].nbits = 15; gv_local.lookup_454_sig[352].bits = 0xA42A0000;
-  gv_local.lookup_454_sig[353].nbits = 15; gv_local.lookup_454_sig[353].bits = 0xA53E0000;
-  gv_local.lookup_454_sig[354].nbits = 15; gv_local.lookup_454_sig[354].bits = 0xB3D80000;
-  gv_local.lookup_454_sig[355].nbits = 15; gv_local.lookup_454_sig[355].bits = 0xA53C0000;
-  gv_local.lookup_454_sig[356].nbits = 15; gv_local.lookup_454_sig[356].bits = 0xC8900000;
-  gv_local.lookup_454_sig[357].nbits = 15; gv_local.lookup_454_sig[357].bits = 0xC9880000;
-  gv_local.lookup_454_sig[358].nbits = 15; gv_local.lookup_454_sig[358].bits = 0xC8A80000;
-  gv_local.lookup_454_sig[359].nbits = 15; gv_local.lookup_454_sig[359].bits = 0xCB700000;
-  gv_local.lookup_454_sig[360].nbits = 15; gv_local.lookup_454_sig[360].bits = 0xD2C00000;
-  gv_local.lookup_454_sig[361].nbits = 15; gv_local.lookup_454_sig[361].bits = 0xD2C20000;
-  gv_local.lookup_454_sig[362].nbits = 15; gv_local.lookup_454_sig[362].bits = 0xF01E0000;
-  gv_local.lookup_454_sig[363].nbits = 15; gv_local.lookup_454_sig[363].bits = 0xF01A0000;
-  gv_local.lookup_454_sig[364].nbits = 15; gv_local.lookup_454_sig[364].bits = 0xF5E00000;
-  gv_local.lookup_454_sig[365].nbits = 14; gv_local.lookup_454_sig[365].bits = 0x28A40000;
-  gv_local.lookup_454_sig[366].nbits = 14; gv_local.lookup_454_sig[366].bits = 0x33800000;
-  gv_local.lookup_454_sig[367].nbits = 14; gv_local.lookup_454_sig[367].bits = 0x36EC0000;
-  gv_local.lookup_454_sig[368].nbits = 14; gv_local.lookup_454_sig[368].bits = 0x51D00000;
-  gv_local.lookup_454_sig[369].nbits = 14; gv_local.lookup_454_sig[369].bits = 0x56D40000;
-  gv_local.lookup_454_sig[370].nbits = 14; gv_local.lookup_454_sig[370].bits = 0x5D540000;
-  gv_local.lookup_454_sig[371].nbits = 14; gv_local.lookup_454_sig[371].bits = 0x70840000;
-  gv_local.lookup_454_sig[372].nbits = 14; gv_local.lookup_454_sig[372].bits = 0x86080000;
-  gv_local.lookup_454_sig[373].nbits = 14; gv_local.lookup_454_sig[373].bits = 0x87640000;
-  gv_local.lookup_454_sig[374].nbits = 14; gv_local.lookup_454_sig[374].bits = 0x94180000;
-  gv_local.lookup_454_sig[375].nbits = 14; gv_local.lookup_454_sig[375].bits = 0x972C0000;
-  gv_local.lookup_454_sig[376].nbits = 14; gv_local.lookup_454_sig[376].bits = 0xB3040000;
-  gv_local.lookup_454_sig[377].nbits = 14; gv_local.lookup_454_sig[377].bits = 0xC8940000;
-  gv_local.lookup_454_sig[378].nbits = 14; gv_local.lookup_454_sig[378].bits = 0xCB980000;
-  gv_local.lookup_454_sig[379].nbits = 14; gv_local.lookup_454_sig[379].bits = 0xDA740000;
-  gv_local.lookup_454_sig[380].nbits = 14; gv_local.lookup_454_sig[380].bits = 0xDBC40000;
-  gv_local.lookup_454_sig[381].nbits = 14; gv_local.lookup_454_sig[381].bits = 0xF57C0000;
-  gv_local.lookup_454_sig[382].nbits = 13; gv_local.lookup_454_sig[382].bits = 0x28900000;
-  gv_local.lookup_454_sig[383].nbits = 13; gv_local.lookup_454_sig[383].bits = 0x28880000;
-  gv_local.lookup_454_sig[384].nbits = 13; gv_local.lookup_454_sig[384].bits = 0x30900000;
-  gv_local.lookup_454_sig[385].nbits = 13; gv_local.lookup_454_sig[385].bits = 0x36E00000;
-  gv_local.lookup_454_sig[386].nbits = 13; gv_local.lookup_454_sig[386].bits = 0x56C00000;
-  gv_local.lookup_454_sig[387].nbits = 13; gv_local.lookup_454_sig[387].bits = 0x56D80000;
-  gv_local.lookup_454_sig[388].nbits = 13; gv_local.lookup_454_sig[388].bits = 0x5D580000;
-  gv_local.lookup_454_sig[389].nbits = 13; gv_local.lookup_454_sig[389].bits = 0x66C00000;
-  gv_local.lookup_454_sig[390].nbits = 13; gv_local.lookup_454_sig[390].bits = 0x70880000;
-  gv_local.lookup_454_sig[391].nbits = 13; gv_local.lookup_454_sig[391].bits = 0x75680000;
-  gv_local.lookup_454_sig[392].nbits = 13; gv_local.lookup_454_sig[392].bits = 0x84000000;
-  gv_local.lookup_454_sig[393].nbits = 13; gv_local.lookup_454_sig[393].bits = 0x86100000;
-  gv_local.lookup_454_sig[394].nbits = 13; gv_local.lookup_454_sig[394].bits = 0x8E400000;
-  gv_local.lookup_454_sig[395].nbits = 13; gv_local.lookup_454_sig[395].bits = 0x94400000;
-  gv_local.lookup_454_sig[396].nbits = 13; gv_local.lookup_454_sig[396].bits = 0x94E00000;
-  gv_local.lookup_454_sig[397].nbits = 13; gv_local.lookup_454_sig[397].bits = 0x94F80000;
-  gv_local.lookup_454_sig[398].nbits = 13; gv_local.lookup_454_sig[398].bits = 0x94480000;
-  gv_local.lookup_454_sig[399].nbits = 13; gv_local.lookup_454_sig[399].bits = 0x97300000;
-  gv_local.lookup_454_sig[400].nbits = 13; gv_local.lookup_454_sig[400].bits = 0xB3D00000;
-  gv_local.lookup_454_sig[401].nbits = 13; gv_local.lookup_454_sig[401].bits = 0xD0580000;
-  gv_local.lookup_454_sig[402].nbits = 13; gv_local.lookup_454_sig[402].bits = 0xCB900000;
-  gv_local.lookup_454_sig[403].nbits = 13; gv_local.lookup_454_sig[403].bits = 0xCB680000;
-  gv_local.lookup_454_sig[404].nbits = 13; gv_local.lookup_454_sig[404].bits = 0xCB780000;
-  gv_local.lookup_454_sig[405].nbits = 13; gv_local.lookup_454_sig[405].bits = 0xCB580000;
-  gv_local.lookup_454_sig[406].nbits = 13; gv_local.lookup_454_sig[406].bits = 0xCB600000;
-  gv_local.lookup_454_sig[407].nbits = 13; gv_local.lookup_454_sig[407].bits = 0xC8B00000;
-  gv_local.lookup_454_sig[408].nbits = 13; gv_local.lookup_454_sig[408].bits = 0xC8A00000;
-  gv_local.lookup_454_sig[409].nbits = 13; gv_local.lookup_454_sig[409].bits = 0xB3680000;
-  gv_local.lookup_454_sig[410].nbits = 13; gv_local.lookup_454_sig[410].bits = 0xB3080000;
-  gv_local.lookup_454_sig[411].nbits = 13; gv_local.lookup_454_sig[411].bits = 0xA5200000;
-  gv_local.lookup_454_sig[412].nbits = 13; gv_local.lookup_454_sig[412].bits = 0x97380000;
-  gv_local.lookup_454_sig[413].nbits = 13; gv_local.lookup_454_sig[413].bits = 0x94D80000;
-  gv_local.lookup_454_sig[414].nbits = 13; gv_local.lookup_454_sig[414].bits = 0x94100000;
-  gv_local.lookup_454_sig[415].nbits = 13; gv_local.lookup_454_sig[415].bits = 0x86000000;
-  gv_local.lookup_454_sig[416].nbits = 13; gv_local.lookup_454_sig[416].bits = 0x74380000;
-  gv_local.lookup_454_sig[417].nbits = 13; gv_local.lookup_454_sig[417].bits = 0x66C80000;
-  gv_local.lookup_454_sig[418].nbits = 13; gv_local.lookup_454_sig[418].bits = 0x59980000;
-  gv_local.lookup_454_sig[419].nbits = 13; gv_local.lookup_454_sig[419].bits = 0x56C80000;
-  gv_local.lookup_454_sig[420].nbits = 13; gv_local.lookup_454_sig[420].bits = 0x36A00000;
-  gv_local.lookup_454_sig[421].nbits = 13; gv_local.lookup_454_sig[421].bits = 0x30800000;
-  gv_local.lookup_454_sig[422].nbits = 13; gv_local.lookup_454_sig[422].bits = 0x28980000;
-  gv_local.lookup_454_sig[423].nbits = 14; gv_local.lookup_454_sig[423].bits = 0xF5740000;
-  gv_local.lookup_454_sig[424].nbits = 14; gv_local.lookup_454_sig[424].bits = 0xDBCC0000;
-  gv_local.lookup_454_sig[425].nbits = 14; gv_local.lookup_454_sig[425].bits = 0xCB540000;
-  gv_local.lookup_454_sig[426].nbits = 14; gv_local.lookup_454_sig[426].bits = 0xB3DC0000;
-  gv_local.lookup_454_sig[427].nbits = 14; gv_local.lookup_454_sig[427].bits = 0xA5380000;
-  gv_local.lookup_454_sig[428].nbits = 14; gv_local.lookup_454_sig[428].bits = 0x97280000;
-  gv_local.lookup_454_sig[429].nbits = 14; gv_local.lookup_454_sig[429].bits = 0x876C0000;
-  gv_local.lookup_454_sig[430].nbits = 14; gv_local.lookup_454_sig[430].bits = 0x74340000;
-  gv_local.lookup_454_sig[431].nbits = 14; gv_local.lookup_454_sig[431].bits = 0x74300000;
-  gv_local.lookup_454_sig[432].nbits = 14; gv_local.lookup_454_sig[432].bits = 0x59900000;
-  gv_local.lookup_454_sig[433].nbits = 14; gv_local.lookup_454_sig[433].bits = 0x36A80000;
-  gv_local.lookup_454_sig[434].nbits = 14; gv_local.lookup_454_sig[434].bits = 0x30980000;
-  gv_local.lookup_454_sig[435].nbits = 15; gv_local.lookup_454_sig[435].bits = 0xF5F40000;
-  gv_local.lookup_454_sig[436].nbits = 15; gv_local.lookup_454_sig[436].bits = 0xF03C0000;
-  gv_local.lookup_454_sig[437].nbits = 15; gv_local.lookup_454_sig[437].bits = 0xF0180000;
-  gv_local.lookup_454_sig[438].nbits = 15; gv_local.lookup_454_sig[438].bits = 0xD0500000;
-  gv_local.lookup_454_sig[439].nbits = 15; gv_local.lookup_454_sig[439].bits = 0xC8AA0000;
-  gv_local.lookup_454_sig[440].nbits = 15; gv_local.lookup_454_sig[440].bits = 0xA4280000;
-  gv_local.lookup_454_sig[441].nbits = 15; gv_local.lookup_454_sig[441].bits = 0x94D20000;
-  gv_local.lookup_454_sig[442].nbits = 15; gv_local.lookup_454_sig[442].bits = 0x94D00000;
-  gv_local.lookup_454_sig[443].nbits = 15; gv_local.lookup_454_sig[443].bits = 0x860E0000;
-  gv_local.lookup_454_sig[444].nbits = 15; gv_local.lookup_454_sig[444].bits = 0x751A0000;
-  gv_local.lookup_454_sig[445].nbits = 15; gv_local.lookup_454_sig[445].bits = 0x70820000;
-  gv_local.lookup_454_sig[446].nbits = 15; gv_local.lookup_454_sig[446].bits = 0x660C0000;
-  gv_local.lookup_454_sig[447].nbits = 15; gv_local.lookup_454_sig[447].bits = 0x59940000;
-  gv_local.lookup_454_sig[448].nbits = 15; gv_local.lookup_454_sig[448].bits = 0x56D20000;
-  gv_local.lookup_454_sig[449].nbits = 15; gv_local.lookup_454_sig[449].bits = 0x36E80000;
-  gv_local.lookup_454_sig[450].nbits = 16; gv_local.lookup_454_sig[450].bits = 0xF1970000;
-  gv_local.lookup_454_sig[451].nbits = 16; gv_local.lookup_454_sig[451].bits = 0xD0520000;
-  gv_local.lookup_454_sig[452].nbits = 16; gv_local.lookup_454_sig[452].bits = 0xC8AC0000;
-  gv_local.lookup_454_sig[453].nbits = 16; gv_local.lookup_454_sig[453].bits = 0xC8930000;
-  gv_local.lookup_454_sig[454].nbits = 16; gv_local.lookup_454_sig[454].bits = 0xC9E00000;
-  gv_local.lookup_454_sig[455].nbits = 16; gv_local.lookup_454_sig[455].bits = 0xC98A0000;
-  gv_local.lookup_454_sig[456].nbits = 16; gv_local.lookup_454_sig[456].bits = 0xC8AE0000;
-  gv_local.lookup_454_sig[457].nbits = 16; gv_local.lookup_454_sig[457].bits = 0xC8920000;
-  gv_local.lookup_454_sig[458].nbits = 16; gv_local.lookup_454_sig[458].bits = 0xC8AD0000;
-  gv_local.lookup_454_sig[459].nbits = 16; gv_local.lookup_454_sig[459].bits = 0xC8AF0000;
-  gv_local.lookup_454_sig[460].nbits = 16; gv_local.lookup_454_sig[460].bits = 0xC98B0000;
-  gv_local.lookup_454_sig[461].nbits = 16; gv_local.lookup_454_sig[461].bits = 0xB3DA0000;
-  gv_local.lookup_454_sig[462].nbits = 16; gv_local.lookup_454_sig[462].bits = 0xCB720000;
-  gv_local.lookup_454_sig[463].nbits = 16; gv_local.lookup_454_sig[463].bits = 0xC9E10000;
-  gv_local.lookup_454_sig[464].nbits = 16; gv_local.lookup_454_sig[464].bits = 0xD0530000;
-  gv_local.lookup_454_sig[465].nbits = 16; gv_local.lookup_454_sig[465].bits = 0xB3DB0000;
-  gv_local.lookup_454_sig[466].nbits = 16; gv_local.lookup_454_sig[466].bits = 0xDBC80000;
-  gv_local.lookup_454_sig[467].nbits = 16; gv_local.lookup_454_sig[467].bits = 0xCB730000;
-  gv_local.lookup_454_sig[468].nbits = 16; gv_local.lookup_454_sig[468].bits = 0xDBC90000;
-  gv_local.lookup_454_sig[469].nbits = 16; gv_local.lookup_454_sig[469].bits = 0xF01D0000;
-  gv_local.lookup_454_sig[470].nbits = 16; gv_local.lookup_454_sig[470].bits = 0xF01C0000;
-  gv_local.lookup_454_sig[471].nbits = 16; gv_local.lookup_454_sig[471].bits = 0xF5E20000;
-  gv_local.lookup_454_sig[472].nbits = 16; gv_local.lookup_454_sig[472].bits = 0xF1960000;
-  gv_local.lookup_454_sig[473].nbits = 16; gv_local.lookup_454_sig[473].bits = 0xF5E30000;
-  gv_local.lookup_454_sig[474].nbits = 15; gv_local.lookup_454_sig[474].bits = 0x2A600000;
-  gv_local.lookup_454_sig[475].nbits = 15; gv_local.lookup_454_sig[475].bits = 0x309C0000;
-  gv_local.lookup_454_sig[476].nbits = 15; gv_local.lookup_454_sig[476].bits = 0x309E0000;
-  gv_local.lookup_454_sig[477].nbits = 15; gv_local.lookup_454_sig[477].bits = 0x2A620000;
-  gv_local.lookup_454_sig[478].nbits = 15; gv_local.lookup_454_sig[478].bits = 0x36EA0000;
-  gv_local.lookup_454_sig[479].nbits = 15; gv_local.lookup_454_sig[479].bits = 0x56D00000;
-  gv_local.lookup_454_sig[480].nbits = 15; gv_local.lookup_454_sig[480].bits = 0x59960000;
-  gv_local.lookup_454_sig[481].nbits = 15; gv_local.lookup_454_sig[481].bits = 0x5D520000;
-  gv_local.lookup_454_sig[482].nbits = 15; gv_local.lookup_454_sig[482].bits = 0x5D500000;
-  gv_local.lookup_454_sig[483].nbits = 15; gv_local.lookup_454_sig[483].bits = 0x66000000;
-  gv_local.lookup_454_sig[484].nbits = 15; gv_local.lookup_454_sig[484].bits = 0x66020000;
-  gv_local.lookup_454_sig[485].nbits = 15; gv_local.lookup_454_sig[485].bits = 0x660E0000;
-  gv_local.lookup_454_sig[486].nbits = 15; gv_local.lookup_454_sig[486].bits = 0x75180000;
-  gv_local.lookup_454_sig[487].nbits = 15; gv_local.lookup_454_sig[487].bits = 0x70800000;
-  gv_local.lookup_454_sig[488].nbits = 15; gv_local.lookup_454_sig[488].bits = 0x751C0000;
-  gv_local.lookup_454_sig[489].nbits = 15; gv_local.lookup_454_sig[489].bits = 0x860C0000;
-  gv_local.lookup_454_sig[490].nbits = 15; gv_local.lookup_454_sig[490].bits = 0x751E0000;
-  gv_local.lookup_454_sig[491].nbits = 15; gv_local.lookup_454_sig[491].bits = 0x876A0000;
-  gv_local.lookup_454_sig[492].nbits = 15; gv_local.lookup_454_sig[492].bits = 0x87680000;
-  gv_local.lookup_454_sig[493].nbits = 15; gv_local.lookup_454_sig[493].bits = 0x941C0000;
-  gv_local.lookup_454_sig[494].nbits = 15; gv_local.lookup_454_sig[494].bits = 0x94D60000;
-  gv_local.lookup_454_sig[495].nbits = 15; gv_local.lookup_454_sig[495].bits = 0x941E0000;
-  gv_local.lookup_454_sig[496].nbits = 15; gv_local.lookup_454_sig[496].bits = 0x94F60000;
-  gv_local.lookup_454_sig[497].nbits = 15; gv_local.lookup_454_sig[497].bits = 0x94F40000;
-  gv_local.lookup_454_sig[498].nbits = 15; gv_local.lookup_454_sig[498].bits = 0x94D40000;
-  gv_local.lookup_454_sig[499].nbits = 15; gv_local.lookup_454_sig[499].bits = 0xA42E0000;
-  gv_local.lookup_454_sig[500].nbits = 15; gv_local.lookup_454_sig[500].bits = 0xDBC20000;
-  gv_local.lookup_454_sig[501].nbits = 14; gv_local.lookup_454_sig[501].bits = 0x36AC0000;
-  gv_local.lookup_454_sig[502].nbits = 14; gv_local.lookup_454_sig[502].bits = 0x339C0000;
-  gv_local.lookup_454_sig[503].nbits = 14; gv_local.lookup_454_sig[503].bits = 0x33980000;
-  gv_local.lookup_454_sig[504].nbits = 14; gv_local.lookup_454_sig[504].bits = 0x33C80000;
-  gv_local.lookup_454_sig[505].nbits = 14; gv_local.lookup_454_sig[505].bits = 0x33840000;
-  gv_local.lookup_454_sig[506].nbits = 14; gv_local.lookup_454_sig[506].bits = 0x33880000;
-  gv_local.lookup_454_sig[507].nbits = 14; gv_local.lookup_454_sig[507].bits = 0x2A640000;
-  gv_local.lookup_454_sig[508].nbits = 14; gv_local.lookup_454_sig[508].bits = 0x338C0000;
-  gv_local.lookup_454_sig[509].nbits = 14; gv_local.lookup_454_sig[509].bits = 0x28A80000;
-  gv_local.lookup_454_sig[510].nbits = 15; gv_local.lookup_454_sig[510].bits = 0xF5F60000;
-  gv_local.lookup_454_sig[511].nbits =  9; gv_local.lookup_454_sig[511].bits = 0x97800000;
-
-#if SRA_DECOMPRESS_USE_REVERSE_LOOKUP
-  /* reverse huffman lookup table
-   */
-  memset (gv_local.rlookup_454_sig, 0, sizeof(uint16_t)*REV_HUFF_TREESIZE_16);
-
-  for (i=0; i<SIG_HUFF_TREESIZE; i++)
-  {
-    val = gv_local.lookup_454_sig[i].bits >> 16;
-    gv_local.rlookup_454_sig [val] = (uint16_t) i;
-    for (j=1; j<=(0xFFFF>>gv_local.lookup_454_sig[i].nbits); j++)
-      gv_local.rlookup_454_sig [val+j] = (uint16_t) i;
-  }
-#endif
-  _s_sort_lookup (gv_local.lookup_454_sig, gv_local.idx_454_sig, SIG_HUFF_TREESIZE);
-
-  gv_local.lookup_454_sig_initialized = 1;
-}
diff --git a/libs/sraxf/v0-decompress-local.h b/libs/sraxf/v0-decompress-local.h
deleted file mode 100644
index afffcdb..0000000
--- a/libs/sraxf/v0-decompress-local.h
+++ /dev/null
@@ -1,368 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _SRA_DECOMPRESS_LOCAL_HEADER
-#define _SRA_DECOMPRESS_LOCAL_HEADER
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define SRA_DECOMPRESS_USE_REVERSE_LOOKUP 1
-
-#include <assert.h>
-#include <byteswap.h>
-#include <limits.h>
-#include <math.h> 
-/*#include <netinet/in.h>*/
-#include <search.h> 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-/*#include <unistd.h>*/
-#include <zlib.h>
-#include <stdint.h>
-
-#define SIG_HUFF_TREESIZE         512
-#define INT_HUFF_TREESIZE         512
-#define NSE_HUFF_TREESIZE         512
-#define PRB_SLX_HUFF_TREESIZE       7
-#define PRB_SLX_SPAN               81
-#define PRB_SLX_MIN                40
- 
-#define PRB_454_HUFF_TREESIZE     100
-#define POS_454_HUFF_TREESIZE      64
-
-#if SRA_DECOMPRESS_USE_REVERSE_LOOKUP
-#define REV_HUFF_TREESIZE_16    65536
-#define REV_HUFF_TREESIZE_08      256
-#endif
-
-#define SIG_MID_POINT            (SIG_HUFF_TREESIZE/2-1)
-#define SIG_MAX_POINT            (SIG_HUFF_TREESIZE-1)
-#define INT_MID_POINT            (INT_HUFF_TREESIZE/2-1)
-#define INT_MAX_POINT            (INT_HUFF_TREESIZE-1)
-#define NSE_MID_POINT            (NSE_HUFF_TREESIZE/2-1)
-#define NSE_MAX_POINT            (NSE_HUFF_TREESIZE-1)
-#define PRB_SLX_MAX_POINT        (PRB_SLX_HUFF_TREESIZE-1)
-#define PRB_454_MAX_POINT        (PRB_454_HUFF_TREESIZE-1)
-#define POS_454_MAX_POINT        (POS_454_HUFF_TREESIZE-1) 
-
-#define LOG_MAIN_MULTIPLIER     2048
-#define LOG_SUB_MULTIPLIER       256
-
-#ifndef _UCHAR_DEFINED
-#define _UCHAR_DEFINED
-typedef unsigned char  uchar_t;
-#endif
-
-/* clearing malloc
- *  NB - in all cases, clearing memory before use
- *  is unnecessary, since the buffers are allocated
- *  to exact sizes and completely overwritten.
- */
-void* sra_zalloc (unsigned int);
-#define sra_zalloc( bytes ) \
-    malloc ( bytes )
-
-/*
- */
-struct SRALookup;
-struct SRALocal;
-
-typedef struct SRALookup* SRALookup_t;
-typedef struct SRALocal*  SRALocal_t;
-
-/* huffman lookup table
- */
-typedef struct SRALookup
-{
-  uchar_t   nbits; /* number of bits for an entry */
-  uint32_t  bits;  /* actual bits */
-} SRALookup;
-
-/* local data storage
- */
-typedef struct SRALocal
-{
-  SRALookup    lookup_slx_sig [SIG_HUFF_TREESIZE];
-  SRALookup    lookup_slx_int [INT_HUFF_TREESIZE];
-  SRALookup    lookup_slx_nse [NSE_HUFF_TREESIZE];
-  SRALookup    lookup_slx_prb [PRB_SLX_HUFF_TREESIZE];
-
-  SRALookup    lookup_454_sig [SIG_HUFF_TREESIZE];
-  SRALookup    lookup_454_prb [PRB_454_HUFF_TREESIZE];
-  SRALookup    lookup_454_pos [POS_454_HUFF_TREESIZE];
-
-  uint16_t     idx_454_sig [SIG_HUFF_TREESIZE];
-  uint16_t     idx_454_prb [PRB_454_HUFF_TREESIZE];
-  uint16_t     idx_454_pos [POS_454_HUFF_TREESIZE];
-
-  uint16_t     idx_slx_sig [SIG_HUFF_TREESIZE];
-  uint16_t     idx_slx_int [INT_HUFF_TREESIZE];
-  uint16_t     idx_slx_nse [NSE_HUFF_TREESIZE];
-  uint16_t     idx_slx_prb [PRB_SLX_HUFF_TREESIZE];
-
-#if SRA_DECOMPRESS_USE_REVERSE_LOOKUP
-  uint16_t     rlookup_slx_sig [REV_HUFF_TREESIZE_16];
-  uint16_t     rlookup_slx_int [REV_HUFF_TREESIZE_16];
-  uint16_t     rlookup_slx_nse [REV_HUFF_TREESIZE_16];
-  uchar_t      rlookup_slx_prb [REV_HUFF_TREESIZE_08];
-
-  uint16_t     rlookup_454_sig [REV_HUFF_TREESIZE_16];
-  uint16_t     rlookup_454_prb [REV_HUFF_TREESIZE_16];
-#endif
-
-  /* sequence encoding/decoding tables
-   */
-  uchar_t      conv2to4na [256][4];  /* backward conversion to nucleotides */
-  uchar_t      conv2to4cs [256][4];  /* backward conversion to color space */
-  uchar_t      convqs4to1 [PRB_SLX_SPAN];
-
-  int          lookup_slx_sig_initialized;
-  int          lookup_slx_int_initialized;
-  int          lookup_slx_nse_initialized;
-  int          lookup_slx_prb_initialized;
-
-  int          lookup_454_sig_initialized;
-  int          lookup_454_prb_initialized;
-  int          lookup_454_pos_initialized;
-  int          lookup_454_seq_initialized;
-} SRALocal;
-
-
-/* some useful macros
- *
- */
-#define _put_short(data, dst, shift, bitpos) \
-  do { \
-    unsigned int   _shift =*(shift); \
-    unsigned int   _bitpos= (bitpos); \
-    unsigned char* _dst   = (unsigned char*)(dst); \
-    unsigned char  _byte; \
-    if(_bitpos) \
-    { \
-      _byte = (unsigned char)((data) >> 8); \
-      *(_dst+_shift)   |= (_byte >> _bitpos); \
-      *(_dst+_shift+1) |= (_byte << (8-_bitpos)); \
-      _byte = (unsigned char)((data) & 0xFF); \
-      *(_dst+_shift+1) |= (_byte >> _bitpos); \
-      *(_dst+_shift+2) |= (_byte << (8-_bitpos)); \
-    } \
-    else \
-    { \
-      _byte = (unsigned char)((data) >> 8); \
-      *(_dst+_shift)   = _byte; \
-      _byte = (unsigned char)((data) & 0xFF); \
-      *(_dst+_shift+1) = _byte; \
-    } \
-    *(shift)=_shift+2; \
-  } while(0)
-/*      
- */   
-#define _get_byte(src, shift, bitpos, byte, update) \
-  do { \
-    unsigned int _shift=*(shift); \
-    *(byte) = 0; \
-    if(bitpos) \
-    { \
-      *(byte)  = *((src)+_shift)<<(bitpos); \
-      *(byte) |= *((src)+_shift+1)>>(8-(bitpos)); \
-    } \
-    else *(byte) = *((src)+_shift); \
-    if(update) *(shift)=_shift+1; \
-  } while(0)
-
-/*
- */
-#define _get_short(src, shift, bitpos, data, update) \
-  do { \
-    unsigned int   _shift=*(shift); \
-    unsigned short _data =0; \
-    if(bitpos) \
-    { \
-      _data  = ((*((src)+_shift)<<(bitpos))<<8); \
-      _data |= ((*((src)+_shift+1)>>(8-(bitpos)))<<8); \
-      _data |= ((*((src)+_shift+1)<<(bitpos))); \
-      _data |= ((*((src)+_shift+2)>>(8-(bitpos)))); \
-    } \
-    else \
-    { \
-      _data  = (*((src)+_shift)<<8); \
-      _data |= (*((src)+_shift+1) & 0xFF); \
-    } \
-    *(data) = _data; \
-    if(update) *(shift)=_shift+2; \
-  } while(0)
-    
-/*
- */
-#if _DEBUGGING
-#define _get_long(src, nbits, shift, bitpos, ldata, update, max_bits)	\
-    do {								\
-        unsigned int   _shift =*(shift);				\
-        unsigned int   _bitpos=*(bitpos);				\
-        unsigned char* _src=(unsigned char*)(src);                      \
-        uint32_t _l = 0;						\
-        int _bits_done = 0;						\
-        int _nbits = nbits;						\
-                                                                        \
-        if (_bitpos + _nbits + (_shift << 3) > max_bits) {              \
-            fprintf(stderr, "legacy code trying to read %u bits beyond end of data at %s, line %d.\n", _bitpos + _nbits + (_shift << 3) - max_bits, __FILE__, __LINE__); \
-            _nbits = max_bits - (_bitpos + (_shift << 3));              \
-        }                                                               \
-        while (_nbits > 0) {                                            \
-            unsigned _bits;						\
-            int _bitsl;                                                 \
-                                                                        \
-            _bits = _src[_shift];					\
-            _bitsl = 8;                                                 \
-                                                                        \
-            if (_bitpos) {                                              \
-                _bits &= 0xFFu >> _bitpos;                              \
-                _bitsl = 8 - _bitpos;                                   \
-            }                                                           \
-                                                                        \
-            if (_bitsl > _nbits) {                                      \
-                _bits >>= _bitsl - _nbits;                              \
-                _bitsl = _nbits;                                        \
-            }                                                           \
-                                                                        \
-            _bitpos += _bitsl;                                          \
-                                                                        \
-            if (_bitpos == 8) {                                         \
-                _bitpos = 0;                                            \
-                _shift++;                                               \
-            }                                                           \
-                                                                        \
-            _l |= _bits << (32 - (_bits_done + _bitsl));		\
-                                                                        \
-            _bits_done += _bitsl;					\
-                                                                        \
-            _nbits -= _bitsl;                                           \
-        }								\
-                                                                        \
-        *ldata = _l;                                                    \
-                                                                        \
-        if(update) {                                                    \
-            *(shift) =_shift;                                           \
-            *(bitpos)=_bitpos;                                          \
-        }								\
-    } while(0)
-#else
-#define _get_long(src, nbits, shift, bitpos, ldata, update, max_bits)	\
-    do {								\
-        unsigned int   _shift =*(shift);				\
-        unsigned int   _bitpos=*(bitpos);				\
-        unsigned char* _src=(unsigned char*)(src);                      \
-        uint32_t _l = 0;						\
-        int _bits_done = 0;						\
-        int _nbits = nbits;						\
-                                                                        \
-        if (_bitpos + _nbits + (_shift << 3) > max_bits) {              \
-            _nbits = max_bits - (_bitpos + (_shift << 3));              \
-        }                                                               \
-        while (_nbits > 0) {                                            \
-            unsigned _bits;						\
-            int _bitsl;                                                 \
-                                                                        \
-            _bits = _src[_shift];					\
-            _bitsl = 8;                                                 \
-                                                                        \
-            if (_bitpos) {                                              \
-                _bits &= 0xFFu >> _bitpos;                              \
-                _bitsl = 8 - _bitpos;                                   \
-            }                                                           \
-                                                                        \
-            if (_bitsl > _nbits) {                                      \
-                _bits >>= _bitsl - _nbits;                              \
-                _bitsl = _nbits;                                        \
-            }                                                           \
-                                                                        \
-            _bitpos += _bitsl;                                          \
-                                                                        \
-            if (_bitpos == 8) {                                         \
-                _bitpos = 0;                                            \
-                _shift++;                                               \
-            }                                                           \
-                                                                        \
-            _l |= _bits << (32 - (_bits_done + _bitsl));		\
-                                                                        \
-            _bits_done += _bitsl;					\
-                                                                        \
-            _nbits -= _bitsl;                                           \
-        }								\
-                                                                        \
-        *ldata = _l;                                                    \
-                                                                        \
-        if(update) {                                                    \
-            *(shift) =_shift;                                           \
-            *(bitpos)=_bitpos;                                          \
-        }								\
-    } while(0)
-#endif
-
-/* various rotation routines
- */
-#define _rotate_1(type,array) \
-  do { \
-    type* _ptr = (type*)(array); \
-    type  _val = *(_ptr+0); \
-    *(_ptr+0) = *(_ptr+1); *(_ptr+1) = *(_ptr+2); \
-    *(_ptr+2) = *(_ptr+3); *(_ptr+3) = _val; \
-  } while(0)
-/*
- */
-#define _rotate_2(type,array) \
-  do { \
-    type* _ptr = (type*)(array); \
-    type  _val = *(_ptr+0); \
-    *(_ptr+0) = *(_ptr+2); *(_ptr+2) = _val; \
-    _val = *(_ptr+1); \
-    *(_ptr+1) = *(_ptr+3); *(_ptr+3) = _val; \
-  } while(0)
-/*
- */
-#define _rotate_3(type,array) \
-  do { \
-    type* _ptr = (type*)(array); \
-    type  _val = *(_ptr+3); \
-    *(_ptr+3) = *(_ptr+2); *(_ptr+2) = *(_ptr+1); \
-    *(_ptr+1) = *(_ptr+0); *(_ptr+0) = _val; \
-  } while(0)
-
-/*
- */
-#define _cmpbits(src1, src2, size, result) \
-  do { \
-    unsigned int _mask=0xFFFFFFFFL<<(32-(size)); \
-    if (((unsigned int)(src1)&_mask)^((unsigned int)(src2)&_mask)) *(result)=0; else *(result)=1; \
-  } while(0)
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/libs/sraxf/v0-decompress.c b/libs/sraxf/v0-decompress.c
deleted file mode 100644
index 16cdc99..0000000
--- a/libs/sraxf/v0-decompress.c
+++ /dev/null
@@ -1,1096 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include "v0-decompress.h"
-#include "v0-decompress-local.h"
-#include <klib/data-buffer.h>
-#include <klib/sort.h>
-#include <sysalloc.h>
-
-#include <math.h>
-
-/* local data
- */
-SRALocal     gv_local;
-
-static
-void *sra_alloc ( KDataBuffer *dst, KDataBuffer *alt, size_t bytes )
-{
-    rc_t rc;
-
-    /* whatever was in dst, put it in alt */
-    KDataBufferWhack ( alt );
-#if 0
-    *alt = *dst;
-#else
-    KDataBufferSub ( dst, alt, 0, UINT64_MAX );
-    KDataBufferWhack(dst);
-#endif
-
-    /* allocate a new space */
-    rc = (uint32_t)KDataBufferMakeBytes ( dst, (uint32_t)bytes );
-    if ( rc != 0 )
-        return NULL;
-
-#if 1
-#define BZERO_SIZE 256
-    if (bytes > BZERO_SIZE)
-        memset(&((char *)dst->base)[bytes-BZERO_SIZE], 0, BZERO_SIZE);
-    else
-        memset(dst->base, 0, bytes);
-#undef BZERO_SIZE
-#endif
-    
-    /* return a pointer to it just like malloc */
-    return dst -> base;
-}
-
-/*
- */
-static void _s_undelta_4_channel (int slen, int tlen, void* src, int ssize)
-{
-  int     i, j;
-  char*   cptr = (char*)src;
-  short*  sptr = (short*)src;
-  int*    iptr = (int*)src;
-
-  assert (tlen);
-  assert ((ssize&3) == 0); /* make sure we have all 4 channels in it */
-
-  for (i=0, j=0; i<ssize/tlen; i+=4, j++)
-  {
-    /* after each slen the actual data is stored as is,
-     * this shift happens at the begining as well
-     */
-    if (j%slen == 0) { i += 4; j++; }
-
-    switch (tlen)
-    {
-      case 4: *(iptr+i+0) += *(iptr+i-4);
-              *(iptr+i+1) += *(iptr+i-3);
-              *(iptr+i+2) += *(iptr+i-2);
-              *(iptr+i+3) += *(iptr+i-1);
-              break;
-
-      case 2: *(sptr+i+0) += *(sptr+i-4);
-              *(sptr+i+1) += *(sptr+i-3);
-              *(sptr+i+2) += *(sptr+i-2);
-              *(sptr+i+3) += *(sptr+i-1);
-              break;
-
-      default:
-      case 1: *(cptr+i+0) += *(cptr+i-4);
-              *(cptr+i+1) += *(cptr+i-3);
-              *(cptr+i+2) += *(cptr+i-2);
-              *(cptr+i+3) += *(cptr+i-1);
-              break;
-    }
-  }
-}
-
-/*
- */
-static void _s_exponent_4_channel (int slen, void* dst, int dsize, const void* src, int ssize, float sim, float snm)
-{
-  int     i;
-  float*  fptr = (float*)dst;
-  short*  sptr = (short*)src;
-
-  assert ((ssize&3) == 0); /* make sure we have all 4 channels in it */
-  assert (ssize*2 == dsize);
-
-  for (i=0; i<ssize>>1; i+=4) /* the source buffer is full of short values, therefore ssize>>1 */
-  {
-    *(fptr+i+0) = expf ((float)*(sptr+i+0)/LOG_MAIN_MULTIPLIER)/10 + sim;
-    *(fptr+i+1) = expf ((float)*(sptr+i+1)/LOG_SUB_MULTIPLIER )/10 + snm;
-    *(fptr+i+2) = expf ((float)*(sptr+i+2)/LOG_SUB_MULTIPLIER )/10 + snm;
-    *(fptr+i+3) = expf ((float)*(sptr+i+3)/LOG_SUB_MULTIPLIER )/10 + snm;
-  }
-}
-
-/*
- */
-static int _s_decompress_zlib ( void* dst, const void* src, int dsize, int ssize )
-{
-    z_stream c_stream; /* decompression stream */
-    
-    memset( &c_stream, 0, sizeof( c_stream ) );
-    c_stream.next_in   = ( Bytef* )src;
-    c_stream.next_out  = ( Bytef* )dst;
-    c_stream.avail_in  = ( uInt )ssize;
-    c_stream.avail_out = ( uInt )dsize;
-    
-    if ( Z_OK != inflateInit ( &c_stream ) )
-    {
-        inflateEnd ( &c_stream );
-        return 1; 
-    }
-    
-    if ( Z_STREAM_END != inflate ( &c_stream, Z_FINISH ) &&
-         Z_OK != inflateSync( &c_stream ) )
-    {
-        inflateEnd ( &c_stream );
-        return 1; 
-    }
-    
-    if ( Z_OK != inflateEnd ( &c_stream ) )
-    {
-        return 1;
-    }
-    
-    return 0;
-}
-
-/*
- */
-static int CC _s_cmp_key (const void* keyptr, const void* idxptr, void *data)
-{
-  SRALookup_t plook = data;
-  static uint32_t mask [33] = {0x00000000, 0x80000000, 0xC0000000, 0xE0000000,
-                               0xF0000000, 0xF8000000, 0xFC000000, 0xFE000000,
-                               0xFF000000, 0xFF800000, 0xFFC00000, 0xFFE00000,
-                               0xFFF00000, 0xFFF80000, 0xFFFC0000, 0xFFFE0000,
-                               0xFFFF0000, 0xFFFF8000, 0xFFFFC000, 0xFFFFE000,
-                               0xFFFFF000, 0xFFFFF800, 0xFFFFFC00, 0xFFFFFE00,
-                               0xFFFFFF00, 0xFFFFFF80, 0xFFFFFFC0, 0xFFFFFFE0,
-                               0xFFFFFFF0, 0xFFFFFFF8, 0xFFFFFFFC, 0xFFFFFFFE,
-                               0xFFFFFFFF};
-
-  uint16_t   index      = *(uint16_t*)idxptr;
-  uint32_t   keyBits    = *(uint32_t*)keyptr & mask[plook[index].nbits];
-  uint32_t   lookupBits = plook[index].bits;
-
-  if (keyBits < lookupBits) return -1;
-  if (keyBits > lookupBits) return  1;
-
-  return 0;
-}
-
-/*
- * decompresses positions for 454 platform, and restores their actual values
- *
- */
-int sra_decompress_pos ( KDataBuffer *dst, KDataBuffer *alt, const void* src, int ssize )
-{
-  uchar_t        magic;              /* compression type magic */
-  const uchar_t* pepos;              /* ptr to encoded positions */
-  uchar_t*       popos;              /* ptr to output positions */
-  uint16_t*      pspos;              /* ptr to short values after restoration */
-  uchar_t*       iptr;               /* ptr to index in lookup table */
-  uchar_t        indx;               /* actual index */
-  uint16_t       offset, shift, osize, pos, rbpos, nbits, i;
-  uint32_t       lval;               /* _get_long reads into it */
-
-  assert (gv_local.lookup_454_pos_initialized);
-
-  rbpos  = 0;
-  offset = 0;
-  pepos  = src;
-
-  /* get magic and size of data
-   */
-  _get_byte  (pepos, &offset, rbpos, &magic, 1);
-  _get_short (pepos, &offset, rbpos, &osize, 1);
-
-  assert (magic == SRA_CT_ZLIB || magic == SRA_CT_HUFFMAN);
-
-  /* decompress zlib
-   */
-  if (magic == SRA_CT_ZLIB) /* it is always applied on top of huffman */
-  {
-    shift = 3; /* magic + length */
-    popos = sra_alloc ( dst, alt, osize + 100 ); /* generosity */
-
-    if (_s_decompress_zlib(popos, pepos+shift, (int)osize + 100, ssize-shift))
-      return 1;
-
-    rbpos  = 0; /* read bit position */
-    offset = 0;
-    ssize  = osize;
-    pepos  = popos;
-    _get_byte  (pepos, &offset, rbpos, &magic, 1);
-    _get_short (pepos, &offset, rbpos, &osize, 1);
-    assert (magic == SRA_CT_HUFFMAN);
-    magic = SRA_CT_ZLIB; /* to make sure an extra allocated buffer will be destroyed */
-  }
-
-  popos = sra_alloc (dst, alt, osize );
-
-
-  /* decompress huffman
-   */
-  pos = 0;
-  while (pos < osize)
-  {
-    if (ssize-offset > 4) nbits = 32;
-    else                  nbits = ((ssize-offset)==4?32:((ssize-offset)==3?24:((ssize-offset)==2?16:8)))-rbpos;
-
-    _get_long ( pepos, nbits, &offset, &rbpos, &lval, 0, (ssize << 3) );
-
-    iptr = (uchar_t*) kbsearch ( &lval, gv_local.idx_454_pos,
-                                 POS_454_HUFF_TREESIZE, sizeof(uint16_t), _s_cmp_key, gv_local.lookup_454_pos );
-    assert (iptr);
-    indx = *iptr;
-
-    offset += ((rbpos+(uint16_t)gv_local.lookup_454_pos[indx].nbits) >> 3);
-    rbpos   = ((rbpos+(uint16_t)gv_local.lookup_454_pos[indx].nbits) &  7);
-
-    if (indx < POS_454_MAX_POINT)
-      *(popos+pos) = indx;
-    else
-    {
-      uchar_t val;
-      _get_byte (pepos, &offset, rbpos, &val, 1);
-      *(popos+pos) = val;
-    }
-    pos++;
-  }
-
-  /* undelta
-   */
-  pspos = sra_alloc ( dst, alt, (osize*sizeof(uint16_t)+3)&~3); /** align to 4-byte **/
-  assert (pspos);
-
-  *(pspos+0) = *(popos+0);
-  for (i=1; i<osize; i++)
-    *(pspos+i) = *(pspos+i-1) + *(popos+i);
-
-  /* set element size to 16 bits */
-  KDataBufferCast ( dst, dst, 16, true );
-
-  /* crop size to osize */
-  assert ( osize <= dst -> elem_count );
-  KDataBufferResize ( dst, osize );
-
-  return 0;
-}
-
-
-int sra_decompress_prb_454 ( KDataBuffer *dst, KDataBuffer *alt, const void* src, int ssize )
-{
-  uchar_t        magic;
-  const uchar_t* peprb;
-  uchar_t*       poprb;
-#if !SRA_DECOMPRESS_USE_REVERSE_LOOKUP
-  uint16_t*      iptr;
-#endif
-  uint16_t       offset, shift, osize, pos, rbpos, nbits;
-  uchar_t        indx;
-  uint32_t       lval;
-
-  assert (gv_local.lookup_454_prb_initialized);
-
-  rbpos  = 0; /* read bit position */
-  offset = 0;
-  peprb  = src;
-
-  /* get magic and size of data
-   */
-  _get_byte  (peprb, &offset, rbpos, &magic, 1);
-  _get_short (peprb, &offset, rbpos, &osize, 1);
-
-  assert (magic == SRA_CT_ZLIB || magic == SRA_CT_HUFFMAN);
-
-  /* decompress zlib
-   */
-  if (magic == SRA_CT_ZLIB)
-  {
-    shift = 3; /* magic + length */
-/****  HACK: in some runs osize was truncated/corrupted????  Giving it some more space *****/
-    poprb = sra_alloc ( dst, alt, osize+200 );
-
-    if (_s_decompress_zlib(poprb, peprb+shift, (int)osize + 200, ssize-shift))
-      return 1;
-
-    rbpos  = 0; /* read bit position */
-    offset = 0;
-    ssize  = osize;
-    peprb  = poprb;
-    _get_byte  (peprb, &offset, rbpos, &magic, 1);
-    _get_short (peprb, &offset, rbpos, &osize, 1);
-    assert (magic == SRA_CT_HUFFMAN);
-  }
-
-  poprb = sra_alloc (dst, alt, (osize+3)&~3); /** align to 4-byte boundary **/
-
-
-  /* decompress huffman
-   */
-  pos = 0;
-  while (pos < osize)
-  {
-    if (ssize-offset > 4) nbits = 32;
-    else                  nbits = ((ssize-offset)==4?32:((ssize-offset)==3?24:((ssize-offset)==2?16:8)))-rbpos;
-
-    if ((offset > (uint32_t)ssize) || (nbits == 0))
-      return 1;
-
-    _get_long (peprb, nbits, &offset, &rbpos, &lval, 0, (ssize << 3));
-
-#if SRA_DECOMPRESS_USE_REVERSE_LOOKUP
-    indx = gv_local.rlookup_454_prb [lval>>16];
-#else
-    iptr = (uint16_t*) kbsearch (&lval, gv_local.idx_454_prb,
-                                PRB_454_HUFF_TREESIZE, sizeof(uint16_t), _s_cmp_key, gv_local.lookup_454_prb);
-    assert (iptr);
-    indx = *iptr;
-#endif
-
-    offset += ((rbpos+(uint16_t)gv_local.lookup_454_prb[indx].nbits) >> 3);
-    rbpos   = ((rbpos+(uint16_t)gv_local.lookup_454_prb[indx].nbits) &  7);
-
-    if (indx < PRB_454_MAX_POINT)
-      *(poprb+pos) = indx;
-    else
-    {
-      uchar_t val;
-      _get_byte (peprb, &offset, rbpos, &val, 1);
-      *(poprb+pos) = val;
-    }
-    pos++;
-  }
-
-  /* crop size to osize */
-  assert ( osize <= dst -> elem_count );
-  KDataBufferResize ( dst, osize );
-
-  return 0;
-}
-
-int sra_decompress_clp  ( KDataBuffer *dst, KDataBuffer *alt, const void* src, int ssize )
-{
-  uchar_t        magic;
-  const uchar_t* peclp;
-  uchar_t*       poclp;
-  uint32_t       osize, offset;
-  uint16_t       rbpos, shift;
-
-  rbpos  = 0;
-  offset = 0;
-  peclp  = src;
-
-  /* get magic and size of data
-   */
-  _get_byte  (peclp,     &offset,  rbpos, &magic, 1);
-  _get_long  (peclp, 32, &offset, &rbpos, &osize, 1, (ssize << 3));
-
-  assert (magic == SRA_CT_ZLIB);
-
-  shift = 5; /* magic + length */
-  poclp = sra_alloc ( dst, alt, osize + 100 );
-
-  if (_s_decompress_zlib(poclp, peclp+shift, (int)osize + 100, ssize-shift))
-    return 1;
-
-  /* crop size to osize */
-  assert ( osize <= dst -> elem_count );
-  KDataBufferResize ( dst, osize );
-
-  return 0;
-}
-
-int sra_decompress_sig_454 ( KDataBuffer *dst, KDataBuffer *alt, const void* src, int ssize )
-{
-  uchar_t        magic;
-  const uchar_t* pesig;
-  uchar_t*       posig;
-#if !SRA_DECOMPRESS_USE_REVERSE_LOOKUP
-  uint16_t*      iptr;
-#endif
-  uint16_t       offset, shift, osize, pos, rbpos, wbpos, indx, nbits;
-  uint32_t       lval;
-
-  assert (gv_local.lookup_454_sig_initialized);
-
-  rbpos  = 0;
-  offset = 0;
-  pesig  = src;
-
-  /* get magic and size of data
-   */
-  _get_byte  (pesig, &offset, rbpos, &magic, 1);
-  _get_short (pesig, &offset, rbpos, &osize, 1);
-
-  assert (magic == SRA_CT_ZLIB || magic == SRA_CT_HUFFMAN);
-
-  /* decompress zlib
-   */
-  if (magic == SRA_CT_ZLIB)
-  {
-    shift = 3; /* magic + length */
-    posig = sra_alloc ( dst, alt, osize + 100 );
-
-    if (_s_decompress_zlib(posig, pesig+shift, (int)osize + 100, ssize-shift))
-      return 1;
-
-    rbpos  = 0; /* read bit position */
-    offset = 0;
-    ssize  = osize;
-    pesig  = posig;
-    _get_byte  (pesig, &offset, rbpos, &magic, 1);
-    _get_short (pesig, &offset, rbpos, &osize, 1);
-    assert (magic == SRA_CT_HUFFMAN);
-  }
- 
-  posig = sra_alloc ( dst, alt, osize );
-
-  /* decompress huffman
-   */
-  pos   = 0;
-  wbpos = 0; /* write bit position */
-  while (pos < osize)
-  {
-    if (ssize-offset > 4) nbits = 32;
-    else                  nbits = ((ssize-offset)==4?32:((ssize-offset)==3?24:((ssize-offset)==2?16:8)))-rbpos;
-
-    _get_long (pesig, nbits, &offset, &rbpos, &lval, 0, (ssize << 3));
-
-#if SRA_DECOMPRESS_USE_REVERSE_LOOKUP
-    indx = gv_local.rlookup_454_sig [lval>>16];
-#else
-    iptr = (uint16_t*) kbsearch (&lval, gv_local.idx_454_sig,
-                                SIG_HUFF_TREESIZE, sizeof(uint16_t), _s_cmp_key, gv_local.lookup_454_sig);
-    assert (iptr);
-    indx = *iptr;
-#endif
-
-    offset += ((rbpos+(uint16_t)gv_local.lookup_454_sig[indx].nbits) >> 3);
-    rbpos   = ((rbpos+(uint16_t)gv_local.lookup_454_sig[indx].nbits) &  7);
-
-    if (indx < SIG_MAX_POINT)
-    {
-      indx = bswap_16 (indx);
-      _put_short (indx, posig, &pos, wbpos);
-    }
-    else
-    {
-      uint16_t val;
-      if ((int)nbits - (int)gv_local.lookup_454_sig[indx].nbits >= 16)
-      {
-        val = (uint16_t)((lval >> (16-gv_local.lookup_454_sig[indx].nbits)) & 0xFFFF);
-        offset += 2;
-      }
-      else
-        _get_short (pesig, &offset, rbpos, &val, 1);
-
-      val = bswap_16 (val);
-      _put_short (val, posig, &pos, wbpos);
-    }
-  }
-
-  /* crop size to osize */
-  assert ( osize <= dst -> elem_count );
-  KDataBufferResize ( dst, osize );
-
-  return 0;
-}
-
-int sra_decompress_prb_slx ( KDataBuffer *dst, KDataBuffer *alt, const void* src, int ssize )
-{
-  uchar_t        magic;
-  char           byte;
-  char           qmin, qmax;
-  const uchar_t* peprb;
-  uchar_t*       poprb;
-  uint32_t       osize, offset, rbpos, pos;
-  uint16_t       fix_seq_len, shift;
-
-  assert (gv_local.lookup_slx_prb_initialized);
-
-  rbpos  = 0;
-  offset = 0;
-  peprb  = src;
-
-  /* get magic and size of data
-   */
-  _get_byte  (peprb,     &offset,  rbpos, &magic, 1);
-  _get_long  (peprb, 32, &offset, &rbpos, &osize, 1, (ssize << 3));
-    
-  assert (magic == SRA_CT_ZLIB || magic == SRA_CT_HUFFMAN || magic == SRA_CT_UNCOMPRESSED);
-
-  /* decompress zlib
-   */
-  if (magic == SRA_CT_ZLIB)
-  {
-    shift = 5; /* magic + length */
-    poprb = sra_alloc ( dst, alt, osize + 100);
-    if (_s_decompress_zlib(poprb, peprb+shift, (int)osize + 100, ssize-shift))
-      return 1;
-
-    rbpos  = 0;
-    offset = 0;
-    ssize  = osize;
-    peprb  = poprb;
-    _get_byte  (peprb,     &offset,  rbpos, &magic, 1);
-    _get_long  (peprb, 32, &offset, &rbpos, &osize, 1, (ssize << 3));
-
-    assert (magic == SRA_CT_HUFFMAN || magic == SRA_CT_UNCOMPRESSED);
-  }
-    
-  _get_byte  (peprb, &offset,  rbpos, &qmin,        1);
-  _get_byte  (peprb, &offset,  rbpos, &qmax,        1);
-  _get_short (peprb, &offset,  rbpos, &fix_seq_len, 1);
-
-  poprb = sra_alloc (dst, alt, osize+100); /** huffman decode can read too much ***/
-
-  /* decompress huffman
-   */
-  if (magic ==  SRA_CT_HUFFMAN)
-  {
-#if !SRA_DECOMPRESS_USE_REVERSE_LOOKUP
-    uchar_t*   iptr;
-#endif
-    uchar_t    indx;
-    union      { char c[4]; uint32_t val; } uval;
-    uint32_t   lval;
-
-
-    pos = 0;
-    while (pos < osize)
-    {
-      if (offset > (uint32_t)ssize)
-        return 1;
-
-      _get_long (peprb, 4, &offset, &rbpos, &lval, 0, (ssize << 3));
-
-#if SRA_DECOMPRESS_USE_REVERSE_LOOKUP
-      indx = gv_local.rlookup_slx_prb [lval>>24];
-#else
-      iptr = (uchar_t*) kbsearch (&lval, gv_local.idx_slx_prb,
-                                 PRB_SLX_HUFF_TREESIZE, sizeof(uint16_t), _s_cmp_key, gv_local.lookup_slx_prb);
-      assert (iptr);
-      indx = *iptr;
-#endif
-
-      offset += ((rbpos+(uint16_t)gv_local.lookup_slx_prb[indx].nbits) >> 3);
-      rbpos   = ((rbpos+(uint16_t)gv_local.lookup_slx_prb[indx].nbits) &  7);
-
-      switch (indx)
-      {
-        case 0: /* max min min min */
-          uval.c[3] = uval.c[2] = uval.c[1] = qmin; uval.c[0] = qmax;
-          break;
-
-        case 1: /* -5 -5 -5 -5 */
-          uval.c[3] = uval.c[2] = uval.c[1] = uval.c[0] = -5;
-          break;
-
-        case 2: /* val -val min min */
-          _get_long (peprb, 6, &offset, &rbpos, &lval, 1, (ssize << 3));
-          byte = (char)(lval >> 26); /* only 6 bits are needed */
-          uval.c[3] = uval.c[2] = qmin; uval.c[1] = -byte; uval.c[0] = byte;
-          break;
-
-        case 3: /* val min -val min */
-          _get_long (peprb, 6, &offset, &rbpos, &lval, 1, (ssize << 3));
-          byte = (char)(lval >> 26); /* only 6 bits are needed */
-          uval.c[3] = uval.c[1] = qmin; uval.c[2] = -byte; uval.c[0] = byte;
-          break;
-
-        case 4: /* val min min -val */
-          _get_long (peprb, 6, &offset, &rbpos, &lval, 1, (ssize << 3));
-          byte = (char)(lval >> 26); /* only 6 bits are needed */
-          uval.c[2] = uval.c[1] = qmin; uval.c[3] = -byte; uval.c[0] = byte;
-          break;
-
-        case 5:
-        default:
-          _get_long (peprb, 32, &offset, &rbpos, (uint32_t *)&uval.c[0], 1, (ssize << 3));
-          /*uval.val = lval*/;
-          break;
-      }
-      memcpy (poprb+pos, &uval.c[0], sizeof(uint32_t));
-      pos += 4;
-    }
-  }
-  else
-  if (magic == SRA_CT_UNCOMPRESSED)
-  {
-      memcpy (poprb, peprb+9, osize);
-  }
-
-  assert ( osize <= dst -> elem_count );
-  KDataBufferResize ( dst, osize );
-
-  return 0;
-}
-
-static void _s_decode_slx (uchar_t magic, const uchar_t* pesig, uchar_t* posig, uint32_t osize, uint32_t offset, uint32_t rbpos, int ssize)
-{
-  uint32_t pos = 0;
-  uint16_t fix_seq_len;
-
-  if (magic == SRA_CT_UNCOMPRESSED || magic == SRA_CT_BASELINED)
-  {
-    int32_t  baseline = 0;
-    float    fval;
-    uint16_t uval;
-
-    _get_short (pesig,     &offset,  rbpos, &fix_seq_len,  1);
-    _get_long  (pesig, 32, &offset, &rbpos, &baseline,     1, (ssize << 3));
-
-    rbpos = 0; /* read bit position */
-
-
-    while (pos < osize)
-    {
-      uval = 0;
-      _get_short (pesig, &offset, rbpos, &uval, 1);
-      fval =     (float) (uval-baseline);
-      memcpy     (posig+pos, &fval, sizeof(float));
-      pos += sizeof(float);
-    }
-  }
-  else
-  if (magic == SRA_CT_NORMALIZED)
-  {
-    union  { float fval; uint32_t uval; } uf;
-    float  fval;
-    float  fmin;
-    short  sval;
-
-    _get_short (pesig,     &offset,  rbpos, &fix_seq_len,  1);
-    _get_short (pesig,     &offset,  rbpos, &sval,         1);
-    _get_long  (pesig, 32, &offset, &rbpos, &uf.uval,      1, (ssize << 3));
-
-    fmin = (float) sval;
-    rbpos = 0; /* read bit position */
-
-
-    while (pos < osize)
-    {
-      sval = 0;
-      fval = uf.fval;
-      _get_short (pesig, &offset, rbpos, &sval, 1);
-      fval *= sval; fval += fmin;
-      memcpy     (posig+pos, &fval, sizeof(float));
-      pos += sizeof(float);
-    }
-  }
-}
-
-int sra_decompress_sig_slx ( KDataBuffer *dst, KDataBuffer *alt, const void* src, int ssize )
-{
-  uchar_t        magic;
-  const uchar_t* pesig;
-  uchar_t*       posig;
-#if !SRA_DECOMPRESS_USE_REVERSE_LOOKUP
-  uint16_t*      iptr;
-#endif
-  uint16_t       indx, fix_seq_len, shift;
-  uint32_t       pos, rbpos, wbpos, nbits;
-  uint32_t       offset, osize, lval;
-  union { float fval; uint32_t uval; } sim, snm; /* minimum level of signal and noise */
-
-  assert (gv_local.lookup_slx_sig_initialized);
-
-  rbpos  = 0;
-  offset = 0;
-  pesig  = src;
-
-  /* get magic and size of data
-   */
-  _get_byte  (pesig,     &offset,  rbpos, &magic, 1);
-  _get_long  (pesig, 32, &offset, &rbpos, &osize, 1, (ssize << 3));
-
-  assert (magic == SRA_CT_ZLIB         || magic == SRA_CT_HUFFMAN ||
-          magic == SRA_CT_UNCOMPRESSED || magic == SRA_CT_NORMALIZED ||
-          magic == SRA_CT_BASELINED);
-
-  /* decompress zlib
-   */
-  if (magic == SRA_CT_ZLIB)
-  {
-    shift = 5; /* magic + length */
-    posig = sra_alloc ( dst, alt, osize + 100 );
-
-    if (_s_decompress_zlib(posig, pesig+shift, (int)osize + 100, ssize-shift))
-      return 1;
-
-    rbpos  = 0; /* read bit position */
-    offset = 0;
-    ssize  = osize;
-    pesig  = posig;
-    _get_byte  (pesig,     &offset,  rbpos, &magic, 1);
-    _get_long  (pesig, 32, &offset, &rbpos, &osize, 1, (ssize << 3));
-
-    assert (magic == SRA_CT_HUFFMAN    || magic == SRA_CT_UNCOMPRESSED ||
-            magic == SRA_CT_NORMALIZED || magic == SRA_CT_BASELINED);
-  }
-
-  /* decompress huffman
-   */
-  if (magic == SRA_CT_HUFFMAN)
-  {
-    _get_short (pesig,     &offset,  rbpos, &fix_seq_len, 1);
-    _get_long  (pesig, 32, &offset, &rbpos, &sim.uval,    1, (ssize << 3));
-    _get_long  (pesig, 32, &offset, &rbpos, &snm.uval,    1, (ssize << 3));
-
-    assert ((osize&3) == 0); /* make shure it can be devided by 4 */
-
-    posig = sra_alloc (dst, alt, osize);
-
-    pos   = 0;
-    wbpos = 0; /* write bit position */
-
-    while (pos < osize)
-    {
-      if (ssize-offset > 4) nbits = 32;
-      else                  nbits = ((ssize-offset)==4?32:((ssize-offset)==3?24:((ssize-offset)==2?16:8)))-rbpos;
-
-      if (offset > (uint32_t)ssize)
-        return 1;
-
-      _get_long (pesig, nbits, &offset, &rbpos, &lval, 0, (ssize << 3));
-
-#if SRA_DECOMPRESS_USE_REVERSE_LOOKUP
-      indx = gv_local.rlookup_slx_sig [lval>>16];
-#else
-      iptr = (uint16_t*) kbsearch (&lval, gv_local.idx_slx_sig,
-                                  SIG_HUFF_TREESIZE, sizeof(uint16_t), _s_cmp_key, gv_local.lookup_slx_sig);
-      assert (iptr);
-      indx = *iptr;
-#endif
-
-      offset += ((rbpos+(uint32_t)gv_local.lookup_slx_sig[indx].nbits) >> 3);
-      rbpos   = ((rbpos+(uint32_t)gv_local.lookup_slx_sig[indx].nbits)  & 7);
-
-      if (indx < SIG_MAX_POINT)
-      {
-        indx = bswap_16 ((uint16_t)(indx-SIG_MID_POINT));
-        _put_short (indx, posig, &pos, wbpos);
-      }
-      else
-      {
-        uint16_t val;
-        if ((int)nbits - (int)gv_local.lookup_slx_sig[indx].nbits >= 16)
-        {
-          val = (short)((lval >> (16-gv_local.lookup_slx_sig[indx].nbits)) & 0xFFFF);
-          offset += 2;
-        }
-        else
-          _get_short (pesig, &offset, rbpos, &val, 1);
-
-        val = bswap_16 (val);
-        _put_short (val, posig, &pos, wbpos);
-      }
-    }
-
-    _s_undelta_4_channel (fix_seq_len, sizeof(uint16_t), posig, osize);
-
-    pesig = posig;
-    ssize = osize;
-    osize = osize << 1;
-    posig = sra_alloc ( dst, alt, osize );
-
-    _s_exponent_4_channel (fix_seq_len, posig, osize, pesig, ssize, sim.fval, snm.fval);
-  }
-  else
-  if (magic == SRA_CT_UNCOMPRESSED || magic == SRA_CT_NORMALIZED || magic == SRA_CT_BASELINED)
-  {
-    assert ((osize&3) == 0); /* make shure it can be devided by 4 */
-    osize *= 2;              /* desination size is 4 bytes per channel, but the original is 2 */
-
-    posig = sra_alloc ( dst, alt, osize );
-
-    _s_decode_slx (magic, pesig, posig, osize, offset, rbpos, ssize);
-  }
-
-  assert ( osize <= dst -> elem_count );
-  KDataBufferResize ( dst, osize );
-
-  return 0;
-}
-
-int sra_decompress_int ( KDataBuffer *dst, KDataBuffer *alt, const void* src, int ssize )
-{
-  uchar_t        magic;
-  const uchar_t* pesig;
-  uchar_t*       posig;
-#if !SRA_DECOMPRESS_USE_REVERSE_LOOKUP
-  uint16_t*      iptr;
-#endif
-  uint16_t       indx, fix_seq_len, shift;
-  uint32_t       pos, rbpos, wbpos, nbits;
-  uint32_t       offset, osize, lval;
-  union { float fval; uint32_t uval; } sim, snm; /* minimum level of signal and noise */
-
-  assert (gv_local.lookup_slx_int_initialized);
-
-  rbpos  = 0;
-  offset = 0;
-  pesig  = src;
-
-  /* get magic and size of data
-   */
-  _get_byte  (pesig,     &offset,  rbpos, &magic, 1);
-  _get_long  (pesig, 32, &offset, &rbpos, &osize, 1, (ssize << 3));
-
-  assert (magic == SRA_CT_ZLIB         || magic == SRA_CT_HUFFMAN ||
-          magic == SRA_CT_UNCOMPRESSED || magic == SRA_CT_NORMALIZED ||
-          magic == SRA_CT_BASELINED);
-
-  /* decompress zlib
-   */
-  if (magic == SRA_CT_ZLIB)
-  {
-    shift = 5; /* magic + length */
-    posig = sra_alloc ( dst, alt, osize + 100 );
-
-    if (_s_decompress_zlib(posig, pesig+shift, (int)osize + 100, ssize-shift))
-      return 1;
-
-    rbpos  = 0; /* read bit position */
-    offset = 0;
-    ssize  = osize;
-    pesig  = posig;
-    _get_byte  (pesig,     &offset,  rbpos, &magic, 1);
-    _get_long  (pesig, 32, &offset, &rbpos, &osize, 1, (ssize << 3));
-
-    assert (magic == SRA_CT_HUFFMAN    || magic == SRA_CT_UNCOMPRESSED ||
-            magic == SRA_CT_NORMALIZED || magic == SRA_CT_BASELINED);
-  }
-
-  /* decompress huffman
-   */
-  if (magic == SRA_CT_HUFFMAN)
-  {
-    _get_short (pesig,     &offset,  rbpos, &fix_seq_len, 1);
-    _get_long  (pesig, 32, &offset, &rbpos, &sim.uval,    1, (ssize << 3));
-    _get_long  (pesig, 32, &offset, &rbpos, &snm.uval,    1, (ssize << 3));
-
-    assert ((osize&3) == 0); /* make shure it can be devided by 4 */
-
-    posig = sra_alloc (dst, alt, osize);
-
-    pos   = 0;
-    wbpos = 0; /* write bit position */
-
-    while (pos < osize)
-    {
-      if (ssize-offset > 4) nbits = 32;
-      else                  nbits = ((ssize-offset)==4?32:((ssize-offset)==3?24:((ssize-offset)==2?16:8)))-rbpos;
-
-      if (offset > (uint32_t)ssize)
-        return 1;
-
-      _get_long (pesig, nbits, &offset, &rbpos, &lval, 0, (ssize << 3));
-
-#if SRA_DECOMPRESS_USE_REVERSE_LOOKUP
-      indx = gv_local.rlookup_slx_int [lval>>16];
-#else
-      iptr = (uint16_t*) kbsearch (&lval, gv_local.idx_slx_int,
-                                  INT_HUFF_TREESIZE, sizeof(uint16_t), _s_cmp_key, gv_local.lookup_slx_int);
-      assert (iptr);
-      indx = *iptr;
-#endif
-
-      offset += ((rbpos+(uint32_t)gv_local.lookup_slx_int[indx].nbits) >> 3);
-      rbpos   = ((rbpos+(uint32_t)gv_local.lookup_slx_int[indx].nbits)  & 7);
-
-      if (indx < INT_MAX_POINT)
-      {
-        indx = bswap_16 ((uint16_t)(indx-INT_MID_POINT));
-        _put_short (indx, posig, &pos, wbpos);
-      }
-      else
-      {
-        uint16_t val;
-        if ((int)nbits - (int)gv_local.lookup_slx_int[indx].nbits >= 16)
-        {
-          val = (short)((lval >> (16-gv_local.lookup_slx_int[indx].nbits)) & 0xFFFF);
-          offset += 2;
-        }
-        else
-          _get_short (pesig, &offset, rbpos, &val, 1);
-
-        val = bswap_16 (val);
-        _put_short (val, posig, &pos, wbpos);
-      }
-    }
-
-    _s_undelta_4_channel (fix_seq_len, sizeof(uint16_t), posig, osize);
-
-    pesig = posig;
-    ssize = osize;
-    osize = osize << 1;
-    posig = sra_alloc (dst, alt, osize);
-
-    _s_exponent_4_channel (fix_seq_len, posig, osize, pesig, ssize, sim.fval, snm.fval);
-  }
-  else
-  if (magic == SRA_CT_UNCOMPRESSED || magic == SRA_CT_NORMALIZED || magic == SRA_CT_BASELINED)
-  {
-    assert ((osize&3) == 0); /* make shure it can be devided by 4 */
-    osize *= 2;              /* desination size is 4 bytes per channel, but the original is 2 */
-
-    posig = sra_alloc (dst, alt, osize);
-
-    _s_decode_slx (magic, pesig, posig, osize, offset, rbpos, ssize);
-  }
-
-  assert ( osize <= dst -> elem_count );
-  KDataBufferResize ( dst, osize );
-
-  return 0;
-}
-
-int sra_decompress_nse ( KDataBuffer *dst, KDataBuffer *alt, const void* src, int ssize )
-{
-  uchar_t        magic;
-  const uchar_t* pesig;
-  uchar_t*       posig;
-#if !SRA_DECOMPRESS_USE_REVERSE_LOOKUP
-  uint16_t*      iptr;
-#endif
-  uint16_t       indx, fix_seq_len, shift;
-  uint32_t       pos, rbpos, wbpos, nbits;
-  uint32_t       offset, osize, lval;
-  union { float fval; uint32_t uval; } sim, snm; /* minimum level of signal and noise */
-
-  assert (gv_local.lookup_slx_nse_initialized);
-
-  rbpos  = 0;
-  offset = 0;
-  pesig  = src;
-
-  /* get magic and size of data
-   */
-  _get_byte  (pesig,     &offset,  rbpos, &magic, 1);
-  _get_long  (pesig, 32, &offset, &rbpos, &osize, 1, (ssize << 3));
-
-  assert (magic == SRA_CT_ZLIB         || magic == SRA_CT_HUFFMAN ||
-          magic == SRA_CT_UNCOMPRESSED || magic == SRA_CT_NORMALIZED ||
-          magic == SRA_CT_BASELINED);
-
-  /* decompress zlib
-   */
-  if (magic == SRA_CT_ZLIB)
-  {
-    shift = 5; /* magic + length */
-    posig = sra_alloc ( dst, alt, osize + 100 );
-
-    if (_s_decompress_zlib(posig, pesig+shift, (int)osize + 100, ssize-shift))
-      return 1;
-
-    rbpos  = 0; /* read bit position */
-    offset = 0;
-    ssize  = osize;
-    pesig  = posig;
-    _get_byte  (pesig,     &offset,  rbpos, &magic, 1);
-    _get_long  (pesig, 32, &offset, &rbpos, &osize, 1, (ssize << 3));
-
-    assert (magic == SRA_CT_HUFFMAN    || magic == SRA_CT_UNCOMPRESSED ||
-            magic == SRA_CT_NORMALIZED || magic == SRA_CT_BASELINED);
-  }
-
-  /* decompress huffman
-   */
-  if (magic == SRA_CT_HUFFMAN)
-  {
-    _get_short (pesig,     &offset,  rbpos, &fix_seq_len, 1);
-    _get_long  (pesig, 32, &offset, &rbpos, &sim.uval,    1, (ssize << 3));
-    _get_long  (pesig, 32, &offset, &rbpos, &snm.uval,    1, (ssize << 3));
-
-    assert ((osize&3) == 0); /* make shure it can be devided by 4 */
-
-    posig = sra_alloc (dst, alt, osize);
-
-    /* decompress huffman
-     */
-    pos   = 0;
-    wbpos = 0; /* write bit position */
-
-    while (pos < osize)
-    {
-      if (ssize-offset > 4) nbits = 32;
-      else                  nbits = ((ssize-offset)==4?32:((ssize-offset)==3?24:((ssize-offset)==2?16:8)))-rbpos;
-
-      if (offset > (uint32_t)ssize)
-        return 1;
-
-      _get_long (pesig, nbits, &offset, &rbpos, &lval, 0, (ssize << 3));
-
-#if SRA_DECOMPRESS_USE_REVERSE_LOOKUP
-      indx = gv_local.rlookup_slx_nse [lval>>16];
-#else
-      iptr = (uint16_t*) kbsearch (&lval, gv_local.idx_slx_nse,
-                                  NSE_HUFF_TREESIZE, sizeof(uint16_t), _s_cmp_key, gv_local.lookup_slx_nse);
-      assert (iptr);
-      indx = *iptr;
-#endif
-
-      offset += ((rbpos+(uint32_t)gv_local.lookup_slx_nse[indx].nbits) >> 3);
-      rbpos   = ((rbpos+(uint32_t)gv_local.lookup_slx_nse[indx].nbits)  & 7);
-
-      if (indx < NSE_MAX_POINT)
-      {
-        indx = bswap_16 ((uint16_t)(indx-NSE_MID_POINT));
-        _put_short (indx, posig, &pos, wbpos);
-      }
-      else
-      {
-        uint16_t val;
-        if ((int)nbits - (int)gv_local.lookup_slx_int[indx].nbits >= 16)
-        {
-          val = (short)((lval >> (16-gv_local.lookup_slx_nse[indx].nbits)) & 0xFFFF);
-          offset += 2;
-        }
-        else
-          _get_short (pesig, &offset, rbpos, &val, 1);
-
-        val = bswap_16 (val);
-        _put_short (val, posig, &pos, wbpos);
-      }
-    }
-
-    _s_undelta_4_channel (fix_seq_len, sizeof(uint16_t), posig, osize);
-
-    pesig = posig;
-    ssize = osize;
-    osize = osize << 1;
-    posig = sra_alloc (dst, alt, osize);
-
-    _s_exponent_4_channel (fix_seq_len, posig, osize, pesig, ssize, sim.fval, snm.fval);
-  }
-  else
-  if (magic == SRA_CT_UNCOMPRESSED || magic == SRA_CT_NORMALIZED || magic == SRA_CT_BASELINED)
-  {
-    assert ((osize&3) == 0); /* make shure it can be devided by 4 */
-    osize *= 2;              /* desination size is 4 bytes per channel, but the original is 2 */
-
-    posig = sra_alloc (dst, alt, osize);
-
-    _s_decode_slx (magic, pesig, posig, osize, offset, rbpos, ssize);
-  }
-
-  assert ( osize <= dst -> elem_count );
-  KDataBufferResize ( dst, osize );
-
-  return 0;
-}
-
diff --git a/libs/sraxf/v0-decompress.h b/libs/sraxf/v0-decompress.h
deleted file mode 100644
index c144ce4..0000000
--- a/libs/sraxf/v0-decompress.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _SRA_DECOMPRESS_HEADER
-#define _SRA_DECOMPRESS_HEADER
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* sra compression types
- */
-#define SRA_CT_UNCOMPRESSED      0
-#define SRA_CT_HUFFMAN           1
-#define SRA_CT_ZLIB              2
-#define SRA_CT_NCBI2NA           3
-#define SRA_CT_NORMALIZED        4
-#define SRA_CT_BASELINED         5
-#define SRA_CT_PACKED            6
-#define SRA_CT_TRUNCATED         7
-#define SRA_CT_EXP10             8
-#define SRA_CT_TRANSLATE         9
-
-
-/* forward of KDataBuffer */
-struct KDataBuffer;
-
-
-/* blob header pseudo descriptions
- *  NB - all structs are single-byte aligned
- *
-struct HDR_454_POSITION
-{
-    uint8_t type;
-    uint16_t osize; -- double compressed, 2 headers total
-};
-
-struct HDR_454_READ
-{
-    uint8_t type;
-    uint16_t osize; -- 1 byte per base, i.e. row-length
-};
-
-struct HDR_454_QUALITY
-{
-    uint8_t type;
-    uint16_t osize; -- double compressed
-};
-
-struct HDR_454_CLIP
-{
-    uint8_t type;
-    uint32_t osize; -- zlib compressed
-};
-
-struct HDR_454_SIGNAL
-{
-    uint8_t type;
-    uint16_t osize; -- double compressed
-};
-
-struct HDR_SLX_ZLIB
-{
-    uint8_t type;
-    uint32_t osize; -- double compressed
-};
-
-struct HDR_SLX_QUALITY
-{
-    uint8_t type;
-    uint32_t osize;
-    uint8_t qmin;
-    uint8_t qmax;
-    uint16_t fixed_len;
-};
-
-struct HDR_SLX_READ
-{
-    uint8_t type;
-    uint32_t osize;
-    uint16_t fixed_len;
-};
-
-struct HDR_SLX_SIG_HUFFMAN
-{
-    uint8_t type;
-    uint32_t osize;
-    uint16_t fixed_len;
-    float sim;
-    float snm;
-};
-
-struct HDR_SLX_SIG_BASELINE -- or uncompressed
-{
-    uint8_t type;
-    uint32_t osize;
-    uint16_t fixed_len;
-    uint32_t baseline;
-};
-
-struct HDR_SLX_SIG_NORMALIZED
-{
-    uint8_t type;
-    uint32_t osize;
-    uint16_t fixed_len;
-    uint16_t min;
-    float scale;
-};
-
-*/
-
-/* decompression routines:
- * return a pointer to an allocated memory buffer and the size of the buffer in bytes
- * you would need to free(*dst) after its use
- *
- * parameters:
- *   platform = 1 (454), 2 (solexa)
- *   dst    - a pointer to a buffer into which an uncompressed data is written
- *   dsize  - the size of the incompressed data
- *   src    - compressed data source
- *   ssize  - size of compressed data
- *
- * return values: 0 - OK, 1 - error
- */
-void sra_decompress_init  (void);
-
-/* SIGNAL */
-int sra_decompress_sig_454(struct KDataBuffer *dst, struct KDataBuffer *alt, const void* src, int ssize);
-int sra_decompress_sig_slx(struct KDataBuffer *dst, struct KDataBuffer *alt, const void* src, int ssize);
-/* INTENSITY */
-int sra_decompress_int(struct KDataBuffer *dst, struct KDataBuffer *alt, const void* src, int ssize);
-/* NOISE */
-int sra_decompress_nse(struct KDataBuffer *dst, struct KDataBuffer *alt, const void* src, int ssize);
-/* QUALITY */
-int sra_decompress_prb_454(struct KDataBuffer *dst, struct KDataBuffer *alt, const void* src, int ssize);
-int sra_decompress_prb_slx(struct KDataBuffer *dst, struct KDataBuffer *alt, const void* src, int ssize);
-/* POSITION */
-int sra_decompress_pos(struct KDataBuffer *dst, struct KDataBuffer *alt, const void* src, int ssize);
-/* CLIP_QUALITY_ */
-int sra_decompress_clp(struct KDataBuffer *dst, struct KDataBuffer *alt, const void* src, int ssize);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/libs/sraxf/v0-funcs.c b/libs/sraxf/v0-funcs.c
deleted file mode 100644
index 61b4a5b..0000000
--- a/libs/sraxf/v0-funcs.c
+++ /dev/null
@@ -1,337 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include <sra/sradb.h>
-#include <vdb/xform.h>
-#include <vdb/vdb-priv.h>
-#include <klib/data-buffer.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <limits.h>
-
-#include <endian.h>
-#include <byteswap.h>
-
-#ifdef HTONL
-#undef HTONL
-#endif
-
-#ifdef HTONS
-#undef HTONS
-#endif
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define HTONL( x ) bswap_32 ( x )
-#define HTONS( x ) bswap_16 ( x )
-#else
-#define HTONL( x ) ( x )
-#define HTONS( x ) ( x )
-#endif
-
-#include "v0-decompress.h"
-
-static
-rc_t CC sra_read_decompress_454 ( void *self, const VXformInfo *info,
-    VLegacyBlobResult *rslt, const KDataBuffer *src )
-{
-    rc_t rc;
-    KDataBuffer *dst = rslt -> dst;
-    const uint8_t *p = src -> base;
-
-    uint32_t num_bases = HTONS ( * ( const uint16_t* ) & p [ 1 ] );
-    uint32_t hdr_size = 3;
-
-    /* make sub-buffer from input */
-    KDataBuffer tmp;
-    rc = KDataBufferCast ( src, & tmp, 8, false );
-    if ( rc == 0 )
-    {
-        KDataBufferWhack ( dst );
-        rc = KDataBufferSub ( & tmp, dst, hdr_size, UINT64_MAX );
-        if ( rc == 0 )
-        {
-            /* cast to 2na */
-            rc = KDataBufferCast ( dst, dst, 2, true );
-            if ( rc == 0 )
-            {
-                /* resize to actual number of bases */
-                assert ( num_bases <= dst -> elem_count );
-                rc = KDataBufferResize ( dst, num_bases );
-            }
-        }
-
-        KDataBufferWhack ( & tmp );
-    }
-
-    return rc;
-}
-
-static
-rc_t CC sra_read_decompress_slx ( void *self, const VXformInfo *info,
-    VLegacyBlobResult *rslt, const KDataBuffer *src )
-{
-    rc_t rc;
-    KDataBuffer tmp;
-    uint32_t hdr_size;
-    KDataBuffer *dst = rslt -> dst;
-    const uint8_t *p = src -> base;
-
-    uint32_t num_bases = HTONL ( * ( const uint32_t* ) & p [ 1 ] );
-    uint32_t row_len = HTONS ( * ( const uint16_t* ) & p [ 5 ] );
-    assert ( row_len != 0 );
-    assert ( num_bases % row_len == 0 );
-    hdr_size = 7;
-
-    /* make sub-buffer from input */
-    rc = KDataBufferCast ( src, & tmp, 8, false );
-    if ( rc == 0 )
-    {
-        KDataBufferWhack ( dst );
-        rc = KDataBufferSub ( & tmp, dst, hdr_size, UINT64_MAX );
-        if ( rc == 0 )
-        {
-            /* cast to 2na */
-            rc = KDataBufferCast ( dst, dst, 2, true );
-            if ( rc == 0 )
-            {
-                /* resize to actual number of bases */
-                assert ( num_bases <= dst -> elem_count );
-                rc = KDataBufferResize ( dst, num_bases );
-            }
-        }
-
-        KDataBufferWhack ( & tmp );
-    }
-
-    return rc;
-}
-
-VTRANSFACT_IMPL ( NCBI_SRA_decode_READ, 1, 0, 0 ) ( const void *self,
-    const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    VNoHdrBlobFunc f;
-    rslt -> variant = vftLegacyBlob;
-
-    /* the discriminator */
-    switch ( cp -> argv [ 0 ] . data . u8 [ 0 ] )
-    {
-    case SRA_PLATFORM_454:
-        f = sra_read_decompress_454;
-        break;
-    case SRA_PLATFORM_ILLUMINA:
-        f = sra_read_decompress_slx;
-        break;
-    default:
-        return RC ( rcSRA, rcFunction, rcConstructing, rcParam, rcInvalid );
-    }
-
-    /* DO NOT CHANGE ASSIGNMENT FROM "f"
-       we want the compiler to catch type mismatches */
-    rslt -> u . bf = ( VBlobFunc ) f;
-
-    return 0;
-}
-
-/* all of the functions have this prototype */
-typedef int ( * legacy_decompress_func ) ( KDataBuffer*, KDataBuffer*, const void*, int );
-
-/* function ids */
-enum
-{
-    sra_prb_454,
-    sra_prb_slx,
-    sra_sig_454,
-    sra_sig_slx,
-    sra_int,
-    sra_nse,
-    sra_clip,
-    sra_pos
-};
-
-static
-legacy_decompress_func funcs [] =
-{
-    sra_decompress_prb_454,
-    sra_decompress_prb_slx,
-    sra_decompress_sig_454,
-    sra_decompress_sig_slx,
-    sra_decompress_int,
-    sra_decompress_nse,
-    sra_decompress_clp,
-    sra_decompress_pos
-};
-
-static
-rc_t CC sra_legacy_decompress ( void *self, const VXformInfo *info,
-    VLegacyBlobResult *rslt, const KDataBuffer *src )
-{
-    int failed;
-    KDataBuffer *dst = rslt -> dst;
-
-    /* an initially empty buffer */
-    KDataBuffer alt;
-    KDataBufferMakeBytes ( & alt, 0 );
-
-    assert(KDataBufferBytes ( src ) < INT_MAX);
-    /* invoke the decompression function */
-    failed = funcs [ ( size_t ) self ] ( dst, & alt, src -> base, (int)KDataBufferBytes ( src ) );
-
-    /* whack any double buffer */
-    KDataBufferWhack ( & alt );
-
-    /* return non-descript status */
-    if ( failed )
-        return RC ( rcSRA, rcBlob, rcUnpacking, rcNoObj, rcUnknown );
-    return 0;
-}
-
-static
-rc_t sra_legacy_init ( void )
-{
-    static bool done;
-    if ( ! done )
-    {
-        sra_decompress_init ();
-        done = true;
-    }
-
-    return 0;
-}
-
-VTRANSFACT_IMPL ( NCBI_SRA_decode_QUALITY, 1, 0, 0 ) ( const void *self,
-    const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    /* DO NOT REMOVE THIS ASSIGNMENT
-       we want the compiler to catch type mismatches */
-    VNoHdrBlobFunc f = sra_legacy_decompress;
-    rslt -> u . bf = ( VBlobFunc ) f;
-    rslt -> variant = vftLegacyBlob;
-
-    /* the discriminator */
-    switch ( cp -> argv [ 0 ] . data . u8 [ 0 ] )
-    {
-    case SRA_PLATFORM_454:
-        rslt -> self = ( void* ) sra_prb_454;
-        break;
-    case SRA_PLATFORM_ILLUMINA:
-        rslt -> self = ( void* ) sra_prb_slx;
-        break;
-    default:
-        return RC ( rcSRA, rcFunction, rcConstructing, rcParam, rcInvalid );
-    }
-
-    return sra_legacy_init ();
-}
-
-VTRANSFACT_IMPL ( NCBI_SRA_decode_SIGNAL, 1, 0, 0 ) ( const void *self,
-    const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    /* DO NOT REMOVE THIS ASSIGNMENT
-       we want the compiler to catch type mismatches */
-    VNoHdrBlobFunc f = sra_legacy_decompress;
-    rslt -> u . bf = ( VBlobFunc ) f;
-    rslt -> variant = vftLegacyBlob;
-
-    /* the discriminator */
-    switch ( cp -> argv [ 0 ] . data . u8 [ 0 ] )
-    {
-    case SRA_PLATFORM_454:
-        rslt -> self = ( void* ) sra_sig_454;
-        break;
-    case SRA_PLATFORM_ILLUMINA:
-        rslt -> self = ( void* ) sra_sig_slx;
-        break;
-    default:
-        return RC ( rcSRA, rcFunction, rcConstructing, rcParam, rcInvalid );
-    }
-
-    return sra_legacy_init ();
-}
-
-VTRANSFACT_IMPL ( NCBI_SRA_decode_INTENSITY, 1, 0, 0 ) ( const void *self,
-    const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    /* DO NOT REMOVE THIS ASSIGNMENT
-       we want the compiler to catch type mismatches */
-    VNoHdrBlobFunc f = sra_legacy_decompress;
-    rslt -> u . bf = ( VBlobFunc ) f;
-    rslt -> variant = vftLegacyBlob;
-
-    /* the discriminator */
-    rslt -> self = ( void* ) sra_int;
-
-    return sra_legacy_init ();
-}
-
-VTRANSFACT_IMPL ( NCBI_SRA_decode_NOISE, 1, 0, 0 ) ( const void *self,
-    const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    /* DO NOT REMOVE THIS ASSIGNMENT
-       we want the compiler to catch type mismatches */
-    VNoHdrBlobFunc f = sra_legacy_decompress;
-    rslt -> u . bf = ( VBlobFunc ) f;
-    rslt -> variant = vftLegacyBlob;
-
-    /* the discriminator */
-    rslt -> self = ( void* ) sra_nse;
-
-    return sra_legacy_init ();
-}
-
-VTRANSFACT_IMPL ( NCBI_SRA_decode_CLIP, 1, 0, 0 ) ( const void *self,
-    const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    /* DO NOT REMOVE THIS ASSIGNMENT
-       we want the compiler to catch type mismatches */
-    VNoHdrBlobFunc f = sra_legacy_decompress;
-    rslt -> u . bf = ( VBlobFunc ) f;
-    rslt -> variant = vftLegacyBlob;
-
-    /* the discriminator */
-    rslt -> self = ( void* ) sra_clip;
-
-    return sra_legacy_init ();
-}
-
-VTRANSFACT_IMPL ( NCBI_SRA_decode_POSITION, 1, 0, 0 ) ( const void *self,
-    const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    /* DO NOT REMOVE THIS ASSIGNMENT
-       we want the compiler to catch type mismatches */
-    VNoHdrBlobFunc f = sra_legacy_decompress;
-    rslt -> u . bf = ( VBlobFunc ) f;
-    rslt -> variant = vftLegacyBlob;
-
-    /* the discriminator */
-    rslt -> self = ( void* ) sra_pos;
-
-    return sra_legacy_init ();
-}
diff --git a/libs/sraxf/varloc.c b/libs/sraxf/varloc.c
deleted file mode 100644
index 2698110..0000000
--- a/libs/sraxf/varloc.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-#include <insdc/insdc.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/table.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <bitstr.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-
-/****************************** tokenize_var_id *******************************/
-/* typedef uint16_t text_token [ 3 ]; */
-
-static
-rc_t CC tokenize_var_id ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc = 0;
-    int pos = 0;
-    unsigned const var_id_len = argv[0].u.data.elem_count;
-    struct
-    {
-        uint16_t token_type;
-        uint16_t position;
-        uint16_t length;
-    } *dst;
-    const char *var_id	= argv[0].u.data.base;
-    var_id += argv[0].u.data.first_elem;
-    
-    rslt->data->elem_bits = sizeof(dst[0]) * 8;
-    rc = KDataBufferResize( rslt -> data, 2 );
-    if ( rc != 0 ) return rc;
-    rslt -> elem_count = 2;
-    dst = rslt -> data -> base;
-    memset(dst, 0, 2 * sizeof *dst);
- 
-    /* ([A-Za-z]*)(\d*) */
-    if (var_id_len > 0) {
-        for (pos = var_id_len - 1; pos >= 0; --pos) {
-            if (var_id[pos] < '0' || var_id[pos] > '9') {
-                ++pos;
-                break;
-            }
-            if (pos == 0) { /* all numbers */
-                break;
-            }
-        }
-    }
-    dst [ 1 ] . position = pos;
-    dst [ 1 ] . length = var_id_len - pos;
-    dst [ 0 ] . length = var_id_len - dst [ 1 ] . length;
-
-    return rc;
-}
-
-/* 
- * tokenize_var_id
- *   splits into 2 tokens
- *   0 - prefix
- *   1 - suffix
- *
- * extern function
- * text:token NCBI:var:tokenize_var_id #1 ( ascii var_id );
- */
-VTRANSFACT_IMPL ( NCBI_var_tokenize_var_id, 1, 0, 0 ) ( const void *Self,
-    const VXfactInfo *info, VFuncDesc *rslt,
-    const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->u.rf = tokenize_var_id;
-    rslt->variant = vftRow;
-    return 0;
-}
diff --git a/libs/vdb/Makefile b/libs/vdb/Makefile
deleted file mode 100644
index e0ea319..0000000
--- a/libs/vdb/Makefile
+++ /dev/null
@@ -1,180 +0,0 @@
-# ===========================================================================
-#
-#                            PUBLIC DOMAIN NOTICE
-#               National Center for Biotechnology Information
-#
-#  This software/database is a "United States Government Work" under the
-#  terms of the United States Copyright Act.  It was written as part of
-#  the author's official duties as a United States Government employee and
-#  thus cannot be copyrighted.  This software/database is freely available
-#  to the public for use. The National Library of Medicine and the U.S.
-#  Government have not placed any restriction on its use or reproduction.
-#
-#  Although all reasonable efforts have been taken to ensure the accuracy
-#  and reliability of the software and data, the NLM and the U.S.
-#  Government do not and cannot warrant the performance or results that
-#  may be obtained by using this software or data. The NLM and the U.S.
-#  Government disclaim all warranties, express or implied, including
-#  warranties of performance, merchantability or fitness for any particular
-#  purpose.
-#
-#  Please cite the author in any work or product based on this material.
-#
-# ===========================================================================
-
-
-default: std
-
-TOP ?= $(shell ../../build/abspath.sh ../..)
-MODULE = libs/vdb
-
-INT_LIBS = \
-	libvdb \
-	libwvdb
-
-ALL_LIBS = \
-	$(INT_LIBS)
-
-include $(TOP)/build/Makefile.env
-
-#-------------------------------------------------------------------------------
-# outer targets
-#
-all std: makedirs
-	@ $(MAKE_CMD) $(TARGDIR)/std
-
-$(INT_LIBS): makedirs
-	@ $(MAKE_CMD) $(ILIBDIR)/$@
-
-.PHONY: all std $(ALL_LIBS)
-
-#-------------------------------------------------------------------------------
-# std
-#
-$(TARGDIR)/std: \
-	$(addprefix $(ILIBDIR)/,$(INT_LIBS))
-
-.PHONY: $(TARGDIR)/all $(TARGDIR)/std
-
-#-------------------------------------------------------------------------------
-# clean
-#
-clean: stdclean
-
-.PHONY: clean
-
-#-------------------------------------------------------------------------------
-# virtual db library
-#
-$(ILIBDIR)/libvdb: $(addprefix $(ILIBDIR)/libvdb.,$(ILIBEXT))
-
-VDBCMN_SRC = \
-	dbmgr-cmn \
-	schema-tok \
-	schema-parse \
-	schema-type \
-	schema-func \
-	schema-prod \
-	schema-expr \
-	schema-eval \
-	schema-tbl \
-	schema-db \
-	schema-dump \
-	schema-int \
-	schema \
-	linker-int \
-	linker-cmn \
-	database-cmn \
-	database-depend \
-	database-load \
-	table-cmn \
-	table-load \
-	cursor-cmn \
-	column-cmn \
-	prod-cmn \
-	prod-expr \
-	prod-func \
-	phys-cmn \
-	phys-load \
-	blob \
-	blob-headers \
-	page-map \
-	row-id \
-	row-len \
-	fixed-row-len \
-	merge \
-	split \
-	compare \
-	meta-read \
-	meta-value \
-	meta-attr-read \
-	cast \
-	range-validate \
-	parameter-read \
-	redimension \
-	index_project \
-	index_lookup \
-	transpose \
-	delta_average \
-	report-vdb
-
-VDB_SRC = \
-	$(VDBCMN_SRC) \
-	dbmgr \
-	linker \
-	database \
-	table \
-	cursor \
-	column \
-	prod \
-	phys
-
-VDB_OBJ = \
-	$(addsuffix .$(LOBX),$(VDB_SRC))
-
-VDB_LIB = \
-	-dkdb \
-	-dvfs \
-	-dkfg \
-	-dkfs \
-	-dkproc \
-	-dklib \
-	-dz
-
-$(ILIBDIR)/libvdb.$(LIBX): $(VDB_OBJ)
-	$(LD) --slib -o $@ $^ $(VDB_LIB)
-
-#-------------------------------------------------------------------------------
-# update version
-#
-$(ILIBDIR)/libwvdb: $(addprefix $(ILIBDIR)/libwvdb.,$(ILIBEXT))
-
-WVDB_SRC = \
-	$(VDBCMN_SRC) \
-	wdbmgr \
-	wlinker \
-	wdatabase \
-	wtable \
-	wcursor \
-	wcolumn \
-	wprod \
-	wphys \
-	meta-write \
-	meta-attr-write \
-	meta-append \
-	index_insert
-
-WVDB_OBJ = \
-	$(addsuffix .$(LOBX),$(WVDB_SRC))
-
-WVDB_LIB = \
-	-dwkdb \
-	-dvfs \
-	-dkfg \
-	-dkfs \
-	-dkproc \
-	-dklib \
-	-dz
-
-$(ILIBDIR)/libwvdb.$(LIBX): $(WVDB_OBJ)
-	$(LD) --slib -o $@ $^ $(WVDB_LIB)
diff --git a/libs/vdb/blob-headers.c b/libs/vdb/blob-headers.c
deleted file mode 100644
index da2db3e..0000000
--- a/libs/vdb/blob-headers.c
+++ /dev/null
@@ -1,726 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <vdb/extern.h>
-#include <klib/rc.h>
-#include <klib/vlen-encode.h>
-#include <klib/data-buffer.h>
-#include "blob-headers.h"
-#include <vdb/xform.h>
-#include <atomic32.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stddef.h>
-#include <assert.h>
-
-struct VBlobHeaderData {
-    int64_t *args;
-    uint8_t *ops;
-    atomic32_t refcount;
-    uint32_t op_count;
-    uint32_t arg_count;
-    uint64_t osize;
-    uint8_t flags;
-    uint8_t version;
-    uint32_t fmt;
-    bool read_only;
-    bool args_alloc;
-    bool ops_alloc;
-};
-
-struct VBlobHeaderVT {
-    void ( * destroy )( struct VBlobHeader * );
-};
-
-struct VBlobHeader {
-    const struct VBlobHeaderVT *vt;
-    const struct BlobHeaders *parent;
-    const struct VBlobHeaderData *owned;
-    atomic32_t refcount;
-    int32_t op_head;
-    int32_t op_tail;
-    int32_t op_cap;
-    int32_t arg_head;
-    int32_t arg_tail;
-    int32_t arg_cap;
-};
-
-struct BlobHeaders {
-    struct VBlobHeaderData *data;
-    const BlobHeaders *link;
-    atomic32_t refcount;
-};
-
-struct BlobHeaderDummy {
-    struct VBlobHeader hdr;
-    struct BlobHeaders dummy;
-    struct VBlobHeaderData data;
-};
-
-static void VBlobHeaderDestroy( struct VBlobHeader * );
-static void VBlobHeaderDummyDestroy( struct VBlobHeader * );
-static const struct VBlobHeaderVT VBlobHeader_vt[] = { { VBlobHeaderDestroy }, { VBlobHeaderDummyDestroy } };
-
-static void VBlobHeaderDataWhack( struct VBlobHeaderData *that )
-{
-    if (that)
-    {
-        if (that->args_alloc)
-            free(that->args);
-        if (that->ops_alloc)
-            free(that->ops);
-        free(that);
-    }
-}
-
-static rc_t VBlobHeaderDataDestroy( struct VBlobHeaderData *that ) {
-    VBlobHeaderDataWhack(that);
-    return 0;
-}
-
-static rc_t VBlobHeaderDataRelease( const struct VBlobHeaderData *self ) {
-    if (self && atomic32_dec_and_test(&(((struct VBlobHeaderData *)self)->refcount)))
-        return VBlobHeaderDataDestroy((struct VBlobHeaderData *)self);
-    return 0;
-}
-
-#if 0
-static rc_t VBlobHeaderDataAddRef ( const struct VBlobHeaderData *self ) {
-    if (self)
-        atomic32_inc(&(((struct VBlobHeaderData *)self)->refcount));
-    return 0;
-}
-#endif
-
-static int VBlobHeaderDataGetExclusiveOwnership( struct VBlobHeaderData *self ) {
-    if (atomic32_read_and_add(&self->refcount, 1) == 1)
-        return 1;
-    return 0;    
-}
-
-static void BlobHeadersWhack( BlobHeaders *that ) {
-    free( that );
-}
-
-static rc_t BlobHeadersDestroy( BlobHeaders *that ) {
-    const BlobHeaders *link = that->link;
-    
-    VBlobHeaderDataRelease(that->data);
-    BlobHeadersWhack(that);
-    BlobHeadersRelease(link);
-    return 0;
-}
-
-rc_t BlobHeadersAddRef ( const BlobHeaders *self ) {
-    if (self)
-        atomic32_inc(&(((BlobHeaders *)self)->refcount));
-    return 0;
-}
-
-rc_t BlobHeadersRelease ( const BlobHeaders *self ) {
-    if (self && atomic32_dec_and_test(&(((BlobHeaders *)self)->refcount)))
-        return BlobHeadersDestroy((BlobHeaders *)self);
-    return 0;
-}
-
-#if 0
-static int BlobHeadersGetExclusiveOwnership( BlobHeaders *self ) {
-    if (atomic32_read_and_add(&self->refcount, 1) == 1)
-        return 1;
-    return 0;    
-}
-#endif
-
-static rc_t BlobHeadersCreateInternal ( BlobHeaders **lhs, unsigned ops, unsigned args ) {
-    BlobHeaders *y = calloc(1, sizeof *y);
-
-    *lhs = NULL;
-    if (y) {
-        atomic32_set(&y->refcount, 1);
-        y->data = calloc(1, sizeof(*y->data) + args * sizeof(y->data->args[0]) + ops);
-        if (y->data) {
-            atomic32_set(&y->data->refcount, 1);
-            if (args) {
-                y->data->args = (void *)(&y->data[1]);
-                if (ops) {
-                    y->data->ops = (void *)(&y->data->args[args]);
-                    y->data->op_count = ops;
-                }
-                y->data->arg_count = args;
-            }
-            else if (ops) {
-                y->data->ops = (void *)(&y->data[1]);
-                y->data->op_count = ops;
-            }
-            *lhs = y;
-            
-            return 0;
-        }
-        free(y);
-    }
-    return RC(rcVDB, rcHeader, rcConstructing, rcMemory, rcExhausted);
-}
-
-rc_t BlobHeadersCreate( BlobHeaders **lhs )
-{
-    return BlobHeadersCreateInternal( lhs, 0, 0 );
-}
-
-uint32_t BlobHeadersGetMaxBufferSize ( const BlobHeaders *self )
-{
-    uint32_t y = 1;
-    const BlobHeaders *x = self;
-    const uint32_t per_header = 25;
-    
-    while (x) {
-        y += per_header + x->data ? (x->data->op_count + x->data->arg_count * 10) : 0;
-        x = x->link;
-    }
-    return y;
-}
-
-static rc_t deserialize_v0(BlobHeaders **dst, const uint8_t *src, uint64_t ssize);
-
-rc_t BlobHeadersCreateFromData ( BlobHeaders **lhs, const uint8_t *src, uint64_t ssize )
-{
-    rc_t rc;
-    BlobHeaders *y;
-    
-    if (src == NULL)
-        return RC(rcVDB, rcHeader, rcConstructing, rcParam, rcNull);
-    if (ssize < 1)
-        return RC(rcVDB, rcHeader, rcConstructing, rcData, rcInsufficient);
-    
-    switch (*src) {
-    case 0:
-        rc = deserialize_v0(&y, src + 1, ssize - 1);
-        if (rc == 0)
-            *lhs = y;
-        break;
-    default:
-        rc = RC(rcVDB, rcHeader, rcConstructing, rcData, rcBadVersion);
-        break;
-    }
-    return rc;
-}
-
-static rc_t serialize1( const BlobHeaders *self, KDataBuffer *buffer, uint64_t offset, uint64_t *size ) {
-    uint8_t flags = 0;
-    uint8_t version = 0;
-    uint32_t fmt = 0;
-    uint64_t osize = 0;
-    uint32_t op_count = 0;
-    uint32_t arg_count = 0;
-    rc_t rc;
-    uint64_t sz;
-    uint8_t *dst;
-    uint64_t dsize;
-
-    if (self->data) {
-        version = self->data->version;
-        flags = self->data->flags;
-        fmt = self->data->fmt;
-        osize = self->data->osize;
-        op_count = self->data->op_count;
-        arg_count = self->data->arg_count;
-    }
-    sz = 2 + 4 * 5 + op_count + arg_count * 10;
-    rc = KDataBufferResize(buffer, sz + offset);
-    if (rc)
-        return rc;
-
-    dst = buffer->base;
-    dst += offset;
-    dsize = buffer->elem_count - offset;
-    
-    *dst++ = flags; --dsize;
-    *dst++ = version; --dsize;
-    
-    rc = vlen_encode1(dst, dsize, &sz, fmt);
-    if (rc)
-        return rc;
-    dst += sz; dsize -= sz;
-    
-    rc = vlen_encode1(dst, dsize, &sz, osize);
-    if (rc)
-        return rc;
-    dst += sz; dsize -= sz;
-    
-    rc = vlen_encode1(dst, dsize, &sz, op_count);
-    if (rc)
-        return rc;
-    dst += sz; dsize -= sz;
-    
-    rc = vlen_encode1(dst, dsize, &sz, arg_count);
-    if (rc)
-        return rc;
-    dst += sz; dsize -= sz;
-    
-    if (op_count > 0) {
-        memcpy(dst, self->data->ops, op_count);
-        dst += op_count;
-        dsize -= op_count;
-    }
-    if (arg_count > 0) {
-        rc = vlen_encode(dst, dsize, &sz, self->data->args, arg_count);
-        if (rc)
-            return rc;
-        dst += sz; /* dsize -= sz */;
-    }
-    *size = (uint64_t)( dst - (uint8_t *)buffer->base );
-    return 0;
-}
-
-static rc_t deserialize_v0( BlobHeaders **dst, const uint8_t *src, uint64_t ssize ) {
-    uint8_t flags;
-    uint8_t version;
-    uint32_t fmt;
-    uint64_t osize;
-    uint32_t op_count;
-    uint32_t arg_count;
-    int64_t x;
-    uint64_t sz;
-    rc_t rc;
-    BlobHeaders *y;
-
-    *dst = NULL;
-    
-    if (ssize < 2)
-        return RC(rcVDB, rcHeader, rcConstructing, rcData, rcInsufficient);
-
-    flags = *src++; --ssize;
-    version = *src++; --ssize;
-    
-    rc = vlen_decode1(&x, src, ssize, &sz);
-    if (rc)
-        return ResetRCContext(rc, rcVDB, rcHeader, rcConstructing);
-    src += sz; 
-	ssize -= sz;
-    fmt = (uint32_t)x;
-    
-    rc = vlen_decode1(&x, src, ssize, &sz);
-    if (rc)
-        return ResetRCContext(rc, rcVDB, rcHeader, rcConstructing);
-    src += sz; 
-	ssize -= sz;
-    osize = (uint32_t)x;
-    
-    rc = vlen_decode1(&x, src, ssize, &sz);
-    if (rc)
-        return ResetRCContext(rc, rcVDB, rcHeader, rcConstructing);
-    src += sz; 
-	ssize -= sz;
-    op_count = (uint32_t)x;
-    
-    rc = vlen_decode1(&x, src, ssize, &sz);
-    if (rc)
-        return ResetRCContext(rc, rcVDB, rcHeader, rcConstructing);
-    src += sz; 
-	ssize -= sz;
-    arg_count = (uint32_t)x;
-
-    rc = BlobHeadersCreateInternal(&y, op_count, arg_count);
-    if (rc)
-        return rc;
-    
-    y->data->flags = flags;
-    y->data->version = version;
-    y->data->fmt = fmt;
-    y->data->osize = osize;
-    y->data->read_only = true;
-
-    if (op_count > 0) {
-        if (ssize < op_count) {
-            BlobHeadersRelease(y);
-            return RC(rcVDB, rcHeader, rcConstructing, rcData, rcInsufficient);
-        }
-        memcpy(y->data->ops, src, op_count);
-        src += op_count; ssize -= op_count;
-    }        
-    if (arg_count > 0) {
-        rc = vlen_decode(y->data->args, arg_count, src, ssize, &sz);
-        if (rc) {
-            BlobHeadersRelease(y);
-            return ResetRCContext(rc, rcVDB, rcHeader, rcConstructing);
-        }
-        src += sz; ssize -= sz;
-    }
-    if (ssize) {
-        BlobHeaders *link;
-        
-        rc = deserialize_v0(&link, src, ssize);
-        if (rc) {
-            BlobHeadersRelease(y);
-            return rc;
-        }
-        y->link = link;
-    }
-    *dst = y;
-    return 0;
-}
-
-static rc_t serialize( const BlobHeaders *self, KDataBuffer *buffer, uint64_t offset, uint64_t *sz ) {
-    rc_t rc;
-
-    rc = serialize1(self, buffer, offset, sz);
-    if (rc == 0 && self->link)
-        rc = serialize(self->link, buffer, *sz, sz);
-    return rc;
-}
-
-rc_t BlobHeadersSerialize ( BlobHeaders *self, KDataBuffer *buffer,
-        uint64_t offset, uint64_t *psz )
-{
-    rc_t rc;
-    uint64_t sz = 0;
-    
-    assert(buffer->elem_bits == 8);
-    assert(buffer->bit_offset == 0);
-    
-    rc = KDataBufferResize(buffer, 1);
-    if (rc)
-        return rc;
-    ((uint8_t *)(buffer->base))[offset] = 0;
-    rc = serialize(self, buffer, offset + 1, &sz);
-    *psz = sz - offset;
-    return rc;
-}
-
-rc_t BlobHeadersCreateChild ( BlobHeaders *self, BlobHeaders **new_hdr ) 
-{
-    BlobHeaders *y;
-    rc_t rc;
-
-    *new_hdr = NULL;
-    rc = BlobHeadersCreate(&y);
-    if (rc == 0) {
-        y->link = self;
-        BlobHeadersAddRef(y->link);
-        *new_hdr = y;
-        return 0;
-    }
-    return rc;
-}
-
-VBlobHeader *BlobHeadersCreateDummyHeader ( uint8_t version, uint32_t fmt, uint8_t flags, uint64_t size )
-{
-    struct BlobHeaderDummy *y;
-    
-    y = calloc(1, sizeof(*y));
-    if (y) {
-        y->data.fmt = fmt;
-        y->data.version = version;
-        y->data.osize = size;
-        y->data.flags = flags;
-        atomic32_set(&y->data.refcount, 1);
-
-        y->dummy.data = &y->data;
-        atomic32_set(&y->dummy.refcount, 1);
-        
-        y->hdr.vt = &VBlobHeader_vt[1];
-        y->hdr.parent = &y->dummy;
-        atomic32_set(&y->hdr.refcount, 1);
-        
-        return &y->hdr;
-    }
-    return 0;
-}
-
-const BlobHeaders *BlobHeadersGetNextFrame( const BlobHeaders *cself ) {
-    return cself ? cself->link : 0;
-}
-
-const BlobHeaders *BlobHeadersPop( const BlobHeaders *cself ) {
-    const BlobHeaders *y = BlobHeadersGetNextFrame(cself);
-    BlobHeadersAddRef(y);
-    BlobHeadersRelease(cself);
-    return y;
-}
-
-VBlobHeader *BlobHeadersGetHeader ( const BlobHeaders *self )
-{
-    VBlobHeader *y = calloc(1, sizeof(*y));
-    
-    if (y) {
-        y->vt = &VBlobHeader_vt[0];
-        atomic32_set(&y->refcount, 1);
-        y->parent = self;
-        BlobHeadersAddRef(y->parent);
-        if (self->data) {
-            y->op_tail = self->data->op_count;
-            y->arg_tail = self->data->arg_count;
-        }
-    }
-    return y;
-}
-
-VBlobHeader *BlobHeadersGetHdrWrite ( BlobHeaders *self ) {
-    VBlobHeader *y = BlobHeadersGetHeader(self);
-    
-    if (y) {
-        if (self->data && !self->data->read_only) {
-            if (VBlobHeaderDataGetExclusiveOwnership(self->data)) {
-                y->owned = self->data;
-                return y;
-            }
-        }
-        VBlobHeaderRelease(y);
-    }
-    return NULL;
-}
-
-static void VBlobHeaderDummyDestroy( VBlobHeader *that ) {
-    free(that);
-}
-
-static void VBlobHeaderDestroy( VBlobHeader *that ) {
-    VBlobHeaderDataRelease(that->owned);
-    BlobHeadersRelease(that->parent);
-    free(that);
-}
-
-LIB_EXPORT rc_t CC VBlobHeaderRelease ( const VBlobHeader *cself ) {
-    VBlobHeader *self = (VBlobHeader *)cself;
-    
-    if (self && atomic32_dec_and_test(&self->refcount))
-        self->vt->destroy(self);
-    return 0;
-}
-
-rc_t VBlobHeaderAddRef ( const VBlobHeader *self ) {
-    if (self)
-        atomic32_inc(&(((VBlobHeader *)self)->refcount));
-    return 0;
-}
-
-LIB_EXPORT rc_t CC VBlobHeaderCreateFork ( const VBlobHeader *self, VBlobHeader **rslt ) {
-    if (self == NULL)
-        return RC(rcVDB, rcHeader, rcCopying, rcSelf, rcNull);
-    
-    if (self->parent == NULL)
-        return RC(rcVDB, rcHeader, rcCopying, rcSelf, rcInvalid);
-    
-    if (rslt == NULL)
-        return RC(rcVDB, rcHeader, rcCopying, rcParam, rcNull);
-    
-    *rslt = BlobHeadersCreateDummyHeader(self->parent->data->version, self->parent->data->fmt, 0, self->parent->data->osize);
-    if (*rslt)
-        return 0;
-    return RC(rcVDB, rcHeader, rcCopying, rcMemory, rcInsufficient);
-}
-
-rc_t VBlobHeaderReplace( VBlobHeader *targ, const VBlobHeader *src ) {
-    BlobHeaders *parent;
-    struct VBlobHeaderData *data;
-    atomic32_t temp;
-    
-    if (src == NULL || targ == NULL)
-        return RC(rcVDB, rcHeader, rcCopying, rcParam, rcNull);
-
-    if (src->vt != &VBlobHeader_vt[1] || targ->vt != &VBlobHeader_vt[0])
-        return RC(rcVDB, rcHeader, rcCopying, rcParam, rcInvalid);
-    
-    if (atomic32_read(&targ->refcount) != 1)
-        return RC(rcVDB, rcHeader, rcCopying, rcParam, rcInvalid);
-    
-    data = calloc(1, sizeof(*data));
-    if (data == NULL)
-        return RC(rcVDB, rcHeader, rcCopying, rcMemory, rcExhausted);
-
-    *data = *src->parent->data;
-    atomic32_set(&data->refcount, 1);
-    
-    parent = (BlobHeaders *)targ->parent;
-    VBlobHeaderDataRelease(parent->data);
-    parent->data = data;
-    
-    atomic32_set(&temp, atomic32_read(&src->refcount));
-    *targ = *src;
-    atomic32_set(&targ->refcount, atomic32_read(&temp));
-    targ->parent = parent;
-    targ->vt = &VBlobHeader_vt[0];
-    
-    return 0;
-}
-
-rc_t VBlobHeaderOpPushHead ( VBlobHeader *self, uint8_t op )
-{
-    return RC(rcVDB, rcHeader, rcWriting, rcInterface, rcUnsupported);
-}
-
-rc_t VBlobHeaderArgPushHead ( VBlobHeader *self, int64_t arg )
-{
-    return RC(rcVDB, rcHeader, rcWriting, rcInterface, rcUnsupported);
-}
-
-#define MIN_ALLOC 16
-
-LIB_EXPORT rc_t CC VBlobHeaderOpPushTail ( VBlobHeader *self, uint8_t op )
-{
-    struct VBlobHeaderData *data;
-    
-    assert(self);
-    assert(self->parent);
-    data = self->parent->data;
-    assert(data);
-    assert(!data->read_only);
-    
-    if (data->ops == NULL) {
-        data->ops = malloc(MIN_ALLOC);
-        if (data->ops == NULL)
-            return RC(rcVDB, rcHeader, rcWriting, rcMemory, rcExhausted);
-        self->op_cap = MIN_ALLOC;
-    }
-    
-    assert(self->op_tail <= self->op_cap);
-    
-    if (self->op_tail == self->op_cap) {
-        uint32_t size = self->op_cap;
-        void *temp = realloc(data->ops, size += size);
-        
-        if (temp == NULL)
-            return RC(rcVDB, rcHeader, rcWriting, rcMemory, rcExhausted);
-        data->ops = temp;
-        self->op_cap = size;
-    }
-    data->ops[self->op_tail++] = op;
-    ++data->op_count;
-    data->ops_alloc = true;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC VBlobHeaderArgPushTail ( VBlobHeader *self, int64_t arg )
-{
-    struct VBlobHeaderData *data;
-    
-    assert(self);
-    assert(self->parent);
-    data = self->parent->data;
-    assert(data);
-    assert(!data->read_only);
-    
-    if (data->args == NULL) {
-        data->args = malloc(MIN_ALLOC * sizeof(data->args[0]));
-        if (data->args == NULL)
-            return RC(rcVDB, rcHeader, rcWriting, rcMemory, rcExhausted);
-        self->arg_cap = MIN_ALLOC;
-    }
-    
-    assert(self->arg_tail <= self->arg_cap);
-    
-    if (self->arg_tail == self->arg_cap) {
-        uint32_t size = self->arg_cap;
-        void *temp = realloc(data->args, (size += size) * sizeof(data->args[0]));
-        
-        if (temp == NULL)
-            return RC(rcVDB, rcHeader, rcWriting, rcMemory, rcExhausted);
-        data->args = temp;
-        self->arg_cap = size;
-    }
-    data->args[self->arg_tail++] = arg;
-    ++data->arg_count;
-    data->args_alloc = true;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC VBlobHeaderOpPopHead ( const VBlobHeader *self, uint8_t *op )
-{
-    if (self->op_head >= self->op_tail || self->op_head >= (int32_t)self->parent->data->op_count)
-        return RC(rcVDB, rcHeader, rcReading, rcData, rcExhausted);
-    *op = self->parent->data->ops[self->op_head];
-    ++((VBlobHeader *)self)->op_head;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC VBlobHeaderOpPopTail ( const VBlobHeader *self, uint8_t *op )
-{
-    if (self->op_tail < self->op_head || self->op_tail < 0)
-        return RC(rcVDB, rcHeader, rcReading, rcData, rcExhausted);
-    *op = self->parent->data->ops[self->op_tail];
-    --((VBlobHeader *)self)->op_tail;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC VBlobHeaderArgPopHead ( const VBlobHeader *self, int64_t *arg )
-{
-    if (self->arg_head >= self->arg_tail || self->arg_head >= (int32_t)self->parent->data->arg_count || self->parent->data->args == NULL)
-        return RC(rcVDB, rcHeader, rcReading, rcData, rcExhausted);
-    *arg = self->parent->data->args[self->arg_head];
-    ++((VBlobHeader *)self)->arg_head;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC VBlobHeaderArgPopTail ( const VBlobHeader *self, int64_t *arg )
-{
-    if (self->arg_tail < self->arg_head || self->arg_tail < 0 || self->parent->data->args == NULL)
-        return RC(rcVDB, rcHeader, rcReading, rcData, rcExhausted);
-    *(uint64_t *)arg = self->parent->data->args[self->arg_tail];
-    --((VBlobHeader *)self)->arg_tail;
-    return 0;
-}
-
-LIB_EXPORT uint8_t CC VBlobHeaderVersion ( const VBlobHeader *self )
-{
-    return self->parent->data->version;
-}
-
-LIB_EXPORT void CC VBlobHeaderSetVersion ( VBlobHeader *self, uint8_t version )
-{
-    self->parent->data->version = version;
-}
-
-uint8_t VBlobHeaderFlags ( const VBlobHeader *self )
-{
-    return self->parent->data->flags & 0x7F;
-}
-
-void VBlobHeaderSetFlags ( VBlobHeader *self, uint8_t flags )
-{
-    self->parent->data->flags = (self->parent->data->flags & 0x80) | (flags & 0x7F);
-}
-
-uint32_t VBlobHeaderFormat ( const VBlobHeader *self )
-{
-    return self->parent->data->fmt;
-}
-
-void VBlobHeaderSetFormat ( VBlobHeader *self, uint32_t fmt )
-{
-    self->parent->data->fmt = fmt;
-}
-
-uint64_t VBlobHeaderSourceSize ( const VBlobHeader *self )
-{
-    return self->parent->data->osize;
-}
-
-void VBlobHeaderSetSourceSize ( VBlobHeader *self, uint64_t ssize )
-{
-    self->parent->data->osize = ssize;
-}
diff --git a/libs/vdb/blob-headers.h b/libs/vdb/blob-headers.h
deleted file mode 100644
index 110bb4a..0000000
--- a/libs/vdb/blob-headers.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-struct KDataBuffer;
-typedef struct BlobHeaders BlobHeaders;
-
-/* add ref and release */
-rc_t BlobHeadersAddRef( const BlobHeaders *self );
-rc_t BlobHeadersRelease( const BlobHeaders *self );
-
-/* constructors */
-
-/* create a new header stack */
-rc_t BlobHeadersCreate( BlobHeaders **lhs );
-
-/* add a new header frame to the stack */
-rc_t BlobHeadersCreateChild( BlobHeaders *self, BlobHeaders **child );
-
-/* create header stack from serialization */
-rc_t BlobHeadersCreateFromData( BlobHeaders **lhs, const uint8_t *src, uint64_t ssize );
-
-/* move down the header stack
- * you will need to AddRef the result pointer
- * before releasing the argument pointer
- */
-const BlobHeaders *BlobHeadersGetNextFrame( const BlobHeaders *cself );
-
-/* this is a convenience function to
- * pop the current frame off the stack
- * returns the new current frame
- *  get next frame
- *  addref next frame
- *  release current frame
- *  return next frame
- *
- * The idea is to do
- *  headers = BlobHeadersPop(headers);
- */
-const BlobHeaders *BlobHeadersPop( const BlobHeaders *cself );
-
-/* a worst-case estimate of how many bytes
- * the serialization will take
- */
-uint32_t BlobHeadersGetMaxBufferSize( const BlobHeaders *self );
-
-/* serialize the whole stack
- *
- * Params:
- *  self: (in) top of the stack
- *  buffer: (in/out) the data buffer to write into
- *  offset: (in) number of bytes into buffer to start writing at
- */
-rc_t BlobHeadersSerialize( BlobHeaders *self, struct KDataBuffer *buffer, uint64_t offset, uint64_t *sz );
-
-/* get the header in the current frame */
-/* for read */
-struct VBlobHeader *BlobHeadersGetHeader( const BlobHeaders *self );
-struct VBlobHeader *BlobHeadersGetHdrWrite( BlobHeaders *self );
-struct VBlobHeader *BlobHeadersCreateDummyHeader( uint8_t version, uint32_t fmt, uint8_t flags, uint64_t size );
-
-
-/* VBlobHeader stuff */
-rc_t VBlobHeaderAddRef ( struct VBlobHeader const *self );
-
-#if NOT_DEFINED_IN_VDB_XFORM_H
-uint8_t VBlobHeaderVersion( const struct VBlobHeader *self );
-void VBlobHeaderSetVersion( struct VBlobHeader *self, uint8_t version );
-#endif
-
-uint8_t VBlobHeaderFlags( const struct VBlobHeader *self );
-void VBlobHeaderSetFlags( struct VBlobHeader *self, uint8_t flags );
-
-uint32_t VBlobHeaderFormatId( const struct VBlobHeader *self );
-void VBlobHeaderSetFormat( struct VBlobHeader *self, uint32_t fmt );
-
-uint64_t VBlobHeaderSourceSize( const struct VBlobHeader *self );
-void VBlobHeaderSetSourceSize( struct VBlobHeader *self, uint64_t ssize );
-
-
-/* Replace
- *  replace contents of "self" with the contents of "src"
- *
- *  after running multiple processes in parallel, one header must
- *  be chosen to associate with the output blob. use this function
- *  to set ...
- */
-rc_t VBlobHeaderReplace ( struct VBlobHeader *self, struct VBlobHeader const *src );
diff --git a/libs/vdb/blob-priv.h b/libs/vdb/blob-priv.h
deleted file mode 100644
index 625e979..0000000
--- a/libs/vdb/blob-priv.h
+++ /dev/null
@@ -1,200 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#ifndef _h_blob_priv_
-#define _h_blob_priv_
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifndef _h_vdb_blob_
-#include <vdb/blob.h>
-#endif
-
-#ifndef _h_klib_refcount_
-#include <klib/refcount.h>
-#endif
-
-#ifndef _h_klib_data_buffer_
-#include <klib/data-buffer.h>
-#endif
-
-#ifndef _h_vdb_xform_
-#include <vdb/xform.h>
-#endif
-
-#define TRACKING_BLOBS 0
-#if TRACKING_BLOBS
-#include <stdio.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-    
-#if _DEBUGGING
-#define VBLOG_HAS_NAME 1
-#endif
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct PageMap;
-struct BlobHeaders;
-struct VProduction;
-struct VBlobPageMapCache;
-
-typedef struct PageMapProcessRequest{
-    struct PageMap *pm;        /**** deserialized form **/
-    KDataBuffer data;   /**** serialized   form **/
-    uint32_t    row_count;
-    uint64_t    elem_count;
-    rc_t rc;            /**** results **/
-
-    volatile enum {
-        ePMPR_STATE_NONE=0,
-        ePMPR_STATE_SERIALIZE_REQUESTED,
-        ePMPR_STATE_DESERIALIZE_REQUESTED,
-        ePMPR_STATE_SERIALIZE_DONE,
-        ePMPR_STATE_DESERIALIZE_DONE,
-	ePMPR_STATE_EXIT
-    } state;            /**** request state      **/
-    struct KLock      *lock;
-    struct KCondition *cond;
-} PageMapProcessRequest;
-
-
-/*--------------------------------------------------------------------------
- * VBlob
- */
-struct VBlob
-{
-    int64_t start_id;
-    int64_t stop_id;
-    
-    struct PageMap *pm;
-    struct BlobHeaders *headers;
-    struct VBlobPageMapCache *spmc; /* cache for split */
-    KDataBuffer data;
-    KRefcount refcount;
-
-/*    uint32_t row_count; */ /* == stop_id + 1 - start_id */
-    bool no_cache;
-    VByteOrder byte_order;
-#if VBLOG_HAS_NAME
-    const char name[32];
-#endif
-};
-
-struct VBlobPageMapCache {
-    int n;
-    struct PageMap *pm[1];
-};
-
-#define BlobBufferBits(BLOB) ((uint64_t)KDataBufferBits(&(BLOB)->data))
-#define BlobBufferBytes(BLOB) ((size_t)(KDataBufferBytes(&(BLOB)->data)))
-#define BlobRowCount(BLOB) ((uint32_t)( (uint64_t)((BLOB)->stop_id - (BLOB)->start_id) == UINT64_MAX ? UINT32_MAX : (BLOB)->stop_id + 1 - (BLOB)->start_id ))
-
-#if TRACKING_BLOBS
-/* #define TRACK_BLOB(f,p) fprintf(stderr, "%s %p %d %s:%d:%s\n",#f,(void*)p,*(int*)(&p->refcount),__FILE__,__LINE__,__func__) */
-#define TRACK_BLOB(f,p) fprintf(stderr, "+++++ %s %p %d %s:%d\n",#f,(void*)(p),p?*(int*)(&(p)->refcount):0,__func__,__LINE__)
-#else
-#define TRACK_BLOB(f,p)
-#endif
-
-rc_t VBlobNew( VBlob **lhs, int64_t start_id, int64_t stop_id, const char *name );
-
-/* use inline-able addref and release on blobs
-   within the library for efficiency */
-#if 1
-#define VBlobAddRef( self ) \
-    ( ( ( self ) == NULL ) ? \
-      0 : ( atomic32_inc ( & ( self ) -> refcount ), 0 ) )
-#define VBlobRelease( self ) \
-    ( ( ( self ) == NULL || atomic32_read_and_add_gt ( & ( self ) -> refcount, -1, 1 ) > 1 ) ? \
-      0 : VBlobRelease ( self ) )
-#endif
-
-#if _DEBUGGING
-void VBlobCheckIntegrity ( const VBlob *self );
-#else
-#define VBlobCheckIntegrity( self ) \
-  ( void ) 0
-#endif
-
-rc_t VBlobCreateFromData(
-                         struct VBlob **lhs,
-                         int64_t start_id, int64_t stop_id,
-                         const KDataBuffer *src,
-                         uint32_t elem_bits,
-			 PageMapProcessRequest const *pmpr
-);
-
-rc_t VBlobCreateFromSingleRow(
-                              struct VBlob **lhs,
-                              int64_t start_id, int64_t stop_id,
-                              const KDataBuffer *src,
-                              VByteOrder byte_order
-);
-/*** VBlob as a new array; meaning fixed len,data_run(..)=1 **/
-rc_t VBlobNewAsArray(struct VBlob **lhs, int64_t start_id, int64_t stop_id, uint32_t rowlen, uint32_t elem_bits); 
-    
-rc_t VBlobSerialize( const VBlob *self, KDataBuffer *result );
-
-bool VBlobIsSingleRow( const VBlob *self );
-
-uint32_t VBlobFixedRowLength( const struct VBlob *self );
-
-rc_t VBlobAppend( struct VBlob *self, const struct VBlob *other );
-/**** finds start_id in a blob and builds sub-blob for the number or repetitions ***/
-rc_t VBlobSubblob( const struct VBlob *self,struct VBlob **sub, int64_t start_id );
-
-void VBlobPageMapOptimize( struct VBlob **self );
-
-#define LAST_BLOB_CACHE_SIZE 256
-
-
-typedef struct VBlobMRUCache VBlobMRUCache; /** forward declaration **/
-typedef  struct VBlobMRUCacheCursorContext {  /** to be used to pass cache context down to production level ***/
-	VBlobMRUCache * cache;
-	uint32_t	col_idx;
-} VBlobMRUCacheCursorContext;
-
-VBlobMRUCache * VBlobMRUCacheMake(uint64_t capacity );
-void VBlobMRUCacheDestroy( VBlobMRUCache *self );
-const VBlob* VBlobMRUCacheFind(const VBlobMRUCache *cself, uint32_t col_idx, int64_t row_id);
-rc_t VBlobMRUCacheSave(const VBlobMRUCache *cself, uint32_t col_idx, const VBlob *blob);
-
-
-rc_t PageMapProcessGetPagemap(const PageMapProcessRequest *self,struct PageMap **pm);
-
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* _h_blob_priv_ */
diff --git a/libs/vdb/blob.c b/libs/vdb/blob.c
deleted file mode 100644
index e8ffc4a..0000000
--- a/libs/vdb/blob.c
+++ /dev/null
@@ -1,1569 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <vdb/extern.h>
- 
-#define TRACK_REFERENCES 0
-
-#include "page-map.h"
-#include "blob-headers.h"
-#include "blob.h"
-#include "blob-priv.h"
-#include <klib/rc.h>
-#include <klib/defs.h>
-#include <byteswap.h>
-#include <klib/data-buffer.h>
-#include <klib/container.h>
-#include <klib/vlen-encode.h>
-#include <kdb/btree.h>
-#include <vdb/schema.h>
-#include <vdb/xform.h>
-#include <klib/log.h>
-#include <sysalloc.h>
-#include <bitstr.h>
-
-#include <kproc/timeout.h>
-#include <kproc/lock.h>
-#include <kproc/cond.h>
-
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-#include <os-native.h>
-
-#include <stdio.h> /* temp for debugging */
-
-#if _DEBUGGING
-void VBlobCheckIntegrity ( const VBlob *self )
-{
-    if ( self != NULL )
-    {
-        rc_t rc = KDataBufferCheckIntegrity ( & self -> data );
-        if ( rc != 0 )
-        {
-            fprintf ( stderr, "AAAAAH!\n" );
-        }
-    }
-}
-#endif
-
-rc_t VBlobNew ( VBlob **lhs, int64_t start_id, int64_t stop_id, const char *name ) {
-    VBlob *y;
-    
-    if ( name == NULL )
-        name = "";
-#if VBLOG_HAS_NAME
-    *lhs = y = malloc(sizeof(*y) + strlen(name));
-#else
-    *lhs = y = calloc(1, sizeof(*y));
-#endif
-    if (y) {
-        KRefcountInit(&y->refcount, 1, "VBlob", "new", name);
-        y->start_id = start_id;
-        y->stop_id = stop_id;
-        y->data.elem_bits = 1;
-        y->byte_order = vboNative;
-#if VBLOG_HAS_NAME
-        y->pm = NULL;
-        y->headers = NULL;
-        y->spmc = NULL;
-        memset(&y->data, 0, sizeof(y->data));
-        y->no_cache = 0;
-        strcpy(&(((char *)y->name)[0]), name);
-#endif
-        
-        return 0;
-    }
-    return RC(rcVDB, rcBlob, rcConstructing, rcMemory, rcExhausted);
-}
-rc_t VBlobNewAsArray(struct VBlob **lhs, int64_t start_id, int64_t stop_id, uint32_t rowlen, uint32_t elem_bits)
-{
-	VBlob *y;
-	rc_t rc = VBlobNew(&y,start_id,stop_id,NULL);
-	if(rc == 0){
-		rc = KDataBufferMake(&y->data,elem_bits,rowlen*(stop_id-start_id+1));
-		if(rc == 0){
-			rc=PageMapNewFixedRowLength(&y->pm,stop_id-start_id+1,rowlen);
-			if(rc == 0){
-				*lhs = y;
-				return 0;
-			}
-			PageMapRelease(y->pm);
-		}
-		VBlobRelease(y);
-	}
-	return rc;
-}
-
-static rc_t VBlobDestroy( VBlob *that ) {
-    if (that->spmc) {
-        int i;
-        
-        for (i = 0; i != that->spmc->n; ++i)
-            PageMapRelease(that->spmc->pm[i]);
-        free(that->spmc);
-    }
-    KDataBufferWhack(&that->data);
-    BlobHeadersRelease(that->headers);
-    PageMapRelease(that->pm);
-    free(that);
-    return 0;
-}
-
-static rc_t decode_header_byte_v2(
-                                  uint8_t header_byte,
-                                  uint8_t *variant,
-                                  uint8_t *adjust,
-                                  VByteOrder *byte_order
-) {
-    *adjust = (8 - (header_byte & 7)) & 7; header_byte >>= 3;
-    *byte_order = (header_byte & 1) ? vboBigEndian : vboLittleEndian;
-    header_byte >>= 1;
-    *variant = header_byte & 3;
-    header_byte >>= 2;
-    return header_byte == 2 ? 0 : RC(rcVDB, rcBlob, rcReading, rcData, rcBadVersion);
-}
-
-static rc_t decode_header_v2_0(
-                               const uint8_t *src,
-                               uint64_t ssize,
-                               uint32_t *hdr_size,
-                               uint32_t *map_size,
-                               uint32_t *offset
-) {
-    *offset = 3;
-    if (ssize < *offset)
-        return RC(rcVDB, rcBlob, rcConstructing, rcData, rcInsufficient);
-    
-    *hdr_size = src[1];
-    *map_size = src[2];
-    return 0;
-}
-
-static rc_t decode_header_v2_1(
-                               const uint8_t *src,
-                               uint64_t ssize,
-                               uint32_t *hdr_size,
-                               uint32_t *map_size,
-                               uint32_t *offset
-) {
-    *offset = 4;
-    if (ssize < *offset)
-        return RC(rcVDB, rcBlob, rcConstructing, rcData, rcInsufficient);
-    
-    *hdr_size = src[1];
-    *map_size = (uint32_t)src[2] | ((uint32_t)src[3] << 8);
-    return 0;
-}
-
-static rc_t decode_header_v2_2(
-                               const uint8_t *src,
-                               uint64_t ssize,
-                               uint32_t *hdr_size,
-                               uint32_t *map_size,
-                               uint32_t *offset
-) {
-    *offset = 6;
-    if (ssize < *offset)
-        return RC(rcVDB, rcBlob, rcConstructing, rcData, rcInsufficient);
-    
-    *hdr_size = src[1];
-    *map_size = (uint32_t)src[2] | ((uint32_t)src[3] << 8) | ((uint32_t)src[4] << 16) | ((uint32_t)src[5] << 24);
-    return 0;
-}
-
-static rc_t decode_header_v2_3(
-                               const uint8_t *src,
-                               uint64_t ssize,
-                               uint32_t *hdr_size,
-                               uint32_t *map_size,
-                               uint32_t *offset
-) {
-    *offset = 9;
-    if (ssize < *offset)
-        return RC(rcVDB, rcBlob, rcConstructing, rcData, rcInsufficient);
-    
-    *hdr_size = (uint32_t)src[1] | ((uint32_t)src[2] << 8) | ((uint32_t)src[3] << 16) | ((uint32_t)src[4] << 24);
-    *map_size = (uint32_t)src[5] | ((uint32_t)src[6] << 8) | ((uint32_t)src[7] << 16) | ((uint32_t)src[8] << 24);
-    return 0;
-}
-
-static rc_t decode_header_v2(
-                             const uint8_t *src,
-                             uint64_t ssize,
-                             uint32_t *hdr_size,
-                             uint32_t *map_size,
-                             uint32_t *offset,
-                             uint8_t *adjust,
-                             VByteOrder *byte_order
-) {
-    rc_t rc;
-    uint8_t variant;
-    
-    if (ssize == 0)
-        return RC(rcVDB, rcBlob, rcConstructing, rcData, rcInsufficient);
-
-    rc = decode_header_byte_v2(src[0], &variant, adjust, byte_order);
-    if (rc)
-        return rc;
-
-    switch (variant) {
-    case 0:
-        return decode_header_v2_0(src, ssize, hdr_size, map_size, offset);
-    case 1:
-        return decode_header_v2_1(src, ssize, hdr_size, map_size, offset);
-    case 2:
-        return decode_header_v2_2(src, ssize, hdr_size, map_size, offset);
-    case 3:
-        return decode_header_v2_3(src, ssize, hdr_size, map_size, offset);
-    default:
-        return RC(rcVDB, rcBlob, rcConstructing, rcData, rcBadVersion);
-    }
-}
-
-static rc_t encode_header_v1(
-                             uint8_t *dst,
-                             uint64_t dsize,
-                             uint64_t *used,
-                             uint32_t row_length,
-                             bitsz_t data_size,
-                             VByteOrder byte_order
-) {
-    /* byte-order goes in bits 0..1 */
-    uint8_t header_byte = byte_order & 3;
-    if ( header_byte == vboNative )
-    {
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-        header_byte = ( uint8_t) vboLittleEndian;
-#else
-        header_byte = ( uint8_t) vboBigEndian;
-#endif
-    }
-
-    /* blob size adjust goes in bits 2..4 */
-    header_byte |= ( ( 8 - ( data_size & 7 ) ) & 7 ) << 2;
-    
-    /* row-length code goes in bits 5..6 */
-    if ( row_length == 1 ) {
-        header_byte |= 3 << 5;
-        * used = 1;
-        if ( dsize < * used )
-            return RC(rcVDB, rcBlob, rcConstructing, rcBuffer, rcInsufficient);
-        dst[0] = header_byte;
-    }
-    else if (row_length < 0x100) {
-        *used = 2;
-        if (dsize < *used)
-            return RC(rcVDB, rcBlob, rcConstructing, rcBuffer, rcInsufficient);
-        dst[0] = header_byte;
-        dst[1] = ( uint8_t ) row_length;
-    }
-    else if (row_length < 0x10000) {
-        header_byte |= 1 << 5;
-        *used = 3;
-        if (dsize < *used)
-            return RC(rcVDB, rcBlob, rcConstructing, rcBuffer, rcInsufficient);
-        dst[0] = header_byte;
-        dst[1] = ( uint8_t ) row_length;
-        dst[2] = ( uint8_t ) ( row_length >> 8 );
-    }
-    else {
-        header_byte |= 2 << 5;
-        *used = 5;
-        if (dsize < *used)
-            return RC(rcVDB, rcBlob, rcConstructing, rcBuffer, rcInsufficient);
-        dst[0] = header_byte;
-        dst[1] = ( uint8_t ) row_length;
-        dst[2] = ( uint8_t ) ( row_length >> 8 );
-        dst[3] = ( uint8_t ) ( row_length >> 16 );
-        dst[4] = ( uint8_t ) ( row_length >> 24 );
-    }
-    return 0;
-}
-
-static rc_t encode_header_v2(
-                             uint8_t *dst,
-                             uint64_t dsize,
-                             uint64_t *used,
-                             uint64_t hdr_size,
-                             uint64_t map_size,
-                             bitsz_t data_size
-) {
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-    uint8_t header_byte = 0x80 | ( (uint8_t)data_size & 7 );
-#else
-    uint8_t header_byte = 0x88 | ( (uint8_t)data_size & 7 );
-#endif
-    
-    assert(hdr_size >> 32 == 0);
-    assert(map_size >> 32 == 0);
-    
-    if ((hdr_size >> 8) == 0) {
-        if ((map_size >> 8) == 0) {
-            *used = 3;
-            if (dsize < *used)
-                return RC(rcVDB, rcBlob, rcConstructing, rcBuffer, rcInsufficient);
-            
-            dst[0] = header_byte;
-            dst[1] = hdr_size;
-            dst[2] = map_size;
-        }
-        else if ((map_size >> 16) == 0) {
-            *used = 4;
-            if (dsize < *used)
-                return RC(rcVDB, rcBlob, rcConstructing, rcBuffer, rcInsufficient);
-            
-            dst[0] = header_byte | 0x10;
-            dst[1] = hdr_size;
-            dst[2] = map_size;
-            dst[3] = map_size >> 8;
-        }
-        else {
-            *used = 6;
-            if (dsize < *used)
-                return RC(rcVDB, rcBlob, rcConstructing, rcBuffer, rcInsufficient);
-
-            dst[0] = header_byte | 0x20;
-            dst[1] = hdr_size;
-            dst[2] = map_size;
-            dst[3] = map_size >> 8;
-            dst[4] = map_size >> 16;
-            dst[5] = map_size >> 24;
-        }
-    }
-    else {
-        *used = 9;
-        if (dsize < *used)
-            return RC(rcVDB, rcBlob, rcConstructing, rcBuffer, rcInsufficient);
-
-        dst[0] = header_byte | 0x30;
-
-        dst[1] = hdr_size;
-        dst[2] = hdr_size >> 8;
-        dst[3] = hdr_size >> 16;
-        dst[4] = hdr_size >> 24;
-
-        dst[5] = map_size;
-        dst[6] = map_size >> 8;
-        dst[7] = map_size >> 16;
-        dst[8] = map_size >> 24;
-    }
-    return 0;
-}
-
-static
-rc_t PageMapProcessRequestLock(PageMapProcessRequest *self)
-{
-	rc_t rc=RC(rcVDB,rcPagemap, rcConstructing, rcSelf, rcNull);
-	if(self){
-		/*** no plans to wait here the thread should be released by now ****/
-		rc = KLockAcquire(self->lock);
-		if(rc == 0){
-			if(self->state != ePMPR_STATE_NONE){ /*** thread is not released yet **/
-				assert(0); /** should not happen ***/
-				KLockUnlock(self->lock);
-				rc=RC(rcVDB, rcPagemap, rcConstructing, rcThread, rcBusy);
-			}
-		}
-	}
-	return rc;
-}
-
-static
-void PageMapProcessRequestLaunch(PageMapProcessRequest *self)
-{
-	KConditionSignal ( self -> cond );
-	KLockUnlock(self -> lock);
-}
-
-rc_t PageMapProcessGetPagemap(const PageMapProcessRequest *cself,struct PageMap **pm)
-{
-	rc_t rc=RC(rcVDB,rcPagemap, rcConstructing, rcSelf, rcNull);
-        if(cself){
-	    PageMapProcessRequest *self=(PageMapProcessRequest*)cself;
-	    if(self->lock == NULL){
-		/** NOT LOCKABLE **/
-		rc=0;
-	    } else if((rc = KLockAcquire ( self->lock ))==0){
-CHECK_AGAIN:
-		switch(self->state){
-		 case ePMPR_STATE_DESERIALIZE_REQUESTED:
-			/*fprintf(stderr,"Waiting for pagemap %p\n",cself->lock);*/
-			rc = KConditionWait ( self -> cond, self -> lock );
-                        goto CHECK_AGAIN;
-		 case ePMPR_STATE_DESERIALIZE_DONE:
-			assert(self->pm);
-			/*fprintf(stderr,"Pagemap %p Used R:%6d|DR:%d|LR:%d\n",self->lock, self->pm->row_count,self->pm->data_recs,self->pm->leng_recs);*/
-			*pm=self->pm;
-			self->pm = NULL;
-			KDataBufferWhack(&self->data);
-			self->row_count = 0;
-			self->state = ePMPR_STATE_NONE;
-			KConditionSignal(self->cond);
-			KLockUnlock(self -> lock);
-			break;
-		case ePMPR_STATE_NONE: /* not requested */
-			KLockUnlock(self -> lock);
-		    rc = 0;
-		    break;
-		 default: /** should never happen ***/
-			assert(0);
-			KLockUnlock(self -> lock);
-			return RC(rcVDB, rcPagemap, rcConverting, rcParam, rcInvalid );
-		}
-	    }
-        }
-        return rc;
-}
-
-
-static
-rc_t VBlobCreateFromData_v2(
-                            VBlob **lhs,
-                            const KDataBuffer *data,
-                            int64_t start_id, int64_t stop_id,
-                            uint32_t elem_bits, PageMapProcessRequest *pmpr
-) {
-    uint64_t ssize = data->elem_count;
-    uint32_t hsize;
-    uint32_t msize;
-    uint32_t offset;
-    VByteOrder byte_order;
-    uint8_t adjust;
-    VBlob *y;
-    uint32_t data_offset;
-    uint32_t pagemap_offset;
-    bitsz_t databits;
-    uint32_t elem_count;
-    uint8_t *src = data->base;
-    rc_t rc;
-    
-    rc = decode_header_v2(src, ssize, &hsize, &msize, &offset, &adjust, &byte_order);
-    if (rc)
-        return rc;
-
-    if (ssize < offset + hsize + msize)
-        return RC(rcVDB, rcBlob, rcConstructing, rcData, rcInsufficient);
-    
-    pagemap_offset = offset + hsize;
-    data_offset = pagemap_offset + msize;
-    assert(data_offset <= ssize);
-    ssize -= data_offset;
-    databits = (ssize << 3) - adjust;
-    assert(databits % elem_bits == 0);
-    elem_count = (uint32_t)( databits / elem_bits );
-
-    rc = VBlobNew(&y, start_id, stop_id, NULL);
-    TRACK_BLOB (VBlobNew, y);
-    if (rc == 0) {
-        if (hsize)
-            rc = BlobHeadersCreateFromData(&y->headers, src+offset , hsize);
-        if (rc == 0) {
-            if (msize > 0) {
-                if(PageMapProcessRequestLock(pmpr)==0) {
-                    KDataBufferSub(data, &pmpr->data, pagemap_offset, msize);
-                    pmpr->row_count = BlobRowCount(y);
-                    pmpr->state = ePMPR_STATE_DESERIALIZE_REQUESTED;
-                    /*fprintf(stderr,"Pagemap %p Requested R:%6d|SZ:%d|%ld:%ld\n",pmpr->lock, pmpr->row_count,msize,start_id, stop_id);*/
-                    PageMapProcessRequestLaunch(pmpr);
-                }
-                else {
-                    KDataBuffer tdata;
-                    KDataBufferSub(data, &tdata, pagemap_offset, msize);
-                    rc = PageMapDeserialize(&y->pm, tdata.base,tdata.elem_count, BlobRowCount(y));
-                    KDataBufferWhack(&tdata);
-                }
-            }
-            if (rc == 0) {
-                KDataBufferSub(data, &y->data, data_offset, ssize);
-                y->data.elem_bits = elem_bits;
-                y->data.elem_count = elem_count;
-                y->byte_order = byte_order;
-                *lhs = y;
-                return 0;
-            }
-        }
-        (void)VBlobRelease(y);
-        TRACK_BLOB (VBlobRelease, y);
-    }
-    return rc;
-}
-
-static
-rc_t VBlobCreateFromData_v1(
-                            VBlob **lhs,
-                            const KDataBuffer *data,
-                            int64_t start_id, int64_t stop_id,
-                            uint32_t elem_bits
-) {
-    const uint8_t *src = data->base;
-    uint64_t ssize = data->elem_count;
-    uint8_t header;
-    rc_t rc;
-    VBlob *y;
-    VByteOrder byte_order;
-    uint32_t offset;
-    int adjust;
-    int rls; /* row length size */
-    uint64_t row_len;
-    bitsz_t databits;
-    
-    if (ssize == 0)
-        return RC(rcVDB, rcBlob, rcConstructing, rcData, rcInsufficient);
-    
-    header = *src;
-    byte_order = header & 3; header >>= 2;
-    adjust = header & 7;
-    header >>= 3;
-    rls = header & 3;
-    
-    /* convert rls from a code to an actual length */
-    rls = "\x01\x02\x04\x00" [ rls ];
-
-    /* adjust offset */
-    offset = rls + 1;
-
-    /* handle special code where row length is implicitly 1 */
-    if ( rls == 0 )
-        row_len = 1;
-
-    /* ensure sufficient header bytes */
-    else if ( ssize < offset )
-        return RC(rcVDB, rcBlob, rcConstructing, rcData, rcInsufficient);
-    else
-    {
-        /* produce little-endian 64-bit row-length */
-        row_len = 0;
-        memcpy ( & row_len, & src [ 1 ], rls );
-
-#if __BYTE_ORDER != __LITTLE_ENDIAN
-        /* correct for big-endian */
-        row_len = bswap_64 ( row_len );
-#endif
-    }
-
-    ssize -= offset;
-    databits = (ssize << 3) - adjust;
-    assert(databits % elem_bits == 0);
-
-    rc = VBlobNew(&y, start_id, stop_id, NULL);
-    TRACK_BLOB (VBLobNew, y);
-    if (rc == 0) {
-
-        uint64_t row_count = BlobRowCount ( y );
-
-        /* test for badly formed row-length */
-        if ( rls == 4 )
-        {
-            assert ( row_len != 0 );
-            if ( row_len * row_count != databits / elem_bits )
-            {
-                /* we can fix a length if we know the count */
-                if ( row_count != 0 )
-                    row_len = ( databits / elem_bits ) / row_count;
-                else
-                {
-                    /* rely on code to handle legacy blobs in prod-cmn.c:VFunctionProdCallByteswap */
-                    row_len = 0;
-                }
-            }
-        }
-
-        if ( row_len != 0 )
-            rc = PageMapNewFixedRowLength( &y->pm, row_count, row_len );
-        if (rc == 0) {
-            KDataBufferSub(data, &y->data, offset, ssize);
-            y->data.elem_bits = elem_bits;
-            y->data.elem_count = (uint32_t)( databits / elem_bits );
-            y->byte_order = byte_order;
-			
-            *lhs = y;
-            return 0;
-        }
-        /* like a call to VBlobRelease (y); */
-        TRACK_BLOB (VBlobRelease-free, y);
-        free(y);
-    }
-    return rc;
-}
-
-static void VBlobOptimize_UnRLE_uint8_t(VBlob **vblobp)
-{
-	VBlob   *sblob  = *vblobp;
-	VBlob *vblob;
-	rc_t rc = VBlobNewAsArray(&vblob,sblob -> start_id, sblob -> stop_id,sblob->pm->length[0],sblob->data.elem_bits);
-	if( rc == 0){
-		uint32_t i,j;
-		uint8_t *src=sblob->data.base;
-		uint8_t *dst=vblob->data.base;
-		for(i=j=0;i<sblob->pm->data_recs;i++){
-			row_count_t data_len=sblob->pm->data_run[i];
-			while(data_len > 0){
-				assert(j < sblob->pm->row_count);
-				dst[j++] = src[i];
-				data_len--;
-			}
-		}
-		vblob->pm->optimized = eBlobPageMapOptimizedSucceeded;
-		VBlobRelease(sblob);
-		(*vblobp) = vblob;
-	}
-}
-static void VBlobOptimize_UnRLE_uint16_t(VBlob **vblobp)
-{
-	VBlob   *sblob  = *vblobp;
-	VBlob *vblob;
-	rc_t rc = VBlobNewAsArray(&vblob,sblob -> start_id, sblob -> stop_id,sblob->pm->length[0],sblob->data.elem_bits);
-	if( rc == 0) {
-		uint32_t i,j;
-		uint16_t *src=sblob->data.base;
-		uint16_t *dst=vblob->data.base;
-		for(i=j=0;i<sblob->pm->data_recs;i++){
-			row_count_t data_len=sblob->pm->data_run[i];
-			while(data_len > 0){
-				assert(j < sblob->pm->row_count);
-				dst[j++] = src[i];
-				data_len--;
-			}
-		}
-		vblob->pm->optimized = eBlobPageMapOptimizedSucceeded;
-		VBlobRelease(sblob);
-		(*vblobp) = vblob;
-	}
-}
-static void VBlobOptimize_UnRLE_uint32_t(VBlob **vblobp)
-{
-	VBlob   *sblob  = *vblobp;
-	VBlob *vblob;
-	rc_t rc = VBlobNewAsArray(&vblob,sblob -> start_id, sblob -> stop_id,sblob->pm->length[0],sblob->data.elem_bits);
-	if( rc == 0) {
-		uint32_t i,j;
-		uint32_t *src=sblob->data.base;
-		uint32_t *dst=vblob->data.base;
-		for(i=j=0;i<sblob->pm->data_recs;i++){
-			row_count_t data_len=sblob->pm->data_run[i];
-			while(data_len > 0){
-				assert(j < sblob->pm->row_count);
-				dst[j++] = src[i];
-				data_len--;
-			}
-		}
-		vblob->pm->optimized = eBlobPageMapOptimizedSucceeded;
-		VBlobRelease(sblob);
-		(*vblobp) = vblob;
-	}
-}
-static void VBlobOptimize_UnRLE_uint64_t(VBlob **vblobp)
-{
-	VBlob   *sblob  = *vblobp;
-	VBlob *vblob;
-	rc_t rc = VBlobNewAsArray(&vblob,sblob -> start_id, sblob -> stop_id,sblob->pm->length[0],sblob->data.elem_bits);
-	if( rc == 0) {
-		uint32_t i,j;
-		uint64_t *src=sblob->data.base;
-		uint64_t *dst=vblob->data.base;
-		for(i=j=0;i<sblob->pm->data_recs;i++){
-			row_count_t data_len=sblob->pm->data_run[i];
-			while(data_len > 0){
-				assert(j < sblob->pm->row_count);
-				dst[j++] = src[i];
-				data_len--;
-			}
-		}
-		vblob->pm->optimized = eBlobPageMapOptimizedSucceeded;
-		VBlobRelease(sblob);
-		(*vblobp) = vblob;
-	}
-}
-
-
-void VBlobPageMapOptimize ( VBlob **vblobp)
-{
-	VBlob   *sblob  = *vblobp;
-	PageMap *pm     = sblob->pm;
-	if(pm->optimized != eBlobPageMapOptimizedNone) return; /* do not optimize previously optimized blobs */
-	pm->optimized = eBlobPageMapOptimizedFailed; /*** prevent future optimization if none of the algorithms succeeds ***/
-
-	if(pm->leng_recs == 1)
-    {
-		if( pm->length[0] * sblob->data.elem_bits == 8 /** 1 byte data ***/
-		    &&  pm->data_recs < pm->row_count       /** rle was used ***/
-		    &&  pm->data_recs * 6 > pm->row_count){ /** but not super efficiently **/
-			/*printf("OPTIMIZATION: UnRLE(8)\n");*/
-			VBlobOptimize_UnRLE_uint8_t(vblobp); 
-			return;
-		}
-		if( pm->length[0] * sblob->data.elem_bits == 16 /** 2 byte data ***/
-		    &&  pm->data_recs < pm->row_count       /** rle was used ***/
-		    &&  pm->data_recs * 2 > pm->row_count){ /** but not super efficiently **/
-			/*printf("OPTIMIZATION: UnRLE(16)\n");*/
-			VBlobOptimize_UnRLE_uint16_t(vblobp);
-			return;
-		}
-		if( pm->length[0] * sblob->data.elem_bits == 32 /** 4 byte data ***/
-		    &&  pm->data_recs < pm->row_count       /** rle was used ***/
-		    &&  pm->data_recs * 15 > pm->row_count * 10 ){ /** but not super efficiently **/
-			/*printf("OPTIMIZATION: UnRLE(32)\n");*/
-			VBlobOptimize_UnRLE_uint32_t(vblobp);
-			return;
-		}
-		if( pm->length[0] * sblob->data.elem_bits == 64 /** 8 byte data ***/
-		    &&  pm->data_recs < pm->row_count       /** rle was used ***/
-		    &&  pm->data_recs * 11 > pm->row_count * 10 ){ /** but not super efficiently **/
-			/*printf("OPTIMIZATION: UnRLE(64)\n");*/
-			VBlobOptimize_UnRLE_uint64_t(vblobp);
-			return;
-		}
-
-	}
-
-	if(pm->row_count > 1024 && (sblob->data.elem_bits & 7) == 0)
-    {
-		elem_count_t	minlen,maxlen;
-		elem_count_t	elem_sz = sblob->data.elem_bits/8;
-		rc_t rc = PageMapRowLengthRange(pm, &minlen,&maxlen);
-		if( rc == 0  && maxlen*elem_sz > 2 && maxlen*elem_sz <= 2048 /* do not optimize super large entries */){ 
-		/******* TRY dictionary **/
-			int64_t		limit_vocab_size;
-			uint32_t	vocab_cnt=0;
-			KBTree		*vocab_key2id = NULL;
-			bool		valid_data_run = (pm->row_count != pm->data_recs);
-			uint32_t	*data_offset = NULL;
-			KDataBuffer     new_data;
-
-			rc=KDataBufferMake(&new_data,sblob->data.elem_bits,0); /** no allocation - shoulf not fail at all **/
-			assert(rc==0);
-/*******************
-* another formula
-* the savings should not be less than the waste on pointers into data vocabulary
-* it is assumed that the data offsets will cost us not more than 2 bytes on disk
-* the nasty left part is the average number of bytes in a row
-* limit_vocab_size = ((int64_t)sblob->data.elem_count*elem_sz - 2*pm->row_count) * sblob->data.elem_count / pm->data_recs / elem_sz;
-****************/
-			limit_vocab_size = ((int64_t)sblob->data.elem_count*elem_sz +(valid_data_run?pm->data_recs*2:0) -  2*pm->row_count)
-					   * pm->data_recs / (int64_t)sblob->data.elem_count / elem_sz;
-			
-
-			if(limit_vocab_size <=1 ){
-				rc = RC(rcVDB, rcBlob, rcConstructing, rcId, rcOutofrange);
-			}
-			if(limit_vocab_size > pm->data_recs/4){
-				limit_vocab_size = pm->data_recs/4;  /* to limit the amount of work **/
-			}
-#define MAX_VOCAB_SIZE 2048
-			if(limit_vocab_size > MAX_VOCAB_SIZE) limit_vocab_size=MAX_VOCAB_SIZE;
-			if(rc == 0)
-				rc=KBTreeMakeUpdate(&vocab_key2id, NULL, 256*1024*1024,
-				      false, kbtOpaqueKey,
-				      minlen?minlen*elem_sz:1,maxlen*elem_sz, sizeof ( uint32_t ), NULL);
-			if(rc == 0){
-				uint32_t i,j;
-				uint8_t  *src;
-				uint32_t dst_offset;
-				uint32_t vocab_arr[MAX_VOCAB_SIZE];
-				data_offset = malloc(pm->data_recs * sizeof(*data_offset));
-				if(data_offset == NULL){
-					rc = RC(rcVDB, rcBlob, rcConstructing, rcMemory, rcExhausted);
-				}
-				for(i=j=0,src = sblob->data.base,dst_offset=0;i<pm->leng_recs && rc == 0 ;i++){
-					row_count_t leng_run = pm->leng_run[i];
-					if(pm->length[i] == 0){/*** trivial case, can point anywhere - no vocabulary**/
-						for(;leng_run > 0;j++){
-							row_count_t data_run = valid_data_run?pm->data_run[j]:1;
-							assert(leng_run >= data_run);
-							data_offset[j] = 0; /**  point to offset=0 **/
-							leng_run -=data_run;
-						}
-					} else for(;leng_run > 0 && rc == 0;j++){
-						row_count_t data_run = valid_data_run?pm->data_run[j]:1;
-						bool wasInserted;
-						uint64_t tmp_id = vocab_cnt;
-						assert(leng_run >= data_run);
-						leng_run -=data_run;
-						rc = KBTreeEntry(vocab_key2id, &tmp_id, &wasInserted, src, pm->length[i]*elem_sz);
-						if(rc == 0){
-							if(wasInserted){
-								vocab_cnt++;
-								if(vocab_cnt == limit_vocab_size) {
-									rc = RC(rcVDB, rcBlob, rcConstructing, rcId, rcTooBig);
-								} else {
-									vocab_arr[tmp_id] = dst_offset; /** save offset */
-									data_offset[j]    = dst_offset;
-									rc = KDataBufferResize(&new_data,dst_offset+pm->length[i]);
-									if(rc == 0){
-										memcpy((uint8_t*)new_data.base+dst_offset*elem_sz,src,pm->length[i]*elem_sz);
-										dst_offset += pm->length[i];
-									}
-								}
-							} else {
-								assert(vocab_arr[tmp_id] <= dst_offset);
-								data_offset[j] = vocab_arr[tmp_id]; /** retrieve offset **/
-							}
-						}
-						src +=pm->length[i]*elem_sz;
-						assert(src - (uint8_t*)sblob->data.base <= sblob->data.elem_count * elem_sz);
-					}
-				}
-				if(rc == 0 ){
-					PageMap *new_pm;
-					/*printf("OPTIMIZATION LEVEL REACHED: vocab:%d,rows:%d,data_recs:%d\n",vocab_cnt ,pm->row_count,pm->data_recs);*/
-					rc=PageMapToRandomAccess(&new_pm,pm,data_offset); 
-					if(rc == 0){
-						/** DONE ***/
-						VBlob *vblob;
-						rc=VBlobNew(&vblob, sblob->start_id, sblob->stop_id, NULL);
-						if(rc==0){
-							vblob->pm = new_pm;
-							vblob->pm->optimized = eBlobPageMapOptimizedSucceeded;
-							vblob->data = new_data;
-							VBlobRelease(sblob);
-							*vblobp=vblob;
-							free(data_offset);
-							KBTreeRelease(vocab_key2id);
-							return;
-						}
-						PageMapRelease(new_pm);
-						
-					}
-				} else {
-					/*printf("NO OPTIMIZATION: vocab:%d,rows:%d,data_recs:%d\n",vocab_cnt ,pm->row_count,pm->data_recs);*/
-				}
-				if(data_offset) free(data_offset);
-				if(vocab_key2id) KBTreeRelease  ( vocab_key2id );
-			}
-            KDataBufferWhack(&new_data);
-		}
-	}
-
-}
-
-
-rc_t VBlobSerialize ( const VBlob *self, KDataBuffer *result ) {
-    uint64_t sz;
-    rc_t rc;
-    bitsz_t data_bits = KDataBufferBits(&self->data);
-    uint64_t data_bytes = KDataBufferBytes(&self->data);
-    uint32_t row_length;
-    
-    if (self->headers == NULL && (row_length = PageMapHasSimpleStructure(self->pm)) != 0) {
-        rc = KDataBufferResize(result, 5 + data_bytes);
-        if (rc == 0) {
-
-#if _DEBUGGING && 1
-            /* temporary assert that we are setting byte_order properly
-               in the future, we may allow some functions to issue other
-               byte orders, although there is no conceivable reason to do so */
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-            assert ( self -> byte_order == vboNative || self -> byte_order == vboLittleEndian );
-#else
-            assert ( self -> byte_order == vboNative || self -> byte_order == vboBigEndian );
-#endif
-#endif
-            rc = encode_header_v1(result->base, result->elem_count, &sz, row_length, data_bits, self->byte_order);
-            if (rc == 0) {
-                memcpy(&((uint8_t *)result->base)[sz], self->data.base, data_bytes);
-                result->elem_count = sz + data_bytes;
-            }
-        }
-    }
-    else {
-        KDataBuffer headers;
-        KDataBuffer pagemap;
-        
-        rc = KDataBufferMakeBytes(&headers, 0);
-        if (rc == 0) {
-            if (self->headers)
-                rc = BlobHeadersSerialize(self->headers, &headers, 0, &sz);
-            else
-                sz = 0;
-            if (rc == 0) {
-                headers.elem_count = sz;
-                rc = KDataBufferMakeBytes(&pagemap, 0);
-                if (rc == 0) {
-                    if (self->pm)
-                        rc = PageMapSerialize(self->pm, &pagemap, 0, &sz);
-                    else
-                        sz = 0;
-                    if (rc == 0) {
-                        pagemap.elem_count = sz;
-                        rc = KDataBufferResize(result, 9 + data_bytes + headers.elem_count + pagemap.elem_count);
-                        if (rc == 0) {
-                            rc = encode_header_v2(result->base, result->elem_count, &sz, headers.elem_count, pagemap.elem_count, data_bits);
-                            if (rc == 0) {
-                                memcpy(&((uint8_t *)result->base)[sz], headers.base, headers.elem_count);
-                                sz += headers.elem_count;
-                                memcpy(&((uint8_t *)result->base)[sz], pagemap.base, pagemap.elem_count);
-                                sz += pagemap.elem_count;
-                                memcpy(&((uint8_t *)result->base)[sz], self->data.base, data_bytes);
-                                result->elem_count = sz + data_bytes;
-                            }
-                        }
-                    }
-                    KDataBufferWhack(&pagemap);
-                }
-            }
-        }
-        KDataBufferWhack(&headers);
-    }
-    
-    return rc;
-}
-
-rc_t VBlobCreateFromData ( struct VBlob **lhs,
-                         int64_t start_id, int64_t stop_id,
-                         const KDataBuffer *src,
-                         uint32_t elem_bits , PageMapProcessRequest const *pmpr)
-{
-    VBlob *y = NULL;
-    rc_t rc;
-    
-    assert(lhs);
-    assert(src);
-    assert(src->elem_bits == 8);
-    assert(src->bit_offset == 0);
-
-    *lhs = 0;
-
-    if ((((const uint8_t *)src->base)[0] & 0x80) == 0)
-        rc = VBlobCreateFromData_v1(&y, src, start_id, stop_id, elem_bits);
-    else
-        rc = VBlobCreateFromData_v2(&y, src, start_id, stop_id, elem_bits, (PageMapProcessRequest*)pmpr);
-
-    if (rc == 0)
-        *lhs = y;
-
-    return rc;
-}
-
-rc_t VBlobCreateFromSingleRow (
-			      struct VBlob **lhs,
-			      int64_t start_id, int64_t stop_id,
-			      const KDataBuffer *src,
-			      VByteOrder byte_order )
-{
-    VBlob *y;
-    rc_t rc;
-    
-    rc = VBlobNew(&y, start_id, stop_id, NULL);
-    TRACK_BLOB (VBlobNew, y);
-    if (rc == 0) {
-        assert(src->elem_count >> 32 == 0);
-        rc = PageMapNewSingle(&y->pm, BlobRowCount(y), (uint32_t)src->elem_count);
-        if (rc == 0) {
-            rc = KDataBufferSub(src, &y->data, 0, UINT64_MAX);
-            if (rc == 0) {
-                y->byte_order = byte_order;
-                *lhs = y;
-                return 0;
-            }
-        }
-        /* should add a release/free? */
-    }
-    return rc;
-}
-
-bool VBlobIsSingleRow( const struct VBlob *self ) {
-    return (self->pm && self->pm->data_recs==1) ? true : false;
-}
-
-uint32_t VBlobFixedRowLength( const struct VBlob *self ) {
-    return self->pm ? PageMapFixedRowLength(self->pm) : 0;
-}
-
-#define COMPARE(FORCE, BITS, DBASE, DOFF, SBASE, SOFF, LENGTH) \
-    (((FORCE == 0) || (BITS & 7) != 0) ? ( \
-        bitcmp(DBASE, DOFF * BITS + FORCE, SBASE, SOFF * BITS, LENGTH * BITS)) : ( \
-        memcmp(((const char *)DBASE)+((DOFF * BITS) >> 3), \
-               ((const char *)SBASE)+((SOFF * BITS) >> 3), \
-               ((LENGTH * BITS) >> 3))))
-
-#define COPY(FORCE, BITS, DBASE, DOFF, SBASE, SOFF, LENGTH) \
-    (((FORCE == 0) || (BITS & 7) != 0) ? ( \
-        bitcpy(DBASE, DOFF * BITS + FORCE, SBASE, SOFF * BITS, LENGTH * BITS)) : ( \
-        (void)memcpy(((      char *)DBASE)+((DOFF * BITS) >> 3), \
-               ((const char *)SBASE)+((SOFF * BITS) >> 3), \
-               ((LENGTH * BITS) >> 3))))
-
-rc_t VBlobAppendRow(VBlob *self,
-                    elem_count_t *last_offset,
-                    elem_count_t *last_length,
-                    const KDataBuffer *src,
-                    elem_count_t offset,
-                    elem_count_t length,
-                    row_count_t repeat_count
-                    )
-{
-    rc_t rc;
-    
-    if (!PageMapHasRows(self->pm) || length != *last_length ||
-        COMPARE(self->data.bit_offset, self->data.elem_bits,
-                self->data.base, *last_offset,
-                src->base, offset,
-                length) != 0
-        )
-    {
-        *last_offset = self->data.elem_count;
-        rc = KDataBufferResize(&self->data, *last_offset + length);
-        if (rc == 0) {
-            COPY(self->data.bit_offset, self->data.elem_bits,
-                 self->data.base, *last_offset,
-                 src->base, offset, length);
-            rc = PageMapAppendRows(self->pm, length, repeat_count, false);
-        }
-        *last_length = length;
-    }
-    else
-        rc = PageMapAppendRows(self->pm, length, repeat_count, true);
-    
-    return rc;
-}
-
-static rc_t VBlobGetLastRow(VBlob *self, elem_count_t *offset, elem_count_t *length) {
-    
-    *length = PageMapLastLength(self->pm);
-    *offset = self->data.elem_count - *length;
-
-    return 0;
-}
-
-rc_t VBlobAppend(VBlob *self, const VBlob *other) {
-    rc_t rc;
-    row_count_t offset;
-    row_count_t length;
-    
-    if (self->headers)
-        return RC(rcVDB, rcBlob, rcConcatenating, rcSelf, rcInconsistent);
-    if (other->headers)
-        return RC(rcVDB, rcBlob, rcConcatenating, rcParam, rcInvalid);
-
-    if (self->stop_id + 1 != other->start_id)
-        return RC(rcVDB, rcBlob, rcConcatenating, rcId, rcOutofrange);
-
-    if (other->data.elem_bits != self->data.elem_bits)
-        return RC(rcVDB, rcBlob, rcConcatenating, rcData, rcInvalid);
-
-#if 0
-    fprintf(stderr, "appending %u(%u) (length: %u) to %u(%u) (length: %u) %s\n",
-            (unsigned)other->start_id, (unsigned)BlobRowCount(other),
-            (unsigned)other->data.elem_count,
-            (unsigned)self->start_id, (unsigned)BlobRowCount(self),
-            (unsigned)self->data.elem_count,
-            self->name);
-#endif
-    
-    rc = VBlobGetLastRow(self, &offset, &length);
-    if (rc == 0) {
-        PageMapIterator iter;
-        
-        rc = PageMapNewIterator(other->pm, &iter, 0, -1);
-        if (rc == 0) {
-            KDataBuffer orig;
-            
-            rc = KDataBufferMakeWritable(&self->data , &orig);
-            if (rc == 0) {
-                row_count_t row_count;
-                KDataBufferWhack(&self->data);
-                self->data = orig;
-                do {
-                    row_count = PageMapIteratorRepeatCount(&iter);
-                    rc = VBlobAppendRow(self, &offset, &length, &other->data,
-                                        PageMapIteratorDataOffset(&iter),
-                                        PageMapIteratorDataLength(&iter),
-                                        row_count);
-                } while (rc == 0 && PageMapIteratorAdvance(&iter, row_count));
-                if (rc == 0) {
-                    self->stop_id = other->stop_id;
-                    self->no_cache |= other->no_cache;
-                }
-            }
-        }
-    }
-    return rc;
-}
-
-rc_t VBlobSubblob( const struct VBlob *self,struct VBlob **sub, int64_t start_id )
-{
-    rc_t rc;
-    KDataBuffer  kd;
-    PageMapIterator pmi;
-    
-    if (start_id < self->start_id || start_id > self->stop_id)
-        return RC(rcVDB, rcBlob, rcConverting, rcId, rcOutofrange);
-    
-    rc=PageMapNewIterator(self->pm,&pmi, 0, -1);
-    if(rc == 0){
-        if(PageMapIteratorAdvance(&pmi,start_id-self->start_id)){
-            row_count_t numrep = PageMapIteratorRepeatCount(&pmi);
-            elem_count_t offset = PageMapIteratorDataOffset(&pmi);
-            elem_count_t length = PageMapIteratorDataLength(&pmi);
-            
-#if 0
-            fprintf(stderr, "splitting %u(%u) (offset: %u, length: %u) from %s\n",
-                    (unsigned)start_id, (unsigned)numrep,
-                    (unsigned)offset, (unsigned)length,
-                    self->name);
-#endif
-            
-            rc = KDataBufferSub(&self->data, &kd, offset, length);
-            if(rc == 0){
-                int64_t	stop_id;
-
-                if(length > 0) stop_id = start_id + numrep - 1;
-                else           stop_id = start_id; /*** HACK - 0 sized data may be a sign that real data is somewhere else ***/
-
-                rc = VBlobCreateFromSingleRow(sub, start_id, stop_id, &kd, self->byte_order);
-                KDataBufferWhack(&kd);
-            }
-        } else {
-            rc = RC(rcVDB, rcBlob, rcConverting, rcId, rcOutofrange);
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC VBlobIdRange ( const VBlob *self,
-    int64_t *first, uint64_t *count )
-{
-    rc_t rc;
-
-    if ( first == NULL && count == NULL )
-        rc = RC ( rcVDB, rcBlob, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcBlob, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            if ( first != NULL )
-                * first = self -> start_id;
-            if ( count != NULL )
-                * count = self -> stop_id + 1 - self -> start_id;
-            return 0;
-        }
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VBlobCellData ( const VBlob *self, int64_t row_id,
-    uint32_t *elem_bits, const void **base, uint32_t *boff, uint32_t *row_len )
-{
-    rc_t rc;
-    uint32_t dummy;
-
-    if ( elem_bits == NULL )
-        elem_bits = & dummy;
-    if ( boff == NULL )
-        boff = & dummy;
-    if ( row_len == NULL )
-        row_len = & dummy;
-
-    if ( base == NULL )
-        rc = RC ( rcVDB, rcBlob, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcBlob, rcAccessing, rcSelf, rcNull );
-        else if ( row_id < self -> start_id || self -> stop_id < row_id )
-            rc = RC ( rcVDB, rcBlob, rcAccessing, rcRange, rcInvalid );
-        else
-        {
-            uint64_t start;
-
-            /* TBD - this may be wrong */
-            * elem_bits = self -> data . elem_bits;
-            * row_len = PageMapGetIdxRowInfo ( self -> pm, ( uint32_t ) ( row_id - self -> start_id ), boff );
-            start = ( uint64_t ) boff [ 0 ] * elem_bits [ 0 ];
-            * base = ( uint8_t* ) self -> data . base + ( start >> 3 );
-            * boff = ( uint32_t ) start & 7;
-
-            return 0;
-        }
-
-        * base = NULL;
-    }
-
-    * elem_bits = * boff = * row_len = 0;
-
-    return rc;
-}
-
-/* a copy of VCursorRead() */
-LIB_EXPORT rc_t CC VBlobRead ( const VBlob *self, int64_t row_id,
-    uint32_t elem_bits, void *buffer, uint32_t blen, uint32_t *row_len )
-{
-    rc_t rc = 0;
-    const void* base = NULL;
-    uint32_t boff = 0;
-    uint32_t elem_size = 0;
-    uint64_t to_read = 0;
-    uint64_t bsize = 0;
-
-    if ( self == NULL )
-    {   return RC ( rcVDB, rcBlob, rcReading, rcSelf, rcNull ); }
-
-    if ( buffer == NULL || row_len == NULL )
-    {   return RC ( rcVDB, rcBlob, rcReading, rcParam, rcNull ); }
-
-    if ( elem_bits == 0 || ( elem_bits & 7 ) != 0 )
-    {   return RC ( rcVDB, rcCursor, rcReading, rcParam, rcInvalid ); }
-
-    rc = VBlobCellData ( self, row_id, &elem_size, &base, &boff, row_len );
-    if ( rc != 0 )
-    {   return rc; }
-    if ( elem_size < elem_bits && elem_bits % elem_size != 0 )
-    {   return RC ( rcVDB, rcCursor, rcReading, rcType, rcInconsistent ); }
-    if ( elem_size > elem_bits && elem_size % elem_bits != 0 )
-    {   return RC ( rcVDB, rcCursor, rcReading, rcType, rcInconsistent ); }
-    if ( * row_len == 0 )
-    {   return 0; }
-    if ( blen == 0 )
-    {   return RC ( rcVDB, rcCursor, rcReading, rcBuffer, rcInsufficient ); }
-
-    to_read = * row_len * elem_size;
-    bsize = blen * elem_bits;
-
-    /* always return the required buffer size */
-    * row_len = ( uint32_t ) ( to_read / elem_bits );
-
-    /* detect buffer too small */
-    if ( to_read > bsize ) {
-        rc = RC ( rcVDB, rcCursor, rcReading, rcBuffer, rcInsufficient );
-        to_read = bsize;
-    }
-
-    /* copy out data up to limit */
-    assert ( boff == 0 );
-    memcpy ( buffer, base, ( size_t ) ( to_read >> 3 ) );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VBlobReadBits ( const VBlob *self, int64_t row_id,
-    uint32_t elem_bits, uint32_t start, void *buffer, uint32_t off,
-    uint32_t blen, uint32_t *num_read, uint32_t *remaining )
-{
-    rc_t rc = 0;
-    const void* base = NULL;
-    uint32_t boff = 0;
-    uint32_t elem_size = 0;
-    uint64_t to_read = 0;
-    uint64_t bsize = 0;
-    uint32_t row_len = 0;
-    uint32_t dummy;
-    if ( remaining == NULL )
-    {   remaining = & dummy; }
-
-    if ( self == NULL )
-    {   return RC ( rcVDB, rcBlob, rcReading, rcSelf, rcNull ); }
-
-    if ( buffer == NULL || num_read == NULL )
-    {   return RC ( rcVDB, rcBlob, rcReading, rcParam, rcNull ); }
-
-    if ( elem_bits == 0 || ( elem_bits & 7 ) != 0  )
-    {   return RC ( rcVDB, rcBlob, rcReading, rcParam, rcInvalid ); }
-
-    rc = VBlobCellData ( self, row_id, &elem_size, &base, &boff, &row_len );
-    if ( rc != 0 )
-    {   return rc; }
-    if ( elem_size < elem_bits && elem_bits % elem_size != 0 )
-    {   return RC ( rcVDB, rcCursor, rcReading, rcType, rcInconsistent ); }
-    if ( elem_size > elem_bits && elem_size % elem_bits != 0 )
-    {   return RC ( rcVDB, rcCursor, rcReading, rcType, rcInconsistent ); }
-    if ( row_len == 0 ) {
-        * num_read = * remaining = 0;
-        return 0;
-    }
-    if ( * num_read == 0 )
-    {   return 0; }
-    to_read = row_len * elem_size;
-    bsize = blen * elem_bits;
-
-    if ( blen == 0 ) {
-        * num_read = 0;
-        * remaining = ( uint32_t ) ( to_read / elem_bits );
-        return 0;
-    }
-    bsize = blen * elem_size;
-    if ( to_read <= bsize )
-    {   * remaining = 0; }
-    else {
-        * remaining = (uint32_t)( ( to_read - bsize ) / elem_bits );
-        to_read = bsize;
-    }
-    bitcpy ( buffer, off, base, boff, ( bitsz_t ) to_read );
-    * num_read = ( uint32_t ) ( to_read / elem_bits );
-
-    return rc;
-}
-
-#undef VBlobAddRef
-#undef VBlobRelease
-
-LIB_EXPORT rc_t CC VBlobAddRef ( const VBlob *self )
-{
-    if ( self != NULL )
-        KRefcountAdd(&self->refcount, "VBlob");
-    return 0;
-}
-
-LIB_EXPORT rc_t CC VBlobRelease ( const VBlob *self )
-{
-    rc_t rc = 0;
-
-    if ( self != 0 )
-    {
-        switch ( KRefcountDrop(&self->refcount, "VBlob") )
-        {
-        case krefWhack:
-            return VBlobDestroy ( (VBlob*) self );
-        case krefNegative:
-            rc = RC (rcVDB, rcBlob, rcDestroying, rcBlob, rcExcessive);
-            PLOGERR ( klogInt, (klogInt, rc, "Released a blob $(B) with no more references",
-                      PLOG_P(self)));
-            break;
-        }
-    }
-    return rc;
-}
-
-/*--------------------------------------------------------------------------
- * VBlobCache
- */
-typedef struct VBlobCache VBlobCache;
-struct VBlobCache
-{
-    BSTNode bn;
-    DLNode ln;
-    size_t size;
-    const VBlob *blob;
-    uint32_t col_idx;
-};
-
-static
-void CC VBlobCacheWhack ( BSTNode *n, void *ignore )
-{
-    VBlobCache *self = ( VBlobCache* ) n;
-    VBlobRelease ( ( VBlob* ) self -> blob );
-    free ( self );
-}
-
-static
-rc_t VBlobCacheMake ( VBlobCache **bcp, const VBlob *blob, uint32_t col_idx, size_t blob_size )
-{
-    VBlobCache *bc = malloc ( sizeof * bc );
-    if ( bc == NULL )
-        return RC ( rcVDB, rcCursor, rcReading, rcMemory, rcExhausted );
-
-    bc -> size = blob_size;
-    bc -> blob = blob;
-    VBlobAddRef(blob);
-    bc -> col_idx = col_idx;
-    * bcp = bc;
-    return 0;
-}
-typedef struct VBlobCacheKey VBlobCacheKey;
-struct VBlobCacheKey
-{
-    int64_t row_id;
-    uint32_t col_idx;
-};
-
-static
-int CC VBlobCacheCmp ( const void *a, const BSTNode *b )
-{
-    const VBlobCacheKey * key = a;
-    const VBlobCache * node = ( const VBlobCache* ) b;
-
-    if ( key -> col_idx != node -> col_idx )
-        return ( int ) key -> col_idx - ( int ) node -> col_idx;
-
-    if ( key -> row_id < node -> blob -> start_id )
-        return -1;
-    return key -> row_id > node -> blob -> stop_id;
-}
-
-static
-int CC VBlobCacheSort ( const BSTNode *a, const BSTNode *b )
-{
-    const VBlobCache * item = ( const VBlobCache* ) a;
-    const VBlobCache * node = ( const VBlobCache* ) b;
-
-    if ( item -> col_idx != node -> col_idx )
-        return ( int ) item -> col_idx - ( int ) node -> col_idx;
-
-    if ( item -> blob -> stop_id < node -> blob -> start_id )
-        return -1;
-    return item -> blob -> start_id > node -> blob -> stop_id;
-}
-
-struct VBlobMRUCache { /* read-only blob cache */
-    BSTree cache;
-    DLList lru;
-    size_t capacity;
-    size_t contents;
-    /* last blob cache */
-    VBlob *last[LAST_BLOB_CACHE_SIZE]; /** last 4 blob to be cached per given col_idx, limiting col_idx  **/
-};
-
-
-VBlobMRUCache * VBlobMRUCacheMake(uint64_t capacity )
-{
-    VBlobMRUCache *self = NULL;
-    if(capacity > 0){
-	self = malloc(sizeof(*self));
-        if(self){
-		BSTreeInit ( & self -> cache);
-		DLListInit ( & self -> lru );
-		memset(self -> last,0,LAST_BLOB_CACHE_SIZE*sizeof(*self -> last));
-		self->capacity = capacity;
-		self->contents = 0;
-	}
-   }
-   return self;
-}
-
-void VBlobMRUCacheDestroy( VBlobMRUCache *self )
-{
-    if(self){
-	int i;
-	BSTreeWhack ( & self -> cache, VBlobCacheWhack, NULL );
-	DLListInit ( & self -> lru );
-	for(i=0;i<LAST_BLOB_CACHE_SIZE;i++){
-		if(self -> last[i]) {
-		    VBlobRelease(self -> last[i]);
-		    self->last[i] = NULL;
-		}
-	}
-	free(self);
-    }
-}
-
-const VBlob* VBlobMRUCacheFind(const VBlobMRUCache *cself, uint32_t col_idx, int64_t row_id)
-{
-    const VBlob* blob;
-    VBlobCache *bc;
-    VBlobCacheKey bck;
-    VBlobMRUCache *self = (VBlobMRUCache*)cself;
-
-    /* check MRU blob */
-    if(col_idx <= LAST_BLOB_CACHE_SIZE)
-    {
-	blob = self->last[col_idx-1];
-	if(blob && row_id >= blob->start_id && row_id <= blob->stop_id)
-	{
-	    return blob;
-		
-	}
-    }
-
-    /* check cache for entry */
-    bck . row_id = row_id;
-    bck . col_idx = col_idx;
-    bc = ( VBlobCache* ) BSTreeFind ( & self -> cache, & bck, VBlobCacheCmp );
-    if ( bc != NULL )
-    {
-        /* save in MRU */
-        if(col_idx <= LAST_BLOB_CACHE_SIZE)
-        {
-            if(self->last[col_idx-1])
-                VBlobRelease(self->last[col_idx-1]);
-            self->last[col_idx-1] = (VBlob*)bc->blob;
-            if(VBlobAddRef (self->last[col_idx-1])!=0)
-		return NULL;
-        }
-        /* maintain LRU */
-        DLListUnlink  (&self->lru,&bc->ln);
-        DLListPushHead(&self->lru,&bc->ln);
-        /* ask column to read from blob */
-        return bc->blob;
-    }
-    return NULL;
-}
-rc_t VBlobMRUCacheSave(const VBlobMRUCache *cself, uint32_t col_idx, const VBlob *blob)
-{
-    rc_t   rc;
-    size_t blob_size =sizeof(VBlobCache) + sizeof(VBlob);
-    VBlobCache *bc=NULL;
-    VBlobMRUCache *self = (VBlobMRUCache*)cself;
-
-    if(blob->no_cache) return 0;
-
-    blob_size  += KDataBufferBytes(&blob->data);
-    if (blob->pm != NULL) {
-        blob_size += 
-                  KDataBufferBytes(&blob->pm->cstorage)
-                + KDataBufferBytes(&blob->pm->dstorage)
-                + KDataBufferBytes(&blob->pm->istorage);
-    }
-    /** auto-raise capacity for large blob **/
-    if(blob_size > self -> capacity) self -> capacity = blob_size;
-
-    /* now cache the blob */
-    rc = VBlobCacheMake ( & bc, blob, col_idx, blob_size );
-    if ( rc == 0 ) {
-        /* attempt a unique insertion */
-        VBlobCache *existing;
-        rc = BSTreeInsertUnique ( &self -> cache, & bc -> bn, ( BSTNode** ) & existing, VBlobCacheSort );
-        if ( rc != 0 ){
-            VBlobCacheWhack ( & bc -> bn, NULL );
-	    rc = 0;
-        } else {
-            /* remember as last used  **/
-            if(col_idx <= LAST_BLOB_CACHE_SIZE)
-            {
-		if(self->last[col_idx-1])
-			VBlobRelease(self->last[col_idx-1]);
-		self->last[col_idx-1] = (VBlob*)bc->blob;
-		rc = VBlobAddRef (self->last[col_idx-1]);
-		if(rc != 0)
-		   return rc;
-	    }
-            /* perform accounting */
-            self -> contents += blob_size;
-            while ( self -> contents > self -> capacity )
-            {
-                /* get least recently used */
-                DLNode *last = DLListPopTail ( & self -> lru );
-                if ( last == NULL )
-                    break;
-
-                /* drop blob */
-                existing = ( VBlobCache* ) ( ( char* ) last - sizeof existing -> bn );
-
-                BSTreeUnlink ( & self -> cache, & existing -> bn );
-                self -> contents -= existing -> size;
-                VBlobCacheWhack ( & existing -> bn, NULL );
-            }
-
-            /* insert at head of list */
-            DLListPushHead ( & self -> lru, & bc -> ln );
-        }
-    }
-    return 0;
-}
-
diff --git a/libs/vdb/blob.h b/libs/vdb/blob.h
deleted file mode 100644
index 860e7c8..0000000
--- a/libs/vdb/blob.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#ifndef _h_blob_
-#define _h_blob_
-
-#ifndef _h_vdb_extern_
- #include <vdb/extern.h>
-#endif
-
-#ifndef _h_blob_priv_
- #include "blob-priv.h"
-#endif
-
-struct VBlobBuffer;
-struct VRowBuffer;
-
-enum VBlobVariant_t {
-    vbvBlobbed,
-    vbvRowBuffer,
-    vbvSingleRow
-};
-
-
-/* Write the row lengths for the rows from start_id thru stop_id, inclusive
- */
-rc_t VBlobWritePageMap( VBlob *self, int64_t start_id, int64_t stop_id, const uint32_t row_length[] );
-
-/* Read (copy out) the row lengths for the rows from start_id thru stop_id, inclusive
- */
-rc_t VBlobReadPageMap( const VBlob *self, int64_t start_id, int64_t stop_id, uint32_t row_length[] );
-
-/* Change the shape of the databuffer.
- *
- * This function does not resize the buffer; it changes how it is
- * interpreted, i.e. it is a typecast.
- * The quantity ((bits per element) * (# elements)) remains the same.
- *
- * new bits = bits * bits_mult / bits_div
- * new #elements = #elements * bits_div / bits_mult
- * 
- */
-rc_t VBlobBufferReshape( struct VBlobBuffer *self, int bits_mult, int bits_div );
-
-/* Turn a raw blob into a page buffer
- *
- * This is essentially a type-cast.
- */
-rc_t VBlobMakeRowBuffer( struct VRowBuffer **lhs,
-                         const VBlob *cself
-);
-
-/* Serialize
- *
- * Get a blob serialized into a new data buffer.
- * Whack this when done with it.
- */
-rc_t VBlobSerialize(const VBlob *cself, KDataBuffer *result);
-
-
-#endif /* _h_blob_ */
diff --git a/libs/vdb/cast.c b/libs/vdb/cast.c
deleted file mode 100644
index 0718ec9..0000000
--- a/libs/vdb/cast.c
+++ /dev/null
@@ -1,583 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <vdb/extern.h> 
-
-#include "xform-priv.h"
-#include "blob-priv.h"
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <klib/data-buffer.h>
-#include <klib/text.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <arch-impl.h>
-#include <os-native.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <limits.h>
-#include <float.h>
-#include <string.h>
-#include <assert.h>
-
-/* copy
- *  just perform an addref on input blob
- */
-static
-rc_t CC copy ( void *self, const VXformInfo *info, int64_t row_id,
-    VBlob **rslt, uint32_t argc, const VBlob *argv [] )
-{
-    * rslt = ( VBlob* ) argv [ 0 ];
-    (void)VBlobAddRef (*rslt );
-    return 0;
-}
-
-/* casting object
- *  uses a three-step process for converting:
- *  1. read source into canonical fmt
- *  2. convert domains as required
- *  3. write from canonical fmt to dest
- */
-typedef struct Cast Cast;
-struct Cast
-{
-    /* read source to canonical fmt */
-    union
-    {
-        int ( * num ) ( const void *src, void *dst );
-        int ( * chr ) ( uint32_t *ch, const void *begin, const void *end );
-    } read;
-
-    /* transform from one domain to another */
-    union
-    {
-        rc_t ( * num ) ( const void *src, void *dst );
-    } convert;
-
-    /* write from canonical fmt to destination */
-    union
-    {
-        int ( * num ) ( const void *src,  void *dst );
-        int ( * chr ) ( void *begin, void *end, uint32_t ch );
-    } write;
-
-    /* intrinsic dim of source */
-    uint32_t intrinsic_dim;
-
-    /* intrinsic sizes of src and dst */
-    uint32_t src_bits, dst_bits;
-};
-
-static
-rc_t CC cast_num ( void *data, const VXformInfo *info,
-    void *dst, const void *src, uint64_t elem_count )
-{
-    const Cast *self = ( const void* ) data;
-
-    /* since we are performing intrinsic-level operations,
-       convert the array length into intrinsic count */
-    uint32_t i;
-    uint64_t count = elem_count * self -> intrinsic_dim;
-
-    /* treat source and destination as byte pointers */
-    int bytes;
-    uint8_t *dp = dst;
-    const uint8_t *sp = src;
-
-    /* read and conversion buffers */
-    union { int64_t i64; uint64_t u64; double f64; } buff [ 2 ];
-
-    /* loop without conversion */
-    if ( self -> convert . num == NULL )
-    {
-        for ( i = 0; i < count; ++ i )
-        {
-            /* read into canonical fmt */
-            bytes = ( * self -> read . num ) ( sp, & buff [ 0 ] );
-            sp += bytes;
-
-            /* write into destination fmt */
-            bytes = ( * self -> write . num ) ( & buff [ 0 ], dp );
-            if ( bytes < 0 )
-                return RC ( rcVDB, rcType, rcCasting, rcRange, rcExcessive );
-            dp += bytes;
-        }
-    }
-
-    /* loop with conversion */
-    else
-    {
-        for ( i = 0; i < count; ++ i )
-        {
-            rc_t rc;
-
-            /* read into canonical fmt */
-            bytes = ( * self -> read . num ) ( sp, & buff [ 0 ] );
-            sp += bytes;
-
-            /* convert domains */
-            rc = ( * self -> convert . num ) ( & buff [ 0 ], & buff [ 1 ] );
-            if ( rc != 0 )
-                return rc;
-
-            /* write into destination fmt */
-            bytes = ( * self -> write . num ) ( & buff [ 1 ], dp );
-            if ( bytes < 0 )
-                return RC ( rcVDB, rcType, rcCasting, rcRange, rcExcessive );
-            dp += bytes;
-        }
-    }
-
-    return 0;
-}
-
-static
-rc_t resize_dst ( KDataBuffer *dst, uint8_t **dpos, uint8_t **dend,
-    const uint8_t *sbase, const uint8_t *spos, const uint8_t *send )
-{
-    size_t offset = * dpos - ( uint8_t* ) dst -> base;
-    double expand = ( double ) ( send - sbase ) / ( spos - sbase );
-    rc_t rc = KDataBufferResize ( dst, ( uint32_t ) ( expand * offset ) + 32 );
-    if ( rc == 0 )
-    {
-        * dpos = & ( ( uint8_t* ) dst -> base ) [ offset ];
-        * dend = & ( ( uint8_t* ) dst -> base ) [ dst -> elem_count ];
-    }
-    return rc;
-}
-
-static
-rc_t CC cast_chr ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    const Cast *self = ( const void* ) data;
-
-    int bytes;
-    uint32_t buff [ 2 ];
-    uint8_t *dpos, *dend;
-    const uint8_t *sbase, *spos, *send;
-
-    /* determine source boundaries */
-    sbase = argv [ 0 ] . u . data . base;
-    sbase += (size_t)argv [ 0 ] . u . data . first_elem *
-        argv [ 0 ] . u . data . elem_bits >> 3;
-    send = & sbase [ (size_t)argv [ 0 ] . u . data . elem_count *
-        argv [ 0 ] . u . data . elem_bits >> 3 ];
-    spos = sbase;
-
-    /* resize the destination blob */
-    rc = KDataBufferCast ( rslt -> data, rslt -> data, 8, true );
-    if ( rc == 0 )
-        rc = KDataBufferResize ( rslt -> data, (uint32_t)( send - sbase ) );
-    if ( rc != 0 )
-        return rc;
-
-    /* get the destination boundaries */
-    dpos = rslt -> data -> base;
-    dend = dpos + rslt -> data -> elem_count;
-    assert ( rslt -> data -> bit_offset == 0 );
-
-    while ( spos < send )
-    {
-        /* read into utf32 */
-        bytes = ( * self -> read . chr ) ( & buff [ 0 ], spos, send );
-        if ( bytes <= 0 )
-            return RC ( rcVDB, rcType, rcCasting, rcData, rcCorrupt );
-        spos += bytes;
-
-        /* write into destination */
-        bytes = ( * self -> write . chr ) ( dpos, dend, buff [ 0 ] );
-        if ( bytes <= 0 )
-        {
-            if ( bytes < 0 )
-                return RC ( rcVDB, rcType, rcCasting, rcData, rcCorrupt );
-            rc = resize_dst ( rslt -> data, & dpos, & dend, sbase, spos, send );
-            if ( rc != 0 )
-                return rc;
-        }
-        dpos += bytes;
-    }
-
-    /* return the number of elements and reset the data buffer */
-    rslt -> elem_count = ( uint32_t ) ( dpos - ( uint8_t* ) rslt -> data -> base );
-    if ( rslt -> elem_bits > 8 )
-        rslt -> elem_count /= rslt -> elem_bits >> 3;
-
-    return 0;
-}
-
-/* read_num
- *  numeric readers convert size
- */
-#define READ_NUM( S, D ) \
-static int read_ ## S ( const void *src, void *dst ) \
-{ * ( D* ) dst = * ( const S* ) src; return sizeof ( S ); }
-
-READ_NUM ( int8_t, int64_t )
-READ_NUM ( int16_t, int64_t )
-READ_NUM ( int32_t, int64_t )
-READ_NUM ( int64_t, int64_t )
-
-READ_NUM ( uint8_t, uint64_t )
-READ_NUM ( uint16_t, uint64_t )
-READ_NUM ( uint32_t, uint64_t )
-READ_NUM ( uint64_t, uint64_t )
-
-READ_NUM ( float, double )
-READ_NUM ( double, double )
-
-typedef int ( * read_num_func ) ( const void*, void* );
-static read_num_func read_num_tbl [] =
-{
-    read_uint8_t, read_uint16_t, read_uint32_t, read_uint64_t,
-    read_int8_t, read_int16_t, read_int32_t, read_int64_t,
-    NULL, NULL, read_float, read_double
-};
-
-/* write_num
- *  numeric writers convert size and check limit
- */
-#define WRITE_NUM( S, D ) \
-static int write_ ## D ( const void *src, void *dst ) \
-{ * ( D* ) dst = * ( const S* ) src; return sizeof ( D ); }
-
-#define WRITE_SNUM( S, D, PLIM, NLIM ) \
-static int write_ ## D ( const void *src, void *dst ) \
-{ \
-    S s = * ( const S* ) src; \
-    if ( s > PLIM || s < NLIM ) \
-        return -1; \
-    * ( D* ) dst = ( D )s; \
-    return sizeof ( D ); \
-}
-
-#define WRITE_UNUM( S, D, LIM ) \
-static int write_ ## D ( const void *src, void *dst ) \
-{ \
-    S s = * ( const S* ) src; \
-    if ( s > LIM ) \
-        return -1; \
-    * ( D* ) dst = ( D )s; \
-    return sizeof ( D ); \
-}
-
-WRITE_SNUM ( int64_t, int8_t, INT8_MAX, INT8_MIN )
-WRITE_SNUM ( int64_t, int16_t, INT16_MAX, INT16_MIN )
-WRITE_SNUM ( int64_t, int32_t, INT32_MAX, INT32_MIN )
-WRITE_NUM ( int64_t, int64_t )
-
-WRITE_UNUM ( uint64_t, uint8_t, UINT8_MAX )
-WRITE_UNUM ( uint64_t, uint16_t, UINT16_MAX )
-WRITE_UNUM ( uint64_t, uint32_t, UINT32_MAX )
-WRITE_NUM ( uint64_t, uint64_t )
-
-WRITE_SNUM ( double, float, FLT_MAX, FLT_MIN )
-WRITE_NUM ( double, double )
-
-typedef int ( * write_num_func ) ( const void*, void* );
-static write_num_func write_num_tbl [] =
-{
-    write_uint8_t, write_uint16_t, write_uint32_t, write_uint64_t,
-    write_int8_t, write_int16_t, write_int32_t, write_int64_t,
-    NULL, NULL, write_float, write_double
-};
-
-/* convert_num
- */
-static
-rc_t convert_int ( const void *src, void *dst )
-{
-    if ( ( * ( int64_t* ) dst = * ( const int64_t* ) src ) < 0 )
-        return RC ( rcVDB, rcType, rcCasting, rcRange, rcExcessive );
-    return 0;
-}
-
-static
-rc_t convert_int_float ( const void *src, void *dst )
-{ * ( double* ) dst = * ( const int64_t* ) src; return 0; }
-
-static
-rc_t convert_uint_float ( const void *src, void *dst )
-{ * ( double* ) dst = * ( const uint64_t* ) src; return 0; }
-
-static
-rc_t convert_float_int ( const void *src, void *dst )
-{
-    double d = * ( const double* ) src;
-    if ( d > INT64_MAX || d < INT64_MIN )
-        return RC ( rcVDB, rcType, rcCasting, rcRange, rcExcessive );
-    * ( int64_t* ) dst = ( int64_t ) d;
-    return 0;
-}
-
-static
-rc_t convert_float_uint ( const void *src, void *dst )
-{
-    double d = * ( const double* ) src;
-    if ( d > UINT64_MAX )
-        return RC ( rcVDB, rcType, rcCasting, rcRange, rcExcessive );
-    * ( uint64_t* ) dst = ( uint64_t ) d;
-    return 0;
-}
-
-typedef rc_t ( * convert_num_func ) ( const void*, void* );
-static convert_num_func convert_num_tbl [] =
-{
-    /* unsigned integer conversion */
-    NULL, convert_int, convert_uint_float,
-    /* signed integer conversion */
-    convert_int, NULL, convert_int_float,
-    /* floating point conversion */
-    convert_float_int, convert_float_uint, NULL
-};
-
-
-/* read_chr
- *  characters readers convert size and encoding
- */
-static int read_ascii ( uint32_t *ch,  const void *begin, const void *end )
-{
-    char s;
-    if ( ( const char* ) begin >= ( const char* ) end )
-        return 0;
-    s = * ( const char* ) begin;
-    if ( s < 0 )
-        return -1;
-    * ch = s;
-    return 1;
-}
-
-#define read_utf8 \
-    ( int ( * ) ( uint32_t*, const void*, const void* ) ) utf8_utf32
-
-static int read_utf16 ( uint32_t *ch, const void *begin, const void *end )
-{
-    if ( ( const uint16_t* ) begin >= ( const uint16_t* ) end )
-        return 0;
-    /* yes, I know this is wrong - but don't blame me
-       that the UNICODE folks can't produce a uni-code
-       character with 16 bits... ( GO, KLINGON! ) */
-    * ch = * ( const uint16_t* ) begin;
-    return 2;
-}
-
-static int read_utf32 ( uint32_t *ch, const void *begin, const void *end )
-{
-    if ( ( const uint32_t* ) begin >= ( const uint32_t* ) end )
-        return 0;
-    * ch = * ( const uint32_t* ) begin;
-    return 4;
-}
-
-typedef int ( * read_chr_func ) ( uint32_t*, const void*, const void* );
-static read_chr_func read_chr_tbl [] =
-{
-    /* ascii reads */
-    read_ascii, NULL, NULL,
-    /* unicode reads */
-    read_utf8, read_utf16, read_utf32
-};
-
-/* write_chr
- *  character writers convert size and encoding
- */
-static int write_ascii ( void *begin, void *end, uint32_t ch )
-{
-    if ( ( char* ) begin >= ( char* ) end )
-        return 0;
-    * ( char* ) begin = ( ch >= 128 ) ? '.' : ( char ) ch;
-    return 1;
-}
-
-#define write_utf8 \
-    ( int ( * ) ( void*, void*, uint32_t ) ) utf32_utf8
-
-static int write_utf16 ( void *begin, void *end, uint32_t ch )
-{
-    if ( ( uint16_t* ) begin >= ( uint16_t* ) end )
-        return 0;
-    if ( ch >= 0x10000 )
-        return -1;
-    * ( uint16_t* ) begin = ( uint16_t ) ch;
-    return 2;
-}
-
-static int write_utf32 ( void *begin, void *end, uint32_t ch )
-{
-    if ( ( uint32_t* ) begin >= ( uint32_t* ) end )
-        return 0;
-    * ( uint32_t* ) begin = ch;
-    return 4;
-}
-
-typedef int ( * write_chr_func ) ( void*, void*, uint32_t );
-static write_chr_func write_chr_tbl [] =
-{
-    /* ascii writes */
-    write_ascii, NULL, NULL,
-    /* unicode writes */
-    write_utf8, write_utf16, write_utf32
-};
-
-
-/* cast
- *  this operation is equivalent to a C forced cast, as it allows
- *  reinterpretation of data both in size and type, although
- *  it does not convert text to integer or vice-versa...
- */
-static
-rc_t make_self ( VFuncDesc *rslt, Cast **fself )
-{
-    * fself = calloc ( 1, sizeof ** fself );
-    if ( * fself == NULL )
-        return RC ( rcVDB, rcFunction, rcConstructing, rcMemory, rcExhausted );
-
-    rslt -> self = * fself;
-    rslt -> whack = free;
-    return 0;
-}
-
-VTRANSFACT_BUILTIN_IMPL ( vdb_cast, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rc_t rc;
-    Cast *fself;
-    int32_t src_size_idx, dst_size_idx;
-
-    /* cast cannot change intrinsic dimension. it is tempting to
-       consider the ability to cast B1[8] to U8[1], but then what
-       would it mean to cast B1[1] to U8[1] or B1[8] to U8[8] ? */
-    if ( info -> fdesc . desc . intrinsic_dim != dp -> argv [ 0 ] . desc . intrinsic_dim )
-        return RC ( rcVDB, rcFunction, rcConstructing, rcType, rcIncorrect );
-
-    /* cast is often used to ensure a source has a given type
-       meaning that in many cases no cast is required */
-    if ( info -> fdesc . desc . domain == dp -> argv [ 0 ] . desc . domain )
-    {
-        if ( info -> fdesc . desc . intrinsic_bits == dp -> argv [ 0 ] . desc . intrinsic_bits )
-        {
-            /* input and output are already binary compatible */
-            rslt -> variant = vftBlobN;
-            VFUNCDESC_INTERNAL_FUNCS(rslt)->bfN = copy;
-            return 0;
-        }
-    }
-
-    src_size_idx = uint32_lsbit ( dp -> argv [ 0 ] . desc . intrinsic_bits );
-    dst_size_idx = uint32_lsbit ( info -> fdesc . desc . intrinsic_bits );
-
-    /* numeric <-> numeric casts are supported */
-    if ( info -> fdesc . desc . domain >= vtdUint &&
-         info -> fdesc . desc . domain <= vtdFloat &&
-         dp -> argv [ 0 ] . desc . domain >= vtdUint &&
-         dp -> argv [ 0 ] . desc . domain <= vtdFloat )
-    {
-
-        /* byte-aligned offsets will be values 3..6
-           values < 3 are not byte-aligned
-           values > 6 are >= 128 bits and not handled */
-        if ( src_size_idx >= 3 && src_size_idx <= 6 &&
-             dst_size_idx >= 3 && dst_size_idx <= 6 )
-        {
-            rc = make_self ( rslt, & fself );
-            if ( rc != 0 )
-                return rc;
-
-            /* get reader */
-            fself -> read . num = read_num_tbl
-                [ ( dp -> argv [ 0 ] . desc . domain - vtdUint ) * 4 + src_size_idx - 3 ];
-            if ( fself -> read . num != NULL )
-            {
-                /* get writer */
-                fself -> write . num = write_num_tbl
-                    [ ( info -> fdesc . desc . domain - vtdUint ) * 4 + dst_size_idx - 3 ];
-                if ( fself -> write . num != NULL )
-                {
-                    /* get optional converter */
-                    fself -> convert . num = convert_num_tbl
-                        [ ( dp -> argv [ 0 ] . desc . domain - vtdUint ) * ( vtdFloat - vtdUint + 1 ) +
-                          info -> fdesc . desc . domain - vtdUint ];
-
-                    /* set intrinsic dimension */
-                    fself -> intrinsic_dim = info -> fdesc . desc . intrinsic_dim;
-
-                    /* done */
-                    rslt -> u . af = cast_num;
-                    rslt -> variant = vftArray;
-                    return 0;
-                }
-            }
-
-            free ( fself );
-            rslt -> whack = NULL;
-        }
-    }
-
-    /* text <-> text casts are supported */
-    if ( info -> fdesc . desc . domain >= vtdAscii &&
-         info -> fdesc . desc . domain <= vtdUnicode &&
-         dp -> argv [ 0 ] . desc . domain >= vtdAscii &&
-         dp -> argv [ 0 ] . desc . domain <= vtdUnicode )
-    {
-        if ( src_size_idx >= 3 && src_size_idx <= 5 &&
-             dst_size_idx >= 3 && dst_size_idx <= 5 )
-        {
-            rc = make_self ( rslt, & fself );
-            if ( rc != 0 )
-                return rc;
-
-            /* get reader */
-            fself -> read . chr = read_chr_tbl
-                [ ( dp -> argv [ 0 ] . desc . domain - vtdAscii ) * 3 + src_size_idx - 3 ];
-            if ( fself -> read . chr != NULL )
-            {
-                /* get writer */
-                fself -> write . chr = write_chr_tbl
-                    [ ( info -> fdesc . desc . domain - vtdAscii ) * 4 + dst_size_idx - 3 ];
-                if ( fself -> write . chr != NULL )
-                {
-                    /* set source and dest sizes */
-                    fself -> src_bits = 1 << src_size_idx;
-                    fself -> dst_bits = 1 << dst_size_idx;
-
-                    /* done */
-                    rslt -> u . rf = cast_chr;
-                    rslt -> variant = vftRow;
-                    return 0;
-                }
-            }
-
-            free ( fself );
-            rslt -> whack = NULL;
-        }
-    }
-
-    /* everything else is unsupported */
-    return RC ( rcVDB, rcFunction, rcConstructing, rcFunction, rcUnsupported );
-}
diff --git a/libs/vdb/column-cmn.c b/libs/vdb/column-cmn.c
deleted file mode 100644
index 5df824d..0000000
--- a/libs/vdb/column-cmn.c
+++ /dev/null
@@ -1,307 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-
-#define USE_KURT 1
-
-
-#include <vdb/extern.h>
-
-#define KONST const
-#include "column-priv.h"
-#include "dbmgr-priv.h"
-#include "schema-priv.h"
-#include "prod-priv.h"
-#include "blob-priv.h"
-#include "page-map.h"
-#undef KONST
-
-#include <vdb/manager.h>
-#include <kdb/column.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * VColumn
- */
-
-/* Whack
- */
-void VColumnDestroy ( VColumn *self )
-{
-#if PROD_REFCOUNT && ! PROD_ALL_IN_CURSOR
-    PROD_TRACK_REFCOUNT (VProductionRelease,self->in);
-    VProductionRelease ( self -> in, NULL ); 
-#endif
-#if USE_KURT
-    VBlobRelease ( self -> cache );
-#endif
-    VSchemaSever ( self -> schema );
-}
-
-
-/* Cmp
- * Sort
- */
-int CC VColumnCmp ( const void *item, const void *n )
-{
-    const VColumn *b = n;
-    return SColumnSort ( item, b -> scol );
-}
-
-int CC VColumnSort ( const void *item, const void *n )
-{
-    const VColumn *a = item;
-    const VColumn *b = n;
-    return SColumnSort ( a -> scol, b -> scol );
-}
-
-
-/* IdRange
- *  returns id range for column or page
- */
-rc_t VColumnIdRangeRead ( const VColumn *self, int64_t *first, int64_t *last )
-{
-    rc_t rc;
-
-    assert ( self != NULL );
-    assert ( first != NULL && last != NULL );
-
-    if ( self -> in == NULL )
-        rc = RC ( rcVDB, rcColumn, rcAccessing, rcRange, rcNotOpen );
-    else
-    {
-        /* a little silly, but set max range in 64-bit
-           without complaints from 32-bit compilers */
-        * first = 1;
-        * first <<= 63;
-        * last = ~ * first;
-
-        /* now intersect this range with all physical sources */
-        rc = VProductionColumnIdRange ( self -> in, first, last );
-        if ( rc == 0 )
-            return 0;
-    }
-
-    * first = * last = 0;
-
-    return rc;
-}
-
-rc_t VColumnPageIdRange ( const VColumn *self, int64_t id, int64_t *first, int64_t *last )
-{
-    rc_t rc;
-
-    assert ( self != NULL );
-    assert ( first != NULL && last != NULL );
-
-    if ( self -> in == NULL )
-        rc = RC ( rcVDB, rcColumn, rcAccessing, rcRange, rcNotOpen );
-    else
-    {
-        /* try to find page and get its range */
-        rc = VProductionPageIdRange ( self -> in, id, first, last );
-        if ( rc == 0 )
-            return 0;
-    }
-
-    * first = * last = 0;
-
-    return rc;
-}
-
-
-/* Datatype
- *  returns typedecl and/or typedef for column data
- *
- *  "type" [ OUT, NULL OKAY ] - returns the column type declaration
- *
- *  "def" [ OUT, NULL OKAY ] - returns the definition of the type
- *  returned in "type_decl"
- *
- * NB - one of "type" and "def" must be non-NULL
- */
-rc_t VColumnDatatype ( const VColumn *self, VTypedecl *type, VTypedesc *desc )
-{
-    assert ( self != NULL );
-    assert ( type != NULL || desc != NULL );
-
-    if ( type != NULL )
-        * type = self -> td;
-
-    if ( desc != NULL )
-        * desc = self -> desc;
-
-    return 0;
-}
-
-/* Init - PRIVATE
- */
-rc_t VColumnInit ( VColumn *self, const VSchema *schema, const SColumn *scol )
-{
-    rc_t rc = VSchemaDescribeTypedecl ( schema, & self -> desc, & scol -> td );
-    if ( rc == 0 )
-    {
-        self -> schema = VSchemaAttach ( schema );
-        self -> scol = scol;
-        self -> td = scol -> td;
-        self -> read_only = scol -> read_only;
-    }
-    return rc;
-}
-
-
-/* Make - PRIVATE
- *  make a read column
- */
-rc_t VColumnMake ( VColumn **colp, const VSchema *schema, const SColumn *scol )
-{
-    rc_t rc;
-    VColumn *col;
-
-    assert ( colp != NULL );
-    assert ( schema != NULL );
-
-    col = calloc ( 1, sizeof * col );
-    if ( col == NULL )
-        rc = RC ( rcVDB, rcColumn, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        rc = VColumnInit ( col, schema, scol );
-        if ( rc == 0 )
-        {
-            col -> read_only = true;
-            * colp = col;
-            return 0;
-        }
-
-        free ( col );
-    }
-
-    * colp = NULL;
-    return rc;
-}
-
-rc_t VColumnReadCachedBlob ( const VColumn *self, const VBlob *vblob, int64_t row_id,
-    uint32_t *elem_bits, const void **base, uint32_t *boff, uint32_t *row_len )
-{
-    uint64_t start;
-
-    * elem_bits = VTypedescSizeof ( & self -> desc );
-    * row_len = PageMapGetIdxRowInfo ( vblob -> pm, ( uint32_t ) ( row_id - vblob -> start_id ), boff );
-    start = ( uint64_t ) boff [ 0 ] * elem_bits [ 0 ];
-    * base = ( uint8_t* ) vblob -> data . base + ( start >> 3 );
-    * boff = ( uint32_t ) start & 7;
-
-    return 0;
-}
-
-rc_t VColumnReadBlob ( const VColumn *cself, const VBlob **vblobp, int64_t row_id,
-   uint32_t *elem_bits, const void **base, uint32_t *boff, uint32_t *row_len, VBlobMRUCacheCursorContext *cctx )
-{
-    rc_t rc;
-
-    if ( cself -> in == NULL )
-        rc = RC ( rcVDB, rcColumn, rcReading, rcColumn, rcNotOpen );
-    else
-    {
-        VBlob *vblob;
-        rc = VProductionReadBlob ( cself -> in, & vblob, row_id, 1, cctx );
-        if ( rc == 0 )
-        {
-            VColumn *self = ( VColumn* ) cself;
-            VColumnReadCachedBlob ( self, vblob, row_id, elem_bits, base, boff, row_len );
-
-#if USE_KURT
-            TRACK_BLOB ( VBlobRelease, self -> cache );
-            ( void ) VBlobRelease ( self -> cache );
-
-            if ( VBlobAddRef ( vblob ) != 0 )
-                self -> cache = NULL;
-            else
-                self -> cache = vblob;
-#endif
-
-            * vblobp = vblob;
-        }
-    }
-
-    return rc;
-}
-
-rc_t VColumnRead ( const VColumn *cself, int64_t row_id,
-   uint32_t *elem_bits, const void **base, uint32_t *boff, uint32_t *row_len,
-   VBlob **vblob)
-{
-    rc_t rc;
-    VBlob *dummy = NULL;
-    if (vblob == NULL)
-    {   vblob = &dummy; }
-
-    if ( cself -> in == NULL )
-        rc = RC ( rcVDB, rcColumn, rcReading, rcColumn, rcNotOpen );
-    else
-    {
-        rc = VProductionReadBlob ( cself -> in, vblob, row_id, 1, NULL );
-        if ( rc == 0 )
-        {
-            VColumn *self = ( VColumn* ) cself;
-            VColumnReadCachedBlob ( self, *vblob, row_id, elem_bits, base, boff, row_len );
-
-#if USE_KURT
-            TRACK_BLOB ( VBlobRelease, self -> cache );
-            ( void ) VBlobRelease ( self -> cache );
-            self -> cache = *vblob;
-#else
-            TRACK_BLOB ( VBlobRelease, *vblob );
-            ( void ) VBlobRelease ( *vblob );
-            *vblob = NULL;
-#endif
-        }
-    }
-
-    return rc;
-}
-
-/* IsStatic
- *  answers question: "does this column have the same value for every cell?"
- */
-rc_t VColumnIsStatic ( const VColumn *self, bool *is_static )
-{
-    if ( self != NULL )
-        return VProductionIsStatic ( self -> in, is_static );
-    
-    assert ( is_static != NULL );
-    * is_static = false;
-
-    return RC ( rcVDB, rcColumn, rcAccessing, rcSelf, rcNull );
-}
diff --git a/libs/vdb/column-priv.h b/libs/vdb/column-priv.h
deleted file mode 100644
index 2e26e5d..0000000
--- a/libs/vdb/column-priv.h
+++ /dev/null
@@ -1,294 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_column_priv_
-#define _h_column_priv_
-
-#ifndef _h_vdb_extern_
-#include <vdb/extern.h>
-#endif
-
-#ifndef _h_vdb_xform_
-#include <vdb/xform.h>
-#endif
-
-#ifndef _h_klib_container_
-#include <klib/container.h>
-#endif
-
-#ifndef _h_klib_data_buffer_
-#include <klib/data-buffer.h>
-#endif
-
-#include <os-native.h>
-
-#ifndef KONST
-#define KONST
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct Vector;
-struct VDBManager;
-struct VSchema;
-struct SColumn;
-struct SExpression;
-struct VProduction;
-struct VBlob;
-struct VBlobMRUCacheCursorContext;
-
-
-/*--------------------------------------------------------------------------
- * VColumn
- *  externally visible column object
- */
-typedef struct VColumn VColumn;
-struct VColumn
-{
-    /* for type queries */
-    struct VSchema const *schema;
-
-    /* typed column */
-    struct SColumn const *scol;
-
-    /* read production */
-    struct VProduction *in;
-
-    /* cached output */
-    struct VBlob *cache;
-
-    /* type information */
-    VTypedecl td;
-    VTypedesc desc;
-
-    /* vector ids */
-    uint32_t ord;
-
-    bool read_only;
-    uint8_t align [ 3 ];
-};
-
-void CC VColumnWhack ( void *item, void *curs );
-void VColumnDestroy ( VColumn *self );
-rc_t VColumnInit ( VColumn *self,
-    struct VSchema const *schema, struct SColumn const *scol );
-
-int CC VColumnCmp ( const void *item, const void *n );
-int CC VColumnSort ( const void *item, const void *n );
-
-rc_t VColumnMake ( VColumn **col,
-    struct VSchema const *schema, struct SColumn const *scol );
-
-rc_t VColumnIdRange ( const VColumn *self,
-    int64_t *first, int64_t *last );
-rc_t VColumnIdRangeRead ( const VColumn *self,
-    int64_t *first, int64_t *last );
-rc_t VColumnPageIdRange ( const VColumn *self,
-    int64_t id, int64_t *first, int64_t *last );
-
-rc_t VColumnDatatype ( const VColumn *self,
-    struct VTypedecl *type, struct VTypedesc *desc );
-
-rc_t VColumnRead ( const VColumn *self, int64_t row_id,
-   uint32_t *elem_bits, const void **base, uint32_t *boff, uint32_t *row_len,
-   struct VBlob **vblob );
-
-rc_t VColumnReadBlob ( const VColumn *self, struct VBlob const **blob, int64_t row_id,
-   uint32_t *elem_bits, const void **base, uint32_t *boff, uint32_t *row_len, struct VBlobMRUCacheCursorContext *cctx);
-
-rc_t VColumnReadCachedBlob ( const VColumn *self, struct VBlob const *blob, int64_t row_id,
-   uint32_t *elem_bits, const void **base, uint32_t *boff, uint32_t *row_len );
-
-rc_t VColumnIsStatic ( const VColumn *self, bool *is_static );
-
-/*--------------------------------------------------------------------------
- * WColumn
- *  column with input buffer
- */
-typedef struct WColumn WColumn;
-struct WColumn
-{
-    VColumn dad;
-
-    /* half-closed range of buffered rows */
-    int64_t start_id, end_id;
-
-    /* half-closed id for page cutoff */
-    int64_t cutoff_id;
-
-    /* alternate read production */
-    struct VProduction *alt;
-
-    /* validate production */
-    struct VProduction *val;
-
-    /* write production */
-    struct VProduction *out;
-
-    /* output page */
-    struct VBlob *page;
-
-    /* default row data */
-    KDataBuffer dflt;
-
-    /* accumulators */
-    KDataBuffer data, rowmap;
-
-    /* peak byte size history of data accumulator */
-    size_t data_peak_hist [ 16 ];
-    size_t data_peak;
-
-    /* total committed bits in buffer */
-    bitsz_t bits_in_buffer;
-
-    /* number of uncommitted bits in buffer */
-    bitsz_t row_len;
-
-    /* size ( in bytes ) to trigger page commit */
-    size_t trigger;
-
-    /* number of committed rows in buffer */
-    size_t num_rows;
-
-    /* peak history index */
-    uint8_t peak_hist_idx;
-
-    /* true if there is a default value */
-    bool have_dflt;
-
-    /* set upon any successful write */
-    bool row_written;
-
-    /* set if the last row written was default */
-    bool dflt_last;
-
-    /* set upon row commit */
-    bool row_committed;
-};
-
-/* WColumnRowMap
- */
-typedef struct WColumnRowMap WColumnRowMap;
-struct WColumnRowMap
-{
-    int64_t start_id;
-    uint64_t len, cnt;
-};
-
-rc_t WColumnMake ( VColumn **col, struct VSchema const *schema,
-    struct SColumn const *scol, struct SExpression const *dflt_limit,
-    struct VDBManager *mgr, struct Vector *cx_bind );
-
-rc_t WColumnSetDefault ( VColumn *self,
-    bitsz_t elem_bits, const void *buffer, bitsz_t boff, uint64_t len );
-rc_t WColumnWrite ( VColumn *self,
-    bitsz_t elem_bits, const void *buffer, bitsz_t boff, uint64_t len );
-
-/* OpenRow
- *  update state
- *
- *  "const_row_id" [ IN, CONST ] - id of row being opened. useful
- *  only on initial open when no other rows are buffered.
- */
-void CC WColumnOpenRow ( void *self, void *const_row_id );
-
-/* RowDefaults
- *  if a row has not been written but has a default value,
- *  that value is written to the row. if no default exists,
- *  an error is generated.
- *
- *  "rc" [ OUT, DEFAULT ZERO ] - preset to 0
- *
- *  returns true if any error occurs ( i.e. "*rc != 0" )
- */
-bool CC WColumnRowDefaults ( void *self, void *rc );
-
-/* CommitRow
- *  closes the row to further writes and accepts
- *  all data written so far as complete. if the accumulated
- *  page data trigger a flush, the flush parameter is set.
- *
- *  "end_id" [ IN/OUT ] - used to calculate the minimum
- *  end_id for pages. if the column decides that it has too
- *  much data in its buffer and wants a cutoff < current
- *  value, it can lower the id.
- *
- *  returns true if there was a memory error.
- */
-bool CC WColumnCommitRow ( void *self, void *end_id );
-
-/* RepeatRow
- *  go into the last row entry
- *  extend the count by count
- *  data points to this structure
- */
-typedef struct { int64_t end_id; uint64_t count; } WColumnRepeatRowData;
-void CC WColumnRepeatRow ( void *self, void *data );
-
-/* CloseRow
- *  discards uncommitted data
- *  update state
- */
-void CC WColumnCloseRow ( void *self, void *ignore );
-
-/* BufferPage
- *  captures page range
- *
- *  "end_id" [ IN, CONST ] - half-closed id of buffered range end
- *  column should capture this information for creating page
- *  id range either on demand, or pre-prepared.
- *
- *  returns true if there was a memory error.
- */
-bool CC WColumnBufferPage ( void *self, void *const_end_id );
-
-/* DropPage
- *  drops all rows associated with committed page
- */
-void CC WColumnDropPage ( void *self, void *ignore );
-
-/* ReadBlob
- *  reads an input blob
- *  returns a blob with all rows in commit range
- *
- *  "vblob" [ OUT ] - page to return
- *
- *  "id" [ IN ] - an id that must be within page range
- *  returns rcNotFound and NULL blob if id is not within range
- */
-rc_t WColumnReadBlob ( WColumn *self, struct VBlob **vblob, int64_t id );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_column_priv_ */
diff --git a/libs/vdb/column.c b/libs/vdb/column.c
deleted file mode 100644
index 4c4c741..0000000
--- a/libs/vdb/column.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#define KONST const
-#include "column-priv.h"
-#include "dbmgr-priv.h"
-#include "schema-priv.h"
-#include "cursor-priv.h"
-#undef KONST
-
-#include <vdb/manager.h>
-#include <vdb/cursor.h>
-#include <kdb/column.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-
-/*--------------------------------------------------------------------------
- * VColumn
- */
-
-
-/* Whack
- *  perform read-only cleanup
- */
-void CC VColumnWhack ( void *item, void *data )
-{
-    VColumn *self = item;
-    VCursor *curs = data;
-
-    /* remove from cursor */
-    if ( curs != NULL )
-    {
-        VectorSwap ( & curs -> row, self -> ord, NULL, & item );
-        VCursorCacheSwap ( & curs -> col, & self -> scol -> cid, NULL, & item );
-    }
-
-    VColumnDestroy ( self );
-    free ( self );
-}
-
-
-/* IdRange
- *  returns id range for column or page
- */
-rc_t VColumnIdRange ( const VColumn *self, int64_t *first, int64_t *last )
-{
-    return VColumnIdRangeRead ( self, first, last );
-}
diff --git a/libs/vdb/compare.c b/libs/vdb/compare.c
deleted file mode 100644
index e72f374..0000000
--- a/libs/vdb/compare.c
+++ /dev/null
@@ -1,242 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include "blob.h"
-#include "blob-headers.h"
-#include "page-map.h"
-#include "blob-priv.h"
-#include "xform-priv.h"
-#include "prod-priv.h"
-
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <klib/debug.h>
-#include <atomic32.h>
-#include <bitstr.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <assert.h>
-
-#define RC_NOT_SAME RC(rcVDB, rcBlob, rcValidating, rcData, rcCorrupt)
-
-typedef struct float_compare_t {
-    unsigned sig_bits;
-} float_compare_t;
-
-static
-rc_t CC blob_compare(
-                  void *self,
-                  const VRowData *orig,
-                  const VRowData *test
-) {
-    const bitsz_t o_ofs = (size_t)orig->u.data.first_elem * orig->u.data.elem_bits;
-    const bitsz_t t_ofs = (size_t)test->u.data.first_elem * orig->u.data.elem_bits;
-    const bitsz_t bits = (size_t)orig->u.data.elem_count * orig->u.data.elem_bits;
-    int cmp;
-
-    if (orig->u.data.elem_bits % 8 == 0) {
-        cmp = memcmp(
-                   &((const char *)orig->u.data.base)[o_ofs >> 3],
-                   &((const char *)test->u.data.base)[t_ofs >> 3],
-                   bits >> 3
-            );
-    }
-    else {
-        cmp = bitcmp(orig->u.data.base, o_ofs, test->u.data.base, t_ofs, bits);
-    }
-    if(cmp)
-	return RC_NOT_SAME;
-    return 0;
-
-}
-static bool equal_f32( const float A[], const float B[], uint64_t elem_count, unsigned sig_bits ) {
-    unsigned i;
-    const int shift = 24 - sig_bits;
-    
-    assert(shift > 0);
-    
-    for (i = 0; i != elem_count; ++i) {
-        int expa;
-        int expb;
-        uint32_t mana;
-        uint32_t manb;
-        float a = A[i];
-        float b = B[i];
-        int diff;
-        
-        if (a < 0) {
-            a = -a;
-            b = -b;
-            if (b < 0)
-                return false;
-        }
-
-        a = frexpf(a, &expa);
-        b = frexpf(b, &expb);
-        
-        if (expa < expb) {
-            ++expa;
-            a /= 2.0;
-        }
-        else if (expb < expa) {
-            ++expb;
-            b /= 2.0;
-        }
-        if (expa != expb)
-            return false;
-        
-        mana = (uint32_t)ldexpf( a, 24 );
-        manb = (uint32_t)ldexpf( b, 24 );
-        
-        diff = (mana >> shift) - (manb >> shift);
-
-        if (-1 > diff || diff > 1)
-            return false;
-    }
-    return true;
-}
-
-static
-rc_t CC blob_compare_f32(
-                      void *Self,
-                      const VRowData *orig,
-                      const VRowData *test
-) {
-    float_compare_t *self = Self;
-    
-    if (!equal_f32(
-                   &((const float *)orig->u.data.base)[orig->u.data.first_elem],
-                   &((const float *)test->u.data.base)[test->u.data.first_elem],
-                   orig->u.data.elem_count,
-                   self->sig_bits
-               ))
-    {
-        return RC_NOT_SAME;
-    }
-    
-    return 0;
-}
-
-static
-void CC vfunc_free ( void * self )
-{
-    free (self);
-}
-
-VTRANSFACT_BUILTIN_IMPL(vdb_compare, 1, 0, 0) (
-                                       const void *self,
-                                       const VXfactInfo *info,
-                                       VFuncDesc *rslt,
-                                       const VFactoryParams *cp,
-                                       const VFunctionParams *dp
-) 
-{
-    VTypedesc type;
-    assert ( dp->argc == 2 );
-
-    rslt->variant = prodFuncBuiltInCompare;
-    
-#if 0
-    if (dp->argv[0].desc.domain != dp->argv[1].desc.domain ||
-        dp->argv[0].desc.intrinsic_dim != dp->argv[1].desc.intrinsic_dim ||
-        dp->argv[0].desc.intrinsic_bits != dp->argv[1].desc.intrinsic_bits
-    ) {
-        return RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-    }
-#endif
-    type = dp->argv[0].desc;
-    
-    if (type.domain == vtdFloat) {
-        if (cp->argc > 0) {
-            unsigned sig_bits = cp->argv[0].data.u32[0];
-
-            if (sig_bits == 0) {
-                return RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-            }
-            switch (type.intrinsic_bits) {
-            case 32:
-                if (sig_bits < 24)
-                    VFUNCDESC_INTERNAL_FUNCS(rslt)->cf = blob_compare_f32;
-                break;
-            case 64:
-#if 0
-                if (sig_bits < 52)
-                    VFUNCDESC_INTERNAL_FUNCS(rslt)->cf = blob_compare_f64;
-#endif
-                break;
-            default:
-                break;
-            }
-            if (VFUNCDESC_INTERNAL_FUNCS(rslt)->cf) {
-                float_compare_t *Self;
-            
-                Self = malloc(sizeof *Self);
-                if (Self == NULL)
-                    return RC(rcVDB, rcFunction, rcConstructing, rcMemory, rcExhausted);
-
-                Self->sig_bits = sig_bits;
-            
-                rslt->self = Self;
-                rslt->whack = vfunc_free;
-                return 0;
-            }
-        }
-        else {
-            VDB_DEBUG (("warning: using identity compare for floating point types won't work if using fzip\n"));
-        }
-    }
-    VFUNCDESC_INTERNAL_FUNCS(rslt)->cf = blob_compare;
-    return 0;
-}
-
-static
-rc_t CC true_func(
-                  void *self,
-                  const VRowData *orig,
-                  const VRowData *test
-) {
-    return 0;
-}
-
-VTRANSFACT_BUILTIN_IMPL(vdb_no_compare, 1, 0, 0) (
-                                       const void *self,
-                                       const VXfactInfo *info,
-                                       VFuncDesc *rslt,
-                                       const VFactoryParams *cp,
-                                       const VFunctionParams *dp
-) 
-{
-    rslt->variant = prodFuncBuiltInCompare;
-    VFUNCDESC_INTERNAL_FUNCS(rslt)->cf = true_func;
-    return 0;
-}
diff --git a/libs/vdb/cursor-cmn.c b/libs/vdb/cursor-cmn.c
deleted file mode 100644
index 0f8f331..0000000
--- a/libs/vdb/cursor-cmn.c
+++ /dev/null
@@ -1,2481 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#include <va_copy.h>
-
-#define TRACK_REFERENCES 0
-
-#define KONST const
-#define SKONST
-#include "cursor-priv.h"
-#include "dbmgr-priv.h"
-#include "linker-priv.h"
-#include "table-priv.h"
-#include "schema-priv.h"
-#include "schema-parse.h"
-#include "column-priv.h"
-#include "phys-priv.h"
-#include "prod-priv.h"
-#include "prod-expr.h"
-#undef KONST
-#undef SKONST
-#include "blob-priv.h"
-#include "page-map.h"
-
-#include <vdb/cursor.h>
-#include <vdb/table.h>
-#include <vdb/vdb-priv.h>
-#include <kdb/table.h>
-#include <kdb/meta.h>
-#include <kdb/namelist.h>
-#include <kfs/dyload.h>
-#include <klib/symbol.h>
-#include <klib/symtab.h>
-#include <klib/namelist.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <bitstr.h>
-#include <os-native.h>
-#include <sysalloc.h>
-
-#include <kproc/lock.h>
-#include <kproc/cond.h>
-#include <kproc/thread.h>
-
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-
-#define PERMIT_POST_OPEN_ADD 1
-#if _ARCH_BITS == 32
-#define DISABLE_READ_CACHE 1
-#else
-#define DISABLE_READ_CACHE 0
-#endif
-
-/* normally false
-   can be set for certain applications using VDBManagerDisablePagemapThread
-*/
-static bool s_disable_pagemap_thread;
-
-
-/*--------------------------------------------------------------------------
- * VCursorCache
- */
-
-/* Whack
- */
-void VCursorCacheWhack ( VCursorCache *self,
-    void ( CC * whack ) ( void *item, void *data ), void *data )
-{
-    uint32_t i = VectorStart ( & self -> cache );
-    uint32_t end = VectorLength ( & self -> cache );
-    for ( end += i; i < end; ++ i )
-    {
-        Vector *ctx;
-        rc_t rc = VectorSwap ( & self -> cache, i, NULL, ( void** ) & ctx );
-        if ( rc == 0 && ctx != NULL )
-        {
-            VectorWhack ( ctx, whack, data );
-            free ( ctx );
-        }
-    }
-
-    VectorWhack ( & self -> cache, NULL, NULL );
-}
-
-
-/* Get
- *  retrieve object by cid
- */
-void *VCursorCacheGet ( const VCursorCache *self, const VCtxId *cid )
-{
-    const Vector *ctx = ( const void* ) VectorGet ( & self -> cache, cid -> ctx );
-    return VectorGet ( ctx, cid -> id );
-}
-
-/* Set
- *  set object by cid
- */
-rc_t VCursorCacheSet ( VCursorCache *self, const VCtxId *cid, const void *item )
-{
-    Vector *ctx = VectorGet ( & self -> cache, cid -> ctx );
-    if ( ctx == NULL )
-    {
-        rc_t rc;
-
-        ctx = malloc ( sizeof * ctx );
-        if ( ctx == NULL )
-            return RC ( rcVDB, rcVector, rcConstructing, rcMemory, rcExhausted );
-
-        rc = VectorSet ( & self -> cache, cid -> ctx, ctx );
-        if ( rc != 0 )
-        {
-            free ( ctx );
-            return rc;
-        }
-
-        VectorInit ( ctx, 0, 16 );
-    }
-
-    return VectorSet ( ctx, cid -> id, item );
-}
-
-/* Swap
- *  swap object by cid
- */
-rc_t VCursorCacheSwap ( VCursorCache *self, const VCtxId *cid, const void *item, void **prior )
-{
-    Vector *ctx = VectorGet ( & self -> cache, cid -> ctx );
-    if ( ctx == NULL )
-    {
-        * prior = NULL;
-        return VCursorCacheSet ( self, cid, item );
-    }
-    return VectorSwap ( ctx, cid -> id, item, prior );
-}
-
-
-/*--------------------------------------------------------------------------
- * NamedParamNode
- */
-
-typedef struct NamedParamNode NamedParamNode;
-struct NamedParamNode
-{
-    BSTNode n;
-    String name;
-    KDataBuffer value;
-};
-
-static
-void CC NamedParamNodeWhack ( BSTNode *n, void *ignore )
-{
-    NamedParamNode *self = ( NamedParamNode* ) n;
-    KDataBufferWhack ( & self -> value );
-    free ( self );
-}
-
-static
-int CC NamedParamComp ( const void *item, const BSTNode *n )
-{
-    const String *name = item;
-    const NamedParamNode *node = ( const NamedParamNode* ) n;
-
-    return StringOrderNoNullCheck ( name, & node -> name );
-}
-
-static
-int CC NamedParamNodeComp ( const BSTNode *A, const BSTNode *B )
-{
-    const NamedParamNode *a = (const NamedParamNode *) A;
-    const NamedParamNode *b = (const NamedParamNode *) B;
-
-    return StringOrderNoNullCheck ( & a -> name, & b -> name );
-}
-/*--------------------------------------------------------------------------
- * LinkedCursorNode
- */
-
-typedef struct LinkedCursorNode LinkedCursorNode;
-struct LinkedCursorNode
-{
-    BSTNode n;
-    char tbl[64];
-    VCursor *curs;
-};
-
-static
-void CC LinkedCursorNodeWhack ( BSTNode *n, void *ignore )
-{
-    LinkedCursorNode *self = ( LinkedCursorNode* ) n;
-    VCursorRelease (  self -> curs );
-    free ( self );
-}
-
-static
-int CC LinkedCursorComp ( const void *item, const BSTNode *n )
-{
-    const char *tbl = item;
-    const LinkedCursorNode *node = ( const LinkedCursorNode* ) n;
-
-    return strncmp ( tbl, node -> tbl, sizeof(node -> tbl) );
-}
-
-static
-int CC LinkedCursorNodeComp ( const BSTNode *A, const BSTNode *B )
-{
-    const LinkedCursorNode *a = (const LinkedCursorNode *) A;
-    const LinkedCursorNode *b = (const LinkedCursorNode *) B;
-
-    return strncmp ( a -> tbl, b -> tbl,sizeof(a->tbl) );
-}
-
-
-
-/*--------------------------------------------------------------------------
- * VCursor
- *  a row cursor onto a VTable
- */
-
-static void CC VCursorVColumnWhack_checked( void *item, void *data )
-{
-    if ( item != NULL )
-        VColumnWhack( item, data );
-}
-
-/* Whack
- */
-rc_t VCursorDestroy ( VCursor *self )
-{
-    KRefcountWhack ( & self -> refcount, "VCursor" );
-    VBlobMRUCacheDestroy ( self->blob_mru_cache);
-    if ( self -> user_whack != NULL )
-        ( * self -> user_whack ) ( self -> user );
-    BSTreeWhack ( & self -> named_params, NamedParamNodeWhack, NULL );
-    BSTreeWhack ( & self -> linked_cursors, LinkedCursorNodeWhack, NULL );
-    VCursorCacheWhack ( & self -> col, NULL, NULL );
-    VCursorCacheWhack ( & self -> phys, VPhysicalWhack, NULL );
-    VCursorCacheWhack ( & self -> prod, NULL, NULL );
-    VectorWhack ( & self -> owned, VProductionWhack, NULL );
-    VectorWhack ( & self -> trig, NULL, NULL );
-    VectorWhack ( & self -> row, VCursorVColumnWhack_checked, NULL );
-
-    VSchemaRelease ( self -> schema );
-
-    VTableSever ( self -> tbl );
-
-    free ( self );
-
-    return 0;
-}
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-LIB_EXPORT rc_t CC VCursorAddRef ( const VCursor *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "VCursor" ) )
-        {
-        case krefLimit:
-            return RC ( rcVDB, rcCursor, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC VCursorRelease ( const VCursor *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "VCursor" ) )
-        {
-        case krefWhack:
-            return VCursorWhack ( ( VCursor* ) self );
-        case krefNegative:
-            return RC ( rcVDB, rcCursor, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-/* Make - PRIVATE
- */
-rc_t VCursorMake ( VCursor **cursp, const VTable *tbl )
-{
-    rc_t rc;
-    VCursor *curs;
-
-    /* must have return param */
-    assert ( cursp != NULL );
-
-    /* must have parent tbl */
-    assert ( tbl != NULL );
-
-    /* create a structure */
-    curs = calloc ( 1, sizeof * curs );
-    if ( curs == NULL )
-        rc = RC ( rcVDB, rcCursor, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        /* create a separate schema object */
-        rc = VSchemaMake ( & curs -> schema, tbl -> schema );
-        if ( rc == 0 )
-        {
-            /* extend table schema to populate with implicits */
-            rc = STableCloneExtend ( tbl -> stbl, & curs -> stbl, curs -> schema );
-            if ( rc == 0 )
-            {
-                curs -> tbl = VTableAttach ( tbl );
-                VectorInit ( & curs -> row, 1, 16 );
-                VCursorCacheInit ( & curs -> col, 0, 16 );
-                VCursorCacheInit ( & curs -> phys, 0, 16 );
-                VCursorCacheInit ( & curs -> prod, 0, 16 );
-                VectorInit ( & curs -> owned, 0, 64 );
-                VectorInit ( & curs -> trig, 0, 64 );
-                KRefcountInit ( & curs -> refcount, 1, "VCursor", "make", "vcurs" );
-                curs -> state = vcConstruct;
-                curs -> permit_add_column = true;
-                curs -> suspend_triggers  = false;
-                * cursp = curs;
-                return 0;
-            }
-
-            VSchemaRelease ( curs -> schema );
-        }
-
-        free ( curs );
-    }
-
-    * cursp = NULL;
-
-    return rc;
-}
-
-/* SupplementSchema
- *  scan table for physical column names
- *  create transparent yet incomplete (untyped) columns for unknown names
- *  create incomplete (untyped) physical columns for forwarded names
- *  repeat process on static columns, except create complete (fully typed) objects
- */
-static
-rc_t VCursorSupplementName ( const KSymTable *tbl,
-    STable *stbl, const VTypedecl *td, const char *name )
-{
-    rc_t rc = 0;
-    char buffer [ 256 ];
-
-    /* create physical name string */
-    int len = snprintf ( buffer, sizeof buffer, ".%s", name );
-    if ( len < 0 || len >= sizeof buffer )
-        rc = RC ( rcVDB, rcCursor, rcConstructing, rcName, rcExcessive );
-    else
-    {
-        KSymbol *sym;
-
-        String pname, cname;
-        StringInit ( & pname, buffer, len, string_len ( buffer, len ) );
-
-        /* if physical name is known */
-        sym = KSymTableFind ( tbl, & pname );
-        if ( sym != NULL )
-        {
-            /* if it is being implemented here */
-            if ( sym -> type == eVirtual )
-                rc = STableImplicitPhysMember ( stbl, td, sym, & pname );
-            return rc;
-        }
-
-        /* if simple name is unknown, add implicit */
-        sym = KSymTableFind ( tbl, StringSubstr ( & pname, & cname, 1, 0 ) );
-        if ( sym == NULL )
-        {
-            /* create implicit physical */
-            rc = STableImplicitPhysMember ( stbl, td, sym, & pname );
-            if ( rc == 0 )
-                rc = STableImplicitColMember ( stbl, & cname, & pname );
-        }
-    }
-    return rc;
-}
-
-static
-rc_t VCursorSupplementPhysical ( const KSymTable *tbl, const VCursor *self )
-{
-    KNamelist *names;
-    rc_t rc = KTableListCol ( self -> tbl -> ktbl, & names );
-    if ( rc == 0 )
-    {
-        uint32_t i, count;
-        rc = KNamelistCount ( names, & count );
-        for ( i = 0; rc == 0 && i < count; ++ i )
-        {
-            const char *name;
-            rc = KNamelistGet ( names, i, & name );
-            if ( rc == 0 )
-                rc = VCursorSupplementName ( tbl, self -> stbl, NULL, name );
-        }
-        KNamelistRelease ( names );
-    }
-    return rc;
-}
-
-static
-rc_t VCursorSupplementStatic ( const KSymTable *tbl, const VCursor *self )
-{
-    rc_t rc;
-    KNamelist *names;
-
-    const KMDataNode *root = self -> tbl -> col_node;
-    if ( root == NULL )
-        return 0;
-
-    rc = KMDataNodeListChild ( root, & names );
-    if ( rc == 0 )
-    {
-        uint32_t i, count;
-        rc = KNamelistCount ( names, & count );
-        for ( i = 0; rc == 0 && i < count; ++ i )
-        {
-            const char *name;
-            rc = KNamelistGet ( names, i, & name );
-            if ( rc == 0 )
-            {
-                const KMDataNode *node;
-                rc = KMDataNodeOpenNodeRead ( root, & node, name );
-                if ( rc == 0 )
-                {
-                    size_t size;
-                    char typedecl [ 256 ];
-                    rc = KMDataNodeReadAttr ( node, "type", typedecl, sizeof typedecl, & size );
-                    if ( rc == 0 && size != 0 )
-                    {
-                        VTypedecl td;
-                        rc = VSchemaResolveTypedecl ( self -> schema, & td, typedecl );
-                        if ( rc == 0 )
-                            rc = VCursorSupplementName ( tbl, self -> stbl, & td, name );
-
-                        rc = 0; /*** don't care if name is not in the schema ***/
-		
-                    }
-
-                    KMDataNodeRelease ( node );
-                }
-            }
-        }
-
-        KNamelistRelease ( names );
-    }
-
-    return rc;
-}
-
-rc_t VCursorSupplementSchema ( const VCursor *self )
-{
-    KSymTable tbl;
-    rc_t rc = init_tbl_symtab ( & tbl, self -> schema, self -> stbl );
-    if ( rc == 0 )
-    {
-        rc = VCursorSupplementPhysical ( & tbl, self );
-        if ( rc == 0 )
-            rc = VCursorSupplementStatic ( & tbl, self );
-        KSymTableWhack ( & tbl );
-    }
-    return rc;
-}
-
-
-/* CreateCachedCursorRead
- *  creates a read cursor object onto table with a cache limit in bytes
- *
- *  AVAILABILITY: version 2.1
- *
- *  "curs" [ OUT ] - return parameter for newly created cursor
- *
- *  "capacity" [ IN ] - the maximum bytes to cache on the cursor before
- *  dropping least recently used blobs
- */
-static rc_t VTableCreateCachedCursorReadImpl ( const VTable *self,
-    const VCursor **cursp, size_t capacity, bool create_pagemap_thread  )
-{
-    rc_t rc;
-#if DISABLE_READ_CACHE
-    capacity = 0;
-#endif
-    if ( cursp == NULL )
-        rc = RC ( rcVDB, rcTable, rcOpening, rcParam, rcNull );
-    else {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcTable, rcOpening, rcSelf, rcNull );
-        else {
-            VCursor *curs;
-#if LAZY_OPEN_COL_NODE
-            if ( self -> col_node == NULL )
-                KMetadataOpenNodeRead ( self -> meta, & ( ( VTable* ) self ) -> col_node, "col" );
-#endif
-            rc = VCursorMake ( & curs, self );
-            if ( rc == 0 ) {
-                curs -> blob_mru_cache = VBlobMRUCacheMake(capacity);
-                curs -> read_only = true;
-                rc = VCursorSupplementSchema ( curs );
-               
-#if 0  
-                if ( create_pagemap_thread && capacity > 0 && rc == 0 )
-                {
-                    rc = VCursorLaunchPagemapThread ( curs );
-                    if ( rc != 0 )
-                    {
-                        if ( GetRCState( rc ) == rcNotAvailable )
-                            rc = 0;
-                    }
-                }   
-#endif
-                if ( rc == 0 )
-                {
-                    if(capacity > 0)
-                        curs->launch_cnt = 5;
-                    else
-                        curs->launch_cnt=200;
-                    * cursp = curs;
-                    return 0;
-                }
-                VCursorRelease ( curs );
-            }
-        }
-        * cursp = NULL;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VTableCreateCachedCursorRead ( const VTable *self,
-    const VCursor **cursp, size_t capacity )
-{
-	return VTableCreateCachedCursorReadImpl(self,cursp,capacity,true);
-}
-
-/**
-*** VTableCreateCursorReadInternal is only visible in vdb and needed for schema resolutions
-****/
-rc_t  VTableCreateCursorReadInternal(const VTable *self, const VCursor **cursp)
-{
-	return VTableCreateCachedCursorReadImpl(self,cursp,0,false);
-}
-
-/* CreateCursor
- *  creates a cursor object onto table
- *  multiple read cursors are allowed
- *  only a single write cursor is allowed
- *
- *  "curs" [ OUT ] - return parameter for newly created cursor
- */
-LIB_EXPORT rc_t CC VTableCreateCursorRead ( const VTable *self, const VCursor **curs )
-{
-    /* will be deprecated in the future */
-    return VTableCreateCachedCursorRead ( self, curs, 0 );
-}
-
-/* PermitPostOpenAdd
- *  allows columns to be added to open cursor
- *  for write cursor, the effect lasts until the first row commit
- */
-LIB_EXPORT rc_t CC VCursorPermitPostOpenAdd ( const VCursor *cself )
-{
-    rc_t rc;
-    VCursor *self = ( VCursor* ) cself;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcCursor, rcUpdating, rcSelf, rcNull );
-    else if ( self -> state == vcFailed )
-        rc = RC ( rcVDB, rcCursor, rcUpdating, rcCursor, rcInvalid );
-    else if ( self -> state != vcConstruct )
-        rc = RC ( rcVDB, rcCursor, rcUpdating, rcCursor, rcOpen );
-    else
-    {
-        self -> permit_post_open_add = true;
-        rc = 0;
-    }
-
-    return rc;
-}
-/*  SuspendTriggers
- *  blocks resolution of schema-based triggers
- *  
- */
-LIB_EXPORT rc_t CC VCursorSuspendTriggers ( const VCursor *cself )
-{
-    rc_t rc;
-    VCursor *self = ( VCursor* ) cself;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcCursor, rcUpdating, rcSelf, rcNull );
-    else
-    {
-        self -> suspend_triggers = true;
-        rc = 0;
-    }
-
-    return rc;
-}
-
-
-/* AddSColumn
- */
-static
-rc_t VCursorAddSColumn ( VCursor *self, uint32_t *idx,
-    const SColumn *scol, const VTypedecl *cast, Vector *cx_bind )
-{
-    rc_t rc;
-    VColumn *col;
-
-    if ( self -> read_only )
-    {
-        /* must be readable */
-        if ( scol -> read == NULL )
-            return RC ( rcVDB, rcCursor, rcUpdating, rcColumn, rcWriteonly );
-    }
-    else
-    {
-        /* must be writable */
-        if ( scol -> read_only || ( scol -> read == NULL && scol -> validate == NULL ) )
-            return RC ( rcVDB, rcCursor, rcUpdating, rcColumn, rcReadonly );
-    }
-
-    /* must not already be there - benign error */
-    col = VCursorCacheGet ( & self -> col, & scol -> cid );
-    if ( col != NULL )
-    {
-        * idx = col -> ord;
-        return RC ( rcVDB, rcCursor, rcUpdating, rcColumn, rcExists );
-    }
-
-    /* make object */
-    rc = VCursorMakeColumn ( self, & col, scol, cx_bind );
-    if ( rc == 0 )
-    {
-        /* insert it into vectors */
-        rc = VectorAppend ( & self -> row, & col -> ord, col );
-        if ( rc == 0 )
-        {
-            void *ignore;
-            rc = VCursorCacheSet ( & self -> col, & scol -> cid, col );
-            if ( rc == 0 )
-            {
-                /* open column if cursor open or type unknown */
-                if ( self -> state >= vcReady || scol -> td . type_id == 0 )
-                {
-                    rc = VCursorPostOpenAdd ( self, col );
-                    assert ( rc != 0 || scol -> td . type_id != 0 );
-                }
-                if ( rc == 0 )
-                {
-                    /* check cast of SColumn against requested type
-                       this is to handle the case where the column
-                       was created incomplete, i.e. with unknown type */
-                    if ( cast == NULL || VTypedeclToTypedecl ( & scol -> td,
-                             self -> schema, cast, & col -> td, NULL ) )
-                    {
-                        /* has been entered */
-                        * idx = col -> ord;
-                        return 0;
-                    }
-                }
-
-                /* bail out */
-                VCursorCacheSwap ( & self -> col, & scol -> cid, NULL, & ignore );
-            }
-
-            VectorSwap ( & self -> row, col -> ord, NULL, & ignore );
-        }
-
-        VColumnWhack ( col, NULL );
-    }
-
-    return rc;
-}
-
-
-/* AddColspec
- *  a "colspec" is either a simple column name or a typed name expression
- *  uses STable to evaluate colspec and find an SColumn
- */
-static
-rc_t VCursorAddColspec ( VCursor *self, uint32_t *idx, const char *colspec )
-{
-    rc_t rc;
-
-    /* find an appropriate column in schema */
-    uint32_t type;
-    VTypedecl cast;
-    const SNameOverload *name;
-    const SColumn *scol = STableFind ( self -> tbl -> stbl, self -> schema,
-        & cast, & name, & type, colspec, "VCursorAddColspec", true );
-    if ( scol == NULL || type != eColumn )
-        rc = RC ( rcVDB, rcCursor, rcUpdating, rcColumn, rcNotFound );
-    else
-    {
-        Vector cx_bind;
-        VectorInit ( & cx_bind, 1, self -> schema -> num_indirect );
-        rc = VCursorAddSColumn ( self, idx, scol, & cast, & cx_bind );
-        VectorWhack ( & cx_bind, NULL, NULL );
-    }
-
-    return rc;
-}
-
-
-/* AddColumn
- *  add a column to an unopened cursor
- *
- *  "idx" [ OUT ] - return parameter for column index
- *
- *  "name" [ IN ] - NUL terminated column name spec.
- *  to identify a column by name, provide the column name
- *  by itself. if there are multiple types available under
- *  that name, the default type for that column will be
- *  selected. to select a specific type, the name may
- *  be cast to that type using a cast expression, e.g.
- *    "( type ) name"
- *  the special name "*" may be added to a read cursor.
- */
-LIB_EXPORT rc_t CC VCursorVAddColumn ( const VCursor *cself,
-    uint32_t *idx, const char *name, va_list args )
-{
-    rc_t rc;
-    VCursor *self = ( VCursor* ) cself;
-
-    if ( idx == NULL )
-        rc = RC ( rcVDB, rcCursor, rcUpdating, rcParam, rcNull );
-    else
-    {
-        * idx = 0;
-
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcCursor, rcUpdating, rcSelf, rcNull );
-        else if ( name == NULL )
-            rc = RC ( rcVDB, rcCursor, rcUpdating, rcName, rcNull );
-        else if ( name [ 0 ] == 0 )
-            rc = RC ( rcVDB, rcCursor, rcUpdating, rcName, rcEmpty );
-        else if ( self -> state == vcFailed )
-            rc = RC ( rcVDB, rcCursor, rcUpdating, rcCursor, rcInvalid );
-        else if ( self -> state != vcConstruct && ! self -> permit_add_column )
-            rc = RC ( rcVDB, rcCursor, rcUpdating, rcCursor, rcLocked );
-        else
-        {
-            char colspec [ 1024 ];
-            int len = vsnprintf ( colspec, sizeof colspec, name, args );
-            if ( len < 0 || len >= sizeof colspec )
-                rc = RC ( rcVDB, rcCursor, rcUpdating, rcName, rcExcessive );
-            else
-            {
-                rc = VCursorAddColspec ( self, idx, colspec );
-                if ( rc == 0 || GetRCState ( rc ) == rcExists )
-                    return rc;
-            }
-
-            if ( ! self -> permit_add_column )
-            {
-                PLOGERR ( klogErr, ( klogErr, rc, "failed to add column '$(spec)' to cursor",
-                                     "spec=%s", colspec ));
-            }
-            return rc;
-        }
-    }
-
-    LOGERR ( klogErr, rc, "failed to add column" );
-
-    return rc;
-}
-
-
-/* AddColumn
- *  add a column to an unopened cursor
- *
- *  "idx" [ OUT ] - return parameter for column index
- *
- *  "name" [ IN ] - NUL terminated column name spec.
- *  to identify a column by name, provide the column name
- *  by itself. if there are multiple types available under
- *  that name, the default type for that column will be
- *  selected. to select a specific type, the name may
- *  be cast to that type using a cast expression, e.g.
- *    "( type ) name"
- *  the special name "*" may be added to a read cursor.
- */
-LIB_EXPORT rc_t CC VCursorAddColumn ( const VCursor *self,
-    uint32_t *idx, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = VCursorVAddColumn ( self, idx, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* GetColspec
- *  a "colspec" is either a simple column name or a typed name expression
- *  uses STable to evaluate colspec and find an SColumn
- */
-static
-rc_t VCursorGetColspec ( const VCursor *self, uint32_t *idx, const char *colspec )
-{
-    rc_t rc;
-
-    /* find an appropriate column in schema */
-    uint32_t type;
-    VTypedecl cast;
-    const SNameOverload *name;
-    const SColumn *scol = STableFind ( self -> tbl -> stbl, self -> schema,
-        & cast, & name, & type, colspec, "VCursorGetColspec", true );
-    if ( scol == NULL || type != eColumn )
-        rc = RC ( rcVDB, rcCursor, rcAccessing, rcColumn, rcNotFound );
-    else
-    {
-        /* if the column-spec gave us the exact column, return it */
-        VColumn *col = VCursorCacheGet ( & self -> col, & scol -> cid );
-        if ( col != NULL )
-        {
-            * idx = col -> ord;
-            return 0;
-        }
-
-        /* prepare for failure */
-        rc = RC ( rcVDB, rcCursor, rcAccessing, rcColumn, rcNotFound );
-
-        /* there should be a name overload object */
-        if ( name != NULL )
-        {
-            uint32_t count, i = VectorStart ( & name -> items );
-            uint32_t end = VectorLength ( & name -> items );
-            for ( end += i, count = 0; i < end; ++ i )
-            {
-                scol = ( const void* ) VectorGet ( & name -> items, i );
-                if ( scol != NULL )
-                {
-                    col = VCursorCacheGet ( & self -> col, & scol -> cid );
-                    if ( col != NULL )
-                    {
-                        * idx = col -> ord;
-                        ++ count;
-                    }
-                }
-            }
-
-            if ( count == 1 )
-                return 0;
-            if ( count != 0 )
-                return RC ( rcVDB, rcCursor, rcAccessing, rcColumn, rcAmbiguous );
-        }
-    }
-
-    return rc;
-}
-
-
-/* GetColumnIdx
- *  retrieve column index by name spec
- *
- *  "idx" [ OUT ] - return parameter for column index
- *
- *  "name" [ IN ] - NUL terminated column name spec.
- */
-LIB_EXPORT rc_t CC VCursorVGetColumnIdx ( const VCursor *self,
-    uint32_t *idx, const char *name, va_list args )
-{
-    rc_t rc;
-
-    if ( idx == NULL )
-        rc = RC ( rcVDB, rcCursor, rcAccessing, rcParam, rcNull );
-    else
-    {
-        * idx = 0;
-
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcCursor, rcAccessing, rcSelf, rcNull );
-        else if ( name == NULL )
-            rc = RC ( rcVDB, rcCursor, rcAccessing, rcName, rcNull );
-        else if ( name [ 0 ] == 0 )
-            rc = RC ( rcVDB, rcCursor, rcAccessing, rcName, rcEmpty );
-        else if ( self -> state == vcFailed )
-            rc = RC ( rcVDB, rcCursor, rcAccessing, rcCursor, rcInvalid );
-        else
-        {
-            char colspec [ 1024 ];
-            int len = vsnprintf ( colspec, sizeof colspec, name, args );
-            if ( len < 0 || len >= sizeof colspec )
-                rc = RC ( rcVDB, rcCursor, rcAccessing, rcName, rcExcessive );
-            else
-            {
-                rc = VCursorGetColspec ( self, idx, colspec );
-            }
-        }
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VCursorGetColumnIdx ( const VCursor *self, uint32_t *idx, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = VCursorVGetColumnIdx ( self, idx, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* Datatype
- *  returns typedecl and/or typedef for column data
- *
- *  "idx" [ IN ] - column index
- *
- *  "type" [ OUT, NULL OKAY ] - returns the column type declaration
- *
- *  "def" [ OUT, NULL OKAY ] - returns the definition of the type
- *  returned in "type_decl"
- *
- * NB - one of "type" and "def" must be non-NULL
- */
-LIB_EXPORT rc_t CC VCursorDatatype ( const VCursor *self, uint32_t idx,
-    struct VTypedecl *type, struct VTypedesc *desc )
-{
-    rc_t rc;
-
-    if ( type == NULL && desc == NULL )
-        rc = RC ( rcVDB, rcCursor, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcCursor, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            const VColumn *vcol = ( const VColumn* ) VectorGet ( & self -> row, idx );
-            if ( vcol == NULL )
-                rc = RC ( rcVDB, rcCursor, rcAccessing, rcColumn, rcNotFound );
-            else
-                return VColumnDatatype ( vcol, type, desc );
-        }
-
-        if ( type != NULL )
-            memset ( type, 0, sizeof * type );
-        if ( desc != NULL )
-            memset ( desc, 0, sizeof * desc );
-    }
-
-    return rc;
-}
-
-
-/* IdRange
- *  returns id range for column
- *
- *  "idx" [ IN ] - column index
- *
- *  "id" [ IN ] - page containing this row id is target
- *
- *  "first" [ OUT, NULL OKAY ] and "last" [ OUT, NULL OKAY ] -
- *  id range is returned in these output parameters, where
- *  at least ONE must be NOT-NULL
- */
-typedef struct VCursorIdRangeData VCursorIdRangeData;
-struct VCursorIdRangeData
-{
-    int64_t first, last;
-    rc_t rc;
-};
-
-static
-bool CC column_id_range ( void *item, void *data )
-{
-    if ( ( size_t ) item > 8 )
-    {
-        int64_t first, last;
-        VCursorIdRangeData *pb = data;
-
-        rc_t rc = VColumnIdRange ( ( const void* ) item, & first, & last );
-
-        if ( GetRCState ( rc ) == rcEmpty )
-            return false;
-
-        if ( ( pb -> rc = rc ) != 0 )
-            return true;
-
-        if ( first < pb -> first )
-            pb -> first = first;
-        if ( last > pb -> last )
-            pb -> last = last;
-    }
-
-    return false;
-}
-
-LIB_EXPORT rc_t CC VCursorIdRange ( const VCursor *self, uint32_t idx,
-    int64_t *first, uint64_t *count )
-{
-    rc_t rc;
-
-    if ( first == NULL && count == NULL )
-        rc = RC ( rcVDB, rcCursor, rcAccessing, rcParam, rcNull );
-    else
-    {
-        int64_t dummy;
-        uint64_t dummy_count;
-
-        if ( first == NULL )
-            first = & dummy;
-        else if ( count == NULL )
-            count = & dummy_count;
-
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcCursor, rcAccessing, rcSelf, rcNull );
-        else if ( self -> state < vcReady )
-        {
-            if ( self -> state == vcFailed )
-                rc = RC ( rcVDB, rcCursor, rcAccessing, rcCursor, rcInvalid );
-            else
-                rc = RC ( rcVDB, rcCursor, rcAccessing, rcCursor, rcNotOpen );
-        }
-        else if ( idx == 0 )
-        {
-            VCursorIdRangeData pb;
-
-            pb . first = INT64_MAX;
-            pb . last = INT64_MIN;
-            pb . rc = RC ( rcVDB, rcCursor, rcAccessing, rcRange, rcEmpty );
-
-            if ( ! VectorDoUntil ( & self -> row, false, column_id_range, & pb ) )
-            {
-                * first = pb . first;
-                * count = pb . last >= pb . first ? pb . last + 1 - pb . first : 0;
-                return pb . rc;
-            }
-
-            rc = pb . rc;
-        }
-        else
-        {
-            const VColumn *vcol = ( const VColumn* ) VectorGet ( & self -> row, idx );
-            if ( vcol == NULL )
-                rc = RC ( rcVDB, rcCursor, rcAccessing, rcColumn, rcNotFound );
-            else {
-                int64_t last;
-
-                rc = VColumnIdRange ( vcol, first, &last );
-                if (rc == 0)
-                    *count = last + 1 - *first;
-                return rc;
-            }
-        }
-
-        * first = * count = 0;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VCursorPageIdRange ( struct VCursor const *self,
-    uint32_t idx, int64_t id, int64_t *first, int64_t *last )
-{
-    rc_t rc;
-
-    if ( first == NULL && last == NULL )
-        rc = RC ( rcVDB, rcCursor, rcAccessing, rcParam, rcNull );
-    else
-    {
-        int64_t dummy;
-        if ( first == NULL )
-            first = & dummy;
-        else if ( last == NULL )
-            last = & dummy;
-
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcCursor, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            const VColumn *vcol = ( const VColumn* ) VectorGet ( & self -> row, idx );
-            if ( vcol == NULL )
-                rc = RC ( rcVDB, rcCursor, rcAccessing, rcColumn, rcNotFound );
-            else
-                return VColumnPageIdRange ( vcol, id, first, last );
-        }
-
-        * first = * last = 0;
-    }
-
-    return rc;
-}
-
-
-/* Open
- *  open cursor, resolving schema
- *  for the set of opened columns
- *
- *  NB - there is no corresponding "Close"
- *  use "Release" instead.
- */
-typedef struct VProdResolveData VProdResolveData;
-struct VProdResolveData
-{
-    VProdResolve pr;
-    rc_t rc;
-};
-
-
-static
-bool CC VCursorResolveColumn ( void *item, void *data )
-{
-    if ( item != NULL )
-    {
-        void *ignore;
-        VCursor *self;
-
-        VColumn *col = item;
-        VProdResolveData *pb = data;
-        SColumn *scol = ( SColumn* ) col -> scol;
-
-        VProduction *src = NULL;
-        pb -> rc = VProdResolveColumnRoot ( & pb -> pr, & src, scol );
-        if ( pb -> rc == 0 )
-        {
-            if ( src > FAILED_PRODUCTION )
-            {
-                /* repair for incomplete implicit column decl */
-                if ( scol -> td . type_id == 0 )
-                    scol -> td = src -> fd . td;
-
-                return false;
-            }
-
-            pb -> rc = RC ( rcVDB, rcCursor, rcOpening, rcColumn, rcUndefined );
-        }
-
-        /* check for tolerance */
-        self = pb -> pr . curs;
-        if ( ! pb -> pr . ignore_column_errors )
-        {
-            if ( ! self -> permit_post_open_add )
-            {
-                PLOGERR ( klogErr, ( klogErr, pb -> rc, "failed to resolve column '$(name)' idx '$(idx)'",
-                                     "name=%.*s,idx=%u"
-                                     , ( int ) scol -> name -> name . size
-                                     , scol -> name -> name . addr
-                                     , col -> ord ));
-            }
-
-            return true;
-        }
-
-        /* remove from row and cache */
-        VectorSwap ( & self -> row, col -> ord, NULL, & ignore );
-        VCursorCacheSwap ( & self -> col, & scol -> cid, NULL, & ignore );
-
-        /* dump the VColumn */
-        VColumnWhack ( col, NULL );
-
-        /* return no-error */
-        pb -> rc = 0;
-    }
-
-    return false;
-}
-
-static
-rc_t VCursorOpenColumn ( const VCursor *cself, VColumn *col )
-{
-    KDlset *libs;
-    VCursor *self = ( VCursor* ) cself;
-
-    Vector cx_bind;
-    VProdResolveData pb;
-    pb . pr . schema = self -> schema;
-    pb . pr . ld = self -> tbl -> linker;
-    pb . pr . stbl = self -> stbl;
-    pb . pr . curs = self;
-    pb . pr . cache = & self -> prod;
-    pb . pr . owned = & self -> owned;
-    pb . pr . cx_bind = & cx_bind;
-    pb . pr . chain = chainDecoding;
-    pb . pr . blobbing = false;
-    pb . pr . ignore_column_errors = false;
-    pb . pr . discover_writable_columns = false;
-
-    VectorInit ( & cx_bind, 1, self -> schema -> num_indirect );
-
-    pb . rc = VLinkerOpen ( pb . pr . ld, & libs );
-    if ( pb . rc == 0 )
-    {
-        pb . pr . libs = libs;
-        VCursorResolveColumn ( col, & pb );
-        KDlsetRelease ( libs );
-    }
-
-    VectorWhack ( & cx_bind, NULL, NULL );
-
-    return pb . rc;
-}
-
-/* PostOpenAdd
- *  handle opening of a column after the cursor is opened
- */
-rc_t VCursorPostOpenAddRead ( VCursor *self, VColumn *col )
-{
-    return VCursorOpenColumn ( self, col );
-}
-
-
-static
-rc_t VCursorResolveColumnProductions ( VCursor *self,
-    const KDlset *libs, bool ignore_failures )
-{
-    Vector cx_bind;
-    VProdResolveData pb;
-    pb . pr . schema = self -> schema;
-    pb . pr . ld = self -> tbl -> linker;
-    pb . pr . libs = libs;
-    pb . pr . stbl = self -> stbl;
-    pb . pr . curs = self;
-    pb . pr . cache = & self -> prod;
-    pb . pr . owned = & self -> owned;
-    pb . pr . cx_bind = & cx_bind;
-    pb . pr . chain = chainDecoding;
-    pb . pr . blobbing = false;
-    pb . pr . ignore_column_errors = ignore_failures;
-    pb . pr . discover_writable_columns = false;
-    pb . rc = 0;
-
-    VectorInit ( & cx_bind, 1, self -> schema -> num_indirect );
-
-    if ( ! VectorDoUntil ( & self -> row, false, VCursorResolveColumn, & pb ) )
-        pb . rc = 0;
-
-    VectorWhack ( & cx_bind, NULL, NULL );
-
-    return pb . rc;
-}
-
-rc_t VCursorOpenRead ( VCursor *self, const KDlset *libs )
-{
-    rc_t rc;
-
-    if ( self -> state >= vcReady )
-        rc = 0;
-    else if ( self -> state == vcFailed )
-        rc = RC ( rcVDB, rcCursor, rcOpening, rcCursor, rcInvalid );
-    else
-    {
-        rc = VCursorResolveColumnProductions ( self, libs, false );
-        if ( rc == 0 )
-        {
-            self -> row_id = self -> start_id = self -> end_id = 1;
-            self -> state = vcReady;
-            return 0;
-        }
-
-        self -> state = vcFailed;
-    }
-
-    return rc;
-}
-
-static
-rc_t VCursorOpenForListing ( const VCursor *cself )
-{
-    rc_t rc;
-    VCursor *self = ( VCursor* ) cself;
-
-    VLinker *ld = self -> tbl -> linker;
-
-    KDlset *libs;
-    rc = VLinkerOpen ( ld, & libs );
-    if ( rc == 0 )
-    {
-        rc = VCursorResolveColumnProductions ( self, libs, true );
-        KDlsetRelease ( libs );
-    }
-    return rc;
-}
-
-
-
-/* RowId
- *  return id from row cursor within open blob
- *
- *  "id" [ OUT ] - current row id
- */
-LIB_EXPORT rc_t CC VCursorRowId ( const VCursor *self, int64_t *id )
-{
-    rc_t rc;
-    if ( id == NULL )
-        rc = RC ( rcVDB, rcCursor, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcCursor, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            * id = self -> row_id;
-            return 0;
-        }
-
-        * id = 0;
-    }
-
-    return rc;
-}
-
-
-/* SetRowIdRead - PRIVATE
- *  seek to given row id
- *
- *  "row_id" [ IN ] - row id to select
- */
-rc_t VCursorSetRowIdRead ( VCursor *self, int64_t row_id )
-{
-    assert ( self != NULL );
-
-    self -> row_id = row_id;
-    return 0;
-}
-
-
-/* OpenRowRead
- * CloseRowRead
- */
-rc_t VCursorOpenRowRead ( VCursor *self )
-{
-    assert ( self != NULL );
-
-    self -> state = vcRowOpen;
-    return 0;
-}
-
-rc_t VCursorCloseRowRead ( VCursor *self )
-{
-    assert ( self != NULL );
-
-    ++ self -> row_id;
-    self -> state = vcReady;
-    return 0;
-}
-
-
-/* Read
- *  read entire single row of byte-aligned data into a buffer
- *
- *  "col_idx" [ IN ] - index of column to be read, returned by "AddColumn"
- *
- *  "elem_bits" [ IN ] - expected element size in bits, required
- *  to be compatible with the actual element size, and be a multiple
- *  of 8 ( byte-aligned ). for non-byte-aligned data, see ReadBits
- *
- *  "buffer" [ OUT ] and "blen" [ IN ] - return buffer for row data
- *  where "blen" gives buffer capacity in elements. the total buffer
- *  size in bytes == ( "elem_bits" * "blen" + 7 ) / 8.
- *
- *  "row_len" [ OUT ] - return parameter for the number of elements
- *  in the requested row.
- *
- *  when the return code is 0, "row_len" will contain the number of
- *  elements read into buffer. if the return code indicates that the
- *  buffer is too small, "row_len" will give the required buffer length.
- */
-static
-rc_t VCursorReadColumnDirectInt ( const VCursor *cself, int64_t row_id, uint32_t col_idx,
-    uint32_t *elem_bits, const void **base, uint32_t *boff, uint32_t *row_len,
-    const VBlob **rslt )
-{
-    rc_t rc,rc_cache=0;
-    const VColumn *col;
-    const VBlob *blob;
-
-    col = ( const void* ) VectorGet ( & cself -> row, col_idx );
-    if ( col == NULL )
-        return RC ( rcVDB, rcCursor, rcReading, rcColumn, rcInvalid );
-
-    /* 2.0 behavior if not caching */
-    if ( cself -> blob_mru_cache == NULL )
-        return VColumnRead ( col, row_id, elem_bits, base, boff, row_len, (VBlob**) rslt );
-
-    /* check MRU blob */
-    blob = VBlobMRUCacheFind(cself->blob_mru_cache,col_idx,row_id);
-    if(blob){
-        /* ask column to read from blob */
-	assert(row_id >= blob->start_id && row_id <= blob->stop_id);
-        return VColumnReadCachedBlob ( col, blob, row_id, elem_bits, base, boff, row_len);
-    }
-    { /* ask column to produce a blob to be cached */
-	VBlobMRUCacheCursorContext cctx;
-	cctx.cache=cself -> blob_mru_cache;
-	cctx.col_idx = col_idx;
-	rc = VColumnReadBlob(col,&blob,row_id,elem_bits,base,boff,row_len,&cctx);
-    }
-    if ( rc != 0 || blob == NULL ){
-	if(rslt) *rslt = NULL;
-        return rc;
-    }
-    if(blob->stop_id > blob->start_id + 4)
-	    rc_cache=VBlobMRUCacheSave(cself->blob_mru_cache, col_idx, blob);
-    if(rslt==NULL){ /** user does not care about the blob ***/
-	if( rc_cache == 0){
-		VBlobRelease((VBlob*)blob);
-	} /** else the memory will leak **/
-    } else {
-	*rslt=blob;
-    }
-    return 0;
-}
-
-/* GetBlob
- *  retrieve a blob of data containing the current row id
- * GetBlobDirect
- *  retrieve a blob of data containing the requested row id
- *
- *  "blob" [ OUT ] - return parameter for a new reference
- *  to VBlob containing requested cell. NB - must be released
- *  via VBlobRelease when no longer needed.
- *
- *  "row_id" [ IN ] - allows ReadDirect random access to any cell
- *  in column
- *
- *  "col_idx" [ IN ] - index of column to be read, returned by "AddColumn"
- */
-LIB_EXPORT rc_t CC VCursorGetBlob ( const VCursor *self,
-    const VBlob **blob, uint32_t col_idx )
-{
-    rc_t rc;
-
-    if ( blob == NULL )
-        rc = RC ( rcVDB, rcCursor, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcCursor, rcAccessing, rcSelf, rcNull );
-        else if ( ! self -> read_only )
-            rc = RC ( rcVDB, rcCursor, rcReading, rcCursor, rcWriteonly );
-        else
-        {
-            const void *base;
-            uint32_t elem_bits, boff, row_len;
-
-            switch ( self -> state )
-            {
-            case vcConstruct:
-                rc = RC ( rcVDB, rcCursor, rcReading, rcCursor, rcNotOpen );
-                break;
-            case vcReady:
-                rc = RC ( rcVDB, rcCursor, rcReading, rcRow, rcNotOpen );
-                break;
-            case vcRowOpen:
-                rc = VCursorReadColumnDirectInt
-                    ( self, self -> row_id, col_idx, &elem_bits, &base, &boff, &row_len, blob );
-                if ( rc == 0 )
-                {
-                    rc = VBlobAddRef ( ( VBlob* ) *blob );
-                    if ( rc == 0 )
-                        return 0;
-                }
-                break;
-            default:
-                rc = RC ( rcVDB, rcCursor, rcReading, rcCursor, rcInvalid );
-            }
-        }
-
-        * blob = NULL;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VCursorGetBlobDirect ( const VCursor *self,
-    const VBlob **blob, int64_t row_id, uint32_t col_idx )
-{
-    rc_t rc;
-
-    if ( blob == NULL )
-        rc = RC ( rcVDB, rcCursor, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcCursor, rcAccessing, rcSelf, rcNull );
-        else if ( ! self -> read_only )
-            rc = RC ( rcVDB, rcCursor, rcReading, rcCursor, rcWriteonly );
-        else
-        {
-            const void *base;
-            uint32_t elem_bits, boff, row_len;
-
-            switch ( self -> state )
-            {
-            case vcConstruct:
-                rc = RC ( rcVDB, rcCursor, rcReading, rcCursor, rcNotOpen );
-                break;
-            case vcReady:
-            case vcRowOpen:
-                rc = VCursorReadColumnDirectInt
-                    ( self, row_id, col_idx, &elem_bits, &base, &boff, &row_len, blob );
-                if ( rc == 0 )
-                {
-                    rc = VBlobAddRef ( ( VBlob* ) *blob );
-                    if ( rc == 0 )
-                        return 0;
-                }
-                break;
-            default:
-                rc = RC ( rcVDB, rcCursor, rcReading, rcCursor, rcInvalid );
-            }
-        }
-
-        * blob = NULL;
-    }
-    return rc;
-}
-
-static
-rc_t VCursorReadColumnDirect ( const VCursor *self, int64_t row_id, uint32_t col_idx,
-    uint32_t *elem_bits, const void **base, uint32_t *boff, uint32_t *row_len )
-{
-    if ( ! self -> read_only )
-        return RC ( rcVDB, rcCursor, rcReading, rcCursor, rcWriteonly );
-
-    switch ( self -> state )
-    {
-    case vcConstruct:
-        return RC ( rcVDB, rcCursor, rcReading, rcCursor, rcNotOpen );
-    case vcReady:
-    case vcRowOpen:
-        break;
-    default:
-        return RC ( rcVDB, rcCursor, rcReading, rcCursor, rcInvalid );
-    }
-
-    return VCursorReadColumnDirectInt
-        ( self, row_id, col_idx, elem_bits, base, boff, row_len, NULL );
-}
-
-
-static
-rc_t VCursorReadColumn ( const VCursor *self, uint32_t col_idx,
-    uint32_t *elem_bits, const void **base, uint32_t *boff, uint32_t *row_len )
-{
-    if ( ! self -> read_only )
-        return RC ( rcVDB, rcCursor, rcReading, rcCursor, rcWriteonly );
-
-    switch ( self -> state )
-    {
-    case vcConstruct:
-        return RC ( rcVDB, rcCursor, rcReading, rcCursor, rcNotOpen );
-    case vcReady:
-        return RC ( rcVDB, rcCursor, rcReading, rcRow, rcNotOpen );
-    case vcRowOpen:
-        break;
-    default:
-        return RC ( rcVDB, rcCursor, rcReading, rcCursor, rcInvalid );
-    }
-
-    return VCursorReadColumnDirectInt
-        ( self, self -> row_id, col_idx, elem_bits, base, boff, row_len, NULL );
-}
-
-static __inline__
-bool bad_elem_bits ( uint32_t elem_size, uint32_t elem_bits )
-{
-    if ( elem_size != elem_bits )
-    {
-        if ( elem_size < elem_bits && elem_bits % elem_size != 0 )
-            return true;
-        return ( elem_size % elem_bits != 0 );
-    }
-    return false;
-}
-
-LIB_EXPORT rc_t CC VCursorRead ( const VCursor *self, uint32_t col_idx,
-    uint32_t elem_bits, void *buffer, uint32_t blen, uint32_t *row_len )
-{
-    rc_t rc;
-
-    if ( row_len == NULL )
-        rc = RC ( rcVDB, rcCursor, rcReading, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcCursor, rcReading, rcSelf, rcNull );
-        else if ( elem_bits == 0 || ( elem_bits & 7 ) != 0 )
-            rc = RC ( rcVDB, rcCursor, rcReading, rcParam, rcInvalid );
-        else
-        {
-            uint32_t elem_size; const void *base; uint32_t boff;
-            rc = VCursorReadColumn ( self, col_idx, & elem_size,
-                & base, & boff, row_len );
-            if ( rc == 0 )
-            {
-                if ( bad_elem_bits ( elem_size, elem_bits ) )
-                    rc = RC ( rcVDB, rcCursor, rcReading, rcType, rcInconsistent );
-                else if ( * row_len != 0 )
-                {
-                    if ( blen == 0 )
-                        return RC ( rcVDB, rcCursor, rcReading, rcBuffer, rcInsufficient );
-                    if ( buffer == NULL )
-                        rc = RC ( rcVDB, rcCursor, rcReading, rcParam, rcNull );
-                    else
-                    {
-                        uint64_t to_read = * row_len * elem_size;
-                        uint64_t bsize = blen * elem_bits;
-
-                        /* always return the required buffer size */
-                        * row_len = ( uint32_t ) ( to_read / elem_bits );
-
-                        /* detect buffer too small */
-                        if ( to_read > bsize )
-                        {
-                            rc = RC ( rcVDB, rcCursor, rcReading, rcBuffer, rcInsufficient );
-                            to_read = bsize;
-                        }
-
-                        /* copy out data up to limit */
-                        assert ( boff == 0 );
-                        memcpy ( buffer, base, ( size_t ) ( to_read >> 3 ) );
-
-                        return rc;
-                    }
-                }
-            }
-        }
-
-        * row_len = 0;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VCursorReadDirect ( const VCursor *self, int64_t row_id, uint32_t col_idx,
-    uint32_t elem_bits, void *buffer, uint32_t blen, uint32_t *row_len )
-{
-    rc_t rc;
-
-    if ( row_len == NULL )
-        rc = RC ( rcVDB, rcCursor, rcReading, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcCursor, rcReading, rcSelf, rcNull );
-        else if ( elem_bits == 0 || ( elem_bits & 7 ) != 0 )
-            rc = RC ( rcVDB, rcCursor, rcReading, rcParam, rcInvalid );
-        else
-        {
-            uint32_t elem_size; const void *base; uint32_t boff;
-            rc = VCursorReadColumnDirect ( self, row_id, col_idx,
-                & elem_size, & base, & boff, row_len );
-            if ( rc == 0 )
-            {
-                if ( bad_elem_bits ( elem_size, elem_bits ) )
-                    rc = RC ( rcVDB, rcCursor, rcReading, rcType, rcInconsistent );
-                else if ( * row_len != 0 )
-                {
-                    if ( blen == 0 )
-                        return RC ( rcVDB, rcCursor, rcReading, rcBuffer, rcInsufficient );
-                    if ( buffer == NULL )
-                        rc = RC ( rcVDB, rcCursor, rcReading, rcParam, rcNull );
-                    else
-                    {
-                        uint64_t to_read = * row_len * elem_size;
-                        uint64_t bsize = blen * elem_bits;
-
-                        /* always return the required buffer size */
-                        * row_len = ( uint32_t ) ( to_read / elem_bits );
-
-                        /* detect buffer too small */
-                        if ( to_read > bsize )
-                        {
-                            rc = RC ( rcVDB, rcCursor, rcReading, rcBuffer, rcInsufficient );
-                            to_read = bsize;
-                        }
-
-                        /* copy out data up to limit */
-                        assert ( boff == 0 );
-                        memcpy ( buffer, base, ( size_t ) ( to_read >> 3 ) );
-
-                        return rc;
-                    }
-                }
-            }
-        }
-
-        * row_len = 0;
-    }
-
-    return rc;
-}
-
-
-/* ReadBits
- *  read single row of potentially bit-aligned column data into a buffer
- *
- *  "col_idx" [ IN ] - index of column to be read, returned by "AddColumn"
- *
- *  "elem_bits" [ IN ] - expected element size in bits, required to be
- *  compatible with the actual element size, and may ( or may not ) be
- *  a multiple of 8 ( byte aligned ).
- *
- *  "start" [ IN ] - zero-based starting index to first element,
- *  valid from 0 .. row_len - 1
- *
- *  "buffer" [ IN ], "boff" [ IN ] and "blen" [ IN ] -
- *  return buffer for row data, where "boff" is in BITS
- *  and "blen" is in ELEMENTS.
- *
- *  "num_read" [ OUT ] - return parameter for the number of elements
- *  read, which is <= "blen"
- *
- *  "remaining" [ OUT, NULL OKAY ] - optional return parameter for
- *  the number of elements remaining to be read. specifically,
- *  "start" + "num_read" + "remaining" == row length, assuming that
- *  "start" <= row length.
- */
-LIB_EXPORT rc_t CC VCursorReadBits ( const VCursor *self, uint32_t col_idx,
-    uint32_t elem_bits, uint32_t start, void *buffer, uint32_t off,
-    uint32_t blen, uint32_t *num_read, uint32_t *remaining )
-{
-    rc_t rc;
-
-    uint32_t dummy;
-    if ( remaining == NULL )
-        remaining = & dummy;
-
-    if ( num_read == NULL )
-        rc = RC ( rcVDB, rcCursor, rcReading, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcCursor, rcReading, rcSelf, rcNull );
-        else if ( elem_bits == 0 )
-            rc = RC ( rcVDB, rcCursor, rcReading, rcParam, rcInvalid );
-        else
-        {
-            uint32_t elem_size; const void *base; uint32_t boff;
-            rc = VCursorReadColumn ( self, col_idx, & elem_size,
-                & base, & boff, num_read );
-            if ( rc == 0 )
-            {
-                if ( bad_elem_bits ( elem_size, elem_bits ) )
-                    rc = RC ( rcVDB, rcCursor, rcReading, rcType, rcInconsistent );
-                else if ( * num_read != 0 )
-                {
-                    uint64_t to_read = * num_read * elem_size;
-                    uint64_t doff = start * elem_bits;
-                    to_read = to_read > doff ? to_read - doff : 0;
-                    if ( blen == 0 )
-                    {
-                        * num_read = 0;
-                        * remaining = ( uint32_t ) ( to_read / elem_bits );
-                        return 0;
-                    }
-
-                    if ( buffer == NULL )
-                        rc = RC ( rcVDB, rcCursor, rcReading, rcParam, rcNull );
-                    else
-                    {
-                        uint64_t bsize = blen * elem_size;
-                        if ( to_read <= bsize )
-                            * remaining = 0;
-                        else
-                        {
-                            * remaining = (uint32_t)( ( to_read - bsize ) / elem_bits );
-                            to_read = bsize;
-                        }
-                        bitcpy ( buffer, off, base, boff + doff, ( bitsz_t ) to_read );
-                        * num_read = ( uint32_t ) ( to_read / elem_bits );
-                        return 0;
-                    }
-                }
-            }
-        }
-
-        * num_read = 0;
-    }
-
-    * remaining = 0;
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VCursorReadBitsDirect ( const VCursor *self, int64_t row_id, uint32_t col_idx,
-    uint32_t elem_bits, uint32_t start, void *buffer, uint32_t off,
-    uint32_t blen, uint32_t *num_read, uint32_t *remaining )
-{
-    rc_t rc;
-
-    uint32_t dummy;
-    if ( remaining == NULL )
-        remaining = & dummy;
-
-    if ( num_read == NULL )
-        rc = RC ( rcVDB, rcCursor, rcReading, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcCursor, rcReading, rcSelf, rcNull );
-        else if ( elem_bits == 0 )
-            rc = RC ( rcVDB, rcCursor, rcReading, rcParam, rcInvalid );
-        else
-        {
-            uint32_t elem_size; const void *base; uint32_t boff;
-            rc = VCursorReadColumnDirect ( self, row_id, col_idx,
-                & elem_size, & base, & boff, num_read );
-            if ( rc == 0 )
-            {
-                if ( bad_elem_bits ( elem_size, elem_bits ) )
-                    rc = RC ( rcVDB, rcCursor, rcReading, rcType, rcInconsistent );
-                else if ( * num_read != 0 )
-                {
-                    uint64_t to_read = * num_read * elem_size;
-                    uint64_t doff = start * elem_bits;
-                    to_read = to_read > doff ? to_read - doff : 0;
-                    if ( blen == 0 )
-                    {
-                        * num_read = 0;
-                        * remaining = ( uint32_t ) ( to_read / elem_bits );
-                        return 0;
-                    }
-
-                    if ( buffer == NULL )
-                        rc = RC ( rcVDB, rcCursor, rcReading, rcParam, rcNull );
-                    else
-                    {
-                        uint64_t bsize = blen * elem_size;
-                        if ( to_read <= bsize )
-                            * remaining = 0;
-                        else
-                        {
-                            * remaining = (uint32_t)( ( to_read - bsize ) / elem_bits );
-                            to_read = bsize;
-                        }
-                        bitcpy ( buffer, off, base, boff + doff, ( bitsz_t ) to_read );
-                        * num_read = ( uint32_t ) ( to_read / elem_bits );
-                        return 0;
-                    }
-                }
-            }
-        }
-
-        * num_read = 0;
-    }
-
-    * remaining = 0;
-
-    return rc;
-}
-
-
-/* CellData
- *  access pointer to single cell of potentially bit-aligned column data
- *
- *  "col_idx" [ IN ] - index of column to be read, returned by "AddColumn"
- *
- *  "elem_bits" [ OUT, NULL OKAY ] - optional return parameter for
- *  element size in bits
- *
- *  "base" [ OUT ] and "boff" [ OUT, NULL OKAY ] -
- *  compound return parameter for pointer to row starting bit
- *  where "boff" is in BITS
- *
- *  "row_len" [ OUT, NULL OKAY ] - the number of elements in row
- */
-LIB_EXPORT rc_t CC VCursorCellData ( const VCursor *self, uint32_t col_idx,
-    uint32_t *elem_bits, const void **base, uint32_t *boff, uint32_t *row_len )
-{
-    rc_t rc;
-
-    uint32_t dummy1, dummy2, dummy3;
-    if ( row_len == NULL )
-        row_len = & dummy1;
-    if ( boff == NULL )
-        boff = & dummy2;
-    if ( elem_bits == NULL )
-        elem_bits = & dummy3;
-
-    if ( base == NULL )
-        rc = RC ( rcVDB, rcCursor, rcReading, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcCursor, rcReading, rcSelf, rcNull );
-        else
-        {
-            rc = VCursorReadColumn ( self, col_idx,
-                elem_bits, base, boff, row_len );
-            if ( rc == 0 )
-                return 0;
-        }
-
-        * base = NULL;
-    }
-
-    * elem_bits = 0;
-    * boff = 0;
-    * row_len = 0;
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VCursorCellDataDirect ( const VCursor *self, int64_t row_id, uint32_t col_idx,
-    uint32_t *elem_bits, const void **base, uint32_t *boff, uint32_t *row_len )
-{
-    rc_t rc;
-
-    uint32_t dummy1, dummy2, dummy3;
-    if ( row_len == NULL )
-        row_len = & dummy1;
-    if ( boff == NULL )
-        boff = & dummy2;
-    if ( elem_bits == NULL )
-        elem_bits = & dummy3;
-
-    if ( base == NULL )
-        rc = RC ( rcVDB, rcCursor, rcReading, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcCursor, rcReading, rcSelf, rcNull );
-        else
-        {
-            rc = VCursorReadColumnDirect ( self, row_id, col_idx,
-                elem_bits, base, boff, row_len );
-            if ( rc == 0 )
-                return 0;
-        }
-
-        * base = NULL;
-    }
-
-    * elem_bits = 0;
-    * boff = 0;
-    * row_len = 0;
-
-    return rc;
-}
-
-
-/* OpenParent
- *  duplicate reference to parent table
- *  NB - returned reference must be released
- */
-LIB_EXPORT rc_t CC VCursorOpenParentRead ( const VCursor *self, const VTable **tbl )
-{
-    rc_t rc;
-
-    if ( tbl == NULL )
-        rc = RC ( rcVDB, rcCursor, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcCursor, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = VTableAddRef ( self -> tbl );
-            if ( rc == 0 )
-            {
-                * tbl = self -> tbl;
-                return 0;
-            }
-        }
-
-        * tbl = NULL;
-    }
-
-    return rc;
-}
-
-struct insert_overloaded_pb
-{
-    VCursor *curs;
-    Vector *cx_bind;
-};
-
-static
-void CC insert_overloaded_scolumns ( void *item, void *data )
-{
-    struct insert_overloaded_pb *pb = data;
-    const SColumn *scol = ( const void* ) item;
-
-    uint32_t ignore;
-    VCursorAddSColumn ( pb -> curs, & ignore, scol, NULL, pb -> cx_bind );
-}
-
-static
-void VCursorListCol_walk_through_columns_and_add_to_cursor ( VCursor *self )
-{
-    uint32_t idx = VectorStart ( & self -> stbl -> cname );
-    uint32_t end = VectorLength ( & self -> stbl -> cname );
-
-    Vector cx_bind;
-    struct insert_overloaded_pb pb;
-    pb . curs = self;
-    pb . cx_bind = & cx_bind;
-    VectorInit ( & cx_bind, 1, self -> schema -> num_indirect );
-
-    for ( end += idx; idx < end; ++idx )
-    {
-        /* look at the table column name guy */
-        const SNameOverload* ol_entry = ( const SNameOverload* ) VectorGet ( & self -> stbl -> cname, idx );
-        if ( ol_entry != NULL )
-            VectorForEach ( & ol_entry -> items, false, insert_overloaded_scolumns, & pb );
-    }
-
-    VectorWhack ( & cx_bind, NULL, NULL );
-}
-
-static
-rc_t VCursorListCol_consolidate_and_insert( const VCursor *self, BSTree *columns )
-{
-    rc_t rc = VCursorOpenForListing ( self );
-    if ( rc == 0 )
-    {
-        uint32_t idx = VectorStart ( & self -> row );
-        uint32_t end = VectorLength ( & self -> row );
-
-        for ( end += idx; idx < end; ++idx )
-        {
-            const VColumn* vcol = ( const VColumn* ) VectorGet ( & self -> row, idx );
-            if ( vcol != NULL )
-            {
-                VColumnRef *cref;
-                rc = VColumnRefMake ( & cref, self -> schema, vcol -> scol );
-                if ( rc != 0 )
-                    break;
-
-                rc = BSTreeInsert ( columns, & cref -> n, VColumnRefSort );
-                assert ( rc == 0 );
-            }
-        }
-    }
-
-    return rc;
-}
-
-
-/* ListReadableColumns
- *  performs an insert of '*' to cursor
- *  attempts to resolve all read rules
- *  records all SColumns that successfully resolved
- *  populates BTree with VColumnRef objects
- */
-rc_t VCursorListReadableColumns ( VCursor *self, BSTree *columns )
-{
-    /* add '*' to cursor */
-    VCursorListCol_walk_through_columns_and_add_to_cursor ( self );
-
-    /* insert all columns into tree */
-    return VCursorListCol_consolidate_and_insert ( self, columns );
-}
-
-
-/* GetUserData
- *  store/retrieve an opaque pointer to user data
- *
- *  "data" [ OUT ] - return parameter for getting data
- */
-LIB_EXPORT rc_t CC VCursorGetUserData ( const VCursor *self, void **data )
-{
-    rc_t rc;
-
-    if ( data == NULL )
-        rc = RC ( rcVDB, rcCursor, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcCursor, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            * data = self -> user;
-            return 0;
-        }
-
-        * data = NULL;
-    }
-
-    return rc;
-}
-
-/* SetUserData
- *  store/retrieve an opaque pointer to user data
- *
- *  "data" [ IN ] - parameter for setting data
- *
- *  "destroy" [ IN, NULL OKAY ] - optional destructor param
- *  invoked from destructor of "self"
- */
-LIB_EXPORT rc_t CC VCursorSetUserData ( const VCursor *cself,
-    void *data, void ( CC * destroy ) ( void *data ) )
-{
-    VCursor *self = ( VCursor* ) cself;
-
-    if ( self == NULL )
-        return RC ( rcVDB, rcCursor, rcUpdating, rcSelf, rcNull );
-
-    self -> user = data;
-    self -> user_whack = destroy;
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC VCursorLinkedCursorGet(const VCursor *cself,const char *tbl,VCursor const **curs)
-{
-    LinkedCursorNode *node;
-    VCursor *self = (VCursor *)cself;
-
-    if(cself == NULL)
-        return RC(rcVDB, rcCursor, rcAccessing, rcSelf, rcNull);
-    if(tbl == NULL)
-        return RC(rcVDB, rcCursor, rcAccessing, rcName, rcNull);
-    if(tbl[0] == '\0')
-        return RC(rcVDB, rcCursor, rcAccessing, rcName, rcEmpty);
-    node = (LinkedCursorNode *)BSTreeFind(&self->linked_cursors, tbl, LinkedCursorComp);
-    if (node == NULL)
-        return RC(rcVDB, rcCursor, rcAccessing, rcName, rcNotFound);
-
-    *curs = node->curs;
-    return 0;
-}
-LIB_EXPORT rc_t CC VCursorLinkedCursorSet(const VCursor *cself,const char *tbl,VCursor const *curs)
-{
-    LinkedCursorNode *node;
-    VCursor *self = (VCursor *)cself;
-    rc_t rc;
-
-    if(cself == NULL)
-        return RC(rcVDB, rcCursor, rcAccessing, rcSelf, rcNull);
-    if(tbl == NULL)
-        return RC(rcVDB, rcCursor, rcAccessing, rcName, rcNull);
-    if(tbl[0] == '\0')
-        return RC(rcVDB, rcCursor, rcAccessing, rcName, rcEmpty);
-
-    node = malloc(sizeof(*node));
-    if (node == NULL)
-            return RC(rcVDB, rcCursor, rcAccessing, rcMemory, rcExhausted);
-    strncpy(node->tbl,tbl,sizeof(node->tbl));
-    node->curs=(VCursor*)curs;
-    rc = BSTreeInsertUnique(&self->linked_cursors, (BSTNode *)node, NULL, LinkedCursorNodeComp);
-    if (rc)
-       free(node); 
-    else 
-	VCursorAddRef(curs);
-    return rc;
-}
-
-
-/* private */
-LIB_EXPORT rc_t CC VCursorParamsGet( struct VCursorParams const *cself,
-    const char *Name, KDataBuffer **value )
-{
-    NamedParamNode *node;
-    String name;
-    VCursor *self = (VCursor *)cself;
-    
-    if (cself == NULL)
-        return RC(rcVDB, rcCursor, rcAccessing, rcSelf, rcNull);
-    
-    if (Name == NULL)
-        return RC(rcVDB, rcCursor, rcAccessing, rcName, rcNull);
-    
-    if (Name[0] == '\0')
-        return RC(rcVDB, rcCursor, rcAccessing, rcName, rcEmpty);
-    
-    StringInitCString(&name, Name);
-    node = (NamedParamNode *)BSTreeFind(&self->named_params, &name, NamedParamComp);
-    if (node == NULL)
-        return RC(rcVDB, rcCursor, rcAccessing, rcName, rcNotFound);
-        
-    *value = &node->value;
-    return 0;
-}
-
-/* private */
-static rc_t VCursorParamsLookupOrCreate(struct VCursorParams const *cself,
-                         const char *Name, KDataBuffer **value)
-{
-    NamedParamNode *node;
-    String name;
-    VCursor *self = (VCursor *)cself;
-    rc_t rc;
-    
-    StringInitCString(&name, Name);
-    node = (NamedParamNode *)BSTreeFind(&self->named_params, &name, NamedParamComp);
-    if (node == NULL) {
-        node = malloc(sizeof(*node) + StringSize(&name) + 1);
-        if (node == NULL)
-            return RC(rcVDB, rcCursor, rcAccessing, rcMemory, rcExhausted);
-        
-        strcpy((char *)(&node[1]), Name);
-        StringInit ( & node -> name, (const char *)(&node[1]), name . size, name . len );
-        
-        memset ( & node -> value, 0, sizeof node -> value );
-        node -> value . elem_bits = 8;
-        
-        rc = BSTreeInsertUnique(&self->named_params, (BSTNode *)node, NULL, NamedParamNodeComp);
-        assert(rc == 0);
-    }
-    *value = &node->value;
-    return 0;
-}
-
-LIB_EXPORT rc_t CC VCursorParamsVSet(struct VCursorParams const *cself, 
-    const char *Name, const char *fmt, va_list args )
-{
-    KDataBuffer *value;
-    rc_t rc;
-
-    if (cself == NULL)
-        return RC(rcVDB, rcCursor, rcAccessing, rcSelf, rcNull);
-
-    if (Name == NULL)
-        return RC(rcVDB, rcCursor, rcAccessing, rcName, rcNull);
-
-    if (Name[0] == '\0')
-        return RC(rcVDB, rcCursor, rcAccessing, rcName, rcEmpty);
-
-    rc = VCursorParamsLookupOrCreate(cself, Name, &value);
-    if (rc == 0) {
-        int n;
-        char dummy[1];
-
-        va_list copy;
-        va_copy(copy, args);
-
-        /* optimistic printf */
-        n = vsnprintf ( ( value -> base == NULL ) ?
-            dummy : value -> base, value -> elem_count, fmt, copy );
-        va_end(copy);
-
-        if ( n < 0 || n >= (int)value -> elem_count )
-        {
-            rc = KDataBufferResize ( value, ( n < 0 ) ? 4000 : n + 1 );
-            if (rc == 0)
-            {
-                n = vsnprintf(value->base, value->elem_count, fmt, args);
-                if ( n < 0 || n >= (int)value->elem_count )
-                {
-                    rc = RC ( rcVDB, rcCursor, rcUpdating, rcParam, rcInvalid );
-                    KDataBufferWhack ( value );
-                }
-            }
-        }
-
-        if ( rc == 0 )
-            value -> elem_count = n;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VCursorParamsSet( struct VCursorParams const *cself, 
-    const char *name, const char *fmt, ... )
-{
-    va_list va;
-    rc_t rc;
-
-    va_start(va, fmt);
-    rc = VCursorParamsVSet(cself, name, fmt, va);
-    va_end(va);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VCursorParamsUnset( struct VCursorParams const *cself, const char *Name ) {
-    KDataBuffer *value;
-    rc_t rc;
-
-    if (cself == NULL)
-        return RC(rcVDB, rcCursor, rcAccessing, rcSelf, rcNull);
-
-    if (Name == NULL)
-        return RC(rcVDB, rcCursor, rcAccessing, rcParam, rcNull);
-
-    if (Name[0] == '\0')
-        return RC(rcVDB, rcCursor, rcAccessing, rcParam, rcInvalid);
-
-    rc = VCursorParamsGet(cself, Name, &value);
-    if (rc == 0)
-        KDataBufferWhack(value);
-
-    return rc;
-}
-
-/*  VCursorGetSchema
- *  returns current schema of the open cursor
- */
-LIB_EXPORT struct VSchema const * CC VCursorGetSchema ( struct VCursor const *self )
-{
-    return self ? self->schema : NULL;
-}
-
-
-static rc_t run_pagemap_thread ( const KThread *t, void *data )
-{
-    rc_t rc;
-    VCursor *self = data;
-    /* acquire lock */
-    MTCURSOR_DBG (( "run_pagemap_thread: acquiring lock\n" ));
-    while((rc = KLockAcquire ( self -> pmpr.lock ))==0){
-CHECK_AGAIN:
-	switch(self->pmpr.state){
-	 case ePMPR_STATE_NONE: 		/* wait for new request */
-	 case ePMPR_STATE_SERIALIZE_DONE: 	/* wait for result pickup **/
-	 case ePMPR_STATE_DESERIALIZE_DONE:	/* wait for result pickup **/
-		MTCURSOR_DBG (( "run_pagemap_thread: waiting for new request\n" ));
-		rc = KConditionWait ( self -> pmpr.cond, self -> pmpr.lock );
-		goto CHECK_AGAIN;
-	 case ePMPR_STATE_EXIT: /** exit requested ***/
-		MTCURSOR_DBG (( "run_pagemap_thread: exit by request\n" ));
-		KLockUnlock(self -> pmpr.lock);
-		return 0;
-	 case ePMPR_STATE_DESERIALIZE_REQUESTED:
-		MTCURSOR_DBG (( "run_pagemap_thread: request to deserialize\n" ));
-		self->pmpr.rc = PageMapDeserialize(&self->pmpr.pm,self->pmpr.data.base,self->pmpr.data.elem_count,self->pmpr.row_count);
-		if(self->pmpr.rc == 0){
-			self->pmpr.rc=PageMapExpandFull(self->pmpr.pm);
-			/*self->pmpr.rc=PageMapExpand(self->pmpr.pm,self->pmpr.row_count<2048?self->pmpr.row_count-1:2048);*/
-			assert(self->pmpr.rc == 0);
-		}
-		self->pmpr.state = ePMPR_STATE_DESERIALIZE_DONE;
-		/*fprintf(stderr,"Pagemap %p Done R:%6d|DR:%d|LR:%d\n",self->pmpr.lock, self->pmpr.pm->row_count,self->pmpr.pm->data_recs,self->pmpr.pm->leng_recs);*/
-		KConditionSignal ( self -> pmpr.cond );
-		KLockUnlock(self -> pmpr.lock);
-		break;
-	 case ePMPR_STATE_SERIALIZE_REQUESTED:
-		MTCURSOR_DBG (( "run_pagemap_thread: request to serialize\n" ));
-		self->pmpr.rc = PageMapSerialize(self->pmpr.pm,&self->pmpr.data,0,&self->pmpr.elem_count);
-		self->pmpr.state = ePMPR_STATE_SERIALIZE_DONE;
-		KConditionSignal ( self -> pmpr.cond );
-		KLockUnlock(self -> pmpr.lock);
-		break;
-	 default:
-		assert(0);
-		KLockUnlock(self -> pmpr.lock);
-		return RC(rcVDB, rcPagemap, rcConverting, rcParam, rcInvalid );
-	 
-	}
-    }
-    MTCURSOR_DBG (( "run_pagemap_thread: exit\n" ));
-    return rc;
-}
-
-rc_t VCursorLaunchPagemapThread(VCursor *curs)
-{
-	rc_t rc;
-
-    assert ( curs != NULL );
-	curs -> pagemap_thread = NULL; /** if fails - will not use **/
-
-    if ( s_disable_pagemap_thread )
-        return RC ( rcVDB, rcCursor, rcExecuting, rcThread, rcNotAvailable );
-
-	rc = KLockMake ( & curs -> pmpr.lock );
-	if(rc == 0)
-    {
-		rc = KConditionMake ( & curs -> pmpr.cond );
-        if(rc == 0)
-        {
-            rc = KThreadMake ( & curs -> pagemap_thread, run_pagemap_thread, curs );
-            if ( rc == 0 )
-                return 0;
-
-            KConditionRelease ( curs -> pmpr . cond );
-            curs -> pmpr . cond = NULL;
-        }
-
-        KLockRelease ( curs -> pmpr . lock );
-        curs -> pmpr . lock = NULL;
-    }
-
-	return rc;
-}
-
-rc_t VCursorTerminatePagemapThread(VCursor *self)
-{
-	rc_t rc=0;
-
-    assert ( self != NULL );
-
-	if(self -> pagemap_thread != NULL)
-    {
-		rc = KLockAcquire ( self -> pmpr.lock );
-		if ( rc == 0 )
-        {
-			self -> pmpr.state = ePMPR_STATE_EXIT;
-			KConditionSignal ( self -> pmpr.cond );
-			KLockUnlock ( self -> pmpr.lock );
-		}
-		KThreadWait ( self -> pagemap_thread, NULL );
-	}
-
-	KThreadRelease ( self -> pagemap_thread );
-	KConditionRelease ( self -> pmpr.cond );
-	KLockRelease ( self -> pmpr.lock );
-
-    self -> pagemap_thread = NULL;
-    self -> pmpr . cond = NULL;
-    self -> pmpr . lock = NULL;
-
-	return rc;
-}
-
-/* DisablePagemapThread
- *  this can cause difficulties for some clients
- */
-LIB_EXPORT rc_t CC VDBManagerDisablePagemapThread ( struct VDBManager const *self )
-{
-    if ( self == NULL )
-        return RC ( rcVDB, rcMgr, rcUpdating, rcSelf, rcNull );
-    s_disable_pagemap_thread = true;
-    return 0;
-}
-
-
-/* IsStaticColumn
- *  answers question: "does this column have the same value for every cell?"
- */
-LIB_EXPORT rc_t CC VCursorIsStaticColumn ( const VCursor *self, uint32_t col_idx, bool *is_static )
-{
-    rc_t rc;
-
-    if ( is_static == NULL )
-        rc = RC ( rcVDB, rcCursor, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcCursor, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            uint32_t start = VectorStart ( & self -> row );
-            uint32_t end = start + VectorLength ( & self -> row );
-            if ( col_idx < start || col_idx > end )
-                rc = RC ( rcVDB, rcCursor, rcSelecting, rcId, rcInvalid );
-            else
-            {
-                VColumn *col = VectorGet ( & self -> row, col_idx );
-                return VColumnIsStatic ( col, is_static );
-            }
-        }
-
-        * is_static = false;
-    }
-
-    return rc;
-}
diff --git a/libs/vdb/cursor-priv.h b/libs/vdb/cursor-priv.h
deleted file mode 100644
index 9ec8b13..0000000
--- a/libs/vdb/cursor-priv.h
+++ /dev/null
@@ -1,311 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_cursor_priv_
-#define _h_cursor_priv_
-
-#ifndef _h_vdb_extern_
-#include <vdb/extern.h>
-#endif
-
-#ifndef _h_klib_vector_
-#include <klib/vector.h>
-#endif
-
-#ifndef _h_klib_container_
-#include <klib/container.h>
-#endif
-
-#ifndef _h_klib_refcount_
-#include <klib/refcount.h>
-#endif
-
-#ifndef KONST
-#define KONST
-#endif
-
-#ifndef SKONST
-#define SKONST const
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "blob-priv.h"
-
-#define MTCURSOR_DBG( msg ) DBGMSG ( DBG_VDB, DBG_FLAG ( DBG_VDB_MTCURSOR ), msg )
-
-
-
-#define VCURSOR_WRITE_MODES_SUPPORTED 0
-
-/* temporary - until the full kproc for Windows is operational */
-#if defined(WINDOWS) || defined(_WIN32) || defined(NCBI_WITHOUT_MT)
-#define VCURSOR_FLUSH_THREAD 0
-#else
-#define VCURSOR_FLUSH_THREAD 1
-#endif
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KLock;
-struct KCondition;
-struct KThread;
-struct KNamelist;
-struct KDlset;
-struct VTable;
-struct VCtxId;
-struct VSchema;
-struct SColumn;
-struct VColumn;
-struct VPhysical;
-
-
-/*--------------------------------------------------------------------------
- * VCursorCache
- *  a dual-level vector
- */
-typedef struct VCursorCache VCursorCache;
-struct VCursorCache
-{
-    Vector cache;
-};
-
-
-/* Init
- */
-#define VCursorCacheInit( self, start, block ) \
-    VectorInit ( & ( self ) -> cache, start, block )
-
-/* Whack
- */
-void VCursorCacheWhack ( VCursorCache *self,
-    void ( CC * whack ) ( void *item, void *data ), void *data );
-
-/* Get
- *  retrieve object by cid
- */
-void *VCursorCacheGet ( const VCursorCache *self, struct VCtxId const *cid );
-
-/* Set
- *  set object by cid
- */
-rc_t VCursorCacheSet ( VCursorCache *self,
-    struct VCtxId const *cid, const void *item );
-
-/* Swap
- *  swap object by cid
- */
-rc_t VCursorCacheSwap ( VCursorCache *self,
-    struct VCtxId const *cid, const void *item, void **prior );
-
-
-/*--------------------------------------------------------------------------
- * VCursor
- */
-enum
-{
-    vcConstruct,
-    vcFailed,
-    vcReady,
-    vcRowOpen,
-    vcRowCommitted,
-    vcPageCommit
-};
-
-enum
-{
-    vfReady,
-    vfBusy,
-    vfFgErr,
-    vfBgErr,
-    vfExit
-};
-
-
-struct VCursor
-{
-    /* row id */
-    int64_t row_id;
-
-    /* half-closed page range */
-    int64_t start_id, end_id;
-
-    /* starting id for flush */
-    volatile int64_t flush_id;
-
-    /* attached reference to table */
-    struct VTable KONST *tbl;
-
-    /* cursor-specific schema and table */
-    struct VSchema SKONST *schema;
-    struct STable SKONST *stbl;
-
-    /* background flush thread objects */
-    int64_t launch_cnt;
-    struct KThread *flush_thread;
-    struct KLock *flush_lock;
-    struct KCondition *flush_cond;
-
-    /* background pagemap conversion objects */
-    struct KThread *pagemap_thread;
-    PageMapProcessRequest pmpr;
-
-    /* user data */
-    void *user;
-    void ( CC * user_whack ) ( void *data );
-
-    /* external named cursor parameters */    
-    BSTree named_params;
-
-    /* linked cursors */
-    BSTree linked_cursors;
-
-    /* read-only blob cache */
-    VBlobMRUCache *blob_mru_cache;
-
-    /* external row of VColumn* by ord ( owned ) */
-    Vector row;
-
-    /* column objects by cid ( not-owned ) */
-    VCursorCache col;
-
-    /* physical columns by cid ( owned ) */
-    VCursorCache phys;
-    uint32_t phys_cnt;
-
-    /* productions by cid ( not-owned ) */
-    VCursorCache prod;
-
-    /* intermediate productions ( owned ) */
-    Vector owned;
-
-    /* trigger productions ( not-owned ) */
-    Vector trig;
-
-    KRefcount refcount;
-
-    volatile uint32_t flush_cnt;
-
-    /* foreground state */
-    uint8_t state;
-
-    /* flush_state */
-    volatile uint8_t flush_state;
-
-    bool read_only;
-
-    /* support for sradb-v1 API */
-    bool permit_add_column;
-    bool permit_post_open_add;
-    /* support suspension of schema-declared triggers **/
-    bool suspend_triggers;
-};
-
-
-/* Make
- */
-rc_t VCursorMake ( struct VCursor **cursp, struct VTable const *tbl );
-
-rc_t VTableCreateCursorWriteInt ( struct VTable *self, struct VCursor **cursp, KCreateMode mode, bool create_thread );
-
-/* Whack
- * Destroy
- */
-rc_t VCursorWhack ( struct VCursor *self );
-rc_t VCursorDestroy ( struct VCursor *self );
-
-/* SupplementSchema
- *  scan table for physical column names
- *  create transparent yet incomplete (untyped) columns for unknown names
- *  create incomplete (untyped) physical columns for forwarded names
- *  repeat process on static columns, except create complete (fully typed) objects
- */
-rc_t VCursorSupplementSchema ( struct VCursor const *self );
-
-/* MakeColumn
- */
-rc_t VCursorMakeColumn ( struct VCursor *self,
-    struct VColumn **col, struct SColumn const *scol, Vector *cx_bind );
-
-/* SetRowIdRead - PRIVATE
- *  seek to given row id
- *
- *  "row_id" [ IN ] - row id to select
- */
-rc_t VCursorSetRowIdRead ( struct VCursor *self, int64_t row_id );
-
-/* Open
- */
-rc_t VCursorOpenRead ( struct VCursor *self, struct KDlset const *libs );
-/**
-*** VTableCreateCursorReadInternal is only visible in vdb and needed for schema resolutions
-****/
-rc_t  VTableCreateCursorReadInternal(const struct VTable *self, const struct VCursor **cursp);
-
-
-/* ListReadableColumns
- *  performs an insert of '*' to cursor
- *  attempts to resolve all read rules
- *  records all SColumns that successfully resolved
- *  populates BTree with VColumnRef objects
- */
-rc_t VCursorListReadableColumns ( struct VCursor *self, BSTree *columns );
-
-/* ListWritableColumns
- *  walks list of SPhysicals and trigger SProductions
- *  attempts to resolve all write rules
- *  records any SColumn that can be reached
- *  populates BTree with VColumnRef objects
- */
-rc_t VCursorListWritableColumns ( struct VCursor *self, BSTree *columns );
-rc_t VCursorListSeededWritableColumns ( struct VCursor *self, BSTree *columns, struct KNamelist const *seed );
-
-/* PostOpenAdd
- *  handle opening of a column after the cursor is opened
- */
-rc_t VCursorPostOpenAdd ( struct VCursor *self, struct VColumn *col );
-rc_t VCursorPostOpenAddRead ( struct VCursor *self, struct VColumn *col );
-
-/* OpenRowRead
- * CloseRowRead
- */
-rc_t VCursorOpenRowRead ( struct VCursor *self );
-rc_t VCursorCloseRowRead ( struct VCursor *self );
-
-
-/** pagemap supporting thread **/
-rc_t VCursorLaunchPagemapThread(struct VCursor *self);
-rc_t VCursorTerminatePagemapThread(struct VCursor *self);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_cursor_priv_ */
diff --git a/libs/vdb/cursor.c b/libs/vdb/cursor.c
deleted file mode 100644
index 63adbc3..0000000
--- a/libs/vdb/cursor.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#define TRACK_REFERENCES 0
-
-#define KONST const
-#include "cursor-priv.h"
-#include "dbmgr-priv.h"
-#include "linker-priv.h"
-#include "schema-priv.h"
-#include "table-priv.h"
-#include "column-priv.h"
-#undef KONST
-
-#include <vdb/cursor.h>
-#include <vdb/table.h>
-#include <kfs/dyload.h>
-#include <klib/symbol.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * VCursor
- *  a row cursor onto a VTable
- */
-
-
-/* Whack
- */
-rc_t VCursorWhack ( VCursor *self )
-{
-    VCursorTerminatePagemapThread(self);
-    return VCursorDestroy ( self );
-}
-
-
-/* MakeColumn
- */
-rc_t VCursorMakeColumn ( VCursor *self, VColumn **col, const SColumn *scol, Vector *cx_bind )
-{
-    return VColumnMake ( col, self -> schema, scol );
-}
-
-/* PostOpenAdd
- *  handle opening of a column after the cursor is opened
- */
-rc_t VCursorPostOpenAdd ( VCursor *self, VColumn *col )
-{
-    return VCursorPostOpenAddRead ( self, col );
-}
-
-/* Open
- *  open cursor, resolving schema
- *  for the set of opened columns
- *
- *  NB - there is no corresponding "Close"
- *  use "Release" instead.
- */
-LIB_EXPORT rc_t CC VCursorOpen ( const VCursor *cself )
-{
-    rc_t rc;
-    VCursor *self = ( VCursor* ) cself;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcCursor, rcOpening, rcSelf, rcNull );
-    else
-    {
-        VLinker *ld = self -> tbl -> linker;
-
-        KDlset *libs;
-        rc = VLinkerOpen ( ld, & libs );
-        if ( rc == 0 )
-        {
-            rc = VCursorOpenRead ( self, libs );
-            if ( rc == 0 )
-            {
-                int64_t first;
-                uint64_t count;
-                
-                rc = VCursorIdRange ( self, 0, & first, & count );
-                if ( rc != 0 )
-                {
-                    /* permit empty open when run from sradb */
-                    if ( GetRCState ( rc ) == rcEmpty && GetRCObject ( rc ) == rcRange &&
-                         self -> permit_add_column && VectorLength ( & self -> row ) == 0 )
-                    {
-                        rc = 0;
-                    }
-                }
-                else if ( count != 0 )
-                {
-                    /* set initial row id to starting row */
-                    self -> start_id = self -> end_id = self -> row_id = first;
-                }
-
-                if ( rc != 0 )
-                    self -> state = vcFailed;
-            }
-
-            KDlsetRelease ( libs );
-        }
-    }
-
-    return rc;
-}
-
-
-/* SetRowId
- *  seek to given row id
- *
- *  "row_id" [ IN ] - row id to select
- */
-LIB_EXPORT rc_t CC VCursorSetRowId ( const VCursor *cself, int64_t row_id )
-{
-    rc_t rc;
-    VCursor *self = ( VCursor* ) cself;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcCursor, rcPositioning, rcSelf, rcNull );
-    else if ( self -> state > vcReady )
-        rc = RC ( rcVDB, rcCursor, rcPositioning, rcCursor, rcBusy );
-    else
-        rc = VCursorSetRowIdRead ( self, row_id );
-
-    return rc;
-}
-
-
-/* OpenRow
- *  open currently closed row indicated by row id
- */
-LIB_EXPORT rc_t CC VCursorOpenRow ( const VCursor *cself )
-{
-    rc_t rc;
-    VCursor *self = ( VCursor* ) cself;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcCursor, rcOpening, rcSelf, rcNull );
-    else if ( self -> state < vcReady )
-        rc = RC ( rcVDB, rcCursor, rcOpening, rcRow, rcIncomplete );
-    else if ( self -> state > vcReady )
-        rc = 0;
-    else
-        rc = VCursorOpenRowRead ( self );
-
-    return rc;
-}
-
-/* CloseRow
- *  balances OpenRow message
- *  if there are uncommitted modifications,
- *  discard all changes. otherwise,
- *  advance to next row
- */
-LIB_EXPORT rc_t CC VCursorCloseRow ( const VCursor *cself )
-{
-    rc_t rc;
-    VCursor *self = ( VCursor* ) cself;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcCursor, rcClosing, rcSelf, rcNull );
-    else if ( self -> state < vcRowOpen )
-        rc = 0;
-    else
-        rc = VCursorCloseRowRead ( self );
-
-    return rc;
-}
diff --git a/libs/vdb/database-cmn.c b/libs/vdb/database-cmn.c
deleted file mode 100644
index c877fea..0000000
--- a/libs/vdb/database-cmn.c
+++ /dev/null
@@ -1,724 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#define KONST const
-#include "database-priv.h"
-#include "dbmgr-priv.h"
-#undef KONST
-
-#include "schema-priv.h"
-#include "linker-priv.h"
-
-#include <vdb/manager.h>
-#include <vdb/database.h>
-#include <kdb/manager.h>
-#include <kdb/database.h>
-#include <kdb/meta.h>
-#include <kdb/namelist.h>
-#include <klib/debug.h>
-#include <klib/printf.h>
-#include <klib/rc.h>
-#include <klib/namelist.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * VDatabase
- *  opaque connection to a database within file system
- */
-
-
-/* Whack
- */
-rc_t CC VDatabaseWhack ( VDatabase *self )
-{
-    rc_t rc = 0;
-
-    KRefcountWhack ( & self -> refcount, "VDatabase" );
-
-    /* release user data */
-    if ( self -> user != NULL && self -> user_whack != NULL )
-    {
-        ( * self -> user_whack ) ( self -> user );
-        self -> user = NULL;
-        self -> user_whack = NULL;
-    }
-
-    /* release dad */
-    if ( self -> dad != NULL )
-    {
-        rc = VDatabaseSever ( self -> dad );
-        if ( rc == 0 )
-            self -> dad = NULL;
-    }
-
-    /* remove from mgr */
-    if ( rc == 0 )
-        rc = VDBManagerSever ( self -> mgr );
-
-    if ( rc == 0 )
-    {
-        /* complete */
-        KMetadataRelease ( self -> meta );
-        KDatabaseRelease ( self -> kdb );
-        VSchemaRelease ( self -> schema );
-
-        free ( self );
-        return 0;
-    }
-
-    KRefcountInit ( & self -> refcount, 1, "VDatabase", "whack", "vdb" );
-    return rc;
-}
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-LIB_EXPORT rc_t CC VDatabaseAddRef ( const VDatabase *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "VDatabase" ) )
-        {
-        case krefLimit:
-            return RC ( rcVDB, rcDatabase, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC VDatabaseRelease ( const VDatabase *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "VDatabase" ) )
-        {
-        case krefWhack:
-            return VDatabaseWhack ( ( VDatabase* ) self );
-        case krefNegative:
-            return RC ( rcVDB, rcDatabase, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-/* Attach
- * Sever
- *  internal reference management
- */
-VDatabase *VDatabaseAttach ( const VDatabase *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAddDep ( & self -> refcount, "VDatabase" ) )
-        {
-        case krefLimit:
-            return NULL;
-        }
-    }
-    return ( VDatabase* ) self;
-}
-
-rc_t VDatabaseSever ( const VDatabase *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDropDep ( & self -> refcount, "VDatabase" ) )
-        {
-        case krefWhack:
-            return VDatabaseWhack ( ( VDatabase* ) self );
-        case krefNegative:
-            return RC ( rcVDB, rcDatabase, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/* Make - PRIVATE
- *  creates an initialized database object
- *  expects a mgr and optionally a parent db,
- *  enforces schema validity according to some rules,
- */
-rc_t VDatabaseMake ( VDatabase **dbp,
-    const VDBManager *mgr, const VDatabase *dad, const VSchema *schema )
-{
-    rc_t rc;
-
-    /* create a structure */
-    VDatabase *db = calloc ( 1, sizeof * db );
-    if ( db == NULL )
-        rc = RC ( rcVDB, rcDatabase, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        /* create a modifiable schema */
-        rc = VSchemaMake ( ( VSchema** ) & db -> schema, schema );
-        if ( rc == 0 )
-        {
-            db -> mgr = VDBManagerAttach ( mgr );
-            db -> dad = VDatabaseAttach ( dad );
-            KRefcountInit ( & db -> refcount, 1, "VDatabase", "make", "vdb" );
-
-            db -> cmode = ( uint8_t ) kcmOpen;
-            db -> checksum = ( uint8_t ) kcsNone;
-
-            * dbp = db;
-            return 0;
-        }
-
-        VDatabaseWhack ( db );
-    }
-
-    * dbp = NULL;
-
-    return rc;
-}
-
-
-/* OpenRead
- *  finish opening a db for read
- */
-static
-rc_t CC VDatabaseOpenRead ( VDatabase *self )
-{
-    /* open metadata */
-    rc_t rc = KDatabaseOpenMetadataRead ( self -> kdb, & self -> meta );
-    if ( rc == 0 )
-    {
-        /* fetch stored schema */
-        rc = VDatabaseLoadSchema ( self );
-        if ( rc == 0 && self -> sdb == NULL )
-            rc = RC ( rcVDB, rcDatabase, rcOpening, rcSchema, rcNotFound );
-    }
-
-    DBGMSG(DBG_VDB, DBG_FLAG(DBG_VDB_VDB), ("VDatabaseOpenRead = %d\n", rc));
-
-    return rc;
-}
-
-
-/* OpenDBRead
- * VOpenDBRead
- *  open a database for read
- *
- *  "db" [ OUT ] - return parameter for newly opened database
- *
- *  "schema" [ IN, NULL OKAY ] - schema object containg database
- *  declaration to be used in creating db.
- *
- *  "path" [ IN ] - NUL terminated string in
- *  wd-native character set giving path to database
- */
-LIB_EXPORT rc_t CC VDBManagerVOpenDBRead ( const VDBManager *self,
-    const VDatabase **dbp, const VSchema *schema,
-    const char *path, va_list args )
-{
-    rc_t rc;
-
-    if ( dbp == NULL )
-        rc = RC ( rcVDB, rcMgr, rcOpening, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcMgr, rcOpening, rcSelf, rcNull );
-        else
-        {
-            VDatabase *db;
-
-            if ( schema == NULL )
-                schema = self -> schema;
-
-            rc = VDatabaseMake ( & db, self, NULL, schema );
-            if ( rc == 0 )
-            {
-                db -> read_only = true;
-
-                rc = KDBManagerVOpenDBRead ( self -> kmgr, & db -> kdb, path, args );
-                if ( rc == 0 )
-                {
-                    rc = VDatabaseOpenRead ( db );
-                    if ( rc == 0 )
-                    {
-                        * dbp = db;
-                        return 0;
-                    }
-                }
-
-                VDatabaseWhack ( db );
-            }
-        }
-
-        * dbp = NULL;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VDBManagerOpenDBRead ( const VDBManager *self,
-    const VDatabase **db, const VSchema *schema,
-    const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = VDBManagerVOpenDBRead ( self, db, schema, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VDatabaseVOpenDBRead ( const VDatabase *self,
-    const VDatabase **dbp, const char *name, va_list args )
-{
-    rc_t rc;
-
-    if ( dbp == NULL )
-        rc = RC ( rcVDB, rcDatabase, rcOpening, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcDatabase, rcOpening, rcSelf, rcNull );
-        else
-        {
-            VDatabase *db;
-            rc = VDatabaseMake ( & db, self -> mgr, self, self -> schema );
-            if ( rc == 0 )
-            {
-                db -> read_only = true;
-
-                rc = KDatabaseVOpenDBRead ( self -> kdb, & db -> kdb, name, args );
-                if ( rc == 0 )
-                {
-                    rc = VDatabaseOpenRead ( db );
-                    if ( rc == 0 )
-                    {
-                        * dbp = db;
-                        return 0;
-                    }
-                }
-
-                VDatabaseWhack ( db );
-            }
-        }
-
-        * dbp = NULL;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VDatabaseOpenDBRead ( const VDatabase *self,
-    const VDatabase **db, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = VDatabaseVOpenDBRead ( self, db, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* Locked
- *  returns true if locked
- */
-LIB_EXPORT bool CC VDatabaseLocked ( const VDatabase *self )
-{
-    /* TBD - no concept of virtual database locking
-       other than physical database locking */
-    if ( self != NULL )
-        return KDatabaseLocked ( self -> kdb );
-    return false;
-}
-
-
-/* IsAlias
- *  returns true if object name is an alias
- *  returns path to fundamental name if it was aliased
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptDatabase, kptTable and kptIndex
- *
- *  "resolved" [ OUT ] and "rsize" [ IN ] - optional output buffer
- *  for fundamenta object name if "alias" is not a fundamental name, 
- *
- *  "name" [ IN ] - NUL terminated object name
- */
-LIB_EXPORT bool CC VDatabaseIsAlias ( const VDatabase *self, uint32_t type,
-    char *resolved, size_t rsize, const char *name )
-{
-    if ( self != NULL )
-        return KDatabaseIsAlias ( self -> kdb, type, resolved, rsize, name );
-
-    if ( resolved != NULL && rsize != 0 )
-        * resolved = 0;
-
-    return false;
-}
-
-
-/* Writable
- *  returns 0 if object is writable
- *  or a reason why if not
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptDatabase, kptTable and kptIndex
- *
- *  "path" [ IN ] - NUL terminated path
- */
-LIB_EXPORT rc_t CC VDatabaseVWritable ( const VDatabase *self, uint32_t type, 
-        const char *name, va_list args )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcDatabase, rcAccessing, rcSelf, rcNull );
-    else
-        rc = KDatabaseVWritable ( self -> kdb, type, name, args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VDatabaseWritable ( const VDatabase *self, uint32_t type, const char *name, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, name );
-
-    rc = VDatabaseVWritable ( self, type, name, args );
-
-    va_end ( args );
-
-    return rc;
-}
-
-/* OpenMetadataRead
- *  opens metadata for read
- *
- *  "meta" [ OUT ] - return parameter for metadata
- */
-LIB_EXPORT rc_t CC VDatabaseOpenMetadataRead ( const VDatabase *self, const KMetadata **meta )
-{
-    rc_t rc;
-    if ( meta == NULL )
-        rc = RC ( rcVDB, rcDatabase, rcAccessing, rcParam, rcNull );
-    else
-    {
-        * meta = NULL;
-
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcDatabase, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            /* we operate under the notion of
-               single-threaded operation, so hand out
-               read or update capable object */
-            rc = KMetadataAddRef ( self -> meta );
-            if ( rc == 0 )
-                * meta = self -> meta;
-        }
-    }
-
-    return rc;
-}
-
-
-/* OpenManager
- *  duplicate reference to manager
- *  NB - returned reference must be released
- */
-LIB_EXPORT rc_t CC VDatabaseOpenManagerRead ( const VDatabase *self, const VDBManager **mgr )
-{
-    rc_t rc;
-
-    if ( mgr == NULL )
-        rc = RC ( rcVDB, rcDatabase, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcDatabase, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = VDBManagerAddRef ( self -> mgr );
-            if ( rc == 0 )
-            {
-                * mgr = self -> mgr;
-                return 0;
-            }
-        }
-
-        * mgr = NULL;
-    }
-
-    return rc;
-}
-
-
-/* OpenParent
- *  duplicate reference to parent database
- *  NB - returned reference must be released
- */
-LIB_EXPORT rc_t CC VDatabaseOpenParentRead ( const VDatabase *self, const VDatabase **par )
-{
-    rc_t rc;
-
-    if ( par == NULL )
-        rc = RC ( rcVDB, rcDatabase, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcDatabase, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = VDatabaseAddRef ( self -> dad );
-            if ( rc == 0 )
-            {
-                * par = self -> dad;
-                return 0;
-            }
-        }
-
-        * par = NULL;
-    }
-
-    return rc;
-}
-
-
-/* OpenSchema
- *  duplicate reference to table schema
- *  NB - returned reference must be released
- */
-LIB_EXPORT rc_t CC VDatabaseOpenSchema ( const VDatabase *self, const VSchema **schema )
-{
-    rc_t rc;
-
-    if ( schema == NULL )
-        rc = RC ( rcVDB, rcDatabase, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcDatabase, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = VSchemaAddRef ( self -> schema );
-            if ( rc == 0 )
-            {
-                * schema = self -> schema;
-                return 0;
-            }
-        }
-
-        * schema = NULL;
-    }
-
-    return rc;
-}
-
-
-/* lists the tables of the database
- * 
- * "names" [ OUT ] - return parameter for tables 
- */
-LIB_EXPORT rc_t CC VDatabaseListTbl ( const VDatabase *self, KNamelist **names )
-{
-    rc_t rc;
-
-    if ( names == NULL )
-        rc = RC ( rcVDB, rcDatabase, rcListing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcDatabase, rcListing, rcSelf, rcNull );
-        else
-        {
-            if ( self->kdb == NULL )
-                rc = RC ( rcVDB, rcDatabase, rcListing, rcParam, rcNull );
-            else
-            {
-                return KDatabaseListTbl ( self->kdb, names );
-            }
-        }
-        *names = NULL;
-    }
-    return rc;
-}
-
-/* lists the sub-databases of the database
- * 
- * "names" [ OUT ] - return parameter for databases 
- */
-LIB_EXPORT rc_t CC VDatabaseListDB ( const VDatabase *self, KNamelist **names )
-{
-    rc_t rc;
-
-    if ( names == NULL )
-        rc = RC ( rcVDB, rcDatabase, rcListing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcDatabase, rcListing, rcSelf, rcNull );
-        else
-        {
-            if ( self->kdb == NULL )
-                rc = RC ( rcVDB, rcDatabase, rcListing, rcParam, rcNull );
-            else
-            {
-                return KDatabaseListDB ( self->kdb, names );
-            }
-        }
-        *names = NULL;
-    }
-    return rc;
-}
-
-/* GetUserData
- * SetUserData
- *  store/retrieve an opaque pointer to user data
- */
-LIB_EXPORT rc_t CC VDatabaseGetUserData ( const VDatabase *self, void **data )
-{
-    rc_t rc;
-
-    if ( data == NULL )
-        rc = RC ( rcVDB, rcDatabase, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcDatabase, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            * data = self -> user;
-            return 0;
-        }
-
-        * data = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VDatabaseSetUserData ( const VDatabase *cself,
-    void *data, void ( CC * destroy ) ( void *data ) )
-{
-    VDatabase *self = ( VDatabase* ) cself;
-    if ( cself == NULL )
-        return RC ( rcVDB, rcDatabase, rcUpdating, rcSelf, rcNull );
-
-    self -> user = data;
-    self -> user_whack = destroy;
-
-    return 0;
-}
-
-
-/* OpenKDatabase
- *  returns a new reference to underlying KDatabase
- */
-LIB_EXPORT rc_t CC VDatabaseOpenKDatabaseRead ( const VDatabase *self, const KDatabase **kdb )
-{
-    rc_t rc;
-
-    if ( kdb == NULL )
-        rc = RC ( rcVDB, rcDatabase, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcDatabase, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = KDatabaseAddRef ( self -> kdb );
-            if ( rc == 0 )
-            {
-                * kdb = self -> kdb;
-                return 0;
-            }
-        }
-
-        * kdb = NULL;
-    }
-
-    return rc;
-}
-
-
-
-/* Typespec
- *  retrieve db typespec
- *
- *  AVAILABILITY: version 2.2
- *
- *  "ts_buff" [ IN ] and "ts_size" [ IN ] - buffer for return of NUL-terminated
- *  db typespec, e.g. 'NCBI:db:abc#1.1'
- */
-LIB_EXPORT rc_t CC VDatabaseTypespec ( const VDatabase *self, char *ts_buff, size_t ts_size )
-{
-    rc_t rc;
-
-    if ( ts_size == 0 )
-        rc = RC ( rcVDB, rcDatabase, rcAccessing, rcBuffer, rcInsufficient );
-    else if ( ts_buff == NULL )
-        rc = RC ( rcVDB, rcDatabase, rcAccessing, rcBuffer, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcDatabase, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc_t rc2;
-            rc2 = string_printf ( ts_buff, ts_size, NULL, "%N#%V", self -> sdb -> name, self -> sdb -> version );
-            if ( rc2 == 0 )
-                return 0;
-            rc = rc2;
-        }
-
-        ts_buff [ 0 ] = 0;
-    }
-
-    return rc;
-}
-
-
-/* IsCSRA
- *  ask an open database if it conforms to cSRA schema
- */
-LIB_EXPORT bool CC VDatabaseIsCSRA ( const VDatabase *self )
-{
-    if ( self != NULL )
-        return KDatabaseExists ( self -> kdb, kptTable, "PRIMARY_ALIGNMENT" );
-
-    return false;
-}
diff --git a/libs/vdb/database-depend.c b/libs/vdb/database-depend.c
deleted file mode 100644
index c8c9b9f..0000000
--- a/libs/vdb/database-depend.c
+++ /dev/null
@@ -1,1807 +0,0 @@
-/*==============================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#include <vdb/vdb-priv.h> /* VDBManagerGetKDBManagerRead */
-#include <vdb/manager.h> /* VDBManagerRelease */
-#include <vdb/cursor.h>
-#include <vdb/table.h>
-#include <vdb/database.h>
-#include <vdb/dependencies.h>
-
-#include <kdb/kdb-priv.h> /* KDBManagerGetVFSManager */
-#include <kdb/manager.h>
-
-#include <vfs/manager.h> /* VFSManager */
-#include <vfs/resolver.h> /* VResolver */
-#include <vfs/path.h>
-
-#include <kfg/config.h>
-
-#include <klib/container.h>
-#include <klib/debug.h> /* DBG_VDB */
-#include <klib/log.h>
-#include <klib/out.h>
-#include <klib/printf.h> /* string_printf */
-#include <klib/rc.h>
-#include <klib/text.h>
-
-#include <sysalloc.h>
-
-#include "cursor-priv.h"
-
-/* missing macros/function from klib/rc.h
- */
-#define GetRCSTATE( rc ) \
-    ( ( rc ) & 0x00003FFF )
-#define RC_STATE( obj, state)                         \
-    ( rc_t ) ( ( ( rc_t ) ( obj ) << 6 ) |            \
-               ( ( rc_t ) ( state ) ) )
-
-#include <assert.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifndef PATH_MAX
-#define PATH_MAX 4096
-#endif
-
-#define RELEASE(type, obj) do { rc_t rc2 = type##Release(obj); \
-    if (rc2 && !rc) { rc = rc2; } obj = NULL; } while (false)
-
-static bool OLD = true;
-
-typedef struct {
-    /* deprecated way */
-    char ref[PATH_MAX + 1];
-
-    /* new way */
-    const String *local;
-    const String *remote;
-    const String *cache;
-
-    uint32_t count;
-    rc_t rc;
-} Resolved;
-typedef struct {
-    BSTNode n;
-
-    bool circular;
-    char* name;
-    uint32_t readLen;
-    char* seqId;
-    bool local;
-
-    Resolved resolved;
-} RefNode;
-static rc_t _ResolvedRelease(Resolved *self) {
-    rc_t rc = 0;
-
-    assert(self);
-
-    free((void*)self->local);
-    free((void*)self->cache);
-    free((void*)self->remote);
-
-    memset(self, 0, sizeof *self);
-
-    return rc;
-}
-
-
-static void CC bstWhack( BSTNode* n, void* ignore )
-{
-    RefNode* sn = (RefNode*) n;
-
-    assert( sn );
-
-    free( sn->name );
-
-    free( sn->seqId );
-
-    _ResolvedRelease( &sn->resolved );
-
-    memset( sn, 0, sizeof *sn );
-
-    free( sn );
-}
-
-static
-int CC bstCmpBySeqId(const void* item, const BSTNode* n)
-{
-    const char* s1 = item;
-    const RefNode* sn = (const RefNode*) n;
-
-    assert(s1 && sn);
-
-    return strcmp(s1, sn->seqId);
-}
-
-static int CC bstCmpByRemote(const void* item, const BSTNode* n)
-{
-    const String* s1 = item;
-    const RefNode* sn = (const RefNode*) n;
-
-    assert(sn);
-
-    if (s1 == NULL) {
-        return sn->resolved.remote != NULL;
-    }
-    else {
-        int min = s1->size < sn->resolved.remote->size
-            ? s1->size : sn->resolved.remote->size;
-        return strncmp(s1->addr, sn->resolved.remote->addr, min);
-    }
-}
-
-static
-int CC bstSortBySeqId(const BSTNode* item, const BSTNode* n)
-{
-    const RefNode* sn = (const RefNode*) item;
-
-    return bstCmpBySeqId(sn->seqId, n);
-}
-
-static
-int CC bstSortByRemote(const BSTNode* item, const BSTNode* n)
-{
-    const RefNode* sn = (const RefNode*) item;
-
-    return bstCmpByRemote(sn->resolved.remote, n);
-}
-
-typedef struct Column {
-    uint32_t idx;
-    const char* name;
-    uint32_t expected;
-    uint32_t elem_bits;
-} Column;
-
-static
-rc_t AddColumn(rc_t rc, const VCursor* curs, Column* col)
-{
-    if (rc == 0) {
-        assert(curs && col);
-
-        rc = VCursorAddColumn(curs, &col->idx, col->name);
-        if (rc != 0) {
-            DBGMSG(DBG_VDB, DBG_FLAG(DBG_VDB),
-                ("Cannot Add Column %s", col->name));
-        }
-    }
-
-    return rc;
-}
-
-/* Read a column data from a Cursor */
-static
-rc_t CursorRead(rc_t rc, const VCursor* curs, int64_t row_id,
-    const Column* col, void* buffer, uint32_t blen, uint32_t* row_len)
-{
-    assert(curs);
-
-    if (rc == 0) {
-        uint32_t elem_bits = col->elem_bits;
-        uint32_t expected = col->expected;
-        assert(col);
-
-        if (blen == 0) {
-            assert(buffer == NULL);
-            ++blen;
-        }
-
-        rc = VCursorReadDirect
-            (curs, row_id, col->idx, elem_bits, buffer, blen - 1, row_len);
-
-        if (rc != 0) {
-            if (buffer == NULL &&
-                rc == RC(rcVDB, rcCursor, rcReading, rcBuffer, rcInsufficient))
-            {
-                rc = 0;
-            }
-        }
-        else {
-            if (expected > 0 && *row_len != expected) {
-                rc = RC(rcVDB, rcCursor, rcReading, rcData, rcUnexpected);
-            }
-            if (buffer != NULL && expected == 0)
-            {   ((char*)buffer)[*row_len] = '\0'; }
-        }
-    }
-
-    return rc;
-}
-
-#if 0
-/* Read a String from Configuration into "value" buffer */
-static rc_t ReadCfgStr
-(const KConfig* kfg, const char* path, char* value, size_t value_sz)
-{
-    rc_t rc = 0;
-    const KConfigNode *node = NULL;
-
-    rc = KConfigOpenNodeRead(kfg, &node, path);
-    if (rc == 0) {
-        size_t num_read = 0;
-        size_t remaining = 0;
-        rc = KConfigNodeRead
-            (node, 0, value, value_sz - 1, &num_read, &remaining);
-        if (rc == 0) {
-            if (remaining != 0)
-            {   rc = RC(rcVDB, rcString, rcReading, rcSize, rcExcessive); }
-/* TODO: make sure check value[num_read] assignment is valid
-         when remaining == 0 */
-            else { value[num_read] = '\0'; }
-        }
-    }
-
-    RELEASE(KConfigNode, node);
-
-    return rc;
-}
-#endif
-
-#define SIZE 4096
-
-/* Ctx struct is used to find a file using KConfig "refseq" parameters */
-typedef struct {
-    KDirectory* dir;
-
-    char servers[SIZE];
-    char volumes[SIZE];
-    char paths[SIZE];
-
-    VResolver* resolver;
-
-    const Resolved* last;
-    bool hasDuplicates;
-} Ctx;
-static rc_t CtxInit(Ctx* self, const VDatabase *db) {
-    rc_t rc = 0;
-    KConfig* cfg = NULL;
-
-    assert(self && db);
-
-    memset(self, 0, sizeof *self);
-
-    if (rc == 0) {
-        rc = KConfigMake(&cfg, NULL);
-        if (rc == 0) {
-            const KConfigNode *node = NULL;
-            rc = KConfigOpenNodeRead(cfg, &node, "repository");
-            if (rc == 0) {
-                OLD = false;
-                LOGMSG(klogInfo, "KConfig(repository) found: using VResolver");
-            }
-            else {
-                OLD = true;
-                LOGMSG(klogInfo,
-                    "KConfig(repository) not found: not using VResolver");
-            }
-            RELEASE(KConfigNode, node);
-        }
-    }
-
-#if 0
-    if (OLD) {
-        if (self->dir != NULL) {
-            return rc;
-        }
-
-        rc = KDirectoryNativeDir(&self->dir);
-
-        if (rc == 0) {
-            const char path[] = "refseq/servers";
-            rc = ReadCfgStr(cfg, path, self->servers, sizeof self->servers);
-            if (rc != 0) {
-                if (GetRCState(rc) == rcNotFound)
-                {   rc = 0; }
-            }
-            else {
-                const char path[] = "refseq/volumes";
-                rc = ReadCfgStr(cfg, path, self->volumes, sizeof self->volumes);
-                if (rc != 0) {
-                    if (GetRCState(rc) == rcNotFound)
-                    {   rc = 0; }
-                }
-            }
-
-            if (rc == 0) {
-                const char path[] = "refseq/paths";
-                rc = ReadCfgStr(cfg, path, self->paths, sizeof self->paths);
-                if (rc != 0) {
-                    if (GetRCState(rc) == rcNotFound)
-                    {   rc = 0; }
-                }
-            }
-        }
-    }
-    else
-#endif
-    {
-        const VDBManager *mgr = NULL;
-        const VFSManager* vfsmgr = NULL;
-        const KDBManager* kmgr = NULL;
-
-        if (rc == 0) {
-            rc = VDatabaseOpenManagerRead(db, &mgr);
-        }
-
-        if (rc == 0) {
-            rc = VDBManagerGetKDBManagerRead(mgr, &kmgr);
-        }
-
-        if (rc == 0) {
-            rc = KDBManagerGetVFSManager(kmgr, &vfsmgr);
-        }
-
-        if (rc == 0) {
-            rc = VFSManagerGetResolver(vfsmgr, &self->resolver);
-        }
-
-        RELEASE(VFSManager, vfsmgr);
-        RELEASE(KDBManager, kmgr);
-        RELEASE(VDBManager, mgr);
-    }
-
-    RELEASE(KConfig, cfg);
-
-    return rc;
-}
-
-static rc_t CtxDestroy(Ctx* self) {
-    rc_t rc = 0;
-
-    assert(self);
-
-    RELEASE(KDirectory, self->dir);
-    RELEASE(VResolver, self->resolver);
-
-    memset(self, 0, sizeof *self);
-
-    return rc;
-}
-
-typedef struct {
-    const char* file;
-    bool found;
-} FindRefseq;
-#if 0
-static rc_t CC is_file_in_dir(const KDirectory* dir,
-    uint32_t type, const char* name, void* data)
-{
-    rc_t rc = 0;
-
-    FindRefseq* t = data;
-
-    assert(dir && name && data && t->file);
-
-    if (strcmp(t->file, name) == 0) {
-        uint64_t size = 0;
-        rc = KDirectoryFileSize(dir, &size, name);
-        if (rc == 0 && size > 0) {
-            /* compensate configuration-assistant.perl behavior:
-               it used to create an empty refseq file
-               when failed to download it */
-            t->found = true;
-        }
-    }
-
-    return rc;
-}
-/* Find file within srv/vol. If found then copy complete path to buf.
- * Return true if found
- */
-static bool FindInDir(rc_t* aRc, const KDirectory* native, const char* srv,
-    const char* vol, const char* file, char* buf, size_t blen)
-{
-    rc_t rc = 0;
-
-    const KDirectory* dir = NULL;
-
-    FindRefseq t;
-
-    assert(aRc && native && srv && file && buf && blen);
-
-    rc = *aRc;
-
-    if (rc != 0)
-    {   return false; }
-
-    if (vol)
-    {   rc = KDirectoryOpenDirRead(native, &dir, false, "%s/%s", srv, vol); }
-    else
-    {   rc = KDirectoryOpenDirRead(native, &dir, false, srv); }
-
-    if (rc == 0) {
-        memset(&t, 0, sizeof t);
-        t.file = file;
-        rc = KDirectoryVVisit(dir, false, is_file_in_dir, &t, ".", NULL);
-        if (GetRCObject(rc) == rcDirectory && GetRCState(rc) == rcUnauthorized)
-        {   rc = 0; }
-
-        if (rc == 0 && t.found) {
-            if (vol) {
-                rc = KDirectoryResolvePath(native,
-                    true, buf, blen, "%s/%s/%s", srv, vol, file);
-            }
-            else {
-                rc = KDirectoryResolvePath(native,
-                    true, buf, blen, "%s/%s", srv, file);
-            }
-        }
-    }
-    else if (rc == SILENT_RC(rcFS,
-        rcDirectory, rcOpening, rcPath, rcIncorrect))
-    {
-        /* ignored nonexistent directory */
-        rc = 0;
-    }
-
-    RELEASE(KDirectory, dir);
-
-    *aRc = rc;
-
-    return t.found;
-}
-#endif
-#define rcResolver   rcTree
-static bool NotFoundByResolver(rc_t rc) {
-    if (GetRCModule(rc) == rcVFS) {
-        if (GetRCTarget(rc) == rcResolver) {
-            if (GetRCContext(rc) == rcResolving) {
-                if (GetRCState(rc) == rcNotFound) {
-                    return true;
-                }
-            }
-        }
-    }
-    return false;
-}
-
-/* find remote reference using VResolver */
-static rc_t FindRef(Ctx* ctx, const char* seqId, Resolved* resolved,
-    int cacheState)
-{
-    rc_t rc = 0;
-
-    VPath* acc = NULL;
-    const VPath *remote = NULL;
-    size_t num_writ = 0;
-    char ncbiAcc[512] = "";
-
-    assert(ctx && resolved);
-
-    if (cacheState != -1) {
-        VResolverCacheEnable(ctx->resolver, cacheState);
-    }
-
-    if (rc == 0) {
-        rc = string_printf(ncbiAcc, sizeof ncbiAcc, &num_writ,
-            "ncbi-acc:%s?vdb-ctx=refseq", seqId);
-        if (rc == 0 && num_writ > sizeof ncbiAcc) {
-            return RC(rcExe, rcFile, rcCopying, rcBuffer, rcInsufficient);
-        }
-    }
-
-    if (rc == 0)
-    {
-        VFSManager *mgr;
-        rc = VFSManagerMake ( & mgr );
-        if ( rc == 0 )
-        {
-            rc = VFSManagerMakePath ( mgr, &acc, ncbiAcc);
-            VFSManagerRelease ( mgr );
-        }
-    }
-
-    if (rc == 0) {
-        bool remoteNotFound = false;
-        const VPath *local = NULL;
-        rc = VResolverLocal(ctx->resolver, acc, &local);
-        if (rc == 0) {
-            rc = VPathMakeString(local, &resolved->local);
-            RELEASE(VPath, local);
-        }
-        else if (NotFoundByResolver(rc)) {
-            rc = 0;
-        }
-
-        if (rc == 0) {
-            rc = VResolverRemote(ctx->resolver, eProtocolHttp, acc, &remote);
-            if (rc == 0) {
-                rc = VPathMakeString(remote, &resolved->remote);
-                if (rc == 0) {
-                    char *fragment = string_chr(resolved->remote->addr,
-                        resolved->remote->size, '#');
-                    if (fragment != NULL) {
-                        *fragment = '\0';
-                    }
-                }
-            }
-            else if (NotFoundByResolver(rc)) {
-                remoteNotFound = true;
-                rc = 0;
-            }
-        }
-
-        if (rc == 0 && !remoteNotFound) {
-            uint64_t file_size = 0;
-            const VPath *cache = NULL;
-            rc = VResolverCache(ctx->resolver, remote, &cache, file_size);
-            if (rc == 0) {
-                rc = VPathMakeString(cache, &resolved->cache);
-            }
-            else if (NotFoundByResolver(rc)) {
-                rc = 0;
-            }
-            RELEASE(VPath, cache);
-        }
-
-        if (rc == 0) {
-            if (ctx->last == NULL) {
-                ctx->last = resolved;
-            }
-            else {
-                const String *last = ctx->last->remote;
-                const String *crnt = resolved->remote;
-                if (last != NULL && crnt != NULL &&
-                    last->addr != NULL && crnt->addr != NULL)
-                {
-                    int min = crnt->size < last->size ? crnt->size : last->size;
-                    if (strncmp(last->addr, crnt->addr, min) == 0) {
-                        ctx->hasDuplicates = true;
-                    }
-                }
-            }
-        }
-    }
-
-    RELEASE(VPath, remote);
-    RELEASE(VPath, acc);
-
-    if (cacheState != -1) {
-        VResolverCacheEnable(ctx->resolver, vrAlwaysDisable);
-    }
-
-    return rc;
-}
-#if 0
-/* find remote reference using KConfig values */
-static
-rc_t DeprecatedFindRef(Ctx* ctx, const char* seqId, Resolved* resolved)
-{
-    rc_t rc = 0;
-    bool found = false;
-
-    int i = ~0;
-
-    char* buf = NULL;
-    size_t blen = 0;
-
-    assert(ctx && seqId && resolved);
-
-    memset(resolved, 0, sizeof *resolved);
-    buf = resolved->ref;
-    blen = sizeof resolved->ref;
-
-    for (i = 0; i < 2 && !found; ++i) {
-        char prefix[7] = "";
-        if (i > 0) {
-            if (strlen(seqId) > 6) {
-                strncpy(prefix, seqId, 6);
-                prefix[6] = '\0';
-                seqId = prefix;
-            }
-            else {
-                break;
-            }
-        }
-        if (rc == 0 && ctx->dir != NULL) {
-            if (FindInDir(&rc, ctx->dir, ".", NULL, seqId, buf, blen)) {
-                found = true;
-            }
-            else {
-                if (ctx->paths[0]) {
-                    char paths[SIZE];
-                    char* path_rem = paths;
-                    char* path_sep = NULL;
-                    strcpy(paths, ctx->paths);
-                    do {
-                        char const* path = path_rem;
-                        path_sep = strchr(path, ':');
-                        if (path_sep) {
-                            path_rem = path_sep + 1;
-                            *path_sep = 0;
-                        }
-                        if (FindInDir(&rc, ctx->dir, path, NULL,
-                            seqId, buf, blen))
-                        {
-                            found = true;
-                            break;
-                        }
-                    } while(path_sep && rc == 0);
-                }
-                if (!found && ctx->servers[0] && ctx->volumes[0]) {
-                    char server[SIZE];
-                    char vol[SIZE];
-                    char* srv_sep = NULL;
-                    char* srv_rem = server;
-                    strcpy(server, ctx->servers);
-    /* TODO check for multiple servers/volumes */
-                    do {
-                        char* vol_rem = vol;
-                        char* vol_sep = NULL;
-                        strcpy(vol, ctx->volumes);
-                        srv_sep = strchr(server, ':');
-                        if (srv_sep) {
-                            srv_rem = srv_sep + 1;
-                            *srv_sep = '\0';
-                        }
-                        do {
-                            char const* volume = vol_rem;
-                            vol_sep = strchr(volume, ':');
-                            if (vol_sep) {
-                                vol_rem = vol_sep + 1;
-                                *vol_sep = 0;
-                            }
-                            if (FindInDir(&rc, ctx->dir, server, volume,
-                                seqId, buf, blen))
-                            {
-                                found = true;
-                                break;
-                            }
-                        } while (vol_sep && rc == 0);
-                    } while (!found && srv_sep && rc == 0);
-                }
-            }
-        }
-    }
-
-    return rc;
-}
-#endif
-typedef struct {
-/* row values */
-    uint32_t readLen;
-    char circular[8];
-    char name[256];
-    char seqId[256];
-
-/* we do not read CMP_READ value, just its row_len */
-    uint32_t row_lenCMP_READ;
-} Row;
-/* Add a REFERENCE table Row to BSTree */
-static
-rc_t AddRow(BSTree* tr, Row* data, Ctx* ctx, int cacheState)
-{
-    rc_t rc = 0;
-    bool newRemote = false;
-    RefNode* sn = NULL;
-
-    assert(tr && data && ctx);
-
-    sn = (RefNode*) BSTreeFind(tr, data->seqId, bstCmpBySeqId);
-    if (sn == NULL) {
-        sn = calloc(1, sizeof *sn);
-        if (sn == NULL) {
-            return RC
-                (rcVDB, rcStorage, rcAllocating, rcMemory, rcExhausted);
-        }
-        sn->seqId = string_dup_measure(data->seqId, NULL);
-        if (sn->seqId == NULL) {
-            bstWhack((BSTNode*) sn, NULL);
-            sn = NULL;
-            return RC
-                (rcVDB, rcStorage, rcAllocating, rcMemory, rcExhausted);
-        }
-
-        sn->name = string_dup_measure(data->name, NULL);
-        if (sn->name == NULL) {
-            bstWhack((BSTNode*) sn, NULL);
-            sn = NULL;
-            return RC
-                (rcVDB, rcStorage, rcAllocating, rcMemory, rcExhausted);
-        }
-
-        sn->circular = data->circular[0];
-        sn->readLen = data->readLen;
-        sn->local = (data->row_lenCMP_READ != 0);
-        newRemote = ! sn->local;
-
-        BSTreeInsert(tr, (BSTNode*)sn, bstSortBySeqId);
-    }
-    else {
-        if (data->row_lenCMP_READ != 0) {
-            sn->local = true;
-        }
-        if (strcmp(sn->name, data->name) || sn->circular != data->circular[0]) {
-            return RC(rcVDB, rcCursor, rcReading, rcData, rcInconsistent);
-        }
-        sn->readLen += data->readLen;
-    }
-
-    if (rc == 0 && newRemote) {
-/*      if (OLD) {
-            rc = DeprecatedFindRef(ctx, sn->seqId, &sn->resolved);
-        }
-        else { */
-            rc = FindRef(ctx, sn->seqId, &sn->resolved, cacheState);
-/*      } */
-    }
-
-    return rc;
-}
-
-struct VDBDependencies {
-    uint32_t count;
-    RefNode** dependencies;
-
-    BSTree* tr;
-
-    /* open references */
-    KRefcount refcount;
-};
-typedef struct Initializer {
-    bool all;            /* IN: when false: process just missed */
-    bool fill;           /* IN:
-                          false: count(fill count); true: fill dep(use count) */
-    uint32_t count;      /* IO: all/missed count */
-    VDBDependencies* dep;/* OUT: to be filled */
-    uint32_t i;          /* PRIVATE: index in dep */
-    rc_t rc;             /* OUT */
-} Initializer;
-/* Work function to process dependencies tree
- * Input parameters are in Initializer:
- *  all (true: all dependencies, false: just missing)
- *  fill(false: count dependencies, true: fill dependencies array
- */
-static void CC bstProcess(BSTNode* n, void* data) {
-    RefNode* elm = (RefNode*) n;
-    Initializer* obj = (Initializer*) data;
-    bool go = false;
-
-    assert(elm && obj);
-
- /* remore reference && refseq table not found */
-    if (obj->all) {
-        go = true;
-    }
-    else if (!elm->local) {
-        if (OLD) {
-            if (elm->resolved.ref[0] == '\0') {
-                go = true;
-            }
-        }
-        else {
-            if (elm->resolved.local == NULL) {
-                go = true;
-            }
-        }
-    }
-
-    if (!go) {
-        return;
-    }
-
-    if (!obj->fill) {
-        ++obj->count;
-    }
-    else {
-        if (obj->dep == NULL || obj->dep->dependencies == NULL) {
-            return;
-        }
-        if (obj->i < obj->count) {
-            *(obj->dep->dependencies + ((obj->i)++)) = elm;
-        }
-        else {
-            obj->rc = RC(rcVDB, rcDatabase, rcAccessing, rcSelf, rcCorrupt);
-        }
-    }
-}
-
-/* Read REFERENCE table; fill in BSTree */
-static
-rc_t CC VDatabaseDependencies(const VDatabase *self, BSTree* tr,
-    bool* has_no_REFERENCE, bool* hasDuplicates, bool disableCaching)
-{
-    rc_t rc = 0;
-
-    int64_t i = 0;
-    int64_t firstId = 0;
-    int64_t lastId = 0;
-
-    Column CIRCULAR = { 0, "CIRCULAR", 1,  8 };
-    Column CMP_READ = { 0, "CMP_READ", 0,  8 };
-    Column NAME     = { 0, "NAME"    , 0,  8 };
-    Column READ_LEN = { 0, "READ_LEN", 1, 32 };
-    Column SEQ_ID   = { 0, "SEQ_ID",   0,  8 };
-
-    const VTable* tbl = NULL;
-    const VCursor* curs = NULL;
-
-    int cacheState = -1;
-
-    Ctx ctx;
-
-    assert(self && tr && has_no_REFERENCE);
-
-    *has_no_REFERENCE = false;
-
-    if (rc == 0) {
-        rc = CtxInit(&ctx, self);
-    }
-
-    if (rc == 0 && disableCaching) {
-        cacheState = VResolverCacheEnable(ctx.resolver, vrAlwaysDisable);
-    }
-
-
-    if (rc == 0) {
-        rc = VDatabaseOpenTableRead(self, &tbl, "REFERENCE");
-        if (GetRCState(rc) == rcNotFound) {
-            *has_no_REFERENCE = true;
-        }
-    }
-    if (rc == 0) {
-        rc = VTableCreateCursorReadInternal(tbl, &curs);
-    }
-
-    rc = AddColumn(rc, curs, &CIRCULAR);
-    rc = AddColumn(rc, curs, &CMP_READ);
-    rc = AddColumn(rc, curs, &NAME    );
-    rc = AddColumn(rc, curs, &READ_LEN);
-    rc = AddColumn(rc, curs, &SEQ_ID  );
-
-    if (rc == 0) {
-        rc = VCursorOpen(curs);
-    }
-    if (rc == 0) {
-        uint64_t count = 0;
-        rc = VCursorIdRange(curs, 0, &firstId, &count);
-        lastId = firstId + count - 1;
-    }
-
-    for (i = firstId; i <= lastId && rc == 0; ++i) {
-        uint32_t row_len = 0;
-        Row data;
-        if (rc == 0) {
-            rc = CursorRead(rc, curs, i, &CIRCULAR,
-                data.circular, sizeof data.circular, &row_len);
-            if (rc != 0) {
-                PLOGERR(klogErr, (klogErr, rc,
-                    "failed to read cursor(col='CIRCULAR', spot='$(id)')",
-                    "id=%ld", i));
-            }
-        }
-        if (rc == 0) {
-            rc = CursorRead(rc, curs, i, &CMP_READ,
-                NULL, 0, &data.row_lenCMP_READ);
-            if (rc != 0) {
-                PLOGERR(klogErr, (klogErr, rc,
-                    "failed to read cursor(col='CMP_READ', spot='$(id)')",
-                    "id=%ld", i));
-            }
-        }
-        if (rc == 0) {
-            rc = CursorRead(rc, curs, i, &NAME,
-                data.name, sizeof data.name, &row_len);
-            if (rc != 0) {
-                PLOGERR(klogErr, (klogErr, rc,
-                    "failed to read cursor(col='NAME', spot='$(id)')",
-                    "id=%ld", i));
-            }
-        }
-        if (rc == 0) {
-            rc = CursorRead(rc, curs, i, &READ_LEN,
-                &data.readLen, sizeof data.readLen, &row_len);
-            if (rc != 0) {
-                PLOGERR(klogErr, (klogErr, rc,
-                    "failed to read cursor(col='READ_LEN', spot='$(id)')",
-                    "id=%ld", i));
-            }
-        }
-        if (rc == 0) {
-            rc = CursorRead(rc, curs, i, &SEQ_ID,
-                data.seqId, sizeof data.seqId, &row_len);
-            if (rc != 0) {
-                PLOGERR(klogErr, (klogErr, rc,
-                    "failed to read cursor(col='SEQ_ID', spot='$(id)')",
-                    "id=%ld", i));
-            }
-        }
-        if (rc == 0) {
-            rc = AddRow(tr, &data, &ctx, cacheState);
-        }
-    }
-
-    if (rc == 0 && hasDuplicates != NULL) {
-        *hasDuplicates = ctx.hasDuplicates;
-    }
-
-    if (*has_no_REFERENCE) {
-        rc = 0;
-    }
-
-    if (cacheState != -1) {
-        VResolverCacheEnable(ctx.resolver, cacheState);
-    }
-
-    {
-        rc_t rc2 = CtxDestroy(&ctx);
-        if (rc == 0 && rc2 != 0) {
-            rc = rc2;
-        }
-    }
-
-    RELEASE(VCursor, curs);
-    RELEASE(VTable, tbl);
-
-    return rc;
-}
-
-/* Get dependency number "idx" */
-static
-rc_t VDBDependenciesGet(const VDBDependencies* self,
-    RefNode** dep, uint32_t idx)
-{
-    rc_t rc = 0;
-
-    assert(dep);
-
-    if (self == NULL) {
-        return RC(rcVDB, rcDatabase, rcAccessing, rcSelf, rcNull);
-    }
-
-    if (idx >= self->count) {
-        return RC(rcVDB, rcDatabase, rcAccessing, rcParam, rcExcessive);
-    }
-
-    *dep = *(self->dependencies + idx);
-    if (*dep == NULL) {
-        return RC(rcVDB, rcDatabase, rcAccessing, rcSelf, rcCorrupt);
-    }
-
-    return rc;
-}
-
-/* Count
- *  retrieve the number of dependencies
- *
- *  "count" [ OUT ] - return parameter for dependencies count
- */
-LIB_EXPORT rc_t CC VDBDependenciesCount(const VDBDependencies* self,
-    uint32_t* count)
-{
-    if (self == NULL) {
-        return RC(rcVDB, rcDatabase, rcAccessing, rcSelf, rcNull);
-    }
-
-    if (count == NULL) {
-        return RC(rcVDB, rcDatabase, rcAccessing, rcParam, rcNull);
-    }
-
-    *count = self->count;
-
-    return 0;
-}
-
-/* Circular */
-LIB_EXPORT rc_t CC VDBDependenciesCircular(const VDBDependencies* self,
-    bool* circular, uint32_t idx)
-{
-    rc_t rc = 0;
-    RefNode* dep = NULL;
-
-    if (circular == NULL) {
-        return RC(rcVDB, rcDatabase, rcAccessing, rcParam, rcNull);
-    }
-
-    rc = VDBDependenciesGet(self, &dep, idx);
-
-    if (rc == 0) {
-        *circular = dep->circular;
-    }
-
-    return rc;
-}
-
-/* Local
- *  retrieve local property
- *
- *  "local" [ OUT ] - true if object is stored internally
- *
- *  "idx" [ IN ] - zero-based index of dependency
- */
-LIB_EXPORT rc_t CC VDBDependenciesLocal(const VDBDependencies* self,
-    bool* local, uint32_t idx)
-{
-    rc_t rc = 0;
-    RefNode* dep = NULL;
-
-    if (local == NULL) {
-        return RC(rcVDB, rcDatabase, rcAccessing, rcParam, rcNull);
-    }
-
-    rc = VDBDependenciesGet(self, &dep, idx);
-
-    if (rc == 0) {
-        *local = dep->local;
-    }
-
-    return rc;
-}
-
-/* Name
- *
- * "name" [ OUT ] - returned pointed should not be released.
- *                  it becomes invalid after VDBDependenciesRelease
- */
-LIB_EXPORT rc_t CC VDBDependenciesName(const VDBDependencies* self,
-    const char** name, uint32_t idx)
-{
-    rc_t rc = 0;
-    RefNode* dep = NULL;
-
-    if (name == NULL) {
-        return RC(rcVDB, rcDatabase, rcAccessing, rcParam, rcNull);
-    }
-
-    rc = VDBDependenciesGet(self, &dep, idx);
-
-    if (rc == 0) {
-        *name = dep->name;
-    }
-
-    return rc;
-}
-
-static rc_t VDBDependencyGetPath(const String* from, const char** to) {
-    assert(to);
-
-    *to = NULL;
-
-    if (OLD) {
-        return 0;
-    }
-
-    if (from == NULL) {
-        return 0;
-    }
-
-    if (from->addr != NULL && from->size > 0 &&
-        from->addr[from->size - 1] != '\0' &&
-        from->addr[from->size] != '\0')
-    {
-        return RC(rcVDB, rcString, rcValidating, rcChar, rcInvalid);
-    }
-
-    *to = from->addr;
-    return 0;
-}
-
-/* Path
- *  for remote dependencies: returns:
- *                              path for resolved dependency,
- *                              NULL for missing dependency.
- *  returns NULL for local dependencies
- *
- * "path" [ OUT ] - returned pointed should not be released.
- *                  it becomes invalid after VDBDependenciesRelease
- */
-LIB_EXPORT rc_t CC VDBDependenciesPath(const VDBDependencies* self,
-    const char** path, uint32_t idx)
-{
-    rc_t rc = 0;
-    RefNode* dep = NULL;
-
-    if (path == NULL) {
-        return RC(rcVDB, rcDatabase, rcAccessing, rcParam, rcNull);
-    }
-
-    rc = VDBDependenciesGet(self, &dep, idx);
-
-    if (rc == 0) {
-        if (dep->local) {
-            *path = NULL;
-        }
-        else {
-            if (OLD) {
-                *path = dep->resolved.ref;
-            }
-            else {
-                rc = VDBDependencyGetPath(dep->resolved.local, path);
-            }
-        }
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VDBDependenciesPathRemote(const VDBDependencies* self,
-    const char** path, uint32_t idx)
-{
-    rc_t rc = 0;
-    RefNode* dep = NULL;
-
-    if (path == NULL) {
-        return RC(rcVDB, rcDatabase, rcAccessing, rcParam, rcNull);
-    }
-
-    rc = VDBDependenciesGet(self, &dep, idx);
-
-    if (rc == 0) {
-        rc = VDBDependencyGetPath(dep->resolved.remote, path);
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VDBDependenciesPathCache(const VDBDependencies* self,
-    const char** path, uint32_t idx)
-{
-    rc_t rc = 0;
-    RefNode* dep = NULL;
-
-    if (path == NULL) {
-        return RC(rcVDB, rcDatabase, rcAccessing, rcParam, rcNull);
-    }
-
-    rc = VDBDependenciesGet(self, &dep, idx);
-
-    if (rc == 0) {
-        rc = VDBDependencyGetPath(dep->resolved.cache, path);
-    }
-
-    return rc;
-}
-
-/* SeqId
- *
- * "seq_id" [ OUT ] - returned pointed should not be released.
- *                    it becomes invalid after VDBDependenciesRelease
- */
-LIB_EXPORT rc_t CC VDBDependenciesSeqId(const VDBDependencies* self,
-    const char** seq_id, uint32_t idx)
-{
-    rc_t rc = 0;
-    RefNode* dep = NULL;
-
-    if (seq_id == NULL) {
-        return RC(rcVDB, rcDatabase, rcAccessing, rcParam, rcNull);
-    }
-
-    rc = VDBDependenciesGet(self, &dep, idx);
-
-    if (rc == 0) {
-        *seq_id = dep->seqId;
-    }
-
-    return rc;
-}
-
-/* Type
- *
- * "type" [ OUT ] - a KDBPathType from kdb/manager.h
- */
-LIB_EXPORT rc_t CC VDBDependenciesType(const VDBDependencies* self,
-    uint32_t* type, uint32_t idx)
-{
-    rc_t rc = 0;
-    RefNode* dep = NULL;
-
-    if (type == NULL) {
-        return RC(rcVDB, rcDatabase, rcAccessing, rcParam, rcNull);
-    }
-
-    rc = VDBDependenciesGet(self, &dep, idx);
-
-    if (rc == 0) {
-        *type = kptTable;
-    }
-
-    return rc;
-}
-
-#define CLSNAME "VDBDependencies"
-
-VDB_EXTERN rc_t CC VDBDependenciesAddRef(const VDBDependencies* self ) {
-    if (self != NULL) {
-        switch (KRefcountAdd(&self->refcount, CLSNAME)) {
-            case krefLimit:
-                return RC(rcVDB, rcDatabase, rcAttaching, rcRange, rcExcessive);
-        }
-    }
-
-    return 0;
-}
-
-static rc_t VDBDependenciesWhack(VDBDependencies* self) {
-    if (self == NULL) {
-        return 0;
-    }
-
-    KRefcountWhack(&self->refcount, CLSNAME);
-
-    BSTreeWhack(self->tr, bstWhack, NULL);
-    free(self->tr);
-
-    free(self->dependencies);
-
-    memset(self, 0, sizeof *self);
-
-    free(self);
-
-    return 0;
-}
-
-/* Release
- *  (objects ARE NOT reference counted)
- *  ignores NULL references
- */
-LIB_EXPORT rc_t CC VDBDependenciesRelease(const VDBDependencies* self) {
-    if (self != NULL) {
-        switch (KRefcountDrop(&self->refcount, CLSNAME)) {
-        case krefWhack:
-            return VDBDependenciesWhack((VDBDependencies*)self);
-        case krefNegative:
-            return RC(rcVDB, rcDatabase, rcReleasing, rcRange, rcExcessive);
-        }
-    }
-
-    return 0;
-}
-
-typedef struct {
-    BSTree* tr;
-    int count;
-    bool all;
-} SBstCopy;
-static void CC bstCopy(BSTNode* n, void* data) {
-    RefNode* sn = NULL;
-    RefNode* elm = (RefNode*) n;
-    SBstCopy* x = (SBstCopy*)data;
-    BSTree* tr = x->tr;
-    bool go = false;
-    assert(elm && tr);
-
-    if (x->all) {
-        go = true;
-    } else if (!elm->local) {
-        assert(!OLD);
-        if (elm->resolved.local == NULL) {
-            go = true;
-        }
-    }
-
-    if (!go) {
-        return;
-    }
-
-    sn = (RefNode*) BSTreeFind(tr, elm->resolved.remote, bstCmpByRemote);
-    if (sn == NULL) {
-        sn = calloc(1, sizeof *sn);
-        if (sn == NULL) {
-/* TODO: generate error message */
-            return;
-        }
-
-        sn->seqId = string_dup_measure(elm->seqId, NULL);
-        if (sn->seqId == NULL) {
-            bstWhack((BSTNode*) sn, NULL);
-            return;
-        }
-
-        sn->name = string_dup_measure(elm->name, NULL);
-        if (sn->name == NULL) {
-            bstWhack((BSTNode*) sn, NULL);
-            return;
-        }
-
-        sn->circular = elm->circular;
-        sn->readLen = elm->readLen;
-        sn->local = elm->local;
-
-        sn->resolved.count = 1;
-
-        sn->resolved.local = elm->resolved.local;
-        elm->resolved.local = NULL;
-
-        sn->resolved.remote = elm->resolved.remote;
-        elm->resolved.remote = NULL;
-
-        sn->resolved.cache = elm->resolved.cache;
-        elm->resolved.cache = NULL;
-
-        BSTreeInsert(tr, (BSTNode*)sn, bstSortByRemote);
-        ++x->count;
-    }
-    else {
-        bool archived = false;
-        if (sn->resolved.rc != 0) {
-            return;
-        }
-        else if (sn->circular != elm->circular) {
-            sn->resolved.rc
-                = RC(rcVDB, rcNumeral, rcComparing, rcData, rcInvalid);
-        }
-        else if ((sn->name == NULL && elm->name != NULL)
-            || (sn->name != NULL && elm->name == NULL))
-        {
-            sn->resolved.rc
-                = RC(rcVDB, rcString, rcComparing, rcData, rcInvalid);
-        }
-        else if (strcmp(sn->name, elm->name) != 0) {
-            if (strncmp(sn->name, elm->name, 6) == 0) {
-                archived = true;
-            }
-            else {
-                sn->resolved.rc
-                    = RC(rcVDB, rcString, rcComparing, rcData, rcInvalid);
-            }
-        }
-
-        if (sn->resolved.rc != 0) {
-        }
-        else if (sn->readLen != elm->readLen && !archived) {
-            sn->resolved.rc
-                = RC(rcVDB, rcNumeral, rcComparing, rcData, rcInvalid);
-        }
-        else if (sn->seqId == NULL || elm->seqId == NULL) {
-            sn->resolved.rc
-                = RC(rcVDB, rcString, rcComparing, rcData, rcInvalid);
-        }
-        else if (sn->local != elm->local) {
-            sn->resolved.rc
-                = RC(rcVDB, rcNumeral, rcComparing, rcData, rcInvalid);
-        }
-        else if (sn->resolved.ref[0] != '\0' || elm->resolved.ref[0] != '\0') {
-            sn->resolved.rc
-                = RC(rcVDB, rcString, rcComparing, rcData, rcInvalid);
-        }
-        else if (sn->resolved.local != NULL || elm->resolved.local != NULL) {
-            sn->resolved.rc
-                = RC(rcVDB, rcString, rcComparing, rcData, rcInvalid);
-        }
-        else if (StringCompare(sn->resolved.remote, elm->resolved.remote) != 0)
-        {
-            int min = sn->resolved.remote->size < elm->resolved.remote->size
-                ? sn->resolved.remote->size : elm->resolved.remote->size;
-            if (!archived || strncmp(sn->resolved.remote->addr,
-                                elm->resolved.remote->addr, min) != 0)
-            {
-                sn->resolved.rc
-                    = RC(rcVDB, rcString, rcComparing, rcData, rcInvalid);
-            }
-        }
-
-        if (sn->resolved.rc != 0) {
-        }
-        else if (StringCompare(sn->resolved.cache, elm->resolved.cache) != 0)
-        {
-            sn->resolved.rc
-                = RC(rcVDB, rcString, rcComparing, rcData, rcInvalid);
-        }
-        else {
-            if (archived) {
-                int i = 0;
-                bool tail = false;
-                for (;;++i) {
-                    char* c1 = &sn->seqId[i];
-                    const char c2 = elm->seqId[i];
-                    if (*c1 == '\0') {
-                        break;
-                    }
-                    if (!tail && (c2 == '\0' || *c1 != c2)) {
-                        tail = true;
-                    }
-                    if (tail) {
-     /* incorrect:
-        we keep at least one seqid for archived refseqs to be able to resolve them
-                        *c1 = '.'; */
-                    }
-                }
-            }
-            ++sn->resolved.count;
-        }
-    }
-}
-
-/* ListDependencies
- *  create a dependencies object: list all dependencies
- *
- *  "dep" [ OUT ] - return for VDBDependencies object
- *
- *  "missing" [ IN ] - if true, list only missing dependencies
- *  otherwise, list all dependencies
- *
- * N.B. If missing == true then
- *     just one refseq dependency will be returned for 'container' Refseq files.
- */
-static rc_t VDatabaseListDependenciesImpl(const VDatabase* self,
-    const VDBDependencies** dep, bool missing, bool disableCaching)
-{
-    rc_t rc = 0;
-    VDBDependencies* obj = NULL;
-    bool all = ! missing;
-    bool has_no_REFERENCE = false;
-    bool hasDuplicates = false;
-
-    if (self == NULL) {
-        return RC(rcVDB, rcDatabase, rcAccessing, rcSelf, rcNull);
-    }
-    if (dep == NULL) {
-        return RC(rcVDB, rcDatabase, rcAccessing, rcParam, rcNull);
-    }
-
-    obj = calloc(1, sizeof *obj);
-    if (obj == NULL) {
-        return RC(rcVDB, rcStorage, rcAllocating, rcMemory, rcExhausted);
-    }
-
-    obj->tr = malloc(sizeof *obj->tr);
-    if (obj->tr == NULL) {
-        free(obj);
-        return RC(rcVDB, rcStorage, rcAllocating, rcMemory, rcExhausted);
-    }
-    BSTreeInit(obj->tr);
-
-    /* initialize dependencie tree */
-    rc = VDatabaseDependencies(self, obj->tr,
-        &has_no_REFERENCE, &hasDuplicates, disableCaching);
-    if (rc == 0 && has_no_REFERENCE) {
-        KRefcountInit(&obj->refcount, 1, CLSNAME, "make", "nodep");
-        *dep = obj;
-        return rc;
-    }
-
-    if (rc == 0) {
-        Initializer init;
-        memset(&init, 0, sizeof init);
-
-        /* count all/missing dependencies */
-        init.all = all;
-        init.fill = false;
-        BSTreeForEach(obj->tr, false, bstProcess, &init);
-     /* now init.count = number of (all == true ? 'all' : 'missed') references*/
-
-        rc = init.rc;
-        if (rc == 0) {
-            obj->count = init.count;
-        }
-
-        if (rc == 0 && missing && hasDuplicates) {
-            /* references have duplicates. e.g. AAAB01... */
-            SBstCopy x;
-            BSTree* tr = malloc(sizeof *tr);
-            if (tr == NULL) {
-                rc = RC(rcVDB, rcStorage, rcAllocating, rcMemory, rcExhausted);
-                return rc;
-            }
-            BSTreeInit(tr);
-            x.count = 0;
-            x.tr = tr;
-            x.all = all;
-
-         /* compact obj->tr into tr, skip duplicates
-            x.count is the number of all references from obj.tr */
-            BSTreeForEach(obj->tr, false, bstCopy, &x);
-            BSTreeWhack(obj->tr, bstWhack, NULL);
-            free(obj->tr);
-            obj->tr = tr;
-            obj->count = init.count = x.count;
-        }
-
-        if (rc == 0) {
-            /* initialize dependencies array with pointers to tree values */
-            if (obj->count > 0) {
-                obj->dependencies
-                    = calloc(obj->count, sizeof obj->dependencies);
-                if (obj->dependencies == NULL) {
-                    free(obj);
-                    return RC
-                        (rcVDB, rcStorage, rcAllocating, rcMemory, rcExhausted);
-                }
-                init.fill = true;
-                init.dep = obj;
-                BSTreeForEach(obj->tr, false, bstProcess, &init);
-                rc = init.rc;
-                if (rc == 0 && init.i != init.count) {
-                    rc = RC(rcVDB, rcDatabase, rcAccessing, rcSelf, rcCorrupt);
-                }
-            }
-        }
-    }
-
-    if (rc == 0) {
-        KRefcountInit(&obj->refcount, 1, CLSNAME, "make", "dep");
-        *dep = obj;
-    }
-    else {
-        VDBDependenciesRelease(obj);
-    }
-
-    return rc;
-}
-
-
-/* ListDependencies
- *  create a dependencies object: list all dependencies
- *
- *  "dep" [ OUT ] - return for VDBDependencies object
- *
- *  "missing" [ IN ] - if true, list only missing dependencies
- *  otherwise, list all dependencies
- *
- * N.B. If missing == true then
- *     just one refseq dependency will be returned for 'container' Refseq files.
- */
-LIB_EXPORT rc_t CC VDatabaseListDependencies(const VDatabase* self,
-    const VDBDependencies** dep, bool missing)
-{
-    return VDatabaseListDependenciesImpl(self, dep, missing, false);
-}
-
-
-/* ListDependenciesWithCaching
- *  create dependencies object: list dependencies
- *
- *  Call VResolverCacheEnable(cacheState) before reading VDatabase.
- *  It allows to control cache update inside the function.
- *
- *  "dep" [ OUT ] - return for VDBDependencies object
- *
- *  "missing" [ IN ] - if true, list only missing dependencies
- *  otherwise, list all dependencies
- *
- *  "disableCaching" [ IN ] - if true, disable caching inside of the function
- *  otherwise, do not change the caching state
- */
-LIB_EXPORT rc_t CC VDatabaseListDependenciesWithCaching (
-    struct VDatabase const *self,
-    const VDBDependencies **dep, bool missing,
-    bool disableCaching )
-{
-    return VDatabaseListDependenciesImpl(self, dep, missing, disableCaching);
-}
-
-
-static bool DependenciesError(rc_t rc) {
-    return GetRCModule(rc) == rcAlign && GetRCObject(rc) == rcTable
-          && GetRCState(rc) == rcNotFound;
-}
-
-typedef enum ErrType {
-    eUnknown,
-    eNoEncInKfg,
-    ePwdFileNotFound,
-    eBadPwdFile,
-    eBadEncKey
-} ErrType;
-static ErrType DependenciesType(rc_t rc) {
-    if (GetRCTarget(rc) == rcEncryptionKey)
-    {
-        switch (GetRCSTATE(rc))
-        {
-            /* no configuration or environment */
-        case RC_STATE(rcFile, rcUnknown):
-            return eNoEncInKfg;
-
-            /* no file where told to look */
-        case RC_STATE(rcFile, rcNotFound):
-            return ePwdFileNotFound;
-
-            /* after decryption the file wasn't a database object */
-        case RC_STATE(rcEncryption, rcIncorrect):
-            return eBadEncKey;
-
-        default:
-            break;
-        }
-    }
-    else if (GetRCTarget(rc) == rcMgr)
-    {
-        switch (GetRCSTATE(rc))
-        {
-        case RC_STATE(rcEncryptionKey, rcTooShort): /* too short */
-        case RC_STATE(rcEncryptionKey, rcTooLong): /* too long */
-            return eBadPwdFile;
-
-        default:
-            break;
-        }
-    }
-    return eUnknown;
-}
-
-LIB_EXPORT bool CC UIError( rc_t rc,
-    const VDatabase* db, const VTable* table)
-{
-    bool retval = false;
-    if( db != NULL || table != NULL ) {
-      if( DependenciesError(rc) ) {
-        if( db != NULL ) {
-            VDatabaseAddRef(db);
-        } else if( VTableOpenParentRead(table, &db) != 0 ) {
-            db = NULL;
-        }
-        if( db != NULL ) {
-            const VTable* ref;
-            if( VDatabaseOpenTableRead(db, &ref, "REFERENCE") == 0 ) {
-                const VCursor* c;
-                if( VTableCreateCachedCursorRead(ref, &c, 0) == 0 ) {
-                    uint32_t i;
-                    retval = VCursorAddColumn(c, &i, "CIRCULAR") == 0
-                        && VCursorOpen(c) == 0;
-                    VCursorRelease(c);
-                }
-                VTableRelease(ref);
-            }
-            VDatabaseRelease(db);
-        }
-      }
-    }
-    else if (db == NULL && table == NULL) {
-        ErrType type = DependenciesType(rc);
-        if (type != eUnknown) {
-            retval = true;
-        }
-    }
-    return retval;
-}
-
-static
-void CC VDBDependenciesLOGMissing( rc_t rc,
-    const VDatabase* db, bool log_list )
-{
-    static bool once = false;
-    if( !once ) {
-      KWrtHandler handler;
-
-      once = true;
-
-      handler.writer = KOutWriterGet();
-      handler.data = KOutDataGet();
-      KOutHandlerSetStdErr();
-
-      if (DependenciesError(rc)) {
-        OUTMSG(("This operation requires access to external"
-            " reference sequence(s) that could not be located\n"));
-        if (db && log_list) {
-            const VDBDependencies* dep = NULL;
-            uint32_t i, count = 0;
-            if( VDatabaseListDependencies(db, &dep, true) == 0 &&
-                VDBDependenciesCount(dep, &count) == 0 ) {
-                for(i = 0; i < count; i++) {
-                    const char* name = NULL, *seqId = NULL;
-                    if (VDBDependenciesName(dep, &name, i) == 0
-                            && VDBDependenciesSeqId(dep, &seqId, i) == 0)
-                    {
-                        OUTMSG(("Reference sequence %s %s was not found\n",
-                                seqId, name));
-                    }
-                }
-                VDBDependenciesRelease(dep);
-            }
-        }
-        OUTMSG((
-              "Please run \"perl configuration-assistant.perl\" and try again\n"
-            ));
-      }
-      else {
-        switch (DependenciesType(rc)) {
-            case eNoEncInKfg:
-                OUTMSG((
-"The file you are trying to open is encrypted,\n"
-"but no decryption password could be located.\n"
-"To set up a password,\n"
-"run the 'configuration-assistant.perl' script provided with the toolkit.\n"));
-                break;
-            case ePwdFileNotFound:
-                OUTMSG((
-"The file you are trying to open is encrypted,\n"
-"but no decryption password could be obtained\n"
-"from the path given in configuration.\n"
-"To set up or change a password,\n"
-"run the 'configuration-assistant.perl' script provided with the toolkit.\n"));
-                break;
-            case eBadEncKey:
-                OUTMSG((
-"The file you are trying to open is encrypted, but could not be opened.\n"
-"Either your password is incorrect or the downloaded file is corrupt.\n"
-"To set up or change a password,\n"
-"run the 'configuration-assistant.perl' script provided with the toolkit.\n"
-"To test the file for corruption,\n"
-"run the 'nencvalid' tool provided with the toolkit.\n"));
-                break;
-        case eBadPwdFile:
-                OUTMSG((
-"The file you are trying to open is encrypted, but could not be opened.\n"
-"The password in the password file in unusable either from being 0 bytes\n"
-"or more than 4096 bytes long. The password starts at the beginning of\n"
-"the file and ends with the first CR (\\r) pr LF (\\n) or at the end of\n"
-"the file.\n"
-"To set up or change a password,\n"
-"run the 'configuration-assistant.perl' script provided with the toolkit.\n"));
-                break;
-            default:
-                assert(0);
-        }
-      }
-
-      OUTMSG(("\n"));
-      KOutHandlerSet(handler.writer, handler.data);
-    }
-}
-
-LIB_EXPORT const char* CC UIDatabaseGetErrorString(rc_t rc)
-{
-    if (DependenciesError(rc)) {
-        return "This operation requires access to external"
-            " reference sequence(s) that could not be located";
-    }
-    else {
-        switch (DependenciesType(rc)) {
-            case eNoEncInKfg:
-                return "The file is encrypted, "
-                    "but no decryption password could be located";
-            case ePwdFileNotFound:
-                return "The file is encrypted, "
-                    "but no decryption password could be obtained "
-                    "from the path given in configuration";
-            case eBadEncKey:
-                return "The file is encrypted, but could not be opened. "
-                    "Either the password is incorrect or the file is corrupt";
-            case eBadPwdFile:
-                return "The file is encrypted, but could not be opened. "
-                    "The password in the password file in unusable";
-            default:
-                assert(0);
-                return "Unexpected Dependency Type";
-        }
-    }
-}
-
-LIB_EXPORT void CC UIDatabaseLOGError( rc_t rc,
-    const VDatabase* db, bool log_list )
-{
-    VDBDependenciesLOGMissing(rc, db, log_list);
-}
-
-LIB_EXPORT void CC UITableLOGError( rc_t rc,
-    const VTable* table, bool log_list )
-{
-    const VDatabase* db;
-    if( table == NULL ) {
-        VDBDependenciesLOGMissing(rc, NULL, log_list);
-    }
-    else if( VTableOpenParentRead(table, &db) == 0 && db != NULL ) {
-        VDBDependenciesLOGMissing(rc, db, log_list);
-        VDatabaseRelease(db);
-    }
-}
diff --git a/libs/vdb/database-load.c b/libs/vdb/database-load.c
deleted file mode 100644
index c36975e..0000000
--- a/libs/vdb/database-load.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#define KONST const
-#define SKONST
-
-#include "database-priv.h"
-#include "dbmgr-priv.h"
-#include "schema-parse.h"
-
-#undef KONST
-#undef SKONST
-
-#include "schema-priv.h"
-#include "linker-priv.h"
-
-#include <vdb/manager.h>
-#include <vdb/database.h>
-#include <kdb/manager.h>
-#include <kdb/database.h>
-#include <kdb/meta.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * VDatabase
- *  opaque connection to a database within file system
- */
-
-
-/* LoadSchema
- */
-
-rc_t VDatabaseLoadSchema ( VDatabase *self )
-{
-    /* try to get schema text */
-    const KMDataNode *node;
-    rc_t rc = KMetadataOpenNodeRead ( self -> meta, & node, "schema" );
-    if ( rc == 0 )
-    {
-        /* the node is probably within our 4K buffer,
-           but by using the callback mechanism we don't
-           have buffer or allocation issues. */
-        KMDataNodeSchemaFillData pb;
-        pb . node = node;
-        pb . pos = 0;
-        pb . add_v0 = false;
-
-        /* add in schema text. it is not mandatory, but it is
-           the design of the system to store object schema with
-           the object so that it is capable of standing alone */
-        rc = VSchemaParseTextCallback ( self -> schema,
-            "VDatabaseLoadSchema", KMDataNodeFillSchema, & pb );
-        if ( rc == 0 )
-        {
-            /* determine database type */
-            rc = KMDataNodeReadAttr ( node, "name",
-                pb . buff, sizeof pb . buff, & pb . pos );
-            if ( rc == 0 )
-            {
-                uint32_t type;
-                const SNameOverload *name;
-
-                /* find the sdb if possible */
-                self -> sdb = VSchemaFind ( self -> schema,
-                    & name, & type, pb . buff, "VDatabaseLoadSchema", false );
-
-                /* the schema must be found in this case */
-                if ( self -> sdb == NULL || type != eDatabase )
-                {
-                    self -> sdb = NULL;
-                    rc = RC ( rcVDB, rcDatabase, rcLoading, rcSchema, rcCorrupt );
-                    PLOGERR ( klogInt, ( klogInt, rc, "failed to establish database type from '$(expr)'",
-                                         "expr=%s", pb . buff ));
-                }
-            }
-        }
-
-        KMDataNodeRelease ( node );
-    }
-    else if ( GetRCState ( rc ) == rcNotFound )
-    {
-        /* the database may be under creation */
-        if ( ! self -> read_only )
-            rc = 0;
-    }
-
-    return rc;
-}
diff --git a/libs/vdb/database-priv.h b/libs/vdb/database-priv.h
deleted file mode 100644
index e3e9c88..0000000
--- a/libs/vdb/database-priv.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_database_priv_
-#define _h_database_priv_
-
-#ifndef _h_vdb_extern_
-#include <vdb/extern.h>
-#endif
-
-#ifndef _h_vdb_database_
-#include <vdb/database.h>
-#endif
-
-#ifndef _h_klib_container_
-#include <klib/container.h>
-#endif
-
-#ifndef _h_klib_refcount_
-#include <klib/refcount.h>
-#endif
-
-#ifndef KONST
-#define KONST
-#endif
-
-#ifndef SKONST
-#define SKONST const
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct VSchema;
-struct KDatabase;
-struct SDatabase;
-struct KMetadata;
-struct VDBManager;
-
-/*--------------------------------------------------------------------------
- * VDatabase
- *  interface to physical database
- */
-struct VDatabase
-{
-    /* creating manager */
-    struct VDBManager KONST *mgr;
-
-    /* enclosing database - NULL OKAY */
-    KONST VDatabase *dad;
-
-    /* schema and db description */
-    struct VSchema SKONST *schema;
-    struct SDatabase const *sdb;
-
-    /* underlying physical layer database */
-    struct KDatabase KONST *kdb;
-
-    /* open database metadata */
-    struct KMetadata KONST *meta;
-
-    /* user data */
-    void *user;
-    void ( CC * user_whack ) ( void *data );
-#if 0
-    /* externally visible names */
-    BSTree scope;
-#endif
-    /* page size for creating columns */
-    size_t pgsize;
-
-    /* open references */
-    KRefcount refcount;
-
-    /* create and checksum modes for columns */
-    uint8_t cmode;
-    uint8_t checksum;
-
-    /* open mode */
-    bool read_only;
-};
-
-
-/* Whack
- */
-rc_t CC VDatabaseWhack ( VDatabase *self );
-
-
-/* Attach
- * Sever
- *  internal reference management
- */
-VDatabase *VDatabaseAttach ( const VDatabase *self );
-rc_t VDatabaseSever ( const VDatabase *self );
-
-
-/* Make
- *  creates an initialized database object
- *  expects either a mgr or a parent db,
- *  enforces schema validity according to some rules,
- */
-rc_t VDatabaseMake ( VDatabase **db,
-    struct VDBManager const *mgr,
-    const VDatabase *dad,
-    struct VSchema const *schema );
-
-
-/* LoadSchema
- *  looks in metadata for stored schema
- */
-rc_t VDatabaseLoadSchema ( VDatabase *self );
-
-/* StoreSchema
- *  stores schema definition in metadata
- */
-rc_t VDatabaseStoreSchema ( VDatabase *self );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_database_priv_ */
diff --git a/libs/vdb/database.c b/libs/vdb/database.c
deleted file mode 100644
index 1e52034..0000000
--- a/libs/vdb/database.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#define KONST const
-#include "database-priv.h"
-#undef KONST
diff --git a/libs/vdb/dbmgr-cmn.c b/libs/vdb/dbmgr-cmn.c
deleted file mode 100644
index 41ac831..0000000
--- a/libs/vdb/dbmgr-cmn.c
+++ /dev/null
@@ -1,825 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#define TRACK_REFERENCES 0
-/* should match dbmgr.c and/or wdbmgr.c */
-
-#define KONST const
-#include "dbmgr-priv.h"
-#undef KONST
-
-#include "schema-priv.h"
-#include "linker-priv.h"
-
-#include <vdb/manager.h>
-#include <vdb/database.h>
-#include <vdb/table.h>
-#include <vdb/vdb-priv.h>
-#include <kdb/manager.h>
-#include <kdb/database.h>
-#include <kdb/table.h>
-#include <kdb/meta.h>
-#include <kfg/config.h>
-#include <kfs/directory.h>
-#include <kfs/dyload.h>
-#include <klib/log.h>
-#include <klib/text.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-#if 1
-#define DEBUG_PRINT( fmt, ... ) ( void ) 0
-#else
-#define DEBUG_PRINT(fmt, ...) fprintf(stderr, "%s - " fmt "\n", __func__, __VA_ARGS__)
-#endif
-
-/*--------------------------------------------------------------------------
- * VDBManager
- *  opaque handle to library
- */
-
-/* Whack
- */
-static
-rc_t VDBManagerWhack ( VDBManager *self )
-{
-    rc_t rc;
-
-    KRefcountWhack ( & self -> refcount, "VDBManager" );
-
-    rc = KDBManagerRelease ( self -> kmgr );
-    if ( rc == 0 )
-    {
-        /* release user data */
-        if ( self -> user != NULL && self -> user_whack != NULL )
-        {
-            ( * self -> user_whack ) ( self -> user );
-            self -> user = NULL;
-            self -> user_whack = NULL;
-        }
-
-        VSchemaRelease ( self -> schema );
-        VLinkerRelease ( self -> linker );
-        free ( self );
-        return 0;
-    }
-
-    KRefcountInit ( & self -> refcount, 1, "VDBManager", "whack", "vmgr" );
-    return rc;
-}
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-LIB_EXPORT rc_t CC VDBManagerAddRef ( const VDBManager *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "VDBManager" ) )
-        {
-        case krefLimit:
-            return RC ( rcVDB, rcMgr, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC VDBManagerRelease ( const VDBManager *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "VDBManager" ) )
-        {
-        case krefWhack:
-            return VDBManagerWhack ( ( VDBManager* ) self );
-        case krefNegative:
-            return RC ( rcVDB, rcMgr, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-/* Attach
- * Sever
- *  internal reference management
- */
-VDBManager *VDBManagerAttach ( const VDBManager *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAddDep ( & self -> refcount, "VDBManager" ) )
-        {
-        case krefLimit:
-            return NULL;
-        }
-    }
-    return ( VDBManager* ) self;
-}
-
-rc_t VDBManagerSever ( const VDBManager *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDropDep ( & self -> refcount, "VDBManager" ) )
-        {
-        case krefWhack:
-            return VDBManagerWhack ( ( VDBManager* ) self );
-        case krefNegative:
-            return RC ( rcVDB, rcMgr, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/* Writable
- *  returns 0 if object is writable
- *  or a reason why if not
- *
- *  "path" [ IN ] - NUL terminated path
- */
-LIB_EXPORT rc_t CC VDBManagerVWritable ( const VDBManager *self, const char *path, va_list args )
-{
-    if ( self == NULL )
-        return RC ( rcVDB, rcMgr, rcAccessing, rcSelf, rcNull );
-    return KDBManagerVWritable ( self -> kmgr, path, args );
-}
-
-LIB_EXPORT rc_t CC VDBManagerWritable ( const VDBManager *self, const char *path, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, path );
-
-    rc = VDBManagerVWritable ( self, path, args );
-
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* AddSchemaIncludePath
- *  add an include path to schema for locating input files
- */
-LIB_EXPORT rc_t CC VDBManagerVAddSchemaIncludePath ( const VDBManager *self, const char *path, va_list args )
-{
-    if ( self != NULL )
-        return VSchemaVAddIncludePath ( self -> schema, path, args );
-
-    return RC ( rcVDB, rcMgr, rcUpdating, rcSelf, rcNull );
-}
-
-LIB_EXPORT rc_t CC VDBManagerAddSchemaIncludePath ( const VDBManager *self, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = VDBManagerVAddSchemaIncludePath ( self, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* AddLoadLibraryPath
- *  add a path[s] to loader for locating dynamic libraries
- */
-LIB_EXPORT rc_t CC VDBManagerVAddLoadLibraryPath ( const VDBManager *self, const char *path, va_list args )
-{
-    if ( self != NULL )
-        return VLinkerVAddLoadLibraryPath ( self -> linker, path, args );
-
-    return RC ( rcVDB, rcMgr, rcUpdating, rcSelf, rcNull );
-}
-
-LIB_EXPORT rc_t CC VDBManagerAddLoadLibraryPath ( const VDBManager *self, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = VDBManagerVAddLoadLibraryPath ( self, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* ConfigFromKfg
- */
-static
-rc_t VDBManagerGetKfgPath ( const KConfig *kfg, const char *path, char *value, size_t value_size, size_t *num_read )
-{
-    /* open node */
-    const KConfigNode *node;
-    rc_t rc = KConfigOpenNodeRead ( kfg, & node, path );
-    if ( rc == 0 )
-    {
-        size_t remaining;
-        rc = KConfigNodeRead ( node, 0, value, value_size, num_read, & remaining );
-        if ( rc == 0 )
-        {
-            if ( remaining != 0 )
-                rc = RC ( rcVDB, rcMgr, rcConstructing, rcPath, rcExcessive );
-            else if ( string_chr ( value, * num_read, '%' ) != NULL )
-                rc = RC ( rcVDB, rcMgr, rcConstructing, rcPath, rcInvalid );
-        }
-
-        KConfigNodeRelease ( node );
-    }
-    return rc;
-}
-
-static
-rc_t VDBManagerConfigFromKfg ( VDBManager *self, bool update )
-{
-    size_t num_read;
-    char full [ 4096 ];
-
-    /* open configuration manager */
-    KConfig *kfg;
-    rc_t rc = KConfigMake ( & kfg, NULL );
-    if ( rc != 0 )
-        rc = 0;
-    else
-    {
-        /* look for load library paths */
-        rc = VDBManagerGetKfgPath ( kfg, update ?
-            "vdb/wmodule/paths": "vdb/module/paths",
-            full, sizeof full, & num_read );
-        if ( rc != 0 )
-            rc = 0;
-        else
-        {
-            /* split by ':' */
-            const char * path = full;
-            const char *colon = string_chr ( full, num_read, ':' );
-            while ( colon != NULL )
-            {
-                /* add path between "path" and "colon" */
-                rc = VDBManagerAddLoadLibraryPath ( self, "%.*s", ( int ) ( colon - path ), path );
-                if ( rc != 0 )
-                    break;
-                num_read -= ( colon - path ) - 1;
-                path = colon + 1;
-                colon = string_chr ( path, num_read, ':' );
-            }
-
-            /* add in last portion */
-            if ( rc == 0 && num_read != 0 )
-                rc = VDBManagerAddLoadLibraryPath ( self, "%.*s", ( int ) ( num_read ), path );
-        }
-
-        /* look for schema paths */
-        if ( rc == 0 )
-            rc = VDBManagerGetKfgPath ( kfg, "vdb/schema/paths", full, sizeof full, & num_read );
-        if ( rc != 0 )
-            rc = 0;
-        else
-        {
-            /* split by ':' */
-            const char * path = full;
-            const char *colon = string_chr ( full, num_read, ':' );
-            while ( colon != NULL )
-            {
-                /* add path between "path" and "colon" */
-                rc = VDBManagerAddSchemaIncludePath ( self, "%.*s", ( int ) ( colon - path ), path );
-                if ( rc != 0 )
-                {
-                    PLOGERR ( klogWarn, ( klogWarn, rc, "schema path '$(path)' was rejected",
-                                          "path=%.*s", ( int ) ( colon - path ), path ) );
-                    rc = 0;
-                }
-                num_read -= colon - path + 1;
-                path = colon + 1;
-                colon = string_chr ( path, num_read, ':' );
-            }
-
-            /* add in last portion */
-            if ( rc == 0 && num_read != 0 )
-            {
-                rc = VDBManagerAddSchemaIncludePath ( self, "%.*s", ( int ) ( num_read ), path );
-                if ( rc != 0 )
-                {
-                    PLOGERR ( klogWarn, ( klogWarn, rc, "schema path '$(path)' was rejected",
-                                          "path=%.*s", ( int ) num_read, path ) );
-                    rc = 0;
-                }
-            }
-        }
-
-        KConfigRelease ( kfg );
-    }
-
-    return rc;
-}
-
-/* ConfigFromLibPath
- *  trace this library back to file system
- *  attempt to locate relative paths
- *  add them to library and schema path lists
- */
-static
-rc_t VDBManagerConfigFromLibPath ( VDBManager *self, bool update )
-{
-    KDyld *dlmgr;
-    rc_t rc = KDyldMake ( & dlmgr );
-    if ( rc == 0 )
-    {
-        const KDirectory *home;
-        rc = KDyldHomeDirectory ( dlmgr, & home, ( fptr_t ) VDBManagerConfigPaths );
-        if ( rc == 0 )
-        {
-            char full [ 4096 ];
-
-            /* paths to modules */
-            const char *mod_paths [] =
-            {
-                "ncbi/mod",
-                "vdb/mod",
-                "../mod"
-            };
-            const char *wmod_paths [] =
-            {
-                "ncbi/wmod",
-                "vdb/wmod",
-                "../wmod"
-            };
-
-            /* paths to schema */
-            const char *schema_paths [] =
-            {
-                "ncbi/schema",
-                "vdb/schema",
-                "../schema"
-            };
-
-            /* test for a few possible module paths */
-            uint32_t i;
-            const char **paths = update ? wmod_paths : mod_paths;
-            for ( i = 0; rc == 0 && i < sizeof mod_paths / sizeof mod_paths [ 0 ]; ++ i )
-            {
-                uint32_t type = KDirectoryPathType ( home, "%s%u", paths [ i ], sizeof ( void* ) * 8 );
-                if ( ( type & ~ kptAlias ) == kptDir )
-                {
-                    /* add full path */
-                    rc = KDirectoryResolvePath ( home, true, full, sizeof full, "%s%u", paths [ i ], sizeof ( void* ) * 8 );
-                    if ( rc == 0 )
-                        rc = VDBManagerAddLoadLibraryPath ( self, full );
-                }
-            }
-
-            for ( i = 0; rc == 0 && i < sizeof mod_paths / sizeof mod_paths [ 0 ]; ++ i )
-            {
-                uint32_t type = KDirectoryPathType ( home, paths [ i ] );
-                if ( ( type & ~ kptAlias ) == kptDir )
-                {
-                    /* add full path */
-                    rc = KDirectoryResolvePath ( home, true, full, sizeof full, paths [ i ] );
-                    if ( rc == 0 )
-                        rc = VDBManagerAddLoadLibraryPath ( self, full );
-                }
-            }
-
-            for ( i = 0; rc == 0 && i < sizeof schema_paths / sizeof schema_paths [ 0 ]; ++ i )
-            {
-                uint32_t type = KDirectoryPathType ( home, schema_paths [ i ] );
-                if ( ( type & ~ kptAlias ) == kptDir )
-                {
-                    /* add full path */
-                    rc = KDirectoryResolvePath ( home, true, full, sizeof full, schema_paths [ i ] );
-                    if ( rc == 0 )
-                        rc = VDBManagerAddSchemaIncludePath ( self, full );
-                }
-            }
-
-            KDirectoryRelease ( home );
-        }
-
-        KDyldRelease ( dlmgr );
-    }
-    return rc;
-}
-
-/* ConfigPaths
- *  looks for configuration information to set
- *  include paths for schema parser and
- *  load paths for linker
- */
-rc_t VDBManagerConfigPaths ( VDBManager *self, bool update )
-{
-    rc_t rc = VDBManagerConfigFromKfg ( self, update );
-    if ( rc == 0 )
-        rc = VDBManagerConfigFromLibPath ( self, update );
-    return rc;
-}
-
-
-/* GetUserData
- * SetUserData
- *  store/retrieve an opaque pointer to user data
- */
-LIB_EXPORT rc_t CC VDBManagerGetUserData ( const VDBManager *self, void **data )
-{
-    rc_t rc;
-
-    if ( data == NULL )
-        rc = RC ( rcVDB, rcMgr, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcMgr, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            * data = self -> user;
-            return 0;
-        }
-
-        * data = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VDBManagerSetUserData ( const VDBManager *cself,
-    void *data, void ( CC * destroy ) ( void *data ) )
-{
-    VDBManager *self = ( VDBManager* ) cself;
-    if ( cself == NULL )
-        return RC ( rcVDB, rcMgr, rcUpdating, rcSelf, rcNull );
-
-    self -> user = data;
-    self -> user_whack = destroy;
-
-    return 0;
-}
-
-/* OpenKDBManager
- *  returns a new reference to KDBManager used by VDBManager
- */
-LIB_EXPORT rc_t CC VDBManagerOpenKDBManagerRead ( const VDBManager *self, const KDBManager **kmgr )
-{
-    rc_t rc;
-
-    if ( kmgr == NULL )
-        rc = RC ( rcVDB, rcMgr, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcMgr, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = KDBManagerAddRef ( self -> kmgr );
-            if ( rc == 0 )
-            {
-                * kmgr = self -> kmgr;
-                return 0;
-            }
-        }
-
-        * kmgr = NULL;
-    }
-
-    return rc;
-}
-
-
-static
-ver_t VDBManagerGetLoaderVersFromMeta ( const KMetadata * meta )
-{
-    const KMDataNode *node = NULL;
-    rc_t rc = KMetadataOpenNodeRead ( meta, & node, "SOFTWARE/loader" );
-    KMDataNodeRelease ( node );
-    if ( rc == 0 )
-    {
-        size_t num_read;
-        char vers_string [ 64 ];
-        rc = KMDataNodeReadAttr ( node, "vers", vers_string, sizeof vers_string, & num_read );
-        if ( rc == 0 )
-        {
-            char *end, *start = vers_string;
-            unsigned long maj = strtoul ( start, & end, 10 );
-
-            KMDataNodeRelease ( node );
-
-            if ( end > start && end [ 0 ] == '.' )
-            {
-                unsigned long min = strtoul ( start = end + 1, & end, 10 );
-                if ( end > start && end [ 0 ] == '.' )
-                {
-                    unsigned long rel = strtoul ( start = end + 1, & end, 10 );
-                    if ( end > start )
-                        return ( maj << 24 ) | ( min << 16 ) | rel;
-                }
-            }
-        }
-    }
-    return 0;
-}
-
-
-/* VDBManagerGetVersFromMeta
- *  helper-function for VDBManagerGetObjVersion
- */
-static
-ver_t VDBManagerGetVersFromMeta ( const KMetadata * meta, bool is_db )
-{
-    rc_t rc = 0;
-    uint32_t meta_vers;
-    const KMDataNode *node;
-
-    /* look for loader version as first clue */
-    ver_t version = VDBManagerGetLoaderVersFromMeta ( meta );
-    if ( VersionGetMajor ( version ) >= 2 ) {
-        return version;
-    }
-
-    /* was the run vdb-copied? */
-    rc = KMetadataOpenNodeRead ( meta, & node, "SOFTWARE/update" );
-    if ( rc == 0 ) {
-        KMDataNodeRelease ( node );
-        return 0x2000000;
-    }
-
-    /* If SOFTWARE/loader/@vers exists but SOFTWARE/update does not
-     * then return the former */
-    if ( version != 0 ) {
-        return version;
-    }
-
-    /* THE PRINCIPAL DESCRIPTION OF SOFTWARE VERSION
-       WAS NOT FOUND. USE HEURISTICS TO DETERMINE VERSION
-       FROM THIS POINT FORWARD. */
-
-    /* look at the version of the metadata file itself
-       metdata version 1 means pre-vdb, i.e. v0 */
-    rc = KMetadataVersion ( meta, & meta_vers );
-    if ( rc == 0 && meta_vers < 2 )
-        return 0;
-
-    /* assume all databases are v2 */
-    if ( is_db )
-        return 0x2000000;
-
-
-    /* AT THIS POINT, WE KNOW WE MUST HAVE A TABLE,
-       BUT WE DON'T HAVE PERFECT EVIDENCE OF VERSION,
-       SINCE THE SOFTWARE NODE IS NOT MANDATORY. */
-
-    /* if "schema" exists, it's v2 */
-    rc = KMetadataOpenNodeRead ( meta, & node, "schema" );
-    if ( rc == 0 )
-    {
-        KMDataNodeRelease ( node );
-        return 0x2000000;
-    }
-
-    /* if "col" exists, it's v1 */
-    rc = KMetadataOpenNodeRead ( meta, &node, "col" );
-    if ( rc == 0 )
-    {
-        KMDataNodeRelease ( node );
-        return 0x1000000;
-    }
-
-    /* appears to be v0 */
-    return 0;
-}
-
-
-/* VDBManagerGetObjVersion
- *  returns the vdb-version of the given object
- */
-LIB_EXPORT rc_t CC VDBManagerGetObjVersion ( const VDBManager *self, ver_t * version, const char *path )
-{
-    rc_t rc;
-
-    if ( version == NULL )
-        rc = RC ( rcVDB, rcMgr, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcMgr, rcAccessing, rcSelf, rcNull );
-        else if ( path == NULL )
-            rc = RC ( rcVDB, rcMgr, rcAccessing, rcPath, rcNull );
-        else if ( path [ 0 ] == 0 )
-            rc = RC ( rcVDB, rcMgr, rcAccessing, rcPath, rcEmpty );
-        else
-        {
-            const KTable *tbl;
-            const KDatabase *db;
-            const KMetadata *meta;
-
-            int path_type = KDBManagerPathType ( self -> kmgr, path ) & ~ kptAlias;
-            switch ( path_type )
-            {
-            case kptDatabase:
-                rc = KDBManagerOpenDBRead ( self -> kmgr, & db, path );
-                if ( rc == 0 )
-                {
-                    rc = KDatabaseOpenMetadataRead ( db, & meta );
-                    KDatabaseRelease ( db );
-                }
-                break;
-            case kptTable:
-                rc = KDBManagerOpenTableRead ( self -> kmgr, & tbl, path );
-                if ( rc == 0 )
-                {
-                    rc = KTableOpenMetadataRead ( tbl, & meta );
-                    KTableRelease ( tbl );
-                }
-                break;
-
-            case kptPrereleaseTbl:
-                * version = 0;
-                return 0;
-
-            default:
-                rc = RC ( rcVDB, rcMgr, rcAccessing, rcPath, rcIncorrect );
-            }
-
-            if ( rc == 0 )
-            {
-                * version = VDBManagerGetVersFromMeta ( meta, path_type == kptDatabase );
-                KMetadataRelease ( meta );
-                return 0;
-            }
-        }
-
-        * version = 0;
-    }
-
-    return rc;
-}
-
-/* VDBManagerGetObjModDate
- *  returns the load/modification timestamp of the given object
- */
-LIB_EXPORT rc_t CC VDBManagerGetObjModDate ( const VDBManager *self, KTime_t *timestamp, const char *path )
-{
-    rc_t rc;
-
-    if ( timestamp == NULL )
-        rc = RC ( rcVDB, rcMgr, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcMgr, rcAccessing, rcSelf, rcNull );
-        else if ( path == NULL )
-            rc = RC ( rcVDB, rcMgr, rcAccessing, rcPath, rcNull );
-        else if ( path [ 0 ] == 0 )
-            rc = RC ( rcVDB, rcMgr, rcAccessing, rcPath, rcEmpty );
-        else
-        {
-            const KTable *tbl;
-            const KDatabase *db;
-            const KMetadata *meta;
-
-            int path_type = KDBManagerPathType ( self -> kmgr, path ) & ~ kptAlias;
-            switch ( path_type )
-            {
-            case kptDatabase:
-                rc = KDBManagerOpenDBRead ( self -> kmgr, & db, path );
-                if ( rc == 0 )
-                {
-                    rc = KDatabaseOpenMetadataRead ( db, & meta );
-                    KDatabaseRelease ( db );
-                }
-                break;
-            case kptTable:
-                rc = KDBManagerOpenTableRead ( self -> kmgr, & tbl, path );
-                if ( rc == 0 )
-                {
-                    rc = KTableOpenMetadataRead ( tbl, & meta );
-                    KTableRelease ( tbl );
-                }
-                break;
-
-            case kptPrereleaseTbl:
-                * timestamp = 0;
-                meta = NULL;
-                break;
-
-            default:
-                rc = RC ( rcVDB, rcMgr, rcAccessing, rcPath, rcIncorrect );
-            }
-
-            if ( rc == 0 )
-            {
-                if ( meta != NULL )
-                {
-                    const KMDataNode *node;
-                    rc = KMetadataOpenNodeRead ( meta, & node, "LOAD/timestamp" );
-                    KMetadataRelease ( meta );
-                    if ( rc == 0 )
-                    {
-                        rc = KMDataNodeReadAsI64 ( node, timestamp );
-                        KMDataNodeRelease ( node );
-                        if ( rc == 0 )
-                            return 0;
-                    }
-                }
-
-                /* TBD - at this point our recourse is to check for
-                   the object's timestamp in the filesystem */
-            }
-        }
-
-        * timestamp = 0;
-    }
-
-    return rc;
-}
-
-/* ListExternalSchemaModules
- */
-LIB_EXPORT rc_t CC VDBManagerListExternalSchemaModules ( const VDBManager *self, KNamelist **listp )
-{
-    rc_t rc;
-
-    if ( listp == NULL )
-        rc = RC ( rcVDB, rcMgr, rcListing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcMgr, rcListing, rcSelf, rcNull );
-        else
-        {
-            rc = VLinkerListExternalSchemaModules ( self -> linker, listp );
-            if ( rc == 0 )
-                return 0;
-        }
-
-        * listp = NULL;
-    }
-
-    return rc;
-}
-
-
-/* PathType
- *  check the path type of an object/directory path.
- *
- *  this is an extension of the KDirectoryPathType ( see <kdb/manager.h> )
- *  and will return the KDirectory values if a path type is not specifically
- *  a VDB or KDB object.
- */
-LIB_EXPORT int CC VDBManagerPathType ( const VDBManager * self,
-    const char *path, ... )
-{
-    int type;
-
-    va_list args;
-    va_start ( args, path );
-
-    type = VDBManagerVPathType ( self, path, args );
-
-    va_end ( args );
-
-    return type;
-}
-
-LIB_EXPORT int CC VDBManagerVPathType ( const VDBManager * self,
-    const char *path, va_list args )
-{
-    if ( self != NULL )
-        return KDBManagerVPathType ( self -> kmgr, path, args );
-
-    return kptBadPath;
-}
diff --git a/libs/vdb/dbmgr-priv.h b/libs/vdb/dbmgr-priv.h
deleted file mode 100644
index aa1b36b..0000000
--- a/libs/vdb/dbmgr-priv.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_dbmgr_priv_
-#define _h_dbmgr_priv_
-
-#ifndef _h_vdb_extern_
-#include <vdb/extern.h>
-#endif
-
-#ifndef _h_vdb_manager_
-#include <vdb/manager.h>
-#endif
-
-#ifndef _h_klib_container_
-#include <klib/container.h>
-#endif
-
-#ifndef _h_klib_refcount_
-#include <klib/refcount.h>
-#endif
-
-#ifndef KONST
-#define KONST
-#endif
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KDBManager;
-struct VSchema;
-struct VLinker;
-
-
-/*--------------------------------------------------------------------------
- * VDBManager
- *  handle to library
- */
-struct VDBManager
-{
-    /* underlying physical layer manager */
-    struct KDBManager KONST *kmgr;
-
-    /* intrinsic schema elements */
-    struct VSchema *schema;
-
-    /* intrinsic functions */
-    struct VLinker *linker;
-
-    /* user data */
-    void *user;
-    void ( CC * user_whack ) ( void *data );
-
-    /* open references */
-    KRefcount refcount;
-};
-
-/* Attach
- * Sever
- *  internal reference management
- */
-VDBManager *VDBManagerAttach ( const VDBManager *self );
-rc_t VDBManagerSever ( const VDBManager *self );
-
-
-/* ConfigPaths
- *  looks for configuration information to set
- *  include paths for schema parser and
- *  load paths for linker
- */
-rc_t VDBManagerConfigPaths ( VDBManager *self, bool update );
-
-
-/*--------------------------------------------------------------------------
- * generic whackers
- */
-void CC VectMbrWhack ( void *item, void *ignore );
-void CC BSTreeMbrWhack ( BSTNode *n, void *ignore );
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_dbmgr_priv_ */
diff --git a/libs/vdb/dbmgr.c b/libs/vdb/dbmgr.c
deleted file mode 100644
index 3ad07a1..0000000
--- a/libs/vdb/dbmgr.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#define TRACK_REFERENCES 0
-/* should match dbmgr-cmn.c */
-
-#include "libvdb.vers.h"
-
-#define KONST const
-#include "dbmgr-priv.h"
-#undef KONST
-
-#include "schema-priv.h"
-#include "linker-priv.h"
-
-#include <vdb/manager.h>
-#include <vdb/schema.h>
-#include <kdb/kdb-priv.h> /* KDBManagerMakeReadWithVFSManager */
-#include <kdb/manager.h>
-#include <kfs/directory.h>
-#include <klib/text.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <assert.h>
-
-/*--------------------------------------------------------------------------
- * VDBManager
- *  opaque handle to library
- */
-
-
-/* MakeRead
- * MakeReadWithVFSManager
- *  create library handle for specific use
- *  NB - only one of the functions will be implemented
- *
- *  "wd" [ IN, NULL OKAY ] - optional working directory for
- *  accessing the file system. mgr will attach its own reference.
- */
-LIB_EXPORT rc_t CC VDBManagerMakeRead ( const VDBManager **mgrp, const KDirectory *wd )
-{
-    return VDBManagerMakeReadWithVFSManager(mgrp, wd, NULL);
-}
-
-LIB_EXPORT rc_t CC VDBManagerMakeReadWithVFSManager ( const VDBManager **mgrp,
-    const KDirectory *wd, struct VFSManager *vmgr )
-{
-    rc_t rc;
-
-    if ( mgrp == NULL )
-        rc = RC ( rcVDB, rcMgr, rcConstructing, rcParam, rcNull );
-    else
-    {
-        VDBManager *mgr = malloc ( sizeof * mgr );
-        if ( mgr == NULL )
-            rc = RC ( rcVDB, rcMgr, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            rc = KDBManagerMakeReadWithVFSManager ( & mgr -> kmgr, wd, vmgr );
-            if ( rc == 0 )
-            {
-                rc = VSchemaMakeIntrinsic ( & mgr -> schema );
-                if ( rc == 0 )
-                {
-                    rc = VLinkerMakeIntrinsic ( & mgr -> linker );
-                    if ( rc == 0 )
-                    {
-                        rc = VDBManagerConfigPaths ( mgr, false );
-                        if ( rc == 0 )
-                        {
-                            mgr -> user = NULL;
-                            mgr -> user_whack = NULL;
-                            KRefcountInit ( & mgr -> refcount, 1, "VDBManager", "make-read", "vmgr" );
-                            * mgrp = mgr;
-                            return 0;
-                        }
-
-                        VLinkerRelease ( mgr -> linker );
-                    }
-
-                    VSchemaRelease ( mgr -> schema );
-                }
-
-                KDBManagerRelease ( mgr -> kmgr );
-            }
-
-            free ( mgr );
-        }
-
-        * mgrp = NULL;
-    }
-    return rc;
-}
-
-
-/* Version
- *  returns the library version
- */
-LIB_EXPORT rc_t CC VDBManagerVersion ( const VDBManager *self, uint32_t *version )
-{
-    if ( version == NULL )
-        return RC ( rcVDB, rcMgr, rcAccessing, rcParam, rcNull );
-    if ( self == NULL )
-        return RC ( rcVDB, rcMgr, rcAccessing, rcSelf, rcNull );
-
-    * version = LIBVDB_VERS;
-    return 0;
-}
-
-
-/* RunPeriodicTasks
- *  executes periodic tasks, such as cache flushing
- */
-LIB_EXPORT rc_t CC VDBManagerRunPeriodicTasks ( const VDBManager *self )
-{
-    if ( self != NULL )
-        return KDBManagerRunPeriodicTasks ( self -> kmgr );
-
-    return RC ( rcVDB, rcMgr, rcExecuting, rcSelf, rcNull );
-}
diff --git a/libs/vdb/delta_average.c b/libs/vdb/delta_average.c
deleted file mode 100644
index 2afd8e5..0000000
--- a/libs/vdb/delta_average.c
+++ /dev/null
@@ -1,297 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#include <vdb/xform.h>
-#include <klib/rc.h>
-
-#include "xform-priv.h"
-#include "blob-priv.h"
-#include "blob-headers.h"
-#include "blob.h"
-#include "page-map.h"
-
-#include <sysalloc.h>
-
-#include <assert.h>
-#include <stdlib.h>
-
-
-/* Create
- *
- * Create a new blob.  A new data buffer is sized to
- * 'element_count' * sizeof datatype; its contents are
- * uninitialized.
- */
-static
-rc_t VBlobCreateEncode ( VBlob **blobp, const VBlob *in, uint32_t max_rl_bytes,uint8_t *avg, uint32_t elem_bytes )
-{
-    rc_t rc = VBlobNew ( blobp, in -> start_id, in -> stop_id, "delta_average" );
-    if ( rc == 0 )
-    {
-        VBlob *blob = * blobp;
-        rc = PageMapAddRef ( in -> pm );
-	if(rc == 0) {
-		blob->pm = in -> pm ;
-		if(max_rl_bytes > 0){
-			rc = KDataBufferMake ( & blob -> data, in -> data . elem_bits, in -> data . elem_count );
-		} else {
-			rc = KDataBufferSub(&in->data, &blob->data, 0, UINT64_MAX);
-		}
-		if ( rc == 0 ){
-			rc = BlobHeadersCreateChild(in->headers, &blob->headers);
-			if ( rc == 0) {
-				VBlobHeader *hdr = BlobHeadersGetHdrWrite(blob->headers);
-				assert(hdr!=NULL);
-				if(hdr != 0){
-					int i;
-					VBlobHeaderSetVersion (hdr, 1);
-					rc = VBlobHeaderArgPushTail(hdr, max_rl_bytes);
-					assert(rc == 0);
-					rc = VBlobHeaderArgPushTail(hdr, elem_bytes);
-                                        assert(rc == 0);
-					for(i=0; i< max_rl_bytes; i++){
-						rc = VBlobHeaderOpPushTail(hdr,avg[i]);
-						assert(rc==0);
-					}
-					blob -> byte_order = in -> byte_order;
-					VBlobHeaderRelease(hdr);
-					return 0;
-				}
-			}
-		}
-		PageMapRelease( blob->pm);
-        }
-	VBlobRelease ( blob );
-        * blobp = NULL;
-    }
-    return rc;
-}
-
-static
-rc_t VBlobCreateDecode ( VBlob **blobp, const VBlob *in, uint32_t *max_rl_bytes,uint8_t **avg, uint32_t *elem_bytes)
-{
-    rc_t rc = VBlobNew ( blobp, in -> start_id, in -> stop_id, "undelta_average" );
-    if ( rc == 0 )
-    {
-        VBlob *blob = * blobp;
-        rc = PageMapAddRef ( in -> pm );
-	if(rc == 0) {
-		VBlobHeader *hdr;
-		blob->pm = in -> pm ;
-                blob->headers = (BlobHeaders *)BlobHeadersGetNextFrame(in->headers);
-		BlobHeadersAddRef(blob->headers);
-		hdr = BlobHeadersGetHeader(in->headers);
-		if(hdr || VBlobHeaderVersion(hdr)!=1) {
-			int64_t len;
-			int64_t eb;
-			rc = VBlobHeaderArgPopHead(hdr, &len);
-			if( rc == 0)
-				rc = VBlobHeaderArgPopHead(hdr, &eb);
-			if( rc == 0){
-				*max_rl_bytes=len;
-				*elem_bytes = eb;
-				if(len > 0){
-					rc = KDataBufferMake ( & blob -> data, in -> data . elem_bits, in -> data . elem_count );
-					if ( rc == 0){
-						*avg=malloc(len);
-						if(*avg){
-							int i;
-							for(i=0;i<len && rc == 0;i++){
-								rc = VBlobHeaderOpPopHead(hdr,(*avg)+i);
-							}
-							if(rc == 0){
-								VBlobHeaderRelease(hdr);
-								return 0;
-							} else {
-								rc =  RC(rcVDB, rcFunction, rcExecuting, rcHeader, rcCorrupt) ;
-							}
-						} else {
-							rc =  RC(rcVDB, rcFunction, rcExecuting, rcMemory, rcExhausted) ;
-						}
-					}
-				} else {
-					rc = KDataBufferSub(&in->data, &blob->data, 0, UINT64_MAX);
-					if(rc == 0){
-						VBlobHeaderRelease(hdr);
-						return 0;
-					}
-				}
-				VBlobHeaderRelease(hdr);
-			} else {
-				rc =  RC(rcVDB, rcFunction, rcExecuting, rcHeader, rcCorrupt) ;
-			}
-		} else {
-			rc =  RC(rcVDB, rcFunction, rcExecuting, rcHeader, rcCorrupt) ;
-		}
-		PageMapRelease( blob->pm);
-        }
-	VBlobRelease ( blob );
-        * blobp = NULL;
-    }
-    return rc;
-}
-
-static
-rc_t CC undelta_average ( void *self, const VXformInfo *info, int64_t row_id,
-    VBlob **rslt, uint32_t argc, const VBlob *argv [] )
-{
-    uint32_t  max_rl_bytes = 0;
-    uint8_t   *avg = NULL;
-    uint32_t elem_bytes = 0;
-    /* input blob - schema assures us that it is ready to go */
-    const VBlob *in = argv [ 0 ];
-  /* allocate output blob of same size */
-    rc_t rc = VBlobCreateDecode ( rslt, in,&max_rl_bytes,&avg,&elem_bytes );
-    if(rc == 0 && max_rl_bytes > 0){
-	uint8_t *dst = (*rslt)->data.base; /** destination pointer **/
-	uint8_t *src = in -> data.base;
-	int	i,j,k;
-	PageMap *pm  = in->pm;
-
-	for(i=j=0,src = in -> data.base;i<pm->leng_recs;i++){
-                row_count_t leng_run=pm->leng_run[i];
-                elem_count_t len = pm->length[i];
-                assert(len<=max_rl_bytes);
-                while(leng_run > 0){
-                        for(k=0;k<len*elem_bytes;k++,src++,dst++){
-                                dst[0] = avg[k] - src[0]; /** symmetrical to encode **/
-                        }
-                        assert(leng_run >= (pm->data_run?pm->data_run[j]:1));
-                        leng_run -= pm->data_run?pm->data_run[j]:1;
-			j++;
-                }
-        }
-
-    }
-    if(avg) free(avg);
-    return rc;
-}
-
-VTRANSFACT_BUILTIN_IMPL ( vdb_undelta_average, 1, 0, 0 )
-    ( const void *self, const VXfactInfo *info, VFuncDesc *rslt,
-      const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    VFUNCDESC_INTERNAL_FUNCS ( rslt ) -> bfN = undelta_average;
-    rslt -> variant = vftBlobN;
-    return 0;
-}
-
-static
-rc_t CC delta_average ( void *self, const VXformInfo *info, int64_t row_id,
-    VBlob **rslt, uint32_t argc, const VBlob *argv [] )
-{
-    rc_t rc;
-    /* input blob - schema assures us that it is ready to go */
-    const VBlob *in = argv [ 0 ];
-    const PageMap *pm = in->pm; 
-    uint8_t     *src;
-    elem_count_t   min_row_len,max_row_len;
-    uint64_t	min_rl_bytes,max_rl_bytes;
-    uint32_t    *cnts;
-    uint32_t    elem_bytes;
-    int         i,j,k;
-    uint8_t	*avg=NULL;
-    uint64_t    sum_rle;
-    uint8_t	last;
-
-    if(pm->row_count < 256 || (in->data.elem_bits & 7)!=0){
-	return VBlobCreateEncode ( rslt, in, 0,NULL,0 );
-    }
-    elem_bytes = in->data.elem_bits >> 3;
-    PageMapRowLengthRange(pm,&min_row_len,&max_row_len);
-    if(max_row_len > 1024){
-	return VBlobCreateEncode ( rslt, in, 0,NULL,0 );
-    }
-    /*** rescale to bytes **/
-    min_rl_bytes = (min_row_len * in->data.elem_bits) >> 3;
-    max_rl_bytes = (max_row_len * in->data.elem_bits) >> 3;
-
-    cnts=calloc(sizeof(*cnts),256*max_rl_bytes); /** computing counts of values **/
-    avg=malloc(max_rl_bytes);
-
-    /** collect sums and averages ***/
-    /** using tight loop instead of iterators **/
-    for(i=j=0,src = in -> data.base, sum_rle=0,last=0;i<pm->leng_recs;i++){
-	row_count_t leng_run=pm->leng_run[i];
-	elem_count_t len = pm->length[i];
-	assert(len<=max_rl_bytes);
-	while(leng_run > 0){
-		for(k=0;k<len*elem_bytes;k++,src++){
-			if(last==src[0]) sum_rle++;
-			cnts[256*k+src[0]]++;
-			last=src[0];
-		}
-		assert(leng_run >= (pm->data_run?pm->data_run[j]:1));
-		leng_run -= pm->data_run?pm->data_run[j]:1;
-		j++;
-	}
-    }
-    if(sum_rle * 10 > elem_bytes * in->data.elem_count * 3){/** total number of repetitions is high - leave it for zlib RLE ***/
-        free(cnts);
-        free(avg);
-        return VBlobCreateEncode(rslt,in,0,NULL,0);
-    }
-
-    for(i=0;i<max_rl_bytes;i++){
-	avg[i] = 0;
-	for(j=1;j<256;j++){
-		if(cnts[256*i+j] > cnts[256*i+avg[i]]){
-			avg[i]=j; 
-		}
-	}
-    }
-    rc = VBlobCreateEncode ( rslt, in, max_rl_bytes,avg,elem_bytes );
-    if (rc == 0 ){
-	uint8_t *dst = (*rslt)->data.base; /** destination pointer **/
-	for(i=j=0,src = in -> data.base;i<pm->leng_recs;i++){
-		row_count_t leng_run=pm->leng_run[i];
-		elem_count_t len = pm->length[i];
-		assert(len<=max_rl_bytes);
-		while(leng_run > 0){
-			for(k=0;k < len*elem_bytes;k++,src++,dst++){
-				dst[0] = avg[k] - src[0]; /** will do it in this direction **/
-			}
-			assert(leng_run >= (pm->data_run?pm->data_run[j]:1));
-			leng_run -= pm->data_run?pm->data_run[j]:1;
-			j++;
-		}
-	}
-     }
-    if(cnts) free(cnts);
-    if(avg)  free(avg);
-    return rc;
-}
-
-VTRANSFACT_BUILTIN_IMPL ( vdb_delta_average, 1, 0, 0 )
-    ( const void *self, const VXfactInfo *info, VFuncDesc *rslt,
-      const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    VFUNCDESC_INTERNAL_FUNCS ( rslt ) -> bfN = delta_average;
-    rslt -> variant = vftBlobN;
-    return 0;
-}
diff --git a/libs/vdb/environment-read.c b/libs/vdb/environment-read.c
deleted file mode 100644
index 6809da2..0000000
--- a/libs/vdb/environment-read.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/table.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <vdb/vdb-priv.h>
-#include <sysalloc.h>
-
-#include "xform-priv.h"
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-static
-rc_t CC environment_read_func(
-                         void *Self,
-                         const VXformInfo *info,
-                         int64_t row_id,
-                         VRowResult *rslt,
-                         uint32_t argc,
-                         const VRowData argv[]
-) {
-    const KDataBuffer *value = Self;
-    rc_t rc = 0;
-    
-    rslt->data->elem_bits = value->elem_bits;
-    rslt->data->elem_count = 0;
-    rc = KDataBufferResize(rslt->data, value->elem_count);
-    if (rc == 0) {
-        memcpy(rslt->data->base, value->base, KDataBufferBytes(value));
-        rc = KDataBufferCast(rslt->data, rslt->data, rslt->elem_bits, true);
-        if (rc == 0)
-            rslt->elem_count = rslt->data->elem_count;
-    }
-    return rc;
-}
-
-static rc_t CC get_databuffer( KDataBuffer **rslt, const char *Name, size_t len ) {
-    char name[4096];
-    char *x;
-    rc_t rc;
-    
-    if (len >= sizeof(name))
-        return RC(rcVDB, rcFunction, rcConstructing, rcName, rcTooLong);
-    
-    memcpy(name, Name, len);
-    name[len] = '\0';
-    
-    x = getenv(name);
-    rc = KDataBufferMake( *rslt, 8, (uint32_t)( len = strlen( x ) ) );
-    if (rc)
-        return rc;
-    memcpy((**rslt).base, x, len);
-    return 0;
-}
-
-/* 
- function utf8 environment:read #1.0 < ascii name > ();
- */
-VTRANSFACT_BUILTIN_IMPL(environment_read, 1, 0, 0)
-    (const void *Self, const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp
-) {
-    rc_t rc;
-    KDataBuffer *value;
-            
-    rc = get_databuffer(&value, cp->argv[0].data.ascii, cp->argv[0].count);
-    if (rc == 0) {
-        rslt->self = value;
-        rslt->whack = (void (*)(void *))KDataBufferWhack;
-        
-        rslt->variant = vftRow;
-        rslt->u.rf = environment_read_func;
-    }
-
-	return rc;
-}
diff --git a/libs/vdb/fixed-row-len.c b/libs/vdb/fixed-row-len.c
deleted file mode 100644
index 440a10c..0000000
--- a/libs/vdb/fixed-row-len.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <klib/data-buffer.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <sysalloc.h>
-
-#include "prod-priv.h"
-#include "xform-priv.h"
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-
-static
-rc_t CC fixed_row_len_func ( void *self, const VXformInfo *info,
-    int64_t row_id, VRowResult *rslt, uint32_t argc, const VRowData in[] )
-{
-    assert ( rslt -> data -> elem_bits == 32 );
-    if ( rslt -> data -> elem_count == 0 )
-    {
-        rc_t rc = KDataBufferResize ( rslt -> data, 1 );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    * ( uint32_t* ) rslt -> data -> base = VProductionFixedRowLength ( info -> prod, row_id, true );
-    rslt -> elem_count = 1;
-
-    return 0;
-}
-
-VTRANSFACT_BUILTIN_IMPL ( vdb_fixed_row_len, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt -> variant = vftRow;
-    rslt -> u . rf = fixed_row_len_func;
-    return 0;
-}
diff --git a/libs/vdb/index_insert.c b/libs/vdb/index_insert.c
deleted file mode 100644
index 5929ccd..0000000
--- a/libs/vdb/index_insert.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#include <sra/sradb.h>
-#include <vdb/xform.h>
-#include <vdb/table.h>
-#include <kdb/index.h>
-#include <klib/data-buffer.h>
-#include <klib/text.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-struct self_t {
-    KIndex *ndx;
-    char *key_buf;
-    size_t key_buf_size;
-};
-
-/*
- function utf8 idx:text:insert #1.0 < ascii index_name > ( utf8 key );
- */
-
-static
-rc_t CC index_insert( void *Self, const VXformInfo *info, int64_t row_id,
-                       VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    struct self_t *self = Self;
-    rc_t rc;
-    const char *x;
-    char skey[4096];
-    char *key = skey;
-    uint32_t key_len;
-
-    rslt -> elem_count = 0;
-
-    x = argv [ 0 ] . u . data . base;
-    key_len = argv [ 0 ] . u . data . elem_count;
-    x += argv [ 0 ] . u . data . first_elem;
-    
-    if (key_len + 1 >= sizeof(skey)) {
-        if (key_len + 1 >= self->key_buf_size) {
-            void *temp = realloc(self->key_buf, key_len + 1);
-            if (temp == NULL)
-                return RC(rcVDB, rcFunction, rcExecuting, rcMemory, rcExhausted);
-            self->key_buf = temp;
-            self->key_buf_size = key_len + 1;
-        }
-        key = self->key_buf;
-    }
-    memcpy(key, x, key_len);
-    key[key_len] = 0;
-
-    /* attempt to insert into index */
-    rc = KIndexInsertText ( self->ndx, false, key, row_id );
-    if ( rc != 0 )
-    {
-        /* insert failed for whatever reason - return key */
-        rc = KDataBufferResize ( rslt -> data, key_len );
-        if ( rc != 0 )
-            return rc;
-        memcpy ( rslt -> data -> base, key, key_len );
-        
-        rslt -> elem_count = key_len;
-    }
-    
-    return 0;
-}    
-
-static void CC self_whack(void *Self) {
-    struct self_t *self = Self;
-    KIndexRelease(self->ndx);
-    if (self->key_buf)
-        free(self->key_buf);
-    free(Self);
-}
-
-VTRANSFACT_IMPL ( idx_text_insert, 1, 0, 0 ) ( const void *Self,
-    const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    struct self_t *self;
-    
-    self = malloc(sizeof(*self));
-    if (self) {
-        rc_t rc;
-        
-        rc = VTableCreateIndex ( ( VTable* ) info -> tbl, &self->ndx, kitText | kitProj, kcmOpen,
-                                "%.*s", cp->argv[0].count, cp->argv[0].data.ascii );
-        if( rc == 0 ) {
-            rslt->self = self;
-            rslt->whack = self_whack;
-            rslt->variant = vftNonDetRow;
-            rslt->u.ndf = index_insert;
-            self->key_buf = NULL;
-            self->key_buf_size = 0;
-            return 0;
-        }
-        free(self);
-        return rc;
-    }
-    else
-        return RC(rcVDB, rcFunction, rcConstructing, rcMemory, rcExhausted);
-}
diff --git a/libs/vdb/index_lookup.c b/libs/vdb/index_lookup.c
deleted file mode 100644
index 4589609..0000000
--- a/libs/vdb/index_lookup.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#include "blob.h"
-#include "blob-headers.h"
-#include "page-map.h"
-#include "blob-priv.h"
-#include "xform-priv.h"
-
-#include <vdb/xform.h>
-#include <vdb/table.h>
-#include <vdb/vdb-priv.h>
-#include <kdb/index.h>
-#include <klib/rc.h>
-#include <klib/text.h>
-#include <klib/pbstree.h>
-#include <klib/log.h>
-#include <sysalloc.h>
-#include <atomic32.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-
-#include <assert.h>
-
-typedef struct tag_self_t {
-    const       KIndex *ndx;
-    char        query_key[1024];
-    uint32_t    query_key_len;
-    const struct VCursorParams * parms;
-    uint32_t    elem_bits;
-} self_t;
-
-static void CC self_whack( void *Self )
-{
-    self_t *self = Self;
-    
-    KIndexRelease( self->ndx );
-    free( self );
-}
-
-
-static
-rc_t CC index_lookup_impl(
-                          void *Self,
-                          const VXformInfo *info,
-                          int64_t row_id,
-                          VRowResult *rslt,
-                          uint32_t argc,
-                          const VRowData argv[]
-                          )
-{
-    rc_t rc;
-    const self_t *self = Self;
-    KDataBuffer *query_buf = NULL;
-    
-    rslt->elem_count = 0;
-    rslt->no_cache = 1;
-    
-    rc = VCursorParamsGet(self->parms, self->query_key, &query_buf);
-    if (GetRCState(rc) == rcNotFound && GetRCObject(rc) == rcName) {
-        rc = KDataBufferResize(rslt->data, 0);
-        return rc;
-    }
-    if (rc == 0) {
-        char  squery[4096];
-        char *hquery = NULL;
-        char *query = squery;
-        uint64_t id_count;
-        int64_t start_id;
-        
-        if (query_buf->elem_count >= sizeof(squery)) {
-            hquery = malloc(query_buf->elem_count + 1);
-            if (hquery == NULL)
-                return RC(rcVDB, rcIndex, rcReading, rcMemory, rcExhausted);
-            query = hquery;
-        }
-        memcpy(query, query_buf->base, query_buf->elem_count);
-        query[query_buf->elem_count] = '\0';
-        rc = KIndexFindText(self->ndx, query, &start_id, &id_count,NULL,NULL);
-        if (hquery)
-            free(hquery);
-        if (rc == 0) {
-            rc = KDataBufferResize ( rslt -> data, 1 );
-            if( rc == 0) {
-                int64_t *out = rslt -> data->base;
-                
-                out[0] = start_id;
-                out[1] = start_id + id_count - 1;
-
-                rslt -> elem_count = 1;
-                rslt -> no_cache = 1; /***** This row should never be cached **/
-            }
-        }
-    }
-    return rc;
-}
-
-/*
- * function vdb:row_id_range  idx:text:lookup #1 < ascii index_name , ascii query_by_name > ();
- */
-VTRANSFACT_BUILTIN_IMPL(idx_text_lookup, 1, 0, 0) (
-                                           const void *Self,
-                                           const VXfactInfo *info,
-                                           VFuncDesc *rslt,
-                                           const VFactoryParams *cp,
-                                           const VFunctionParams *dp
-) {
-    rc_t rc;
-    const KIndex *ndx;
-    KIdxType type;
-    
-    rc = VTableOpenIndexRead(info->tbl, &ndx, "%.*s", (int)cp->argv[0].count, cp->argv[0].data.ascii);
-    if ( rc != 0 )
-    {
-        if ( GetRCState ( rc ) != rcNotFound )
-            PLOGERR (klogErr, (klogErr, rc, "Failed to open index '$(index)'", "index=%.*s", (int)cp->argv[0].count, cp->argv[0].data.ascii));
-        return rc;
-    }
-    
-    rc = KIndexType(ndx, &type);
-    if (rc == 0) {
-        if (type == kitProj + kitText) {
-            self_t *self;
-            
-            self = malloc(sizeof(*self));
-            if (self) {
-                self->ndx = ndx;
-                self->elem_bits = VTypedescSizeof(&info->fdesc.desc);
-                memcpy(self->query_key,cp->argv[1].data.ascii,cp->argv[1].count);
-                self->query_key_len = cp->argv[1].count;
-                self->query_key[self->query_key_len] = '\0';
-                self->parms = info->parms;
-                
-                rslt->self = self;
-                rslt->whack = self_whack;
-                rslt->variant = vftNonDetRow;
-                rslt->u.ndf = index_lookup_impl;
-                return 0;
-            }
-            rc = RC(rcVDB, rcFunction, rcConstructing, rcMemory, rcExhausted);
-        }
-        else
-            rc = RC(rcVDB, rcFunction, rcConstructing, rcIndex, rcIncorrect);
-    }
-    KIndexRelease(ndx);
-    return rc;
-}
diff --git a/libs/vdb/index_project.c b/libs/vdb/index_project.c
deleted file mode 100644
index 2d8a7c6..0000000
--- a/libs/vdb/index_project.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#include "blob.h"
-#include "blob-headers.h"
-#include "page-map.h"
-#include "blob-priv.h"
-#include "xform-priv.h"
-
-#include <vdb/xform.h>
-#include <vdb/table.h>
-#include <kdb/index.h>
-#include <klib/rc.h>
-#include <klib/log.h>
-#include <sysalloc.h>
-#include <atomic32.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <assert.h>
-
-typedef struct tag_self_t {
-    const KIndex *ndx;
-    uint32_t elem_bits;
-} self_t;
-
-static void CC self_whack( void *Self )
-{
-    self_t *self = Self;
-    
-    KIndexRelease( self->ndx );
-    free( self );
-}
-
-#include <stdio.h>
-
-static
-rc_t CC index_project_impl(
-                            void *Self,
-                            const VXformInfo *info,
-                            int64_t row_id,
-                            VBlob **rslt,
-                            uint32_t argc, const VBlob *argv[]
-) {
-    rc_t rc;
-    const self_t *self = Self;
-    KDataBuffer temp;
-    uint64_t id_count;
-    int64_t start_id;
-    char key_buf[1024];
-    char *key = key_buf;
-    size_t sz = sizeof(key_buf) - 1;
-
-    for ( ; ; ) {
-        rc = KIndexProjectText(self->ndx, row_id, &start_id, &id_count, key, sz + 1, &sz);
-        if ((GetRCState(rc) == rcNotFound && GetRCObject(rc) == rcId) || sz==0 ){
-/*          fprintf(stderr, "row %u not in index\n", (unsigned)row_id); */
-            if (argc > 0 && argv[0] != NULL) { 
-                /*** this types of blobs may have holes in them ***/
-                rc = VBlobSubblob(argv[0],rslt,row_id );
-            }
-            else
-                rc = RC(rcVDB, rcFunction, rcExecuting, rcRow, rcNotFound);
-            break;
-        }
-        if (GetRCState(rc) == rcInsufficient && GetRCObject(rc) == rcBuffer && key == key_buf) {
-            rc = KDataBufferMakeBytes( &temp, (uint32_t)( sz + 1 ) );
-            if (rc) {
-                key = temp.base;
-                continue;
-            }
-        }
-        if (rc == 0) {
-            VBlob *y;
-        
-            /* it seems old index returns length including \0 so we have to adjust */
-            while (sz > 0 && key[sz - 1] == '\0')
-                --sz;
-
-            rc = VBlobNew(&y, start_id, start_id + id_count - 1, "vdb:index:project");
-            if (rc == 0) {
-                rc = PageMapNewSingle( &y->pm, (uint32_t)id_count, (uint32_t)sz );
-                if (rc == 0) {
-                    if (key == key_buf) {
-                        rc = KDataBufferMakeBytes( &y->data, (uint32_t)sz );
-                        if (rc == 0)
-                            memcpy(y->data.base, key, sz);
-                    }
-                    else
-                        KDataBufferSub( &temp, &y->data, 0, (uint32_t)sz );
-                }
-                if (rc == 0) 
-                    *rslt = y;
-                else {
-                    TRACK_BLOB( VBlobRelease, ((VBlob*)y) );
-                    (void)VBlobRelease(y);
-                }
-            }
-        }
-        break;
-    }
-    if (key != key_buf)
-        KDataBufferWhack(&temp);
-    return rc;
-}
-
-VTRANSFACT_BUILTIN_IMPL(idx_text_project, 1, 0, 0) (
-                                           const void *Self,
-                                           const VXfactInfo *info,
-                                           VFuncDesc *rslt,
-                                           const VFactoryParams *cp,
-                                           const VFunctionParams *dp
-) {
-    rc_t rc;
-    const KIndex *ndx;
-    KIdxType type;
-    
-    rc = VTableOpenIndexRead(info->tbl, &ndx, "%.*s", (int)cp->argv[0].count, cp->argv[0].data.ascii);
-    if ( rc != 0 )
-    {
-        if ( GetRCState ( rc ) != rcNotFound )
-            PLOGERR (klogErr, (klogErr, rc, "Failed to open index '$(index)'", "index=%.*s", (int)cp->argv[0].count, cp->argv[0].data.ascii));
-        return rc;
-    }
-    
-    rc = KIndexType(ndx, &type);
-    if (rc == 0) {
-        if (type == kitProj + kitText) {
-            self_t *self;
-            
-            self = malloc(sizeof(*self));
-            if (self) {
-                self->ndx = ndx;
-                self->elem_bits = VTypedescSizeof(&info->fdesc.desc);
-                rslt->self = self;
-                rslt->whack = self_whack;
-                rslt->variant = vftBlobN;
-                VFUNCDESC_INTERNAL_FUNCS(rslt)->bfN = index_project_impl;
-                return 0;
-            }
-            rc = RC(rcVDB, rcFunction, rcConstructing, rcMemory, rcExhausted);
-        }
-        else
-            rc = RC(rcVDB, rcFunction, rcConstructing, rcIndex, rcIncorrect);
-    }
-    KIndexRelease(ndx);
-    return rc;
-}
diff --git a/libs/vdb/libvdb.vers.h b/libs/vdb/libvdb.vers.h
deleted file mode 100644
index c423f0c..0000000
--- a/libs/vdb/libvdb.vers.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#define LIBVDB_VERS 0x02060004
diff --git a/libs/vdb/libwvdb.vers.h b/libs/vdb/libwvdb.vers.h
deleted file mode 100644
index 6f33e03..0000000
--- a/libs/vdb/libwvdb.vers.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#define LIBWVDB_VERS 0x02060004
diff --git a/libs/vdb/linker-cmn.c b/libs/vdb/linker-cmn.c
deleted file mode 100644
index 73c87ec..0000000
--- a/libs/vdb/linker-cmn.c
+++ /dev/null
@@ -1,651 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#define TRACK_REFERENCES 0
-
-#include "linker-priv.h"
-#include "schema-priv.h"
-#include "dbmgr-priv.h"
-
-#include <kfs/directory.h>
-#include <kfs/dyload.h>
-#include <kfs/kfs-priv.h>
-#include <klib/symbol.h>
-#include <klib/symtab.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * LFactory
- *  describes an external C function factory
- */
-
-/* Whack
- */
-void CC LFactoryWhack ( void *item, void *ignore )
-{
-    LFactory *self = item;
-
-    /* whack the guy's factory object */
-    if ( self -> desc . whack != NULL )
-        ( * self -> desc . whack ) ( self -> desc . fself );
-
-    /* douse the dynamic library */
-    KSymAddrRelease ( self -> addr );
-
-    /* gone */
-    free ( self );
-}
-
-
-/*--------------------------------------------------------------------------
- * LSpecial
- *  describes an external C table recognition function
- */
-
-/* Whack
- */
-void CC LSpecialWhack ( void *item, void *ignore )
-{
-    LSpecial *self = item;
-    KSymAddrRelease ( self -> addr );
-    free ( self );
-}
-
-
-/*--------------------------------------------------------------------------
- * VLinker
- */
-
-/* Whack
- */
-static
-rc_t CC VLinkerWhack ( VLinker *self )
-{
-    KRefcountWhack ( & self -> refcount, "VLinker" );
-
-    VectorWhack ( & self -> fact, LFactoryWhack, NULL );
-    VectorWhack ( & self -> special, LSpecialWhack, NULL );
-    BSTreeWhack ( & self -> scope, KSymbolWhack, NULL );
-
-    KDyldRelease ( self -> dl );
-    VLinkerSever ( self -> dad );
-
-    free ( self );
-
-    return 0;
-}
-
-
-/* StartIdx
- *  returns starting index
- */
-#define VLinkerStartIdx( dad, vect, starting ) \
-    ( ( ( dad ) == NULL ) ? ( starting ) : \
-      ( VectorStart ( & ( dad ) -> vect ) + \
-        VectorLength ( & ( dad ) -> vect ) ) )
-
-/* VectorInit
- *  performs vector initialization
- */
-#define VLinkerVectorInit( linker, dad, vect, starting, block ) \
-    VectorInit ( & ( linker ) -> vect, VLinkerStartIdx ( dad, vect, starting ), block )
-
-/* Make
- *  creates an empty linker
- */
-rc_t VLinkerMake ( VLinker **lp, const VLinker *dad, struct KDyld *dl )
-{
-    rc_t rc;
-
-    VLinker *linker = malloc ( sizeof * linker );
-    if ( linker == NULL )
-        return RC ( rcVDB, rcMgr, rcConstructing, rcMemory, rcExhausted );
-
-    rc = KDyldAddRef ( linker -> dl = dl );
-    if ( rc == 0 )
-    {
-        linker -> dad = VLinkerAttach ( dad );
-        BSTreeInit ( & linker -> scope );
-
-        VLinkerVectorInit ( linker, dad, fact, 1, 64 );
-        VLinkerVectorInit ( linker, dad, special, 1, 8 );
-
-        KRefcountInit ( & linker -> refcount, 1, "VLinker", "make", "vld" );
-    
-        * lp = linker;
-        return 0;
-    }
-
-    free ( linker );
-    return rc;
-}
-
-/* Release
- */
-rc_t VLinkerRelease ( const VLinker *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "VLinker" ) )
-        {
-        case krefWhack:
-            return VLinkerWhack ( ( VLinker* ) self );
-        case krefNegative:
-            return RC ( rcVDB, rcMgr, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-/* Attach
- * Sever
- */
-VLinker *VLinkerAttach ( const VLinker *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAddDep ( & self -> refcount, "VLinker" ) )
-        {
-        case krefLimit:
-            return NULL;
-        }
-    }
-    return ( VLinker* ) self;
-}
-
-rc_t VLinkerSever ( const VLinker *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDropDep ( & self -> refcount, "VLinker" ) )
-        {
-        case krefWhack:
-            return VLinkerWhack ( ( VLinker* ) self );
-        case krefNegative:
-            return RC ( rcVDB, rcMgr, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/* AddLoadLibraryPath
- *  add a path[s] to loader for locating dynamic libraries
- */
-rc_t VLinkerVAddLoadLibraryPath ( const VLinker *self, const char *path, va_list args )
-{
-    if ( self != NULL )
-        return KDyldVAddSearchPath ( self -> dl, path, args );
-
-    return RC ( rcVDB, rcMgr, rcUpdating, rcSelf, rcNull );
-}
-
-
-/* Open
- *  opens libraries for search
- */
-rc_t VLinkerOpen ( const VLinker *self, struct KDlset **libs )
-{
-    rc_t rc = KDyldMakeSet ( self -> dl, libs );
-    if ( rc == 0 )
-    {
-        KDlset *set = * libs;
-
-        rc = KDlsetAddAll ( set );
-        if ( rc == 0 )
-            return 0;
-
-        KDlsetRelease ( set );
-        * libs = NULL;
-    }
-    return rc;
-}
-
-
-/* EnterIntoScope
- *  pushes linker symbol tables into scope
- */
-static
-rc_t CC VLinkerEnterIntoScope ( const VLinker *self, KSymTable *tbl )
-{
-    rc_t rc;
-
-    if ( self -> dad == NULL )
-        rc = KSymTableInit ( tbl, NULL );
-    else
-        rc = VLinkerEnterIntoScope ( self -> dad, tbl );
-
-    if ( rc == 0 )
-        rc = KSymTablePushScope ( tbl, & ( ( VLinker* ) self ) -> scope );
-
-    return rc;
-}
-
-
-/* MakeFQN
- */
-static
-size_t CC VLinkerMakeFQN ( char *buffer, size_t bsize, const KSymbol *name )
-{
-    size_t sz = 0;
-
-    if ( name -> dad != NULL )
-    {
-        sz = VLinkerMakeFQN ( buffer, bsize, name -> dad );
-        if ( sz < bsize )
-            buffer [ sz ++ ] = '_';
-    }
-
-    if ( sz < bsize )
-    {
-        sz += string_copy ( & buffer [ sz ], bsize - sz,
-            name -> name . addr, name -> name . size );
-    }
-
-    return sz;
-}
-
-/* ScanFactory
- *  scans code modules for all named entrypoints
- *  compares version numbers, retaining the highest
- *  that satisfies stated functional interface
- */
-typedef struct VLinkerFactoryMatchData VLinkerFactoryMatchData;
-struct VLinkerFactoryMatchData
-{
-    VTransDesc desc;
-    uint32_t version;
-};
-
-static
-bool CC VLinkerBestMatch ( const KSymAddr *sym, void *data )
-{
-    VLinkerFactoryMatchData *pb = data;
-
-    rc_t rc;
-    VTransDesc desc;
-
-    rc_t ( CC * f ) ( VTransDesc* );
-    KSymAddrAsFunc ( sym, ( fptr_t* ) & f );
-
-    memset ( & desc, 0, sizeof desc );
-    rc = ( * f ) ( & desc );
-    if ( rc == 0 )
-    {
-        /* we don't actually expect to see two versions
-           of a factory at all, much less with the same
-           major interface version */
-        uint32_t maj = desc . itf_version >> 24;
-        if ( maj != 0 && maj == ( pb -> desc . itf_version >> 24 ) )
-        {
-            /* TBD - issue warning */
-        }
-
-        /* prototype should have been declared with a version,
-           but if not, then any version will do */
-        if ( pb -> version == 0 ||
-             ( maj == ( pb -> version >> 24 ) &&
-               desc . itf_version >= pb -> version ) )
-        {
-            /* accept latest version */
-            if ( desc . itf_version > pb -> desc . itf_version )
-            {
-                pb -> desc = desc;
-                return true;
-            }
-        }
-    }
-    return false;
-}
-
-static
-rc_t VLinkerScanFactory ( VLinker *self, const KDlset *libs,
-    KSymTable *tbl, const KSymbol **symp, const KSymbol *name,
-    uint32_t version )
-{
-    rc_t rc;
-
-    /* convert schema fqn into legal C identifier */
-    char fqn [ 1024 ];
-    size_t sz = VLinkerMakeFQN ( fqn, sizeof fqn, name );
-    if ( sz >= sizeof fqn )
-        rc = RC ( rcVDB, rcMgr, rcResolving, rcName, rcExcessive );
-    else
-    {
-        KSymAddr *entrypoint;
-        VLinkerFactoryMatchData pb;
-        memset ( & pb, 0, sizeof pb );
-        pb . version = version;
-
-        /* ask loader to locate fqn in library search path */
-        rc = KDlsetLastSymbol ( libs, & entrypoint,
-            fqn, VLinkerBestMatch, & pb );
-        if ( rc == 0 )
-        {
-            /* allocate factory object */
-            LFactory *fact = malloc ( sizeof * fact );
-            if ( fact == NULL )
-                rc = RC ( rcVDB, rcMgr, rcResolving, rcMemory, rcExhausted );
-            else
-            {
-                /* give it the exact schema name */
-                rc = KSymTableDupSymbol ( tbl,
-                    ( KSymbol** ) & fact -> name, name, ltFactory, fact );
-                if ( rc == 0 )
-                {
-                    /* finally, insert the symbol into our vector */
-                    rc = VectorAppend ( & self -> fact, & fact -> id, fact );
-                    if ( rc == 0 )
-                    {
-                        /* done */
-                        fact -> addr = entrypoint;
-                        fact -> desc = pb . desc;
-                        fact -> external = true;
-                        * symp = fact -> name;
-                        return 0;
-                    }
-
-                    KSymTableRemoveSymbol ( tbl, fact -> name );
-                }
-
-                free ( fact );
-            }
-
-            KSymAddrRelease ( entrypoint );
-        }
-    }
-
-    return rc;
-}
-
-/* ScanSpecial
- *  scans code modules for the first named entrypoint
- */
-static
-rc_t CC VLinkerScanSpecial ( VLinker *self, const KDlset *libs,
-    KSymTable *tbl, const KSymbol **symp, const KSymbol *name, uint32_t type )
-{
-    rc_t rc;
-
-    /* convert schema fqn into legal C identifier */
-    char fqn [ 1024 ];
-    size_t sz = VLinkerMakeFQN ( fqn, sizeof fqn, name );
-    if ( sz >= sizeof fqn )
-        rc = RC ( rcVDB, rcMgr, rcResolving, rcName, rcExcessive );
-    else
-    {
-        /* ask loader to locate fqn in open library set */
-        KSymAddr *entrypoint;
-        rc = KDlsetSymbol ( libs, & entrypoint, fqn );
-        if ( rc == 0 )
-        {
-            /* allocate special function object */
-            LSpecial *special = malloc ( sizeof * special );
-            if ( special == NULL )
-                rc = RC ( rcVDB, rcMgr, rcResolving, rcMemory, rcExhausted );
-            else
-            {
-                special -> func = NULL;
-
-                /* give it the exact schema name */
-                rc = KSymTableDupSymbol ( tbl,
-                    ( KSymbol** ) & special -> name, name, type, special );
-                if ( rc == 0 )
-                {
-                    /* finally, insert the symbol into our vector */
-                    rc = VectorAppend ( & self -> special, & special -> id, special );
-                    if ( rc == 0 )
-                    {
-                        /* done */
-                        special -> addr = entrypoint;
-                        * symp = special -> name;
-                        return 0;
-                    }
-
-                    KSymTableRemoveSymbol ( tbl, special -> name );
-                }
-
-                free ( special );
-            }
-
-            KSymAddrRelease ( entrypoint );
-        }
-    }
-
-    return rc;
-}
-
-/* Find
- *  find a named symbol
- *
- *  "func" [ OUT ] - return parameter for func pointer
- *
- *  "proto" [ IN ] - function prototype from schema
- *
- *  "external" [ OUT ] - tells whether factory is built-in or external
- */
-rc_t VLinkerFindFactory ( VLinker *self, const KDlset *libs,
-    VTransDesc *desc, const SFunction *proto, bool *external )
-{
-    KSymTable tbl;
-    rc_t rc = VLinkerEnterIntoScope ( self, & tbl );
-    if ( rc == 0 )
-    {
-        /* factory name if explicit */
-        const KSymbol *sym, *name = proto -> u . ext . fact;
-
-        /* use simple function name as implicit factory name */
-        if ( name == NULL )
-            name = proto -> name;
-
-        /* look for the symbol by name -
-           factory names do not support version overloading */
-        sym = KSymTableFindSymbol ( & tbl, name );
-
-        /* if not found, search for best match */
-        if ( sym == NULL )
-            rc = VLinkerScanFactory ( self, libs, & tbl, & sym, name, proto -> version );
-
-        /* otherwise ensure the found name is in fact a factory */
-        else if ( sym -> type != ltFactory )
-            rc = RC ( rcVDB, rcMgr, rcResolving, rcName, rcIncorrect );
-
-        /* examine results */
-        if ( rc == 0 )
-        {
-            const LFactory *fact = sym -> u . obj;
-
-            /* test for incompatible version */
-            if ( ( fact -> desc . itf_version >> 24 ) != ( proto -> version >> 24 ) )
-                rc = RC ( rcVDB, rcMgr, rcResolving, rcInterface, rcIncorrect );
-            else if ( fact -> desc . itf_version < proto -> version )
-                rc = RC ( rcVDB, rcMgr, rcResolving, rcInterface, rcIncorrect );
-            else
-            {
-                * desc = fact -> desc;
-                * external = fact -> external;
-            }
-        }
-
-        KSymTableWhack ( & tbl );
-    }
-    return rc;
-}
-
-static
-void CC VLinkerNameWhackSymbol ( KSymbol *sym )
-{
-    if ( sym != NULL )
-    {
-        VLinkerNameWhackSymbol ( sym -> dad );
-        free ( sym );
-    }
-}
-
-static
-KSymbol *VLinkerNameToSymbol ( String *name )
-{
-    KSymbol *sym, *dad = NULL;
-    const char *end = string_rchr ( name -> addr, name -> size, ':' );
-    if ( end != 0 )
-    {
-        String sub;
-        StringSubstr ( name, & sub, 0, string_len ( name -> addr, end - name -> addr ) );
-        dad = VLinkerNameToSymbol ( & sub );
-        if ( dad == NULL )
-            return NULL;
-
-        BSTreeInit ( & dad -> u . scope );
-
-        name -> addr += sub . size + 1;
-        name -> size -= sub . size + 1;
-        name -> len -= sub . len + 1;
-    }
-
-    sym = malloc ( sizeof * sym );
-    if ( sym == NULL )
-    {
-        VLinkerNameWhackSymbol ( dad );
-        return NULL;
-    }
-
-    sym -> u . obj = NULL;
-    sym -> dad = dad;
-    sym -> name = * name;
-    sym -> type = 0;
-
-    if ( dad != NULL )
-        BSTreeInsert ( & dad -> u . scope, & sym -> n, KSymbolSort );
-
-    return sym;
-}
-
-rc_t VLinkerFindNamedFactory ( VLinker *self, const KDlset *libs,
-    VTransDesc *desc, const char *fact_name )
-{
-    KSymTable tbl;
-    rc_t rc = VLinkerEnterIntoScope ( self, & tbl );
-    if ( rc == 0 )
-    {
-        KSymbol *name;
-        const KSymbol *sym;
-
-        String str;
-        StringInitCString ( & str, fact_name );
-        name = VLinkerNameToSymbol ( & str );
-
-        /* look for the symbol by name -
-           factory names do not support version overloading */
-        sym = KSymTableFindSymbol ( & tbl, name );
-        
-        /* if not found, search for best match */
-        if ( sym == NULL )
-            rc = VLinkerScanFactory ( self, libs, & tbl, & sym, name, 0 );
-
-        /* otherwise ensure the found name is in fact a factory */
-        else if ( sym -> type != ltFactory )
-            rc = RC ( rcVDB, rcMgr, rcResolving, rcName, rcIncorrect );
-
-        VLinkerNameWhackSymbol ( name );
-
-        /* examine results */
-        if ( rc == 0 )
-        {
-            const LFactory *fact = sym -> u . obj;
-            * desc = fact -> desc;
-        }
-
-        KSymTableWhack ( & tbl );
-    }
-    return rc;
-}
-
-
-rc_t VLinkerFindUntyped ( VLinker *self, const KDlset *libs,
-    VUntypedTableTest *func, const SFunction *proto )
-{
-    KSymTable tbl;
-    rc_t rc = VLinkerEnterIntoScope ( self, & tbl );
-    if ( rc == 0 )
-    {
-        /* untyped functions do not have factories */
-        const KSymbol *sym = KSymTableFindSymbol ( & tbl, proto -> name );
-
-        /* if not found, search for it */
-        if ( sym == NULL )
-            rc = VLinkerScanSpecial ( self, libs, & tbl, & sym, proto -> name, ltUntyped );
-
-        /* otherwise ensure the found name is in fact untyped */
-        else if ( sym -> type != ltUntyped )
-            rc = RC ( rcVDB, rcMgr, rcResolving, rcName, rcIncorrect );
-
-        /* return results */
-        if ( rc == 0 )
-        {
-            const LSpecial *untyped = sym -> u . obj;
-            if ( untyped -> addr == NULL )
-                * func = untyped -> func;
-            else
-                KSymAddrAsFunc ( untyped -> addr, ( fptr_t* ) func );
-        }
-
-        KSymTableWhack ( & tbl );
-    }
-    return rc;
-}
-
-
-/* ListExternalSchemaModules
- */
-rc_t VLinkerListExternalSchemaModules ( const VLinker *self, struct KNamelist **listp )
-{
-    rc_t rc;
-
-    assert ( listp != NULL );
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcDylib, rcListing, rcSelf, rcNull );
-    else
-    {
-        KDlset *libs;
-        rc = VLinkerOpen ( self, & libs );
-        if ( rc == 0 )
-        {
-            rc = KDlsetList ( libs, listp );
-            KDlsetRelease ( libs );
-        }
-    }
-
-    return rc;
-}
diff --git a/libs/vdb/linker-int.c b/libs/vdb/linker-int.c
deleted file mode 100644
index 35d1875..0000000
--- a/libs/vdb/linker-int.c
+++ /dev/null
@@ -1,665 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#include "linker-priv.h"
-#include "schema-parse.h"
-#include "xform-priv.h"
-
-#include <kfs/dyload.h>
-#include <klib/token.h>
-#include <klib/symtab.h>
-#include <klib/symbol.h>
-#include <klib/out.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <byteswap.h>
-#include <assert.h>
-
-extern VTRANSFACT_DECL ( vdb_cast );
-extern VTRANSFACT_DECL ( vdb_redimension );
-extern VTRANSFACT_DECL ( vdb_row_id );
-extern VTRANSFACT_DECL ( vdb_row_len );
-extern VTRANSFACT_DECL ( vdb_fixed_row_len );
-extern VTRANSFACT_DECL ( vdb_compare );
-extern VTRANSFACT_DECL ( vdb_no_compare );
-extern VTRANSFACT_DECL ( vdb_range_validate );
-extern VTRANSFACT_DECL ( vdb_merge );
-extern VTRANSFACT_DECL ( vdb_split );
-extern VTRANSFACT_DECL ( vdb_transpose );
-extern VTRANSFACT_DECL ( vdb_detranspose );
-extern VTRANSFACT_DECL ( vdb_delta_average );
-extern VTRANSFACT_DECL ( vdb_undelta_average );
-extern VTRANSFACT_DECL ( meta_read );
-extern VTRANSFACT_DECL ( meta_value );
-extern VTRANSFACT_DECL ( meta_attr_read );
-extern VTRANSFACT_DECL ( idx_text_project );
-extern VTRANSFACT_DECL ( idx_text_lookup );
-extern VTRANSFACT_DECL ( parameter_read );
-extern VTRANSFACT_DECL ( environment_read );
-
-/* newly imported things */
-extern VTRANSFACT_DECL ( ALIGN_align_restore_read );
-extern VTRANSFACT_DECL ( ALIGN_cigar );
-extern VTRANSFACT_DECL ( ALIGN_cigar_2 );
-extern VTRANSFACT_DECL ( ALIGN_generate_has_mismatch );
-extern VTRANSFACT_DECL ( ALIGN_generate_mismatch );
-extern VTRANSFACT_DECL ( ALIGN_generate_mismatch_qual );
-extern VTRANSFACT_DECL ( ALIGN_project_from_sequence );
-extern VTRANSFACT_DECL ( ALIGN_raw_restore_read );
-extern VTRANSFACT_DECL ( ALIGN_ref_restore_read );
-extern VTRANSFACT_DECL ( ALIGN_ref_sub_select );
-extern VTRANSFACT_DECL ( ALIGN_seq_restore_read );
-extern VTRANSFACT_DECL ( INSDC_SEQ_rand_4na_2na );
-extern VTRANSFACT_DECL ( INSDC_SRA_format_spot_name );
-extern VTRANSFACT_DECL ( INSDC_SRA_format_spot_name_no_coord );
-extern VTRANSFACT_DECL ( NCBI_SRA_ABI_tokenize_spot_name );
-extern VTRANSFACT_DECL ( NCBI_SRA_Helicos_tokenize_spot_name );
-extern VTRANSFACT_DECL ( NCBI_SRA_Illumina_tokenize_spot_name );
-extern VTRANSFACT_DECL ( NCBI_SRA_IonTorrent_tokenize_spot_name );
-extern VTRANSFACT_DECL ( NCBI_SRA__454__dynamic_read_desc );
-extern VTRANSFACT_DECL ( NCBI_SRA__454__process_position );
-extern VTRANSFACT_DECL ( NCBI_SRA__454__tokenize_spot_name );
-extern VTRANSFACT_DECL ( NCBI_SRA_bio_start );
-extern VTRANSFACT_DECL ( NCBI_SRA_decode_CLIP );
-extern VTRANSFACT_DECL ( NCBI_SRA_decode_INTENSITY );
-extern VTRANSFACT_DECL ( NCBI_SRA_decode_NOISE );
-extern VTRANSFACT_DECL ( NCBI_SRA_decode_POSITION );
-extern VTRANSFACT_DECL ( NCBI_SRA_decode_QUALITY );
-extern VTRANSFACT_DECL ( NCBI_SRA_decode_READ );
-extern VTRANSFACT_DECL ( NCBI_SRA_decode_SIGNAL );
-extern VTRANSFACT_DECL ( NCBI_SRA_denormalize );
-extern VTRANSFACT_DECL ( NCBI_SRA_extract_coordinates );
-extern VTRANSFACT_DECL ( NCBI_SRA_extract_name_coord );
-extern VTRANSFACT_DECL ( NCBI_SRA_fix_read_seg );
-extern VTRANSFACT_DECL ( NCBI_SRA_linker_from_readn );
-extern VTRANSFACT_DECL ( NCBI_SRA_lookup );
-extern VTRANSFACT_DECL ( NCBI_SRA_make_position );
-extern VTRANSFACT_DECL ( NCBI_SRA_make_read_desc );
-extern VTRANSFACT_DECL ( NCBI_SRA_make_spot_desc );
-extern VTRANSFACT_DECL ( NCBI_SRA_normalize );
-#if HAVE_PREFIX_TREE_TO_NAME
-extern VTRANSFACT_DECL ( NCBI_SRA_prefix_tree_to_name );
-#endif
-extern VTRANSFACT_DECL ( NCBI_SRA_qual4_decode );
-extern VTRANSFACT_DECL ( NCBI_SRA_qual4_decompress_v1 );
-#if HAVE_READ_LEN_FROM_NREADS
-extern VTRANSFACT_DECL ( NCBI_SRA_read_len_from_nreads );
-extern VTRANSFACT_DECL ( NCBI_SRA_read_start_from_nreads );
-#endif
-extern VTRANSFACT_DECL ( NCBI_SRA_read_seg_from_readn );
-extern VTRANSFACT_DECL ( NCBI_SRA_rewrite_spot_name );
-extern VTRANSFACT_DECL ( NCBI_SRA_rotate );
-extern VTRANSFACT_DECL ( NCBI_SRA_swap );
-extern VTRANSFACT_DECL ( NCBI_WGS_build_read_type );
-extern VTRANSFACT_DECL ( NCBI_WGS_build_scaffold_qual );
-extern VTRANSFACT_DECL ( NCBI_WGS_build_scaffold_read );
-extern VTRANSFACT_DECL ( NCBI_WGS_tokenize_nuc_accession );
-extern VTRANSFACT_DECL ( NCBI_WGS_tokenize_prot_accession );
-extern VTRANSFACT_DECL ( NCBI_align_clip );
-extern VTRANSFACT_DECL ( NCBI_align_clip_2 );
-extern VTRANSFACT_DECL ( NCBI_align_compress_quality );
-extern VTRANSFACT_DECL ( NCBI_align_decompress_quality );
-extern VTRANSFACT_DECL ( NCBI_align_edit_distance );
-extern VTRANSFACT_DECL ( NCBI_align_edit_distance_2 );
-extern VTRANSFACT_DECL ( NCBI_align_generate_mismatch_qual_2 );
-extern VTRANSFACT_DECL ( NCBI_align_generate_preserve_qual );
-extern VTRANSFACT_DECL ( NCBI_align_get_clipped_cigar );
-extern VTRANSFACT_DECL ( NCBI_align_get_clipped_cigar_2 );
-extern VTRANSFACT_DECL ( NCBI_align_get_clipped_ref_offset );
-extern VTRANSFACT_DECL ( NCBI_align_get_left_soft_clip );
-extern VTRANSFACT_DECL ( NCBI_align_get_left_soft_clip_2 );
-extern VTRANSFACT_DECL ( NCBI_align_get_mate_align_id );
-extern VTRANSFACT_DECL ( NCBI_align_get_mismatch_read );
-extern VTRANSFACT_DECL ( NCBI_align_get_ref_delete );
-extern VTRANSFACT_DECL ( NCBI_align_get_ref_insert );
-extern VTRANSFACT_DECL ( NCBI_align_get_ref_len );
-extern VTRANSFACT_DECL ( NCBI_align_get_ref_mismatch );
-extern VTRANSFACT_DECL ( NCBI_align_get_ref_preserve_qual );
-extern VTRANSFACT_DECL ( NCBI_align_get_right_soft_clip );
-extern VTRANSFACT_DECL ( NCBI_align_get_right_soft_clip_2 );
-extern VTRANSFACT_DECL ( NCBI_align_get_right_soft_clip_3 );
-extern VTRANSFACT_DECL ( NCBI_align_get_right_soft_clip_4 );
-extern VTRANSFACT_DECL ( NCBI_align_get_sam_flags );
-extern VTRANSFACT_DECL ( NCBI_align_get_sam_flags_2 );
-extern VTRANSFACT_DECL ( NCBI_align_get_seq_preserve_qual );
-extern VTRANSFACT_DECL ( NCBI_align_local_ref_id );
-extern VTRANSFACT_DECL ( NCBI_align_local_ref_start );
-extern VTRANSFACT_DECL ( NCBI_align_make_cmp_read_desc );
-extern VTRANSFACT_DECL ( NCBI_align_make_read_start );
-extern VTRANSFACT_DECL ( NCBI_align_mismatch_restore_qual );
-extern VTRANSFACT_DECL ( NCBI_align_not_my_row );
-extern VTRANSFACT_DECL ( NCBI_align_raw_restore_qual );
-extern VTRANSFACT_DECL ( NCBI_align_ref_name );
-extern VTRANSFACT_DECL ( NCBI_align_ref_pos );
-extern VTRANSFACT_DECL ( NCBI_align_ref_seq_id );
-extern VTRANSFACT_DECL ( NCBI_align_ref_sub_select_preserve_qual );
-extern VTRANSFACT_DECL ( NCBI_align_seq_construct_read );
-extern VTRANSFACT_DECL ( NCBI_align_template_len );
-extern VTRANSFACT_DECL ( NCBI_color_from_dna );
-extern VTRANSFACT_DECL ( NCBI_dna_from_color );
-extern VTRANSFACT_DECL ( NCBI_fp_extend );
-extern VTRANSFACT_DECL ( NCBI_lower_case_tech_reads );
-extern VTRANSFACT_DECL ( NCBI_unpack );
-extern VTRANSFACT_DECL ( NCBI_unzip );
-extern VTRANSFACT_DECL ( NCBI_var_tokenize_var_id );
-extern VTRANSFACT_DECL ( vdb_add_row_id );
-extern VTRANSFACT_DECL ( vdb_bit_or );
-extern VTRANSFACT_DECL ( vdb_bunzip );
-extern VTRANSFACT_DECL ( vdb_ceil );
-extern VTRANSFACT_DECL ( vdb_clip );
-extern VTRANSFACT_DECL ( vdb_cut );
-extern VTRANSFACT_DECL ( vdb_delta );
-extern VTRANSFACT_DECL ( vdb_deriv );
-extern VTRANSFACT_DECL ( vdb_diff );
-extern VTRANSFACT_DECL ( vdb_echo );
-extern VTRANSFACT_DECL ( vdb_exists );
-extern VTRANSFACT_DECL ( vdb_extract_token );
-extern VTRANSFACT_DECL ( vdb_fixed_vec_sum );
-extern VTRANSFACT_DECL ( vdb_floor );
-extern VTRANSFACT_DECL ( vdb_funzip );
-extern VTRANSFACT_DECL ( vdb_integral );
-extern VTRANSFACT_DECL ( vdb_integral_0 );
-extern VTRANSFACT_DECL ( vdb_iunzip );
-extern VTRANSFACT_DECL ( vdb_izip );
-extern VTRANSFACT_DECL ( vdb_map );
-extern VTRANSFACT_DECL ( vdb_max );
-extern VTRANSFACT_DECL ( vdb_min );
-extern VTRANSFACT_DECL ( vdb_outlier_decode );
-extern VTRANSFACT_DECL ( vdb_outlier_encode );
-extern VTRANSFACT_DECL ( vdb_pack );
-extern VTRANSFACT_DECL ( vdb_paste );
-extern VTRANSFACT_DECL ( vdb_rldecode );
-extern VTRANSFACT_DECL ( vdb_round );
-extern VTRANSFACT_DECL ( vdb_simple_sub_select );
-extern VTRANSFACT_DECL ( vdb_simple_sub_select_1 );
-extern VTRANSFACT_DECL ( vdb_sprintf );
-extern VTRANSFACT_DECL ( vdb_strtonum );
-extern VTRANSFACT_DECL ( vdb_subtract_row_id );
-extern VTRANSFACT_DECL ( vdb_sum );
-extern VTRANSFACT_DECL ( vdb_trim );
-extern VTRANSFACT_DECL ( vdb_trunc );
-extern VTRANSFACT_DECL ( vdb_undelta );
-extern VTRANSFACT_DECL ( vdb_unpack );
-extern VTRANSFACT_DECL ( vdb_unzip );
-extern VTRANSFACT_DECL ( vdb_vec_sum );
-
-struct KTable;
-struct KMetadata;
-extern bool CC NCBI_SRA_accept_untyped ( struct KTable const *tbl, struct KMetadata const *meta );
-extern bool CC NCBI_SRA__454__untyped_0 ( struct KTable const *tbl, struct KMetadata const *meta );
-extern bool CC NCBI_SRA__454__untyped_1_2a ( struct KTable const *tbl, struct KMetadata const *meta );
-extern bool CC NCBI_SRA__454__untyped_1_2b ( struct KTable const *tbl, struct KMetadata const *meta );
-extern bool CC NCBI_SRA_Illumina_untyped_0a ( struct KTable const *tbl, struct KMetadata const *meta );
-extern bool CC NCBI_SRA_Illumina_untyped_0b ( struct KTable const *tbl, struct KMetadata const *meta );
-extern bool CC NCBI_SRA_Illumina_untyped_1a ( struct KTable const *tbl, struct KMetadata const *meta );
-extern bool CC NCBI_SRA_Illumina_untyped_1b ( struct KTable const *tbl, struct KMetadata const *meta );
-extern bool CC NCBI_SRA_ABI_untyped_1 ( struct KTable const *tbl, struct KMetadata const *meta );
-
-
-/* select is REALLY internal */
-static
-rc_t CC select_func ( void *self, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    return 0;
-}
-
-VTRANSFACT_BUILTIN_IMPL ( vdb_select, 1, 0, 0 ) ( const void *self,
-    const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    /* set function pointer to non-NULL */
-    rslt -> u . rf = select_func;
-    rslt -> variant = vftSelect;
-    return 0;
-}
-
-/* temporary silly stuff
- */
-
-static
-rc_t CC hello_func ( void *self, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    char *func_hello = self;
-    OUTMSG (( "%s - row id %ld\n", func_hello, row_id ));
-    return 0;
-}
-
-VTRANSFACT_BUILTIN_IMPL ( vdb_hello, 1, 0, 0 ) ( const void *self,
-    const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    const char *fact_hello = "vdb:hello factory";
-    const char *func_hello = "vdb:hello function";
-
-    if ( cp -> argc > 0 )
-    {
-        fact_hello = cp -> argv [ 0 ] . data . ascii;
-        if ( cp -> argc > 1 )
-            func_hello = cp -> argv [ 1 ] . data . ascii;
-    }
-
-    rslt -> self = malloc ( strlen ( func_hello ) + 1 );
-    if ( rslt -> self == NULL )
-        return RC ( rcVDB, rcFunction, rcConstructing, rcMemory, rcExhausted );
-    strcpy ( rslt -> self, func_hello );
-    rslt -> whack = free;
-    rslt -> u . rf = hello_func;
-    rslt -> variant = vftRow;
-
-    OUTMSG (( "%s - %u factory params, %u function params\n", fact_hello, cp -> argc, dp -> argc ));
-    return 0;
-}
-
-/* InitFactories
- */
-static
-rc_t CC VLinkerEnterFactory ( KSymTable *tbl, const SchemaEnv *env,
-    LFactory *lfact, const char *name )
-{
-    rc_t rc;
-
-    KTokenSource src;
-    KTokenText tt;
-    KToken t;
-
-    KTokenTextInitCString ( & tt, name, "VLinkerEnterFactory" );
-    KTokenSourceInit ( & src, & tt );
-    next_token ( tbl, & src, & t );
-
-    rc = create_fqn ( tbl, & src, & t, env, ltFactory, lfact );
-    if ( rc == 0 )
-        lfact -> name = t . sym;
-
-    return rc;
-}
-
-
-rc_t VLinkerAddFactories ( VLinker *self,
-    const VLinkerIntFactory *fact, uint32_t count,
-    KSymTable *tbl, const SchemaEnv *env )
-{
-    uint32_t i;
-    for ( i = 0; i < count; ++ i )
-    {
-        rc_t rc;
-        LFactory *lfact = malloc ( sizeof * lfact );
-        if ( lfact == NULL )
-            return RC ( rcVDB, rcFunction, rcRegistering, rcMemory, rcExhausted );
-
-        /* invoke factory to get description */
-        rc = ( * fact [ i ] . f ) ( & lfact -> desc );
-        if ( rc != 0 )
-        {
-            free ( lfact );
-            return rc;
-        }
-
-        /* I am intrinsic and have no dl symbol */
-        lfact -> addr = NULL;
-        lfact -> name = NULL;
-        lfact -> external = false;
-
-        /* add to linker */
-        rc = VectorAppend ( & self -> fact, & lfact -> id, lfact );
-        if ( rc != 0 )
-        {
-            LFactoryWhack ( lfact, NULL );
-            return rc;
-        }
-
-        /* create name */
-        rc = VLinkerEnterFactory ( tbl, env, lfact, fact [ i ] . name );
-        if ( rc != 0 )
-        {
-            void *ignore;
-            VectorSwap ( & self -> fact, lfact -> id, NULL, & ignore );
-            LFactoryWhack ( lfact, NULL );
-            return rc;
-        }
-    }
-
-    return 0;
-}
-
-
-static
-rc_t CC VLinkerEnterSpecial ( KSymTable *tbl, const SchemaEnv *env,
-    LSpecial *lspec, const char *name )
-{
-    rc_t rc;
-
-    KTokenSource src;
-    KTokenText tt;
-    KToken t;
-
-    KTokenTextInitCString ( & tt, name, "VLinkerEnterSpecial" );
-    KTokenSourceInit ( & src, & tt );
-    next_token ( tbl, & src, & t );
-
-    rc = create_fqn ( tbl, & src, & t, env, ltUntyped, lspec );
-    if ( rc == 0 )
-        lspec -> name = t . sym;
-
-    return rc;
-}
-
-typedef struct VLinkerIntSpecial VLinkerIntSpecial;
-struct VLinkerIntSpecial
-{
-    bool ( CC * f ) ( struct KTable const *tbl, struct KMetadata const *meta );
-    const char *name;
-};
-
-static
-rc_t VLinkerAddUntyped ( VLinker *self,
-    const VLinkerIntSpecial *special, uint32_t count,
-    KSymTable *tbl, const SchemaEnv *env )
-{
-    uint32_t i;
-    for ( i = 0; i < count; ++ i )
-    {
-        rc_t rc;
-        LSpecial *lspec = malloc ( sizeof * lspec );
-        if ( lspec == NULL )
-            return RC ( rcVDB, rcFunction, rcRegistering, rcMemory, rcExhausted );
-
-        /* I am intrinsic and have no dl symbol */
-        lspec -> addr = NULL;
-        lspec -> name = NULL;
-        lspec -> func = special [ i ] . f;
-
-        /* add to linker */
-        rc = VectorAppend ( & self -> special, & lspec -> id, lspec );
-        if ( rc != 0 )
-        {
-            LSpecialWhack ( lspec, NULL );
-            return rc;
-        }
-
-        /* create name */
-        rc = VLinkerEnterSpecial ( tbl, env, lspec, special [ i ] . name );
-        if ( rc != 0 )
-        {
-            void *ignore;
-            VectorSwap ( & self -> special, lspec -> id, NULL, & ignore );
-            LSpecialWhack ( lspec, NULL );
-            return rc;
-        }
-    }
-
-    return 0;
-}
-
-/* InitFactories
- */
-rc_t VLinkerInitFactoriesRead ( VLinker *self,  KSymTable *tbl, const SchemaEnv *env )
-{
-    static VLinkerIntFactory fact [] =
-    {
-        { vdb_cast, "vdb:cast" },
-        { vdb_redimension, "vdb:redimension" },
-        { vdb_row_id, "vdb:row_id" },
-        { vdb_row_len, "vdb:row_len" },
-        { vdb_fixed_row_len, "vdb:fixed_row_len" },
-        { vdb_select, "vdb:select" },
-        { vdb_compare, "vdb:compare" },
-        { vdb_no_compare, "vdb:no_compare" },
-        { vdb_range_validate, "vdb:range_validate" },
-        { vdb_merge, "vdb:merge" },
-        { vdb_split, "vdb:split" },
-        { vdb_transpose, "vdb:transpose" },
-        { vdb_detranspose, "vdb:detranspose" },
-        { vdb_delta_average, "vdb:delta_average" },
-        { vdb_undelta_average, "vdb:undelta_average" },
-        { meta_read, "meta:read" },
-        { meta_value, "meta:value" },
-        { meta_attr_read, "meta:attr:read" },
-        { idx_text_project, "idx:text:project" },
-        { idx_text_lookup, "idx:text:lookup" },
-        { parameter_read, "parameter:read" },
-/*        { environment_read, "environment:read" }, */
-
-        { ALIGN_align_restore_read, "ALIGN:align_restore_read" },
-        { ALIGN_cigar, "ALIGN:cigar" },
-        { ALIGN_cigar_2, "ALIGN:cigar_2" },
-        { ALIGN_generate_has_mismatch, "ALIGN:generate_has_mismatch" },
-        { ALIGN_generate_mismatch, "ALIGN:generate_mismatch" },
-        { ALIGN_generate_mismatch_qual, "ALIGN:generate_mismatch_qual" },
-        { ALIGN_project_from_sequence, "ALIGN:project_from_sequence" },
-        { ALIGN_raw_restore_read, "ALIGN:raw_restore_read" },
-        { ALIGN_ref_restore_read, "ALIGN:ref_restore_read" },
-        { ALIGN_ref_sub_select, "ALIGN:ref_sub_select" },
-        { ALIGN_seq_restore_read, "ALIGN:seq_restore_read" },
-        { INSDC_SEQ_rand_4na_2na, "INSDC:SEQ:rand_4na_2na" },
-        { INSDC_SRA_format_spot_name, "INSDC:SRA:format_spot_name" },
-        { INSDC_SRA_format_spot_name_no_coord, "INSDC:SRA:format_spot_name_no_coord" },
-        { NCBI_SRA_ABI_tokenize_spot_name, "NCBI:SRA:ABI:tokenize_spot_name" },
-        { NCBI_SRA_Helicos_tokenize_spot_name, "NCBI:SRA:Helicos:tokenize_spot_name" },
-        { NCBI_SRA_Illumina_tokenize_spot_name, "NCBI:SRA:Illumina:tokenize_spot_name" },
-        { NCBI_SRA_IonTorrent_tokenize_spot_name, "NCBI:SRA:IonTorrent:tokenize_spot_name" },
-        { NCBI_SRA__454__dynamic_read_desc, "NCBI:SRA:_454_:dynamic_read_desc" },
-        { NCBI_SRA__454__process_position, "NCBI:SRA:_454_:process_position" },
-        { NCBI_SRA__454__tokenize_spot_name, "NCBI:SRA:_454_:tokenize_spot_name" },
-        { NCBI_SRA_bio_start, "NCBI:SRA:bio_start" },
-        { NCBI_SRA_decode_CLIP, "NCBI:SRA:decode:CLIP" },
-        { NCBI_SRA_decode_INTENSITY, "NCBI:SRA:decode:INTENSITY" },
-        { NCBI_SRA_decode_NOISE, "NCBI:SRA:decode:NOISE" },
-        { NCBI_SRA_decode_POSITION, "NCBI:SRA:decode:POSITION" },
-        { NCBI_SRA_decode_QUALITY, "NCBI:SRA:decode:QUALITY" },
-        { NCBI_SRA_decode_READ, "NCBI:SRA:decode:READ" },
-        { NCBI_SRA_decode_SIGNAL, "NCBI:SRA:decode:SIGNAL" },
-        { NCBI_SRA_denormalize, "NCBI:SRA:denormalize" },
-        { NCBI_SRA_extract_coordinates, "NCBI:SRA:extract_coordinates" },
-        { NCBI_SRA_extract_name_coord, "NCBI:SRA:extract_name_coord" },
-        { NCBI_SRA_fix_read_seg, "NCBI:SRA:fix_read_seg" },
-#if HAVE_LINKER_FROM_READN
-        { NCBI_SRA_linker_from_readn, "NCBI:SRA:linker_from_readn" },
-#endif
-        { NCBI_SRA_lookup, "NCBI:SRA:lookup" },
-        { NCBI_SRA_make_position, "NCBI:SRA:make_position" },
-        { NCBI_SRA_make_read_desc, "NCBI:SRA:make_read_desc" },
-        { NCBI_SRA_make_spot_desc, "NCBI:SRA:make_spot_desc" },
-        { NCBI_SRA_normalize, "NCBI:SRA:normalize" },
-#if HAVE_PREFIX_TREE_TO_NAME
-        { NCBI_SRA_prefix_tree_to_name, "NCBI:SRA:prefix_tree_to_name" },
-#endif
-        { NCBI_SRA_qual4_decode, "NCBI:SRA:qual4_decode" },
-        { NCBI_SRA_qual4_decompress_v1, "NCBI:SRA:qual4_decompress_v1" },
-#if HAVE_READ_LEN_FROM_NREADS
-        { NCBI_SRA_read_len_from_nreads, "NCBI:SRA:read_len_from_nreads" },
-        { NCBI_SRA_read_start_from_nreads, "NCBI:SRA:read_start_from_nreads" },
-#endif
-        { NCBI_SRA_read_seg_from_readn, "NCBI:SRA:read_seg_from_readn" },
-        { NCBI_SRA_rewrite_spot_name, "NCBI:SRA:rewrite_spot_name" },
-        { NCBI_SRA_rotate, "NCBI:SRA:rotate" },
-        { NCBI_SRA_swap, "NCBI:SRA:swap" },
-        { NCBI_WGS_build_read_type, "NCBI:WGS:build_read_type" },
-        { NCBI_WGS_build_scaffold_qual, "NCBI:WGS:build_scaffold_qual" },
-        { NCBI_WGS_build_scaffold_read, "NCBI:WGS:build_scaffold_read" },
-        { NCBI_WGS_tokenize_nuc_accession, "NCBI:WGS:tokenize_nuc_accession" },
-        { NCBI_WGS_tokenize_prot_accession, "NCBI:WGS:tokenize_prot_accession" },
-        { NCBI_align_clip, "NCBI:align:clip" },
-        { NCBI_align_clip_2, "NCBI:align:clip_2" },
-        { NCBI_align_compress_quality, "NCBI:align:compress_quality" },
-        { NCBI_align_decompress_quality, "NCBI:align:decompress_quality" },
-        { NCBI_align_edit_distance, "NCBI:align:edit_distance" },
-        { NCBI_align_edit_distance_2, "NCBI:align:edit_distance_2" },
-        { NCBI_align_generate_mismatch_qual_2, "NCBI:align:generate_mismatch_qual_2" },
-        { NCBI_align_generate_preserve_qual, "NCBI:align:generate_preserve_qual" },
-        { NCBI_align_get_clipped_cigar, "NCBI:align:get_clipped_cigar" },
-        { NCBI_align_get_clipped_cigar_2, "NCBI:align:get_clipped_cigar_2" },
-        { NCBI_align_get_clipped_ref_offset, "NCBI:align:get_clipped_ref_offset" },
-        { NCBI_align_get_left_soft_clip, "NCBI:align:get_left_soft_clip" },
-        { NCBI_align_get_left_soft_clip_2, "NCBI:align:get_left_soft_clip_2" },
-        { NCBI_align_get_mate_align_id, "NCBI:align:get_mate_align_id" },
-        { NCBI_align_get_mismatch_read, "NCBI:align:get_mismatch_read" },
-        { NCBI_align_get_ref_delete, "NCBI:align:get_ref_delete" },
-        { NCBI_align_get_ref_insert, "NCBI:align:get_ref_insert" },
-        { NCBI_align_get_ref_len, "NCBI:align:get_ref_len" },
-        { NCBI_align_get_ref_mismatch, "NCBI:align:get_ref_mismatch" },
-        { NCBI_align_get_ref_preserve_qual, "NCBI:align:get_ref_preserve_qual" },
-        { NCBI_align_get_seq_preserve_qual, "NCBI:align:get_seq_preserve_qual" },
-        { NCBI_align_get_right_soft_clip, "NCBI:align:get_right_soft_clip" },
-        { NCBI_align_get_right_soft_clip_2, "NCBI:align:get_right_soft_clip_2" },
-        { NCBI_align_get_right_soft_clip_3, "NCBI:align:get_right_soft_clip_3" },
-        { NCBI_align_get_right_soft_clip_4, "NCBI:align:get_right_soft_clip_4" },
-        { NCBI_align_get_sam_flags, "NCBI:align:get_sam_flags" },
-        { NCBI_align_get_sam_flags_2, "NCBI:align:get_sam_flags_2" },
-        { NCBI_align_local_ref_id, "NCBI:align:local_ref_id" },
-        { NCBI_align_local_ref_start, "NCBI:align:local_ref_start" },
-        { NCBI_align_make_cmp_read_desc, "NCBI:align:make_cmp_read_desc" },
-        { NCBI_align_make_read_start, "NCBI:align:make_read_start" },
-        { NCBI_align_mismatch_restore_qual, "NCBI:align:mismatch_restore_qual" },
-        { NCBI_align_not_my_row, "NCBI:align:not_my_row" },
-        { NCBI_align_raw_restore_qual, "NCBI:align:raw_restore_qual" },
-        { NCBI_align_ref_name, "NCBI:align:ref_name" },
-        { NCBI_align_ref_pos, "NCBI:align:ref_pos" },
-        { NCBI_align_ref_seq_id, "NCBI:align:ref_seq_id" },
-        { NCBI_align_ref_sub_select_preserve_qual, "NCBI:align:ref_sub_select_preserve_qual" },
-        { NCBI_align_seq_construct_read, "NCBI:align:seq_construct_read" },
-        { NCBI_align_template_len, "NCBI:align:template_len" },
-        { NCBI_color_from_dna, "NCBI:color_from_dna" },
-        { NCBI_dna_from_color, "NCBI:dna_from_color" },
-        { NCBI_fp_extend, "NCBI:fp_extend" },
-        { NCBI_lower_case_tech_reads, "NCBI:lower_case_tech_reads" },
-        { NCBI_unpack, "NCBI:unpack" },
-        { NCBI_unzip, "NCBI:unzip" },
-        { NCBI_var_tokenize_var_id, "NCBI:var:tokenize_var_id" },
-        { vdb_add_row_id, "vdb:add_row_id" },
-        { vdb_bit_or, "vdb:bit_or" },
-        { vdb_bunzip, "vdb:bunzip" },
-        { vdb_ceil, "vdb:ceil" },
-        { vdb_clip, "vdb:clip" },
-        { vdb_cut, "vdb:cut" },
-        { vdb_delta, "vdb:delta" },
-        { vdb_deriv, "vdb:deriv" },
-        { vdb_diff, "vdb:diff" },
-        { vdb_echo, "vdb:echo" },
-        { vdb_exists, "vdb:exists" },
-        { vdb_extract_token, "vdb:extract_token" },
-        { vdb_fixed_vec_sum, "vdb:fixed_vec_sum" },
-        { vdb_floor, "vdb:floor" },
-        { vdb_funzip, "vdb:funzip" },
-        { vdb_integral, "vdb:integral" },
-        { vdb_integral_0, "vdb:integral_0" },
-        { vdb_iunzip, "vdb:iunzip" },
-        { vdb_izip, "vdb:izip" },
-        { vdb_map, "vdb:map" },
-        { vdb_max, "vdb:max" },
-        { vdb_min, "vdb:min" },
-        { vdb_outlier_decode, "vdb:outlier_decode" },
-        { vdb_outlier_encode, "vdb:outlier_encode" },
-        { vdb_pack, "vdb:pack" },
-        { vdb_paste, "vdb:paste" },
-        { vdb_rldecode, "vdb:rldecode" },
-        { vdb_round, "vdb:round" },
-        { vdb_simple_sub_select_1, "vdb:simple_sub_select_1" },
-        { vdb_sprintf, "vdb:sprintf" },
-        { vdb_strtonum, "vdb:strtonum" },
-        { vdb_subtract_row_id, "vdb:subtract_row_id" },
-        { vdb_sum, "vdb:sum" },
-        { vdb_trim, "vdb:trim" },
-        { vdb_trunc, "vdb:trunc" },
-        { vdb_undelta, "vdb:undelta" },
-        { vdb_unpack, "vdb:unpack" },
-        { vdb_unzip, "vdb:unzip" },
-        { vdb_vec_sum, "vdb:vec_sum" },
-
-        { vdb_hello, "vdb:hello" }
-    };
-
-    static VLinkerIntSpecial special [] =
-    {
-        { NCBI_SRA_accept_untyped, "NCBI:SRA:accept_untyped" },
-        { NCBI_SRA__454__untyped_0, "NCBI:SRA:_454_:untyped_0" },
-        { NCBI_SRA__454__untyped_1_2a, "NCBI:SRA:_454_:untyped_1_2a" },
-        { NCBI_SRA__454__untyped_1_2b, "NCBI:SRA:_454_:untyped_1_2b" },
-        { NCBI_SRA_Illumina_untyped_0a, "NCBI:SRA:Illumina:untyped_0a" },
-        { NCBI_SRA_Illumina_untyped_0b, "NCBI:SRA:Illumina:untyped_0b" },
-        { NCBI_SRA_Illumina_untyped_1a, "NCBI:SRA:Illumina:untyped_1a" },
-        { NCBI_SRA_Illumina_untyped_1b, "NCBI:SRA:Illumina:untyped_1b" },
-        { NCBI_SRA_ABI_untyped_1, "NCBI:SRA:ABI:untyped_1" }
-    };
-
-    rc_t rc = VLinkerAddFactories ( self, fact, sizeof fact / sizeof fact [ 0 ], tbl, env );
-    if ( rc == 0 )
-        rc = VLinkerAddUntyped ( self, special, sizeof special / sizeof special [ 0 ], tbl, env );
-    return rc;
-}
-
-
-/* MakeIntrinsic
- *  creates an initial, intrinsic linker
- *  pre-loaded with intrinsic factories
- */
-rc_t VLinkerMakeIntrinsic ( VLinker **lp )
-{
-    KDyld *dl;
-    rc_t rc = KDyldMake ( & dl );
-    if ( rc == 0 )
-    {
-        rc = VLinkerMake ( lp, NULL, dl );
-        KDyldRelease ( dl );
-
-        if ( rc == 0 )
-        {
-            KSymTable tbl;
-            VLinker *self = * lp;
-
-            /* create symbol table with no intrinsic scope */
-            rc = KSymTableInit ( & tbl, NULL );
-            if ( rc == 0 )
-            {
-                SchemaEnv env;
-                SchemaEnvInit ( & env, EXT_SCHEMA_LANG_VERSION );
-
-                /* make intrinsic scope modifiable */
-                KSymTablePushScope ( & tbl, & self -> scope );
-
-                /* add intrinsic functions */
-                rc = VLinkerInitFactories ( self, & tbl, & env );
-                if ( rc == 0 )
-                {
-                    KSymTableWhack ( & tbl );
-                    return 0;
-                }
-
-                KSymTableWhack ( & tbl );
-            }
-
-            VLinkerRelease ( self );
-        }
-    }
-
-    * lp = NULL;
-
-    return rc;
-}
diff --git a/libs/vdb/linker-priv.h b/libs/vdb/linker-priv.h
deleted file mode 100644
index 141c8d7..0000000
--- a/libs/vdb/linker-priv.h
+++ /dev/null
@@ -1,271 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_linker_priv_
-#define _h_linker_priv_
-
-#ifndef _h_vdb_extern_
-#include <vdb/extern.h>
-#endif
-
-#ifndef _h_klib_token_
-#include <klib/token.h>
-#endif
-
-#ifndef _h_vdb_xform_
-#include <vdb/xform.h>
-#endif
-
-#ifndef _h_vdb_vdb_priv_
-#include <vdb/vdb-priv.h>
-#endif
-
-#ifndef _h_klib_container_
-#include <klib/container.h>
-#endif
-
-#ifndef _h_klib_vector_
-#include <klib/vector.h>
-#endif
-
-#ifndef _h_klib_refcount_
-#include <klib/refcount.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KSymbol;
-struct KSymTable;
-struct KNamelist;
-struct KDyld;
-struct KDlset;
-struct KSymAddr;
-struct SFunction;
-struct SchemaEnv;
-struct VTransDesc;
-
-
-/*--------------------------------------------------------------------------
- * linker symbol types
- */
-enum
-{
-    ltFactory = eNumSymtabIDs,
-    ltUntyped
-};
-
-
-/*--------------------------------------------------------------------------
- * VLinker
- *  responsible for performing runtime schema resolution
- *  and C factory/function management
- *
- *  a schema will be declared with conditional productions and
- *  references to C functions. at load time, all schema expressions
- *  will be evaluated, unused conditional productions pruned,
- *  function references resolved, function objects created,
- *  and all paths rejected due to errors of any sort eliminated,
- *  leaving the final runtime schema.
- *
- *  the current implementation
- */
-typedef struct VLinker VLinker;
-struct VLinker
-{
-    /* dynamic loader */
-    struct KDyld *dl;
-
-    /* parent loader */
-    const VLinker *dad;
-
-    /* global scope for functions */
-    BSTree scope;
-
-    /* factory objects */
-    Vector fact;
-
-    /* special funcs */
-    Vector special;
-
-    KRefcount refcount;
-};
-
-
-/* Make
- *  creates an empty linker
- */
-rc_t VLinkerMake ( VLinker **lp, const VLinker *dad, struct KDyld *dl );
-
-/* MakeIntrinsic
- *  creates an initial, intrinsic linker
- *  pre-loaded with intrinsic factories
- */
-rc_t VLinkerMakeIntrinsic ( VLinker **intrinsic );
-
-/* InitFactories
- *  initialize intrinsic factories
- *
- *  "tbl" [ IN ] - linker-scope symbol table
- *
- *  "env" [ IN ] - default schema parser environment
- */
-rc_t VLinkerInitFactories ( VLinker *self,
-    struct KSymTable *tbl, struct SchemaEnv const *env );
-rc_t VLinkerInitFactoriesRead ( VLinker *self,
-    struct KSymTable *tbl, struct SchemaEnv const *env );
-
-/* AddFactories
- *  add a list of intrinsic factories
- *
- *  "fact" [ IN ] and "count" [ IN ] - list of intrinsic factories to register
- *
- *  "tbl" [ IN ] - linker-scope symbol table
- *
- *  "env" [ IN ] - default schema parser environment
- */
-typedef struct VLinkerIntFactory VLinkerIntFactory;
-struct VLinkerIntFactory
-{
-    rc_t ( CC * f ) ( struct VTransDesc *desc );
-    const char *name;
-};
-
-rc_t VLinkerAddFactories ( VLinker *self,
-    const VLinkerIntFactory *fact, uint32_t count,
-    struct KSymTable *tbl, struct SchemaEnv const *env );
-
-
-/* Release
- */
-rc_t VLinkerRelease ( const VLinker *self );
-
-/* Attach
- * Sever
- */
-VLinker *VLinkerAttach ( const VLinker *self );
-rc_t VLinkerSever ( const VLinker *self );
-
-
-/* AddLoadLibraryPath
- *  add a path[s] to loader for locating dynamic libraries
- */
-rc_t VLinkerVAddLoadLibraryPath ( const VLinker *self,
-    const char *path, va_list args );
-
-
-/* Open
- *  opens libraries for search
- */
-rc_t VLinkerOpen ( const VLinker *self, struct KDlset **libs );
-
-
-/* Find
- *  find a named symbol
- *
- *  "libs" [ IN ] - set of open libraries to search
- *
- *  "desc" [ OUT ] - transform factory description
- *  "func" [ OUT ] - return parameter for func pointer
- *
- *  "proto" [ IN ] - function prototype from schema
- *
- *  "external" [ OUT ] - true if function is not built-in
- */
-rc_t VLinkerFindFactory ( VLinker *self, struct KDlset const *libs,
-    VTransDesc *desc, struct SFunction const *proto, bool *external );
-rc_t VLinkerFindNamedFactory ( VLinker *self, struct KDlset const *libs,
-    VTransDesc *desc, const char *fact_name );
-rc_t VLinkerFindUntyped ( VLinker *self, struct KDlset const *libs,
-    VUntypedTableTest *func, struct SFunction const *proto );
-
-
-/* ListExternalSchemaModules
- */
-rc_t VLinkerListExternalSchemaModules ( const VLinker *self,
-    struct KNamelist **list );
-
-
-/*--------------------------------------------------------------------------
- * LFactory
- *  describes an external C function factory
- */
-typedef struct LFactory LFactory;
-struct LFactory
-{
-    /* factory function address */
-    struct KSymAddr const *addr;
-
-    /* factory name */
-    struct KSymbol const *name;
-
-    /* factory description */
-    VTransDesc desc;
-
-    /* factory id */
-    uint32_t id;
-
-    /* externally supplied factory */
-    bool external;
-};
-
-/* Whack
- */
-void CC LFactoryWhack ( void *item, void *ignore );
-
-
-/*--------------------------------------------------------------------------
- * LSpecial
- *  describes an external C table recognition function
- *  or a row-length function
- */
-typedef struct LSpecial LSpecial;
-struct LSpecial
-{
-    /* function address */
-    struct KSymAddr const *addr;
-
-    /* func name */
-    struct KSymbol const *name;
-
-    /* for built-in address */
-    VUntypedFunc func;
-
-    /* func id */
-    uint32_t id;
-};
-
-/* Whack
- */
-void CC LSpecialWhack ( void *item, void *ignore );
-
-
-#endif /* _h_linker_priv_ */
diff --git a/libs/vdb/linker.c b/libs/vdb/linker.c
deleted file mode 100644
index 1351a61..0000000
--- a/libs/vdb/linker.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#define TRACK_REFERENCES 0
-
-#include "linker-priv.h"
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-
-/* InitFactories
- */
-rc_t VLinkerInitFactories ( VLinker *self, struct KSymTable *tbl, struct SchemaEnv const *env )
-{
-    return VLinkerInitFactoriesRead ( self, tbl, env );
-}
diff --git a/libs/vdb/merge.c b/libs/vdb/merge.c
deleted file mode 100644
index 918f24f..0000000
--- a/libs/vdb/merge.c
+++ /dev/null
@@ -1,215 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#include "blob.h"
-
-#include "blob-headers.h"
-#include "page-map.h"
-#include "blob-priv.h"
-#include "xform-priv.h"
-
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <atomic32.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-
-static unsigned uniq_list( unsigned dst[], void **list, unsigned N ) {
-    unsigned i;
-    unsigned j;
-    unsigned n;
-    void *on_stack[16];
-    void **uniq = on_stack;
-    void **on_heap = 0;
-    
-    if (N > sizeof(on_stack) / sizeof(on_stack[0])) {
-        on_heap = malloc(N * sizeof(on_heap[0]));
-        uniq = on_heap;
-    }
-    for (i = 0, n = 0; i != N; ++i) {
-        for (j = 0; j != n; ++j) {
-            if (uniq[j] == list[i])
-                break;
-        }
-        dst[i] = j;
-        if (j == n) {
-            uniq[j] = list[i];
-            ++n;
-        }
-    }
-    memcpy(list, uniq, n * sizeof(list[0]));
-    if (on_heap)
-        free(on_heap);
-    return n;
-}
-
-static
-rc_t CC VBlobCreateMerged( VBlob **lhs, uint32_t num_inputs, const VBlob *input[] ) {
-    unsigned i;
-    KDataBuffer buffer;
-    BlobHeaders *headers;
-    VBlobHeader *hdr;
-    rc_t rc;
-    uint64_t sz = 0;
-    uint32_t bsize;
-    
-/*
-     headers:
-         args:
-             num_inputs
-             num_row_maps
-             row_map_number[num_inputs]
-             length(row_map)[num_row_maps]
-             length(header)[num_inputs]
-             length(data_blob)[num_inputs]
-     data:
-         row_map[num_row_maps]
-         header[num_inputs]
-         data_blob[num_inputs]
- */
-    
-    for (i = 1; i != num_inputs; ++i) {
-        if (input[0]->start_id != input[i]->start_id || input[0]->stop_id != input[i]->stop_id)
-            return RC(rcVDB, rcBlob, rcConstructing, rcParam, rcInvalid);
-    }
-    
-    rc = BlobHeadersCreate(&headers);
-    if (rc)
-        return rc;
-    
-    hdr = BlobHeadersGetHdrWrite(headers);
-    if (hdr == NULL) {
-        BlobHeadersRelease(headers);
-        return RC(rcVDB, rcFunction, rcExecuting, rcMemory, rcExhausted);
-    }
-    rc = KDataBufferMakeBytes(&buffer, bsize = 0);
-    if (rc) {
-        VBlobHeaderRelease(hdr);
-        BlobHeadersRelease(headers);
-        return rc;
-    }
-    VBlobHeaderSetFormat(hdr, 0); /* TBD: set format id to correct value for merged or do it in caller */
-    VBlobHeaderSetVersion(hdr, 1);
-    
-    VBlobHeaderArgPushTail(hdr, num_inputs);
-    
-    {
-        unsigned *v;
-        PageMap **pm;
-        unsigned n;
-		
-        v = malloc(num_inputs * sizeof(*v));
-        pm = malloc(num_inputs * sizeof(*pm));
-        for (i = 0; i != num_inputs; ++i) {
-            pm[i] = input[i]->pm;
-        }
-        n = uniq_list(v, (void **)pm, num_inputs);
-        VBlobHeaderArgPushTail(hdr, n);
-        for (i = 0; i != num_inputs; ++i)
-            VBlobHeaderArgPushTail(hdr, v[i]);
-        free(v);
-        for (i = 0; rc == 0 && i != n; ++i) {
-            rc = PageMapSerialize(pm[i], &buffer, bsize, &sz);
-            VBlobHeaderArgPushTail(hdr, sz);
-            bsize += sz;
-        }
-        free(pm);
-    }
-    
-    for (i = 0; rc == 0 && i != num_inputs; ++i) {
-        if (input[i]->headers) {
-            rc = BlobHeadersSerialize(input[i]->headers, &buffer, bsize, &sz);
-            VBlobHeaderArgPushTail(hdr, sz);
-            bsize += sz;
-        }
-        else
-            VBlobHeaderArgPushTail(hdr, 0);
-    }
-    
-    for (i = 0; rc == 0 && i != num_inputs; ++i) {
-        const VBlob *o = input[i];
-        
-        sz = (uint32_t)BlobBufferBits( o );
-        rc = VBlobHeaderArgPushTail( hdr, sz );
-        sz = (sz + 7) >> 3;
-        if (rc == 0) {
-            rc = KDataBufferResize(&buffer, bsize + sz);
-            if (rc == 0) {
-                memcpy((uint8_t *)buffer.base + bsize, o->data.base, sz);
-                bsize += sz;
-            }
-        }
-    }
-    VBlobHeaderRelease(hdr);
-    if (rc == 0) {
-        VBlob *y;
-        
-        rc = VBlobNew(&y, input[0]->start_id, input[0]->stop_id, "merge");
-        if (rc == 0) {
-            y->headers = headers;
-            KDataBufferSub(&buffer, &y->data, 0, UINT64_MAX);
-            
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-            y->byte_order = vboLittleEndian;
-#else
-            y->byte_order = vboBigEndian;
-#endif
-            *lhs = y;
-	    KDataBufferWhack(&buffer);
-            return 0;
-        }
-        rc = RC(rcVDB, rcBlob, rcConstructing, rcMemory, rcExhausted);
-    }
-    KDataBufferWhack(&buffer);
-    BlobHeadersRelease(headers);
-    
-    return rc;
-}
-
-static
-rc_t CC vdb_merge_impl(
-                    void *self,
-                    const VXformInfo *info,
-                    int64_t row_id,
-                    VBlob **rslt,
-                    uint32_t argc, const VBlob *argv[]
-) {
-	return VBlobCreateMerged(rslt, argc, argv);
-}
-
-VTRANSFACT_BUILTIN_IMPL(vdb_merge, 1, 0, 0) (const void *self, const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-	rslt->variant = vftBlobN;
-    VFUNCDESC_INTERNAL_FUNCS(rslt)->bfN = vdb_merge_impl;
-	return 0;
-}
diff --git a/libs/vdb/meta-append.c b/libs/vdb/meta-append.c
deleted file mode 100644
index 1ea05f4..0000000
--- a/libs/vdb/meta-append.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <vdb/extern.h>
-
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/table.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <bitstr.h>
-#include <sysalloc.h>
-
-#include "schema-priv.h"
-#include "xform-priv.h"
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-typedef struct self_t {
-    KMDataNode *node;
-    void ( * byte_swap ) ( void *dst, const void *src, uint64_t count );    
-} self_t;
-
-static void CC self_whack( void *vp ) {
-    self_t *self = vp;
-    
-    KMDataNodeRelease( self->node );
-    free( vp );
-}
-
-static
-rc_t CC meta_append_func(
-                     void *Self,
-                     const VXformInfo *info,
-                     int64_t row_id,
-                     VRowResult *rslt,
-                     uint32_t argc,
-                     const VRowData argv[]
-) {
-    self_t *self = Self;
-    char sbuf[1024];
-    void *buf = sbuf;
-    void *hbuf = 0;
-    bitsz_t offset = (argv[0].u.data.first_elem * argv[0].u.data.elem_bits);
-    bitsz_t blen = argv[0].u.data.elem_count * argv[0].u.data.elem_bits;
-    size_t length = (blen + 7) >> 3;
-    rc_t rc = 0;
-    
-    if (length > sizeof(sbuf)) {
-        hbuf = malloc(length);
-        if (hbuf == NULL)
-            return RC(rcVDB, rcFunction, rcExecuting, rcMemory, rcExhausted);
-        buf = hbuf;
-    }
-    
-    if (self->byte_swap)
-        self->byte_swap(buf, ((const uint8_t *)argv[0].u.data.base) + offset, argv[0].u.data.elem_count);
-    else {
-        memset(buf, 0, length);
-        bitcpy(buf, 0, argv[0].u.data.base, offset, blen);
-    }
-    
-    rc = KMDataNodeAppend(self->node, buf, length);
-    if (hbuf)
-        free(hbuf);
-    
-    if (rc == 0) {
-        rslt->elem_count = argv[0].u.data.elem_count;
-        rslt->elem_bits = argv[0].u.data.elem_bits;
-        assert(rslt->data->elem_bits == rslt->elem_bits);
-        rc = KDataBufferResize(rslt->data, rslt->elem_count);
-        if (rc == 0)
-            bitcpy(rslt->data->base, 0, argv[0].u.data.base, offset, blen);
-    }
-    return rc;
-}
-
-/* 
- */
-VTRANSFACT_BUILTIN_IMPL(meta_append, 1, 0, 0) (const void *Self, const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rc_t rc = 0;
-    self_t *self;
-    SDatatype *sdt;
-    bool need_byte_swap;
-    
-    sdt = VSchemaFindTypeid(info->schema, info->fdesc.fd.td.type_id);
-    assert(sdt != NULL);
-    
-	self = calloc(1, sizeof(self_t));
-	if (self) {
-        KMetadata *meta;
-        
-        rc = VTableOpenMetadataUpdate((VTable *)info->tbl, &meta);
-        if (rc == 0) {
-            rc = KMetadataOpenNodeUpdate(meta, &self->node, cp->argv[0].data.ascii);
-            KMetadataRelease(meta);
-            if (rc == 0) {
-                KMDataNodeByteOrder(self->node, &need_byte_swap);
-                if (need_byte_swap)
-                    self->byte_swap = sdt->byte_swap;
-                
-                rslt->self = self;
-                rslt->whack = self_whack;
-                
-                rslt->variant = vftNonDetRow;
-                rslt->u.ndf = meta_append_func;
-                
-                return 0;
-            }
-        }
-        self_whack(self);
-	}
-	else
-		rc = RC(rcVDB, rcFunction, rcConstructing, rcMemory, rcExhausted);
-        return rc;
-}
diff --git a/libs/vdb/meta-attr-read.c b/libs/vdb/meta-attr-read.c
deleted file mode 100644
index cb0324f..0000000
--- a/libs/vdb/meta-attr-read.c
+++ /dev/null
@@ -1,448 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/table.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <klib/text.h>
-#include <sysalloc.h>
-#include "xform-priv.h"
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-typedef struct self_t {
-    const KMDataNode *node;
-    char *name;
-    KDataBuffer value;
-} self_t;
-
-static void CC self_whack( void *vp ) {
-    self_t *self = vp;
-    
-    KDataBufferWhack( &self->value );
-    free( self->name );
-    KMDataNodeRelease( self->node );
-    free( vp );
-}
-
-static
-rc_t CC meta_attr_read_cstring(
-                            void *Self,
-                            const VXformInfo *info,
-                            int64_t row_id,
-                            VRowResult *rslt,
-                            uint32_t argc,
-                            const VRowData argv[]
-) {
-    self_t *self = Self;
-    size_t length;
-    rc_t rc = 0;
-    
-    rc = KMDataNodeReadAttr(self->node, self->name, 0, 0, &length);
-    if (rc)
-        return rc;
-    rc = KDataBufferResize( &self->value, (uint32_t)( length + 1 ) );
-    if (rc)
-        return rc;
-    rc = KMDataNodeReadAttr( self->node, self->name, self->value.base, self->value.elem_count, &length );
-    if (rc)
-        return rc;
-    KDataBufferWhack( rslt->data );
-    KDataBufferSub( &self->value, rslt->data, 0, (uint32_t)length );
-    rslt->elem_count = (uint32_t)length;
-	return 0;
-}
-
-static
-rc_t CC meta_attr_read_bool(
-                       void *Self,
-                       const VXformInfo *info,
-                       int64_t row_id,
-                       VRowResult *rslt,
-                       uint32_t argc,
-                       const VRowData argv[]
-) {
-    const self_t *self = Self;
-    int16_t value;
-    rc_t rc = 0;
-    
-    rc = KMDataNodeReadAttrAsI16(self->node, self->name, &value);
-    if (rc)
-        return rc;
-    *(bool *)self->value.base = value == 0 ? false : true;
-    KDataBufferWhack(rslt->data);
-    KDataBufferSub(&self->value, rslt->data, 0, UINT64_MAX);
-    rslt->elem_count = 1;
-	return 0;
-}
-
-static
-rc_t CC meta_attr_read_I8(
-                        void *Self,
-                        const VXformInfo *info,
-                        int64_t row_id,
-                        VRowResult *rslt,
-                        uint32_t argc,
-                        const VRowData argv[]
-) {
-    const self_t *self = Self;
-    int16_t value;
-    rc_t rc = 0;
-    
-    rc = KMDataNodeReadAttrAsI16(self->node, self->name, &value);
-    if (rc)
-        return rc;
-    *(int8_t *)self->value.base = (int8_t)value;
-    KDataBufferWhack(rslt->data);
-    KDataBufferSub(&self->value, rslt->data, 0, UINT64_MAX);
-    rslt->elem_count = 1;
-	return 0;
-}
-
-static
-rc_t CC meta_attr_read_U8(
-                        void *Self,
-                        const VXformInfo *info,
-                        int64_t row_id,
-                        VRowResult *rslt,
-                        uint32_t argc,
-                        const VRowData argv[]
-) {
-    const self_t *self = Self;
-    uint16_t value;
-    rc_t rc = 0;
-    
-    rc = KMDataNodeReadAttrAsU16(self->node, self->name, &value);
-    if (rc)
-        return rc;
-    *(uint8_t *)self->value.base = (int8_t)value;
-    KDataBufferWhack(rslt->data);
-    KDataBufferSub(&self->value, rslt->data, 0, UINT64_MAX);
-    rslt->elem_count = 1;
-	return 0;
-}
-
-static
-rc_t CC meta_attr_read_I16(
-                        void *Self,
-                        const VXformInfo *info,
-                        int64_t row_id,
-                        VRowResult *rslt,
-                        uint32_t argc,
-                        const VRowData argv[]
-) {
-    const self_t *self = Self;
-    int16_t *value = self->value.base;
-    rc_t rc = 0;
-    
-    rc = KMDataNodeReadAttrAsI16(self->node, self->name, value);
-    if (rc)
-        return rc;
-    KDataBufferWhack(rslt->data);
-    KDataBufferSub(&self->value, rslt->data, 0, UINT64_MAX);
-    rslt->elem_count = 1;
-	return 0;
-}
-
-static
-rc_t CC meta_attr_read_U16(
-                        void *Self,
-                        const VXformInfo *info,
-                        int64_t row_id,
-                        VRowResult *rslt,
-                        uint32_t argc,
-                        const VRowData argv[]
-) {
-    const self_t *self = Self;
-    uint16_t *value = self->value.base;
-    rc_t rc = 0;
-    
-    rc = KMDataNodeReadAttrAsU16(self->node, self->name, value);
-    if (rc)
-        return rc;
-    KDataBufferWhack(rslt->data);
-    KDataBufferSub(&self->value, rslt->data, 0, UINT64_MAX);
-    rslt->elem_count = 1;
-	return 0;
-}
-
-static
-rc_t CC meta_attr_read_I32(
-                        void *Self,
-                        const VXformInfo *info,
-                        int64_t row_id,
-                        VRowResult *rslt,
-                        uint32_t argc,
-                        const VRowData argv[]
-) {
-    const self_t *self = Self;
-    int32_t *value = self->value.base;
-    rc_t rc = 0;
-    
-    rc = KMDataNodeReadAttrAsI32(self->node, self->name, value);
-    if (rc)
-        return rc;
-    KDataBufferWhack(rslt->data);
-    KDataBufferSub(&self->value, rslt->data, 0, UINT64_MAX);
-    rslt->elem_count = 1;
-	return 0;
-}
-
-static
-rc_t CC meta_attr_read_U32(
-                        void *Self,
-                        const VXformInfo *info,
-                        int64_t row_id,
-                        VRowResult *rslt,
-                        uint32_t argc,
-                        const VRowData argv[]
-) {
-    const self_t *self = Self;
-    uint32_t *value = self->value.base;
-    rc_t rc = 0;
-    
-    rc = KMDataNodeReadAttrAsU32(self->node, self->name, value);
-    if (rc)
-        return rc;
-    KDataBufferWhack(rslt->data);
-    KDataBufferSub(&self->value, rslt->data, 0, UINT64_MAX);
-    rslt->elem_count = 1;
-	return 0;
-}
-
-static
-rc_t CC meta_attr_read_I64(
-                        void *Self,
-                        const VXformInfo *info,
-                        int64_t row_id,
-                        VRowResult *rslt,
-                        uint32_t argc,
-                        const VRowData argv[]
-) {
-    const self_t *self = Self;
-    int64_t *value = self->value.base;
-    rc_t rc = 0;
-    
-    rc = KMDataNodeReadAttrAsI64(self->node, self->name, value);
-    if (rc)
-        return rc;
-    KDataBufferWhack(rslt->data);
-    KDataBufferSub(&self->value, rslt->data, 0, UINT64_MAX);
-    rslt->elem_count = 1;
-	return 0;
-}
-
-static
-rc_t CC meta_attr_read_U64(
-                        void *Self,
-                        const VXformInfo *info,
-                        int64_t row_id,
-                        VRowResult *rslt,
-                        uint32_t argc,
-                        const VRowData argv[]
-) {
-    const self_t *self = Self;
-    uint64_t *value = self->value.base;
-    rc_t rc = 0;
-    
-    rc = KMDataNodeReadAttrAsU64(self->node, self->name, value);
-    if (rc)
-        return rc;
-    KDataBufferWhack(rslt->data);
-    KDataBufferSub(&self->value, rslt->data, 0, UINT64_MAX);
-    rslt->elem_count = 1;
-	return 0;
-}
-
-static
-rc_t CC meta_attr_read_F32(
-                        void *Self,
-                        const VXformInfo *info,
-                        int64_t row_id,
-                        VRowResult *rslt,
-                        uint32_t argc,
-                        const VRowData argv[]
-) {
-    const self_t *self = Self;
-    double value;
-    rc_t rc = 0;
-    
-    rc = KMDataNodeReadAttrAsF64(self->node, self->name, &value);
-    if (rc)
-        return rc;
-    *(float *)self->value.base = (float)value;
-    KDataBufferWhack(rslt->data);
-    KDataBufferSub(&self->value, rslt->data, 0, UINT64_MAX);
-    rslt->elem_count = 1;
-	return 0;
-}
-
-static
-rc_t CC meta_attr_read_F64(
-                        void *Self,
-                        const VXformInfo *info,
-                        int64_t row_id,
-                        VRowResult *rslt,
-                        uint32_t argc,
-                        const VRowData argv[]
-) {
-    const self_t *self = Self;
-    double *value = self->value.base;
-    rc_t rc = 0;
-    
-    rc = KMDataNodeReadAttrAsF64(self->node, self->name, value);
-    if (rc)
-        return rc;
-    KDataBufferWhack(rslt->data);
-    KDataBufferSub(&self->value, rslt->data, 0, UINT64_MAX);
-    rslt->elem_count = 1;
-	return 0;
-}
-
-/* 
- function ascii meta:attr:read #1.0 < ascii node, ascii attr, * bool deterministic > ();
- */
-VTRANSFACT_BUILTIN_IMPL(meta_attr_read, 1, 0, 0) (const void *Self, const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rc_t rc = 0;
-    self_t *self;
-    bool variable = false;
-    rc_t ( CC * var_row_func )(
-                         void *Self,
-                         const VXformInfo *info,
-                         int64_t row_id,
-                         VRowResult *rslt,
-                         uint32_t argc,
-                         const VRowData argv[]
-                         );
-    bool deterministic = true;
-    
-    if (cp->argc > 2)
-        deterministic = cp->argv[2].data.b[0];
-    
-    switch (info->fdesc.desc.domain) {
-    case vtdBool:
-        var_row_func = meta_attr_read_bool;
-        break;
-    case vtdInt:
-        switch (info->fdesc.desc.intrinsic_bits) {
-        case 8:
-            var_row_func = meta_attr_read_I8;
-            break;
-        case 16:
-            var_row_func = meta_attr_read_I16;
-            break;
-        case 32:
-            var_row_func = meta_attr_read_I32;
-            break;
-        case 64:
-            var_row_func = meta_attr_read_I64;
-            break;
-        default:
-            return RC(rcVDB, rcFunction, rcConstructing, rcType, rcInvalid);
-        }
-        break;
-    case vtdUint:
-        switch (info->fdesc.desc.intrinsic_bits) {
-        case 8:
-            var_row_func = meta_attr_read_U8;
-            break;
-        case 16:
-            var_row_func = meta_attr_read_U16;
-            break;
-        case 32:
-            var_row_func = meta_attr_read_U32;
-            break;
-        case 64:
-            var_row_func = meta_attr_read_U64;
-            break;
-        default:
-            return RC(rcVDB, rcFunction, rcConstructing, rcType, rcInvalid);
-        }
-        break;
-    case vtdFloat:
-        switch (info->fdesc.desc.intrinsic_bits) {
-        case 32:
-            var_row_func = meta_attr_read_F32;
-            break;
-        case 64:
-            var_row_func = meta_attr_read_F64;
-            break;
-        default:
-            return RC(rcVDB, rcFunction, rcConstructing, rcType, rcInvalid);
-        }
-        break;
-    case vtdAscii:
-        variable = true;
-        var_row_func = meta_attr_read_cstring;
-        break;
-    default:
-        return RC(rcVDB, rcFunction, rcConstructing, rcType, rcInvalid);
-    }
-    
-	self = calloc(1, sizeof(self_t));
-	if (self) {
-        self->name = malloc(cp->argv[1].count + 1);
-        if (self->name) {
-            string_copy(self->name, cp->argv[1].count + 1, cp->argv[1].data.ascii,cp->argv[1].count);
-            if (!variable)
-                rc = KDataBufferMake(&self->value, info->fdesc.desc.intrinsic_bits, 1);
-            else
-                self->value.elem_bits = 8;
-            if (rc == 0) {
-                const KMetadata *meta;
-                
-                rc = VTableOpenMetadataRead(info->tbl, &meta);
-                if (rc == 0) {
-                    rc = KMetadataOpenNodeRead(meta, &self->node, "*.*s", cp->argv[0].count, cp->argv[0].data.ascii);
-                    KMetadataRelease(meta);
-                    if (rc == 0) {
-                        rslt->self = self;
-                        rslt->whack = self_whack;
-                        
-                        rslt->variant = deterministic ? vftRow : vftNonDetRow;
-                        rslt->u.ndf = var_row_func;
-                        
-                        return 0;
-                    }
-                }
-            }
-        }
-        self_whack(self);
-	}
-	else
-		rc = RC(rcVDB, rcFunction, rcConstructing, rcMemory, rcExhausted);
-	return rc;
-}
diff --git a/libs/vdb/meta-attr-write.c b/libs/vdb/meta-attr-write.c
deleted file mode 100644
index 2a2421c..0000000
--- a/libs/vdb/meta-attr-write.c
+++ /dev/null
@@ -1,529 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#include <klib/defs.h>
-#include <klib/printf.h>
-#include <klib/rc.h>
-#include <vdb/table.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <sysalloc.h>
-#include "xform-priv.h"
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <stdarg.h>
-#include <stdio.h>
-
-typedef struct self_t {
-    KMDataNode *node;
-    char name[1];
-} self_t;
-
-static void CC self_whack( void *vp ) {
-    self_t *self = vp;
-    
-    KMDataNodeRelease( self->node );
-    free( vp );
-}
-
-static rc_t meta_attr_write_fmt( self_t *self, const char *fmt, ... )
-{
-    rc_t rc;
-    size_t n;
-    char sbuf[4096];
-
-    va_list va;
-    va_start(va, fmt);
-    rc = string_vprintf(sbuf, sizeof(sbuf), & n, fmt, va);
-    va_end(va);
-    
-    if ( rc == 0 )
-        rc = KMDataNodeWriteAttr(self->node, self->name, sbuf);
-
-    return rc;
-}
-
-static
-rc_t CC meta_attr_write_ascii(
-                             void *Self,
-                             const VXformInfo *info,
-                             int64_t row_id,
-                             VRowResult *rslt,
-                             uint32_t argc,
-                             const VRowData argv[]
-) {
-    self_t *self = Self;
-
-    char *value;
-    size_t length = argv[0].u.data.elem_count;
-
-    const char *src = argv[0].u.data.base;
-    
-    rc_t rc = KDataBufferResize( rslt->data, (uint32_t)( length + 1 ) );
-    if (rc)
-        return rc;
-    
-    value = rslt->data->base;
-    memcpy(value, & src [ argv[0].u.data.first_elem ], length);
-    value[length] = '\0';
-
-    rc = KMDataNodeWriteAttr(self->node, self->name, value);
-    if (rc)
-        return rc;
-
-    rslt->elem_count = (uint32_t)length;
-	return 0;
-}
-
-static
-rc_t CC meta_attr_write_bool(
-                          void *Self,
-                          const VXformInfo *info,
-                          int64_t row_id,
-                          VRowResult *rslt,
-                          uint32_t argc,
-                          const VRowData argv[]                          
-) {
-    rc_t rc;
-    self_t *self = Self;
-    uint8_t value = ((const uint8_t *)argv[0].u.data.base)[argv[0].u.data.first_elem];
-
-    /* TBD -this is not dependent upon C code, but upon schema.
-       we probably want a warning here rather than an assert */
-    assert(argv[0].u.data.elem_count == 1);
-
-    rc = KDataBufferResize(rslt -> data, 1);
-    if (rc)
-        return rc;
-
-    *(uint8_t *)rslt->data->base = value ? true : false;
-    rc = meta_attr_write_fmt(self, "%s", value ? "true" : "false");
-    if (rc)
-        return rc;
-
-    rslt->elem_count = 1;
-	return 0;
-}
-
-static
-rc_t CC meta_attr_write_I8(
-                        void *Self,
-                        const VXformInfo *info,
-                        int64_t row_id,
-                        VRowResult *rslt,
-                        uint32_t argc,
-                        const VRowData argv[]
-) {
-    self_t *self = Self;
-    int8_t value = ((const int8_t *)argv[0].u.data.base)[argv[0].u.data.first_elem];
-    rc_t rc = 0;
-    
-    assert(argv[0].u.data.elem_count == 1);
-    
-    rc = KDataBufferResize(rslt->data, 1);
-    if (rc)
-        return rc;
-    
-    *(int8_t *)rslt->data ->base = value;
-    rc = meta_attr_write_fmt(self, "%d", (int)value);
-    if (rc)
-        return rc;
-    
-    rslt->elem_count = 1;
-    
-	return 0;
-}
-
-static
-rc_t CC meta_attr_write_U8(
-                        void *Self,
-                        const VXformInfo *info,
-                        int64_t row_id,
-                        VRowResult *rslt,
-                        uint32_t argc,
-                        const VRowData argv[]
-) {
-    self_t *self = Self;
-    uint8_t value = ((const uint8_t *)argv[0].u.data.base)[argv[0].u.data.first_elem];
-    rc_t rc = 0;
-    
-    assert(argv[0].u.data.elem_count == 1);
-    
-    rc = KDataBufferResize(rslt->data, 1);
-    if (rc)
-        return rc;
-    
-    *(uint8_t *)rslt->data->base = value;
-    rc = meta_attr_write_fmt(self, "%u", (int)value);
-    if (rc)
-        return rc;
-    
-    rslt->elem_count = 1;
-    
-	return 0;
-}
-
-static
-rc_t CC meta_attr_write_I16(
-                         void *Self,
-                         const VXformInfo *info,
-                         int64_t row_id,
-                         VRowResult *rslt,
-                         uint32_t argc,
-                         const VRowData argv[]
-) {
-    self_t *self = Self;
-    int16_t value = ((const int16_t *)argv[0].u.data.base)[argv[0].u.data.first_elem];
-    rc_t rc = 0;
-    
-    assert(argv[0].u.data.elem_count == 1);
-    
-    rc = KDataBufferResize(rslt->data, 1);
-    if (rc)
-        return rc;
-    
-    *(int16_t *)rslt->data->base = value;
-    rc = meta_attr_write_fmt(self, "%d", (int)value);
-    if (rc)
-        return rc;
-    
-    rslt->elem_count = 1;
-    
-	return 0;
-}
-
-static
-rc_t CC meta_attr_write_U16(
-                         void *Self,
-                         const VXformInfo *info,
-                         int64_t row_id,
-                         VRowResult *rslt,
-                         uint32_t argc,
-                         const VRowData argv[]
-) {
-    self_t *self = Self;
-    uint16_t value = ((const uint16_t *)argv[0].u.data.base)[argv[0].u.data.first_elem];
-    rc_t rc = 0;
-    
-    assert(argv[0].u.data.elem_count == 1);
-    
-    rc = KDataBufferResize(rslt->data, 1);
-    if (rc)
-        return rc;
-    
-    *(uint16_t *)rslt->data->base = value;
-    rc = meta_attr_write_fmt(self, "%u", (int)value);
-    if (rc)
-        return rc;
-    
-    rslt->elem_count = 1;
-    
-	return 0;
-}
-
-static
-rc_t CC meta_attr_write_I32(
-                         void *Self,
-                         const VXformInfo *info,
-                         int64_t row_id,
-                         VRowResult *rslt,
-                         uint32_t argc,
-                         const VRowData argv[]
-) {
-    self_t *self = Self;
-    int32_t value = ((const int32_t *)argv[0].u.data.base)[argv[0].u.data.first_elem];
-    rc_t rc = 0;
-    
-    assert(argv[0].u.data.elem_count == 1);
-    
-    rc = KDataBufferResize(rslt->data, 1);
-    if (rc)
-        return rc;
-    
-    *(int32_t *)rslt->data->base = value;
-    rc = meta_attr_write_fmt(self, "%d", value);
-    if (rc)
-        return rc;
-    
-    rslt->elem_count = 1;
-    
-	return 0;
-}
-
-static
-rc_t CC meta_attr_write_U32(
-                         void *Self,
-                         const VXformInfo *info,
-                         int64_t row_id,
-                         VRowResult *rslt,
-                         uint32_t argc,
-                         const VRowData argv[]
-) {
-    self_t *self = Self;
-    uint32_t value = ((const uint32_t *)argv[0].u.data.base)[argv[0].u.data.first_elem];
-    rc_t rc = 0;
-    
-    assert(argv[0].u.data.elem_count == 1);
-    
-    rc = KDataBufferResize(rslt->data, 1);
-    if (rc)
-        return rc;
-    
-    *(uint32_t *)rslt->data->base = value;
-    rc = meta_attr_write_fmt(self, "%u", value);
-    if (rc)
-        return rc;
-    
-    rslt->elem_count = 1;
-    
-	return 0;
-}
-
-static
-rc_t CC meta_attr_write_I64(
-                         void *Self,
-                         const VXformInfo *info,
-                         int64_t row_id,
-                         VRowResult *rslt,
-                         uint32_t argc,
-                         const VRowData argv[]
-) {
-    self_t *self = Self;
-    int64_t value = ((const int64_t *)argv[0].u.data.base)[argv[0].u.data.first_elem];
-    rc_t rc = 0;
-    
-    assert(argv[0].u.data.elem_count == 1);
-    
-    rc = KDataBufferResize(rslt->data, 1);
-    if (rc)
-        return rc;
-    
-    *(int64_t *)rslt->data->base = value;
-    rc = meta_attr_write_fmt(self, "%ld", value);
-    if (rc)
-        return rc;
-    
-    rslt->elem_count = 1;
-    
-	return 0;
-}
-
-static
-rc_t CC meta_attr_write_U64(
-                         void *Self,
-                         const VXformInfo *info,
-                         int64_t row_id,
-                         VRowResult *rslt,
-                         uint32_t argc,
-                         const VRowData argv[]
-) {
-    self_t *self = Self;
-    uint64_t value = ((const uint64_t *)argv[0].u.data.base)[argv[0].u.data.first_elem];
-    rc_t rc = 0;
-    
-    assert(argv[0].u.data.elem_count == 1);
-    
-    rc = KDataBufferResize(rslt->data, 1);
-    if (rc)
-        return rc;
-    
-    *(uint64_t *)rslt->data->base = value;
-    rc = meta_attr_write_fmt(self, "%lu", value);
-    if (rc)
-        return rc;
-    
-    rslt->elem_count = 1;
-    
-	return 0;
-}
-
-static
-rc_t CC meta_attr_write_F32(
-                         void *Self,
-                         const VXformInfo *info,
-                         int64_t row_id,
-                         VRowResult *rslt,
-                         uint32_t argc,
-                         const VRowData argv[]
-) {
-    self_t *self = Self;
-    float value = ((const float *)argv[0].u.data.base)[argv[0].u.data.first_elem];
-    rc_t rc = 0;
-    
-    assert(argv[0].u.data.elem_count == 1);
-    
-    rc = KDataBufferResize(rslt->data, 1);
-    if (rc)
-        return rc;
-    
-    *(float *)rslt->data->base = value;
-    rc = meta_attr_write_fmt(self, "%.8e", value);
-    if (rc)
-        return rc;
-    
-    rslt->elem_count = 1;
-    
-	return 0;
-}
-
-static
-rc_t CC CC meta_attr_write_F64(
-                         void *Self,
-                         const VXformInfo *info,
-                         int64_t row_id,
-                         VRowResult *rslt,
-                         uint32_t argc,
-                         const VRowData argv[]
-) {
-    self_t *self = Self;
-    double value = ((const double *)argv[0].u.data.base)[argv[0].u.data.first_elem];
-    rc_t rc = 0;
-    
-    assert(argv[0].u.data.elem_count == 1);
-    
-    rc = KDataBufferResize(rslt->data, 1);
-    if (rc)
-        return rc;
-    
-    *(double *)rslt->data->base = value;
-    rc = meta_attr_write_fmt(self, "%.16e", value);
-    if (rc)
-        return rc;
-    
-    rslt->elem_count = 1;
-    
-	return 0;
-}
-
-/* 
- */
-VTRANSFACT_BUILTIN_IMPL(meta_attr_write, 1, 0, 0) (const void *Self, const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rc_t rc = 0;
-    self_t *self;
-    bool variable = false;
-    rc_t ( CC * var_row_func )(
-                         void *Self,
-                         const VXformInfo *info,
-                         int64_t row_id,
-                         VRowResult *rslt,
-                         uint32_t argc,
-                         const VRowData argv[]
-                         );
-    
-    switch (dp->argv[0].desc.domain) {
-    case vtdBool:
-        var_row_func = meta_attr_write_bool;
-        break;
-    case vtdInt:
-        switch (info->fdesc.desc.intrinsic_bits) {
-        case 8:
-            var_row_func = meta_attr_write_I8;
-            break;
-        case 16:
-            var_row_func = meta_attr_write_I16;
-            break;
-        case 32:
-            var_row_func = meta_attr_write_I32;
-            break;
-        case 64:
-            var_row_func = meta_attr_write_I64;
-            break;
-        default:
-            return RC(rcVDB, rcFunction, rcConstructing, rcType, rcInvalid);
-        }
-        break;
-    case vtdUint:
-        switch (info->fdesc.desc.intrinsic_bits) {
-        case 8:
-            var_row_func = meta_attr_write_U8;
-            break;
-        case 16:
-            var_row_func = meta_attr_write_U16;
-            break;
-        case 32:
-            var_row_func = meta_attr_write_U32;
-            break;
-        case 64:
-            var_row_func = meta_attr_write_U64;
-            break;
-        default:
-            return RC(rcVDB, rcFunction, rcConstructing, rcType, rcInvalid);
-        }
-        break;
-    case vtdFloat:
-        switch (info->fdesc.desc.intrinsic_bits) {
-        case 32:
-            var_row_func = meta_attr_write_F32;
-            break;
-        case 64:
-            var_row_func = meta_attr_write_F64;
-            break;
-        default:
-            return RC(rcVDB, rcFunction, rcConstructing, rcType, rcInvalid);
-        }
-        break;
-    case vtdAscii:
-        variable = true;
-        var_row_func = meta_attr_write_ascii;
-        break;
-    default:
-        return RC(rcVDB, rcFunction, rcConstructing, rcType, rcInvalid);
-    }
-    
-	self = calloc(1, sizeof *self + cp->argv[1].count);
-	if (self == NULL)
-		rc = RC(rcVDB, rcFunction, rcConstructing, rcMemory, rcExhausted);
-    else
-    {
-        KMetadata *meta;
-        strcpy(self->name, cp->argv[1].data.ascii);
-        rc = VTableOpenMetadataUpdate((VTable *)info->tbl, &meta);
-        if (rc == 0) {
-            rc = KMetadataOpenNodeUpdate(meta, &self->node, cp->argv[0].data.ascii);
-            KMetadataRelease(meta);
-            if (rc == 0) {
-                rslt->self = self;
-                rslt->whack = self_whack;
-                        
-                rslt->variant = vftNonDetRow;
-                rslt->u.ndf = var_row_func;
-                        
-                return 0;
-            }
-        }
-        self_whack(self);
-	}
-
-	return rc;
-}
diff --git a/libs/vdb/meta-read.c b/libs/vdb/meta-read.c
deleted file mode 100644
index 6876d13..0000000
--- a/libs/vdb/meta-read.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <vdb/extern.h>
-
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/table.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <bitstr.h>
-#include <sysalloc.h>
-
-#include "schema-priv.h"
-#include "xform-priv.h"
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-typedef struct self_t {
-    const KMDataNode *node;
-    void ( * byte_swap ) ( void *dst, const void *src, uint64_t count );
-} self_t;
-
-static void CC self_whack( void *vp ) {
-    self_t *self = vp;
-    
-    KMDataNodeRelease( self->node );
-    free( vp );
-}
-
-static
-rc_t CC meta_read_func(
-                     void *Self,
-                     const VXformInfo *info,
-                     int64_t row_id,
-                     VRowResult *rslt,
-                     uint32_t argc,
-                     const VRowData argv[]
-) {
-    self_t *self = Self;
-    size_t length;
-    size_t read;
-    rc_t rc = 0;
-    
-    rc = KMDataNodeRead(self->node, 0, 0, 0, &read, &length);
-    if (rc == 0) {
-        rslt->data->elem_bits = 8;
-        rslt->data->elem_count = 0; /* no usable data */
-        rc = KDataBufferResize( rslt->data, length );
-        if (rc)
-            return rc;
-        
-        rc = KMDataNodeRead( self->node, 0, rslt->data->base, length, &length, 0 );
-        if (rc == 0) {
-            rc = KDataBufferCast(rslt->data, rslt->data, rslt->elem_bits, true);
-            if (rc == 0) {
-                if (self->byte_swap)
-                    self->byte_swap(rslt->data->base, rslt->data->base, rslt->data->elem_count);
-                rslt->elem_count = rslt->data->elem_count;
-            }
-        }
-    }
-    return rc;
-}
-
-/* 
- function < type T > T meta:read #1.0 < ascii node, * bool deterministic > ();
- */
-VTRANSFACT_BUILTIN_IMPL ( meta_read, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rc_t rc = 0;
-    self_t *self;
-    SDatatype *sdt;
-    bool need_byte_swap;
-    bool deterministic = true;
-    
-    if (cp->argc > 1)
-        deterministic = cp->argv[1].data.b[0];
-        
-    sdt = VSchemaFindTypeid(info->schema, info->fdesc.fd.td.type_id);
-    assert(sdt != NULL);
-    
-	self = calloc(1, sizeof(self_t));
-	if (self == NULL)
-		rc = RC(rcVDB, rcFunction, rcConstructing, rcMemory, rcExhausted);
-    else
-    {
-        const KMetadata *meta;
-        
-        rc = VTableOpenMetadataRead(info->tbl, &meta);
-        if (rc == 0) {
-            rc = KMetadataOpenNodeRead(meta, &self->node, "%.*s", cp->argv[0].count, cp->argv[0].data.ascii);
-            KMetadataRelease(meta);
-            if (rc == 0) {
-                KMDataNodeByteOrder(self->node, &need_byte_swap);
-                if (need_byte_swap)
-                    self->byte_swap = sdt->byte_swap;
-                
-                rslt->self = self;
-                rslt->whack = self_whack;
-                
-                rslt->variant = deterministic ? vftRow : vftNonDetRow;
-                rslt->u.ndf = meta_read_func;
-                
-                return 0;
-            }
-        }
-        self_whack(self);
-	}
-    return rc;
-}
diff --git a/libs/vdb/meta-value.c b/libs/vdb/meta-value.c
deleted file mode 100644
index c511b74..0000000
--- a/libs/vdb/meta-value.c
+++ /dev/null
@@ -1,381 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <vdb/extern.h>
-
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/table.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <bitstr.h>
-#include <sysalloc.h>
-#include "xform-priv.h"
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-typedef struct self_t {
-    const KMDataNode *node;
-    KDataBuffer value;
-} self_t;
-
-static void CC self_whack( void *vp ) {
-    self_t *self = vp;
-    
-    KMDataNodeRelease( self->node );
-    KDataBufferWhack( &self->value );
-    free( vp );
-}
-
-static
-rc_t CC meta_value_U8(
-                   void *Self,
-                   const VXformInfo *info,
-                   int64_t row_id,
-                   VRowResult *rslt,
-                   uint32_t argc,
-                   const VRowData argv[]
-) {
-    self_t *self = Self;
-    uint64_t value;
-    rc_t rc = 0;
-    
-    rc = KMDataNodeReadAsU64(self->node, &value);
-    if (rc == 0) {
-        ((uint8_t *)self->value.base)[0] = (uint8_t)value;
-        rslt->elem_bits = 8;
-        rslt->elem_count = 1;
-        KDataBufferWhack(rslt->data);
-        rc = KDataBufferSub(&self->value, rslt->data, 0, UINT64_MAX);
-    }
-    return rc;
-}
-
-static
-rc_t CC meta_value_U16(
-                   void *Self,
-                   const VXformInfo *info,
-                   int64_t row_id,
-                   VRowResult *rslt,
-                   uint32_t argc,
-                   const VRowData argv[]
-) {
-    self_t *self = Self;
-    uint64_t value;
-    rc_t rc = 0;
-    
-    rc = KMDataNodeReadAsU64(self->node, &value);
-    if (rc == 0) {
-        ((uint16_t *)self->value.base)[0] = (uint16_t)value;
-        rslt->elem_bits = 16;
-        rslt->elem_count = 1;
-        KDataBufferWhack(rslt->data);
-        rc = KDataBufferSub(&self->value, rslt->data, 0, UINT64_MAX);
-    }
-    return rc;
-}
-
-static
-rc_t CC meta_value_U32(
-                   void *Self,
-                   const VXformInfo *info,
-                   int64_t row_id,
-                   VRowResult *rslt,
-                   uint32_t argc,
-                   const VRowData argv[]
-) {
-    self_t *self = Self;
-    uint64_t value;
-    rc_t rc = 0;
-    
-    rc = KMDataNodeReadAsU64(self->node, &value);
-    if (rc == 0) {
-        ((uint32_t *)self->value.base)[0] = (uint32_t)value;
-        rslt->elem_bits = 32;
-        rslt->elem_count = 1;
-        KDataBufferWhack(rslt->data);
-        rc = KDataBufferSub(&self->value, rslt->data, 0, UINT64_MAX);
-    }
-    return rc;
-}
-
-static
-rc_t CC meta_value_U64(
-                   void *Self,
-                   const VXformInfo *info,
-                   int64_t row_id,
-                   VRowResult *rslt,
-                   uint32_t argc,
-                   const VRowData argv[]
-) {
-    self_t *self = Self;
-    rc_t rc = 0;
-    
-    rc = KMDataNodeReadAsU64(self->node, (uint64_t *)self->value.base);
-    if (rc == 0) {
-        rslt->elem_bits = 64;
-        rslt->elem_count = 1;
-        KDataBufferWhack(rslt->data);
-        rc = KDataBufferSub(&self->value, rslt->data, 0, UINT64_MAX);
-    }
-    return rc;
-}
-
-
-static
-rc_t CC meta_value_I8(
-                   void *Self,
-                   const VXformInfo *info,
-                   int64_t row_id,
-                   VRowResult *rslt,
-                   uint32_t argc,
-                   const VRowData argv[]
-) {
-    self_t *self = Self;
-    int64_t value;
-    rc_t rc = 0;
-    
-    rc = KMDataNodeReadAsI64(self->node, &value);
-    if (rc == 0) {
-        ((int8_t *)self->value.base)[0] = (int8_t)value;
-        rslt->elem_bits = 8;
-        rslt->elem_count = 1;
-        KDataBufferWhack(rslt->data);
-        rc = KDataBufferSub(&self->value, rslt->data, 0, UINT64_MAX);
-    }
-    return rc;
-}
-
-static
-rc_t CC meta_value_I16(
-                    void *Self,
-                    const VXformInfo *info,
-                    int64_t row_id,
-                    VRowResult *rslt,
-                    uint32_t argc,
-                    const VRowData argv[]
-) {
-    self_t *self = Self;
-    int64_t value;
-    rc_t rc = 0;
-    
-    rc = KMDataNodeReadAsI64(self->node, &value);
-    if (rc == 0) {
-        ((int16_t *)self->value.base)[0] = (int16_t)value;
-        rslt->elem_bits = 16;
-        rslt->elem_count = 1;
-        KDataBufferWhack(rslt->data);
-        rc = KDataBufferSub(&self->value, rslt->data, 0, UINT64_MAX);
-    }
-    return rc;
-}
-
-static
-rc_t CC meta_value_I32(
-                    void *Self,
-                    const VXformInfo *info,
-                    int64_t row_id,
-                    VRowResult *rslt,
-                    uint32_t argc,
-                    const VRowData argv[]
-) {
-    self_t *self = Self;
-    int64_t value;
-    rc_t rc = 0;
-    
-    rc = KMDataNodeReadAsI64(self->node, &value);
-    if (rc == 0) {
-        ((int32_t *)self->value.base)[0] = (int32_t)value;
-        rslt->elem_bits = 32;
-        rslt->elem_count = 1;
-        KDataBufferWhack(rslt->data);
-        rc = KDataBufferSub(&self->value, rslt->data, 0, UINT64_MAX);
-    }
-    return rc;
-}
-
-static
-rc_t CC meta_value_I64(
-                    void *Self,
-                    const VXformInfo *info,
-                    int64_t row_id,
-                    VRowResult *rslt,
-                    uint32_t argc,
-                    const VRowData argv[]
-) {
-    self_t *self = Self;
-    rc_t rc = 0;
-    
-    rc = KMDataNodeReadAsI64(self->node, (int64_t *)self->value.base);
-    if (rc == 0) {
-        rslt->elem_bits = 64;
-        rslt->elem_count = 1;
-        KDataBufferWhack(rslt->data);
-        rc = KDataBufferSub(&self->value, rslt->data, 0, UINT64_MAX);
-    }
-    return rc;
-}
-
-static
-rc_t CC meta_value_F32(
-                    void *Self,
-                    const VXformInfo *info,
-                    int64_t row_id,
-                    VRowResult *rslt,
-                    uint32_t argc,
-                    const VRowData argv[]
-) {
-    self_t *self = Self;
-    double value;
-    rc_t rc = 0;
-    
-    rc = KMDataNodeReadAsF64(self->node, &value);
-    if (rc == 0) {
-        ((float *)self->value.base)[0] = (float)value;
-        rslt->elem_bits = 32;
-        rslt->elem_count = 1;
-        KDataBufferWhack(rslt->data);
-        rc = KDataBufferSub(&self->value, rslt->data, 0, UINT64_MAX);
-    }
-    return rc;
-}
-
-static
-rc_t CC meta_value_F64(
-                    void *Self,
-                    const VXformInfo *info,
-                    int64_t row_id,
-                    VRowResult *rslt,
-                    uint32_t argc,
-                    const VRowData argv[]
-) {
-    self_t *self = Self;
-    rc_t rc = 0;
-    
-    rc = KMDataNodeReadAsF64(self->node, (double *)self->value.base);
-    if (rc == 0) {
-        rslt->elem_bits = 64;
-        rslt->elem_count = 1;
-        KDataBufferWhack(rslt->data);
-        rc = KDataBufferSub(&self->value, rslt->data, 0, UINT64_MAX);
-    }
-    return rc;
-}
-
-/* 
- function < type T > T meta:value #1.0 < ascii node, * bool deterministic > ();
- */
-VTRANSFACT_BUILTIN_IMPL(meta_value, 1, 0, 0) (const void *Self, const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rc_t rc = 0;
-    self_t *self;
-    bool deterministic = true;
-    
-    if (cp->argc > 1)
-        deterministic = cp->argv[1].data.b[0];
-
-    self = calloc(1, sizeof(self_t));
-	if (self) {
-        rc = KDataBufferMake(&self->value, info->fdesc.desc.intrinsic_bits, 1);
-        if (rc == 0) {
-            const KMetadata *meta;
-            
-            rc = VTableOpenMetadataRead(info->tbl, &meta);
-            if (rc == 0) {
-                rc = KMetadataOpenNodeRead(meta, &self->node, "%.*s", cp->argv[0].count, cp->argv[0].data.ascii);
-                KMetadataRelease(meta);
-                if (rc == 0) {
-                    rslt->self = self;
-                    rslt->whack = self_whack;
-                    
-                    rslt->variant = deterministic ? vftRow : vftNonDetRow;
-                    switch (info->fdesc.desc.domain) {
-                    case vtdFloat:
-                        switch (info->fdesc.desc.intrinsic_bits) {
-                        case 32:
-                            rslt->u.ndf = meta_value_F32;
-                            return 0;
-                        case 64:
-                            rslt->u.ndf = meta_value_F64;
-                            return 0;
-                        default:
-                            break;
-                        }
-                        break;
-                    case vtdInt:
-                        switch (info->fdesc.desc.intrinsic_bits) {
-                        case 8:
-                            rslt->u.ndf = meta_value_I8;
-                            return 0;
-                        case 16:
-                            rslt->u.ndf = meta_value_I16;
-                            return 0;
-                        case 32:
-                            rslt->u.ndf = meta_value_I32;
-                            return 0;
-                        case 64:
-                            rslt->u.ndf = meta_value_I64;
-                            return 0;
-                        default:
-                            break;
-                        }
-                        break;
-                    case vtdUint:
-                        switch (info->fdesc.desc.intrinsic_bits) {
-                        case 8:
-                            rslt->u.ndf = meta_value_U8;
-                            return 0;
-                        case 16:
-                            rslt->u.ndf = meta_value_U16;
-                            return 0;
-                        case 32:
-                            rslt->u.ndf = meta_value_U32;
-                            return 0;
-                        case 64:
-                            rslt->u.ndf = meta_value_U64;
-                            return 0;
-                        default:
-                            break;
-                        }
-                        break;
-                    default:
-                        break;
-                    }
-                    rc = RC(rcVDB, rcFunction, rcConstructing, rcType, rcInvalid);
-                }
-            }
-        }
-        self_whack(self);
-	}
-	else
-		rc = RC(rcVDB, rcFunction, rcConstructing, rcMemory, rcExhausted);
-    return rc;
-}
diff --git a/libs/vdb/meta-write.c b/libs/vdb/meta-write.c
deleted file mode 100644
index a720cb9..0000000
--- a/libs/vdb/meta-write.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/table.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <bitstr.h>
-#include <sysalloc.h>
-#include "schema-priv.h"
-#include "xform-priv.h"
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-typedef struct self_t {
-    KMDataNode *node;
-    void ( * byte_swap ) ( void *dst, const void *src, uint64_t count );
-} self_t;
-
-static void CC self_whack( void *vp ) {
-    self_t *self = vp;
-    
-    KMDataNodeRelease( self->node );
-    free( vp );
-}
-
-static
-rc_t CC meta_write_func(
-                     void *Self,
-                     const VXformInfo *info,
-                     int64_t row_id,
-                     VRowResult *rslt,
-                     uint32_t argc,
-                     const VRowData argv[]
-) {
-    self_t *self = Self;
-
-    /* pointer to input page */
-    const uint8_t *sbuf = argv [ 0 ] . u . data . base;
-
-    /* bit offset to first element in row */
-    bitsz_t offset = (argv[0].u.data.first_elem * argv[0].u.data.elem_bits);
-
-    /* the number of bits in this row */
-    bitsz_t blen = argv[0].u.data.elem_count * argv[0].u.data.elem_bits;
-
-    /* row length in bytes */
-    size_t length = (blen + 7) >> 3;
-
-    /* set output buffer size */
-    rc_t rc = KDataBufferCast ( rslt -> data, rslt -> data, rslt -> elem_bits, true );
-    if ( rc == 0 )
-        rc = KDataBufferResize ( rslt -> data, (uint32_t)( blen / rslt -> elem_bits ) );
-    if ( rc != 0 )
-        return rc;
-
-    /* copy data: if byte-swapping, then data are at least 16-bit aligned */
-    if ( ( blen & 7 ) != 0 )
-    {
-        /* ensure trailing bits of buffer are zero */
-        ( ( uint8_t* ) rslt -> data -> base ) [ length - 1 ] = 0;
-        bitcpy ( rslt -> data -> base, 0, sbuf, offset, blen );
-    }
-    else if ( self -> byte_swap != NULL )
-    {
-        ( * self -> byte_swap ) ( rslt -> data -> base,
-            & sbuf [ offset >> 3 ], argv[0].u.data.elem_count );
-    }
-    else
-    {
-        memcpy ( rslt -> data -> base, & sbuf [ offset >> 3 ], length );
-    }
-
-    /* write row to metadata-node */
-    rc = KMDataNodeWrite ( self -> node, rslt -> data -> base, length );
-    if ( rc == 0 )
-        rslt -> elem_count = rslt -> data -> elem_count;
-
-    return rc;
-}
-
-/* meta:write
- */
-VTRANSFACT_BUILTIN_IMPL(meta_write, 1, 0, 0) (const void *Self, const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rc_t rc;
-    self_t *self;
-    bool need_byte_swap;
-    
-    SDatatype *sdt = VSchemaFindTypeid(info->schema, dp->argv[0].fd.td.type_id);
-    assert(sdt != NULL);
-    
-	self = calloc(1, sizeof(self_t));
-	if (self == NULL)
-		rc = RC(rcVDB, rcFunction, rcConstructing, rcMemory, rcExhausted);
-    else
-    {
-        KMetadata *meta;
-
-        /* even if we cast away const on the table,
-           kdb will still prevent us from doing so if
-           it's actually read-only */
-        rc = VTableOpenMetadataUpdate((VTable *)info->tbl, &meta);
-        if (rc == 0) {
-            rc = KMetadataOpenNodeUpdate(meta, &self->node, cp->argv[0].data.ascii);
-            KMetadataRelease(meta);
-            if (rc == 0) {
-                KMDataNodeByteOrder(self->node, &need_byte_swap);
-                if (need_byte_swap)
-                    self->byte_swap = sdt->byte_swap;
-                
-                rslt->self = self;
-                rslt->whack = self_whack;
-                
-                rslt->variant = vftNonDetRow;
-                rslt->u.ndf = meta_write_func;
-                
-                return 0;
-            }
-        }
-        self_whack(self);
-	}
-
-	return rc;
-}
diff --git a/libs/vdb/page-map.c b/libs/vdb/page-map.c
deleted file mode 100644
index 08c0066..0000000
--- a/libs/vdb/page-map.c
+++ /dev/null
@@ -1,1721 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#define TRACK_REFERENCES 0
-
-#include <vdb/extern.h>
-#include <klib/rc.h>
-#include <atomic.h>
-
-#include <bitstr.h>
-
-#include <klib/pack.h>
-#include <klib/vlen-encode.h>
-#include <sysalloc.h>
-#include "page-map.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <stdio.h>
-
-#include <zlib.h>
-
-/* Page maps describe the layout of rows within a blob.
- * The data within a page map is run-length encoded.
- * I.e. if two identical rows are stored sequentially 
- */
-
-
-
-#define VALIDATE_PAGEMAPS 0
-#define PAGEMAP_STATISTICS 0
-#if PAGEMAP_STATISTICS
-static struct {
-    size_t currentFootprint;
-    size_t maxFootprint;
-    size_t currentWaste;
-    size_t maxWaste;
-    unsigned alive;
-    unsigned maxAlive;
-    unsigned create;
-    unsigned createStatic;
-    unsigned createFixedRow;
-    unsigned createSingle;
-    unsigned grows;
-    unsigned expands;
-    unsigned expandCalls;
-    unsigned appends;
-} pm_stats;
-#endif
-
-elem_count_t PageMapLastLength(const PageMap *cself) {
-    return cself->leng_recs > 0 ? cself->length[cself->leng_recs - 1] : 0;
-}
-
-
-
-static rc_t PageMapRegionExpand(PageMap *self,pm_expand_region_type_t TYPE,row_count_t numrows,elem_count_t length,elem_count_t data_offset)
-{
-	rc_t rc;
-	if(   self->exp_rgn_last == 0           /** not started **/
-	   || self->exp_rgn_last->type != TYPE 	/** another type **/
-           || (TYPE == PM_REGION_EXPAND_SAMEDATA && self->exp_rgn_last->data_offset != data_offset)  /** not the same data */
-           || (TYPE!=PM_REGION_EXPAND_FULL && self->exp_rgn_last->length != length) /** all non-full types are length-dependant**/
-		){ /** New region **/
-		self->exp_rgn_cnt++;
-		rc = KDataBufferResize(&self->istorage, self->exp_rgn_cnt);
-		if(rc) return rc;
-
-		self->exp_rgn_last = (PageMapRegion *)self->istorage.base + self->exp_rgn_cnt -1;
-		self->exp_rgn_last->type=TYPE;
-		self->exp_rgn_last->start_row=self->exp_row_last;
-		self->exp_rgn_last->data_offset = data_offset;
-		self->exp_rgn_last->length = length;
-		self->exp_rgn_last->numrows = numrows;
-		self->exp_rgn_last->expanded = false;
- 	} else { /** continue with existing region **/
-		if(TYPE == PM_REGION_EXPAND_FULL){
-			row_count_t i;
-			elem_count_t *base;
-			uint64_t old_cnt = self->dstorage.elem_count;
-			uint64_t new_cnt = old_cnt + 2*numrows;
-			if(!self->exp_rgn_last->expanded){/*** need to start expansion ***/
-				new_cnt += 2*self->exp_rgn_last->numrows; /*** need to catch up **/
-				rc = KDataBufferResize(&self->dstorage, new_cnt);
-				if(rc) return rc;
-				base = (elem_count_t *)self->dstorage.base + old_cnt;
-				for(i=0;i<self->exp_rgn_last->numrows;i++){
-					base[2*i] = self->exp_rgn_last->length;
-					base[2*i+1] = self->exp_rgn_last->data_offset;
-				}
-				self->exp_rgn_last->data_offset = old_cnt;
-				self->exp_rgn_last->expanded=true;
-			} else {
-				rc = KDataBufferResize(&self->dstorage, new_cnt);
-				if(rc) return rc;
-				base = (elem_count_t *)self->dstorage.base + self->exp_rgn_last->data_offset;
-			}
-			base += 2*self->exp_rgn_last->numrows;
-			for(i=0;i<numrows;i++){
-				base[2*i]   = length;
-				base[2*i+1] = data_offset;
-			}
-		} else if(TYPE == PM_REGION_EXPAND_SAMELEN){
-			 row_count_t i;
-                        elem_count_t *base;
-                        uint64_t old_cnt = self->dstorage.elem_count;
-                        uint64_t new_cnt = old_cnt + numrows;
-                        if(!self->exp_rgn_last->expanded){/*** need to start expansion ***/
-                                new_cnt += self->exp_rgn_last->numrows; /*** need to catch up **/
-                                rc = KDataBufferResize(&self->dstorage, new_cnt);
-                                if(rc) return rc;
-                                base = (elem_count_t *)self->dstorage.base + old_cnt;
-                                for(i=0;i<self->exp_rgn_last->numrows;i++){
-                                        base[i] = self->exp_rgn_last->data_offset;
-                                }
-                                self->exp_rgn_last->data_offset = old_cnt;
-				self->exp_rgn_last->expanded=true;
-                        } else {
-				rc = KDataBufferResize(&self->dstorage, new_cnt);
-				if(rc) return rc;
-                                base = (elem_count_t *)self->dstorage.base + self->exp_rgn_last->data_offset;
-                        }
-			base += self->exp_rgn_last->numrows;
-                        for(i=0;i<numrows;i++){
-                                base[i]   = data_offset;
-                        }
-		}
-		self->exp_rgn_last->numrows += numrows;
-	}
-	return 0;
-}
-
-rc_t PageMapPreExpandFull(const PageMap *cself, row_count_t upto) /*** mostly for use as a temporary pagemap ***/
-{
-	rc_t    rc=0;
-	if(upto > 0){
-		PageMap *self = (PageMap *)cself;
-		assert(self->exp_rgn_last == 0);
-		rc = KDataBufferResize(&self->istorage, 1); /** one and only one pagemap **/
-		if(rc) return rc;
-		
-		self->exp_rgn_last = (PageMapRegion *)self->istorage.base + self->exp_rgn_cnt;
-		self->exp_rgn_cnt = ++self->exp_dr_last;
-
-		self->exp_rgn_last->data_offset = 0;
-		rc=KDataBufferResize(&self->dstorage, upto*2);
-		if(rc) return rc;
-		self->exp_rgn_last->start_row   = 0;
-		self->exp_rgn_last->numrows = 0;
-		self->exp_rgn_last->type = PM_REGION_EXPAND_FULL;
-		self->exp_rgn_last->expanded = true;
-		self->pre_exp_row_count = upto;
-	}
-	return rc;
-}
-
-rc_t PageMapExpandFull(const PageMap *cself)
-{
-	rc_t rc;
-	PageMap *self = (PageMap *)cself;
-	if(self->leng_recs == 1){ 
-		if(   self->data_recs == 1  /* static */
-                   || self->random_access ){ 
-			return 0;
-		} else if(self->data_recs == self->row_count && !self->random_access){ /** equidistant **/
-			rc=PageMapRegionExpand(self,PM_REGION_EXPAND_EQUIDISTANT,self->row_count,self->length[0],0);
-			if(rc) return rc;
-			self->exp_data_offset_last += self->row_count*self->length[0];
-			self->exp_row_last = self->row_count ;
-			self->exp_dr_last =  self->row_count;
-			self->exp_lr_last =  1;
-			self->exp_lr_used =  self->row_count;
-			return  0;
-		}
-        }
-	return 0;
-/*** OTHER VARIANTS  ***
-	return PageMapExpand(cself, cself->row_count);
-	return PageMapExpand(cself, cself->row_count < 1024?cself->row_count:1024);
-******************/
-}
-
-rc_t PageMapExpand(const PageMap *cself, row_count_t upto)
-{
-	rc_t	rc;
-        PageMap *self = (PageMap *)cself;
-#define LENG_RUN_TRIGGER 8
-#define DATA_RUN_TRIGGER 8
-#define EQUI_RUN_TRIGGER 8
-	if( self->leng_recs == 1 && self->row_count > self->data_recs*12/10 && !self->random_access){ /*** Shortcut to make tight loop ***/
-
-		if(self->exp_rgn_last == 0){
-			rc = KDataBufferResize(&self->istorage, self->data_recs);
-			if(rc) return rc;
-		}
-		self->exp_rgn_last = (PageMapRegion *)self->istorage.base + self->exp_rgn_cnt;
-		while(self->exp_dr_last < self->data_recs && self->exp_row_last <= upto + 128){
-			self->exp_rgn_last->start_row   = self->exp_row_last;
-			self->exp_rgn_last->data_offset = self->length[0]*self->exp_dr_last;
-			self->exp_rgn_last->numrows = self->data_run?self->data_run[self->exp_dr_last]:1;
-			self->exp_row_last += self->data_run?self->data_run[self->exp_dr_last]:1;
-			self->exp_rgn_last->type = PM_REGION_EXPAND_SAMEDATA;
-			self->exp_rgn_last->length      = self->length[0];
-			self->exp_rgn_last->expanded = false;
-			self->exp_dr_last  ++;
-			self->exp_rgn_last ++;
-		}
-		self->exp_rgn_cnt = self->exp_dr_last;
-	} else for(;self->exp_lr_last < self->leng_recs && self->exp_dr_last < self->data_recs && self->exp_row_last <= upto + 128;){
-		row_count_t leng_run=self->leng_run[self->exp_lr_last] - self->exp_lr_used;
-		elem_count_t length =self->length[self->exp_lr_last];
-		if(leng_run == 0) {
-			self->exp_lr_last++;
-			self->exp_lr_used=0;
-			continue;
-		}
-		if(leng_run >= LENG_RUN_TRIGGER && !self->random_access){
-			while(leng_run > 0 && self->exp_row_last <= upto + 128){
-				row_count_t data_run=self->data_run?self->data_run[self->exp_dr_last]:1;
-				assert(leng_run >= data_run);/** data runs should have the same lengths **/
-				assert(data_run > 0);
-				if(data_run >= DATA_RUN_TRIGGER){
-					rc=PageMapRegionExpand(self,PM_REGION_EXPAND_SAMEDATA,data_run, length,self->exp_data_offset_last);
-					if(rc) return rc;
-					assert(leng_run >= data_run);
-					leng_run -= data_run;
-					self->exp_lr_used += data_run;
-					self->exp_row_last+= data_run; 
-					self->exp_dr_last++;
-					self->exp_data_offset_last += length;
-				} else if( /**** quick check if all remaining rows are equidistant ****/
-					     self->exp_lr_last == self->leng_recs - 1 /*** last leng_run ***/
-					  && self->row_count - self->exp_row_last == self->data_recs - self->exp_dr_last /*** all remaining data_runs are 1 ***/
-					  && self->row_count - self->exp_row_last > EQUI_RUN_TRIGGER){ 
-						assert( leng_run == self->row_count - self->exp_row_last);
-						assert(data_run == 1);
-						rc=PageMapRegionExpand(self,PM_REGION_EXPAND_EQUIDISTANT,leng_run, length,self->exp_data_offset_last);
-						if(rc) return rc;
-						self->exp_data_offset_last += leng_run*length;
-						self->exp_row_last = self->row_count ;
-						self->exp_dr_last =  self->data_recs;
-						self->exp_lr_last = self->leng_recs;
-						self->exp_lr_used += leng_run;
-						leng_run = 0;
-						
-				} else {
-					if( data_run == 1){
-						row_count_t data_run_unique;
-						for( data_run_unique =0;
-						     data_run_unique < leng_run && ((self->data_run==NULL)||self->data_run[self->exp_dr_last+data_run_unique]==1);
-						     data_run_unique++){}
-						if(data_run_unique >= EQUI_RUN_TRIGGER){
-							rc=PageMapRegionExpand(self,PM_REGION_EXPAND_EQUIDISTANT,data_run_unique,length,self->exp_data_offset_last);
-							self->exp_dr_last += data_run_unique;
-							self->exp_data_offset_last += data_run_unique*length;
-							assert(leng_run >= data_run_unique);
-							leng_run -= data_run_unique;
-						        self->exp_lr_used  += data_run_unique;
-							self->exp_row_last += data_run_unique;
-						} else while(data_run_unique){
-							rc=PageMapRegionExpand(self,PM_REGION_EXPAND_SAMELEN,data_run,length,self->exp_data_offset_last);
-							if(rc) return rc;
-							assert(leng_run > 0);
-							leng_run --;
-							self->exp_lr_used ++;
-							self->exp_row_last++;
-							self->exp_dr_last++;
-							self->exp_data_offset_last += length;
-							data_run_unique--;
-						}
-					} else {
-						rc=PageMapRegionExpand(self,PM_REGION_EXPAND_SAMELEN,data_run,length,self->exp_data_offset_last);
-						if(rc) return rc;
-						assert(leng_run >= data_run);
-						leng_run -= data_run;
-						self->exp_lr_used += data_run;
-						self->exp_row_last+= data_run;
-						self->exp_dr_last++;
-						self->exp_data_offset_last += length;
-					}
-				}
-			}
-			assert(self->exp_row_last <= self->row_count);
-		} else {
-			while(leng_run > 0){
-				row_count_t data_run=cself->data_run?cself->data_run[self->exp_dr_last]:1;
-				assert(leng_run >= data_run);/** data runs should have the same lengths **/
-				if(self->random_access){
-					rc=PageMapRegionExpand(self,PM_REGION_EXPAND_FULL,data_run,length,self->data_offset[self->exp_row_last]);
-					self->exp_data_offset_last  = self->data_offset[self->exp_row_last] + length;
-				} else {
-					rc=PageMapRegionExpand(self,PM_REGION_EXPAND_FULL,data_run,length,self->exp_data_offset_last);
-					self->exp_data_offset_last += length;
-				}
-				if(rc) return rc;
-				self->exp_row_last += data_run;
-				assert(leng_run >= data_run);
-				leng_run -= data_run;
-				self->exp_lr_used += data_run;
-				self->exp_dr_last++;
-			}
-		}
-	}
-	return 0;
-}
-
-static rc_t PageMapFindRegion(const PageMap *cself,uint64_t row,PageMapRegion **pmr)
-{
-	/*** in PageMap rows are 0-based **/
-	rc_t	rc;
-	pm_size_t left,right,i_rgn;
-	if(row >= cself->row_count )
-		return  RC (rcVDB, rcPagemap, rcSearching, rcRow, rcNotFound );
-	if(cself -> exp_row_last <= row){
-		rc=PageMapExpand(cself,row);
-		if(rc) return rc;
-	}
-
-	if(cself->exp_rgn_cnt > 1){
-		i_rgn = cself->i_rgn_last;
-		left = 0;
-		right = cself->exp_rgn_cnt - 1;
-		while(right > left){
-			PageMapRegion*  rgn=  (PageMapRegion*)cself->istorage.base + i_rgn;
-			assert(i_rgn < cself->exp_rgn_cnt);
-			if(row < rgn->start_row){
-				right = i_rgn-1;
-				i_rgn  = (left + right) / 2;
-			} else if(row == rgn->start_row + rgn->numrows){ /*** special case for positive sequentual scans ***/
-				i_rgn++;
-			} else if(row > rgn->start_row + rgn->numrows){
-				left = i_rgn+1;
-				i_rgn =  (left + right + 1) / 2;
-			} else {
-				break;
-			}
-		}
-	} else {
-		i_rgn = 0;
-	}
-	{
-		PageMap *self = (PageMap *)cself;
-		self->i_rgn_last = i_rgn;
-		self->rgn_last = (PageMapRegion*)self->istorage.base+cself->i_rgn_last;
-	}
-	assert(cself->rgn_last->start_row <= row);
-	assert(cself->rgn_last->start_row + cself->rgn_last->numrows > row);
-	if(pmr) *pmr=(PageMapRegion*)cself->istorage.base + i_rgn;
-	return 0;
-}
-
-static rc_t PageMapRegionGetData(const PageMapRegion *cself,const elem_count_t *exp_base,uint64_t row,uint32_t * data_offset,uint32_t * data_length,uint32_t * repeat_count)
-{
-	if(row < cself->start_row || row >= cself->start_row + cself->numrows)
-		return  RC (rcVDB, rcPagemap, rcSearching, rcRow, rcNotFound );
-
-	if(data_offset != NULL || data_length != NULL || repeat_count != NULL){
-		if(!cself->expanded){
-			if(data_length) *data_length=cself->length;
-			if(data_offset){
-				*data_offset=cself->data_offset;
-				if(cself->type == PM_REGION_EXPAND_EQUIDISTANT){
-					*data_offset += cself->length * (row - cself->start_row);
-				}
-			}
-			if(repeat_count) {
-				if(cself->type == PM_REGION_EXPAND_EQUIDISTANT) *repeat_count=1;
-				else *repeat_count = cself->numrows + cself->start_row - row;
-			}
-		} else switch(cself->type){
-			case PM_REGION_EXPAND_FULL:
-				{
-					row_count_t  i = row - cself->start_row;
-					exp_base += cself->data_offset;
-					if(data_length)  *data_length = exp_base[2*i];
-					if(data_offset)  *data_offset = exp_base[2*i+1];
-					if(repeat_count){
-						int j;
-						for(j=i+1;   j<cself->numrows
-							  && exp_base[2*i]   == exp_base[2*j]
-							  && exp_base[2*i+1] == exp_base[2*j+1];j++){}
-						*repeat_count = j-i;
-					}
-				}
-				break;
-			case PM_REGION_EXPAND_SAMELEN:
-				if(data_length) *data_length=cself->length;
-				if(data_offset || repeat_count){
-					row_count_t  i = row - cself->start_row;
-					exp_base += cself->data_offset;
-					if(data_offset) *data_offset = exp_base[i];
-					if(repeat_count){
-						int j;
-						for(j=i+1;j<cself->numrows && exp_base[i] == exp_base[j];j++){}
-						*repeat_count = j-i;
-					}
-				}
-				break;
-			default: /*** should not happen to anything but 2 above **/
-				return RC (rcVDB, rcPagemap, rcSearching, rcData, rcInconsistent ); 
-		}
-	}
-	return 0;
-}
-
-/*** This is a heavy-weight function which gets data by integration all the time - useful for debugging ****/
-static rc_t PageMapGetData_HW(const PageMap *cself,uint64_t row,uint32_t * data_offset,uint32_t * data_length,uint32_t * repeat_count)
-{
-	if(row >= cself->row_count)
-		return  RC (rcVDB, rcPagemap, rcSearching, rcRow, rcNotFound );
-	if(data_offset != NULL || data_length != NULL || repeat_count != NULL){
-		uint64_t i,j,r;
-		uint32_t dto,dtl,dtr;
-		uint32_t leng_run,data_run;
-		r=dto=i=j=0;
-		leng_run=cself->leng_run[0];
-		while(1){
-			dtl  = cself->length[i];
-			data_run=cself->data_run?cself->data_run[j]:1;
-			j++;
-			r+= data_run;
-			if(r > row){
-				dtr = r - row;
-				 break;
-			}
-			dto += dtl;
-			leng_run -= data_run;
-			if(leng_run == 0){
-				i++;
-				leng_run=cself->leng_run[i];
-			}
-		}
-		if(data_length)   *data_length=dtl;
-		if(data_offset)   *data_offset=dto;
-		if(repeat_count)  *repeat_count=dtr;
-	}
-	return 0;
-}
-/*** another function to help debugging ***/
-static int DEBUG_PageMapPrintSum(const PageMap *pm, uint32_t row)
-{
-	int i,r;
-	for(i=0,r=row; i < pm->data_recs && r > 0;r-=pm->data_run?pm->data_run[i]:1,i++){}
-	printf("Data recs= <%d>, rows_left = <%d>\n",i,r);
-	for(i=0,r=row; i < pm->leng_recs && r >0;r-=pm->leng_run[i++]){}
-	printf("Leng recs= <%d>, rows_left = <%d>\n",i,r);
-	return 0;
-}
-rc_t PageMapFindRow(const PageMap *cself,uint64_t row,uint32_t * data_offset,uint32_t * data_length,uint32_t * repeat_count)
-{
-	rc_t	rc=0;
-	PageMapRegion *pmr;
-
-	if(cself->data_recs == 1){ /** static **/
-		if(repeat_count) *repeat_count = UINT32_MAX;
-		if(data_offset)  *data_offset = 0;
-		if(data_length)  *data_length = cself->length[0];
-		return 0;
-        }
-	if(cself->random_access && cself->leng_recs == 1){
-		if(row >= cself->data_recs)
-			return RC(rcVDB, rcPagemap, rcAccessing, rcRow, rcOutofrange);
-		if(data_length)  *data_length = cself->length[0];
-		if(data_offset)  *data_offset =  cself->data_offset[row];
-		if(repeat_count){
-			uint64_t i;
-			for( i=row+1, repeat_count[0]=1; i < cself->data_recs &&  cself->data_offset[i] == cself->data_offset[row]; i++, repeat_count[0]++ ){}
-		}
-		return 0;
-	}
-
-	rc = PageMapFindRegion(cself,row,&pmr);
-	if(rc) return rc;
-
-        rc = PageMapRegionGetData(pmr,cself->dstorage.base,row,data_offset,data_length,repeat_count);
-	if(rc) return rc;
-
-#if _HEAVY_PAGEMAP_DEBUGGING
-	{
-		uint32_t dto,dtl,dtr;
-		rc = PageMapGetData_HW(cself,row,&dto,&dtl,&dtr);
-		assert(rc == 0);
-		if(data_length) assert(dtl==*data_length);
-		if(data_offset) assert(dto==*data_offset);
-		if(repeat_count)  assert(dtr==*repeat_count);
-	}
-#endif
-	return 0;
-}
-
-rc_t PageMapNewIterator(const PageMap *self, PageMapIterator *lhs, uint64_t first_row, uint64_t num_rows)
-{
-    rc_t rc;
-
-    if (first_row + num_rows > self->row_count)
-        num_rows = self->row_count - first_row;
-
-#if _DEBUGGING
-    if (self->data_recs > 1) {
-        assert(first_row == (row_count_t)first_row);
-        assert(num_rows == (row_count_t)num_rows);
-        assert(first_row + num_rows == (row_count_t)(first_row + num_rows));
-    }
-#endif
-    
-    memset(lhs, 0, sizeof(*lhs));
-
-#if _HEAVY_PAGEMAP_DEBUGGING
-    lhs->parent = self;
-#endif
-
-    lhs->last_row = first_row + num_rows;
-    lhs->cur_row = first_row;
-    if(self->data_recs == 1){
-	lhs->repeat_count  = (num_rows < UINT32_MAX)?num_rows:UINT32_MAX;
-	lhs->static_datalen = self->length[0];
-	return 0;
-    }
-    if(self->random_access && self->leng_recs == 1 && first_row < self->row_count){ /** simple random access - no explosion needed **/
-	lhs->static_datalen = self->length[0];
-	lhs->exp_base = &self->data_offset;
-	if(lhs->last_row > self->row_count) lhs->last_row = self->row_count;
-	return 0;
-    }
-    if( self->exp_row_last < lhs->last_row){
-	    rc = PageMapExpand(self,lhs->last_row-1);
-	    if(rc) return rc;
-    }
-    rc = PageMapFindRow(self,first_row,NULL,NULL,NULL);
-    if(rc) return rc;
-    lhs->rgns    = (PageMapRegion**) &self->istorage.base;
-    lhs->exp_base = (elem_count_t**) &self->dstorage.base;
-    lhs->cur_rgn  = self->i_rgn_last;
-    lhs->cur_rgn_row = lhs->cur_row - (*lhs->rgns)[self->i_rgn_last].start_row;
-    assert(lhs->cur_rgn_row < (*lhs->rgns)[self->i_rgn_last].numrows);
-    return  0;
-}
-
-static PageMap *new_PageMap(void) {
-
-    PageMap *y;
-    y = malloc(sizeof(*y));
-    if (y) {
-	memset(y,0,sizeof(*y));
-        KRefcountInit(&y->refcount, 1, "PageMap", "new", "");
-	y->istorage.elem_bits = sizeof(PageMapRegion)*8;
-	y->dstorage.elem_bits = sizeof(elem_count_t)*8;
-    }
-    return y;
-}
-
-static PageMap *new_StaticPageMap(unsigned length, unsigned data) {
-    union {
-        PageMap pm;
-        row_count_t rcnt;
-        elem_count_t ecnt;
-    } *y;
-    size_t const sz = sizeof(*y)
-                    + sizeof(y->pm.length[0]) * length
-                    + sizeof(y->pm.leng_run[0]) * length
-                    + sizeof(y->pm.data_run[0]) * data;
-    
-    y = malloc(sz);
-    if (y) {
-#if PAGEMAP_STATISTICS
-        ++pm_stats.createStatic;
-        ++pm_stats.alive;
-        if (pm_stats.maxAlive < pm_stats.alive)
-            pm_stats.maxAlive = pm_stats.alive;
-        pm_stats.currentFootprint += sz;
-        if (pm_stats.maxFootprint < pm_stats.currentFootprint)
-            pm_stats.maxFootprint = pm_stats.currentFootprint;
-#endif
-        memset(&y->pm, 0, sizeof(y->pm));
-        KRefcountInit(&y->pm.refcount, 1, "PageMap", "new_Static", "");
-        y->pm.length = (elem_count_t *)&y[1];
-        y->pm.leng_run = (row_count_t *)&y->pm.length[length];
-        y->pm.data_run = &y->pm.leng_run[length];
-        y->pm.reserve_leng = length;
-        y->pm.reserve_data = data;
-	y->pm.istorage.elem_bits = sizeof(PageMapRegion)*8;
-	y->pm.dstorage.elem_bits = sizeof(elem_count_t)*8;
-    }
-    return &y->pm;
-}
-
-static
-rc_t PageMapGrow(PageMap *self, uint32_t new_reserve_leng, uint32_t new_reserve_data) {
-    uint32_t sz;
-    PageMap temp = *self;
-    uint32_t reserve_data = self->reserve_data;
-    uint32_t reserve_leng = self->reserve_leng;
-    rc_t rc;
-
-#if PAGEMAP_STATISTICS
-    ++pm_stats.grows;
-#endif
-    if (new_reserve_leng > (1UL << 31) || new_reserve_data > (1UL << 31))
-        return RC(rcVDB, rcPagemap, rcAllocating, rcParam, rcExcessive);
-    
-    if (reserve_leng == 0)
-        reserve_leng = 1;
-    if (reserve_data == 0)
-        reserve_data = 1;
-#define MIN_KBUF_RESERVE_SIZE 256  
-    while (reserve_leng < new_reserve_leng)
-        reserve_leng <<= 1;
-    if (reserve_leng < MIN_KBUF_RESERVE_SIZE) reserve_leng = MIN_KBUF_RESERVE_SIZE;
-    while (reserve_data < new_reserve_data)
-        reserve_data <<= 1;
-    if (reserve_data < MIN_KBUF_RESERVE_SIZE) reserve_data = MIN_KBUF_RESERVE_SIZE;
-
-    sz = reserve_leng * 2 + reserve_data;
-#if PAGEMAP_STATISTICS
-    pm_stats.currentFootprint -= KDataBufferMemorySize(&self->estorage);
-#endif
-    {
-        KDataBuffer new_buffer;
-        
-        rc = KDataBufferMake(&new_buffer, 8 * sizeof(uint32_t), sz);
-        if (rc)
-            return rc;
-#if PAGEMAP_STATISTICS
-        pm_stats.currentFootprint += KDataBufferMemorySize(&self->estorage);
-        if (pm_stats.maxFootprint < pm_stats.currentFootprint)
-            pm_stats.maxFootprint = pm_stats.currentFootprint;
-#endif
-        self->cstorage = new_buffer;
-    }
-    self->length = self->cstorage.base;
-    self->leng_run = self->length + reserve_leng;
-    self->data_run = self->leng_run + reserve_leng;
-    self->start_valid = 0;
-    
-    if (self->leng_recs > 0 && temp.length != NULL) {
-        memcpy(self->length  , temp.length  , self->reserve_leng * sizeof(uint32_t));
-        memcpy(self->leng_run, temp.leng_run, self->reserve_leng * sizeof(uint32_t));
-    }
-    if (self->data_recs > 0 && temp.data_run != NULL)
-        memcpy(self->data_run, temp.data_run, self->reserve_data * sizeof(uint32_t));
-
-    self->reserve_leng = reserve_leng;
-    self->reserve_data = reserve_data;
-#if PAGEMAP_STATISTICS
-    pm_stats.currentWaste += (self->reserve_data - self->data_recs) * sizeof(self->data_run[0]) +
-                             (self->reserve_leng - self->leng_recs) * (sizeof(self->leng_run[0]) + sizeof(self->length[0]));
-    if (pm_stats.maxWaste < pm_stats.currentWaste)
-        pm_stats.maxWaste = pm_stats.currentWaste;
-#endif
-    KDataBufferWhack(&temp.cstorage);
-
-    return 0;
-}
-
-rc_t PageMapNew(PageMap **lhs, uint32_t reserve) {
-    PageMap *y = new_PageMap();
-
-    if (y == NULL)
-        return RC(rcVDB, rcPagemap, rcConstructing, rcMemory, rcExhausted);
-
-    if (reserve > 0) {
-        rc_t rc = PageMapGrow(y, reserve, reserve);
-        if (rc) {
-            free(y);
-            return rc;
-        }
-#if PAGEMAP_STATISTICS
-        --pm_stats.grows;
-#endif
-    }
-    *lhs = y;
-#if PAGEMAP_STATISTICS
-    ++pm_stats.create;
-    ++pm_stats.alive;
-    if (pm_stats.maxAlive < pm_stats.alive)
-        pm_stats.maxAlive = pm_stats.alive;
-    pm_stats.currentFootprint += sizeof(*y);
-    if (pm_stats.maxFootprint < pm_stats.currentFootprint)
-        pm_stats.maxFootprint = pm_stats.currentFootprint;
-#endif
-    return 0;
-}
-
-rc_t PageMapToRandomAccess(PageMap **rslt, PageMap * src,uint32_t *data_offset) /** data_offset should have dimension of data_run ***/
-{
-	rc_t rc;
-	bool simple = (src->row_count == src->data_recs);
-	PageMap *dst;
-	assert(src->row_count >= src->leng_recs);
-	rc = PageMapNew(&dst, 0);
-	if(rc == 0){
-		dst->leng_recs=src->leng_recs;
-		dst->row_count=src->row_count;
-		rc = KDataBufferMake(&dst->cstorage, 8 * sizeof(uint32_t), 2*dst->leng_recs+(data_offset?dst->row_count:0));
-		if(rc == 0){
-			dst->length = dst->cstorage.base;
-			dst->leng_run    = dst->length   + dst->leng_recs;
-			dst->data_recs = src->row_count;
-			memcpy(dst->length,  src->length,  sizeof(uint32_t)*dst->leng_recs);
-			memcpy(dst->leng_run,src->leng_run,sizeof(uint32_t)*dst->leng_recs);
-			if(data_offset){
-				dst->data_offset = dst->leng_run + dst->leng_recs;
-				if(simple){
-					memcpy(dst->data_offset,data_offset,sizeof(uint32_t)*dst->row_count);
-				} else {
-					uint32_t i,j;
-					for(i=j=0;i<src->data_recs;i++){
-						elem_count_t data_len=src->data_run[i];
-						while(data_len > 0){
-							assert(j < src->row_count);
-							dst->data_offset[j++] = data_offset[i];
-							data_len--;
-						}
-					}
-				}
-				dst->random_access=true;
-			} 
-			dst->reserve_leng = dst->leng_recs;
-			dst->reserve_data = dst->row_count;
-			dst->start_valid = dst->row_count;
-			*rslt = dst;
-			return 0;
-		}
-		PageMapRelease(dst);
-	}
-	return rc;
-}
-
-
-rc_t PageMapNewFixedRowLength(PageMap **lhs, uint64_t row_count, uint64_t row_len) {
-    PageMap *y;
-    rc_t rc;
-
-    if (row_count >> 32 != 0 || row_len >> 32 != 0)
-        return RC(rcVDB, rcPagemap, rcConstructing, rcParam, rcTooBig);
-    
-    rc = PageMapNew(&y, 0);
-#if PAGEMAP_STATISTICS
-    ++pm_stats.createFixedRow;
-    --pm_stats.create;
-#endif
-    if (rc)
-        return rc;
-    rc = PageMapGrow(y, 1, (uint32_t)row_count);
-#if PAGEMAP_STATISTICS
-    --pm_stats.grows;
-#endif
-    if (rc == 0) {
-	int i;
-        *lhs = y;
-        y->length[0] = (uint32_t)row_len;
-        y->leng_run[0] = (uint32_t)row_count;
-        y->leng_recs = 1;
-        y->data_recs = (uint32_t)row_count;
-        y->row_count = (uint32_t)row_count;
-        for (i = 0; i != (uint32_t)row_count; ++i) {
-            y->data_run[i] = 1;
-        }
-
-    }
-    if (rc)
-        PageMapRelease(y);
-    return rc;
-}
-
-rc_t PageMapNewSingle(PageMap **lhs, uint64_t row_count, uint64_t row_len) {
-    PageMap *y;
-    rc_t rc;
-    
-    if (row_count >> 32 != 0)
-        return RC(rcVDB, rcPagemap, rcConstructing, rcParam, rcTooBig);
-    
-    rc = PageMapNewFixedRowLength(&y, 1, row_len);
-    if (rc == 0) {
-#if PAGEMAP_STATISTICS
-        ++pm_stats.createSingle;
-        --pm_stats.createFixedRow;
-#endif
-        y->row_count = y->data_run[0] = y->leng_run[0] = (uint32_t)row_count;
-        *lhs = y;
-    }
-    return rc;
-}
-
-bool PageMapHasRows(const PageMap *self) {
-    return self->data_recs > 0;
-}
-
-uint32_t PageMapFixedRowLength (const PageMap *self) {
-    uint32_t rslt = 0;
-    
-    if (self->leng_recs == 1)
-        rslt = self->length[0];
-    return rslt;
-}
-
-rc_t PageMapRowLengthRange (const PageMap *self,elem_count_t *min,elem_count_t *max)
-{
-    int i;
-    *min = *max = self->length[0];
-    for(i=1;i<self->leng_recs;i++){
-	if      (self->length[i] < *min) *min = self->length[i];
-	else if (self->length[i] > *max) *max = self->length[i];
-    }
-    return 0;
-}
-
-
-uint32_t PageMapHasSimpleStructure(const PageMap *self) {
-    uint32_t rslt = PageMapFixedRowLength(self);
-    
-    if (rslt == 0)
-        return rslt;
-
-    if(self->data_recs != self->row_count) return 0;
-
-    return rslt;
-}
-
-#if 0
-static bool PageMapValidate(const PageMap *cself) {
-    unsigned i;
-    uint32_t n;
-    uint32_t m;
-        
-    for (m = 0, i = 0; i != cself->leng_recs; ++i) m += cself->leng_run[i];
-    for (n = 0, i = 0; i != cself->data_recs; ++i) n += cself->data_run[i];
-
-    return m == n ? true : false;
-}
-
-static
-rc_t PageMapAppendRun(PageMap *self, uint32_t run_length, uint32_t row_length) {
-    return -1;
-}
-#endif
-
-rc_t PageMapAppendRows(PageMap *self, uint64_t row_length, uint64_t run_length, bool same_data) {
-    rc_t rc;
-    uint32_t leng_cur = self->leng_recs - 1;
-    uint32_t data_cur = self->data_recs - 1;
-    
-    if ((uint32_t)row_length != row_length)
-        return RC(rcVDB, rcPagemap, rcConstructing, rcParam, rcTooBig);
-    
-    if ((uint32_t)run_length != run_length)
-        return RC(rcVDB, rcPagemap, rcConstructing, rcParam, rcTooBig);
-    
-    if (self->leng_recs && row_length == self->length[leng_cur])
-        self->leng_run[leng_cur] += run_length;
-    else {
-        same_data = false;
-        leng_cur = self->leng_recs;
-        ++self->leng_recs;
-
-#if PAGEMAP_STATISTICS
-        pm_stats.currentWaste -= sizeof(self->leng_run[0]) + sizeof(self->length[0]);
-#endif
-        
-        if (self->leng_recs >= self->reserve_leng) {
-            rc = PageMapGrow(self, self->leng_recs, 0);
-            if (rc)
-                return rc;
-        }
-        self->leng_run[leng_cur] = run_length;
-        self->length[leng_cur] = (uint32_t)row_length;
-    }
-    if (self->data_recs && same_data)
-        self->data_run[data_cur] += run_length;
-    else {
-        data_cur = self->data_recs;
-        ++self->data_recs;
-        
-#if PAGEMAP_STATISTICS
-        pm_stats.currentWaste -= sizeof(self->data_run[0]);
-#endif
-        
-        if (self->data_recs >= self->reserve_data) {
-            rc = PageMapGrow(self, 0, self->data_recs);
-            if (rc)
-                return rc;
-        }
-        self->data_run[data_cur] = run_length;
-    }
-    if(self->row_count < self->pre_exp_row_count){
-	int i;
-	elem_count_t *exp_base = self->dstorage.base;
-	elem_count_t data_offset;
-	if(same_data){
-		if(self->row_count == 0){
-			data_offset = 0;
-		} else {
-			data_offset = exp_base[2*self->row_count-1];
-		}
-	} else {
-		data_offset = self->exp_data_offset_last;
-		self->exp_data_offset_last += row_length;
-	}
-	for(i=self->row_count;i<run_length+self->row_count;i++){
-		exp_base[2*i]  =  row_length;
-		exp_base[2*i+1]=  data_offset;
-	}
-	self->exp_row_last += run_length;
-	self->exp_rgn_last->numrows += run_length;
-	
-    }
-    self->row_count += run_length;
-    return 0;
-}
-
-static rc_t serialize_lengths(
-                              KDataBuffer *Dst,
-                              uint64_t offset, 
-                              const uint32_t run[],
-                              unsigned runs,
-                              uint64_t *consumed
-) {
-    rc_t rc;
-    unsigned i;
-    uint64_t j;
-    uint64_t n;
-    uint8_t *dst = Dst->base;
-    
-    dst += offset;
-    *consumed = 0;
-    for (i = 0, j = 0, n = 0, rc = 0; rc == 0 && i != runs; ++i, j += n)
-        rc = vlen_encodeU1(dst + j, 5, &n, run[i]);
-    
-    if (rc == 0)
-        *consumed = j;
-    
-    return rc;
-}
-
-#if 0
-
-static rc_t deserialize_lengths(
-                                uint32_t run[],
-                                unsigned runs,
-                                uint8_t const src[],
-                                unsigned ssize,
-                                uint64_t *consumed
-) {
-    unsigned i;
-    unsigned j;
-    uint64_t n;
-    
-    *consumed = 0;
-    for (i = 0, j = 0; i != runs; ++i, j += (unsigned)n) {
-        uint64_t val;
-        rc_t rc = vlen_decodeU1(&val, src + j, ssize - j, &n);
-        
-        if (rc) return rc;
-        run[i] = (uint32_t)val;
-    }
-    *consumed = j;
-    return 0;
-}
-#else
-
-#if _ARCH_BITS == 32
-#define FLAG_64 0x8080808080808080ULL
-#define VAL_64  0x7F7F7F7F7F7F7F7FULL
-#else
-#define FLAG_64 0x8080808080808080UL
-#define VAL_64  0x7F7F7F7F7F7F7F7FUL
-#endif
-
-static rc_t deserialize_lengths(
-                                uint32_t run[],
-                                unsigned runs,
-                                uint8_t const src[],
-                                unsigned ssize,
-                                uint64_t *consumed
-) {
-    uint8_t	to_align = 16 - (((long)src)&15);/** alignmentto 16 bytes will make optimizer and cpu happy. don't care about loss in cast - we need the lowest byte **/
-    int		si=0;/**source index **/
-    int		di=0;/** destination index **/
-    int		pcnt = (ssize - to_align )/8; 
-
-    memset(run,0,runs*sizeof(*run));
-    if(pcnt){ /** does it make sense at all ***/
-	uint64_t    *ptr=(uint64_t*) (src + to_align);
-	int         pi;
-	
-	for(;si<to_align && di < runs ;si++){ /** align the pointer first **/
-		if(((int8_t)src[si]) < 0) {
-			run[di] += src[si] & 0x7F;
-			run[di] <<= 7;
-		} else {
-			run[di++] += src[si];
-		}
-	}	
-	assert((((long)ptr)&15) == 0);
-	for(pi = 0; pi < pcnt && di < runs; pi++){ /** do bulk staff **/
-		uint64_t flag = ptr[pi] & FLAG_64;
-		uint64_t  val = ptr[pi] & VAL_64;
-		int  i;
-		int8_t     *cf = (int8_t*)&flag;
-		uint8_t	   *cv = (uint8_t*)&val;
-		for(i=0;i<8 && di < runs;i++){ /** no endian problem - casting of ptr matches casting of flag & val **/
-			si++;
-			run[di] += cv[i];
-			if(cf[i] < 0){
-				run[di] <<= 7;
-			} else {
-				di++;
-			}
-		}
-	}
-    }
-   
-    for(;si < ssize && di < runs;si++){/** deal with tails **/
-	if(((int8_t)src[si]) < 0) {
-		run[di] += src[si] & 0x7F;
-		run[di] <<= 7;
-	} else {
-		run[di++] += src[si];
-	}
-    }
-    *consumed = si;
-    return 0;
-}
-
-#endif
-
-static
-rc_t serialize(const PageMap *self, KDataBuffer *buffer, uint64_t *size) {
-/*
- variant 0: fixed row length, data_run[..] == 1
-    vlencode(row_length)
- version 2: same as 0 but random access
-    adds serialize(data_offset)
-
- variant 1: fixed row length, variable data_run
-    vlencode(row_length)
-    vlencode(data_recs)
-    serialize(data_run)
-
- variant 2: variable row length, data_run[..] == 1
-    vlencode(leng_recs)
-    serialize(length)
-    serialize(leng_run)
- versuion 2: same as 2 but random access
-    adds serialize(data_offset)
- 
- variant 3: variable row length, variable data_run
-    vlencode(leng_recs)
-    vlencode(data_recs)
-    serialize(length)
-    serialize(leng_run)
-    serialize(data_run)
-
-  
-
- */
-    uint8_t version = self->random_access?2:1;
-    uint8_t variant = 0;
-    uint8_t header;
-    rc_t rc = 0;
-    uint64_t sz;
-    KDataBuffer compress;
-
-
-
-    memset(&compress, 0, sizeof(compress));
-
-    variant = ( (self->data_recs == self->row_count)? 0 : 1) | ((self->leng_recs == 1 ? 0 : 1) << 1);
-    header = (version << 2) | variant;
-    switch (variant) {
-    case 0:
-        rc = KDataBufferResize(buffer, 6);
-        if (rc == 0) {
-            ((uint8_t *)buffer->base)[0] = header;
-            vlen_encodeU1(((uint8_t *)buffer->base) + 1, 5, &sz, self->length[0]);
-	    buffer->elem_count = sz + 1;
-	    if(self->random_access){
-		rc = KDataBufferMakeBytes(&compress, 5*self->row_count);
-		if(rc == 0){
-			rc = serialize_lengths(&compress, 0, self->data_offset, self->row_count, &sz);
-			compress.elem_count = sz;
-		}
-	    }
-        }
-        break;
-    case 1:
-        rc = KDataBufferResize(buffer, 11);
-        if (rc == 0) {
-            rc = KDataBufferMakeBytes(&compress, 5 * self->data_recs);
-            if (rc == 0) {
-                ((uint8_t *)buffer->base)[0] = header;
-                vlen_encodeU1(((uint8_t *)buffer->base) + 1, 5, &sz, self->length[0]);
-                buffer->elem_count = sz + 1;
-                vlen_encodeU1(((uint8_t *)buffer->base) + 1 + sz, 5, &sz, self->data_recs);
-                buffer->elem_count += sz;
-                
-                rc = serialize_lengths(&compress, 0, self->data_run, self->data_recs, &sz);
-                compress.elem_count = sz;
-            }
-        }
-        break;
-    case 2:
-        rc = KDataBufferResize(buffer, 6);
-        if (rc == 0) {
-            rc = KDataBufferMakeBytes(&compress, 10 * self->leng_recs + (self->random_access?5*self->row_count:0));
-            if (rc == 0) {
-                ((uint8_t *)buffer->base)[0] = header;
-                vlen_encodeU1(((uint8_t *)buffer->base) + 1, 5, &sz, self->leng_recs);
-                buffer->elem_count = sz + 1;
-
-                rc = serialize_lengths(&compress, 0, self->length, self->leng_recs, &sz);
-                compress.elem_count = sz;
-                if (rc == 0) {
-                    rc = serialize_lengths(&compress, compress.elem_count, self->leng_run, self->leng_recs, &sz);
-                    compress.elem_count += sz;
-		    if(self->random_access && rc == 0) {
-                        rc = serialize_lengths(&compress, compress.elem_count, self->data_offset, self->row_count, &sz);
-                        compress.elem_count += sz;
-		    }
-                }
-            }
-        }
-	break;
-    case 3:
-        rc = KDataBufferResize(buffer, 11);
-        if (rc == 0) {
-            rc = KDataBufferMakeBytes(&compress, 10 * self->leng_recs + 5 * self->data_recs);
-            if (rc == 0) {
-                ((uint8_t *)buffer->base)[0] = header;
-                vlen_encodeU1(((uint8_t *)buffer->base) + 1, 5, &sz, self->leng_recs);
-                buffer->elem_count = sz + 1;
-                vlen_encodeU1(((uint8_t *)buffer->base) + 1 + sz, 5, &sz, self->data_recs);
-                buffer->elem_count += sz;
-                
-                rc = serialize_lengths(&compress, 0, self->length, self->leng_recs, &sz);
-                compress.elem_count = sz;
-                if (rc == 0) {
-                    rc = serialize_lengths(&compress, compress.elem_count, self->leng_run, self->leng_recs, &sz);
-                    compress.elem_count += sz;
-                    if (rc == 0) {
-                        rc = serialize_lengths(&compress, compress.elem_count, self->data_run, self->data_recs, &sz);
-                        compress.elem_count += sz;
-                    }
-                }
-            }
-        }
-        break;
-    }
-    if (rc == 0 && compress.base) {
-        uint64_t hsize = buffer->elem_count;
-        
-        rc = KDataBufferResize(buffer, hsize + compress.elem_count);
-        if (rc == 0) {
-            if (version == 0)
-                memcpy(((uint8_t *)buffer->base) + hsize, compress.base, compress.elem_count);
-            else {
-                z_stream zs;
-                int zr;
-                
-                memset(&zs, 0, sizeof(zs));
-                
-                assert(compress.elem_count >> 32 == 0);
-                
-                zs.next_out = ((Bytef *)buffer->base) + hsize;
-                zs.avail_out = (uInt)compress.elem_count;
-                
-                zs.next_in = compress.base;
-                zs.avail_in = (uInt)compress.elem_count;
-                
-                zr = deflateInit2(&zs, Z_BEST_SPEED, Z_DEFLATED, -15, 9, Z_DEFAULT_STRATEGY);
-                switch (zr) {
-                case Z_OK:
-                    for (; ;) {
-                        zr = deflate(&zs, Z_FINISH);
-                        if (zr == Z_OK) {
-                            unsigned const offset = (unsigned)(zs.next_out - (Bytef *)buffer->base);
-                            rc = KDataBufferResize(buffer, buffer->elem_count * 2);
-                            if (rc)
-                                break;
-                            zs.next_out = ((Bytef *)buffer->base) + offset;
-                            zs.avail_out = (uInt)(buffer->elem_count - offset);
-                        }
-                        else if (zr == Z_STREAM_END) {
-                            KDataBufferResize(buffer, zs.total_out + hsize);
-                            break;
-                        }
-                        else {
-                            rc = RC(rcVDB, rcPagemap, rcWriting, rcParam, rcInvalid);
-                            break;
-                        }
-                    }
-                    deflateEnd(&zs);
-                    break;
-                case Z_MEM_ERROR:
-                    rc = RC(rcVDB, rcPagemap, rcWriting, rcMemory, rcExhausted);
-                    break;
-                default:
-                    rc = RC(rcVDB, rcPagemap, rcWriting, rcParam, rcInvalid);
-                }
-            }
-        }
-    }
-    KDataBufferWhack(&compress);
-    if (rc == 0)
-        *size = buffer->elem_count;
-    
-    return rc;
-}
-
-rc_t PageMapSerialize (const PageMap *self, KDataBuffer *buffer, uint64_t offset, uint64_t *size) {
-    rc_t rc;
-    KDataBuffer temp;
-
-    assert(buffer->elem_bits == 8);
-    assert(buffer->bit_offset == 0);
-    
-    rc = KDataBufferMakeBytes(&temp, 0);
-    if (rc == 0) {
-        uint64_t sz;
-        
-        rc = serialize(self, &temp, &sz);
-        if (rc == 0) {
-            rc = KDataBufferResize(buffer, offset + sz);
-            if (rc == 0)
-                memcpy(&((char *)buffer->base)[offset], temp.base, sz);
-            *size = sz;
-        }
-        KDataBufferWhack(&temp);
-    }
-    return rc;
-}
-
-static
-rc_t PageMapDeserialize_v0(PageMap **lhs, uint8_t const src[], unsigned ssize, row_count_t row_count) {
-    uint8_t variant = src[0] & 3;
-    uint8_t version =src[0] >> 2;
-    unsigned cur = 1;
-    uint64_t row_len;
-    uint64_t data_recs;
-    uint64_t leng_recs;
-    uint64_t sz;
-    bool     random_access=(version==2?true:false);
-    rc_t rc = 0;
-    
-    switch (variant) {
-    case 0:
-        /*
-         variant 0: fixed row length, data_run[..] == 1
-         vlencode(row_length)
-         */
-        rc = vlen_decodeU1(&row_len, &src[cur], ssize - cur, &sz); if (rc) return rc;
-	cur += sz;
-        
-        *lhs = new_StaticPageMap(1, random_access?row_count:1);
-        if (*lhs == NULL)
-            return RC(rcVDB, rcPagemap, rcConstructing, rcMemory, rcExhausted);
-        
-        (**lhs).data_recs = row_count;
-        (**lhs).leng_recs = 1;
-        
-        (**lhs).length[0] = (elem_count_t)row_len;
-        (**lhs).leng_run[0] = row_count;
-
-	if(random_access){
-		(**lhs).data_offset= (**lhs).data_run;
-		rc = deserialize_lengths((**lhs).data_offset, (unsigned)row_count, &src[cur], ssize - cur, &sz);
-	}
-	(**lhs).data_run = 0;
-        break;
-    case 1:
-        /*
-         variant 1: fixed row length, variable data_run
-         vlencode(row_length)
-         vlencode(data_recs)
-         serialize(data_run)
-         */
-        rc = vlen_decodeU1(&row_len, &src[cur], ssize - cur, &sz); if (rc) return rc;
-        cur += sz;
-        
-        rc = vlen_decodeU1(&data_recs, &src[cur], ssize - cur, &sz); if (rc) return rc;
-        cur += sz;
-        
-        *lhs = new_StaticPageMap(1, data_recs);
-        if (*lhs == NULL)
-            return RC(rcVDB, rcPagemap, rcConstructing, rcMemory, rcExhausted);
-        
-        (**lhs).data_recs = data_recs;
-        (**lhs).leng_recs = 1;
-        
-        (**lhs).length[0] = (elem_count_t)row_len;
-        (**lhs).leng_run[0] = row_count;
-        
-        rc = deserialize_lengths((**lhs).data_run, (unsigned)data_recs, &src[cur], ssize - cur, &sz);
-        break;
-    case 2:
-        /*
-         variant 2: variable row length, data_run[..] == 1
-         vlencode(leng_recs)
-         serialize(length)
-         serialize(leng_run)
-         */
-        rc = vlen_decodeU1(&leng_recs, &src[cur], ssize - cur, &sz); if (rc) return rc;
-        cur += sz;
-        
-        *lhs = new_StaticPageMap((unsigned)leng_recs, random_access?row_count:1);
-        if (*lhs == NULL)
-            return RC(rcVDB, rcPagemap, rcConstructing, rcMemory, rcExhausted);
-        
-        (**lhs).data_recs = row_count;
-        (**lhs).leng_recs = leng_recs;
-        
-#if 0  
-        rc = deserialize_lengths((**lhs).length, (unsigned)leng_recs, &src[cur], ssize - cur, &sz);
-        if (rc == 0) {
-            cur += sz;
-            rc = deserialize_lengths((**lhs).leng_run, (unsigned)leng_recs, &src[cur], ssize - cur, &sz);
-        }
-#else /** can use the fact that both length and leng_run a sequentually allocated ***/
-	rc = deserialize_lengths((**lhs).length, (unsigned)(2*leng_recs), &src[cur], ssize - cur, &sz);
-	if(rc == 0 && random_access){
-		cur+=sz;
-		(**lhs).data_offset= (**lhs).data_run;
-		rc = deserialize_lengths((**lhs).data_offset, (unsigned)row_count, &src[cur], ssize - cur, &sz);
-	}
-	(**lhs).data_run = 0;
-		
-#endif
-        break;
-    case 3:
-        /*
-         variant 3: variable row length, variable data_run
-         vlencode(leng_recs)
-         vlencode(data_recs)
-         serialize(length)
-         serialize(leng_run)
-         serialize(data_run)
-         */
-        rc = vlen_decodeU1(&leng_recs, &src[cur], ssize - cur, &sz);  if (rc) return rc;
-        cur += sz;
-        
-        rc = vlen_decodeU1(&data_recs, &src[cur], ssize - cur, &sz);  if (rc) return rc;
-        cur += sz;
-        
-        *lhs = new_StaticPageMap(leng_recs, data_recs);
-        if (*lhs == NULL)
-            return RC(rcVDB, rcPagemap, rcConstructing, rcMemory, rcExhausted);
-        
-        (**lhs).data_recs = data_recs;
-        (**lhs).leng_recs = leng_recs;
-#if 0   
-        rc = deserialize_lengths((**lhs).length, leng_recs, &src[cur], ssize - cur, &sz);
-        if (rc == 0) {
-            cur += sz;
-            rc = deserialize_lengths((**lhs).leng_run, leng_recs, &src[cur], ssize - cur, &sz);
-            if (rc == 0) {
-                cur += sz;
-                rc = deserialize_lengths((*lhs)->data_run, data_recs, &src[cur], ssize - cur, &sz);
-            }
-        }
-#else /** can use the fact that both length and leng_run a sequentually allocated ***/
-	rc = deserialize_lengths((**lhs).length, (unsigned)(2*leng_recs+data_recs), &src[cur], ssize - cur, &sz);
-#endif
-        break;
-     default:
-	rc = RC(rcVDB, rcPagemap, rcConstructing, rcFormat, rcUnrecognized);
-    }
-    (**lhs).random_access = random_access;
-    return rc;
-}
-
-static
-rc_t PageMapDeserialize_v1(PageMap **lhs, const uint8_t *Src, uint64_t ssize, uint32_t row_count) {
-    const uint8_t *src = Src;
-    const uint8_t * const endp = src + ssize;
-    uint8_t variant = *src & 3;
-    uint64_t bsize;
-    uint64_t hsize;
-    uint64_t val;
-    uint64_t sz;
-    rc_t rc = 0;
-    KDataBuffer decompress;
-    z_stream zs;
-    int zr;
-    bool random_access = ((src[0]>>2)==2);
-    
-    switch (variant) {
-    case 0:
-	if(!random_access)
-		return PageMapDeserialize_v0(lhs, src, ssize, row_count);
-	++src;
-	rc = vlen_decodeU1(&val, src, endp - src, &sz);
-	if( rc == 0){
-		src += sz;
-		hsize = src - Src;
-		bsize = 5 * row_count;
-	}
-	break;
-    case 1:
-        ++src;
-        rc = vlen_decodeU1(&val, src, endp - src, &sz);
-        if (rc == 0) {
-            src += sz;
-            rc = vlen_decodeU1(&val, src, endp - src, &sz);
-            if (rc == 0) {
-                src += sz;
-                hsize = src - Src;
-                bsize = 5 * val;
-            }
-        }
-        break;
-    case 2:
-        ++src;
-        rc = vlen_decodeU1(&val, src, endp - src, &sz);
-        if (rc == 0) {
-            src += sz;
-            hsize = src - Src;
-            bsize = 10 * val;
-	    if(random_access){
-		bsize +=  5 * row_count;
-	    }
-        }
-        break;
-    case 3:
-        ++src;
-        rc = vlen_decodeU1(&val, src, endp - src, &sz);
-        if (rc == 0) {
-            src += sz;
-            bsize = 10 * val;
-            rc = vlen_decodeU1(&val, src, endp - src, &sz);
-            if (rc == 0) {
-                src += sz;
-                hsize = src - Src;
-                bsize += 5 * val;
-            }
-        }
-        break;
-    default:
-        return RC(rcVDB, rcPagemap, rcConstructing, rcData, rcInvalid);
-    }
-    if (rc)
-        return rc;
-    
-    rc = KDataBufferMakeBytes(&decompress, hsize + bsize);
-    if (rc)
-        return rc;
-
-    memcpy(decompress.base, Src, hsize);
-    memset(&zs, 0, sizeof(zs));
-    
-    zs.next_in = (Bytef *)src;
-    assert((endp - src) == (uInt)(endp - src));
-    zs.avail_in = (uInt)(endp - src);
-    
-    zs.next_out = ((Bytef *)decompress.base) + hsize;
-    assert(bsize == (uInt)(bsize));
-    zs.avail_out = (uInt)bsize;
-    
-    zr = inflateInit2(&zs, -15);
-    if (zr == Z_OK) {
-        zr = inflate(&zs, Z_FINISH);
-        if (zr != Z_STREAM_END)
-            rc = RC(rcVDB, rcPagemap, rcConstructing, rcData, rcInvalid);
-        inflateEnd(&zs);
-    }
-    else
-        rc = RC(rcVDB, rcPagemap, rcConstructing, rcMemory, rcExhausted);
-    
-    if (rc == 0)
-        rc = PageMapDeserialize_v0(lhs, decompress.base, hsize + zs.total_out, row_count);
-    KDataBufferWhack(&decompress);
-    return rc;
-}
-
-rc_t PageMapDeserialize (PageMap **lhs, const void *src, uint64_t ssize, uint64_t row_count) {
-    rc_t rc;
-
-    if ((uint32_t)row_count != row_count)
-        return RC(rcVDB, rcPagemap, rcConstructing, rcParam, rcTooBig);
-        
-    if (lhs == NULL)
-        return RC(rcVDB, rcPagemap, rcConstructing, rcParam, rcNull);
-    
-    *lhs = NULL;
-    if (src == NULL || ssize == 0)
-        return 0;
-
-    switch (*(const uint8_t *)src >> 2) {
-    case 0:
-        rc = PageMapDeserialize_v0(lhs, src, ssize, (uint32_t)row_count);
-        break;
-    case 1:
-    case 2:
-        rc = PageMapDeserialize_v1(lhs, src, ssize, (uint32_t)row_count);
-        break;
-    default:
-        return RC(rcVDB, rcPagemap, rcConstructing, rcData, rcBadVersion);
-    }
-    if (rc == 0)
-        (**lhs).row_count = (uint32_t)row_count;
-    else
-        PageMapRelease(*lhs);
-    return rc;
-}
-
-static
-rc_t PageMapDestroy(PageMap *that)
-{
-#if PAGEMAP_STATISTICS
-    pm_stats.currentWaste -= (that->reserve_data - that->data_recs) * sizeof(that->data_run[0]) +
-                             (that->reserve_leng - that->leng_recs) * (sizeof(that->leng_run[0]) + sizeof(that->length[0]));
-    pm_stats.currentFootprint -= sizeof(*that) + that->reserve_data * sizeof(that->data_run[0]) +
-                                 that->reserve_leng * (sizeof(that->leng_run[0]) + sizeof(that->length[0]));
-    --pm_stats.alive;
-    if (pm_stats.alive == 0) {
-        fprintf(stderr, 
-                "PM Stats:\n"
-                "Footprint (cur/max): %u/%u\n"
-                "Waste (cur/max): %u/%u\n"
-                "Alive (cur/max): %u/%u\n"
-                "Created (static/fixed/single/total): %u/%u/%u/%u\n"
-                "Grows: %u\n"
-                "Expands (act/calls): %u/%u\n"
-                "Appends: %u\n\n",
-                (unsigned)pm_stats.currentFootprint,
-                (unsigned)pm_stats.maxFootprint,
-                (unsigned)pm_stats.currentWaste,
-                (unsigned)pm_stats.maxWaste,
-                pm_stats.alive,
-                pm_stats.maxAlive,
-                pm_stats.createStatic,
-                pm_stats.createFixedRow,
-                pm_stats.createSingle,
-                pm_stats.create + pm_stats.createStatic + pm_stats.createFixedRow + pm_stats.createSingle,
-                pm_stats.grows,
-                pm_stats.expands,
-                pm_stats.expandCalls,
-                pm_stats.appends
-                );
-    }
-#endif
-    KDataBufferWhack(&that->istorage);
-    KDataBufferWhack(&that->dstorage);
-    KDataBufferWhack(&that->cstorage);
-    free(that);
-    return 0;
-}
-
-rc_t PageMapRelease (const PageMap *self) {
-    if (self) {
-        if (KRefcountDrop(&self->refcount, "PageMap") == krefWhack)
-          return PageMapDestroy((PageMap *)self);
-    }
-    return 0;
-}
-
-rc_t PageMapAddRef (const PageMap *self) {
-    if (self)
-        KRefcountAdd(&self->refcount, "PageMap");
-    return 0;
-}
-
-uint32_t PageMapGetIdxRowInfo (const PageMap *cself, uint32_t idx, uint32_t *starting_element)
-{
-	rc_t rc=0;
-	uint32_t	len;
-
-	if (idx  < (cself->data_run?cself->data_run[0]:1) || cself->data_recs == 1) {
-		if (starting_element) *starting_element = 0;
-		if (cself->leng_recs == 0) len=0;
-		else  len = cself->length[0];
-		return cself->length[0];
-	} else {
-		rc = PageMapFindRow(cself,idx,starting_element,&len,NULL);
-		if(rc) len=0;
-	}
-	return len;
-}
-
-int PageMapCompare(const PageMap *a, const PageMap *b) {
-    unsigned ai;
-    unsigned bi;
-    unsigned ar; /* runs in a */
-    unsigned br; /* runs in b */
-    
-    if (
-        a == b || (
-        a->leng_recs == b->leng_recs &&
-        a->data_recs == b->data_recs &&
-        memcmp(a->length, b->length, sizeof(a->length[0]) * a->leng_recs) == 0 &&
-        memcmp(a->leng_run, b->leng_run, sizeof(a->leng_run[0]) * a->leng_recs) == 0 &&
-        memcmp(a->data_run, b->data_run, sizeof(a->data_run[0]) * a->data_recs) == 0
-    ))
-        return 2;
-    
-    ai = bi = 0;
-    ar = a->leng_run[0];
-    br = b->leng_run[0];
-    
-    while (ai < a->leng_recs && bi < b->leng_recs) {
-        if (a->length[ai] != b->length[bi])
-            return 0;
-        if (ar < br) {
-            br -= ar;
-            ar = a->leng_run[++ai];
-        }
-        else if (ar == br) {
-            ar = a->leng_run[++ai];
-            br = b->leng_run[++bi];
-        }
-        else {
-            ar -= br;
-            br = b->leng_run[++bi];
-        }
-    }
-    if (ai != a->leng_recs || bi != b->leng_recs)
-        return -1;
-    else
-        return 1;
-}
-
-int PageMapCompareStatic (const PageMap *a, const PageMap *b) {
-    if (
-	  a->data_recs != 1 ||
-	  a->leng_recs != 1 ||
-	  a->leng_run[0] != a->data_run[0]
-    )
-        return -1; /* *a is not static */
-    
-    if (a == b)
-        return 2; /* static and identical */
-
-    if (
-	  b->data_recs != 1 ||
-	  b->leng_recs != 1 ||
-	  b->leng_run[0] != b->data_run[0]
-    )
-        return -1; /* *b is not static */
-    
-    if (a->length[0] == b->length[0] && a->leng_run[0] <= b->leng_run[0])
-        /* static and compatible, but we want to prevent deeper inspection
-         * so we're lying and saying that they are identical */
-        return 2;
-
-    return 0;  /* not same */
-}
-
-rc_t PageMapAppend(PageMap *self, const PageMap *other) {
-    KDataBuffer cstorage;
-    rc_t rc;
-    
-    rc = KDataBufferMake(&cstorage, sizeof(self->length[0]) * 8, (self->leng_recs + other->leng_recs) * 2 + self->data_recs + other->data_recs);
-    if (rc == 0) {
-        uint32_t *const length = cstorage.base;
-        uint32_t *const leng_run = length + self->leng_recs + other->leng_recs;
-        uint32_t *const data_run = leng_run + self->leng_recs + other->leng_recs;
-        
-#if PAGEMAP_STATISTICS
-        ++pm_stats.appends;
-        pm_stats.currentWaste -= (self->reserve_data - self->data_recs) * sizeof(self->data_run[0]) +
-                                 (self->reserve_leng - self->leng_recs) * (sizeof(self->leng_run[0]) + sizeof(self->length[0]));
-        pm_stats.currentFootprint -= self->reserve_data * sizeof(self->data_run[0]) +
-                                     self->reserve_leng * (sizeof(self->leng_run[0]) + sizeof(self->length[0]));
-#endif
-        memcpy(length                  , self->length , self->leng_recs  * sizeof(length[0]));
-        memcpy(length + self->leng_recs, other->length, other->leng_recs * sizeof(length[0]));
-
-        memcpy(leng_run                  , self->leng_run , self->leng_recs  * sizeof(leng_run[0]));
-        memcpy(leng_run + self->leng_recs, other->leng_run, other->leng_recs * sizeof(leng_run[0]));
-        
-        memcpy(data_run                  , self->data_run , self->data_recs  * sizeof(data_run[0]));
-        memcpy(data_run + self->data_recs, other->data_run, other->data_recs * sizeof(data_run[0]));
-        
-        KDataBufferWhack(&self->cstorage);
-        self->cstorage = cstorage;
-
-        self->length = length;
-        self->leng_run = leng_run;
-        self->data_run = data_run;
-        
-        self->leng_recs += other->leng_recs;
-        self->data_recs += other->data_recs;
-        self->row_count += other->row_count;
-        self->reserve_leng = self->leng_recs;
-        self->reserve_data = self->data_recs;
-        
-#if PAGEMAP_STATISTICS
-        pm_stats.currentWaste += (self->reserve_data - self->data_recs) * sizeof(self->data_run[0]) +
-                                 (self->reserve_leng - self->leng_recs) * (sizeof(self->leng_run[0]) + sizeof(self->length[0]));
-        pm_stats.currentFootprint += self->reserve_data * sizeof(self->data_run[0]) +
-                                     self->reserve_leng * (sizeof(self->leng_run[0]) + sizeof(self->length[0]));
-        if (pm_stats.maxFootprint < pm_stats.currentFootprint)
-            pm_stats.maxFootprint = pm_stats.currentFootprint;
-#endif
-        return 0;
-    }
-    return rc;
-}
diff --git a/libs/vdb/page-map.h b/libs/vdb/page-map.h
deleted file mode 100644
index 0fead2e..0000000
--- a/libs/vdb/page-map.h
+++ /dev/null
@@ -1,383 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#ifndef _h_page_map_
-#define _h_page_map_
-
-#include <assert.h>
-
-#ifndef _h_vdb_extern_
-#include <vdb/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#include <klib/data-buffer.h>
-#include <klib/refcount.h>
-
-#if _DEBUGGING
-#define _HEAVY_PAGEMAP_DEBUGGING 0
-#endif
-
-struct KDataBuffer;
-
-typedef uint32_t pm_size_t;
-typedef uint32_t row_count_t;
-typedef uint32_t elem_count_t;
-
-typedef enum {  PM_REGION_EXPAND_UNKNOWN=0,     /** notset **/
-                PM_REGION_EXPAND_FULL,          /** full expansion     - 2 arrays: offset,length**/
-                PM_REGION_EXPAND_SAMELEN,       /** partial expansion  - 1 array: offset **/
-                PM_REGION_EXPAND_EQUIDISTANT,   /** data have same length and always unique - no expansion needed **/
-                PM_REGION_EXPAND_SAMEDATA       /** same data - no expansion needed ***/
-} pm_expand_region_type_t;
-
-typedef struct PageMapRegion {
-	row_count_t	start_row;
-	row_count_t	numrows;
-	elem_count_t	data_offset;/** for unexpanded regions first direct offset into data**/
-				    /** for expanded regions - offset into expanded storage **/
-	elem_count_t	length;	    /** first length of the region ***/
-	uint8_t		type;       /** one of the types from pm_expand_region_type_t*/
-	bool		expanded;   /** if expandable storage is being used ***/
-} PageMapRegion;
-
-
-
-
-typedef struct PageMap {
-    /* memory allocation object for length[], leng_run[], data_run[] */
-    KDataBuffer cstorage;
-
-    /* array of row lengths
-     * has leng_recs elements
-     * is sized to reserve_leng elements
-     * == storage.base
-     */
-    bool   random_access;
-    enum { eBlobPageMapOptimizedNone, eBlobPageMapOptimizedSucceeded, eBlobPageMapOptimizedFailed}  optimized;
-    elem_count_t *length;
-
-    /* array of run lengths of row lengths
-     * has leng_recs elements
-     * is sized to reserve_leng elements
-     * == length + reserve_leng
-     */
-    row_count_t *leng_run;
-
-    /* array of repeat counts of data
-     * has data_recs elements
-     * is sized to reserve_data elements
-     * == leng_run + reserve_leng
-     */
-    row_count_t *data_run;
-    /** expanded offsets into data - needed for random access ***/
-    /** only valid when random_access is true **/
-    elem_count_t *data_offset;
-
-/******* DYNAMIC EXPANSION CONTROL *****************/
-    PageMapRegion		*exp_rgn_last;
-    row_count_t			exp_row_last;   /* last row analyzed for region expansion */
-    row_count_t			exp_lr_used;    /* how much leng_run was used from the */
-    pm_size_t			exp_lr_last;	/* index of last leng_run expanded */
-    pm_size_t			exp_dr_last;	/* index of last data_run expanded */
-    pm_size_t			exp_rgn_cnt;    /* current number of expanded regions */
-    elem_count_t		exp_data_offset_last;/* last offset into data */
-    
-
-    KDataBuffer			istorage;	/* binary searchable storage for expansion regions */
-    KDataBuffer			dstorage;	/* storage for expanded data */
-/** LAST SEARCH CONTROL *****/
-    pm_size_t			i_rgn_last; 	/* region index found in previous lookup **/
-    PageMapRegion*		rgn_last; 	/* redundant - region found in previous lookup **/
-
-/****************************/
-
-    pm_size_t leng_recs;     /* number of valid elements in length[] and leng_run[] */
-    pm_size_t data_recs;     /* number of valid elements in data_run[] */
-    pm_size_t reserve_leng;  /* number of allocated elements in length[] and leng_run[] */
-    pm_size_t reserve_data;  /* number of allocated elements in data_run[] */
-    pm_size_t start_valid;   /* the expanded array contains valid data upto start_valid */
-    row_count_t row_count;   /* total number of rows in page map */
-    row_count_t pre_exp_row_count; /* number of rows pre-expanded */
-    KRefcount refcount;
-} PageMap;
-
-
-/* a pessimistic estimate - actual size will *always* be less than or equal */
-size_t PageMapGetMaxBufferSize(const PageMap *self);
-
-rc_t PageMapSerialize(const PageMap *self, struct KDataBuffer *buffer, uint64_t byte_offset, uint64_t *actual_bytes);
-
-rc_t PageMapDeserialize(PageMap **lhs, const void *src, uint64_t src_bytes, uint64_t row_count);
-
-rc_t PageMapRelease(const PageMap *self);
-
-rc_t PageMapAddRef(const PageMap *self);
-
-/*  PageMapGetIdxRowInfo
- *
- *  Get row length and starting element number for a row.
- *  This is a potentially expensive operation; the first time
- *  it is called for any page map, the memory used by the page
- *  map nearly doubles and an index is built on the row length
- *  runs and the data runs.  Subsequent calls are O(N log N).
- *  However, asking for the information about the first row
- *  (i.e. idx = 0) never causes allocation or indexing and is
- *  always O(1).
- *
- *  Params:
- *      self: [IN] the page map
- *      idx:  the row number starting from 0
- *      starting_element: [OUT, OPTIONAL]
- *
- *  Returns:
- *      the length of the row
- *      or 0 if not found
- */
-uint32_t PageMapGetIdxRowInfo(const PageMap *self, uint32_t idx, uint32_t *starting_element);
-
-rc_t PageMapNew(PageMap **lhs, uint32_t reserve);
-
-rc_t PageMapNewSingle(PageMap **lhs, uint64_t row_count, uint64_t row_length);
-
-rc_t PageMapNewFixedRowLength(PageMap **lhs, uint64_t row_count, uint64_t row_len);
-
-rc_t PageMapToRandomAccess(PageMap **rslt, PageMap * src,uint32_t *data_offset);
-
-uint32_t PageMapFixedRowLength(const PageMap *self);
-
-rc_t	PageMapRowLengthRange(const PageMap *self, elem_count_t *min,elem_count_t *max);
-
-uint32_t PageMapHasSimpleStructure(const PageMap *self);
-
-rc_t PageMapAppendRows(PageMap *self, uint64_t row_length, uint64_t run_length, bool same_data);
-
-#define PageMapAppendRow(SELF, ROW_LENGTH, SAME_DATA) (PageMapAppendRows((SELF), (ROW_LENGTH), 1, SAME_DATA))
-
-/* append some rows of the same data */
-#define PageMapAppendSomeRows(SELF, ROW_LENGTH, RUN_LENGTH) (PageMapAppendRows((SELF), (ROW_LENGTH), (RUN_LENGTH), false))
-
-/* concatenate two page maps */
-rc_t PageMapAppend(PageMap *self, const PageMap *other);
-
-/** Find data using pagemap ***/
-rc_t PageMapFindRow(const PageMap *cself,uint64_t row,uint32_t * data_offset,uint32_t * data_length,uint32_t * repeat_count);
-
-
-/*
- -1: error
- 0: not same
- 1: compatible (i.e. all rows same length)
- else: identical
- */
-int PageMapCompare(const PageMap *a, const PageMap *b);
-/* same but static columns */
-int PageMapCompareStatic(const PageMap *a, const PageMap *b);
-
-typedef struct PageMapIterator PageMapIterator;
-struct PageMapIterator {
-    row_count_t		last_row;
-    row_count_t		cur_row;
-    PageMapRegion**	rgns;	  /** all regions from the pagemap **/
-    pm_size_t		cur_rgn;  /** offset of the current region **/
-    row_count_t 	cur_rgn_row; /** row relative to offset of the region **/
-    elem_count_t	**exp_base; /*** exp buffer ***/
-    row_count_t		repeat_count; /** remaining repeat count **/
-    elem_count_t	static_datalen;
-#if _HEAVY_PAGEMAP_DEBUGGING
-    PageMap *parent;
-#endif
-};
-
-rc_t PageMapNewIterator(const PageMap *self, PageMapIterator *lhs, uint64_t first_row, uint64_t num_rows);
-
-static __inline__ bool PageMapIteratorAdvance(PageMapIterator *self, row_count_t rows)
-{
-    if (self->cur_row + rows < self->last_row) {
-	self->cur_row += rows;
-	self->cur_rgn_row += rows;
-	if(self->repeat_count > rows) self->repeat_count-= rows;
-	else self->repeat_count = 0;
-	if(self->rgns){/** non-static, non simple random access**/
-		while((*self->rgns)[self->cur_rgn].numrows <= self->cur_rgn_row){
-			self->cur_rgn_row -= (*self->rgns)[self->cur_rgn].numrows;
-			self->cur_rgn++;
-		}
-        }
-        return true;
-    }
-    return false;
-}
-
-#define PageMapIteratorNext(SELF) PageMapIteratorAdvance(SELF, 1)
-
-static __inline__ elem_count_t PageMapIteratorDataLength(const PageMapIterator *self)
-{
-    elem_count_t datalen=0;
-    if(self->rgns == NULL) {/* static or simple random-access*/
-	return  self->static_datalen;
-    }
-    switch ((*self->rgns)[self->cur_rgn].type){
-	case PM_REGION_EXPAND_FULL:
-		if((*self->rgns)[self->cur_rgn].expanded){
-			datalen = (*self->exp_base)[(*self->rgns)[self->cur_rgn].data_offset + 2*self->cur_rgn_row];
-		} else {
-			datalen = (*self->rgns)[self->cur_rgn].length;
-		}
-                break;
-	case PM_REGION_EXPAND_SAMELEN:
-	case PM_REGION_EXPAND_EQUIDISTANT:
-	case PM_REGION_EXPAND_SAMEDATA:
-		datalen = (*self->rgns)[self->cur_rgn].length;
-		break;
-	default:
-		assert(0);
-		break;
-   }
-#if _HEAVY_PAGEMAP_DEBUGGING
-   {
-	elem_count_t dtl,dto,dtr;
-	PageMapFindRow(self->parent,self->cur_row,&dto,&dtl,&dtr);
-	assert(dtl==datalen);
-   }
-#endif
-   /*printf("DATA_LEN=%d\n",datalen);*/
-   return datalen;
-}
-
-static __inline__ elem_count_t PageMapIteratorDataOffset(const PageMapIterator *self)
-{
-    elem_count_t dataoff=0;
-    if(self->rgns == NULL){ /** static or simple random **/
-	if(self->exp_base != NULL)  /** simple random access */
-		dataoff= (*self->exp_base)[self->cur_row];
-	return dataoff;
-    }
-    switch ((*self->rgns)[self->cur_rgn].type){
-        case PM_REGION_EXPAND_FULL:
-                if((*self->rgns)[self->cur_rgn].expanded){
-                        dataoff = (*self->exp_base)[(*self->rgns)[self->cur_rgn].data_offset + 2*self->cur_rgn_row + 1];
-                } else {
-                        dataoff = (*self->rgns)[self->cur_rgn].data_offset;
-                }
-                break;
-        case PM_REGION_EXPAND_SAMELEN:
-		if((*self->rgns)[self->cur_rgn].expanded){
-                        dataoff = (*self->exp_base)[(*self->rgns)[self->cur_rgn].data_offset + self->cur_rgn_row];
-                } else {
-                        dataoff = (*self->rgns)[self->cur_rgn].data_offset;
-                }
-                break;
-        case PM_REGION_EXPAND_EQUIDISTANT:
-		dataoff = (*self->rgns)[self->cur_rgn].data_offset + (*self->rgns)[self->cur_rgn].length * self->cur_rgn_row;
-		break;
-        case PM_REGION_EXPAND_SAMEDATA:
-                dataoff = (*self->rgns)[self->cur_rgn].data_offset;
-                break;
-        default:
-                assert(0);
-                break;
-    }
-#if _HEAVY_PAGEMAP_DEBUGGING
-   {
-        elem_count_t dtl,dto,dtr;
-        PageMapFindRow(self->parent,self->cur_row,&dto,&dtl,&dtr);
-        assert(dto==dataoff);
-   }
-#endif
-    return dataoff;
-}
-
-static __inline__ row_count_t PageMapIteratorRepeatCount(const PageMapIterator *cself)
-{
-    if(cself->repeat_count==0){
-	PageMapIterator *self = (PageMapIterator*) cself;
-	if(self->rgns==NULL){ /** must be simple random access **/
-		uint64_t i;
-		assert(*self->exp_base);
-		for(i=self->cur_row+1,self->repeat_count=1;
-                    i< self->last_row && (*self->exp_base)[i]==(*self->exp_base)[self->cur_row];
-                    i++,self->repeat_count++){}
-	} else {
-		switch ((*self->rgns)[self->cur_rgn].type){
-		 case PM_REGION_EXPAND_FULL:
-			if((*self->rgns)[self->cur_rgn].expanded){
-				row_count_t i;
-				elem_count_t* base = (*self->exp_base) + (*self->rgns)[self->cur_rgn].data_offset;
-				self->repeat_count = 1;
-				for(i=self->cur_rgn_row+1;i<(*self->rgns)[self->cur_rgn].numrows;i++){
-					if(base[2*self->cur_rgn_row]== base[2*i] && base[2*self->cur_rgn_row+1]== base[2*i+1]) self->repeat_count++;
-					else break;
-				}
-			} else {
-				self->repeat_count =  (*self->rgns)[self->cur_rgn].numrows - self->cur_rgn_row;
-			}
-			break;
-		 case PM_REGION_EXPAND_SAMELEN:
-			if((*self->rgns)[self->cur_rgn].expanded){
-				row_count_t i;
-				elem_count_t* base = (*self->exp_base) + (*self->rgns)[self->cur_rgn].data_offset;
-				self->repeat_count = 1;
-				for(i=self->cur_rgn_row+1;i<(*self->rgns)[self->cur_rgn].numrows;i++){
-					if(base[self->cur_rgn_row] == base[i]) self->repeat_count++;
-					else break;
-				}
-			} else {
-				self->repeat_count = (*self->rgns)[self->cur_rgn].numrows - self->cur_rgn_row;
-			}
-			break;
-		 case PM_REGION_EXPAND_EQUIDISTANT:
-			self->repeat_count = 1;
-			break;
-		 case PM_REGION_EXPAND_SAMEDATA:
-			self->repeat_count =  (*self->rgns)[self->cur_rgn].numrows - self->cur_rgn_row;
-			break;
-		 default:
-			assert(0);
-			break;
-		}
-	}
-    }
-#if _HEAVY_PAGEMAP_DEBUGGING
-   {
-        elem_count_t dtl,dto,dtr;
-        PageMapFindRow(cself->parent,cself->cur_row,&dto,&dtl,&dtr);
-        assert(dtr==cself->repeat_count);
-   }
-#endif
-    return cself->repeat_count;
-}
-
-elem_count_t PageMapLastLength(const PageMap *cself);
-bool PageMapHasRows(const PageMap *self);
-rc_t PageMapExpand(const PageMap *cself, row_count_t upto);
-rc_t PageMapExpandFull(const PageMap *cself);
-rc_t PageMapPreExpandFull(const PageMap *cself, row_count_t upto);
-
-#endif /* _h_page_map_ */
diff --git a/libs/vdb/parameter-read.c b/libs/vdb/parameter-read.c
deleted file mode 100644
index af9621c..0000000
--- a/libs/vdb/parameter-read.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-#include "xform-priv.h"
-
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/table.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <vdb/vdb-priv.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-static
-rc_t CC parameter_read_func(
-                         void *Self,
-                         const VXformInfo *info,
-                         int64_t row_id,
-                         VRowResult *rslt,
-                         uint32_t argc,
-                         const VRowData argv[]
-) {
-    const KDataBuffer *value = Self;
-    rc_t rc = 0;
-    
-    rslt->data->elem_bits = value->elem_bits;
-    rslt->data->elem_count = 0;
-    rc = KDataBufferResize(rslt->data, value->elem_count);
-    if (rc == 0) {
-        memcpy(rslt->data->base, value->base, KDataBufferBytes(value));
-        rc = KDataBufferCast(rslt->data, rslt->data, rslt->elem_bits, true);
-        if (rc == 0)
-            rslt->elem_count = rslt->data->elem_count;
-    }
-	return rc;
-}
-
-static rc_t get_databuffer( KDataBuffer **rslt, struct VCursorParams const *params, const char *Name, size_t len ) {
-    char name[4096];
-    
-    if (len >= sizeof(name))
-        return RC(rcVDB, rcFunction, rcConstructing, rcName, rcTooLong);
-    
-    memcpy(name, Name, len);
-    name[len] = '\0';
-    
-    return VCursorParamsGet(params, name, rslt);
-}
-
-/* 
- function utf8 parameter:read #1.0 < ascii name, * bool deterministic > ();
- */
-VTRANSFACT_BUILTIN_IMPL(parameter_read, 1, 0, 0)
-    (const void *Self, const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp
-) {
-    rc_t rc;
-    KDataBuffer *value;
-    bool deterministic = true;
-    
-    if (cp->argc > 1)
-        deterministic = cp->argv[1].data.b[0];
-
-    rc = get_databuffer(&value, info->parms, cp->argv[0].data.ascii, cp->argv[0].count);
-    if (rc == 0) {
-        rslt->self = value;
-        
-        rslt->variant = deterministic ? vftRow : vftNonDetRow;
-        rslt->u.ndf = parameter_read_func;
-    }
-
-	return rc;
-}
diff --git a/libs/vdb/phys-cmn.c b/libs/vdb/phys-cmn.c
deleted file mode 100644
index 1c39325..0000000
--- a/libs/vdb/phys-cmn.c
+++ /dev/null
@@ -1,679 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#define KONST const
-#include "phys-priv.h"
-#include "schema-parse.h"
-#include "schema-priv.h"
-#include "schema-expr.h"
-#include "table-priv.h"
-#include "cursor-priv.h"
-#include "prod-priv.h"
-#include "blob-priv.h"
-#undef KONST
-
-#include <vdb/cursor.h>
-#include <kdb/column.h>
-#include <kdb/meta.h>
-#include <klib/symbol.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <endian.h>
-
-
-/*--------------------------------------------------------------------------
- * KMDataNode
- */
-
-
-/* Addr
- *  reach into node and get address
- *  returns raw pointer and node size
- */
-rc_t CC KMDataNodeAddr ( const KMDataNode *self,
-    const void **addr, size_t *size );
-
-
-/*--------------------------------------------------------------------------
- * VPhysical
- */
-
-/* Destroy
- */
-void VPhysicalDestroy ( VPhysical *self )
-{
-
-#if PROD_REFCOUNT && ! PROD_ALL_IN_CURSOR
-    PROD_TRACK_REFCOUNT(VProductionRelease, self->out);
-    VProductionRelease ( self -> out, NULL );
-    PROD_TRACK_REFCOUNT(VProductionRelease, self->b2p);
-    VProductionRelease ( self -> b2p, NULL );
-    PROD_TRACK_REFCOUNT(VProductionRelease, self->b2s);
-    VProductionRelease ( self -> b2s, NULL ); 
-    PROD_TRACK_REFCOUNT(VProductionRelease, self->in);
-    VProductionRelease ( self -> in, NULL );
-#endif
-
-    KDataBufferWhack ( & self -> srow );
-
-    SExpressionWhack ( self -> enc );
-
-    KMDataNodeRelease ( self -> knode );
-
-    KMetadataRelease ( self -> meta );
-    KColumnRelease ( self -> kcol );
-    
-    free ( self );
-}
-
-/* Make
- */
-rc_t VPhysicalMake ( VPhysical **physp, const VCursor *curs, const SPhysMember *smbr )
-{
-    VPhysical *phys = calloc ( 1, sizeof * phys );
-
-    if ( phys == NULL )
-        return RC ( rcVDB, rcColumn, rcConstructing, rcMemory, rcExhausted );
-
-    phys -> curs = curs;
-    phys -> smbr = smbr;
-
-    * physp = phys;
-    return 0;
-}
-
-/* FinishKColumn
- */
-
-#if 0
-#include <stdio.h>
-static
-rc_t pstdout ( void *ignore, const void *buffer, size_t bsize )
-{
-    fwrite ( buffer, 1, bsize, stdout );
-    return 0;
-}
-#endif
-
-rc_t VPhysicalFinishKColumn ( VPhysical *self, VSchema *schema, const SPhysMember *smbr )
-{
-    /* determine its range of row ids */
-    uint64_t count;
-    rc_t rc = KColumnIdRange ( self -> kcol, & self -> kstart_id, & count );
-    self -> kstop_id = self -> kstart_id + count - 1;
-    if ( rc == 0 )
-    {
-        if ( self -> meta == NULL )
-        {
-            /* bring over "no_hdr" from SPhysical */
-            self -> no_hdr = ( ( const SPhysEncExpr* ) smbr -> type ) -> phys -> no_hdr;
-        }
-        else
-        {
-            /* read in metadata */
-            VTypedecl td;
-            rc = VPhysicalLoadMetadata ( self, & td, schema );
-            /*VSchemaDump ( schema, sdmPrint, NULL, pstdout, NULL );*/
-            if ( rc == 0 )
-            {
-                /* if member type is unknown, reset to actual type */
-                if ( smbr -> td . type_id == 0 )
-                {
-                    /* this member was introduced into cursor schema
-                       by the function VCursorSupplementPhysical with
-                       an unknown type - i.e. the schema compiler will
-                       not recognize "any" as a member type. essentially
-                       the member type setting was delayed until now */
-                    ( ( SPhysMember* ) smbr ) -> td = td;
-                }
-
-                /* validate that the physical column matches
-                   the schema member declaration type */
-                else if ( ! VTypedeclCommonAncestor ( & td, schema, & smbr -> td, NULL, NULL ) )
-                {
-                    rc = RC ( rcVDB, rcColumn, rcLoading, rcType, rcInconsistent );
-                    PLOGERR ( klogInt, ( klogInt, rc, "inconsistent schema and actual types for column '$(name)'"
-                               , "name=%.*s"
-                               , ( int ) smbr -> name -> name . size
-                               , smbr -> name -> name . addr ));
-                }
-            }
-        }
-    }
-
-    return rc;
- }
-
-/* FinishStatic
- */
-rc_t VPhysicalFinishStatic ( VPhysical *self, const VSchema *schema, const SPhysMember *smbr )
-{
-    /* see if data node actually exists */
-    const KMDataNode *node;
-    rc_t rc = KMDataNodeOpenNodeRead ( self -> knode, & node, "row" );
-    if ( rc  != 0 )
-        return rc;
-    KMDataNodeRelease ( node );
-
-    /* determine id range */
-    rc = KMDataNodeOpenNodeRead ( self -> knode, & node, "start_id" );
-    if ( rc == 0 )
-    {
-        /* modern static column */
-        rc = KMDataNodeReadAsI64 ( node, & self -> sstart_id );
-        KMDataNodeRelease ( node );
-        if ( rc == 0 )
-        {
-            rc = KMDataNodeOpenNodeRead ( self -> knode, & node, "row_count" );
-            if ( rc == 0 )
-            {
-                uint64_t row_count;
-                
-                rc = KMDataNodeReadAsU64 ( node, & row_count );
-                KMDataNodeRelease ( node );
-                assert(row_count != 0);
-                self -> sstop_id = self -> sstart_id + row_count - 1;
-            }
-        }
-    }
-    else if ( GetRCState ( rc ) == rcNotFound )
-    {
-        /* get the table metadata */
-        const KMetadata *tmeta = self -> curs -> tbl -> meta;
-
-        /* original static column with no range */
-        self -> sstart_id = 1;
-
-        /* work a little harder to correct this problem */
-        rc = KMetadataGetSequence ( tmeta, "spot", & self -> sstop_id );
-        if ( rc != 0 )
-            rc = KMetadataGetSequence ( tmeta, ".", & self -> sstop_id );
-        if ( rc != 0 )
-        {
-#if 0
-            /* set to infinite range */
-            self -> sstart_id <<= 63;
-            self -> sstop_id = ~ self -> sstart_id;
-#else
-            /* set to single row */
-            self -> sstart_id = 1;
-            self -> sstop_id = 1;
-#endif
-            rc = 0;
-        }
-    }
-
-    if ( rc == 0 )
-    {
-        size_t size;
-        char type_expr [ 256 ];
-
-        /* read column type */
-        rc = KMDataNodeReadAttr ( self -> knode, "type",
-            type_expr, sizeof type_expr, & size );
-        if ( rc == 0 )
-        {
-            VTypedecl td;
-
-            /* resolve type */
-            rc = VSchemaResolveTypedecl ( schema, & td, type_expr );
-            if ( rc == 0 )
-            {
-                /* if member type is unknown, reset to actual type */
-                if ( smbr -> td . type_id == 0 )
-                {
-                    /* this member was introduced into cursor schema
-                       by the function VCursorSupplementPhysical with
-                       an unknown type - i.e. the schema compiler will
-                       not recognize "any" as a member type. essentially
-                       the member type setting was delayed until now */
-                    ( ( SPhysMember* ) smbr ) -> td = td;
-                }
-
-                /* validate that the physical column matches
-                   the schema member declaration type */
-                else if ( ! VTypedeclCommonAncestor ( & td, schema, & smbr -> td, NULL, NULL ) )
-                {
-                    rc = RC ( rcVDB, rcColumn, rcLoading, rcType, rcInconsistent );
-                    PLOGERR ( klogInt, ( klogInt, rc, "inconsistent schema and actual types for static column '$(name)'"
-                               , "name=%.*s"
-                               , ( int ) smbr -> name -> name . size
-                               , smbr -> name -> name . addr ));
-                }
-            }
-        }
-    }
-
-    return rc;
-}
-
-
-/* Open
- *  open existing columns
- *  load schema definitions
- */
-rc_t VPhysicalOpenRead ( VPhysical *self, VSchema *schema, const VTable *tbl )
-{
-    rc_t rc;
-
-    /* physical member name from schema */
-    const SPhysMember *smbr = self -> smbr;
-    const KSymbol *name = smbr -> name;
-
-    /* mark physical as read-only */
-    self -> read_only = true;
-
-    /* open column for update */
-    rc = KTableOpenColumnRead ( tbl -> ktbl, & self -> kcol,
-        "%.*s", ( int ) name -> name . size - 1, name -> name . addr + 1 );
-    if ( rc == 0 )
-    { 
-        /* open its metadata */
-        rc = KColumnOpenMetadataRead ( self -> kcol, & self -> meta );
-        if ( rc == 0 || GetRCState ( rc ) == rcNotFound )
-        {
-            /* finish off common initialization */
-            rc = VPhysicalFinishKColumn ( self, schema, smbr );
-        }
-    }
-
-    /* it's okay if a column doesn't exist - it may exist as a static */
-    else if ( GetRCState ( rc ) == rcNotFound )
-    {
-        rc = 0;
-    }
-
-    if ( rc == 0 && self -> kcol == NULL )
-    {
-        /* must have static col parent node */
-        if ( tbl -> col_node == NULL )
-            rc = RC ( rcVDB, rcTable, rcOpening, rcColumn, rcNotFound );
-        else
-        {
-            /* look for static */
-            const KMDataNode *node;
-            rc = KMDataNodeOpenNodeRead ( tbl -> col_node, & node,
-                "%.*s", ( int ) name -> name . size - 1, name -> name . addr + 1 );
-            if ( rc == 0 )
-            {
-                self -> knode = node;
-
-                /* finish off common initialization */
-                rc = VPhysicalFinishStatic ( self, schema, smbr );
-            }
-        }
-    }
-
-    return rc;
-}
-
-/* ReadKColumn
- *  read a raw blob from kcolumn
- */
-static
-rc_t VPhysicalReadKColumn ( VPhysical *self, VBlob **vblob, int64_t id, uint32_t elem_bits )
-{
-    rc_t rc;
-    VBlob *blob;
-    const KColumnBlob *kblob;
-
-    /* check id against column contents */
-    if ( self -> kcol == NULL ||
-         id < self -> kstart_id || id > self -> kstop_id )
-    {
-        * vblob = NULL;
-        return RC ( rcVDB, rcColumn, rcReading, rcRow, rcNotFound );
-    }
-
-#if PROD_CACHE
-    /* check for recently written cache contents */
-    if ( self -> b2s != NULL && self -> b2s -> cache [ 0 ] != NULL )
-    {
-        VProduction *b2s = self -> b2s;
-
-        int i;
-        for ( i = 0; i < PROD_CACHE; ++ i )
-        {
-            blob = b2s -> cache [ i ];
-            if ( id >= blob -> start_id && id <= blob -> stop_id )
-            {
-                * vblob = blob;
-                rc = VBlobAddRef ( blob );
-                if ( rc != 0 )
-                    return rc;
-
-                TRACK_BLOB ( VBlobAddRef, blob );
-#if PROD_CACHE > 1
-                /* MRU cache */
-                if ( i > 0 )
-                {
-                    do
-                        b2s -> cache [ i ] = b2s -> cache [ i - 1 ];
-                    while ( -- i > 0 );
-                    b2s -> cache [ 0 ] = blob;
-                }
-#endif
-                return 0;
-            }
-        }
-    }
-#endif
-
-    /* find blob in KColumn
-       TBD - handle potential merge/update later */
-    rc = KColumnOpenBlobRead ( self -> kcol, & kblob, id );
-    if ( rc == 0 )
-    {
-        /* get blob size */
-        size_t num_read, remaining;
-        rc = KColumnBlobRead ( kblob, 0, NULL, 0, & num_read, & remaining );
-        if ( rc == 0 )
-        {
-            /* get blob id range */
-            uint32_t count;
-            int64_t start_id;
-            rc = KColumnBlobIdRange ( kblob, & start_id, & count );
-            if ( rc == 0 )
-            {
-                KDataBuffer buffer;
-
-                /* fabricate "stop_id" */
-                int64_t stop_id = start_id + count - 1;
-
-                /* if the encoding was marked __no_header */
-                if ( self -> no_hdr )
-                    num_read = 2;
-
-                /* create data buffer */
-                rc = KDataBufferMakeBytes ( & buffer, num_read + remaining );
-                if ( rc == 0 )
-                {
-                    /* read entire blob */
-                    uint8_t *p = buffer . base;
-                    rc = KColumnBlobRead ( kblob, 0,
-                        & p [ num_read ], remaining, & num_read, & remaining );
-                    if ( rc == 0 )
-                    {
-                        if ( self -> no_hdr )
-                        {
-                            /* create fake v1 header byte with fixed row-length:
-                               000ooobb where "o" is offset ( 0 ), and
-                               "b" is byte order ( always little-endian ) */
-                            p [ 0 ] = ( uint8_t ) vboLittleEndian;
-                            p [ 1 ] = 0;
-                        }
-
-                        /* create a proper blob */
-                        rc = VBlobNew ( vblob, start_id, stop_id, "readkcolumn" );
-                        TRACK_BLOB (VBlobNew, *vblob);
-                        if ( rc == 0 )
-                        {
-                            rc = KDataBufferSub ( & buffer, & ( * vblob ) -> data, 0, UINT64_MAX );
-                            assert ( rc == 0 );
-                        }
-                    }
-
-                    KDataBufferWhack ( & buffer );
-                }
-            }
-        }
-
-        KColumnBlobRelease ( kblob );
-    }
-
-    return rc;
-}
-
-/* Read
- *  read a blob from static data or decoding chain
- */
-static
-rc_t VPhysicalReadStatic ( VPhysical *self, VBlob **vblob, int64_t id, uint32_t elem_bits )
-{
-    bool reversed;
-    rc_t rc = KMDataNodeByteOrder ( self -> knode, & reversed );
-    if ( rc == 0 )
-    {
-        const KMDataNode *row;
-
-        /* detect non-native byte-order */
-        VByteOrder byte_order = vboNative;
-        if ( reversed )
-        {
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-            byte_order = vboBigEndian;
-#else
-            byte_order = vboLittleEndian;
-#endif
-        }
-
-        /* open sub-node for row */
-        rc = KMDataNodeOpenNodeRead ( self -> knode, & row, "row" );
-        if ( rc == 0 )
-        {
-            /* get raw pointer and size in bytes */
-            size_t bytes;
-            const void *base;
-            rc = KMDataNodeAddr ( row, & base, & bytes );
-            if ( rc == 0 )
-            {
-                uint64_t row_bits;
-
-                /* if there's a "size" node, read size in bits */
-                const KMDataNode *size;
-                rc = KMDataNodeOpenNodeRead ( self -> knode, & size, "size" );
-                if ( rc == 0 )
-                {
-                    rc = KMDataNodeReadAsU64 ( size, & row_bits );
-                    KMDataNodeRelease ( size );
-                }
-                else if ( GetRCState ( rc ) == rcNotFound )
-                {
-                    row_bits = bytes << 3;
-                    rc = 0;
-                }
-
-                /* check that the row length is an integral number of elements */
-                assert ( elem_bits != 0 );
-                if ( rc == 0 && row_bits % elem_bits != 0 )
-                    rc = RC ( rcVDB, rcColumn, rcReading, rcRow, rcCorrupt );
-
-                /* go forth */
-                if ( rc == 0 )
-                {
-                    KDataBuffer buffer;
-                    rc = KDataBufferMake ( & buffer, elem_bits, ( uint32_t ) ( row_bits / elem_bits ) );
-                    if ( rc == 0 )
-                    {
-                        int64_t sstart_id = self -> sstart_id;
-                        int64_t sstop_id = self -> sstop_id;
-
-                        /* copy out single row */
-                        memcpy ( buffer . base, base, bytes );
-                        self->fixed_len = buffer.elem_count;
-
-                        /* limit row range */
-                        if ( ( ( sstop_id - sstart_id ) >> 32 ) != 0 )
-                        {
-                            sstart_id  =   ((id-1) &  ~0x7fffffffUL ) + 1;  /** Truncate to the nearest 2 billion **/
-                            if ( ( ( sstop_id - sstart_id ) >> 32 ) != 0 ) /** still not enough ***/
-                                sstop_id = sstart_id + 0x80000000UL ; /** leave only 2 billion */
-                        }
-
-                        rc = VBlobCreateFromSingleRow ( vblob,
-                            sstart_id, sstop_id, & buffer, byte_order );
-                        KDataBufferWhack( &buffer );
-                    }
-                }
-            }
-
-            KMDataNodeRelease ( row );
-        }
-    }
-
-    return rc;
-}
-
-rc_t VPhysicalReadBlob ( VPhysical *self, VBlob **vblob, int64_t id, uint32_t elem_bits )
-{
-    rc_t rc;
-
-    /* check for hit on static guy */
-    if ( self -> knode != NULL &&
-         id >= self -> sstart_id && id <= self -> sstop_id )
-    {
-        return VPhysicalReadStatic ( self, vblob, id, elem_bits );
-    }
-
-    /* need to read from kcolumn path */
-    rc = VProductionReadBlob ( self -> b2p, vblob, id , 1, NULL);
-	if ( rc == 0 )
-    {
-	    if((*vblob)->pm==NULL)
-        {
-            rc = PageMapProcessGetPagemap(&self->curs->pmpr,&(*vblob)->pm);
-	    }
-    }
-
-	return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * VPhysicalProd
- */
-
-rc_t VPhysicalProdMake ( VProduction **prodp, Vector *owned,
-    struct VCursor *curs, VPhysical *phys, int sub, const char *name,
-    const VFormatdecl *fd, const VTypedesc *desc )
-{
-#define PHYSPROD_INDEX_OFFSET 1000000000
-    VPhysicalProd *prod;
-    rc_t rc = VProductionMake ( prodp, owned, sizeof * prod,
-        prodPhysical, sub, name, fd, desc, NULL, chainDecoding );
-    if ( rc == 0 )
-    {
-        prod = ( VPhysicalProd* ) * prodp;
-
-        /* this class only knows how to redirect messages to VPhysical */
-        prod -> phys = phys;
-	if(sub == prodPhysicalOut){
-		(*prodp) -> cctx.cache   = curs->blob_mru_cache;
-		(*prodp) -> cctx.col_idx = PHYSPROD_INDEX_OFFSET + (++curs -> phys_cnt);
-	}
-    }
-    return rc;
-}
-
-
-void VPhysicalProdDestroy ( VPhysicalProd *self )
-{
-}
-
-
-/* Read
- */
-rc_t VPhysicalProdRead ( VPhysicalProd *self, VBlob **vblob, int64_t id, uint32_t cnt )
-{
-    uint32_t elem_bits;
-
-    if ( self == NULL )
-        return RC ( rcVDB, rcProduction, rcReading, rcSelf, rcNull );
-    if ( self -> phys == NULL )
-        return RC ( rcVDB, rcColumn, rcReading, rcSelf, rcNull );
-
-    elem_bits = VTypedescSizeof ( & self -> dad . desc );
-
-    switch ( self -> dad . sub )
-    {
-    case prodPhysicalOut:
-        return VPhysicalRead ( self -> phys, vblob, id, cnt, elem_bits );
-    case prodPhysicalKCol:
-        return VPhysicalReadKColumn ( self -> phys, vblob, id, elem_bits );
-    }
-
-    return RC ( rcVDB, rcProduction, rcReading, rcType, rcInvalid );
-}
-
-uint32_t VPhysicalProdFixedRowLength ( const VPhysicalProd *Self, int64_t row_id ) {
-    const VPhysical *self;
-    
-    if ( Self == NULL )
-        return 0;
-    self = Self->phys;
-    if ( self == NULL )
-        return 0;
-    return self->fixed_len;
-}
-
-rc_t VPhysicalProdColumnIdRange ( const VPhysicalProd *Self,
-                               int64_t *first, int64_t *last )
-{
-    const VPhysical *self;
-    
-    if ( Self == NULL )
-        return RC ( rcVDB, rcProduction, rcReading, rcSelf, rcNull );
-    self = Self->phys;
-    if ( self == NULL )
-        return RC ( rcVDB, rcColumn, rcReading, rcSelf, rcNull );
-    
-    if (self->knode) {
-        *first = self->sstart_id;
-        *last  = self->sstop_id;
-        return 0;
-    }
-    if (self->kcol) {
-        *first = self->kstart_id;
-        *last  = self->kstop_id;
-        return 0;
-    }
-    return RC ( rcVDB, rcColumn, rcReading, rcRange, rcEmpty );
-}
-
-
-/* IsStatic
- *  is this a static column
- */
-rc_t VPhysicalIsStatic ( const VPhysical *self, bool *is_static )
-{
-    assert ( is_static != NULL );
-
-    if ( self == NULL )
-    {
-        * is_static = false;
-        return RC ( rcVDB, rcColumn, rcAccessing, rcSelf, rcNull );
-    }
-
-    * is_static = self -> knode != NULL;
-    return 0;
-}
diff --git a/libs/vdb/phys-load.c b/libs/vdb/phys-load.c
deleted file mode 100644
index d4197fa..0000000
--- a/libs/vdb/phys-load.c
+++ /dev/null
@@ -1,330 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-
-#define KONST const
-#include "phys-priv.h"
-#include "schema-parse.h"
-#include "schema-priv.h"
-#include "schema-expr.h"
-#include "cursor-priv.h"
-#include "prod-priv.h"
-#undef KONST
-
-#include <vdb/cursor.h>
-#include <kdb/column.h>
-#include <kdb/meta.h>
-#include <klib/symbol.h>
-#include <klib/debug.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-
-#define ALLOW_V1_UPDATE 0
-
-/*--------------------------------------------------------------------------
- * VPhysical
- */
-
-/* LoadSchema
- *  looks in metadata for stored schema
- */
-static
-rc_t CC VPhysicalLoadV1Schema ( VPhysical *self,
-    VTypedecl *td, VSchema *schema, const KMDataNode *node )
-{
-    rc_t rc;
-
-    KMDataNodeSchemaFillData pb;
-    pb . node = node;
-    pb . pos = 0;
-    pb . add_v0 = true;
-
-    /* add stored declaration to cursor schema */
-    rc = VSchemaParseTextCallback ( schema,
-        "VPhysicalLoadV1Schema", KMDataNodeFillSchema, & pb );
-   if ( rc == 0 )
-    {
-        size_t size;
-        char type_expr [ 256 ];
-
-        /* retrieve and resolve "type" attribute */
-        rc = KMDataNodeReadAttr ( node, "type",
-            type_expr, sizeof type_expr, & size );
-        if ( rc == 0 )
-            rc = VSchemaResolveTypedecl ( schema, td, type_expr );
-
-        /* if a decoding schema exists */
-        if ( rc == 0 && pb . pos != 0 )
-        {
-            char sphysical_name [ 512 ];
-
-            /* preserve schema function expression */
-            size_t decoding_xsize;
-            char decoding_expr [ 256 ];
-            rc = KMDataNodeReadAttr ( node, "schema",
-                decoding_expr, sizeof decoding_expr, & decoding_xsize );
-            if ( rc == 0 )
-            {
-                /* look for "encoding" */
-                const KMDataNode *enc;
-                rc = KMetadataOpenNodeRead ( self -> meta, & enc, "encoding" );
-                if ( rc == 0 )
-                {
-#if ALLOW_V1_UPDATE
-                    if ( ! self -> read_only )
-                    {
-                        /* add stored declaration to cursor schema */
-                        pb . node = enc;
-                        pb . pos = 0;
-                        pb . add_v0 = true;
-                        rc = VSchemaParseTextCallback ( schema,
-                            "VPhysicalLoadV1Schema", KMDataNodeFillSchema, & pb );
-                    }
-                    if ( rc == 0 )
-#endif
-                    {
-                        /* preserve schema function expression */
-                        size_t encoding_xsize;
-                        char encoding_expr [ 256 ], enc_type [ 256 ];
-                        rc = KMDataNodeReadAttr ( enc, "schema",
-                            encoding_expr, sizeof encoding_expr, & encoding_xsize );
-                        if ( rc == 0 )
-                        {
-                            rc = KMDataNodeReadAttr ( enc, "type",
-                                enc_type, sizeof enc_type, & size );
-                        }
-                        if ( rc == 0 )
-                        {
-#if ALLOW_V1_UPDATE
-                            if ( self -> read_only )
-                            {
-#endif
-                                /* build sphysical name */
-                                sprintf ( sphysical_name, "%s_only", decoding_expr );
-
-                                /* build physical decl */
-                                pb . pos = sprintf ( pb . buff, "version 1;"
-                                                     "physical %s %s:phys#1"
-                                                     "{decode{%s k=@;return %s(k);}}"
-                                                     , type_expr
-                                                     , sphysical_name
-                                                     , enc_type
-                                                     , decoding_expr
-                                    );
-#if ALLOW_V1_UPDATE
-                            }
-                            else
-                            {
-                                /* strip off common namespace */
-                                size_t i, ns_size;
-                                string_match ( decoding_expr, decoding_xsize,
-                                    encoding_expr, encoding_xsize, -1, & ns_size );
-                                if ( ns_size != 0 )
-                                {
-                                    char *p = string_rchr ( decoding_expr, ns_size, ':' );
-                                    ns_size = ( p == NULL ) ? 0U : ( uint32_t ) ( p - decoding_expr ) + 1U;
-                                }
-
-                                /* build sphysical name */
-                                sprintf ( sphysical_name, "%s_%s", decoding_expr, & encoding_expr [ ns_size ] );
-                                for ( i = ns_size; sphysical_name [ i ] != 0; ++ i )
-                                {
-                                    if ( sphysical_name [ i ] == ':' )
-                                        sphysical_name [ i ] = '_';
-                                }
-
-                                /* build physical decl */
-                                pb . pos = sprintf ( pb . buff, "version 1;"
-                                                     "physical %s %s:phys#1"
-                                                     "{encode{return %s(@);}"
-                                                     "decode{%s k=@;return %s(k);}}"
-                                                     , type_expr
-                                                     , sphysical_name
-                                                     , encoding_expr
-                                                     , enc_type
-                                                     , decoding_expr
-                                    );
-                            }
-#endif
-                        }
-                    }
-
-                    KMDataNodeRelease ( enc );
-                }
-                else if ( GetRCState ( rc ) == rcNotFound )
-                {
-                    /* build sphysical name */
-                    sprintf ( sphysical_name, "%s_only", decoding_expr );
-
-                    /* build decode-only physical decl */
-                    pb . pos = sprintf ( pb . buff, "version 1;"
-                                         "physical %s %s:phys#1"
-                                         "{decode{opaque k=@;return %s(k);}}"
-                                         , type_expr
-                                         , sphysical_name
-                                         , decoding_expr
-                        );
-                    rc = 0;
-                }
-                if ( rc == 0 )
-                {
-                    /* parse synthesized schema into cursor VSchema */
-                    rc = VSchemaParseText ( schema,
-                        "VPhysicalLoadV1Schema", pb . buff, pb . pos );
-                    if ( rc == 0 )
-                    {
-                        VTypedecl etd;
-
-                        /* create a new expression object */
-                        sprintf ( pb . buff, "%s:phys#1", sphysical_name );
-                        rc = VSchemaImplicitPhysEncExpr ( schema, & etd,
-                            & self -> enc, pb . buff, "VPhysicalLoadV1Schema" );
-                        if ( rc != 0 )
-                        {
-                            PLOGERR ( klogInt, ( klogInt, rc, "failed to establish column type from '$(expr)'",
-                                       "expr=%s", pb . buff ));
-                        }
-                        else if ( self -> smbr != NULL && self -> smbr -> type == NULL )
-                        {
-                            /* back-patch schema */
-                            ( ( SPhysMember* ) self -> smbr ) -> type = self -> enc;
-                            atomic32_inc ( & ( ( SExpression* ) self -> enc ) -> refcount );
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    KMDataNodeRelease ( node );
-    return rc;
-}
-
-static
-rc_t CC VPhysicalLoadSchema ( VPhysical *self,
-    VTypedecl *td, VSchema *schema, const KMDataNode *node )
-{
-    rc_t rc;
-
-    KMDataNodeSchemaFillData pb;
-    pb . node = node;
-    pb . pos = 0;
-    pb . add_v0 = false;
-
-    /* add stored declaration to cursor schema */
-    rc = VSchemaParseTextCallback ( schema,
-        "VPhysicalLoadSchema", KMDataNodeFillSchema, & pb );
-    if ( rc == 0 )
-    {
-        /* retrieve fully-resolved type attribute */
-        rc = KMDataNodeReadAttr ( node, "type",
-            pb . buff, sizeof pb . buff, & pb . pos );
-        if ( rc == 0 )
-            rc = VSchemaResolveTypedecl ( schema, td, pb . buff );
-        if ( rc == 0 )
-        {
-            /* get encoding expression */
-            rc = KMDataNodeReadAttr ( node, "expr",
-                pb . buff, sizeof pb . buff, & pb . pos );
-            if ( rc == 0 )
-            {
-                VTypedecl etd;
-
-                /* create a new expression object */
-                rc = VSchemaImplicitPhysEncExpr ( schema, & etd,
-                    & self -> enc, pb . buff, "VPhysicalLoadSchema" );
-                if ( rc != 0 )
-                {
-                    PLOGERR ( klogInt, ( klogInt, rc, "failed to establish column type from '$(expr)'",
-                               "expr=%s", pb . buff ));
-                }
-
-                /* match SPhysical type against stated type */
-                else if ( ! VTypedeclToTypedecl ( & etd, schema, td, NULL, NULL ) )
-                {
-                    rc = RC ( rcVDB, rcColumn, rcLoading, rcType, rcInconsistent );
-                    PLOGERR ( klogInt, ( klogInt, rc, "inconsistent metadata for column '$(name)'"
-                               , "name=%.*s"
-                               , ( int ) self -> smbr -> name -> name . size
-                               , self -> smbr -> name -> name . addr ));
-                }
-            }
-            else if ( GetRCState ( rc ) == rcNotFound )
-            {
-                rc = 0;
-            }
-        }
-    }
-
-    KMDataNodeRelease ( node );
-    return rc;
-}
-
-rc_t VPhysicalLoadMetadata ( VPhysical *self, VTypedecl *td, VSchema *schema )
-{
-    /* capture fixed row length */
-    const KMDataNode *node;
-    rc_t rc = KMetadataOpenNodeRead ( self -> meta, & node, "row-len" );
-    if ( rc == 0 )
-    {
-        rc = KMDataNodeReadAsU32 ( node, & self -> fixed_len );
-        KMDataNodeRelease ( node );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    /* look for "schema" root node */
-    rc = KMetadataOpenNodeRead ( self -> meta, & node, "schema" );
-    if ( rc == 0 )
-        return VPhysicalLoadSchema ( self, td, schema, node );
-    if ( GetRCState ( rc ) != rcNotFound )
-        return rc;
-
-    /* appears to be an older column */
-    self -> v01 = true;
-
-    /* look for "decoding" root node */
-    rc = KMetadataOpenNodeRead ( self -> meta, & node, "decoding" );
-    if ( rc == 0 )
-        return VPhysicalLoadV1Schema ( self, td, schema, node );
-    if ( GetRCState ( rc ) != rcNotFound )
-        return rc;
-
-    /* benign error for very old columns */
-    rc = RC ( rcVDB, rcColumn, rcLoading, rcSchema, rcNotFound );
-
-    DBGMSG(DBG_VDB, DBG_FLAG(DBG_VDB_VDB),
-        ("VPhysicalLoadMetadata = %d\n", rc));
-
-    return rc;
-}
diff --git a/libs/vdb/phys-priv.h b/libs/vdb/phys-priv.h
deleted file mode 100644
index b821b8b..0000000
--- a/libs/vdb/phys-priv.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_phys_priv_
-#define _h_phys_priv_
-
-#ifndef _h_vdb_extern_
-#include <vdb/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifndef _h_klib_data_buffer_
-#include <klib/data-buffer.h>
-#endif
-
-#ifndef KONST
-#define KONST
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KColumn;
-struct KMetadata;
-struct KMDataNode;
-struct VTypedecl;
-struct VSchema;
-struct VTable;
-struct VCursor;
-struct VBlob;
-struct SExpression;
-struct SPhysMember;
-struct VProduction;
-
-
-/*--------------------------------------------------------------------------
- * VPhysical
- *
- *  "?start_id" is a starting id for column
- *
- *  "?stop_id" is an INCLUSIVE stop id for column, where the apparent
- *  convention was to whine about using intervals at all due to legacy
- *  issues while at the same time using "stop" as a lame attempt at
- *  indicating fully-closed vs. "end" to indicate half-closed intervals.
- */
-typedef struct VPhysical VPhysical;
-struct VPhysical
-{
-    /* physical column */
-    int64_t kstart_id, kstop_id;
-    struct KColumn KONST *kcol;
-    struct KMetadata KONST *meta;
-
-    /* static column */
-    int64_t sstart_id, sstop_id;
-    struct KMDataNode KONST *knode;
-
-    /* owning cursor */
-    struct VCursor KONST *curs;
-
-    /* definition from schema */
-    struct SPhysMember const *smbr;
-
-    /* encoding expression */
-    struct SExpression const *enc;
-
-    /* read production
-       provides decompressed data,
-       with correct byte-order */
-    struct VProduction *out;
-
-    /* output of decompression schema */
-    struct VProduction *b2p;
-
-    /* output of compression schema */
-    struct VProduction *b2s;
-
-    /* write production
-       provides decompressed data
-       in native byte-order */
-    struct VProduction *in;
-
-    /* cached static row data */
-    KDataBuffer srow;
-
-    /* id */
-    uint32_t id;
-
-    /* fixed row length */
-    uint32_t fixed_len;
-
-    /* synthesize v1 blob header */
-    bool no_hdr;
-
-    /* v0 or v1 blobs */
-    bool v01;
-
-    /* recorded at create time */
-    bool read_only;
-};
-
-/* symbol for failed production */
-#define FAILED_PHYSICAL ( ( VPhysical* ) 1U )
-
-/* Make
- *  make an empty object
- */
-rc_t VPhysicalMake ( VPhysical **phys,
-    struct VCursor KONST *curs, struct SPhysMember const *smbr );
-
-/* Whack
- */
-void VPhysicalDestroy ( VPhysical *self );
-void CC VPhysicalWhack ( void *self, void *ignore );
-
-/* Open
- *  open existing columns
- *  load schema definitions
- */
-rc_t VPhysicalOpenWrite ( VPhysical *self,
-    struct VSchema *schema, struct VTable const *tbl );
-rc_t VPhysicalOpenRead ( VPhysical *self,
-    struct VSchema *schema, struct VTable const *tbl );
-
-/* Finish
- *  complete common open procedures
- */
-rc_t VPhysicalFinishKColumn ( VPhysical *self,
-    struct VSchema *schema, struct SPhysMember const *smbr );
-rc_t VPhysicalFinishStatic ( VPhysical *self,
-    struct VSchema const *schema, struct SPhysMember const *smbr );
-
-/* LoadMetadata
- *  looks in metadata for stored schema
- *  loads fixed row length
- */
-rc_t VPhysicalLoadMetadata ( VPhysical *self,
-    struct VTypedecl *td, struct VSchema *schema );
-
-/* Read
- *  get the blob
- */
-rc_t VPhysicalRead ( VPhysical *self,
-    struct VBlob **vblob, int64_t id, uint32_t cnt, uint32_t elem_bits );
-rc_t VPhysicalReadBlob ( VPhysical *self,
-    struct VBlob **vblob, int64_t id, uint32_t elem_bits );
-
-/* IsStatic
- *  is this a static column
- */
-rc_t VPhysicalIsStatic ( const VPhysical *self, bool *is_static );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_phys_priv_ */
diff --git a/libs/vdb/phys.c b/libs/vdb/phys.c
deleted file mode 100644
index 5e216f7..0000000
--- a/libs/vdb/phys.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#define KONST const
-#define SKONST const
-#include "phys-priv.h"
-#include "prod-priv.h"
-#include "blob-priv.h"
-#undef KONST
-#undef SKONST
-
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-
-/*--------------------------------------------------------------------------
- * VPhysical
- */
-
-
-/* Whack
- */
-void CC VPhysicalWhack ( void *item, void *ignore )
-{
-    VPhysical *self = item;
-    if ( self > FAILED_PHYSICAL )
-        VPhysicalDestroy ( self );
-}
-
-/* Read
- *  get the blob
- */
-rc_t VPhysicalRead ( VPhysical *self, VBlob **vblob, int64_t id, uint32_t cnt, uint32_t elem_bits )
-{
-    return VPhysicalReadBlob ( self, vblob, id, elem_bits );
-}
diff --git a/libs/vdb/prod-cmn.c b/libs/vdb/prod-cmn.c
deleted file mode 100644
index eb74b68..0000000
--- a/libs/vdb/prod-cmn.c
+++ /dev/null
@@ -1,2321 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#define USE_EUGENE 1
-
-
-#define TRACK_REFERENCES 0
-
-#include <vdb/extern.h>
-
-#define KONST const
-#include "prod-priv.h"
-#include "prod-expr.h"
-#include "schema-priv.h"
-#include "schema-parse.h"
-#include "schema-expr.h"
-#include "table-priv.h"
-#include "cursor-priv.h"
-#include "linker-priv.h"
-#include "column-priv.h"
-#include "phys-priv.h"
-#include "blob-priv.h"
-#include "blob.h"
-#include "page-map.h"
-#include "blob-headers.h"
-#undef KONST
-
-#include <vdb/schema.h>
-#include <vdb/cursor.h>
-#include <vdb/xform.h>
-#include <klib/symbol.h>
-#include <klib/log.h>
-#include <klib/debug.h>
-#include <klib/rc.h>
-#include <os-native.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <bitstr.h>
-#include <stdio.h>
-#include <limits.h>
-
-#if !defined(WINDOWS)  &&  !defined(_WIN32)  &&  !defined(NCBI_WITHOUT_MT)
-#define LAUNCH_PAGEMAP_THREAD 1
-#endif
-
-
-/*--------------------------------------------------------------------------
- * VBlob
- */
-
-
-static
-void CC vblob_release ( void *item, void *ignore )
-{
-    TRACK_BLOB ( VBlobRelease, ( VBlob* ) item );
-    VBlobRelease ( ( VBlob* ) item );
-}
-
-/*--------------------------------------------------------------------------
- * VProduction
- */
-
-
-/* Make
- *  allocation and parent initialization
- *  called from the "Make" functions below
- *
- *  "prod" [ OUT ] - returned production
- *
- *  "size" [ IN ] - sizeof sub-type
- *
- *  "owned" [ IN ] - vector to contain productions
- *
- *  "var" [ IN ] - variant code, e.g. prodSimple, prodFunc
- *
- *  "sub" [ IN ] - sub-variant code, e.g. prodSimplePage2Blob
- *
- *  "name" [ IN, NULL OKAY ] - optional object name, derived
- *  from schema if possible
- *
- *  "fd" [ IN ] and "desc" [ IN ] - production type description
- *
- *  "cid" [ IN ] - contextual ( two-level ) id
- *
- *  "chain" [ IN ] - which chain(s) are supported
- *    chainEncoding    - when going from input to physical
- *    chainDecoding    - when pulling from physical to output
- *    chainUncommitted - when resolving trigger and validation expressions
- */
-rc_t VProductionMake ( VProduction **prodp, Vector *owned, size_t size,
-    int var, int sub, const char *name, const VFormatdecl *fd,
-    const VTypedesc *desc, const VCtxId *cid, uint8_t chain )
-{
-    rc_t rc;
-    VProduction *prod;
-
-#if PROD_NAME
-    size_t psize = size;
-#endif
-
-    assert ( size >= sizeof * prod );
-
-#if PROD_NAME
-    if ( name != NULL )
-        size += strlen ( name );
-    size += 1;
-#endif
-
-    prod = calloc ( 1, size );
-    if ( prod == NULL )
-        rc = RC ( rcVDB, rcProduction, rcResolving, rcMemory, rcExhausted );
-    else
-    {
-        rc = VectorAppend ( owned, & prod -> oid, prod );
-        if ( rc != 0 )
-        {
-            free ( prod );
-            prod = NULL;
-        }
-        else
-        {
-#if PROD_NAME
-            prod -> name = ( ( const char* ) prod ) + psize;
-            strcpy ( ( char* ) prod -> name, name ? name : "" );
-#endif
-
-            if ( fd != NULL )
-                prod -> fd = * fd;
-            if ( desc != NULL )
-                prod -> desc = * desc;
-            if ( cid != NULL )
-                prod -> cid = * cid;
-
-            prod -> var = ( uint8_t ) var;
-            prod -> sub = ( uint8_t ) sub;
-            prod -> chain = chain;
-        }
-    }
-
-    * prodp = prod;
-    return rc;
-}
-
-#if PROD_CACHE
-static
-void VProductionFlushCacheDeep ( VProduction *self, const char *context )
-{
-    int i;
-    for ( i = 0; i < self -> cache_cnt; ++ i )
-    {
-#if TRACKING_BLOBS
-        if ( self -> cache [ i ] != NULL )
-        {
-            fprintf( stderr, "%p->%p(%d) dropped from cache on %s *** %s\n"
-                     , self
-                     , self -> cache [ i ]
-                     , atomic32_read ( & self -> cache -> refcount )
-                     , context
-                     , self -> name
-                );
-        }
-#endif
-        vblob_release ( self -> cache [ i ], NULL );
-        self -> cache [ i ] = NULL;
-    }
-}
-#endif
-
-
-/*--------------------------------------------------------------------------
- * VSimpleProd
- *  single input param
- */
-
-/* Make
- */
-rc_t VSimpleProdMake ( VProduction **prodp, Vector *owned, struct VCursor const *curs,
-   int sub, const char *name, const VFormatdecl *fd, const VTypedesc *desc,
-    const VCtxId *cid, VProduction *in, uint8_t chain )
-{
-    VSimpleProd *prod;
-    rc_t rc = VProductionMake ( prodp, owned, sizeof * prod,
-        prodSimple, sub, name, fd, desc, cid, chain );
-    if ( rc == 0 )
-    {
-        prod = ( VSimpleProd* ) * prodp;
-        prod -> in = in;
-        prod -> curs = curs;
-    }
-    return rc;
-}
-
-static
-rc_t VSimpleProdPage2Blob ( VSimpleProd *self, VBlob **rslt, int64_t id ,uint32_t cnt)
-{
-    return VProductionReadBlob(self->in, rslt, id, cnt, NULL);
-}
-
-static
-rc_t VSimpleProdSerial2Blob ( VSimpleProd *self, VBlob **rslt, int64_t id, uint32_t cnt )
-{
-    /* read serialized blob */
-    VBlob *sblob;
-    rc_t rc = VProductionReadBlob ( self -> in, &sblob, id, cnt, NULL );
-    if ( rc == 0 )
-    {
-        /* recast data to 8 bit */
-        KDataBuffer buffer;
-        rc = KDataBufferCast ( & sblob -> data, & buffer, 8, false );
-        if (rc == 0)
-        {
-            /* create a new, fluffy blob having rowmap and headers */
-            VBlob *y;
-#if LAUNCH_PAGEMAP_THREAD
-            if(self->curs->pagemap_thread == NULL){
-                VCursor *curs = (VCursor*) self->curs;
-                if(--curs->launch_cnt<=0){
-                    /* ignoring errors because we operate with or without thread */
-                    VCursorLaunchPagemapThread(curs);
-                }
-            }
-#endif
-		
-            rc = VBlobCreateFromData ( & y, sblob -> start_id, sblob -> stop_id,
-                & buffer, VTypedescSizeof ( & self -> dad . desc ), self->curs->pagemap_thread?&self->curs->pmpr:NULL );
-            KDataBufferWhack ( & buffer );
-
-            /* return on success */
-            if ( rc == 0 )
-                * rslt = y;
-        }
-
-	vblob_release(sblob, NULL);
-    }
-
-    return rc;
-}
-
-
-static
-rc_t VSimpleProdBlob2Serial( VSimpleProd *self, VBlob **rslt, int64_t id, uint32_t cnt )
-{
-    rc_t rc;
-    VBlob *sblob;
-    
-    rc = VProductionReadBlob(self->in, &sblob, id, cnt, NULL);
-    if (rc == 0) {
-        VBlob *y;
-        
-        rc = VBlobNew(&y, sblob->start_id, sblob->stop_id, "blob2serial");
-        TRACK_BLOB (VBlobNew, y);
-        if (rc == 0) {
-            rc = KDataBufferMakeBytes(&y->data, 0);
-            if (rc == 0) {
-                /* save a reference to the page map so that fixed row-length can be determined */
-                y->pm = sblob->pm;
-                PageMapAddRef(y->pm);
-                
-                rc = VBlobSerialize(sblob, &y->data);
-                if (rc == 0)
-                    * rslt = y;
-            }
-            if (rc)
-	      vblob_release(y, NULL);
-        }
-
-	vblob_release(sblob, NULL);
-    }
-    return rc;
-}
-
-/* Read
- *  return a blob containing row id
- */
-rc_t VSimpleProdRead ( VSimpleProd *self, VBlob **vblob, int64_t id, uint32_t cnt, VBlobMRUCacheCursorContext *cctx)
-{
-    rc_t rc;
-
-    switch ( self -> dad . sub )
-    {
-    case prodSimpleCast:
-        rc = VProductionReadBlob ( self -> in, vblob, id , cnt, cctx );
-        break;
-    case prodSimplePage2Blob:
-        return VSimpleProdPage2Blob(self, vblob, id, cnt);
-    case prodSimpleSerial2Blob:
-        return VSimpleProdSerial2Blob(self, vblob, id, cnt);
-    case prodSimpleBlob2Serial:
-        return VSimpleProdBlob2Serial(self, vblob, id, cnt);
-    default:
-        * vblob = NULL;
-        return RC ( rcVDB, rcProduction, rcReading, rcProduction, rcCorrupt );
-    }
-
-    if ( rc == 0 )
-    {
-        VBlob *blob = * vblob;
-
-        /* force data buffer to reflect element size */
-        if ( self -> dad . fd . fmt == 0 &&
-             self -> dad . fd . td . type_id > 2 )
-        {
-            uint32_t elem_bits = VTypedescSizeof ( & self -> dad . desc );
-            if ( elem_bits != 0 && blob -> data . elem_bits != elem_bits )
-            {
-                rc = KDataBufferCast ( & blob -> data, & blob -> data, elem_bits, true );
-                if ( rc != 0 )
-                {
-                    vblob_release ( blob, NULL );
-                    * vblob = NULL;
-                }
-            }
-        }
-    }
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * VFunctionProd
- *  function input params are VProduction*
- *  extern C function pointer and self object
- */
-
-rc_t VFunctionProdMake ( VFunctionProd **prodp, Vector *owned,
-    const VCursor *curs, int sub, const char *name,
-    const VFormatdecl *fd, const VTypedesc *desc, uint8_t chain )
-{
-    VFunctionProd *prod;
-    rc_t rc = VProductionMake ( ( VProduction** ) prodp, owned,
-        sizeof * prod, prodFunc, sub, name, fd, desc, NULL, chain );
-    if ( rc == 0 )
-    {
-        prod = * prodp;
-        prod -> curs = curs;
-
-        if ( sub != prodFuncByteswap )
-            VectorInit ( & prod -> parms, 0, 4 );
-        else
-        {
-            SDatatype *dt = VSchemaFindTypeid ( curs -> schema, fd -> td . type_id );
-            assert ( dt != NULL );
-            prod -> u . bswap = dt -> byte_swap;
-            VectorInit ( & prod -> parms, 0, 1 );
-        }
-    }
-    return rc;
-}
-
-void VFunctionProdDestroy ( VFunctionProd *self )
-{
-    /* release input parameters */
-    VectorWhack ( & self -> parms, NULL, NULL );
-    if ( self -> whack != NULL )
-        ( * self -> whack ) ( self -> fself );
-}
-
-
-
-/* Read
- */
-
-#define VECTOR_ALLOC_ARRAY( ARGC, ARRAY, S_ARRAY, H_ARRAY )	\
-    do { \
-        (H_ARRAY) = NULL; \
-        (ARRAY) = &((S_ARRAY)[0]); \
-        if ((ARGC) > sizeof((S_ARRAY)) / sizeof((S_ARRAY)[0])) { \
-            (H_ARRAY) = malloc(argc * sizeof((H_ARRAY)[0])); \
-            if ((H_ARRAY) == NULL) \
-                return RC(rcVDB, rcProduction, rcReading, rcMemory, rcExhausted); \
-            (ARRAY) = &((H_ARRAY)[0]); \
-        } \
-    } while (0)
-
-#define VECTOR_COPY_TO_ARRAY( VECTOR, ARRAY )	\
-    do { \
-        int i, n; \
-        for (n = (i = VectorStart((VECTOR))) + VectorLength((VECTOR)); i != n; ++i) \
-            (ARRAY)[i] = VectorGet((VECTOR), i); \
-    } while (0)
-
-#define VECTOR_TO_ARRAY( ARGC, ARRAY, S_ARRAY, H_ARRAY, VECTOR )	\
-    do { \
-        VECTOR_ALLOC_ARRAY((ARGC), (ARRAY), (S_ARRAY), (H_ARRAY)); \
-        VECTOR_COPY_TO_ARRAY((VECTOR), (ARRAY)); \
-    } while (0)
-
-static
-rc_t VFunctionProdCallNDRowFunc(
-                                VFunctionProd *self,
-                                VBlob **prslt,
-                                int64_t row_id,
-                                const VXformInfo *info,
-                                Vector *args
-                                )
-{
-    rc_t rc;
-    
-    /* create output blob
-       TBD - try to used cached blob if available */
-#if PROD_NAME
-    rc = VBlobNew ( prslt, row_id, row_id, self->dad.name );
-#else
-    rc = VBlobNew ( prslt, row_id, row_id, "VFunctionProdCallNDRowFunc" );
-#endif
-    TRACK_BLOB ( VBlobNew, *prslt );
-    if ( rc == 0 )
-    {
-        VRowResult rslt;
-        VRowData on_stack [ 16 ], *on_heap, *argv;
-
-        VBlob *blob = * prslt;
-        uint32_t i, argc = VectorLength ( args );
-
-        /* create and populate array of input parameters */
-        VECTOR_ALLOC_ARRAY(argc, argv, on_stack, on_heap);
-        for ( i = 0; i < argc; ++ i )
-        {
-            const VBlob *in = VectorGet(args, i);
-            uint32_t first_elem;
-
-            /* always point to page base address */
-            argv [ i ] . u . data . base = in -> data . base;
-
-            /* get row length and starting element in one pass */
-            argv [ i ] . u . data . elem_count = PageMapGetIdxRowInfo ( in -> pm,
-                (uint32_t)( row_id - in -> start_id ), & first_elem );
-
-            argv [ i ] . u . data . first_elem = first_elem;
-            
-            /* finally set the element size */
-            argv [ i ] . u . data . elem_bits = in -> data . elem_bits;
-        }
-
-        /* fill out return param block
-           NB - the initially passed-in buffer
-           may be reallocated by external function */
-        rslt . data =  & blob -> data;
-        rslt . elem_count = 0;
-        rslt . elem_bits = blob -> data . elem_bits =
-            VTypedescSizeof ( & self -> dad . desc );
-        rslt.no_cache = 0;
-        
-        blob -> byte_order = vboNative;
-
-        /* invoke the row function */
-        rc = self -> u . ndf ( self -> fself, info, row_id, & rslt, argc, argv );
-        blob->no_cache = (rslt.no_cache ? true : false);
-
-        /* clean up input arguments */
-        if ( on_heap != NULL )
-            free ( on_heap );
-
-        /* take reallocated buffer */
-        if ( rslt . data != & blob -> data )
-        {
-            KDataBufferWhack ( & blob -> data );
-            KDataBufferSub ( rslt . data, & blob -> data, 0, UINT64_MAX );
-            KDataBufferWhack ( rslt . data );
-        }
-        blob->data.elem_count = rslt.elem_count;
-
-        /* if the function was successful incorporate row length */
-        if (rc == 0)
-        {
-            assert(rslt . elem_count >> 32 == 0);
-            rc = PageMapNewFixedRowLength ( & blob -> pm, 1, (uint32_t)rslt . elem_count );
-            if ( rc == 0 )
-                return 0;
-        }
-
-        vblob_release ( blob, NULL );
-
-        *prslt = NULL;
-    }
-
-    return rc;
-}
-
-static
-rc_t VFunctionProdCallRowFunc( VFunctionProd *self, VBlob **prslt, int64_t row_id, 
-    uint32_t row_count, const VXformInfo *info, Vector *args )
-{
-    rc_t rc;
-    uint32_t i, argc = VectorLength ( args );
-    VRowResult rslt;
-    VRowData args_os[16], *args_oh, *argv;
-    KDataBuffer scratch;
-    VBlob *blob;
-    const VBlob *in;
-    PageMapIterator iter_os[16], *iter_oh, *iter;
-    uint64_t last = 0;
-    uint32_t last_len = 0;
-    uint64_t  window;
-    
-    if (argc == 0) {
-        memset(&scratch, 0, sizeof(scratch));
-        memset(&args_os[0], 0, sizeof(args_os[0]));
-        rslt.data = &scratch;
-        rslt.elem_count = 0;
-        rslt.elem_bits = scratch.elem_bits = VTypedescSizeof(&self->dad.desc);
-        
-        rc = self->u.rf(self->fself, info, row_id, &rslt, 0, args_os);
-        if (rc == 0) {
-#if PROD_NAME
-            rc = VBlobNew ( &blob, -INT64_MAX - 1, INT64_MAX, self->dad.name );
-#else
-            rc = VBlobNew ( &blob, -INT64_MAX - 1, INT64_MAX, "VFunctionProdCallDetRowFunc" );
-#endif
-            if (rc == 0) {
-		        blob->byte_order = vboNative;
-                assert(rslt.elem_count <= UINT32_MAX);
-                KDataBufferSub(rslt.data, &blob->data, 0, rslt.elem_count);
-		if ( rslt.data != & scratch )
-		  KDataBufferWhack(rslt.data);
-                rc = PageMapNewSingle(&blob->pm, UINT32_MAX, (uint32_t)rslt.elem_count);
-                if (rc == 0)
-                    *prslt = blob;
-                else
-		  vblob_release(blob, NULL);
-            }
-        }
-        KDataBufferWhack(&scratch);
-        return rc;
-    }
-
-
-#define MAX_BLOB_REGROUP 256 /** max rows in blob for regrouping ***/
-    window=self->stop_id-self->start_id+1;/*** from previous fetch **/
-    if(row_id == self->stop_id+1){ /** sequentual io ***/
-	if( window < MAX_BLOB_REGROUP && (row_id%(4*window))==1){
-		window *=4;
-	}
-    } else {
-	window = 1;
-    } 
-
-    if(window == 1){
-	self->start_id=self->stop_id=row_id;
-	if(row_count > 0) self->stop_id += row_count-1;
-    } else { 
-      for (self->start_id=-INT64_MAX - 1,self->stop_id=INT64_MAX,i = 0; i != argc; ++ i) {
-          in = VectorGet(args, i);
-        if(self->start_id < in->start_id) self->start_id=in->start_id;
-        if(self->stop_id  > in->stop_id ) self->stop_id =in->stop_id;
-      }
-      assert(row_id >= self->start_id && row_id  + row_count -1 <= self->stop_id);
-      if(self->start_id==-INT64_MAX - 1 || self->stop_id==INT64_MAX){
-        self->start_id=self->stop_id=row_id;
-        if(row_count > 0) self->stop_id += row_count-1;
-      } else if (    row_count ==1 /*we are re-blobing */
-                  && self->stop_id - self->start_id > 2*window){
-	int64_t	n=(row_id-1)/window;
-	if(self->start_id <= n*window)      self->start_id=n*window+1;
-	if(self->stop_id > (n+1) * window) self->stop_id = (n+1)*window;
-      }
-    }
-    
-#if PROD_NAME
-    rc = VBlobNew ( &blob, self->start_id, self->stop_id, self->dad.name );
-#else
-    rc = VBlobNew ( &blob, self->start_id, self->stop_id, "VFunctionProdCallDetRowFunc" );
-#endif
-    TRACK_BLOB ( VBlobNew, blob );
-    if (rc)
-        return rc;
-    rc = PageMapNew(&blob->pm, BlobRowCount(blob));
-    if (rc == 0)
-	rc = PageMapPreExpandFull(blob->pm, BlobRowCount(blob));
-    if (rc) {
-      vblob_release(blob, NULL);
-        return rc;
-    }
-    
-    
-    memset(&scratch, 0, sizeof(scratch));
-    rslt.data = &scratch;
-    rslt.elem_bits = scratch.elem_bits = blob->data.elem_bits = VTypedescSizeof(&self->dad.desc);
-    blob->byte_order = vboNative;
-    
-    /* create and populate array of input parameters */
-    VECTOR_ALLOC_ARRAY(argc, argv, args_os, args_oh);
-    VECTOR_ALLOC_ARRAY(argc, iter, iter_os, iter_oh);
-    
-    for (i = 0; i != argc; ++ i) {
-        in = VectorGet(args, i);
-       
-	if(in->start_id == -INT64_MAX - 1 ) {
-		rc = PageMapNewIterator(in->pm, &iter[i],0,-1);
-	} else {
-		rc = PageMapNewIterator(in->pm, &iter[i], self->start_id-in->start_id, self->stop_id - self->start_id + 1);
-	}
-        if ( rc ) break;
-/*********
-        if ( !PageMapIteratorAdvance( &iter[i], (uint32_t)( start_id - in->start_id ) ) ) {
-            rc = RC(rcVDB, rcFunction, rcExecuting, rcBlob, rcCorrupt);
-            break;
-        }
-**********/
-        memset(&argv[i], 0, sizeof(argv[i]));
-        argv[i].variant = vrdData;
-        argv[i].u.data.elem_bits = in->data.elem_bits;
-        argv[i].u.data.base = in->data.base;
-    }
-    
-    for (row_id = self->start_id; row_id <= self->stop_id && rc == 0; ) {
-        uint32_t row_count = 1;
-	if(self->dad.sub == vftRow ){
-		row_count = PageMapIteratorRepeatCount(&iter[0]);
-		
-		for (i = 1; i != argc; ++i) {
-		    uint32_t j = PageMapIteratorRepeatCount(&iter[i]);
-		    if (row_count > j)
-			row_count = j;
-		}
-		if (row_id + row_count > self->stop_id + 1)
-		    row_count = (uint32_t)( self->stop_id + 1 - row_id );
-	}
-			
-	for (i = 0; i != argc; ++i) {
-	    argv[i].u.data.elem_count = PageMapIteratorDataLength(&iter[i]);
-	    argv[i].u.data.first_elem = PageMapIteratorDataOffset(&iter[i]);
-	}
-        
-        rslt.elem_count = 0;
-        rc = self->u.rf(self->fself, info, row_id, &rslt, argc, argv);
-        if (rc) break;
-        
-        assert(rslt.elem_count >> 32 == 0);
-
-        if ( row_id == self->start_id || last_len != rslt.elem_count || 
-            bitcmp(blob->data.base, last * rslt.elem_bits,
-                   rslt.data->base, 0, rslt.elem_count * rslt.elem_bits) != 0)
-        {
-            last = blob->data.elem_count;
-            rc = KDataBufferResize(&blob->data, blob->data.elem_count + rslt.elem_count);
-            if (rc == 0) {
-                bitcpy(blob->data.base, last * rslt.elem_bits,
-                       rslt.data->base, 0, rslt.elem_count * rslt.elem_bits);
-                rc = PageMapAppendRows(blob->pm, rslt.elem_count, row_count, false);
-            }
-        }
-        else
-            rc = PageMapAppendRows(blob->pm, rslt.elem_count, row_count, true);
-        
-        /* drop any new buffer that was returned to us */
-        if (rslt.data != &scratch) {
-            KDataBufferWhack(rslt.data);
-        }
-        
-        if (rc) break;
-        
-        last_len = (uint32_t)rslt.elem_count;
-
-        for (i = 0; i != argc; ++i)
-            PageMapIteratorAdvance(&iter[i], row_count);
-        row_id += row_count;
-    }
-    KDataBufferWhack(&scratch);    
-    if (args_oh) free(args_oh);
-    if (iter_oh) free(iter_oh);
-
-    if (rc == 0) {
-        *prslt = blob;
-        return 0;
-    }
-    vblob_release(blob, NULL);
-    
-    return rc;
-}
-
-static
-rc_t VFunctionProdCallArrayFunc( VFunctionProd *self, VBlob **prslt,
-    int64_t id, const VXformInfo *info, Vector *args ) {
-    VBlob *rslt = 0;
-    VBlob *sblob;
-    rc_t rc;
-    
-    sblob = VectorGet(args, 0);
-    assert(sblob);
-    
-#if PROD_NAME
-    rc = VBlobNew(&rslt, sblob->start_id, sblob->stop_id, self->dad.name);
-#else
-    rc = VBlobNew(&rslt, sblob->start_id, sblob->stop_id, "VFunctionProdCallArrayFunc");
-#endif
-    TRACK_BLOB( VBlobNew, rslt );
-    if (rc == 0) {
-        rslt->pm = sblob->pm;
-        PageMapAddRef(rslt->pm);
-        
-        if (sblob->headers) {
-            if ( self -> dad . chain == chainEncoding )
-                rc = BlobHeadersCreateChild(sblob->headers, &rslt->headers);
-            else {
-                rslt->headers = (BlobHeaders *)BlobHeadersGetNextFrame(sblob->headers);
-                BlobHeadersAddRef(rslt->headers);
-            }
-        }
-        if (rc == 0) {
-	    rc = KDataBufferMake(&rslt->data, VTypedescSizeof(&self->dad.desc), sblob->data.elem_count);
-            if (rc == 0) {
-                rc = self->u.af(
-                                self->fself,
-                                info,
-                                rslt->data.base,
-                                sblob->data.base,
-                                sblob->data.elem_count
-                                );
-                if (rc == 0) {
-                    *prslt = rslt;
-                    return 0;
-                }
-            }
-        }
-
-        vblob_release( rslt, NULL );
-    }
-    
-    return rc;
-}
-
-static
-rc_t VFunctionProdCallPageFunc( VFunctionProd *self, VBlob **rslt, int64_t id, 
-    const VXformInfo *info, Vector *args )
-{
-    struct input_t {
-        const VBlob *blob;
-        bool	sb_input;
-        PageMapIterator cur_row;
-        bool at_end;
-    };
-    struct input_t on_stack[8];
-    struct input_t *on_heap;
-    struct input_t *argv;
-    
-    VRowData pb_stack[8];
-    VRowData *pb_heap;
-    VRowData *param;
-    
-    rc_t rc=0;
-    uint32_t i, argc = VectorLength(args);
-    int64_t start_id;
-    int64_t stop_id;
-    uint32_t elem_count;
-    uint32_t row_count;
-    int first_non_control_input;
-    int allInputsAreSingleRow;
-    VBlob *blob = NULL;
-    
-    VECTOR_ALLOC_ARRAY(argc, argv, on_stack, on_heap);
-    VECTOR_ALLOC_ARRAY(argc, param, pb_stack, pb_heap);
-
-    memset(argv, 0, sizeof(argv[0]) * argc);
-    
-    for (start_id = stop_id = 0,
-         first_non_control_input=-1,
-         allInputsAreSingleRow = true,
-         i = 0; i != argc ; ++i) {
-        const VBlob *b = (const VBlob *)VectorGet(args, i);
-        const VProduction *prod = (const VProduction *)VectorGet(&self->parms, i);
-
-
-        if(b->pm == NULL){
-            rc=PageMapProcessGetPagemap(&self->curs->pmpr,(PageMap**)(&b->pm));
-            if(rc != 0) return rc;
-        }
-        
-        if (prod->control) {
-            param[i].variant = vrdControl;
-            assert(0); /*** TBD: Not implemented ???? ***/
-        } else {
-            param[i].variant = vrdData;
-            argv[i].blob = b;
-            argv[i].sb_input = VBlobIsSingleRow(argv[i].blob);
-            allInputsAreSingleRow &= argv[i].sb_input;
-            
-            if(first_non_control_input < 0){
-                first_non_control_input = i;
-                start_id = argv[i].blob->start_id;
-                stop_id = argv[i].blob->stop_id;
-            } else {
-                if(start_id < argv[i].blob->start_id)
-                    start_id = argv[i].blob->start_id;
-                if(stop_id > argv[i].blob->stop_id)
-                    stop_id  = argv[i].blob->stop_id;
-            }
-        }
-    }
-    if ( allInputsAreSingleRow ) {
-	row_count = stop_id - start_id + 1;
-	if(row_count == 0 ) /*** case of static column **/
-		row_count=1;
-    } else {
-	row_count = stop_id - start_id + 1;
-    }
-    if (first_non_control_input < 0) /* no non-control inputs */
-        rc = RC(rcVDB, rcFunction, rcExecuting, rcParam, rcInvalid);
-    else if (start_id > stop_id )
-        rc = RC(rcVDB, rcFunction, rcExecuting, rcRange, rcEmpty);
-    
-    for ( elem_count = 0, i = 0; i != argc && rc ==0; ++i) {
-        rc = PageMapNewIterator(argv[i].blob->pm, &argv[i].cur_row, start_id - argv[i].blob->start_id ,row_count);
-        if(rc == 0){
-            PageMapIterator temp = argv[i].cur_row;
-            uint32_t ec = 0;
-            
-            if ( argv[i].sb_input ){
-                ec = PageMapIteratorDataLength(&temp) * row_count;
-            } else do {
-                ec+=PageMapIteratorDataLength(&temp);
-            } while (PageMapIteratorNext(&temp));
-            if(ec == 0){
-                rc = RC(rcVDB, rcFunction, rcExecuting, rcPagemap, rcInvalid); /* bad page map */
-            } else if (elem_count == 0){
-                elem_count=ec;
-            } else if (ec != elem_count){
-                rc = RC(rcVDB, rcFunction, rcExecuting, rcParam, rcInvalid); /* Pages have to have the same number of elements*/
-            }
-    	}
-    }
-    
-    while (rc == 0) /* not really while */ {
-#if PROD_NAME
-        rc = VBlobNew(&blob, start_id, stop_id, self->dad.name);
-#else
-        rc = VBlobNew(&blob, start_id, stop_id, "VFunctionProdCallPageFunc");
-#endif
-        if (rc) break;
-        
-        TRACK_BLOB(VBlobNew,blob);
-        
-        if (allInputsAreSingleRow) {
-            VFixedRowResult rslt;
-            uint32_t	row_element_count = PageMapIteratorDataLength(&argv[first_non_control_input].cur_row);
-            
-            rc = PageMapNewSingle(&blob->pm, row_count, row_element_count);
-            if (rc) break;
-            
-            rc = KDataBufferMake(&blob->data, VTypedescSizeof(&self->dad.desc), row_element_count);
-            if (rc) break;
-            
-            for (i = 0; i != argc; ++i) {
-                if (param[i].variant == vrdControl)
-                    continue;
-                if (argv[i].at_end) {
-                    rc = RC(rcVDB, rcFunction, rcExecuting, rcRow, rcNotFound);
-                    break;
-                }
-                
-                param[i].u.data.base = argv[i].blob->data.base;
-                param[i].u.data.elem_count = row_element_count;
-                param[i].u.data.first_elem = PageMapIteratorDataOffset(&argv[i].cur_row);
-                param[i].u.data.elem_bits = argv[i].blob->data.elem_bits;
-                
-                argv[i].at_end = PageMapIteratorNext(&argv[i].cur_row) ? false : true;
-            }
-            if (rc) break;
-            
-            rslt.base = blob->data.base;
-            rslt.first_elem = 0;
-            rslt.elem_count = row_element_count;
-            rslt.elem_bits = blob->data.elem_bits;
-            
-            rc = self->u.pf(self->fself, info, start_id, &rslt, argc, param);
-        } else {
-            uint32_t first_write;
-            int64_t row_id;
-            uint32_t last = 0;
-            uint32_t last_rowlen = 0;
-            
-            rc = PageMapNew(&blob->pm, row_count); /*** max number of rows - it may collapse some **/
-            if (rc) break;
-            rc = KDataBufferMake(&blob->data, VTypedescSizeof(&self->dad.desc), elem_count);
-            if (rc) break;
-            
-            for (first_write = 0, row_id = start_id; row_id <= stop_id; ++row_id) {
-                VFixedRowResult rslt;
-                
-                for (i = 0; i != argc; ++i) {
-                    if (param[i].variant == vrdControl)
-                        continue;
-                    if (argv[i].at_end) {
-                        rc = RC(rcVDB, rcFunction, rcExecuting, rcRow, rcNotFound);
-                        break;
-                    }
-                    
-                    param[i].u.data.base = argv[i].blob->data.base;
-                    param[i].u.data.elem_count = PageMapIteratorDataLength(&argv[i].cur_row);
-                    param[i].u.data.first_elem = PageMapIteratorDataOffset(&argv[i].cur_row);
-                    param[i].u.data.elem_bits = argv[i].blob->data.elem_bits;
-                    
-                    argv[i].at_end = PageMapIteratorNext(&argv[i].cur_row) ? false : true;
-                }
-                if (rc)
-                    break;
-                
-                rslt.base = blob->data.base;
-                rslt.first_elem = first_write;
-                rslt.elem_count = param[first_non_control_input].u.data.elem_count;
-                rslt.elem_bits = blob->data.elem_bits;
-                
-                rc = self->u.pf(self->fself, info, row_id, &rslt, argc, param);
-                if (rc)
-                    break;
-                
-                assert(rslt.elem_count >> 32 == 0);
-                if ( row_id != start_id && last_rowlen == rslt.elem_count &&
-                    memcmp(((char*)blob->data.base) + (last*rslt.elem_bits)/8,
-                           ((char*)blob->data.base) + (first_write*rslt.elem_bits)/8,
-                           (rslt.elem_count*rslt.elem_bits)/8) == 0)
-                {
-                    rc = PageMapAppendRow(blob->pm, (uint32_t)rslt.elem_count, true);
-                }
-                else {
-                    last = first_write;
-                    first_write += rslt.elem_count;
-                    rc = PageMapAppendRow(blob->pm, (uint32_t)rslt.elem_count, false);
-                }
-                if (rc)
-                    break;
-                last_rowlen = (uint32_t)rslt.elem_count;
-            }
-            if (rc)
-                break;
-            KDataBufferSub(&blob->data, &blob->data, 0, first_write);
-        }
-        *rslt = blob;
-        break;
-    }
-    if (rc != 0 && blob != NULL) vblob_release(blob, NULL);
-    if (on_heap) free(on_heap);
-    if (pb_heap) free(pb_heap);
-    return rc;
-}
-
-static
-rc_t VFunctionProdCallBlobFuncEncoding( VFunctionProd *self, VBlob *rslt, int64_t id,
-    const VXformInfo *info, const VBlob *sblob ) {
-    VBlobData src;
-    VBlobResult dst;
-    VBlobHeader *hdr;
-    rc_t rc;
-    uint32_t elem_size = VTypedescSizeof(&self->dad.desc);
-    
-    rc = BlobHeadersCreateChild(sblob->headers, &rslt->headers);
-    if (rc == 0) {
-        hdr = BlobHeadersGetHdrWrite(rslt->headers);
-        if (hdr) {
-            bitsz_t sz = KDataBufferBits(&sblob->data);
-            
-            VBlobHeaderSetSourceSize(hdr, KDataBufferBytes(&sblob->data));
-            sz = (sz + elem_size - 1) / elem_size;
-            rc = KDataBufferMake( &rslt->data, elem_size, sz );
-        }
-        else
-            rc = RC(rcVDB, rcFunction, rcExecuting, rcMemory, rcExhausted);
-    }
-    if (rc)
-        return rc;
-
-    dst.header = NULL;
-    
-    if ( sblob -> data.elem_count == 0)
-        goto SKIP_COMPRESSION;
-
-    src.data = sblob -> data.base;
-    src.elem_count = sblob -> data.elem_count;
-    src.elem_bits = sblob -> data.elem_bits;
-    src.byte_order = sblob -> byte_order;
-    
-    dst.data = rslt -> data.base;
-    dst.elem_count = rslt -> data.elem_count;
-    dst.elem_bits = rslt -> data.elem_bits;
-    dst.byte_order = sblob -> byte_order;
-    
-    rc = self->u.bf(self->fself, info, &dst, &src, hdr);
-    
-    if (rc == 0) {
-        if ( dst.header != NULL && dst.header != hdr ) {
-            VBlobHeaderReplace ( hdr, dst.header );
-            VBlobHeaderRelease ( dst.header );
-        }
-        rslt->data.elem_bits = dst.elem_bits;
-        rslt->data.elem_count = dst.elem_count;
-        rslt->byte_order = dst.byte_order;
-    }
-    else if (GetRCObject(rc) == rcBuffer && GetRCState(rc) == rcInsufficient) {
-    SKIP_COMPRESSION:
-        VBlobHeaderSetFlags(hdr, 1);
-        
-        KDataBufferWhack(&rslt->data);
-        if ( dst.header != NULL && dst.header != hdr )
-            VBlobHeaderRelease ( dst.header );
-        
-        /* compressors usually produce bits (elem_size == 1) or bytes (elem_size == 8)
-         * the cast to bits can never fail, so we will force the cast to bytes to also be
-         * infallible; casts to other sizes are allowed to fail to prevent data loss */
-        if (elem_size == 8) {
-            KDataBufferSub(&sblob->data, &rslt->data, 0, UINT64_MAX);
-            /* We can't shrink the data and KDataBufferCast won't increase the number of bits
-             * but we know that KDataBuffer can't allocate anything other than whole bytes
-             * so we're forcing the conversion to bytes manually. */
-            rslt->data.elem_count = KDataBufferBytes(&rslt->data);
-            rslt->data.elem_bits = 8;
-            rc = 0;
-        }
-        else /* if elem_size == 1 this will always work */
-            rc = KDataBufferCast(&sblob->data, &rslt->data, elem_size, false);
-    }
-    VBlobHeaderRelease(hdr);
-    
-    return rc;
-}
-
-static
-rc_t VFunctionProdCallBlobFuncDecoding( VFunctionProd *self, VBlob *rslt,
-    int64_t id, const VXformInfo *info, const VBlob *sblob ) {
-    VBlobHeader *hdr;
-    rc_t rc;
-    uint32_t elem_size = VTypedescSizeof(&self->dad.desc);
-    
-    if (sblob->headers == NULL) {
-        /* v1 blobs don't have headers, but v1 blobs
-         * are fixed row-length so we know the data size
-         * we are relying on the blob deserialization code
-         * to set the page map up correctly */
-        if (sblob->pm == NULL) {
-            hdr = BlobHeadersCreateDummyHeader(0, 0, 0, (sblob->data.elem_bits * sblob->data.elem_count + 7) >> 3);
-        }
-        else
-            hdr = BlobHeadersCreateDummyHeader(0, 0, 0, BlobRowCount(sblob) * PageMapGetIdxRowInfo(sblob->pm, 0, 0));
-        /* leave rslt->headers null so that the next
-         * stage will also create a dummy header */
-    }
-    else {
-        /* rslt gets the headers for the next stage in decoding */
-        rslt->headers = (BlobHeaders *)BlobHeadersGetNextFrame(sblob->headers);
-        BlobHeadersAddRef(rslt->headers);
-        
-        /* get the headers for this stage in decoding */
-        hdr = BlobHeadersGetHeader(sblob->headers);
-    }
-    if ( hdr == NULL )
-        rc = RC(rcVDB, rcFunction, rcExecuting, rcMemory, rcExhausted);
-    else if ((VBlobHeaderFlags(hdr) & 1) != 0)
-    {
-        /* compression was skipped */
-        VBlobHeaderRelease(hdr);
-        return KDataBufferCast(&sblob->data, &rslt->data, elem_size, true);
-    }
-    else
-    {
-        rc = KDataBufferMakeBytes(&rslt->data, VBlobHeaderSourceSize(hdr));
-        if (rc == 0) {
-            VBlobData src;
-            VBlobResult dst;
-            
-            dst.header = NULL;
-            
-            src.data = sblob -> data.base;
-            src.elem_count = sblob -> data.elem_count;
-            src.elem_bits = sblob -> data.elem_bits;
-            src.byte_order = sblob -> byte_order;
-            
-            dst.data = rslt -> data.base;
-            dst.elem_count = (rslt -> data.elem_count << 3) / elem_size;
-            dst.elem_bits = elem_size;
-            dst.byte_order = sblob -> byte_order;
-            
-            rc = self->u.bf(self->fself, info, &dst, &src, hdr);
-            
-            if (rc == 0) {
-                if ( dst.header != NULL && dst.header != hdr ) {
-                    /* only allow replacement of headers when encoding */
-                    VBlobHeaderRelease ( dst.header );
-                }
-                
-                rslt->data.elem_bits = dst.elem_bits;
-                rslt->data.elem_count = dst.elem_count;
-                rslt->byte_order = dst.byte_order;
-                
-                rc = KDataBufferCast(&rslt->data, &rslt->data, elem_size, true);
-            }
-        }
-        VBlobHeaderRelease(hdr);
-    }
-
-    return rc;
-}
-
-static
-rc_t VFunctionProdCallBlobFunc( VFunctionProd *self, VBlob **prslt,
-    int64_t id, const VXformInfo *info, Vector *args ) {
-    VBlob *rslt = 0;
-    VBlob *sblob;
-    rc_t rc;
-    
-    sblob = VectorGet(args, 0);
-    assert(sblob);
-    if(self->dad.chain == chainEncoding){
-	VBlobAddRef(sblob);
-	if(sblob->headers==NULL)/**first in encryption chain***/
-		VBlobPageMapOptimize(&sblob); /** try to optimize the blob **/
-    }
-
-#if PROD_NAME
-    rc = VBlobNew(&rslt, sblob->start_id, sblob->stop_id, self->dad.name);
-#else
-    rc = VBlobNew(&rslt, sblob->start_id, sblob->stop_id, "VFunctionProdCallBlobFunc");
-#endif
-    if (rc)
-        return rc;
-    
-    TRACK_BLOB(VBlobNew,rslt);
-    
-    /* blob funcs are not allowed to change page maps */
-    rslt->pm = sblob->pm;
-    PageMapAddRef(rslt->pm);
-    
-    rslt->byte_order = sblob->byte_order;
-    
-    if (self->dad.chain == chainEncoding){
-        rc = VFunctionProdCallBlobFuncEncoding(self, rslt, id, info, sblob);
-	vblob_release( sblob, NULL );
-    } else {
-        rc = VFunctionProdCallBlobFuncDecoding(self, rslt, id, info, sblob);
-    }
-    
-    if (rc == 0) {
-        *prslt = rslt;
-        return 0;
-    }
-    vblob_release( rslt, NULL );
-    return rc;
-}
-
-static
-rc_t VFunctionProdCallBlobNFunc( VFunctionProd *self, VBlob **rslt,
-    int64_t id, const VXformInfo *info, Vector *args ) {
-    const VBlob *on_stack[16];
-    const VBlob **on_heap;
-    const VBlob **argv;
-    int argc = VectorLength(args);
-    rc_t rc;
-    
-    VECTOR_TO_ARRAY(argc, argv, on_stack, on_heap, args);
-    {
-	int i;
-	for(i=0;i<argc;i++){
-		VBlob const *vb=argv[i];
-		if(vb->pm == NULL){
-			rc=PageMapProcessGetPagemap(&self->curs->pmpr,(PageMap**)(&vb->pm));
-			if(rc != 0) return rc;
-		}
-	}
-    }
-    rc = self->u.bfN(self->fself, info, id, rslt, argc, argv);
-    if ( on_heap )
-        free( (void*) on_heap );
-    return rc;
-}
-
-static
-rc_t VFunctionProdCallLegacyBlobFunc( VFunctionProd *self, VBlob **prslt,
-    int64_t id, const VXformInfo *info, Vector *args ) {
-    VBlob *rslt = 0;
-    VBlob *sblob;
-    VNoHdrBlobFunc func = (VNoHdrBlobFunc)self->u.bf;
-    rc_t rc;
-    uint32_t elem_size = VTypedescSizeof(&self->dad.desc);
-    
-    sblob = VectorGet(args, 0);
-    assert(sblob);
-    
-#if PROD_NAME
-    rc = VBlobNew(&rslt, sblob->start_id, sblob->stop_id, self->dad.name);
-#else
-    rc = VBlobNew(&rslt, sblob->start_id, sblob->stop_id, "VFunctionProdCallLegacyBlobFunc");
-#endif
-    TRACK_BLOB(VBlobNew,rslt);
-    if (rc == 0) {
-        rc = KDataBufferMakeBytes(&rslt->data, 0);
-        if (rc == 0) {
-            VLegacyBlobResult dst;
-            dst.dst = & rslt -> data;
-            dst.byte_order = vboLittleEndian;
-            rc = func(self->fself,
-                      info,
-                      &dst,
-                      &sblob->data
-                      );
-            
-            if (rc == 0)
-            {
-                rslt->byte_order = dst.byte_order;
-
-                rc = KDataBufferCast(&rslt->data, &rslt->data, elem_size, true);
-                if (rc == 0) {
-                    rslt->pm = sblob->pm;
-                    PageMapAddRef(rslt->pm);
-
-                    *prslt = rslt;
-                    return 0;
-                }
-            }
-        }
-
-        vblob_release( rslt, NULL );
-    }
-    return rc;
-}
-
-static
-rc_t VFunctionProdCallByteswap ( VFunctionProd *self, VBlob **vblob,
-    int64_t id, const VXformInfo *info, Vector *args )
-{
-    /* get single input blob */
-    VBlob *blob = VectorFirst ( args );
-    rc_t rc;
-
-    assert ( blob != NULL );
-    
-#if PROD_CACHE
-    VProductionFlushCacheDeep ( & self -> dad, "byteswap" );
-#endif
-    
-    /* CAST */
-    rc = KDataBufferCast ( & blob->data, & blob->data, 
-                           self->dad.desc.intrinsic_bits * self->dad.desc.intrinsic_dim,
-                           false );
-    if ( rc == 0 )
-    {
-        /* legacy blob check
-         * repair missing pagemap
-         */
-        if (blob->pm == NULL) {
-            uint64_t row_count = BlobRowCount ( blob );
-            if ( row_count == 0 || blob->data.elem_count % row_count != 0)
-                rc = RC(rcVDB, rcBlob, rcReading, rcBlob, rcCorrupt);
-            else {
-                uint64_t row_len = blob->data.elem_count / row_count;
-                rc = PageMapNewFixedRowLength(&blob->pm, row_count, row_len);
-            }
-        }
-    }
-
-    if ( rc != 0)
-        return rc;
-
-    /* check for byteswapping function */
-    if ( self -> u.bswap != NULL )
-    {
-
-        if ( blob -> byte_order ==
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-             vboBigEndian
-#else
-             vboLittleEndian
-#endif
-            )
-        {
-            uint32_t int_size;
-            uint64_t blob_bits;
-
-            /* make writable */
-            KDataBuffer buffer;
-
-            rc = KDataBufferMakeWritable ( & blob -> data, & buffer );
-            if ( rc != 0 )
-                return rc;
-
-            /* invoke byte-swap function on input */
-            blob_bits = KDataBufferBits ( & buffer );
-            int_size = self -> dad.desc .intrinsic_bits;
-            ( * self -> u.bswap ) ( buffer.base, buffer.base,
-                ( uint32_t ) ( blob_bits / int_size ) );
-
-            /* poke bytes back into blob */
-            KDataBufferWhack ( & blob -> data );
-            blob -> data = buffer;
-        }
-    }
-
-    blob -> byte_order = vboNative;
-    *vblob = blob;
-
-    (void)VBlobAddRef ( blob );
-    TRACK_BLOB( VBlobAddRef, blob );
-
-    return 0;
-}
-
-#if _DEBUGGING
-#include <ctype.h>
-
-static
-rc_t VFunctionProdCallCompare1(VFunctionProd *self, VBlob **vblob, int64_t id, uint32_t cnt) {
-    VBlob *orig;
-    rc_t rc;
-    
-    *vblob = NULL;
-    assert(VectorLength(&self->parms) == 2);
-    rc = VProductionReadBlob((const VProduction *)VectorGet(&self->parms, 0), &orig, id, cnt, NULL);
-    if (rc == 0) {
-        int64_t i;
-        PageMapIterator oi;
-        VRowData orig_data;
-        const VProduction *test_prod = VectorGet(&self->parms, 1);
-
-        orig_data.u.data.base = orig->data.base;
-        orig_data.u.data.elem_bits = orig->data.elem_bits;
-        
-        PageMapNewIterator(orig->pm, &oi, 0, -1);
-        
-        for (i = orig->start_id; i <= orig->stop_id; ++i) {
-            VBlob *test;
-            uint32_t j;
-
-            j = PageMapIteratorDataLength(&oi);
-
-            rc = VProductionReadBlob(test_prod, &test, i, 1, NULL);
-            if (rc == 0) {
-                if (orig->data.elem_bits != test->data.elem_bits || orig->byte_order != test->byte_order)
-                    rc = RC(rcVDB, rcBlob, rcValidating, rcBlob, rcCorrupt);
-                else {
-                    PageMapIterator ti;
-                    VRowData test_data;
-
-                    test_data.u.data.base = test->data.base;
-                    test_data.u.data.elem_bits = test->data.elem_bits;
-                    
-                    PageMapNewIterator(test->pm, &ti, 0, -1);
-                    
-                    if (!PageMapIteratorAdvance(&ti, (uint32_t)(i - test->start_id))) {
-                        rc = RC(rcVDB, rcBlob, rcValidating, rcBlob, rcCorrupt);
-                    }
-                    else {
-                        uint32_t k = PageMapIteratorDataLength(&ti);
-                        orig_data.u.data.elem_count = test_data.u.data.elem_count = j;
-                        
-                        orig_data.u.data.first_elem = (orig->data.bit_offset / orig->data.elem_bits) + PageMapIteratorDataOffset(&oi);
-                        test_data.u.data.first_elem = (test->data.bit_offset / test->data.elem_bits) + PageMapIteratorDataOffset(&ti);
-
-                        if (j != k) {
-                            rc = RC(rcVDB, rcBlob, rcValidating, rcBlob, rcCorrupt);
-                        } else {
-                            rc = self->u.cf(self->fself, &orig_data, &test_data);
-                            if (rc) {
-                                rc = RC(rcVDB, rcBlob, rcValidating, rcBlob, rcCorrupt);
-                            }
-                        }
-                        if (rc) {
-                            const uint8_t *a = orig_data.u.data.base;
-                            const uint8_t *b = test_data.u.data.base;
-                            unsigned count;
-                            unsigned k;
-                            unsigned m;
-                            char f, ax[9 + 16 * 4 + 1], bx[9 + 16 * 4 + 1];
-                            char av[16], bv[16];
-
-                            a += (orig_data.u.data.first_elem * orig_data.u.data.elem_bits) >> 3;
-                            b += (test_data.u.data.first_elem * test_data.u.data.elem_bits) >> 3;
-                            /* show up to a row of data before */
-                            count = a - (const uint8_t*)orig_data.u.data.base;
-                            count = count < b - (const uint8_t*)orig_data.u.data.base ? count : b - (const uint8_t*)orig_data.u.data.base;
-                            count = count > 16 ? 16 : count;
-                            a -= count;
-                            b -= count;
-                            
-                            count += (j * orig->data.elem_bits + 7) >> 3;
-
-                            for (k = 0, m = 0; k != count; ++k) {
-                                if (m == 0) {
-                                    sprintf(ax, "%08X>", k);
-                                    sprintf(bx, "%08X<", k);
-                                }
-                                f = a[k] == b[k] ? ' ': '*';
-                                sprintf(ax + m * 4 + 9, " %02x%c", a[k], f);
-                                av[m] = isprint(a[k]) ? a[k] : '.';
-                                sprintf(bx + m * 4 + 9, " %02x%c", b[k], f);
-                                bv[m] = isprint(b[k]) ? b[k] : '.';
-                                m++;
-                                if(m == 16 || k == count - 1) {
-                                    DBGMSG(DBG_VDB, DBG_VDB_COMPARE, ("%-73s '%.*s'\n%-73s '%.*s'\n\n", ax, m, av, bx, m, bv));
-                                    m = 0;
-                                }
-                            }
-                        }
-                    }
-                }
-                vblob_release(test, NULL);
-                if (rc)
-                    break; }
-            else
-                break;
-            PageMapIteratorAdvance(&oi, 1);
-        }
-        vblob_release(orig, NULL);
-    }
-    return rc;
-}
-#endif
-
-static
-rc_t VFunctionProdCallCompare( VFunctionProd *self, VBlob **vblob, int64_t id, uint32_t cnt ) {
-    VBlob *orig;
-    rc_t rc;
-    VProduction const *orig_prod;
-    
-    *vblob = NULL;
-    assert(VectorLength(&self->parms) == 2);
-    orig_prod = (const VProduction *)VectorGet(&self->parms, 0);
-    rc = VProductionReadBlob(orig_prod, &orig, id, cnt, NULL);
-    if (rc == 0) {
-        VBlob *test;
-        const VProduction *test_prod = VectorGet(&self->parms, 1);
-        
-        rc = VProductionReadBlob(test_prod, &test, id, cnt, NULL);
-        if (rc == 0) {
-            if (orig->data.elem_bits != test->data.elem_bits || orig->byte_order != test->byte_order){
-                rc = RC(rcVDB, rcBlob, rcValidating, rcBlob, rcCorrupt);
-            } else if(   orig->pm->data_recs != 1				/*** catching static **/
-                      || test->pm->data_recs != 1				/*** trying quick comparison **/
-		      || orig->data.elem_count != test->data.elem_count
-                      || memcmp( orig->data.base, test->data.base, (orig->data.elem_bits*orig->data.elem_count+7)/8)){
-                uint64_t i;
-                PageMapIterator oi;
-                PageMapIterator ti;
-                VRowData orig_data;
-                VRowData test_data;
-                
-                orig_data.u.data.base = orig->data.base;
-                orig_data.u.data.elem_bits = orig->data.elem_bits;
-                
-                test_data.u.data.base = test->data.base;
-                test_data.u.data.elem_bits = test->data.elem_bits;
-                
-                PageMapNewIterator(orig->pm, &oi, 0, -1);
-                PageMapNewIterator(test->pm, &ti, 0, -1);
-                if (test->start_id < orig->start_id) {
-                    if ( !PageMapIteratorAdvance( &ti, (uint32_t)( orig->start_id - test->start_id ) ) ) {
-                        rc = RC(rcVDB, rcBlob, rcValidating, rcBlob, rcCorrupt);
-                        DBGMSG(DBG_VDB, DBG_VDB_COMPARE, ("%s: page map mismatch at row %li\n", self->dad.name, id));
-                    }
-                }
-                
-                for (i = orig->start_id; rc == 0; ) {
-                    uint32_t elem_count;
-                    uint64_t prev_i = i;
-                    
-                    orig_data.u.data.first_elem = (orig->data.bit_offset / orig->data.elem_bits) + PageMapIteratorDataOffset(&oi);
-                    test_data.u.data.first_elem = (test->data.bit_offset / test->data.elem_bits) + PageMapIteratorDataOffset(&ti);
-
-                    for (elem_count = 0; ; ) {
-                        bool done = false;
-                        uint32_t j;
-                        uint32_t k;
-                        
-                        j = PageMapIteratorDataLength(&oi);
-                        k = PageMapIteratorDataLength(&ti);
-                        if (j != k) {
-                            rc = RC(rcVDB, rcBlob, rcValidating, rcBlob, rcCorrupt);
-                            DBGMSG(DBG_VDB, DBG_VDB_COMPARE, ("%s: length mismatch at row %li ( original=%u, test=%u )\n", self->dad.name, i, j, k));
-                            break;
-                        }
-                        elem_count += j;
-                        
-                        j = PageMapIteratorRepeatCount(&oi);
-                        k = PageMapIteratorRepeatCount(&ti);
-                        if (j != k) {
-                            done = true;
-                            if (j > k)
-                                j = k;
-                        }
-                        if (PageMapIteratorAdvance(&ti, j) != PageMapIteratorAdvance(&oi, j)) {
-                            rc = RC(rcVDB, rcBlob, rcValidating, rcBlob, rcCorrupt);
-                            DBGMSG(DBG_VDB, DBG_VDB_COMPARE, ("%s: page map corrupt at row %li\n", self->dad.name, i));
-                            break;
-                        }
-                        i += j;
-			if ( done || (int64_t)i > orig->stop_id || test->pm->random_access || orig->pm->random_access || !PageMapIteratorAdvance( &ti, 0 ) )
-                            break;
-                    }
-                    if (rc)
-                        break;
-                    if ( (int64_t)i > ( orig->stop_id + 1 ) ) {
-                        rc = RC(rcVDB, rcBlob, rcValidating, rcBlob, rcCorrupt);
-                        (void)prev_i; /* shut up warning when not printing debug msg */
-                        DBGMSG(DBG_VDB, DBG_VDB_COMPARE, ("%s: page map has too many rows at row %li\n", self->dad.name, prev_i));
-                        break;
-                    }
-                    
-                    orig_data.u.data.elem_count = test_data.u.data.elem_count = elem_count;
-                    
-                    rc = self->u.cf(self->fself, &orig_data, &test_data);
-                    if (rc) {
-                        rc = RC(rcVDB, rcBlob, rcValidating, rcBlob, rcCorrupt);
-                        DBGMSG(DBG_VDB, DBG_VDB_COMPARE, ("%s: data mismatch at row %li\n", self->dad.name, prev_i));
-                        break;
-                    }
-                    if ((int64_t)i > orig->stop_id )
-                        break;
-                    
-                    /* check to see if the test iterator is at end
-                     * and if so, fetch next blob */
-                    if (!PageMapIteratorAdvance(&ti, 0)) {
-                        VBlob *temp;
-                        
-                        rc = VProductionReadBlob(test_prod, &temp, i, orig->stop_id - i, NULL);
-                        if (rc == 0) {
-                            vblob_release(test, NULL);
-                            test = temp;
-                            test_data.u.data.base = test->data.base;
-                            PageMapNewIterator(test->pm, &ti, 0, -1);
-                            if ( test->start_id < (int64_t)i ) {
-                                if ( !PageMapIteratorAdvance( &ti, (uint32_t)( i - test->start_id ) ) ) {
-                                    rc = RC(rcVDB, rcBlob, rcValidating, rcBlob, rcCorrupt);
-                                    DBGMSG(DBG_VDB, DBG_VDB_COMPARE, ("%s: page map mismatch at row %li\n", self->dad.name, i));
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-            vblob_release(test, NULL);
-        }
-        vblob_release(orig, NULL);
-    }
-    return rc;
-}
-
-typedef struct fetch_param_blob_data fetch_param_blob_data;
-struct fetch_param_blob_data
-{
-    int64_t id;
-    uint32_t cnt;
-    Vector *inputs;
-    VBlob *vblob;
-    rc_t rc;
-    bool no_cache;
-};
-
-static
-bool CC fetch_param_blob ( void *item, void *data )
-{
-    fetch_param_blob_data *pb = data;
-    VBlob *blob;
-    
-    pb -> rc = VProductionReadBlob ( item, & blob, pb -> id , pb -> cnt, NULL);
-    if ( pb -> rc == 0 )
-    {
-        pb -> rc = VectorAppend ( pb -> inputs, NULL, blob );
-        if ( pb -> rc == 0 ) {
-            pb->no_cache |= blob->no_cache;
-            return false;
-        }
-
-        vblob_release ( blob, NULL );
-    }
-
-    return true;
-}
-
-static
-bool CC fetch_first_param_blob ( void *item, void *data )
-{
-    fetch_param_blob_data *pb = data;
-    
-    pb -> rc = VProductionReadBlob ( item, &pb->vblob, pb -> id , pb -> cnt, NULL);
-    if (GetRCState(pb->rc) == rcNotFound)
-        return false;
-    if ( pb -> vblob -> data.elem_count == 0 )
-        return false;
-    return true;
-}
-
-static
-rc_t VFunctionProdSelect ( VFunctionProd *self, VBlob **vblob, int64_t id, uint32_t cnt ) {
-    fetch_param_blob_data pb;
-    
-    pb.id = id;
-    pb.cnt = cnt;
-    pb.rc = 0;
-    pb.vblob = NULL;
-    VectorDoUntil ( & self -> parms, false, fetch_first_param_blob, & pb );
-    * vblob = pb.vblob;
-    return pb.rc;
-}
-
-static rc_t VFunctionProdReadNormal ( VFunctionProd *self, VBlob **vblob, int64_t id ,uint32_t cnt )
-{
-    rc_t rc;
-    Vector inputs;
-    fetch_param_blob_data pb;
-    VBlob *vb=NULL;
-    int64_t	id_run;
-    int64_t     cnt_run;
-
-    /* fill out information for function to use */
-    const VCursor *curs = self -> curs;
-    VXformInfo info;
-
-    if(cnt == 0) cnt = 1;
-
-#if VMGR_PASSED_TO_XFORM
-    info . mgr = curs -> tbl -> mgr;
-#endif
-#if VSCHEMA_PASSED_TO_XFORM
-    info . schema = curs -> schema;
-#endif
-#if VTABLE_PASSED_TO_XFORM
-    info . tbl = curs -> tbl;
-#endif
-#if VPRODUCTION_PASSED_TO_XFORM
-    info . prod = & self -> dad;
-#endif
-    info . fdesc . fd = self -> dad . fd;
-    info . fdesc . desc = self -> dad . desc;
-    *vblob = NULL;
-
-    if (self->dad.sub == prodFuncBuiltInCompare) {
-        rc = VFunctionProdCallCompare(self, vblob, id, cnt);
-#if _DEBUGGING
-        if (rc != 0)
-            rc = VFunctionProdCallCompare1(self, vblob, id, cnt);
-#endif
-        return rc;
-    }
-
-    /* all other functions take some form of blob input */
-    VectorInit ( & inputs, 0, VectorLength ( & self -> parms ) );
-    pb . id = id;
-    pb . cnt = cnt;
-    pb . inputs = & inputs;
-    pb . vblob = NULL;
-    pb . rc = 0;
-    pb.no_cache = 0;
-    if ( VectorDoUntil ( & self -> parms, false, fetch_param_blob, & pb ) )
-        rc = pb . rc;
-    else for( id_run=id, cnt_run=cnt, rc=0; cnt_run > 0 && rc==0;) 
-    {
-        switch ( self -> dad . sub )
-        {
-        case vftLegacyBlob:
-            rc = VFunctionProdCallLegacyBlobFunc ( self, &vb, id_run, & info, & inputs );
-            break;
-        case vftNonDetRow:
-            rc = VFunctionProdCallNDRowFunc ( self, &vb, id_run, & info, & inputs );
-            break;
-        case vftRow:
-        case vftIdDepRow:
-            rc = VFunctionProdCallRowFunc ( self, &vb, id_run, cnt_run, & info, & inputs );
-            break;
-        case vftArray:
-            rc = VFunctionProdCallArrayFunc ( self, &vb, id_run, & info, & inputs );
-            break;
-        case vftFixedRow:
-            rc = VFunctionProdCallPageFunc ( self, &vb, id_run, & info, & inputs );
-            break;
-        case vftBlob:
-            rc = VFunctionProdCallBlobFunc ( self, &vb, id_run, & info, & inputs );
-            break;
-        case vftBlobN:
-            rc = VFunctionProdCallBlobNFunc ( self, &vb, id_run, & info, & inputs );
-            break;
-        case prodFuncByteswap:
-            rc = VFunctionProdCallByteswap ( self, &vb, id_run, & info, & inputs );
-            break;
-        default:
-            rc = RC ( rcVDB, rcFunction, rcReading, rcProduction, rcCorrupt );
-        }
-        if (rc == 0){
-            if (vb == NULL) {
-                rc = RC ( rcVDB, rcFunction, rcReading, rcProduction, rcNull );
-            }
-            else {
-                if (vb -> start_id > id_run || vb -> stop_id < id_run) { /*** shoudn't happen ***/
-                    rc = RC ( rcVDB, rcBlob, rcReading, rcRange, rcInsufficient );
-                }
-                if (*vblob == NULL) {
-                    *vblob=vb;
-                }
-                else {
-                    if (vb -> start_id <= id) {/** new blob is not appendable, but can replace the current one **/
-                        vblob_release(*vblob, NULL);
-                        *vblob = vb;
-                    }
-                    else {
-                        /*** append here **/
-                        rc = VBlobAppend(*vblob, vb);
-                        vblob_release(vb, NULL);
-                    }
-                }
-                /* propagate dirty flag */
-                (*vblob)->no_cache |= pb.no_cache;
-                if( (*vblob) -> stop_id >= id + cnt - 1)
-                    break;
-
-                id_run  = (*vblob) -> stop_id + 1;
-                cnt_run = id + cnt - id_run;
-
-            }
-        }
-    }
-    /* drop input blobs */
-    VectorWhack ( & inputs, vblob_release, NULL );
-    return rc;
-}
-
-rc_t VFunctionProdRead ( VFunctionProd *self, VBlob **vblob, int64_t id , uint32_t cnt )
-{
-    if ( self -> dad . sub == vftSelect )
-        return VFunctionProdSelect ( self, vblob, id , cnt);
-    return VFunctionProdReadNormal(self, vblob, id, cnt);
-}    
-
-typedef struct fetch_param_IdRange_data fetch_param_IdRange_data;
-struct fetch_param_IdRange_data
-{
-    int64_t first;
-    int64_t last;
-    rc_t rc;
-    bool first_time;
-};
-
-static
-bool CC fetch_param_IdRange ( void *item, void *data )
-{
-    fetch_param_IdRange_data *pb = data;
-    int64_t first;
-    int64_t last;
-    rc_t rc;
-    
-    rc = VProductionColumnIdRange(item, &first, &last);
-    if (GetRCState(rc) == rcEmpty && GetRCObject(rc) == rcRange)
-        return false;
-
-    pb->rc = rc;
-    if (rc == 0 )
-    {
-        if (pb->first_time || first < pb->first)
-            pb->first = first;
-        if (pb->first_time || last > pb->last)
-            pb->last = last;
-        pb->first_time = false;
-        return false;
-    }
-    
-    return true;
-}
-
-LIB_EXPORT rc_t CC VFunctionProdColumnIdRange ( const VFunctionProd *self, int64_t *first, int64_t *last )
-{
-    fetch_param_IdRange_data pb;
-
-    pb.first_time = true;
-    pb . rc = 0;
-    pb.first = 1;
-    pb.last = 0;
-    
-    VectorDoUntil ( & self -> parms, false, fetch_param_IdRange, & pb );
-    if (pb.rc == 0) {
-        *first = pb.first;
-        *last = pb.last;
-    }
-    
-    return pb . rc;
-}
-
-typedef struct fetch_param_FixedRowLength_data fetch_param_FixedRowLength_data;
-struct fetch_param_FixedRowLength_data
-{
-    uint32_t length;
-    int64_t row_id;
-    bool first_time;
-};
-
-static
-bool CC fetch_param_FixedRowLength ( void *item, void *data )
-{
-    fetch_param_FixedRowLength_data *pb = data;
-    uint32_t length;
-    
-    if (((const VProduction *)item)->control == false) {
-        length = VProductionFixedRowLength(item, pb->row_id, false);
-
-        if (pb->first_time)
-            pb->length = length;
-
-        pb->first_time = false;
-        
-        if (length == 0 || length != pb->length)
-            return true;
-    }
-    return false;
-}
-
-static
-uint32_t VFunctionProdFixedRowLength ( const VFunctionProd *self, int64_t row_id, bool ignore_self )
-{
-    fetch_param_FixedRowLength_data pb;
-
-    if ( ! ignore_self )
-    {
-        switch ( self -> dad . sub )
-        {
-        case vftRow:
-        case vftNonDetRow:
-        case vftIdDepRow:
-            return 0;
-        }
-    }
-
-    pb.first_time = true;
-    pb.length = 0;
-
-    VectorDoUntil ( & self -> parms, false, fetch_param_FixedRowLength, & pb );
-
-    return pb.length;
-}
-
-
-/*--------------------------------------------------------------------------
- * VScriptProd
- */
-
-rc_t VScriptProdMake ( VScriptProd **prodp, Vector *owned, struct VCursor const *curs,
-    int sub, const char *name, const VFormatdecl *fd,
-    const VTypedesc *desc, uint8_t chain )
-{
-    VScriptProd *prod;
-    rc_t rc = VProductionMake ( ( VProduction** ) prodp, owned, sizeof * prod,
-        prodScript, sub, name, fd, desc, NULL, chain );
-    if ( rc == 0 )
-    {
-        prod = * prodp;
-        prod -> curs = curs;
-        VectorInit ( & prod -> owned, 0, 4 );
-    }
-    return rc;
-}
-
-void VScriptProdDestroy ( VScriptProd *self )
-{
-    VectorWhack ( & self -> owned, VProductionWhack, NULL );
-}
-
-
-/* Read
- */
-rc_t VScriptProdRead ( VScriptProd *self, VBlob **vblob, int64_t id,uint32_t cnt )
-{
-    return VProductionReadBlob ( self -> rtn, vblob, id , cnt, NULL);
-}
-
-static rc_t VScriptProdColumnIdRange ( const VScriptProd *self, int64_t *first, int64_t *last )
-{
-    return VProductionColumnIdRange(self->rtn, first, last);
-}
-
-static uint32_t VScriptProdFixedRowLength ( const VScriptProd *self, int64_t row_id )
-{
-    return VProductionFixedRowLength(self->rtn, row_id, false);
-}
-
-
-/*--------------------------------------------------------------------------
- * VProduction
- */
-
-/* Init
- *  parent initialization function
- *  called from the "Make" functions below
- */
-#if 0
-static
-void VProductionInit ( VProduction *self, int var, int sub, const char *name,
-                       const VFormatdecl *fd, const VTypedesc *desc,
-                       const VCtxId *cid, uint8_t chain )
-{
-    memset ( self, 0, sizeof * self );
-
-    if ( fd != NULL )
-        self -> fd = * fd;
-    if ( desc != NULL )
-        self -> desc = * desc;
-    if ( cid != NULL )
-        self -> cid = * cid;
-
-    self -> var = ( uint8_t ) var;
-    self -> sub = ( uint8_t ) sub;
-    self -> chain = chain;
-}
-#endif
-
-
-void CC VProductionWhack ( void *item, void *owned )
-{
-    VProduction * self = item;
-
-    if ( self != NULL )
-    {
-        if ( owned != NULL)
-        {
-            void *ignore;
-            VectorSwap ( owned, self -> oid, NULL, & ignore );
-            assert ( ( void* ) self == ignore );
-        }
-
-
-#if PROD_CACHE
-        VProductionFlushCacheDeep ( self, "whack" );
-#endif
-        switch ( self -> var )
-        {
-        case prodSimple:
-#if TRACKING_BLOBS
-            fprintf( stderr, "VSimpleProd %p being whacked *** %s\n", self, self->name );
-#endif
-            VSimpleProdDestroy ( ( VSimpleProd* ) self );
-            break;
-
-        case prodFunc:
-#if TRACKING_BLOBS
-            fprintf( stderr, "VFunctionProd %p being whacked *** %s\n", self, self->name );
-#endif
-            VFunctionProdDestroy ( ( VFunctionProd* ) self );
-            break;
-
-        case prodScript:
-#if TRACKING_BLOBS
-            fprintf( stderr, "VScriptProd %p being whacked *** %s\n", self, self->name );
-#endif
-            VScriptProdDestroy ( ( VScriptProd* ) self );
-            break;
-
-        case prodPhysical:
-#if TRACKING_BLOBS
-            fprintf( stderr, "VPhysicalProd %p being whacked *** %s\n", self, self->name );
-#endif
-            VPhysicalProdDestroy ( ( VPhysicalProd* ) self );
-            break;
-
-        case prodColumn:
-#if TRACKING_BLOBS
-            fprintf( stderr, "VColumnProd %p being whacked *** %s\n", self, self->name );
-#endif
-            VColumnProdDestroy ( ( VColumnProd* ) self );
-            break;
-        }
-
-        free ( self );
-    }
-}
-
-/* Cmp
- * Sort
- *  compare item is a VCtxId
- *  sort item is a VProduction
- *  n is always a VProduction
- */
-LIB_EXPORT int CC VProductionCmp ( const void *item, const void *n )
-{
-    const VCtxId *a = item;
-    const VProduction *b = n;
-    return VCtxIdCmp ( a, & b -> cid );
-}
-
-LIB_EXPORT int CC VProductionSort ( const void *item, const void *n )
-{
-    const VProduction *a = item;
-    const VProduction *b = n;
-    return VCtxIdCmp ( & a -> cid, & b -> cid );
-}
-
-
-/* IdRange
- *  obtains intersection of all physical sources
- *
- *  "first" [ IN/OUT ] and "last" [ IN/OUT ] - range to intersect
- */
-rc_t VProductionColumnIdRange ( const VProduction *self,
-    int64_t *first, int64_t *last )
-{
-    if ( self <= FAILED_PRODUCTION )
-        return 0;
-
-    switch ( self -> var )
-    {
-    case prodSimple:
-        return VProductionColumnIdRange ( ( ( const VSimpleProd* ) self ) -> in, first, last );
-    case prodFunc:
-        return VFunctionProdColumnIdRange((const VFunctionProd *)self, first, last);
-    case prodScript:
-        return VScriptProdColumnIdRange((const VScriptProd *)self, first, last);
-    case prodPhysical:
-        return VPhysicalProdColumnIdRange((const VPhysicalProd *)self, first, last);
-    case prodColumn:
-        return RC ( rcVDB, rcColumn, rcAccessing, rcRange, rcEmpty );
-    }
-    
-    return RC ( rcVDB, rcColumn, rcAccessing, rcType, rcUnknown );
-}
-
-rc_t VProductionPageIdRange ( VProduction *self,
-    int64_t id, int64_t *first, int64_t *last )
-{
-    VBlob *blob;
-    rc_t rc = VProductionReadBlob ( self, & blob, id , 1, NULL);
-    if ( rc == 0 )
-    {
-        * first = blob -> start_id;
-        * last = blob -> stop_id;
-
-        vblob_release ( blob, NULL );
-    }
-    return rc;
-}
-
-/* RowLength
- *  get row length for a particular row
- */
-uint32_t VProductionRowLength ( const VProduction *self, int64_t row_id )
-{
-    uint32_t row_len;
-
-    VBlob *blob;
-    rc_t rc = VProductionReadBlob ( self, & blob, row_id, 1, NULL );
-    if ( rc != 0 )
-        return 0;
-    
-    row_len = PageMapGetIdxRowInfo ( blob -> pm, (uint32_t)( row_id - blob -> start_id) , NULL );
-
-    vblob_release ( blob, NULL );
-    
-    return row_len;
-}
-
-/* FixedRowLength
- *  get fixed row length for entire column
- *  returns 0 if not fixed
- */
-uint32_t VProductionFixedRowLength ( const VProduction *self, int64_t row_id,bool ignore_self )
-{
-    switch ( self -> var )
-    {
-    case prodSimple:
-        return VProductionFixedRowLength ( ( ( const VSimpleProd* ) self ) -> in, row_id, ignore_self );
-    case prodFunc:
-        return VFunctionProdFixedRowLength((const VFunctionProd *)self, row_id, ignore_self);
-    case prodScript:
-        return VScriptProdFixedRowLength((const VScriptProd *)self, row_id);
-    case prodPhysical:
-        return VPhysicalProdFixedRowLength((const VPhysicalProd *)self, row_id);
-    }
-
-    return RC ( rcVDB, rcColumn, rcAccessing, rcType, rcUnknown );
-}
-
-
-/* ReadBlob
- */
-rc_t VProductionReadBlob ( const VProduction *cself, VBlob **vblob, int64_t id, uint32_t cnt, VBlobMRUCacheCursorContext *cctx )
-{
-    rc_t rc;
-    VProduction *self = ( VProduction* ) cself;
-
-#if PROD_CACHE
-    int i;
-    VBlob *blob;
-#endif
-
-    * vblob = NULL;
-
-    /* should not be possible, but safety is cheap */
-    if ( self == NULL )
-        return RC ( rcVDB, rcProduction, rcReading, rcSelf, rcNull );
-
-    /*** Cursor-level column blobs may be 1-to-1 with production blobs ***/
-    if(cctx != NULL && self->cctx.cache == NULL ){ /*** we are connected to read cursor **/
-	self->cctx = *cctx; /*** remember it ***/
-	/** No need to do anything else here - we are on "direct line" to the column ***/
-    } else if(self->cctx.cache != NULL){
-	/** somewhere else this production is connected to a cursor **/
-	/** lets try to get answers from the cursor **/
-	blob=(VBlob*) VBlobMRUCacheFind(self->cctx.cache,self->cctx.col_idx,id);
-	if(blob){
-		rc = VBlobAddRef ( blob );
-                if ( rc != 0 ) return rc;
-		*vblob=blob;
-		return 0;
-	}
-    }
-
-#if PROD_CACHE
-    /* check cache */
-    for ( i = 0; i < self -> cache_cnt; ++ i )
-    {
-        blob = self -> cache [ i ];
-        if ( self -> cache [ i ] != NULL )
-        {
-            /* check id range */
-            if (
-#if USE_EUGENE
-                /* NB - this is an approach where we always cache
-                   a blob after a read in order to keep it alive,
-                   but never allow a cache hit on retrieval */
-                ! blob -> no_cache &&
-#endif
-                id >= blob -> start_id &&
-                id <= blob -> stop_id )
-            {
-                rc = VBlobAddRef ( blob );
-                if ( rc != 0 )
-                    return rc;
-#if TRACKING_BLOBS
-                fprintf( stderr, "%p->%p(%d) new reference to cached blob *** %s\n"
-                         , self
-                         , blob
-                         , atomic32_read ( & blob -> refcount )
-                         , self->name
-                    );
-#endif
-                /* return new reference */
-                * vblob = blob;
-#if PROD_CACHE > 1
-                /* MRU cache */
-                if ( i > 0 )
-                {
-		    memmove(self -> cache +1,self -> cache,i*sizeof(*self->cache));
-                    self -> cache [ 0 ] = blob;
-		    if( i > self->cache_cnt_max / 2 -1 ){ /** this is how wash area is defined **/
-			self->cache_wash_access_cnt++; /** we are accessing  wash area of the cache **/
-		    }
-                }
-#endif
-                return 0;
-            }
-        }
-    }
-#endif /* PROD_CACHE */
-
-    /* dispatch */
-    switch ( self -> var )
-    {
-    case prodSimple:
-        rc = VSimpleProdRead ( ( VSimpleProd* ) self, vblob, id, cnt,cctx );
-        break;
-    case prodFunc:
-        rc = VFunctionProdRead ( ( VFunctionProd* ) self, vblob, id , cnt);
-#if _DEBUGGING && PROD_NAME
-        if ( rc != 0 )
-            DBGMSG ( DBG_VDB, DBG_VDB_FUNCTION, ( "%s: %R\n", self -> name, rc ) );
-#endif
-        break;
-    case prodScript:
-        rc = VScriptProdRead ( ( VScriptProd* ) self, vblob, id , cnt);
-        break;
-    case prodPhysical:
-        rc = VPhysicalProdRead ( ( VPhysicalProd* ) self, vblob, id, cnt );
-        break;
-    case prodColumn:
-        rc = VColumnProdRead ( ( VColumnProd* ) self, vblob, id );
-        break;
-    default:
-        return RC ( rcVDB, rcProduction, rcReading, rcType, rcUnknown );
-    }
-
-#if ! PROD_CACHE
-    return rc;
-#else
-    blob = * vblob;
-
-    if ( rc != 0 || * vblob == NULL )
-        return rc;
-
-#if ! USE_EUGENE
-         /* NB - there is another caching mechanism on VColumn
-            if a blob does not want to be cached, it is rejected here */
-    if ( ! blob -> no_cache )
-        return 0;
-#endif
-    if(cctx == NULL && self->cctx.cache != NULL && blob->stop_id > blob->start_id + 4){/** we will benefit from caching here **/
-	VBlobMRUCacheSave(self->cctx.cache,self->cctx.col_idx,blob);
-	return 0;
-    }
-
-    if(blob->pm == NULL) return 0;
-
-
-    /* cache output */
-    rc = VBlobAddRef ( blob );
-    if ( rc == 0 )
-    {
-        VBlobCheckIntegrity ( blob );
-        if(self -> cache_cnt_max == 0){ /*** set the cache size now ***/
-		self -> cache_cnt_max = PROD_CACHE;
-#if 0
-	} else if(   self->var==prodScript
-		  && self -> cache_cnt >= self -> cache_cnt_max
-		  && self -> cache_cnt_max/PROD_CACHE  < PROD_CACHE_MAX_EXTENTS
-		  && self -> cache_wash_access_cnt > PROD_CACHE_WASH_ACCESS_THRESHOLD){  /** try to extend the cache ***/
-			 self -> cache_cnt_max += PROD_CACHE;
-                         self -> cache_wash_access_cnt = 0;
-#endif
-	}
-	if(self -> cache_cnt < self -> cache_cnt_max){
-		if(self -> cache_cnt > 0 ){
-			memmove(self -> cache + 1, self -> cache , self -> cache_cnt * sizeof(*self -> cache));
-		}
-		self -> cache_cnt ++;
-	} else {
-		/* release whatever was there previously */
-        	/* drop LRU */
-		vblob_release ( self -> cache [ self -> cache_cnt - 1 ], NULL );
-		memmove(self -> cache + 1, self -> cache , (self -> cache_cnt -1) * sizeof(*self -> cache));
-        }
-        /* insert a head of list */
-        self -> cache [ 0 ] = blob;
-                
-#if TRACKING_BLOBS
-        fprintf( stderr, "%p->%p(%d) cached *** %s\n"
-                 , self
-                 , blob
-                 , atomic32_read ( & blob -> refcount )
-                 , self -> name
-            );
-#endif
-    }
-
-#if USE_EUGENE
-    /* this code requires the blob to be cached on the production */
-    return rc;
-#else
-    /* we don't care if the blob was not cached */
-    return 0;
-#endif
-
-#endif /* PROD_CACHE */
-}
-
-/* IsStatic
- *  trace all the way to a physical production
- */
-rc_t VProductionIsStatic ( const VProduction *self, bool *is_static )
-{
-    rc_t rc;
-
-    assert ( is_static != NULL );
-    * is_static = false;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcColumn, rcAccessing, rcSelf, rcNull );
-    else
-    {
-        for ( rc = 0; self != NULL; )
-        {
-            switch ( self -> var )
-            {
-            case prodSimple:
-                self = ( ( const VSimpleProd*) self ) -> in;
-                break;
-            case prodFunc:
-            case prodScript:
-            {
-                const VFunctionProd *fp = ( const VFunctionProd* ) self;
-                uint32_t start = VectorStart ( & fp -> parms );
-                uint32_t end = VectorLength ( & fp -> parms );
-                for ( end += start; start < end; ++ start )
-                {
-                    self = ( const VProduction* ) VectorGet ( & fp -> parms, start );
-                    if ( self != NULL )
-                    {
-                        rc = VProductionIsStatic ( self, is_static );
-                        if ( rc != 0 || * is_static )
-                            break;
-                    }
-                }
-                return rc;
-            }
-            case prodPhysical:
-                return VPhysicalIsStatic ( ( ( const VPhysicalProd* ) self ) -> phys, is_static );
-            case prodColumn:
-                self = NULL;
-                break;
-            default:
-                return RC ( rcVDB, rcProduction, rcReading, rcType, rcUnknown );
-            }
-        }
-    }
-
-    return rc;
-}
diff --git a/libs/vdb/prod-expr.c b/libs/vdb/prod-expr.c
deleted file mode 100644
index 6d84d4e..0000000
--- a/libs/vdb/prod-expr.c
+++ /dev/null
@@ -1,887 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#define TRACK_REFERENCES 0
-
-#define KONST const
-#include "schema-priv.h"
-#include "schema-expr.h"
-#include "schema-parse.h"
-#include "cursor-priv.h"
-#include "column-priv.h"
-#include "prod-priv.h"
-#include "prod-expr.h"
-#include "phys-priv.h"
-#undef KONST
-
-#include <vdb/schema.h>
-#include <vdb/cursor.h>
-#include <vdb/xform.h>
-#include <klib/symbol.h>
-#include <klib/debug.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * VProdResolve
- */
-
-/* CastExpr
- *  inserts an explicit cast operation
- *
- *  in "C" style languages ( okay, ALGOL style ), a cast expression is
- *  used as a means of coercing the rh expression type to a fixed type,
- *  which is then assigned to the lh side with normal typecasting rules.
- *  specifically, performs an intermediate assignment allowing truncation
- *  to reshape and potentially reformat the rh value ( e.g. float to char ).
- *
- *  in "C++" there were new cast operators introduced to indicate more nuance:
- *    static_cast      - permits up and down-casts with compiler check
- *    const_cast       - modifies cv qualifiers [ not applicable to VDB ]
- *    dynamic_cast     - permits up and down-casts with runtime check
- *    reinterpret_cast - permits casts between unrelated classes with
- *                       compatible binary forms ( a la "C" style ).
- *
- *  in "VDB", the compiler preserves lh and rh type information until
- *  productions are resolved. assignments always involve implicit casts
- *  that permit casting from sub to super-type. our explicit cast expression
- *  performs something analogous to the C++ "static_cast" in that it allows
- *  direct up and down casts, as well as sibling and cousin casts.
- *
- *  specifically, LH = ( T ) RH when T is a sub-type of LH and:
- *    a) RH is a sub-type of T [ implicit rule ]
- *    b) T is a sub-type of RH [ downcast ]
- *    c) T and RH share a common ancestor
- *  in all cases, LH, T and RH must all have identical element sizes
- *
- *  implicit typecasting rules allow LH or RH to be a typeset. the types
- *  are initially refined to the intersection between LH and RH
- *    a) TYPE    x TYPE
- *    b) TYPESET x TYPE
- *    c) TYPE    x TYPESET
- *    d) TYPESET x TYPESET
- *  in the latter case, the intersection may produce more than one possible
- *  result, which would incur an error when evaluating the expression. a
- *  cast operator will remove the ambiguity.
- *
- *  the rh expression may involve a column name, with type overloading. this
- *  creates the same effect as a TYPESET. a cast operator can clarify an ambigous
- *  assignment, and in the case of downcasts, make it possible.
- *
- * NB
- *  to perform a C++ style reinterpret_cast, use the "cast" function
- */
-static
-rc_t VProdResolveCastExpr ( const VProdResolve *self, VProduction **out, const SBinExpr *expr )
-{
-    /* extract cast type */
-    VFormatdecl cast;
-    rc_t rc = STypeExprResolveAsFormatdecl
-        ( ( const STypeExpr* ) expr -> left, self -> schema, & cast, self -> cx_bind );
-    if ( rc == 0 )
-    {
-        /* resolve rh expression */
-        VTypedesc desc;
-        VFormatdecl fd = cast;
-        rc = VProdResolveExpr ( self, out, & desc,
-            & fd, expr -> right, true );
-        if ( rc != 0 || * out == NULL )
-            return rc;
-
-        /* casting mode allowed returned production to be:
-           a) identical type
-           b) sub-type
-           c) super-type
-           d) have common parent
-
-           in all cases, the sizeof rh production element
-           matches "cast" size */
-        rc = VSimpleProdMake ( out, self -> owned, self -> curs, prodSimpleCast,
-            "cast", & cast, & desc, NULL, * out, self -> chain );
-    }
-
-    return rc;
-}
-
-/* ParamExpr
- *  resolve a simple parameter by name
- */
-LIB_EXPORT rc_t CC VProdResolveParamExpr ( const VProdResolve *self, VProduction **out, const KSymbol *sym )
-{
-    const SProduction *sprod = sym -> u . obj;
-    VProduction *vprod = VCursorCacheGet ( self -> cache, & sprod -> cid );
-    if ( vprod != NULL )
-    {
-        * out = vprod;
-        return 0;
-    }
-
-    PLOGMSG ( klogWarn, ( klogWarn, "unknown parameter '$(param)' used in expression"
-                          , "param=%.*s"
-                          , ( int ) sprod -> name -> name . size
-                          , sprod -> name -> name . addr ));
-    return 0;
-}
-
-
-/* ProdExpr
- *  resolve a simple production by name
- *  create/return a VSimpleProd object
- */
-rc_t VProdResolveSProduction ( const VProdResolve *self, VProduction **out, const SProduction *sprod )
-{
-    rc_t rc;
-    VFormatdecl fd;
-
-    /* check cache */
-    VProduction *vprod = VCursorCacheGet ( self -> cache, & sprod -> cid );
-    if ( vprod != NULL )
-    {
-        /* return valid or failed production */
-        * out = vprod;
-        return 0;
-    }
-
-    /* pre-fail */
-    rc = VCursorCacheSet ( self -> cache, & sprod -> cid, FAILED_PRODUCTION );
-    if ( rc == 0 )
-    {
-        /* resolve production type */
-        if ( sprod -> trigger )
-            memset ( & fd, 0, sizeof fd );
-        else
-        {
-            rc = STypeExprResolveAsFormatdecl
-                ( ( const STypeExpr* ) sprod -> fd, self -> schema, & fd, self -> cx_bind );
-        }
-    }
-    if ( rc == 0 )
-    {
-        /* resolve assignment expression */
-        VTypedesc desc;
-        rc = VProdResolveExpr ( self, out, & desc,
-            & fd, sprod -> expr, false );
-        if ( rc == 0 && * out != NULL )
-        {
-            const char *name = sprod -> name -> name . addr;
-            assert ( name [ sprod -> name -> name . size ] == 0 );
-            rc = VSimpleProdMake ( out, self -> owned, self -> curs, prodSimpleCast, 
-                name, & fd, & desc, & sprod -> cid, * out, self -> chain );
-            if ( rc == 0 )
-            {
-                void *ignore;
-                rc = VCursorCacheSwap ( self -> cache, & sprod -> cid, * out, & ignore );
-            }
-        }
-    }
-
-    return rc;
-}
-
-static
-rc_t VProdResolveProdExpr ( const VProdResolve *self, VProduction **out, const KSymbol *sym )
-{
-    const SProduction *sprod = sym -> u . obj;
-    if ( ! sprod -> trigger )
-        return VProdResolveSProduction ( self, out, sprod );
-
-    PLOGMSG ( klogWarn, ( klogWarn, "trigger production '$(trig)' used in expression"
-                          , "trig=%.*s"
-                          , ( int ) sym -> name . size
-                          , sym -> name . addr ));
-
-    return 0;
-}
-
-
-/* ColumnExpr
- *  the trick about resolving a column reference is in its type
- */
-typedef struct SColumnBestFit SColumnBestFit;
-struct SColumnBestFit
-{
-    BSTNode n;
-    const SColumn *scol;
-    VTypedecl td;
-    uint32_t distance;
-};
-
-static
-rc_t VProdResolveBestColumn ( const VProdResolve *self,
-    VProduction **out, const BSTree *ordered, bool alt )
-{
-    rc_t rc;
-
-    /* walk all candidtes */
-    const SColumnBestFit *n = ( const SColumnBestFit* ) BSTreeFirst ( ordered );
-    for ( rc = 0; n != NULL; n = ( const SColumnBestFit* ) BSTNodeNext ( & n -> n ) )
-    {
-        /* look for open column */
-        const SColumn *scol = n -> scol;
-
-        /* resolve the column as appropriate */
-        rc = VProdResolveColumn ( self, out, scol, alt );
-        if ( rc != 0 || * out != NULL )
-            break;
-    }
-
-    return rc;
-}
-
-static
-int CC order_column ( const BSTNode *item, const BSTNode *n )
-{
-    const SColumnBestFit *a = ( const SColumnBestFit* ) item;
-    const SColumnBestFit *b = ( const SColumnBestFit* ) n;
-    if ( a -> distance < b -> distance )
-        return -1;
-    if ( a -> distance > b -> distance )
-        return 1;
-    return VCtxIdCmp ( & a -> scol -> cid, & b -> scol -> cid );
-}
-
-static
-rc_t VProdResolveColExpr ( const VProdResolve *self, VProduction **out,
-    VFormatdecl *fd, const SSymExpr *x, bool casting )
-{
-    rc_t rc;
-    const SNameOverload *sname;
-    const KSymbol *sym = x -> _sym;
-
-    BSTree ordered;
-    uint32_t i, count;
-    SColumnBestFit buff [ 16 ], * nodes = buff;
-
-    /* fail if "fd" has a format */
-    if ( fd -> fmt != 0 )
-    {
-        PLOGMSG ( klogWarn, ( klogWarn, "illegal cast of column '$(name)'"
-                   , "name=%.*s"
-                   , ( int ) sym -> name . size
-                   , sym -> name . addr ));
-        return 0;
-    }
-
-    /* allocate nodes for indexing columns */
-    sname = sym -> u . obj;
-    count = VectorLength ( & sname -> items );
-    if ( count > sizeof buff / sizeof buff [ 0 ] )
-    {
-        nodes = malloc ( sizeof * nodes * count );
-        if ( nodes == NULL )
-            return RC ( rcVDB, rcProduction, rcResolving, rcMemory, rcExhausted );
-    }
-
-    /* insert columns into ordered tree */
-    BSTreeInit ( & ordered );
-    for ( i = VectorStart ( & sname -> items ), count += i; i < count; ++ i )
-    {
-        /* get SColumn */
-        nodes [ i ] . scol = ( const void* ) VectorGet ( & sname -> items, i );
-
-        /* perform type cast and measure distance */
-        if ( casting ?
-             VTypedeclCommonAncestor ( & nodes [ i ] . scol -> td, self -> schema,
-                 & fd -> td, & nodes [ i ] . td, & nodes [ i ] . distance ) :
-             VTypedeclToTypedecl ( & nodes [ i ] . scol -> td, self -> schema,
-                 & fd -> td, & nodes [ i ] . td, & nodes [ i ] . distance ) )
-        {
-            BSTreeInsert ( & ordered, & nodes [ i ] . n, order_column );
-        }
-    }
-
-    /* try to resolve each in order */
-    rc = VProdResolveBestColumn ( self, out, & ordered, x -> alt );
-
-    if ( nodes != buff )
-        free ( nodes );
-
-    return rc;
-}
-
-
-/* PhysExpr
- */
-rc_t VProdResolveSPhysMember ( const VProdResolve *self,
-    VProduction **out, const SPhysMember *smbr )
-{
-    rc_t rc;
-    VCursor *curs;
-    VPhysical *phys;
-
-    curs = self -> curs;
-    phys = VCursorCacheGet ( & curs -> phys, & smbr -> cid );
-    if ( phys != NULL )
-    {
-        /* this guy should be readable, but it is not guaranteed */
-        if ( phys != FAILED_PHYSICAL )
-            * out = phys -> out;
-        return 0;
-    }
-
-    /* pre-fail */
-    rc = VCursorCacheSet ( & curs -> phys, & smbr -> cid, FAILED_PHYSICAL );
-    if ( rc == 0 )
-    {
-        /* create physical object */
-        rc = VPhysicalMake ( & phys, curs, smbr );
-        if ( rc == 0 )
-        {
-            /* build physical */
-            rc = VProdResolvePhysical ( self, phys );
-            if ( rc == 0 && phys -> out > FAILED_PRODUCTION && phys -> b2p > FAILED_PRODUCTION )
-            {
-                /* set success */
-                void *ignore;
-                rc = VCursorCacheSwap ( & curs -> phys, & smbr -> cid, phys, & ignore );
-                if ( rc == 0 )
-                {
-                    * out = phys -> out;
-                    return 0;
-                }
-            }
-            if ( GetRCState ( rc ) == rcUndefined )
-                rc = 0;
-
-            VPhysicalWhack ( phys, NULL );
-        }
-    }
-
-    return rc;
-}
-
-static
-rc_t VProdResolvePhysExpr ( const VProdResolve *self,
-    VProduction **out, const KSymbol *sym )
-{
-    if ( self -> chain == chainEncoding )
-    {
-        assert ( self -> curs -> read_only == false );
-        PLOGMSG ( klogWarn, ( klogWarn, "illegal access of physical column '$(name)'"
-                   , "name=%.*s"
-                   , ( int ) sym -> name . size
-                   , sym -> name . addr ));
-        return 0;
-    }
-
-    return VProdResolveSPhysMember ( self, out, sym -> u . obj );
-}
-
-
-/* FwdExpr
- *  handle a forwarded symbol in expression
- *  if the symbol is "virtual", check for its override
- *  map actual symbol type to expression handler
- */
-static
-rc_t VProdResolveFwdExpr ( const VProdResolve *self, VProduction **out,
-    VFormatdecl *fd, const SSymExpr *x, bool casting )
-{
-    /* virtual names that appear in parent table
-       expressions may be overridden in children */
-    const KSymbol *sym = x -> _sym;
-    if ( sym -> type == eVirtual )
-    {
-        /* most derived table class */
-        const STable *stbl = self -> stbl;
-        const KSymbol *sym2 = sym;
-        
-        sym = STableFindOverride ( stbl, ( const VCtxId* ) & sym -> u . fwd );
-        if ( sym == NULL )
-        {
-            PLOGMSG ( klogWarn, ( klogWarn, "virtual reference '$(fwd)' not found in overrides table"
-                       , "fwd=%.*s"
-                       , ( int ) sym2 -> name . size
-                       , sym2 -> name . addr ));
-            return 0;
-        }
-    }
-
-    /* test symbol type */
-    switch ( sym -> type )
-    {
-    case eProduction:
-        return VProdResolveProdExpr ( self, out, sym );
-    case ePhysMember:
-        return VProdResolvePhysExpr ( self, out, sym );
-    case eColumn:
-        return VProdResolveColExpr ( self, out, fd, x, casting );
-    }
-
-    VDB_DEBUG (("%s: unresolved forward reference '%S'",
-                 __func__, &sym->name));
-
-    return 0;
-}
-
-/* ResolveExpr
- *  resolves expression and returns resulting production object
- *
- *  "out" [ IN/OUT, INITIALLY NULL ] - return parameter for production.
- *  assmed to be preset to NULL on input.
- *  invalid on output with non-zero return code
- *  non-NULL on successful resolution with zero return code
- *
- *  "fd" [ IN/OUT ] - resultant type of assignment expression
- *  on input gives acceptance criteria, i.e. a fmtdecl, typeset or wildcard
- *  invalid on output with non-zero return code or NULL "out"
- *  otherwise, gives actual assigned type on output
- *
- *  "casting" [ IN ] - true if performing explicit type casting
- *  see VProdResolveCastExpr for rules
- *
- *  "desc" [ OUT, NULL OKAY ] - resultant type description of "out"
- *  invalid on non-zero return or NULL "out"
- *  contains description of fd->td on success
- *
- *  "cache" [ IN ] - modifiable vector of VProductions by id within
- *  a given scope: table or script function.
- *
- *  "param" [ IN, NULL OKAY ] - modifiable vector of VProduction params
- *  by id - only valid within script function
- *
- *  "expr" [ IN ] - expression to be evaluated
- *
- *  returns non-zero if a non-recoverable error occurs, 0 otherwise.
- *  resolution is only successful on zero return code and non-NULL out.
- */
-#if _DEBUGGING
-#include "schema-dump.h"
-
-static size_t xsz;
-static char xbuffer [ 4096 ];
-
-static
-rc_t CC VProdResolveCapture ( void *data, const void *buffer, size_t size )
-{
-    if ( xsz + size >= sizeof xbuffer )
-    {
-        LOGERR (klogFatal, -1, "( xsz + size >= sizeof xbuffer )");
-        return -1;
-    }
-    memcpy ( & xbuffer [ xsz ], buffer, size );
-    xsz += size;
-    return 0;
-}
-
-static
-const char *VProdResolvePrintExpr ( const VProdResolve *self, const SExpression *expr )
-{
-    SDumper dumper;
-    SDumperInit ( & dumper, self -> schema, sdmPrint, VProdResolveCapture, NULL );
-
-    xsz = 0;
-    SDumperPrint ( & dumper, "%E", expr );
-    SDumperWhack ( & dumper );
-
-    xbuffer [ xsz ] = 0;
-    return xbuffer;
-}
-
-static const char ispaces [] = "                                                                "
-                               "                                                                ";
-static int indent_level = 0;
-#endif
-
-rc_t VProdResolveExpr ( const VProdResolve *self,
-    VProduction **out, VTypedesc *desc, VFormatdecl *fd,
-    const SExpression *expr, bool casting )
-{
-    rc_t rc;
-    VProduction *prod;
-
-    if ( expr == NULL )
-    {
-        /* report NULL expression, but don't die */
-        PLOGMSG ( klogWarn, ( klogWarn, "NULL expression in '$(tbl)' table schema"
-                   , "tbl=%.*s"
-                   , ( int ) self -> stbl -> name -> name . size
-                   , self -> stbl -> name -> name . addr ));
-        return 0;
-    }
-
-    prod = NULL;
-    *out = NULL;
-
-#if _DEBUGGING
-    ++ indent_level;
-    VDB_DEBUG (( "%*cresolving expression '%s'\n", indent_level, ' ',
-                 VProdResolvePrintExpr ( self, expr ) ));
-#endif
-
-    switch ( expr -> var )
-    {
-    case eParamExpr:
-        /* a script function is making reference to a parameter */
-        rc = VProdResolveParamExpr ( self, & prod, ( ( const SSymExpr* ) expr ) -> _sym );
-    assert (rc != -1);
-        break;
-
-    case eProdExpr:
-        /* return a simple production */
-        rc = VProdResolveProdExpr ( self, & prod, ( ( const SSymExpr* ) expr ) -> _sym );
-    assert (rc != -1);
-        break;
-
-    case eFwdExpr:
-        /* handle an implicit or overridden reference */
-        rc = VProdResolveFwdExpr ( self, & prod, fd, ( const SSymExpr* ) expr, casting );
-    assert (rc != -1);
-        break;
-
-    case eColExpr:
-        /* return a column production */
-        rc = VProdResolveColExpr ( self, & prod, fd, ( const SSymExpr* ) expr, casting );
-    assert (rc != -1);
-        break;
-
-    case ePhysExpr:
-        /* return a physical production */
-        rc = VProdResolvePhysExpr ( self, & prod, ( ( const SSymExpr* ) expr ) -> _sym );
-    assert (rc != -1);
-        break;
-
-    case eScriptExpr:
-        /* create a script function */
-        rc = VProdResolveScriptExpr ( self, & prod, fd, ( const SFuncExpr* ) expr );
-    assert (rc != -1);
-        break;
-
-    case eFuncExpr:
-        /* create an external function */
-        rc = VProdResolveFuncExpr ( self, & prod, fd, ( const SFuncExpr* ) expr );
-    assert (rc != -1);
-        break;
-
-    case eCastExpr:
-        /* perform an explicit cast */
-        rc = VProdResolveCastExpr ( self, & prod, ( const SBinExpr* ) expr );
-    assert (rc != -1);
-        break;
-        
-    case eCondExpr:
-        /* run left and right expressions in order until exit condition */
-        rc = VProdResolveExpr ( self, out, desc, fd, ( ( const SBinExpr* ) expr ) -> left, casting );
-    assert (rc != -1);
-        if ( ( rc == 0 && * out == NULL ) || self -> discover_writable_columns )
-        {
-            rc = VProdResolveExpr ( self, out, desc, fd, ( ( const SBinExpr* ) expr ) -> right, casting );
-    assert (rc != -1);
-        }
-#if _DEBUGGING
-        -- indent_level;
-#endif
-        return rc;
-
-    default:
-        /* report bad expression, but don't die */
-        PLOGMSG ( klogWarn, ( klogWarn, "unrecognized expression in '$(tbl)' table schema"
-                   , "tbl=%.*s"
-                   , ( int ) self -> stbl -> name -> name . size
-                   , self -> stbl -> name -> name . addr ));
-#if _DEBUGGING
-        -- indent_level;
-#endif
-        return 0;
-    }
-
-    /* guard against returns of NULL or FAILED_PRODUCTION */
-    if ( rc == 0 && prod > FAILED_PRODUCTION )
-    {
-        VDB_DEBUG ( ("%*cresolved expression  '%s'\n", indent_level, ' ', VProdResolvePrintExpr ( self, expr ) ) );
-
-        /* returned production must be on requested chain */
-        if ( ( prod -> chain & self -> chain ) == 0 )
-        {
-            rc = RC ( rcVDB, rcProduction, rcResolving, rcSchema, rcInconsistent );
-            VDB_DEBUG ( ( "%*cPRODUCTION RESOLVED ON WRONG FORK: %R\n", indent_level, ' ', rc ) );
-        }
-        else
-        {
-            /* fix uncommitted production chain */
-            if ( prod -> chain == chainUncommitted )
-                prod -> chain = self -> chain;
-
-            /* test for type compatibility - modifies "fd" */
-            if ( casting ?
-                 VFormatdeclCommonAncestor ( & prod -> fd, self -> schema, fd, fd, NULL ) :
-                 VFormatdeclToFormatdecl ( & prod -> fd, self -> schema, fd, fd, NULL ) )
-            {
-                /* if no type description is requested, we're done */
-                if ( desc == NULL )
-                    * out = prod;
-                else
-                {
-                    /* otherwise, create a type description */
-                    rc = VSchemaDescribeTypedecl ( self -> schema, desc, & fd -> td );
-    assert (rc != -1);
-                    if ( rc != 0 )
-                        VDB_DEBUG ( ( "%*cREQUESTED TYPE CANNOT BE DESCRIBED: %R\n", indent_level, ' ', rc ) );
-                    else
-                        * out = prod;
-                }
-            }
-            else
-            {
-#if _DEBUGGING
-                char from [ 128 ] = "", to [ 128 ] = "";
-                VTypedeclToText ( & prod -> fd . td, self -> schema, from, sizeof from );
-                VTypedeclToText ( & fd -> td, self -> schema, to, sizeof to );
-                VDB_DEBUG ( ( "%*cexpression '%s' cannot be %s from '%s' to '%s'\n"
-                              , indent_level, ' '
-                              , VProdResolvePrintExpr ( self, expr )
-                              , casting ? "cast" : "typed"
-                              , from
-                              , to
-                             )
-                    );
-#endif
-            }
-        }
-    }
-    else if ( rc != 0 )
-    {
-        VDB_DEBUG ( ( "failed to resolve expression '%s' prod %p %R\n", VProdResolvePrintExpr ( self, expr ), prod, rc ) );
-    }
-    else if ( prod == NULL )
-    {
-        VDB_DEBUG ( ( "expression '%s' was not resolved\n", VProdResolvePrintExpr ( self, expr ) ) );
-    }
-    else
-    {
-        VDB_DEBUG ( ( "expression '%s' returned FAILED_PRODUCTION\n", VProdResolvePrintExpr ( self, expr ) ) );
-    }
-
-#if _DEBUGGING
-    -- indent_level;
-#endif
-
-    return rc;
-}
-
-
-/* ResolveColumn
- *  resolves a column from read/validate expression
- */
-rc_t VProdResolveColumnRead ( const VProdResolve *self,
-    VProduction **out, const SColumn *scol )
-{
-    rc_t rc;
-    VFormatdecl fd;
-    const char *name;
-    VCursor *curs;
-    VColumn *vcol;
-
-    VDB_DEBUG ( ( "resolving column '%N' read expression.\n", scol -> name ) );
-
-    /* potential error if self is NULL */
-    curs = self -> curs;
-    if ( out == NULL )
-    {
-        rc =  RC(rcVDB, rcProduction, rcResolving, rcParam, rcNull);
-        VDB_DEBUG ( ( "result NULL for column '%N'; no output can be produced by '%s' rc %R\n",
-                      scol -> name, __func__, rc ) );
-        return rc;
-    }
-    
-    /* fetch the column */
-    vcol = VCursorCacheGet ( & curs -> col, & scol -> cid );
-    if ( vcol == NULL )
-    {
-        VDB_DEBUG ( ( "failed to fetch NULL for column '%N'; no output was produced by '%s'\n",
-                      scol -> name, __func__ ) );
-        return 0;
-    }
-
-    /* if the read production is in place, return it */
-    if ( vcol -> in != NULL )
-    {
-        if ( vcol -> in != FAILED_PRODUCTION )
-            * out = vcol -> in;
-        return 0;
-    }
-
-    /* pre-fail */
-    vcol -> in = FAILED_PRODUCTION;
-
-    /* production resolution works with fmtdecl */
-    fd . td = scol -> td;
-    fd . fmt = 0;
-
-    /* resolve the expression */
-    rc = VProdResolveExpr ( self, out, & vcol -> desc, & fd, scol -> read, false );
-    assert (rc != -1);
-
-    if ( rc != 0 || *out == NULL )
-        return rc;
-
-    /* repair incomplete column declarations */
-    if ( scol -> td . type_id == 0 )
-    {
-        if ( fd . td . type_id == 0 )
-        {
-            rc = RC ( rcVDB, rcColumn, rcResolving, rcType, rcUndefined );
-            VDB_DEBUG (("failed to repair incomplete declaration for column '%N' rc %R\n",
-                        scol -> name, rc));
-            return rc;
-        }
-        ( ( SColumn* ) scol ) -> td = fd . td;
-    }
-
-    /* create a simple prod to manage fd and desc */
-    name = scol -> name -> name . addr;
-    assert ( name [ scol -> name -> name . size ] == 0 );
-    rc = VSimpleProdMake ( out, self -> owned, self -> curs, prodSimpleCast,
-        name, & fd, & vcol -> desc, NULL, * out, self -> chain );
-
-    assert (rc != -1);
-    if ( rc != 0 )
-    {
-        VDB_DEBUG (("failed to create a simple prod to manage fd and desc for column '%N', rc %R\n",
-                    scol -> name, rc));
-        return rc;
-    }
-
-    /* return column input - this is input to the column
-       that is intended to be read from the cursor */
-    vcol -> in = * out;
-    return rc;
-}
-
-/* ResolvePhysical
- *  resolves a physical column
- */
-rc_t VProdResolvePhysicalRead ( const VProdResolve *self, VPhysical *phys )
-{
-    rc_t rc;
-    VTypedesc desc;
-    VFormatdecl fd;
-    VProduction *prod;
-    VFunctionProd *bs;
-    VCursor *curs = self -> curs;
-
-    const char *name;
-    const SExpression *enc;
-    const SPhysMember *smbr;
-
-    /* a write cursor would have opened this already */
-    if ( curs -> read_only )
-    {
-        /* open the physical column for read */
-        rc = VPhysicalOpenRead ( phys,
-            ( VSchema* ) self -> schema, curs -> tbl );
-        if ( rc != 0 )
-        {
-            /* trying to open a column that doesn't exist
-               is not an error, but it didn't resolve */
-            if ( GetRCState ( rc ) == rcNotFound )
-                return 0;
-
-            return rc;
-        }
-    }
-
-    /* should be completely resolved */
-    smbr = phys -> smbr;
-    if ( smbr -> td . type_id == 0 )
-        return 0;
-
-    /* production name */
-    name = smbr -> name -> name . addr;
-
-    /* type information */
-    fd . td = smbr -> td;
-    fd . fmt = 0;
-    rc = VSchemaDescribeTypedecl ( self -> schema, & desc, & fd . td );
-    if ( rc != 0 )
-        return rc;
-
-    /* create output adapter */
-    rc = VPhysicalProdMake ( & prod, self -> owned,
-        curs, phys, prodPhysicalOut, name, & fd, & desc );
-    if ( rc != 0 )
-        return rc;
-
-    /* create byte-swap function with transparent type information */
-    rc = VFunctionProdMake ( & bs, self -> owned,
-        curs, prodFuncByteswap, name, & fd, & desc, chainDecoding );
-    if ( rc != 0 )
-        return rc;
-
-    /* set adapter as input to byte swap */
-    rc = VectorAppend ( & bs -> parms, NULL, prod );
-    if ( rc != 0 )
-        return rc;
-
-    /* take byte-swap function as output */
-    phys -> out = & bs -> dad;
-
-    /* NB - we now have byte-order native output via an adapter
-       it remains to create a decoding path for physical blobs */
-
-
-    /* create adapter */
-    rc = VPhysicalProdMake ( & prod, self -> owned,
-        curs, phys, prodPhysicalKCol, name, & fd, & desc );
-    if ( rc != 0 )
-        return rc;
-
-    /* create serial-to-blob stage */
-    rc = VSimpleProdMake ( & prod, self -> owned, self->curs,
-        prodSimpleSerial2Blob, name, & fd, & desc, NULL, prod, chainDecoding );
-    if ( rc != 0 )
-        return rc;
-
-    /* determine physical encoding */
-    enc = phys -> enc;
-    if ( enc == NULL )
-        enc = smbr -> type;
-
-    /* if unencoded */
-    if ( enc == NULL )
-        phys -> b2p = prod;
-    else
-    {
-        /* the adapter type should be undefined */
-        memset ( & prod -> fd, 0, sizeof prod -> fd );
-        prod -> desc . intrinsic_bits = prod -> desc . intrinsic_dim = 1;
-        prod -> desc . domain = 0;
-
-        /* create decoding production */
-        rc = VProdResolveEncodingExpr ( self, & phys -> b2p,
-            prod, ( const SPhysEncExpr* ) enc );
-    }
-
-    return rc;
-}
diff --git a/libs/vdb/prod-expr.h b/libs/vdb/prod-expr.h
deleted file mode 100644
index d35a839..0000000
--- a/libs/vdb/prod-expr.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_prod_expr_
-#define _h_prod_expr_
-
-#ifndef _h_vdb_extern_
-#include <vdb/extern.h>
-#endif
-
-#ifndef _h_cursor_priv_
-#include "cursor-priv.h"
-#endif
-
-#ifndef _h_prod_priv_
-#include "prod-priv.h"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct BSTree;
-struct KDlset;
-struct VSchema;
-struct SProduction;
-struct SPhysMember;
-struct SColumn;
-struct SExpression;
-struct SFuncExpr;
-struct SPhysEncExpr;
-struct VLinker;
-struct VPhysical;
-
-
-/*--------------------------------------------------------------------------
- * VProduction
- */
-
-/* symbol for failed production */
-#define FAILED_PRODUCTION ( ( VProduction* ) 1U )
-
-
-/*--------------------------------------------------------------------------
- * VTypedecl
- */
-
-/* Resolve
- *  ensures typedecl is completely resolved
- */
-rc_t VTypedeclResolve ( const VTypedecl *self,
-    struct VSchema const *schema, VTypedecl *resolved );
-
-
-/*--------------------------------------------------------------------------
- * VProdResolve
- */
-typedef struct VProdResolve VProdResolve;
-struct VProdResolve
-{
-    /* source of type-related information, functions and structures */
-    struct VSchema const *schema;
-
-    /* source of factory functions */
-    struct VLinker *ld;
-    struct KDlset const *libs;
-
-    /* schema of table being resolved */
-    struct STable const *stbl;
-
-    /* cursor containing columns, physicals, productions, triggers */
-    struct VCursor *curs;
-
-    /* vector of cached named productions */
-    VCursorCache *cache;
-
-    /* vector of owned productions */
-    Vector *owned;
-
-    /* vector of late-binding expressions */
-    Vector *cx_bind;
-
-    /* which chain is being resolved
-       chainEncoding    - when going from input to physical
-       chainDecoding    - when pulling from physical to output
-       chainUncommitted - when resolving trigger and validation expressions
-    */
-    uint8_t chain;
-
-    /* true if within blob realm */
-    bool blobbing;
-
-    /* true if column resolution errors should NOT halt cursor open */
-    bool ignore_column_errors;
-
-    /* true if discovering writable columns */
-    bool discover_writable_columns;
-};
-
-
-/* ResolveColumn
- *  resolves a column using read/validate expression
- */
-rc_t VProdResolveColumn ( const VProdResolve *self,
-    VProduction **out, struct SColumn const *scol, bool alt );
-rc_t VProdResolveColumnRoot ( const VProdResolve *self,
-    VProduction **out, struct SColumn const *scol );
-rc_t VProdResolveColumnRead ( const VProdResolve *self,
-    VProduction **out, struct SColumn const *scol );
-
-
-/* ResolvePhysical
- *  resolves a physical column
- */
-rc_t VProdResolvePhysical ( const VProdResolve *self,
-    struct VPhysical *phys );
-rc_t VProdResolvePhysicalRead ( const VProdResolve *self,
-    struct VPhysical *phys );
-
-
-/* ResolveExpr
- *  resolves expression and returns resulting production object
- *
- *  "out" [ IN/OUT, INITIALLY NULL ] - return parameter for production.
- *  assmed to be preset to NULL on input.
- *  invalid on output with non-zero return code
- *  non-NULL on successful resolution with zero return code
- *
- *  "fd" [ IN/OUT ] - resultant type of assignment expression
- *  on input gives acceptance criteria, i.e. a fmtdecl, typeset or wildcard
- *  invalid on output with non-zero return code or NULL "out"
- *  otherwise, gives actual assigned type on output
- *
- *  "desc" [ OUT, NULL OKAY ] - resultant type description of "out"
- *  invalid on non-zero return or NULL "out"
- *  contains description of fd->td on success
- *
- *  "expr" [ IN ] - expression to be evaluated
- *
- *  "casting" [ IN ] - true if performing explicit type casting
- *  see VProdResolveCastExpr for rules
- *
- *  returns non-zero if a non-recoverable error occurs, 0 otherwise.
- *  resolution is only successful on zero return code and non-NULL out.
- */
-rc_t VProdResolveExpr ( const VProdResolve *self,
-    VProduction **out, VTypedesc *desc, VFormatdecl *fd,
-    struct SExpression const *expr, bool casting );
-
-/* resolves any type of SProduction */
-rc_t VProdResolveSProduction ( const VProdResolve *self, VProduction **out,
-    struct SProduction const *sprod );
-
-/* resolves an SPhysMember symbol */
-rc_t VProdResolveSPhysMember ( const VProdResolve *self,
-    VProduction **out, struct SPhysMember const *smbr );
-
-/* resolves a script function */
-rc_t VProdResolveScriptExpr ( const VProdResolve *self, VProduction **out,
-    const VFormatdecl *lval_fd, struct SFuncExpr const *expr );
-
-/* resolves an external function */
-rc_t VProdResolveFuncExpr ( const VProdResolve *self, VProduction **out,
-    const VFormatdecl *lval_fd, struct SFuncExpr const *expr );
-
-/* resolves physical encoding/decoding expr */
-rc_t VProdResolveEncodingExpr ( const VProdResolve *self, VProduction **out,
-    VProduction *in, struct SPhysEncExpr const *expr );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_prod_expr_ */
diff --git a/libs/vdb/prod-func.c b/libs/vdb/prod-func.c
deleted file mode 100644
index 8c3f8ef..0000000
--- a/libs/vdb/prod-func.c
+++ /dev/null
@@ -1,955 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#define TRACK_REFERENCES 0
-
-#include <vdb/extern.h>
-
-#define KONST const
-#include "prod-priv.h"
-#include "prod-expr.h"
-#include "dbmgr-priv.h"
-#include "schema-priv.h"
-#include "schema-parse.h"
-#include "schema-expr.h"
-#include "linker-priv.h"
-#include "table-priv.h"
-#include "cursor-priv.h"
-#include "column-priv.h"
-#include "phys-priv.h"
-#undef KONST
-
-#include <vdb/manager.h>
-#include <vdb/cursor.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <klib/symbol.h>
-#include <klib/log.h>
-#include <klib/debug.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-
-/*--------------------------------------------------------------------------
- * VProdResolve
- */
-typedef struct SFunctionPushParam SFunctionPushParam;
-struct SFunctionPushParam
-{
-    /* vectors to allow recursive evaluation of types and functions */
-    Vector schema_prior;
-    Vector fact_parms, fact_prior;
-
-    VFormatdecl fd;
-    VTypedesc desc;
-};
-
-static
-rc_t SFunctionPush ( const SFunction *self, const VProdResolve *pr,
-    const VFormatdecl *lval_fd, const SFuncExpr *expr, SFunctionPushParam *pb )
-{
-    rc_t rc;
-    const VSchema *schema = pr -> schema;
-
-    /* validate input parameter counts against formal list */
-    uint32_t count = VectorLength ( & expr -> pfunc );
-    if ( count < self -> func . mand )
-    {
-        rc = RC ( rcVDB, rcFunction, rcResolving, rcParam, rcInsufficient );
-        PLOGERR ( klogWarn, ( klogWarn, rc,
-                   "function '$(func)' requires $(mand) params but got $(count)",
-                   "func=%.*s,mand=%u,count=%u",
-                   self->name->name.len, self->name->name.addr,
-                   self->func.mand,
-                   count
-                 ));
-    }
-    else
-    {
-        uint32_t end = VectorLength ( & self -> func . parms );
-        if ( end < count && ! self -> func . vararg )
-        {
-            rc = RC ( rcVDB, rcFunction, rcResolving, rcParam, rcExcessive );
-            PLOGERR ( klogWarn, ( klogWarn, rc,
-                       "function '$(func)' requires $(mand) params but got $(count)",
-                       "func=%.*s,mand=%u,count=%u",
-                       self->name->name.len, self->name->name.addr,
-                       end,
-                       count
-                     ));
-        }
-        /* ensure this is not an untyped function */
-        else if ( ! self -> validate && self -> rt == NULL )
-            rc = RC ( rcVDB, rcFunction, rcResolving, rcFunction, rcIncorrect );
-        else
-        {
-            /* bind schema params */
-            rc = SFunctionBindSchemaParms ( self, & pb -> schema_prior, & expr -> schem, pr -> cx_bind );
-            if ( rc == 0 )
-            {
-                /* resolve return type */
-                if ( self -> validate )
-                {
-                    /* set type to "void" */
-                    pb -> fd . td . type_id = pb -> fd . td . dim = 1;
-                    pb -> fd . fmt = 0;
-                    memset ( & pb -> desc, 0, sizeof pb -> desc );
-                    pb -> desc . intrinsic_bits = 1;
-                    pb -> desc . intrinsic_dim = 1;
-                }
-                else
-                {
-                    rc = STypeExprResolveAsFormatdecl
-                        ( ( const STypeExpr* ) self -> rt, schema, & pb -> fd, pr -> cx_bind );
-                    if ( rc == 0 )
-                    {
-                        /* pick up cast from lval when return type is "any" or typeset */
-                        if ( pb -> fd . td . type_id == 0 ||
-                             pb -> fd . td . type_id >= 0x40000000 )
-                        {
-                            VFormatdecl cast;
-
-                            if ( VFormatdeclCommonAncestor ( & pb -> fd, schema, lval_fd, & cast, NULL ) )
-                                pb -> fd = cast;
-                            else
-                            {
-                                const KSymbol *fd_name = NULL;
-                                const KSymbol *lval_name = NULL;
-                            
-                                const SDatatype *dt = VSchemaFindTypeid ( schema, lval_fd -> td . type_id );
-                                if ( dt != NULL )
-                                    lval_name = dt -> name;
-                                
-                                dt = VSchemaFindTypeid ( schema, pb -> fd . td . type_id );
-                                if ( dt != NULL )
-                                    fd_name = dt -> name;
-                                else
-                                {
-                                    const STypeset *ts = VSchemaFindTypesetid ( schema, pb -> fd . td . type_id );
-                                    if ( ts != NULL )
-                                        fd_name = ts->name;
-                                }
-
-                                if ( lval_name != NULL && fd_name != NULL ) 
-                                {
-                                    PLOGMSG ( klogWarn, ( klogWarn,
-                                               "function '$(func)' could not resolve return type '$(rtype)' in '$(typeset)'",
-                                               "func=%.*s,rtype=%.*s,typeset=%.*s",
-                                               self->name->name.len, self->name->name.addr,
-                                               lval_name->name.len, lval_name->name.addr,
-                                               fd_name->name.len, fd_name->name.addr
-                                                  ));
-                                }
-                                else
-                                {
-                                    PLOGMSG ( klogInt, ( klogInt,
-                                               "function '$(func)' could not resolve return type or type names!",
-                                               "func=%.*s",
-                                               self->name->name.len, self->name->name.addr
-                                                 ));
-                                }
-                            }
-                        }
-
-                        /* pick up cast from lval when return dimension is "*" */
-                        else if ( pb -> fd . td . dim == 0 )
-                        {
-                            VTypedesc lh_desc, rh_desc;
-                            /* since rh type is T' and is cast to lh type T,
-                               missing dimension is sizeof ( T[dim] ) / sizeof ( T' ) */
-                            rc = VSchemaDescribeTypedecl ( schema, & lh_desc, & lval_fd -> td );
-                            if ( rc == 0 )
-                            {
-                                VTypedecl rh_td;
-                                rh_td . type_id = pb -> fd . td . type_id;
-                                rh_td . dim = 1;
-                                rc = VSchemaDescribeTypedecl ( schema, & rh_desc, & rh_td );
-                                if ( rc == 0 )
-                                {
-                                    pb -> fd . td . dim = VTypedescSizeof ( & lh_desc ) /
-                                        VTypedescSizeof ( & rh_desc );
-
-                                    /* force dimension "*" to be at least 1 */
-                                    if ( pb -> fd . td . dim == 0 )
-                                        pb -> fd . td . dim = 1;
-                                }
-                            }
-                        }
-
-                        /* evaluate type description */
-                        rc = VSchemaDescribeTypedecl ( schema, & pb -> desc, & pb -> fd . td );
-                    }
-                }
-                 
-                if ( rc == 0 )
-                {
-                    /* bind factory params */
-                    rc = SFunctionBindFactParms ( self, & pb -> fact_parms, & pb -> fact_prior, & expr -> pfact, pr -> cx_bind );
-                    if ( rc == 0 )
-                        return 0;
-                }
-
-                SFunctionRestSchemaParms ( self, & pb -> schema_prior, pr -> cx_bind );
-            }
-        }
-    }
-
-    LOGERR ( klogWarn, rc, "failed to resolve function expression" );
-    return rc;
-}
-
-static
-void SFunctionPop ( const SFunction *self,
-    const VProdResolve *pr, SFunctionPushParam *pb )
-{
-    SFunctionRestFactParms ( self, & pb -> fact_prior, pr -> cx_bind );
-    SFunctionRestSchemaParms ( self, & pb -> schema_prior, pr -> cx_bind );
-    VectorWhack ( & pb -> fact_parms, NULL, NULL );
-}
-
-static
-rc_t VProdResolveFuncParamExpr ( const VProdResolve *self, Vector *out,
-    VFormatdecl *fd, const SExpression *expr, const SProduction *sprod )
-{
-    /* Create a production to resolve the expression; also set its
-     * type description */
-    VTypedesc desc;
-    VProduction *prod = NULL;
-    rc_t rc = VProdResolveExpr ( self, & prod, & desc, fd, expr, false );
-    if ( rc == 0 )
-    {
-        if ( prod == NULL )
-            rc = RC ( rcVDB, rcFunction, rcResolving, rcProduction, rcIncomplete );
-        else
-        {
-            bool control;
-            const char *name;
-
-            if ( sprod == NULL )
-            {
-                control = false;
-                name = "vararg";
-            }
-            else
-            {
-                control = sprod -> control;
-                name = sprod -> name -> name . addr;
-                assert ( name [ sprod -> name -> name . size ] == 0 );
-            }
-
-            rc = VSimpleProdMake ( & prod, self -> owned, self-> curs,
-                prodSimpleCast, name,fd, & desc, NULL, prod, self -> chain);
-            if ( rc == 0 )
-            {
-                prod -> control = control;
-                rc = sprod ?
-                    VectorSet ( out, prod -> cid . id = sprod -> cid . id, prod ):
-                    VectorAppend ( out, & prod -> cid . id, prod );
-                if ( rc != 0 )
-                    VProductionWhack ( prod, self -> owned );
-            }
-        }
-    }
-    return rc;
-}
-
-static
-rc_t VProdResolveValidateFuncParams ( const VProdResolve *self, Vector *out,
-    const SFormParmlist *formal, const Vector *expr )
-{
-    rc_t rc;
-    VFormatdecl fd;
-    const SProduction *sprod;
-
-    uint32_t count = VectorLength ( expr );
-    uint32_t end = VectorLength ( & formal -> parms );
-    VectorInit ( out, 0, count );
-
-    /* formal param count must be 2 */
-    assert ( end == 2 );
-
-    /* input param count must equal formals */
-    if ( count != end )
-    {
-        if ( count > end )
-            return RC ( rcVDB, rcFunction, rcResolving, rcParam, rcExcessive );
-        return RC ( rcVDB, rcFunction, rcResolving, rcParam, rcInsufficient );
-    }
-
-    /* resolve production type */
-    sprod = ( const void* ) VectorGet ( & formal -> parms, 0 );
-    rc = STypeExprResolveAsFormatdecl
-        ( ( const STypeExpr* ) sprod -> fd, self -> schema, & fd, self -> cx_bind );
-    if ( rc == 0 )
-    {
-        /* bring in source parameter */
-        const SExpression *pexpr = VectorGet ( expr, 0 );
-
-        /* create copy of resolve block and set to write side */
-        VProdResolve pr = * self;
-        pr . chain = chainEncoding;
-
-        /* resolve source parameter */
-        rc = VProdResolveFuncParamExpr ( & pr, out, & fd, pexpr, sprod );
-        if ( rc == 0 )
-        {
-            /* comparison formal */
-            sprod = ( const void* ) VectorGet ( & formal -> parms, 1 );
-            rc = STypeExprResolveAsFormatdecl
-                ( ( const STypeExpr* ) sprod -> fd, self -> schema, & fd, self -> cx_bind );
-            if ( rc == 0 )
-            {
-                /* bring in comparison parameter */
-                pexpr = VectorGet ( expr, 1 );
-
-                /* evaluate on read side */
-                pr . chain = chainDecoding;
-
-                /* resolve comparison parameter */
-                rc = VProdResolveFuncParamExpr ( & pr, out, & fd, pexpr, sprod );
-            }
-        }
-    }
-
-    return rc;
-}
-
-static
-rc_t VProdResolveFuncParams ( const VProdResolve *self, Vector *out,
-     const SFormParmlist *formal, const Vector *expr )
-{
-    rc_t rc;
-    VFormatdecl fd, ffd;
-
-    uint32_t i, count = VectorLength ( expr );
-    uint32_t end = VectorLength ( & formal -> parms );
-    VectorInit ( out, 0, count );
-
-    /* assert that there is at least one formal param
-       or that we don't have varargs */
-    assert ( end != 0 || count == 0 );
-
-    /* resolve named parameters */
-    for ( rc = 0, i = 0; rc == 0 && i < count && i < end; ++ i )
-    {
-        /* resolve production type */
-        const SProduction *sprod = ( const void* ) VectorGet ( & formal -> parms, i );
-        rc = STypeExprResolveAsFormatdecl
-            ( ( const STypeExpr* ) sprod -> fd, self -> schema, & fd, self -> cx_bind );
-        if ( rc == 0 )
-        {
-            /* bring in parameter */
-            const SExpression *pexpr = VectorGet ( expr, i );
-            ffd = fd;
-            rc = VProdResolveFuncParamExpr ( self, out, & fd, pexpr, sprod );
-        }
-    }
-
-    /* resolve vararg parameters */
-    for ( ; rc == 0 && i < count; ++ i )
-    {
-        
-        const SExpression *pexpr = VectorGet ( expr, i );
-
-#if 0
-        /* use type "any" */
-        memset ( & fd, 0, sizeof fd );
-#else
-        /* use last formal type */
-        fd = ffd;
-#endif
-
-        rc = VProdResolveFuncParamExpr ( self, out, & fd, pexpr, NULL );
-    }
-
-    return rc;
-}
-
-rc_t VProdResolveScriptExpr ( const VProdResolve *self,
-    VProduction **out, const VFormatdecl *lval_fd, const SFuncExpr *expr )
-{
-    const SFunction *func = expr -> func;
-
-    SFunctionPushParam pb;
-    rc_t rc = SFunctionPush ( func, self, lval_fd, expr, & pb );
-    if ( rc == 0 )
-    {
-        Vector *inputs = malloc ( sizeof * inputs );
-        if ( inputs == NULL )
-            rc = RC ( rcVDB, rcVector, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            rc = VProdResolveFuncParams ( self, inputs,
-                & func -> func, & expr -> pfunc );
-            if ( rc == 0 )
-            {
-                /* script name
-                   heuristic - known to have been created with NUL term */
-                const char *name = expr -> func -> name -> name . addr;
-
-                /* by this time, we have bound all parameters */
-                VScriptProd *script;
-                rc = VScriptProdMake ( & script, self -> owned, self -> curs,
-                    prodScriptFunction, name, & pb . fd, & pb . desc, self -> chain );
-                if ( rc == 0 )
-                {
-                    VCursorCache local;
-                    VCursorCacheInit ( & local, 0, 2 );
-
-                    rc = VectorAppend ( & local . cache, NULL, inputs );
-                    if ( rc == 0 )
-                    {
-                        /* create new structure */
-                        VProdResolve spr = * self;
-                        spr . cache = & local;
-                        spr . owned = & script -> owned;
-
-                        /* forget about the inputs */
-                        inputs = NULL;
-
-                        /* now evaluate the return expression */
-                        rc = VProdResolveExpr ( & spr, & script -> rtn, NULL, & pb . fd,
-                            func -> u . script . rtn, false );
-                        if ( rc != 0 || script -> rtn == NULL )
-                            VProductionWhack ( & script -> dad, self -> owned );
-                        else
-                        {
-                            * out = & script -> dad;
-                        }
-                    }
-
-                    VCursorCacheWhack ( & local, NULL, NULL );
-                }
-            }
-            else if ( GetRCState ( rc ) == rcIncomplete )
-            {
-                /* reset errors when input parameters could not be resolved */
-                rc = 0;
-            }
-
-            if ( inputs != NULL )
-            {
-                VectorWhack ( inputs, NULL, NULL );
-                free ( inputs );
-            }
-        }
-
-        SFunctionPop ( func, self, & pb );
-    }
-
-    return rc;
-}
-
-static
-rc_t VFunctionProdMakeFactParms ( VFunctionProd *self, const VProdResolve *pr,
-    const SFormParmlist *pfact, const Vector *pval, VFactoryParams *fp, const SConstExpr **cxp )
-{
-    rc_t rc;
-    VTypedecl td;
-    const VSchema *schema = pr -> schema;
-    uint32_t i, last = 0, count = fp -> argc;
-
-    for ( rc = 0, i = 0; rc == 0 && i < count; ++ i )
-    {
-        /* fetch the formal parameter, which can be NULL
-           when the factory parameters allow varargs */
-        const SIndirectConst *ic = ( const void* ) VectorGet ( & pfact -> parms, i );
-        if ( ic != NULL )
-            last = i;
-        else
-        {
-            assert ( i != 0 );
-
-            /* just use the last parameter's type */
-            ic = ( const void* ) VectorGet ( & pfact -> parms, last );
-            assert ( ic != NULL );
-        }
-
-        /* TBD - nobody is using function pointer parameters yet */
-        if ( ic -> td == NULL )
-        {
-            rc = RC ( rcVDB, rcFunction, rcConstructing, rcType, rcNull );
-            LOGERR ( klogFatal, rc, "function factory with function param" );
-            break;
-        }
-
-        /* evaluate constant typedecl */
-        rc = STypeExprResolveAsTypedecl ( ( const STypeExpr* ) ic -> td, schema, & td, pr -> cx_bind );
-        if ( rc == 0 )
-            rc = VSchemaDescribeTypedecl ( schema, & fp -> argv [ i ] . desc, & td );
-
-        if ( rc == 0 )
-        {
-            /* evaluate constant expression */
-            const SExpression *ic_expr = ( const void* ) VectorGet ( pval, i );
-            assert ( ic_expr != NULL );
-            rc = eval_const_expr ( schema, & td, ic_expr, ( SExpression** ) & cxp [ i ], pr -> cx_bind );
-            if ( rc == 0 )
-            {
-                /* catch undefined factory parameters from outer script */
-                if ( cxp [ i ] -> dad . var == eIndirectExpr )
-                {
-                    if ( fp -> argc > i )
-                        fp -> argc = i;
-                }
-                else if ( cxp [ i ] -> dad . var != eConstExpr )
-                {
-                    rc = -1;
-                    LOGERR (klogFatal, rc, "(cxp[i]->dad.var != eConstExpr)");
-                    break;
-                }
-                else if ( i >= fp -> argc )
-                {
-                    rc = -1;
-                    LOGERR (klogFatal, rc, "(i >= fp->argc)");
-                    break;
-                }
-                else
-                {
-                    fp -> argv [ i ] . data . u8 = cxp [ i ] -> u . u8;
-                    fp -> argv [ i ] . count = cxp [ i ] -> td . dim;
-                }
-            }
-        }
-    }
-
-    for ( ; i < count; ++ i )
-        cxp [ i ] = NULL;
-
-    return rc;
-}
-
-static
-rc_t VProdResolveInvokeFactory ( const VProdResolve *self, const VXfactInfo *info,
-    VFunctionProd *fprod, const VFactoryParams *cp, const VFunctionParams *dp,
-    VTransDesc *td, bool external )
-{
-    rc_t rc;
-
-    VFuncDesc desc;
-    memset ( & desc, 0, sizeof desc );
-
-    rc = ( * td -> factory ) ( td -> fself, info, & desc, cp, dp );
-    assert ( rc != -1 );
-
-    /* clobber returned context */
-    if ( rc != 0 )
-        rc = ResetRCContext ( rc, rcVDB, rcFunction, rcConstructing );
-
-    /* TBD - validate the returned value */
-    else if ( external &&
-        ( desc . variant == vftInvalid ||
-          desc . variant > vftBlob ||
-          desc . u . bf == NULL ) )
-    {
-        rc = RC ( rcVDB, rcFunction, rcConstructing, rcType, rcInvalid );
-    }
-    else
-    {
-        fprod -> fself = desc . self;
-        fprod -> whack = desc . whack;
-        fprod -> u . rf = desc . u . rf;
-        fprod -> dad . sub = ( uint8_t ) desc . variant;
-    }
-
-    return rc;
-}
-
-static
-rc_t VProdResolveBuildFuncParms ( const VProdResolve *self, const VXfactInfo *info,
-    VFunctionProd *fprod, const VFactoryParams *cp, VTransDesc *td, bool external )
-{
-    rc_t rc;
-    uint32_t i, count;
-
-    /* create a block of function parameters
-       start with data on the stack */
-    VFunctionParams fpbuff, * fp = & fpbuff;
-    count = VectorLength ( & fprod -> parms );
-    if ( count > sizeof fpbuff . argv / sizeof fpbuff . argv [ 0 ] )
-    {
-        fp = malloc ( sizeof fpbuff -
-                      sizeof fpbuff . argv +
-                      count * sizeof fpbuff . argv [ 0 ] );
-        if ( fp == NULL )
-            return RC ( rcVDB, rcFunction, rcResolving, rcMemory, rcExhausted );
-    }
-
-    fp -> argc = count;
-
-    /* copy types */
-    for ( i = 0; i < count; ++ i )
-    {
-        const VProduction *vprod = ( const void* ) VectorGet ( & fprod -> parms, i );
-        fp -> argv [ i ] . fd = vprod -> fd;
-        fp -> argv [ i ] . desc = vprod -> desc;
-    }
-
-    rc = VProdResolveInvokeFactory ( self, info, fprod, cp, fp, td, external );
-
-    if ( fp != & fpbuff )
-        free ( fp );
-
-    return rc;
-}
-
-static
-rc_t VProdResolveBuildFactParms ( const VProdResolve *self, const VXfactInfo *info,
-    VFunctionProd *fprod, const SFormParmlist *pfact, const Vector *pval,
-    VTransDesc *td, bool external )
-{
-    rc_t rc;
-    uint32_t i;
-
-    /* count the number of parameters */
-    uint32_t count = VectorLength ( pval );
-
-    /* create a block of factory parameters
-       start with data on the stack */
-    VFactoryParams fpbuff, * fp = & fpbuff;
-    const SConstExpr *cxbuff [ 16 ], **cxp = cxbuff;
-
-    /* 9/11/13
-       VFactoryParams has a declared array of 16 elements.
-       cxbuff is also declared to have 16 elements. the idea
-       is that they stay in sync. */
-    assert ( sizeof fpbuff . argv / sizeof fpbuff . argv [ 0 ] ==
-             sizeof cxbuff / sizeof cxbuff [ 0 ] );
-
-    /* 16 is generally more than enough parameters.
-       but in cases where it may not be ( e.g. maps ),
-       malloc the memory according to count. */
-    if ( count > sizeof fpbuff . argv / sizeof fpbuff . argv [ 0 ] )
-    {
-        /* allocate both structures in a single block */
-        fp = malloc ( sizeof fpbuff -
-                      sizeof fpbuff . argv +
-                      count * ( sizeof fpbuff . argv [ 0 ] + sizeof cxbuff [ 0 ] ) );
-
-        if ( fp == NULL )
-            return RC ( rcVDB, rcFunction, rcResolving, rcMemory, rcExhausted );
-
-        /* reset expression array to point within block */
-        cxp = ( const SConstExpr** ) & fp -> argv [ count ];
-    }
-
-    fp -> argc = count;
-    fp -> align = 0;
-
-    /* the purpose of this function is to bind type expressions to type ids
-       before the remainder of the function is evaluated. for this to work,
-       we need a mapping of parameterized type ids to expressions.
-
-       the purpose of the cx array is to enable recursion by saving previously
-       bound expressions upon entry ... */
-    rc = VFunctionProdMakeFactParms ( fprod, self, pfact, pval, fp, cxp );
-    assert ( rc != -1 );
-    if ( rc == 0 )
-        rc = VProdResolveBuildFuncParms ( self, info, fprod, fp, td, external );
-    assert ( rc != -1 );
-
-    for ( i = 0; i < count; ++ i )
-        SExpressionWhack ( & cxp [ i ] -> dad );
-
-    if ( fp != & fpbuff )
-        free ( fp );
-
-    return rc;
-}
-
-rc_t VProdResolveFuncExpr ( const VProdResolve *self,
-    VProduction **out, const VFormatdecl *lval_fd, const SFuncExpr *expr )
-{
-    const SFunction *sfunc = expr -> func;
-    const char *name = sfunc -> name -> name . addr;
-
-    SFunctionPushParam pb;
-    rc_t rc = SFunctionPush ( sfunc, self, lval_fd, expr, & pb );
-
-    assert ( rc != -1 );
-
-    if ( rc == 0 )
-    {
-        bool external;
-        VTransDesc td;
-        VXfactInfo info;
-
-        /* pass function type information */
-        info . fdesc . fd = pb . fd;
-        info . fdesc . desc = pb . desc;
-
-        /* locate factory function */
-        rc = VLinkerFindFactory ( self -> ld, self -> libs, & td, sfunc, & external );
-        if ( rc == 0 )
-        {
-            /* create a production representing function */
-            VFunctionProd *fprod;
-            rc = VFunctionProdMake ( & fprod, self -> owned,
-                self -> curs, vftInvalid, name, & info . fdesc . fd,
-                & info . fdesc . desc, self -> chain );
-            if ( rc == 0 )
-            {
-                /* check for a validation function
-                   these functions are generally compiler-generated */
-                if ( sfunc -> validate )
-                {
-                    rc = VProdResolveValidateFuncParams ( self, & fprod -> parms,
-                        & sfunc -> func, & expr -> pfunc );
-                }
-                else
-                {
-                    /* resolve normal function parameters */
-                    rc = VProdResolveFuncParams ( self, & fprod -> parms,
-                        & sfunc -> func, & expr -> pfunc );
-                }
-
-                if ( rc == 0 )
-                {
-                    /* prepare info block for function factory */
-                    info . schema = self -> schema;
-                    info . tbl = self -> curs -> tbl;
-                    info . mgr = info . tbl -> mgr;
-                    info . parms = ( struct VCursorParams * ) self -> curs;
-
-                    /* by this point the schema and factory parameters
-                       have been bound: named type and constant parameters
-                       are entered into the "self -> cx_bind" Vector,
-                       factory parameter constants are positionally recorded
-                       in "pb . fact_parms", and function parameter productions
-                       are recorded in "fprod" */
-
-                    /* the following function will evaluate the parameters
-                       and invoke the factory function to construct production */
-                    rc = VProdResolveBuildFactParms ( self, & info, fprod,
-                        & sfunc -> fact, & pb . fact_parms, & td, external );
-                    if ( rc == 0 )
-                    {
-                        /* successfully created */
-                        * out = & fprod -> dad;
-                    }
-                }
-
-                if ( rc != 0 )
-                {
-                    /* reset errors when input parameters could not be resolved
-                       or if function factory returned an error */
-                    if ( GetRCState ( rc ) == rcIncomplete ||
-                         ( GetRCTarget ( rc ) == rcFunction && GetRCContext ( rc ) == rcConstructing ) )
-                    {
-                        rc = 0;
-                    }
-
-                    VProductionWhack ( & fprod -> dad, self -> owned );
-                }
-            }
-        }
-        else
-        {
-            /* TBD - perhaps report what went wrong, but if function
-               could not be resolved, don't stop the whole process */
-            VDB_DEBUG (( "failed to find function '%S' rc %R",
-                        & sfunc -> name -> name, rc ));
-            rc = 0;
-        }
-        
-        SFunctionPop ( sfunc, self, & pb );
-    }
-
-    return rc;
-}
-
-
-/* resolves physical encoding/decoding expr */
-rc_t VProdResolveEncodingExpr ( const VProdResolve *self,
-    VProduction **out, VProduction *in, const SPhysEncExpr *expr )
-{
-    const SPhysical *sphys = expr -> phys;
-
-    /* bind schema and factory params */
-    Vector schema_prior;
-    rc_t rc = SPhysicalBindSchemaParms ( sphys, & schema_prior, & expr -> schem, self -> cx_bind );
-    if ( rc == 0 )
-    {
-        Vector fact_parms, fact_prior;
-        rc = SPhysicalBindFactParms ( sphys, & fact_parms, & fact_prior, & expr -> pfact, self -> cx_bind );
-        if ( rc == 0 )
-        {
-            /* create single input param vector */
-            Vector *inputs = malloc ( sizeof * inputs );
-            if ( inputs == NULL )
-                rc = RC ( rcVDB, rcVector, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                VectorInit ( inputs, 0, 1 );
-                rc = VectorAppend ( inputs, NULL, in );
-                if ( rc == 0 )
-                {
-                    VFormatdecl fd;
-
-                    if ( self -> chain == chainEncoding )
-                        memset ( & fd, 0, sizeof fd );
-                    else
-                    {
-                        rc = STypeExprResolveAsFormatdecl
-                            ( ( const STypeExpr* ) sphys -> td, self -> schema, & fd, self -> cx_bind );
-                    }
-
-                    if ( rc == 0 )
-                    {
-                        VScriptProd *script;
-                        const char *name = sphys -> name -> name . addr;
-                        rc = VScriptProdMake ( & script, self -> owned, self -> curs,
-                            prodScriptFunction, name, & fd, NULL, self -> chain );
-                        if ( rc == 0 )
-                        {
-                            /* create a production cache for the encoding */
-                            VCursorCache local;
-                            VCursorCacheInit ( & local, 0, 2 );
-
-                            rc = VectorAppend ( & local . cache, NULL, inputs );
-                            if ( rc == 0 )
-                            {
-                                const SFunction *func = ( self -> chain == chainEncoding ) ?
-                                    & sphys -> encode : & sphys -> decode;
-
-                                VProdResolve spr = * self;
-                                spr . cache = & local;
-                                spr . owned = & script -> owned;
-
-                                /* forget about input vector */
-                                inputs = NULL;
-
-                                /* now evaluate the return expression */
-                                rc = VProdResolveExpr ( & spr, & script -> rtn,
-                                    & script -> dad . desc, & script -> dad . fd,
-                                    func -> u . script . rtn, false );
-                                if ( rc != 0 || script -> rtn == NULL )
-                                    VProductionWhack ( & script -> dad, self -> owned );
-                                else
-                                {
-                                    * out = & script -> dad;
-                                }
-                            }
-
-                            VCursorCacheWhack ( & local, NULL, NULL );
-                        }
-                    }
-                
-                    if ( inputs != NULL )
-                    {
-                        VectorWhack ( inputs, NULL, NULL );
-                        free ( inputs );
-                    }
-                }
-            }
-            
-            SPhysicalRestFactParms ( sphys, & fact_prior, self -> cx_bind );
-            VectorWhack ( & fact_parms, NULL, NULL );
-        }
-
-        SPhysicalRestSchemaParms ( sphys, & schema_prior, self -> cx_bind );
-    }
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * VFunctionProd
- */
-
-/* BuiltInComparison
- */
-rc_t VFunctionProdMakeBuiltInComp ( VProduction **prodp, Vector *owned,
-    const char *name,  const VProdResolve *resolve, VProduction *orig, VProduction *test )
-{
-    /* locate factory */
-    VTransDesc td;
-    rc_t rc = VLinkerFindNamedFactory ( resolve -> ld,
-        resolve -> libs, & td, "vdb:compare" );
-    if ( rc == 0 )
-    {
-        const VCursor *curs = resolve -> curs;
-
-        /* build factory params */
-        VFuncDesc fd;
-        VXfactInfo info;
-        VFactoryParams cp;
-        VFunctionParams dp;
-
-        info . schema = curs -> schema;
-        info . tbl  = curs -> tbl;
-        info . mgr = curs -> tbl -> mgr;
-	info . parms = (struct VCursorParams*)curs;
-        info . fdesc . fd = orig -> fd;
-        info . fdesc . desc = orig -> desc;
-
-        memset ( & fd, 0, sizeof fd );
-
-        /* TBD - fill out % or epsilon for fp compare */
-        cp . argc = 0;
-
-        dp . argc = 2;
-        dp . argv [ 0 ] . desc = orig -> desc;
-        dp . argv [ 0 ] . fd = orig -> fd;
-        dp . argv [ 1 ] . desc = test -> desc;
-        dp . argv [ 1 ] . fd = test -> fd;
-
-        /* invoke factory */
-        rc = ( * td . factory ) ( td . fself, & info, & fd, & cp, & dp );
-        if ( rc == 0 )
-        {
-            VFunctionProd *prod;
-            rc = VFunctionProdMake ( & prod, owned, curs,
-                fd . variant, name, & orig -> fd, & orig -> desc, chainDecoding );
-            if ( rc == 0 )
-            {
-                prod -> fself = fd . self;
-                prod -> whack = fd . whack;
-                prod -> u . rf = fd . u . rf;
-
-                /* use orig and test as inputs */
-                rc = VectorAppend ( & prod -> parms, NULL, orig );
-                if ( rc == 0 )
-                {
-                    rc = VectorAppend ( & prod -> parms, NULL, test );
-                    if ( rc == 0 )
-                    {
-                        * prodp = & prod -> dad;
-                        return 0;
-                    }
-                }
-            }
-        }
-    }
-
-    return rc;
-}
diff --git a/libs/vdb/prod-priv.h b/libs/vdb/prod-priv.h
deleted file mode 100644
index d1601ea..0000000
--- a/libs/vdb/prod-priv.h
+++ /dev/null
@@ -1,459 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_prod_priv_
-#define _h_prod_priv_
-
-#ifndef _h_vdb_extern_
-#include <vdb/extern.h>
-#endif
-
-#ifndef _h_klib_vector_
-#include <klib/vector.h>
-#endif
-
-#ifndef _h_xform_priv_
-#include "xform-priv.h"
-#endif
-
-#ifndef _h_schema_priv_
-#include "schema-priv.h"
-#endif
-
-#ifndef _h_blob_priv_
-#include "blob-priv.h"
-#endif
-
-#ifndef _h_klib_debug_
-#include <klib/debug.h> /* DBG_VDB */
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#define PROD_CACHE  	  2                   	/** default size of Production Cache ***/
-#define PROD_CACHE_MAX_EXTENTS  4		/** maximum multiplier for extending selected production caches when random io is detected ***/
-#define PROD_CACHE_WASH_ACCESS_THRESHOLD 10	/** number of accesses to wash part of the cache to trigger cache extension ***/
-						/** this is to determine random access pattern ***/
-
-/* IT IS A BAD IDEA TO USE EXTERN COLUMNS IN EXPRESSIONS
-   but it used to be okay in version 0 of the schema, so
-   it still occurs sometimes. We have allowed opening
-   columns from within schema but were afraid to alter the
-   row vector because this disturbs the serial allocation
-   of ids that could fool programmers trying to be clever.
-   Unfortunately, this resulted in a stray reference after
-   we shifted reference ownership to the row vector.
-
-   Setting this symbol to 1 will cause schema-opened columns
-   to be inserted into the row vector, disturbing the index
-   series passed out to clients, but not losing the reference. */
-#define OPEN_COLUMN_ALTERS_ROW 1
-
-#if _DEBUGGING
-#define PROD_NAME 1
-#endif
-
-#define VDB_DEBUG(msg) DBGMSG(DBG_VDB,DBG_FLAG(DBG_VDB_RESOLVE), msg )
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct VBlob;
-struct VColumn;
-struct VPhysical;
-struct VProdResolve;
-struct VBlobMRUCacheCursorContext;
-
-
-/*--------------------------------------------------------------------------
- * VProduction
- */
-
-/* major production types */
-enum
-{
-    /* simple assignment from another production */
-    prodSimple,
-
-    /* function result and input parameters */
-    prodFunc,
-
-    /* a type of function with its own sub-productions */
-    prodScript,
-
-    /* an adapter production that references a VPhysical */
-    prodPhysical,
-
-    /* an adapter production referencing a VColumn */
-    prodColumn
-};
-
-/* read/write chain */
-enum
-{
-    chainInvalid,
-    chainEncoding,
-    chainDecoding,
-    chainUncommitted
-};
-
-#if ! VPRODUCTION_DECLARED_IN_XFORM_H
-typedef struct VProduction VProduction;
-#endif
-struct VProduction
-{
-#if PROD_NAME
-    const char *name;
-#endif
-#if PROD_CACHE
-    /* cached output */
-    struct VBlob *cache [ PROD_CACHE * PROD_CACHE_MAX_EXTENTS];
-    uint32_t cache_cnt_max;
-    uint32_t cache_cnt;
-    uint32_t cache_wash_access_cnt;
-#endif
-    /* format declaration and element type description */
-    VFormatdecl fd;
-    VTypedesc desc;
-
-    /* schema contextual id */
-    VCtxId cid;
-
-    /* owned vector id */
-    uint32_t oid;
-
-    /* production major variant ( enum see above ) */
-    uint8_t var;
-
-    /* production sub-variant ( specific to each major variant */
-    uint8_t sub;
-
-    /* indication of read/write chain */
-    uint8_t chain;
-
-    /* true if used as control parameter */
-    bool control;
-    /* is this production directly connected to a Column in a Cursor */
-    VBlobMRUCacheCursorContext cctx;
-};
-
-
-/* Make
- *  allocation and parent initialization
- *  called from the "Make" functions below
- *
- *  "prod" [ OUT ] - returned production
- *
- *  "size" [ IN ] - sizeof sub-type
- *
- *  "owned" [ IN ] - vector to contain productions
- *
- *  "var" [ IN ] - variant code, e.g. prodSimple, prodFunc
- *
- *  "sub" [ IN ] - sub-variant code, e.g. prodSimplePage2Blob
- *
- *  "name" [ IN, NULL OKAY ] - optional object name, derived
- *  from schema if possible
- *
- *  "fd" [ IN ] and "desc" [ IN ] - production type description
- *
- *  "cid" [ IN ] - contextual ( two-level ) id
- *
- *  "chain" [ IN ] - which chain(s) are supported
- *    chainEncoding    - when going from input to physical
- *    chainDecoding    - when pulling from physical to output
- *    chainUncommitted - when resolving trigger and validation expressions
- */
-rc_t VProductionMake ( VProduction **prod, Vector *owned, size_t size,
-    int var, int sub, const char *name, const VFormatdecl *fd,
-    const VTypedesc *desc, const VCtxId *cid, uint8_t chain );
-
-
-/* Whack
- *  virtual whacker
- *  calls variant specific "Destroy" function
- *  frees object
- *
- *  "owned" [ IN, NULL OKAY ] - a Vector owning production
- *  if not NULL, production will be removed from vector
- */
-void CC VProductionWhack ( void *item, void *owned );
-
-
-#if ! VPRODUCTION_DECLARED_IN_XFORM_H
-/* IdRange
- *  obtains intersection of all physical sources
- *
- *  "first" [ IN/OUT ] and "last" [ IN/OUT ] - range to intersect
- */
-rc_t VProductionColumnIdRange ( const VProduction *self,
-    int64_t *first, int64_t *last );
-rc_t VProductionPageIdRange ( VProduction *self,
-    int64_t id, int64_t *first, int64_t *last );
-
-/* RowLength
- *  get row length for a particular row
- */
-uint32_t VProductionRowLength ( const VProduction *self, int64_t row_id );
-
-/* FixedRowLength
- *  get fixed row length for entire column
- *  returns 0 if not fixed
- */
-uint32_t VProductionFixedRowLength ( const VProduction *self, int64_t row_id, bool ignore_self );
-
-#endif /* ! VPRODUCTION_DECLARED_IN_XFORM_H */
-
-/* ReadBlob
- *  fetch a blob containing at least the requested row
- *  returns a new reference
- */
-rc_t VProductionReadBlob ( const VProduction *self, struct VBlob **vblob, int64_t id , uint32_t cnt, struct VBlobMRUCacheCursorContext* cctx);
-
-/* IsStatic
- *  trace all the way to a physical production
- */
-rc_t VProductionIsStatic ( const VProduction *self, bool *is_static );
-
-
-/*--------------------------------------------------------------------------
- * VSimpleProd
- *  single input param
- */
-enum
-{
-    /* an implicit cast ( assignment ) or an explicit cast from schema */
-    prodSimpleCast,
-
-    /* perform blob class manipulation at page boundary */
-    prodSimplePage2Blob,
-
-    /* serialization interface at kcolumn boundary */
-    prodSimpleSerial2Blob,
-    prodSimpleBlob2Serial
-};
-
-typedef struct VSimpleProd VSimpleProd;
-struct VSimpleProd
-{
-    VProduction dad;
-    VProduction *in;
-    struct VCursor const *curs;
-};
-
-rc_t VSimpleProdMake ( VProduction **prod, Vector *owned,
-    struct VCursor const *curs,int sub, const char *name, const VFormatdecl *fd,
-    const VTypedesc *desc, const VCtxId *cid,
-    VProduction *in, uint8_t chain );
-
-#define VSimpleProdDestroy( self ) \
-    ( ( void ) 0 )
-
-/* Read
- *  return a blob containing row id
- */
-rc_t VSimpleProdRead ( VSimpleProd *self, struct VBlob **vblob, int64_t id, uint32_t cnt, struct VBlobMRUCacheCursorContext *cctx );
-
-
-/*--------------------------------------------------------------------------
- * VFunctionProd
- *  function input params are VProduction*
- *  extern C function pointer and self object
- */
-enum
-{
-    prodFuncExternal = vftLastFuncProto - 1,
-
-    /* internal types */
-    prodFuncBuiltInCompare,
-    prodFuncByteswap
-};
-
-typedef struct VFunctionProd VFunctionProd;
-struct VFunctionProd
-{
-    VProduction dad;
-
-    /* back-pointer to owning cursor
-       not a reference, not to be released */
-    struct VCursor const *curs;
-
-    /* object and optional destructor */
-    void *fself;
-    void ( CC * whack ) ( void *self );
-
-    /* runtime function */
-    union
-    {
-        /* public types */
-        VRowFunc rf;
-        VNonDetRowFunc ndf;
-        VArrayFunc af;
-        VFixedRowFunc pf;
-        VBlobFunc bf;
-
-        /* merge type */
-        VBlobFuncN bfN;
-        
-        /* compare type */
-        VBlobCompareFunc cf;
-
-        /* internal types */
-        void ( * bswap ) ( void*, const void*, uint64_t );
-
-    } u;
-
-    /* vector of VProduction input parameters */
-    Vector parms;
-
-    /* adaptive prefetch parameters */
-   int64_t start_id;
-   int64_t stop_id;
-};
-
-
-rc_t VFunctionProdMake ( VFunctionProd **prod, Vector *owned,
-    struct VCursor const *curs, int sub, const char *name,
-    const VFormatdecl *fd, const VTypedesc *desc, uint8_t chain );
-
-void VFunctionProdDestroy ( VFunctionProd *self );
-
-
-/* BuiltInComparison
- */
-rc_t VFunctionProdMakeBuiltInComp ( VProduction **prod, Vector *owned,
-    const char *name, struct VProdResolve const *resolve,
-    VProduction *orig, VProduction *test );
-
-
-/* Read
- */
-rc_t VFunctionProdRead ( VFunctionProd *self, struct VBlob **vblob, int64_t id , uint32_t cnt );
-
-
-/*--------------------------------------------------------------------------
- * VScriptProd
- *  function input params are VProduction*
- *  intermediate productions are also VProduction*
- */
-enum
-{
-    prodScriptFunction
-};
-
-typedef struct VScriptProd VScriptProd;
-struct VScriptProd
-{
-    VProduction dad;
-    VProduction *rtn;
-    Vector owned;
-    struct VCursor const *curs;
-};
-
-
-rc_t VScriptProdMake ( VScriptProd **prod, Vector *owned,
-    struct VCursor const *curs, int sub, const char *name, const VFormatdecl *fd,
-    const VTypedesc *desc, uint8_t chain );
-
-void VScriptProdDestroy ( VScriptProd *self );
-
-
-/* Read
- */
-rc_t VScriptProdRead ( VScriptProd *self,
-    struct VBlob **vblob, int64_t id, uint32_t cnt);
-
-
-/*--------------------------------------------------------------------------
- * VPhysicalProd
- *  adapts a VPhysical to VProduction
- */
-enum
-{
-    prodPhysicalOut,
-    prodPhysicalKCol
-};
-
-typedef struct VPhysicalProd VPhysicalProd;
-struct VPhysicalProd
-{
-    VProduction dad;
-    struct VPhysical *phys;
-};
-
-rc_t VPhysicalProdMake ( VProduction **prod, Vector *owned,
-    struct VCursor *curs, struct VPhysical *phys, int sub, const char *name,
-    const VFormatdecl *fd, const VTypedesc *desc );
-
-void VPhysicalProdDestroy ( VPhysicalProd *self );
-
-
-/* Read
- */
-rc_t VPhysicalProdRead ( VPhysicalProd *self,
-    struct VBlob **vblob, int64_t id, uint32_t cnt );
-
-rc_t VPhysicalProdColumnIdRange (const VPhysicalProd *self, int64_t *first, int64_t *last );
-
-uint32_t VPhysicalProdFixedRowLength(const VPhysicalProd *self, int64_t row_id );
-
-/*--------------------------------------------------------------------------
- * VColumnProd
- *  adapts a VColumn to VProduction
- */
-enum
-{
-    prodColumnOut
-};
-
-typedef struct VColumnProd VColumnProd;
-struct VColumnProd
-{
-    VProduction dad;
-    struct VColumn *col;
-};
-
-
-rc_t VColumnProdMake ( VProduction **prodp, Vector *owned,
-    struct VColumn *col, int sub, const char *name );
-
-void VColumnProdDestroy ( VColumnProd *self );
-
-
-/* Read
- */
-rc_t VColumnProdRead ( VColumnProd *self,
-    struct VBlob **vblob, int64_t id );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_prod_priv_ */
diff --git a/libs/vdb/prod.c b/libs/vdb/prod.c
deleted file mode 100644
index 2dce059..0000000
--- a/libs/vdb/prod.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-#define TRACK_REFERENCES 0
-
-#define KONST const
-#include "prod-priv.h"
-#include "prod-expr.h"
-#include "schema-priv.h"
-#include "schema-expr.h"
-#include "cursor-priv.h"
-#include "column-priv.h"
-#undef KONST
-
-#include <vdb/cursor.h>
-#include <klib/symbol.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-
-/*--------------------------------------------------------------------------
- * VProdResolve
- */
-
-/* ResolveColumn
- *  resolves a column using read expression
- */
-rc_t VProdResolveColumnRoot ( const VProdResolve *self,
-    VProduction **out, const SColumn *scol )
-{
-    rc_t rc = VProdResolveColumnRead ( self, out, scol );
-    if ( rc == 0 && * out <= FAILED_PRODUCTION )
-        return RC ( rcVDB, rcCursor, rcOpening, rcColumn, rcUndefined );
-    return rc;
-}
-
-rc_t VProdResolveColumn ( const VProdResolve *self,
-    VProduction **out, const SColumn *scol, bool alt )
-{
-    rc_t rc;
-    VColumn *vcol;
-    VCursor *curs = self -> curs;
-
-    if (alt) {
-        /* TODO: Generate warning message */
-        return RC(rcVDB, rcCursor, rcOpening, rcSchema, rcInvalid);
-    }
-    /* read-only cursor may add columns from schema */
-    vcol = VCursorCacheGet ( & curs -> col, & scol -> cid );
-    if ( vcol == NULL )
-    {
-        rc = VCursorMakeColumn ( curs, & vcol, scol, self -> cx_bind );
-        if ( rc != 0 )
-            return rc;
-
-#if OPEN_COLUMN_ALTERS_ROW
-        rc = VectorAppend ( & curs -> row, & vcol -> ord, vcol );
-        if ( rc != 0 )
-        {
-            VColumnWhack ( vcol, NULL );
-            return rc;
-        }
-#endif
-        rc = VCursorCacheSet ( & curs -> col, & scol -> cid, vcol );
-        if ( rc != 0 )
-        {
-#if OPEN_COLUMN_ALTERS_ROW
-            void *ignore;
-            VectorSwap ( & curs -> row, vcol -> ord, NULL, & ignore );
-            vcol -> ord = 0;
-#endif
-            VColumnWhack ( vcol, NULL );
-            return rc;
-        }
-    }
-
-    /* resolve for read production */
-    return VProdResolveColumnRead ( self, out, scol );
-}
-
-rc_t VProdResolvePhysical ( const VProdResolve *self, struct VPhysical *phys )
-{
-    return VProdResolvePhysicalRead ( self, phys );
-}
-
-/*--------------------------------------------------------------------------
- * VColumnProd
- *  message redirect to VColumn
- */
-
-rc_t VColumnProdMake ( VProduction **prodp, Vector *owned,
-    VColumn *col, int sub, const char *name )
-{
-    return RC ( rcVDB, rcColumn, rcReading, rcSchema, rcInvalid );
-}
-
-void VColumnProdDestroy ( VColumnProd *self )
-{
-}
-
-/* Read
- */
-rc_t VColumnProdRead ( VColumnProd *self, struct VBlob **vblob, int64_t id )
-{
-    return RC ( rcVDB, rcColumn, rcReading, rcSchema, rcInvalid );
-}
diff --git a/libs/vdb/range-validate.c b/libs/vdb/range-validate.c
deleted file mode 100644
index 9585c64..0000000
--- a/libs/vdb/range-validate.c
+++ /dev/null
@@ -1,195 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include "xform-priv.h"
-#include "blob.h"
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-
-typedef union {
-    /* integer */
-    int8_t i8[2];
-    int16_t i16[2];
-    int32_t i32[2];
-    int64_t i64[2];
-    
-    /* unsigned integer */
-    uint8_t u8[2];
-    uint16_t u16[2];
-    uint32_t u32[2];
-    uint64_t u64[2];
-    
-    /* floating point */
-    float f32[2];
-    double f64[2];
-} self_t;
-
-#define VALID_FUNC(FUNC, TYPE, VAL) \
-static rc_t CC FUNC(void *Self, const VXformInfo *info, int64_t row_id, VBlob **rslt, uint32_t argc, const VBlob *argv[]) { \
-    const self_t *self = Self; \
-    TYPE lower = self->VAL[0]; \
-    TYPE upper = self->VAL[1]; \
-    const TYPE *src = argv[0]->data.base; \
-    unsigned i; \
-    uint64_t n = argv[0]->data.elem_count; \
-\
-    for (i = 0; i != n; ++i) { \
-        TYPE val = src[i]; \
-\
-        if (val < lower || val > upper) \
-	    return RC(rcVDB, rcFunction, rcExecuting, rcConstraint, rcViolated); \
-    } \
-    *rslt = (VBlob *)argv[0]; \
-    (void)VBlobAddRef(*rslt); \
-    return 0; \
-}
-
-VALID_FUNC(valid_U8, uint8_t, u8)
-VALID_FUNC(valid_I8, int8_t, i8)
-VALID_FUNC(valid_U16, uint16_t, u16)
-VALID_FUNC(valid_I16, int16_t, i16)
-VALID_FUNC(valid_U32, uint32_t, u32)
-VALID_FUNC(valid_I32, int32_t, i32)
-VALID_FUNC(valid_U64, uint64_t, u64)
-VALID_FUNC(valid_I64, int64_t, i64)
-VALID_FUNC(valid_F32, float, f32)
-VALID_FUNC(valid_F64, double, f64)
-
-/* range_validate
- *  function < type T > T range_validate #1.0 < T lower, T upper > ( T in )
- */
-static
-void CC vfunc_free ( void * self )
-{
-    free (self);
-}
-
-VTRANSFACT_BUILTIN_IMPL(vdb_range_validate, 1, 0, 0) (const void *Self, const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rc_t rc = 0;
-    self_t *self;
-
-    /* check types */
-    switch (info->fdesc.desc.domain) {
-        case vtdInt:
-        case vtdUint:
-        case vtdFloat:
-            break;
-        default:
-            return RC(rcVDB, rcFunction, rcConstructing, rcType, rcInvalid);
-    }
-    switch (info->fdesc.desc.intrinsic_bits) {
-        case 8:
-        case 16:
-        case 32:
-        case 64:
-            break;
-        default:
-            return RC(rcVDB, rcFunction, rcConstructing, rcType, rcInvalid);
-    }
-    
-    self = malloc(sizeof(*self));
-    if (self == NULL)
-        return RC(rcVDB, rcFunction, rcConstructing, rcMemory, rcExhausted);
-    
-    rslt->self = self;
-    rslt->whack = vfunc_free;
-    rslt->variant = vftBlobN;
-    
-    switch (info->fdesc.desc.domain) {
-        case vtdInt:
-            switch (info->fdesc.desc.intrinsic_bits) {
-                case 8:
-                    VFUNCDESC_INTERNAL_FUNCS(rslt)->bfN = valid_I8;
-                    self->i8[0] = *cp->argv[0].data.i8;
-                    self->i8[1] = *cp->argv[1].data.i8;
-                    break;
-                case 16:
-                    VFUNCDESC_INTERNAL_FUNCS(rslt)->bfN = valid_I16;
-                    self->i16[0] = *cp->argv[0].data.i16;
-                    self->i16[1] = *cp->argv[1].data.i16;
-                    break;
-                case 32:
-                    VFUNCDESC_INTERNAL_FUNCS(rslt)->bfN = valid_I32;
-                    self->i32[0] = *cp->argv[0].data.i32;
-                    self->i32[1] = *cp->argv[1].data.i32;
-                    break;
-                case 64:
-                    VFUNCDESC_INTERNAL_FUNCS(rslt)->bfN = valid_I64;
-                    self->i64[0] = *cp->argv[0].data.i64;
-                    self->i64[1] = *cp->argv[1].data.i64;
-                    break;
-            }
-            break;
-        case vtdUint:
-            switch (info->fdesc.desc.intrinsic_bits) {
-                case 8:
-                    VFUNCDESC_INTERNAL_FUNCS(rslt)->bfN = valid_U8;
-                    self->u8[0] = *cp->argv[0].data.u8;
-                    self->u8[1] = *cp->argv[1].data.u8;
-                    break;
-                case 16:
-                    VFUNCDESC_INTERNAL_FUNCS(rslt)->bfN = valid_U16;
-                    self->u16[0] = *cp->argv[0].data.u16;
-                    self->u16[1] = *cp->argv[1].data.u16;
-                    break;
-                case 32:
-                    VFUNCDESC_INTERNAL_FUNCS(rslt)->bfN = valid_U32;
-                    self->u32[0] = *cp->argv[0].data.u32;
-                    self->u32[1] = *cp->argv[1].data.u32;
-                    break;
-                case 64:
-                    VFUNCDESC_INTERNAL_FUNCS(rslt)->bfN = valid_U64;
-                    self->u64[0] = *cp->argv[0].data.u64;
-                    self->u64[1] = *cp->argv[1].data.u64;
-                    break;
-            }
-            break;
-        case vtdFloat:
-            switch (info->fdesc.desc.intrinsic_bits) {
-                case 32:
-                    VFUNCDESC_INTERNAL_FUNCS(rslt)->bfN = valid_F32;
-                    self->f32[0] = *cp->argv[0].data.f32;
-                    self->f32[1] = *cp->argv[1].data.f32;
-                    break;
-                case 64:
-                    VFUNCDESC_INTERNAL_FUNCS(rslt)->bfN = valid_F64;
-                    self->f64[0] = *cp->argv[0].data.f64;
-                    self->f64[1] = *cp->argv[1].data.f64;
-                    break;
-            }
-            break;
-    }
-    return rc;
-}
diff --git a/libs/vdb/redimension.c b/libs/vdb/redimension.c
deleted file mode 100644
index 3e22dfe..0000000
--- a/libs/vdb/redimension.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-#include "blob.h"
-
-#include "blob-headers.h"
-#include "page-map.h"
-#include "blob-priv.h"
-#include "xform-priv.h"
-
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-#include <atomic32.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <assert.h>
-
-typedef struct self_t {
-    uint32_t elem_bits;
-} self_t;
-
-static
-rc_t CC redimension_drvr(
-                      void *Self,
-                      const VXformInfo *info,
-                      int64_t row_id,
-                      VBlob **rslt,
-                      uint32_t argc, const VBlob *argv[]
-) {
-    rc_t rc;
-    const self_t *self = (const self_t *)Self;
-    const VBlob *src = argv[0];
-    VBlob *y;
-    
-    rc = VBlobNew(&y, src->start_id, src->stop_id, "redimension");
-    if (rc)
-        return rc;
-    
-    rc = KDataBufferCast(&src->data, &y->data, self->elem_bits, false);
-    if (rc == 0) {
-        y->byte_order = src->byte_order;
-        PageMapAddRef(y->pm = src->pm);
-	y->pm->optimized = eBlobPageMapOptimizedFailed; /** pagemap is no longer valid; prevent optimization ***/
-        BlobHeadersAddRef(y->headers = src->headers);
-        
-        *rslt = y;
-        return 0;
-    }
-	return rc;
-}
-static
-void CC vfunc_free ( void * self )
-{
-    free ( self );
-}
-
-#include <stdio.h>
-
-VTRANSFACT_BUILTIN_IMPL(vdb_redimension, 1, 0, 0) (
-                                           const void *Self,
-                                           const VXfactInfo *info,
-                                           VFuncDesc *rslt,
-                                           const VFactoryParams *cp,
-                                           const VFunctionParams *dp
-) {
-    self_t *self;
-    
-    self = malloc(sizeof(*self));
-    if (self) {
-        self->elem_bits = VTypedescSizeof(&info->fdesc.desc);
-        
-        rslt->self = self;
-        rslt->whack = vfunc_free;
-        rslt->variant = vftBlobN;
-        VFUNCDESC_INTERNAL_FUNCS(rslt)->bfN = redimension_drvr;
-        return 0;
-    }
-    return RC(rcVDB, rcFunction, rcConstructing, rcMemory, rcExhausted);
-}
diff --git a/libs/vdb/report-vdb.c b/libs/vdb/report-vdb.c
deleted file mode 100644
index 58a263c..0000000
--- a/libs/vdb/report-vdb.c
+++ /dev/null
@@ -1,856 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#include <klib/report.h> /* ReportInit */
-#include <klib/time.h> /* KTime */
-#include <klib/namelist.h> /* KNamelistRelease */
-#include <klib/out.h> /* OUTMSG */
-#include <klib/klib-priv.h> /* ReportFuncs */
-
-#include <vdb/report.h> /* ... */
-#include <vdb/manager.h> /* VDBManagerVersion */
-#include <vdb/vdb-priv.h> /* VTableOpenKTableRead */
-#include <vdb/database.h> /* VDatabaseRelease */
-#include <vdb/table.h> /* VTableOpenParentRead */
-#include <vdb/dependencies.h> /* VDBDependenciesRelease */
-
-#include <kdb/kdb-priv.h> /* KDatabaseGetPath */
-#include <kdb/manager.h> /* kptDatabase */
-#include <kdb/database.h> /* KDatabaseRelease */
-#include <kdb/table.h> /* KTableRelease */
-
-#include <kfs/dyload.h> /* KDyld */
-#include <kfs/file.h> /* KFileRead */
-#include <kfs/nullfile.h> /* KFileMakeNullUpdate */
-#include <kfs/md5.h> /* KMD5SumFmt */
-
-#include <atomic.h>
-
-#include <stdarg.h> /* va_start */
-#include <stdio.h> /* sprintf */
-#include <stdlib.h> /* malloc */
-#include <string.h> /* memset */
-#include <limits.h> /* PATH_MAX */
-#include <assert.h>
-
-#ifndef PATH_MAX
-#define PATH_MAX 4096
-#endif
-
-#define RELEASE(type, obj) do { rc_t rc2 = type##Release(obj); \
-    if (rc2 && !rc) { rc = rc2; } obj = NULL; } while (false)
-
-/*
- * An unrecoverable error happened.
- * We can help to solve it
- * by reporting information about known application execution environment.
- */
-
-typedef struct Report {
-    const VDBManager* mgr;
-    const VDatabase* db;
-    const VTable* table;
-} Report;
-
-static Report *report_singleton;
-
-static rc_t CC ReportRelease ( void )
-{
-    rc_t rc = 0;
-    Report *prev_report, *cur_report;
-
-    cur_report = report_singleton;
-    do
-    {
-        prev_report = cur_report;
-        cur_report = atomic_test_and_set_ptr ( ( void* volatile* ) & report_singleton, NULL, prev_report );
-    }
-    while ( cur_report != prev_report );
-
-    if ( cur_report != NULL )
-    {
-        /* cleanup */
-        VTableRelease ( cur_report -> table );
-        VDatabaseRelease ( cur_report -> db );
-        VDBManagerRelease ( cur_report -> mgr );
-        memset ( cur_report, 0, sizeof * cur_report );
-    }
-
-    return rc;
-}
-
-static rc_t CC ReportObj(const ReportFuncs *f, uint32_t indent,
-    const char *path, bool *wasDbOrTableSet);
-static rc_t CC ReportSOFTWARE ( const ReportFuncs *f, uint32_t indent, const char *argv_0, const char *date, ver_t tool_ver );
-
-static rc_t ReportGet(Report** self)
-{
-    rc_t rc = 0;
-
-    static bool latch;
-    if ( ! latch )
-    {
-        static Report self;
-
-        rc = ReportInitVDB ( ReportObj, ReportSOFTWARE, ReportRelease );
-        if ( rc == 0 )
-        {
-            report_singleton = & self;
-            latch = true;
-        }
-    }
-
-    * self = ( Report* ) report_singleton;
-
-    return rc;
-}
-
-#define report ( * f -> report )
-#define reportData ( * f -> reportData )
-#define reportData1 ( * f -> reportData1 )
-#define reportOpen ( * f -> reportOpen )
-#define reportOpen1 ( * f -> reportOpen1 )
-#define reportClose ( * f -> reportClose )
-#define reportClose1 ( * f -> reportClose1 )
-#define reportError ( * f -> reportError )
-#define reportErrorStr ( * f -> reportErrorStr )
-#define reportErrorStrImpl ( * f -> reportErrorStrImpl )
-#define reportErrorStrInt ( * f -> reportErrorStrInt )
-#define reportError3Str ( * f -> reportError3Str )
-
-static
-rc_t ReportBuild(const ReportFuncs *f, uint32_t indent, bool dynamic, const VDBManager* mgr)
-{
-    rc_t rc = 0;
-    if (!dynamic)
-    {   report(indent, "Build", 1, "static", 's', "true"); }
-    else {
-        KNamelist* list = NULL;
-        reportOpen(indent, "Build", 1, "static", 's', "false");
-        if (mgr) {
-            rc_t rc2 = VDBManagerListExternalSchemaModules(mgr, &list);
-            if (rc2 != 0) {
-                reportError
-                    (indent + 1, rc2, "VDBManagerListExternalSchemaModules");
-                if (rc == 0 && rc2 != 0)
-                {   rc = rc2; }
-            }
-            else {
-                uint32_t count = 0;
-                rc2 = KNamelistCount(list, &count);
-                if (rc2 != 0) {
-                    reportErrorStr(indent + 1, rc2, "KNamelistCount", "origin",
-                        "VDBManagerListExternalSchemaModules");
-                    if (rc == 0 && rc2 != 0)
-                    {   rc = rc2; }
-                }
-                else {
-                    int64_t i = 0;
-                    for (i = 0; i < count && rc2 == 0; ++i) {
-                        const char* name = NULL;
-                        rc2 = KNamelistGet(list, i, &name);
-                        if (rc2 != 0) {
-                            reportErrorStr(
-                                indent + 1, rc2, "KNamelistGet", "origin",
-                                "VDBManagerListExternalSchemaModules");
-                            if (rc == 0 && rc2 != 0)
-                            {   rc = rc2; }
-                        }
-                        else {
-                            report(indent + 1, "Module", 1, "name", 's', name);
-                        }
-                    }
-                }
-            }
-        }
-        RELEASE(KNamelist, list);
-        reportClose(indent, "Build");
-    }
-    return rc;
-}
-
-static rc_t VDBDependenciesReportDepend1(const VDBDependencies *self,
-    const ReportFuncs *f,
-    uint32_t count, uint32_t indent, bool toreport, uint32_t *missing)
-{
-    KDirectory *dir = NULL;
-    rc_t rc = 0;
-    uint32_t i = ~0;
-
-    assert(missing);
-
-    *missing = 0;
-
-    for (i = 0; i < count; ++i) {
-        bool isMissing = false;
-        bool local = false;
-        const char* seq_id = "";
-        const char* path = NULL;
-        rc = VDBDependenciesSeqId(self, &seq_id, i);
-        if (rc != 0 && toreport)
-            reportErrorStrInt(indent, rc, "VDBDependenciesSeqId",
-                "origin", "VDatabaseListDependencies", "idx", i);
-        if (rc == 0) {
-            rc = VDBDependenciesLocal(self, &local, i);
-            if (rc != 0 && toreport) {
-                reportErrorStrInt(indent, rc,
-                    "VDBDependenciesLocal",
-                    "origin", "VDatabaseListDependencies", "idx", i);
-            }
-        }
-        if (rc == 0) {
-            rc = VDBDependenciesPath(self, &path, i);
-            if (rc != 0 && toreport) {
-                reportErrorStrInt(indent, rc, "VDBDependenciesPath",
-                    "origin", "VDatabaseListDependencies", "idx", i);
-            }
-        }
-        if (rc == 0) {
-            if (!local && (path == NULL || path[0] == '\0')) {
-                isMissing = true;
-                ++*missing;
-            }
-            if (toreport) {
-                bool reported = false;
-                if (!isMissing && !local)  {
-                    rc_t rc = 0;
-                    bool readable = false;
-                    uint64_t size = ~0;
-                    KTime_t date = 0;
-                    bool ready = false;
-                    if (dir == NULL)
-                    {   rc = KDirectoryNativeDir(&dir); }
-                    assert(!local && path && path[0]);
-                    if (dir != NULL) {
-                        rc = KDirectoryFileSize(dir, &size, path);
-                        if (rc == 0)
-                        {   rc = KDirectoryDate(dir, &date, path); }
-                        if (rc == 0) {
-                            const KFile* f = NULL;
-                            rc = KDirectoryOpenFileRead(dir, &f, path);
-                            if (rc == 0) {
-                                char buffer[1024];
-                                size_t num_read = 0;
-                                size_t bsize =
-                                    size > sizeof buffer ? sizeof buffer : size;
-                                rc = KFileReadAll(f,
-                                    0, buffer, bsize, &num_read);
-                                if (rc == 0 && num_read != bsize) {
-                                    rc = RC(rcVDB, rcFile, rcReading,
-                                        rcBuffer, rcExcessive);
-                                }
-                                if (rc == 0)
-                                {   readable = true; }
-                            }
-                            KFileRelease(f);
-                        }
-                        if (rc == 0)
-                        {   ready = true; }
-                    }
-                    if (ready) {
-                        KTime kt;
-                        memset(&kt, 0, sizeof kt);
-                        KTimeLocal(&kt, date);
-                        report(indent, "Dependency", 7,
-                            "index", 'd', i,
-                            "seq_id", 's', seq_id,
-                            "local", 's', local ? "true" : "false",
-                            "path", 's', path,
-                            "size", 'u', size,
-                            "date", 'T', &kt,
-                            "readable", 's', readable ? "true" : "false");
-                        reported = true;
-                    }
-                    else {
-                        report(indent, "Dependency", 5,
-                            "index", 'd', i,
-                            "seq_id", 's', seq_id,
-                            "local", 's', local ? "true" : "false",
-                            "path", 's', path,
-                            "error", 'R', rc);
-                        reported = true;
-                    }
-                }
-                if (!reported) {
-                    report(indent, "Dependency", 4,
-                        "index", 'd', i,
-                        "seq_id", 's', seq_id,
-                        "local", 's', local ? "true" : "false",
-                        "path", 's', path == NULL ? "" : path);
-                }
-            }
-        }
-        if (rc != 0 && !toreport)
-        {   break; }
-    }
-
-    RELEASE(KDirectory, dir);
-
-    return rc;
-}
-
-static rc_t ReportDepend(const ReportFuncs *f,
-    uint32_t indent, const VDatabase* db)
-{
-    rc_t rc = 0;
-
-    const VDBDependencies* dep = NULL;
-
-    const char tag[] = "Dependencies";
-
-    assert(db);
-
-    reportOpen(indent, tag, 0);
-
-    rc = VDatabaseListDependencies(db, &dep, false);
-    if (rc != 0) {
-        reportError(indent + 1, rc, "VDatabaseListDependencies");
-    }
-    else {
-        uint32_t count = 0;
-        rc = VDBDependenciesCount(dep, &count);
-        if (rc != 0) { 
-            reportError(indent + 1, rc, "VDBDependenciesCount");
-        }
-        else {
-            uint32_t missing = 0;
-            const char tag[] = "List";
-            rc = VDBDependenciesReportDepend1(dep, f,
-                count, indent + 2, false, &missing);
-
-            if (rc == 0) {
-                reportOpen(indent + 1, tag, 2, "count", 'd', count,
-                    "missing", 'd', missing);
-            }
-            else {
-                reportOpen(indent + 1, tag, 1, "count", 'd', count);
-            }
-            
-            rc = VDBDependenciesReportDepend1(dep, f,
-                count, indent + 2, true, &missing);
-            reportClose(indent + 1, tag);
-        }
-    }
-
-    reportClose(indent, tag);
-
-    RELEASE(VDBDependencies, dep);
-
-    return rc;
-}
-
-typedef struct Total {
-    int64_t sz;
-    int64_t files;
-} Total;
-
-static rc_t CC visitor(const KDirectory* dir,
-    uint32_t type, const char* name, void* data)
-{
-    rc_t rc = 0;
-    Total* total = (Total*) data;
-    if (type & kptAlias)
-    {   return rc; }
-    assert(total);
-    switch (type) {
-        case kptFile: {
-            uint64_t size = 0;
-            rc = KDirectoryFileSize(dir, &size, name);
-            if (rc == 0) {
-                total->sz += size;
-            }
-            ++total->files;
-            break;
-        }
-        case kptDir: 
-            rc = KDirectoryVisit(dir, false, visitor, total, name);
-            break;
-        default:
-            rc = RC(rcVDB, rcDirectory, rcVisiting, rcType, rcUnexpected);
-            break;
-    }
-    return rc;
-}
-
-static rc_t ReportDir(const ReportFuncs *f, uint32_t indent, const KTable* tbl) {
-    rc_t rc = 0;
-    const KDirectory* dir = NULL;
-    if (tbl == NULL) {
-        report(indent, "Error", 1, "KTable" , 's', "NULL");
-        return rc;
-    }
-    rc = KTableOpenDirectoryRead(tbl, &dir);
-    if (rc != 0) {
-        reportError(indent, rc, "KTableOpenDirectoryRead");
-    }
-    else {
-        Total total;
-        memset(&total, 0, sizeof total);
-        rc = KDirectoryVisit(dir, false, visitor, &total, NULL);
-        report(indent, "Directory", 2,
-            "size", 'l', total.sz, "files", 'l', total.files);
-    }
-    RELEASE(KDirectory, dir);
-    return rc;
-}
-
-#define OBJ_OPEN(indent,count,path,type) reportOpen(indent, "Object", count, \
-    "path", 's', path, "type", 's', type
-#define OBJ_P_OPEN(indent,count,path,type,file_type) \
-    OBJ_OPEN(indent, count, path, type), "fs_type", 's', file_type
-
-#define OBJ(indent,path,type) \
-    OBJ_OPEN(indent, 2, path, type) )
-#define OBJ_P(indent,path,type,file_type) \
-    OBJ_P_OPEN(indent, 3, path, type, file_type) )
-#define OBJ_P_A(indent,path,type,file_type) \
-    OBJ_P_OPEN(indent, 4, path, type, file_type), "alias", 's', "true")
-#define OBJ_P_S(indent,path,type,file_type,size) \
-    OBJ_P_OPEN(indent, 4, path, type, file_type), "size", 'l', size)
-#define OBJ_P_S_A(indent,path,type,file_type,size) \
-    OBJ_P_OPEN(indent, 5, path, type, file_type), "size", 'l', size, \
-                                                  "alias", 's', "true")
-
-static rc_t CC ReportObj(const ReportFuncs *f, uint32_t indent,
-    const char *object, bool *wasDbOrTableSet)
-{
-    Report* self = NULL;
-    const char* fullpath = NULL;
-    const KDatabase* kdb = NULL;
-    const KTable* ktbl = NULL;
-    const VDatabase* db = NULL;
-    KPathType type = kptNotFound;
-    KPathType file_type = kptNotFound;
-    bool alias = false;
-    uint64_t size = 0;
-    bool size_unknown = true;
-
-    rc_t rc = ReportGet(&self);
-    assert(self);
-
-    if (wasDbOrTableSet != NULL) {
-        *wasDbOrTableSet = self->db != NULL || self->table != NULL;
-        return 0;
-    }
-
-    if (self->db != NULL) {
-        type = kptDatabase;
-        db = self->db;
-    }
-    else if (self->table != NULL) {
-        rc_t rc2 = VTableOpenParentRead(self->table, &db);
-        if (rc2)
-        {
-            if (rc == 0)
-            {
-                rc = rc2;
-            }
-        }
-        else if (!db)
-        {
-            type = kptTable;
-            rc2 = VTableGetKTableRead(self->table, &ktbl);
-            if (rc2)
-            {
-                if (rc == 0)
-                {
-                    rc = rc2;
-                }
-            }
-            else
-            {
-                rc2 = KTableGetPath(ktbl, &fullpath);
-            }
-        }
-    }
-
-    if (db) {
-        rc_t rc2 = VDatabaseOpenKDatabaseRead(db, &kdb);
-        type = kptDatabase;
-        if (rc2) {
-            if (rc == 0)
-            {   rc = rc2; }
-        }
-        else {
-            rc2 = KDatabaseGetPath(kdb, &fullpath);
-            if (rc2) {
-                if (rc == 0)
-                {   rc = rc2; }
-            }
-        }
-    }
-
-    if (fullpath) {
-        KDirectory* dir = NULL;
-        rc_t rc2 = KDirectoryNativeDir(&dir);
-        if (rc2) {
-            if (rc == 0)
-            {   rc = rc2; }
-        }
-        else {
-            file_type = KDirectoryPathType(dir, fullpath);
-            alias = file_type & kptAlias;
-            file_type &= ~kptAlias;
-            if (file_type == kptFile) {
-                rc2 = KDirectoryFileSize(dir, &size, fullpath);
-                if (rc2) {
-                    if (rc == 0)
-                    {   rc = rc2; }
-                }
-                else {  size_unknown = false; }
-            }
-        }
-        RELEASE(KDirectory, dir);
-    }
-
-    if (object || type != kptNotFound) {
-        const char* path
-            = fullpath ? fullpath : object ? object : "not set";
-        const char* stype = type == kptTable ? "table" : 
-            type == kptDatabase ? "database" : "unknown";
-        const char* sfile_type = file_type == kptFile ? "archive" : 
-            file_type == kptDir ? "dir" : "unexpected";
-
-        if (fullpath && !size_unknown) {
-            if (alias)
-            { OBJ_P_S_A(indent, path, stype, sfile_type, size); }
-            else
-            { OBJ_P_S  (indent, path, stype, sfile_type, size); }
-        }
-        else if (fullpath && size_unknown) {
-            if (alias)
-            { OBJ_P_A  (indent, path, stype, sfile_type); }
-            else
-            { OBJ_P    (indent, path, stype, sfile_type); }
-        }
-        else
-        {     OBJ      (indent, path, stype); }
-
-        if (!db)
-        {   db = self->db; }
-
-        if (db) {
-            rc_t rc2 = ReportDepend(f, indent + 1, db);
-            if (rc == 0)
-            {   rc = rc2; }
-        }
-        if (file_type == kptDir) {
-            rc_t rc2 = ReportDir(f, indent + 1, ktbl);
-            if (rc == 0)
-            {   rc = rc2; }
-        }
-
-        reportClose(indent, "Object");
-    }
-
-    if (db != self->db)
-    {   RELEASE(VDatabase, db); }
-    RELEASE(KTable, ktbl);
-    RELEASE(KDatabase, kdb);
-
-    return rc;
-}
-
-#ifdef _STATIC
-
-static
-rc_t md5(const char* path, uint8_t digest[16], const KDirectory* dir)
-{
-    const KFile* kf = NULL;
-    rc_t rc = KDirectoryOpenFileRead(dir, &kf, path);
-    if (rc == 0) {
-        KFile* fnull = NULL;
-        rc = KFileMakeNullUpdate(&fnull);
-        if (rc == 0) {
-            KMD5SumFmt* fmt = NULL;
-            rc = KMD5SumFmtMakeUpdate(&fmt, fnull);
-            if (rc == 0) {
-                const KFile* md5 = NULL;
-                rc = KFileMakeNewMD5Read(&md5, kf, fmt, path);
-                if (rc == 0) {
-                    uint64_t ps = 0;
-                    char buffer[512];
-                    size_t read = 0;
-                    do {
-                        rc = KFileRead(md5, ps, buffer, sizeof buffer, &read);
-                        if (rc == 0)
-                        {   ps += read; }
-                    } while (rc == 0 && read > 0);
-                    if (rc == 0) {
-                        bool bin;
-                        rc = KMD5SumFmtFind(fmt, path, digest, &bin);
-                    }
-                }
-                RELEASE(KFile, md5);
-            }
-            RELEASE(KMD5SumFmt, fmt);
-        }
-/*      RELEASE(KFile, fnull); fnull is released by KMD5SumFmt* fmt */
-    }
-/*  RELEASE(KFile, kf); kf is released by KFile* md5 */
-    return rc;
-}
-
-static
-rc_t ReportAlias(const ReportFuncs *f, uint32_t indent, const char* alias, const KDirectory* dir)
-{
-    char resolved[PATH_MAX + 1];
-    rc_t rc
-        = KDirectoryResolveAlias(dir, false, resolved, sizeof resolved, alias);
-    if (rc == 0) {
-        const char tag[] = "Alias";
-        uint32_t type = KDirectoryPathType(dir, resolved);
-        if (type & kptAlias) {
-            reportOpen(indent, tag, 1, "resolved", 's', resolved);
-            rc = ReportAlias(f, indent + 1, resolved, dir);
-            reportClose(indent, tag);
-        }
-        else
-        {   report(indent, tag, 1, "resolved", 's', resolved); }
-    }
-    return rc;
-}
-
-static rc_t ReportBinary(const ReportFuncs *f, uint32_t indent, const char* argv0) {
-    rc_t rc = 0;
-#ifdef _STATIC
-    KDyld *dyld = NULL;
-    assert(argv0);
-    rc = KDyldMake(&dyld);
-    if (rc != 0) {
-        reportError(indent + 1, rc, "KDyldMake");
-    }
-    else {
-        const KDirectory* dir = NULL;
-        rc = KDyldHomeDirectory(dyld, &dir, (fptr_t) ReportFinalize);
-        if (rc != 0) {
-            reportError(indent + 1, rc, "KDyldHomeDirectory");
-        }
-        else {
-            char binary[PATH_MAX + 1];
-            const char* name = strpbrk(argv0, "/\\");
-            const char* last_name = name;
-            if (last_name)
-            {   ++last_name; }
-            while (name) {
-                name = strpbrk(last_name, "/\\");
-                if (name) {
-                    last_name = name;
-                    if (last_name)
-                    {   ++last_name; }
-                }
-            }
-            name = last_name ? last_name : argv0;
-            rc = KDirectoryResolvePath(dir, true, binary, sizeof binary, name);
-            if (rc != 0) {
-                reportErrorStr(indent + 1, rc, "KDirectoryResolvePath",
-                    "origin", "KDyldHomeDirectory");
-            }
-            else {
-                bool found = false;
-                const char tag[] = "Binary";
-                const char* sType = NULL;
-                uint8_t digest[16];
-                uint32_t type = KDirectoryPathType(dir, binary);
-                switch (type & ~kptAlias) {
-                    case kptFile:
-                        sType = type & kptAlias ? "alias" : "file";
-                        found = true;
-                        break;
-                    case kptNotFound:
-                        sType = "not found";
-                        break;
-                    default:
-                        sType = "unknown";
-                        break;
-                }
-                if (found)
-                {   rc = md5(name, digest, dir); }
-                if (type & kptAlias) {
-                    if (found && rc == 0)  {
-                        reportOpen(indent, tag, 3, "path", 's', binary,
-                            "type", 's', sType, "md5", 'M', digest);
-                    }
-                    else {
-                        reportOpen(indent, tag, 2, "path", 's', binary,
-                            "type", 's', sType);
-                    }
-                    if (rc == 0 && type & kptAlias)
-                    {   rc = ReportAlias(f, indent + 1, name, dir); }
-                    reportClose(indent, tag);
-                }
-                else {
-                    if (found && rc == 0)  {
-                        report(indent, tag, 3, "path", 's', binary,
-                            "type", 's', sType, "md5", 'M', digest);
-                    }
-                    else {
-                        report(indent, tag, 2, "path", 's', binary,
-                            "type", 's', sType);
-                    }
-                }
-            }
-        }
-        RELEASE(KDirectory, dir);
-    }
-    RELEASE(KDyld, dyld);
-#endif
-    return rc;
-}
-#endif
-
-static rc_t CC ReportSOFTWARE(const ReportFuncs *f, uint32_t indent, const char *argv_0, const char *date, ver_t tool_ver ) {
-    rc_t rc = 0;
-
-    Report* self = NULL;
-    ReportGet(&self);
-    assert(self);
-
-    reportOpen(indent, "SOFTWARE", 0);
-
-    if (self->mgr) {
-        uint32_t version = 0;
-        rc = VDBManagerVersion(self->mgr, &version);
-        if (rc != 0) {
-            reportOpen(indent + 1, "Library", 0);
-            reportError(indent + 2, rc, "VDBManagerVersion");
-            reportClose(indent + 1, "Library");
-        }
-        else { report(indent + 1, "VDBLibrary", 1, "vers", 'V', version); }
-    }
-
-    {
-#ifdef _STATIC
-        bool dynamic = false;
-#else
-        bool dynamic = true;
-#endif
-
-        rc_t rc2 = ReportBuild(f, indent + 1, dynamic, self->mgr);
-        if (rc == 0 && rc2 != 0)
-        {   rc = rc2; }
-    }
-
-    if (argv_0) {
-        const char tag[] = "Tool";
-#ifdef _STATIC
-        reportOpen(indent + 1, tag, 3, "date", 's', date,
-                   "name", 's', argv_0, "vers", 'V', tool_ver);
-        {
-            rc_t rc2 = ReportBinary(f, indent + 2, argv_0);
-            if (rc == 0 && rc2 != 0)
-            {   rc = rc2; }
-        }
-        reportClose(indent + 1, tag);
-#else
-        report(indent + 1, tag, 3, "date", 's', date,
-                   "name", 's', argv_0, "vers", 'V', tool_ver);
-#endif
-    }
-
-    reportClose(indent, "SOFTWARE");
-
-    return rc;
-}
-
-
-
-/* SetVDBManager
- *  remember the manager in use
- */
-LIB_EXPORT rc_t CC ReportSetVDBManager(const VDBManager *mgr) {
-    rc_t rc = 0;
-
-    Report* self = NULL;
-    ReportGet(&self);
-    if ( self != NULL )
-    {
-        rc = VDBManagerAddRef ( mgr );
-        if ( rc == 0 )
-        {
-            rc = VDBManagerRelease ( self -> mgr );
-            if ( rc != 0 )
-                VDBManagerRelease ( mgr );
-            else
-                self -> mgr = mgr;
-        }
-    }
-    return rc;
-}
-
-
-/* SetDatabase
- *  call it if you work with Database
- *
- *  "path" [ IN ] - path to the database that is used to access it
- */
-LIB_EXPORT rc_t CC ReportResetDatabase ( const char *path, const VDatabase *db )
-{
-    rc_t rc = 0;
-
-    Report* self = NULL;
-    ReportGet(&self);
-    if ( self != NULL )
-    {
-        rc = VDatabaseAddRef ( db );
-        if ( rc == 0 )
-        {
-            VTableRelease ( self -> table ), self -> table = NULL;
-            VDatabaseRelease ( self -> db );
-            self -> db = db;
-        }
-    }
-
-    return rc;
-}
-
-
-/* SetTable
- *  call it if you work with Table
- *
- *  "path" [ IN ] - path to the table that is used to access it
- */
-LIB_EXPORT rc_t CC ReportResetTable ( const char *path, const VTable *tbl )
-{
-    rc_t rc = 0;
-
-    Report* self = NULL;
-    ReportGet(&self);
-    if ( self != NULL )
-    {
-        rc = VTableAddRef ( tbl );
-        if ( rc == 0 )
-        {
-            VDatabaseRelease ( self -> db ), self -> db = NULL;
-            VTableRelease ( self -> table );
-            self -> table = tbl;
-        }
-    }
-
-    return rc;
-}
diff --git a/libs/vdb/row-id.c b/libs/vdb/row-id.c
deleted file mode 100644
index a5996f2..0000000
--- a/libs/vdb/row-id.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <klib/data-buffer.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <sysalloc.h>
-#include "xform-priv.h"
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-
-static
-rc_t CC row_id_func ( void *self, const VXformInfo *info,
-    int64_t row_id, VRowResult *rslt, uint32_t argc, const VRowData in [] )
-{
-    assert ( rslt -> data -> elem_bits == 64 );
-    if ( rslt -> data -> elem_count == 0 )
-    {
-        rc_t rc = KDataBufferResize ( rslt -> data, 1 );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    * ( int64_t* ) rslt -> data -> base = row_id;
-    rslt -> elem_count = 1;
-
-    return 0;
-}
-
-VTRANSFACT_BUILTIN_IMPL ( vdb_row_id, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt -> variant = vftNonDetRow;
-    rslt -> u . ndf = row_id_func;
-    return 0;
-}
diff --git a/libs/vdb/row-len.c b/libs/vdb/row-len.c
deleted file mode 100644
index e2a6484..0000000
--- a/libs/vdb/row-len.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <klib/data-buffer.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <sysalloc.h>
-#include "xform-priv.h"
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-
-static
-rc_t CC row_len_func ( void *self, const VXformInfo *info,
-    int64_t row_id, VRowResult *rslt, uint32_t argc, const VRowData in[] )
-{
-    assert ( rslt -> data -> elem_bits == 32 );
-    if ( rslt -> data -> elem_count == 0 )
-    {
-        rc_t rc = KDataBufferResize ( rslt -> data, 1 );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    /* for the moment row length are 32-bit */
-    * ( uint32_t* ) rslt -> data -> base = (uint32_t)in [ 0 ] . u . data . elem_count;
-    rslt -> elem_count = 1;
-
-    return 0;
-}
-
-VTRANSFACT_BUILTIN_IMPL ( vdb_row_len, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt -> variant = vftRow;
-    rslt -> u . rf = row_len_func;
-    return 0;
-}
diff --git a/libs/vdb/schema-db.c b/libs/vdb/schema-db.c
deleted file mode 100644
index 5db6156..0000000
--- a/libs/vdb/schema-db.c
+++ /dev/null
@@ -1,746 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#include "schema-priv.h"
-#include "schema-parse.h"
-#include "schema-dump.h"
-#include "dbmgr-priv.h"
-
-#include <klib/symbol.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * STblMember
- *  table member
- */
-
-/* Mark
- */
-static
-void CC STblMemberMark ( void * item, void * data )
-{
-    const STblMember * self = item;
-    if ( item != NULL )
-        STableMark ( ( void * )self -> tbl, data );
-}
-
-/* Dump
- */
-bool CC STblMemberDefDump ( void *item, void *dumper )
-{
-    SDumper *b = dumper;
-    STblMember *self = item;
-
-    b -> rc = SDumperPrint ( b, "\ttable " );
-    if ( b -> rc == 0 )
-        b -> rc = STableDump ( self -> tbl, b );
-    if ( b -> rc == 0 )
-        b -> rc = SDumperPrint ( b, " %N;\n", self -> name );
-
-    return ( b -> rc != 0 ) ? true : false;
-}
-
-rc_t STblMemberDump ( const STblMember *self, SDumper *d )
-{
-    return FQNDump ( self != NULL ? self -> name : NULL, d );
-}
-
-
-/*--------------------------------------------------------------------------
- * SDBMember
- *  sub-db member
- */
-
-/* Find
- */
-SDBMember * CC SDatabaseFindDB ( const SDatabase *self, const char *name );
-
-/* Mark
- */
-static
-void CC SDBMemberMark ( void * item, void * data )
-{
-    const SDBMember * self = item;
-    if ( self != NULL )
-        SDatabaseMark ( ( void * )self -> db, data );
-}
-
-/* Dump
- */
-bool CC SDBMemberDefDump ( void *item, void *dumper )
-{
-    SDumper *b = dumper;
-    SDBMember *self = item;
-
-    b -> rc = SDumperPrint ( b, "\tdatabase " );
-    if ( b -> rc == 0 )
-        b -> rc = SDatabaseDump ( self -> db, b );
-    if ( b -> rc == 0 )
-        b -> rc = SDumperPrint ( b, " %N;\n", self -> name );
-
-    return ( b -> rc != 0 ) ? true : false;
-}
-
-rc_t SDBMemberDump ( const SDBMember *self, SDumper *d )
-{
-    return FQNDump ( self != NULL ? self -> name : NULL, d );
-}
-
-
-/*--------------------------------------------------------------------------
- * SDatabase
- *  database declaration
- */
-
-#if SLVL >= 6
-
-/* Whack
- */
-void CC SDatabaseWhack ( void *item, void *ignore )
-{
-    SDatabase *self = item;
-
-    BSTreeWhack ( & self -> scope, KSymbolWhack, NULL );
-    VectorWhack ( & self -> db, SDBMemberWhack, NULL );
-    VectorWhack ( & self -> tbl, STblMemberWhack, NULL );
-
-    free ( self );
-}
-
-/* Cmp
- * Sort
- */
-int CC SDatabaseCmp ( const void *item, const void *n )
-{
-    const uint32_t *a = item;
-    const SDatabase *b = n;
-
-    if ( * a > b -> version )
-        return 1;
-    return ( int ) ( * a >> 24 ) - ( int ) ( b -> version >> 24 );
-}
-
-int CC SDatabaseSort ( const void *item, const void *n )
-{
-    const SDatabase *a = item;
-    const SDatabase *b = n;
-
-    return ( int ) ( a -> version >> 24 ) - ( int ) ( b -> version >> 24 );
-}
-
-static
-rc_t SDatabaseCompare ( const SDatabase *a, const SDatabase *b, const SDatabase **newer, bool exhaustive )
-{
-    assert ( ( a -> version >> 24 ) == ( b -> version >> 24 ) );
-
-    * newer = a -> version >= b -> version ? a : b;
-
-    /* TBD - more exhaustive comparison */
-
-    return 0;
-}
-
-/* Find
- *  generic object find within database scope
- *
- *  "name" [ OUT ] - returns list of overloaded objects if found
- *
- *  "type" [ OUT ] - returns object type id, e.g.:
- *    eDatatype, eTypeset, eFormat, eFunction, ePhysical, eTable, ...
- *
- *  "expr" [ IN ] - NUL terminated name expression identifying object
- *
- *  "ctx" [ IN ] - NUL terminated context string for evaluation,
- *  substitutes for filename in logging reports
- *
- *  returns principal object identified. if NULL but "name" is not
- *  NULL, then the object was only partially identified.
- */
-const void * SDatabaseFind ( const SDatabase *self,
-    const VSchema *schema, const SNameOverload **name,
-    uint32_t *type, const char *expr, const char *ctx )
-{
-    rc_t rc;
-    KSymTable tbl;
-
-    /* initialize to not-found */
-    const void *obj = NULL;
-    * name = NULL;
-    * type = 0;
-
-    /* build a symbol table for database */
-    rc = init_db_symtab ( & tbl, schema, self );
-    if ( rc == 0 )
-    {
-        obj = resolve_object ( & tbl, schema, NULL, name, type, expr, ctx, false );
-        KSymTableWhack ( & tbl );
-    }
-
-    return obj;
-}
-
-/* Extend
- */
-static
-void CC VectorTranslate ( Vector *v, const Vector *dad )
-{
-    uint32_t block = VectorBlock ( v );
-    uint32_t start = VectorStart ( dad ) + VectorLength ( dad );
-    VectorInit ( v, start, block );
-}
-
-static
-rc_t CC SDatabaseExtend ( SDatabase *self, const SDatabase *dad )
-{
-    self -> dad = dad;
-    VectorTranslate ( & self -> db, & dad -> db );
-    VectorTranslate ( & self -> tbl, & dad -> tbl );
-    return 0;
-}
-
-/* Mark
- */
-void CC SDatabaseClearMark ( void *item, void *ignore )
-{
-    SDatabase *self = item;
-    self -> marked = false;
-}
-
-
-void CC SDatabaseMark ( void * item, void * data )
-{
-    SDatabase * self = item;
-    if ( self != NULL && ! self -> marked )
-    {
-        self -> marked = true;
-        VectorForEach ( & self -> db, false, SDBMemberMark, data );
-        VectorForEach ( & self -> tbl, false, STblMemberMark, data );
-        SDatabaseMark ( ( void * )self -> dad, data );
-    }
-}
-
-void CC SDatabaseNameMark ( const SNameOverload *self, const VSchema *schema )
-{
-    if ( self != NULL )
-    {
-        VectorForEach ( & self -> items, false, SDatabaseMark, ( void* ) schema );
-    }
-}
-
-/* Dump
- *  dump "database" { }
- */
-rc_t SDatabaseDump ( const SDatabase *self, struct SDumper *d )
-{
-    d -> rc = FQNDump ( self != NULL ? self -> name : NULL, d );
-    if ( d -> rc == 0 && self != NULL )
-        d -> rc = SDumperVersion ( d, self -> version );
-    return d -> rc;
-}
-
-bool CC SDatabaseDefDump ( void *item, void *data )
-{
-    SDumper *b = data;
-    const SDatabase *self = ( const void* ) item;
-
-    if ( SDumperMarkedMode ( b ) && ! self -> marked )
-        return false;
-
-    b -> rc = SDumperPrint ( b, "\tdatabase %N", self -> name );
-
-    if ( b -> rc == 0 )
-        b -> rc = SDumperVersion ( b, self -> version );
-
-    /* TBD - need to overhaul inheritance of databases */
-    if ( b -> rc == 0 && self -> dad != NULL )
-        b -> rc = SDumperPrint ( b, "= %N", self -> dad -> name );
-
-    if ( b -> rc == 0 )
-        b -> rc = SDumperPrint ( b, "\n\t{\n" );
-
-    SDumperIncIndentLevel ( b );
-
-    if ( b -> rc == 0 )
-        VectorDoUntil ( & self -> tbl, false, STblMemberDefDump, b );
-
-    if ( b -> rc == 0 )
-        VectorDoUntil ( & self -> db, false, SDBMemberDefDump, b );
-
-    SDumperDecIndentLevel ( b );
-
-    if ( b -> rc == 0 )
-        b -> rc = SDumperPrint ( b, "\t}\n" );
-
-    return ( b -> rc != 0 ) ? true : false;
-}
-
-#endif
-
-/*--------------------------------------------------------------------------
- * VSchema
- */
-
-#if SLVL >= 6
-
-static
-rc_t CC db_dbmbr ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, SDBMember *m )
-{
-    rc_t rc ;
-    const SNameOverload *name;
-
-    /* look for database typename */
-    rc = next_fqn ( tbl, src, t, env );
-    if ( rc != 0 )
-        return KTokenFailure ( t, klogErr, rc, "database typename" );
-    if ( t -> id != eDatabase )
-        return KTokenExpected ( t, klogErr, "database typename" );
-    name = t -> sym -> u . obj;
-
-    /* look for version */
-    if ( next_token ( tbl, src, t ) -> id != eHash )
-        m -> db = VectorLast ( & name -> items );
-    else
-    {
-        uint32_t vers;
-        next_token ( tbl, src, t );
-        rc = maj_min_rel ( tbl, src, t, env, self, & vers, true );
-        if ( rc != 0 )
-            return rc;
-        m -> db = VectorFind ( & name -> items, & vers, NULL, SDatabaseCmp );
-    }
-    if ( m -> db == NULL )
-    {
-        rc = RC ( rcVDB, rcSchema, rcParsing, rcDatabase, rcNotFound );
-        return KTokenRCExplain ( t, klogErr, rc );
-    }
-
-    /* get member name */
-    if ( t -> sym != NULL )
-    {
-        KTokenSourceReturn ( src, t );
-        next_shallow_token ( tbl, src, t, true );
-    }
-
-    /* looking for undefined identifier */
-    if ( t -> id == eIdent )
-    {
-        rc = KSymTableCreateConstSymbol ( tbl, & m -> name, & t -> str, eDBMember, m );
-        if ( rc != 0 )
-            return KTokenRCExplain ( t, klogInt, rc );
-    }
-    else if ( t -> id == eDBMember )
-        return KTokenExpected ( t, klogErr, "undefined database member name" );
-    else if ( t -> id != eForward && t -> id != eVirtual )
-        return KTokenExpected ( t, klogErr, "database member name" );
-    else
-    {
-        m -> name = t -> sym;
-        ( ( KSymbol* ) t -> sym ) -> u . obj = m;
-        ( ( KSymbol* ) t -> sym ) -> type = eDBMember;
-    }
-
-    /* expect we're done */
-    return expect ( tbl, src, t, eSemiColon, ";", true );
-}
-
-static
-rc_t CC database_dbmbr ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, SDatabase *db, bool tmpl )
-{
-    rc_t rc;
-    SDBMember *m = malloc ( sizeof * m );
-    if ( m == NULL )
-        rc = RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-    else
-    {
-        memset ( m, 0, sizeof * m );
-        m -> tmpl = tmpl;
-
-        rc = db_dbmbr ( tbl, src, t, env, self, m );
-        if ( rc == 0 )
-        {
-            rc = VectorAppend ( & db -> db, & m -> cid . id, m );
-            if ( rc == 0 )
-                return 0;
-        }
-
-        SDBMemberWhack ( m, NULL );
-    }
-    return rc;
-}
-
-static
-rc_t CC db_tblmbr ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, STblMember *m )
-{
-    rc_t rc ;
-    const SNameOverload *name;
-
-    /* look for table typename */
-    rc = next_fqn ( tbl, src, t, env );
-    if ( rc != 0 )
-        return KTokenFailure ( t, klogErr, rc, "table typename" );
-    if ( t -> id != eTable )
-        return KTokenExpected ( t, klogErr, "table typename" );
-    name = t -> sym -> u . obj;
-
-    /* look for version */
-    if ( next_token ( tbl, src, t ) -> id != eHash )
-        m -> tbl = VectorLast ( & name -> items );
-    else
-    {
-        uint32_t vers;
-        next_token ( tbl, src, t );
-        rc = maj_min_rel ( tbl, src, t, env, self, & vers, true );
-        if ( rc != 0 )
-            return rc;
-        m -> tbl = VectorFind ( & name -> items, & vers, NULL, STableCmp );
-    }
-    if ( m -> tbl == NULL )
-    {
-        rc = RC ( rcVDB, rcSchema, rcParsing, rcTable, rcNotFound );
-        return KTokenRCExplain ( t, klogErr, rc );
-    }
-
-    /* get member name */
-    if ( t -> sym != NULL )
-    {
-        KTokenSourceReturn ( src, t );
-        next_shallow_token ( tbl, src, t, true );
-    }
-
-    /* looking for undefined identifier */
-    if ( t -> id == eIdent )
-    {
-        rc = KSymTableCreateConstSymbol ( tbl, & m -> name, & t -> str, eTblMember, m );
-        if ( rc != 0 )
-            return KTokenRCExplain ( t, klogInt, rc );
-    }
-    else
-    {
-        if ( t -> id == eTblMember )
-            return KTokenExpected ( t, klogErr, "undefined table member name" );
-        if ( t -> id != eForward && t -> id != eVirtual )
-            return KTokenExpected ( t, klogErr, "table member name" );
-
-        m -> name = t -> sym;
-        ( ( KSymbol* ) t -> sym ) -> u . obj = m;
-        ( ( KSymbol* ) t -> sym ) -> type = eTblMember;
-    }
-
-    /* expect we're done */
-    return expect ( tbl, src, next_token ( tbl, src, t ), eSemiColon, ";", true );
-}
-
-static
-rc_t CC database_tblmbr ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, SDatabase *db, bool tmpl )
-{
-    rc_t rc;
-    STblMember *m = malloc ( sizeof * m );
-    if ( m == NULL )
-        rc = RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-    else
-    {
-        memset ( m, 0, sizeof * m );
-        m -> tmpl = tmpl;
-
-        rc = db_tblmbr ( tbl, src, t, env, self, m );
-        if ( rc == 0 )
-        {
-            rc = VectorAppend ( & db -> tbl, & m -> cid . id, m );
-            if ( rc == 0 )
-                return 0;
-        }
-
-        STblMemberWhack ( m, NULL );
-    }
-    return rc;
-}
-
-/*
- * database-body      = '{' [ <database-mbrs> ] '}'
- * database-mbrs      = [ 'template' ] <database-mbr> [ <database-mbrs> ]
- * database-mbr       = 'database' <db-mbr>
- *                    | 'table' <table-mbr>
- *                    | ';'
- */
-static
-rc_t CC database_mbr ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, SDatabase *db )
-{
-    bool tmpl = false;
-
-    switch ( t -> id )
-    {
-    case  kw_template:
-        tmpl = true;
-        next_token ( tbl, src, t );
-        break;
-    case eSemiColon:
-        next_token ( tbl, src, t );
-        return 0;
-    }
-
-    switch ( t -> id )
-    {
-    case kw_database:
-        return database_dbmbr ( tbl, src,
-            next_token ( tbl, src, t ), env, self, db, tmpl );
-    case kw_table:
-        return database_tblmbr ( tbl, src,
-            next_token ( tbl, src, t ), env, self, db, tmpl );
-    }
-
-    return KTokenExpected ( t, klogErr, "table or database" );
-}
-
-static
-rc_t CC database_body ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, SDatabase *db )
-{
-    rc_t rc = expect ( tbl, src, t, eLeftCurly, "{", true );
-    if ( rc != 0 )
-        return rc;
-
-    while ( t -> id != eRightCurly )
-    {
-        rc = database_mbr ( tbl, src, t, env, self, db );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    return expect ( tbl, src, t, eRightCurly, "}", true );
-}
-
-
-/*
- * push-db-scope
- * pop-db-scope
- */
-rc_t push_db_scope ( KSymTable *tbl, const SDatabase *db )
-{
-    if ( db -> dad != NULL )
-    {
-        rc_t rc = push_db_scope ( tbl, db -> dad );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    return KSymTablePushScope ( tbl, ( BSTree* ) & db -> scope );
-}
-
-void pop_db_scope ( KSymTable *tbl, const SDatabase *db )
-{
-    while ( db != NULL )
-    {
-        KSymTablePopScope ( tbl );
-        db = db -> dad;
-    }
-}
-
-/*
- * init-db-symtab
- *  initializes "tbl"
- *  places db in scope
- *  must be balanced by KSymTableWhack
- */
-rc_t init_db_symtab ( KSymTable *tbl, const VSchema *schema, const SDatabase *db )
-{
-    rc_t rc = init_symtab ( tbl, schema );
-    if ( rc == 0 )
-    {
-        rc = push_db_scope ( tbl, db );
-        if ( rc == 0 )
-            return 0;
-
-        KSymTableWhack ( tbl );
-    }
-
-    return rc;
-}
-
-
-/*
- * database-decl      = 'database' <fqn> '#' <maj-min-rel>
- *                      [ '=' <database-name> ] <database-body>
- * database-body      = '{' [ <database-mbrs> ] '}'
- * database-mbrs      = <database-mbr> [ <database-mbrs> ]
- */
-static
-rc_t database_decl ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, SDatabase *db )
-{
-    /* db name */
-    rc_t rc = create_fqn ( tbl, src, t, env, eDatabase, NULL );
-    if ( rc != 0 && GetRCState ( rc ) != rcExists )
-        return KTokenFailure ( t, klogErr, rc, "database name" );
-    db -> name = t -> sym;
-
-    /* database version */
-    if ( next_token ( tbl, src, t ) -> id != eHash )
-        return KTokenExpected ( t, klogErr, "#" );
-    next_token ( tbl, src, t );
-    rc = maj_min_rel ( tbl, src, t, env, self, & db -> version, true );
-    if ( rc != 0 )
-        return rc;
-
-    /* prepare vectors */
-    VectorInit ( & db -> db, 0, 8 );
-    VectorInit ( & db -> tbl, 0, 8 );
-
-    /* look for inheritance */
-    if ( t -> id == eAssign )
-    {
-        const SDatabase *dad;
-        const SNameOverload *pname;
-
-        /* look for dad */
-        rc = next_fqn ( tbl, src, next_token ( tbl, src, t ), env );
-        if ( rc != 0 )
-            return KTokenFailure ( t, klogErr, rc, "database name" );
-
-        /* insist that dad be a database */
-        if ( t -> id != eDatabase )
-            return KTokenExpected ( t, klogErr, "database name" );
-        pname = t -> sym -> u . obj;
-
-        /* check for version */
-        if ( next_token ( tbl, src, t ) -> id != eHash )
-            dad = VectorLast ( & pname -> items );
-        else
-        {
-            uint32_t pvers;
-            next_token ( tbl, src, t );
-            rc = maj_min_rel ( tbl, src, t, env, self, & pvers, true );
-            if ( rc != 0 )
-                return rc;
-            dad = VectorFind ( & pname -> items, & pvers, NULL, SDatabaseCmp );
-        }
-
-        /* dad should be found */
-        if ( dad == NULL )
-        {
-            rc = RC ( rcVDB, rcSchema, rcParsing, rcDatabase, rcNotFound );
-            return KTokenRCExplain ( t, klogErr, rc );
-        }
-
-        /* take the inheritance */
-        rc = SDatabaseExtend ( db, dad );
-        if ( rc != 0 )
-            return KTokenRCExplain ( t, klogInt, rc );
-    }
-
-    /* enter database into scope */
-    rc = push_db_scope ( tbl, db );
-    if ( rc == 0 )
-    {
-        /* parse the definition */
-        rc = database_body ( tbl, src, t, env, self, db );
-
-        /* pop out of scope */
-        pop_db_scope ( tbl, db );
-    }
-
-    return rc;
-}
-
-rc_t database_declaration ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self )
-{
-    rc_t rc;
-    void *ignore;
-
-    SDatabase *db = malloc ( sizeof * db );
-    if ( db == NULL )
-    {
-        rc = RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-        return KTokenRCExplain ( t, klogInt, rc );
-    }
-
-    memset ( db, 0, sizeof * db );
-    rc = database_decl ( tbl, src, t, env, self, db );
-    if ( rc == 0 )
-    {
-        SNameOverload *name = ( void* ) db -> name -> u . obj;
-        if ( name == NULL )
-        {
-            rc = SNameOverloadMake ( & name, db -> name, 0, 4 );
-            if ( rc == 0 )
-            {
-                rc = VectorAppend ( & self -> dname, & name -> cid . id, name );
-                if ( rc != 0 )
-                    SNameOverloadWhack ( name, NULL );
-            }
-        }
-
-        if ( rc == 0 )
-        {
-            rc = VectorAppend ( & self -> db, & db -> id, db );
-            if ( rc == 0 )
-            {
-                uint32_t idx;
-                rc = VectorInsertUnique ( & name -> items, db, & idx, SDatabaseSort );
-                if ( rc == 0 )
-                    return rc;
-
-                if ( GetRCState ( rc ) == rcExists )
-                {
-                    const SDatabase *newer;
-                    SDatabase *exist = VectorGet ( & name -> items, idx );
-                    rc = SDatabaseCompare ( exist, db, & newer, false );
-                    if ( rc == 0 && newer == db )
-                    {
-                        VectorSwap ( & name -> items, idx, db, & ignore );
-                        /* TBD - need to update parent/child relationships */
-                        return 0;
-                    }
-                }
-
-                VectorSwap ( & self -> db, db -> id, NULL, & ignore );
-            }
-        }
-    }
-    else if ( GetRCState ( rc ) == rcExists )
-    {
-        rc = 0;
-    }
-
-    SDatabaseWhack ( db, NULL );
-
-    return rc;
-}
-
-#endif
diff --git a/libs/vdb/schema-dump.c b/libs/vdb/schema-dump.c
deleted file mode 100644
index 5ef2ca3..0000000
--- a/libs/vdb/schema-dump.c
+++ /dev/null
@@ -1,683 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#include "schema-dump.h"
-#include "schema-priv.h"
-#include "schema-parse.h"
-#include "schema-expr.h"
-
-#include <klib/text.h>
-#include <klib/printf.h>
-#include <klib/symbol.h>
-#include <klib/symtab.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <os-native.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * SDumper
- */
-
-
-/* Init
- *  sets up block
- */
-void SDumperInit ( SDumper *self, const VSchema *schema, uint32_t mode,
-    rc_t ( CC * flush ) ( void *fd, const void *buffer, size_t size ), void *fd )
-{
-    self -> schema = schema;
-    self -> flush = flush;
-    self -> fd = fd;
-    self -> sep = "";
-    self -> rc = 0;
-    self -> indent = 0;
-    self -> mode = ( uint16_t ) mode;
-    self -> total = 0;
-}
-
-
-/* Flush
- */
-static
-rc_t SDumperFlush ( SDumper *self )
-{
-    rc_t rc = ( * self -> flush ) ( self -> fd, self -> buffer, self -> total );
-    if ( rc == 0 )
-        self -> total = 0;
-    return rc;
-}
-
-static
-rc_t SDumperFlushLine ( SDumper *self )
-{
-#if ! _DEBUGGING
-    if ( self -> total < sizeof self -> buffer / 2 )
-        return 0;
-#endif
-    return SDumperFlush ( self );
-}
-
-
-/* Whack
- *  flushes buffer if necessary
- */
-rc_t SDumperWhack ( SDumper *self )
-{
-    if ( self -> rc == 0 && self -> total != 0 )
-        return SDumperFlush ( self );
-    return 0;
-}
-
-
-/* Write
- *  writes data to buffer, flushes as necessary
- */
-rc_t SDumperWrite ( SDumper *self, const char *buffer, size_t size )
-{
-    rc_t rc;
-    size_t total, num_writ;
-
-    for ( rc = 0, total = 0; total < size; total += num_writ )
-    {
-        if ( self -> total == sizeof self -> buffer )
-        {
-            rc = SDumperFlush ( self );
-            if ( rc != 0 )
-                break;
-        }
-
-        num_writ = size - total;
-        if ( num_writ > sizeof self -> buffer - self -> total )
-            num_writ = sizeof self -> buffer - self -> total;
-
-        memcpy ( & self -> buffer [ self -> total ], & buffer [ total ], num_writ );
-        self -> total += num_writ;
-    }
-
-    return rc;
-}
-
-/* IndentLevel
- *  increase or decrease indentation level
- */
-void SDumperIncIndentLevel ( SDumper *self )
-{
-    ++ self -> indent;
-}
-
-void SDumperDecIndentLevel ( SDumper *self )
-{
-    if ( self -> indent > 0 )
-        -- self -> indent;
-}
-
-
-/* Indent
- *  writes indentation spacing
- */
-rc_t SDumperIndent ( SDumper *self )
-{
-    rc_t rc;
-    uint32_t total, num_writ;
-
-    /* use a tab */
-    const char *tabs = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
-
-    for ( rc = 0, total = 0; total < self -> indent; total += num_writ )
-    {
-        num_writ = ( ( self -> indent - total - 1 ) & 0xF ) + 1;
-        rc = SDumperWrite ( self, tabs, num_writ );
-        if ( rc != 0 )
-            break;
-    }
-
-    return rc;
-}
-
-/* SepString
- *  sets separator string
- */
-void SDumperSepString ( SDumper *self, const char *sep )
-{
-    self -> sep = sep;
-}
-
-/* Sep
- *  write separator string
- */
-rc_t SDumperSep ( SDumper *self )
-{
-    if ( self -> sep == NULL )
-        return 0;
-
-    return SDumperWrite ( self, self -> sep, strlen ( self -> sep ) );
-}
-
-/* Print
- *  \t   - indent
- *  \n   - end of line
- *  \v   - separator
- *  %d   - int
- *  %u   - unsigned int
- *  %x   - unsigned int ( lower-case )
- *  %X   - unsigned int ( UPPER-case )
- *  %f   - double
- *  %ld  - int64_t
- *  %lu  - uint64_t
- *  %lx  - uint64_t ( lower-case )
- *  %lX  - uint64_t ( UPPER-case )
- *  %p   - pointer ( UPPER-case )
- *  %z   - size_t ( decimal )
- *  %s   - const char* ( NUL-terminated )
- *  %.*s - int, const char*
- *  %S   - const String*
- *  %N   - const KSymbol*
- *  %T   - const VTypedecl*
- *  %F   - const VFormatdecl*
- *  %V   - uint32_t version
- *  %E   - const SExpression*
- */
-rc_t SDumperVPrint ( SDumper *self, const char *fmt, va_list args )
-{
-    rc_t rc;
-    const char *start, *end;
-    for ( rc = 0, start = end = fmt; * end != 0; ++ end )
-    {
-        int len;
-        size_t size;
-        char buffer [ 256 ];
-
-        switch ( * end )
-        {
-        case '\t':
-            if ( end > start )
-                rc = SDumperWrite ( self, start, end - start );
-            if ( rc == 0 )
-                rc = SDumperIndent ( self );
-            start = end + 1;
-            break;
-        case '\n':
-            rc = SDumperWrite ( self, start, end - start + 1 );
-            if ( rc == 0 )
-                rc = SDumperFlushLine ( self );
-            start = end + 1;
-            break;
-        case '\v':
-            if ( end > start )
-                rc = SDumperWrite ( self, start, end - start );
-            if ( rc == 0 )
-                rc = SDumperSep ( self );
-            start = end + 1;
-            break;
-        case '%':
-            if ( end > start )
-            {
-                rc = SDumperWrite ( self, start, end - start );
-                if ( rc != 0 )
-                    break;
-            }
-            switch ( * ( ++ end ) )
-            {
-            case 'd':
-                len = sprintf ( buffer, "%d", va_arg ( args, int ) );
-                rc = SDumperWrite ( self, buffer, len );
-                break;
-            case 'u':
-                len = sprintf ( buffer, "%u", va_arg ( args, unsigned int ) );
-                rc = SDumperWrite ( self, buffer, len );
-                break;
-            case 'x':
-                len = sprintf ( buffer, "%x", va_arg ( args, unsigned int ) );
-                rc = SDumperWrite ( self, buffer, len );
-                break;
-            case 'X':
-                len = sprintf ( buffer, "%X", va_arg ( args, unsigned int ) );
-                rc = SDumperWrite ( self, buffer, len );
-                break;
-            case 'f':
-                len = sprintf ( buffer, "%f", va_arg ( args, double ) );
-                rc = SDumperWrite ( self, buffer, len );
-                break;
-            case 'l':
-                switch ( * ( ++ end ) )
-                {
-                case 'd':
-                    rc = string_printf ( buffer, sizeof buffer, & size, "%ld", va_arg ( args, int64_t ) );
-                    if ( rc == 0 )
-                        rc = SDumperWrite ( self, buffer, size );
-                    break;
-                case 'u':
-                    rc = string_printf ( buffer, sizeof buffer, & size, "%lu", va_arg ( args, uint64_t ) );
-                    if ( rc == 0 )
-                        rc = SDumperWrite ( self, buffer, size );
-                    break;
-                case 'x':
-                    rc = string_printf ( buffer, sizeof buffer, & size, "%lx", va_arg ( args, uint64_t ) );
-                    if ( rc == 0 )
-                        rc = SDumperWrite ( self, buffer, size );
-                    break;
-                case 'X':
-                    rc = string_printf ( buffer, sizeof buffer, & size, "%lX", va_arg ( args, uint64_t ) );
-                    if ( rc == 0 )
-                        rc = SDumperWrite ( self, buffer, size );
-                    break;
-                }
-                break;
-            case 'p':
-                rc = string_printf ( buffer, sizeof buffer, & size, "0x%p", va_arg ( args, size_t ) );
-                if ( rc == 0 )
-                    rc = SDumperWrite ( self, buffer, size );
-                break;
-            case 'z':
-                rc = string_printf ( buffer, sizeof buffer, & size, "%zu", va_arg ( args, size_t ) );
-                if ( rc == 0 )
-                    rc = SDumperWrite ( self, buffer, size );
-                break;
-            case 's':
-                len = snprintf ( buffer, sizeof buffer, "%s", va_arg ( args, const char* ) );
-                if ( len < 0 || len >= sizeof buffer )
-                    rc = RC ( rcVDB, rcSchema, rcWriting, rcString, rcExcessive );
-                else
-                    rc = SDumperWrite ( self, buffer, len );
-                break;
-            case '.':
-                if ( end [ 1 ] == '*' && end [ 2 ] == 's' )
-                {
-                    end += 2;
-                    len = va_arg ( args, int );
-                    if ( len >= sizeof buffer )
-                        rc = RC ( rcVDB, rcSchema, rcWriting, rcString, rcExcessive );
-                    else
-                    {
-                        len = sprintf ( buffer, "%.*s", len, va_arg ( args, const char* ) );
-                        rc = SDumperWrite ( self, buffer, len );
-                    }
-                    break;
-                }
-                /* not handling anything else */
-                rc = SDumperWrite ( self, "%.", 2 );
-                break;
-            case 'S':
-                rc = StringDump ( va_arg ( args, const String* ), self );
-                break;
-            case 'N':
-                rc = FQNDump ( va_arg ( args, const KSymbol* ), self );
-                break;
-#if SLVL >= 1
-            case 'T':
-                rc = VTypedeclDump ( va_arg ( args, struct VTypedecl const* ), self );
-                break;
-            case 'F':
-                rc = VFormatdeclDump ( va_arg ( args, struct VFormatdecl const* ), self );
-                break;
-#endif
-#if SLVL >= 2
-            case 'E':
-                rc = SExpressionDump ( va_arg ( args, const SExpression* ) , self );
-                break;
-#endif
-            case 'V':
-                rc = SDumperVersion ( self, va_arg ( args, uint32_t ) );
-                break;
-            case '%':
-                rc = SDumperWrite ( self, "%", 1 );
-                break;
-            }
-            start = end + 1;
-            break;
-        }
-
-        if ( rc != 0 )
-            break;
-    }
-
-    if ( rc == 0 && end > start )
-    {
-        rc = SDumperWrite ( self, start, end - start );
-        if ( rc == 0 )
-            rc = SDumperFlushLine ( self );
-    }
-
-    return rc;
-}
-
-rc_t SDumperPrint ( SDumper *self, const char *fmt, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, fmt );
-    rc = SDumperVPrint ( self, fmt, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * various types
- */
-
-/* Version
- */
-rc_t SDumperVersion ( SDumper *self, uint32_t version )
-{
-    const char *fmt;
-
-    if ( ( version & 0xFFFF ) != 0 )
-        fmt =" #%u.%u.%u";
-    else if ( ( version & 0xFF0000 ) != 0 )
-        fmt =" #%u.%u";
-    else
-        fmt =" #%u";
-
-    switch ( SDumperMode ( self ) )
-    {
-    case sdmCompact:
-        ++ fmt;
-        break;
-    }
-
-    return SDumperPrint ( self, fmt,
-                          ( version >> 24 ),
-                          ( version >> 16 ) & 0xFF,
-                          ( version & 0xFFFF ) );
-}
-
-/* String
- */
-rc_t StringDump ( const String *self, SDumper *b )
-{
-    return SDumperWrite ( b, self -> addr, self -> size );
-}
-
-/* KSymbol
- */
-rc_t KSymbolDump ( const KSymbol *self, SDumper *b )
-{
-    if ( self == NULL )
-        return SDumperWrite ( b, "NULL", 4 );
-
-    return StringDump ( & self -> name, b );
-}
-
-/* FQN
- *  writes fully qualified name in schema format
- */
-rc_t FQNDump ( const KSymbol *self, SDumper *b )
-{
-    rc_t rc = 0;
-
-    if ( self != NULL && self -> dad != NULL )
-    {
-        rc = FQNDump ( self -> dad, b );
-        if ( rc == 0 )
-            rc = SDumperWrite ( b, ":", 1 );
-    }
-
-    if ( rc == 0 )
-        rc = KSymbolDump ( self, b );
-
-    return rc;
-}
-
-/* Alias
- */
-LIB_EXPORT bool CC KSymbolDumpAlias ( void *item, void *data )
-{
-    SDumper *b = data;
-    const KSymbol *self = ( const KSymbol* ) item;
-    if ( self -> u . obj == b -> alias -> u . obj )
-    {
-        if ( SDumperMode ( b ) == sdmCompact )
-            b -> rc = SDumperPrint ( b, "alias %N %N;", b -> alias, self );
-        else
-            b -> rc = SDumperPrint ( b, "alias %N %N;\n", b -> alias, self );
-    }
-
-    return false;
-}
-
-rc_t AliasDump ( const KSymbol *self, SDumper *b )
-{
-    const VSchema *schema = b -> schema;
-    for ( b -> rc = 0, b -> alias = self; schema != NULL; schema = schema -> dad )
-    {
-        if ( VectorDoUntil ( & schema -> alias, false, KSymbolDumpAlias, b ) )
-            return b -> rc;
-    }
-    return 0;
-}
-
-/* VSchema
- */
-static
-bool VSchemaDumpInt ( const VSchema *self, SDumper *b, int dump_class )
-{
-    /* never dump intrinsic schema */
-    if ( self -> dad == NULL )
-    {
-#if SLVL >= 1
-        if ( SDumperMode ( b ) == sdmCompact )
-            SDumperPrint ( b, "version 1;" );
-        else
-            SDumperPrint ( b, "version 1;\n" );
-#endif
-        return false;
-    }
-
-    /* always dump parent */
-    if ( VSchemaDumpInt ( self -> dad, b, dump_class ) )
-        return true;
-
-    /* dump self */
-#if SLVL >= 1
-    if ( ( dump_class == 0 || dump_class == sdcTypes ) &&
-         VectorDoUntil ( & self -> dt, false, SDatatypeDefDump, b ) )
-        return true;
-
-    if ( ( dump_class == 0 || dump_class == sdcTypesets ) &&
-         VectorDoUntil ( & self -> ts, false, STypesetDefDump, b ) )
-        return true;
-#endif
-    if ( ( dump_class == 0 || dump_class == sdcFormats ) &&
-         VectorDoUntil ( & self -> fmt, false, SFormatDefDump, b ) )
-        return true;
-#if SLVL >= 2
-    if ( ( dump_class == 0 || dump_class == sdcConstants ) &&
-         VectorDoUntil ( & self -> cnst, false, SConstantDefDump, b ) )
-        return true;
-#endif
-#if SLVL >= 3
-    if ( ( dump_class == 0 || dump_class == sdcFunctions ) &&
-         VectorDoUntil ( & self -> func, false, SFunctionDeclDump, b ) )
-        return true;
-#endif
-#if SLVL >= 5
-    if ( ( dump_class == 0 || dump_class == sdcColumns ) &&
-         VectorDoUntil ( & self -> phys, false, SPhysicalDefDump, b ) )
-        return true;
-#endif
-#if SLVL >= 6
-    if ( ( dump_class == 0 || dump_class == sdcTables ) &&
-         VectorDoUntil ( & self -> tbl, false, STableDefDump, b ) )
-        return true;
-    if ( ( dump_class == 0 || dump_class == sdcDatabases ) &&
-         VectorDoUntil ( & self -> db, false, SDatabaseDefDump, b ) )
-        return true;
-#endif
-    return false;
-}
-
-LIB_EXPORT rc_t CC VSchemaDump ( const VSchema *self, uint32_t mode, const char *decl,
-    rc_t ( CC * flush ) ( void *fd, const void *buffer, size_t bsize ), void *fd )
-{
-    rc_t rc;
-    bool failed;
-    int dump_class = ( mode >> 8 ) & 0x7F;
-
-    SDumper b;
-    SDumperInit ( & b, self, mode & 0x80FF, flush, fd );
-
-    if ( decl != NULL && decl [ 0 ] != 0 )
-    {
-        uint32_t type;
-        const void *obj;
-        const SNameOverload *name;
-
-        b . mode |= MARKED_MODE;
-        VSchemaClearMark ( self );
-
-        obj = VSchemaFind ( self, & name, & type, decl, "VSchemaDump", false );
-
-        if ( obj != NULL ) switch ( type )
-        {
-        case eConstant:
-            SConstantMark ( obj );
-            break;
-        case eFormat:
-            SFormatMark ( obj );
-            break;
-        case eDatatype:
-            SDatatypeMark ( obj );
-            break;
-        case eTypeset:
-            STypesetMark ( obj, self );
-            break;
-        case eFunction:
-        case eUntypedFunc:
-        case eScriptFunc:
-            SFunctionMark ( ( void * )obj, ( void * )self );
-            break;
-        case ePhysical:
-            SPhysicalMark ( ( void * )obj, ( void * )self );
-            break;
-        case eTable:
-            STableMark ( ( void * )obj, ( void * )self );
-            break;
-        case eDatabase:
-            SDatabaseMark ( ( void * )obj, ( void * )self );
-            break;
-        }
-        else if ( name != NULL ) switch ( type )
-        {
-        case eFunction:
-        case eUntypedFunc:
-        case eScriptFunc:
-            SFuncNameMark ( name, self );
-            break;
-        case ePhysical:
-            SPhysNameMark ( name, self );
-            break;
-        case eTable:
-            STableNameMark ( name, self );
-            break;
-        case eDatabase:
-            SDatabaseNameMark ( name, self );
-            break;
-        }
-    }
-
-    failed = VSchemaDumpInt ( self, & b, dump_class );
-
-    rc = SDumperWhack ( & b );
-    return failed ? b . rc : rc;
-}
-
-static rc_t CC dump_to_stderr(void *dst, const void *buf, size_t sz)
-{
-    fwrite(buf, 1, sz, stderr);
-    return 0;
-}
-
-rc_t VSchemaDebugPrint ( const VSchema *self, const char *decl )
-{
-    return VSchemaDump ( self, sdmPrint, decl, dump_to_stderr, NULL );
-}
-
-/* ToText
- *  converts some object to textual representation
- */
-typedef struct VSchema2TextData VSchema2TextData;
-struct VSchema2TextData
-{
-    char *buff;
-    size_t bsize;
-    size_t total;
-};
-
-static
-rc_t CC flush_to_text ( void *data, const void *buffer, size_t size )
-{
-    VSchema2TextData *pb = data;
-    if ( size != 0 )
-    {
-        if ( pb -> total + size >= pb -> bsize )
-            return RC ( rcVDB, rcSchema, rcWriting, rcBuffer, rcInsufficient );
-
-        memcpy ( & pb -> buff [ pb -> total ], buffer, size );
-        pb -> total += size;
-    }
-    return 0;
-}
-
-rc_t VSchemaToText ( const VSchema *self,
-    char *buff, size_t bsize, size_t *num_writ, const char *fmt, ... )
-{
-    SDumper b;
-    rc_t rc, wrc;
-    VSchema2TextData pb;
-
-    va_list args;
-    va_start ( args, fmt );
-
-    assert ( buff != NULL );
-    assert ( bsize != 0 );
-
-    SDumperInit ( & b, self, sdmCompact, flush_to_text, & pb );
-
-    pb . buff = buff;
-    pb . bsize = bsize;
-    pb . total = 0;
-
-    rc = SDumperVPrint ( & b, fmt, args );
-    wrc = SDumperWhack ( & b );
-
-    * num_writ = pb . total;
-
-    va_end ( args );
-    return rc != 0 ? rc : wrc;
-}
diff --git a/libs/vdb/schema-dump.h b/libs/vdb/schema-dump.h
deleted file mode 100644
index 9172fc9..0000000
--- a/libs/vdb/schema-dump.h
+++ /dev/null
@@ -1,208 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_schema_dump_
-#define _h_schema_dump_
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#include <stdarg.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct String;
-struct KSymbol;
-struct VSchema;
-struct VTypedecl;
-struct VFormatdecl;
-
-
-/*--------------------------------------------------------------------------
- * SDumper
- */
-#define MARKED_MODE 0x8000
-
-enum VSchemaDumpClass
-{
-    sdcTypes = 1,
-    sdcTypesets,
-    sdcFormats,
-    sdcConstants,
-    sdcFunctions,
-    sdcColumns,
-    sdcTables,
-    sdcDatabases
-};
-
-typedef struct SDumper SDumper;
-struct SDumper
-{
-    struct VSchema const *schema;
-
-    struct KSymbol const *alias;
-
-    rc_t ( CC * flush ) ( void *fd, const void *buffer, size_t size );
-    void *fd;
-
-    const char *sep;
-
-    rc_t rc;
-    uint16_t indent;
-    uint16_t mode;
-
-    size_t total;
-    char buffer [ 4096 ];
-};
-
-/* Init
- *  sets up block
- */
-void SDumperInit ( SDumper *self, struct VSchema const *schema, uint32_t mode,
-    rc_t ( CC * flush ) ( void *fd, const void *buffer, size_t size ), void *fd );
-
-/* Whack
- *  flushes buffer if necessary
- */
-rc_t SDumperWhack ( SDumper *self );
-
-/* Write
- *  write some text to the dumper
- */
-rc_t SDumperWrite ( SDumper *self,
-    const char *buffer, size_t size );
-
-/* IndentLevel
- *  increase or decrease indentation level
- */
-void SDumperIncIndentLevel ( SDumper *self );
-void SDumperDecIndentLevel ( SDumper *self );
-
-/* Indent
- *  writes indentation spacing
- */
-rc_t SDumperIndent ( SDumper *self );
-
-/* SepString
- *  sets separator string
- */
-void SDumperSepString ( SDumper *self, const char *sep );
-
-/* Sep
- *  write separator string
- */
-rc_t SDumperSep ( SDumper *self );
-
-/* Print
- *  \t   - indent
- *  \n   - end of line
- *  \v   - separator
- *  %d   - int
- *  %u   - unsigned int
- *  %x   - unsigned int ( lower-case )
- *  %X   - unsigned int ( UPPER-case )
- *  %f   - double
- *  %ld  - int64_t
- *  %lu  - uint64_t
- *  %lx  - uint64_t ( lower-case )
- *  %lX  - uint64_t ( UPPER-case )
- *  %p   - pointer ( UPPER-case )
- *  %z   - size_t ( decimal )
- *  %s   - const char* ( NUL-terminated )
- *  %.*s - int, const char*
- *  %S   - const String*
- *  %N   - const KSymbol*
- *  %T   - const VTypedecl*
- *  %F   - const VFormatdecl*
- *  %V   - uint32_t version
- *  %E   - const SExpression*
- */
-rc_t SDumperPrint ( SDumper *self, const char *fmt, ... );
-rc_t SDumperVPrint ( SDumper *self, const char *fmt, va_list args );
-
-
-/* Mode
- *  get the dump mode
- */
-#define SDumperMode( self ) \
-    ( ( self ) -> mode & 0xFF )
-
-/* Class
- *  get the class of object to dump
- */
-#define SDumperClass( self ) \
-    ( ( ( self ) -> mode >> 8 ) & 0x7F )
-
-/* MarkedMode
- *  tells if only running in marked mode
- */
-#define SDumperMarkedMode( self ) \
-    ( ( self ) -> mode & MARKED_MODE )
-
-
-/*--------------------------------------------------------------------------
- * various types
- */
-
-/* Version
- */
-rc_t SDumperVersion ( SDumper *self, uint32_t version );
-
-/* String
- */
-rc_t StringDump ( struct String const *self, SDumper *d );
-
-/* KSymbol
- */
-rc_t KSymbolDump ( struct KSymbol const *self, SDumper *b );
-
-/* FQN
- *  writes fully qualified name in schema format
- */
-rc_t FQNDump ( struct KSymbol const *self, SDumper *b );
-
-/* Alias
- */
-rc_t AliasDump ( struct KSymbol const *self, SDumper *b );
-
-/* VTypedecl
- * VFormatdecl
- */
-rc_t VTypedeclDump ( struct VTypedecl const *self, SDumper *b );
-rc_t VFormatdeclDump ( struct VFormatdecl const *self, SDumper *b );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_schema_dump_ */
diff --git a/libs/vdb/schema-eval.c b/libs/vdb/schema-eval.c
deleted file mode 100644
index 2c8c5b7..0000000
--- a/libs/vdb/schema-eval.c
+++ /dev/null
@@ -1,1400 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#include "schema-priv.h"
-#include "schema-parse.h"
-#include "schema-expr.h"
-
-#include <klib/symbol.h>
-#include <klib/symtab.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-#include <bitstr.h>
-#include <atomic32.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * VSchema
- */
-
-
-/* CacheIntrinsicTypeId
- *  for id-caching
- *
- *  reads id atomically from "cache" and returns if non-zero
- *
- *  otherwise retrieves type id by name lookup, and sets
- *  value atomically in "cache" before returning.
- */
-uint32_t VSchemaCacheIntrinsicTypeId ( const VSchema *self,
-    atomic32_t *cache, const char *typename )
-{
-    uint32_t id;
-
-    assert ( self != NULL );
-    assert ( cache != NULL );
-    assert ( typename != NULL && typename [ 0 ] != 0 );
-
-    /* retrieve cached value */
-    id = atomic32_read ( cache );
-    if ( id == 0 )
-    {
-        String name;
-        uint32_t prev;
-        const KSymbol *sym;
-        const SDatatype *dt;
-
-        /* find intrinsic schema */
-        const VSchema *intrinsic = self;
-        while ( intrinsic -> dad != NULL )
-            intrinsic = intrinsic -> dad;
-
-        /* find datatype U32 */
-        StringInitCString ( & name, typename );
-        sym = ( const KSymbol* )
-            BSTreeFind ( & intrinsic -> scope, & name, KSymbolCmp );
-        assert ( sym != NULL );
-        dt = sym -> u . obj;
-
-        /* this SHOULD be idempotent */
-        prev = atomic32_test_and_set ( cache, ( int ) dt -> id, id );
-        assert ( prev == id || prev == dt -> id );
-
-        id = dt -> id;
-    }
-
-    return id;
-}
-
-
-/*--------------------------------------------------------------------------
- * constant numeric expressions
- *
- *  built-in typecasting allows for the chain
- *    bool => uint => int => float
- *
- *  built-in size promotion is automatic from 8 => 16 => 32 => 64 bits
- *
- *  constant size-demotion is allowed due to knowledge of constant value
- *
- *  explicit casts may reverse type promotion rules
- */
-
-
-/* 64 bit interchange union
- */
-typedef union nx nx;
-union nx
-{
-    uint64_t u64;
-    int64_t i64;
-    double f64;
-};
-
-
-/* readers
- *  access data in 8, 16, 32 or 64 bit form
- *  return data in 64 bit form
- *  advance data pointer
- */
-static
-const void *read_bool ( nx *data, const void *p )
-{
-    const bool *src = p;
-    data -> u64 = src [ 0 ];
-    return src + 1;
-}
-
-static
-const void *read_U8 ( nx *data, const void *p )
-{
-    const uint8_t *src = p;
-    data -> u64 = src [ 0 ];
-    return src + 1;
-}
-
-static
-const void *read_U16 ( nx *data, const void *p )
-{
-    const uint16_t *src = p;
-    data -> u64 = src [ 0 ];
-    return src + 1;
-}
-
-static
-const void *read_U32 ( nx *data, const void *p )
-{
-    const uint32_t *src = p;
-    data -> u64 = src [ 0 ];
-    return src + 1;
-}
-
-static
-const void *read_U64 ( nx *data, const void *p )
-{
-    const uint64_t *src = p;
-    data -> u64 = src [ 0 ];
-    return src + 1;
-}
-
-static
-const void *read_I8 ( nx *data, const void *p )
-{
-    const int8_t *src = p;
-    data -> i64 = src [ 0 ];
-    return src + 1;
-}
-
-static
-const void *read_I16 ( nx *data, const void *p )
-{
-    const int16_t *src = p;
-    data -> i64 = src [ 0 ];
-    return src + 1;
-}
-
-static
-const void *read_I32 ( nx *data, const void *p )
-{
-    const int32_t *src = p;
-    data -> i64 = src [ 0 ];
-    return src + 1;
-}
-
-static
-const void *read_I64 ( nx *data, const void *p )
-{
-    const int64_t *src = p;
-    data -> i64 = src [ 0 ];
-    return src + 1;
-}
-
-static
-const void *read_F32 ( nx *data, const void *p )
-{
-    const float *src = p;
-    data -> f64 = src [ 0 ];
-    return src + 1;
-}
-
-static
-const void *read_F64 ( nx *data, const void *p )
-{
-    const double *src = p;
-    data -> f64 = src [ 0 ];
-    return src + 1;
-}
-
-/* writers
- *  write data in 8, 16, 32, or 64 bit form
- *  receive data in 64 bit form
- *  advance pointers
- */
-static
-void *write_bool ( void *p, const nx *data )
-{
-    bool *dst = p;
-    dst [ 0 ] = data -> u64 ? true : false;
-    return dst + 1;
-}
-
-static
-void *write_U8 ( void *p, const nx *data )
-{
-    uint8_t *dst = p;
-    dst [ 0 ] = ( uint8_t ) data -> u64;
-    if ( ( uint64_t ) dst [ 0 ] != data -> u64 )
-        return NULL;
-    return dst + 1;
-}
-
-static
-void *write_U16 ( void *p, const nx *data )
-{
-    uint16_t *dst = p;
-    dst [ 0 ] = ( uint16_t ) data -> u64;
-    if ( ( uint64_t ) dst [ 0 ] != data -> u64 )
-        return NULL;
-    return dst + 1;
-}
-
-static
-void *write_U32 ( void *p, const nx *data )
-{
-    uint32_t *dst = p;
-    dst [ 0 ] = ( uint32_t ) data -> u64;
-    if ( ( uint64_t ) dst [ 0 ] != data -> u64 )
-        return NULL;
-    return dst + 1;
-}
-
-static
-void *write_U64 ( void *p, const nx *data )
-{
-    uint64_t *dst = p;
-    dst [ 0 ] = data -> u64;
-    return dst + 1;
-}
-
-static
-void *write_I8 ( void *p, const nx *data )
-{
-    int8_t *dst = p;
-    dst [ 0 ] = ( int8_t ) data -> i64;
-    if ( ( int64_t ) dst [ 0 ] != data -> i64 )
-        return NULL;
-    return dst + 1;
-}
-
-static
-void *write_I16 ( void *p, const nx *data )
-{
-    int16_t *dst = p;
-    dst [ 0 ] = ( int16_t ) data -> i64;
-    if ( ( int64_t ) dst [ 0 ] != data -> i64 )
-        return NULL;
-    return dst + 1;
-}
-
-static
-void *write_I32 ( void *p, const nx *data )
-{
-    int32_t *dst = p;
-    dst [ 0 ] = ( int32_t ) data -> i64;
-    if ( ( int64_t ) dst [ 0 ] != data -> i64 )
-        return NULL;
-    return dst + 1;
-}
-
-static
-void *write_I64 ( void *p, const nx *data )
-{
-    int64_t *dst = p;
-    dst [ 0 ] = data -> i64;
-    return dst + 1;
-}
-
-static
-void *write_F32 ( void *p, const nx *data )
-{
-    double e;
-    float *dst = p;
-    dst [ 0 ] = ( float ) data -> f64;
-    e = ( double ) dst [ 0 ] - data -> f64;
-    if ( -1.0 < e || e > 1.0 )
-        return NULL;
-    return dst + 1;
-}
-
-static
-void *write_F64 ( void *p, const nx *data )
-{
-    double *dst = p;
-    dst [ 0 ] = data -> f64;
-    return dst + 1;
-}
-
-
-/* converters
- *  convert from one data type to another
- */
-static
-nx *null_cvt ( nx *data )
-{
-    return data;
-}
-
-static
-nx *uint_int ( nx *data )
-{
-    if ( data -> i64 < 0 )
-        return NULL;
-    return data;
-}
-
-static
-nx *uint_float ( nx *data )
-{
-    if ( data -> i64 < 0 )
-        return NULL;
-    data -> f64 = (double)data -> i64;
-    return data;
-}
-
-static
-nx *int_float ( nx *data )
-{
-    data -> f64 = (double)data -> i64;
-    return data;
-}
-
-static
-nx *float_int ( nx *data )
-{
-    data -> i64 = ( int64_t ) data -> f64;
-    return data;
-}
-
-static
-nx *float_uint ( nx *data )
-{
-    data -> i64 = ( int64_t ) data -> f64;
-    if ( data -> i64 < 0 )
-        return NULL;
-    return data;
-}
-
-static
-nx *int_uint ( nx *data )
-{
-    if ( data -> i64 < 0 )
-        return NULL;
-    return data;
-}
-
-/* eval-numeric-expr
- *  tries to evaluate a constant numeric expression against type
- *  returns non-zero error code if failed
- */
-#if SLVL >= 1
-LIB_EXPORT rc_t CC eval_numeric_expr ( const VSchema *self, const VTypedecl *td,
-    const SConstExpr *expr, SConstExpr **xp, bool force )
-{
-    SConstExpr *x;
-    uint32_t sbits, sdim;
-    uint32_t i, dbits, ddim;
-
-    void *dst;
-    const void *src;
-
-    const void* ( * reader ) ( nx*, const void* );
-    void* ( * writer ) ( void*, const nx* );
-    nx* ( * cvt ) ( nx* );
-
-    /* source and destination types of constant vector */
-    const SDatatype *sdt = VSchemaFindTypeid ( self, expr -> td . type_id );
-    const SDatatype *ddt = VSchemaFindTypeid ( self, td -> type_id );
-    if ( sdt == NULL || ddt == NULL )
-        return RC ( rcVDB, rcExpression, rcEvaluating, rcType, rcNotFound );
-
-    /* size of source and destination types */
-    sbits = sdt -> size;
-    dbits = ddt -> size;
-
-    /* regardless of how derived the specified types may be,
-       get their dimensions in terms of intrinsic types */
-    sdim = SDatatypeIntrinsicDim ( sdt );
-    ddim = SDatatypeIntrinsicDim ( ddt );
-
-    /* convert stated sizes to intrinsic element size */
-    assert ( sdim != 0 && ( sbits % sdim ) == 0 );
-    sbits /= sdim;
-    assert ( ddim != 0 && ( dbits % ddim ) == 0 );
-    dbits /= ddim;
-
-    /* test for cast compatibility */
-    if ( ! force ) switch ( ddt -> domain )
-    {
-    case ddBool:
-        /* only bool casts to bool */
-        if ( sdt -> domain != ddBool )
-            return RC ( rcVDB, rcExpression, rcEvaluating, rcType, rcIncorrect );
-        break;
-    case ddUint: case ddInt: case ddFloat:
-        if ( sdt -> domain > ddt -> domain )
-            return RC ( rcVDB, rcExpression, rcEvaluating, rcType, rcIncorrect );
-        break;
-    default:
-        return RC ( rcVDB, rcExpression, rcEvaluating, rcType, rcUnexpected );
-    }
-
-    /* reset dimensions to account for explicit values */
-    sdim *= expr -> td . dim;
-    i = ddim * td -> dim;
-
-    /* destination dim must divide source dim evenly */
-    if ( i == 0 || sdim < i || ( sdim % i ) != 0 )
-        return RC ( rcVDB, rcExpression, rcEvaluating, rcType, rcIncorrect );
-
-    /* determine reader */
-    switch ( sdt -> domain )
-    {
-    case ddBool:
-        reader = read_bool; break;
-    case ddUint:
-        switch ( sbits )
-        {
-        case 8:  reader = read_U8; break;
-        case 16: reader = read_U16; break;
-        case 32: reader = read_U32; break;
-        case 64: reader = read_U64; break;
-        default:
-            return RC ( rcVDB, rcExpression, rcEvaluating, rcType, rcUnexpected );
-        }
-        break;
-    case ddInt:
-        switch ( sbits )
-        {
-        case 8:  reader = read_I8; break;
-        case 16: reader = read_I16; break;
-        case 32: reader = read_I32; break;
-        case 64: reader = read_I64; break;
-        default:
-            return RC ( rcVDB, rcExpression, rcEvaluating, rcType, rcUnexpected );
-        }
-        break;
-    case ddFloat:
-        switch ( sbits )
-        {
-        case 32: reader = read_F32; break;
-        case 64: reader = read_F64; break;
-        default:
-            return RC ( rcVDB, rcExpression, rcEvaluating, rcType, rcUnexpected );
-        }
-        break;
-    default:
-        /* here to quiet compiler complaints */
-        reader = NULL;
-    }
-
-    /* determine writer */
-    switch ( ddt -> domain )
-    {
-    case ddBool:
-        writer = write_bool; break;
-    case ddUint:
-        switch ( dbits )
-        {
-        case 8:  writer = write_U8; break;
-        case 16: writer = write_U16; break;
-        case 32: writer = write_U32; break;
-        case 64: writer = write_U64; break;
-        default:
-            return RC ( rcVDB, rcExpression, rcEvaluating, rcType, rcUnexpected );
-        }
-        break;
-    case ddInt:
-        switch ( dbits )
-        {
-        case 8:  writer = write_I8; break;
-        case 16: writer = write_I16; break;
-        case 32: writer = write_I32; break;
-        case 64: writer = write_I64; break;
-        default:
-            return RC ( rcVDB, rcExpression, rcEvaluating, rcType, rcUnexpected );
-        }
-        break;
-    case ddFloat:
-        switch ( dbits )
-        {
-        case 32: writer = write_F32; break;
-        case 64: writer = write_F64; break;
-        default:
-            return RC ( rcVDB, rcExpression, rcEvaluating, rcType, rcUnexpected );
-        }
-        break;
-    default:
-        writer = NULL;
-    }
-
-    /* determine converter */
-    if ( sdt -> domain == ddt -> domain )
-        cvt = null_cvt;
-    else switch ( ddt -> domain )
-    {
-    case ddBool:
-    case ddUint:
-        switch ( sdt -> domain )
-        {
-        case ddInt:
-            cvt = int_uint; break;
-        case ddFloat:
-            cvt = float_uint; break;
-        default:
-            cvt = null_cvt;
-        }
-        break;
-    case ddInt:
-        switch ( sdt -> domain )
-        {
-        case ddFloat:
-            cvt = float_int; break;
-        default:
-            cvt = uint_int; break;
-        }
-        break;
-    case ddFloat:
-        switch ( sdt -> domain )
-        {
-        case ddInt:
-            cvt = int_float; break;
-        default:
-            cvt = uint_float; break;
-        }
-        break;
-    default:
-        cvt = null_cvt;
-    }
-
-    /* create output object */
-    {
-	unsigned int alloc_size;
-
-	alloc_size=(((size_t)dbits * sdim + 7) >> 3);
-	if(alloc_size < sizeof(x->u)){ /** don't go below size of union ***/
-		alloc_size=sizeof(*x);	
-	} else { /** overallocate here ***/
-		alloc_size+=sizeof(*x)-sizeof(x->u);
-	}
-	alloc_size = (alloc_size+3)&~3; /** align to 4 bytes **/
-    	x = malloc ( alloc_size );
-	if ( x == NULL )
-            return RC ( rcVDB, rcExpression, rcEvaluating, rcMemory, rcExhausted );
-	memset(x,0,alloc_size);
-    }
-
-    /* copy, and perform type conversion */
-    src = & expr -> u;
-    dst = & x -> u;
-    for ( i = 0; i < sdim; ++ i )
-    {
-        nx data;
-        const nx *dp;
-
-        /* read element */
-        src = ( * reader ) ( & data, src );
-
-        /* type-promote */
-        dp = ( * cvt ) ( & data );
-        if ( dp == NULL )
-        {
-            free ( x );
-            return RC ( rcVDB, rcExpression, rcEvaluating, rcConstraint, rcViolated );
-        }
-
-        /* write element */
-        dst = ( * writer ) ( dst, dp );
-        if ( dst == NULL )
-        {
-            free ( x );
-            return RC ( rcVDB, rcExpression, rcEvaluating, rcConstraint, rcViolated );
-        }
-    }
-
-    /* it is done */
-    x -> dad . var = eConstExpr;
-    atomic32_set ( & x -> dad . refcount, 1 );
-    x -> td . type_id = td -> type_id;
-    x -> td . dim = sdim / ddim;
-    * xp = x;
-    return 0;
-}
-#endif
-
-
-/*--------------------------------------------------------------------------
- * constant textual expressions
- *
- *  built-in typecasting allows for the chain
- *    ascii => unicode
- *
- *  built-in size promotion is automatic from 8 => 16 => 32 bits
- *
- *  constant size-demotion is allowed due to knowledge of constant value
- *
- *  explicit casts may reverse type promotion rules
- */
-
-
-static
-const void *read_ascii ( uint32_t *ch, const void *p, const void *end )
-{
-    const char *src = p;
-    if ( src [ 0 ] < 0 )
-        return NULL;
-    * ch = src [ 0 ];
-    return src + 1;
-}
-
-static
-const void *read_utf8 ( uint32_t *ch, const void *p, const void *end )
-{
-    const char *src = p;
-    int len = utf8_utf32 ( ch, src, end );
-    if ( len <= 0 )
-        return NULL;
-    return src + len;
-}
-
-static
-const void *read_utf16 ( uint32_t *ch, const void *p, const void *end )
-{
-    const uint16_t *src = p;
-    * ch = src [ 0 ];
-    return src + 1;
-}
-
-static
-const void *read_utf32 ( uint32_t *ch, const void *p, const void *end )
-{
-    const uint32_t *src = p;
-    * ch = src [ 0 ];
-    return src + 1;
-}
-
-static
-void *write_ascii ( void *p, void *end, uint32_t ch )
-{
-    char *dst = p;
-    if ( ch >= 128 )
-        ch = '?';
-    dst [ 0 ] = ( char ) ch;
-    return dst + 1;
-}
-
-static
-void *write_utf8 ( void *p, void *end, uint32_t ch )
-{
-    char *dst = p;
-    int len = utf32_utf8 ( dst, end, ch );
-    if ( len <= 0 )
-        return NULL;
-    return dst + len;
-}
-
-static
-void *write_utf16 ( void *p, void *end, uint32_t ch )
-{
-    uint16_t *dst = p;
-    if ( ch > 0x10000 )
-        ch = '?';
-    dst [ 0 ] = ( uint16_t ) ch;
-    return dst + 1;
-}
-
-static
-void *write_utf32 ( void *p, void *end, uint32_t ch )
-{
-    uint32_t *dst = p;
-    dst [ 0 ] = ch;
-    return dst + 1;
-}
-
-#if SLVL >= 1
-LIB_EXPORT rc_t CC eval_text_expr ( const VSchema *self, const VTypedecl *td,
-    const SConstExpr *expr, SConstExpr **xp, bool force )
-{
-    size_t size;
-    uint32_t len;
-    SConstExpr *x;
-    uint32_t sbits, sdim;
-    uint32_t i, dbits, ddim;
-
-    void *dst, *dend;
-    const void *src, *send;
-    void* ( * writer ) ( void*, void*, uint32_t );
-    const void* ( * reader ) ( uint32_t*, const void*, const void* );
-
-    /* source and destination types of constant vector */
-    const SDatatype *sdt = VSchemaFindTypeid ( self, expr -> td . type_id );
-    const SDatatype *ddt = VSchemaFindTypeid ( self, td -> type_id );
-    if ( sdt == NULL || ddt == NULL )
-        return RC ( rcVDB, rcExpression, rcEvaluating, rcType, rcNotFound );
-
-    /* size of source and destination types */
-    sbits = sdt -> size;
-    dbits = ddt -> size;
-
-    /* regardless of how derived the specified types may be,
-       get their dimensions in terms of intrinsic types */
-    sdim = SDatatypeIntrinsicDim ( sdt );
-    ddim = SDatatypeIntrinsicDim ( ddt );
-
-    /* convert stated sizes to intrinsic element size */
-    assert ( sdim != 0 && ( sbits % sdim ) == 0 );
-    sbits /= sdim;
-    assert ( ddim != 0 && ( dbits % ddim ) == 0 );
-    dbits /= ddim;
-
-    /* test for cast compatibility */
-    if ( ! force ) switch ( ddt -> domain )
-    {
-    case ddAscii:
-        /* only ascii casts to ascii */
-        if ( sdt -> domain != ddAscii )
-            return RC ( rcVDB, rcExpression, rcEvaluating, rcType, rcIncorrect ); 
-        break;
-    case ddUnicode:
-        if ( sdt -> domain < ddAscii || sdt -> domain > ddt -> domain )
-            return RC ( rcVDB, rcExpression, rcEvaluating, rcType, rcIncorrect );
-        break;
-    default:
-        return RC ( rcVDB, rcExpression, rcEvaluating, rcType, rcUnexpected );
-    }
-
-    /* restore source dimension */
-    sdim *= expr -> td . dim;
-
-    /* determine reader and length */
-    len = sdim;
-    switch ( sdt -> domain )
-    {
-    case ddAscii:
-        reader = read_ascii; break;
-    default:
-        switch ( sbits )
-        {
-        case 8:
-            reader = read_utf8;
-            len = string_len ( expr -> u . utf8, sdim );
-            break;
-        case 16:
-            reader = read_utf16;
-            break;
-        case 32:
-            reader = read_utf32;
-            break;
-        default:
-            return RC ( rcVDB, rcExpression, rcEvaluating, rcType, rcUnexpected );
-        }
-    }
-
-    /* determine writer and size */
-    ddim = len;
-    switch ( ddt -> domain )
-    {
-    case ddAscii:
-        writer = write_ascii;
-        size = len;
-        break;
-    default:
-        switch ( sbits )
-        {
-        case 8:
-            writer = write_utf8;
-            switch ( dbits )
-            {
-            case 16:
-                utf16_cvt_string_len ( expr -> u . utf16, len << 1, & size );
-                break;
-            case 32:
-                utf32_cvt_string_len ( expr -> u . utf32, len << 2, & size );
-                break;
-            default:
-                size = sdim;
-            }
-            ddim = ( uint32_t ) size;
-            break;
-        case 16:
-            writer = write_utf16;
-            size = len << 1;
-            break;
-        case 32:
-            writer = write_utf32;
-            size = len << 2;
-            break;
-        default:
-            return RC ( rcVDB, rcExpression, rcEvaluating, rcType, rcUnexpected );
-        }
-    }
-
-    /* create output object */
-    {
-	unsigned int alloc_size;
-
-	alloc_size=size;
-	if(alloc_size < sizeof(x->u)){ /** don't go below size of union ***/
-		alloc_size=sizeof(*x);	
-	} else { /** overallocate here ***/
-		alloc_size+=sizeof(*x)-sizeof(x->u);
-	}
-	alloc_size = (alloc_size+3)&~3; /** align to 4 bytes **/
-    	x = malloc ( alloc_size );
-	if ( x == NULL )
-		return RC ( rcVDB, rcExpression, rcEvaluating, rcMemory, rcExhausted );
-	memset(x,0,alloc_size);
-    }
-   
-
-    /* copy, and perform type conversion */
-    src = expr -> u . utf8;
-    send = & expr -> u . utf8 [ sdim ];
-    dst = x -> u . utf8;
-    dend = & x -> u . utf8 [ size ];
-    for ( i = 0; i < len; ++ i )
-    {
-        uint32_t ch;
-
-        /* read character */
-        src = ( * reader ) ( & ch, src, send );
-        if ( src == NULL )
-        {
-            free ( x );
-            return RC ( rcVDB, rcExpression, rcEvaluating, rcData, rcCorrupt );
-        }
-
-        /* write character */
-        dst = ( * writer ) ( dst, dend, ch );
-        if ( dst == NULL )
-        {
-            free ( x );
-            return RC ( rcVDB, rcExpression, rcEvaluating, rcData, rcCorrupt );
-        }
-    }
-
-    /* it is done */
-    x -> dad . var = eConstExpr;
-    atomic32_set ( & x -> dad . refcount, 1 );
-    x -> td . type_id = td -> type_id;
-    x -> td . dim = ddim;
-    * xp = x;
-    return 0;
-}
-#endif
-
-
-/*--------------------------------------------------------------------------
- * SConstExpr
- */
-
-
-/* Resolve
- *  return constant expression as a vector of indicated type
- */
-rc_t SConstExprResolveAsBool ( const SConstExpr *self,
-    const VSchema *schema, bool *b, uint32_t capacity );
-rc_t SConstExprResolveAsI8 ( const SConstExpr *self,
-    const VSchema *schema, int8_t *i8, uint32_t capacity );
-rc_t SConstExprResolveAsI16 ( const SConstExpr *self,
-    const VSchema *schema, int16_t *i16, uint32_t capacity );
-rc_t SConstExprResolveAsI32 ( const SConstExpr *self,
-    const VSchema *schema, int32_t *i32, uint32_t capacity );
-rc_t SConstExprResolveAsI64 ( const SConstExpr *self,
-    const VSchema *schema, int64_t *i64, uint32_t capacity );
-rc_t SConstExprResolveAsU8 ( const SConstExpr *self,
-    const VSchema *schema, uint8_t *u8, uint32_t capacity );
-rc_t SConstExprResolveAsU16 ( const SConstExpr *self,
-    const VSchema *schema, uint16_t *u16, uint32_t capacity );
-
-rc_t SConstExprResolveAsU32 ( const SConstExpr *self,
-    const VSchema *schema, uint32_t *u32, uint32_t capacity, Vector *cx_bind )
-{
-    if ( capacity != 1 )
-        return RC ( rcVDB, rcExpression, rcEvaluating, rcType, rcUnsupported );
-    return eval_uint_expr ( schema, ( const SExpression* ) self, u32, cx_bind );
-}
-
-rc_t SConstExprResolveAsU64 ( const SConstExpr *self,
-    const VSchema *schema, uint32_t *u64, uint32_t capacity );
-rc_t SConstExprResolveAsF32 ( const SConstExpr *self,
-    const VSchema *schema, float *f32, uint32_t capacity );
-rc_t SConstExprResolveAsF64 ( const SConstExpr *self,
-    const VSchema *schema, double *f64, uint32_t capacity );
-rc_t SConstExprResolveAsAscii ( const SConstExpr *self,
-    const VSchema *schema, char *ascii, size_t capacity );
-rc_t SConstExprResolveAsUTF8 ( const SConstExpr *self,
-    const VSchema *schema, char *utf8, size_t bytes );
-rc_t SConstExprResolveAsUTF16 ( const SConstExpr *self,
-    const VSchema *schema, uint16_t *utf16, uint32_t capacity );
-rc_t SConstExprResolveAsUTF32 ( const SConstExpr *self,
-    const VSchema *schema, uint32_t *utf32, uint32_t capacity );
-
-
-/*--------------------------------------------------------------------------
- * STypeExpr
- */
-
-/* Resolve
- *  resolve type expression to either a VTypedecl or VFormatdecl
- */
-rc_t STypeExprResolveAsFormatdecl ( const STypeExpr *self,
-    const VSchema *schema, VFormatdecl *fd, Vector *cx_bind )
-{
-    rc_t rc;
-    uint32_t dim;
-
-    /* if self is resolved, then the format, type
-       and dimension are completely resolved */
-    if ( self -> resolved )
-    {
-        * fd = self -> fd;
-        return 0;
-    }
-
-#if SLVL < 3
-    return RC ( rcVDB, rcExpression, rcEvaluating, rcType, rcIncorrect );
-#else
-    /* the format is always completely resolved,
-       this leaves type and/or dimension */
-
-    if ( self -> id != NULL )
-    {
-        /* the type needs to be resolved */
-        const STypeExpr *type = ( const STypeExpr* ) VectorGet ( cx_bind, self -> id -> type_id );
-        if ( type == NULL )
-            return RC ( rcVDB, rcExpression, rcEvaluating, rcType, rcUndefined );
-        if ( type -> dad . var != eTypeExpr )
-            return RC ( rcVDB, rcExpression, rcEvaluating, rcType, rcIncorrect );
-        rc = STypeExprResolveAsFormatdecl ( type, schema, fd, cx_bind );
-        if ( rc != 0 )
-            return rc;
-
-        /* at this point, "fd" has some format - which we'll clobber,
-           a type and dim from the indirect type just resolved */
-    }
-    else
-    {
-        /* take known type and default dimension */
-        fd -> td . type_id = self -> fd . td . type_id;
-        fd -> td . dim = 1;
-    }
-
-    /* always take our format */
-    fd -> fmt = self -> fd . fmt;
-
-    /* test for unresolved dimension */
-    dim = self -> fd . td . dim;
-    if ( dim == 0 && self -> dim != NULL )
-    {
-        const SExpression *dx = self -> dim;
-        while ( dx != NULL )
-        {
-            const SIndirectConst *ic;
-
-            if ( dx -> var == eConstExpr )
-            {
-                rc = SConstExprResolveAsU32 ( ( const SConstExpr* ) dx, schema, & dim, 1, cx_bind );
-                if ( rc != 0 )
-                    return rc;
-                break;
-            }
-
-            if ( dx -> var != eIndirectExpr )
-                return RC ( rcVDB, rcExpression, rcEvaluating, rcType, rcIncorrect );
-
-            ic = ( ( const SSymExpr* ) dx ) -> _sym -> u . obj;
-            assert ( ic != NULL );
-
-            dx = ( const SExpression* ) VectorGet ( cx_bind, ic -> expr_id );
-        }
-
-        /* must have non-zero dim */
-        if ( dim == 0 )
-            return RC ( rcVDB, rcExpression, rcEvaluating, rcType, rcUndefined );
-    }
-
-    /* factor in our dimension */
-    fd -> td . dim *= dim;
-    return 0;
-#endif
-}
-
-rc_t STypeExprResolveAsTypedecl ( const STypeExpr *self,
-    const VSchema *schema, VTypedecl *td, Vector *cx_bind )
-{
-    VFormatdecl fd;
-    rc_t rc = STypeExprResolveAsFormatdecl ( self, schema, & fd, cx_bind );
-    if ( rc == 0 )
-    {
-        if ( fd . fmt != 0 )
-            return RC ( rcVDB, rcExpression, rcEvaluating, rcType, rcIncorrect );
-        * td = fd . td;
-    }
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * general constant expression evaluation
- */
-#if SLVL >= 1
-
-/* eval-type-expr
- *  should be able to boil things down to defined type vector
- */
-static
-rc_t eval_type_expr ( const VSchema *self, const VTypedecl *td,
-    const STypeExpr *expr, SExpression **xp )
-{
-    PLOGMSG( klogWarn, ( klogWarn, "TDB: $(msg)", "msg=handle type expression" ));
-    return -1;
-}
-
-/* eval-indirect-expr
- */
-static
-rc_t eval_indirect_expr ( const VSchema *self, const VTypedecl *td,
-    const SSymExpr *expr, SExpression **xp, Vector *cx_bind )
-{
-    const SIndirectConst *ic = expr -> _sym -> u . obj;
-
-    /* if the expression is there */
-    if ( ic -> expr_id != 0 )
-    {
-        const SExpression *ic_expr = ( const SExpression* ) VectorGet ( cx_bind, ic -> expr_id );
-        if ( ic_expr != NULL )
-            return eval_const_expr ( self, td, ic_expr, xp, cx_bind );
-    }
-
-    /* just return self */
-    * xp = & ( ( SSymExpr* ) expr ) -> dad;
-    atomic32_inc ( & ( ( SSymExpr* ) expr ) -> dad . refcount );
-    return 0;
-}
-
-
-/* eval-const-cast-expr
- */
-static
-rc_t eval_const_cast_expr ( const VSchema *self, const VTypedecl *td,
-    const SExpression *expr, SExpression **xp )
-{
-    PLOGMSG( klogWarn, ( klogWarn, "TDB: $(msg)", "msg=handle const cast expression" ));
-    return -1;
-}
-
-
-/* eval-func-param-expr
- */
-static
-rc_t eval_func_param_expr ( const VSchema *self, const VTypedecl *td,
-    const SExpression *expr, SExpression **xp )
-{
-    PLOGMSG( klogWarn, ( klogWarn, "TDB: $(msg)", "msg=handle function expression" ));
-    return -1;
-}
-
-struct eval_vector_param_expr_pb
-{
-    rc_t rc;
-    const VSchema *self;
-    const VTypedecl *td;
-    Vector *cx_bind;
-    Vector v;
-};
-
-static
-void CC vector_free ( void *item, void *data )
-{
-    free ( item );
-}
-
-static
-bool CC do_eval_vector_param_expr ( void *item, void *data )
-{
-    struct eval_vector_param_expr_pb *pb = data;
-    SExpression *rslt = NULL;
-    
-    pb -> rc = eval_const_expr ( pb -> self, pb -> td, item, & rslt, pb -> cx_bind );
-    if ( pb -> rc != 0 )
-        return true;
-
-    switch ( rslt -> var )
-    {
-    case eConstExpr:
-        VectorAppend ( & pb -> v, NULL, rslt );
-        break;
-    case eVectorExpr:
-        free ( rslt );
-        break;
-    default:
-        free ( rslt );
-        pb -> rc = RC ( rcVDB, rcExpression, rcEvaluating, rcExpression, rcUnexpected );
-        return true;
-    }
-
-    return false;
-}
-
-/* eval-vector-param-expr
- */
-static
-rc_t eval_vector_param_expr ( const VSchema *self, const VTypedecl *td,
-    const SVectExpr *expr, SExpression **xp, Vector *cx_bind )
-{
-    struct eval_vector_param_expr_pb pb;
-
-    *xp = NULL;
-    
-    pb . rc = 0;
-    pb . self = self;
-    pb . td = td;
-    pb . cx_bind = cx_bind;
-    VectorInit ( & pb . v, 0, 32 );
-    
-    VectorDoUntil ( & expr -> expr, 0, do_eval_vector_param_expr, & pb );
-    if ( pb . rc == 0 )
-    {
-        SConstExpr *rslt;
-        uint32_t elem_count = VectorLength ( & pb . v );
-        uint32_t elem_bits;
-        size_t alloc_size;
-        
-        {
-            const SDatatype *dt = VSchemaFindTypeid ( self, td -> type_id );
-            elem_bits = dt -> size;
-        }
-
-        alloc_size = ( ( ( size_t ) elem_bits * elem_count + 7 ) >> 3 );
-
-        /** don't go below size of union ***/
-        if ( alloc_size < sizeof rslt -> u )
-            alloc_size = sizeof * rslt;	
-        /** overallocate here ***/
-        else
-            alloc_size += sizeof * rslt - sizeof rslt -> u ;
-
-        /** align to 4 bytes **/
-        alloc_size = ( alloc_size + 3 ) & ~ 3;
-        rslt = calloc ( alloc_size, 1 );
-        if ( rslt == NULL )
-            pb . rc = RC ( rcVDB, rcExpression, rcEvaluating, rcMemory, rcExhausted );
-        else
-        {
-            uint32_t i;
-
-            rslt -> dad . var = eConstExpr;
-            atomic32_set ( & rslt -> dad . refcount, 1 );
-            rslt -> td = *td;
-            rslt -> td . dim = elem_count;
-            
-            for ( i = 0; i != elem_count; ++i )
-            {
-                const SConstExpr *y = VectorGet ( & pb . v, i );
-                bitcpy ( & rslt -> u, i * elem_bits, & y -> u, 0, elem_bits );
-            }
-
-            *xp = & rslt -> dad;
-        }
-    }
-
-    VectorWhack( & pb . v, vector_free, 0 );
-
-    return pb . rc;
-}
-
-
-/* eval-const-expr
- *  tries to evaluate a constant expression against type
- *  returns non-zero error code if failed
- */
-rc_t eval_const_expr ( const VSchema *self, const VTypedecl *td,
-    const SExpression *expr, SExpression **xp, Vector *cx_bind )
-{
-    rc_t rc;
-    const SConstExpr *s;
-
-    switch ( expr -> var )
-    {
-    case eTypeExpr:
-        return eval_type_expr ( self, td, ( const STypeExpr* ) expr, xp );
-    case eConstExpr:
-        s = ( const SConstExpr* ) expr;
-        break;
-#if SLVL >= 3
-    case eIndirectExpr:
-        return eval_indirect_expr ( self, td, ( const SSymExpr* ) expr, xp, cx_bind );
-#endif
-#if SLVL >= 4
-    case eFuncParamExpr:
-        return eval_func_param_expr ( self, td, expr, xp );
-#endif
-    case eCastExpr:
-        return eval_const_cast_expr ( self, td, expr, xp );
-    case eVectorExpr:
-        return eval_vector_param_expr(self, td, ( const SVectExpr* ) expr, xp, cx_bind );
-    default:
-        *xp = NULL;
-        return RC ( rcVDB, rcExpression, rcEvaluating, rcExpression, rcUnexpected );
-    }
-
-    /* try to evaluate as numeric */
-    rc = eval_numeric_expr ( self, td, s, ( SConstExpr** ) xp, false );
-
-    /* fall over to text */
-    if ( rc != 0 && GetRCState ( rc ) == rcUnexpected && GetRCObject ( rc ) == rcType )
-        rc = eval_text_expr ( self, td, s, ( SConstExpr** ) xp, false );
-
-    return rc;
-}
-
-/* eval-uint-expr
- *  special const expression evaluator for uint32_t
- */
-rc_t eval_uint_expr ( const VSchema *self,
-    const SExpression *expr, uint32_t *value, Vector *cx_bind )
-{
-    rc_t rc;
-    VTypedecl td;
-    SConstExpr *x;
-
-    /* capture runtime value for U32 */
-    static atomic32_t s_U32_id;
-    uint32_t U32_id = VSchemaCacheIntrinsicTypeId ( self, & s_U32_id, "U32" );
-
-    /* evaluate expression against type */
-    td . type_id = U32_id;
-    td . dim = 1;
-    rc = eval_const_expr ( self, & td, expr, ( SExpression** ) & x, cx_bind );
-    if ( rc != 0 )
-        return rc;
-
-    /* verify dimensionality */
-    assert ( x -> dad . var == eConstExpr );
-    if ( x -> td . dim != 1 )
-        return RC ( rcVDB, rcExpression, rcEvaluating, rcType, rcIncorrect );
-
-    /* got it */
-    * value = x -> u . u32 [ 0 ];
-    free ( x );
-    return 0;
-}
-
-
-/* eval-uint64-expr
- *  special const expression evaluator for uint32_t
- */
-rc_t eval_uint64_expr ( const VSchema *self,
-    const SExpression *expr, uint64_t *value, Vector *cx_bind )
-{
-    rc_t rc;
-    VTypedecl td;
-    SConstExpr *x;
-
-    /* capture runtime value for U64 */
-    static atomic32_t s_U64_id;
-    uint64_t U64_id = VSchemaCacheIntrinsicTypeId ( self, & s_U64_id, "U64" );
-
-    /* evaluate expression against type */
-    td . type_id = U64_id;
-    td . dim = 1;
-    rc = eval_const_expr ( self, & td, expr, ( SExpression** ) & x, cx_bind );
-    if ( rc != 0 )
-        return rc;
-
-    /* verify dimensionality */
-    assert ( x -> dad . var == eConstExpr );
-    if ( x -> td . dim != 1 )
-        return RC ( rcVDB, rcExpression, rcEvaluating, rcType, rcIncorrect );
-
-    /* got it */
-    * value = x -> u . u64 [ 0 ];
-    free ( x );
-    return 0;
-}
-
-
-/* eval-expr-syntax
- *  examine expression syntax
- *  fixes forward references
- */
-static
-bool CC eval_vect_expr_syntax ( void *item, void *data )
-{
-    rc_t *rc = data;
-    SExpression *x = item;
-    * rc = eval_expr_syntax ( x );
-    return ( * rc != 0 ) ? true : false;
-}
-
-static
-rc_t eval_type_expr_syntax ( const STypeExpr *expr )
-{
-    if ( expr -> dad . var != eTypeExpr )
-        return RC ( rcVDB, rcExpression, rcValidating, rcExpression, rcIncorrect );
-    return 0;
-}
-
-static
-rc_t eval_fwd_expr_syntax ( SSymExpr *expr )
-{
-    const KSymbol *sym = expr -> _sym;
-    assert ( sym != NULL );
-    switch ( sym -> type )
-    {
-    case eFuncParam:
-        expr -> dad . var = eParamExpr;
-        break;
-    case eProduction:
-        expr -> dad . var = eProdExpr;
-        break;
-    case eColumn:
-        expr -> dad . var = eColExpr;
-        break;
-    case ePhysMember:
-        expr -> dad . var = ePhysExpr;
-        break;
-    case eForward:
-        return RC ( rcVDB, rcSchema, rcValidating, rcName, rcUndefined );
-    case eVirtual:
-        break;
-
-    default:
-        return RC ( rcVDB, rcSchema, rcValidating, rcExpression, rcInvalid );
-    }
-
-    return 0;
-}
-
-rc_t eval_expr_syntax ( const SExpression *expr )
-{
-    rc_t rc;
-
-    if ( expr == NULL )
-        rc = RC ( rcVDB, rcExpression, rcValidating, rcSelf, rcNull );
-    else switch ( expr -> var )
-    {
-    case eFwdExpr:
-        rc = eval_fwd_expr_syntax ( ( SSymExpr* ) expr );
-        break;
-    case eCastExpr:
-        rc = eval_type_expr_syntax ( ( const STypeExpr* ) ( ( const SBinExpr* ) expr ) -> left );
-        if ( rc == 0 )
-            rc = eval_expr_syntax ( ( ( const SBinExpr* ) expr ) -> right );
-        break;
-    case eVectorExpr:
-        rc = 0;
-        VectorDoUntil ( & ( ( const SVectExpr* ) expr ) -> expr, false, eval_vect_expr_syntax, & rc );
-        break;
-    case eCondExpr:
-        rc = eval_expr_syntax ( ( ( const SBinExpr* ) expr ) -> left );
-        if ( rc == 0 )
-            rc = eval_expr_syntax ( ( ( const SBinExpr* ) expr ) -> right );
-        break;
-    default:
-        rc = 0;
-    }
-
-    return rc;
-}
-
-#endif
diff --git a/libs/vdb/schema-expr.c b/libs/vdb/schema-expr.c
deleted file mode 100644
index 139cdee..0000000
--- a/libs/vdb/schema-expr.c
+++ /dev/null
@@ -1,2169 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#include "schema-priv.h"
-#include "schema-parse.h"
-#include "schema-expr.h"
-#include "schema-dump.h"
-
-#include <klib/symbol.h>
-#include <klib/symtab.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * SExpression
- */
-#if SLVL >= 1
-void SExpressionWhack ( const SExpression *cself )
-{
-    SExpression *self = ( SExpression* ) cself;
-    if ( self != NULL && atomic32_dec_and_test ( & self -> refcount ) )
-    {
-        switch ( self -> var )
-        {
-        case eTypeExpr:
-        {
-            STypeExpr *x = ( STypeExpr* ) self;
-            SExpressionWhack ( x -> dim );
-            break;
-        }
-        case eFuncExpr:
-        case eScriptExpr:
-        {
-            SFuncExpr *x = ( SFuncExpr* ) self;
-            VectorWhack ( & x -> schem, SExpressionVWhack, NULL );
-            VectorWhack ( & x -> pfact, SExpressionVWhack, NULL );
-            VectorWhack ( & x -> pfunc, SExpressionVWhack, NULL );
-            break;
-        }
-        case ePhysEncExpr:
-        {
-            SPhysEncExpr *x = ( SPhysEncExpr* ) self;
-            VectorWhack ( & x -> schem, SExpressionVWhack, NULL );
-            VectorWhack ( & x -> pfact, SExpressionVWhack, NULL );
-            break;
-        }
-        case eNegateExpr:
-        {
-            SUnaryExpr *x = ( SUnaryExpr* ) self;
-            SExpressionWhack ( x -> expr );
-            break;
-        }
-        case eCastExpr:
-        case eCondExpr:
-        {
-            SBinExpr *x = ( SBinExpr* ) self;
-            SExpressionWhack ( x -> left );
-            SExpressionWhack ( x -> right );
-            break;
-        }
-        case eVectorExpr:
-        {
-            SVectExpr *x = ( SVectExpr* ) self;
-            VectorWhack ( & x -> expr, SExpressionVWhack, NULL );
-            break;
-        }}
-
-        free ( self );
-    }
-}
-
-void CC SExpressionVWhack ( void *item, void *ignore )
-{
-    SExpression *self = item;
-    SExpressionWhack ( self );
-}
-#endif
-
-/* Mark
- */
-#if SLVL >= 1
-void CC SExpressionMark ( void * item, void * data )
-{
-    const SExpression * self = item;
-    const VSchema * schema = data;
-    if ( self != NULL ) switch ( self -> var )
-    {
-    case eTypeExpr:
-        STypeExprMark ( ( const STypeExpr* ) self, schema );
-        break;
-    case eConstExpr:
-        VSchemaTypeMark ( schema, ( ( const SConstExpr* ) self ) -> td . type_id );
-        break;
-    case eIndirectExpr:
-    case eParamExpr:
-    case eProdExpr:
-    case eFwdExpr:
-    case eFuncParamExpr:
-    case eColExpr:
-    case ePhysExpr:
-        SSymExprMark ( ( const SSymExpr* ) self, schema );
-        break;
-    case eFuncExpr:
-    case eScriptExpr:
-        SFuncExprMark ( ( const SFuncExpr* ) self, schema );
-        break;
-    case ePhysEncExpr:
-        SPhysEncExprMark ( ( const SPhysEncExpr* ) self, schema );
-        break;
-    case eNegateExpr:
-        SExpressionMark ( ( void * )( ( const SUnaryExpr* ) self ) -> expr, data );
-        break;
-    case eCastExpr:
-    case eCondExpr:
-        SExpressionMark ( ( void * )( ( const SBinExpr* ) self ) -> left, data );
-        SExpressionMark ( ( void * )( ( const SBinExpr* ) self ) -> right, data );
-        break;
-    case eVectorExpr:
-        VectorForEach ( & ( ( const SVectExpr* ) self ) -> expr, false,
-                        SExpressionMark, data );
-        break;
-    }
-}
-#endif
-
-/* Dump
- */
-#if SLVL >= 1
-bool CC SExpressionListDump ( void *item, void *data )
-{
-    SDumper *b = data;
-    const SExpression *self = ( const void* ) item;
-
-    SDumperSep ( b );
-    b -> rc = SExpressionDump ( self, b );
-    SDumperSepString ( b, SDumperMode ( b ) == sdmCompact ? "," : ", " );
-
-    return ( b -> rc != 0 ) ? true : false;
-}
-
-rc_t SExpressionBracketListDump ( const Vector *expr, SDumper *b,
-    const char *begin, const char *end )
-{
-    SDumperSepString ( b, begin );
-    if ( VectorDoUntil ( expr, false, SExpressionListDump, b ) )
-        return b -> rc;
-    return SDumperPrint ( b, end );
-}
-
-static
-rc_t STypeExprDump ( const STypeExpr *self, SDumper *b )
-{
-    rc_t rc;
-    if ( self -> fmt != NULL )
-    {
-        rc = SFormatDump ( self -> fmt, b );
-        if ( rc != 0 )
-            return rc;
-
-        if ( self -> dt == NULL && self -> ts == NULL && self -> id == NULL )
-            return 0;
-
-        rc = SDumperWrite ( b, "/", 1 );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    if ( self -> dt != NULL )
-        rc = SDatatypeDump ( self -> dt, b );
-    else if ( self -> ts != NULL )
-        rc = STypesetDump ( self -> ts, b );
-#if SLVL >= 3
-    else if ( self -> id != NULL )
-        rc = SIndirectTypeDump ( self -> id, b );
-#endif
-    else
-        rc = SDumperWrite ( b, "NULL", 4 );
-
-    if ( rc == 0 )
-    {
-        if ( SDumperMode ( b ) == sdmCompact )
-        {
-            if ( self -> dim != NULL )
-                rc = SDumperPrint ( b, "[%E]", self -> dim );
-            else if ( self -> fd . td . dim == 0 )
-                rc = SDumperPrint ( b, "[*]" );
-        }
-        else
-        {
-            if ( self -> dim != NULL )
-                rc = SDumperPrint ( b, " [ %E ]", self -> dim );
-            else if ( self -> fd . td . dim == 0 )
-                rc = SDumperPrint ( b, " [ * ]" );
-        }
-    }
-    
-    return rc;
-}
-
-static
-rc_t SConstExprDump ( const SConstExpr *self, SDumper *b )
-{
-    rc_t rc = 0;
-    bool compact = SDumperMode ( b ) == sdmCompact ? true : false;
-    const SDatatype *dt = VSchemaFindTypeid ( b -> schema, self -> td . type_id );
-    uint32_t bits = dt -> size;
-    uint32_t i, dim = SDatatypeIntrinsicDim ( dt );
-    assert ( dim != 0 && ( bits % dim ) == 0 );
-    bits /= dim;
-    dim *= self -> td . dim;
-
-    /* open a vector expression */
-    if ( dt -> domain < ddAscii && dim > 1 )
-    {
-        rc = SDumperPrint ( b, compact ? "[" : "[ " );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    SDumperSepString ( b, "" );
-
-    switch ( dt -> domain )
-    {
-    case ddBool:
-        for ( i = 0; i < dim; ++ i )
-        {
-            rc = SDumperPrint ( b, "\v%s", self -> u . b [ i ] ? "true" : "false" );
-            if ( rc != 0 )
-                return rc;
-            SDumperSepString ( b, compact ? "," : ", " );
-        }
-        break;
-    case ddUint:
-        switch ( bits )
-        {
-        case 8:
-            for ( i = 0; i < dim; ++ i )
-            {
-                rc = SDumperPrint ( b, "\v%u", self -> u . u8 [ i ] );
-                if ( rc != 0 )
-                    return rc;
-                SDumperSepString ( b, compact ? "," : ", " );
-            }
-            break;
-        case 16:
-            for ( i = 0; i < dim; ++ i )
-            {
-                rc = SDumperPrint ( b, "\v%u", self -> u . u16 [ i ] );
-                if ( rc != 0 )
-                    return rc;
-                SDumperSepString ( b, compact ? "," : ", " );
-            }
-            break;
-        case 32:
-            for ( i = 0; i < dim; ++ i )
-            {
-                rc = SDumperPrint ( b, "\v%u", self -> u . u32 [ i ] );
-                if ( rc != 0 )
-                    return rc;
-                SDumperSepString ( b, compact ? "," : ", " );
-            }
-            break;
-        case 64:
-            for ( i = 0; i < dim; ++ i )
-            {
-                rc = SDumperPrint ( b, "\v%lu", self -> u . u64 [ i ] );
-                if ( rc != 0 )
-                    return rc;
-                SDumperSepString ( b, compact ? "," : ", " );
-            }
-            break;
-        }
-        break;
-    case ddInt:
-        switch ( bits )
-        {
-        case 8:
-            for ( i = 0; i < dim; ++ i )
-            {
-                rc = SDumperPrint ( b, "\v%d", self -> u . i8 [ i ] );
-                if ( rc != 0 )
-                    return rc;
-                SDumperSepString ( b, compact ? "," : ", " );
-            }
-            break;
-        case 16:
-            for ( i = 0; i < dim; ++ i )
-            {
-                rc = SDumperPrint ( b, "\v%d", self -> u . i16 [ i ] );
-                if ( rc != 0 )
-                    return rc;
-                SDumperSepString ( b, compact ? "," : ", " );
-            }
-            break;
-        case 32:
-            for ( i = 0; i < dim; ++ i )
-            {
-                rc = SDumperPrint ( b, "\v%d", self -> u . i32 [ i ] );
-                if ( rc != 0 )
-                    return rc;
-                SDumperSepString ( b, compact ? "," : ", " );
-            }
-            break;
-        case 64:
-            for ( i = 0; i < dim; ++ i )
-            {
-                rc = SDumperPrint ( b, "\v%ld", self -> u . i64 [ i ] );
-                if ( rc != 0 )
-                    return rc;
-                SDumperSepString ( b, compact ? "," : ", " );
-            }
-            break;
-        }
-        break;
-    case ddFloat:
-        switch ( bits )
-        {
-        case 32:
-            for ( i = 0; i < dim; ++ i )
-            {
-                rc = SDumperPrint ( b, "\v%f", ( double ) self -> u . f32 [ i ] );
-                if ( rc != 0 )
-                    return rc;
-                SDumperSepString ( b, compact ? "," : ", " );
-            }
-            break;
-        case 64:
-            for ( i = 0; i < dim; ++ i )
-            {
-                rc = SDumperPrint ( b, "\v%f", self -> u . f64 [ i ] );
-                if ( rc != 0 )
-                    return rc;
-                SDumperSepString ( b, compact ? "," : ", " );
-            }
-            break;
-        }
-        break;
-    case ddAscii:
-    {
-        const char *end, *p;
-
-        rc = SDumperWrite ( b, "'", 1 );
-
-    do_ascii:
-        for ( p = self -> u . ascii, end = p + dim; rc == 0 && p < end; )
-        {
-            const char *start = p;
-            while ( p < end && isprint ( * p ) )
-                ++ p;
-            rc = SDumperWrite ( b, start, p - start );
-            if ( p == end )
-                break;
-
-            switch ( * p )
-            {
-            case '\n':
-                rc = SDumperWrite ( b, "\\n", 2 );
-                break;
-            case '\r':
-                rc = SDumperWrite ( b, "\\", 2 );
-                break;
-            case '\t':
-                rc = SDumperWrite ( b, "\\t", 2 );
-                break;
-            default:
-                rc = SDumperPrint ( b, "\\x%x%x", ( * ( uint8_t* ) p ) / 16, * p & 15 );
-            }
-            ++ p;
-        }
-        if ( rc == 0 )
-            rc = SDumperWrite ( b, "'", 1 );
-        return rc;
-    }
-    case ddUnicode:
-    {
-        rc = SDumperWrite ( b, "'", 1 );
-        if ( rc != 0 )
-            return rc;
-
-        if ( bits == 8 )
-            goto do_ascii;
-
-        for ( i = 0; i < dim; ++ i )
-        {
-            char buff [ 8 ];
-            uint32_t ch = ( bits == 16 ) ?
-                ( uint32_t )  self -> u . utf16 [ i ] :
-                self -> u . utf32 [ i ];
-
-            if ( ch >= 128 )
-                sprintf ( buff, "\\u%04x", ch );
-            else if ( isprint ( ( int ) ch ) )
-                buff [ 0 ] = ( char ) ch, buff [ 1 ] = 0;
-            else switch ( ch )
-            {
-            case '\n':
-                sprintf ( buff, "\\n" );
-                break;
-            case '\r':
-                sprintf ( buff, "\\r" );
-                break;
-            case '\t':
-                sprintf ( buff, "\\t" );
-                break;
-            default:
-                sprintf ( buff, "\\x%02x", ch );
-            }
-
-            rc = SDumperPrint ( b, buff );
-            if ( rc != 0 )
-                return rc;
-        }
-        if ( rc == 0 )
-            rc = SDumperWrite ( b, "'", 1 );
-        return rc;
-    }}
-
-    if ( rc == 0 && dim > 1 )
-        rc = SDumperPrint ( b, compact ? "]" : " ]" );
-
-    return rc;
-}
-
-#if SLVL >= 3
-static
-rc_t SFuncExprDump ( const SFuncExpr *self, SDumper *b )
-{
-    rc_t rc;
-    bool compact = SDumperMode ( b ) == sdmCompact ? true : false;
-
-    if ( VectorLength ( & self -> schem ) != 0 )
-    {
-        if ( compact )
-            rc = SExpressionBracketListDump ( & self -> schem, b, "<", ">" );
-        else
-            rc = SExpressionBracketListDump ( & self -> schem, b, "< ", " > " );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    rc = SFunctionDump ( self -> func, b );
-    if ( rc != 0 )
-        return rc;
-
-    rc = SDumperVersion ( b, self -> version_requested ?
-        self -> version : self -> func -> version );
-    if ( rc != 0 )
-        return rc;
-
-    if ( VectorLength ( & self -> pfact ) != 0 )
-    {
-        if ( compact )
-            rc = SExpressionBracketListDump ( & self -> pfact, b, "<", ">" );
-        else
-            rc = SExpressionBracketListDump ( & self -> pfact, b, " < ", " >" );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    if ( VectorLength ( & self -> pfunc ) == 0 )
-        rc = SDumperPrint ( b, compact ? "()" : " ()" );
-    else if ( compact )
-        rc = SExpressionBracketListDump ( & self -> pfunc, b, "(", ")" );
-    else
-        rc = SExpressionBracketListDump ( & self -> pfunc, b, " ( ", " )" );
-
-    return rc;
-}
-#endif
-
-#if SLVL >= 7
-static
-rc_t SPhysEncExprDump ( const SPhysEncExpr *self, SDumper *b )
-{
-    rc_t rc;
-    bool compact = SDumperMode ( b ) == sdmCompact ? true : false;
-
-    if ( VectorLength ( & self -> schem ) != 0 )
-    {
-        if ( compact )
-            rc = SExpressionBracketListDump ( & self -> schem, b, "<", ">" );
-        else
-            rc = SExpressionBracketListDump ( & self -> schem, b, "< ", " > " );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    rc = SPhysicalDump ( self -> phys, b );
-    if ( rc != 0 )
-        return rc;
-
-    if ( self -> version_requested )
-        rc = SDumperVersion ( b, self -> version );
-    else
-        rc = SDumperVersion ( b, self -> phys -> version );
-    if ( rc != 0 )
-        return rc;
-
-    if ( VectorLength ( & self -> pfact ) != 0 )
-    {
-        if ( compact )
-            rc = SExpressionBracketListDump ( & self -> pfact, b, "<", ">" );
-        else
-            rc = SExpressionBracketListDump ( & self -> pfact, b, " < ", " >" );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    return rc;
-}
-#endif
-
-rc_t SExpressionDump ( const SExpression *self, SDumper *b )
-{
-    bool compact = SDumperMode ( b ) == sdmCompact ? true : false;
-
-    if ( self == NULL )
-        return SDumperWrite ( b, "NULL", 4 );
-
-    switch ( self -> var )
-    {
-    case eTypeExpr:
-        return STypeExprDump ( ( const STypeExpr* ) self, b );
-    case eConstExpr:
-        return SConstExprDump ( ( const SConstExpr* ) self, b );
-#if SLVL >= 3
-    case eIndirectExpr:
-    case eParamExpr:
-    case eProdExpr:
-    case eFwdExpr:
-    case eFuncParamExpr:
-    case eColExpr:
-    case ePhysExpr:
-    {
-        const SSymExpr *x = ( const SSymExpr* ) self;
-        if ( x -> alt )
-            return SDumperPrint ( b, "@%N", x -> _sym );
-        return KSymbolDump ( x -> _sym, b );
-    }
-    case eFuncExpr:
-#if SLVL >= 4
-    case eScriptExpr:
-#endif
-        return SFuncExprDump ( ( const SFuncExpr* ) self, b );
-#endif
-#if SLVL >= 7
-    case ePhysEncExpr:
-        return SPhysEncExprDump ( ( const SPhysEncExpr* ) self, b );
-#endif
-    case eNegateExpr:
-    {
-        const SUnaryExpr *x = ( const SUnaryExpr* ) self;
-        return SDumperPrint ( b, "-%E", x -> expr );
-    }
-    case eCastExpr:
-    {
-        const SBinExpr *x = ( const SBinExpr* ) self;
-        return SDumperPrint ( b, compact ? "(%E)%E" : "( %E ) %E", x -> left, x -> right );
-    }
-    case eCondExpr:
-    {
-        const SBinExpr *x = ( const SBinExpr* ) self;
-        return SDumperPrint ( b, compact ? "%E|%E" : "%E | %E", x -> left, x -> right );
-    }
-    case eVectorExpr:
-    {
-        const SVectExpr *x = ( const SVectExpr* ) self;
-        if ( compact )
-            return SExpressionBracketListDump ( & x -> expr, b, "[", "]" );
-        return SExpressionBracketListDump ( & x -> expr, b, "[ ", " ]" );
-    }}
-
-    return SDumperPrint ( b, "EXPR-UNKNOWN" );
-
-}
-
-bool SExpressionVDump ( void *item, void *data )
-{
-    SDumper *b = data;
-    const SExpression *self = ( const void* ) item;
-
-    b -> rc = SExpressionDump ( self, b );
-
-    return ( b -> rc != 0 ) ? true : false;
-}
-#endif /* SLVL >= 1 */
-
-
-/*--------------------------------------------------------------------------
- * STypeExpr
- */
-
-/* Mark
- */
-void STypeExprMark ( const STypeExpr *self, const VSchema *schema )
-{
-    if ( self -> fmt != NULL )
-        SFormatMark ( self -> fmt );
-    if ( self -> dt != NULL )
-        SDatatypeMark ( self -> dt );
-    if ( self -> ts != NULL )
-        STypesetMark ( self -> ts, schema );
-    if ( self -> dim )
-        SExpressionMark ( ( void * ) self -> dim, ( void * ) schema );
-}
-
-
-/*--------------------------------------------------------------------------
- * SSymExpr
- */
-
-/* Make
- *  used when creating implicit expressions
- */
-rc_t SSymExprMake ( const SExpression **xp, const KSymbol *sym, uint32_t var )
-{
-    SSymExpr *x = malloc ( sizeof * x );
-    if ( x == NULL )
-        return RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-
-    x -> dad . var = var;
-    atomic32_set ( & x -> dad . refcount, 1 );
-    x -> _sym = sym;
-    x -> alt = false;
-
-    * xp = & x -> dad;
-    return 0;
-}
-
-/* Mark
- */
-void SSymExprMark ( const SSymExpr *self, const VSchema *schema )
-{
-    switch ( self -> _sym -> type )
-    {
-    case eConstant:
-        SConstantMark ( self -> _sym -> u . obj );
-        break;
-    }
-}
-
-
-/*--------------------------------------------------------------------------
- * SFuncExpr
- */
-
-/* Mark
- */
-void SFuncExprMark ( const SFuncExpr *self, const VSchema *schema )
-{
-    SFunctionMark ( ( void * )self -> func, ( void * )schema );
-}
-
-
-/*--------------------------------------------------------------------------
- * SPhysEncExpr
- */
-
-/* ImplicitPhysEncExpr
- *  create expression object
- */
-rc_t VSchemaImplicitPhysEncExpr ( VSchema *self,
-    VTypedecl *td, const SExpression **expr, const char *text, const char *ctx )
-{
-    KSymTable tbl;
-    rc_t rc = init_symtab ( & tbl, self );
-    if ( rc == 0 )
-    {
-        KToken t;
-        KTokenText tt;
-        KTokenSource src;
-
-        SchemaEnv env;
-        SchemaEnvInit ( & env, EXT_SCHEMA_LANG_VERSION );
-
-        KTokenTextInitCString ( & tt, text, ctx );
-        KTokenSourceInit ( & src, & tt );
-        next_token ( & tbl, & src, & t );
-
-        rc = phys_encoding_expr ( & tbl, & src, & t, & env, self, td, expr );
-
-        KSymTableWhack ( & tbl );
-    }
-    return rc;
-}
-
-/* Mark
- */
-void SPhysEncExprMark ( const SPhysEncExpr *self, const VSchema *schema )
-{
-    SPhysicalMark ( ( void * )self -> phys, ( void * )schema );
-}
-
-
-/*--------------------------------------------------------------------------
- * VSchema
- */
-
-#if SLVL >= 1
-static
-rc_t const_vect_expr ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, const VSchema *self, const SVectExpr **xp )
-{
-    rc_t rc;
-    SVectExpr *x = malloc ( sizeof * x );
-    if ( x == NULL )
-        return RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-
-    x -> dad . var = eVectorExpr;
-    atomic32_set ( & x -> dad . refcount, 1 );
-    VectorInit ( & x -> expr, 0, 16 );
-
-    do
-    {
-        SExpression *vx;
-        rc = const_expr ( tbl, src, next_token ( tbl, src, t ),
-            env, self, ( const SExpression** ) & vx );
-        if ( rc != 0 )
-            break;
-
-        if ( vx -> var == eVectorExpr )
-        {
-            SExpressionWhack ( vx );
-            rc = KTokenExpected ( t, klogErr, "scalar constant" );
-            break;
-        }
-
-        rc = VectorAppend ( & x -> expr, NULL, vx );
-        if ( rc != 0 )
-        {
-            SExpressionWhack ( vx );
-            break;
-        }
-    }
-    while ( t -> id == eComma );
-
-    if ( rc != 0 )
-        SExpressionWhack ( & x -> dad );
-    else
-    {
-        * xp = x;
-        rc = expect ( tbl, src, t, eRightSquare, "]", true );
-    }
-
-    return rc;
-}
-#endif
-
-/*
- * const-expr         = <constname>
- *                    | CONST-VALUE
- */
-#if SLVL >= 1
-static
-rc_t negate_expr ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, const VSchema *self, const SExpression **xp )
-{
-    rc_t rc = const_expr ( tbl, src, next_token ( tbl, src, t ), env, self, xp );
-    if ( rc == 0 )
-    {
-        SUnaryExpr *x;
-        SConstExpr *cx;
-        const SSymExpr *sx;
-        const SExpression *td;
-        const SDatatype *dt;
-
-        static atomic32_t s_I8_id;
-        static atomic32_t s_I16_id;
-        static atomic32_t s_I32_id;
-        static atomic32_t s_I64_id;
-
-        switch ( ( * xp ) -> var )
-        {
-        case eConstExpr:
-            cx = * ( SConstExpr** ) xp;
-            if ( cx -> td . dim < 2 )
-            {
-                dt = VSchemaFindTypeid ( self, cx -> td . type_id );
-                if ( dt != NULL ) switch ( dt -> domain )
-                {
-                case vtdUint:
-                    switch ( dt -> size )
-                    {
-                    case 8:
-                        cx -> td . type_id  = VSchemaCacheIntrinsicTypeId ( self, & s_I8_id, "I8" );
-                        break;
-                    case 16:
-                        cx -> td . type_id  = VSchemaCacheIntrinsicTypeId ( self, & s_I16_id, "I16" );
-                        break;
-                    case 32:
-                        cx -> td . type_id  = VSchemaCacheIntrinsicTypeId ( self, & s_I32_id, "I32" );
-                        break;
-                    case 64:
-                        cx -> td . type_id  = VSchemaCacheIntrinsicTypeId ( self, & s_I64_id, "I64" );
-                        break;
-                    }
-                    /* no break */
-                case vtdInt:
-                    switch ( dt -> size )
-                    {
-                    case 8:
-                        cx -> u . i8 [ 0 ] = - cx -> u . i8 [ 0 ];
-                        return 0;
-                    case 16:
-                        cx -> u . i16 [ 0 ] = - cx -> u . i16 [ 0 ];
-                        return 0;
-                    case 32:
-                        cx -> u . i32 [ 0 ] = - cx -> u . i32 [ 0 ];
-                        return 0;
-                    case 64:
-                        cx -> u . i64 [ 0 ] = - cx -> u . i64 [ 0 ];
-                        return 0;
-                    }
-                    break;
-                case vtdFloat:
-                    switch ( dt -> size )
-                    {
-                    case 32:
-                        cx -> u . f32 [ 0 ] = - cx -> u . f32 [ 0 ];
-                        return 0;
-                    case 64:
-                        cx -> u . f64 [ 0 ] = - cx -> u . f64 [ 0 ];
-                        return 0;
-                    }
-                    break;
-                }
-            }
-            break;
-
-        case eIndirectExpr:
-            /* if type is known, at least verify domain */
-            sx = * ( const SSymExpr** ) xp;
-            td = ( ( const SIndirectConst* ) sx -> _sym -> u . obj ) -> td;
-            if ( td != NULL )
-            {
-                const STypeExpr *tx = ( const STypeExpr* ) td;
-                if ( tx-> dad . var == eTypeExpr && tx -> resolved )
-                {
-                    /* cannot have formats, but this is verified elsewhere */
-                    if ( tx -> fd . fmt == 0 && tx -> fd . td . dim < 2 )
-                    {
-                        /* determine domain */
-                        dt = VSchemaFindTypeid ( self, tx -> fd . td . type_id );
-                        if ( dt != NULL ) switch ( dt -> domain )
-                        {
-                        case vtdUint:
-                            KTokenExpected ( t, klogWarn, "signed integer" );
-                        case vtdInt:
-                        case vtdFloat:
-                            goto introduce_negate_expr;
-                        }
-                    }
-                }
-
-                break;
-            }
-
-        introduce_negate_expr:
-            x = malloc ( sizeof * x );
-            if ( x == NULL )
-            {
-                SExpressionWhack ( & sx -> dad );
-                return RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-            }
-
-            x -> dad . var = eNegateExpr;
-            atomic32_set ( & x -> dad . refcount, 1 );
-            x -> expr = & sx -> dad;
-            * xp = & x -> dad;
-            return 0;
-
-        case eNegateExpr:
-            /* double negate */
-            x = * ( SUnaryExpr** ) xp;
-            * xp = x -> expr;
-            free ( x );
-            return 0;
-
-        default:
-            SExpressionWhack ( * xp );
-            return KTokenExpected ( t, klogErr, "integer or floating point constant" );
-        }
-
-        rc = RC ( rcVDB, rcSchema, rcParsing, rcType, rcIncorrect );
-        KTokenRCExplain ( t, klogErr, rc );
-    }
-
-    return rc;
-}
-
-static
-rc_t bool_expr ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, const VSchema *self, const SConstExpr **xp )
-{
-    static atomic32_t s_bool_id;
-
-    SConstExpr *x = malloc ( sizeof * x - sizeof x -> u + sizeof x -> u . b [ 0 ] );
-    if ( x == NULL )
-        return RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-
-    assert ( t -> id == kw_true || t -> id == kw_false );
-    x -> u . b [ 0 ] = ( t -> id == kw_true );
-
-    x -> dad . var = eConstExpr;
-    atomic32_set ( & x -> dad . refcount, 1 );
-    x -> td . type_id = VSchemaCacheIntrinsicTypeId ( self, & s_bool_id, "bool" );
-    x -> td . dim = 1;
-
-    * xp = x;
-
-    next_token ( tbl, src, t );
-    return 0;
-}
-
-static
-rc_t uint_expr ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, const VSchema *self, const SConstExpr **xp )
-{
-    rc_t rc;
-    static atomic32_t s_U64_id;
-
-    SConstExpr *x = malloc ( sizeof * x - sizeof x -> u + sizeof x -> u . u64 [ 0 ] );
-    if ( x == NULL )
-        return RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-
-    rc = KTokenToU64 ( t, & x -> u . u64 [ 0 ] );
-    if ( rc != 0 )
-    {
-        free ( x );
-        return rc;
-    }
-
-    x -> dad . var = eConstExpr;
-    atomic32_set ( & x -> dad . refcount, 1 );
-    x -> td . type_id = VSchemaCacheIntrinsicTypeId ( self, & s_U64_id, "U64" );
-    x -> td . dim = 1;
-
-    * xp = x;
-
-    next_token ( tbl, src, t );
-    return 0;
-}
-
-static
-rc_t float_expr ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, const VSchema *self, const SConstExpr **xp )
-{
-    rc_t rc;
-    static atomic32_t s_F64_id;
-
-    SConstExpr *x = malloc ( sizeof * x - sizeof x -> u + sizeof x -> u . f64 [ 0 ] );
-    if ( x == NULL )
-        return RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-
-    rc = KTokenToF64 ( t, & x -> u . f64 [ 0 ] );
-    if ( rc != 0 )
-    {
-        free ( x );
-        return rc;
-    }
-
-    x -> dad . var = eConstExpr;
-    atomic32_set ( & x -> dad . refcount, 1 );
-    x -> td . type_id = VSchemaCacheIntrinsicTypeId ( self, & s_F64_id, "F64" );
-    x -> td . dim = 1;
-
-    * xp = x;
-
-    next_token ( tbl, src, t );
-    return 0;
-}
-
-static
-rc_t string_expr ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, const VSchema *self, const SConstExpr **xp )
-{
-    rc_t rc;
-
-    size_t size = t -> str . size + 1;
-    SConstExpr *x = malloc ( sizeof * x - sizeof x -> u + size );
-    if ( x == NULL )
-        return RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-
-    rc = KTokenToString ( t, x -> u . utf8, size, & size );
-    if ( rc != 0 )
-    {
-        free ( x );
-        return rc;
-    }
-
-    x -> dad . var = eConstExpr;
-    atomic32_set ( & x -> dad . refcount, 1 );
-    x -> td . dim = ( uint32_t ) size;
-
-    if ( t -> id == eString || ( size_t ) string_len ( x -> u . utf8, size ) == size )
-    {
-        static atomic32_t s_ascii_id;
-        x -> td . type_id = VSchemaCacheIntrinsicTypeId ( self, & s_ascii_id, "ascii" );
-    }
-    else
-    {
-        static atomic32_t s_utf8_id;
-        x -> td . type_id = VSchemaCacheIntrinsicTypeId ( self, & s_utf8_id, "utf8" );
-    }
-
-    * xp = x;
-
-    next_token ( tbl, src, t );
-    return 0;
-}
-
-static
-rc_t sym_const_expr ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, const VSchema *self, const SConstExpr **xp )
-{
-    const KSymbol *sym = t -> sym;
-    const SConstant *cnst = sym -> u . obj;
-
-    assert ( cnst -> expr != NULL );
-    atomic32_inc ( & ( ( SExpression* ) cnst -> expr ) -> refcount );
-    * xp = ( SConstExpr* ) cnst -> expr;
-
-    next_token ( tbl, src, t );
-    return 0;
-}
-#endif /* SLVL >= 1 */
-
-
-#if SLVL >= 3
-LIB_EXPORT rc_t CC indirect_const_expr ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, const VSchema *self, const SExpression **xp )
-{
-    SSymExpr *x = malloc ( sizeof *x );
-    if ( x == NULL )
-        return RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-
-    x -> dad . var = eIndirectExpr;
-    atomic32_set ( & x -> dad . refcount, 1 );
-    x -> _sym = t -> sym;
-    x -> alt = false;
-    * xp = & x -> dad;
-
-    next_token ( tbl, src, t );
-    return 0;
-}
-#endif /* SLVL >= 1 */
-
-/*
- * type-expr          = <typeset>
- *                    | <fmtdecl>
- *                    | <fmtname> '/' <typeset>
- */
-#if SLVL >= 1
-static
-rc_t type_expr_impl ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, const VSchema *self, const SExpression **fd, bool vardim )
-{
-    STypeExpr *x;
-
-    rc_t rc = next_fqn ( tbl, src, t, env );
-    if ( rc != 0 )
-        return rc;
-
-    x = malloc ( sizeof *x );
-    if ( x == NULL )
-        return RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-
-    x -> dad . var = eTypeExpr;
-    atomic32_set ( & x -> dad . refcount, 1 );
-    x -> fmt = NULL;
-    x -> dt = NULL;
-    x -> ts = NULL;
-    x -> id = NULL;
-    x -> dim = NULL;
-    x -> fd . fmt = 0;
-    x -> fd . td . type_id = 0;
-    x -> fd . td . dim = 0;
-    x -> resolved = true;
-
-    if ( t -> id == eFormat )
-    {
-        x -> fmt = t -> sym -> u . obj;
-        x -> fd . fmt = x -> fmt -> id;
-        if ( next_token ( tbl, src, t ) -> id != eFwdSlash )
-        {
-            * fd = & x -> dad;
-            return 0;
-        }
-
-        rc = next_fqn ( tbl, src, next_token ( tbl, src, t ), env );
-        if ( rc != 0 )
-        {
-            free ( x );
-            return rc;
-        }
-    }
-
-    switch ( t -> id )
-    {
-    case eDatatype:
-        x -> dt = t -> sym -> u . obj;
-        x -> fd . td . type_id = x -> dt -> id;
-        break;
-    case eTypeset:
-        x -> ts = t -> sym -> u . obj;
-        x -> fd . td . type_id = x -> ts -> id;
-        break;
-#if SLVL >= 3
-    case eSchemaType:
-        x -> id = t -> sym -> u . obj;
-        x -> resolved = false;
-        break;
-#endif
-    default:
-        free ( x );
-        return KTokenExpected ( t, klogErr, "datatype or typeset" );
-    }
-
-    if ( next_token ( tbl, src, t ) -> id != eLeftSquare )
-        x -> fd . td . dim = 1;
-    else
-    {
-        if ( next_token ( tbl, src, t ) -> id == eAsterisk && vardim )
-            next_token ( tbl, src, t );
-        else
-        {
-            const SConstExpr *cx;
-
-            rc = const_expr ( tbl, src, t, env, self, & x -> dim );
-            if ( rc != 0 )
-            {
-                free ( x );
-                return rc;
-            }
-
-            switch ( x -> dim -> var )
-            {
-            case eConstExpr:
-                cx =  ( const SConstExpr* ) x -> dim;
-                if ( cx -> td . dim == 1 )
-                {
-                    const SDatatype *dt = VSchemaFindTypeid ( self, cx -> td . type_id );
-                    if ( dt != NULL && SDatatypeIntrinsicDim ( dt ) == 1 )
-                    {
-                        if ( dt -> domain == vtdUint )
-                        {
-                            switch ( dt -> size )
-                            {
-                            case 64:
-                                if ( cx -> u . u64 [ 0 ] <= 0xFFFFFFFF )
-                                    x -> fd . td . dim = ( uint32_t ) cx -> u . u64 [ 0 ];
-                                break;
-                            case 32:
-                                x -> fd . td . dim = cx -> u . u32 [ 0 ];
-                                break;
-                            case 16:
-                                x -> fd . td . dim = cx -> u . u16 [ 0 ];
-                                break;
-                            case 8:
-                                x -> fd . td . dim = cx -> u . u8 [ 0 ];
-                                break;
-                            }
-                        }
-                        else if ( dt -> domain ==  vtdInt )
-                        {
-                            switch ( dt -> size )
-                            {
-                            case 64:
-                                if ( cx -> u . i64 [ 0 ] > 0 && cx -> u . i64 [ 0 ] <= 0xFFFFFFFF )
-                                    x -> fd . td . dim = ( uint32_t ) cx -> u . i64 [ 0 ];
-                                break;
-                            case 32:
-                                if ( cx -> u . i32 [ 0 ] > 0 )
-                                    x -> fd . td . dim = cx -> u . i32 [ 0 ];
-                                break;
-                            case 16:
-                                if ( cx -> u . i16 [ 0 ] > 0 )
-                                    x -> fd . td . dim = cx -> u . i16 [ 0 ];
-                                break;
-                            case 8:
-                                if ( cx -> u . i8 [ 0 ] > 0 )
-                                    x -> fd . td . dim = cx -> u . i8 [ 0 ];
-                                break;
-                            }
-                        }
-
-                        if ( x -> fd . td . dim > 0 )
-                            break;
-                    }
-                }
-
-                SExpressionWhack ( & x -> dad );
-                return KTokenExpected ( t, klogErr, "constant integer expression" );
-
-            case eIndirectExpr:
-                x -> resolved = false;
-                break;
-            default:
-                SExpressionWhack ( & x -> dad );
-                return KTokenExpected ( t, klogErr, "constant integer expression" );
-            }
-        }
-
-        rc = expect ( tbl, src, t, eRightSquare, "]", true );
-        if ( rc != 0 )
-        {
-            SExpressionWhack ( & x -> dad );
-            return rc;
-        }
-    }
-    
-    * fd = & x -> dad;
-    return 0;
-}
-
-rc_t type_expr ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, const VSchema *self, const SExpression **fd )
-{
-    return type_expr_impl ( tbl, src, t, env, self, fd, false );
-}
-
-rc_t vardim_type_expr ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, const VSchema *self, const SExpression **fd )
-{
-    return type_expr_impl ( tbl, src, t, env, self, fd, true );
-}
-#endif /* SLVL >= 1 */
-
-
-/*
- * cast_expr          = '(' <type-expr> ')' <expression>
- */
-#if SLVL >= 1
-static
-rc_t cast_expr ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, const SBinExpr **xp,
-    rc_t ( * expr ) ( KSymTable*, KTokenSource*, KToken*,
-        const SchemaEnv*, VSchema*, const SExpression** ) )
-{
-    rc_t rc;
-    SBinExpr *x = malloc ( sizeof * x );
-    if ( x == NULL )
-        return RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-
-    rc = type_expr ( tbl, src, next_token ( tbl, src, t ), env, self, & x -> left );
-    if ( rc == 0 )
-    {
-        rc = expect ( tbl, src, t, eRightParen, ")", true );
-        if ( rc == 0 )
-        {
-            rc = ( * expr ) ( tbl, src, t, env, self, & x -> right );
-            if ( rc == 0 )
-            {
-                x -> dad . var = eCastExpr;
-                atomic32_set ( & x -> dad . refcount, 1 );
-                * xp = x;
-                return 0;
-            }
-        }
-
-        SExpressionWhack ( x -> left );
-    }
-
-    free ( x );
-    return rc;
-}
-
-
-rc_t const_expr ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, const VSchema *self, const SExpression **xp )
-{
-    switch ( t -> id )
-    {
-    case eDecimal:
-    case eHex:
-    case eOctal:
-        return uint_expr ( tbl, src, t, env, self, ( const SConstExpr** ) xp );
-    case eFloat:
-    case eExpFloat:
-        return float_expr ( tbl, src, t, env, self, ( const SConstExpr** ) xp );
-    case eString:
-    case eEscapedString:
-        return string_expr ( tbl, src, t, env, self, ( const SConstExpr** ) xp );
-    case eConstant:
-        return sym_const_expr ( tbl, src, t, env, self, ( const SConstExpr** ) xp );
-#if SLVL >= 4
-    case eFactParam:
-#endif
-#if SLVL >= 3
-    case eSchemaParam:
-        return indirect_const_expr ( tbl, src, t, env, self, xp );
-#endif
-    case eLeftSquare:
-        return const_vect_expr ( tbl, src, t, env, self, ( const SVectExpr** ) xp );
-    case kw_false:
-    case kw_true:
-        return bool_expr ( tbl, src, t, env, self, ( const SConstExpr** ) xp );
-    case eLeftParen:
-        return cast_expr ( ( KSymTable* ) tbl, src, t, env,
-            ( VSchema* ) self, ( const SBinExpr** ) xp,
-            ( rc_t ( * ) ( KSymTable*, KTokenSource*, KToken*,
-              const SchemaEnv*, VSchema*, const SExpression** ) ) const_expr );
-    case eMinus:
-        /* unary minus sign */
-        return negate_expr ( tbl, src, t, env, self, xp );
-    case ePlus:
-        /* unary plus sign */
-        return const_expr ( tbl, src, next_token ( tbl, src, t ), env, self, xp );
-    }
-
-    return KTokenExpected ( t, klogErr, "boolean, integer, float, string or symbolic constant" );
-}
-#endif /* SLVL >= 1 */
-
-
-/*
- * func-param-expr    = <funcname>
- */
-#if SLVL >= 4
-static
-rc_t sym_expr ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, const SSymExpr **xp, uint32_t var, bool alt )
-{
-    SSymExpr *x = malloc ( sizeof * x );
-    if ( x == NULL )
-        return RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-
-    x -> dad . var = var;
-    atomic32_set ( & x -> dad . refcount, 1 );
-    x -> _sym = t -> sym;
-    x -> alt = alt;
-    * xp = x;
-
-    next_token ( tbl, src, t );
-    return 0;
-}
-
-#define func_param_expr( tbl, src, t, env, self, xp ) \
-    sym_expr ( tbl, src, t, env, self, xp, eFuncParamExpr, false )
-
-#endif
-
-
-/*
- * param-expr         = <func-param>
- * 
- */
-#if SLVL >= 4
-
-#define param_expr( tbl, src, t, env, self, xp ) \
-    sym_expr ( tbl, src, t, env, self, xp, eParamExpr, false )
-
-#endif
-
-
-/*
- * prod-expr          = <production>
- * 
- */
-#if SLVL >= 4
-
-#define prod_expr( tbl, src, t, env, self, xp ) \
-    sym_expr ( tbl, src, t, env, self, xp, eProdExpr, false )
-
-#endif
-
-
-/*
- * fwd-expr           = ID
- */
-#if SLVL >= 4
-static
-rc_t fwd_decl_expr ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, const SSymExpr **xp, bool alt )
-{
-    rc_t rc;
-    SSymExpr *x = malloc ( sizeof * x );
-    if ( x == NULL )
-        return RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-
-    rc = KSymTableCreateConstSymbol ( tbl, & x -> _sym, & t -> str, eForward, NULL );
-    if ( rc != 0 )
-    {
-        free ( x );
-        return rc;
-    }
-
-    x -> dad . var = eFwdExpr;
-    atomic32_set ( & x -> dad . refcount, 1 );
-    x -> alt = alt;
-    * xp = x;
-
-    next_token ( tbl, src, t );
-    return 0;
-}
-
-#define fwd_ref_expr( tbl, src, t, env, self, xp, alt ) \
-    sym_expr ( tbl, src, t, env, self, xp, eFwdExpr, alt )
-
-#endif
-
-
-/*
- * column-expr        = <column>
- */
-#if SLVL >= 8
-
-#define column_expr( tbl, src, t, env, self, xp, alt ) \
-    sym_expr ( tbl, src, t, env, self, xp, eColExpr, alt )
-
-#endif
-
-
-/*
- * physical-expr      = KCOL
- */
-#if SLVL >= 7
-
-#define physical_expr( tbl, src, t, env, self, xp ) \
-    sym_expr ( tbl, src, t, env, self, xp, ePhysExpr, false )
-
-#endif
-
-
-/*
- * schema-parms       = <schema-param> [ ',' <schema-parms> ]
- * schema-param       = [ ID '=' ]  <schema-value>
- * schema-value       = <fmtdecl>
- *                    | <uint-expr>
- */
-#if SLVL >= 4
-static
-rc_t schema_value ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, const SExpression **v )
-{
-    /* could be a typename */
-    if ( t -> id == eNamespace )
-    {
-        rc_t rc = next_fqn ( tbl, src, t, env );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    /* param value */
-    switch ( t -> id )
-    {
-    /* type parameter */
-    case eFormat:
-    case eDatatype:
-    case eTypeset:
-    case eSchemaType:
-        return type_expr ( tbl, src, t, env, self, v );
-
-    /* manifest uint constant */
-    case eDecimal:
-    case eHex:
-    case eOctal:
-        return uint_expr ( tbl, src, t, env, self, ( const SConstExpr** ) v );
-
-    /* symbolic constant must be uint */
-    case eConstant:
-        return sym_const_expr ( tbl, src, t, env, self, ( const SConstExpr** ) v );
-
-    /* schema or factory constant must be uint
-       but may not yet be completely resolved */
-    case eSchemaParam:
-    case eFactParam:
-        return indirect_const_expr ( tbl, src, t, env, self, v );
-    }
-
-    return KTokenExpected ( t, klogErr, "data type or unsigned int constant" );
-}
-#endif
-
-/*
- * fact-parms         = <fact-param> [ ',' <fact-parms> ]
- * fact-param         = [ ID '=' ] <fact-value>
- * fact-value         = <func-name>
- *                    | '[' <fact-const-list> ']'
- */
-#if SLVL >= 4
-static
-rc_t fact_value ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, const SExpression **v )
-{
-    if ( t -> id == eNamespace )
-    {
-        rc_t rc = next_fqn ( tbl, src, t, env );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    switch ( t -> id )
-    {
-        /* const-expression */
-    case eDecimal:
-    case eHex:
-    case eOctal:
-        return uint_expr ( tbl, src, t, env, self, ( const SConstExpr** ) v );
-    case eFloat:
-    case eExpFloat:
-        return float_expr ( tbl, src, t, env, self, ( const SConstExpr** ) v );
-    case eString:
-    case eEscapedString:
-        return string_expr ( tbl, src, t, env, self, ( const SConstExpr** ) v );
-    case eConstant:
-        return sym_const_expr ( tbl, src, t, env, self, ( const SConstExpr** ) v );
-    case eSchemaParam:
-    case eFactParam:
-        return indirect_const_expr ( tbl, src, t, env, self, v );
-    case eLeftSquare:
-        return const_vect_expr ( tbl, src, t, env, self, ( const SVectExpr** ) v );
-    case kw_false:
-    case kw_true:
-        return bool_expr ( tbl, src, t, env, self, ( const SConstExpr** ) v );
-
-        /* cast expression */
-    case eLeftParen:
-        return cast_expr ( tbl, src, t, env, self, ( const SBinExpr** ) v, fact_value );
-
-        /* function name */
-    case eFunction:
-        return func_param_expr ( tbl, src, t, env, self, ( const SSymExpr** ) v );
-
-    case eMinus:
-        /* unary minus sign */
-        return negate_expr ( tbl, src, t, env, self, v );
-    case ePlus:
-        /* unary plus sign */
-        return const_expr ( tbl, src, next_token ( tbl, src, t ), env, self, v );
-    }
-
-    return KTokenExpected ( t, klogErr, "constant, function param or cast operator" );
-}
-
-static
-rc_t old_fact_value ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, const SExpression **v )
-{
-    switch ( t -> id )
-    {
-        /* const-expression */
-    case eDecimal:
-    case eHex:
-    case eOctal:
-        return uint_expr ( tbl, src, t, env, self, ( const SConstExpr** ) v );
-    case eFloat:
-    case eExpFloat:
-        return float_expr ( tbl, src, t, env, self, ( const SConstExpr** ) v );
-    case eString:
-    case eEscapedString:
-        return string_expr ( tbl, src, t, env, self, ( const SConstExpr** ) v );
-    case eMinus:
-        return negate_expr ( tbl, src, t, env, self, v );
-    case ePlus:
-        return old_fact_value ( tbl, src, next_token ( tbl, src, t ), env, self, v );
-    }
-
-    return RC ( rcVDB, rcSchema, rcParsing, rcNoObj, rcNoErr );
-}
-#endif
-
-/*
- *    func-parms         = <func-param> [ ',' <func-parms> ]
- *    func-param         = <colname>
- *                       | <physname>
- *                       | <production>
- *                       | <parmname>
- */
-#if SLVL >= 4
-static
-rc_t param_value ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, const SExpression **v )
-{
-    KToken t2;
-    bool alt = false;
-
-    /* look for special modifiers */
-    switch ( t -> id )
-    {
-#if SLVL >= 7
-    case ePeriod:
-        /* detect special syntax for physical column names */
-        physical_name ( tbl, src, t, env );
-        break;
-#endif
-    case eAtSign:
-
-        /* detect alternate column source */
-        switch ( next_token ( tbl, src, & t2 ) -> id )
-        {
-#if SLVL >= 8
-        case eColumn:
-#endif
-        case eIdent:
-        case eForward:
-        case eVirtual:
-            * t = t2;
-            alt = true;
-            break;
-
-        default:
-            KTokenSourceReturn ( src, & t2 );
-        }
-        break;
-    }
-
-    switch ( t -> id )
-    {
-    /* handle function or script params, named productions */
-#if SLVL >= 5
-    case eAtSign:
-        t -> sym = KSymTableFind ( tbl, & t -> str );
-        if ( t -> sym == NULL )
-            break;
-        t -> id = t -> sym -> type;
-        /* no break */
-#endif
-    case eFuncParam:
-        return param_expr ( tbl, src, t, env, self, ( const SSymExpr** ) v );
-    case eProduction:
-        return prod_expr ( tbl, src, t, env, self, ( const SSymExpr** ) v );
-
-    /* forward reference */
-    case eIdent:
-        return fwd_decl_expr ( tbl, src, t, env, self, ( const SSymExpr** ) v, alt );
-    case eForward:
-    case eVirtual:
-        return fwd_ref_expr ( tbl, src, t, env, self, ( const SSymExpr** ) v, alt );
-#if SLVL >= 8
-    /* column expression */
-    case eColumn:
-        return column_expr ( tbl, src, t, env, self, ( const SSymExpr** ) v, alt );
-#endif
-#if SLVL >= 7
-    /* physical column expression */
-    case ePhysMember:
-        return physical_expr ( tbl, src, t, env, self, ( const SSymExpr** ) v );
-#endif
-    /* cast expression */
-    case eLeftParen:
-        return cast_expr ( tbl, src, t, env, self, ( const SBinExpr** ) v, param_value );
-    }
-
-    return KTokenExpected ( t, klogErr, "column or production name or cast operator" );
-}
-
-static
-rc_t param_list ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, Vector *v,
-    rc_t ( * value ) ( KSymTable*, KTokenSource*, KToken*,
-        const SchemaEnv*, VSchema*, const SExpression** ) )
-{
-    rc_t rc;
-    const SExpression *x;
-
-    while ( 1 )
-    {
-        /* param value */
-        rc = ( * value ) ( tbl, src, t, env, self, & x );
-        if ( rc != 0 )
-            return rc;
-
-        /* record parameter */
-        rc = VectorAppend ( v, NULL, x );
-        if ( rc != 0 )
-        {
-            SExpressionWhack ( x );
-            return KTokenRCExplain ( t, klogInt, rc );
-        }
-
-        if ( t -> id != eComma )
-            break;
-
-        next_token ( tbl, src, t );
-    }
-
-    return 0;
-}
-
-static
-rc_t func_expression ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, SFuncExpr *fx, const KSymbol **sym )
-{
-    rc_t rc;
-
-    /* schema-parms */
-    if ( t -> id == eLeftAngle )
-    {
-        next_token ( tbl, src, t );
-        rc = param_list ( tbl, src, t, env, self, & fx -> schem, schema_value );
-        if ( rc == 0 )
-            rc = expect ( tbl, src, t, eRightAngle, ">", true );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    /* locate function or schema */
-    rc = next_fqn ( tbl, src, t, env );
-    if ( rc != 0 )
-        return rc;
-
-    if ( t -> id != eScriptFunc && t -> id != eFunction )
-        return KTokenExpected ( t, klogErr, "function" );
-    * sym = t -> sym;
-
-    /* look for requested version */
-    if ( next_token ( tbl, src, t ) -> id == eHash )
-    {
-        fx -> version_requested = true;
-        rc = maj_min_rel ( tbl, src, next_token ( tbl, src, t ),
-            env, self,  & fx -> version, false );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    /* look for factory params */
-    if ( t -> id == eLeftAngle && ! env -> mixed_fact_param_list )
-    {
-        next_token ( tbl, src, t );
-        rc = param_list ( tbl, src, t, env, self, & fx -> pfact, fact_value );
-        if ( rc == 0 )
-            rc = expect ( tbl, src, t, eRightAngle, ">", true );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    /* function params */
-    if ( t -> id != eLeftParen )
-        return KTokenExpected ( t, klogErr, "(" );
-    if ( next_token ( tbl, src, t ) -> id != eRightParen )
-    {
-        /* handle old-style fact params */
-        if ( env -> mixed_fact_param_list )
-        {
-            rc = param_list ( tbl, src, t, env, self, & fx -> pfact, old_fact_value );
-            if ( GetRCState ( rc ) == rcNoErr )
-                rc = 0;
-        }
-
-        /* handle normal function params */
-        if ( rc == 0 )
-            rc = param_list ( tbl, src, t, env, self, & fx -> pfunc, param_value );
-    }
-    if ( rc == 0 )
-        rc = expect ( tbl, src, t, eRightParen, ")", true );
-
-    return rc;
-}
-
-static
-rc_t func_expr ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, const SFuncExpr **xp )
-{
-    rc_t rc;
-    const KSymbol *sym = NULL;
-
-    SFuncExpr *fx = malloc ( sizeof * fx );
-    if ( fx == NULL )
-        return RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-
-    /* initialize */
-    fx -> dad . var = eFuncExpr;
-    atomic32_set ( & fx -> dad . refcount, 1 );
-    fx -> func = NULL;
-    VectorInit ( & fx -> schem, 0, 4 );
-    VectorInit ( & fx -> pfact, 0, 8 );
-    VectorInit ( & fx -> pfunc, 0, 8 );
-    fx -> version = 0;
-    fx -> version_requested = false;
-    fx -> untyped = false;
-
-    /* parse expression */
-    rc = func_expression ( tbl, src, t, env, self, fx, & sym );
-    if ( rc == 0 )
-    {
-        const SNameOverload *vf = sym -> u . obj;
-
-        /* match expression */
-        if ( vf -> name -> type == eScriptFunc )
-            fx -> dad . var = eScriptExpr;
-
-        if ( fx -> version_requested )
-        {
-            fx -> func =
-                VectorFind ( & vf -> items, & fx -> version, NULL, SFunctionCmp );
-        }
-        else
-        {
-            fx -> func = VectorLast ( & vf -> items );
-        }
-
-        * xp = fx;
-        return 0;
-    }
-
-    SExpressionWhack ( & fx -> dad );
-    return rc;
-}
-#endif /* SLVL >= 4 */
-
-/*
- * expression         = <param-value>
- *                    | <func-expr>
- *                    | '(' <type-expr> ')' <expression>
- */
-#if SLVL >= 4
-rc_t expression ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, const SExpression **xp )
-{
-    rc_t rc;
-
-    if ( t -> id == eNamespace )
-    {
-        rc = next_fqn ( tbl, src, t, env );
-        if ( rc != 0 )
-            return rc;
-    }
-
-#if SLVL >= 7
-    /* detect special syntax for physical column names */
-    if ( t -> id == ePeriod )
-        physical_name ( tbl, src, t, env );
-#endif
-
-    switch ( t -> id )
-    {
-    /* handle function or script params, named productions */
-#if SLVL >= 5
-    case eAtSign:
-        t -> sym = KSymTableFind ( tbl, & t -> str );
-        if ( t -> sym == NULL )
-            break;
-        t -> id = t -> sym -> type;
-        /* no break */
-#endif
-    case eFuncParam:
-        return param_expr ( tbl, src, t, env, self, ( const SSymExpr** ) xp );
-    case eProduction:
-        return prod_expr ( tbl, src, t, env, self, ( const SSymExpr** ) xp );
-
-    /* forward reference */
-    case eIdent:
-        return fwd_decl_expr ( tbl, src, t, env, self, ( const SSymExpr** ) xp, false );
-    case eForward:
-    case eVirtual:
-        return fwd_ref_expr ( tbl, src, t, env, self, ( const SSymExpr** ) xp, false );
-#if SLVL >= 8
-    /* column expression */
-    case eColumn:
-        return column_expr ( tbl, src, t, env, self, ( const SSymExpr** ) xp, false );
-#endif
-#if SLVL >= 7
-    /* physical column expression */
-    case ePhysMember:
-        return physical_expr ( tbl, src, t, env, self, ( const SSymExpr** ) xp );
-#endif
-    /* function expression */
-    case eLeftAngle:
-    case eFunction:
-    case eScriptFunc:
-        return func_expr ( tbl, src, t, env, self, ( const SFuncExpr** ) xp );
-
-    /* cast expression */
-    case eLeftParen:
-        return cast_expr ( tbl, src, t, env, self,
-            ( const SBinExpr** ) xp, expression );
-
-    /* type expression */
-    case eFormat:
-    case eDatatype:
-    case eTypeset:
-    case eSchemaType:
-        return type_expr ( tbl, src, t, env, self, xp );
-
-    /* in case expression gets used for const-expression */
-    case eDecimal:
-    case eHex:
-    case eOctal:
-        return uint_expr ( tbl, src, t, env, self, ( const SConstExpr** ) xp );
-    case eFloat:
-    case eExpFloat:
-        return float_expr ( tbl, src, t, env, self, ( const SConstExpr** ) xp );
-    case eString:
-    case eEscapedString:
-        return string_expr ( tbl, src, t, env, self, ( const SConstExpr** ) xp );
-    case eConstant:
-        return sym_const_expr ( tbl, src, t, env, self, ( const SConstExpr** ) xp );
-    case eSchemaParam:
-    case eFactParam:
-        return indirect_const_expr ( tbl, src, t, env, self, xp );
-    case eLeftSquare:
-        return const_vect_expr ( tbl, src, t, env, self, ( const SVectExpr** ) xp );
-    case kw_false:
-    case kw_true:
-        return bool_expr ( tbl, src, t, env, self, ( const SConstExpr** ) xp );
-
-    case eMinus:
-        /* unary minus sign */
-        return negate_expr ( tbl, src, t, env, self, xp );
-    case ePlus:
-        /* unary plus sign */
-        return const_expr ( tbl, src, next_token ( tbl, src, t ), env, self, xp );
-    }
-
-    return KTokenExpected ( t, klogErr, "production name, column name, function or cast expression" );
-}
-#endif /* SLVL >= 4 */
-
-
-/*
- * cond-expr          = <expression> [ '|' <cond-expr> ]
- */
-#if SLVL >= 4
-rc_t cond_expr ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, const SExpression **xp )
-{
-    rc_t rc = expression ( tbl, src, t, env, self, xp );
-    if ( rc != 0 )
-        return rc;
-
-    if ( t -> id == ePipe )
-    {
-        SBinExpr *x = malloc ( sizeof * x );
-        if ( x == NULL )
-        {
-            SExpressionWhack ( * xp ), * xp = NULL;
-            return RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-        }
-
-        x -> dad . var = eCondExpr;
-        atomic32_set ( & x -> dad . refcount, 1 );
-        x -> left = * xp;
-        x -> right = NULL;
-        * xp = & x -> dad;
-
-        rc = cond_expr ( tbl, src, next_token ( tbl, src, t ), env, self, & x -> right );
-        if ( rc != 0 )
-        {
-            SExpressionWhack ( & x -> dad );
-            * xp = NULL;
-        }
-    }
-
-    return rc;
-}
-#endif /* SLVL >= 4 */
-
-/*
- * untyped-expr       = <fmtdecl> | <untyped-func-name> '(' ')'
- */
-#if SLVL >= 6
-static
-rc_t untyped_func_expr ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, const SFuncExpr **xp )
-{
-    rc_t rc;
-    const KSymbol *sym = t -> sym;
-
-    /* expect empty parameter list */
-    next_token ( tbl, src, t );
-    rc = expect ( tbl, src, t, eLeftParen, "(", true );
-    if ( rc == 0 )
-        rc = expect ( tbl, src, t, eRightParen, ")", true );
-    if ( rc == 0 )
-    {
-        const SNameOverload *vf = sym -> u . obj;
-
-        SFuncExpr *fx = malloc ( sizeof * fx );
-        if ( fx == NULL )
-            return RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-
-        /* initialize */
-        fx -> dad . var = eFuncExpr;
-        atomic32_set ( & fx -> dad . refcount, 1 );
-        VectorInit ( & fx -> schem, 0, 4 );
-        VectorInit ( & fx -> pfact, 0, 8 );
-        VectorInit ( & fx -> pfunc, 0, 8 );
-        fx -> version = 0;
-        fx -> version_requested = false;
-        fx -> untyped = true;
-
-        fx -> func = VectorLast ( & vf -> items );
-
-        * xp = fx;
-        return 0;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC untyped_expr ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, const SExpression **xp )
-{
-    rc_t rc;
-
-    if ( t -> id == eNamespace )
-    {
-        rc = next_fqn ( tbl, src, t, env );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    switch ( t -> id )
-    {
-    /* function expression */
-    case eUntypedFunc:
-        return untyped_func_expr ( tbl, src, t, env, self, ( const SFuncExpr** ) xp );
-
-    /* type expression */
-    case eFormat:
-        return type_expr ( tbl, src, t, env, self, xp );
-    }
-
-    return KTokenExpected ( t, klogErr, "type or function expression" );
-}
-#endif /* SLVL >= 6 */
-
-
-/*
- * phys-encoding-expr = [ '<' <schema-parms> '>' ]
- *                      <phys-encoding-name> [ '#' <maj-min-rel> ]
- *                      [ '<' <fact-params> '>' ]
- */
-#if SLVL >= 7
-static
-rc_t phys_enc_expr ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, SPhysEncExpr *x, const KSymbol **sym )
-{
-    rc_t rc;
-
-    /* schema parms */
-    if ( t -> id == eLeftAngle )
-    {
-        next_token ( tbl, src, t );
-        rc = param_list ( tbl, src, t, env, self, & x -> schem, schema_value );
-        if ( rc == 0 )
-            rc = expect ( tbl, src, t, eRightAngle, ">", true );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    /* phys-encoding-name */
-    rc = next_fqn ( tbl, src, t, env );
-    if ( rc != 0 )
-        return rc;
-
-    if ( t -> id != ePhysical )
-        return KTokenExpected ( t, klogErr, "physical encoding" );
-    * sym = t -> sym;
-
-
-    /* look for requested version */
-    if ( next_token ( tbl, src, t ) -> id == eHash )
-    {
-        x -> version_requested = true;
-        rc = maj_min_rel ( tbl, src, next_token ( tbl, src, t ),
-            env, self,  & x -> version, false );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    /* look for factory params */
-    if ( t -> id == eLeftAngle )
-    {
-        next_token ( tbl, src, t );
-        rc = param_list ( tbl, src, t, env, self, & x -> pfact, fact_value );
-        if ( rc == 0 )
-            rc = expect ( tbl, src, t, eRightAngle, ">", true );
-    }
-
-    return rc;
-}
-
-rc_t phys_encoding_expr ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, VTypedecl *td, const SExpression **xp )
-{
-    rc_t rc;
-    const KSymbol *sym = NULL;
-
-    SPhysEncExpr *x = malloc ( sizeof * x );
-    if ( x == NULL )
-        return RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-
-    /* initialize */
-    x -> dad . var = ePhysEncExpr;
-    atomic32_set ( & x -> dad . refcount, 1 );
-    x -> phys = NULL;
-    VectorInit ( & x -> schem, 0, 4 );
-    VectorInit ( & x -> pfact, 0, 8 );
-    x -> version = 0;
-    x -> version_requested = false;
-
-    /* parse expression */
-    rc = phys_enc_expr ( tbl, src, t, env, self, x, & sym );
-    if ( rc == 0 )
-    {
-        const SNameOverload *name = sym -> u . obj;
-
-        if ( x -> version_requested )
-        {
-            x -> phys =
-                VectorFind ( & name -> items, & x -> version, NULL, SPhysicalCmp );
-        }
-        else
-        {
-            x -> phys = VectorLast ( & name -> items );
-        }
-
-        /* evaluate type expression */
-        if ( td != NULL )
-        {
-            /* bind schema parameters */
-            Vector prior, cx_bind;
-            VectorInit ( & cx_bind, 1, self -> num_indirect ? self -> num_indirect : 16 );
-            rc = SPhysicalBindSchemaParms ( x -> phys, & prior, & x -> schem, & cx_bind );
-            if ( rc == 0 )
-            {
-                const SExpression *tx = x -> phys -> td;
-                assert ( tx != NULL );
-                rc = STypeExprResolveAsTypedecl ( ( const STypeExpr* ) tx, self, td, & cx_bind );
-                SPhysicalRestSchemaParms ( x -> phys, & prior, & cx_bind );
-            }
-            VectorWhack ( & cx_bind, NULL, NULL );
-        }
-
-        if ( rc == 0 )
-        {
-            * xp = & x -> dad;
-            return 0;
-        }
-    }
-
-    SExpressionWhack ( & x -> dad );
-    return rc;
-}
-#endif
diff --git a/libs/vdb/schema-expr.h b/libs/vdb/schema-expr.h
deleted file mode 100644
index b815890..0000000
--- a/libs/vdb/schema-expr.h
+++ /dev/null
@@ -1,396 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_schema_expr_
-#define _h_schema_expr_
-
-#ifndef _h_klib_text_
-#include <klib/text.h>
-#endif
-
-#ifndef _h_klib_vector_
-#include <klib/vector.h>
-#endif
-
-#ifndef _h_vdb_xform_
-#include <vdb/xform.h>
-#endif
-
-#ifndef _h_atomic32_
-#include <atomic32.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KSymbol;
-struct VSchema;
-struct SFormat;
-struct SDatatype;
-struct STypeset;
-struct SIndirectType;
-struct SPhysical;
-struct SDumper;
-
-
-/*--------------------------------------------------------------------------
- * SExpression
- *  supertype of all expressions
- */
-enum
-{
-    /* a type expression */
-    eTypeExpr,
-
-    /* constant or indirect constant expr */
-    eConstExpr, eIndirectExpr,
-
-    /* functional param, schema or table production */
-    eParamExpr, eProdExpr, eFwdExpr,
-
-    /* a function passed as a parameter */
-    eFuncParamExpr,
-
-    /* extern or physical column expression */
-    eColExpr, ePhysExpr,
-
-    /* functional expression */
-    eFuncExpr, eScriptExpr,
-
-    /* physical encoding expression */
-    ePhysEncExpr,
-
-    /* cast operator expression */
-    eCastExpr,
-
-    /* unary negation */
-    eNegateExpr,
-
-    /* conditional expression */
-    eCondExpr,
-
-    /* vector expression */
-    eVectorExpr
-};
-
-typedef struct SExpression SExpression;
-struct SExpression
-{
-    uint32_t var;
-
-    /* this could be KRefcount */
-    atomic32_t refcount;
-};
-
-/* Whack
- */
-void SExpressionWhack ( const SExpression *self );
-void CC SExpressionVWhack ( void *item, void *ignore );
-
-/* Mark
- */
-void CC SExpressionMark ( void * item, void * data );
-
-/* Dump
- */
-rc_t SExpressionDump ( const SExpression *self, struct SDumper *d );
-bool SExpressionVDump ( void *item, void *dumper );
-bool CC SExpressionListDump ( void *item, void *dumper );
-rc_t SExpressionBracketListDump ( const Vector *expr, struct SDumper *d,
-    const char *begin, const char *end );
-
-
-/*--------------------------------------------------------------------------
- * STypeExpr
- *  handles general form of what has been called a typedecl,
- *  with an optional blob format, type, typeset, indirect type,
- *  and a const dimension expression.
- *
- *  when properly resolved, "fd" contains runtime values
- */
-typedef struct STypeExpr STypeExpr;
-struct STypeExpr
-{
-    SExpression dad;
-
-    struct SFormat const *fmt;
-    struct SDatatype const *dt;
-    struct STypeset const *ts;
-    struct SIndirectType const *id;
-    const SExpression *dim;
-
-    VFormatdecl fd;
-    bool resolved;
-};
-
-
-/* Resolve
- *  resolve type expression to either a VTypedecl or VFormatdecl
- */
-rc_t STypeExprResolveAsTypedecl ( const STypeExpr *self,
-    struct VSchema const *schema, VTypedecl *td, Vector *cx_bind );
-rc_t STypeExprResolveAsFormatdecl ( const STypeExpr *self,
-    struct VSchema const *schema, VFormatdecl *fd, Vector *cx_bind );
-
-/* Mark
- */
-void STypeExprMark ( const STypeExpr *self, struct VSchema const *schema );
-
-
-/*--------------------------------------------------------------------------
- * SConstExpr
- *  handles a vector of constant values
- *  evaluated from manifest or direct symbolic constants
- *
- *  "td" holds both an appropriate constant type
- *  as well as vector dimension
- *
- *  when td.type_id is utf8, dim gives
- *  the number of bytes rather than characters.
- */
-typedef struct SConstExpr SConstExpr;
-struct SConstExpr
-{
-    SExpression dad;
-
-    VTypedecl td;
-    union
-    {
-        /* bool */
-        bool b [ 8 ];
-
-        /* integer */
-        int8_t i8 [ 8 ];
-        int16_t i16 [ 4 ];
-        int32_t i32 [ 2 ];
-        int64_t i64 [ 1 ];
-
-        /* unsigned integer */
-        uint8_t u8 [ 8 ];
-        uint16_t u16 [ 4 ];
-        uint32_t u32 [ 2 ];
-        uint64_t u64 [ 1 ];
-
-        /* float */
-        float f32 [ 2 ];
-        double f64 [ 1 ];
-
-        /* ascii */
-        char ascii [ 8 ];
-
-        /* unicode */
-        char utf8 [ 8 ];
-        uint16_t utf16 [ 4 ];
-        uint32_t utf32 [ 2 ];
-
-    } u;
-};
-
-
-/* Resolve
- *  return constant expression as a vector of indicated type
- */
-rc_t SConstExprResolveAsBool ( const SConstExpr *self,
-    struct VSchema const *schema, bool *b, uint32_t capacity );
-rc_t SConstExprResolveAsI8 ( const SConstExpr *self,
-    struct VSchema const *schema, int8_t *i8, uint32_t capacity );
-rc_t SConstExprResolveAsI16 ( const SConstExpr *self,
-    struct VSchema const *schema, int16_t *i16, uint32_t capacity );
-rc_t SConstExprResolveAsI32 ( const SConstExpr *self,
-    struct VSchema const *schema, int32_t *i32, uint32_t capacity );
-rc_t SConstExprResolveAsI64 ( const SConstExpr *self,
-    struct VSchema const *schema, int64_t *i64, uint32_t capacity );
-rc_t SConstExprResolveAsU8 ( const SConstExpr *self,
-    struct VSchema const *schema, uint8_t *u8, uint32_t capacity );
-rc_t SConstExprResolveAsU16 ( const SConstExpr *self,
-    struct VSchema const *schema, uint16_t *u16, uint32_t capacity );
-rc_t SConstExprResolveAsU32 ( const SConstExpr *self,
-    struct VSchema const *schema, uint32_t *u32, uint32_t capacity, Vector *cx_bind );
-rc_t SConstExprResolveAsU64 ( const SConstExpr *self,
-    struct VSchema const *schema, uint32_t *u64, uint32_t capacity );
-rc_t SConstExprResolveAsF32 ( const SConstExpr *self,
-    struct VSchema const *schema, float *f32, uint32_t capacity );
-rc_t SConstExprResolveAsF64 ( const SConstExpr *self,
-    struct VSchema const *schema, double *f64, uint32_t capacity );
-rc_t SConstExprResolveAsAscii ( const SConstExpr *self,
-    struct VSchema const *schema, char *ascii, size_t capacity );
-rc_t SConstExprResolveAsUTF8 ( const SConstExpr *self,
-    struct VSchema const *schema, char *utf8, size_t bytes );
-rc_t SConstExprResolveAsUTF16 ( const SConstExpr *self,
-    struct VSchema const *schema, uint16_t *utf16, uint32_t capacity );
-rc_t SConstExprResolveAsUTF32 ( const SConstExpr *self,
-    struct VSchema const *schema, uint32_t *utf32, uint32_t capacity );
-
-
-/*--------------------------------------------------------------------------
- * SSymExpr
- *  holds a symbolic object reference
- *  used for productions and columns and indirect constants
- *  the productions and columns may be forward declarations,
- *  in which case the symbol will point to NULL when dereferenced.
- */
-typedef struct SSymExpr SSymExpr;
-struct SSymExpr
-{
-    SExpression dad;
-    struct KSymbol const *_sym;
-    bool alt;
-};
-
-/* Make
- *  used when creating implicit expressions
- */
-rc_t SSymExprMake ( const SExpression **xp,
-    struct KSymbol const *sym, uint32_t var );
-
-/* Mark
- */
-void SSymExprMark ( const SSymExpr *self, struct VSchema const *schema );
-
-
-/*--------------------------------------------------------------------------
- * SFuncExpr
- *  gathers schema, factory and functional parameter expressions
- *  locates and dereferences function or script by name and version
- */
-typedef struct SFuncExpr SFuncExpr;
-struct SFuncExpr
-{
-    SExpression dad;
-
-    /* some sort of expression */
-    struct SFunction const *func;
-
-    /* schema type and constant params */
-    Vector schem;
-
-    /* factory params */
-    Vector pfact;
-
-    /* function params */
-    Vector pfunc;
-
-    /* requested version */
-    uint32_t version;
-    bool version_requested;
-
-    /* for purposes of obtaining column info
-       in the absence of metadata */
-    bool untyped;
-};
-
-/* Mark
- */
-void SFuncExprMark ( const SFuncExpr *self, struct VSchema const *schema );
-
-
-/*--------------------------------------------------------------------------
- * SPhysEncExpr
- *  
- */
-typedef struct SPhysEncExpr SPhysEncExpr;
-struct SPhysEncExpr
-{
-    SExpression dad;
-
-    /* physical encoding */
-    struct SPhysical const *phys;
-
-    /* schema type and constant params */
-    Vector schem;
-
-    /* factory params */
-    Vector pfact;
-
-    /* requested version */
-    uint32_t version;
-    bool version_requested;
-};
-
-/* ImplicitPhysEncExpr
- *  create expression object
- */
-rc_t VSchemaImplicitPhysEncExpr ( VSchema *self, VTypedecl *td,
-    const SExpression **expr, const char *text, const char *ctx );
-
-/* Mark
- */
-void SPhysEncExprMark ( const SPhysEncExpr *self,
-    struct VSchema const *schema );
-
-
-/*--------------------------------------------------------------------------
- * SUnaryExpr
- *  applies a unary expression to further
- */
-typedef struct SUnaryExpr SUnaryExpr;
-struct SUnaryExpr
-{
-    SExpression dad;
-    const SExpression *expr;
-};
-
-
-/*--------------------------------------------------------------------------
- * SBinExpr
- *  connects two expression by means of an operator
- *  the operator is implicit in expression variant
- *
- *  e.g. eCastExpr where left = STypeExpr, right = SExpression
- */
-typedef struct SBinExpr SBinExpr;
-struct SBinExpr
-{
-    SExpression dad;
-    const SExpression *left;
-    const SExpression *right;
-};
-
-
-/*--------------------------------------------------------------------------
- * SVectExpr
- *  gathers multiple expressions connect by means of an operator
- *  the operator is implicit in expression variant
- *
- *  e.g. eCondExpr where operator is '|', or
- *  a constant vector where the operator is ','
- */
-typedef struct SVectExpr SVectExpr;
-struct SVectExpr
-{
-    SExpression dad;
-    Vector expr;
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_schema_expr_ */
diff --git a/libs/vdb/schema-func.c b/libs/vdb/schema-func.c
deleted file mode 100644
index 43065f7..0000000
--- a/libs/vdb/schema-func.c
+++ /dev/null
@@ -1,1657 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-#include "schema-priv.h"
-#include "schema-parse.h"
-#include "schema-expr.h"
-#include "schema-dump.h"
-
-#include <klib/symbol.h>
-#include <klib/symtab.h>
-#include <klib/out.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * SIndirectConst
- *  a parameterized constant
- */
-#if SLVL >= 3
-
-/* Whack
- */
-void CC SIndirectConstWhack ( void *item, void *ignore )
-{
-    SIndirectConst * self = item;
-    SExpressionWhack ( self -> td );
-    free ( self );
-}
-
-/* Mark
- */
-void CC SIndirectConstMark ( void * item, void * data )
-{
-    const SIndirectConst * self = item;
-    if ( self != NULL )
-        SExpressionMark ( ( void* ) self -> td, data );
-}
-
-/* Dump
- *  dump "const", dump object
- */
-rc_t SIndirectConstDump ( const SIndirectConst *self, struct SDumper *d )
-{
-    return KSymbolDump ( self != NULL ? self -> name : NULL, d );
-}
-
-bool CC SIndirectConstDefDump ( void *item, void *data )
-{
-    SDumper *b = data;
-    const SIndirectConst *self = ( const void* ) item;
-
-    /* check for this being a function */
-    if ( self -> td == NULL )
-        b -> rc = SDumperPrint ( b, "function %N", self -> name );
-    else
-        b -> rc = SDumperPrint ( b, "%E %N", self -> td, self -> name );
-
-    return ( b -> rc != 0 ) ? true : false;
-}
-#endif
-
-/*--------------------------------------------------------------------------
- * SIndirectType
- */
-#if SLVL >= 3
-
-/* Whack
- */
-void CC SIndirectTypeWhack ( void *item, void *ignore )
-{
-    free ( item );
-}
-
-
-/* Find
- */
-SIndirectType *VSchemaFindITypeid ( const VSchema *self, uint32_t id )
-{
-    SIndirectType *pt = VectorGet ( & self -> pt, id );
-    while ( pt == NULL )
-    {
-        self = self -> dad;
-        if ( self == NULL )
-            break;
-        pt = VectorGet ( & self -> pt, id );
-    }
-    return pt;
-}
-
-
-/* Dump
- */
-rc_t SIndirectTypeDump ( const SIndirectType *self, struct SDumper *d )
-{
-    return KSymbolDump ( self != NULL ? self -> name : NULL, d );
-}
-
-#endif
-
-/*--------------------------------------------------------------------------
- * SFormParamlist
- */
-#if SLVL >= 3
-
-/* Whack
- */
-void SFormParmlistWhack ( SFormParmlist *self, void ( CC * pwhack ) ( void*, void* ) )
-{
-    VectorWhack ( & self -> parms, pwhack, NULL );
-}
-
-
-/* Mark
- */
-void SFormParmlistMark ( const SFormParmlist *self,
-    void ( CC * mark ) ( void*, void* ), const VSchema *schema )
-{
-    if ( self != NULL )
-        VectorForEach ( & self -> parms, false, mark, ( void* ) schema );
-}
-
-
-/* Dump
- *  dump param list
- */
-rc_t SFormParamlistDump ( const SFormParmlist *self, SDumper *b,
-    bool ( CC * dump ) ( void*, void* ),
-    const char *begin, const char *end, const char *empty )
-{
-    rc_t rc;
-    void *item;
-    uint32_t i, parm_cnt = VectorLength ( & self -> parms );
-    bool compact = SDumperMode ( b ) == sdmCompact ? true : false;
-
-    /* if the guy has no specific parameters */
-    if ( parm_cnt == 0 )
-    {
-        if ( self -> vararg )
-            return SDumperPrint ( b, "%s...%s", begin, end );
-        return SDumperPrint ( b, empty );
-    }
-
-    /* print mandatory params */
-    SDumperSepString ( b, begin );
-    for ( rc = 0, i = 0; i < ( uint32_t ) self -> mand; ++ i )
-    {
-        item = VectorGet ( & self -> parms, i );
-        rc = SDumperSep ( b );
-        if ( rc == 0 && ( * dump ) ( item, b ) )
-            rc = b -> rc;
-        SDumperSepString ( b, compact ? "," : ", " );
-    }
-    if ( rc != 0 )
-        return rc;
-
-    if ( i != 0 )
-        SDumperSepString ( b, compact ? "*" : " * " );
-    else
-    {
-        /* issue "begin" */
-        rc = SDumperSep ( b );
-        if ( rc != 0 )
-            return rc;
-
-        SDumperSepString ( b, compact ? "*" :  "* " );
-    }
-
-    /* print optional params */
-    for ( ; i < parm_cnt; ++ i )
-    {
-        item = VectorGet ( & self -> parms, i );
-        rc = SDumperSep ( b );
-        if ( rc == 0 && ( * dump ) ( item, b ) )
-            rc = b -> rc;
-        SDumperSepString ( b, compact ? "," : ", " );
-    }
-    if ( rc != 0 )
-        return rc;
-
-    /* print optional vararg */
-    if ( self -> vararg )
-        return SDumperPrint ( b, compact ? ",...%s" : ", ...%s", end );
-
-    /* close */
-    return SDumperPrint ( b, end );
-}
-
-#endif
-
-/*--------------------------------------------------------------------------
- * SFunction
- */
-
-#if SLVL >= 3
-
-/* Whack
- */
-void SFunctionDestroy ( SFunction *self )
-{
-    SExpressionWhack ( self -> rt );
-#if SLVL >= 4
-    if ( self -> script )
-    {
-        SExpressionWhack ( self -> u . script . rtn );
-        VectorWhack ( & self -> u . script . prod, SProductionWhack, NULL );
-    }
-#endif
-    BSTreeWhack ( & self -> sscope, KSymbolWhack, NULL );
-    BSTreeWhack ( & self -> fscope, KSymbolWhack, NULL );
-    SFormParmlistWhack ( & self -> fact, SIndirectConstWhack );
-    SFormParmlistWhack ( & self -> func, SProductionWhack );
-    VectorWhack ( & self -> type, NULL, NULL );
-    VectorWhack ( & self -> schem, SIndirectConstWhack, NULL );
-}
-
-void CC SFunctionWhack ( void *self, void *ignore )
-{
-    SFunctionDestroy ( self );
-    free ( self );
-}
-
-/* Cmp
- * Sort
- */
-int CC SFunctionCmp ( const void *item, const void *n )
-{
-    const uint32_t *a = item;
-    const SFunction *b = n;
-
-    if ( * a > b -> version )
-        return 1;
-    return ( int ) ( * a >> 24 ) - ( int ) ( b -> version >> 24 );
-}
-
-int CC SFunctionSort ( const void *item, const void *n )
-{
-    const SFunction *a = item;
-    const SFunction *b = n;
-
-    return ( int ) ( a -> version >> 24 ) - ( int ) ( b -> version >> 24 );
-}
-
-#if _DEBUGGING && 0
-static String no_name = { "<no-name>", sizeof "<no-name>" - 1, sizeof "<no-name>" - 1 };
-#define DBG_CXBIND1( op, name, id, val ) \
-    OUTMSG (( "%s:%d - cx_bind %s: name=%S, id=%u, val=%p\n", __func__, __LINE__, op, & name, id, val ))
-#define DBG_CXBIND2( op, name, id, old, new ) \
-    OUTMSG (( "%s:%d - cx_bind %s: name=%S, id=%u, old=%p, new=%p\n", __func__, __LINE__, op, & name, id, old, new ))
-#else
-#define DBG_CXBIND1( op, name, id, val ) \
-    ( ( void ) 0 )
-#define DBG_CXBIND2( op, name, id, old, new ) \
-    ( ( void ) 0 )
-#endif
-
-/* Bind
- *  perform schema and factory param substitution
- *  returns prior param values
- *
- *  9/11/13
- *  "self" is a cursor-local cloned version of schema decl
- */
-rc_t SFunctionBindSchemaParms ( const SFunction *self,
-    Vector *prior, const Vector *subst, Vector *cx_bind )
-{
-    rc_t rc = 0;
-
-    uint32_t i, count;
-    void *cx_old, *cx_new;
-
-    const SIndirectType *id;
-    const SIndirectConst *ic;
-
-    /* count input params
-       the first bunch are types
-       the remainder are constants */
-    count = VectorLength ( subst );
-
-    /* initialize return value
-       the prior values act as a stack for recursion */
-    VectorInit ( prior, 0, count );
-
-    /* determine total schema params */
-    i = VectorLength ( & self -> type ) + VectorLength ( & self -> schem );
-
-    /* param counts must match */
-    if ( count < i )
-        rc = RC ( rcVDB, rcFunction, rcEvaluating, rcParam, rcInsufficient );
-    else if ( count > i )
-        rc = RC ( rcVDB, rcFunction, rcEvaluating, rcParam, rcExcessive );
-    if ( rc != 0 )
-    {
-        PLOGERR ( klogWarn, ( klogWarn, rc,
-                 "schema parameter count mismatch - function: '$(f)'; expected $(i), received $(count)",
-                 "f=%.*s,count=%u,i=%u",
-                 self -> name -> name . size, self -> name -> name . addr,
-                 count, i ));
-        return rc;
-    }
-
-    /* bind types */
-    count = VectorLength ( & self -> type );
-    for ( i = 0; i < count; ++ i )
-    {
-        /* get the indirect type object */
-        id = VectorGet ( & self -> type, i );
-        assert ( id != NULL );
-
-        /* get the new type expression */
-        cx_new = VectorGet ( subst, id -> pos );
-        assert ( cx_new != NULL );
-
-        /* update the binding vector */
-        rc = VectorSwap ( cx_bind, id -> type_id, cx_new, & cx_old );
-        if ( rc != 0 )
-            break;
-        DBG_CXBIND2 ( "bind schema type", id -> name -> name, id -> type_id, cx_old, cx_new );
-
-        /* save old value on stack for recursion */
-        rc = VectorSet ( prior, id -> pos, cx_old );
-        if ( rc != 0 )
-        {
-            cx_new = cx_old;
-            VectorSwap ( cx_bind, id -> type_id, cx_new, & cx_old );
-            DBG_CXBIND2 ( "revert bind type", id -> name -> name, id -> type_id, cx_old, cx_new );
-            break;
-        }
-    }
-
-    /* bind constants */
-    if ( rc == 0 )
-    {
-        count = VectorLength ( & self -> schem );
-        for ( i = 0 ; i < count; ++ i )
-        {
-            ic = VectorGet ( & self -> schem, i );
-            assert ( ic != NULL );
-
-            /* get the new constant value expression */
-            cx_new = VectorGet ( subst, ic -> pos );
-            assert ( cx_new != NULL );
-
-            /* update the binding vector */
-            rc = VectorSwap ( cx_bind, ic -> expr_id, cx_new, & cx_old );
-            if ( rc != 0 )
-                break;
-            DBG_CXBIND2 ( "bind schema const", ic -> name -> name, ic -> expr_id, cx_old, cx_new );
-
-            /* save old value on stack for recursion */
-            rc = VectorSet ( prior, ic -> pos, cx_old );
-            if ( rc != 0 )
-            {
-                cx_new = cx_old;
-                VectorSwap ( cx_bind, ic -> expr_id, cx_new, & cx_old );
-                DBG_CXBIND2 ( "revert bind const", ic -> name -> name, ic -> expr_id, cx_old, cx_new );
-                break;
-            }
-        }
-
-        /* if there was no error, we're done */
-        if ( rc == 0 )
-            return 0;
-
-        /* reverse the damage done by binding constants */
-        while ( i -- > 0 )
-        {
-            ic = VectorGet ( & self -> schem, i );
-            assert ( ic != NULL );
-
-            /* get the old constant value expression */
-            cx_new = VectorGet ( prior, ic -> pos );
-            assert ( cx_new != NULL );
-
-            /* restore the binding vector */
-            VectorSwap ( cx_bind, ic -> expr_id, cx_new, & cx_old );
-            DBG_CXBIND2 ( "revert bind const", ic -> name -> name, ic -> expr_id, cx_old, cx_new );
-        }
-
-        /* reset i */
-        i = VectorLength ( & self -> type );
-    }
-
-    /* reverse the damage done by binding types */
-    while ( i -- > 0 )
-    {
-        /* get the indirect type object */
-        id = VectorGet ( & self -> type, i );
-        assert ( id != NULL );
-
-        /* get the old type expression */
-        cx_new = VectorGet ( prior, id -> pos );
-        assert ( cx_new != NULL );
-
-        /* restore the binding vector */
-        VectorSwap ( cx_bind, id -> type_id, cx_new, & cx_old );
-        DBG_CXBIND2 ( "revert bind type", id -> name -> name, id -> type_id, cx_old, cx_new );
-    }
-
-    /* a non-zero rc indicates the Vector is invalid */
-    VectorWhack ( prior, NULL, NULL );
-    return rc;
-}
-
-rc_t SFunctionBindFactParms ( const SFunction *self,
-    Vector *parms, Vector *prior, const Vector *subst, Vector *cx_bind )
-{
-    rc_t rc = 0;
-    SIndirectConst *ic;
-    void *cx_old, *cx_new;
-    uint32_t i, count, act_count, form_count;
-
-    /* count input params */
-    count = act_count = VectorLength ( subst );
-
-    /* must have minimum count */
-    if ( act_count < self -> fact . mand )
-    {
-        rc =  RC ( rcVDB, rcFunction, rcEvaluating, rcParam, rcInsufficient );
-        PLOGERR ( klogWarn, ( klogWarn, rc,
-                   "missing mandatory factory parameters - function: '$(func)'; expected $(mand), received $(count)",
-                   "func=%.*s,mand=%u,count=%u",
-                   self -> name -> name . size, self -> name -> name . addr,
-                   self -> fact . mand, act_count ));
-        return rc;
-    }
-
-    /* test against maximum count */
-    form_count = VectorLength ( & self -> fact . parms );
-    if ( act_count > form_count )
-    {
-        if ( ! self -> fact . vararg )
-        {
-            rc = RC ( rcVDB, rcFunction, rcEvaluating, rcParam, rcExcessive );
-            PLOGERR ( klogWarn, ( klogWarn, rc,
-                       "extra factory parameters - function: '$(func)'; expected $(mand), received $(count)",
-                       "func=%.*s,mand=%u,count=%u",
-                       self -> name -> name . size, self -> name -> name . addr,
-                       form_count, act_count ));
-            return rc;
-        }
-        count = form_count;
-    }
-
-    /* initialize return values
-       the "parms" vector is a positional vector of expressions,
-       and is the only way to get at varargs.
-       the prior values act as a stack for recursion */
-    VectorInit ( parms, 0, act_count );
-    VectorInit ( prior, 0, form_count );
-
-    /* bind actual formal parameter values */
-    for ( i = 0; i < form_count && i < act_count; ++ i )
-    {
-        /* get the indirect constant object */
-        ic = VectorGet ( & self -> fact . parms, i );
-        assert ( ic != NULL );
-
-        /* get the new value expression */
-        assert ( ic -> pos == i );
-        cx_new = VectorGet ( subst, i );
-        assert ( cx_new != NULL );
-
-        /* update the positional vector */
-        rc = VectorAppend ( parms, NULL, cx_new );
-        if ( rc != 0 )
-            break;
-
-        /* update the binding vector */
-        rc = VectorSwap ( cx_bind, ic -> expr_id, cx_new, & cx_old );
-        if ( rc != 0 )
-            break;
-        DBG_CXBIND2 ( "bind fact const", ic -> name -> name, ic -> expr_id, cx_old, cx_new );
-
-        /* save the old value on stack for recursion */
-        rc = VectorSet ( prior, i, cx_old );
-        if ( rc != 0 )
-        {
-            cx_new = cx_old;
-            VectorSwap ( cx_bind, ic -> expr_id, cx_new, & cx_old );
-            DBG_CXBIND2 ( "revert bind const", ic -> name -> name, ic -> expr_id, cx_old, cx_new );
-            break;
-        }
-    }
-
-    if ( rc == 0 )
-    {
-        /* this loop should only actually execute
-           to record missing optional formals */
-        assert ( i == form_count || ( i == act_count && act_count < form_count ) );
-
-        /* record optional formal parameter values */
-        for ( ; i < form_count; ++ i )
-        {
-            /* get the indirect constant object */
-            ic = VectorGet ( & self -> fact . parms, i );
-            assert ( ic != NULL );
-
-            /* get the new value expression */
-            assert ( ic -> pos == i );
-            cx_new = VectorGet ( subst, i );
-
-            /* save the same value on stack for recursion */
-            rc = VectorSet ( prior, i, cx_new );
-            if ( rc != 0 )
-                break;
-
-            DBG_CXBIND1 ( "ignore optional fact const", ic -> name -> name, ic -> expr_id, cx_new );
-        }
-    }
-
-    if ( rc == 0 )
-    {
-        /* this loop should only actually execute
-           to record vararg params beyond all formals */
-        assert ( i == form_count );
-
-        /* set vararg values */
-        for ( ; i < act_count; ++ i )
-        {
-            /* get the extra value expression */
-            cx_new = VectorGet ( subst, i );
-            assert ( cx_new != NULL );
-
-            /* update the positional vector */
-            rc = VectorAppend ( parms, NULL, cx_new );
-            if ( rc != 0 )
-                break;
-
-            DBG_CXBIND1 ( "vararg fact const", no_name, 0, cx_new );
-        }
-
-        if ( rc == 0 )
-            return 0;
-
-        i = form_count;
-    }
-
-    while ( i -- > 0 )
-    {
-        /* get the indirect type object */
-        ic = VectorGet ( & self -> fact . parms, i );
-        assert ( ic != NULL );
-
-        /* get the old type expression */
-        cx_new = VectorGet ( subst, ic -> pos );
-        assert ( cx_new != NULL );
-
-        /* restore the binding vector */
-        VectorSwap ( cx_bind, ic -> expr_id, cx_new, & cx_old );
-        DBG_CXBIND2 ( "revert bind const", ic -> name -> name, ic -> expr_id, cx_old, cx_new );
-    }
-    
-    VectorWhack ( parms, NULL, NULL ); 
-    VectorWhack ( prior, NULL, NULL );
-
-    return rc;
-}
-
-/* Rest-ore
- *  restore schema and factory param substitution
- *  destroys prior param vector
- */
-void SFunctionRestSchemaParms ( const SFunction *self, Vector *prior, Vector *cx_bind )
-{
-    rc_t rc;
-    uint32_t i, count;
-    void * cx_old, * ignore;
-
-    /* must have whole thing in prior */
-    assert ( VectorLength ( prior ) == VectorLength ( & self -> type ) + VectorLength ( & self -> schem ) );
-
-    /* restore prior values */
-    count = VectorLength ( & self -> type );
-    for ( i = 0; i < count; ++ i )
-    {
-        /* get the indirect type object */
-        const SIndirectType *id = VectorGet ( & self -> type, i );
-        assert ( id != NULL );
-
-        /* get the old type expression */
-        cx_old = VectorGet ( prior, id -> pos );
-
-        /* update the binding vector */
-        rc = VectorSwap ( cx_bind, id -> type_id, cx_old, & ignore );
-        assert ( rc == 0 );
-
-        DBG_CXBIND2 ( "restore bind type", id -> name -> name, id -> type_id, ignore, cx_old );
-    }
-
-    count = VectorLength ( & self -> schem );
-    for ( i = 0; i < count; ++ i )
-    {
-        const SIndirectConst *ic = VectorGet ( & self -> schem, i );
-        assert ( ic != NULL );
-
-        /* get the old constant value expression */
-        cx_old = VectorGet ( prior, ic -> pos );
-
-        /* restore the binding vector */
-        rc = VectorSwap ( cx_bind, ic -> expr_id, cx_old, & ignore );
-        assert ( rc == 0 );
-
-        DBG_CXBIND2 ( "restore bind const", ic -> name -> name, ic -> expr_id, ignore, cx_old );
-    }
-
-    VectorWhack ( prior, NULL, NULL );
-}
-
-void SFunctionRestFactParms ( const SFunction *self, Vector *prior, Vector *cx_bind )
-{
-    rc_t rc;
-    uint32_t i, count;
-    void * cx_old, * ignore;
-
-    /* must have whole thing in prior */
-    assert ( VectorLength ( prior ) == VectorLength ( & self -> fact . parms ) );
-
-    /* restore prior values */
-    count = VectorLength ( & self -> fact . parms );
-    for ( i = 0; i < count; ++ i )
-    {
-        const SIndirectConst *ic = VectorGet ( & self -> fact . parms, i );
-        assert ( ic != NULL );
-
-        /* get the old constant value expression */
-        cx_old = VectorGet ( prior, ic -> pos );
-
-        /* restore the binding vector */
-        rc = VectorSwap ( cx_bind, ic -> expr_id, cx_old, & ignore );
-        assert ( rc == 0 );
-
-        DBG_CXBIND2 ( "restore bind const", ic -> name -> name, ic -> expr_id, ignore, cx_old );
-    }
-
-    VectorWhack ( prior, NULL, NULL );
-}
-
-
-/* Mark
- */
-void CC SFunctionClearMark ( void *item, void *ignore )
-{
-    SFunction *self = item;
-    self -> marked = false;
-}
-
-void CC SFunctionMark ( void * item, void * data )
-{
-    SFunction * self = item;
-    const VSchema * schema = data;
-    if ( self != NULL && ! self -> marked )
-    {
-        self -> marked = true;
-        SExpressionMark ( ( void * )self -> rt, data );
-        SFormParmlistMark ( & self -> fact, SIndirectConstMark, schema );
-        SFormParmlistMark ( & self -> func, SProductionMark, schema );
-        VectorForEach ( & self -> schem, false, SIndirectConstMark, data );
-
-        if ( self -> script )
-        {
-            SExpressionMark ( ( void * )self -> u . script . rtn, ( void * )schema );
-            VectorForEach ( & self -> u . script . prod, false, SProductionMark, data );
-        }
-    }
-}
-
-void SFuncNameMark ( const SNameOverload *self, const VSchema *schema )
-{
-    if ( self != NULL )
-    {
-        VectorForEach ( & self -> items, false, SFunctionMark, ( void * ) schema );
-    }
-}
-
-
-/* Dump
- */
-rc_t SFunctionDump ( const SFunction *self, struct SDumper *d )
-{
-    return FQNDump ( self != NULL ? self -> name : NULL, d );
-}
-
-rc_t SFunctionDeclDumpSchemaParms ( const SFunction *self, SDumper *b )
-{
-    bool compact = SDumperMode ( b ) == sdmCompact ? true : false;
-
-    /* this first part is weird, because the types and
-       constants are kept separately, although they were
-       specified in a single list */
-    uint32_t i, j, sparm_cnt = VectorLength ( & self -> type ) +
-        VectorLength ( & self -> schem );
-    if ( sparm_cnt == 0 )
-        return 0;
-
-    SDumperSepString ( b, compact ? "<" : "< " );
-    for ( i = j = 0; i < sparm_cnt; ++ i )
-    {
-        const SIndirectType *id = VectorGet ( & self -> type, i - j );
-        rc_t rc = SDumperSep ( b );
-        if ( rc != 0 )
-            return rc;
-        if ( id != NULL && id -> pos == i )
-            rc = SDumperPrint ( b, "type %N", id -> name );
-        else
-        {
-            const SIndirectConst *ic = VectorGet ( & self -> schem, j );
-            assert ( id == NULL || id -> pos > i );
-            if ( ic == NULL )
-                rc = SDumperWrite ( b, "NULL", 4 );
-            else
-                SIndirectConstDefDump ( ( void* ) ic, b );
-        }
-        if ( rc != 0 )
-            return rc;
-        SDumperSepString ( b, compact ? "," : ", " );
-    }
-
-    return SDumperPrint ( b, compact ? ">" : " > " );
-}
-
-rc_t SFunctionDeclDumpFactParms ( const SFunction *self, SDumper *b )
-{
-    if ( SDumperMode ( b ) == sdmCompact )
-        return SFormParamlistDump ( & self -> fact, b, SIndirectConstDefDump, "<", ">", "" );
-    return SFormParamlistDump ( & self -> fact, b, SIndirectConstDefDump, " < ", " >", "" );
-}
-
-bool CC SFunctionDeclDump ( void *item, void *data )
-{
-    SDumper *b = data;
-    const SFunction *self = ( const void* ) item;
-    const char *func_class = "extern";
-
-    bool compact = SDumperMode ( b ) == sdmCompact ? true : false;
-
-    if ( SDumperMarkedMode ( b ) && ! self -> marked )
-        return false;
-
-    if ( self -> script )
-        func_class = "schema";
-    else if ( self -> validate )
-        func_class = "validate";
-
-    /* a type of function */
-    b -> rc = SDumperPrint ( b, "%s function ", func_class );
-    if ( b -> rc == 0 )
-    {
-        if ( self -> untyped )
-            b -> rc = SDumperPrint ( b, compact ? "__untyped %N()" : "__untyped %N ()", self -> name );
-        else if ( self -> row_length )
-            b -> rc = SDumperPrint ( b, compact ? "__row_length %N()" : "__row_length %N ()", self -> name );
-        else
-        {
-            /* could have schema parameters */
-            b -> rc = SFunctionDeclDumpSchemaParms ( self, b );
-
-            /* a return type expression, followed by a function name */
-            if ( b -> rc == 0 )
-            {
-                if ( self -> validate )
-                    b -> rc = SDumperPrint ( b, "void %N", self -> name );
-                else
-                    b -> rc = SDumperPrint ( b, "%E %N", self -> rt, self -> name );
-            }
-
-            /* version should be given */
-            if ( b -> rc == 0 )
-                b -> rc = SDumperVersion ( b, self -> version );
-
-            /* factory parameters */
-            if ( b -> rc == 0 )
-                b -> rc = SFunctionDeclDumpFactParms ( self, b );
-
-            /* function parameters */
-            if ( b -> rc == 0 )
-            {
-                if ( compact )
-                    b -> rc = SFormParamlistDump ( & self -> func, b, SProductionDefDump, "(", ")", "()" );
-                else
-                    b -> rc = SFormParamlistDump ( & self -> func, b, SProductionDefDump, " ( ", " )", " ()" );
-            }
-        }
-    }
-
-    if ( b -> rc == 0 )
-    {
-#if SLVL >= 4
-        if ( self -> script )
-        {
-            if ( ! compact )
-                b -> rc = SDumperWrite ( b, "\n", 1 );
-            if ( b -> rc == 0 )
-                b -> rc = SFunctionBodyDump ( self, b );
-        }
-        else
-#endif
-        {
-            if ( self -> u . ext . fact != NULL )
-                b -> rc = SDumperPrint ( b, compact ? "=%N" : " = %N", self -> u . ext . fact );
-            if ( b -> rc == 0 )
-                b -> rc = SDumperPrint ( b, compact ? ";" : ";\n" );
-        }
-    }
-
-    if ( b -> rc == 0 )
-        b -> rc = AliasDump ( self -> name, b );
-
-    return ( b -> rc != 0 ) ? true : false;
-}
-
-#endif
-
-
-/*--------------------------------------------------------------------------
- * VSchema
- */
-
-#if SLVL >= 3
-
-/*
- * formal-symbol     = ID
- */
-static
-rc_t formal_symbol ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env,  uint32_t id, const void *obj )
-{
-    rc_t rc;
-
-    /* allow symbol redefines in current scope only */
-    if ( t -> sym != NULL )
-    {
-        KTokenSourceReturn ( src, t );
-        next_shallow_token ( tbl, src, t, true );
-    }
-
-    /* must have a parameter name */
-    if ( t -> id != eIdent )
-        return KTokenExpected ( t, klogErr, "undefined identifier" );
-
-    /* create the symbol in current scope */
-    rc = KSymTableCreateSymbol ( tbl, & t -> sym, & t -> str, id, obj );
-    if ( rc != 0 )
-        KTokenRCExplain ( t, klogInt, rc );
-
-    return rc;
-}
-
-
-/*
- * param-formal       = [ 'control' ] <typespec> ID
- */
-static
-rc_t param_formal ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, SFormParmlist *sig )
-{
-    rc_t rc;
-
-    /* create the factory formal parameter,
-       which is just a production awaiting an expr */
-    SProduction *param = malloc ( sizeof * param );
-    if ( param == NULL )
-    {
-        rc = RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-        return KTokenRCExplain ( t, klogInt, rc );
-    }
-
-    /* finish initialization */
-    memset ( param, 0, sizeof * param );
-
-    /* accept 'control' keyword */
-    if ( t -> id == kw_control )
-    {
-        param -> control = true;
-        next_token ( tbl, src, t );
-    }
-
-    /* if parsing v0 text, then this is a persisted
-       column schema. it will have only a formal param
-       name, but no type. substitute "any" */
-    if ( env -> schema_param_types_absent )
-    {
-        KTokenSourceReturn ( src, t );
-        CONST_STRING ( & t -> str, "any" );
-        t -> sym = KSymTableFindIntrinsic ( tbl, & t -> str );
-        assert ( t -> sym != NULL );
-        t -> id = t -> sym -> type;
-    }
-
-    /* should start off with a type */
-    rc = vardim_type_expr ( tbl, src, t, env, self, & param -> fd );
-    if ( rc != 0 )
-    {
-        free ( param );
-        return rc;
-    }
-
-    /* create a name */
-    rc = formal_symbol ( tbl, src, t, env, eFuncParam, param );
-    if ( rc != 0 )
-    {
-        SProductionWhack ( param, NULL );
-        return rc;
-    }
-    param -> name = t -> sym;
-
-    /* append to param list */
-    rc = VectorAppend ( & sig -> parms, & param -> cid . id, param );
-    if ( rc != 0 )
-    {
-        SProductionWhack ( param, NULL );
-        return KTokenRCExplain ( t, klogInt, rc );
-    }
-
-    next_token ( tbl, src, t );
-    return 0;
-}
-
-
-/*
- * fact-formals       = <fact-formal> [ ',' <fact-formals> ]
- * fact-formal        = <fact-typedecl> ID
- * fact-parmname      = ID
- */
-static
-rc_t fact_formal ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, SFormParmlist *sig )
-{
-    rc_t rc;
-    SIndirectConst *param = malloc ( sizeof * param );
-    if ( param == NULL )
-    {
-        rc = RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-        return KTokenRCExplain ( t, klogInt, rc );
-    }
-
-    param -> td = NULL;
-    param -> expr_id = 0;
-
-#if ACCEPT_FUNCTION_AS_FACT_PARAM
-    /* type could be 'function' */
-    if ( t -> id == kw_function )
-        next_token ( tbl, src, t );
-
-    /* should be a typedecl */
-    else
-#endif
-    {
-        rc = type_expr ( tbl, src, t, env, self, & param -> td );
-        if ( rc != 0 )
-        {
-            free ( param );
-            return KTokenFailure ( t, klogErr, rc,
-#if ACCEPT_FUNCTION_AS_FACT_PARAM
-                                   "function or "
-#endif
-                                   "data type" );
-        }
-    }
-
-    /* get its name */
-    rc = formal_symbol ( tbl, src, t, env, eFactParam, param );
-    if ( rc != 0 )
-    {
-        SIndirectConstWhack ( param, NULL );
-        return rc;
-    }
-    param -> name = t -> sym;
-
-    /* store as a parameter */
-    rc = VectorAppend ( & sig -> parms, & param -> pos, param );
-    if ( rc != 0 )
-    {
-        SIndirectConstWhack ( param, NULL );
-        return KTokenRCExplain ( t, klogInt, rc );
-    }
-
-    /* set binding constant */
-    param -> expr_id = ++ self -> num_indirect;
-
-    next_token ( tbl, src, t );
-    return 0;
-}
-
-
-/*
- * formal-params     = <formal-param> [ ',' <formal-params> ]
- */
-static
-rc_t formal_params ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, SFormParmlist *sig,
-    rc_t ( * formal_param ) ( KSymTable*, KTokenSource*, KToken*,
-        const SchemaEnv*, VSchema*, SFormParmlist* ) )
-{
-    while ( t -> sym != NULL || t -> id == eIdent )
-    {
-        rc_t rc = ( * formal_param ) ( tbl, src, t, env, self, sig );
-        if ( rc != 0 )
-            return rc;
-
-        if ( t -> id != eComma )
-            break;
-
-        next_token ( tbl, src, t );
-    }
-
-    return 0;
-}
-
-
-/*
- * formal-signature   = <formal-params> [ '*' <formal-params> ] [',' '...' ]
- *                    | '*' <formal-params> [',' '...' ]
- *                    | '...'
- */
-static
-rc_t formal_signature ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, SFormParmlist *sig,
-    rc_t ( * formal_param ) ( KSymTable*, KTokenSource*, KToken*,
-        const SchemaEnv*, VSchema*, SFormParmlist* ) )
-{
-    /* read mandatory parameters */
-    rc_t rc = formal_params ( tbl, src, t, env, self, sig, formal_param );
-
-    /* remember the number of mandatory params seen */
-    sig -> mand = VectorLength ( & sig -> parms );
-
-    /* read optional parameters */
-    if ( rc == 0 && t -> id == eAsterisk )
-    {
-        next_token ( tbl, src, t );
-        rc = formal_params ( tbl, src, t, env, self, sig, formal_param );
-        if ( rc == 0 && VectorLength ( & sig -> parms ) == sig -> mand )
-            KTokenExpected ( t, klogWarn, "optional parameter" );
-    }
-
-    /* accept '...' */
-    if ( t -> id == eEllipsis )
-    {
-        /* but only if there was at least one real parameter */
-        if ( VectorLength ( & sig -> parms ) == 0 )
-        {
-            rc = RC ( rcVDB, rcSchema, rcParsing, rcParam, rcInsufficient );
-            return KTokenFailure ( t, klogErr, rc, "vararg parameter requires at least one real parameter" );
-        }
-
-        sig -> vararg = true;
-        next_token ( tbl, src, t );
-    }
-
-    return 0;
-}
-
-/*
- * parm-signature     = <parm-formals> [ '*' <parm-formals> ] [',' '...' ]
- *                    | '*' <parm-formals> [',' '...' ]
- *                    | '...'
- */
-static
-rc_t parm_signature ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, SFormParmlist *sig )
-{
-    /* open list */
-    rc_t rc = expect ( tbl, src, t, eLeftParen, "(", true );
-    if ( rc != 0 )
-        return rc;
-
-    /* parse list */
-    rc = formal_signature ( tbl, src, t, env, self, sig, param_formal );
-    if ( rc != 0 )
-        return 0;
-
-    /* expect close */
-    return expect ( tbl, src, t, eRightParen, ")", true );
-}
-
-/*
- * fact-signature     = <fact-formals> [ '*' <fact-formals> ] [ ',' '...' ]
- *                    | '*' <fact-formals> [ ',' '...' ]
- *                    | '...'
- */
-rc_t fact_signature ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, SFormParmlist *sig )
-{
-    /* open list */
-    rc_t rc = expect ( tbl, src, t, eLeftAngle, "<", true );
-    if ( rc != 0 )
-        return rc;
-
-    /* parse list */
-    rc = formal_signature ( tbl, src, t, env, self, sig, fact_formal );
-    if ( rc != 0 )
-        return rc;
-
-    /* expect close */
-    return expect ( tbl, src, t, eRightAngle, ">", true );
-}
-
-
-/*
- * schema-signature   = <schema-formals>
- * schema-formals     = <schema-formal> [ ',' <schema-formals> ]
- * schema-formal      = <schema-typedecl> ID
- * schema-parmname    = ID
- */
-rc_t schema_signature ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, SFunction *sig )
-{
-    rc_t rc;
-
-    /* open list */
-    if ( t -> id != eLeftAngle )
-        return KTokenExpected ( t, klogErr, "<" );
-
-    /* gather schema parameters */
-    do
-    {
-        const SExpression *td;
-        const SDatatype *dt;
-
-        /* check parameter type */
-        switch ( next_token ( tbl, src, t ) -> id )
-        {
-        case kw_type:
-            td = NULL;
-            next_token ( tbl, src, t );
-            break;
-
-        case eDatatype:
-            dt = t -> sym -> u . obj;
-            if ( dt -> domain == ddUint )
-            {
-                /* evaluate the type expression */
-                rc = type_expr ( tbl, src, t, env, self, & td );
-                if ( rc != 0 )
-                    return KTokenFailure ( t, klogErr, rc, "unsigned integer datatype" );
-
-                /* the type should be totally resolved */
-                assert ( td != NULL && td -> var == eTypeExpr );
-                assert ( ( ( const STypeExpr* ) td ) -> resolved );
-                if ( ( ( const STypeExpr* ) td ) -> fd . td . dim == 1 )
-                    break;
-
-                SExpressionWhack ( td );
-                return KTokenExpected ( t, klogErr, "single dimensional unsigned integer datatype" );
-            }
-
-        default:
-            return KTokenExpected ( t, klogErr, "type keyword or unsigned integer datatype" );
-        }
-
-        /* get parameter name */
-        if ( t -> id != eIdent )
-        {
-            if ( td != NULL )
-                SExpressionWhack ( td );
-            return KTokenExpected ( t, klogErr, "parameter name" );
-        }
-
-        if ( td == NULL )
-        {
-            SIndirectType *formal = malloc ( sizeof * formal );
-            if ( formal == NULL )
-            {
-                rc = RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-                return KTokenRCExplain ( t, klogInt, rc );
-            }
-
-            /* initialize to raw format,
-               undefined type, and no dimension */
-            formal -> type_id = 0;
-
-            /* create symbol */
-            rc = KSymTableCreateConstSymbol ( tbl, & formal -> name,
-                & t -> str, eSchemaType, formal );
-            if ( rc == 0 )
-            {
-                /* record positional */
-                rc = VectorAppend ( & sig -> type, & formal -> pos, formal );
-                if ( rc == 0 )
-                {
-                    void *ignore;
-
-                    /* record formal */
-                    rc = VectorAppend ( & self -> pt, & formal -> id, formal );
-                    if ( rc != 0 )
-                        VectorSwap ( & sig -> type, formal -> pos, NULL, & ignore );
-                    else
-                        formal -> pos += VectorLength ( & sig -> schem );
-                }
-            }
-            if ( rc != 0 )
-            {
-                free ( formal );
-                return KTokenRCExplain ( t, klogInt, rc );
-            }
-
-            formal -> type_id = ++ self -> num_indirect;
-        }
-        else
-        {
-            SIndirectConst *formal = malloc ( sizeof * formal );
-            if ( formal == NULL )
-            {
-                SExpressionWhack ( td );
-                rc = RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-                return KTokenRCExplain ( t, klogInt, rc );
-            }
-
-            /* initialize with no value */
-            formal -> expr_id = 0;
-            formal -> td = td;
-
-            /* create symbol */
-            rc = KSymTableCreateConstSymbol ( tbl, & formal -> name,
-                & t -> str, eSchemaParam, formal );
-            if ( rc == 0 )
-            {
-                /* record formal */
-                rc = VectorAppend ( & sig -> schem, & formal -> pos, formal );
-                if ( rc == 0 )
-                    formal -> pos += VectorLength ( & sig -> type );
-            }
-            if ( rc != 0 )
-            {
-                SIndirectConstWhack ( formal, NULL );
-                return KTokenRCExplain ( t, klogInt, rc );
-            }
-
-            formal -> expr_id = ++ self -> num_indirect;
-        }
-    }
-    while ( next_token ( tbl, src, t ) -> id == eComma );
-
-    /* expect close */
-    return expect ( tbl, src, t, eRightAngle, ">", true );
-}
-
-static
-rc_t return_type_expr ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, SFunction *f )
-{
-    if ( f -> validate )
-        return expect ( tbl, src, t, kw_void, "void", true );
-    return vardim_type_expr ( tbl, src, t, env, self, & f -> rt );
-}
-
-
-static
-rc_t func_decl ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, SFunction *f, uint32_t type )
-{
-    rc_t rc;
-
-    /* check for __untyped or __row_length function */
-    if ( t -> id == kw___untyped || t -> id == kw___row_length )
-    {
-        uint32_t sym_type;
-
-        /* can't be a script function */
-        if ( type == eScriptFunc )
-            return KTokenExpected ( t, klogErr, "script function return type" );
-
-        /* can't be a validate function */
-        if ( f -> validate )
-            return KTokenExpected ( t, klogErr, "void return type" );
-
-        /* determine variant */
-        if ( t -> id == kw___untyped )
-        {
-            f -> untyped = true;
-            sym_type = eUntypedFunc;
-        }
-        else
-        {
-            f -> row_length = true;
-            sym_type = eRowLengthFunc;
-        }
-
-        /* treat keyword as a NULL return type */
-        next_token ( tbl, src, t );
-
-        /* create function name */
-        rc = create_fqn ( tbl, src, t, env, sym_type, NULL );
-        if ( rc != 0 )
-        {
-            if ( GetRCState ( rc ) == rcExists )
-                return rc;
-            return KTokenFailure ( t, klogErr, rc, "fully qualified name" );
-        }
-
-        /* record symbol */
-        f -> name = t -> sym;
-        next_token ( tbl, src, t );
-
-        /* consume empty param list */
-        rc = expect ( tbl, src, t, eLeftParen, "(", true );
-        if ( rc == 0 )
-            rc = expect ( tbl, src, t, eRightParen, ")", true );
-        return rc;
-    }
-
-
-    /* initialize vectors */
-    VectorInit ( & f -> fact . parms, 0, 8 );
-    VectorInit ( & f -> func . parms, 0, 8 );
-    VectorInit ( & f -> type, 0, 8 );
-    VectorInit ( & f -> schem, 0, 8 );
-
-    /* get schema signature */
-    if ( t -> id == eLeftAngle )
-    {
-        /* enter schema param scope */
-        rc = KSymTablePushScope ( tbl, & f -> sscope );
-        if ( rc != 0 )
-            return KTokenRCExplain ( t, klogInt, rc );
-
-        /* parse schema params */
-        rc = schema_signature ( tbl, src, t, env, self, f );
-
-        /* interpret return type within schema param scope */
-        if ( rc == 0 )
-        {
-            rc = return_type_expr ( tbl, src, t, env, self, f );
-            if ( rc != 0 )
-                KTokenFailure ( t, klogErr, rc, "return type" );
-        }
-
-        /* pop scope */
-        KSymTablePopScope ( tbl );
-
-        /* bail on problems */
-        if ( rc != 0 )
-            return rc;
-
-        /* "t" contains a lookahead token. while unlikely,
-           it could have matched something defined in schema
-           param scope. re-evaluate if possible */
-        if ( t -> sym != NULL ) switch ( t -> sym -> type )
-        {
-        case eSchemaType:
-        case eSchemaParam:
-            t -> id = eIdent;
-            t -> sym = KSymTableFind ( tbl, & t -> str );
-            if ( t -> sym != NULL )
-                t -> id = t -> sym -> type;
-            break;
-        }
-    }
-    else
-    {
-        /* get return type within global scope */
-        rc = return_type_expr ( tbl, src, t, env, self, f );
-        if ( rc != 0 )
-            return KTokenFailure ( t, klogErr, rc, "return type" );
-    }
-
-    /* get function name */
-    rc = create_fqn ( tbl, src, t, env, type, NULL );
-    if ( rc != 0 ) switch ( GetRCState ( rc ) )
-    {
-    case rcExists:
-        break;
-    case rcUnexpected:
-        if ( type == 0 && t -> sym != NULL )
-        {
-            if ( t -> sym -> type == eFunction || t -> sym -> type == eScriptFunc )
-                break;
-        }
-    default:
-        return KTokenFailure ( t, klogErr, rc, "fully qualified name" );
-    }
-
-    /* record symbol - new or redefined */
-    f -> name = t -> sym;
-
-    /* get version */
-    if ( next_token ( tbl, src, t ) -> id == eHash )
-    {
-        bool allow_release = ( f -> name -> type != eFunction ) ? true : false;
-        next_token ( tbl, src, t );
-        rc = maj_min_rel ( tbl, src, t, env, self, & f -> version, allow_release );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    /* parse formal parameters - enter schema scope */
-    rc = KSymTablePushScope ( tbl, & f -> sscope );
-    if ( rc != 0 )
-        KTokenRCExplain ( t, klogInt, rc );
-    else
-    {
-        /* enter function scope */
-        rc = KSymTablePushScope ( tbl, & f -> fscope );
-        if ( rc != 0 )
-            KTokenRCExplain ( t, klogInt, rc );
-        else
-        {
-            /* gather factory parameters */
-            if ( t -> id == eLeftAngle )
-                rc = fact_signature ( tbl, src, t, env, self, & f -> fact );
-
-            /* gather function parameters */
-            if ( rc == 0 )
-                rc = parm_signature ( tbl, src, t, env, self, & f -> func );
-
-            /* leave function scope */
-            KSymTablePopScope ( tbl );
-        }
-
-        /* leave schema scope */
-        KSymTablePopScope ( tbl );
-    }
-
-    /* go a bit further */
-    if ( rc == 0 )
-    {
-        /* detect script body */
-        if ( t -> id == eLeftCurly )
-        {
-#if SLVL >= 4
-            /* if user already specified extern function
-               or if user specified vararg factory params */
-            if ( type == eFunction || f -> fact . vararg )
-#endif
-                return KTokenExpected ( t, klogErr, "; or =" );
-#if SLVL >= 4
-            /* if no type was specified */
-            if ( type == 0 )
-            {
-                /* if name was previously defined as a function */
-                if ( f -> name -> type == eFunction )
-                    return KTokenExpected ( t, klogErr, "; or =" );
-
-                /* name is either undefined or script - clobber to script */
-                ( ( KSymbol* ) f -> name ) -> type = eScriptFunc;
-            }
-
-            /* parse remainder as script function */
-            return script_body ( tbl, src, t, env, self, f );
-#endif
-        }
-
-        /* detect case where should be script but isn't */
-        if ( f -> name -> type == eScriptFunc )
-            return KTokenExpected ( t, klogErr, "{" );
-
-        /* definitely an extern function */
-        if ( type == 0 )
-            ( ( KSymbol* ) f -> name ) -> type = eFunction;
-
-        /* process factory spec */
-        if ( t -> id == eAssign )
-        {
-            /* get factory name */
-            next_token ( tbl, src, t );
-            rc = create_fqn ( tbl, src, t, env, eFactory, NULL );
-            if ( rc != 0 ) switch ( GetRCState ( rc ) )
-            {
-            case rcExists:
-                break;
-            case rcUnexpected:
-                if ( t -> sym != NULL && t -> sym -> type == eFunction )
-                    break;
-            default:
-                return rc;
-            }
-
-            f -> u . ext . fact = t -> sym;
-            next_token ( tbl, src, t );
-        }
-
-        /* expect a semicolon */
-        rc = expect ( tbl, src, t, eSemiColon, ";", true );
-    }
-
-    return rc;
-}
-
-static
-rc_t function_decl ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, uint32_t type, bool validate )
-{
-    rc_t rc;
-    void *ignore;
-
-    /* create object */
-    SFunction *f = malloc ( sizeof * f );
-    if ( f == NULL )
-    {
-        rc = RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-        return KTokenRCExplain ( t, klogInt, rc );
-    }
-
-    memset ( f, 0, sizeof * f );
-    f -> validate = validate;
-
-    /* parse function decl */
-    rc = func_decl ( tbl, src, t, env, self, f, type );
-
-    /* check validation functions for exactly two parameters */
-    if ( f -> validate && ( rc == 0 || GetRCState ( rc ) == rcExists ) )
-    {
-        if ( f -> func . mand != 2 ||
-             f -> func . vararg != 0 ||
-             VectorLength ( & f -> func . parms ) != 2 )
-        {
-            rc = RC ( rcVDB, rcSchema, rcParsing, rcFunction, rcInvalid );
-            KTokenRCExplain ( t, klogInt, rc );
-        }
-    }
-
-    if ( rc == 0 )
-    {
-        /* need an overloaded name entry */
-        SNameOverload *name = ( void* ) f -> name -> u . obj;
-        if ( name == NULL )
-        {
-            /* create name */
-            rc = SNameOverloadMake ( & name, f -> name, 0, 4 );
-            if ( rc == 0 )
-            {
-                /* insert it - it's allowed to be empty */
-                rc = VectorAppend ( & self -> fname, & name -> cid . id, name );
-                if ( rc != 0 )
-                    SNameOverloadWhack ( name, NULL );
-            }
-        }
-
-        /* now need to record function */
-        if ( rc == 0 )
-        {
-            /* assume it's new in this schema */
-            rc = VectorAppend ( & self -> func, & f -> id, f );
-            if ( rc == 0 )
-            {
-                /* insert into name overload and exit on success */
-                uint32_t idx;
-                rc = VectorInsertUnique ( & name -> items, f, & idx, SFunctionSort );
-                if ( rc == 0 )
-                    return 0;
-
-                /* expected failure is that a function already exists */
-                if ( GetRCState ( rc ) != rcExists )
-                    VectorSwap ( & self -> func, f -> id, NULL, & ignore );
-                else
-                {
-                    /* see if new function trumps old */
-                    SFunction *exist = VectorGet ( & name -> items, idx );
-                    if ( f -> version > exist -> version )
-                    {
-                        /* insert our function in name overload */
-                        VectorSwap ( & name -> items, idx, f, & ignore );
-
-                        /* if existing is in another schema... */
-                        if ( ( const void* ) name != exist -> name -> u . obj )
-                            return 0;
-
-                        /* need to swap with old */
-                        assert ( exist -> id >= VectorStart ( & self -> func ) );
-                        assert ( exist -> id < f -> id );
-                        VectorSwap ( & self -> func, f -> id, NULL, & ignore );
-                        VectorSwap ( & self -> func, f -> id = exist -> id, f, & ignore );
-                        f = exist;
-                    }
-
-                    /* exists is not an error */
-                    rc = 0;
-                }
-
-                VectorSwap ( & self -> func, f -> id, NULL, & ignore );
-            }
-        }
-    }
-    else if ( GetRCState ( rc ) == rcExists )
-    {
-        rc = 0;
-    }
-    
-    SFunctionWhack ( f, NULL );
-    return rc;
-}
-
-/*
- * function-decl      = 'function' <ext-func-decl> ';'
- *                    | 'function' <script-func-decl>
- */
-rc_t function_declaration ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self )
-{
-    return function_decl ( tbl, src, t, env, self,
-        env -> script_function_called_schema ? eFunction : 0, false );
-}
-
-/*
- * extern-func        = 'extern' 'function' <ext-function-decl> ';'
- */
-rc_t extfunc_declaration ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self )
-{
-    return function_decl ( tbl, src, t, env, self, eFunction, false );
-}
-
-/*
- * validate-func      = 'validate' 'function' <validate-function-decl> ';'
- */
-rc_t valfunc_declaration ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self )
-{
-    return function_decl ( tbl, src, t, env, self, eFunction, true );
-}
-
-#endif /* SLVL >= 3 */
-
-
-#if SLVL >= 4
-
-/*
- * script-decl        = 'schema' [ 'function' ] <script-func-decl>
- */
-rc_t script_declaration ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self )
-{
-    if ( t -> id == kw_function )
-        next_token ( tbl, src, t );
-
-    return function_decl ( tbl, src, t, env, self, eScriptFunc, false );
-}
-
-#endif /* SLVL >= 4 */
diff --git a/libs/vdb/schema-int.c b/libs/vdb/schema-int.c
deleted file mode 100644
index d0204cf..0000000
--- a/libs/vdb/schema-int.c
+++ /dev/null
@@ -1,376 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#include "schema-priv.h"
-#include "schema-parse.h"
-
-#include <vdb/vdb-priv.h>
-#include <klib/symbol.h>
-#include <klib/symtab.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <byteswap.h>
-#include <assert.h>
-
-#define INTRINSIC_SUB_BYTE_MULTI_BIT_TYPES 0
-
-/* init_keywords
- *  create simple symbols with special ids
- */
-static
-rc_t init_keywords ( KSymTable *tbl )
-{
-    int i;
-    static struct
-    {
-        const char *keyword;
-        int id;
-    } kw [] =
-    {
-#define KEYWORD( word ) \
-        { # word, kw_ ## word }
-
-        KEYWORD ( alias ),
-        KEYWORD ( column ),
-        KEYWORD ( const ),
-        KEYWORD ( control ),
-        KEYWORD ( database ),
-        KEYWORD ( decode ),
-        KEYWORD ( default ),
-        KEYWORD ( encode ),
-        KEYWORD ( extern ),
-        KEYWORD ( false ),
-        KEYWORD ( fmtdef ),
-        KEYWORD ( function ),
-        KEYWORD ( include ),
-        KEYWORD ( index ),
-        KEYWORD ( limit ),
-        KEYWORD ( physical ),
-        KEYWORD ( read ),
-        KEYWORD ( readonly ),
-        KEYWORD ( return ),
-        KEYWORD ( schema ),
-        KEYWORD ( static ),
-        KEYWORD ( table ),
-        KEYWORD ( trigger ),
-        KEYWORD ( template ),
-        KEYWORD ( true ),
-        KEYWORD ( type ),
-        KEYWORD ( typedef ),
-        KEYWORD ( typeset ),
-        KEYWORD ( validate ),
-        KEYWORD ( version ),
-        KEYWORD ( view ),
-        KEYWORD ( virtual ),
-        KEYWORD ( void ),
-        KEYWORD ( writeonly ),
-        KEYWORD ( __untyped ),
-        KEYWORD ( __row_length ),
-        KEYWORD ( __no_header )
-
-#undef KEYWORD
-    };
-
-    /* define keywords */
-    for ( i = 0; i < sizeof kw / sizeof kw [ 0 ]; ++ i )
-    {
-        rc_t rc;
-
-        String name;
-        StringInitCString ( & name, kw [ i ] . keyword );
-        rc = KSymTableCreateSymbol ( tbl, NULL, & name, kw [ i ] . id, NULL );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    return 0;
-}
-
-
-/* byte swapping */
-static
-void byte_swap_16 ( void *dst, const void *src, uint64_t count )
-{
-    uint16_t *d = dst;
-    const uint16_t *s = src;
-
-    uint64_t i;
-    for ( i = 0; i < count; ++ i )
-        d [ i ] = bswap_16 ( s [ i ] );
-}
-
-static
-void byte_swap_32 ( void *dst, const void *src, uint64_t count )
-{
-    uint32_t *d = dst;
-    const uint32_t *s = src;
-
-    uint64_t i;
-    for ( i = 0; i < count; ++ i )
-        d [ i ] = bswap_32 ( s [ i ] );
-}
-
-static
-void byte_swap_64 ( void *dst, const void *src, uint64_t count )
-{
-    uint64_t *d = dst;
-    const uint64_t *s = src;
-
-    uint64_t i;
-    for ( i = 0; i < count; ++ i )
-        d [ i ] = bswap_64 ( s [ i ] );
-}
-
-#if SUPPORT_128_BIT
-static
-void byte_swap_128 ( void *dst, const void *src, uint64_t count )
-{
-    uint64_t i;
-    uint64_t *d = dst;
-    const uint64_t *s = src;
-
-    if ( ( const uint64_t* ) d != s )
-    {
-        for ( count += count, i = 0; i < count; i += 2 )
-        {
-            d [ i + 0 ] = bswap_64 ( s [ i + 1 ] );
-            d [ i + 1 ] = bswap_64 ( s [ i + 0 ] );
-        }
-    }
-    else
-    {
-        for ( count += count, i = 0; i < count; i += 2 )
-        {
-            uint64_t tmp = bswap_64 ( s [ i + 0 ] );
-            d [ i + 0 ] = bswap_64 ( s [ i + 1 ] );
-            d [ i + 1 ] = tmp;
-        }
-    }
-}
-#endif
-
-
-/* InitTypes
- *  set up intrinsic types
- */
-static
-rc_t VSchemaInitTypes ( VSchema *self, KSymTable *tbl )
-{
-    int i;
-    static struct
-    {
-        const char *newtype;
-        const char *supertype;
-        void ( * byte_swap ) ( void *dst, const void *src, uint64_t count );
-        uint8_t dim;
-        uint8_t domain;
-    } dt [] =
-    {
-        { "any", NULL, NULL, 1, 0 },
-        { "void", NULL, NULL, 1, 0 },
-        { "opaque", NULL, NULL, 1, 0 },
-
-        /* bundles of bits in machine native order */
-        { "B1", "opaque", NULL, 1, ddUint },
-        { "B8", "opaque", NULL, 8, ddUint },
-        { "B16", "opaque", byte_swap_16, 16, ddUint },
-        { "B32", "opaque", byte_swap_32, 32, ddUint },
-        { "B64", "opaque", byte_swap_64, 64, ddUint },
-
-        /* the basic unsigned integer types */
-        { "U1", "B1", NULL, 1, ddUint },
-        { "U8", "B8", NULL, 1, ddUint },
-        { "U16", "B16", byte_swap_16, 1, ddUint },
-        { "U32", "B32", byte_swap_32, 1, ddUint },
-        { "U64", "B64", byte_swap_64, 1, ddUint },
-
-        /* the basic signed integer types */
-        { "I8", "B8", NULL, 1, ddInt },
-        { "I16", "B16", byte_swap_16, 1, ddInt },
-        { "I32", "B32", byte_swap_32, 1, ddInt },
-        { "I64", "B64", byte_swap_64, 1, ddInt },
-
-#if INTRINSIC_SUB_BYTE_MULTI_BIT_TYPES
-        /* all the basic bit tuples are subtypes
-           of opaque, making them essentially atomic,
-           required due to native byte order issues */
-        { "B2", "opaque", NULL, 2, ddUint },
-        { "B4", "opaque", NULL, 4, ddUint },
-        { "U2", "B2", NULL, 1, ddUint },
-        { "U4", "B4", NULL, 1, ddUint },
-        { "I4", "B4", NULL, 1, ddInt },
-#endif
-
-#if SUPPORT_128_BIT
-        /* 128 bit types */
-        { "B128", "opaque", byte_swap_128, 128, ddUint },
-        { "U128", "B128", byte_swap_128, 1, ddUint },
-        { "I128", "B128", byte_swap_128, 1, ddInt },
-#endif
-
-        /* floating point */
-        { "F32", "B32", byte_swap_32, 1, ddFloat },
-        { "F64", "B64", byte_swap_64, 1, ddFloat },
-
-        /* bool is typed to reflect C/C++ */
-        { "bool", "U8", NULL, 1, ddBool },
-
-        /* default character set is UNICODE */
-        { "utf8", "B8", NULL, 1, ddUnicode },
-        { "utf16", "B16", byte_swap_16, 1, ddUnicode },
-        { "utf32", "B32", byte_swap_32, 1, ddUnicode },
-
-        /* contrary to sub-classing, which extends/expands
-           a class, sub-typing refines it, making ASCII
-           a sub-type of UTF-8 in our system */
-        { "ascii", "utf8", NULL, 1, ddAscii }
-    };
-
-    for ( i = 0; i < sizeof dt / sizeof dt [ 0 ]; ++ i )
-    {
-        rc_t rc;
-        String name;
-        SDatatype *newtype;
-        const SDatatype *super = NULL;
-
-        if ( dt [ i ] . supertype != NULL )
-        {
-            KSymbol *sym;
-
-            /* find supertype in symbol table */
-            StringInitCString ( & name, dt [ i ] . supertype );
-            sym = KSymTableFind ( tbl, & name );
-            assert ( sym != NULL );
-            assert ( sym -> type == eDatatype );
-            super = sym -> u . obj;
-        }
-
-        /* create datatype */
-        newtype = malloc ( sizeof * newtype );
-        if ( newtype == NULL )
-            return RC ( rcVDB, rcSchema, rcConstructing, rcMemory, rcExhausted );
-
-        /* initialize datatype */
-        newtype -> super = super;
-        newtype -> byte_swap = dt [ i ] . byte_swap;
-        newtype -> size = ( ( super != NULL ) ? super -> size : 1 ) * dt [ i ] . dim;
-        newtype -> dim = dt [ i ] . dim;
-        newtype -> domain = dt [ i ] . domain;
-
-        /* just to cover any lazy programming, take byte_swap
-           from super-type if not already specified */
-        if ( super != NULL && newtype -> byte_swap == NULL )
-            newtype -> byte_swap = super -> byte_swap;
-
-        /* create symbol for new type */
-        StringInitCString ( & name, dt [ i ] . newtype );
-        newtype -> name = KSymTableFind ( tbl, & name );
-        assert ( newtype -> name == NULL || i == 1 );
-        if ( newtype -> name == NULL )
-            rc = KSymTableCreateConstSymbol ( tbl, & newtype -> name, & name, eDatatype, newtype );
-        else
-            rc = 0;
-
-        /* add datatype */
-        if ( rc == 0 )
-            rc = VectorAppend ( & self -> dt, & newtype -> id, newtype );
-
-        if ( rc != 0 )
-        {
-            free ( newtype );
-            return rc;
-        }
-    }
-
-    return 0;
-}
-
-
-/* MakeIntrinsic
- *  initialize intrinsics
- */
-rc_t VSchemaMakeIntrinsic ( VSchema **sp )
-{
-    rc_t rc = VSchemaMake ( sp, NULL );
-    if ( rc == 0 )
-    {
-        KSymTable tbl;
-        VSchema *self = * sp;
-
-        /* create symbol table with no intrinsic scope */
-        rc = KSymTableInit ( & tbl, NULL );
-        if ( rc == 0 )
-        {
-            /* make intrinsic scope modifiable */
-            KSymTablePushScope ( & tbl, & self -> scope );
-
-            /* add keywords, which are only names */
-            rc = init_keywords ( & tbl );
-            if ( rc == 0 )
-            {
-                /* TBD - init intrinsic formats */
-                rc = VSchemaInitTypes ( self, & tbl );
-                if ( rc == 0 )
-                {
-                    KSymTableWhack ( & tbl );
-                    return 0;
-                }
-            }
-
-            KSymTableWhack ( & tbl );
-        }
-
-        VSchemaRelease ( self );
-    }
-
-    * sp = NULL;
-
-    return rc;
-}
-
-/* LastIntrinsicTypeId - PRIVATE
- *  used to allow cast to intrinsics
- */
-LIB_EXPORT uint32_t CC VSchemaLastIntrinsicTypeId ( const VSchema *self )
-{
-    uint32_t last;
-    for ( last = 0; self != NULL; self = self -> dad )
-    {
-        if ( self -> dad == NULL )
-        {
-            last = VectorStart ( & self -> dt ) + VectorLength ( & self -> dt );
-            if ( last != 0 )
-                -- last;
-            break;
-        }
-    }
-
-    return last;
-}
diff --git a/libs/vdb/schema-parse.c b/libs/vdb/schema-parse.c
deleted file mode 100644
index d36cd8b..0000000
--- a/libs/vdb/schema-parse.c
+++ /dev/null
@@ -1,855 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#include "schema-priv.h"
-#include "schema-expr.h"
-#include "schema-parse.h"
-#include "schema-dump.h"
-
-#include <kfs/directory.h>
-#include <kfs/file.h>
-#include <kfs/mmap.h>
-#include <klib/symbol.h>
-#include <klib/symtab.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-
-
-/*--------------------------------------------------------------------------
- * SchemaEnv
- */
-
-/* Init - PRIVATE
- *  initialize to current version
- */
-static
-void SchemaEnvInitFeatures ( SchemaEnv *env )
-{
-    assert ( env != NULL );
-
-    switch ( env -> version >> 24 )
-    {
-    case 0:
-        env -> schema_param_types_absent = 1;
-        env -> mixed_fact_param_list = 1;
-        env -> script_function_called_schema = 1;
-        break;
-    case 1:
-        switch ( ( uint8_t ) ( env -> version >> 16 ) )
-        {
-        case 1:
-            env -> default_view_decl = 1;
-            env -> has_view_keyword = 1;
-            break;
-        }
-    }
-}
-
-void SchemaEnvInit ( SchemaEnv *env, uint32_t version )
-{
-    assert ( env != NULL );
-    memset ( env, 0, sizeof * env );
-
-    /* set version */
-    env -> version = version;
-    SchemaEnvInitFeatures ( env );
-}
-
-
-/*--------------------------------------------------------------------------
- * SConstant
- */
-#if SLVL >= 2
-
-/* Whack
- */
-void CC SConstantWhack ( void *item, void *ignore )
-{
-    SConstant *self = item;
-    SExpressionWhack ( self -> expr );
-    free ( self );
-}
-
-/* Mark
- */
-void CC SConstantClearMark ( void *item, void *ignore )
-{
-    SConstant *self = item;
-    self -> marked = false;
-}
-
-void SConstantMark ( const SConstant *cself )
-{
-    SConstant *self = ( SConstant* ) cself;
-    if ( self != NULL && ! self -> marked )
-        self -> marked = true;
-}
-
-/* Dump
- *  dump "const", dump object
- */
-rc_t SConstantDump ( const SConstant *self, struct SDumper *d )
-{
-    return FQNDump ( self != NULL ? self -> name : NULL, d );
-}
-
-bool CC SConstantDefDump ( void *item, void *data )
-{
-    SDumper *b = data;
-    const SConstant *self = ( const void* ) item;
-
-    if ( SDumperMarkedMode ( b ) && ! self -> marked )
-        return false;
-
-    if ( SDumperMode ( b ) == sdmCompact )
-    {
-        return SDumperPrint ( b, "const %T %N=%E;",
-            & self -> td, self -> name, self -> expr );
-    }
-
-    return SDumperPrint ( b, "const %T %N = %E;\n",
-        & self -> td, self -> name, self -> expr );
-}
-
-#endif
-
-
-/*--------------------------------------------------------------------------
- * VSchema
- */
-
-
-/* resolve_object
- *  generic object find
- *
- *  "td" [ OUT, NULL OKAY ] - returns cast type expression
- *  if given or "any" if not
- *
- *  "name" [ OUT ] - returns list of overloaded objects if found
- *
- *  "type" [ OUT ] - returns object type id, e.g.:
- *    eDatatype, eTypeset, eFormat, eFunction, ePhysical, eTable, ...
- *
- *  "expr" [ IN ] - NUL terminated name expression identifying object
- *
- *  "ctx" [ IN ] - NUL terminated context string for evaluation,
- *  substitutes for filename in logging reports
- *
- *  "dflt" [ IN ] - if true, resolve default value
- *
- *  returns principal object identified. if NULL but "name" is not
- *  NULL, then the object was only partially identified.
- */
-static
-int CC SColumnSortByID ( const void **item, const void **n, void *ignore )
-{
-    const SColumn *a = * item;
-    const SColumn *b = * n;
-    return VCtxIdCmp ( & a -> cid, & b -> cid );
-}
-
-static
-void CC SColumnLastDefault ( void *item, void *data )
-{
-    const SColumn *self = ( const SColumn* ) item;
-    const SColumn **colp = ( const SColumn** ) data;
-
-    if ( self -> dflt || * colp == NULL )
-        * colp = self;
-}
-
-typedef struct column_best_fit_data column_best_fit_data;
-struct column_best_fit_data
-{
-    const SColumn *scol;
-    const VSchema *schema;
-    VTypedecl td;
-    uint32_t distance;
-};
-
-static
-void CC SColumnBestFit ( void *item, void *data )
-{
-    const SColumn *scol = ( const void * ) item;
-    if ( scol -> td . type_id != 0 )
-    {
-        uint32_t distance;
-        column_best_fit_data *pb = data;
-        if ( VTypedeclToTypedecl ( & scol -> td, pb -> schema, & pb -> td, NULL, & distance ) )
-        {
-            if ( pb -> scol == NULL || pb -> distance > distance )
-            {
-                pb -> scol = scol;
-                pb -> distance = distance;
-            }
-        }
-    }
-}
-
-const void *resolve_object ( const KSymTable *tbl,
-    const VSchema *self, VTypedecl *tdp, const SNameOverload **namep,
-     uint32_t *type, const char *expr, const char *ctx, bool dflt )
-{
-    rc_t rc;
-    const void *obj;
-    
-    VTypedecl td;
-    bool has_type = false;
-
-    KToken t;
-    KTokenText tt;
-    KTokenSource src;
-
-    SchemaEnv env;
-    SchemaEnvInit ( & env, EXT_SCHEMA_LANG_VERSION );
-
-    KTokenTextInitCString ( & tt, expr, ctx );
-    KTokenSourceInit ( & src, & tt );
-    next_token ( tbl, & src, & t );
-
-    /* initialize return values */
-    obj = NULL;
-
-    /* ready to go - can accept a typecast */
-    if ( t . id == eLeftParen )
-    {
-        has_type = true;
-        next_token ( tbl, & src, & t );
-        rc = typedecl ( tbl, & src, & t, & env, self, & td );
-        if ( rc == 0 )
-            rc = expect ( tbl, & src, & t, eRightParen, ")", true );
-        if ( tdp != NULL )
-            * tdp = td;
-    }
-
-    /* can also accept a physical name */
-    else 
-    {
-        if ( t . id == ePeriod )
-            physical_name ( tbl, & src, & t, & env );
-        if ( tdp != NULL )
-            memset ( tdp, 0, sizeof * tdp );
-        rc = 0;
-    }
-
-    /* we recognize a column name or
-       a fully-qualified name optionally followed by
-       a version to fully-qualify obj */
-    if ( rc == 0 )
-        rc = next_fqn ( tbl, & src, & t, & env );
-    if ( rc == 0 )
-    {
-        uint32_t vers;
-        KToken st = t;
-        bool has_vers = false;
-        bool needs_name = true;
-        const SNameOverload *name = NULL;
-
-        next_token ( tbl, & src, & t );
-        switch ( st . id )
-        {
-        case eConstant:
-        case eFormat:
-        case eDatatype:
-        case eTypeset:
-        case ePhysMember:
-        case eTblMember:
-        case eDBMember:
-            needs_name = false;
-            obj = st . sym -> u . obj;
-            break;
-        case eFunction:
-        case eScriptFunc:
-        case ePhysical:
-        case eTable:
-        case eDatabase:
-            if ( t . id == eHash )
-            {
-                next_token ( tbl, & src, & t );
-                rc = maj_min_rel ( tbl, & src, & t, & env, self, & vers, true );
-                if ( rc != 0 )
-                    break;
-                has_vers = true;
-            }
-        case eUntypedFunc:
-        case eColumn:
-            name = st . sym -> u . obj;
-            break;
-        }
-
-        /* check if we found anything at all */
-        if ( obj != NULL || name != NULL )
-        {
-            /* accept but don't require semi-colon */
-            if ( t . id == eSemiColon )
-                next_token ( tbl, & src, & t );
-
-            /* expect end of input or else we didn't recognize */
-            if ( t . id != eEndOfInput )
-            {
-                obj = NULL;
-                name = NULL;
-            }
-        }
-
-        /* if we have something */
-        if ( obj != NULL || name != NULL )
-        {
-            * type = st . id;
-
-            /* resolve by version */
-            if ( has_vers )
-            {
-                assert ( name != NULL );
-                switch ( st . id )
-                {
-                case eFunction:
-                case eScriptFunc:
-                    obj = VectorFind ( & name -> items, & vers, NULL, SFunctionCmp );
-                    break;
-                case ePhysical:
-                    obj = VectorFind ( & name -> items, & vers, NULL, SPhysicalCmp );
-                    break;
-                case eTable:
-                    obj = VectorFind ( & name -> items, & vers, NULL, STableCmp );
-                    break;
-                case eDatabase:
-                    obj = VectorFind ( & name -> items, & vers, NULL, SDatabaseCmp );
-                    break;
-                }
-
-                /* since a version was requested,
-                   don't allow a partial find */
-                if ( obj == NULL )
-                    name = NULL;
-            }
-
-            /* resolve by type or default */
-            else if ( needs_name )
-            {
-                assert ( name != NULL );
-                switch ( st . id )
-                {
-                case eColumn:
-                    if ( ! has_type )
-                    {
-                        Vector items;
-                        rc = VectorCopy ( & name -> items, & items );
-                        if ( rc != 0 )
-                            break;
-                        VectorReorder ( & items, SColumnSortByID, NULL );
-                        VectorForEach ( & items, false, SColumnLastDefault, (void*)& obj );
-                        VectorWhack ( & items, NULL, NULL );
-                    }
-                    else
-                    {
-                        column_best_fit_data pb;
-                        pb . scol = NULL;
-                        pb . schema = self;
-                        pb . td = td;
-                        pb . distance = -1;
-
-                        VectorForEach ( & name -> items, false, SColumnBestFit, & pb );
-                        obj = pb . scol;
-                        if ( obj == NULL )
-                        {
-                            /* if named column is incomplete, allow match */
-                            memset ( & td, 0, sizeof td );
-                            obj = VectorFind ( & name -> items, & td, NULL, SColumnCmp );
-
-                            /* if column could not be matched by type, forget it */
-                            if ( obj == NULL )
-                                name = NULL;
-                        }
-                    }
-                    break;
-
-                default:
-                    if ( dflt )
-                        obj = VectorLast ( & name -> items );
-                }
-            }
-
-            * namep = name;
-        }
-    }
-
-    return obj;
-}
-
-/* Find
- *  generic object find
- *
- *  "name" [ OUT ] - returns list of overloaded names if found
- *
- *  "type" [ OUT ] - returns object type id, e.g.:
- *    eDatatype, eTypeset, eFormat, eFunction, ePhysical, eTable, ...
- *
- *  "expr" [ IN ] - name expression identifying object
- *
- *  returns principal object identified. if NULL but "name" is not
- *  NULL, then the object was only partially identified.
- */
-const void *VSchemaFind ( const VSchema *self,
-    const SNameOverload **name, uint32_t *type,
-    const char *expr, const char *ctx, bool dflt )
-{
-    rc_t rc;
-    KSymTable tbl;
-
-    /* initialize to not-found */
-    const void *obj = NULL;
-    * name = NULL;
-    * type = 0;
-
-    /* build a symbol table for schema */
-    rc = init_symtab ( & tbl, self );
-    if ( rc == 0 )
-    {
-        obj = resolve_object ( & tbl, self, NULL, name, type, expr, ctx, dflt );
-        KSymTableWhack ( & tbl );
-    }
-
-    return obj;
-}
-
-
-/* next_token
- *  gets next token
- *  looks up any identifier in symbol table
- *  converts token id to found symbol type
- */
-KToken *next_token ( const KSymTable *tbl, KTokenSource *src, KToken *t )
-{
-    if ( KTokenizerNext ( kDefaultTokenizer, src, t ) -> id == eIdent )
-    {
-        KSymbol *sym = KSymTableFind ( tbl, & t -> str );
-        t -> sym = sym;
-        if ( sym != NULL )
-            t -> id = sym -> type;
-    }
-
-    return t;
-}
-
-KToken *next_shallow_token ( const KSymTable *tbl, KTokenSource *src, KToken *t, bool plus_intrinsic )
-{
-    if ( KTokenizerNext ( kDefaultTokenizer, src, t ) -> id == eIdent || t -> id == eName )
-    {
-        KSymbol *sym = KSymTableFindShallow ( tbl, & t -> str );
-        if ( sym == NULL && plus_intrinsic )
-            sym = KSymTableFindIntrinsic ( tbl, & t -> str );
-        t -> sym = sym;
-        if ( sym != NULL )
-            t -> id = sym -> type;
-    }
-
-    return t;
-}
-
-
-/* expect
- *  performs a comparison of t->id against id, and takes one of 3 actions:
- *  1) when ids match, advance to next token and return 0
- *  2) when ids don't match but the expected token is not required,
- *     issue a KTokenExpected warning using expected text and return 0
- *  3) when ids don't match and the expected token is required,
- *     issue a KTokenExpected error using expected text and return its rc_t
- */
-rc_t expect ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    int id, const char *expected, bool required )
-{
-    if ( t -> id == id )
-        next_token ( tbl, src, t );
-    else if ( ! required )
-        KTokenExpected ( t, klogWarn, expected );
-    else
-        return KTokenExpected ( t, klogErr, expected );
-    return 0;
-}
-
-
-/*
- * maj-min            = <uint-expr> [ '.' <uint-expr> ]
- * maj-min-rel        = <uint-expr> [ '.' <uint-expr> [ '.' <uint-expr> ] ]
- */
-
-#if SLVL >= 1
-rc_t maj_min_rel ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, const VSchema *self, uint32_t *version, bool accept_release )
-{
-    rc_t rc;
-
-    if ( ! accept_release && t -> id == eMajMinRel )
-        return KTokenExpected ( t, klogErr, "maj.min version" );
-
-    rc = KTokenToVersion ( t, version );
-    if ( rc != 0 )
-        KTokenExpected ( t, klogErr, "version spec" );
-
-    next_token ( tbl, src, t );
-    return rc;
-}
-#endif
-
-
-/*
- * const-definition   = 'const' <typedecl> <fqn> '=' <const-expr>
- */
-#if SLVL >= 2
-static
-rc_t const_definition ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self )
-{
-    rc_t rc;
-    SConstant *cnst = malloc ( sizeof * cnst );
-    if ( cnst == NULL )
-        return RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-
-    rc = typedecl ( tbl, src, t, env, self, & cnst -> td );
-    if ( rc == 0 )
-        rc = create_fqn ( tbl, src, t, env, eConstant, cnst );
-    if ( rc == 0 )
-    {
-        cnst -> name = t -> sym;
-        rc = expect ( tbl, src, next_token ( tbl, src, t ), eAssign, "=", true );
-        if ( rc == 0 )
-            rc = const_expr ( tbl, src, t, env, self, & cnst -> expr );
-    }
-    else if ( GetRCState ( rc ) == rcExists )
-    {
-        cnst -> name = t -> sym;
-        rc = expect ( tbl, src, next_token ( tbl, src, t ), eAssign, "=", true );
-        if ( rc == 0 )
-            rc = const_expr ( tbl, src, t, env, self, & cnst -> expr );
-        if ( rc == 0 )
-        {
-            /* TBD - compare expressions for equivalence */
-            SConstantWhack ( cnst, NULL );
-            return expect ( tbl, src, t, eSemiColon, ";", true );
-        }
-    }
-
-    if ( rc != 0 )
-    {
-        free ( cnst );
-        return rc;
-    }
-
-    rc = VectorAppend ( & self -> cnst, & cnst -> id, cnst );
-    if ( rc != 0 )
-    {
-        SConstantWhack ( cnst, NULL );
-        return KTokenRCExplain ( t, klogInt, rc );
-    }
-
-    return expect ( tbl, src, t, eSemiColon, ";", true );
-}
-#endif
-
-
-/*
- * alias-definition   = 'alias' SYMBOL <fqn>
- */
-static
-rc_t alias_definition ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self )
-{
-    const KSymbol *sym;
-
-    /* read symbol name */
-    rc_t rc = next_fqn ( tbl, src, t, env );
-    if ( rc != 0 )
-        return KTokenFailure ( t, klogErr, rc, "fully qualified name" );
-
-    /* remember symbol */
-    sym = t -> sym;
-
-    /* create new name */
-    rc = create_fqn ( tbl, src, next_token ( tbl, src, t ),
-        env, sym -> type, sym -> u . obj );
-    if ( rc != 0 )
-    {
-        if ( GetRCState ( rc ) != rcExists )
-            return KTokenFailure ( t, klogErr, rc, "fully qualified name" );
-
-        /* TBD - compare alias */
-        return expect ( tbl, src, next_token ( tbl, src, t ), eSemiColon, ";", true );
-    }
-
-    /* record alias */
-    rc = VectorAppend ( & self -> alias, NULL, t -> sym );
-    if ( rc != 0 )
-        return KTokenRCExplain ( t, klogErr, rc );
-
-    return expect ( tbl, src, next_token ( tbl, src, t ), eSemiColon, ";", true );
-}
-
-
-/*
- * extern-decl        = 'extern' 'function' <ext-function-decl> ';'
- */
-static
-rc_t extern_declaration ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self )
-{
-    switch ( t -> id )
-    {
-#if SLVL >= 3
-    case kw_function:
-        return extfunc_declaration ( tbl, src, next_token ( tbl, src, t ), env, self );
-#endif
-    default:
-        break;
-    }
-
-    return KTokenExpected ( t, klogErr, "function" );
-}
-
-
-/*
- * validate-decl      = 'validate' 'function' <validate-function-decl> ';'
- */
-static
-rc_t validate_declaration ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self )
-{
-    switch ( t -> id )
-    {
-#if SLVL >= 3
-    case kw_function:
-        return valfunc_declaration ( tbl, src, next_token ( tbl, src, t ), env, self );
-#endif
-    default:
-        break;
-    }
-
-    return KTokenExpected ( t, klogErr, "function" );
-}
-
-
-/*
- * include-stmt       = 'include' STRING ';'
- */
-static
-rc_t include_stmt ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self )
-{
-    rc_t rc;
-
-    if ( t -> id != eString )
-        return KTokenExpected ( t, klogErr, "file path" );
-
-    rc = VSchemaParseFile ( self, "%.*s", ( int ) ( t -> str . size - 2 ), t -> str . addr + 1 );
-    if ( rc != 0 )
-        return KTokenRCExplain ( t, klogErr, rc );
-
-    return expect ( tbl, src, next_token ( tbl, src, t ), eSemiColon, ";", true );
-}
-
-
-/*
- * schema-decl        = <type-definition>
- *                    | <typeset-definition>
- *                    | <format-definition>
- *                    | <const-definition>
- *                    | <alias-definition>
- *                    | <extern-decl>
- *                    | <script-decl>
- *                    | <function-decl>
- *                    | <physical-decl>
- *                    | <table-decl>
- *                    | <database-decl>
- *                    | <include-stmt>
- *                    | ';'
- */
-static
-rc_t schema_decl ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self )
-{
-    /* expect a keyword */
-    switch ( t -> id )
-    {
-#if SLVL >= 1
-    case kw_typedef:
-        return type_definition ( tbl, src, next_token ( tbl, src, t ), env, self );
-    case kw_typeset:
-        return typeset_definition ( tbl, src, next_token ( tbl, src, t ), env, self );
-#endif
-    case kw_fmtdef:
-        return format_definition ( tbl, src, next_token ( tbl, src, t ), env, self );
-#if SLVL >= 2
-    case kw_const:
-        return const_definition ( tbl, src, next_token ( tbl, src, t ), env, self );
-#endif
-    case kw_alias:
-        return alias_definition ( tbl, src, next_token ( tbl, src, t ), env, self );
-
-    case kw_extern:
-        return extern_declaration ( tbl, src, next_token ( tbl, src, t ), env, self );
-#if SLVL >= 3
-    case kw_function:
-        return function_declaration ( tbl, src, next_token ( tbl, src, t ), env, self );
-#endif
-#if SLVL >= 4
-    case kw_schema:
-        return script_declaration ( tbl, src, next_token ( tbl, src, t ), env, self );
-#endif
-#if SLVL >= 5
-    case kw_physical:
-        return physical_declaration ( tbl, src, next_token ( tbl, src, t ), env, self );
-#endif
-#if SLVL >= 6
-    case kw_table:
-        return table_declaration ( tbl, src, next_token ( tbl, src, t ), env, self );
-    case kw_database:
-        return database_declaration ( tbl, src, next_token ( tbl, src, t ), env, self );
-#endif
-    case kw_include:
-        return include_stmt ( tbl, src, next_token ( tbl, src, t ), env, self );
-
-    case kw_validate:
-        return validate_declaration ( tbl, src, next_token ( tbl, src, t ), env, self );
-
-    case eSemiColon:
-        /* TBD - issue warning if desired */
-        next_token ( tbl, src, t );
-        return 0;
-    }
-
-    /* it wasn't the right thing */
-    return KTokenExpected ( t, klogErr,
-        "include, typedef, typeset, fmtdef, function, schema, database or table" );
-}
-
-/*
- * schema-version     = 'version' <maj-min>
- */
-#if SLVL >= 1
-static
-rc_t schema_version ( const KSymTable *tbl, KTokenSource *src, KToken *t, SchemaEnv *env )
-{
-    rc_t rc = maj_min_rel ( tbl, src, t, env, NULL, & env -> version, false );
-    if ( rc == 0 )
-        SchemaEnvInitFeatures ( env );
-    return rc;
-}
-#endif
-
-
-/* examine_schema_contents
- *  run a sanity check on schema contents
- */
-#if EXAMINE_SCHEMA_CONTENTS >= 1
-static
-rc_t examine_schema_contents ( const VSchema *self )
-{
-    rc_t rc = 0;
-
-    if ( self -> dad != NULL )
-    {
-        rc = examine_schema_contents ( self -> dad );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    if ( BSTreeDoUntil ( & self -> scope, false, KSymbolExamineContents, & rc ) )
-        return rc;
-
-    return 0;
-}
-#endif
-
-/*
- * schema             = [ <schema-version> ';' ] [ <schema-decl-list> ]
- *
- * schema-decl-list   = <schema-decl> [ <schema-decl-list> ]
- */
-rc_t init_symtab ( KSymTable *tbl, const VSchema *self )
-{
-    rc_t rc;
-
-    if ( self -> dad == NULL )
-        return KSymTableInit ( tbl, ( BSTree* ) & self -> scope );
-
-    rc = init_symtab ( tbl, self -> dad );
-    if ( rc == 0 )
-        rc = KSymTablePushScope ( tbl, ( BSTree* ) & self -> scope );
-
-    return rc;
-}
-
-rc_t schema ( KTokenSource *src, VSchema *self )
-{
-    /* push schema scope onto symbol table */
-    KSymTable tbl;
-    rc_t rc = init_symtab ( & tbl, self );
-    if ( rc == 0 )
-    {
-        KToken t;
-        SchemaEnv env;
-
-        /* prime token and look for version */
-        next_token ( & tbl, src, & t );
-#if SLVL >= 1
-        /* initialize default to v1 */
-        if ( t . id != kw_version )
-            SchemaEnvInit ( & env, 0x01000000 );
-        else
-        {
-            /* initialize explicit version */
-            memset ( & env, 0, sizeof env );
-            rc = schema_version ( & tbl, src, next_token ( & tbl, src, & t ), & env );
-            if ( rc == 0 )
-                rc = expect ( & tbl, src, & t, eSemiColon, ";", true );
-        }
-#endif
-        if ( rc == 0 && t . id != eEndOfInput )
-        {
-            /* implement optional schema-decl-list */
-            while ( rc == 0 && t . id != eEndOfInput )
-            {
-#if EXAMINE_SCHEMA_CONTENTS >= 1
-                rc = examine_schema_contents ( self );
-                if ( rc == 0 )
-#endif
-                rc = schema_decl ( & tbl, src, & t, & env, self );
-            }
-        }
-
-        KSymTableWhack ( & tbl );
-    }
-
-    return rc;
-}
diff --git a/libs/vdb/schema-parse.h b/libs/vdb/schema-parse.h
deleted file mode 100644
index efd695f..0000000
--- a/libs/vdb/schema-parse.h
+++ /dev/null
@@ -1,607 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_schema_parse_
-#define _h_schema_parse_
-
-#ifndef _h_schema_priv_
-#include "schema-priv.h"
-#endif
-
-#ifndef _h_schema_tok_
-#include "schema-tok.h"
-#endif
-
-#ifndef _h_klib_symtab_
-#include <klib/symtab.h>
-#endif
-
-#ifndef _h_klib_debug_
-#include <klib/debug.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * defines
- */
-#define PARSE_DEBUG( msg ) \
-    DBGMSG ( DBG_VDB, DBG_FLAG ( DBG_VDB_PARSE ), msg )
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct SVector;
-struct STable;
-struct SDatabase;
-struct SFunction;
-struct SConstExpr;
-struct SFormParmlist;
-struct SExpression;
-struct STypeExpr;
-
-/*--------------------------------------------------------------------------
- * extension of token ids
- */
-enum
-{
-    /* a symbolic constant */
-    eConstant = eNumSymtabIDs,
-
-    /* format type */
-    eFormat,
-
-    /* dynamic data type */
-    eDatatype,
-
-    /* typeset */
-    eTypeset,
-
-    /* factory */
-    eFactory,
-
-    /* external C function */
-    eFunction,
-    eUntypedFunc,
-    eRowLengthFunc,
-
-    /* script function */
-    eScriptFunc,
-
-    /* schema type and param
-       a schema type is a templatized type, basically
-       a name without a completed definition
-
-       a schema param is a parameterized constant that
-       can be used in defining type vector dimensions */
-    eSchemaType,
-    eSchemaParam,
-
-    /* factory param and name
-       a factory param is a templatized constant, but
-       cannot be used to define type dimensions */
-    eFactParam,
-
-    /* function param */
-    eFuncParam,
-
-    /* intermediate production */
-    eProduction,
-
-    /* physical column */
-    ePhysical,
-
-    /* physical column member */
-    ePhysMember,
-
-    /* external column */
-    eColumn,
-
-    /* forward declaration */
-    eForward,
-
-    /* purely virtual production */
-    eVirtual,
-
-    /* table */
-    eTable,
-
-    /* table member */
-    eTblMember,
-
-    /* database */
-    eDatabase,
-
-    /* database member */
-    eDBMember,
-
-    /* keywords */
-    eFirstKeyword,
-
-    kw_alias = eFirstKeyword,
-    kw_column,
-    kw_const,
-    kw_control,
-    kw_database,
-    kw_decode,
-    kw_default,
-    kw_encode,
-    kw_extern,
-    kw_false,
-    kw_fmtdef,
-    kw_function,
-    kw_include,
-    kw_index,
-    kw_limit,
-    kw_physical,
-    kw_read,
-    kw_readonly,
-    kw_return,
-    kw_schema,
-    kw_static,
-    kw_table,
-    kw_template,
-    kw_trigger,
-    kw_true,
-    kw_type,
-    kw_typedef,
-    kw_typeset,
-    kw_validate,
-    kw_version,
-    kw_view,
-    kw_virtual,
-    kw_void,
-    kw_writeonly,
-
-    /* special keywords */
-    kw___untyped,
-    kw___row_length,
-    kw___no_header
-
-};
-
-/* SchemaEnv
- *  states the schema language version
- *  gives switches as to features, errors, warnings, etc.
- */
-typedef struct SchemaEnv SchemaEnv;
-struct SchemaEnv
-{
-    /* maj.min.rel format,
-       only maj.min supported */
-    uint32_t version;
-
-    /* V0 COMPATIBILITY SWITCHES */
-    uint32_t schema_param_types_absent : 1;
-    uint32_t mixed_fact_param_list : 1;
-    uint32_t script_function_called_schema : 1;
-
-    /* V1 SWITCHES */
-    uint32_t default_view_decl : 1;
-    uint32_t has_view_keyword : 1;
-};
-
-/* SCHEMA_LANG_VERSION
- *  version numbers of schema language
- */
-#define CUR_SCHEMA_LANG_VERSION 0x01000000
-#define EXT_SCHEMA_LANG_VERSION 0x01000000
-
-/* Init
- *  initialize to current version
- */
-void SchemaEnvInit ( SchemaEnv *env, uint32_t version );
-
-/*--------------------------------------------------------------------------
- * schema-parse.c
- */
-
-/*
- * schema             = [ <schema-version> ';' ] [ <schema-decl-list> ]
- *
- * schema-decl-list   = <schema-decl> [ <schema-decl-list> ]
- *
- * schema-decl        = <type-definition> ';'
- *                    | <typeset-definition> ';'
- *                    | <format-definition> ';'
- *                    | <function-decl> ';'
- *                    | <schema-decl>
- *                    | <table-decl>
- *
- * schema-version     = 'version' <maj-min>
- */
-rc_t schema ( KTokenSource *src, VSchema *self );
-
-/*
- * init_symtab
- *  initializes "tbl"
- *  places schema and parents into scope
- *  must be balanced by KSymTableWhack
- */
-rc_t init_symtab ( KSymTable *tbl, const VSchema *self );
-
-/* next_token
- *  gets next token
- *  looks up any identifier in symbol table
- *  converts token id to found symbol type
- * next_shallow_token
- *  only searches current scope, and optionally intrinsic scope
- */
-#define next_token vdb_next_token
-#define next_shallow_token vdb_next_shallow_token
-KToken *next_token ( const KSymTable *tbl, KTokenSource *src, KToken *t );
-KToken *next_shallow_token ( const KSymTable *tbl,
-    KTokenSource *src, KToken *t, bool plus_intrinsic );
-
-/* expect
- *  performs a comparison of t->id against id, and takes one of 3 actions:
- *  1) when ids match, advance to next token and return 0
- *  2) when ids don't match but the expected token is not required,
- *     issue a KTokenExpected warning using expected text and return 0
- *  3) when ids don't match and the expected token is required,
- *     issue a KTokenExpected error using expected text and return its rc_t
- */
-rc_t expect ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    int id, const char *expected, bool required );
-
-/*
- * maj-min            = <uint-expr> [ '.' <uint-expr> ]
- * maj-min-rel        = <uint-expr> [ '.' <uint-expr> [ '.' <uint-expr> ] ]
- */
-rc_t maj_min_rel ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, const VSchema *self, uint32_t *version, bool accept_release );
-
-rc_t next_uint ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, const VSchema *self, uint32_t *val );
-
-/* resolve_object
- *  generic object find
- *
- *  "td" [ OUT, NULL OKAY ] - returns cast type expression
- *  if given or "any" if not
- *
- *  "name" [ OUT ] - returns list of overloaded objects if found
- *
- *  "type" [ OUT ] - returns object type id, e.g.:
- *    eDatatype, eTypeset, eFormat, eFunction, ePhysical, eTable, ...
- *
- *  "expr" [ IN ] - NUL terminated name expression identifying object
- *
- *  "ctx" [ IN ] - NUL terminated context string for evaluation,
- *  substitutes for filename in logging reports
- *
- *  "dflt" [ IN ] - if true, resolve default value
- *
- *  returns principal object identified. if NULL but "name" is not
- *  NULL, then the object was only partially identified.
- */
-const void *resolve_object ( const KSymTable *tbl,
-    const VSchema *self, VTypedecl *td, const SNameOverload **name,
-    uint32_t *type, const char *expr, const char *ctx, bool dflt );
-
-
-/*--------------------------------------------------------------------------
- * schema-type.c
- */
-
-
-/*
- * fqn                = ID [ <nested-name> ]
- * nested-name        = ':' NAME [ <nested-name> ]
- */
-rc_t next_fqn ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env );
-rc_t create_fqn ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, uint32_t id, const void *obj );
-
-
-/*
- * dim                = '[' <uint-expr> ']'
- */
-rc_t dim ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, const VSchema *self, uint32_t *dim, bool required );
-
-/*
- * typename           = <fqn>
- * typedecl           = <typename> [ <dim> ]
- */
-rc_t typename ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, uint32_t *id );
-rc_t typedecl ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, const VSchema *self, VTypedecl *td );
-
-/*
- * typeset            = <fqn>
- * typespec           = <typedecl>
- *                    | <typeset> [ <dim> ]
- */
-rc_t typeset ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, uint32_t *id );
-rc_t typespec ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, const VSchema *self, VTypedecl *td );
-
-/*
- * fmtname            = <fqn>
- * fmtdecl            = <fmtname> [ '/' <typedecl> ]
- *                    | <typedecl>
- * fmtspec            = <fmtname> [ '/' <typedecl> ]
- *                    | <typespec>
- */
-rc_t fmtname ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, uint32_t *id );
-rc_t fmtdecl ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, const VSchema *self, VFormatdecl *fd );
-rc_t fmtspec ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, const VSchema *self, VFormatdecl *fd );
-
-/*
- * type-definition    = 'typedef' <typename> <typedef-list>
- * typedef-list       = <typedef-decl> [ ',' <typedef-list> ]
- * typedef-decl       = <fqn> [ <dim> ]
- */
-rc_t type_definition ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self );
-
-/*
- * typeset-definition = 'typeset' <typeset> '{' <typespec-list> '}'
- * typespec-list      = <typespec> [ ',' <typespec-list> ]
- */
-rc_t typeset_definition ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self );
-
-/*
- * format-definition  = 'fmtdef' [ <fmtname> ] <fqn>
- */
-rc_t format_definition ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self );
-
-
-/*--------------------------------------------------------------------------
- * schema-func.c
- */
-
-/*
- * function-decl      = [ 'extern' ] 'function' <ext-function-decl> ';'
- *                    | 'validate' 'function' <validate-function-decl> ';'
- *                    | 'schema' [ 'function' ] <sch-func-decl>
- *                    | 'function' <ext-func-decl> ';'
- *                    | 'function' <sch-func-decl>
- */
-rc_t function_declaration ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self );
-rc_t extfunc_declaration ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self );
-rc_t valfunc_declaration ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self );
-rc_t script_declaration ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self );
-
-/*
- * schema-signature   = <schema-formals>
- * schema-formals     = <schema-formal> [ ',' <schema-formals> ]
- * schema-formal      = <schema-typedecl> ID
- * schema-parmname    = ID
- */
-rc_t schema_signature ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, struct SFunction *sig );
-
-/*
- * fact-signature     = <fact-formals> [ '*' <fact-formals> ] [ ',' '...' ]
- *                    | '*' <fact-formals> [ ',' '...' ]
- *                    | '...'
- */
-rc_t fact_signature ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, struct SFormParmlist *sig );
-
-
-/*--------------------------------------------------------------------------
- * schema-prod.c
- */
-
-/*
- * production-stmt    = <func-fmtdecl> ID <assign-expr>
- *                    | 'trigger' ID <assign-expr>
- */
-rc_t production_stmt ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, struct Vector *v, uint32_t ptype );
-
-/*
- * script-body        = '{' <script-stmts> '}'
- */
-rc_t script_body ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, struct SFunction *f );
-
-/*
- * physical-decl      = 'physical' [ 'column' ] <typedecl>
- *                       <fqn> '#' <maj-min-rel> <phys-body>
- */
-rc_t physical_declaration ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self );
-
-
-/*--------------------------------------------------------------------------
- * schema-expr.c
- */
-
-/*
- * dim-expr           = '[' <uint-expr> ']'
- */
-rc_t dim_expr ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, struct SExpression const **dim, bool required );
-
-
-/*
- * cond-expr          = <expression> [ '|' <cond-expr> ]
- */
-rc_t cond_expr ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, struct SExpression const **expr );
-
-/*
- * expression         = <param-value>
- *                    | <func-expr>
- *                    | '(' <func-fmtdecl> ')' <expression>
- */
-rc_t expression ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, struct SExpression const **expr );
-
-/*
- * type-expr          = <typeset>
- *                    | <fmtdecl>
- *                    | <fmtname> '/' <typeset>
- */
-rc_t type_expr ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, const VSchema *self, struct SExpression const **fd );
-rc_t vardim_type_expr ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, const VSchema *self, struct SExpression const **fd );
-
-/*
- * const-expr         = <constname>
- *                    | CONST-VALUE
- */
-rc_t const_expr ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, const VSchema *self, struct SExpression const **expr );
-
-/*
- * phys-encoding-expr = [ '<' <schema-parms> '>' ]
- *                      <phys-encoding-name> [ '#' <maj-min-rel> ]
- *                      [ '<' <fact-params> '>' ]
- */
-rc_t phys_encoding_expr ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, VTypedecl *td, struct SExpression const **expr );
-
-
-/*--------------------------------------------------------------------------
- * schema-eval.c
- */
-
-/* eval-const-expr
- *  tries to evaluate a constant expression against type
- *  returns non-zero error code if failed
- */
-rc_t eval_const_expr ( const VSchema *self, const VTypedecl *td,
-    struct SExpression const *expr, struct SExpression **value, Vector *cx_bind );
-
-/* eval-uint-expr
- *  special const expression evaluator for uint32_t
- */
-rc_t eval_uint_expr ( const VSchema *self,
-    struct SExpression const *expr, uint32_t *value, Vector *cx_bind );
-
-/* eval-uint64-expr
- *  special const expression evaluator for uint64_t
- */
-rc_t eval_uint64_expr ( const VSchema *self,
-    struct SExpression const *expr, uint64_t *value, Vector *cx_bind );
-
-/* eval-expr-syntax
- *  examine expression syntax
- *  fixes forward references
- */
-rc_t eval_expr_syntax ( struct SExpression const *expr );
-
-
-/*--------------------------------------------------------------------------
- * schema-tbl.c
- */
-
-/*
- * physical-name      = '.' ID
- */
-void physical_name ( const KSymTable *tbl,
-    KTokenSource *src, KToken *t, const SchemaEnv *env );
-
-/*
- * push-tbl-scope
- * pop-tbl-scope
- */
-rc_t push_tbl_scope ( KSymTable *tbl, struct STable const *table );
-void pop_tbl_scope ( KSymTable *tbl, struct STable const *table );
-
-/*
- * init-tbl-symtab
- *  initializes "tbl"
- *  places table in scope
- *  must be balanced by KSymTableWhack
- */
-rc_t init_tbl_symtab ( KSymTable *tbl, const VSchema *schema, struct STable const *table );
-
-/*
- * table-decl         = 'table' <fqn> <table-def>
- * table-def          = [ <table-dad> ] <table-body>
- *                    | <table-dad> ';'
- *
- * table-dad          = '=' <table-name>
- *
- * table-body         = '{' [ <table-decl-list> ] '}'
- * table-decl-list    = <tbl-local-decl> ';' [ <table-decl-list> ]
- */
-rc_t table_declaration ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self );
-
-
-/*--------------------------------------------------------------------------
- * schema-db.c
- */
-
-/*
- * push-db-scope
- * pop-db-scope
- */
-rc_t push_db_scope ( KSymTable *tbl, struct SDatabase const *db );
-void pop_db_scope ( KSymTable *tbl, struct SDatabase const *db );
-
-/*
- * init-db-symtab
- *  initializes "tbl"
- *  places db in scope
- *  must be balanced by KSymTableWhack
- */
-rc_t init_db_symtab ( KSymTable *tbl, const VSchema *schema, struct SDatabase const *db );
-
-/*
- * database-decl      = 'database' <fqn> <database-def>
- * database-def       = [ <database-dad> ] <database-body>
- *                    | <database-dad> ';'
- *
- * database-dad       = '=' <database-name>
- *
- * database-body      = '{' [ <db-decl-list> ] '}'
- * db-decl-list       = <database-decl>
- *                    | <table-decl>
- */
-rc_t database_declaration ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_schema_int_ */
diff --git a/libs/vdb/schema-priv.h b/libs/vdb/schema-priv.h
deleted file mode 100644
index 7e321ab..0000000
--- a/libs/vdb/schema-priv.h
+++ /dev/null
@@ -1,1308 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_schema_priv_
-#define _h_schema_priv_
-
-#ifndef _h_vdb_schema_
-#include <vdb/schema.h>
-#endif
-
-#ifndef _h_vdb_xform_
-#include <vdb/xform.h>
-#endif
-
-#ifndef _h_klib_text_
-#include <klib/text.h>
-#endif
-
-#ifndef _h_klib_container_
-#include <klib/container.h>
-#endif
-
-#ifndef _h_klib_vector_
-#include <klib/vector.h>
-#endif
-
-#ifndef _h_klib_refcount_
-#include <klib/refcount.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * SLVL - schema development level
- *  used to bring schema together in an orderly fashion
- *
- *  level 0: include, fmtdef, alias
- *
- *  level 1: version, typedef, dim, typeset
- *           const-expr, type-expr
- *           eval-uint-expr, eval-type-expr
- *
- *  level 2: const, eval-const-expr
- *
- *  level 3: function, schema-param-decl, fact-param-decl, func-param-decl
- *           indirect-type-expr, indirect-const-expr, prod-expr
- *
- *  level 4: script, return-stmt, prod-stmt
- *           cond-expr, cast-expr, func-expr, name-expr
- *
- *  level 5: physical
- *
- *  level 6: database, table
- *
- *  level 7: physical members
- *
- *  level 8: columns
- */
-#ifndef SLVL
-#define SLVL 8
-#endif
-
-
-/*--------------------------------------------------------------------------
- * EXAMINE_SCHEMA_CONTENTS
- *  debugging setting for examining contents and detecting inconsistencies
- */
-#ifndef EXAMINE_SCHEMA_CONTENTS
-#if _DEBUGGING
-#define EXAMINE_SCHEMA_CONTENTS 0
-#else
-#define EXAMINE_SCHEMA_CONTENTS 0
-#endif
-#endif
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct String;
-struct KSymbol;
-struct KTokenText;
-struct KMDataNode;
-struct SFunction;
-struct SDatabase;
-struct VDBManager;
-struct SExpression;
-struct SDumper;
-
-
-/*--------------------------------------------------------------------------
- * VCtxId
- *  id within a context
- *  made to be compatible with KSymbol.u.fwd
- */
-typedef struct VCtxId VCtxId;
-struct VCtxId
-{
-    uint32_t ctx;
-    uint32_t id;
-};
-
-/* Cmp
- */
-#define VCtxIdCmp( a, b ) \
-    ( ( ( a ) -> ctx != ( b ) -> ctx ) ? \
-      ( int ) ( a ) -> ctx - ( int ) ( b ) -> ctx : \
-      ( int ) ( a ) -> id - ( int ) ( b ) -> id )
-
-
-/*--------------------------------------------------------------------------
- * KSymbol
- */
-
-/* Copy
- *  deep copy a single symbol
- */
-rc_t KSymbolCopy ( BSTree *scope,
-    struct KSymbol **cp, struct KSymbol const *orig );
-
-/* CopyScope
- *  deep copy all symbols within a scope
- */
-bool CC KSymbolCopyScope ( BSTNode *sym, void *scope );
-
-
-/* ExamineContents
- *  not much to be done here
- */
-#if EXAMINE_SCHEMA_CONTENTS >= 1
-bool KSymbolExamineContents ( BSTNode *sym, void *rc );
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KMDataNode
- */
-
-/* FillSchema
- *  a schema buffer fill function that reads from KMDataNode
- *
- * NB - preset "add_v0" to false for normal operation, "true"
- *  if the buffer should be prefixed with "version 0;" on first read
- */
-typedef struct KMDataNodeSchemaFillData KMDataNodeSchemaFillData;
-struct KMDataNodeSchemaFillData
-{
-    struct KMDataNode const *node;
-    size_t pos;
-    char buff [ 64 * 1024 - 1 ];
-    bool add_v0;
-};
-
-rc_t CC KMDataNodeFillSchema ( void *data, struct KTokenText *tt, size_t save );
-
-
-/*--------------------------------------------------------------------------
- * VTypedecl
- * VFormatdecl
- */
-
-/* CommonAncestor
- *  find a common ancestor between "self" and "peer"
- *  returns distance as sum of distances from each to "ancestor"
- */
-bool VFormatdeclCommonAncestor ( const VFormatdecl *self, const VSchema *schema,
-    const VFormatdecl *peer, VFormatdecl *ancestor, uint32_t distances [ 2 ] );
-
-
-/*--------------------------------------------------------------------------
- * SNameOverload
- *  describes an overloaded name
- *  used to implement versioning 
- */
-typedef struct SNameOverload SNameOverload;
-struct SNameOverload
-{
-    /* symbolic name */
-    struct KSymbol const *name;
-
-    /* overloaded items */
-    Vector items;
-
-    /* contextual id */
-    VCtxId cid;
-};
-
-/* Make
- */
-rc_t SNameOverloadMake ( SNameOverload **name,
-    struct KSymbol const *sym, uint32_t start, uint32_t len );
-
-/* Copy
- */
-rc_t SNameOverloadCopy ( BSTree *scope,
-    SNameOverload **cp, const SNameOverload *orig );
-rc_t SNameOverloadVectorCopy ( BSTree *scope,
-    const Vector *src, Vector *dest );
-
-/* Whack
- */
-void CC SNameOverloadWhack ( void *self, void *ignore );
-
-
-/*--------------------------------------------------------------------------
- * VSchema
- *  a symbol scope
- *  data types, blob formats, function and sub-schema declarations
- *  database and table declarations
- */
-struct VSchema
-{
-    /* parent schema */
-    const VSchema *dad;
-
-    /* global scope for this schema */
-    BSTree scope;
-
-    /* paths of opened files */
-    BSTree paths;
-
-    /* include path - vector of KDirectory references
-       ordered by precedence */
-    Vector inc;
-
-    /* alias names - owned by scope, but recorded for dumping */
-    Vector alias;
-
-    /* formats - ids start at 1, where 0 is reserved for NULL */
-    Vector fmt;
-
-    /* datatypes - ids start at 0, which is reserved for 'any' */
-    Vector dt;
-
-    /* typesets - ids start at 0x40000000 */
-    Vector ts;
-
-    /* parameterized types, declared within function
-       signatures and defined within expressions
-       ids start at 0x80000001, where 0x80000000
-       is reserved for 'undefined' */
-    Vector pt;
-
-    /* symbolic constants */
-    Vector cnst;
-
-    /* extern and schema functions */
-    Vector func;
-    Vector fname;
-
-    /* physical columns */
-    Vector phys;
-    Vector pname;
-
-    /* tables */
-    Vector tbl;
-    Vector tname;
-
-    /* databases */
-    Vector db;
-    Vector dname;
-
-    KRefcount refcount;
-
-    uint32_t file_count;
-
-    /* number of indirect expressions
-       these are uniquely identified place-holders
-       for cursor-open binding of
-       type and constant expressions */
-    uint32_t num_indirect;
-};
-
-
-/* Make
- *  creates an empty schema
- */
-rc_t VSchemaMake ( VSchema **sp, const VSchema *dad );
-
-
-/* MakeIntrinsic
- *  creates an initial, intrinsic schema
- */
-rc_t VSchemaMakeIntrinsic ( VSchema **intrinsic );
-
-
-/* Attach
- * Sever
- */
-VSchema *VSchemaAttach ( const VSchema *self );
-rc_t VSchemaSever ( const VSchema *self );
-
-
-/* ParseTextCallback
- *  parse schema text
- *  add productions to existing schema
- *
- *  "name" [ IN, NULL OKAY ] - optional name
- *  representing text, e.g. filename
- *
- *  "fill" [ IN ] and "data" [ IN, OPAQUE ] - for filling buffer
- */
-rc_t VSchemaParseTextCallback ( VSchema *self, const char *name,
-    rc_t ( CC * fill ) ( void *self, struct KTokenText *tt, size_t save ),
-    void *data );
-
-/* Find
- *  generic object find within schema global scope
- *
- *  "name" [ OUT ] - returns list of overloaded objects if found
- *
- *  "type" [ OUT ] - returns object type id, e.g.:
- *    eDatatype, eTypeset, eFormat, eFunction, ePhysical, eTable, ...
- *
- *  "expr" [ IN ] - NUL terminated name expression identifying object
- *
- *  "ctx" [ IN ] - NUL terminated context string for evaluation,
- *  substitutes for filename in logging reports
- *
- *  "dflt" [ IN ] - if true, resolve default value
- *
- *  returns principal object identified. if NULL but "name" is not
- *  NULL, then the object was only partially identified.
- */
-const void *VSchemaFind ( const VSchema *self,
-    const SNameOverload **name, uint32_t *type,
-    const char *expr, const char *ctx, bool dflt );
-
-
-/* CacheIntrinsicTypeId
- *  for id-caching
- *
- *  reads id atomically from "cache" and returns if non-zero
- *
- *  otherwise retrieves type id by name lookup, and sets
- *  value atomically in "cache" before returning.
- */
-uint32_t VSchemaCacheIntrinsicTypeId ( const VSchema *self,
-    atomic32_t *cache, const char *typename );
-
-
-/* Marking
- */
-void VSchemaClearMark ( const VSchema *self );
-void VSchemaClearPhysMark ( const VSchema *self );
-void VSchemaTypeMark ( const VSchema *self, uint32_t type_id );
-
-
-/* ToText
- *  converts some object to textual representation
- */
-rc_t VSchemaToText ( struct VSchema const *self,
-    char *buff, size_t bsize, size_t *num_writ, const char *fmt, ... );
-
-#if _DEBUGGING
-/* ListSymtab
- *  lists contents of symbol table
- */
-void VSchemaListSymtab ( struct VSchema const *self );
-#endif
-
-
-/*--------------------------------------------------------------------------
- * SFormat
- *  describes a blob format
- */
-typedef struct SFormat SFormat;
-struct SFormat
-{
-    /* symbolic name */
-    struct KSymbol const *name;
-
-    /* superfmt - i.e. current fmt extends superfmt
-       implying that super can be decoded by current */
-    const SFormat *super;
-
-    /* format id */
-    uint32_t id;
-
-    /* marking */
-    bool marked;
-};
-
-/* Whack
- */
-#define SFormatWhack VectMbrWhack
-
-/* Find
- */
-SFormat *VSchemaFindFmtid ( const VSchema *self, uint32_t id );
-
-/* Mark
- */
-void CC SFormatClearMark ( void *item, void *ignore );
-void SFormatMark ( const SFormat *self );
-
-/* Dump
- *  dump "fmtdef", dump object
- */
-bool CC SFormatDefDump ( void *item, void *dumper );
-rc_t SFormatDump ( const SFormat *self, struct SDumper *d );
-
-
-/*--------------------------------------------------------------------------
- * SDatatype
- *  describes a registered datatype
- */
-enum
-{
-    /* these have been exported to <vdb/schema.h> */
-    ddBool = vtdBool,
-    ddUint = vtdUint,
-    ddInt = vtdInt,
-    ddFloat = vtdFloat,
-    ddAscii = vtdAscii,
-    ddUnicode = vtdUnicode
-};
-
-typedef struct SDatatype SDatatype;
-struct SDatatype
-{
-    /* symbolic name */
-    struct KSymbol const *name;
-
-    /* supertype */
-    const SDatatype *super;
-
-    /* special byte-swap function */
-    void ( * byte_swap ) ( void *dst, const void *src, uint64_t count );
-
-    /* type id */
-    uint32_t id;
-
-    /* number of parent elements, from declaration:
-       typedef super [ dim ] name; */
-    uint32_t dim;
-
-    /* element size, calculated as
-       super -> size * dim */
-    uint32_t size;
-
-    /* data domain */
-    uint16_t domain;
-
-    /* marking */
-    bool marked;
-};
-
-/* Whack
- */
-#define SDatatypeWhack VectMbrWhack
-
-/* IntrinsicDim
- */
-uint32_t SDatatypeIntrinsicDim ( const SDatatype *self );
-
-/* Find
- */
-SDatatype *VSchemaFindTypeid ( const VSchema *self, uint32_t id );
-
-/* Mark
- */
-void CC SDatatypeClearMark ( void *item, void *ignore );
-void SDatatypeMark ( const SDatatype *self );
-
-/* Dump
- */
-bool CC SDatatypeDefDump ( void *item, void *dumper );
-rc_t SDatatypeDump ( const SDatatype *self, struct SDumper *d );
-
-
-/*--------------------------------------------------------------------------
- * STypeset
- *  describes a set of typedecls
- */
-typedef struct STypeset STypeset;
-struct STypeset
-{
-    /* symbolic name */
-    struct KSymbol const *name;
-
-    /* typeset id */
-    uint32_t id;
-
-    /* marking */
-    bool marked;
-
-    /* fmtdecls */
-    uint16_t count;
-    VTypedecl td [ 1 ];
-};
-
-/* Whack
- */
-#define STypesetWhack VectMbrWhack
-
-/* Find
- */
-STypeset *VSchemaFindTypesetid ( const VSchema *self, uint32_t id );
-
-/* Mark
- */
-void CC STypesetClearMark ( void *item, void *ignore );
-void STypesetMark ( const STypeset *self, const VSchema *schema );
-
-/* Dump
- */
-bool CC STypesetDefDump ( void *item, void *dumper );
-rc_t STypesetDump ( const STypeset *self, struct SDumper *d );
-
-
-/*--------------------------------------------------------------------------
- * SIndirectType
- *  a parameterized typespec
- */
-typedef struct SIndirectType SIndirectType;
-struct SIndirectType
-{
-    /* symbolic name */
-    struct KSymbol const *name;
-
-    /* index into binding vector */
-    uint32_t type_id;
-
-    /* formal type id */
-    uint32_t id;
-
-    /* parameter position */
-    uint32_t pos;
-};
-
-/* Whack
- */
-void CC SIndirectTypeWhack ( void *item, void *ignore );
-
-/* Find
- */
-SIndirectType *VSchemaFindITypeid ( const VSchema *self, uint32_t id );
-
-/* Dump
- */
-rc_t SIndirectTypeDump ( const SIndirectType *self, struct SDumper *d );
-
-
-/*--------------------------------------------------------------------------
- * SConstant
- *  describes a symbolic constant
- */
-typedef struct SConstant SConstant;
-struct SConstant
-{
-    /* symbolic name */
-    struct KSymbol const *name;
-
-    /* value */
-    struct SExpression const *expr;
-
-    /* type */
-    VTypedecl td;
-
-    /* id */
-    uint32_t id;
-
-    /* marking */
-    bool marked;
-};
-
-/* Whack
- */
-void CC SConstantWhack ( void *item, void *ignore );
-
-/* Mark
- */
-void CC SConstantClearMark ( void *item, void *ignore );
-void SConstantMark ( const SConstant *self );
-
-/* Dump
- *  dump "const", dump object
- */
-bool CC SConstantDefDump ( void *item, void *dumper );
-rc_t SConstantDump ( const SConstant *self, struct SDumper *d );
-
-
-/*--------------------------------------------------------------------------
- * SIndirectConst
- *  a parameterized constant
- */
-typedef struct SIndirectConst SIndirectConst;
-struct SIndirectConst
-{
-    /* symbolic name */
-    struct KSymbol const *name;
-
-    /* formal typedecl or NULL if function */
-    struct SExpression const *td;
-
-    /* index into binding vector */
-    uint32_t expr_id;
-
-    /* offset position from # of indirect types */
-    uint32_t pos;
-};
-
-/* Whack
- */
-void CC SIndirectConstWhack ( void * item, void * ignore );
-
-/* Mark
- */
-void CC SIndirectConstMark ( void * item, void * data );
-
-/* Dump
- *  dump "const", dump object
- */
-bool CC SIndirectConstDefDump ( void *item, void *dumper );
-rc_t SIndirectConstDump ( const SIndirectConst *self, struct SDumper *d );
-
-
-/*--------------------------------------------------------------------------
- * SProduction
- *  a named production
- */
-typedef struct SProduction SProduction;
-struct SProduction
-{
-    /* symbolic name */
-    struct KSymbol const *name;
-
-    /* conditional expression */
-    struct SExpression const *expr;
-
-    /* formal fmtdecl */
-    struct SExpression const *fd;
-
-    /* contextual id */
-    VCtxId cid;
-
-    /* trigger production */
-    bool trigger;
-
-    /* control parameter */
-    bool control;
-};
-
-/* Whack
- */
-void CC SProductionWhack ( void * item, void * ignore );
-
-/* Mark
- */
-void CC SProductionMark ( void * itme, void * data );
-
-/* Dump
- *  dump production
- */
-bool CC SProductionDefDump ( void *item, void *dumper );
-rc_t SProductionDump ( const SProduction *self, struct SDumper *d );
-
-
-/*--------------------------------------------------------------------------
- * SFormParmlist
- *  zero or more formal parameters
- */
-typedef struct SFormParmlist SFormParmlist;
-struct SFormParmlist
-{
-    Vector parms;
-    uint16_t mand;
-    uint16_t vararg;
-};
-
-/* Whack
- */
-void SFormParmlistWhack ( SFormParmlist *self,
-    void ( CC * pwhack ) ( void*, void* ) );
-
-/* HasParams
- */
-#define SFormParmlistHasParams( self ) \
-    ( VectorLength ( & ( self ) -> parms ) != 0 || \
-      ( self ) -> varag != 0 )
-
-/* Mark
- */
-void SFormParmlistMark ( const SFormParmlist *self,
-    void ( CC * mark ) ( void*, void* ), const VSchema *schema );
-
-/* Dump
- *  dump param list
- */
-rc_t SFormParamlistDump ( const SFormParmlist *self, struct SDumper *d,
-    bool ( CC * dump ) ( void*, void* ),
-    const char *begin, const char *end, const char *empty );
-
-
-/*--------------------------------------------------------------------------
- * SFunction
- */
-typedef struct SFunction SFunction;
-struct SFunction
-{
-    /* symbolic name */
-    struct KSymbol const *name;
-
-    /* return type expression - NULL for untyped or row-length */
-    struct SExpression const *rt;
-
-    /* pointer to additional information */
-    union
-    {
-        struct
-        {
-            /* optional factory id */
-            struct KSymbol const *fact;
-
-        } ext;
-
-        struct
-        {
-            /* return statement conditional expression */
-            struct SExpression const *rtn;
-
-            /* schema productions */
-            Vector prod;
-
-            uint32_t align;
-
-        } script;
-
-    } u;
-
-    /* schema scope - i.e. indirect types and uint const */
-    BSTree sscope;
-
-    /* function scope - i.e. factory and func params, productions */
-    BSTree fscope;
-
-    /* factory parameters */
-    SFormParmlist fact;
-
-    /* function parameters */
-    SFormParmlist func;
-
-    /* schema types - indirect types, defined and owned by VSchema
-       held here for positional correlation */
-    Vector type;
-
-    /* declared version */
-    uint32_t version;
-
-    /* schema parameters - indirect uint constants */
-    Vector schem;
-
-    /* function id */
-    uint32_t id;
-
-    /* script or extern function */
-    bool script;
-
-    /* marking */
-    bool marked;
-
-    /* validate, untyped or row-length function */
-    bool validate;
-    bool untyped;
-    bool row_length;
-};
-
-/* Whack
- */
-void SFunctionDestroy ( SFunction *self );
-void CC SFunctionWhack ( void *self, void *ignore );
-
-/* Cmp
- * Sort
- */
-int CC SFunctionCmp ( const void *item, const void *n );
-int CC SFunctionSort ( const void *item, const void *n );
-
-/* Bind
- *  perform schema and factory param substitution
- *  returns prior param values
- */
-rc_t SFunctionBindSchemaParms ( const SFunction *self,
-    Vector *prior, const Vector *subst, Vector *cx_bind );
-rc_t SFunctionBindFactParms ( const SFunction *self,
-    Vector *parms, Vector *prior, const Vector *subst, Vector *cx_bind );
-
-/* Rest-ore
- *  restore schema and factory param substitution
- *  destroys prior param vector
- */
-void SFunctionRestSchemaParms ( const SFunction *self, Vector *prior, Vector *cx_bind );
-void SFunctionRestFactParms ( const SFunction *self, Vector *prior, Vector *cx_bind );
-
-/* Mark
- */
-void CC SFunctionClearMark ( void * self, void * ignore );
-void CC SFunctionMark ( void * item, void * data );
-void SFuncNameMark ( const SNameOverload *self, const VSchema *schema );
-
-/* Dump
- */
-rc_t SFunctionDeclDumpSchemaParms ( const SFunction *self, struct SDumper *d );
-rc_t SFunctionDeclDumpFactParms ( const SFunction *self, struct SDumper *d );
-bool CC SFunctionDeclDump ( void *item, void *dumper );
-rc_t SFunctionBodyDump ( const SFunction *self, struct SDumper *d );
-rc_t SFunctionDump ( const SFunction *self, struct SDumper *d );
-
-
-/*--------------------------------------------------------------------------
- * SPhysical
- *  physical column declaration
- */
-typedef struct SPhysical SPhysical;
-struct SPhysical
-{
-    /* symbolic name */
-    struct KSymbol const *name;
-
-    /* optional function for determining row length */
-    const SFunction *row_length;
-
-    /* encoding scripts */
-    SFunction encode, decode;
-
-    /* column type */
-    struct SExpression const *td;
-
-    /* required version */
-    uint32_t version;
-
-    /* physical decl id */
-    uint32_t id;
-
-    /* marking */
-    bool marked;
-
-    /* if only decode side exists */
-    bool read_only;
-
-    /* v0 blobs have no headers */
-    bool no_hdr;
-};
-
-/* Whack
- */
-void CC SPhysicalWhack ( void *self, void *ignore );
-
-/* Cmp
- * Sort
- */
-int CC SPhysicalCmp ( const void *item, const void *n );
-int CC SPhysicalSort ( const void *item, const void *n );
-
-/* Bind
- *  perform schema and factory param substitution
- *  returns prior param values
- */
-rc_t SPhysicalBindSchemaParms ( const SPhysical *self,
-    Vector *prior, const Vector *subst, Vector *cx_bind );
-rc_t SPhysicalBindFactParms ( const SPhysical *self,
-     Vector *parms, Vector *prior, const Vector *subst, Vector *cx_bind );
-
-/* Rest-ore
- *  restore schema and factory param substitution
- *  destroys prior param vector
- */
-void SPhysicalRestSchemaParms ( const SPhysical *self, Vector *prior, Vector *cx_bind );
-void SPhysicalRestFactParms ( const SPhysical *self, Vector *prior, Vector *cx_bind );
-
-/* Mark
- */
-void CC SPhysicalClearMark ( void * self, void * ignore );
-void CC SPhysicalMark ( void * item, void * data );
-void SPhysNameMark ( const SNameOverload *self, const VSchema *schema );
-
-/* Dump
- */
-bool CC SPhysicalDefDump ( void *self, void *data );
-rc_t SPhysicalDump ( const SPhysical *self, struct SDumper *d );
-
-
-/*--------------------------------------------------------------------------
- * STable
- *  table declaration
- */
-typedef struct STable STable;
-struct STable
-{
-    /* symbolic name */
-    struct KSymbol const *name;
-
-    /* optional function for determining table type */
-    const SFunction *untyped;
-
-    /* optional expression for limiting all columns' blob sizes */
-    struct SExpression const *limit;
-
-    /* optional default view declaration */
-    const String *dflt_view;
-
-    /* scope */
-    BSTree scope;
-
-    /* parents */
-    Vector parents;
-
-    /* overrides ( inherited virtual productions )
-       contents are grouped by introducing parent */
-    Vector overrides;
-
-    /* columns */
-    Vector col;
-    Vector cname;
-
-    /* explicitly declared physical column members */
-    Vector phys;
-
-    /* assignment statements */
-    Vector prod;
-
-    /* introduced virtual ( undefined ) productions
-       contents are unowned KSymbol pointers */
-    Vector vprods;
-
-    /* owned KSymbols that are not in scope */
-    Vector syms;
-
-    /* source file & line */
-    String src_file;
-    uint32_t src_line;
-
-    /* required version */
-    uint32_t version;
-
-    /* table id */
-    uint32_t id;
-
-    /* marking */
-    bool marked;
-};
-
-/* Whack
- */
-void CC STableWhack ( void *self, void *ignore );
-
-/* CloneExtend
- *  creates an initially transparent table extension
- *  used by cursor to permit addition of implicit productions
- */
-rc_t STableCloneExtend ( const STable *self, STable **clone, VSchema *schema );
-
-/* Cmp
- * Sort
- */
-int CC STableCmp ( const void *item, const void *n );
-int CC STableSort ( const void *item, const void *n );
-
-/* Find
- *  generic object find within table scope
- *
- *  "td" [ OUT, NULL OKAY ] - returns cast type expression
- *  if given or "any" if not
- *
- *  "name" [ OUT ] - returns list of overloaded objects if found
- *
- *  "type" [ OUT ] - returns object type id, e.g.:
- *    eDatatype, eTypeset, eFormat, eFunction, ePhysical, eTable, ...
- *
- *  "expr" [ IN ] - NUL terminated name expression identifying object
- *
- *  "ctx" [ IN ] - NUL terminated context string for evaluation,
- *  substitutes for filename in logging reports
- *
- *  "dflt" [ IN ] - if true, resolve default value
- *
- *  returns principal object identified. if NULL but "name" is not
- *  NULL, then the object was only partially identified.
- */
-const void *STableFind ( const STable *self,
-    const VSchema *schema, VTypedecl *td, const SNameOverload **name,
-    uint32_t *type, const char *expr, const char *ctx, bool dflt );
-
-
-/* FindOverride
- *  finds an inherited or introduced overridden symbol
- */
-struct KSymbol *STableFindOverride ( const STable *self, const VCtxId *cid );
-
-/* FindOrdAncestor
- *  finds a parent or grandparent by order
- */
-const STable *STableFindOrdAncestor ( const STable *self, uint32_t i );
-
-/* Mark
- */
-void CC STableClearMark ( void *self, void *ignore );
-/*
-void CC STableMark ( const STable *self, const VSchema *schema );
-*/
-void STableNameMark ( const SNameOverload *self, const VSchema *schema );
-
-/* Dump
- *  dump "table" { }
- */
-bool CC STableDefDump ( void *self, void *dumper );
-rc_t STableDump ( const STable *self, struct SDumper *d );
-
-rc_t VSchemaDumpTableName ( const VSchema *self, uint32_t mode, const STable *stbl,
-    rc_t ( CC * flush ) ( void *dst, const void *buffer, size_t bsize ), void *dst );
-rc_t VSchemaDumpTableDecl ( const VSchema *self, uint32_t mode, const STable *stbl,
-    rc_t ( CC * flush ) ( void *dst, const void *buffer, size_t bsize ), void *dst );
-
-
-/*--------------------------------------------------------------------------
- * SColumn
- *  column declaration
- */
-typedef struct SColumn SColumn;
-struct SColumn
-{
-    /* symbolic name */
-    struct KSymbol const *name;
-
-    /* read productions */
-    struct SExpression const *read;
-
-    /* validation productions */
-    struct SExpression const *validate;
-
-    /* page size limit */
-    struct SExpression const *limit;
-
-    /* physical type expression */
-    struct SExpression const *ptype;
-
-    /* typedecl */
-    VTypedecl td;
-
-    /* contextual id */
-    VCtxId cid;
-
-    /* if true, this column is default for name */
-    bool dflt;
-
-    /* if read-only, there must be a read expression */
-    bool read_only;
-
-    /* if no read or validate expression exists
-       and no corresponding physical member exists */
-    bool simple;
-};
-
-/* Whack
- */
-void CC SColumnWhack ( void *item, void *ignore );
-
-/* Cmp
- *  compare a const VTypedecl* against const SColumn*
- * Sort
- *  compare two const SColumn*
- */
-int CC SColumnCmp ( const void *item, const void *n );
-int CC SColumnSort ( const void *item, const void *n );
-
-
-/* ImplicitColMember
- *  adds an implicit column member of simple or incomplete type
- *
- *  "cname" [ IN ] - column name
- *
- *  "pname" [ IN ] - name of physical column
- */
-rc_t STableImplicitColMember ( STable *self,
-    struct String const *cname, struct String const *pname );
-
-/* Dump
- */
-bool CC SColumnDefDump ( void *item, void *dumper );
-rc_t SColumnDump ( const SColumn *self, struct SDumper *d );
-
-
-/*--------------------------------------------------------------------------
- * SPhysMember
- *  physical member
- */
-typedef struct SPhysMember SPhysMember;
-struct SPhysMember
-{
-    /* symbolic name */
-    struct KSymbol const *name;
-
-    /* column type expression */
-    struct SExpression const *type;
-
-    /* assignment expression */
-    struct SExpression const *expr;
-
-    /* column datatype */
-    VTypedecl td;
-
-    /* contextual id */
-    VCtxId cid;
-
-    /* if static, it is implemented in table metadata */
-    bool stat;
-
-    /* it simple, the member was implicitly declared */
-    bool simple;
-};
-
-/* Whack
- */
-void CC SPhysMemberWhack ( void *item, void *ignore );
-
-/* ImplicitPhysMember
- *  adds an implicit physical member of simple or incomplete type
- *
- *  "td" [ IN, NULL OKAY ] - type of member, if known
- *
- *  "sym" [ IN, NULL OKAY ] - optional symbol to be overridden
- *
- *  "name" [ IN ] - name of new symbol to be created if "sym" is NULL
- */
-rc_t STableImplicitPhysMember ( STable *self, const VTypedecl *td,
-    struct KSymbol *sym, struct String const *name );
-
-/* Mark
- */
-/*
-void CC SPhysMemberMark ( const SPhysMember *self, const VSchema *schema );
-*/
-
-/* Dump
- */
-bool CC SPhysMemberDefDump ( void *item, void *dumper );
-rc_t SPhysMemberDump ( const SPhysMember *self, struct SDumper *d );
-
-
-/*--------------------------------------------------------------------------
- * SDatabase
- *  database declaration
- */
-typedef struct SDatabase SDatabase;
-struct SDatabase
-{
-    /* symbolic name */
-    struct KSymbol const *name;
-
-    /* scope */
-    BSTree scope;
-
-    /* parents */
-    const SDatabase *dad;
-
-    /* databases */
-    Vector db;
-
-    /* tables */
-    Vector tbl;
-
-    /* required version */
-    uint32_t version;
-
-    /* database id */
-    uint32_t id;
-
-    /* marking */
-    bool marked;
-};
-
-/* Whack
- */
-void CC SDatabaseWhack ( void *self, void *ignore );
-
-/* Cmp
- * Sort
- */
-int CC SDatabaseCmp ( const void *item, const void *n );
-int CC SDatabaseSort ( const void *item, const void *n );
-
-/* Find
- *  generic object find within database scope
- *
- *  "name" [ OUT ] - returns list of overloaded objects if found
- *
- *  "type" [ OUT ] - returns object type id, e.g.:
- *    eDatatype, eTypeset, eFormat, eFunction, ePhysical, eTable, ...
- *
- *  "expr" [ IN ] - NUL terminated name expression identifying object
- *
- *  "ctx" [ IN ] - NUL terminated context string for evaluation,
- *  substitutes for filename in logging reports
- *
- *  returns principal object identified. if NULL but "name" is not
- *  NULL, then the object was only partially identified.
- */
-const void *SDatabaseFind ( const SDatabase *self,
-    const VSchema *schema, const SNameOverload **name,
-    uint32_t *type, const char *expr, const char *ctx );
-
-/* Mark
- */
-void CC SDatabaseClearMark ( void *self, void *ignore );
-void CC SDatabaseMark ( void * item, void * data );
-void CC SDatabaseNameMark ( const SNameOverload *self, const VSchema *schema );
-
-/* Dump
- *  dump "database" { }
- */
-bool CC SDatabaseDefDump ( void *self, void *dumper );
-rc_t SDatabaseDump ( const SDatabase *self, struct SDumper *d );
-
-
-/*--------------------------------------------------------------------------
- * STblMember
- *  table member
- */
-typedef struct STblMember STblMember;
-struct STblMember
-{
-    /* symbolic name */
-    struct KSymbol const *name;
-
-    /* table declaration */
-    const STable *tbl;
-
-    /* contextual id */
-    VCtxId cid;
-
-    /* is a template */
-    bool tmpl;
-};
-
-/* Whack
- */
-#define STblMemberWhack VectMbrWhack
-
-void CC STableMark ( void * item, void * data );
-
-/* Dump
- */
-bool CC STblMemberDefDump ( void *item, void *dumper );
-rc_t STblMemberDump ( const STblMember *self, struct SDumper *d );
-
-
-/*--------------------------------------------------------------------------
- * SDBMember
- *  sub-db member
- */
-typedef struct SDBMember SDBMember;
-struct SDBMember
-{
-    /* symbolic name */
-    struct KSymbol const *name;
-
-    /* database declaration */
-    const SDatabase *db;
-
-    /* contextual id */
-    VCtxId cid;
-
-    /* is a template */
-    bool tmpl;
-};
-
-/* Whack
- */
-#define SDBMemberWhack VectMbrWhack
-
-/* Dump
- */
-bool CC SDBMemberDefDump ( void *item, void *dumper );
-rc_t SDBMemberDump ( const SDBMember *self, struct SDumper *d );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_schema_priv_ */
diff --git a/libs/vdb/schema-prod.c b/libs/vdb/schema-prod.c
deleted file mode 100644
index c637b10..0000000
--- a/libs/vdb/schema-prod.c
+++ /dev/null
@@ -1,1004 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#include "schema-priv.h"
-#include "schema-parse.h"
-#include "schema-expr.h"
-#include "schema-dump.h"
-
-#include <klib/symbol.h>
-#include <klib/symtab.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * SProduction
- *  describes a schema production/statement
- */
-#if SLVL >= 3
-
-/* Whack
- */
-void CC SProductionWhack ( void *item, void *ignore )
-{
-    SProduction *s = item;
-    SExpressionWhack ( s -> expr );
-    SExpressionWhack ( s -> fd );
-    free ( s );
-}
-
-/* Mark
- */
-void CC SProductionMark ( void * item, void * data )
-{
-    const SProduction * self = item;
-    if ( self != NULL )
-    {
-        SExpressionMark ( ( void * )self -> fd, data );
-        SExpressionMark ( ( void * )self -> expr, data );
-    }
-}
-
-/* Dump
- *  dump production
- */
-rc_t SProductionDump ( const SProduction *self, struct SDumper *d )
-{
-    if ( self == NULL )
-        return KSymbolDump ( NULL, d );
-    if ( ! self -> control )
-        return KSymbolDump ( self -> name, d );
-    return SDumperPrint ( d, "control %N", self -> name );
-}
-
-bool CC SProductionDefDump ( void *item, void *data )
-{
-    SDumper *b = data;
-    const SProduction *self = ( const void* ) item;
-
-    /* function params are waiting for an expression */
-    if ( self -> expr == NULL )
-        b -> rc = SDumperPrint ( b, "%E %N", self -> fd, self -> name );
-    else
-    {
-        bool compact = SDumperMode ( b ) == sdmCompact ? true : false;
-        if ( self -> trigger )
-        {
-            b -> rc = SDumperPrint ( b, compact ? "trigger %N=%E;" : "\ttrigger %N = %E;\n"
-                                     , self -> name
-                                     , self -> expr );
-        }
-        else
-        {
-            b -> rc = SDumperPrint ( b, compact ? "%E %N=%E;" : "\t%E %N = %E;\n"
-                                     , self -> fd
-                                     , self -> name
-                                     , self -> expr );
-        }
-    }
-
-    return ( b -> rc != 0 ) ? true : false;
-}
-
-#endif
-
-
-/*--------------------------------------------------------------------------
- * SFunction
- *  describes a schema function
- */
-#if SLVL >= 4
-
-/* Dump
- */
-rc_t SFunctionBodyDump ( const SFunction *self, SDumper *b )
-{
-    bool compact = SDumperMode ( b ) == sdmCompact ? true : false;
-
-    if ( VectorLength ( & self -> u . script . prod ) == 0 )
-    {
-        b -> rc = SDumperPrint ( b, compact ?
-            "{return %E;}" : "\t{ return %E; }\n",
-            self -> u . script . rtn );
-    }
-    else
-    {
-        b -> rc = SDumperPrint ( b, compact ? "{" : "\t{\n" );
-        if ( b -> rc == 0 )
-        {
-            if ( ! compact )
-                SDumperIncIndentLevel ( b );
-            if ( ! VectorDoUntil ( & self -> u . script . prod, false, SProductionDefDump, b ) )
-                b -> rc = SDumperPrint ( b, compact ? "return %E;" : "\treturn %E;\n", self -> u . script . rtn );
-            if ( ! compact )
-                SDumperDecIndentLevel ( b );
-        }
-        if ( b -> rc == 0 )
-            b -> rc = SDumperPrint ( b, compact ? "}" : "\t}\n" );
-    }
-
-    return b -> rc;
-}
-
-#endif
-
-/*--------------------------------------------------------------------------
- * SPhysical
- */
-
-#if SLVL >= 5
-
-/* Whack
- */
-void CC SPhysicalWhack ( void *n, void *ignore )
-{
-    SPhysical *self = n;
-
-    /* if any schema or factory parameters were given, the objects
-       have been shared between encode and decode schema funcs, and
-       the schema names are also shared between funcs. wipe out the
-       encode copy and leave ownership with decode */
-    BSTreeInit ( & self -> encode . sscope );
-    VectorInit ( & self -> encode . fact . parms, 0, 1 );
-    VectorInit ( & self -> encode . type, 0, 1 );
-    VectorInit ( & self -> encode . schem, 0, 1 );
-
-    /* now allow normal destruction to proceed */
-    SFunctionDestroy ( & self -> encode );
-    SFunctionDestroy ( & self -> decode );
-    SExpressionWhack ( self -> td );
-
-    free ( self );
-}
-
-/* Cmp
- * Sort
- */
-int CC SPhysicalCmp ( const void *item, const void *n )
-{
-    const uint32_t *a = item;
-    const SPhysical *b = n;
-
-    if ( * a > b -> version )
-        return 1;
-    return ( int ) ( * a >> 24 ) - ( int ) ( b -> version >> 24 );
-}
-
-int CC SPhysicalSort ( const void *item, const void *n )
-{
-    const SPhysical *a = item;
-    const SPhysical *b = n;
-
-    return ( int ) ( a -> version >> 24 ) - ( int ) ( b -> version >> 24 );
-}
-
-/* Bind
- *  perform schema and factory param substitution
- *  returns prior param values
- */
-rc_t SPhysicalBindSchemaParms ( const SPhysical *self,
-    Vector *prior, const Vector *subst, Vector *cx_bind )
-{
-    return SFunctionBindSchemaParms ( & self -> decode, prior, subst, cx_bind );
-}
-
-rc_t SPhysicalBindFactParms ( const SPhysical *self,
-    Vector *parms, Vector *prior, const Vector *subst, Vector *cx_bind )
-{
-    return SFunctionBindFactParms ( & self -> decode, parms, prior, subst, cx_bind );
-}
-
-/* Rest-ore
- *  restore schema and factory param substitution
- *  destroys prior param vector
- */
-void SPhysicalRestSchemaParms ( const SPhysical *self, Vector *prior, Vector *cx_bind )
-{
-    SFunctionRestSchemaParms ( & self -> decode, prior, cx_bind );
-}
-
-void SPhysicalRestFactParms ( const SPhysical *self, Vector *prior, Vector *cx_bind )
-{
-    SFunctionRestFactParms ( & self -> decode, prior, cx_bind );
-}
-
-/* Mark
- */
-void CC SPhysicalClearMark ( void *item, void *ignore )
-{
-    SPhysical *self = item;
-    self -> marked = false;
-    self -> encode . marked = false;
-    self -> decode . marked = false;
-}
-
-void VSchemaClearPhysMark ( const VSchema *self )
-{
-    if ( self -> dad != NULL )
-        VSchemaClearPhysMark ( self -> dad );
-    VectorForEach ( & self -> phys, false, SPhysicalClearMark, NULL );
-}
-
-void CC SPhysicalMark ( void * item, void * data )
-{
-    SPhysical *self = item;
-    if ( self != NULL && ! self -> marked )
-    {
-        self -> marked = true;
-        SExpressionMark ( ( void * )self -> td, data );
-        SFunctionMark ( ( void * )& self -> encode, data );
-        SFunctionMark ( ( void * )& self -> decode, data );
-    }
-}
-
-void SPhysNameMark ( const SNameOverload *self, const VSchema *schema )
-{
-    if ( self != NULL )
-    {
-        VectorForEach ( & self -> items, false, SPhysicalMark, ( void* ) schema );
-    }
-}
-
-/* Dump
- */
-rc_t SPhysicalDump ( const SPhysical *self, SDumper *d )
-{
-    return FQNDump ( self != NULL ? self -> name : NULL, d );
-}
-
-bool CC SPhysicalDefDump ( void *n, void *data )
-{
-    SDumper *b = data;
-    const SPhysical *self = ( const void* ) n;
-    bool compact = SDumperMode ( b ) == sdmCompact ? true : false;
-
-    if ( SDumperMarkedMode ( b ) && ! self -> marked )
-        return false;
-
-    /* a physical column */
-    b -> rc = SDumperPrint ( b, "physical " );
-
-    /* could have schema parameters */
-    if ( b -> rc == 0 )
-        b -> rc = SFunctionDeclDumpSchemaParms ( & self -> decode, b );
-
-    /* issue __no_header for v0 encodings */
-    if ( b -> rc == 0 && self -> no_hdr )
-        b -> rc = SDumperPrint ( b, "__no_header " );
-
-    /* a return type expression followed by column typename */
-    if ( b -> rc == 0 )
-        b -> rc = SDumperPrint ( b, "%E %N", self -> td, self -> name );
-
-    /* versions are mandatory */
-    if ( b -> rc == 0 )
-        b -> rc = SDumperVersion ( b, self -> version );
-
-    /* could have factory parameters */
-    if ( b -> rc == 0 )
-        b -> rc = SFunctionDeclDumpFactParms ( & self -> decode, b );
-
-    /* physical body */
-    if ( b -> rc == 0 )
-    {
-        b -> rc = SDumperPrint ( b, compact ? "{" : "\n\t{\n" );
-        if ( b -> rc == 0 )
-        {
-            if ( ! compact )
-                SDumperIncIndentLevel ( b );
-
-            if ( self -> encode . u . script . rtn != NULL )
-            {
-                b -> rc = SDumperPrint ( b, compact ? "encode" : "\tencode\n" );
-                if ( b -> rc == 0 )
-                    b -> rc = SFunctionBodyDump ( & self -> encode, b );
-            }
-            if ( b -> rc == 0 )
-                b -> rc = SDumperPrint ( b, compact ? "decode" : "\tdecode\n" );
-            if ( b -> rc == 0 )
-                b -> rc = SFunctionBodyDump ( & self -> decode, b );
-
-            if ( ! compact )
-                SDumperDecIndentLevel ( b );
-        }
-        if ( b -> rc == 0 )
-            b -> rc = SDumperPrint ( b, compact ? "}" : "\t}\n" );
-    }
-
-    return ( b -> rc != 0 ) ? true : false;
-}
-
-#endif
-
-
-/*--------------------------------------------------------------------------
- * VSchema
- */
-
-#if SLVL >= 4
-
-/*
- * production-stmt    = <func-fmtdecl> ID <assign-expr>
- *                    | 'trigger' ID <assign-expr>
- */
-rc_t production_stmt ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, Vector *v, uint32_t ptype )
-{
-    rc_t rc;
-    String id;
-    KSymbol *sym;
-
-    SProduction *prod = malloc ( sizeof *prod );
-    if ( prod == NULL )
-    {
-        rc = RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-        return KTokenRCExplain ( t, klogInt, rc );
-    }
-
-    memset ( prod, 0, sizeof * prod );
-
-    /* look for trigger production */
-    if ( ptype == eTable && t -> id == kw_trigger )
-    {
-        prod -> trigger = true;
-        next_token ( tbl, src, t );
-    }
-    else
-    {
-        KToken t2 = * t;
-
-        /* variable type */
-        rc = type_expr ( tbl, src, t, env, self, & prod -> fd );
-        if ( rc != 0 )
-        {
-            free ( prod );
-            return KTokenExpected ( t, klogErr, "type declaration" );
-        }
-
-        /* disallow formatted types within table */
-        if ( ptype == eTable && ( ( const STypeExpr* ) prod -> fd ) -> fmt != NULL )
-        {
-            SExpressionWhack ( prod -> fd );
-            free ( prod );
-            return KTokenExpected ( & t2, klogErr, "unformatted type declaration" );
-        }
-    }
-
-    /* catch defined identifiers */
-    if ( t -> sym != NULL && t -> id != eForward && t -> id != eVirtual )
-    {
-        /* if this is not a table or the symbol is not a production */
-        if ( ptype != eTable || t -> id != eProduction )
-        {
-            /* re-interpret this token in schema and intrinsic scopes */
-            KTokenSourceReturn ( src, t );
-            next_shallow_token ( tbl, src, t, true );
-        }
-    }
-
-    /* require an identifier or a forward reference */
-    sym = NULL;
-    if ( t -> id == eForward || t -> id == eVirtual )
-        sym = t -> sym;
-    else if ( t -> id != eIdent )
-    {
-        SProductionWhack ( prod, NULL );
-        return KTokenExpected ( t, klogErr, "production name" );
-    }
-
-    /* remember identifier */
-    id = t -> str;
-
-    /* within the production, only '=' is accepted for assignment
-       this could certainly change in the future... */
-    if ( next_token ( tbl, src, t ) -> id != eAssign )
-    {
-        SProductionWhack ( prod, NULL );
-        return KTokenExpected ( t, klogErr, "=" );
-    }
-
-    /* parse conditional expression */
-    rc = cond_expr ( tbl, src, next_token ( tbl, src, t ),
-        env, self, & prod -> expr );
-    if ( rc == 0 )
-    {
-        /* create symbolic name for production and insert */
-        if ( sym == NULL )
-            rc = KSymTableCreateConstSymbol ( tbl, & prod -> name, & id, eProduction, prod );
-        else
-        {
-            /* convert forward reference or virtual to production */
-            sym -> type = eProduction;
-            sym -> u . obj = prod;
-            prod -> name = sym;
-        }
-        if ( rc == 0 )
-        {
-            /* ctx = 0 for params, ctx == 1 for productions */
-            prod -> cid . ctx = 1;
-            rc = VectorAppend ( v, & prod -> cid . id, prod );
-        }
-        if ( rc != 0 )
-            KTokenRCExplain ( t, klogInt, rc );
-    }
-
-    /* cleanup */
-    if ( rc != 0 )
-        SProductionWhack ( prod, NULL );
-
-    return rc;
-}
-
-/*
- * schema-stmt        = 'return' <cond-expr>
- *                    | <production-stmt>
- */
-static
-rc_t script_stmt ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, SFunction *f )
-{
-    rc_t rc;
-
-    if ( t -> id == kw_return )
-    {
-        /* disallow multiple return statements */
-        if ( f -> u . script . rtn != NULL )
-        {
-            rc = RC ( rcVDB, rcSchema, rcParsing, rcToken, rcExists );
-            return KTokenRCExplain ( t, klogErr, rc );
-        }
-
-        /* just get a conditional expression */
-        rc = cond_expr ( tbl, src, next_token ( tbl, src, t ),
-            env, self, & f -> u . script . rtn );
-    }
-    else
-    {
-        rc = production_stmt ( tbl, src, t, env, self,
-            & f -> u . script . prod, eScriptFunc );
-    }
-
-    if ( rc == 0 )
-        rc = expect ( tbl, src, t, eSemiColon, ";", true );
-
-    return rc;
-}
-
-
-/*
- * schema-body        = '{' <script-stmts> '}'
- *
- * script-stmts       = <script-stmt> ';' [ <script-stmts> ]
- */
-static
-rc_t schema_body ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, SFunction *f )
-{
-    /* always open braces */
-    rc_t rc = expect ( tbl, src, t, eLeftCurly, "{", true );
-    if ( rc != 0 )
-        return rc;
-
-    /* expect at least one statement */
-    rc = script_stmt ( tbl, src, t, env, self, f );
-    if ( rc != 0 )
-        return rc;
-
-    /* handle statement list */
-    while ( t -> id != eRightCurly )
-    {
-        rc = script_stmt ( tbl, src, t, env, self, f );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    /* must have a return statement */
-    if ( f -> u . script . rtn  == NULL )
-        return KTokenExpected ( t, klogErr, "return statement" );
-
-    /* looks like a script function */
-    f -> script = true;
-
-    /* close braces */
-    return expect ( tbl, src, t, eRightCurly, "}", true );
-}
-
-static
-bool CC script_prod_syntax ( void *item, void *data )
-{
-    rc_t *rc = data;
-    SProduction *prod = item;
-
-    assert ( prod -> name != NULL );
-    assert ( prod -> name -> type == eProduction );
-
-    * rc = eval_expr_syntax ( prod -> fd );
-    if ( * rc == 0 )
-        * rc = eval_expr_syntax ( prod -> expr );
-
-    return ( * rc != 0 ) ? true : false;
-}
-
-static
-bool CC script_sym_syntax ( BSTNode *n, void *data )
-{
-    rc_t *rc = data;
-    KSymbol *sym = ( KSymbol* ) n;
-
-    if ( sym -> type == eForward )
-    {
-        * rc = RC ( rcVDB, rcSchema, rcParsing, rcName, rcUndefined );
-        return true;
-    }
-
-    return false;
-}
-
-static
-rc_t script_syntax ( const VSchema *self, SFunction *f )
-{
-    rc_t rc = eval_expr_syntax ( f -> u . script . rtn );
-    if ( rc == 0 )
-    {
-        BSTreeDoUntil ( & f -> fscope,
-            false, script_sym_syntax, & rc );
-    }
-    if ( rc == 0 )
-        VectorDoUntil ( & f -> u . script . prod, false, script_prod_syntax, & rc );
-    return rc;
-}
-
-/*
- * script-body        = '{' <script-stmts> '}'
- */
-rc_t script_body ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, SFunction *f )
-{
-    /* enter schema scope */
-    rc_t rc = KSymTablePushScope ( tbl, & f -> sscope );
-    if ( rc != 0 )
-        KTokenRCExplain ( t, klogInt, rc );
-    else
-    {
-        /* enter function scope */
-        rc = KSymTablePushScope ( tbl, & f -> fscope );
-        if ( rc != 0 )
-            KTokenRCExplain ( t, klogInt, rc );
-        else
-        {
-            /* parse '{' statements; '}' */
-            VectorInit ( & f -> u . script . prod, 0, 8 );
-            rc = schema_body ( tbl, src, t, env, self, f );
-
-            /* leave function scope */
-            KSymTablePopScope ( tbl );
-        }
-
-        /* leave schema scope */
-        KSymTablePopScope ( tbl );
-    }
-
-    if ( rc == 0 )
-        rc = script_syntax ( self, f );
-
-    return rc;
-}
-
-#endif /* SLVL >= 4 */
-
-#if SLVL >= 5
-
-static
-rc_t rowlen_func_expr ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, SPhysical *p )
-{
-    const SNameOverload *name;
-
-    /* expecting a function assignment */
-    rc_t rc = expect ( tbl, src,
-        next_token ( tbl, src, t ), eAssign, "=", true );
-    if ( rc == 0 )
-        rc = next_fqn ( tbl, src, t, env );
-    if ( rc != 0 )
-        return rc;
-    if ( t -> id != eRowLengthFunc )
-        return KTokenExpected ( t, klogErr, "row length function expression" );
-    name = t -> sym -> u . obj;
-
-    rc = expect ( tbl, src,
-        next_token ( tbl, src, t ), eLeftParen, "(", true );
-    if ( rc == 0 )
-        rc = expect ( tbl, src, t, eRightParen, ")", true );
-    if ( rc == 0 )
-        rc = expect ( tbl, src, t, eSemiColon, ";", true );
-
-    if ( rc == 0 )
-    {
-        p -> row_length = VectorLast ( & name -> items );
-        if ( p -> row_length == NULL )
-        {
-            rc = RC ( rcVDB, rcSchema, rcParsing, rcFunction, rcNotFound );
-            KTokenRCExplain ( t, klogErr, rc );
-        }
-    }
-
-    return rc;
-}
-
-/*
- * physical-stmt      = 'encode' <script-body>
- *                    | 'decode' <script-body>
- */
-static
-rc_t physical_stmt ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, SPhysical *p, bool encoding )
-{
-    rc_t rc;
-    String symstr;
-    SFunction *f = encoding ? & p -> encode : & p -> decode;
-
-    /* simulate a schema function signature */
-    SProduction *parm = malloc ( sizeof * parm );
-    if ( parm == NULL )
-    {
-        rc = RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-        return KTokenRCExplain ( t, klogInt, rc );
-    }
-    memset ( parm, 0, sizeof * parm );
-    VectorInit ( & f -> func . parms, 0, 1 );
-    rc = VectorAppend ( & f -> func . parms, & parm -> cid . id, parm );
-    if ( rc != 0 )
-    {
-        free ( parm );
-        return KTokenRCExplain ( t, klogInt, rc );
-    }
-
-    /* enter schema scope */
-    rc = KSymTablePushScope ( tbl, & f -> sscope );
-    if ( rc != 0 )
-        KTokenRCExplain ( t, klogInt, rc );
-    else
-    {
-        /* enter param scope */
-        rc = KSymTablePushScope ( tbl, & f -> fscope );
-        if ( rc != 0 )
-            KTokenRCExplain ( t, klogInt, rc );
-        else
-        {
-            /* create special input symbol */
-            CONST_STRING ( & symstr, "@" );
-            rc = KSymTableCreateConstSymbol ( tbl, & parm -> name,
-                & symstr, eFuncParam, parm );
-            if ( rc != 0 )
-                KTokenRCExplain ( t, klogInt, rc );
-            else
-            {
-                VectorInit ( & f -> u . script . prod, 0, 8 );
-                rc = schema_body ( tbl, src, t, env, self, f );
-            }
-
-            /* exit param scope */
-            KSymTablePopScope ( tbl );
-        }
-
-        /* exit schema scope */
-        KSymTablePopScope ( tbl );
-    }
-
-    return rc;
-}
-
-/*
- * physical-decl      = 'physical' [ 'column' ] <typedecl>
- *                       <fqn> '#' <maj-min-rel> <phys-body>
- * phys-body          =  '{' <physical-stmts> '}'
- * physical-stmt      = 'encode' <script-body>
- *                    | 'decode' <script-body>
- *                    | '__row_length = <func-expr>
- *                    | ';'
- */
-static
-rc_t physical_decl ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, SPhysical *p )
-{
-    rc_t rc;
-    const char *expected;
-
-    /* could have schema parameters */
-    if ( t -> id == eLeftAngle )
-    {
-        /* enter schema param scope */
-        rc = KSymTablePushScope ( tbl, & p -> decode . sscope );
-        if ( rc != 0 )
-            return KTokenRCExplain ( t, klogInt, rc );
-
-        /* parse schema params */
-        rc = schema_signature ( tbl, src, t, env, self, & p -> decode );
-
-        /* copy schema parameters to encode function
-           NB - must be cleared before destruction */
-        p -> encode . sscope = p -> decode . sscope;
-        p -> encode . type = p -> decode . type;
-        p -> encode . schem = p -> decode. schem;
-
-        /* interpret return type within schema param scope */
-        if ( rc == 0 )
-        {
-            rc = type_expr ( tbl, src, t, env, self, & p -> td );
-            if ( rc != 0 )
-                KTokenFailure ( t, klogErr, rc, "column typedecl" );
-        }
-
-        /* pop scope */
-        KSymTablePopScope ( tbl );
-
-        /* bail on problems */
-        if ( rc != 0 )
-            return rc;
-
-        /* "t" contains a lookahead token. while unlikely,
-           it could have matched something defined in schema
-           param scope. re-evaluate if possible */
-        if ( t -> sym != NULL ) switch ( t -> sym -> type )
-        {
-        case eSchemaType:
-        case eSchemaParam:
-            KTokenSourceReturn ( src, t );
-            next_token ( tbl, src, t );
-            break;
-        }
-    }
-    else
-    {
-        /* allow v0 columns to be declared with no blob header */
-        if ( t -> id == kw___no_header )
-        {
-            p -> no_hdr = true;
-            next_token ( tbl, src, t );
-        }
-
-        /* get column type expression */
-        rc = type_expr ( tbl, src, t, env, self, & p -> td );
-        if ( rc != 0 )
-            return KTokenExpected ( t, klogErr, "column typedecl" );
-    }
-
-    /* expect fully-qualified name */
-    rc = create_fqn ( tbl, src, t, env, ePhysical, NULL );
-    if ( rc != 0 && GetRCState ( rc ) != rcExists )
-        return KTokenFailure ( t, klogErr, rc, "column typename" );
-    p -> name = t -> sym;
-
-    /* must have a version */
-    if ( next_token ( tbl, src, t ) -> id != eHash )
-        return KTokenExpected ( t, klogErr, "#" );
-    next_token ( tbl, src, t );
-    rc = maj_min_rel ( tbl, src, t, env, self, & p -> version, false );
-    if ( rc != 0 )
-        return rc;
-
-    /* factory params */
-    if ( t -> id == eLeftAngle )
-    {
-        rc = KSymTablePushScope ( tbl, & p -> decode . sscope );
-        if ( rc != 0 )
-            return KTokenRCExplain ( t, klogInt, rc );
-        rc = KSymTablePushScope ( tbl, & p -> decode . fscope );
-        if ( rc != 0 )
-            KTokenRCExplain ( t, klogInt, rc );
-        else
-        {
-            rc = fact_signature ( tbl, src, t, env, self, & p -> decode . fact );
-            if ( rc == 0 )
-            {
-                /* copy factory parameters to encode function
-                   NB - must be cleared before destruction */
-                p -> encode . fact = p -> decode . fact;
-
-                /* clone factory parameter symbols */
-                if ( BSTreeDoUntil ( & p -> decode . fscope, false, KSymbolCopyScope, & p -> encode . fscope ) )
-                    rc = RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-            }
-
-            KSymTablePopScope ( tbl );
-        }
-
-        KSymTablePopScope ( tbl );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    /* allow shorthand for decode-only */
-    if ( t -> id == eAssign )
-    {
-        next_token ( tbl, src, t );
-        rc = physical_stmt ( tbl, src, t, env, self, p, false );
-        if ( rc == 0 )
-            p -> read_only = true;
-        return rc;
-    }
-
-    /* open body */
-    rc = expect ( tbl, src, t, eLeftCurly, "{", true );
-    if ( rc != 0 )
-        return rc;
-
-    /* gather both parts */
-    expected = p -> no_hdr ? "decode" : "decode or encode";
-    while ( t -> id != eRightCurly )
-    {
-        if ( t -> id == eSemiColon )
-            next_token ( tbl, src, t );
-        else if ( t -> id == kw_decode && p -> decode . u . script . rtn == NULL )
-        {
-            next_token ( tbl, src, t );
-            rc = physical_stmt ( tbl, src, t, env, self, p, false );
-            if ( rc != 0 )
-                return rc;
-            expected = ( p -> encode . u . script . rtn == NULL ) ? "encode" : "}";
-        }
-        else if ( t -> id == kw_encode && p -> encode . u . script . rtn == NULL && ! p -> no_hdr )
-        {
-            next_token ( tbl, src, t );
-            rc = physical_stmt ( tbl, src, t, env, self, p, true );
-            if ( rc != 0 )
-                return rc;
-            expected = ( p -> decode . u . script . rtn == NULL ) ? "decode" : "}";
-        }
-        else if ( t -> id == kw___row_length && p -> row_length == NULL && p -> no_hdr )
-        {
-            rc = rowlen_func_expr ( tbl, src, t, env, self, p );
-            if ( rc != 0 )
-                return rc;
-        }
-        else
-        {
-            return KTokenExpected ( t, klogErr, expected );
-        }
-    }
-
-    /* must have at least a decoding */
-    if ( p -> decode . u . script . rtn == NULL )
-        return KTokenExpected ( t, klogErr, "decode" );
-
-    /* close */
-    rc = expect ( tbl, src, t, eRightCurly, "}", true );
-    if ( rc == 0 )
-    {
-        /* detect read-only decl */
-        if ( p -> encode . u . script . rtn == NULL )
-            p -> read_only = true;
-        else
-        {
-            /* patch up input parameter to encoding */
-            SProduction *parm = VectorGet ( & p -> encode . func . parms, 0 );
-            assert ( parm != NULL );
-            parm -> fd = p -> td;
-            atomic32_inc ( & ( ( SExpression* ) p -> td ) -> refcount );
-        }
-    }
-
-    return rc;
-}
-
-static
-void init_function ( SFunction *f )
-{
-    memset ( f, 0, sizeof * f );
-    f -> script = true;
-}
-
-rc_t physical_declaration ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self )
-{
-    rc_t rc;
-    void *ignore;
-
-    SPhysical *p = malloc ( sizeof * p );
-    if ( p == NULL )
-    {
-        rc = RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-        return KTokenRCExplain ( t, klogInt, rc );
-    }
-
-    p -> name = NULL;
-    p -> row_length = NULL;
-    init_function ( & p -> encode );
-    init_function ( & p -> decode );
-    p -> td = NULL;
-    p -> read_only = false;
-    p -> no_hdr = false;
-
-    if ( t -> id == kw_column )
-        next_token ( tbl, src, t );
-
-    rc = physical_decl ( tbl, src, t, env, self, p );
-    if ( rc == 0 )
-    {
-        SNameOverload *name = ( void* ) p -> name -> u . obj;
-        if ( name == NULL )
-        {
-            rc = SNameOverloadMake ( & name, p -> name, 0, 8 );
-            if ( rc == 0 )
-            {
-                rc = VectorAppend ( & self -> pname, & name -> cid . id, name );
-                if ( rc != 0 )
-                    SNameOverloadWhack ( name, NULL );
-            }
-        }
-
-        if ( rc == 0 )
-        {
-            rc = VectorAppend ( & self -> phys, & p -> id, p );
-            if ( rc == 0 )
-            {
-                uint32_t idx;
-                rc = VectorInsertUnique ( & name -> items, p, & idx, SPhysicalSort );
-                if ( rc == 0 )
-                    return 0;
-                if ( GetRCState ( rc ) != rcExists )
-                    VectorSwap ( & self -> phys, p -> id, NULL, & ignore );
-                else
-                {
-                    SPhysical *exist = VectorGet ( & name -> items, idx );
-                    if ( p -> version > exist -> version )
-                    {
-                        VectorSwap ( & name -> items, idx, p, & ignore );
-                        if ( ( const void* ) name != exist -> name -> u . obj )
-                            return 0;
-                        assert ( exist -> id >= VectorStart ( & self -> phys ) );
-                        assert ( exist -> id < p -> id );
-                        VectorSwap ( & self -> phys, p -> id, NULL, & ignore );
-                        VectorSwap ( & self -> phys, p -> id = exist -> id, p, & ignore );
-                        p = exist;
-                    }
-
-                    /* exists is not an error */
-                    rc = 0;
-                }
-
-                VectorSwap ( & self -> phys, p -> id, NULL, & ignore );
-            }
-        }
-    }
-    else if ( GetRCState ( rc ) == rcExists )
-    {
-        rc = 0;
-    }
-    
-    SPhysicalWhack ( p, NULL );
-
-    return rc;
-}
-
-#endif /* SLVL >= 5 */
diff --git a/libs/vdb/schema-tbl.c b/libs/vdb/schema-tbl.c
deleted file mode 100644
index 2a0be41..0000000
--- a/libs/vdb/schema-tbl.c
+++ /dev/null
@@ -1,2928 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#include "schema-priv.h"
-#include "schema-parse.h"
-#include "schema-expr.h"
-#include "schema-dump.h"
-#include "dbmgr-priv.h"
-
-#include <klib/symbol.h>
-#include <klib/log.h>
-#include <klib/debug.h>
-#include <klib/rc.h>
-#include <klib/namelist.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-
-/* if non-zero, accept a typeset or a typedecl
-   for column. otherwise, only allow a typedecl */
-#define ALLOW_COLUMN_TYPESET 1
-
-/* make implicit physical expressions explicit on output */
-#define DUMP_EXPLICIT_PHYS_MEMBERS 0
-
-/* temporary v1 schema modification */
-#define ALLOW_DEFAULT_VIEW_DECL 1
-
-
-/*--------------------------------------------------------------------------
- * SColumn
- *  column declaration
- */
-
-#if SLVL >= 8
-
-/* Whack
- */
-void CC SColumnWhack ( void *item, void *ignore )
-{
-    SColumn *self = item;
-    SExpressionWhack ( self -> read );
-    SExpressionWhack ( self -> validate );
-    SExpressionWhack ( self -> limit );
-    SExpressionWhack ( self -> ptype );
-    free ( self );
-}
-
-/* Cmp
- * Sort
- */
-int CC SColumnCmp ( const void *item, const void *n )
-{
-    const VTypedecl *a = item;
-    const SColumn *b = n;
-
-    if ( a -> type_id != b -> td . type_id )
-        return ( int ) a -> type_id - ( int ) b -> td . type_id;
-    return ( int ) a -> dim - ( int ) b -> td . dim;
-}
-
-int CC SColumnSort ( const void *item, const void *n )
-{
-    const SColumn *a = item;
-    const SColumn *b = n;
-
-    if ( a -> td . type_id != b -> td . type_id )
-        return ( int ) a -> td . type_id - ( int ) b -> td . type_id;
-    return ( int ) a -> td . dim - ( int ) b -> td . dim;
-}
-
-/* Mark
- */
-static
-void CC SColumnMark ( void * item, void * data )
-{
-    const SColumn *self = item;
-    VSchema * schema = data;
-    if ( self != NULL )
-    {
-        SExpressionMark ( ( void * )self -> read, data );
-        SExpressionMark ( ( void * )self -> validate, data );
-        SExpressionMark ( ( void * )self -> limit, data );
-        VSchemaTypeMark ( schema, self -> td . type_id );
-    }
-}
-
-/* Dump
- */
-rc_t SColumnDump ( const SColumn *self, SDumper *d )
-{
-    return KSymbolDump ( self != NULL ? self -> name : NULL, d );
-}
-
-static
-rc_t SColumnDumpExpr ( SDumper *d, const SExpression *e )
-{
-    rc_t rc;
-    const SBinExpr *c;
-    bool compact = SDumperMode ( d ) == sdmCompact ? true : false;
-
-    if ( e -> var != eCondExpr )
-        return SDumperPrint ( d, compact ? "=%E;" : " = %E;\n", e );
-
-    c = ( const SBinExpr* ) e;
-
-    if ( ! compact )
-        SDumperIncIndentLevel ( d );
-    rc = SDumperPrint ( d, compact ? "=%E" : "\n\t= %E\n", c -> left );
-    while ( rc == 0 )
-    {
-        if ( c -> right -> var != eCondExpr )
-            break;
-        c = ( const SBinExpr* ) c -> right;
-        rc = SDumperPrint ( d, compact ? "|%E" : "\n\t| %E\n", c -> left );
-    }
-
-    rc = SDumperPrint ( d, compact ? "|%E" : "\n\t| %E\n", c -> right );
-    if ( ! compact )
-        SDumperDecIndentLevel ( d );
-    return rc;
-}
-
-bool CC SColumnDefDump ( void *item, void *data )
-{
-    SDumper *b = data;
-    const SColumn *self = ( const void* ) item;
-    bool compact = SDumperMode ( b ) == sdmCompact ? true : false;
-
-    /* handle simple cases first */
-    if ( self -> validate == NULL && self -> limit == NULL )
-    {
-        /* simple */
-#if ! DUMP_EXPLICIT_PHYS_MEMBERS
-        if ( self -> simple )
-        {
-            if ( self -> ptype != NULL )
-            {
-                b -> rc = SDumperPrint ( b, compact ? "column %E %N;" : "\tcolumn %E %N;\n"
-                                         , self -> ptype
-                                         , self -> name
-                    );
-            }
-            else
-            {
-                b -> rc = SDumperPrint ( b, compact ? "column %T %N;" : "\tcolumn %T %N;\n"
-                                         , & self -> td
-                                         , self -> name
-                    );
-            }
-        }
-        else
-#endif
-        {
-            assert ( self -> read != NULL );
-            b -> rc = SDumperPrint ( b, compact ? "%s%scolumn %T %N = %E;" : "\t%s%scolumn %T %N = %E;\n"
-                                     , self -> dflt ? "default " : ""
-                                     , self -> read_only ? "readonly " : ""
-                                     , & self -> td
-                                     , self -> name
-                                     , self -> read
-                );
-        }
-    }
-
-    /* canonical representation */
-    else
-    {
-#if ! DUMP_EXPLICIT_PHYS_MEMBERS
-        if ( self -> ptype != NULL )
-        {
-            b -> rc = SDumperPrint ( b, compact ? "%scolumn %E %N{" : "\t%scolumn %E %N\n\t{\n"
-                                     , self -> dflt ? "default " : ""
-                                     , self -> ptype
-                                     , self -> name
-                );
-        }
-        else
-#endif
-        {
-            b -> rc = SDumperPrint ( b, compact ? "%s%scolumn %T %N{" : "\t%s%scolumn %T %N\n\t{\n"
-                                     , self -> dflt ? "default " : ""
-                                     , self -> read_only ? "readonly " : ""
-                                     , & self -> td
-                                     , self -> name
-                );
-        }
-        if ( b -> rc == 0 )
-        {
-            if ( ! compact )
-                SDumperIncIndentLevel ( b );
-
-#if DUMP_EXPLICIT_PHYS_MEMBERS
-            if ( self -> read != NULL )
-#else
-            if ( ! self -> simple && self -> read != NULL )
-#endif
-            {
-                b -> rc = SDumperPrint ( b, compact ? "read" : "\tread" );
-                if ( b -> rc == 0 )
-                    b -> rc = SColumnDumpExpr ( b, self -> read );
-            }
-
-            if ( b -> rc == 0 && self -> validate != NULL )
-            {
-                b -> rc = SDumperPrint ( b, compact ? "validate" : "\tvalidate" );
-                if ( b -> rc == 0 )
-                    b -> rc = SColumnDumpExpr ( b, self -> validate );
-            }
-
-            if ( b -> rc == 0 && self -> limit != NULL )
-                b -> rc = SDumperPrint ( b, compact ? "limit = %E;" : "\tlimit = %E;\n", self -> limit );
-
-            if ( ! compact )
-                SDumperDecIndentLevel ( b );
-        }
-        if ( b -> rc == 0 )
-            b -> rc = SDumperPrint ( b, compact ? "}" : "\t}\n" );
-    }
-
-    return ( b -> rc != 0 ) ? true : false;
-}
-
-#endif
-
-
-/*--------------------------------------------------------------------------
- * SPhysMember
- *  column declaration
- */
-
-#if SLVL >= 7
-
-/* Whack
- */
-void CC SPhysMemberWhack ( void *item, void *ignore )
-{
-    SPhysMember *self = item;
-
-    SExpressionWhack ( self -> type );
-    SExpressionWhack ( self -> expr );
-    free ( self );
-}
-
-/* Mark
- */
-void CC SPhysMemberMark ( void * item, void * data )
-{
-    const SPhysMember * self = item;
-    const VSchema * schema = data;
-    if ( self != NULL )
-    {
-        SExpressionMark ( ( void * )self -> type, data );
-        SExpressionMark ( ( void * )self -> expr, data );
-        VSchemaTypeMark ( schema, self -> td . type_id );
-    }
-}
-
-/* Dump
- */
-rc_t SPhysMemberDump ( const SPhysMember *self, struct SDumper *d )
-{
-    return FQNDump ( self != NULL ? self -> name : NULL, d );
-}
-
-bool CC SPhysMemberDefDump ( void *item, void *data )
-{
-    SDumper *b = data;
-    const SPhysMember *self = ( const void* ) item;
-    bool compact = SDumperMode ( b ) == sdmCompact ? true : false;
-
-#if ! DUMP_EXPLICIT_PHYS_MEMBERS
-    if ( self -> simple )
-        return false;
-#endif
-
-    b -> rc = SDumperPrint ( b, compact ? "%s column " : "\t%s column "
-                             , self -> stat ? "static" : "physical"
-        );
-    if ( b -> rc == 0 )
-    {
-        if ( self -> type != NULL )
-            b -> rc = SExpressionDump ( self -> type, b );
-        else
-            b -> rc = SDumperPrint ( b, "%T", & self -> td );
-    }
-    if ( b -> rc == 0 )
-    {
-        if ( compact )
-        {
-            if ( self -> expr == NULL )
-                b -> rc = SDumperPrint ( b, " %N;", self -> name );
-            else
-                b -> rc = SDumperPrint ( b, " %N=%E;", self -> name, self -> expr );
-        }
-        else
-        {
-            if ( self -> expr == NULL )
-                b -> rc = SDumperPrint ( b, " %N;\n", self -> name );
-            else
-                b -> rc = SDumperPrint ( b, " %N = %E;\n", self -> name, self -> expr );
-        }
-    }
-
-    return ( b -> rc != 0 ) ? true : false;
-}
-
-#endif
-
-/*--------------------------------------------------------------------------
- * STableOverrides
- *  describes extended parent
- */
-
-#if SLVL >= 6
-typedef struct STableOverrides STableOverrides;
-struct STableOverrides
-{
-    const STable *dad;
-    Vector overrides;
-    uint32_t ctx;
-};
-
-/* Cmp
- * Sort
- */
-static
-int CC STableOverridesCmp ( const void *item, const void *n )
-{
-    const uint32_t *a = item;
-    const STableOverrides *b = n;
-
-    return ( int ) * a - ( int ) b -> ctx;
-}
-
-static
-int CC STableOverridesSort ( const void *item, const void *n )
-{
-    const STableOverrides *a = item;
-    const STableOverrides *b = n;
-
-    return ( int ) a -> ctx - ( int ) b -> ctx;
-}
-
-static
-int CC STableOverridesKSort ( const void **item, const void **n, void *ignore )
-{
-    return STableOverridesSort ( * item, * n );
-}
-
-/* Whack
- */
-static
-void CC STableOverridesWhack ( void *item, void *ignore )
-{
-    STableOverrides *self = item;
-    VectorWhack ( & self -> overrides, NULL, NULL );
-    free ( self );
-}
-
-/* Make
- */
-static
-rc_t STableOverridesMake ( Vector *parents, const STable *dad, const Vector *overrides )
-{
-    rc_t rc;
-    STableOverrides *to;
-
-    /* first question is whether parent exists */
-    if ( VectorFind ( parents, & dad -> id, NULL, STableOverridesCmp ) != NULL )
-        return RC ( rcVDB, rcSchema, rcParsing, rcTable, rcExists );
-
-    /* create a new override object */
-    to = malloc ( sizeof * to );
-    if ( to == NULL )
-        return RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-
-    /* shallow clone */
-    rc = VectorCopy ( overrides, & to -> overrides );
-    if ( rc != 0 )
-    {
-        free ( to );
-        return rc;
-    }
-    to -> dad = dad;
-    to -> ctx = dad -> id;
-
-    /* insert into parent override vector */
-    rc = VectorInsert ( parents, to, NULL, STableOverridesSort );
-    if ( rc != 0 )
-    {
-        STableOverridesWhack ( to, NULL );
-        return rc;
-    }
-
-    return 0;
-}
-
-static
-bool CC STableOverridesClone ( void *item, void *data )
-{
-    const STableOverrides *self = ( const void* ) item;
-    rc_t rc = STableOverridesMake ( data, self -> dad, & self -> overrides );
-    return ( rc != 0 && GetRCState ( rc ) != rcExists ) ? true : false;
-}
-
-#endif
-
-/*--------------------------------------------------------------------------
- * STable
- *  table declaration
- */
-
-#if SLVL >= 6
-
-/* Whack
- */
-void CC STableWhack ( void *item, void *ignore )
-{
-    STable *self = item;
-
-    if ( self -> dflt_view != NULL )
-        StringWhack ( self -> dflt_view );
-
-#if SLVL >= 8
-    VectorWhack ( & self -> col, SColumnWhack, NULL );
-    VectorWhack ( & self -> cname, SNameOverloadWhack, NULL );
-#endif
-#if SLVL >= 7
-    VectorWhack ( & self -> phys, SPhysMemberWhack, NULL );
-#endif
-    VectorWhack ( & self -> prod, SProductionWhack, NULL );
-    VectorWhack ( & self -> vprods, NULL, NULL );
-    VectorWhack ( & self -> syms, ( void ( CC * ) ( void*, void* ) ) KSymbolWhack, NULL );
-
-    VectorWhack ( & self -> parents, NULL, NULL );
-    VectorWhack ( & self -> overrides, STableOverridesWhack, NULL );
-
-    SExpressionWhack ( self -> limit );
-
-    BSTreeWhack ( & self -> scope, KSymbolWhack, NULL );
-
-    free ( self );
-}
-
-/* Cmp
- * Sort
- */
-int CC STableCmp ( const void *item, const void *n )
-{
-    const uint32_t *a = item;
-    const STable *b = n;
-
-    if ( * a > b -> version )
-        return 1;
-    return ( int ) ( * a >> 24 ) - ( int ) ( b -> version >> 24 );
-}
-
-int CC STableSort ( const void *item, const void *n )
-{
-    const STable *a = item;
-    const STable *b = n;
-
-    return ( int ) ( a -> version >> 24 ) - ( int ) ( b -> version >> 24 );
-}
-
-
-/* Find
- *  generic object find within table scope
- *
- *  "td" [ OUT, NULL OKAY ] - returns cast type expression
- *  if given or "any" if not
- *
- *  "name" [ OUT ] - returns list of overloaded objects if found
- *
- *  "type" [ OUT ] - returns object type id, e.g.:
- *    eDatatype, eTypeset, eFormat, eFunction, ePhysical, eTable, ...
- *
- *  "expr" [ IN ] - NUL terminated name expression identifying object
- *
- *  "ctx" [ IN ] - NUL terminated context string for evaluation,
- *  substitutes for filename in logging reports
- *
- *  "dflt" [ IN ] - if true, resolve default value
- *
- *  returns principal object identified. if NULL but "name" is not
- *  NULL, then the object was only partially identified.
- */
-const void *STableFind ( const STable *self,
-    const VSchema *schema, VTypedecl *td, const SNameOverload **name,
-    uint32_t *type, const char *expr, const char *ctx, bool dflt )
-{
-    rc_t rc;
-    KSymTable tbl;
-
-    /* initialize to not-found */
-    const void *obj = NULL;
-    * name = NULL;
-    * type = 0;
-
-    /* build a symbol table for table */
-    rc = init_tbl_symtab ( & tbl, schema, self );
-    if ( rc == 0 )
-    {
-        obj = resolve_object ( & tbl, schema, td, name, type, expr, ctx, dflt );
-        KSymTableWhack ( & tbl );
-    }
-
-    return obj;
-}
-
-
-/* FindOverride
- *  finds an inherited or introduced overridden symbol
- */
-KSymbol *STableFindOverride ( const STable *self, const VCtxId *cid )
-{
-    const STableOverrides *to;
-
-    /* it may be on the existing table */
-    if ( cid -> ctx == self -> id )
-        return VectorGet ( & self -> vprods, cid -> id );
-
-    to = ( const void* ) VectorFind ( & self -> overrides,
-        & cid -> ctx, NULL, STableOverridesCmp );
-    if ( to == NULL )
-        return NULL;
-
-    return VectorGet ( & to -> overrides, cid -> id );
-}
-
-/* FindOrdAncestor
- *  finds a parent or grandparent by order
- */
-const STable *STableFindOrdAncestor ( const STable *self, uint32_t i )
-{
-    const STableOverrides *to = ( const void* ) VectorGet ( & self -> overrides, i );
-    if ( to == NULL )
-        return NULL;
-    return to -> dad;
-}
-
-
-/* Extend
- */
-static
-bool CC STableHasDad ( void *item, void *data )
-{
-    if ( item == data )
-        return true;
-    return false;
-}
-
-static
-bool STableTestForTypeCollision ( const SNameOverload *a, const SNameOverload *b )
-{
-    uint32_t ax, bx, ctx;
-
-    uint32_t aend = VectorLength ( & a -> items );
-    uint32_t bend = VectorLength ( & b -> items );
-
-    if ( aend == 0 || bend == 0 )
-        return false;
-
-    ctx = a -> cid . ctx;
-    ax = VectorStart ( & a -> items );
-    bx = VectorStart ( & b -> items );
-
-    for ( aend += ax, bend += bx; ax < aend && bx < bend; )
-    {
-        int diff;
-        const SColumn *acol = ( const void* ) VectorGet ( & a -> items, ax );
-        const SColumn *bcol = ( const void* ) VectorGet ( & b -> items, bx );
-        assert ( acol != NULL && bcol != NULL );
-
-        /* if they are both from some other shared parent
-           maybe they are even the same column */
-        if ( acol == bcol || acol -> cid . ctx == bcol -> cid . ctx )
-        {
-            ++ ax;
-            ++ bx;
-            continue;
-        }
-
-        /* don't bother comparing if either is from
-           originating table, as they are required
-           to appear in both lists */
-        if ( acol -> cid . ctx == ctx )
-        {
-            ++ ax;
-            continue;
-        }
-
-        if ( bcol -> cid . ctx == ctx )
-        {
-            ++ bx;
-            continue;
-        }
-
-        /* test the column types */
-        diff = SColumnSort ( acol, bcol );
-
-        /* if they are the same type, this is a collision */
-        if ( diff == 0 )
-            return true;
-
-        /* let it slide */
-        if ( diff < 0 )
-            ++ ax;
-        else
-            ++ bx;
-    }
-
-    return false;
-}
-
-static
-bool STableTestForSymCollision ( const KSymbol *sym, void *data )
-{
-    const KSymTable *tbl = ( const void* ) data;
-    const KSymbol *found = KSymTableFindSymbol ( tbl, sym );
-    if ( found != NULL && found != sym ) switch ( found -> type )
-    {
-    case eColumn:
-        if ( sym -> type == eColumn )
-        {
-            /* when colliding columns originated in the same
-               table, consider them to be compatible extensions */
-            const SNameOverload *found_col, *sym_col;
-            sym_col = sym -> u . obj;
-            found_col = found -> u . obj;
-            assert ( sym_col != NULL && found_col != NULL );
-            if ( sym_col -> cid . ctx == found_col -> cid . ctx )
-                return STableTestForTypeCollision ( sym_col, found_col );
-        }
-    case eProduction:
-    case ePhysMember:
-        PLOGMSG ( klogErr, ( klogErr, "duplicate symbol '$(sym)' in parent table hierarchy"
-                             , "sym=%S"
-                             , & sym -> name
-                      ));
-        return true;
-    }
-    return false;
-}
-
-static
-bool CC STableTestColCollisions ( void *item, void *data )
-{
-    const SNameOverload *no = ( const void* ) item;
-    return STableTestForSymCollision ( no -> name, data );
-}
-
-static
-bool CC STableTestPhysCollisions ( void *item, void *data )
-{
-    const SPhysMember *phys = ( const void* ) item;
-    return STableTestForSymCollision ( phys -> name, data );
-}
-
-static
-bool CC STableTestProdCollisions ( void *item, void *data )
-{
-    const SProduction *prod = ( const void* ) item;
-    return STableTestForSymCollision ( prod -> name, data );
-}
-
-static
-bool STableTestForCollisions ( void *item, void *data )
-{
-    const STable *self = ( const void* ) item;
-
-    /* test column names */
-    if ( VectorDoUntil ( & self -> cname, false, STableTestColCollisions, data ) )
-        return true;
-
-    /* test physical names */
-    if ( VectorDoUntil ( & self -> phys, false, STableTestPhysCollisions, data ) )
-        return true;
-
-    /* test production names */
-    if ( VectorDoUntil ( & self -> prod, false, STableTestProdCollisions, data ) )
-        return true;
-
-    return false;
-}
-
-static
-bool CC STableOverridesTestForCollisions ( void *item, void *data )
-{
-    const STableOverrides *to = ( const void* ) item;
-    return STableTestForCollisions ( ( void* ) to -> dad, data );
-}
-
-static
-bool CC STableCopyColumnNames ( void *item, void *data )
-{
-    rc_t rc;
-    STable *self= data;
-    SNameOverload *copy;
-    const SNameOverload *orig = ( const void* ) item;
-    const KSymbol *sym = ( const KSymbol* )
-        BSTreeFind ( & self -> scope, & orig -> name -> name, KSymbolCmp );
-    if ( sym == NULL )
-    {
-        rc = SNameOverloadCopy ( & self -> scope, & copy, orig );
-        if ( rc == 0 )
-        {
-            rc = VectorAppend ( & self -> cname, & copy -> cid . id, copy );
-            if ( rc != 0 )
-                SNameOverloadWhack ( copy, NULL );
-        }
-    }
-    else
-    {
-        copy = ( void* ) sym -> u . obj;
-        assert ( copy -> cid . ctx == orig -> cid . ctx );
-        rc = VectorMerge ( & copy -> items, true, & orig -> items, SColumnSort );
-    }
-
-    return ( rc != 0 ) ? true : false;
-}
-
-static
-bool CC STableScanVirtuals ( void *item, void *data )
-{
-    KSymTable *tbl = data;
-    STableOverrides *to = item;
-    BSTree *scope = VectorLast ( & tbl -> stack );
-    uint32_t i = VectorStart ( & to -> overrides );
-    uint32_t end = VectorLength ( & to -> overrides );
-    for ( end += i; i < end; ++ i )
-    {
-        const KSymbol *orig = ( const void* ) VectorGet ( & to -> overrides, i );
-        assert ( orig != NULL );
-        if ( orig -> type == eVirtual )
-        {
-            void *ignore;
-
-            /* since the virtual productions in one parent could be
-               defined by another parent, test for the possibility */
-            const KSymbol *def = KSymTableFindSymbol ( tbl, orig );
-            if ( def != NULL )
-                VectorSwap ( & to -> overrides, i, def, & ignore );
-            else
-            {
-                /* copy the original */
-                KSymbol *copy;
-                rc_t rc = KSymbolCopy ( scope, & copy, orig );
-                if ( rc != 0 )
-                    return true;
-
-                /* replace the parent virtual with an updatable copy */
-                VectorSwap ( & to -> overrides, i, copy, & ignore );
-            }
-        }
-    }
-    return false;
-}
-
-static
-rc_t STableExtend ( KSymTable *tbl, STable *self, const STable *dad )
-{
-    rc_t rc;
-
-    /* reject if direct parent already there */
-    if ( VectorDoUntil ( & self -> parents, false, STableHasDad, ( void* ) dad ) )
-        return RC ( rcVDB, rcSchema, rcParsing, rcTable, rcExists );
-
-    /* if parent is already in ancestry, treat as redundant */
-    if ( VectorFind ( & self -> overrides, & dad -> id, NULL, STableOverridesCmp ) != NULL )
-        return VectorAppend ( & self -> parents, NULL, dad );
-
-    /* enter scope for this table */
-    rc = push_tbl_scope ( tbl, self );
-    if ( rc != 0 )
-        return rc;
-
-    /* test for any collisions */
-    if ( STableTestForCollisions ( ( void* ) dad, tbl ) ||
-         VectorDoUntil ( & dad -> overrides, false, STableOverridesTestForCollisions, tbl ) )
-    {
-        pop_tbl_scope ( tbl, self );
-        return RC ( rcVDB, rcSchema, rcParsing, rcName, rcExists );
-    }
-
-    /* pop table scope */
-    pop_tbl_scope ( tbl, self );
-
-    /* add "dad" to parent list */
-    rc = VectorAppend ( & self -> parents, NULL, dad );
-    if ( rc != 0 )
-        return rc;
-
-    /* copy column names from parent - should already contain all grandparents */
-    if ( VectorDoUntil ( & dad -> cname, false, STableCopyColumnNames, self ) )
-        return RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-
-    /* add "dad" to overrides */
-    rc = STableOverridesMake ( & self -> overrides, dad, & dad -> vprods );
-    if ( rc == 0 )
-    {
-        /* add all grandparents */
-        if ( VectorDoUntil ( & dad -> overrides, false, STableOverridesClone, & self -> overrides ) )
-            rc = RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-    }
-    else if ( GetRCState ( rc ) == rcExists )
-    {
-        rc = 0;
-    }
-    return rc;
-}
-
-/* CloneExtend
- *  creates an initially transparent table extension
- *  used by cursor to permit addition of implicit productions
- */
-rc_t STableCloneExtend ( const STable *self, STable **clone, VSchema *schema )
-{
-    rc_t rc;
-    KSymTable tbl;
-
-    STable *table = malloc ( sizeof * table );
-    if ( table == NULL )
-        return RC ( rcVDB, rcSchema, rcUpdating, rcMemory, rcExhausted );
-
-    /* need to take a deep look at scope */
-    rc = init_symtab ( & tbl, schema );
-    if ( rc != 0 )
-        return rc;
-
-    /* this takes care of initializing "scope" */
-    memset ( table, 0, sizeof * table );
-
-    /* take name and version, since this is an anonymous extension */
-    table -> name = KSymTableFindSymbol ( & tbl, self -> name );
-    KSymTableWhack ( & tbl );
-    assert ( table -> name != NULL );
-    table -> src_file = self -> src_file;
-    table -> src_line = self -> src_line;
-    table -> version = self -> version;
-
-    /* take on table-wide blob limit */
-    if ( self -> limit != NULL )
-    {
-        table -> limit = self -> limit;
-        atomic32_inc ( & ( ( SExpression* ) table -> limit ) -> refcount );
-    }
-
-    /* initialize all vectors for single-inheritance */
-    VectorInit ( & table -> parents, 0, 1 );
-    VectorInit ( & table -> overrides, 0, VectorLength ( & self -> overrides ) + 1 );
-    VectorInit ( & table -> col, 0, 16 );
-    VectorInit ( & table -> cname, 0, 16 );
-    VectorInit ( & table -> phys, 0, 16 );
-    VectorInit ( & table -> prod, 0, 64 );
-    VectorInit ( & table -> vprods, 1, 16 );
-    VectorInit ( & table -> syms, 1, 32 );
-
-    rc = init_tbl_symtab ( & tbl, schema, table );
-    if ( rc == 0 )
-        rc = STableExtend ( & tbl, table, self );
-    if ( rc == 0 )
-    {
-        rc = push_tbl_scope ( & tbl, table );
-        if ( rc == 0 )
-        {
-            if ( VectorDoUntil ( & table -> overrides, false, STableScanVirtuals, & tbl ) )
-                rc = RC ( rcVDB, rcSchema, rcUpdating, rcMemory, rcExhausted );
-        }
-    }
-
-    KSymTableWhack ( & tbl );
-
-    if ( rc == 0 )
-    {
-        /* add table to schema */
-        rc = VectorAppend ( & schema -> tbl, & table -> id, table );
-        if ( rc == 0 )
-        {
-            void *dad;
-            uint32_t idx;
-            SNameOverload *name = ( void* ) table -> name -> u . obj;
-
-            /* find ourselves in table overloads */
-            dad = VectorFind ( & name -> items, & table -> version, & idx, STableCmp );
-            assert ( dad != NULL );
-            assert ( dad == ( void* ) self );
-
-            /* set clone in our place */
-            VectorSwap ( & name -> items, idx, table, & dad );
-
-            * clone = table;
-            return 0;
-        }
-    }
-
-    STableWhack ( table, NULL ), table = NULL;
-    return rc;
-}
-
-/* ImplicitPhysMember
- *  adds an implicit physical member
- */
-rc_t STableImplicitPhysMember ( STable *self,
-    const VTypedecl *td, KSymbol *sym, const String *name )
-{
-    rc_t rc;
-    SPhysMember *m = malloc ( sizeof * m );
-    if ( m == NULL )
-        rc = RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-    else
-    {
-        memset ( m, 0, sizeof * m );
-
-        /* if discovered as static column, give it a type */
-        if ( td != NULL )
-            m -> td = * td;
-
-        /* create name symbol as required */
-        if ( sym == NULL )
-        {
-            rc = KSymbolMake ( & sym, name, ePhysMember, m );
-            if ( rc == 0 )
-                BSTreeInsert ( & self -> scope, & sym -> n, KSymbolSort );
-        }
-        if ( sym != NULL )
-        {
-            /* complete handshake with symbol */
-            m -> name = sym;
-            sym -> u . obj = m;
-            sym -> type = ePhysMember;
-
-            /* add member to table */
-            m -> cid . ctx = self -> id;
-            rc = VectorAppend ( & self -> phys, & m -> cid . id, m );
-            if ( rc == 0 )
-                return 0;
-        }
-
-        SPhysMemberWhack ( m, NULL );
-    }
-    return rc;
-}
-
-/* ImplicitColMember
- *  adds an implicit column member of simple or incomplete type
- *
- *  "cname" [ IN ] - column name
- *
- *  "pname" [ IN ] - name of physical column
- */
-rc_t STableImplicitColMember ( STable *self,
-    const String *cname, const String *pname )
-{
-    rc_t rc;
-
-    /* create SColumn */
-    SColumn *col = malloc ( sizeof * col );
-    if ( col == NULL )
-        rc = RC ( rcVDB, rcTable, rcUpdating, rcMemory, rcExhausted );
-    else
-    {
-        const KSymbol *psym;
-        memset ( col, 0, sizeof * col );
-
-        /* look up SPhysMember */
-        psym = ( const KSymbol* ) BSTreeFind ( & self -> scope, pname, KSymbolCmp );
-        if ( psym == NULL )
-            rc = RC ( rcVDB, rcTable, rcUpdating, rcColumn, rcNotFound );
-        else
-        {
-            KSymbol *csym;
-
-            /* create column symbol */
-            rc = KSymbolMake ( & csym, cname, eColumn, col );
-            if ( rc == 0 )
-            {
-                BSTNode *exist;
-
-                /* complete handshake with symbol */
-                col -> name = csym;
-
-                /* insert into table scope and reject on collision
-                   deep check should have been executed previously */
-                rc = BSTreeInsertUnique ( & self -> scope, & csym -> n, & exist, KSymbolSort );
-                if ( rc == 0 )
-                {
-                    /* take column typedecl ( if known ) from physical */
-                    SPhysMember *phys = ( void* ) psym -> u . obj;
-                    col -> td = phys -> td;
-
-                    /* cross-link the external and physical columns */
-                    rc = SSymExprMake ( & col -> read, psym, ePhysExpr );
-                    if ( rc == 0 )
-                        rc = SSymExprMake ( & phys -> expr, csym, eColExpr );
-                    if ( rc == 0 )
-                    {
-                        /* add column to table */
-                        col -> cid . ctx = self -> id;
-                        rc = VectorAppend ( & self -> col, & col -> cid . id, col );
-                        if ( rc == 0 )
-                        {
-                            void *ignore;
-                            SNameOverload *name;
-
-                            /* create a column name with a single typed column */
-                            rc = SNameOverloadMake ( & name, csym, 0, 1 );
-                            if ( rc == 0 )
-                            {
-                                /* being the only column, "col" may be simply
-                                   inserted rather than using a sorted insert */
-                                rc = VectorAppend ( & name -> items, NULL, col );
-                                if ( rc == 0 )
-                                {
-                                    /* finally, insert name into table */
-                                    rc = VectorAppend ( & self -> cname, & name -> cid . id, name );
-                                    if ( rc == 0 )
-                                    {
-                                        name -> cid . ctx = self -> id;
-                                        return 0;
-                                    }
-                                }
-
-                                SNameOverloadWhack ( name, NULL );
-                            }
-
-                            VectorSwap ( & self -> col, col -> cid . id, NULL, & ignore );
-                        }
-
-                        SExpressionWhack ( phys -> expr ), phys -> expr = NULL;
-                    }
-
-                    BSTreeUnlink ( & self -> scope, & csym -> n );
-                }
-
-                KSymbolWhack ( & csym -> n, NULL );
-            }
-        }
-
-        SColumnWhack ( col, NULL );
-    }
-    return rc;
-}
-
-
-/* Compare
- */
-static
-int KSymbolDeepCompare ( const KSymbol *a, const KSymbol *b )
-{
-    int diff;
-
-    /* the same symbol */
-    if ( a == b )
-        return 0;
-
-    /* parents are first */
-    if ( a -> dad != NULL )
-    {
-        if ( b -> dad != NULL )
-        {
-            /* both symbols have parents */
-            diff = KSymbolDeepCompare ( a -> dad, b -> dad );
-            if ( diff != 0 )
-                return diff;
-        }
-        else
-        {
-            /* "b" is a root */
-            diff = KSymbolDeepCompare ( a -> dad, b );
-            if ( diff != 0 )
-                return diff;
-            return 1;
-        }
-    }
-    else if ( b -> dad != NULL )
-    {
-        /* "a" is a root */
-        diff = KSymbolDeepCompare ( a, b -> dad );
-        if ( diff != 0 )
-            return diff;
-        return -1;
-    }
-
-    /* perform textual comparison */
-    return KSymbolSort ( & a -> n, & b -> n );
-}
-
-static
-int CC STableNameSort ( const void **a, const void **b, void *ignore )
-{
-    int diff;
-    const STable *tb = * b;
-    const STable *ta = * a;
-    if ( tb == NULL )
-        return ta != NULL;
-    if ( ta == NULL )
-        return -1;
-    diff = KSymbolDeepCompare ( ta -> name, tb -> name );
-    if ( diff != 0 )
-        return diff;
-    if ( ta -> version < tb -> version )
-        return -1;
-    if ( ta -> version > tb -> version )
-        return 1;
-    return 0;
-}
-
-enum
-{
-    stbl_cmp_insertion = 1 << 0,
-    stbl_cmp_deletion  = 1 << 1,
-    stbl_cmp_mismatch  = 1 << 2,
-    stbl_cmp_newer     = 1 << 3,
-    stbl_cmp_older     = 1 << 4
-};
-
-static
-rc_t STableCompare ( const STable *a, const STable *b, const STable **newer, bool exhaustive )
-{
-    rc_t stage_rc, cmp_rc = 0;
-    uint32_t stage_bits, cmp_bits = 0;
-
-    int diff;
-    Vector va, vb;
-    uint32_t ia, ib, ca, cb;
-
-    assert ( ( a -> version >> 24 ) == ( b -> version >> 24 ) );
-
-    PARSE_DEBUG (( "STableCompare: testing %N #%.3V against #%.3V\n",
-                   a -> name, a -> version, b -> version ));
-
-    /* guess the newer of the two based upon version alone */
-    * newer = a -> version >= b -> version ? a : b;
-
-    /* test #1 - immediate parents */
-    ca = VectorLength ( & a -> parents );
-    cb = VectorLength ( & b -> parents );
-    if ( ca != cb || ca != 0 )
-    {
-        /* make a copy */
-        cmp_rc = VectorCopy ( & a -> parents, & va );
-        if ( cmp_rc != 0 )
-            return cmp_rc;
-        cmp_rc = VectorCopy ( & b -> parents, & vb );
-        if ( cmp_rc != 0 )
-        {
-            VectorWhack ( & va, NULL, NULL );
-            return cmp_rc;
-        }
-        if ( ca > 1 )
-            VectorReorder ( & va, STableNameSort, NULL );
-        if ( cb > 1 )
-            VectorReorder ( & vb, STableNameSort, NULL );
-
-        for ( stage_bits = ia = ib = 0; ia < ca && ib < cb; )
-        {
-            const STable *pa = ( const void* ) VectorGet ( & va, ia );
-            const STable *pb = ( const void* ) VectorGet ( & vb, ib );
-            if ( pa == pb )
-            {
-                ++ ia, ++ ib;
-                continue;
-            }
-            diff = KSymbolDeepCompare ( pa -> name, pb -> name );
-            if ( diff < 0 )
-            {
-                stage_bits |= stbl_cmp_insertion;
-                ++ ia;
-            }
-            else if ( diff > 0 )
-            {
-                stage_bits |= stbl_cmp_deletion;
-                ++ ib;
-            }
-            else
-            {
-                if ( pa -> version > pb -> version )
-                    stage_bits |= stbl_cmp_newer;
-                else if ( pa -> version < pb -> version )
-                    stage_bits |= stbl_cmp_older;
-
-                ++ ia, ++ ib;
-            }
-        }
-
-        VectorWhack ( & va, NULL, NULL );
-        VectorWhack ( & vb, NULL, NULL );
-
-        PARSE_DEBUG (( "STableCompare: %N #%.3V vs. #%.3V - PARENT COMPARISON:\n%s%s%s%s%s"
-                       , a -> name, a -> version, b -> version
-                       , ( stage_bits == 0 )                 ? "  no differences detected\n" : ""
-                       , ( stage_bits & stbl_cmp_insertion ) ? "  insertion(s) detected\n" : ""
-                       , ( stage_bits & stbl_cmp_deletion )  ? "  deletion(s) detected\n" : ""
-                       , ( stage_bits & stbl_cmp_newer )     ? "  newer ancestor(s) detected\n" : ""
-                       , ( stage_bits & stbl_cmp_older )     ? "  older ancestor(s) detected\n" : ""
-            ));
-
-        if ( stage_bits != 0 )
-        {
-            /* if the table versions are the same, the parents should not have insertions or deletions */
-            if ( a -> version == b -> version && ( stage_bits & ( stbl_cmp_insertion | stbl_cmp_deletion ) ) != 0 )
-            {
-                stage_rc = RC ( rcVDB, rcSchema, rcParsing, rcTable, rcInconsistent );
-                PLOGERR ( klogErr, ( klogErr, stage_rc, "STableCompare: illegal redeclaration of table '$(tbl)' - differing parents."
-                                     , "tbl=%N#%.3V"
-                                     , a -> name, b -> version ) );
-                if ( ! exhaustive )
-                    return stage_rc;
-                if ( cmp_rc == 0 )
-                    cmp_rc = stage_rc;
-            }
-
-            /* if the tables have same parent names but conflicting versions */
-            if ( ( stage_bits & ( stbl_cmp_newer | stbl_cmp_older ) ) == ( stbl_cmp_newer | stbl_cmp_older ) )
-            {
-                stage_rc = RC ( rcVDB, rcSchema, rcParsing, rcTable, rcInconsistent );
-                PLOGERR ( klogErr, ( klogErr, stage_rc, "STableCompare: illegal redeclaration of table '$(tbl)' - both older and newer parent versions."
-                                     , "tbl=%N#%.3V"
-                                     , a -> name, b -> version ) );
-                if ( ! exhaustive )
-                    return stage_rc;
-                if ( cmp_rc == 0 )
-                    cmp_rc = stage_rc;
-            }
-            else
-            {
-                /* if "a" claims to be newer than "b" */
-                if ( a -> version > b -> version )
-                {
-                    if ( ( stage_bits & stbl_cmp_older ) != 0 )
-                    {
-                        stage_rc = RC ( rcVDB, rcSchema, rcParsing, rcTable, rcInconsistent );
-                        PLOGERR ( klogErr, ( klogErr, stage_rc, "STableCompare: illegal redeclaration of table '$(tbl)' - version $(new_vers) has older parents than version $(old_vers)."
-                                             , "tbl=%N,new_vers=#%.3V,old_vers=#%.3V"
-                                             , a -> name, a -> version, b -> version ) );
-                        if ( ! exhaustive )
-                            return stage_rc;
-                        if ( cmp_rc == 0 )
-                            cmp_rc = stage_rc;
-                    }
-                }
-
-                /* if "b" claims to be newer than "a" */
-                else if ( a -> version < b -> version )
-                {
-                    if ( ( stage_bits & stbl_cmp_newer ) != 0 )
-                    {
-                        stage_rc = RC ( rcVDB, rcSchema, rcParsing, rcTable, rcInconsistent );
-                        PLOGERR ( klogErr, ( klogErr, stage_rc, "STableCompare: illegal redeclaration of table '$(tbl)' - version $(old_vers) has newer parents than version $(new_vers)."
-                                             , "tbl=%N,new_vers=#%.3V,old_vers=#%.3V"
-                                             , a -> name, b -> version, a -> version ) );
-                        if ( ! exhaustive )
-                            return stage_rc;
-                        if ( cmp_rc == 0 )
-                            cmp_rc = stage_rc;
-                    }
-                }
-
-                /* they are the same - check parent versions */
-                else if ( ( stage_bits & ( stbl_cmp_newer | stbl_cmp_older ) ) != 0 )
-                {
-                    PLOGMSG ( klogInfo, ( klogInfo, "STableCompare: table '$(tbl)' differs in parent hierarchy"
-                                          " - latest declaration chosen automatically.", "tbl=%N#%.3V"
-                                          , a -> name, b -> version ));
-
-                    * newer = ( stage_bits & stbl_cmp_newer ) ? a : b;
-                }
-            }
-
-            cmp_bits |= stage_bits;
-        }
-    }
-
-    /* test #2 - immediate extern columns */
-    /* test #3 - immediate physical columns */
-    /* test #4 - immediate productions */
-    /* test #5 - immediate virtual productions */
-    /* test #6 - deep parents */
-    /* test #7 - deep extern columns */
-    /* test #8 - deep physical columns */
-    /* test #9 - deep productions */
-    /* test #10 - deep virtual productions */
-
-    return cmp_rc;
-}
-
-
-/* Mark
- */
-void CC STableClearMark ( void *item, void *ignore )
-{
-    STable *self = item;
-    self -> marked = false;
-}
-
-
-void CC STableMark ( void * item, void * data )
-{
-    STable * self = item;
-    if ( self != NULL && ! self -> marked )
-    {
-        self -> marked = true;
-        SFunctionMark ( ( void * )self -> untyped, data );
-        VectorForEach ( & self -> col, false, SColumnMark, data );
-        VectorForEach ( & self -> phys, false, SPhysMemberMark, data );
-        VectorForEach ( & self -> prod, false, SProductionMark, data );
-        VectorForEach ( & self -> parents, false, STableMark, data );
-    }
-}
-
-void STableNameMark ( const SNameOverload *self, const VSchema *schema )
-{
-    if ( self != NULL )
-    {
-        VectorForEach ( & self -> items, false, STableMark, ( void * )schema );
-    }
-}
-
-
-/* Dump
- *  dump "table" { }
- */
-rc_t STableDump ( const STable *self, struct SDumper *d )
-{
-    d -> rc = FQNDump ( self != NULL ? self -> name : NULL, d );
-    if ( d -> rc == 0 && self != NULL )
-        d -> rc = SDumperVersion ( d, self -> version );
-    return d -> rc;
-}
-
-#if _DEBUGGING
-static
-bool CC SProductionDumpVirtuals ( void *item, void *data )
-{
-    SDumper *b = data;
-    const KSymbol *sym = ( const void* ) item;
-
-    switch ( sym -> type )
-    {
-    case eVirtual:
-        b -> rc = SDumperPrint ( b, "\t *  virtual %N = 0;\n", sym );
-        break;
-    case eProduction:
-    {
-        const SProduction *prod = sym -> u . obj;
-        b -> rc = SDumperPrint ( b, "\t *  %E %N;\n", prod -> fd, sym );
-        break;
-    }
-    case eColumn:
-    {
-        b -> rc = SDumperPrint ( b, "\t *  column %N;\n", sym );
-        break;
-    }
-    case ePhysMember:
-    {
-        const SPhysMember *phys = sym -> u . obj;
-        if ( phys -> type != NULL )
-            b -> rc = SDumperPrint ( b, "\t *  physical %E %N;\n", phys -> type, sym );
-        else
-            b -> rc = SDumperPrint ( b, "\t *  physical %T %N;\n", & phys -> td, sym );
-        break;
-    }}
-
-    return ( b -> rc != 0 ) ? true : false;
-}
-
-static
-bool CC SProductionDumpOverrides ( void *item, void *data )
-{
-    SDumper *b = data;
-    const STableOverrides *to = ( const void* ) item;
-    if ( VectorLength ( & to -> overrides ) == 0 )
-        return false;
-
-    b -> rc = SDumperPrint ( b, "\n\t/* %N inherited virtual productions\n", to -> dad -> name );
-    if ( b -> rc != 0 )
-        return true;
-    if ( VectorDoUntil ( & to -> overrides, false, SProductionDumpVirtuals, b ) )
-        return true;
-    b -> rc = SDumperPrint ( b, "\t */\n" );
-
-    return ( b -> rc != 0 ) ? true : false;
-}
-#endif
-
-static
-bool STableDumpBody ( const STable *self, SDumper *b )
-{
-    bool compact = SDumperMode ( b ) == sdmCompact ? true : false;
-
-    if ( self -> untyped != NULL )
-    {
-        b -> rc = SDumperPrint ( b, compact ? "__untyped=%N();" : "\t__untyped = %N ();\n"
-                                 , self -> untyped -> name
-            );
-        if ( b -> rc != 0 )
-            return true;
-    }
-    if ( self -> limit != NULL )
-    {
-        b -> rc = SDumperPrint ( b, compact ? "column default limit=%E;" : "\tcolumn default limit = %E;\n"
-                                 , self -> limit
-            );
-        if ( b -> rc != 0 )
-            return true;
-    }
-#if SLVL >= 8
-    if ( VectorDoUntil ( & self -> col, false, SColumnDefDump, b ) )
-        return true;
-#endif
-    if ( VectorDoUntil ( & self -> prod, false, SProductionDefDump, b ) )
-        return true;
-#if SLVL >= 7
-    if ( VectorDoUntil ( & self -> phys, false, SPhysMemberDefDump, b ) )
-        return true;
-#endif
-#if _DEBUGGING
-    if ( SDumperMode ( b ) == sdmPrint )
-    {
-        if ( VectorDoUntil ( & self -> overrides, false, SProductionDumpOverrides, b ) )
-            return true;
-
-        if ( VectorLength ( & self -> vprods ) != 0 )
-        {
-            b -> rc = SDumperPrint ( b, "\n\t/* %N virtual productions\n", self -> name );
-            if ( b -> rc != 0 )
-                return true;
-            if ( VectorDoUntil ( & self -> vprods, false, SProductionDumpVirtuals, b ) )
-                return true;
-            b -> rc = SDumperPrint ( b, "\t */\n" );
-            if ( b -> rc != 0 )
-                return true;
-        }
-    }
-#endif
-
-    return false;
-}
-
-static
-bool CC STableDumpParents ( void *item, void *data )
-{
-    SDumper *b = data;
-    const STable *self = ( const void* ) item;
-
-    b -> rc = SDumperPrint ( b, "\v%N%V", self -> name, self -> version );
-
-    SDumperSepString ( b, SDumperMode ( b ) == sdmCompact ? "," : ", " );
-
-    return ( b -> rc != 0 ) ? true : false;
-}
-
-bool CC STableDefDump ( void *item, void *data )
-{
-    bool rtn;
-    SDumper *b = data;
-    const STable *self = ( const void* ) item;
-    bool compact = SDumperMode ( b ) == sdmCompact ? true : false;
-
-    if ( SDumperMarkedMode ( b ) && ! self -> marked )
-        return false;
-
-    b -> rc = SDumperPrint ( b, compact ? "table %N" : "\ttable %N", self -> name );
-
-    if ( b -> rc == 0 )
-        b -> rc = SDumperVersion ( b, self -> version );
-
-    if ( b -> rc == 0 )
-    {
-        SDumperSepString ( b, compact ? "=" : " = " );
-        VectorDoUntil ( & self -> parents, false, STableDumpParents, b );
-    }
-
-    if ( b -> rc == 0 )
-        b -> rc = SDumperPrint ( b, compact ? "{" : "\n\t{\n" );
-
-    if ( b -> rc != 0 )
-        return true;
-
-    if ( ! compact )
-        SDumperIncIndentLevel ( b );
-    rtn = STableDumpBody ( self, b );
-    if ( ! compact )
-        SDumperDecIndentLevel ( b );
-
-    if ( rtn )
-        return true;
-
-    b -> rc = SDumperPrint ( b, compact ? "}" : "\t}\n" );
-
-    return ( b -> rc != 0 ) ? true : false;
-}
-
-#endif
-
-
-/*--------------------------------------------------------------------------
- * VSchema
- */
-
-#if SLVL >= 7
-
-/*
- * physical-name      = '.' ID
- */
-void physical_name ( const KSymTable *tbl, KTokenSource *src, KToken *t, const SchemaEnv *env )
-{
-    KToken t2;
-    if ( KTokenizerNext ( kDefaultTokenizer, src, & t2 ) -> id != eIdent ||
-         t -> str . addr + 1 != t2 . str . addr )
-    {
-        /* this is just a dot */
-        KTokenSourceReturn ( src, & t2 );
-    }
-    else
-    {
-        /* this is a physical name */
-        t -> str . size += t2 . str . size;
-        t -> str . len += t2 . str . len;
-        t -> id = eIdent;
-        t -> sym = KSymTableFind ( tbl, & t -> str );
-        if ( t -> sym != NULL )
-            t -> id = t -> sym -> type;
-    }
-}
-
-/*
- *    physical-decl      = 'physical' [ 'column' ] KCOL '{' <physical-stmts> '}'
- *    physical-stmts     = <physical-stmt> ';' [ <physical-stmts> ]
- *    physical-stmt      = 'read' ( '=' | '+= ) <cond-expr>
- *                       | 'write' ( '=' | '+=' ) <cond-expr>
- *                       | '__untyped' '=' <untyped-expr>
- */
-static
-rc_t physical_mbr ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, SPhysMember *m )
-{
-    rc_t rc;
-
-    /* determine static flag */
-    if ( t -> id == kw_static )
-    {
-        next_token ( tbl, src, t );
-        m -> stat = true;
-    }
-
-    /* skip keywords */
-    if ( t -> id == kw_physical )
-        next_token ( tbl, src, t );
-    if ( t -> id == kw_column )
-        next_token ( tbl, src, t );
-
-    /* if member type begins with schema parameters... */
-    if ( t -> id == eLeftAngle )
-        rc = phys_encoding_expr ( tbl, src, t, env, self, & m -> td, & m -> type );
-    else
-    {
-        /* get either a typename or a physical column name */
-        rc = next_fqn ( tbl, src, t, env );
-        if ( rc == 0 )
-        {
-            /* column is probably based upon a physical structure */
-            if ( t -> id == ePhysical )
-                rc = phys_encoding_expr ( tbl, src, t, env, self, & m -> td, & m -> type );            
-            else if ( t -> id != eDatatype )
-                return KTokenExpected ( t, klogErr, "typename or physical column type" );
-            else
-                rc = typedecl ( tbl, src, t, env, self, & m -> td );
-        }
-    }
-    if ( rc != 0 )
-        return KTokenFailure ( t, klogErr, rc, "typename or physical column type" );
-
-    /* get name */
-    if ( t -> id != ePeriod )
-        return KTokenExpected ( t, klogErr, "physical name starting with period" );
-    physical_name ( tbl, src, t, env );
-    if ( t -> id == eIdent )
-    {
-        /* enter name into scope */
-        rc = KSymTableCreateConstSymbol ( tbl, & m -> name, & t -> str, ePhysMember, m );
-        if ( rc != 0 )
-            return KTokenRCExplain ( t, klogInt, rc );
-    }
-    else if ( t -> id == ePhysMember )
-        return KTokenExpected ( t, klogErr, "undefined physical member name" );
-    else if ( t -> id != eForward && t -> id != eVirtual )
-        return KTokenExpected ( t, klogErr, "physical member name" );
-    else
-    {
-        m -> name = t -> sym;
-        ( ( KSymbol* ) t -> sym ) -> u . obj = m;
-        ( ( KSymbol* ) t -> sym ) -> type = ePhysMember;
-    }
-
-
-    /* get the assignment expression */
-    if ( next_token ( tbl, src, t ) -> id == eAssign )
-    {
-        rc = cond_expr ( tbl, src, next_token ( tbl, src, t ), env, self, & m -> expr );
-        if ( rc != 0 )
-            return KTokenFailure ( t, klogErr, rc, "assignment expression" );
-    }
-
-    /* expect we're done */
-    return expect ( tbl, src, t, eSemiColon, ";", true );
-}
-
-static
-rc_t physical_member ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, STable *table )
-{
-    rc_t rc;
-    SPhysMember *m = malloc ( sizeof * m );
-    if ( m == NULL )
-        rc = RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-    else
-    {
-        memset ( m, 0, sizeof * m );
-        rc = physical_mbr ( tbl, src, t, env, self, m );
-        if ( rc == 0 )
-        {
-            rc = VectorAppend ( & table -> phys, & m -> cid . id, m );
-            if ( rc == 0 )
-                return 0;
-        }
-
-        SPhysMemberWhack ( m, NULL );
-    }
-    return rc;
-}
-
-static
-rc_t implicit_physical_member ( KSymTable *tbl, const SchemaEnv *env,
-    STable *table, SColumn *c, KSymbol *sym )
-{
-    rc_t rc;
-    SPhysMember *m = malloc ( sizeof * m );
-    if ( m == NULL )
-        rc = RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-    else
-    {
-        /* create initialized simple physical member */
-        memset ( m, 0, sizeof * m );
-        m -> simple = true;
-
-        /* capture type information */
-        m -> td = c -> td;
-        if ( c -> ptype != NULL )
-        {
-            m -> type = c -> ptype;
-            atomic32_inc ( & ( ( SExpression* ) c -> ptype ) -> refcount );
-        }
-
-        /* link up with name */
-        m -> name = sym;
-        sym -> u . obj = m;
-
-        /* now create simple input expression */
-        rc = SSymExprMake ( & m -> expr, c -> name, eColExpr );
-        if ( rc == 0 )
-            rc = SSymExprMake ( & c -> read, sym, ePhysExpr );
-        if ( rc == 0 )
-        {
-            rc = VectorAppend ( & table -> phys, & m -> cid . id, m );
-            if ( rc == 0 )
-                return 0;
-        }
-
-        SPhysMemberWhack ( m, NULL );
-    }
-    return rc;
-}
-#endif
-
-#if SLVL >= 8
-/*
- * column-stmt        = 'read' '=' <cond-expr>
- *                    | 'validate' '=' <cond-expr>
- *                    | 'limit' '=' UINT_EXPR
- *                    | ';'
- */
-static
-rc_t column_stmt ( KSymTable *tbl, KTokenSource *src, KToken *t,
-     const SchemaEnv *env, VSchema *self, SColumn *c, const char **expected )
-{
-    rc_t rc;
-
-    switch ( t -> id )
-    {
-    case eSemiColon:
-        return 0;
-
-    case kw_read:
-
-        if ( c -> simple )
-            break;
-
-        if ( c -> read != NULL )
-        {
-            rc = RC ( rcVDB, rcSchema, rcParsing, rcProduction, rcExists );
-            return KTokenRCExplain ( t, klogErr, rc );
-        }
-
-        rc = expect ( tbl, src, next_token ( tbl, src, t ), eAssign, "=", true );
-        if ( rc == 0 )
-        {
-            rc = cond_expr ( tbl, src, t, env, self, & c -> read );
-            if ( rc != 0 )
-                KTokenFailure ( t, klogErr, rc, "read expression" );
-            else
-            {
-                if ( c -> read_only )
-                    * expected = "}";
-                else if ( c -> validate == NULL && c -> limit == NULL )
-                    * expected = "validate or limit or }";
-                else if ( c -> validate == NULL )
-                    * expected = "validate or }";
-                else if ( c -> limit == NULL )
-                    * expected = "limit or }";
-                else
-                    * expected = "}";
-                return 0;
-            }
-        }
-        break;
-
-    case kw_validate:
-
-        if ( c -> read_only || c -> simple )
-            break;
-
-        if ( c -> validate != NULL )
-        {
-            rc = RC ( rcVDB, rcSchema, rcParsing, rcProduction, rcExists );
-            return KTokenRCExplain ( t, klogErr, rc );
-        }
-
-        rc = expect ( tbl, src, next_token ( tbl, src, t ), eAssign, "=", true );
-        if ( rc == 0 )
-        {
-            rc = cond_expr ( tbl, src, t, env, self, & c -> validate );
-            if ( rc != 0 )
-                KTokenFailure ( t, klogErr, rc, "validate expression" );
-            else
-            {
-                if ( c -> read == NULL && c -> limit == NULL )
-                    * expected = "read or limit or }";
-                else if ( c -> read == NULL )
-                    * expected = "read or }";
-                else if ( c -> limit == NULL )
-                    * expected = "limit or }";
-                else
-                    * expected = "}";
-                return 0;
-            }
-        }
-        break;
-
-    case kw_limit:
-
-        if ( c -> read_only )
-            break;
-
-        if ( c -> limit != NULL )
-        {
-            rc = RC ( rcVDB, rcSchema, rcParsing, rcConstraint, rcExists );
-            return KTokenRCExplain ( t, klogErr, rc );
-        }
-
-        rc = expect ( tbl, src, next_token ( tbl, src, t ), eAssign, "=", true );
-        if ( rc == 0 )
-        {
-            rc = const_expr ( tbl, src, t, env, self, & c -> limit );
-            if ( rc != 0 )
-                KTokenFailure ( t, klogErr, rc, "limit constraint" );
-            else
-            {
-                if ( c -> read == NULL && c -> validate == NULL )
-                    * expected = "read or validate or }";
-                else if ( c -> read == NULL )
-                    * expected = "read or }";
-                else if ( c -> validate == NULL )
-                    * expected = "validate or }";
-                else
-                    * expected = "}";
-                return 0;
-            }
-        }
-        break;
-    }
-
-    return KTokenExpected ( t, klogErr, * expected );
-}
-
-/*
- * column-body        = '{' <column-stmts> '}'
- * column-stmts       = <column-stmt> ';' [ <column-stmts> ]
- */
-static
-rc_t column_body ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, SColumn *c )
-{
-    const char *expected;
-
-    rc_t rc = expect ( tbl, src, t, eLeftCurly, "{", true );
-    if ( rc != 0 )
-        return rc;
-
-    expected = c -> read_only ? "read or }" :
-        ( c -> simple ? "limit or }" :  "read or validate or limit or }" );
-
-    while ( t -> id != eRightCurly )
-    {
-        rc = column_stmt ( tbl, src, t, env, self, c, & expected );
-        if ( rc == 0 )
-            rc = expect ( tbl, src, t, eSemiColon, ";", true );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    if ( c -> read == NULL && c -> validate == NULL )
-        c -> simple = true;
-
-    return expect ( tbl, src, t, eRightCurly, "}", true );
-}
-
-/*
- * column-decl        = <typedecl> ID <column-body>
- */
-static
-rc_t typed_column_decl ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, STable *table, SColumn *c )
-{
-    rc_t rc = 0;
-
-    /* if column was forwarded, give it a type */
-    if ( t -> id == eForward || t -> id == eVirtual )
-    {
-        c -> name = t -> sym;
-        t -> sym -> type = eColumn;
-    }
-
-    /* catch case where column exists */
-    else if ( t -> id == eColumn )
-    {
-        const SNameOverload *name = t -> sym -> u . obj;
-        if ( VectorFind ( & name -> items, & c -> td, NULL, SColumnCmp ) != NULL )
-            return KTokenExpected ( t, klogErr, "new column name" );
-        c -> name = t -> sym;
-    }
-    else
-    {
-        /* allow names defined in scopes other than table and intrinsic */
-        if ( t -> sym != NULL )
-        {
-            KTokenSourceReturn ( src, t );
-            next_shallow_token ( tbl, src, t, true );
-        }
-
-        if ( t -> id != eIdent )
-            return KTokenExpected ( t, klogErr, "column name" );
-
-        rc = KSymTableCreateConstSymbol ( tbl, & c -> name, & t -> str, eColumn, NULL );
-        if ( rc != 0 )
-            return KTokenRCExplain ( t, klogInt, rc );
-    }
-
-    /* we have "[ 'readonly' | ... ] 'column' TYPE ID" by now.
-       accept a simple assignment for read/validate,
-       or a semi-colon for implicit physical, or a compound
-       statement body for read/validate/limit statements */
-    switch ( next_token ( tbl, src, t ) -> id )
-    {
-    case eSemiColon:
-
-        /* acceptable unless readonly */
-        if ( c -> read_only )
-            rc = KTokenExpected ( t, klogErr, "= or {" );
-
-        /* this looks like a simple column */
-        c -> simple = true;
-        break;
-
-    case eAssign:
-
-        /* if a simple column ( implicit physical ),
-           then there cannot be a read expression */
-        if ( c -> simple )
-            rc = KTokenExpected ( t, klogErr, "; after simple column" );
-        else
-        {
-            /* simple read expression */
-            next_token ( tbl, src, t );
-            rc = cond_expr ( tbl, src, t, env, self, & c -> read );
-            if ( rc != 0 )
-                KTokenFailure ( t, klogErr, rc, "read expression" );
-            else
-                rc = expect ( tbl, src, t, eSemiColon, ";", true );
-        }
-        break;
-
-    case eLeftCurly:
-        /* this is a canonical-form column */
-        rc = column_body ( tbl, src, t, env, self, c );
-        break;
-
-    default:
-        rc = KTokenExpected ( t, klogErr, c -> read_only ? "= or {" : "; or = or {" );
-    }
-
-    /* check for a simple column */
-    if ( rc == 0 && c -> simple )
-    {
-        String physname;
-        char physnamebuff [ 256 ];
-
-        /* check for existence of corresponding physical member */
-        if ( c -> name -> name . size >= sizeof physnamebuff )
-        {
-            /* this is a very long column name... */
-            rc = RC ( rcVDB, rcSchema, rcParsing, rcName, rcExcessive );
-            KTokenFailure ( t, klogErr, rc, "column name" );
-        }
-        else
-        {
-            KSymbol *sym;
-
-            /* tack a dot onto the beginning and look up the symbol */
-            physnamebuff [ 0 ] = '.';
-            memcpy ( & physnamebuff [ 1 ], c -> name -> name . addr, c -> name -> name . size );
-            StringInit ( & physname, physnamebuff, c -> name -> name . size + 1, c -> name -> name . len + 1 );
-            sym = KSymTableFind ( tbl, & physname );
-
-            /* if the symbol exists, then this CANNOT be a simple column */
-            if ( sym != NULL && ! ( sym -> type == eForward || sym -> type == eVirtual ) )
-            {
-                /* check for explicit physical type */
-                if ( c -> ptype != NULL )
-                {
-                    rc = RC ( rcVDB, rcSchema, rcParsing, rcName, rcExists );
-                    KTokenFailure ( t, klogErr, rc, "implicit physical column previously declared" );
-                }
-                else
-                {
-                    rc = RC ( rcVDB, rcSchema, rcParsing, rcExpression, rcNotFound );
-                    KTokenFailure ( t, klogErr, rc, "missing column read or validate expression" );
-                }
-            }
-            else if ( ( c -> td . type_id & 0xC0000000 ) != 0 )
-            {
-                rc = RC ( rcVDB, rcSchema, rcParsing, rcType, rcIncorrect );
-                KTokenFailure ( t, klogErr, rc, "simple columns cannot have typeset as type" );
-            }
-            else
-            {
-                if ( sym != NULL )
-                    sym -> type = ePhysMember;
-                else
-                {
-                    rc = KSymTableCreateSymbol ( tbl, & sym, & physname, ePhysMember, NULL );
-                    if ( rc != 0 )
-                        KTokenFailure ( t, klogErr, rc, "failed to create symbol" );
-                }
-                if ( rc == 0 )
-                {
-                    rc = implicit_physical_member ( tbl, env, table, c, sym );
-                }
-            }
-        }
-    }
-
-    return rc;
-}
-
-static
-rc_t column_decl ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, STable *table, SColumn *c )
-{
-    rc_t rc;
-
-    /* intercept physical type unless marked read-only */
-    if ( ! c -> read_only )
-    {
-        switch ( t -> id )
-        {
-        case eNamespace:
-            rc = next_fqn ( tbl, src, t, env );
-            if ( rc != 0 )
-                return KTokenFailure ( t, klogErr, rc, "typename or physical column type" );
-            if ( t -> id != ePhysical )
-                break;
-        case ePhysical:
-        case eLeftAngle:
-            rc = phys_encoding_expr ( tbl, src, t, env, self, & c -> td, & c -> ptype );
-            if ( rc != 0 )
-                return KTokenFailure ( t, klogErr, rc, "typename or physical column type" );
-
-            /* this column MUST be simple */
-            c -> simple = true;
-            return typed_column_decl ( tbl, src, t, env, self, table, c );
-        }
-    }
-
-#if ALLOW_COLUMN_TYPESET
-    /* read typedecl or typeset */
-    rc = typespec ( tbl, src, t, env, self, & c -> td );
-#else
-    /* read hard typedecl */
-    rc = typedecl ( tbl, src, t, env, self, & c -> td );
-#endif
-    if ( rc != 0 )
-        return KTokenExpected ( t, klogErr, "column type" );
-
-    /* finish the parse with a normal type */
-    return typed_column_decl ( tbl, src, t, env, self, table, c );
-}
-
-static
-rc_t column_declaration ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, STable *table )
-{
-    rc_t rc;
-    SColumn *c;
-    bool dflt, read_only;
-
-    /* parse 'virtual' and 'default' keywords */
-    for ( dflt = read_only = false;
-          t -> id != kw_column; next_token ( tbl, src, t ) )
-    {
-        switch ( t -> id )
-        {
-        case kw_default:
-            if ( dflt )
-                break;
-            dflt = true;
-            continue;
-
-        case kw_extern:
-            continue;
-
-        case kw_readonly:
-            if ( read_only )
-                break;
-            read_only = true;
-            continue;
-        }
-
-        return KTokenExpected ( t, klogErr, "column" );
-    }
-
-    /* consume 'column' keyword and look for 'default' or 'limit' */
-    switch ( next_token ( tbl, src, t ) -> id )
-    {
-    case kw_default:
-    {
-        KToken t2 = * t;
-        KTokenSource src2 = * src;
-        if ( next_token ( tbl, src, t ) -> id != kw_limit )
-        {
-            * t = t2;
-            * src = src2;
-            break;
-        }
-    }
-    case kw_limit:
-
-        if ( dflt || read_only )
-            break;
-
-        if ( table -> limit != NULL )
-        {
-            rc = RC ( rcVDB, rcSchema, rcParsing, rcConstraint, rcExists );
-            return KTokenRCExplain ( t, klogErr, rc );
-        }
-
-        rc = expect ( tbl, src, next_token ( tbl, src, t ), eAssign, "=", true );
-        if ( rc == 0 )
-        {
-            rc = const_expr ( tbl, src, t, env, self, & table -> limit );
-            if ( rc != 0 )
-                KTokenFailure ( t, klogErr, rc, "limit constraint" );
-            else
-                rc = expect ( tbl, src, t, eSemiColon, ";", true );
-        }
-        return rc;
-    }
-
-    /* create column object */
-    c = malloc ( sizeof * c );
-    if ( c == NULL )
-    {
-        rc = RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-        return KTokenRCExplain ( t, klogInt, rc );
-    }
-
-    memset ( c, 0, sizeof * c );
-    c -> dflt = dflt;
-    c -> read_only = read_only;
-
-    /* parse decl */
-    rc = column_decl ( tbl, src, t, env, self, table, c );
-    if ( rc == 0 )
-    {
-        /* give column its own id within table */
-        rc = VectorAppend ( & table -> col, & c -> cid . id, c );
-        if ( rc != 0 )
-            KTokenRCExplain ( t, klogInt, rc );
-        else
-        {
-            void *ignore;
-            SNameOverload *name = ( void* ) c -> name -> u . obj;
-            if ( name == NULL )
-            {
-                rc = SNameOverloadMake ( & name, c -> name, 0, 4 );
-                if ( rc == 0 )
-                {
-                    name -> cid . ctx = -1;
-                    rc = VectorAppend ( & table -> cname, & name -> cid . id, name );
-                    if ( rc != 0 )
-                        SNameOverloadWhack ( name, NULL );
-                }
-            }
-
-            if ( rc == 0 )
-            {
-                rc = VectorInsertUnique ( & name -> items, c, NULL, SColumnSort );
-                if ( rc == 0 )
-                    return 0;
-            }
-
-            /* reverse column insertion */
-            VectorSwap ( & table -> col, c -> cid . id, NULL, & ignore );
-
-            /* what went wrong */
-            KTokenRCExplain ( t, klogInt, rc );
-        }
-    }
-
-    SColumnWhack ( c, NULL );
-    return rc;
-}
-#endif
-
-#if SLVL >= 6
-
-static
-rc_t untyped_tbl_expr ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, STable *table )
-{
-    const SNameOverload *name;
-
-    /* expecting a function assignment */
-    rc_t rc = expect ( tbl, src,
-        next_token ( tbl, src, t ), eAssign, "=", true );
-    if ( rc == 0 )
-        rc = next_fqn ( tbl, src, t, env );
-    if ( rc != 0 )
-        return rc;
-    if ( t -> id != eUntypedFunc )
-        return KTokenExpected ( t, klogErr, "untyped function expression" );
-    name = t -> sym -> u . obj;
-
-    rc = expect ( tbl, src,
-        next_token ( tbl, src, t ), eLeftParen, "(", true );
-    if ( rc == 0 )
-        rc = expect ( tbl, src, t, eRightParen, ")", true );
-    if ( rc == 0 )
-        rc = expect ( tbl, src, t, eSemiColon, ";", true );
-
-    if ( rc == 0 )
-    {
-        table -> untyped = VectorLast ( & name -> items );
-        if ( table -> untyped == NULL )
-        {
-            rc = RC ( rcVDB, rcSchema, rcParsing, rcFunction, rcNotFound );
-            KTokenRCExplain ( t, klogErr, rc );
-        }
-    }
-
-    return rc;
-}
-
-#if SLVL >= 8
-static
-rc_t default_view_decl ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, STable *table )
-{
-    rc_t rc;
-    bool string_too_long;
-
-    if ( next_token ( tbl, src, t ) -> id != eString )
-        return KTokenExpected ( t, klogErr, "default view declaration" );
-
-    string_too_long = false;
-    if ( t -> str . size >= 236 + 2 )
-    {
-        KTokenExpected ( t, klogWarn, "default view declaration less than 236 characters" );
-        string_too_long = true;
-    }
-
-    rc = expect ( tbl, src, t, eSemiColon, ";", true );
-    if ( rc == 0 && ! string_too_long )
-    {
-        String decl = t -> str;
-        ++ decl . addr;
-        decl . size -= 2;
-        decl . len -= 2;
-
-        if ( table -> dflt_view != NULL )
-            StringWhack ( table -> dflt_view );
-
-        rc = StringCopy ( & table -> dflt_view, & decl );
-    }
-
-    return rc;
-}
-#endif
-
-/*
- * table-local-decl   = [ 'virtual' ] 'column' <column-decl>
- *                    | 'physical' [ 'column' ] <physical-decl>
- *                    | <production_stmt>
- */
-static
-rc_t table_local_decl ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, STable *table )
-{
-    rc_t rc;
-
-    switch ( t -> id )
-    {
-#if SLVL >= 8
-    case kw_default:
-        if ( env -> default_view_decl )
-        {
-            KToken t2;
-            if ( next_token ( tbl, src, & t2 ) -> id == kw_view )
-                return default_view_decl ( tbl, src, t, env, self, table );
-             KTokenSourceReturn ( src, & t2 );
-        }
-        /* no break */
-    case kw_extern:
-    case kw_column:
-    case kw_readonly:
-        return column_declaration ( tbl, src, t, env, self, table );
-#endif
-#if SLVL >= 7
-    case kw_static:
-    case kw_physical:
-        return physical_member ( tbl, src, t, env, self, table );
-#endif
-    case kw___untyped:
-        return untyped_tbl_expr ( tbl, src, t, env, self, table );
-#if 0
-    case kw_index:
-        break;
-#endif
-    case eSemiColon:
-        next_token ( tbl, src, t );
-        rc = 0;
-        break;
-
-    default:
-        rc = production_stmt ( tbl, src, t, env, self, & table -> prod, eTable );
-        if ( rc == 0 )
-            rc = expect ( tbl, src, t, eSemiColon, ";", true );
-    }
-
-    return rc;
-}
-
-/*
- * table-body         = '{' [ <table-decl-list> ] '}'
- *
- * table-decl-list    = <tbl-local-decl> ';' [ <table-decl-list> ]
- */
-typedef struct STableScanData STableScanData;
-struct STableScanData
-{
-    STable *self;
-    rc_t rc;
-};
-
-static
-bool CC table_fwd_scan ( BSTNode *n, void *data )
-{
-    STableScanData *pb = data;
-    KSymbol *sym = ( KSymbol* ) n;
-    STable *self = pb -> self;
-
-    /* process forwarded symbols */
-    if ( sym -> type == eForward )
-    {
-        /* this symbol was introduced in THIS table */
-        sym -> u . fwd . ctx = self -> id;
-
-        /* add it to the introduced virtual productions and make it virtual */
-        pb -> rc = VectorAppend ( & self -> vprods, & sym -> u . fwd . id, sym );
-        if ( pb -> rc != 0 )
-            return true;
-        sym -> type = eVirtual;
-    }
-    /* symbols other than fwd or virtual are ignored */
-    else if ( sym -> type != eVirtual )
-    {
-        return false;
-    }
-
-    /* add symbol to vector to track ownership */
-    pb -> rc = VectorAppend ( & self -> syms, NULL, sym );
-    if ( pb -> rc != 0 )
-        return true;
-
-    /* remove from symbol table */
-    BSTreeUnlink ( & self -> scope, & sym -> n );
-    return false;
-}
-
-static
-rc_t table_body ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, STable *table )
-{
-    rc_t rc = expect ( tbl, src, t, eLeftCurly, "{", true );
-    if ( rc != 0 )
-        return rc;
-
-    while ( t -> id != eRightCurly )
-    {
-        rc = table_local_decl ( tbl, src, t, env, self, table );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    rc = expect ( tbl, src, t, eRightCurly, "}", true );
-    if ( rc == 0 )
-    {
-        STableScanData pb;
-        pb . self = table;
-        pb . rc = 0;
-
-        /* scan table scope for unresolved forward references */
-        if ( BSTreeDoUntil ( & table -> scope, false, table_fwd_scan, & pb ) )
-            KTokenRCExplain ( t, klogInt, rc = pb . rc );
-    }
-
-    return rc;
-}
-
-/*
- * table-syntax
- */
-static
-bool CC table_prod_syntax ( void *item, void *data )
-{
-    rc_t *rc = data;
-    const SProduction *prod = ( const SProduction* ) item;
-
-    if ( ! prod -> trigger )
-        * rc = eval_expr_syntax ( prod -> fd );
-    if ( * rc == 0 )
-        * rc = eval_expr_syntax ( prod -> expr );
-
-    return ( * rc != 0 ) ? true : false;
-}
-
-static
-rc_t table_stmt_syntax ( const STable *table )
-{
-    rc_t rc = 0;
-    VectorDoUntil ( & table -> prod, false, table_prod_syntax, & rc );
-    return rc;
-}
-
-#if SLVL >= 8
-static
-bool CC table_typed_column_syntax ( void *item, void *data )
-{
-    rc_t *rc = data;
-    const SColumn *col = ( const SColumn* ) item;
-
-    if ( col -> read != NULL )
-        * rc = eval_expr_syntax ( col -> read );
-    if ( * rc == 0 && col -> validate != NULL )
-        * rc = eval_expr_syntax ( col -> validate );
-    if ( * rc == 0 && col -> limit != NULL )
-        * rc = eval_expr_syntax ( col -> limit );
-
-    return ( * rc != 0 ) ? true : false;
-}
-
-static
-rc_t table_column_syntax ( const STable *table )
-{
-    rc_t rc = 0;
-    VectorDoUntil ( & table -> col, false, table_typed_column_syntax, & rc );
-    return rc;
-}
-#endif
-
-#if SLVL >= 7
-static
-bool CC table_physcol_syntax ( void *item, void *data )
-{
-    rc_t *rc = data;
-    const SPhysMember *col = ( const SPhysMember* ) item;
-
-    if ( col -> expr == NULL )
-        return false;
-
-    * rc = eval_expr_syntax ( col -> expr );
-    return ( * rc != 0 ) ? true : false;
-}
-
-static
-rc_t table_physical_syntax ( const STable *table )
-{
-    rc_t rc = 0;
-    VectorDoUntil ( & table -> phys, false, table_physcol_syntax, & rc );
-    return rc;
-}
-#endif
-
-
-/*
- * push-tbl-scope
- * pop-tbl-scope
- */
-void pop_tbl_scope ( KSymTable *tbl, const STable *table )
-{
-    uint32_t i, count = VectorLength ( & table -> overrides );
-    for ( ++ count, i = 0; i < count; ++ i )
-        KSymTablePopScope ( tbl );
-}
-
-rc_t push_tbl_scope ( KSymTable *tbl, const STable *table )
-{
-    rc_t rc;
-    uint32_t i = VectorStart ( & table -> overrides );
-    uint32_t count = VectorLength ( & table -> overrides );
-    for ( count += i; i < count; ++ i )
-    {
-        const STableOverrides *to = ( const void* ) VectorGet ( & table -> overrides, i );
-        rc = KSymTablePushScope ( tbl, ( BSTree* ) & to -> dad -> scope );
-        if ( rc != 0 )
-        {
-            for ( count = VectorStart ( & table -> overrides ); i > count; -- i )
-                KSymTablePopScope ( tbl );
-            return rc;
-        }
-    }
-
-    rc = KSymTablePushScope ( tbl, ( BSTree* ) & table -> scope );
-    if ( rc != 0 )
-    {
-        for ( i = VectorStart ( & table -> overrides ); i < count; ++ i )
-            KSymTablePopScope ( tbl );
-    }
-
-    return rc;
-}
-
-/*
- * init-tbl-symtab
- *  initializes "tbl"
- *  places table in scope
- *  must be balanced by KSymTableWhack
- */
-rc_t init_tbl_symtab ( KSymTable *tbl, const VSchema *schema, const STable *table )
-{
-    rc_t rc = init_symtab ( tbl, schema );
-    if ( rc == 0 )
-    {
-        rc = push_tbl_scope ( tbl, table );
-        if ( rc == 0 )
-            return 0;
-
-        KSymTableWhack ( tbl );
-    }
-
-    return rc;
-}
-
-
-/*
- * table-decl         = 'table' <fqn> '#' <maj-min-rel>
- *                      [ '=' <table-name> ] <table-body>
- * table-body         = '{' [ <table-stmts> ] '}'
- * table-stmts        = <table-stmt> ';' [ <table-stmts> ]
- */
-static
-rc_t table_decl ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self, STable *table )
-{
-    /* table name */
-    rc_t rc = create_fqn ( tbl, src, t, env, eTable, NULL );
-    if ( rc != 0 && GetRCState ( rc ) != rcExists )
-        return KTokenFailure ( t, klogErr, rc, "table name" );
-    table -> name = t -> sym;
-    table -> src_file = t -> txt -> path;
-    table -> src_line = t -> lineno;
-
-    /* table version */
-    if ( next_token ( tbl, src, t ) -> id != eHash )
-        return KTokenExpected ( t, klogErr, "#" );
-    next_token ( tbl, src, t );
-    rc = maj_min_rel ( tbl, src, t, env, self, & table -> version, true );
-    if ( rc != 0 )
-        return rc;
-
-    /* prepare vectors */
-    VectorInit ( & table -> parents, 0, 4 );
-    VectorInit ( & table -> overrides, 0, 4 );
-    VectorInit ( & table -> col, 0, 16 );
-    VectorInit ( & table -> cname, 0, 16 );
-    VectorInit ( & table -> phys, 0, 16 );
-    VectorInit ( & table -> prod, 0, 64 );
-    VectorInit ( & table -> vprods, 1, 16 );
-    VectorInit ( & table -> syms, 1, 32 );
-
-    /* look for inheritance */
-    if ( t -> id == eAssign ) do
-    {
-        const STable *dad;
-        const SNameOverload *name;
-
-        /* look for dad */
-        rc = next_fqn ( tbl, src, next_token ( tbl, src, t ), env );
-        if ( rc != 0 )
-            return KTokenFailure ( t, klogErr, rc, "table name" );
-
-        /* insist that dad be a table */
-        if ( t -> id != eTable )
-            return KTokenExpected ( t, klogErr, "table name" );
-        name = t -> sym -> u . obj;
-
-        /* check for version */
-        if ( next_token ( tbl, src, t ) -> id != eHash )
-            dad = VectorLast ( & name -> items );
-        else
-        {
-            uint32_t vers;
-            next_token ( tbl, src, t );
-            rc = maj_min_rel ( tbl, src, t, env, self, & vers, true );
-            if ( rc != 0 )
-                return rc;
-            dad = VectorFind ( & name -> items, & vers, NULL, STableCmp );
-#if _DEBUGGING && 1
-            if ( dad != NULL && dad -> version > vers )
-            {
-                PLOGMSG ( klogInfo, ( klogInfo
-                                      , "table_decl: table '$(tbl)' specifies parent table '$(parent)' - should be $(actual_version)"
-                                      , "tbl=%N#%.3V,parent=%N#%.3V,actual_version=#%.3V"
-                                      , table -> name, table -> version
-                                      , dad -> name, vers
-                                      , dad -> version
-                              ));
-            }
-#endif
-        }
-
-        /* dad should be found */
-        if ( dad == NULL )
-        {
-            rc = RC ( rcVDB, rcSchema, rcParsing, rcTable, rcNotFound );
-            return KTokenRCExplain ( t, klogErr, rc );
-        }
-
-        /* take the inheritance */
-        rc = STableExtend ( tbl, table, dad );
-        if ( rc != 0 )
-            return KTokenRCExplain ( t, klogInt, rc );
-    }
-    while ( t -> id == eComma );
-
-    /* enter table into scope */
-    rc = push_tbl_scope ( tbl, table );
-    if ( rc == 0 )
-    {
-        /* scan override tables for virtual symbols */
-        if ( VectorDoUntil ( & table -> overrides, false, STableScanVirtuals, tbl ) )
-            rc = RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-
-        /* parse the definition */
-        else
-            rc = table_body ( tbl, src, t, env, self, table );
-
-        /* pop out of scope */
-        pop_tbl_scope ( tbl, table );
-    }
-
-    /* fix forward references */
-    if ( rc == 0 )
-    {
-        rc = table_stmt_syntax ( table );
-#if SLVL >= 8
-        if ( rc == 0 )
-            rc = table_column_syntax ( table );
-#endif
-#if SLVL >= 7
-        if ( rc == 0 )
-            rc = table_physical_syntax ( table );
-#endif
-    }
-
-    return rc;
-}
-
-static
-void CC column_set_context ( void *item, void *data )
-{
-    SColumn *self = item;
-    self -> cid . ctx = * ( const uint32_t* ) data;
-}
-
-static
-void CC name_set_context ( void *item, void *data )
-{
-    SNameOverload *self = item;
-    if ( ( int32_t ) self -> cid . ctx < 0 )
-        self -> cid . ctx = * ( const uint32_t* ) data;
-}
-
-static
-void CC physical_set_context ( void *item, void *data )
-{
-    SPhysMember *self = item;
-    self -> cid . ctx = * ( const uint32_t* ) data;
-}
-
-static
-void CC production_set_context ( void *item, void *data )
-{
-    SProduction *self = item;
-    self -> cid . ctx = * ( const uint32_t* ) data;
-}
-
-static
-void CC symbol_set_context ( void *item, void *data )
-{
-    KSymbol *self = item;
-    self -> u . fwd . ctx = * ( const uint32_t* ) data;
-}
-
-static
-void table_set_context ( STable *self )
-{
-    VectorForEach ( & self -> col, false, column_set_context, & self -> id );
-    VectorForEach ( & self -> cname, false, name_set_context, & self -> id );
-    VectorForEach ( & self -> phys, false, physical_set_context, & self -> id );
-    VectorForEach ( & self -> prod, false, production_set_context, & self -> id );
-    VectorForEach ( & self -> vprods, false, symbol_set_context, & self -> id );
-}
-
-#if NO_UPDATE_TBL_REF || 0
-#define schema_update_tbl_ref( self, exist, table ) \
-    0
-#else
-typedef struct update_tbl_ref_data update_tbl_ref_data;
-struct update_tbl_ref_data
-{
-    const STable *exist, *table;
-    rc_t rc;
-};
-
-static
-bool CC table_update_tbl_ref ( void *item, void *data )
-{
-    STable *self = item;
-    update_tbl_ref_data *pb = data;
-
-    bool is_ancestor;
-
-    /* check for having this guy as an immediate parent */
-    uint32_t i = VectorStart ( & self -> parents );
-    uint32_t count = VectorLength ( & self -> parents );
-    for ( count += i; i < count; ++ i )
-    {
-        STable *dad = VectorGet ( & self -> parents, i );
-        if ( ( const STable* ) dad == pb -> exist )
-        {
-            void *ignore;
-            VectorSwap ( & self -> parents, i, pb -> table, & ignore );
-            PARSE_DEBUG (( "table_update_tbl_ref: replaced parent '%N#%.3V' with version #%.3V in table '%N#%.3V'.\n"
-                           , dad -> name, dad -> version
-                           , pb -> table -> version
-                           , self -> name, self -> version
-                ));
-            break;
-        }
-    }
-
-    /* check for having him in the ancestry somewhere */
-    i = VectorStart ( & self -> overrides );
-    count = VectorLength ( & self -> overrides );
-    for ( is_ancestor = false, count += i; i < count; ++ i )
-    {
-        STableOverrides *to = VectorGet ( & self -> overrides, i );
-        if ( to -> dad == pb -> exist )
-        {
-            is_ancestor = true;
-
-            /* rewrite overrides to have updated parent */
-            VectorWhack ( & to -> overrides, NULL, NULL );
-            pb -> rc = VectorCopy ( & pb -> table -> vprods, & to -> overrides );
-            if ( pb -> rc != 0 )
-                return true;
-            to -> dad = pb -> table;
-            to -> ctx = pb -> table -> id;
-            VectorReorder ( & self -> overrides, STableOverridesKSort, NULL );
-            PARSE_DEBUG (( "table_update_tbl_ref: replaced ancestor '%N#%.3V' with version #%.3V in table '%N#%.3V'.\n"
-                           , pb -> exist -> name, pb -> exist -> version
-                           , pb -> table -> version
-                           , self -> name, self -> version
-                ));
-        }
-    }
-
-    /* if he's not an ancestor, we're done */
-    if ( ! is_ancestor )
-        return false;
-
-    /* remove columns from old parent */
-    i = VectorStart ( & self -> cname );
-    count = VectorLength ( & self -> cname );
-    for ( count += i; i < count; ++ i )
-    {
-        Vector cv;
-        uint32_t cx, cnt;
-        SNameOverload *name = VectorGet ( & self -> cname, i );
-
-        /* names originating in existing parent get mapped */
-        if ( name -> cid . ctx == pb -> exist -> id )
-        {
-            name -> cid . ctx = pb -> table -> id;
-            PARSE_DEBUG (( "table_update_tbl_ref: updated context of column name '%N' from %u to %u.\n"
-                           , name -> name
-                           , pb -> exist -> id
-                           , pb -> table -> id
-                ));
-        }
-
-        /* now copy over columns, but eliminate all from old parent */
-        cx = VectorStart ( & name -> items );
-        cnt = VectorLength ( & name -> items );
-        VectorInit ( & cv, cx, cnt );
-        for ( cnt += cx; cx < cnt; ++ cx )
-        {
-            SColumn *c = VectorGet ( & name -> items, cx );
-            if ( c -> cid . ctx == pb -> exist -> id )
-            {
-                PARSE_DEBUG (( "table_update_tbl_ref: dropping column index %u from name '%N'.\n"
-                               , cx
-                               , name -> name
-                    ));
-            }
-            else
-            {
-                pb -> rc = VectorAppend ( & cv, NULL, c );
-                if ( pb -> rc != 0 )
-                    return true;
-            }
-        }
-        VectorWhack ( & name -> items, NULL, NULL );
-        name -> items = cv;
-    }
-
-    /* add in all columns from new parent */
-    if ( VectorDoUntil ( & pb -> table -> cname, false, STableCopyColumnNames, self ) )
-    {
-        pb -> rc = RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-        return true;
-    }
-
-    return false;
-}
-
-static
-bool CC tblmbr_update_tbl_ref ( void *item, void *data )
-{
-    STblMember *self = item;
-    update_tbl_ref_data *pb = data;
-
-    if ( self -> tbl == pb -> exist )
-    {
-        PARSE_DEBUG (( "tblmbr_update_tbl_ref: updated table member '%N %N' from %V to %V.\n"
-                       , pb -> exist -> name
-                       , self -> name
-                       , pb -> exist -> version
-                       , pb -> table -> version
-                ));
-        self -> tbl = pb -> table;
-    }
-
-    return false;
-}
-
-static
-bool CC db_update_tbl_ref ( void *item, void *data )
-{
-    SDatabase *self = item;
-
-    /* update table members */
-    if ( VectorDoUntil ( & self -> tbl, false, tblmbr_update_tbl_ref, data ) )
-        return true;
-
-    return VectorDoUntil ( & self -> db, false, db_update_tbl_ref, data );
-}
-
-static
-rc_t schema_update_tbl_ref ( VSchema *self, const STable *exist, const STable *table )
-{
-    update_tbl_ref_data pb;
-    pb . exist = exist;
-    pb . table = table;
-    pb . rc = 0;
-
-    if ( ! VectorDoUntil ( & self -> tbl, false, table_update_tbl_ref, & pb ) )
-          VectorDoUntil ( & self -> db, false, db_update_tbl_ref, & pb );
-
-    return pb . rc;
-}
-#endif
-
-rc_t table_declaration ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self )
-{
-    rc_t rc;
-    void *ignore;
-
-    STable *table = calloc ( 1, sizeof * table );
-    if ( table == NULL )
-    {
-        rc = RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-        return KTokenRCExplain ( t, klogInt, rc );
-    }
-
-    rc = table_decl ( tbl, src, t, env, self, table );
-    if ( rc == 0 )
-    {
-        SNameOverload *name = ( void* ) table -> name -> u . obj;
-        if ( name == NULL )
-        {
-            rc = SNameOverloadMake ( & name, table -> name, 0, 4 );
-            if ( rc == 0 )
-            {
-                rc = VectorAppend ( & self -> tname, & name -> cid . id, name );
-                if ( rc != 0 )
-                    SNameOverloadWhack ( name, NULL );
-            }
-        }
-
-        if ( rc == 0 )
-        {
-            rc = VectorAppend ( & self -> tbl, & table -> id, table );
-            if ( rc == 0 )
-            {
-                uint32_t idx;
-
-                /* set the table id on all members */
-                table_set_context ( table );
-
-                /* add to named table overrides */
-                rc = VectorInsertUnique ( & name -> items, table, & idx, STableSort );
-                if ( rc == 0 )
-                    return 0;
-
-                if ( GetRCState ( rc ) == rcExists )
-                {
-                    const STable *newer;
-                    STable *exist = VectorGet ( & name -> items, idx );
-                    rc = STableCompare ( exist, table, & newer, false );
-                    if ( rc == 0 && newer == table )
-                    {
-                        /* put the new one in place of the existing */
-                        VectorSwap ( & name -> items, idx, table, & ignore );
-
-                        /* tell everyone to use new table */
-                        return schema_update_tbl_ref ( self, exist, table );
-                    }
-                }
-
-                VectorSwap ( & self -> tbl, table -> id, NULL, & ignore );
-            }
-        }
-    }
-    else if ( GetRCState ( rc ) == rcExists )
-    {
-        rc = 0;
-    }
-
-    STableWhack ( table, NULL );
-
-    return rc;
-}
-
-#endif
diff --git a/libs/vdb/schema-tok.c b/libs/vdb/schema-tok.c
deleted file mode 100644
index 94a456d..0000000
--- a/libs/vdb/schema-tok.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-#include "schema-tok.h"
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * KToken
- */
-
-
-rc_t KTokenRCExplain ( const KToken *self, KLogLevel lvl, rc_t rc )
-{
-    if ( rc != 0 )
-    {
-        PLOGERR (lvl, ( lvl, rc, "$(file):$(lineno)", "file=%.*s,lineno=%u"
-                   , ( int ) self -> txt -> path . size, self -> txt -> path . addr
-                   , self -> lineno ));
-    }
-    return rc;
-}
-
-rc_t KTokenFailure ( const KToken *self, KLogLevel lvl, rc_t rc, const char *expected )
-{
-    if ( GetRCState ( rc ) != rcUnexpected )
-        return KTokenRCExplain ( self, lvl, rc );
-
-    PLOGMSG ( lvl, ( lvl, "$(file):$(lineno): "
-               "expected '$(expected)' but found '$(found)'",
-               "file=%.*s,lineno=%u,expected=%s,found=%.*s"
-               , ( int ) self -> txt -> path . size, self -> txt -> path . addr
-               , self -> lineno
-               , expected
-               , ( int ) self -> str . size, self -> str . addr ));
-
-    return rc;
-}
-
-rc_t KTokenExpected ( const KToken *self, KLogLevel lvl, const char *expected )
-{
-    return KTokenFailure ( self, lvl,
-        RC ( rcVDB, rcSchema, rcParsing, rcToken, rcUnexpected ), expected );
-}
diff --git a/libs/vdb/schema-tok.h b/libs/vdb/schema-tok.h
deleted file mode 100644
index bdad9dd..0000000
--- a/libs/vdb/schema-tok.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_schema_tok_
-#define _h_schema_tok_
-
-#ifndef _h_klib_token_
-#include <klib/token.h>
-#endif
-
-#ifndef _h_klib_log_
-#include <klib/log.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-
-/*--------------------------------------------------------------------------
- * KToken
- *  a string with an id
- */
-
-
-/* common error reporting
- */
-rc_t KTokenExpected ( const KToken *self, KLogLevel lvl, const char *expected );
-rc_t KTokenFailure ( const KToken *self, KLogLevel lvl, rc_t rc, const char *expected );
-rc_t KTokenRCExplain ( const KToken *self, KLogLevel lvl, rc_t rc );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_schema_tok_ */
diff --git a/libs/vdb/schema-type.c b/libs/vdb/schema-type.c
deleted file mode 100644
index dcd729d..0000000
--- a/libs/vdb/schema-type.c
+++ /dev/null
@@ -1,2573 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#include "schema-priv.h"
-#include "schema-parse.h"
-#include "schema-expr.h"
-#include "schema-dump.h"
-#include "dbmgr-priv.h"
-
-#include <sra/types.h>
-#include <klib/symbol.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * SFormat
- */
-
-/* Find
- */
-SFormat *VSchemaFindFmtid ( const VSchema *self, uint32_t id )
-{
-    SFormat *fmt = VectorGet ( & self -> fmt, id );
-    while ( fmt == NULL )
-    {
-        self = self -> dad;
-        if ( self == NULL )
-            break;
-        fmt = VectorGet ( & self -> fmt, id );
-    }
-    return fmt;
-}
-
-/* Mark
- */
-void CC SFormatClearMark ( void *item, void *ignore )
-{
-    SFormat *self = item;
-    self -> marked = false;
-}
-
-void SFormatMark ( const SFormat *cself )
-{
-    SFormat *self = ( SFormat* ) cself;
-    if ( cself != NULL && ! cself -> marked )
-    {
-        self -> marked = true;
-        SFormatMark ( self -> super );
-    }
-}
-
-
-/* Dump
- *  dump "fmtdef", dump object
- */
-rc_t SFormatDump ( const SFormat *self, SDumper *b )
-{
-    return FQNDump ( self != NULL ? self -> name : NULL, b );
-}
-
-bool CC SFormatDefDump ( void *item, void *data )
-{
-    SDumper *b = data;
-    const SFormat *self = ( const void* ) item;
-
-    if ( SDumperMarkedMode ( b ) && ! self -> marked )
-        return false;
-
-    if ( SDumperMode ( b ) == sdmCompact )
-    {
-        b -> rc = ( self -> super != NULL ) ?
-            SDumperPrint ( b, "fmtdef %N %N;", self -> super -> name, self -> name ):
-            SDumperPrint ( b, "fmtdef %N;", self -> name );
-    }
-    else
-    {
-        b -> rc = ( self -> super != NULL ) ?
-            SDumperPrint ( b, "fmtdef %N %N;\n", self -> super -> name, self -> name ):
-            SDumperPrint ( b, "fmtdef %N;\n", self -> name );
-    }
-
-    if ( b -> rc == 0 )
-        b -> rc = AliasDump ( self -> name, b );
-
-    return ( b -> rc != 0 ) ? true : false;
-}
-
-
-/*--------------------------------------------------------------------------
- * SDatatype
- */
-
-/* IntrinsicDim
- */
-#if SLVL >= 1
-uint32_t SDatatypeIntrinsicDim ( const SDatatype *self )
-{
-    uint32_t dim = 1;
-    while ( 1 )
-    {
-        /* if type has no supertype or supertype is opaque
-           then this is the base intrinsic type */
-        const SDatatype *super = self -> super;
-        if ( super == NULL || super -> domain == 0 )
-            break;
-
-        /* accumulate the vector dimension of this type */
-        dim *= self -> dim;
-        self = super;
-    }
-
-    return dim;
-}
-
-/* Find
- */
-SDatatype *VSchemaFindTypeid ( const VSchema *self, uint32_t id )
-{
-    SDatatype *dt = VectorGet ( & self -> dt, id );
-    while ( dt == NULL )
-    {
-        self = self -> dad;
-        if ( self == NULL )
-            break;
-        dt = VectorGet ( & self -> dt, id );
-    }
-    return dt;
-}
-
-
-/* DescribeTypedecl
- *  produce a description of typedecl properties
- */
-LIB_EXPORT rc_t CC VSchemaDescribeTypedecl ( const VSchema *self,
-    VTypedesc *desc, const VTypedecl *td )
-{
-    rc_t rc;
-    if ( desc == NULL )
-        rc = RC ( rcVDB, rcSchema, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcSchema, rcAccessing, rcSelf, rcNull );
-        else if ( td == NULL )
-            rc = RC ( rcVDB, rcSchema, rcAccessing, rcParam, rcNull );
-        else
-        {
-            const SDatatype *dt = VSchemaFindTypeid ( self, td -> type_id );
-            if ( dt == NULL )
-                rc = RC ( rcVDB, rcSchema, rcAccessing, rcType, rcNotFound );
-            else
-            {
-                /* initial dimension from typedecl itself */
-                desc -> intrinsic_dim = td -> dim ? td -> dim : 1;
-
-                /* domain comes from the original type */
-                desc -> domain = dt -> domain;
-
-                while ( 1 )
-                {
-                    const SDatatype *super = dt -> super;
-                    if ( super == NULL || super -> domain == 0 )
-                        break;
-
-                    /* become supertype */
-                    assert ( super != dt );
-                    desc -> intrinsic_dim *= dt -> dim;
-                    dt = super;
-                }
-
-                /* take size from intrinsic */
-                desc -> intrinsic_bits = dt -> size;
-                return 0;
-            }
-        }
-
-        memset ( desc, 0, sizeof * desc );
-    }
-    return rc;
-}
-
-
-/* DescribeTypedef - PRIVATE
- *  a type is defined as either:
- *
- *     'typedef' <type> ';'
- *  or
- *     'typedef' <supertype> <type> '[' <dim> ']' ';'
- */
-LIB_EXPORT rc_t CC VSchemaDescribeTypedef ( const VSchema *self,
-    VTypedef *def, uint32_t type_id )
-{
-    rc_t rc;
-    if ( def == NULL )
-        rc = RC ( rcVDB, rcSchema, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcSchema, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            const SDatatype *dt = VSchemaFindTypeid ( self, type_id );
-            if ( dt == NULL )
-                rc = RC ( rcVDB, rcSchema, rcAccessing, rcType, rcNotFound );
-            else
-            {
-                /* id of <type> */
-                def -> type_id = dt -> id;
-
-                /* check for supertype */
-                if ( dt -> super == NULL )
-                {
-                    /* null id */
-                    def -> super_id = 0;
-                    /* sizeof ( <type> ) in bits */
-                    def -> type_size = dt -> size;
-                    assert ( dt -> dim <= 1 );
-                }
-                else
-                {
-                    /* id of <supertype> */
-                    def -> super_id = dt -> super -> id;
-                    /* sizeof ( <super-type> ) in bits */
-                    def -> type_size = dt -> super -> size;
-                }
-
-                /* 'dim' from 'typedef <supertype> <type> [ dim ];' */
-                def -> dim = dt -> dim;
-
-                /* the only bit of domain information is whether the type is signed */
-                def -> sign = 0;
-                switch ( dt -> domain )
-                {
-                case vtdInt:
-                case vtdFloat:
-                    def -> sign = 1;
-                    break;
-                }
-
-                return 0;
-            }
-        }
-
-        memset ( def, 0, sizeof * def );
-    }
-
-    return rc;
-}
-
-/* Mark
- */
-void CC SDatatypeClearMark ( void *item, void *ignore )
-{
-    SDatatype *self = item;
-    self -> marked = false;
-}
-
-void SDatatypeMark ( const SDatatype *cself )
-{
-    SDatatype *self = ( SDatatype* ) cself;
-    if ( cself != NULL && ! cself -> marked )
-    {
-        self -> marked = true;
-        SDatatypeMark ( self -> super );
-    }
-}
-
-/* Dump
- */
-rc_t SDatatypeDump ( const SDatatype *self, SDumper *d )
-{
-    return FQNDump ( self != NULL ? self -> name : NULL, d );
-}
-
-bool CC SDatatypeDefDump ( void *item, void *data )
-{
-    SDumper *b = data;
-    const char *dimfmt;
-    const SDatatype *self = ( const void* ) item;
-
-    if ( SDumperMarkedMode ( b ) && ! self -> marked )
-        return false;
-
-    switch ( SDumperMode ( b ) )
-    {
-    case sdmCompact:
-        dimfmt = "[%u]"; break;
-    default:
-        dimfmt = " [ %u ]";
-    }
-
-    b -> rc = SDumperPrint ( b, "typedef %N %N",
-        self -> super -> name, self -> name );
-    if ( b -> rc == 0 && self -> dim > 1 )
-        b -> rc = SDumperPrint ( b, dimfmt, self -> dim );
-    if ( b -> rc == 0 )
-    {
-        if ( SDumperMode ( b ) == sdmCompact )
-            b -> rc = SDumperWrite ( b, ";", 1 );
-        else
-        {
-#if _DEBUGGING && 1
-            b -> rc = SDumperPrint ( b, "; /* size %u */\n", self -> size );
-#else
-            b -> rc = SDumperWrite ( b, ";\n", 2 );
-#endif
-        }
-    }
-
-    if ( b -> rc == 0 )
-        b -> rc = AliasDump ( self -> name, b );
-
-    return ( b -> rc != 0 ) ? true : false;
-}
-#endif
-
-/*--------------------------------------------------------------------------
- * STypesetMbr
- *  a typedecl that can be tested for uniqueness
- */
-typedef struct STypesetMbr STypesetMbr;
-struct STypesetMbr
-{
-    BSTNode n;
-    VTypedecl td;
-};
-
-/* Whack
- */
-#define STypesetMbrWhack BSTreeMbrWhack
-
-/* Cmp
- * Sort
- */
-static
-int VTypedeclCmp ( const VTypedecl *a, const VTypedecl *b )
-{
-    if ( a -> type_id != b -> type_id )
-        return ( int ) a -> type_id - ( int ) b -> type_id;
-    return ( int ) a -> dim - ( int ) b -> dim;
-}
-
-static
-int CC STypesetMbrSort ( const BSTNode *item, const BSTNode *n )
-{
-    const STypesetMbr *a = ( const STypesetMbr* ) item;
-    const STypesetMbr *b = ( const STypesetMbr* ) n;
-    return VTypedeclCmp ( & a -> td, & b -> td );
-}
-
-
-/*--------------------------------------------------------------------------
- * VTypedecl
- */
-
-#if SLVL >= 1
-
-/* ToText
- *  convert a VTypedecl into canonical text
- *
- *  "buffer" [ OUT ] and "bsize" [ IN ] - output buffer for
- *  NUL terminated type declaration string
- *
- *  "fmtdecl" [ IN ] - binary representation of fmtdecl
- */
-LIB_EXPORT rc_t CC VTypedeclToText ( const VTypedecl *self,
-    const VSchema *schema, char *buffer, size_t bsize )
-{
-    rc_t rc;
-
-    if ( bsize == 0 )
-        rc = RC ( rcVDB, rcType, rcConverting, rcBuffer, rcInsufficient );
-    else if ( buffer == NULL )
-        rc = RC ( rcVDB, rcType, rcConverting, rcBuffer, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcType, rcConverting, rcSelf, rcNull );
-        else if ( schema == NULL )
-            rc = RC ( rcVDB, rcType, rcConverting, rcSchema, rcNull );
-        else
-        {
-            size_t num_writ;
-            rc = VSchemaToText ( schema, buffer, bsize - 1, & num_writ, "%T", self );
-            if ( rc == 0 )
-            {
-                buffer [ num_writ ] = 0;
-                return 0;
-            }
-        }
-
-        buffer [ 0 ] = 0;
-    }
-
-    return rc;
-}
-
-
-/* ToSupertype
- *  attempt to cast a typedecl to a size-equivalent supertype decl
- *
- *  "schema" [ IN ] - schema object that would know about this type
- *
- *  "cast" [ OUT ] - return parameter for supertype decl
- *  valid only if function returns true.
- *
- *  returns true if cast succeeded
- */
-LIB_EXPORT bool CC VTypedeclToSupertype ( const VTypedecl *self,
-    const VSchema *schema, VTypedecl *cast )
-{
-    if ( self != NULL && schema != NULL )
-    {
-        const SDatatype *dt = VSchemaFindTypeid ( schema, self -> type_id );
-        if ( dt != NULL )
-        {
-            uint32_t dim = dt -> dim;
-            dt = dt -> super;
-            if ( dt != NULL && dt -> domain != 0 )
-            {
-                if ( cast != NULL )
-                {
-                    cast -> type_id = dt -> id;
-                    cast -> dim = self -> dim * dim;
-                }
-
-                return true;
-            }
-        }
-    }
-    return false;
-}
-
-
-/* ToTypedecl
- *  attempt to cast a typedecl to a size-equivalent ancestor decl
- *
- *  "schema" [ IN ] - schema object that would know about this type
- *
- *  "ancestor" [ IN ] - target typedecl or typeset for cast
- *
- *  "cast" [ OUT, NULL ] - return parameter for ancestor decl
- *  valid only if function returns true. if "ancestor" was a typeset,
- *  the value of "cast" will be the closest matching ancestral type.
- *
- *  "distance" [ OUT, NULL OKAY ] - optional linear measure of casting
- *  generations. valid only if function returns true. a value of 0 means
- *  that "self" is a direct match with "ancestor", a value of 1 means that
- *  "self" is an immediate subtype of "ancestor", etc.
- *
- *  returns true if cast succeeded
- */
-static
-bool VTypedecl2Typedecl ( const VTypedecl *self,
-    const VSchema *schema, const VTypedecl *ancestor,
-    VTypedecl *cast, uint32_t *distance )
-{
-    const SDatatype *src;
-    uint32_t i, type_id = self -> type_id;
-    uint32_t gramps = ancestor -> type_id;
-    uint32_t dim = self -> dim;
-
-    /* casting from "any" */
-    if ( type_id == 0 )
-    {
-        /* "any" to "any" isn't a cast... or is it? */
-        if ( gramps == 0 )
-            return false;
-
-        /* produce output */
-        if ( cast != NULL && ( const VTypedecl* ) cast != ancestor )
-            * cast = * ancestor;
-
-        /* record distance */
-        if ( distance != NULL )
-            * distance = 0;
-
-        return true;
-    }
-
-    /* casting to "any" */
-    if ( gramps == 0 )
-    {
-        /* produce output */
-        if ( cast != NULL && ( const VTypedecl* ) cast != self )
-            * cast = * self;
-
-        /* record distance */
-        if ( distance != NULL )
-            * distance = 0;
-
-        return true;
-    }
-
-    /* special case for identity */
-    if ( type_id == gramps )
-    {
-        /* detect variable dimension */
-        if ( dim == 0 )
-        {
-            dim = ancestor -> dim;
-            if ( ancestor -> dim == 0 )
-                return false;
-        }
-
-        /* if ancestor has variable dimension */
-        if ( ancestor -> dim == 0 )
-        {
-            if ( cast != NULL )
-            {
-                cast -> type_id = type_id;
-                cast -> dim = dim;
-            }
-        }
-        else
-        {
-            /* must have identical fixed dimension */
-            if ( dim != ancestor -> dim )
-                return false;
-
-            /* produce output */
-            if ( cast != NULL && ( const VTypedecl* ) cast != ancestor )
-                * cast = * ancestor;
-        }
-
-        /* record distance */
-        if ( distance != NULL )
-            * distance = 0;
-
-        return true;
-    }
-    /***** Temporary fix for duplicate types****/
-    {
-	char bufa[100];
-	char bufb[100];
-	if(   self->dim == ancestor->dim
-	   && VTypedeclToText(     self, schema, bufa, sizeof(bufa))== 0
-           && VTypedeclToText( ancestor, schema, bufb, sizeof(bufb))== 0
-           && strcmp(bufa,bufb) == 0){
-		if ( cast != NULL && ( const VTypedecl* ) cast != ancestor ) * cast = * ancestor;
-		if ( distance != NULL ) * distance = 0;
-		return true;
-        }
-    }
-	
-    /************************/
-
-    /* find type */
-    src = VSchemaFindTypeid ( schema, type_id );
-    if ( src == NULL )
-        return false;
-
-    /* cast toward gramps */
-    for ( i = 0; src -> id > gramps; ++ i )
-    {
-        dim *= src -> dim;
-        src = src -> super;
-        if ( src == NULL || src -> domain == 0 )
-            return false;
-    }
-
-    /* if not met */
-    if ( src -> id != gramps )
-        return false;
-
-    /* handle variable dimension */
-    if ( dim == 0 )
-    {
-        dim = ancestor -> dim;
-        if ( ancestor -> dim == 0 )
-            return false;
-    }
-    if ( ancestor -> dim == 0 )
-    {
-        if ( cast != NULL )
-        {
-            cast -> type_id = gramps;
-            cast -> dim = dim;
-        }
-    }
-    else
-    {
-        if ( dim != ancestor -> dim )
-            return false;
-        if ( cast != NULL && ( const VTypedecl* ) cast != ancestor )
-            * cast = * ancestor;
-    }
-
-    /* produce output */
-    if ( distance != NULL )
-        * distance = i;
-                            
-    return true;
-}
-
-static
-bool STypesetdecl2Typedecl ( const STypeset *self, uint32_t sdim,
-    const VSchema *schema,  const VTypedecl *ancestor,
-    VTypedecl *cast, uint32_t *distance )
-{
-    bool early;
-    VTypedecl btd;
-    uint32_t i, count, best;
-
-    /* ambiguous if casting to "any" */
-    if ( ancestor -> type_id == 0 )
-        return false;
-
-    /* can exit early if only testing castability */
-    early = ( cast == NULL && distance == NULL ) ? true : false;
-
-    /* walk set */
-    for ( best = ~ 0U, count = self -> count, i = 0; i < count; ++ i )
-    {
-        uint32_t dist;
-
-        /* convert set member to vector */
-        VTypedecl td = self -> td [ i ];
-        td . dim *= sdim;
-
-        /* cast to ancestor */
-        if ( VTypedecl2Typedecl ( & td, schema, ancestor, & td, & dist ) )
-        {
-            /* if only testing castability */
-            if ( early )
-                return true;
-
-            /* if match is better */
-            if ( dist < best )
-            {
-                if ( distance != NULL )
-                    * distance = dist;
-                if ( dist == 0 )
-                {
-                    if ( cast != NULL )
-                        * cast = td;
-                    return true;
-                }
-
-                btd = td;
-                best = dist;
-            }
-        }
-    }
-
-    if ( ( int32_t ) best > 0 )
-    {
-        if ( cast != NULL )
-            * cast = btd;
-        return true;
-    }
-
-    return false;
-}
-
-static
-bool VTypedecl2STypesetdecl ( const VTypedecl *self,
-    const VSchema *schema, const STypeset *dst, uint32_t ddim,
-    VTypedecl *cast, uint32_t *distance )
-{
-    const SDatatype *src;
-    uint32_t i, j, count, type_id, sdim;
-
-    /* ambiguous if casting from "any" */
-    if ( self -> type_id == 0 )
-        return false;
-
-    /* find source type */
-    src = VSchemaFindTypeid ( schema, self -> type_id );
-    if ( src == NULL )
-        return false;
-
-    /* current dimension */
-    sdim = self -> dim;
-
-    /* perform cast */
-    for ( count = dst -> count, type_id = src -> id, i = 0; ; type_id = src -> id, ++ i )
-    {
-        /* scan set for type match */
-        for ( j = 0; j < count; ++ j )
-        {
-            if ( type_id == dst -> td [ j ] . type_id )
-            {
-                /* this is a hit on type */
-                if ( sdim == dst -> td [ j ] . dim * ddim )
-                {
-                    /* best match is first match */
-                    if ( distance != NULL )
-                        * distance = i;
-                    if ( cast != NULL )
-                    {
-                        cast -> type_id = type_id;
-                        cast -> dim = sdim;
-                    }
-                    return true;
-                }
-                break;
-            }
-        }
-
-        /* did not match any of them */
-        sdim *= src -> dim;
-        src = src -> super;
-        if ( src == NULL || src -> domain == 0 )
-            break;
-    }
-
-    return false;
-}
-
-static
-bool VTypesetdeclToTypedecl ( const VTypedecl *self,
-    const VSchema *schema,  const VTypedecl *ancestor,
-    VTypedecl *cast, uint32_t *distance )
-{
-    /* find source typeset */
-    const STypeset *src = VSchemaFindTypesetid ( schema, self -> type_id );
-
-    /* not found or empty */
-    if ( src == NULL || src -> count == 0 )
-        return false;
-
-    /* if has single type */
-    if ( src -> count == 1 )
-    {
-        VTypedecl td = src -> td [ 0 ];
-        td . dim *= self -> dim;
-        return VTypedecl2Typedecl ( & td, schema, ancestor, cast, distance );
-    }
-
-    /* perform cast */
-    return STypesetdecl2Typedecl ( src, self -> dim, schema, ancestor, cast, distance );
-}
-
-static
-bool VTypedeclToTypesetdecl ( const VTypedecl *self,
-    const VSchema *schema,  const VTypedecl *ancestor,
-    VTypedecl *cast, uint32_t *distance )
-{
-    /* find ancestor typeset */
-    const STypeset *dst = VSchemaFindTypesetid ( schema, ancestor -> type_id );
-
-    /* if not found or empty */
-    if ( dst == NULL || dst -> count == 0 )
-        return false;
-
-    /* if has a single type */
-    if ( dst -> count == 1 )
-    {
-        VTypedecl td = dst -> td [ 0 ];
-        td . dim *= ancestor -> dim;
-        return VTypedecl2Typedecl ( self, schema, & td, cast, distance );
-    }
-
-    /* find best match */
-    return VTypedecl2STypesetdecl ( self, schema, dst, ancestor -> dim, cast, distance );
-}
-
-static
-bool VTypesetdeclToTypesetdecl ( const VTypedecl *self,
-    const VSchema *schema,  const VTypedecl *ancestor,
-    VTypedecl *cast, uint32_t *distance )
-{
-    bool early;
-    VTypedecl btd, td;
-    uint32_t i, count, best;
-    const STypeset * src, *dst;
-
-    /* find source typeset */
-    src = VSchemaFindTypesetid ( schema, self -> type_id );
-
-    /* not found or empty */
-    if ( src == NULL || src -> count == 0 )
-        return false;
-
-    /* find ancestor typeset */
-    dst = VSchemaFindTypesetid ( schema, ancestor -> type_id );
-
-    /* if not found or empty */
-    if ( dst == NULL || dst -> count == 0 )
-        return false;
-
-    /* if has a single type */
-    if ( src -> count == 1 )
-    {
-        td = src -> td [ 0 ];
-        td . dim *= self -> dim;
-        if ( dst -> count == 1 )
-        {
-            btd = dst -> td [ 0 ];
-            btd . dim *= ancestor -> dim;
-            return VTypedecl2Typedecl ( & td, schema, & btd, cast, distance );
-        }
-        return VTypedecl2STypesetdecl ( & td, schema, dst, ancestor -> dim, cast, distance );
-    }
-    if ( dst -> count == 1 )
-    {
-        td = dst -> td [ 0 ];
-        td . dim *= ancestor -> dim;
-        return STypesetdecl2Typedecl ( src, self -> dim, schema, & td, cast, distance );
-    }
-
-    /* can exit early if only testing castability */
-    early = ( cast == NULL && distance == NULL ) ? true : false;
-
-    /* full matrix scan */
-    for ( best = ~ 0U, count = src -> count, i = 0; i < count; ++ i )
-    {
-        uint32_t dist;
-
-        td = src -> td [ i ];
-        td . dim *= self -> dim;
-
-        if ( VTypedecl2STypesetdecl ( & td, schema, dst, ancestor -> dim, & td, & dist ) )
-        {
-            if ( early )
-                return true;
-
-            if ( dist < best )
-            {
-                if ( distance != NULL )
-                    * distance = dist;
-                if ( dist == 0 )
-                {
-                    if ( cast != NULL )
-                        * cast = td;
-                    return true;
-                }
-                btd = td;
-                best = dist;
-            }
-        }
-    }
-
-    if ( ( int32_t ) best > 0 )
-    {
-        if ( cast != NULL )
-            * cast = btd;
-        return true;
-    }
-
-    return false;
-}
-
-LIB_EXPORT bool CC VTypedeclToTypedecl ( const VTypedecl *self, const VSchema *schema,
-    const VTypedecl *ancestor, VTypedecl *cast, uint32_t *distance )
-{
-    if ( self == NULL || schema == NULL || ancestor == NULL )
-        return false;
-
-    /* source is typeset */
-    if ( self -> type_id >= 0x40000000 )
-    {
-        /* typeset => typeset */
-        if ( ancestor -> type_id >= 0x40000000 )
-            return VTypesetdeclToTypesetdecl ( self, schema, ancestor, cast, distance );
-
-        /* typeset => typedecl */
-        return VTypesetdeclToTypedecl ( self, schema, ancestor, cast, distance );
-    }
-
-    /* ancestor is typeset */
-    if ( ancestor -> type_id >= 0x40000000 )
-    {
-        /* typedecl => typeset */
-        return VTypedeclToTypesetdecl ( self, schema, ancestor, cast, distance );
-    }
-
-    /* typedecl => typedecl */
-    return VTypedecl2Typedecl ( self, schema, ancestor, cast, distance );
-}
-
-
-/* ToType
- *  attempt to cast a typedecl to a size-equivalent ancestor decl
- *
- *  "schema" [ IN ] - schema object that would know about this type
- *
- *  "ancestor" [ IN ] - target type or typeset for cast
- *
- *  "cast" [ OUT ] - return parameter for ancestor decl
- *  valid only if function returns true. if "ancestor" was a typeset,
- *  the value of "cast" will be the closest matching ancestral type.
- *
- *  "distance" [ OUT, NULL OKAY ] - optional linear measure of casting
- *  generations. valid only if function returns true. a value of 0 means
- *  that "self" is a direct match with "ancestor", a value of 1 means that
- *  "self" is an immediate subtype of "ancestor", etc.
- *
- *  returns true if cast succeeded
- */
-static
-bool VTypedecl2Type ( const VTypedecl *self,
-    const VSchema *schema, uint32_t gramps,
-    VTypedecl *cast, uint32_t *distance )
-{
-    const SDatatype *src;
-    uint32_t i, dim, type_id = self -> type_id;
-
-    /* cannot produce a valid typedecl if self is "any" or dimension is variable */
-    if ( type_id == 0 || self -> dim == 0 )
-        return false;
-
-    /* casting to "any" or identity */
-    if ( gramps == 0 || type_id == gramps)
-    {
-        if ( cast != NULL && ( const VTypedecl* ) cast != self )
-            * cast = * self;
-        if ( distance != NULL )
-            * distance = 0;
-        return true;
-    }
-
-    /* find type */
-    src = VSchemaFindTypeid ( schema, type_id );
-    if ( src == NULL )
-        return false;
-
-    /* cast toward gramps */
-    for ( dim = self -> dim, i = 0; src -> id > gramps; ++ i )
-    {
-        dim *= src -> dim;
-        src = src -> super;
-        if ( src == NULL || src -> domain == 0 )
-            return false;
-    }
-
-    /* if not met */
-    if ( src -> id != gramps )
-        return false;
-
-    /* produce output */
-    if ( distance != NULL )
-        * distance = i;
-                            
-    if ( cast != NULL )
-    {
-        cast -> type_id = gramps;
-        cast -> dim = dim;
-    }
-
-    return true;
-}
-
-static
-bool STypesetdecl2Type ( const STypeset *self, uint32_t sdim,
-    const VSchema *schema, uint32_t gramps,
-    VTypedecl *cast, uint32_t *distance )
-{
-    bool early;
-    VTypedecl btd;
-    uint32_t i, count, best;
-
-    /* ambiguous if casting to "any" */
-    if ( gramps == 0 )
-        return false;
-
-    /* can exit early if only testing castability */
-    early = ( cast == NULL && distance == NULL ) ? true : false;
-
-    /* cast all to ancestor */
-    for ( best = ~ 0U, count = self -> count, i = 0; i < count; ++ i )
-    {
-        uint32_t dist;
-
-        VTypedecl td;
-        td = self -> td [ i ];
-        td . dim *= sdim;
-
-        if ( VTypedecl2Type ( & td, schema, gramps, & td, & dist ) )
-        {
-            /* if only testing castability */
-            if ( early )
-                return true;
-
-            /* if match is better */
-            if ( dist < best )
-            {
-                if ( distance != NULL )
-                    * distance = dist;
-                if ( dist == 0 )
-                {
-                    if ( cast != NULL )
-                        * cast = td;
-                    return true;
-                }
-                btd = td;
-                best = dist;
-            }
-        }
-    }
-
-    if ( ( int32_t ) best > 0 )
-    {
-        if ( cast != NULL )
-            * cast = btd;
-        return true;
-    }
-
-    return false;
-}
-
-static
-bool VTypesetdeclToType ( const VTypedecl *self, const VSchema *schema,
-    uint32_t gramps, VTypedecl *cast, uint32_t *distance )
-{
-    /* find source typeset */
-    const STypeset *src = VSchemaFindTypesetid ( schema, self -> type_id );
-
-    /* not found or empty */
-    if ( src == NULL || src -> count == 0 )
-        return false;
-
-    /* if has single type */
-    if ( src -> count == 1 )
-    {
-        VTypedecl td = src -> td [ 0 ];
-        td . dim *= self -> dim;
-        return VTypedecl2Type ( & td, schema, gramps, cast, distance );
-    }
-
-    /* perform cast */
-    return STypesetdecl2Type ( src, self -> dim, schema, gramps, cast, distance );
-}
-
-LIB_EXPORT bool CC VTypedeclToType ( const VTypedecl *self, const VSchema *schema,
-    uint32_t ancestor, VTypedecl *cast, uint32_t *distance )
-{
-    if ( self == NULL || schema == NULL )
-        return false;
-
-    /* if casting to typeset */
-    if ( ancestor >= 0x40000000 )
-    {
-        /* convert ancestor to VTypedecl,
-           since the operation will be identical
-           due to the fact that the typeset contents
-           will have dimension, i.e. dimensions must match */
-        VTypedecl td;
-        td . type_id = ancestor;
-        td . dim = 1;
-
-        /* typeset => typeset */
-        if ( self -> type_id >= 0x40000000 )
-            return VTypesetdeclToTypesetdecl ( self, schema, & td, cast, distance );
-
-        /* typedecl => typeset */
-        return VTypedeclToTypesetdecl ( self, schema, & td, cast, distance );
-    }
-
-    /* typeset => type */
-    if ( self -> type_id >= 0x40000000 )
-        return VTypesetdeclToType ( self, schema, ancestor, cast, distance );
-
-    /* typedecl => type */
-    return VTypedecl2Type ( self, schema, ancestor, cast, distance );
-}
-
-/* CommonAncestor
- *  find a common ancestor between "self" and "peer"
- *  returns distance as sum of distances from each to "ancestor"
- */
-static
-bool VTypedeclTypedeclCmn ( const VTypedecl *self, const VSchema *schema,
-    const VTypedecl *peer, VTypedecl *ancestor, uint32_t *distance )
-{
-    const SDatatype *at, *bt;
-    uint32_t a, b, adim, bdim;
-
-    /* retrieve datatypes */
-    at = VSchemaFindTypeid ( schema, self -> type_id );
-    if ( at == NULL )
-        return false;
-
-    bt = VSchemaFindTypeid ( schema, peer -> type_id );
-    if ( bt == NULL )
-        return false;
-
-    /* walk each side toward parents */
-    for ( a = b = 0, adim = self -> dim, bdim = peer -> dim; at -> id != bt -> id; )
-    {
-        const SDatatype *dt;
-        if ( at -> id > bt -> id )
-        {
-            ++ a;
-            adim *= at -> dim;
-            dt = at = at -> super;
-        }
-        else
-        {
-            ++ b;
-            bdim *= bt -> dim;
-            dt = bt = bt -> super;
-        }
-        if ( dt == NULL || dt -> domain == 0 )
-            return false;
-    }
-
-    if ( adim == 0 )
-    {
-        if ( bdim == 0 )
-            return false;
-        adim = bdim;
-    }
-    else if ( bdim == 0 )
-    {
-        bdim = adim;
-    }
-
-    /* we have a common parent type, but dimensions must match */
-    if ( adim == bdim )
-    {
-        if ( distance != NULL )
-            * distance = a + b;
-        if ( ancestor != NULL )
-        {
-            ancestor -> type_id = at -> id;
-            ancestor -> dim = adim;
-        }
-        return true;
-    }
-
-    return false;
-}
-
-static
-bool VTypedeclSTypesetdeclCmn ( const VTypedecl *self, const VSchema *schema,
-    const STypeset *peer, uint32_t bdim, VTypedecl *ancestor, uint32_t *distance )
-{
-    bool early;
-    VTypedecl btd;
-    uint32_t i, count, best;
-
-    early = ( ancestor == NULL && distance == NULL ) ? true : false;
-
-    for ( best = ~ 0U, count = peer -> count, i = 0; i < count; ++ i )
-    {
-        uint32_t dist;
-
-        VTypedecl td = peer -> td [ i ];
-        td . dim *= bdim;
-
-        if ( VTypedeclTypedeclCmn ( self, schema, & td, & td, & dist ) )
-        {
-            if ( early )
-                return true;
-
-            if ( dist < best )
-            {
-                if ( distance != NULL )
-                    * distance = dist;
-                if ( dist == 0 )
-                {
-                    if ( ancestor != NULL )
-                        * ancestor = td;
-                    return true;
-                }
-                btd = td;
-                best = dist;
-            }
-        }
-    }
-
-    if ( ( int32_t ) best > 0 )
-    {
-        if ( ancestor != NULL )
-            * ancestor = btd;
-        return true;
-    }
-
-    return false;
-}
-
-static
-bool VTypedeclTypesetCmn ( const VTypedecl *self, const VSchema *schema,
-    const VTypedecl *peer, VTypedecl *ancestor, uint32_t *distance )
-{
-    /* find peer typeset */
-    const STypeset *ts = VSchemaFindTypesetid ( schema, peer -> type_id );
-
-    /* if not found or empty */
-    if ( ts == NULL || ts -> count == 0 )
-        return false;
-
-    /* if has a single type */
-    if ( ts -> count == 1 )
-    {
-        VTypedecl td = ts -> td [ 0 ];
-        td . dim *= peer -> dim;
-        return VTypedeclTypedeclCmn ( self, schema, & td, ancestor, distance );
-    }
-
-    /* find best match */
-    return VTypedeclSTypesetdeclCmn ( self, schema, ts, peer -> dim, ancestor, distance );
-}
-
-static
-bool VTypesetTypesetCmn ( const VTypedecl *self, const VSchema *schema,
-    const VTypedecl *peer, VTypedecl *ancestor, uint32_t *distance )
-{
-    bool early;
-    VTypedecl btd, td;
-    uint32_t i, count, best;
-    const STypeset *ats, *bts;
-
-    /* find self typeset */
-    ats = VSchemaFindTypesetid ( schema, self -> type_id );
-    if ( ats == NULL || ats -> count == 0 )
-        return false;
-
-    /* find peer typeset */
-    bts = VSchemaFindTypesetid ( schema, peer -> type_id );
-    if ( bts == NULL || bts -> count == 0 )
-        return false;
-
-    /* check for simple contents */
-    if ( ats -> count == 1 )
-    {
-        td = ats -> td [ 0 ];
-        td . dim *= self -> dim;
-        if ( bts -> count == 1 )
-        {
-            btd = bts -> td [ 0 ];
-            btd . dim *= peer -> dim;
-            return VTypedeclTypedeclCmn ( & td, schema, & btd, ancestor, distance );
-        }
-        return VTypedeclSTypesetdeclCmn ( & td, schema, bts, peer -> dim, ancestor, distance );
-    }
-    if ( bts -> count == 1 )
-    {
-        td = bts -> td [ 0 ];
-        td . dim *= peer -> dim;
-        return VTypedeclSTypesetdeclCmn ( & td, schema, ats, self -> dim, ancestor, distance );
-    }
-
-    early = ( ancestor == NULL && distance == NULL ) ? true : false;
-
-    for ( best = ~ 0U, count = ats -> count, i = 0; i < count; ++ i )
-    {
-        uint32_t dist = ~ 0;
-
-        td = ats -> td [ i ];
-        td . dim *= self -> dim;
-
-        if ( VTypedeclSTypesetdeclCmn ( & td, schema, bts, peer -> dim, & td, & dist ) )
-        {
-            if ( early )
-                return true;
-
-            if ( dist < best )
-            {
-                if ( distance != NULL )
-                    * distance = dist;
-                if ( dist == 0 )
-                {
-                    if ( ancestor != NULL )
-                        * ancestor = td;
-                    return true;
-                }
-                btd = td;
-                best = dist;
-            }
-        }
-    }
-
-    if ( ( int32_t ) best > 0 )
-    {
-        if ( ancestor != NULL )
-            * ancestor = btd;
-        return true;
-    }
-
-    return false;
-}
-
-LIB_EXPORT bool CC VTypedeclCommonAncestor ( const VTypedecl *self, const VSchema *schema,
-    const VTypedecl *peer, VTypedecl *ancestor, uint32_t *distance )
-{
-    if ( self == NULL || schema == NULL || peer == NULL )
-        return false;
-
-    /* wildcard make it hard to find common ancestor */
-    if ( self -> type_id == 0 || peer -> type_id == 0 )
-        return VTypedeclToTypedecl ( self, schema, peer, ancestor, distance );
-
-    /* rh type is typeset */
-    if ( self -> type_id >= 0x40000000 )
-    {
-        /* typeset, typeset => parent */
-        if ( peer -> type_id >= 0x40000000 )
-            return VTypesetTypesetCmn ( self, schema, peer, ancestor, distance );
-
-        /* typeset, typedecl => parent */
-        return VTypedeclTypesetCmn ( peer, schema, self, ancestor, distance );
-    }
-
-    /* typedecl, typeset => parent */
-    if ( peer -> type_id >= 0x40000000 )
-        return VTypedeclTypesetCmn ( self, schema, peer, ancestor, distance );
-
-    /* typedecl, typedecl => parent */
-    return VTypedeclTypedeclCmn ( self, schema, peer, ancestor, distance );
-}
-
-/* Dump
- */
-rc_t VTypedeclDump ( const VTypedecl *self, SDumper *b )
-{
-    rc_t rc;
-    uint32_t type_id = self -> type_id;
-    if ( type_id < 0x40000000 )
-    {
-        const SDatatype *dt = VSchemaFindTypeid ( b -> schema, type_id );
-        rc = SDatatypeDump ( dt, b );
-        if ( rc == 0 && dt != NULL && dt -> id == 0 )
-            return 0;
-    }
-    else if ( type_id < 0x80000000 )
-    {
-        const STypeset *ts = VSchemaFindTypesetid ( b -> schema, type_id );
-        rc = STypesetDump ( ts, b );
-    }
-    else
-    {
-#if SLVL >= 3
-        const SIndirectType *id = VSchemaFindITypeid ( b -> schema, type_id );
-        rc = SIndirectTypeDump ( id, b );
-#else
-        rc = RC ( rcVDB, rcSchema, rcWriting, rcType, rcUnrecognized );
-#endif
-    }
-
-    if ( rc == 0 && self -> dim != 1 )
-    {
-        const char *fmt;
-        switch ( SDumperMode ( b ) )
-        {
-        case sdmCompact:
-            fmt = self -> dim ? "[%u]" : "[*]"; break;
-        default:
-            fmt = self -> dim ? " [ %u ]" : " [ * ]";
-        }
-        rc = SDumperPrint ( b, fmt, self -> dim );
-    }
-
-    return rc;
-}
-#endif
-
-
-/*--------------------------------------------------------------------------
- * VTypedesc
- *  describes the fundamental properties of a VTypedecl
- *  replaces the deprecated structure VTypedef
- */
-
-/* Sizeof
- */
-LIB_EXPORT uint32_t CC VTypedescSizeof ( const VTypedesc *self )
-{
-    if ( self == NULL )
-        return 0;
-    return self -> intrinsic_bits * self -> intrinsic_dim;
-}
-
-
-/*--------------------------------------------------------------------------
- * VFormatdecl
- */
-#if SLVL >= 1
-LIB_EXPORT rc_t CC VFormatdeclToText ( const VFormatdecl *self,
-    const VSchema *schema, char *buffer, size_t bsize )
-{
-    PLOGMSG ( klogWarn, ( klogWarn, "TDB: $(msg)", "msg=handle VFormatdeclToText " ));    
-    return -1;
-}
-
-/* ToFormatdecl
- *  attempt to cast a fmtdecl to a size-equivalent ancestor decl
- *
- *  "schema" [ IN ] - schema object that would know about this type
- *
- *  "ancestor" [ IN ] - target fmtdecl or typespec for cast
- *
- *  "cast" [ OUT ] - return parameter for ancestor decl
- *  valid only if function returns true. if "ancestor" contained a typeset,
- *  the value of "cast" will be the closest matching ancestral type.
- *
- *  "distances" [ OUT, NULL OKAY ] - optional linear measure of independent
- *  casting generations for format ( 0 ) and type ( 1 ). valid only if function
- *  returns true. a value of 0 means that "self" is a direct match with "ancestor",
- *  a value of 1 means that "self" is an immediate subtype of "ancestor", etc.
- *
- *  returns true if cast succeeded
- */
-static
-bool VFormatdeclToFormatdeclInt ( const VFormatdecl *self, const VSchema *schema,
-    const VFormatdecl *ancestor, VFormatdecl *cast, uint32_t distances [ 2 ],
-    bool ( CC * td2td ) ( const VTypedecl*, const VSchema*, const VTypedecl*, VTypedecl*, uint32_t* ) )
-{
-    if ( self != NULL && schema != NULL && ancestor != NULL )
-    {
-        uint32_t i;
-        const SFormat *fmt;
-
-        /* just to handle common cases */
-        if ( distances != NULL )
-            distances [ 0 ] = distances [ 1 ] = 0;
-
-        /* no format on self */
-        if ( self -> fmt == 0 )
-        {
-            /* resulting format is ancestor's */
-            if ( cast != NULL )
-                cast -> fmt = ancestor -> fmt;
-
-            /* if no ancestor format, or if have type info, perform type cast */
-            if ( ancestor -> fmt == 0 || self -> td . type_id != 0 || ancestor -> td . type_id != 0 )
-            {
-                return ( * td2td ) ( & self -> td, schema,
-                    & ancestor -> td, & cast -> td, distances ? & distances [ 1 ] : NULL );
-            }
-
-            /* resultant type is undefined */
-            if ( cast != NULL )
-            {
-                cast -> td . type_id = 0;
-                cast -> td . dim = 1;
-            }
-
-            return true;
-        }
-
-        if ( ancestor -> fmt == 0 || ancestor -> fmt == self -> fmt )
-        {
-            /* resulting format is our own */
-            if ( cast != NULL )
-                cast -> fmt = self -> fmt;
-
-            /* if have type info, perform type cast */
-            if ( self -> td . type_id != 0 || ancestor -> td . type_id != 0 )
-            {
-                return ( * td2td ) ( & self -> td, schema,
-                    & ancestor -> td, & cast -> td, distances ? & distances [ 1 ] : NULL );
-            }
-
-            /* resultant type is undefined */
-            if ( cast != NULL )
-            {
-                cast -> td . type_id = 0;
-                cast -> td . dim = 1;
-            }
-
-            return true;
-        }
-
-        /* distinct formats involved */
-        fmt = VSchemaFindFmtid ( schema, self -> fmt );
-        for ( i = 0; fmt != NULL; ++ i, fmt = fmt -> super )
-        {
-            if ( fmt -> id == ancestor -> fmt )
-            {
-                /* successful cast to ancestor */
-                if ( cast != NULL )
-                    cast -> fmt = ancestor -> fmt;
-                if ( distances != NULL )
-                    distances [ 0 ] = i;
-
-                /* if have type info, perform type cast */
-                if ( self -> td . type_id != 0 || ancestor -> td . type_id != 0 )
-                {
-                    return ( * td2td ) ( & self -> td, schema,
-                        & ancestor -> td, & cast -> td, distances ? & distances [ 1 ] : NULL );
-                }
-
-                /* resultant type is undefined */
-                if ( cast != NULL )
-                {
-                    cast -> td . type_id = 0;
-                    cast -> td . dim = 1;
-                }
-
-                return true;
-            }
-        }
-    }
-
-    return false;
-}
-
-LIB_EXPORT bool CC VFormatdeclToFormatdecl ( const VFormatdecl *self,
-    const VSchema *schema, const VFormatdecl *ancestor,
-    VFormatdecl *cast, uint32_t distances [ 2 ] )
-{
-    return VFormatdeclToFormatdeclInt ( self, schema,
-        ancestor, cast, distances, VTypedeclToTypedecl );
-}
-
-
-/* CommonAncestor
- *  find a common ancestor between "self" and "peer"
- *  returns distance as sum of distances from each to "ancestor"
- */
-bool VFormatdeclCommonAncestor ( const VFormatdecl *self, const VSchema *schema,
-    const VFormatdecl *peer, VFormatdecl *ancestor, uint32_t distances [ 2 ] )
-{
-    return VFormatdeclToFormatdeclInt ( self, schema,
-        peer, ancestor, distances, VTypedeclCommonAncestor );
-}
-
-
-rc_t VFormatdeclDump ( const VFormatdecl *self, SDumper *b )
-{
-    rc_t rc;
-    uint32_t fmt_id = self -> fmt;
-
-    if ( fmt_id != 0 )
-    {
-        const SFormat *fmt = VSchemaFindFmtid ( b -> schema, fmt_id );
-        rc = SFormatDump ( fmt, b );
-        if ( rc != 0 || self -> td . type_id == 0 )
-            return rc;
-
-        rc = SDumperWrite ( b, "/", 1 );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    return VTypedeclDump ( & self -> td, b );
-}
-#endif
-
-/*--------------------------------------------------------------------------
- * STypeset
- */
-
-static
-void CC STypesetPopulate ( BSTNode *n, void *data )
-{
-    const STypesetMbr *mbr = ( const STypesetMbr* ) n;
-    STypeset *ts = data;
-    ts -> td [ ts -> count ++ ] = mbr -> td;
-}
-
-/* Find
- */
-STypeset *VSchemaFindTypesetid ( const VSchema *self, uint32_t id )
-{
-    STypeset *ts = VectorGet ( & self -> ts, id );
-    while ( ts == NULL )
-    {
-        self = self -> dad;
-        if ( self == NULL )
-            break;
-        ts = VectorGet ( & self -> ts, id );
-    }
-    return ts;
-}
-
-/* Mark
- */
-void CC STypesetClearMark ( void *item, void *ignore )
-{
-    STypeset *self = item;
-    self -> marked = false;
-}
-
-void VSchemaTypeMark ( const VSchema *self, uint32_t type_id )
-{
-    const SDatatype *dt;
-    const STypeset *ts;
-
-    switch ( type_id & 0xC0000000 )
-    {
-    case 0:
-        while ( type_id < VectorStart ( & self -> dt ) )
-        {
-            self = self -> dad;
-            if ( self -> dad == NULL )
-                return;
-        }
-
-        dt = VectorGet ( & self -> dt, type_id );
-        if ( dt != NULL )
-            SDatatypeMark ( dt );
-        break;
-
-    case 0x40000000:
-        while ( type_id < VectorStart ( & self -> ts ) )
-        {
-            self = self -> dad;
-            if ( self -> dad == NULL )
-                return;
-        }
-
-        ts = VectorGet ( & self -> ts, type_id );
-        if ( ts != NULL )
-            STypesetMark ( ts, self );
-        break;
-    }
-}
-
-void STypesetMark ( const STypeset *cself, const VSchema *schema )
-{
-    STypeset *self = ( STypeset* ) cself;
-    if ( cself != NULL && ! cself -> marked )
-    {
-        uint32_t i, count = self -> count;
-        self -> marked = true;
-        for ( i = 0; i < count; ++ i )
-            VSchemaTypeMark ( schema, self -> td [ i ] . type_id );
-    }
-}
-
-/* Dump
- */
-rc_t STypesetDump ( const STypeset *self, struct SDumper *d )
-{
-    return FQNDump ( self -> name, d );
-}
-
-#if SLVL >= 1
-bool CC STypesetDefDump ( void *item, void *data )
-{
-    int i;
-
-    SDumper *b = data;
-    const char *tsfmt, *sep, *cls;
-    const STypeset *self = ( const void* ) item;
-
-    if ( SDumperMarkedMode ( b ) && ! self -> marked )
-        return false;
-
-    switch ( SDumperMode ( b ) )
-    {
-    case sdmCompact:
-        tsfmt = "typeset %N{";
-        sep = ",";
-        cls = "};";
-        break;
-    default:
-        tsfmt = "typeset %N { ";
-        sep = ", ";
-        cls = " };\n";
-    }
-
-
-    SDumperSepString ( b, "" );
-
-    b -> rc = SDumperPrint ( b, tsfmt, self -> name );
-    for ( i = 0; b -> rc == 0 && i < ( int ) self -> count; ++ i )
-    {
-        b -> rc = SDumperSep ( b );
-        if ( b -> rc == 0 )
-            b -> rc = VTypedeclDump ( & self -> td [ i ], b );
-        SDumperSepString ( b, sep );
-    }
-    if ( b -> rc == 0 )
-        b -> rc = SDumperPrint ( b, cls );
-
-    if ( b -> rc == 0 )
-        b -> rc = AliasDump ( self -> name, b );
-
-    return ( b -> rc != 0 ) ? true : false;
-}
-#endif
-
-/*--------------------------------------------------------------------------
- * VSchema
- */
-
-/*
- * fqn                = ID [ <nested-name> ]
- * nested-name        = ':' NAME [ <nested-name> ]
- */
-static
-rc_t nested_name ( const KSymTable *tbl, KTokenSource *src, KToken *t, const SchemaEnv *env )
-{
-    rc_t rc;
-    KSymbol *ns = t -> sym;
-
-    /* look for colon separator */
-    if ( next_token ( tbl, src, t ) -> id != eColon )
-        return RC ( rcVDB, rcSchema, rcParsing, rcToken, rcIncomplete );
-
-    /* push namespace onto stack */
-    rc = KSymTablePushNamespace ( tbl, ns );
-    if ( rc == 0 )
-    {
-        /* look for another namespace */
-        if ( next_shallow_token ( tbl, src, t, false ) -> id == eNamespace )
-            rc = nested_name ( tbl, src, t, env );
-
-        /* pop namespace */
-        KSymTablePopNamespace ( tbl );
-    }
-
-    return rc;
-}
-
-rc_t next_fqn ( const KSymTable *tbl, KTokenSource *src, KToken *t, const SchemaEnv *env )
-{
-    rc_t rc;
-    KToken t2;
-    KTokenSource src2;
-
-    /* looking for a symbolic name */
-    if ( t -> sym == NULL )
-        return RC ( rcVDB, rcSchema, rcParsing, rcToken, rcUnexpected );
-
-    /* anything other than a namespace is what we want */
-    if ( t -> id != eNamespace )
-        return 0;
-
-    /* perform a lookahead */
-    t2 = * t;
-    src2 = * src;
-
-    /* requires ':' following namespace */
-    rc = nested_name ( tbl, & src2, & t2, env );
-    if ( rc == 0 )
-    {
-        KSymbol *ns;
-        uint32_t scope;
-
-        /* recognized patern (NS:)+TOKEN
-           check that TOKEN is a defined symbol within NS */
-        if ( t2 . sym != NULL )
-        {
-            * t = t2;
-            * src = src2;
-            return 0;
-        }
-
-        /* before returning an error, look harder.
-           extended VSchema can create symtab entries
-           for namespaces that opaque the parent schema */
-        for ( scope = 0, ns = t -> sym; ns != NULL; )
-        {
-            /* find a deeper symbol */
-            ns = KSymTableFindNext ( tbl, ns, & scope );
-            if ( ns != NULL && ns -> type == eNamespace )
-            {
-                t2 = * t;
-                src2 = * src;
-                t2 . sym = ns;
-                rc = nested_name ( tbl, & src2, & t2, env );
-                if ( rc != 0 )
-                    return rc;
-                if ( t2 . sym != NULL )
-                {
-                    * t = t2;
-                    * src = src2;
-                    return 0;
-                }
-            }
-        }
-
-        /* could not find anything */
-        rc = RC ( rcVDB, rcSchema, rcParsing, rcToken, rcIncomplete );
-    }
-    return rc;
-}
-
-static
-rc_t create_fqn_sym ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, uint32_t id, const void *obj )
-{
-    KToken t2;
-    KTokenSource src2 = * src;
-
-    /* need to peek at next token */
-    if ( KTokenizerNext ( kDefaultTokenizer, & src2, & t2 ) -> id == eColon )
-    {
-        /* and again to find ident or name */
-        KTokenizerNext ( kDefaultTokenizer, & src2, & t2 );
-
-        /* allow reserved word "view" to be used in schemas <= 1.0 */
-        if ( t2 . id == kw_view && ! env -> has_view_keyword )
-            t2 . id = eIdent;
-
-        if ( t2 . id == eIdent || t2 . id == eName )
-        {
-            /* create a namespace and go in */
-            KSymbol *ns;
-            rc_t rc = KSymTableCreateNamespace ( tbl, & ns, & t -> str );
-            if ( rc == 0 )
-            {
-                rc = KSymTablePushNamespace ( tbl, ns );
-                if ( rc == 0 )
-                {
-                    /* accept ':' NS */
-                    * t = t2;
-                    * src = src2;
-
-                    /* recurse */
-                    rc = create_fqn_sym ( tbl, src, t, env, id, obj );
-
-                    /* exit namespace */
-                    KSymTablePopNamespace ( tbl );
-                }
-            }
-
-            /* always return */
-            return rc;
-        }
-    }
-
-    /* contents of "t" are a proper symbol */
-    assert ( t -> id == eIdent || t -> id == eName );
-    return KSymTableCreateSymbol ( tbl, & t -> sym, & t -> str, id, obj );
-}
-
-static
-rc_t enter_namespace ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, uint32_t id, const void *obj )
-{
-    KSymbol *ns = t -> sym;
-    rc_t rc = KSymTablePushNamespace ( tbl, ns );
-    if ( rc == 0 )
-    {
-        if ( next_token ( tbl, src, t ) -> id != eColon )
-            rc = KTokenExpected ( t, klogErr, ":" );
-        else switch ( next_shallow_token ( tbl, src, t, false ) -> id )
-        {
-        case eNamespace:
-            rc = enter_namespace ( tbl, src, t, env, id, obj );
-            break;
-        case eIdent:
-        case eName:
-            rc = create_fqn_sym ( tbl, src, t, env, id, obj );
-            break;
-        case kw_view:
-            if ( ! env -> has_view_keyword )
-            {
-                rc = create_fqn_sym ( tbl, src, t, env, id, obj );
-                break;
-            }
-            /* no break */
-        default:
-            if ( t -> id == id )
-                rc = RC ( rcVDB, rcSchema, rcParsing, rcToken, rcExists );
-            else
-                rc = RC ( rcVDB, rcSchema, rcParsing, rcToken, rcUnexpected );
-        }
-
-        KSymTablePopNamespace ( tbl );
-    }
-    return rc;
-}
-
-rc_t create_fqn ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, uint32_t id, const void *obj )
-{
-    switch ( t -> id )
-    {
-    case eNamespace:
-        return enter_namespace ( tbl, src, t, env, id, obj );
-    case eIdent:
-        return create_fqn_sym ( tbl, src, t, env, id, obj );
-    default:
-        if ( t -> id == id )
-            return RC ( rcVDB, rcSchema, rcParsing, rcToken, rcExists );
-    }
-
-    return RC ( rcVDB, rcSchema, rcParsing, rcToken, rcUnexpected );
-}
-
-
-/*
- * dim                = '[' <uint-expr> ']'
- */
-#if SLVL >= 1
-rc_t dim ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, const VSchema *self, uint32_t *dim, bool required )
-{
-    rc_t rc;
-
-    if ( ! required && t -> id != eLeftSquare )
-    {
-        * dim = 1;
-        return 0;
-    }
-
-    /* consume '[' */
-    rc = expect ( tbl, src, t, eLeftSquare, "[", true );
-    if ( rc == 0 )
-    {
-        /* assume manifest constant */
-        rc = KTokenToU32 ( t, dim );
-
-        /* otherwise, assume some sort of symbolic expression */
-        if ( rc != 0 )
-        {
-            const SExpression *x;
-            rc = const_expr ( tbl, src, t, env, self, & x );
-            if ( rc == 0 )
-            {
-                Vector dummy;
-                VectorInit ( & dummy, 1, 16 );
-
-                /* should have evaluated to a constant expression */
-                rc = eval_uint_expr ( self, x, dim, & dummy );
-                SExpressionWhack ( x );
-
-                VectorWhack ( & dummy, NULL, NULL );
-            }
-            if ( rc != 0 )
-                return rc;
-        }
-    }
-
-    /* close brackets */
-    return expect ( tbl, src, next_token ( tbl, src, t ), eRightSquare, "]", true );
-}
-
-
-/*
- * typename           = <fqn>
- */
-rc_t typename ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, uint32_t *id )
-{
-    const SDatatype *dt;
-    const SIndirectType *tp;
-
-    /* consume fully qualified name */
-    rc_t rc = next_fqn ( tbl, src, t, env );
-    if ( rc != 0 )
-        return rc;
-
-    /* the name must be defined as a data type */
-    switch ( t -> id )
-    {
-    case eDatatype:
-        dt = t -> sym -> u. obj;
-        * id = dt -> id;
-        break;
-    case eSchemaType:
-        tp = t -> sym -> u. obj;
-        * id = tp -> id;
-        break;
-    default:
-        return RC ( rcVDB, rcSchema, rcParsing, rcToken, rcUnexpected );
-    }
-
-    return 0;
-}
-
-
-/*
- * typedecl           = <typename> [ <dim> ]
- */
-rc_t typedecl ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, const VSchema *self, VTypedecl *td )
-{
-    rc_t rc = typename ( tbl, src, t, env, & td -> type_id );
-    if ( rc != 0 )
-        return rc;
-
-    next_token ( tbl, src, t );
-    return dim ( tbl, src, t, env, self, & td -> dim, false );
-}
-
-
-/*
- * typeset            = <fqn>
- */
-rc_t typeset ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-   const SchemaEnv *env, uint32_t *id )
-{
-    const STypeset *ts;
-
-    /* consume fully qualified name */
-    rc_t rc = next_fqn ( tbl, src, t, env );
-    if ( rc != 0 )
-        return rc;
-
-    /* the name must be defined as a typeset */
-    if ( t -> id != eTypeset )
-        return RC ( rcVDB, rcSchema, rcParsing, rcToken, rcUnexpected );
-
-    /* retrieve the runtime type id */
-    assert ( t -> sym != NULL );
-    ts = t -> sym -> u . obj;
-    * id = ts -> id;
-
-    return 0;
-}
-
-/*
- * typespec           = <typedecl>
- *                    | <typeset> [ <dim> ]
- */
-rc_t typespec ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, const VSchema *self, VTypedecl *td )
-{
-    const STypeset *ts;
-    const SDatatype *dt;
-    const SIndirectType *tp;
-
-    /* get a typename or typeset */
-    rc_t rc = next_fqn ( tbl, src, t, env );
-    if ( rc != 0 )
-        return rc;
-
-    switch ( t -> id )
-    {
-    case eDatatype:
-        dt = t -> sym -> u. obj;
-        td -> type_id = dt -> id;
-        break;
-    case eSchemaType:
-        tp = t -> sym -> u. obj;
-        td -> type_id = tp -> id;
-        break;
-    case eTypeset:
-        ts = t -> sym -> u. obj;
-        td -> type_id = ts -> id;
-        break;
-    default:
-        return RC ( rcVDB, rcSchema, rcParsing, rcToken, rcUnexpected );
-    }
-
-    next_token ( tbl, src, t );
-    return dim ( tbl, src, t, env, self, & td -> dim, false );
-}
-#endif
-
-
-/*
- * fmtname            = <fqn>
- */
-rc_t fmtname ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, uint32_t *id )
-{
-    const SFormat *fmt;
-
-    /* consume fully qualified name */
-    rc_t rc = next_fqn ( tbl, src, t, env );
-    if ( rc != 0 )
-        return rc;
-
-    /* the name must be defined as a format */
-    if ( t -> id != eFormat )
-        return RC ( rcVDB, rcSchema, rcParsing, rcToken, rcUnexpected );
-
-    /* retrieve the runtime fmt id */
-    assert ( t -> sym != NULL );
-    fmt = t -> sym -> u . obj;
-    * id = fmt -> id;
-
-    return 0;
-}
-
-/*
- * fmtdecl            = <fmtname> [ '/' <typedecl> ]
- *                    | <typedecl>
- */
-#if SLVL >= 1
-rc_t fmtdecl ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, const VSchema *self, VFormatdecl *fd )
-{
-    const SDatatype *dt;
-    const SIndirectType *tp;
-
-    /* get a fmtname or typename */
-    rc_t rc = next_fqn ( tbl, src, t, env );
-    if ( rc != 0 )
-        return rc;
-
-    /* look first for fmtname */
-    if ( t -> id == eFormat )
-    {
-        const SFormat *fmt = t -> sym -> u . obj;
-        fd -> fmt = fmt -> id;
-
-        /* unless followed by '/', this is a simple format declaration */
-        if ( next_token ( tbl, src, t ) -> id != eFwdSlash )
-        {
-            fd -> td . type_id = 0;
-            fd -> td . dim = 0;
-            return 0;
-        }
-
-        /* expect a typename */
-        rc = next_fqn ( tbl, src, next_token ( tbl, src, t ), env );
-        if ( rc != 0 )
-            return rc;
-    }
-    else
-    {
-        fd -> fmt = 0;
-    }
-
-    switch ( t -> id )
-    {
-    case eDatatype:
-        dt = t -> sym -> u. obj;
-        fd -> td . type_id = dt -> id;
-        break;
-    case eSchemaType:
-        tp = t -> sym -> u. obj;
-        fd -> td . type_id = tp -> id;
-        break;
-    default:
-        return RC ( rcVDB, rcSchema, rcParsing, rcToken, rcUnexpected );
-    }
-
-    next_token ( tbl, src, t );
-    return dim ( tbl, src, t, env, self, & fd -> td . dim, false );
-}
-
-/*
- * fmtspec            = <typespec>
- *                    | <fmtname> [ '/' <typedecl> ]
- */
-rc_t fmtspec ( const KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, const VSchema *self, VFormatdecl *fd )
-{
-    const SFormat *fmt;
-    const STypeset *ts;
-    const SDatatype *dt;
-    const SIndirectType *tp;
-
-    /* get a fmtname, typename or typeset */
-    rc_t rc = next_fqn ( tbl, src, t, env );
-    if ( rc != 0 )
-        return rc;
-
-    fd -> fmt = 0;
-    switch ( t -> id )
-    {
-    case eDatatype:
-        dt = t -> sym -> u. obj;
-        fd -> td . type_id = dt -> id;
-        break;
-    case eSchemaType:
-        tp = t -> sym -> u. obj;
-        fd -> td . type_id = tp -> id;
-        break;
-    case eTypeset:
-        ts = t -> sym -> u. obj;
-        fd -> td . type_id = ts -> id;
-        break;
-    case eFormat:
-        fmt = t -> sym -> u . obj;
-        fd -> fmt = fmt -> id;
-
-        /* unless followed by '/', this is a simple format declaration */
-        if ( next_token ( tbl, src, t ) -> id != eFwdSlash )
-        {
-            fd -> td . type_id = 0;
-            fd -> td . dim = 0;
-            return 0;
-        }
-        return typedecl ( tbl, src, t, env, self, & fd -> td );
-
-    default:
-        return RC ( rcVDB, rcSchema, rcParsing, rcToken, rcUnexpected );
-    }
-
-    next_token ( tbl, src, t );
-    return dim ( tbl, src, t, env, self, & fd -> td . dim, false );
-}
-#endif
-
-
-/*
- * type-definition    = 'typedef' <typename> <typedef-list>
- * typedef-list       = <typedef-decl> [ ',' <typedef-list> ]
- * typedef-decl       = <fqn> [ <dim> ]
- */
-#if SLVL >= 1
-rc_t type_definition ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self )
-{
-    VTypedecl td;
-    uint32_t super_size;
-    const SDatatype *super;
-
-    /* expect a typename */
-    rc_t rc = typename ( tbl, src, t, env, & td . type_id );
-    if ( rc != 0 )
-        return KTokenFailure ( t, klogErr, rc, "type name" );
-    if ( td . type_id == 0 )
-    {
-        rc = RC ( rcVDB, rcSchema, rcParsing, rcType, rcIncorrect );
-        return KTokenFailure ( t, klogErr, rc, "illegal base type" );
-    }
-
-    /* capture supertype */
-    assert ( t -> sym != NULL );
-    assert ( t -> sym -> type == eDatatype );
-    super = t -> sym -> u . obj;
-
-    /* get supertype size */
-    super_size = super -> size;
-
-    do
-    {
-        KSymbol *sym;
-        SDatatype *dt;
-
-        /* expect a fully qualified name */
-        rc = create_fqn ( tbl, src, next_token ( tbl, src, t ), env, eDatatype, NULL );
-        if ( rc == 0 )
-        {
-            /* remember symbol */
-            sym = t -> sym;
-
-            /* get dimension */
-            next_token ( tbl, src, t );
-            rc = dim ( tbl, src, t, env, self, & td . dim, false );
-            if ( rc != 0 )
-                return KTokenFailure ( t, klogErr, rc, "vector dimension" );
-
-            /* allocate a datatype */
-            dt = malloc ( sizeof * dt );
-            if ( dt == NULL )
-            {
-                rc = RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-                return KTokenRCExplain ( t, klogInt, rc );
-            }
-
-            /* fill it out from super-type */
-            dt -> super = super;
-            dt -> byte_swap = super -> byte_swap;
-            dt -> name = sym;
-            dt -> size = super_size * td . dim;
-            dt -> dim = td . dim;
-            dt -> domain = super -> domain;
-
-            /* insert into type vector */
-            rc = VectorAppend ( & self -> dt, & dt -> id, dt );
-            if ( rc != 0 )
-            {
-                free ( dt );
-                return KTokenRCExplain ( t, klogInt, rc );
-            }
-
-            /* connect symbol */
-            sym -> u . obj = dt;
-        }
-
-        /* allow a benign redefine */
-        else if ( GetRCState ( rc ) != rcExists )
-            return KTokenFailure ( t, klogErr, rc, "fully qualified name" );
-        else
-        {
-            /* remember this already defined name */
-            sym = t -> sym;
-            assert ( sym != NULL && sym -> type == eDatatype );
-
-            /* look for a dimension */
-            next_token ( tbl, src, t );
-            rc = dim ( tbl, src, t, env, self, & td . dim, false );
-            if ( rc != 0 )
-                return KTokenFailure ( t, klogErr, rc, "vector dimension" );
-
-            /* peek at existing definition */
-            dt = ( SDatatype* ) sym -> u . obj;
-            if ( dt -> super != super || dt -> dim != td . dim )
-            {
-                rc = RC ( rcVDB, rcSchema, rcParsing, rcToken, rcExists );
-                return KTokenRCExplain ( t, klogErr, rc );
-            }
-        }
-    }
-    while ( t -> id == eComma );
-
-    return expect ( tbl, src, t, eSemiColon, ";", true );
-}
-#endif
-
-
-/*
- * format-definition  = 'fmtdef' [ <fmtname> ] <fqn>
- * fmtname            = <fqn>
- */
-rc_t format_definition ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self )
-{
-    KSymbol *sym;
-    SFormat *fmt;
-    const SFormat *super;
-
-    /* start with the assumption that the name needs to be created */
-    rc_t rc = create_fqn ( tbl, src, t, env, eFormat, NULL );
-    if ( rc == 0 )
-    {
-        super = NULL;
-        sym = t -> sym;
-        next_token ( tbl, src, t );
-    }
-    else if ( GetRCState ( rc ) != rcExists )
-        return KTokenFailure ( t, klogErr, rc, "fully qualified name" );
-    else
-    {
-        /* could be a superfmt or could be a redefine */
-        sym = t -> sym;
-        if ( next_token ( tbl, src, t ) -> id != eIdent && t -> sym == NULL )
-        {
-            /* we will assume it was a redefine of a simple format */
-            return expect ( tbl, src, t, eSemiColon, "fully qualified name or ;", true );
-        }
-
-        /* has a superfmt */
-        super = sym -> u . obj;
-
-        /* do it again */
-        rc = create_fqn ( tbl, src, t, env, eFormat, NULL );
-        if ( rc != 0 )
-        {
-            /* may have been a redefine of a path-based format */
-            if ( GetRCState ( rc ) != rcExists )
-                return KTokenFailure ( t, klogErr, rc, "fully qualified name" );
-
-            return expect ( tbl, src, next_token ( tbl, src, t ),
-                eSemiColon, "fully qualified name or ;", true );
-        }
-
-        sym = t -> sym;
-        next_token ( tbl, src, t );
-    }
-
-    /* create a format */
-    fmt = malloc ( sizeof * fmt );
-    if ( fmt == NULL )
-    {
-        rc = RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-        return KTokenRCExplain ( t, klogInt, rc );
-    }
-
-    /* superfmt */
-    fmt -> super = super;
-
-    /* link to name */
-    fmt -> name = sym;
-
-    /* insert into vector */
-    rc = VectorAppend ( & self -> fmt, & fmt -> id, fmt );
-    if ( rc != 0 )
-    {
-        free ( fmt );
-        return KTokenRCExplain ( t, klogInt, rc );
-    }
-
-    /* link symbol to fmt */
-    sym -> u . obj = fmt;
-
-    return expect ( tbl, src, t, eSemiColon, ";", true );
-}
-
-
-/*
- * typeset-definition = 'typeset' <typeset> '{' <typespec-list> '}'
- * typespec-list      = <typespec> [ ',' <typespec-list> ]
- */
-#if SLVL >= 1
-rc_t typeset_definition ( KSymTable *tbl, KTokenSource *src, KToken *t,
-    const SchemaEnv *env, VSchema *self )
-{
-    BSTree tree;
-    KSymbol *sym;
-    bool existing;
-    uint32_t i, count;
-
-    rc_t rc = create_fqn ( tbl, src, t, env, eTypeset, NULL );
-    if ( rc == 0 )
-    {
-        sym = t -> sym;
-        existing = false;
-    }
-    else if ( GetRCState ( rc ) != rcExists )
-        return KTokenFailure ( t, klogErr, rc, "fully qualified name" );
-    else
-    {
-        sym = t -> sym;
-        existing = true;
-    }
-
-    if ( next_token ( tbl, src, t ) -> id != eLeftCurly )
-        return KTokenExpected ( t, klogErr, "{" );
-
-    BSTreeInit ( & tree );
-    count = 0;
-
-    do
-    {
-        STypesetMbr *mbr, *exist;
-
-        /* read typepec */
-        VTypedecl td;
-        next_token ( tbl, src, t );
-        rc = typespec ( tbl, src, t, env, self, & td );
-        if ( rc != 0 )
-        {
-            KTokenFailure ( t, klogErr, rc, "type name, format name or typeset name" );
-            break;
-        }
-
-        /* if we got a typedecl, add it */
-        if ( td . type_id < 0x40000000 )
-        {
-            mbr = malloc ( sizeof * mbr );
-            if ( mbr == NULL )
-            {
-                rc = RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-                KTokenRCExplain ( t, klogInt, rc );
-                break;
-            }
-
-            mbr -> td = td;
-
-            /* ignore/allow duplicates */
-            if ( BSTreeInsertUnique ( & tree, & mbr -> n,
-                 ( BSTNode** ) & exist, STypesetMbrSort ) != 0 )
-            {
-                free ( mbr );
-            }
-            else
-            {
-                ++ count;
-            }
-        }
-
-        /* got a typeset - add each of its members */
-        else
-        {
-            const STypeset *ts;
-            const VSchema *s = self;
-
-            do
-            {
-                ts = VectorGet ( & s -> ts, td . type_id );
-                if ( ts != NULL )
-                    break;
-                s = s -> dad;
-            }
-            while ( s != NULL );
-            assert ( ts != NULL );
-
-            for ( i = 0; i < ts -> count; ++ i )
-            {
-                mbr = malloc ( sizeof * mbr );
-                if ( mbr == NULL )
-                {
-                    rc = RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-                    KTokenRCExplain ( t, klogInt, rc );
-                    break;
-                }
-
-                mbr -> td = ts -> td [ i ];
-
-                /* ignore/allow duplicates */
-                if ( BSTreeInsertUnique ( & tree, & mbr -> n,
-                     ( BSTNode** ) & exist, STypesetMbrSort ) != 0 )
-                {
-                    free ( mbr );
-                }
-                else
-                {
-                    ++ count;
-                }
-            }
-
-            if ( rc != 0 )
-                break;
-        }
-    }
-    while ( t -> id == eComma );
-
-    if ( rc != 0 )
-    {
-        BSTreeWhack ( & tree, BSTreeMbrWhack, NULL );
-        return rc;
-    }
-
-    if ( t -> id != eRightCurly )
-        rc = KTokenExpected ( t, klogErr, "}" );
-    else
-    {
-        /* we have a typeset */
-        STypeset *ts = malloc ( sizeof * ts - sizeof ts -> td + count * sizeof ts -> td [ 0 ] );
-        if ( ts == NULL )
-            rc = RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-        else
-        {
-            /* initialize */
-            ts -> name = sym;
-            ts -> count = 0;
-
-            /* copy fmtdecls */
-            BSTreeForEach ( & tree, false, STypesetPopulate, ts );
-            assert ( ts -> count == count );
-
-            /* have a new one */
-            if ( ! existing )
-            {
-                /* enter it into list */
-                sym -> u . obj = ts;
-                rc = VectorAppend ( & self -> ts, & ts -> id, ts );
-                if ( rc != 0 )
-                {
-                    free ( ts );
-                    KTokenRCExplain ( t, klogInt, rc );
-                }
-            }
-
-            /* allow benign redefine */
-            else
-            {
-                const STypeset *orig = sym -> u . obj;
-                if ( orig -> count != count )
-                {
-                    rc = RC ( rcVDB, rcSchema, rcParsing, rcToken, rcExists );
-                    KTokenRCExplain ( t, klogErr, rc );
-                }
-                else for ( i = 0; i < count; ++ i )
-                {
-                    if ( VTypedeclCmp ( & orig -> td [ i ], & ts -> td [ i ] ) != 0 )
-                    {
-                        rc = RC ( rcVDB, rcSchema, rcParsing, rcToken, rcExists );
-                        KTokenRCExplain ( t, klogErr, rc );
-                        break;
-                    }
-                }
-
-                free ( ts );
-            }
-        }
-    }
-
-    BSTreeWhack ( & tree, BSTreeMbrWhack, NULL );
-
-    if ( rc == 0 )
-        rc = expect ( tbl, src, next_token ( tbl, src, t ), eSemiColon, ";", false );
-
-    return rc;
-}
-#endif
diff --git a/libs/vdb/schema.c b/libs/vdb/schema.c
deleted file mode 100644
index b848997..0000000
--- a/libs/vdb/schema.c
+++ /dev/null
@@ -1,1768 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#define TRACK_REFERENCES 0
-
-#include "va_copy.h"
-
-#define KONST const
-#include "dbmgr-priv.h"
-#undef KONST
-
-#include "schema-priv.h"
-#include "schema-tok.h"
-#include "schema-parse.h"
-
-#include <kdb/meta.h>
-#include <kfs/directory.h>
-#include <kfs/file.h>
-#include <kfs/mmap.h>
-#include <klib/symbol.h>
-#include <klib/symtab.h>
-#include <klib/namelist.h>
-#include <klib/data-buffer.h>
-#include <klib/printf.h>
-#include <klib/out.h>
-#include <klib/rc.h>
-#include <os-native.h>      /* because of snprintf on windows */
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * KDirectory
- */
-static
-void CC KDirRefRelease ( void *item, void *ignore )
-{
-    KDirectoryRelease ( ( const void* ) item );
-}
-
-/*--------------------------------------------------------------------------
- * generic
- */
-
-void CC VectMbrWhack ( void *item, void *ignore )
-{
-    free ( item );
-}
-
-void CC BSTreeMbrWhack ( BSTNode *n, void *ignore )
-{
-    free ( n );
-}
-
-/*--------------------------------------------------------------------------
- * KSymbol
- */
-rc_t KSymbolCopy ( BSTree *scope, KSymbol **cp, const KSymbol *orig )
-{
-    rc_t rc;
-    KSymbol *copy, *dad = NULL;
-
-    /* recursively copy namespaces */
-    if ( orig -> dad != NULL )
-    {
-        rc = KSymbolCopy ( scope, cp, orig -> dad );
-        if ( rc != 0 )
-            return rc;
-
-        /* copied dad becomes scope */
-        dad = * cp;
-        scope = & dad -> u . scope;
-    }
-
-#if COPY_SHARE_TEXT
-    /* create simple copy with no new space for text */
-    copy = malloc ( sizeof * copy );
-#else
-    copy = malloc ( sizeof (*copy) + orig->name.size + 1 );
-#endif
-    if ( copy == NULL )
-        return RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-
-    /* copy original, including pointer to string */
-    * copy = * orig;
-
-#if ! COPY_SHARE_TEXT
-
-    /* copy original including string */
-    string_copy ( ( char* ) ( copy + 1 ), orig -> name . size + 1,
-        orig -> name . addr, orig -> name . size );
-
-    /* fix up pointer to string */
-    copy -> name . addr = ( const char* ) ( copy + 1 );
-#endif
-    copy -> dad = dad;
-
-    /* if we just created a namespace, forget its children */
-    if ( copy -> type == eNamespace )
-    {
-        BSTreeInit ( & copy -> u . scope );
-        rc = BSTreeInsertUnique ( scope, & copy -> n, ( BSTNode** ) cp, KSymbolSort );
-        if ( rc != 0 )
-        {
-            free ( copy );
-            copy = * cp;
-            if ( copy -> type == eNamespace )
-                rc = 0;
-            else
-                copy = NULL;
-        }
-    }
-    else
-    {
-        rc = BSTreeInsertUnique ( scope, & copy -> n, ( BSTNode** ) cp, KSymbolSort );
-        if ( rc != 0 )
-        {
-            free ( copy );
-            copy = NULL;
-        }
-    }
-
-/*     if (*cp != copy) */
-/*      fprintf(stderr,"%p\t%30s %30.*s\tmalloc\t%d\n", (void*)copy,  */
-/*              __func__,(int)copy->name.size,copy->name.addr, copy->type); */
-
-    * cp = copy;
-    return rc;
-}
-
-bool CC KSymbolCopyScope ( BSTNode *n, void *scope )
-{
-    const KSymbol *sym = ( const KSymbol* ) n;
-
-    /* perform a deep copy of leaf symbols */
-    if ( sym -> type != eNamespace )
-    {
-        KSymbol *ignore;
-        rc_t rc = KSymbolCopy ( scope, & ignore, sym );
-        return ( rc != 0 ) ? true : false;
-    }
-
-    /* traverse namespaces to find leaves */
-    return BSTreeDoUntil ( & sym -> u . scope, false, KSymbolCopyScope, scope );
-}
-
-#if _DEBUGGING
-static
-void CC KSymbolList ( BSTNode *item, void *data )
-{
-    const KSymbol *self = ( const KSymbol* ) item;
-    const char *indent = ( const char* ) data;
-
-    OUTMSG (( "%s%.*s = %#p"
-             , indent
-             , ( int ) self -> name . size, self -> name . addr
-             , self
-        ));
-
-    if ( self -> type != eNamespace )
-        putchar ( '\n' );
-    else
-    {
-        printf ( " ( namespace ):\n" );
-        if ( indent [ -1 ] != '.' )
-            -- indent;
-
-        BSTreeForEach ( & self -> u . scope, false, KSymbolList, ( void* ) indent );
-    }
-}
-
-static
-void CC BSTreeListSymbols ( const BSTree *self, const char *indent )
-{
-    OUTMSG (( "%sscope = %#p\n"
-             , indent
-             , self
-        ));
-
-    if ( indent [ -1 ] != '.' )
-        -- indent;
-
-    BSTreeForEach ( self, false, KSymbolList, ( void* ) indent );
-}
-#endif
-
-
-
-/* ExamineContents
- *  not much to be done here
- */
-#if EXAMINE_SCHEMA_CONTENTS >= 1
-bool CC KSymbolExamineContents ( BSTNode *n, void *data )
-{
-    rc_t *rc = data;
-    const KSymbol *sym = ( const KSymbol* ) n;
-
-    /* can test heuristic that name is NULL-terminated,
-       that name size and length are identical */
-
-    /* can test that symbol type is a valid id type */
-    return false;
-}
-#endif
-
-
-
-
-/*--------------------------------------------------------------------------
- * KMDataNode
- */
-
-/* FillSchema
- *  a schema buffer fill function that reads from KMDataNode
- */
-rc_t CC KMDataNodeFillSchema ( void *data, KTokenText *tt, size_t save )
-{
-    rc_t rc;
-    size_t num_read;
-    KMDataNodeSchemaFillData *pb = data;
-
-     /* on very first fill, check for specifying v0 */
-    if ( pb -> add_v0 )
-    {
-        assert ( save == 0 );
-        CONST_STRING ( & tt -> str, "version 0;" );
-        pb -> add_v0 = false;
-        return 0;
-    }
-
-   /* save any characters not yet consumed */
-    if ( save != 0 )
-    {
-        assert ( save < sizeof pb -> buff );
-        memmove ( pb -> buff,
-            & tt -> str . addr [ tt -> str . size - save ], save );
-    }
-
-    /* read as many characters as are available */
-    rc = KMDataNodeRead ( pb -> node, pb -> pos,
-        & pb -> buff [ save ], sizeof pb -> buff - save, & num_read, NULL );
-    if ( rc == 0 )
-    {
-	/******** PROTECT FROM BUGS IN TOKENIZER ****/
-	if(num_read == sizeof (pb -> buff) - save){ /** not the last chunk ***/
-		int i;
-		for(i=num_read+save-1;i > save && (isalnum(pb -> buff[i]) || pb -> buff[i]=='_');i--){}
-		if(i > save && pb -> buff[i]=='.'){ /*** leave this physical column for the next buffer **/
-			num_read=i-save;
-		}
-	}
-	/********************************************/
-        /* reset the buffer in "tt" */
-        tt -> str . addr = pb -> buff;
-        tt -> str . size = save + num_read;
-        tt -> str . len = string_len ( pb -> buff, save + num_read );
-        pb -> pos += num_read;
-    }
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * SNameOverload
- */
-
-/* Whack
- */
-void CC SNameOverloadWhack ( void *item, void *ignore )
-{
-    SNameOverload *self = item;
-    VectorWhack ( & self -> items, NULL, NULL );
-    free ( self );
-}
-
-/* Make
- */
-rc_t SNameOverloadMake ( SNameOverload **np,
-    const KSymbol *sym, uint32_t start, uint32_t len )
-{
-    SNameOverload *name = malloc ( sizeof * name );
-    if ( name == NULL )
-        return RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-
-    name -> name = sym;
-    ( ( KSymbol* ) sym ) -> u . obj = name;
-    VectorInit ( & name -> items, start, len );
-    name -> cid . ctx = 0;
-
-    * np = name;
-    return 0;
-}
-
-/* Copy
- */
-rc_t SNameOverloadCopy ( BSTree *scope,
-    SNameOverload **cp, const SNameOverload *orig )
-{
-    KSymbol *sym;
-    rc_t rc = KSymbolCopy ( scope, & sym, orig -> name );
-    if ( rc == 0 )
-    {
-        SNameOverload *copy;
-        rc = SNameOverloadMake ( & copy, sym, 0, 0 );
-        if ( rc == 0 )
-        {
-            /* copy contents */
-            rc = VectorCopy ( & orig -> items, & copy -> items );
-            if ( rc == 0 )
-            {
-                copy -> cid = orig -> cid;
-                * cp = copy;
-                return 0;
-            }
-
-            SNameOverloadWhack ( copy, NULL );
-        }
-
-        BSTreeUnlink ( scope, & sym -> n );
-        KSymbolWhack ( & sym -> n, NULL );
-    }
-
-    * cp = NULL;
-    return rc;
-}
-
-typedef struct SNameOverloadCopyData SNameOverloadCopyData;
-struct SNameOverloadCopyData
-{
-    BSTree *scope;
-    Vector *dest;
-    rc_t rc;
-};
-
-static
-bool CC SNameOverloadVectorCopyItem ( void *item, void *data )
-{
-    SNameOverloadCopyData *pb = data;
-
-    SNameOverload *copy;
-    pb -> rc = SNameOverloadCopy ( pb -> scope, & copy, ( const void* ) item );
-    if ( pb -> rc == 0 )
-        pb -> rc = VectorAppend ( pb -> dest, & copy -> cid . id, copy );
-
-    return ( pb -> rc != 0 ) ? true : false;
-}
-
-rc_t SNameOverloadVectorCopy ( BSTree *scope, const Vector *src, Vector *dest )
-{
-    SNameOverloadCopyData pb;
-    pb . scope = scope;
-    pb . dest = dest;
-    pb . rc = 0;
-
-    if ( VectorDoUntil ( src, false, SNameOverloadVectorCopyItem, & pb ) )
-        return pb . rc;
-
-    return 0;
-}
-
-
-/*--------------------------------------------------------------------------
- * VIncludedPath
- */
-typedef struct VIncludedPath VIncludedPath;
-struct VIncludedPath
-{
-    BSTNode n;
-    uint32_t ord;
-    char path [ 1 ];
-};
-
-/* Cmp
- * Sort
- */
-static
-int CC VIncludedPathCmp ( const void *item, const BSTNode *n )
-{
-    const char *a = item;
-    const VIncludedPath *b = ( const VIncludedPath* ) n;
-    return strcmp ( a, b -> path );
-}
-
-static
-int CC VIncludedPathSort ( const BSTNode *item, const BSTNode *n )
-{
-    const VIncludedPath *a = ( const VIncludedPath* ) item;
-    const VIncludedPath *b = ( const VIncludedPath* ) n;
-    return strcmp ( a -> path, b -> path );
-}
-
-static
-int CC VIncludedPathSortByOrder ( const BSTNode *item, const BSTNode *n )
-{
-    const VIncludedPath *a = ( const VIncludedPath* ) item;
-    const VIncludedPath *b = ( const VIncludedPath* ) n;
-    return ( int ) a -> ord - ( int ) b -> ord;
-}
-
-/* Make
- */
-static
-rc_t CC VIncludedPathMake ( BSTree *paths, uint32_t *count, const char *path )
-{
-    VIncludedPath *p = malloc ( sizeof * p + strlen ( path ) );
-    if ( p == NULL )
-        return RC ( rcVDB, rcSchema, rcParsing, rcMemory, rcExhausted );
-    p -> ord = ( * count ) ++;
-    strcpy ( p -> path, path );
-    BSTreeInsert ( paths, & p -> n, VIncludedPathSort );
-    return 0;
-}
-
-
-/*--------------------------------------------------------------------------
- * VSchema
- *  a symbol scope
- *  data types, blob formats, function and sub-schema declarations
- *  database and table declarations
- */
-
-
-#if _DEBUGGING
-/* Listing
- *  list symbol tables
- */
-void VSchemaListSymtab ( const VSchema *self )
-{
-    if ( self != NULL )
-    {
-        const char *indent = ".                ";
-        VSchemaListSymtab ( self -> dad );
-        BSTreeListSymbols ( & self -> scope, & indent [ 17 ] );
-        putchar ( '\n' );
-    }
-}
-#endif
-
-
-/* Marking
- */
-void VSchemaClearMark ( const VSchema *self )
-{
-    if ( self == NULL )
-        return;
-
-    VectorForEach ( & self -> fmt, false, SFormatClearMark, NULL );
-    VectorForEach ( & self -> dt, false, SDatatypeClearMark, NULL );
-    VectorForEach ( & self -> ts, false, STypesetClearMark, NULL );
-    VectorForEach ( & self -> cnst, false, SConstantClearMark, NULL );
-    VectorForEach ( & self -> func, false, SFunctionClearMark, NULL );
-    VectorForEach ( & self -> phys, false, SPhysicalClearMark, NULL );
-    VectorForEach ( & self -> tbl, false, STableClearMark, NULL );
-    VectorForEach ( & self -> db, false, SDatabaseClearMark, NULL );
-
-    if ( self -> dad != NULL )
-        VSchemaClearMark ( self -> dad );
-}
-
-
-/* Destroy
- */
-static
-void CC VSchemaDestroy ( VSchema *self )
-{
-    REFMSG ( "VSchema", "destroy", & self -> refcount );
-    
-    BSTreeWhack ( & self -> scope, KSymbolWhack, NULL );
-    BSTreeWhack ( & self -> paths, BSTreeMbrWhack, NULL );
-    VectorWhack ( & self -> inc, KDirRefRelease, NULL );
-    VectorWhack ( & self -> alias, NULL, NULL );
-    VectorWhack ( & self -> fmt, SFormatWhack, NULL );
-#if SLVL >= 1
-    VectorWhack ( & self -> dt, SDatatypeWhack, NULL );
-    VectorWhack ( & self -> ts, STypesetWhack, NULL );
-#endif
-#if SLVL >= 3
-    VectorWhack ( & self -> pt, SIndirectTypeWhack, NULL );
-#endif
-#if SLVL >= 2
-    VectorWhack ( & self -> cnst, SConstantWhack, NULL );
-#endif
-#if SLVL >= 3
-    VectorWhack ( & self -> func, SFunctionWhack, NULL );
-    VectorWhack ( & self -> fname, SNameOverloadWhack, NULL );
-#endif
-#if SLVL >= 5
-    VectorWhack ( & self -> phys, SPhysicalWhack, NULL );
-    VectorWhack ( & self -> pname, SNameOverloadWhack, NULL );
-#endif
-#if SLVL >= 6
-    VectorWhack ( & self -> tbl, STableWhack, NULL );
-    VectorWhack ( & self -> tname, SNameOverloadWhack, NULL );
-
-    VectorWhack ( & self -> db, SDatabaseWhack, NULL );
-    VectorWhack ( & self -> dname, SNameOverloadWhack, NULL );
-#endif
-
-    free ( self );
-}
-
-/* Whack
- */
-static
-rc_t CC VSchemaWhack ( VSchema *self )
-{
-    KRefcountWhack ( & self -> refcount, "VSchema" );
-
-    VSchemaSever ( self -> dad );
-    VSchemaDestroy ( self );
-
-    return 0;
-}
-
-
-/* AddRef
- * Release
- *  all objects are reference counted
- *  NULL references are ignored
- */
-LIB_EXPORT rc_t CC VSchemaAddRef ( const VSchema *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "VSchema" ) )
-        {
-        case krefLimit:
-            return RC ( rcVDB, rcMgr, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC VSchemaRelease ( const VSchema *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "VSchema" ) )
-        {
-        case krefWhack:
-            return VSchemaWhack ( ( VSchema* ) self );
-        case krefNegative:
-            return RC ( rcVDB, rcMgr, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-/* Attach
- * Sever
- */
-VSchema *VSchemaAttach ( const VSchema *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAddDep ( & self -> refcount, "VSchema" ) )
-        {
-        case krefLimit:
-            return NULL;
-        }
-    }
-    return ( VSchema* ) self;
-}
-
-rc_t VSchemaSever ( const VSchema *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDropDep ( & self -> refcount, "VSchema" ) )
-        {
-        case krefWhack:
-            return VSchemaWhack ( ( VSchema* ) self );
-        case krefNegative:
-            return RC ( rcVDB, rcMgr, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-/* StartIdx
- *  returns starting index
- */
-#define VSchemaStartIdx( dad, vect, starting ) \
-    ( ( ( dad ) == NULL ) ? ( starting ) : \
-      ( VectorStart ( & ( dad ) -> vect ) + \
-        VectorLength ( & ( dad ) -> vect ) ) )
-
-/* VectorInit
- *  performs vector initialization
- */
-#define VSchemaVectorInit( schema, dad, vect, starting, block ) \
-    VectorInit ( & ( schema ) -> vect, VSchemaStartIdx ( dad, vect, starting ), block )
-
-
-/* MakeSchema
- *  make an empty schema
- */
-rc_t VSchemaMake ( VSchema **sp,  const VSchema *dad )
-{
-    VSchema *schema = malloc ( sizeof * schema );
-    if ( schema == NULL )
-        return RC ( rcVDB, rcMgr, rcConstructing, rcMemory, rcExhausted );
-
-    schema -> dad = VSchemaAttach ( dad );
-    BSTreeInit ( & schema -> scope );
-    BSTreeInit ( & schema -> paths );
-
-    /* datatypes, typesets and parameterized types all shared
-       the same type_id space from 0..0xFFFFFFFF. each is
-       assigned a range to avoid overlap:
-
-       datatypes = 0..0x3FFFFFFF
-       typesets = 0x40000000..0x7FFFFFFF
-       undefined parameterized type = 0x80000000
-       parameterized types = 0x80000001..0xFFFFFFFF
-    */
-    VSchemaVectorInit ( schema, dad, inc, 0, 4 );
-    VSchemaVectorInit ( schema, dad, alias, 0, 16 );
-    VSchemaVectorInit ( schema, dad, fmt, 1, 16 );
-    VSchemaVectorInit ( schema, dad, dt, 0, 128 );
-    VSchemaVectorInit ( schema, dad, ts, 0x40000000, 16 );
-    VSchemaVectorInit ( schema, dad, pt, 0x80000001, 32 );
-
-    VSchemaVectorInit ( schema, dad, cnst, 0, 32 );
-    VSchemaVectorInit ( schema, dad, func, 0, 64 );
-    VSchemaVectorInit ( schema, dad, phys, 0, 32 );
-    VSchemaVectorInit ( schema, dad, tbl, 0, 16 );
-    VSchemaVectorInit ( schema, dad, db, 0, 4 );
-
-    VectorInit ( & schema -> fname, 0, 64 );
-    VectorInit ( & schema -> pname, 0, 32 );
-    VectorInit ( & schema -> tname, 0, 16 );
-    VectorInit ( & schema -> dname, 0, 4 );
-
-    KRefcountInit ( & schema -> refcount, 1, "VSchema", "make", "vschema" );
-    schema -> file_count = 0;
-    schema -> num_indirect = ( dad == NULL ) ? 0 : dad -> num_indirect;
-
-    /* copy the versioned name vectors and names */
-    if ( dad != NULL )
-    {
-        rc_t rc = SNameOverloadVectorCopy ( & schema -> scope, & dad -> fname, & schema -> fname );
-        if ( rc == 0 )
-            rc = SNameOverloadVectorCopy ( & schema -> scope, & dad -> pname, & schema -> pname );
-        if ( rc == 0 )
-            rc = SNameOverloadVectorCopy ( & schema -> scope, & dad -> tname, & schema -> tname );
-        if ( rc == 0 )
-            rc = SNameOverloadVectorCopy ( & schema -> scope, & dad -> dname, & schema -> dname );
-        if ( rc != 0 )
-        {
-            VSchemaWhack ( schema );
-            * sp = NULL;
-            return rc;
-        }
-    }
-    
-    * sp = schema;
-    return 0;
-}
-
-
-/* AddIncludePath
- *  add an include path to schema for locating input files
- */
-LIB_EXPORT rc_t CC VSchemaVAddIncludePath ( VSchema *self, const char *path, va_list args )
-{
-    KDirectory *wd;
-    rc_t rc = KDirectoryNativeDir ( & wd );
-    if ( rc == 0 )
-    {
-        const KDirectory *dir;
-        rc = KDirectoryVOpenDirRead ( wd, & dir, false, path, args );
-        if ( rc == 0 )
-        {
-            rc = VectorAppend ( & self -> inc, NULL, dir );
-            if ( rc != 0 )
-                KDirectoryRelease ( dir );
-        }
-
-        KDirectoryRelease ( wd );
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VSchemaAddIncludePath ( VSchema *self, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = VSchemaVAddIncludePath ( self, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* ParseText
- *  parse schema text
- *  add productions to existing schema
- *
- *  "name" [ IN, NULL OKAY ] - optional name
- *  representing text, e.g. filename
- *
- *  "text" [ IN ] and "bytes" [ IN ] - input buffer of text
- */
-static
-rc_t CC VSchemaParseTextInt ( VSchema *self,
-    const char *name, const char *text, size_t bytes )
-{
-    KTokenText tt;
-    KTokenSource src;
-    String str, path;
-    rc_t rc;
-    
-    if ( name == NULL || name [ 0 ] == 0 )
-        CONST_STRING ( & path, "<unnamed>" );
-    else
-        StringInitCString ( & path, name );
-
-    StringInit ( & str, text, bytes, string_len ( text, bytes ) );
-    KTokenTextInit ( & tt, & str, & path );
-    KTokenSourceInit ( & src, & tt );
-
-    rc = schema ( & src, self );
-    
-    if (rc == 0)
-        PARSE_DEBUG( ("Parsed schema from %s\n", name) );
-    else
-        PARSE_DEBUG( ("Failed to parse schema from %s\n", name) );
-    
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VSchemaParseText ( VSchema *self, const char *name,
-    const char *text, size_t bytes )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcSchema, rcParsing, rcSelf, rcNull );
-    else if ( bytes == 0 )
-        rc = 0;
-    else if ( text == NULL )
-        rc = RC ( rcVDB, rcSchema, rcParsing, rcParam, rcNull );
-    else
-        rc = VSchemaParseTextInt ( self, name, text, bytes );
-
-    return rc;
-}
-
-
-/* ParseTextCallback
- *  parse schema text
- *  add productions to existing schema
- *
- *  "name" [ IN, NULL OKAY ] - optional name
- *  representing text, e.g. filename
- *
- *  "fill" [ IN ] and "data" [ IN, OPAQUE ] - for filling buffer
- */
-rc_t VSchemaParseTextCallback ( VSchema *self, const char *name,
-    rc_t ( CC * fill ) ( void *self, KTokenText *tt, size_t save ), void *data )
-{
-    KTokenText tt;
-    KTokenSource src;
-
-    KTokenTextInitCString ( & tt, "", name );
-    tt . read = fill;
-    tt . data = data;
-
-    KTokenSourceInit ( & src, & tt );
-
-    return schema ( & src, self );
-}
-
-
-/* OpenFile
- *  opens a file, using include paths
- */
-static
-rc_t CC VSchemaTryOpenFile ( const VSchema *self, const KDirectory *dir, const KFile **fp,
-    char *path, size_t path_max, const char *name, va_list args )
-{
-    rc_t rc;
-    va_list cpy_args;
-
-    va_copy ( cpy_args, args );
-    rc = KDirectoryVResolvePath ( dir, true, path, path_max, name, cpy_args );
-    va_end ( cpy_args );
-
-    if ( rc == 0 )
-    {
-        /* try to find file in already opened list */
-        if ( BSTreeFind ( & self -> paths, path, VIncludedPathCmp ) != NULL )
-        {
-            * fp = NULL;
-            return 0;
-        }
-    }
-
-    if ( rc == 0 )
-        rc = KDirectoryVOpenFileRead ( dir, fp, path, NULL );
-
-    return rc;
-}
-
-static
-rc_t CC VSchemaOpenFile ( const VSchema *self, const KFile **fp,
-    char *path, size_t path_max, const char *name, va_list args )
-{
-    const VSchema *schema;
-    for ( schema = self; schema != NULL; schema = schema -> dad )
-    {
-        uint32_t i, end;
-
-        for ( i = VectorStart ( & schema -> inc ), end = i + VectorLength ( & schema -> inc );
-              i < end; ++ i )
-        {
-            const KDirectory *dir = ( const KDirectory* ) VectorGet ( & schema -> inc, i );
-            if ( dir != NULL )
-            {
-                rc_t rc = VSchemaTryOpenFile ( self, dir, fp, path, path_max, name, args );
-                if ( rc == 0 || GetRCState ( rc ) != rcNotFound )
-                    return rc;
-            }
-        }
-    }
-
-    return RC ( rcVDB, rcSchema, rcOpening, rcPath, rcNotFound );
-}
-
-/* ParseFile
- *  parse schema file
- *  add productions to existing schema
- *
- *  "name" [ IN ] - filename, absolute or valid relative to
- *  working directory or within an include path
- */
-LIB_EXPORT rc_t CC VSchemaVParseFile ( VSchema *self, const char *name, va_list args )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcSchema, rcOpening, rcSelf, rcNull );
-    else if ( name == NULL )
-        rc = RC ( rcVDB, rcSchema, rcOpening, rcPath, rcNull );
-    else if ( name [ 0 ] == 0 )
-        rc = RC ( rcVDB, rcSchema, rcOpening, rcPath, rcEmpty );
-    else
-    {
-        const KFile *f;
-        char path [ 4096 ];
-
-        /* open file using include paths */
-        rc = VSchemaOpenFile ( self, & f, path, sizeof path, name, args );
-
-        /* try to open the file according to current directory */
-        if ( rc != 0 )
-        {
-            KDirectory *wd;
-            rc = KDirectoryNativeDir ( & wd );
-            if ( rc == 0 )
-            {
-                rc = VSchemaTryOpenFile ( self, wd, & f, path, sizeof path, name, args );
-                KDirectoryRelease ( wd );
-            }
-        }
-
-        /* if the file was opened... */
-        if ( rc == 0 && f != NULL )
-        {
-            const KMMap *mm;
-            rc = KMMapMakeRead ( & mm, f );
-            if ( rc == 0 )
-            {
-                size_t size;
-                const void *addr;
-                rc = KMMapAddrRead ( mm, & addr );
-                if ( rc == 0 )
-                    rc = KMMapSize ( mm, & size );
-                if ( rc == 0 )
-                {
-                    rc = VIncludedPathMake ( & self -> paths, & self -> file_count, path );
-                    if ( rc == 0 )
-                        rc = VSchemaParseTextInt ( self, path, addr, size );
-                }
-            
-                KMMapRelease ( mm );
-            }
-        
-            KFileRelease ( f );
-        }
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VSchemaParseFile ( VSchema *self, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = VSchemaVParseFile ( self, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* ResolveFmtdecl
- *  converts a fmtdecl string to fmt id, type id and vector dimension
- *
- *  "resolved" [ OUT ] - resolved fmtdecl
- *
- *  "fmtdecl" [ IN ] - type declaration
- */
-rc_t CC VSchemaVResolveFmtdecl ( const VSchema *self,
-    VFormatdecl *resolved, const char *decl, va_list args )
-{
-    rc_t rc;
-
-    if ( resolved == NULL )
-        rc = RC ( rcVDB, rcSchema, rcResolving, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcSchema, rcResolving, rcSelf, rcNull );
-        else if ( decl == NULL )
-            rc = RC ( rcVDB, rcSchema, rcResolving, rcType, rcNull );
-        else if ( decl [ 0 ] == 0 )
-            rc = RC ( rcVDB, rcSchema, rcResolving, rcType, rcEmpty );
-        else
-        {
-            char buffer [ 256 ];
-            int len = vsnprintf ( buffer, sizeof buffer, decl, args );
-            if ( len < 0 || len >= sizeof buffer )
-                rc = RC ( rcVDB, rcSchema, rcResolving, rcType, rcExcessive );
-            else
-            {
-                KSymTable tbl;
-                rc = init_symtab ( & tbl, self );
-                if ( rc == 0 )
-                {
-                    KToken t;
-                    KTokenText tt;
-                    KTokenSource src;
-                    String text, path;
-
-                    SchemaEnv env;
-                    SchemaEnvInit ( & env, EXT_SCHEMA_LANG_VERSION );
-
-                    StringInit ( & text, buffer, len, string_len ( buffer, len ) );
-                    CONST_STRING ( & path, "VSchemaResolve" );
-                    KTokenTextInit ( & tt, & text, & path );
-                    KTokenSourceInit ( & src, & tt );
-
-                    rc = fmtspec ( & tbl, & src, next_token ( & tbl, & src, & t ),
-                        & env, self, resolved );
-
-                    KSymTableWhack ( & tbl );
-
-                    if ( rc == 0 )
-                        return 0;
-                }
-            }
-        }
-
-        resolved -> td . type_id = 0;
-        resolved -> td . dim = 0;
-        resolved -> fmt = 0;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VSchemaResolveFmtdecl ( const VSchema *self,
-    VFormatdecl *resolved, const char *fmtdecl, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, fmtdecl );
-    rc = VSchemaVResolveFmtdecl ( self, resolved, fmtdecl, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* ResolveTypespec
- *  converts a typespec string to fmt id, type id and vector dimension
- *
- *  "resolved" [ OUT ] - resolved fmtdecl
- *
- *  "typespec" [ IN ] - type specification
- */
-LIB_EXPORT rc_t CC VSchemaVResolveTypespec ( const VSchema *self,
-    VTypedecl *resolved, const char *decl, va_list args )
-{
-    rc_t rc;
-
-    if ( resolved == NULL )
-        rc = RC ( rcVDB, rcSchema, rcResolving, rcParam, rcNull );
-    else
-    {
-        VFormatdecl fd;
-        rc = VSchemaVResolveFmtdecl ( self, & fd, decl, args );
-        if ( rc == 0 )
-        {
-            if ( fd . fmt != 0 )
-                rc = RC ( rcVDB, rcSchema, rcResolving, rcType, rcIncorrect );
-            else
-            {
-                * resolved = fd . td;
-                return 0;
-            }
-        }
-
-        resolved -> type_id = 0;
-        resolved -> dim = 0;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VSchemaResolveTypespec ( const VSchema *self,
-    VTypedecl *resolved, const char *typespec, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, typespec );
-    rc = VSchemaVResolveTypespec ( self, resolved, typespec, args );
-    va_end ( args );
-
-    return rc;
-}
-
-/* ResolveTypedecl
- *  converts a typedecl string to type id and vector dimension
- *
- *  "resolved" [ OUT ] - resolved type declaration
- *
- *  "typedecl" [ IN ] - type declaration
- */
-LIB_EXPORT rc_t CC VSchemaVResolveTypedecl ( const VSchema *self,
-    VTypedecl *resolved, const char *decl, va_list args )
-{
-    rc_t rc = VSchemaVResolveTypespec ( self, resolved, decl, args );
-    if ( rc == 0 )
-    {
-        if ( ( resolved -> type_id & 0xC0000000 ) == 0 )
-            return 0;
-
-        rc = RC ( rcVDB, rcSchema, rcResolving, rcType, rcIncorrect );
-        
-        resolved -> type_id = 0;
-        resolved -> dim = 0;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VSchemaResolveTypedecl ( const VSchema *self,
-    VTypedecl *resolved, const char *typedecl, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, typedecl );
-    rc = VSchemaVResolveTypedecl ( self, resolved, typedecl, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* IncludeFiles
- *  generates a list of paths to include file
- */
-static
-bool CC VIncludedPathList ( BSTNode *n, void *list )
-{
-    const VIncludedPath *p = ( const VIncludedPath* ) n;
-    rc_t rc = VNamelistAppend ( list, p -> path );
-    return ( rc != 0 ) ? true : false;
-}
-
-LIB_EXPORT rc_t CC VSchemaIncludeFiles ( const VSchema *self, const KNamelist **listp )
-{
-    rc_t rc;
-    if ( listp == NULL )
-        rc = RC ( rcVDB, rcSchema, rcListing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcSchema, rcListing, rcSelf, rcNull );
-        else
-        {
-            /* create namelist */
-            VNamelist *list;
-            rc = VNamelistMake ( & list, self -> file_count );
-            if ( rc == 0 )
-            {
-                /* create a shallow copy */
-                BSTree paths = self -> paths;
-
-                /* sort by order rather than by path */
-                BSTreeResort ( & paths, VIncludedPathSortByOrder );
-
-                /* add paths to list */
-                if ( BSTreeDoUntil ( & paths, false, VIncludedPathList, list ) )
-                    rc = RC ( rcVDB, rcSchema, rcListing, rcMemory, rcExhausted );
-
-                /* restore path order */
-                BSTreeResort ( & paths, VIncludedPathSort );
-                assert ( paths . root == self -> paths . root );
-
-                /* cast list, creating a new reference */
-                if ( rc == 0 )
-                    rc = VNamelistToNamelist ( list, (KNamelist **)listp );
-
-                /* discard original reference */
-                VNamelistRelease ( list );
-
-                /* return list */
-                if ( rc == 0 )
-                    return 0;
-            }
-        }
-
-        * listp = NULL;
-    }
-    return rc;
-}
-
-
-/* ListLegacyTables - PRIVATE
- *  scan all tables defined in schema
- *  return the fully-qualified and versioned name of each legacy SRA table
- */
-typedef struct STableFindData STableFindData;
-struct STableFindData
-{
-    VNamelist *list;
-    rc_t rc;
-};
-
-static
-bool CC STableTestUntyped ( void *item, void *data )
-{
-    const STable *stbl = ( const void* ) item;
-    STableFindData *pb = data;
-
-    if ( stbl -> untyped != NULL )
-    {
-        char buffer [ 1024 ];
-
-        /* found a legacy table */
-        pb -> rc = string_printf ( buffer, sizeof buffer, NULL, "%N#%V", stbl -> name, stbl -> version );
-        if ( pb -> rc != 0 )
-        {
-            pb -> rc = RC ( rcVDB, rcSchema, rcListing, rcName, rcExcessive );
-            return true;
-        }
-
-        /* add it to the vector */
-        pb -> rc = VNamelistAppend ( pb -> list, buffer );
-        if ( pb -> rc != 0 )
-            return true;
-    }
-
-    return false;
-}
-
-static
-bool VSchemaFindUntyped ( const VSchema *self, STableFindData *pb )
-{
-    if ( self -> dad )
-    {
-        if ( VSchemaFindUntyped ( self -> dad, pb ) )
-            return true;
-    }
-
-    return VectorDoUntil ( & self -> tbl, false, STableTestUntyped, pb );
-}
-
-LIB_EXPORT rc_t CC VSchemaListLegacyTables ( const VSchema *self, KNamelist **listp )
-{
-    rc_t rc;
-
-    if ( listp == NULL )
-        rc = RC ( rcVDB, rcSchema, rcListing, rcParam, rcNull );
-    else
-    {
-        * listp = NULL;
-
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcSchema, rcListing, rcSelf, rcNull );
-        else
-        {
-            STableFindData pb;
-            rc = VNamelistMake ( & pb . list, 16 );
-            if ( rc == 0 )
-            {
-                pb . rc = 0;
-                if ( VSchemaFindUntyped ( self, & pb ) )
-                    rc = pb . rc;
-                else
-                    rc = VNamelistToNamelist ( pb . list, listp );
-                    
-                VNamelistRelease ( pb . list );
-            }
-        }
-    }
-
-    return rc;
-}
-
-/*--------------------------------------------------------------------------
- * VDBManager
- */
-
-LIB_EXPORT rc_t CC VDBManagerMakeSchema ( const VDBManager *self, VSchema **schema )
-{
-    rc_t rc;
-    if ( schema == NULL )
-        rc = RC ( rcVDB, rcMgr, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcMgr, rcConstructing, rcSelf, rcNull );
-        else
-        {
-            rc = VSchemaMake ( schema, self -> schema );
-            if ( rc == 0 )
-                return rc;
-        }
-
-        * schema = NULL;
-    }
-
-    return rc;
-}
-
-
-
-/*--------------------------------------------------------------------------
- * VSchemaRuntimeTable
- *  an object that represents a table ( or sub-table ) created at runtime
- *  that can be used to create a VTable object
- */
-struct VSchemaRuntimeTable
-{
-    VSchema *schema;
-    KDataBuffer text;
-    size_t bytes;
-};
-
-
-/* Print
- *  print schema text into buffer
- */
-static
-rc_t VSchemaRuntimeTablePrint ( VSchemaRuntimeTable *self, const char *fmt, ... )
-{
-    int status;
-    va_list args;
-
-    char *buffer;
-    size_t bsize;
-
-    /* make sure there's a bunch of room */
-    if ( self -> text . elem_count - self -> bytes < 4096 )
-    {
-        rc_t rc = KDataBufferResize ( & self -> text, self -> text . elem_count + 4096 );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    /* the output buffer for this print */
-    buffer = self -> text . base;
-    bsize = self -> text . elem_count - self -> bytes;
-
-    va_start ( args, fmt );
-    status = vsnprintf ( & buffer [ self -> bytes ], bsize, fmt, args );
-    va_end ( args );
-
-    if ( status < 0 || status >= bsize )
-        return RC ( rcVDB, rcSchema, rcConstructing, rcParam, rcExcessive );
-
-    self -> bytes += status;
-    return 0;
-}
-
-
-/* Make
- *  make a table in the schema provided
- *
- *  "tbl" [ OUT ] - return parameter for new schema table object
- *
- *  "typename" [ IN ] - NUL terminated string giving desired typename of table
- *   may include version spec
- *
- *  "supertype_spec" [ IN, NULL OKAY ] - optional supertype spec, giving
- *   either a single super-table type string or multiple comma-separated tables
- */
-LIB_EXPORT rc_t CC VSchemaMakeRuntimeTable ( VSchema *self,
-    VSchemaRuntimeTable **tblp, const char *typename, const char *supertype_spec )
-{
-    rc_t rc;
-
-    if ( tblp == NULL )
-        rc = RC ( rcVDB, rcSchema, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcSchema, rcConstructing, rcSelf, rcNull );
-        else if ( typename == NULL )
-            rc = RC ( rcVDB, rcSchema, rcConstructing, rcType, rcNull );
-        else if ( typename [ 0 ] == 0 )
-            rc = RC ( rcVDB, rcSchema, rcConstructing, rcType, rcEmpty );
-        else
-        {
-            VSchemaRuntimeTable *tbl = malloc ( sizeof * tbl );
-            if ( tbl == NULL )
-                rc = RC ( rcVDB, rcSchema, rcConstructing, rcMemory, rcExhausted );
-            else
-            {
-                rc = KDataBufferMakeBytes ( & tbl -> text, 4096 * 2 );
-                if ( rc == 0 )
-                {
-                    rc = VSchemaAddRef ( self );
-                    if ( rc == 0 )
-                    {
-                        const char *dflt_vers = "";
-                        if ( strchr ( typename, '#' ) == NULL )
-                            dflt_vers = "#1.0";
-
-                        tbl -> schema = self;
-                        tbl -> bytes = 0;
-
-                        /* open the table */
-                        rc = VSchemaRuntimeTablePrint ( tbl, "table %s%s", typename, dflt_vers );
-                        if ( rc == 0 )
-                        {
-                            if ( supertype_spec != NULL && supertype_spec [ 0 ] != 0 )
-                                rc = VSchemaRuntimeTablePrint ( tbl, " = %s", supertype_spec );
-                            if ( rc == 0 )
-                            {
-                                rc = VSchemaRuntimeTablePrint ( tbl, "\n{\n" );
-                                if ( rc == 0 )
-                                {
-                                    * tblp = tbl;
-                                    return 0;
-                                }
-                            }
-                        }
-
-                        VSchemaRelease ( tbl -> schema );
-                    }
-
-                    KDataBufferWhack ( & tbl -> text );
-                }
-
-                free ( tbl );
-            }
-        }
-
-        * tblp = NULL;
-    }
-
-    return rc;
-}
-
-/* Close
- *  close the schema table handle
- *  discards any uncomitted data
- */
-LIB_EXPORT rc_t CC VSchemaRuntimeTableClose ( VSchemaRuntimeTable *self )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcSchema, rcClosing, rcSelf, rcNull );
-    else
-    {
-        rc = VSchemaRelease ( self -> schema );
-        if ( rc == 0 )
-        {
-            KDataBufferWhack ( & self -> text );
-            free ( self );
-        }
-    }
-
-    return rc;
-}
-
-
-/* Commit
- *  commits table data
- *  closes object to further modification
- */
-LIB_EXPORT rc_t CC VSchemaRuntimeTableCommit ( VSchemaRuntimeTable *self )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcSchema, rcCommitting, rcSelf, rcNull );
-    else
-    {
-        const char *data = self -> text . base;
-        if ( self -> bytes == 0 )
-            rc = RC ( rcVDB, rcSchema, rcCommitting, rcSelf, rcEmpty );
-        else
-        {
-            rc = VSchemaRuntimeTablePrint ( self, "}\n" );
-            if ( rc == 0 )
-                rc = VSchemaParseText ( self -> schema, "runtime-table", data, self -> bytes );
-            KDataBufferWhack ( & self -> text );
-        }
-    }
-
-    return rc;
-}
-
-
-/* AddColumn
- *  add a simple column to the table
- *
- *  "td" [ IN ] - data type of column, obtained from schema object
- *
- *  "encoding" [ IN, NULL OKAY ] - optional compression/encoding type
- *  specified as a NUL-terminated string
- *
- *  "name" [ IN ] - NUL-terminated simple ASCII name
- *   conforming to column name requirements
- */
-LIB_EXPORT rc_t CC VSchemaRuntimeTableVAddColumn ( VSchemaRuntimeTable *self, 
-    const VTypedecl *td, const char *encoding, const char *name, va_list args )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcSchema, rcUpdating, rcSelf, rcNull );
-    else if ( td == NULL )
-        rc = RC ( rcVDB, rcSchema, rcUpdating, rcType, rcNull );
-    else if ( name == NULL )
-        rc = RC ( rcVDB, rcSchema, rcUpdating, rcName, rcNull );
-    else if ( name [ 0 ] == 0 )
-        rc = RC ( rcVDB, rcSchema, rcUpdating, rcName, rcEmpty );
-    else
-    {
-        char typedecl [ 256 ];
-        rc = VTypedeclToText ( td, self -> schema, typedecl, sizeof typedecl );
-        if ( rc == 0 )
-        {
-            rc = VSchemaRuntimeTablePrint ( self, "    extern column " );
-            if ( rc == 0 )
-            {
-                if ( encoding != NULL && encoding [ 0 ] != 0 )
-                    rc = VSchemaRuntimeTablePrint ( self, "%s ", encoding );
-                else
-                    rc = VSchemaRuntimeTablePrint ( self, "%s ", typedecl );
-            }
-            if ( rc == 0 )
-                rc = VSchemaRuntimeTablePrint ( self, name, args );
-            if ( rc == 0 )
-                rc = VSchemaRuntimeTablePrint ( self, ";\n" );
-        }
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VSchemaRuntimeTableAddColumn ( VSchemaRuntimeTable *self, 
-    const VTypedecl *td, const char *encoding, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = VSchemaRuntimeTableVAddColumn ( self, td, encoding, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* AddTypedColumn
- *  Gerber versions of AddColumn
- *
- *  AddBooleanColumn - simple boolean column with default compression
- *                     provides both packed ( single bit ) and byte versions
- *  AddIntegerColumn - sized integer column with appropriate sign, size and compression
- *  AddFloatColumn   - sized floating point column with lossy compression
- *  AddAsciiColumn   - 8-bit ASCII text column with standard compression
- *  AddUnicodeColumn - UTF8, UTF16, or UTF32 text column with standard compression
- */
-LIB_EXPORT rc_t CC VSchemaRuntimeTableVAddBooleanColumn ( VSchemaRuntimeTable *self, const char *name, va_list args )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcSchema, rcUpdating, rcSelf, rcNull );
-    else if ( name == NULL )
-        rc = RC ( rcVDB, rcSchema, rcUpdating, rcName, rcNull );
-    else if ( name [ 0 ] == 0 )
-        rc = RC ( rcVDB, rcSchema, rcUpdating, rcName, rcEmpty );
-    else
-    {
-        VTypedecl td;
-        rc = VSchemaResolveTypedecl ( self -> schema, & td, "bool" );
-        if ( rc == 0 )
-            rc = VSchemaRuntimeTableVAddColumn ( self, & td, "bool_encoding", name, args );
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VSchemaRuntimeTableAddBooleanColumn ( VSchemaRuntimeTable *self, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = VSchemaRuntimeTableVAddBooleanColumn ( self, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VSchemaRuntimeTableVAddIntegerColumn ( VSchemaRuntimeTable *self,
-    uint32_t bits, bool has_sign,  const char *name, va_list args )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcSchema, rcUpdating, rcSelf, rcNull );
-    else if ( name == NULL )
-        rc = RC ( rcVDB, rcSchema, rcUpdating, rcName, rcNull );
-    else if ( name [ 0 ] == 0 )
-        rc = RC ( rcVDB, rcSchema, rcUpdating, rcName, rcEmpty );
-    else
-    {
-        VTypedecl td;
-
-        char typedecl [ 256 ];
-        int status = snprintf ( typedecl, sizeof typedecl, "%c%u", has_sign ? 'I' : 'U', bits );
-        if ( status < 0 || status >= sizeof typedecl )
-            rc = RC ( rcVDB, rcSchema, rcUpdating, rcBuffer, rcInsufficient );
-        else
-        {
-            rc = VSchemaResolveTypedecl ( self -> schema, & td, typedecl );
-            if ( rc != 0 && ( ( ( ( bits - 1 ) & bits ) != 0 ) || bits < 8 || bits > 64 ) )
-            {
-                status = snprintf ( typedecl, sizeof typedecl, "%c1 [ %u ]", ( bits < 4 ) ? 'B' : ( has_sign ? 'I' : 'U' ), bits );
-                if ( status < 0 || status >= sizeof typedecl )
-                    rc = RC ( rcVDB, rcSchema, rcUpdating, rcBuffer, rcInsufficient );
-                else
-                    rc = VSchemaResolveTypedecl ( self -> schema, & td, typedecl );
-            }
-            if ( rc == 0 )
-            {
-                char encoding [ 256 ];
-
-                status = snprintf ( encoding, sizeof encoding, "< %s > izip_encoding", typedecl );
-                if ( status < 0 || status >= sizeof encoding )
-                    rc = RC ( rcVDB, rcSchema, rcUpdating, rcBuffer, rcInsufficient );
-                else
-                    rc = VSchemaRuntimeTableVAddColumn ( self, & td, encoding, name, args );
-            }
-        }
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VSchemaRuntimeTableAddIntegerColumn ( VSchemaRuntimeTable *self,
-    uint32_t bits, bool has_sign,  const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = VSchemaRuntimeTableVAddIntegerColumn ( self, bits, has_sign, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VSchemaRuntimeTableVAddFloatColumn ( VSchemaRuntimeTable *self,
-    uint32_t bits, uint32_t significant_mantissa_bits,  const char *name, va_list args )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcSchema, rcUpdating, rcSelf, rcNull );
-    else if ( name == NULL )
-        rc = RC ( rcVDB, rcSchema, rcUpdating, rcName, rcNull );
-    else if ( name [ 0 ] == 0 )
-        rc = RC ( rcVDB, rcSchema, rcUpdating, rcName, rcEmpty );
-    else
-    {
-        VTypedecl td;
-
-        char typedecl [ 256 ];
-        int status = snprintf ( typedecl, sizeof typedecl, "F%u", bits );
-        if ( status < 0 || status >= sizeof typedecl )
-            rc = RC ( rcVDB, rcSchema, rcUpdating, rcBuffer, rcInsufficient );
-        else
-        {
-            rc = VSchemaResolveTypedecl ( self -> schema, & td, typedecl );
-            if ( rc == 0 )
-            {
-                char encoding [ 256 ];
-
-                if ( bits != 32 || significant_mantissa_bits >= bits )
-                {
-                    status = snprintf ( encoding, sizeof encoding,
-                        "< %s > zip_encoding", typedecl );
-                }
-                else
-                {
-                    status = snprintf ( encoding, sizeof encoding,
-                        "< %s > fzip_encoding < %u >", typedecl, significant_mantissa_bits );
-                }
-                if ( status < 0 || status >= sizeof encoding )
-                    rc = RC ( rcVDB, rcSchema, rcUpdating, rcBuffer, rcInsufficient );
-                else
-                    rc = VSchemaRuntimeTableVAddColumn ( self, & td, encoding, name, args );
-            }
-        }
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VSchemaRuntimeTableAddFloatColumn ( VSchemaRuntimeTable *self,
-    uint32_t bits, uint32_t significant_mantissa_bits,  const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = VSchemaRuntimeTableVAddFloatColumn ( self, bits, significant_mantissa_bits, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VSchemaRuntimeTableVAddAsciiColumn ( VSchemaRuntimeTable *self, const char *name, va_list args )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcSchema, rcUpdating, rcSelf, rcNull );
-    else if ( name == NULL )
-        rc = RC ( rcVDB, rcSchema, rcUpdating, rcName, rcNull );
-    else if ( name [ 0 ] == 0 )
-        rc = RC ( rcVDB, rcSchema, rcUpdating, rcName, rcEmpty );
-    else
-    {
-        VTypedecl td;
-        rc = VSchemaResolveTypedecl ( self -> schema, & td, "ascii" );
-        if ( rc == 0 )
-            rc = VSchemaRuntimeTableVAddColumn ( self, & td, "< ascii > zip_encoding", name, args );
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VSchemaRuntimeTableAddAsciiColumn ( VSchemaRuntimeTable *self, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = VSchemaRuntimeTableVAddAsciiColumn ( self, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC VSchemaRuntimeTableVAddUnicodeColumn ( VSchemaRuntimeTable *self,
-    uint32_t bits, const char *name, va_list args )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcSchema, rcUpdating, rcSelf, rcNull );
-    else if ( name == NULL )
-        rc = RC ( rcVDB, rcSchema, rcUpdating, rcName, rcNull );
-    else if ( name [ 0 ] == 0 )
-        rc = RC ( rcVDB, rcSchema, rcUpdating, rcName, rcEmpty );
-    else
-    {
-        VTypedecl td;
-
-        char typedecl [ 256 ];
-        int status = snprintf ( typedecl, sizeof typedecl, "utf%u", bits );
-        if ( status < 0 || status >= sizeof typedecl )
-            rc = RC ( rcVDB, rcSchema, rcUpdating, rcBuffer, rcInsufficient );
-        else
-        {
-            rc = VSchemaResolveTypedecl ( self -> schema, & td, typedecl );
-            if ( rc == 0 )
-            {
-                char encoding [ 256 ];
-                status = snprintf ( encoding, sizeof encoding,
-                    "< %s > zip_encoding", typedecl );
-                if ( status < 0 || status >= sizeof encoding )
-                    rc = RC ( rcVDB, rcSchema, rcUpdating, rcBuffer, rcInsufficient );
-                else
-                    rc = VSchemaRuntimeTableVAddColumn ( self, & td, encoding, name, args );
-            }
-        }
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VSchemaRuntimeTableAddUnicodeColumn ( VSchemaRuntimeTable *self,
-    uint32_t bits, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = VSchemaRuntimeTableVAddUnicodeColumn ( self, bits, name, args );
-    va_end ( args );
-
-    return rc;
-}
diff --git a/libs/vdb/split.c b/libs/vdb/split.c
deleted file mode 100644
index 14ebc12..0000000
--- a/libs/vdb/split.c
+++ /dev/null
@@ -1,398 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <vdb/extern.h>
-#include "blob.h"
-
-#include "blob-headers.h"
-#include "page-map.h"
-#include "blob-priv.h"
-#include "prod-priv.h"
-#include "xform-priv.h"
-
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <klib/data-buffer.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-#include <atomic32.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-static
-int64_t read_64(const uint8_t **Src, const uint8_t *end, int scale, rc_t *rc) {
-	int64_t x = 0;
-	uint8_t c;
-	const uint8_t *src = *Src;
-	int n = 0;
-	
-	switch (scale) {
-	case 1:
-		scale = 2;
-		break;
-	case 2:
-		scale = 3;
-		break;
-	case 4:
-		scale = 5;
-		break;
-	case 8:
-		scale = 10;
-		break;
-	default:
-		return 0;
-	}
-	*rc = 0;
-	do {
-		if (src >= end) {
-			*rc = RC(rcVDB, rcBlob, rcConstructing, rcData, rcInsufficient);
-			return 0;
-		}
-		if (++n > scale) {
-			*rc = RC(rcVDB, rcBlob, rcConstructing, rcData, rcInvalid);
-			return 0;
-		}
-		
-		c = *src++;
-		if ((c & 0x80) != 0)
-			break;
-		x <<= 7;
-		x |= c;
-	} while (1);
-    
-	c &= 0x7F;
-	if ((c & 0x40) != 0) {
-		c &= 0x3F;
-		x <<= 6;
-		x |= c;
-		x = -x;
-	}
-	else {
-		x <<= 6;
-		x |= c;
-	}
-	*Src = src;
-	return x;
-}
-
-static rc_t VBlobSplit_v1_validate_header(const uint8_t *inp, const uint8_t *in_end, unsigned n, const uint8_t **data) {
-    rc_t rc;
-    unsigned i;
-    
-    for (i = 0; i != n; ++i) {
-        read_64(&inp, in_end, 4, &rc);
-        if (rc != 0)
-            return rc;
-    }
-    *data = inp;
-    return 0;
-}
-
-static rc_t VBlobSplit_v1(VBlob **lhs, const VBlob *self, uint32_t index, uint32_t elem_bits) {
-    const uint8_t *inp;
-    const uint8_t *in_end;
-    const uint8_t *data;
-    size_t insize;
-    rc_t rc;
-    unsigned block_count;
-    unsigned i;
-    
-    inp = self->data.base;
-    assert(self->data.bit_offset == 0);
-    insize = KDataBufferBytes(&self->data);
-    assert(insize > 0);
-    in_end = inp + insize;
-    
-    block_count = (unsigned int)read_64(&inp, in_end, 1, &rc);
-    if (rc != 0)
-        return rc;
-    
-    rc = VBlobSplit_v1_validate_header(inp, in_end, block_count, &data);
-    if (rc != 0)
-        return rc;
-    
-    for (i = 0; i != block_count; ++i) {
-        unsigned block_size = (unsigned int)read_64(&inp, in_end, 4, &rc);
-        uint8_t bits;
-        uint8_t byte_order;
-        uint16_t row_len;
-        int64_t start_id;
-        uint32_t id_span;
-        const char *datatype;
-        
-        if (data >= in_end || data + 1 >= in_end)
-            return RC(rcVDB, rcBlob, rcConstructing, rcData, rcInsufficient);
-        bits = data[0];
-        byte_order = data[1];
-        data += 2;
-        
-        row_len = (uint16_t)read_64(&data, in_end, 2, &rc);
-        if (rc != 0)
-            return rc;
-        
-        start_id = read_64(&data, in_end, 8, &rc);
-        if (rc != 0)
-            return rc;
-        
-        id_span = (uint32_t)read_64(&data, in_end, 4, &rc);
-        if (rc != 0)
-            return rc;
-        
-        if (data + block_size >= in_end)
-            return RC(rcVDB, rcBlob, rcConstructing, rcData, rcInsufficient);
-        
-        datatype = (const char *)data;
-        data = memchr(datatype, 0, block_size);
-        if (data == NULL)
-            return RC(rcVDB, rcBlob, rcConstructing, rcData, rcInvalid);
-        
-        ++data;
-        if (data >= in_end)
-            return RC(rcVDB, rcBlob, rcConstructing, rcData, rcInsufficient);
-        
-        if (i == index) {
-            if (((block_size * 8) - bits) % elem_bits != 0)
-                rc = RC(rcVDB, rcBlob, rcConstructing, rcData, rcInvalid);
-            else {
-                VBlob *y;
-                
-                rc = VBlobNew(&y, start_id, start_id + id_span, "split");
-                if (rc == 0) {
-                    KDataBuffer temp;
-                    
-                    y->byte_order = byte_order;
-                    rc = KDataBufferCast(&self->data, &temp, 8, false);
-                    if (rc == 0) {
-                        KDataBufferSub(&temp, &temp, (uint32_t)( data - (const uint8_t *)self->data.base ), block_size);
-                        KDataBufferCast(&temp, &temp, 1, true);
-                        temp.elem_count -= bits;
-                        rc = KDataBufferCast(&temp, &y->data, elem_bits, false);
-                        KDataBufferWhack(&temp);
-                        if (rc == 0) {
-                            rc = PageMapNewFixedRowLength(&y->pm, BlobRowCount(y), row_len);
-                            if (rc == 0) {
-                                *lhs = y;
-                                return 0;
-                            }
-                        }
-                    }
-                    TRACK_BLOB( VBlobRelease, ((VBlob*)y) );
-                    (void)VBlobRelease(y);
-                }
-            }
-            return rc;
-        }
-        data += block_size;
-    }
-    return RC(rcVDB, rcBlob, rcConstructing, rcParam, rcInvalid);
-}
-
-static rc_t VBlobSplit_v2(VBlob **lhs, const VBlob *self, uint32_t index, uint32_t elem_bits, const VBlobHeader *hdr) {
-    unsigned doffset;
-    unsigned dlength;
-    unsigned num_inputs;
-    unsigned num_maps;
-    unsigned map;
-    unsigned i;
-    int64_t val;
-    rc_t rc;
-    VBlob *y;
-    PageMap *pm;
-    BlobHeaders *headers;
-    
-    rc = VBlobHeaderArgPopHead(hdr, &val);
-    if (rc)
-        return rc;
-    num_inputs = (unsigned)val;
-    
-    if ( (unsigned)index > num_inputs )
-        return RC(rcVDB, rcBlob, rcConstructing, rcParam, rcInvalid);
-    
-    rc = VBlobHeaderArgPopHead(hdr, &val);
-    if (rc)
-        return rc;
-    num_maps = (unsigned)val;
-    
-    for (map = 0, i = 0; i != num_inputs; ++i) {
-        rc = VBlobHeaderArgPopHead(hdr, &val);
-        if (rc)
-            break;
-        if (i == index)
-            map = (unsigned)val;
-    }
-    if (rc)
-        return rc;
-    if (map > num_maps || map < 0)
-        return RC(rcVDB, rcBlob, rcConstructing, rcData, rcInvalid);
-    
-    if (self->spmc == 0) {
-        ((VBlob *)self)->spmc = malloc(sizeof(*self->spmc) - sizeof(self->spmc->pm) + num_maps * sizeof(self->spmc->pm[0]));
-        if (self->spmc) {
-            self->spmc->n = num_maps;
-            for (doffset = i = 0; i != num_maps; ++i) {
-                rc = VBlobHeaderArgPopHead(hdr, &val);
-                if (rc)
-                    break;
-                rc = PageMapDeserialize(&self->spmc->pm[i], &((uint8_t *)self->data.base)[doffset], (uint32_t)val, BlobRowCount(self));
-                if (rc)
-                    break;
-                doffset += (unsigned)val;
-            }
-        }
-        else
-            return RC(rcVDB, rcBlob, rcConstructing, rcMemory, rcExhausted);
-    }
-    else {
-        for (doffset = i = 0; i != num_maps; ++i) {
-            rc = VBlobHeaderArgPopHead(hdr, &val);
-            if (rc)
-                break;
-            doffset += (unsigned)val;
-        }
-    }
-    if (rc)
-        return rc;
-    pm = self->spmc->pm[map];
-    
-    for (i = 0; rc == 0 && i != num_inputs; ++i) {
-        rc = VBlobHeaderArgPopHead(hdr, &val);
-        if ( rc )
-            break;
-        if ( i == index ) {
-            if (val)
-                rc = BlobHeadersCreateFromData(&headers, &((uint8_t *)self->data.base)[doffset], (uint32_t)val);
-            else
-                headers = NULL;
-        }
-        doffset += (unsigned)val;
-    }
-    
-    for (dlength = 0, i = 0; rc == 0 && i != num_inputs; ++i) {
-        rc = VBlobHeaderArgPopHead(hdr, &val);
-        if (rc)
-            break;
-        if (i == index) {
-            dlength = (unsigned)val;
-            break;
-        }
-        doffset += ( ( (unsigned)val + 7 ) >> 3 );
-    }
-    if (rc)
-        return rc;
-    assert(dlength != 0);
-    
-    rc = VBlobNew(&y, self->start_id, self->stop_id, "split");
-    if (rc == 0) {
-        KDataBuffer buffer;
-        
-        rc = KDataBufferCast(&self->data, &buffer, 8, false);
-        if (rc == 0) {
-            KDataBufferSub( &buffer, &buffer, (uint32_t)doffset, (uint32_t)( (dlength + 7) >> 3 ) );
-            KDataBufferCast(&buffer, &buffer, 1, true);
-            buffer.elem_count = (uint32_t)dlength;
-            rc = KDataBufferCast(&buffer, &y->data, elem_bits, false);
-            KDataBufferWhack(&buffer);
-            if (rc == 0) {
-                y->pm = pm;
-                PageMapAddRef(y->pm);
-                y->headers = (BlobHeaders *)headers;
-                
-                *lhs = y;
-                return 0;
-            }
-        }
-        TRACK_BLOB( VBlobRelease, ((VBlob*)y) );
-        (void)VBlobRelease(y);
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VBlobBufferSplit(VBlob **lhs, const VBlob *self, uint32_t index, uint32_t elem_bits) {
-    rc_t rc;
-    
-    if (self->headers) {
-        const VBlobHeader *hdr = BlobHeadersGetHeader(self->headers);
-		
-        if (hdr) {
-            switch (VBlobHeaderVersion(hdr)) {
-            case 1:
-                rc = VBlobSplit_v2(lhs, self, index, elem_bits, hdr);
-                break;
-            default:
-                rc = RC(rcVDB, rcBlob, rcConstructing, rcData, rcBadVersion);
-                break;
-            }
-            VBlobHeaderRelease(hdr);
-            return rc;
-        }
-        return RC(rcVDB, rcBlob, rcConstructing, rcMemory, rcExhausted);
-    }
-    else {
-        return VBlobSplit_v1(lhs, self, index, elem_bits);
-    }
-}
-
-typedef struct self_t {
-    uint32_t index;
-} self_t;
-
-/* split
- *  any split #1.0 < U32 idx > ( merged_fmt in );
- *  any NCBI:split #1.0 < U32 idx > ( merged_t in );
- */
-static
-rc_t CC split_impl( void *self,
-                const VXformInfo *info,
-                int64_t row_id,
-                VBlob **rslt,
-                uint32_t argc,
-                const VBlob *argv[] )
-{
-    return VBlobBufferSplit(rslt, argv[0], ((const self_t *)self)->index, VTypedescSizeof(&info->prod->desc));
-}
-
-static
-void CC vfunc_free ( void * self )
-{
-    free ( self );
-}
-
-VTRANSFACT_BUILTIN_IMPL(vdb_split, 1, 0, 0) (const void *self, const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->self = malloc(sizeof(self_t));
-    if (rslt->self) {
-        ((self_t *)rslt->self)->index = cp->argv[0].data.u32[0];
-        rslt->whack = vfunc_free;
-        rslt->variant = vftBlobN;
-        VFUNCDESC_INTERNAL_FUNCS(rslt)->bfN = split_impl;
-        return 0;
-    }
-    return RC(rcVDB, rcFunction, rcConstructing, rcMemory, rcExhausted);
-}
diff --git a/libs/vdb/table-cmn.c b/libs/vdb/table-cmn.c
deleted file mode 100644
index af5a849..0000000
--- a/libs/vdb/table-cmn.c
+++ /dev/null
@@ -1,1247 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#define TRACK_REFERENCES 0
-
-#define KONST const
-#include "table-priv.h"
-#include "cursor-priv.h"
-#include "database-priv.h"
-#include "dbmgr-priv.h"
-#undef KONST
-
-#include "schema-priv.h"
-#include "schema-dump.h"
-#include "linker-priv.h"
-
-#include <vdb/vdb-priv.h>
-#include <vdb/cursor.h>
-#include <kdb/manager.h>
-#include <kdb/database.h>
-#include <kdb/table.h>
-#include <kdb/index.h>
-#include <kdb/column.h>
-#include <kdb/meta.h>
-#include <kdb/namelist.h>
-#include <kdb/kdb-priv.h>
-#include <klib/symbol.h>
-#include <klib/text.h>
-#include <klib/printf.h>
-#include <klib/log.h>
-#include <klib/debug.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * VTable
- *  a collection of columns indexed by row id, metadata, indices
- */
-
-/* Whack
- */
-rc_t VTableWhack ( VTable *self )
-{
-    KRefcountWhack ( & self -> refcount, "VTable" );
-
-    BSTreeWhack ( & self -> read_col_cache, VColumnRefWhack, NULL );
-    BSTreeWhack ( & self -> write_col_cache, VColumnRefWhack, NULL );
-
-    KMDataNodeRelease ( self -> col_node );
-    KMetadataRelease ( self -> meta );
-    KTableRelease ( self -> ktbl );
-    VSchemaRelease ( self -> schema );
-    VLinkerRelease ( self -> linker );
-    VDatabaseSever ( self -> db );
-    VDBManagerSever ( self -> mgr );
-
-    free ( self );
-    return 0;
-}
-
-
-/* AddRef
- */
-LIB_EXPORT rc_t CC VTableAddRef ( const VTable *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "VTable" ) )
-        {
-        case krefLimit:
-            return RC ( rcVDB, rcTable, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC VTableRelease ( const VTable *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "VTable" ) )
-        {
-        case krefWhack:
-            return VTableWhack ( ( VTable* ) self );
-        case krefNegative:
-            return RC ( rcVDB, rcTable, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-/* Attach
- * Sever
- *  internal
- */
-VTable *VTableAttach ( const VTable *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAddDep ( & self -> refcount, "VTable" ) )
-        {
-        case krefLimit:
-            return NULL;
-        }
-    }
-    return ( VTable* ) self;
-}
-
-rc_t VTableSever ( const VTable *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDropDep ( & self -> refcount, "VTable" ) )
-        {
-        case krefWhack:
-            return VTableWhack ( ( VTable* ) self );
-        case krefNegative:
-            return RC ( rcVDB, rcTable, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-
-/* Make - PRIVATE
- */
-rc_t VTableMake ( VTable **tblp,
-    const VDBManager *mgr, const VDatabase *db, const VSchema *schema )
-{
-    rc_t rc;
-
-    /* create a structure */
-    VTable *tbl = calloc ( sizeof * tbl, 1 );
-    if ( tbl == NULL )
-        rc = RC ( rcVDB, rcTable, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        /* since the object has been zeroed, Whack will work properly */
-        rc = VSchemaMake ( ( VSchema** ) & tbl -> schema, schema );
-        if ( rc == 0 )
-        {
-            tbl -> mgr = VDBManagerAttach ( mgr );
-            tbl -> db = VDatabaseAttach ( db );
-
-            BSTreeInit ( & tbl -> read_col_cache );
-            BSTreeInit ( & tbl -> write_col_cache );
-
-            KRefcountInit ( & tbl -> refcount, 1, "VTable", "make", "vtbl" );
-
-            tbl -> cmode = ( uint8_t ) kcmOpen;
-            tbl -> checksum = ( uint8_t ) kcsNone;
-
-            rc = VLinkerMake ( & tbl -> linker, mgr -> linker, mgr -> linker -> dl );
-            if ( rc == 0 )
-            {
-                * tblp = tbl;
-                return 0;
-            }
-        }
-
-        VTableWhack ( tbl );
-    }
-
-    * tblp = NULL;
-
-    return rc;
-}
-
-
-/* OpenRead
- *  finish initialization on open for read
- */
-static
-rc_t VTableOpenRead ( VTable *self )
-{
-    /* open metadata */
-    rc_t rc = KTableOpenMetadataRead ( self -> ktbl, & self -> meta );
-    if ( rc == 0 )
-    {
-        /* open "col" node, if present */
-        rc = KMetadataOpenNodeRead ( self -> meta, & self -> col_node, "col" );
-        if ( rc == 0 || GetRCState ( rc ) == rcNotFound )
-        {
-            /* fetch stored schema */
-            rc = VTableLoadSchema ( self );
-            if ( rc == 0 && self -> stbl == NULL )
-                rc = RC ( rcVDB, rcTable, rcOpening, rcSchema, rcNotFound );
-        }
-    }
-
-    DBGMSG(DBG_VDB, DBG_FLAG(DBG_VDB_VDB), ("VTableOpenRead = %d\n", rc));
-
-    return rc;
-}
-
-
-/* OpenTableRead
- * VOpenTableRead
- *  open a table for read
- *
- *  "tbl" [ OUT ] - return parameter for newly opened table
- *
- *  "path" [ IN ] - NUL terminated string in
- *  wd-native character set giving path to table
- */
-LIB_EXPORT rc_t CC VDBManagerVOpenTableRead ( const VDBManager *self,
-    const VTable **tblp, const VSchema *schema,
-    const char *path, va_list args )
-{
-    rc_t rc;
-
-    if ( tblp == NULL )
-        rc = RC ( rcVDB, rcMgr, rcOpening, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcMgr, rcOpening, rcSelf, rcNull );
-        else
-        {
-            VTable *tbl;
-
-            /* if no schema is given, always pass intrinsic */
-            if ( schema == NULL )
-                schema = self -> schema;
-
-            rc = VTableMake ( & tbl, self, NULL, schema );
-            if ( rc == 0 )
-            {
-                tbl -> read_only = true;
-                rc = KDBManagerVOpenTableRead ( self -> kmgr, & tbl -> ktbl, path, args );
-                if ( rc == 0 )
-                {
-                    rc = VTableOpenRead ( tbl );
-                    if ( rc == 0 )
-                    {
-#if LAZY_OPEN_COL_NODE
-                        KMDataNodeRelease ( tbl -> col_node );
-                        tbl -> col_node = NULL;
-#endif
-                        * tblp = tbl;
-                        return 0;
-                    }
-                }
-                VTableWhack ( tbl );
-            }
-        }
-
-        * tblp = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VDBManagerOpenTableRead ( const VDBManager *self, const VTable **tbl,
-    const VSchema *schema, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = VDBManagerVOpenTableRead ( self, tbl, schema, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VDatabaseVOpenTableRead ( const VDatabase *self,
-    const VTable **tblp, const char *path, va_list args )
-{
-    rc_t rc;
-
-    if ( tblp == NULL )
-        rc = RC ( rcVDB, rcDatabase, rcOpening, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcDatabase, rcOpening, rcSelf, rcNull );
-        else
-        {
-            VTable *tbl;
-            rc = VTableMake ( & tbl, self -> mgr, self, self -> schema );
-            if ( rc == 0 )
-            {
-                tbl -> read_only = true;
-
-                rc = KDatabaseVOpenTableRead ( self -> kdb, & tbl -> ktbl, path, args );
-                if ( rc == 0 )
-                {
-                    rc = VTableOpenRead ( tbl );
-                    if ( rc == 0 )
-                    {
-                        * tblp = tbl;
-                        return 0;
-                    }
-                }
-
-                VTableWhack ( tbl );
-            }
-        }
-
-        * tblp = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VDatabaseOpenTableRead ( const VDatabase *self,
-    const VTable **tbl, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = VDatabaseVOpenTableRead ( self, tbl, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* Locked
- *  returns true if locked
- */
-LIB_EXPORT bool CC VTableLocked ( const VTable *self )
-{
-    if ( self != NULL )
-        return KTableLocked ( self -> ktbl );
-    return false;
-}
-
-
-/* Writable
- *  returns 0 if object is writable
- *  or a reason why if not
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptIndex and kptColumn
- *
- *  "path" [ IN ] - NUL terminated path
- */
-LIB_EXPORT rc_t CC VTableVWritable ( const VTable *self, uint32_t type, const char * name, va_list args )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcTable, rcAccessing, rcSelf, rcNull );
-    else
-        rc = KTableVWritable ( self -> ktbl, type, name, args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VTableWritable ( const VTable *self, uint32_t type, const char * name, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, name );
-
-    rc = VTableVWritable ( self, type, name, args );
-
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* OpenMetadataRead
- *  opens metadata file
- *
- *  "meta" [ OUT ] - return parameter for metadata
- */
-LIB_EXPORT rc_t CC VTableOpenMetadataRead ( const VTable *self, struct KMetadata const **meta )
-{
-    rc_t rc;
-
-    if ( meta == NULL )
-        rc = RC ( rcVDB, rcTable, rcOpening, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcTable, rcOpening, rcSelf, rcNull );
-        else
-        {
-            * meta = self -> meta;
-            return KMetadataAddRef ( self -> meta );
-        }
-
-        * meta = NULL;
-    }
-
-    return rc;
-}
-
-
-/* OpenIndexRead
- * VOpenIndexRead
- *  open an index for read
- *
- *  "idx" [ OUT ] - return parameter for newly opened index
- *
- *  "name" [ IN ] - NUL terminated string in UTF-8 giving simple name of idx
- */
-LIB_EXPORT rc_t CC VTableVOpenIndexRead ( const VTable *self,
-    struct KIndex const **idx, const char *name, va_list args )
-{
-    rc_t rc;
-    KIdxType type;
-    uint32_t version;
-    const KMDataNode *node;
-
-    if ( self == NULL )
-    {
-        if ( idx == NULL )
-            return RC ( rcVDB, rcTable, rcOpening, rcParam, rcNull );
-        * idx = NULL;
-        return RC ( rcVDB, rcTable, rcOpening, rcSelf, rcNull );
-    }
-
-    /* open the requested index */
-    rc = KTableVOpenIndexRead ( self -> ktbl, idx, name, args );
-    if ( rc != 0 )
-        return rc;
-
-    /* get version and type */
-    rc = KIndexVersion ( * idx, & version );
-    if ( rc == 0 )
-        rc = KIndexType ( * idx, & type );
-    if ( rc != 0 )
-        return 0;
-
-    /* look for versions 2 or 3, type kitText or kitText with projection */
-    switch ( version )
-    {
-    case 2:
-    case 3:
-        switch ( type )
-        {
-        case kitText:
-        case kitText | kitProj:
-            break;
-        default:
-            return 0;
-        }
-        break;
-    default:
-        return 0;
-    }
-
-    /* look for a node in metadata for repairing maximum id */
-    rc = KMetadataOpenNodeRead ( self -> meta, & node, "/.seq/spot" );
-    if ( rc == 0 )
-    {
-        int64_t maxid;
-        rc = KMDataNodeReadAsI64 ( node, & maxid );
-        if ( rc == 0 )
-            KIndexSetMaxRowId ( * idx, maxid );
-        KMDataNodeRelease ( node );
-    }
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC VTableOpenIndexRead ( const VTable *self,
-    struct KIndex const **idx, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = VTableVOpenIndexRead ( self, idx, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* ListColumns
- *  list readable column names
- *
- *  "names" [ OUT ] - return parameter for namelist
- *
- *  availability: v2.1
- */
-static
-rc_t list_readable_columns ( const VTable *cself )
-{
-    VTable *self = ( VTable* ) cself;
-
-    VCursor *curs;
-    rc_t rc = VTableCreateCursorReadInternal ( self, ( const VCursor** ) & curs );
-    if (  rc == 0 )
-    {
-        /* let this private VCursor-function list the columns */
-        rc = VCursorListReadableColumns ( curs, & self -> read_col_cache );
-        VCursorRelease ( curs );
-        if ( rc == 0 )
-            self -> read_col_cache_valid = true;
-    }
-
-    return rc;
-}
-
-rc_t make_column_namelist ( const BSTree *columns, KNamelist **names )
-{
-    VNamelist *list;
-    rc_t rc = VNamelistMake ( & list, 8 );
-    if ( rc == 0 )
-    {
-        const String *last = NULL;
-        const VColumnRef *cref = ( const VColumnRef* )
-            BSTreeFirst ( columns );
-        while ( cref != NULL )
-        {
-            if ( last == NULL || ! StringEqual ( last, & cref -> name ) )
-            {
-                rc = VNamelistAppend ( list, cref -> name . addr );
-                if ( rc != 0 )
-                    break;
-
-                last = & cref -> name;
-            }
-
-            cref = ( const VColumnRef* )
-                BSTNodeNext ( & cref -> n );
-        }
-
-        if ( rc == 0 )
-            rc = VNamelistToNamelist ( list, names );
-
-        VNamelistRelease ( list );
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VTableListReadableColumns ( const VTable *self, KNamelist **names )
-{
-    rc_t rc;
-
-    if ( names == NULL )
-        rc = RC ( rcVDB, rcTable, rcListing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcTable, rcListing, rcSelf, rcNull );
-        else
-        {
-            if ( ! self -> read_col_cache_valid )
-                rc = list_readable_columns ( self );
-
-            if ( self -> read_col_cache_valid )
-                return make_column_namelist ( & self -> read_col_cache, names );
-        }
-
-        * names = NULL;
-    }
-    return rc;
-}
-
-/* v2.0 interface
- */
-LIB_EXPORT rc_t CC VTableListCol ( const VTable *cself, KNamelist **names )
-{
-    return VTableListReadableColumns ( cself, names );
-}
-
-
-
-/* ListPhysColumns
- *  avail: 2.4
- */
-LIB_EXPORT rc_t CC VTableListPhysColumns ( const VTable *self, KNamelist **names )
-{
-    rc_t rc;
-
-    if ( names == NULL )
-        rc = RC ( rcVDB, rcTable, rcListing, rcParam, rcNull );
-    else
-    {
-        * names = NULL;
-
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcTable, rcListing, rcSelf, rcNull );
-        else
-        {
-            KNamelist *kcol_names;
-            rc = KTableListCol ( self -> ktbl, & kcol_names );
-            if ( rc == 0 )
-            {
-                uint32_t kcol_count;
-                rc = KNamelistCount ( kcol_names, & kcol_count );
-                if ( rc == 0 )
-                {
-                    uint32_t scol_count = 0;
-                    KNamelist *scol_names = NULL;
-                    const KMDataNode *col_node = self -> col_node;
-
-#if LAZY_OPEN_COL_NODE
-                    if ( col_node == NULL )
-                    {
-                        rc = KMetadataOpenNodeRead ( self -> meta, & ( ( VTable* ) self ) -> col_node, "col" );
-                        if ( rc == 0 || GetRCState ( rc ) != rcNotFound )
-                            col_node = self -> col_node;
-                    }
-#endif
-                    if ( col_node != NULL )
-                    {
-                        rc = KMDataNodeListChildren ( col_node, & scol_names );
-                        if ( rc == 0 )
-                            rc = KNamelistCount ( scol_names, & scol_count );
-                    }
-
-                    if ( rc == 0 )
-                    {
-                        VNamelist *vnames;
-                        rc = VNamelistMake ( & vnames, kcol_count + scol_count );
-                        if ( rc == 0 )
-                        {
-                            uint32_t i;
-                            const char *name;
-
-                            for ( i = 0; i < kcol_count && rc == 0; ++ i )
-                            {
-                                rc = KNamelistGet ( kcol_names, i, & name );
-                                if ( rc == 0 )
-                                    rc = VNamelistAppend ( vnames, name );
-                            }
-
-                            for ( i = 0; i < scol_count && rc == 0; ++ i )
-                            {
-                                rc = KNamelistGet ( scol_names, i, & name );
-                                if ( rc == 0 )
-                                    rc = VNamelistAppend ( vnames, name );
-                            }
-
-                            if ( rc == 0 )
-                            {
-                                rc = VNamelistToNamelist ( vnames, names );
-                                if ( rc == 0 )
-                                    VNamelistReorder ( vnames, false );
-                            }
-                        }
-
-                        VNamelistRelease ( vnames );
-                    }
-
-                    KNamelistRelease ( scol_names );
-                }
-
-                KNamelistRelease ( kcol_names );
-            }
-        }
-    }
-
-    return rc;
-}
-
-
-/* ListDatatypes
- *  returns list of typedecls for named column
- *
- *  "col" [ IN ] - column name
- *
- *  "dflt_idx" [ OUT, NULL OKAY ] - returns the zero-based index
- *  into "typedecls" of the default datatype for the named column
- *
- *  "typedecls" [ OUT ] - list of datatypes available for named column
- *
- *  availability: v2.1
- */
-
-rc_t make_column_typelist ( const BSTree *columns,
-    const char *col, uint32_t *dflt_idx, KNamelist **typedecls )
-{
-    VNamelist *list;
-    rc_t rc = VNamelistMake ( & list, 8 );
-    if ( rc == 0 )
-    {
-        uint32_t idx;
-        const VColumnRef *first;
-
-        String col_name;
-        StringInitCString ( & col_name, col );
-
-        first = ( const VColumnRef* )
-            BSTreeFind ( columns, & col_name, VColumnRefCmpString );
-        if ( first != NULL )
-        {
-            const VColumnRef *cref = ( const VColumnRef* ) BSTNodePrev ( & first -> n );
-            while ( cref != NULL && StringEqual ( & first -> name, & cref -> name ) )
-            {
-                first = cref;
-                cref = ( const VColumnRef* ) BSTNodePrev ( & cref -> n );
-            }
-
-            for ( cref = first, idx = 0; ; ++ idx )
-            {
-                rc = VNamelistAppend ( list, cref -> typedecl );
-                if ( rc != 0 )
-                    break;
-
-                if ( cref -> dflt )
-                    * dflt_idx = idx;
-
-                cref = ( const VColumnRef* ) BSTNodeNext ( & cref -> n );
-                if ( cref == NULL || ! StringEqual ( & first -> name, & cref -> name ) )
-                    break;
-            }
-        }
-
-        if ( rc == 0 )
-            rc = VNamelistToNamelist ( list, typedecls );
-
-        VNamelistRelease ( list );
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VTableListReadableDatatypes ( const VTable *self,
-    const char *col, uint32_t *dflt_idx, KNamelist **typedecls )
-{
-    rc_t rc;
-
-    uint32_t dummy;
-    if ( dflt_idx == NULL )
-        dflt_idx = & dummy;
-
-    * dflt_idx = 0;
-
-    if ( typedecls == NULL )
-        rc = RC ( rcVDB, rcTable, rcListing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcTable, rcListing, rcSelf, rcNull );
-        else if ( col == NULL )
-            rc = RC ( rcVDB, rcTable, rcListing, rcName, rcNull );
-        else if ( col [ 0 ] == 0 )
-            rc = RC ( rcVDB, rcTable, rcListing, rcName, rcEmpty );
-        else
-        {
-            if ( ! self -> read_col_cache_valid )
-                rc = list_readable_columns ( self );
-
-            if ( self -> read_col_cache_valid )
-                return make_column_typelist ( & self -> read_col_cache, col, dflt_idx, typedecls );
-        }
-
-        * typedecls = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VTableColumnDatatypes( const VTable *cself, const char *col,
-    uint32_t *dflt_idx, KNamelist **typedecls )
-{
-    return VTableListReadableDatatypes ( cself, col, dflt_idx, typedecls );
-}
-
-
-/* OpenManager
- *  duplicate reference to manager
- *  NB - returned reference must be released
- */
-LIB_EXPORT rc_t CC VTableOpenManagerRead ( const VTable *self, const VDBManager **mgr )
-{
-    rc_t rc;
-
-    if ( mgr == NULL )
-        rc = RC ( rcVDB, rcTable, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcTable, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = VDBManagerAddRef ( self -> mgr );
-            if ( rc == 0 )
-            {
-                * mgr = self -> mgr;
-                return 0;
-            }
-        }
-
-        * mgr = NULL;
-    }
-
-    return rc;
-}
-
-
-/* OpenParent
- *  duplicate reference to parent database
- *  NB - returned reference must be released
- */
-LIB_EXPORT rc_t CC VTableOpenParentRead ( const VTable *self, const VDatabase **db )
-{
-    rc_t rc;
-
-    if ( db == NULL )
-        rc = RC ( rcVDB, rcTable, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcTable, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = VDatabaseAddRef ( self -> db );
-            if ( rc == 0 )
-            {
-                * db = self -> db;
-                return 0;
-            }
-        }
-
-        * db = NULL;
-    }
-
-    return rc;
-}
-
-
-/* OpenSchema
- *  duplicate reference to table schema
- *  NB - returned reference must be released
- */
-LIB_EXPORT rc_t CC VTableOpenSchema ( const VTable *self, const VSchema **schema )
-{
-    rc_t rc;
-
-    if ( schema == NULL )
-        rc = RC ( rcVDB, rcTable, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcTable, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = VSchemaAddRef ( self -> schema );
-            if ( rc == 0 )
-            {
-                * schema = self -> schema;
-                return 0;
-            }
-        }
-
-        * schema = NULL;
-    }
-
-    return rc;
-}
-
-
-/* GetUserData
- * SetUserData
- *  store/retrieve an opaque pointer to user data
- */
-LIB_EXPORT rc_t CC VTableGetUserData ( const VTable *self, void **data )
-{
-    rc_t rc;
-
-    if ( data == NULL )
-        rc = RC ( rcVDB, rcTable, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcTable, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            * data = self -> user;
-            return 0;
-        }
-
-        * data = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VTableSetUserData ( const VTable *cself,
-    void *data, void ( CC * destroy ) ( void *data ) )
-{
-    VTable *self = ( VTable* ) cself;
-    if ( cself == NULL )
-        return RC ( rcVDB, rcTable, rcUpdating, rcSelf, rcNull );
-
-    self -> user = data;
-    self -> user_whack = destroy;
-
-    return 0;
-}
-
-
-/* GetKTable
- *  returns a new reference to underlying KTable
- */
-LIB_EXPORT rc_t CC VTableGetKTableRead ( const VTable *self, const KTable **ktbl )
-{
-    rc_t rc;
-
-    if ( ktbl == NULL )
-        rc = RC ( rcVDB, rcTable, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcTable, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            * ktbl = self -> ktbl;
-            return KTableAddRef ( * ktbl );
-        }
-
-        * ktbl = NULL;
-    }
-
-    return rc;
-}
-
-
-
-/* Typespec
- *  retrieve table typespec
- *
- *  AVAILABILITY: version 2.1
- *
- *  "ts_buff" [ IN ] and "ts_size" [ IN ] - buffer for return of NUL-terminated
- *  table typespec, e.g. 'NCBI:tbl:abc#1.1'
- */
-#define USE_SDUMPER 0
-
-#if USE_SDUMPER
-typedef struct flush_tblspec_pb flush_tblspec_pb;
-struct flush_tblspec_pb
-{
-    char *buff;
-    size_t size;
-    size_t bytes;
-};
-
-static
-rc_t CC flush_tbl_typespec ( void *data, const void *buffer, size_t size )
-{
-    flush_tblspec_pb *pb = data;
-    if ( pb -> bytes + size >= pb -> size )
-        return RC ( rcVDB, rcTable, rcAccessing, rcBuffer, rcInsufficient );
-    memcpy ( & pb -> buff [ pb -> bytes ], buffer, size );
-    pb -> bytes += size;
-    pb -> buff [ pb -> bytes ] = 0;
-    return 0;
-}
-#endif
-
-LIB_EXPORT rc_t CC VTableTypespec ( const VTable *self, char *ts_buff, size_t ts_size )
-{
-    rc_t rc = 0;
-
-    if ( ts_size == 0 )
-        rc = RC ( rcVDB, rcTable, rcAccessing, rcBuffer, rcInsufficient );
-    else if ( ts_buff == NULL )
-        rc = RC ( rcVDB, rcTable, rcAccessing, rcBuffer, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcTable, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc_t rc2;
-#if USE_SDUMPER
-            SDumper dumper;
-            flush_tblspec_pb pb;
-
-            /* initialize pb */
-            pb . buff = ts_buff;
-            pb . size = ts_size;
-            pb . bytes = 0;
-
-            /* initialize dumper for extracting name */
-            SDumperInit ( & dumper, self -> schema, sdmCompact, flush_tbl_typespec, & pb );
-
-            /* dump only the table name */
-            assert ( self -> stbl != NULL );
-            rc = SDumperPrint ( & dumper, "%N%V", self -> stbl -> name, self -> stbl -> version );
-
-            /* done */
-            rc2 = SDumperWhack ( & dumper );
-            if ( rc == 0 )
-            {
-                if ( rc2 == 0 )
-                    return 0;
-
-                rc = rc2;
-            }
-#else
-            rc2 = string_printf ( ts_buff, ts_size, NULL, "%N#%V", self -> stbl -> name, self -> stbl -> version );
-            if ( rc2 == 0 )
-                return 0;
-#endif
-        }
-
-        ts_buff [ 0 ] = 0;
-    }
-
-    return rc;
-}
-
-
-/* HasStaticColumn - PRIVATE
- *  given a physical column name, report whether it exists
- *  and is ( currently ) static
- *  avail: 2.5
- */
-LIB_EXPORT bool CC VTableHasStaticColumn ( const VTable *self, const char *name )
-{
-    if ( self != NULL && name != NULL && name [ 0 ] != 0 )
-    {
-        /* a full check of this might include testing that the column
-           can be opened for read or write, but the API is purposely
-           vague on what this means.
-
-           currently the meaning of this ( PRIVATE ) API is whether
-           there is a metadata column entry with this name - period. */
-        const KMDataNode *node;
-        rc_t rc = KMetadataOpenNodeRead ( self -> meta, & node, "/col/%s", name );
-        if ( rc == 0 )
-        {
-            KMDataNodeRelease ( node );
-            return true;
-        }
-    }
-
-    return false;
-}
-
-
-/*--------------------------------------------------------------------------
- * VColumnRef
- *  cache entry
- */
-
-/* Whack
- */
-void CC VColumnRefWhack ( BSTNode *n, void *ignore )
-{
-    free ( n );
-}
-
-
-/* Make
- *  make a column ref from an SColumn*
- */
-rc_t VColumnRefMake ( VColumnRef **rp, const VSchema *schema, const SColumn *scol )
-{
-    char text [ 256 ];
-    rc_t rc = VTypedeclToText ( & scol -> td, schema, text, sizeof text );
-    if ( rc == 0 )
-    {
-        size_t tdsize = strlen ( text );
-        const String *name = & scol -> name -> name;
-        VColumnRef *cref = malloc ( sizeof * cref + name -> size + tdsize );
-        if ( cref == NULL )
-            rc = RC ( rcVDB, rcTable, rcListing, rcMemory, rcExhausted );
-        else
-        {
-            strcpy ( cref -> typedecl, text );
-            string_copy ( & cref -> typedecl [ tdsize + 1 ], name -> size + 1, name -> addr, name -> size );
-            StringInit ( & cref -> name, & cref -> typedecl [ tdsize + 1 ], name -> size, name -> len );
-            cref -> td = scol -> td;
-            cref -> cid = scol -> cid;
-            cref -> dflt = scol -> dflt;
-
-            * rp = cref;
-        }
-    }
-
-    return rc;
-}
-
-
-/* CmpString
- *  compares by name only
- *  "item" is a const String*
- */
-int CC VColumnRefCmpString ( const void *item, const BSTNode *n )
-{
-    const VColumnRef *cref = ( const VColumnRef* ) n;
-    return StringCompare ( item, & cref -> name );
-}
-
-/* Sort
- *  compares by ( name, type ) pair
- */
-int CC VColumnRefSort ( const BSTNode *item, const BSTNode *n )
-{
-    const VColumnRef *a = ( const VColumnRef* ) item;
-    const VColumnRef *b = ( const VColumnRef* ) n;
-
-    /* sorted first by name - case sensitive ASCII alphabetically */
-    int diff = StringCompare ( & a -> name, & b -> name );
-    if ( diff != 0 )
-        return diff;
-
-    /* sort by cid */
-    return VCtxIdCmp ( & a -> cid, & b -> cid );
-}
-
-#if 0 /* more for later */
-static
-rc_t create_cursor_all_readable_columns(const VTable *self,
-                                        unsigned *ncol, uint32_t **idx,
-                                        const VCursor **curs)
-{
-    KNamelist *list;
-    rc_t rc = VTableListReadableColumns(self, &list);
-    
-    if (rc == 0) {
-        rc = VTableCreateCursorReadInternal(self, curs);
-        if (rc == 0) {
-            uint32_t n;
-            
-            rc = KNamelistCount(list, ncol);
-            if (rc == 0) {
-                n = *ncol;
-                *idx = malloc(n * sizeof(**idx));
-                if (idx) {
-                    unsigned i;
-                    
-                    for (i = 0; i != (unsigned)n; ++i) {
-                        const char *name;
-                        
-                        rc = KNamelistGet(list, i, &name);
-                        if (rc)
-                            break;
-                        rc = VCursorAddColumn(*curs, &(*idx)[i], name);
-                        if (rc)
-                            break;
-                    }
-                    if (rc)
-                        free(*idx);
-                }
-                else
-                    rc = RC(rcVDB, rcTable, rcValidating, rcMemory, rcExhausted);
-            }
-            if (rc)
-                VCursorRelease(*curs);
-        }
-        KNamelistRelease(list);
-    }
-    if (rc) {
-        *idx = NULL;
-        *curs = NULL;
-        *ncol = 0;
-    }
-    return rc;
-}
-
-static
-rc_t fetch_all_rows(const VCursor *curs, unsigned ncol, const uint32_t cid[/* ncol */])
-{
-    int64_t start;
-    int64_t stop;
-    int64_t row;
-    unsigned i;
-    rc_t rc;
-    
-    for (i = 0; i != ncol; ++i) {
-        int64_t cstart;
-        uint64_t ccount;
-        
-        rc = VCursorIdRange(curs, cid[i], &cstart, &ccount);
-        if (rc)
-            return rc;
-        if (i == 0) {
-            start = cstart;
-            stop = cstart + ccount;
-        }
-        else {
-            if (start > cstart)
-                start = cstart;
-            if (stop < cstart + ccount)
-                stop = cstart + ccount;
-        }
-    }
-    for (row = start; row != stop; ++row) {
-        for (i = 0; i != ncol; ++i) {
-            uint32_t elem_bits;
-            const void *base;
-            uint32_t offset;
-            uint32_t length;
-            
-            rc = VCursorCellDataDirect(curs, row, cid[i], &elem_bits,
-                                       &base, &offset, &length);
-            if (rc)
-                return rc;
-        }
-    }
-    return 0;
-}
-
-VDB_EXTERN
-rc_t CC VTableConsistencyCheck(const VTable *self, int level)
-{
-    uint32_t *cid;
-    unsigned ncol;
-    const VCursor *curs;
-    rc_t rc = create_cursor_all_readable_columns(self, &ncol, &cid, &curs);
-    
-    if (rc)
-        return rc;
-    rc = fetch_all_rows(curs, ncol, cid);
-    free(cid);
-    VCursorRelease(curs);
-    return rc;
-}
-#endif
diff --git a/libs/vdb/table-load.c b/libs/vdb/table-load.c
deleted file mode 100644
index 3c3638c..0000000
--- a/libs/vdb/table-load.c
+++ /dev/null
@@ -1,323 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#define KONST const
-#define SKONST
-
-#include "dbmgr-priv.h"
-#include "table-priv.h"
-#include "schema-priv.h"
-#include "schema-parse.h"
-#include "linker-priv.h"
-
-#undef KONST
-#undef SKONST
-
-#include <vdb/table.h>
-#include <vdb/vdb-priv.h>
-#include <kdb/meta.h>
-#include <kdb/namelist.h>
-#include <kfs/dyload.h>
-#include <klib/namelist.h>
-#include <klib/token.h>
-#include <klib/rc.h>
-#include <os-native.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-
-/* LoadSchema
- *  looks in metadata for stored schema
- *  or searches available definitions for match
- */
-typedef struct VTableFindData VTableFindData;
-struct VTableFindData
-{
-    VLinker *linker;
-    struct KDlset *libs;
-    const VTable *vtbl;
-    const STable *stbl;
-};
-
-static
-bool CC VTableTestUntyped ( void *item, void *data )
-{
-    VTableFindData *pb = data;
-    const STable *stbl = ( const void* ) item;
-
-    if ( stbl -> untyped != NULL )
-    {
-        /* get the function pointer */
-        VUntypedTableTest test = NULL;
-        rc_t rc = VLinkerFindUntyped ( pb -> linker, pb -> libs,
-            & test, stbl -> untyped );
-        if ( rc == 0 )
-        {
-            /* ask if it recognizes the table */
-            if ( ( * test ) ( pb -> vtbl -> ktbl, pb -> vtbl -> meta ) )
-            {
-                pb -> stbl = stbl;
-                return true;
-            }
-        }
-    }
-     
-    return false;
-}
-
-static
-bool VSchemaFindUntyped ( const VSchema *self, VTableFindData *pb )
-{
-    if ( self -> dad )
-    {
-        if ( VSchemaFindUntyped ( self -> dad, pb ) )
-            return true;
-    }
-    
-    return VectorDoUntil ( & self -> tbl, false, VTableTestUntyped, pb );
-}
-
-static
-rc_t VTableFindType ( VTable *self )
-{
-    rc_t rc;
-    VTableFindData pb;
-    
-    pb . linker = self -> linker;
-    
-    rc = VLinkerOpen ( pb . linker, & pb . libs );
-    if ( rc == 0 )
-    {
-        pb . vtbl = self;
-        pb . stbl = NULL;
-        
-        /* search schema */
-        VSchemaFindUntyped ( self -> schema, & pb );
-        
-        /* record stbl */
-        self -> stbl = pb . stbl;
-        KDlsetRelease ( pb . libs );
-    }
-    return rc;
-}
-
-static
-rc_t VTableLoadSchemaNode ( VTable *self, const KMDataNode *node )
-{
-    rc_t rc;
-    
-    /* the node is probably within our 4K buffer,
-     but by using the callback mechanism we don't
-     have buffer or allocation issues. */
-    KMDataNodeSchemaFillData pb;
-    pb . node = node;
-    pb . pos = 0;
-    pb . add_v0 = false;
-    
-    /* add in schema text. it is not mandatory, but it is
-     the design of the system to store object schema with
-     the object so that it is capable of standing alone */
-    rc = VSchemaParseTextCallback ( self -> schema,
-        "VTableLoadSchema", KMDataNodeFillSchema, & pb );
-    if ( rc == 0 )
-    {
-        /* determine table type */
-        rc = KMDataNodeReadAttr ( node, "name",
-            pb . buff, sizeof pb . buff, & pb . pos );
-        if ( rc == 0 )
-        {
-            uint32_t type;
-            const SNameOverload *name;
-            
-            /* find the stbl if possible */
-            self -> stbl = VSchemaFind ( self -> schema,
-                & name, & type, pb . buff, "VTableLoadSchema", false );
-            
-            /* the schema must be found in this case */
-            if ( self -> stbl == NULL || type != eTable )
-            {
-                self -> stbl = NULL;
-                rc = RC ( rcVDB, rcTable, rcLoading, rcSchema, rcCorrupt );
-                PLOGERR ( klogInt, ( klogInt, rc, "failed to establish table type from '$(expr)'",
-                                     "expr=%s", pb . buff ));
-            }
-        }
-    }
-    return rc;
-}
-
-rc_t VTableLoadSchema ( VTable *self )
-{
-    /* try to get schema text */
-    const KMDataNode *node;
-    rc_t rc = KMetadataOpenNodeRead ( self -> meta, & node, "schema" );
-    if ( rc == 0 )
-    {
-        rc = VTableLoadSchemaNode ( self, node );
-        KMDataNodeRelease ( node );
-    }
-    else if ( GetRCState ( rc ) == rcNotFound )
-    {
-        /* this is an older version. search schema
-         for a table having an untyped function */
-        rc = VTableFindType ( self );
-    }
-
-    return rc;
-}
-
-/* ExtendSchema
- *  discover all existing physical and static columns
- *  that are not represented in the table schema
- *  and add them in ( if possible )
- */
-static
-rc_t VTablePopulateStrayKColumn ( const VTable *self, const char *name )
-{
-    /* TBD - not returning error because the result of doing
-       nothing is simply to leave these columns inaccessible  */
-
-    /* open KColumn */
-    /* open KMetadata */
-    /* process v1 */
-    /* process v2 */
-    /* need to discover a datatype and schema information */
-    return 0;
-}
-
-static
-rc_t VTablePopulateStrayStatic ( const VTable *self,
-    const char *name, const KMDataNode *node )
-{
-    /* TBD - not returning error because the result of doing
-       nothing is simply to leave these columns inaccessible  */
-
-    /* need to discover a datatype */
-    return 0;
-}
-
-static
-bool VTableNameAvail ( const KSymTable *tbl, const char *name )
-{
-    String str;
-
-    /* build a physical name from simple name */
-    char pname [ 256 ];
-    int len = snprintf ( pname, sizeof pname, ".%s", name );
-    if ( len < 0 || len >= sizeof pname )
-        return false;
-
-    /* test for defined physical name */
-    StringInit ( & str, pname, len, len );
-    if ( KSymTableFind ( tbl, & str ) != NULL )
-        return false;
-
-    /* test for defined simple name */
-    StringSubstr ( & str, & str, 1, 0 );
-    if ( KSymTableFind ( tbl, & str ) != NULL )
-        return false;
-
-    /* name is available */
-    return true;
-}
-
-LIB_EXPORT rc_t CC VTableExtendSchema ( const VTable *self )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcTable, rcUpdating, rcSelf, rcNull );
-    else
-    {
-        /* create symbol table for STable */
-        KSymTable tbl;
-        rc = init_tbl_symtab ( & tbl, self -> schema, self -> stbl );
-        if ( rc == 0 )
-        {
-            KNamelist *names;
-            const char *name;
-            uint32_t i, count;
-
-            /* list all physical tables from KTable */
-            rc = KTableListCol ( self -> ktbl, & names );
-            if ( rc != 0 )
-                rc = 0;
-            else
-            {
-                rc = KNamelistCount ( names, & count );
-                for ( i = 0; rc == 0 && i < count; ++ i )
-                {
-                    /* if there are any stray columns, add them in */
-                    rc = KNamelistGet ( names, i, & name );
-                    if ( rc == 0 && VTableNameAvail ( & tbl, name ) )
-                        rc = VTablePopulateStrayKColumn ( self, name );
-                }
-
-                KNamelistRelease ( names );
-            }
-
-            if ( rc == 0 )
-            {
-                /* access table's static columns */
-                const KMDataNode *cols = self -> col_node;
-                if ( cols != NULL )
-                {
-                    /* list all columns */
-                    rc = KMDataNodeListChild ( cols, & names );
-                    if (rc == 0) {
-                        rc = KNamelistCount ( names, & count );
-                        for ( i = 0; rc == 0 && i < count; ++ i )
-                        {
-                            rc = KNamelistGet ( names, i, & name );
-                            if ( rc == 0 && VTableNameAvail ( & tbl, name ) )
-                            {
-                                const KMDataNode *node;
-                                rc = KMDataNodeOpenNodeRead ( cols, & node, name );
-                                if ( rc == 0 )
-                                {
-                                    /* add in static column */
-                                    rc = VTablePopulateStrayStatic ( self, name, node );
-                                    KMDataNodeRelease ( node );
-                                }
-                            }
-                        }
-                        KNamelistRelease ( names );
-                    }
-                }
-            }
-        }
-
-        KSymTableWhack ( & tbl );
-    }
-
-    return rc;
-}
diff --git a/libs/vdb/table-priv.h b/libs/vdb/table-priv.h
deleted file mode 100644
index 4835628..0000000
--- a/libs/vdb/table-priv.h
+++ /dev/null
@@ -1,232 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_table_priv_
-#define _h_table_priv_
-
-#ifndef _h_vdb_table_
-#include <vdb/table.h>
-#endif
-
-#ifndef _h_schema_priv_
-#include "schema-priv.h"
-#endif
-
-#ifndef _h_vdb_schema_
-#include <vdb/schema.h>
-#endif
-
-#ifndef _h_klib_container_
-#include <klib/container.h>
-#endif
-
-#ifndef _h_klib_vector_
-#include <klib/vector.h>
-#endif
-
-#ifndef _h_klib_text_
-#include <klib/text.h>
-#endif
-
-#ifndef _h_klib_refcount_
-#include <klib/refcount.h>
-#endif
-
-#ifndef KONST
-#define KONST
-#endif
-
-#ifndef SKONST
-#define SKONST const
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define LAZY_OPEN_COL_NODE 0
-
-
-/*--------------------------------------------------------------------------
- * forwards
- */
-struct KTable;
-struct STable;
-struct SColumn;
-struct VLinker;
-struct VDatabase;
-struct KMetadata;
-struct VDBManager;
-
-
-/*--------------------------------------------------------------------------
- * VTable
- *  represents a table
- *  normally implemented as a directory
- *  but may be a single archive file
- *  in either executable or streamable format
- */
-struct VTable
-{
-    /* creating manager */
-    struct VDBManager KONST *mgr;
-
-    /* enclosing database - NULL OKAY */
-    struct VDatabase KONST *db;
-
-    /* schema and table description
-       a new schema is created to house schema
-       obtained from existing table/column metadata */
-    VSchema SKONST *schema;
-    struct STable const *stbl;
-
-    /* intrinsic functions */
-    struct VLinker *linker;
-
-    /* underlying physical layer table */
-    struct KTable KONST *ktbl;
-
-    /* open table metadata */
-    struct KMetadata KONST *meta;
-
-    /* "col" subnode of metadata */
-    struct KMDataNode KONST *col_node;
-
-    /* caches of readable and writable columns */
-    BSTree read_col_cache;
-    BSTree write_col_cache;
-
-    /* user data */
-    void *user;
-    void ( CC * user_whack ) ( void *data );
-
-    /* page size for creating columns */
-    size_t pgsize;
-
-    /* open references */
-    KRefcount refcount;
-
-    /* create and checksum modes for columns */
-    uint8_t cmode;
-    uint8_t checksum;
-
-    /* open mode */
-    bool read_only;
-
-    /* cache validity */
-    bool read_col_cache_valid;
-    bool write_col_cache_valid;
-};
-
-
-/* Whack
- */
-rc_t VTableWhack ( VTable *self );
-
-
-/* Attach
- * Sever
- *  internal reference management
- */
-VTable *VTableAttach ( const VTable *self );
-rc_t VTableSever ( const VTable *self );
-
-
-/* Make
- *  creates an initialized table object
- *  expects either a mgr or a parent db,
- *  creates a modifiable schema
- */
-rc_t VTableMake ( VTable **tblp,
-    struct VDBManager const *mgr,
-    struct VDatabase const *db,
-    const VSchema *schema );
-
-
-/* LoadSchema
- *  looks in metadata for stored schema
- *  or searches available definitions for match
- */
-rc_t VTableLoadSchema ( VTable *self );
-
-/* StoreSchema
- *  stores schema definition in metadata
- */
-VDB_EXTERN rc_t VTableStoreSchema ( VTable *self );
-
-/* support for listing
- */
-rc_t make_column_namelist ( const BSTree *columns, struct KNamelist **names );
-rc_t make_column_typelist ( const BSTree *columns, const char *col,
-    uint32_t *dflt_idx, struct KNamelist **typedecls );
-
-
-/*--------------------------------------------------------------------------
- * VColumnRef
- *  cache entry
- */
-typedef struct VColumnRef VColumnRef;
-struct VColumnRef
-{
-    BSTNode n;
-    String name;
-    VTypedecl td;
-    VCtxId cid;
-    bool dflt;
-    char typedecl [ 2 ];
-};
-
-
-/* Whack
- *  for dropping a BSTree
- */
-void CC VColumnRefWhack ( BSTNode *n, void *ignore );
-
-
-/* Make
- *  make a column ref from an SColumn*
- */
-rc_t VColumnRefMake ( VColumnRef **cref,
-    const VSchema *schema, struct SColumn const *scol );
-
-
-/* CmpString
- *  compares by name only
- *  "item" is a const String*
- */
-int CC VColumnRefCmpString ( const void *item, const BSTNode *n );
-
-/* Sort
- *  compares by (name,type) pair
- */
-int CC VColumnRefSort ( const BSTNode *item, const BSTNode *n );
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_table_priv_ */
diff --git a/libs/vdb/table.c b/libs/vdb/table.c
deleted file mode 100644
index ed2d71d..0000000
--- a/libs/vdb/table.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#define KONST const
-#include "table-priv.h"
-#undef KONST
-
-#include <klib/namelist.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-/* List
- *  (moved from table-cmn.c to here, because needs access to VCursor...)
- *  create a namelist of all usable columns :
- *  columns, that can be added to a cursor - and the following cursor-open will not fail
- */
-LIB_EXPORT rc_t CC VTableListWritableColumns ( struct VTable *self, KNamelist **names )
-{
-    rc_t rc;
-
-    if ( names == NULL )
-        rc = RC ( rcVDB, rcTable, rcListing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcTable, rcListing, rcSelf, rcNull );
-        else
-        {
-            VNamelist *list;
-            rc = VNamelistMake ( & list, 0 );
-            if ( rc == 0 )
-            {
-                rc = VNamelistToNamelist ( list, names );
-                VNamelistRelease ( list );
-                return rc;
-            }
-        }
-
-        * names = NULL;
-    }
-    return rc;
-}
-
-
-/* ListDatatypes
- *  returns list of typedecls for named column
- *
- *  "col" [ IN ] - column name
- *
- *  "typedecls" [ OUT ] - list of datatypes available for named column
- *
- *  availability: v2.1
- */
-LIB_EXPORT rc_t CC VTableListWritableDatatypes ( struct VTable *self,
-    const char *col, KNamelist **typedecls )
-{
-    rc_t rc;
-    
-    if ( typedecls == NULL )
-        rc = RC ( rcVDB, rcTable, rcListing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcTable, rcListing, rcSelf, rcNull );
-        else if ( col == NULL )
-            rc = RC ( rcVDB, rcSchema, rcListing, rcName, rcNull );
-        else if ( col [ 0 ] == 0 )
-            rc = RC ( rcVDB, rcSchema, rcListing, rcName, rcEmpty );
-        else
-        {
-            /* make eventually returned */
-            VNamelist *vlist;
-            rc = VNamelistMake ( &vlist, 0 );
-            if ( rc == 0 )
-            {
-                rc = VNamelistToNamelist ( vlist, typedecls );
-                VNamelistRelease ( vlist );
-                return rc;
-            }
-        }
-
-        * typedecls = NULL;
-    }
-
-    return rc;
-}
diff --git a/libs/vdb/transpose.c b/libs/vdb/transpose.c
deleted file mode 100644
index 3b585ab..0000000
--- a/libs/vdb/transpose.c
+++ /dev/null
@@ -1,720 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#include <vdb/xform.h>
-#include <klib/rc.h>
-
-#include "xform-priv.h"
-#include "blob-priv.h"
-#include "blob.h"
-#include "page-map.h"
-
-#include <assert.h>
-
-
-/* Create
- *
- * Create a new blob.  A new data buffer is sized to
- * 'element_count' * sizeof datatype; its contents are
- * uninitialized.
- */
-static
-rc_t VBlobCreate ( VBlob **blobp, const VBlob *in )
-{
-    rc_t rc = VBlobNew ( blobp, in -> start_id, in -> stop_id, "transpose" );
-    if ( rc == 0 )
-    {
-        VBlob *blob = * blobp;
-        rc = KDataBufferMake ( & blob -> data,
-            in -> data . elem_bits, in -> data . elem_count );
-        if ( rc != 0 )
-        {
-            VBlobRelease ( blob );
-            * blobp = NULL;
-        }
-        else
-        {
-            blob -> byte_order = in -> byte_order;
-        }
-    }
-    return rc;
-}
-
-
-/* detranspose
- *  pardoning the awful name, apply a transposition on the result
- *  of "transpose" to produce the original blob. "transpose"
- *  itself cannot be reused because of its signature.
- *
- *  see "transpose" below for an explanation
- */
-static
-rc_t CC transpose_formatted8 ( void *self, const VXformInfo *info, int64_t row_id,
-    VBlob **rslt, uint32_t argc, const VBlob *argv [] )
-{
-    /* input blob - schema assures us that it is ready to go */
-    const VBlob *in = argv [ 0 ];
-
-    /* allocate output blob of same size */
-    rc_t rc = VBlobCreate ( rslt, in );
-    if ( rc != 0 )
-        rc = ResetRCContext ( rc, rcVDB, rcFunction, rcExecuting );
-    else
-    {
-        VBlob *out = * rslt;
-
-        /* page-map iterator */
-        PageMapIterator it;
-        rc = PageMapNewIterator ( in -> pm, & it, 0, -1 );
-
-        /* create a new reference to the page map */
-        if ( rc == 0 )
-            rc = PageMapAddRef ( in -> pm );
-
-        /* last chance for failure */
-        if ( rc != 0 )
-        {
-            rc = ResetRCContext ( rc, rcVDB, rcFunction, rcExecuting );
-            VBlobRelease ( out );
-            * rslt = NULL;
-        }
-        else
-        {
-            uint32_t j, k;
-            elem_count_t i, max_row_len, row_len, rpt_cnt;
-
-            /* get source and destination pointers */
-            uint8_t *dst = out -> data . base;
-            const uint8_t *src = in -> data . base;
-
-            /* set page-map on out */
-            out -> pm = in -> pm;
-
-            /* perform the transformation
-               the first pass will determine maximum row length */
-            for ( max_row_len = 0, j = k = 0; ;  k += row_len )
-            {
-                row_len = PageMapIteratorDataLength ( & it );
-                if ( row_len > max_row_len )
-                    max_row_len = row_len;
-
-                if ( row_len != 0 )
-                {
-                    dst [ k ] = src [ j ];
-                    ++ j;
-                }
-
-                rpt_cnt = PageMapIteratorRepeatCount ( & it );
-                if ( ! PageMapIteratorAdvance ( & it, rpt_cnt ) )
-                    break;
-            }
-
-            /* perform transformation on the remainder */
-            for ( i = 1; i < max_row_len; ++ i )
-            {
-                it . cur_row = 0;
-                for ( k = i; ; k += row_len )
-                {
-                    row_len = PageMapIteratorDataLength ( & it );
-                    if ( row_len > i )
-                    {
-                        dst [ k ] = src [ j ];
-                        ++ j;
-                    }
-
-                    rpt_cnt = PageMapIteratorRepeatCount ( & it );
-                    if ( ! PageMapIteratorAdvance ( & it, rpt_cnt ) )
-                        break;
-                }
-            }
-        }
-    }
-
-    return rc;
-}
-
-static
-rc_t CC transpose_formatted16 ( void *self, const VXformInfo *info, int64_t row_id,
-    VBlob **rslt, uint32_t argc, const VBlob *argv [] )
-{
-    const VBlob *in = argv [ 0 ];
-    rc_t rc = VBlobCreate ( rslt, in );
-    if ( rc != 0 )
-        rc = ResetRCContext ( rc, rcVDB, rcFunction, rcExecuting );
-    else
-    {
-        VBlob *out = * rslt;
-        PageMapIterator it;
-        rc = PageMapNewIterator ( in -> pm, & it, 0, -1 );
-        if ( rc == 0 )
-            rc = PageMapAddRef ( in -> pm );
-        if ( rc != 0 )
-        {
-            rc = ResetRCContext ( rc, rcVDB, rcFunction, rcExecuting );
-            VBlobRelease ( out );
-            * rslt = NULL;
-        }
-        else
-        {
-            uint32_t j, k;
-            elem_count_t i, max_row_len, row_len, rpt_cnt;
-            uint16_t *dst = out -> data . base;
-            const uint16_t *src = in -> data . base;
-            out -> pm = in -> pm;
-            for ( max_row_len = 0, j = k = 0; ;  k += row_len )
-            {
-                row_len = PageMapIteratorDataLength ( & it );
-                if ( row_len > max_row_len )
-                    max_row_len = row_len;
-                if ( row_len != 0 )
-                {
-                    dst [ k ] = src [ j ];
-                    ++ j;
-                }
-                rpt_cnt = PageMapIteratorRepeatCount ( & it );
-                if ( ! PageMapIteratorAdvance ( & it, rpt_cnt ) )
-                    break;
-            }
-            for ( i = 1; i < max_row_len; ++ i )
-            {
-                it . cur_row = 0;
-                for ( k = i; ; k += row_len )
-                {
-                    row_len = PageMapIteratorDataLength ( & it );
-                    if ( row_len > i )
-                    {
-                        dst [ k ] = src [ j ];
-                        ++ j;
-                    }
-                    rpt_cnt = PageMapIteratorRepeatCount ( & it );
-                    if ( ! PageMapIteratorAdvance ( & it, rpt_cnt ) )
-                        break;
-                }
-            }
-        }
-    }
-
-    return rc;
-}
-
-static
-rc_t CC transpose_formatted32 ( void *self, const VXformInfo *info, int64_t row_id,
-    VBlob **rslt, uint32_t argc, const VBlob *argv [] )
-{
-    const VBlob *in = argv [ 0 ];
-    rc_t rc = VBlobCreate ( rslt, in );
-    if ( rc != 0 )
-        rc = ResetRCContext ( rc, rcVDB, rcFunction, rcExecuting );
-    else
-    {
-        VBlob *out = * rslt;
-        PageMapIterator it;
-        rc = PageMapNewIterator ( in -> pm, & it, 0, -1 );
-        if ( rc == 0 )
-            rc = PageMapAddRef ( in -> pm );
-        if ( rc != 0 )
-        {
-            rc = ResetRCContext ( rc, rcVDB, rcFunction, rcExecuting );
-            VBlobRelease ( out );
-            * rslt = NULL;
-        }
-        else
-        {
-            uint32_t j, k;
-            elem_count_t i, max_row_len, row_len, rpt_cnt;
-            uint32_t *dst = out -> data . base;
-            const uint32_t *src = in -> data . base;
-            out -> pm = in -> pm;
-            for ( max_row_len = 0, j = k = 0; ;  k += row_len )
-            {
-                row_len = PageMapIteratorDataLength ( & it );
-                if ( row_len > max_row_len )
-                    max_row_len = row_len;
-                if ( row_len != 0 )
-                {
-                    dst [ k ] = src [ j ];
-                    ++ j;
-                }
-                rpt_cnt = PageMapIteratorRepeatCount ( & it );
-                if ( ! PageMapIteratorAdvance ( & it, rpt_cnt ) )
-                    break;
-            }
-            for ( i = 1; i < max_row_len; ++ i )
-            {
-                it . cur_row = 0;
-                for ( k = i; ; k += row_len )
-                {
-                    row_len = PageMapIteratorDataLength ( & it );
-                    if ( row_len > i )
-                    {
-                        dst [ k ] = src [ j ];
-                        ++ j;
-                    }
-                    rpt_cnt = PageMapIteratorRepeatCount ( & it );
-                    if ( ! PageMapIteratorAdvance ( & it, rpt_cnt ) )
-                        break;
-                }
-            }
-        }
-    }
-
-    return rc;
-}
-
-static
-rc_t CC transpose_formatted64 ( void *self, const VXformInfo *info, int64_t row_id,
-    VBlob **rslt, uint32_t argc, const VBlob *argv [] )
-{
-    const VBlob *in = argv [ 0 ];
-    rc_t rc = VBlobCreate ( rslt, in );
-    if ( rc != 0 )
-        rc = ResetRCContext ( rc, rcVDB, rcFunction, rcExecuting );
-    else
-    {
-        VBlob *out = * rslt;
-        PageMapIterator it;
-        rc = PageMapNewIterator ( in -> pm, & it, 0, -1 );
-        if ( rc == 0 )
-            rc = PageMapAddRef ( in -> pm );
-        if ( rc != 0 )
-        {
-            rc = ResetRCContext ( rc, rcVDB, rcFunction, rcExecuting );
-            VBlobRelease ( out );
-            * rslt = NULL;
-        }
-        else
-        {
-            uint32_t j, k;
-            elem_count_t i, max_row_len, row_len, rpt_cnt;
-            uint64_t *dst = out -> data . base;
-            const uint64_t *src = in -> data . base;
-            out -> pm = in -> pm;
-            for ( max_row_len = 0, j = k = 0; ;  k += row_len )
-            {
-                row_len = PageMapIteratorDataLength ( & it );
-                if ( row_len > max_row_len )
-                    max_row_len = row_len;
-                if ( row_len != 0 )
-                {
-                    dst [ k ] = src [ j ];
-                    ++ j;
-                }
-                rpt_cnt = PageMapIteratorRepeatCount ( & it );
-                if ( ! PageMapIteratorAdvance ( & it, rpt_cnt ) )
-                    break;
-            }
-            for ( i = 1; i < max_row_len; ++ i )
-            {
-                it . cur_row = 0;
-                for ( k = i; ; k += row_len )
-                {
-                    row_len = PageMapIteratorDataLength ( & it );
-                    if ( row_len > i )
-                    {
-                        dst [ k ] = src [ j ];
-                        ++ j;
-                    }
-                    rpt_cnt = PageMapIteratorRepeatCount ( & it );
-                    if ( ! PageMapIteratorAdvance ( & it, rpt_cnt ) )
-                        break;
-                }
-            }
-        }
-    }
-
-    return rc;
-}
-
-VTRANSFACT_BUILTIN_IMPL ( vdb_detranspose, 1, 0, 0 )
-    ( const void *self, const VXfactInfo *info, VFuncDesc *rslt,
-      const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    switch ( VTypedescSizeof ( & info -> fdesc . desc ) )
-    {
-    case 8:
-        VFUNCDESC_INTERNAL_FUNCS ( rslt ) -> bfN = transpose_formatted8;
-        break;
-    case 16:
-        VFUNCDESC_INTERNAL_FUNCS ( rslt ) -> bfN = transpose_formatted16;
-        break;
-    case 32:
-        VFUNCDESC_INTERNAL_FUNCS ( rslt ) -> bfN = transpose_formatted32;
-        break;
-    case 64:
-        VFUNCDESC_INTERNAL_FUNCS ( rslt ) -> bfN = transpose_formatted64;
-        break;
-    }
-
-    rslt -> variant = vftBlobN;
-    return 0;
-}
-
-/* transpose
- *  transpose a page of unformatted data
- *
- *  for example - convert a simple page of values,
- *  where vertical scale is row id and horizontal element index:
- *
- *        1   2   3
- *      +---+---+---+
- *    1 | a | b | c |
- *      +---+---+---+
- *    2 | d | e |
- *      +---+---+
- *    3 | f |
- *      +---+---+---+
- *    4 | g | h | i |
- *      +---+---+---+
- *
- *  into:
- *
- *        1   2   3   4
- *      +---+---+---+---+
- *    1 | a | d | f | g |
- *      +---+---+---+---+
- *    2 | b | e |   | h |
- *      +---+---+   +---+
- *    3 | c |       | i |
- *      +---+       +---+
- *
- *  or:
- *
- *      +---+---+---+---+---+---+---+---+---+
- *      | a | d | f | g | b | e | h | c | i |
- *      +---+---+---+---+---+---+---+---+---+
- *
- *  variable row-lengths are supported. The output blob is
- *  formatted, meaning that the result can no longer be addressed
- *  as a matrix, but the transposition has be applied to data.
- *
- *  "in" [ DATA ] - unformatted data to be transposed
- */
-static
-rc_t CC transpose_unformatted8 ( void *self, const VXformInfo *info, int64_t row_id,
-    VBlob **rslt, uint32_t argc, const VBlob *argv [] )
-{
-    /* input blob - schema assures us that it is ready to go */
-    const VBlob *in = argv [ 0 ];
-
-    /* allocate output blob of same size */
-    rc_t rc = VBlobCreate ( rslt, in );
-    if ( rc != 0 )
-        rc = ResetRCContext ( rc, rcVDB, rcFunction, rcExecuting );
-    else
-    {
-        VBlob *out = * rslt;
-
-        /* page-map iterator */
-        PageMapIterator it;
-        rc = PageMapNewIterator ( in -> pm, & it, 0, -1 );
-
-        /* create a new reference to the page map */
-        if ( rc == 0 )
-            rc = PageMapAddRef ( in -> pm );
-
-        /* last chance for failure */
-        if ( rc != 0 )
-        {
-            rc = ResetRCContext ( rc, rcVDB, rcFunction, rcExecuting );
-            VBlobRelease ( out );
-            * rslt = NULL;
-        }
-        else
-        {
-            uint32_t j, k;
-            elem_count_t i, max_row_len, row_len, rpt_cnt;
-
-            /* get source and destination pointers */
-            uint8_t *dst = out -> data . base;
-            const uint8_t *src = in -> data . base;
-
-            /* set page-map on out */
-            out -> pm = in -> pm;
-
-            /* perform the transformation
-               the first pass will determine maximum row length */
-            for ( max_row_len = 0, j = k = 0; ;  k += row_len )
-            {
-                row_len = PageMapIteratorDataLength ( & it );
-                if ( row_len > max_row_len )
-                    max_row_len = row_len;
-
-                if ( row_len != 0 )
-                {
-                    dst [ j ] = src [ k ];
-                    ++ j;
-                }
-
-                rpt_cnt = PageMapIteratorRepeatCount ( & it );
-                if ( ! PageMapIteratorAdvance ( & it, rpt_cnt ) )
-                    break;
-            }
-
-            /* perform transformation on the remainder */
-            for ( i = 1; i < max_row_len; ++ i )
-            {
-                it . cur_row = 0;
-                for ( k = i; ; k += row_len )
-                {
-                    row_len = PageMapIteratorDataLength ( & it );
-                    if ( row_len > i )
-                    {
-                        dst [ j ] = src [ k ];
-                        ++ j;
-                    }
-
-                    rpt_cnt = PageMapIteratorRepeatCount ( & it );
-                    if ( ! PageMapIteratorAdvance ( & it, rpt_cnt ) )
-                        break;
-                }
-            }
-        }
-    }
-
-    return rc;
-}
-
-static
-rc_t CC transpose_unformatted16 ( void *self, const VXformInfo *info, int64_t row_id,
-    VBlob **rslt, uint32_t argc, const VBlob *argv [] )
-{
-    const VBlob *in = argv [ 0 ];
-    rc_t rc = VBlobCreate ( rslt, in );
-    if ( rc != 0 )
-        rc = ResetRCContext ( rc, rcVDB, rcFunction, rcExecuting );
-    else
-    {
-        VBlob *out = * rslt;
-        PageMapIterator it;
-        rc = PageMapNewIterator ( in -> pm, & it, 0, -1 );
-        if ( rc == 0 )
-            rc = PageMapAddRef ( in -> pm );
-        if ( rc != 0 )
-        {
-            rc = ResetRCContext ( rc, rcVDB, rcFunction, rcExecuting );
-            VBlobRelease ( out );
-            * rslt = NULL;
-        }
-        else
-        {
-            uint32_t j, k;
-            elem_count_t i, max_row_len, row_len, rpt_cnt;
-            uint16_t *dst = out -> data . base;
-            const uint16_t *src = in -> data . base;
-            out -> pm = in -> pm;
-            for ( max_row_len = 0, j = k = 0; ;  k += row_len )
-            {
-                row_len = PageMapIteratorDataLength ( & it );
-                if ( row_len > max_row_len )
-                    max_row_len = row_len;
-                if ( row_len != 0 )
-                {
-                    dst [ j ] = src [ k ];
-                    ++ j;
-                }
-                rpt_cnt = PageMapIteratorRepeatCount ( & it );
-                if ( ! PageMapIteratorAdvance ( & it, rpt_cnt ) )
-                    break;
-            }
-            for ( i = 1; i < max_row_len; ++ i )
-            {
-                it . cur_row = 0;
-                for ( k = i; ; k += row_len )
-                {
-                    row_len = PageMapIteratorDataLength ( & it );
-                    if ( row_len > i )
-                    {
-                        dst [ j ] = src [ k ];
-                        ++ j;
-                    }
-                    rpt_cnt = PageMapIteratorRepeatCount ( & it );
-                    if ( ! PageMapIteratorAdvance ( & it, rpt_cnt ) )
-                        break;
-                }
-            }
-        }
-    }
-
-    return rc;
-}
-
-static
-rc_t CC transpose_unformatted32 ( void *self, const VXformInfo *info, int64_t row_id,
-    VBlob **rslt, uint32_t argc, const VBlob *argv [] )
-{
-    const VBlob *in = argv [ 0 ];
-    rc_t rc = VBlobCreate ( rslt, in );
-    if ( rc != 0 )
-        rc = ResetRCContext ( rc, rcVDB, rcFunction, rcExecuting );
-    else
-    {
-        VBlob *out = * rslt;
-        PageMapIterator it;
-        rc = PageMapNewIterator ( in -> pm, & it, 0, -1 );
-        if ( rc == 0 )
-            rc = PageMapAddRef ( in -> pm );
-        if ( rc != 0 )
-        {
-            rc = ResetRCContext ( rc, rcVDB, rcFunction, rcExecuting );
-            VBlobRelease ( out );
-            * rslt = NULL;
-        }
-        else
-        {
-            uint32_t j, k;
-            elem_count_t i, max_row_len, row_len, rpt_cnt;
-            uint32_t *dst = out -> data . base;
-            const uint32_t *src = in -> data . base;
-            out -> pm = in -> pm;
-            for ( max_row_len = 0, j = k = 0; ;  k += row_len )
-            {
-                row_len = PageMapIteratorDataLength ( & it );
-                if ( row_len > max_row_len )
-                    max_row_len = row_len;
-                if ( row_len != 0 )
-                {
-                    dst [ j ] = src [ k ];
-                    ++ j;
-                }
-                rpt_cnt = PageMapIteratorRepeatCount ( & it );
-                if ( ! PageMapIteratorAdvance ( & it, rpt_cnt ) )
-                    break;
-            }
-            for ( i = 1; i < max_row_len; ++ i )
-            {
-                it . cur_row = 0;
-                for ( k = i; ; k += row_len )
-                {
-                    row_len = PageMapIteratorDataLength ( & it );
-                    if ( row_len > i )
-                    {
-                        dst [ j ] = src [ k ];
-                        ++ j;
-                    }
-                    rpt_cnt = PageMapIteratorRepeatCount ( & it );
-                    if ( ! PageMapIteratorAdvance ( & it, rpt_cnt ) )
-                        break;
-                }
-            }
-        }
-    }
-
-    return rc;
-}
-
-static
-rc_t CC transpose_unformatted64 ( void *self, const VXformInfo *info, int64_t row_id,
-    VBlob **rslt, uint32_t argc, const VBlob *argv [] )
-{
-    const VBlob *in = argv [ 0 ];
-    rc_t rc = VBlobCreate ( rslt, in );
-    if ( rc != 0 )
-        rc = ResetRCContext ( rc, rcVDB, rcFunction, rcExecuting );
-    else
-    {
-        VBlob *out = * rslt;
-        PageMapIterator it;
-        rc = PageMapNewIterator ( in -> pm, & it, 0, -1 );
-        if ( rc == 0 )
-            rc = PageMapAddRef ( in -> pm );
-        if ( rc != 0 )
-        {
-            rc = ResetRCContext ( rc, rcVDB, rcFunction, rcExecuting );
-            VBlobRelease ( out );
-            * rslt = NULL;
-        }
-        else
-        {
-            uint32_t j, k;
-            elem_count_t i, max_row_len, row_len, rpt_cnt;
-            uint64_t *dst = out -> data . base;
-            const uint64_t *src = in -> data . base;
-            out -> pm = in -> pm;
-            for ( max_row_len = 0, j = k = 0; ;  k += row_len )
-            {
-                row_len = PageMapIteratorDataLength ( & it );
-                if ( row_len > max_row_len )
-                    max_row_len = row_len;
-                if ( row_len != 0 )
-                {
-                    dst [ j ] = src [ k ];
-                    ++ j;
-                }
-                rpt_cnt = PageMapIteratorRepeatCount ( & it );
-                if ( ! PageMapIteratorAdvance ( & it, rpt_cnt ) )
-                    break;
-            }
-            for ( i = 1; i < max_row_len; ++ i )
-            {
-                it . cur_row = 0;
-                for ( k = i; ; k += row_len )
-                {
-                    row_len = PageMapIteratorDataLength ( & it );
-                    if ( row_len > i )
-                    {
-                        dst [ j ] = src [ k ];
-                        ++ j;
-                    }
-                    rpt_cnt = PageMapIteratorRepeatCount ( & it );
-                    if ( ! PageMapIteratorAdvance ( & it, rpt_cnt ) )
-                        break;
-                }
-            }
-        }
-    }
-
-    return rc;
-}
-
-
-VTRANSFACT_BUILTIN_IMPL ( vdb_transpose, 1, 0, 0 )
-    ( const void *self, const VXfactInfo *info, VFuncDesc *rslt,
-      const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    /* the TYPE of input has been validated by schema, but not the dimension */
-    switch ( VTypedescSizeof ( & dp -> argv [ 0 ] . desc ) )
-    {
-    case 8:
-        VFUNCDESC_INTERNAL_FUNCS ( rslt ) -> bfN = transpose_unformatted8;
-        break;
-    case 16:
-        VFUNCDESC_INTERNAL_FUNCS ( rslt ) -> bfN = transpose_unformatted16;
-        break;
-    case 32:
-        VFUNCDESC_INTERNAL_FUNCS ( rslt ) -> bfN = transpose_unformatted32;
-        break;
-    case 64:
-        VFUNCDESC_INTERNAL_FUNCS ( rslt ) -> bfN = transpose_unformatted64;
-        break;
-    default:
-        return RC ( rcVDB, rcFunction, rcConstructing, rcType, rcUnsupported );
-    }
-
-    rslt -> variant = vftBlobN;
-    return 0;
-}
diff --git a/libs/vdb/wcolumn.c b/libs/vdb/wcolumn.c
deleted file mode 100644
index fa7e2c8..0000000
--- a/libs/vdb/wcolumn.c
+++ /dev/null
@@ -1,1069 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#include "klib/symbol.h"
-#include "column-priv.h"
-#include "dbmgr-priv.h"
-#include "schema-priv.h"
-#include "schema-expr.h"
-#include "schema-parse.h"
-#include "cursor-priv.h"
-#include "prod-priv.h"
-#include "blob-priv.h"
-#include "page-map.h"
-
-#include <vdb/manager.h>
-#include <vdb/cursor.h>
-#include <kdb/column.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <bitstr.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-/* these constants MUST each be a power of two */
-#define INITIAL_DATA_PEAK ( 32 * 1024 )
-#define SINGLE_PAGE_SIZE ( 4 * 1024 )
-
-/* this is a fairly high value, useful for writing single tables
-   of data that are generally accessed serially. it's bad for random. */
-#define DFLT_TRIGGER ( 2 * 1024 * 1024 )
-
-/* debugging aid - Row-wise RunLengthEncoding ( repeated column
-   elimination ) can be disabled to check for errors it may introduce. */
-#define USE_RLE 1
-
-/* when defined, use as an additional condition for detecting
-   auto-commit cutoff points, with a limit in kilo-rows given below */
-#define ROW_COUNT_CUTOFFS 128
-
-#if ROW_COUNT_CUTOFFS
-#define MAX_ROW_COUNT ( ROW_COUNT_CUTOFFS * 1024 )
-#else
-#define MAX_ROW_COUNT 0x40000000
-#endif
-
-
-/*--------------------------------------------------------------------------
- * VColumn
- */
-
-static 
-void WColumnDestroy ( WColumn * self )
-{
-#if PROD_REFCOUNT && ! PROD_ALL_IN_CURSOR
-    PROD_TRACK_REFCOUNT ( VProductionRelease, self -> out );
-    VProductionRelease ( self -> out, NULL );
-    PROD_TRACK_REFCOUNT ( VProductionRelease, self -> val );
-    VProductionRelease ( self -> val, NULL );
-#endif
-}
-
-
-/* Whack
- *  perform read-only cleanup
- */
-void CC VColumnWhack ( void *item, void *data )
-{
-    VColumn *self = item;
-    VCursor *curs = data;
-
-    /* remove from cursor */
-    if ( curs != NULL )
-    {
-        VectorSwap ( & curs -> row, self -> ord, NULL, & item );
-        VCursorCacheSwap ( & curs -> col, & self -> scol -> cid, NULL, & item );
-    }
-
-    if ( ! self -> read_only )
-    {
-        WColumn *wself = ( WColumn* ) self;
-
-        if ( wself -> page != NULL )
-        {
-            TRACK_BLOB (VBlobRelease, wself->page);
-            VBlobRelease ( wself -> page );
-        }
-
-        KDataBufferWhack ( & wself -> dflt );
-        KDataBufferWhack ( & wself -> data );
-        KDataBufferWhack ( & wself -> rowmap );
-        WColumnDestroy ( wself );
-
-    }
-
-    VColumnDestroy ( self );
-    free ( self );
-}
-
-
-/* Make - PRIVATE
- *  make a write column
- */
-rc_t WColumnMake ( VColumn **colp, const VSchema *schema, const SColumn *scol,
-    const SExpression *blob_limit, VDBManager *mgr, Vector *cx_bind )
-{
-    rc_t rc;
-    WColumn *col;
-
-    assert ( colp != NULL );
-    assert ( schema != NULL );
-    assert ( scol != NULL );
-    assert ( mgr != NULL );
-
-    col = calloc ( 1, sizeof * col );
-    if ( col == NULL )
-        rc = RC ( rcVDB, rcColumn, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        rc = VColumnInit ( & col -> dad, schema, scol );
-        if ( rc == 0 )
-        {
-            uint32_t i;
-
-            /* initialize peak histories */
-            for ( i = 0; i < sizeof col -> data_peak_hist / sizeof col -> data_peak_hist [ 0 ]; ++ i )
-                col -> data_peak_hist [ i ] = INITIAL_DATA_PEAK;
-
-            /* initial current peak */
-            col -> data_peak = INITIAL_DATA_PEAK;
-
-            /* use column-specific expression if provided */
-            if ( scol -> limit != NULL )
-                blob_limit = scol -> limit;
-
-            /* evaluate blob cutoff limit expression */
-            if ( blob_limit == NULL )
-            {
-#ifdef DFLT_TRIGGER
-                /* use define */
-                col -> trigger = DFLT_TRIGGER;
-#else
-                /* produce max unsigned integer */
-                -- col -> trigger;
-#endif
-            }
-            else
-            {
-                /* evaluate column blob limit */
-                uint64_t trigger;
-                rc = eval_uint64_expr ( schema, blob_limit, & trigger, cx_bind );
-                col -> trigger = ( size_t ) trigger;
-            }
-
-            if ( rc == 0 )
-            {
-                * colp = & col -> dad;
-                return 0;
-            }
-        }
-
-        free ( col );
-    }
-
-    * colp = NULL;
-    return rc;
-}
-
-
-/* IdRange
- *  returns id range for column or page
- */
-rc_t VColumnIdRange ( const VColumn *vcol, int64_t *first, int64_t *last )
-{
-    rc_t rc;
-    const WColumn *self = ( const WColumn* ) vcol;
-
-    assert ( self != NULL );
-    assert ( first != NULL && last != NULL );
-
-    if ( self -> dad . in != NULL )
-        return VColumnIdRangeRead ( & self -> dad, first, last );
-
-    if ( self -> val == NULL )
-        rc = RC ( rcVDB, rcColumn, rcAccessing, rcRange, rcNotOpen );
-    else
-    {
-        /* a little silly, but set max range in 64-bit
-           without complaints from 32-bit compilers */
-        * first = 1;
-        * first <<= 63;
-        * last = ~ * first;
-
-        /* now intersect this range with all physical sources */
-        rc = VProductionColumnIdRange ( self -> val, first, last );
-        if ( rc == 0 )
-            return 0;
-    }
-
-    * first = * last = 0;
-
-    return rc;
-}
-
-/* SetDefault
- *  capture default row data
- */
-rc_t WColumnSetDefault ( VColumn *vcol,
-    bitsz_t elem_bits, const void *buffer, bitsz_t boff, uint64_t len )
-{
-    rc_t rc;
-    bitsz_t elem_size, to_copy;
-    WColumn *self = ( WColumn* ) vcol;
-
-    assert ( elem_bits != 0 );
-    assert ( buffer != NULL || ( boff == 0 && len == 0 ) );
-
-    /* test "compatibility" of elem_bits
-       this is used to interpret "len" */
-    elem_size = VTypedescSizeof ( & self -> dad . desc );
-    if ( elem_bits < elem_size && elem_size % elem_bits != 0 )
-        return RC ( rcVDB, rcColumn, rcUpdating, rcType, rcInconsistent );
-    if ( elem_bits > elem_size && elem_bits % elem_size != 0 )
-        return RC ( rcVDB, rcColumn, rcUpdating, rcType, rcInconsistent );
-
-    /* allow NULL setting */
-    if ( buffer == NULL )
-    {
-        KDataBufferWhack ( & self -> dflt );
-        memset ( & self -> dflt, 0, sizeof self -> dflt );
-        self -> have_dflt = true;
-        return 0;
-    }
-
-    /* set the element size */
-    rc = KDataBufferCast ( & self -> dflt, & self -> dflt, elem_bits, false );
-    if ( rc != 0 )
-        return rc;
-
-    /* set the length */
-    rc = KDataBufferResize ( & self -> dflt, len );
-    if ( rc != 0 )
-    {
-        assert ( KDataBufferWritable ( & self -> dflt ) );
-        return rc;
-    }
-
-    /* copy in the row */
-    to_copy = len * elem_bits;
-    if ( ( ( boff | to_copy ) & 7 ) != 0 )
-        bitcpy ( self -> dflt . base, 0, buffer, boff, to_copy );
-    else
-        memcpy ( self -> dflt . base, & ( ( const uint8_t* ) buffer ) [ boff >> 3 ], to_copy >> 3 );
-    self -> have_dflt = true;
-    return 0;
-}
-
-
-/* OpenRow
- *  update state
- *
- *  "const_row_id" [ IN, CONST ] - id of row being opened. useful
- *  only on initial open when no other rows are buffered.
- */
-void CC WColumnOpenRow ( void *item, void *const_row_id )
-{
-    WColumn *self = item;
-    if ( self != NULL )
-    {
-        int64_t row_id = * ( const int64_t* ) const_row_id;
-
-        assert ( ! self -> row_written );
-        if ( self -> start_id != self -> end_id )
-        {
-            assert ( row_id == self -> end_id );
-        }
-        else
-        {
-            /* capture row id */
-            self -> start_id = self -> end_id = self -> cutoff_id = row_id;
-            assert ( self -> bits_in_buffer == 0 );
-            assert ( self -> row_len == 0 );
-            assert ( self -> num_rows == 0 );
-            assert ( self -> dflt_last == false );
-        }
-    }
-}
-
-
-/* Write
- */
-rc_t WColumnWrite ( VColumn *cself,
-    bitsz_t elem_bits, const void *buffer, bitsz_t boff, uint64_t len )
-{
-    WColumn *self = ( WColumn* ) cself;
-
-    bitsz_t elem_size, num_bits, data_bits, doff;
-
-    assert ( elem_bits != 0 );
-    assert ( buffer != NULL || ( boff == 0 && len == 0 ) );
-
-    /* the number of bits to write */
-    num_bits = ( bitsz_t ) elem_bits * len;
-
-    /* test "compatibility" of elem_bits
-       this is used to interpret "len" */
-    elem_size = VTypedescSizeof ( & self -> dad . desc );
-    if ( elem_bits != elem_size )
-    {
-        if ( elem_bits < elem_size && elem_size % elem_bits != 0 )
-            return RC ( rcVDB, rcColumn, rcUpdating, rcType, rcInconsistent );
-        if ( elem_bits > elem_size && elem_bits % elem_size != 0 )
-            return RC ( rcVDB, rcColumn, rcUpdating, rcType, rcInconsistent );
-        if ( num_bits % elem_size != 0 )
-            return RC ( rcVDB, rcColumn, rcUpdating, rcType, rcInconsistent );
-    }
-
-    /* allow empty row */
-    if ( len == 0 )
-    {
-        self -> row_written = true;
-        self -> dflt_last = false;
-        return 0;
-    }
-
-    /* disallow any further modifications */
-    if ( self -> row_committed )
-        return RC ( rcVDB, rcColumn, rcUpdating, rcColumn, rcBusy );
-
-    /* total number of bits to be put into buffer */
-    doff = self -> bits_in_buffer + self -> row_len;
-    data_bits = doff + num_bits;
-
-    /* see if it fits into buffer */
-    if ( data_bits > KDataBufferBits ( & self -> data ) )
-    {
-        rc_t rc;
-
-        /* calculate needed bytes */
-        size_t new_size = ( ( size_t ) ( ( data_bits + 7 ) >> 3 ) + INITIAL_DATA_PEAK - 1 )
-            & ~ ( size_t ) ( INITIAL_DATA_PEAK - 1 );
-
-        /* need buffer memory */
-        if ( self -> data . elem_count == 0 )
-        {
-            /* always go with the peak size if larger */
-            if ( new_size < self -> data_peak )
-                new_size = self -> data_peak;
-
-            /* make initial buffer at most recent peak */
-            rc = KDataBufferMakeBytes ( & self -> data, new_size );
-            if ( rc != 0 )
-                return rc;
-        }
-        else
-        {
-            /* we have a new peak */
-            rc = KDataBufferResize ( & self -> data, new_size );
-            if ( rc != 0 )
-                return rc;
-        }
-    }
-
-    /* copy in data */
-    if ( ( ( boff | doff | num_bits ) & 7 ) != 0 )
-        bitcpy ( self -> data . base, doff, buffer, boff, num_bits );
-    else
-    {
-        memcpy ( & ( ( uint8_t* ) self -> data . base ) [ doff >> 3 ],
-                 & ( ( const uint8_t* ) buffer ) [ boff >> 3 ], num_bits >> 3 );
-    }
-
-    /* accept changes */
-    self -> row_len += num_bits;
-    self -> row_written = true;
-    self -> dflt_last = false;
-
-    return 0;
-}
-
-/* RowDefaults
- *  if a row has not been written but has a default value,
- *  that value is written to the row. if no default exists,
- *  an error is generated.
- *
- *  "rc" [ OUT, DEFAULT ZERO ] - preset to 0
- *
- *  returns true if any error occurs ( i.e. "*rc != 0" )
- */
-bool CC WColumnRowDefaults ( void *item, void *data )
-{
-    WColumn *self = item;
-    rc_t *rc = data;
-
-    /* nothing to do if row written */
-    if ( self == NULL || self -> row_written )
-        return false;
-
-    /* error if no default value */
-    if ( ! self -> have_dflt )
-    {
-        * rc = RC ( rcVDB, rcColumn, rcClosing, rcRow, rcIncomplete );
-        PLOGERR ( klogErr,
-                  ( klogErr, * rc, "Column: $(col)", "col=%.*s"
-                    , self -> dad . scol -> name -> name . size
-                    , self -> dad . scol -> name -> name . addr )
-            );
-        return true;
-    }
-        
-    /* detect NULL row as default */
-    if ( self -> dflt . elem_bits == 0 )
-    {
-        * rc = RC ( rcVDB, rcColumn, rcClosing, rcRow, rcNull );
-        PLOGERR ( klogWarn,
-                  ( klogWarn, * rc, "Column: $(col)", "col=%.*s"
-                    , self -> dad . scol -> name -> name . size
-                    , self -> dad . scol -> name -> name . addr )
-            );
-        return false;
-    }
-
-    /* if the last column written was default,
-       there is an opportunity for simply incrementing the repeat count */
-    if ( USE_RLE && self -> dflt_last )
-    {
-        WColumnRowMap *rm = self -> rowmap . base;
-        assert ( self -> num_rows != 0 );
-        ++ rm [ self -> num_rows - 1 ] . cnt;
-        return false;
-    }
-
-    /* write default data */
-    * rc = WColumnWrite ( & self -> dad, self -> dflt . elem_bits,
-        self -> dflt . base, 0, self -> dflt . elem_count );
-    if ( * rc != 0 )
-        return true;
-    
-    /* record the fact that this was default */
-    self -> dflt_last = true;
-    return false;
-}
-
-/* CommitRow
- *  closes the row to further writes and accepts
- *  all data written so far as complete. if the accumulated
- *  page data trigger a flush, the flush parameter is set.
- *
- *  "end_id" [ IN/OUT ] - used to calculate the minimum
- *  end_id for pages. if the column decides that it has too
- *  much data in its buffer and wants a cutoff < current
- *  value, it can lower the id.
- *
- *  returns true if there was a memory error.
- */
-static
-bool WColumnCommitRepeatedRow ( WColumn *self, WColumnRowMap *rm, int64_t end_id )
-{
-    /* if we've previously declared a cutoff id,
-       incorporate the repeated row into the range */
-    if ( ( self -> cutoff_id != self -> start_id ) && ( self -> cutoff_id + 1 == end_id ) )
-        self -> cutoff_id = end_id;
-
-    /* just account for the repeated row */
-    ++ rm -> cnt;
-
-    /* drop data */
-    self -> row_len = 0;
-
-    /* the row has been successfully committed */
-    self -> row_committed = true;
-
-    /* no error */
-    return false;
-}
-
-static
-bool WColumnCommitRowData ( WColumn *self, int64_t *end_id )
-{
-    size_t cur_size;
-    uint64_t row_len;
-    bitsz_t elem_bits;
-    WColumnRowMap *rm;
-
-    /* if no data were written and that's okay, ignore */
-    if ( ! self -> row_written )
-    {
-        assert ( self -> row_len == 0 );
-        self -> row_committed = true;
-        return false;
-    }
-
-    /* column's element size */
-    elem_bits = VTypedescSizeof ( & self -> dad . desc );
-    assert ( self -> row_len % elem_bits == 0 );
-    row_len = self -> row_len / elem_bits;
-
-    /* detect repeated row */
-    if ( USE_RLE && self -> num_rows != 0 )
-    {
-        rm = self -> rowmap . base;
-        rm += self -> num_rows - 1;
-
-        if ( rm -> len == row_len )
-        {
-            bitsz_t poff, coff;
-            const uint8_t *base;
-
-            if ( row_len == 0 )
-                return WColumnCommitRepeatedRow ( self, rm, * end_id );
-
-            base = ( const void* ) self -> data . base;
-            assert ( self -> bits_in_buffer >= self -> row_len );
-            coff = self -> bits_in_buffer;
-            poff = self -> bits_in_buffer - self -> row_len;
-
-            if ( ( ( poff | coff | self -> row_len ) & 7 ) != 0 )
-            {
-                if ( bitcmp ( base, poff, base, coff, self -> row_len ) == 0 )
-                    return WColumnCommitRepeatedRow ( self, rm, * end_id );
-            }
-            else
-            {
-                if ( memcmp ( & base [ poff >> 3 ], & base [ coff >> 3 ], self -> row_len >> 3 ) == 0 )
-                    return WColumnCommitRepeatedRow ( self, rm, * end_id );
-            }
-        }
-    }
-
-    /* need to add a new row */
-    if ( ( uint64_t ) self -> num_rows == self -> rowmap . elem_count )
-    {
-        /* need more memory */
-        rc_t rc;
-        self -> rowmap . elem_bits = sizeof * rm * 8;
-        rc = KDataBufferResize ( & self -> rowmap, self -> rowmap . elem_count + 16 * 1024 );
-        if ( rc != 0 )
-        {
-            PLOGERR ( klogErr,
-                      ( klogErr, rc, "Column: $(col) failed to resize row map", "col=%.*s"
-                        , self -> dad . scol -> name -> name . size
-                        , self -> dad . scol -> name -> name . addr )
-                );
-            return true;
-        }
-    }
-
-    rm = self -> rowmap . base;
-    rm += self -> num_rows;
-
-    rm -> start_id = self -> end_id;
-    rm -> len = row_len;
-    rm -> cnt = 1;
-
-    self -> bits_in_buffer += self -> row_len;
-    self -> row_len = 0;
-
-    ++ self -> num_rows;
-    self -> row_committed = true;
-
-    /* detect 1x blob cutoff */
-    cur_size = ( size_t ) ( self -> bits_in_buffer + 7 ) >> 3;
-    if ( cur_size >= self -> trigger )
-    {
-        /* if size just crossed the trigger boundary and 
-         * cutoff_id has not been advanced yet */
-        if ( self -> cutoff_id == self -> start_id )
-        {
-            self -> cutoff_id = * end_id;
-        }
-
-        /* or perhaps the buffer is too large */
-        else if ( ( cur_size + cur_size ) >= self -> trigger * 3 )
-        {
-            /* set to min of current end or our cutoff */
-            if ( self -> cutoff_id < * end_id )
-            {
-#if ROW_COUNT_CUTOFFS
-                /* the number of rows until our cutoff */
-                uint64_t row_count = self -> cutoff_id - self -> start_id;
-                if ( row_count != 0 )
-                {
-/*                  int64_t end; */
-                    uint64_t msb = row_count;
-
-                    /* adjust id to nearest power of two size
-                       that does not exceed current id */
-                    while ( ( msb & ( msb - 1 ) ) != 0 )
-                        msb &= msb - 1;
-
-                    /* add in rounding factor to row_count */
-                    row_count += ( msb >> 1 );
-
-                    /* truncate */
-                    row_count &= ~ ( msb - 1 );
-
-                    if ( row_count >= 1024 )
-                    {
-                        /* limit to current row */
-                        while ( row_count > 1024 && self -> start_id + row_count > * end_id )
-                            row_count >>= 1;
-
-                        if ( self -> start_id + row_count <= * end_id )
-                            self -> cutoff_id = self -> start_id + row_count;
-                    }
-                }
-#endif
-                * end_id = self -> cutoff_id;
-            }
-        }
-    }
-
-    return false;
-}
-
-bool CC WColumnCommitRow ( void *item, void *data )
-{
-    WColumn *self = item;
-    if ( self != NULL )
-    {
-        int64_t *end_id = data;
-
-        if ( WColumnCommitRowData ( self, end_id ) )
-            return true;
-
-        /* if the row range is too great */
-        if ( ( self -> end_id - self -> start_id ) >= MAX_ROW_COUNT )
-        {
-            /* if row range has just crossed the boundary and 
-             * cutoff_id has not been advanced yet */
-            if ( self -> cutoff_id == self -> start_id )
-            {
-                self -> cutoff_id = * end_id;
-            }
-
-            /* set to min of current end or our cutoff */
-            else if ( self -> cutoff_id < * end_id )
-            {
-                * end_id = self -> cutoff_id;
-            }
-        }
-    }
-
-    return false;
-}
-
-/* RepeatRow
- *  go into the last row entry
- *  extend the count by uint64_t
- */
-void CC WColumnRepeatRow ( void *item, void *data )
-{
-    WColumn *self = item;
-    const WColumnRepeatRowData *pb = data;
-
-    if ( self != NULL && self -> num_rows != 0 )
-    {
-        WColumnRowMap *rm = self -> rowmap . base;
-        rm += self -> num_rows - 1;
-
-        /* if we've previously declared a cutoff id,
-           incorporate the repeated row into the range */
-        if ( ( self -> cutoff_id != self -> start_id ) && ( self -> cutoff_id + 1 == pb -> end_id ) )
-            self -> cutoff_id = pb -> end_id + pb -> count;
-
-        /* just account for the repeated row */
-        rm -> cnt += pb -> count;
-        self -> end_id += pb -> count;
-    }
-}
-
-/* CloseRow
- *  discards uncommitted data
- *  update state
- */
-void CC WColumnCloseRow ( void *item, void *ignore )
-{
-    WColumn *self = item;
-    if ( self != NULL )
-    {
-        if ( self -> row_committed )
-            ++ self -> end_id;
-
-        self -> row_len = 0;
-        self -> row_written = false;
-        self -> row_committed = false;
-    }
-}
-
-/* BufferPage
- *  captures page range
- *
- *  "end_id" [ IN, CONST ] - half-closed id of buffered range end
- *  column should capture this information for creating page
- *  id range either on demand, or pre-prepared.
- *
- *  returns true if there was a memory error.
- */
-static
-bool WColumnSplitBuffer ( WColumn *self, int64_t end_id, size_t rm_idx )
-{
-    rc_t rc;
-    int64_t id;
-    VBlob *vblob;
-    bool splitting;
-    size_t i, data_cur;
-    uint64_t sum_elems;
-
-    const WColumnRowMap *rm = self -> rowmap . base;
-
-    uint64_t num_rows = rm [ rm_idx ] . start_id + rm [ rm_idx ] . cnt - self -> start_id;
-    assert ( rm [ 0 ] . start_id == self -> start_id );
-
-    /* adjust end_id [ TAKES CARE OF THEORETICAL ERROR CONDITION
-       NOT KNOWN TO EXIST ] and num_rows ( when splitting repeat ) */
-    id = end_id;
-    splitting = false;
-    if ( self -> start_id + num_rows <= id )
-        id = self -> start_id + num_rows;
-    else
-    {
-        num_rows = id - self -> start_id;
-        splitting = true;
-    }
-
-    /* release previous ( but unexpected ) cache if there */
-    if ( self -> page != NULL )
-    {
-        TRACK_BLOB ( VBlobRelease, self -> page );
-        VBlobRelease ( self -> page );
-        self -> page = NULL;
-    }
-
-    /* create new blob */
-    rc = VBlobNew ( & vblob,
-                    self -> start_id, id - 1,
-                    self -> dad . scol -> name -> name . addr );
-    TRACK_BLOB ( VBlobNew, vblob );
-    if ( rc != 0 )
-    {
-        PLOGERR ( klogErr,
-                  ( klogErr, rc, "Column: $(col) failed to allocate page", "col=%.*s"
-                    , self -> dad . scol -> name -> name . size
-                    , self -> dad . scol -> name -> name . addr )
-            );
-        return true;
-    }
-
-    /* create blob page map */
-    rc = PageMapNew ( & vblob -> pm, rm_idx + 1 ); /*** rm_idx tells many WColumnRowMap need to be added to PageMap ***/
-    if ( rc != 0 )
-    {
-        TRACK_BLOB ( VBlobRelease, vblob );
-        VBlobRelease ( vblob );
-
-        PLOGERR ( klogErr,
-                  ( klogErr, rc, "Column: $(col) failed to create page map", "col=%.*s"
-                    , self -> dad . scol -> name -> name . size
-                    , self -> dad . scol -> name -> name . addr )
-            );
-        return true;
-    }
-
-    /* write page map up to ( but not including ) last entry */
-    for ( sum_elems = 0, i = 0; i < rm_idx; ++ i )
-    {
-        sum_elems += rm [ i ] . len;
-        rc = PageMapAppendSomeRows ( vblob -> pm, rm [ i ] . len, rm [ i ] . cnt );
-        if ( rc != 0 )
-        {
-            TRACK_BLOB ( VBlobRelease, vblob );
-            VBlobRelease ( vblob );
-
-            PLOGERR ( klogErr,
-                      ( klogErr, rc, "Column: $(col) failed to write page map", "col=%.*s"
-                        , self -> dad . scol -> name -> name . size
-                        , self -> dad . scol -> name -> name . addr )
-                );
-            return true;
-        }
-    }
-
-    sum_elems += rm [ i ] . len;
-    rc = PageMapAppendSomeRows ( vblob -> pm, rm [ i ] . len, id - rm [ i ] . start_id );
-    if ( rc != 0 )
-    {
-        TRACK_BLOB ( VBlobRelease, vblob );
-        VBlobRelease ( vblob );
-
-        PLOGERR ( klogErr,
-                  ( klogErr, rc, "Column: $(col) failed to write page map", "col=%.*s"
-                    , self -> dad . scol -> name -> name . size
-                    , self -> dad . scol -> name -> name . addr )
-            );
-        return true;
-    }
-
-    /* determine current data buffer usage */
-    data_cur = ( size_t ) ( ( ( self -> bits_in_buffer + 7 ) >> 3 )
-        + SINGLE_PAGE_SIZE - 1 ) & ~ ( size_t ) ( SINGLE_PAGE_SIZE - 1 );
-
-    /* update peak history */
-    if ( self -> data_peak_hist [ self -> peak_hist_idx ] == self -> data_peak )
-    {
-        int j;
-        size_t data_peak = data_cur;
-
-        for ( j = ( self -> peak_hist_idx + 1 ) & 0xF;
-              j != self -> peak_hist_idx;
-              j = ( j + 1 ) & 0xF )
-        {
-            if ( self -> data_peak_hist [ j ] > data_peak )
-                data_peak = self -> data_peak_hist [ j ];
-        }
-
-        self -> data_peak = data_peak;
-    }
-    self -> data_peak_hist [ self -> peak_hist_idx ] = data_cur;
-    self -> peak_hist_idx = ( self -> peak_hist_idx + 1 ) & 0xF;
-    if ( data_cur > self -> data_peak )
-        self -> data_peak = data_cur;
-
-    /* hand data over to blob */
-    vblob -> data = self -> data;
-    vblob -> data . elem_bits = VTypedescSizeof ( & self -> dad . desc );
-    vblob -> data . elem_count = sum_elems;
-
-    /* handle residual data */
-    if ( splitting )
-        sum_elems -= rm [ rm_idx ] . len;
-    else
-        ++ rm_idx;
-
-    if ( rm_idx == self -> num_rows )
-    {
-        /* no residual data/rows */
-        memset ( & self -> data, 0, sizeof self -> data );
-        self -> bits_in_buffer = 0;
-        self -> num_rows = 0;
-        self -> start_id = self -> cutoff_id = end_id;
-    }
-    else
-    {
-        KDataBuffer data;
-        bitsz_t boff, to_copy;
-
-        /* allocate a new data buffer */
-        rc = KDataBufferMakeBytes ( & data, self -> data_peak );
-        if ( rc != 0 )
-        {
-            /* forget transfer of blob */
-            memset ( & vblob -> data, 0, sizeof vblob -> data );
-
-            TRACK_BLOB ( VBlobRelease, vblob );
-            VBlobRelease ( vblob );
-
-            PLOGERR ( klogErr,
-                      ( klogErr, rc, "Column: $(col) failed to split page", "col=%.*s"
-                        , self -> dad . scol -> name -> name . size
-                        , self -> dad . scol -> name -> name . addr )
-                );
-            return true;
-        }
-
-        /* copy data */
-        boff = ( rm_idx > 0 ) ?
-            sum_elems * vblob -> data . elem_bits : 0;
-        to_copy = self -> bits_in_buffer - boff;
-        if ( ( ( boff | to_copy ) & 7 ) != 0 )
-            bitcpy ( data . base, 0, self -> data . base, boff, to_copy );
-        else
-            memcpy ( data . base, & ( ( const uint8_t* ) self -> data . base ) [ boff >> 3 ], to_copy >> 3 );
-
-        self -> data = data;
-        self -> bits_in_buffer = to_copy;
-
-        /* copy row map */
-        memmove ( self -> rowmap . base, & rm [ rm_idx ], ( self -> num_rows -= rm_idx ) * sizeof * rm );
-
-        /* adjust starting id and repeat count if splitting single row */
-        if ( splitting )
-        {
-            WColumnRowMap *split = self -> rowmap . base;
-            split -> cnt = split -> start_id + split -> cnt - id;
-            split -> start_id = id;
-        }
-
-        self -> start_id = self -> cutoff_id = id;
-    }
-
-    self -> page = vblob;
-    self -> dflt_last = false;
-
-    return false;
-}
-
-static
-int WColumnRowMapCompare ( const WColumnRowMap *self, int64_t id )
-{
-    /* id is right-edge exclusive */
-    if ( self -> start_id >= id )
-        return -1;
-    return id > self -> start_id + self -> cnt;
-}
-
-bool CC WColumnBufferPage ( void *item, void *const_end_id )
-{
-    WColumn *self = item;
-    if ( self != NULL )
-    {
-        int64_t end_id = * ( const int64_t* ) const_end_id;
-
-        int diff;
-        const WColumnRowMap *rm = self -> rowmap . base;
-        size_t i, left, right = self -> num_rows;
-
-        /* find the entry mentioned */
-        if ( self -> num_rows == 0 )
-        {
-            PLOGMSG ( klogWarn,
-                      ( klogWarn, "Column: $(col) has no rows to buffer", "col=%.*s"
-                        , self -> dad . scol -> name -> name . size
-                        , self -> dad . scol -> name -> name . addr )
-                );
-            return true;
-        }
-
-        /* check last entry */
-        i = right - 1;
-        diff = WColumnRowMapCompare ( & rm [ i ], end_id );
-        if ( diff >= 0 )
-            return WColumnSplitBuffer ( self, end_id, i );
-
-        /* check that the id is within our range at all */
-        assert ( self -> start_id == rm [ 0 ] . start_id );
-        if ( end_id < self -> start_id )
-        {
-            PLOGMSG ( klogWarn,
-                      ( klogWarn, "Column: $(col) cutoff id $(id) is not within range"
-                        , "col=%.*s,id=%ld"
-                        , self -> dad . scol -> name -> name . size
-                        , self -> dad . scol -> name -> name . addr
-                        , end_id )
-                );
-            return true;
-        }
-
-        /* search rails are left ( inclusive ) at 0, right ( exclusive ) at num_rows */
-        left = 0;
-
-        /* perform arithmetic search for initial portion */
-        if ( right > 1000 )
-        {
-            double p = ( double ) ( end_id - rm [ left ] . start_id ) /
-                ( rm [ right - 1 ] . start_id + rm [ right - 1 ] . cnt - rm [ left ] . start_id );
-            assert ( p >= 0.0 && p <= 1.0 );
-
-            i = left + p * ( right - left );
-
-            diff = WColumnRowMapCompare ( & rm [ i ], end_id );
-            if ( diff == 0 )
-                return WColumnSplitBuffer ( self, end_id, i );
-            if ( diff < 0 )
-                right = i;
-            else
-                left = i + 1;
-
-            if ( left < right )
-            {
-                p = ( double ) ( end_id - rm [ left ] . start_id ) /
-                    ( rm [ right - 1 ] . start_id + rm [ right - 1 ] . cnt - rm [ left ] . start_id );
-                assert ( p >= 0.0 && p <= 1.0 );
-
-                i = left + p * ( right - left );
-
-                diff = WColumnRowMapCompare ( & rm [ i ], end_id );
-                if ( diff == 0 )
-                    return WColumnSplitBuffer ( self, end_id, i );
-                if ( diff < 0 )
-                    right = i;
-                else
-                    left = i + 1;
-            }
-        }
-
-        /* normal binary search */
-        while ( left < right )
-        {
-            i = ( left + right ) >> 1;
-
-            diff = WColumnRowMapCompare ( & rm [ i ], end_id );
-            if ( diff == 0 )
-                return WColumnSplitBuffer ( self, end_id, i );
-            if ( diff < 0 )
-                right = i;
-            else
-                left = i + 1;
-        }
-
-        PLOGMSG ( klogErr,
-                  ( klogErr, "Column: $(col) cutoff id $(id) is not within range"
-                    , "col=%.*s,id=%ld"
-                    , self -> dad . scol -> name -> name . size
-                    , self -> dad . scol -> name -> name . addr
-                    , end_id )
-            );
-    }
-
-    return true;
-}
-
-/* ReadBlob
- *  reads an input blob
- *  called as a result of commit page which reads the validation production
- */
-rc_t WColumnReadBlob ( WColumn *self, VBlob **vblob, int64_t id )
-{
-    if ( self -> page == NULL )
-        return RC ( rcVDB, rcColumn, rcReading, rcBuffer, rcNotFound );
-    if ( id < self -> page -> start_id || id > self -> page -> stop_id )
-        return RC ( rcVDB, rcColumn, rcReading, rcRow, rcNotFound );
-
-    * vblob = self -> page;
-    VBlobAddRef ( self -> page );
-    TRACK_BLOB ( VBlobAddRef, self -> page );
-
-    return 0;
-}
-
-/* DropPage
- *  drops any page buffers created
- */
-void CC WColumnDropPage ( void *item, void *ignore )
-{
-    WColumn *self = item;
-    if ( self != NULL && self -> page != NULL )
-    {
-        TRACK_BLOB ( VBlobRelease, self -> page );
-        VBlobRelease ( self -> page );
-        self -> page = NULL;
-    }
-}
diff --git a/libs/vdb/wcursor.c b/libs/vdb/wcursor.c
deleted file mode 100644
index 0455850..0000000
--- a/libs/vdb/wcursor.c
+++ /dev/null
@@ -1,1205 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#define TRACK_REFERENCES 0
-
-#include "cursor-priv.h"
-#include "dbmgr-priv.h"
-#include "linker-priv.h"
-#include "schema-priv.h"
-#include "table-priv.h"
-#include "column-priv.h"
-#include "phys-priv.h"
-#include "prod-priv.h"
-#include "prod-expr.h"
-#include "blob-priv.h"
-
-#include <vdb/cursor.h>
-#include <vdb/table.h>
-#include <kdb/meta.h>
-#include <kfs/dyload.h>
-#include <klib/symbol.h>
-#include <klib/log.h>
-#include <klib/debug.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#if VCURSOR_FLUSH_THREAD
-
-#include <kproc/lock.h>
-#include <kproc/cond.h>
-#include <kproc/thread.h>
-
-#if _DEBUGGING
-/* set to 1 to trigger behavior to simulate
-   an error within flush thread */
-#define FORCE_FLUSH_ERROR_EXIT 0
-#endif
-
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * VCursor
- *  a row cursor onto a VTable
- */
-
-/* forward
- *  to avoid reordering whole page
- */
-static
-rc_t VCursorFlushPageInt ( VCursor *self );
-
-
-/* Whack
- */
-rc_t VCursorWhack ( VCursor *self )
-{
-#if VCURSOR_FLUSH_THREAD
-    if ( self -> flush_thread != NULL )
-    {
-        rc_t rc = KLockAcquire ( self -> flush_lock );
-        if ( rc == 0 )
-        {
-            while ( self -> flush_state == vfBusy )
-            {
-                MTCURSOR_DBG (( "VCursorWhack: waiting for thread to process\n" ));
-                KConditionWait ( self -> flush_cond, self -> flush_lock );
-            }
-            self -> flush_state = vfExit;
-            KConditionSignal ( self -> flush_cond );
-            KLockUnlock ( self -> flush_lock );
-        }
-
-        MTCURSOR_DBG (( "VCursorWhack: waiting on thread to exit\n" ));
-        KThreadWait ( self -> flush_thread, NULL );
-    }
-
-    MTCURSOR_DBG (( "VCursorWhack: finishing\n" ));
-    KThreadRelease ( self -> flush_thread );
-    KConditionRelease ( self -> flush_cond );
-    KLockRelease ( self -> flush_lock );
-#endif
-    VCursorTerminatePagemapThread(self);
-    return VCursorDestroy ( self );
-}
-
-
-/* CreateCursor
- *  creates a cursor object onto table
- *  multiple read cursors are allowed
- *  only a single write cursor is allowed
- *
- *  "curs" [ OUT ] - return parameter for newly created cursor
- *
- *  "mode" [ IN ] - describes udate behavior
- *    kcmUpdate   : allow inserts or updates
- *    kcmReplace  : replace all existing rows with newly written rows
- *    kcmInsert   : allow only inserts, i.e. new rows
- */
-#if VCURSOR_FLUSH_THREAD
-static rc_t CC run_flush_thread ( const KThread *t, void *data );
-#endif
-
-rc_t VTableCreateCursorWriteInt ( VTable *self, VCursor **cursp, KCreateMode mode, bool create_thread )
-{
-    rc_t rc;
-
-    if ( cursp == NULL )
-        rc = RC ( rcVDB, rcCursor, rcCreating, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcTable, rcAccessing, rcSelf, rcNull );
-        else if ( self -> read_only )
-            rc = RC ( rcVDB, rcCursor, rcCreating, rcTable, rcReadonly );
-#if VCURSOR_WRITE_MODES_SUPPORTED
-#error "expecting kcmInsert mode only"
-#else
-        else if ( mode != kcmInsert )
-            rc = RC ( rcVDB, rcCursor, rcCreating, rcMode, rcUnsupported );
-#endif
-        else
-        {
-            VCursor *curs;
-
-#if LAZY_OPEN_COL_NODE
-            if ( self -> col_node == NULL )
-                KMetadataOpenNodeUpdate ( self -> meta, & self -> col_node, "col" );
-#endif
-            rc = VCursorMake ( & curs, self );
-            if ( rc == 0 )
-            {
-                rc = VCursorSupplementSchema ( curs );
-#if VCURSOR_FLUSH_THREAD
-                if ( rc == 0 && create_thread )
-                {
-                    rc = KLockMake ( & curs -> flush_lock );
-                    if ( rc == 0 )
-                        rc = KConditionMake ( & curs -> flush_cond );
-                    if ( rc == 0 )
-                        rc = KThreadMake ( & curs -> flush_thread, run_flush_thread, curs );
-                }
-#endif
-                if ( rc == 0 )
-                {
-                    * cursp = curs;
-                    return 0;
-                }
-
-                VCursorRelease ( curs );
-            }
-        }
-
-        * cursp = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VTableCreateCursorWrite ( VTable *self, VCursor **cursp, KCreateMode mode )
-{
-    return VTableCreateCursorWriteInt ( self, cursp, mode, true );
-}
-
-
-/* MakeColumn
- */
-rc_t VCursorMakeColumn ( VCursor *self, VColumn **col, const SColumn *scol, Vector *cx_bind )
-{
-    VTable *vtbl;
-
-    if ( self -> read_only )
-        return VColumnMake ( col, self -> schema, scol );
-
-    vtbl = self -> tbl;
-    return WColumnMake ( col, self -> schema, scol, vtbl -> stbl -> limit, vtbl -> mgr, cx_bind );
-}
-
-
-/* PostOpenAdd
- *  handle opening of a column after the cursor is opened
- */
-rc_t VCursorPostOpenAdd ( VCursor *self, VColumn *col )
-{
-    rc_t rc = VCursorPostOpenAddRead ( self, col );
-
-    if ( ! self -> read_only && rc == 0 && self -> state == vcRowOpen )
-    {
-        int64_t row_id = self -> row_id;
-        WColumnOpenRow ( col, & row_id );
-    }
-
-    return rc;
-}
-
-/* Open
- *  open cursor, resolving schema
- *  for the set of opened columns
- *
- *  NB - there is no corresponding "Close"
- *  use "Release" instead.
- */
-static
-rc_t VProdResolveAddShallowTriggers ( const VProdResolve *self, const STable *stbl )
-{
-    rc_t rc;
-    VCursor *curs;
-    uint32_t i = VectorStart ( & stbl -> prod );
-    uint32_t end = i + VectorLength ( & stbl -> prod );
-
-    for ( rc = 0, curs = self -> curs; ( rc == 0 || self -> ignore_column_errors ) && i < end; ++ i )
-    {
-        SProduction *sprod = VectorGet ( & stbl -> prod, i );
-        if ( sprod != NULL && sprod -> trigger )
-        {
-            VProduction *prod = NULL;
-            rc = VProdResolveSProduction ( self, & prod, sprod );
-            if ( rc == 0 && prod != NULL )
-                rc = VectorAppend ( & curs -> trig, NULL, prod );
-        }
-    }
-
-    if ( self -> ignore_column_errors )
-        return 0;
-
-    return rc;
-}
-
-static
-rc_t VProdResolveAddTriggers ( const VProdResolve *self, const STable *stbl )
-{
-    uint32_t i = VectorStart ( & stbl -> overrides );
-    uint32_t end = VectorLength ( & stbl -> overrides );
-    for ( end += i; i < end; ++ i )
-    {
-        const STable *dad = STableFindOrdAncestor ( stbl, i );
-        rc_t rc = VProdResolveAddShallowTriggers ( self, dad );
-        if ( rc != 0 )
-            return rc;
-    }
-    return VProdResolveAddShallowTriggers ( self, stbl );
-}
-
-LIB_EXPORT rc_t CC VCursorOpen ( const VCursor *cself )
-{
-    rc_t rc;
-    VCursor *self = ( VCursor* ) cself;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcCursor, rcOpening, rcSelf, rcNull );
-    else
-    {
-        VLinker *ld = self -> tbl -> linker;
-
-        KDlset *libs;
-        rc = VLinkerOpen ( ld, & libs );
-        if ( rc == 0 )
-        {
-            rc = VCursorOpenRead ( self, libs );
-            if ( rc == 0 )
-            {
-                if ( ! self -> read_only )
-                {
-                    Vector cx_bind;
-                    VProdResolve pr;
-                    pr . schema = self -> schema;
-                    pr . ld = ld;
-                    pr . libs = libs;
-                    pr . stbl = self -> stbl;
-                    pr . curs = self;
-                    pr . cache = & self -> prod;
-                    pr . owned = & self -> owned;
-                    pr . cx_bind = & cx_bind;
-                    pr . chain = chainEncoding;
-                    pr . blobbing = false;
-                    pr . ignore_column_errors = false;
-                    pr . discover_writable_columns = false;
-
-                    VectorInit ( & cx_bind, 1, self -> schema -> num_indirect );
-
-                    if ( ! self -> suspend_triggers )
-                        rc = VProdResolveAddTriggers ( & pr, self -> stbl );
-
-                    VectorWhack ( & cx_bind, NULL, NULL );
-                }
-
-                if ( rc == 0 )
-                {
-                    /* TBD - warn if any input columns are unreferenced by schema */
-
-                    int64_t first;
-                    uint64_t count;
-                    
-                    rc = VCursorIdRange ( self, 0, & first, & count );
-                    if ( rc != 0 )
-                    {
-                        if ( GetRCState ( rc ) == rcEmpty )
-                        {
-                            /* writable cursors are expected to be empty */
-                            if ( ! self -> read_only ||
-                                 /* permit empty open when run from sradb */
-                                 ( GetRCObject ( rc ) == rcRange &&
-                                   self -> permit_add_column &&
-                                   VectorLength ( & self -> row ) == 0 ) )
-                            {
-                                rc = 0;
-                            }
-                        }
-                    }
-                    else if ( count != 0 )
-                    {
-                        if ( self -> read_only )
-                        {
-                            /* set initial row id to starting row */
-                            self -> start_id = self -> end_id = self -> row_id = first;
-                        }
-                        else
-                        {
-                            /* set initial row id to append */
-                            self -> start_id = self -> end_id = self -> row_id = first + count;
-                        }
-                    }
-                }
-
-                if ( rc != 0 )
-                    self -> state = vcFailed;
-            }
-
-            KDlsetRelease ( libs );
-        }
-    }
-
-    return rc;
-}
-
-
-/* ListWritableColumns
- *  walks list of SPhysicals and trigger SProductions
- *  attempts to resolve all write rules
- *  records any SColumn that can be reached
- *  populates BTree with VColumnRef objects
- */
-struct resolve_phys_data
-{
-    VProdResolve pr;
-    const KNamelist *seed;
-    uint32_t count;
-};
-
-static
-void CC resolve_writable_sphys ( void *item, void *data )
-{
-    struct resolve_phys_data *pb = data;
-    const SPhysMember *smbr = ( const void* ) item;
-    VProduction *out = NULL;
-
-    if ( pb -> seed == NULL )
-        VProdResolveSPhysMember ( & pb -> pr, & out, smbr );
-    else
-    {
-        uint32_t i;
-        const KSymbol *sym = smbr -> name;
-        const char *sname = sym -> name . addr;
-        size_t ssize = sym -> name . size;
-        if ( sname [ 0 ] == '.' )
-        {
-            ++ sname;
-            -- ssize;
-        }
-
-        /* TBD - this is not too speedy, but it is
-           very low frequency in all known cases */
-        for ( i = 0; i < pb -> count; ++ i )
-        {
-            const char *name;
-            rc_t rc = KNamelistGet ( pb -> seed, i, & name );
-            if ( rc == 0 )
-            {
-                if ( strlen ( name ) == ssize && memcmp ( sname, name, ssize ) == 0 )
-                {
-                    VProdResolveSPhysMember ( & pb -> pr, & out, smbr );
-                    break;
-                }
-            }
-        }
-    }
-}
-
-static
-void VProdResolveWritableColumns ( struct resolve_phys_data *pb, bool suspend_triggers )
-{
-    const STable *dad, *stbl = pb -> pr . stbl;
-
-    /* walk table schema looking for parents */
-    uint32_t i = VectorStart ( & stbl -> overrides );
-    uint32_t end = VectorLength ( & stbl -> overrides );
-    for ( end += i; i < end; ++ i )
-    {
-        dad = STableFindOrdAncestor ( stbl, i );
-        VectorForEach ( & dad -> phys, false, resolve_writable_sphys, pb );
-    }
-
-    /* walk current table */
-    VectorForEach ( & stbl -> phys, false, resolve_writable_sphys, pb );
-
-    /* add triggers */
-    if ( !suspend_triggers && pb -> seed == NULL )
-    {
-        pb -> pr . chain = chainUncommitted;
-        VProdResolveAddTriggers ( & pb -> pr, stbl );
-    }
-}
-
-rc_t VCursorListSeededWritableColumns ( VCursor *self, BSTree *columns, const KNamelist *seed )
-{
-    rc_t rc;
-    KDlset *libs;
-
-    Vector cx_bind;
-    struct resolve_phys_data pb;
-    pb . pr . schema = self -> schema;
-    pb . pr . ld = self -> tbl -> linker;
-    pb . pr . stbl = self -> stbl;
-    pb . pr . curs = self;
-    pb . pr . cache = & self -> prod;
-    pb . pr . owned = & self -> owned;
-    pb . pr . cx_bind = & cx_bind;
-    pb . pr . chain = chainEncoding;
-    pb . pr . blobbing = false;
-    pb . pr . ignore_column_errors = true;
-    pb . pr . discover_writable_columns = true;
-    pb . seed = seed;
-
-    if ( seed != NULL )
-    {
-        rc = KNamelistCount ( seed, & pb . count );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    VectorInit ( & cx_bind, 1, self -> schema -> num_indirect );
-
-    /* open the dynamic linker libraries */
-    rc = VLinkerOpen ( pb . pr . ld, & libs );
-    if ( rc == 0 )
-    {
-        pb . pr . libs = libs;
-        VProdResolveWritableColumns ( & pb , self -> suspend_triggers );
-
-        VectorWhack ( & cx_bind, NULL, NULL );
-        KDlsetRelease ( libs );
-
-        if ( rc == 0 )
-        {
-            /* add columns to list */
-            uint32_t idx = VectorStart ( & self -> row );
-            uint32_t end = VectorLength ( & self -> row );
-
-            for ( end += idx; idx < end; ++idx )
-            {
-                const VColumn* vcol = ( const VColumn* ) VectorGet ( & self -> row, idx );
-                if ( vcol != NULL )
-                {
-                    VColumnRef *cref;
-                    rc = VColumnRefMake ( & cref, self -> schema, vcol -> scol );
-                    if ( rc != 0 )
-                        break;
-
-                    rc = BSTreeInsert ( columns, & cref -> n, VColumnRefSort );
-                    assert ( rc == 0 );
-                }
-            }
-        }
-    }
-
-    return rc;
-}
-
-rc_t VCursorListWritableColumns ( VCursor *self, BSTree *columns )
-{
-    return VCursorListSeededWritableColumns ( self, columns, NULL );
-}
-
-/* SetRowId
- *  seek to given row id
- *
- *  "row_id" [ IN ] - row id to select
- */
-LIB_EXPORT rc_t CC VCursorSetRowId ( const VCursor *cself, int64_t row_id )
-{
-    rc_t rc;
-    VCursor *self = ( VCursor* ) cself;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcCursor, rcPositioning, rcSelf, rcNull );
-    else if ( self -> state == vcFailed )
-        rc = RC ( rcVDB, rcCursor, rcPositioning, rcCursor, rcInvalid );
-    else if ( self -> state > vcReady || self -> start_id < self -> end_id )
-        rc = RC ( rcVDB, rcCursor, rcPositioning, rcCursor, rcBusy );
-    else if ( self -> read_only )
-        rc = VCursorSetRowIdRead ( self, row_id );
-    else
-    {
-        /* the test of start/end range above tells us that
-           no rows are buffered, so the row id can be simply set */
-        self -> start_id = self -> end_id = self -> row_id = row_id;
-        rc = 0;
-    }
-
-    return rc;
-}
-
-
-/* OpenRow
- *  open currently closed row indicated by row id
- */
-LIB_EXPORT rc_t CC VCursorOpenRow ( const VCursor *cself )
-{
-    rc_t rc;
-    VCursor *self = ( VCursor* ) cself;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcCursor, rcOpening, rcSelf, rcNull );
-    else if ( self -> state != vcReady )
-    {
-        switch ( self -> state )
-        {
-        case vcConstruct:
-            rc = RC ( rcVDB, rcCursor, rcOpening, rcRow, rcIncomplete );
-            break;
-        case vcFailed:
-            rc = RC ( rcVDB, rcCursor, rcOpening, rcCursor, rcInvalid );
-            break;
-        case vcRowOpen:
-            rc = 0;
-            break;
-        default:
-            rc = RC ( rcVDB, rcCursor, rcOpening, rcRow, rcBusy );
-        }
-    }
-    else if ( self -> read_only )
-        rc = VCursorOpenRowRead ( self );
-    else
-    {
-        /* validate that all columns have the same starting row_id */
-        int64_t row_id = self -> row_id;
-        VectorForEach ( & self -> row, false, WColumnOpenRow, & row_id );
-        assert ( row_id == self -> row_id );
-        self -> state = vcRowOpen;
-        rc = 0;
-    }
-
-    return rc;
-}
-
-/* CommitRow
- *  commit row after writing
- *  prevents further writes
- */
-LIB_EXPORT rc_t CC VCursorCommitRow ( VCursor *self )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcCursor, rcCommitting, rcSelf, rcNull );
-    else if ( self -> read_only )
-        rc = RC ( rcVDB, rcCursor, rcCommitting, rcCursor, rcReadonly );
-    else if ( self -> state == vcFailed )
-        rc = RC ( rcVDB, rcCursor, rcCommitting, rcCursor, rcInvalid );
-    else if ( self -> state < vcRowOpen )
-        rc = RC ( rcVDB, rcCursor, rcCommitting, rcRow, rcNotOpen );
-    else if ( self -> state >= vcRowCommitted )
-        rc = 0;
-    else
-    {
-        self -> permit_add_column = self -> permit_post_open_add;
-
-        /* tell columns to slam in any default values */
-        rc = 0;
-        if ( VectorDoUntil ( & self -> row, false, WColumnRowDefaults, & rc ) )
-            return rc;
-
-        /* account for row just written */
-        self -> end_id = self -> row_id + 1;
-
-        /* tell columns to commit the row, and allow
-           each to return an earlier cutoff id ( half-closed ) */
-        if ( VectorDoUntil ( & self -> row, false, WColumnCommitRow, & self -> end_id ) )
-        {
-            self -> state = vcFailed;
-            return RC ( rcVDB, rcCursor, rcCommitting, rcMemory, rcExhausted );
-        }
-
-        /* returned result should never be <= start id */
-        assert ( self -> end_id > self -> start_id );
-
-        /* if returned result dips down into the range of buffered rows
-           then one or more columns has requested an automatic page commit */
-        self -> state = ( self -> end_id <= self -> row_id ) ? vcPageCommit : vcRowCommitted;
-    }
-
-    return rc;
-}
-
-/* RepeatRow
- *  repeats the current row by the count provided
- *  row must have been committed
- *
- *  AVAILABILITY: version 2.6
- *
- *  "count" [ IN ] - the number of times to repeat
- *  the current row.
- */
-LIB_EXPORT rc_t CC VCursorRepeatRow ( VCursor *self, uint64_t count )
-{
-    rc_t rc = 0;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcCursor, rcUpdating, rcSelf, rcNull );
-    else if ( self -> read_only )
-        rc = RC ( rcVDB, rcCursor, rcUpdating, rcCursor, rcReadonly );
-    else if ( self -> state == vcFailed )
-        rc = RC ( rcVDB, rcCursor, rcUpdating, rcCursor, rcInvalid );
-    else if ( self -> state < vcRowOpen )
-        rc = RC ( rcVDB, rcCursor, rcUpdating, rcRow, rcNotOpen );
-    else if ( self -> state < vcRowCommitted )
-        rc = RC ( rcVDB, rcCursor, rcUpdating, rcRow, rcInvalid );
-    else if ( count != 0 )
-    {
-        WColumnRepeatRowData pb;
-        pb . end_id = self -> row_id;
-        pb . count = count;
-
-        /* tell columns to commit the row, and allow
-           each to return an earlier cutoff id ( half-closed ) */
-        VectorForEach ( & self -> row, false, WColumnRepeatRow, & pb );
-
-        /* extend the current row-id */
-        if ( self -> end_id < self -> row_id )
-            self -> row_id += count;
-        else
-        {
-            self -> row_id += count;
-            self -> end_id += count;
-        }
-    }
-
-    return rc;
-}
-
-/* CloseRow
- *  balances OpenRow message
- *  if there are uncommitted modifications,
- *  discard all changes. otherwise,
- *  advance to next row
- */
-LIB_EXPORT rc_t CC VCursorCloseRow ( const VCursor *cself )
-{
-    rc_t rc = 0;        /* needed in case FlushPage isn't called */
-    VCursor *self = ( VCursor* ) cself;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcCursor, rcClosing, rcSelf, rcNull );
-    else if ( self -> state == vcFailed )
-        rc = RC ( rcVDB, rcCursor, rcClosing, rcCursor, rcInvalid );
-    else if ( self -> state < vcRowOpen )
-        rc = 0;
-    else if ( self -> read_only )
-        rc = VCursorCloseRowRead ( self );
-    else
-    {
-        /* tell each of the columns that no further data may be written
-           and to abandon any uncommitted writes */
-        VectorForEach ( & self -> row, false, WColumnCloseRow, NULL );
-
-        /* if the row was committed... */
-        if ( self -> state >= vcRowCommitted )
-        {
-            /* close off the page if so requested */
-            if ( self -> state == vcPageCommit )
-            {
-                rc = VCursorFlushPageInt ( self );
-                if ( rc )
-                {
-                    self -> state = vcFailed;
-                    return rc;
-                }
-            }
-
-            /* advance to next id */
-            ++ self -> row_id;
-        }
-
-        self -> state = vcReady;
-        rc = 0;
-    }
-
-    return rc;
-}
-
-
-/* Default
- *  give a default row value for column
- *
- *  "col_idx" [ IN ] - index of column to be read, returned by "AddColumn"
- *
- *  "elem_bits" [ IN ] - stated element size in bits, required
- *  to be compatible with the actual element size
- *
- *  "buffer" [ IN ] and "boff" [ IN ] - compound pointer and offset
- *  to start of default row data where "boff" is in BITS
- *
- *  "row_len" [ IN ] - the number of elements in default row
- */
-LIB_EXPORT rc_t CC VCursorDefault ( VCursor *self, uint32_t col_idx,
-    bitsz_t elem_bits, const void *buffer, bitsz_t boff, uint64_t row_len )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcCursor, rcWriting, rcSelf, rcNull );
-    else if ( buffer == NULL && ( boff != 0 || row_len != 0 ) )
-        rc = RC ( rcVDB, rcCursor, rcWriting, rcParam, rcNull );
-    else if ( self -> read_only )
-        rc = RC ( rcVDB, rcCursor, rcWriting, rcCursor, rcReadonly );
-    else if ( elem_bits == 0 )
-        rc = RC ( rcVDB, rcCursor, rcWriting, rcParam, rcInvalid );
-    else
-    {
-        VColumn *col = VectorGet ( & self -> row, col_idx );
-        if ( col == NULL )
-            rc = RC ( rcVDB, rcCursor, rcWriting, rcColumn, rcInvalid );
-        else
-            rc = WColumnSetDefault ( col, elem_bits, buffer, boff, row_len );
-    }
-
-    return rc;
-}
-
-
-/* Write
- *  append bit-aligned column data to row
- *
- *  "col_idx" [ IN ] - index of column to be read, returned by "AddColumn"
- *
- *  "elem_bits" [ IN ] - stated element size in bits, required
- *  to be compatible with the actual element size
- *
- *  "buffer" [ IN ] and "boff" [ IN ] - compound pointer and offset
- *  to start of default row data where "boff" is in BITS
- *
- *  "count" [ IN ] - the number of elements to append
- */
-LIB_EXPORT rc_t CC VCursorWrite ( VCursor *self, uint32_t col_idx,
-    bitsz_t elem_bits, const void *buffer, bitsz_t boff, uint64_t count )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcCursor, rcWriting, rcSelf, rcNull );
-    else if ( buffer == NULL && count != 0 )
-        rc = RC ( rcVDB, rcCursor, rcWriting, rcParam, rcNull );
-    else if ( self -> read_only )
-        rc = RC ( rcVDB, rcCursor, rcWriting, rcCursor, rcReadonly );
-    else if ( self -> state != vcRowOpen )
-    {
-        switch ( self -> state )
-        {
-        case vcConstruct:
-            rc = RC ( rcVDB, rcCursor, rcAccessing, rcCursor, rcNotOpen );
-            break;
-        case vcFailed:
-            rc = RC ( rcVDB, rcCursor, rcAccessing, rcCursor, rcInvalid );
-            break;
-        case vcReady:
-            rc = RC ( rcVDB, rcCursor, rcAccessing, rcRow, rcNotOpen );
-            break;
-        default:
-            rc = RC ( rcVDB, rcCursor, rcAccessing, rcRow, rcLocked );
-        }
-    }
-    else
-    {
-        VColumn *col = VectorGet ( & self -> row, col_idx );
-        if ( col == NULL )
-            rc = RC ( rcVDB, rcCursor, rcWriting, rcColumn, rcInvalid );
-        else
-            rc = WColumnWrite ( col, elem_bits, buffer, boff, count );
-    }
-
-    return rc;
-}
-
-
-/* FlushPage
- *  forces flush of all buffered page data
- *  fails if row is open
- *
- *  pages are normally auto-committed based upon
- *  size and column affinity
- */
-typedef struct run_trigger_prod_data run_trigger_prod_data;
-struct run_trigger_prod_data
-{
-    int64_t  id;
-    uint32_t cnt;
-    rc_t rc;
-};
-
-static
-bool CC run_trigger_prods ( void *item, void *data )
-{
-    run_trigger_prod_data *pb = data;
-    VProduction *prod = item;
-
-    VBlob *blob;
-    pb -> rc = VProductionReadBlob ( prod, & blob, pb -> id , pb -> cnt, NULL);
-    if ( pb -> rc != 0 )
-        return true;
-    if ( blob != NULL )
-        TRACK_BLOB ( VBlobRelease, blob );
-    ( void ) VBlobRelease ( blob );
-    return false;
-}
-
-#if VCURSOR_FLUSH_THREAD
-static
-rc_t CC run_flush_thread ( const KThread *t, void *data )
-{
-    rc_t rc;
-    VCursor *self = data;
-
-    /* acquire lock */
-    MTCURSOR_DBG (( "run_flush_thread: acquiring lock\n" ));
-    rc = KLockAcquire ( self -> flush_lock );
-    if ( rc == 0 )
-    {
-        do
-        {
-            bool failed;
-            run_trigger_prod_data pb;
-
-            /* wait for data */
-            if ( self -> flush_state == vfReady )
-            {
-                MTCURSOR_DBG (( "run_flush_thread: waiting for input\n" ));
-                rc = KConditionWait ( self -> flush_cond, self -> flush_lock );
-                if ( rc != 0 )
-                    break;
-            }
-
-            /* bail unless state is busy */
-            if ( self -> flush_state != vfBusy )
-            {
-                MTCURSOR_DBG (( "run_flush_thread: exiting\n" ));
-                break;
-            }
-
-            /* prepare param block */
-            pb . id = self -> flush_id;
-            pb . cnt = self -> flush_cnt;
-            pb . rc = 0;
-
-            MTCURSOR_DBG (( "run_flush_thread: unlocking and running\n" ));
-            KLockUnlock ( self -> flush_lock );
-
-            /* run productions from trigger roots */
-            failed = VectorDoUntil ( & self -> trig, false, run_trigger_prods, & pb );
-
-            /* drop page buffers */
-            MTCURSOR_DBG (( "run_flush_thread: dropping page buffers\n" ));
-            VectorForEach ( & self -> row, false, WColumnDropPage, NULL );
-
-            /* reacquire lock */
-            MTCURSOR_DBG (( "run_flush_thread: re-acquiring lock" ));
-            rc = KLockAcquire ( self -> flush_lock );
-            if ( rc != 0 )
-            {
-                self -> flush_state = vfBgErr;
-                LOGERR ( klogSys, rc, "run_flush_thread: re-acquiring lock failed - exit" );
-                return rc;
-            }
-
-#if FORCE_FLUSH_ERROR_EXIT
-            if ( ! failed )
-            {
-                pb . rc = RC ( rcVDB, rcCursor, rcFlushing, rcThread, rcCanceled );
-                failed = true;
-            }
-#endif
-            /* get out on failure */
-            if ( failed )
-            {
-                self -> flush_state = vfBgErr;
-                LOGERR ( klogInt, pb . rc, "run_flush_thread: run_trigger_prods failed - exit" );
-                KConditionSignal ( self -> flush_cond );
-                rc = pb . rc;
-            }
-
-            /* no longer busy */
-            else if ( self -> flush_state == vfBusy )
-            {
-                /* signal waiter */
-                self -> flush_state = vfReady;
-                MTCURSOR_DBG (( "run_flush_thread: signaling ready\n" ));
-                rc = KConditionSignal ( self -> flush_cond );
-                if ( rc != 0 )
-                    LOGERR ( klogSys, rc, "run_flush_thread: failed to signal foreground thread - exit" );
-            }
-        }
-        while ( rc == 0 );
-
-        MTCURSOR_DBG (( "run_flush_thread: unlocking\n" ));
-        KLockUnlock ( self -> flush_lock );
-    }
-
-    MTCURSOR_DBG (( "run_flush_thread: exit\n" ));
-    return rc;
-}
-#endif
-
-static
-rc_t VCursorFlushPageInt ( VCursor *self )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcCursor, rcFlushing, rcSelf, rcNull );
-    else if ( self -> read_only )
-        rc = RC ( rcVDB, rcCursor, rcFlushing, rcCursor, rcReadonly );
-    else
-    {
-        int64_t end_id;
-#if ! VCURSOR_FLUSH_THREAD
-        run_trigger_prod_data pb;
-#endif
-        switch ( self -> state )
-        {
-        case vcConstruct:
-            rc = RC ( rcVDB, rcCursor, rcFlushing, rcCursor, rcNotOpen );
-            break;
-        case vcFailed:
-            rc = RC ( rcVDB, rcCursor, rcFlushing, rcCursor, rcInvalid );
-            break;
-        case vcRowOpen:
-            rc = RC ( rcVDB, rcCursor, rcFlushing, rcCursor, rcBusy );
-            break;
-        default:
-
-            /* ignore request if there is no page to commit */
-            if ( self -> start_id == self -> end_id )
-            {
-                /* the cursor should be in unwritten state,
-                   where the row_id can be reset but drags
-                   along the other markers. */
-                assert ( self -> end_id == self -> row_id );
-                return 0;
-            }
-
-#if VCURSOR_FLUSH_THREAD
-            MTCURSOR_DBG (( "VCursorFlushPageInt: going to acquire lock\n" ));
-            /* get lock */
-            rc = KLockAcquire ( self -> flush_lock );
-            if ( rc != 0 )
-                return rc;
-
-            MTCURSOR_DBG (( "VCursorFlushPageInt: have lock\n" ));
-
-            /* make sure that background thread is ready */
-            while ( self -> flush_state == vfBusy )
-            {
-                MTCURSOR_DBG (( "VCursorFlushPageInt: waiting for background thread\n" ));
-                rc = KConditionWait ( self -> flush_cond, self -> flush_lock );
-                if ( rc != 0 )
-                {
-                    LOGERR ( klogSys, rc, "VCursorFlushPageInt: wait failed - exiting" );
-                    KLockUnlock ( self -> flush_lock );
-                    return rc;
-                }
-            }
-
-            if ( self -> flush_state != vfReady )
-            {
-                if ( self -> flush_state != vfBgErr )
-                    rc = RC ( rcVDB, rcCursor, rcFlushing, rcCursor, rcInconsistent );
-                else
-                {
-                    rc_t rc2;
-                    MTCURSOR_DBG (( "VCursorFlushPageInt: waiting on thread to exit\n" ));
-                    rc = KThreadWait ( self -> flush_thread, & rc2 );
-                    if ( rc == 0 )
-                    {
-                        rc = rc2;
-                        MTCURSOR_DBG (( "VCursorFlushPageInt: releasing thread\n" ));
-                        KThreadRelease ( self -> flush_thread );
-                        self -> flush_thread = NULL;
-                    }
-                }
-
-                PLOGERR ( klogInt, (klogInt, rc, "VCursorFlushPageInt: not in ready state[$(state)] - exiting","state=%hu",self -> flush_state ));
-                KLockUnlock ( self -> flush_lock );
-                return rc;
-            }
-
-            MTCURSOR_DBG (( "VCursorFlushPageInt: running buffer page\n" ));
-#endif
-
-            /* first, tell all columns to bundle up their pages into buffers */
-            end_id = self -> end_id;
-            rc = RC ( rcVDB, rcCursor, rcFlushing, rcMemory, rcExhausted );
-            if ( VectorDoUntil ( & self -> row, false, WColumnBufferPage, & end_id ) )
-            {
-                VectorForEach ( & self -> row, false, WColumnDropPage, NULL );
-                self -> flush_state = vfFgErr;
-            }
-            else
-            {
-                /* supposed to be constant */
-                assert ( end_id == self -> end_id );
-#if VCURSOR_FLUSH_THREAD
-                MTCURSOR_DBG (( "VCursorFlushPageInt: pages buffered - capturing id and count\n" ));
-                self -> flush_id = self -> start_id;
-                self -> flush_cnt = self -> end_id - self -> start_id;
-
-                self -> start_id = self -> end_id;
-                self -> end_id = self -> row_id + 1;
-                self -> state = vcReady;
-
-                MTCURSOR_DBG (( "VCursorFlushPageInt: state set to busy - signaling bg thread\n" ));
-                self -> flush_state = vfBusy;
-                rc = KConditionSignal ( self -> flush_cond );
-                if ( rc != 0 )
-                    LOGERR ( klogSys, rc, "VCursorFlushPageInt: condition returned error on signal" );
-#else
-                /* run all validation and trigger productions */
-                pb . id = self -> start_id;
-                pb . cnt = self -> end_id - self -> start_id;
-                pb . rc = 0;
-                if ( ! VectorDoUntil ( & self -> trig, false, run_trigger_prods, & pb ) )
-                {
-                    self -> start_id = self -> end_id;
-                    self -> end_id = self -> row_id + 1;
-                    self -> state = vcReady;
-                }
-
-                rc = pb . rc;
-
-                /* drop page buffers */
-                VectorForEach ( & self -> row, false, WColumnDropPage, NULL );
-#endif
-            }
-
-#if VCURSOR_FLUSH_THREAD
-            MTCURSOR_DBG (( "VCursorFlushPageInt: unlocking\n" ));
-            KLockUnlock ( self -> flush_lock );
-#endif
-        }
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VCursorFlushPage ( VCursor *self )
-{
-    rc_t rc = VCursorFlushPageInt ( self );
-    if ( rc == 0 )
-    {
-#if VCURSOR_FLUSH_THREAD
-        MTCURSOR_DBG (( "VCursorFlushPage: going to acquire lock\n" ));
-        /* get lock */
-        rc = KLockAcquire ( self -> flush_lock );
-        if ( rc != 0 )
-            return rc;
-
-        MTCURSOR_DBG (( "VCursorFlushPage: have lock\n" ));
-
-        /* wait until background thread has finished */
-        while ( self -> flush_state == vfBusy )
-        {
-            MTCURSOR_DBG (( "VCursorFlushPage: waiting for background thread\n" ));
-            rc = KConditionWait ( self -> flush_cond, self -> flush_lock );
-            if ( rc != 0 )
-            {
-                LOGERR ( klogSys, rc, "VCursorFlushPage: wait failed - exiting" );
-                KLockUnlock ( self -> flush_lock );
-                return rc;
-            }
-        }
-
-        /* what was the proper rc */
-        if ( self -> flush_state != vfReady )
-        {
-            if ( self -> flush_state != vfBgErr )
-                rc = RC ( rcVDB, rcCursor, rcFlushing, rcCursor, rcInconsistent );
-            else
-            {
-                rc_t rc2;
-                MTCURSOR_DBG (( "VCursorFlushPage: waiting on thread to exit\n" ));
-                rc = KThreadWait ( self -> flush_thread, & rc2 );
-                if ( rc == 0 )
-                {
-                    rc = rc2;
-                    MTCURSOR_DBG (( "VCursorFlushPage: releasing thread\n" ));
-                    KThreadRelease ( self -> flush_thread );
-                    self -> flush_thread = NULL;
-                }
-            }
-
-            PLOGERR ( klogInt, (klogInt, rc, "VCursorFlushPage: not in ready state[$(state)] - exiting",
-                                "state=%hu", self -> flush_state ));
-
-            KLockUnlock ( self -> flush_lock );
-            return rc;
-        }
-        KLockUnlock ( self -> flush_lock );
-#endif
-        assert ( self -> row_id == self -> start_id );
-        self -> end_id = self -> row_id;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VCursorCommit ( VCursor *self )
-{
-    rc_t rc = VCursorFlushPage ( self );
-    if ( rc == 0 )
-    {
-        VTable *tbl = self -> tbl;
-        if ( tbl -> read_col_cache_valid )
-        {
-            tbl -> read_col_cache_valid = false;
-            BSTreeWhack ( & tbl -> read_col_cache, VColumnRefWhack, NULL );
-        }
-        if ( tbl -> write_col_cache_valid )
-        {
-            tbl -> write_col_cache_valid = false;
-            BSTreeWhack ( & tbl -> write_col_cache, VColumnRefWhack, NULL );
-        }
-    }
-    return rc;
-}
-
-
-/* OpenParent
- *  duplicate reference to parent table
- *  NB - returned reference must be released
- */
-LIB_EXPORT rc_t CC VCursorOpenParentUpdate ( VCursor *self, VTable **tbl )
-{
-    rc_t rc;
-
-    if ( tbl == NULL )
-        rc = RC ( rcVDB, rcCursor, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcCursor, rcAccessing, rcSelf, rcNull );
-        else if ( self -> tbl -> read_only )
-            rc = RC ( rcVDB, rcCursor, rcAccessing, rcTable, rcReadonly );
-        else
-        {
-            rc = VTableAddRef ( self -> tbl );
-            if ( rc == 0 )
-            {
-                * tbl = self -> tbl;
-                return 0;
-            }
-        }
-
-        * tbl = NULL;
-    }
-
-    return rc;
-}
diff --git a/libs/vdb/wdatabase.c b/libs/vdb/wdatabase.c
deleted file mode 100644
index f2df4cb..0000000
--- a/libs/vdb/wdatabase.c
+++ /dev/null
@@ -1,661 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#include "database-priv.h"
-#include "dbmgr-priv.h"
-#include "schema-priv.h"
-#include "schema-parse.h"
-#include "linker-priv.h"
-
-#include <kdb/kdb-priv.h>
-#include <vdb/manager.h>
-#include <vdb/database.h>
-#include <kdb/manager.h>
-#include <kdb/database.h>
-#include <kdb/meta.h>
-#include <klib/debug.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * VDatabase
- *  opaque connection to a database within file system
- */
-
-
-/* StoreSchema
- */
-rc_t VDatabaseStoreSchema ( VDatabase *self )
-{
-    /* open schema node */
-    KMDataNode *node;
-    rc_t rc = KMetadataOpenNodeUpdate ( self -> meta, & node, "schema" );
-    if ( rc == 0 )
-    {
-        size_t num_writ;
-        char expr [ 256 ];
-        rc = VSchemaToText ( self -> schema, expr, sizeof expr - 1, & num_writ,
-            "%N%V", self -> sdb -> name, self -> sdb -> version );
-        if ( rc != 0 )
-            LOGERR ( klogInt, rc, "failed to determine database schema" );
-        else
-        {
-            expr [ num_writ ] = 0;
-            rc = KMDataNodeWriteAttr ( node, "name", expr );
-            if ( rc != 0 )
-                PLOGERR (klogInt, ( klogInt, rc, "failed to write database type '$(expr)'", "expr=%s", expr ));
-            else
-            {
-                /* truncate existing schema */
-                rc = KMDataNodeWrite ( node, "", 0 );
-                if ( rc == 0 )
-                {
-                    rc = VSchemaDump ( self -> schema, sdmCompact, expr,
-                        ( rc_t ( CC * ) ( void*, const void*, size_t ) ) KMDataNodeAppend, node );
-                }
-                if ( rc != 0 )
-                    PLOGERR (klogInt, ( klogInt, rc, "failed to write database schema '$(expr)'", "expr=%s", expr ));
-            }
-        }
-
-        KMDataNodeRelease ( node );
-    }
-    return rc;
-}
-
-
-/* OpenUpdate
- *  finish create operation
- */
-static
-rc_t VDatabaseOpenUpdate ( VDatabase *self, const char *decl )
-{
-    /* open metadata */
-    rc_t rc = KDatabaseOpenMetadataUpdate ( self -> kdb, & self -> meta );
-    if ( rc == 0 )
-    {
-        /* fetch stored schema */
-        rc = VDatabaseLoadSchema ( self );
-        if ( rc == 0 )
-        {
-            /* fetch requested schema */
-            const SDatabase *sdb = self -> sdb;
-            if ( decl != NULL && decl [ 0 ] != 0 )
-            {
-                uint32_t type;
-                const SNameOverload *name;
-                sdb = ( self -> dad != NULL ) ?
-                    SDatabaseFind ( self -> dad -> sdb, self -> schema,
-                        & name, & type, decl, "VDatabaseOpenUpdate" ):
-                    VSchemaFind ( self -> schema,
-                        & name, & type, decl, "VDatabaseOpenUpdate", true );
-                if ( sdb != NULL && type != eDatabase )
-                {
-                    PLOGMSG ( klogWarn, ( klogWarn, "expression '$(expr)' is not a database",
-                               "expr=%s", decl ));
-                    sdb = NULL;
-                }
-            }
-
-            /* error if the two definitions differ */
-            if ( sdb != NULL && self -> sdb != NULL && sdb != self -> sdb )
-                rc = RC ( rcVDB, rcDatabase, rcOpening, rcSchema, rcIncorrect );
-            else if ( sdb == NULL && self -> sdb == NULL )
-                rc = RC ( rcVDB, rcDatabase, rcOpening, rcSchema, rcNotFound );
-            else
-            {
-                if ( sdb != NULL )
-                    self -> sdb = sdb;
-
-                /* write schema to metadata */
-                rc = VDatabaseStoreSchema ( self );
-                if ( rc == 0 )
-                    return 0;
-            }
-        }
-    }
-
-    DBGMSG(DBG_VDB, DBG_FLAG(DBG_VDB_VDB), ("VDatabaseOpenUpdate = %d\n", rc));
-
-    return rc;
-}
-
-
-/* CreateDB
- * VCreateDB
- *  create a new or open an existing database
- *
- *  "db" [ OUT ] - return parameter for newly opened database
- *
- *  "schema" [ IN ] - schema object containg database
- *  declaration to be used in creating db [ needed by manager ].
- *
- *  "decl" [ IN ] - type and optionally version of db schema
- *
- *  "cmode" [ IN ] - creation mode
- *
- *  "path" [ IN ] - NUL terminated string in
- *  wd-native character set giving path to database
- */
-LIB_EXPORT rc_t CC VDBManagerVCreateDB ( VDBManager *self, VDatabase **dbp,
-    const VSchema *schema, const char *decl,
-    KCreateMode cmode, const char *path, va_list args )
-{
-    rc_t rc;
-
-    if ( dbp == NULL )
-        rc = RC ( rcVDB, rcMgr, rcCreating, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcMgr, rcCreating, rcSelf, rcNull );
-        else if ( schema == NULL )
-            rc = RC ( rcVDB, rcMgr, rcOpening, rcSchema, rcNull );
-        else if ( decl == NULL )
-            rc = RC ( rcVDB, rcMgr, rcOpening, rcName, rcNull );
-        else if ( decl [ 0 ] == 0 )
-            rc = RC ( rcVDB, rcMgr, rcOpening, rcName, rcEmpty );
-        else
-        {
-            rc = VDatabaseMake ( dbp, self, NULL, schema );
-            if ( rc == 0 )
-            {
-                VDatabase *db = * dbp;
-
-                rc = KDBManagerVCreateDB ( self -> kmgr, & db -> kdb, cmode, path, args );
-                if ( rc == 0 )
-                {
-                    rc = VDatabaseOpenUpdate ( db, decl );
-                    if ( rc == 0 )
-                        return 0;
-
-                    rc = ResetRCContext ( rc, rcVDB, rcMgr, rcCreating );
-                }
-
-                VDatabaseWhack ( db );
-            }
-        }
-
-        * dbp = NULL;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VDBManagerCreateDB ( VDBManager *self, VDatabase **db,
-    const VSchema *schema, const char *decl,
-    KCreateMode cmode, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = VDBManagerVCreateDB ( self, db, schema, decl, cmode, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VDatabaseVCreateDB ( VDatabase *self, VDatabase **dbp,
-    const char *decl, KCreateMode cmode, const char *name, va_list args )
-{
-    rc_t rc;
-
-    if ( dbp == NULL )
-        rc = RC ( rcVDB, rcDatabase, rcCreating, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcDatabase, rcCreating, rcSelf, rcNull );
-        else if ( decl == NULL )
-            rc = RC ( rcVDB, rcMgr, rcOpening, rcName, rcNull );
-        else if ( decl [ 0 ] == 0 )
-            rc = RC ( rcVDB, rcMgr, rcOpening, rcName, rcEmpty );
-        else if ( self -> read_only )
-            rc = RC ( rcVDB, rcDatabase, rcCreating, rcDatabase, rcReadonly );
-        else
-        {
-            rc = VDatabaseMake ( dbp, NULL, self, self -> schema );
-            if ( rc == 0 )
-            {
-                VDatabase *db = * dbp;
-
-                rc = KDatabaseVCreateDB ( self -> kdb, & db -> kdb, cmode, name, args );
-                if ( rc == 0 )
-                {
-                    rc = VDatabaseOpenUpdate ( db, decl );
-                    if ( rc == 0 )
-                        return 0;
-
-                    rc = ResetRCContext ( rc, rcVDB, rcDatabase, rcCreating );
-                }
-
-                VDatabaseWhack ( db );
-            }
-        }
-
-        * dbp = NULL;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VDatabaseCreateDB ( VDatabase *self, VDatabase **db,
-    const char *decl, KCreateMode cmode, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = VDatabaseVCreateDB ( self, db, decl, cmode, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VDatabaseVDropDB ( VDatabase *self,
-                                     const char *name, va_list args)
-{
-    return KDatabaseVDropDB(self->kdb, name, args);
-}
-
-LIB_EXPORT rc_t CC VDatabaseDropDB ( VDatabase *self,
-                                    const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-    
-    va_start ( args, name );
-    rc = VDatabaseVDropDB(self, name, args);
-    va_end ( args );
-    
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VDatabaseVDropTable ( VDatabase *self,
-                                    const char *name, va_list args)
-{
-    return KDatabaseVDropTable(self->kdb, name, args);
-}
-
-LIB_EXPORT rc_t CC VDatabaseDropTable ( VDatabase *self,
-                                      const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-    
-    va_start ( args, name );
-    rc = VDatabaseVDropTable(self, name, args);
-    va_end ( args );
-    
-    return rc;
-}
-
-
-/* OpenDBUpdate
- * VOpenDBUpdate
- *  open a database for read/write
- *
- *  "db" [ OUT ] - return parameter for newly opened database
- *
- *  "schema" [ IN, NULL OKAY ] - schema object containg database
- *  declaration to be used in creating db [ needed by manager ].
- *
- *  "path" [ IN ] - NUL terminated string in
- *  wd-native character set giving path to database
- */
-LIB_EXPORT rc_t CC VDBManagerVOpenDBUpdate ( VDBManager *self, VDatabase **dbp,
-    const VSchema *schema, const char *path, va_list args )
-{
-    rc_t rc;
-
-    if ( dbp == NULL )
-        rc = RC ( rcVDB, rcMgr, rcOpening, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcMgr, rcOpening, rcSelf, rcNull );
-        else
-        {
-            if ( schema == NULL )
-                schema = self -> schema;
-
-            rc = VDatabaseMake ( dbp, self, NULL, schema );
-            if ( rc == 0 )
-            {
-                VDatabase *db = * dbp;
-
-                rc = KDBManagerVOpenDBUpdate ( self -> kmgr, & db -> kdb, path, args );
-                if ( rc == 0 )
-                {
-                    rc = VDatabaseOpenUpdate ( db, NULL );
-                    if ( rc == 0 )
-                        return 0;
-                }
-                        
-                VDatabaseWhack ( db );
-            }
-        }
-
-        * dbp = NULL;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VDBManagerOpenDBUpdate ( VDBManager *self, VDatabase **db,
-    const VSchema *schema, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = VDBManagerVOpenDBUpdate ( self, db, schema, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VDatabaseVOpenDBUpdate ( VDatabase *self, VDatabase **dbp,
-    const char *name, va_list args )
-{
-    rc_t rc;
-
-    if ( dbp == NULL )
-        rc = RC ( rcVDB, rcDatabase, rcOpening, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcDatabase, rcOpening, rcSelf, rcNull );
-        else if ( self -> read_only )
-            rc = RC ( rcVDB, rcDatabase, rcOpening, rcDatabase, rcReadonly );
-        else
-        {
-            rc = VDatabaseMake ( dbp, NULL, self, self -> schema );
-            if ( rc == 0 )
-            {
-                VDatabase *db = * dbp;
-
-                rc = KDatabaseVOpenDBUpdate ( self -> kdb, & db -> kdb, name, args );
-                if ( rc == 0 )
-                {
-                    rc = VDatabaseOpenUpdate ( db, NULL );
-                    if ( rc == 0 )
-                        return 0;
-                }
-
-                VDatabaseWhack ( db );
-            }
-        }
-
-        * dbp = NULL;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VDatabaseOpenDBUpdate ( VDatabase *self, VDatabase **db, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = VDatabaseVOpenDBUpdate ( self, db, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-/* Lock
- *  apply lock
- *
- *  if object is already locked, the operation is idempotent
- *  and returns an rc state of rcLocked
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptDatabase, kptTable and kptIndex
- *
- *  "path" [ IN ] - NUL terminated path
- */
-LIB_EXPORT rc_t CC VDatabaseVLock ( VDatabase *self, uint32_t type, const char *name, va_list args )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcDatabase, rcLocking, rcSelf, rcNull );
-    else
-        rc = KDatabaseVLock ( self -> kdb, type, name, args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VDatabaseLock ( VDatabase *self, uint32_t type, const char *name, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, name );
-
-    rc = VDatabaseVLock ( self, type, name, args );
-
-    va_end ( args );
-
-    return rc;
-}
-
-/* Unlock
- *  remove lock
- *
- *  if object is already unlocked, the operation is idempotent
- *  and returns an rc state of rcUnlocked
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptDatabase, kptTable and kptIndex
- *
- *  "path" [ IN ] - NUL terminated path
- */
-LIB_EXPORT rc_t CC VDatabaseVUnlock ( VDatabase *self, uint32_t type, const char *name, va_list args )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcDatabase, rcUnlocking, rcSelf, rcNull );
-    else
-        rc = KDatabaseVUnlock ( self -> kdb, type, name, args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VDatabaseUnlock ( VDatabase *self, uint32_t type, const char *name, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, name );
-
-    rc = VDatabaseVUnlock ( self, type, name, args );
-
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* OpenMetadataUpdate
- *  opens metadata for update
- *
- *  "meta" [ OUT ] - return parameter for metadata
- */
-LIB_EXPORT rc_t CC VDatabaseOpenMetadataUpdate ( VDatabase *self, KMetadata **meta )
-{
-    rc_t rc;
-    if ( meta == NULL )
-        rc = RC ( rcVDB, rcDatabase, rcAccessing, rcParam, rcNull );
-    else
-    {
-        * meta = NULL;
-
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcDatabase, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            /* we operate under the notion of
-               single-threaded operation, so hand out
-               read or update capable object */
-            rc = KMetadataAddRef ( self -> meta );
-            if ( rc == 0 )
-                * meta = self -> meta;
-        }
-    }
-
-    return rc;
-}
-
-
-/* ColumnCreateParams
- *  sets the creation parameters for physical columns
- *
- *  "cmode" [ IN ] - creation mode
- *
- *  "checksum" [ IN ] - the type of checksum information to
- *  apply when writing blobs
- *
- *  "pgsize" [ IN, DEFAULT ZERO ] - size of internal column "pages"
- *  the default value is indicated by 0 ( zero ).
- *  NB - CURRENTLY THE ONLY SUPPORTED PAGE SIZE IS 1 ( ONE ) BYTE.
- */
-LIB_EXPORT rc_t CC VDatabaseColumnCreateParams ( VDatabase *self,
-    KCreateMode cmode, KChecksum checksum, size_t pgsize )
-{
-    if ( self == NULL )
-        return RC ( rcVDB, rcTable, rcUpdating, rcSelf, rcNull );
-
-    self -> cmode = cmode;
-    self -> checksum = checksum;
-    self -> pgsize = pgsize;
-
-    return 0;
-}
-
-
-/* OpenManager
- *  duplicate reference to manager
- *  NB - returned reference must be released
- */
-LIB_EXPORT rc_t CC VDatabaseOpenManagerUpdate ( VDatabase *self, VDBManager **mgr )
-{
-    rc_t rc;
-
-    if ( mgr == NULL )
-        rc = RC ( rcVDB, rcDatabase, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcDatabase, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = VDBManagerAddRef ( self -> mgr );
-            if ( rc == 0 )
-            {
-                * mgr = self -> mgr;
-                return 0;
-            }
-        }
-
-        * mgr = NULL;
-    }
-
-    return rc;
-}
-
-
-/* OpenParent
- *  duplicate reference to parent database
- *  NB - returned reference must be released
- */
-LIB_EXPORT rc_t CC VDatabaseOpenParentUpdate ( VDatabase *self, VDatabase **par )
-{
-    rc_t rc;
-
-    if ( par == NULL )
-        rc = RC ( rcVDB, rcDatabase, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcDatabase, rcAccessing, rcSelf, rcNull );
-        else if ( self -> dad != NULL && self -> dad -> read_only )
-            rc = RC ( rcVDB, rcDatabase, rcAccessing, rcDatabase, rcReadonly );
-        else
-        {
-            rc = VDatabaseAddRef ( self -> dad );
-            if ( rc == 0 )
-            {
-                * par = self -> dad;
-                return 0;
-            }
-        }
-
-        * par = NULL;
-    }
-
-    return rc;
-}
-
-
-/* OpenKDatabase
- *  returns a new reference to underlying KDatabase
- */
-LIB_EXPORT rc_t CC VDatabaseOpenKDatabaseUpdate ( VDatabase *self, KDatabase **kdb )
-{
-    rc_t rc;
-
-    if ( kdb == NULL )
-        rc = RC ( rcVDB, rcDatabase, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcDatabase, rcAccessing, rcSelf, rcNull );
-        else if ( self -> read_only )
-            rc = RC ( rcVDB, rcDatabase, rcAccessing, rcDatabase, rcReadonly );
-        else
-        {
-            rc = KDatabaseAddRef ( self -> kdb );
-            if ( rc == 0 )
-            {
-                * kdb = self -> kdb;
-                return 0;
-            }
-        }
-
-        * kdb = NULL;
-    }
-
-    return rc;
-}
diff --git a/libs/vdb/wdbmgr.c b/libs/vdb/wdbmgr.c
deleted file mode 100644
index f45a53f..0000000
--- a/libs/vdb/wdbmgr.c
+++ /dev/null
@@ -1,251 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#define TRACK_REFERENCES 0
-/* should match dbmgr-cmn.c */
-
-#include "libwvdb.vers.h"
-
-#include "dbmgr-priv.h"
-#include "schema-priv.h"
-#include "linker-priv.h"
-
-#include <vdb/manager.h>
-#include <vdb/schema.h>
-#include <vdb/vdb-priv.h>
-#include <kdb/manager.h>
-#include <kfs/directory.h>
-#include <kproc/lock.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * VDBManager
- *  opaque handle to library
- */
-
-
-/* MakeUpdate
- *  create library handle for specific use
- *  NB - only one of the functions will be implemented
- *
- */
-LIB_EXPORT rc_t CC VDBManagerMakeUpdate ( VDBManager **mgrp,  KDirectory *wd )
-{
-    rc_t rc;
-
-    if ( mgrp == NULL )
-        rc = RC ( rcVDB, rcMgr, rcConstructing, rcParam, rcNull );
-    else
-    {
-        VDBManager *mgr = malloc ( sizeof * mgr );
-        if ( mgr == NULL )
-            rc = RC ( rcVDB, rcMgr, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            rc = KDBManagerMakeUpdate ( & mgr -> kmgr, wd );
-            if ( rc == 0 )
-            {
-                rc = VSchemaMakeIntrinsic ( & mgr -> schema );
-                if ( rc == 0 )
-                {
-                    rc = VLinkerMakeIntrinsic ( & mgr -> linker );
-                    if ( rc == 0 )
-                    {
-                        rc = VDBManagerConfigPaths ( mgr, true );
-                        if ( rc == 0 )
-                        {
-                            mgr -> user = NULL;
-                            mgr -> user_whack = NULL;
-                            KRefcountInit ( & mgr -> refcount, 1, "VDBManager", "make-update", "vmgr" );
-                            * mgrp = mgr;
-                            return 0;
-                        }
-
-                        VLinkerRelease ( mgr -> linker );
-                    }
-
-                    VSchemaRelease ( mgr -> schema );
-                }
-
-                KDBManagerRelease ( mgr -> kmgr );
-            }
-
-            free ( mgr );
-        }
-
-        * mgrp = NULL;
-    }
-    return rc;
-}
-
-
-/* Version
- *  returns the library version
- */
-LIB_EXPORT rc_t CC VDBManagerVersion ( const VDBManager *self, uint32_t *version )
-{
-    if ( version == NULL )
-        return RC ( rcVDB, rcMgr, rcAccessing, rcParam, rcNull );
-    if ( self == NULL )
-        return RC ( rcVDB, rcMgr, rcAccessing, rcSelf, rcNull );
-
-    * version = LIBWVDB_VERS;
-    return 0;
-}
-
-/* Lock
- *  apply lock
- *
- *  if object is already locked, the operation is idempotent
- *  and returns an rc state of rcLocked
- *
- *  "path" [ IN ] - NUL terminated path
- */
-LIB_EXPORT rc_t CC VDBManagerVLock ( VDBManager *self, const char *path, va_list args )
-{
-    if ( self == NULL )
-        return RC ( rcVDB, rcMgr, rcLocking, rcSelf, rcNull );
-    return KDBManagerVLock ( self -> kmgr, path, args );
-}
-
-LIB_EXPORT rc_t CC VDBManagerLock ( VDBManager *self, const char *path, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, path );
-
-    rc = VDBManagerVLock ( self, path, args );
-
-    va_end ( args );
-
-    return rc;
-}
-
-/* Unlock
- *  remove lock
- *
- *  if object is already unlocked, the operation is idempotent
- *  and returns an rc state of rcUnlocked
- *
- *  "path" [ IN ] - NUL terminated path
- */
-LIB_EXPORT rc_t CC VDBManagerVUnlock ( VDBManager *self, const char *path, va_list args )
-{
-    if ( self == NULL )
-        return RC ( rcVDB, rcMgr, rcUnlocking, rcSelf, rcNull );
-    return KDBManagerVUnlock ( self -> kmgr, path, args );
-}
-
-LIB_EXPORT rc_t CC VDBManagerUnlock ( VDBManager *self, const char *path, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, path );
-
-    rc = VDBManagerVUnlock ( self, path, args );
-
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* Drop
- *  drop an object based on its path
- *
- *  "path" [ IN ] - NUL terminated string in UTF-8 giving path to the vdb object
- */
-LIB_EXPORT rc_t CC VDBManagerVDrop ( VDBManager *self, uint32_t obj_type, const char *path, va_list args )
-{
-    if ( self != NULL )
-        return KDBManagerVDrop ( self -> kmgr, obj_type, path, args );
-
-    return RC ( rcVDB, rcMgr, rcRemoving, rcSelf, rcNull );
-}
-
-LIB_EXPORT rc_t CC VDBManagerDrop ( VDBManager *self, uint32_t obj_type, const char *path, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, path );
-
-    rc = VDBManagerVDrop ( self, obj_type, path, args );
-
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* VDBManagerRunPeriodicTasks
- *  executes periodic tasks, such as cache flushing
- */
-LIB_EXPORT rc_t CC VDBManagerRunPeriodicTasks ( const VDBManager *self )
-{
-    if ( self == NULL )
-        return RC ( rcVDB, rcMgr, rcExecuting, rcSelf, rcNull );
-
-    return KDBManagerRunPeriodicTasks ( self -> kmgr );
-}
-
-/* OpenKDBManager
- *  returns a new reference to KDBManager used by VDBManager
- */
-LIB_EXPORT rc_t CC VDBManagerOpenKDBManagerUpdate ( VDBManager *self, KDBManager **kmgr )
-{
-    rc_t rc;
-
-    if ( kmgr == NULL )
-        rc = RC ( rcVDB, rcMgr, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcMgr, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = KDBManagerAddRef ( self -> kmgr );
-            if ( rc == 0 )
-            {
-                * kmgr = self -> kmgr;
-                return 0;
-            }
-        }
-
-        * kmgr = NULL;
-    }
-
-    return rc;
-}
diff --git a/libs/vdb/wlinker.c b/libs/vdb/wlinker.c
deleted file mode 100644
index 3ce08c8..0000000
--- a/libs/vdb/wlinker.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#define TRACK_REFERENCES 0
-
-#include "linker-priv.h"
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-
-extern VTRANSFACT_DECL ( meta_write );
-extern VTRANSFACT_DECL ( meta_attr_write );
-
-/* newly imported things */
-extern VTRANSFACT_DECL ( NCBI_SRA_cmp_stats_trigger );
-extern VTRANSFACT_DECL ( NCBI_SRA_cmpf_stats_trigger );
-extern VTRANSFACT_DECL ( NCBI_SRA_extract_name_fmt );
-extern VTRANSFACT_DECL ( NCBI_SRA_extract_spot_name );
-extern VTRANSFACT_DECL ( NCBI_SRA_phred_stats_trigger );
-extern VTRANSFACT_DECL ( NCBI_SRA_qual4_encode );
-extern VTRANSFACT_DECL ( NCBI_SRA_stats_trigger );
-#if HAVE_ALIGN_STATS_TRIGGER
-extern VTRANSFACT_DECL ( NCBI_align_stats_trigger );
-extern VTRANSFACT_DECL ( NCBI_seq_stats_trigger );
-#endif
-extern VTRANSFACT_DECL ( NCBI_refSeq_stats );
-extern VTRANSFACT_DECL ( idx_text_insert );
-extern VTRANSFACT_DECL ( vdb_bzip );
-extern VTRANSFACT_DECL ( vdb_checksum );
-extern VTRANSFACT_DECL ( vdb_fzip );
-extern VTRANSFACT_DECL ( vdb_rlencode );
-extern VTRANSFACT_DECL ( vdb_zip );
-
-/* InitFactories
- */
-rc_t VLinkerInitFactories ( VLinker *self, struct KSymTable *tbl, struct SchemaEnv const *env )
-{
-    static VLinkerIntFactory fact [] =
-    {
-        { meta_write, "meta:write" },
-        { meta_attr_write, "meta:attr:write" },
-
-        { NCBI_SRA_cmp_stats_trigger, "NCBI:SRA:cmp_stats_trigger" },
-        { NCBI_SRA_cmpf_stats_trigger, "NCBI:SRA:cmpf_stats_trigger" },
-        { NCBI_SRA_extract_name_fmt, "NCBI:SRA:extract_name_fmt" },
-        { NCBI_SRA_extract_spot_name, "NCBI:SRA:extract_spot_name" },
-        { NCBI_SRA_phred_stats_trigger, "NCBI:SRA:phred_stats_trigger" },
-        { NCBI_SRA_qual4_encode, "NCBI:SRA:qual4_encode" },
-        { NCBI_SRA_stats_trigger, "NCBI:SRA:stats_trigger" },
-#if HAVE_ALIGN_STATS_TRIGGER
-        { NCBI_align_stats_trigger, "NCBI:align:stats_trigger" },
-        { NCBI_seq_stats_trigger, "NCBI:seq:stats_trigger" },
-#endif
-        { NCBI_refSeq_stats, "NCBI:refSeq:stats" },
-        { idx_text_insert, "idx:text:insert" },
-        { vdb_bzip, "vdb:bzip" },
-        { vdb_checksum, "vdb:checksum" },
-        { vdb_fzip, "vdb:fzip" },
-        { vdb_rlencode, "vdb:rlencode" },
-        { vdb_zip, "vdb:zip" }
-    };
-
-    rc_t rc = VLinkerInitFactoriesRead ( self, tbl, env );
-    if ( rc == 0 )
-        rc = VLinkerAddFactories ( self, fact, sizeof fact / sizeof fact [ 0 ], tbl, env );
-    return rc;
-}
diff --git a/libs/vdb/wphys.c b/libs/vdb/wphys.c
deleted file mode 100644
index e1f2d27..0000000
--- a/libs/vdb/wphys.c
+++ /dev/null
@@ -1,909 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-#include <os-native.h>
-
-#define KONST
-#define SKONST
-#include "phys-priv.h"
-#include "schema-parse.h"
-#include "schema-priv.h"
-#include "schema-expr.h"
-#include "table-priv.h"
-#include "cursor-priv.h"
-#include "prod-priv.h"
-#include "prod-expr.h"
-#include "blob-priv.h"
-#include "page-map.h"
-#undef KONST
-#undef SKONST
-
-#include <vdb/vdb-priv.h>
-#include <vdb/cursor.h>
-#include <kdb/manager.h>
-#include <kdb/table.h>
-#include <kdb/column.h>
-#include <kdb/meta.h>
-#include <klib/symbol.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <bitstr.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-
-#if VCURSOR_WRITE_MODES_SUPPORTED
-#error "only kcmInsert and kcmReplace modes supported"
-#else
-#define WHOLE_REPLACE_UPDATE 1
-#endif
-
-/*--------------------------------------------------------------------------
- * VPhysical
- */
-
-static
-rc_t VPhysicalConvertStatic ( VPhysical *self );
-
-
-/* Whack
- */
-void CC VPhysicalWhack ( void *item, void *ignore )
-{
-    VPhysical *self = item;
-    if ( self > FAILED_PHYSICAL )
-    {
-#if PROD_CACHE
-        /* detect close of static column */
-        if ( ! self -> read_only && self -> knode != NULL )
-        {
-            /* if the column is fairly large for metadata */
-            if ( KDataBufferBytes ( & self -> srow ) > 64 * 1024 )
-                /* convert it to a single blob */
-                VPhysicalConvertStatic ( self );
-        }
-#endif
-        if ( ! self -> read_only )
-        {
-            rc_t rc;
-            VCursor *curs = self -> curs;
-            VTable *tbl = curs -> tbl;
-
-            const String *name = & self -> smbr -> name -> name;
-
-            KMDataNode *col_node = tbl -> col_node;
-
-            /* create rename strings */
-            char buff [ 300 ];
-            char *oldname, *colname, *tmpname = buff;
-            int sz = snprintf ( buff, sizeof buff / 3, "%.*s.tmp",
-                ( int ) name -> size - 1, name -> addr + 1 );
-            if ( sz < 0 || sz > sizeof buff / 3 )
-            {
-                tmpname = malloc ( 3 * 4 * 1024 );
-                if ( tmpname == NULL )
-                {
-                    rc = RC ( rcVDB, rcColumn, rcClosing, rcMemory, rcInsufficient );
-                    PLOGERR ( klogSys, ( klogInt, rc, "failed to close column '$(colname)'",
-                        "colname=%.*s", ( int ) name -> size - 1, name -> addr + 1 ));
-                    return;
-                }
-
-                sz = snprintf ( tmpname, 4 * 1024, "%.*s.tmp",
-                    ( int ) name -> size - 1, name -> addr + 1 );
-                assert ( sz > 0 && sz < 4 * 1024 );
-            }
-            oldname = & tmpname [ ++ sz ];
-            colname = & oldname [ sz ];
-            sprintf ( oldname, "%.*s.old", ( int ) name -> size - 1, name -> addr + 1 );
-            sprintf ( colname, "%.*s", ( int ) name -> size - 1, name -> addr + 1 );
-
-            /* close and rename static column */
-            if ( self -> knode != NULL )
-            {
-                rc = KMDataNodeRelease ( self -> knode );
-                if ( rc != 0 )
-                {
-                    PLOGERR ( klogInt, ( klogInt, rc, "failed to release static node when closing column '$(colname)'",
-                                         "colname=%s", colname ));
-                }
-                else
-                {
-                    self -> knode = NULL;
-
-                    assert ( col_node != NULL );
-                    rc = KMDataNodeDropChild ( col_node, colname );
-                    if ( rc != 0 && GetRCState ( rc ) != rcNotFound )
-                    {
-                        PLOGERR ( klogInt, ( klogInt, rc, "failed to drop previous static node when closing column '$(colname)'",
-                                             "colname=%s", colname ));
-                    }
-                    else
-                    {
-                        rc = KMDataNodeRenameChild ( col_node, tmpname, colname );
-                        if ( rc != 0 )
-                        {
-                            PLOGERR ( klogInt, ( klogInt, rc, "failed to rename static node when closing column '$(colname)'",
-                                                 "colname=%s", colname ));
-                        }
-                        else
-                        {
-                            KTable *ktbl;
-                            rc = VTableOpenKTableUpdate ( tbl, & ktbl );
-                            if ( rc == 0 )
-                            {
-                                rc = KTableUnlock ( ktbl, kptColumn, colname );
-                                if ( rc == 0 || GetRCState ( rc ) == rcUnlocked )
-                                    rc = KTableDropColumn ( ktbl, colname );
-                                KTableRelease ( ktbl );
-                                rc = 0;
-                            }
-                        }
-                    }
-                }
-            }
-            else if ( self -> kcol != NULL )
-            {
-                KMDataNode *node;
-
-                /* write fixed length to column metadata */
-                if ( self -> fixed_len != 0 )
-                {
-                    rc = KMetadataOpenNodeUpdate ( self -> meta, & node, "row-len" );
-                    if ( rc != 0 )
-                    {
-                        PLOGERR ( klogInt, ( klogInt, rc, "failed to open '$(node)' node when closing column '$(colname)'",
-                            "node=row-len,colname=%s", colname ));
-                    }
-                    else
-                    {
-                        if ( self -> fixed_len < 0x100 )
-                        {
-                            uint8_t u8 = ( uint8_t ) self -> fixed_len;
-                            rc = KMDataNodeWriteB8 ( node, & u8 );
-                        }
-                        else if ( self -> fixed_len < 0x10000 )
-                        {
-                            uint16_t u16 = ( uint16_t ) self -> fixed_len;
-                            rc = KMDataNodeWriteB16 ( node, & u16 );
-                        }
-                        else
-                        {
-                            rc = KMDataNodeWriteB32 ( node, & self -> fixed_len );
-                        }
-                        if ( rc != 0 )
-                        {
-                            PLOGERR ( klogInt, ( klogInt, rc, "failed to update '$(node)' node when closing column '$(colname)'",
-                                "node=row-len,colname=%s", colname ));
-                        }
-
-                        KMDataNodeRelease ( node );
-                    }
-                }
-                else
-                {
-                    rc = KMetadataOpenNodeUpdate ( self -> meta, & node, NULL );
-                    if ( rc != 0 )
-                    {
-                        PLOGERR ( klogInt, ( klogInt, rc, "failed to open '$(node)' node when closing column '$(colname)'",
-                            "node=/,colname=%s", colname ));
-                    }
-                    else
-                    {
-                        rc = KMDataNodeDropChild ( node, "row-len" );
-                        if ( rc == 0 && GetRCState ( rc ) != rcNotFound )
-                        {
-                            PLOGERR ( klogInt, ( klogInt, rc, "failed to update '$(node)' node when closing column '$(colname)'",
-                                "node=row-len,colname=%s", colname ));
-                        }
-
-                        KMDataNodeRelease ( node );
-                    }
-                }
-
-                /* close column */
-                rc = KMetadataRelease ( self -> meta );
-                if ( rc != 0 )
-                    PLOGERR ( klogInt, ( klogInt, rc, "failed to release column '$(colname)'", "colname=%s", colname ));
-                else
-                {
-                    self -> meta = NULL;
-                    rc = KColumnRelease ( self -> kcol );
-                    if ( rc != 0 )
-                        PLOGERR ( klogInt, ( klogInt, rc, "failed to release column '$(colname)'", "colname=%s", colname ));
-                    else
-                    {
-                        KTable *ktbl;
-
-                        self -> kcol = NULL;
-
-                        /* access KTable */
-                        rc = VTableOpenKTableUpdate ( tbl, & ktbl );
-                        if ( rc != 0 )
-                        {
-                            PLOGERR ( klogInt, ( klogInt, rc, "failed to access physical table when closing column '$(colname)'",
-                                                 "colname=%s", colname ));
-                        }
-                        else
-                        {
-                            bool has_old;
-
-                            /* unlock existing */
-                            rc = KTableUnlock ( ktbl, kptColumn, colname );
-                            if ( rc == 0 || GetRCState ( rc ) == rcUnlocked )
-                            {
-                                has_old = true;
-
-                                /* rename existing */
-                                rc = KTableRenameColumn ( ktbl, true, colname, oldname );
-                                if ( rc != 0 )
-                                {
-                                    PLOGERR ( klogSys, ( klogInt, rc, "failed to rename previous column when closing '$(colname)'",
-                                                         "colname=%s", colname ));
-                                }
-                            }
-                            else if ( GetRCState ( rc ) == rcNotFound )
-                            {
-                                has_old = false;
-                                rc = 0;
-                            }
-                            if ( rc == 0 )
-                            {
-                                /* rename new column */
-                                rc = KTableRenameColumn ( ktbl, true, tmpname, colname );
-                                if ( rc != 0 )
-                                {
-                                    PLOGERR ( klogSys, ( klogInt, rc, "failed to rename previous column when closing '$(colname)'",
-                                                         "colname=%s", colname ));
-                                    if ( has_old )
-                                    {
-                                        rc = KTableRenameColumn ( ktbl, true, oldname, colname );
-                                        if ( rc != 0 )
-                                        {
-                                            PLOGERR ( klogSys, ( klogInt, rc, "failed to restore previous column when closing '$(colname)'",
-                                                                 "colname=%s", colname ));
-                                        }
-                                    }
-                                }
-                                else
-                                {
-                                    if ( has_old )
-                                    {
-                                        /* drop old column */
-                                        rc = KTableDropColumn ( ktbl, oldname );
-                                        if ( rc != 0 )
-                                        {
-                                            PLOGERR ( klogWarn, ( klogInt, rc, "preexisting column was not dropped when closing '$(colname)'",
-                                                                  "colname=%s", colname ));
-                                        }
-                                    }
-
-                                    KMDataNodeDropChild ( col_node, colname );
-                                }
-                            }
-
-                            KTableRelease ( ktbl );
-                        }
-                    }
-                }
-            }
-
-            if ( tmpname != buff )
-                free ( tmpname );
-        }
-
-        VPhysicalDestroy ( self );
-    }
-}
-
-/* Open
- *  open existing columns
- *  load schema definitions
- */
-rc_t VPhysicalOpenWrite ( VPhysical *self, VSchema *schema, const VTable *tbl )
-{
-#if WHOLE_REPLACE_UPDATE
-    return 0;
-#else
-    /* physical member name from schema */
-    const SPhysMember *smbr = self -> smbr;
-    const KSymbol *name = smbr -> name;
-
-    /* open column for update */
-    rc_t rc = KTableOpenColumnUpdate ( tbl -> ktbl, & self -> kcol,
-        "%.*s", ( int ) name -> name . size - 1, name -> name . addr + 1 );
-    if ( rc == 0 )
-    { 
-        /* open its metadata */
-        rc = KColumnOpenMetadataUpdate ( self -> kcol, & self -> meta );
-        if ( rc == 0 )
-        {
-            /* finish off common initialization */
-            rc = VPhysicalFinishKColumn ( self, schema, smbr );
-        }
-    }
-
-    /* it's okay if a column doesn't exist -
-       it'll either be created or will exist as a static */
-    else if ( GetRCState ( rc ) == rcNotFound )
-    {
-        rc = 0;
-    }
-
-    if ( rc == 0 && self -> kcol == NULL )
-    {
-        /* look for static */
-        const KMDataNode *node;
-        assert ( tbl -> col_node != NULL );
-        rc = KMDataNodeOpenNodeRead ( tbl -> col_node, & node,
-            "%.*s", ( int ) name -> name . size - 1, name -> name . addr + 1 );
-        if ( rc == 0 )
-        {
-            /* reopen for update */
-            KMDataNodeRelease ( node );
-            rc = KMDataNodeOpenNodeUpdate ( tbl -> col_node, & self -> knode,
-                "%.*s", ( int ) name -> name . size - 1, name -> name . addr + 1 );
-            if ( rc == 0 )
-            {
-                /* finish off common initialization */
-                rc = VPhysicalFinishStatic ( self, schema, smbr );
-            }
-        }
-        else if ( GetRCState ( rc ) == rcNotFound )
-        {
-            rc = 0;
-        }
-    }
-
-    return rc;
-#endif
-}
-
-static
-rc_t VPhysicalCreateStatic ( VPhysical *self, const VBlob *vblob )
-{
-    rc_t rc;
-    const String *name;
-
-    VCursor *curs = self -> curs;
-    VTable *tbl = curs -> tbl;
-
-    KMDataNode *col_node = tbl -> col_node;
-    assert ( col_node != NULL );
-
-    /* create node */
-    name = & self -> smbr -> name -> name;
-    rc = KMDataNodeOpenNodeUpdate ( col_node, & self -> knode,
-        "%.*s.tmp", ( int ) name -> size - 1, name -> addr + 1 );
-    if ( rc == 0 )
-    {
-        /* type */
-        char typedecl [ 256 ];
-        rc = VTypedeclToText ( & self -> smbr -> td,
-            curs -> schema, typedecl, sizeof typedecl );
-        if ( rc == 0 )
-            rc = KMDataNodeWriteAttr ( self -> knode, "type", typedecl );
-        if ( rc == 0 )
-        {
-            /* open row */
-            KMDataNode *row;
-            rc = KMDataNodeOpenNodeUpdate ( self -> knode, & row, "row" );
-            if ( rc == 0 )
-            {
-                /* keep a copy of the original */
-                rc = KDataBufferSub ( & vblob -> data, & self -> srow, 0, UINT64_MAX );
-                if ( rc == 0 )
-                {
-                    /* total bits in static row */
-                    uint64_t row_bits = KDataBufferBits ( & vblob -> data );
-
-                    /* check for need to reverse byte order */
-                    bool reverse;
-                    rc = KMDataNodeByteOrder ( row, & reverse );
-                    if ( rc == 0 )
-                    {
-                        KDataBuffer data;
-
-                        /* if the output metadata file is in native byte order */
-                        if ( ! reverse )
-                            rc = KDataBufferSub ( & vblob -> data, & data, 0, UINT64_MAX );
-                        else
-                        {
-                            /* find the datatype for static column */
-                            const SDatatype *dt = VSchemaFindTypeid ( curs -> schema,
-                                self -> smbr -> td . type_id );
-                            assert ( dt != NULL );
-
-                            /* if the type does not need swapping */
-                            if ( dt -> byte_swap == NULL )
-                                rc = KDataBufferSub ( & vblob -> data, & data, 0, UINT64_MAX );
-                            else
-                            {
-                                /* swap into a writable buffer */
-                                rc = KDataBufferMake ( & data, vblob -> data . elem_bits, vblob -> data . elem_count );
-                                if ( rc == 0 )
-                                {
-                                    ( * dt -> byte_swap ) ( data . base,
-                                        vblob -> data . base, ( uint32_t ) ( row_bits / dt -> size ) );
-                                }
-                            }
-                        }
-                        if ( rc == 0 )
-                        {
-                            /* write row */
-                            rc = KMDataNodeWrite ( row, data . base, ( size_t ) ( ( row_bits + 7 ) >> 3 ) );
-                            if ( rc == 0 )
-                            {
-                                /* if row-bits are not integral bytes */
-                                if ( ( row_bits & 7 ) != 0 )
-                                {
-                                    /* record them in a size node */
-                                    KMDataNode *size;
-                                    rc = KMDataNodeOpenNodeUpdate ( self -> knode, & size, "size" );
-                                    if ( rc == 0 )
-                                    {
-                                        rc = KMDataNodeWriteB64 ( size, & row_bits );
-                                        KMDataNodeRelease ( size );
-                                    }
-                                }
-                            }
-
-                            KDataBufferWhack ( & data );
-                        }
-                    }
-                }
-
-                KMDataNodeRelease ( row );
-            }
-        }
-
-        if ( rc != 0 )
-        {
-            KMDataNodeRelease ( self -> knode ), self -> knode = NULL;
-            KMDataNodeDropChild ( col_node, "%.*s", ( int ) name -> size - 1, name -> addr + 1 );
-            KDataBufferWhack ( & self -> srow );
-        }
-        else
-        {
-            self -> sstart_id = vblob -> start_id;
-            self -> sstop_id = vblob -> stop_id;
-            self -> fixed_len = PageMapGetIdxRowInfo ( vblob -> pm, 0, NULL );
-        }
-    }
-    
-    return rc;
-}
-
-static
-rc_t VPhysicalCreateKColumn ( VPhysical *self )
-{
-    rc_t rc;
-    VCursor *curs = self -> curs;
-    const SPhysMember *smbr = self -> smbr;
-    VTable *tbl = curs -> tbl;
-    const String *name = & smbr -> name -> name;
-
-    /* check for static designation */
-    if ( smbr -> stat )
-    {
-        rc = RC ( rcVDB, rcColumn, rcCreating, rcConstraint, rcViolated );
-        return rc;
-    }
-
-    /* create physical column */
-    rc = KTableCreateColumn ( tbl -> ktbl, & self -> kcol,
-        ( KCreateMode ) tbl -> cmode, ( KChecksum ) tbl -> checksum, tbl -> pgsize, 
-        "%.*s.tmp", ( int ) name -> size - 1, name -> addr + 1 );
-    if ( rc == 0 )
-    {
-        /* create its metadata */
-        rc = KColumnOpenMetadataUpdate ( self -> kcol, & self -> meta );
-        if ( rc == 0 )
-        {
-            /* print typedecl */
-            char buffer [ 256 ];
-            rc = VTypedeclToText ( & smbr -> td,
-                curs -> schema, buffer, sizeof buffer );
-            if ( rc == 0 )
-            {
-                /* create schema node */
-                KMDataNode *schema_node;
-                rc = KMetadataOpenNodeUpdate ( self -> meta, & schema_node, "schema" );
-                if ( rc == 0 )
-                {
-                    /* write column type */
-                    rc = KMDataNodeWriteAttr ( schema_node, "type", buffer );
-                    if ( rc == 0 )
-                    {
-                        /* going to write some schema */
-                        if ( smbr -> type == NULL )
-                        {
-                            /* buffer already contains datatype */
-                            if ( smbr -> td . dim != 1 )
-                            {
-                                /* get just the typename */
-                                VTypedecl td = smbr -> td;
-                                td . dim = 1;
-                                rc = VTypedeclToText ( & smbr -> td,
-                                    curs -> schema, buffer, sizeof buffer );
-                            }
-                        }
-                        else
-                        {
-                            size_t num_writ;
-
-                            /* get physical type expression */
-                            rc = VSchemaToText ( curs -> schema,
-                                buffer, sizeof buffer, & num_writ, "%E", smbr -> type );
-                            if ( rc == 0 )
-                            {
-                                buffer [ num_writ ] = 0;
-                                rc = KMDataNodeWriteAttr ( schema_node, "expr", buffer );
-                                if ( rc == 0 )
-                                {
-                                    const SPhysical *sphys = ( ( const SPhysEncExpr* ) smbr -> type ) -> phys;
-                                    rc = VSchemaToText ( curs -> schema,
-                                        buffer, sizeof buffer, & num_writ, "%N%V",
-                                        sphys -> name, sphys -> version );
-                                    if ( rc == 0 )
-                                        buffer [ num_writ ] = 0;
-                                }
-                            }
-                        }
-                    }
-                    if ( rc == 0 )
-                    {
-                        rc = VSchemaDump ( curs -> schema, sdmCompact, buffer,
-                           ( rc_t ( CC * ) ( void*, const void*, size_t ) ) KMDataNodeAppend, schema_node );
-                        if ( rc == 0 )
-                        {
-                            /* mark it empty */
-                            self -> kstart_id = 1;
-                            self -> kstop_id = 0;
-                        }
-                    }
-                }
-
-                KMDataNodeRelease ( schema_node );
-            }
-        }
-    }
-
-    return rc;
-}
-
-static
-rc_t VPhysicalWriteKColumn ( VPhysical *self, const VBlob *vblob )
-{
-    KColumnBlob *kblob;
-    rc_t rc = KColumnCreateBlob ( self -> kcol, & kblob );
-    if ( rc == 0 )
-    {
-        /* for now, row counts are 32-bit */
-        uint32_t count = (uint32_t)(vblob -> stop_id - vblob -> start_id + 1);
-        rc = KColumnBlobAssignRange ( kblob, vblob -> start_id, count );
-        if ( rc == 0 )
-        {
-            rc = KColumnBlobAppend ( kblob, vblob -> data . base, KDataBufferBytes ( & vblob -> data ) );
-            if ( rc == 0 )
-            {
-                rc = KColumnBlobCommit ( kblob );
-                if ( rc == 0 )
-                {
-                    /* get the fixed row-length of this blob */
-                    uint32_t blob_fixed = VBlobFixedRowLength ( vblob );
-
-                    /* detect if the column is truly fixed row length */
-                    if ( self -> kstart_id > self -> kstop_id )
-                        self -> fixed_len = blob_fixed;
-                    else if ( blob_fixed != self -> fixed_len )
-                        self -> fixed_len = 0;
-
-                    /* incorporate id range into our view of the world */
-                    if ( vblob -> start_id < self -> kstart_id )
-                        self -> kstart_id = vblob -> start_id;
-                    if ( vblob -> stop_id > self -> kstop_id )
-                        self -> kstop_id = vblob -> stop_id;
-                }
-            }
-        }
-
-        KColumnBlobRelease ( kblob );
-    }
-    return rc;
-}
-
-static
-rc_t VPhysicalConvertStatic ( VPhysical *self )
-{
-#if ! PROD_CACHE
-    return RC ( rcVDB, rcColumn, rcConverting, rcFunction, rcUnsupported );
-#else
-    rc_t rc = VPhysicalCreateKColumn ( self );
-    if ( rc == 0 )
-    {
-        int64_t sstart_id, sstop_id;
-
-        /* save incoming blob cache on stack */
-        VBlob *cache [ PROD_CACHE * PROD_CACHE_MAX_EXTENTS ];
-        assert ( sizeof cache == sizeof self -> in -> cache );
-        memcpy ( cache, self -> in -> cache, sizeof cache );
-
-        /* set incoming blob cache to empty */
-        memset ( self -> in -> cache, 0, sizeof self -> in -> cache );
-
-        for ( sstart_id = self -> sstart_id;
-              rc == 0 && sstart_id <= self -> sstop_id;
-              sstart_id = sstop_id + 1 )
-        {
-            /* 3G rows */
-            sstop_id = sstart_id + 0xC0000000;
-            assert ( sstop_id > sstart_id );
-
-            /* limit to actual end */
-            if ( sstop_id > self -> sstop_id )
-                sstop_id = self -> sstop_id;
-
-            /* don't create tiny additional blobs */
-            else if ( ( self -> sstop_id - sstop_id ) < 1000 )
-                sstop_id = self -> sstop_id;
-
-            /* recreate a VBlob from static that can be sent through encoding */
-            rc = VBlobCreateFromSingleRow ( & self -> in -> cache [ 0 ],
-                sstart_id, sstop_id, & self -> srow, vboNative );
-            if ( rc == 0 )
-            {
-                /* get an encoded version of static blob */
-                VBlob *vblob;
-                rc = VProductionReadBlob ( self -> b2s, & vblob, sstart_id, 1,NULL );
-                if ( rc == 0 )
-                {
-                    /* write encoded blob to physical */
-                    rc = VPhysicalWriteKColumn ( self, vblob );
-
-                    /* in all events, release blob */
-                    TRACK_BLOB ( VBlobRelease, vblob );
-                    ( void ) VBlobRelease ( vblob );
-                }
-            
-                /* release the blob from static */
-                TRACK_BLOB ( VBlobRelease, self -> in -> cache [ 0 ] );
-                ( void ) VBlobRelease ( self -> in -> cache [ 0 ] );
-            }
-        }
-
-        /* restore cache from stack */
-        memcpy ( self -> in -> cache, cache, sizeof self -> in -> cache );
-
-        if ( rc == 0 )
-        {
-            const String *name;
-            VCursor *curs = self -> curs;
-            VTable *tbl = curs -> tbl;
-
-            /* tear down static */
-            KMDataNodeRelease ( self -> knode );
-            self -> knode = NULL;
-
-            /* delete column from table */
-            name = & self -> smbr -> name -> name;
-            assert ( tbl -> col_node != NULL );
-            rc = KMDataNodeDropChild ( tbl -> col_node,
-                "%.*s.tmp", ( int ) name -> size - 1, name -> addr + 1 );
-        }
-    }
-
-    return rc;
-#endif
-}
-
-static
-rc_t KMDataNodeWriteId ( KMDataNode *self, int64_t id )
-{
-    int32_t i32;
-    
-    if ( id >= -128 && id < 128 )
-    {
-        int8_t i8 = ( int8_t ) id;
-        return KMDataNodeWriteB8 ( self, & i8 );
-    }
-    if ( id >= -32768 && id < 32768 )
-    {
-        int16_t i16 = ( int16_t ) id;
-        return KMDataNodeWriteB16 ( self, & i16 );
-    }
-    
-    i32 = ( int32_t ) id;
-    if ( ( int64_t ) i32 == id )
-        return KMDataNodeWriteB32 ( self, & i32 );
-    
-    return KMDataNodeWriteB64 ( self, & id );
-}
-
-static
-rc_t KMDataNodeWriteCount ( KMDataNode *self, uint64_t count )
-{
-    if ( count < 0x100 )
-    {
-        uint8_t i8 = ( uint8_t ) count;
-        return KMDataNodeWriteB8 ( self, & i8 );
-    }
-    if ( count < 0x10000 )
-    {
-        uint16_t i16 = ( uint16_t ) count;
-        return KMDataNodeWriteB16 ( self, & i16 );
-    }
-    if ( ( count >> 32 ) == 0 )
-    {
-        uint32_t i32 = ( uint32_t ) count;
-        return KMDataNodeWriteB32 ( self, & i32 );
-    }
-    return KMDataNodeWriteB64 ( self, & count );
-}
-
-static
-rc_t VPhysicalSetStaticId ( VPhysical *self )
-{
-    KMDataNode *node;
-    rc_t rc = KMDataNodeOpenNodeUpdate ( self -> knode, & node, "start_id" );
-    if ( rc == 0 )
-    {
-        rc = KMDataNodeWriteId ( node, self -> sstart_id );
-        KMDataNodeRelease ( node );
-
-        if ( rc == 0 )
-        {
-            rc = KMDataNodeOpenNodeUpdate ( self -> knode, & node, "row_count" );
-            if ( rc == 0 )
-            {
-                rc = KMDataNodeWriteCount ( node, self -> sstop_id - self -> sstart_id + 1 );
-                KMDataNodeRelease ( node );
-            }
-        }
-    }
-    return rc;
-}
-
-static
-rc_t VPhysicalWrite ( VPhysical *self, int64_t id, uint32_t cnt )
-{
-    /* read from page space */
-    VBlob *vblob;
-    rc_t rc = VProductionReadBlob ( self -> in, & vblob, id , cnt,NULL);
-    if ( rc == 0 )
-    {
-        /* test for single row in blob */
-        assert ( vblob != NULL );
-        if ( VBlobIsSingleRow ( vblob ) )
-        {
-            /* new column */
-            if ( self -> knode == NULL && self -> kcol == NULL )
-            {
-                rc = VPhysicalCreateStatic ( self, vblob );
-                TRACK_BLOB ( VBlobRelease, vblob );
-                ( void ) VBlobRelease ( vblob );
-                if ( rc == 0 )
-                    rc = VPhysicalSetStaticId ( self );
-                return rc;
-            }
-
-            /* existing static column */
-            if ( self -> knode != NULL )
-            {
-                /* not allowing both to be active at the same time */
-                assert ( self -> kcol == NULL );
-
-                /* overlapping or adjacent id ranges */
-                assert ( vblob -> start_id <= vblob -> stop_id );
-                if ( vblob -> stop_id + 1 >= self -> sstart_id &&
-                     vblob -> start_id <= self -> sstop_id + 1 )
-                {
-                    /* compare lengths */
-                    if ( self -> fixed_len == PageMapGetIdxRowInfo ( vblob -> pm, 0, NULL ) )
-                    {
-                        /* compare bits */
-                        assert ( KDataBufferBits ( & self -> srow ) == KDataBufferBits ( & vblob -> data ) );
-                        if ( bitcmp ( self -> srow . base, self -> srow . bit_offset,
-                                      vblob -> data . base, vblob -> data . bit_offset,
-                                      KDataBufferBits ( & self -> srow ) ) == 0 )
-                        {
-                            /* it's fine */
-                            if ( vblob -> start_id < self -> sstart_id )
-                                self -> sstart_id = vblob -> start_id;
-                            if ( vblob -> stop_id > self -> sstop_id )
-                                self -> sstop_id = vblob -> stop_id;
-
-                            TRACK_BLOB ( VBlobRelease, vblob );
-                            ( void ) VBlobRelease ( vblob );
-
-                            return VPhysicalSetStaticId ( self );
-                        }
-                    }
-                }
-            }
-        }
-
-        /* At this point we can no longer be a static row:
-         * the current blob might have been more than a single row, or
-         * it might have been unable to extend range of static as a single row */
-        if ( self -> knode != NULL )
-            rc = VPhysicalConvertStatic ( self );
-
-        /* need to write to KColumn */
-        if ( rc == 0 )
-        {
-            /* not allowing both knode and kcol to be active at the same time */
-            assert ( self -> knode == NULL );
-
-            /* create KColumn if necessary */
-            if ( self -> kcol == NULL )
-                rc = VPhysicalCreateKColumn ( self );
-
-            /* pull through encoding */
-            if ( rc == 0 )
-            {
-                TRACK_BLOB ( VBlobRelease, vblob );
-                ( void ) VBlobRelease ( vblob );
-                rc = VProductionReadBlob ( self -> b2s, & vblob, id, cnt,NULL );
-                if ( rc == 0 )
-                {
-                    /* write encoded blob to physical */
-                    rc = VPhysicalWriteKColumn ( self, vblob );
-                }
-            }
-        }
-
-        TRACK_BLOB ( VBlobRelease, vblob );
-        ( void ) VBlobRelease ( vblob );
-    }
-
-    return rc;
-}
-
-/* Read
- *  get the blob
- */
-rc_t VPhysicalRead ( VPhysical *self, VBlob **vblob, int64_t id, uint32_t cnt, uint32_t elem_bits )
-{
-    /* use this as the chance to read from input */
-    if ( self -> in != NULL )
-    {
-        rc_t rc = VPhysicalWrite ( self, id, cnt );
-        if ( rc != 0 )
-        {
-            * vblob = NULL;
-            return rc;
-        }
-    }
-
-    /* now let read-side do its work */
-    return VPhysicalReadBlob ( self, vblob, id, elem_bits );
-}
diff --git a/libs/vdb/wprod.c b/libs/vdb/wprod.c
deleted file mode 100644
index dafb8bb..0000000
--- a/libs/vdb/wprod.c
+++ /dev/null
@@ -1,439 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#define TRACK_REFERENCES 0
-
-#define KONST const
-#include "prod-priv.h"
-#include "prod-expr.h"
-#include "schema-priv.h"
-#include "schema-expr.h"
-#include "cursor-priv.h"
-#include "column-priv.h"
-#include "phys-priv.h"
-#undef KONST
-
-#include <vdb/cursor.h>
-#include <klib/symbol.h>
-#include <klib/log.h>
-#include <klib/debug.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-
-/*--------------------------------------------------------------------------
- * VProdResolve
- */
-
-/* ResolveColumn
- *  resolves a column using read/write expression
- */
-rc_t VProdResolveColumnRoot ( const VProdResolve *self,
-    VProduction **out, const SColumn *scol )
-{
-    rc_t rc;
-    WColumn *wcol;
-    VTypedesc desc;
-    const char *name;
-    VCursor *curs = self -> curs;
-    VProduction * in;
-
-    * out = NULL;
-
-    /* decide upon behavior */
-    if ( curs -> read_only )
-    {
-        rc = VProdResolveColumnRead ( self, out, scol );
-        if ( rc == 0 && * out <= FAILED_PRODUCTION )
-            return RC ( rcVDB, rcCursor, rcOpening, rcColumn, rcUndefined );
-        return rc;
-    }
-
-    /* write-only cursor must have existing column */
-    wcol = VCursorCacheGet ( & curs -> col, & scol -> cid );
-    if ( wcol == NULL )
-        return 0;
-
-    /* not intended to be reentrant */
-    assert ( wcol -> val == NULL );
-
-    /* evaluate input expression */
-    if ( scol -> validate == NULL )
-    {
-        /* use normal read expression */
-        rc = VProdResolveColumnRead ( self, &in, scol );
-    }
-    else
-    {
-        VFormatdecl fd;
-        
-        /* create fmtdecl from typedecl */
-        memset ( & fd, 0, sizeof fd );
-
-        VDB_DEBUG ( ( "resolving column '%N' validate expression.\n", scol -> name ) );
-
-        /* use validation expression */
-        rc = VProdResolveExpr ( self, &in, & desc, & fd, scol -> validate, false );
-    }
-
-    /* check failures */
-    if ( rc != 0 )
-    {
-        VDB_DEBUG ( ( "failed to resolve column '%N' - %R.\n", scol -> name, rc ) );
-        return rc;
-    }
-    if ( in <= FAILED_PRODUCTION )
-    {
-        VDB_DEBUG ( ( "failed to resolve column '%N' - NULL or failed production.\n", scol -> name ) );
-        return RC ( rcVDB, rcCursor, rcOpening, rcColumn, rcUndefined );
-    }
-
-    /* column name */
-    name = scol -> name -> name . addr;
-
-    /* pick up production */
-    if ( scol -> validate != NULL )
-    {
-        rc = VSimpleProdMake ( & wcol -> val, self -> owned, self -> curs,
-            prodSimpleCast, name, NULL, NULL, NULL, in, chainDecoding );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    /* create implicit comparison function */
-    else
-    {
-        /* need an output production */
-        if ( wcol -> out == NULL )
-        {
-            rc = VColumnProdMake ( & wcol -> out, self -> owned,
-                & wcol -> dad, prodColumnOut, name );
-            if ( rc != 0 )
-                return rc;
-        }
-
-        /* create comparison func */
-        rc = VFunctionProdMakeBuiltInComp ( & wcol -> val, self -> owned,
-            name, self, wcol -> out, in );
-        if ( rc != 0 )
-            return rc;
-    }
-
-    /* install trigger */
-    rc = VectorAppend ( & curs -> trig, NULL, wcol -> val );
-    if ( rc == 0 )
-        * out = wcol -> val;
-
-    return rc;
-}
-
-rc_t VProdResolveColumn ( const VProdResolve *self,
-    VProduction **out, const SColumn *scol, bool alt )
-{
-    rc_t rc;
-    VColumn *vcol;
-    WColumn *wcol;
-    VCursor *curs = self -> curs;
-
-    /* decide upon behavior */
-    if ( curs -> read_only )
-    {
-        if ( alt )
-        {
-            /* TODO: Generate warning message */
-            return RC ( rcVDB, rcCursor, rcOpening, rcSchema, rcInvalid );
-        }
-        vcol = VCursorCacheGet ( & curs -> col, & scol -> cid );
-        if ( vcol == NULL )
-        {
-            rc = VCursorMakeColumn ( curs, & vcol, scol, self -> cx_bind );
-            if ( rc != 0 )
-                return rc;
-
-#if OPEN_COLUMN_ALTERS_ROW
-            rc = VectorAppend ( & curs -> row, & vcol -> ord, vcol );
-            if ( rc != 0 )
-            {
-                VColumnWhack ( vcol, NULL );
-                return rc;
-            }
-#endif
-            rc = VCursorCacheSet ( & curs -> col, & scol -> cid, vcol );
-            if ( rc != 0 )
-            {
-#if OPEN_COLUMN_ALTERS_ROW
-                void *ignore;
-                VectorSwap ( & curs -> row, vcol -> ord, NULL, & ignore );
-                vcol -> ord = 0;
-#endif
-                VColumnWhack ( vcol, NULL );
-                return rc;
-            }
-        }
-
-        return VProdResolveColumnRead ( self, out, scol );
-    }
-
-    /* write cursor but read side */
-    if ( self -> chain == chainDecoding )
-    {
-        if ( alt )
-        {
-            /* TODO: Generate warning message */
-            return RC ( rcVDB, rcCursor, rcOpening, rcSchema, rcInvalid );
-        }
-
-        return VProdResolveColumnRead ( self, out, scol );
-    }
-
-    /* get existing column */
-    wcol = VCursorCacheGet ( & curs -> col, & scol -> cid );
-    if ( wcol == NULL )
-    {
-        /* normally write-only cursor must have existing column */
-        if ( ! self -> discover_writable_columns )
-            return 0;
-
-        /* auto-create writable column for purposes of discovery */
-        if ( scol -> read_only )
-            return 0;
-        rc = VCursorMakeColumn ( curs, & vcol, scol, self -> cx_bind );
-        if ( rc != 0 )
-            return rc;
-
-        /* add it to the row as if user had done it */
-        rc = VectorAppend ( & curs -> row, & vcol -> ord, vcol );
-        if ( rc == 0 )
-        {
-            /* add it to the indexed vector */
-            rc = VCursorCacheSet ( & curs -> col, & scol -> cid, vcol );
-            if ( rc != 0 )
-            {
-                void *ignore;
-                VectorSwap ( & curs -> row, vcol -> ord, NULL, & ignore );
-                vcol -> ord = 0;
-            }
-        }
-
-        if ( rc != 0 )
-        {
-            VColumnWhack ( vcol, NULL );
-            return rc;
-        }
-
-        wcol = ( WColumn* ) vcol;
-    }
-
-    /* create output production as required */
-    if ( wcol -> out == NULL )
-    {
-        const char *name = scol -> name -> name . addr;
-        rc = VColumnProdMake ( & wcol -> out, self -> owned,
-            & wcol -> dad, prodColumnOut, name );
-        if ( rc != 0 )
-            return rc;
-    }
-    if ( alt )
-    {
-        * out = wcol -> dad . in;
-        assert ( * out != NULL );
-    }
-    else
-    {
-        * out = wcol -> out;
-    }
-    return 0;
-}
-
-/* ResolvePhysical
- *  resolves a physical column
- */
-static
-rc_t VProdResolvePhysicalWrite ( const VProdResolve *self, VPhysical *phys )
-{
-    VTypedesc desc;
-    VFormatdecl fd;
-    VProdResolve pr;
-    VProduction *prod;
-    VCursor *curs = self -> curs;
-
-    const char *name;
-    const SExpression *enc;
-    const SPhysMember *smbr;
-
-    /* open the physical column for write
-       load column metadata/schema, complete
-       physical member description. */
-    rc_t rc = VPhysicalOpenWrite ( phys,
-        ( VSchema* ) self -> schema, curs -> tbl );
-    if ( rc != 0 )
-        return rc;
-
-    /* there are two conditions under which a physical member
-       definition would be incommplete prior to opening the
-       column: 1) if the physical column were only forwarded
-       within table schema, or 2) if the column were added as
-       the result of a file system scan.
-
-       for the column to be writable, it must have had a complete
-       member definition from table schema, with a type and an
-       assignment expression, or it must have been added as the
-       result of an fs scan with a simple reciprocal expression.
-       the test for these two cases is for a resolved typedecl
-       and an assignment expression. */
-
-    /* nothing more to do if column does not exist
-       and member was undeclared, or is declared read-only */
-    smbr = phys -> smbr;
-    if ( smbr -> td . type_id == 0 || smbr -> expr == NULL )
-        return 0;
-
-    /* build fmtdecl */
-    fd . td = smbr -> td;
-    fd . fmt = 0;
-
-    /* shift to encode chain */
-    pr = * self;
-    pr . chain = chainEncoding;
-
-    /* resolve the input expression */
-    rc = VProdResolveExpr ( & pr, & phys -> in, & desc, & fd, smbr -> expr, false );
-    if ( rc == 0 && phys -> in == NULL )
-        return RC ( rcVDB, rcCursor, rcOpening, rcColumn, rcUndefined );
-
-    /* NB - at this point, fd and desc
-       represent the column's well-defined type */
-
-    /* member name */
-    name = smbr -> name -> name . addr;
-
-    /* physical encoding */
-    enc = phys -> enc;
-    if ( enc == NULL )
-        enc = smbr -> type;
-
-    /* build encoding schema in steps:
-         in <- page-to-blob
-    */
-    rc = VSimpleProdMake ( & prod, pr . owned,  pr . curs,
-        prodSimplePage2Blob, name, & fd, & desc, NULL, phys -> in, chainEncoding );
-    if ( rc == 0 && enc != NULL )
-    {
-        /* in <- p2b <- encoding-func */
-        pr . blobbing = true;
-        rc = VProdResolveEncodingExpr ( & pr, & prod,
-            prod, ( const SPhysEncExpr* ) enc );
-        if ( rc == 0 )
-        {
-            fd = prod -> fd;
-            desc = prod -> desc;
-        }
-    }
-    if ( rc == 0 )
-    {
-        rc = VSimpleProdMake ( & phys -> b2s, pr . owned, pr . curs,
-            prodSimpleBlob2Serial, name, & fd, & desc, NULL, prod, chainEncoding );
-    }
-
-    return rc;
-}
-
-rc_t VProdResolvePhysical ( const VProdResolve *self, VPhysical *phys )
-{
-    /* build encoding chain if writable cursor */
-    if ( ! self -> curs -> read_only )
-    {
-        rc_t rc = VProdResolvePhysicalWrite ( self, phys );
-        if ( rc != 0 || self -> discover_writable_columns )
-            return rc;
-    }
-
-    /* build decoding chain */
-    return VProdResolvePhysicalRead ( self, phys );
-}
-
-/*--------------------------------------------------------------------------
- * VColumnProd
- *  message redirect to VColumn
- */
-
-rc_t VColumnProdMake ( VProduction **prodp, Vector *owned,
-    VColumn *col, int sub, const char *name )
-{
-    const SColumn *scol = col -> scol;
-
-    /* why was this changed to get the column td from SColumn? */
-    VTypedesc desc;
-    rc_t rc = VSchemaDescribeTypedecl ( col -> schema,
-        & desc, & col -> scol -> td );
-    if ( rc != 0 )
-        * prodp = NULL;
-    else
-    {
-        VColumnProd *prod;
-
-        /* construct an fd because column does not have one */
-        VFormatdecl fd;
-        fd . td = scol -> td;
-        fd . fmt = 0;
-
-        rc = VProductionMake ( prodp, owned, sizeof * prod,
-            prodColumn, sub, name, & fd, & desc, NULL, chainEncoding );
-        if ( rc == 0 )
-        {
-            prod = ( VColumnProd* ) * prodp;
-            prod -> col = col;
-        }
-    }
-    return rc;
-}
-
-void VColumnProdDestroy ( VColumnProd *self )
-{
-}
-
-
-/* Read
- */
-rc_t VColumnProdRead ( VColumnProd *self, struct VBlob **vblob, int64_t id )
-{
-    WColumn *wcol = ( WColumn* ) self -> col;
-
-    switch ( self -> dad . sub )
-    {
-    case prodColumnOut:
-        return WColumnReadBlob ( wcol, vblob, id );
-    }
-
-    return RC ( rcVDB, rcColumn, rcReading, rcProduction, rcCorrupt );
-}
diff --git a/libs/vdb/wtable.c b/libs/vdb/wtable.c
deleted file mode 100644
index 6a6b2ef..0000000
--- a/libs/vdb/wtable.c
+++ /dev/null
@@ -1,987 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-#include "table-priv.h"
-#include "cursor-priv.h"
-#include "dbmgr-priv.h"
-#include "schema-priv.h"
-#include "schema-parse.h"
-#include "schema-dump.h"
-#include "database-priv.h"
-#include "linker-priv.h"
-
-#include <vdb/schema.h>
-#include <vdb/cursor.h>
-#include <vdb/vdb-priv.h>
-#include <kdb/manager.h>
-#include <kdb/database.h>
-#include <kdb/table.h>
-#include <kdb/index.h>
-#include <kdb/column.h>
-#include <kdb/meta.h>
-#include <kdb/namelist.h>
-#include <klib/symbol.h>
-#include <klib/debug.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-/*--------------------------------------------------------------------------
- * VTable
- *  a collection of columns indexed by row id, metadata, indices
- */
-
-
-/* StoreSchema
- *  stores schema definition in metadata
- *
- *  <schema name="">...</schema>
- */
-LIB_EXPORT rc_t VTableStoreSchema ( VTable *self )
-{
-    /* open schema node */
-    KMDataNode *node;
-    rc_t rc = KMetadataOpenNodeUpdate ( self -> meta, & node, "schema" );
-    if ( rc == 0 )
-    {
-        size_t num_writ;
-        char expr [ 256 ];
-        rc = VSchemaToText ( self -> schema, expr, sizeof expr - 1, & num_writ,
-            "%N%V", self -> stbl -> name, self -> stbl -> version );
-        if ( rc != 0 )
-            LOGERR ( klogInt, rc, "failed to determine table schema" );
-        else
-        {
-            expr [ num_writ ] = 0;
-
-            /* if table has a default view declaration,
-               store the table information under a new attribute */
-            if ( self -> stbl -> dflt_view != NULL )
-            {
-                uint32_t type;
-                const SNameOverload *name;
-                const STable *view = VSchemaFind ( self -> schema, & name, & type,
-                    self -> stbl -> dflt_view-> addr, __func__, false );
-                if ( view == NULL )
-                {
-                    rc = RC ( rcVDB, rcTable, rcUpdating, rcSchema, rcNotFound );
-                    PLOGERR ( klogInt, ( klogInt, rc, "failed to locate default view schema '$(expr)'",
-                                         "expr=%S", self -> stbl -> dflt_view ));
-                }
-                else
-                {
-                    rc = KMDataNodeWriteAttr ( node, "table", expr );
-                    if ( rc != 0 )
-                        PLOGERR ( klogInt, ( klogInt, rc, "failed to write table type '$(expr)'", "expr=%s", expr ));
-                    else
-                    {
-                        rc = VSchemaToText ( self -> schema, expr, sizeof expr - 1, & num_writ,
-                            "%N%V", view -> name, view -> version );
-                        if ( rc != 0 )
-                            LOGERR ( klogInt, rc, "failed to determine table default view schema" );
-                        else
-                            expr [ num_writ ] = 0;
-                    }
-                }
-            }
-
-            if ( rc == 0 )
-            {
-                rc = KMDataNodeWriteAttr ( node, "name", expr );
-                if ( rc != 0 )
-                    PLOGERR ( klogInt, ( klogInt, rc, "failed to write table name '$(expr)'", "expr=%s", expr ));
-            }
-            if ( rc == 0 )
-            {
-                /* truncate existing schema */
-                rc = KMDataNodeWrite ( node, "", 0 );
-                if ( rc == 0 )
-                {
-                    rc = VSchemaDump ( self -> schema, sdmCompact, expr,
-                        ( rc_t ( CC * ) ( void*, const void*, size_t ) ) KMDataNodeAppend, node );
-                }
-                if ( rc != 0 )
-                    PLOGERR ( klogInt, ( klogInt, rc, "failed to write table schema '$(expr)'", "expr=%s", expr ));
-            }
-        }
-
-        KMDataNodeRelease ( node );
-    }
-    return rc;
-}
-
-
-/* OpenUpdate
- *  finish create operation
- */
-static
-rc_t VTableOpenUpdate ( VTable *self, const char *decl )
-{
-    /* open metadata */
-    rc_t rc = KTableOpenMetadataUpdate ( self -> ktbl, & self -> meta );
-    if ( rc == 0 )
-    {
-        /* open "col" node */
-        rc = KMetadataOpenNodeUpdate ( self -> meta, & self -> col_node, "col" );
-        if ( rc == 0 )
-        {
-            /* fetch stored schema */
-            rc = VTableLoadSchema ( self );
-            if ( rc == 0 )
-            {
-                /* fetch requested schema */
-                const STable *stbl = self -> stbl;
-                if ( decl != NULL && decl [ 0 ] != 0 )
-                {
-                    uint32_t type;
-                    const SNameOverload *name;
-
-                    if ( self -> db != NULL )
-                    {
-                        const STblMember *mbr = SDatabaseFind ( self -> db -> sdb,
-                            self -> schema, & name, & type, decl, "VTableOpenUpdate" );
-                        if ( mbr == NULL || type != eTblMember )
-                        {
-                            PLOGMSG ( klogWarn, ( klogWarn, "expression '$(expr)' is not a table member",
-                                       "expr=%s", decl ));
-                            stbl = NULL;
-                        }
-                        else
-                        {
-                            stbl = mbr -> tbl;
-                            assert ( stbl != NULL );
-                        }
-                    }
-                    else
-                    {
-                        stbl = VSchemaFind ( self -> schema,
-                            & name, & type, decl, "VTableOpenUpdate", true );
-                        if ( stbl != NULL && type != eTable )
-                        {
-                            PLOGMSG ( klogWarn, ( klogWarn, "expression '$(expr)' is not a table",
-                                       "expr=%s", decl ));
-                            stbl = NULL;
-                        }
-                    }
-                }
-
-                /* error if the two definitions differ */
-                if ( stbl != NULL && self -> stbl != NULL && stbl != self -> stbl )
-                    rc = RC ( rcVDB, rcTable, rcOpening, rcSchema, rcIncorrect );
-                else if ( stbl == NULL && self -> stbl == NULL )
-                    rc = RC ( rcVDB, rcTable, rcOpening, rcSchema, rcNotFound );
-                else if ( self -> stbl == NULL )
-                {
-
-                    /* write schema to metadata */
-                    self -> stbl = stbl;
-                    rc = VTableStoreSchema ( self );
-                }
-                else if ( stbl != NULL )
-                {
-                    /* use latest schema but don't overwrite in metadata */
-                    self -> stbl = stbl;
-                }
-            }
-        }
-    }
-
-    DBGMSG(DBG_VDB, DBG_FLAG(DBG_VDB_VDB), ("VTableOpenUpdate = %d\n", rc));
-
-    return rc;
-}
-
-
-/* CreateTable
- *  create a new or open an existing table using manager
- *
- *  "tbl" [ OUT ] - return parameter for newly opened table
- *
- *  "schema" [ IN ] - schema object containg table
- *  declaration to be used in creating tbl.
- *
- *  "typespec" [ IN ] - type and optionally version of table schema,
- *  e.g. 'MY_NAMESPACE:MyTable' or 'MY_NAMESPACE:MyTable#1.1'
- *
- *  "cmode" [ IN ] - creation mode
- *
- *  "path" [ IN ] - NUL terminated string in
- *  wd-native character set giving path to table
- */
-LIB_EXPORT rc_t CC VDBManagerVCreateTable ( VDBManager *self, VTable **tblp,
-    const VSchema *schema, const char *typespec,
-    KCreateMode cmode, const char *path, va_list args )
-{
-    rc_t rc;
-
-    if ( tblp == NULL )
-        rc = RC ( rcVDB, rcMgr, rcCreating, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcMgr, rcCreating, rcSelf, rcNull );
-        else if ( schema == NULL )
-            rc = RC ( rcVDB, rcMgr, rcOpening, rcSchema, rcNull );
-        else if ( typespec == NULL )
-            rc = RC ( rcVDB, rcMgr, rcOpening, rcName, rcNull );
-        else if ( typespec [ 0 ] == 0 )
-            rc = RC ( rcVDB, rcMgr, rcOpening, rcName, rcEmpty );
-        else
-        {
-            /* create object with new schema */
-            rc = VTableMake ( tblp, self, NULL, schema );
-            if ( rc == 0 )
-            {
-                VTable *tbl = * tblp;
-
-                /* create physical object */
-                rc = KDBManagerVCreateTable ( self -> kmgr, & tbl -> ktbl, cmode, path, args );
-                if ( rc == 0 )
-                {
-                    rc = VTableOpenUpdate ( tbl, typespec );
-                    if ( rc == 0 )
-                    {
-#if LAZY_OPEN_COL_NODE
-                        KMDataNodeRelease ( tbl -> col_node );
-                        tbl -> col_node = NULL;
-#endif
-                        return 0;
-                    }
-
-                    rc = ResetRCContext ( rc, rcVDB, rcMgr, rcCreating );
-                }
-                VTableWhack ( tbl );
-            }
-        }
-
-        * tblp = NULL;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VDBManagerCreateTable ( VDBManager *self, VTable **tbl,
-    const VSchema *schema, const char *typespec,
-    KCreateMode cmode, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = VDBManagerVCreateTable ( self, tbl, schema, typespec, cmode, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-/* CreateTable
- *  create a new or open an existing table under database
- *
- *  "tbl" [ OUT ] - return parameter for newly opened table
- *
- *  "member" [ IN ] - name of table member template under database
- *  the named member is a table template rather than a named table.
- *
- *  "cmode" [ IN ] - creation mode
- *
- *  "name" [ IN ] - NUL terminated string in
- *  db-native character set giving actual table name
- */
-LIB_EXPORT rc_t CC VDatabaseVCreateTable ( VDatabase *self, VTable **tblp,
-    const char *member, KCreateMode cmode, const char *name, va_list args )
-{
-    rc_t rc;
-
-    if ( tblp == NULL )
-        rc = RC ( rcVDB, rcDatabase, rcCreating, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcDatabase, rcCreating, rcSelf, rcNull );
-        else if ( member == NULL )
-            rc = RC ( rcVDB, rcMgr, rcOpening, rcName, rcNull );
-        else if ( member [ 0 ] == 0 )
-            rc = RC ( rcVDB, rcMgr, rcOpening, rcName, rcEmpty );
-        else if ( self -> read_only )
-            rc = RC ( rcVDB, rcDatabase, rcCreating, rcDatabase, rcReadonly );
-        else
-        {
-            rc = VTableMake ( tblp, self -> mgr, self, self -> schema );
-            if ( rc == 0 )
-            {
-                VTable *tbl = * tblp;
-
-                rc = KDatabaseVCreateTable ( self -> kdb, & tbl -> ktbl, cmode, name, args );
-                if ( rc == 0 )
-                {
-                    rc = VTableOpenUpdate ( tbl, member );
-                    if ( rc == 0 )
-                    {
-                        tbl -> pgsize = self -> pgsize;
-                        tbl -> cmode = self -> cmode;
-                        tbl -> checksum = self -> checksum;
-#if LAZY_OPEN_COL_NODE
-                        KMDataNodeRelease ( tbl -> col_node );
-                        tbl -> col_node = NULL;
-#endif
-                        return 0;
-                    }
-
-                    rc = ResetRCContext ( rc, rcVDB, rcDatabase, rcCreating );
-                }
-
-                VTableWhack ( tbl );
-            }
-        }
-
-        * tblp = NULL;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VDatabaseCreateTable ( VDatabase *self, VTable **tbl,
-    const char *member, KCreateMode cmode, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = VDatabaseVCreateTable ( self, tbl, member, cmode, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* OpenTableUpdate
- * VOpenTableUpdate
- *  open a table for read/write
- *
- *  "tbl" [ OUT ] - return parameter for newly opened table
- *
- *  "name" [ IN ] - NUL terminated string in UTF-8 giving name of table
- */
-LIB_EXPORT rc_t CC VDBManagerVOpenTableUpdate ( VDBManager *self, VTable **tblp,
-    const VSchema *schema, const char *path, va_list args )
-{
-    rc_t rc;
-
-    if ( tblp == NULL )
-        rc = RC ( rcVDB, rcMgr, rcOpening, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcMgr, rcOpening, rcSelf, rcNull );
-        else
-        {
-            /* if no schema is given, always pass intrinsic */
-            if ( schema == NULL )
-                schema = self -> schema;
-
-            rc = VTableMake ( tblp, self, NULL, schema );
-            if ( rc == 0 )
-            {
-                VTable *tbl = * tblp;
-                rc = KDBManagerVOpenTableUpdate ( self -> kmgr, & tbl -> ktbl, path, args );
-                if ( rc == 0 )
-                {
-                    rc = VTableOpenUpdate ( tbl, NULL );
-                    if ( rc == 0 )
-                    {
-#if LAZY_OPEN_COL_NODE
-                        KMDataNodeRelease ( tbl -> col_node );
-                        tbl -> col_node = NULL;
-#endif
-                        return 0;
-                    }
-                }
-                VTableWhack ( tbl );
-            }
-        }
-        * tblp = NULL;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VDBManagerOpenTableUpdate ( VDBManager *self,
-    VTable **tbl, const VSchema *schema, const char *path, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, path );
-    rc = VDBManagerVOpenTableUpdate ( self, tbl, schema, path, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VDatabaseVOpenTableUpdate ( VDatabase *self,
-    VTable **tblp, const char *name, va_list args )
-{ 
-    rc_t rc;
-
-    if ( tblp == NULL )
-        rc = RC ( rcVDB, rcDatabase, rcOpening, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcDatabase, rcOpening, rcSelf, rcNull );
-        else
-        {
-            rc = VTableMake ( tblp, self -> mgr, self, self -> schema );
-            if ( rc == 0 )
-            {
-                VTable *tbl = * tblp;
-
-                rc = KDatabaseVOpenTableUpdate ( self -> kdb, & tbl -> ktbl, name, args );
-                if ( rc == 0 )
-                {
-                    rc = VTableOpenUpdate ( tbl, NULL );
-                    if ( rc == 0 )
-                    {
-#if LAZY_OPEN_COL_NODE
-                        KMDataNodeRelease ( tbl -> col_node );
-                        tbl -> col_node = NULL;
-#endif
-                        return 0;
-                    }
-                }
-
-                VTableWhack ( tbl );
-            }
-        }
-
-        * tblp = NULL;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VDatabaseOpenTableUpdate ( VDatabase *self, VTable **tbl, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = VDatabaseVOpenTableUpdate ( self, tbl, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* Lock
- *  apply lock
- *
- *  if object is already locked, the operation is idempotent
- *  and returns an rc state of rcLocked
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptIndex and kptColumn
- *
- *  "path" [ IN ] - NUL terminated path
- */
-LIB_EXPORT rc_t CC VTableVLock ( VTable *self, uint32_t type, const char * name, va_list args )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcTable, rcLocking, rcSelf, rcNull );
-    else
-        rc = KTableVLock ( self -> ktbl, type, name, args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VTableLock ( VTable *self, uint32_t type, const char * name, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, name );
-
-    rc = VTableVLock ( self, type, name, args );
-
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* Unlock
- *  remove lock
- *
- *  if object is already unlocked, the operation is idempotent
- *  and returns an rc state of rcUnlocked
- *
- *  "type" [ IN ] - a KDBPathType
- *  valid values are kptIndex and kptColumn
- *
- *  "path" [ IN ] - NUL terminated path
- */
-LIB_EXPORT rc_t CC VTableVUnlock ( VTable *self, uint32_t type,
-    const char * name, va_list args )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcTable, rcUnlocking, rcSelf, rcNull );
-    else
-        rc = KTableVUnlock ( self -> ktbl, type, name, args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VTableUnlock ( VTable *self, uint32_t type,
-    const char * name, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, name );
-
-    rc = VTableVUnlock ( self, type, name, args );
-
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* OpenMetadataUpdate
- *  opens metadata file
- *
- *  "meta" [ OUT ] - return parameter for metadata
- */
-LIB_EXPORT rc_t CC VTableOpenMetadataUpdate ( VTable *self, struct KMetadata **meta )
-{
-    rc_t rc;
-    if ( meta == NULL )
-        rc = RC ( rcVDB, rcTable, rcOpening, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcTable, rcOpening, rcSelf, rcNull );
-        else
-        {
-            * meta = self -> meta;
-            return KMetadataAddRef ( self -> meta );
-        }
-
-        * meta = NULL;
-    }
-
-    return rc;
-}
-
-
-/* CreateIndex
- * VCreateIndex
- *  create a new or open an existing index
- *
- *  "idx" [ OUT ] - return parameter for newly opened index
- *
- *  "type" [ IN ] - type of index to create
- *
- *  "cmode" [ IN ] - creation mode
- *
- *  "name" [ IN ] - NUL terminated string in UTF-8 giving simple name of idx
- */
-LIB_EXPORT rc_t CC VTableCreateIndex ( VTable *self, struct KIndex **idx,
-    KIdxType type, KCreateMode cmode, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = VTableVCreateIndex ( self, idx, type, cmode, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VTableVCreateIndex ( VTable *self, struct KIndex **idx,
-    KIdxType type, KCreateMode cmode, const char *name, va_list args )
-{
-    if ( self != NULL )
-        return KTableVCreateIndex ( self -> ktbl, idx, type, cmode, name, args );
-
-    if ( idx == NULL )
-        return RC ( rcVDB, rcTable, rcCreating, rcParam, rcNull );
-
-    return RC ( rcVDB, rcTable, rcCreating, rcSelf, rcNull );
-}
-
-
-/* OpenIndexUpdate
- * VOpenIndexUpdate
- *  open an index for read/write
- *
- *  "idx" [ OUT ] - return parameter for newly opened index
- *
- *  "name" [ IN ] - NUL terminated string in UTF-8 giving simple name of idx
- */
-
-LIB_EXPORT rc_t CC VTableOpenIndexUpdate ( VTable *self,
-    struct KIndex **idx, const char *name, ... )
-{
-    rc_t rc;
-    va_list args;
-
-    va_start ( args, name );
-    rc = VTableVOpenIndexUpdate ( self, idx, name, args );
-    va_end ( args );
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VTableVOpenIndexUpdate ( VTable *self,
-    struct KIndex **idx, const char *name, va_list args )
-{
-    if ( self != NULL )
-        return KTableVOpenIndexUpdate ( self -> ktbl, idx, name, args );
-
-    if ( idx == NULL )
-        return RC ( rcVDB, rcTable, rcOpening, rcParam, rcNull );
-
-    return RC ( rcVDB, rcTable, rcOpening, rcSelf, rcNull );
-}
-
-
-/* ListColumns
- *  list writable column names
- *
- *  "names" [ OUT ] - return parameter for namelist
- *
- *  availability: v2.1
- */
-static
-rc_t list_writable_columns ( VTable *self )
-{
-    rc_t rc;
-    VCursor *curs;
-
-    if ( self -> read_only )
-    {
-        self -> write_col_cache_valid = true;
-        return 0;
-    }
-
-    rc = VTableCreateCursorWriteInt ( self, & curs, kcmInsert, false );
-    if (  rc == 0 )
-    {
-	/* no need for schema-based triggers to fire **/
-	VCursorSuspendTriggers ( curs );
-        /* let this private VCursor-function list the columns */
-        rc = VCursorListWritableColumns ( curs, & self -> write_col_cache );
-        VCursorRelease ( curs );
-        if ( rc == 0 )
-            self -> write_col_cache_valid = true;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VTableListWritableColumns ( VTable *self, KNamelist **names )
-{
-    rc_t rc;
-
-    if ( names == NULL )
-        rc = RC ( rcVDB, rcTable, rcListing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcTable, rcListing, rcSelf, rcNull );
-        else
-        {
-            if ( ! self -> write_col_cache_valid )
-                rc = list_writable_columns ( self );
-
-            if ( self -> write_col_cache_valid )
-                return make_column_namelist ( & self -> write_col_cache, names );
-        }
-
-        * names = NULL;
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VTableListSeededWritableColumns ( VTable *self,
-    KNamelist **names, const KNamelist *seed )
-{
-    rc_t rc;
-
-    if ( names == NULL )
-        rc = RC ( rcVDB, rcTable, rcListing, rcParam, rcNull );
-    else
-    {
-        * names = NULL;
-
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcTable, rcListing, rcSelf, rcNull );
-        else if ( seed == NULL )
-            rc = RC ( rcVDB, rcTable, rcListing, rcParam, rcNull );
-        else
-        {
-            BSTree cache;
-            BSTreeInit ( & cache );
-
-            rc = 0;
-
-            if ( ! self -> read_only )
-            {
-                VCursor *curs;
-                rc = VTableCreateCursorWriteInt ( self, & curs, kcmInsert, false );
-                if (  rc == 0 )
-                {
-                    /* let this private VCursor-function list the columns */
-                    rc = VCursorListSeededWritableColumns ( curs, & cache, seed );
-                    VCursorRelease ( curs );
-                }
-            }
-
-            if ( rc == 0 )
-                rc = make_column_namelist ( & cache, names );
-
-            BSTreeWhack ( & cache, VColumnRefWhack, NULL );
-        }
-    }
-
-    return rc;
-}
-
-
-/* ListDatatypes
- *  returns list of typedecls for named column
- *
- *  "col" [ IN ] - column name
- *
- *  "dflt_idx" [ OUT, NULL OKAY ] - returns the zero-based index
- *  into "typedecls" of the default datatype for the named column
- *
- *  "typedecls" [ OUT ] - list of datatypes available for named column
- *
- *  availability: v2.1
- */
-LIB_EXPORT rc_t CC VTableListWritableDatatypes ( VTable *self,
-    const char *col, KNamelist **typedecls )
-{
-    rc_t rc;
-    
-    if ( typedecls == NULL )
-        rc = RC ( rcVDB, rcTable, rcListing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcTable, rcListing, rcSelf, rcNull );
-        else if ( col == NULL )
-            rc = RC ( rcVDB, rcSchema, rcListing, rcName, rcNull );
-        else if ( col [ 0 ] == 0 )
-            rc = RC ( rcVDB, rcSchema, rcListing, rcName, rcEmpty );
-        else
-        {
-            if ( ! self -> write_col_cache_valid )
-                rc = list_writable_columns ( self );
-
-            if ( self -> write_col_cache_valid )
-            {
-                uint32_t dummy;
-                return make_column_typelist ( & self -> write_col_cache, col, & dummy, typedecls );
-            }
-        }
-
-        * typedecls = NULL;
-    }
-
-    return rc;
-}
-
-
-/* Reindex
- *  optimize column indices
- */
-LIB_EXPORT rc_t CC VTableReindex ( VTable *self )
-{
-    if ( self == NULL )
-        return RC ( rcVDB, rcTable, rcReindexing, rcSelf, rcNull );
-
-    /* now allow the KTable to do its job */
-    return KTableReindex ( self -> ktbl );
-}
-
-
-/* ColumnCreateParams
- *  sets the creation parameters for physical columns
- *
- *  "cmode" [ IN ] - creation mode
- *
- *  "checksum" [ IN ] - the type of checksum information to
- *  apply when writing blobs
- *
- *  "pgsize" [ IN, DEFAULT ZERO ] - size of internal column "pages"
- *  the default value is indicated by 0 ( zero ).
- *  NB - CURRENTLY THE ONLY SUPPORTED PAGE SIZE IS 1 ( ONE ) BYTE.
- */
-LIB_EXPORT rc_t CC VTableColumnCreateParams ( struct VTable *self,
-    KCreateMode cmode, KChecksum checksum, size_t pgsize )
-{
-    if ( self == NULL )
-        return RC ( rcVDB, rcTable, rcUpdating, rcSelf, rcNull );
-
-    self -> cmode = cmode;
-    self -> checksum = checksum;
-    self -> pgsize = pgsize;
-
-    return 0;
-}
-
-
-/* OpenManager
- *  duplicate reference to manager
- *  NB - returned reference must be released
- */
-LIB_EXPORT rc_t CC VTableOpenManagerUpdate ( VTable *self, struct VDBManager **mgr )
-{
-    rc_t rc;
-
-    if ( mgr == NULL )
-        rc = RC ( rcVDB, rcTable, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcTable, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            rc = VDBManagerAddRef ( self -> mgr );
-            if ( rc == 0 )
-            {
-                * mgr = self -> mgr;
-                return 0;
-            }
-        }
-
-        * mgr = NULL;
-    }
-
-    return rc;
-}
-
-
-/* OpenParent
- *  duplicate reference to parent database
- *  NB - returned reference must be released
- */
-LIB_EXPORT rc_t CC VTableOpenParentUpdate ( VTable *self, struct VDatabase **db )
-{
-    rc_t rc;
-
-    if ( db == NULL )
-        rc = RC ( rcVDB, rcTable, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcTable, rcAccessing, rcSelf, rcNull );
-        else if ( self -> db != NULL && self -> db -> read_only )
-            rc = RC ( rcVDB, rcTable, rcAccessing, rcDatabase, rcReadonly );
-        else
-        {
-            rc = VDatabaseAddRef ( self -> db );
-            if ( rc == 0 )
-            {
-                * db = self -> db;
-                return 0;
-            }
-        }
-
-        * db = NULL;
-    }
-
-    return rc;
-}
-
-/* OpenKTable
- *  returns a new reference to underlying KTable
- */
-LIB_EXPORT rc_t CC VTableOpenKTableUpdate ( VTable *self, KTable **ktbl )
-{
-    rc_t rc;
-
-    if ( ktbl == NULL )
-        rc = RC ( rcVDB, rcTable, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVDB, rcTable, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            * ktbl = self -> ktbl;
-            return KTableAddRef ( * ktbl );
-        }
-
-        * ktbl = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VTableVDropColumn(VTable *self, const char fmt[], va_list args)
-{
-    return KTableVDropColumn(self->ktbl, fmt, args);
-}
-
-LIB_EXPORT rc_t CC VTableDropColumn(VTable *self, const char fmt[], ...)
-{
-    va_list va;
-    rc_t rc;
-    
-    va_start(va, fmt);
-    rc = VTableVDropColumn(self, fmt, va);
-    va_end(va);
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VTableRenameColumn ( struct VTable *self, bool force,
-    const char *from, const char *to )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcVDB, rcTable, rcAccessing, rcSelf, rcNull );
-    else
-    {
-        rc = KTableRenameColumn ( self->ktbl, force, from, to );
-        if ( GetRCState(rc) == rcNotFound )
-           rc = KMDataNodeRenameChild( self->col_node, from, to );
-    }
-
-    return rc;
-}
-
diff --git a/libs/vdb/xform-priv.h b/libs/vdb/xform-priv.h
deleted file mode 100644
index aaa539b..0000000
--- a/libs/vdb/xform-priv.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*=======================================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#ifndef _h_xform_priv_
-#define _h_xform_priv_
-
-#ifndef _h_vdb_xform_
-#include <vdb/xform.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* VBlobFuncN
- *  works on VBlob objects
- */
-struct VBlob;
-
-enum
-{
-    vftBlobN = vftBlob + 1,
-    vftSelect,
-
-    vftLastFuncProto
-};
-
-/* merge and other internal functions
- *
- * If you return one of your input blobs, ***** ADDREF ***** it.
- */
-typedef rc_t ( CC * VBlobFuncN ) ( void *self, const VXformInfo *info, int64_t row_id,
-    struct VBlob **rslt, uint32_t argc, struct VBlob const *argv [] );
-
-typedef rc_t ( CC * VBlobCompareFunc ) (void *self, const VRowData *input, const VRowData *read);
-
-typedef union VFuncDescInternalFuncs VFuncDescInternalFuncs;
-union VFuncDescInternalFuncs
-{
-    VRowFunc         rf;
-    VNonDetRowFunc   ndf;
-    VFixedRowFunc    pf;
-    VArrayFunc       af;
-    VBlobFunc        bf;
-    VBlobFuncN       bfN;
-    VBlobCompareFunc cf;
-};
-
-#define VFUNCDESC_INTERNAL_FUNCS( DESC ) \
-    ( ( union VFuncDescInternalFuncs * ) ( & ( DESC ) -> u ) )
-
-/* factory declaration with no self parameter */
-#define VTRANSFACT_BUILTIN_IMPL( fact, maj, min, rel ) \
-    VTRANSFACT_IMPL ( fact, maj, min, rel )
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_xform_priv_ */
diff --git a/libs/vfs/Makefile b/libs/vfs/Makefile
deleted file mode 100644
index 12c32af..0000000
--- a/libs/vfs/Makefile
+++ /dev/null
@@ -1,123 +0,0 @@
-# ===========================================================================
-#
-#                            PUBLIC DOMAIN NOTICE
-#               National Center for Biotechnology Information
-#
-#  This software/database is a "United States Government Work" under the
-#  terms of the United States Copyright Act.  It was written as part of
-#  the author's official duties as a United States Government employee and
-#  thus cannot be copyrighted.  This software/database is freely available
-#  to the public for use. The National Library of Medicine and the U.S.
-#  Government have not placed any restriction on its use or reproduction.
-#
-#  Although all reasonable efforts have been taken to ensure the accuracy
-#  and reliability of the software and data, the NLM and the U.S.
-#  Government do not and cannot warrant the performance or results that
-#  may be obtained by using this software or data. The NLM and the U.S.
-#  Government disclaim all warranties, express or implied, including
-#  warranties of performance, merchantability or fitness for any particular
-#  purpose.
-#
-#  Please cite the author in any work or product based on this material.
-#
-# ===========================================================================
-
-default: all
-
-TOP ?= $(shell ../../build/abspath.sh ../..)
-MODULE = libs/vfs
-
-INT_LIBS = \
-	libvfs
-
-ALL_LIBS = \
-	$(INT_LIBS)
-
-TEST_TOOLS = \
-
-include $(TOP)/build/Makefile.env
-
-RWORKDIR=$(TOP)/$(MODULE)
-
-#-------------------------------------------------------------------------------
-# outer targets
-#
-all std: makedirs
-	@ $(MAKE_CMD) $(TARGDIR)/std
-
-$(INT_LIBS): makedirs
-	@ $(MAKE_CMD) $(ILIBDIR)/$@
-
-$(TEST_TOOLS): makedirs
-	@ $(MAKE_CMD) $(TEST_BINDIR)/$@
-
-.PHONY: all std $(ALL_LIBS) $(TEST_TOOLS)
-
-#-------------------------------------------------------------------------------
-# std
-#
-$(TARGDIR)/std: \
-	$(addprefix $(ILIBDIR)/,$(INT_LIBS))
-
-.PHONY: $(TARGDIR)/std
-
-#-------------------------------------------------------------------------------
-# clean
-#
-clean: stdclean
-	@ rm -f $(addsuffix *,$(addprefix $(TEST_BINDIR)/,$(TEST_TOOLS)))
-
-.PHONY: clean
-
-#-------------------------------------------------------------------------------
-# vfs
-#
-$(ILIBDIR)/libvfs: $(addprefix $(ILIBDIR)/libvfs.,$(ILIBEXT))
-
-VFS_SRC_CMN = \
-	syspath \
-	manager  \
-	resolver
-
-VFS_SRC = \
-	path \
-	$(VFS_SRC_CMN)
-
-VFS_OBJ = \
-	$(addsuffix .$(LOBX),$(VFS_SRC))
-
-VFS_LIB = \
-	-lkns \
-	-lkns \
-	-lkrypto \
-	-lkfg \
-	-lkfs \
-	-lklib
-
-$(ILIBDIR)/libvfs.$(LIBX): $(VFS_OBJ)
-	$(LD) --slib -o $@ $^ $(VFS_LIB)
-
-
-
-#-------------------------------------------------------------------------------
-# white-box test
-#
-
-TEST_SRC = \
-	path-test
-
-TEST_OBJ = \
-	$(addsuffix .$(OBJX),$(TEST_SRC)) \
-	$(addsuffix .$(LOBX),$(VFS_SRC_CMN))
-
-TEST_LIB = \
-	-skapp \
-	-skns \
-	-skrypto \
-	-skfg \
-	-skfs \
-	-skproc \
-	-sklib 
-
-$(TEST_BINDIR)/path-test: $(TEST_OBJ)
-	$(LD) --exe -o $@ $^ $(TEST_LIB)
diff --git a/libs/vfs/keyring.c b/libs/vfs/keyring.c
deleted file mode 100644
index f73740a..0000000
--- a/libs/vfs/keyring.c
+++ /dev/null
@@ -1,292 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include "keyring.h"
-
-#include <klib/rc.h>
-#include <klib/refcount.h>
-#include <klib/text.h>
-#include <klib/data-buffer.h>
-#include <klib/log.h>
-
-#include <kns/stream.h>
-#include <kns/endpoint.h>
-#include <kns/socket.h>
-#include <kns/manager.h>
-
-#include <vfs/keyring-priv.h>
-
-#include <sysalloc.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-/*TODO: define protocol messages in a central location */
-/*requests*/
-static const char* shutdownMsg = "\x01X";
-static const char* initMsg     = "\x01I";
-/*responses*/
-static const char* initMsgSuccess = "IY";
-static const char* initMsgFailure = "IN";
-
-#define rcTarget rcNoTarg
-
-#define KEYRING_MAX_PATH 4096
-
-struct KKeyRing
-{
-    KRefcount refcount;
-    
-    char serverDataDir[KEYRING_MAX_PATH];
-
-    bool read_only;
-    bool shutting_down;
-    
-    KStream* ipc;
-};
-
-static
-rc_t CC ShakeHands(KStream* ipc)
-{   /* Send Init message, wait for a response (give new server a chance to ask for password */
-    rc_t rc;
-    LogMsg ( klogInfo, "KeyringClient: sending Init");
-    rc = KStreamWrite(ipc, initMsg, string_size(initMsg), NULL);
-    if (rc == 0)
-    {
-        unsigned char msg_size;
-        size_t numRead = 0;
-        rc = KStreamReadAll(ipc, &msg_size, 1, &numRead);
-        if (rc == 0 && numRead == 1)
-        {
-            char resp[2];
-            if (msg_size == sizeof(resp))
-            {
-                rc = KStreamReadAll(ipc, resp, msg_size, &numRead);
-                if (rc == 0 && numRead == msg_size)
-                {
-                    pLogMsg ( klogInfo, "KeyringClient: received '$(b1)$(b2)'", "b1=%c,b2=%c", resp[0], resp[1] );
-                    if (string_cmp(resp, sizeof(resp), initMsgSuccess, sizeof(initMsgSuccess), msg_size) == 0)
-                        rc = 0;
-                    else if (string_cmp(resp, sizeof(resp), initMsgFailure, sizeof(initMsgFailure), msg_size) == 0)
-                        rc = RC ( rcVFS, rcTarget, rcAttaching, rcParam, rcIncorrect);
-                    else
-                        rc = RC ( rcVFS, rcTarget, rcAttaching, rcMessage, rcUnexpected);
-                }
-                else
-                    LogErr(klogErr, rc, "KeyringClient: KStreamReadAll(2) failed");
-            }
-            else
-            {
-                pLogMsg ( klogInfo, "KeyringClient: received '$(bytes)' bytes, expected 2", "bytes=%d", (int32_t)msg_size );
-                rc = RC ( rcVFS, rcTarget, rcAttaching, rcMessage, rcUnexpected);
-            }
-        }
-        else
-        {
-            pLogMsg ( klogInfo, "KeyringClient: received '$(bytes)' bytes, expected 1", "bytes=%d", (int32_t)numRead );
-            LogErr(klogErr, rc, "KeyringClient: KStreamReadAll(1) failed");
-        }
-    }
-        
-    return rc;
-}
-
-static
-rc_t CC KKeyRingInit(KKeyRing* self, const char* path)
-{
-    rc_t rc = 0;
-    memset(self, 0, sizeof(KKeyRing));
-
-    KRefcountInit ( & self -> refcount, 1, "KKeyRing", "init", "" );
-
-    LogMsg ( klogInfo, "KeyringClient: starting keyring");
-    rc = StartKeyRing(path);
-    LogMsg ( klogInfo, "KeyringClient: keyring started");
-    
-    if (rc == 0)
-    {
-        KNSManager* kns;
-        rc = KNSManagerMake ( &kns );
-        if (rc == 0)
-        {
-            rc_t rc2;
-            KEndPoint ep;
-            String name; 
-            CONST_STRING(&name, KEYRING_IPC_NAME);
-            rc = KNSManagerInitIPCEndpoint(kns, &ep, &name);    
-            if (rc == 0)
-            {
-                LogMsg ( klogInfo, "KeyringClient: caling KNSMakeIPCConnection");
-                rc = KNSManagerMakeIPCConnection ( kns, &self->ipc, &ep, 5 );
-                if (rc == 0)
-                {
-                    LogMsg ( klogInfo, "KeyringClient: KNSMakeIPCConnection successful");
-                    rc = ShakeHands(self->ipc);
-                }
-            }
-            rc2 = KNSManagerRelease(kns);
-            if (rc == 0)
-                rc2 = rc;
-        }
-    }
-    
-    return rc;    
-}
-
-static
-rc_t CC KKeyRingWhack(KKeyRing* self)
-{
-    rc_t rc = 0;
-    rc_t rc2;
-    if (self->ipc != NULL && self->shutting_down)  
-    {    /* send a shutdown message to the server */
-        LogMsg ( klogInfo, "KeyringClient: sending Shutdown");
-        rc = KStreamWrite(self->ipc, shutdownMsg, string_size(shutdownMsg), NULL);
-    }
-        
-    rc2 = KStreamRelease(self->ipc);
-    if (rc == 0)
-        rc = rc2;
-        
-    free(self);
-    
-    return rc;
-}
-
-LIB_EXPORT
-rc_t CC KKeyRingAddRef ( const KKeyRing *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "KKeyRing" ) )
-        {
-        case krefLimit:
-            return RC ( rcVFS, rcTarget, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT 
-rc_t CC KKeyRingRelease ( KKeyRing *self, bool shutdown_server )
-{
-    if ( self != NULL )
-    {
-        if (shutdown_server)
-            self->shutting_down = true; /* request shutdown when refcount reaches 0 */
-            
-        switch ( KRefcountDrop ( & self -> refcount, "KKeyRing" ) )
-        {
-        case krefWhack:
-            return KKeyRingWhack ( ( KKeyRing* ) self );
-        break;
-        case krefLimit:
-            return RC ( rcVFS, rcTarget, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC KKeyRingMakeRead( const KKeyRing** cself, const char* path )
-{
-    KKeyRing** self = (KKeyRing**)cself;
-    rc_t rc = KKeyRingMakeUpdate(self, path);
-    if (rc == 0)
-        (*self)->read_only = true;
-    return rc;
-}
-
-LIB_EXPORT 
-rc_t CC KKeyRingMakeUpdate(KKeyRing** self, const char* path)
-{
-    KKeyRing* obj;
-    rc_t rc;
-    
-    if ( self == NULL )
-        rc = RC ( rcVFS, rcTarget, rcCreating, rcParam, rcNull );
-    else
-    {
-        obj = malloc(sizeof(KKeyRing));
-        if (obj == NULL)
-            rc = RC ( rcVFS, rcTarget, rcCreating, rcMemory, rcExhausted );
-        {
-            rc = KKeyRingInit(obj, path);
-            if (rc == 0)
-               *self = obj;
-            else
-                free(obj);
-        }
-    }
-    
-    return rc;
-}
-
-rc_t CC KKeyRingAddProject(KKeyRing* self, const char* project_key, const char* dl_key, const char* enc_key)
-{
-    rc_t rc = 0;
-    if ( self == NULL )
-        rc = RC ( rcVFS, rcTarget, rcSending, rcSelf, rcNull );
-    else if (project_key == NULL || dl_key == NULL || enc_key == NULL)
-        rc = RC ( rcVFS, rcTarget, rcSending, rcParam, rcNull );
-    else
-    {   /* Project Add: "<uint8 msg_length>PA<uint8 length>name<uint8 length>dl_ticket<uint8 length>enc_key" */
-        size_t pkSize = string_size(project_key);
-        size_t dkSize = string_size(dl_key);
-        size_t ekSize = string_size(enc_key);
-
-        char buf[256];
-        uint8_t msg_size = 2 + sizeof(uint8_t) + pkSize + sizeof(uint8_t) + dkSize + sizeof(uint8_t) + ekSize;
-        if ( 1 + msg_size > sizeof(buf) )
-            rc = RC ( rcVFS, rcTarget, rcSending, rcSize, rcExcessive );
-        else
-        {
-            size_t idx = 0;
-        
-            buf[0] = msg_size; ++idx;
-
-            buf[idx]='P'; ++idx;
-            buf[idx]='A'; ++idx;
-            
-            buf[idx] = (char)pkSize; ++idx;
-            string_copy(buf + idx, sizeof(buf)-idx, project_key, pkSize);
-            idx += pkSize;
-            
-            buf[idx] = (char)dkSize; ++idx;
-            string_copy(buf + idx, sizeof(buf)-idx, dl_key, dkSize);
-            idx += dkSize;
-            
-            buf[idx] = (char)ekSize; ++idx;
-            string_copy(buf + idx, sizeof(buf)-idx, enc_key, ekSize);
-            idx += ekSize;
-            
-            assert(idx == msg_size + 1);
-            rc = KStreamWrite(self->ipc, buf, idx, NULL);
-        }
-    }
-    return rc;
-        
-}
-
diff --git a/libs/vfs/keyring.h b/libs/vfs/keyring.h
deleted file mode 100644
index b1140ee..0000000
--- a/libs/vfs/keyring.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_vfs_keyring_
-#define _h_vfs_keyring_
-
-#ifndef _h_vfs_extern_
-#include <vfs/extern.h>
-#endif
-
-#ifndef _h_klib_defs_
-#include <klib/defs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* 
- * API for clients of a client/server KeyRing implementation.
- * Client code can use this interface and fall back to using KKeyStore in some cases, e.g. to work with a project that has not been
- * added to the keyring. This can be done behind KKeyRing interface (would have to define an object naming scheme that is compatible 
- * with project-id/type/object-id), or explicitly in the client code.
- */
-typedef struct KKeyRing KKeyRing;
- 
- /* Make
- * Open an IPC connection to a keyring server. Will start the server if none is running.
- * KKeyRingMakeRead will reject Add/Delete operations 
- * dataDir [ IN, NULL OK ] = path to the directory with keyring database. NULL - use default location (~/.ncbi)
- */
-VFS_EXTERN rc_t CC KKeyRingMakeRead( const KKeyRing** self, const char* dataDir );
-VFS_EXTERN rc_t CC KKeyRingMakeUpdate( KKeyRing** self, const char* dataDir );
-
- /* AddRef
- * Release
- *
- * shutdown_server [ IN ] - if this is the last reference, send a Shutdown message to server before closing the IPC connection.
- * This will not necessarily shut down the server immediately; if there are other active connections, the server will wait for them to close first.
- * Use KKeyRingIsServerRunning() to check it the server is down.
- */
-VFS_EXTERN rc_t CC KKeyRingAddRef ( const KKeyRing *self );
-VFS_EXTERN rc_t CC KKeyRingRelease ( KKeyRing *self, bool shutdown_server );
- 
-/* 
- * retrieving download/encyprtion keys
- */
-VFS_EXTERN rc_t CC KKeyRingGetDownloadTicket(const KKeyRing* self, const char* project_key, const char** dl_key);
-VFS_EXTERN rc_t CC KKeyRingGetProjectEncryptionKey(const KKeyRing* self, const char* project_key, const char** enc_key);
-
-/*
- * managing projects 
-*/                                                   
-VFS_EXTERN rc_t CC KKeyRingAddProject(KKeyRing* self, const char* project_key, const char* dl_key, const char* enc_key);
-VFS_EXTERN rc_t CC KKeyRingDeleteProject(KKeyRing* self, const char* project_key); /* will delete all associated objects */
-
-/*
- * managing objects
- */
-VFS_EXTERN rc_t CC KKeyRingAddObject(KKeyRing* self, 
-                                      const char* project_key, uint8_t object_type, const char* object_key,
-                                      const char* display_name, uint64_t size, const char* checksum);
-VFS_EXTERN rc_t CC KKeyRingDeleteObject(KKeyRing* self, 
-                                         const char* project_key, uint8_t object_type, const char* object_key);
-
-/* KKeyRingReencrypt
- * Server can refuse to reencrypt if it detects other active servers.
- */
-VFS_EXTERN rc_t CC KKeyRingReencrypt(KKeyRing** self, const char* new_passwd); 
-
- /* IsServerRunning
- * dataDir [ IN, NULL OK ] = path to the directory with keyring database. NULL - use default location (~/.ncbi)
- */
-VFS_EXTERN bool CC KKeyRingIsServerRunning(const char* dataDir);
-
-/* 
- * private API for libkrypto 
- */
-
-VFS_EXTERN rc_t CC KKeyRingGetObjectEncryptionKey(const KKeyRing* self, const char* project_key, 
-                                                   uint8_t object_type, const char* object_key, const char** enc_key);
-
-                                                   
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_vfs_keyring_ */
diff --git a/libs/vfs/manager.c b/libs/vfs/manager.c
deleted file mode 100644
index a622a50..0000000
--- a/libs/vfs/manager.c
+++ /dev/null
@@ -1,3027 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <vfs/extern.h>
-
-#include "path-priv.h"
-
-#include <sra/srapath.h>
-
-#include <vfs/manager.h>
-#include <vfs/manager-priv.h> /* VFSManagerMakeFromKfg */
-#include <vfs/path.h>
-#include <vfs/path-priv.h>
-#include <vfs/resolver.h>
-
-#include <krypto/key.h>
-#include <krypto/encfile.h>
-#include <krypto/wgaencrypt.h>
-#include <krypto/ciphermgr.h>
-
-#include <kfg/config.h>
-#include <kfg/repository.h>
-#include <kfg/keystore.h>
-#include <kfg/keystore-priv.h>
-#include <kfg/kfg-priv.h>
-
-#include <kfs/directory.h>
-#include <kfs/file.h>
-#include <kfs/sra.h>
-#include <kfs/tar.h>
-#include <kfs/dyload.h>
-#include <kfs/kfs-priv.h>
-#include <kfs/nullfile.h>
-#include <kfs/buffile.h>
-#include <kfs/quickmount.h>
-#include <kfs/cacheteefile.h>
-#include <kfs/lockfile.h>
-
-#include <kns/manager.h>
-#include <kns/http.h>
-#include <kxml/xml.h>
-
-#include <klib/debug.h> /* DBGMSG */
-#include <klib/log.h>
-#include <klib/printf.h>
-#include <klib/rc.h>
-#include <klib/refcount.h>
-
-#include <strtol.h>
-
-#include <sysalloc.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-
-#ifdef _DEBUGGING
-#define MGR_DEBUG(msg) DBGMSG(DBG_VFS,DBG_FLAG(DBG_VFS_MGR), msg)
-#else
-#define MGR_DEBUG(msg)
-#endif
-
-
-#define DEFAULT_CACHE_BLOCKSIZE ( 32768 * 4 )
-#define DEFAULT_CACHE_CLUSTER 1
-
-#define VFS_KRYPTO_PASSWORD_MAX_SIZE 4096
-
-/*--------------------------------------------------------------------------
- * VFSManager
- */
-
-/* currently expected to be a singleton and not use a vtable but
- * be fully fleshed out here */
-struct VFSManager
-{
-    /* the current directory in the eyes of the O/S when created */
-    KDirectory * cwd;
-
-    /* configuration manager */
-    KConfig * cfg;
-
-    /* krypto's cipher manager */
-    KCipherManager * cipher;
-
-    /* SRAPath will be replaced with a VResolver */
-    struct VResolver * resolver;
-
-    /* network manager */
-    KNSManager * kns;
-
-    /* path to a global password file */
-    char *pw_env;
-    
-    /* encryption key storage */ 
-    struct KKeyStore* keystore;
-
-    KRefcount refcount;
-};
-
-static const char kfsmanager_classname [] = "VFSManager";
-
-static 
-VFSManager * singleton = NULL;
-
-
-/* Destroy
- *  destroy file
- */
-static rc_t VFSManagerDestroy ( VFSManager *self )
-{
-    if ( self == NULL )
-        return RC ( rcVFS, rcFile, rcDestroying, rcSelf, rcNull );
-    
-    KKeyStoreRelease( self -> keystore );
-    free ( self -> pw_env );
-    VResolverRelease ( self -> resolver );
-    KNSManagerRelease ( self -> kns );
-    KCipherManagerRelease ( self -> cipher );
-    KConfigRelease ( self -> cfg );
-    KDirectoryRelease ( self -> cwd );
-    KRefcountWhack (&self->refcount, kfsmanager_classname);
-
-    free (self);
-    singleton = NULL;
-
-    return 0;
-}
-
-/* AddRef
- *  creates a new reference
- *  ignores NULL references
- */
-LIB_EXPORT rc_t CC VFSManagerAddRef ( const VFSManager *self )
-{
-    if (self != NULL)
-    {
-        switch (KRefcountAdd (&self->refcount, kfsmanager_classname))
-        {
-        case krefOkay:
-            break;
-        case krefZero:
-            return RC (rcVFS, rcMgr, rcAttaching, rcRefcount, rcIncorrect);
-        case krefLimit:
-            return RC (rcVFS, rcMgr, rcAttaching, rcRefcount, rcExhausted);
-        case krefNegative:
-            return RC (rcVFS, rcMgr, rcAttaching, rcRefcount, rcInvalid);
-        default:
-            return RC (rcVFS, rcMgr, rcAttaching, rcRefcount, rcUnknown);
-        }
-    }
-    return 0;
-}
-
-/* Release
- *  discard reference to file
- *  ignores NULL references
- */
-LIB_EXPORT rc_t CC VFSManagerRelease ( const VFSManager *self )
-{
-    rc_t rc = 0;
-    if (self != NULL)
-    {
-        switch (KRefcountDrop (&self->refcount, kfsmanager_classname))
-        {
-        case krefOkay:
-        case krefZero:
-            break;
-        case krefWhack:
-            rc = VFSManagerDestroy ((VFSManager*)self);
-            break;
-        case krefNegative:
-            return RC (rcVFS, rcMgr, rcAttaching, rcRefcount, rcInvalid);
-        default:
-            rc = RC (rcVFS, rcMgr, rcAttaching, rcRefcount, rcUnknown);
-            break;            
-        }
-    }
-    return rc;
-}
-
-
-
-/*--------------------------------------------------------------------------
- * VFSManagerMakeHTTPFile
- */
-static
-rc_t VFSManagerMakeHTTPFile( const VFSManager * self, const KFile **cfp,
-                             const char * url, const char * cache_location )
-{
-    rc_t rc = KNSManagerMakeHttpFile ( self -> kns, cfp, NULL, 0x01010000, url );
-    if ( rc == 0 )
-    {
-        const KFile *temp_file;
-        rc_t rc2;
-        if ( cache_location == NULL )
-        {
-            /* there is no cache_location! just wrap the remote file in a buffer */
-            rc2 = KBufFileMakeRead ( & temp_file, * cfp, 128 * 1024 * 1024 );
-        }
-        else
-        {
-            /* we do have a cache_location! wrap the remote file in a cacheteefile */
-            rc2 = KDirectoryMakeCacheTee ( self->cwd, &temp_file, *cfp, NULL,
-                                           DEFAULT_CACHE_BLOCKSIZE, DEFAULT_CACHE_CLUSTER,
-                                           false, "%s", cache_location );
-        }
-        if ( rc2 == 0 )
-        {
-            KFileRelease ( * cfp );
-            * cfp = temp_file;
-        }
-    }
-    return rc;
-}
-
-static rc_t CC VFSManagerGetConfigPWFile (const VFSManager * self, char * b, size_t bz, size_t * pz)
-{
-    const char * env;
-    const KConfigNode * node;
-    size_t oopsy;
-    size_t z = 0;
-    rc_t rc;
-
-    if (pz)
-        *pz = 0;
-
-    env = getenv (ENV_KRYPTO_PWFILE);
-    if (!env)
-        env = self->pw_env;
-    if (env)
-    {
-        z = string_copy (b, bz, env, string_size (env));
-    
-        /* force a NUL that string_copy might have omitted 
-         * even if this truncates the path */
-        b[bz-1] = '\0';
-
-        if (pz)
-            *pz = z;
-       
-        return 0;
-    }
-    
-    { /* If we are in a protected area, there may be an area-specific key file */
-        const KRepositoryMgr *repoMgr;
-        rc = KConfigMakeRepositoryMgrRead ( self->cfg, &repoMgr );
-        if (rc == 0)
-        {
-            const KRepository* prot;
-            rc = KRepositoryMgrCurrentProtectedRepository ( repoMgr, &prot );
-            if (rc == 0)
-            {
-                rc = KRepositoryEncryptionKeyFile ( prot, b, bz, pz);            
-                KRepositoryRelease(prot);
-            }
-            KRepositoryMgrRelease(repoMgr);
-        }
-        if (GetRCState(rc) == rcNotFound)
-            rc = RC (rcVFS, rcMgr, rcOpening, rcEncryptionKey, rcNotFound);
-    }
-
-    if (rc != 0)
-    {   /* fall back on an old-style global password file*/
-        rc = KConfigOpenNodeRead (self->cfg, &node, KFG_KRYPTO_PWFILE);
-        if (rc)
-        {
-            /* if not found, change object from path to encryption key */
-            if (GetRCState(rc) == rcNotFound)
-                rc = RC (rcVFS, rcMgr, rcOpening, rcEncryptionKey, rcNotFound);
-        }
-        else
-        {
-            rc = KConfigNodeRead (node, 0, b, bz-1, &z, &oopsy);
-            if (rc == 0)
-            {
-                if (oopsy != 0)
-                    rc = RC (rcKrypto, rcMgr, rcReading, rcBuffer, rcInsufficient);
-                else
-                {
-                    b[z] = '\0';
-                    *pz = z;
-                }
-            }
-            KConfigNodeRelease (node);
-        }
-    }
-    
-    return rc;
-}
-
-static
-rc_t GetEncryptionKey(const VFSManager * self, const VPath * vpath, char* obuff, size_t buf_size, size_t *pwd_size)
-{
-    /* -----
-     * #if 0
-     * first check the insecure password on the command line hack 
-     * #endif 
-     *
-     * then check the option for pwfile in the VPath
-     * then check the option for pwfd
-     * then check the keystore. if necessary, keystore will 
-     *          check the environment      
-     *          check the configuration
-     */
-
-#if 0
-    /* obviously not used yet */
-    if (VPathOption (vpath, vpopt_temporary_pw_hack, obuff, buf_size, &z) == 0)
-    {
-        if (z < 1)
-            rc = RC (rcVFS, rcPath, rcConstructing, rcParam, rcInvalid);
-        else
-        {
-            size_t x = 0;
-            size_t y = 0;
-            int ch, h, l;
-
-            while (x < z)
-            {
-                h = tolower(obuff[x++]);
-                l = tolower(obuff[x++]);
-
-                if (!isxdigit(h) || !isxdigit(l))
-                    rc = RC (rcVFS, rcPath, rcConstructing, rcParam, rcInvalid);
-
-                if (isdigit(h))
-                    ch = (h - '0') << 4;
-                else
-                    ch = (h + 10 - 'a') << 4;
-                if (isdigit(l))
-                    ch |= (l - '0');
-                else
-                    ch |= (l + 10 - 'a');
-
-                /* added for compatibility with other passwords */
-                if ((ch == '\r') || (ch == '\n'))
-                    break;
-                obuff[y++] = (char)ch;
-            }
-            obuff[y] = '\0';
-            assert (z == x);
-            assert (z/2 == y);
-            z = y;
-            * pwd_size = z;
-        }
-    }
-#endif    
-
-    rc_t rc = 0;
-    rc_t rc2;
-    size_t z;
-
-    if (VPathOption (vpath, vpopt_pwpath, obuff, buf_size - 1, &z) == 0)
-    {
-        const KFile * pwfile;
-        obuff [z] = '\0';
-        rc = KDirectoryOpenFileRead(self->cwd, &pwfile, obuff);
-        if (rc == 0)
-        {
-            rc = KKeyStoreSetTemporaryKeyFromFile(self->keystore, pwfile);
-            rc2 = KFileRelease(pwfile);
-            if (rc == 0)
-                rc = rc2;
-        }
-    }
-    else if (VPathOption (vpath, vpopt_pwfd, obuff, buf_size - 1, &z) == 0)
-    {
-        /* -----
-         * pwfd is not fully a VPath at this point: we 
-         * should obsolete it
-         */
-        const KFile * pwfile;
-        obuff [z] = '\0';
-        rc = KFileMakeFDFileRead (&pwfile, atoi (obuff));
-        if (rc == 0)
-        {
-            rc = KKeyStoreSetTemporaryKeyFromFile(self->keystore, pwfile);
-            rc2 = KFileRelease(pwfile);
-            if (rc == 0)
-                rc = rc2;
-        }
-    }
-    
-    if (rc == 0)
-    {
-        KEncryptionKey* enc_key;
-        rc = KKeyStoreGetKey(self->keystore, NULL, &enc_key); /* here, we are only interested in global keys - at least for now */
-        if (rc == 0)
-        {
-            *pwd_size = string_copy(obuff, buf_size, enc_key->value.addr, enc_key->value.size);
-            if (*pwd_size != enc_key->value.size)
-                rc = RC(rcVFS, rcPath, rcReading, rcBuffer, rcInsufficient);
-            rc2 = KEncryptionKeyRelease(enc_key);
-            if (rc == 0)
-                rc = rc2;
-        }
-    }
-    
-    rc2 = KKeyStoreSetTemporaryKeyFromFile(self->keystore, NULL); /* forget the temp key if set */
-    if (rc == 0)
-        rc = rc2;
-    return rc;
-}
-
-/*
- * This is still hack - must match VFSManagerResolvePathRelativeDir()
- */
-LIB_EXPORT rc_t CC VFSManagerWGAValidateHack (const VFSManager * self, 
-                                              const KFile * file,
-                                              const char * path) /* we'll move this to a vpath */
-{
-    VPath * vpath;
-    rc_t rc = 0;
-
-    rc = VPathMake (&vpath, path);
-    if (rc == 0)
-    {
-        size_t z;
-        char obuff [VFS_KRYPTO_PASSWORD_MAX_SIZE + 2]; /* 1 for over-read and 1 for NUL */
-        rc = GetEncryptionKey(self, vpath, obuff, sizeof(obuff), &z);
-
-        if (rc == 0)
-        {
-            rc = WGAEncValidate (file, obuff, z);
-        }
-    }
-    return rc;
-}
-
-
-
-/* ResolvePath
- *
- * take a VPath and resolve to a final form apropriate for KDB
- *
- * that is take a relative path and resolve it against the CWD
- * or take an accession and resolve into the local or remote 
- * VResolver file based on config. It is just a single resolution percall
- */
-static rc_t VFSManagerResolvePathResolver (const VFSManager * self,
-                                           uint32_t flags,
-                                           const VPath * in_path,
-                                           VPath ** out_path)
-{
-    rc_t rc = 0;
-
-    *out_path = NULL;
-
-    /*
-     * this RC perculates up for ncbi-acc: schemes but not for
-     * no scheme uris
-     */
-    if ((flags & vfsmgr_rflag_no_acc) == vfsmgr_rflag_no_acc)
-    {
-        /* hack */
-        if ( VPathGetUri_t ( in_path ) == vpuri_none )
-            rc = SILENT_RC (rcVFS, rcMgr, rcResolving, rcSRA, rcNotAvailable);
-        else
-            rc = RC (rcVFS, rcMgr, rcResolving, rcSRA, rcNotAvailable);
-    }
-    else
-    {
-        bool not_done = true;
-
-        /*
-         * cast because we seem to have the restriction on the output from
-         * VResolver that seems too restrictive
-         */
-        if ((flags & vfsmgr_rflag_no_acc_local) == 0)
-        {
-            rc = VResolverLocal (self->resolver, in_path, (const VPath **)out_path);
-            if (rc == 0)
-                not_done = false;
-        }
-            
-        if (not_done && ((flags & vfsmgr_rflag_no_acc_remote) == 0))
-        {
-            rc = VResolverRemote (self->resolver, eProtocolHttp,
-                in_path, (const VPath **)out_path);
-        }
-    }
-    return rc;
-}
-
-
-static rc_t VFSManagerResolvePathInt (const VFSManager * self,
-                                      uint32_t flags,
-                                      const KDirectory * base_dir,
-                                      const VPath * in_path,
-                                      VPath ** out_path)
-{
-    rc_t rc;
-    char * pc;
-    VPUri_t uri_type;
-
-    assert (self);
-    assert (in_path);
-    assert (out_path);
-
-    uri_type = VPathGetUri_t ( in_path );
-    switch ( uri_type )
-    {
-    default:
-        rc = RC (rcVFS, rcMgr, rcResolving, rcPath, rcInvalid);
-        break;
-
-    case vpuri_not_supported:
-    case vpuri_ncbi_legrefseq:
-        rc = RC (rcVFS, rcMgr, rcResolving, rcPath, rcUnsupported);
-        break;
-
-    case vpuri_ncbi_acc:
-        rc = VFSManagerResolvePathResolver (self, flags, in_path, out_path);
-        break;
-
-    case vpuri_none:
-        /* for KDB purposes, no scheme might be an accession */
-        if (flags & vfsmgr_rflag_kdb_acc)
-        {
-             /* no '/' is permitted in an accession */
-            pc = string_chr (in_path->path.addr, in_path->path.size, '/');
-            if (pc == NULL)
-            {
-                rc = VFSManagerResolvePathResolver (self, flags, in_path, out_path);
-                if (rc == 0)
-                    break;
-            }
-        }
-        /* Fall through */
-    case vpuri_ncbi_vfs:
-    case vpuri_file:
-        /* check for relative versus full path : assumes no 'auth' not starting with '/' */
-        if (in_path->path.addr[0] == '/')
-        {
-            rc = VPathAddRef (in_path);
-            if (rc == 0)
-                *out_path = (VPath *)in_path; /* oh these const ptr are annoying */
-        }
-        else
-        {
-            /* not 'properly' handling query, fragment etc. for relative path
-             * assumes path within VPath is ASCIZ
-             */
-            size_t s;
-            VPath * v;
-            char u [32 * 1024];
-
-            switch ( uri_type )
-            {
-            default:
-                rc = RC (rcVFS, rcMgr, rcResolving, rcFunction, rcInvalid);
-                break;
-
-            case vpuri_ncbi_vfs:
-                string_printf ( u, sizeof u, & s, "%S:", & in_path -> scheme );
-                rc = KDirectoryResolvePath ( base_dir, true, & u [ s ], sizeof u - s,
-                    "%.*s", ( int ) in_path -> path . size, in_path -> path . addr );
-                if ( rc == 0 )
-                {
-                    s = string_size ( u );
-                    rc = string_printf ( & u [ s ], sizeof u - s, NULL,
-                        "%S%S", & in_path -> query, & in_path -> fragment );
-                }
-                if (rc == 0)
-                    rc = VPathMake (&v, u);
-                break;
-
-            case vpuri_none:
-            case vpuri_file:
-                rc = KDirectoryResolvePath ( base_dir, true, u, sizeof u,
-                    "%.*s", ( int ) in_path -> path . size, in_path -> path . addr );
-                rc = VPathMake (&v, u);
-                break;
-            }
-            if (rc == 0)
-                *out_path = v;
-        }
-        break;
-
-        /* these are considered fully resolved already */
-    case vpuri_http:
-    case vpuri_ftp:
-        rc = VPathAddRef (in_path);
-        if (rc == 0)
-            *out_path = (VPath*)in_path;
-        break;
-
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC VFSManagerResolvePath (const VFSManager * self,
-                                          uint32_t flags,
-                                          const VPath * in_path,
-                                          VPath ** out_path)
-{
-    if (out_path == NULL)
-        return RC (rcVFS, rcMgr, rcResolving, rcParam, rcNull);
-
-    *out_path = NULL;
-
-    if (self == NULL)
-        return RC (rcVFS, rcMgr, rcResolving, rcSelf, rcNull);
-
-    if (in_path == NULL)
-        return RC (rcVFS, rcMgr, rcResolving, rcParam, rcNull);
-
-    return VFSManagerResolvePathInt (self, flags, self->cwd, in_path, out_path);
-}
-
-LIB_EXPORT rc_t CC VFSManagerResolvePathRelative (const VFSManager * self,
-                                                  uint32_t flags,
-                                                  const struct  VPath * base_path,
-                                                  const struct  VPath * in_path,
-                                                  struct VPath ** out_path)
-{
-    const KDirectory * dir;
-    rc_t rc;
-
-    if (out_path == NULL)
-        rc = RC (rcVFS, rcMgr, rcResolving, rcParam, rcNull);
-
-    *out_path = NULL;
-
-    if (self == NULL)
-        return RC (rcVFS, rcMgr, rcResolving, rcSelf, rcNull);
-
-    if (in_path == NULL)
-        return RC (rcVFS, rcMgr, rcResolving, rcParam, rcNull);
-
-    rc = VFSManagerOpenDirectoryRead (self, &dir, base_path);
-    if (rc == 0)
-        rc = VFSManagerResolvePathInt (self, flags, dir, in_path, out_path);
-
-    return rc;
-}
-
-/*
- * This is still hack - must match VFSManagerGetEncryptionKey()
- */
-
-LIB_EXPORT rc_t CC VFSManagerResolvePathRelativeDir (const VFSManager * self,
-                                                     uint32_t flags,
-                                                     const KDirectory * base_dir,
-                                                     const VPath * in_path,
-                                                     VPath ** out_path)
-{
-    if (out_path == NULL)
-        return RC (rcVFS, rcMgr, rcResolving, rcParam, rcNull);
-
-    *out_path = NULL;
-
-    if (self == NULL)
-        return RC (rcVFS, rcMgr, rcResolving, rcSelf, rcNull);
-
-    if (in_path == NULL)
-        return RC (rcVFS, rcMgr, rcResolving, rcParam, rcNull);
-
-    return VFSManagerResolvePathInt (self, flags, base_dir, in_path, out_path);
-}
-
-
-/* OpenFileRead
- *  opens an existing file with read-only access
- *
- *  "f" [ OUT ] - return parameter for newly opened file
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- */
-static
-rc_t VFSManagerOpenFileReadDecryption (const VFSManager *self,
-                                       const KDirectory * dir,
-                                       const KFile ** f,
-                                       const KFile * file,
-                                       const VPath * path,
-                                       bool force_decrypt,
-                                       bool * was_encrypted)
-{
-    rc_t rc = 0;
-    size_t z;
-    char obuff [VFS_KRYPTO_PASSWORD_MAX_SIZE + 2]; /* 1 for over-read and 1 for NUL */
-    bool has_enc_opt;
-
-    if (was_encrypted)
-        *was_encrypted = false;
-
-    /* -----
-     * at this point we have no fatal errors and we have the
-     * file opened but we have not seen if we have to decrypt
-     * or use other query options
-     */
-    has_enc_opt = (VPathOption (path, vpopt_encrypted, obuff,
-                                sizeof obuff, &z) == 0);
-
-    if ((has_enc_opt == false) &&
-        (force_decrypt == false))
-    {
-        /* if we are not told to decrypt, don't and we are done */
-        KFileAddRef (file);
-        *f = file;
-    }
-
-    else /* we are told to decrypt if possible */
-    {
-        /* -----
-         * pre-read 4kb from the 'encrypted file'
-         */
-        rc = KFileRandomAccess (file);
-        if (rc == 0)
-            ;
-        /* most common and easiest option is it has random
-         * access - a no-op here
-         */
-        else if (GetRCState(rc) == rcUnsupported)
-        {
-            const KFile * buffile;
-
-            rc = KBufFileMakeRead (&buffile, file, 32 * 2 * 1024);
-            if (rc)
-                ;
-            else
-            {
-                /* there is an extra reference to file now, but
-                 * it gets removed after this function returns
-                 */
-                file = buffile;
-            }
-        }
-        
-        if (rc == 0)
-        {
-            size_t tz;
-            char tbuff [4096];
-
-            /* we now have a file from which we can pre-read the
-             * possible encrypted format header */
-            rc = KFileReadAll (file, 0, tbuff, sizeof tbuff, &tz);
-            if (rc == 0)
-            {
-                /* 
-                 * we've successfully read 4KB from the file,
-                 * now decide if is actually an encrypted file
-                 * format we support
-                 */
-                const KFile * encfile;
-
-                /* is this the header of an ecnrypted file? */
-                if (KFileIsEnc (tbuff, tz) == 0)
-                {
-                    if (was_encrypted)
-                        *was_encrypted = true;
-                    rc = GetEncryptionKey(self, path, obuff, sizeof(obuff), &z);
-                    if (rc == 0)
-                    {
-                        KKey key;
-
-                        /* create the AES Key */
-                        rc = KKeyInitRead (&key, kkeyAES128, obuff, z);
-                        if (rc)
-                            ;
-                        else
-                        {
-                            rc = KEncFileMakeRead (&encfile, file, &key);
-                            if (rc)
-                                ;
-                            else
-                            {
-                                const KFile * buffile;
-
-                                /*
-                                 * TODO: make the bsize a config item not a hard constant
-                                 */
-                                rc = KBufFileMakeRead (&buffile, encfile,
-                                                       256 * 1024 * 1024);
-                                if (rc == 0)
-                                {
-                                    *f = buffile;
-                                    /* *f keeps a reference to encfile, can release it here */
-                                    KFileRelease (encfile);
-                                    return 0;
-                                }
-                                KFileRelease (encfile);
-                            }
-                        }
-                    }
-                }
-                else if (KFileIsWGAEnc (tbuff, tz) == 0)
-                {
-                    if (was_encrypted)
-                        *was_encrypted = true;
-                    rc = GetEncryptionKey(self, path, obuff, sizeof(obuff), &z);
-                    if (rc == 0)
-                    {
-                        rc = KFileMakeWGAEncRead (&encfile, file, obuff, z);
-                        if (rc)
-                            ;
-                        else
-                        {
-                            /* we'll release anextra reference to file
-                             * after this function returns
-                             */
-                            *f = encfile;
-                            return 0;
-                        }
-                    }
-                }
-                else
-                {
-                    /* -----
-                     * not encrypted in a manner we can decrypt so 
-                     * give back the raw file (possibly buffered
-                     *
-                     * since file is released in the caller
-                     * we need another reference
-                     */
-                    KFileAddRef (file);
-                    *f = file;
-                    return 0;
-                }
-            }
-        }
-    }
-    return rc;
-}
-
-
-/*
- * try to open the file as a regular file
- */
-static
-rc_t VFSManagerOpenFileReadRegularFile (char * pbuff, size_t z,
-                                        KFile const ** file,
-                                        const KDirectory * dir)
-{
-    rc_t rc;
-    char rbuff [8192];
-
-    assert ((pbuff) && (pbuff[0]));
-    assert (*file == NULL);
-
-    rc = KDirectoryResolvePath (dir, true, rbuff, sizeof rbuff,
-                                pbuff);
-    if (rc)
-        ; /* log? */
-    else
-    {
-        /* validate that the file system agrees the path refers
-         * to a regular file (even if through a link */
-        uint32_t type;
-
-        type = KDirectoryPathType (dir, rbuff);
-        switch (type & ~kptAlias)
-        {
-        case kptNotFound:
-            rc = RC (rcVFS, rcMgr, rcOpening, rcFile,
-                     rcNotFound);
-            break;
-
-        case kptBadPath:
-            rc = RC (rcVFS, rcMgr, rcOpening, rcFile,
-                     rcInvalid);
-            break;
-
-        case kptDir:
-        case kptCharDev:
-        case kptBlockDev:
-        case kptFIFO:
-        case kptZombieFile:
-            rc = RC (rcVFS, rcMgr, rcOpening, rcFile,
-                     rcIncorrect);
-            break;
-
-        default:
-            rc = RC (rcVFS, rcMgr, rcOpening, rcFile, rcUnknown);
-            break;
-
-        case kptFile:
-            /*
-             * this is the good/successful path: open the file 
-             * as a const KFile
-             */
-            rc = KDirectoryOpenFileRead (dir, file, rbuff);
-            break;
-        }
-    }
-
-    return rc;
-}
-
-/*
- * if successful set *file to a usable KFile * and return 0
- * if unsuccessful but without error, set *file to NULL and return 0
- * if an error encountered set *file to NULL and return non-zero.
- */
-static
-rc_t VFSManagerOpenFileReadSpecial (char * pbuff, size_t z, KFile const ** file)
-{
-    rc_t rc = 0;
-    static const char dev [] = "/dev/";
-    static const char dev_stdin [] = "/dev/stdin";
-    static const char dev_null [] = "/dev/null";
-
-    assert (pbuff);
-    assert (z);
-    assert (file);
-
-    *file = NULL;
-
-    /*
-     * Handle a few special case path names that are pre-opened
-     * 'file descriptors'
-     *
-     * This probably needs to be system specific eventually
-     *
-     * First check for the path being in the 'dev' directory in
-     * posix/unix terms
-     */
-    if (string_cmp (dev, sizeof dev - 1, pbuff, z, sizeof dev - 1) != 0)
-        rc = 0; /* we're done */
-
-    else
-    {
-        if (strcmp (dev_stdin, pbuff) == 0)
-            rc = KFileMakeStdIn (file);
-
-        else if (strcmp (dev_null, pbuff) == 0)
-            rc = KFileMakeNullRead (file);
-
-        else if (strncmp ("/dev/fd/", pbuff, sizeof "/dev/fd/" - 1) == 0)
-        {
-            char * pc;
-            size_t ix;
-
-            pc = pbuff + sizeof "/dev/fd/" - 1;
-
-            for (ix = 0; isdigit (pc[ix]); ++ix)
-                assert (ix <= z);
-
-            if ((ix > 0)&&(pc[ix] == '\0'))
-            {
-                int fd;
-
-                fd = atoi (pc);
-                rc = KFileMakeFDFileRead (file, fd);
-            }
-        }
-    }
-
-    return rc;
-}
-
-static
-rc_t VFSManagerOpenFileReadInt (const VFSManager *self,
-                                const KDirectory * dir,
-                                KFile const **f,
-                                const VPath * path,
-                                bool force_decrypt,
-                                bool * was_encrypted)
-{
-    /* -----
-     * this is a first pass that only opens files directory referenced from 
-     * the ced or have a sysdir root; that is it uses KSysDir and KSysFile
-     * only.
-     */
-    const KFile * file = NULL;
-    size_t num_read;
-    char pbuff [4096];
-    rc_t rc;
-
-    rc = VPathReadPath (path, pbuff, sizeof pbuff, &num_read);
-    if (rc)
-        ; /* log? */
-    else
-    {
-        /* -----
-         * try to open path as a special file if requested
-         *
-         * *file will be set or a usable file or to NULL and rc will reflect
-         * any error
-         */
-        rc = VFSManagerOpenFileReadSpecial (pbuff, num_read, &file);
-
-        if (rc == 0)
-        {
-            /* -----
-             * If we didn't open the file using the special
-             * logic above for special paths open the file and have no error,
-             * continue
-             */
-            if (file == NULL)
-                rc = VFSManagerOpenFileReadRegularFile (pbuff, num_read,
-                                                        &file, dir);
-            /*
-             * we either have an rc to return with or we have an open KFile:
-             * check for possible encryption that we are told to decrypt
-             */
-            if (rc == 0)
-            {
-                rc = VFSManagerOpenFileReadDecryption (self, dir, f, file, path,
-                                                       force_decrypt, was_encrypted);
-            }
-            /* release file if we are here and it is open */
-            KFileRelease (file);
-        }
-    }
-    return rc;
-}
-
-
-static
-rc_t VFSManagerOpenFileReadDirectoryRelativeInt (const VFSManager *self,
-                                                 const KDirectory * dir,
-                                                 KFile const **f,
-                                                 const VPath * path,
-                                                 bool force_decrypt,
-                                                 bool * was_encrypted)
-{
-    rc_t rc;
-
-    if (f == NULL)
-        rc = RC (rcVFS, rcMgr, rcOpening, rcParam, rcNull);
-
-    else
-    {
-        *f = NULL;
-
-        if ((f == NULL) || (path == NULL))
-            rc = RC (rcVFS, rcMgr, rcOpening, rcParam, rcNull);
-
-        else if (self == NULL)
-            rc = RC (rcVFS, rcMgr, rcOpening, rcSelf, rcNull);
-
-        else
-        {
-
-            rc = VFSManagerOpenFileReadInt (self, dir, f, path, force_decrypt, was_encrypted);
-        }
-    }
-    return rc;
-}
-
-
-/* we will create a KFile from a http or ftp url... */
-static rc_t VFSManagerOpenCurlFile ( const VFSManager *self,
-                                     KFile const **f,
-                                     const VPath * path )
-{
-    rc_t rc;
-/*    const char * url; */
-    const String * uri = NULL;
-
-    if ( f == NULL )
-        return RC( rcVFS, rcMgr, rcOpening, rcParam, rcNull );
-    *f = NULL;
-    if ( self == NULL )
-        return RC( rcVFS, rcMgr, rcOpening, rcSelf, rcNull );
-    if ( path == NULL )
-        return RC( rcVFS, rcMgr, rcOpening, rcParam, rcNull );
-
-/*    url = path->path.addr; */
-    rc = VPathMakeString ( path, &uri );
-    if ( rc == 0 )
-    {
-        if ( self->resolver != NULL )
-        {
-            const VPath * local_cache;
-            /* find cache - vresolver call */
-            rc = VResolverCache ( self->resolver, path, &local_cache, 0 );
-            if ( rc == 0 )
-                /* we did find a place for local cache --> use it! */
-                rc = VFSManagerMakeHTTPFile( self, f, uri->addr, local_cache->path.addr );
-            else
-                /* we did NOT find a place for local cache --> we are not caching! */
-                rc = VFSManagerMakeHTTPFile( self, f, uri->addr, NULL );
-        }
-        else
-            rc = VFSManagerMakeHTTPFile( self, f, uri->addr, NULL );
-        free( ( void * )uri );
-    }
-    return rc;
-}
-
-
-LIB_EXPORT
-rc_t CC VFSManagerOpenFileReadDirectoryRelative (const VFSManager *self,
-                                                 const KDirectory * dir,
-                                                 KFile const **f,
-                                                 const VPath * path)
-{
-    return VFSManagerOpenFileReadDirectoryRelativeInt (self, dir, f, path, false, NULL);
-}
-
-LIB_EXPORT
-rc_t CC VFSManagerOpenFileReadDirectoryRelativeDecrypt (const VFSManager *self,
-                                                        const KDirectory * dir,
-                                                        KFile const **f,
-                                                        const VPath * path) /*,
-                                                        bool force_decrypt) */
-{
-    return VFSManagerOpenFileReadDirectoryRelativeInt (self, dir, f, path, true, NULL);
-}
-
-
-static rc_t ResolveVPathByVResolver( struct VResolver * resolver, const VPath ** path )
-{
-    rc_t rc;
-
-    if ( resolver == NULL )
-        rc = RC ( rcVFS, rcFile, rcOpening, rcSRA, rcUnsupported );
-    else
-    {
-        const VPath * tpath;
-        rc = VResolverLocal ( resolver, *path, &tpath );
-        if ( rc == 0 )
-        {
-            VPathRelease ( *path );
-            *path = tpath;
-        }
-    }
-    return rc;
-}
-
-static rc_t ResolveVPathBySRAPath( const VPath ** path )
-{
-    * path = NULL;
-    return RC ( rcVFS, rcFile, rcOpening, rcSRA, rcUnsupported );
-}
-
-
-LIB_EXPORT rc_t CC VFSManagerOpenFileRead ( const VFSManager *self,
-                                            KFile const **f,
-                                            const VPath * path_ )
-{
-    rc_t rc;
-
-    if ( f == NULL )
-        rc = RC (rcVFS, rcMgr, rcOpen, rcParam, rcNull);
-    else
-    {
-        *f = NULL;
-
-        if  (self == NULL )
-            rc = RC ( rcVFS, rcMgr, rcOpen, rcSelf, rcNull );
-        else if ( f == NULL )
-            rc = RC ( rcVFS, rcMgr, rcOpen, rcParam, rcNull );
-        else
-        {
-            rc = VPathAddRef ( path_ );
-            if ( rc == 0 )
-            {
-                const VPath * path = path_;
-                VPUri_t uri_type = VPathGetUri_t ( path );
-
-                switch ( uri_type )
-                {
-                default:
-                case vpuri_invalid:
-                    rc = RC (rcVFS, rcFile, rcOpening, rcPath, rcInvalid);
-                    break;
-
-                case vpuri_not_supported:
-                    rc = RC (rcVFS, rcFile, rcOpening, rcPath, rcUnsupported);
-                    break;
-
-                case vpuri_ncbi_acc:
-                    if ( self->resolver != NULL )
-                        rc = ResolveVPathByVResolver( self->resolver, &path );
-                    else
-                        rc = ResolveVPathBySRAPath( &path );
-
-                    if ( rc != 0 )
-                        break;
-
-                /* !!! fall through !!! */
-
-                case vpuri_none:
-                case vpuri_ncbi_vfs:
-                case vpuri_file:
-                    rc = VFSManagerOpenFileReadDirectoryRelativeInt ( self, self->cwd, f, path, false, NULL );
-                    break;
-
-                case vpuri_ncbi_legrefseq:
-                    rc = RC ( rcVFS, rcFile, rcOpening, rcPath, rcIncorrect );
-                    break;
-
-                case vpuri_http:
-                case vpuri_ftp:
-                    rc = VFSManagerOpenCurlFile ( self, f, path );
-                    break;
-                }
-                VPathRelease (path);
-            }
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC VFSManagerOpenFileReadDecrypt (const VFSManager *self,
-                                                  KFile const **f,
-                                                  const VPath * path)
-{
-    return VFSManagerOpenFileReadDirectoryRelativeInt ( self, self->cwd, f, path, true, NULL );
-}
-
-LIB_EXPORT
-rc_t CC VFSManagerOpenDirectoryUpdateDirectoryRelative (const VFSManager *self,
-                                                        const KDirectory * dir,
-                                                        KDirectory **d,
-                                                        const VPath * path)
-{
-    rc_t rc;
-    VPUri_t uri_type;
-
-    if ((d == NULL) || (path == NULL))
-        return RC (rcVFS, rcMgr, rcOpening, rcParam, rcNull);
-
-    *d = NULL;
-
-    if (self == NULL)
-        return RC (rcVFS, rcMgr, rcOpening, rcSelf, rcNull);
-
-    uri_type = VPathGetUri_t ( path );
-    switch ( uri_type )
-    {
-    case vpuri_http :
-    case vpuri_ftp :
-        return RC( rcVFS, rcMgr, rcOpening, rcParam, rcWrongType );
-
-    default :
-        {
-            uint32_t type;
-
-            /* WHY NOT JUST TRY TO OPEN THE DIRECTORY,
-               AND LET KFS TELL US WHAT'S WRONG? */
-
-            type = KDirectoryPathType (dir, "%.*s", ( int ) path -> path . size, path -> path . addr );
-            switch (type & ~kptAlias)
-            {
-            case kptNotFound:
-                rc = RC (rcVFS, rcMgr, rcOpening, rcDirectory, rcNotFound);
-                break;
-
-            case kptFile:
-                rc = RC (rcVFS, rcMgr, rcOpening, rcDirectory, rcReadonly);
-                break;
-
-            case kptBadPath:
-                rc = RC (rcVFS, rcMgr, rcOpening, rcDirectory, rcInvalid);
-                break;
-
-            case kptDir:
-                rc = KDirectoryOpenDirUpdate ((KDirectory*)dir, d, false, "%.*s", ( int ) path -> path . size, path -> path . addr);
-                return rc;
-
-            case kptCharDev:
-            case kptBlockDev:
-            case kptFIFO:
-            case kptZombieFile:
-                rc = RC (rcVFS, rcMgr, rcOpening, rcDirectory, rcIncorrect);
-                break;
-
-            default:
-                rc = RC (rcVFS, rcMgr, rcOpening, rcDirectory, rcUnknown);
-                break;
-            }
-        }
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC VFSManagerOpenDirectoryUpdate (const VFSManager *self,
-                                                  KDirectory **d,
-                                                  const VPath * path)
-{
-    return VFSManagerOpenDirectoryUpdateDirectoryRelative (self, self->cwd, d, path);
-}
-
-
-static
-rc_t TransformFileToDirectory(const KDirectory * dir,
-                              const KFile * file,
-                              KDirectory const **d,
-                              const char *path_str,
-                              bool was_encrypted)
-{
-    rc_t rc;
-
-    rc = KFileRandomAccess( file );
-    if (rc)
-        PLOGERR(klogErr,(klogErr, rc, "Can not use files without random access"
-                         " as database archives '$(P)'", "P=%s", path_str));
-    else
-    {
-        size_t tz;
-        char tbuff [4096];
-
-        rc = KFileReadAll (file, 0, tbuff, sizeof tbuff, &tz);
-        if ( rc )
-            LOGERR (klogErr, rc, "Error reading the head of an archive to use as a database object");
-        else
-        {
-            /* we only use KAR/SRA or tar files as archives so try to identify
-             * as our KAR/SRA file.
-             IT IS NOT TRUE ANYMORE ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */
-            if ( KFileIsSRA( tbuff, tz ) == 0 )
-                /* if it was open it as a directory */
-                rc = KDirectoryOpenSraArchiveReadUnbounded_silent_preopened( dir, d, false, file, path_str );
-
-            else
-            {
-                rc = KDirectoryOpenTarArchiveRead_silent_preopened( dir, d, false, file, path_str );
-
-                /*
-                 * if RC here we did not have an SRA and did not have
-                 * a tar file we could use; assume the problem was:
-                 * - decryption if the file was encrypted
-                 * - or it is not an archive
-                 */
-                if (rc != 0) {
-                    if ( was_encrypted ) {
-                     /* the following RC update is not correct anymore but:
-                        TODO: check tools/libraries
-                            that expect this returned code and fix them
-                        rc = RC(rcVFS, rcEncryptionKey, rcOpening, rcEncryption,
-                             rcIncorrect ); */
-                        PLOGERR (klogErr, (klogErr, rc,
-                            "could not use '$(P)' as an "
-                            "archive it was encrypted so the password"
-                            " was possibly wrong or it is not SRA or"
-                            " TAR file", "P=%s", path_str));
-                    }
-                    else {
-                        PLOGERR (klogInfo, (klogInfo, rc,
-                            "could not use '$(P)' as an "
-                            "archive not identified as SRA or"
-                            " TAR file", "P=%s", path_str));
-                    }
-                }
-            }
-        }
-    }
-    return rc;
-}
-
-/* also handles ftp - if it cant we'll need another function */
-static
-rc_t VFSManagerOpenDirectoryReadHttp (const VFSManager *self,
-                                      const KDirectory * dir,
-                                      KDirectory const **d,
-                                      const VPath * path,
-                                      bool force_decrypt)
-{
-    rc_t rc;
-    const KFile * file = NULL;
-
-    rc = VFSManagerOpenCurlFile ( self, &file, path );
-    if ( rc != 0 )
-    {
-        PLOGERR ( klogErr, ( klogErr, rc, "error with http open '$(U)'",
-                             "U=%S:%S", & path -> scheme, & path -> path ) );
-    }
-    else
-    {
-        const char mountpointpath[] = "/";
-        const KDirectory * mountpoint;
-
-        rc = KQuickMountDirMake (self->cwd, &mountpoint, file,
-                                 mountpointpath, sizeof mountpointpath - 1, 
-                                 path->path.addr, path->path.size);
-        if (rc)
-        {
-            PLOGERR (klogInt, (klogErr, rc, "error creating mount "
-                               "'$(M)' for '$(F)", "M=%s,F=%S",
-                               mountpointpath, &path->path));
-        }
-        else
-        {
-            const KFile * f;
-            bool was_encrypted = false;
-
-            rc = VFSManagerOpenFileReadDecryption (self, mountpoint, &f,
-                                                   file, path,
-                                                   force_decrypt,
-                                                   &was_encrypted);
-            if (rc == 0)
-            {
-                    
-                rc = TransformFileToDirectory (mountpoint, f, d, 
-                                               path->path.addr,
-                                               was_encrypted);
-                /* hacking in the fragment bit */
-                if ((rc == 0) && (path->fragment . size > 1 ) )
-                {
-                    const KDirectory * tempd = * d;
-                    const char * fragment = path -> fragment . addr + 1;
-                    int frag_size = ( int ) path -> fragment . size - 1;
-
-                    assert ( fragment [ -1 ] == '#' );
-                        
-                    rc = KDirectoryOpenDirRead (tempd, d, false, "%.*s", frag_size, fragment );
-                    
-                    KDirectoryRelease (tempd);
-                }
-                KFileRelease (f);
-            }
-            KDirectoryRelease (mountpoint);
-        }
-        KFileRelease (file);
-    }
-    return rc;
-}
-
-
-static
-rc_t VFSManagerOpenDirectoryReadKfs (const VFSManager *self,
-                                     const KDirectory * dir,
-                                     KDirectory const **d,
-                                     const VPath * path,
-                                     bool force_decrypt)
-{
-    const KFile * file = NULL;
-    char rbuff[ 4096 ]; /* resolved path buffer */
-    rc_t rc;
-
-    assert (self);
-    assert (dir);
-    assert (d);
-    assert (path);
-    assert ((force_decrypt == false) || (force_decrypt == true));
-    assert (*d == NULL);
-
-    file = NULL;
-
-    rc = KDirectoryResolvePath( dir, true, rbuff, sizeof rbuff, "%.*s", ( int ) path -> path . size, path -> path . addr );
-    if ( rc == 0 )
-    {
-        uint32_t type;
-        bool was_encrypted;
-
-        type = KDirectoryPathType( dir, rbuff );
-        switch (type & ~kptAlias)
-        {
-        case kptNotFound:
-            rc = RC( rcVFS, rcMgr, rcOpening, rcDirectory, rcNotFound );
-            break;
-
-        case kptFile:
-            rc = VFSManagerOpenFileReadDirectoryRelativeInt (self, dir, 
-                                                             &file, path, 
-                                                             force_decrypt,
-                                                             &was_encrypted);
-            if (rc == 0)
-                rc = TransformFileToDirectory (dir, file, d, rbuff,
-                                               was_encrypted);
-            break;
-
-        case kptBadPath:
-            rc = RC( rcVFS, rcMgr, rcOpening, rcDirectory, rcInvalid );
-            break;
-
-        case kptDir:
-            rc = KDirectoryOpenDirRead( dir, d, false, rbuff );
-            return rc;
-
-        case kptCharDev:
-        case kptBlockDev:
-        case kptFIFO:
-        case kptZombieFile:
-            rc = RC( rcVFS, rcMgr, rcOpening, rcDirectory, rcIncorrect );
-            break;
-
-        default:
-            rc = RC( rcVFS, rcMgr, rcOpening, rcDirectory, rcUnknown );
-            break;
-        }
-
-        /* hacking in the fragment bit */
-        /* the C grammar specifies order of precedence... */
-        if ((rc == 0) && (path->fragment.size > 1 ))
-        {
-            const KDirectory * tempd = * d;
-            const char * fragment = path -> fragment . addr + 1;
-            int frag_size = ( int ) path -> fragment . size - 1;
-
-            assert ( fragment [ -1 ] == '#' );
-            
-            rc = KDirectoryOpenDirRead (tempd, d, false, "%.*s", frag_size, fragment );
-            
-            KDirectoryRelease (tempd);
-        }
-    }
-
-    KFileRelease(file);
-
-    return rc;
-}
-
-
-static
-rc_t VFSManagerOpenDirectoryReadLegrefseq (const VFSManager *self,
-                                           const KDirectory * dir,
-                                           KDirectory const **d,
-                                           const VPath * path,
-                                           bool force_decrypt)
-{
-    const KFile * file;
-    const KDirectory * dd;
-    size_t num_read;
-    char pbuff [4096]; /* path buffer */
-    rc_t rc;
-
-    assert (self);
-    assert (dir);
-    assert (d);
-    assert (path);
-    assert ((force_decrypt == false) || (force_decrypt == true));
-    assert (*d == NULL);
-
-    file = NULL;
-    dd = NULL;
-
-    /* hier part only */
-    rc = VPathReadPath (path, pbuff, sizeof pbuff, &num_read);
-    if ( rc == 0 )
-    {
-        char rbuff[ 4096 ]; /* resolved path buffer */
-        rc = KDirectoryResolvePath( dir, true, rbuff, sizeof rbuff, pbuff );
-        if ( rc == 0 )
-        {
-            uint32_t type;
-            bool was_encrypted;
-
-            type = KDirectoryPathType( dir, rbuff );
-            switch (type & ~kptAlias)
-            {
-            case kptNotFound:
-                rc = RC( rcVFS, rcMgr, rcOpening, rcDirectory, rcNotFound );
-                break;
-
-            case kptFile:
-                rc = VFSManagerOpenFileReadDirectoryRelativeInt (self, dir, 
-                                                                 &file, path, 
-                                                                 force_decrypt,
-                                                                 &was_encrypted);
-                if (rc == 0)
-                    rc = TransformFileToDirectory (dir, file, &dd, rbuff,
-                                                   was_encrypted);
-                break;
-
-            case kptBadPath:
-                rc = RC( rcVFS, rcMgr, rcOpening, rcDirectory, rcInvalid );
-                break;
-
-            case kptDir:
-                rc = KDirectoryOpenDirRead( dir, &dd, false, rbuff );
-                break;
-
-            case kptCharDev:
-            case kptBlockDev:
-            case kptFIFO:
-            case kptZombieFile:
-                rc = RC( rcVFS, rcMgr, rcOpening, rcDirectory, rcIncorrect );
-                break;
-
-            default:
-                rc = RC( rcVFS, rcMgr, rcOpening, rcDirectory, rcUnknown );
-                break;
-            }
-
-            if (rc == 0)
-            {
-                if ( path -> fragment . size < 2 )
-                    rc = RC( rcVFS, rcMgr, rcOpening, rcPath, rcIncorrect );
-                else
-                {
-                    const char *fragment = path -> fragment . addr + 1;
-                    int frag_size = ( int ) path -> fragment . size - 1;
-                    assert ( fragment [ -1 ] == '#' );
-
-                    rc = KDirectoryOpenDirRead (dd, d, false, "%.*s", frag_size, fragment );
-
-                    KDirectoryRelease (dd);
-                }
-            }
-        }
-    }
-    return rc;
-}
-
-
-static
-rc_t VFSManagerOpenDirectoryReadDirectoryRelativeInt (const VFSManager *self,
-                                                      const KDirectory * dir,
-                                                      KDirectory const **d,
-                                                      const VPath * path_,
-                                                      bool force_decrypt)
-{
-    rc_t rc;
-    do 
-    {
-        if (d == NULL)
-        {
-            rc =  RC (rcVFS, rcDirectory, rcOpening, rcParam, rcNull);
-            break;
-        }
-
-        *d = NULL;
-
-        if (self == NULL)
-        {
-            rc = RC (rcVFS, rcDirectory, rcOpening, rcSelf, rcNull);
-            break;
-        }
-
-        if ((dir == NULL) || (path_ == NULL))
-        {
-            rc = RC (rcVFS, rcDirectory, rcOpening, rcParam, rcNull);
-            break;
-        }
-
-#if 0
-        if ((force_decrypt != false) && (force_decrypt != true))
-        {
-            rc = RC (rcVFS, rcDirectory, rcOpening, rcParam, rcInvalid);
-            break;
-        }
-#endif
-
-        rc = VPathAddRef (path_);
-        if ( rc )
-            break;
-        else
-        {
-            const VPath *path = path_;
-            VPUri_t uri_type = VPathGetUri_t ( path );
-
-            switch ( uri_type )
-            {
-            default:
-            case vpuri_invalid:
-                rc = RC (rcVFS, rcDirectory, rcOpening, rcPath, rcInvalid);
-                break;
-
-
-            case vpuri_not_supported:
-                rc = RC (rcVFS, rcDirectory, rcOpening, rcPath, rcUnsupported);
-                break;
-
-            case vpuri_ncbi_acc:
-                if ( self->resolver != NULL )
-                    rc = ResolveVPathByVResolver( self->resolver, &path );
-                else
-                    rc = ResolveVPathBySRAPath( &path );
-                if ( rc != 0 )
-                    break;
-
-            /* !!! fall through !!! */
-
-            case vpuri_none:
-            case vpuri_ncbi_vfs:
-            case vpuri_file:
-                rc = VFSManagerOpenDirectoryReadKfs ( self, dir, d, path, force_decrypt );
-                break;
-
-            case vpuri_ncbi_legrefseq:
-                rc = VFSManagerOpenDirectoryReadLegrefseq ( self, dir, d, path, force_decrypt );
-                break;
-
-            case vpuri_http:
-            case vpuri_ftp:
-                rc = VFSManagerOpenDirectoryReadHttp ( self, dir, d, path, force_decrypt );
-                break;
-            }
-            VPathRelease ( path ); /* same as path_ if not uri */
-        }
-    } while (0);
-    return rc;
-}
-
-
-LIB_EXPORT 
-rc_t CC VFSManagerOpenDirectoryReadDirectoryRelative (const VFSManager *self,
-                                                      const KDirectory * dir,
-                                                      KDirectory const **d,
-                                                      const VPath * path)
-{
-    return VFSManagerOpenDirectoryReadDirectoryRelativeInt (self, dir, d, path, false);
-}
-
-
-LIB_EXPORT 
-rc_t CC VFSManagerOpenDirectoryReadDirectoryRelativeDecrypt (const VFSManager *self,
-                                                             const KDirectory * dir,
-                                                             KDirectory const **d,
-                                                             const VPath * path)
-{
-    return VFSManagerOpenDirectoryReadDirectoryRelativeInt (self, dir, d, path, true);
-}
-
-
-LIB_EXPORT rc_t CC VFSManagerOpenDirectoryReadDecrypt (const VFSManager *self,
-                                                       KDirectory const **d,
-                                                       const VPath * path)
-{
-    return VFSManagerOpenDirectoryReadDirectoryRelativeInt (self, self->cwd, d, path, true);
-}
-
-
-LIB_EXPORT rc_t CC VFSManagerOpenDirectoryRead (const VFSManager *self,
-                                                KDirectory const **d,
-                                                const VPath * path)
-{
-    return VFSManagerOpenDirectoryReadDirectoryRelativeInt (self, self->cwd, d, path, false);
-}
-
-
-/* OpenFileWrite
- *  opens an existing file with write access
- *
- *  "f" [ OUT ] - return parameter for newly opened file
- *
- *  "update" [ IN ] - if true, open in read/write mode
- *  otherwise, open in write-only mode
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target file
- */
-LIB_EXPORT rc_t CC VFSManagerOpenFileWrite (const VFSManager *self,
-                                            KFile **f, bool update,
-                                            const VPath * path )
-{
-    /* -----
-     * this is a first pass that only opens files directory referenced from 
-     * the ced or have a sysdir root; that is it uses KSysDir and KSysFile
-     * only.
-     */
-    KFile * file = NULL;
-    size_t num_read;
-    char pbuff [4096];
-    rc_t rc;
-
-    if ((f == NULL) || (path == NULL))
-        return RC (rcVFS, rcMgr, rcOpening, rcParam, rcNull);
-
-    *f = NULL;
-
-    if (self == NULL)
-        return RC (rcVFS, rcMgr, rcOpening, rcSelf, rcNull);
-
-    rc = VPathReadPath (path, pbuff, sizeof pbuff, &num_read);
-    if (rc == 0)
-    {
-        /* handle a few special case path names
-         * This probably needs to be system specifica eventually
-         */
-        if (strncmp ("/dev/", pbuff, sizeof "/dev/" - 1) == 0)
-        {
-
-            if (strcmp ("/dev/stdout", pbuff) == 0)
-                rc = KFileMakeStdOut (&file);
-            else if (strcmp ("/dev/stderr", pbuff) == 0)
-                rc = KFileMakeStdErr (&file);
-            else if (strcmp ("/dev/null", pbuff) == 0)
-                rc = KFileMakeNullUpdate (&file);
-            else if (strncmp ("/dev/fd/", pbuff, sizeof "/dev/fd/" - 1) == 0)
-            {
-                char * pc;
-                size_t ix;
-
-                pc = pbuff + sizeof "/dev/fd/" - 1;
-
-                for (ix = 0; isdigit (pc[ix]); ++ix)
-                    ;
-
-                if ((ix > 0)&&(pc[ix] == '\0'))
-                {
-                    int fd = atoi (pc);
-
-                    rc = KFileMakeFDFileWrite (&file, update, fd);
-                }
-            }
-        }
-        if ((rc == 0)&&(file == NULL))
-        {
-            char rbuff [4096];
-
-            rc = KDirectoryResolvePath (self->cwd, true, rbuff, sizeof rbuff, pbuff);
-            if (rc == 0)
-            {
-                uint32_t type;
-
-                type = KDirectoryPathType (self->cwd, rbuff);
-                switch (type & ~kptAlias)
-                {
-                case kptNotFound:
-                    rc = RC (rcVFS, rcMgr, rcOpening, rcFile, rcNotFound);
-                    break;
-
-                case kptFile:
-                    rc = KDirectoryOpenFileWrite (self->cwd, &file, update, rbuff);
-                    break;
-
-                case kptBadPath:
-                    rc = RC (rcVFS, rcMgr, rcOpening, rcFile, rcInvalid);
-                    break;
-                case kptDir:
-                case kptCharDev:
-                case kptBlockDev:
-                case kptFIFO:
-                case kptZombieFile:
-                    rc = RC (rcVFS, rcMgr, rcOpening, rcFile, rcIncorrect);
-                    break;
-
-                default:
-                    rc = RC (rcVFS, rcMgr, rcOpening, rcFile, rcUnknown);
-                    break;
-                }
-            }
-        }
-    }
-    if (rc == 0)
-    {
-        size_t z;
-        char obuff [VFS_KRYPTO_PASSWORD_MAX_SIZE+2];
-
-        if (VPathOption (path, vpopt_encrypted, obuff, sizeof obuff, &z) == 0)
-        {
-            rc = GetEncryptionKey(self, path, obuff, sizeof(obuff), &z);
-            if (rc == 0)
-            {
-                KKey key;
-                KFile * encfile;
-            
-                rc = KKeyInitUpdate (&key, kkeyAES128, obuff, z);
-                if (rc == 0)
-                {
-                    rc = KEncFileMakeWrite (&encfile, file, &key);
-                    if (rc == 0)
-                    {
-                        KFileRelease (file); /* owned by encfile now */
-                        *f = encfile;
-                        return 0;
-                    }
-                }
-            }
-            if (rc)
-                KFileRelease (file);
-        }
-        else
-        {
-            *f = file;
-            return 0;
-        }
-    }
-    return rc;
-}
-
-
-/* CreateFile
- *  opens a file with write access
- *
- *  "f" [ OUT ] - return parameter for newly opened file
- *
- *  "update" [ IN ] - if true, open in read/write mode
- *  otherwise, open in write-only mode
- *
- *  "access" [ IN ] - standard Unix access mode, e.g. 0664
- *
- *  "mode" [ IN ] - a creation mode ( see explanation above ).
- *
- *  "path" [ IN ] VPath representing the path, URL or URN of the desired file
- */
-LIB_EXPORT rc_t CC VFSManagerCreateFile ( const VFSManager *self, KFile **f,
-                                          bool update, uint32_t access, KCreateMode mode, const VPath * path )
-{
-    /* -----
-     * this is a first pass that only opens files directory referenced from 
-     * the ced or have a sysdir root; that is it uses KSysDir and KSysFile
-     * only.
-     */
-    KFile * file = NULL;
-    size_t num_read;
-    rc_t rc;
-    bool file_created = false;
-    char pbuff [4096];
-    char rbuff [4096];
-
-    if ((f == NULL) || (path == NULL))
-        return RC (rcVFS, rcMgr, rcOpening, rcParam, rcNull);
-
-    *f = NULL;
-
-    if (self == NULL)
-        return RC (rcVFS, rcMgr, rcOpening, rcSelf, rcNull);
-
-    rc = VPathReadPath (path, pbuff, sizeof pbuff, &num_read);
-    if (rc == 0)
-    {
-
-        /* handle a few special case path names
-         * This probably needs to be system specifica eventually
-         */
-        if (strncmp ("/dev/", pbuff, sizeof "/dev/" - 1) == 0)
-        {
-
-            if (strcmp ("/dev/stdout", pbuff) == 0)
-                rc = KFileMakeStdOut (&file);
-            else if (strcmp ("/dev/stderr", pbuff) == 0)
-                rc = KFileMakeStdErr (&file);
-            else if (strcmp ("/dev/null", pbuff) == 0)
-                rc = KFileMakeNullUpdate (&file);
-            else if (strncmp ("/dev/fd/", pbuff, sizeof "/dev/fd/" - 1) == 0)
-            {
-                char * pc;
-                size_t ix;
-
-                pc = pbuff + sizeof "/dev/fd/" - 1;
-
-                for (ix = 0; isdigit (pc[ix]); ++ix)
-                    ;
-
-                if ((ix > 0)&&(pc[ix] == '\0'))
-                {
-                    int fd = atoi (pc);
-
-                    rc = KFileMakeFDFileWrite (&file, update, fd);
-                }
-            }
-        }
-        if ((rc == 0)&&(file == NULL))
-        {
-            rc = KDirectoryResolvePath (self->cwd, true, rbuff, sizeof rbuff, pbuff);
-            if (rc == 0)
-            {
-                uint32_t type;
-
-                type = KDirectoryPathType (self->cwd, rbuff);
-                switch (type & ~kptAlias)
-                {
-                case kptNotFound:
-                case kptFile:
-                    rc = KDirectoryCreateFile (self->cwd, &file, update, access, mode,
-                                               rbuff);
-                    if (rc == 0)
-                        file_created = true;
-                    break;
-
-                case kptBadPath:
-                    rc = RC (rcVFS, rcMgr, rcOpening, rcFile, rcInvalid);
-                    break;
-                case kptDir:
-                case kptCharDev:
-                case kptBlockDev:
-                case kptFIFO:
-                case kptZombieFile:
-                    rc = RC (rcVFS, rcMgr, rcOpening, rcFile, rcIncorrect);
-                    break;
-
-                default:
-                    rc = RC (rcVFS, rcMgr, rcOpening, rcFile, rcUnknown);
-                    break;
-                }
-            }
-        }
-    }
-    if (rc == 0)
-    {
-        size_t z;
-        char obuff [VFS_KRYPTO_PASSWORD_MAX_SIZE+2];
-
-        if (VPathOption (path, vpopt_encrypted, obuff, sizeof obuff, &z) == 0)
-        {
-            rc = GetEncryptionKey(self, path, obuff, sizeof(obuff), &z);
-            if (rc == 0)
-            {
-                KKey key;
-                KFile * encfile;
-                rc = KKeyInitUpdate (&key, kkeyAES128, obuff, z);
-
-                obuff[z] = '\0';
-
-                rc = KEncFileMakeWrite (&encfile, file, &key);
-                if (rc == 0)
-                {
-                    KFileRelease (file); /* now owned by encfile */
-                    *f = encfile;
-                    return 0;   
-                }
-            }
-            if (rc)
-                KFileRelease (file);
-        }
-        else
-        {
-            *f = file;
-            return 0;
-        }
-    }
-    if (rc && file_created)
-        KDirectoryRemove (self->cwd, true, rbuff);
-    return rc;
-}
-
-
-/* Remove
- *  remove an accessible object from its directory
- *
- *  "force" [ IN ] - if true and target is a directory,
- *  remove recursively
- *
- *  "path" [ IN ] - NUL terminated string in directory-native
- *  character set denoting target object
- */
-LIB_EXPORT rc_t CC VFSManagerRemove ( const VFSManager *self, bool force,
-                                      const VPath * path )
-{
-    /* -----
-     * this is a first pass that only opens files directory referenced from 
-     * the ced or have a sysdir root; that is it uses KSysDir and KSysFile
-     * only.
-     */
-    size_t num_read;
-    char pbuff [4096];
-    rc_t rc;
-
-    if (path == NULL)
-        return RC (rcVFS, rcMgr, rcOpening, rcParam, rcNull);
-
-    if (self == NULL)
-        return RC (rcVFS, rcMgr, rcOpening, rcSelf, rcNull);
-
-    rc = VPathReadPath (path, pbuff, sizeof pbuff, &num_read);
-    if (rc == 0)
-    {
-        char rbuff [4096];
-    
-        rc = KDirectoryResolvePath (self->cwd, true, rbuff, sizeof rbuff, pbuff);
-        if (rc == 0)
-        {
-            uint32_t type;
-
-            type = KDirectoryPathType (self->cwd, rbuff);
-            switch (type & ~kptAlias)
-            {
-            case kptNotFound:
-                break;
-
-            case kptFile:
-            case kptDir:
-            case kptCharDev:
-            case kptBlockDev:
-            case kptFIFO:
-            case kptZombieFile:
-                rc = KDirectoryRemove (self->cwd, force, rbuff);
-                break;
-
-            case kptBadPath:
-                rc = RC (rcVFS, rcMgr, rcOpening, rcFile, rcInvalid);
-                break;
-/*                 rc = RC (rcVFS, rcMgr, rcOpening, rcFile, rcIncorrect); */
-/*                 break; */
-
-            default:
-                rc = RC (rcVFS, rcMgr, rcOpening, rcFile, rcUnknown);
-                break;
-            }
-        }
-    }
-    return rc;
-}
-
-/* Make
- */
-LIB_EXPORT rc_t CC VFSManagerMake ( VFSManager ** pmanager )
-{
-    return VFSManagerMakeFromKfg(pmanager, NULL);
-}
-
-/* Make
- */
-LIB_EXPORT rc_t CC VFSManagerMakeFromKfg ( struct VFSManager ** pmanager,
-    struct KConfig * cfg)
-{
-    rc_t rc;
-
-    if (pmanager == NULL)
-        return RC (rcVFS, rcMgr, rcConstructing, rcParam, rcNull);
-
-    *pmanager = singleton;
-    if ( singleton != NULL )
-    {
-        rc = VFSManagerAddRef ( singleton );
-        if ( rc != 0 )
-            *pmanager = NULL;
-    }
-    else
-    {
-        VFSManager * obj;
-
-        obj = calloc (1, sizeof (*obj));
-        if (obj == NULL)
-            rc = RC (rcVFS, rcMgr, rcConstructing, rcMemory, rcExhausted);
-        else
-        {
-            KRefcountInit (& obj -> refcount, 1,
-                kfsmanager_classname, "init", "singleton" );
-
-            rc = KDirectoryNativeDir ( & obj -> cwd );
-            if ( rc == 0 )
-            {
-                if (cfg == NULL)
-                    rc = KConfigMake ( & obj -> cfg, NULL );
-                else
-                {
-                    rc = KConfigAddRef ( cfg );
-                    if (rc == 0)
-                        obj -> cfg = cfg;
-                }
-                if ( rc == 0 )
-                {
-                    rc = KCipherManagerMake ( & obj -> cipher );
-                    if ( rc == 0 )
-                    {
-                        rc = KKeyStoreMake ( & obj -> keystore, obj -> cfg );
-                        if ( rc == 0 )
-                        {
-                            rc = VFSManagerMakeResolver ( obj, & obj -> resolver, obj -> cfg );
-                            if ( rc != 0 )
-                            {
-                                LOGERR ( klogWarn, rc, "could not build vfs-resolver" );
-                                rc = 0;
-                            }
-
-                            rc = KNSManagerMake ( & obj -> kns );
-                            if ( rc != 0 )
-                            {
-                                LOGERR ( klogWarn, rc, "could not build network manager" );
-                                rc = 0;
-                            }
-
-                            *pmanager = singleton = obj;
-       DBGMSG(DBG_KNS, DBG_FLAG(DBG_KNS_MGR),  ("%s(%p)\n", __FUNCTION__, cfg));
-                            return 0;
-                        }
-                    }
-                }
-            }
-        }
-
-        VFSManagerDestroy (obj);
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC VFSManagerGetCWD (const VFSManager * self, KDirectory ** cwd)
-{
-    rc_t rc;
-
-    if ( cwd == NULL )
-        rc = RC (rcVFS, rcMgr, rcAccessing, rcParam, rcNull);
-    else
-    {
-        if ( self == NULL )
-            rc = RC (rcVFS, rcMgr, rcAccessing, rcSelf, rcNull);
-        else
-        {
-            rc = KDirectoryAddRef ( self -> cwd );
-            if ( rc == 0 )
-            {
-                * cwd = self -> cwd;
-                return 0;
-            }
-        }
-
-        * cwd = NULL;
-    }
-
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC VFSManagerGetResolver ( const VFSManager * self, struct VResolver ** resolver )
-{
-    rc_t rc;
-
-    if ( resolver == NULL )
-        rc = RC (rcVFS, rcMgr, rcAccessing, rcParam, rcNull);
-    else
-    {
-        if ( self == NULL )
-            rc = RC (rcVFS, rcMgr, rcAccessing, rcSelf, rcNull);
-        else
-        {
-            rc = VResolverAddRef ( self -> resolver );
-            if ( rc == 0 )
-            {
-                * resolver = self -> resolver;
-                return 0;
-            }
-        }
-
-        * resolver = NULL;
-    }
-
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC VFSManagerGetKNSMgr ( const VFSManager * self, struct KNSManager ** kns )
-{
-    rc_t rc;
-
-    if ( kns == NULL )
-        rc = RC (rcVFS, rcMgr, rcAccessing, rcParam, rcNull);
-    else
-    {
-        if ( self == NULL )
-            rc = RC (rcVFS, rcMgr, rcAccessing, rcSelf, rcNull);
-        else
-        {
-            rc = KNSManagerAddRef ( self -> kns );
-            if ( rc == 0 )
-            {
-                * kns = self -> kns;
-                return 0;
-            }
-        }
-
-        * kns = NULL;
-    }
-
-    return rc;
-}
-
-
-LIB_EXPORT rc_t CC VFSManagerGetKryptoPassword (const VFSManager * self,
-                                                char * password,
-                                                size_t max_size,
-                                                size_t * size)
-{
-    rc_t rc;
-
-    if (self == NULL)
-        rc = RC (rcVFS, rcMgr, rcAccessing, rcSelf, rcNull);
-
-    else if ((password == NULL) || (max_size == 0) || (size == NULL))
-        rc = RC (rcVFS, rcMgr, rcAccessing, rcParam, rcNull);
-
-    else
-    {
-        size_t z;
-        char obuff [4096 + 16];
-
-        rc = VFSManagerGetConfigPWFile(self, obuff, sizeof obuff, &z);
-        if (rc == 0)
-        {
-            VPath * vpath;
-            rc_t rc2;
-            rc = VPathMake (&vpath, obuff);
-            if (rc == 0)
-                rc = GetEncryptionKey(self, vpath, password, max_size, size);
-            rc2 = VPathRelease (vpath);
-            if (rc == 0)
-                rc = rc2;
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VFSManagerUpdateKryptoPassword (const VFSManager * self, 
-                                                   const char * password,
-                                                   size_t size,
-                                                   char * pwd_dir,
-                                                   size_t pwd_dir_size)
-{
-    static const char temp_extension [] = ".tmp";
-    rc_t rc;
-
-    if (self == NULL)
-        rc = RC (rcVFS, rcEncryptionKey, rcUpdating, rcSelf, rcNull);
-
-    else if ((password == NULL) || (size == 0))
-        rc = RC (rcVFS, rcEncryptionKey, rcUpdating, rcParam, rcNull);
-
-    else if (size > VFS_KRYPTO_PASSWORD_MAX_SIZE)
-        rc = RC (rcVFS, rcEncryptionKey, rcUpdating, rcSize, rcExcessive);
-
-    else if ((string_chr (password, size, '\n') != NULL) ||
-             (string_chr (password, size, '\r') != NULL))
-        rc = RC (rcVFS, rcEncryptionKey, rcUpdating, rcEncryptionKey, rcInvalid);
-
-    else
-    {
-        size_t old_password_file_size;
-        char old_password_file [8193];
-        
-        rc = VFSManagerGetConfigPWFile (self, old_password_file,
-                                        sizeof old_password_file - 1,
-                                        &old_password_file_size);
-        if (rc) {
-            if (rc ==
-                SILENT_RC(rcKrypto, rcMgr, rcReading, rcBuffer, rcInsufficient))
-            {
-                rc =
-                    RC(rcVFS, rcEncryptionKey, rcUpdating, rcPath, rcExcessive);
-            }
-            LOGERR (klogErr, rc, "failed to obtain configured path for password file");
-        }
-
-        else if (old_password_file_size >= (sizeof old_password_file - 1))
-        {
-            rc = RC (rcVFS, rcEncryptionKey, rcUpdating, rcPath, rcExcessive);
-            PLOGERR (klogErr,
-                     (klogErr, rc, "configured path too long for function "
-                      "'$(P)' '${F}'", "P=%s,F=%s",
-                      old_password_file, __func__));
-        }
-        else
-        {
-            KPathType ftype;
-            bool old_exists;
-
-            old_password_file[old_password_file_size] = '\0';
-            ftype = KDirectoryPathType (self->cwd, old_password_file);
-
-            switch (ftype)
-            {
-            case kptNotFound:
-                old_exists = false;
-                break;
-
-            case kptBadPath:
-                rc = RC (rcVFS, rcEncryptionKey, rcUpdating, rcPath, rcInvalid);
-                break;
-
-            case kptFile:
-                old_exists = true;
-                break;
-
-            case kptDir:
-            case kptCharDev:
-            case kptBlockDev:
-            case kptFIFO:
-            case kptZombieFile:
-            case kptDataset:
-            case kptDatatype:
-                rc = RC (rcVFS, rcEncryptionKey, rcUpdating, rcPath, rcIncorrect);
-                break;
-
-            default:
-                rc = RC (rcVFS, rcEncryptionKey, rcUpdating, rcPath, rcCorrupt);
-                break;
-            }
-
-            if (rc)
-                PLOGERR (klogErr,
-                         (klogErr, rc, "cannot use configured path for "
-                          "password file '$(P)'", "P=%s", old_password_file));
-
-            else
-            {
-                VPath * vold;
-                size_t new_password_file_size;
-                char new_password_file [sizeof old_password_file + sizeof temp_extension];
-                size_t password_dir_size;
-                char password_dir [sizeof old_password_file];
-/*                 bool save_old_password; */
-                char * pc;
-
-                memcpy (password_dir, old_password_file, old_password_file_size);
-                memcpy (new_password_file, old_password_file, old_password_file_size);
-                memcpy (new_password_file + old_password_file_size, temp_extension, sizeof temp_extension);
-                new_password_file_size = old_password_file_size + sizeof temp_extension - 1;
-
-                pc = string_rchr (password_dir, old_password_file_size, '/');
-                if (pc == NULL)
-                {
-                    password_dir[0] = '.';
-                    pc = password_dir+1;
-                }
-                *pc = '\0';
-                password_dir_size = pc - password_dir;
-
-                if (pwd_dir && pwd_dir_size) {
-                    size_t n = string_copy(pwd_dir, pwd_dir_size,
-                                           password_dir, password_dir_size + 1);
-                    if (n >= pwd_dir_size) {
-                        int i = 0;
-                        size_t p = pwd_dir_size - 1;
-                        pwd_dir[p] = '\0';
-                        for (i = 0; i < 3; ++i) {
-                            if (p == 0)
-                            {   break; }
-                            pwd_dir[--p] = '.';
-                        }
-                        if (p != 0)
-                        {   pwd_dir[--p] = ' '; }
-                    }
-                }
-
-                rc = VPathMake (&vold, old_password_file);
-                if (rc)
-                    PLOGERR (klogErr,
-                             (klogErr, rc, "could not create vpath for "
-                              "password file '$(P)'", "P=%s",
-                              old_password_file));
-
-                else
-                {
-                    VPath * vnew;
-
-                    rc = VPathMake (&vnew, new_password_file);
-                    if (rc)
-                        PLOGERR (klogErr,
-                                 (klogErr, rc, "could not create vpath for "
-                                  "password file '$(P)'", "P=%s",
-                                  new_password_file));
-
-                    else
-                    {
-                        const KFile * fold = NULL;
-                        KFile * fnew = NULL;
-
-                        if (old_exists)
-                        {
-                            rc = VFSManagerOpenFileRead (self, &fold, vold);
-
-                            if (rc)
-                                PLOGERR (klogErr,
-                                         (klogErr, rc, "unable to open existing "
-                                          "password file '$(P)'", "P=%s",
-                                          old_password_file));
-                        }
-                        
-
-                        if (rc == 0)
-                        {
-                            rc = VFSManagerCreateFile (self, &fnew, false, 0600,
-                                                       kcmInit|kcmParents,
-                                                       vnew);
-                            if (rc)
-                                PLOGERR (klogErr,
-                                         (klogErr, rc, "unable to open temporary "
-                                          "password file '$(P)'", "P=%s",
-                                          new_password_file));
-
-                            else
-                            {
-                                uint64_t writ;
-                                size_t this_writ;
-
-                                rc = KFileWriteAll (fnew, 0, password, size, &this_writ);
-                                if (rc)
-                                    PLOGERR (klogErr,
-                                             (klogErr, rc, "unable to write "
-                                              "password to temporary password "
-                                              "file '$(P)'", "P=%s",
-                                              new_password_file));
-
-                                else if (this_writ != size)
-                                {
-                                    rc = RC (rcVFS, rcEncryptionKey, rcWriting,
-                                             rcFile, rcInsufficient);
-                                    PLOGERR (klogErr,
-                                             (klogErr, rc, "unable to write complete "
-                                              "password to temporary password "
-                                              "file '$(P)'", "P=%s",
-                                              new_password_file));
-                                }
-
-                                else
-                                {
-                                    writ = this_writ;
-
-                                    rc = KFileWriteAll (fnew, this_writ, "\n", 1, &this_writ);
-                                    if (rc)
-                                        PLOGERR (klogErr,
-                                                 (klogErr, rc, "unable to write "
-                                                  "password to temporary password "
-                                                  "file '$(P)'", "P=%s",
-                                                  new_password_file));
-
-                                    else if (this_writ != 1)
-                                    {
-                                        rc = RC (rcVFS, rcEncryptionKey, rcWriting,
-                                                 rcFile, rcInsufficient);
-                                        PLOGERR (klogErr,
-                                                 (klogErr, rc, "unable to write complete "
-                                                  "password to temporary password "
-                                                  "file '$(P)'", "P=%s",
-                                                  new_password_file));
-                                    }
-
-                                    else
-                                    {
-                                        bool do_rename;
-
-                                        do_rename = true;
-                                        ++writ;
-
-                                        if (old_exists)
-                                        {
-                                            uint64_t read;
-                                            size_t this_read;
-                                            char buffer [VFS_KRYPTO_PASSWORD_MAX_SIZE+4];
-
-                                            rc = KFileReadAll (fold, 0, buffer,
-                                                               sizeof buffer, &this_read);
-                                            if (rc)
-                                                ;
-
-                                            else
-                                            {
-                                                read = this_read;
-                                                /* look for duplicated password */
-                                                if (read > size)
-                                                {
-                                                    char cc;
-
-                                                    cc = buffer[size];
-                                                    if (((cc == '\n') || (cc == '\r')) &&
-                                                        (memcmp (buffer, password, size) == 0))
-                                                    {
-                                                        do_rename = false;
-                                                    }
-                                                }
-                                                if (read)
-                                                    rc = KFileWriteAll (fnew, writ, buffer, read, &this_writ);
-
-                                                if (rc)
-                                                    ;
-                                                else if (do_rename)
-                                                {
-                                                    writ += this_writ;
-
-                                                    do
-                                                    {
-                                                        rc = KFileReadAll (fold, read, buffer,
-                                                                           sizeof buffer, &this_read);
-                                                        if (rc)
-                                                            ;
-
-                                                        else if (this_read == 0)
-                                                            break;
-
-                                                        else
-                                                        {
-                                                            rc = KFileWriteAll (fnew, writ, buffer,
-                                                                                this_read, &this_writ);
-                                                            if (rc)
-                                                                ;
-
-                                                            else if (this_read != this_writ)
-                                                            {
-                                                                rc = RC (rcVFS, rcEncryptionKey, rcWriting,
-                                                                         rcFile, rcInsufficient);
-                                                                PLOGERR (klogErr,
-                                                                         (klogErr, rc,
-                                                                          "unable to write complete "
-                                                                          "password to temporary password "
-                                                                          "file '$(P)'", "P=%s",
-                                                                          new_password_file));
-                                                            }
-
-                                                            else
-                                                            {
-                                                                read += this_read;
-                                                                writ += this_writ;
-                                                            }
-                                                        }
-                                                    } while (rc == 0);
-                                                }
-                                            }
-                                            KFileRelease (fold);
-                                            fold = NULL;
-                                        }
-
-                                        KFileRelease (fnew);
-                                        fnew = NULL;
-
-                                        if (rc == 0)
-                                        {
-                                            if (do_rename)
-                                            {
-                                                rc = KDirectoryRename (self->cwd, true, 
-                                                                       new_password_file,
-                                                                       old_password_file);
-                                            }
-                                            else
-                                            {
-                                                KDirectoryRemove (self->cwd, true, new_password_file);
-                                            }
-
-#if !WINDOWS
-                                            if (rc == 0)
-                                            {
-                                                uint32_t access;
-
-                                                rc = KDirectoryAccess (self->cwd,
-                                                                       &access, password_dir);
-                                                if (rc)
-                                                    ;
-
-                                                else
-                                                {
-                                                    if (access & 0027)
-                                                        rc = RC (rcVFS, rcEncryptionKey, rcUpdating, rcDirectory, rcExcessive);
-                                                }
-                                            }
-#endif
-                                        }
-                                    }
-                                }
-                                KFileRelease (fnew);
-                            }
-                            KFileRelease (fold);
-                        }
-                        VPathRelease (vold);
-                    }
-                    VPathRelease (vnew);
-                }
-            }
-        }
-    }
-    return rc;
-}
-
-/*--------------------------------------------------------------------------
- * KConfig
- *  placing some KConfig code that relies upon VFS here
- */
-
-
-/* ReadVPath
- *  read a VPath node value
- *
- * self [ IN ] - KConfig object
- * path [ IN ] - path to the node
- * result [ OUT ] - return value (rc != 0 if cannot be converted)
- *
- */
-LIB_EXPORT rc_t CC KConfigReadVPath ( struct KConfig const* self, const char* path, struct VPath** result )
-{
-    rc_t rc;
-
-    if ( result == NULL )
-        rc = RC ( rcKFG, rcNode, rcReading, rcParam, rcNull );
-    else
-    {
-        struct KConfigNode const *n;
-        rc = KConfigOpenNodeRead ( self, & n, path );
-        if ( rc == 0 )
-        {
-            rc = KConfigNodeReadVPath ( n, result );
-            KConfigNodeRelease ( n );
-            return rc;
-        }
-
-        * result = NULL;
-    }
-
-    return rc;
-}
-
-/* ReadVPath
- *  read a VPath node value
- *
- * self [ IN ] - KConfigNode object
- * result [ OUT ] - return value (rc != 0 if cannot be converted)
- *
- */
-LIB_EXPORT rc_t CC KConfigNodeReadVPath ( struct KConfigNode const *self, struct VPath** result )
-{
-    rc_t rc;
-
-    if ( result == NULL )
-        rc = RC ( rcKFG, rcNode, rcReading, rcParam, rcNull );
-    else
-    {
-        char buffer [ 4096 ];
-        size_t num_read, to_read;
-        rc = KConfigNodeRead ( self, 0, buffer, sizeof buffer, & num_read, & to_read );
-        if ( rc == 0 )
-        {
-            char *p;
-
-            if ( to_read == 0 && num_read < sizeof buffer )
-            {
-                buffer [ num_read ] = 0;
-                return VPathMake ( result, buffer );
-            }
-
-            p = malloc ( num_read + to_read + 1 );
-            if ( p == NULL )
-                rc = RC ( rcKFG, rcNode, rcReading, rcMemory, rcExhausted );
-            else
-            {
-                rc = KConfigNodeRead ( self, 0, p, num_read + to_read + 1, & num_read, & to_read );
-                if ( rc == 0 )
-                {
-                    p [ num_read ] = 0;
-                    rc = VPathMake ( result, p );
-                }
-
-                free ( p );
-                return rc;
-            }
-        }
-
-        * result = NULL;
-    }
-
-    return rc;
-}
-
-
-static rc_t VFSManagerResolveAcc( const VFSManager * self,
-                                  const struct VPath * source,
-                                  struct VPath ** path_to_build,
-                                  const struct KFile ** remote_file,
-                                  const struct VPath ** local_cache )
-{
-    rc_t rc;
-    const VPath * local, * remote;
-    
-    assert (self);
-    assert (source);
-    assert (path_to_build);
-    assert (remote_file);
-    assert (local_cache);
-
-#if 1
-    rc = VResolverQuery ( self -> resolver, eProtocolHttp, source, & local, & remote, local_cache );
-    if ( rc == 0 )
-    {
-        assert ( local != NULL || remote != NULL );
-        assert ( local == NULL || remote == NULL );
-        * path_to_build = ( VPath* ) ( ( local != NULL ) ? local : remote );
-    }
-#else
-
-    /* first try to find it localy */
-    rc = VResolverLocal ( self->resolver, source, (const VPath **)path_to_build );
-    if ( GetRCState( rc ) == rcNotFound )
-    {
-        /* if not found localy, try to find it remotely */
-        rc = VResolverRemote ( self->resolver, eProtocolHttp,
-            source, (const VPath **)path_to_build, remote_file );
-        if ( rc == 0 && remote_file != NULL && local_cache != NULL )
-        {
-            /* if found and the caller wants to know the location of a local cache file... */
-            uint64_t size_of_remote_file = 0;
-            if ( *remote_file != NULL )
-                rc = KFileSize ( *remote_file, &size_of_remote_file );
-            if ( rc ==  0 )
-                rc = VResolverCache ( self->resolver, *path_to_build, local_cache, size_of_remote_file );
-        }
-    }
-
-#endif
-    return rc;
-}
-
-
-static rc_t VFSManagerResolveLocal( const VFSManager * self,
-                                    const char * local_path,
-                                    struct VPath ** path_to_build )
-{
-    assert ( self != NULL );
-    assert ( local_path != NULL && local_path [ 0 ] != 0 );
-    assert ( path_to_build != NULL );
-
-    return VFSManagerMakePath ( self, path_to_build, "ncbi-file:%s", local_path );
-}
-
-static rc_t VFSManagerResolvePathOrAcc( const VFSManager * self,
-                                        const struct VPath * source,
-                                        struct VPath ** path_to_build,
-                                        const struct KFile ** remote_file,
-                                        const struct VPath ** local_cache,
-                                        bool resolve_acc )
-{
-    char buffer[ 4096 ];
-    size_t num_read;
-    rc_t rc = VPathReadPath ( source, buffer, sizeof buffer, &num_read );
-    if ( rc == 0 && num_read > 0 )
-    {
-        char * pos_of_slash = string_chr ( buffer, string_size( buffer ), '/' );
-        if ( pos_of_slash != NULL )
-        {
-            /* we can now assume that the source is a filesystem-path :
-               we build a new VPath and prepend with 'ncbi-file:' */
-            rc = VFSManagerResolveLocal( self, buffer, path_to_build );
-        }
-        else if ( resolve_acc )
-        {
-            /* we assume the source is an accession! */
-            rc = VFSManagerResolveAcc( self, source, path_to_build, remote_file, local_cache );
-            if ( GetRCState( rc ) == rcNotFound )
-            {
-                /* if we were not able to find the source as accession, we assume it is a local path */
-                rc = VFSManagerResolveLocal( self, buffer, path_to_build );
-            }
-        }
-        else
-        {
-            rc = RC ( rcVFS, rcMgr, rcAccessing, rcParam, rcInvalid );
-        }
-    }
-    return rc;
-}
-
-
-static rc_t VFSManagerResolveRemote( const VFSManager * self,
-                                     struct VPath ** source,
-                                     struct VPath ** path_to_build,
-                                     const struct KFile ** remote_file,
-                                     const struct VPath ** local_cache )
-{
-    rc_t rc = 0;
-    *path_to_build = *source;
-    if ( local_cache != NULL && remote_file != NULL && self->resolver != NULL )
-    {
-
-/*        VFS_EXTERN rc_t CC VPathMakeString ( const VPath * self, const String ** uri ); */
-        char full_url[ 4096 ];
-        size_t num_read;
-        rc = VPathReadPath ( *source, full_url, sizeof full_url, &num_read );
-        if ( rc == 0 && num_read > 0 )
-        {
-            rc = KNSManagerMakeHttpFile ( self -> kns, remote_file, NULL, 0x01010000, full_url );
-            if ( rc == 0 )
-            {
-                uint64_t size_of_remote_file = 0;
-                rc = KFileSize ( *remote_file, &size_of_remote_file );
-                if ( rc == 0 )
-                    rc = VResolverCache ( self->resolver, *source, local_cache, size_of_remote_file );
-            }
-        }
-    }
-    *source = NULL;
-    return rc;
-}
-
-/* DEPRECATED */
-LIB_EXPORT rc_t CC VFSManagerResolveSpec ( const VFSManager * self,
-                                           const char * spec,
-                                           struct VPath ** path_to_build,
-                                           const struct KFile ** remote_file,
-                                           const struct VPath ** local_cache,
-                                           bool resolve_acc )
-{
-    rc_t rc = 0;
-    if ( self == NULL )
-        rc = RC ( rcVFS, rcMgr, rcAccessing, rcSelf, rcNull );
-    else if ( spec == NULL || path_to_build == NULL )
-        rc = RC ( rcVFS, rcMgr, rcAccessing, rcParam, rcNull );
-    else if ( spec[ 0 ] == 0 )
-        rc = RC ( rcVFS, rcMgr, rcAccessing, rcParam, rcEmpty );
-    else
-    {
-        VPath * temp;
-        *path_to_build = NULL;
-        if ( local_cache != NULL )
-            *local_cache = NULL;
-        if ( remote_file != NULL ) 
-            *remote_file = NULL;
-        rc = VPathMake ( &temp, spec );
-        if ( rc == 0 )
-        {
-            VPUri_t uri_type;
-            rc = VPathGetScheme_t( temp, &uri_type );
-            if ( rc == 0 )
-            {
-                switch ( uri_type )
-                {
-                default                  : /* !! fall through !! */
-                case vpuri_invalid       : rc = RC ( rcVFS, rcMgr, rcAccessing, rcParam, rcInvalid );
-                                           break;
-
-                case vpuri_none          : /* !! fall through !! */
-                case vpuri_not_supported : rc = VFSManagerResolvePathOrAcc( self, temp, path_to_build, remote_file, local_cache, resolve_acc );
-                                           break;
-
-                case vpuri_ncbi_vfs      : /* !! fall through !! */
-                case vpuri_file          : *path_to_build = temp;
-                                           temp = NULL;
-                                           break;
-
-                case vpuri_ncbi_acc      : if ( resolve_acc )
-                                                rc = VFSManagerResolveAcc( self, temp, path_to_build, remote_file, local_cache );
-                                           else
-                                                rc = RC ( rcVFS, rcMgr, rcAccessing, rcParam, rcInvalid );
-                                           break;
-
-                case vpuri_http          : /* !! fall through !! */
-                case vpuri_ftp           : rc = VFSManagerResolveRemote( self, &temp, path_to_build, remote_file, local_cache );
-                                           break;
-
-                case vpuri_ncbi_legrefseq: /* ??? */
-                                           break;
-                }
-            }
-            if ( temp != NULL )
-                VPathRelease ( temp );
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT const struct KConfig* CC VFSManagerGetConfig(const struct VFSManager * self)
-{
-    if ( self == NULL )
-        return NULL;
-    return self->cfg;
-}
-
-/*
- * Object Id / Object name bindings for accessions and dbGaP files
- */
-
-#define MAX_OBJID_SIZE 20
-#define MAX_NAME_SIZE 4096
-
-LIB_EXPORT void VFSManagerSetBindingsFile(struct VFSManager * self, const char* path)
-{
-    if (self != NULL)
-        KKeyStoreSetBindingsFile( self->keystore, path);
-}
-
-LIB_EXPORT const char* VFSManagerGetBindingsFile(struct VFSManager * self)
-{
-    if (self == NULL)
-        return NULL;
-    return KKeyStoreGetBindingsFile(self->keystore);
-}
-
-LIB_EXPORT rc_t CC VFSManagerRegisterObject(struct VFSManager* self, uint32_t oid, const struct VPath* obj)
-{
-    rc_t rc = 0;
-    if ( self == NULL )
-        rc = RC ( rcVFS, rcMgr, rcRegistering, rcSelf, rcNull );
-    else if ( obj == NULL )
-        rc = RC ( rcVFS, rcMgr, rcRegistering, rcParam, rcNull );
-    else
-    {
-        const String* newName;
-        rc = VPathMakeString (obj, &newName);
-        if (rc == 0)
-        {
-            rc = KKeyStoreRegisterObject(self->keystore, oid, newName);
-            StringWhack(newName);
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VFSManagerGetObject(const struct VFSManager* self, uint32_t oid, struct VPath** obj)
-{
-    rc_t rc = 0;
-    if ( self == NULL )
-        rc = RC ( rcVFS, rcMgr, rcRetrieving, rcSelf, rcNull );
-    else if ( obj == NULL )
-        rc = RC ( rcVFS, rcMgr, rcRetrieving, rcParam, rcNull );
-    else
-    {
-        const String* objName;
-        rc = KKeyStoreGetObjectName(self->keystore, oid, &objName);
-        if (rc == 0)
-        {
-            rc = VFSManagerMakePath (self, obj, "%S", objName);
-            StringWhack(objName);
-        }
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VFSManagerGetObjectId(const struct VFSManager* self, const struct VPath* obj, uint32_t* oid)
-{
-    rc_t rc = 0;
-    if ( self == NULL )
-        rc = RC ( rcVFS, rcMgr, rcRetrieving, rcSelf, rcNull );
-    else if ( obj == NULL || oid == NULL)
-        rc = RC ( rcVFS, rcMgr, rcRetrieving, rcParam, rcNull );
-    else
-    {
-        const String* pathString;
-        rc = VPathMakeString(obj, &pathString);
-        if (rc == 0)
-        {
-            rc = VKKeyStoreGetObjectId(self->keystore, pathString, oid);
-            StringWhack(pathString);
-        }
-    }
-    return rc;
-}
-
diff --git a/libs/vfs/path-priv.h b/libs/vfs/path-priv.h
deleted file mode 100644
index 7724632..0000000
--- a/libs/vfs/path-priv.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*===========================================================================
-*
-*                            Public Domain Notice
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_path_priv_
-#define _h_path_priv_
-
-#ifndef _h_vfs_extern_
-#include <vfs/extern.h>
-#endif
-
-#ifndef _h_klib_refcount_
-#include <klib/refcount.h>
-#endif
-
-#ifndef _h_klib_data_buffer_
-#include <klib/data-buffer.h>
-#endif
-
-#ifndef _h_klib_text_
-#include <klib/text.h>
-#endif
-
-#ifndef _h_vfs_path_
-#include <vfs/path.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*--------------------------------------------------------------------------
- * VPath
- */
-struct VPath
-{
-    KDataBuffer data;
-
-    String scheme;
-    String auth;
-    String host;
-    String portname;
-    String path;
-    String query;
-    String fragment;
-
-    KRefcount refcount;
-
-    uint32_t obj_id;
-    uint32_t acc_code;
-
-    uint32_t ipv4;
-    uint16_t ipv6 [ 8 ];
-    uint16_t portnum;
-
-    uint8_t scheme_type;
-    uint8_t host_type;
-    uint8_t path_type;
-
-    bool from_uri;
-    bool missing_port;
-};
-
-enum VPathVariant
-{
-    vpInvalid,
-    vpOID,
-    vpAccession,
-    vpNameOrOID,
-    vpNameOrAccession,
-    vpName,
-    vpRelPath,
-    vpUNCPath,
-    vpFullPath,
-    vpAuth,
-    vpHostName,
-    vpEndpoint
-};
-
-enum VHostVariant
-{
-    vhDNSName,
-    vhIPv4,
-    vhIPv6
-};
-
-/* legacy support */
-#define VPathMake LegacyVPathMake
-VFS_EXTERN rc_t VPathMake ( VPath ** new_path, const char * posix_path );
-#define VPathMakeFmt LegacyVPathMakeFmt
-rc_t VPathMakeFmt ( VPath ** new_path, const char * fmt, ... );
-#define VPathMakeVFmt LegacyVPathMakeVFmt
-rc_t VPathMakeVFmt ( VPath ** new_path, const char * fmt, va_list args );
-#define VPathMakeSysPath LegacyVPathMakeSysPath
-VFS_EXTERN rc_t VPathMakeSysPath ( VPath ** new_path, const char * sys_path );
-
-typedef enum eVPUri_t
-{
-    vpuri_invalid = -1,
-    vpuri_none, 
-    vpuri_not_supported,
-    vpuri_ncbi_file,
-    vpuri_ncbi_vfs = vpuri_ncbi_file,
-    vpuri_file,
-    vpuri_ncbi_acc,
-    vpuri_http,
-    vpuri_ftp,
-    vpuri_ncbi_legrefseq,
-    vpuri_ncbi_obj,     /* for dbGaP objects */
-    vpuri_fasp,         /* for Aspera downloads */
-    vpuri_count
-} VPUri_t;
-
-#define VPathGetScheme_t LegacyVPathGetScheme_t
-VFS_EXTERN rc_t CC VPathGetScheme_t ( const VPath * self, VPUri_t * uri_type );
-
-#define VPathGetUri_t LegacyVPathGetUri_t
-VPUri_t VPathGetUri_t (const VPath * self);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_path_priv_ */
diff --git a/libs/vfs/path.c b/libs/vfs/path.c
deleted file mode 100644
index 317af37..0000000
--- a/libs/vfs/path.c
+++ /dev/null
@@ -1,3374 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <vfs/extern.h>
-
-#include "path-priv.h"
-
-#include <vfs/manager.h>
-#include <vfs/resolver.h>
-#include <klib/printf.h>
-#include <klib/rc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-#include <sysalloc.h>
-
-#define MAX_ACCESSION_LEN 20
-#define TREAT_URI_RESERVED_AS_FILENAME 0
-
-
-/*--------------------------------------------------------------------------
- * VPath
- */
-
-
-/* Whack
- */
-static
-void VPathWhack ( VPath * self )
-{
-    KDataBufferWhack ( & self -> data );
-    KRefcountWhack ( & self -> refcount, "VPath" );
-    free ( self );
-}
-
-/* ParseURI
- *  parse a flexible URI
- *  allowed to be a formal URI with scheme,
- *  a simple POSIX path, or a simple accession
- *
- * NB - the purpose is to parse, not to enforce correctness
- *  emphasis is placed on speed and leniency
- *
- *  url
- *      = accession
- *      | posix-path
- *      | scheme-spec '//' host-spec full-name-spec opt-query opt-fragment
- *      ;
- *
- *  accession
- *      = alpha-part digits-part opt-extensions
- *      | prefix alpha-part digits-part opt-extensions
- *      | prefix digits-part extensions opt-suffix
- *      ;
- *
- *  prefix
- *      = [A-Za-z]+ '_'
- *
- *  alpha-part
- *      = [A-Za-z]+
- *      ;
- *
- *  digits-part
- *      = [0-9]+
- *      ;
- *
- *  opt-extensions
- *      =
- *      | extensions
- *      ;
- *
- *  extensions
- *      = extension
- *      | extensions extension
- *      ;
- *
- *  extension
- *      = '.' [0-9]+
- *      ;
- *
- *  opt-suffix
- *      =
- *      | '_' [A-Za-z]+
- *      ;
- *
- *  obj-id
- *      = [0-9]+
- *      ;
- *
- *  posix-path
- *      = full-path
- *      | rel-path
- *      ;
- *
- *  full-path
- *      = '/' rel-path
- *      ;
- *
- *  rel-path
- *      = name
- *      | rel-path '/' name
- *      ;
- *
- *  name
- *      = [^?#/]+
- *      ;
- *
- *  scheme-spec
- *      = scheme ':'
- *      ;
- *
- *  scheme
- *      = [A-Za-z][-+A-Za-z0-9.]*
- *      ;
- *
- *  host-spec
- *      = dns-name
- *      | ipv4-spec
- *      | '[' ipv6-spec ']'
- *      ;
- *
- *  full-name-spec
- *      = '/' accession
- *      | full-path
- *      | '/' obj-id
- *      ;
- *
- *  opt-query
- *      =
- *      | '?' [^#]+
- *      ;
- *
- *  opt-fragment
- *      =
- *      | '#' any
- *      ;
- */
-typedef enum VPathParseState
-{
-    vppStart,
-    vppAccPrefixAlphaNamePathOrScheme,
-    vppAccAlphaNamePath,
-    vppAccDigitNamePathOrScheme,
-    vppAccDigitNamePath,
-    vppAccExtNamePathOrScheme,
-    vppAccExtNamePath,
-    vppAccSuffixNamePath,
-    vppAccDotNamePathOrScheme,
-    vppAccDotNamePath,
-    vppAccUnderNamePath,
-    vppNamePathOrScheme,
-    vppAccOidRelOrSlash,
-    vppAccPrefixAlphaRel,
-    vppAccAlphaRel,
-    vppAccDigitRel,
-    vppAccExtRel,
-    vppAccSuffixRel,
-    vppOidRel,
-    vppAccDotRel,
-    vppAccUnderRel,
-    vppSlash,
-    vppAuthHostSpec,
-    vppAuthHostNamePort,
-    vppHostSpec,
-    vppHostNamePort,
-    vppIPv4Port,
-    vppIPv4Dot,
-    vppIPv6Port,
-    vppIPv6Colon,
-    vppPortSpecOrFullPath,
-    vppPortSpec,
-    vppPortName,
-    vppPortNum,
-    vppNamePath,
-    vppUNCOrMalformedPOSIXPath,
-    vppFullOrUNCPath,
-    vppRelPath,
-    vppFullPath,
-    vppUNCPath,
-    vppParamName,
-    vppParamValue,
-    vppFragment
-}
-VPathParseState;
-
-static
-void VPathCaptureScheme ( VPath * self, const char * uri, size_t start, size_t end )
-{
-    size_t size = end - start;
-    StringInit ( & self -> scheme, & uri [ start ], size, ( uint32_t ) ( size ) );
-    self -> from_uri = true;
-
-    if ( size != 0 )
-    {
-        const char * scheme = & uri [ start ];
-        self -> scheme_type = vpuri_not_supported;
-
-        /* use size as a quick hash */
-        switch ( size )
-        {
-        case 3:
-            /* ftp */
-            if ( strcase_cmp (  scheme, 3, "ftp", 3, 3 ) == 0 )
-                self -> scheme_type = vpuri_ftp;
-            break;
-        case 4:
-            /* 4 character schemes */
-            switch (  uri [ 0 ] )
-            {
-            case 'f':
-            case 'F':
-                /* file */
-                if ( strcase_cmp (  scheme + 1, 3, "file" + 1, 3, 3 ) == 0 )
-                    self -> scheme_type = vpuri_file;
-                /* fasp */
-                else if ( strcase_cmp (  scheme + 1, 3, "fasp" + 1, 3, 3 ) == 0 )
-                    self -> scheme_type = vpuri_fasp;
-                break;
-            case 'h':
-            case 'H':
-                /* http */
-                if ( strcase_cmp (  scheme + 1, 3, "http" + 1, 3, 3 ) == 0 )
-                    self -> scheme_type = vpuri_http;
-                break;
-            }
-            break;
-            
-        case 8:
-            /* 8 character schemes starting with "ncbi-" */
-            if ( strcase_cmp (  scheme, 5, "ncbi-", 5, 5 ) != 0 )
-                break;
-            switch (  uri [ 5 ] )
-            {
-            case 'a':
-            case 'A':
-                /* ncbi-acc */
-                if ( strcase_cmp (  scheme + 5 + 1, 2, "acc" + 1, 2, 2 ) == 0 )
-                    self -> scheme_type = vpuri_ncbi_acc;
-                break;
-            case 'o':
-            case 'O':
-                /* ncbi-obj */
-                if ( strcase_cmp (  scheme + 5 + 1, 2, "obj" + 1, 2, 2 ) == 0 )
-                    self -> scheme_type = vpuri_ncbi_obj;
-                break;
-            }
-            break;
-            
-        case 9:
-            /* 9 character schemes starting with "ncbi-" */
-            if ( strcase_cmp (  scheme, 5, "ncbi-", 5, 5 ) != 0 )
-                break;
-            switch (  uri [ 5 ] )
-            {
-            case 'f':
-            case 'F':
-                /* ncbi-file */
-                if ( strcase_cmp (  scheme + 5 + 1, 3, "file" + 1, 3, 3 ) == 0 )
-                    self -> scheme_type = vpuri_ncbi_file;
-                break;
-            }
-            break;
-            
-        case 16:
-            /* 16 character schemes starting with "x-ncbi-" */
-            if ( strcase_cmp (  scheme, 7, "x-ncbi-", 7, 7 ) != 0 )
-                break;
-            switch (  uri [ 7 ] )
-            {
-            case 'l':
-            case 'L':
-                /* x-ncbi-legrefseq */
-                if ( strcase_cmp (  scheme + 7 + 1, 8, "legrefseq" + 1, 8, 8 ) == 0 )
-                    self -> scheme_type = vpuri_ncbi_legrefseq;
-                break;
-            }
-            break;
-        }
-    }
-}
-
-static
-void VPathCaptureAccession ( VPath * self, const char * uri, size_t start, size_t end )
-{
-    size_t size = end - start;
-    StringInit ( & self -> path, & uri [ start ], size, ( uint32_t ) size );
-
-    switch ( self -> scheme_type )
-    {
-    case vpuri_none:
-         self -> path_type = vpNameOrAccession;
-         break;
-    case vpuri_ncbi_acc:
-        if ( size < MAX_ACCESSION_LEN )
-        {
-            self -> path_type = vpAccession;
-            break;
-        }
-        /* no break */
-    default:
-         self -> path_type = vpName;
-    }
-}
-
-static
-void VPathCaptureAccCode ( VPath * self, uint32_t acc_prefix,
-    uint32_t acc_alpha, uint32_t acc_digit, uint32_t acc_ext, uint32_t acc_suffix )
-{
-    self -> acc_code
-        = ( acc_prefix << 16 )
-        | ( acc_alpha << 12 )
-        | ( acc_digit << 8 )
-        | ( acc_ext << 4 )
-        | ( acc_suffix << 0 )
-        ;
-
-    if ( self -> path_type == vpNameOrAccession )
-    {
-        switch ( self -> acc_code >> 8 )
-        {
-        case 0x015:
-        case 0x026:
-        case 0x106:
-        case 0x126:
-            /* refseq */
-            self -> path_type = vpAccession;
-            break;
-
-        case 0x109:
-            /* refseq or named annotation */
-            self -> path_type = vpAccession;
-            break;
-
-        case 0x036:
-        case 0x037:
-        case 0x038:
-        case 0x039:
-            /* sra */
-            break;
-
-        case 0x042:
-        case 0x048:
-        case 0x049:
-        case 0x142:
-        case 0x148:
-        case 0x149:
-            /* wgs */
-            self -> path_type = vpAccession;
-            break;
-
-        case 0x029:
-            if ( self -> acc_code == 0x02910 )
-            {
-                if ( self -> path . addr [ 0 ] == 'N' &&
-                     self -> path . addr [ 1 ] == 'A' )
-                {
-                    /* na */
-                    self -> path_type = vpAccession;
-                }
-            }
-            break;
-        }
-    }
-}
-
-static
-void VPathCaptureOid ( VPath * self, uint64_t oid, const char * uri, size_t start, size_t oid_start, size_t end )
-{
-    size_t oid_size = end - oid_start;
-
-    if ( oid == 0 || oid_size > 10 || oid > 0xFFFFFFFF )
-        self -> path_type = vpName;
-    else
-    {
-        self -> obj_id = ( uint32_t ) oid;
-
-        if ( self -> scheme_type == vpuri_ncbi_obj )
-        {
-            StringInit ( & self -> path, & uri [ oid_start ], oid_size, ( uint32_t ) oid_size );
-            self -> path_type = vpOID;
-            return;
-        }
-
-        self -> path_type = vpNameOrOID;
-    }
-
-    StringInit ( & self -> path, & uri [ start ], ( end - start ), ( uint32_t ) ( end - start ) );
-}
-
-static
-void VPathCaptureAuth ( VPath * self, const char * uri, size_t start, size_t end )
-{
-    StringInit ( & self -> auth, & uri [ start ], end - start, ( uint32_t ) ( end - start ) );
-    self -> path_type = vpAuth;
-}
-
-static
-void VPathCaptureHostName ( VPath * self, const char * uri, size_t start, size_t end )
-{
-    StringInit ( & self -> host, & uri [ start ], end - start, ( uint32_t ) ( end - start ) );
-    self -> path_type = vpHostName;
-}
-
-static
-rc_t VPathCaptureIPv4 ( VPath * self, const uint32_t ipv4 [ 4 ] )
-{
-    uint32_t i;
-
-    for ( i = 0; i < 4; ++ i )
-    {
-        if ( ipv4 [ i ] >= 256 )
-            return RC ( rcVFS, rcPath, rcParsing, rcData, rcExcessive );
-    }
-
-    self -> ipv4
-        = ( ipv4 [ 0 ] << 24 )
-        | ( ipv4 [ 1 ] << 16 )
-        | ( ipv4 [ 2 ] << 8 )
-        | ( ipv4 [ 3 ] << 0 )
-        ;
-
-    self -> path_type = vpEndpoint;
-    self -> host_type = vhIPv4;
-
-    return 0;
-}
-
-static
-rc_t VPathCaptureIPv6 ( VPath * self, const uint32_t ipv6 [ 8 ] )
-{
-    uint32_t i;
-
-    for ( i = 0; i < 8; ++ i )
-    {
-        if ( ipv6 [ i ] >= 0x10000 )
-            return RC ( rcVFS, rcPath, rcParsing, rcData, rcExcessive );
-
-        self -> ipv6 [ i ] = ( uint16_t ) ipv6 [ i ];
-    }
-
-    self -> path_type = vpEndpoint;
-    self -> host_type = vhIPv6;
-
-    return 0;
-}
-
-static
-void VPathCapturePortName ( VPath * self, const char * uri, size_t start, size_t end )
-{
-    StringInit ( & self -> portname, & uri [ start ], end - start, ( uint32_t ) ( end - start ) );
-    self -> path_type = vpEndpoint;
-}
-
-static
-rc_t VPathCapturePortNum ( VPath * self, uint32_t port )
-{
-    if ( port >= 0x10000 )
-        return RC ( rcVFS, rcPath, rcParsing, rcData, rcExcessive );
-
-    self -> portnum = ( uint16_t ) port;
-    self -> path_type = vpEndpoint;
-
-    return 0;
-}
-
-static
-void VPathCapturePath ( VPath * self, const char * uri, size_t start, size_t end, uint32_t count, uint32_t var )
-{
-    StringInit ( & self -> path, & uri [ start ], end - start, count );
-    self -> path_type = ( uint8_t ) var;
-}
-
-static
-void VPathCaptureQuery ( VPath * self, const char * uri, size_t start, size_t end, uint32_t count )
-{
-    StringInit ( & self -> query, & uri [ start ], end - start, count );
-}
-
-static
-void VPathCaptureFragment ( VPath * self, const char * uri, size_t start, size_t end, uint32_t count )
-{
-    StringInit ( & self -> fragment, & uri [ start ], end - start, count );
-}
-
-#define VPathParseResetAnchor( i ) \
-    do { anchor = ( i ); count = 0; } while ( 0 )
-
-static
-rc_t VPathParse ( VPath * self, const char * uri, size_t uri_size )
-{
-    rc_t rc;
-    int bytes;
-    uint32_t port;
-    size_t i, anchor;
-    uint32_t count, total;
-    VPathParseState state = vppStart;
-
-    /* for handling current accession schemes */
-    uint32_t acc_prefix = 0;
-    uint32_t acc_alpha = 0;
-    uint32_t acc_digit = 0;
-    uint32_t acc_ext = 0;
-    uint32_t acc_suffix = 0;
-
-    /* for accummulating ip addresses */
-    uint32_t ip;
-    uint32_t ipv4 [ 4 ];
-    uint32_t ipv6 [ 8 ];
-
-    /* for accumulating oid */
-    uint64_t oid;
-    uint32_t oid_anchor;
-
-    for ( i = anchor = 0, total = count = 0; i < uri_size; ++ total, ++ count, i += bytes )
-    {
-        /* read character */
-        uint32_t ch = uri [ i ];
-
-        /* assume ascii */
-        bytes = 1;
-        if ( ( char ) ch  < 0 )
-        {
-            uint32_t utf32;
-
-            /* read into UTF-32 */
-            bytes = utf8_utf32 ( & utf32, & uri [ i ], & uri [ uri_size ] );
-            if ( bytes <= 0 )
-            {
-                if ( bytes < 0 )
-                    return RC ( rcVFS, rcPath, rcParsing, rcChar, rcInvalid );
-                return RC ( rcVFS, rcPath, rcParsing, rcData, rcInsufficient );
-            }
-
-            ch = utf32;
-        }
-
-        /* enter state */
-        switch ( state )
-        {
-        case vppStart:
-
-            if ( ch >= 128 )
-                state = vppNamePath;
-            else if ( isalpha ( ch ) )
-            {
-                acc_alpha = 1;
-                state = vppAccPrefixAlphaNamePathOrScheme;
-            }
-            else if ( isdigit ( ch ) )
-                state = vppNamePath;
-            else switch ( ch )
-            {
-            case '/':
-                state = vppFullOrUNCPath;
-                break;
-
-#if ! TREAT_URI_RESERVED_AS_FILENAME
-            case ':':
-            case '?':
-            case '#':
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-#endif
-
-            default:
-                state = vppNamePath;
-            }
-            break;
-
-        case vppAccPrefixAlphaNamePathOrScheme:
-
-            if ( ch >= 128 )
-            {
-                acc_alpha = 0;
-                state = vppNamePath;
-            }
-            else if ( isalpha ( ch ) )
-                ++ acc_alpha;
-            else if ( isdigit ( ch ) )
-            {
-                ++ acc_digit;
-                state = vppAccDigitNamePathOrScheme;
-            }
-            else switch ( ch )
-            {
-            case '/':
-                acc_alpha = 0;
-                state = vppRelPath;
-                break;
-
-            case '_':
-                acc_prefix = 1;
-                state = vppAccAlphaNamePath;
-                acc_alpha = 0;
-                break;
-
-            case '.':
-            case '+':
-            case '-':
-                acc_alpha = 0;
-                state = vppNamePathOrScheme;
-                break;
-
-            case ':':
-                acc_alpha = 0;
-                VPathCaptureScheme ( self, uri, anchor, i );
-                state = vppAccOidRelOrSlash;
-                break;
-
-#if ! TREAT_URI_RESERVED_AS_FILENAME
-            case '?':
-            case '#':
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-#endif
-
-            default:
-                acc_alpha = 0;
-                state = vppNamePath;
-            }
-            break;
-
-        case vppAccAlphaNamePath:
-
-            if ( ch >= 128 )
-            {
-                acc_prefix = acc_alpha = 0;
-                state = vppNamePath;
-            }
-            else if ( isalpha ( ch ) )
-                ++ acc_alpha;
-            else if ( isdigit ( ch ) )
-            {
-                ++ acc_digit;
-                state = vppAccDigitNamePath;
-            }
-            else switch ( ch )
-            {
-            case '/':
-                acc_prefix = acc_alpha = 0;
-                state = vppRelPath;
-                break;
-
-#if ! TREAT_URI_RESERVED_AS_FILENAME
-            case ':':
-            case '?':
-            case '#':
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-#endif
-
-            default:
-                acc_prefix = acc_alpha = 0;
-                state = vppNamePath;
-            }
-            break;
-
-        case vppAccDigitNamePathOrScheme:
-
-            if ( ch >= 128 )
-            {
-                acc_prefix = acc_alpha = acc_digit = 0;
-                state = vppNamePath;
-            }
-            else if ( isalpha ( ch ) )
-            {
-                acc_prefix = acc_alpha = acc_digit = 0;
-                state = vppNamePathOrScheme;
-            }
-            else if ( isdigit ( ch ) )
-                ++ acc_digit;
-            else switch ( ch )
-            {
-            case '/':
-                acc_prefix = acc_alpha = acc_digit = 0;
-                state = vppRelPath;
-                break;
-
-            case '.':
-                state = vppAccDotNamePathOrScheme;
-                break;
-
-            case '+':
-            case '-':
-                acc_prefix = acc_alpha = acc_digit = 0;
-                state = vppNamePathOrScheme;
-                break;
-
-            case ':':
-                acc_prefix = acc_alpha = acc_digit = 0;
-                VPathCaptureScheme ( self, uri, anchor, i );
-                state = vppAccOidRelOrSlash;
-                break;
-
-#if ! TREAT_URI_RESERVED_AS_FILENAME
-            case '?':
-            case '#':
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-#endif
-
-            default:
-                acc_prefix = acc_alpha = acc_digit = 0;
-                state = vppNamePath;
-            }
-            break;
-
-        case vppAccDigitNamePath:
-
-            if ( ch >= 128 || isalpha ( ch ) )
-            {
-                acc_prefix = acc_alpha = acc_digit = 0;
-                state = vppNamePath;
-            }
-            else if ( isdigit ( ch ) )
-                ++ acc_digit;
-            else switch ( ch )
-            {
-            case '/':
-                acc_prefix = acc_alpha = acc_digit = 0;
-                state = vppRelPath;
-                break;
-
-            case '.':
-                state = vppAccDotNamePath;
-                break;
-
-#if ! TREAT_URI_RESERVED_AS_FILENAME
-            case ':':
-            case '?':
-            case '#':
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-#endif
-
-            default:
-                acc_prefix = acc_alpha = acc_digit = 0;
-                state = vppNamePath;
-            }
-            break;
-
-        case vppAccExtNamePathOrScheme:
-
-            if ( ch >= 128 )
-            {
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                state = vppNamePath;
-            }
-            else if ( isalpha ( ch ) )
-            {
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                state = vppNamePathOrScheme;
-            }
-            else if ( isdigit ( ch ) )
-                break;
-            else switch ( ch )
-            {
-            case '/':
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                state = vppRelPath;
-                break;
-
-            case '.':
-                state = vppAccDotNamePathOrScheme;
-                break;
-
-            case '+':
-            case '-':
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                state = vppNamePathOrScheme;
-                break;
-
-            case ':':
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                VPathCaptureScheme ( self, uri, anchor, i );
-                state = vppAccOidRelOrSlash;
-                break;
-
-#if ! TREAT_URI_RESERVED_AS_FILENAME
-            case '?':
-            case '#':
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-#endif
-
-            case '_':
-                if ( acc_prefix != 0 && acc_alpha == 0 && acc_digit == 9 )
-                {
-                    state = vppAccUnderNamePath;
-                    break;
-                }
-
-                /* no break */
-
-            default:
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                state = vppNamePath;
-            }
-            break;
-
-        case vppAccExtNamePath:
-
-            if ( ch >= 128 || isalpha ( ch ) )
-            {
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                state = vppNamePath;
-            }
-            else if ( isdigit ( ch ) )
-                break;
-            else switch ( ch )
-            {
-            case '/':
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                state = vppRelPath;
-                break;
-
-            case '.':
-                state = vppAccDotNamePath;
-                break;
-
-#if ! TREAT_URI_RESERVED_AS_FILENAME
-            case ':':
-            case '?':
-            case '#':
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-#endif
-
-            case '_':
-                if ( acc_prefix != 0 && acc_alpha == 0 && acc_digit == 9 && acc_ext == 1 )
-                {
-                    state = vppAccUnderNamePath;
-                    break;
-                }
-
-                /* no break */
-
-            default:
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                state = vppNamePath;
-            }
-            break;
-
-        case vppAccSuffixNamePath:
-
-            if ( ch >= 128 || isdigit ( ch ) )
-            {
-                acc_prefix = acc_alpha = acc_digit = acc_ext = acc_suffix = 0;
-                state = vppNamePath;
-            }
-            else if ( isalpha ( ch ) )
-                break;
-            else switch ( ch )
-            {
-            case '/':
-                acc_prefix = acc_alpha = acc_digit = acc_ext = acc_suffix = 0;
-                state = vppRelPath;
-                break;
-
-#if ! TREAT_URI_RESERVED_AS_FILENAME
-            case ':':
-            case '?':
-            case '#':
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-#endif
-
-            default:
-                acc_prefix = acc_alpha = acc_digit = acc_ext = acc_suffix = 0;
-                state = vppNamePath;
-            }
-            break;
-
-        case vppAccDotNamePathOrScheme:
-
-            if ( ch >= 128 )
-            {
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                state = vppNamePath;
-            }
-            else if ( isalpha ( ch ) )
-            {
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                state = vppNamePathOrScheme;
-            }
-            else if ( isdigit ( ch ) )
-            {
-                ++ acc_ext;
-                state = vppAccExtNamePathOrScheme;
-            }
-            else switch ( ch )
-            {
-            case '/':
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                state = vppRelPath;
-                break;
-
-            case '.':
-            case '+':
-            case '-':
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                state = vppNamePathOrScheme;
-                break;
-
-            case ':':
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                VPathCaptureScheme ( self, uri, anchor, i );
-                state = vppAccOidRelOrSlash;
-                break;
-
-#if ! TREAT_URI_RESERVED_AS_FILENAME
-            case '?':
-            case '#':
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-#endif
-
-            default:
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                state = vppNamePath;
-            }
-            break;
-
-        case vppAccDotNamePath:
-
-            if ( ch >= 128 || isalpha ( ch ) )
-            {
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                state = vppNamePath;
-            }
-            else if ( isdigit ( ch ) )
-            {
-                ++ acc_ext;
-                state = vppAccExtNamePath;
-            }
-            else switch ( ch )
-            {
-            case '/':
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                state = vppRelPath;
-                break;
-
-#if ! TREAT_URI_RESERVED_AS_FILENAME
-            case ':':
-            case '?':
-            case '#':
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-#endif
-
-            default:
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                state = vppNamePath;
-            }
-            break;
-
-        case vppAccUnderNamePath:
-
-            if ( ch >= 128 || isdigit ( ch ) )
-            {
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                state = vppNamePath;
-            }
-            else if ( isalpha ( ch ) )
-            {
-                ++ acc_suffix;
-                state = vppAccSuffixNamePath;
-            }
-            else switch ( ch )
-            {
-            case '/':
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                state = vppRelPath;
-                break;
-
-#if ! TREAT_URI_RESERVED_AS_FILENAME
-            case ':':
-            case '?':
-            case '#':
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-#endif
-
-            default:
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                state = vppNamePath;
-            }
-            break;
-
-        case vppNamePathOrScheme:
-
-            if ( ch >= 128 )
-                state = vppNamePath;
-            else if ( isalnum ( ch ) )
-                break;
-            else switch ( ch )
-            {
-            case '/':
-                state = vppRelPath;
-                break;
-
-            case '.':
-            case '+':
-            case '-':
-                break;
-
-            case ':':
-                VPathCaptureScheme ( self, uri, anchor, i );
-                state = vppAccOidRelOrSlash;
-                break;
-
-#if ! TREAT_URI_RESERVED_AS_FILENAME
-            case '?':
-            case '#':
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-#endif
-
-            default:
-                state = vppNamePath;
-            }
-            break;
-
-        case vppAccOidRelOrSlash:
-
-            VPathParseResetAnchor ( i );
-            acc_prefix = acc_digit = acc_ext = 0;
-
-            if ( ch >= 128 )
-                state = vppNamePath;
-
-            else if ( isalpha ( ch ) )
-            {
-                acc_alpha = 1;
-                state = vppAccPrefixAlphaRel;
-            }
-
-            else if ( isdigit ( ch ) )
-            {
-                state = vppOidRel;
-                oid = ch - '0';
-                oid_anchor = (uint32_t)i;
-            }
-
-            else if ( ch != '/' )
-                state = vppNamePath;
-
-            else
-                state = vppSlash;
-
-            break;
-
-        case vppAccPrefixAlphaRel:
-
-            if ( ch >= 128 )
-            {
-                acc_alpha = 0;
-                state = vppNamePath;
-            }
-            else if ( isalpha ( ch ) )
-                ++ acc_alpha;
-            else if ( isdigit ( ch ) )
-            {
-                ++ acc_digit;
-                state = vppAccDigitRel;
-            }
-            else switch ( ch )
-            {
-            case '_':
-                acc_prefix = 1;
-                acc_alpha = 0;
-                state = vppAccAlphaRel;
-                break;
-
-            case '/':
-                acc_alpha = 0;
-                state = vppRelPath;
-                break;
-
-            case '?':
-                VPathCaptureAccession ( self, uri, anchor, i );
-                VPathCaptureAccCode ( self, acc_prefix, acc_alpha, acc_digit, acc_ext, acc_suffix );
-                state = vppParamName;
-                VPathParseResetAnchor ( i );
-                break;
-
-            case '#':
-                VPathCaptureAccession ( self, uri, anchor, i );
-                VPathCaptureAccCode ( self, acc_prefix, acc_alpha, acc_digit, acc_ext, acc_suffix );
-                state = vppFragment;
-                VPathParseResetAnchor ( i );
-                break;
-
-            case ':':
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-
-            default:
-                acc_alpha = 0;
-                state = vppNamePath;
-            }
-            break;
-
-        case vppAccAlphaRel:
-
-            if ( ch >= 128 )
-            {
-                acc_prefix = acc_alpha = 0;
-                state = vppNamePath;
-            }
-            else if ( isalpha ( ch ) )
-                ++ acc_alpha;
-            else if ( isdigit ( ch ) )
-            {
-                ++ acc_digit;
-                state = vppAccDigitRel;
-            }
-            else switch ( ch )
-            {
-            case '/':
-                acc_prefix = acc_alpha = 0;
-                state = vppRelPath;
-                break;
-
-            case '?':
-                VPathCaptureAccession ( self, uri, anchor, i );
-                VPathCaptureAccCode ( self, acc_prefix, acc_alpha, acc_digit, acc_ext, acc_suffix );
-                state = vppParamName;
-                VPathParseResetAnchor ( i );
-                break;
-
-            case '#':
-                VPathCaptureAccession ( self, uri, anchor, i );
-                VPathCaptureAccCode ( self, acc_prefix, acc_alpha, acc_digit, acc_ext, acc_suffix );
-                state = vppFragment;
-                VPathParseResetAnchor ( i );
-                break;
-
-            case ':':
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-
-            default:
-                acc_prefix = acc_alpha = 0;
-                state = vppNamePath;
-            }
-            break;
-
-        case vppAccDigitRel:
-
-            if ( ch >= 128 || isalpha ( ch ) )
-            {
-                acc_prefix = acc_alpha = acc_digit = 0;
-                state = vppNamePath;
-            }
-            else if ( isdigit ( ch ) )
-                ++ acc_digit;
-            else switch ( ch )
-            {
-            case '.':
-                state = vppAccDotRel;
-                break;
-
-            case '/':
-                acc_prefix = acc_alpha = acc_digit = 0;
-                state = vppRelPath;
-                break;
-
-            case '?':
-                VPathCaptureAccession ( self, uri, anchor, i );
-                VPathCaptureAccCode ( self, acc_prefix, acc_alpha, acc_digit, acc_ext, acc_suffix );
-                state = vppParamName;
-                VPathParseResetAnchor ( i );
-                break;
-
-            case '#':
-                VPathCaptureAccession ( self, uri, anchor, i );
-                VPathCaptureAccCode ( self, acc_prefix, acc_alpha, acc_digit, acc_ext, acc_suffix );
-                state = vppFragment;
-                VPathParseResetAnchor ( i );
-                break;
-
-            case ':':
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-
-            default:
-                acc_prefix = acc_alpha = acc_digit = 0;
-                state = vppNamePath;
-            }
-            break;
-
-        case vppAccExtRel:
-
-            if ( ch >= 128 || isalpha ( ch ) )
-            {
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                state = vppNamePath;
-            }
-            else if ( isdigit ( ch ) )
-                break;
-            else switch ( ch )
-            {
-            case '.':
-                state = vppAccDotRel;
-                break;
-
-            case '/':
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                state = vppRelPath;
-                break;
-
-            case '?':
-                VPathCaptureAccession ( self, uri, anchor, i );
-                VPathCaptureAccCode ( self, acc_prefix, acc_alpha, acc_digit, acc_ext, acc_suffix );
-                state = vppParamName;
-                VPathParseResetAnchor ( i );
-                break;
-
-            case '#':
-                VPathCaptureAccession ( self, uri, anchor, i );
-                VPathCaptureAccCode ( self, acc_prefix, acc_alpha, acc_digit, acc_ext, acc_suffix );
-                state = vppFragment;
-                VPathParseResetAnchor ( i );
-                break;
-
-            case ':':
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-
-            case '_':
-                if ( acc_prefix != 0 && acc_alpha == 0 && acc_digit == 9 && acc_ext == 1 )
-                {
-                    state = vppAccUnderRel;
-                    break;
-                }
-
-            default:
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                state = vppNamePath;
-            }
-            break;
-
-        case vppAccSuffixRel:
-
-            if ( ch >= 128 || isdigit ( ch ) )
-            {
-                acc_prefix = acc_alpha = acc_digit = acc_ext = acc_suffix = 0;
-                state = vppNamePath;
-            }
-            else if ( isalpha ( ch ) )
-                break;
-            else switch ( ch )
-            {
-            case '.':
-                state = vppAccDotRel;
-                break;
-
-            case '/':
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                state = vppRelPath;
-                break;
-
-            case '?':
-                VPathCaptureAccession ( self, uri, anchor, i );
-                VPathCaptureAccCode ( self, acc_prefix, acc_alpha, acc_digit, acc_ext, acc_suffix );
-                state = vppParamName;
-                VPathParseResetAnchor ( i );
-                break;
-
-            case '#':
-                VPathCaptureAccession ( self, uri, anchor, i );
-                VPathCaptureAccCode ( self, acc_prefix, acc_alpha, acc_digit, acc_ext, acc_suffix );
-                state = vppFragment;
-                VPathParseResetAnchor ( i );
-                break;
-
-            case ':':
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-
-            default:
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                state = vppNamePath;
-            }
-            break;
-
-        case vppOidRel:
-
-            if ( ch >= 128 )
-            {
-                oid = 0;
-                state = vppNamePath;
-            }
-            else if ( isdigit ( ch ) )
-            {
-                if ( oid == 0 )
-                    oid_anchor = (uint32_t)i;
-
-                oid *= 10;
-                oid += ch - '0';
-            }
-            else switch ( ch )
-            {
-            case '/':
-                oid = 0;
-                state = vppRelPath;
-                break;
-
-            case '?':
-                VPathCaptureOid ( self, oid, uri, anchor, oid_anchor, i );
-                state = vppParamName;
-                VPathParseResetAnchor ( i );
-                break;
-
-            case '#':
-                VPathCaptureOid ( self, oid, uri, anchor, oid_anchor, i );
-                state = vppFragment;
-                VPathParseResetAnchor ( i );
-                break;
-
-            case ':':
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-
-            default:
-                oid = 0;
-                state = vppNamePath;
-            }
-            break;
-
-        case vppAccDotRel:
-
-            if ( ch >= 128 || isalpha ( ch ) )
-            {
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                state = vppNamePath;
-            }
-            else if ( isdigit ( ch ) )
-            {
-                ++ acc_ext;
-                state = vppAccExtRel;
-            }
-            else switch ( ch )
-            {
-            case '/':
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                state = vppRelPath;
-                break;
-
-            case ':':
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-
-            default:
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                state = vppNamePath;
-            }
-            break;
-
-        case vppAccUnderRel:
-
-            if ( ch >= 128 || isdigit ( ch ) )
-            {
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                state = vppNamePath;
-            }
-            else if ( isalpha ( ch ) )
-            {
-                ++ acc_suffix;
-                state = vppAccSuffixRel;
-            }
-            else switch ( ch )
-            {
-            case '/':
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                state = vppRelPath;
-                break;
-
-            case ':':
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-
-            default:
-                acc_prefix = acc_alpha = acc_digit = acc_ext = 0;
-                state = vppNamePath;
-            }
-            break;
-
-        case vppSlash:
-
-            switch ( ch )
-            {
-            case '/':
-                if ( self -> scheme_type == vpuri_ncbi_file )
-                    state = vppUNCOrMalformedPOSIXPath;
-                else
-                    state = vppAuthHostSpec;
-                break;
-
-            case ':':
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-
-            case '?':
-                VPathCapturePath ( self, uri, anchor, i, count, vpFullPath );
-                state = vppParamName;
-                VPathParseResetAnchor ( i );
-                break;
-
-            case '#':
-                VPathCapturePath ( self, uri, anchor, i, count, vpFullPath );
-                state = vppFragment;
-                VPathParseResetAnchor ( i );
-                break;
-
-            default:
-                state = vppFullPath;
-            }
-            break;
-
-        case vppAuthHostSpec:
-
-            if ( ch >= 128 )
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-
-            VPathParseResetAnchor ( i );
-
-            if ( isalpha ( ch ) )
-                state = vppAuthHostNamePort;
-            else if ( isdigit ( ch ) )
-            {
-                ipv4 [ ip = 0 ] = ch - '0';
-                state = vppIPv4Port;
-            }
-            else switch ( ch )
-            {
-            case '/':
-                state = vppFullPath;
-                break;
-            case '[':
-                ip = 0;
-                memset ( ipv6, 0, sizeof ipv6 );
-                state = vppIPv6Colon;
-                break;
-            default:
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-            }
-
-            break;
-
-        case vppHostSpec:
-
-            if ( ch >= 128 )
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-
-            VPathParseResetAnchor ( i );
-
-            if ( isalpha ( ch ) )
-                state = vppHostNamePort;
-            else if ( isdigit ( ch ) )
-            {
-                ipv4 [ ip = 0 ] = ch - '0';
-                state = vppIPv4Port;
-            }
-            else switch ( ch )
-            {
-            case '/':
-                state = vppFullPath;
-                break;
-            case '[':
-                ip = 0;
-                memset ( ipv6, 0, sizeof ipv6 );
-                state = vppIPv6Colon;
-                break;
-            default:
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-            }
-
-            break;
-
-        case vppAuthHostNamePort:
-
-            if ( ch >= 128 )
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-
-            if ( isalnum ( ch ) )
-                break;
-            else switch ( ch )
-            {
-            case '@':
-                VPathCaptureAuth ( self, uri, anchor, i );
-                state = vppHostSpec;
-                break;
-
-            case '.':
-            case '+':
-            case '-':
-            case '_':
-                break;
-
-            case ':':
-                VPathCaptureHostName ( self, uri, anchor, i );
-                state = vppPortSpec;
-                break;
-
-            case '/':
-                VPathCaptureHostName ( self, uri, anchor, i );
-                state = vppFullPath;
-                VPathParseResetAnchor ( i );
-                break;
-
-            default:
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-            }
-            break;
-
-        case vppHostNamePort:
-
-            if ( ch >= 128 )
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-
-            if ( isalnum ( ch ) )
-                break;
-            else switch ( ch )
-            {
-            case '.':
-            case '+':
-            case '-':
-            case '_':
-                break;
-
-            case ':':
-                VPathCaptureHostName ( self, uri, anchor, i );
-                state = vppPortSpec;
-                break;
-
-            case '/':
-                VPathCaptureHostName ( self, uri, anchor, i );
-                state = vppFullPath;
-                VPathParseResetAnchor ( i );
-                break;
-
-            default:
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-            }
-            break;
-
-        case vppIPv4Port:
-
-            if ( ch >= 128 )
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-            if ( ipv4 [ ip ] >= 256 )
-                return RC ( rcVFS, rcPath, rcParsing, rcData, rcExcessive );
-            if ( isdigit ( ch ) )
-                ipv4 [ ip ] = ipv4 [ ip ] * 10 + ch - '0';
-            else if ( ++ ip == 4 )
-            {
-                switch ( ch )
-                {
-                case ':':
-                    rc = VPathCaptureIPv4 ( self, ipv4 );
-                    state = vppPortSpec;
-                    break;
-
-                case '/':
-                    rc = VPathCaptureIPv4 ( self, ipv4 );
-                    state = vppFullPath;
-                    VPathParseResetAnchor ( i );
-                    break;
-
-                default:
-                    return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-                }
-
-                if ( rc != 0 )
-                    return rc;
-            }
-            else if ( ch == '.' )
-                state = vppIPv4Dot;
-            else
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-            break;
-
-        case vppIPv4Dot:
-
-            if ( ch >= 128 || ! isdigit ( ch ) )
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-
-            ipv4 [ ip ] = ch - '0';
-            state = vppIPv4Port;
-
-            break;
-
-        case vppIPv6Port:
-
-            if ( ch >= 128 )
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-            if ( ipv6 [ ip ] >= 0x10000 )
-                return RC ( rcVFS, rcPath, rcParsing, rcData, rcExcessive );
-            if ( isdigit ( ch ) )
-                ipv6 [ ip ] = ( ipv6 [ ip ] << 4 ) + ch - '0';
-            else if ( isxdigit ( ch ) )
-                ipv6 [ ip ] = ( ipv6 [ ip ] << 4 ) + toupper ( ch ) - 'A' + 10;
-            else
-            {
-                switch ( ch )
-                {
-                case ']':
-                    rc = VPathCaptureIPv6 ( self, ipv6 );
-                    state = vppPortSpecOrFullPath;
-                    break;
-
-                case ':':
-                    if ( ++ ip != 8 )
-                    {
-                        state = vppIPv6Colon;
-                        break;
-                    }
-
-                    /* no break */
-                default:
-                    return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-                }
-
-                if ( rc != 0 )
-                    return rc;
-            }
-            break;
-
-        case vppIPv6Colon:
-
-            if ( ch != ':' )
-            {
-                if ( ch >= 128 || ! isxdigit ( ch ) )
-                    return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-
-                if ( isdigit ( ch ) )
-                    ipv6 [ ip ] = ch - '0';
-                else
-                    ipv6 [ ip ] = toupper ( ch ) - 'A' + 10;
-            }
-
-            state = vppIPv6Port;
-
-            break;
-
-        case vppPortSpecOrFullPath:
-
-            switch ( ch )
-            {
-            case ':':
-                state = vppPortSpec;
-                break;
-
-            case '/':
-                state = vppFullPath;
-                VPathParseResetAnchor ( i );
-                break;
-
-            default:
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-            }
-
-            break;
-
-        case vppPortSpec:
-
-            if ( ch >= 128 )
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-
-            VPathParseResetAnchor ( i );
-
-            if ( isalpha ( ch ) )
-                state = vppPortName;
-            else if ( isdigit ( ch ) )
-            {
-                port = ch - '0';
-                state = vppPortNum;
-            }
-            else switch ( ch )
-            {
-            case '/':
-                self -> missing_port = true;
-                state = vppFullPath;
-                break;
-
-            default:
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-            }
-
-            break;
-
-        case vppPortName:
-
-            if ( ch >= 128 )
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-
-            if ( isalnum ( ch ) )
-                break;
-            else switch ( ch )
-            {
-            case '/':
-                VPathCapturePortName ( self, uri, anchor, i );
-                state = vppFullPath;
-                VPathParseResetAnchor ( i );
-                break;
-
-            default:
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-            }
-            break;
-
-        case vppPortNum:
-
-            if ( ch >= 128 )
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-            if ( port >= 0x10000 )
-                return RC ( rcVFS, rcPath, rcParsing, rcData, rcExcessive );
-
-            if ( isdigit ( ch ) )
-                port = port * 10 + ch - '0';
-            else switch ( ch )
-            {
-            case '/':
-                rc = VPathCapturePortNum ( self, port );
-                if ( rc != 0 )
-                    return rc;
-                state = vppFullPath;
-                VPathParseResetAnchor ( i );
-                break;
-
-            default:
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-            }
-            break;
-
-        case vppNamePath:
-
-            switch ( ch )
-            {
-            case '/':
-                state = vppRelPath;
-                break;
-
-            case ':':
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-
-            case '?':
-                VPathCapturePath ( self, uri, anchor, i, count, vpName );
-                state = vppParamName;
-                VPathParseResetAnchor ( i );
-                break;
-
-            case '#':
-                VPathCapturePath ( self, uri, anchor, i, count, vpName );
-                state = vppFragment;
-                VPathParseResetAnchor ( i );
-                break;
-            }
-
-            break;
-
-        case vppUNCOrMalformedPOSIXPath:
-
-            switch ( ch )
-            {
-            case '/':
-                state = vppFullPath;
-                VPathParseResetAnchor ( i );
-                break;
-
-            case ':':
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-
-            case '?':
-                VPathCapturePath ( self, uri, anchor, i, count, vpFullPath );
-                state = vppParamName;
-                VPathParseResetAnchor ( i );
-                break;
-
-            case '#':
-                VPathCapturePath ( self, uri, anchor, i, count, vpFullPath );
-                state = vppFragment;
-                VPathParseResetAnchor ( i );
-                break;
-
-            default:
-                state = vppUNCPath;
-            }
-
-            break;
-
-        case vppFullOrUNCPath:
-
-            if ( ch == '/' )
-            {
-                state = vppUNCOrMalformedPOSIXPath;
-                break;
-            }
-
-            state = vppFullPath;
-            /* no break */
-
-        case vppRelPath:
-        case vppFullPath:
-
-            switch ( ch )
-            {
-            case ':':
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-
-            case '?':
-                VPathCapturePath ( self, uri, anchor, i, count,
-                    ( state == vppRelPath ) ? vpRelPath : vpFullPath );
-                state = vppParamName;
-                VPathParseResetAnchor ( i );
-                break;
-
-            case '#':
-                VPathCapturePath ( self, uri, anchor, i, count,
-                    ( state == vppRelPath ) ? vpRelPath : vpFullPath );
-                state = vppFragment;
-                VPathParseResetAnchor ( i );
-                break;
-            }
-
-            break;
-
-        case vppUNCPath:
-
-            switch ( ch )
-            {
-            case ':':
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-
-            case '?':
-                VPathCapturePath ( self, uri, anchor, i, count, vpUNCPath );
-                state = vppParamName;
-                VPathParseResetAnchor ( i );
-                break;
-
-            case '#':
-                VPathCapturePath ( self, uri, anchor, i, count, vpUNCPath );
-                state = vppFragment;
-                VPathParseResetAnchor ( i );
-                break;
-            }
-
-            break;
-
-        case vppParamName:
-
-            switch ( ch )
-            {
-            case ':':
-            case '?':
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-
-            case '=':
-                state = vppParamValue;
-                break;
-
-            case '#':
-                VPathCaptureQuery ( self, uri, anchor, i, count );
-                state = vppFragment;
-                VPathParseResetAnchor ( i );
-                break;
-            }
-
-            break;
-
-        case vppParamValue:
-
-            switch ( ch )
-            {
-            case ':':
-            case '?':
-            case '=':
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-
-            case '&':
-                state = vppParamName;
-                break;
-
-            case '#':
-                VPathCaptureQuery ( self, uri, anchor, i, count );
-                state = vppFragment;
-                VPathParseResetAnchor ( i );
-                break;
-            }
-
-            break;
-
-        case vppFragment:
-
-            switch ( ch )
-            {
-            case ':':
-            case '?':
-            case '#':
-                return RC ( rcVFS, rcPath, rcParsing, rcChar, rcUnexpected );
-            }
-
-            break;
-        }
-    }
-
-    switch ( state )
-    {
-    case vppStart:
-        return RC ( rcVFS, rcPath, rcParsing, rcString, rcEmpty );
-    case vppAccPrefixAlphaNamePathOrScheme:
-    case vppAccAlphaNamePath:
-    case vppAccDigitNamePathOrScheme:
-    case vppAccDigitNamePath:
-    case vppAccExtNamePathOrScheme:
-    case vppAccExtNamePath:
-    case vppAccSuffixNamePath:
-        VPathCaptureAccession ( self, uri, anchor, i );
-        VPathCaptureAccCode ( self, acc_prefix, acc_alpha, acc_digit, acc_ext, acc_suffix );
-        break;
-    case vppAccDotNamePathOrScheme:
-    case vppAccDotNamePath:
-    case vppAccUnderNamePath:
-    case vppNamePathOrScheme:
-        VPathCapturePath ( self, uri, anchor, i, count, vpName );
-        break;
-    case vppAccOidRelOrSlash:
-        return RC ( rcVFS, rcPath, rcParsing, rcData, rcInsufficient );
-    case vppAccPrefixAlphaRel:
-    case vppAccAlphaRel:
-    case vppAccDigitRel:
-    case vppAccExtRel:
-    case vppAccSuffixRel:
-        VPathCaptureAccession ( self, uri, anchor, i );
-        VPathCaptureAccCode ( self, acc_prefix, acc_alpha, acc_digit, acc_ext, acc_suffix );
-        break;
-    case vppOidRel:
-        VPathCaptureOid ( self, oid, uri, anchor, oid_anchor, i );
-        break;
-    case vppAccDotRel:
-    case vppAccUnderRel:
-    case vppSlash:
-    case vppAuthHostSpec:
-    case vppHostSpec:
-        return RC ( rcVFS, rcPath, rcParsing, rcData, rcInsufficient );
-    case vppAuthHostNamePort:
-    case vppHostNamePort:
-        VPathCaptureHostName ( self, uri, anchor, i );
-        break;
-    case vppIPv4Port:
-        if ( ++ ip == 4 )
-            return VPathCaptureIPv4 ( self, ipv4 );
-    case vppIPv4Dot:
-    case vppIPv6Port:
-    case vppIPv6Colon:
-    case vppPortSpecOrFullPath:
-    case vppPortSpec:
-        return RC ( rcVFS, rcPath, rcParsing, rcData, rcInsufficient );
-    case vppPortName:
-        VPathCapturePortName ( self, uri, anchor, i );
-        break;
-    case vppPortNum:
-        return VPathCapturePortNum ( self, port );
-    case vppNamePath:
-        VPathCapturePath ( self, uri, anchor, i, count, vpName );
-        break;
-    case vppRelPath:
-        VPathCapturePath ( self, uri, anchor, i, count, vpRelPath );
-        break;
-    case vppUNCOrMalformedPOSIXPath:
-    case vppFullOrUNCPath:
-    case vppFullPath:
-        VPathCapturePath ( self, uri, anchor, i, count, vpFullPath );
-        break;
-    case vppUNCPath:
-        VPathCapturePath ( self, uri, anchor, i, count, vpUNCPath );
-        break;
-    case vppParamName:
-    case vppParamValue:
-        VPathCaptureQuery ( self, uri, anchor, i, count );
-        break;
-    case vppFragment:
-        VPathCaptureFragment ( self, uri, anchor, i, count );
-        break;
-    }
-
-    return 0;
-}
-
-
-/* MakeFromText
- *  could be anything...
- */
-static
-rc_t VPathMakeFromVText ( VPath ** ppath, const char * path_fmt, va_list args )
-{
-    rc_t rc;
-    KDataBuffer buffer;
-
-    /* initialize buffer */
-    memset ( & buffer, 0, sizeof buffer );
-    buffer . elem_bits = 8;
-
-    /* print into buffer */
-    rc = KDataBufferVPrintf ( & buffer, path_fmt, args );
-    if ( rc == 0 )
-    {
-        VPath * path = calloc ( 1, sizeof * path );
-        if ( path == NULL )
-            rc = RC ( rcVFS, rcPath, rcAllocating, rcMemory, rcExhausted );
-        else
-        {
-            /* straight copy to steal contents */
-            path -> data = buffer;
-
-            /* parse into portions */
-            rc = VPathParse ( path, buffer . base, ( size_t ) buffer . elem_count - 1 );
-            if ( rc == 0 )
-            {
-                KRefcountInit ( & path -> refcount, 1, "VPath", "make-from-text", buffer . base );
-                * ppath = path;
-                return 0;
-            }
-
-            free ( path );
-        }
-
-        KDataBufferWhack ( & buffer );
-    }
-
-    * ppath = NULL;
-
-    return rc;
-}
-
-static
-rc_t VPathMakeFromText ( VPath ** ppath, const char * text, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, text );
-
-    rc = VPathMakeFromVText ( ppath, text, args );
-
-    va_end ( args );
-
-    return rc;
-}
-
-/* AddRef
- * Release
- *  ignores NULL references
- */
-LIB_EXPORT rc_t CC VPathAddRef ( const VPath *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "VPath" ) )
-        {
-        case krefLimit:
-            return RC ( rcVFS, rcPath, rcAttaching, rcRange, rcExcessive );
-        }
-    }
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC VPathRelease ( const VPath *self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "VPath" ) )
-        {
-        case krefWhack:
-            VPathWhack ( ( VPath* ) self );
-            break;
-        case krefNegative:
-            return RC ( rcVFS, rcPath, rcReleasing, rcRange, rcExcessive );
-        }
-    }
-
-    return 0;
-}
-
-
-/* IsFSCompatible
- *  asks if the path can be used with the OS' filesystems
- */
-LIB_EXPORT bool CC VPathIsFSCompatible ( const VPath * self )
-{
-    if ( self != NULL )
-    {
-        switch ( self -> path_type )
-        {
-        case vpNameOrAccession:
-        case vpName:
-        case vpRelPath:
-        case vpUNCPath:
-        case vpFullPath:
-            return true;
-        }
-    }
-    return false;
-}
-
-
-/* FromUri
- *  asks if the path was created from a formal URI
- */
-LIB_EXPORT bool CC VPathFromUri ( const VPath * self )
-{
-    if ( self != NULL )
-        return self -> from_uri;
-    return false;
-}
-
-
-/* Read*
- *  read the various parts
- *  copies out data into user-supplied buffer
- */
-static
-rc_t VPathSetInvalidReturn ( rc_t rc,
-    char * buffer, size_t buffer_size, size_t * num_read )
-{
-    if ( num_read != NULL )
-        * num_read = 0;
-    if ( buffer != NULL && buffer_size != 0 )
-        buffer [ 0 ] = 0;
-    return rc;
-}
-
-static
-rc_t VPathReadTestSelf ( const VPath * self,
-    char * buffer, size_t buffer_size, size_t * num_read )
-{
-    rc_t rc;
-
-    if ( self == NULL )
-        rc = RC ( rcVFS, rcPath, rcReading, rcSelf, rcNull );
-    else if ( self -> path_type == vpInvalid )
-        rc = RC ( rcVFS, rcPath, rcReading, rcSelf, rcInvalid );
-    else
-        return 0;
-
-    return VPathSetInvalidReturn ( rc, buffer, buffer_size, num_read );
-}
-
-static
-rc_t VPathReadMember ( const VPath * self,
-    char * buffer, size_t buffer_size, size_t * num_read,
-    const String * mbr, uint32_t idx )
-{
-    rc_t rc = VPathReadTestSelf ( self, buffer, buffer_size, num_read );
-    if ( rc == 0 )
-        rc = string_printf ( buffer, buffer_size, num_read, "%:*-$S", idx, mbr );
-    return rc;
-}
-
-static
-rc_t VPathGetSchemeInt ( const VPath * self, String * scheme )
-{
-    if ( self -> scheme . size != 0 )
-        * scheme = self -> scheme;
-
-    else switch ( self -> path_type )
-    {
-    case vpOID:
-        CONST_STRING ( scheme, "ncbi-obj" );
-        break;
-    case vpAccession:
-        CONST_STRING ( scheme, "ncbi-acc" );
-        break;
-    case vpNameOrOID:
-    case vpNameOrAccession:
-    case vpName:
-    case vpRelPath:
-    case vpFullPath:
-        if ( self -> query . size != 0 || self -> fragment . size != 0 )
-            CONST_STRING ( scheme, "ncbi-file" );
-        else
-            CONST_STRING ( scheme, "file" );
-        break;
-    case vpUNCPath:
-        CONST_STRING ( scheme, "ncbi-file" );
-        break;
-    default:
-        return RC ( rcVFS, rcPath, rcReading, rcType, rcIncorrect );
-    }
-
-    return 0;
-}
-
-static
-rc_t VPathReadSchemeInt ( const VPath * self,
-    char * buffer, size_t buffer_size, size_t * num_read,
-    const char * suffix, bool * fail )
-{
-    String scheme;
-    rc_t rc = VPathGetSchemeInt ( self, & scheme );
-    if ( rc != 0 )
-    {
-        * fail = true;
-        return rc;
-    }
-    return string_printf ( buffer, buffer_size, num_read, "%S%s", & scheme, suffix );
-}
-
-static
-rc_t VPathReadAuthInt ( const VPath * self,
-    char * buffer, size_t buffer_size, size_t * num_read,
-    const char * prefix )
-{
-    rc_t rc = 0;
-
-    if ( self -> auth . size == 0 )
-        * num_read = 0;
-    else
-    {
-        rc = string_printf ( buffer, buffer_size, num_read,
-                             "%s%S", prefix, & self -> auth );
-    }
-
-    return rc;
-}
-
-static
-rc_t VPathReadHostInt ( const VPath * self,
-    char * buffer, size_t buffer_size, size_t * num_read,
-    const char * prefix )
-{
-    rc_t rc = 0;
-    const char * lbrack, * rbrack;
-
-    switch ( self -> host_type )
-    {
-    case vhDNSName:
-
-        rc = string_printf ( buffer, buffer_size, num_read,
-                             "%s%S", prefix, & self -> host );
-        break;
-
-    case vhIPv4:
-
-        rc = string_printf ( buffer, buffer_size, num_read
-                             , "%s%u.%u.%u.%u"
-                             , prefix
-                             , ( self -> ipv4 >> 24 ) & 0xFF
-                             , ( self -> ipv4 >> 16 ) & 0xFF
-                             , ( self -> ipv4 >>  8 ) & 0xFF
-                             , ( self -> ipv4 >>  0 ) & 0xFF
-            );
-        break;
-
-    case vhIPv6:
-
-        lbrack = rbrack = "";
-        if ( prefix [ 0 ] != 0 )
-        {
-            lbrack = "[";
-            rbrack = "]";
-        }
-
-        rc = string_printf ( buffer, buffer_size, num_read
-                             , "%s%s%u:%u:%u:%u:%u:%u:%u:%u%s"
-                             , prefix
-                             , lbrack
-                             , self -> ipv6 [ 0 ]
-                             , self -> ipv6 [ 1 ]
-                             , self -> ipv6 [ 2 ]
-                             , self -> ipv6 [ 3 ]
-                             , self -> ipv6 [ 4 ]
-                             , self -> ipv6 [ 5 ]
-                             , self -> ipv6 [ 6 ]
-                             , self -> ipv6 [ 7 ]
-                             , rbrack
-            );
-        break;
-    }
-
-    return rc;
-}
-
-static
-rc_t VPathReadPathInt ( const VPath * self,
-    char * buffer, size_t buffer_size, size_t * num_read )
-{
-    rc_t rc;
-
-    /* print remainder */
-    switch ( self -> path_type )
-    {
-    case vpOID:
-            
-        rc = string_printf ( buffer, buffer_size, num_read
-                             , "%u"
-                             , self -> obj_id
-            );
-        break;
-
-    case vpAccession:
-    case vpNameOrOID:
-    case vpNameOrAccession:
-    case vpName:
-    case vpRelPath:
-    case vpUNCPath:
-    case vpFullPath:
-
-        assert ( self -> path . size != 0 );
-        rc = string_printf ( buffer, buffer_size, num_read
-                             , "%S"
-                             , & self -> path
-            );
-        break;
-
-    default:
-
-        if ( num_read != NULL )
-            * num_read = 0;
-
-        rc = 0;
-    }
-
-    return rc;
-}
-
-static
-rc_t VPathReadUriInt ( const VPath * self,
-    char * buffer, size_t buffer_size, size_t * total_read )
-{
-    rc_t rc;
-    const char * host_prefix;
-    size_t total, num_read, avail;
-    bool has_auth, has_host, fail = false;
-
-    /* print scheme plus preparation for host */
-    rc = VPathReadSchemeInt ( self, buffer, buffer_size, & num_read, ":", & fail );
-    if ( fail )
-        return VPathSetInvalidReturn ( rc, buffer, buffer_size, total_read );
-    total = num_read;
-    avail = ( rc == 0 ) ? buffer_size - total : 0;
-
-    /* print auth */
-    host_prefix = "//";
-    rc = VPathReadAuthInt ( self, & buffer [ total ], avail, & num_read, host_prefix );
-    total += num_read;
-    avail -= ( rc == 0 ) ? num_read : 0;
-    has_auth = num_read > 2;
-    if ( has_auth )
-        host_prefix = "@";
-
-    /* print host */
-    rc = VPathReadHostInt ( self, & buffer [ total ], avail, & num_read, host_prefix );
-    total += num_read;
-    avail -= ( rc == 0 ) ? num_read : 0;
-    has_host = num_read > ( 2 - has_auth );
-
-    /* print port */
-    if ( has_host )
-    {
-        if ( self -> portname . size != 0 )
-            rc = string_printf ( & buffer [ total ], avail, & num_read, ":%S", & self -> portname );
-        else if ( self -> portnum != 0 )
-            rc = string_printf ( & buffer [ total ], avail, & num_read, ":%u", self -> portnum );
-        else if ( self -> missing_port )
-            rc = string_printf ( & buffer [ total ], avail, & num_read, ":" );
-        else
-            num_read = 0;
-
-        total += num_read;
-        avail -= ( rc == 0 ) ? num_read : 0;
-    }
-
-    /* sanity check */
-    assert ( ! has_auth || has_host );
-    assert ( self -> path . size == 0 || self -> path . addr [ 0 ] == '/' || ! has_host );
-    assert ( self -> query . size == 0 || self -> query . addr [ 0 ] == '?' );
-    assert ( self -> fragment . size == 0 || self -> fragment . addr [ 0 ] == '#' );
-
-    /* print remainder */
-    switch ( self -> path_type )
-    {
-    case vpOID:
-
-        if ( ! has_host )
-        {
-            /* correct for empty host spec */
-            total -= 2;
-            avail += 2;
-        }
-
-        rc = string_printf ( & buffer [ total ], avail, & num_read
-                             , "%s%u%S%S"
-                             , has_host ? "/" : ""
-                             , self -> obj_id
-                             , & self -> query
-                             , & self -> fragment
-            );
-        break;
-
-    case vpAccession:
-    case vpNameOrOID:
-    case vpNameOrAccession:
-    case vpName:
-    case vpRelPath:
-    case vpUNCPath:
-
-        assert ( ! has_host );
-
-        /* correct for empty host spec */
-        total -= 2;
-        avail += 2;
-
-        /* no break */
-
-    case vpFullPath:
-
-        assert ( self -> path . size != 0 );
-        rc = string_printf ( & buffer [ total ], avail, & num_read
-                             , "%S%S%S"
-                             , & self -> path
-                             , & self -> query
-                             , & self -> fragment
-            );
-        break;
-    }
-
-    if ( total_read != NULL )
-        * total_read = total + num_read;
-
-    if ( rc != 0 && buffer != NULL && buffer_size != 0 )
-        buffer [ 0 ] = 0;
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VPathReadUri ( const VPath * self,
-    char * buffer, size_t buffer_size, size_t * num_read )
-{
-    rc_t rc = VPathReadTestSelf ( self, buffer, buffer_size, num_read );
-    if ( rc == 0 )
-        rc = VPathReadUriInt ( self, buffer, buffer_size, num_read );
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VPathReadScheme ( const VPath * self,
-    char * buffer, size_t buffer_size, size_t * num_read )
-{
-    rc_t rc = VPathReadTestSelf ( self, buffer, buffer_size, num_read );
-    if ( rc == 0 )
-    {
-        bool fail = false;
-        rc = VPathReadSchemeInt ( self, buffer, buffer_size, num_read, "", & fail );
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VPathReadAuth ( const VPath * self,
-    char * buffer, size_t buffer_size, size_t * num_read )
-{
-    rc_t rc = VPathReadTestSelf ( self, buffer, buffer_size, num_read );
-    if ( rc == 0 )
-        rc = VPathReadAuthInt ( self, buffer, buffer_size, num_read, "" );
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VPathReadHost ( const VPath * self,
-    char * buffer, size_t buffer_size, size_t * num_read )
-{
-    rc_t rc = VPathReadTestSelf ( self, buffer, buffer_size, num_read );
-    if ( rc == 0 )
-        rc = VPathReadHostInt ( self, buffer, buffer_size, num_read, "" );
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VPathReadPortName ( const VPath * self,
-    char * buffer, size_t buffer_size, size_t * num_read )
-{
-    return VPathReadMember ( self,
-        buffer, buffer_size, num_read,
-        & self -> portname, 0 );
-}
-
-LIB_EXPORT rc_t CC VPathReadPath ( const VPath * self,
-    char * buffer, size_t buffer_size, size_t * num_read )
-{
-    rc_t rc = VPathReadTestSelf ( self, buffer, buffer_size, num_read );
-    if ( rc == 0 )
-        rc = VPathReadPathInt ( self, buffer, buffer_size, num_read );
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VPathReadQuery ( const VPath * self,
-    char * buffer, size_t buffer_size, size_t * num_read )
-{
-    return VPathReadMember ( self,
-        buffer, buffer_size, num_read,
-        & self -> query, 1 );
-}
-
-static
-rc_t VPathFindParam ( const VPath * self, const char * param, String * val_str )
-{
-    rc_t rc;
-
-    if ( param == NULL )
-        rc = RC ( rcVFS, rcPath, rcReading, rcParam, rcNull );
-    else if ( param [ 0 ] == 0 )
-        rc = RC ( rcVFS, rcPath, rcReading, rcParam, rcEmpty );
-    else
-    {
-        size_t qsize = string_size ( param );
-        const char * start = self -> query . addr;
-        const char * end = start + self -> query . size;
-        if ( ++ start < end ) while ( 1 )
-        {
-            /* match as many characters as possible of param name */
-            uint32_t matching = strcase_match ( start, end - start, param, qsize, -1, NULL );
-            start += matching;
-
-            if ( ( size_t ) matching == qsize )
-            {
-                /* may have found the parameter */
-                if ( start == end || start [ 0 ] == '&' )
-                {
-                    /* no value */
-                    StringInit ( val_str, "", 0, 0 );
-                    return 0;
-                }
-
-                if ( start [ 0 ] == '=' )
-                {
-                    /* have value */
-                    const char * val = start + 1;
-                    const char * pend = string_chr ( val, end - val, '&' );
-                    if ( pend == NULL )
-                        pend = end;
-                    StringInit ( val_str, val, pend - val, string_len ( val, pend - val ) );
-                    return 0;
-                }
-            }
-
-            /* find next parameter */
-            start = string_chr ( start, end - start, '&' );
-            if ( start == NULL )
-                break;
-
-            /* skip separator */
-            ++ start;
-        }
-
-        rc = RC ( rcVFS, rcPath, rcReading, rcParam, rcNotFound );
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VPathReadParam ( const VPath * self, const char * param,
-    char * buffer, size_t buffer_size, size_t * num_read )
-{
-    rc_t rc = VPathReadTestSelf ( self, buffer, buffer_size, num_read );
-    if ( rc == 0 )
-    {
-        String val_str;
-        rc = VPathFindParam ( self, param, & val_str );
-        if ( rc == 0 )
-        {
-            /* copy out value */
-            return string_printf ( buffer, buffer_size, num_read
-                                   , "%S"
-                                   , & val_str
-                );
-        }
-
-        VPathSetInvalidReturn ( rc, buffer, buffer_size, num_read );
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VPathReadFragment ( const VPath * self,
-    char * buffer, size_t buffer_size, size_t * num_read )
-{
-    return VPathReadMember ( self,
-        buffer, buffer_size, num_read,
-        & self -> fragment, 1 );
-}
-
-
-/* MakeUri
- *  convert a VPath into a Uri
- */
-LIB_EXPORT rc_t CC VPathMakeUri ( const VPath * self, const String ** uri )
-{
-    rc_t rc;
-
-    if ( uri == NULL )
-        rc = RC ( rcVFS, rcPath, rcAccessing, rcParam, rcNull );
-    else
-    {
-        /* TBD - if we build the path from a URI, we should just
-           grab the text from buffer */
-        size_t bytes;
-        char buffer [ 8192 ];
-        rc = VPathReadUri ( self, buffer, sizeof buffer, & bytes );
-        if ( rc == 0 )
-        {
-            String uri_str;
-            StringInit ( & uri_str, buffer, bytes, string_len ( buffer, bytes ) );
-            return StringCopy ( uri, & uri_str );
-        }
-
-        /* TBD - if we ever have huge URIs, 8K can be insufficient */
-        * uri = NULL;
-    }
-    return rc;
-}
-
-
-/* MakeString
- *  convert a VPath into a String
- *  respects original source of path,
- *  i.e. does not add scheme unnecessarily
- */
-LIB_EXPORT rc_t CC VPathMakeString ( const VPath * self, const String ** str )
-{
-    rc_t rc;
-
-    if ( str == NULL )
-        rc = RC ( rcVFS, rcPath, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVFS, rcPath, rcAccessing, rcSelf, rcNull );
-        else
-        {
-            size_t bytes, host;
-            char buffer [ 8192 ];
-
-            if ( self -> from_uri || self -> query . size != 0 || self -> fragment . size != 0 )
-                rc = VPathReadUriInt ( self, buffer, sizeof buffer, & bytes );
-            else switch ( self -> path_type )
-            {
-            case vpHostName:
-                rc = VPathReadHostInt ( self, buffer, sizeof buffer, & bytes, "" );
-                break;
-
-            case vpEndpoint:
-                rc = VPathReadHostInt ( self, buffer, sizeof buffer, & host, "" );
-                if ( rc == 0 )
-                {
-                    if ( self -> portname . size != 0 )
-                    {
-                        rc = string_printf ( & buffer [ host ], sizeof buffer - host,
-                            & bytes, ":%S", & self -> portname );
-                    }
-                    else
-                    {
-                        rc = string_printf ( & buffer [ host ], sizeof buffer - host,
-                            & bytes, ":%u", & self -> portnum );
-                    }
-
-                    bytes += host;
-                }
-                break;
-
-            default:
-                rc = VPathReadPathInt ( self, buffer, sizeof buffer, & bytes );
-            }
-
-            if ( rc == 0 )
-            {
-                String local_str;
-                StringInit ( & local_str, buffer, bytes, string_len ( buffer, bytes ) );
-                return StringCopy ( str, & local_str );
-            }
-        }
-
-        * str = NULL;
-    }
-    return rc;
-}
-
-
-/* Get*
- *  retrieves internal parts
- *  returns pointers to internal String data
- *  Strings remain valid while "self" is valid
- */
-static
-rc_t VPathGetTestSelf ( const VPath * self )
-{
-    if ( self == NULL )
-        return RC ( rcVFS, rcPath, rcAccessing, rcSelf, rcNull );
-    if ( self -> path_type == vpInvalid )
-        return RC ( rcVFS, rcPath, rcAccessing, rcSelf, rcInvalid );
-    return 0;
-}
-
-LIB_EXPORT rc_t CC VPathGetScheme ( const VPath * self, String * str )
-{
-    rc_t rc;
-
-    if ( str == NULL )
-        rc = RC ( rcVFS, rcPath, rcAccessing, rcParam, rcNull );
-    else
-    {
-        rc = VPathGetTestSelf ( self );
-        if ( rc == 0 )
-        {
-            /* work harder to fill out a scheme if not there */
-            rc = VPathGetSchemeInt ( self, str );
-            if ( rc == 0 )
-                return 0;
-
-            /* if the path can't have a scheme, it's okay */
-            rc = 0;
-        }
-
-        StringInit ( str, "", 0, 0 );
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VPathGetAuth ( const VPath * self, String * str )
-{
-    rc_t rc;
-
-    if ( str == NULL )
-        rc = RC ( rcVFS, rcPath, rcAccessing, rcParam, rcNull );
-    else
-    {
-        rc = VPathGetTestSelf ( self );
-        if ( rc == 0 )
-        {
-            * str = self -> auth;
-            return 0;
-        }
-
-        StringInit ( str, "", 0, 0 );
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VPathGetHost ( const VPath * self, String * str )
-{
-    rc_t rc;
-
-    if ( str == NULL )
-        rc = RC ( rcVFS, rcPath, rcAccessing, rcParam, rcNull );
-    else
-    {
-        rc = VPathGetTestSelf ( self );
-        if ( rc == 0 )
-        {
-            * str = self -> host;
-            return 0;
-        }
-
-        StringInit ( str, "", 0, 0 );
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VPathGetPortName ( const VPath * self, String * str )
-{
-    rc_t rc;
-
-    if ( str == NULL )
-        rc = RC ( rcVFS, rcPath, rcAccessing, rcParam, rcNull );
-    else
-    {
-        rc = VPathGetTestSelf ( self );
-        if ( rc == 0 )
-        {
-            * str = self -> portname;
-            return 0;
-        }
-
-        StringInit ( str, "", 0, 0 );
-    }
-
-    return rc;
-}
-
-LIB_EXPORT uint16_t CC VPathGetPortNum ( const VPath * self )
-{
-    rc_t rc = VPathGetTestSelf ( self );
-    if ( rc == 0 )
-        return self -> portnum;
-
-    return 0;
-}
-
-LIB_EXPORT rc_t CC VPathGetPath ( const VPath * self, String * str )
-{
-    rc_t rc;
-
-    if ( str == NULL )
-        rc = RC ( rcVFS, rcPath, rcAccessing, rcParam, rcNull );
-    else
-    {
-        rc = VPathGetTestSelf ( self );
-        if ( rc == 0 )
-        {
-            * str = self -> path;
-            return 0;
-        }
-
-        StringInit ( str, "", 0, 0 );
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VPathGetQuery ( const VPath * self, String * str )
-{
-    rc_t rc;
-
-    if ( str == NULL )
-        rc = RC ( rcVFS, rcPath, rcAccessing, rcParam, rcNull );
-    else
-    {
-        rc = VPathGetTestSelf ( self );
-        if ( rc == 0 )
-        {
-            StringSubstr ( & self -> query, str, 1, 0 );
-            return 0;
-        }
-
-        StringInit ( str, "", 0, 0 );
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VPathGetParam ( const VPath * self, const char * param, String * str )
-{
-    rc_t rc;
-
-    if ( str == NULL )
-        rc = RC ( rcVFS, rcPath, rcAccessing, rcParam, rcNull );
-    else
-    {
-        rc = VPathGetTestSelf ( self );
-        if ( rc == 0 )
-        {
-            rc = VPathFindParam ( self, param, str );
-            if ( rc == 0 )
-                return 0;
-        }
-
-        StringInit ( str, "", 0, 0 );
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VPathGetFragment ( const VPath * self, String * str )
-{
-    rc_t rc;
-
-    if ( str == NULL )
-        rc = RC ( rcVFS, rcPath, rcAccessing, rcParam, rcNull );
-    else
-    {
-        rc = VPathGetTestSelf ( self );
-        if ( rc == 0 )
-        {
-            StringSubstr ( & self -> fragment, str, 1, 0 );
-            return 0;
-        }
-
-        StringInit ( str, "", 0, 0 );
-    }
-
-    return rc;
-}
-
-/* TEMPORARY */
-LIB_EXPORT uint32_t CC VPathGetOid ( const VPath * self )
-{
-    if ( self != NULL )
-        return self -> obj_id;
-    return 0;
-}
-
-/*--------------------------------------------------------------------------
- * VFSManager
- */
-
-
-/* MakePath
- *  make a path object from a string conforming to
- *  either a standard POSIX path or a URI
- *
- *  "new_path" [ OUT ] - return parameter for new path object
- *
- *  "path_str" [ IN ] - a UTF-8 NUL-terminated string
- *  representing a POSIX path or URI, or
- *  a string_printf compatible format string
- *
- *  "path_fmt" [ IN ] and "args" [ IN ] - a UTF-8 NUL-terminated fmt string
- *  compatible with string_vprintf, plus argument list
- */
-LIB_EXPORT rc_t CC VFSManagerVMakePath ( const VFSManager * self,
-    VPath ** new_path, const char * path_fmt, va_list args )
-{
-    rc_t rc;
-
-    if ( new_path == NULL )
-        rc = RC ( rcVFS, rcMgr, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVFS, rcMgr, rcConstructing, rcSelf, rcNull );
-        else if ( path_fmt == NULL )
-            rc = RC ( rcVFS, rcMgr, rcConstructing, rcPath, rcNull );
-        else if ( path_fmt [ 0 ] == 0 )
-            rc = RC ( rcVFS, rcMgr, rcConstructing, rcPath, rcEmpty );
-        else
-        {
-            rc = VPathMakeFromVText ( new_path, path_fmt, args );
-            if ( rc == 0 )
-            {
-                VPath * path = * new_path;
-
-                if ( ! path -> from_uri )
-                {
-                    String scheme;
-                    rc = VPathGetSchemeInt ( path, & scheme );
-                    if ( rc == 0 )
-                        path -> scheme = scheme;
-                }
-
-                return 0;
-            }
-        }
-
-        * new_path = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VFSManagerMakePath ( const VFSManager * self,
-    VPath ** new_path, const char * path_str, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, path_str );
-
-    rc = VFSManagerVMakePath ( self, new_path, path_str, args );
-
-    va_end ( args );
-
-    return rc;
-}
-
-/* MakeAccPath - TEMPORARY
- *  takes a textual accession representation
- *  creates a VPath representing an accession
- *
- *  "new_path" [ OUT ] - return parameter for new path object
- *
- *  "acc" [ IN ] - a NUL-terminated ASCII fmt string
- */
-LIB_EXPORT rc_t CC VFSManagerVMakeAccPath ( const VFSManager * self,
-    VPath ** new_path, const char * fmt, va_list args )
-{
-    rc_t rc = VFSManagerVMakePath ( self, new_path, fmt, args );
-    if ( rc == 0 )
-    {
-        VPath * path = * new_path;
-        switch ( path -> path_type )
-        {
-        case vpAccession:
-            break;
-        case vpNameOrAccession:
-            path -> path_type = vpAccession;
-            break;
-        default:
-            VPathRelease ( path );
-            * new_path = NULL;
-            return RC ( rcVFS, rcMgr, rcConstructing, rcToken, rcIncorrect );
-        }
-
-        if ( path -> scheme . size == 0 )
-            VPathCaptureScheme ( path, "ncbi-acc", 0, 8 );
-    }
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VFSManagerMakeAccPath ( const VFSManager * self,
-    VPath ** new_path, const char * acc, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, acc );
-
-    rc = VFSManagerVMakeAccPath ( self, new_path, acc, args );
-
-    va_end ( args );
-
-    return rc;
-}
-
-
-/* MakeOidPath - TEMPORARY
- *  takes an integer oid
- *  creates a VPath representing an obj-id
- *
- *  "new_path" [ OUT ] - return parameter for new path object
- *
- *  "oid" [ IN ] - a non-zero object id
- */
-LIB_EXPORT rc_t CC VFSManagerMakeOidPath ( const VFSManager * self,
-    VPath ** new_path, uint32_t oid )
-{
-    char oid_str [ 32 ];
-    rc_t rc = string_printf ( oid_str, sizeof oid_str, NULL, "%u", oid );
-    assert ( rc == 0 );
-
-    rc = VFSManagerMakePath ( self, new_path, oid_str );
-    if ( rc == 0 )
-    {
-        VPath * path = * new_path;
-        switch ( path -> path_type )
-        {
-        case vpInvalid:
-        case vpNameOrAccession:
-        case vpName:
-            break;
-        default:
-            VPathRelease ( path );
-            * new_path = NULL;
-            return RC ( rcVFS, rcMgr, rcConstructing, rcToken, rcIncorrect );
-        }
-
-        VPathCaptureScheme ( path, "ncbi-obj", 0, 8 );
-        path -> obj_id = oid;
-        path -> path_type = vpOID;
-    }
-    return rc;
-}
-
-
-
-/* ==========================================
-             HACK O' MATIC
- */
-
-#include <vfs/path-priv.h>
-#include <vfs/manager-priv.h>
-#include <kfs/directory.h>
-
-/* MakeDirectoryRelative
- *  apparently the idea was to interpret "posix_path" against
- *  "dir" to come up with a stand-alone path that could be used
- *  without "dir" in the future. this is a total misunderstanding
- *  of the filesystem.
- *
- *  the old code would call create system path from the posix_path,
- *  which seems to make little sense on Windows... then it would
- *  decide whether "posix_path" was standalone or directory relative.
- */
-static
-rc_t LegacyVPathResolveAccession ( VPath ** new_path, const VPath * path )
-{
-    rc_t rc;
-    VFSManager * mgr;
-
-    * new_path = NULL;
-
-    rc = VFSManagerMake ( & mgr );
-    if ( rc == 0 )
-    {
-        VResolver * resolver;
-        rc = VFSManagerGetResolver ( mgr, & resolver );
-        if ( rc == 0 )
-        {
-            rc = VResolverLocal ( resolver, path, ( const VPath** ) new_path );
-            if ( GetRCState ( rc ) == rcNotFound )
-                rc = VResolverRemote ( resolver, eProtocolHttp, path, ( const VPath** ) new_path );
-
-            VResolverRelease ( resolver );
-        }
-
-        VFSManagerRelease ( mgr );
-    }
-
-    return rc;
-}
-
-static
-rc_t LegacyVPathMakeKDirRelative ( VPath ** new_path, const KDirectory * dir, const VPath * path )
-{
-    /* resolve the provided path against directory */
-    char resolved [ 4096 ];
-    rc_t rc = KDirectoryResolvePath ( dir, true, resolved, sizeof resolved,
-        "%.*s", ( uint32_t ) path -> path . size, path -> path . addr );
-    if ( rc == 0 )
-    {
-        /* re-evaluate, adding in any query and fragment */
-        rc = VPathMakeFromText ( new_path, "%s%S%S", resolved, & path -> query, & path -> fragment );
-        if ( rc == 0 )
-        {
-            VPath * relpath = * new_path;
-
-            /* reassess the scheme */
-            String scheme;
-            rc = VPathGetSchemeInt ( relpath, & scheme );
-            if ( rc == 0 )
-                relpath -> scheme = scheme;
-
-            return 0;
-        }
-    }
-
-    * new_path = NULL;
-    return rc;
-}
-
-LIB_EXPORT rc_t CC LegacyVPathMakeDirectoryRelative ( VPath ** new_path,
-    const KDirectory * dir, const char * posix_path )
-{
-    rc_t rc;
-
-    if ( new_path == NULL )
-        rc = RC ( rcVFS, rcMgr, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( dir == NULL )
-            rc = RC ( rcVFS, rcMgr, rcResolving, rcDirectory, rcNull );
-        else
-        {
-            /* first, try to get a VPath from "posix_path" */
-            rc = LegacyVPathMakeFmt ( new_path, posix_path );
-            if ( rc == 0 )
-            {
-                VPath * path = * new_path;
-
-                /* now try to interpret the thing */
-                if ( path -> from_uri )
-                {
-                    /* look at scheme */
-                    switch ( LegacyVPathGetUri_t ( path ) )
-                    {
-                    case vpuri_ncbi_acc:
-                    case vpuri_ncbi_obj:
-                    case vpuri_ncbi_legrefseq:
-                        /* try to resolve using VResolver */
-                        rc = LegacyVPathResolveAccession ( new_path, path );
-                        break;
-
-                    case vpuri_ncbi_vfs:
-                    case vpuri_file:
-                        /* test for full path */
-                        if ( path -> path_type == vpFullPath || path -> path_type == vpUNCPath )
-                            return 0;
-
-                        /* interpret relative to given directory */
-                        rc = LegacyVPathMakeKDirRelative ( new_path, dir, path );
-                        break;
-
-                    case vpuri_http:
-                    case vpuri_ftp:
-                    case vpuri_fasp:
-                        /* calling code would know how to handle these */
-                        return 0;
-
-                    default:
-                        /* while apparently valid URIs, callers would not know */
-                        * new_path = NULL;
-                    }
-                }
-
-                else
-                {
-                    /* look at deduced path type */
-                    switch ( path -> path_type )
-                    {
-                    case vpOID:
-                    case vpAccession: /* this is not expected not be set... */
-                    case vpNameOrOID:
-                    case vpNameOrAccession:
-                        /* try to resolve using VResolver */
-                        rc = LegacyVPathResolveAccession ( new_path, path );
-                        if ( rc == 0 )
-                            break;
-
-                        /* no break */
-
-                    case vpName:
-                    case vpRelPath:
-                        rc = LegacyVPathMakeKDirRelative ( new_path, dir, path );
-                        break;
-
-                    case vpUNCPath:
-                    case vpFullPath:
-                        return 0;
-
-                    default:
-                        * new_path = NULL;
-                    }
-                }
-
-                /* clean up path */
-                assert ( * new_path != path );
-                VPathRelease ( path );
-                return rc;
-            }
-        }
-
-        * new_path = NULL;
-    }
-
-    return rc;
-}
-
-
-/* Option
- *  rc == 0 if the option has been specified
- *  for options with a parameter, the value of the parameter is copied to buffer
- */
-LIB_EXPORT rc_t CC VPathOption ( const VPath * self, VPOption_t option,
-    char * buffer, size_t buffer_size, size_t * num_read )
-{
-    rc_t rc = VPathReadTestSelf ( self, buffer, buffer_size, num_read );
-    if ( rc == 0 )
-    {
-        const char * param1, * param2 = NULL;
-
-        switch ( option )
-        {
-        case vpopt_encrypted:
-            param1 = "enc";
-            param2 = "encrypt";
-            break;
-        case vpopt_pwpath:
-            param1 = "pwfile";
-            break;
-        case vpopt_pwfd:
-            param1 = "pwfile";
-            break;
-        case vpopt_readgroup:
-            param1 = "readgroup";
-            break;
-#if 0            
-        case vpopt_temporary_pw_hack:
-            param1 = "temporary_pw_hack";
-            break;
-#endif            
-        case vpopt_vdb_ctx:
-            param1 = "vdb-ctx";
-            break;
-        case vpopt_gap_ticket: 
-            param1 = "tic";
-            break;
-        default:
-            return RC ( rcVFS, rcPath, rcReading, rcToken, rcUnrecognized );
-        }
-
-        rc = VPathReadParam ( self, param1, buffer, buffer_size, num_read );
-        if ( param2 != NULL && GetRCState ( rc ) == rcNotFound )
-            rc = VPathReadParam ( self, param2, buffer, buffer_size, num_read );
-    }
-    return rc;
-}
-
-
-LIB_EXPORT rc_t LegacyVPathMake ( VPath ** new_path, const char * posix_path )
-{
-    return LegacyVPathMakeFmt ( new_path, posix_path );
-}
-
-rc_t LegacyVPathMakeFmt ( VPath ** new_path, const char * fmt, ... )
-{
-    rc_t rc;
-
-    va_list args;
-    va_start ( args, fmt );
-
-    rc = LegacyVPathMakeVFmt ( new_path, fmt, args );
-
-    va_end ( args );
-
-    return rc;
-}
-
-rc_t LegacyVPathMakeVFmt ( VPath ** new_path, const char * fmt, va_list args )
-{
-    rc_t rc;
-
-    if ( new_path == NULL )
-        rc = RC ( rcVFS, rcPath, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( fmt == NULL )
-            rc = RC ( rcVFS, rcPath, rcConstructing, rcParam, rcNull );
-        else if ( fmt [ 0 ] == 0 )
-            rc = RC ( rcVFS, rcPath, rcConstructing, rcParam, rcEmpty );
-        else
-        {
-            rc = VPathMakeFromVText ( new_path, fmt, args );
-            if ( rc == 0 )
-            {
-                VPath * path = * new_path;
-
-                if ( ! path -> from_uri )
-                {
-                    String scheme;
-                    rc = VPathGetSchemeInt ( path, & scheme );
-                    if ( rc == 0 )
-                        path -> scheme = scheme;
-                }
-
-                return 0;
-            }
-        }
-
-        * new_path = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC LegacyVPathGetScheme_t ( const VPath * self, VPUri_t * uri_type )
-{
-    rc_t rc = 0;
-
-    if ( uri_type == NULL )
-        rc = RC ( rcVFS, rcPath, rcAccessing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVFS, rcPath, rcAccessing, rcSelf, rcNull );
-        else if ( self -> path_type != vpInvalid )
-        {
-            if ( ! self -> from_uri )
-            {
-                * uri_type = vpuri_none;
-                return 0;
-            }
-
-            * uri_type = self -> scheme_type;
-            return 0;
-        }
-
-        /* object was invalid */
-        * uri_type = vpuri_invalid;
-    }
-
-    return rc;
-}
-
-VPUri_t LegacyVPathGetUri_t ( const VPath * self )
-{
-    VPUri_t uri_type;
-    LegacyVPathGetScheme_t ( self, & uri_type );
-    return uri_type;
-}
diff --git a/libs/vfs/resolver-priv.h b/libs/vfs/resolver-priv.h
deleted file mode 100644
index 860c601..0000000
--- a/libs/vfs/resolver-priv.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*===========================================================================
-*
-*                            Public Domain Notice
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#ifndef _h_resolver_priv_
-#define _h_resolver_priv_
-
-#ifndef _h_vfs_resolver_
-#include <vfs/resolver.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*--------------------------------------------------------------------------
- * KConfig Repository Structure
- *  expressed in pseudo BNF:
- *
- *  base-config
- *      = "repository" <category>*
- *      ;
- *
- *  category
- *      = "remote" <remote-sub-category>*
- *      | "site" <site-sub-category>*
- *      | "user" <user-sub-category>*
- *      ;
- *
- *  remote-sub-category
- *      = "main" <public-remote-named-repository>*
- *      | "aux" <public-remote-named-repository>*
- *      | "protected" <protected-remote-named-repository>*
- *      ;
- *
- *  site-sub-category
- *      = "main" <site-named-repository>*
- *      | "aux" <site-named-repository>*
- *      ;
- *
- *  user-sub-category
- *      = "public" <public-user-named-repository>*
- *      | "protected" ID <protected-user-named-repository>*
- *      ;
- *
- *  public-remote-named-repository
- *      = ID <public-remote-repository>
- *      ;
- *
- *  protected-remote-named-repository
- *      = ID <protected-remote-repository>
- *      ;
- *
- *  site-named-repository
- *      = ID <site-repository>
- *      ;
- *
- *  public-user-named-repository
- *      = ID <public-user-repository>
- *      ;
- *
- *  protected-user-named-repository
- *      = ID <protected-user-repository>
- *      ;
- *
- *  public-remote-repository
- *      = <public-remote-root> [ <disabled> ] <apps>*
- *      ;
- *
- *  protected-remote-repository
- *      = <protected-remote-root> [ <disabled> ] <apps>*
- *      ;
- *
- *  site-repository
- *      = <local-root> [ <disabled> ] <apps>*
- *      ;
- *
- *  public-user-repository
- *      = <local-root> [ <disabled> ] [ <cache-enabled> ] <apps>*
- *      ;
- *
- *  protected-user-repository
- *      = <local-root> <passwd> <download-ticket> [ <disabled> ] [ <cache-enabled> ] <apps>*
- *      ;
- *
- *  apps
- *      = "refseq" <app>
- *      | "sra" <app>
- *      | "wgs" <app>
- *      ;
- *
- *  app
- *      = [ <disabled> ] "volumes" <volume>*
- *      ;
- *
- *  volume
- *      = <expansion-alg> "=" <path-list>
- *      ;
- *
- *  expansion-alg
- *      = "flat" | "sra1000" | "sra1024" | "fuse1000" | "refseq" | ...
- *      ;
- *
- *  disabled
- *      = "disabled" "=" ( "true" | * )  # any value other than "true" is false
- *      ;
- *
- *  cache-enabled
- *      = "cache-enabled" "=" ( "true" | * )  # any value other than "true" is false
- *      ;
- */
-
-#define rcResolver   rcTree
-#define rcRepository rcDirectory
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _h_resolver_priv_ */
diff --git a/libs/vfs/resolver.c b/libs/vfs/resolver.c
deleted file mode 100644
index c023670..0000000
--- a/libs/vfs/resolver.c
+++ /dev/null
@@ -1,4386 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * =============================================================================
- *
- */
-
-
-#include <vfs/extern.h>
-#include "resolver-priv.h"
-
-#include <vfs/manager.h>
-#include <vfs/path.h>
-#include <kns/manager.h>
-#include <kns/http.h>
-#include <kns/stream.h>
-#include <kfs/file.h>
-#include <kfs/directory.h>
-#include <kfg/repository.h>
-#include <kfg/config.h>
-
-#include <klib/text.h>
-#include <klib/vector.h>
-#include <klib/refcount.h>
-#include <klib/namelist.h>
-#include <klib/printf.h>
-#include <klib/data-buffer.h>
-#include <klib/debug.h>
-#include <klib/log.h>
-#include <klib/rc.h>
-
-#include <sysalloc.h>
-
-#include <vfs/path-priv.h>
-#include "path-priv.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-/* to turn off CGI name resolution for
-   any refseq accessions */
-#define NO_REFSEQ_CGI 0
-
-/* to turn off CGI name resolution for
-   legacy WGS packages used by refseq */
-#define NO_LEGACY_WGS_REFSEQ_CGI NO_REFSEQ_CGI
-
-/* do not allow fragments to be returned
-   unless we are expecting them for refseq */
-#define DISALLOW_FRAGMENT NO_LEGACY_WGS_REFSEQ_CGI
-
-#define USE_CURL 0
-
-#define NAME_SERVICE_MAJ_VERS 1
-#define NAME_SERVICE_MIN_VERS 1
-#define ONE_DOT_ONE 0x01010000
-#define NAME_SERVICE_VERS \
-    ( ( NAME_SERVICE_MAJ_VERS << 24 ) | ( NAME_SERVICE_MIN_VERS << 16 ) )
-
-
-/*--------------------------------------------------------------------------
- * String
- */
-static
-void CC string_whack ( void *obj, void *ignore )
-{
-    StringWhack ( ( String* ) obj );
-}
-
-/*--------------------------------------------------------------------------
- * VResolverAccToken
- *  breaks up an accession into parts
- *
- *  "acc" is entire accession as given
- *
- *  the remainder is divided like so:
- *
- *    [<prefix>_]<alpha><digits>[.<ext1>[.<ext2>]]
- *
- *  prefix is optional
- *  alpha can be zero length iff prefix is not zero length
- *  digits must be non-zero length
- *  ext1 and ext2 are optional
- */
-typedef struct VResolverAccToken VResolverAccToken;
-struct VResolverAccToken
-{
-    String acc;
-    String prefix;
-    String alpha;
-    String digits;
-    String ext1;
-    String ext2;
-    String suffix;
-};
-
-static
-void VResolverAccTokenInitFromOID ( VResolverAccToken *t, const String *acc )
-{
-    CONST_STRING ( & t -> prefix, "" );
-    t -> alpha = t -> prefix;
-    t -> acc = t -> digits = * acc;
-    t -> ext1 = t -> ext2 = t -> prefix;
-    t -> suffix = t -> prefix;
-}
-
-/*--------------------------------------------------------------------------
- * VResolverAlg
- *  represents a set of zero or more volumes
- *  each of which is addressed using a particular expansion algorithm
- */
-typedef enum
-{
-    appUnknown,
-    appAny,
-    appFILE,
-    appREFSEQ,
-    appSRA,
-    appWGS,
-    appNANNOT,
-    appNAKMER,
-    appCount
-} VResolverAppID;
-
-typedef enum
-{
-    algCGI,
-    algFlat,
-    algSRAFlat,
-    algSRA1024,
-    algSRA1000,
-    algFUSE1000,
-    algREFSEQ,
-    algWGSFlat,
-    algWGS,
-    algFuseWGS,
-    algSRA_NCBI,
-    algSRA_EBI,
-
-    algNANNOTFlat,
-    algNANNOT,
-    algFuseNANNOT,
-    algNAKMERFlat,
-    algNAKMER,
-    algFuseNAKMER,
-
-    /* leave as last value */
-    algUnknown
-
-} VResolverAlgID;
-
-typedef enum
-{
-    cacheDisallow,
-    cacheAllow
-} VResolverCacheAllow;
-
-typedef struct VResolverAlg VResolverAlg;
-struct VResolverAlg
-{
-    /* volume paths - stored as String* */
-    Vector vols;
-
-    /* root path - borrowed reference */
-    const String *root;
-
-    /* download ticket - borrowed reference
-       non-NULL means that the root is a
-       resolver CGI. also, don't rely on
-       presence of any volumes... */
-    const String *ticket;
-
-    /* app_id helps to filter out volumes by app */
-    VResolverAppID app_id;
-
-    /* how to expand an accession */
-    VResolverAlgID alg_id;
-
-    /* a property of the repository */
-    bool protected;
-
-    /* whether the volumes are cache-capable
-       in particular, enabled if cache forced */
-    bool cache_capable;
-
-    /* whether the volumes are cache-enabled */
-    bool cache_enabled;
-
-    /* whether the volume is disabled in config */
-    bool disabled;
-#if 0
-    VRemoteProtocols protocols;
-#endif
-};
-
-
-/* Whack
- */
-static
-void CC VResolverAlgWhack ( void *item, void *ignore )
-{
-    VResolverAlg *self = item;
-
-    /* drop any volumes */
-    VectorWhack ( & self -> vols, string_whack, NULL );
-
-    /* everything else is a borrowed reference */
-
-    free ( self );
-}
-
-/* Make
- */
-static
-rc_t VResolverAlgMake ( VResolverAlg **algp, const String *root,
-     VResolverAppID app_id, VResolverAlgID alg_id, bool protected, bool disabled )
-{
-    rc_t rc;
-    VResolverAlg *alg = calloc ( 1, sizeof * alg );
-    if ( alg == NULL )
-        rc = RC ( rcVFS, rcMgr, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        VectorInit ( & alg -> vols, 0, 8 );
-        alg -> root = root;
-        alg -> app_id = app_id;
-        alg -> alg_id = alg_id;
-        alg -> protected = protected;
-        alg -> disabled = disabled;
-        rc = 0;
-    }
-
-    * algp = alg;
-    return rc;
-}
-
-/* MakeLocalWGSRefseqURI
- *  create a special URI that tells KDB how to open this
- *  obscured table, hidden away within a KAR file
- */
-static
-rc_t VResolverAlgMakeLocalWGSRefseqURI ( const VResolverAlg *self,
-    const String *vol, const String *exp, const String *acc, const VPath ** path )
-{
-    if ( self -> root == NULL )
-        return VPathMakeFmt ( ( VPath** ) path, NCBI_FILE_SCHEME ":%S/%S#tbl/%S", vol, exp, acc );
-    return VPathMakeFmt ( ( VPath** ) path, NCBI_FILE_SCHEME ":%S/%S/%S#tbl/%S", self -> root, vol, exp, acc );
-}
-
-/* MakeeRemoteWGSRefseqURI
- *  create a special URI that tells KDB how to open this
- *  obscured table, hidden away within a KAR file
- */
-static
-rc_t VResolverAlgMakeRemoteWGSRefseqURI ( const VResolverAlg *self,
-    const char *url, const String *acc, const VPath ** path )
-{
-    return VPathMakeFmt ( ( VPath** ) path, "%s#tbl/%S", url, acc );
-}
-
-/* MakeRemotePath
- *  the path is known to exist in the remote file system
- *  turn it into a VPath
- */
-static
-rc_t VResolverAlgMakeRemotePath ( const VResolverAlg *self,
-    const char *url, const VPath ** path )
-{
-    return VPathMakeFmt ( ( VPath** ) path, url );
-}
-
-/* MakeLocalPath
- *  the path is known to exist in the local file system
- *  turn it into a VPath
- */
-static
-rc_t VResolverAlgMakeLocalPath ( const VResolverAlg *self,
-    const String *vol, const String *exp, const VPath ** path )
-{
-    if ( self -> root == NULL )
-        return VPathMakeFmt ( ( VPath** ) path, "%S/%S", vol, exp );
-    return VPathMakeFmt ( ( VPath** ) path, "%S/%S/%S", self -> root, vol, exp );
-}
-
-/* MakeLocalFilePath
- *  the path is known to exist in the local file system
- *  turn it into a VPath
- */
-static
-rc_t VResolverAlgMakeLocalFilePath ( const VResolverAlg *self,
-    const String *vol, const String *exp, const char *krypto_ext, const VPath ** path )
-{
-    if ( self -> root == NULL )
-        return VPathMakeFmt ( ( VPath** ) path, "%S/%S%s", vol, exp, krypto_ext );
-    return VPathMakeFmt ( ( VPath** ) path, "%S/%S/%S%s", self -> root, vol, exp, krypto_ext );
-}
-
-/* expand_accession
- *  expand accession according to algorithm
- */
-static
-rc_t expand_algorithm ( const VResolverAlg *self, const VResolverAccToken *tok,
-    char *expanded, size_t bsize, size_t *size, bool legacy_wgs_refseq )
-{
-    rc_t rc;
-    uint32_t num;
-
-   switch ( self -> alg_id )
-    {
-    case algCGI:
-        return RC ( rcVFS, rcResolver, rcResolving, rcType, rcIncorrect );
-    case algFlat:
-        rc = string_printf ( expanded, bsize, size, "%S", & tok -> acc );
-        break;
-    case algSRAFlat:
-        rc = string_printf ( expanded, bsize, size,
-            "%S%S.sra", & tok -> alpha, & tok -> digits );
-        break;
-    case algSRA1024:
-        num = ( uint32_t ) strtoul ( tok -> digits . addr, NULL, 10 );
-        rc = string_printf ( expanded, bsize, size,
-            "%S/%06u/%S%S.sra", & tok -> alpha, num >> 10, & tok -> alpha, & tok -> digits );
-        break;
-    case algSRA1000:
-        num = ( uint32_t ) ( tok -> alpha . size + tok -> digits . size - 3 );
-        rc = string_printf ( expanded, bsize, size,
-            "%S/%.*S/%S%S.sra", & tok -> alpha, num, & tok -> acc, & tok -> alpha, & tok -> digits );
-        break;
-    case algFUSE1000:
-        num = ( uint32_t ) ( tok -> alpha . size + tok -> digits . size - 3 );
-        rc = string_printf ( expanded, bsize, size,
-            "%S/%.*S/%S%S/%S%S.sra", & tok -> alpha, num, & tok -> acc, 
-            & tok -> alpha, & tok -> digits, & tok -> alpha, & tok -> digits );
-        break;
-    case algREFSEQ:
-        if ( ! legacy_wgs_refseq )
-            rc = string_printf ( expanded, bsize, size, "%S", & tok -> acc );
-        else
-            rc = string_printf ( expanded, bsize, size, "%S%.2S", & tok -> alpha, & tok -> digits );
-        break;
-    case algWGSFlat:
-        num = ( uint32_t ) ( tok -> alpha . size + 2 );
-        if ( tok -> prefix . size != 0 )
-            num += (uint32_t) ( tok -> prefix . size + 1 );
-        rc = string_printf ( expanded, bsize, size,
-            "%.*S", num, & tok -> acc );
-        break;
-    case algWGS:
-        num = ( uint32_t ) ( tok -> alpha . size + 2 );
-        if ( tok -> prefix . size != 0 )
-            num += (uint32_t) ( tok -> prefix . size + 1 );
-        rc = string_printf ( expanded, bsize, size,
-            "WGS/%.2s/%.2s/%.*S", tok -> alpha . addr, tok -> alpha . addr + 2, num, & tok -> acc );
-        break;
-    case algFuseWGS:
-        num = ( uint32_t ) ( tok -> alpha . size + 2 );
-        if ( tok -> prefix . size != 0 )
-            num += (uint32_t) ( tok -> prefix . size + 1 );
-        rc = string_printf ( expanded, bsize, size,
-            "%.2s/%.2s/%.*S", tok -> alpha . addr, tok -> alpha . addr + 2, num, & tok -> acc );
-        break;
-    case algSRA_NCBI:
-        num = ( uint32_t ) strtoul ( tok -> digits . addr, NULL, 10 );
-        rc = string_printf ( expanded, bsize, size,
-            "%S/%06u/%S%S", & tok -> alpha, num >> 10, & tok -> alpha, & tok -> digits );
-        break;
-    case algSRA_EBI:
-        num = ( uint32_t ) ( tok -> alpha . size + tok -> digits . size - 3 );
-        rc = string_printf ( expanded, bsize, size,
-            "%S/%.*S/%S%S", & tok -> alpha, num, & tok -> acc, & tok -> alpha, & tok -> digits );
-        break;
-
-    case algNANNOTFlat:
-        rc = string_printf ( expanded, bsize, size, "%S", & tok -> acc );
-        break;
-    case algNANNOT:
-        num = ( uint32_t ) strtoul ( tok -> digits . addr, NULL, 10 );
-        rc = string_printf ( expanded, bsize, size,
-            "%03u/%03u/%S", num / 1000000, ( num / 1000 ) % 1000, & tok -> acc );
-        break;
-    case algFuseNANNOT:
-        num = ( uint32_t ) strtoul ( tok -> digits . addr, NULL, 10 );
-        rc = string_printf ( expanded, bsize, size,
-            "%03u/%03u/%S", num / 1000000, ( num / 1000 ) % 1000, & tok -> acc );
-        break;
-
-    case algNAKMERFlat:
-        rc = string_printf ( expanded, bsize, size, "%S", & tok -> acc );
-        break;
-    case algNAKMER:
-        num = ( uint32_t ) strtoul ( tok -> digits . addr, NULL, 10 );
-        rc = string_printf ( expanded, bsize, size,
-            "kmer/%03u/%03u/%S", num / 1000000, ( num / 1000 ) % 1000, & tok -> acc );
-        break;
-    case algFuseNAKMER:
-        num = ( uint32_t ) strtoul ( tok -> digits . addr, NULL, 10 );
-        rc = string_printf ( expanded, bsize, size,
-            "kmer/%03u/%03u/%S", num / 1000000, ( num / 1000 ) % 1000, & tok -> acc );
-        break;
-
-    default:
-        return RC ( rcVFS, rcResolver, rcResolving, rcType, rcUnrecognized );
-    }
-
-   return rc;
-}
-
-/* LocalResolve
- *  resolve an accession into a VPath or not found
- *
- *  1. expand accession according to algorithm
- *  2. search all volumes for accession
- *  3. return not found or new VPath
- */
-static
-rc_t VResolverAlgLocalResolve ( const VResolverAlg *self,
-    const KDirectory *wd, const VResolverAccToken *tok,
-    const VPath ** path, bool legacy_wgs_refseq, bool for_cache )
-{
-    KPathType kpt;
-    uint32_t i, count;
-
-    /* expanded accession */
-    String exp;
-    size_t size;
-    char expanded [ 256 ];
-
-    /* in some cases, "root" is NULL */
-    const String *vol, *root = self -> root;
-
-    /* expand the accession */
-    rc_t rc = expand_algorithm ( self, tok, expanded, sizeof expanded, & size, legacy_wgs_refseq );
-
-    /* should never have a problem here... */
-    if ( rc != 0 )
-        return rc;
-
-    /* if this is to detect a cache file, append extension */
-    if ( for_cache )
-    {
-        size += string_copy ( & expanded [ size ], sizeof expanded - size, ".cache", sizeof ".cache" - 1 );
-        if ( size == sizeof expanded )
-            return RC ( rcVFS, rcResolver, rcResolving, rcName, rcNotFound );
-    }
-
-    /* turn the expanded portion into a String
-       we know that size is also length due to
-       accession content rules */
-    StringInit ( & exp, expanded, size, ( uint32_t ) size );
-
-    /* remove the cache extension */
-    if ( for_cache )
-    {
-        exp . len -= sizeof ".cache" - 1;
-        exp . size -= sizeof ".cache" - 1;
-    }
-
-    /* now search all volumes */
-    count = VectorLength ( & self -> vols );
-    if ( root == NULL )
-    {
-        for ( i = 0; i < count; ++ i )
-        {
-            vol = VectorGet ( & self -> vols, i );
-            kpt = KDirectoryPathType ( wd, "%.*s/%.*s"
-                , ( int ) vol -> size, vol -> addr
-                , ( int ) size, expanded );
-            switch ( kpt & ~ kptAlias )
-            {
-            case kptFile:
-            case kptDir:
-                if ( legacy_wgs_refseq )
-                    return VResolverAlgMakeLocalWGSRefseqURI ( self, vol, & exp, & tok -> acc, path );
-                return VResolverAlgMakeLocalPath ( self, vol, & exp, path );
-            default:
-                break;
-            }
-        }
-    }
-    else
-    {
-        for ( i = 0; i < count; ++ i )
-        {
-            vol = VectorGet ( & self -> vols, i );
-            kpt = KDirectoryPathType ( wd, "%.*s/%.*s/%.*s"
-                , ( int ) root -> size, root -> addr
-                , ( int ) vol -> size, vol -> addr
-                , ( int ) size, expanded );
-            switch ( kpt & ~ kptAlias )
-            {
-            case kptFile:
-            case kptDir:
-                if ( legacy_wgs_refseq )
-                    return VResolverAlgMakeLocalWGSRefseqURI ( self, vol, & exp, & tok -> acc, path );
-                return VResolverAlgMakeLocalPath ( self, vol, & exp, path );
-            default:
-                break;
-            }
-        }
-    }
-    
-    return RC ( rcVFS, rcResolver, rcResolving, rcName, rcNotFound );
-}
-
-/* LocalFile
- *  resolve an file name into a VPath or not found
- */
-static
-rc_t VResolverAlgLocalFile ( const VResolverAlg *self,
-    const KDirectory *wd, const VPath *query,
-    const VPath ** path, bool for_cache )
-{
-    KPathType kpt;
-    uint32_t i, count;
-
-    /* in some cases, "root" is NULL */
-    const String *vol, *root = self -> root;
-
-    /* the file name */
-    String fname = query -> path;
-
-    /* cache extension */
-    const char *cache_ext = for_cache ? ".cache" : "";
-
-    /* encryption extension */
-    const char *krypto_ext = self -> protected ? ".ncbi_enc" : "";
-
-    /* now search all volumes */
-    count = VectorLength ( & self -> vols );
-    if ( root == NULL )
-    {
-        for ( i = 0; i < count; ++ i )
-        {
-            vol = VectorGet ( & self -> vols, i );
-            kpt = KDirectoryPathType ( wd
-                , "%.*s/%.*s%s%s"
-                , ( int ) vol -> size, vol -> addr
-                , ( int ) fname . size, fname . addr
-                , krypto_ext
-                , cache_ext
-            );
-
-            switch ( kpt & ~ kptAlias )
-            {
-            case kptFile:
-            case kptDir:
-                return VResolverAlgMakeLocalFilePath ( self, vol, & fname, krypto_ext, path );
-            default:
-                break;
-            }
-
-            if ( krypto_ext [ 0 ] != 0 )
-            {
-                kpt = KDirectoryPathType ( wd
-                    , "%.*s/%.*s%s"
-                    , ( int ) vol -> size, vol -> addr
-                    , ( int ) fname . size, fname . addr
-                    , cache_ext
-                );
-
-                switch ( kpt & ~ kptAlias )
-                {
-                case kptFile:
-                case kptDir:
-                    return VResolverAlgMakeLocalFilePath ( self, vol, & fname, "", path );
-                default:
-                    break;
-                }
-            }
-        }
-    }
-    else
-    {
-        for ( i = 0; i < count; ++ i )
-        {
-            vol = VectorGet ( & self -> vols, i );
-            kpt = KDirectoryPathType ( wd
-                , "%.*s/%.*s/%.*s%s%s"
-                , ( int ) root -> size, root -> addr
-                , ( int ) vol -> size, vol -> addr
-                , ( int ) fname . size, fname . addr
-                , krypto_ext
-                , cache_ext
-            );
-
-            switch ( kpt & ~ kptAlias )
-            {
-            case kptFile:
-            case kptDir:
-                return VResolverAlgMakeLocalFilePath ( self, vol, & fname, krypto_ext, path );
-            default:
-                break;
-            }
-
-            if ( krypto_ext [ 0 ] != 0 )
-            {
-                kpt = KDirectoryPathType ( wd
-                    , "%.*s/%.*s/%.*s%s"
-                    , ( int ) root -> size, root -> addr
-                    , ( int ) vol -> size, vol -> addr
-                    , ( int ) fname . size, fname . addr
-                    , cache_ext
-                );
-
-                switch ( kpt & ~ kptAlias )
-                {
-                case kptFile:
-                case kptDir:
-                    return VResolverAlgMakeLocalFilePath ( self, vol, & fname, "", path );
-                default:
-                    break;
-                }
-            }
-        }
-    }
-    
-    return RC ( rcVFS, rcResolver, rcResolving, rcName, rcNotFound );
-}
-
-static
-rc_t VPathCheckFromNamesCGI ( const VPath * path, const String *ticket, const VPath ** mapping )
-{
-    size_t i, size;
-    const char * start;
-
-    /* must have an explicit scheme */
-    if ( ! path -> from_uri )
-        return RC ( rcVFS, rcResolver, rcResolving, rcMessage, rcCorrupt );
-
-    /* can only be http or fasp */
-    switch ( path -> scheme_type )
-    {
-    case vpuri_http:
-    case vpuri_fasp:
-        break;
-    default:
-        return RC ( rcVFS, rcResolver, rcResolving, rcMessage, rcCorrupt );
-    }
-
-
-    /* must have a host-spec with all ascii-characters */
-    switch ( path -> host_type )
-    {
-    case vhDNSName:
-        if ( path -> host . size == 0 || path -> host . size != ( size_t ) path -> host . len )
-            return RC ( rcVFS, rcResolver, rcResolving, rcMessage, rcCorrupt );
-        start = path -> host . addr;
-        size = path -> host . size;
-        for ( i = 0; i < size; ++ i )
-        {
-            if ( isalnum ( start [ i ] ) )
-                continue;
-            switch ( start [ i ] )
-            {
-            case '.':
-            case '-':
-            case '_':
-                continue;
-            }
-            return RC ( rcVFS, rcResolver, rcResolving, rcMessage, rcCorrupt );
-        }
-        break;
-    case vhIPv4:
-    case vhIPv6:
-        break;
-    }
-
-    /* must have a full-path */
-    if ( path -> path_type != vpFullPath )
-        return RC ( rcVFS, rcResolver, rcResolving, rcMessage, rcCorrupt );
-    /* only ascii characters */
-    assert ( path -> path . size != 0 );
-    if ( path -> path . size != ( size_t ) path -> path . len )
-        return RC ( rcVFS, rcResolver, rcResolving, rcMessage, rcCorrupt );
-    start = path -> path . addr;
-    size = path -> path . size;
-    for ( i = 0; i < size; ++ i )
-    {
-        if ( isalnum ( start [ i ] ) )
-            continue;
-        switch ( start [ i ] )
-        {
-        case '/':
-        case '.':
-        case '-':
-        case '_':
-            continue;
-        }
-        return RC ( rcVFS, rcResolver, rcResolving, rcMessage, rcCorrupt );
-    }
-
-#if DO_NOT_USE_TIC_HACK
-    /* if the ticket was placed into the mapped path */
-    if ( mapping != NULL )
-        ticket = NULL;
-#endif
-
-    if ( path -> query . size != 0 )
-    {
-        String name, val, req;
-
-        /* query must match ticket */
-        if ( ticket == NULL )
-            return RC ( rcVFS, rcResolver, rcResolving, rcMessage, rcCorrupt );
-
-        StringSubstr ( & path -> query, & name, 0, 5 );
-        StringSubstr ( & path -> query, & val, 5, 0 );
-        if ( ! StringEqual ( & val, ticket ) )
-            return RC ( rcVFS, rcResolver, rcResolving, rcMessage, rcCorrupt );
-        CONST_STRING ( & req, "?tic=" );
-        if ( ! StringEqual ( & name, & req ) )
-            return RC ( rcVFS, rcResolver, rcResolving, rcMessage, rcCorrupt );
-    }
-
-#if DISALLOW_FRAGMENT
-    /* cannot have a fragment */
-    if ( path -> fragment . size != 0 )
-        return RC ( rcVFS, rcResolver, rcResolving, rcMessage, rcCorrupt );
-#endif
-
-    return 0;
-}
-
-
-/* ParseResolverCGIResponse_1_0
- *  expect single row table, with this structure:
- *
- *  <accession>|<download-ticket>|<url>|<result-code>|<message>
- */
-static
-rc_t VResolverAlgParseResolverCGIResponse_1_0 ( const char *start, size_t size,
-    const VPath ** path, const String *acc, const String *ticket )
-{
-    rc_t rc;
-    KLogLevel lvl;
-    char *rslt_end;
-    uint32_t result_code;
-
-    String accession, download_ticket, url, rslt_code, msg;
-
-    /* get accession */
-    const char *end = start + size;
-    const char *sep = string_chr ( start, size, '|' );
-    if ( sep == NULL )
-        return RC ( rcVFS, rcResolver, rcResolving, rcName, rcNotFound );
-    StringInit ( & accession, start, sep - start, ( uint32_t ) ( sep - start ) );
-
-    /* get download-ticket */
-    start = sep + 1;
-    sep = string_chr ( start, end - start, '|' );
-    if ( sep == NULL )
-        return RC ( rcVFS, rcResolver, rcResolving, rcName, rcNotFound );
-    StringInit ( & download_ticket, start, sep - start, ( uint32_t ) ( sep - start ) );
-
-    /* get url */
-    start = sep + 1;
-    sep = string_chr ( start, end - start, '|' );
-    if ( sep == NULL )
-        return RC ( rcVFS, rcResolver, rcResolving, rcName, rcNotFound );
-    StringInit ( & url, start, sep - start, ( uint32_t ) ( sep - start ) );
-
-    /* get result-code */
-    start = sep + 1;
-    sep = string_chr ( start, end - start, '|' );
-    if ( sep == NULL )
-        return RC ( rcVFS, rcResolver, rcResolving, rcName, rcNotFound );
-    StringInit ( & rslt_code, start, sep - start, ( uint32_t ) ( sep - start ) );
-
-    /* get msg */
-    start = sep + 1;
-    for ( sep = end; sep > start; -- sep )
-    {
-        switch ( sep [ -1 ] )
-        {
-        case '\n':
-        case '\r':
-            continue;
-        default:
-            break;
-        }
-
-        break;
-    }
-    StringInit ( & msg, start, sep - start, ( uint32_t ) ( sep - start ) );
-
-    /* compare acc to accession */
-    if ( ! StringEqual ( & accession, acc ) )
-        return RC ( rcVFS, rcResolver, rcResolving, rcMessage, rcCorrupt );
-
-    /* compare ticket
-       currently this makes sense with 1 request from a known workspace */
-    if ( download_ticket . size != 0 )
-    {
-        if ( ticket == NULL || ! StringEqual ( & download_ticket, ticket ) )
-            return RC ( rcVFS, rcResolver, rcResolving, rcMessage, rcCorrupt );
-    }
-
-    /* get the result code */
-    if ( rslt_code . size == 0 )
-        return RC ( rcVFS, rcResolver, rcResolving, rcMessage, rcCorrupt );
-    result_code = strtoul ( rslt_code . addr, & rslt_end, 10 );
-    if ( ( const char* ) rslt_end - rslt_code . addr != rslt_code . size )
-        return RC ( rcVFS, rcResolver, rcResolving, rcMessage, rcCorrupt );
-
-    /* still have to test the URL */    
-
-    switch ( result_code / 100 )
-    {
-    case 1:
-        /* informational response
-           not much we can do here */
-        lvl = klogInt;
-        rc = RC ( rcVFS, rcResolver, rcResolving, rcError, rcUnexpected );
-        break;
-
-    case 2:
-        /* successful response
-           but can only handle 200 */
-        if ( result_code == 200 )
-        {
-            /* normal public response */
-            if ( download_ticket . size == 0 )
-                rc = VPathMakeFmt ( ( VPath** ) path, "%S", & url );
-            else
-            {
-                /* protected response */
-                rc = VPathMakeFmt ( ( VPath** ) path, "%S?tic=%S", & url, & download_ticket );
-            }
-
-            if ( rc == 0 )
-            {
-                rc = VPathCheckFromNamesCGI ( * path, ticket, NULL );
-                if ( rc == 0 )
-                    return 0;
-
-                VPathRelease ( * path );
-                * path = NULL;
-            }
-
-            return rc;
-        }
-
-        lvl = klogInt;
-        rc = RC ( rcVFS, rcResolver, rcResolving, rcError, rcUnexpected );
-        break;
-
-    case 3:
-        /* redirection
-           currently this is being handled by our request object */
-        lvl = klogInt;
-        rc = RC ( rcVFS, rcResolver, rcResolving, rcError, rcUnexpected );
-        break;
-
-    case 4:
-        /* client error */
-        lvl = klogErr;
-        switch ( result_code )
-        {
-        case 400:
-            rc = RC ( rcVFS, rcResolver, rcResolving, rcMessage, rcInvalid );
-            break;
-        case 401:
-        case 403:
-            rc = RC ( rcVFS, rcResolver, rcResolving, rcQuery, rcUnauthorized );
-            break;
-        case 404:
-            return RC ( rcVFS, rcResolver, rcResolving, rcName, rcNotFound );
-        case 410:
-            rc = RC ( rcVFS, rcResolver, rcResolving, rcName, rcNotFound );
-            break;
-        default:
-            rc = RC ( rcVFS, rcResolver, rcResolving, rcError, rcUnexpected );
-        }
-        break;
-
-    case 5:
-        /* server error */
-        lvl = klogSys;
-        switch ( result_code )
-        {
-        case 503:
-            rc = RC ( rcVFS, rcResolver, rcResolving, rcDatabase, rcNotAvailable );
-            break;
-        case 504:
-            rc = RC ( rcVFS, rcResolver, rcResolving, rcTimeout, rcExhausted );
-            break;
-        default:
-            rc = RC ( rcVFS, rcResolver, rcResolving, rcError, rcUnexpected );
-        }
-        break;
-
-    default:
-        lvl = klogInt;
-        rc = RC ( rcVFS, rcResolver, rcResolving, rcError, rcUnexpected );
-    }
-
-    /* log message to user */
-    PLOGERR ( lvl, ( lvl, rc, "failed to resolve accession '$(acc)' - $(msg) ( $(code) )",
-        "acc=%S,msg=%S,code=%u", acc, & msg, result_code ) );
-    return rc;
-}
-
-
-/* ParseResolverCGIResponse_1_1
- *  expect single row table, with this structure (SRA-1690) :
- *
- *  <accession>|obj-id|name|size|mod-date|md5|<download-ticket>|<url>|<result-code>|<message>
- */
-static
-rc_t VResolverAlgParseResolverCGIResponse_1_1 ( const char *astart, size_t size,
-    const VPath ** path, const VPath ** mapping, const String *acc,
-    const String *ticket, bool *canRetry )
-{
-    const char *start = astart;
-    rc_t rc;
-    KLogLevel lvl;
-    char *rslt_end;
-    uint32_t result_code;
-
-    String accession, obj_id, name, size_str, mod_date, md5, download_ticket, url, rslt_code, msg;
-
-    /* get accession */
-    const char *end = start + size;
-    const char *sep = string_chr ( start, size, '|' );
-    if ( sep == NULL )
-        return RC ( rcVFS, rcResolver, rcResolving, rcName, rcNotFound );
-    StringInit ( & accession, start, sep - start, ( uint32_t ) ( sep - start ) );
-
-    /* get obj-id */
-    start = sep + 1;
-    sep = string_chr ( start, end - start, '|' );
-    if ( sep == NULL )
-        return RC ( rcVFS, rcResolver, rcResolving, rcName, rcNotFound );
-    StringInit ( & obj_id, start, sep - start, ( uint32_t ) ( sep - start ) );
-
-    /* get name */
-    start = sep + 1;
-    sep = string_chr ( start, end - start, '|' );
-    if ( sep == NULL )
-        return RC ( rcVFS, rcResolver, rcResolving, rcName, rcNotFound );
-    StringInit ( & name, start, sep - start, ( uint32_t ) ( sep - start ) );
-
-    /* get size */
-    start = sep + 1;
-    sep = string_chr ( start, end - start, '|' );
-    if ( sep == NULL )
-        return RC ( rcVFS, rcResolver, rcResolving, rcName, rcNotFound );
-    StringInit ( & size_str, start, sep - start, ( uint32_t ) ( sep - start ) );
-
-    /* get mod-date */
-    start = sep + 1;
-    sep = string_chr ( start, end - start, '|' );
-    if ( sep == NULL )
-        return RC ( rcVFS, rcResolver, rcResolving, rcName, rcNotFound );
-    StringInit ( & mod_date, start, sep - start, ( uint32_t ) ( sep - start ) );
-
-    /* get md5 */
-    start = sep + 1;
-    sep = string_chr ( start, end - start, '|' );
-    if ( sep == NULL )
-        return RC ( rcVFS, rcResolver, rcResolving, rcName, rcNotFound );
-    StringInit ( & md5, start, sep - start, ( uint32_t ) ( sep - start ) );
-
-    /* get download-ticket */
-    start = sep + 1;
-    sep = string_chr ( start, end - start, '|' );
-    if ( sep == NULL )
-        return RC ( rcVFS, rcResolver, rcResolving, rcName, rcNotFound );
-    StringInit ( & download_ticket, start, sep - start, ( uint32_t ) ( sep - start ) );
-
-    /* get url */
-    start = sep + 1;
-    sep = string_chr ( start, end - start, '|' );
-    if ( sep == NULL )
-        return RC ( rcVFS, rcResolver, rcResolving, rcName, rcNotFound );
-    StringInit ( & url, start, sep - start, ( uint32_t ) ( sep - start ) );
-
-    /* get result-code */
-    start = sep + 1;
-    sep = string_chr ( start, end - start, '|' );
-    if ( sep == NULL )
-        return RC ( rcVFS, rcResolver, rcResolving, rcName, rcNotFound );
-    StringInit ( & rslt_code, start, sep - start, ( uint32_t ) ( sep - start ) );
-
-    /* get msg */
-    start = sep + 1;
-    for ( sep = end; sep > start; -- sep )
-    {
-        switch ( sep [ -1 ] )
-        {
-        case '\n':
-        case '\r':
-            continue;
-        default:
-            break;
-        }
-
-        break;
-    }
-    StringInit ( & msg, start, sep - start, ( uint32_t ) ( sep - start ) );
-
-    /* compare acc to accession or obj_id */
-    if ( ! StringEqual ( & accession, acc ) && ! StringEqual ( & obj_id, acc ) ) {
-        DBGMSG(DBG_KNS, DBG_FLAG(DBG_KNS_ERR), (
-            "@@@@@@@@2 %%s:%s:%d: %s"
-                "\n", __FILE__, __FUNCTION__, __LINE__, astart));
-        return RC ( rcVFS, rcResolver, rcResolving, rcMessage, rcCorrupt );
-    }
-
-    /* compare ticket
-       currently this makes sense with 1 request from a known workspace */
-    if ( download_ticket . size != 0 )
-    {
-        if ( ticket == NULL || ! StringEqual ( & download_ticket, ticket ) )
-            return RC ( rcVFS, rcResolver, rcResolving, rcMessage, rcCorrupt );
-    }
-
-    /* get the result code */
-    if ( rslt_code . size == 0 )
-        return RC ( rcVFS, rcResolver, rcResolving, rcMessage, rcCorrupt );
-    result_code = strtoul ( rslt_code . addr, & rslt_end, 10 );
-    if ( ( const char* ) rslt_end - rslt_code . addr != rslt_code . size )
-        return RC ( rcVFS, rcResolver, rcResolving, rcMessage, rcCorrupt );
-
-    /* still have to test the URL */    
-
-    switch ( result_code / 100 )
-    {
-    case 1:
-        /* informational response
-           not much we can do here */
-        lvl = klogInt;
-        rc = RC ( rcVFS, rcResolver, rcResolving, rcError, rcUnexpected );
-        break;
-
-    case 2:
-        /* successful response
-           but can only handle 200 */
-        if ( result_code == 200 )
-        {
-            /* normal public response */
-            if ( download_ticket . size == 0
-#if DO_NOT_USE_TIC_HACK
-                 || mapping != NULL
-#endif
-                )
-            {
-                rc = VPathMakeFmt ( ( VPath** ) path, "%S", & url );
-            }
-            else
-            {
-                /* protected response */
-                rc = VPathMakeFmt ( ( VPath** ) path, "%S?tic=%S", & url, & download_ticket );
-            }
-
-            if ( rc == 0 )
-            {
-                rc = VPathCheckFromNamesCGI ( * path, ticket, mapping );
-                if ( rc == 0 )
-                {
-                    if ( mapping == NULL )
-                        return 0;
-
-                    if ( download_ticket . size != 0 )
-                    {
-                        if ( accession . size != 0 )
-                            rc = VPathMakeFmt ( ( VPath** ) mapping, "ncbi-acc:%S?tic=%S", & accession, & download_ticket );
-                        else if ( name . size == 0 )
-                            return 0;
-                        else
-                            rc = VPathMakeFmt ( ( VPath** ) mapping, "ncbi-file:%S?tic=%S", & name, & download_ticket );
-                    }
-                    else if ( accession . size != 0 )
-                        rc = VPathMakeFmt ( ( VPath** ) mapping, "ncbi-acc:%S", & accession );
-                    else if ( name . size == 0 )
-                        return 0;
-                    else
-                        rc = VPathMakeFmt ( ( VPath** ) mapping, "ncbi-file:%S", & name );
-
-                    if ( rc == 0 )
-                        return 0;
-                }
-
-                VPathRelease ( * path );
-                * path = NULL;
-            }
-
-            return rc;
-        }
-
-        lvl = klogInt;
-        rc = RC ( rcVFS, rcResolver, rcResolving, rcError, rcUnexpected );
-        break;
-
-    case 3:
-        /* redirection
-           currently this is being handled by our request object */
-        lvl = klogInt;
-        rc = RC ( rcVFS, rcResolver, rcResolving, rcError, rcUnexpected );
-        break;
-
-    case 4:
-        /* client error */
-        lvl = klogErr;
-        switch ( result_code )
-        {
-        case 400:
-            rc = RC ( rcVFS, rcResolver, rcResolving, rcMessage, rcInvalid );
-            break;
-        case 401:
-        case 403:
-            rc = RC ( rcVFS, rcResolver, rcResolving, rcQuery, rcUnauthorized );
-            break;
-        case 404:
-            assert(canRetry);
-            *canRetry = false;
-            return RC ( rcVFS, rcResolver, rcResolving, rcName, rcNotFound );
-        case 410:
-            rc = RC ( rcVFS, rcResolver, rcResolving, rcName, rcNotFound );
-            break;
-        default:
-            rc = RC ( rcVFS, rcResolver, rcResolving, rcError, rcUnexpected );
-        }
-        break;
-
-    case 5:
-        /* server error */
-        lvl = klogSys;
-        switch ( result_code )
-        {
-        case 503:
-            rc = RC ( rcVFS, rcResolver, rcResolving, rcDatabase, rcNotAvailable );
-            break;
-        case 504:
-            rc = RC ( rcVFS, rcResolver, rcResolving, rcTimeout, rcExhausted );
-            break;
-        default:
-            rc = RC ( rcVFS, rcResolver, rcResolving, rcError, rcUnexpected );
-        }
-        break;
-
-    default:
-        lvl = klogInt;
-        rc = RC ( rcVFS, rcResolver, rcResolving, rcError, rcUnexpected );
-    }
-
-    /* log message to user */
-    PLOGERR ( lvl, ( lvl, rc, "failed to resolve accession '$(acc)' - $(msg) ( $(code) )",
-        "acc=%S,msg=%S,code=%u", acc, & msg, result_code ) );
-    return rc;
-}
-
-
-/* ParseResolverCGIResponse
- *  the response should be NUL terminated
- *  but should also be close to the size of result
- */
-static
-rc_t VResolverAlgParseResolverCGIResponse ( const KDataBuffer *result,
-    const VPath ** path, const VPath ** mapping, const String *acc,
-    const String *ticket, bool * canRetry )
-{
-    /* the textual response */
-    const char *start = ( const void* ) result -> base;
-    size_t i, size = KDataBufferBytes ( result );
-
-    DBGMSG(DBG_VFS, DBG_FLAG(DBG_VFS), (" Response = %s\n", start));
-
-    /* peel back buffer to significant bytes */
-    while ( size > 0 && start [ size - 1 ] == 0 )
-        -- size;
-
-    /* skip over blanks */
-    for ( i = 0; i < size; ++ i )
-    {
-        if ( ! isspace ( start [ i ] ) )
-            break;
-    }
-
-    /* at this point, we expect only version 1.0 ... */
-    if ( string_cmp ( & start [ i ], size - i, "#1.0", sizeof "#1.0" - 1, sizeof "#1.0" - 1 ) == 0 )
-    {
-        do
-        {
-            /* accept version line */
-            i += sizeof "#1.0" - 1;
-
-            /* must be followed by eoln */
-            if ( start [ i ] == '\r' && start [ i + 1 ] == '\n' )
-                i += 2;
-            else if ( start [ i ] == '\n' )
-                i += 1;
-            else
-                break;
-
-            /* parse 1.0 response table */
-            return VResolverAlgParseResolverCGIResponse_1_0 ( & start [ i ], size - i, path, acc, ticket );
-        }
-        while ( false );
-    }
-
-    /* ... and 1.1 */
-    if ( string_cmp ( & start [ i ], size - i, "#1.1", sizeof "#1.1" - 1, sizeof "#1.1" - 1 ) == 0 )
-    {
-        do
-        {
-            /* accept version line */
-            i += sizeof "#1.1" - 1;
-
-            /* must be followed by eoln */
-            if ( start [ i ] == '\r' && start [ i + 1 ] == '\n' )
-                i += 2;
-            else if ( start [ i ] == '\n' )
-                i += 1;
-            else
-                break;
-
-            /* parse 1.0 response table */
-            return VResolverAlgParseResolverCGIResponse_1_1 ( & start [ i ],
-                size - i, path, mapping, acc, ticket, canRetry );
-        }
-        while ( false );
-    }
-
-    return RC ( rcVFS, rcResolver, rcResolving, rcName, rcNotFound );
-}
-
-/* RemoteProtectedResolve
- *  use NCBI CGI to resolve accession into URL
- */
-static
-rc_t VResolverAlgRemoteProtectedResolveImpl ( const VResolverAlg *self,
-    const KNSManager *kns, VRemoteProtocols protocols, const String *acc,
-    const VPath ** path, const VPath ** mapping, bool legacy_wgs_refseq,
-    bool *canRetry )
-{
-    rc_t rc;
-    KHttpRequest *req;
-
-    assert(path && canRetry);
-    *canRetry = true;
-
-    DBGMSG(DBG_VFS, DBG_FLAG(DBG_VFS), ("names.cgi = %S\n", self -> root));
-    rc = KNSManagerMakeRequest ( kns, & req, 0x01000000, NULL, self -> root -> addr );
-    if ( rc == 0 )
-    {
-        /* build up POST information: */
-        DBGMSG(DBG_VFS, DBG_FLAG(DBG_VFS), ("  version = %u.%u\n",
-            NAME_SERVICE_MAJ_VERS, NAME_SERVICE_MIN_VERS));
-        rc = KHttpRequestAddPostParam ( req, "version=%u.%u",
-            NAME_SERVICE_MAJ_VERS, NAME_SERVICE_MIN_VERS );
-        if ( rc == 0 )
-        {
-            DBGMSG(DBG_VFS, DBG_FLAG(DBG_VFS), ("  acc = %S\n", acc));
-            rc = KHttpRequestAddPostParam ( req, "acc=%S", acc ); 
-        }
-        if ( rc == 0 && legacy_wgs_refseq )
-        {
-            DBGMSG(DBG_VFS, DBG_FLAG(DBG_VFS), ("  ctx = refseq\n"));
-            rc = KHttpRequestAddPostParam ( req, "ctx=refseq" );
-        }
-        if ( rc == 0 && self -> ticket != NULL )
-        {
-            DBGMSG(DBG_VFS, DBG_FLAG(DBG_VFS), ("  tic = %S\n", self -> ticket));
-            rc = KHttpRequestAddPostParam ( req, "tic=%S", self -> ticket );
-        }
-#if NAME_SERVICE_VERS >= ONE_DOT_ONE /* SRA-1690 */
-        if ( rc == 0 )
-        {
-            const char *val;
-            switch ( protocols )
-            {
-            case eProtocolHttp:
-                val = "http";
-                break;
-            case eProtocolFasp:
-                val = "fasp";
-                break;
-            case eProtocolFaspHttp:
-                val = "fasp,http";
-                break;
-            case eProtocolHttpFasp:
-                val = "http,fasp";
-                break;
-            default:
-                val = NULL;
-                rc = RC ( rcVFS, rcResolver, rcResolving, rcParam, rcInvalid );
-            }
-
-            if ( rc == 0 )
-            {
-                DBGMSG(DBG_VFS, DBG_FLAG ( DBG_VFS ), ("  accept-proto = %s\n", val ) );
-                rc = KHttpRequestAddPostParam ( req, "accept-proto=%s", val );
-            }
-        }
-#endif
-
-        if ( rc == 0 )
-        {
-            KHttpResult *rslt;
-            
-            rc = KHttpRequestPOST ( req, &rslt );
-            if ( rc == 0 )
-            {
-                uint32_t code;
-
-                *canRetry = false;
-
-                rc = KHttpResultStatus ( rslt, &code, NULL, 0, NULL );
-                if ( code == 200 )
-                {
-                    KStream *response;
-                    
-                    rc = KHttpResultGetInputStream ( rslt, &response );
-                    if ( rc == 0 )
-                    {
-                        size_t num_read;
-                        size_t total = 0;
-                        
-                        KDataBuffer result;
-                        memset ( & result, 0, sizeof result );
-                        KDataBufferMakeBytes ( & result, 4096 );
-
-                        while ( 1 )
-                        {
-                            uint8_t *base;
-                            uint64_t avail = result . elem_count - total;
-                            if ( avail < 256 )
-                            {
-                                rc = KDataBufferResize ( & result, result . elem_count + 4096 );
-                                if ( rc != 0 )
-                                    break;
-                            }
-                            
-                            base = result . base;
-                            rc = KStreamRead ( response, & base [ total ], result . elem_count - total, & num_read );
-                            if ( rc != 0 )
-                            {
-                                /* TBD - look more closely at rc */
-                                if ( num_read > 0 )
-                                    rc = 0;
-                                else
-                                    break;
-                            }
-
-                            if ( num_read == 0 )
-                                break;
-
-                            total += num_read;
-                        }
-
-                        if ( rc == 0 )
-                        {
-                            result.elem_count = total;
-
-                            rc = VResolverAlgParseResolverCGIResponse(&result,
-                                path, mapping, acc, self->ticket, canRetry);
-                            KDataBufferWhack ( &result );
-                        }
-
-                        KStreamRelease ( response );
-                    }
-                }
-                KHttpResultRelease ( rslt );
-            }
-        }
-        KHttpRequestRelease ( req );
-    }
-
-    assert(*path != NULL || rc != 0);
-
-    if (rc == 0 && *path == NULL) {
-        *canRetry = true;
-        rc = RC(rcVFS, rcResolver, rcResolving, rcName, rcNull);
-    }
-
-    return rc;
-}
-
-static rc_t VResolverAlgRemoteProtectedResolve ( const VResolverAlg *self,
-    const KNSManager *kns, VRemoteProtocols protocols, const String *acc,
-    const VPath ** path, const VPath ** mapping, bool legacy_wgs_refseq )
-{
-    rc_t rc = 0;
-    int i = 0, retryOnFailure = 3;
-    for (i = 0; i < retryOnFailure; ++i) {
-        bool canRetry = false;
-        rc = VResolverAlgRemoteProtectedResolveImpl(self, kns, protocols,
-            acc, path, mapping, legacy_wgs_refseq, &canRetry);
-        if (rc == 0) {
-            break;
-        }
-        if (!canRetry) {
-            DBGMSG(DBG_KNS, DBG_FLAG(DBG_KNS_ERR), (
-"@@@@@@@@2 %s: VResolverAlgRemoteProtectedResolveImpl %d/%d = cannot retry = %R"
-                "\n", __FUNCTION__, i + 1, retryOnFailure, rc));
-            break;
-        }
-        DBGMSG(DBG_KNS, DBG_FLAG(DBG_KNS_ERR), (
-"@@@@@@@@2 %s: VResolverAlgRemoteProtectedResolveImpl %d/%d = can retry = %R"
-            "\n", __FUNCTION__, i + 1, retryOnFailure, rc));
-    }
-
-    if (rc != 0) {
-        DBGMSG(DBG_KNS, DBG_FLAG(DBG_KNS_ERR), (
-            "@@@@@@@@2 %s: returning %R\n", __FUNCTION__, rc));
-    }
-
-    return rc == 0 ? 0 : RC(rcVFS, rcResolver, rcResolving, rcName, rcNotFound);
-}    
-
-/* RemoteResolve
- *  resolve an accession into a VPath or not found
- *
- *  1. expand accession according to algorithm
- *  2. search all volumes for accession
- *  3. return not found or new VPath
- */
-static
-rc_t VResolverAlgRemoteResolve ( const VResolverAlg *self,
-    const KNSManager *kns, VRemoteProtocols protocols, const VResolverAccToken *tok,
-    const VPath ** path, const VPath ** mapping, const KFile ** opt_file_rtn, bool legacy_wgs_refseq )
-{
-    rc_t rc;
-    uint32_t i, count;
-
-    /* expanded accession */
-    String exp;
-    size_t size;
-    char expanded [ 256 ];
-
-    const String *root;
-
-    /* check for download ticket */
-    if ( self -> alg_id == algCGI
-#if NO_LEGACY_WGS_REFSEQ_CGI
-         && ! legacy_wgs_refseq
-#endif
-        )
-    {
-        rc = VResolverAlgRemoteProtectedResolve ( self,
-            kns, protocols, & tok -> acc, path, mapping, legacy_wgs_refseq );
-
-        if (rc == 0 && path != NULL && *path != NULL &&
-            opt_file_rtn != NULL && *opt_file_rtn == NULL &&
-            VPathGetUri_t ( * path ) != vpuri_fasp )
-        {
-            const String *s = NULL;
-            rc_t rc = VPathMakeString(*path, &s);
-            if (rc != 0)
-            {
-                LOGERR(klogInt, rc,
-                    "failed to make string from remote protected path");
-            }
-            else
-            {
-                rc = KNSManagerMakeHttpFile ( kns, opt_file_rtn, NULL, 0x01010000, "%S", s );
-                if (rc != 0)
-                {
-                    PLOGERR(klogInt, (klogInt, rc,
-                        "failed to open file for $(path)", "path=%s", s->addr));
-                }
-                StringWhack ( s );
-            }
-        }
-        return rc;
-    }
-
-    /* for remote, root can never be NULL */
-    root = self -> root;
-
-    /* expand the accession */
-    rc = expand_algorithm ( self, tok, expanded, sizeof expanded, & size, legacy_wgs_refseq );
-
-    /* should never have a problem here... */
-    if ( rc != 0 )
-        return rc;
-
-    /* turn the expanded portion into a String
-       we know that size is also length due to
-       accession content rules */
-    StringInit ( & exp, expanded, size, ( uint32_t ) size );
-
-    /* now search all remote volumes */
-    count = VectorLength ( & self -> vols );
-    for ( i = 0; i < count; ++ i )
-    {
-        char url [ 8192 ];
-        const String *vol = VectorGet ( & self -> vols, i );
-        rc = string_printf ( url, sizeof url, NULL, "%S/%S/%S", root, vol, & exp );
-        if ( rc == 0 )
-        {
-            const KFile *f;
-#if USE_CURL
-            rc = KCurlFileMake ( & f, url, false );
-#else
-            rc = KNSManagerMakeHttpFile ( kns, & f, NULL, 0x01010000, url );
-#endif
-            if ( rc == 0 )
-            {
-                if ( opt_file_rtn != NULL )
-                    * opt_file_rtn = f;
-                else
-                    KFileRelease ( f );
-
-                if ( legacy_wgs_refseq )
-                    return VResolverAlgMakeRemoteWGSRefseqURI ( self, url, & tok -> acc, path );
-                return VResolverAlgMakeRemotePath ( self, url, path );
-            }
-        }
-    }
-    
-    return RC ( rcVFS, rcResolver, rcResolving, rcName, rcNotFound );
-}
-
-
-/* CacheResolve
- *  try to resolve accession for currently cached file
- */
-static
-rc_t VResolverAlgCacheResolve ( const VResolverAlg *self,
-    const KDirectory *wd, const VResolverAccToken *tok,
-    const VPath ** path, bool legacy_wgs_refseq )
-{
-    /* see if the cache file already exists */
-    const bool for_cache = true;
-    rc_t rc = VResolverAlgLocalResolve ( self, wd, tok, path, legacy_wgs_refseq, for_cache );
-    if ( rc == 0 )
-        return 0;
-
-    /* TBD - see if any of these volumes is a good candidate for creating a file */
-
-    return RC ( rcVFS, rcResolver, rcResolving, rcName, rcNotFound );
-}
-
-
-/* CacheFile
- *  try to resolve name for currently cached file
- */
-static
-rc_t VResolverAlgCacheFile ( const VResolverAlg *self,
-    const KDirectory *wd, const VPath *query, const VPath ** path )
-{
-    /* see if the cache file already exists */
-    const bool for_cache = true;
-    rc_t rc = VResolverAlgLocalFile ( self, wd, query, path, for_cache );
-    if ( rc == 0 )
-        return 0;
-
-    /* TBD - see if any of these volumes is a good candidate for creating a file */
-
-    return RC ( rcVFS, rcResolver, rcResolving, rcName, rcNotFound );
-}
-
-
-
-/* MakeCachePath
- *  we have an accession that matches this volume
- *  create a path for it
- */
-static
-rc_t VResolverAlgMakeCachePath ( const VResolverAlg *self,
-    const VResolverAccToken *tok, const VPath ** path, bool legacy_wgs_refseq )
-{
-    uint32_t i, count;
-
-    /* expanded accession */
-    String exp;
-    size_t size;
-    char expanded [ 256 ];
-
-    const String *vol;
-
-    /* expand the accession */
-    rc_t rc = expand_algorithm ( self, tok, expanded, sizeof expanded, & size, legacy_wgs_refseq );
-
-    /* should never have a problem here... */
-    if ( rc != 0 )
-        return rc;
-
-    /* turn the expanded portion into a String
-       we know that size is also length due to
-       accession content rules */
-    StringInit ( & exp, expanded, size, ( uint32_t ) size );
-
-    /* now search all volumes */
-    count = VectorLength ( & self -> vols );
-    for ( i = 0; i < count; ++ i )
-    {
-        vol = VectorGet ( & self -> vols, i );
-        return VResolverAlgMakeLocalPath ( self, vol, & exp, path );
-    }
-    
-    return RC ( rcVFS, rcResolver, rcResolving, rcPath, rcNotFound );
-}
-
-
-/* MakeCacheFilePath
- *  we have a filename that matches this volume
- *  create a path for it
- */
-static
-rc_t VResolverAlgMakeCacheFilePath ( const VResolverAlg *self,
-    const VPath *query, const VPath ** path )
-{
-    String fname = query -> path;
-
-    /* needs proper extension for krypto */
-    const char * krypto_ext = self -> protected ? ".ncbi_enc" : "";
-
-    /* now search all volumes */
-    uint32_t i, count = VectorLength ( & self -> vols );
-    for ( i = 0; i < count; ++ i )
-    {
-        const String *vol = VectorGet ( & self -> vols, i );
-        return VResolverAlgMakeLocalFilePath ( self, vol, & fname, krypto_ext, path );
-    }
-    
-    return RC ( rcVFS, rcResolver, rcResolving, rcPath, rcNotFound );
-}
-
-
-
-/*--------------------------------------------------------------------------
- * VResolver
- */
-struct VResolver
-{
-    /* root paths - stored as String* */
-    Vector roots;
-
-    /* volume algorithms - stored as VResolverAlg* */
-    Vector local;
-    Vector remote;
-
-    /* working directory for testing local paths */
-    const KDirectory *wd;
-
-    /* if there is a protected remote resolver,
-       we will need a KNS manager */
-    const KNSManager *kns;
-
-    /* if there is a working protected repository,
-       store the download ticket here */
-    const String *ticket;
-
-    KRefcount refcount;
-
-    /* counters for various app volumes */
-    uint32_t num_app_vols [ appCount ];
-
-    /* preferred protocols preferences. Default: HTTP */
-    VRemoteProtocols protocols;
-};
-
-
-/* "process" global settings
- *  actually, they are library-closure global
- */
-static atomic32_t enable_local, enable_remote, enable_cache;
-
-
-/* Whack
- */
-static
-rc_t VResolverWhack ( VResolver *self )
-{
-    KRefcountWhack ( & self -> refcount, "VResolver" );
-
-    /* drop all remote volume sets */
-    VectorWhack ( & self -> remote, VResolverAlgWhack, NULL );
-
-    /* drop local volume sets */
-    VectorWhack ( & self -> local, VResolverAlgWhack, NULL );
-
-    /* drop download ticket */
-    if ( self -> ticket != NULL )
-        StringWhack ( ( String* ) self -> ticket );
-
-    /* drop root paths */
-    VectorWhack ( & self -> roots, string_whack, NULL );
-
-    /* release kns */
-    if ( self -> kns != NULL )
-        KNSManagerRelease ( self -> kns );
-
-    /* release directory onto local file system */
-    KDirectoryRelease ( self -> wd );
-
-    free ( self );
-    return 0;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT
-rc_t CC VResolverAddRef ( const VResolver * self )
-{
-    if ( self != NULL )
-    {
-        switch ( KRefcountAdd ( & self -> refcount, "VResolver" ) )
-        {
-        case krefOkay:
-            break;
-        case krefZero:
-            return RC ( rcVFS, rcResolver, rcAttaching, rcRefcount, rcIncorrect );
-        case krefLimit:
-            return RC ( rcVFS, rcResolver, rcAttaching, rcRefcount, rcExhausted );
-        case krefNegative:
-            return RC ( rcVFS, rcResolver, rcAttaching, rcRefcount, rcInvalid );
-        default:
-            return RC ( rcVFS, rcResolver, rcAttaching, rcRefcount, rcUnknown );
-        }
-    }
-    return 0;
-}
-
-LIB_EXPORT
-rc_t CC VResolverRelease ( const VResolver * self )
-{
-    rc_t rc = 0;
-    if ( self != NULL )
-    {
-        switch ( KRefcountDrop ( & self -> refcount, "VResolver" ) )
-        {
-        case krefOkay:
-        case krefZero:
-            break;
-        case krefWhack:
-            VResolverWhack ( ( VResolver* ) self );
-            break;
-        case krefNegative:
-            return RC ( rcVFS, rcResolver, rcAttaching, rcRefcount, rcInvalid );
-        default:
-            rc = RC ( rcVFS, rcResolver, rcAttaching, rcRefcount, rcUnknown );
-            break;            
-        }
-    }
-    return rc;
-}
-
-
-/* get_accession_code
- */
-static
-uint32_t get_accession_code ( const String * accession, VResolverAccToken *tok )
-{
-#if USE_VPATH_OPTIONS_STRINGS
-#error this thing is wrong
-#else
-
-#define MAX_ACCESSION_LEN 20
-
-    uint32_t code;
-
-    const char *acc = accession -> addr;
-    size_t i, size = accession -> size;
-
-    /* capture the whole accession */
-    tok -> acc = * accession;
-
-    /* scan prefix or alpha */
-    for ( i = 0; i < size; ++ i )
-    {
-        if ( ! isalpha ( acc [ i ] ) )
-            break;
-    }
-
-    /* terrible situation - unrecognizable */
-    if ( i == size || i == 0 || i >= MAX_ACCESSION_LEN )
-    {
-        StringInit ( & tok -> prefix, acc, 0, 0 );
-        StringInit ( & tok -> alpha, acc, i, (uint32_t)i );
-        StringInit ( & tok -> digits, & acc [ i ], 0, 0 );
-        tok -> ext1 = tok -> ext2 = tok -> suffix = tok -> digits;
-        return 0;
-    }
-
-    /* if stopped on '_', we have a prefix */
-    if ( acc [ i ] == '_' )
-    {
-        /* prefix
-           store only its presence, not length */
-        code = 1 << 4 * 4;
-        StringInit ( & tok -> prefix, acc, i, (uint32_t)i );
-
-        /* remove prefix */
-        acc += ++ i;
-        size -= i;
-
-        /* scan for alpha */
-        for ( i = 0; i < size; ++ i )
-        {
-            if ( ! isalpha ( acc [ i ] ) )
-                break;
-        }
-
-        if ( i == size || i >= MAX_ACCESSION_LEN )
-        {
-            StringInit ( & tok -> alpha, acc, i, (uint32_t)i );
-            StringInit ( & tok -> digits, & acc [ i ], 0, 0 );
-            tok -> ext1 = tok -> ext2 = tok -> suffix = tok -> digits;
-            return 0;
-        }
-
-        code |= i << 4 * 3;
-        StringInit ( & tok -> alpha, acc, i, (uint32_t)i );
-    }
-    else if ( ! isdigit ( acc [ i ] ) )
-    {
-        StringInit ( & tok -> prefix, acc, 0, 0 );
-        StringInit ( & tok -> alpha, acc, i, (uint32_t)i );
-        StringInit ( & tok -> digits, & acc [ i ], 0, 0 );
-        tok -> ext1 = tok -> ext2 = tok -> suffix = tok -> digits;
-        return 0;
-    }
-    else
-    {
-        /* alpha */
-        code = (uint32_t) ( i << 4 * 3 );
-        StringInit ( & tok -> prefix, acc, 0, 0 );
-        StringInit ( & tok -> alpha, acc, i, (uint32_t)i );
-    }
-
-    /* remove alpha */
-    acc += i;
-    size -= i;
-
-    /* scan digits */
-    for ( i = 0; i < size; ++ i )
-    {
-        if ( ! isdigit ( acc [ i ] ) )
-            break;
-    }
-
-    /* record digits */
-    StringInit ( & tok -> digits, acc, i, (uint32_t)i );
-    StringInit ( & tok -> ext1, & acc [ i ], 0, 0 );
-    tok -> ext2 = tok -> suffix = tok -> ext1;
-
-    if ( i == 0 || i >= MAX_ACCESSION_LEN )
-        return 0;
-
-    code |= i << 4 * 2;
-
-    /* normal return point for SRA */
-    if ( i == size )
-        return code;
-
-    /* check for extension */
-    if ( acc [ i ] != '.' )
-        return 0;
-
-    /* remove digit */
-    acc += ++ i;
-    size -= i;
-
-    /* scan numeric extension */
-    for ( i = 0; i < size; ++ i )
-    {
-        if ( ! isdigit ( acc [ i ] ) )
-            break;
-    }
-
-    if ( i == 0 || i >= MAX_ACCESSION_LEN )
-        return 0;
-
-    /* record the actual extension */
-    StringInit ( & tok -> ext1, acc, i, (uint32_t)i );
-    /* codify the extension simply as present, not by its length */
-    code |= 1 << 4 * 1;
-
-    if ( i == size )
-        return code;
-
-    /* scan for suffix */
-    if ( acc [ i ] == '_' )
-    {
-        acc += ++ i;
-        size -= i;
-        for ( i = 0; i < size; ++ i )
-        {
-            if ( ! isalpha ( acc [ i ] ) )
-                break;
-        }
-
-        /* this has to end the whole thing */
-        if ( i == 0 || i != size )
-            return 0;
-
-        StringInit ( & tok -> suffix, acc, i, (uint32_t)i );
-        /* NB - not incorporating suffix into code right now */
-        return code;
-    }
-
-    if ( acc [ i ] != '.' )
-        return 0;
-
-
-    /* remove first extension */
-    acc += ++ i;
-    size -= i;
-
-    /* scan 2nd numeric extension */
-    for ( i = 0; i < size; ++ i )
-    {
-        if ( ! isdigit ( acc [ i ] ) )
-            break;
-    }
-
-    if ( i == 0 || i >= MAX_ACCESSION_LEN )
-        return 0;
-
-    StringInit ( & tok -> ext2, acc, i, (uint32_t)i );
-    code |= 1 << 4 * 0;
-
-    if ( i == size )
-        return code;
-
-    /* no other patterns are accepted */
-    return 0;
-#endif
-}
-
-
-/* get_accession_app
- */
-static
-VResolverAppID get_accession_app ( const String * accession, bool refseq_ctx,
-    VResolverAccToken *tok, bool *legacy_wgs_refseq )
-{
-    VResolverAppID app;
-    uint32_t code = get_accession_code ( accession, tok );
-
-    if (accession != NULL &&
-        accession->addr != NULL && isdigit(accession->addr[0]))
-    {
-        /* TODO: KART */
-        return appAny;
-    }
-
-    /* disregard extensions at this point */
-    switch ( code >> 4 * 2 )
-    {
-    case 0x015: /* e.g. "J01415" or "J01415.2"     */
-    case 0x026: /* e.g. "CM000071" or "CM000039.2" */
-    case 0x126: /* e.g. "NZ_DS995509.1"            */
-        app = appREFSEQ;
-        break;
-
-    case 0x036: /* e.g. "SRR012345"    */
-    case 0x037: /* e.g. "SRR0123456"   */
-    case 0x038: /* e.g. "SRR01234567"  */
-    case 0x039: /* e.g. "SRR012345678" */
-
-        /* detect accession with extension */
-        if ( ( code & 0xFF ) != 0 )
-            app = appAny;
-        else
-            app = appSRA;
-        break;
-
-    case 0x106: /* e.g. "NC_000012.10"                      */
-    case 0x109: /* e.g. "NW_003315935.1", "GPC_000000393.1" */
-        if ( tok -> prefix . size == 3 &&
-             tok -> prefix . addr [ 0 ] == 'G' &&
-             tok -> prefix . addr [ 1 ] == 'C' &&
-             ( tok -> prefix . addr [ 2 ] == 'A' || tok -> prefix . addr [ 2 ] == 'F' ) )
-        {
-            /* e.g. "GCA_000392025.1_L" */
-            app = appNAKMER;
-            break;
-        }
-
-        app = appREFSEQ;
-        break;
-
-    case 0x042: /* e.g. "AAAB01" is WGS package name */
-    case 0x048: /* e.g. "AAAA01000001"               */
-    case 0x049: /* contig can be 6 or 7 digits       */
-    case 0x142: /* e.g. "NZ_AAEW01"                  */
-    case 0x148: /* e.g. "NZ_AAEW01000001"            */
-    case 0x149:
-        app = appWGS;
-        break;
-
-    case 0x029: /* e.g. NA000008777.1 */
-        if ( code == 0x02910 )
-        {
-            if ( tok -> alpha . addr [ 0 ] == 'N' && tok -> alpha . addr [ 1 ] == 'A' )
-            {
-                app = appNANNOT;
-                break;
-            }
-        }
-
-        /* no break */
-
-    default:
-        /* TBD - people appear to be able to throw anything into refseq,
-           so anything unrecognized we may as well test out there...
-           but this should not stay the case */
-        app = appREFSEQ;
-    }
-
-    if ( app == appWGS )
-    {
-        /* if we know this is for refseq, clobber it here */
-        if ( refseq_ctx )
-        {
-            app = appREFSEQ;
-            * legacy_wgs_refseq = true;
-        }
-    }
-
-    return app;
-}
-
-
-/* LocalResolve
- *  resolve an accession into a VPath or not found
- *
- *  1. determine the type of accession we have, i.e. its "app"
- *  2. search all local algorithms of app type for accession
- *  3. return not found or new VPath
- */
-static
-rc_t VResolverLocalResolve ( const VResolver *self,
-    const String * accession, const VPath ** path, bool refseq_ctx )
-{
-    uint32_t i, count;
-
-    VResolverAccToken tok;
-    bool legacy_wgs_refseq = false;
-    VResolverAppID app = get_accession_app ( accession, refseq_ctx, & tok, & legacy_wgs_refseq );
-
-    /* search all local volumes by app and accession algorithm expansion */
-    count = VectorLength ( & self -> local );
-    for ( i = 0; i < count; ++ i )
-    {
-        const VResolverAlg *alg = VectorGet ( & self -> local, i );
-        if ( alg -> app_id == app )
-        {
-            const bool for_cache = false;
-            rc_t rc = VResolverAlgLocalResolve ( alg, self -> wd, & tok, path, legacy_wgs_refseq, for_cache );
-            if ( rc == 0 )
-                return 0;
-        }
-    }
-
-    return RC ( rcVFS, rcResolver, rcResolving, rcName, rcNotFound );
-}
-
-/* LocalFile
- *  locate a locally stored file
- */
-static
-rc_t VResolverLocalFile ( const VResolver *self, const VPath * query, const VPath ** path )
-{
-    uint32_t i, count;
-
-    count = VectorLength ( & self -> local );
-    for ( i = 0; i < count; ++ i )
-    {
-        const VResolverAlg *alg = VectorGet ( & self -> local, i );
-        if ( alg -> app_id == appFILE )
-        {
-            const bool for_cache = false;
-            rc_t rc = VResolverAlgLocalFile ( alg, self -> wd, query, path, for_cache );
-            if ( rc == 0 )
-                return 0;
-        }
-    }
-
-    return RC ( rcVFS, rcResolver, rcResolving, rcName, rcNotFound );
-}
-
-static
-bool VPathHasRefseqContext ( const VPath * accession )
-{
-    size_t num_read;
-    char option [ 64 ];
-    rc_t rc = VPathOption ( accession, vpopt_vdb_ctx, option, sizeof option, & num_read );
-    if ( rc != 0 )
-        return false;
-
-    return ( num_read == sizeof "refseq" - 1 &&
-             strcase_cmp ( "refseq", sizeof "refseq" - 1,
-                           option, num_read, (uint32_t)num_read ) == 0 );
-}
-
-
-/* Local - DEPRECATED
- *  Find an existing local file/directory that is named by the accession.
- *  rcState of rcNotFound means it does not exist.
- *
- *  other rc code for failure are possible.
- *
- *  Accession must be an ncbi-acc scheme or a simple name with no 
- *  directory paths.
- */
-LIB_EXPORT
-rc_t CC VResolverLocal ( const VResolver * self,
-    const VPath * accession, const VPath ** path )
-{
-    rc_t rc =  VResolverQuery ( self, eProtocolHttp, accession, path, NULL, NULL );
-    if ( rc == 0 )
-    {
-        switch ( accession -> path_type )
-        {
-        case vpOID:
-        case vpAccession:
-        case vpNameOrOID:
-        case vpNameOrAccession:
-            if ( * path != accession )
-                return 0;
-            break;
-
-        case vpName:
-            if ( accession -> query . size != 0 && VPathHasRefseqContext ( accession ) )
-                return 0;
-            break;
-        }
-
-        VPathRelease ( * path );
-        * path = NULL;
-        rc = RC ( rcVFS, rcResolver, rcResolving, rcPath, rcNotFound );
-    }
-    return rc;
-}
-
-
-/* LocalEnable
- *  modify settings for using local repositories,
- *  meaning site, user-public and user-protected.
- *
- *  "enable" [ IN ] - enable or disable local access,
- *  or follow settings in KConfig
- *
- *  returns the previous state of "local-enabled" property
- *
- * NB - in VDB-2, the state is associated with library code
- *  shared libraries in separate closures will have separate
- *  state. this can only occur if dynamic ( manual ) loading of
- *  shared libraries is used, and will not occur with normal
- *  usage. in VDB-3 the state will be stored with the process,
- *  not the library.
- */
-LIB_EXPORT
-VResolverEnableState CC VResolverLocalEnable ( const VResolver * self, VResolverEnableState enable )
-{
-    int32_t val, cur, prior;
-
-    if ( self == NULL )
-        return vrUseConfig;
-
-    /* convert "VResolverEnableState" to 32-bit signed integer for atomic operation */
-    val = ( int32_t ) enable;
-
-    /* before performing atomic swap, get the current setting,
-       and return right away if it is already set correctly */
-    prior = atomic32_read ( & enable_local );
-    if ( prior != val ) do
-    {
-        cur = prior;
-        prior = atomic32_test_and_set ( & enable_local, val, prior );
-    }
-    while ( prior != cur );
-
-    return prior;
-}
-
-
-/* RemoteEnable
- *  apply or remove a process-wide enabling of remote access
- *  regardless of configuration settings
- *
- *  "enable" [ IN ] - if "true", enable all remote access
- *  if false, use settings from configuration.
- *
- *  returns the previous state of "remote-enabled" property
- *
- * NB - in VDB-2, the state is associated with library code
- *  shared libraries in separate closures will have separate
- *  state. this can only occur if dynamic ( manual ) loading of
- *  shared libraries is used, and will not occur with normal
- *  usage. in VDB-3 the state will be stored with the process,
- *  not the library.
- */
-LIB_EXPORT
-VResolverEnableState CC VResolverRemoteEnable ( const VResolver * self, VResolverEnableState enable )
-{
-    int32_t val, cur, prior;
-
-    if ( self == NULL )
-        return vrUseConfig;
-
-    /* convert "VResolverEnableState" to 32-bit signed integer for atomic operation */
-    val = ( int32_t ) enable;
-
-    /* before performing atomic swap, get the current setting,
-       and return right away if it is already set correctly */
-    prior = atomic32_read ( & enable_remote );
-    if ( prior != val ) do
-    {
-        cur = prior;
-        prior = atomic32_test_and_set ( & enable_remote, val, prior );
-    }
-    while ( prior != cur );
-
-    return prior;
-}
-
-
-/* CacheEnable
- *  modify settings for caching files in user repositories
- *
- *  "enable" [ IN ] - enable or disable user repository cache,
- *  or follow settings in KConfig
- *
- *  returns the previous state of "cache-enabled" property
- *
- * NB - in VDB-2, the state is associated with library code
- *  shared libraries in separate closures will have separate
- *  state. this can only occur if dynamic ( manual ) loading of
- *  shared libraries is used, and will not occur with normal
- *  usage. in VDB-3 the state will be stored with the process,
- *  not the library.
- */
-LIB_EXPORT
-VResolverEnableState CC VResolverCacheEnable ( const VResolver * self, VResolverEnableState enable )
-{
-    int32_t val, cur, prior;
-
-    if ( self == NULL )
-        return vrUseConfig;
-
-    /* convert "VResolverEnableState" to 32-bit signed integer for atomic operation */
-    val = ( int32_t ) enable;
-
-    /* before performing atomic swap, get the current setting,
-       and return right away if it is already set correctly */
-    prior = atomic32_read ( & enable_cache );
-    if ( prior != val ) do
-    {
-        cur = prior;
-        prior = atomic32_test_and_set ( & enable_cache, val, prior );
-    }
-    while ( prior != cur );
-
-    return prior;
-}
-
-
-/* RemoteResolve
- *  resolve an accession into a remote VPath or not found
- *  may optionally open a KFile to the object in the process
- *  of finding it
- *
- *  2. determine the type of accession we have, i.e. its "app"
- *  3. search all local algorithms of app type for accession
- *  4. return not found or new VPath
- */
-static
-rc_t VResolverRemoteResolve ( const VResolver *self,
-    VRemoteProtocols protocols, const String * accession,
-    const VPath ** path, const VPath **mapping,
-    const KFile ** opt_file_rtn, bool refseq_ctx, bool is_oid )
-{
-    rc_t rc, try_rc;
-    uint32_t i, count;
-
-    VResolverAccToken tok;
-    VResolverAppID app, wildCard;
-    bool legacy_wgs_refseq = false;
-
-    VResolverEnableState remote_state = atomic32_read ( & enable_remote );
-
-    /* subject the accession to pattern recognition */
-    if ( ! is_oid )
-        app = get_accession_app ( accession, refseq_ctx, & tok, & legacy_wgs_refseq );
-    else
-    {
-        app = appAny;
-        VResolverAccTokenInitFromOID ( & tok, accession );
-    }
-
-    /* search all remote volumes by app and accession algorithm expansion */
-    count = VectorLength ( & self -> remote );
-
-    /* allow matching wildcard app */
-    wildCard = appAny;
-#if NO_REFSEQ_CGI
-    if ( app == appREFSEQ )
-        wildCard = -1;
-#endif
-
-    /* no error recorded yet */
-    rc = 0;
-
-    /* TBD - determine whether these settings interfere with
-       case of resolving oid to cache location */
-
-    /* test for forced enable, which applies only to main guys
-       TBD - limit to main sub-category */
-    if ( remote_state == vrAlwaysEnable )
-    {
-        for ( i = 0; i < count; ++ i )
-        {
-            const VResolverAlg *alg = VectorGet ( & self -> remote, i );
-            if ( alg -> app_id == app || alg -> app_id == wildCard )
-            {
-                try_rc = VResolverAlgRemoteResolve ( alg, self -> kns, protocols, & tok, path, mapping, opt_file_rtn, legacy_wgs_refseq );
-                if ( try_rc == 0 )
-                    return 0;
-                if ( rc == 0 )
-                    rc = try_rc;
-            }
-        }
-    }
-    else
-    {
-        for ( i = 0; i < count; ++ i )
-        {
-            const VResolverAlg *alg = VectorGet ( & self -> remote, i );
-            if ( ( alg -> app_id == app || alg -> app_id == wildCard ) && ! alg -> disabled )
-            {
-                try_rc = VResolverAlgRemoteResolve ( alg, self -> kns, protocols, & tok, path, mapping, opt_file_rtn, legacy_wgs_refseq );
-                if ( try_rc == 0 )
-                    return 0;
-                if ( rc == 0 )
-                    rc = try_rc;
-            }
-        }
-    }
-
-    if ( rc != 0 )
-        return rc;
-
-    return RC ( rcVFS, rcResolver, rcResolving, rcName, rcNotFound );
-}
-
-
-/* Remote
- *  Find an existing remote file that is named by the accession.
- *
- *  rcState of rcNotFound means it did not exist and can not be 
- *  downloaded. Probably a bad accession name.
- *
- *  Need a specific rc for no network configured.
- *  Need a specific rc for network access permitted.
- *
- *  Other rc code for failure are possible.
- *
- *  Accession must be an ncbi-acc scheme or a simple name with no 
- *  directory paths.
- *
- * REMOVED 12/23/13
- *  "opt_file_rtn" [ OUT, NULL OKAY ] - optional return parameter for
- *   any KFile that may be opened as a result of resolution. This can
- *   happen if resolving an accession involves opening a URL to a
- *   remote server, for example, in which case the KFile can be returned.
- */
-LIB_EXPORT
-rc_t CC VResolverRemote ( const VResolver * self,
-    VRemoteProtocols protocols, const VPath * accession,
-    const VPath ** path /*, const KFile ** opt_file_rtn */ )
-{
-    rc_t rc;
-
-#if 0
-    if ( opt_file_rtn != NULL )
-        * opt_file_rtn = NULL;
-#endif
-
-    rc = VResolverQuery ( self, protocols, accession, NULL, path, NULL );
-#if 0
-    if ( rc == 0 && opt_file_rtn != NULL &&
-        VPathGetUri_t ( * path ) != vpuri_fasp )
-    {
-#if USE_CURL
-        char path_str [ 8192 ];
-        rc = VPathReadUri ( * path, path_str, sizeof path_str, NULL );
-        if ( rc == 0 )
-            rc = KCurlFileMake ( opt_file_rtn, path_str, false);
-        if ( rc != 0 )
-        {
-            VPathRelease ( * path );
-            * path = NULL;
-        }
-#endif
-    }
-#endif
-
-    return rc;
-}
-
-/* ExtractAccessionApp
- *  examine a path for accession portion,
- *  and try to recognize what app it belongs to
- */
-static
-VResolverAppID VResolverExtractAccessionApp ( const VResolver *self,
-    const VPath * query, bool has_fragment,
-    String * accession, VResolverAccToken * tok,
-    bool *legacy_wgs_refseq )
-{
-    bool refseq_ctx = has_fragment;
-
-    * accession = query -> path;
-
-    if ( query -> fragment . size > 1 )
-        refseq_ctx = true;
-
-    /* should have something looking like an accession.
-       determine its app to see if we were successful */
-    return get_accession_app ( accession, refseq_ctx, tok, legacy_wgs_refseq );
-}
-
-static
-bool VPathHasDownloadTicket ( const VPath * url )
-{
-    size_t num_read;
-    char option [ 64 ];
-    rc_t rc = VPathOption ( url, vpopt_gap_ticket, option, sizeof option, & num_read );
-    return rc == 0;
-}
-
-static
-rc_t VPathExtractAcc ( const VPath * url, VPath ** acc )
-{
-    rc_t rc;
-    String accession;
-
-    /* locate last path or accession guy */
-    const char * start = string_rchr ( url -> path . addr, url -> path . size, '/' );
-    const char * sep, * end = url -> path . addr + url -> path . size;
-    if ( start ++ == NULL )
-        start = url -> path . addr;
-
-    /* strip off known extensions */
-    sep = string_rchr ( start, end - start, '.' );
-    while ( sep != NULL )
-    {
-        switch ( end - sep )
-        {
-        case 4:
-            if ( strcase_cmp ( ".sra", 4, sep, 4, 4 ) == 0 )
-                end = sep;
-            else if ( strcase_cmp ( ".wgs", 4, sep, 4, 4 ) == 0 )
-                end = sep;
-            break;
-        case 9:
-            if ( strcase_cmp ( ".ncbi_enc", 9, sep, 9, 9 ) == 0 )
-            {
-                end = sep;
-                sep = string_rchr ( start, end - start, '.' );
-                continue;
-            }
-            break;
-        }
-        break;
-    }
-
-    /* this is the string */
-    StringInit ( & accession, start, end - start, string_len ( start, end - start ) );
-
-    /* now extract the mapping */
-    rc = LegacyVPathMakeFmt ( acc, "ncbi-acc:%S%S%S",
-        & accession, & url -> query, & url -> fragment );
-    if ( rc == 0 )
-    {
-        VPath * ap = * acc;
-
-        /* fix up case where we said accession but it was really a name */
-        if ( ap -> acc_code == 0 || ap -> path_type != vpAccession )
-            CONST_STRING ( & ap -> scheme, "ncbi-file" );
-    }
-
-    return rc;
-}
-
-static
-rc_t VResolverCacheResolve ( const VResolver *self,
-    const VPath * query, bool has_fragment,
-    const VPath ** cache, bool refseq_ctx )
-{
-    rc_t rc = 0;
-
-    String accession;
-    VResolverAccToken tok;
-    bool legacy_wgs_refseq = false;
-    VResolverAppID app = VResolverExtractAccessionApp ( self,
-        query, has_fragment, & accession, & tok, & legacy_wgs_refseq );
-
-    /* going to walk the local volumes, and remember
-       which one was best. actually, we have no algorithm
-       for determining it, so it's just the comment for TBD */
-    const VResolverAlg *alg, *best = NULL;
-
-    /* search the volumes for a cache-enabled place */
-    uint32_t i, count = VectorLength ( & self -> local );
-
-    /* check for protected status by presence of a download ticket */
-    bool protected = VPathHasDownloadTicket ( query );
-
-    VResolverEnableState cache_state = atomic32_read ( & enable_cache );
-
-    /* check for cache-enable override */
-    if ( cache_state == vrAlwaysEnable )
-    {
-        for ( i = 0; i < count; ++ i )
-        {
-            alg = VectorGet ( & self -> local, i );
-            if ( alg -> cache_capable && alg -> protected == protected &&
-                 ( alg -> app_id == app || alg -> app_id == appAny ) )
-            {
-                /* try to find an existing cache file
-                   NB - race condition exists unless
-                   we do something with lock files */
-                rc = VResolverAlgCacheResolve ( alg, self -> wd, & tok, cache, legacy_wgs_refseq );
-                if ( rc == 0 )
-                    return 0;
-
-                /* just remember the first as best for now */
-                if ( best == NULL )
-                    best = alg;
-            }
-        }
-    }
-    else
-    {
-        for ( i = 0; i < count; ++ i )
-        {
-            alg = VectorGet ( & self -> local, i );
-            if ( alg -> cache_enabled && alg -> protected == protected &&
-                 ( alg -> app_id == app || alg -> app_id == appAny ) )
-            {
-                /* try to find an existing cache file
-                   NB - race condition exists unless
-                   we do something with lock files */
-                rc = VResolverAlgCacheResolve ( alg, self -> wd, & tok, cache, legacy_wgs_refseq );
-                if ( rc == 0 )
-                    return 0;
-
-                /* just remember the first as best for now */
-                if ( best == NULL )
-                    best = alg;
-            }
-        }
-    }
-    
-    /* no existing cache file was found,
-       so create a new one using the best
-       TBD - this should remember a volume path */
-    if ( best == NULL )
-        rc = RC ( rcVFS, rcResolver, rcResolving, rcPath, rcNotFound );
-    else
-        rc = VResolverAlgMakeCachePath ( best, & tok, cache, legacy_wgs_refseq );
-
-    return rc;
-}
-
-static
-rc_t VResolverCacheFile ( const VResolver *self, const VPath * query, const VPath ** cache )
-{
-    rc_t rc = 0;
-
-    /* going to walk the local volumes, and remember
-       which one was best. actually, we have no algorithm
-       for determining it, so it's just the comment for TBD */
-    const VResolverAlg *alg, *best = NULL;
-
-    /* search the volumes for a cache-enabled place */
-    uint32_t i, count = VectorLength ( & self -> local );
-
-    /* check for protected status by presence of a download ticket */
-    bool protected = VPathHasDownloadTicket ( query );
-
-    VResolverEnableState cache_state = atomic32_read ( & enable_cache );
-
-    /* check for cache-enable override */
-    if ( cache_state == vrAlwaysEnable )
-    {
-        for ( i = 0; i < count; ++ i )
-        {
-            alg = VectorGet ( & self -> local, i );
-            if ( alg -> cache_capable && alg -> protected == protected && alg -> app_id == appFILE )
-            {
-                /* try to find an existing cache file
-                   NB - race condition exists unless
-                   we do something with lock files */
-                rc = VResolverAlgCacheFile ( alg, self -> wd, query, cache );
-                if ( rc == 0 )
-                    return 0;
-
-                /* just remember the first as best for now */
-                if ( best == NULL )
-                    best = alg;
-            }
-        }
-    }
-    else
-    {
-        for ( i = 0; i < count; ++ i )
-        {
-            alg = VectorGet ( & self -> local, i );
-            if ( alg -> cache_enabled && alg -> protected == protected && alg -> app_id == appFILE )
-            {
-                /* try to find an existing cache file
-                   NB - race condition exists unless
-                   we do something with lock files */
-                rc = VResolverAlgCacheFile ( alg, self -> wd, query, cache );
-                if ( rc == 0 )
-                    return 0;
-
-                /* just remember the first as best for now */
-                if ( best == NULL )
-                    best = alg;
-            }
-        }
-    }
-    
-    /* no existing cache file was found,
-       so create a new one using the best
-       TBD - this should remember a volume path */
-    if ( best == NULL )
-        rc = RC ( rcVFS, rcResolver, rcResolving, rcPath, rcNotFound );
-    else
-        rc = VResolverAlgMakeCacheFilePath ( best, query, cache );
-
-    return rc;
-}
-
-
-/* Cache
- *  Find a cache directory that might or might not contain a partially
- *  downloaded file.
- *
- *  Accession must be an ncbi-acc scheme, an http url or a simple name with no 
- *  directory paths. All three should return the same directory URL as a VPath. (?)
- *  Or should it be a directory or a file url depending upon finding a partial
- *  download? This would require co-ordination with all download mechanisms that
- *  we permit.
- *
- *  With refseq holding wgs objects we have a case were the downloaded file is not
- *  named the same as the original accession as the file archive you want is a
- *  container for other files.
- *
- *  Find local will give a path that has a special scheme in these cases. 
- *  Find remote will give the url for the container that contains the accession
- *  so using the returned VPath from resolve remote is better than the original
- *  accession in this one case.  I think...
- */
-LIB_EXPORT
-rc_t CC VResolverCache ( const VResolver * self,
-    const VPath * url, const VPath ** path, uint64_t file_size )
-{
-    return VResolverQuery ( self, eProtocolHttp, url, NULL, NULL, path );
-}
-
-/* QueryOID
- */
-
-static
-rc_t get_query_accession ( const VPath * query, String * accession, char * oid_str, size_t bsize )
-{
-    rc_t rc;
-
-    /* going to treat oid as accession */
-    * accession = query -> path;
-
-    /* if the VPath already gives us a numeral, great */
-    if ( query -> path . size != 0 && query -> path . addr [ 0 ] != '0' )
-        return 0;
-
-    /* otherwise, generate one on stack */
-    rc = string_printf ( oid_str, bsize, & accession -> size, "%u", query -> obj_id );
-    if ( rc == 0 )
-    {
-        accession -> addr = oid_str;
-        accession -> len = ( uint32_t ) accession -> size;
-    }
-
-    return rc;
-}
-
-static
-rc_t VResolverQueryOID ( const VResolver * self, VRemoteProtocols protocols,
-    const VPath * query, const VPath ** local, const VPath ** remote, const VPath ** cache )
-{
-    rc_t rc;
-
-    /* require non-zero oid */
-    if ( query -> obj_id == 0 )
-        rc = RC ( rcVFS, rcResolver, rcResolving, rcPath, rcCorrupt );
-    else
-    {
-        /* temporary - no access to vfs
-           NB - this manager will either use a singleton
-           or create a new one with its existing config */
-        VFSManager * vfs;
-        rc = VFSManagerMake ( & vfs );
-        if ( rc == 0 )
-        {
-            char oid_str [ 32 ];
-            String accession;
-            VPath * mapped_query = NULL;
-
-            /* not expected to ever be true */
-            bool refseq_ctx = VPathHasRefseqContext ( query );
-
-            /* PREFACE - having an oid, we will need to map it to either
-               an accession or simple filename before resolving to a
-               local or cache path. there are two ways of getting this
-               mapping: either through the VFS manager, or by asking the
-               remote resolver CGI.
-
-               ASSUMPTION - if the file exists locally or is cached,
-               there should be a mapping available to VFS manager. this
-               assumption can fail if the mapping database has been lost
-               or damaged.
-            */
-
-            /* MAP OID TO ACCESSION */
-            if ( local != NULL || cache != NULL )
-            {
-                /* we want a mapping. ask VFS manager for one */
-                rc = VFSManagerGetObject ( vfs, query -> obj_id, & mapped_query );
-                if ( GetRCState ( rc ) == rcNotFound )
-                {
-                    /* no mapping could be found. another possibility is to resolve remotely */
-                    if ( remote != NULL || atomic32_read ( & enable_remote ) != vrAlwaysDisable )
-                    {
-                        rc = get_query_accession ( query, & accession, oid_str, sizeof oid_str );
-                        if ( rc == 0 )
-                        {
-                            const VPath * remote2, * remote_mapping = NULL;
-                            rc = VResolverRemoteResolve ( self, protocols, & accession,
-                                & remote2, & remote_mapping, NULL, refseq_ctx, true );
-                            if ( rc == 0 )
-                            {
-                                /* got it. now enter into VFS manager's table */
-                                rc = VFSManagerRegisterObject ( vfs, query -> obj_id, remote_mapping );
-                                if ( rc == 0 )
-                                {
-                                    mapped_query = ( VPath* ) remote_mapping;
-                                    remote_mapping = NULL;
-                                    if ( remote != NULL )
-                                    {
-                                        * remote = remote2;
-                                        remote2 = NULL;
-                                    }
-                                }
-
-                                VPathRelease ( remote2 );
-                                VPathRelease ( remote_mapping );
-                            }
-                        }
-                    }
-                }
-
-                if ( rc == 0 )
-                {
-                    assert ( mapped_query != NULL );
-
-                    /* the returned VPath should be of a usable type */
-                    assert ( mapped_query -> path_type == vpAccession       ||
-                             mapped_query -> path_type == vpNameOrAccession ||
-                             mapped_query -> path_type == vpName );
-                    assert ( mapped_query -> path . size != 0 );
-                }
-            }
-
-            /* RESOLVE FOR LOCAL PATH */
-            if ( local != NULL && mapped_query != NULL )
-            {
-                if ( mapped_query -> path_type == vpName )
-                {
-                    /* see if this is a file stored locally */
-                    rc = VResolverLocalFile ( self, mapped_query, local );
-                }
-                else
-                {
-                    /* grab the path as accession */
-                    accession = mapped_query -> path;
-
-                    /* resolve from accession to local path
-                       will NOT find partial cache files */
-                    rc = VResolverLocalResolve ( self, & accession, local, refseq_ctx );
-                }
-
-                if ( rc == 0 && remote != NULL && * remote != NULL )
-                {
-                    /* dump remote path used to map oid */
-                    VPathRelease ( * remote );
-                    * remote = NULL;
-                }
-            }
-
-            if ( local == NULL || * local == NULL )
-            {
-                bool has_fragment = false;
-
-                /* RESOLVE FOR REMOTE */
-                if ( remote != NULL && * remote == NULL )
-                {
-                    rc = get_query_accession ( query, & accession, oid_str, sizeof oid_str );
-                    if ( rc == 0 )
-                    {
-                        const VPath * remote_mapping = NULL;
-                        rc = VResolverRemoteResolve ( self, protocols, & accession, remote,
-                            ( mapped_query == NULL && cache != NULL ) ? & remote_mapping : NULL,
-                            NULL, refseq_ctx, true );
-
-                        if ( rc == 0 && mapped_query == NULL && cache != NULL && remote_mapping == NULL )
-                        {
-                            /* THIS IS LIKELY AN INTERNAL ERROR
-                               EITHER THE CGI DID NOT RETURN A MAPPING
-                               OR WE DID NOT PROPERLY PARSE IT */
-                            VPathRelease ( * remote );
-                            rc = RC ( rcVFS, rcResolver, rcResolving, rcPath, rcNull );
-                        }
-
-                        /* register new mapping */
-                        if ( rc == 0 )
-                        {
-                            assert ( * remote != NULL );
-                            if ( ( * remote ) -> fragment . size != 0 )
-                                has_fragment = true;
-                            if ( remote_mapping != NULL )
-                            {
-                                rc = VFSManagerRegisterObject ( vfs, query -> obj_id, remote_mapping );
-                                if ( rc == 0 )
-                                {
-                                    mapped_query = ( VPath* ) remote_mapping;
-                                    remote_mapping = NULL;
-                                }
-                                VPathRelease ( remote_mapping );
-                            }
-                        }
-                    }
-                }
-
-                /* RESOLVE FOR CACHE */
-                if ( ( remote == NULL || * remote != NULL ) && cache != NULL && mapped_query != NULL )
-                {
-                    /* test for file or accession */
-                    if ( mapped_query -> path_type == vpName )
-                    {
-                        /* see if this is a file stored locally */
-                        rc = VResolverCacheFile ( self, mapped_query, cache );
-                    }
-                    else
-                    {
-                        /* resolve from accession to cache path */
-                        rc = VResolverCacheResolve ( self, mapped_query, has_fragment, cache, refseq_ctx );
-                    }
-                    if ( rc != 0 && remote != NULL )
-                    {
-                        assert ( * cache == NULL );
-                        VPathRelease ( * remote );
-                        * remote = NULL;
-                    }
-                }
-            }
-
-            VPathRelease ( mapped_query );
-
-            VFSManagerRelease ( vfs );
-        }
-    }
-
-    return rc;
-}
-
-/* QueryAcc
- */
-static
-rc_t VResolverQueryAcc ( const VResolver * self, VRemoteProtocols protocols,
-    const VPath * query, const VPath ** local, const VPath ** remote, const VPath ** cache )
-{
-    rc_t rc = 0;
-
-    /* the accession should be directly usable */
-    const String * accession = & query -> path;
-
-    /* check if it is intended to locate a legacy refseq object */
-    bool refseq_ctx = VPathHasRefseqContext ( query );
-
-    /* will be needed to consult CGI */
-    const VPath * remote2 = NULL, * mapped_query = NULL;
-
-    /* LOCAL RESOLUTION */
-    if ( local != NULL )
-        rc = VResolverLocalResolve ( self, accession, local, refseq_ctx );
-
-    if ( local == NULL || * local == NULL )
-    {
-        bool has_fragment = false;
-
-        /* REMOTE RESOLUTION */
-        if ( remote != NULL || ( self -> ticket != NULL && cache != NULL ) )
-        {
-            /* will need to map if protected */
-            const VPath ** mapped_ptr = ( self -> ticket != NULL && cache != NULL ) ?
-                & mapped_query : NULL;
-
-            /* request remote resolution
-               this does not need to map the query to an accession */
-            rc = VResolverRemoteResolve ( self, protocols, accession,
-                & remote2, mapped_ptr, NULL, refseq_ctx, false );
-
-            if ( rc == 0 )
-            {
-                if ( remote2 -> fragment . size != 0 )
-                    has_fragment = true;
-
-                if ( remote != NULL )
-                    * remote = remote2;
-                else
-                    VPathRelease ( remote2 );
-
-                remote2 = NULL;
-            }
-        }
-
-        if ( ( remote == NULL || * remote != NULL ) && cache != NULL )
-        {
-            if ( mapped_query != NULL )
-                rc = VResolverCacheResolve ( self, mapped_query, has_fragment, cache, refseq_ctx );
-#if 0
-            /* the bad assumption that every remotely retrieved accession MUST be mapped */
-            else if ( self -> ticket != NULL )
-                rc = RC ( rcVFS, rcResolver, rcResolving, rcPath, rcNotFound );
-#endif
-            else
-                rc = VResolverCacheResolve ( self, query, has_fragment, cache, refseq_ctx );
-
-            if ( rc != 0 && remote != NULL )
-            {
-                assert ( * cache == NULL );
-                if ( GetRCState ( rc ) == rcNotFound )
-                    rc = 0;
-                else
-                {
-                    VPathRelease ( * remote );
-                    * remote = NULL;
-                }
-            }
-        }
-
-        if ( mapped_query != NULL )
-            VPathRelease ( mapped_query );
-    }
-
-    return rc;
-}
-
-/* QueryPath
- *  this behavior may not be correct
- *  perhaps we should reject paths upon input,
- *  and only resolve things that need resolving
- *  but there is a thought that we can also transform paths
- */
-static
-rc_t VResolverQueryPath ( const VResolver * self, const VPath * query, const VPath ** local )
-{
-    rc_t rc;
-
-    if ( local == NULL )
-        return RC ( rcVFS, rcResolver, rcResolving, rcPath, rcNotFound );
-
-    switch ( KDirectoryPathType ( self -> wd, "%.*s", ( int ) query -> path . size, query -> path . addr ) )
-    {
-    case kptFile:
-    case kptDir:
-    case kptCharDev:
-    case kptBlockDev:
-    case kptFIFO:
-    case kptFile | kptAlias:
-    case kptDir | kptAlias:
-    case kptCharDev | kptAlias:
-    case kptBlockDev | kptAlias:
-    case kptFIFO | kptAlias:
-        break;
-    default:
-        return RC ( rcVFS, rcResolver, rcResolving, rcPath, rcNotFound );
-    }
-
-    rc = VPathAddRef ( query );
-    if ( rc == 0 )
-        * local = query;
-
-    return rc;
-}
-
-
-/* QueryName
- *  may eventually look for the name in local cache,
- *  but for now just return it as a path
- */
-static
-rc_t VResolverQueryName ( const VResolver * self, VRemoteProtocols protocols,
-    const VPath * query, const VPath ** local, const VPath ** remote, const VPath ** cache )
-{
-    return VResolverQueryPath ( self, query, local );
-}
-
-
-/* QueryURL
- *  URL resolves to itself for remote and potentially to a path for cache
- */
-static
-rc_t VResolverQueryURL ( const VResolver * self, VRemoteProtocols protocols,
-    const VPath * query, const VPath ** remote, const VPath ** cache )
-{
-    rc_t rc = 0;
-
-    /* if neither remote nor cache, then must have requested local,
-       and a URL cannot be resolved to local in our world... */
-    if ( ( ( size_t ) remote | ( size_t ) cache ) == 0 )
-        return RC ( rcVFS, rcResolver, rcResolving, rcPath, rcIncorrect );
-
-    /* the URL always resolves to itself for remote */
-    if ( remote != NULL )
-    {
-        rc = VPathAddRef ( query );
-        if ( rc != 0 )
-            return rc;
-        * remote = query;
-    }
-
-    /* if we want a cache location, then try to resolve it */
-    if ( cache != NULL )
-    {
-        VPath *mapping;
-
-        /* check for refseq context */
-        bool refseq_ctx = VPathHasRefseqContext ( query );
-
-        /* first, extract accession or name from URL */
-        rc = VPathExtractAcc ( query, & mapping );
-        if ( rc == 0 )
-        {
-            /* now map to cache location */
-            rc = VResolverCacheResolve ( self, mapping, false, cache, refseq_ctx );
-            VPathRelease ( mapping );
-            if ( GetRCState ( rc ) == rcNotFound && remote != NULL )
-                rc = 0;
-        }
-
-        /* any error must invalidate "remote" */
-        if ( rc != 0 && remote != NULL )
-        {
-            VPathRelease ( * remote );
-            * remote = NULL;
-        }
-    }
-
-    return rc;
-}
-
-
-/* Query
- *  resolve object location to either an existing local path,
- *  or a pair of remote URL + local cache location.
- *
- *  "protocols" [ IN ] - the desired protocols for remote resolution
- *
- *  "query" [ IN ] - a path that can represent:
- *     accession : a recognizable accession from NCBI or known organization
- *     obj-id    : a dbGaP object id
- *     path      : a filesystem path
- *     url       : a remote location
- *
- *  "local" [ OUT, NULL OKAY ] - optional return parameter for local path:
- *     accession : resolve to local user or site path
- *     obj-id    : resolve to local user protected path
- *     path      : return duplicate of input
- *     url       : set to NULL
- *
- *  "remote" [ OUT, NULL OKAY ] - optional return parameter for remote path:
- *     accession : resolve to URL
- *     obj-id    : resolve to URL
- *     path      : set to NULL
- *     url       : set to duplicate
- *
- *  "cache" [ OUT, NULL OKAY ] - optional return parameter for cache path:
- *     accession : resolve to user cache path
- *     obj-id    : resolve to user cache path
- *     path      : set to NULL
- *     url       : resolve to user cache path
- *
- *  any of the output parameters may be NULL, but not all, i.e. there
- *  must be at least one non-NULL return parameter.
- *
- *  if you DON'T want local resolution, pass NULL for "local" and
- *  the query will be resolved remotely. if you don't want remote
- *  resolution, pass NULL for "remote".
- *
- *  a query that is resolved locally will always return NULL for
- *  "remote" and "cache", if the parameters are provided.
- */
-LIB_EXPORT
-rc_t CC VResolverQuery ( const VResolver * self, VRemoteProtocols protocols,
-    const VPath * query, const VPath ** local, const VPath ** remote, const VPath ** cache )
-{
-    rc_t rc;
-
-    if ( ( ( size_t ) local | ( size_t ) remote | ( size_t ) cache ) == 0 )
-        rc = RC ( rcVFS, rcResolver, rcResolving, rcParam, rcNull );
-    else
-    {
-        if ( local != NULL )
-        {
-            * local = NULL;
-            if ( atomic32_read ( & enable_local ) == vrAlwaysDisable )
-                local = NULL;
-        }
-
-        if ( remote != NULL )
-        {
-            * remote = NULL;
-            if ( protocols >= eProtocolLastDefined )
-                return RC ( rcVFS, rcResolver, rcResolving, rcParam, rcInvalid );
-            if ( atomic32_read ( & enable_remote ) == vrAlwaysDisable )
-                remote = NULL;
-        }
-
-        if ( cache != NULL )
-        {
-            * cache = NULL;
-            if ( atomic32_read ( & enable_cache ) == vrAlwaysDisable )
-                cache = NULL;
-        }
-
-        if ( self == NULL )
-            rc = RC ( rcVFS, rcResolver, rcResolving, rcSelf, rcNull );
-        else if ( query == NULL )
-            rc = RC ( rcVFS, rcResolver, rcResolving, rcPath, rcNull );
-        else if ( ( ( size_t ) local | ( size_t ) remote | ( size_t ) cache ) == 0 )
-            rc = RC ( rcVFS, rcResolver, rcResolving, rcPath, rcNotFound );
-        else
-        {
-            switch ( query -> scheme_type )
-            {
-            case vpuri_none:
-            case vpuri_ncbi_file:
-            case vpuri_file:
-            case vpuri_ncbi_acc:
-            case vpuri_ncbi_obj:
-                break;
-
-            case vpuri_http:
-                switch ( protocols )
-                {
-                case eProtocolHttp:
-                case eProtocolFaspHttp:
-                case eProtocolHttpFasp:
-                    return VResolverQueryURL ( self, protocols, query, remote, cache );
-                }
-                return RC ( rcVFS, rcResolver, rcResolving, rcPath, rcIncorrect );
-
-            case vpuri_fasp:
-                switch ( protocols )
-                {
-                case eProtocolFasp:
-                case eProtocolFaspHttp:
-                case eProtocolHttpFasp:
-                    return VResolverQueryURL ( self, protocols, query, remote, cache );
-                }
-                return RC ( rcVFS, rcResolver, rcResolving, rcPath, rcIncorrect );
-
-            default:
-                return RC ( rcVFS, rcResolver, rcResolving, rcPath, rcIncorrect );
-            }
-
-            switch ( query -> path_type )
-            {
-            case vpInvalid:
-                rc = RC ( rcVFS, rcResolver, rcResolving, rcPath, rcInvalid );
-                break;
-
-            case vpOID:
-                rc = VResolverQueryOID ( self, protocols, query, local, remote, cache );
-                break;
-
-            case vpAccession:
-                rc = VResolverQueryAcc ( self, protocols, query, local, remote, cache );
-                break;
-
-            case vpNameOrOID:
-                rc = VResolverQueryOID ( self, protocols, query, local, remote, cache );
-                if ( rc != 0 )
-                    goto try_name;
-                break;
-
-            case vpNameOrAccession:
-                rc = VResolverQueryAcc ( self, protocols, query, local, remote, cache );
-                if ( rc != 0 )
-                    goto try_name;
-                break;
-
-            case vpName:
-                /* try to handle a weird case with non-accessioned names in refseq area */
-                if ( query -> query . size != 0 )
-                {
-                    if ( VPathHasRefseqContext ( query ) )
-                    {
-                        rc = VResolverQueryAcc ( self, protocols, query, local, remote, cache );
-                        if ( rc == 0 )
-                            break;
-                    }
-                }
-            try_name:
-                rc = VResolverQueryName ( self, protocols, query, local, remote, cache );
-                break;
-
-            case vpRelPath:
-            case vpFullPath:
-            case vpUNCPath:
-                rc = VResolverQueryPath ( self, query, local );
-                break;
-
-            default:
-                rc = RC ( rcVFS, rcResolver, rcResolving, rcPath, rcIncorrect );
-            }
-        }
-    }
-
-    return rc;
-}
-
-
-
-/* LoadVolume
- *  capture volume path and other information
- */
-static
-rc_t VResolverAlgLoadVolume ( VResolverAlg *self, uint32_t *num_vols, const char *start, size_t size )
-{
-    rc_t rc = 0;
-
-#if 0
-    /* trim volume whitespace */
-    while ( size != 0 && isspace ( start [ 0 ] ) )
-    {
-        ++ start;
-        -- size;
-    }
-    while ( size != 0 && isspace ( start [ size - 1 ] ) )
-        -- size;
-#endif
-
-    /* trim trailing slashes */
-    while ( size != 0 && start [ size - 1 ] == '/' )
-        -- size;
-
-    /* now see if the string survives */
-    if ( size != 0 )
-    {
-        String loc_vol_str;
-        const String *vol_str;
-        StringInit ( & loc_vol_str, start, size, string_len ( start, size ) );
-        rc = StringCopy ( & vol_str, & loc_vol_str );
-        if ( rc == 0 )
-        {
-            rc = VectorAppend ( & self -> vols, NULL, vol_str );
-            if ( rc == 0 )
-            {
-                * num_vols += 1;
-                return 0;
-            }
-
-            StringWhack ( vol_str );
-        }
-    }
-
-    return rc;
-}
-
-/* LoadVolumes
- *
- *    path-list
- *        = PATH
- *        | <path-list> ':' PATH ;
- */
-static
-rc_t VResolverAlgLoadVolumes ( VResolverAlg *self, uint32_t *num_vols, const String *vol_list )
-{
-    const char *start = vol_list -> addr;
-    const char *end = & vol_list -> addr [ vol_list -> size ];
-    const char *sep = string_chr ( start, end - start, ':' );
-    while ( sep != NULL )
-    {
-        rc_t rc = VResolverAlgLoadVolume ( self, num_vols, start, sep - start );
-        if ( rc != 0 )
-            return rc;
-        start = sep + 1;
-        sep = string_chr ( start, end - start, ':' );
-    }
-    return VResolverAlgLoadVolume ( self, num_vols, start, end - start );
-}
-
-/* LoadAlgVolumes
- *
- *    volumes
- *        = <path-list> ;
- */
-static
-rc_t VResolverLoadAlgVolumes ( Vector *algs, const String *root, const String *ticket,
-    VResolverCacheAllow allow_cache, VResolverAppID app_id, VResolverAlgID alg_id,
-     uint32_t *num_vols, const String *vol_list, bool protected, bool disabled, bool caching )
-{
-    VResolverAlg *alg;
-    rc_t rc = VResolverAlgMake ( & alg, root, app_id, alg_id, protected, disabled );
-    if ( rc == 0 )
-    {
-        alg -> ticket = ticket;
-        alg -> cache_capable = allow_cache == cacheAllow;
-        alg -> cache_enabled = caching;
-
-        if ( ticket != NULL )
-            alg -> alg_id = algCGI;
-
-        rc = VResolverAlgLoadVolumes ( alg, num_vols, vol_list );
-        if ( rc == 0 && VectorLength ( & alg -> vols ) != 0 )
-        {
-            rc = VectorAppend ( algs, NULL, alg );
-            if ( rc == 0 )
-                return 0;
-        }
-
-        VResolverAlgWhack ( alg, NULL );
-    }
-
-    return rc;
-}
-
-/* LoadApp
- *
- *    alg-block
- *        = <alg-type> <volumes> ;
- *
- *    alg-type
- *        = "flat" | "sraFlat" | "sra1024" | "sra1000" | "fuse1000"
- *        | "refseq" | "wgs" | "wgsFlag" | "fuseWGS"
- *        | "ncbi" | "ddbj" | "ebi"
- *        | "nannot" | "nannotFlat" | "fuseNANNOT" ;
- */
-static
-rc_t VResolverLoadVolumes ( Vector *algs, const String *root, const String *ticket,
-    VResolverCacheAllow allow_cache, VResolverAppID app_id, uint32_t *num_vols,
-    const KConfigNode *vols, bool resolver_cgi, bool protected, bool disabled, bool caching )
-{
-    KNamelist *algnames;
-    rc_t rc = KConfigNodeListChildren ( vols, & algnames );
-    if ( rc == 0 )
-    {
-        uint32_t i, count;
-        rc = KNamelistCount ( algnames, & count );
-        for ( i = 0; i < count && rc == 0; ++ i )
-        {
-            const char *algname;
-            rc = KNamelistGet ( algnames, i, & algname );
-            if ( rc == 0 )
-            {
-                const KConfigNode *alg;
-                rc = KConfigNodeOpenNodeRead ( vols, & alg, algname );
-                if ( rc == 0 )
-                {
-                    VResolverAlgID alg_id = algUnknown;
-
-                    /* if using CGI for resolution */
-                    if ( resolver_cgi || strcmp ( algname, "cgi" ) == 0 )
-                        alg_id = algCGI;
-                    /* stored in a flat directory as-is */
-                    else if ( strcmp ( algname, "flat" ) == 0 )
-                        alg_id = algFlat;
-                    /* stored in a flat directory with ".sra" extension */
-                    else if ( strcmp ( algname, "sraFlat" ) == 0 )
-                        alg_id = algSRAFlat;
-                    /* stored in a three-level directory with 1K banks and ".sra" extension */
-                    else if ( strcmp ( algname, "sra1024" ) == 0 )
-                        alg_id = algSRA1024;
-                    /* stored in a three-level directory with 1000 banks and ".sra" extension */
-                    else if ( strcmp ( algname, "sra1000" ) == 0 )
-                        alg_id = algSRA1000;
-                    /* stored in a four-level directory with 1000 banks and ".sra" extension */
-                    else if ( strcmp ( algname, "fuse1000" ) == 0 )
-                        alg_id = algFUSE1000;
-                    /* stored in a flat directory with no extension */
-                    else if ( strcmp ( algname, "refseq" ) == 0 )
-                        alg_id = algREFSEQ;
-                    /* stored in a flat directory with no extension */
-                    else if ( strcmp ( algname, "wgsFlat" ) == 0 )
-                        alg_id = algWGSFlat;
-                    /* stored in a multi-level directory with no extension */
-                    else if ( strcmp ( algname, "wgs" ) == 0 )
-                        alg_id = algWGS;
-                    else if ( strcmp ( algname, "fuseWGS" ) == 0 )
-                        alg_id = algFuseWGS;
-                    /* stored in a three-level directory with 1K banks and no extension */
-                    else if ( strcmp ( algname, "ncbi" ) == 0 ||
-                              strcmp ( algname, "ddbj" ) == 0 )
-                        alg_id = algSRA_NCBI;
-                    /* stored in a three-level directory with 1000 banks and no extension */
-                    else if ( strcmp ( algname, "ebi" ) == 0 )
-                        alg_id = algSRA_EBI;
-
-                    /* new named annotation */
-                    else if ( strcmp ( algname, "nannotFlat" ) == 0 )
-                        alg_id = algNANNOTFlat;
-                    else if ( strcmp ( algname, "nannot" ) == 0 )
-                        alg_id = algNANNOT;
-                    else if ( strcmp ( algname, "fuseNANNOT" ) == 0 )
-                        alg_id = algFuseNANNOT;
-
-                    /* new named annotation */
-                    else if ( strcmp ( algname, "nakmerFlat" ) == 0 )
-                        alg_id = algNAKMERFlat;
-                    else if ( strcmp ( algname, "nakmer" ) == 0 )
-                        alg_id = algNAKMER;
-                    else if ( strcmp ( algname, "fuseNAKMER" ) == 0 )
-                        alg_id = algFuseNAKMER;
-
-                    if ( alg_id != algUnknown )
-                    {
-                        String *vol_list;
-                        rc = KConfigNodeReadString ( alg, & vol_list );
-                        if ( rc == 0 )
-                        {
-                            if ( StringLength ( vol_list ) != 0 )
-                            {
-                                rc = VResolverLoadAlgVolumes ( algs, root, ticket, allow_cache,
-                                    app_id, alg_id, num_vols, vol_list, protected, disabled, caching );
-                            }
-                            StringWhack ( vol_list );
-                        }
-                    }
-
-                    KConfigNodeRelease ( alg );
-                }
-            }
-        }
-
-        KNamelistRelease ( algnames );
-    }
-    return rc;
-}
-
-/* LoadApp
- *
- *    app
- *        = [ <disabled> ] [ <cache-enabled> ] <vol-group> ;
- *
- *    disabled
- *        = "disabled" '=' ( "true" | "false" ) ;
- *
- *    cache-enabled
- *        = "cache-enabled" '=' ( "true" | "false" ) ;
- *
- *    vol-group
- *        = "volumes" <alg-block>* ;
- */
-static
-rc_t VResolverLoadApp ( VResolver *self, Vector *algs, const String *root, const String *ticket,
-    VResolverCacheAllow allow_cache, VResolverAppID app_id, uint32_t *num_vols,
-    const KConfigNode *app, bool resolver_cgi, bool protected, bool disabled, bool caching )
-{
-    const KConfigNode *node;
-
-    /* test for disabled app - it is entirely possible */
-    rc_t rc = KConfigNodeOpenNodeRead ( app, & node, "disabled" );
-    if ( rc == 0 )
-    {
-        bool app_disabled = false;
-        rc = KConfigNodeReadBool ( node, & app_disabled );
-        KConfigNodeRelease ( node );
-        if ( rc == 0 && app_disabled && algs == & self -> local )
-            return 0;
-        disabled |= app_disabled;
-    }
-
-    /* test again for cache enabled */
-    if ( allow_cache == cacheAllow )
-    {
-        rc = KConfigNodeOpenNodeRead ( app, & node, "cache-enabled" );
-        if ( rc == 0 )
-        {
-            /* allow this node to override current value */
-            bool cache;
-            rc = KConfigNodeReadBool ( node, & cache );
-            KConfigNodeRelease ( node );
-            if ( rc == 0 )
-                caching = cache;
-        }
-    }
-
-    /* get volumes */
-    rc = KConfigNodeOpenNodeRead ( app, & node, "volumes" );
-    if ( GetRCState ( rc ) == rcNotFound )
-        rc = 0;
-    else if ( rc == 0 )
-    {
-        rc = VResolverLoadVolumes ( algs, root, ticket, allow_cache,
-            app_id, num_vols, node, resolver_cgi, protected, disabled, caching );
-        KConfigNodeRelease ( node );
-    }
-
-    return rc;
-}
-
-/* LoadApps
- *
- *    app-block
- *        = <app-name> <app> ;
- *
- *    app-name
- *        = "refseq" | "sra" | "wgs" | "nannot" | "nakmer" ;
- */
-static
-rc_t VResolverLoadApps ( VResolver *self, Vector *algs, const String *root,
-    const String *ticket, VResolverCacheAllow allow_cache, const KConfigNode *apps,
-    bool resolver_cgi, bool protected, bool disabled, bool caching )
-{
-    KNamelist *appnames;
-    rc_t rc = KConfigNodeListChildren ( apps, & appnames );
-    if ( rc == 0 )
-    {
-        uint32_t i, count;
-        rc = KNamelistCount ( appnames, & count );
-        if ( resolver_cgi && rc == 0 && count == 0 )
-        {
-            VResolverAlg *cgi;
-            rc = VResolverAlgMake ( & cgi, root, appAny, algCGI, protected, disabled );
-            if ( rc == 0 )
-            {
-                rc = VectorAppend ( algs, NULL, cgi );
-                if ( rc == 0 )
-                {
-                    ++ self -> num_app_vols [ appAny ];
-                    return 0;
-                }
-            }
-        }
-        else for ( i = 0; i < count && rc == 0; ++ i )
-        {
-            const char *appname;
-            rc = KNamelistGet ( appnames, i, & appname );
-            if ( rc == 0 )
-            {
-                const KConfigNode *app;
-                rc = KConfigNodeOpenNodeRead ( apps, & app, appname );
-                if ( rc == 0 )
-                {
-                    VResolverAppID app_id = appUnknown;
-                    if ( strcmp ( appname, "file" ) == 0 )
-                        app_id = appFILE;
-                    else if ( strcmp ( appname, "nakmer" ) == 0 )
-                        app_id = appNAKMER;
-                    else if ( strcmp ( appname, "nannot" ) == 0 )
-                        app_id = appNANNOT;
-                    else if ( strcmp ( appname, "refseq" ) == 0 )
-                        app_id = appREFSEQ;
-                    else if ( strcmp ( appname, "sra" ) == 0 )
-                        app_id = appSRA;
-                    else if ( strcmp ( appname, "wgs" ) == 0 )
-                        app_id = appWGS;
-
-                    rc = VResolverLoadApp ( self, algs, root, ticket, allow_cache, app_id,
-                        & self -> num_app_vols [ app_id ], app, resolver_cgi, protected, disabled, caching );
-
-                    KConfigNodeRelease ( app );
-                }
-            }
-        }
-        KNamelistRelease ( appnames );
-    }
-    return rc;
-}
-
-/* LoadRepo
- *
- *    repository
- *        = [ <disabled> ] [ <cache-enabled> ] <root> <app-group> ;
- *
- *    disabled
- *        = "disabled" '=' ( "true" | "false" ) ;
- *
- *    cache-enabled
- *        = "cache-enabled" '=' ( "true" | "false" ) ;
- *
- *    root
- *        = "root" '=' PATH ;
- *
- *    app-group
- *        = "apps" <app-block>* ;
- */
-static
-rc_t VResolverLoadRepo ( VResolver *self, Vector *algs, const KConfigNode *repo,
-    const String *ticket, VResolverCacheAllow allow_cache, bool protected )
-{
-    const KConfigNode *node;
-    bool caching, resolver_cgi;
-
-    /* test for disabled repository */
-    bool disabled = false;
-    rc_t rc = KConfigNodeOpenNodeRead ( repo, & node, "disabled" );
-    if ( rc == 0 )
-    {
-        rc = KConfigNodeReadBool ( node, & disabled );
-        KConfigNodeRelease ( node );
-
-        /* don't bother recording local, disabled repositories */
-        if ( rc == 0 && disabled && algs == & self -> local )
-            return 0;
-    }
-
-    /* check for caching */
-    caching = allow_cache;
-    if ( allow_cache )
-    {
-        rc = KConfigNodeOpenNodeRead ( repo, & node, "cache-enabled" );
-        if ( rc == 0 )
-        {
-            rc = KConfigNodeReadBool ( node, & caching );
-            KConfigNodeRelease ( node );
-            if ( rc != 0 )
-                caching = false;
-        }
-    }
-
-    /* cache-capable repositories cannot be remote resolvers */
-    resolver_cgi = false;
-    if ( allow_cache )
-        rc = KConfigNodeOpenNodeRead ( repo, & node, "root" );
-    else
-    {
-        /* check for specific resolver CGI */
-        rc = KConfigNodeOpenNodeRead ( repo, & node, "resolver-cgi" );
-        if ( rc == 0 )
-            resolver_cgi = true;
-        /* or get the repository root */
-        else if ( GetRCState ( rc ) == rcNotFound )
-        {
-            rc = KConfigNodeOpenNodeRead ( repo, & node, "root" );
-        }
-    }
-    if ( GetRCState ( rc ) == rcNotFound )
-        rc = 0;
-    else if ( rc == 0 )
-    {
-        /* read root as String */
-        String *root;
-        rc = KConfigNodeReadString ( node, & root );
-        KConfigNodeRelease ( node );
-        if ( GetRCState ( rc ) == rcNotFound )
-            rc = 0;
-        else if ( rc == 0 )
-        {
-            /* perform a bit of cleanup on root */
-            while ( root -> size != 0 && root -> addr [ root -> size - 1 ] == '/' )
-            {
-                /* this is terribly nasty, but known to be safe */
-                -- root -> len;
-                -- root -> size;
-            }
-
-            /* store string on VResolver for management purposes,
-               pass the loaned reference to sub-structures */
-            rc = VectorAppend ( & self -> roots, NULL, root );
-            if ( rc != 0 )
-                StringWhack ( root );
-            else
-            {
-                /* open the "apps" sub-node */
-                rc = KConfigNodeOpenNodeRead ( repo, & node, "apps" );
-                if ( rc == 0 )
-                {
-                    rc = VResolverLoadApps ( self, algs, root, ticket,
-                        allow_cache, node, resolver_cgi, protected, disabled, caching );
-                    KConfigNodeRelease ( node );
-                }
-                else if ( GetRCState ( rc ) == rcNotFound )
-                {
-                    rc = 0;
-                    if ( resolver_cgi )
-                    {
-                        VResolverAlg *cgi;
-                        rc = VResolverAlgMake ( & cgi, root, appAny, algCGI, protected, disabled );
-                        if ( rc == 0 )
-                        {
-                            cgi -> ticket = ticket;
-
-                            rc = VectorAppend ( algs, NULL, cgi );
-                            if ( rc == 0 )
-                            {
-                                ++ self -> num_app_vols [ appAny ];
-                                return 0;
-                            }
-                        }
-
-                        VResolverAlgWhack ( cgi, NULL );
-                    }
-                }
-            }
-        }
-    }
-
-    return rc;
-}
-
-
-/* LoadNamedRepo
- *
- *    repository-block
- *        = ID <repository> ;
- */
-static
-rc_t VResolverLoadNamedRepo ( VResolver *self, Vector *algs, const KConfigNode *sub,
-    const String *ticket, const char *name, VResolverCacheAllow allow_cache, bool protected )
-{
-    const KConfigNode *repo;
-    rc_t rc = KConfigNodeOpenNodeRead ( sub, & repo, name );
-    if ( GetRCState ( rc ) == rcNotFound )
-        rc = 0;
-    else if ( rc == 0 )
-    {
-        rc = VResolverLoadRepo ( self, algs, repo, ticket, allow_cache, protected );
-        KConfigNodeRelease ( repo );
-    }
-    return rc;
-}
-
-/* LoadSubCategory
- *
- *    sub-category-block
- *        = <sub-category> <repository-block>* ;
- *
- *    sub-category
- *        = "main" | "aux" | "protected"
- *
- *    repository-block
- *        = ID <repository> ;
- */
-static
-rc_t VResolverLoadSubCategory ( VResolver *self, Vector *algs, const KConfigNode *kfg,
-    const String *ticket, const char *sub_path, VResolverCacheAllow allow_cache, bool protected )
-{
-    const KConfigNode *sub;
-    rc_t rc = KConfigNodeOpenNodeRead ( kfg, & sub, sub_path );
-    if ( GetRCState ( rc ) == rcNotFound )
-        rc = 0;
-    else if ( rc == 0 )
-    {
-        KNamelist *children;
-        rc = KConfigNodeListChildren ( sub, & children );
-        if ( rc == 0 )
-        {
-            uint32_t i, count;
-            rc = KNamelistCount ( children, & count );
-            for ( i = 0; i < count && rc == 0; ++ i )
-            {
-                const char *name;
-                rc = KNamelistGet ( children, i, & name );
-                if ( rc == 0 )
-                    rc = VResolverLoadNamedRepo ( self, algs, sub, ticket, name, allow_cache, protected );
-            }
-
-            KNamelistRelease ( children );
-        }
-        KConfigNodeRelease ( sub );
-    }
-    return rc;
-}
-
-/* LoadProtected
- *  special function to handle single, active protected workspace
- */
-static
-rc_t VResolverLoadProtected ( VResolver *self, const KConfigNode *kfg, const char *rep_name )
-{
-    const KConfigNode *repo;
-    rc_t rc = KConfigNodeOpenNodeRead ( kfg, & repo, "user/protected/%s", rep_name );
-    if ( GetRCState ( rc ) == rcNotFound )
-        rc = 0;
-    else if ( rc == 0 )
-    {
-        rc = VResolverLoadRepo ( self, & self -> local, repo, NULL, cacheAllow, true );
-        KConfigNodeRelease ( repo );
-    }
-    return rc;
-}
-
-/* LoadLegacyRefseq
- *  load refseq information from KConfig
- *
- *  there are two legacy versions being supported
- *
- *    legacy-refseq
- *        = "refseq" <legacy-vol-or-repo> ;
- *
- *    legacy-vol-or-repo
- *        = "volumes" '=' <path-list>
- *        | <legacy-refseq-repo> <legacy-refseq-vols>
- *        ;
- */
-static
-rc_t VResolverLoadLegacyRefseq ( VResolver *self, const KConfig *cfg )
-{
-    const KConfigNode *vols;
-    rc_t rc = KConfigOpenNodeRead ( cfg, & vols, "/refseq/paths" );
-    if ( GetRCState ( rc ) == rcNotFound )
-        rc = 0;
-    else if ( rc == 0 )
-    {
-        String *vol_list;
-        rc = KConfigNodeReadString ( vols, & vol_list );
-        if ( rc == 0 )
-        {
-            const bool protected = false;
-            const bool disabled = false;
-            const bool caching = true;
-            rc = VResolverLoadAlgVolumes ( & self -> local, NULL, NULL, cacheAllow,
-                appREFSEQ, algREFSEQ,  & self -> num_app_vols [ appREFSEQ ],
-                vol_list, protected, disabled, caching );
-            StringWhack ( vol_list );
-        }
-        KConfigNodeRelease ( vols );
-    }
-
-    return rc;
-}
-
-
-/* ForceRemoteRefseq
- *  makes sure there is a remote source of refseq
- *  or else adds a hard-coded URL to NCBI
- */
-static
-rc_t VResolverForceRemoteRefseq ( VResolver *self )
-{
-    rc_t rc;
-    bool found;
-    String local_root;
-    const String *root;
-
-    uint32_t i, count = VectorLength ( & self -> remote );
-    for ( found = false, i = 0; i < count; ++ i )
-    {
-        VResolverAlg *alg = ( VResolverAlg* ) VectorGet ( & self -> remote, i );
-        if ( alg -> app_id == appREFSEQ )
-        {
-            found = true;
-            if ( alg -> disabled )
-                alg -> disabled = false;
-        }
-    }
-
-    if ( found )
-        return 0;
-
-    if ( self -> num_app_vols [ appAny ] != 0 )
-    {
-        for ( i = 0; i < count; ++ i )
-        {
-            VResolverAlg *alg = ( VResolverAlg* ) VectorGet ( & self -> remote, i );
-            if ( alg -> app_id == appAny )
-            {
-                found = true;
-                if ( alg -> disabled )
-                    alg -> disabled = false;
-            }
-        }
-    }
-
-    if ( found )
-        return 0;
-
-    /* create one from hard-coded constants */
-    StringInitCString ( & local_root, "http://ftp-trace.ncbi.nlm.nih.gov/sra" );
-    rc = StringCopy ( & root, & local_root );    
-    if ( rc == 0 )
-    {
-        rc = VectorAppend ( & self -> roots, NULL, root );
-        if ( rc != 0 )
-            StringWhack ( root );
-        else
-        {
-            String vol_list;
-            const bool protected = false;
-            const bool disabled = false;
-            const bool caching = false;
-            StringInitCString ( & vol_list, "refseq" );
-            rc = VResolverLoadAlgVolumes ( & self -> remote, root, NULL, cacheDisallow,
-                appREFSEQ, algREFSEQ, & self -> num_app_vols [ appREFSEQ ],
-                & vol_list, protected, disabled, caching );
-        }
-    }
-
-    return rc;
-}
-
-
-/* GetDownloadTicket
- *  if we are within a working environment that has a download ticket,
- *  capture it here and add that local repository into the mix
- */
-static
-const String *VResolverGetDownloadTicket ( const VResolver *self,
-    const KRepository *protected, char *buffer, size_t bsize )
-{
-    const String *ticket = NULL;
-    if ( protected != NULL )
-    {
-        rc_t rc = KRepositoryName ( protected, buffer, bsize, NULL );
-        if ( rc == 0 )
-        {
-            size_t ticsz;
-            char ticbuf [ 256 ];
-            rc = KRepositoryDownloadTicket ( protected, ticbuf, sizeof ticbuf, & ticsz );
-            if ( rc == 0 )
-            {
-                String tic;
-                StringInit ( & tic, ticbuf, ticsz, ( uint32_t ) ticsz );
-                rc = StringCopy ( & ticket, & tic );
-            }
-        }
-    }
-    return ticket;
-}
-
-
-/* ForceRemoteProtected
- *  makes sure there is a remote CGI
- */
-static
-rc_t VResolverForceRemoteProtected ( VResolver *self )
-{
-    rc_t rc;
-    const String *root;
-
-    /* create one from hard-coded constants */
-    String cgi_root;
-    StringInitCString ( & cgi_root, "http://www.ncbi.nlm.nih.gov/Traces/names/names.cgi" );
-    rc = StringCopy ( & root, & cgi_root );    
-    if ( rc == 0 )
-    {
-        rc = VectorAppend ( & self -> roots, NULL, root );
-        if ( rc != 0 )
-            StringWhack ( root );
-        else
-        {
-            const bool protected = true;
-            const bool disabled = false;
-
-            VResolverAlg *cgi;
-            rc = VResolverAlgMake ( & cgi, root, appAny, algCGI, protected, disabled );
-            if ( rc == 0 )
-            {
-                cgi -> ticket = self -> ticket;
-
-                rc = VectorAppend ( & self -> remote, NULL, cgi );
-                if ( rc == 0 )
-                {
-                    ++ self -> num_app_vols [ appAny ];
-                    return 0;
-                }
-            }
-
-            VResolverAlgWhack ( cgi, NULL );
-        }
-    }
-
-    return rc;
-}
-
-
-/* Load
- *  load the respository from ( current ) KConfig
- *
- *  using pseudo BNF, it looks like this:
- *
- *    repositories
- *        = "repository" <category-block>* ;
- *
- *    category-block
- *        = <category> <sub-category-block>* ;
- *
- *    category
- *        = "remote" | "site" | "user" ;
- *
- *    sub-category-block
- *        = <sub-category> <repository-block>* ;
- *
- *    sub-category
- *        = "main" | "aux" | "protected"
- */
-static
-rc_t VResolverDetectSRALeafPath ( VResolver *self )
-{
-    /* capture working directory as "root" path */
-    const KDirectory *wd = self -> wd;
-    char cwd [ 4096 ];
-    rc_t rc = KDirectoryResolvePath ( wd, true, cwd, sizeof cwd, "." );
-    if ( rc == 0 )
-    {
-        const String *root;
-
-        /* convert C-string to real string */
-        String cwd_str;
-        StringInitCString ( & cwd_str, cwd );
-
-        /* create a copy on heap */
-        rc = StringCopy ( & root, & cwd_str );
-        if ( rc == 0 )
-        {
-            /* insert into "roots" */
-            rc = VectorAppend ( & self -> roots, NULL, root );
-            if ( rc == 0 )
-            {
-                /* create an algorithm for any application where the
-                   spec is to be treated as a leaf path */
-                VResolverAlg *alg;
-                rc = VResolverAlgMake ( & alg, root, appAny, algFlat, self -> ticket != NULL, false );
-                if ( rc == 0 )
-                {
-                    const String *vol;
-
-                    /* create a single volume - "." */
-                    CONST_STRING ( & cwd_str, "." );
-                    rc = StringCopy ( & vol, & cwd_str );
-                    if ( rc == 0 )
-                    {
-                        rc = VectorAppend ( & alg -> vols, NULL, vol );
-                        if ( rc != 0 )
-                            free ( ( void* ) vol );
-                        else
-                        {
-                            /* insert into local resolution path */
-                            rc = VectorAppend ( & self -> local, NULL, alg );
-                            if ( rc == 0 )
-                                return 0;
-                        }
-                    }
-                
-                    VResolverAlgWhack ( alg, NULL );
-                }
-            }
-
-            free ( ( void* ) root );
-        }
-    }
-    return rc;
-}
-
-static
-rc_t VResolverForceUserFilesVol ( VResolver *self, const VResolverAlg *sraAlg )
-{
-   /* create an algorithm for "file" application where the
-       spec is to be treated as a leaf path */
-    VResolverAlg *alg;
-    rc_t rc = VResolverAlgMake ( & alg, sraAlg -> root, appFILE, algFlat, sraAlg -> protected, sraAlg -> disabled );
-    if ( rc == 0 )
-    {
-        String vol_str;
-        const String *vol;
-
-        /* create a single volume - "files" */
-        CONST_STRING ( & vol_str, "files" );
-        rc = StringCopy ( & vol, & vol_str );
-        if ( rc == 0 )
-        {
-            rc = VectorAppend ( & alg -> vols, NULL, vol );
-            if ( rc != 0 )
-                free ( ( void* ) vol );
-            else
-            {
-                /* copy sra settings */
-                alg -> ticket = sraAlg -> ticket;
-                alg -> cache_capable = sraAlg -> cache_capable;
-                alg -> cache_enabled = sraAlg -> cache_enabled;
-
-                /* insert into local resolution path */
-                rc = VectorAppend ( & self -> local, NULL, alg );
-                if ( rc == 0 )
-                {
-                    ++ self -> num_app_vols [ appFILE ];
-                    return 0;
-                }
-            }
-        }
-                
-        VResolverAlgWhack ( alg, NULL );
-    }
-
-    return rc;
-}
-
-static
-rc_t VResolverForceUserFiles ( VResolver *self )
-{
-    rc_t rc;
-    uint32_t i, count = VectorLength ( & self -> local );
-
-    for ( rc = 0, i = 0; i < count; ++ i )
-    {
-        const VResolverAlg *alg = VectorGet ( & self -> local, i );
-        if ( alg -> app_id == appSRA && alg -> cache_capable )
-        {
-            rc = VResolverForceUserFilesVol ( self, alg );
-            if ( rc != 0 )
-                break;
-        }
-    }
-
-    return rc;
-}
-
-
-static
-rc_t VResolverLoad ( VResolver *self, const KRepository *protected, const KConfig *cfg )
-{
-    bool have_remote_protected = false;
-
-    const KConfigNode *kfg;
-    rc_t rc = KConfigOpenNodeRead ( cfg, & kfg, "repository" );
-    if ( GetRCState ( rc ) == rcNotFound )
-        rc = 0;
-    else if ( rc == 0 )
-    {
-        /* check to see what the current directory is */
-        char buffer [ 256 ];
-        self -> ticket = VResolverGetDownloadTicket ( self, protected, buffer, sizeof buffer );
-
-        /* allow user to specify leaf paths in current directory */
-        rc = VResolverDetectSRALeafPath ( self );
-
-        /* if the user is inside of a protected workspace, load it now */
-        if ( rc == 0 && self -> ticket != NULL )
-        {
-            rc = VResolverLoadProtected ( self, kfg, buffer );
-            if ( rc == 0 && self -> num_app_vols [ appFILE ] == 0 )
-                rc = VResolverForceUserFiles ( self );
-        }
-        /* now load user public repositories */
-        if ( rc == 0 )
-            rc = VResolverLoadSubCategory ( self, & self -> local, kfg, NULL, "user/main", cacheAllow, false );
-        if ( rc == 0 )
-            rc = VResolverLoadSubCategory ( self, & self -> local, kfg, NULL, "user/aux", cacheAllow, false );
-
-        /* load any site repositories */
-        if ( rc == 0 )
-            rc = VResolverLoadSubCategory ( self, & self -> local, kfg, NULL, "site/main", cacheDisallow, false );
-        if ( rc == 0 )
-            rc = VResolverLoadSubCategory ( self, & self -> local, kfg, NULL, "site/aux", cacheDisallow, false );
-
-        /* if within a protected workspace, load protected remote repositories */
-        if ( rc == 0 && self -> ticket != NULL )
-        {
-            rc = KNSManagerMake ( ( KNSManager** ) & self -> kns );
-            if ( rc == 0 )
-            {
-                uint32_t entry_vols = VectorLength ( & self -> remote );
-                rc = VResolverLoadSubCategory ( self, & self -> remote, kfg,
-                    self -> ticket, "remote/protected", cacheDisallow, true );
-                have_remote_protected = VectorLength ( & self -> remote ) > entry_vols;
-            }
-        }
-
-        /* load any remote repositories */
-        if ( rc == 0 )
-            rc = VResolverLoadSubCategory ( self, & self -> remote, kfg, NULL, "remote/main", cacheDisallow, false );
-        if ( rc == 0 )
-            rc = VResolverLoadSubCategory ( self, & self -> remote, kfg, NULL, "remote/aux", cacheDisallow, false );
-
-        KConfigNodeRelease ( kfg );
-
-        /* recover from public remote repositories using resolver CGI */
-        if ( self -> kns == NULL
-#if USE_CURL
-             && self -> num_app_vols [ appAny ] != 0
-#endif
-            )
-        {
-            rc = KNSManagerMake ( ( KNSManager** ) & self -> kns );
-        }
-    }
-
-    if ( rc == 0 && self -> num_app_vols [ appAny ] == 0 )
-    {
-        bool has_current_refseq = true;
-
-        /* AT THIS POINT, a current configuration will have something.
-           But, older out-of-date configurations may exist and need special handling. */
-        if ( self -> num_app_vols [ appREFSEQ ] == 0 )
-        {
-            has_current_refseq = false;
-            rc = VResolverLoadLegacyRefseq ( self, cfg );
-        }
-
-        /* now, one more special case - for external users
-           who had legacy refseq configuration but nothing for SRA,
-           force existence of a remote refseq access */
-        if ( rc == 0
-             && ! has_current_refseq
-             && self -> num_app_vols [ appREFSEQ ] != 0
-             && self -> num_app_vols [ appSRA ] == 0 )
-        {
-            rc = VResolverForceRemoteRefseq ( self );
-        }
-    }
-
-    if ( rc == 0 && self -> num_app_vols [ appFILE ] == 0 )
-        rc = VResolverForceUserFiles ( self );
-
-    if ( rc == 0 && self -> ticket != NULL && ! have_remote_protected )
-        rc = VResolverForceRemoteProtected ( self );
-
-    self -> protocols = eProtocolHttp;
-
-    return rc;
-}
-
-LIB_EXPORT
-rc_t CC VResolverProtocols ( VResolver * self,
-    VRemoteProtocols protocols )
-{
-    if ( self == NULL )
-        return RC ( rcVFS, rcResolver, rcUpdating, rcSelf, rcNull );
-
-    if ( protocols >= eProtocolLastDefined )
-        return RC ( rcVFS, rcResolver, rcUpdating, rcParam, rcInvalid );
-
-    self -> protocols = protocols;
-
-    return 0;
-}
-
-
-/* Make
- *  internal factory function
- */
-static
-rc_t VResolverMake ( VResolver ** objp, const KDirectory *wd,
-    const KRepository *protected, const KConfig *kfg )
-{
-    rc_t rc;
-
-    VResolver *obj = calloc ( 1, sizeof * obj );
-    if ( obj == NULL )
-        rc = RC ( rcVFS, rcMgr, rcCreating, rcMemory, rcExhausted );
-    else
-    {
-        VectorInit ( & obj -> roots, 0, 8 );
-        VectorInit ( & obj -> local, 0, 8 );
-        VectorInit ( & obj -> remote, 0, 8 );
-        obj -> wd = wd;
-
-        KRefcountInit ( & obj -> refcount, 1, "VResolver", "make", "resolver" );
-
-        rc = VResolverLoad ( obj, protected, kfg );
-        if ( rc == 0 )
-        {
-            * objp = obj;
-            return 0;
-        }
-
-        VResolverWhack ( obj );
-    }
-
-    return rc;
-}
-
-/* Make
- *  ask the VFS manager or repository to make a resolver
- */
-LIB_EXPORT
-rc_t CC VFSManagerMakeResolver ( const VFSManager * self,
-    VResolver ** new_resolver, const KConfig * cfg )
-{
-    rc_t rc;
-
-    if ( new_resolver == NULL )
-        rc = RC ( rcVFS, rcMgr, rcCreating, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVFS, rcMgr, rcCreating, rcSelf, rcNull );
-        else if ( cfg == NULL )
-            rc = RC ( rcVFS, rcMgr, rcCreating, rcParam, rcNull );
-        else
-        {
-            KDirectory *wd;
-            rc = VFSManagerGetCWD ( self, & wd );
-            if ( rc == 0 )
-            {
-                const KRepositoryMgr *rmgr;
-                rc = KConfigMakeRepositoryMgrRead ( cfg, & rmgr );
-                if ( rc == 0 )
-                {
-                    const KRepository *protected = NULL;
-                    rc = KRepositoryMgrCurrentProtectedRepository ( rmgr, & protected );
-                    if ( rc == 0 || GetRCState ( rc ) == rcNotFound )
-                    {
-                        rc = VResolverMake ( new_resolver, wd, protected, cfg );
-                        KRepositoryRelease ( protected );
-
-                        if ( rc == 0 )
-                        {
-                            KRepositoryMgrRelease ( rmgr );
-                            return 0;
-                        }
-                    }
-
-                    KRepositoryMgrRelease ( rmgr );
-                }
-
-                KDirectoryRelease ( wd );
-            }
-        }
-
-        *new_resolver = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT
-rc_t CC KRepositoryMakeResolver ( const KRepository *self,
-    VResolver ** new_resolver, const KConfig * cfg )
-{
-    rc_t rc;
-
-    if ( new_resolver == NULL )
-        rc = RC ( rcVFS, rcMgr, rcCreating, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVFS, rcMgr, rcCreating, rcSelf, rcNull );
-        else if ( cfg == NULL )
-            rc = RC ( rcVFS, rcMgr, rcCreating, rcParam, rcNull );
-        else
-        {
-            KDirectory *wd;
-            rc = KDirectoryNativeDir ( & wd );
-            if ( rc == 0 )
-            {
-                rc = VResolverMake ( new_resolver, wd, self, cfg );
-                if ( rc == 0 )
-                    return 0;
-
-                KDirectoryRelease ( wd );
-            }
-        }
-
-        *new_resolver = NULL;
-    }
-
-    return rc;
-}
diff --git a/libs/vfs/srapath-stub.c b/libs/vfs/srapath-stub.c
deleted file mode 100644
index da0985d..0000000
--- a/libs/vfs/srapath-stub.c
+++ /dev/null
@@ -1,372 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <sra/extern.h>
-#include <klib/rc.h>
-#include <klib/defs.h>
-#include <klib/refcount.h>
-#include <sra/srapath.h>
-#include <sra/sradb-priv.h>
-#include <sysalloc.h>
-#include <os-native.h>
-
-#include <sra/impl.h>
-
-#include <string.h>
-#include <assert.h>
-#include <stdio.h>
-
-
-/*--------------------------------------------------------------------------
- * SRAPath
- *  manages accession -> path conversion
- */
-
-/* Make
- *  create path manager
- *
- *  the path manager should already be configured with
- *  standard search paths, but can be augmented by using
- *  the Add*Path messages.
- *
- *  "dir" [ IN, NULL OKAY ] - optional root directory to use
- *  attaches a new reference
- */
-LIB_EXPORT rc_t CC SRAPathMake ( SRAPath **pm, struct KDirectory const *dir )
-{
-    rc_t rc;
-
-    if ( pm == NULL )
-        rc = RC ( rcSRA, rcMgr, rcConstructing, rcParam, rcNull );
-    else
-    {
-        rc = SRAPathMakeImpl( pm, dir );
-        if ( rc == 0 )
-            return 0;
-
-        * pm = NULL;
-    }
-
-    return rc;
-}
-
-
-/* AddRef
- * Release
- */
-LIB_EXPORT rc_t CC SRAPathAddRef ( const SRAPath *self )
-{
-    if ( self != NULL )
-    {
-        switch ( self -> vt -> v1 . maj )
-        {
-        case 1:
-        case 2:
-            return self -> vt -> v1 . addref ( self );
-        }
-
-        return RC ( rcSRA, rcMgr, rcReleasing, rcInterface, rcBadVersion );
-    }
-    return 0;
-}
-
-LIB_EXPORT rc_t CC SRAPathRelease ( const SRAPath *self )
-{
-    if ( self != NULL )
-    {
-        switch ( self -> vt -> v1 . maj )
-        {
-        case 1:
-        case 2:
-            return self -> vt -> v1 . release ( self );
-        }
-
-        return RC ( rcSRA, rcMgr, rcReleasing, rcInterface, rcBadVersion );
-    }
-    return 0;
-}
-
-
-/* Version
- *  returns the library version
- */
-LIB_EXPORT rc_t CC SRAPathVersion ( const SRAPath *self, uint32_t *version )
-{
-    if ( version == NULL )
-        return RC ( rcSRA, rcMgr, rcAccessing, rcParam, rcNull );
-
-    * version = 0;
-
-    if ( self == NULL )
-        return RC ( rcSRA, rcMgr, rcAccessing, rcSelf, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-    case 2:
-        return self -> vt -> v1 . version ( self, version );
-    }
-
-    return RC ( rcSRA, rcMgr, rcAccessing, rcInterface, rcBadVersion );
-}
-
-
-/* Clear
- *  forget all existing server and volume paths
- */
-LIB_EXPORT rc_t CC SRAPathClear ( SRAPath *self )
-{
-    if ( self == NULL )
-        return RC ( rcSRA, rcMgr, rcResetting, rcSelf, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-    case 2:
-        return self -> vt -> v1 . clear ( self );
-    }
-
-    return RC ( rcSRA, rcMgr, rcResetting, rcInterface, rcBadVersion );
-}
-
-
-/* AddRepPath
- *  add a replication path
- *
- *  "rep" [ IN ] - NUL-terminated server search path
- *  may be a compound path with ':' separator characters, e.g.
- *  "/panfs/traces01:/panfs/traces31"
- *
- *  NB - servers are searched in the order provided,
- *  first to last, until one of them satisfies a request,
- *  at which time the successful server is placed at the
- *  head of the search path.
- */
-LIB_EXPORT rc_t CC SRAPathAddRepPath ( SRAPath *self, const char *path )
-{
-    if ( self == NULL )
-        return RC ( rcSRA, rcMgr, rcUpdating, rcSelf, rcNull );
-    if ( path == NULL )
-        return RC ( rcSRA, rcMgr, rcUpdating, rcString, rcNull );
-    if ( path [ 0 ] == 0 )
-        return RC ( rcSRA, rcMgr, rcUpdating, rcString, rcEmpty );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-    case 2:
-        return self -> vt -> v1 . addRepPath ( self, path );
-    }
-
-    return RC ( rcSRA, rcMgr, rcUpdating, rcInterface, rcBadVersion );
-}
-
-
-/* AddVolPath
- *  add a volume path
- *
- *  "vol" [ IN ] - NUL-terminated volume search path
- *  may be a compound path with ':' separator characters, e.g.
- *  "sra2:sra1:sra0"
- *
- *  NB - volumes are searched in the order provided,
- *  first to last. they are never re-ordered.
- */
-LIB_EXPORT rc_t CC SRAPathAddVolPath ( SRAPath *self, const char *path )
-{
-    if ( self == NULL )
-        return RC ( rcSRA, rcMgr, rcUpdating, rcSelf, rcNull );
-    if ( path == NULL )
-        return RC ( rcSRA, rcMgr, rcUpdating, rcString, rcNull );
-    if ( path [ 0 ] == 0 )
-        return RC ( rcSRA, rcMgr, rcUpdating, rcString, rcEmpty );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-    case 2:
-        return self -> vt -> v1 . addVolPath ( self, path );
-    }
-
-    return RC ( rcSRA, rcMgr, rcUpdating, rcInterface, rcBadVersion );
-}
-
-
-/* Full
- *  creates full path from server, volume & accession
- *
- *  "rep" [ IN ] - NUL terminated full path of replication
- *  server, e.g. "/panfs/traces01"
- *
- *  "vol" [ IN ] - NUL terminated relative path of volume,
- *  e.g. "sra2"
- *
- *  "accession" [ IN ] - NUL terminated run accession,
- *  e.g. "SRR000001"
- *
- *  "path" [ OUT ] and "path_max" [ IN ] - return buffer for
- *  NUL-terminated full path to accession.
- */
-LIB_EXPORT rc_t CC SRAPathFull ( const SRAPath *self, const char *rep,
-    const char *vol, const char *accession, char *path, size_t path_max )
-{
-    if ( path_max == 0 )
-        return RC ( rcSRA, rcMgr, rcAccessing, rcBuffer, rcInsufficient );
-    if ( path == NULL )
-        return RC ( rcSRA, rcMgr, rcAccessing, rcBuffer, rcNull );
-
-    /* prepare return for failure */
-    path [ 0 ] = 0;
-
-    /* test remainder */
-    if ( self == NULL )
-        return RC ( rcSRA, rcMgr, rcAccessing, rcSelf, rcNull );
-    if ( accession == NULL )
-        return RC ( rcSRA, rcMgr, rcAccessing, rcPath, rcNull );
-    if ( accession [ 0 ] == 0 )
-        return RC ( rcSRA, rcMgr, rcAccessing, rcPath, rcEmpty );
-
-    /* turn NULL prefix parts into empty string */
-    if ( rep == NULL )
-        rep = "";
-    if ( vol == NULL )
-        vol = "";
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-    case 2:
-        return self -> vt -> v1 . fullPath ( self, rep, vol, accession, path, path_max );
-    }
-
-    return RC ( rcSRA, rcMgr, rcAccessing, rcInterface, rcBadVersion );
-}
-
-
-/* Test
- *  returns true if path appears to be accession
- *  the test is a heuristic, and may return false positives
- *
- *  "path" [ IN ] - NUL terminated path to run
- */
-LIB_EXPORT bool CC SRAPathTest ( const SRAPath *self, const char *path )
-{
-    if ( self == NULL )
-        return false;
-    if ( path == NULL || path [ 0 ] == 0 )
-        return false;
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-    case 2:
-        return self -> vt -> v1 . testPath ( self, path );
-    }
-
-    return false;
-}
-
-
-/* Find
- *  finds location of run within rep-server/volume matrix
- *
- *  "accession" [ IN ] - NUL terminated run accession,
- *   e.g. "SRR000001"
- *
- *  "path" [ OUT ] and "path_max" [ IN ] - return buffer for
- *  NUL-terminated full path to accession.
- *
- *  returns 0 if path exists, rc state rcNotFound if
- *  path cannot be found, and rcInsufficient if buffer is
- *  too small.
- */
-LIB_EXPORT rc_t CC SRAPathFindWithRepLen ( const SRAPath *self,
-    const char *accession, char *path, size_t path_max, size_t *rep_len )
-{
-    if ( path == NULL )
-        return RC ( rcSRA, rcMgr, rcSelecting, rcBuffer, rcNull );
-    if ( path_max == 0 )
-        return RC ( rcSRA, rcMgr, rcSelecting, rcBuffer, rcInsufficient );
-
-    /* looking for illegal character in the accession 'name'
-     * this will be the RC from something like "ncbi-acc:./SRR000001"
-     * or if this is called as a default resolution in the old manner
-     */
-    if ( strchr ( accession, '/' ) != NULL )
-        return RC ( rcSRA, rcUri, rcResolving, rcPath, rcIncorrect );
-
-    path [ 0 ] = 0;
-
-    if ( self == NULL )
-        return RC ( rcSRA, rcMgr, rcSelecting, rcSelf, rcNull );
-    if ( accession == NULL )
-        return RC ( rcSRA, rcMgr, rcSelecting, rcPath, rcNull );
-    if ( accession [ 0 ] == 0 )
-        return RC ( rcSRA, rcMgr, rcSelecting, rcPath, rcEmpty );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-    case 2:
-        return self -> vt -> v1 . findPath ( self, accession, path, path_max, rep_len );
-    }
-
-    return RC ( rcSRA, rcMgr, rcSelecting, rcInterface, rcBadVersion );
-}
-
-LIB_EXPORT rc_t CC SRAPathFind ( const SRAPath *self,
-    const char *accession, char *path, size_t path_max )
-{
-    return SRAPathFindWithRepLen ( self, accession, path, path_max, NULL );
-}
-
-
-/* List (Deprecated)
- *  list all runs known to SRAPath
- *  this can be VERY SLOW due to the large number of runs
- *
- *  "runs" [ OUT ] - return parameter for ordered list of accessions
- *
- *  "deep" [ IN ] - when false, list only first responding server
- */
-LIB_EXPORT rc_t CC SRAPathList ( const SRAPath *self, struct KNamelist **runs, bool deep )
-{
-    if ( runs == NULL )
-        return RC ( rcSRA, rcMgr, rcListing, rcParam, rcNull );
-
-    * runs = NULL;
-
-    if ( self == NULL )
-        return RC ( rcSRA, rcMgr, rcListing, rcSelf, rcNull );
-
-    switch ( self -> vt -> v1 . maj )
-    {
-    case 1:
-        return RC ( rcSRA, rcMgr, rcListing, rcInterface, rcUnsupported ); /* removed from v1 */
-    }
-
-    return RC ( rcSRA, rcMgr, rcListing, rcInterface, rcBadVersion );
-}
diff --git a/libs/vfs/srapath.c b/libs/vfs/srapath.c
deleted file mode 100644
index eb1ae28..0000000
--- a/libs/vfs/srapath.c
+++ /dev/null
@@ -1,1424 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <sra/path-extern.h>
-
-struct SRARunlist;
-#define KNAMELIST_IMPL struct SRARunlist
-#include <klib/impl.h>
-
-struct NCBISRAPath;
-#define SRAPATH_IMPL struct NCBISRAPath
-#include <sra/impl.h>
-
-#include "libsrapath.vers.h"
-
-#include <vfs/manager.h>
-#include <sra/srapath.h>
-#include <kfs/directory.h>
-#include <kfs/file.h>
-#include <kfs/mmap.h>
-#include <kfs/dyload.h>
-#include <klib/container.h>
-#include <klib/vector.h>
-#include <klib/text.h>
-#include <klib/rc.h>
-#include <klib/printf.h>
-#include <kfg/config.h>
-#include <kfg/kfg-priv.h>
-#include <klib/debug.h>
-#include <klib/log.h>
-#include <os-native.h>
-#include <sysalloc.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-#include "path-priv.h"
-
-/*--------------------------------------------------------------------------
- * SRAPathString
- */
-enum
-{
-    alg_none,
-    alg_ncbi,
-    alg_ddbj,
-    alg_ebi,
-    alg_refseq,
-    alg_wgs
-};
-
-typedef struct SRAPathString SRAPathString;
-struct SRAPathString
-{
-    DLNode n;
-    uint8_t alg;
-    char path [ 1 ];
-};
-
-/* Whack
- */
-static
-void CC SRAPathStringWhack ( DLNode *n, void *ignore )
-{
-    free ( n );
-}
-
-/* Make
- */
-static
-rc_t SRAPathStringMake ( DLList *list, const char *path, size_t sz, uint8_t alg )
-{
-    SRAPathString *s = (SRAPathString*) malloc ( sizeof * s + sz );
-    if ( s == NULL )
-        return RC ( rcSRA, rcMgr, rcUpdating, rcMemory, rcExhausted );
-
-    s -> alg = alg;
-    string_copy ( s -> path, sz + 1, path, sz );
-    DLListPushTail ( list, & s -> n );
-
-    return 0;
-}
-
-
-/* Find
- */
-typedef struct SRAPathFindInfo SRAPathFindInfo;
-struct SRAPathFindInfo
-{
-    const char *path;
-    size_t size;
-    uint8_t alg;
-    bool found;
-};
-
-static
-bool CC SRAPathStringFind ( DLNode *n, void *data )
-{
-    const SRAPathString *p = ( const SRAPathString* ) n;
-    SRAPathFindInfo *pb = ( SRAPathFindInfo* ) data;
-    if ( memcmp ( p -> path, pb -> path, pb -> size ) == 0 )
-    {
-        if ( p -> path [ pb -> size ] == 0 )
-        {
-            pb -> alg = p -> alg;
-            return pb -> found = true;
-        }
-    }
-    return false;
-}
-
-/*--------------------------------------------------------------------------
- * NCBIRepository
- *  represents a repository: replication server(s) / volume(s)
- */
-typedef struct NCBIRepository NCBIRepository;
-struct NCBIRepository
-{
-    DLNode n;
-
-    uint8_t type; /* repository type: alg_ncbi (sra: ncbi/ebi/ddbj), alg_wgs, alg_refseq*/
-
-    /* replication servers */
-    DLList repsrv;
-
-    /* volumes upon each repserver */
-    DLList vols;
-};
-/* Init
- */
-static
-rc_t CC SRARepoMake(NCBIRepository** repo)
-{
-    *repo = (NCBIRepository*)malloc(sizeof(NCBIRepository));
-    if (* repo == 0)
-    {
-        return RC ( rcSRA, rcMgr, rcInitializing, rcMemory, rcExhausted );
-    }
-    (*repo)->type = alg_ncbi;
-    (*repo)->n.next = NULL;
-    (*repo)->n.prev = NULL;
-    DLListInit(&(*repo)->repsrv);
-    DLListInit(&(*repo)->vols);
-    return 0;
-}
-/* Whack
- */
-static
-void CC SRARepoWhack ( DLNode *n, void *ignore )
-{
-    if (n != NULL)
-    {
-        DLListWhack ( & ((NCBIRepository*) n) -> repsrv, SRAPathStringWhack, NULL );
-        DLListWhack ( & ((NCBIRepository*) n) -> vols, SRAPathStringWhack, NULL );
-        free ( (NCBIRepository*) n );
-    }
-}
-
-static 
-const char* AlgToStr(uint8_t alg)
-{
-    switch (alg)
-    {
-    case alg_ncbi: 
-    case alg_ddbj:
-    case alg_ebi: return "SRA";
-    case alg_wgs: return "WGS";
-    case alg_refseq: return "REFSEQ";
-    default: return "<unknown>";
-    }
-}
-
-
-static 
-void CC LogVolume( DLNode *n, void *data )
-{
-    const SRAPathString* self = (const SRAPathString*)n;
-    PATH_DEBUG (("        \"%s\", type=%s\n", 
-                  self->path,
-                  AlgToStr(self->alg)));
-}
-
-static 
-void CC LogServer( DLNode *n, void *data )
-{
-    const SRAPathString* self = (const SRAPathString*)n;
-    PATH_DEBUG (("        \"%s\"\n", self->path));
-}
-
-static 
-void CC LogRepository ( DLNode *n, void *data )
-{
-    if (n != NULL)
-    {
-        const NCBIRepository* self = (const NCBIRepository*)n;
-        PATH_DEBUG (("    type=%s\n", AlgToStr(self->type)));
-        PATH_DEBUG (("    servers:\n"));
-        DLListForEach ( & self->repsrv, false, LogServer, NULL );
-        PATH_DEBUG (("    volumes:\n"));
-        DLListForEach ( & self->vols, false, LogVolume, NULL );
-    }
-}
-
-/*--------------------------------------------------------------------------
- * NCBISRAPath
- *  manages accession -> path conversion
- */
-typedef struct NCBISRAPath NCBISRAPath;
-struct NCBISRAPath
-{
-    struct SRAPath dad;
-
-    /* working directory */
-    const KDirectory *dir;
-
-    /* repositories */
-    DLList repos;
-    NCBIRepository* dflt_repo; /* default repository (likely to be removed in the future versions) */ 
-
-    atomic32_t refcount;
-};
-
-static void LogPathInfo(const NCBISRAPath* self)
-{
-    PATH_DEBUG (("NCBISRAPath configuration:\n"));
-    DLListForEach ( & self->repos, false, LogRepository, NULL );
-    PATH_DEBUG (("default repository:\n"));
-    LogRepository( (DLNode*) self->dflt_repo, NULL );
-}
-
-/* Whack
- */
-static
-rc_t SRAPathWhack ( NCBISRAPath *self )
-{
-    rc_t rc = KDirectoryRelease ( self -> dir );
-    if ( rc == 0 )
-    {
-        DLListWhack ( & self -> repos, SRARepoWhack, NULL );
-        SRARepoWhack ( (DLNode*) self -> dflt_repo, NULL );
-        free ( self );
-    }
-    return rc;
-}
-
-
-/* AddRef
- * Release
- */
-static
-rc_t CC NCBISRAPathAddRef ( const NCBISRAPath *cself )
-{
-    atomic32_inc ( & ( ( NCBISRAPath* ) cself ) -> refcount );
-    return 0;
-}
-
-static
-rc_t CC NCBISRAPathRelease ( const NCBISRAPath *cself )
-{
-    NCBISRAPath *self = ( NCBISRAPath* ) cself;
-    if ( atomic32_dec_and_test ( & self -> refcount ) )
-        return SRAPathWhack ( self );
-    return 0;
-}
-
-
-/* Version
- *  returns the library version
- */
-static
-rc_t CC NCBISRAPathVersion ( const NCBISRAPath *self, uint32_t *version )
-{
-    * version = LIBSRAPATH_VERS;
-    return 0;
-}
-
-
-/* Clear
- *  forget existing server and volume paths for the default repository
- */
-static
-rc_t CC NCBISRAPathClear ( NCBISRAPath *self )
-{
-    DLListWhack ( & self -> dflt_repo -> repsrv, SRAPathStringWhack, NULL );
-    DLListWhack ( & self -> dflt_repo -> vols, SRAPathStringWhack, NULL );
-    DLListInit ( & self -> dflt_repo -> repsrv );
-    DLListInit ( & self -> dflt_repo -> vols );
-
-    return 0;
-}
-
-
-/* AddPath
- *  add an alternate replication or volume path
- *
- *  "path" [ IN ] and "size" [ IN ] - sets a search path
- *
- *  "alt" [ IN ] - use std or alternate volume path algorithm
- */
-static
-rc_t SRAPathAddSubPath ( DLList *list, const char *path, size_t size, uint8_t alg )
-{
-    /* see if it's already there */
-    SRAPathFindInfo pb;
-    pb . path = path;
-    pb . size = size;
-    pb . found = 0;
-    DLListDoUntil ( list, 0, SRAPathStringFind, & pb );
-    if ( pb . found )
-        return 0;
-
-    /* create a new one */
-    return SRAPathStringMake ( list, path, size, alg );
-}
-
-static
-rc_t SRAPathAddPath ( DLList *list, const char *path, uint8_t alg )
-{
-    rc_t rc;
-    if ( path == NULL )
-        rc = RC ( rcSRA, rcMgr, rcUpdating, rcString, rcNull );
-    else if ( path [ 0 ] == 0 )
-        rc = RC ( rcSRA, rcMgr, rcUpdating, rcString, rcEmpty );
-    else
-    {
-        /* treat path as a Unix-style multi-path */
-        size_t size = string_size ( path );
-        while ( 1 )
-        {
-            /* find separator */
-            const char *sep = string_chr ( path, size, ':' );
-            if ( sep == NULL )
-                break;
-
-            /* add sub-path */
-            rc = SRAPathAddSubPath ( list, path, sep - path, alg );
-            if ( rc != 0 )
-                return rc;
-
-            /* consume ':' */
-            ++ sep;
-
-            /* pop from string */
-            size -= sep - path;
-            path = sep;
-        }
-
-        return SRAPathAddSubPath ( list, path, size, alg );
-    }
-    return rc;
-}
-
-/* AddRepPath
- *  add a replication path to a repository
- *
- *  "rep" [ IN ] - NUL-terminated server search path
- *  may be a compound path with ':' separator characters, e.g.
- *  "/panfs/traces01:/panfs/traces31"
- *
- *  NB - servers are searched in the order provided,
- *  first to last, until one of them satisfies a request,
- *  at which time the successful server is placed at the
- *  head of the search path.
- */
-static
-rc_t CC NCBISRAPathAddRepPath ( NCBIRepository* repo, const char *rep )
-{
-    return SRAPathAddPath ( & repo -> repsrv, rep, alg_none );
-}
-static
-rc_t CC NCBISRAPathAddRepPathDefault ( NCBISRAPath *self, const char *rep )
-{
-    return NCBISRAPathAddRepPath ( self -> dflt_repo, rep );
-}
-
-/* AddVolPath
- *  add a volume path to the default repository
- *
- *  "vol" [ IN ] - NUL-terminated volume search path
- *  may be a compound path with ':' separator characters, e.g.
- *  "sra2:sra1:sra0"
- *
- *  NB - volumes are searched in the order provided,
- *  first to last. they are never re-ordered.
- */
-static
-rc_t SRAPathAddAlgVolPath ( NCBIRepository* repo, const char *vol, uint8_t alg )
-{
-    return SRAPathAddPath ( & repo -> vols, vol, alg );
-}
-static
-rc_t CC NCBISRAPathAddVolPathDefault ( NCBISRAPath *self, const char *vol )
-{
-    return SRAPathAddAlgVolPath ( self -> dflt_repo, vol, alg_ncbi);
-}
-
-/* Config
- *  configure an existing path manager
- */
-static
-rc_t SRAPathConfigValue ( const KConfig *kfg, const char *node_path,
-    char *value, size_t value_size, const char *dflt )
-{
-    const KConfigNode *node;
-    rc_t rc = KConfigOpenNodeRead ( kfg, & node, node_path );
-    if ( rc == 0 )
-    {
-        size_t num_read, remaining;
-        rc = KConfigNodeRead ( node, 0, value, value_size - 1, & num_read,  & remaining );
-        if ( rc == 0 )
-        {
-            if ( remaining != 0 )
-                rc = RC ( rcSRA, rcMgr, rcConstructing, rcString, rcExcessive );
-            else
-                value [ num_read ] = 0;
-        }
-
-        KConfigNodeRelease ( node );
-    }
-
-    if ( rc != 0 )
-    {
-        if ( dflt != NULL && dflt [ 0 ] != 0 )
-        {
-            size_t num_read = string_copy_measure ( value, value_size, dflt );
-            rc = 0;
-            if ( num_read == value_size )
-                rc = RC ( rcSRA, rcMgr, rcConstructing, rcString, rcExcessive );
-        }
-        else
-	    	value[0] = 0;     
-    }
-    return rc;
-}
-
-static 
-rc_t ConfigVolume(NCBIRepository* repo, KConfig * kfg, const char* keyPref, const char* keySuff, uint8_t alg )
-{
-    char value [ 4096 ];
-    char key [ 4096 ];
-    size_t pSize = string_size(keyPref);
-    size_t sSize = string_size(keySuff);
-    if ( pSize + sSize >= sizeof(key))
-    {
-        return RC ( rcSRA, rcMgr, rcConstructing, rcString, rcExcessive );
-    }
-    string_copy(key, sizeof(key), keyPref, pSize);
-    string_copy(key + pSize, sizeof(key) - pSize, keySuff, sSize);
-    key[pSize+sSize] = 0;
-    value[0] = '\0';
-    if ( SRAPathConfigValue ( kfg, key, value, sizeof value, NULL ) == 0 )        
-        SRAPathAddAlgVolPath ( repo, value, alg );
-    return 0;
-}
-
-static
-rc_t ConfigRepo(KConfig * kfg, const char *dflt, const char* reps, const char* volPref, uint8_t type, NCBIRepository** repo)
-{
-    char value [ 4096 ] = "";
-    rc_t rc;
-
-    /* set up a new repo */ 
-    rc = SRARepoMake(repo);
-    if ( rc == 0 )
-    {
-        (*repo)->type = type;
-
-        /* set up servers */
-        if ( SRAPathConfigValue ( kfg, reps, value, sizeof value, dflt ) == 0 )
-            NCBISRAPathAddRepPath ( *repo, value );
-
-        if ( type == alg_ncbi )
-        {
-            /* set up NCBI volumes */
-            rc = ConfigVolume( *repo, kfg, volPref, "/ncbi/volumes", alg_ncbi );
-
-            /* set up EBI volumes */
-            if (rc == 0)
-                rc = ConfigVolume( *repo, kfg, volPref, "/ebi/volumes", alg_ebi );
-
-            /* set up DDBJ volumes */
-            if (rc == 0)
-                rc = ConfigVolume( *repo, kfg, volPref, "/ddbj/volumes", alg_ddbj );
-        }
-        else if (rc == 0)
-        {
-                rc = ConfigVolume( *repo, kfg, volPref, "/volumes", type);
-        }
-    }
-    return rc;
-}
-
-static
-rc_t ConfigRepoSet(DLList* repos, KConfig * kfg, const char* kfgPath, const char *dflt, uint8_t type)
-{
-    const KConfigNode *node;
-
-    rc_t rc = KConfigOpenNodeRead ( kfg, & node, kfgPath );
-    if ( rc == 0 )
-    {
-        KNamelist* children;
-        rc = KConfigNodeListChild ( node, &children );
-        if ( rc == 0 )
-        {
-            uint32_t count;
-            rc = KNamelistCount ( children, &count );
-            if ( rc == 0 )
-            {
-                uint32_t i;
-                for (i = 0; i < count; ++i)
-                {
-                    const char* name;
-                    rc = KNamelistGet ( children, i, &name );
-                    if ( rc == 0 )
-                    {
-                        #define BufSize 4096
-                        char buf[ BufSize ];
-                        size_t bSize = string_size(kfgPath);
-                        string_copy(buf, BufSize, kfgPath, bSize);
-                        if (bSize + string_size(name) < sizeof(buf))
-                        {
-                            NCBIRepository* repo;
-                            string_copy(buf + bSize, sizeof(buf) - bSize, name, string_size(name) + 1);
-                            rc = ConfigRepo( kfg, dflt, buf, buf, type, &repo );
-                            DLListPushTail( repos, (DLNode*) repo );
-                        }
-                        #undef BufSize
-                    }
-                    else
-                    {
-                        rc = RC ( rcSRA, rcMgr, rcConstructing, rcString, rcExcessive );
-                    }
-                    if ( rc != 0 )
-                    {
-                        break;
-                    }
-                }
-            }
-            KNamelistRelease ( children );
-        }
-
-        KConfigNodeRelease ( node );
-    }
-    if (GetRCState(rc) == rcNotFound)
-    {
-        return 0;
-    }
-    return rc;
-}
-
-static
-rc_t SRAPathConfig ( NCBISRAPath *self )
-{
-    const char *dflt;
-    KConfig * kfg;
-    rc_t rc = KConfigMakeLocal ( & kfg, NULL );
-    assert ( ( rc == 0 && kfg != NULL ) || ( rc != 0 && kfg == NULL ) );
-
-    /* look for defaults */
-    dflt = getenv ( "SRAPATH" );
-
-    /* locate and configure all repositories */
-    if ( rc == 0 )
-        rc = ConfigRepoSet( & self->repos, kfg, "/sra/repository/", dflt, alg_ncbi );
-    if ( rc == 0 )
-        rc = ConfigRepoSet( & self->repos, kfg, "/wgs/repository/", dflt, alg_wgs );
-    if ( rc == 0 )
-        rc = ConfigRepoSet( & self->repos, kfg, "/refseq/repository/", dflt, alg_refseq );
-
-    if ( rc == 0 )
-    {   /* default repository for backwards compatibility */
-        rc = ConfigRepo( kfg, dflt, "sra/servers", "sra", alg_ncbi, &self->dflt_repo );
-
-        /* set up REFSEQ volumes */
-        if (rc == 0)
-            rc = ConfigVolume( self->dflt_repo, kfg, "", "/refseq/volumes", alg_refseq );
-
-        /* set up WGS volumes */
-        if (rc == 0)
-            rc = ConfigVolume( self->dflt_repo, kfg, "sra", "/wgs/volumes", alg_wgs );
-    }
-
-    LogPathInfo(self);
-
-    /* kfg may be NULL */        
-    KConfigRelease ( kfg );
-
-    return rc;
-}
-
-
-/* ParseRunAccession
- *  accession is a string matching <prefix><number>
- *  extract prefix length and accession number
- */
-static
-rc_t SRAPathParseRunAccession ( const char *accession, uint32_t *prefix, uint32_t *number )
-{
-    char *end;
-    uint32_t i;
-
-    for ( i = 0; accession [ i ] != 0; ++ i )
-    {
-        if ( isdigit ( accession [ i ] ) )
-            break;
-    }
-
-    if ( i == 0 )
-        return RC ( rcSRA, rcMgr, rcResolving, rcPath, rcInvalid );
-
-    * prefix = i;
-    * number = ( uint32_t ) strtoul ( & accession [ i ], & end, 10 );
-
-    if (( end [ 0 ] == 0 ) || ( end [ 0 ] == '.' ))
-    {
-        return 0;
-    }
-    return RC ( rcSRA, rcMgr, rcResolving, rcPath, rcInvalid );
-}
-
-
-/* Full
- *  creates full path from server, volume & accession
- *
- *  "rep" [ IN ] - NUL terminated full path of replication
- *  server, e.g. "/panfs/traces01"
- *
- *  "vol" [ IN ] - NUL terminated relative path of volume,
- *  e.g. "sra2"
- *
- *  "accession" [ IN ] - NUL terminated run accession,
- *  e.g. "SRR000001"
- *
- *  "path" [ OUT ] and "path_max" [ IN ] - return buffer for
- *  NUL-terminated full path to accession.
- */
-static
-rc_t SRAPathFullInt ( const NCBISRAPath *self, const char *rep, const char *vol,
-    const char *accession, char *path, size_t path_max, size_t bank_size )
-{
-    /* pick apart accession */
-    uint32_t prefix, number;
-    rc_t rc = SRAPathParseRunAccession ( accession, & prefix, & number );
-    if ( rc == 0 )
-    {
-        size_t len;
-        size_t total = 0;
-        uint32_t bank = number / bank_size;
-
-        if ( rep [ 0 ] != 0 && vol [ 0 ] != 0 )
-        {
-            /* normally write all parts at once */
-            if ( rep [ strlen (rep) - 1 ] == '/') /* check for need or not a '/' between rep and vol */
-                rc= string_printf ( path, path_max, &len, "%s%s/%.*s/%06u/%s"
-                                 , rep
-                                 , vol
-                                 , ( int ) prefix, accession
-                                 , bank
-                                 , accession );
-            else
-                rc= string_printf  ( path, path_max, &len, "%s/%s/%.*s/%06u/%s"
-                                 , rep
-                                 , vol
-                                 , ( int ) prefix, accession
-                                 , bank
-                                 , accession );
-        }
-        else
-        {
-            /* allow for individual rep-server and volume parts */
-            if ( rep [ 0 ] != 0 )
-            {
-                rc = string_printf ( path, path_max, &len, "%s/", rep );
-                if ( rc != 0 || ( total = len ) >= path_max )
-                    return RC ( rcSRA, rcMgr, rcAccessing, rcBuffer, rcInsufficient );
-            }
-            else if ( vol [ 0 ] != 0 )
-            {
-                rc = string_printf ( & path [ total ], path_max - total, &len, "%s/", vol );
-                if ( rc != 0 || ( total = len ) >= path_max )
-                    return RC ( rcSRA, rcMgr, rcAccessing, rcBuffer, rcInsufficient );
-            }
-
-            /* append the accession */
-            rc = string_printf ( & path [ total ], path_max - total, &len, "%.*s/%06u/%s"
-                             , ( int ) prefix, accession
-                             , bank
-                             , accession );
-        }
-
-        /* common detection of buffer overflow */
-        if ( rc != 0 || ( total += len ) >= path_max )
-            rc = RC ( rcSRA, rcMgr, rcAccessing, rcBuffer, rcInsufficient );
-    }
-
-    return rc;
-}
-
-static
-rc_t SRAPathFullEBI ( const NCBISRAPath *self, const char *rep, const char *vol,
-    const char *accession, char *path, size_t path_max )
-{
-    /* pick apart accession */
-    uint32_t prefix, number;
-    rc_t rc = SRAPathParseRunAccession ( accession, & prefix, & number );
-    if ( rc == 0 )
-    {
-        size_t len;
-        size_t total = 0;
-        uint32_t bank = number / 1000;
-
-        if ( rep [ 0 ] != 0 && vol [ 0 ] != 0 )
-        {
-            /* normally write all parts at once */
-            if ( rep [ strlen (rep) - 1 ] == '/') /* check for need or not a '/' between rep and vol */
-                rc= string_printf ( path, path_max, &len, "%s%s/%.*s/%.*s%03u/%s"
-                                 , rep
-                                 , vol
-                                 , ( int ) prefix, accession
-                                 , ( int ) prefix, accession
-                                 , bank
-                                 , accession );
-            else
-                rc= string_printf  ( path, path_max, &len, "%s/%s/%.*s/%.*s%03u/%s"
-                                 , rep
-                                 , vol
-                                 , ( int ) prefix, accession
-                                 , ( int ) prefix, accession
-                                 , bank
-                                 , accession );
-        }
-        else
-        {
-            /* allow for individual rep-server and volume parts */
-            if ( rep [ 0 ] != 0 )
-            {
-                rc = string_printf ( path, path_max, &len, "%s/", rep );
-                if ( rc < 0 || ( total = len ) >= path_max )
-                    return RC ( rcSRA, rcMgr, rcAccessing, rcBuffer, rcInsufficient );
-            }
-            else if ( vol [ 0 ] != 0 )
-            {
-                rc = string_printf ( & path [ total ], path_max - total, &len, "%s/", vol );
-                if ( rc != 0 || ( total = len ) >= path_max )
-                    return RC ( rcSRA, rcMgr, rcAccessing, rcBuffer, rcInsufficient );
-            }
-
-            /* append the accession */
-            rc = string_printf ( & path [ total ], path_max - total, &len, "%.*s/%.*s%03u/%s"
-                             , ( int ) prefix, accession
-                             , ( int ) prefix, accession
-                             , bank
-                             , accession );
-        }
-
-        /* common detection of buffer overflow */
-        if ( len < 0 || ( total += len ) >= path_max )
-            rc = RC ( rcSRA, rcMgr, rcAccessing, rcBuffer, rcInsufficient );
-    }
-
-    return rc;
-}
-
-/*
-* Refseq-style accessions come in 2 naming flavors, flat or SRA-like.
-* If an accession with a flat name does not exist, use SRAPathFullInt to create an SRA-like path
-*/
-static
-rc_t SRAPathFullREFSEQ ( const NCBISRAPath *self, const char *rep, const char *vol,
-    const char *accession, char *path, size_t path_max )
-{
-    /* pick apart accession */
-    uint32_t prefix, number;
-    rc_t rc = SRAPathParseRunAccession ( accession, & prefix, & number );
-    if ( rc == 0 )
-    {
-        size_t len;
-        size_t total = 0;
-
-        if ( rep [ 0 ] != 0 && vol [ 0 ] != 0 )
-        {
-            /* normally write all parts at once */
-            if ( rep [ strlen (rep) - 1 ] == '/') /* check for need or not a '/' between rep and vol */
-                rc= string_printf ( path, path_max, &len, "%s%s/%s"
-                                 , rep
-                                 , vol
-                                 , accession );
-            else
-                rc= string_printf  ( path, path_max, &len, "%s/%s/%s"
-                                 , rep
-                                 , vol
-                                 , accession );
-        }
-        else
-        {
-            /* allow for individual rep-server and volume parts */
-            if ( rep [ 0 ] != 0 )
-            {
-                rc = string_printf ( path, path_max, &len, "%s/", rep );
-                if ( rc != 0 || ( total = len ) >= path_max )
-                    return RC ( rcSRA, rcMgr, rcAccessing, rcBuffer, rcInsufficient );
-            }
-            else if ( vol [ 0 ] != 0 )
-            {
-                rc = string_printf ( & path [ total ], path_max - total, &len, "%s/", vol );
-                if ( rc != 0 || ( total = len ) >= path_max )
-                    return RC ( rcSRA, rcMgr, rcAccessing, rcBuffer, rcInsufficient );
-            }
-
-            /* append the accession */
-            rc = string_printf ( & path [ total ], path_max - total, &len, "%s"
-                             , accession );
-        }
-
-        /* common detection of buffer overflow */
-        if ( rc != 0 || ( total += len ) >= path_max )
-            rc = RC ( rcSRA, rcMgr, rcAccessing, rcBuffer, rcInsufficient );
-    }
-
-    return rc;
-}
-
-/*
- * Try to locate in RefSeq Archives:
- * check for pattern '(\w{4}\d{2})[\.\d]+'; the archive is $1
- * use the scheme "x-ncbi-legrefseq" for vfs to recognize special case
- */
-static
-rc_t SRAPathFullREFSEQArchive(NCBISRAPath const *self,
-                              char const rep[],
-                              char const vol[],
-                              char const accession[],
-                              char path[],
-                              size_t path_max
-                             )
-{
-    size_t const rep_sz = strlen(rep);
-    size_t const vol_sz = strlen(vol);
-    char const *const rep_sep = (rep_sz > 0 && rep[rep_sz - 1] != '/') ? "/" : "";
-    char const *const vol_sep = (vol_sz > 0 && vol[vol_sz - 1] != '/') ? "/" : "";
-    size_t sz;
-    unsigned i;
-    VFSManager *vfs;
-    rc_t rc = VFSManagerMake(&vfs);
-    VPath *vpath;
-    KDirectory const *dir;
-    KPathType type;
-    
-    if (rc)
-        return rc;
-    
-    for (i = 0; i < 4; ++i) {
-        int const ch = accession[i];
-        
-        if (ch == 0 || !isalpha(ch))
-            return RC(rcSRA, rcMgr, rcAccessing, rcPath, rcIncorrect);
-    }
-    for ( ; ; ++i) {
-        int const ch = accession[i];
-        
-        if (ch == 0)
-            break;
-        if (ch != '.' && !isdigit(ch))
-            return RC(rcSRA, rcMgr, rcAccessing, rcPath, rcIncorrect);
-    }
-    if (i < 8)
-        return RC(rcSRA, rcMgr, rcAccessing, rcPath, rcIncorrect);
-    
-    rc = string_printf(path, path_max, &sz, "x-ncbi-legrefseq:%s%s%s%s%.6s", rep, rep_sep, vol, vol_sep, accession);
-    if (rc) return rc;
-    i = sz;
-    
-    rc = VPathMake(&vpath, path + 17);
-    if (rc) return rc;
-
-    rc = VFSManagerOpenDirectoryRead(vfs, &dir, vpath);
-    VPathRelease(vpath);
-    VFSManagerRelease(vfs);
-    if (rc) return rc;
-    
-    type = KDirectoryPathType(dir, "tbl/%s", accession);
-    KDirectoryRelease(dir);
-    
-    if (type != kptDir)
-        return RC(rcSRA, rcMgr, rcAccessing, rcPath, rcIncorrect);
-
-    rc = string_printf(path + i, path_max - i, &sz, "#tbl/%s", accession);
-    
-    return rc;
-}
-
-/*
-* WGS style naming: accession name ABCD01 resolves into WGS/AB/CD/ABCD01
-*/
-static
-rc_t SRAPathFullWGS( const NCBISRAPath *self, const char *rep, const char *vol,
-    const char *accession, char *path, size_t path_max )
-{
-    /* pick apart accession */
-    uint32_t prefix, number;
-    rc_t rc = SRAPathParseRunAccession ( accession, & prefix, & number );
-    if ( rc == 0 )
-    {
-        size_t len;
-        size_t total = 0;
-
-        if ( prefix < 4 )
-        {
-            return RC ( rcSRA, rcMgr, rcResolving, rcName, rcTooShort );
-        }
-
-        if ( rep [ 0 ] != 0 && vol [ 0 ] != 0 )
-        {
-            /* normally write all parts at once */
-            if ( rep [ strlen (rep) - 1 ] == '/') /* check for need or not a '/' between rep and vol */
-                rc= string_printf ( path, path_max, &len, "%s%s/WGS/%.2s/%.2s/%s"
-                                 , rep
-                                 , vol
-                                 , accession
-                                 , accession+2
-                                 , accession );
-            else
-                rc= string_printf ( path, path_max, &len, "%s/%s/WGS/%.2s/%.2s/%s"
-                                 , rep
-                                 , vol
-                                 , accession
-                                 , accession+2
-                                 , accession );
-        }
-        else
-        {
-            /* allow for individual rep-server and volume parts */
-            if ( rep [ 0 ] != 0 )
-            {
-                rc = string_printf ( path, path_max, &len, "%s/", rep );
-                if ( rc != 0 || ( total = len ) >= path_max )
-                    return RC ( rcSRA, rcMgr, rcAccessing, rcBuffer, rcInsufficient );
-            }
-            else if ( vol [ 0 ] != 0 )
-            {
-                rc = string_printf ( & path [ total ], path_max - total, &len, "%s/", vol );
-                if ( rc != 0 || ( total = len ) >= path_max )
-                    return RC ( rcSRA, rcMgr, rcAccessing, rcBuffer, rcInsufficient );
-            }
-
-            /* append the accession */
-                rc= string_printf ( & path [ total ], path_max - total, &len, "WGS/%.2s/%.2s/%s"
-                                 , accession
-                                 , accession+2
-                                 , accession );
-        }
-
-        /* common detection of buffer overflow */
-        if ( rc != 0 || ( total += len ) >= path_max )
-            rc = RC ( rcSRA, rcMgr, rcAccessing, rcBuffer, rcInsufficient );
-    }
-
-    return rc;
-}
-
-static
-rc_t ApplyAlg( const NCBISRAPath *self, const char *rep, const char *vol, 
-    const char *accession, char *path, size_t path_max, NCBIRepository *repo, bool* found)
-{
-    SRAPathFindInfo pb;
-    /* see if we recognize volume */
-    pb . path = vol;
-    pb . size = strlen ( vol );
-    pb . found = 0;
-
-    DLListDoUntil ( & repo -> vols, 0, SRAPathStringFind, & pb );
-    if ( pb . found )
-    {
-        *found = true;
-        switch (pb . alg)
-        {
-        case alg_ebi:
-            return SRAPathFullEBI ( self, rep, vol, accession, path, path_max );
-        case alg_refseq:
-        {
-            rc_t rc = SRAPathFullREFSEQ ( self, rep, vol, accession, path, path_max );
-            if ( rc == 0) /* check for existence of accession at the root of the volume, and if not found try to apply the default path-building scheme */
-            {
-                switch ( KDirectoryPathType ( self -> dir, path ) )
-                {
-                case kptNotFound:
-                case kptBadPath:
-                    return SRAPathFullREFSEQArchive( self, rep, vol, accession, path, path_max );
-                default:
-                	return 0;
-                }
-            }
-		}            
-        case alg_wgs:
-            return SRAPathFullWGS ( self, rep, vol, accession, path, path_max );
-        default:
-            break;
-        }
-    }
-    *found = false;
-    return 0;
-}
-
-static
-rc_t CC NCBISRAPathFull ( const NCBISRAPath *self, const char *rep, const char *vol,
-    const char *accession, char *path, size_t path_max )
-{
-    NCBIRepository *repo;
-    bool found;
-    rc_t rc;
-
-    /* loop through repositories */ 
-    for ( repo = ( NCBIRepository* ) DLListHead ( & self -> repos );
-          repo != NULL; repo = ( NCBIRepository* ) DLNodeNext ( & repo -> n ) )
-    {
-        rc = ApplyAlg( self, rep, vol, accession, path, path_max, repo, &found);
-        if (found)
-        {
-            return rc;
-        }
-    }
-    /* try the default repository */
-    rc = ApplyAlg( self, rep, vol, accession, path, path_max, self -> dflt_repo, &found);
-    if (found)
-    {
-        return rc;
-    }
-    /* internal version */
-    return SRAPathFullInt ( self, rep, vol, accession, path, path_max, 1024 );
-}
-
-
-/* Test
- *  returns true if path appears to be accession
- *  the test is a heuristic, and may return false positives
- *
- *  "path" [ IN ] - NUL terminated path to run
- */
-static
-bool SRAPathTestTable ( const KDirectory *dir, uint32_t type, const char *path )
-{
-    /* differentiate between legacy and current structure */
-    switch ( KDirectoryPathType ( dir, "%s/idx", path ) )
-    {
-    case kptNotFound:
-        switch ( KDirectoryPathType ( dir, "%s/meta", path ) )
-        {
-        case kptFile:
-        case kptFile | kptAlias:
-            switch ( KDirectoryPathType ( dir, "%s/skey", path ) )
-            {
-            case kptFile:
-            case kptFile | kptAlias:
-                return true;
-            }
-            break;
-        }
-        break;
-
-    case kptDir:
-    case kptDir | kptAlias:
-        switch ( KDirectoryPathType ( dir, "%s/md/cur", path ) )
-        {
-        case kptFile:
-        case kptFile | kptAlias:
-            return true;
-        }
-        break;
-    }
-
-    /* not a table */
-    return false;
-}
-
-static
-bool SRAPathTestDatabase ( const KDirectory *dir, uint32_t type, const char *path )
-{
-    /* don't have a more stringent requirement for database at this time */
-    return true;
-}
-
-static
-bool SRAPathTestFile ( const KDirectory *dir, uint32_t type, const char *path )
-{
-    /* TBD - need to look at magic information */
-    return false;
-}
-
-static
-bool SRAPathTestInt ( const KDirectory *dir, uint32_t type, const char *path )
-{
-    switch ( type )
-    {
-    case kptDir:
-    case kptDir | kptAlias:
-        break;
-
-    case kptFile:
-    case kptFile | kptAlias:
-        return SRAPathTestFile ( dir, type, path );
-
-    default:
-        return false;
-    }
-
-    /* detect apparent tables */
-    switch ( KDirectoryPathType ( dir, "%s/col", path ) )
-    {
-    case kptDir:
-    case kptDir | kptAlias:
-        return SRAPathTestTable ( dir, type, path );
-    }
-
-    /* detect apparent databases */
-    switch ( KDirectoryPathType ( dir, "%s/tbl", path ) )
-    {
-    case kptDir:
-    case kptDir | kptAlias:
-        return SRAPathTestDatabase ( dir, type, path );
-    }
-
-    /* not a recognized accession */
-    return false;
-}
-
-static
-bool CC NCBISRAPathTest ( const NCBISRAPath *self, const char *path )
-{
-    return SRAPathTestInt ( self -> dir,
-        KDirectoryPathType ( self -> dir, path ), path );
-}
-
-
-/* FindOnServer
- *  find accession on rep-server 
- */
-static
-rc_t SRAPathFindOnServer ( const NCBISRAPath *self, const NCBIRepository *repo, const SRAPathString *srv,
-    const char *accession, char *path, size_t path_max, int vol_type )
-{
-    const SRAPathString *vol;
-
-    PATH_DEBUG (("SRAPathFindOnServer(%s)\n", srv->path));
-
-    for ( vol = ( const SRAPathString* ) DLListHead ( & repo -> vols );
-          vol != NULL; vol = ( const SRAPathString* ) DLNodeNext ( & vol -> n ) )
-    {
-        if ( vol_type == alg_none || vol_type == vol->alg )
-        {
-            rc_t rc;
-
-            PATH_DEBUG (("SRAPathFindOnServer trying volume %s\n", vol->path));
-
-            switch ( vol -> alg )
-            {
-            case alg_ebi:
-                rc = SRAPathFullEBI ( self, srv -> path, vol -> path, accession, path, path_max );
-                break;
-            case alg_refseq:
-                rc = SRAPathFullREFSEQ ( self, srv -> path, vol -> path, accession, path, path_max );
-                if ( rc == 0) /* check for existence of accession at the root of the volume, and if not found try to apply the default path-building scheme */
-                {
-                    switch ( KDirectoryPathType ( self -> dir, path ) )
-                    {
-                    case kptNotFound:
-                    case kptBadPath:
-                        rc = SRAPathFullREFSEQArchive( self, srv -> path, vol -> path, accession, path, path_max );
-                        if (rc == 0) {
-                            PATH_DEBUG (("SRAPathFindOnServer: found(%s)\n", path));
-                            return 0;
-                        }
-                        break;
-                    default:
-                    	return 0;
-                    }
-                }
-                break;
-            case alg_wgs:
-                rc = SRAPathFullWGS ( self, srv -> path, vol -> path, accession, path, path_max );
-                break;
-            default:
-                rc = SRAPathFullInt ( self, srv -> path, vol -> path, accession, path, path_max, 1024 );
-                break;
-            }
-            if ( rc == 0 )
-            {
-                switch ( KDirectoryPathType ( self -> dir, path ) )
-                {
-                case kptNotFound:
-                case kptBadPath:
-                    break;
-                default:
-                    PATH_DEBUG (("SRAPathFindOnServer: found(%s)\n", path));
-                    return 0;
-                }
-            }
-            else
-            {
-                if ( GetRCState( rc ) == rcInsufficient )
-                    return rc;
-            }
-        }
-    }
-
-    return RC ( rcSRA, rcMgr, rcSelecting, rcPath, rcNotFound );
-}
-
-/* FindInRepo
- *  find accession in a repository
- */
-static
-rc_t SRAPathFindInRepo ( const NCBISRAPath *self, NCBIRepository *repo, const char *accession, 
-                         char *path, size_t path_max, size_t *rep_len, int vol_type )
-{
-    SRAPathString *srv;
-
-    PATH_DEBUG (("SRAPathFindInRepo(%s)\n", AlgToStr(repo->type)));
-
-    /* look for accession on a rep-server */
-    for ( srv = ( SRAPathString* ) DLListHead ( & repo -> repsrv ); srv != NULL; srv = ( SRAPathString* ) DLNodeNext ( & srv -> n ) )
-    {
-        /* try with this server */
-        rc_t rc = SRAPathFindOnServer ( self, repo, srv, accession, path, path_max, vol_type );
-        if ( rc == 0 )
-        {
-            /* make sure server is at head of list */
-            if ( DLNodePrev ( & srv -> n ) != NULL )
-            {
-                DLListUnlink ( & repo -> repsrv, & srv -> n );
-                DLListPushHead ( & repo -> repsrv, & srv -> n );
-            }
-
-            if ( rep_len != NULL )
-                * rep_len = strlen ( srv -> path );
-            
-            return 0;
-        }
-
-        if ( GetRCState ( rc ) != rcNotFound )
-            return rc;
-    }
-
-    return RC ( rcSRA, rcMgr, rcSelecting, rcPath, rcNotFound );
-}
-
-/* FindInRepoByType
- *  find accession in a repository of a given type
- */
-static
-rc_t SRAPathFindInRepoByType ( const NCBISRAPath *self, const char *accession, char *path, size_t path_max, size_t *rep_len, int repo_type, int vol_type )
-{
-    /* loop through all repositories */
-    NCBIRepository *repo; 
-    for ( repo = ( NCBIRepository* ) DLListHead ( & self -> repos ); repo != NULL; repo = ( NCBIRepository* ) DLNodeNext ( & repo -> n ) )
-    {
-        if ( repo->type == repo_type && SRAPathFindInRepo(self, repo, accession, path, path_max, rep_len, vol_type) == 0 )
-            return 0;
-    }
-    return RC ( rcSRA, rcMgr, rcSelecting, rcPath, rcNotFound );
-}
-
-/* FastFind
- * Uses heuristics to select the repository most likely to contain the accession, then tries to locate the acecssion in the repository.
-*/
-static
-rc_t FindFast( const NCBISRAPath *cself, const char *accession, char *path, size_t path_max, size_t *rep_len )
-{
-    /*TODO: look up cache first */
-    
-    /* recognize known naming schemes */
-    size_t size = string_size(accession);
-    if ( string_cmp(accession, size, "SRR", 3, 3) == 0 )
-        return SRAPathFindInRepoByType(cself, accession, path, path_max, rep_len, alg_ncbi, alg_ncbi);
-
-    if ( string_cmp(accession, size, "ERR", 3, 3) == 0 )
-        return SRAPathFindInRepoByType(cself, accession, path, path_max, rep_len, alg_ncbi, alg_ebi);
-
-    if ( string_cmp(accession, size, "DRR", 3, 3) == 0 )
-        return SRAPathFindInRepoByType(cself, accession, path, path_max, rep_len, alg_ncbi, alg_ddbj);
-        
-    if ( string_chr(accession, size, '.') != NULL )
-        return SRAPathFindInRepoByType(cself, accession, path, path_max, rep_len, alg_refseq, alg_none);    
-        
-    if ( size > 2 && isdigit(accession[size-1]) && isdigit(accession[size-2]) && ! isdigit(accession[size-3]) ) 
-        return SRAPathFindInRepoByType(cself, accession, path, path_max, rep_len, alg_wgs, alg_none);    
-        
-    return RC ( rcSRA, rcMgr, rcSelecting, rcPath, rcNotFound );
-}
-
-/* Find
- *  finds location of run within rep-server/volume matrix
- *
- *  "accession" [ IN ] - NUL terminated run accession,
- *   e.g. "SRR000001"
- *
- *  "path" [ OUT ] and "path_max" [ IN ] - return buffer for
- *  NUL-terminated full path to accession.
- *
- *  returns 0 if path exists, rc state rcNotFound if
- *  path cannot be found, and rcInsufficient if buffer is
- *  too small.
- */
-static
-rc_t CC NCBISRAPathFindWithRepLen ( const NCBISRAPath *cself, const char *accession, char *path, size_t path_max, size_t *rep_len )
-{
-    rc_t rc;
-    NCBIRepository *repo;
-
-    PATH_DEBUG(("NCBISRAPathFindWithRepLen(%s)\n", accession));
-
-    rc = FindFast( cself, accession, path, path_max, rep_len );
-    if ( rc == 0 )
-        return 0;
-        
-    /* loop through all repositories */ 
-    for ( repo = ( NCBIRepository* ) DLListHead ( & cself -> repos ); repo != NULL; repo = ( NCBIRepository* ) DLNodeNext ( & repo -> n ) )
-    {
-        rc = SRAPathFindInRepo(cself, repo, accession, path, path_max, rep_len, alg_none);
-        if ( rc == 0 )
-            return 0;
-    }
-    /* default repository */
-    return SRAPathFindInRepo(cself, cself -> dflt_repo, accession, path, path_max, rep_len, alg_none);
-}
-
-struct SRAPath_vt_v2 vtSRAPath =
-{
-    2, 1,
-    NCBISRAPathAddRef,
-    NCBISRAPathRelease,
-    NCBISRAPathVersion,
-    NCBISRAPathClear,
-    NCBISRAPathAddRepPathDefault,
-    NCBISRAPathAddVolPathDefault,
-    NCBISRAPathFull,
-    NCBISRAPathTest,
-    NCBISRAPathFindWithRepLen
-};
-
-/* Make
- *  create path manager
- *
- *  the path manager should already be configured with
- *  standard search paths, but can be augmented by using
- *  the Add*Path messages.
- *
- *  "dir" [ IN, NULL OKAY ] - optional root directory to use
- *  attaches a new reference
- */
-MOD_EXPORT
-rc_t CC SRAPathMakeImpl ( SRAPath **pm, const KDirectory *dir )
-{
-    rc_t rc;
-
-    if ( pm == NULL )
-        rc = RC ( rcSRA, rcMgr, rcConstructing, rcParam, rcNull );
-    else
-    {
-        NCBISRAPath *p = (NCBISRAPath *) malloc ( sizeof * p );
-        if ( p == NULL )
-            rc = RC ( rcSRA, rcMgr, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            p -> dad . vt = ( SRAPath_vt* ) & vtSRAPath;
-            p -> dir = dir;
-            if ( dir != NULL )
-                rc = KDirectoryAddRef ( dir );
-            else
-            {
-                KDirectory *wd;
-                rc = KDirectoryNativeDir ( & wd );
-                p -> dir = wd;
-            }
-
-            if ( rc != 0 )
-                free ( p );
-            else
-            {
-                DLListInit ( & p -> repos );
-                p -> dflt_repo = NULL;
-                atomic32_set ( & p -> refcount, 1 );
-
-                /* the object is now complete */
-                rc = SRAPathConfig ( p );
-                if ( rc == 0 )
-                {
-                    * pm = & p -> dad;
-                    return 0;
-                }
-
-                SRAPathWhack ( p );
-            }
-        }
-
-        * pm = NULL;
-    }
-
-    return rc;
-}
diff --git a/libs/vfs/unix/syskeyring.c b/libs/vfs/unix/syskeyring.c
deleted file mode 100644
index 74e940c..0000000
--- a/libs/vfs/unix/syskeyring.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <vfs/keyring-priv.h>
-
-#include <kfg/config.h>
-
-#include <klib/text.h>
-#include <klib/rc.h>
-#include <klib/log.h>
-#include <klib/printf.h>
-
-#include <kfs/file.h>
-#include <kfs/directory.h>
-#include <kfs/lockfile.h>
-
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <sys/wait.h>
-
-#include <stdio.h>
-
-#ifndef MAX_PATH
-#define MAX_PATH 4096
-#endif
-
-const char* KeyRingDefaultDataDir = "~/.ncbi";
-
-/*TODO: move to ../keyring.c */
-LIB_EXPORT bool CC KKeyRingIsServerRunning(const char* dataDir)
-{   
-    KDirectory* wd;
-    rc_t rc = KDirectoryNativeDir (&wd);
-    if (rc == 0)
-    {
-        char lockFileName[MAX_PATH];
-        if (dataDir == NULL)
-            dataDir = KeyRingDefaultDataDir;
-        rc = string_printf(lockFileName, sizeof(lockFileName)-1, NULL, "%s/keyring_lock", dataDir);
-        
-        if (rc == 0)
-        {
-            KFile* lockedFile;
-            rc = KDirectoryCreateExclusiveAccessFile(wd, &lockedFile, true, 0600, kcmOpen, lockFileName);
-            if (rc == 0)
-                KFileRelease(lockedFile);
-        }
-        KDirectoryRelease(wd);
-    }
-    return rc != 0;
-}
-
-rc_t StartKeyRing(const char* dataDir)
-{
-    rc_t rc = 0;
-    
-    pid_t child = fork();
-    switch (child)
-    {
-        case 0: /* child */
-        {   /* become the server */
-        
-/*TODO: calculate based on $(APPPATH) in kfg */
-const char* KeyRingServerExeName = "/home/boshkina/internal/asm-trace/centos/gcc/stat/x86_64/dbg/bin/keyring-srv";
-
-            if (dataDir == NULL)
-                dataDir = "~/.ncbi";
-            LogMsg(klogInfo, "Keyring: execl...");
-
-            if (execl(KeyRingServerExeName, KeyRingServerExeName, dataDir, NULL) == -1)
-            {   /* TODO: look around:
-                    - same dir as the current executable (kfg/APPPATH)
-                    - current dir
-                    - etc.
-                */
-            }
-            pLogMsg(klogErr, 
-                    "Keyring: execl($(exe)) failed ($(errno)=$(perrno))", 
-                    "exe=%s,errno=%d,perrno=%!", 
-                    KeyRingServerExeName, errno, errno);
-            exit(1);
-            break;
-        }
-        case -1: /* error */
-        {
-            switch (errno)
-            {
-            case EAGAIN:
-            case ENOMEM:
-                rc = RC (rcVFS, rcProcess, rcProcess, rcMemory, rcInsufficient);
-                break;
-            case ENOSYS:
-                rc = RC (rcVFS, rcProcess, rcProcess, rcInterface, rcUnsupported);
-                break;
-            default:
-                rc = RC (rcVFS, rcProcess, rcProcess, rcError, rcUnknown);
-                break;
-            }
-            break;
-        }
-        default: /* parent */
-            break;
-    }
-        
-    return rc;
-}
-
-#if 0
-static
-rc_t GetAppPath(const char* buf, size_t bufsize)
-{
-    KConfig* kfg;
-    rc_t rc = KConfigMake(&kfg, NULL);
-    if (rc == 0)
-    {
-        const KConfigNode *node;
-        char path[] = "APPPATH";
-        char buf[4096];
-        size_t num_read;
-        rc_t rc2;
-    
-        rc_t rc=KConfigOpenNodeRead(kfg, &node, path, string_measure(path, NULL), buf);
-        if (rc == 0) 
-        {
-            rc = KConfigNodeRead(node, 0, buf, bufsize, &num_read, NULL);
-            rc2 = KConfigNodeRelease(node);
-            if (rc == 0)
-                rc = r2;
-        }
-        rc2 = KConfigRelease(kfg);
-        if (rc == 0)
-            rc = r2;
-    }
-    return rc;
-}
-#endif
\ No newline at end of file
diff --git a/libs/vfs/unix/syspath.c b/libs/vfs/unix/syspath.c
deleted file mode 100644
index 334b7a4..0000000
--- a/libs/vfs/unix/syspath.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vfs/extern.h>
-
-#include "path-priv.h"
-
-#include <vfs/manager.h>
-#include <klib/text.h>
-#include <klib/refcount.h>
-#include <klib/rc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-#include <sysalloc.h>
-
-
-/*--------------------------------------------------------------------------
- * VFSManager
- */
-
-
-/* MakeSysPath
- *  make a path object from an OS native filesystem path string
- *
- *  "new_path" [ OUT ] - return parameter for new path object
- *
- *  "sys_path" [ IN ] - a UTF-8 NUL-terminated string
- *  representing a native filesystem path
- *
- *  "wide_sys_path" [ IN ] - a wide NUL-terminated string
- *  representing a native filesystem path, where
- *  wchar_t is either USC-2 or UTF-32 depending upon libraries
- */
-LIB_EXPORT rc_t CC VFSManagerMakeSysPath ( const VFSManager * self,
-    VPath ** new_path, const char * sys_path )
-{
-    rc_t rc;
-
-    if ( sys_path != NULL )
-    {
-        /* POSIX paths are our normal path type */
-        return VFSManagerMakePath ( self, new_path, "%s", sys_path );
-    }
-
-    if ( new_path == NULL )
-        rc = RC ( rcVFS, rcMgr, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVFS, rcMgr, rcConstructing, rcSelf, rcNull );
-        else
-            rc = RC ( rcVFS, rcMgr, rcConstructing, rcPath, rcNull );
-
-        * new_path = NULL;
-    }
-
-    return rc;
-}
-
-LIB_EXPORT rc_t CC VFSManagerWMakeSysPath ( const VFSManager * self,
-    VPath ** new_path, const wchar_t * wide_sys_path )
-{
-    rc_t rc;
-
-    if ( new_path == NULL )
-        rc = RC ( rcVFS, rcMgr, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVFS, rcMgr, rcConstructing, rcSelf, rcNull );
-        else if ( wide_sys_path == NULL )
-            rc = RC ( rcVFS, rcMgr, rcConstructing, rcPath, rcNull );
-        else
-        {
-            size_t src_size, dst_size;
-            uint32_t len = wchar_cvt_string_measure ( wide_sys_path, & src_size, & dst_size );
-            if ( len == 0 )
-                rc = RC ( rcVFS, rcMgr, rcConstructing, rcPath, rcEmpty );
-            else
-            {
-                /* transform to UTF-8 */
-                size_t copy_size;
-                char utf8_path [ 4096 ], *dst = utf8_path;
-                if ( dst_size < sizeof utf8_path )
-                    dst_size = sizeof utf8_path;
-                else
-                {
-                    dst = malloc ( ++ dst_size );
-                    if ( dst == NULL )
-                        rc = RC ( rcVFS, rcMgr, rcConstructing, rcMemory, rcExhausted );
-                }
-
-                copy_size = wchar_cvt_string_copy ( dst, dst_size, wide_sys_path, src_size );
-                if ( copy_size >= dst_size )
-                    rc = RC ( rcVFS, rcMgr, rcConstructing, rcBuffer, rcInsufficient );
-                else
-                {
-                    dst [ copy_size ] = 0;
-                    rc = VFSManagerMakePath ( self, new_path, "%s", dst );
-                }
-
-                if ( dst != utf8_path )
-                    free ( dst );
-
-                if ( rc == 0 )
-                    return 0;
-            }
-        }
-
-        * new_path = NULL;
-    }
-
-    return rc;
-}
-
-/* ==========================================
-             HACK O' MATIC
- */
-
-LIB_EXPORT rc_t LegacyVPathMakeSysPath ( VPath ** new_path, const char * sys_path )
-{
-    return LegacyVPathMake ( new_path, sys_path );
-}
diff --git a/libs/vfs/win/syskeyring.c b/libs/vfs/win/syskeyring.c
deleted file mode 100644
index 54ee745..0000000
--- a/libs/vfs/win/syskeyring.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <vfs/keyring-priv.h>
-
-#include <kfg/config.h>
-#include <klib/text.h>
-
-const char* KeyRingDefaultDataDir = "%USERPROFILE%\\.ncbi";
-
-rc_t StartKeyRing(const char* dataDir)
-{
-    KConfig* kfg;
-    rc_t rc = KConfigMake(&kfg, NULL);
-    if (rc == 0)
-    {
-        const KConfigNode *node;
-        char path[] = "$(APPPATH)";
-        char buf[4096];
-        size_t num_read;
-    
-        rc_t rc=KConfigOpenNodeRead(kfg, &node, path, string_measure(path, NULL), buf);
-        if (rc == 0) 
-        {
-            rc = KConfigNodeRead(node, 0, buf, sizeof(buf), &num_read, NULL);
-            if (rc == 0)
-            {
-/*printf("apppath='%s'\n", buf);        */
-            }
-            KConfigNodeRelease(node);
-        }
-        rc = KConfigRelease(kfg);
-    }
-    return rc;
-}
diff --git a/libs/vfs/win/syspath.c b/libs/vfs/win/syspath.c
deleted file mode 100644
index 2c9a849..0000000
--- a/libs/vfs/win/syspath.c
+++ /dev/null
@@ -1,343 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vfs/extern.h>
-
-#include <vfs/manager.h>
-#include <vfs/path.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <klib/log.h>
-#include <klib/out.h>
-#include <klib/debug.h>
-
-#include "../path-priv.h"
-
-#include <wchar.h>
-#include <windows.h>
-#include <direct.h>
-
-#include <sysalloc.h>
-
-/*--------------------------------------------------------------------------
- * VFSManager
- */
-
-
-/* MakeSysPath
- *  make a path object from an OS native filesystem path string
- *
- *  "new_path" [ OUT ] - return parameter for new path object
- *
- *  "sys_path" [ IN ] - a UTF-8 NUL-terminated string
- *  representing a native filesystem path
- *
- *  "wide_sys_path" [ IN ] - a wide NUL-terminated string
- *  representing a native filesystem path, where
- *  wchar_t is either USC-2 or UTF-32 depending upon libraries
- */
-LIB_EXPORT rc_t CC VFSManagerMakeSysPath ( const VFSManager * self,
-    VPath ** new_path, const char * sys_path )
-{
-    rc_t rc = 0;
-
-    /* this is all incorrect - the only reason we STILL use
-       wchar_t in Windows is to guarantee UNICODE. most of the
-       time, we'll have UTF-8, which is okay. but on older systems,
-       it could still be something ancient. should use OS
-       to convert from system path to UCS-2. */
-
-    if ( new_path == NULL )
-        rc = RC ( rcVFS, rcMgr, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVFS, rcMgr, rcConstructing, rcSelf, rcNull );
-        else if ( sys_path == NULL )
-            rc = RC ( rcVFS, rcMgr, rcConstructing, rcPath, rcNull );
-        else
-        {
-            size_t src_size = string_size ( sys_path );
-
-            /* transform to wchar_t */
-            wchar_t wchar_path [ 4096 ], * dst = wchar_path;
-            size_t copy_size, dst_size = src_size * sizeof wchar_path [ 0 ];
-            if ( dst_size < sizeof wchar_path )
-                dst_size = sizeof wchar_path;
-            else
-            {
-                dst = malloc ( dst_size += sizeof * dst );
-                if ( dst == NULL )
-                    rc = RC ( rcVFS, rcMgr, rcConstructing, rcMemory, rcExhausted );
-            }
-
-            if ( rc == 0 )
-            {
-                /* we need to call windows to do the conversion, because sys_path can
-                   be ascii or multi-byte */
-                copy_size = MultiByteToWideChar(    CP_THREAD_ACP,
-                                        MB_PRECOMPOSED,
-                                        sys_path,
-                                        ( int )src_size,
-                                        dst,
-                                        ( int ) ( dst_size / sizeof dst[ 0 ] ) - 1 );
-                if ( copy_size == 0 )
-                {
-                    DWORD status = GetLastError ();
-                    DBGMSG ( DBG_VFS, DBG_FLAG_ANY, ( "MultiByteToWideChar: error code - %!.\n", status ) );
-                    rc = RC ( rcVFS, rcMgr, rcConstructing, rcPath, rcInvalid );
-                }
-                else
-                {
-                    dst [ copy_size ] = 0;
-                    rc = VFSManagerWMakeSysPath ( self, new_path, dst );
-                }
-
-                if ( dst != wchar_path )
-                    free ( dst );
-
-                if ( rc == 0 )
-                    return 0;
-
-            }
-        }
-
-        * new_path = NULL;
-    }
-
-    return rc;
-}
-
-
-static rc_t transform_to_utf8_and_make_vpath( const VFSManager * self,
-                                              VPath ** new_path,
-                                              const wchar_t * src )
-{
-    rc_t rc = 0;
-    size_t src_size, dst_size;
-    uint32_t len = wchar_cvt_string_measure ( src, & src_size, & dst_size );
-    if ( len == 0 )
-        rc = RC ( rcVFS, rcMgr, rcConstructing, rcPath, rcEmpty );
-    else
-    {
-        /* transform to UTF-8 */
-        size_t copy_size;
-        char utf8_path [ 4096 ], *dst = utf8_path;
-        if ( dst_size < sizeof utf8_path )
-            dst_size = sizeof utf8_path;
-        else
-        {
-            dst = malloc ( ++ dst_size );
-            if ( dst == NULL )
-                return RC ( rcVFS, rcMgr, rcConstructing, rcMemory, rcExhausted );
-        }
-
-        copy_size = wchar_cvt_string_copy ( dst, dst_size, src, src_size );
-        if ( copy_size >= dst_size )
-            rc = RC ( rcVFS, rcMgr, rcConstructing, rcBuffer, rcInsufficient );
-        else
-        {
-            size_t i;
-
-            dst [ copy_size ] = 0;
-
-            /* convert '\\' to '/' */
-            for ( i = 0; i < copy_size; ++ i )
-            {
-                if ( dst [ i ] == '\\' )
-                    dst [ i ] = '/';
-            }
-
-            /* this is the final goal! */
-            rc = VFSManagerMakePath ( self, new_path, "%.*s", ( uint32_t ) copy_size, dst );
-        }
-
-        if ( dst != utf8_path )
-            free ( dst );
-    }
-    return rc;
-}
-
-
-static rc_t make_absolute_and_transform_to_utf8_and_make_vpath( const VFSManager * self,
-                                              VPath ** new_path,
-                                              const wchar_t * src )
-{
-    rc_t rc;
-    wchar_t full [ 4096 ];
-
-    /* expand to full path - this is temporary, and will be replaced after KFS is updated */
-    DWORD len = GetFullPathNameW ( src, sizeof full / sizeof full [ 0 ], full, NULL );
-    if ( len == 0 )
-    {
-        /* we have an error */
-        DWORD status = GetLastError ();
-        DBGMSG ( DBG_VFS, DBG_FLAG_ANY, ( "GetFullPathNameW: error code - %u.\n", status ) );
-        rc = RC ( rcVFS, rcMgr, rcConstructing, rcPath, rcInvalid );
-    }
-    else if ( len >= sizeof full / sizeof full [ 0 ] )
-    {
-        /* the buffer is too small ! */
-        wchar_t * big_buf = malloc( ( ++len ) * ( sizeof full[ 0 ] ) );
-        if ( big_buf == NULL )
-            rc = RC ( rcVFS, rcMgr, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            DWORD len2 = GetFullPathNameW ( src, len, big_buf, NULL );
-            if ( len2 == 0 )
-            {
-                /* we have an error */
-                DWORD status = GetLastError ();
-                DBGMSG ( DBG_VFS, DBG_FLAG_ANY, ( "GetFullPathNameW: error code - %u.\n", status ) );
-                rc = RC ( rcVFS, rcMgr, rcConstructing, rcPath, rcInvalid );
-            }
-            else if ( len2 >= len )
-            {
-                DBGMSG ( DBG_VFS, DBG_FLAG_ANY, ( "GetFullPathNameW: buffer too small again - %u.\n", len2 ) );
-                rc = RC ( rcVFS, rcMgr, rcConstructing, rcPath, rcInvalid );
-            }
-            else
-            {
-                /* now we can call the final transform and make */
-                rc = transform_to_utf8_and_make_vpath( self, new_path, big_buf );
-            }
-            free( big_buf );
-        }
-    }
-    else
-    {
-        /* now we can call the final transform and make */
-        rc = transform_to_utf8_and_make_vpath( self, new_path, full );
-    }
-    return rc;
-}
-
-static
-bool could_be_url ( const wchar_t * wide_sys_path )
-{
-    uint32_t i;
-    for ( i = 0; wide_sys_path [ i ] != 0; ++ i )
-    {
-        if ( wide_sys_path [ i ] == ':' )
-        {
-            if ( i < 3 || i > 16 )
-                break;
-            for ( ++ i; wide_sys_path [ i ] != 0; ++ i )
-            {
-                if ( wide_sys_path [ i ] == '\\' )
-                    return false;
-            }
-            return true;
-        }
-
-        if ( wide_sys_path [ i ] == '\\' )
-            break;
-    }
-    return false;
-}
-
-
-LIB_EXPORT rc_t CC VFSManagerWMakeSysPath ( const VFSManager * self,
-    VPath ** new_path, const wchar_t * wide_sys_path )
-{
-    rc_t rc = 0;
-
-    /* what makes Windows paths exciting is that they
-       have these drive letters, or they can be UNC,
-       but they can be relative to the current drive,
-       and they can use back-slashes because they're
-       easy to type, or they can use forward-slashes,
-       whatever. */
-
-    if ( new_path == NULL )
-        rc = RC ( rcVFS, rcMgr, rcConstructing, rcParam, rcNull );
-    else
-    {
-        if ( self == NULL )
-            rc = RC ( rcVFS, rcMgr, rcConstructing, rcSelf, rcNull );
-        else if ( wide_sys_path == NULL )
-            rc = RC ( rcVFS, rcMgr, rcConstructing, rcPath, rcNull );
-        else
-        {
-            if ( ( wide_sys_path [ 0 ] == '\\' && wide_sys_path [ 1 ] == '\\' ) ||
-                 ( wide_sys_path [ 0 ] == '/'  && wide_sys_path [ 1 ] == '/'  ) )
-            {
-                /* it is an unc-path */
-
-                /* reject IO or device namespaces */
-                if ( ( wide_sys_path [ 2 ] ==  '?' || wide_sys_path [ 2 ] == '.' ) &&
-                     ( wide_sys_path [ 3 ] == '\\' || wide_sys_path [ 3 ] == '/' ) )
-                    return RC ( rcVFS, rcPath, rcConstructing, rcPath, rcIncorrect );
-
-                /* produce the VPath-instance from the passed in string */
-                rc = transform_to_utf8_and_make_vpath( self, new_path,  wide_sys_path );
-            }
-            else
-            {
-                /* it is not an unc-path */
-                if ( iswalpha ( wide_sys_path [ 0 ] ) && wide_sys_path [ 1 ] == ':' )
-                {
-                    /* drive letter detected */
-                    if ( wide_sys_path [ 2 ] != '\\' && wide_sys_path [ 2 ] != '/' )
-                    {
-                        /* no absolute path, we have make a absolute path first */
-                        rc = make_absolute_and_transform_to_utf8_and_make_vpath( self, new_path, wide_sys_path );
-                    }
-                    else
-                    {
-                        /* produce the VPath-instance from the passed in string */
-                        rc = transform_to_utf8_and_make_vpath( self, new_path,  wide_sys_path );
-                    }
-                }
-                else if ( could_be_url ( wide_sys_path ) )
-                    rc = transform_to_utf8_and_make_vpath( self, new_path,  wide_sys_path );
-                else
-                {
-                    /* no drive letter detected, we have make a absolute path first */
-                    rc = make_absolute_and_transform_to_utf8_and_make_vpath( self, new_path, wide_sys_path );
-                }
-            }
-        }
-    }
-    return rc;
-}
-
-
-/* ==========================================
-             HACK O' MATIC
- */
-
-LIB_EXPORT rc_t LegacyVPathMakeSysPath ( VPath ** new_path, const char * sys_path )
-{
-    VFSManager * vfs;
-    rc_t rc = VFSManagerMake ( & vfs );
-    if ( rc == 0 )
-    {
-        rc = VFSManagerMakeSysPath ( vfs, new_path, sys_path );
-        VFSManagerRelease ( vfs );
-    }
-    return rc;
-}
diff --git a/libs/vxf/Makefile b/libs/vxf/Makefile
deleted file mode 100644
index 1afc882..0000000
--- a/libs/vxf/Makefile
+++ /dev/null
@@ -1,162 +0,0 @@
-# ===========================================================================
-#
-#                            PUBLIC DOMAIN NOTICE
-#               National Center for Biotechnology Information
-#
-#  This software/database is a "United States Government Work" under the
-#  terms of the United States Copyright Act.  It was written as part of
-#  the author's official duties as a United States Government employee and
-#  thus cannot be copyrighted.  This software/database is freely available
-#  to the public for use. The National Library of Medicine and the U.S.
-#  Government have not placed any restriction on its use or reproduction.
-#
-#  Although all reasonable efforts have been taken to ensure the accuracy
-#  and reliability of the software and data, the NLM and the U.S.
-#  Government do not and cannot warrant the performance or results that
-#  may be obtained by using this software or data. The NLM and the U.S.
-#  Government disclaim all warranties, express or implied, including
-#  warranties of performance, merchantability or fitness for any particular
-#  purpose.
-#
-#  Please cite the author in any work or product based on this material.
-#
-# ===========================================================================
-
-
-default: std
-
-TOP ?= $(shell ../../build/abspath.sh ../..)
-MODULE = libs/vxf
-
-INT_LIBS = \
-	libvxf \
-	libwvxf
-
-include $(TOP)/build/Makefile.env
-
-RWORKDIR = $(BINDIR)
-
-ALL_LIBS = \
-	$(INT_LIBS)
-
-#-------------------------------------------------------------------------------
-# outer targets
-#
-all std: makedirs
-	@ $(MAKE_CMD) $(TARGDIR)/std
-
-$(INT_LIBS): makedirs
-	@ $(MAKE_CMD) $(TARGDIR)/$@
-
-.PHONY: all std $(ALL_LIBS)
-
-#-------------------------------------------------------------------------------
-# std
-#
-$(TARGDIR)/std: \
-	$(addprefix $(TARGDIR)/,$(INT_LIBS))
-
-.PHONY: $(TARGDIR)/std
-
-#-------------------------------------------------------------------------------
-# clean
-#
-clean: stdclean
-
-.PHONY: clean
-
-#-------------------------------------------------------------------------------
-# vdb transform library
-#
-$(TARGDIR)/libvxf: $(addprefix $(ILIBDIR)/libvxf.,$(ILIBEXT))
-
-VXF_SRC = \
-	ceil \
-	clip \
-	cut \
-	echo \
-	exists \
-	floor \
-	paste \
-	round \
-	trunc \
-	unzip \
-	map \
-	funzip \
-	vec-sum \
-	min \
-	max \
-	rldecode \
-	pack \
-	unpack \
-	izip \
-	iunzip \
-	diff \
-	sum \
-	bit_or \
-	trim \
-	deriv \
-	integral \
-	integral_0 \
-	delta \
-	undelta \
-	add-row-id \
-	subtract-row-id \
-	irzip \
-	rand_4na_2na \
-	outlier-encoder \
-	outlier-decoder \
-	bunzip \
-	simple-sub-select \
-	extract_token \
-	strtonum \
-	sprintf \
-	wgs-tokenize-accession \
-	lower-case-tech-reads
-
-VXF_OBJ = \
-	$(addsuffix .$(LOBX),$(VXF_SRC))
-
-VXF_LIB = \
-	-dvdb \
-	-dklib \
-	-dm \
-	-dz \
-	-dbz2
-
-$(ILIBDIR)/libvxf.$(LIBX): $(VXF_OBJ)
-	$(LD) --slib -o $@ $^ $(VXF_LIB)
-
-#-------------------------------------------------------------------------------
-# wvdb transform library
-#
-
-$(TARGDIR)/libwvxf: $(addprefix $(ILIBDIR)/libwvxf.,$(ILIBEXT))
-
-WVXF_SRC = \
-	$(VXF_SRC) \
-	zip \
-	bzip \
-	fzip \
-	rlencode \
-	checksum
-
-WVXF_OBJ = \
-	$(addsuffix .$(LOBX),$(WVXF_SRC))
-
-# temporary
-WVXF_LIB = \
-	-dwvdb \
-	-dwkdb \
-	-dklib \
-	-dm \
-	-dz \
-	-dbz2
-
-$(ILIBDIR)/libwvxf.$(LIBX): $(WVXF_OBJ)
-	$(LD) --slib -o $@ $^ $(WVXF_LIB)
-
-libwvxf.vers.h:
-	@ true
-
-.PHONY: $(TARGDIR)/libwvxf
diff --git a/libs/vxf/add-row-id.c b/libs/vxf/add-row-id.c
deleted file mode 100644
index b07e9c2..0000000
--- a/libs/vxf/add-row-id.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-#include <vdb/xform.h>
-#include <arch-impl.h>
-#include <klib/data-buffer.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-static
-rc_t CC add_int64_t ( void *self, const VXformInfo *info,
-    int64_t row_id, VRowResult *rslt,
-    uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    uint32_t i;
-    int64_t *dst;
-    const int64_t *src = argv [ 0 ] . u . data . base;
-    uint64_t elem_count = argv [ 0 ] . u . data . elem_count;
-
-    assert ( rslt -> data -> elem_bits == 64 );
-    rc = KDataBufferResize ( rslt -> data, elem_count );
-    if ( rc != 0 )
-        return rc;
-
-    dst = rslt -> data -> base;
-    rslt -> elem_count = elem_count;
-
-    /* while this function is typically used on single-element rows,
-       we advertise taking rows of any length... */
-    for ( i = 0, src += argv [ 0 ] . u . data . first_elem; i < elem_count; ++ i )
-        dst [ i ] = src [ i ] + row_id;
-
-    return 0;
-}
-
-
-/* add_row_id
- *  return the sum of input and current row id
- *
- *  "in" [ DATA ]
- *
- * SYNOPSIS:
- *  corrects for series that have been offset by row-id
- */
-VTRANSFACT_IMPL ( vdb_add_row_id, 1, 0, 0 ) ( const void *fself, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    /* version 1.0 operates on I64 input */
-    rslt -> u . ndf = add_int64_t;
-    rslt -> variant = vftNonDetRow;
-    return 0;
-}
diff --git a/libs/vxf/bit_or.c b/libs/vxf/bit_or.c
deleted file mode 100644
index 644ea53..0000000
--- a/libs/vxf/bit_or.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-#include <vdb/xform.h>
-#include <vdb/table.h>
-#include <vdb/vdb-priv.h>
-#include <klib/rc.h>
-#include <klib/data-buffer.h>
-#include <klib/log.h>
-#include <sysalloc.h>
-#include <atomic32.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-
-#include <assert.h>
-
-typedef struct tag_self_t {
-    uint8_t     align;
-} self_t;
-
-static void CC self_whack( void *Self )
-{
-    free( Self );
-}
-static
-rc_t CC bit_or_impl(
-                 void *Self,
-                 const VXformInfo *info,
-                 int64_t row_id,
-                 VRowResult *rslt,
-                 uint32_t argc,
-                 const VRowData argv[]
-                          )
-{                                                                        
-    rc_t rc;
-    uint32_t a_size,b_size;
-    const self_t *self = Self;
-    const uint8_t *a = argv[0].u.data.base;
-    const uint8_t *b = argv[1].u.data.base;
-    uint8_t *dst;
-
-    a += argv[0].u.data.first_elem;
-    b += argv[1].u.data.first_elem;
-
-    assert((argv[0].u.data.elem_bits&7)== 0);
-    assert(argv[1].u.data.elem_bits==argv[0].u.data.elem_bits);
-
-    rslt->elem_bits = argv[0].u.data.elem_bits;
-    
-    a_size = argv[0].u.data.elem_count * (argv[0].u.data.elem_bits>>3);
-    b_size = argv[1].u.data.elem_count * (argv[1].u.data.elem_bits>>3);
-    if(a_size >= b_size){ /**** leaving a > b *****/
-	rslt->elem_count = argv[0].u.data.elem_count;
-    } else { /*** switching so  a > b ***/
-	const uint8_t *t;
-	uint32_t       t_size;
-	rslt->elem_count = argv[1].u.data.elem_count;
-	t=a;a=b;b=t;
-	t_size=a_size;a_size=b_size;b_size=t_size;
-    } 
-    /*** everything a is now the largest ***/
-    rc = KDataBufferResize ( rslt->data, a_size );
-    if(rc==0){
-	dst = rslt -> data -> base;
-
-	if(b_size == 0){/*** trivial shortcut ***/
-		memcpy(dst,a,a_size);
-		return 0;
-	}
-	if(self -> align == 1){ /*** left side align ***/
-		while(a_size > b_size){
-			*dst++ = *a++;
-			a_size--;
-		}
-	}
-	while(b_size > 0){
-		*dst++ = *a++ | *b++;
-		a_size--;
-		b_size--;
-		
-	}
-	while(a_size > 0){
-		*dst++ = *a++;
-                a_size--;
-	}
-    }
-    return 0;
-}
-
-VTRANSFACT_IMPL ( vdb_bit_or, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rc_t rc;
-    self_t *self;
-            
-    self = malloc(sizeof(*self));
-    if (self) {
-	self->align = cp->argv[0].data.u8[0];
-	rslt->self = self;
-	rslt->whack = self_whack;
-	rslt->variant = vftRow;
-	rslt->u.rf = bit_or_impl;
-	return 0;
-    }
-    rc = RC(rcVDB, rcFunction, rcConstructing, rcMemory, rcExhausted);
-    return rc;
-}
diff --git a/libs/vxf/bunzip.c b/libs/vxf/bunzip.c
deleted file mode 100644
index 3ea4309..0000000
--- a/libs/vxf/bunzip.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <vdb/vdb-priv.h>
-#include <klib/data-buffer.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <endian.h>
-#include <byteswap.h>
-#include <string.h>
-#include <bzlib.h>
-
-static rc_t invoke_bzip2 ( void *dst, size_t dsize, const void *src, size_t ssize )
-{
-    int bzerr;
-
-    bz_stream s;
-    memset ( & s, 0, sizeof s );
-    bzerr = BZ2_bzDecompressInit ( & s, 0, 0 );
-    if ( bzerr != BZ_OK )
-        return RC ( rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted );
-
-    s.next_in = (void *)src;
-    s.avail_in = ssize;
-    s.next_out = dst;
-    s.avail_out = dsize;
-    
-    bzerr = BZ2_bzDecompress(&s);
-    BZ2_bzDecompressEnd ( & s );
-
-    switch ( bzerr )
-    {
-    case BZ_OK:
-    case BZ_STREAM_END:
-        break;
-    default:
-        return RC(rcXF, rcFunction, rcExecuting, rcNoObj, rcUnexpected);
-    }
-
-    return 0;
-}
-
-static
-rc_t bunzip_func_v1 ( const VXformInfo *info, VBlobResult *dst, const VBlobData *src )
-{
-    dst->byte_order = src->byte_order;
-    return invoke_bzip2 ( dst->data, (((size_t)dst->elem_count * dst->elem_bits + 7) >> 3),
-                          src->data, (((size_t)src->elem_count * src->elem_bits + 7) >> 3));
-}
-
-static
-rc_t bunzip_func_v2 ( const VXformInfo *info,
-    VBlobResult *dst, const VBlobData *src, VBlobHeader *hdr )
-{
-    int64_t trailing;
-    rc_t rc = VBlobHeaderArgPopHead ( hdr, & trailing );
-    if ( rc == 0 )
-    {
-        dst -> elem_count *= dst -> elem_bits;
-        dst -> byte_order = src -> byte_order;
-        dst -> elem_bits = 1;
-
-        rc = invoke_bzip2 ( dst->data, (((size_t)dst->elem_count + 7) >> 3),
-                            src->data, (((size_t)src->elem_count * src->elem_bits + 7) >> 3));
-        if ( rc == 0 )
-        {
-            dst -> elem_count &= ( uint64_t ) ~ 7;
-            dst -> elem_count |= trailing;
-        }
-    }
-
-    return rc;
-}
-
-
-static
-rc_t CC bunzip_func ( void *Self, const VXformInfo *info,
-    VBlobResult *dst, const VBlobData *src, VBlobHeader *hdr )
-{
-    switch ( VBlobHeaderVersion ( hdr ) )
-    {
-    case 1:
-        return bunzip_func_v1(info, dst, src);
-    case 2:
-        return bunzip_func_v2(info, dst, src, hdr);
-    }
-
-    return RC(rcXF, rcFunction, rcExecuting, rcParam, rcBadVersion);
-}
-
-/* bunzip
- *  function any bunzip #1.0 ( bzip2_fmt in );
- */
-VTRANSFACT_IMPL ( vdb_bunzip, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->variant = vftBlob;
-    rslt->u.bf = bunzip_func;
-
-    return 0;
-}
diff --git a/libs/vxf/bzip.c b/libs/vxf/bzip.c
deleted file mode 100644
index 1070503..0000000
--- a/libs/vxf/bzip.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <klib/data-buffer.h>
-#include <sysalloc.h>
-
-#include <string.h>
-#include <bzlib.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#include <stdio.h>
-#include <assert.h>
-
-#define BUFFER_GROWTH_RATE (128 * 1024)
-
-typedef struct bzip_t bzip_t;
-struct bzip_t
-{
-    int32_t blockSize100k;
-    int32_t workFactor;
-};
-
-#if _DEBUGGING
-static
-void debug_print_bz_stream(const bz_stream *s)
-{
-    printf("avail_in: %u, avail_out: %u, total_in_lo32: %u, total_in_hi32: %u, total_out_lo32: %u, total_out_hi32: %u\n",
-           s->avail_in,
-           s->avail_out,
-           s->total_in_lo32, s->total_in_hi32,
-           s->total_out_lo32, s->total_out_hi32);
-}
-#endif
-
-static
-rc_t invoke_bzip2 ( bzip_t *self, void *dst, uint32_t *dsize, const void *src, uint32_t ssize)
-{
-    int bzerr;
-
-    bz_stream s;
-    memset ( & s, 0, sizeof s );
-    bzerr = BZ2_bzCompressInit ( & s, self -> blockSize100k, 0, self -> workFactor );
-    if ( bzerr != BZ_OK )
-        return RC ( rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted );
-    
-    s.next_in = (void *)src;
-    s.avail_in = ssize;
-    s.next_out = dst;
-    s.avail_out = *dsize;
-    
-    *dsize = 0;
-    bzerr = BZ2_bzCompress(&s, BZ_FINISH);
-    switch (bzerr)
-    {
-    case BZ_OK:
-    case BZ_RUN_OK:
-    case BZ_FINISH_OK:
-    case BZ_STREAM_END:
-        break;
-    default:
-#if _DEBUGGING
-        fprintf(stderr, "BZ2_bzCompress: unexpected bzip2 error %i\n", bzerr);
-#endif
-        BZ2_bzCompressEnd ( & s );
-        return RC(rcXF, rcFunction, rcExecuting, rcSelf, rcUnexpected);
-    }
-
-    assert ( s.total_out_hi32 == 0 );
-    *dsize = s.total_out_lo32;
-
-
-    BZ2_bzCompressEnd ( & s );
-
-    return 0;
-}
-
-static
-rc_t CC bzip_func ( void *Self, const VXformInfo *info,
-    VBlobResult *dst, const VBlobData *src, VBlobHeader *hdr )
-{
-    rc_t rc;
-    bzip_t *self = Self;
-
-    /* input bits */
-    uint64_t sbits = ( uint64_t) src -> elem_count * src -> elem_bits;
-
-    /* input bytes */
-    uint32_t ssize = ( uint32_t ) ( ( sbits + 7 ) >> 3 );
-
-    /* required output size */
-    uint32_t dsize = ( uint32_t ) ( ( ( size_t ) dst -> elem_count * dst->elem_bits + 7 ) >> 3 );
-
-    if ( ( sbits & 7 ) == 0 )
-        /* version 1 is byte-aligned */
-        VBlobHeaderSetVersion ( hdr, 1 );
-    else
-    {
-        VBlobHeaderSetVersion ( hdr, 2 );
-        VBlobHeaderArgPushTail ( hdr, ( int64_t ) ( sbits & 7 ) );
-    }
-
-    rc = invoke_bzip2 ( self, dst -> data, & dsize, src -> data, ssize);
-    if (rc == 0)
-    {
-        dst->elem_bits = 1;
-        dst->byte_order = src->byte_order;
-        if (dsize != 0)
-            dst->elem_count = dsize << 3;
-        else
-            rc = RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-    }
-
-    return rc;
-}
-
-/* bzip
- * function bzip2_fmt bzip #1.0 < * U32 blockSize100k, U32 workFactor > ( any in );
- */
-VTRANSFACT_IMPL ( vdb_bzip, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    bzip_t *fself;
-
-    int blockSize100k = 5;
-    int workFactor = 0;
-
-    if ( cp -> argc > 0 )
-    {
-        blockSize100k = cp -> argv [ 0 ] . data . i32 [ 0 ];
-        if ( blockSize100k < 1 || blockSize100k > 9 )
-            return RC(rcXF, rcFunction, rcConstructing, rcParam, rcInvalid);
-        if ( cp -> argc > 1 )
-        {
-            workFactor = cp -> argv [ 1 ] . data . i32 [ 0 ];
-            if ( workFactor > 250 )
-                return RC(rcXF, rcFunction, rcConstructing, rcParam, rcInvalid);
-        }
-    }
-
-    fself = malloc ( sizeof *fself );
-    if ( fself == NULL )
-        return RC ( rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted );
-    fself -> blockSize100k = blockSize100k;
-    fself -> workFactor = workFactor;
-
-    rslt->self = fself;
-    rslt->whack = free;
-    rslt->variant = vftBlob;
-    rslt->u.bf = bzip_func;
-        
-    return 0;
-}
diff --git a/libs/vxf/ceil.c b/libs/vxf/ceil.c
deleted file mode 100644
index 141d868..0000000
--- a/libs/vxf/ceil.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <math.h>
-#include <assert.h>
-
-#define FLOAT_FUNC ceilf
-#define DOUBLE_FUNC ceil
-#include "math-funcs-impl.h"
-
-/*
- function < type T >
- T vdb:ceil #1.0 ( T in );
- */
-VTRANSFACT_IMPL(vdb_ceil, 1, 0, 0) (const void *self, const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp ) {
-    return factory(self, info, rslt, cp, dp);
-}
diff --git a/libs/vxf/checksum.c b/libs/vxf/checksum.c
deleted file mode 100644
index 37b3903..0000000
--- a/libs/vxf/checksum.c
+++ /dev/null
@@ -1,566 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <vdb/extern.h>
-#include <vdb/xform.h>
-#include <vdb/table.h>
-#include <vdb/schema.h>
-#include <kdb/meta.h>
-#include <klib/checksum.h>
-#include <klib/text.h>
-#include <klib/rc.h>
-
-#include <sysalloc.h>
-
-#include <bitstr.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-typedef struct CRC32State CRC32State;
-struct CRC32State
-{
-    uint64_t len;
-    uint32_t crc;
-};
-
-typedef struct checksum checksum;
-struct checksum
-{
-    KMetadata *meta;
-
-    void ( * swap ) ( checksum *self );
-    void ( * sum ) ( checksum *self, const void *data, size_t bytes );
-    size_t ( * digest ) ( checksum *self, uint8_t *buff, size_t bsize );
-
-    size_t valid;
-    union
-    {
-        CRC32State crc32;
-        MD5State md5;
-        SHA1State sha1;
-        SHA256State sha256;
-        SHA384State sha384;
-        SHA512State sha512;
-        uint8_t buff [ 1 ];
-    } u;
-
-    bool byte_swap;
-    char node [ 1 ];
-};
-
-/*--------------------------------------------------------------------------
- * CRC32
- */
-static
-void vdb_crc32swap ( checksum *self )
-{
-    self -> u . crc32 . len = bswap_64 ( self -> u . crc32 . len );
-    self -> u . crc32 . crc = bswap_32 ( self -> u . crc32 . crc );
-}
-
-static
-void vdb_crc32sum ( checksum *self, const void *data, size_t bytes )
-{
-    self -> u . crc32 . crc = CRC32 ( self -> u . crc32 . crc, data, bytes );
-    self -> u . crc32 . len += bytes;
-}
-
-static
-size_t vdb_crc32digest ( checksum *self, uint8_t *buff, size_t bsize )
-{
-    uint64_t len = self -> u . crc32 . len;
-    uint8_t ch[sizeof(len)];
-    unsigned i;
-
-    assert ( bsize >= 4 );
-
-    for (i = 0; len; len >>= 8, ++i)
-        ch[i] = (uint8_t)len;
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-    * ( uint32_t* ) buff = bswap_32 ( ~ CRC32 ( self -> u . crc32 . crc, ch, i ) );
-#else
-    * ( uint32_t* ) buff =  ~ CRC32 ( self -> u . crc32 . crc, ch, i );
-#endif
-    return 4;
-}
-
-/*--------------------------------------------------------------------------
- * md5
- */
-static
-void vdb_md5swap ( checksum *self )
-{
-    self -> u . md5 . count [ 0 ] = bswap_32 ( self -> u . md5 . count [ 0 ] );
-    self -> u . md5 . count [ 1 ] = bswap_32 ( self -> u . md5 . count [ 1 ] );
-    self -> u . md5 . abcd [ 0 ] = bswap_32 ( self -> u . md5 . abcd [ 0 ] );
-    self -> u . md5 . abcd [ 1 ] = bswap_32 ( self -> u . md5 . abcd [ 1 ] );
-    self -> u . md5 . abcd [ 2 ] = bswap_32 ( self -> u . md5 . abcd [ 2 ] );
-    self -> u . md5 . abcd [ 3 ] = bswap_32 ( self -> u . md5 . abcd [ 3 ] );
-}
-
-static
-void vdb_md5sum ( checksum *self, const void *data, size_t bytes )
-{
-    MD5StateAppend ( & self -> u . md5, data, bytes );
-}
-
-static
-size_t vdb_md5digest ( checksum *self, uint8_t *buff, size_t bsize )
-{
-    assert ( bsize >= 16 );
-    MD5StateFinish ( & self -> u . md5, buff );
-    return 16;
-}
-
-/*--------------------------------------------------------------------------
- * sha1
- */
-static
-void vdb_sha32swap ( checksum *self )
-{
-    unsigned int i;
-    self -> u . sha1 . len = bswap_64 ( self -> u . sha1 . len );
-    for ( i = 0; i < 8; ++ i )
-        self -> u . sha1 . H [ i ] = bswap_32 ( self -> u . sha1 . H [ i ] );
-    self -> u . sha1 . cur = bswap_32 ( self -> u . sha1 . cur );
-}
-
-static
-void vdb_sha1sum ( checksum *self, const void *data, size_t bytes )
-{
-    SHA1StateAppend ( & self -> u . sha1, data, bytes );
-}
-
-static
-size_t vdb_sha1digest ( checksum *self, uint8_t *buff, size_t bsize )
-{
-    assert ( bsize >= 20 );
-    SHA1StateFinish ( & self -> u . sha1, buff );
-    return 20;
-}
-
-/*--------------------------------------------------------------------------
- * sha256
- */
-static
-void vdb_sha256sum ( checksum *self, const void *data, size_t bytes )
-{
-    SHA256StateAppend ( & self -> u . sha256, data, bytes );
-}
-
-static
-size_t vdb_sha256digest ( checksum *self, uint8_t *buff, size_t bsize )
-{
-    assert ( bsize >= 32 );
-    SHA256StateFinish ( & self -> u . sha256, buff );
-    return 32;
-}
-
-/*--------------------------------------------------------------------------
- * sha384
- */
-static
-void vdb_sha64swap ( checksum *self )
-{
-    unsigned int i;
-    self -> u . sha384 . len = bswap_64 ( self -> u . sha384 . len );
-    for ( i = 0; i < 8; ++ i )
-        self -> u . sha384 . H [ i ] = bswap_64 ( self -> u . sha384 . H [ i ] );
-    self -> u . sha384 . cur = bswap_32 ( self -> u . sha384 . cur );
-}
-
-static
-void vdb_sha384sum ( checksum *self, const void *data, size_t bytes )
-{
-    SHA384StateAppend ( & self -> u . sha384, data, bytes );
-}
-
-static
-size_t vdb_sha384digest ( checksum *self, uint8_t *buff, size_t bsize )
-{
-    assert ( bsize >= 48 );
-    SHA384StateFinish ( & self -> u . sha384, buff );
-    return 48;
-}
-
-/*--------------------------------------------------------------------------
- * sha512
- */
-static
-void vdb_sha512sum ( checksum *self, const void *data, size_t bytes )
-{
-    SHA512StateAppend ( & self -> u . sha512, data, bytes );
-}
-
-static
-size_t vdb_sha512digest ( checksum *self, uint8_t *buff, size_t bsize )
-{
-    assert ( bsize >= 64 );
-    SHA512StateFinish ( & self -> u . sha512, buff );
-    return 64;
-}
-
-
-/*--------------------------------------------------------------------------
- * general checksum function
- */
-static
-rc_t CC checksum_driver ( void *obj, const VXformInfo *info,
-    int64_t row_id, VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    checksum *self = obj;
-
-    /* we ensured the input was an octet-stream within the factory */
-    uint32_t elem_bytes = argv [ 0 ] . u . data . elem_bits >> 3;
-    const uint8_t *src = argv [ 0 ] . u . data . base;
-    uint64_t count = argv [ 0 ] . u . data . elem_count;
-
-    src += argv [ 0 ] . u . data . first_elem * elem_bytes;
-    count *= elem_bytes;
-
-    ( * self -> sum ) ( self, src, count );
-
-    return 0;
-}
-
-static
-void CC checksum_whack ( void *obj )
-{
-    checksum *self = obj;
-
-    /* store metadata */
-    KMDataNode *digest;
-    rc_t rc = KMetadataOpenNodeUpdate ( self -> meta, & digest, self -> node );
-    if ( rc == 0 )
-    {
-        size_t bytes;
-        uint8_t buff [ 256 ];
-
-        /* open state node */
-        KMDataNode *state;
-        rc = KMDataNodeOpenNodeUpdate ( digest, & state, "state" );
-        if ( rc == 0 )
-        {
-            if ( self -> byte_swap )
-                ( * self -> swap ) ( self );
-
-            KMDataNodeWrite ( state, & self -> u, self -> valid );
-            KMDataNodeRelease ( state );
-
-            if ( self -> byte_swap )
-                ( * self -> swap ) ( self );
-       }
-
-        /* capture digest */
-        bytes = ( * self -> digest ) ( self, buff, sizeof buff );
-
-        /* write digest */
-        KMDataNodeWrite ( digest, buff, bytes );
-        KMDataNodeRelease ( digest );
-    }
-
-    KMetadataRelease ( self -> meta );
-    free ( self );
-}
-
-static
-rc_t checksum_prior_state ( checksum *self, size_t state_size )
-{
-    const KMDataNode *state;
-    rc_t rc = KMetadataOpenNodeRead ( self -> meta, & state, "%s/state", self -> node );
-    if ( rc == 0 )
-    {
-        size_t remaining;
-        rc = KMDataNodeRead ( state, 0, self -> u . buff, sizeof self -> u, & self -> valid, & remaining );
-        KMDataNodeRelease ( state );
-        if ( rc == 0 )
-        {
-            if ( remaining != 0 || self -> valid > state_size )
-                rc = RC ( rcXF, rcFunction, rcConstructing, rcData, rcExcessive );
-            else if ( self -> valid != 0 && self -> valid < state_size )
-                rc = RC ( rcXF, rcFunction, rcConstructing, rcData, rcInsufficient );
-        }
-    }
-    else if ( GetRCState ( rc ) == rcNotFound )
-    {
-        rc = 0;
-    }
-
-    return rc;
-}
-
-static
-rc_t checksum_make ( const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, size_t state_size )
-{
-    rc_t rc;
-    checksum *self = malloc ( sizeof * self + cp -> argv [ 0 ] . count );
-    if ( self == NULL )
-        rc = RC ( rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted );
-    else
-    {
-        rc = VTableOpenMetadataUpdate ( ( VTable* ) info -> tbl, & self -> meta );
-        if ( rc == 0 )
-        {
-            rc = KMetadataByteOrder ( self -> meta, & self -> byte_swap );
-            if ( rc == 0 )
-            {
-                string_copy ( self -> node, cp -> argv [ 0 ] . count + 1,
-                    cp -> argv [ 0 ] . data . ascii, cp -> argv [ 0 ] . count );
-
-                memset ( & self -> u, 0, sizeof self -> u );
-                rc = checksum_prior_state ( self, state_size );
-                if ( rc == 0 )
-                {
-                    rslt -> self = self;
-                    rslt -> whack = checksum_whack;
-                    rslt -> variant = vftNonDetRow;
-                    rslt -> u . rf = checksum_driver;
-
-                    return 0;
-                }
-            }
-
-            KMetadataRelease ( self -> meta );
-        }
-
-        free ( self );
-    }
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * crc32 factory
- */
-static
-rc_t vdb_crc32_fact ( const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp )
-{
-    checksum *self;
-    rc_t rc = checksum_make ( info, rslt, cp, sizeof self -> u . crc32 );
-    if ( rc == 0 )
-    {
-        self = rslt -> self;
-        self -> swap = vdb_crc32swap;
-        self -> sum = vdb_crc32sum;
-        self -> digest = vdb_crc32digest;
-        if ( self -> valid == 0 ) {
-            self -> u . crc32 . crc = 0;
-            self -> u . crc32 . len = 0;
-            self -> valid = sizeof ( self -> u . crc32 );
-        }
-        else if ( self -> byte_swap )
-            vdb_crc32swap ( self );
-    }
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * md5 factory
- */
-static
-rc_t vdb_md5sum_fact ( const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp )
-{
-    checksum *self;
-    rc_t rc = checksum_make ( info, rslt, cp, sizeof self -> u . md5 );
-    if ( rc == 0 )
-    {
-        self = rslt -> self;
-        self -> swap = vdb_md5swap;
-        self -> sum = vdb_md5sum;
-        self -> digest = vdb_md5digest;
-        if ( self -> valid == 0 ) {
-            MD5StateInit ( & self -> u . md5 );
-            self -> valid = sizeof ( self -> u . md5 );
-        }
-        else if ( self -> byte_swap )
-            vdb_md5swap ( self );
-    }
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * sha factories
- */
-static
-rc_t vdb_sha1_fact ( const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp )
-{
-    checksum *self;
-    rc_t rc = checksum_make ( info, rslt, cp, sizeof self -> u . sha1 );
-    if ( rc == 0 )
-    {
-        self = rslt -> self;
-        self -> swap = vdb_sha32swap;
-        self -> sum = vdb_sha1sum;
-        self -> digest = vdb_sha1digest;
-        if ( self -> valid == 0 ) {
-            SHA1StateInit ( & self -> u . sha1 );
-            self -> valid = sizeof ( self -> u . sha1 );
-        }
-        else if ( self -> byte_swap )
-            vdb_sha32swap ( self );
-    }
-
-    return rc;
-}
-
-static
-rc_t vdb_sha256_fact ( const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp )
-{
-    checksum *self;
-    rc_t rc = checksum_make ( info, rslt, cp, sizeof self -> u . sha256 );
-    if ( rc == 0 )
-    {
-        self = rslt -> self;
-        self -> swap = vdb_sha32swap;
-        self -> sum = vdb_sha256sum;
-        self -> digest = vdb_sha256digest;
-        if ( self -> valid == 0 ) {
-            SHA256StateInit ( & self -> u . sha256 );
-            self -> valid = sizeof ( self -> u . sha256 );
-        }
-        else if ( self -> byte_swap )
-            vdb_sha32swap ( self );
-    }
-
-    return rc;
-}
-
-static
-rc_t vdb_sha384_fact ( const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp )
-{
-    checksum *self;
-    rc_t rc = checksum_make ( info, rslt, cp, sizeof self -> u . sha384 );
-    if ( rc == 0 )
-    {
-        self = rslt -> self;
-        self -> swap = vdb_sha64swap;
-        self -> sum = vdb_sha384sum;
-        self -> digest = vdb_sha384digest;
-        if ( self -> valid == 0 ) {
-            SHA384StateInit ( & self -> u . sha384 );
-            self -> valid = sizeof ( self -> u . sha384 );
-        }
-        else if ( self -> byte_swap )
-            vdb_sha64swap ( self );
-    }
-
-    return rc;
-}
-
-static
-rc_t vdb_sha512_fact ( const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp )
-{
-    checksum *self;
-    rc_t rc = checksum_make ( info, rslt, cp, sizeof self -> u . sha512 );
-    if ( rc == 0 )
-    {
-        self = rslt -> self;
-        self -> swap = vdb_sha64swap;
-        self -> sum = vdb_sha512sum;
-        self -> digest = vdb_sha512digest;
-        if ( self -> valid == 0 ) {
-            SHA512StateInit ( & self -> u . sha512 );
-            self -> valid = sizeof ( self -> u . sha512 );
-        }
-        else if ( self -> byte_swap )
-            vdb_sha64swap ( self );
-    }
-
-    return rc;
-}
-
-
-/*--------------------------------------------------------------------------
- * checksum factory
- */
-VTRANSFACT_IMPL ( vdb_checksum, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    /* version 1.0 has 2 factory params... */
-    assert ( cp -> argc == 2 );
-    /* ...and 1 function param */
-    assert ( dp -> argc == 1 );
-
-    /* both factory params are of type ascii */
-    assert ( cp -> argv [ 0 ] . desc . domain == vtdAscii );
-    assert ( cp -> argv [ 1 ] . desc . domain == vtdAscii );
-    assert ( cp -> argv [ 0 ] . desc . intrinsic_bits == 8 );
-    assert ( cp -> argv [ 1 ] . desc . intrinsic_bits == 8 );
-    assert ( cp -> argv [ 0 ] . desc . intrinsic_dim == 1 );
-    assert ( cp -> argv [ 1 ] . desc . intrinsic_dim == 1 );
-
-    /* the input must be limited to bytes */
-    assert ( dp -> argc == 1 );
-    assert ( dp -> argv [ 0 ] . desc . intrinsic_bits == 8 );
-
-    /* look up algorithm */
-    switch ( cp -> argv [ 1 ] . count )
-    {
-    case 3:
-        if ( strcase_cmp ( cp -> argv [ 1 ] . data . ascii, 3, "md5", 3, 3 ) == 0 )
-            return vdb_md5sum_fact ( info, rslt, cp );
-        break;
-    case 4:
-        if ( strcase_cmp ( cp -> argv [ 1 ] . data . ascii, 4, "sha1", 4, 4 ) == 0 )
-            return vdb_sha1_fact ( info, rslt, cp );
-        break;
-    case 5:
-        if ( strcase_cmp ( cp -> argv [ 1 ] . data . ascii, 5, "crc32", 5, 5 ) == 0 )
-            return vdb_crc32_fact ( info, rslt, cp );
-        else if ( strcase_cmp ( cp -> argv [ 1 ] . data . ascii, 5, "sha-1", 5, 5 ) == 0 )
-            return vdb_sha1_fact ( info, rslt, cp );
-        break;
-    case 6:
-        if ( strcase_cmp ( cp -> argv [ 1 ] . data . ascii, 6, "crc-32", 6, 6 ) == 0 )
-            return vdb_crc32_fact ( info, rslt, cp );
-        else if ( strcase_cmp ( cp -> argv [ 1 ] . data . ascii, 6, "sha256", 6, 6 ) == 0 )
-            return vdb_sha256_fact ( info, rslt, cp );
-        else if ( strcase_cmp ( cp -> argv [ 1 ] . data . ascii, 6, "sha384", 6, 6 ) == 0 )
-            return vdb_sha384_fact ( info, rslt, cp );
-        else if ( strcase_cmp ( cp -> argv [ 1 ] . data . ascii, 6, "sha512", 6, 6 ) == 0 )
-            return vdb_sha512_fact ( info, rslt, cp );
-        break;
-    case 7:
-        if ( strcase_cmp ( cp -> argv [ 1 ] . data . ascii, 7, "sha-256", 7, 7 ) == 0 )
-            return vdb_sha256_fact ( info, rslt, cp );
-        else if ( strcase_cmp ( cp -> argv [ 1 ] . data . ascii, 7, "sha-384", 7, 7 ) == 0 )
-            return vdb_sha384_fact ( info, rslt, cp );
-        else if ( strcase_cmp ( cp -> argv [ 1 ] . data . ascii, 7, "sha-512", 7, 7 ) == 0 )
-            return vdb_sha512_fact ( info, rslt, cp );
-        break;
-    }
-
-    /* failed to resolve algorithm */
-    return RC ( rcXF, rcFunction, rcConstructing, rcParam, rcIncorrect );
-}
diff --git a/libs/vxf/clip.c b/libs/vxf/clip.c
deleted file mode 100644
index e8047c2..0000000
--- a/libs/vxf/clip.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-
-typedef struct {
-    union {
-        /* integer */
-        int8_t i8[2];
-        int16_t i16[2];
-        int32_t i32[2];
-        int64_t i64[2];
-    
-        /* unsigned integer */
-        uint8_t u8[2];
-        uint16_t u16[2];
-        uint32_t u32[2];
-        uint64_t u64[2];
-    
-        /* floating point */
-        float f32[2];
-        double f64[2];
-    } u;
-    uint32_t dim;
-} self_t;
-
-#define CLIP_FUNC(FUNC, TYPE, VAL) \
-static rc_t CC FUNC(void *Self, const VXformInfo *info, void *Dst, const void *Src, uint64_t n) { \
-    const self_t *self = Self; \
-    TYPE lower = self->u.VAL[0]; \
-    TYPE upper = self->u.VAL[1]; \
-    TYPE *dst = Dst; \
-    const TYPE *src = Src; \
-    size_t i; \
-\
-    for (i = 0, n *= self->dim; i != n; ++i) { \
-        TYPE val = src[i]; \
-\
-        if (val < lower) \
-            val = lower; \
-        else if (val > upper) \
-            val = upper; \
-\
-        dst[i] = val; \
-    } \
-    return 0; \
-}
-
-CLIP_FUNC(clip_U8, uint8_t, u8)
-CLIP_FUNC(clip_I8, int8_t, i8)
-CLIP_FUNC(clip_U16, uint16_t, u16)
-CLIP_FUNC(clip_I16, int16_t, i16)
-CLIP_FUNC(clip_U32, uint32_t, u32)
-CLIP_FUNC(clip_I32, int32_t, i32)
-CLIP_FUNC(clip_U64, uint64_t, u64)
-CLIP_FUNC(clip_I64, int64_t, i64)
-CLIP_FUNC(clip_F32, float, f32)
-CLIP_FUNC(clip_F64, double, f64)
-
-static
-void CC vxf_free_wrapper( void *ptr )
-{
-	free( ptr );
-}
-
-/* clip
- function < type T > T clip #1.0 < T lower, T upper > ( T in ) = vdb:clip;
- function < type T, U32 dim > T [ dim ] vclip #1.0 < T lower, T upper > ( T [ dim ] in ) = vdb:clip;
- */
-VTRANSFACT_IMPL(vdb_clip, 1, 0, 0) (const void *Self, const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rc_t rc = 0;
-    self_t *self;
-
-    /* check types */
-    switch (info->fdesc.desc.domain) {
-        case vtdInt:
-        case vtdUint:
-        case vtdFloat:
-            break;
-        default:
-            return RC(rcVDB, rcFunction, rcConstructing, rcType, rcInvalid);
-    }
-    switch (info->fdesc.desc.intrinsic_bits) {
-        case 8:
-        case 16:
-        case 32:
-        case 64:
-            break;
-        default:
-            return RC(rcVDB, rcFunction, rcConstructing, rcType, rcInvalid);
-    }
-    
-    self = malloc(sizeof(*self));
-    if (self == NULL)
-        return RC(rcVDB, rcFunction, rcConstructing, rcMemory, rcExhausted);
-    
-    rslt->self = self;
-    rslt->whack = vxf_free_wrapper;
-    rslt->variant = vftArray;
-
-    self->dim = info->fdesc.fd.td.dim;
-    
-    switch (info->fdesc.desc.domain) {
-        case vtdInt:
-            switch (info->fdesc.desc.intrinsic_bits) {
-                case 8:
-                    rslt->u.af = clip_I8;
-                    self->u.i8[0] = *cp->argv[0].data.i8;
-                    self->u.i8[1] = *cp->argv[1].data.i8;
-                    break;
-                case 16:
-                    rslt->u.af = clip_I16;
-                    self->u.i16[0] = *cp->argv[0].data.i16;
-                    self->u.i16[1] = *cp->argv[1].data.i16;
-                    break;
-                case 32:
-                    rslt->u.af = clip_I32;
-                    self->u.i32[0] = *cp->argv[0].data.i32;
-                    self->u.i32[1] = *cp->argv[1].data.i32;
-                    break;
-                case 64:
-                    rslt->u.af = clip_I64;
-                    self->u.i64[0] = *cp->argv[0].data.i64;
-                    self->u.i64[1] = *cp->argv[1].data.i64;
-                    break;
-            }
-            break;
-        case vtdUint:
-            switch (info->fdesc.desc.intrinsic_bits) {
-                case 8:
-                    rslt->u.af = clip_U8;
-                    self->u.u8[0] = *cp->argv[0].data.u8;
-                    self->u.u8[1] = *cp->argv[1].data.u8;
-                    break;
-                case 16:
-                    rslt->u.af = clip_U16;
-                    self->u.u16[0] = *cp->argv[0].data.u16;
-                    self->u.u16[1] = *cp->argv[1].data.u16;
-                    break;
-                case 32:
-                    rslt->u.af = clip_U32;
-                    self->u.u32[0] = *cp->argv[0].data.u32;
-                    self->u.u32[1] = *cp->argv[1].data.u32;
-                    break;
-                case 64:
-                    rslt->u.af = clip_U64;
-                    self->u.u64[0] = *cp->argv[0].data.u64;
-                    self->u.u64[1] = *cp->argv[1].data.u64;
-                    break;
-            }
-            break;
-        case vtdFloat:
-            switch (info->fdesc.desc.intrinsic_bits) {
-                case 32:
-                    rslt->u.af = clip_F32;
-                    self->u.f32[0] = *cp->argv[0].data.f32;
-                    self->u.f32[1] = *cp->argv[1].data.f32;
-                    break;
-                case 64:
-                    rslt->u.af = clip_F64;
-                    self->u.f64[0] = *cp->argv[0].data.f64;
-                    self->u.f64[1] = *cp->argv[1].data.f64;
-                    break;
-            }
-            break;
-    }
-	return rc;
-}
diff --git a/libs/vxf/cut.c b/libs/vxf/cut.c
deleted file mode 100644
index e732659..0000000
--- a/libs/vxf/cut.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <bitstr.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <assert.h>
-
-typedef struct self_t {
-    void (*f)(const struct self_t *, void *, const void *, size_t);
-    uint32_t type_size;
-    uint32_t dim;
-    uint32_t n;
-    uint32_t idx[7];
-} self_t;
-
-static
-void cut8(const struct self_t *self, void *Dst, const void *Src, size_t elem_count) {
-    uint8_t *dst = Dst;
-    const uint8_t *src = Src;
-    int i;
-    int j;
-    int doff;
-    int soff;
-    
-    for (doff = soff = i = 0; i != elem_count; ++i, doff += self->n, soff += self->dim) {
-        for (j = 0; j != self->n; ++j) {
-            dst[doff + j] = src[soff + self->idx[j]];
-        }
-    }
-}
-
-static
-void cut16(const struct self_t *self, void *Dst, const void *Src, size_t elem_count) {
-    uint16_t *dst = Dst;
-    const uint16_t *src = Src;
-    int i;
-    int j;
-    int doff;
-    int soff;
-    
-    for (doff = soff = i = 0; i != elem_count; ++i, doff += self->n, soff += self->dim) {
-        for (j = 0; j != self->n; ++j) {
-            dst[doff + j] = src[soff + self->idx[j]];
-        }
-    }
-}
-
-static
-void cut32(const struct self_t *self, void *Dst, const void *Src, size_t elem_count) {
-    uint32_t *dst = Dst;
-    const uint32_t *src = Src;
-    int i;
-    int j;
-    int doff;
-    int soff;
-    
-    for (doff = soff = i = 0; i != elem_count; ++i, doff += self->n, soff += self->dim) {
-        for (j = 0; j != self->n; ++j) {
-            dst[doff + j] = src[soff + self->idx[j]];
-        }
-    }
-}
-
-static
-void cut64(const struct self_t *self, void *Dst, const void *Src, size_t elem_count) {
-    uint64_t *dst = Dst;
-    const uint64_t *src = Src;
-    int i;
-    int j;
-    int doff;
-    int soff;
-    
-    for (doff = soff = i = 0; i != elem_count; ++i, doff += self->n, soff += self->dim) {
-        for (j = 0; j != self->n; ++j) {
-            dst[doff + j] = src[soff + self->idx[j]];
-        }
-    }
-}
-
-static
-void cut_bytes(const struct self_t *self, void *Dst, const void *Src, size_t elem_count) {
-    uint8_t *dst = Dst;
-    const uint8_t *src = Src;
-    int i;
-    int j;
-    int doff;
-    int soff;
-    const int sz = self->type_size >> 3;
-    const int di = sz * self->n;
-    const int si = sz * self->dim;
-    
-    for (doff = soff = i = 0; i != elem_count; ++i, doff += di, soff += si) {
-        for (j = 0; j != self->n; ++j) {
-            memcpy(dst + doff + j * sz, src + soff + self->idx[j] * sz, sz);
-        }
-    }
-}
-
-static
-void cut_bits(const struct self_t *self, void *dst, const void *src, size_t elem_count) {
-    int i;
-    int j;
-    int doff;
-    int soff;
-    const int sz = self->type_size;
-    const int di = sz * self->n;
-    const int si = sz * self->dim;
-    
-    for (doff = soff = i = 0; i != elem_count; ++i, doff += di, soff += si) {
-        for (j = 0; j != self->n; ++j) {
-            bitcpy(dst, doff + j * sz, src, soff + self->idx[j] * sz, sz);
-        }
-    }
-}
-
-static
-rc_t CC cut_driver (
-                    void *Self,
-                    const VXformInfo *info,
-                    void *dst,
-                    const void *src,
-                    uint64_t elem_count
-                    )
-{
-    const self_t *self = Self;
-    
-    self->f( self, dst, src, elem_count );
-    return 0;
-}
-
-static
-void CC vxf_cut_wrapper( void *ptr )
-{
-	free( ptr );
-}
-
-/* cut
- * function < type T >
- * T [ * ] cut #1.0 < U32 idx, ... > ( T [ * ] in );
- */
-VTRANSFACT_IMPL(vdb_cut, 1, 0, 0) (const void *self, const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    uint32_t dim = cp->argc;
-    int i;
-    self_t *ctx;
-    
-    assert(dim != 0);
-    for (i = 0; i != dim; ++i) {
-        if (*(cp->argv[i].data.u32) >= dp->argv[0].fd.td.dim)
-            return RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-    }
-    
-    ctx = malloc ( sizeof * ctx - sizeof ctx -> idx + dim * sizeof ctx -> idx [ 0 ] );
-    if (ctx == NULL)
-        return RC(rcVDB, rcFunction, rcConstructing, rcMemory, rcExhausted);
-
-    ctx->type_size = VTypedescSizeof ( & info -> fdesc . desc ) / dim;
-    ctx->dim = VTypedescSizeof ( & dp->argv[0].desc ) / ctx->type_size;
-    ctx->n = dim;
-
-    for (i = 0; i != dim; ++i)
-    {
-        ctx->idx[i] = cp->argv[i].data.u32[0];
-        if ( ctx->idx[i] >= ctx->dim )
-        {
-            free ( ctx );
-            return RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-        }
-    }
-    
-    rslt->self = ctx;
-    rslt->whack = vxf_cut_wrapper;
-    rslt->variant = vftArray;
-    rslt->u.af = cut_driver;
-    
-    switch (ctx->type_size) {
-        case 8:
-            ctx->f = cut8;
-            break;
-        case 16:
-            ctx->f = cut16;
-            break;
-        case 32:
-            ctx->f = cut32;
-            break;
-        case 64:
-            ctx->f = cut64;
-            break;
-        default:
-            ctx->f = (ctx->type_size & 7) == 0 ? cut_bytes : cut_bits;
-            break;
-    }
-    
-	return 0;
-}
diff --git a/libs/vxf/delta.c b/libs/vxf/delta.c
deleted file mode 100644
index fc3136b..0000000
--- a/libs/vxf/delta.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-#include <vdb/xform.h>
-#include <arch-impl.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-
-#define DELTA_NAME( T )  delta_ ## T
-#define DELTA( T )                                                       \
-static                                                                   \
-rc_t CC DELTA_NAME ( T ) ( void *data,                                   \
-    const VXformInfo *info,  void *rslt, const void *input,              \
-    uint64_t elem_count)                                                 \
-{                                                                        \
-    uint32_t i;                                                          \
-    T *dst       = (T*) rslt;                                            \
-    const T *src = (const T*) input;                                     \
-    if(elem_count >0) {							 \
-        dst [ 0 ] = src [ 0 ];						 \
-	for ( i = 1; i < elem_count; ++ i ) {                            \
-	    dst [ i ] = src [ i ] - src [ i - 1 ];                       \
-	}                                                                \
-    }									 \
-    return 0;                                                            \
-}
-
-DELTA ( int8_t )
-DELTA ( int16_t )
-DELTA ( int32_t )
-DELTA ( int64_t )
-
-static VArrayFunc delta_func [] =
-{
-    DELTA_NAME ( int8_t  ),
-    DELTA_NAME ( int16_t ),
-    DELTA_NAME ( int32_t ),
-    DELTA_NAME ( int64_t )
-};
-/* delta
- *  return the 1 derivative of inputs
- *
- *  "T" [ TYPE ] - input and output data type
- *  must be member of  signed integers
- *
- *  "a" [ DATA ] - operand
- *
- *
- * SYNOPSIS:
- *  return 1st derivative for the whole blob with 1st element unmodified
- *
- * USAGE:
- *    I32 A = < I32 > delta ( B );
- */
-VTRANSFACT_IMPL ( vdb_delta, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    int size_idx;
-    if ( info -> fdesc . desc . domain != vtdInt)
-    {
-        return RC ( rcXF, rcFunction, rcConstructing, rcType, rcIncorrect );
-    }
-
-    /* TBD - eventually support vector derivatives
-       for today, check that dim of T is 1 */
-    if ( dp -> argv [ 0 ] . desc . intrinsic_dim != 1 )
-        return RC ( rcXF, rcFunction, rcConstructing, rcType, rcIncorrect );
-
-    /* the only numeric types we support are between 8 and 64 bits */
-    size_idx = uint32_lsbit ( dp -> argv [ 0 ] . desc . intrinsic_bits ) - 3;
-    if ( size_idx < 0 || size_idx > 3 || ( ( dp -> argv [ 0 ] . desc . intrinsic_bits &
-                                             ( dp -> argv [ 0 ] . desc . intrinsic_bits - 1 ) ) != 0 ) )
-        return RC ( rcXF, rcFunction, rcConstructing, rcType, rcIncorrect );
-
-
-    rslt -> u . af = delta_func [ size_idx ];
-    rslt -> variant = vftArray;
-
-    return 0;
-}
diff --git a/libs/vxf/deriv.c b/libs/vxf/deriv.c
deleted file mode 100644
index 564e66a..0000000
--- a/libs/vxf/deriv.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-#include <vdb/xform.h>
-#include <arch-impl.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-
-#define DERIV_NAME( T )  deriv_ ## T
-#define DERIV( T )                                                       \
-static                                                                   \
-rc_t CC DERIV_NAME ( T ) ( void *data,                                      \
-    const VXformInfo *info, int64_t row_id, const VFixedRowResult *rslt, \
-    uint32_t argc, const VRowData argv [] )                              \
-{                                                                        \
-    uint32_t i;                                                          \
-                                                                         \
-    T *dst       = rslt -> base;                                         \
-    const T *src = argv [ 0 ] . u . data . base;                         \
-    if(rslt -> elem_count == 0) return 0;				 \
-    dst += rslt -> first_elem;						 \
-    src += argv [ 0 ] . u . data . first_elem;				 \
-    dst [ 0 ] = src [ 0 ];						 \
-                                                                         \
-    for ( i = 1; i < rslt -> elem_count; ++ i ) {                        \
-        dst [ i ] = src [ i ] - src [ i - 1 ];                           \
-    }                                                                    \
-    return 0;                                                            \
-}
-
-DERIV ( int8_t )
-DERIV ( int16_t )
-DERIV ( int32_t )
-DERIV ( int64_t )
-
-static VFixedRowFunc deriv_func [] =
-{
-    DERIV_NAME ( int8_t  ),
-    DERIV_NAME ( int16_t ),
-    DERIV_NAME ( int32_t ),
-    DERIV_NAME ( int64_t )
-};
-/* deriv
- *  return the 1 derivative of inputs
- *
- *  "T" [ TYPE ] - input and output data type
- *  must be member of  signed integers
- *
- *  "a" [ DATA ] - operand
- *
- *
- * SYNOPSIS:
- *  return 1st derivative for every row with 1st element unmodified
- *
- * USAGE:
- *    I32 pos_1st_d = < I32 > deriv ( position );
- */
-VTRANSFACT_IMPL ( vdb_deriv, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    int size_idx;
-    if ( info -> fdesc . desc . domain != vtdInt)
-    {
-        return RC ( rcXF, rcFunction, rcConstructing, rcType, rcIncorrect );
-    }
-
-    /* TBD - eventually support vector derivatives
-       for today, check that dim of T is 1 */
-    if ( dp -> argv [ 0 ] . desc . intrinsic_dim != 1 )
-        return RC ( rcXF, rcFunction, rcConstructing, rcType, rcIncorrect );
-
-    /* the only numeric types we support are between 8 and 64 bits */
-    size_idx = uint32_lsbit ( dp -> argv [ 0 ] . desc . intrinsic_bits ) - 3;
-    if ( size_idx < 0 || size_idx > 3 || ( ( dp -> argv [ 0 ] . desc . intrinsic_bits &
-                                             ( dp -> argv [ 0 ] . desc . intrinsic_bits - 1 ) ) != 0 ) )
-        return RC ( rcXF, rcFunction, rcConstructing, rcType, rcIncorrect );
-
-
-    rslt -> u . pf = deriv_func [ size_idx ];
-    rslt -> variant = vftFixedRow;
-
-    return 0;
-}
diff --git a/libs/vxf/diff.c b/libs/vxf/diff.c
deleted file mode 100644
index d7062d4..0000000
--- a/libs/vxf/diff.c
+++ /dev/null
@@ -1,356 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-#include <vdb/xform.h>
-#include <arch-impl.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-/* optional constant */
-typedef union diff_data diff_data;
-union diff_data
-{
-    int8_t i8;
-    int16_t i16;
-    int32_t i32;
-    int64_t i64;
-
-    uint8_t u8;
-    uint16_t u16;
-    uint32_t u32;
-    uint64_t u64;
-
-    float f32;
-    double f64;
-};
-
-#define FULL_DIFF_NAME( T )                                              \
-    full_diff_ ## T
-#define FULL_DIFF( T, k )                                                \
-static                                                                   \
-rc_t CC FULL_DIFF_NAME ( T ) ( void *data,                                  \
-    const VXformInfo *info, int64_t row_id, const VFixedRowResult *rslt, \
-    uint32_t argc, const VRowData argv [] )                              \
-{                                                                        \
-    uint32_t i;                                                          \
-    const diff_data *self = ( const void* ) data;                        \
-                                                                         \
-    T *dst = rslt -> base;                                               \
-    const T *a = argv [ 0 ] . u . data . base;                           \
-    const T *b = argv [ 1 ] . u . data . base;                           \
-                                                                         \
-    for ( i = 0, dst += rslt -> first_elem,                              \
-              a += argv [ 0 ] . u . data . first_elem,                   \
-              b += argv [ 1 ] . u . data . first_elem;                   \
-          i < rslt -> elem_count; ++ i )                                 \
-    {                                                                    \
-        dst [ i ] = a [ i ] - b [ i ] - self -> k;                       \
-    }                                                                    \
-                                                                         \
-    return 0;                                                            \
-}
-
-FULL_DIFF ( int8_t, i8 )
-FULL_DIFF ( int16_t, i16 )
-FULL_DIFF ( int32_t, i32 )
-FULL_DIFF ( int64_t, i64 )
-FULL_DIFF ( uint8_t, u8 )
-FULL_DIFF ( uint16_t, u16 )
-FULL_DIFF ( uint32_t, u32 )
-FULL_DIFF ( uint64_t, u64 )
-FULL_DIFF ( float, f32 )
-FULL_DIFF ( double, f64 )
-
-static VFixedRowFunc full_diff_func [] =
-{
-    FULL_DIFF_NAME ( uint8_t ),
-    FULL_DIFF_NAME ( uint16_t ),
-    FULL_DIFF_NAME ( uint32_t ),
-    FULL_DIFF_NAME ( uint64_t ),
-    FULL_DIFF_NAME ( int8_t ),
-    FULL_DIFF_NAME ( int16_t ),
-    FULL_DIFF_NAME ( int32_t ),
-    FULL_DIFF_NAME ( int64_t ),
-    NULL,
-    NULL,
-    FULL_DIFF_NAME ( float ),
-    FULL_DIFF_NAME ( double )
-};
-
-#define CONST_DIFF_NAME( T )                                             \
-    const_diff_ ## T
-#define CONST_DIFF( T, k )                                               \
-static                                                                   \
-rc_t CC CONST_DIFF_NAME ( T ) ( void *data, const VXformInfo *info,         \
-    void *rslt, const void *src, uint64_t elem_count )                   \
-{                                                                        \
-    uint32_t i;                                                          \
-    const diff_data *self = ( const void* ) data;                        \
-                                                                         \
-    T *dst = rslt;                                                       \
-    const T *a = src;                                                    \
-                                                                         \
-    for ( i = 0; i < elem_count; ++ i )                                 \
-    {                                                                    \
-        dst [ i ] = a [ i ] - self -> k;                                 \
-    }                                                                    \
-                                                                         \
-    return 0;                                                            \
-}
-
-CONST_DIFF ( int8_t, i8 )
-CONST_DIFF ( int16_t, i16 )
-CONST_DIFF ( int32_t, i32 )
-CONST_DIFF ( int64_t, i64 )
-CONST_DIFF ( uint8_t, u8 )
-CONST_DIFF ( uint16_t, u16 )
-CONST_DIFF ( uint32_t, u32 )
-CONST_DIFF ( uint64_t, u64 )
-CONST_DIFF ( float, f32 )
-CONST_DIFF ( double, f64 )
-
-static VArrayFunc const_diff_func [] =
-{
-    CONST_DIFF_NAME ( uint8_t ),
-    CONST_DIFF_NAME ( uint16_t ),
-    CONST_DIFF_NAME ( uint32_t ),
-    CONST_DIFF_NAME ( uint64_t ),
-    CONST_DIFF_NAME ( int8_t ),
-    CONST_DIFF_NAME ( int16_t ),
-    CONST_DIFF_NAME ( int32_t ),
-    CONST_DIFF_NAME ( int64_t ),
-    NULL,
-    NULL,
-    CONST_DIFF_NAME ( float ),
-    CONST_DIFF_NAME ( double )
-};
-
-#define NO_CONST_NAME( T )                                               \
-    no_const_ ## T
-#define NO_CONST( T )                                                    \
-static                                                                   \
-rc_t CC NO_CONST_NAME ( T ) ( void *data,                                   \
-    const VXformInfo *info, int64_t row_id, const VFixedRowResult *rslt, \
-    uint32_t argc, const VRowData argv [] )                              \
-{                                                                        \
-    uint32_t i;                                                          \
-                                                                         \
-    T *dst = rslt -> base;                                               \
-    const T *a = argv [ 0 ] . u . data . base;                           \
-    const T *b = argv [ 1 ] . u . data . base;                           \
-                                                                         \
-    for ( i = 0, dst += rslt -> first_elem,                              \
-              a += argv [ 0 ] . u . data . first_elem,                   \
-              b += argv [ 1 ] . u . data . first_elem;                   \
-          i < rslt -> elem_count; ++ i )                                 \
-    {                                                                    \
-        dst [ i ] = a [ i ] - b [ i ];                                   \
-    }                                                                    \
-                                                                         \
-    return 0;                                                            \
-}
-
-NO_CONST ( int8_t )
-NO_CONST ( int16_t )
-NO_CONST ( int32_t )
-NO_CONST ( int64_t )
-NO_CONST ( uint8_t )
-NO_CONST ( uint16_t )
-NO_CONST ( uint32_t )
-NO_CONST ( uint64_t )
-NO_CONST ( float )
-NO_CONST ( double )
-
-static VFixedRowFunc no_const_func [] =
-{
-    NO_CONST_NAME ( uint8_t ),
-    NO_CONST_NAME ( uint16_t ),
-    NO_CONST_NAME ( uint32_t ),
-    NO_CONST_NAME ( uint64_t ),
-    NO_CONST_NAME ( int8_t ),
-    NO_CONST_NAME ( int16_t ),
-    NO_CONST_NAME ( int32_t ),
-    NO_CONST_NAME ( int64_t ),
-    NULL,
-    NULL,
-    NO_CONST_NAME ( float ),
-    NO_CONST_NAME ( double )
-};
-
-static
-rc_t CC no_diff ( void *data, const VXformInfo *info,
-    void *dst, const void *src, uint64_t elem_count )
-{
-    memcpy ( dst, src, (size_t)elem_count * VTypedescSizeof ( & info -> fdesc . desc ) >> 3 );
-    return 0;
-}
-
-static
-void CC vxf_diff_wrapper( void *ptr )
-{
-	free( ptr );
-}
-
-/* diff
- *  return the difference of inputs
- *
- *  "T" [ TYPE ] - input and output data type
- *  must be member of numeric_set
- *
- *  "k" [ CONST, DEFAULT 0 ] - optional constant
- *  to be added or subtracted
- *
- *  "a" [ DATA ] - left-most operand
- *
- *  "b" [ DATA ] - optional subtractand
- *
- * SYNOPSIS:
- *  incorporates "k" into expression for every row
- *  returns sum or difference of inputs for all rows
- *
- * USAGE:
- *  length of half-closed interval
- *    U32 len = < U32 > diff ( stop, start );
- *  length of fully-closed interval
- *    U32 len = < U32 > diff < -1 > ( stop, start );
- */
-VTRANSFACT_IMPL ( vdb_diff, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    bool has_const;
-    int32_t size_idx;
-    diff_data k;
-
-    /* "T" must be member of numeric_set */
-    switch ( info -> fdesc . desc . domain )
-    {
-    case vtdUint:
-    case vtdInt:
-    case vtdFloat:
-        break;
-    default:
-        return RC ( rcXF, rcFunction, rcConstructing, rcType, rcIncorrect );
-    }
-
-    /* TBD - eventually support vector differences
-       for today, check that dim of T is 1 */
-    if ( dp -> argv [ 0 ] . desc . intrinsic_dim != 1 )
-        return RC ( rcXF, rcFunction, rcConstructing, rcType, rcIncorrect );
-
-    /* the only numeric types we support are between 8 and 64 bits */
-    size_idx = uint32_lsbit ( dp -> argv [ 0 ] . desc . intrinsic_bits ) - 3;
-    if ( size_idx < 0 || size_idx > 3 || ( ( dp -> argv [ 0 ] . desc . intrinsic_bits &
-                                             ( dp -> argv [ 0 ] . desc . intrinsic_bits - 1 ) ) != 0 ) )
-        return RC ( rcXF, rcFunction, rcConstructing, rcType, rcIncorrect );
-
-
-    /* there are 4 variants:
-       1. no constant ( or is 0 ) and single input
-       2. non-zero constant and single input
-       3. no constant ( or is 0 ) and dual input
-       4. non-zero constant and dual input */
-    has_const = false;
-    if ( cp -> argc == 1 ) switch ( cp -> argv [ 0 ] . desc . domain )
-    {
-    case vtdUint:
-    case vtdInt:
-        switch ( cp -> argv [ 0 ] . desc . intrinsic_bits )
-        {
-        case 8:
-            if ( ( k . u8 = cp -> argv [ 0 ] . data . u8 [ 0 ] ) != 0 )
-                has_const = true;
-            break;
-        case 16:
-            if ( ( k . u16 = cp -> argv [ 0 ] . data . u16 [ 0 ] ) != 0 )
-                has_const = true;
-            break;
-        case 32:
-            if ( ( k . u32 = cp -> argv [ 0 ] . data . u32 [ 0 ] ) != 0 )
-                has_const = true;
-            break;
-        case 64:
-            if ( ( k . u64 = cp -> argv [ 0 ] . data . u64 [ 0 ] ) != 0 )
-                has_const = true;
-            break;
-        }
-        break;
-
-    case vtdFloat:
-        switch ( cp -> argv [ 0 ] . desc . intrinsic_bits )
-        {
-        case 32:
-            if ( ( k . f32 = cp -> argv [ 0 ] . data . f32 [ 0 ] ) != 0.0 )
-                has_const = true;
-            break;
-        case 64:
-            if ( ( k . f64 = cp -> argv [ 0 ] . data . f64 [ 0 ] ) != 0.0 )
-                has_const = true;
-            break;
-        }
-        break;
-    }
-
-    if ( has_const )
-    {
-        diff_data *pb = malloc ( sizeof * pb );
-        if ( pb == NULL )
-            return RC ( rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted );
-        * pb = k;
-
-        rslt -> self = pb;
-        rslt -> whack = vxf_diff_wrapper;
-
-        if ( dp -> argc > 1 )
-        {
-            rslt -> u . pf = full_diff_func [ ( dp -> argv [ 0 ] . desc . domain - vtdUint ) * 4 + size_idx ];
-            rslt -> variant = vftFixedRow;
-        }
-        else
-        {
-            rslt -> u . af = const_diff_func [ ( dp -> argv [ 0 ] . desc . domain - vtdUint ) * 4 + size_idx ];
-            rslt -> variant = vftArray;
-        }
-    }
-    else
-    {
-        if ( dp -> argc > 1 )
-        {
-            rslt -> u . pf = no_const_func [ ( dp -> argv [ 0 ] . desc . domain - vtdUint ) * 4 + size_idx ];
-            rslt -> variant = vftFixedRow;
-        }
-        else
-        {
-            rslt -> u . af = no_diff;
-            rslt -> variant = vftArray;
-        }
-    }
-
-    return 0;
-}
diff --git a/libs/vxf/echo.c b/libs/vxf/echo.c
deleted file mode 100644
index c8a8938..0000000
--- a/libs/vxf/echo.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <klib/data-buffer.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <sysalloc.h>
-
-#include <bitstr.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-
-struct self_t {
-    KDataBuffer val;
-    bitsz_t csize;
-    bitsz_t dsize;
-    int count;
-};
-
-static void CC self_free( void *Self ) {
-    struct self_t *self = Self;
-    
-    KDataBufferWhack(&self->val);
-    free(self);
-}
-
-static void fill(struct self_t *self, int start) {
-    int i;
-    
-    for (i = start; i != self->count; ++i)
-        bitcpy(self->val.base, i * self->csize, self->val.base, 0, self->csize);
-}
-
-static rc_t grow_and_fill(struct self_t *self, uint32_t rlen) {
-    bitsz_t rsize = rlen * self->dsize;
-    rc_t rc;
-    
-    if (self->count * self->csize <= rsize) {
-        int old_count = self->count;
-        int new_count = old_count;
-        
-        while (new_count * self->csize <= rsize)
-            new_count <<= 1;
-        
-        rc = KDataBufferResize(&self->val, new_count);
-        if (rc)
-            return rc;
-        
-        self->count = new_count;
-        fill(self, old_count);
-    }
-    return 0;
-}
-
-/* echo
- function < type T > T echo #1.0 < T val > ( any row_len );
- */
-static
-rc_t CC echo_func_1(
-                 void *Self,
-                 const VXformInfo *info,
-                 int64_t row_id,
-                 VRowResult *rslt,
-                 uint32_t argc,
-                 const VRowData argv[]
-) {
-    struct self_t *self = Self;
-    rc_t rc;
-
-    assert(argv[0].u.data.elem_count >> 32 == 0);
-    rc = grow_and_fill(self, (uint32_t)argv[0].u.data.elem_count);
-    if (rc == 0) {
-        KDataBufferWhack(rslt->data);
-        rslt->elem_count = argv[0].u.data.elem_count;
-        rc = KDataBufferSub(&self->val, rslt->data, 0, rslt->elem_count);
-    }
-    return rc;
-}
-
-/* echo
- function < type T > T echo #1.0 < T val > ();
- */
-static
-rc_t CC echo_func_0(
-                 void *Self,
-                 const VXformInfo *info,
-                 int64_t row_id,
-                 VRowResult *rslt,
-                 uint32_t argc,
-                 const VRowData argv[]
-) {
-    struct self_t *self = Self;
-
-    KDataBufferWhack(rslt->data);
-    rslt->elem_count = (uint32_t)( self->csize / self->dsize );
-    return KDataBufferSub(&self->val, rslt->data, 0, rslt->elem_count);
-}
-
-rc_t echo_row_0 ( const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp )
-{
-    rc_t rc;
-    struct self_t *self = malloc ( sizeof *self );
-    if ( self == NULL )
-        return RC(rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted);
-
-    self->dsize = VTypedescSizeof ( & cp->argv[0].desc );
-    self->csize = self->dsize * cp->argv[0].count;
-    self->count = 1;
-
-    rc = KDataBufferMake(&self->val, self->dsize, cp->argv[0].count);
-    if (rc == 0) {
-        bitcpy(self->val.base, 0, cp->argv[0].data.u8, 0, self->csize);
-    
-        rslt->self = self;
-        rslt->whack = self_free;
-        rslt->variant = vftRow;
-        rslt->u.rf = echo_func_0;
-        return 0;
-    }
-    free(self);
-    return rc;
-}
-
-static
-rc_t echo_row_1 ( const VXfactInfo *info, VFuncDesc *rslt,
-    const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rc_t rc;
-    struct self_t *self = malloc ( sizeof *self );
-    if ( self == NULL )
-        return RC ( rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted );
-
-    self->dsize = VTypedescSizeof ( & cp->argv[0].desc );
-    self->csize = self->dsize * cp->argv[0].count;
-    self->count = 256;
-
-    rc = KDataBufferMake(&self->val, self->dsize, cp->argv[0].count*self->count);
-    if (rc == 0)
-    {
-        bitcpy(self->val.base, 0, cp->argv[0].data.u8, 0, self->csize);
-        fill(self, 1);
-
-        rslt->self = self;
-        rslt->whack = self_free;
-        rslt->variant = vftRow;
-        rslt->u.rf = echo_func_1;
-        return 0;
-    }
-    free(self);
-    return rc;
-}
-
-VTRANSFACT_IMPL ( vdb_echo, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    if ( dp -> argc == 0 )
-        return echo_row_0 ( info, rslt, cp );
-    return echo_row_1 ( info, rslt, cp, dp );
-}
diff --git a/libs/vxf/exists.c b/libs/vxf/exists.c
deleted file mode 100644
index b0b6b6c..0000000
--- a/libs/vxf/exists.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <klib/data-buffer.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <sysalloc.h>
-#include <bitstr.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-
-struct self_t {
-    KDataBuffer val;
-    bitsz_t csize;
-    bitsz_t dsize;
-    int count;
-};
-
-static void CC self_free( void *Self ) {
-    struct self_t *self = Self;
-    
-    KDataBufferWhack(&self->val);
-    free(self);
-}
-
-static void fill(struct self_t *self, int start) {
-    int i;
-    
-    for (i = start; i != self->count; ++i)
-        bitcpy(self->val.base, 0, self->val.base, i * self->csize, self->csize);
-}
-
-static rc_t grow_and_fill(struct self_t *self, int rlen) {
-    bitsz_t rsize = rlen * self->dsize;
-    rc_t rc;
-    
-    if (self->count * self->csize <= rsize) {
-        int old_count = self->count;
-        int new_count = old_count;
-        
-        while (new_count * self->csize <= rsize)
-            new_count <<= 1;
-        
-        rc = KDataBufferResize(&self->val, new_count);
-        if (rc)
-            return rc;
-        
-        self->count = new_count;
-        fill(self, old_count);
-    }
-    return 0;
-}
-
-/* exists
- function < type T > T exits #1.0 < T val > ( any predicate, any row_len );
- */
-static
-rc_t CC exists_func_1(
-                 void *Self,
-                 const VXformInfo *info,
-                 int64_t row_id,
-                 VRowResult *rslt,
-                 uint32_t argc,
-                 const VRowData argv[]
-) {
-    struct self_t *self = Self;
-    rc_t rc = grow_and_fill(self, argv[1].u.data.elem_count);
-    
-    if (rc == 0) {
-        KDataBufferWhack(rslt->data);
-        rslt->elem_count = argv[1].u.data.elem_count;
-        rc = KDataBufferSub(&self->val, rslt->data, 0, rslt->elem_count);
-    }
-    return rc;
-}
-
-/* exists
- function < type T > T exists #1.0 < T val > ( any predicate );
- */
-static
-rc_t CC exists_func_0(
-                 void *Self,
-                 const VXformInfo *info,
-                 int64_t row_id,
-                 VRowResult *rslt,
-                 uint32_t argc,
-                 const VRowData argv[]
-) {
-    struct self_t *self = Self;
-
-    KDataBufferWhack(rslt->data);
-    rslt->elem_count = (uint32_t)( self->csize / self->dsize );
-    return KDataBufferSub(&self->val, rslt->data, 0, rslt->elem_count);
-}
-
-rc_t exists_row_0 ( const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp )
-{
-    rc_t rc;
-    struct self_t *self = malloc ( sizeof *self );
-    if ( self == NULL )
-        return RC(rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted);
-
-    self->dsize = VTypedescSizeof ( & cp->argv[0].desc );
-    self->csize = self->dsize * cp->argv[0].count;
-    self->count = 1;
-
-    rc = KDataBufferMake(&self->val, self->dsize, cp->argv[0].count);
-    if (rc == 0) {
-        bitcpy(self->val.base, 0, cp->argv[0].data.u8, 0, self->csize);
-    
-        rslt->self = self;
-        rslt->whack = self_free;
-        rslt->variant = vftRow;
-        rslt->u.rf = exists_func_0;
-        return 0;
-    }
-    free(self);
-    return rc;
-}
-
-static
-rc_t exists_row_1 ( const VXfactInfo *info, VFuncDesc *rslt,
-    const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rc_t rc;
-    struct self_t *self = malloc ( sizeof *self );
-    if ( self == NULL )
-        return RC ( rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted );
-
-    self->dsize = VTypedescSizeof ( & cp->argv[0].desc );
-    self->csize = self->dsize * cp->argv[0].count;
-    self->count = 256;
-
-    rc = KDataBufferMake(&self->val, self->dsize, cp->argv[0].count*self->count);
-    if (rc == 0)
-    {
-        bitcpy(self->val.base, 0, cp->argv[0].data.u8, 0, self->csize);
-        fill(self, 1);
-
-        rslt->self = self;
-        rslt->whack = self_free;
-        rslt->variant = vftRow;
-        rslt->u.rf = exists_func_1;
-        return 0;
-    }
-    free(self);
-    return rc;
-}
-
-/* exists
- *  returns constant or dynamic value if predicate input exists
- *
- *  "T" [ TYPE ] - type of data to return
- *
- *  "cval" [ CONST, OPTIONAL ] - a data constant. when present,
- *  the function will behave like "echo" ( see below )
- *
- *  "predicate" [ DATA ] - an input whose existence determines
- *  whether the function will operate or not.
- *
- *  "dval" [ DATA, OPTIONAL ] - data value, either passed through
- *  or used to determine a repeat count of "cval" ( see below )
- *
- * USAGE:
- *  when "cval" is omitted, "dval" must be present and will be
- *  passed through depending upon the existence of "predicate"
- *    U8 count = < U8 > exists ( col, count2 );
- *
- *  when "cval" is present, "dval" may be omitted, and "cval" will
- *  be passed through just like echo depending upon "predicate"
- *   U8 count = < U8 > exists < 2 > ( col2 ) | < U8 > echo < 1 > ();
- *
- *  when "cval" and "dval" are both present, the behavior is
- *  like echo, but gated with "predicate"
- *    ascii poly = < ascii > exists < 'a' > ( col, repeat );
- *
-function < type T > T exists #1.0 < * T cval > ( any predicate, * T dval ) = vdb:exists;
-*/
-VTRANSFACT_IMPL ( vdb_exists, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    if ( dp -> argc == 1 )
-        return exists_row_0 ( info, rslt, cp );
-    return exists_row_1 ( info, rslt, cp, dp );
-}
diff --git a/libs/vxf/extract_token.c b/libs/vxf/extract_token.c
deleted file mode 100644
index 98d8e28..0000000
--- a/libs/vxf/extract_token.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <klib/data-buffer.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <string.h>
-#include <assert.h>
-
-
-typedef uint16_t text_token;
-enum { tt_id, tt_start, tt_len };
-
-
-/* extract_token
- *  extract a textual token from an input string
- *
- *  "idx" [ CONST ] - a zero-based index of the token
- *  if value < row_len ( tok ), then the substring of
- *  indexed token is returned. otherwise, returns empty.
- *
- *  "str" [ DATA ] - input text. type must be compatible with
- *  output production, meaning types must be same, or ascii input
- *  with utf8 output.
- *
- *  "tok" [ DATA ] - results of tokenizing "str"
- */
-static
-rc_t CC extract_token ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    KDataBuffer *dst = rslt -> data;
-    uint32_t idx = ( uint32_t ) ( size_t ) data;
-
-    rslt -> elem_count = 0;
-    if ( ( uint64_t ) idx >= argv [ 1 ] . u . data . elem_count )
-    {
-        /* issue empty string */
-        rc = KDataBufferResize ( dst, 0 );
-    }
-    else
-    {
-        size_t sub_bytes, elem_bytes = ( size_t ) ( argv [ 0 ] . u . data . elem_bits >> 3 );
-        const char *str = argv [ 0 ] . u . data . base;
-        const text_token *tok = argv [ 1 ] . u . data . base;
-
-        str += argv [ 0 ] . u . data . first_elem * elem_bytes;
-        tok += ( argv [ 1 ] . u . data . first_elem + idx ) * 3;
-        sub_bytes = elem_bytes * tok [ tt_len ];
-
-        /* set output buffer size */
-        KDataBufferCast ( dst, dst, rslt -> elem_bits, true );
-        rc = KDataBufferResize ( dst, tok [ tt_len ] );
-        if ( rc == 0 )
-        {
-            /* copy substring */
-            rslt -> elem_count = tok [ tt_len ];
-            memcpy ( dst -> base, & str [ elem_bytes * tok [ tt_start ] ], sub_bytes );
-        }
-    }
-
-    return rc;
-}
-
-VTRANSFACT_IMPL ( vdb_extract_token, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    /* ensure that the type of input is either identical to
-       or compatible with the output */
-    if ( ! VTypedeclToTypedecl ( & dp -> argv [ 0 ] . fd . td, info -> schema, & info -> fdesc . fd . td, NULL, NULL ) )
-        return RC ( rcXF, rcFunction, rcConstructing, rcType, rcInconsistent );
-
-    rslt -> self = ( void* ) ( size_t ) cp -> argv [ 0 ] . data . u32 [ 0 ];
-    rslt -> variant = vftRow;
-    rslt -> u . rf = extract_token;
-    return 0;
-}
diff --git a/libs/vxf/floor.c b/libs/vxf/floor.c
deleted file mode 100644
index 2fe5aff..0000000
--- a/libs/vxf/floor.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <vdb/extern.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <math.h>
-#include <assert.h>
-
-#define FLOAT_FUNC floorf
-#define DOUBLE_FUNC floor
-#include "math-funcs-impl.h"
-
-/*
- function < type T >
- T vdb:floor #1.0 ( T in );
- */
-VTRANSFACT_IMPL(vdb_floor, 1, 0, 0) (const void *self, const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp ) {
-    return factory(self, info, rslt, cp, dp);
-}
diff --git a/libs/vxf/fsplit-join.impl.h b/libs/vxf/fsplit-join.impl.h
deleted file mode 100644
index 1688723..0000000
--- a/libs/vxf/fsplit-join.impl.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#include <stdint.h>
-#include <float.h>
-#include <math.h>
-
-#if ENCODING
-static unsigned split_and_pack_f32(const float src[], uint32_t n, unsigned m, uint8_t *pexp) {
-    const uint32_t mask = ~(0x007FFFFF >> (m - 1));
-    uint32_t i; /* src & exponent index */
-    uint32_t j; /* mantissa byte offset */
-    uint32_t breg = 0;
-    int inreg = 0;
-    uint8_t *pman = pexp + n;
-    
-    for (i = 0, j = 0; i != n; ++i) {
-        float f = src[i];
-        uint32_t man;
-        int exp;
-        int sgn = 0;
-        
-        if (f == 0.0) {
-            exp = 0;
-            man = 0;
-        }
-        else {
-            if (f < 0.0) {
-                sgn = 1;
-                f = -f;
-            }
-            man = (uint32_t)ldexpf(frexpf(f, &exp), 24);
-            man &= mask;
-#if ROUND_TO_NEAREST
-            {
-                float fl = ldexpf(man, exp - 24);
-                float fh = ldexpf(man + (mask & ~(mask << 1)), exp - 24);
-                
-                if (fh - f < f - fl) {
-                    man = (uint32_t)ldexpf(frexpf(fh, &exp), 24);
-                    man &= mask;
-                }
-            }
-#endif
-            exp += 127;
-            man &= 0x7FFFFF;
-            if (sgn)
-                man |= 0x800000;
-            man >>= (24 - m);
-        }
-        pexp[i] = exp;
-        if (inreg + m < 32) {
-            breg = (breg << m) | man;
-            inreg += m;
-        }
-        else {
-            const int n = 32 - inreg;
-            inreg = m - n;
-            breg = (breg << n) | (man >> inreg);
-            
-            pman[j + 0] = breg >> 24;
-            pman[j + 1] = breg >> 16;
-            pman[j + 2] = breg >>  8;
-            pman[j + 3] = breg >>  0;
-            j += 4;
-            
-            breg = man;
-        }
-    }
-    breg <<= 32 - inreg;
-    while (inreg > 0) {
-        pman[j] = breg >> 24;
-        breg <<= 8;
-        ++j;
-        inreg -= 8;
-    }
-    return j;
-}
-#endif /* ENCODING */
-
-#if DECODING
-static void unpack_and_join_f32(const uint8_t src[], uint32_t n, unsigned m, float dst[]) {
-    uint32_t i;
-    uint32_t j;
-    uint32_t breg;
-    uint32_t inreg;
-    
-    for (i = 0, j = n, breg = 0, inreg = 0; i != n; ) {
-        if (inreg >= m) {
-            const uint32_t man = (((breg >> (inreg - m)) << (24 - m)) & 0x00FFFFFF);
-            const int exp = src[i];
-            
-            if (exp != 0 || man != 0) {
-                const float f = ldexpf(man | 0x800000, (exp - 127) - 24);
-                
-                if ((man & 0x800000) != 0)
-                    dst[i] = -f;
-                else
-                    dst[i] = f;
-            }
-            else
-                dst[i] = 0.0;
-            inreg -= m;
-            ++i;
-        }
-        else {
-            breg = (breg << 8) | src[j];
-            inreg += 8;
-            ++j;
-        }
-    }
-}
-#endif /* DECODING */
diff --git a/libs/vxf/funzip.c b/libs/vxf/funzip.c
deleted file mode 100644
index 3559eab..0000000
--- a/libs/vxf/funzip.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <klib/data-buffer.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <zlib.h>
-#include <assert.h>
-
-#define DECODING 1
-#include "fsplit-join.impl.h"
-
-static rc_t invoke_zlib(void *dst, uint32_t dsize, uint32_t *psize, const void *src, uint32_t ssize) {
-    z_stream s;
-    int zr;
-    rc_t rc;
-    
-    memset(&s, 0, sizeof(s));
-    s.next_in = (void *)src;
-    s.avail_in = ssize;
-    s.next_out = dst;
-    s.avail_out = dsize;
-    
-    *psize = 0;
-    zr = inflateInit2(&s, -15);
-    switch (zr) {
-    case 0:
-        break;
-    case Z_MEM_ERROR:
-        return RC(rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted);
-    default:
-        return RC(rcXF, rcFunction, rcExecuting, rcNoObj, rcUnexpected);
-    }
-    zr = inflate(&s, Z_FINISH);
-    switch (zr) {
-    case Z_STREAM_END:
-        assert(s.total_out <= UINT32_MAX);
-        *psize = (uint32_t)s.total_out;
-        rc = 0;
-        break;
-    case Z_OK:
-        rc = RC(rcXF, rcFunction, rcExecuting, rcMemory, rcInsufficient);
-        break;
-    case Z_BUF_ERROR:
-    case Z_NEED_DICT:
-    case Z_DATA_ERROR:
-        rc = RC(rcXF, rcFunction, rcExecuting, rcData, rcCorrupt);
-        break;
-    case Z_MEM_ERROR:
-        rc = RC(rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted);
-        break;
-    default:
-        rc = RC(rcXF, rcFunction, rcExecuting, rcNoObj, rcUnexpected);
-        break;
-    }
-    zr = inflateEnd(&s);
-    switch (zr) {
-    case Z_OK:
-        return rc;
-    default:
-        if (rc == 0)
-            return RC(rcXF, rcFunction, rcExecuting, rcData, rcCorrupt);
-        return rc;
-    }
-}
-
-static
-rc_t f32unzip_func_v0(
-                   const VXformInfo *info,
-                   VBlobResult *Dst,
-                   const VBlobData *src,
-                   const VBlobHeader *hdr
-) {
-    rc_t rc;
-    uint8_t mantissa;
-    int64_t val;
-    float *dst = Dst->data;
-    uint32_t elem_count;
-    const bitsz_t dbits = Dst->elem_count * Dst->elem_bits;
-    KDataBuffer scratch;
-    
-    rc = KDataBufferMakeBytes(&scratch, (dbits + 7) >> 3);
-    if (rc == 0) {
-        assert(scratch.elem_count >> 32 == 0);
-        rc = invoke_zlib(scratch.base, (uint32_t)scratch.elem_count, &elem_count,
-                         src->data, ((size_t)src->elem_count * src->elem_bits + 7) >> 3);
-        if (rc == 0) {
-            scratch.elem_count = elem_count;
-            
-            VBlobHeaderArgPopHead(hdr, &val);
-            mantissa = (uint8_t)val;
-            
-            elem_count = (uint32_t)((8 * (size_t)scratch.elem_count) / (8 + mantissa));
-            if ((size_t)elem_count * 32 > dbits)
-                rc = RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-            else {
-                Dst->elem_bits = 32;
-                Dst->elem_count = elem_count;
-                Dst->byte_order = vboNative;
-                
-                unpack_and_join_f32(scratch.base, elem_count, mantissa, dst);
-            }
-        }
-    }
-    KDataBufferWhack(&scratch);
-    return rc;
-}
-
-static
-rc_t CC f32unzip_func(
-                void *Self,
-                const VXformInfo *info,
-                VBlobResult *dst,
-                const VBlobData *src,
-                VBlobHeader *hdr
-) {
-    uint8_t bits;
-    
-    switch (VBlobHeaderVersion(hdr)) {
-    case 0:
-        VBlobHeaderOpPopHead(hdr, &bits);
-        switch (bits) {
-        case 0:
-            return f32unzip_func_v0(info, dst, src, hdr);
-        }
-        return RC(rcXF, rcFunction, rcExecuting, rcParam, rcUnexpected);
-    default:
-        return RC(rcXF, rcFunction, rcExecuting, rcParam, rcBadVersion);
-    }
-}
-
-/* unzip
- function
- fzip_set funzip #1.0 ( fzip_fmt in );
- */
-VTRANSFACT_IMPL(vdb_funzip, 1, 0, 0) (const void *self, const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->variant = vftBlob;
-    rslt->u.bf = f32unzip_func;
-
-    return 0;
-}
diff --git a/libs/vxf/fzip.c b/libs/vxf/fzip.c
deleted file mode 100644
index 784bec2..0000000
--- a/libs/vxf/fzip.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <klib/data-buffer.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <zlib.h>
-
-#include <assert.h>
-
-#define ROUND_TO_NEAREST 1
-#define ENCODING 1
-#include "fsplit-join.impl.h"
-
-struct self_t {
-    int32_t mantissa;
-};
-
-static rc_t invoke_zlib(void *dst, uint64_t *dsize, const void *src, uint32_t ssize, int32_t strategy, int32_t level) {
-    z_stream s;
-    int zr;
-    rc_t rc = 0;
-    
-    memset(&s, 0, sizeof(s));
-    s.next_in = (void *)src;
-    s.avail_in = ssize;
-    s.next_out = dst;
-    s.avail_out = (uInt)*dsize;
-    
-    *dsize = 0;
-    zr = deflateInit2(&s, level, Z_DEFLATED, -15, 9, strategy);
-    switch (zr) {
-        case 0:
-            break;
-        case Z_MEM_ERROR:
-            return RC(rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted);
-        case Z_STREAM_ERROR:
-            return RC(rcXF, rcFunction, rcExecuting, rcParam, rcInvalid);
-        default:
-            return RC(rcXF, rcFunction, rcExecuting, rcSelf, rcUnexpected);
-    }
-    zr = deflate(&s, Z_FINISH);
-    switch (zr) {
-        case Z_STREAM_END:
-            break;
-        case Z_OK:
-            s.total_out = 0;
-            break;
-        default:
-            rc = RC(rcXF, rcFunction, rcExecuting, rcSelf, rcUnexpected);
-            break;
-    }
-    zr = deflateEnd(&s);
-    if (zr != Z_OK)
-        rc = RC(rcXF, rcFunction, rcExecuting, rcSelf, rcUnexpected);
-    if (rc == 0) {
-        assert(s.total_out <= UINT32_MAX);
-        *dsize = (uint32_t)s.total_out;
-    }
-    return rc;
-}
-
-static
-rc_t CC f32zip_func(
-              void *Self,
-              const VXformInfo *info,
-              VBlobResult *dst,
-              const VBlobData *Src,
-              VBlobHeader *hdr
-) {
-    rc_t rc;
-    const struct self_t *self = Self;
-    uint64_t dsize = (dst->elem_count * dst->elem_bits + 7) >> 3;
-    uint64_t element_count = (Src->elem_count * Src->elem_bits) >> 5;
-    uint64_t man_bytes;
-    KDataBuffer scratch;
-    
-    assert(element_count >> 32 == 0);
-    assert(dsize >> 32 == 0);
-    rc = KDataBufferMakeBytes(&scratch, element_count << 2);
-    if (rc)
-        return rc;
-    
-    VBlobHeaderSetVersion(hdr, 0);
-    VBlobHeaderOpPushTail(hdr, 0);
-    VBlobHeaderArgPushTail(hdr, self->mantissa);
-    
-    man_bytes = split_and_pack_f32(
-                                   Src->data, (uint32_t)element_count,
-                                   self->mantissa,
-                                   scratch.base);
-    assert((element_count + man_bytes) >> 32 == 0);
-    rc = invoke_zlib(dst->data, &dsize, scratch.base, (uint32_t)(element_count + man_bytes), Z_RLE, Z_BEST_SPEED);
-    KDataBufferWhack(&scratch);
-    if (rc == 0) {
-        dst->elem_bits = 1;
-        dst->byte_order = vboNone;
-        if (dsize)
-            dst->elem_count = dsize << 3;
-        else
-            rc = RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-    }
-    return rc;
-}
-
-static
-void CC vxf_fzip_wrapper( void *ptr )
-{
-	free( ptr );
-}
-
-/* vdb:fzip
- * function fzip_fmt vdb:fzip #1.0 < U32 mantissa > ( fzip_set in );
- */
-VTRANSFACT_IMPL(vdb_fzip, 1, 0, 0) (const void *self, const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    struct self_t *ctx;
-    uint32_t mantissa = 0;
-
-    assert(cp->argc == 1);
-    
-    mantissa = cp->argv[0].data.u32[0];
-    if (1 > mantissa || mantissa > 24)
-        return RC(rcXF, rcFunction, rcConstructing, rcParam, rcInvalid);
-    
-    ctx = malloc(sizeof(*ctx));
-    if (ctx) {
-        ctx->mantissa = mantissa;
-       
-        rslt->self = ctx;
-        rslt->whack = vxf_fzip_wrapper;
-        rslt->variant = vftBlob;
-        rslt->u.bf = f32zip_func;
-        
-        return 0;
-    }
-    return RC(rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted);
-}
diff --git a/libs/vxf/integral.c b/libs/vxf/integral.c
deleted file mode 100644
index 7d40482..0000000
--- a/libs/vxf/integral.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-#include <vdb/xform.h>
-#include <arch-impl.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-
-#define INTEGRAL_NAME( T )  integral_ ## T
-#define INTEGRAL( T )                                                       \
-static                                                                   \
-rc_t CC INTEGRAL_NAME ( T ) ( void *data,                                      \
-    const VXformInfo *info, int64_t row_id, const VFixedRowResult *rslt, \
-    uint32_t argc, const VRowData argv [] )                              \
-{                                                                        \
-    uint32_t i;                                                          \
-                                                                         \
-    T *dst       = rslt -> base;                                         \
-    const T *src = argv [ 0 ] . u . data . base;                         \
-    if(rslt -> elem_count== 0) return 0;				 \
-    dst += rslt -> first_elem;						 \
-    src += argv [ 0 ] . u . data . first_elem;				 \
-    dst [ 0 ] = src [ 0 ];						 \
-                                                                         \
-    for ( i = 1; i < rslt -> elem_count; ++ i ) {                        \
-        dst [ i ] = src [ i ] + dst [ i - 1 ];                           \
-    }                                                                    \
-    return 0;                                                            \
-}
-
-INTEGRAL ( int8_t )
-INTEGRAL ( int16_t )
-INTEGRAL ( int32_t )
-INTEGRAL ( int64_t )
-
-static VFixedRowFunc integral_func [] =
-{
-    INTEGRAL_NAME ( int8_t  ),
-    INTEGRAL_NAME ( int16_t ),
-    INTEGRAL_NAME ( int32_t ),
-    INTEGRAL_NAME ( int64_t )
-};
-/* integral
- *  return the 1 integral of input
- *
- *  "T" [ TYPE ] - input and output data type
- *  must be member of  signed integers
- *
- *  "a" [ DATA ] - operand
- *
- *
- * SYNOPSIS:
- *  return 1st integral for every row
- *
- * USAGE:
- *    I32 position = < I32 > integral ( pos_1st_d );
- */
-VTRANSFACT_IMPL ( vdb_integral, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    int size_idx;
-    switch ( info -> fdesc . desc . domain )
-    {
-    case vtdUint:
-    case vtdInt:
-        break;
-    default:
-        return RC ( rcXF, rcFunction, rcConstructing, rcType, rcIncorrect );
-    }
-
-    /* TBD - eventually support vector integrals
-       for today, check that dim of T is 1 */
-    if ( dp -> argv [ 0 ] . desc . intrinsic_dim != 1 )
-        return RC ( rcXF, rcFunction, rcConstructing, rcType, rcIncorrect );
-
-    /* the only numeric types we support are between 8 and 64 bits */
-    size_idx = uint32_lsbit ( dp -> argv [ 0 ] . desc . intrinsic_bits ) - 3;
-    if ( size_idx < 0 || size_idx > 3 || ( ( dp -> argv [ 0 ] . desc . intrinsic_bits &
-                                             ( dp -> argv [ 0 ] . desc . intrinsic_bits - 1 ) ) != 0 ) )
-        return RC ( rcXF, rcFunction, rcConstructing, rcType, rcIncorrect );
-
-
-    rslt -> u . pf = integral_func [ size_idx ];
-    rslt -> variant = vftFixedRow;
-
-    return 0;
-}
diff --git a/libs/vxf/integral_0.c b/libs/vxf/integral_0.c
deleted file mode 100644
index cda997a..0000000
--- a/libs/vxf/integral_0.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-#include <vdb/xform.h>
-#include <arch-impl.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-
-#define INTEGRAL_NAME( T )  integral_ ## T
-#define INTEGRAL( T )                                                       \
-static                                                                   \
-rc_t CC INTEGRAL_NAME ( T ) ( void *data,                                      \
-    const VXformInfo *info, int64_t row_id, const VFixedRowResult *rslt, \
-    uint32_t argc, const VRowData argv [] )                              \
-{                                                                        \
-    uint32_t i;                                                          \
-                                                                         \
-    T *dst       = rslt -> base;                                         \
-    const T *src = argv [ 0 ] . u . data . base;                         \
-    if(rslt -> elem_count== 0) return 0;				 \
-    dst += rslt -> first_elem;						 \
-    src += argv [ 0 ] . u . data . first_elem;				 \
-    dst [ 0 ] = 0;						 \
-                                                                         \
-    for ( i = 1; i < rslt -> elem_count; ++ i ) {                        \
-        dst [ i ] = src [ i ] + dst [ i - 1 ];                           \
-    }                                                                    \
-    return 0;                                                            \
-}
-
-INTEGRAL ( int8_t )
-INTEGRAL ( int16_t )
-INTEGRAL ( int32_t )
-INTEGRAL ( int64_t )
-
-static VFixedRowFunc integral0_func [] =
-{
-    INTEGRAL_NAME ( int8_t  ),
-    INTEGRAL_NAME ( int16_t ),
-    INTEGRAL_NAME ( int32_t ),
-    INTEGRAL_NAME ( int64_t )
-};
-/* integral
- *  return the 1 integral of input
- *
- *  "T" [ TYPE ] - input and output data type
- *  must be member of  signed integers
- *
- *  "a" [ DATA ] - operand
- *
- *
- * SYNOPSIS:
- *  return 1st integral for every row
- *
- * USAGE:
- *    I32 position = < I32 > integral_0 ( pos_1st_d );
- */
-VTRANSFACT_IMPL ( vdb_integral_0, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    int size_idx;
-    switch ( info -> fdesc . desc . domain )
-    {
-    case vtdUint:
-    case vtdInt:
-        break;
-    default:
-        return RC ( rcXF, rcFunction, rcConstructing, rcType, rcIncorrect );
-    }
-
-    /* TBD - eventually support vector integrals
-       for today, check that dim of T is 1 */
-    if ( dp -> argv [ 0 ] . desc . intrinsic_dim != 1 )
-        return RC ( rcXF, rcFunction, rcConstructing, rcType, rcIncorrect );
-
-    /* the only numeric types we support are between 8 and 64 bits */
-    size_idx = uint32_lsbit ( dp -> argv [ 0 ] . desc . intrinsic_bits ) - 3;
-    if ( size_idx < 0 || size_idx > 3 || ( ( dp -> argv [ 0 ] . desc . intrinsic_bits &
-                                             ( dp -> argv [ 0 ] . desc . intrinsic_bits - 1 ) ) != 0 ) )
-        return RC ( rcXF, rcFunction, rcConstructing, rcType, rcIncorrect );
-
-
-    rslt -> u . pf = integral0_func [ size_idx ];
-    rslt -> variant = vftFixedRow;
-
-    return 0;
-}
diff --git a/libs/vxf/irzip.c b/libs/vxf/irzip.c
deleted file mode 100644
index 2ef4995..0000000
--- a/libs/vxf/irzip.c
+++ /dev/null
@@ -1,564 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-#include <compiler.h>
-#include <klib/sort.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <sysalloc.h>
-
-#include <byteswap.h>
-#include <os-native.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <float.h>
-#include <limits.h>
-#include <math.h>
-
-#include <zlib.h>
-
-#include <stdio.h>
-#include <assert.h>
-
-typedef struct {
-    size_t size;
-    size_t used;
-    void *buf;
-} szbuf;
-
-static rc_t zlib_compress(szbuf *dst, const void *src, size_t ssize, int32_t strategy, int32_t level) {
-    z_stream s;
-    int zr;
-    rc_t rc = 0;
-    
-    memset(&s, 0, sizeof(s));
-    s.next_in = (void *)src;
-    s.avail_in = (uInt)ssize;
-    s.next_out = dst->buf;
-    s.avail_out = (uInt)dst->size;
-    
-    dst->used = 0;
-    
-    zr = deflateInit2(&s, level, Z_DEFLATED, -15, 9, strategy);
-    switch (zr) {
-    case 0:
-        break;
-    case Z_MEM_ERROR:
-        return RC(rcVDB, rcFunction, rcExecuting, rcMemory, rcExhausted);
-    case Z_STREAM_ERROR:
-        return RC(rcVDB, rcFunction, rcExecuting, rcParam, rcInvalid);
-    default:
-        return RC(rcVDB, rcFunction, rcExecuting, rcSelf, rcUnexpected);
-    }
-    zr = deflate(&s, Z_FINISH);
-    switch (zr) {
-    case Z_STREAM_END:
-        break;
-    case Z_OK:
-        s.total_out = 0;
-        break;
-    default:
-        rc = RC(rcVDB, rcFunction, rcExecuting, rcSelf, rcUnexpected);
-        break;
-    }
-    zr = deflateEnd(&s);
-    if (zr != Z_OK)
-        rc = RC(rcVDB, rcFunction, rcExecuting, rcSelf, rcUnexpected);
-    if (rc == 0) {
-        dst->used = (uint32_t)s.total_out;
-    }
-    return rc;
-}
-
-static rc_t zlib_decompress(void *dst, size_t dsize, size_t *psize, const void *src, size_t ssize) {
-    z_stream s;
-    int zr;
-    rc_t rc;
-    
-    memset(&s, 0, sizeof(s));
-    s.next_in = (void *)src;
-    s.avail_in = (uInt)ssize;
-    s.next_out = dst;
-    s.avail_out = (uInt)dsize;
-    
-    zr = inflateInit2(&s, -15);
-    switch (zr) {
-    case 0:
-        break;
-    case Z_MEM_ERROR:
-        return RC(rcVDB, rcFunction, rcExecuting, rcMemory, rcExhausted);
-    default:
-        return RC(rcVDB, rcFunction, rcExecuting, rcNoObj, rcUnexpected);
-    }
-    zr = inflate(&s, Z_FINISH);
-    switch (zr) {
-    case Z_STREAM_END:
-    case Z_OK:
-        *psize = s.total_in;
-        rc = 0;
-        break;
-    case Z_BUF_ERROR:
-    case Z_NEED_DICT:
-    case Z_DATA_ERROR:
-        rc = RC(rcVDB, rcFunction, rcExecuting, rcData, rcCorrupt);
-        break;
-    case Z_MEM_ERROR:
-        rc = RC(rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted);
-        break;
-    default:
-        rc = RC(rcVDB, rcFunction, rcExecuting, rcNoObj, rcUnexpected);
-        break;
-    }
-    if (inflateEnd(&s) == Z_OK) return rc;
-    
-    return rc == 0 ? RC(rcVDB, rcFunction, rcExecuting, rcData, rcCorrupt) : rc;
-}
-
-
-#define STYPE int8_t
-#define USTYPE uint8_t
-#define ENCODE encode_i8
-#define DECODE decode_i8
-#include "irzip.impl.h"
-#undef ENCODE
-#undef DECODE
-#undef STYPE
-#undef USTYPE
-
-#define STYPE int16_t
-#define USTYPE uint16_t
-#define ENCODE encode_i16
-#define DECODE decode_i16
-#include "irzip.impl.h"
-#undef ENCODE
-#undef DECODE
-#undef STYPE
-#undef USTYPE
-
-#define STYPE int32_t
-#define USTYPE uint32_t
-#define ENCODE encode_i32
-#define DECODE decode_i32
-#define TRY2SERIES 1
-#include "irzip.impl.h"
-#undef TRY2SERIES
-#undef ENCODE
-#undef DECODE
-#undef STYPE
-#undef USTYPE
-
-#define STYPE int64_t
-#define USTYPE uint64_t
-#define ENCODE encode_i64
-#define DECODE decode_i64
-#define TRY2SERIES 1
-#include "irzip.impl.h"
-#undef TRY2SERIES
-#undef ENCODE
-#undef DECODE
-#undef STYPE
-#undef USTYPE
-
-#define STYPE uint8_t
-#define USTYPE uint8_t
-#define ENCODE encode_u8
-#define DECODE decode_u8
-#include "irzip.impl.h"
-#undef ENCODE
-#undef DECODE
-#undef STYPE
-#undef USTYPE
-
-#define STYPE uint16_t
-#define USTYPE uint16_t
-#define ENCODE encode_u16
-#define DECODE decode_u16
-#include "irzip.impl.h"
-#undef ENCODE
-#undef DECODE
-#undef STYPE
-#undef USTYPE
-
-#define STYPE uint32_t
-#define USTYPE uint32_t
-#define ENCODE encode_u32
-#define DECODE decode_u32
-#define TRY2SERIES 1
-#include "irzip.impl.h"
-#undef TRY2SERIES
-#undef ENCODE
-#undef DECODE
-#undef STYPE
-#undef USTYPE
-
-#define STYPE uint64_t
-#define USTYPE uint64_t
-#define ENCODE encode_u64
-#define DECODE decode_u64
-#define TRY2SERIES 1
-#include "irzip.impl.h"
-#undef TRY2SERIES
-#undef ENCODE
-#undef DECODE
-#undef STYPE
-#undef USTYPE
-
-
-typedef rc_t (*encode_f)(uint8_t dst[], size_t dsize, size_t *used,
-                         int64_t *Min, int64_t *Slope, uint8_t *series_count,uint8_t *planes, const void *Y, unsigned N);
-
-struct self_t {
-    encode_f f;
-};
-
-static
-struct self_t selfs[8] = {
-    { (encode_f)encode_u8 },
-    { (encode_f)encode_i8 },
-    { (encode_f)encode_u16 },
-    { (encode_f)encode_i16 },
-    { (encode_f)encode_u32 },
-    { (encode_f)encode_i32 },
-    { (encode_f)encode_u64 },
-    { (encode_f)encode_i64 },
-};
-
-
-
-static
-rc_t CC irzip(
-               void *Self,
-               const VXformInfo *info,
-               VBlobResult *dst,
-               const VBlobData *src,
-               VBlobHeader *hdr
-) {
-    rc_t rc = 0;
-    const struct self_t *self = Self;
-    size_t dsize;
-    int64_t min[2],slope[2];
-    uint8_t planes;
-    uint8_t series_count = 1;
-
-    assert(src->elem_count >> 32 == 0);
-    assert(((dst->elem_count * dst->elem_bits + 7) >> 3) >> 32 == 0);
-    dsize = (uint32_t)((dst->elem_count * dst->elem_bits + 7) >> 3);
-    
-   
-    rc = self->f(dst->data, dsize, &dsize, min, slope, &series_count, &planes, src->data, (unsigned)src->elem_count);
-#if 0
-    if(/*src->elem_bits ==64 &&*/ dsize > 0){
-	printf("%2d:irzip_elem_bits=%.8f\telem=%d\tstart=%ld\tslope=%lx\tplanes=%d\n",(int)src->elem_bits,dsize*8./src->elem_count,(int)src->elem_count,min,slope,planes);
-    }
-#endif
-    
-    VBlobHeaderSetVersion(hdr, (series_count > 1)?3:2);
-    if ( rc == 0 ) {
-	rc = VBlobHeaderOpPushTail(hdr, planes);
-	if ( rc == 0) {
-		rc = VBlobHeaderArgPushTail(hdr, min[0]);
-		if ( rc == 0 ) {
-			rc = VBlobHeaderArgPushTail(hdr, slope[0]);
-			if ( rc == 0 ){
-				if(series_count > 1){
-					rc = VBlobHeaderArgPushTail(hdr, min[1]);
-					if(rc == 0) rc = VBlobHeaderArgPushTail(hdr, slope[1]);
-				}
-				dst->byte_order = vboNative;
-				dst->elem_bits = 1;
-				dst->elem_count = dsize << 3;
-			}
-		}
-	}
-   }
-    return rc;
-}
-
-/* 
- function izip_fmt izip #2.1 ( izip_set in )
- */
-VTRANSFACT_IMPL(vdb_izip, 2, 1, 1) (const void *Self, const VXfactInfo *info,
-                                     VFuncDesc *rslt, const VFactoryParams *cp,
-                                     const VFunctionParams *dp )
-{
-/*
-* 2.1.1: bug fix for #VDB-539, bad conversions in encode_u64
-*/
-
-    if (dp->argc != 1) {
-#if _DEBUGGING
-        fprintf(stderr, "dp->argc = %u != 1\n", dp->argc);
-#endif
-        return RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-    }
-
-    rslt->variant = vftBlob;
-    rslt->u.bf = irzip;
-
-    switch (dp->argv[0].desc.domain) {
-    case vtdInt:
-        switch (dp->argv[0].desc.intrinsic_bits) {
-        case 8:
-            rslt->self = &selfs[1];
-            break;
-        case 16:
-            rslt->self = &selfs[3];
-            break;
-        case 32:
-            rslt->self = &selfs[5];
-            break;
-        case 64:
-            rslt->self = &selfs[7];
-            break;
-        default:
-#if _DEBUGGING
-            fprintf(stderr, "intrinsic_bits = %u != (8|16|32|64)\n", dp->argv[0].desc.intrinsic_bits);
-#endif
-            return RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-            break;
-        }
-        break;
-    case vtdUint:
-        switch (dp->argv[0].desc.intrinsic_bits) {
-        case 8:
-            rslt->self = &selfs[0];
-            break;
-        case 16:
-            rslt->self = &selfs[2];
-            break;
-        case 32:
-            rslt->self = &selfs[4];
-            break;
-        case 64:
-            rslt->self = &selfs[6];
-            break;
-        default:
-#if _DEBUGGING
-            fprintf(stderr, "intrinsic_bits = %u != (8|16|32|64)\n", dp->argv[0].desc.intrinsic_bits);
-#endif
-            return RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-            break;
-        }
-        break;
-    default:
-#if _DEBUGGING
-        fprintf(stderr, "domain != vtdInt or vtdUint\n");
-#endif
-        return RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-    }
-
-    return 0;
-}
-
-typedef rc_t (*decode_f)(void *dst, unsigned N, int64_t* min, int64_t* slope, uint8_t series_count,uint8_t planes, const uint8_t src[], size_t ssize);
-
-static
-decode_f uselfs[8] = {
-    (decode_f)decode_u8,
-    (decode_f)decode_i8,
-    (decode_f)decode_u16,
-    (decode_f)decode_i16,
-    (decode_f)decode_u32,
-    (decode_f)decode_i32,
-    (decode_f)decode_u64,
-    (decode_f)decode_i64,
-};
-
-static
-rc_t iunzip_func_v1(
-                    void *Self,
-                    const VXformInfo *info,
-                    VBlobResult *dst,
-                    const VBlobData *src,
-                    int64_t* min,int64_t* slope,uint8_t series_count,
-                    uint8_t planes
-                    )
-{
-    uint32_t ssize;
-    rc_t rc;
-    
-    assert(dst->elem_count >> 32 == 0);
-    assert(((src->elem_count * src->elem_bits + 7) >> 3) >> 32 == 0);
-    ssize = (uint32_t)((src->elem_count * src->elem_bits + 7) >> 3);
-    
-    dst->byte_order = vboNative;
-    
-    rc = uselfs[(uintptr_t)(Self)](dst->data, (unsigned)dst->elem_count, min, slope, series_count, planes,src->data, ssize);
-    return rc;
-}
-
-extern rc_t CC iunzip_func_v0(
-                              void *Self,
-                              const VXformInfo *info,
-                              VBlobResult *dst,
-                              const VBlobData *src
-                              );
-    
-static
-rc_t CC iunzip(
-            void *Self,
-            const VXformInfo *info,
-            VBlobResult *dst,
-            const VBlobData *src,
-            VBlobHeader *hdr
-            )
-{
-    switch (VBlobHeaderVersion(hdr)) {
-    case 0:
-        return iunzip_func_v0(Self, info, dst, src);
-    case 1: 
-    case 2: 
-    case 3:
-	{
-        int64_t min[2],slope[2];
-        uint8_t planes;
-	uint8_t series_count=1;
-        rc_t rc;
-        
-        rc = VBlobHeaderOpPopHead(hdr, &planes);
-        if (rc == 0) {
-            rc = VBlobHeaderArgPopHead(hdr, min);
-            if (rc == 0) {
-		rc = VBlobHeaderArgPopHead(hdr, slope);
-		if (rc != 0) slope[0] = 0;
-		else {
-			rc = VBlobHeaderArgPopHead(hdr, min + 1);
-			if(rc==0) rc= VBlobHeaderArgPopHead(hdr, slope+1);
-			if(rc==0) series_count=2;
-		}
-                return iunzip_func_v1(Self, info, dst, src, min,slope, series_count, planes);
-            }
-	}
-        return rc;
-    }
-    default:
-        return RC(rcVDB, rcFunction, rcExecuting, rcParam, rcBadVersion);
-    }
-}
-
-/* 
- function izip_set iunzip #2.1 ( izip_fmt in )
- */
-VTRANSFACT_IMPL(vdb_iunzip, 2, 1, 0) (const void *Self, const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->variant = vftBlob;
-    rslt->u.bf = iunzip;
-    
-    switch (info->fdesc.desc.domain) {
-    case vtdInt:
-        switch (info->fdesc.desc.intrinsic_bits) {
-        case 8:
-            rslt->self = (void *)1;
-            break;
-        case 16:
-            rslt->self = (void *)3;
-            break;
-        case 32:
-            rslt->self = (void *)5;
-            break;
-        case 64:
-            rslt->self = (void *)7;
-            break;
-        default:
-#if _DEBUGGING
-            fprintf(stderr, "intrinsic_bits = %u != (8|16|32|64)\n", info->fdesc.desc.intrinsic_bits);
-#endif
-            return RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-            break;
-        }
-        break;
-    case vtdUint:
-        switch (info->fdesc.desc.intrinsic_bits) {
-        case 8:
-            rslt->self = (void *)0;
-            break;
-        case 16:
-            rslt->self = (void *)2;
-            break;
-        case 32:
-            rslt->self = (void *)4;
-            break;
-        case 64:
-            rslt->self = (void *)6;
-            break;
-        default:
-#if _DEBUGGING
-            fprintf(stderr, "intrinsic_bits = %u != (8|16|32|64)\n", info->fdesc.desc.intrinsic_bits);
-#endif
-            return RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-            break;
-        }
-        break;
-    default:
-#if _DEBUGGING
-        fprintf(stderr, "domain != vtdInt or vtdUint\n");
-#endif
-        return RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-    }
-    return 0;
-}
-
-#if TESTING
-int test_encode(const int32_t Y[], unsigned N) {
-    uint8_t *dst;
-    size_t dsize;
-    size_t temp;
-    rc_t rc = 0;
-    int64_t min,slope;
-    uint8_t planes;
-    
-    temp = N * sizeof(Y[0]);
-    assert(temp >> 32 == 0);
-    dst = malloc(dsize = (unsigned)temp);
-    if (dst == NULL)
-        return RC(rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted);
-
-    rc = encode_i32(dst, dsize, &dsize, &min, &slope, &planes, Y, N);
-    
-    {
-        int32_t *X;
-        
-        X = malloc(N * sizeof(Y[0]));
-        if (X) {
-            rc = decode_i32( X, N, min, slope, planes, dst, dsize);
-            if (rc == 0) {
-                rc = memcmp(Y, X, N * sizeof(Y[0])) == 0 ? 0 : RC(rcXF, rcFunction, rcExecuting, rcFunction, rcInvalid);
-            }
-            free(X);
-        }
-    }
-
-    free(dst);
-    if (rc)
-        fprintf(stdout, "test failed!\n");
-    return rc;
-}
-#endif
-
diff --git a/libs/vxf/irzip.impl.h b/libs/vxf/irzip.impl.h
deleted file mode 100644
index ff12a7b..0000000
--- a/libs/vxf/irzip.impl.h
+++ /dev/null
@@ -1,482 +0,0 @@
-/*
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-#define DELTA_UND  0
-#if _ARCH_BITS == 32
-#define DELTA_POS  0x7ffffffffffffff0LL
-#define DELTA_NEG  0x7ffffffffffffff1LL
-#define DELTA_BOTH 0x7ffffffffffffff2LL
-#else
-#define DELTA_POS  0x7ffffffffffffff0
-#define DELTA_NEG  0x7ffffffffffffff1
-#define DELTA_BOTH 0x7ffffffffffffff2
-#endif
-
-#define TRIGGER_2ND_SERIES 10*1024
-
-static rc_t ENCODE(uint8_t dst[], size_t dsize, size_t *used, int64_t *Min, int64_t *Slope, uint8_t *series_count,uint8_t *planes, const STYPE Y[], unsigned N)
-{
-    unsigned i;
-    unsigned k;
-    rc_t rc=0;
-    STYPE min,a0;
-    int64_t 	slope, delta_type = DELTA_UND,y_cur;
-    uint64_t    sum_a0,sum_min,sum_y,sum_delta;
-    uint64_t	max_diff;
-    uint8_t	*scratch=NULL;
-#ifdef TRY2SERIES
-    uint8_t	*series=NULL;/*** for 2nd series flag ***/
-    uint64_t    sum_delta2[2] = {0,0};
-    uint64_t    max_diff2[2] = {0,0};
-    uint32_t	last[2]; /** to run 2 series ***/
-    int64_t	delta2_type[2] = {DELTA_UND,DELTA_UND};
-#endif
-
-    if( N < 10 ) /*** no reason to encode **/
-		return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-
-    scratch=malloc(N*sizeof(STYPE));
-    if(scratch==NULL) return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-#ifdef TRY2SERIES
-    series=malloc(N*sizeof(*series));
-    if(series==NULL) return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-#endif
-   
-    /*** the code tries to best-fit one of 3 cases ****/
-    /*** 1. delta - for monotonous data **/
-    /*** 2. horizontal line through the minimum ****/
-    /*** 3. sloped line from the first element y[i] = y[0] + i * slope ***/
-    /*** all algorithms keep delta positive ****/
-    /*** 1. is preferred ***/
-    /*** the best between 2 and 3 is chosen by the sum of all deltas ****/
-    /*** floating point calculations are avoided ***/
-	a0 =  Y[0];
-	y_cur = Y[1];
-	sum_y =  Y[0] +  Y[1];
-	slope = (int64_t)Y[1] - (int64_t)Y[0];
-	if(slope < 0) {
-		min = Y[1]; 
-		sum_delta = -slope;
-		delta_type = DELTA_NEG;
-	} else {
-		min = Y[0];
-		sum_delta = slope;
-		if( slope != 0 ) delta_type = DELTA_POS;
-	}
-	max_diff = sum_delta;
-#ifdef TRY2SERIES
-	if(sum_delta >= TRIGGER_2ND_SERIES){
-		last[0]=0; last[1]=1;
-		series[0]=0; series[1]=1;
-	} else {
-		last[0]=1; last[1]=0;
-		series[0]=0; series[1]=0;
-		delta2_type[0] = delta_type;
-		sum_delta2[0]=sum_delta;
-		max_diff2[0]= sum_delta;
-	}
-#endif
-	for (i = 2; i < N; ++i) {
-		int64_t  md = (int64_t)Y[i] - (int64_t)min;
-		int64_t diff =  (int64_t)Y[i] - (int64_t)Y[i-1];
-		uint64_t abs_diff = (diff >= 0) ? diff : -diff;
-#ifdef TRY2SERIES
-		int64_t	last_delta_type = delta_type ;
-#endif
-		sum_y += Y[i];
-		sum_delta += abs_diff;
-		if(abs_diff > max_diff) max_diff = abs_diff;
-#define MACRO_SET_DELTA_TYPE(Diff,DeltaType) \
-		if( DeltaType != DELTA_BOTH){ \
-			if ( Diff > 0){ \
-				if(DeltaType == DELTA_NEG ) DeltaType =DELTA_BOTH; \
-				else if (DeltaType == DELTA_UND) DeltaType = DELTA_POS; \
-			} else if ( Diff < 0 ){ \
-				if(DeltaType == DELTA_POS ) DeltaType =DELTA_BOTH; \
-				else if (DeltaType == DELTA_UND) DeltaType = DELTA_NEG; \
-			} \
-		}
-		MACRO_SET_DELTA_TYPE(diff,delta_type);
-#ifdef TRY2SERIES
-		if(last[1] == 0){/** don't have a second series yet ***/
-			if(abs_diff >= TRIGGER_2ND_SERIES){
-				last[1]=i;
-				series[i]=1;
-				sum_delta2[0] = sum_delta - abs_diff;
-				delta2_type[0] = last_delta_type;
-				max_diff2[0] = max_diff;
-			} else {
-				last[0]=i;
-				series[i]=0;
-			}
-		} else { /*** second series is in being built ***/
-			int64_t diff1 =  (int64_t)Y[i] - (int64_t)Y[last[0]];
-			int64_t diff2 =  (int64_t)Y[i] - (int64_t)Y[last[1]];
-			uint64_t abs_diff1 = (diff1 >= 0) ? diff1 : -diff1;
-			uint64_t abs_diff2 = (diff2 >= 0) ? diff2 : -diff2;
-			if(abs_diff1 <= abs_diff2){
-				last[0]=i;
-				series[i]=0;
-				sum_delta2[0] += abs_diff1;
-				if(abs_diff1 > max_diff2[0]) max_diff2[0] = abs_diff1;
-				MACRO_SET_DELTA_TYPE(diff1,delta2_type[0]);
-			} else {
-				last[1]=i;
-				series[i]=1;
-				sum_delta2[1] += abs_diff2;
-				if(abs_diff2 > max_diff2[1]) max_diff2[1] = abs_diff2;
-				MACRO_SET_DELTA_TYPE(diff2,delta2_type[1]);
-			}
-		}
-#endif
-		if ( md < 0 ) {
-			min = Y[i];
-		}
-		y_cur += slope;
-		if(y_cur > (int64_t)Y[i]){/*** reduce the slope ***/
-			slope =  ((int64_t)Y[i] - (int64_t)Y[0] - i+1/**round down**/) /i;
-			y_cur =  (int64_t)Y[0] + (int64_t)(i* slope);
-			assert( y_cur <= (int64_t)Y[i]);
-		}
-	}
-
-    /*** define which delta is the smallest **/
-    *series_count=1;
-    if(delta_type == DELTA_BOTH) sum_delta <<= 1; /*** in DELTA_BOTH case we will use extra bit ***/
-    
-    sum_min = sum_y - N*min;
-    sum_a0  = sum_y - N*a0 - slope*N*(N-1)/2;
-    
-			
-    if( (delta_type == DELTA_POS || delta_type == DELTA_NEG ||
-        (delta_type == DELTA_BOTH &&  max_diff <  (((uint64_t)1)<<(sizeof(STYPE)*8-1))) /*** to prevent loosing a bit **/
-        ) && sum_delta <= sum_min && sum_delta <= sum_a0){
-	a0=Y[0];
-	slope = delta_type;
-    } else if(sum_a0 > sum_min){
-	a0 = min;
-	slope = 0;
-    }
-	
-
-    *planes = 0;
-    *used = 0;
-    *Min= a0;
-    *Slope = slope;
-
-#ifdef TRY2SERIES
-    if(last[1] > 0){
-	bool delta2_is_ok=true;
-	uint64_t    sum_delta2_total=0;
-	if(delta2_type[0] == DELTA_UND) delta2_type[0] = DELTA_POS;
-	if(delta2_type[1] == DELTA_UND) delta2_type[1] = DELTA_POS;
-
-	if(delta2_type[0] == DELTA_BOTH){
-		 delta2_is_ok = delta2_is_ok && (max_diff2[0] <  (((uint64_t)1)<<(sizeof(STYPE)*8-2)));
-		 sum_delta2_total += sum_delta2[0] * 4;
-	} else {
-		 delta2_is_ok = delta2_is_ok && (max_diff2[0] <  (((uint64_t)1)<<(sizeof(STYPE)*8-1)));
-		 sum_delta2_total += sum_delta2[0] * 2;
-	}
-	if(delta2_type[1] == DELTA_BOTH){
-		delta2_is_ok = delta2_is_ok && (max_diff2[1] <  (((uint64_t)1)<<(sizeof(STYPE)*8-2)));
-		sum_delta2_total += sum_delta2[1] * 4;
-	} else {
-		delta2_is_ok = delta2_is_ok && (max_diff2[1] <  (((uint64_t)1)<<(sizeof(STYPE)*8-1)));
-		sum_delta2_total += sum_delta2[1] * 2;
-	}
-	
-	if(delta2_is_ok && sum_delta2_total < sum_delta && sum_delta2_total < sum_min && sum_delta2_total< sum_a0){
-		*series_count=2;
-		Slope[0] = delta2_type[0];
-		Slope[1] = delta2_type[1];
-		Min[0]   = Y[0];
-	}
-    }
-#endif
-
-#define MACRO_FLUSH_VALUE \
-	for(k=0;k<sizeof(STYPE);k++){ \
-		if ((scratch[i+k*N] = (uint8_t)(val & 0xff)) != 0){ \
-			*planes |= (1<<k); \
-		} \
-		val >>= 8; \
-	}
-
-    /*** rotate the array ***/
-    if( *series_count > 1 ){
-#ifdef TRY2SERIES
-	for( i = 0,last[0]=0,last[1]=0; i != N; ++i){
-		uint64_t val;
-		if(series[i] == 0){
-			if(delta2_type[0] == DELTA_POS)       { assert(Y[i] >= Y[last[0]]); val = Y[i] - Y[last[0]];}
-			else if (delta2_type[0] == DELTA_NEG) { assert(Y[i] <= Y[last[0]]); val = Y[last[0]] - Y[i];}
-			else if( Y[i] >= Y[last[0]] )         val = (Y[i] - Y[last[0]])*2;
-			else				      val = (Y[last[0]] - Y[i])*2+1;
-			last[0]=i;
-			val<<=1;
-		} else {
-			if(last[1]==0){
-				Min[1] = Y[i];
-				val = 1;/*** flag second series with a bit ***/
-			} else {
-				if(delta2_type[1] == DELTA_POS)       { assert(Y[i] >= Y[last[1]]); val = Y[i] - Y[last[1]];}
-				else if (delta2_type[1] == DELTA_NEG) { assert(Y[i] <= Y[last[1]]); val = Y[last[1]] - Y[i];}
-				else if( Y[i] >= Y[last[1]] )         val = (Y[i] - Y[last[1]])*2;
-				else				      val = (Y[last[1]] - Y[i])*2+1;
-				val = val*2+1; /*** flag second series with a bit ***/
-			}
-			last[1]=i;
-		}
-                MACRO_FLUSH_VALUE;
-        }
-#else
-	assert(0);
-	rc=RC(rcXF, rcFunction, rcExecuting, rcParam, rcInconsistent);
-#endif
-    } else if(slope == DELTA_POS){
-	for( i = 0; i != N; ++i){
-		uint64_t val=Y[i] - a0;
-		assert(Y[i] >= a0);
-		a0 =  Y[i];
-		MACRO_FLUSH_VALUE;
-	}
-    } else if( slope == DELTA_NEG){
-	for( i = 0; i != N; ++i){
-		uint64_t  val = a0 - Y[i];
-		assert(Y[i] <= a0);
-                a0 =  Y[i];
-		MACRO_FLUSH_VALUE;
-	}
-    } else if( slope == DELTA_BOTH){
-	for( i = 0; i != N; ++i){
-		uint64_t val;
-		if( Y[i] >= a0 ){ /** move sign bit into the lowest bit ***/
-                        val = ( Y[i] - a0 ) << 1;
-                } else {
-                        val = ( a0 - Y[i]) * 2 + 1;
-                }
-                a0 =  Y[i];
-		MACRO_FLUSH_VALUE;
-	}
-    } else {
-	for( i = 0; i != N; ++i){
-		uint64_t val =  Y[i] - a0 - slope*i;
-		assert((int64_t)Y[i] >=  (int64_t)a0 + slope*i);
-		MACRO_FLUSH_VALUE;
-	}
-    }
-
-    /*** record the arrays ***/
-    for(k=0;k<sizeof(STYPE) && rc == 0; k++){
-	if (*planes & (1<<k)) {
-		szbuf s2;
-		s2.used = 0;
-		s2.size = dsize - *used;
-		s2.buf  = dst + *used;
-		rc = zlib_compress(&s2, scratch+k*N, N,Z_RLE, Z_BEST_SPEED);
-		if ( rc == 0 ) {
-			*used += s2.used;
-			if (s2.used == 0) /*** skip zipping **/
-				 rc=RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-		}
-	}
-    }
-    if(scratch) free(scratch);
-#ifdef TRY2SERIES
-    if(series) free(series);
-#endif
-    return rc;
-}
-
-static rc_t DECODE(STYPE Y[], unsigned N, int64_t* min, int64_t* slope, uint8_t series_count, uint8_t planes, const uint8_t src[], size_t ssize)
-{
-    unsigned k;
-    size_t j;
-    unsigned m;
-    unsigned i;
-    uint8_t *scratch=NULL;
-    rc_t rc=0;
-    bool    first;
-
-    memset(Y, 0, sizeof(Y[0]) * N);
-    for (j = k = 0, m = 1,first=true; m < 0x100; m <<= 1, k += 8) {
-        size_t n;
-        
-        if ((planes & m) == 0)
-            continue;
-        
-        n = 0;
-	if( !scratch ) scratch = malloc(N);
-	
-        rc = zlib_decompress(scratch, N, &n, src + j, ssize - j);
-        if (rc) goto DONE;
-        j += n;
-	if(first){
-		for (i = 0; i != N; ++i) Y[i] = ((STYPE)scratch[i]) << k;
-		first = false;
-	} else {
-		for (i = 0; i != N; ++i) Y[i] |= ((STYPE)scratch[i]) << k;
-	}
-    }
-    if(series_count == 2){
-#if 0 /** trying to unroll ***/
-	STYPE Ylast;
-	if(slope[0]==DELTA_BOTH){
-		if(slope[1]==DELTA_BOTH){ 
-			for(i = 0; i != N; ++i){
-				scratch[i] = Y[i]&3;
-				Y[i] = ((USTYPE)Y[i]) >> 2;
-			}
-		} else {
-			for(i = 0; i != N; ++i){
-				uint8_t tmp = Y[i]&1;
-				if(tmp){
-					scratch[i] = tmp;
-					Y[i] = ((USTYPE)Y[i]) >> 1;
-				} else {
-					scratch[i] = Y[i]&3;
-					Y[i] = ((USTYPE)Y[i]) >> 2;
-				}
-                        }
-
-		}
-	} else {
-		if(slope[1]==DELTA_BOTH){
-			for(i = 0; i != N; ++i){
-                                uint8_t tmp = Y[i]&1;
-                                if(!tmp){
-                                        scratch[i] = tmp;
-					Y[i] = ((USTYPE)Y[i]) >> 1;
-                                } else {
-                                        scratch[i] = Y[i]&3;
-					Y[i] = ((USTYPE)Y[i]) >> 2;
-
-                                }
-                        }
-		} else {
-			for(i = 0; i != N; ++i){
-				scratch[i] = Y[i]&1;
-				Y[i] = ((USTYPE)Y[i]) >> 1;
-			}
-		}
-	}
-	/** k=0 - main series, k=1 -secondary **/
-	for(k=0;k<2;k++){
-		Ylast = min[k];
-		if(slope[k]==DELTA_POS) {
-			for (i = 0; i != N; ++i){
-				if((scratch[i]&1)==k){
-					Y[i]  = Ylast + Y[i];
-					Ylast = Y[i];
-				}
-			}
-		} else if (slope[k]==DELTA_NEG){
-			for (i = 0; i != N; ++i){
-				if((scratch[i]&1)==k){
-					Y[i]  = Ylast - Y[i];
-					Ylast = Y[i];
-				}
-			}
-		} else for (i = 0; i != N; ++i){
-			if((scratch[i]&1)==k){
-				if(scratch[i]&2){
-					Y[i]  = Ylast - Y[i];
-				} else {
-					Y[i]  = Ylast + Y[i];
-				}
-				Ylast = Y[i];
-			}
-		}
-	}
-
-#else
-	uint32_t last[2]={0,0};
-	for (i = 0; i != N; ++i){
-		if( (Y[i]&1) == 0 ){/**main series **/
-			USTYPE val = (USTYPE)Y[i];
-			val >>= 1;
-			if(i==0){
-                                Y[i] = (STYPE)min[0];
-                                last[0]=i;
-                        }
-			if(slope[0]==DELTA_POS)      Y[i] = Y[last[0]] + val;
-			else if(slope[0]==DELTA_NEG) Y[i] = Y[last[0]] - val;
-			else if ((val&1)==0)         Y[i] = Y[last[0]] + (val >>1);
-			else 	                     Y[i] = Y[last[0]] - (val >>1);
-			last[0]=i;
-		} else { /**secondary series ***/
-			USTYPE val = (USTYPE)Y[i];
-			val >>= 1;
-			if(last[1]==0){
-				Y[i] = (STYPE)min[1];
-				last[1]=i;
-			}
-                        if(slope[1]==DELTA_POS)      Y[i] = Y[last[1]] + val;
-                        else if(slope[1]==DELTA_NEG) Y[i] = Y[last[1]] - val;
-                        else if ((val&1)==0)         Y[i] = Y[last[1]] + (val >>1);
-                        else                         Y[i] = Y[last[1]] - (val >>1);
-                        last[1]=i;
-		}
-        }
-#endif
-    } else if(min[0]==0 && slope[0]==0){ /*** no slope no offset - nothing to do ***/
-    } else if(slope[0] == DELTA_POS){
-	assert(Y[0] == 0);
-	Y[0] = (STYPE)min[0];
-	for (i = 1; i != N; ++i){
-		Y[i] = Y[i-1] + Y[i];
-	}
-    } else if (slope[0] == DELTA_NEG ) {
-	assert(Y[0] == 0);
-	Y[0] = (STYPE)min[0];
-	for (i = 1; i != N; ++i){
-		Y[i] =  Y[i-1] - Y[i];
-	}
-    } else if (slope[0] == DELTA_BOTH){
-	assert(Y[0] == 0);
-	Y[0] = (STYPE)min[0];
-	for (i = 1; i != N; ++i){
-		USTYPE val = (USTYPE)Y[i];
-		val >>= 1;
-		if(Y[i] & 1) Y[i] = Y[i-1] - val;
-		else         Y[i] = Y[i-1] + val;
-	}
-    } else if(slope[0] == 0) {
-	for (i = 0; i != N; ++i){
-		Y[i]  += (STYPE)min[0];
-	}
-    } else {
-	for (i = 0; i != N; ++i){
-                Y[i]  += (STYPE)min[0];
-                min[0] += slope[0];
-        }
-    }
-
-DONE:
-    if(scratch) free(scratch);
-    return rc;
-}
diff --git a/libs/vxf/iunzip.c b/libs/vxf/iunzip.c
deleted file mode 100644
index fb9cf52..0000000
--- a/libs/vxf/iunzip.c
+++ /dev/null
@@ -1,748 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <sysalloc.h>
-#include <byteswap.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <float.h>
-#include <limits.h>
-#include <math.h>
-
-#include <zlib.h>
-
-#include <stdio.h>
-#include <assert.h>
-
-#include "izip-common.h"
-
-static void unpack_nbuf16_swap(nbuf *x) {
-    unsigned i;
-    
-    for (i = x->used; i; --i) {
-        x->data.raw[i - 1] = bswap_16(x->data.u16[i - 1]) + x->min;
-    }
-}
-
-static void unpack_nbuf32_swap(nbuf *x) {
-    unsigned i;
-    
-    for (i = x->used; i; --i) {
-        x->data.raw[i - 1] = bswap_32(x->data.u32[i - 1]) + x->min;
-    }
-}
-
-static void unpack_nbuf8(nbuf *x) {
-    unsigned i;
-    
-    for (i = x->used; i; --i) {
-        x->data.raw[i - 1] = x->data.u8[i - 1] + x->min;
-    }
-}
-
-static void unpack_nbuf16(nbuf *x) {
-    unsigned i;
-    
-    for (i = x->used; i; --i) {
-        x->data.raw[i - 1] = x->data.u16[i - 1] + x->min;
-    }
-}
-
-static void unpack_nbuf32(nbuf *x) {
-    unsigned i;
-    
-    for (i = x->used; i; --i) {
-        x->data.raw[i - 1] = x->data.u32[i - 1] + x->min;
-    }
-}
-
-static void unpack_nbuf(nbuf *x) {
-    unsigned i;
-    
-    switch (x->var) {
-    case 4:
-        unpack_nbuf8(x);
-        break;
-    case 3:
-        unpack_nbuf16(x);
-        break;
-    case 2:
-        unpack_nbuf32(x);
-        break;
-    default:
-        for (i = x->used; i; --i) {
-            x->data.raw[i - 1] = x->data.u64[i - 1] + x->min;
-        }
-        break;
-    }
-    x->var = 0;
-}
-
-static void unpack_nbuf_swap(nbuf *x) {
-    unsigned i;
-    
-    switch (x->var) {
-    case 4:
-        unpack_nbuf8(x);
-        break;
-    case 3:
-        unpack_nbuf16_swap(x);
-        break;
-    case 2:
-        unpack_nbuf32_swap(x);
-        break;
-    default:
-        for (i = x->used; ; --i) {
-            x->data.raw[i - 1] = bswap_64(x->data.u64[i - 1]) + x->min;
-            if (i == 0)
-                break;
-        }
-        break;
-    }
-    x->var = 0;
-}
-
-static rc_t zlib_decompress(void *dst, unsigned dsize, unsigned *psize, const void *src, uint32_t ssize) {
-    z_stream s;
-    int zr;
-    rc_t rc = 0;
-    
-    memset(&s, 0, sizeof(s));
-    s.next_in = (void *)src;
-    s.avail_in = ssize;
-    s.next_out = dst;
-    s.avail_out = dsize;
-    
-    zr = inflateInit2(&s, -15);
-    switch (zr) {
-    case 0:
-        break;
-    case Z_MEM_ERROR:
-        return RC(rcVDB, rcFunction, rcExecuting, rcMemory, rcExhausted);
-    default:
-        return RC(rcVDB, rcFunction, rcExecuting, rcNoObj, rcUnexpected);
-    }
-    zr = inflate(&s, Z_FINISH);
-    switch (zr) {
-    case Z_STREAM_END:
-        assert(s.total_out <= UINT32_MAX);
-        *psize = (uint32_t)s.total_out;
-        rc = 0;
-        break;
-    case Z_OK:
-        rc = RC(rcXF, rcFunction, rcExecuting, rcMemory, rcInsufficient);
-        break;
-    case Z_BUF_ERROR:
-    case Z_NEED_DICT:
-    case Z_DATA_ERROR:
-        rc = RC(rcVDB, rcFunction, rcExecuting, rcData, rcCorrupt);
-        break;
-    case Z_MEM_ERROR:
-        rc = RC(rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted);
-        break;
-    default:
-        rc = RC(rcVDB, rcFunction, rcExecuting, rcNoObj, rcUnexpected);
-        break;
-    }
-    zr = inflateEnd(&s);
-    switch (zr) {
-    case Z_OK:
-        return rc;
-    default:
-        if (rc == 0)
-            {
-            return RC(rcVDB, rcFunction, rcExecuting, rcData, rcCorrupt);
-            }
-        return rc;
-    }
-    return 0;
-}
-
-static
-void decode_types(uint8_t dst[], unsigned n, const uint8_t src[])
-{
-    unsigned i, j, k = 0;
-    
-    for (i = 0, j = 1; i != n; ++i)
-    {
-        if (j == 1)
-            k = src[i / 8];
-
-        dst[i] = (k & j) == 0 ? 0 : 1;
-
-        j <<= 1;
-        if (j == 0x100)
-            j = 1;
-    }
-}
-
-#define DESERIAL16(X) do { if (i + 2 > n) return RC(rcXF, rcFunction, rcExecuting, rcData, rcInsufficient); memcpy(&y->u.izipped.X, &src[i], 2); i += 2; if (swap) y->u.izipped.X = bswap_16(y->u.izipped.X); } while (0)
-#define DESERIAL32(X) do { if (i + 4 > n) return RC(rcXF, rcFunction, rcExecuting, rcData, rcInsufficient); memcpy(&y->u.izipped.X, &src[i], 4); i += 4; if (swap) y->u.izipped.X = bswap_32(y->u.izipped.X); } while (0)
-#define DESERIAL64(X) do { if (i + 8 > n) return RC(rcXF, rcFunction, rcExecuting, rcData, rcInsufficient); memcpy(&y->u.izipped.X, &src[i], 8); i += 8; if (swap) y->u.izipped.X = bswap_64(y->u.izipped.X); } while (0)
-
-static rc_t deserialize_encoded(struct encoded *y, const uint8_t src[], unsigned n, int swap) {
-    unsigned i = 0;
-    
-    memset(y, 0, sizeof(*y));
-    
-    if (i + 1 > n)
-        return RC(rcXF, rcFunction, rcExecuting, rcData, rcInsufficient);
-    y->flags = src[i]; ++i;
-    
-    if (i + 4 > n)
-        return RC(rcXF, rcFunction, rcExecuting, rcData, rcInsufficient);
-    memcpy(&y->data_count, &src[i], 4); i += 4;
-    if (swap)
-        y->data_count = bswap_32(y->data_count);
-    
-    switch (y->flags & 0x03) {
-    case 2:
-    case 3:
-        if (i + 8 > n)
-            return RC(rcXF, rcFunction, rcExecuting, rcData, rcInsufficient);
-        memcpy(&y->u.packed.min, &src[i], 8); i += 8;
-        if (swap)
-            y->u.packed.min = bswap_64(y->u.packed.min);
-    case 1:
-        y->u.zipped.data_size = n - i;
-        y->u.zipped.data = &src[i];
-        return 0;
-    default:
-        break;
-    }
-    
-    DESERIAL32(data_flags);
-    DESERIAL32(segments);
-    DESERIAL32(outliers);
-    
-    DESERIAL32(type_size);
-    DESERIAL32(diff_size);
-    DESERIAL32(length_size);
-    DESERIAL32(dy_size);
-    DESERIAL32(dx_size);
-    DESERIAL32(a_size);
-    DESERIAL32(outlier_size);
-    
-    DESERIAL64(min_diff);
-    DESERIAL64(min_length);
-    DESERIAL64(min_dy);
-    DESERIAL64(min_dx);
-    DESERIAL64(min_a);
-    DESERIAL64(min_outlier);
-    
-    if (FLAG_TYPE(y->u.izipped) != DATA_ABSENT && FLAG_TYPE(y->u.izipped) != DATA_CONSTANT) {
-        if (i + y->u.izipped.type_size > n)
-            return RC(rcXF, rcFunction, rcExecuting, rcData, rcInsufficient);
-        y->u.izipped.type = &src[i]; i += y->u.izipped.type_size;
-    }
-    
-    if (FLAG_DIFF(y->u.izipped) != DATA_ABSENT && FLAG_DIFF(y->u.izipped) != DATA_CONSTANT) {
-        if (i + y->u.izipped.diff_size > n)
-            return RC(rcXF, rcFunction, rcExecuting, rcData, rcInsufficient);
-        y->u.izipped.diff = &src[i]; i += y->u.izipped.diff_size;
-    }
-    
-    if (FLAG_LENGTH(y->u.izipped) != DATA_ABSENT && FLAG_LENGTH(y->u.izipped) != DATA_CONSTANT) {
-        if (i + y->u.izipped.length_size > n)
-            return RC(rcXF, rcFunction, rcExecuting, rcData, rcInsufficient);
-        y->u.izipped.length = &src[i]; i += y->u.izipped.length_size;
-    }
-    
-    if (FLAG_DY(y->u.izipped) != DATA_ABSENT && FLAG_DY(y->u.izipped) != DATA_CONSTANT) {
-        if (i + y->u.izipped.dy_size > n)
-            return RC(rcXF, rcFunction, rcExecuting, rcData, rcInsufficient);
-        y->u.izipped.dy = &src[i]; i += y->u.izipped.dy_size;
-    }
-    
-    if (FLAG_DX(y->u.izipped) != DATA_ABSENT && FLAG_DX(y->u.izipped) != DATA_CONSTANT) {
-        if (i + y->u.izipped.dx_size > n)
-            return RC(rcXF, rcFunction, rcExecuting, rcData, rcInsufficient);
-        y->u.izipped.dx = &src[i]; i += y->u.izipped.dx_size;
-    }
-    
-    if (FLAG_A(y->u.izipped) != DATA_ABSENT && FLAG_A(y->u.izipped) != DATA_CONSTANT) {
-        if (i + y->u.izipped.a_size > n)
-            return RC(rcXF, rcFunction, rcExecuting, rcData, rcInsufficient);
-        y->u.izipped.a = &src[i]; i += y->u.izipped.a_size;
-    }
-    
-    if (FLAG_OUTLIER(y->u.izipped) != DATA_ABSENT && FLAG_OUTLIER(y->u.izipped) != DATA_CONSTANT) {
-        if (i + y->u.izipped.outlier_size > n)
-            return RC(rcXF, rcFunction, rcExecuting, rcData, rcInsufficient);
-        y->u.izipped.outlier = &src[i];
-        /* i += y->u.izipped.outlier_size; */
-    }
-    
-    return 0;
-}
-
-#define BITS_TO_VARIANT(X, BITS) do { switch(BITS) { case 8: (X)->var = 4; break; case 16: (X)->var = 3; break; case 32: (X)->var = 2; break; case 64: (X)->var = 1; break; default: return RC(rcXF, rcFunction, rcExecuting, rcData, rcInvalid); } } while (0);
-
-static rc_t decode_encoded(struct decoded *y, const struct encoded *x) {
-    unsigned i;
-    unsigned type = x->flags & 0x3;
-    rc_t rc;
-    const uint8_t *src;
-    uint8_t *hsrc;
-    unsigned elem_bits;
-    unsigned n = 0;
-    
-    memset(y, 0, sizeof(*y));
-    y->data_count = x->data_count;
-    y->size_type = (x->flags >> 2) & 3;
-    
-    y->diff = alloc_raw_nbuf(y->data_count);
-    if (y->diff == NULL)
-        return RC(rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted);
-    
-    if (type) {
-        if ((type & 1) != 0)  {
-            rc = zlib_decompress(y->diff->data.u8, 8 * y->data_count, &n, x->u.zipped.data, x->u.zipped.data_size );
-            if (rc)
-                return rc;
-            if ((type & 2) != 0)
-                y->diff->min = x->u.packed.min;
-        }
-        else {
-            y->diff->min = x->u.packed.min;
-            memcpy(y->diff->data.u8, x->u.packed.data, n = x->u.packed.data_size);
-        }
-        elem_bits = n * 8 / x->data_count;
-        if (elem_bits * x->data_count / 8 != n)
-            return RC(rcXF, rcFunction, rcExecuting, rcData, rcInvalid);
-        BITS_TO_VARIANT(y->diff, elem_bits);
-        if (type == 1 && 4 - y->diff->var != y->size_type) {
-#if _DEBUGGING
-            fprintf(stderr, "decode_encoded: var = %i, size_type = %u\n", (int)y->diff->var, (unsigned)y->size_type);
-#endif
-            return RC(rcXF, rcFunction, rcExecuting, rcRange, rcExcessive);
-        }
-        y->diff->used = x->data_count;
-        return 0;
-    }
-    
-    y->type = malloc(x->u.izipped.segments);
-    if (y->type == NULL)
-        return RC(rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted);
-    
-    if (x->u.izipped.outliers) {
-        hsrc = NULL;
-        
-        if (FLAG_TYPE(x->u.izipped) == DATA_ZIPPED) {
-            hsrc = malloc(x->u.izipped.segments);
-            if (hsrc == NULL)
-                return RC(rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted);
-            rc = zlib_decompress(hsrc, x->u.izipped.segments, &i, x->u.izipped.type, x->u.izipped.type_size);
-            if (rc) {
-                free(hsrc);
-                return rc;
-            }
-            src = hsrc;
-        }
-        else
-            src = x->u.izipped.type;
-        decode_types(y->type, x->u.izipped.segments, src);
-        if (hsrc) free(hsrc);
-        for (n = i = 0; i != x->u.izipped.segments; ++i) {
-            if (y->type[i])
-                ++n;
-        }
-        y->lines = x->u.izipped.segments - n;
-        y->outliers = n;
-    }
-    else {
-        memset(y->type, 0, x->u.izipped.segments);
-        y->lines = x->u.izipped.segments;
-        y->outliers = 0;
-    }
-    
-    y->diff->min = x->u.izipped.min_diff;
-    if (FLAG_DIFF(x->u.izipped) == DATA_CONSTANT) {
-        y->diff->used = x->u.izipped.diff_size;
-        memset(y->diff->data.raw, 0, nbuf_size(y->diff));
-    }
-    else {
-        if (FLAG_DIFF(x->u.izipped) == DATA_ZIPPED) {
-            rc = zlib_decompress(y->diff->data.u8, y->diff->size * 8, &n, x->u.izipped.diff, x->u.izipped.diff_size);
-            if (rc)
-                return rc;
-        }
-        else {
-            n = x->u.izipped.diff_size;
-            memcpy(y->diff->data.u8, x->u.izipped.diff, n);
-        }
-
-        if ( y->diff->size != 0 )
-            elem_bits = (n * 8) / y->diff->size;
-        else
-            return RC(rcXF, rcFunction, rcExecuting, rcData, rcInvalid);
-
-        if (elem_bits * y->diff->size / 8 != n)
-            return RC(rcXF, rcFunction, rcExecuting, rcData, rcInvalid);
-        BITS_TO_VARIANT(y->diff, elem_bits);
-        y->diff->used = n >> (4 - y->diff->var);
-    }
-    
-    y->length = alloc_nbuf(y->lines + y->outliers, 2);
-    if (y->length == NULL)
-        return RC(rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted);
-    
-    y->length->min = x->u.izipped.min_length;
-    if (FLAG_LENGTH(x->u.izipped) == DATA_CONSTANT) {
-        y->length->used = y->lines + y->outliers;
-        memset(y->length->data.raw, 0, nbuf_size(y->length));
-    }
-    else {
-        if (FLAG_LENGTH(x->u.izipped) == DATA_ZIPPED) {
-            rc = zlib_decompress(y->length->data.u8, y->length->size * 4, &n, x->u.izipped.length, x->u.izipped.length_size);
-            if (rc)
-                return rc;
-        }
-        else {
-            n = x->u.izipped.length_size;
-            memcpy(y->length->data.u8, x->u.izipped.length, n);
-        }
-        elem_bits = (n * 8) / (y->lines + y->outliers);
-        if (elem_bits * (y->lines + y->outliers) / 8 != n)
-            return RC(rcXF, rcFunction, rcExecuting, rcData, rcInvalid);
-        BITS_TO_VARIANT(y->length, elem_bits);
-        y->length->used = n >> (4 - y->length->var);
-    }
-    
-    y->dy = alloc_nbuf(y->lines, 1);
-    if (y->dy == NULL)
-        return RC(rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted);
-    
-    y->dy->min = x->u.izipped.min_dy;
-    if (FLAG_DY(x->u.izipped) == DATA_CONSTANT) {
-        y->dy->used = y->lines;
-        memset(y->dy->data.raw, 0, nbuf_size(y->dy));
-    }
-    else {
-        if (FLAG_DY(x->u.izipped) == DATA_ZIPPED) {
-            rc = zlib_decompress(y->dy->data.u8, y->dy->size * 8, &n, x->u.izipped.dy, x->u.izipped.dy_size);
-            if (rc)
-                return rc;
-        }
-        else {
-            n = x->u.izipped.dy_size;
-            memcpy(y->dy->data.u8, x->u.izipped.dy, n);
-        }
-        elem_bits = (n * 8) / y->lines;
-        if (elem_bits * y->lines / 8 != n)
-            return RC(rcXF, rcFunction, rcExecuting, rcData, rcInvalid);
-        BITS_TO_VARIANT(y->dy, elem_bits);
-        y->dy->used = n >> (4 - y->dy->var);
-    }
-    
-    y->dx = alloc_nbuf(y->lines, 1);
-    if (y->dx == NULL)
-        return RC(rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted);
-    
-    y->dx->min = x->u.izipped.min_dx;
-    if (FLAG_DX(x->u.izipped) == DATA_CONSTANT) {
-        y->dx->used = y->lines;
-        memset(y->dx->data.raw, 0, nbuf_size(y->dx));
-    }
-    else {
-        if (FLAG_DX(x->u.izipped) == DATA_ZIPPED) {
-            rc = zlib_decompress(y->dx->data.u8, y->dx->size * 8, &n, x->u.izipped.dx, x->u.izipped.dx_size);
-            if (rc)
-                return rc;
-        }
-        else {
-            n = x->u.izipped.dx_size;
-            memcpy(y->dx->data.u8, x->u.izipped.dx, n);
-        }
-        elem_bits = (n * 8) / y->lines;
-        if (elem_bits * y->lines / 8 != n)
-            return RC(rcXF, rcFunction, rcExecuting, rcData, rcInvalid);
-        BITS_TO_VARIANT(y->dx, elem_bits);
-        y->dx->used = n >> (4 - y->dx->var);
-    }
-    
-    y->a = alloc_nbuf(y->lines, 1);
-    if (y->a == NULL)
-        return RC(rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted);
-    
-    y->a->min = x->u.izipped.min_a;
-    if (FLAG_A(x->u.izipped) == DATA_CONSTANT) {
-        y->a->used = y->lines;
-        memset(y->a->data.raw, 0, nbuf_size(y->a));
-    }
-    else {
-        if (FLAG_A(x->u.izipped) == DATA_ZIPPED) {
-            rc = zlib_decompress(y->a->data.u8, y->a->size * 8, &n, x->u.izipped.a, x->u.izipped.a_size);
-            if (rc)
-                return rc;
-        }
-        else {
-            n = x->u.izipped.a_size;
-            memcpy(y->a->data.u8, x->u.izipped.a, n);
-        }
-        elem_bits = (n * 8) / y->lines;
-        if (elem_bits * y->lines / 8 != n)
-            return RC(rcXF, rcFunction, rcExecuting, rcData, rcInvalid);
-        BITS_TO_VARIANT(y->a, elem_bits);
-        y->a->used = n >> (4 - y->a->var);
-    }
-    
-    if (y->outliers) {
-        y->outlier = alloc_nbuf(x->u.izipped.outliers, 1);
-        if (y->outlier == NULL)
-            return RC(rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted);
-        
-        y->outlier->min = x->u.izipped.min_outlier;
-        if (FLAG_OUTLIER(x->u.izipped) == DATA_CONSTANT) {
-            y->outlier->used = y->outliers;
-            memset(y->outlier->data.raw, 0, nbuf_size(y->outlier));
-        }
-        else {
-            if (FLAG_OUTLIER(x->u.izipped) == DATA_ZIPPED) {
-                rc = zlib_decompress(y->outlier->data.u8, y->outlier->size * 8, &n, x->u.izipped.outlier, x->u.izipped.outlier_size);
-                if (rc)
-                    return rc;
-            }
-            else {
-                n = x->u.izipped.outlier_size;
-                memcpy(y->outlier->data.u8, x->u.izipped.outlier, n);
-            }
-            elem_bits = (n * 8) / x->u.izipped.outliers;
-            if (elem_bits * x->u.izipped.outliers / 8 != n)
-                return RC(rcXF, rcFunction, rcExecuting, rcData, rcInvalid);
-            BITS_TO_VARIANT(y->outlier, elem_bits);
-            y->outlier->used = n >> (4 - y->outlier->var);
-        }
-    }
-    
-    return 0;
-}
-
-#define STYPE uint8_t
-#define DECODE decode_u8
-#include "izip-decode.impl.h"
-#undef STYPE
-#undef DECODE
-
-#define STYPE int8_t
-#define DECODE decode_i8
-#include "izip-decode.impl.h"
-#undef STYPE
-#undef DECODE
-
-#define STYPE uint16_t
-#define DECODE decode_u16
-#include "izip-decode.impl.h"
-#undef STYPE
-#undef DECODE
-
-#define STYPE int16_t
-#define DECODE decode_i16
-#include "izip-decode.impl.h"
-#undef STYPE
-#undef DECODE
-
-#define STYPE uint32_t
-#define DECODE decode_u32
-#include "izip-decode.impl.h"
-#undef STYPE
-#undef DECODE
-
-#define STYPE int32_t
-#define DECODE decode_i32
-#include "izip-decode.impl.h"
-#undef STYPE
-#undef DECODE
-
-#define STYPE uint64_t
-#define DECODE decode_u64
-#include "izip-decode.impl.h"
-#undef STYPE
-#undef DECODE
-
-#define STYPE int64_t
-#define DECODE decode_i64
-#include "izip-decode.impl.h"
-#undef STYPE
-#undef DECODE
-
-typedef rc_t (*decode_f)(void *dst, unsigned dsize, const uint8_t src[], unsigned N, int swap);
-
-static
-decode_f selfs[8] = {
-    (decode_f)decode_u8,
-    (decode_f)decode_i8,
-    (decode_f)decode_u16,
-    (decode_f)decode_i16,
-    (decode_f)decode_u32,
-    (decode_f)decode_i32,
-    (decode_f)decode_u64,
-    (decode_f)decode_i64,
-};
-
-#if 0
-rc_t ex_decode8( void *dst, unsigned dsize, uint8_t *src, unsigned ssize )
-{
-    return selfs[0].f( dst, dsize, src, ssize, 0 );
-}
-
-rc_t ex_decode16( void *dst, unsigned dsize, uint8_t *src, unsigned ssize )
-{
-    return selfs[2].f( dst, dsize, src, ssize, 0 );
-}
-
-rc_t ex_decode32( void *dst, unsigned dsize, uint8_t *src, unsigned ssize )
-{
-    return selfs[4].f( dst, dsize, src, ssize, 0 );
-}
-
-rc_t ex_decode64( void *dst, unsigned dsize, uint8_t *src, unsigned ssize )
-{
-    return selfs[6].f( dst, dsize, src, ssize, 0 );
-}
-#endif
-
-rc_t CC iunzip_func_v0(
-                    void *Self,
-                    const VXformInfo *info,
-                    VBlobResult *dst,
-                    const VBlobData *src
-) {
-    uint32_t ssize;
-    
-    assert(dst->elem_count >> 32 == 0);
-    assert(((src->elem_count * src->elem_bits + 7) >> 3) >> 32 == 0);
-    ssize = (uint32_t)((src->elem_count * src->elem_bits + 7) >> 3);
-    
-    dst->byte_order = vboNative;
-    switch (src->byte_order) {
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-    case vboBigEndian:
-#else
-    case vboBigEndian:
-#endif
-        return selfs[(uintptr_t)Self](dst->data, (uint32_t)dst->elem_count,
-                       src->data, ssize,
-                       1);
-    default:
-        return selfs[(uintptr_t)Self](dst->data, (uint32_t)dst->elem_count,
-                       src->data, ssize,
-                       0);
-    }
-}
-
-#if 0
-
-static
-rc_t CC iunzip(
-            void *Self,
-            const VXformInfo *info,
-            VBlobResult *dst,
-            const VBlobData *src,
-            VBlobHeader *hdr
-) {
-    switch (VBlobHeaderVersion(hdr)) {
-    case 0:
-        return iunzip_func_v0(Self, info, dst, src);
-    default:
-        return RC(rcVDB, rcFunction, rcExecuting, rcParam, rcBadVersion);
-    }
-}
-
-/* 
- function izip_set iunzip #1.0 ( izip_fmt in )
- */
-VTRANSFACT_IMPL(vdb_iunzip, 1, 0, 0) (const void *Self, const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->variant = vftBlob;
-    rslt->u.bf = iunzip;
-    
-    switch (info->fdesc.desc.domain) {
-    case vtdInt:
-        switch (info->fdesc.desc.intrinsic_bits) {
-        case 8:
-            rslt->self = (void *)1;
-            break;
-        case 16:
-            rslt->self = (void *)3;
-            break;
-        case 32:
-            rslt->self = (void *)5;
-            break;
-        case 64:
-            rslt->self = (void *)7;
-            break;
-        default:
-#if _DEBUGGING
-            fprintf(stderr, "intrinsic_bits = %u != (8|16|32|64)\n", info->fdesc.desc.intrinsic_bits);
-#endif
-            return RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-            break;
-        }
-        break;
-    case vtdUint:
-        switch (info->fdesc.desc.intrinsic_bits) {
-        case 8:
-            rslt->self = (void *)0;
-            break;
-        case 16:
-            rslt->self = (void *)2;
-            break;
-        case 32:
-            rslt->self = (void *)4;
-            break;
-        case 64:
-            rslt->self = (void *)6;
-            break;
-        default:
-#if _DEBUGGING
-            fprintf(stderr, "intrinsic_bits = %u != (8|16|32|64)\n", info->fdesc.desc.intrinsic_bits);
-#endif
-            return RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-            break;
-        }
-        break;
-    default:
-#if _DEBUGGING
-        fprintf(stderr, "domain != vtdInt or vtdUint\n");
-#endif
-        return RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-    }
-    return 0;
-}
-#endif
-
-#if TESTING
-int test_decode(int32_t *dst, unsigned dsize, const uint8_t *src, unsigned ssize, int swap) {
-    return decode_i32(dst, dsize, src, ssize, 0);
-}
-#endif
diff --git a/libs/vxf/izip-common.h b/libs/vxf/izip-common.h
deleted file mode 100644
index c6dc84c..0000000
--- a/libs/vxf/izip-common.h
+++ /dev/null
@@ -1,195 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-typedef struct {
-    unsigned size;
-    unsigned used;
-    int64_t min;
-    int64_t max;
-    unsigned var;
-    union {
-        int64_t  raw[1];
-        uint64_t u64[1];
-        uint32_t u32[2];
-        uint16_t u16[4];
-        uint8_t  u8[8];
-    } data;
-} nbuf;
-
-#define nbuf_get(X, I) (((const nbuf *)X)->var == 4 ? ((const nbuf *)X)->data.u8[(I)] : (((const nbuf *)X)->var == 3 ? ((const nbuf *)X)->data.u16[(I)] : (((const nbuf *)X)->var == 2 ? ((const nbuf *)X)->data.u32[(I)] : ((const nbuf *)X)->data.u64[(I)])))
-
-static unsigned nbuf_size(const nbuf *x) {
-    size_t y;
-    
-    switch (x->var) {
-    default:
-        y = sizeof(x->data.raw[0]) * x->used;
-        break;
-    case 1:
-        y = sizeof(x->data.u64[0]) * x->used;
-        break;
-    case 2:
-        y = sizeof(x->data.u32[0]) * x->used;
-        break;
-    case 3:
-        y = sizeof(x->data.u16[0]) * x->used;
-        break;
-    case 4:
-        y = sizeof(x->data.u8[0]) * x->used;
-        break;
-    }
-    assert(y <= UINT32_MAX);
-    return (unsigned)y;
-}
-
-static nbuf *alloc_nbuf(unsigned cnt, unsigned var) {
-    nbuf *rslt;
-    
-    rslt = malloc(sizeof(*rslt) - sizeof(rslt->data) + cnt * sizeof(rslt->data.raw[0]));
-    if ( rslt != NULL ) {
-        memset(rslt, 0, sizeof(*rslt) - sizeof(rslt->data));
-        rslt->size = cnt;
-        rslt->used = 0;
-        rslt->var = var;
-    }
-    return rslt;
-}
-
-static nbuf *alloc_raw_nbuf(unsigned cnt) {
-    return alloc_nbuf(cnt, 0);
-}
-
-struct decoded {
-    unsigned data_count;
-    unsigned lines;
-    unsigned outliers;
-    unsigned size_type;
-    
-    nbuf *diff;      /* diff[data_count] */
-    uint8_t *type;   /* type[lines + outliers] */
-    nbuf *length;    /* length[lines + outliers]  */
-    nbuf *dy;        /* dy[lines] */
-    nbuf *dx;        /* dx[lines] */
-    nbuf *a;         /* a[lines] */
-    nbuf *outlier;   /* outlier[outliers] */
-};
-
-#define DATA_CONSTANT (1)
-#define DATA_ZIPPED (2)
-#define DATA_ABSENT (3)
-
-#define FLAG_BITS (4)
-#define FLAG_MASK ((1 << FLAG_BITS) - 1)
-
-#define FLAG_BITS_TYPE      (0)
-#define FLAG_BITS_DIFF      (FLAG_BITS + FLAG_BITS_TYPE)
-#define FLAG_BITS_LENGTH    (FLAG_BITS + FLAG_BITS_DIFF)
-#define FLAG_BITS_DY        (FLAG_BITS + FLAG_BITS_LENGTH)
-#define FLAG_BITS_DX        (FLAG_BITS + FLAG_BITS_DY)
-#define FLAG_BITS_A         (FLAG_BITS + FLAG_BITS_DX)
-#define FLAG_BITS_OUTLIER   (FLAG_BITS + FLAG_BITS_A)
-
-#define SET_TYPE_ABSENT(FLAGS)      ((FLAGS).data_flags) |= (DATA_ABSENT << FLAG_BITS_TYPE)
-#define SET_DIFF_ABSENT(FLAGS)      ((FLAGS).data_flags) |= (DATA_ABSENT << FLAG_BITS_DIFF)
-#define SET_LENGTH_ABSENT(FLAGS)    ((FLAGS).data_flags) |= (DATA_ABSENT << FLAG_BITS_LENGTH)
-#define SET_DY_ABSENT(FLAGS)        ((FLAGS).data_flags) |= (DATA_ABSENT << FLAG_BITS_DY)
-#define SET_DX_ABSENT(FLAGS)        ((FLAGS).data_flags) |= (DATA_ABSENT << FLAG_BITS_DX)
-#define SET_A_ABSENT(FLAGS)         ((FLAGS).data_flags) |= (DATA_ABSENT << FLAG_BITS_A)
-#define SET_OUTLIER_ABSENT(FLAGS)   ((FLAGS).data_flags) |= (DATA_ABSENT << FLAG_BITS_OUTLIER)
-
-#define SET_TYPE_CONSTANT(FLAGS)    ((FLAGS).data_flags) |= (DATA_CONSTANT << FLAG_BITS_TYPE)
-#define SET_DIFF_CONSTANT(FLAGS)    ((FLAGS).data_flags) |= (DATA_CONSTANT << FLAG_BITS_DIFF)
-#define SET_LENGTH_CONSTANT(FLAGS)  ((FLAGS).data_flags) |= (DATA_CONSTANT << FLAG_BITS_LENGTH)
-#define SET_DY_CONSTANT(FLAGS)      ((FLAGS).data_flags) |= (DATA_CONSTANT << FLAG_BITS_DY)
-#define SET_DX_CONSTANT(FLAGS)      ((FLAGS).data_flags) |= (DATA_CONSTANT << FLAG_BITS_DX)
-#define SET_A_CONSTANT(FLAGS)       ((FLAGS).data_flags) |= (DATA_CONSTANT << FLAG_BITS_A)
-#define SET_OUTLIER_CONSTANT(FLAGS) ((FLAGS).data_flags) |= (DATA_CONSTANT << FLAG_BITS_OUTLIER)
-
-#define SET_TYPE_ZIPPED(FLAGS)      ((FLAGS).data_flags) |= (DATA_ZIPPED << FLAG_BITS_TYPE)
-#define SET_DIFF_ZIPPED(FLAGS)      ((FLAGS).data_flags) |= (DATA_ZIPPED << FLAG_BITS_DIFF)
-#define SET_LENGTH_ZIPPED(FLAGS)    ((FLAGS).data_flags) |= (DATA_ZIPPED << FLAG_BITS_LENGTH)
-#define SET_DY_ZIPPED(FLAGS)        ((FLAGS).data_flags) |= (DATA_ZIPPED << FLAG_BITS_DY)
-#define SET_DX_ZIPPED(FLAGS)        ((FLAGS).data_flags) |= (DATA_ZIPPED << FLAG_BITS_DX)
-#define SET_A_ZIPPED(FLAGS)         ((FLAGS).data_flags) |= (DATA_ZIPPED << FLAG_BITS_A)
-#define SET_OUTLIER_ZIPPED(FLAGS)   ((FLAGS).data_flags) |= (DATA_ZIPPED << FLAG_BITS_OUTLIER)
-
-#define FLAG_TYPE(O)                ((((O).data_flags) >> FLAG_BITS_TYPE   ) & FLAG_MASK)
-#define FLAG_DIFF(O)                ((((O).data_flags) >> FLAG_BITS_DIFF   ) & FLAG_MASK)
-#define FLAG_LENGTH(O)              ((((O).data_flags) >> FLAG_BITS_LENGTH ) & FLAG_MASK)
-#define FLAG_DY(O)                  ((((O).data_flags) >> FLAG_BITS_DY     ) & FLAG_MASK)
-#define FLAG_DX(O)                  ((((O).data_flags) >> FLAG_BITS_DX     ) & FLAG_MASK)
-#define FLAG_A(O)                   ((((O).data_flags) >> FLAG_BITS_A      ) & FLAG_MASK)
-#define FLAG_OUTLIER(O)             ((((O).data_flags) >> FLAG_BITS_OUTLIER) & FLAG_MASK)
-
-struct encoded {
-    uint8_t flags;   /* 0x1: zipped, 0x2: packed, 0x3: packed+zipped, 0x0: izipped */
-    uint32_t data_count;
-    union {
-        struct {
-            uint32_t data_size;
-            const uint8_t *data;
-        } zipped;
-        struct {
-            uint32_t data_size;
-            const uint8_t *data;
-            int64_t min;
-        } packed;
-        struct {
-            uint32_t data_flags;
-            uint32_t segments;
-            uint32_t outliers;
-            uint32_t type_size;
-            uint32_t diff_size;
-            uint32_t length_size;
-            uint32_t dy_size;
-            uint32_t dx_size;
-            uint32_t a_size;
-            uint32_t outlier_size;
-            
-            int64_t min_diff;
-            int64_t min_length;
-            int64_t min_dy;
-            int64_t min_dx;
-            int64_t min_a;
-            int64_t min_outlier;
-            
-            const uint8_t *type;
-            const uint8_t *diff;
-            const uint8_t *length;
-            const uint8_t *dy;
-            const uint8_t *dx;
-            const uint8_t *a;
-            const uint8_t *outlier;
-        } izipped;
-    } u;
-};
-
-#if 1
-#define DEBUG_PRINT(fmt, ...) { do { } while(0); }
-#else
-#define DEBUG_PRINT(fmt, ...) fprintf(stderr, "%s - " fmt "\n", __func__, __VA_ARGS__)
-#endif
-
diff --git a/libs/vxf/izip-decode.impl.h b/libs/vxf/izip-decode.impl.h
deleted file mode 100644
index d6f88f8..0000000
--- a/libs/vxf/izip-decode.impl.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-static
-rc_t DECODE(STYPE Y[], unsigned N, const uint8_t src[], unsigned ssize, int swap) {
-    rc_t rc;
-    struct encoded encoded;
-    struct decoded decoded;
-    unsigned i;
-    unsigned j;
-    unsigned k;
-    unsigned u;
-    unsigned v;
-    
-    rc = deserialize_encoded(&encoded, src, ssize, swap);
-    if (rc)
-        return rc;
-    rc = decode_encoded(&decoded, &encoded);
-    if (rc == 0) {
-        if (decoded.diff->used != N)
-            return RC(rcXF, rcFunction, rcExecuting, rcData, rcInvalid);
-        
-        if ((encoded.flags & 3) == 0) {
-            if (N == 121)
-                DEBUG_PRINT("decompressing izip", 0);
-            if (swap) {
-                unpack_nbuf_swap(decoded.diff);
-                unpack_nbuf_swap(decoded.length);
-                unpack_nbuf_swap(decoded.dy);
-                unpack_nbuf_swap(decoded.dx);
-                unpack_nbuf_swap(decoded.a);
-                if (decoded.outlier)
-                    unpack_nbuf_swap(decoded.outlier);
-            }
-            else {
-                unpack_nbuf(decoded.diff);
-                unpack_nbuf(decoded.length);
-                unpack_nbuf(decoded.dy);
-                unpack_nbuf(decoded.dx);
-                unpack_nbuf(decoded.a);
-                if (decoded.outlier)
-                    unpack_nbuf(decoded.outlier);
-            }
-
-            if (N == 121) {
-                for (i = 0; i != decoded.diff->used; ++i) {
-                    DEBUG_PRINT("  %i - diff: %lli", i, decoded.diff->data.raw[i]);
-                }
-            }
-            
-            for (u = v = k = i = 0; i != decoded.lines + decoded.outliers; ++i) {
-                unsigned n = (unsigned)decoded.length->data.raw[i];
-                
-                if (decoded.type[i]) {
-                    if (N == 121)
-                        DEBUG_PRINT("extracting stored segment %u; length: %u", i, n);
-                    for (j = 0; j != n; ++j, ++k, ++v)
-                        Y[k] = (STYPE)( decoded.outlier->data.raw[v] );
-                }
-                else {
-                    const double m = decoded.dy->data.raw[u] / (double)decoded.dx->data.raw[u];
-                    
-                    if (N == 121)
-                        DEBUG_PRINT("extracting line segment %u; length: %u; dy: %lli; dx: %lli; a: %lli", i, n, decoded.dy->data.raw[u], decoded.dx->data.raw[u], decoded.a->data.raw[u]);
-                    for (j = 0; j != n; ++j, ++k) {
-                        Y[k] = (STYPE)( decoded.diff->data.raw[k] + (STYPE)(decoded.a->data.raw[u] + j * m) );
-                        if (N == 121)
-                            DEBUG_PRINT("    %u: %i", k, (int)Y[k]);
-                    }
-                    ++u;
-                }
-            }
-        }
-        else if ((encoded.flags & 2) != 0) {
-            if ((((size_t)1) << decoded.size_type) > sizeof(Y[0])) {
-#if _DEBUGGING
-                fprintf(stderr, "iunzip: refusing to decode from original element size of %u to %u\n", (unsigned)(((size_t)1) << decoded.size_type), (unsigned)sizeof(Y[0]));
-#endif
-                return RC(rcXF, rcFunction, rcExecuting, rcRange, rcExcessive);
-            }
-            switch (decoded.diff->var) {
-            case 4:
-                for (i = 0; i != decoded.diff->used; ++i)
-                    Y[i] = (int32_t)( decoded.diff->data.u8[i] + decoded.diff->min );
-                break;
-            case 3:
-                for (i = 0; i != decoded.diff->used; ++i)
-                    Y[i] = (int32_t)( decoded.diff->data.u16[i] + decoded.diff->min );
-                break;
-            case 2:
-                for (i = 0; i != decoded.diff->used; ++i)
-                    Y[i] = (int32_t)( decoded.diff->data.u32[i] + decoded.diff->min );
-                break;
-            case 1:
-            default:
-                for (i = 0; i != decoded.diff->used; ++i)
-                    Y[i] = (int32_t)( decoded.diff->data.u64[i] + decoded.diff->min );
-                break;
-            }
-        }
-        else {
-            if ((((size_t)1) << decoded.size_type) > sizeof(Y[0])) {
-#if _DEBUGGING
-                fprintf(stderr, "iunzip: refusing to decode from original element size of %u to %u\n", (unsigned)(((size_t)1) << decoded.size_type), (unsigned)sizeof(Y[0]));
-#endif
-                return RC(rcXF, rcFunction, rcExecuting, rcRange, rcExcessive);
-            }
-            
-            switch (decoded.diff->var) {
-            case 4:
-                for (i = 0; i != decoded.diff->used; ++i)
-                    Y[i] = (int32_t)decoded.diff->data.u8[i];
-                break;
-            case 3:
-                for (i = 0; i != decoded.diff->used; ++i)
-                    Y[i] = (int32_t)decoded.diff->data.u16[i];
-                break;
-            case 2:
-                for (i = 0; i != decoded.diff->used; ++i)
-                    Y[i] = (int32_t)decoded.diff->data.u32[i];
-                break;
-            case 1:
-            default:
-                for (i = 0; i != decoded.diff->used; ++i)
-                    Y[i] = (int32_t)decoded.diff->data.u64[i];
-                break;
-            }
-        }
-    }
-    if (decoded.diff)   free(decoded.diff);
-    if (decoded.type)   free(decoded.type);
-    if (decoded.length) free(decoded.length);
-    if (decoded.dy)     free(decoded.dy);
-    if (decoded.dx)     free(decoded.dx);
-    if (decoded.a)      free(decoded.a);
-    if (decoded.outlier) free(decoded.outlier);
-    
-    return rc;
-}
diff --git a/libs/vxf/izip-encode.impl.h b/libs/vxf/izip-encode.impl.h
deleted file mode 100644
index a6ddc15..0000000
--- a/libs/vxf/izip-encode.impl.h
+++ /dev/null
@@ -1,523 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-
-static int ANALYZE(stats_t stats[], const unsigned scnt, unsigned *fcnt, const STYPE Y[], const unsigned dcnt, STYPE *MIN, STYPE *MAX) {
-    stats_t **base;
-    unsigned i;
-    unsigned k;
-    unsigned n = (dcnt + scnt - 1) / scnt;
-    int loops;
-    unsigned split;
-    unsigned merged = 0;
-    STYPE min = Y[0];
-    STYPE max = Y[0];
-    
-    memset(stats, 0, sizeof(stats[0]));
-    
-    for (i = 0, k = 0; i != dcnt; ++i) {
-        if (min > Y[i])
-            min = Y[i];
-        if (max < Y[i])
-            max = Y[i];
-        
-        stats[k].sy  += (double_t)Y[i];
-        stats[k].syy += (double_t)Y[i] * Y[i];
-        stats[k].sxy += (double_t)Y[i] * i;
-        
-        stats[k].sx  += (double_t)i;
-        stats[k].sxx += (double_t)i * i;
-        
-        ++stats[k].n;
-        if (stats[k].n != n)
-            continue;
-        
-        stats[k].fit = fitness( stats + k );
-        ++k;
-        if (k == scnt)
-            break;
-        memset(stats + k, 0, sizeof(stats[0]));
-        stats[k].x = i + 1;
-    }
-    n = k;
-    if (k != scnt && stats[k].n) {
-        stats[k].fit = fitness( stats + k );
-        ++n;
-    }
-    
-    *MIN = min;
-    *MAX = max;
-    
-    if (n == 1) {
-        *fcnt = 1;
-        return 0;
-    }
-    for (k = 0, i = 1; i != n; ++i) {
-        stats_t temp;
-        
-        merge(&temp, &stats[k], &stats[i]);
-        if (temp.fit >= stats[k].fit) {
-            stats[k] = temp;
-        }
-        else {
-            stats[++k] = stats[i];
-        }
-    }
-    n = k + 1;
-    
-    if (n == 1) {
-        *fcnt = 1;
-        return 0;
-    }
-    
-    base = malloc(scnt * sizeof(base[0]));
-    if (base == NULL)
-        return 1;
-    
-    for (loops = dcnt; loops > 0; loops >>= 1) {
-        for (i = 0, k = 0; i != n; ++i) {
-            assert(stats[i].x == k);
-            k += stats[i].n;
-            base[i] = &stats[i];
-            stats[i].i = i;
-        }
-        assert( k == dcnt );
-        ksort( base, n, sizeof(base[0]), comp_fitness, NULL );
-        if (n < scnt) {
-            for (i = 0, split = 0; i != n && n + split != scnt; ++i) {
-                stats_t R;
-                stats_t L = *base[i];
-                unsigned u = L.n / 2;
-                unsigned j;
-                
-                if (u == 0)
-                    continue;
-                
-                memset(&R, 0, sizeof(R));
-                                
-                R.x = L.x + L.n - u;
-                R.n = u;
-                u = L.x + L.n;
-                for (j = R.x; j != u; ++j) {
-                    R.sx  += j;
-                    R.sxx += (double_t)j * j;
-                    R.sy  += Y[j];
-                    R.syy += (double_t)Y[j] * Y[j];
-                    R.sxy += (double_t)Y[j] * j;
-                }
-                L.sx  -= R.sx;
-                L.sxx -= R.sxx;
-                L.sy  -= R.sy;
-                L.syy -= R.syy;
-                L.sxy -= R.sxy;
-                assert(L.n > R.n);
-                L.n   -= R.n;
-                
-                L.fit = fitness( &L );
-                R.fit = fitness( &R );
-                
-                if (L.n == 1 || R.n == 1 || L.fit > base[i]->fit || R.fit > base[i]->fit) {
-                    assert(L.x + L.n == R.x);
-                    assert(L.n + R.n == stats[L.i].n);
-                    L.i = R.i = dcnt; /* invalid value */
-                    *base[i] = L;
-                    stats[n + split] = R;
-                    ++split;
-                }
-            }
-            if (split) {
-                n += split;
-                ksort( stats, n, sizeof(stats[0]), comp_position, NULL );
-                continue;
-            }
-        }
-        
-        merged = 0;
-        for (i = n; i; ) {
-            stats_t temp;
-            unsigned j;
-            
-            --i;
-            j = base[i]->i;
-            
-            if (j == n - 1 || stats[j].n == 0 || stats[j + 1].n == 0)
-                continue;
-            
-            merge(&temp, stats + j, stats + j + 1);
-            if (temp.n > 2 && temp.fit >= stats[j].fit) {
-                stats[j] = temp;
-                stats[j + 1].n = 0;
-                stats[j + 1].x = dcnt;
-                ++merged;
-            }
-        }
-        if (merged == 0)
-            break;
-        
-        for (k = 0, i = 1; i < n; ++i) {
-            if (stats[i].n)
-                stats[++k] = stats[i];
-        }
-        assert(k + 1 == n - merged);
-        n -= merged;
-    }
-    
-    *fcnt = n;
-    free(base);
-    return 0;
-}
-
-#ifndef ABS
-#define ABS(X) ((uint64_t)(X >= 0 ? (X) : (-(X))))
-#endif
-
-static
-rc_t ENCODE(uint8_t *dst, unsigned dsize, unsigned *psize, const STYPE Y[], unsigned N, int DUMP) {
-    stats_t *stats = 0;
-    unsigned m = (N + CHUNK_SIZE - 1) / CHUNK_SIZE;
-    unsigned n;
-    rc_t rc = 0;
-    unsigned i;
-    unsigned j;
-    unsigned k;
-    unsigned u;
-    unsigned v;
-    STYPE min = 0;
-    STYPE max = 0;
-    unsigned pack_size = 0;
-    szbuf zipped;
-    struct decoded decoded;
-    struct encoded encoded;
-    int debugging = 0;
-
-    if (psize)
-        *psize = 0;
-    memset(&decoded, 0, sizeof(decoded));
-
-    do {
-        stats = malloc(m * sizeof(stats[0]));
-        if (stats == NULL) {
-            rc = RC(rcVDB, rcFunction, rcExecuting, rcMemory, rcExhausted);
-            break;
-        }
-        rc = ANALYZE(stats, m, &n, Y, N, &min, &max);
-        if (rc) {
-            rc = RC(rcVDB, rcFunction, rcExecuting, rcMemory, rcExhausted);
-            break;
-        }
-        
-        if ((ABS(min) >> 8) == 0 && (ABS(max) >> 8) == 0) {
-            decoded.size_type = 0;
-            pack_size = N;
-        }
-        else if ((ABS(min) >> 16) == 0 && (ABS(max) >> 16) == 0) {
-            decoded.size_type = 1;
-            pack_size = N * 2;
-        }
-        else if ((ABS(min) >> 32) == 0 && (ABS(max) >> 32) == 0) {
-            decoded.size_type = 2;
-            pack_size = N * 4;
-        }
-        else {
-            decoded.size_type = 3;
-            pack_size = N * 8;
-        }
-        
-        decoded.diff = alloc_raw_nbuf(N);
-        if (decoded.diff == NULL) {
-            rc = RC(rcVDB, rcFunction, rcExecuting, rcMemory, rcExhausted);
-            break;
-        }
-        decoded.outlier = alloc_raw_nbuf(N);
-        if (decoded.outlier == NULL) {
-            rc = RC(rcVDB, rcFunction, rcExecuting, rcMemory, rcExhausted);
-            break;
-        }
-        decoded.type = malloc(n);
-        if (decoded.type == NULL) {
-            rc = RC(rcVDB, rcFunction, rcExecuting, rcMemory, rcExhausted);
-            break;
-        }
-        decoded.length = alloc_raw_nbuf(n);
-        if (decoded.length == NULL) {
-            rc = RC(rcVDB, rcFunction, rcExecuting, rcMemory, rcExhausted);
-            break;
-        }
-
-        for (v = u = k = i = 0; i != n; ++i) {
-            decoded.length->data.raw[i] = stats[i].n;
-            if (stats[i].n >= OUTLIER_LIMIT) {
-                double_t M;
-                int64_t dy;
-                int64_t dx;
-                int64_t a;
-                
-                ++v;
-                regress_params(stats + i, &dy, &dx, &a);
-                M = dy / (double_t)dx;
-                for (j = 0; j != stats[i].n; ++j, ++k) {
-                    decoded.diff->data.raw[k] = Y[k] - (STYPE)(M * j + a);
-                    if (decoded.diff->min > decoded.diff->data.raw[k] || k == 0)
-                        decoded.diff->min = decoded.diff->data.raw[k];
-                    if (decoded.diff->max < decoded.diff->data.raw[k] || k == 0)
-                        decoded.diff->max = decoded.diff->data.raw[k];
-                }
-                decoded.type[i] = 0;
-            }
-            else {
-                for (j = 0; j != stats[i].n; ++j, ++k, ++u) {
-                    decoded.diff->data.raw[k] = 0;
-                    if (decoded.diff->min > 0 || k == 0)
-                        decoded.diff->min = 0;
-                    if (decoded.diff->max < 0 || k == 0)
-                        decoded.diff->max = 0;
-                    decoded.outlier->data.raw[u] = Y[k];
-                    if (decoded.outlier->min > decoded.outlier->data.raw[u] || u == 0)
-                        decoded.outlier->min = decoded.outlier->data.raw[u];
-                    if (decoded.outlier->max < decoded.outlier->data.raw[u] || u == 0)
-                        decoded.outlier->max = decoded.outlier->data.raw[u];
-                }
-                ++decoded.outliers;
-                decoded.type[i] = 1;
-            }
-        }
-        decoded.length->used = n;
-        decoded.outlier->used = u;
-        decoded.diff->used = k;
-
-        decoded.dy = alloc_raw_nbuf(v);
-        if (decoded.dy == NULL) {
-            rc = RC(rcVDB, rcFunction, rcExecuting, rcMemory, rcExhausted);
-            break;
-        }
-        decoded.dx = alloc_raw_nbuf(v);
-        if (decoded.dx == NULL) {
-            rc = RC(rcVDB, rcFunction, rcExecuting, rcMemory, rcExhausted);
-            break;
-        }
-        decoded.a = alloc_raw_nbuf(v);
-        if (decoded.a == NULL) {
-            rc = RC(rcVDB, rcFunction, rcExecuting, rcMemory, rcExhausted);
-            break;
-        }
-        for (u = i = 0; i < n; ++i) {
-            if (decoded.type[i] == 0) {
-                regress_params(stats + i, decoded.dy->data.raw + u, decoded.dx->data.raw + u, decoded.a->data.raw + u);
-                if (u == 0) {
-                    decoded.dy->min = decoded.dy->data.raw[u];
-                    decoded.dy->max = decoded.dy->data.raw[u];
-                    decoded.dx->min = decoded.dx->data.raw[u];
-                    decoded.dx->max = decoded.dx->data.raw[u];
-                    decoded.a->min = decoded.a->data.raw[u];
-                    decoded.a->max = decoded.a->data.raw[u];
-                }
-                else {
-                    if (decoded.dy->min > decoded.dy->data.raw[u])
-                        decoded.dy->min = decoded.dy->data.raw[u];
-                    if (decoded.dy->max < decoded.dy->data.raw[u])
-                        decoded.dy->max = decoded.dy->data.raw[u];
-                    if (decoded.dx->min > decoded.dx->data.raw[u])
-                        decoded.dx->min = decoded.dx->data.raw[u];
-                    if (decoded.dx->max < decoded.dx->data.raw[u])
-                        decoded.dx->max = decoded.dx->data.raw[u];
-                    if (decoded.a->min > decoded.a->data.raw[u])
-                        decoded.a->min = decoded.a->data.raw[u];
-                    if (decoded.a->max < decoded.a->data.raw[u])
-                        decoded.a->max = decoded.a->data.raw[u];
-                }
-                ++u;            
-            }
-        }
-        decoded.data_count = N;
-        decoded.lines = decoded.dy->used = decoded.dx->used = decoded.a->used = u;
-        
-        free(stats); stats = NULL;
-        
-        for (u = k = 0, i = 1; i < n; ++i) {
-            if (decoded.type[i] == 1 && decoded.type[k] == 1) {
-                --decoded.length->used;
-                --decoded.outliers;
-                decoded.length->data.raw[k] += decoded.length->data.raw[i];
-            }
-            else {
-                ++k;
-                if (k != i) {
-                    decoded.type[k] = decoded.type[i];
-                    decoded.length->data.raw[k] = decoded.length->data.raw[i];
-                }
-            }
-        }
-        for (i = 0; i != decoded.length->used; ++i) {
-            if (decoded.length->min > decoded.length->data.raw[i] || i == 0)
-                decoded.length->min = decoded.length->data.raw[i];
-            if (decoded.length->max < decoded.length->data.raw[i] || i == 0)
-                decoded.length->max = decoded.length->data.raw[i];
-        }
-        if (DUMP) {
-            if (N == 121) {
-                DEBUG_PRINT("Y:", 0);
-                for (i = 0; i != N; ++i)
-                    DEBUG_PRINT("    %u: %i, diff: %lli", i, (int)Y[i], decoded.diff->data.raw[i]);
-
-                DEBUG_PRINT("%u elements, %u stored, %u lines", N, decoded.outliers, decoded.lines);
-                for (i = 0; i != decoded.lines; ++i) {
-                    DEBUG_PRINT("line %u: dy: %lli; dx: %lli; a: %lli", i, decoded.dy->data.raw[i], decoded.dx->data.raw[i], decoded.a->data.raw[i]);
-                }
-            }
-            if (decoded.diff)   free(decoded.diff);
-            if (decoded.type)   free(decoded.type);
-            if (decoded.length) free(decoded.length);
-            if (decoded.dy)     free(decoded.dy);
-            if (decoded.dx)     free(decoded.dx);
-            if (decoded.a)      free(decoded.a);
-            if (decoded.outlier) free(decoded.outlier);
-                            
-            if (stats)  free(stats);
-            return 0;
-        }
-        pack_nbuf(decoded.diff);
-        pack_nbuf(decoded.length);
-        pack_nbuf(decoded.dy);
-        pack_nbuf(decoded.dx);
-        pack_nbuf(decoded.a);
-        pack_nbuf(decoded.outlier);
-        
-        rc = encode_decoded(&encoded, &decoded);
-        if (rc == 0) {
-            unsigned act_size;
-            
-            rc = serialize_encoded(dst, dsize, &act_size, &encoded);
-            /* DEBUG_PRINT("izip compress to %u bytes", act_size); */
-            if (psize)
-                *psize = act_size;
-            free_encoded(&encoded);
-        }
-    } while (0);
-    
-    if (decoded.diff)   free(decoded.diff);
-    if (decoded.type)   free(decoded.type);
-    if (decoded.length) free(decoded.length);
-    if (decoded.dy)     free(decoded.dy);
-    if (decoded.dx)     free(decoded.dx);
-    if (decoded.a)      free(decoded.a);
-    if (decoded.outlier) free(decoded.outlier);
-                            
-    if (stats)  free(stats);
-    
-    if (*psize && pack_size && (pack_size + 13) < *psize) {
-        decoded.diff = alloc_raw_nbuf(N);
-        if (decoded.diff) {
-            decoded.diff->max = max;
-            decoded.diff->min = min;
-            decoded.diff->used = N;
-            
-            switch (decoded.size_type) {
-            case 0:
-                decoded.diff->var = 4;
-                for (i = 0; i != N; ++i)
-                    decoded.diff->data.u8[i] = (uint8_t)( Y[i] - min );
-                break;
-            case 1:
-                decoded.diff->var = 3;
-                for (i = 0; i != N; ++i)
-                    decoded.diff->data.u16[i] = (uint16_t)( Y[i] - min );
-                break;
-            case 2:
-                decoded.diff->var = 2;
-                for (i = 0; i != N; ++i)
-                    decoded.diff->data.u32[i] = (uint32_t)( Y[i] - min );
-                break;
-            default:
-                decoded.diff->var = 1;
-                for (i = 0; i != N; ++i)
-                    decoded.diff->data.u64[i] = Y[i] - min;
-                break;
-            }
-            zipped.buf = malloc(zipped.size = nbuf_size(decoded.diff));
-
-            if (zipped.buf) {
-                rc_t rc2 = zlib_compress(&zipped, decoded.diff->data.u8, zipped.size, Z_DEFAULT_STRATEGY, Z_BEST_SPEED);
-                if (rc2 == 0 && zipped.used > 0) {
-                    encoded.flags = (decoded.size_type << 2) | 3;
-                    encoded.data_count = N;
-                    encoded.u.zipped.data_size = zipped.used;
-                    encoded.u.zipped.data = zipped.buf;
-                    encoded.u.packed.min = min;
-                    rc = serialize_encoded(dst, dsize, psize, &encoded);
-/*                    DEBUG_PRINT("packed+zipped to %u bytes", *psize); */
-                    debugging = 3;
-                }
-                else {
-                    encoded.flags = (decoded.size_type << 2) | 2;
-                    encoded.data_count = N;
-                    encoded.u.packed.data_size = nbuf_size(decoded.diff);
-                    encoded.u.packed.data = decoded.diff->data.u8;
-                    encoded.u.packed.min = min;
-                    rc = serialize_encoded(dst, dsize, psize, &encoded);
-/*                    DEBUG_PRINT("packed to %u bytes", *psize); */
-                    debugging = 2;
-                }
-                free(zipped.buf);
-            }
-            else {
-                rc = RC(rcVDB, rcFunction, rcExecuting, rcMemory, rcExhausted);
-            }
-            free(decoded.diff);
-        }
-        else {
-            rc = RC(rcVDB, rcFunction, rcExecuting, rcMemory, rcExhausted);
-        }
-    }
-    else {
-        /* DEBUG_PRINT("packed would have been %u", pack_size + 13); */
-    }
-
-    if (*psize) {
-        size_t bsize = N * sizeof(Y[0]);
-        assert(bsize <= UINT32_MAX);
-        zipped.buf = malloc(zipped.size = (unsigned)bsize);
-        if (zipped.buf) {
-            rc_t rc2 = zlib_compress(&zipped, Y, zipped.size, Z_DEFAULT_STRATEGY, Z_BEST_SPEED);
-            if (rc2 == 0 && zipped.used + 5 <= *psize) {
-                encoded.flags = ((sizeof(Y[0]) == 1 ? 0 : sizeof(Y[0]) == 2 ? 1 : sizeof(Y[0]) == 4 ? 2 : 3) << 2) | 1;
-                encoded.data_count = N;
-                encoded.u.zipped.data_size = zipped.used;
-                encoded.u.zipped.data = zipped.buf;
-                rc = serialize_encoded(dst, dsize, psize, &encoded);
-                /* DEBUG_PRINT("zipped to %u bytes", *psize); */
-                debugging = 1;
-            }
-            else {
-                /* DEBUG_PRINT("zipped would have been %u", zipped.used + 5); */
-            }
-
-            free(zipped.buf);
-        }
-    }
-    /* if (debugging == 0) { */
-    /*     ENCODE(NULL, 0, NULL, Y, N, 1); */
-    /* } */
-    return rc;
-}
diff --git a/libs/vxf/izip.c b/libs/vxf/izip.c
deleted file mode 100644
index 824dca4..0000000
--- a/libs/vxf/izip.c
+++ /dev/null
@@ -1,865 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-#include <compiler.h>
-#include <klib/sort.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <sysalloc.h>
-#include <byteswap.h>
-#include <os-native.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <float.h>
-#include <limits.h>
-#include <math.h>
-
-#include <zlib.h>
-
-#include <stdio.h>
-#include <assert.h>
-
-#include "izip-common.h"
-
-#define FTYPE double_t
-typedef struct stats_t {
-    FTYPE sy, syy, sxy;
-    FTYPE sx, sxx;
-    FTYPE fit;
-    unsigned n;
-    unsigned i;
-    unsigned x;
-} stats_t;
-
-#if 0
-static void debug_print_stats(const stats_t *st) {
-    fprintf(stderr, "sy: %lf, syy: %lf, sxy: %lf, sx: %lf, sxx: %lf, n: %u\n",
-        st->sy, st->syy, st->sxy, st->sx, st->sxx, st->n);
-}
-
-static void debug_print_data_u32(const uint32_t Y[], unsigned n) {
-    unsigned i;
-
-    for (i = 0; i != n; ++i) {
-        fprintf(stderr, "%u\n", Y[i]);
-    }
-}
-
-static void debug_print_data_u64(const uint64_t Y[], unsigned n) {
-    unsigned i;
-
-    for (i = 0; i != n; ++i) {
-        fprintf(stderr, "%ju\n", Y[i]);
-    }
-}
-#endif
-
-static FTYPE fitness( const stats_t *st)
-{
-    double_t var_xy = st->sxy - st->sx * st->sy / (double_t)st->n;
-    double_t var_x  = st->sxx - st->sx * st->sx / (double_t)st->n;
-    double_t var_y  = st->syy - st->sy * st->sy / (double_t)st->n;
-    
-    if (st->n <= 2)
-        return 1.0;
-    if (var_y == 0.0)
-        return 1.0;
-    if (var_xy != 0.0) {
-        if (var_x != 0.0) {
-            double_t fit = (var_xy / var_x) * (var_xy / var_y);
-            assert(-1.0 <= fit && fit <= 1.0);
-            return fit;
-        }
-    }
-    return 0.0;
-}
-
-static void regress_params(const stats_t *st, int64_t *dy, int64_t *dx, int64_t *a) {
-    double_t beta = (st->sxy - st->sx * st->sy / st->n) / ((double_t)st->n * (st->n - 1) * (st->n + 1) / 12.0);
-    double_t beta2;
-    int sgn = 1;
-    
-    if (beta < 0) {
-        beta = -beta;
-        sgn = -1;
-    }
-    if (beta > 0 && beta < 1) {
-        *dy = sgn * UINT16_MAX;
-        *dx = (int64_t)( UINT16_MAX / beta );
-    }
-    else if (beta < (UINT64_MAX / UINT16_MAX)) {
-        *dy = (int64_t)( sgn * beta * UINT16_MAX );
-        *dx = UINT16_MAX;
-    }
-    else {
-        *dy = (int64_t)( sgn * beta );
-        *dx = 1;
-    }
-    beta2 = (double_t)*dy / *dx;
-    *a = (int64_t)( (st->sy / st->n) - beta2 * (st->n - 1) / 2 );
-    
-    return;
-}
-
-typedef struct {
-    unsigned size;
-    unsigned used;
-    void *buf;
-} szbuf;
-
-static void pack_nbuf8(nbuf *x) {
-    unsigned i;
-    const unsigned n = x->used;
-    
-    for (i = 0; i != n; ++i)
-        x->data.u8[i] = (uint8_t)( x->data.raw[i] - x->min );
-    x->var = 4;
-}
-
-static void pack_nbuf16(nbuf *x) {
-    unsigned i;
-    const unsigned n = x->used;
-    
-    for (i = 0; i != n; ++i)
-        x->data.u16[i] = (uint16_t)( x->data.raw[i] - x->min );
-    x->var = 3;
-}
-
-static void pack_nbuf32(nbuf *x) {
-    unsigned i;
-    const unsigned n = x->used;
-    
-    for (i = 0; i != n; ++i)
-        x->data.u32[i] = (uint32_t)( x->data.raw[i] - x->min );
-    x->var = 2;
-}
-
-static void pack_nbuf(nbuf *x) {
-    if ((x->max - x->min) >> 8 == 0) {
-        pack_nbuf8(x);
-    }
-    else if ((x->max - x->min) >> 16 == 0) {
-        pack_nbuf16(x);
-    }
-    else if ((x->max - x->min) >> 32 == 0) {
-        pack_nbuf32(x);
-    }
-    else {
-        unsigned i;
-        const unsigned n = x->used;
-        
-        for (i = 0; i != n; ++i)
-            x->data.u64[i] = x->data.raw[i] - x->min;
-        x->var = 1;
-    }
-}
-
-static rc_t zlib_compress(szbuf *dst, const void *src, uint32_t ssize, int32_t strategy, int32_t level) {
-    z_stream s;
-    int zr;
-    rc_t rc = 0;
-    
-    memset(&s, 0, sizeof(s));
-    s.next_in = (void *)src;
-    s.avail_in = ssize;
-    s.next_out = dst->buf;
-    s.avail_out = (uInt)dst->size;
-    
-    dst->used = 0;
-    
-    zr = deflateInit2(&s, level, Z_DEFLATED, -15, 9, strategy);
-    switch (zr) {
-    case 0:
-        break;
-    case Z_MEM_ERROR:
-        return RC(rcVDB, rcFunction, rcExecuting, rcMemory, rcExhausted);
-    case Z_STREAM_ERROR:
-        return RC(rcVDB, rcFunction, rcExecuting, rcParam, rcInvalid);
-    default:
-        return RC(rcVDB, rcFunction, rcExecuting, rcSelf, rcUnexpected);
-    }
-    zr = deflate(&s, Z_FINISH);
-    switch (zr) {
-    case Z_STREAM_END:
-        break;
-    case Z_OK:
-        s.total_out = 0;
-        break;
-    default:
-        rc = RC(rcVDB, rcFunction, rcExecuting, rcSelf, rcUnexpected);
-        break;
-    }
-    zr = deflateEnd(&s);
-    if (zr != Z_OK)
-        rc = RC(rcVDB, rcFunction, rcExecuting, rcSelf, rcUnexpected);
-    if (rc == 0) {
-        assert(s.total_out <= UINT32_MAX);
-        dst->used = (uint32_t)s.total_out;
-    }
-    return rc;
-}
-
-static
-void encode_types(uint8_t *packed, const uint8_t type[], unsigned n) {
-    unsigned i;
-    unsigned j;
-    unsigned k;
-    
-    for (i = k = 0, j = 1; i != n; ++i) {
-        if (type[i])
-            k |= j;
-        j <<= 1;
-        if (j == 0x100) {
-            j = 1;
-            packed[i / 8] = k;
-            k = 0;
-        }
-    }
-    packed[i / 8] = k;
-}
-
-static rc_t encode_decoded(struct encoded *y, const struct decoded *x) {
-    rc_t rc = 0;
-    uint8_t *temp;
-    unsigned temp_size;
-    szbuf zbuf;
-    
-    memset(y, 0, sizeof(*y));
-    y->flags = x->size_type << 2;
-    y->data_count = x->data_count;
-    y->u.izipped.segments = x->lines + x->outliers;
-    y->u.izipped.outliers = x->outliers ? x->outlier->used : 0;
-    
-    y->u.izipped.min_diff = x->diff->min;
-    y->u.izipped.min_length = x->length->min;
-    y->u.izipped.min_dy = x->dy->min;
-    y->u.izipped.min_dx = x->dx->min;
-    y->u.izipped.min_a = x->a->min;
-    y->u.izipped.min_outlier = x->outlier->min;
-    
-    if (x->outliers) {
-        temp = malloc((temp_size = (x->lines + x->outliers + 7) / 8) + 1);
-        if (temp == NULL)
-            return RC(rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted);
-
-        encode_types(temp, x->type, x->lines + x->outliers);
-        
-        zbuf.buf = malloc(zbuf.size = temp_size);
-        if (zbuf.buf == NULL)
-            return RC(rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted);
-
-        zbuf.used = 0;
-        rc = zlib_compress(&zbuf, temp, temp_size, Z_DEFAULT_STRATEGY, Z_BEST_SPEED);
-        if (rc) {
-            free(zbuf.buf);
-            free(temp);
-            return rc;
-        }
-        if (zbuf.used > 0 && zbuf.used < zbuf.size) {
-            free(temp);
-            SET_TYPE_ZIPPED(y->u.izipped);
-            y->u.izipped.type = zbuf.buf;
-            y->u.izipped.type_size = zbuf.used;
-        }
-        else {
-            free(zbuf.buf);
-            y->u.izipped.type = temp;
-            y->u.izipped.type_size = temp_size;
-        }
-    }
-    else {
-        SET_TYPE_ABSENT(y->u.izipped);
-        SET_OUTLIER_ABSENT(y->u.izipped);
-        y->u.izipped.type_size = 0;
-    }
-
-    if (x->diff->min == x->diff->max) {
-        SET_DIFF_CONSTANT(y->u.izipped);
-        y->u.izipped.diff_size = x->diff->used;
-    }
-    else {
-        zbuf.buf = malloc(zbuf.size = nbuf_size(x->diff));
-        if (zbuf.buf == NULL)
-            return RC(rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted);
-        zbuf.used = 0;
-        
-        rc = zlib_compress(&zbuf, &x->diff->data, zbuf.size, Z_FILTERED, Z_BEST_SPEED);
-        if (rc) {
-            free(zbuf.buf);
-            return rc;
-        }
-        if (zbuf.used > 0 && zbuf.used < zbuf.size) {
-            SET_DIFF_ZIPPED(y->u.izipped);
-            y->u.izipped.diff = zbuf.buf;
-            y->u.izipped.diff_size = zbuf.used;
-        }
-        else {
-            y->u.izipped.diff = x->diff->data.u8;
-            y->u.izipped.diff_size = zbuf.size;
-            free(zbuf.buf);
-        }
-    }
-    
-    if (x->length->min == x->length->max) {
-        SET_LENGTH_CONSTANT(y->u.izipped);
-        y->u.izipped.length_size = x->length->used;
-    }
-    else {
-        zbuf.buf = malloc(zbuf.size = nbuf_size(x->length));
-        if (zbuf.buf == NULL)
-            return RC(rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted);
-        zbuf.used = 0;
-        
-        rc = zlib_compress(&zbuf, &x->length->data, zbuf.size, Z_DEFAULT_STRATEGY, Z_BEST_SPEED);
-        if (rc) {
-            free(zbuf.buf);
-            return rc;
-        }
-        if (zbuf.used > 0 && zbuf.used < zbuf.size) {
-            SET_LENGTH_ZIPPED(y->u.izipped);
-            y->u.izipped.length = zbuf.buf;
-            y->u.izipped.length_size = zbuf.used;
-        }
-        else {
-            y->u.izipped.length = x->length->data.u8;
-            y->u.izipped.length_size = zbuf.size;
-            free(zbuf.buf);
-        }
-    }
-    
-    if (x->dy->min == x->dy->max) {
-        SET_DY_CONSTANT(y->u.izipped);
-        y->u.izipped.dy_size = x->dy->used;
-    }
-    else {
-        zbuf.buf = malloc(zbuf.size = nbuf_size(x->dy));
-        if (zbuf.buf == NULL)
-            return RC(rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted);
-        zbuf.used = 0;
-        
-        rc = zlib_compress(&zbuf, &x->dy->data, zbuf.size, Z_DEFAULT_STRATEGY, Z_BEST_SPEED);
-        if (rc) {
-            free(zbuf.buf);
-            return rc;
-        }
-        if (zbuf.used > 0 && zbuf.used < zbuf.size) {
-            SET_DY_ZIPPED(y->u.izipped);
-            y->u.izipped.dy = zbuf.buf;
-            y->u.izipped.dy_size = zbuf.used;
-        }
-        else {
-            y->u.izipped.dy = x->dy->data.u8;
-            y->u.izipped.dy_size = zbuf.size;
-            free(zbuf.buf);
-        }
-    }
-    
-    if (x->dx->min == x->dx->max) {
-        SET_DX_CONSTANT(y->u.izipped);
-        y->u.izipped.dx_size = x->dx->used;
-    }
-    else {
-        zbuf.buf = malloc(zbuf.size = nbuf_size(x->dx));
-        if (zbuf.buf == NULL)
-            return RC(rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted);
-        zbuf.used = 0;
-        
-        rc = zlib_compress(&zbuf, &x->dx->data, zbuf.size, Z_DEFAULT_STRATEGY, Z_BEST_SPEED);
-        if (rc) {
-            free(zbuf.buf);
-            return rc;
-        }
-        if (zbuf.used > 0 && zbuf.used < zbuf.size) {
-            SET_DX_ZIPPED(y->u.izipped);
-            y->u.izipped.dx = zbuf.buf;
-            y->u.izipped.dx_size = zbuf.used;
-        }
-        else {
-            y->u.izipped.dx = x->dx->data.u8;
-            y->u.izipped.dx_size = zbuf.size;
-            free(zbuf.buf);
-        }
-    }
-    
-    if (x->a->min == x->a->max) {
-        SET_A_CONSTANT(y->u.izipped);
-        y->u.izipped.a_size = x->a->used;
-    }
-    else {
-        zbuf.buf = malloc(zbuf.size = nbuf_size(x->a));
-        if (zbuf.buf == NULL)
-            return RC(rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted);
-        zbuf.used = 0;
-        
-        rc = zlib_compress(&zbuf, &x->a->data, zbuf.size, Z_DEFAULT_STRATEGY, Z_BEST_SPEED);
-        if (rc) {
-            free(zbuf.buf);
-            return rc;
-        }
-        if (zbuf.used > 0 && zbuf.used < zbuf.size) {
-            SET_A_ZIPPED(y->u.izipped);
-            y->u.izipped.a = zbuf.buf;
-            y->u.izipped.a_size = zbuf.used;
-        }
-        else {
-            y->u.izipped.a = x->a->data.u8;
-            y->u.izipped.a_size = zbuf.size;
-            free(zbuf.buf);
-        }
-    }
-    
-    if (x->outliers != 0) {
-        zbuf.buf = malloc(zbuf.size = nbuf_size(x->outlier));
-        if (zbuf.buf == NULL)
-            return RC(rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted);
-        zbuf.used = 0;
-        
-        rc = zlib_compress(&zbuf, &x->outlier->data, zbuf.size, Z_DEFAULT_STRATEGY, Z_BEST_SPEED);
-        if (rc) {
-            free(zbuf.buf);
-            return rc;
-        }
-        if (zbuf.used > 0 && zbuf.used < zbuf.size) {
-            SET_OUTLIER_ZIPPED(y->u.izipped);
-            y->u.izipped.outlier = zbuf.buf;
-            y->u.izipped.outlier_size = zbuf.used;
-        }
-        else {
-            y->u.izipped.outlier = x->outlier->data.u8;
-            y->u.izipped.outlier_size = zbuf.size;
-            free(zbuf.buf);
-        }
-    }
-    
-    return 0;
-}
-
-static void free_encoded(const struct encoded *self) {
-    switch (self->flags & 3) {
-    case 0:
-        if (FLAG_OUTLIER(self->u.izipped) == DATA_ZIPPED)
-            free((void *)self->u.izipped.outlier);
-        if (FLAG_A(self->u.izipped) == DATA_ZIPPED)
-            free((void *)self->u.izipped.a);
-        if (FLAG_DX(self->u.izipped) == DATA_ZIPPED)
-            free((void *)self->u.izipped.dx);
-        if (FLAG_DY(self->u.izipped) == DATA_ZIPPED)
-            free((void *)self->u.izipped.dy);
-        if (FLAG_LENGTH(self->u.izipped) == DATA_ZIPPED)
-            free((void *)self->u.izipped.length);
-        if (FLAG_DIFF(self->u.izipped) == DATA_ZIPPED)
-            free((void *)self->u.izipped.diff);
-        if (FLAG_TYPE(self->u.izipped) != DATA_ABSENT)
-            free((void *)self->u.izipped.type);
-        break;
-    default:
-        break;
-    }
-}
-
-#define SERIALZE16(X) do { if (i + 2 > dsize) return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient); memcpy(dst + i, &x->u.izipped.X, 2); i += 2; } while(0)
-#define SERIALZE32(X) do { if (i + 4 > dsize) return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient); memcpy(dst + i, &x->u.izipped.X, 4); i += 4; } while(0)
-#define SERIALZE64(X) do { if (i + 8 > dsize) return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient); memcpy(dst + i, &x->u.izipped.X, 8); i += 8; } while(0)
-
-static
-rc_t serialize_encoded(uint8_t *dst, unsigned dsize, unsigned *psize, const struct encoded *x) {
-    unsigned i = 0;
-   
-    *psize = 0;
-
-    if (i + 1 > dsize)
-        return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);    
-    dst[i] = x->flags; i += 1;
-    
-    if (i + 4 > dsize)
-        return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);    
-    memcpy(dst + i, &x->data_count, 4); i += 4;
-
-    switch (x->flags & 0x03) {
-    case 3:
-    case 2:
-        if (i + 8 > dsize)
-            return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);    
-        memcpy(dst + i, &x->u.packed.min, 8); i += 8;
-        /* fall thru */
-    case 1:
-        if (i + x->u.zipped.data_size > dsize)
-            return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);    
-        memcpy(dst + i, x->u.zipped.data, x->u.zipped.data_size); i += x->u.zipped.data_size;
-        *psize = i;
-        return 0;
-    default:
-        break;
-    }
-    
-    SERIALZE32(data_flags);
-    SERIALZE32(segments);
-    SERIALZE32(outliers);
-    SERIALZE32(type_size);
-    SERIALZE32(diff_size);
-    SERIALZE32(length_size);
-    SERIALZE32(dy_size);
-    SERIALZE32(dx_size);
-    SERIALZE32(a_size);
-    SERIALZE32(outlier_size);
-
-    SERIALZE64(min_diff);
-    SERIALZE64(min_length);
-    SERIALZE64(min_dy);
-    SERIALZE64(min_dx);
-    SERIALZE64(min_a);
-    SERIALZE64(min_outlier);
-    
-    if (FLAG_TYPE(x->u.izipped) != DATA_ABSENT && FLAG_TYPE(x->u.izipped) != DATA_CONSTANT) {
-        if (i + x->u.izipped.type_size > dsize)
-            return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-        memcpy(dst + i, x->u.izipped.type, x->u.izipped.type_size); i += x->u.izipped.type_size;
-    }
-    
-    if (FLAG_DIFF(x->u.izipped) != DATA_ABSENT && FLAG_DIFF(x->u.izipped) != DATA_CONSTANT) {
-        if (i + x->u.izipped.diff_size > dsize)
-            return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-        memcpy(dst + i, x->u.izipped.diff, x->u.izipped.diff_size); i += x->u.izipped.diff_size;
-    }
-    
-    if (FLAG_LENGTH(x->u.izipped) != DATA_ABSENT && FLAG_LENGTH(x->u.izipped) != DATA_CONSTANT) {
-        if (i + x->u.izipped.length_size > dsize)
-            return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-        memcpy(dst + i, x->u.izipped.length, x->u.izipped.length_size); i += x->u.izipped.length_size;
-    }
-    
-    if (FLAG_DY(x->u.izipped) != DATA_ABSENT && FLAG_DY(x->u.izipped) != DATA_CONSTANT) {
-        if (i + x->u.izipped.dy_size > dsize)
-            return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-        memcpy(dst + i, x->u.izipped.dy, x->u.izipped.dy_size); i += x->u.izipped.dy_size;
-    }
-    
-    if (FLAG_DX(x->u.izipped) != DATA_ABSENT && FLAG_DX(x->u.izipped) != DATA_CONSTANT) {
-        if (i + x->u.izipped.dx_size > dsize)
-            return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-        memcpy(dst + i, x->u.izipped.dx, x->u.izipped.dx_size); i += x->u.izipped.dx_size;
-    }
-    
-    if (FLAG_A(x->u.izipped) != DATA_ABSENT && FLAG_A(x->u.izipped) != DATA_CONSTANT) {
-        if (i + x->u.izipped.a_size > dsize)
-            return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-        memcpy(dst + i, x->u.izipped.a, x->u.izipped.a_size); i += x->u.izipped.a_size;
-    }
-    
-    if (FLAG_OUTLIER(x->u.izipped) != DATA_ABSENT && FLAG_OUTLIER(x->u.izipped) != DATA_CONSTANT) {
-        if (i + x->u.izipped.outlier_size > dsize)
-            return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-        memcpy(dst + i, x->u.izipped.outlier, x->u.izipped.outlier_size); i += x->u.izipped.outlier_size;
-    }
-    
-    *psize = i;
-    return 0;
-}
-
-static int CC comp_position(const void *A, const void *B, void * ignored) {
-    const stats_t *a = A;
-    const stats_t *b = B;
-    
-    return a->x - b->x;
-}
-
-static int CC comp_fitness(const void *A, const void *B, void * ignored) {
-    const stats_t **a = (const stats_t **)A;
-    const stats_t **b = (const stats_t **)B;
-    
-    return (**a).fit < (**b).fit ? -1 : (**b).fit < (**a).fit ? 1 : (**a).i - (**b).i;
-}
-
-static void merge(stats_t *dst, const stats_t *L, const stats_t *R) {
-    stats_t temp = *L;
-    
-    temp.sx  += R->sx;
-    temp.sxx += R->sxx;
-    temp.sy  += R->sy;
-    temp.syy += R->syy;
-    temp.sxy += R->sxy;
-    temp.n   += R->n;
-    temp.fit  = fitness( &temp );
-    
-    *dst = temp;
-}
-
-#define OUTLIER_LIMIT (12)
-#define CHUNK_SIZE (16)
-#define SANITY_CHECK 1
-
-/* for signed operations */
-#define ABS(X) ((uint64_t)(X >= 0 ? (X) : (-(X))))
-
-#define STYPE int8_t
-#define ANALYZE analyze_i8
-#define ENCODE encode_i8
-#include "izip-encode.impl.h"
-#undef STYPE
-#undef ANALYZE
-#undef ENCODE
-
-#define STYPE int16_t
-#define ANALYZE analyze_i16
-#define ENCODE encode_i16
-#include "izip-encode.impl.h"
-#undef STYPE
-#undef ANALYZE
-#undef ENCODE
-
-#define STYPE int32_t
-#define ANALYZE analyze_i32
-#define ENCODE encode_i32
-#include "izip-encode.impl.h"
-#undef STYPE
-#undef ANALYZE
-#undef ENCODE
-
-#define STYPE int64_t
-#define ANALYZE analyze_i64
-#define ENCODE encode_i64
-#include "izip-encode.impl.h"
-#undef STYPE
-#undef ANALYZE
-#undef ENCODE
-
-
-/* for unsigned operations */
-#undef ABS
-#define ABS(X) ((uint64_t)(X))
-
-#define STYPE uint8_t
-#define ANALYZE analyze_u8
-#define ENCODE encode_u8
-#include "izip-encode.impl.h"
-#undef STYPE
-#undef ANALYZE
-#undef ENCODE
-
-#define STYPE uint16_t
-#define ANALYZE analyze_u16
-#define ENCODE encode_u16
-#include "izip-encode.impl.h"
-#undef STYPE
-#undef ANALYZE
-#undef ENCODE
-
-#define STYPE uint32_t
-#define ANALYZE analyze_u32
-#define ENCODE encode_u32
-#include "izip-encode.impl.h"
-#undef STYPE
-#undef ANALYZE
-#undef ENCODE
-
-#define STYPE uint64_t
-#define ANALYZE analyze_u64
-#define ENCODE encode_u64
-#include "izip-encode.impl.h"
-#undef STYPE
-#undef ANALYZE
-#undef ENCODE
-
-typedef rc_t (*encode_f)(uint8_t *dst, unsigned dsize, unsigned *psize, const void *Y, unsigned N, int DUMP);
-
-struct self_t {
-    encode_f f;
-};
-
-static
-struct self_t selfs[8] = {
-    { (encode_f)encode_u8 },
-    { (encode_f)encode_i8 },
-    { (encode_f)encode_u16 },
-    { (encode_f)encode_i16 },
-    { (encode_f)encode_u32 },
-    { (encode_f)encode_i32 },
-    { (encode_f)encode_u64 },
-    { (encode_f)encode_i64 },
-};
-
-rc_t ex_encode8( void *dst, unsigned dsize, uint8_t *src,
-                 unsigned ssize_in_u8, unsigned *written )
-{
-    return selfs[0].f( dst, dsize, written, src, ssize_in_u8, 0 );
-}
-
-rc_t ex_encode16( void *dst, unsigned dsize, uint16_t *src,
-                  unsigned ssize_in_u16, unsigned *written )
-{
-    return selfs[2].f( dst, dsize, written, src, ssize_in_u16, 0 );
-}
-
-rc_t ex_encode32( void *dst, unsigned dsize, uint32_t *src,
-                  unsigned ssize_in_u32, unsigned *written )
-{
-    return selfs[4].f( dst, dsize, written, src, ssize_in_u32, 0 );
-}
-
-rc_t ex_encode64( void *dst, unsigned dsize, uint64_t *src,
-                  unsigned ssize_in_u64, unsigned *written )
-{
-    return selfs[6].f( dst, dsize, written, src, ssize_in_u64, 0 );
-}
-
-static
-rc_t CC izip(
-               void *Self,
-               const VXformInfo *info,
-               VBlobResult *dst,
-               const VBlobData *src,
-               VBlobHeader *hdr
-) {
-    rc_t rc = 0;
-    const struct self_t *self = Self;
-    uint32_t dsize;
-    
-    VBlobHeaderSetVersion(hdr, 0);
-
-    assert(src->elem_count >> 32 == 0);
-    assert(((dst->elem_count * dst->elem_bits + 7) >> 3) >> 32 == 0);
-    dsize = (uint32_t)((dst->elem_count * dst->elem_bits + 7) >> 3);
-    rc = self->f(dst->data, (uint32_t)dsize, &dsize, src->data, (uint32_t)src->elem_count, 0);
-    if (dsize && rc == 0) {
-        dst->byte_order = vboNative;
-        dst->elem_bits = 1;
-        dst->elem_count = dsize << 3;
-        return 0;
-    }
-    return RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-}
-
-#if 0
-/* 
- function izip_fmt izip #1.0 ( izip_set in )
- */
-VTRANSFACT_IMPL(vdb_izip, 1, 0, 0) (const void *Self, const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    if (dp->argc != 1) {
-#if _DEBUGGING
-        fprintf(stderr, "dp->argc = %u != 1\n", dp->argc);
-#endif
-        return RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-    }
-
-    rslt->variant = vftBlob;
-    rslt->u.bf = izip;
-
-    switch (dp->argv[0].desc.domain) {
-    case vtdInt:
-        switch (dp->argv[0].desc.intrinsic_bits) {
-        case 8:
-            rslt->self = &selfs[1];
-            break;
-        case 16:
-            rslt->self = &selfs[3];
-            break;
-        case 32:
-            rslt->self = &selfs[5];
-            break;
-        case 64:
-            rslt->self = &selfs[7];
-            break;
-        default:
-#if _DEBUGGING
-            fprintf(stderr, "intrinsic_bits = %u != (8|16|32|64)\n", dp->argv[0].desc.intrinsic_bits);
-#endif
-            return RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-            break;
-        }
-        break;
-    case vtdUint:
-        switch (dp->argv[0].desc.intrinsic_bits) {
-        case 8:
-            rslt->self = &selfs[0];
-            break;
-        case 16:
-            rslt->self = &selfs[2];
-            break;
-        case 32:
-            rslt->self = &selfs[4];
-            break;
-        case 64:
-            rslt->self = &selfs[6];
-            break;
-        default:
-#if _DEBUGGING
-            fprintf(stderr, "intrinsic_bits = %u != (8|16|32|64)\n", dp->argv[0].desc.intrinsic_bits);
-#endif
-            return RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-            break;
-        }
-        break;
-    default:
-#if _DEBUGGING
-        fprintf(stderr, "domain != vtdInt or vtdUint\n");
-#endif
-        return RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-    }
-
-    return 0;
-}
-#endif
-
-#if TESTING
-extern int test_decode(int32_t *, unsigned, const uint8_t *, unsigned, int);
-
-int test_encode(const int32_t Y[], unsigned N) {
-    uint8_t *dst;
-    unsigned dsize;
-    size_t temp;
-    rc_t rc = 0;
-    
-    temp = N * sizeof(Y[0]);
-    assert(temp >> 32 == 0);
-    dst = malloc(dsize = (unsigned)temp);
-    if (dst == NULL)
-        return RC(rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted);
-    rc = encode_i32(dst, dsize, &dsize, Y, N, 0);
-
-    {
-        int32_t *X;
-        
-        X = malloc(N * sizeof(Y[0]));
-        if (X) {
-            rc = test_decode(X, N, dst, dsize, 0);
-            if (rc == 0) {
-                rc = memcmp(Y, X, N * sizeof(Y[0])) == 0 ? 0 : RC(rcXF, rcFunction, rcExecuting, rcFunction, rcInvalid);
-            }
-            free(X);
-        }
-    }
-
-    free(dst);
-    if (rc)
-        fprintf(stdout, "test failed!\n");
-    return rc;
-}
-#endif
diff --git a/libs/vxf/lower-case-tech-reads.c b/libs/vxf/lower-case-tech-reads.c
deleted file mode 100644
index 9f9e911..0000000
--- a/libs/vxf/lower-case-tech-reads.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-#include <vdb/xform.h>
-#include <insdc/insdc.h>
-#include <klib/data-buffer.h>
-#include <klib/rc.h>
-
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <ctype.h>
-
-static
-rc_t CC lower_case_tech_reads ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    uint32_t i, j, k;
-
-    char *mixed;
-    const char *read_text = argv [ 0 ] . u . data . base;
-    const INSDC_coord_len *read_len = argv [ 1 ] . u . data . base;
-    const INSDC_read_type *read_type = argv [ 2 ] . u . data . base;
-
-    rc_t rc = KDataBufferResize ( rslt -> data, argv [ 0 ] . u . data . elem_count );
-    if ( rc != 0 )
-        return rc;
-
-    rslt -> elem_count = argv [ 0 ] . u . data . elem_count;
-
-    mixed = rslt -> data -> base;
-    read_text += argv [ 0 ] . u . data . first_elem;
-    read_len += argv [ 1 ] . u . data . first_elem;
-    read_type += argv [ 2 ] . u . data . first_elem;
-
-    for ( i = j = 0; i < argv [ 0 ] . u . data . elem_count; ++ j )
-    {
-        /* should still have reads described */
-        if ( j == argv [ 1 ] . u . data . elem_count || j == argv [ 2 ] . u . data . elem_count )
-            break;
-
-        /* get read length */
-        k = read_len [ j ];
-        if ( i + k > argv [ 0 ] . u . data . elem_count )
-            k = argv [ 0 ] . u . data . elem_count - i;
-
-        /* decide upon upper or lower case */
-        if ( ( read_type [ j ] & 1 ) != READ_TYPE_BIOLOGICAL )
-        {
-            for ( ; k > 0; ++ i, -- k )
-                mixed [ i ] = tolower ( read_text [ i ] );
-        }
-        else
-        {
-            for ( ; k > 0; ++ i, -- k )
-                mixed [ i ] = toupper ( read_text [ i ] );
-        }
-    }
-
-    for ( ; i < argv [ 0 ] . u . data . elem_count; ++ i )
-        mixed [ i ] = toupper ( read_text [ i ] );
-
-    return 0;
-}
-
-
-/* lower_case_tech_reads
- *  locates technical reads within an IUPAC sequence
- *  converts them to lower-case
- *
- *  "read_text" [ DATA ] - IUPAC source text
- *
- *  "read_len" [ DATA ] - ordered array of read lengths
- *
- *  "read_type" [ DATA ] - describes which reads are technical
- *  and which are biological. determines the case of each read segment
- *
- * extern function
- * INSDC:dna:mixed_case:text NCBI:lower_case_tech_reads #1 ( INSDC:dna:text read_text,
- *     INSDC:coord:len read_len, INSDC:read:type read_type );
- */
-VTRANSFACT_IMPL ( NCBI_lower_case_tech_reads, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt -> u . rf = lower_case_tech_reads;
-    rslt -> variant = vftRow;
-    return 0;
-}
diff --git a/libs/vxf/map.c b/libs/vxf/map.c
deleted file mode 100644
index ab7c25c..0000000
--- a/libs/vxf/map.c
+++ /dev/null
@@ -1,1019 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-#include <klib/defs.h>
-#include <klib/sort.h>
-#include <klib/rc.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-
-/* LOOP TYPES
- *  this function can be characterized by its loops
- *
- *  1) single-input that is type-compatible with the output
- *     functions like the unix command "tr" by allowing all
- *     input to pass through, except those matching the "from"
- *     array, which are changed to the corresponding entry in
- *     the "to" array.
- *
- *  2) single-input that is NOT type-compatible with output
- *     functions like a type transformation where ALL input
- *     must be transformed, i.e. there can be no pass through.
- *     this loop requires detection of any unspecified input
- *     and results in an error.
- *
- *  3) dual-input that combines the other two loops, in a sense.
- *     it is like the first loop type in that there are no
- *     points of failure, and like the second in that it has
- *     to test for matches against the "from" array. its exact
- *     behavior is to pass values from the second input to the
- *     output unchanged, unless the corresponding value from the
- *     first input matches anything in the "from" table, in which
- *     case the corresponding "to" value is substituted to dest.
- */
-
-
-/* type 1: 8-bit to 8-bit map
- *  this is our principal workhorse
- *  there are no points of failure
- *  the map is built initially for identity
- *  and overridden to perform substitutions indicated
- */
-static
-rc_t CC type1_uint8_t ( void *self, const VXformInfo *info,
-    void *vdst, const void *vsrc, uint64_t elem_count )
-{
-    const uint8_t *map = ( const void* ) self;
-    const uint8_t *src = vsrc;
-    uint8_t *dst = vdst;
-
-    uint64_t i;
-    for ( i = 0; i < elem_count; ++ i )
-        dst [ i ] = map [ src [ i ] ];
-
-    return 0;
-}
-
-static
-rc_t make_type1_uint8_t ( void **selfp, const uint8_t *from, const uint8_t *to, uint32_t map_len )
-{
-    uint32_t i;
-
-    uint8_t *map = malloc ( 256 );
-    if ( map == NULL )
-        return RC ( rcVDB, rcFunction, rcConstructing, rcMemory, rcExhausted );
-
-    for ( i = 0; i < 256; ++ i )
-        map [ i ] = ( uint8_t ) i;
-
-    for ( i = 0; i < map_len; ++ i )
-        map [ from [ i ] ] = to [ i ];
-
-    * selfp = map;
-    return 0;
-}
-
-
-/* map_t
- *  a structure that holds "from" and "to" arrays
- */
-typedef struct map_t map_t;
-struct map_t
-{
-#if _DEBUGGING
-    /* array function for type 1 and 2 loops */
-    VArrayFunc array;
-#endif
-
-    /* row function for type 3 loops */
-    void ( * row ) ( const map_t *self, void *dst,
-        const void *src, const void *tst, uint64_t elem_count );
-
-    /* map length */
-    uint32_t map_len;
-    uint32_t align;
-
-    /* ordered "from" array and corresponding "to" array */
-    const void *from, * to;
-};
-
-
-/* type 1: linear map
- *  when the arrays are so short as to not benefit from binary search
- */
-#define TYPE1_LINEAR_MAP( TYPE )                                \
-static                                                          \
-rc_t CC type1_linear_ ## TYPE ( void *vself,                    \
-    const VXformInfo *info, void *vdst, const void *vsrc,       \
-    uint64_t elem_count )                                       \
-{                                                               \
-    const map_t *self = ( const void* ) vself;                  \
-                                                                \
-    const TYPE *src = vsrc;                                     \
-    TYPE *dst = vdst;                                           \
-                                                                \
-    const TYPE *from = self -> from;                            \
-    const TYPE *to = self -> to;                                \
-                                                                \
-    uint64_t i;                                                 \
-    uint32_t j, map_len = self -> map_len;                      \
-    for ( i = 0; i < elem_count; ++ i )                         \
-    {                                                           \
-        TYPE elem = dst [ i ] = src [ i ];                      \
-        for ( j = 0; j < map_len; ++ j )                        \
-        {                                                       \
-            if ( from [ j ] == elem )                           \
-            {                                                   \
-                dst [ i ] = to [ j ];                           \
-                break;                                          \
-            }                                                   \
-        }                                                       \
-    }                                                           \
-                                                                \
-    return 0;                                                   \
-}
-
-TYPE1_LINEAR_MAP ( uint16_t )
-TYPE1_LINEAR_MAP ( uint32_t )
-TYPE1_LINEAR_MAP ( uint64_t )
-TYPE1_LINEAR_MAP ( float )
-TYPE1_LINEAR_MAP ( double )
-
-static VArrayFunc type1_linear_funcs [ 5 ] =
-{
-    type1_linear_uint16_t,
-    type1_linear_uint32_t,
-    type1_linear_uint64_t,
-    type1_linear_float,
-    type1_linear_double
-};
-
-
-/* type 1: binary map
- *  when the arrays are long enough to warrant binary search
- */
-#define TYPE1_BINARY_MAP( TYPE )                                \
-static                                                          \
-rc_t CC type1_binary_ ## TYPE ( void *vself,                    \
-    const VXformInfo *info, void *vdst, const void *vsrc,       \
-    uint64_t elem_count )                                       \
-{                                                               \
-    const map_t *self = ( const void* ) vself;                  \
-                                                                \
-    const TYPE *src = vsrc;                                     \
-    TYPE *dst = vdst;                                           \
-                                                                \
-    const TYPE *from = self -> from;                            \
-    const TYPE *to = self -> to;                                \
-                                                                \
-    uint64_t i;                                                 \
-    for ( i = 0; i < elem_count; ++ i )                         \
-    {                                                           \
-        TYPE elem = dst [ i ] = src [ i ];                      \
-                                                                \
-        uint32_t lower = 0, upper = self -> map_len;            \
-        while ( lower < upper )                                 \
-        {                                                       \
-            uint32_t j = ( lower + upper ) >> 1;                \
-            TYPE cur = from [ j ];                              \
-            if ( elem == cur )                                  \
-            {                                                   \
-                dst [ i ] = to [ j ];                           \
-                break;                                          \
-            }                                                   \
-            if ( elem < cur )                                   \
-                upper = j;                                      \
-            else                                                \
-                lower = j + 1;                                  \
-        }                                                       \
-    }                                                           \
-                                                                \
-    return 0;                                                   \
-}
-
-TYPE1_BINARY_MAP ( uint16_t )
-TYPE1_BINARY_MAP ( uint32_t )
-TYPE1_BINARY_MAP ( uint64_t )
-TYPE1_BINARY_MAP ( float )
-TYPE1_BINARY_MAP ( double )
-
-static VArrayFunc type1_binary_funcs [ 5 ] =
-{
-    type1_binary_uint16_t,
-    type1_binary_uint32_t,
-    type1_binary_uint64_t,
-    type1_binary_float,
-    type1_binary_double
-};
-
-/* type 2: 8-bit to N-bit
- *  allowed to perform a lookup test
- */
-#define TYPE2_8BIT_MAP( DTYPE )                                 \
-static                                                          \
-rc_t CC type2_uint8_t_to_ ## DTYPE ( void *vself,               \
-    const VXformInfo *info, void *vdst, const void *vsrc,       \
-    uint64_t elem_count )                                       \
-{                                                               \
-    const map_t *self = ( const void* ) vself;                  \
-                                                                \
-    const uint8_t *src = vsrc;                                  \
-    DTYPE *dst = vdst;                                          \
-                                                                \
-    const uint8_t *from = self -> from;                         \
-    const DTYPE *to = self -> to;                               \
-                                                                \
-    uint64_t i;                                                 \
-    for ( i = 0; i < elem_count; ++ i )                         \
-    {                                                           \
-        int j = src [ i ];                                      \
-        if ( ! from [ j ] )                                     \
-        {                                                       \
-            return RC ( rcVDB, rcFunction, rcExecuting,         \
-                       rcConstraint, rcViolated );              \
-        }                                                       \
-        dst [ i ] = to [ j ];                                   \
-    }                                                           \
-                                                                \
-    return 0;                                                   \
-}
-
-TYPE2_8BIT_MAP ( uint8_t )
-TYPE2_8BIT_MAP ( uint16_t )
-TYPE2_8BIT_MAP ( uint32_t )
-TYPE2_8BIT_MAP ( uint64_t )
-
-/* type2: binary map
- *  due to the combinatorial explosion,
- *  just implement the binary version
- */
-#define TYPE2_BINARY_MAP( STYPE, DTYPE )                        \
-static                                                          \
-rc_t CC type2_ ## STYPE ## _to_ ## DTYPE ( void *vself,         \
-    const VXformInfo *info, void *vdst, const void *vsrc,       \
-    uint64_t elem_count )                                       \
-{                                                               \
-    const map_t *self = ( const void* ) vself;                  \
-                                                                \
-    const STYPE *src = vsrc;                                    \
-    DTYPE *dst = vdst;                                          \
-                                                                \
-    const STYPE *from = self -> from;                           \
-    const DTYPE *to = self -> to;                               \
-                                                                \
-    uint64_t i;                                                 \
-    for ( i = 0; i < elem_count; ++ i )                         \
-    {                                                           \
-        STYPE cur, elem = src [ i ];                            \
-                                                                \
-        uint32_t j, lower = 0, upper = self -> map_len;         \
-        while ( lower < upper )                                 \
-        {                                                       \
-            j = ( lower + upper ) >> 1;                         \
-            cur = from [ j ];                                   \
-            if ( elem == cur )                                  \
-                goto FOUND;                                     \
-            if ( elem < cur )                                   \
-                upper = j;                                      \
-            else                                                \
-                lower = j + 1;                                  \
-        }                                                       \
-        return RC( rcVDB, rcFunction, rcExecuting,              \
-                   rcConstraint, rcViolated );                  \
-FOUND:                                                          \
-        dst [ i ] = to [ j ];                                   \
-    }                                                           \
-                                                                \
-    return 0;                                                   \
-}
-
-TYPE2_BINARY_MAP ( uint16_t, uint8_t )
-TYPE2_BINARY_MAP ( uint16_t, uint16_t )
-TYPE2_BINARY_MAP ( uint16_t, uint32_t )
-TYPE2_BINARY_MAP ( uint16_t, uint64_t )
-
-TYPE2_BINARY_MAP ( uint32_t, uint8_t )
-TYPE2_BINARY_MAP ( uint32_t, uint16_t )
-TYPE2_BINARY_MAP ( uint32_t, uint32_t )
-TYPE2_BINARY_MAP ( uint32_t, uint64_t )
-
-TYPE2_BINARY_MAP ( uint64_t, uint8_t )
-TYPE2_BINARY_MAP ( uint64_t, uint16_t )
-TYPE2_BINARY_MAP ( uint64_t, uint32_t )
-TYPE2_BINARY_MAP ( uint64_t, uint64_t )
-
-TYPE2_BINARY_MAP ( float, uint8_t )
-TYPE2_BINARY_MAP ( float, uint16_t )
-TYPE2_BINARY_MAP ( float, uint32_t )
-TYPE2_BINARY_MAP ( float, uint64_t )
-
-TYPE2_BINARY_MAP ( double, uint8_t )
-TYPE2_BINARY_MAP ( double, uint16_t )
-TYPE2_BINARY_MAP ( double, uint32_t )
-TYPE2_BINARY_MAP ( double, uint64_t )
-
-static VArrayFunc type2_funcs [ 6 ] [ 4 ] =
-{
-    /* uint8_t */
-    {
-        type2_uint8_t_to_uint8_t,
-        type2_uint8_t_to_uint16_t,
-        type2_uint8_t_to_uint32_t,
-        type2_uint8_t_to_uint64_t
-    },
-
-    /* uint16_t */
-    {
-        type2_uint16_t_to_uint8_t,
-        type2_uint16_t_to_uint16_t,
-        type2_uint16_t_to_uint32_t,
-        type2_uint16_t_to_uint64_t
-    },
-
-    /* uint32_t */
-    {
-        type2_uint32_t_to_uint8_t,
-        type2_uint32_t_to_uint16_t,
-        type2_uint32_t_to_uint32_t,
-        type2_uint32_t_to_uint64_t
-    },
-
-    /* uint64_t */
-    {
-        type2_uint64_t_to_uint8_t,
-        type2_uint64_t_to_uint16_t,
-        type2_uint64_t_to_uint32_t,
-        type2_uint64_t_to_uint64_t
-    },
-
-    /* float */
-    {
-        type2_float_to_uint8_t,
-        type2_float_to_uint16_t,
-        type2_float_to_uint32_t,
-        type2_float_to_uint64_t
-    },
-
-    /* double */
-    {
-        type2_double_to_uint8_t,
-        type2_double_to_uint16_t,
-        type2_double_to_uint32_t,
-        type2_double_to_uint64_t
-    }
-};
-
-
-/* type 3: 8-bit to N-bit
- *  allowed to perform a lookup test
- */
-#define TYPE3_8BIT_MAP( DTYPE )                                 \
-static                                                          \
-void type3_uint8_t_to_ ## DTYPE ( const map_t *self,            \
-    void *vdst, const void *vsrc, const void *vtst,             \
-    uint64_t elem_count )                                       \
-{                                                               \
-    const uint8_t *tst = vtst;                                  \
-    const DTYPE *src = vsrc;                                    \
-    DTYPE *dst = vdst;                                          \
-                                                                \
-    const uint8_t *from = self -> from;                         \
-    const DTYPE *to = self -> to;                               \
-                                                                \
-    uint64_t i;                                                 \
-    for ( i = 0; i < elem_count; ++ i )                         \
-    {                                                           \
-        int j = tst [ i ];                                      \
-        dst [ i ] = src [ i ];                                  \
-        if ( from [ j ] )                                       \
-            dst [ i ] = to [ j ];                               \
-    }                                                           \
-}
-
-TYPE3_8BIT_MAP ( uint8_t )
-TYPE3_8BIT_MAP ( uint16_t )
-TYPE3_8BIT_MAP ( uint32_t )
-TYPE3_8BIT_MAP ( uint64_t )
-
-/* type3: binary map
- *  due to the combinatorial explosion,
- *  just implement the binary version
- */
-#define TYPE3_BINARY_MAP( STYPE, DTYPE )                        \
-static                                                          \
-void type3_ ## STYPE ## _to_ ## DTYPE ( const map_t *self,      \
-    void *vdst, const void *vsrc, const void *vtst,             \
-    uint64_t elem_count )                                       \
-{                                                               \
-    const STYPE *tst = vtst;                                    \
-    const DTYPE *src = vsrc;                                    \
-    DTYPE *dst = vdst;                                          \
-                                                                \
-    const STYPE *from = self -> from;                           \
-    const DTYPE *to = self -> to;                               \
-                                                                \
-    uint64_t i;                                                 \
-    for ( i = 0; i < elem_count; ++ i )                         \
-    {                                                           \
-        STYPE elem = tst [ i ];                                 \
-        uint32_t lower = 0, upper = self -> map_len;            \
-                                                                \
-        dst [ i ] = src [ i ];                                  \
-                                                                \
-        while ( lower < upper )                                 \
-        {                                                       \
-            uint32_t j = ( lower + upper ) >> 1;                \
-            STYPE cur = from [ j ];                             \
-            if ( elem == cur )                                  \
-            {                                                   \
-                dst [ i ] = to [ j ];                           \
-                break;                                          \
-            }                                                   \
-            if ( elem < cur )                                   \
-                upper = j;                                      \
-            else                                                \
-                lower = j + 1;                                  \
-        }                                                       \
-    }                                                           \
-}
-
-TYPE3_BINARY_MAP ( uint16_t, uint8_t )
-TYPE3_BINARY_MAP ( uint16_t, uint16_t )
-TYPE3_BINARY_MAP ( uint16_t, uint32_t )
-TYPE3_BINARY_MAP ( uint16_t, uint64_t )
-
-TYPE3_BINARY_MAP ( uint32_t, uint8_t )
-TYPE3_BINARY_MAP ( uint32_t, uint16_t )
-TYPE3_BINARY_MAP ( uint32_t, uint32_t )
-TYPE3_BINARY_MAP ( uint32_t, uint64_t )
-
-TYPE3_BINARY_MAP ( uint64_t, uint8_t )
-TYPE3_BINARY_MAP ( uint64_t, uint16_t )
-TYPE3_BINARY_MAP ( uint64_t, uint32_t )
-TYPE3_BINARY_MAP ( uint64_t, uint64_t )
-
-TYPE3_BINARY_MAP ( float, uint8_t )
-TYPE3_BINARY_MAP ( float, uint16_t )
-TYPE3_BINARY_MAP ( float, uint32_t )
-TYPE3_BINARY_MAP ( float, uint64_t )
-
-TYPE3_BINARY_MAP ( double, uint8_t )
-TYPE3_BINARY_MAP ( double, uint16_t )
-TYPE3_BINARY_MAP ( double, uint32_t )
-TYPE3_BINARY_MAP ( double, uint64_t )
-
-typedef void ( * type3_func ) ( const map_t*, void*, const void*, const void*, uint64_t );
-static type3_func type3_funcs [ 6 ] [ 4 ] =
-{
-    /* uint8_t */
-    {
-        type3_uint8_t_to_uint8_t,
-        type3_uint8_t_to_uint16_t,
-        type3_uint8_t_to_uint32_t,
-        type3_uint8_t_to_uint64_t
-    },
-
-    /* uint16_t */
-    {
-        type3_uint16_t_to_uint8_t,
-        type3_uint16_t_to_uint16_t,
-        type3_uint16_t_to_uint32_t,
-        type3_uint16_t_to_uint64_t
-    },
-
-    /* uint32_t */
-    {
-        type3_uint32_t_to_uint8_t,
-        type3_uint32_t_to_uint16_t,
-        type3_uint32_t_to_uint32_t,
-        type3_uint32_t_to_uint64_t
-    },
-
-    /* uint64_t */
-    {
-        type3_uint64_t_to_uint8_t,
-        type3_uint64_t_to_uint16_t,
-        type3_uint64_t_to_uint32_t,
-        type3_uint64_t_to_uint64_t
-    },
-
-    /* float */
-    {
-        type3_float_to_uint8_t,
-        type3_float_to_uint16_t,
-        type3_float_to_uint32_t,
-        type3_float_to_uint64_t
-    },
-
-    /* double */
-    {
-        type3_double_to_uint8_t,
-        type3_double_to_uint16_t,
-        type3_double_to_uint32_t,
-        type3_double_to_uint64_t
-    }
-};
-
-
-#if _DEBUGGING
-static
-rc_t CC type12_driver ( void *xself, const VXformInfo *info,
-    void *dst, const void *src, uint64_t elem_count )
-{
-    map_t *self = xself;
-    return ( * self -> array ) ( self, info, dst, src, elem_count );
-}
-#endif
-
-static
-rc_t CC type3_driver ( void *xself,
-    const VXformInfo *info, int64_t row_id,
-    const VFixedRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    const map_t *self = ( const void* ) xself;
-
-    /* base pointers to pages */
-    uint8_t *dst = rslt -> base;
-    const uint8_t *tst = argv [ 0 ] . u . data . base;
-    const uint8_t *src = argv [ 1 ] . u . data . base;
-
-    /* offset by bytes to first element of row */
-    dst += ( rslt -> elem_bits * rslt -> first_elem ) >> 3;
-    tst += ( argv [ 0 ] . u . data . elem_bits * argv [ 0 ] . u . data . first_elem ) >> 3;
-    src += ( argv [ 1 ] . u . data . elem_bits * argv [ 1 ] . u . data . first_elem ) >> 3;
-
-    /* invoke function */
-    ( * self -> row ) ( self, dst, src, tst, rslt -> elem_count );
-    return 0;
-}
-
-
-/* make
- *  make a map_t structure
- */
-#define MAKE_8BIT_MAP_T( DTYPE )                                        \
-static                                                                  \
-rc_t make_map_t_uint8_t_to_ ## DTYPE ( map_t **mapp,                    \
-    const void *vfrom, const void *vto, uint32_t map_len )              \
-{                                                                       \
-    uint32_t i;                                                         \
-    uint8_t *tst;                                                       \
-    DTYPE *dto;                                                         \
-    const uint8_t *from = vfrom;                                        \
-    const DTYPE *sto = vto;                                             \
-    map_t *map = calloc ( 1, sizeof * map +                             \
-        ( sizeof * tst + sizeof * dto ) * 256 );                        \
-    if ( map == NULL )                                                  \
-    {                                                                   \
-        return RC ( rcVDB, rcFunction, rcConstructing,                  \
-            rcMemory, rcExhausted );                                    \
-    }                                                                   \
-                                                                        \
-    tst = ( uint8_t* ) ( map + 1 );                                     \
-    dto = ( DTYPE* ) & tst [ 256 ];                                     \
-                                                                        \
-    map -> row = NULL;                                                  \
-    map -> map_len = map_len;                                           \
-    map -> align = 0;                                                   \
-    map -> from = ( void* ) tst;                                        \
-    map -> to = ( void* ) dto;                                          \
-    * mapp = map;                                                       \
-                                                                        \
-    for ( i = 0; i < map_len; ++ i )                                    \
-    {                                                                   \
-        int j = from [ i ];                                             \
-        tst [ j ] = 1;                                                  \
-        dto [ j ] = sto [ i ];                                          \
-    }                                                                   \
-                                                                        \
-    return 0;                                                           \
-}
-
-MAKE_8BIT_MAP_T ( uint8_t )
-MAKE_8BIT_MAP_T ( uint16_t )
-MAKE_8BIT_MAP_T ( uint32_t )
-MAKE_8BIT_MAP_T ( uint64_t )
-
-#define MAP_T_CMP( TYPE )                                               \
-static                                                                  \
-int CC map_t_cmp_ ## TYPE ( const void *a, const void *b, void *data )     \
-{                                                                       \
-    const TYPE *from = ( const TYPE* ) data;                            \
-    int left = * ( const uint16_t* ) a;                                 \
-    int right = * ( const uint16_t* ) b;                                \
-    if ( from [ left ] < from [ right ] )                               \
-        return -1;                                                      \
-    return from [ left ] > from [ right ];                              \
-}
-
-MAP_T_CMP ( uint16_t )
-MAP_T_CMP ( uint32_t )
-MAP_T_CMP ( uint64_t )
-MAP_T_CMP ( float )
-MAP_T_CMP ( double )
-
-#define MAKE_MAP_T( STYPE, DTYPE )                                      \
-static                                                                  \
-rc_t make_map_t_ ## STYPE ## _to_ ## DTYPE ( map_t **mapp,              \
-    const void *vfrom, const void *vto, uint32_t map_len )              \
-{                                                                       \
-    uint32_t i;                                                         \
-    uint16_t buff [ 64 ], *ord = buff;                                  \
-                                                                        \
-    DTYPE *dto;                                                         \
-    STYPE *dfrom;                                                       \
-                                                                        \
-    const STYPE *sfrom = vfrom;                                         \
-    const DTYPE *sto = vto;                                             \
-    map_t *map = malloc ( sizeof * map +                                \
-        ( sizeof * dfrom + sizeof * dto ) * map_len );                  \
-    if ( map == NULL )                                                  \
-    {                                                                   \
-        return RC ( rcVDB, rcFunction, rcConstructing,                  \
-            rcMemory, rcExhausted );                                    \
-    }                                                                   \
-                                                                        \
-    dfrom = ( STYPE* ) ( map + 1 );                                     \
-    dto = ( DTYPE* ) & dfrom [ map_len ];                               \
-                                                                        \
-    map -> row = NULL;                                                  \
-    map -> map_len = map_len;                                           \
-    map -> align = 0;                                                   \
-    map -> from = ( void* ) dfrom;                                      \
-    map -> to = ( void* ) dto;                                          \
-    * mapp = map;                                                       \
-                                                                        \
-    if ( map_len > sizeof buff / sizeof buff [ 0 ] )                    \
-    {                                                                   \
-        assert ( map_len < 0x10000 );                                   \
-        ord = malloc ( sizeof * ord * map_len );                        \
-        if ( ord == NULL )                                              \
-        {                                                               \
-            free ( map );                                               \
-            return RC ( rcVDB, rcFunction, rcConstructing,              \
-                rcMemory, rcExhausted );                                \
-        }                                                               \
-    }                                                                   \
-                                                                        \
-    for ( i = 0; i < map_len; ++ i )                                    \
-        ord [ i ] = ( uint16_t ) i;                                     \
-    ksort ( ord, map_len, sizeof ord [ 0 ],                             \
-        map_t_cmp_ ## STYPE, ( void* ) sfrom );                          \
-                                                                        \
-    for ( i = 0; i < map_len; ++ i )                                    \
-    {                                                                   \
-        int j = ord [ i ];                                              \
-        dfrom [ i ] = sfrom [ j ];                                      \
-        dto [ i ] = sto [ j ];                                          \
-    }                                                                   \
-                                                                        \
-    if ( ord != buff )                                                  \
-        free ( ord );                                                   \
-                                                                        \
-    return 0;                                                           \
-}
-
-MAKE_MAP_T ( uint16_t, uint8_t )
-MAKE_MAP_T ( uint16_t, uint16_t )
-MAKE_MAP_T ( uint16_t, uint32_t )
-MAKE_MAP_T ( uint16_t, uint64_t )
-
-MAKE_MAP_T ( uint32_t, uint8_t )
-MAKE_MAP_T ( uint32_t, uint16_t )
-MAKE_MAP_T ( uint32_t, uint32_t )
-MAKE_MAP_T ( uint32_t, uint64_t )
-
-MAKE_MAP_T ( uint64_t, uint8_t )
-MAKE_MAP_T ( uint64_t, uint16_t )
-MAKE_MAP_T ( uint64_t, uint32_t )
-MAKE_MAP_T ( uint64_t, uint64_t )
-
-MAKE_MAP_T ( float, uint8_t )
-MAKE_MAP_T ( float, uint16_t )
-MAKE_MAP_T ( float, uint32_t )
-MAKE_MAP_T ( float, uint64_t )
-
-MAKE_MAP_T ( double, uint8_t )
-MAKE_MAP_T ( double, uint16_t )
-MAKE_MAP_T ( double, uint32_t )
-MAKE_MAP_T ( double, uint64_t )
-
-
-typedef rc_t ( * make_func ) ( map_t**, const void*, const void*, uint32_t );
-static make_func make_funcs [ 6 ] [ 4 ] =
-{
-    /* uint8_t */
-    {
-        make_map_t_uint8_t_to_uint8_t,
-        make_map_t_uint8_t_to_uint16_t,
-        make_map_t_uint8_t_to_uint32_t,
-        make_map_t_uint8_t_to_uint64_t
-    },
-
-    /* uint16_t */
-    {
-        make_map_t_uint16_t_to_uint8_t,
-        make_map_t_uint16_t_to_uint16_t,
-        make_map_t_uint16_t_to_uint32_t,
-        make_map_t_uint16_t_to_uint64_t
-    },
-
-    /* uint32_t */
-    {
-        make_map_t_uint32_t_to_uint8_t,
-        make_map_t_uint32_t_to_uint16_t,
-        make_map_t_uint32_t_to_uint32_t,
-        make_map_t_uint32_t_to_uint64_t
-    },
-
-    /* uint64_t */
-    {
-        make_map_t_uint64_t_to_uint8_t,
-        make_map_t_uint64_t_to_uint16_t,
-        make_map_t_uint64_t_to_uint32_t,
-        make_map_t_uint64_t_to_uint64_t
-    },
-
-    /* float */
-    {
-        make_map_t_float_to_uint8_t,
-        make_map_t_float_to_uint16_t,
-        make_map_t_float_to_uint32_t,
-        make_map_t_float_to_uint64_t
-    },
-
-    /* double */
-    {
-        make_map_t_double_to_uint8_t,
-        make_map_t_double_to_uint16_t,
-        make_map_t_double_to_uint32_t,
-        make_map_t_double_to_uint64_t
-    }
-};
-
-/* domain_and_size_code
- *  converts sizes 8..64 into 0..3
- *  converts domains into integer or float
- *  combines the two into a single integer
- *  returns -1 if something is simply unsupported
- */
-static
-int domain_and_size_code ( const VTypedesc *desc )
-{
-    int size, type;
-    switch ( desc -> intrinsic_bits )
-    {
-    case 8:
-        size = 0;
-        break;
-    case 16:
-        size = 1;
-        break;
-    case 32:
-        size = 2;
-        break;
-    case 64:
-        size = 3;
-        break;
-    default:
-        return -1;
-    }
-
-    switch ( desc -> domain )
-    {
-    case vtdBool:
-    case vtdUint:
-    case vtdInt:
-        type = 0;
-        break;
-    case vtdFloat:
-        type = 4;
-        break;
-    case vtdAscii:
-    case vtdUnicode:
-        type = 0;
-        break;
-    default:
-        return -1;
-    }
-
-    return type + size;
-}
-
-
-/* map
- *  translate input elements
- *  behaves much like the Unix "tr" command
- *  except that charsets are not [currently] supported
- *
- *  "A" [ TYPE ] - input data type, e.g. "ascii"
- *
- *  "B" [ TYPE ] - output data type, e.g. "ascii" or "U8"
- *
- *  "from" [ CONST ] - set of key values.
- *
- *  "to" [ CONST ] - set of mapped values,
- *  where length ( from ) === length ( to )
- *
- *  "in" [ DATA ] - input data to be matched against keys
- *  in "from". also serves as source data when "src" is omitted
- *
- *  "src" [ DATA, OPTIONAL ] - source data to be edited by
- *  substituting "to" values when corresponding "in" value
- *  matches key in "from". if omitted, "in" is used.
- *
- * USAGE:
- *  to upper case letters from a given alphabet
- *    ascii upper = < ascii, ascii > map < 'acgtn', 'ACGTN' > ( in );
- *
- *  to translate from ascii to binary
- *    U8 bin = < ascii, U8 > map < 'ACGTN', [ 0, 1, 2, 3, 0 ] > ( in );
- *
- *  to alter certain values of a column based upon values in another
- *    U8 n_encoded = < ascii, U8 > map < 'N', 0 > ( read, quality );
- *
- * CAVEATS:
- *  the full canonical mode of operation uses separate inputs
- *  for key matching and output source.
- *
- *  when a single input is specified:
- *   - sizeof ( A ) must equal sizeof ( B )
- *   - A must be a proper subset of B -OR-
- *   - "from" keys must match every possible "in" value ( total substitution )
- */
-static
-rc_t vdb_map_type1_8bit_fact ( VFuncDesc *rslt, const VFactoryParams *cp )
-{
-    rc_t rc = make_type1_uint8_t ( & rslt -> self,
-        cp -> argv [ 0 ] . data . u8,
-        cp -> argv [ 1 ] . data . u8,
-        cp -> argv [ 0 ] . count );
-    if ( rc != 0 )
-        return rc;
-
-    rslt -> whack = free;
-    rslt -> u. af = type1_uint8_t;
-    rslt -> variant = vftArray;
-
-    return 0;
-}
-
-static
-rc_t vdb_map_type1_fact ( VFuncDesc *rslt, const VFactoryParams *cp )
-{
-    rc_t rc;
-    int code;
-    map_t *self;
-
-    /* look for special case of 8-bit to 8-bit mapping */
-    if ( cp -> argv [ 0 ] . desc . intrinsic_bits == 8 )
-        return vdb_map_type1_8bit_fact ( rslt, cp );
-
-    /* determine the domain and size code */
-    code = domain_and_size_code ( & cp -> argv [ 0 ] . desc );
-    if ( code < 0 )
-        return RC ( rcVDB, rcFunction, rcConstructing, rcType, rcUnsupported );
-
-    /* create the object */
-    rc = ( * make_funcs [ code ] [ code & 3 ] )
-        ( & self,
-          cp -> argv [ 0 ] . data . u8,
-          cp -> argv [ 1 ] . data . u8,
-          cp -> argv [ 0 ] . count );
-    if ( rc != 0 )
-        return rc;
-
-    /* 8=>8 can be discounted */
-    -- code;
-
-    /* determine whether it makes sense to perform a binary search */
-    rslt -> u. af = ( cp -> argv [ 0 ] . count < 8 ) ?
-        type1_linear_funcs [ code ] : type1_binary_funcs [ code ];
-    
-    rslt -> self = self;
-    rslt -> whack = free;
-    rslt -> variant = vftArray;
-
-#if _DEBUGGING
-    self -> array = rslt -> u . af;
-    rslt -> u . af = type12_driver;
-#endif
-
-    return 0;
-}
-
-static
-rc_t vdb_map_type2_fact ( VFuncDesc *rslt, const VFactoryParams *cp )
-{
-    rc_t rc;
-    map_t *self;
-    int code1, code2;
-
-    /* determine the domain and size codes */
-    code1 = domain_and_size_code ( & cp -> argv [ 0 ] . desc );
-    code2 = domain_and_size_code ( & cp -> argv [ 1 ] . desc );
-    if ( code1 < 0 ||  code2 < 0 )
-        return RC ( rcVDB, rcFunction, rcConstructing, rcType, rcUnsupported );
-
-    /* create the object */
-    rc = ( * make_funcs [ code1 ] [ code2 & 3 ] )
-        ( & self,
-          cp -> argv [ 0 ] . data . u8,
-          cp -> argv [ 1 ] . data . u8,
-          cp -> argv [ 0 ] . count );
-    if ( rc != 0 )
-        return rc;
-    
-    rslt -> self = self;
-    rslt -> whack = free;
-    rslt -> u. af = type2_funcs [ code1 ] [ code2 & 3 ];
-    rslt -> variant = vftArray;
-
-#if _DEBUGGING
-    self -> array = rslt -> u . af;
-    rslt -> u . af = type12_driver;
-#endif
-
-    return 0;
-}
-
-static
-rc_t vdb_map_type3_fact ( VFuncDesc *rslt, const VFactoryParams *cp )
-{
-    rc_t rc;
-    map_t *self;
-    int code1, code2;
-
-    /* determine the domain and size codes */
-    code1 = domain_and_size_code ( & cp -> argv [ 0 ] . desc );
-    code2 = domain_and_size_code ( & cp -> argv [ 1 ] . desc );
-    if ( code1 < 0 ||  code2 < 0 )
-        return RC ( rcVDB, rcFunction, rcConstructing, rcType, rcUnsupported );
-
-    /* create the object */
-    rc = ( * make_funcs [ code1 ] [ code2 & 3 ] )
-        ( & self,
-          cp -> argv [ 0 ] . data . u8,
-          cp -> argv [ 1 ] . data . u8,
-          cp -> argv [ 0 ] . count );
-    if ( rc != 0 )
-        return rc;
-
-    self -> row = type3_funcs [ code1 ] [ code2 & 3 ];
-    
-    rslt -> self = self;
-    rslt -> whack = free;
-    rslt -> u. pf = type3_driver;
-    rslt -> variant = vftFixedRow;
-
-    return 0;
-}
-
-VTRANSFACT_IMPL ( vdb_map, 1, 0, 0 ) ( const void *ignore, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    /* the compiler has no way of knowing that the map dimensions must match */
-    if ( cp -> argv [ 0 ] . count != cp -> argv [ 1 ] . count )
-        return RC ( rcVDB, rcFunction, rcConstructing, rcConstraint, rcViolated );
-
-    /* the loop type is determined by the number of inputs and input type */
-    if ( dp -> argc == 2 )
-        return vdb_map_type3_fact ( rslt, cp );
-
-    /* since two schema types A and B are given, the compiler has no way
-       of knowing that it should check for a relationship between them */
-    if ( VTypedeclToTypedecl ( & dp -> argv [ 0 ] . fd . td, info -> schema, & info -> fdesc . fd . td, NULL, NULL ) )
-        return vdb_map_type1_fact ( rslt, cp );
-
-    return vdb_map_type2_fact ( rslt, cp );
-}
diff --git a/libs/vxf/math-funcs-impl.h b/libs/vxf/math-funcs-impl.h
deleted file mode 100644
index 8f95e12..0000000
--- a/libs/vxf/math-funcs-impl.h
+++ /dev/null
@@ -1,361 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <compiler.h>
-#include <math.h>
-
-typedef void (*math_f)(void *dst, const void *src, size_t elem_count);
-typedef union self_t {
-    void *vp;
-    math_f f;
-} self_t;
-
-static void F32_to_I8(void *Dst, const void *Src, size_t elem_count) {
-    int8_t *dst = Dst;
-    const float *src = Src;
-    int i;
-    
-    for (i = 0; i != elem_count; ++i)
-        dst[i] = (int8_t)FLOAT_FUNC(src[i]);
-}
-
-static void F32_to_U8(void *Dst, const void *Src, size_t elem_count) {
-    uint8_t *dst = Dst;
-    const float *src = Src;
-    int i;
-    
-    for (i = 0; i != elem_count; ++i)
-        dst[i] = (uint8_t)FLOAT_FUNC(src[i]);
-}
-
-static void F32_to_I16(void *Dst, const void *Src, size_t elem_count) {
-    int16_t *dst = Dst;
-    const float *src = Src;
-    int i;
-    
-    for (i = 0; i != elem_count; ++i)
-        dst[i] = (int16_t)FLOAT_FUNC(src[i]);
-}
-
-static void F32_to_U16(void *Dst, const void *Src, size_t elem_count) {
-    uint16_t *dst = Dst;
-    const float *src = Src;
-    int i;
-    
-    for (i = 0; i != elem_count; ++i)
-        dst[i] = (uint16_t)FLOAT_FUNC(src[i]);
-}
-
-static void F32_to_I32(void *Dst, const void *Src, size_t elem_count) {
-    int32_t *dst = Dst;
-    const float *src = Src;
-    int i;
-    
-    for (i = 0; i != elem_count; ++i)
-        dst[i] = (int32_t)FLOAT_FUNC(src[i]);
-}
-
-static void F32_to_U32(void *Dst, const void *Src, size_t elem_count) {
-    uint32_t *dst = Dst;
-    const float *src = Src;
-    int i;
-    
-    for (i = 0; i != elem_count; ++i)
-        dst[i] = (uint32_t)FLOAT_FUNC(src[i]);
-}
-
-static void F32_to_I64(void *Dst, const void *Src, size_t elem_count) {
-    int64_t *dst = Dst;
-    const float *src = Src;
-    int i;
-    
-    for (i = 0; i != elem_count; ++i)
-        dst[i] = (int64_t)FLOAT_FUNC(src[i]);
-}
-
-static void F32_to_U64(void *Dst, const void *Src, size_t elem_count) {
-    uint64_t *dst = Dst;
-    const float *src = Src;
-    int i;
-    
-    for (i = 0; i != elem_count; ++i)
-        dst[i] = (uint64_t)FLOAT_FUNC(src[i]);
-}
-
-static void F32_to_F32(void *Dst, const void *Src, size_t elem_count) {
-    float *dst = Dst;
-    const float *src = Src;
-    int i;
-    
-    for (i = 0; i != elem_count; ++i)
-        dst[i] = FLOAT_FUNC(src[i]);
-}
-
-static void F32_to_F64(void *Dst, const void *Src, size_t elem_count) {
-    double *dst = Dst;
-    const float *src = Src;
-    int i;
-    
-    for (i = 0; i != elem_count; ++i)
-        dst[i] = FLOAT_FUNC(src[i]);
-}
-
-static void F64_to_I8(void *Dst, const void *Src, size_t elem_count) {
-    int8_t *dst = Dst;
-    const double *src = Src;
-    int i;
-    
-    for (i = 0; i != elem_count; ++i)
-        dst[i] = (int8_t)DOUBLE_FUNC(src[i]);
-}
-
-static void F64_to_U8(void *Dst, const void *Src, size_t elem_count) {
-    uint8_t *dst = Dst;
-    const double *src = Src;
-    int i;
-    
-    for (i = 0; i != elem_count; ++i)
-        dst[i] = (uint8_t)DOUBLE_FUNC(src[i]);
-}
-
-static void F64_to_I16(void *Dst, const void *Src, size_t elem_count) {
-    int16_t *dst = Dst;
-    const double *src = Src;
-    int i;
-    
-    for (i = 0; i != elem_count; ++i)
-        dst[i] = (int16_t)DOUBLE_FUNC(src[i]);
-}
-
-static void F64_to_U16(void *Dst, const void *Src, size_t elem_count) {
-    uint16_t *dst = Dst;
-    const double *src = Src;
-    int i;
-    
-    for (i = 0; i != elem_count; ++i)
-        dst[i] = (uint16_t)DOUBLE_FUNC(src[i]);
-}
-
-static void F64_to_I32(void *Dst, const void *Src, size_t elem_count) {
-    int32_t *dst = Dst;
-    const double *src = Src;
-    int i;
-    
-    for (i = 0; i != elem_count; ++i)
-        dst[i] = (int32_t)DOUBLE_FUNC(src[i]);
-}
-
-static void F64_to_U32(void *Dst, const void *Src, size_t elem_count) {
-    uint32_t *dst = Dst;
-    const double *src = Src;
-    int i;
-    
-    for (i = 0; i != elem_count; ++i)
-        dst[i] = (uint32_t)DOUBLE_FUNC(src[i]);
-}
-
-static void F64_to_I64(void *Dst, const void *Src, size_t elem_count) {
-    int64_t *dst = Dst;
-    const double *src = Src;
-    int i;
-    
-    for (i = 0; i != elem_count; ++i)
-        dst[i] = (int64_t)DOUBLE_FUNC(src[i]);
-}
-
-static void F64_to_U64(void *Dst, const void *Src, size_t elem_count) {
-    uint64_t *dst = Dst;
-    const double *src = Src;
-    int i;
-    
-    for (i = 0; i != elem_count; ++i)
-        dst[i] = (uint64_t)DOUBLE_FUNC(src[i]);
-}
-
-static void F64_to_F32(void *Dst, const void *Src, size_t elem_count) {
-    float *dst = Dst;
-    const double *src = Src;
-    int i;
-    
-    for (i = 0; i != elem_count; ++i)
-        dst[i] = (float)DOUBLE_FUNC(src[i]);
-}
-
-static void F64_to_F64(void *Dst, const void *Src, size_t elem_count) {
-    double *dst = Dst;
-    const double *src = Src;
-    int i;
-    
-    for (i = 0; i != elem_count; ++i)
-        dst[i] = DOUBLE_FUNC(src[i]);
-}
-
-static
-rc_t CC array_func(
-                void *Self,
-                const VXformInfo *info,
-                void *dst,
-                const void *src,
-                uint64_t num_elements
-                )
-{
-    self_t hack;
-
-    hack.vp = Self;
-    hack.f(dst, src, ( size_t ) num_elements);
-    return 0;
-}
-
-static rc_t factory( const void *self, const VXfactInfo *info, 
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    VTypedesc src_desc;
-    rc_t rc;
-    self_t hack;
-
-    rc = VSchemaDescribeTypedecl(info->schema, &src_desc, &dp->argv[0].fd.td);
-    if (rc)
-        return rc;
-    
-    rslt->variant = vftArray;
-    rslt->u.af = array_func;
-    
-    switch (src_desc.intrinsic_bits) {
-    case 32:
-        switch (info->fdesc.desc.domain) {
-        case vtdInt:
-            switch (info->fdesc.desc.intrinsic_bits) {
-            case 8:
-                hack.f = F32_to_I8;
-                break;
-            case 16:
-                hack.f = F32_to_I16;
-                break;
-            case 32:
-                hack.f = F32_to_I32;
-                break;
-            case 64:
-                hack.f = F32_to_I64;
-                break;
-            default:
-                return RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-            }
-            break;
-        case vtdUint:
-            switch (info->fdesc.desc.intrinsic_bits) {
-            case 8:
-                hack.f = F32_to_U8;
-                break;
-            case 16:
-                hack.f = F32_to_U16;
-                break;
-            case 32:
-                hack.f = F32_to_U32;
-                break;
-            case 64:
-                hack.f = F32_to_U64;
-                break;
-            default:
-                return RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-            }
-            break;
-        case vtdFloat:
-            switch (info->fdesc.desc.intrinsic_bits) {
-            case 32:
-                hack.f = F32_to_F32;
-                break;
-            case 64:
-                hack.f = F32_to_F64;
-                break;
-            default:
-                return RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-            }
-            break;
-        default:
-            return RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-        }
-        break;
-    case 64:
-        switch (info->fdesc.desc.domain) {
-        case vtdInt:
-            switch (info->fdesc.desc.intrinsic_bits) {
-            case 8:
-                hack.f = F64_to_I8;
-                break;
-            case 16:
-                hack.f = F64_to_I16;
-                break;
-            case 32:
-                hack.f = F64_to_I32;
-                break;
-            case 64:
-                hack.f = F64_to_I64;
-                break;
-            default:
-                return RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-            }
-            break;
-        case vtdUint:
-            switch (info->fdesc.desc.intrinsic_bits) {
-            case 8:
-                hack.f = F64_to_U8;
-                break;
-            case 16:
-                hack.f = F64_to_U16;
-                break;
-            case 32:
-                hack.f = F64_to_U32;
-                break;
-            case 64:
-                hack.f = F64_to_U64;
-                break;
-            default:
-                return RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-            }
-            break;
-        case vtdFloat:
-            switch (info->fdesc.desc.intrinsic_bits) {
-            case 32:
-                hack.f = F64_to_F32;
-                break;
-            case 64:
-                hack.f = F64_to_F64;
-                break;
-            default:
-                return RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-            }
-            break;
-        default:
-            return RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-        }
-        break;
-    default:
-        return RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-    }
-    rslt->self = hack.vp;
-    return 0;
-}
-
diff --git a/libs/vxf/max.c b/libs/vxf/max.c
deleted file mode 100644
index c941468..0000000
--- a/libs/vxf/max.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef void (*func_t)(void *, const void *, const void *, uint64_t);
-
-typedef struct self_t {
-    func_t f;
-} self_t;
-
-#define FUNC(VALTYPE) F_ ## VALTYPE
-
-#define FUNC_DEF(VALTYPE) \
-static void FUNC(VALTYPE)(void *Dst, const void *A, const void *B, uint64_t n) { \
-    VALTYPE *dst = (VALTYPE *)Dst; \
-    const VALTYPE *a = (const VALTYPE *)A; \
-    const VALTYPE *b = (const VALTYPE *)B; \
-    uint64_t i; \
-    \
-    for (i = 0; i != n; ++i) \
-        dst[i] = b[i] < a[i] ? a[i] : b[i]; \
-}
-
-FUNC_DEF(float)
-FUNC_DEF(double)
-FUNC_DEF(uint8_t)
-FUNC_DEF(uint16_t)
-FUNC_DEF(uint32_t)
-FUNC_DEF(uint64_t)
-FUNC_DEF(int8_t)
-FUNC_DEF(int16_t)
-FUNC_DEF(int32_t)
-FUNC_DEF(int64_t)
-
-static
-rc_t CC fixed_row_func(
-                      void *Self,
-                      const VXformInfo *info,
-                      int64_t row_id,
-                      const VFixedRowResult *rslt,
-                      uint32_t argc,
-                      const VRowData argv[]
-) {
-    const self_t *self = Self;
-
-    /* base pointers to pages */
-    uint8_t *dst = rslt -> base;
-    const uint8_t *a = argv [ 0 ] . u . data . base;
-    const uint8_t *b = argv [ 1 ] . u . data . base;
-
-    /* offset by bytes to first element of row */
-    dst += ( rslt -> elem_bits * rslt -> first_elem ) >> 3;
-    a += ( argv [ 0 ] . u . data . elem_bits * argv [ 0 ] . u . data . first_elem ) >> 3;
-    b += ( argv [ 1 ] . u . data . elem_bits * argv [ 1 ] . u . data . first_elem ) >> 3;
-
-    self -> f ( dst, a, b, rslt -> elem_count );
-    return 0;
-}
-
-static
-void CC vxf_max_wrapper( void *ptr )
-{
-	free( ptr );
-}
-
-/* 
- */
-VTRANSFACT_IMPL(vdb_max, 1, 0, 0) (const void *Self, const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rc_t rc = 0;
-    self_t *self;
-
-	self = malloc(sizeof(self_t));
-    if (self == NULL)
-        return RC(rcVDB, rcFunction, rcConstructing, rcMemory, rcExhausted);
-        
-    rslt->self = self;
-    rslt->whack = vxf_max_wrapper;
-    rslt->variant = vftFixedRow;
-    rslt->u.pf = fixed_row_func;
-
-    switch (info->fdesc.desc.intrinsic_bits) {
-    case 8:
-        switch (info->fdesc.desc.domain) {
-        case vtdInt:
-            self->f = FUNC(int8_t);
-            break;
-        case vtdUint:
-            self->f = FUNC(uint8_t);
-            break;
-        default:
-            rc = RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-        }
-        break;
-    case 16:
-        switch (info->fdesc.desc.domain) {
-        case vtdInt:
-            self->f = FUNC(int16_t);
-            break;
-        case vtdUint:
-            self->f = FUNC(uint16_t);
-            break;
-        default:
-            rc = RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-        }
-        break;
-    case 32:
-        switch (info->fdesc.desc.domain) {
-        case vtdInt:
-            self->f = FUNC(int32_t);
-            break;
-        case vtdUint:
-            self->f = FUNC(uint32_t);
-            break;
-        case vtdFloat:
-            self->f = FUNC(float);
-            break;
-        default:
-            rc = RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-        }
-        break;
-    case 64:
-        switch (info->fdesc.desc.domain) {
-        case vtdInt:
-            self->f = FUNC(int64_t);
-            break;
-        case vtdUint:
-            self->f = FUNC(uint64_t);
-            break;
-        case vtdFloat:
-            self->f = FUNC(double);
-            break;
-        default:
-            rc = RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-        }
-        break;
-    default:
-        rc = RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-    }
-
-    if (rc)
-        free(self);
-    return rc;
-}
diff --git a/libs/vxf/min.c b/libs/vxf/min.c
deleted file mode 100644
index b7e209c..0000000
--- a/libs/vxf/min.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef void (*func_t)(void *, const void *, const void *, uint64_t);
-
-typedef struct self_t {
-    func_t f;
-} self_t;
-
-#define FUNC(VALTYPE) F_ ## VALTYPE
-
-#define FUNC_DEF(VALTYPE) \
-static void FUNC(VALTYPE)(void *Dst, const void *A, const void *B, uint64_t n) { \
-    VALTYPE *dst = (VALTYPE *)Dst; \
-    const VALTYPE *a = (const VALTYPE *)A; \
-    const VALTYPE *b = (const VALTYPE *)B; \
-    uint64_t i; \
-    \
-    for (i = 0; i != n; ++i) \
-        dst[i] = a[i] < b[i] ? a[i] : b[i]; \
-}
-
-FUNC_DEF(float)
-FUNC_DEF(double)
-FUNC_DEF(uint8_t)
-FUNC_DEF(uint16_t)
-FUNC_DEF(uint32_t)
-FUNC_DEF(uint64_t)
-FUNC_DEF(int8_t)
-FUNC_DEF(int16_t)
-FUNC_DEF(int32_t)
-FUNC_DEF(int64_t)
-
-static
-rc_t CC fixed_row_func(
-                      void *Self,
-                      const VXformInfo *info,
-                      int64_t row_id,
-                      const VFixedRowResult *rslt,
-                      uint32_t argc,
-                      const VRowData argv[]
-) {
-    const self_t *self = Self;
-
-    /* base pointers to pages */
-    uint8_t *dst = rslt -> base;
-    const uint8_t *a = argv [ 0 ] . u . data . base;
-    const uint8_t *b = argv [ 1 ] . u . data . base;
-
-    /* offset by bytes to first element of row */
-    dst += ( rslt -> elem_bits * rslt -> first_elem ) >> 3;
-    a += ( argv [ 0 ] . u . data . elem_bits * argv [ 0 ] . u . data . first_elem ) >> 3;
-    b += ( argv [ 1 ] . u . data . elem_bits * argv [ 1 ] . u . data . first_elem ) >> 3;
-    
-    self -> f ( dst, a, b, rslt -> elem_count );
-    return 0;
-}
-
-static
-void CC vxf_min_wrapper( void *ptr )
-{
-	free( ptr );
-}
-
-/* 
- */
-VTRANSFACT_IMPL(vdb_min, 1, 0, 0) (const void *Self, const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rc_t rc = 0;
-    self_t *self;
-
-	self = malloc(sizeof(self_t));
-    if (self == NULL)
-        return RC(rcVDB, rcFunction, rcConstructing, rcMemory, rcExhausted);
-        
-    rslt->self = self;
-    rslt->whack = vxf_min_wrapper;
-    rslt->variant = vftFixedRow;
-    rslt->u.pf = fixed_row_func;
-
-    switch (info->fdesc.desc.intrinsic_bits) {
-    case 8:
-        switch (info->fdesc.desc.domain) {
-        case vtdInt:
-            self->f = FUNC(int8_t);
-            break;
-        case vtdUint:
-            self->f = FUNC(uint8_t);
-            break;
-        default:
-            rc = RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-        }
-        break;
-    case 16:
-        switch (info->fdesc.desc.domain) {
-        case vtdInt:
-            self->f = FUNC(int16_t);
-            break;
-        case vtdUint:
-            self->f = FUNC(uint16_t);
-            break;
-        default:
-            rc = RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-        }
-        break;
-    case 32:
-        switch (info->fdesc.desc.domain) {
-        case vtdInt:
-            self->f = FUNC(int32_t);
-            break;
-        case vtdUint:
-            self->f = FUNC(uint32_t);
-            break;
-        case vtdFloat:
-            self->f = FUNC(float);
-            break;
-        default:
-            rc = RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-        }
-        break;
-    case 64:
-        switch (info->fdesc.desc.domain) {
-        case vtdInt:
-            self->f = FUNC(int64_t);
-            break;
-        case vtdUint:
-            self->f = FUNC(uint64_t);
-            break;
-        case vtdFloat:
-            self->f = FUNC(double);
-            break;
-        default:
-            rc = RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-        }
-        break;
-    default:
-        rc = RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-    }
-
-    if (rc)
-        free(self);
-    return rc;
-}
diff --git a/libs/vxf/outlier-decoder.c b/libs/vxf/outlier-decoder.c
deleted file mode 100644
index 19e2ee2..0000000
--- a/libs/vxf/outlier-decoder.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <klib/data-buffer.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <sysalloc.h>
-
-#include <bitstr.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-
-#define DECODER_NAME(T) outlier_encode_ ## T
-#define DECODER(T) static rc_t CC DECODER_NAME(T) (void *self, const VXformInfo *info, void *Dst, const void *Src, uint64_t elem_count) \
-{ \
-    T *dst = (T *)Dst; \
-    T const *src = (T const *)Src; \
-    T const outlier = *(T const *)self; \
-    uint64_t i; \
-    for (i = 0; i != elem_count; ++i) { \
-        T const y = src[i]; \
-        if (y & 1) \
-            dst[i] = outlier; \
-        else \
-            dst[i] = y >> 1; \
-    } \
-    return 0; \
-}
-
-DECODER(uint8_t)
-DECODER(uint16_t)
-DECODER(uint32_t)
-DECODER(uint64_t)
-
-/*
- function < type T > T outlier_decode #1.0 < T outlier > ( T y );
- */
-
-VTRANSFACT_IMPL ( vdb_outlier_decode, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-                                                 VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rc_t rc;
-    void *self;
-    
-    if (info->fdesc.desc.domain != vtdInt || cp->argv[0].count != 1)
-        return RC(rcXF, rcFunction, rcConstructing, rcType, rcIncorrect);
-        
-        switch (VTypedescSizeof(&cp->argv[0].desc)) {
-        case 8:
-        case 16:
-        case 32:
-        case 64:
-            break;
-        default:
-            return RC(rcXF, rcFunction, rcConstructing, rcType, rcIncorrect);
-            break;
-        }
-    
-    self = malloc(sizeof(uint64_t));
-    if (self == NULL)
-        return RC(rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted);
-        
-        switch (VTypedescSizeof(&cp->argv[0].desc)) {
-        case 8:
-            *(uint8_t *)self = cp->argv[0].data.u8[0];
-            rslt->u.af = DECODER_NAME(uint8_t);
-            break;
-        case 16:
-            *(uint16_t *)self = cp->argv[0].data.u16[0];
-            rslt->u.af = DECODER_NAME(uint16_t);
-            break;
-        case 32:
-            *(uint32_t *)self = cp->argv[0].data.u32[0];
-            rslt->u.af = DECODER_NAME(uint32_t);
-            break;
-        case 64:
-            *(uint64_t *)self = cp->argv[0].data.u64[0];
-            rslt->u.af = DECODER_NAME(uint64_t);
-            break;
-        default:
-            break;
-        }
-    rslt->self = self;
-    rslt->whack = free;
-    rslt->variant = vftArray;
-    return 0;
-}
diff --git a/libs/vxf/outlier-encoder.c b/libs/vxf/outlier-encoder.c
deleted file mode 100644
index 6720044..0000000
--- a/libs/vxf/outlier-encoder.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <klib/data-buffer.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <sysalloc.h>
-
-#include <bitstr.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-
-#define ENCODER_NAME(T) outlier_encode_ ## T
-#define ENCODER(T) static rc_t CC ENCODER_NAME(T) (void *self, const VXformInfo *info, void *Dst, const void *Src, uint64_t elem_count) \
-{ \
-    T *dst = (T *)Dst; \
-    T const *src = (T const *)Src; \
-    T last = 1; \
-    T const outlier = *(T const *)self; \
-    uint64_t i; \
-    for (i = 0; i != elem_count; ++i) { \
-        T const y = src[i]; \
-        if ((((T)(y << 1)) >> 1) != y) \
-            return RC(rcXF, rcFunction, rcExecuting, rcConstraint, rcViolated); \
-        if (y == outlier) \
-            dst[i] = last; \
-        else \
-            last = (dst[i] = y << 1) | 1; \
-    } \
-    return 0; \
-}
-
-extern void Debugger(void);
-
-ENCODER(uint8_t)
-ENCODER(uint16_t)
-ENCODER(uint32_t)
-#if 1
-ENCODER(uint64_t)
-#else
-static rc_t CC outlier_encode_uint64_t (void *self, const VXformInfo *info, void *Dst, const void *Src, uint64_t elem_count)
-{
-    typedef uint64_t T;
-    T *dst = (T *)Dst;
-    T const *src = (T const *)Src;
-    T last = 1;
-    T const outlier = *(T const *)self;
-    uint64_t i;
-
-    for (i = 0; i != elem_count; ++i) {
-        T const y = src[i];
-        if ((((T)(y << 1)) >> 1) != y)
-            return RC(rcXF, rcFunction, rcExecuting, rcConstraint, rcViolated);
-        if (y == outlier)
-            dst[i] = last;
-        else
-            last = (dst[i] = y << 1) | 1;
-    }
-    return 0;
-}
-#endif
-
-/*
- function < type T > T outlier_encode #1.0 < T outlier > ( T y );
- */
-
-VTRANSFACT_IMPL ( vdb_outlier_encode, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rc_t rc;
-    void *self;
-
-    if (info->fdesc.desc.domain != vtdInt || cp->argv[0].count != 1)
-        return RC(rcXF, rcFunction, rcConstructing, rcType, rcIncorrect);
-
-    switch (VTypedescSizeof(&cp->argv[0].desc)) {
-    case 8:
-    case 16:
-    case 32:
-    case 64:
-        break;
-    default:
-        return RC(rcXF, rcFunction, rcConstructing, rcType, rcIncorrect);
-        break;
-    }
-    
-    self = malloc(sizeof(uint64_t));
-    if (self == NULL)
-        return RC(rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted);
-    
-    switch (VTypedescSizeof(&cp->argv[0].desc)) {
-    case 8:
-        *(uint8_t *)self = cp->argv[0].data.u8[0];
-        rslt->u.af = ENCODER_NAME(uint8_t);
-        break;
-    case 16:
-        *(uint16_t *)self = cp->argv[0].data.u16[0];
-        rslt->u.af = ENCODER_NAME(uint16_t);
-        break;
-    case 32:
-        *(uint32_t *)self = cp->argv[0].data.u32[0];
-        rslt->u.af = ENCODER_NAME(uint32_t);
-        break;
-    case 64:
-        *(uint64_t *)self = cp->argv[0].data.u64[0];
-        rslt->u.af = ENCODER_NAME(uint64_t);
-        break;
-    default:
-        break;
-    }
-    rslt->self = self;
-    rslt->whack = free;
-    rslt->variant = vftArray;
-    return 0;
-}
diff --git a/libs/vxf/pack.c b/libs/vxf/pack.c
deleted file mode 100644
index 27b9bae..0000000
--- a/libs/vxf/pack.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <sysalloc.h>
-
-#include <klib/pack.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-
-
-typedef struct self_t {
-    VTypedesc sdesc;
-    uint32_t dbits;
-} self_t;
-
-static
-rc_t CC pack_func(
-               void *Self,
-               const VXformInfo *info,
-               void *dst,
-               const void *src,
-               uint64_t elem_count
-) {
-    const self_t *self = Self;
-    bitsz_t psize;
-    
-    return Pack(
-                self->sdesc.intrinsic_bits, self->dbits,
-                src, (elem_count * self->sdesc.intrinsic_dim * self->sdesc.intrinsic_bits) >> 3, 0,
-                dst, 0, elem_count * self->sdesc.intrinsic_dim * self->dbits, &psize
-               );
-}
-
-static
-void CC vxf_pack_wrapper( void *ptr )
-{
-	free( ptr );
-}
-
-/* 
- */
-VTRANSFACT_IMPL(vdb_pack, 1, 0, 0) (const void *Self, const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rc_t rc = 0;
-    self_t *self;
-
-    self = malloc(sizeof(self_t));
-    if (self) {
-        self->dbits = info->fdesc.desc.intrinsic_dim;
-
-        assert (dp->argc == 1);
-        self->sdesc = dp->argv[0].desc;
-        
-        rslt->self = self;
-        rslt->whack = vxf_pack_wrapper;
-
-        rslt->variant = vftArray;
-        rslt->u.af = pack_func;
-    }
-    else
-        rc = RC(rcVDB, rcFunction, rcConstructing, rcMemory, rcExhausted);
-    return rc;
-}
diff --git a/libs/vxf/paste.c b/libs/vxf/paste.c
deleted file mode 100644
index 6dd4b1a..0000000
--- a/libs/vxf/paste.c
+++ /dev/null
@@ -1,357 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <klib/data-buffer.h>
-#include <klib/rc.h>
-#include <bitstr.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-typedef struct pastie pastie;
-struct pastie
-{
-    struct
-    {
-        union
-        {
-            void *u1;
-            uint8_t *u8;
-            uint16_t *u16;
-            uint32_t *u32;
-            uint64_t *u64;
-        } u;
-        bitsz_t off;
-
-    } dst;
-    struct
-    {
-        union
-        {
-            const void *u1;
-            const uint8_t *u8;
-            const uint16_t *u16;
-            const uint32_t *u32;
-            const uint64_t *u64;
-        } u;
-        bitsz_t off, len;
-
-    } src [ 16 ];
-};
-
-static
-rc_t CC paste_func1 ( void *data, const VXformInfo *info, int64_t row_id,
-    const VFixedRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc = 0;
-    pastie *self = data;
-    uint32_t i, j, row_len = (uint32_t)rslt -> elem_count;
-
-    assert(rslt -> elem_count >> 32 == 0);
-    /* populate "self" */
-    self -> dst . u . u1 = rslt -> base;
-    self -> dst . off = ((uint64_t)rslt -> first_elem) * rslt -> elem_bits;
-    for ( j = 0; j < argc; ++ j )
-    {
-        self -> src [ j ] . u . u1 = argv [ j ] . u . data .base;
-        self -> src [ j ] . off = ((uint64_t)argv [ j ] . u . data .first_elem) * argv [ j ] . u . data .elem_bits;
-        self -> src [ j ] . len = argv [ j ] . u . data .elem_bits;
-    }
-
-    /* create output row */
-    for ( i = 0; i < row_len; ++ i )
-    {
-        for ( j = 0; j < argc; ++ j )
-        {
-            uint32_t k = (uint32_t)self -> src [ j ] . len;
-            assert(self -> src [ j ] . len >> 32 == 0);
-            bitcpy ( self -> dst . u . u1, self -> dst . off,
-                     self -> src [ j ] . u . u1, self -> src [ j ] . off, k );
-            self -> dst . off += k;
-            self -> src [ j ] . off += k;
-        }
-    }
-    return rc;
-}
-
-static
-rc_t CC paste_func8 ( void *data, const VXformInfo *info, int64_t row_id,
-    const VFixedRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc = 0;
-    pastie *self = data;
-    uint32_t i, j, row_len = (uint32_t)rslt -> elem_count;
-    
-    assert(rslt -> elem_count >> 32 == 0);
-    /* populate "self" */
-    self -> dst . u . u8 = rslt -> base;
-    self -> dst . off = ((uint64_t)rslt -> first_elem) * (rslt -> elem_bits>>3);
-    for ( j = 0; j < argc; ++ j )
-    {
-        self -> src [ j ] . u . u8 = argv [ j ] . u . data .base;
-        self -> src [ j ] . off = ((uint64_t)argv [ j ] . u . data .first_elem) * (argv [ j ] . u . data .elem_bits >> 3);
-        self -> src [ j ] . len = argv [ j ] . u . data .elem_bits >> 3;
-    }
-
-    /* create output row */
-    for ( i = 0; i < row_len; ++ i )
-    {
-        for ( j = 0; j < argc; ++ j )
-        {
-            uint32_t k;
-            for ( k = 0; k < self -> src [ j ] . len; ++ k )
-            {
-                self -> dst . u . u8 [ self -> dst . off + k ] =
-                    self -> src [ j ] . u . u8 [ self -> src [ j ] . off + k ];
-            }
-
-            self -> dst . off += k;
-            self -> src [ j ] . off += k;
-        }
-    }
-    return rc;
-}
-
-static
-rc_t CC paste_func16 ( void *data, const VXformInfo *info, int64_t row_id,
-    const VFixedRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc = 0;
-    pastie *self = data;
-    uint32_t i, j, row_len = (uint32_t)rslt -> elem_count;
-    
-    assert(rslt -> elem_count >> 32 == 0);
-    /* populate "self" */
-    self -> dst . u . u16 = rslt -> base;
-    self -> dst . off = ((uint64_t)rslt -> first_elem) * (rslt -> elem_bits>>4);
-    for ( j = 0; j < argc; ++ j )
-    {
-        self -> src [ j ] . u . u16 = argv [ j ] . u . data .base;
-        self -> src [ j ] . off = ((uint64_t)argv [ j ] . u . data .first_elem) * (argv [ j ] . u . data .elem_bits >> 4);
-        self -> src [ j ] . len = argv [ j ] . u . data .elem_bits >> 4;
-    }
-
-    /* create output row */
-    for ( i = 0; i < row_len; ++ i )
-    {
-        for ( j = 0; j < argc; ++ j )
-        {
-            uint32_t k;
-            for ( k = 0; k < self -> src [ j ] . len; ++ k )
-            {
-                self -> dst . u . u16 [ self -> dst . off + k ] =
-                    self -> src [ j ] . u . u16 [ self -> src [ j ] . off + k ];
-            }
-
-            self -> dst . off += k;
-            self -> src [ j ] . off += k;
-        }
-    }
-    return rc;
-}
-
-static
-rc_t CC paste_func32 ( void *data, const VXformInfo *info, int64_t row_id,
-    const VFixedRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc = 0;
-    pastie *self = data;
-    uint32_t i, j, row_len = (uint32_t)rslt -> elem_count;
-    
-    assert(rslt -> elem_count >> 32 == 0);
-    /* populate "self" */
-    self -> dst . u . u32 = rslt -> base;
-    self -> dst . off = ((uint64_t)rslt -> first_elem) * (rslt -> elem_bits>>5);
-    for ( j = 0; j < argc; ++ j )
-    {
-        self -> src [ j ] . u . u32 = argv [ j ] . u . data .base;
-        self -> src [ j ] . off = ((uint64_t)argv [ j ] . u . data .first_elem) * (argv [ j ] . u . data .elem_bits >> 5);
-        self -> src [ j ] . len = argv [ j ] . u . data .elem_bits >> 5;
-    }
-
-    /* create output row */
-    for ( i = 0; i < row_len; ++ i )
-    {
-        for ( j = 0; j < argc; ++ j )
-        {
-            uint32_t k;
-            for ( k = 0; k < self -> src [ j ] . len; ++ k )
-            {
-                self -> dst . u . u32 [ self -> dst . off + k ] =
-                    self -> src [ j ] . u . u32 [ self -> src [ j ] . off + k ];
-            }
-
-            self -> dst . off += k;
-            self -> src [ j ] . off += k;
-        }
-    }
-    return rc;
-}
-
-static
-rc_t CC paste_func64 ( void *data, const VXformInfo *info, int64_t row_id,
-    const VFixedRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc = 0;
-    pastie *self = data;
-    uint32_t i, j, row_len = (uint32_t)rslt -> elem_count;
-    
-    assert(rslt -> elem_count >> 32 == 0);
-    /* populate "self" */
-    self -> dst . u . u64 = rslt -> base;
-    self -> dst . off = ((uint64_t)rslt -> first_elem) * (rslt -> elem_bits>>6);
-    for ( j = 0; j < argc; ++ j )
-    {
-        self -> src [ j ] . u . u64 = argv [ j ] . u . data .base;
-        self -> src [ j ] . off = ((uint64_t)argv [ j ] . u . data .first_elem) * (argv [ j ] . u . data .elem_bits >> 6);
-        self -> src [ j ] . len = argv [ j ] . u . data .elem_bits >> 6;
-    }
-
-    /* create output row */
-    for ( i = 0; i < row_len; ++ i )
-    {
-        for ( j = 0; j < argc; ++ j )
-        {
-            uint32_t k;
-            for ( k = 0; k < self -> src [ j ] . len; ++ k )
-            {
-                self -> dst . u . u64 [ self -> dst . off + k ] =
-                    self -> src [ j ] . u . u64 [ self -> src [ j ] . off + k ];
-            }
-
-            self -> dst . off += k;
-            self -> src [ j ] . off += k;
-        }
-    }
-    return rc;
-}
-
-static
-void CC vxf_paste_wrapper( void *ptr )
-{
-	free( ptr );
-}
-
-#include <stdio.h>
-
-/* paste
- * function < type T > T [ * ] paste #1.0 ( T [ * ] in, ... );
- * function any NCBI:paste #1.0 ( any in, ... );
- */
-VTRANSFACT_IMPL ( vdb_paste, 1, 0, 0 ) ( const void *self,
-    const VXfactInfo *info, VFuncDesc *rslt,
-    const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    pastie *fself;
-    uint32_t rtn_bits, min_gcd;
-
-    /* in the case of the modern "paste", the compiler is able to
-       enforce only the function signature, but not the essential
-       requirement that the output dimension equal the sum of all
-       input dimensions. in the case of "NCBI:paste", the compiler
-       cannot enforce anything, so we check for inputs that have
-       the same domain and intrinsic type-size, already guaranteed
-       by the type-checked version. */
-    uint32_t i, sum;
-    for ( i = sum = 0; i < dp -> argc; ++ i )
-    {
-        assert ( dp -> argv [ i ] . fd . td . dim != 0 );
-
-        /* handle type-checking for NCBI:paste */
-        if ( dp -> argv [ i ] . desc . domain != info -> fdesc . desc . domain ||
-             dp -> argv [ i ] . desc . intrinsic_bits != info -> fdesc . desc . intrinsic_bits )
-        {
-            return RC ( rcXF, rcFunction, rcConstructing, rcType, rcIncorrect );
-        }
-
-        sum += dp -> argv [ i ] . desc . intrinsic_dim;
-    }
-
-    assert ( info -> fdesc . fd . td . dim != 0 );
-    if ( sum > info -> fdesc . desc . intrinsic_dim )
-        return RC ( rcXF, rcFunction, rcConstructing, rcArgv, rcExcessive );
-
-    if ( sum < info -> fdesc . desc . intrinsic_dim )
-        return RC ( rcXF, rcFunction, rcConstructing, rcArgv, rcInsufficient );
-
-    /* allocate self */
-    fself = malloc ( sizeof * fself - sizeof fself -> src + sizeof fself -> src [ 0 ] * dp -> argc );
-    if ( fself == NULL )
-        return RC ( rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted );
-
-    /* we can create the function */
-    rslt -> self = fself;
-    rslt -> whack = vxf_paste_wrapper;
-    rslt -> variant = vftFixedRow;
-
-    /* the output dimension == sum ( dimension ) for all inputs
-       each input dimension will have a GCD of sizeof ( element ) * N
-       for N = 1 .. output dimension. the minimum of these will determine
-       the common copy word size */
-    rtn_bits = VTypedescSizeof ( & info -> fdesc . desc );
-    for ( min_gcd = rtn_bits, i = 0; i < dp -> argc; ++ i )
-    {
-        uint32_t gcd, a, b = VTypedescSizeof ( & dp -> argv [ i ] . desc );
-        for ( a = rtn_bits; ; )
-        {
-            if ( b == 0 )
-            {
-                gcd = a;
-                break;
-            }
-
-            a %= b;
-            if ( a == 0 )
-            {
-                gcd = b;
-                break;
-            }
-
-            b %= a;
-        }
-
-        if ( gcd < min_gcd )
-            min_gcd = gcd;
-    }
-
-    /* select the copy word size */
-    if ( ( min_gcd & 63 ) == 0 )
-        rslt -> u . pf = paste_func64;
-    else if ( ( min_gcd & 31 ) == 0 )
-        rslt -> u . pf = paste_func32;
-    else if ( ( min_gcd & 15 ) == 0 )
-        rslt -> u . pf = paste_func16;
-    else if ( ( min_gcd & 7 ) == 0 )
-        rslt -> u . pf = paste_func8;
-    else
-        rslt -> u . pf = paste_func1;
-
-    return 0;
-}
diff --git a/libs/vxf/rand_4na_2na.c b/libs/vxf/rand_4na_2na.c
deleted file mode 100644
index e8feaac..0000000
--- a/libs/vxf/rand_4na_2na.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-#include <vdb/xform.h>
-#include <arch-impl.h>
-#include <klib/rc.h>
-#include <klib/data-buffer.h>
-#include <sysalloc.h>
-#include <time.h>
-
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-#if 1
-static struct {
-	uint8_t num_bits;
-	uint8_t val[4];
-} map[16] = {
-
-#if WE_SECRETLY_MEANT_4NA_BY_2NA
-#define A 1
-#define C 2
-#define G 4
-#define T 8
-#else
-#define A 0
-#define C 1
-#define G 2
-#define T 3
-#endif
-/*0000*/{4,{A,C,G,T}}, 
-/*0001*/{1,{A}},
-/*0010*/{1,{C}},
-/*0011*/{2,{A,C}},
-/*0100*/{1,{G}},
-/*0101*/{2,{A,G}},
-/*0110*/{2,{C,G}},
-/*0111*/{3,{A,C,G}},
-/*1000*/{1,{T}},
-/*1001*/{2,{A,T}},
-/*1010*/{2,{C,T}},
-/*1011*/{3,{A,C,T}},
-/*1100*/{2,{G,T}},
-/*1101*/{3,{A,G,T}},
-/*1110*/{3,{C,G,T}},
-/*1111*/{4,{A,C,G,T}}
-#undef A
-#undef C
-#undef G
-#undef T
-};
-
-static uint8_t randomize_ambiguity(uint8_t base, unsigned *seed, bool *reseed) {
-    assert(base < 16);
-    
-    if (map[base].num_bits == 1) {
-        base = map[base].val[0];
-        *seed = (*seed << 2) | base;
-        *reseed = true;
-        return base;
-    }
-    else {        
-        unsigned int rval;
-        unsigned int num_bits = map [ base ] . num_bits;
-        
-        if (*reseed)
-        {
-            *reseed = false;
-            srand(*seed);
-        }
-        rval = ( unsigned int ) ( ( ( uint64_t ) rand () * num_bits ) / RAND_MAX );
-
-        if ( rval >= num_bits)
-            return map[base].val[rval % num_bits];
-
-        return map[base].val[rval];
-    }
-}
-#else
-typedef uint8_t dna4na_t;
-
-static const bool isExact[16]
-  = { 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 };
-
-static const struct { dna4na_t val[12]; } possibleBase[16] = {
-    {{ 1, 2, 4, 8, 1, 2, 4, 8, 1, 2, 4, 8 }}, /* 0000 1 2 4 8 */
-    {{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }}, /* 0001 1 */
-    {{ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }}, /* 0010 2 */
-    {{ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 }}, /* 0011 1 2 */
-    {{ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }}, /* 0100 4 */
-    {{ 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4 }}, /* 0101 1 4 */
-    {{ 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4 }}, /* 0110 2 4 */
-    {{ 1, 2, 4, 1, 2, 4, 1, 2, 4, 1, 2, 4 }}, /* 0111 1 2 4 */
-    {{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 }}, /* 1000 8 */
-    {{ 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8 }}, /* 1001 1 8 */
-    {{ 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8 }}, /* 1010 2 8 */
-    {{ 1, 2, 8, 1, 2, 8, 1, 2, 8, 1, 2, 8 }}, /* 1011 1 2 8 */
-    {{ 4, 8, 4, 8, 4, 8, 4, 8, 4, 8, 4, 8 }}, /* 1100 4 8 */
-    {{ 1, 4, 8, 1, 4, 8, 1, 4, 8, 1, 4, 8 }}, /* 1101 1 4 8 */
-    {{ 2, 4, 8, 2, 4, 8, 2, 4, 8, 2, 4, 8 }}, /* 1110 2 4 8 */
-    {{ 1, 2, 4, 8, 1, 2, 4, 8, 1, 2, 4, 8 }}  /* 1111 1 2 4 8 */
-};
-
-static uint8_t randomize_ambiguity(uint8_t base, unsigned *seed, bool *reseed) {
-    assert(base < 16);
-    
-    if (isExact[base]) {
-        typedef uint8_t dna2na_t;
-        
-        static const dna2na_t map4na2na[16]
-        = { 0, 0, 1, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0 };
-        
-        *seed = (*seed << 2) | map4na2na[base];
-        *reseed = true;
-        return base;
-    }
-    else {
-        unsigned rval;
-        
-        if (*reseed) {
-            *reseed = false;
-            srand(*seed);
-        }
-        rval = ((uint8_t)(rand() / (RAND_MAX >> 8))) % 12;
-        assert(rval < 12);
-        return possibleBase[base].val[rval];
-    }
-}
-#endif
-
-
-static
-rc_t CC rand_4na_2na_impl  ( void *data,
-    const VXformInfo *info, int64_t row_id, VRowResult *rslt,
-    uint32_t argc, const VRowData argv [] )
-{
-    unsigned seed = time( NULL ) + row_id;
-    bool reseed = true;
-    uint8_t *dst;
-    const uint8_t *src = argv [ 0 ] . u . data . base;
-    rc_t	rc;
-    KDataBuffer *dst_buf = rslt -> data;
-    
-    src += argv[0].u.data.first_elem;
-    rslt->elem_count = argv[0].u.data.elem_count;
-    assert(dst_buf -> elem_bits == 8 );
-#if 0
-    rslt->no_cache = true; /** do not cache randomized data **/
-#endif
-    rc = KDataBufferResize ( dst_buf, rslt->elem_count );
-    if( rc == 0 ){
-	    int i,last;
-	    dst = dst_buf -> base;
-
-	    for ( last = rslt -> elem_count; last >  0 && src[last-1] == 15; last --){} /** find run of Ns from the right **/
-	    if  ( rslt -> elem_count - last < 5) last = rslt -> elem_count; /*** discard not so large run of Ns ***/
-	    
-	    for ( i = 0; i < last ; ++ i )
-		dst[i] = randomize_ambiguity(src[i], &seed, &reseed);
-	    for ( ; i < rslt -> elem_count; ++ i ) /** large run of Ns from the right is set to As, not randomized  **/
-		dst[i] = 0;
-    }
-    return rc;
-}
-
-
-VTRANSFACT_IMPL ( INSDC_SEQ_rand_4na_2na, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt -> self = NULL;
-    rslt -> whack = NULL;
-    rslt -> u . ndf = rand_4na_2na_impl;
-    rslt -> variant = vftNonDetRow;
-
-    return 0;
-}
diff --git a/libs/vxf/rldecode.c b/libs/vxf/rldecode.c
deleted file mode 100644
index f39c868..0000000
--- a/libs/vxf/rldecode.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <klib/data-buffer.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <assert.h>
-
-enum header_flags {
-	zero_run = 0,
-	one_run = 1,
-	byte_run = 2,
-	uncompressed = 3
-};
-
-static int decode(uint8_t *dst, unsigned dsize, const uint8_t src[], unsigned ssize) {
-    int st, type;
-    unsigned size, i, j;
-    
-    for (st = type = 0, i = j = size = 0; i != ssize; ++i) {
-        int x = src[i];
-        
-        switch (st) {
-        case 0:
-            type = x >> 6;
-            size = x & 0x1F;
-            if ((x & 0x20) == 0)
-                goto DECODED;
-            st = 1;
-            break;
-        case 1:
-            size = (size << 7) | (x & 0x7F);
-            if ((x & 0x80) == 0)
-                goto DECODED;
-            st = 2;
-            break;
-        case 2:
-            size = (size << 7) | (x & 0x7F);
-            if ((x & 0x80) == 0)
-                goto DECODED;
-            st = 3;
-            break;
-        case 3:
-            size = (size << 7) | (x & 0x7F);
-            if ((x & 0x80) == 0)
-                goto DECODED;
-            return 1;
-        case 4:
-            dst[j++] = x;
-            if (--size == 0)
-                st = 0;
-            break;
-        case 5:
-            memset(dst + j, x, size);
-            j += size;
-            st = 0;
-            break;
-        }
-        continue;
-    DECODED:
-        if (j + size > dsize)
-            return 1;
-        switch (type) {
-        case uncompressed:
-            if (size == 0) {
-                size = ssize - i - 1;
-                if (j + size > dsize)
-                    return 1;
-                memcpy(dst + j, src + i + 1, size);
-                return 0;
-            }
-            st = 4;
-            break;
-        case zero_run:
-            memset(dst + j, 0, size);
-            j += size;
-            st = 0;
-            break;
-        case one_run:
-            memset(dst + j, 0xFF, size);
-            j += size;
-            st = 0;
-            break;
-        default:
-            st = 5;
-            break;
-        }
-    }
-    return 0;
-}
-
-static
-rc_t CC rldecode_func(
-                   void *Self,
-                   const VXformInfo *info,
-                   VBlobResult *dst,
-                   const VBlobData *src,
-                   VBlobHeader *hdr
-) {
-    int rslt;
-    
-    rslt = decode(dst->data, (unsigned)(((size_t)dst->elem_count * dst->elem_bits + 7) >> 3),
-                  src->data, (unsigned)(((size_t)src->elem_count * src->elem_bits + 7) >> 3));
-    if (rslt)
-        return RC(rcVDB, rcFunction, rcExecuting, rcData, rcCorrupt);
-    return 0;
-}
-
-/* vdb:rldecode
- * function any rldecode #1.0 ( rle_fmt in )
- */
-VTRANSFACT_IMPL(vdb_rldecode, 1, 0, 0) (const void *self, const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->variant = vftBlob;
-    rslt->u.bf = rldecode_func;
-    
-    return 0;
-}
-
-#if TESTING
-int rld_test(void *dst, unsigned dsize, const void *src, unsigned ssize) {
-    return decode(dst, dsize, src, ssize);
-}
-#endif
diff --git a/libs/vxf/rlencode.c b/libs/vxf/rlencode.c
deleted file mode 100644
index 05a4890..0000000
--- a/libs/vxf/rlencode.c
+++ /dev/null
@@ -1,262 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <klib/data-buffer.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <assert.h>
-
-enum header_flags {
-	zero_run = 0,
-	one_run = 1,
-	byte_run = 2,
-	uncompressed = 3
-};
-
-#define SPECIAL ((uncompressed) << 6)
-
-#define MAX_RUN_LEN ((size_t)(((size_t)1) << (5 + 3 * 7)))
-#define HEAD_SIZE (4)
-
-static __inline__
-unsigned LENGTH_SIZE(size_t len) {
-    return len < 1 ? 0 : len < 1UL << 6 ? 1 : len < 1UL << 13 ? 2 : len < 1UL << 20 ? 3 : len < 1UL << 27 ? 4 : 0;
-}
-
-static __inline__
-int OUTPUT_SIZE(int type, int len) {
-    switch (type) {
-    case zero_run:
-    case one_run:
-        return LENGTH_SIZE(len);
-    case byte_run:
-        return LENGTH_SIZE(len) + 1;
-    case uncompressed:
-        return LENGTH_SIZE(len) + len;
-    default:
-        return len + 1;
-    }
-}
-
-static __inline__
-int f_HEADER(uint8_t HEAD[], uint8_t FLAG, int rlen) {
-    if (rlen < 1UL << 5) {
-        HEAD[0] = (FLAG << 6) | rlen;
-        return 1;
-    }
-    if (rlen < 1UL << 12) {
-        HEAD[0] = (FLAG << 6) | (1 << 5) | (rlen >> 7);
-        HEAD[1] =                           rlen         & 0x7F;
-        return 2;
-    }
-    if (rlen < 1UL << 19) {
-        HEAD[0] = (FLAG << 6) | (1 << 5) | ( rlen >> 14);
-        HEAD[1] =               (1 << 7) | ((rlen >>  7) & 0x7F);
-        HEAD[2] =                            rlen        & 0x7F;
-        return 3;
-    }
-        HEAD[0] = (FLAG << 6) | (1 << 5) | ( rlen >> 21);
-        HEAD[1] =               (1 << 7) | ((rlen >> 14) & 0x7F);
-        HEAD[2] =               (1 << 7) | ((rlen >>  7) & 0x7F);
-        HEAD[3] =                            rlen        & 0x7F;
-        return 4;
-}
-
-#define HEADER(Y, HEAD, FLAG, LEN) Y = f_HEADER(HEAD, FLAG, LEN)
-
-static __inline__ int rle_write(uint8_t *dst, const uint8_t *dend, const uint8_t *src, int type, size_t len) {
-	uint8_t head[HEAD_SIZE + 1];
-	int i = 0;
-	
-	if (type == SPECIAL) {
-		if (dst + len + 1 > dend)
-			return 0;
-
-		*dst++ = SPECIAL;
-		memcpy(dst, src, len);
-		return (int)len + 1;
-	}
-    if (len >= MAX_RUN_LEN) {
-        i = rle_write(dst, dend, src, type, len >> 1);
-        if (i == 0)
-            return 0;
-        if (type == uncompressed)
-            src += len >> 1;
-        return i + rle_write(dst + i, dend, src, type, len - (len >> 1));
-    }
-	
-	HEADER(i, head, type, (int)len);
-
-	if (type == byte_run)
-		++i;
-	if (dst + i > dend)
-		return 0;
-	switch (type) {
-    case byte_run:
-        head[i - 1] = *src;
-    case zero_run:
-    case one_run:
-        memcpy(dst, head, i);
-        return i;
-    default:
-        break;
-	}
-	if (dst + i + len > dend)
-		return 0;
-	memcpy(dst, head, i);
-	memcpy(dst + i, src, len);
-	return i + (int)len;
-}
-
-#define WRITE(SRC, TYPE, END) do { \
-    int i; \
-    i = rle_write(dst, dend, (SRC), (TYPE), (END) - (SRC)); \
-    if (i == 0) { \
-        i = rle_write(dst, dend, (SRC), SPECIAL, send - (SRC)); \
-        if (i == 0) { \
-            return -1; \
-        } \
-    } \
-    dst += i; \
-} while(0)
-
-static int encode(uint8_t *Dst, unsigned dsize, unsigned *psize, const uint8_t *src, unsigned ssize) {
-    uint8_t *dst = Dst;
-	const uint8_t *const dend = dst + dsize;
-	const uint8_t *const send = src + ssize;
-	const uint8_t *cp = src, *mark = NULL;
-	uint8_t last;
-	int type;
-    unsigned size1, size2, size3;
-	
-	while (last = *cp, ++cp != send) {
-		if (*cp == last) {
-			if (mark == NULL)
-				mark = cp - 1;
-			else
-				continue;
-		}
-		else {
-			if (mark == NULL)
-				continue;
-			if (mark != src) {
-				if (mark - src == 1) {
-					if (*src == 0)
-						type = zero_run;
-					else if (*src == 0xFF)
-						type = one_run;
-					else
-						type = uncompressed;
-				}
-				else
-					type = uncompressed;
-				size1 = OUTPUT_SIZE(type, (int)( mark - src ) );
-				size2 = OUTPUT_SIZE(*mark == 0 ? zero_run : *mark == 0xFF ? one_run : byte_run, (int)(cp - mark) );
-				size3 = OUTPUT_SIZE(uncompressed, (int)(cp - src) );
-				if (size1 + size2 >= size3) {
-					mark = NULL;
-					continue;
-				}
-				WRITE(src, type, mark);
-			}
-			WRITE(mark, *mark == 0 ? zero_run : *mark == 0xFF ? one_run : byte_run, cp);
-			mark = NULL;
-			src = cp;
-		}
-	}
-	if (src != cp) {
-		if (mark == NULL)
-			WRITE(src, SPECIAL, cp);
-		else {
-			if (mark != src) {
-				if (mark - src == 1) {
-					if (*src == 0)
-						type = zero_run;
-					else if (*src == 0xFF)
-						type = one_run;
-					else
-						type = uncompressed;
-				}
-				else
-					type = uncompressed;
-				WRITE(src, type, mark);
-			}
-			WRITE(mark, *mark == 0 ? zero_run : *mark == 0xFF ? one_run : byte_run, cp);
-		}
-	}
-    *psize = (unsigned)(dst - Dst);
-	return 0;
-}
-
-static
-rc_t CC rlencode_func(
-              void *Self,
-              const VXformInfo *info,
-              VBlobResult *dst,
-              const VBlobData *src,
-              VBlobHeader *hdr
-) {
-    unsigned sz;
-    int rc;
-    
-    VBlobHeaderSetVersion(hdr, 0);
-    rc = encode(dst->data, (unsigned)(((size_t)dst->elem_count * dst->elem_bits + 7) >> 3), &sz,
-                src->data, (unsigned)(((size_t)src->elem_count * src->elem_bits + 7) >> 3));
-    if (rc)
-        return RC(rcVDB, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-    dst->elem_bits = 1;
-    dst->byte_order = vboNone;
-    dst->elem_count = sz << 3;
-
-    return 0;
-}
-
-/* vdb:rlencode
- * function rle_fmt rlencode #1.0 ( any in )
- */
-VTRANSFACT_IMPL(vdb_rlencode, 1, 0, 0) (const void *self, const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->variant = vftBlob;
-    rslt->u.bf = rlencode_func;
-    
-    return 0;
-}
-
-#if TESTING
-int rle_test(void *dst, unsigned dsize, const void *src, unsigned ssize) {
-    unsigned dummy;
-    return encode(dst, dsize, &dummy, src, ssize);
-}
-#endif
-
diff --git a/libs/vxf/round.c b/libs/vxf/round.c
deleted file mode 100644
index 8d74830..0000000
--- a/libs/vxf/round.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <compiler.h>
-#include <sysalloc.h>
-
-#include <assert.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <math.h>
-
-#define FLOAT_FUNC roundf
-#define DOUBLE_FUNC round
-#include "math-funcs-impl.h"
-
-/*
- function < type T >
- T vdb:round #1.0 ( T in );
- */
-VTRANSFACT_IMPL(vdb_round, 1, 0, 0) (const void *self, const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp ) {
-    return factory(self, info, rslt, cp, dp);
-}
diff --git a/libs/vxf/simple-sub-select.c b/libs/vxf/simple-sub-select.c
deleted file mode 100644
index 527f111..0000000
--- a/libs/vxf/simple-sub-select.c
+++ /dev/null
@@ -1,278 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-#include <vdb/xform.h>
-#include <vdb/database.h>
-#include <vdb/table.h>
-#include <vdb/cursor.h>
-#include <vdb/vdb-priv.h>
-
-
-#include <klib/rc.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <insdc/sra.h>
-#include <insdc/insdc.h>
-#include <bitstr.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-
-typedef struct SubSelect SubSelect;
-struct SubSelect
-{
-    const VCursor *curs;
-    uint32_t idx;
-    const VCursor *native_curs; /** Native cursors are either master cursor or sub_cursors - no need to AddRef **/
-    bool  first_time;
-    char  *col_name;
-    uint32_t col_name_len;
-};
-
-static
-rc_t CC simple_sub_select ( void *data, const VXformInfo *info,
-    int64_t local_row_id, VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    const SubSelect *self = ( const void* ) data;
-
-    rc_t rc;
-    const void *base;
-    uint32_t elem_bits, boff, row_len;
-    int32_t  idx=0; /*** 0 - means no index ***/
-
-    const int64_t *remote_row_id = argv [ 0 ] . u . data . base;
-    remote_row_id += argv [ 0 ] . u . data . first_elem;
-
-    assert ( argv [ 0 ] . u . data . elem_bits == 64 );
-    if(argv [ 0 ] . u . data . elem_count == 0){/** alow empty returns ***/
-        rc = KDataBufferResize ( rslt -> data, 0 );
-        rslt -> elem_count = 0;
-        return 0;
-    }
-    assert ( argv [ 0 ] . u . data . elem_count == 1 );
-    if(argc > 1 ){
-    	const int32_t *remote_idx = argv[1].u.data.base;
-        idx=remote_idx[argv[1].u.data.first_elem];
-    }
-    if(self->native_curs && self->first_time){ /*** can we use native cursor for the data? ***/
-        SubSelect *mself = (SubSelect *)self;
-        uint32_t idx;
-        rc = VCursorAddColumn ( mself->native_curs, & idx, "%.*s", mself->col_name_len, mself->col_name );
-        if(rc == 0 || GetRCState(rc) == rcExists){
-            VCursorRelease( mself->curs);
-            mself->curs = mself->native_curs;
-            mself->idx  = idx;
-        }
-        mself->first_time = false;
-        rc = 0; /** reset rc? **/
-    }
-	
-    /* sub-select */
-    rc = VCursorCellDataDirect ( self -> curs, * remote_row_id, self -> idx,
-                                 & elem_bits, & base, & boff, & row_len );
-    if ( rc == 0 )
-    {
-        uint8_t *cbase=(uint8_t*)base + (boff>>3);
-        rslt -> data -> elem_bits = elem_bits;
-        if(idx < 0 || idx > row_len){ /** out of bounds **/
-            rc = KDataBufferResize ( rslt -> data, 0 );
-            rslt -> elem_count = 0;
-            return rc;
-        } else if (idx > 0){ /*** do subset ***/
-            row_len=1;
-            cbase += (elem_bits>>3)*(idx-1);
-            boff  += elem_bits * (idx-1);
-        }
-	
-        rc = KDataBufferResize ( rslt -> data, row_len );
-        if ( rc == 0 )
-        {
-            bitsz_t bits = ( bitsz_t ) elem_bits * row_len;
-
-            if ( ( elem_bits & 7 ) != 0 )
-                bitcpy ( rslt -> data -> base, 0, base, boff, bits );
-            else{
-                assert((boff&7)==0);
-                memcpy ( rslt -> data -> base, cbase, bits>>3 );
-            }	
-
-            rslt -> elem_count = row_len;
-        }
-    }
-    else if ( GetRCState ( rc ) == rcNotFound )
-    {
-        rc = KDataBufferResize ( rslt -> data, 0 );
-        rslt -> elem_count = 0;
-    }
-
-    return rc;
-}
-
-
-/* open_sub_cursor
- */
-static
-rc_t open_sub_cursor ( SubSelect **fself, const VXfactInfo *info, const VFactoryParams *cp, const VCursor *native_curs )
-{
-    rc_t rc=0;
-    const VTable *tbl, *ftbl = NULL;
-    char name[256]="";
-    const VCursor *curs;
-
-    if ( cp -> argv [ 0 ] . count > 0 )
-    {
-        sprintf(name,"%.*s",(int)cp->argv[0].count,cp->argv[0].data.ascii);
-        rc = VCursorLinkedCursorGet(native_curs,name,&curs);
-        if(rc == 0){
-            rc = VCursorOpenParentRead(curs,&ftbl);
-            if(rc != 0)
-                return rc;
-            VCursorAddRef(curs);
-            tbl = ftbl;
-        } else {
-            const VDatabase *db;
-            rc = VTableOpenParentRead ( info -> tbl, & db );
-            if(rc != 0) return rc;
-            rc = VDatabaseOpenTableRead ( db, & ftbl,name);
-            if(rc != 0) return rc;
-            VDatabaseRelease ( db );
-            tbl = ftbl;
-            rc = VTableCreateCachedCursorRead ( tbl, (const VCursor**)& curs, 256*1024*1024 ); /*** some random io is expected ***/
-            if(rc != 0) return rc;
-            rc = VCursorPermitPostOpenAdd( curs );
-            if(rc != 0) return rc;
-            rc = VCursorOpen( curs );
-            if(rc != 0) return rc;
-            rc = VCursorLinkedCursorSet(native_curs,name,curs);
-            if(rc != 0) return rc;
-        }
-        native_curs = NULL;
-    }
-    else /** we don't now if native_curs permits adding columns **/
-    {
-        tbl = info -> tbl;
-        rc = VTableCreateCachedCursorRead ( tbl, & curs, 0 ); /*** some random io is expected ***/
-    }
-    if ( rc == 0 )
-    {
-        uint32_t idx;
-        rc = VCursorAddColumn ( curs, & idx, "%.*s",
-                                ( int ) cp -> argv [ 1 ] . count, cp -> argv [ 1 ] . data . ascii );
-        if ( rc == 0 || GetRCState(rc) == rcExists)
-        {
-            rc = VCursorOpen ( curs );
-            if ( rc == 0 )
-            {
-                VTypedesc src;
-                rc = VCursorDatatype ( curs, idx, NULL, & src );
-                if ( rc == 0 )
-                {
-                    /* selected column should have same characteristics */
-                    if ( src . domain != info -> fdesc . desc . domain                 ||
-                         src . intrinsic_bits != info -> fdesc . desc . intrinsic_bits ||
-                         src . intrinsic_dim != info -> fdesc . desc. intrinsic_dim )
-                    {
-                        rc = RC ( rcXF, rcFunction, rcConstructing, rcType, rcInconsistent );
-                    }
-                    else
-                    {
-                        SubSelect *self = malloc ( sizeof * self );
-                        if ( self == NULL )
-                            rc = RC ( rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted );
-                        else
-                        {
-                            self -> curs = curs;
-                            self -> idx = idx;
-                            self->native_curs = native_curs;
-                            self->first_time  = true;
-                            self->col_name_len  = cp->argv[1].count;
-                            self->col_name = malloc(self->col_name_len);
-                            memcpy(self->col_name,cp->argv[1].data.ascii,self->col_name_len);
-                            * fself = self;
-                            if ( ftbl != NULL )
-                                VTableRelease ( ftbl );
-                            return 0;
-                        }
-                    }
-                }
-            }
-        }
-        VCursorRelease ( curs );
-    }
-    if ( ftbl != NULL )
-        VTableRelease ( ftbl );
-
-    return rc;
-}
-
-
-/* close_sub_cursor
- */
-static
-void CC close_sub_cursor ( void *data )
-{
-    SubSelect *self = data;
-    if(self->curs != self->native_curs) VCursorRelease ( self -> curs );
-    free ( self->col_name);
-    free ( self );
-}
-
-
-/* 
- * function < type T >
- * T simple_sub_select < ascii tbl, ascii col > ( I64 row * I32 elem_idx(1-based) )
- *     = vdb:simple_sub_select;
- */
-VTRANSFACT_IMPL ( vdb_simple_sub_select_1, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rc_t rc;
-    SubSelect *fself;
-
-    assert ( cp -> argc == 2 );
-    assert ( dp -> argc == 1 || dp -> argc == 2);
-
-    rc = open_sub_cursor ( & fself, info, cp, (const VCursor*)info->parms );
-    if ( rc == 0 )
-    {
-        rslt -> self = fself;
-        rslt -> u . rf = simple_sub_select;
-        rslt -> variant = vftRow;
-        rslt -> whack = close_sub_cursor;
-    }
-
-    return rc;
-}
-
-VTRANSFACT_IMPL ( vdb_simple_sub_select, 0, 9, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    return VTRANSFACT_NAME ( vdb_simple_sub_select_1 ) ( self, info, rslt, cp, dp );
-}
diff --git a/libs/vxf/sprintf.c b/libs/vxf/sprintf.c
deleted file mode 100644
index 385d25c..0000000
--- a/libs/vxf/sprintf.c
+++ /dev/null
@@ -1,1279 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <klib/data-buffer.h>
-#include <klib/text.h>
-#include <klib/printf.h>
-#include <klib/debug.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-
-/* the number of PrintFmt, PrintArg and String
-   elements to allocate in function-local storage */
-#define LOCAL_FMT_COUNT 64
-
-
-typedef struct Sprintf Sprintf;
-struct Sprintf
-{
-    const PrintFmt *fmt;
-    PrintArg *args;
-    String *str;
-};
-
-static uint8_t const radix2_size [ 4 ] = { 8, 16, 32, 64 };
-static uint8_t const radix8_size [ 4 ] = { 3, 6, 11, 22 };
-static uint8_t const radix10_size [ 4 ] = { 3, 5, 10, 20 };
-static uint8_t const radix16_size [ 4 ] = { 2, 4, 8, 16 };
-
-#if _DEBUGGING
-static
-rc_t validate_obj ( const Sprintf *obj, bool fmt_only )
-{
-    uint32_t i;
-
-    /* validate the format blocks */
-    for ( i = 0; obj -> fmt [ i ] . type != sptTerm; ++ i )
-    {
-        /* at this point, only looking for bad formats */
-        if ( obj -> fmt [ i ] . type == sptLiteral )
-        {
-            if ( obj -> fmt [ i ] . u . l . text == NULL )
-                return RC ( rcXF, rcFunction, rcConstructing, rcString, rcNull );
-            if ( obj -> fmt [ i ] . u . l . size == 0 )
-                return RC ( rcXF, rcFunction, rcConstructing, rcString, rcEmpty );
-            if ( string_chr ( obj -> fmt [ i ] . u . l . text, obj -> fmt [ i ] . u . l . size, 0 ) != NULL )
-                return RC ( rcXF, rcFunction, rcConstructing, rcString, rcInvalid );
-        }
-    }
-
-    return 0;
-}
-#endif
-
-static
-size_t get_radix_size ( const PrintFmt *fmt, uint32_t selector )
-{
-    const uint8_t *radix_size;
-    switch ( fmt -> radix )
-    {
-    case 0:
-        return 0;
-    case 10:
-        radix_size = radix10_size;
-        break;
-    case 16:
-        radix_size = radix16_size;
-        break;
-    case 8:
-        radix_size = radix8_size;
-        break;
-    default:
-        radix_size = radix2_size;
-    }
-    return radix_size [ selector ];
-}
-
-typedef struct FuncArgs FuncArgs;
-struct FuncArgs
-{
-    const VRowData *argv;
-    uint32_t argc;
-    uint32_t idx;
-};
-
-static
-const void *access_cell_data ( FuncArgs *args, uint64_t *row_len, size_t *size )
-{
-    size_t elem_bytes;
-    const uint8_t *data;
-
-    if ( args -> idx == args -> argc )
-        return NULL;
-
-    elem_bytes = args -> argv [ args -> idx ] . u . data . elem_bits / 8;
-    assert ( elem_bytes * 8 == args -> argv [ args -> idx ] . u . data . elem_bits );
-
-    data = args -> argv [ args -> idx ] . u . data . base;
-    * row_len = args -> argv [ args -> idx ] . u . data . elem_count;
-
-    data += args -> argv [ args -> idx ] . u . data . first_elem * elem_bytes;
-
-    if ( size != NULL )
-        * size = ( size_t ) ( * row_len * elem_bytes );
-
-    ++ args -> idx;
-    return data;
-}
-
-static
-rc_t capture_uint_scalar ( FuncArgs *args, uint64_t *val )
-{
-    uint64_t row_len;
-    const void *data = access_cell_data ( args, & row_len, NULL );
-
-    if ( data == NULL )
-        return RC ( rcXF, rcFunction, rcExecuting, rcData, rcNull );
-
-    if ( row_len != 1 )
-        return RC ( rcXF, rcFunction, rcExecuting, rcRange, rcExcessive );
-
-    switch ( args -> argv [ args -> idx - 1 ] . u . data . elem_bits )
-    {
-    case 8:
-        * val = * ( const uint8_t* ) data;
-        break;
-    case 16:
-        * val = * ( const uint16_t* ) data;
-        break;
-    case 32:
-        * val = * ( const uint32_t* ) data;
-        break;
-    case 64:
-        * val = * ( const uint64_t* ) data;
-        break;
-    }
-
-    return 0;
-}
-
-static
-rc_t CC sprintf_func ( void *obj,
-     const VXformInfo *info, int64_t row_id, VRowResult *rslt,
-     uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    size_t cell_size;
-    uint32_t str_idx, fmt_idx, arg_idx;
-
-    Sprintf *self = obj;
-
-    const PrintFmt *fmt = self -> fmt;
-    PrintArg *args = self -> args;
-    String *str = self -> str;
-
-    FuncArgs vargs;
-    vargs . argv = argv;
-    vargs . argc = argc;
-    vargs . idx = 0;
-
-    str_idx = fmt_idx = arg_idx = 0;
-
-#if _DEBUGGING
-    rc = validate_obj ( self, false );
-    if ( rc != 0 )
-        KDbgMsg ( "%s - self is bad on entry: %R\n", __func__, rc );
-#endif
-
-    /* initial pass - prepare argument list & estimate cell size */
-    for ( rc = 0, cell_size = 0; fmt [ fmt_idx ] . type != sptTerm; ++ fmt_idx )
-    {
-        size_t arg_size;
-        bool check_index;
-        uint64_t row_len, start_idx, select_len;
-        uint32_t ext_start_index, ext_stop_index;
-
-        row_len = 0;
-
-        /* test for external field width, precision, index */
-        if ( fmt [ fmt_idx ] . ext_field_width )
-        {
-            rc = capture_uint_scalar ( & vargs, & args [ arg_idx ++ ] . u );
-            if ( rc != 0 )
-                return rc;
-        }
-        if ( fmt [ fmt_idx ] . ext_precision )
-        {
-            rc = capture_uint_scalar ( & vargs, & args [ arg_idx ++ ] . u );
-            if ( rc != 0 )
-                return rc;
-        }
-
-        if ( ! fmt [ fmt_idx ] . ext_start_index )
-            start_idx = fmt [ fmt_idx ] . u . f . start_idx;
-        else
-        {
-            /* if the start index is the last in vector,
-               this needs to be suspended until later */
-            if ( ! fmt [ fmt_idx ] . inf_start_index )
-            {
-                rc = capture_uint_scalar ( & vargs, & start_idx );
-                if ( rc != 0 )
-                    return rc;
-                args [ arg_idx ] . u = start_idx;
-            }
-
-            ext_start_index = arg_idx ++;
-        }
-
-        if ( ! fmt [ fmt_idx ] . ext_stop_index && ! fmt [ fmt_idx ] . ext_select_len )
-            select_len = fmt [ fmt_idx ] . u . f . select_len;
-        else
-        {
-            /* if the stop index is the last in vector,
-               this needs to be suspended until later */
-            if ( ! fmt [ fmt_idx ] . inf_stop_index )
-            {
-                rc = capture_uint_scalar ( & vargs, & select_len );
-                if ( rc != 0 )
-                    return rc;
-                args [ arg_idx ] . u = select_len;
-            }
-            ext_stop_index = arg_idx ++;
-        }
-
-        /* make an estimate of the bytes needed by sprintf engine for argument
-           get row_len at the same time */
-        check_index = false;
-        switch ( fmt [ fmt_idx ] . type )
-        {
-        case sptLiteral:                     /* char literal        - arg in fmt   */
-            assert ( fmt [ fmt_idx ] . u . l . text != NULL );
-            arg_size = fmt [ fmt_idx ] . u . l . size;
-            row_len = arg_size;
-            -- arg_idx;
-            break;
-        case sptSignedInt8Vect:              /* signed vector int   - arg is d8    */
-            args [ arg_idx ] . d8 = access_cell_data ( & vargs, & row_len, NULL );
-            arg_size = get_radix_size ( & fmt [ fmt_idx ], 0 ) + 1;
-            break;
-        case sptSignedInt16Vect:             /* signed vector int   - arg is d16   */
-            args [ arg_idx ] . d16 = access_cell_data ( & vargs, & row_len, NULL );
-            arg_size = get_radix_size ( & fmt [ fmt_idx ], 1 ) + 1;
-            break;
-        case sptSignedInt32Vect:             /* signed vector int   - arg is d32   */
-            args [ arg_idx ] . d32 = access_cell_data ( & vargs, & row_len, NULL );
-            arg_size = get_radix_size ( & fmt [ fmt_idx ], 2 ) + 1;
-            break;
-        case sptSignedInt64Vect:             /* signed vector int   - arg is d64   */
-            args [ arg_idx ] . d64 = access_cell_data ( & vargs, & row_len, NULL );
-            arg_size = get_radix_size ( & fmt [ fmt_idx ], 3 ) + 1;
-            break;
-        case sptUnsignedInt8Vect:            /* unsigned vector int - arg is u8    */
-            args [ arg_idx ] . u8 = access_cell_data ( & vargs, & row_len, NULL );
-            arg_size = get_radix_size ( & fmt [ fmt_idx ], 0 ) + 2;
-            break;
-        case sptUnsignedInt16Vect:           /* unsigned vector int - arg is u16   */
-            args [ arg_idx ] . u16 = access_cell_data ( & vargs, & row_len, NULL );
-            arg_size = get_radix_size ( & fmt [ fmt_idx ], 1 ) + 2;
-            break;
-        case sptUnsignedInt32Vect:           /* unsigned vector int - arg is u32   */
-            args [ arg_idx ] . u32 = access_cell_data ( & vargs, & row_len, NULL );
-            arg_size = get_radix_size ( & fmt [ fmt_idx ], 2 ) + 2;
-            break;
-        case sptUnsignedInt64Vect:           /* unsigned vector int - arg is u64   */
-            args [ arg_idx ] . u64 = access_cell_data ( & vargs, & row_len, NULL );
-            arg_size = get_radix_size ( & fmt [ fmt_idx ], 3 ) + 2;
-            break;
-        case sptFloat32Vect:                 /* vector float        - arg is f32   */
-            args [ arg_idx ] . f32 = access_cell_data ( & vargs, & row_len, NULL );
-            arg_size = 32;
-            break;
-        case sptFloat64Vect:                 /* vector float        - arg is f64   */
-            args [ arg_idx ] . f64 = access_cell_data ( & vargs, & row_len, NULL );
-            arg_size = 32;
-            break;
-        case sptFloatLongVect:               /* vector float        - arg is flong */
-            args [ arg_idx ] . flong = access_cell_data ( & vargs, & row_len, NULL );
-            arg_size = 32;
-            break;
-        case sptString:                      /* vector character    - arg is S     */
-            str [ str_idx ] . addr = access_cell_data ( & vargs, & row_len, & str [ str_idx ] . size );
-            str [ str_idx ] . len = ( uint32_t ) str [ str_idx ] . size;
-            arg_size = str [ str_idx ] . size;
-            args [ arg_idx ] . S = & str [ str_idx ++ ];
-            check_index = true;
-            break;
-        case sptUCS2String:                  /* vector character    - arg is S     */
-        case sptUTF32String:                 /* vector character    - arg is S     */
-            return RC ( rcXF, rcFunction, rcExecuting, rcType, rcUnsupported );
-        case sptRowId:                       /* current row id      - arg is d     */
-            args [ arg_idx ] . d = row_id;
-            arg_size = get_radix_size ( & fmt [ fmt_idx ], 3 ) + 1;
-            ++ arg_idx;
-            continue;
-        case sptRowLen:                      /* current row length  - arg is u     */
-            access_cell_data ( & vargs, & args [ arg_idx ] . u, NULL );
-            arg_size = get_radix_size ( & fmt [ fmt_idx ], 3 ) + 2;
-            ++ arg_idx;
-            continue;
-        }
-
-        /* back-fill based upon row-length in case of non-empty rows */
-        if ( row_len != 0 )
-        {
-            /* start index is last in row */
-            if ( fmt [ fmt_idx ] . inf_start_index )
-                start_idx = args [ ext_start_index ] . u = row_len - 1;
-
-            /* end index is last in row */
-            if ( fmt [ fmt_idx ] . inf_stop_index )
-                select_len = args [ ext_stop_index ] . u = row_len - 1;
-        }
-
-        /* detect runtime error condition */
-        if ( start_idx >= row_len )
-            args [ arg_idx ] . p = NULL;
-        else
-        {
-            /* adjust size by index */
-            if ( check_index )
-            {
-                /* the select_len should be correct,
-                   unless the end is a stop coordinate */
-                if ( fmt [ fmt_idx ] . ext_stop_index )
-                {
-                    if ( select_len <= start_idx )
-                        select_len = 1;
-                    else
-                        select_len -= start_idx - 1;
-                }
-
-                /* select_len of 0 means infinite */
-                if ( select_len == 0 )
-                    select_len = row_len - start_idx;
-
-                /* real size after sub-str */
-                arg_size = argv [ vargs . idx - 1 ] . u . data . elem_bits * select_len / 8;
-            }
-
-            /* incorporate size into calcuation */
-            cell_size += arg_size;
-        }
-
-        /* done with argument */
-        ++ arg_idx;
-    }
-
-    /* round cell-size up to nearest 4K */
-    cell_size = ( cell_size + 4095 ) & ~ ( size_t ) 4095;
-
-    /* set output buffer size */
-    rc = KDataBufferResize( rslt -> data, cell_size );
-    if ( rc == 0 )
-    {
-#if _DEBUGGING
-        rc = validate_obj ( self, false );
-        if ( rc != 0 )
-            KDbgMsg ( "%s - self is bad before invoking structured_sprintf: %R\n", __func__, rc );
-#endif
-        /* invoke sprintf engine */
-        rc = structured_sprintf ( rslt -> data -> base,
-            rslt -> data -> elem_count, & cell_size, fmt, args );
-
-        /* recover from buffer insufficient */
-        if ( GetRCState ( rc ) == rcInsufficient && GetRCObject ( rc ) == rcBuffer )
-        {
-            rc = KDataBufferResize ( rslt -> data, cell_size + 1 );
-            if ( rc == 0 )
-            {
-                rc = structured_sprintf ( rslt -> data -> base,
-                    rslt -> data -> elem_count, & cell_size, fmt, args );
-            }
-        }
-
-        if ( rc == 0 )
-        {
-            /* set the return parameters */
-            rc = KDataBufferResize ( rslt -> data, cell_size );
-            if ( rc == 0 )
-            {
-                rslt -> elem_count = cell_size;
-                rslt -> elem_bits = 8;
-            }
-        }
-    }
-
-    return rc;
-}
-
-typedef struct ParseData ParseData;
-struct ParseData
-{
-    KDataBuffer overflow;
-    size_t fmt_size;
-    size_t lit_size;
-    PrintFmt *fmt;
-    uint32_t str_idx;
-    uint32_t fmt_idx;
-    uint32_t arg_idx;
-};
-
-/* create_overflow
- *  create a buffer so large that it cannot overflow again
- *  copy in existing structures
- */
-static
-rc_t create_overflow ( ParseData *pd, uint32_t fmt_idx )
-{
-    /* infer that we can never have more format items than characters in the string... */
-
-    /* our size will create a format for every byte.
-       this should be a total overkill. */
-    size_t buff_size = sizeof pd -> fmt [ 0 ] * pd -> fmt_size;
-
-    /* make the buffer */
-    rc_t rc = KDataBufferMakeBytes ( & pd -> overflow, buff_size );
-    if ( rc == 0 )
-    {
-        /* capture pointers to stack structures */
-        const PrintFmt *fmt = pd -> fmt;
-
-        /* destination pointer */
-        pd -> fmt = pd -> overflow . base;
-
-        /* copy existing data */
-        memcpy ( pd -> fmt, fmt, fmt_idx * sizeof pd -> fmt [ 0 ] );
-   }
-
-    pd -> fmt_idx = fmt_idx;
-
-    return rc;
-}
-
-typedef struct VAList VAList;
-struct VAList
-{
-    const VFunctionParams *dp;
-    uint32_t idx;
-};
-
-static
-rc_t check_integer_arg ( VAList *vargs )
-{
-    if ( vargs -> idx == vargs -> dp -> argc )
-        return RC ( rcXF, rcFunction, rcConstructing, rcParam, rcInsufficient );
-
-    switch ( vargs -> dp -> argv [ vargs -> idx ] . desc . domain )
-    {
-    case vtdBool:
-    case vtdInt:
-    case vtdUint:
-        break;
-    default:
-        return RC ( rcXF, rcFunction, rcConstructing, rcParam, rcIncorrect );
-    }
-
-    switch ( VTypedescSizeof ( & vargs -> dp -> argv [ vargs -> idx ] . desc ) )
-    {
-    case 8:
-    case 16:
-    case 32:
-    case 64:
-        break;
-    default:
-        return RC ( rcXF, rcFunction, rcConstructing, rcParam, rcIncorrect );
-    }
-
-    ++ vargs -> idx;
-    return 0;
-}
-
-static
-rc_t extract_size_modifier ( VAList *vargs, char *size_modifier )
-{
-    switch ( vargs -> dp -> argv [ vargs -> idx ] . desc . domain )
-    {
-    case vtdBool:
-        * size_modifier = 0;
-        break;
-    case vtdUint:
-    case vtdInt:
-        switch ( VTypedescSizeof ( & vargs -> dp -> argv [ vargs -> idx ] . desc ) )
-        {
-        case 8:
-            * size_modifier = 't';
-            break;
-        case 16:
-            * size_modifier = 'h';
-            break;
-        case 32:
-            * size_modifier = 0;
-            break;
-        case 64:
-            * size_modifier = 'l';
-            break;
-        default:
-            return RC ( rcXF, rcFunction, rcConstructing, rcParam, rcIncorrect );
-        }
-        break;
-    case vtdFloat:
-        switch ( VTypedescSizeof ( & vargs -> dp -> argv [ vargs -> idx ] . desc ) )
-        {
-        case 32:
-            * size_modifier = 'h';
-            break;
-        case 64:
-            * size_modifier = 0;
-            break;
-        default:
-            return RC ( rcXF, rcFunction, rcConstructing, rcParam, rcIncorrect );
-        }
-        break;
-    case vtdAscii:
-        * size_modifier = 0;
-        break;
-    case vtdUnicode:
-        switch ( vargs -> dp -> argv [ vargs -> idx ] . desc . intrinsic_bits )
-        {
-        case 8:
-            * size_modifier = 0;
-            break;
-        case 16:
-            * size_modifier = 'h';
-            break;
-        case 32:
-            * size_modifier = 'l';
-            break;
-        default:
-            return RC ( rcXF, rcFunction, rcConstructing, rcParam, rcIncorrect );
-        }
-        break;
-    default:
-        return RC ( rcXF, rcFunction, rcConstructing, rcParam, rcIncorrect );
-    }
-    return 0;
-}
-
-
-/* parse_format_string
- *  parse format string and args into structured format
- */
-static
-rc_t parse_format_string ( const char *fmt_str, ParseData *pd, VAList *vargs )
-{
-    rc_t rc;
-    uint32_t i, fmt_idx;
-
-    PrintFmt *fmt = pd -> fmt;
-
-    /* initialize returned counters */
-    pd -> lit_size = 0;
-    pd -> str_idx = pd -> fmt_idx = pd -> arg_idx = 0;
-
-    /* loop over format string */
-    for ( rc = 0, i = fmt_idx = 0; fmt_str [ i ] != 0; ++ i )
-    {
-        uint32_t domain;
-        bool alternate, numeric;
-        char size_modifier, time_modifier;
-        bool has_width, has_precision, has_index;
-
-        /* loop to gather literal portions */
-        uint32_t start;
-        for ( start = i; ; ++ i )
-        {
-            /* run until we hit start of substitution token
-               or until we hit end of format string */
-            if ( fmt_str [ i ] != 0 && fmt_str [ i ] != '%' )
-                continue;
-
-            /* detect a literal string */
-            if ( i != start )
-            {
-                /* expand into overflow */
-                if ( fmt_idx == LOCAL_FMT_COUNT )
-                {
-                    rc = create_overflow ( pd, fmt_idx );
-                    if ( rc != 0 )
-                        return rc;
-
-                    fmt = pd -> fmt;
-                }
-
-                /* create a text-literal format */
-                memset ( & fmt [ fmt_idx ], 0, sizeof fmt [ 0 ] );
-                fmt [ fmt_idx ] . u . l . text = & fmt_str [ start ];
-                fmt [ fmt_idx ] . u . l . size = i - start;
-                pd -> lit_size += i - start;
-                fmt [ fmt_idx ] . fmt = spfText;
-                fmt [ fmt_idx ] . type = sptLiteral;
-
-                /* increment counter */
-                ++ fmt_idx;
-            }
-
-            /* detect escape sequence */
-            if ( fmt_str [ i ] == 0 || fmt_str [ i + 1 ] != '%' )
-                break;
-
-            /* skip over escape */
-            start = ++ i;
-        }
-
-        /* done when NUL byte is seen */
-        if ( fmt_str [ i ] == 0 )
-            break;
-
-        /* detect overflow */
-        if ( fmt_idx == LOCAL_FMT_COUNT )
-        {
-            rc = create_overflow ( pd, fmt_idx );
-            if ( rc != 0 )
-                return rc;
-
-            fmt = pd -> fmt;
-        }
-
-        /* initial format
-         *  thousands_separate    = false
-         *  add_prefix            = false
-         *  force_decimal_point   = false
-         *  leave_trailing_zeros  = false
-         *  print_time            = false
-         *  print_date            = false
-         *  print_weekday         = false
-         *  print_timezone        = false
-         *  hour_24               = false
-         *  sign                  = 0
-         *  left_fill             = space
-         */
-        memset ( & fmt [ fmt_idx ], 0, sizeof fmt [ 0 ] );
-        fmt [ fmt_idx ] . left_fill = ' ';
-
-        /* scan flags */
-        alternate = false;
-        while ( 1 )
-        {
-            switch ( fmt_str [ ++ i ] )
-            {
-                /* plus and space modify application of sign
-                   to signed integer and floating point conversions.
-                   plus overrides space. */
-            case ' ':
-                if ( fmt [ fmt_idx ] . sign == 0 )
-            case '+':
-                    fmt [ fmt_idx ] . sign = fmt_str [ i ];
-                continue;
-
-                /* dash indicates left-alignment. indicate this
-                   by setting "left_fill" to NUL. */
-            case '-':
-                fmt [ fmt_idx ] . left_fill = 0;
-                continue;
-
-                /* zero indicates an alternate left-fill for
-                   numeric conversions. the zero is inserted before
-                   any sign character in { '+', '-' or ' ' }.
-                   since "left_fill" is also used to indicate
-                   alignment, only store when right aligning. */
-            case '0':
-                if ( fmt [ fmt_idx ] . left_fill != 0 )
-                    fmt [ fmt_idx ] . left_fill = '0';
-                continue;
-
-                /* hash indicates that the formatter should use an
-                   "alternate" approach. that approach is specific
-                   to the format. */
-            case '#':
-                alternate = true;
-                continue;
-
-                /* comma ( or apostrophe outside of US ) indicates
-                   that the integer portion of a numeral should use
-                   a comma as a thousands separator for legibility. */
-            case ',':
-            case '\'':
-                fmt [ fmt_idx ] . thousands_separate = 1;
-                continue;
-            }
-
-            /* we've hit a non-flag character */
-            break;
-        }
-
-        /* minimum field width */
-        has_width = false;
-        if ( isdigit ( fmt_str [ i ] ) )
-        {
-            /* literal */
-            has_width = true;
-            fmt [ fmt_idx ] . u . f . min_field_width = fmt_str [ i ] - '0';
-            while ( isdigit ( fmt_str [ ++ i ] ) )
-            {
-                fmt [ fmt_idx ] . u . f . min_field_width *= 10;
-                fmt [ fmt_idx ] . u . f . min_field_width += fmt_str [ i ] - '0';
-            }
-        }
-        else if ( fmt_str [ i ] == '*' )
-        {
-            /* external */
-            rc = check_integer_arg ( vargs );
-            if ( rc != 0 )
-                return rc;
-
-            has_width = true;
-            fmt [ fmt_idx ] . ext_field_width = 1;
-            ++ pd -> arg_idx;
-            ++ i;
-        }
-
-        /* precision */
-        has_precision = false;
-        if ( fmt_str [ i ] == '.' )
-        {
-            /* a single dot implies a precision value of 0 */
-            has_precision = true;
-
-            if ( isdigit ( fmt_str [ ++ i ] ) )
-            {
-                /* a literal precision */
-                fmt [ fmt_idx ] . u . f . precision = fmt_str [ i ] - '0';
-                while ( isdigit ( fmt_str [ ++ i ] ) )
-                {
-                    fmt [ fmt_idx ] . u . f . precision *= 10;
-                    fmt [ fmt_idx ] . u . f . precision += fmt_str [ i ] - '0';
-                }
-            }
-            else if ( fmt_str [ i ] == '*' )
-            {
-                /* external */
-                rc = check_integer_arg ( vargs );
-                if ( rc != 0 )
-                    return rc;
-
-                fmt [ fmt_idx ] . ext_precision = 1;
-                ++ pd -> arg_idx;
-                ++ i;
-            }
-            else if ( fmt_str [ i ] == '-' )
-            {
-                /* eat a negative precision - treat as 0 */
-                while ( isdigit ( fmt_str [ ++ i ] ) )
-                    ( void ) 0;
-            }
-        }
-
-        /* index - given when parameter is a vector */
-        has_index = false;
-        if ( fmt_str [ i ] == ':' )
-        {
-            bool has_start, has_len, has_end, end_is_stop;
-            has_start = has_len = has_end = end_is_stop = false;
-
-            /* parameter is taken as a vector,
-               with a default index starting at 0 */
-            has_index = true;
-
-            if ( isdigit ( fmt_str [ ++ i ] ) )
-            {
-                /* literal index */
-                fmt [ fmt_idx ] . u . f . start_idx = fmt_str [ i ] - '0';
-                while ( isdigit ( fmt_str [ ++ i ] ) )
-                {
-                    fmt [ fmt_idx ] . u . f . start_idx *= 10;
-                    fmt [ fmt_idx ] . u . f . start_idx += fmt_str [ i ] - '0';
-                }
-                has_start = true;
-            }
-            else switch ( fmt_str [ i ] )
-            {
-            case '*':
-                /* external */
-                rc = check_integer_arg ( vargs );
-                if ( rc != 0 )
-                    return rc;
-
-                fmt [ fmt_idx ] . ext_start_index = 1;
-                ++ pd -> arg_idx;
-                ++ i;
-                has_start = true;
-                break;
-            case '$':
-                fmt [ fmt_idx ] . inf_start_index = 1;
-                fmt [ fmt_idx ] . ext_start_index = 1;
-                ++ pd -> arg_idx;
-                ++ i;
-                has_start = true;
-                break;
-            }
-
-            /* detect range */
-            switch ( fmt_str [ i ] )
-            {
-                /* given as start-stop */
-            case '-':
-                end_is_stop = true;
-
-                /* given as start/len */
-            case '/':
-
-                has_len = true;
-
-                if ( isdigit ( fmt_str [ ++ i ] ) )
-                {
-                    /* literal selection length or end */
-                    fmt [ fmt_idx ] . u . f . select_len = fmt_str [ i ] - '0';
-                    while ( isdigit ( fmt_str [ ++ i ] ) )
-                    {
-                        fmt [ fmt_idx ] . u . f . select_len *= 10;
-                        fmt [ fmt_idx ] . u . f . select_len += fmt_str [ i ] - '0';
-                    }
-                    has_end = true;
-                }
-                else switch ( fmt_str [ i ] )
-                {
-                case '*':
-                    /* external */
-                    rc = check_integer_arg ( vargs );
-                    if ( rc != 0 )
-                        return rc;
-
-                    /* external selection length or end */
-                    fmt [ fmt_idx ] . ext_stop_index = end_is_stop;
-                    fmt [ fmt_idx ] . ext_select_len = ! end_is_stop;
-                    ++ pd -> arg_idx;
-                    ++ i;
-                    has_end = true;
-                    break;
-                case '$':
-                    /* ignore index end if start is infinite */
-                    if ( ! fmt [ fmt_idx ] . inf_start_index )
-                    {
-                        fmt [ fmt_idx ] . inf_stop_index = 1;
-                        fmt [ fmt_idx ] . ext_stop_index = 1;
-                        ++ pd -> arg_idx;
-                        end_is_stop = has_end = true;
-                    }
-                    ++ i;
-                    break;
-                case '-':
-                    /* negatives are garbage */
-                    while ( isdigit ( fmt_str [ ++ i ] ) )
-                        ( void ) 0;
-                    break;
-                default:
-                    end_is_stop = false;
-                }
-                break;
-            }
-
-            if ( ! has_len && has_start )
-                fmt [ fmt_idx ] . u . f . select_len = 1;
-        }
-
-        /* size - accept for brownie-points and for KTime */
-        size_modifier = time_modifier = 0;
-        switch ( fmt_str [ i ] )
-        {
-            /* "Tiny" modifier - like "hh" in C format */
-        case 't':
-            /* "Half" modifier - same as C format */
-        case 'h':
-            /* "Long" modifier - means 64-bit for integers, otherwise like C */
-        case 'l':
-            size_modifier = time_modifier = fmt_str [ i ++ ];
-            break;
-            /* "siZe" modifier - whatever the size of size_t is */
-        case 'z':
-            ++ i;
-            time_modifier = 'z';
-            if ( sizeof ( size_t ) == sizeof ( uint64_t ) )
-                size_modifier = 'l';
-            break;
-        }
-
-        /* output format
-           describes the formatting to apply on output
-           if precision has not been set, give it a default value */
-        domain = 0;
-        numeric = false;
-        switch ( fmt_str [ i ] )
-        {
-            /* decimal signed integer */
-        case 'd':
-        case 'i':
-            fmt [ fmt_idx ] . radix = 10;
-            fmt [ fmt_idx ] . fmt = spfSignedInt;
-            numeric = true;
-            if ( ! has_precision )
-                fmt [ fmt_idx ] . u . f . precision = 1;
-            else if ( fmt [ fmt_idx ] . left_fill == '0' )
-                fmt [ fmt_idx ] . left_fill = ' ';
-            domain = vtdInt;
-            break;
-
-            /* decimal unsigned integer */
-        case 'u':
-            fmt [ fmt_idx ] . radix = 10;
-        unsigned_int:
-            fmt [ fmt_idx ] . fmt = spfUnsigned;
-            fmt [ fmt_idx ] . sign = 0;
-            numeric = true;
-            if ( ! has_precision )
-                fmt [ fmt_idx ] . u . f . precision = 1;
-            else if ( fmt [ fmt_idx ] . left_fill == '0' )
-                fmt [ fmt_idx ] . left_fill = ' ';
-            domain = vtdUint;
-            break;
-
-            /* hex unsigned integer */
-        case 'x':
-            fmt [ fmt_idx ] . add_prefix = alternate;
-            fmt [ fmt_idx ] . radix = 16;
-            goto unsigned_int;
-
-            /* upper-case hex unsigned integer */
-        case 'X':
-            fmt [ fmt_idx ] . upper_case_num = 1;
-            fmt [ fmt_idx ] . add_prefix = alternate;
-            fmt [ fmt_idx ] . radix = 16;
-            goto unsigned_int;
-
-            /* octal unsigned integer */
-        case 'o':
-            fmt [ fmt_idx ] . add_prefix = alternate;
-            fmt [ fmt_idx ] . radix = 8;
-            goto unsigned_int;
-
-            /* binary unsigned integer */
-        case 'b':
-            fmt [ fmt_idx ] . add_prefix = alternate;
-            fmt [ fmt_idx ] . radix = 2;
-            goto unsigned_int;
-
-            /* decimal signed floating point */
-        case 'f':
-            fmt [ fmt_idx ] . fmt = spfStdFloat;
-        fmt_float:
-            fmt [ fmt_idx ] . radix = 10;
-            fmt [ fmt_idx ] . force_decimal_point = alternate;
-            numeric = true;
-            if ( ! has_precision )
-                fmt [ fmt_idx ] . u . f . precision = 6;
-            domain = vtdFloat;
-            break;
-
-            /* scientific notation floating point */
-        case 'e':
-            fmt [ fmt_idx ] . fmt = spfSciFloat;
-            goto fmt_float;
-
-            /* "general" floating point */
-        case 'g':
-            fmt [ fmt_idx ] . leave_trailing_zeros = alternate;
-            fmt [ fmt_idx ] . fmt = spfGenFloat;
-            goto fmt_float;
-
-            /* character data */
-        case 's':
-            if ( ! has_precision )
-            /* no break */
-        case 'c':
-                fmt [ fmt_idx ] . u . f . precision = -1;
-            fmt [ fmt_idx ] . fmt = spfText;
-            domain = vtdUnicode;
-            break;
-
-        default:
-            return RC ( rcXF, rcString, rcFormatting, rcFormat, rcUnrecognized );
-        }
-
-        /* handle zero padding for non-numeric cases */
-        if ( ! numeric && fmt [ fmt_idx ] . left_fill == '0' )
-            fmt [ fmt_idx ] . left_fill = ' ';
-
-        /* take size from actual parameter */
-        rc = extract_size_modifier ( vargs, & size_modifier );
-        if ( rc != 0 )
-            return rc;
-
-        /* determine type from argument */
-        switch ( vargs -> dp -> argv [ vargs -> idx ] . desc . domain )
-        {
-        case vtdBool:
-        case vtdUint:
-            switch ( domain )
-            {
-            case vtdBool:
-            case vtdUint:
-            case vtdInt:
-                break;
-            case vtdFloat:
-                fmt [ fmt_idx ] . type_cast = 1;
-                break;
-            default:
-                return RC ( rcXF, rcString, rcFormatting, rcParam, rcIncorrect );
-            }
-
-            switch ( size_modifier )
-            {
-            case 't':
-                fmt [ fmt_idx ] . type = sptUnsignedInt8Vect;
-                break;
-            case 'h':
-                fmt [ fmt_idx ] . type = sptUnsignedInt16Vect;
-                break;
-            case 0:
-                fmt [ fmt_idx ] . type = sptUnsignedInt32Vect;
-                break;
-            case 'l':
-                fmt [ fmt_idx ] . type = sptUnsignedInt64Vect;
-                break;
-            }
-            break;
-
-        case vtdInt:
-            switch ( domain )
-            {
-            case vtdBool:
-            case vtdUint:
-            case vtdInt:
-                break;
-            case vtdFloat:
-                fmt [ fmt_idx ] . type_cast = 1;
-                break;
-            default:
-                return RC ( rcXF, rcString, rcFormatting, rcParam, rcIncorrect );
-            }
-
-            switch ( size_modifier )
-            {
-            case 't':
-                fmt [ fmt_idx ] . type = sptSignedInt8Vect;
-                break;
-            case 'h':
-                fmt [ fmt_idx ] . type = sptSignedInt16Vect;
-                break;
-            case 0:
-                fmt [ fmt_idx ] . type = sptSignedInt32Vect;
-                break;
-            case 'l':
-                fmt [ fmt_idx ] . type = sptSignedInt64Vect;
-                break;
-            }
-            break;
-
-        case vtdFloat:
-            switch ( domain )
-            {
-            case vtdBool:
-            case vtdUint:
-            case vtdInt:
-                fmt [ fmt_idx ] . type_cast = 1;
-                break;
-            case vtdFloat:
-                break;
-            default:
-                return RC ( rcXF, rcString, rcFormatting, rcParam, rcIncorrect );
-            }
-
-            switch ( size_modifier )
-            {
-            case 'h':
-                fmt [ fmt_idx ] . type = sptFloat32Vect;
-                break;
-            case 0:
-                fmt [ fmt_idx ] . type = sptFloat64Vect;
-                break;
-            }
-            break;
-
-        case vtdAscii:
-            switch ( domain )
-            {
-            case vtdAscii:
-            case vtdUnicode:
-                if ( size_modifier != 0 )
-                    fmt [ fmt_idx ] . type_cast = 1;
-                break;
-            default:
-                return RC ( rcXF, rcString, rcFormatting, rcParam, rcIncorrect );
-            }
-
-            fmt [ fmt_idx ] . type = sptString;
-
-            ++ pd -> str_idx;
-            break;
-
-        case vtdUnicode:
-            switch ( domain )
-            {
-            case vtdAscii:
-            case vtdUnicode:
-                switch ( size_modifier )
-                {
-                case 0:
-                    fmt [ fmt_idx ] . type = sptString;
-                    break;
-                case 'h':
-                    fmt [ fmt_idx ] . type_cast = 1;
-                    fmt [ fmt_idx ] . type = sptUCS2String;
-                    break;
-                case 'l':
-                    fmt [ fmt_idx ] . type_cast = 1;
-                    fmt [ fmt_idx ] . type = sptUTF32String;
-                    break;
-                }
-                break;
-            default:
-                return RC ( rcXF, rcString, rcFormatting, rcParam, rcIncorrect );
-            }
-
-            ++ pd -> str_idx;
-            break;
-        }
-
-        /* account for format argument */
-        ++ fmt_idx;
-        ++ pd -> arg_idx;
-        ++ vargs -> idx;
-    }
-
-    /* record final fmt */
-    if ( rc == 0 )
-    {
-        if ( fmt_idx == LOCAL_FMT_COUNT )
-        {
-            rc = create_overflow ( pd, fmt_idx );
-            if ( rc != 0 )
-                return rc;
-
-            fmt = pd -> fmt;
-        }
-
-        memset ( & fmt [ fmt_idx ++ ], 0, sizeof fmt [ 0 ] );
-
-        /* if not all arguments were consumed, should this be an error? */
-        if ( vargs -> idx != vargs -> dp -> argc )
-        {
-            /* produce warning */
-        }
-    }
-
-    pd -> fmt_idx = fmt_idx;
-
-    return rc;
-}
-
-VTRANSFACT_IMPL ( vdb_sprintf, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rc_t rc;
-    Sprintf *obj;
-
-    /* const format string */
-    VAList vargs;
-    const char *fmt_str = cp -> argv [ 0 ] . data . ascii;
-
-    /* local formatting storage */
-    PrintFmt fmt [ LOCAL_FMT_COUNT ];
-
-    /* data block for parse */
-    ParseData pd;
-    pd . fmt_size = cp -> argv [ 0 ] . count;
-    pd . fmt = fmt;
-
-    /* packaged va_list */
-    vargs . dp = dp;
-    vargs . idx = 0;
-
-    /* parse the format string */
-    rc = parse_format_string ( fmt_str, & pd, & vargs );
-    if ( rc == 0 )
-    {
-        /* the object size:
-           literal data bytes +
-           space for PrintFmt +
-           space for PrintArg */
-        size_t obj_extra = pd . lit_size +
-            pd . fmt_idx * sizeof ( PrintFmt ) +
-            pd . arg_idx * sizeof ( PrintArg ) +
-            pd . str_idx * sizeof ( String );
-        obj = malloc ( sizeof * obj + 1 + obj_extra );
-        if ( obj == NULL )
-            rc = RC ( rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted );
-        else
-        {
-            uint32_t i;
-
-            char *lit;
-            PrintFmt *dfmt;
-            size_t lit_size;
-
-            obj -> args = ( void* ) ( obj + 1 );
-            dfmt = ( void* ) & obj -> args [ pd . arg_idx ];
-            obj -> str = ( void* ) & dfmt [ pd . fmt_idx ];
-            lit = ( void* ) & obj -> str [ pd . str_idx ];
-            obj -> fmt = dfmt;
-
-            /* not necessary or even helpful, but doesn't cost much */
-            memset ( obj -> args, 0, pd . arg_idx * sizeof obj -> args [ 0 ] );
-            memset ( obj -> str, 0, pd . str_idx * sizeof obj -> str [ 0 ] );
-
-            /* copy format and literals */
-            for ( lit_size = 0, i = 0; i < pd . fmt_idx; ++ i )
-            {
-                /* simple copy */
-                dfmt [ i ] = pd . fmt [ i ];
-                if ( pd . fmt [ i ] . type == sptLiteral )
-                {
-                    /* copy over literal data */
-                    dfmt [ i ] . u . l . text = & lit [ lit_size ];
-                    memcpy ( & lit [ lit_size ],
-                        pd . fmt [ i ] . u . l . text,
-                        pd . fmt [ i ] . u . l . size );
-                    lit_size += pd . fmt [ i ] . u . l . size;
-                }
-            }
-
-            /* NUL-terminate the literal text - again, doesn't help but doesn't hurt */
-            lit [ lit_size ] = 0;
-        }
-    }
-
-    /* douse any overflow memory used */
-    if ( pd . fmt != fmt )
-        KDataBufferWhack ( & pd . overflow );
-
-#if _DEBUGGING
-    if ( rc == 0 )
-    {
-        rc = validate_obj ( obj, true );
-        if ( rc != 0 )
-            KDbgMsg ( "%s - self is bad on factory exit: %R\n", __func__, rc );
-    }
-#endif
-
-    if ( rc == 0 )
-    {
-        rslt -> self = obj;
-        rslt -> whack = free;
-        rslt -> u . rf = sprintf_func;
-        rslt -> variant = vftRow;
-    }
-
-    return rc;
-}
diff --git a/libs/vxf/strtonum.c b/libs/vxf/strtonum.c
deleted file mode 100644
index 322f50e..0000000
--- a/libs/vxf/strtonum.c
+++ /dev/null
@@ -1,354 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <klib/data-buffer.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-
-/* strtonum
- *  convert string to number
- *
- *  "radix" [ CONST, DEFAULT 10 ]
- *   if not specified, or if given as 0, the default will be 10
- *   unless the string begins with "0x" or "0X", in which case radix will be 16
- *   octal is NOT inferred ( i.e. leading "0" does not imply octal )
- *
- *  "str" [ DATA ] - text to be converted
- */
-
-static
-rc_t CC strtoint ( void *data, const VXformInfo *info,
-    VRowResult *rslt, const char *str, size_t str_size )
-{
-    bool negate;
-    size_t i = 0;
-    uint64_t u, max_magnitude;
-    uint32_t radix;
-    rc_t rc;
-    KDataBuffer *dst;
-
-    if (str_size == 0) {
-        rslt -> elem_count = 0;
-        return 0;
-    }
-
-    /* determine radix */
-    radix = ( uint32_t ) ( ( size_t ) data );
-    if ( radix == 0 )
-    {
-        radix = 10;
-        if ( str_size > 2 && str [ 0 ] == '0' ) switch ( tolower ( str [ 1 ] ) )
-        {
-        case 'x':
-            radix = 16;
-            i = 2;
-            break;
-        case 'b':
-            radix = 2;
-            i = 2;
-            break;
-        }
-    }
-
-    /* check for negative */
-    negate = false;
-    if ( radix == 10 && i < str_size && str [ i ] == '-' )
-    {
-        negate = true;
-        ++ i;
-    }
-
-    /* convert numeral */
-    for ( u = 0; i < str_size; ++ i )
-    {
-        int32_t d = toupper ( str [ i ] ) - '0';
-        if ( d < 0 )
-            return RC ( rcXF, rcFunction, rcExecuting, rcParam, rcInvalid );
-        if ( d >= 10 )
-        {
-            d -= 'A' - '0' - 10;
-            if ( d < 10 )
-                return RC ( rcXF, rcFunction, rcExecuting, rcParam, rcInvalid );
-        }
-        if ( d > radix )
-            return RC ( rcXF, rcFunction, rcExecuting, rcParam, rcInvalid );
-        u = u * radix + d;
-    }
-
-    /* determine maximum magnitude */
-    if ( info -> fdesc . desc . intrinsic_bits == 64 )
-        max_magnitude = ( int64_t ) -1;
-    else
-        max_magnitude = ( ( ( uint64_t ) 1 ) << ( info -> fdesc . desc . intrinsic_bits ) ) - 1;
-    if ( info -> fdesc . desc . domain == vtdInt || negate )
-    {
-        max_magnitude >>= 1;
-        max_magnitude += negate;
-    }
-
-    if ( u > max_magnitude )
-        return RC ( rcXF, rcFunction, rcExecuting, rcParam, rcExcessive );
-
-    /* set output buffer size */
-    dst = rslt -> data;
-    rc = KDataBufferCast ( dst, dst, info -> fdesc . desc . intrinsic_bits, true );
-    if ( rc == 0 )
-        rc = KDataBufferResize ( dst, 1 );
-    if ( rc == 0 )
-    {
-        if ( negate )
-            u = - ( int64_t ) u;
-
-        rslt -> elem_count = 1;
-
-        switch ( info -> fdesc . desc . intrinsic_bits )
-        {
-        case 8:
-            * ( uint8_t* ) dst -> base = ( uint8_t ) u;
-            break;
-        case 16:
-            * ( uint16_t* ) dst -> base = ( uint16_t ) u;
-            break;
-        case 32:
-            * ( uint32_t* ) dst -> base = ( uint32_t ) u;
-            break;
-        case 64:
-            * ( uint64_t* ) dst -> base = u;
-            break;
-        default:
-            rc = RC ( rcXF, rcFunction, rcExecuting, rcParam, rcInvalid );
-        }
-    }
-
-    return rc;
-}
-
-static
-rc_t CC strtoflt ( void *data, const VXformInfo *info,
-    VRowResult *rslt, char *str, size_t str_size )
-{
-    /* set output buffer size */
-    rc_t rc;
-    KDataBuffer *dst = rslt -> data;
-
-    double d;
-    char *end;
-
-    str [ str_size ] = 0;
-    d = strtod ( str, & end );
-    if ( end != & str [ str_size ] )
-        return RC ( rcXF, rcFunction, rcExecuting, rcParam, rcInvalid );
-
-    rc = KDataBufferCast ( dst, dst, info -> fdesc . desc . intrinsic_bits, true );
-    if ( rc == 0 )
-        rc = KDataBufferResize ( dst, 1 );
-    if ( rc == 0 )
-    {
-        rslt -> elem_count = 1;
-
-        switch ( info -> fdesc . desc . intrinsic_bits )
-        {
-        case 32:
-            * ( float* ) dst -> base = ( float ) d;
-            break;
-        case 64:
-            * ( double* ) dst -> base = d;
-            break;
-        default:
-            rc = RC ( rcXF, rcFunction, rcExecuting, rcParam, rcInvalid );
-        }
-    }
-
-    return rc;
-}
-
-static
-rc_t CC strtoint_8 ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    const char *str = argv [ 0 ] . u . data . base;
-    str += argv [ 0 ] . u . data . first_elem;
-    return strtoint ( data, info, rslt, str, argv [ 0 ] . u . data . elem_count );
-}
-
-static
-rc_t CC strtoflt_8 ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    char buffer [ 128 ];
-    uint32_t count = argv [ 0 ] . u . data . elem_count;
-    const char *str = argv [ 0 ] . u . data . base;
-    str += argv [ 0 ] . u . data . first_elem;
-
-    if ( count >= sizeof buffer )
-        return RC ( rcXF, rcFunction, rcExecuting, rcParam, rcExcessive );
-
-    memcpy ( buffer, str, count );
-
-    return strtoflt ( data, info, rslt, buffer, count );
-}
-
-static
-rc_t CC strtoint_16 ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    char buffer [ 64 ];
-    uint32_t i, count = argv [ 0 ] . u . data . elem_count;
-    const uint16_t *str = argv [ 0 ] . u . data . base;
-    str += argv [ 0 ] . u . data . first_elem;
-
-    if ( count > sizeof buffer )
-        return RC ( rcXF, rcFunction, rcExecuting, rcParam, rcExcessive );
-
-    for ( i = 0; i < count; ++ i )
-    {
-        if ( str [ i ] > 128 )
-            return RC ( rcXF, rcFunction, rcExecuting, rcParam, rcInvalid );
-        buffer [ i ] = ( char ) str [ i ];
-    }
-
-    return strtoint ( data, info, rslt, buffer, count );
-}
-
-static
-rc_t CC strtoflt_16 ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    char buffer [ 128 ];
-    uint32_t i, count = argv [ 0 ] . u . data . elem_count;
-    const uint16_t *str = argv [ 0 ] . u . data . base;
-    str += argv [ 0 ] . u . data . first_elem;
-
-    if ( count >= sizeof buffer )
-        return RC ( rcXF, rcFunction, rcExecuting, rcParam, rcExcessive );
-
-    for ( i = 0; i < count; ++ i )
-    {
-        if ( str [ i ] > 128 )
-            return RC ( rcXF, rcFunction, rcExecuting, rcParam, rcInvalid );
-        buffer [ i ] = ( char ) str [ i ];
-    }
-
-    return strtoflt ( data, info, rslt, buffer, count );
-}
-
-static
-rc_t CC strtoint_32 ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    char buffer [ 64 ];
-    uint32_t i, count = argv [ 0 ] . u . data . elem_count;
-    const uint32_t *str = argv [ 0 ] . u . data . base;
-    str += argv [ 0 ] . u . data . first_elem;
-
-    if ( count > sizeof buffer )
-        return RC ( rcXF, rcFunction, rcExecuting, rcParam, rcExcessive );
-
-    for ( i = 0; i < count; ++ i )
-    {
-        if ( str [ i ] > 128 )
-            return RC ( rcXF, rcFunction, rcExecuting, rcParam, rcInvalid );
-        buffer [ i ] = ( char ) str [ i ];
-    }
-
-    return strtoint ( data, info, rslt, buffer, count );
-}
-
-static
-rc_t CC strtoflt_32 ( void *data, const VXformInfo *info, int64_t row_id,
-    VRowResult *rslt, uint32_t argc, const VRowData argv [] )
-{
-    char buffer [ 128 ];
-    uint32_t i, count = argv [ 0 ] . u . data . elem_count;
-    const uint32_t *str = argv [ 0 ] . u . data . base;
-    str += argv [ 0 ] . u . data . first_elem;
-
-    if ( count >= sizeof buffer )
-        return RC ( rcXF, rcFunction, rcExecuting, rcParam, rcExcessive );
-
-    for ( i = 0; i < count; ++ i )
-    {
-        if ( str [ i ] > 128 )
-            return RC ( rcXF, rcFunction, rcExecuting, rcParam, rcInvalid );
-        buffer [ i ] = ( char ) str [ i ];
-    }
-
-    return strtoflt ( data, info, rslt, buffer, count );
-}
-
-VTRANSFACT_IMPL ( vdb_strtonum, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    uint32_t radix = 0;
-
-    if ( cp -> argc == 1 )
-    {
-        radix = cp -> argv [ 0 ] . data . u32 [ 0 ];
-        if ( radix > 36 )
-            return RC ( rcXF, rcFunction, rcConstructing, rcParam, rcInvalid );
-    }
-
-    if ( info -> fdesc . desc . domain == vtdFloat ) switch ( radix )
-    {
-    case 0:
-    case 10:
-        break;
-    default:
-        return RC ( rcXF, rcFunction, rcConstructing, rcParam, rcInvalid );
-    }
-
-    if ( dp -> argv [ 0 ] . desc . intrinsic_dim != 1 )
-        return RC ( rcXF, rcFunction, rcConstructing, rcParam, rcInvalid );
-
-    switch ( dp -> argv [ 0 ] . desc . intrinsic_bits )
-    {
-    case 8:
-        rslt -> u . rf = ( info -> fdesc . desc . domain == vtdFloat ) ? strtoflt_8 : strtoint_8;
-        break;
-    case 16:
-        rslt -> u . rf = ( info -> fdesc . desc . domain == vtdFloat ) ? strtoflt_16 : strtoint_16;
-        break;
-    case 32:
-        rslt -> u . rf = ( info -> fdesc . desc . domain == vtdFloat ) ? strtoflt_32 : strtoint_32;
-        break;
-    default:
-        return RC ( rcXF, rcFunction, rcConstructing, rcParam, rcInvalid );
-    }
-
-    rslt -> self = ( void* ) ( size_t ) radix;
-    rslt -> variant = vftRow;
-
-    return 0;
-}
diff --git a/libs/vxf/subtract-row-id.c b/libs/vxf/subtract-row-id.c
deleted file mode 100644
index 16cfcd9..0000000
--- a/libs/vxf/subtract-row-id.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-#include <vdb/xform.h>
-#include <arch-impl.h>
-#include <klib/data-buffer.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-static
-rc_t CC subtract_int64_t ( void *self, const VXformInfo *info,
-    int64_t row_id, VRowResult *rslt,
-    uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    uint32_t i;
-    int64_t *dst;
-    const int64_t *src = argv [ 0 ] . u . data . base;
-    uint64_t elem_count = argv [ 0 ] . u . data . elem_count;
-
-    assert ( rslt -> data -> elem_bits == 64 );
-    rc = KDataBufferResize ( rslt -> data, elem_count );
-    if ( rc != 0 )
-        return rc;
-
-    dst = rslt -> data -> base;
-    rslt -> elem_count = elem_count;
-
-    /* while this function is typically used on single-element rows,
-       we advertise taking rows of any length... */
-    for ( i = 0, src += argv [ 0 ] . u . data . first_elem; i < elem_count; ++ i )
-        dst [ i ] = src [ i ] - row_id;
-
-    return 0;
-}
-
-
-/* subtract_row_id
- *  return the difference between input and current row id
- *
- *  "in" [ DATA ]
- *
- * SYNOPSIS:
- *  predicts that the integer data in "in" will be related to
- *  the corresponding row-id, and subtracts off the latter.
- *  for serially generated ids, this will produce a constant
- *  difference that can be stored as a static column.
- */
-VTRANSFACT_IMPL ( vdb_subtract_row_id, 1, 0, 0 ) ( const void *fself, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    /* version 1.0 operates on I64 input */
-    rslt -> u . ndf = subtract_int64_t;
-    rslt -> variant = vftNonDetRow;
-    return 0;
-}
diff --git a/libs/vxf/sum.c b/libs/vxf/sum.c
deleted file mode 100644
index 4ef695a..0000000
--- a/libs/vxf/sum.c
+++ /dev/null
@@ -1,356 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-#include <vdb/xform.h>
-#include <arch-impl.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-/* optional constant */
-typedef union sum_data sum_data;
-union sum_data
-{
-    int8_t i8;
-    int16_t i16;
-    int32_t i32;
-    int64_t i64;
-
-    uint8_t u8;
-    uint16_t u16;
-    uint32_t u32;
-    uint64_t u64;
-
-    float f32;
-    double f64;
-};
-
-#define FULL_SUM_NAME( T )                                               \
-    full_sum_ ## T
-#define FULL_SUM( T, k )                                                 \
-static                                                                   \
-rc_t CC FULL_SUM_NAME ( T ) ( void *data,                                   \
-    const VXformInfo *info, int64_t row_id, const VFixedRowResult *rslt, \
-    uint32_t argc, const VRowData argv [] )                              \
-{                                                                        \
-    uint32_t i, j;                                                       \
-    const sum_data *self = ( const void* ) data;                         \
-                                                                         \
-    T *dst = rslt -> base;                                               \
-    const T *a = argv [ 0 ] . u . data . base;                           \
-    const T *b = argv [ 1 ] . u . data . base;                           \
-                                                                         \
-    for ( i = 0, dst += rslt -> first_elem,                              \
-              a += argv [ 0 ] . u . data . first_elem,                   \
-              b += argv [ 1 ] . u . data . first_elem;                   \
-          i < rslt -> elem_count; ++ i )                                 \
-    {                                                                    \
-        dst [ i ] = a [ i ] + b [ i ] + self -> k;                       \
-        for ( j = 2; j < argc; ++ j )                                    \
-        {                                                                \
-            const T *c = argv [ j ] . u . data . base;                   \
-            dst [ i ] += c [ argv [ j ] . u . data . first_elem + i ];   \
-        }                                                                \
-    }                                                                    \
-                                                                         \
-    return 0;                                                            \
-}
-
-FULL_SUM ( int8_t, i8 )
-FULL_SUM ( int16_t, i16 )
-FULL_SUM ( int32_t, i32 )
-FULL_SUM ( int64_t, i64 )
-FULL_SUM ( uint8_t, u8 )
-FULL_SUM ( uint16_t, u16 )
-FULL_SUM ( uint32_t, u32 )
-FULL_SUM ( uint64_t, u64 )
-FULL_SUM ( float, f32 )
-FULL_SUM ( double, f64 )
-
-static VFixedRowFunc full_sum_func [] =
-{
-    FULL_SUM_NAME ( uint8_t ),
-    FULL_SUM_NAME ( uint16_t ),
-    FULL_SUM_NAME ( uint32_t ),
-    FULL_SUM_NAME ( uint64_t ),
-    FULL_SUM_NAME ( int8_t ),
-    FULL_SUM_NAME ( int16_t ),
-    FULL_SUM_NAME ( int32_t ),
-    FULL_SUM_NAME ( int64_t ),
-    NULL,
-    NULL,
-    FULL_SUM_NAME ( float ),
-    FULL_SUM_NAME ( double )
-};
-
-#define CONST_SUM_NAME( T )                                              \
-    const_sum_ ## T
-#define CONST_SUM( T, k )                                                \
-static                                                                   \
-rc_t CC CONST_SUM_NAME ( T ) ( void *data, const VXformInfo *info,          \
-    void *rslt, const void *src, uint64_t elem_count )                   \
-{                                                                        \
-    uint32_t i;                                                          \
-    const sum_data *self = ( const void* ) data;                         \
-                                                                         \
-    T *dst = rslt;                                                       \
-    const T *a = src;                                                    \
-                                                                         \
-    for ( i = 0; i < elem_count; ++ i )                                  \
-    {                                                                    \
-        dst [ i ] = a [ i ] + self -> k;                                 \
-    }                                                                    \
-                                                                         \
-    return 0;                                                            \
-}
-
-CONST_SUM ( int8_t, i8 )
-CONST_SUM ( int16_t, i16 )
-CONST_SUM ( int32_t, i32 )
-CONST_SUM ( int64_t, i64 )
-CONST_SUM ( uint8_t, u8 )
-CONST_SUM ( uint16_t, u16 )
-CONST_SUM ( uint32_t, u32 )
-CONST_SUM ( uint64_t, u64 )
-CONST_SUM ( float, f32 )
-CONST_SUM ( double, f64 )
-
-static VArrayFunc const_sum_func [] =
-{
-    CONST_SUM_NAME ( uint8_t ),
-    CONST_SUM_NAME ( uint16_t ),
-    CONST_SUM_NAME ( uint32_t ),
-    CONST_SUM_NAME ( uint64_t ),
-    CONST_SUM_NAME ( int8_t ),
-    CONST_SUM_NAME ( int16_t ),
-    CONST_SUM_NAME ( int32_t ),
-    CONST_SUM_NAME ( int64_t ),
-    NULL,
-    NULL,
-    CONST_SUM_NAME ( float ),
-    CONST_SUM_NAME ( double )
-};
-
-#define NO_CONST_NAME( T )                                               \
-    no_const_ ## T
-#define NO_CONST( T )                                                    \
-static                                                                   \
-rc_t CC NO_CONST_NAME ( T ) ( void *data,                                   \
-    const VXformInfo *info, int64_t row_id, const VFixedRowResult *rslt, \
-    uint32_t argc, const VRowData argv [] )                              \
-{                                                                        \
-    uint32_t i;                                                          \
-                                                                         \
-    T *dst = rslt -> base;                                               \
-    const T *a = argv [ 0 ] . u . data . base;                           \
-    const T *b = argv [ 1 ] . u . data . base;                           \
-                                                                         \
-    for ( i = 0, dst += rslt -> first_elem,                              \
-              a += argv [ 0 ] . u . data . first_elem,                   \
-              b += argv [ 1 ] . u . data . first_elem;                   \
-          i < rslt -> elem_count; ++ i )                                 \
-    {                                                                    \
-        dst [ i ] = a [ i ] + b [ i ];                                   \
-    }                                                                    \
-                                                                         \
-    return 0;                                                            \
-}
-
-NO_CONST ( int8_t )
-NO_CONST ( int16_t )
-NO_CONST ( int32_t )
-NO_CONST ( int64_t )
-NO_CONST ( uint8_t )
-NO_CONST ( uint16_t )
-NO_CONST ( uint32_t )
-NO_CONST ( uint64_t )
-NO_CONST ( float )
-NO_CONST ( double )
-
-static VFixedRowFunc no_const_func [] =
-{
-    NO_CONST_NAME ( uint8_t ),
-    NO_CONST_NAME ( uint16_t ),
-    NO_CONST_NAME ( uint32_t ),
-    NO_CONST_NAME ( uint64_t ),
-    NO_CONST_NAME ( int8_t ),
-    NO_CONST_NAME ( int16_t ),
-    NO_CONST_NAME ( int32_t ),
-    NO_CONST_NAME ( int64_t ),
-    NULL,
-    NULL,
-    NO_CONST_NAME ( float ),
-    NO_CONST_NAME ( double )
-};
-
-static
-rc_t CC no_sum ( void *data, const VXformInfo *info,
-    void *dst, const void *src, uint64_t elem_count )
-{
-    memcpy ( dst, src, (size_t)( elem_count * VTypedescSizeof ( & info -> fdesc . desc ) >> 3 ) );
-    return 0;
-}
-
-static
-void CC vxf_sum_wrapper( void *ptr )
-{
-	free( ptr );
-}
-
-/* sum
- *  return the sum of inputs
- *
- *  "T" [ TYPE ] - input and output data type
- *  must be member of numeric_set
- *
- *  "k" [ CONST, DEFAULT 0 ] - optional constant
- *  to be added
- *
- *  "a" [ DATA ] - left-most operand
- *
- * SYNOPSIS:
- *  incorporates "k" into expression for every row
- *  returns sum or sumerence of inputs for all rows
- */
-VTRANSFACT_IMPL ( vdb_sum, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    bool has_const;
-    int32_t size_idx;
-    sum_data k;
-
-    /* "T" must be member of numeric_set */
-    switch ( info -> fdesc . desc . domain )
-    {
-    case vtdUint:
-    case vtdInt:
-    case vtdFloat:
-        break;
-    default:
-        return RC ( rcXF, rcFunction, rcConstructing, rcType, rcIncorrect );
-    }
-
-    /* TBD - eventually support vector sums
-       for today, check that dim of T is 1 */
-    if ( dp -> argv [ 0 ] . desc . intrinsic_dim != 1 )
-        return RC ( rcXF, rcFunction, rcConstructing, rcType, rcIncorrect );
-
-    /* the only numeric types we support are between 8 and 64 bits */
-    size_idx = uint32_lsbit ( dp -> argv [ 0 ] . desc . intrinsic_bits ) - 3;
-    if ( size_idx < 0 || size_idx > 3 || ( ( dp -> argv [ 0 ] . desc . intrinsic_bits &
-                                             ( dp -> argv [ 0 ] . desc . intrinsic_bits - 1 ) ) != 0 ) )
-        return RC ( rcXF, rcFunction, rcConstructing, rcType, rcIncorrect );
-
-
-    /* there are 5 variants:
-       1. no constant ( or is 0 ) and single input
-       2. non-zero constant and single input
-       3. no constant ( or is 0 ) and dual input
-       4. non-zero constant and dual input
-       5. more than 2 inputs */
-    has_const = false;
-    if ( cp -> argc == 0 )
-        memset ( & k, 0, sizeof k );
-    else switch ( cp -> argv [ 0 ] . desc . domain )
-    {
-    case vtdUint:
-    case vtdInt:
-        switch ( cp -> argv [ 0 ] . desc . intrinsic_bits )
-        {
-        case 8:
-            if ( ( k . u8 = cp -> argv [ 0 ] . data . u8 [ 0 ] ) != 0 )
-                has_const = true;
-            break;
-        case 16:
-            if ( ( k . u16 = cp -> argv [ 0 ] . data . u16 [ 0 ] ) != 0 )
-                has_const = true;
-            break;
-        case 32:
-            if ( ( k . u32 = cp -> argv [ 0 ] . data . u32 [ 0 ] ) != 0 )
-                has_const = true;
-            break;
-        case 64:
-            if ( ( k . u64 = cp -> argv [ 0 ] . data . u64 [ 0 ] ) != 0 )
-                has_const = true;
-            break;
-        }
-        break;
-
-    case vtdFloat:
-        switch ( cp -> argv [ 0 ] . desc . intrinsic_bits )
-        {
-        case 32:
-            if ( ( k . f32 = cp -> argv [ 0 ] . data . f32 [ 0 ] ) != 0.0 )
-                has_const = true;
-            break;
-        case 64:
-            if ( ( k . f64 = cp -> argv [ 0 ] . data . f64 [ 0 ] ) != 0.0 )
-                has_const = true;
-            break;
-        }
-        break;
-    }
-
-    if ( has_const || dp -> argc > 2 )
-    {
-        sum_data *pb = malloc ( sizeof * pb );
-        if ( pb == NULL )
-            return RC ( rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted );
-        * pb = k;
-        
-        rslt -> self = pb;
-        rslt -> whack = vxf_sum_wrapper;
-
-        if ( dp -> argc > 1 )
-        {
-            rslt -> u . pf = full_sum_func [ ( dp -> argv [ 0 ] . desc . domain - vtdUint ) * 4 + size_idx ];
-            rslt -> variant = vftFixedRow;
-        }
-        else
-        {
-            rslt -> u . af = const_sum_func [ ( dp -> argv [ 0 ] . desc . domain - vtdUint ) * 4 + size_idx ];
-            rslt -> variant = vftArray;
-        }
-    }
-    else
-    {
-        if ( dp -> argc > 1 )
-        {
-            rslt -> u . pf = no_const_func [ ( dp -> argv [ 0 ] . desc . domain - vtdUint ) * 4 + size_idx ];
-            rslt -> variant = vftFixedRow;
-        }
-        else
-        {
-            rslt -> u . af = no_sum;
-            rslt -> variant = vftArray;
-        }
-    }
-
-    return 0;
-}
diff --git a/libs/vxf/trim.c b/libs/vxf/trim.c
deleted file mode 100644
index a32678e..0000000
--- a/libs/vxf/trim.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-#include <vdb/xform.h>
-#include <vdb/table.h>
-#include <vdb/vdb-priv.h>
-#include <klib/rc.h>
-#include <klib/data-buffer.h>
-#include <klib/log.h>
-#include <arch-impl.h>
-
-
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-typedef struct trim_self_struct {
-	union {
-	    int8_t i8;
-	    int16_t i16;
-	    int32_t i32;
-	    int64_t i64;
-
-	    uint8_t u8;
-	    uint16_t u16;
-	    uint32_t u32;
-	    uint64_t u64;
-
-	    float f32;
-	    double f64;
-	} el;
-	uint8_t side;
-} self_t;
-
-
-#define TRIM_NAME( T ) trim_ ## T
-
-#define FUNC_TRIM( T, K )                                               \
-static rc_t CC TRIM_NAME ( T ) ( void *data,                            \
-    const VXformInfo *info, int64_t row_id, VRowResult *rslt,           \
-    uint32_t argc, const VRowData argv [] )                             \
-{                                                                       \
-    rc_t rc = 0;                                                        \
-    const self_t *self = data;                                          \
-    uint32_t start = 0;                                                 \
-    uint32_t stop = argv[0].u.data.elem_count;                          \
-    const T *a = argv[0].u.data.base;                                   \
-    a += argv[0].u.data.first_elem;                                     \
-    if (self->side == 0) {                                              \
-        while (start != stop && a[start] == self->el.K)                 \
-            ++start;                                                    \
-    }                                                                   \
-    else {                                                              \
-        while (start != stop && a[stop - 1]  == self->el.K)             \
-            --stop;                                                     \
-    }                                                                   \
-    rslt->elem_count = stop - start;                                    \
-    if (rslt->elem_count > 0) {                                         \
-        rc = KDataBufferResize(rslt->data, rslt->elem_count);           \
-        if (rc == 0)                                                    \
-            memcpy(rslt->data->base, a + start, rslt->elem_count);      \
-    }                                                                   \
-    return rc;                                                          \
-}
-#if 1
-FUNC_TRIM ( uint8_t, u8 )
-#else
-static									 
-rc_t CC trim_uint8_t ( void *data,                                	 
-    const VXformInfo *info, int64_t row_id, VRowResult *rslt,		 
-    uint32_t argc, const VRowData argv [] )                              
-{                                                                        
-    rc_t rc = 0;
-    const self_t *self = data;						 
-    uint32_t start = 0;						
-    uint32_t stop = argv[0].u.data.elem_count;			
-    const uint8_t *a = argv[0].u.data.base;
-    
-    a += argv[0].u.data.first_elem;
-    
-    if (self->side == 0) { /*** left side trim ****/			 
-        while (start != stop && a[start] == self->el.u8)
-            ++start;
-    }
-    else {
-        while (start != stop && a[stop - 1]  == self->el.u8)
-            --stop;
-    }
-    rslt->elem_count = stop - start;
-    if (rslt->elem_count > 0) {
-        rc = KDataBufferResize(rslt->data, rslt->elem_count);
-        if (rc == 0)
-            memcpy(rslt->data->base, a + start, rslt->elem_count);
-    }
-    return rc;
-}
-#endif
-FUNC_TRIM ( int8_t, i8 )
-FUNC_TRIM ( int16_t, i16 )
-FUNC_TRIM ( int32_t, i32 )
-FUNC_TRIM ( int64_t, i64 )
-FUNC_TRIM ( uint16_t, u16 )
-FUNC_TRIM ( uint32_t, u32 )
-FUNC_TRIM ( uint64_t, u64 )
-FUNC_TRIM ( float, f32 )
-FUNC_TRIM ( double, f64 )
-
-static VRowFunc trim_func_set [] =
-{
-    TRIM_NAME ( uint8_t ),
-    TRIM_NAME ( uint16_t ),
-    TRIM_NAME ( uint32_t ),
-    TRIM_NAME ( uint64_t ),
-    TRIM_NAME ( int8_t ),
-    TRIM_NAME ( int16_t ),
-    TRIM_NAME ( int32_t ),
-    TRIM_NAME ( int64_t ),
-    NULL,
-    NULL,
-    TRIM_NAME ( float ),
-    TRIM_NAME ( double )
-};
-
-static
-void CC self_whack( void *ptr )
-{
-	free( ptr );
-}
-
-VTRANSFACT_IMPL ( vdb_trim, 1, 0, 0 ) ( const void *Self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    int32_t size_idx;
-    self_t self;
-
-    self.el.u64 = 0;
-
-    self.side=cp -> argv [ 0 ] . data . u8 [ 0 ];
-
-    /* "T" must be member of numeric_set */
-    switch ( info -> fdesc . desc . domain )
-    {
-    case vtdUint:
-    case vtdInt:
-    case vtdFloat:
-        break;
-    default:
-        return RC ( rcXF, rcFunction, rcConstructing, rcType, rcIncorrect );
-    }
-
-    if ( dp -> argv [ 0 ] . desc . intrinsic_dim != 1 )
-        return RC ( rcXF, rcFunction, rcConstructing, rcType, rcIncorrect );
-
-    /* the only numeric types we support are between 8 and 64 bits */
-    size_idx = uint32_lsbit ( dp -> argv [ 0] . desc . intrinsic_bits ) - 3;
-    if ( size_idx < 0 || size_idx > 3 || ( ( dp -> argv [ 0 ] . desc . intrinsic_bits &
-                                             ( dp -> argv [ 0 ] . desc . intrinsic_bits - 1 ) ) != 0 ) )
-        return RC ( rcXF, rcFunction, rcConstructing, rcType, rcIncorrect );
-
-
-    switch ( cp -> argv [ 1 ] . desc . domain )
-    {
-    case vtdUint:
-    case vtdInt:
-        switch ( cp -> argv [ 1 ] . desc . intrinsic_bits )
-        {
-        case 8:
-	    self . el . u8 = cp -> argv [ 1 ] . data . u8 [ 0 ];
-            break;
-        case 16:
-	    self . el . u16 = cp -> argv [ 1 ] . data . u16 [ 0 ];
-            break;
-        case 32:
-	    self . el . u32 = cp -> argv [ 1 ] . data . u32 [ 0 ];
-            break;
-        case 64:
-            self . el . u64 = cp -> argv [ 1 ] . data . u64 [ 0 ];
-            break;
-	default: return RC ( rcXF, rcFunction, rcConstructing, rcType, rcIncorrect );
-        }
-        break;
-
-    case vtdFloat:
-        switch ( cp -> argv [ 1 ] . desc . intrinsic_bits )
-        {
-        case 32:
-            self . el . f32 = cp -> argv [ 1 ] . data . f32 [ 0 ];
-            break;
-        case 64:
-            self . el . f64 = cp -> argv [ 1 ] . data . f64 [ 0 ];
-            break;
-	default: return RC ( rcXF, rcFunction, rcConstructing, rcType, rcIncorrect );
-        }
-        break;
-    default: return RC ( rcXF, rcFunction, rcConstructing, rcType, rcIncorrect );
-    }
-    rslt -> self = malloc ( sizeof self );
-    memcpy(rslt -> self,&self,sizeof(self));
-    rslt -> whack = self_whack;
-    rslt -> u . rf = trim_func_set [ ( dp -> argv [ 0 ] . desc . domain - vtdUint ) * 4 + size_idx ];
-    rslt -> variant = vftRow;
-
-    return 0;
-}
diff --git a/libs/vxf/trunc.c b/libs/vxf/trunc.c
deleted file mode 100644
index b9a1285..0000000
--- a/libs/vxf/trunc.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <sysalloc.h>
-
-#include <assert.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <math.h>
-
-#define FLOAT_FUNC truncf
-#define DOUBLE_FUNC trunc
-#include "math-funcs-impl.h"
-
-/*
- function < type T >
- T vdb:trunc #1.0 ( T in );
- */
-VTRANSFACT_IMPL(vdb_trunc, 1, 0, 0) (const void *self, const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp ) {
-    return factory(self, info, rslt, cp, dp);
-}
diff --git a/libs/vxf/undelta.c b/libs/vxf/undelta.c
deleted file mode 100644
index 5c3187c..0000000
--- a/libs/vxf/undelta.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-#include <vdb/xform.h>
-#include <arch-impl.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-
-
-#define UNDELTA_NAME( T )  undelta_ ## T
-#define UNDELTA( T )                                                       \
-static                                                                   \
-rc_t CC UNDELTA_NAME ( T ) ( void *data,                                   \
-    const VXformInfo *info,  void *rslt, const void *input,              \
-    uint64_t elem_count)                                                 \
-{                                                                        \
-    uint32_t i;                                                          \
-    T *dst       = (T*) rslt;                                            \
-    const T *src = (const T*) input;                                     \
-    if(elem_count >0) {							 \
-        dst [ 0 ] = src [ 0 ];						 \
-	for ( i = 1; i < elem_count; ++ i ) {                            \
-	    dst [ i ] = src [ i ] + dst [ i - 1 ];                       \
-	}                                                                \
-    }									 \
-    return 0;                                                            \
-}
-
-UNDELTA ( int8_t )
-UNDELTA ( int16_t )
-UNDELTA ( int32_t )
-UNDELTA ( int64_t )
-
-static VArrayFunc undelta_func [] =
-{
-    UNDELTA_NAME ( int8_t  ),
-    UNDELTA_NAME ( int16_t ),
-    UNDELTA_NAME ( int32_t ),
-    UNDELTA_NAME ( int64_t )
-};
-/* undelta
- *  return restoration from 1st derivative of inputs
- *
- *  "T" [ TYPE ] - input and output data type
- *  must be member of  signed integers
- *
- *  "a" [ DATA ] - operand
- *
- *
- * SYNOPSIS:
- *  return restoration of 1st derivative for the whole blob
- *
- * USAGE:
- *    I32 A = < I32 > undelta ( B );
- */
-VTRANSFACT_IMPL ( vdb_undelta, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    int size_idx;
-    if ( info -> fdesc . desc . domain != vtdInt)
-    {
-        return RC ( rcXF, rcFunction, rcConstructing, rcType, rcIncorrect );
-    }
-
-    /* TBD - eventually support vector derivatives
-       for today, check that dim of T is 1 */
-    if ( dp -> argv [ 0 ] . desc . intrinsic_dim != 1 )
-        return RC ( rcXF, rcFunction, rcConstructing, rcType, rcIncorrect );
-
-    /* the only numeric types we support are between 8 and 64 bits */
-    size_idx = uint32_lsbit ( dp -> argv [ 0 ] . desc . intrinsic_bits ) - 3;
-    if ( size_idx < 0 || size_idx > 3 || ( ( dp -> argv [ 0 ] . desc . intrinsic_bits &
-                                             ( dp -> argv [ 0 ] . desc . intrinsic_bits - 1 ) ) != 0 ) )
-        return RC ( rcXF, rcFunction, rcConstructing, rcType, rcIncorrect );
-
-
-    rslt -> u . af = undelta_func [ size_idx ];
-    rslt -> variant = vftArray;
-
-    return 0;
-}
diff --git a/libs/vxf/unpack.c b/libs/vxf/unpack.c
deleted file mode 100644
index d15ae31..0000000
--- a/libs/vxf/unpack.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <sysalloc.h>
-#include <klib/pack.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-
-typedef struct self_t self_t;
-struct self_t
-{
-    VTypedesc sdesc;
-    VTypedesc ddesc;
-    uint32_t sbits;
-};
-
-static
-rc_t CC unpack_func( void *Self, const VXformInfo *info,
-    void *dst, const void *src, uint64_t elem_count )
-{
-    size_t usize;
-    const self_t *self = ( const void* ) Self;
-    bitsz_t ssize = elem_count * VTypedescSizeof ( & self -> sdesc );
-    size_t dsize = (elem_count * VTypedescSizeof ( & self -> ddesc ) + 7) >> 3;
-
-    return Unpack( self -> sbits, self -> ddesc.intrinsic_bits,
-        src, 0, ssize, NULL,
-        dst, dsize, &usize );
-}
-
-static
-void CC vxf_unpack_wrapper( void *ptr )
-{
-    free( ptr );
-}
-
-/* 
- */
-VTRANSFACT_IMPL ( vdb_unpack, 1, 0, 0 ) ( const void *ignore, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    self_t *self = malloc ( sizeof * self );
-    if ( self == NULL )
-        return RC ( rcVDB, rcFunction, rcConstructing, rcMemory, rcExhausted );
-
-    assert (dp->argc == 1);
-    self->sdesc = dp->argv[0].desc;
-    self->ddesc = info->fdesc.desc;
-    self->sbits = VTypedescSizeof ( & dp->argv[0].desc );
-        
-    rslt->self = self;
-    rslt->whack = vxf_unpack_wrapper;
-        
-    rslt->variant = vftArray;
-    rslt->u.af = unpack_func;
-        
-    return 0;
-}
-
-VTRANSFACT_IMPL ( NCBI_unpack, 1, 0, 0 ) ( const void *ignore, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    self_t *self = malloc ( sizeof * self );
-    if ( self == NULL )
-        return RC ( rcVDB, rcFunction, rcConstructing, rcMemory, rcExhausted );
-
-    assert ( dp -> argc == 1 );
-
-    assert ( cp -> argc == 2 );
-    assert ( cp -> argv [ 0 ] . desc . intrinsic_bits == 32 );
-    assert ( cp -> argv [ 0 ] . desc . domain == vtdUint );
-
-    self->sdesc = dp->argv[0].desc;
-    self -> ddesc . intrinsic_bits = cp -> argv [ 1 ] . data . u32 [ 0 ];
-    self -> ddesc . intrinsic_dim = 1;
-    self -> ddesc . domain = 0;
-    self -> sbits = cp -> argv [ 0 ] . data . u32 [ 0 ];
-
-    rslt->self = self;
-    rslt->whack = vxf_unpack_wrapper;
-        
-    rslt->variant = vftArray;
-    rslt->u.af = unpack_func;
-        
-    return 0;
-}
diff --git a/libs/vxf/unzip.c b/libs/vxf/unzip.c
deleted file mode 100644
index f39aabb..0000000
--- a/libs/vxf/unzip.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <vdb/vdb-priv.h>
-#include <klib/data-buffer.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <endian.h>
-#include <byteswap.h>
-#include <string.h>
-#include <zlib.h>
-#include <assert.h>
-
-static rc_t invoke_zlib(void *dst, size_t dsize, const void *src, size_t ssize, int windowBits)
-{
-    int zr;
-    rc_t rc = 0;
-
-    z_stream s;
-    memset ( & s, 0, sizeof s );
-
-    s.next_in = (void *)src;
-    s.avail_in = ssize;
-    s.next_out = dst;
-    s.avail_out = dsize;
-    
-    zr = inflateInit2(&s, windowBits);
-    switch (zr)
-    {
-        case Z_OK:
-            break;
-        case Z_MEM_ERROR:
-            return RC(rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted);
-        default:
-            return RC(rcXF, rcFunction, rcExecuting, rcNoObj, rcUnexpected);
-    }
-    zr = inflate(&s, Z_FINISH);
-    switch (zr)
-    {
-    case Z_STREAM_END:
-        break;
-    case Z_OK:         /* progress but not complete */
-    case Z_BUF_ERROR:  /* no progress - need more output buffer */
-        rc = RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-        break;
-    case Z_NEED_DICT:
-    case Z_DATA_ERROR:
-        rc = RC(rcXF, rcFunction, rcExecuting, rcData, rcCorrupt);
-        break;
-    case Z_MEM_ERROR:
-        rc = RC(rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted);
-        break;
-    default:
-        rc = RC(rcXF, rcFunction, rcExecuting, rcNoObj, rcUnexpected);
-        break;
-    }
-    zr = inflateEnd(&s);
-    switch (zr)
-    {
-        case Z_OK:
-            break;
-        default:
-            if (rc == 0)
-                rc = RC(rcXF, rcFunction, rcExecuting, rcData, rcCorrupt);
-    }
-
-    return rc;
-}
-
-static
-rc_t unzip_func_v1(
-                   const VXformInfo *info,
-                   VBlobResult *dst,
-                   const VBlobData *src
-) {
-    dst->byte_order = src->byte_order;
-    return invoke_zlib(dst->data, (((size_t)dst->elem_count * dst->elem_bits + 7) >> 3),
-                       src->data, (((size_t)src->elem_count * src->elem_bits + 7) >> 3),
-                       -15);
-}
-
-static
-rc_t unzip_func_v2(
-                   const VXformInfo *info,
-                   VBlobResult *dst,
-                   const VBlobData *src,
-                   VBlobHeader *hdr
-) {
-    int64_t trailing;
-    rc_t rc = VBlobHeaderArgPopHead ( hdr, & trailing );
-    if ( rc == 0 )
-    {
-        dst -> elem_count *= dst -> elem_bits;
-        dst -> byte_order = src -> byte_order;
-        dst -> elem_bits = 1;
-
-        /* the feed to zlib MUST be byte aligned
-           so the output must be as well */
-        assert ( ( dst -> elem_count & 7 ) == 0 );
-        rc = invoke_zlib(dst->data, (((size_t)dst->elem_count) >> 3),
-                         src->data, (((size_t)src->elem_count * src->elem_bits + 7) >> 3),
-                         -15);
-
-        /* if the original, uncompressed source was NOT byte aligned,
-           back off the rounded up byte and add in the original bit count */
-        if ( rc == 0 && trailing != 0 )
-            dst -> elem_count -= 8 - trailing;
-    }
-
-    return rc;
-}
-
-static
-rc_t CC legacy_unzip_func ( void *self, const VXformInfo *info,
-    VLegacyBlobResult *rslt, const KDataBuffer *src )
-{
-    rc_t rc;
-    KDataBuffer *dst = rslt -> dst;
-    const uint32_t *in = src -> base;
-#if __BYTE_ORDER == __BIG_ENDIAN
-    uint64_t bits = bswap_32 ( in [ 0 ] );
-#else
-    uint64_t bits = in [ 0 ];
-#endif
-
-    do
-    {
-        size_t const bytes = ( size_t ) ( ( bits + 7 ) >> 3 ) + 64;
-        
-        if ( ( ( uint64_t ) bytes << 3 ) < bits )
-        {
-            rc = RC(rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted);
-            break;
-        }
-
-        dst -> elem_bits = 8;
-        rc = KDataBufferResize ( dst, bytes );
-        if ( rc != 0 )
-            break;
-
-        rc = invoke_zlib ( dst -> base, bytes, & in [ 1 ], (size_t)KDataBufferBytes ( src ) - 4, 15 );
-        if ( rc == 0 )
-        {
-            dst -> elem_bits = 1;
-            dst -> elem_count = bits;
-            break;
-        }
-
-        /* in hopes that this is a 32-bit overflow, try increasing bits */
-        bits += ( uint64_t ) 1U << 32;
-        if ( ( bits >> 32 ) == 16 )
-            break;
-    }
-    while ( GetRCState ( rc ) == rcInsufficient && GetRCObject ( rc ) == rcBuffer );
-
-    return rc;
-}
-
-
-static
-rc_t CC unzip_func(
-                void *Self,
-                const VXformInfo *info,
-                VBlobResult *dst,
-                const VBlobData *src,
-                VBlobHeader *hdr
-) {
-    int const version = VBlobHeaderVersion(hdr);
-    
-    switch (version) {
-    case 1:
-        return unzip_func_v1(info, dst, src);
-        break;
-    case 2:
-        return unzip_func_v2(info, dst, src, hdr);
-        break;
-    default:
-        return RC(rcXF, rcFunction, rcExecuting, rcParam, rcBadVersion);
-    }
-}
-
-/* unzip
- *  function any unzip #1.0 ( zlib_fmt in );
- */
-VTRANSFACT_IMPL ( vdb_unzip, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt->variant = vftBlob;
-    rslt->u.bf = unzip_func;
-
-    return 0;
-}
-
-/* NCBI:unzip
- *  function any NCBI:unzip #1.0 ( NCBI:zlib_encoded_t in );
- */
-VTRANSFACT_IMPL ( NCBI_unzip, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    VNoHdrBlobFunc f = legacy_unzip_func;
-    rslt->variant = vftLegacyBlob;
-    rslt->u.bf = ( VBlobFunc ) f;
-
-    return 0;
-}
diff --git a/libs/vxf/vec-sum.c b/libs/vxf/vec-sum.c
deleted file mode 100644
index 9903124..0000000
--- a/libs/vxf/vec-sum.c
+++ /dev/null
@@ -1,239 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include <vdb/extern.h>
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <klib/data-buffer.h>
-#include <sysalloc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <math.h>
-#include <assert.h>
-
-typedef void (*math_f)(void *const dst,
-                       void const *const src, uint32_t const offset,
-                       uint32_t const vec_length, uint32_t const vec_count);
-typedef struct self_t {
-    uint32_t vec_length;
-    math_f f;
-} self_t;
-
-#define FUNC(VALTYPE) F_ ## VALTYPE
-
-#define FUNC_DEF(VALTYPE) \
-static void FUNC(VALTYPE)(void *Dst, void const *Src, uint32_t const offset, uint32_t const vec_length, uint32_t const vec_count) { \
-    VALTYPE sum; \
-    VALTYPE *const dst = (VALTYPE *)Dst; \
-    VALTYPE const *const src = &((VALTYPE const *)Src)[offset]; \
-    uint32_t i; \
-    uint32_t j; \
-    uint32_t k; \
-    \
-    for (i = k = 0; i != vec_count; ++i) { \
-        for (sum = 0, j = 0; j != vec_length; ++j, ++k) \
-            sum += src[k]; \
-        dst[i] = sum; \
-    } \
-}
-
-FUNC_DEF(float)
-FUNC_DEF(double)
-FUNC_DEF(uint8_t)
-FUNC_DEF(uint16_t)
-FUNC_DEF(uint32_t)
-FUNC_DEF(uint64_t)
-FUNC_DEF(int8_t)
-FUNC_DEF(int16_t)
-FUNC_DEF(int32_t)
-FUNC_DEF(int64_t)
-
-static
-rc_t CC vec_sum_row_func(void *const Self,
-                         VXformInfo const *info,
-                         int64_t const row_id,
-                         VRowResult *const rslt,
-                         uint32_t const argc,
-                         VRowData const argv[])
-{
-    self_t const *self = Self;
-    rc_t rc;
-    
-    assert(argc == 1);
-    
-    rslt->data->elem_bits = rslt->elem_bits;
-    rc = KDataBufferResize(rslt->data, rslt->elem_count = 1);
-    if (rc == 0) {
-        self->f(rslt->data->base,
-                argv[0].u.data.base, argv[0].u.data.first_elem,
-                argv[0].u.data.elem_count, 1);
-    }
-    return rc;
-}
-
-static
-rc_t CC vec_sum_array_func(
-                void *Self,
-                const VXformInfo *info,
-                void *dst,
-                const void *src,
-                uint64_t elem_count
-) {
-    const self_t *self = Self;
-    
-    assert(elem_count % self->vec_length == 0);
-    assert((elem_count / self->vec_length) >> 32 == 0);
-    self->f(dst, src, 0, self->vec_length, (uint32_t)(elem_count / self->vec_length));
-    return 0;
-}
-
-static
-void CC vxf_vec_sum_wrapper( void *ptr )
-{
-	free( ptr );
-}
-
-rc_t vec_sum_make(self_t **const rslt,
-                  VXfactInfo const *const info,
-                  VFunctionParams const *const dp)
-{
-    self_t *self;
-    rc_t rc = 0;
-    
-    self = malloc(sizeof(*self));
-    if (self == NULL)
-        rc = RC(rcVDB, rcFunction, rcConstructing, rcMemory, rcExhausted);
-    else {
-        self->vec_length = dp->argv[0].fd.td.dim;
-        
-        switch (info->fdesc.desc.intrinsic_bits) {
-        case 8:
-            switch (info->fdesc.desc.domain) {
-            case vtdInt:
-                self->f = FUNC(int8_t);
-                break;
-            case vtdUint:
-                self->f = FUNC(uint8_t);
-                break;
-            default:
-                rc = RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-            }
-            break;
-        case 16:
-            switch (info->fdesc.desc.domain) {
-            case vtdInt:
-                self->f = FUNC(int16_t);
-                break;
-            case vtdUint:
-                self->f = FUNC(uint16_t);
-                break;
-            default:
-                rc = RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-            }
-            break;
-        case 32:
-            switch (info->fdesc.desc.domain) {
-            case vtdInt:
-                self->f = FUNC(int32_t);
-                break;
-            case vtdUint:
-                self->f = FUNC(uint32_t);
-                break;
-            case vtdFloat:
-                self->f = FUNC(float);
-                break;
-            default:
-                rc = RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-            }
-            break;
-        case 64:
-            switch (info->fdesc.desc.domain) {
-            case vtdInt:
-                self->f = FUNC(int64_t);
-                break;
-            case vtdUint:
-                self->f = FUNC(uint64_t);
-                break;
-            case vtdFloat:
-                self->f = FUNC(double);
-                break;
-            default:
-                rc = RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-            }
-            break;
-        default:
-            rc = RC(rcVDB, rcFunction, rcConstructing, rcParam, rcInvalid);
-        }
-        if (rc) {
-            free(self);
-            self = NULL;
-        }
-    }
-    *rslt = self;
-    return rc;
-}
-
-VTRANSFACT_IMPL(vdb_vec_sum, 1, 0, 0)(const void *Self,
-                                      const VXfactInfo *info,
-                                      VFuncDesc *rslt,
-                                      const VFactoryParams *cp,
-                                      const VFunctionParams *dp)
-{
-    self_t *self;
-    rc_t rc = vec_sum_make(&self, info, dp);
-    
-    if (rc == 0) {
-        rslt->self = self;
-        rslt->whack = vxf_vec_sum_wrapper;
-        rslt->variant = vftRow;
-        rslt->u.rf = vec_sum_row_func;
-    }
-    return rc;
-}
-
-/*
- function < type T, U32 dim >
- T vec_sum #1.0 ( T [ dim ] in )
- */
-VTRANSFACT_IMPL(vdb_fixed_vec_sum, 1, 0, 0)(const void *Self,
-                                            const VXfactInfo *info,
-                                            VFuncDesc *rslt,
-                                            const VFactoryParams *cp,
-                                            const VFunctionParams *dp)
-{
-    self_t *self;
-    rc_t rc = vec_sum_make(&self, info, dp);
-    
-    if (rc == 0) {
-        rslt->self = self;
-        rslt->whack = vxf_vec_sum_wrapper;
-        rslt->variant = vftArray;
-        rslt->u.af = vec_sum_array_func;
-    }
-    return rc;
-}
diff --git a/libs/vxf/wgs-tokenize-accession.c b/libs/vxf/wgs-tokenize-accession.c
deleted file mode 100644
index 04454fc..0000000
--- a/libs/vxf/wgs-tokenize-accession.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <klib/data-buffer.h>
-#include <klib/text.h>
-#include <klib/printf.h>
-#include <klib/rc.h>
-#include <sysalloc.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-enum
-{
-    NCBI_WGS_acc_token_unrecognized = 1,
-    NCBI_WGS_acc_token_prefix,
-    NCBI_WGS_acc_token_contig
-};
-
-enum
-{
-    TTextToken_id,
-    TTextToken_start,
-    TTextToken_len
-};
-
-
-static
-uint32_t ParseWgsAccession ( uint16_t *tok, const char *acc, size_t acc_len )
-{
-    /* WGS accessions have form:
-     * [NZ_]<4-letter prefix><2-digit version><6-7 digit contig>
-     */
-    size_t i;
-
-    /* scan non-digits */
-    for ( i = 0; i < acc_len; ++ i )
-    {
-        if ( isdigit ( acc [ i ] ) )
-            break;
-    }
-
-    /* require at least 4 characters... */
-    if ( i >= 4 )
-    {
-        /* require at least 8 digits */
-        if ( acc_len - i >= 8 )
-        {
-            /* 2-digit version */
-            if ( isdigit ( acc [ ++ i ] ) )
-            {
-                /* record first token as prefix */
-                tok [ 0 + TTextToken_id ] = NCBI_WGS_acc_token_prefix;
-                tok [ 0 + TTextToken_start ] = 0;
-                tok [ 0 + TTextToken_len ] = ( uint16_t ) ++ i;
-
-                /* the remainder should be contig */
-                tok [ 3 + TTextToken_id ] = NCBI_WGS_acc_token_contig;
-                tok [ 3 + TTextToken_start ] = ( uint16_t ) i;
-                tok [ 3 + TTextToken_len ] = ( uint16_t ) ( acc_len - i );
-
-                /* verify that it is numeric */
-                for ( ; i < acc_len; ++ i )
-                {
-                    if ( ! isdigit ( acc [ i ] ) )
-                        break;
-                }
-
-                /* great success */
-                if ( i == acc_len )
-                    return 2;
-            }
-        }
-    }
-
-    tok [ 0 + TTextToken_id ] = NCBI_WGS_acc_token_unrecognized;
-    tok [ 0 + TTextToken_start ] = 0;
-    tok [ 0 + TTextToken_len ] = ( uint16_t ) acc_len;
-
-    return 1;
-}
-
-static
-rc_t CC tokenize_nuc_accession ( void *obj,
-     const VXformInfo *info, int64_t row_id, VRowResult *rslt,
-     uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    const char *acc;
-    
-    assert ( rslt -> elem_bits == 16 * 3 );
-
-    rslt -> data -> elem_bits = rslt -> elem_bits;
-    rc = KDataBufferResize ( rslt -> data, 2 );
-    if ( rc != 0 )
-        return rc;
-
-    acc = argv [ 0 ] . u . data . base;
-    acc += argv [ 0 ] . u . data . first_elem;
-
-    rslt -> elem_count = ParseWgsAccession ( rslt -> data -> base, acc, argv [ 0 ] . u . data . elem_count );
-    if ( rslt -> elem_count != 2 )
-        rc = KDataBufferResize ( rslt -> data, rslt -> elem_count );
-
-    return rc;
-}
-
-static
-uint32_t ParseProtAccession ( uint16_t *tok, const char *acc, size_t acc_len )
-{
-    /* Protein accessions generally have pattern 
-     * <Cap-letter prefix><digital suffix>
-     * If this doesn't hold, use full accession as prefix, and make suffix empty.
-     */
-    size_t i;
-
-    for ( i = 0; i < acc_len; ++ i )
-    {
-        if ( isdigit ( acc [ i ] ) )
-            break;
-    }
-
-    tok [ 0 + TTextToken_id ] = NCBI_WGS_acc_token_prefix;
-    tok [ 0 + TTextToken_start ] = 0;
-    tok [ 0 + TTextToken_len ] = ( uint16_t ) i;
-
-    for ( ; i < acc_len; ++ i )
-    {
-        if ( ! isdigit ( acc [ i ] ) )
-            break;
-    }
-
-    if ( i == acc_len )
-    {
-        tok [ 3 + TTextToken_id ] = NCBI_WGS_acc_token_contig;
-        tok [ 3 + TTextToken_start ] = tok [ 0 + TTextToken_len ];
-        tok [ 3 + TTextToken_len ] = ( uint16_t ) ( i - tok [ 0 + TTextToken_len ] );
-        return 2;
-    }
-
-    tok [ 0 + TTextToken_len ] = ( uint16_t ) acc_len;
-    return 1;
-}
-
-static
-rc_t CC tokenize_prot_accession ( void *obj,
-     const VXformInfo *info, int64_t row_id, VRowResult *rslt,
-     uint32_t argc, const VRowData argv [] )
-{
-    rc_t rc;
-    const char *acc;
-    
-    assert ( rslt -> elem_bits == 16 * 3 );
-
-    rslt -> data -> elem_bits = rslt -> elem_bits;
-    rc = KDataBufferResize ( rslt -> data, 2 );
-    if ( rc != 0 )
-        return rc;
-
-    acc = argv [ 0 ] . u . data . base;
-    acc += argv [ 0 ] . u . data . first_elem;
-
-    rslt -> elem_count = ParseProtAccession ( rslt -> data -> base, acc, argv [ 0 ] . u . data . elem_count );
-    if ( rslt -> elem_count != 2 )
-        rc = KDataBufferResize ( rslt -> data, rslt -> elem_count );
-
-    return rc;
-}
-
-VTRANSFACT_IMPL ( NCBI_WGS_tokenize_nuc_accession, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt -> u . rf = tokenize_nuc_accession;
-    rslt -> variant = vftRow;
-    return 0;
-}
-
-VTRANSFACT_IMPL ( NCBI_WGS_tokenize_prot_accession, 1, 0, 0 ) ( const void *self, const VXfactInfo *info,
-    VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    rslt -> u . rf = tokenize_prot_accession;
-    rslt -> variant = vftRow;
-    return 0;
-}
diff --git a/libs/vxf/zip.c b/libs/vxf/zip.c
deleted file mode 100644
index 44f376d..0000000
--- a/libs/vxf/zip.c
+++ /dev/null
@@ -1,214 +0,0 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <vdb/extern.h>
-
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <vdb/xform.h>
-#include <vdb/schema.h>
-#include <klib/data-buffer.h>
-#include <sysalloc.h>
-
-#include <string.h>
-#include <zlib.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#ifndef Z_MIN_LEVEL
-#define Z_MIN_LEVEL Z_DEFAULT_COMPRESSION
-#endif
-
-#ifndef Z_MAX_LEVEL
-#define Z_MAX_LEVEL Z_BEST_COMPRESSION
-#endif
-
-#ifndef Z_MIN_STRATEGY
-#define Z_MIN_STRATEGY Z_DEFAULT_STRATEGY
-#endif
-
-#ifndef Z_MAX_STRATEGY
-#define Z_MAX_STRATEGY Z_RLE
-#endif
-
-#include <stdio.h>
-#include <assert.h>
-
-#define BUFFER_GROWTH_RATE (64 * 1024)
-
-struct self_t {
-    int32_t strategy;
-    int32_t level;
-};
-
-#if _DEBUGGING
-static void debug_print_z_stream(const z_stream *s) {
-    printf("avail_in: %lu, avail_out: %lu, total_in: %lu, total_out: %lu\n",
-           (unsigned long)s->avail_in,
-           (unsigned long)s->avail_out,
-           (unsigned long)s->total_in,
-           (unsigned long)s->total_out);
-}
-#endif
-
-static rc_t invoke_zlib(void *dst, uint32_t *dsize, const void *src, uint32_t ssize, int32_t strategy, int32_t level) {
-    z_stream s;
-    int zr;
-    rc_t rc = 0;
-    
-    memset(&s, 0, sizeof(s));
-    s.next_in = (void *)src;
-    s.avail_in = ssize;
-    s.next_out = dst;
-    s.avail_out = *dsize;
-    
-    *dsize = 0;
-    zr = deflateInit2(&s, level, Z_DEFLATED, -15, 9, strategy);
-    switch (zr) {
-    case 0:
-        break;
-    case Z_MEM_ERROR:
-        return RC(rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted);
-    case Z_STREAM_ERROR:
-        return RC(rcXF, rcFunction, rcExecuting, rcParam, rcInvalid);
-    default:
-#if _DEBUGGING
-        fprintf(stderr, "deflateInit2: unexpected zlib error %i: %s (strategy: %i, level: %i)\n", zr, s.msg, strategy, level);
-#endif
-        return RC(rcXF, rcFunction, rcExecuting, rcSelf, rcUnexpected);
-    }
-    zr = deflate(&s, Z_FINISH);
-    switch (zr) {
-    case Z_STREAM_END:
-        break;
-    case Z_OK:
-        s.total_out = 0;
-        break;
-    default:
-#if _DEBUGGING
-        fprintf(stderr, "deflate: unexpected zlib error %i: %s\n", zr, s.msg);
-#endif
-        rc = RC(rcXF, rcFunction, rcExecuting, rcSelf, rcUnexpected);
-        break;
-    }
-    zr = deflateEnd(&s);
-    if (zr != Z_OK && s.total_out != 0) {
-#if _DEBUGGING
-        fprintf(stderr, "deflateEnd: unexpected zlib error %i: %s\n", zr, s.msg);
-#endif
-        rc = RC(rcXF, rcFunction, rcExecuting, rcSelf, rcUnexpected);
-    }
-    if (rc == 0) {
-        assert(s.total_out <= UINT32_MAX);
-        *dsize = (uint32_t)s.total_out;
-    }
-    return rc;
-}
-
-static
-rc_t CC zip_func(
-              void *Self,
-              const VXformInfo *info,
-              VBlobResult *dst,
-              const VBlobData *src,
-              VBlobHeader *hdr
-) {
-    rc_t rc;
-    struct self_t *self = Self;
-
-    /* input bits */
-    uint64_t sbits = ( uint64_t) src -> elem_count * src -> elem_bits;
-
-    /* input bytes */
-    uint32_t ssize = ( uint32_t ) ( ( sbits + 7 ) >> 3 );
-
-    /* required output size */
-    uint32_t dsize = ( uint32_t ) ( ( ( size_t ) dst -> elem_count * dst->elem_bits + 7 ) >> 3 );
-
-    if ( ( sbits & 7 ) == 0 )
-        /* version 1 is byte-aligned */
-        VBlobHeaderSetVersion ( hdr, 1 );
-    else
-    {
-        VBlobHeaderSetVersion ( hdr, 2 );
-        VBlobHeaderArgPushTail ( hdr, ( int64_t ) ( sbits & 7 ) );
-    }
-
-    rc = invoke_zlib ( dst -> data, & dsize, src -> data, ssize, self->strategy, self->level);
-    if (rc == 0) {
-        dst->elem_bits = 1;
-        dst->byte_order = src->byte_order;
-        if (dsize)
-            dst->elem_count = dsize << 3;
-        else
-            rc = RC(rcXF, rcFunction, rcExecuting, rcBuffer, rcInsufficient);
-    }
-    return rc;
-}
-
-static
-void CC vxf_zip_wrapper( void *ptr )
-{
-	free( ptr );
-}
-
-/* zip
- * function zlib_fmt zip #1.0 < * I32 strategy, I32 level > ( any in );
- */
-VTRANSFACT_IMPL(vdb_zip, 1, 0, 0) (const void *self, const VXfactInfo *info, VFuncDesc *rslt, const VFactoryParams *cp, const VFunctionParams *dp )
-{
-    struct self_t *ctx;
-
-    int strategy = Z_RLE;
-    int level = Z_BEST_SPEED;
-
-    if ( cp -> argc > 0 )
-    {
-        strategy = cp -> argv [ 0 ] . data . i32 [ 0 ];
-        if ( strategy < Z_MIN_STRATEGY || strategy > Z_MAX_STRATEGY )
-            return RC(rcXF, rcFunction, rcConstructing, rcParam, rcInvalid);
-        if ( cp -> argc > 1 )
-        {
-            level = cp -> argv [ 1 ] . data . i32 [ 0 ];
-            if ( level < Z_MIN_LEVEL || level > Z_MAX_LEVEL )
-                return RC(rcXF, rcFunction, rcConstructing, rcRange, rcInvalid);
-        }
-    }
-
-    ctx = malloc(sizeof(*ctx));
-    if (ctx) {
-        ctx->strategy = strategy;
-        ctx->level = level;
-       
-        rslt->self = ctx;
-        rslt->whack = vxf_zip_wrapper;
-        rslt->variant = vftBlob;
-        rslt->u.bf = zip_func;
-        
-        return 0;
-    }
-    return RC(rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted);
-}
diff --git a/libs/wgsxf/Makefile b/libs/wgsxf/Makefile
deleted file mode 100644
index 0aa7bfc..0000000
--- a/libs/wgsxf/Makefile
+++ /dev/null
@@ -1,124 +0,0 @@
-# ===========================================================================
-#
-#                            PUBLIC DOMAIN NOTICE
-#               National Center for Biotechnology Information
-#
-#  This software/database is a "United States Government Work" under the
-#  terms of the United States Copyright Act.  It was written as part of
-#  the author's official duties as a United States Government employee and
-#  thus cannot be copyrighted.  This software/database is freely available
-#  to the public for use. The National Library of Medicine and the U.S.
-#  Government have not placed any restriction on its use or reproduction.
-#
-#  Although all reasonable efforts have been taken to ensure the accuracy
-#  and reliability of the software and data, the NLM and the U.S.
-#  Government do not and cannot warrant the performance or results that
-#  may be obtained by using this software or data. The NLM and the U.S.
-#  Government disclaim all warranties, express or implied, including
-#  warranties of performance, merchantability or fitness for any particular
-#  purpose.
-#
-#  Please cite the author in any work or product based on this material.
-#
-# ===========================================================================
-
-
-default: std
-
-TOP ?= $(shell ../../build/abspath.sh ../..)
-MODULE = libs/wgsxf
-
-INT_LIBS = \
-	libwgsxf \
-	libwwgsxf
-
-ALL_LIBS = \
-	$(INT_LIBS)
-
-TEST_TOOLS = \
-
-include $(TOP)/build/Makefile.env
-
-RWORKDIR = $(BINDIR)
-
-#-------------------------------------------------------------------------------
-# outer targets
-#
-all std: makedirs
-	@ $(MAKE_CMD) $(TARGDIR)/std
-
-$(INT_LIBS): makedirs
-	@ $(MAKE_CMD) $(TARGDIR)/$@
-
-$(TEST_TOOLS): makedirs
-	@ $(MAKE_CMD) $(TEST_BINDIR)/$@
-
-.PHONY: all std $(ALL_LIBS) $(TEST_TOOLS)
-
-#-------------------------------------------------------------------------------
-# std
-#
-$(TARGDIR)/std: \
-	$(addprefix $(TARGDIR)/,$(INT_LIBS))
-
-.PHONY: $(TARGDIR)/std
-
-#-------------------------------------------------------------------------------
-# clean
-#
-clean: stdclean
-
-.PHONY: clean
-
-#-------------------------------------------------------------------------------
-# wgs-vdb transform library
-#
-$(TARGDIR)/libwgsxf: $(addprefix $(ILIBDIR)/libwgsxf.,$(ILIBEXT))
-
-WGSXF_SRC = \
-	build_scaffold \
-	build_read_type
-
-WGSXF_OBJ = \
-	$(addsuffix .$(LOBX),$(WGSXF_SRC))
-
-WGSXF_LIB = \
-	-dvdb \
-	-dklib \
-	-dm \
-	-dz \
-	-dbz2
-
-$(ILIBDIR)/libwgsxf.$(LIBX): $(WGSXF_OBJ)
-	$(LD) --slib -o $@ $^ $(WGSXF_LIB)
-
-.PHONY: $(TARGDIR)/libwgsxf
-
-#-------------------------------------------------------------------------------
-# update-side wgs transform library
-#
-
-$(TARGDIR)/libwwgsxf: $(addprefix $(ILIBDIR)/libwwgsxf.,$(ILIBEXT))
-
-WWGSXF_SRC = \
-	$(WGSXF_SRC)
-
-WWGSXF_OBJ = \
-	$(addsuffix .$(LOBX),$(WWGSXF_SRC))
-
-# temporary
-WWGSXF_LIB = \
-	-dwvdb \
-	-dwkdb \
-	-dklib \
-	-dm \
-	-dz \
-	-dbz2
-
-$(ILIBDIR)/libwwgsxf.$(LIBX): $(WWGSXF_OBJ)
-	$(LD) --slib -o $@ $^ $(WWGSXF_LIB)
-
-libwwgsxf.vers.h:
-	@ true
-
-.PHONY: $(TARGDIR)/libwwgsxf
diff --git a/libs/wgsxf/build_read_type.c b/libs/wgsxf/build_read_type.c
deleted file mode 100644
index 02ebed5..0000000
--- a/libs/wgsxf/build_read_type.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-#include <vdb/xform.h>
-#include <vdb/database.h>
-#include <vdb/table.h>
-#include <vdb/cursor.h>
-#include <vdb/schema.h>
-
-#include <klib/defs.h>
-#include <klib/rc.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-
-#include <insdc/insdc.h>
-#include <insdc/sra.h>
-#include <ncbi/wgs-contig.h>
-
-static
-rc_t build_read_type(INSDC_SRA_xread_type dst[],
-                     unsigned const components,
-                     NCBI_WGS_component_props const Props[/* components */])
-{
-    unsigned i;
-    
-    for (i = 0; i != components; ++i) {
-        int const props = Props[i];
-        
-        if (props < 0) {
-            dst[i] = SRA_READ_TYPE_TECHNICAL;
-        }
-        else {
-            int const type = props & 0x0F;
-            
-            if (type == 0) {
-                int const strand = props & ~(NCBI_WGS_strand_plus | NCBI_WGS_strand_minus);
-                
-                switch (strand) {
-                case 0:
-                    dst[i] = SRA_READ_TYPE_BIOLOGICAL;
-                    break;
-                case NCBI_WGS_strand_plus:
-                    dst[i] = SRA_READ_TYPE_BIOLOGICAL | SRA_READ_TYPE_FORWARD;
-                    break;
-                case NCBI_WGS_strand_minus:
-                    dst[i] = SRA_READ_TYPE_BIOLOGICAL | SRA_READ_TYPE_REVERSE;
-                    break;
-                default:
-                    return RC(rcXF, rcFunction, rcExecuting, rcType, rcInvalid);
-                }
-            }
-            else
-                return RC(rcXF, rcFunction, rcExecuting, rcType, rcInvalid);
-        }
-    }
-    return 0;
-}
-
-/*
- * function INSDC:SRA:xread_type NCBI:WGS:build_read_type #1
- *     ( NCBI:WGS:component_props component_props )
- */
-
-static
-rc_t CC build_read_type_impl(void *self, VXformInfo const *info, int64_t row_id,
-                             VFixedRowResult const *rslt,
-                             uint32_t argc, VRowData const argv[])
-{
-    NCBI_WGS_component_props const *const props = argv[0].u.data.base;
-    unsigned const components = argv[0].u.data.elem_count;
-    INSDC_SRA_xread_type *const dst = rslt->base;
-
-    return build_read_type(&dst[rslt->first_elem], components,
-                           &props[argv[0].u.data.first_elem]);
-}
-
-VTRANSFACT_IMPL(NCBI_WGS_build_read_type, 1, 0, 0)(void const *const Self,
-                                                   VXfactInfo const *const info,
-                                                   VFuncDesc *const rslt,
-                                                   VFactoryParams const *const cp,
-                                                   VFunctionParams const *const dp)
-{
-    rslt->variant = vftFixedRow;
-    rslt->u.pf = build_read_type_impl;
-    return 0;
-}
diff --git a/libs/wgsxf/build_scaffold.c b/libs/wgsxf/build_scaffold.c
deleted file mode 100644
index 41b900d..0000000
--- a/libs/wgsxf/build_scaffold.c
+++ /dev/null
@@ -1,435 +0,0 @@
-/*===========================================================================
- *
- *                            PUBLIC DOMAIN NOTICE
- *               National Center for Biotechnology Information
- *
- *  This software/database is a "United States Government Work" under the
- *  terms of the United States Copyright Act.  It was written as part of
- *  the author's official duties as a United States Government employee and
- *  thus cannot be copyrighted.  This software/database is freely available
- *  to the public for use. The National Library of Medicine and the U.S.
- *  Government have not placed any restriction on its use or reproduction.
- *
- *  Although all reasonable efforts have been taken to ensure the accuracy
- *  and reliability of the software and data, the NLM and the U.S.
- *  Government do not and cannot warrant the performance or results that
- *  may be obtained by using this software or data. The NLM and the U.S.
- *  Government disclaim all warranties, express or implied, including
- *  warranties of performance, merchantability or fitness for any particular
- *  purpose.
- *
- *  Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- */
-#include <vdb/extern.h>
-#include <vdb/xform.h>
-#include <vdb/database.h>
-#include <vdb/table.h>
-#include <vdb/cursor.h>
-#include <vdb/schema.h>
-
-#include <klib/defs.h>
-#include <klib/rc.h>
-#include <kdb/meta.h>
-#include <klib/data-buffer.h>
-#include <insdc/insdc.h>
-#include <align/refseq-mgr.h>
-#include <bitstr.h>
-#include <sysalloc.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-
-#include <insdc/sra.h>
-#include <ncbi/wgs-contig.h>
-
-#define READ_GAP_VALUE (0)
-#define QUAL_GAP_VALUE (2)
-
-#define CURSOR_CACHE_SIZE (4 * 1024 * 1024)
-
-typedef struct self_t self_t;
-typedef rc_t (*impl_f)(self_t const *const self, void *const Dst,
-                       unsigned const components,
-                       INSDC_coord_one const start[/* components */],
-                       INSDC_coord_len const length[/* components */],
-                       NCBI_WGS_component_props const props[/* components */],
-                       int64_t const join[/* components */]);
-
-struct self_t
-{
-    VCursor const *curs;
-    uint32_t col_idx;
-    impl_f impl;
-};
-
-static void free_self(self_t *const self)
-{
-    VCursorRelease(self->curs);
-}
-
-static
-void CC whack(void *vp)
-{
-    if (vp) {
-        free_self(vp);
-        free(vp);
-    }
-}
-
-
-static bool does_table_have_column( VTable const * tbl, char const column[] )
-{
-    KNamelist * column_names;
-    bool res = false;
-    rc_t rc = VTableListReadableColumns ( tbl, &column_names );
-    if ( rc == 0 )
-    {
-        uint32_t count;
-        rc = KNamelistCount ( column_names, &count );
-        if ( rc == 0 && count > 0 )
-        {
-            uint32_t idx;
-            size_t col_name_size;
-            const char * col_name = string_chr ( column, string_size( column ), ')' );
-            if ( col_name == NULL )
-                col_name = column;
-            else
-                col_name++;
-            col_name_size = string_size( col_name );
-            for ( idx = 0; idx < count && rc == 0 && !res; ++idx )
-            {
-                const char * name;
-                rc = KNamelistGet ( column_names, idx, &name );
-                if ( rc == 0 && name != NULL )
-                {
-                    int cmp = string_cmp( col_name, col_name_size,
-                                          name, string_size( name ), 0xFFFF );
-                    if ( cmp == 0 )
-                        res = true;
-                }
-            }
-        }
-        KNamelistRelease ( column_names );
-    }
-    return res;
-}
-
-
-static
-rc_t init_self( self_t *self, VTable const * const srctbl, char const column[] )
-{
-    VDatabase const * db;
-    rc_t rc = VTableOpenParentRead( srctbl, &db );
-    if ( rc == 0 )
-    {
-        VTable const * tbl;
-        rc = VDatabaseOpenTableRead( db, &tbl, "SEQUENCE" );
-        VDatabaseRelease( db );
-        if ( rc == 0 )
-        {
-            bool has_column = does_table_have_column( tbl, column );
-            if ( !has_column )
-                VTableRelease( tbl );
-            else
-            {
-                VCursor const * curs;
-#if CURSOR_CACHE_SIZE
-                rc = VTableCreateCachedCursorRead( tbl, &curs, CURSOR_CACHE_SIZE );
-#else
-                rc = VTableCreateCursorRead( tbl, &curs );
-#endif
-                VTableRelease( tbl );
-                if ( rc == 0 )
-                {
-                    uint32_t col_idx;
-                    rc = VCursorAddColumn( curs, &col_idx, column );
-                    if ( rc == 0 )
-                    {
-                        rc = VCursorOpen( curs );
-                        if ( rc == 0 )
-                        {
-                            self->curs = curs;
-                            self->col_idx = col_idx;
-                            return 0;
-                        }
-                        if ( GetRCObject( rc ) == rcColumn && GetRCState( rc ) == rcUndefined )
-                            rc = 0;
-                    }
-                    VCursorRelease( curs );
-                }
-            }
-        }
-    }
-    return rc;
-}
-
-static
-rc_t build_scaffold_read_impl(self_t const *const self, void *const Dst,
-                              unsigned const components,
-                              INSDC_coord_one const Start[/* components */],
-                              INSDC_coord_len const Length[/* components */],
-                              NCBI_WGS_component_props const Props[/* components */],
-                              int64_t const join[/* components */])
-{
-    INSDC_4na_bin *const dst = Dst;
-    unsigned i;
-    unsigned j;
-    unsigned id;
-    rc_t rc;
-    
-    for (rc = 0, id = j = i = 0; rc == 0 && i != components; ++i) {
-        INSDC_coord_len const length = Length[i];
-        int const props = Props[i];
-
-        if (props < 0) {
-            /* gap */
-            memset(dst + j, READ_GAP_VALUE, length);
-        }
-        else if (self->curs == NULL) {
-            memset(dst + j, 15, length);
-        }
-        else {
-            int const type = props & 0x0F;
-            int const strand = (props & ~(NCBI_WGS_strand_plus | NCBI_WGS_strand_minus)) >> 4;
-            
-            if (type != 0 || strand == 3)
-                rc = RC(rcXF, rcFunction, rcExecuting, rcType, rcInvalid);
-            else {
-                int64_t const row = join[id++];
-                uint32_t elem_bits;
-                uint32_t bit_offset;
-                uint32_t elem_count;
-                void const *base;
-                
-                rc = VCursorCellDataDirect(self->curs, row, self->col_idx,
-                                           &elem_bits, &base, &bit_offset,
-                                           &elem_count);
-                assert(bit_offset == 0);
-                if (rc == 0) {
-                    INSDC_coord_one const start = Start[i] - 1;
-                    
-                    if (elem_count < start + length)
-                        rc = RC(rcXF, rcFunction, rcExecuting, rcData, rcInsufficient);
-                    else {
-                        INSDC_4na_bin const *const src = base;
-                        
-                        if (strand == 2) {
-                            static INSDC_4na_bin const complement[] = {
-                                /* 0  0000 - 0000*/  0,
-                                /* 1  0001 - 1000*/  8,
-                                /* 2  0010 - 0100*/  4,
-                                /* 3  0011 - 1100*/ 12,
-                                /* 4  0100 - 0010*/  2,
-                                /* 5  0101 - 1010*/ 10,
-                                /* 6  0110 - 0110*/  6,
-                                /* 7  0111 - 1110*/ 14,
-                                /* 8  1000 - 0001*/  1,
-                                /* 9  1001 - 1001*/  9,
-                                /*10  1010 - 0101*/  5,
-                                /*11  1011 - 1101*/ 13,
-                                /*12  1100 - 0011*/  3,
-                                /*13  1101 - 1011*/ 11,
-                                /*14  1110 - 0111*/  7,
-                                /*15  1111 - 1111*/ 15
-                            };
-                            unsigned k;
-                            unsigned jj;
-                            
-                            for (jj = j + length, k = 0; k != length; ++k) {
-                                INSDC_4na_bin const elem = src[start + k];
-                                
-                                assert(0 <= elem && elem <= 15);
-                                --jj;
-                                dst[jj] = complement[elem];
-                            }
-                        }
-                        else
-                            memcpy(&dst[j], &src[start], length);
-                    }
-                }
-            }
-        }
-
-        j += length;
-    }
-    return rc;
-}
-
-static
-rc_t build_scaffold_qual_impl(self_t const *const self, void *const Dst,
-                              unsigned const components,
-                              INSDC_coord_one const Start[/* components */],
-                              INSDC_coord_len const Length[/* components */],
-                              NCBI_WGS_component_props const Props[/* components */],
-                              int64_t const join[/* components */])
-{
-    INSDC_quality_phred *const dst = Dst;
-    unsigned i;
-    unsigned j;
-    unsigned id;
-    rc_t rc;
-    
-    for (rc = 0, id = j = i = 0; rc == 0 && i != components; ++i) {
-        INSDC_coord_len const length = Length[i];
-        int const props = Props[i];
-        
-        if (props < 0) {
-            /* gap */
-            memset(dst + j, QUAL_GAP_VALUE, length);
-        }
-        else if (self->curs == NULL) {
-            memset(dst + j, 30, length);
-        }
-        else {
-            int const type = props & 0x0F;
-            int const strand = (props & ~(NCBI_WGS_strand_plus | NCBI_WGS_strand_minus)) >> 4;
-            
-            if (type != 0 || strand == 3)
-                rc = RC(rcXF, rcFunction, rcExecuting, rcType, rcInvalid);
-            else {
-                int64_t const row = join[id++];
-                uint32_t elem_bits;
-                uint32_t bit_offset;
-                uint32_t elem_count;
-                void const *base;
-                
-                rc = VCursorCellDataDirect(self->curs, row, self->col_idx,
-                                           &elem_bits, &base, &bit_offset,
-                                           &elem_count);
-                assert(bit_offset == 0);
-                if (rc == 0) {
-                    INSDC_quality_phred const start = Start[i] - 1;
-                    
-                    if (elem_count < start + length)
-                        rc = RC(rcXF, rcFunction, rcExecuting, rcData, rcInsufficient);
-                    else {
-                        INSDC_quality_phred const *const src = base;
-                        
-                        if (strand == 2) {
-                            unsigned k;
-                            unsigned jj;
-                            
-                            for (jj = j + length, k = 0; k != length; ++k) {
-                                INSDC_quality_phred const elem = src[start + k];
-                                
-                                --jj;
-                                dst[jj] = elem;
-                            }
-                        }
-                        else
-                            memcpy(&dst[j], &src[start], length);
-                    }
-                }
-            }
-        }
-        
-        j += length;
-    }
-    return rc;
-}
-
-static
-unsigned total_length(unsigned const components, INSDC_coord_len const length[/* components */])
-{
-    unsigned i;
-    unsigned len;
-    
-    for (i = len = 0; i != components; ++i)
-        len += length[i];
-    return len;
-}
-
-
-/*
- * function INSDC:4na:bin NCBI:WGS:build_scaffold_read #1
- *     ( INSDC:coord:one component_start, INSDC:coord:len component_len,
- *       NCBI:WGS:component_props component_props, I64 component_id )
- *
- * function INSDC:quality:phred NCBI:WGS:build_scaffold_qual #1
- *     ( INSDC:coord:one component_start, INSDC:coord:len component_len,
- *       NCBI:WGS:component_props component_props, I64 component_id )
- */
-
-static
-rc_t CC build_scaffold_impl(void *const data, VXformInfo const *const info,
-                            int64_t const row_id, VRowResult *const rslt,
-                            uint32_t const argc, VRowData const argv[])
-{
-    self_t const *const self = data;
-    INSDC_coord_one const *const start = argv[0].u.data.base;
-    INSDC_coord_len const *const length = argv[1].u.data.base;
-    NCBI_WGS_component_props const *const props = argv[2].u.data.base;
-    int64_t const *const join = argv[3].u.data.base;
-    unsigned const components = argv[0].u.data.elem_count;
-    rc_t rc;
-    
-    assert(argv[1].u.data.elem_count == components);
-    assert(argv[2].u.data.elem_count == components);
-    
-    assert(start != NULL);
-    assert(length != NULL);
-    assert(props != NULL);
-    assert(join != NULL);
-    
-    assert(rslt->elem_bits == 8);
-    rslt->elem_count = total_length(components, &length[argv[1].u.data.first_elem]);
-    rc = KDataBufferResize(rslt->data, rslt->elem_count);
-    if (rc == 0)
-        rc = self->impl(self, rslt->data->base, components,
-                        &start[argv[0].u.data.first_elem],
-                        &length[argv[1].u.data.first_elem],
-                        &props[argv[2].u.data.first_elem],
-                        &join[argv[3].u.data.first_elem]);
-    return rc;
-}
-
-VTRANSFACT_IMPL(NCBI_WGS_build_scaffold_read, 1, 0, 0)(void const * Self,
-                                                       VXfactInfo const * info,
-                                                       VFuncDesc * rslt,
-                                                       VFactoryParams const * cp,
-                                                       VFunctionParams const * dp)
-{
-    self_t *self = calloc(1, sizeof(*self));
-    if (self) {
-        rc_t const rc = init_self(self, info->tbl, "(INSDC:4na:bin)READ");
-        
-        if (rc == 0) {
-            self->impl = build_scaffold_read_impl;
-            
-            rslt->self = self;
-            rslt->whack = whack;
-            rslt->variant = vftRow;
-            rslt->u.rf = build_scaffold_impl;
-        }
-        return rc;
-    }
-    return RC(rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted);
-}
-
-VTRANSFACT_IMPL(NCBI_WGS_build_scaffold_qual, 1, 0, 0)(void const * Self,
-                                                       VXfactInfo const * info,
-                                                       VFuncDesc * rslt,
-                                                       VFactoryParams const * cp,
-                                                       VFunctionParams const * dp)
-{
-    self_t *self = calloc(1, sizeof(*self));
-    if (self) {
-        rc_t const rc = init_self(self, info->tbl, "(INSDC:quality:phred)QUALITY");
-    
-        if (rc == 0) {
-            self->impl = build_scaffold_qual_impl;
-            
-            rslt->self = self;
-            rslt->whack = whack;
-            rslt->variant = vftRow;
-            rslt->u.rf = build_scaffold_impl;
-        }
-        return rc;
-    }
-    return RC(rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted);
-}
diff --git a/os-arch.perl b/os-arch.perl
new file mode 100644
index 0000000..2ebf922
--- /dev/null
+++ b/os-arch.perl
@@ -0,0 +1,35 @@
+use strict;
+
+use FindBin qw($Bin);
+require "$Bin/os-arch.pm";
+
+my ($OS, $ARCH, $OSTYPE, $MARCH, @ARCHITECTURES) = OsArch();
+
+my $res = "$OS.$ARCH";
+
+if (@ARCHITECTURES) {
+    my $name = "$Bin/user.status";
+    if (-e $name) {
+        while (1) {
+            open F, $name or last;
+            foreach (<F>) {
+                chomp;
+                @_ = split /=/;
+                if ($#_ == 1) {
+                    if ($_[0] eq 'arch') {
+                        foreach (@ARCHITECTURES) {
+                            if ($_ eq $_[1]) {
+                                $res = "$OS.$_[1]";
+                                last;
+                            }
+                        }
+                        last;
+                    }
+                }
+            }
+            last;
+        }
+    }
+}
+
+print "$res\n";
diff --git a/os-arch.pm b/os-arch.pm
new file mode 100644
index 0000000..6fbd606
--- /dev/null
+++ b/os-arch.pm
@@ -0,0 +1,100 @@
+sub OsArch {
+    my ($UNAME, $HOST_OS, $HOST_ARCH, $MARCH, @ARCHITECTURES);
+    if ($^O eq 'MSWin32') {
+        $UNAME = $HOST_OS = 'win';
+        $HOST_ARCH = $MARCH = 'x86_64';
+        @ARCHITECTURES = qw(x86_64 i386);
+    } else {
+        $UNAME = `uname -s`;
+        chomp $UNAME;
+        if ($UNAME =~ /Darwin/) {
+            $HOST_OS = 'mac';
+        } elsif ($UNAME =~ /Linux/) {
+            $HOST_OS = 'linux';
+        } elsif ($UNAME =~ /SunOS/) {
+            $HOST_OS = 'sun';
+            @ARCHITECTURES = qw(x86_64 i386);
+        } elsif ($UNAME =~ /xCYGWIN/) {
+            $HOST_OS = 'win';
+        } elsif ($UNAME =~ /xMINGW/) {
+            $HOST_OS = 'win';
+        }
+        if ($HOST_OS eq 'mac') {
+            $MARCH = $HOST_ARCH = MacArch();
+            @ARCHITECTURES = qw(x86_64 i386) if ($MARCH eq 'x86_64');
+        } else {
+            $MARCH = `uname -m`;
+            chomp $MARCH;
+            if ($MARCH =~ /i386/) {
+                $HOST_ARCH = 'i386';
+            } elsif ($MARCH =~ /i486/) {
+                $HOST_ARCH = 'i386';
+            } elsif ($MARCH =~ /i586/) {
+                $HOST_ARCH = 'i386';
+            } elsif ($MARCH =~ /i686/) {
+                if ($UNAME =~ /WOW64/) { # 64-bit capable Cygwin.
+                     # Analyze the version of cl to set the correct architecture
+                    my $CL = `cl.exe 2>&1 > /dev/null`;
+                    if ($CL =~ /for x64/) {
+                        $HOST_ARCH = 'x86_64';
+                    } else {
+                        $HOST_ARCH = 'i386';
+                    }
+                } else {
+                    $HOST_ARCH = 'i386';
+                }
+            } elsif ($MARCH =~ /x86_64/) {
+                $HOST_ARCH = 'x86_64';
+            } elsif ($MARCH =~ /i86pc/) {
+                $HOST_ARCH = 'x86_64';
+                @ARCHITECTURES = qw(x86_64 i386);
+            } elsif ($MARCH =~ /sun4v/) {
+                $HOST_ARCH = 'sparc64';
+		        @ARCHITECTURES = qw(sparc64 sparc32);
+            }
+        }
+    }
+    ($HOST_OS, $HOST_ARCH, $UNAME, $MARCH, @ARCHITECTURES);
+}
+
+sub MacArch {
+    my $ARCH = `uname -m`;
+    chomp $ARCH;
+    if ($ARCH eq 'x86_64') {
+        return $ARCH;
+    } else {
+        my $SYSCTL = '/usr/sbin/sysctl';
+        $SYSCTL = '/sbin/sysctl' if (-x '/sbin/sysctl');
+
+        my $CAP64 = `$SYSCTL -n hw.cpu64bit_capable`;
+        chomp $CAP64;
+
+        my $PADDR_BITS = `$SYSCTL -n machdep.cpu.address_bits.physical`;
+        chomp $PADDR_BITS;
+
+        my $VADDR_BITS = `$SYSCTL -n machdep.cpu.address_bits.virtual`;
+        chomp $VADDR_BITS;
+        
+        if ($CAP64 != 0) {
+            if ($PADDR_BITS > 32 && $VADDR_BITS > 32) {
+                if ($ARCH eq 'i386' || $ARCH eq 'x86_64') {
+                    return 'x86_64';
+                } elsif ($ARCH eq 'Power Macintosh') {
+                    return 'ppc64';
+                } else {
+                    return 'unrecognized';
+                }
+            }
+        }
+
+        if ($ARCH eq 'i386') {
+            return 'i386';
+        } elsif ($ARCH eq 'Power Macintosh') {
+            return 'ppc32';
+        } else {
+            return 'unrecognized';
+        }
+    }
+}
+
+1
diff --git a/package.pm b/package.pm
new file mode 100644
index 0000000..209868f
--- /dev/null
+++ b/package.pm
@@ -0,0 +1,52 @@
+################################################################################
+sub PACKAGE      { "sra-tools" }
+sub VERSION      { "2.4.2-1" }
+sub PACKAGE_TYPE { 'B' }
+sub PACKAGE_NAME { "SRA-TOOLS" }
+sub PACKAGE_NAMW { "SRATOOLS" }
+sub CONFIG_OUT   { 'build' }
+sub PKG { ( LNG   => 'C',
+            OUT   => 'ncbi-outdir',
+            PATH  => '/usr/local/ncbi/sra-tools',
+            UPATH =>      '$HOME/ncbi/sra-tools', ) }
+sub DEPENDS      { ( { name => 'hdf5' , },
+                     { name => 'magic', Include => '/usr/include'        , },
+                     { name => 'xml2' , Include => '/usr/include/libxml2', } ) }
+sub REQ { (
+            { name    => 'ngs-sdk',
+              namew   => 'NGS',
+              option  => 'with-ngs-sdk-prefix',
+              origin  => 'I',
+              type    => 'L',
+              srcpath => '../ngs/ngs-sdk',
+              pkgpath => '/usr/local/ngs/ngs-sdk',
+              usrpath =>      '$HOME/ngs/ngs-sdk',
+              bldpath => '$HOME/ncbi-outdir/ngs-sdk',
+              include => 'ngs/itf/Refcount.h',
+              lib     => 'libngs-c++.a',
+              ilib    => 'libngs-bind-c++.a',
+            },
+            { name    => 'ncbi-vdb',
+              namew   => 'VDB',
+              option  => 'with-ncbi-vdb-sources',
+              boption => 'with-ncbi-vdb-build',
+              origin  => 'I',
+              type    => 'SB',
+              srcpath => '../ncbi-vdb',
+              pkgpath => '/usr/local/ncbi/ncbi-vdb',
+              usrpath =>      '$HOME/ncbi/ncbi-vdb',
+              bldpath => '$HOME/ncbi-outdir/ncbi-vdb',
+              include => 'klib/rc.h',
+              lib     => 'libncbi-vdb.a',
+              ilib    => 'libkapp.a',
+        },
+        {     name    => 'hdf5',
+              option  => 'with-hdf5-prefix',
+              origin  => 'E',
+              type    => 'LI',
+              pkgpath => '/usr',
+              usrpath => '$HOME',
+              include => 'hdf5.h',
+              lib => 'libhdf5.a',
+        } ) }
+1
diff --git a/test/Makefile b/test/Makefile
new file mode 100644
index 0000000..08bddf1
--- /dev/null
+++ b/test/Makefile
@@ -0,0 +1,30 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+#TBD
+default all std clean runtests slowtests:
+	@true
+    
+.PHONY: default all std clean runtests slowtests
+    
\ No newline at end of file
diff --git a/tools/.gitignore b/tools/.gitignore
new file mode 100644
index 0000000..0bff5eb
--- /dev/null
+++ b/tools/.gitignore
@@ -0,0 +1,3 @@
+pileupcomp
+avg-qual
+sra-rewrite
diff --git a/tools/Makefile b/tools/Makefile
index 5b4ba65..13dc05b 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -22,12 +22,14 @@
 #
 # ===========================================================================
 
+by_default: default
 
-TOP ?= $(shell ../build/abspath.sh ..)
+TOP ?= $(abspath ..)
 MODULE = tools
 
 include $(TOP)/build/Makefile.shell
 
+include $(TOP)/build/Makefile.config
 
 #-------------------------------------------------------------------------------
 # default
@@ -35,24 +37,43 @@ include $(TOP)/build/Makefile.shell
 SUBDIRS = \
 	util \
 	kar \
+	kqsh \
 	vdb-dump \
 	sra-dump \
-	sra-load \
 	sra-pileup \
 	bam-loader \
 	fastq-loader \
 	srapath \
 	sra-stat \
 	vdb-copy \
+	rd-filter-redact \
 	vdb-config \
 	align-info \
+	qual-recalib-stat \
 	prefetch \
-	nenctool \
-	nencvalid \
 	vdb-decrypt \
 	vdb-validate \
 	sra-sort \
-    cache-mgr
+	cache-mgr \
+	vcf-loader
+
+ifeq (1,$(HAVE_MAGIC))
+	SUBDIRS += copycat
+endif    
+
+ifeq (1,$(HAVE_XML2))
+	SUBDIRS += sra-load ccextract
+endif    
+
+ifeq (1,$(HAVE_HDF5))
+	SUBDIRS += pacbio-load
+endif
+
+ifneq (win,$(BUILD_OS))
+ifneq (rwin,$(BUILD_OS))
+	SUBDIRS += cg-load
+endif
+endif
 
 # common targets for non-leaf Makefiles; must follow a definition of SUBDIRS
 include $(TOP)/build/Makefile.targets
diff --git a/tools/align-info/Makefile b/tools/align-info/Makefile
index a5f6fc0..0bcef49 100644
--- a/tools/align-info/Makefile
+++ b/tools/align-info/Makefile
@@ -25,7 +25,7 @@
 
 default: std
 
-TOP ?= $(shell ../../build/abspath.sh ../..)
+TOP ?= $(abspath ../..)
 MODULE = tools/align-info
 
 include $(TOP)/build/Makefile.env
@@ -83,8 +83,7 @@ ALIGN_INFO_OBJ = \
 
 ALIGN_INFO_LIB = \
 	-lkapp \
-	-lncbi-vdb \
-	-lxml2 \
+	-sncbi-vdb \
 	-lm
 
 $(BINDIR)/align-info: $(ALIGN_INFO_OBJ)
diff --git a/tools/align-info/align-info.c b/tools/align-info/align-info.c
index afea6d6..b939d48 100644
--- a/tools/align-info/align-info.c
+++ b/tools/align-info/align-info.c
@@ -164,7 +164,7 @@ static rc_t bam_header(const VDatabase* db) {
         DISP_RC(rc, "while calling VDatabaseOpenMetadataRead");
     }
     if (rc == 0) {
-        rc = KMetadataOpenNodeRead(meta, &node, path);
+        rc = KMetadataOpenNodeRead(meta, &node, "%s", path);
         if (GetRCState(rc) == rcNotFound)
         {   rc = 0; }
         else {
@@ -215,7 +215,7 @@ static rc_t qual_stats(const Params* prm, const VDatabase* db) {
     const KMDataNode* node = NULL;
     assert(prm && db);
     if (rc == 0) {
-        rc = VDatabaseOpenTableRead(db, &tbl, tblName);
+        rc = VDatabaseOpenTableRead(db, &tbl, "%s", tblName);
         DISP_RC2(rc, tblName, "while calling VDatabaseOpenTableRead");
     }
     if (rc == 0) {
@@ -303,7 +303,7 @@ static rc_t qual_stats(const Params* prm, const VDatabase* db) {
                 char name[64];
                 const KMDataNode* n = NULL;
                 sprintf(name, "PHRED_%d", quals[i]);
-                rc = KMDataNodeOpenNodeRead(node, &n, name);
+                rc = KMDataNodeOpenNodeRead(node, &n, "%s", name);
                 DISP_RC(rc, name);
                 if (rc == 0) {
                     rc = KMDataNodeReadAsU64(n, &u);
@@ -363,7 +363,7 @@ static rc_t align_info(const Params* prm) {
     }
 
     if (rc == 0) {
-        rc = VDBManagerOpenDBRead(mgr, &db, schema, prm->dbPath);
+        rc = VDBManagerOpenDBRead(mgr, &db, schema, "%s", prm->dbPath);
         if (rc == 0) {
             is_db = true;
         }
diff --git a/tools/align-info/align-info.vers b/tools/align-info/align-info.vers
index cc6c9a4..8e8299d 100644
--- a/tools/align-info/align-info.vers
+++ b/tools/align-info/align-info.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/align-info/align-info.vers.h b/tools/align-info/align-info.vers.h
new file mode 100644
index 0000000..260db0c
--- /dev/null
+++ b/tools/align-info/align-info.vers.h
@@ -0,0 +1 @@
+#define ALIGN_INFO_VERS 0x02040002
diff --git a/tools/bam-loader/Globals.h b/tools/bam-loader/Globals.h
index 50a0d9c..587bf81 100644
--- a/tools/bam-loader/Globals.h
+++ b/tools/bam-loader/Globals.h
@@ -69,6 +69,7 @@ typedef struct globals
     bool omit_reference_reads;
     bool no_real_output;
     bool expectUnsorted;
+    bool requireSorted;
     bool noVerifyReferences;
     bool onlyVerifyReferences;
     bool useQUAL;
diff --git a/tools/bam-loader/Makefile b/tools/bam-loader/Makefile
index 8de8ae4..18082f1 100644
--- a/tools/bam-loader/Makefile
+++ b/tools/bam-loader/Makefile
@@ -25,13 +25,14 @@
 
 default: std
 
-TOP ?= $(shell ../../build/abspath.sh ../..)
+TOP ?= $(abspath ../..)
 MODULE = tools/bam-loader
 
 INT_TOOLS = \
 
 EXT_TOOLS = \
-	bam-load
+	bam-load \
+	bam-load.3
 
 ALL_TOOLS = \
 	$(INT_TOOLS) \
@@ -93,9 +94,30 @@ BAMLOAD_OBJ = \
 BAMLOAD_LIB = \
 	-lkapp \
 	-lload \
-	-lncbi-wvdb \
-	-lxml2 \
+	-sncbi-wvdb \
 	-lm
 
 $(BINDIR)/bam-load: $(BAMLOAD_OBJ)
 	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(BAMLOAD_LIB)
+
+#-------------------------------------------------------------------------------
+# bam-load.3
+#
+BAMLOAD3_SRC = \
+	bam-loader3 \
+	bam-reader \
+	loader-imp3
+
+BAMLOAD3_OBJ = \
+	$(addsuffix .$(OBJX),$(BAMLOAD3_SRC))
+
+BAMLOAD3_LIB = \
+	-lkapp \
+	-lloader \
+	-lload \
+	-sncbi-wvdb \
+	-lm
+
+$(BINDIR)/bam-load.3: $(BAMLOAD3_OBJ)
+	$(LD) --exe --vers $(SRCDIR)/bam-load.3.vers -o $@ $^ $(BAMLOAD3_LIB)
+
diff --git a/tools/bam-loader/alignment-writer.c b/tools/bam-loader/alignment-writer.c
index fe84dc8..999c7d1 100644
--- a/tools/bam-loader/alignment-writer.c
+++ b/tools/bam-loader/alignment-writer.c
@@ -174,3 +174,88 @@ rc_t AlignmentWhack(Alignment * const self, bool const commit)
     free(self);
     return rc ? rc : rc2;
 }
+
+static size_t LayoutStorage(void *const buffer, unsigned const readlen,
+                            void const **const p_ref_offset,
+                            void const **const p_ref_offset_type,
+                            void const **const p_mismatch,
+                            void const **const p_has_ref_offset,
+                            void const **const p_has_mismatch
+                            )
+{
+    int32_t *const ref_offset = buffer;
+    uint8_t *const ref_offset_type = (uint8_t *)&ref_offset[readlen];
+    char *const mismatch = (char *)&ref_offset_type[readlen];
+    bool *const has_ref_offset = (bool *)&mismatch[readlen];
+    bool *const has_mismatch   = (bool *)&has_ref_offset[readlen];
+    void *const endp = &has_mismatch[readlen];
+
+    if (p_ref_offset     ) *p_ref_offset      = ref_offset;
+    if (p_ref_offset_type) *p_ref_offset_type = ref_offset_type;
+    if (p_mismatch       ) *p_mismatch        = mismatch;
+    if (p_has_ref_offset ) *p_has_ref_offset  = has_ref_offset;
+    if (p_has_mismatch   ) *p_has_mismatch    = has_mismatch;
+    
+    return (char const *)endp - (char const *)buffer;
+}
+
+rc_t AlignmentRecordInit(AlignmentRecord *const self, unsigned const readlen)
+{
+    KDataBuffer buffer = self->buffer;
+
+    buffer.elem_bits = 8;
+    {
+        size_t const need = LayoutStorage(0, readlen, 0, 0, 0, 0, 0);
+        rc_t const rc = KDataBufferResize(&buffer, need);
+        if (rc) return rc;
+    }
+    memset(self, 0, sizeof(*self));
+    self->buffer = buffer;
+    
+    self->data.seq_read_id.buffer = &self->read_id;
+    self->data.seq_read_id.elements = 1;
+    self->data.ref_id.buffer = &self->ref_id;
+    self->data.ref_id.elements = 1;
+    if (G.expectUnsorted) {
+        self->data.ref_start.buffer = &self->ref_start;
+        self->data.ref_start.elements = 1;
+    }
+    else {
+        self->data.global_ref_start.buffer = &self->global_ref_start;
+        self->data.global_ref_start.elements = 1;
+    }
+    self->data.ref_orientation.buffer = &self->ref_orientation;
+    self->data.ref_orientation.elements = 1;
+    self->data.mapq.buffer = &self->mapq;
+    self->data.mapq.elements = 1;
+    self->data.tmp_key_id.buffer = &self->tmp_key_id;
+    self->data.tmp_key_id.elements = 1;
+    
+    self->data.read_start.buffer = &self->read_start;
+    self->data.read_start.elements = 1;
+    self->data.read_len.buffer = &self->read_len;
+    self->data.read_len.elements = 1;
+    
+    self->data.mate_ref_orientation.buffer = &self->mate_ref_orientation;
+    self->data.mate_ref_orientation.elements = 1;
+    self->data.mate_ref_id.buffer = &self->mate_ref_id;
+    self->data.mate_ref_id.elements = 1;
+    self->data.mate_ref_pos.buffer = &self->mate_ref_pos;
+    self->data.mate_ref_pos.elements = 1;
+    self->data.mate_align_id.buffer = &self->mate_align_id;
+    self->data.mate_align_id.elements = 1;
+    self->data.template_len.buffer = &self->template_len;
+    self->data.template_len.elements = 1;
+
+    LayoutStorage(buffer.base, readlen,
+                  &self->data.ref_offset.buffer,
+                  &self->data.ref_offset_type.buffer,
+                  &self->data.mismatch.buffer,
+                  &self->data.has_ref_offset.buffer,
+                  &self->data.has_mismatch.buffer);
+
+    self->data.has_mismatch.elements = readlen;
+    self->data.has_ref_offset.elements = readlen;
+    
+    return 0;
+}
diff --git a/tools/bam-loader/alignment-writer.h b/tools/bam-loader/alignment-writer.h
index bd8dfed..cba425b 100644
--- a/tools/bam-loader/alignment-writer.h
+++ b/tools/bam-loader/alignment-writer.h
@@ -27,7 +27,7 @@
 #ifndef BAM_LOAD_ALIGNMENT_WRITER_H_
 #define BAM_LOAD_ALIGNMENT_WRITER_H_ 1
 
-#include <klib/text.h>
+#include <klib/data-buffer.h>
 #include <vdb/database.h>
 #include <vdb/table.h>
 #include <vdb/cursor.h>
@@ -40,6 +40,7 @@ typedef struct s_alignment Alignment;
 typedef struct AlignmentRecord AlignmentRecord;
 
 struct AlignmentRecord {
+    KDataBuffer buffer;
     TableWriterAlgnData data;
     int64_t alignId;
     bool isPrimary;
@@ -79,6 +80,7 @@ struct AlignmentRecord {
 
 #define AR_NUM_OFFSET(X) ((X).data.ref_offset.elements)
 #define AR_OFFSET(X) ((INSDC_coord_zero *)((X).data.ref_offset.buffer))
+#define AR_OFFSET_TYPE(X) ((uint8_t *)((X).data.ref_offset_type.buffer))
 
 Alignment *AlignmentMake(VDatabase *db);
 
@@ -92,4 +94,6 @@ rc_t AlignmentWriteSpotId(Alignment *self, int64_t spotId);
 
 rc_t AlignmentWhack(Alignment *self, bool commit);
 
+rc_t AlignmentRecordInit(AlignmentRecord *self, unsigned readlen);
+
 #endif
diff --git a/tools/bam-loader/bam-load.vers b/tools/bam-loader/bam-load.vers
index cc6c9a4..8e8299d 100644
--- a/tools/bam-loader/bam-load.vers
+++ b/tools/bam-loader/bam-load.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/bam-loader/bam-loader.c b/tools/bam-loader/bam-loader.c
index 3d4ab92..633f7a0 100644
--- a/tools/bam-loader/bam-loader.c
+++ b/tools/bam-loader/bam-loader.c
@@ -58,6 +58,7 @@ static char const option_min_mapq[] = "min-mapq";
 static char const option_qual_compress[] = "qual-quant";
 static char const option_cache_size[] = "cache-size";
 static char const option_unsorted[] = "unsorted";
+static char const option_sorted[] = "sorted";
 static char const option_max_err_count[] = "max-err-count";
 static char const option_max_rec_count[] = "max-rec-count";
 static char const option_no_verify[] = "no-verify";
@@ -168,6 +169,13 @@ char const * unsorted_usage[] =
 };
 
 static
+char const * sorted_usage[] =
+{
+    "Tell the loader to require sorted input",
+    NULL
+};
+
+static
 char const * cache_size_usage[] = 
 {
     "Set the cache size in MB for the temporary indices",
@@ -340,6 +348,7 @@ OptDef Options[] =
     { OPTION_MIN_MATCH, NULL, NULL, use_min_match, 1, true, false },
     { OPTION_NO_SECONDARY, ALIAS_NO_SECONDARY, NULL, use_no_secondary, 1, false, false },
     { option_unsorted, NULL, NULL, unsorted_usage, 1, false,  false },
+    { option_sorted, NULL, NULL, sorted_usage, 1, false,  false },
     { option_no_verify, NULL, NULL, no_verify_usage, 1, false,  false },
     { option_only_verify, NULL, NULL, only_verify_usage, 1, false,  false },
     { option_use_qual, NULL, NULL, use_QUAL_usage, 1, false,  false },
@@ -358,35 +367,36 @@ OptDef Options[] =
 const char* OptHelpParam[] =
 {
     /* order here is same as in OptDef array above!!! */
-    "path",
-    "path",
-    "path-to-file",
-    "path-to-file",
-    "path",
-    "path-to-file",
-    NULL,
-    NULL,
-    NULL,
-    "level",
-    "phred-score",
-    "mbytes",
-    NULL,
-    "count",
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    "name",
-    "new-value",
-    NULL,
-    NULL,
-    NULL,
-    "path-to-file",
-    NULL,
-    "count",
-    NULL
+    "path",				/* input */
+    "path",				/* output */
+    "path-to-file",		/* config */
+    "path-to-file",		/* header */
+    "path",				/* tmpfs */
+    "path-to-file",		/* unaligned */
+    NULL,				/* accept dups */
+    NULL,				/* accept no-match */
+    "path-to-file",		/* no-match log */
+    "level",			/* quality compression */
+    "phred-score",		/* min. mapq */
+    "mbytes",			/* cache size */
+    NULL,				/* no colorspace */
+    "count",			/* min. match count */
+    NULL,				/* no secondary */
+    NULL,				/* unsorted */
+    NULL,				/* sorted */
+    NULL,				/* no verify ref's */
+    NULL,				/* quit after verify ref's */
+    NULL,				/* force QUAL */
+    NULL,				/* ref's from config */
+    "name",				/* only this ref */
+    "new-value",		/* value for aligned qualities */
+    NULL,				/* no quantize mismatch qualities */
+    "number",			/* max. record count to process */
+    "number",			/* max. error count */
+    "path-to-file",		/* reference fasta file */
+    NULL,				/* use XT->TI */
+    "count",			/* max. duplicate warning count */
+    NULL				/* allow hard clipping */
 };
 
 rc_t UsageSummary (char const * progname)
@@ -493,7 +503,7 @@ static rc_t OpenFile(KFile const **kf, char const path[], char const base[])
         
         rc = KDirectoryNativeDir(&dir);
         if (rc == 0) {
-            rc = KDirectoryOpenFileRead(dir, kf, fname);
+            rc = KDirectoryOpenFileRead(dir, kf, "%s", fname);
             KDirectoryRelease(dir);
         }
     }
@@ -568,9 +578,10 @@ rc_t CC KMain (int argc, char * argv[])
     G.minMapQual = 0; /* accept all */
     G.tmpfs = "/tmp";
 #if _ARCH_BITS == 32
-    G.cache_size = ( size_t ) 1 << 30;
+#warning 32-bit build is not tested. BEWARE!!!
+    G.cache_size = ((size_t) 1) << 30;
 #else
-    G.cache_size = ( size_t ) 10 << 30;
+    G.cache_size = ((size_t)16) << 30;
 #endif
     G.maxErrCount = 1000;
     G.minMatchCount = 10;
@@ -783,6 +794,11 @@ rc_t CC KMain (int argc, char * argv[])
             break;
         G.expectUnsorted = pcount > 0;
         
+        rc = ArgsOptionCount (args, option_sorted, &pcount);
+        if (rc)
+            break;
+        G.requireSorted = pcount > 0;
+        
         rc = ArgsOptionCount (args, OPTION_MAX_REC_COUNT, &pcount);
         if (rc)
             break;
@@ -862,7 +878,7 @@ rc_t CC KMain (int argc, char * argv[])
             if (rc) break;
             rc = KDirectoryNativeDir(&dir);
             if (rc) break;
-            rc = KDirectoryCreateFile(dir, &G.noMatchLog, 0, 0664, kcmInit, value);
+            rc = KDirectoryCreateFile(dir, &G.noMatchLog, 0, 0664, kcmInit, "%s", value);
             KDirectoryRelease(dir);
             if (rc) break;
         }
diff --git a/tools/bam-loader/bam-loader3.c b/tools/bam-loader/bam-loader3.c
new file mode 100644
index 0000000..d2a62cd
--- /dev/null
+++ b/tools/bam-loader/bam-loader3.c
@@ -0,0 +1,1028 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+
+#include "bam-load.3.vers.h"
+
+#include <kapp/main.h>
+#include <kapp/args.h>
+#include <klib/text.h>
+#include <klib/log.h>
+#include <klib/out.h>
+#include <klib/status.h>
+#include <klib/rc.h>
+#include <klib/printf.h>
+#include <kfs/directory.h>
+#include <kfs/file.h>
+#include <kapp/log-xml.h>
+#include <align/writer-refseq.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <assert.h>
+#include <limits.h>
+
+#include <loader/common-writer.h>
+#include "loader-imp3.h"
+
+/* MARK: Arguments and Usage */
+static char const option_input[] = "input";
+static char const option_output[] = "output";
+static char const option_tmpfs[] = "tmpfs";
+static char const option_config[] = "config";
+static char const option_min_mapq[] = "min-mapq";
+static char const option_qual_compress[] = "qual-quant";
+static char const option_cache_size[] = "cache-size";
+static char const option_unsorted[] = "unsorted";
+static char const option_max_err_count[] = "max-err-count";
+static char const option_max_err_pct[] = "max-err-pct";
+static char const option_max_rec_count[] = "max-rec-count";
+static char const option_no_verify[] = "no-verify";
+static char const option_only_verify[] = "only-verify";
+static char const option_use_qual[] = "use-QUAL";
+static char const option_ref_filter[] = "ref-filter";
+static char const option_ref_config[] = "ref-config";
+static char const option_edit_aligned_qual[] = "edit-aligned-qual";
+static char const option_unaligned[] = "unaligned";
+static char const option_accept_dup[] = "accept-dups";
+static char const option_accept_nomatch[] = "accept-nomatch";
+static char const option_nomatch_log[] = "nomatch-log";
+static char const option_keep_mismatch_qual[] = "keep-mismatch-qual";
+static char const option_min_match[] = "minimum-match";
+static char const option_header[] = "header";
+static char const option_no_cs[] = "no-cs";
+static char const option_no_secondary[] = "no-secondary";
+static char const option_ref_file[] = "ref-file";
+static char const option_TI[] = "TI";
+static char const option_max_warn_dup_flag[] = "max-warning-dup-flag";
+static char const option_accept_hard_clip[] = "accept-hard-clip";
+static char const option_parse_spot_name[] = "parse-spot-name";
+
+#define OPTION_INPUT option_input
+#define OPTION_OUTPUT option_output
+#define OPTION_TMPFS option_tmpfs
+#define OPTION_CONFIG option_config
+#define OPTION_MINMAPQ option_min_mapq
+#define OPTION_QCOMP option_qual_compress
+#define OPTION_CACHE_SIZE option_cache_size
+#define OPTION_MAX_ERR_COUNT option_max_err_count
+#define OPTION_MAX_ERR_PCT option_max_err_pct
+#define OPTION_MAX_REC_COUNT option_max_rec_count
+#define OPTION_UNALIGNED option_unaligned
+#define OPTION_ACCEPT_DUP option_accept_dup
+#define OPTION_ACCEPT_NOMATCH option_accept_nomatch
+#define OPTION_NOMATCH_LOG option_nomatch_log
+#define OPTION_MIN_MATCH option_min_match
+#define OPTION_HEADER option_header
+#define OPTION_NO_CS option_no_cs
+#define OPTION_NO_SECONDARY option_no_secondary
+#define OPTION_REF_FILE option_ref_file
+#define OPTION_TI option_TI
+#define OPTION_MAX_WARN_DUP_FLAG option_max_warn_dup_flag
+#define OPTION_ACCEPT_HARD_CLIP option_accept_hard_clip
+#define OPTION_PARSE_SPOT_NAME option_parse_spot_name
+
+#define ALIAS_INPUT  "i"
+#define ALIAS_OUTPUT "o"
+#define ALIAS_TMPFS "t"
+#define ALIAS_CONFIG "k"
+#define ALIAS_MINMAPQ "q"
+#define ALIAS_QCOMP "Q"
+#define ALIAS_MAX_ERR_COUNT "E"
+#define ALIAS_UNALIGNED "u"
+#define ALIAS_ACCEPT_DUP "d"
+#define ALIAS_NO_SECONDARY "P"
+#define ALIAS_REF_FILE "r"
+#define ALIAS_MAX_ERR_PCT "p"
+
+static
+char const * input_usage[] = 
+{
+    "Path where to get fasta files from.",
+    NULL
+};
+
+static
+char const * output_usage[] = 
+{
+    "Path and Name of the output database.",
+    NULL
+};
+
+static
+char const * tmpfs_usage[] = 
+{
+    "Path to be used for scratch files.",
+    NULL
+};
+
+static
+char const * config_usage[] = 
+{
+    "Path to configuration file:",
+    "maps the input BAM file's reference names to the equivalent GenBank accession.",
+    "It is a tab-delimited text file with unix line endings (\\n - LF) with the following fields in this order:",
+    "#1 reference name as it occurs in the BAM file's SN field of @SQ header record;",
+    "#2 INSDC reference ID",
+    NULL
+};
+
+static
+char const * min_mapq_usage[] = 
+{
+    "Minimum mapping quality to be considered an alignment.",
+    NULL
+};
+
+static
+char const * qcomp_usage[] = 
+{
+    "Quality scores quantization level, can be a number (0: none, 1: 2bit, 2: 1bit), or a string like '1:10,10:20,20:30,30:-' (which is equivalent to 1).",
+    NULL
+};
+
+static
+char const * unsorted_usage[] = 
+{
+    "Tell the loader to expect unsorted input (requires more memory)",
+    NULL
+};
+
+static
+char const * cache_size_usage[] = 
+{
+    "Set the cache size in MB for the temporary indices",
+    NULL
+};
+
+static
+char const * mrc_usage[] = 
+{
+    "Set the maximum number of records to process from the BAM file",
+    NULL
+};
+
+static
+char const * mec_usage[] = 
+{
+    "Set the maximum number of errors to ignore from the BAM file",
+    NULL
+};
+
+static
+char const * no_verify_usage[] = 
+{
+    "Skip verify existence of references from the BAM file",
+    NULL
+};
+
+static
+char const * only_verify_usage[] = 
+{
+    "Exit after verifying existence of references from the BAM file",
+    NULL
+};
+
+static
+char const * use_QUAL_usage[] = 
+{
+    "use QUAL column for quality values (default is to use OQ if it is available)",
+    NULL
+};
+
+static
+char const * use_ref_filter[] = 
+{
+    "Only process alignments to the given reference",
+    NULL
+};
+
+static
+char const * use_ref_config[] = 
+{
+    "Only process alignments to references in the config file",
+    NULL
+};
+
+static
+char const * use_edit_aligned_qual[] = 
+{
+    "Convert quality at aligned positions to this value",
+    NULL
+};
+
+static
+char const * use_keep_mismatch_qual[] = 
+{
+    "Don't quantized quality at mismatched positions",
+    NULL
+};
+
+static
+char const * use_unaligned[] = 
+{
+    "Specify file without aligned reads",
+    NULL
+};
+
+static
+char const * use_accept_dups[] = 
+{
+    "Accept spots inconsistent PCR duplicate flags",
+    NULL
+};
+
+static
+char const * use_accept_nomatch[] = 
+{
+    "Accept alignments with no matching bases",
+    NULL
+};
+
+static
+char const * use_nomatch_log[] = 
+{
+    "Where to write info for alignments with no matching bases",
+    NULL
+};
+
+static
+char const * use_min_match[] = 
+{
+    "minimum number of matches for an alignment",
+    NULL
+};
+
+static
+char const * use_header[] = 
+{
+    "path to a file containing the SAM header to store in the resulting cSRA, recommended in case of multiple input BAMs",
+    NULL
+};
+
+static
+char const * use_no_cs[] = 
+{
+    "turn off awareness of colorspace",
+    NULL
+};
+
+static
+char const * use_no_secondary[] = 
+{
+    "ignore alignments marked as secondary",
+    NULL
+};
+
+static
+char const * use_ref_file[] = 
+{
+    "path to a fasta file with references",
+    NULL
+};
+
+static
+char const * use_TI[] = 
+{
+    "for trace alignments",
+    NULL
+};
+
+static
+char const * use_max_dup_warnings[] = 
+{
+    "set limit for number of duplicate flag mismatch warnings",
+    NULL
+};
+
+static
+char const * use_accept_hard_clip[] = 
+{
+    "accept hard clipping in CIGAR",
+    NULL
+};
+
+static
+char const * use_parse_spot_name[] = 
+{
+    "parse spot name to remove extra characters",
+    NULL
+};
+
+static
+char const * use_max_err_pct[] = 
+{
+    "acceptable percentage of spots creation errors, default is 5",
+    NULL
+};
+
+OptDef Options[] = 
+{
+    /* order here is same as in param array below!!! */
+    { OPTION_INPUT, ALIAS_INPUT,  NULL,  input_usage, 1, true,  false },
+    { OPTION_OUTPUT, ALIAS_OUTPUT, NULL, output_usage, 1, true,  true },
+    { OPTION_CONFIG, ALIAS_CONFIG,  NULL,  config_usage, 1, true, false },
+    { OPTION_HEADER, NULL, NULL, use_header, 1, true, false },
+    { OPTION_TMPFS, ALIAS_TMPFS, NULL, tmpfs_usage, 1, true,  false },
+    { OPTION_UNALIGNED, ALIAS_UNALIGNED, NULL, use_unaligned, 256, true, false },
+    { OPTION_ACCEPT_DUP, ALIAS_ACCEPT_DUP, NULL, use_accept_dups, 1, false, false },
+    { OPTION_ACCEPT_NOMATCH, NULL, NULL, use_accept_nomatch, 1, false, false },
+    { OPTION_NOMATCH_LOG, NULL, NULL, use_nomatch_log, 1, true, false },
+    { OPTION_QCOMP, ALIAS_QCOMP, NULL, qcomp_usage, 1, true,  false },
+    { OPTION_MINMAPQ, ALIAS_MINMAPQ, NULL, min_mapq_usage, 1, true,  false },
+    { OPTION_CACHE_SIZE, NULL, NULL, cache_size_usage, 1, true,  false },
+    { OPTION_NO_CS, NULL, NULL, use_no_cs, 1, false,  false },
+    { OPTION_MIN_MATCH, NULL, NULL, use_min_match, 1, true, false },
+    { OPTION_NO_SECONDARY, ALIAS_NO_SECONDARY, NULL, use_no_secondary, 1, false, false },
+    { option_unsorted, NULL, NULL, unsorted_usage, 1, false,  false },
+    { option_no_verify, NULL, NULL, no_verify_usage, 1, false,  false },
+    { option_only_verify, NULL, NULL, only_verify_usage, 1, false,  false },
+    { option_use_qual, NULL, NULL, use_QUAL_usage, 1, false,  false },
+    { option_ref_config, NULL, NULL, use_ref_config, 1, false,  false },
+    { option_ref_filter, NULL, NULL, use_ref_filter, 1, true,  false },
+    { option_edit_aligned_qual, NULL, NULL, use_edit_aligned_qual, 1, true, false },
+    { option_keep_mismatch_qual, NULL, NULL, use_keep_mismatch_qual, 1, false,  false },
+    { OPTION_MAX_REC_COUNT, NULL, NULL, mrc_usage, 1, true,  false },
+    { OPTION_MAX_ERR_COUNT, ALIAS_MAX_ERR_COUNT, NULL, mec_usage, 1, true,  false },
+    { OPTION_REF_FILE, ALIAS_REF_FILE, NULL, use_ref_file, 0, true, false },
+    { OPTION_TI, NULL, NULL, use_TI, 1, false, false },
+    { OPTION_MAX_WARN_DUP_FLAG, NULL, NULL, use_max_dup_warnings, 1, true, false },
+    { OPTION_ACCEPT_HARD_CLIP, NULL, NULL, use_accept_hard_clip, 1, false, false },
+    { OPTION_PARSE_SPOT_NAME, NULL, NULL, use_parse_spot_name, 1, false, false },
+    { OPTION_MAX_ERR_PCT, ALIAS_MAX_ERR_PCT, NULL, use_max_err_pct, 1, true,  false },
+};
+
+const char* OptHelpParam[] =
+{
+    /* order here is same as in OptDef array above!!! */
+    "path",
+    "path",
+    "path-to-file",
+    "path-to-file",
+    "path",
+    "path-to-file",
+    NULL,
+    NULL,
+    NULL,
+    "level",
+    "phred-score",
+    "mbytes",
+    NULL,
+    NULL,
+    "count",
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    "name",
+    "new-value",
+    NULL,
+    NULL,
+    NULL,
+    "path-to-file",
+    NULL,
+    "count",
+    NULL,
+    NULL,
+    NULL
+};
+
+rc_t UsageSummary (char const * progname)
+{
+    return KOutMsg (
+        "Usage:\n"
+        "\t%s [options] <bam-file>\n"
+        "\n"
+        "Summary:\n"
+        "\tLoad a BAM formatted data file\n"
+        "\n"
+        "Example:\n"
+        "\t%s -o /tmp/SRZ123456 -k analysis.bam.cfg 123456.bam\n"
+        "\n"
+        ,progname, progname);
+}
+
+char const UsageDefaultName[] = "bam-load";
+
+rc_t CC Usage (const Args * args)
+{
+    rc_t rc;
+    int i;
+    const char * progname = UsageDefaultName;
+    const char * fullpath = UsageDefaultName;
+    const size_t argsQty = sizeof(Options) / sizeof(Options[0]);
+
+    if (args == NULL)
+        rc = RC (rcApp, rcArgv, rcAccessing, rcSelf, rcNull);
+    else
+        rc = ArgsProgram (args, &fullpath, &progname);
+    if (rc)
+        progname = fullpath = UsageDefaultName;
+
+    UsageSummary (progname);
+
+    for(i = 0; i < argsQty; i++ ) {
+        if( Options[i].required && Options[i].help[0] != NULL ) {
+            HelpOptionLine(Options[i].aliases, Options[i].name, OptHelpParam[i], Options[i].help);
+        }
+    }
+    OUTMSG(("\nOptions:\n"));
+    for(i = 0; i < argsQty; i++ ) {
+        if( !Options[i].required && Options[i].help[0] != NULL ) {
+            HelpOptionLine(Options[i].aliases, Options[i].name, OptHelpParam[i], Options[i].help);
+        }
+    }
+    XMLLogger_Usage();
+    OUTMSG(("\n"));
+    HelpOptionsStandard ();
+    HelpVersion (fullpath, KAppVersion());
+    return rc;
+}
+
+/* MARK: Definitions and Globals */
+
+#define SCHEMAFILE "align/align.vschema"
+
+CommonWriterSettings G;
+
+uint32_t CC KAppVersion (void)
+{
+    return BAM_LOAD_3_VERS;
+}
+
+#ifdef _WIN32
+#include <process.h>
+#else
+#include <unistd.h>
+#endif
+static void set_pid(void)
+{
+    G.pid = getpid();
+}
+
+static rc_t PathWithBasePath(char rslt[], size_t sz, char const path[], char const base[])
+{
+    size_t const plen = strlen(path);
+    bool const hasBase = base && base[0];
+    bool const isBareName = strchr(path, '/') == NULL;
+    
+    if (isBareName && hasBase) {
+        if (string_printf(rslt, sz, NULL, "%s/%s", base, path) == 0)
+            return 0;
+    }
+    else if (plen < sz) {
+        strcpy(rslt, path);
+        return 0;
+    }
+    {
+        rc_t const rc = RC(rcApp, rcArgv, rcAccessing, rcBuffer, rcInsufficient);
+        (void)LOGERR(klogErr, rc, "The path to the file is too long");
+        return rc;
+    }
+}
+
+static rc_t OpenFile(KFile const **kf, char const path[], char const base[])
+{
+    char fname[4096];
+    rc_t rc = PathWithBasePath(fname, sizeof(fname), path, base);
+    
+    if (rc == 0) {
+        KDirectory *dir;
+        
+        rc = KDirectoryNativeDir(&dir);
+        if (rc == 0) {
+            rc = KDirectoryOpenFileRead(dir, kf, "%s", fname);
+            KDirectoryRelease(dir);
+        }
+    }
+    return rc;
+}
+
+static rc_t LoadHeader(char const **rslt, char const path[], char const base[])
+{
+    KFile const *kf;
+    rc_t rc = OpenFile(&kf, path, base);
+    
+    *rslt = NULL;
+    if (rc == 0) {
+        uint64_t fsize;
+        rc = KFileSize(kf, &fsize);
+        if (rc == 0) {
+            char *fdata = malloc(fsize+1);
+            
+            if (fdata) {
+                size_t nread;
+                rc = KFileRead(kf, 0, fdata, fsize, &nread);
+                if (rc == 0) {
+                    if (nread) {
+                        fdata[nread] = '\0';
+                        *rslt = fdata;
+                    }
+                    else {
+                        free(fdata);
+                        rc = RC(rcApp, rcArgv, rcAccessing, rcFile, rcEmpty);
+                        (void)PLOGERR(klogErr, (klogErr, rc, "File '$(file)' is empty", "file=%s", path));
+                    }
+                }
+                else {
+                    (void)PLOGERR(klogErr, (klogErr, rc, "Failed to read file '$(file)'", "file=%s", path));
+                }
+            }
+            else {
+                rc = RC(rcApp, rcArgv, rcAccessing, rcMemory, rcExhausted);
+                (void)PLOGERR(klogErr, (klogErr, rc, "Failed to read file '$(file)'", "file=%s", path));
+            }
+        }
+        KFileRelease(kf);
+    }
+    else {
+        (void)PLOGERR(klogErr, (klogErr, rc, "Failed to open file '$(file)'", "file=%s", path));
+    }
+    return rc;
+}
+
+rc_t CC KMain (int argc, char * argv[])
+{
+    Args * args;
+    rc_t rc;
+    unsigned n_aligned = 0;
+    unsigned n_unalgnd = 0;
+    char *aligned[256];
+    char *unalgnd[256];
+    char *name_buffer = NULL;
+    unsigned next_name = 0;
+    unsigned nbsz = 0;
+    char const *value;
+    char *dummy;
+    const XMLLogger* xml_logger = NULL;
+    
+    memset(&G, 0, sizeof(G));
+    
+    G.mode = mode_Archive;
+    G.maxSeqLen = TableWriterRefSeq_MAX_SEQ_LEN;
+    G.schemaPath = SCHEMAFILE;
+    G.omit_aligned_reads = true;
+    G.omit_reference_reads = true;
+    G.minMapQual = 0; /* accept all */
+    G.tmpfs = "/tmp";
+#if _ARCH_BITS == 32
+    G.cache_size = ( size_t ) 1 << 30;
+#else
+    G.cache_size = ( size_t ) 10 << 30;
+#endif
+    G.maxErrCount = 1000;
+    G.maxErrPct = 5;
+    G.minMatchCount = 10;
+    
+    set_pid();
+
+    rc = ArgsMakeAndHandle (&args, argc, argv, 2, Options,
+                            sizeof Options / sizeof (OptDef), XMLLogger_Args, XMLLogger_ArgsQty);
+
+    while (rc == 0) {
+        uint32_t pcount;
+
+        if( (rc = XMLLogger_Make(&xml_logger, NULL, args)) != 0 ) {
+            break;
+        }
+        rc = ArgsOptionCount(args, option_only_verify, &pcount);
+        if (rc)
+            break;
+        G.onlyVerifyReferences = (pcount > 0);
+        
+        rc = ArgsOptionCount(args, option_no_verify, &pcount);
+        if (rc)
+            break;
+        G.noVerifyReferences = (pcount > 0);
+        
+        rc = ArgsOptionCount(args, option_use_qual, &pcount);
+        if (rc)
+            break;
+        G.useQUAL = (pcount > 0);
+        
+        rc = ArgsOptionCount(args, option_ref_config, &pcount);
+        if (rc)
+            break;
+        G.limit2config = (pcount > 0);
+        
+        rc = ArgsOptionCount(args, OPTION_REF_FILE, &pcount);
+        if (rc)
+            break;
+        G.refFiles = calloc(pcount + 1, sizeof(*(G.refFiles)));
+        if( !G.refFiles ) {
+            rc = RC(rcApp, rcArgv, rcAccessing, rcMemory, rcExhausted);
+            break;
+        }
+        while(pcount-- > 0) {
+            rc = ArgsOptionValue(args, OPTION_REF_FILE, pcount, &G.refFiles[pcount]);
+            if (rc)
+                break;
+        }
+
+        rc = ArgsOptionCount (args, OPTION_TMPFS, &pcount);
+        if (rc)
+            break;
+        if (pcount == 1)
+        {
+            rc = ArgsOptionValue (args, OPTION_TMPFS, 0, &G.tmpfs);
+            if (rc)
+                break;
+        }
+        else if (pcount > 1)
+        {
+            rc = RC(rcApp, rcArgv, rcAccessing, rcParam, rcExcessive);
+            OUTMSG (("Single parameter required\n"));
+            MiniUsage (args);
+            break;
+        }
+        
+        rc = ArgsOptionCount (args, OPTION_INPUT, &pcount);
+        if (rc)
+            break;
+        if (pcount == 1)
+        {
+            rc = ArgsOptionValue (args, OPTION_INPUT, 0, &G.inpath);
+            if (rc)
+                break;
+        }
+        else if (pcount > 1)
+        {
+            rc = RC(rcApp, rcArgv, rcAccessing, rcParam, rcExcessive);
+            OUTMSG (("Single input parameter required\n"));
+            MiniUsage (args);
+            break;
+        }
+        
+        rc = ArgsOptionCount (args, option_ref_filter, &pcount);
+        if (rc)
+            break;
+        if (pcount == 1)
+        {
+            rc = ArgsOptionValue (args, option_ref_filter, 0, &G.refFilter);
+            if (rc)
+                break;
+        }
+        else if (pcount > 1)
+        {
+            rc = RC(rcApp, rcArgv, rcAccessing, rcParam, rcExcessive);
+            OUTMSG (("Single parameter required\n"));
+            MiniUsage (args);
+            break;
+        }
+        
+        rc = ArgsOptionCount (args, OPTION_CONFIG, &pcount);
+        if (rc)
+            break;
+        if (pcount == 1)
+        {
+            rc = ArgsOptionValue (args, OPTION_CONFIG, 0, &G.refXRefPath);
+            if (rc)
+                break;
+        }
+        else if (pcount > 1)
+        {
+            rc = RC(rcApp, rcArgv, rcAccessing, rcParam, rcExcessive);
+            OUTMSG (("Single input parameter required\n"));
+            MiniUsage (args);
+            break;
+        }
+        
+        rc = ArgsOptionCount (args, OPTION_OUTPUT, &pcount);
+        if (rc)
+            break;
+        if (pcount == 1)
+        {
+            rc = ArgsOptionValue (args, OPTION_OUTPUT, 0, &G.outpath);
+            if (rc)
+                break;
+        }
+        else if (pcount > 1)
+        {
+            rc = RC(rcApp, rcArgv, rcAccessing, rcParam, rcExcessive);
+            OUTMSG (("Single output parameter required\n"));
+            MiniUsage (args);
+            break;
+        }
+        else if (!G.onlyVerifyReferences) {
+            rc = RC(rcApp, rcArgv, rcAccessing, rcParam, rcInsufficient);
+            OUTMSG (("Output parameter required\n"));
+            MiniUsage (args);
+            break;
+        }
+        
+        rc = ArgsOptionCount (args, OPTION_MINMAPQ, &pcount);
+        if (rc)
+            break;
+        if (pcount == 1)
+        {
+            rc = ArgsOptionValue (args, OPTION_MINMAPQ, 0, &value);
+            if (rc)
+                break;
+            G.minMapQual = strtoul(value, &dummy, 0);
+        }
+        
+        rc = ArgsOptionCount (args, OPTION_QCOMP, &pcount);
+        if (rc)
+            break;
+        if (pcount == 1)
+        {
+            rc = ArgsOptionValue (args, OPTION_QCOMP, 0, &G.QualQuantizer);
+            if (rc)
+                break;
+        }
+        
+        rc = ArgsOptionCount (args, option_edit_aligned_qual, &pcount);
+        if (rc)
+            break;
+        if (pcount == 1)
+        {
+            rc = ArgsOptionValue (args, option_edit_aligned_qual, 0, &value);
+            if (rc)
+                break;
+            G.alignedQualValue = strtoul(value, &dummy, 0);
+            if (G.alignedQualValue == 0) {
+                rc = RC(rcApp, rcArgv, rcAccessing, rcParam, rcIncorrect);
+                OUTMSG (("edit-aligned-qual: bad value\n"));
+                MiniUsage (args);
+                break;
+            }
+            G.editAlignedQual = true;
+        }
+        
+        rc = ArgsOptionCount (args, OPTION_CACHE_SIZE, &pcount);
+        if (rc)
+            break;
+        if (pcount == 1)
+        {
+            rc = ArgsOptionValue (args, OPTION_CACHE_SIZE, 0, &value);
+            if (rc)
+                break;
+            G.cache_size = strtoul(value, &dummy, 0) * 1024UL * 1024UL;
+            if (G.cache_size == 0) {
+                rc = RC(rcApp, rcArgv, rcAccessing, rcParam, rcIncorrect);
+                OUTMSG (("cache-size: bad value\n"));
+                MiniUsage (args);
+                break;
+            }
+        }
+        
+        rc = ArgsOptionCount (args, OPTION_MAX_WARN_DUP_FLAG, &pcount);
+        if (rc)
+            break;
+        if (pcount == 1)
+        {
+            rc = ArgsOptionValue (args, OPTION_MAX_WARN_DUP_FLAG, 0, &value);
+            if (rc)
+                break;
+            G.maxWarnCount_DupConflict = strtoul(value, &dummy, 0);
+        }
+        
+        rc = ArgsOptionCount (args, option_unsorted, &pcount);
+        if (rc)
+            break;
+        G.expectUnsorted = pcount > 0;
+        
+        rc = ArgsOptionCount (args, OPTION_MAX_REC_COUNT, &pcount);
+        if (rc)
+            break;
+        if (pcount == 1)
+        {
+            rc = ArgsOptionValue (args, OPTION_MAX_REC_COUNT, 0, &value);
+            if (rc)
+                break;
+            G.maxAlignCount = strtoul(value, &dummy, 0);
+        }
+        
+        rc = ArgsOptionCount (args, OPTION_MAX_ERR_COUNT, &pcount);
+        if (rc)
+            break;
+        if (pcount == 1)
+        {
+            rc = ArgsOptionValue (args, OPTION_MAX_ERR_COUNT, 0, &value);
+            if (rc)
+                break;
+            G.maxErrCount = strtoul(value, &dummy, 0);
+        }
+        
+        rc = ArgsOptionCount (args, OPTION_MAX_ERR_PCT, &pcount);
+        if (rc)
+            break;
+        if (pcount == 1)
+        {
+            rc = ArgsOptionValue (args, OPTION_MAX_ERR_PCT, 0, &value);
+            if (rc)
+                break;
+            G.maxErrPct = strtoul(value, &dummy, 0);
+        }
+        
+        rc = ArgsOptionCount (args, OPTION_MIN_MATCH, &pcount);
+        if (rc)
+            break;
+        if (pcount == 1)
+        {
+            rc = ArgsOptionValue (args, OPTION_MIN_MATCH, 0, &value);
+            if (rc)
+                break;
+            G.minMatchCount = strtoul(value, &dummy, 0);
+        }
+        
+        rc = ArgsOptionCount (args, OPTION_ACCEPT_DUP, &pcount);
+        if (rc)
+            break;
+        G.acceptBadDups = pcount > 0;
+        
+        rc = ArgsOptionCount (args, OPTION_ACCEPT_NOMATCH, &pcount);
+        if (rc)
+            break;
+        G.acceptNoMatch = pcount > 0;
+        
+        rc = ArgsOptionCount (args, option_keep_mismatch_qual, &pcount);
+        if (rc)
+            break;
+        G.keepMismatchQual = pcount > 0;
+        
+        rc = ArgsOptionCount (args, OPTION_NO_CS, &pcount);
+        if (rc)
+            break;
+        G.noColorSpace = pcount > 0;
+        
+        rc = ArgsOptionCount (args, OPTION_NO_SECONDARY, &pcount);
+        if (rc)
+            break;
+        G.noSecondary = pcount > 0;
+        
+        rc = ArgsOptionCount (args, OPTION_TI, &pcount);
+        if (rc)
+            break;
+        G.hasTI = pcount > 0;
+        
+        rc = ArgsOptionCount (args, OPTION_ACCEPT_HARD_CLIP, &pcount);
+        if (rc)
+            break;
+        G.acceptHardClip = pcount > 0;
+        
+        rc = ArgsOptionCount (args, OPTION_PARSE_SPOT_NAME, &pcount);
+        if (rc)
+            break;
+        G.parseSpotName = pcount > 0;
+        
+        rc = ArgsOptionCount (args, OPTION_NOMATCH_LOG, &pcount);
+        if (rc)
+            break;
+        if (pcount == 1)
+        {
+            KDirectory *dir;
+            
+            rc = ArgsOptionValue (args, OPTION_NOMATCH_LOG, 0, &value);
+            if (rc) break;
+            rc = KDirectoryNativeDir(&dir);
+            if (rc) break;
+            rc = KDirectoryCreateFile(dir, &G.noMatchLog, 0, 0664, kcmInit, "%s", value);
+            KDirectoryRelease(dir);
+            if (rc) break;
+        }
+        
+        rc = ArgsOptionCount (args, OPTION_HEADER, &pcount);
+        if (rc)
+            break;
+        if (pcount == 1) {
+            rc = ArgsOptionValue (args, OPTION_HEADER, 0, &value);
+            if (rc) break;
+            rc = LoadHeader(&G.headerText, value, G.inpath);
+            if (rc) break;
+        }
+        
+        rc = ArgsParamCount (args, &pcount);
+        if (rc) break;
+        if (pcount == 0)
+        {
+            rc = RC(rcApp, rcArgv, rcAccessing, rcParam, rcInsufficient);
+            MiniUsage (args);
+            break;
+        }
+        else if (pcount > sizeof(aligned)/sizeof(aligned[0])) {
+            rc = RC(rcApp, rcArgv, rcAccessing, rcParam, rcExcessive);
+            (void)PLOGERR(klogErr, (klogErr, rc, "$(count) input files is too many, $(max) is the limit",
+                        "count=%u,max=%u", (unsigned)pcount, (unsigned)(sizeof(aligned)/sizeof(aligned[0]))));
+            break;
+        }
+        else {
+            unsigned need = G.inpath ? (strlen(G.inpath) + 1) * pcount : 0;
+            unsigned i;
+            
+            for (i = 0; i < pcount; ++i) {
+                rc = ArgsParamValue(args, i, &value);
+                if (rc) break;
+                need += strlen(value) + 1;
+            }
+            nbsz = need;
+        }
+        
+        rc = ArgsOptionCount (args, OPTION_UNALIGNED, &pcount);
+        if (rc)
+            break;
+        if (pcount > 0)
+        {
+            unsigned need = G.inpath ? (strlen(G.inpath) + 1) * pcount : 0;
+            unsigned i;
+            
+            for (i = 0; i < pcount; ++i) {
+                rc = ArgsOptionValue(args, OPTION_UNALIGNED, i, &value);
+                if (rc) break;
+                need += strlen(value) + 1;
+            }
+            if (rc) break;
+            nbsz += need;
+        }
+        
+        name_buffer = malloc(nbsz);
+        if (name_buffer == NULL) {
+            rc = RC(rcApp, rcArgv, rcAccessing, rcMemory, rcExhausted);
+            break;
+        }
+        
+        rc = ArgsOptionCount (args, OPTION_UNALIGNED, &pcount);
+        if (rc == 0) {
+            unsigned i;
+            
+            for (i = 0; i < pcount; ++i) {
+                rc = ArgsOptionValue(args, OPTION_UNALIGNED, i, &value);
+                if (rc) break;
+                
+                unalgnd[n_unalgnd++] = name_buffer + next_name;
+                rc = PathWithBasePath(name_buffer + next_name, nbsz - next_name, value, G.inpath);
+                if (rc) break;
+                next_name += strlen(name_buffer + next_name) + 1;
+            }
+            if (rc) break;
+        }
+        else
+            break;
+        
+        rc = ArgsParamCount (args, &pcount);
+        if (rc == 0) {
+            unsigned i;
+            
+            for (i = 0; i < pcount; ++i) {
+                rc = ArgsParamValue(args, i, &value);
+                if (rc) break;
+                
+                aligned[n_aligned++] = name_buffer + next_name;
+                rc = PathWithBasePath(name_buffer + next_name, nbsz - next_name, value, G.inpath);
+                if (rc) break;
+                next_name += strlen(name_buffer + next_name) + 1;
+            }
+        }
+        else
+            break;
+        
+        rc = run(argv[0], &G, n_aligned, (char const **)aligned, n_unalgnd, (char const **)unalgnd);
+        break;
+    }
+    free(name_buffer);
+    free((void *)G.headerText);
+    free(G.refFiles);
+
+    value = G.outpath ? strrchr(G.outpath, '/') : "/???";
+    if( value == NULL ) {
+        value = G.outpath;
+    } else {
+        value++;
+    }
+    if (rc) {
+        (void)PLOGERR(klogErr, (klogErr, rc, "load failed",
+                "severity=total,status=failure,accession=%s,errors=%u", value, G.errCount));
+    } else {
+        (void)PLOGMSG(klogInfo, (klogInfo, "loaded",
+                "severity=total,status=success,accession=%s,errors=%u", value, G.errCount));
+    }
+    ArgsWhack(args);
+    XMLLogger_Release(xml_logger);
+    return rc;
+}
diff --git a/tools/bam-loader/bam-reader.c b/tools/bam-loader/bam-reader.c
new file mode 100644
index 0000000..ca397e9
--- /dev/null
+++ b/tools/bam-loader/bam-reader.c
@@ -0,0 +1,1104 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+ 
+typedef struct BamReaderFile    BamReaderFile;
+typedef struct BamRecord        BamRecord;
+typedef struct BamSequence      BamSequence;
+typedef struct BamAlignment     BamAlignment;
+typedef struct BamCGData        BamCGData;
+typedef struct BamReferenceInfo BamReferenceInfo;
+
+#define READERFILE_IMPL     BamReaderFile
+#define RECORD_IMPL         BamRecord
+#define SEQUENCE_IMPL       BamSequence
+#define ALIGNMENT_IMPL      BamAlignment
+#define CGDATA_IMPL         BamCGData
+#define REFERENCEINFO_IMPL  BamReferenceInfo
+
+#include "bam-reader.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+#include <loader/common-reader-priv.h>
+
+struct BamSequence
+{
+    Sequence    dadSeq;
+    Alignment   dadAlign;
+    CGData      dadCG;
+    KRefcount   refcount;
+    
+    const BAMAlignment* bam;    
+    uint16_t flags;
+};
+
+struct BamRecord
+{
+    Record  dad;
+
+    BamSequence seq;
+    Rejected*   rej; 
+};
+/*TODO: remove when done refactoring */
+const BAMAlignment *ToBamAlignment(const Record* record)
+{
+   assert(record);
+   return ((const BamRecord*)record)->seq.bam;
+}
+
+static rc_t BamSequenceInit(BamSequence* self);
+
+/*--------------------------------------------------------------------------
+ * BamRecord
+ */
+static rc_t BamRecordAddRef   ( const BamRecord* self );
+static rc_t BamRecordRelease  ( const BamRecord* self );
+static rc_t BamRecordGetSequence  ( const BamRecord* self, const Sequence** result);
+static rc_t BamRecordGetAlignment ( const BamRecord* self, const Alignment** result);
+static rc_t BamRecordGetRejected  ( const BamRecord* self, const Rejected** result);
+
+static Record_vt_v1 BamRecord_vt = 
+{
+    1, 0, 
+    /* start minor version == 0 */
+    BamRecordAddRef,
+    BamRecordRelease,
+    BamRecordGetSequence,
+    BamRecordGetAlignment,
+    BamRecordGetRejected,
+    /* end minor version == 0 */
+};
+
+static rc_t CC BamRecordInit ( BamRecord* self )
+{
+    assert(self);
+    self->dad.vt.v1 = & BamRecord_vt; 
+    self->rej = 0;
+    return BamSequenceInit(& self->seq);
+}
+
+static rc_t BamRecordWhack( const BamRecord* self )
+{
+    rc_t rc = 0;
+    assert(self);
+    
+    rc = BAMAlignmentRelease(self->seq.bam);
+
+    if (rc != 0)
+        RejectedRelease(self->rej);
+    else
+        rc = RejectedRelease(self->rej);
+
+    free ( (BamRecord*) self );
+    
+    return rc;
+}
+
+static rc_t BamRecordAddRef( const BamRecord* self )
+{
+    assert(self);
+    KRefcountAdd( & self->seq.refcount, "BamRecord" );
+    /* TODO: handle rc from KRefcountAdd */
+    return 0;
+}
+
+static rc_t BamRecordRelease( const BamRecord* cself )
+{
+    if ( cself != NULL )
+    {
+        BamRecord *self = ( BamRecord* ) cself;
+        switch ( KRefcountDrop ( & self ->seq.refcount, "BamRecord" ) )
+        {
+        case krefWhack:
+            BamRecordWhack( self );
+            break;
+        default:
+            /* TODO: handle other values */
+            break;
+        }
+    }
+    return 0;
+}
+
+static rc_t BamRecordGetSequence( const BamRecord* self, const Sequence** result )
+{
+    rc_t rc = 0;
+    assert(result);
+    rc = BamRecordAddRef(self);
+    if (rc == 0)
+        *result = (const Sequence*) & self->seq;
+    else
+        *result = 0;
+    return rc;
+}
+
+static rc_t BamRecordGetAlignment( const BamRecord* self, const Alignment** result)
+{
+    rc_t rc = 0;
+    assert(result);
+
+    /* do not allow access is flagged as unmapped*/
+    if ((self->seq.flags & BAMFlags_SelfIsUnmapped) != 0)
+        *result = 0;
+    else
+    {
+        rc = BamRecordAddRef(self);
+        if (rc == 0)
+            *result = (const Alignment*) & self->seq.dadAlign;
+        else
+            *result = 0;
+    }
+    return rc;
+}
+
+static rc_t BamRecordGetRejected( const BamRecord* self, const Rejected** result)
+{
+    rc_t rc = 0;
+    assert(result);
+    *result = 0;
+    if (self->rej != 0)
+    {
+        rc = RejectedAddRef(self->rej);
+        if (rc == 0)
+            *result = self->rej;
+    }
+    return rc;
+}
+
+/*--------------------------------------------------------------------------
+ * BamSequence forwards
+ */
+static rc_t BamSequenceAddRef                   ( const BamSequence* self );
+static rc_t BamSequenceRelease                  ( const BamSequence* self );
+static rc_t BamSequenceGetReadLength            ( const BamSequence *self, uint32_t *length );
+static rc_t BamSequenceGetRead                  ( const BamSequence *self, char *sequence );
+static rc_t BamSequenceGetRead2                 ( const BamSequence *self, char *sequence, uint32_t start, uint32_t stop );
+static rc_t BamSequenceGetQuality               ( const BamSequence *self, const int8_t **quality, uint8_t *offset, int *qualType );
+static rc_t BamSequenceGetSpotGroup             ( const BamSequence *self, const char **name, size_t *length );
+static rc_t BamSequenceGetSpotName              ( const BamSequence *self, const char **name, size_t *length );
+static bool BamSequenceIsColorSpace             ( const BamSequence *self );
+static rc_t BamSequenceGetCSKey                 ( const BamSequence *self, char cskey[1] );
+static rc_t BamSequenceGetCSReadLength          ( const BamSequence *self, uint32_t *length );
+static rc_t BamSequenceGetCSRead                ( const BamSequence *self, char *sequence );
+static rc_t BamSequenceGetCSQuality             ( const BamSequence *self, const int8_t **quality, uint8_t *offset, int *qualType );
+static bool BamSequenceRecordWasPaired          ( const BamSequence *self );
+static int  BamSequenceRecordOrientationSelf    ( const BamSequence *self );
+static int  BamSequenceRecordOrientationMate    ( const BamSequence *self );
+static bool BamSequenceRecordIsFirst            ( const BamSequence *self );
+static bool BamSequenceRecordIsSecond           ( const BamSequence *self );
+static bool BamSequenceRecordIsDuplicate        ( const BamSequence *self );
+static bool BamSequenceIsLowQuality             ( const BamSequence *self ); 
+static rc_t BamSequenceGetTI                    ( const BamSequence *self, uint64_t *ti );
+
+/*--------------------------------------------------------------------------
+ * BamCGData
+ */
+
+static rc_t BamCGDataAddRef         ( const BamCGData* self );
+static rc_t BamCGDataRelease        ( const BamCGData* self );
+static rc_t BamCGDataGetSeqQual     ( const BamCGData* self, char sequence[/* 35 */], uint8_t quality[/* 35 */] );
+static rc_t BamCGDataGetCigar       ( const BamCGData* self, uint32_t *cigar, uint32_t cig_max, uint32_t *cig_act );
+static rc_t BamCGDataGetAlignGroup  ( const BamCGData* self, char buffer[], size_t max_size, size_t *act_size );
+
+/* CGGetAlignGroup
+ */
+rc_t CC CGDataGetAlignGroup ( const CGData* self,
+                              char buffer[],
+                              size_t max_size,
+                              size_t *act_size );
+
+static CGData_vt_v1 BamCGData_vt = {
+    1, 0, 
+    /* start minor version == 0 */
+    BamCGDataAddRef,
+    BamCGDataRelease,
+    
+    BamCGDataGetSeqQual,
+    BamCGDataGetCigar,
+    BamCGDataGetAlignGroup
+    /* end minor version == 0 */
+};
+
+static const BamSequence*
+BamCGDataToSequence(const BamCGData* cg) 
+{
+    return ( const BamSequence * ) ( (uint8_t*)cg- offsetof ( BamSequence, dadCG) );
+}
+
+static rc_t BamCGDataAddRef  ( const BamCGData* self )
+{
+    return BamSequenceAddRef(BamCGDataToSequence(self));
+}
+
+static rc_t BamCGDataRelease ( const BamCGData* self )
+{
+    return BamSequenceRelease(BamCGDataToSequence(self));
+}
+
+static rc_t BamCGDataGetSeqQual ( const BamCGData* self, char sequence[/* 35 */], uint8_t quality[/* 35 */] )
+{
+    return BAMAlignmentGetCGSeqQual(BamCGDataToSequence(self)->bam, sequence, quality);
+}
+
+static rc_t BamCGDataGetCigar ( const BamCGData* self, uint32_t *cigar, uint32_t cig_max, uint32_t *cig_act )
+{
+    return BAMAlignmentGetCGCigar(BamCGDataToSequence(self)->bam, cigar, cig_max, cig_act);
+}
+
+static rc_t BamCGDataGetAlignGroup ( const BamCGData* self, char buffer[], size_t max_size, size_t *act_size )
+{
+    return BAMAlignmentGetCGAlignGroup(BamCGDataToSequence(self)->bam, buffer, max_size, act_size);
+}
+
+/*--------------------------------------------------------------------------
+ * BamAlignment
+ */
+
+static rc_t BamAlignmentAddRef  ( const BamAlignment* self );
+static rc_t BamAlignmentRelease ( const BamAlignment* self );
+
+static rc_t BamAlignmentGetRefSeqId         ( const BamAlignment *self, int32_t *refSeqId );
+static rc_t BamAlignmentGetMateRefSeqId     ( const BamAlignment *self, int32_t *refSeqId );
+static rc_t BamAlignmentGetPosition         ( const BamAlignment *self, int64_t *pos );
+static rc_t BamAlignmentGetMatePosition     ( const BamAlignment *self, int64_t *pos );
+static rc_t BamAlignmentGetMapQuality       ( const BamAlignment *self, uint8_t *qual );
+static rc_t BamAlignmentGetAlignmentDetail  ( const BamAlignment *self, AlignmentDetail *rslt, uint32_t count, uint32_t *actual, int32_t *firstMatch, int32_t *lastMatch );
+static rc_t BamAlignmentGetAlignOpCount     ( const BamAlignment *self, uint32_t *n );
+static rc_t BamAlignmentGetInsertSize       ( const BamAlignment *self, int64_t *size );
+static rc_t BamAlignmentGetCGData           ( const BamAlignment *self, const CGData** cg);
+static rc_t BamAlignmentGetBAMCigar         ( const BamAlignment *self, uint32_t const **rslt, uint32_t *length );
+static bool BamAlignmentIsSecondary         ( const BamAlignment *self );
+
+static Alignment_vt_v1 BamAlignment_vt = {
+    1, 0, 
+    /* start minor version == 0 */
+    BamAlignmentAddRef,
+    BamAlignmentRelease,
+    BamAlignmentGetRefSeqId,
+    BamAlignmentGetMateRefSeqId,
+    BamAlignmentGetPosition,
+    BamAlignmentGetMatePosition,
+    BamAlignmentGetMapQuality,
+    BamAlignmentGetAlignmentDetail,
+    BamAlignmentGetAlignOpCount,
+    BamAlignmentGetInsertSize,
+    BamAlignmentGetCGData,
+    BamAlignmentGetBAMCigar,
+    BamAlignmentIsSecondary,
+    /* end minor version == 0 */
+};
+
+static const BamSequence*
+BamAlignmentToSequence(const BamAlignment* align) 
+{
+    return ( const BamSequence * ) ( (uint8_t*)align - offsetof ( BamSequence, dadAlign ) );
+}
+
+static rc_t BamAlignmentAddRef  ( const BamAlignment* self )
+{
+    return BamSequenceAddRef(BamAlignmentToSequence(self));
+}
+
+static rc_t BamAlignmentRelease ( const BamAlignment* self )
+{
+    return BamSequenceRelease(BamAlignmentToSequence(self));
+}
+
+static rc_t BamAlignmentGetRefSeqId        ( const BamAlignment *self, int32_t *refSeqId )
+{
+    return BAMAlignmentGetRefSeqId(BamAlignmentToSequence(self)->bam, refSeqId);
+}
+
+static rc_t BamAlignmentGetMateRefSeqId    ( const BamAlignment *self, int32_t *refSeqId )
+{
+    return BAMAlignmentGetMateRefSeqId(BamAlignmentToSequence(self)->bam, refSeqId);
+}
+
+static rc_t BamAlignmentGetPosition        ( const BamAlignment *self, int64_t *pos )
+{
+    return BAMAlignmentGetPosition(BamAlignmentToSequence(self)->bam, pos);
+}
+
+static rc_t BamAlignmentGetMatePosition     ( const BamAlignment *self, int64_t *pos )
+{
+    return BAMAlignmentGetMatePosition(BamAlignmentToSequence(self)->bam, pos);
+}
+
+static rc_t BamAlignmentGetMapQuality      ( const BamAlignment *self, uint8_t *qual )
+{
+    return BAMAlignmentGetMapQuality(BamAlignmentToSequence(self)->bam, qual);
+}
+
+static rc_t BamAlignmentGetAlignmentDetail ( const BamAlignment *self, AlignmentDetail *rslt, uint32_t count, uint32_t *actual, int32_t *firstMatch, int32_t *lastMatch )
+{
+    return BAMAlignmentGetAlignmentDetail ( BamAlignmentToSequence(self)->bam, (BAMAlignmentDetail*)rslt, count, actual, firstMatch, lastMatch );
+}
+
+static rc_t BamAlignmentGetAlignOpCount    ( const BamAlignment *self, uint32_t *n )
+{
+    return BAMAlignmentGetCigarCount ( BamAlignmentToSequence(self)->bam, n );
+}
+
+static rc_t BamAlignmentGetInsertSize      ( const BamAlignment *self, int64_t *size )
+{
+    return BAMAlignmentGetInsertSize ( BamAlignmentToSequence(self)->bam, size );
+}
+
+static rc_t BamAlignmentGetCGData ( const BamAlignment *self, const CGData** cg)
+{
+    rc_t rc = 0;
+    if (BAMAlignmentHasCGData(BamAlignmentToSequence(self)->bam))
+    {
+        rc_t rc = BamAlignmentAddRef(self);
+        if (rc == 0)
+            *cg = (const CGData*) & BamAlignmentToSequence(self)->dadCG;
+        else
+            *cg = 0;
+    }
+    else
+        *cg = 0;
+    return rc;
+}
+
+static rc_t BamAlignmentGetBAMCigar        ( const BamAlignment *self, uint32_t const **rslt, uint32_t *length )
+{
+    return BAMAlignmentGetRawCigar(BamAlignmentToSequence(self)->bam, rslt, length);
+}
+
+static bool BamAlignmentIsSecondary( const BamAlignment *self )
+{
+    return (BamAlignmentToSequence(self)->flags & BAMFlags_IsNotPrimary) != 0;
+}
+
+/*--------------------------------------------------------------------------
+ * BamSequence 
+ */
+
+static Sequence_vt_v1 BamSequence_vt = 
+{
+    1, 0, 
+    /* start minor version == 0 */
+    BamSequenceAddRef,
+    BamSequenceRelease,
+    BamSequenceGetReadLength,
+    BamSequenceGetRead,  
+    BamSequenceGetRead2,
+    BamSequenceGetQuality,
+    BamSequenceGetSpotGroup,
+    BamSequenceGetSpotName, 
+    BamSequenceIsColorSpace,
+    BamSequenceGetCSKey,
+    BamSequenceGetCSReadLength,
+    BamSequenceGetCSRead,
+    BamSequenceGetCSQuality,
+    BamSequenceRecordWasPaired,
+    BamSequenceRecordOrientationSelf,
+    BamSequenceRecordOrientationMate,
+    BamSequenceRecordIsFirst,
+    BamSequenceRecordIsSecond,
+    BamSequenceRecordIsDuplicate,
+    BamSequenceIsLowQuality,
+    BamSequenceGetTI,
+    /* end minor version == 0 */
+};
+
+static
+rc_t
+BamSequenceInit(BamSequence* self)
+{
+    self->dadSeq.vt.v1 = & BamSequence_vt;
+    self->dadAlign.vt.v1 = & BamAlignment_vt;
+    self->dadCG.vt.v1 = & BamCGData_vt;
+    KRefcountInit ( & self -> refcount, 1, "BamSequence", "BamSequenceInit", "");
+    self->bam= 0;
+    self->flags = 0;
+
+    return 0;
+}
+
+static const BamRecord*
+BamSequenceToRecord(const BamSequence* seq) 
+{
+    return ( const BamRecord * ) ( (uint8_t*)seq - offsetof ( BamRecord, seq ) );
+}
+
+static rc_t BamSequenceAddRef( const BamSequence* self )
+{
+    switch (KRefcountAdd( & self->refcount, "BamSequence" ))
+    {
+    case krefLimit:
+        return RC ( RC_MODULE, rcData, rcAttaching, rcRange, rcExcessive );
+    case krefNegative:
+        return RC ( RC_MODULE, rcData, rcAttaching, rcRefcount, rcInvalid );
+    }
+    return 0;
+}
+
+static rc_t BamSequenceRelease( const BamSequence* self )
+{
+    if ( self != NULL )
+    {
+        switch ( KRefcountDrop ( & self -> refcount, "BamSequence" ) )
+        {
+        case krefWhack:
+            return BamRecordWhack ( BamSequenceToRecord(self) );
+
+        case krefNegative:
+            return RC ( RC_MODULE, rcData, rcDestroying, rcSelf, rcDestroyed );
+        }
+    }
+
+    return 0;
+
+}
+
+static rc_t BamSequenceGetReadLength ( const BamSequence *self, uint32_t *length )
+{
+    assert(self);
+    assert(self->bam);
+    return BAMAlignmentGetReadLength(self->bam, length);
+}
+
+static rc_t BamSequenceGetRead ( const BamSequence *self, char *sequence )
+{
+    assert(self);
+    assert(self->bam);
+    assert(sequence);
+    return BAMAlignmentGetSequence(self->bam, sequence);
+}
+
+static rc_t BamSequenceGetRead2 ( const BamSequence *self, char *sequence, uint32_t start, uint32_t stop )
+{
+    assert(self);
+    assert(self->bam);
+    assert(sequence);
+    return BAMAlignmentGetSequence2(self->bam, sequence, start, stop);
+}
+
+static rc_t BamSequenceGetQuality ( const BamSequence *self, const int8_t **quality, uint8_t *offset, int *qualType )
+{
+    assert(self);
+    assert(self->bam);
+    assert(quality);
+    assert(offset);
+    assert(qualType);
+    {
+        rc_t rc = BAMAlignmentGetQuality2(self->bam, (const uint8_t **)quality, offset);
+        if (rc != 0)
+        {
+            *quality = NULL;
+            *offset = 0;
+            *qualType = 0;
+        }
+        else
+            *qualType = QT_Phred;
+        return rc;
+    }
+}
+
+static rc_t BamSequenceGetSpotGroup ( const BamSequence *self, const char **name, size_t *length )
+{
+    assert(self);
+    assert(self->bam);
+    assert(name);
+    {
+        rc_t rc = BAMAlignmentGetReadGroupName ( self->bam, name );
+        if (rc != 0)
+        {
+            *name = NULL;
+            *length = 0;
+        }
+        else
+            *length = string_size(*name);
+        return rc;
+    }
+}
+
+static rc_t BamSequenceGetSpotName ( const BamSequence *self, const char **name, size_t *length )
+{
+    assert(self);
+    assert(self->bam);
+    assert(name);
+    {
+        rc_t rc = BAMAlignmentGetReadName ( self->bam, name );
+        if (rc != 0)
+        {
+            *name = NULL;
+            *length = 0;
+        }
+        else
+            *length = string_size(*name);
+        return rc;
+    }
+}
+
+static bool BamSequenceIsColorSpace ( const BamSequence *self )
+{
+    assert(self);
+    assert(self->bam);
+    return BAMAlignmentHasColorSpace(self->bam);
+}
+
+static rc_t BamSequenceGetCSKey ( const BamSequence *self, char cskey[1] )
+{
+    assert(self);
+    assert(self->bam);
+    return BAMAlignmentGetCSKey(self->bam, cskey);
+}
+
+static rc_t BamSequenceGetCSReadLength     ( const BamSequence *self, uint32_t *length )
+{
+    assert(self);
+    assert(self->bam);
+    assert(length);
+    return BAMAlignmentGetCSSeqLen(self->bam, length);
+}
+
+static rc_t BamSequenceGetCSRead ( const BamSequence *self, char *sequence )
+{
+    assert(self);
+    assert(self->bam);
+    assert(sequence);
+    {
+        uint32_t length;
+        rc_t rc = BAMAlignmentGetCSSeqLen(self->bam, &length);
+        return rc ? rc : BAMAlignmentGetCSSequence(self->bam, sequence, length);
+    }
+}
+
+static rc_t BamSequenceGetCSQuality ( const BamSequence *self, const int8_t **quality, uint8_t *offset, int *qualType )
+{
+    assert(self);
+    assert(self->bam);
+    assert(quality);
+    assert(offset);
+    assert(qualType);
+    {
+        rc_t rc = BAMAlignmentGetCSQuality(self->bam, (const uint8_t **)quality, offset);
+        if (rc != 0)
+        {
+            *quality = NULL;
+            *offset = 0;
+            *qualType = 0;
+        }
+        else
+            *qualType = QT_Phred;
+        return rc;
+    }
+}
+
+static bool BamSequenceRecordWasPaired ( const BamSequence *self )
+{
+    return self->flags & BAMFlags_WasPaired;
+}
+
+static int BamSequenceRecordOrientationSelf ( const BamSequence *self )
+{
+    return (self->flags & BAMFlags_SelfIsReverse) ? ReadOrientationReverse : ReadOrientationForward;
+}
+
+static int BamSequenceRecordOrientationMate ( const BamSequence *self )
+{
+    return (self->flags & BAMFlags_MateIsReverse) ? ReadOrientationReverse : ReadOrientationForward;;
+}
+
+static bool BamSequenceRecordIsFirst ( const BamSequence *self )
+{
+    return self->flags & BAMFlags_IsFirst;
+}
+
+static bool BamSequenceRecordIsSecond ( const BamSequence *self )
+{
+    return self->flags & BAMFlags_IsSecond;
+}
+
+static bool BamSequenceRecordIsDuplicate ( const BamSequence *self )
+{
+    return self->flags & BAMFlags_IsDuplicate;
+}
+
+static bool BamSequenceIsLowQuality ( const BamSequence *self )
+{
+    return self->flags & BAMFlags_IsLowQuality;
+}
+
+static rc_t BamSequenceGetTI ( const BamSequence *self, uint64_t *ti )
+{
+    return BAMAlignmentGetTI(self->bam, ti);
+}
+
+ /*--------------------------------------------------------------------------
+ * BamReferenceInfo forwards
+ */
+static rc_t BamReferenceAddRef                  ( const BamReferenceInfo* self );
+static rc_t BamReferenceRelease                 ( const BamReferenceInfo* self );
+static rc_t BamReferenceInfoGetRefSeqCount      ( const BamReferenceInfo* self, uint32_t* count );
+static rc_t BamReferenceInfoGetRefSeq           ( const BamReferenceInfo* self, uint32_t n, ReferenceSequence* result );
+static rc_t BamReferenceInfoGetReadGroupCount   ( const BamReferenceInfo* self, uint32_t* count );
+static rc_t BamReferenceInfoGetReadGroup        ( const BamReferenceInfo* self, unsigned n, ReadGroup* result );
+static rc_t BamReferenceInfoGetReadGroupByName  ( const BamReferenceInfo* self, const char* name, ReadGroup* result );
+
+static ReferenceInfo_vt_v1 BamReferenceInfo_vt = 
+{
+    1, 0, 
+    /* start minor version == 0 */
+    BamReferenceAddRef,
+    BamReferenceRelease,
+    BamReferenceInfoGetRefSeqCount,
+    BamReferenceInfoGetRefSeq,
+    BamReferenceInfoGetReadGroupCount,
+    BamReferenceInfoGetReadGroup,
+    BamReferenceInfoGetReadGroupByName,
+    /* end minor version == 0 */
+};
+
+/*--------------------------------------------------------------------------
+ * BamReaderFile
+ */
+static rc_t BamReaderFileWhack                      ( BamReaderFile* self );
+static rc_t BamReaderFileGetRecord                  ( const BamReaderFile *self, const Record** result );
+static float BamReaderFileGetProportionalPosition   ( const BamReaderFile *self );
+static rc_t BamReaderFileGetReferenceInfo           ( const BamReaderFile *self, const ReferenceInfo** result );
+
+static ReaderFile_vt_v1 BamReaderFile_vt = 
+{
+    1, 0, 
+    /* start minor version == 0 */
+    BamReaderFileWhack,
+    BamReaderFileGetRecord,
+    BamReaderFileGetProportionalPosition,
+    BamReaderFileGetReferenceInfo,
+    /* end minor version == 0 */
+};
+
+struct BamReaderFile
+{
+    ReaderFile dad;
+    ReferenceInfo refInfo;
+    
+    const BAMFile* reader;
+};
+
+const BAMFile* ToBam(const ReaderFile* reader)
+{
+   assert(reader);
+   return ((const BamReaderFile*)reader)->reader;
+}
+
+float BamReaderFileGetProportionalPosition ( const BamReaderFile *f )
+{
+    BamReaderFile* self = (BamReaderFile*) f;
+    return BAMFileGetProportionalPosition(self->reader);
+} 
+
+rc_t BamReaderFileGetReferenceInfo ( const BamReaderFile *self, const ReferenceInfo** result )
+{
+    *result = & self->refInfo;
+    return ReaderFileAddRef( & self->dad );
+}
+
+rc_t BamReaderFileWhack( BamReaderFile* f )
+{
+    BamReaderFile* self = (BamReaderFile*) f;
+    
+    BAMFileRelease(self->reader);
+    
+    free ( (void*)self->dad.pathname );
+    free ( self );
+    
+    return 0;   
+}
+
+rc_t BamReaderFileGetRecord ( const BamReaderFile *f, const Record** result )
+{
+    rc_t rc;
+    BamReaderFile* self = (BamReaderFile*) f;
+
+    BamRecord* record = (BamRecord*)malloc(sizeof(BamRecord));
+    if (record == NULL)
+    {
+        rc = RC ( RC_MODULE, rcData, rcAllocating, rcMemory, rcExhausted );
+        return 0;
+    }
+    rc = BamRecordInit(record);
+    if (rc != 0)
+    {
+        free(record);
+        return rc;
+    }
+    
+    rc = BAMFileRead2(self->reader, &record->seq.bam);
+    if (rc)
+    {
+        if (GetRCModule(rc) == rcAlign && GetRCObject(rc) == rcRow && GetRCState(rc) == rcNotFound)
+        {   /* end of input */
+            rc = 0; 
+        }
+        *result = 0;
+        BamRecordRelease(record);
+    }    
+    else
+    {
+        *result = (const Record*)record;
+        BAMAlignmentGetFlags(record->seq.bam, &record->seq.flags);
+    }
+        
+    return rc;
+}
+
+rc_t CC BamReaderFileMake( const ReaderFile **reader, char const headerText[], char const path[])
+{
+    rc_t rc;
+    BamReaderFile* self = (BamReaderFile*) malloc ( sizeof * self );
+    if ( self == NULL )
+    {
+        rc = RC ( RC_MODULE, rcFileFormat, rcAllocating, rcMemory, rcExhausted );
+        *reader = 0;
+    }
+    else
+    {
+        rc = ReaderFileInit ( self );
+        self->dad.vt.v1 = & BamReaderFile_vt;
+        self->refInfo.vt.v1 = & BamReferenceInfo_vt;
+
+        self->dad.pathname = string_dup(path, strlen(path)+1);
+        if ( self->dad.pathname == NULL )
+        {
+            rc = RC ( RC_MODULE, rcFileFormat, rcAllocating, rcMemory, rcExhausted );
+        }
+        
+        rc = BAMFileMakeWithHeader ( &self->reader, headerText, "%s", self->dad.pathname );
+        
+        if (rc != 0)
+        {
+            BamReaderFileWhack( self );
+            *reader = 0;
+        }
+        else
+        {
+            *reader = (const ReaderFile *) self;
+        }
+    }
+ 
+    return rc;
+}
+
+/*--------------------------------------------------------------------------
+ * BamReferenceInfo
+ */
+static const BamReaderFile*
+BamRefInfoToReader(const BamReferenceInfo* ref) 
+{
+    return ( const BamReaderFile * ) ( (uint8_t*)ref - offsetof ( BamReaderFile, refInfo ) );
+}
+
+rc_t BamReferenceAddRef ( const BamReferenceInfo* self )
+{
+    return ReaderFileAddRef( & BamRefInfoToReader(self)->dad );
+}
+
+rc_t BamReferenceRelease ( const BamReferenceInfo* self )
+{
+    return ReaderFileRelease ( & BamRefInfoToReader(self)->dad );
+}
+
+rc_t BamReferenceInfoGetRefSeqCount ( const BamReferenceInfo* self, uint32_t* count )
+{
+    return BAMFileGetRefSeqCount( BamRefInfoToReader(self)->reader, count );
+}
+
+rc_t BamReferenceInfoGetRefSeq ( const BamReferenceInfo *self, uint32_t n, ReferenceSequence *result )
+{
+    const BAMRefSeq *refSeq;
+    rc_t rc = BAMFileGetRefSeq( BamRefInfoToReader(self)->reader, n, &refSeq );
+    if (rc != 0 || refSeq == NULL)
+    {
+        return RC ( RC_MODULE, rcHeader, rcAccessing, rcParam, rcOutofrange );
+    }
+    
+    result->length = refSeq->length;
+    result->name = refSeq->name;
+    result->checksum = refSeq->checksum;
+    
+    return 0;
+}
+
+rc_t BamReferenceInfoGetReadGroupCount ( const BamReferenceInfo *self, uint32_t *count )
+{
+    return BAMFileGetReadGroupCount ( BamRefInfoToReader(self)->reader, count );
+}
+
+rc_t BamReferenceInfoGetReadGroup ( const BamReferenceInfo *self, unsigned n, ReadGroup* result )
+{
+    const BAMReadGroup *rg;
+    rc_t rc = BAMFileGetReadGroup( BamRefInfoToReader(self)->reader, n, &rg );
+    if (rc != 0 || rg == NULL)
+    {
+        return RC ( RC_MODULE, rcHeader, rcAccessing, rcParam, rcOutofrange );
+    }
+        
+    result->name = rg->name;
+    result->platform = rg->platform;
+    
+    return 0;
+}
+
+rc_t BamReferenceInfoGetReadGroupByName ( const BamReferenceInfo *self, const char *name, ReadGroup *result )
+{
+    const BAMReadGroup *rg;
+    rc_t rc = BAMFileGetReadGroupByName( BamRefInfoToReader(self)->reader, name, &rg );
+    if (rc != 0 || rg == NULL)
+    {
+        return RC ( RC_MODULE, rcHeader, rcAccessing, rcParam, rcOutofrange );
+    }
+    
+    result->name = rg->name;
+    result->platform = rg->platform;
+    
+    return 0;
+}
+
+
+
+
+
+ 
+#ifdef TENTATIVE 
+/**************************** future parsing-on-a-thread code *****************************************/
+
+#include "bam-reader.h"
+
+#include <atomic32.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <klib/rc.h>
+#include <kproc/lock.h>
+#include <kproc/cond.h>
+#include <kproc/thread.h>
+
+#define BUFFER_COUNT (3)
+
+struct BAMReader
+{
+    atomic32_t refcount;
+    const BAMFile* file;
+    
+    KLock *lock;
+    KCondition *have_data;
+    KCondition *need_data;
+    KThread *th;
+
+    const BAMAlignment* que[BUFFER_COUNT];
+    unsigned volatile nque;
+    rc_t volatile rc;
+    
+    bool eof;
+};
+
+static rc_t BAMReaderThreadMain(KThread const *const th, void *const vp);
+
+#define END_OF_DATA RC(rcAlign, rcFile, rcReading, rcRow, rcNotFound)
+
+rc_t BAMReaderMake( const BAMReader **result,
+                    char const headerText[],
+                    char const path[] )
+{
+    rc_t rc;
+    BAMReader *self = malloc(sizeof(BAMReader));
+    if ( self == NULL )
+    {
+        *result = NULL;
+        return RC(rcAlign, rcFile, rcConstructing, rcMemory, rcExhausted);
+    }
+    else
+    {
+        atomic32_set( & self->refcount, 1 );
+        rc = BAMFileMakeWithHeader( & self->file, headerText, "%s", path);
+        if ( rc != 0 )
+        {
+            free(self);
+            *result = 0;
+        }
+        else
+            *result = self;
+    }
+    
+    self->nque = 0;
+    self->rc = 0;
+    self->eof = false;
+    
+    rc = KLockMake(&self->lock);
+    if (rc == 0) 
+    {
+        rc = KConditionMake(&self->have_data);
+        if (rc == 0) 
+        {
+            rc = KConditionMake(&self->need_data);
+            if (rc == 0) 
+            {
+                rc = KThreadMake(&self->th, BAMReaderThreadMain, self);
+                if (rc == 0) 
+                    return 0;
+                KConditionRelease(self->need_data);
+            }
+            KConditionRelease(self->have_data);
+        }
+        KLockRelease(self->lock);
+    }
+    
+    return rc;
+}           
+
+static void BAMReaderWhack(BAMReader *const self)
+{
+    KThreadCancel(self->th);
+    KThreadWait(self->th, NULL);
+    BAMFileRelease(self->file);
+    KConditionRelease(self->need_data);
+    KConditionRelease(self->have_data);
+    KLockRelease(self->lock);
+    KThreadRelease(self->th);
+}
+        
+
+/* AddRef
+ * Release
+ */
+rc_t BAMReaderAddRef ( const BAMReader *self )
+{
+    if (self != NULL)
+        atomic32_inc(&((BAMReader *)self)->refcount);
+    return 0;
+}
+
+rc_t BAMReaderRelease ( const BAMReader *cself )
+{
+    BAMReader *self = (BAMReader *)cself;
+    
+    if (cself != NULL) 
+    {
+        if (atomic32_dec_and_test(&self->refcount)) 
+        {
+            BAMReaderWhack(self);
+            free(self);
+        }
+    }
+    return 0;
+}
+
+/* GetBAMFile
+ */
+const BAMFile* BAMReaderGetBAMFile ( const BAMReader *self )
+{
+    if (self == NULL)
+        return NULL;
+    return self->file;
+}
+
+static rc_t BAMReaderThreadMain(KThread const *const th, void *const vp)
+{
+    BAMReader *const self = (BAMReader *)vp;
+    rc_t rc = 0;
+    const BAMAlignment* rec;
+    
+    KLockAcquire(self->lock);
+    do 
+    {
+        while (self->nque == BUFFER_COUNT)
+            KConditionWait(self->need_data, self->lock);
+
+        {
+            rc = BAMFileRead( self->file, &rec);
+            if (rc == END_OF_DATA)
+            {
+                rec = NULL;
+                rc = 0;
+            }
+            else if (rc)
+                break;
+
+            self->que[self->nque] = rec;
+            ++self->nque;
+            KConditionSignal(self->have_data);
+        }
+    }
+    while (rec);
+    self->rc = rc;
+    KLockUnlock(self->lock);
+    return 0;
+}
+
+/* Read
+ *  read an aligment
+ *
+ *  "result" [ OUT ] - return param for BAMAlignment object
+ *   must be released with BAMAlignmentRelease
+ *
+ *  returns RC(..., ..., ..., rcRow, rcNotFound) at end
+ */
+rc_t BAMReaderRead ( const BAMReader *cself, const BAMAlignment **result )
+{
+    rc_t rc;
+    BAMReader *self = (BAMReader *)cself;
+    
+    if (self == NULL)
+        return RC(rcAlign, rcFile, rcReading, rcParam, rcNull);
+    if (self->eof)
+        return RC(rcAlign, rcFile, rcReading, rcData, rcInsufficient);
+        
+    KLockAcquire(self->lock);
+    if ((rc = self->rc) == 0) 
+    {
+        while (self->nque == 0 && (rc = self->rc) == 0)
+            KConditionWait(self->have_data, self->lock);
+        if (rc == 0) 
+        {
+            *result = self->que[0];
+            
+            if (*result) 
+            {
+                --self->nque;
+                memmove(&self->que[0], &self->que[1], self->nque * sizeof(self->que[0]));
+                KConditionSignal(self->need_data);
+            }
+            else 
+            {
+                self->eof = true;
+                rc = END_OF_DATA;
+            }
+        }
+    }
+    KLockUnlock(self->lock);
+
+    return rc;
+}
+
+#endif
+
+
diff --git a/tools/bam-loader/bam-reader.h b/tools/bam-loader/bam-reader.h
new file mode 100644
index 0000000..5247563
--- /dev/null
+++ b/tools/bam-loader/bam-reader.h
@@ -0,0 +1,98 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+
+#ifndef _h_bam_reader_
+#define _h_bam_reader_
+
+#include <klib/rc.h>
+#include <kfs/directory.h>
+
+#include <align/extern.h>
+#include <align/bam.h>
+
+#include <loader/common-reader-priv.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+rc_t CC BamReaderFileMake( const ReaderFile **self, char const headerText[], char const path[] );
+
+/* temporary crutches for refactoring: */
+const BAMFile* ToBam(const ReaderFile *self); 
+const BAMAlignment *ToBamAlignment(const Record* record);
+
+#if 0
+#ifdef TENTATIVE
+/*--------------------------------------------------------------------------
+ * BAMReader, a parsing thread adapter for BAMFile.
+ * Creates a thread that does reading and parsing of BAM files, provides access to parsed data one record at a time. 
+ */
+typedef struct BAMReader BAMReader;
+
+rc_t BAMReaderMake( const BAMReader **result,
+                    char const headerText[],
+                    char const path[] );
+
+/* AddRef
+ * Release
+ */
+rc_t BAMReaderAddRef ( const BAMReader *self );
+rc_t AMReaderRelease ( const BAMReader *self );
+
+/* GetBAMFile
+ */
+const BAMFile* BAMReaderGetBAMFile ( const BAMReader *self );
+
+/* Read
+ *  read an aligment
+ *
+ *  "result" [ OUT ] - return param for BAMAlignment object
+ *   must be released with BAMAlignmentRelease
+ *
+ *  returns RC(..., ..., ..., rcRow, rcNotFound) at end
+ */
+rc_t BAMReaderRead ( const BAMReader *self, const BAMAlignment **result );
+
+#else /*TENTATIVE*/
+
+/* use BAMFile directly, as in the earlier version */
+typedef struct BAMFile BAMReader;
+
+#define BAMReaderMake 			BAMFileMakeWithHeader
+#define BAMReaderAddRef 		BAMFileAddRef
+#define BAMReaderRelease 		BAMFileRelease
+#define BAMReaderGetBAMFile(p) 	(p)
+#define BAMReaderRead 			BAMFileRead
+
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _h_bam_reader_ */
diff --git a/tools/bam-loader/loader-imp.c b/tools/bam-loader/loader-imp.c
index 0917b69..2666bf1 100644
--- a/tools/bam-loader/loader-imp.c
+++ b/tools/bam-loader/loader-imp.c
@@ -57,6 +57,7 @@
 #include <insdc/insdc.h>
 #include <insdc/sra.h>
 #include <align/dna-reverse-cmpl.h>
+#include <align/align.h>
 
 #include <kapp/main.h>
 #include <kapp/args.h>
@@ -265,8 +266,8 @@ static rc_t OpenKBTree(KBTree **const rslt, unsigned n, unsigned max)
         return rc;
     
     rc = string_printf(fname, sizeof(fname), NULL, "%s/key2id.%u.%u", G.tmpfs, G.pid, n); if (rc) return rc;
-    rc = KDirectoryCreateFile(dir, &file, true, 0600, kcmInit, fname);
-    KDirectoryRemove(dir, 0, fname);
+    rc = KDirectoryCreateFile(dir, &file, true, 0600, kcmInit, "%s", fname);
+    KDirectoryRemove(dir, 0, "%s", fname);
     KDirectoryRelease(dir);
     if (rc == 0) {
         rc = KBTreeMakeUpdate(rslt, file, cacheSize,
@@ -362,15 +363,49 @@ static unsigned HashKey(void const *key, unsigned keylen)
     return h;
 }
 
-#define USE_ILLUMINA_NAMING_POUND_NUMBER_SLASH_HACK 1
+#define USE_ILLUMINA_NAMING_CORRECTION 1
 
 static size_t GetFixedNameLength(char const name[], size_t const namelen)
 {
-#if USE_ILLUMINA_NAMING_POUND_NUMBER_SLASH_HACK
-    char const *const pound = string_chr(name, namelen, '#');
-    
-    if (pound && pound + 2u < name + namelen && pound[1] >= '0' && pound[1] <= '9' && pound[2] == '/') {
-        return (size_t)(pound - name) + 2u;
+#if USE_ILLUMINA_NAMING_CORRECTION
+/*** Check for possible fixes to illumina names ****/
+    size_t newlen=namelen;
+    /*** First get rid of possible "/1" "/2" "/3" at the end - violates SAM spec **/
+    if(newlen > 2  && name[newlen-2] == '/' &&  (name[newlen-1] == '1' || name[newlen-1] == '2' || name[newlen-1] == '3')){
+	newlen -=2;
+    }
+    if(newlen > 2 && name[newlen-2] == '#' &&  (name[newlen-1] == '0')){ /*** Now, find "#0" ***/
+	newlen -=2;
+    } else if(newlen>10){ /*** find #ACGT ***/
+	int i=newlen;
+	for(i--;i>4;i--){ /*** stopping at 4 since the rest of record should still contain :x:y ***/
+		char a=toupper(name[i]);
+		if(a != 'A' && a != 'C' && a !='G' && a !='T'){
+			break;
+		}
+	}
+	if(name[i]=='#'){
+		switch (newlen-i){ /** allowed values for illumina barcodes :5,6,8 **/
+		 case 5:
+		 case 6:
+		 case 8:
+			newlen=i;
+			break;
+		 default:
+			break;
+		}
+	}
+    }
+    if(newlen < namelen){ /*** check for :x:y at the end now - to make sure it is illumina **/
+	int i=newlen;
+	for(i--;i>0 && isdigit(name[i]);i--){}
+	if(name[i]==':'){
+		for(i--;i>0 && isdigit(name[i]);i--){}
+		if(name[i]==':' && newlen > 0){ /*** some name before :x:y should still exist **/
+			/*** looks like illumina ***/
+			return newlen;
+		}
+	}
     }
 #endif
     return namelen;
@@ -505,8 +540,8 @@ static rc_t OpenMMapFile(context_t *const ctx, KDirectory *const dir)
     if (rc)
         return rc;
     
-    rc = KDirectoryCreateFile(dir, &file, true, 0600, kcmInit, fname);
-    KDirectoryRemove(dir, 0, fname);
+    rc = KDirectoryCreateFile(dir, &file, true, 0600, kcmInit, "%s", fname);
+    KDirectoryRemove(dir, 0, "%s", fname);
     if (rc == 0)
         rc = MMArrayMake(&ctx->id2value, file, sizeof(ctx_value_t));
     KFileRelease(file);
@@ -524,8 +559,8 @@ static rc_t OpenMBankFile(context_t *const ctx, KDirectory *const dir, int which
     if (rc)
         return rc;
     
-    rc = KDirectoryCreateFile(dir, &file, true, 0600, kcmInit, fname);
-    KDirectoryRemove(dir, 0, fname);
+    rc = KDirectoryCreateFile(dir, &file, true, 0600, kcmInit, "%s", fname);
+    KDirectoryRemove(dir, 0, "%s", fname);
     if (rc == 0) {
         KPageFile *backing;
         
@@ -653,7 +688,7 @@ void COPY_READ(INSDC_dna_text D[], INSDC_dna_text const S[], unsigned const L, b
 
 static rc_t OpenBAM(const BAMFile **bam, VDatabase *db, const char bamFile[])
 {
-    rc_t rc = BAMFileMakeWithHeader(bam, G.headerText, bamFile);
+    rc_t rc = BAMFileMakeWithHeader(bam, G.headerText, "%s", bamFile);
     if (rc) {
         (void)PLOGERR(klogErr, (klogErr, rc, "Failed to open '$(file)'", "file=%s", bamFile));
     }
@@ -754,55 +789,6 @@ static void EditUnalignedQualities(uint8_t qual[], bool const hasMismatch[], uns
     }
 }
 
-static void AlignmentRecordInit(AlignmentRecord *self, void *buffer, unsigned readlen, char **endp)
-{
-    memset(self, 0, sizeof(*self));
-
-    self->data.seq_read_id.buffer = &self->read_id;
-    self->data.seq_read_id.elements = 1;
-    self->data.ref_id.buffer = &self->ref_id;
-    self->data.ref_id.elements = 1;
-    if (G.expectUnsorted) {
-        self->data.ref_start.buffer = &self->ref_start;
-        self->data.ref_start.elements = 1;
-    }
-    else {
-        self->data.global_ref_start.buffer = &self->global_ref_start;
-        self->data.global_ref_start.elements = 1;
-    }
-    self->data.ref_orientation.buffer = &self->ref_orientation;
-    self->data.ref_orientation.elements = 1;
-    self->data.mapq.buffer = &self->mapq;
-    self->data.mapq.elements = 1;
-    self->data.tmp_key_id.buffer = &self->tmp_key_id;
-    self->data.tmp_key_id.elements = 1;
-    
-    self->data.read_start.buffer = &self->read_start;
-    self->data.read_start.elements = 1;
-    self->data.read_len.buffer = &self->read_len;
-    self->data.read_len.elements = 1;
-    
-    self->data.mate_ref_orientation.buffer = &self->mate_ref_orientation;
-    self->data.mate_ref_orientation.elements = 1;
-    self->data.mate_ref_id.buffer = &self->mate_ref_id;
-    self->data.mate_ref_id.elements = 1;
-    self->data.mate_ref_pos.buffer = &self->mate_ref_pos;
-    self->data.mate_ref_pos.elements = 1;
-    self->data.mate_align_id.buffer = &self->mate_align_id;
-    self->data.mate_align_id.elements = 1;
-    self->data.template_len.buffer = &self->template_len;
-    self->data.template_len.elements = 1;
-    
-    self->data.ref_offset.buffer = (int32_t *)buffer;
-    self->data.has_mismatch.buffer = (bool *)&AR_OFFSET(*self)[readlen];
-    self->data.has_mismatch.elements = readlen;
-    self->data.has_ref_offset.buffer = &AR_HAS_MISMATCH(*self)[readlen];
-    self->data.has_ref_offset.elements = readlen;
-    self->data.mismatch.buffer = (char *)&AR_HAS_OFFSET(*self)[readlen];
-    
-    *endp = (char *)&AR_MISMATCH(*self)[readlen];
-}
-
 static bool platform_cmp(char const platform[], char const test[])
 {
     unsigned i;
@@ -951,6 +937,7 @@ static rc_t ProcessBAM(char const bamFile[], context_t *ctx, VDatabase *db,
     long     fcountBoth=0;
     long     fcountOne=0;
     int skipRefSeqID = -1;
+    uint64_t recordsRead = 0;
     uint64_t recordsProcessed = 0;
     uint64_t filterFlagConflictRecords=0; /*** counts number of conflicts between flags 0x400 and 0x200 ***/
 #define MAX_WARNINGS_FLAG_CONFLICT 10000 /*** maximum errors to report ***/
@@ -959,6 +946,9 @@ static rc_t ProcessBAM(char const bamFile[], context_t *ctx, VDatabase *db,
     bool isNotColorSpace = G.noColorSpace;
     char alignGroup[32];
     size_t alignGroupLen;
+    AlignmentRecord data;
+    
+    memset(&data, 0, sizeof(data));
     
     rc = OpenBAM(&bam, db, bamFile);
     if (rc) return rc;
@@ -999,7 +989,7 @@ static rc_t ProcessBAM(char const bamFile[], context_t *ctx, VDatabase *db,
     if (rc)
         return rc;
     
-    rc = KDataBufferMake(&buf, (sizeof(int32_t) + sizeof(bool) * 2 + sizeof(char) * 2 + sizeof(uint8_t))*8, 0);
+    rc = KDataBufferMake(&buf, 16, 0);
     if (rc)
         return rc;
     
@@ -1008,7 +998,6 @@ static rc_t ProcessBAM(char const bamFile[], context_t *ctx, VDatabase *db,
     }
     while (rc == 0 && (rc = Quitting()) == 0) {
         bool aligned;
-        AlignmentRecord data;
         uint32_t readlen;
         uint16_t flags;
         int64_t rpos=0;
@@ -1028,12 +1017,19 @@ static rc_t ProcessBAM(char const bamFile[], context_t *ctx, VDatabase *db,
         uint64_t ti = 0;
         uint32_t csSeqLen = 0;
 
-        rc = BAMFileRead(bam, &rec);
+        rc = BAMFileRead2(bam, &rec);
         if (rc) {
             if (GetRCModule(rc) == rcAlign && GetRCObject(rc) == rcRow && GetRCState(rc) == rcNotFound)
                 rc = 0;
+            else if (GetRCModule(rc) == rcAlign && GetRCObject(rc) == rcRow && GetRCState(rc) == rcEmpty) {
+                ++recordsRead;
+                (void)PLOGERR(klogWarn, (klogWarn, rc, "File '$(file)'; record $(recno)", "file=%s,recno=%lu", bamFile, recordsRead));
+                rc = CheckLimitAndLogError();
+                goto LOOP_END;
+            }
             break;
         }
+        ++recordsRead;
         if ((unsigned)(BAMFileGetProportionalPosition(bam) * 100.0) > progress) {
             unsigned new_value = BAMFileGetProportionalPosition(bam) * 100.0;
             KLoadProgressbar_Process(ctx->progress[0], new_value - progress, false);
@@ -1045,7 +1041,7 @@ static rc_t ProcessBAM(char const bamFile[], context_t *ctx, VDatabase *db,
         if (!G.noColorSpace) {
             if (BAMAlignmentHasColorSpace(rec)) {/*BAM*/
                 if (isNotColorSpace) {
-                MIXED_BASE_AND_COLOR:
+MIXED_BASE_AND_COLOR:
                     rc = RC(rcApp, rcFile, rcReading, rcData, rcInconsistent);  
                     (void)PLOGERR(klogErr, (klogErr, rc, "File '$(file)' contains base space and color space", "file=%s", bamFile));
                     goto LOOP_END;
@@ -1066,13 +1062,15 @@ static rc_t ProcessBAM(char const bamFile[], context_t *ctx, VDatabase *db,
                 goto LOOP_END;
             }
             
-            rc = KDataBufferResize(&buf, readlen = 35);
+            rc = AlignmentRecordInit(&data, readlen = 35);
+            if (rc == 0)
+                rc = KDataBufferResize(&buf, readlen);
             if (rc) {
                 (void)LOGERR(klogErr, rc, "Failed to resize record buffer");
                 goto LOOP_END;
             }
             
-            AlignmentRecordInit(&data, buf.base, readlen, &seqDNA);
+            seqDNA = buf.base;
             qual = (uint8_t *)&seqDNA[readlen];
         }
         else {
@@ -1099,13 +1097,16 @@ static rc_t ProcessBAM(char const bamFile[], context_t *ctx, VDatabase *db,
             }
             else if (readlen == 0) {
             }
-            rc = KDataBufferResize(&buf, readlen | csSeqLen);
+            
+            rc = AlignmentRecordInit(&data, readlen | csSeqLen);
+            if (rc == 0)
+                rc = KDataBufferResize(&buf, readlen | csSeqLen);
             if (rc) {
                 (void)LOGERR(klogErr, rc, "Failed to resize record buffer");
                 goto LOOP_END;
             }
             
-            AlignmentRecordInit(&data, buf.base, readlen | csSeqLen, &seqDNA);
+            seqDNA = buf.base;
             qual = (uint8_t *)&seqDNA[readlen | csSeqLen];
         }
         BAMAlignmentGetReadName2(rec, &name, &namelen);/*BAM*/
@@ -1331,8 +1332,14 @@ static rc_t ProcessBAM(char const bamFile[], context_t *ctx, VDatabase *db,
         data.isPrimary = isPrimary;
         if (aligned) {
             uint32_t matches = 0;
-            
-            rc = ReferenceRead(ref, &data, rpos, cigBuf.base, opCount, seqDNA, readlen, &matches);
+            uint8_t rna_orient = ' ';
+
+            BAMAlignmentGetRNAStrand(rec, &rna_orient);
+            rc = ReferenceRead(ref, &data, rpos, cigBuf.base, opCount, seqDNA, readlen,
+                               rna_orient == '+' ? NCBI_align_ro_intron_plus :
+                               rna_orient == '-' ? NCBI_align_ro_intron_minus :
+			       hasCG ? NCBI_align_ro_complete_genomics :
+                               					   NCBI_align_ro_intron_unknown, &matches);
             if (rc) {
                 aligned = false;
                 
@@ -1700,6 +1707,7 @@ static rc_t ProcessBAM(char const bamFile[], context_t *ctx, VDatabase *db,
     KDataBufferWhack(&fragBuf);
     KDataBufferWhack(&srec.storage);
     KDataBufferWhack(&cigBuf);
+    KDataBufferWhack(&data.buffer);
     return rc;
 }
 
@@ -2016,7 +2024,7 @@ rc_t OpenPath(char const path[], KDirectory **dir)
     rc_t rc = KDirectoryNativeDir(&p);
     
     if (rc == 0) {
-        rc = KDirectoryOpenDirUpdate(p, dir, false, path);
+        rc = KDirectoryOpenDirUpdate(p, dir, false, "%s", path);
         KDirectoryRelease(p);
     }
     return rc;
@@ -2068,8 +2076,8 @@ rc_t run(char const progName[],
                     (void)LOGERR (klogErr, rc, "failed to create schema");
                 }
                 else {
-                    (void)(rc = VSchemaAddIncludePath(schema, G.schemaIncludePath));
-                    rc = VSchemaParseFile(schema, G.schemaPath);
+                    (void)(rc = VSchemaAddIncludePath(schema, "%s", G.schemaIncludePath));
+                    rc = VSchemaParseFile(schema, "%s", G.schemaPath);
                     if (rc) {
                         (void)PLOGERR(klogErr, (klogErr, rc, "failed to parse schema file $(file)", "file=%s", G.schemaPath));
                     }
@@ -2077,7 +2085,7 @@ rc_t run(char const progName[],
                         VDatabase *db;
                         
                         rc = VDBManagerCreateDB(mgr, &db, schema, db_type,
-                                                kcmInit + kcmMD5, G.outpath);
+                                                kcmInit + kcmMD5, "%s", G.outpath);
                         rc2 = VSchemaRelease(schema);
                         if (rc2)
                             (void)LOGERR(klogWarn, rc2, "Failed to release schema");
@@ -2103,7 +2111,7 @@ rc_t run(char const progName[],
                                 if (rc == 0) {
                                     KDatabase *kdb;
                                     
-                                    rc = KDBManagerOpenDBUpdate(kmgr, &kdb, G.outpath);
+                                    rc = KDBManagerOpenDBUpdate(kmgr, &kdb, "%s", G.outpath);
                                     if (rc == 0) {
                                         rc = KDatabaseOpenMetadataUpdate(kdb, &meta);
                                         KDatabaseRelease(kdb);
diff --git a/tools/bam-loader/loader-imp3.c b/tools/bam-loader/loader-imp3.c
new file mode 100644
index 0000000..b3387ad
--- /dev/null
+++ b/tools/bam-loader/loader-imp3.c
@@ -0,0 +1,369 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+
+#include <sysalloc.h>
+#include <stdlib.h>
+#include <string.h>
+ 
+#include <klib/rc.h>
+#include <klib/log.h>
+
+#include <kdb/btree.h>
+#include <kdb/meta.h>
+#include <kdb/manager.h>
+#include <kdb/database.h>
+
+#include <kapp/loader-meta.h>
+#include <kapp/main.h>
+
+#include <kfs/directory.h>
+
+#include <vdb/manager.h>
+#include <vdb/schema.h>
+#include <vdb/database.h>
+#include <vdb/vdb-priv.h>
+
+#include <loader/common-writer.h>
+#include <loader/sequence-writer.h>
+#include <loader/reference-writer.h>
+
+#include "bam-reader.h"
+
+static rc_t OpenBAM(const ReaderFile **bam, VDatabase *db, const CommonWriterSettings* G, const char bamFile[])
+{
+    rc_t rc = BamReaderFileMake(bam, G->headerText, bamFile);
+    if (rc) {
+        (void)PLOGERR(klogErr, (klogErr, rc, "Failed to open '$(file)'", "file=%s", bamFile));
+    }
+    else if (db) {
+        KMetadata *dbmeta;
+        
+        rc = VDatabaseOpenMetadataUpdate(db, &dbmeta);
+        if (rc == 0) {
+            KMDataNode *node;
+            
+            rc = KMetadataOpenNodeUpdate(dbmeta, &node, "BAM_HEADER");
+            KMetadataRelease(dbmeta);
+            if (rc == 0) {
+                char const *header;
+                size_t size;
+                
+                rc = BAMFileGetHeaderText(ToBam(*bam), &header, &size);
+                if (rc == 0) {
+                    rc = KMDataNodeWrite(node, header, size);
+                }
+                KMDataNodeRelease(node);
+            }
+        }
+    }
+
+    return rc;
+}
+
+static rc_t VerifyReferences(ReferenceInfo const *bam, const CommonWriterSettings* G, Reference const *ref)
+{
+    rc_t rc = 0;
+    uint32_t n;
+    unsigned i;
+    
+    ReferenceInfoGetRefSeqCount(bam, &n);
+    for (i = 0; i != n; ++i) {
+        ReferenceSequence refSeq;
+        
+        ReferenceInfoGetRefSeq(bam, i, &refSeq);
+        if (G->refFilter && strcmp(refSeq.name, G->refFilter) != 0)
+            continue;
+        
+        rc = ReferenceVerify(ref, refSeq.name, refSeq.length, refSeq.checksum);
+        if (rc) {
+            if (GetRCObject(rc) == rcChecksum && GetRCState(rc) == rcUnequal) {
+#if NCBI
+                (void)PLOGMSG(klogWarn, (klogWarn, "Reference: '$(name)', Length: $(len); checksums do not match", "name=%s,len=%u", refSeq.name, (unsigned)refSeq.length));
+#endif
+            }
+            else
+            if (GetRCObject(rc) == rcSize && GetRCState(rc) == rcUnequal) {
+                (void)PLOGMSG(klogWarn, (klogWarn, "Reference: '$(name)', Length: $(len); lengths do not match", "name=%s,len=%u", refSeq.name, (unsigned)refSeq.length));
+            }
+            else if (GetRCObject(rc) == rcSize && GetRCState(rc) == rcEmpty) {
+                (void)PLOGMSG(klogWarn, (klogWarn, "Reference: '$(name)', Length: $(len); fasta file is empty", "name=%s,len=%u", refSeq.name, (unsigned)refSeq.length));
+            }
+            else if (GetRCObject(rc) == rcId && GetRCState(rc) == rcNotFound) {
+                (void)PLOGMSG(klogWarn, (klogWarn, "Reference: '$(name)', Length: $(len); no match found", "name=%s,len=%u", refSeq.name, (unsigned)refSeq.length));
+            }
+            else {
+                (void)PLOGERR(klogWarn, (klogWarn, rc, "Reference: '$(name)', Length: $(len); error", "name=%s,len=%u", refSeq.name, (unsigned)refSeq.length));
+            }
+        }
+        else if (G->onlyVerifyReferences) {
+            (void)PLOGMSG(klogInfo, (klogInfo, "Reference: '$(name)', Length: $(len); match found", "name=%s,len=%u", refSeq.name, (unsigned)refSeq.length));
+        }
+    }
+    return 0;
+}
+
+rc_t ProcessReferences(const CommonWriterSettings* G, 
+                       VDBManager *mgr, 
+                       VDatabase *db,
+                       unsigned bamFiles, 
+                       char const *bamFile[])
+{
+    Reference ref;
+    rc_t rc = ReferenceInit(&ref, mgr, db, G->expectUnsorted, G->acceptHardClip, G->refXRefPath, G->inpath, G->maxSeqLen, G->refFiles);
+    if (rc)
+        return rc;
+    
+    if (!G->noVerifyReferences) {
+        unsigned i;
+        for (i = 0; i < bamFiles; ++i) {
+            const ReaderFile *bam;
+            const ReferenceInfo* ri;
+            
+            rc = OpenBAM(&bam, db, G, bamFile[i]);
+            if (rc) 
+                break;
+        
+            rc = ReaderFileGetReferenceInfo(bam, &ri);
+            if (rc == 0 && ri != NULL)
+            {
+                rc = VerifyReferences(ri, G, &ref);
+            }
+            ReferenceInfoRelease(ri);
+            
+            ReaderFileRelease(bam); 
+
+            if (rc) 
+                break;
+        }
+    }
+    
+    ReferenceWhack(&ref, false, G->maxSeqLen, Quitting);
+    return rc;
+}
+
+rc_t ArchiveBAM(CommonWriterSettings* G, 
+                VDBManager *mgr, 
+                VDatabase *db,
+                unsigned bamFiles, 
+                char const *bamFile[],
+                unsigned seqFiles, 
+                char const *seqFile[],
+                bool *has_alignments)
+{
+    rc_t rc = 0;
+    unsigned i;
+    CommonWriter cw;
+
+    rc = CommonWriterInit( &cw, mgr, db, G);
+    if (rc != 0)
+        return rc;
+    
+    for (i = 0; i < bamFiles && rc == 0; ++i) {
+        const ReaderFile *reader;
+        rc = OpenBAM(&reader, db, G, bamFile[i]);
+        if (rc == 0) 
+        {
+            rc = CommonWriterArchive( &cw, reader );
+            if (rc != 0) 
+                ReaderFileRelease(reader);
+            else
+                rc = ReaderFileRelease(reader);
+        }
+    }
+    for (i = 0; i < seqFiles && rc == 0; ++i) {
+        const ReaderFile *reader;
+        rc = OpenBAM(&reader, db, G, seqFile[i]);
+        if (rc == 0) 
+        {
+            rc = CommonWriterArchive( &cw, reader );
+            if (rc != 0) 
+                ReaderFileRelease(reader);
+            else
+                rc = ReaderFileRelease(reader);   
+        }
+    }
+    if (rc == 0)
+        rc = CommonWriterComplete( &cw, Quitting() != 0, G->maxMateDistance );
+    else
+        CommonWriterComplete( &cw, true, 0 );
+        
+    *has_alignments = cw.had_alignments;
+    G->errCount = cw.err_count;
+        
+    if (rc == 0)
+        rc = CommonWriterWhack( &cw );
+    else
+        CommonWriterWhack( &cw );
+    
+    if (rc == 0) {
+        (void)LOGMSG(klogInfo, "Successfully loaded all files");
+    }
+    return rc;
+}
+
+rc_t WriteLoaderSignature(KMetadata *meta, char const progName[])
+{
+    KMDataNode *node;
+    rc_t rc = KMetadataOpenNodeUpdate(meta, &node, "/");
+    
+    if (rc == 0) {
+        rc = KLoaderMeta_Write(node, progName, __DATE__, "BAM", KAppVersion());
+        KMDataNodeRelease(node);
+    }
+    if (rc) {
+        (void)LOGERR(klogErr, rc, "Cannot update loader meta");
+    }
+    return rc;
+}
+
+rc_t OpenPath(char const path[], KDirectory **dir)
+{
+    KDirectory *p;
+    rc_t rc = KDirectoryNativeDir(&p);
+    
+    if (rc == 0) {
+        rc = KDirectoryOpenDirUpdate(p, dir, false, "%s", path);
+        KDirectoryRelease(p);
+    }
+    return rc;
+}
+
+static
+rc_t ConvertDatabaseToUnmapped(VDatabase *db)
+{
+    VTable* tbl;
+    rc_t rc = VDatabaseOpenTableUpdate(db, &tbl, "SEQUENCE");
+    if (rc == 0) 
+    {
+        rc = VTableRenameColumn(tbl, false, "CMP_ALTREAD", "ALTREAD");
+        if (rc == 0 || GetRCState(rc) == rcNotFound)
+            rc = VTableRenameColumn(tbl, false, "CMP_READ", "READ");
+/*        if (rc == 0 || GetRCState(rc) == rcNotFound)
+            rc = VTableRenameColumn(tbl, false, "CMP_ALTCSREAD", "ALTCSREAD");
+        if (rc == 0 || GetRCState(rc) == rcNotFound)
+            rc = VTableRenameColumn(tbl, false, "CMP_CSREAD", "CSREAD");*/
+        if (GetRCState(rc) == rcNotFound)
+            rc = 0;
+        rc = VTableRelease(tbl);
+    }
+    return rc;
+}
+
+rc_t run(char const progName[], CommonWriterSettings* G,
+         unsigned bamFiles, char const *bamFile[],
+         unsigned seqFiles, char const *seqFile[])
+{
+    VDBManager *mgr;
+    rc_t rc;
+    rc_t rc2;
+    char const *db_type = G->expectUnsorted ? "NCBI:align:db:alignment_unsorted" : "NCBI:align:db:alignment_sorted";
+    
+    rc = VDBManagerMakeUpdate(&mgr, NULL);
+    if (rc) {
+        (void)LOGERR (klogErr, rc, "failed to create VDB Manager!");
+    }
+    else {
+        bool has_alignments = false;
+        
+        rc = VDBManagerDisablePagemapThread(mgr);
+        if (rc == 0)
+        {
+            if (G->onlyVerifyReferences) {
+                rc = ProcessReferences(G, mgr, NULL, bamFiles, bamFile);
+            }
+            else {
+                VSchema *schema;
+            
+                rc = VDBManagerMakeSchema(mgr, &schema);
+                if (rc) {
+                    (void)LOGERR (klogErr, rc, "failed to create schema");
+                }
+                else {
+                    (void)(rc = VSchemaAddIncludePath(schema, "%s", G->schemaIncludePath));
+                    rc = VSchemaParseFile(schema, "%s", G->schemaPath);
+                    if (rc) {
+                        (void)PLOGERR(klogErr, (klogErr, rc, "failed to parse schema file $(file)", "file=%s", G->schemaPath));
+                    }
+                    else {
+                        VDatabase *db;
+                        
+                        rc = VDBManagerCreateDB(mgr, &db, schema, db_type,
+                                                kcmInit + kcmMD5, "%s", G->outpath);
+                        rc2 = VSchemaRelease(schema);
+                        if (rc2)
+                            (void)LOGERR(klogWarn, rc2, "Failed to release schema");
+                        if (rc == 0)
+                            rc = rc2;
+                        if (rc == 0) {
+                            rc = ProcessReferences(G, mgr, db, bamFiles, bamFile);
+                            if (rc == 0)
+                            {
+                                rc = ArchiveBAM(G, mgr, db, bamFiles, bamFile, seqFiles, seqFile, &has_alignments);
+                            }
+                        }
+                        
+                        if (rc == 0 && !has_alignments) {
+                            rc = ConvertDatabaseToUnmapped(db);
+                        }
+                        
+                        rc2 = VDatabaseRelease(db);
+                        if (rc2)
+                            (void)LOGERR(klogWarn, rc2, "Failed to close database");
+                        if (rc == 0)
+                            rc = rc2;
+                            
+                        if (rc == 0) {
+                            KMetadata *meta;
+                            KDBManager *kmgr;
+                            
+                            rc = VDBManagerOpenKDBManagerUpdate(mgr, &kmgr);
+                            if (rc == 0) {
+                                KDatabase *kdb;
+                                
+                                rc = KDBManagerOpenDBUpdate(kmgr, &kdb, "%s", G->outpath);
+                                if (rc == 0) {
+                                    rc = KDatabaseOpenMetadataUpdate(kdb, &meta);
+                                    KDatabaseRelease(kdb);
+                                }
+                                KDBManagerRelease(kmgr);
+                            }
+                            if (rc == 0) {
+                                rc = WriteLoaderSignature(meta, progName);
+                                KMetadataRelease(meta);
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        rc2 = VDBManagerRelease(mgr);
+        if (rc2)
+            (void)LOGERR(klogWarn, rc2, "Failed to release VDB Manager");
+        if (rc == 0)
+            rc = rc2;
+    }
+    return rc;
+}
diff --git a/tools/bam-loader/loader-imp3.h b/tools/bam-loader/loader-imp3.h
new file mode 100644
index 0000000..9d2926d
--- /dev/null
+++ b/tools/bam-loader/loader-imp3.h
@@ -0,0 +1,38 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#ifndef _loader_imp3_h_
+#define _loader_imp3_h_
+
+struct CommonWriterSettings;
+
+rc_t run(char const argv0[], 
+         struct CommonWriterSettings* G,
+         unsigned countAligned, 
+         char const *bamFile[],
+         unsigned countUnaligned, 
+         char const *unaligned[]);
+
+ #endif
diff --git a/tools/bam-loader/reference-writer.c b/tools/bam-loader/reference-writer.c
index af44f10..b57661f 100644
--- a/tools/bam-loader/reference-writer.c
+++ b/tools/bam-loader/reference-writer.c
@@ -46,13 +46,14 @@
 #include <ctype.h>
 
 #define SORTED_OPEN_TABLE_LIMIT (2)
-#define SORTED_CACHE_SIZE ((2 * 1024 * 1024)/(SORTED_OPEN_TABLE_LIMIT))
+/*#define SORTED_CACHE_SIZE ((2 * 1024 * 1024)/(SORTED_OPEN_TABLE_LIMIT)) TODO: use line below until switch to unsorted is fixed */
+#define SORTED_CACHE_SIZE (350 * 1024 * 1024)
 
 #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
 #define UNSORTED_OPEN_TABLE_LIMIT (8)
 #define UNSORTED_CACHE_SIZE ((1024 * 1024 * 1024)/(UNSORTED_OPEN_TABLE_LIMIT))
 #else
-#define UNSORTED_OPEN_TABLE_LIMIT (64)
+#define UNSORTED_OPEN_TABLE_LIMIT (255)
 #define UNSORTED_CACHE_SIZE (350 * 1024 * 1024)
 #endif
 
@@ -102,10 +103,19 @@ rc_t ReferenceInit(Reference *self, const VDBManager *mgr, VDatabase *db)
 }
 
 static
-void Unsorted(Reference *self) {
+rc_t Unsorted(Reference *self) {
+    if (G.requireSorted) {
+        rc_t const rc = RC(rcApp, rcFile, rcReading, rcConstraint, rcViolated);
+        (void)LOGERR(klogWarn, rc, "Alignments are unsorted");
+        return rc;
+    }
+    /* do not ever change this message */
     (void)LOGMSG(klogWarn, "Alignments are unsorted");
+
     self->out_of_order = true;
+    
     ReferenceMgr_SetCache(self->mgr, UNSORTED_CACHE_SIZE, UNSORTED_OPEN_TABLE_LIMIT);
+    
     KDataBufferWhack(&self->sec_align);
     KDataBufferWhack(&self->pri_align);
     KDataBufferWhack(&self->mismatches);
@@ -113,6 +123,8 @@ void Unsorted(Reference *self) {
     KDataBufferWhack(&self->coverage);
     KDataBufferWhack(&self->pri_overlap);
     KDataBufferWhack(&self->sec_overlap);
+
+    return 0;
 }
 
 #define BAIL_ON_FAIL(STMT) do { rc_t const rc__ = (STMT); if (rc__) return rc__; } while(0)
@@ -173,8 +185,7 @@ static rc_t FlushBuffers(Reference *self, uint64_t upto, bool full, bool final)
                 rc_t rc = ReferenceSeq_AddCoverage(self->rseq, curPos, &data);
                 
                 if (rc) {
-                    Unsorted(self);
-                    return 0;
+                    return Unsorted(self);
                 }
             }
             
@@ -326,58 +337,67 @@ static void GetCounts(AlignmentRecord const *data, unsigned const seqLen,
                       unsigned *const nMiss,
                       unsigned *const nIndels)
 {
-    bool const *has_mismatch = data->data.has_mismatch.buffer;
-    bool const *has_offset = data->data.has_ref_offset.buffer;
-    int32_t const *ref_offset = data->data.ref_offset.buffer;
-    unsigned const n = data->data.ref_offset.elements;
-    unsigned const left_clip = (n != 0 && has_offset[0] && ref_offset[0] < 0) ? -ref_offset[0] : 0;
-    int right_edge;
-    unsigned nmis;
-    unsigned nmatch;
+    bool const *const has_mismatch = data->data.has_mismatch.buffer;
+    bool const *const has_offset = data->data.has_ref_offset.buffer;
+    int32_t const *const ref_offset = data->data.ref_offset.buffer;
+    uint8_t const *const ref_offset_type = data->data.ref_offset_type.buffer;
+    unsigned misses = 0;
+    unsigned matchs = 0;
+    unsigned insert = 0;
+    unsigned delete = 0;
+    unsigned j = 0;
     unsigned i;
-    unsigned j;
     
-    for (right_edge = data->data.ref_len, i = 0; i != n; ++i)
-        right_edge -= ref_offset[i];
-    if (right_edge > seqLen)
-        right_edge = seqLen;
-    for (j = left_clip ? 1 : 0, i = left_clip, nmatch = nmis = 0; i < right_edge; ) {
+    for (i = 0; i < seqLen; ) {
         if (has_offset[i]) {
-            int const offs = ref_offset[j++];
+            int const offs = ref_offset[j];
+            int const type = ref_offset_type[j];
             
+            ++j;
+            if (type == 0) {
+                if (offs < 0)
+                    ++insert;
+                else
+                    ++delete;
+            }
             if (offs < 0) {
                 i += (unsigned)(-offs);
                 continue;
             }
         }
         if (has_mismatch[i])
-            ++nmis;
+            ++misses;
         else
-            ++nmatch;
+            ++matchs;
         ++i;
     }
-    *nMatch = nmatch;
-    *nMiss = nmis;
-    *nIndels = n - (left_clip ? 1 : 0);
+    *nMatch = matchs;
+    *nMiss  = misses;
+    *nIndels = insert + delete;
 }
 
 rc_t ReferenceRead(Reference *self, AlignmentRecord *data, uint64_t const pos,
                    uint32_t const rawCigar[], uint32_t const cigCount,
-                   char const seqDNA[], uint32_t const seqLen, uint32_t *matches)
+                   char const seqDNA[], uint32_t const seqLen,
+                   uint8_t rna_orient, uint32_t *matches)
 {
     *matches = 0;
-    BAIL_ON_FAIL(ReferenceSeq_Compress(self->rseq, (G.acceptHardClip ? ewrefmgr_co_AcceptHardClip : 0) + ewrefmgr_cmp_Binary, pos,
-        seqDNA, seqLen, rawCigar, cigCount, 0, NULL, 0, 0, NULL, 0, &data->data));
+    BAIL_ON_FAIL(ReferenceSeq_Compress(self->rseq,
+                                       (G.acceptHardClip ? ewrefmgr_co_AcceptHardClip : 0) + ewrefmgr_cmp_Binary,
+                                       (INSDC_coord_len)pos,
+                                       seqDNA, seqLen,
+                                       rawCigar, cigCount,
+                                       0, NULL, 0, 0, NULL, 0,
+                                       rna_orient,
+                                       &data->data));
 
     if (!G.acceptNoMatch && data->data.ref_len == 0)
         return RC(rcApp, rcFile, rcReading, rcConstraint, rcViolated);
     
     if (!self->out_of_order && pos < self->lastOffset) {
-        Unsorted(self);
+        return Unsorted(self);
     }
-    if (self->out_of_order)
-        return 0;
-    else {
+    if (!self->out_of_order) {
         unsigned nmis;
         unsigned nmatch;
         unsigned indels;
@@ -393,6 +413,7 @@ rc_t ReferenceRead(Reference *self, AlignmentRecord *data, uint64_t const pos,
         else
             return RC(rcApp, rcFile, rcReading, rcConstraint, rcViolated);
     }
+    return 0;
 }
 
 static rc_t IdVecAppend(KDataBuffer *vec, uint64_t id)
diff --git a/tools/bam-loader/reference-writer.h b/tools/bam-loader/reference-writer.h
index 67d57f4..64e7ade 100644
--- a/tools/bam-loader/reference-writer.h
+++ b/tools/bam-loader/reference-writer.h
@@ -63,7 +63,8 @@ rc_t ReferenceAddAlignId(Reference *self,
                          );
 rc_t ReferenceRead(Reference *self, AlignmentRecord *data, uint64_t pos,
                    uint32_t const rawCigar[], uint32_t cigCount,
-                   char const seqDNA[], uint32_t seqLen, uint32_t *matches);
+                   char const seqDNA[], uint32_t seqLen,
+                   uint8_t rna_orient, uint32_t *matches);
 rc_t ReferenceWhack(Reference *self, bool commit);
 
 #endif
diff --git a/tools/cache-mgr/Makefile b/tools/cache-mgr/Makefile
index ea778c2..44125f0 100644
--- a/tools/cache-mgr/Makefile
+++ b/tools/cache-mgr/Makefile
@@ -25,7 +25,7 @@
 
 default: std
 
-TOP ?= $(shell ../../build/abspath.sh ../..)
+TOP ?= $(abspath ../..)
 MODULE = tools/cache-mgr
 
 include $(TOP)/build/Makefile.env
@@ -91,7 +91,7 @@ TOOL_OBJ = \
 
 TOOL_LIB = \
 	-lkapp \
-	-lncbi-vdb \
+	-sncbi-vdb \
 	-lm
 
 $(BINDIR)/cache-mgr: $(TOOL_OBJ)
diff --git a/tools/cache-mgr/cache-mgr.c b/tools/cache-mgr/cache-mgr.c
index 7c863dd..671280d 100644
--- a/tools/cache-mgr/cache-mgr.c
+++ b/tools/cache-mgr/cache-mgr.c
@@ -160,7 +160,7 @@ rc_t CC Usage ( const Args * args )
         }
 
         if ( rc == 0 )
-            rc = KOutMsg ( "Options:\n" );
+            rc = KOutMsg ( "\n" );
 
         if ( rc == 0 )
         {
@@ -196,15 +196,6 @@ typedef enum tool_main_function
 } tool_main_function;
 
 
-typedef enum repo_select
-{
-    trs_user,
-    trs_site,
-    trs_remote,
-    trs_unknown
-} repo_select;
-
-
 typedef struct tool_options
 {
     uint64_t max_remove;
@@ -214,8 +205,10 @@ typedef struct tool_options
 
     uint32_t path_count;
     tool_main_function main_function;
-    repo_select repo_select;
-    bool detailed, remove_dirs;
+    KRepCategory category;
+
+    bool detailed;
+    bool remove_dirs;
 } tool_options;
 
 
@@ -277,9 +270,9 @@ static bool string_cmp_1( const char * s1, const char * s2 )
 }
 
 
-static repo_select get_repo_select( const Args * args, const char * name )
+static KRepCategory get_repo_select( const Args * args, const char * name )
 {
-    repo_select res = trs_unknown;
+    KRepCategory res = krepBadCategory;
     uint32_t count;
     rc_t rc = ArgsOptionCount( args, name, &count );
     if ( rc != 0 )
@@ -294,11 +287,11 @@ static repo_select get_repo_select( const Args * args, const char * name )
         if ( rc == 0 && s != NULL )
         {
             if ( string_cmp_1 ( s, "user" ) )
-                res = trs_user;
+                res = krepUserCategory;
             else if ( string_cmp_1 ( s, "site" ) )
-                res = trs_site;
+                res = krepSiteCategory;
             else if ( string_cmp_1 ( s, "rem" ) )
-                res = trs_remote;
+                res = krepRemoteCategory;
         }
     }
     return res;
@@ -412,14 +405,14 @@ static rc_t get_tool_options( Args * args, tool_options * options )
         options->main_function = tf_clear;
     else
     {
-        options->repo_select = get_repo_select( args, OPTION_ENABLE );
-        if ( options->repo_select != trs_unknown )
+        options->category = get_repo_select( args, OPTION_ENABLE );
+        if ( options->category != krepBadCategory )
             options->main_function = tf_enable;
 
-        if ( options->repo_select == trs_unknown )
+        if ( options->category == krepBadCategory )
         {
-            options->repo_select = get_repo_select( args, OPTION_DISABLE );
-            if ( options->repo_select != trs_unknown )
+            options->category = get_repo_select( args, OPTION_DISABLE );
+            if ( options->category != krepBadCategory )
                 options->main_function = tf_disable;
         }
     }
@@ -435,6 +428,9 @@ static rc_t get_tool_options( Args * args, tool_options * options )
 typedef struct visit_ctx
 {
     KDirectory * dir;
+    KConfig * cfg;
+    const KRepositoryMgr * repo_mgr;
+
     const tool_options * options;
     const char * path;
     void * data;
@@ -453,7 +449,7 @@ static rc_t foreach_path_obj( visit_ctx * ctx, on_path_t func )
     if ( ctx->path_type == kptDir )
     {
         KNamelist * path_objects;
-        rc = KDirectoryList ( ctx->dir, &path_objects, NULL, NULL, ctx->path );
+        rc = KDirectoryList ( ctx->dir, &path_objects, NULL, NULL, "%s", ctx->path );
         if ( rc != 0 )
         {
             PLOGERR( klogErr, ( klogErr, rc,
@@ -715,31 +711,72 @@ static rc_t perform_report( visit_ctx * octx )
 
 
 /***************************************************************************************************************/
-typedef rc_t ( * CC get_repo_cb )( const KRepositoryMgr *self, KRepositoryVector *repos );
+typedef rc_t ( CC * get_repo_cb )( const KRepositoryMgr *self, KRepositoryVector *repos );
+
+const char MAIN_CAT_USER[] = "user";
+const char MAIN_CAT_SITE[] = "site";
+const char MAIN_CAT_REMOTE[] = "remote";
+
+const char SUB_CAT_UNKNOWN[] = "unknown";
+const char SUB_CAT_MAIN[] = "main";
+const char SUB_CAT_AUX[]  = "aux";
+const char SUB_CAT_PROT[] = "protected";
 
 
-static rc_t report_repo( const tool_options * options, const KRepositoryMgr *repo_mgr, get_repo_cb getter, const char * hint )
+static rc_t report_repo( visit_ctx * octx, KRepCategory category )
 {
-    rc_t rc;
+    rc_t rc, rc1;
     KRepositoryVector repos;
+    const char * hint;
+
     VectorInit ( &repos, 0, 5 );
-    rc = getter ( repo_mgr, &repos );
+
+    switch ( category )
+    {
+        case krepUserCategory   : hint = MAIN_CAT_USER;
+                                   rc = KRepositoryMgrUserRepositories( octx->repo_mgr, &repos );
+                                   break;
+
+        case krepSiteCategory   : hint = MAIN_CAT_SITE;
+                                   rc = KRepositoryMgrSiteRepositories( octx->repo_mgr, &repos );
+                                   break;
+
+        case krepRemoteCategory : hint = MAIN_CAT_REMOTE;
+                                   rc = KRepositoryMgrRemoteRepositories( octx->repo_mgr, &repos );
+                                   break;
+    }
+
     if ( rc != 0 )
     {
-        PLOGERR( klogErr, ( klogErr, rc,
-                 "KRepositoryMgr<$(hint)>repositories() failed in $(func)", "hint=%s,func=%s", hint, __func__ ) );
+        if ( rc == SILENT_RC( rcKFG, rcNode, rcOpening, rcPath, rcNotFound ) )
+        {
+            KOutMsg("\n%s:\n", hint);
+            KOutMsg("\tnot found in configuration\n");
+            rc = 0;
+        }
+        else
+        {
+            PLOGERR( klogErr, ( klogErr, rc,
+                 "KRepositoryMgr<$(hint)>repositories() failed in $(func)",
+                 "hint=%s,func=%s", hint, __func__ ) );
+        }
     }
     else
     {
         uint32_t idx;
-        KOutMsg( "\n%s:\n", hint );
+        bool disabled = KRepositoryMgrCategoryDisabled ( octx->repo_mgr, category );
+
+        rc = KOutMsg( "\n%s:\n", hint );
+        if ( rc == 0 && disabled )
+            rc = KOutMsg( "\tglobally disabled\n" );
+
         for ( idx = 0; idx < VectorLength( &repos ) && rc == 0; ++idx )
         {
             const KRepository *repo = VectorGet( &repos, idx );
             if ( repo != NULL )
             {
                 char repo_name[ 1024 ];
-                rc = KRepositoryName ( repo, repo_name, sizeof repo_name, NULL );
+                rc = KRepositoryDisplayName ( repo, repo_name, sizeof repo_name, NULL );
                 if ( rc != 0 )
                 {
                     PLOGERR( klogErr, ( klogErr, rc,
@@ -747,38 +784,50 @@ static rc_t report_repo( const tool_options * options, const KRepositoryMgr *rep
                 }
                 else
                 {
+                    KRepSubCategory sub_cat = KRepositorySubCategory ( repo );
                     bool disabled = KRepositoryDisabled ( repo );
                     bool cache_enabled = KRepositoryCacheEnabled ( repo );
-                    rc = KOutMsg( "\t%s: %s, cache-%s",
-                            repo_name,
+                    const char * sub_cat_ptr = SUB_CAT_UNKNOWN;
+                    switch( sub_cat )
+                    {
+                        case krepMainSubCategory        : sub_cat_ptr = SUB_CAT_MAIN; break;
+                        case krepAuxSubCategory         : sub_cat_ptr = SUB_CAT_AUX; break;
+                        case krepProtectedSubCategory   : sub_cat_ptr = SUB_CAT_PROT; break;
+                        default                         : sub_cat_ptr = SUB_CAT_UNKNOWN; break;
+                    }
+
+                    rc = KOutMsg( "\t%s.%s: %s, cache-%s",
+                            sub_cat_ptr, repo_name,
                             ( disabled ? "disabled" : "enabled" ),
                             ( cache_enabled ? "enabled" : "disabled" ) );
                     if ( rc == 0 )
                     {
-                        if ( options->detailed )
+                        if ( octx->options->detailed )
                         {
-                            char root[ 4096 ];
-                            rc = KRepositoryRoot ( repo, root, sizeof root, NULL );
-                            if ( rc != 0 )
+                            /* it is OK if we cannot find the root of a repository... */
+                            char where[ 4096 ];
+                            rc1 = KRepositoryRoot ( repo, where, sizeof where, NULL );
+                            if ( rc1 == 0 )
+                                rc = KOutMsg( ", at %s", where );
+                            else
                             {
-                                PLOGERR( klogErr, ( klogErr, rc,
-                                         "KRepositoryRoot( $(hint) ) failed in $(func)", "hint=%s,func=%s", repo_name, __func__ ) );
+                                rc1 = KRepositoryResolver ( repo, where, sizeof where, NULL );
+                                if ( rc1 == 0 )
+                                    rc = KOutMsg( ", at %s", where );
                             }
-                            if ( rc == 0 )
-                                rc = KOutMsg( ", at %s\n", root );
                         }
-                        else
-                            rc = KOutMsg( "\n" );
-                    }
+                                            }
+                    if ( rc == 0 )
+                        rc = KOutMsg( "\n" );
                 }
             }
         }
     }
     {
-        rc_t rc2 = KRepositoryVectorWhack ( &repos );
-        if ( rc2 != 0 )
+        rc1 = KRepositoryVectorWhack ( &repos );
+        if ( rc1 != 0 )
         {
-            PLOGERR( klogErr, ( klogErr, rc2,
+            PLOGERR( klogErr, ( klogErr, rc1,
                      "KRepositoryVectorWhack() for $(hint) failed in $(func)", "hint=%s,func=%s", hint, __func__ ) );
         }
     }
@@ -788,53 +837,17 @@ static rc_t report_repo( const tool_options * options, const KRepositoryMgr *rep
 
 static rc_t perform_rreport( visit_ctx * octx )
 {
-    KConfig * cfg;
-    rc_t rc = KConfigMake ( &cfg, NULL );
-    if ( rc != 0 )
-    {
-        PLOGERR( klogErr, ( klogErr, rc,
-                 "KConfigMake() failed in $(func)", "func=%s", __func__ ) );
-    }
-    else
-    {
-        const KRepositoryMgr *repo_mgr;
-        rc = KConfigMakeRepositoryMgrRead ( cfg, &repo_mgr );
-        if ( rc != 0 )
-        {
-            PLOGERR( klogErr, ( klogErr, rc,
-                     "KConfigMakeRepositoryMgrRead() failed in $(func)", "func=%s", __func__ ) );
-        }
-        else
-        {
-            rc = report_repo( octx->options, repo_mgr, KRepositoryMgrUserRepositories, "user" );
-
-            if ( rc == 0 )
-                rc = report_repo( octx->options, repo_mgr, KRepositoryMgrSiteRepositories, "site" );
+    rc_t rc = report_repo( octx, krepUserCategory );
 
-            if ( rc == 0 )
-                rc = report_repo( octx->options, repo_mgr, KRepositoryMgrRemoteRepositories, "remote" );
+    if ( rc == 0 )
+        rc = report_repo( octx, krepSiteCategory );
 
-            {
-                rc_t rc2 = KRepositoryMgrRelease ( repo_mgr );
-                if ( rc2 != 0 )
-                {
-                    PLOGERR( klogErr, ( klogErr, rc2,
-                             "KRepositoryMgrRelease() failed in $(func)", "func=%s", __func__ ) );
-                }
-            }
+    if ( rc == 0 )
+        rc = report_repo( octx, krepRemoteCategory );
 
-            KOutMsg( "\n\n" );
-        }
+    if ( rc == 0 )
+        rc = KOutMsg( "\n" );
 
-        {
-            rc_t rc2 = KConfigRelease ( cfg );
-            if ( rc2 != 0 )
-            {
-                PLOGERR( klogErr, ( klogErr, rc2,
-                         "KConfigRelease() failed in $(func)", "func=%s", __func__ ) );
-            }
-        }
-    }
     return rc;
 }
 
@@ -983,6 +996,7 @@ static rc_t perform_clear( visit_ctx * octx )
 
 /***************************************************************************************************************/
 
+/*
 static rc_t enable_disable_repo( bool disabled, get_repo_cb getter, const char * hint )
 {
     KConfig * cfg;
@@ -1078,20 +1092,33 @@ static rc_t enable_disable_remote_repo( bool disabled )
 {
     return enable_disable_repo( disabled, KRepositoryMgrRemoteRepositories, "remote" );
 }
-
+*/
 
 /***************************************************************************************************************/
 
 
-static rc_t perform_enable( visit_ctx * octx )
+static rc_t perform_set_disable( visit_ctx * octx, bool disabled )
 {
-    rc_t rc = 0;
-    switch( octx->options->repo_select )
+    rc_t rc;
+    if ( octx->options->category == krepBadCategory )
+        rc = KOutMsg( "enable unknown category\n" );
+    else
     {
-    case trs_user    : rc = enable_disable_user_repo( false ); break;
-    case trs_site    : rc = enable_disable_site_repo( false ); break;
-    case trs_remote  : rc = enable_disable_remote_repo( false ); break;
-    case trs_unknown : rc = KOutMsg( "enable unknown\n" ); break;
+        rc = KRepositoryMgrCategorySetDisabled ( octx->repo_mgr, octx->options->category, disabled );
+        if ( rc != 0 )
+        {
+            PLOGERR( klogErr, ( klogErr, rc,
+                     "KRepositoryMgrCategorySetDisabled() failed in $(func)", "func=%s", __func__ ) );
+        }
+        else
+        {
+            rc = KConfigCommit ( octx->cfg );
+            if ( rc != 0 )
+            {
+                PLOGERR( klogErr, ( klogErr, rc,
+                         "KConfigCommit() failed in $(func)", "func=%s", __func__ ) );
+            }
+        }
     }
     return rc;
 }
@@ -1100,42 +1127,68 @@ static rc_t perform_enable( visit_ctx * octx )
 /***************************************************************************************************************/
 
 
-static rc_t perform_disable( visit_ctx * octx )
+static rc_t perform( tool_options * options, Args * args )
 {
-    rc_t rc = 0;
-    switch( octx->options->repo_select )
+    visit_ctx octx;
+    rc_t rc2, rc = KDirectoryNativeDir( &octx.dir );
+    if ( rc != 0 )
     {
-    case trs_user    : rc = enable_disable_user_repo( true ); break;
-    case trs_site    : rc = enable_disable_site_repo( true ); break;
-    case trs_remote  : rc = enable_disable_remote_repo( true ); break;
-    case trs_unknown : rc = KOutMsg( "disable unknown\n" ); break;
+        PLOGERR( klogErr, ( klogErr, rc,
+                 "KDirectoryNativeDir() failed in $(func)", "func=%s", __func__ ) );
     }
-    return rc;
-}
-
+    else
+    {
+        rc = KConfigMake ( &octx.cfg, NULL );
+        if ( rc != 0 )
+        {
+            PLOGERR( klogErr, ( klogErr, rc,
+                     "KConfigMake() failed in $(func)", "func=%s", __func__ ) );
+        }
+        else
+        {
+            rc = KConfigMakeRepositoryMgrRead ( octx.cfg, &octx.repo_mgr );
+            if ( rc != 0 )
+            {
+                PLOGERR( klogErr, ( klogErr, rc,
+                         "KConfigMakeRepositoryMgrRead() failed in $(func)", "func=%s", __func__ ) );
+            }
+            else
+            {
+                octx.options = options;
+                octx.data = NULL;
+                switch( options->main_function )
+                {
+                    case tf_report  : rc = perform_report( &octx ); break;
+                    case tf_rreport : rc = perform_rreport( &octx ); break;
+                    case tf_unlock  : rc = perform_unlock( &octx ); break;
+                    case tf_clear   : rc = perform_clear( &octx ); break;
+                    case tf_enable  : rc = perform_set_disable( &octx, false ); break;
+                    case tf_disable : rc = perform_set_disable( &octx, true ); break;
+                    case tf_unknown : rc = Usage( args ); break;
+                }
 
-/***************************************************************************************************************/
+                rc2 = KRepositoryMgrRelease ( octx.repo_mgr );
+                if ( rc2 != 0 )
+                {
+                    PLOGERR( klogErr, ( klogErr, rc2,
+                             "KRepositoryMgrRelease() failed in $(func)", "func=%s", __func__ ) );
+                }
+            }
 
+            rc2 = KConfigRelease ( octx.cfg );
+            if ( rc2 != 0 )
+            {
+                PLOGERR( klogErr, ( klogErr, rc2,
+                         "KConfigRelease() failed in $(func)", "func=%s", __func__ ) );
+            }
+        }
 
-static rc_t perform( tool_options * options, Args * args )
-{
-    visit_ctx octx;
-    rc_t rc = KDirectoryNativeDir( &octx.dir );
-    if ( rc == 0 )
-    {
-        octx.options = options;
-        octx.data = NULL;
-        switch( options->main_function )
+        rc2 = KDirectoryRelease( octx.dir );
+        if ( rc2 != 0 )
         {
-            case tf_report  : rc = perform_report( &octx ); break;
-            case tf_rreport : rc = perform_rreport( &octx ); break;
-            case tf_unlock  : rc = perform_unlock( &octx ); break;
-            case tf_clear   : rc = perform_clear( &octx ); break;
-            case tf_enable  : rc = perform_enable( &octx ); break;
-            case tf_disable : rc = perform_disable( &octx ); break;
-            case tf_unknown : rc = Usage( args ); break;
+            PLOGERR( klogErr, ( klogErr, rc2,
+                     "KDirectoryRelease() failed in $(func)", "func=%s", __func__ ) );
         }
-        KDirectoryRelease( octx.dir );
     }
     return rc;
 }
@@ -1258,7 +1311,7 @@ static rc_t explain_no_cache_found ( void )
     if ( rc == 0 )
         rc = KOutMsg( "solution A : specify the cache-path at the commandline like 'cache-mgr ~/my_cache -r'\n" );
     if ( rc == 0 )
-        rc = KOutMsg( "solution B : fix your broken configuration-setup ( run the java-gui )\n" );
+        rc = KOutMsg( "solution B : fix your broken configuration-setup ( use vdb-config )\n" );
     return rc;
 }
 
diff --git a/tools/cache-mgr/cache-mgr.vers b/tools/cache-mgr/cache-mgr.vers
index cc6c9a4..8e8299d 100644
--- a/tools/cache-mgr/cache-mgr.vers
+++ b/tools/cache-mgr/cache-mgr.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/cache-mgr/cache-mgr.vers.h b/tools/cache-mgr/cache-mgr.vers.h
new file mode 100644
index 0000000..04e8d7e
--- /dev/null
+++ b/tools/cache-mgr/cache-mgr.vers.h
@@ -0,0 +1 @@
+#define CACHE_MGR_VERS 0x02040002
diff --git a/tools/ccextract/Makefile b/tools/ccextract/Makefile
new file mode 100644
index 0000000..2872c36
--- /dev/null
+++ b/tools/ccextract/Makefile
@@ -0,0 +1,102 @@
+# ==============================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: std
+
+TOP ?= $(abspath ../..)
+MODULE = tools/ccextract
+
+include $(TOP)/build/Makefile.env
+
+INT_TOOLS =
+
+EXT_TOOLS = 
+
+ifeq (linux,$(OS))
+	EXT_TOOLS += ccextract
+endif
+
+
+ALL_TOOLS = \
+	$(INT_TOOLS) \
+	$(EXT_TOOLS)
+
+#-------------------------------------------------------------------------------
+# outer targets
+#
+all std: vers-includes
+	@ $(MAKE_CMD) $(TARGDIR)/std
+
+$(ALL_TOOLS): vers-includes
+	@ $(MAKE_CMD) $(BINDIR)/$@
+
+.PHONY: all std $(ALL_TOOLS)
+
+#-------------------------------------------------------------------------------
+# std
+#
+$(TARGDIR)/std: \
+	$(addprefix $(BINDIR)/,$(ALL_TOOLS))
+
+.PHONY: $(TARGDIR)/std
+
+#-------------------------------------------------------------------------------
+# vers-includes
+#
+$(TARGDIR)/vers-includes: $(addsuffix .vers.h,$(EXT_TOOLS))
+
+.PHONY: $(TARGDIR)/vers-includes
+
+#-------------------------------------------------------------------------------
+# clean
+#
+clean: stdclean
+
+.PHONY: clean
+
+#-------------------------------------------------------------------------------
+# ccextract
+#  Copy files from one directory to another while cataloging the contents.
+#  XML files can be redirected as well.
+#
+CCEXTRACT_SRC = \
+	ccextract
+
+CCEXTRACT_OBJ = \
+	$(addsuffix .$(OBJX),$(CCEXTRACT_SRC))
+
+CCEXTRACT_LIB = \
+	-lkapp \
+    -lkxfs \
+    -lkxml \
+	-sncbi-vdb \
+
+
+$(BINDIR)/ccextract: $(CCEXTRACT_OBJ)
+	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(CCEXTRACT_LIB)
+
+
+
+
diff --git a/tools/ccextract/ccextract.c b/tools/ccextract/ccextract.c
new file mode 100644
index 0000000..a38386c
--- /dev/null
+++ b/tools/ccextract/ccextract.c
@@ -0,0 +1,1283 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#include <vfs/manager.h>
+#include <vfs/path.h>
+#include <vfs/manager-priv.h>
+#include <vfs/path-priv.h>
+#include <kxml/xml.h>
+#include <kfs/defs.h>
+#include <kfs/directory.h>
+#include <kfs/file.h>
+#include <kfs/nullfile.h>
+#include <kfs/teefile.h>
+#include <klib/defs.h>
+#include <klib/rc.h>
+#include <klib/text.h>
+#include <klib/container.h>
+#include <klib/vector.h>
+#include <klib/out.h>
+#include <klib/log.h>
+#include <klib/debug.h>
+#include <kapp/args.h>
+#include "ccextract.vers.h"
+
+#include <string.h>
+#include <stdlib.h>
+#include <assert.h>
+
+/*
+ * some program globals
+ */
+const char * program_name = "ccextract"; /* default it but try to set it */
+const char * full_path = "ccextract"; /* default it but try to set it */
+
+
+#define OPTION_XML     "copycat-xml"
+#define OPTION_FORCE   "force"
+#define OPTION_DIR     "directory"
+
+#define ALIAS_XML     "x"
+#define ALIAS_FORCE   "f"
+#define ALIAS_DIR     "d"
+
+
+static
+const char * xml_usage[] = 
+{ "XML generated by 'copycat''", NULL };
+static
+const char * force_usage[] = 
+{ "force overwrite of existing files", NULL };
+static
+const char * dir_usage[] = 
+{ "location of output dbase directory", NULL };
+
+
+/* Version  EXTERN
+ *  return 4-part version code: 0xMMmmrrrr, where
+ *      MM = major release
+ *      mm = minor release
+ *    rrrr = bug-fix release
+ */
+uint32_t KAppVersion ( void )
+{
+    return CCEXTRACT_VERS;
+}
+
+
+const char UsageDefaultName [] = "ccextract";
+
+
+rc_t CC UsageSummary (const char * progname)
+{
+    return KOutMsg (
+        "\n"
+        "Usage:\n"
+        "  %s [options] [-d|--directory <directory>] -x|--copycat-xml <XML-file>\\\n"
+        "          source-archive | [path [...]]"
+        "\n"
+        "Summary:\n"
+        "  Copies files and/or directories, creating a catalog of the copied files.\n",
+        progname);
+}
+
+
+
+/*  ----------------------------------------------------------------------
+ */
+static
+const char * first_usage[] = 
+{
+    "The path to a archive file ",
+};
+
+static
+const char * second_usage[] = 
+{
+    "A file by path or ID to extract",
+    "If none are given all files are extracted"
+};
+
+rc_t CC Usage (const Args * args)
+{
+    const char * progname = UsageDefaultName;
+    const char * fullpath = UsageDefaultName;
+    rc_t rc;
+
+    if (args == NULL)
+        rc = RC (rcApp, rcArgv, rcAccessing, rcSelf, rcNull);
+    else
+        rc = ArgsProgram (args, &fullpath, &progname);
+
+    UsageSummary (progname);
+
+    KOutMsg ("Parameters:\n");
+
+    HelpParamLine ("source-file-path", first_usage);
+    HelpParamLine ("extract-path", second_usage);
+
+    KOutMsg ("Options:\n");
+
+    HelpOptionLine (ALIAS_XML, OPTION_XML, "XML-file", xml_usage);
+    HelpOptionLine (ALIAS_DIR, OPTION_DIR, "directoy-path", dir_usage);
+    HelpOptionLine (ALIAS_FORCE, OPTION_FORCE, NULL, force_usage);
+
+    HelpOptionsStandard ();
+/*                     1         2         3         4         5         6         7         8 */
+/*            12345678901234567890123456789012345678901234567890123456789012345678901234567890 */
+    HelpVersion (fullpath, KAppVersion());
+
+    return rc;
+}
+
+
+/*  ----------------------------------------------------------------------
+ */
+static
+OptDef Options[] = 
+{
+    /* name            alias max times oparam required fmtfunc help text loc */
+    { OPTION_XML,   ALIAS_XML,   NULL, xml_usage,   1, true,  true },
+    { OPTION_DIR,   ALIAS_DIR,   NULL, dir_usage,   1, true,  false },
+    { OPTION_FORCE, ALIAS_FORCE, NULL, force_usage, 0, false, false }
+};
+
+
+/*  ----------------------------------------------------------------------
+ */
+static struct
+{
+    const char       * dirstr;
+    VPath            * dirpath;
+    KDirectory       * dir;           /* extraction target directory */
+
+    const char       * xmlstr;
+    VPath            * xmlpath;
+    const KFile      * xml;
+
+    const char       * arcstr;
+
+    /* root directory for XFS is archive as a directory but located below the archive */
+    const char       * rootstr;
+    const KDirectory * root;
+
+    /* base is the directory made from the archive - xtoc/xfs is a bit incoherent here */
+    const char       * basestr;
+    VPath            * basepath;
+    const KDirectory * base;
+
+
+    VFSManager * vfsmgr;
+
+    Vector       pathstr;
+    Vector       pathvpath;
+    BSTree       pathtree;
+
+
+
+
+    KFile *      null;
+
+
+
+
+    bool         force;
+    uint32_t     cm;
+} options;
+
+
+/*  ----------------------------------------------------------------------
+ */
+typedef struct extnode
+{
+    BSTNode       node;
+    const VPath * path;
+    uint64_t      offset;
+} extnode;
+
+
+/*  ----------------------------------------------------------------------
+ */
+static
+rc_t extnode_make (extnode ** new_node, const VPath * path, uint64_t offset)
+{
+    rc_t rc;
+
+    if (new_node == NULL)
+    {
+        rc = RC (rcExe, rcTree, rcConstructing, rcParam, rcNull);
+        LOGERR (klogInt, rc, "missing new_node for making node");
+    }
+    else
+    {
+        *new_node = NULL;
+
+        if (path == NULL)
+        {
+            rc = RC (rcExe, rcTree, rcConstructing, rcParam, rcNull);
+            LOGERR (klogInt, rc, "missing path for making node");
+        }
+        else if (path == NULL)
+        {
+            rc = RC (rcExe, rcTree, rcConstructing, rcParam, rcNull);
+            LOGERR (klogInt, rc, "missing path for making node");
+        }
+        else
+        {
+            extnode * node;
+
+            node = malloc (sizeof *node);
+            if (node == NULL)
+            {
+                rc = RC (rcExe, rcTree, rcConstructing, rcMemory, rcExhausted);
+                LOGERR (klogFatal, rc, "unable to get memory to make a VPath node");
+            }
+            else
+            {
+                rc = VPathAddRef (path);
+                if (rc == 0)
+                {
+                    node->path = path;
+                    node->offset = offset;
+                    *new_node = node;
+                    return 0;
+                }
+                free (node);
+            }
+        }
+    }
+    return rc;
+}
+
+
+/*  ----------------------------------------------------------------------
+ */
+static
+void CC extnode_whack (BSTNode * n, void * data)
+{
+    if (n)
+    {
+        VPathRelease (((extnode*)n)->path);
+        free (n);
+    }
+}
+
+
+/*  ----------------------------------------------------------------------
+ */
+static
+int CC extnode_sort (const BSTNode * item, const BSTNode * n)
+{
+    const extnode * l;
+    const extnode * r;
+    int       ii;
+
+    l = (const extnode *)item;
+    r = (const extnode *)n;
+
+    if (l->offset < r->offset)
+        ii = -1;
+
+    else if (l->offset > r->offset)
+        ii = 1;
+
+    else
+    {
+        size_t lz;
+        size_t rz;
+        char lbuff [8192];
+        char rbuff [8192];
+        rc_t lrc;
+        rc_t rrc;
+
+        lrc = VPathReadPath (l->path, lbuff, sizeof (lbuff), &lz);
+        if (lrc)
+        {
+            LOGERR (klogInt, lrc, "failed to etract item path");
+            lz = 0;
+        }
+
+        rrc = VPathReadPath (r->path, rbuff, sizeof (rbuff), &rz);
+        if (lrc)
+        {
+            LOGERR (klogInt, rrc, "failed to etract node path");
+            rz = 0;
+        }
+
+        ii = string_cmp (lbuff, lz, rbuff, rz, lz + rz);
+    }
+    return ii;
+}
+
+
+/*  ----------------------------------------------------------------------
+ */
+typedef struct rc_data
+{
+    rc_t rc;
+} rc_data;
+
+
+/*  ----------------------------------------------------------------------
+ */
+static
+bool CC extract_one (BSTNode * n, void * data_)
+{
+    extnode * node;
+    rc_data * data = data_;
+    rc_t rc;
+    size_t z;
+    char buff [8193];
+
+    assert (n);
+    assert (data);
+
+    node = (extnode*)n;
+
+    rc = VPathReadPath (node->path, buff, sizeof (buff) - 1, &z);
+    if (rc)
+        LOGERR (klogErr, rc, "error pulling path for an extraction");
+    else
+    {
+        const KFile * sfile;
+
+        buff[z] = '\0';
+
+/*
+ * use base unless we have to revert to root.
+ * base allows more control over options like password where the outside
+ * archive might have a different password than an inner file
+ */
+#if 1 
+        rc = VFSManagerOpenFileReadDirectoryRelative (options.vfsmgr, options.base,
+                                                          &sfile, node->path);
+#else
+        rc = VFSManagerOpenFileReadDirectoryRelative (options.vfsmgr, options.root,
+                                                      &sfile, node->path);
+#endif
+        if (rc)
+            LOGERR (klogErr, rc, "error opening file within the archive");
+        else
+        {
+            KFile * dfile;
+
+/*             KOutMsg ("%s: %s %x\n", __func__, node->path, options.cm); */
+            rc = KDirectoryCreateFile (options.dir, &dfile, false, 0640, options.cm, "%s", buff);
+            if (rc)
+                PLOGERR (klogErr, (klogErr, rc, "failed to create file '$(P)'", "P=%s", buff));
+            else
+            {
+                const KFile * teefile;
+
+                rc = KFileMakeTeeRead (&teefile, sfile, dfile);
+                if (rc)
+                    PLOGERR (klogErr, (klogErr, rc, "failed pipefitting file '$(P)'", "P=%s", buff));
+                else
+                {
+                    KFileAddRef (sfile);
+                    KFileAddRef (dfile);
+                    rc = KFileRelease (teefile);
+                    if (rc)
+                    PLOGERR (klogErr, (klogErr, rc, "failed copying file '$(P)'", "P=%s", buff));
+                }
+            }
+            KFileRelease (sfile);
+        }
+        KFileRelease (sfile);
+    }
+    data->rc = rc;
+    return (rc != 0);
+}
+
+
+/*  ----------------------------------------------------------------------
+ */
+static
+rc_t extract ()
+{
+    rc_data data;
+    bool failed;
+
+    /* done sequentially - this will cause back ups on reads if both
+     * containers and their contents are extracted
+     *
+     * we are also using a DoUntil approach that quits at the first failed
+     * extract
+     */
+    failed = BSTreeDoUntil (&options.pathtree, false, extract_one, &data);
+    
+    if (failed)
+        LOGERR (klogErr, data.rc, "failure extracting a file");
+
+    return data.rc;
+}
+
+
+/*  ----------------------------------------------------------------------
+ */
+#if 0
+static
+int CC sort_pathpath_cmp (const void ** litem, const void ** ritem, void * data)
+{
+    uint64_t lloc, rloc;
+
+    {
+        const VPath * lpath;
+        size_t z;
+        rc_t rc;
+        char pbuff [8192];
+
+        lpath = *litem;
+
+        rc = VPathReadPath (lpath, pbuff, sizeof pbuff, &z);
+        if (rc == 0)
+        {
+            switch (KDirectoryPathType (options.base, "%s", pbuff))
+            {
+            default:
+                lloc = 0;
+                break;
+            case kptFile:
+                rc = KDirectoryFileLocator (options.base, &lloc, "%s", pbuff);
+                break;
+            }
+            if (rc == 0)
+            {
+                const VPath * rpath;
+
+                rpath = *ritem;
+                rc = VPathReadPath (rpath, pbuff, sizeof pbuff, &z);
+                if (rc == 0)
+                {
+                    switch (KDirectoryPathType (options.base, "%s", pbuff))
+                    {
+                    default:
+                        rloc = 0;
+                        break;
+                    case kptFile:
+                        rc = KDirectoryFileLocator (options.base, &rloc, "%s", pbuff);
+                        break;
+                    }
+                }
+            }
+        }
+        if (rc) /* surrender */
+            lloc = rloc = 0;
+    }
+    
+    {
+        int cmp;
+
+        if (lloc < rloc)
+            cmp = -1;
+        else if (lloc > rloc)
+            cmp = 1;
+        else
+        {
+            assert (lloc == rloc);
+            cmp = 0;
+        };
+
+        return cmp;
+    }
+}
+#endif
+
+
+#if 0
+/*  ----------------------------------------------------------------------
+ */
+static
+bool CC build_tree_add (void * _item, void * _data)
+{
+    build_tree_data * data = _data;
+    return false;
+}
+
+
+/*  ----------------------------------------------------------------------
+ */
+static
+rc_t build_tree ()
+{
+    
+    rc_t rc;
+    rc_data data;
+    bool did_until = false;
+
+    BSTreeInit (&options.pathtree);
+
+    VectorDoUntil (options.pathpath, false, build_tree_add, &data);
+}
+#endif
+
+/*  ----------------------------------------------------------------------
+ */
+static
+rc_t insert_path (const VPath * vpath, uint64_t offset)
+{
+    extnode * node;
+    rc_t rc;
+
+    rc = extnode_make (&node, vpath, offset);
+    if (rc == 0)
+    {
+        rc = BSTreeInsert (&options.pathtree, &node->node, extnode_sort);
+        if (rc)
+            LOGERR (klogInt, rc, "error inserting tree node");
+        else
+            return 0;
+
+        extnode_whack (&node->node, NULL);
+    }
+    return rc;
+}
+
+
+/* ----------------------------------------------------------------------
+ */
+static
+rc_t walk_path_file (char * path, size_t z, uint64_t * offset, KPathType kpt)
+{
+    uint64_t this_offset;
+    char * pc;
+    rc_t rc;
+
+    assert (path);
+    assert (offset);
+
+    this_offset = 0;
+    rc = 0;
+    if (kpt == kptFile)
+    {
+        rc = KDirectoryFileLocator (options.base, &this_offset, "%s", path);
+        if (rc)
+            PLOGERR (klogErr,
+                     (klogErr, rc, "failure walking path '$(P)'",
+                      "P=%s", path));
+    }
+    if (rc == 0)
+    {
+        pc = string_rchr (path, z, '/');
+        if (pc)
+        {
+            uint64_t that_offset;
+            KPathType lkpt;
+
+            *pc = '\0';
+            lkpt = KDirectoryPathType (options.base, "%s", path);
+
+            switch (lkpt)
+            {
+            default:
+                rc = RC (rcExe, rcPath, rcAccessing, rcPath, rcInvalid);
+                break;
+            case kptNotFound:
+            case kptZombieFile:
+                rc = RC (rcExe, rcPath, rcAccessing, rcPath, rcNotFound);
+                break;
+
+            case kptBadPath:
+                rc = RC (rcExe, rcPath, rcAccessing, rcPath, rcInvalid);
+                break;
+
+            case kptFile:
+            case kptDir:
+                /* we should always hit here */
+                rc = walk_path_file (path, z, &that_offset, lkpt);
+                if (rc == 0)
+                {
+                    this_offset += that_offset;
+                }
+                break;
+
+            case kptCharDev:
+            case kptBlockDev:
+            case kptFIFO:
+                rc = RC (rcExe, rcPath, rcAccessing, rcPath, rcIncorrect);
+                break;
+            }
+            *pc = '/';
+        }
+    }
+    *offset = this_offset;
+    return rc;
+}
+
+
+/*  ----------------------------------------------------------------------
+ */
+static
+rc_t walk_path_tree (char * path, size_t z)
+{
+    return 0;
+}
+
+
+/*  ----------------------------------------------------------------------
+ * signature is because this is called by VectorDoUntil
+ */
+static
+void CC handle_path (void * item_, void * data_)
+{
+    if ((item_ != NULL) && (data_ != NULL))
+    {
+        VPath * vpath = item_;
+        rc_data * data = data_;
+        size_t z;
+        rc_t rc;
+        char pbuff [8193];
+/*         char tbuff [8193]; */
+
+        if (data->rc)
+            return;
+
+        /* -1 saves room for a guaranteed NUL */
+        rc = VPathReadPath (vpath, pbuff, sizeof (pbuff) - 1, &z);
+        if (rc)
+            LOGERR (klogErr, rc, "failed to pull path out of VPath");
+
+        else if (z)
+        {
+            KPathType kpt;
+
+            /* force a NUL just in case: we saved room for it */
+            pbuff[z] = '\0';
+
+            /* what type of path is this? */
+            kpt = KDirectoryPathType (options.base, "%s", pbuff);
+
+#if 0
+/* ain't doing this now, and may never because of the root versus base problems */
+            /* dereference links until we're done */
+            while (kpt & kptAlias)
+            {
+                rc = KDirectoryResolveAlias (options.base, true,
+                                             tbuff, sizeof tbuff, "%s", pbuff);
+                if (rc)
+                {
+                    PLOGERR (klogErr,
+                             (klogErr, rc, "error resolving path '$(P)'",
+                              "P=%s", pbuff));
+                    break;
+                }
+                else
+                {
+                    memcpy (tbuff, pbuff, sizeof pbuff);
+                    z = string_size (pbuff);
+                    kpt = KDirectoryPathType (options.root, "%s", pbuff);
+                }
+            }
+#endif
+            /* if we didn't crash this path dereferecing it. */
+            if (rc == 0)
+            {
+                if (kpt & kptAlias)
+                    kpt = kptAlias;
+
+                switch (kpt)
+                {
+                default:
+                    rc = RC (rcExe, rcPath, rcAccessing, rcPath, rcInvalid);
+                    PLOGERR (klogErr,
+                             (klogErr, rc, "unknown problem with path '$(P)'",
+                              "P=%s", pbuff));
+                    break;
+                case kptNotFound:
+                    PLOGERR (klogErr,
+                             (klogErr, rc, "path is a not found in archive '$(P)'",
+                              "P=%s", pbuff));
+                    break;
+
+                case kptZombieFile:
+                    rc = RC (rcExe, rcPath, rcAccessing, rcPath, rcNotFound);
+                    PLOGERR (klogErr,
+                             (klogErr, rc, "path is a not in archive but should be '$(P)'",
+                              "P=%s", pbuff));
+                    break;
+
+                case kptBadPath:
+                    rc = RC (rcExe, rcPath, rcAccessing, rcPath, rcInvalid);
+                    PLOGERR (klogErr,
+                             (klogErr, rc, "unusable path form '$(P)'",
+                              "P=%s", pbuff));
+                    break;
+
+                case kptFile:
+                {
+                    uint64_t offset = 0;
+                    rc = walk_path_file (pbuff, z, &offset, kptFile);
+                    if (rc)
+                        PLOGERR (klogErr,
+                                 (klogErr, rc, "couldn't walk path '$(P)'",
+                                  "P=%s", pbuff));
+                    else
+                    {
+                        rc = insert_path (vpath, offset);
+                        if (rc)
+                            PLOGERR (klogErr,
+                                     (klogErr, rc, "couldn't sort path '$(P)'",
+                                      "P=%s", pbuff));
+                    }
+                    break;
+                }
+                case kptDir:
+                    rc = walk_path_tree (pbuff, z);
+                    break;
+
+                case kptCharDev:
+                case kptBlockDev:
+                case kptFIFO:
+                case kptAlias:
+                    rc = RC (rcExe, rcPath, rcAccessing, rcPath, rcIncorrect);
+                    PLOGERR (klogErr,
+                             (klogErr, rc, "unusable path target type '$(P)'",
+                              "P=%s", pbuff));
+                    break;
+                }
+            }
+        }
+        data->rc = rc;
+    }
+}
+
+
+/*  ----------------------------------------------------------------------
+ */
+static
+rc_t build_tree_then_run ()
+{
+    rc_data data;
+
+    data.rc = 0;
+
+    BSTreeInit (&options.pathtree);
+
+    VectorForEach (&options.pathvpath, false, handle_path, &data);
+
+    if (data.rc == 0)
+        data.rc = extract();
+
+    BSTreeWhack (&options.pathtree, extnode_whack, NULL);
+    
+    return data.rc;
+}
+
+/*  ----------------------------------------------------------------------
+ */
+static
+void CC build_vpath_one (void * item, void * data)
+{
+    const char * path;
+    rc_data * prc;
+
+    path = item;
+    prc = data;
+
+    if (prc->rc == 0)
+    {
+        static const char ccid [] = "copycat-id:";
+        const size_t cz = sizeof (ccid) - 1;
+        size_t pz;
+        const char * hier;
+        const char * ppath;
+        VPath * vpath;
+        rc_t rc;
+        char vbuff [8193];
+
+        rc = 0;
+        ppath = path;
+        pz = string_size (path);
+        hier = string_chr (path, pz, ':');
+
+        if ((hier != NULL) &&
+            (0 == string_cmp (path, (hier+1) - path, ccid, cz /*sizeof (ccid) - 1*/, cz)))
+        {
+            static const char nfile[] = "ncbi-file:";
+            char * qmark;
+            size_t s, r/*, q */;
+            char ibuff [8192];
+            char rbuff [8192];
+
+            ++hier;
+            s = hier - path;
+            r = string_copy (ibuff, sizeof (ibuff), hier, pz - s);
+
+            qmark = string_chr (ibuff, r, '?');
+            if (qmark == NULL) /* this is more future with parts */
+                qmark = string_chr (ibuff, r, '#');
+
+            if (qmark != NULL)
+                *qmark = '\0';
+
+            rc = KDirectoryResolveAlias (options.root, true, rbuff, sizeof (rbuff), "%s", ibuff);
+
+            if (rc)
+                PLOGERR (klogErr, (klogErr, rc, "error resolving file id '$(I)", "I=%s", ibuff));
+
+            else 
+            {
+                char * slash;
+                size_t z;
+
+                slash = string_chr (rbuff+1, sizeof (rbuff), '/');
+                if (slash == NULL)
+                    /* we won't extract the root */
+                    return;
+
+                ++slash;
+
+                z = string_size (slash);
+                if (z == 0)
+                    return;
+
+                if (qmark)
+                {
+                    s = string_copy (vbuff, sizeof (vbuff), nfile, sizeof (nfile));
+                    r = string_copy (vbuff + s, sizeof (vbuff) - s, slash, z);
+                    /*q = */string_copy (vbuff + s + r, (sizeof (vbuff) - s) - r, qmark, pz - (qmark - path));
+                }
+                else
+                {
+                    s = string_copy (vbuff, sizeof (vbuff), slash, z);
+                }
+                ppath = vbuff;
+            }
+        }
+
+        if (rc == 0)
+        {
+            rc = VFSManagerMakePath (options.vfsmgr, &vpath, "%s", ppath);
+            if (rc)
+                ;
+            else
+            {
+                rc = VectorAppend (&options.pathvpath, NULL, vpath);
+                if (rc)
+                {
+                    VPathRelease (vpath);
+                }
+            }
+        }
+        
+        prc->rc = rc;
+    }
+}
+
+
+/*  ----------------------------------------------------------------------
+ */
+static
+void CC build_vpath_whack (void * item, void * data)
+{
+    VPath * p;
+
+    p = item;
+
+    VPathRelease ( p );
+}
+
+/*  ----------------------------------------------------------------------
+ * pull paramstring 1-N and comnvert then to internal VPaths
+ */
+static
+rc_t build_vpath_then_run ()
+{
+    rc_data data;
+
+    data.rc = 0;
+
+    VectorInit (&options.pathvpath, 0, VectorLength (&options.pathstr));
+
+    VectorForEach (&options.pathstr, false, build_vpath_one, &data);
+
+    if (data.rc == 0)
+        build_tree_then_run();
+
+    VectorWhack (&options.pathvpath, build_vpath_whack, NULL);
+
+    return data.rc;
+}
+
+
+/*  ----------------------------------------------------------------------
+ * SCHEME:PATH/FILE?QUERY
+ *
+ * form_one is just a file
+ * form_two is just a path and a file (can ignore scheme until more schemes supported)
+ * form_three is all parts except path present which for here acts like form_one
+ * form_four is all four parts
+ *
+ * path is the directory path leading to root
+ * root will be the directory containing the archive
+ * base will be the archive as a directory
+ */
+static
+rc_t open_root_then_run ()
+{
+    static const char dot[] = ".";
+    char         rootstr [8192];
+    char         basestr [8192];
+    const char * colon;
+    rc_t rc;
+
+    colon = strchr (options.arcstr, ':');
+    if (colon == NULL) /* no scheme so it has to be a plain path */
+    {
+        char * last_slash;
+
+        strcpy (basestr, options.arcstr);
+        last_slash = strrchr (basestr, '/');
+
+        if (last_slash == NULL) /* in this directory */
+        {
+            options.rootstr = dot;
+            options.basestr = options.arcstr;
+            /* done */
+        }
+        else
+        {
+            *last_slash = '\0';
+            options.rootstr = basestr;
+            options.basestr = last_slash + 1;
+            /* done */
+        }
+    }
+    else
+    {
+        char * end_of_root;
+        char * last_slash;
+
+        strcpy (rootstr, colon+1);
+
+        end_of_root = strchr (rootstr, '?');
+
+        if (end_of_root == NULL)
+            end_of_root = strchr (rootstr, '#');
+
+        if (end_of_root)
+            *end_of_root = '\0';
+
+        options.rootstr = rootstr;
+
+        last_slash = strchr (rootstr, '/');
+        if (last_slash == NULL)
+        {
+            /* no path */
+            options.rootstr = dot;
+            options.basestr = options.arcstr;
+            /* done */
+        }
+        else
+        {
+            size_t x,z;
+
+            *last_slash = '\0';
+            options.rootstr = rootstr;
+
+            /* scheme */
+            z = string_size (rootstr);
+
+            x = string_copy (basestr, sizeof (basestr), options.arcstr, (colon + 1) - options.arcstr);
+            strcpy (basestr + x, options.arcstr + x + z + 1);
+            options.basestr = basestr;
+            /* done */
+        }
+    }
+    {
+        KDirectory * cwd;
+
+        rc = VFSManagerGetCWD (options.vfsmgr, &cwd);
+        if (rc)
+            ;
+        else
+        {
+            rc = KDirectoryOpenXTocDirRead (cwd, &options.root, true,
+                                            options.xml, "%s", options.rootstr);
+            if (rc)
+                PLOGERR (klogErr, (klogErr, rc,
+                                   "failed to open XFS from '$(P)' using '$(P)'",
+                                   "P=%s", options.basestr, options.xmlstr));
+            else
+            {
+                rc = VFSManagerMakePath (options.vfsmgr, &options.basepath, "%s", options.basestr);
+                if (rc)
+                    PLOGERR (klogErr, (klogErr, rc,
+                                       "failed to make vpath from '$(P)'",
+                                       "P=%s", options.basestr));
+                else
+                {
+                    rc = VFSManagerOpenDirectoryRead (options.vfsmgr,
+                                                      &options.base,
+                                                      options.basepath);
+                    if (rc == 0)
+                    {
+                        rc = build_vpath_then_run ();
+
+                        KDirectoryRelease (options.base);
+                    }
+                    KDirectoryRelease (options.root);
+                }
+                VPathRelease (options.basepath);
+            }
+            KDirectoryRelease (cwd);
+        }
+    }
+    return rc;
+}
+
+
+/*  ----------------------------------------------------------------------
+ */
+static
+rc_t open_xml_then_run()
+{
+    rc_t rc;
+
+    rc = VFSManagerMakePath (options.vfsmgr, &options.xmlpath, "%s", options.xmlstr);
+    if (rc)
+        PLOGERR (klogInt,
+                 (klogInt, rc, "failed to create path for '$(P)'",
+                  "P=%s", options.xmlstr));
+    else
+    {
+        rc = VFSManagerOpenFileRead (options.vfsmgr, &options.xml, options.xmlpath);
+        if (rc)
+            LOGERR (klogErr, rc, "Failed to open output directoryCopycat XML file");
+        else
+        {
+            rc = open_root_then_run ();
+        }
+        VPathRelease (options.xmlpath);
+    }
+    return rc;
+}
+
+
+/*  ----------------------------------------------------------------------
+ */
+static
+rc_t open_dir_then_run()
+{
+    rc_t rc;
+
+    rc = VFSManagerMakePath (options.vfsmgr, &options.dirpath, "%s", options.dirstr);
+    if (rc)
+        PLOGERR (klogInt,
+                 (klogInt, rc, "failed to create path for '$(P)'",
+                  "P=%s", options.dirstr));
+    else
+    {
+        rc = VFSManagerOpenDirectoryUpdate (options.vfsmgr, &options.dir, options.dirpath);
+        if (rc)
+            LOGERR (klogErr, rc, "Failed to open output directory");
+        else
+        {
+            rc = open_xml_then_run();
+            KDirectoryRelease (options.dir);
+        }
+        VPathRelease (options.dirpath);
+    }
+    return rc;
+}
+
+
+/*  ----------------------------------------------------------------------
+ */
+static
+rc_t open_mgr_then_run()
+{
+    rc_t rc;
+
+    rc = VFSManagerMake (&options.vfsmgr);
+    if (rc)
+        LOGERR (klogInt, rc, "failed to create VFS manager");
+    else
+    {
+        rc = open_dir_then_run ();
+    }
+    return rc;
+}
+
+
+/*  ----------------------------------------------------------------------
+ * KMain
+ *
+ * Figure out what is on the command line
+ */
+rc_t KMain ( int argc, char *argv [] )
+{
+    Args * args;
+    rc_t rc;
+
+    rc = ArgsMakeAndHandle (&args, argc, argv, 1, Options, sizeof Options / sizeof (OptDef));
+    if (rc == 0)
+    {
+        /* use do {} while; for easy outs */
+        do
+        {
+            const char * pc;
+            uint32_t pcount;
+
+            rc = ArgsProgram (args, &full_path, &program_name);
+            if (rc)
+            {
+                PLOGERR (klogFatal,
+                         (klogFatal, rc,  "failed to set name to $'(N)'",
+                          "N=%s", program_name));
+                break;
+            }
+
+            rc = ArgsOptionCount (args, OPTION_FORCE, &pcount);
+            if (rc)
+            {
+                LOGERR (klogFatal, rc, "failed to check force option");
+                break;
+            }
+            if (pcount)
+            {
+                options.force = true;
+                options.cm = kcmParents | kcmInit;
+            }
+            else
+            {
+                options.force = true;
+                options.cm = kcmParents | kcmCreate;
+            }
+
+            rc = ArgsOptionCount (args, OPTION_XML, &pcount);
+            if (rc)
+            {
+                LOGERR (klogFatal, rc, "failed to check XML option");
+                break;
+            }
+            if (pcount)
+            {
+                rc = ArgsOptionValue (args, OPTION_XML, 0, &options.xmlstr);
+                if (rc)
+                {
+                    LOGERR (klogFatal, rc, "failed to get XML value");
+                    break;
+                }
+            }
+            else
+            {
+                rc = RC (rcExe, rcArgv, rcParsing, rcParam, rcNull);
+                LOGERR (klogFatal, rc, "missing required copycat-xml option");
+                MiniUsage(args);
+                break;
+            }
+
+            rc = ArgsOptionCount (args, OPTION_DIR, &pcount);
+            if (rc)
+            {
+                LOGERR (klogFatal, rc, "failed to check directory option");
+                break;
+            }
+            if (pcount)
+            {
+                rc = ArgsOptionValue (args, OPTION_DIR, 0, &options.dirstr);
+                if (rc)
+                {
+                    LOGERR (klogFatal, rc, "failed to get directory value");
+                    break;
+                }
+            }
+            else
+            {
+                options.dirstr = ".";
+            }
+
+
+            rc = ArgsParamCount (args, &pcount);
+            if (rc)
+            {
+                LOGERR (klogFatal, rc, "failed to count parameters");
+                break;
+            }
+            if (pcount == 0)
+            {
+                rc = RC ( rcExe, rcArgv, rcReading, rcParam, rcInsufficient );
+                LOGERR (klogFatal, rc, "Missing archive parameter");
+                MiniUsage (args);
+                break;
+            }
+
+            {
+                uint32_t block;
+
+                block = 1;
+                if (pcount > 2)
+                    block = pcount - 1;
+
+                VectorInit (&options.pathstr, 0, block);
+            }
+
+            rc = ArgsParamValue (args, 0, &options.arcstr);
+            if (rc)
+                LOGERR (klogFatal, rc, "failed to retrieve archive parameter");
+            else
+            {
+                if (pcount == 1)
+                {
+                    rc = VectorAppend (&options.pathstr, NULL, ".");
+                    if (rc)
+                        LOGERR (klogFatal, rc, "failed to set default path parameter");
+                }
+                else
+                {
+                    uint32_t ix;
+
+                    for (ix = 1; ix < pcount; ++ix)
+                    {
+                        rc = ArgsParamValue (args, ix, &pc);
+                        if (rc)
+                        {
+                            PLOGERR (klogFatal, 
+                                     (klogFatal, rc, "unable to extract path parameter '$(K)",
+                                      "K=%u", ix));
+                            break;
+                        }
+                        rc = VectorAppend (&options.pathstr, NULL, pc);
+                        if (rc)
+                        {
+                            PLOGERR (klogFatal, 
+                                     (klogFatal, rc, "failed to add path '$(P)' to list",
+                                      "P=%s", pc));
+                            break;
+                        }
+                    }
+                }
+            }
+            if (rc == 0)
+                open_mgr_then_run();
+
+            VectorWhack (&options.pathstr, NULL, NULL);
+
+        } while (0);
+        ArgsWhack (args);
+    }                
+    return rc;
+}
diff --git a/tools/ccextract/ccextract.vers b/tools/ccextract/ccextract.vers
new file mode 100644
index 0000000..8e8299d
--- /dev/null
+++ b/tools/ccextract/ccextract.vers
@@ -0,0 +1 @@
+2.4.2
diff --git a/tools/cg-dump/Makefile b/tools/cg-dump/Makefile
new file mode 100644
index 0000000..6740423
--- /dev/null
+++ b/tools/cg-dump/Makefile
@@ -0,0 +1,117 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: std
+
+TOP ?= $(abspath ../..)
+MODULE = tools/cg-dump
+
+include $(TOP)/build/Makefile.env
+
+INT_TOOLS = \
+
+EXT_TOOLS = \
+	cg-dump
+
+ALL_TOOLS = \
+	$(INT_TOOLS) \
+	$(EXT_TOOLS)
+
+#-------------------------------------------------------------------------------
+# outer targets
+#
+all std: vers-includes
+	@ $(MAKE_CMD) $(TARGDIR)/$@
+
+$(ALL_TOOLS): vers-includes
+	@ $(MAKE_CMD) $(BINDIR)/$@
+
+.PHONY: all std $(ALL_TOOLS)
+
+#-------------------------------------------------------------------------------
+# all
+#
+$(TARGDIR)/all: \
+	$(addprefix $(BINDIR)/,$(ALL_TOOLS))
+
+.PHONY: $(TARGDIR)/all
+
+#-------------------------------------------------------------------------------
+# std
+#
+$(TARGDIR)/std: \
+	$(addprefix $(BINDIR)/,$(EXT_TOOLS))
+
+.PHONY: $(TARGDIR)/std
+
+#-------------------------------------------------------------------------------
+# vers-includes
+#
+$(TARGDIR)/vers-includes: $(addsuffix .vers.h,$(EXT_TOOLS))
+
+.PHONY: $(TARGDIR)/vers-includes
+
+#-------------------------------------------------------------------------------
+# clean
+#
+clean: stdclean
+
+.PHONY: clean
+
+#-------------------------------------------------------------------------------
+# cg-dump
+#
+CG_DUMP_SRC = \
+	num-gen \
+	progressbar \
+	line_token_iter \
+	last_rowid \
+	sg_lookup \
+	cg-dump
+
+CG_DUMP_OBJ = \
+	$(addsuffix .$(OBJX),$(CG_DUMP_SRC))
+
+CG_DUMP_LIB = \
+	-lkapp \
+	-lload \
+	-lkq \
+	-ssraschema \
+	-dalign-reader \
+	$(READONLY_SCHEMA_LIBS) \
+	-lvdb \
+	-lkdb \
+	-lvfs \
+	-lkrypto \
+	-lkfg \
+	-lkfs \
+	-lksrch \
+	-lkproc \
+	-lklib \
+	-lm
+
+$(BINDIR)/cg-dump: $(CG_DUMP_OBJ)
+	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(CG_DUMP_LIB)
+
diff --git a/tools/cg-dump/cg-dump.c b/tools/cg-dump/cg-dump.c
new file mode 100644
index 0000000..ede1b40
--- /dev/null
+++ b/tools/cg-dump/cg-dump.c
@@ -0,0 +1,1563 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "cg-dump.vers.h"
+
+#include <vdb/manager.h>
+#include <vdb/schema.h>
+#include <vdb/table.h>
+#include <vdb/cursor.h>
+#include <vdb/database.h>
+
+#include <kdb/manager.h>    /* because of path-types */
+#include <kdb/meta.h>       /* because of exploring meta-data */
+
+#include <kfs/bzip.h>
+#include <kfs/gzip.h>
+#include <kfs/buffile.h>
+#include <kfs/file.h>
+#include <kfs/directory.h>
+
+#include <kapp/main.h>
+#include <kapp/args.h>
+#include <kapp/queue-file.h>
+
+#include <klib/log.h>
+#include <klib/out.h>
+#include <klib/status.h>
+#include <klib/text.h>
+#include <klib/time.h>
+#include <klib/printf.h>
+#include <klib/container.h>
+#include <klib/rc.h>
+
+#include "num-gen.h"
+#include "progressbar.h"
+#include "sg_lookup.h"
+#include "last_rowid.h"
+
+#include <os-native.h>
+#include <sysalloc.h>
+#include <strtol.h>     /* strtou64 */
+#include <string.h>     /* memset */
+
+#define CURSOR_CACHE_SIZE 256*1024*1024
+#define DEFAULT_CUTOFF 30000000
+
+const char UsageDefaultName[] = "cg-dump";
+
+static const char * rows_usage[]     = { "rows to dump (if ommited: all rows)", NULL };
+static const char * cutoff_usage[]   = { "how many spots max. per output-file", NULL };
+static const char * force_usage[]    = { "force to overwrite output directory if it already exists", NULL };
+static const char * cache_usage[]    = { "size of cursor-cache", NULL };
+static const char * comp_usage[]     = { "output-compression, 'none', 'gzip', 'bzip'(dflt) or 'null'", NULL };
+static const char * prog_usage[]     = { "show progressbar", NULL };
+static const char * lib_usage[]      = { "LIBRARY-value for output-file-header", NULL };
+static const char * sample_usage[]   = { "SAMPLE-value for output-file-header", NULL };
+static const char * prefix_usage[]   = { "name-prefix for output-files", NULL };
+static const char * wbuf_usage[]     = { "use write-buffering of this size", NULL };
+static const char * queue_usage[]    = { "use background threads for writing", NULL };
+static const char * qbytes_usage[]   = { "background producer limit", NULL };
+static const char * qblock_usage[]   = { "background blocksize", NULL };
+static const char * qtimeout_usage[] = { "timeout for background writers", NULL };
+static const char * lrowid_usage[]   = { "find the highest row-id in the out-dir", NULL };
+
+#define OPTION_ROWS "rows"
+#define OPTION_CUTOFF "cutoff"
+#define OPTION_FORCE "force"
+#define OPTION_CACHE "cache"
+#define OPTION_COMP "compress"
+#define OPTION_PROG "progress"
+#define OPTION_LIB "lib"
+#define OPTION_SAMPLE "sample"
+#define OPTION_PREFIX "prefix"
+#define OPTION_WBUF "writebuff"
+#define OPTION_QUEUE "queued"
+#define OPTION_QUEUE_BYTES "queue-bytes"
+#define OPTION_QUEUE_BLOCK "queue-block"
+#define OPTION_QUEUE_TIMEOUT "queue-timeout"
+#define OPTION_LAST_ROWID "last-rowid"
+
+#define ALIAS_ROWS "R"
+#define ALIAS_CUTOFF "C"
+#define ALIAS_FORCE "f"
+#define ALIAS_CACHE "a"
+#define ALIAS_COMP "s"
+#define ALIAS_PROG "p"
+#define ALIAS_WBUF "w"
+#define ALIAS_QUEUE "q"
+
+OptDef DumpOptions[] =
+{
+    { OPTION_ROWS,      ALIAS_ROWS,     NULL, rows_usage,   1,  true,   false },
+    { OPTION_CUTOFF,    ALIAS_CUTOFF,   NULL, cutoff_usage, 1,  true,   false },
+    { OPTION_FORCE,     ALIAS_FORCE,    NULL, force_usage,  1,  false,  false },
+    { OPTION_CACHE,     ALIAS_CACHE,    NULL, cache_usage,  1,  true,   false },
+    { OPTION_COMP,      ALIAS_COMP,     NULL, comp_usage,   1,  true,   false },
+    { OPTION_PROG,      ALIAS_PROG,     NULL, prog_usage,   1,  false,  false },
+    { OPTION_LIB,       NULL,           NULL, lib_usage,    1,  true,   false },
+    { OPTION_SAMPLE,    NULL,           NULL, sample_usage, 1,  true,   false },
+    { OPTION_PREFIX,    NULL,           NULL, prefix_usage, 1,  true,   false },
+    { OPTION_WBUF,      ALIAS_WBUF,     NULL, wbuf_usage,   1,  true,   false },
+    { OPTION_QUEUE,     ALIAS_QUEUE,    NULL, queue_usage,  1,  false,  false },
+    { OPTION_QUEUE_BYTES, NULL,         NULL, qbytes_usage, 1,  true,   false },
+    { OPTION_QUEUE_BLOCK, NULL,         NULL, qblock_usage, 1,  true,   false },
+    { OPTION_QUEUE_TIMEOUT, NULL,       NULL, qtimeout_usage, 1,  true,   false },
+    { OPTION_LAST_ROWID,    NULL,       NULL, lrowid_usage, 1,  false,  false }
+};
+
+
+rc_t CC UsageSummary ( const char * progname )
+{
+    return KOutMsg ( "\nUsage:\n  %s <input-path or accession> <output-path> [options]\n\n",
+                     progname );
+}
+
+rc_t CC Usage ( const Args * args )
+{
+    const char * progname = UsageDefaultName;
+    const char * fullpath = UsageDefaultName;
+    uint32_t n, i;
+    rc_t rc;
+
+    if ( args == NULL )
+        rc = RC ( rcApp, rcArgv, rcAccessing, rcSelf, rcNull );
+    else
+        rc = ArgsProgram ( args, &fullpath, &progname );
+
+    if ( rc )
+        progname = fullpath = UsageDefaultName;
+
+    UsageSummary ( progname );
+
+    KOutMsg ( "Options:\n" );
+
+    n = ( sizeof( DumpOptions ) / sizeof( DumpOptions[ 0 ] ) );
+    for( i = 0; i < n; i++ )
+    {
+        if ( DumpOptions[ i ].help != NULL )
+        {
+            HelpOptionLine( DumpOptions[ i ].aliases, DumpOptions[ i ].name,
+                            NULL, DumpOptions[ i ].help );
+        }
+    }
+    KOutMsg( "\n" );
+
+    HelpOptionsStandard ();
+
+    HelpVersion ( fullpath, KAppVersion() );
+
+    return rc;
+}
+
+
+/* Version  EXTERN
+ *  return 4-part version code: 0xMMmmrrrr, where
+ *      MM = major release
+ *      mm = minor release
+ *    rrrr = bug-fix release
+ */
+ver_t CC KAppVersion ( void )
+{
+    return CG_DUMP_VERS;
+}
+
+
+enum output_compression
+{
+    oc_none = 0,    /* do not compress output */
+    oc_gzip,        /* compress output with gzip */
+    oc_bzip,        /* compress output with bzip2 */
+    oc_null         /* do not create output at all */
+};
+
+
+typedef struct cg_dump_opts
+{
+    uint64_t cutoff;        /* how many bytes of output before new sub-file starts */
+    uint64_t cursor_cache;  /* size of cursor-cache */
+    uint32_t first_chunk;   /* starting number of chunks */
+    size_t wbuff_size;      /* write-buffer size */
+    size_t qbytes;          /* producer limit for background threads */
+    size_t qblock;          /* block-size for background threads */
+    uint32_t qtimeout;      /* timeout for background writers */
+
+    bool overwrite;         /* if output dir exists, overwrite? */
+    bool show_progress;     /* show progressbar */
+    bool use_queue;         /* use queued writer */
+    bool get_last_rowid;    /* discover the last row-id written */
+
+    enum output_compression comp;   /* what type of output compression? */
+
+    const char * lib;       /* LIBRARY - value for output-file-header */
+    const char * sample;    /* SAMPLE - value for output-file-header */
+    const char * prefix;    /* eventual prefix for output-filename */
+} cg_dump_opts;
+
+
+typedef struct lane
+{
+    BSTNode node;
+
+    const String * name;
+    KFile * reads;
+/*    KFile * mappings; */
+    uint64_t write_pos;
+    uint64_t spot_count;
+    uint32_t chunk;
+} lane;
+
+
+typedef struct cg_dump_ctx
+{
+    num_gen * rows;
+    KDirectory * dir;
+    KDirectory * out_dir;
+    const VCursor * seq_cur;
+/*    const VCursor * prim_cur; */
+    BSTree lanes;
+    struct sg_lookup * lookup;
+
+    progressbar * progress;
+    uint8_t fract_digits;
+
+    uint32_t seq_read_idx;
+    uint32_t seq_qual_idx;
+    uint32_t seq_sg_idx;
+/*    uint32_t seq_read_len_idx;
+    uint32_t seq_prim_id_idx;
+
+    uint32_t prim_cigar_idx;
+    uint32_t prim_refname_idx;
+    uint32_t prim_refpos_idx; */
+
+    const char * dst;
+} cg_dump_ctx;
+
+
+const char * s_Database      = "Database";
+const char * s_Table         = "Table";
+const char * s_PrereleaseTbl = "Prerelease Table";
+const char * s_Column        = "Column";
+const char * s_Index         = "Index";
+const char * s_NotFound      = "not found";
+const char * s_BadPath       = "bad path";
+const char * s_File          = "File";
+const char * s_Dir           = "Dir";
+const char * s_CharDev       = "CharDev";
+const char * s_BlockDev      = "BlockDev";
+const char * s_FIFO          = "FIFO";
+const char * s_ZombieFile    = "ZombieFile";
+const char * s_Dataset       = "Dataset";
+const char * s_Datatype      = "Datatype";
+const char * s_Unknown       = "Unknown";
+
+
+const char * pathtype_2_pchar( int path_type )
+{
+    const char * res = s_Unknown;
+    switch ( path_type )
+    {
+    case kptDatabase      : res = s_Database; break;
+    case kptTable         : res = s_Table; break;
+    case kptPrereleaseTbl : res = s_PrereleaseTbl; break;
+    case kptColumn        : res = s_Column; break;
+    case kptIndex         : res = s_Index; break;
+    case kptNotFound      : res = s_NotFound; break;
+    case kptBadPath       : res = s_BadPath; break;
+    case kptFile          : res = s_File; break;
+    case kptDir           : res = s_Dir; break;
+    case kptCharDev       : res = s_CharDev; break;
+    case kptBlockDev      : res = s_BlockDev; break;
+    case kptFIFO          : res = s_FIFO; break;
+    case kptZombieFile    : res = s_ZombieFile; break;
+    case kptDataset       : res = s_Dataset; break;
+    case kptDatatype      : res = s_Datatype; break;
+    }
+    return res;
+}
+
+static int CC String_lane_cmp ( const void * item, const BSTNode * n )
+{
+    const String * spot_group = ( const String * ) item;
+    const lane * sg_lane = ( const lane * ) n;
+    return StringCompare ( sg_lane->name, spot_group );
+}
+
+
+static int CC lane_lane_cmp ( const BSTNode * item, const BSTNode * n )
+{
+    const lane * lane1 = ( const lane * ) item;
+    const lane * lane2 = ( const lane * ) n;
+    return StringCompare ( lane2->name, lane1->name );
+}
+
+
+const char * bzip_ext = ".bz2";
+const char * gzip_ext = ".gz";
+const char * none_ext = "";
+
+
+static rc_t write_header_line( lane * l, const char * line, size_t len )
+{
+    size_t num_writ_file;
+    rc_t rc = KFileWrite ( l->reads, l->write_pos, line, len, &num_writ_file );
+    if ( rc != 0 )
+    {
+        (void)LOGERR( klogErr, rc, "cannot write output for header" );
+    }
+    else
+    {
+        l->write_pos += num_writ_file;
+    }
+    return rc;
+}
+
+
+static rc_t write_header( cg_dump_opts * opts, struct sg_lookup * lookup, lane * l )
+{
+    char buffer[ 1024 ];
+    size_t num_writ_buf;
+    sg * entry = NULL;
+
+    rc_t rc = string_printf ( buffer, sizeof buffer, &num_writ_buf, "#GENERATED_BY\t%s\n", UsageDefaultName );
+    if ( rc != 0 )
+    {
+        (void)LOGERR( klogErr, rc, "cannot generate GENERATED_BY for header" );
+    }
+    else
+        rc = write_header_line( l, buffer, num_writ_buf );
+
+    if ( rc == 0 )
+    {
+        KTime now;
+        KTimeLocal ( &now, KTimeStamp () );
+        rc = string_printf ( buffer, sizeof buffer, &num_writ_buf, "#GENERATED_AT\t%lT\n", &now );
+        if ( rc != 0 )
+        {
+            (void)LOGERR( klogErr, rc, "cannot generate GENERATED_AT for header" );
+        }
+        else
+            rc = write_header_line( l, buffer, num_writ_buf );
+    }
+
+    if ( rc == 0 )
+    {
+        rc = string_printf ( buffer, sizeof buffer, &num_writ_buf, "#SOFTWARE_VERSION\t%.3V\n", KAppVersion() );
+        if ( rc != 0 )
+        {
+            (void)LOGERR( klogErr, rc, "cannot generate SOFTWARE_VERSION for header" );
+        }
+        else
+            rc = write_header_line( l, buffer, num_writ_buf );
+    }
+
+    if ( rc == 0 )
+    {
+        rc = string_printf ( buffer, sizeof buffer, &num_writ_buf, "#FORMAT_VERSION\t2.0\n" );
+        if ( rc != 0 )
+        {
+            (void)LOGERR( klogErr, rc, "cannot generate FORMAT_VERSION for header" );
+        }
+        else
+            rc = write_header_line( l, buffer, num_writ_buf );
+    }
+
+    if ( rc == 0 )
+    {
+        rc = string_printf ( buffer, sizeof buffer, &num_writ_buf, "#TYPE\tSAM_READS\n" );
+        if ( rc != 0 )
+        {
+            (void)LOGERR( klogErr, rc, "cannot generate SAM_READS for header" );
+        }
+        else
+            rc = write_header_line( l, buffer, num_writ_buf );
+    }
+
+    if ( rc == 0 )
+    {
+        rc = string_printf ( buffer, sizeof buffer, &num_writ_buf, "#SLIDE\t%.*s\n", ( l->name->len - 4 ), l->name->addr );
+        if ( rc != 0 )
+        {
+            (void)LOGERR( klogErr, rc, "cannot generate SLIDE for header" );
+        }
+        else
+            rc = write_header_line( l, buffer, num_writ_buf );
+    }
+
+    if ( rc == 0 )
+    {
+        rc = string_printf ( buffer, sizeof buffer, &num_writ_buf, "#LANE\t%.*s\n", 3, l->name->addr + ( ( l->name->len - 3 ) ) );
+        if ( rc != 0 )
+        {
+            (void)LOGERR( klogErr, rc, "cannot generate LANE for header" );
+        }
+        else
+            rc = write_header_line( l, buffer, num_writ_buf );
+    }
+
+    if ( rc == 0 )
+    {
+        rc = string_printf ( buffer, sizeof buffer, &num_writ_buf, "#BATCH_FILE_NUMBER\t%d\n", l->chunk );
+        if ( rc != 0 )
+        {
+            (void)LOGERR( klogErr, rc, "cannot generate BATCH_FILE_NUMBER for header" );
+        }
+        else
+            rc = write_header_line( l, buffer, num_writ_buf );
+    }
+
+    if ( rc == 0 )
+    {
+        rc = string_printf ( buffer, sizeof buffer, &num_writ_buf, "#LANE\t%S\n", l->name );
+        if ( rc != 0 )
+        {
+            (void)LOGERR( klogErr, rc, "cannot generate LANE(2) for header" );
+        }
+        else
+            rc = write_header_line( l, buffer, num_writ_buf );
+    }
+
+    if ( rc == 0 )
+    {
+        perform_sg_lookup( lookup, l->name, &entry );
+        if ( entry != NULL )
+            rc = string_printf ( buffer, sizeof buffer, &num_writ_buf, "#LIBRARY\t%S\n", &entry->lib );
+        else
+            rc = string_printf ( buffer, sizeof buffer, &num_writ_buf, "#LIBRARY\t%s\n", opts->lib );   /* opts->lib */
+        if ( rc != 0 )
+        {
+            (void)LOGERR( klogErr, rc, "cannot generate LIBRARY for header" );
+        }
+        else
+            rc = write_header_line( l, buffer, num_writ_buf );
+    }
+
+    if ( rc == 0 )
+    {
+        if ( entry != NULL )
+            rc = string_printf ( buffer, sizeof buffer, &num_writ_buf, "#SAMPLE\t%S\n", &entry->sample );
+        else
+            rc = string_printf ( buffer, sizeof buffer, &num_writ_buf, "#SAMPLE\t%s\n", opts->sample );   /* opts->sample */
+        if ( rc != 0 )
+        {
+            (void)LOGERR( klogErr, rc, "cannot generate SAMPLE for header" );
+        }
+        else
+            rc = write_header_line( l, buffer, num_writ_buf );
+    }
+
+    if ( rc == 0 )
+    {
+        if ( entry != NULL )
+            rc = string_printf ( buffer, sizeof buffer, &num_writ_buf, "#FIELD_SIZE\t%S\n", &entry->field_size );
+        else
+            rc = string_printf ( buffer, sizeof buffer, &num_writ_buf, "#FIELD_SIZE\t460800\n" );
+        if ( rc != 0 )
+        {
+            (void)LOGERR( klogErr, rc, "cannot generate FIELD_SIZE for header" );
+        }
+        else
+            rc = write_header_line( l, buffer, num_writ_buf );
+    }
+
+    if ( rc == 0 )
+    {
+        rc = string_printf ( buffer, sizeof buffer, &num_writ_buf, "\n>readOffset\tside\tbases\tscores\n" );
+        if ( rc != 0 )
+        {
+            (void)LOGERR( klogErr, rc, "cannot generate columns for header" );
+        }
+        else
+            rc = write_header_line( l, buffer, num_writ_buf );
+    }
+    return rc;
+}
+
+
+static rc_t make_read_file( cg_dump_opts * opts, struct sg_lookup * lookup, KDirectory * dir, lane * l )
+{
+    rc_t rc;
+    if ( opts->comp == oc_null )
+    {
+        l->reads = NULL;
+        rc = 0;
+    }
+    else
+    {
+        const char * ext;
+        switch( opts->comp )
+        {
+            case oc_none : ext = none_ext; break;
+            case oc_gzip : ext = gzip_ext; break;
+            case oc_bzip : ext = bzip_ext; break;
+            case oc_null : ext = none_ext; break;
+        }
+        rc = KDirectoryCreateFile ( dir, &l->reads, true, 0664, kcmCreate, 
+                                    "%s%.*s_%03d.tsv%s", opts->prefix, l->name->len, l->name->addr, l->chunk, ext );
+        if ( rc != 0 )
+        {
+            (void)PLOGERR( klogErr, ( klogErr, rc, "cannot create reads-file for lane '$(lane)' / chunk '$(chunk)'",
+                                      "lane=%S,chunk=%d", l->name, l->chunk ) );
+        }
+        else if ( opts->wbuff_size > 0 )
+        {
+            KFile * buffered;
+            rc = KBufWriteFileMakeWrite ( &buffered, l->reads, opts->wbuff_size );
+            if ( rc != 0 )
+            {
+                (void)PLOGERR( klogErr, ( klogErr, rc, "cannot create buffered reads-file for lane '$(lane)' / chunk '$(chunk)'",
+                                          "lane=%S,chunk=%d", l->name, l->chunk ) );
+            }
+            else
+            {
+                KFileRelease( l->reads );
+                l->reads = buffered;
+            }
+        }
+
+        if ( rc == 0 && opts->comp != oc_none )
+        {
+
+            KFile * compressed = l->reads;
+            if ( opts->comp == oc_bzip )
+            {
+                rc = KFileMakeBzip2ForWrite ( &compressed, l->reads );
+            }
+            else if ( opts->comp == oc_gzip )
+            {
+                rc = KFileMakeGzipForWrite ( &compressed, l->reads );
+            }
+            if ( rc != 0 )
+            {
+                (void)PLOGERR( klogErr, ( klogErr, rc, "cannot create bzip reads-file for lane '$(lane)' / chunk '$(chunk)'",
+                                          "lane=%S,chunk=%d", l->name, l->chunk ) );
+            }
+            else
+            {
+                KFileRelease( l->reads );
+                l->reads = compressed;
+            }
+        }
+
+        if ( rc == 0 && opts->use_queue )
+        {
+            KFile * qf;
+            rc  = KQueueFileMakeWrite ( &qf, l->reads, opts->qbytes, opts->qblock, opts->qtimeout );
+            if ( rc != 0 )
+            {
+                (void)PLOGERR( klogErr, ( klogErr, rc, "cannot create background writer for lane '$(lane)' / chunk '$(chunk)'",
+                                          "lane=%S,chunk=%d", l->name, l->chunk ) );
+            }
+            else
+            {
+                KFileRelease( l->reads );
+                l->reads = qf;
+            }
+        }
+
+    }
+
+    if ( rc == 0 )
+    {
+        rc = write_header( opts, lookup, l );
+    }
+
+    return rc;
+}
+
+
+/*
+static rc_t make_mappings_file( KDirectory * dir, lane * l )
+{
+    rc_t rc = KDirectoryCreateFile ( dir, &l->mappings, true, 0664, kcmCreate, 
+                                "mappings_%.*s_%03d.tsv.gz", l->name->len, l->name->addr, l->chunk );
+    if ( rc != 0 )
+    {
+        (void)PLOGERR( klogErr, ( klogErr, rc, "cannot create mappings-file for lane '$(lane)' / chunk '$(chunk)'",
+                                  "lane=%S,chunk=%d", l->name, l->chunk ) );
+    }
+    else
+    {
+        KFile * bz;
+        rc = KFileMakeBzip2ForWrite ( &bz, l->mappings );
+        if ( rc != 0 )
+        {
+            (void)PLOGERR( klogErr, ( klogErr, rc, "cannot create bzip mappings-file for lane '$(lane)' / chunk '$(chunk)'",
+                                      "lane=%S,chunk=%d", l->name, l->chunk ) );
+        }
+        else
+        {
+            KFileRelease( l->mappings );
+            l->mappings = bz;
+        }
+    }
+}
+
+*/
+
+static rc_t make_lane( cg_dump_opts * opts, struct sg_lookup * lookup, KDirectory * dir, String * spot_group, lane ** sg_lane )
+{
+    rc_t rc = 0;
+    ( *sg_lane ) = malloc( sizeof ** sg_lane );
+    if ( *sg_lane == NULL )
+    {
+        rc = RC( rcExe, rcDatabase, rcReading, rcMemory, rcExhausted );
+        (void)LOGERR( klogErr, rc, "memory exhausted when creating new lane" );
+    }
+    else
+    {
+        (*sg_lane)->chunk = opts->first_chunk;
+        (*sg_lane)->write_pos = 0;
+        (*sg_lane)->spot_count = 0;
+        rc = StringCopy ( &( (*sg_lane)->name ), spot_group );
+        if ( rc != 0 )
+        {
+            (void)LOGERR( klogErr, rc, "cannot copy name for new lane" );
+            free( *sg_lane );
+        }
+        else
+        {
+            rc = make_read_file( opts, lookup, dir, *sg_lane );
+            if ( rc != 0 )
+            {
+                StringWhack ( (*sg_lane)->name );
+                free( *sg_lane );
+            }
+/*
+            else
+            {
+                rc = make_mappings_file( dir, *sg_lane );
+                if ( rc != 0 )
+                {
+                    KFileRelease( (*sg_lane)->reads );
+                    StringWhack ( (*sg_lane)->name );
+                    free( *sg_lane );
+                }
+            }
+*/
+        }
+    }
+    return rc;
+}
+
+
+static void whack_lane( lane * l )
+{
+/*    KFileRelease( l->mappings ); */
+    KFileRelease( l->reads );
+    StringWhack ( l->name );
+    free( l );
+}
+
+
+static rc_t cg_dump_write_spot( cg_dump_opts * opts, cg_dump_ctx * cg_ctx, uint64_t row_id, lane * l )
+{
+    uint32_t elem_bits, boff, read_len;
+    const char * read;
+
+    rc_t rc = VCursorCellDataDirect( cg_ctx->seq_cur, row_id, cg_ctx->seq_read_idx, &elem_bits, (const void**)&read, &boff, &read_len );
+    if ( rc != 0 )
+    {
+        (void)PLOGERR( klogErr, ( klogErr, rc, "cannot read READ in row #$(row_id)", "row_id=%lu", row_id ) );
+    }
+    else
+    {
+        uint32_t qual_len;
+        const char * qual;
+        rc = VCursorCellDataDirect( cg_ctx->seq_cur, row_id, cg_ctx->seq_qual_idx, &elem_bits, (const void**)&qual, &boff, &qual_len );
+        if ( rc != 0 )
+        {
+            (void)PLOGERR( klogErr, ( klogErr, rc, "cannot read QUALITY in row #$(row_id)", "row_id=%lu", row_id ) );
+        }
+        else
+        {
+            if ( ( read_len != 70 ) && ( qual_len != 70 ) )
+            {
+                rc = RC( rcExe, rcDatabase, rcReading, rcRange, rcInvalid );
+                (void)LOGERR( klogErr, rc, "len of read/quality columns do not match cg-length of 2 x 35" );
+            }
+            else
+            {
+                char buffer[ 1024 ];
+                size_t num_writ_buf;
+                rc = string_printf ( buffer, sizeof buffer, &num_writ_buf,
+                        "%lu\t0\t%.35s\t%.35s\n%lu\t1\t%.35s\t%.35s\n",
+                        row_id, read, qual, row_id, &(read[35]), &(qual[35]) );
+                if ( rc != 0 )
+                {
+                    (void)PLOGERR( klogErr, ( klogErr, rc, "cannot generate output in row #$(row_id)", "row_id=%lu", row_id ) );
+                }
+                else
+                {
+                    if ( opts->comp != oc_null )
+                    {
+                        if ( l->spot_count >= opts->cutoff )
+                        {
+                            KFileRelease( l->reads );
+                            l->chunk++;
+                            l->spot_count = 0;
+                            l->write_pos = 0;
+                            rc = make_read_file( opts, cg_ctx->lookup, cg_ctx->out_dir, l );
+                        }
+                        if ( rc == 0 )
+                        {
+                            size_t num_writ_file;
+                            rc = KFileWrite ( l->reads, l->write_pos, buffer, num_writ_buf, &num_writ_file );
+                            if ( rc != 0 )
+                            {
+                                (void)PLOGERR( klogErr, ( klogErr, rc, "cannot write output in row #$(row_id)", "row_id=%lu", row_id ) );
+                            }
+                            else
+                            {
+                                l->write_pos += num_writ_file;
+                                l->spot_count ++;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+    return rc;
+}
+
+
+static rc_t cg_dump_row( cg_dump_opts * opts, cg_dump_ctx * cg_ctx, uint64_t row_id )
+{
+    uint32_t elem_bits, boff, sg_len;
+    const char * sg;
+    rc_t rc = VCursorCellDataDirect( cg_ctx->seq_cur, row_id, cg_ctx->seq_sg_idx, &elem_bits, (const void**)&sg, &boff, &sg_len );
+    if ( rc != 0 )
+    {
+        (void)PLOGERR( klogErr, ( klogErr, rc, "cannot read spot-group in row #$(row_id)", "row_id=%lu", row_id ) );
+    }
+    else
+    {
+        String spot_group;
+        lane * sg_lane;
+
+        StringInit( &spot_group, sg, sg_len, sg_len );
+        sg_lane = ( lane * )BSTreeFind ( &cg_ctx->lanes, &spot_group, String_lane_cmp );
+        if ( sg_lane == NULL )
+        {
+            /* KOutMsg( "row %lu (%S) not found, create it\n", row_id, &spot_group ); */
+            rc = make_lane( opts, cg_ctx->lookup, cg_ctx->out_dir, &spot_group, &sg_lane );
+            if ( rc == 0 )
+            {
+                rc = BSTreeInsert ( &cg_ctx->lanes, ( BSTNode * )sg_lane, lane_lane_cmp );
+                if ( rc != 0 )
+                {
+                    (void)LOGERR( klogErr, rc, "cannot insert new lane" );
+                    whack_lane( sg_lane );
+                }
+            }
+        }
+        else
+        {
+            /* KOutMsg( "row %lu (%S) found, use it\n", row_id, &spot_group ); */
+        }
+        if ( rc == 0 )
+        {
+            cg_dump_write_spot( opts, cg_ctx, row_id, sg_lane ); /* <================== */
+        }
+    }
+    return rc;
+}
+
+
+static rc_t cg_dump_loop( cg_dump_opts * opts, cg_dump_ctx * cg_ctx )
+{
+    const num_gen_iter * iter;
+    rc_t rc = num_gen_iterator_make( cg_ctx->rows, &iter );
+    if ( rc != 0 )
+    {
+        (void)LOGERR( klogErr, rc, "cannot make num-gen-iterator" );
+    }
+    else
+    {
+        uint64_t row_id;
+        rc_t rc1 = num_gen_iterator_next( iter, &row_id );
+        while ( rc == 0 && rc1 == 0 )
+        {
+            rc = Quitting();    /* to be able to cancel the loop by signal */
+            if ( rc == 0 )
+            {
+                rc = cg_dump_row( opts, cg_ctx, row_id ); /* <================== */
+                if ( rc == 0 )
+                {
+                    rc1 = num_gen_iterator_next( iter, &row_id );
+                    if ( rc1 == 0 )
+                    {
+                        if ( opts->show_progress )
+                        {
+                            uint32_t percent;
+                            rc = num_gen_iterator_percent( iter, cg_ctx->fract_digits, &percent );
+                            if ( rc == 0 )
+                                update_progressbar( cg_ctx->progress, cg_ctx->fract_digits, percent );
+                        }
+                    }
+                }
+            }
+        }
+        if ( opts->show_progress )
+            KOutMsg( "\n" );
+        num_gen_iterator_destroy( iter );
+    }
+    return rc;
+}
+
+
+static rc_t cg_dump_add_column( const VCursor * cur, uint32_t * idx, const char * col_name, const char * cur_name )
+{
+    rc_t rc = VCursorAddColumn ( cur, idx, "%s", col_name );
+    if ( rc != 0 )
+    {
+        (void)PLOGERR( klogErr, ( klogErr, rc, "cannot add $(col_name) to $(cur_name)",
+                                  "col_name=%s,cur_name=%s", col_name, cur_name ) );
+    }
+    return rc;
+}
+
+
+static rc_t cg_dump_open_cursor( const VCursor * cur, const char * cur_name )
+{
+    rc_t rc = VCursorOpen ( cur );
+    if ( rc != 0 )
+    {
+        (void)PLOGERR( klogErr, ( klogErr, rc, "cannot open $(cur_name)", "cur_name=%s", cur_name ) );
+    }
+    return rc;
+}
+
+
+static rc_t cg_dump_prepare_seq_tab( cg_dump_ctx * cg_ctx )
+{
+    const VCursor * cur = cg_ctx->seq_cur;
+    const char * cur_name = "SEQ-cursor";
+    rc_t rc = cg_dump_add_column( cur, &cg_ctx->seq_read_idx, "(INSDC:dna:text)READ", cur_name );
+/*
+    if ( rc == 0 )
+        rc = cg_dump_add_column( cur, &cg_ctx->seq_read_len_idx, "(INSDC:coord:len)READ_LEN", cur_name );
+*/
+    if ( rc == 0 )
+        rc = cg_dump_add_column( cur, &cg_ctx->seq_qual_idx, "(INSDC:quality:text:phred_33)QUALITY", cur_name );
+/*
+    if ( rc == 0 )
+        rc = cg_dump_add_column( cur, &cg_ctx->seq_prim_id_idx, "(I64)PRIMARY_ALIGNMENT_ID", cur_name );
+*/
+    if ( rc == 0 )
+        rc = cg_dump_add_column( cur, &cg_ctx->seq_sg_idx, "(ascii)SPOT_GROUP", cur_name );
+    if ( rc == 0 )
+        rc = cg_dump_open_cursor( cur, cur_name );
+    return rc;
+}
+
+
+/*
+static rc_t cg_dump_prepare_prim_tab( cg_dump_ctx * cg_ctx )
+{
+    const VCursor * cur = cg_ctx->prim_cur;
+    const char * cur_name = "PRIM-cursor";
+    rc_t rc = cg_dump_add_column( cur, &cg_ctx->prim_cigar_idx, "(ascii)CIGAR_SHORT", cur_name );
+    if ( rc == 0 )
+        rc = cg_dump_add_column( cur, &cg_ctx->prim_refname_idx, "(ascii)REF_NAME", cur_name );
+    if ( rc == 0 )
+        rc = cg_dump_add_column( cur, &cg_ctx->prim_refpos_idx, "(INSDC:coord:zero)REF_POS", cur_name );
+    if ( rc == 0 )
+        rc = cg_dump_open_cursor( cur, cur_name );
+    return rc;
+}
+*/
+
+static rc_t cg_dump_adjust_rowrange( cg_dump_ctx * cg_ctx )
+{
+    int64_t  first;
+    uint64_t count;
+    rc_t rc = VCursorIdRange( cg_ctx->seq_cur, 0, &first, &count );
+    if ( rc != 0 )
+    {
+        (void)LOGERR( klogErr, rc, "cannot detect Id-Range for SEQ-cursor" );
+    }
+    else
+    {
+        rc = num_gen_range_check( ( num_gen * )cg_ctx->rows, first, count );
+        if ( rc != 0 )
+        {
+            (void)LOGERR( klogErr, rc, "cannot define range of rows" );
+        }
+    }
+    return rc;
+}
+
+
+static rc_t cg_dump_setup_progressbar( cg_dump_ctx * cg_ctx )
+{
+    rc_t rc = make_progressbar( &cg_ctx->progress );
+    if ( rc == 0 )
+    {
+        uint64_t count;
+        const num_gen_iter * iter;
+        cg_ctx->fract_digits = 0;
+        rc = num_gen_iterator_make( cg_ctx->rows, &iter );
+        if ( rc == 0 )
+        {
+            if ( num_gen_iterator_count( iter, &count ) == 0 )
+            {
+                if ( count > 10000 )
+                {
+                    if ( count > 100000 )
+                        cg_ctx->fract_digits = 2;
+                    else
+                        cg_ctx->fract_digits = 1;
+                }
+            }
+            num_gen_iterator_destroy( iter );
+        }
+    }
+    return rc;
+}
+
+
+static rc_t cg_dump_create_output_dir( cg_dump_ctx * cg_ctx )
+{
+    rc_t rc = KDirectoryCreateDir ( cg_ctx->dir, 0775, ( kcmCreate | kcmParents ), "%s", cg_ctx->dst );
+    if ( rc != 0 )
+    {
+        (void)PLOGERR( klogErr, ( klogErr, rc, "cannot create directory '$(dir)'", "dir=%s", cg_ctx->dst ) );
+    }
+    return rc;
+}
+
+
+static rc_t cg_dump_clear_output_dir( cg_dump_opts * opts, cg_dump_ctx * cg_ctx )
+{
+    rc_t rc;
+    if ( opts->overwrite )
+    {
+        rc = KDirectoryClearDir ( cg_ctx->dir, true, "%s", cg_ctx->dst );
+        if ( rc != 0 )
+        {
+            (void)PLOGERR( klogErr, ( klogErr, rc, "cannot clear directory '$(dt)'",
+                                      "dt=%s", cg_ctx->dst ) );
+        }
+    }
+    else
+    {
+        rc = RC( rcExe, rcNoTarg, rcReading, rcParam, rcInvalid );
+        (void)PLOGERR( klogErr, ( klogErr, rc, "output-directory exitst already '$(dt)', use force-switch",
+                                  "dt=%s", cg_ctx->dst ) );
+        KOutMsg( "output-directory exitst already '%s', use force-switch", cg_ctx->dst );
+    }
+    return rc;
+}
+
+
+static rc_t cg_dump_remove_file( cg_dump_opts * opts, cg_dump_ctx * cg_ctx )
+{
+    rc_t rc;
+    if ( opts->overwrite )
+    {
+        rc = KDirectoryRemove ( cg_ctx->dir, true, "%s", cg_ctx->dst );
+        if ( rc != 0 )
+        {
+            (void)PLOGERR( klogErr, ( klogErr, rc, "cannot remove file '$(dt)'",
+                                      "dt=%s", cg_ctx->dst ) );
+        }
+    }
+    else
+    {
+        rc = RC( rcExe, rcNoTarg, rcReading, rcParam, rcInvalid );
+        (void)PLOGERR( klogErr, ( klogErr, rc, "output-directory-name exists as file '$(dt)', use force-switch",
+                                  "dt=%s", cg_ctx->dst ) );
+        KOutMsg( "output-directory-name exists as file '%s', use force-switch", cg_ctx->dst );
+
+    }
+    return rc;
+}
+
+
+static rc_t cg_dump_prepare_output( cg_dump_opts * opts, cg_dump_ctx * cg_ctx )
+{
+    rc_t rc = 0;
+
+    uint32_t pt = ( KDirectoryPathType ( cg_ctx->dir, "%s", cg_ctx->dst ) & ~ kptAlias );
+    switch ( pt )
+    {
+        case kptNotFound :  rc = cg_dump_create_output_dir( cg_ctx ); break;
+
+        case kptDir  :  rc = cg_dump_clear_output_dir( opts, cg_ctx ); break;
+
+        case kptFile :  rc = cg_dump_remove_file( opts, cg_ctx ); 
+                        if ( rc == 0 )
+                            rc = cg_dump_create_output_dir( cg_ctx );
+                        break;
+
+        default :   rc = RC( rcExe, rcNoTarg, rcReading, rcParam, rcInvalid );
+                    (void)PLOGERR( klogErr, ( klogErr, rc, "invalid output-directory-type '$(dt)'",
+                                              "dt=%s", pathtype_2_pchar( pt ) ) );
+                    break;
+    }
+    if ( rc == 0 )
+    {
+        rc = KDirectoryOpenDirUpdate ( cg_ctx->dir, &cg_ctx->out_dir, false, "%s", cg_ctx->dst );
+        if ( rc != 0 )
+        {
+            (void)LOGERR( klogErr, rc, "cannot open output-directory for update" );
+        }
+        else
+        {
+            BSTreeInit( &cg_ctx->lanes );
+        }
+    }
+    return rc;
+}
+
+
+static void CC whack_lanes_nodes( BSTNode *n, void *data )
+{
+    whack_lane( ( lane * )n );
+}
+
+
+static rc_t cg_dump_src_dst_rows_cur( cg_dump_opts * opts, cg_dump_ctx * cg_ctx )
+{
+    /* preparations */
+    rc_t rc = cg_dump_prepare_seq_tab( cg_ctx );
+/*
+    if ( rc == 0 )
+        rc = cg_dump_prepare_prim_tab( cg_ctx );
+*/
+    if ( rc == 0 )
+        rc = cg_dump_adjust_rowrange( cg_ctx );
+    if ( rc == 0 )
+        rc = cg_dump_setup_progressbar( cg_ctx );
+    if ( rc == 0 )
+        rc = cg_dump_prepare_output( opts, cg_ctx );
+
+    /* loop through the SEQUENCE-table */
+    if ( rc == 0 )
+    {
+        rc = cg_dump_loop( opts, cg_ctx ); /* <================== */
+
+        if ( cg_ctx->progress != NULL )
+            destroy_progressbar( cg_ctx->progress );
+        BSTreeWhack ( &cg_ctx->lanes, whack_lanes_nodes, NULL );
+        KDirectoryRelease( cg_ctx->out_dir );
+    }
+    return rc;
+}
+
+
+static rc_t cg_dump_src_dst_rows_vdb( cg_dump_opts * opts, const VDBManager * mgr, const char * src, cg_dump_ctx * cg_ctx )
+{
+    const VDatabase * db;
+    rc_t rc = VDBManagerOpenDBRead( mgr, &db, NULL, "%s", src );
+    if ( rc != 0 )
+    {
+        (void)LOGERR( klogErr, rc, "cannot open database" );
+    }
+    else
+    {
+        rc = parse_sg_lookup( cg_ctx->lookup, db ); /* in sg_lookup.c */
+        if ( rc == 0 )
+        {
+            const VTable * seq;
+            rc = VDatabaseOpenTableRead( db, &seq, "SEQUENCE" );
+            if ( rc != 0 )
+            {
+                (void)LOGERR( klogErr, rc, "cannot open SEQUENCE-table" );
+            }
+            else
+            {
+                const VTable * prim;
+                rc = VDatabaseOpenTableRead( db, &prim, "PRIMARY_ALIGNMENT" );
+                if ( rc != 0 )
+                {
+                    (void)LOGERR( klogErr, rc, "cannot open PRIMARY-ALIGNMENT-table" );
+                }
+                else
+                {
+                    if ( opts->cursor_cache > 0 )
+                        rc = VTableCreateCachedCursorRead( seq, &cg_ctx->seq_cur, opts->cursor_cache );
+                    else
+                        rc = VTableCreateCursorRead( seq, &cg_ctx->seq_cur );
+                    if ( rc != 0 )
+                    {
+                        (void)LOGERR( klogErr, rc, "cannot create cursor for SEQUENCE-table" );
+                    }
+                    else
+                    {
+    /*
+                        if ( opts->cursor_cache > 0 )
+                            rc = VTableCreateCachedCursorRead( prim, &cg_ctx->prim_cur, opts->cursor_cache );
+                        else
+                            rc = VTableCreateCursorRead( prim, &cg_ctx->prim_cur );
+                        if ( rc != 0 )
+                        {
+                            (void)LOGERR( klogErr, rc, "cannot create cursor for PRIMARY_ALIGNMENT-table" );
+                        }
+    */
+
+                        if ( rc == 0 )
+                        {
+                            rc = cg_dump_src_dst_rows_cur( opts, cg_ctx );  /* <================== */
+                            /* VCursorRelease( cg_ctx->prim_cur ); */
+                        }
+                        VCursorRelease( cg_ctx->seq_cur );
+                    }
+                    /* VTableRelease( prim ); */
+                }
+                VTableRelease( seq );
+            }
+        }
+        VDatabaseRelease( db );
+    }
+    return rc;
+}
+
+
+static rc_t cg_dump_src_dst_rows( cg_dump_opts * opts, const char * src, cg_dump_ctx * cg_ctx )
+{
+    rc_t rc = KDirectoryNativeDir( &cg_ctx->dir );
+    if ( rc != 0 )
+    {
+        (void)LOGERR( klogErr, rc, "cannot create internal directory object" );
+    }
+    else
+    {
+        const VDBManager * mgr;
+        rc = VDBManagerMakeRead ( &mgr, cg_ctx->dir );
+        if ( rc != 0 )
+        {
+            (void)LOGERR( klogErr, rc, "cannot create vdb-manager" );
+        }
+        else
+        {
+            int path_type = ( VDBManagerPathType ( mgr, "%s", src ) & ~ kptAlias );
+            if ( path_type != kptDatabase )
+            {
+                rc = RC( rcExe, rcNoTarg, rcReading, rcParam, rcInvalid );
+                if ( path_type == kptNotFound )
+                {
+                    (void)LOGERR( klogErr, rc, "the source object cannot be found" );
+                }
+                else
+                {
+                    (void)LOGERR( klogErr, rc, "source cannot be used" );
+                    KOutMsg( "it is instead: '%s'\n", pathtype_2_pchar( path_type ) );
+                }
+            }
+            else
+            {
+                rc = cg_dump_src_dst_rows_vdb( opts, mgr, src, cg_ctx ); /* <================== */
+            }
+            VDBManagerRelease( mgr );
+        }
+        KDirectoryRelease( cg_ctx->dir );
+    }
+    return rc;
+}
+
+
+static rc_t cg_dump_discover_last_rowid( const char * dst )
+{
+    rc_t rc = KOutMsg( "\n***** discover last processed row-id *****\n" );
+    if ( rc == 0 )
+    {
+        int64_t last_row_id = 0;
+        rc = discover_last_rowid( dst, &last_row_id );
+        if ( rc == 0 )
+        {
+            rc = KOutMsg( "last row-id: %ld\n", last_row_id );
+        }
+    }
+    return rc;
+}
+
+
+static rc_t cg_dump_get_uint64t_option( Args * args, const char * name, uint64_t * value, bool * found  )
+{
+    uint32_t count;
+
+    rc_t rc = ArgsOptionCount( args, name, &count );
+    if ( rc != 0 )
+    {
+        (void)PLOGERR( klogErr, ( klogErr, rc, "cannot detect count of $(name) option", "name=%s", name ) );
+    }
+    else
+    {
+        *found = ( count > 0 );
+    }
+
+    if ( rc == 0 && ( *found ) )
+    {
+        const char * s;
+        rc = ArgsOptionValue( args, name, 0,  &s );
+        if ( rc != 0 )
+        {
+            (void)PLOGERR( klogErr, ( klogErr, rc, "cannot detect value of $(name) option", "name=%s", name ) );
+        }
+        else
+        {
+            char * endp;
+            *value = strtou64( s, &endp, 10 );
+        }
+    }
+    return rc;
+}
+
+
+static rc_t cg_dump_get_size_option( Args * args, const char * name, size_t * value, bool * found  )
+{
+    uint32_t count;
+
+    rc_t rc = ArgsOptionCount( args, name, &count );
+    if ( rc != 0 )
+    {
+        (void)PLOGERR( klogErr, ( klogErr, rc, "cannot detect count of $(name) option", "name=%s", name ) );
+    }
+    else
+    {
+        *found = ( count > 0 );
+    }
+
+    if ( rc == 0 && ( *found ) )
+    {
+        const char * s;
+        rc = ArgsOptionValue( args, name, 0,  &s );
+        if ( rc != 0 )
+        {
+            (void)PLOGERR( klogErr, ( klogErr, rc, "cannot detect value of $(name) option", "name=%s", name ) );
+        }
+        else
+        {
+            *value = atoi( s );
+        }
+    }
+    return rc;
+}
+
+
+static rc_t cg_dump_get_uint32t_option( Args * args, const char * name, uint32_t * value, bool * found  )
+{
+    uint32_t count;
+
+    rc_t rc = ArgsOptionCount( args, name, &count );
+    if ( rc != 0 )
+    {
+        (void)PLOGERR( klogErr, ( klogErr, rc, "cannot detect count of $(name) option", "name=%s", name ) );
+    }
+    else
+    {
+        *found = ( count > 0 );
+    }
+
+    if ( rc == 0 && ( *found ) )
+    {
+        const char * s;
+        rc = ArgsOptionValue( args, name, 0,  &s );
+        if ( rc != 0 )
+        {
+            (void)PLOGERR( klogErr, ( klogErr, rc, "cannot detect value of $(name) option", "name=%s", name ) );
+        }
+        else
+        {
+            *value = atoi( s );
+        }
+    }
+    return rc;
+}
+
+
+static rc_t cg_dump_get_bool_option( Args * args, const char * name, bool * value )
+{
+    uint32_t count;
+
+    rc_t rc = ArgsOptionCount( args, name, &count );
+    if ( rc != 0 )
+    {
+        (void)PLOGERR( klogErr, ( klogErr, rc, "cannot detect count of $(name) option", "name=%s", name ) );
+    }
+    else
+    {
+        *value = ( count > 0 );
+    }
+    return rc;
+}
+
+
+static rc_t cg_dump_get_string_option( Args * args, const char * name, const char ** value, bool * found  )
+{
+    uint32_t count;
+
+    rc_t rc = ArgsOptionCount( args, name, &count );
+    if ( rc != 0 )
+    {
+        (void)PLOGERR( klogErr, ( klogErr, rc, "cannot detect count of $(name) option", "name=%s", name ) );
+    }
+    else
+    {
+        *found = ( count > 0 );
+    }
+
+    if ( rc == 0 && ( *found ) )
+    {
+        rc = ArgsOptionValue( args, name, 0, value );
+        if ( rc != 0 )
+        {
+            (void)PLOGERR( klogErr, ( klogErr, rc, "cannot detect value of $(name) option", "name=%s", name ) );
+        }
+    }
+    return rc;
+}
+
+
+const char * value_comp_none = "none";
+const char * value_comp_bzip = "bzip";
+const char * value_comp_gzip = "gzip";
+const char * value_comp_null = "null";
+
+
+static rc_t cg_dump_gather_output_compression( Args * args, cg_dump_opts * opts )
+{
+    const char * value;
+    bool found;
+    rc_t rc = cg_dump_get_string_option( args, OPTION_COMP, &value, &found );
+    if ( rc == 0 )
+    {
+        opts->comp = oc_bzip;
+        if ( found )
+        {
+            if ( string_cmp ( value, string_size( value ),
+                              value_comp_none, string_size( value_comp_none ), string_size( value ) ) == 0 )
+            {
+                opts->comp = oc_none;
+            }
+            else if ( string_cmp ( value, string_size( value ),
+                                   value_comp_bzip, string_size( value_comp_bzip ), string_size( value ) ) == 0 )
+            {
+                opts->comp = oc_bzip;
+            }
+            else if ( string_cmp ( value, string_size( value ),
+                                   value_comp_gzip, string_size( value_comp_gzip ), string_size( value ) ) == 0 )
+            {
+                opts->comp = oc_gzip;
+            }
+            else  if ( string_cmp ( value, string_size( value ),
+                                   value_comp_null, string_size( value_comp_null ), string_size( value ) ) == 0 )
+            {
+                opts->comp = oc_null;
+            }
+        }
+    }
+    return rc;
+}
+
+
+const char * dflt_lib = "no library";
+const char * dflt_sample = "no sample";
+const char * dflt_prefix = "";
+
+static rc_t cg_dump_gather_opts( Args * args, cg_dump_opts * opts )
+{
+    bool found;
+
+    rc_t rc = cg_dump_get_uint64t_option( args, OPTION_CUTOFF, &opts->cutoff, &found );
+    if ( rc == 0 && !found )
+        opts->cutoff = DEFAULT_CUTOFF;
+
+    if ( rc == 0 )
+        rc = cg_dump_get_bool_option( args, OPTION_FORCE, &opts->overwrite  );
+
+    if ( rc == 0 )
+        rc = cg_dump_get_uint64t_option( args, OPTION_CACHE, &opts->cursor_cache, &found );
+    if ( rc == 0 && !found )
+        opts->cursor_cache = CURSOR_CACHE_SIZE;
+
+    if ( rc == 0 )
+        rc = cg_dump_gather_output_compression( args, opts );
+
+    if ( rc == 0 )
+        rc = cg_dump_get_bool_option( args, OPTION_PROG, &opts->show_progress  );
+
+    opts->first_chunk = 1;
+
+    if ( rc == 0 )
+        rc = cg_dump_get_string_option( args, OPTION_LIB, &opts->lib, &found );
+    if ( rc == 0 && !found )
+        opts->lib = dflt_lib;
+
+    if ( rc == 0 )
+        rc = cg_dump_get_string_option( args, OPTION_SAMPLE, &opts->sample, &found );
+    if ( rc == 0 && !found )
+        opts->sample = dflt_sample;
+
+    if ( rc == 0 )
+        rc = cg_dump_get_string_option( args, OPTION_PREFIX, &opts->prefix, &found );
+    if ( rc == 0 && !found )
+        opts->prefix = dflt_prefix;
+
+    if ( rc == 0 )
+        rc = cg_dump_get_size_option( args, OPTION_WBUF, &opts->wbuff_size, &found );
+
+    if ( rc == 0 )
+        rc = cg_dump_get_bool_option( args, OPTION_QUEUE, &opts->use_queue );
+
+    if ( rc == 0 )
+        rc = cg_dump_get_size_option( args, OPTION_QUEUE_BYTES, &opts->qbytes, &found );
+    if ( rc == 0 && !found )
+        opts->qbytes = ( 2 * 64 * 1024 );
+
+    if ( rc == 0 )
+        rc = cg_dump_get_size_option( args, OPTION_QUEUE_BLOCK, &opts->qblock, &found );
+    if ( rc == 0 && !found )
+        opts->qblock = ( 64 * 1024 );
+
+    if ( rc == 0 )
+        rc = cg_dump_get_uint32t_option( args, OPTION_QUEUE_TIMEOUT, &opts->qtimeout, &found );
+    if ( rc == 0 && !found )
+        opts->qtimeout = 10000;
+
+    if ( rc == 0 )
+        rc = cg_dump_get_bool_option( args, OPTION_LAST_ROWID, &opts->get_last_rowid );
+
+    return rc;
+}
+
+
+static rc_t cg_dump_src_dst( Args * args, const char * src, cg_dump_ctx * cg_ctx )
+{
+    rc_t rc = num_gen_make( &cg_ctx->rows );
+    if ( rc != 0 )
+    {
+        (void)LOGERR( klogErr, rc, "cannot create internal object" );
+    }
+    else
+    {
+        uint32_t count;
+        rc = ArgsOptionCount( args, OPTION_ROWS, &count );
+        if ( rc != 0 )
+        {
+            (void)LOGERR( klogErr, rc, "cannot detect count of program option : 'rows'" );
+        }
+        else
+        {
+            if ( count > 0 )
+            {
+                const char * s;
+                rc = ArgsOptionValue( args, OPTION_ROWS, 0,  &s );
+                if ( rc != 0 )
+                {
+                    (void)LOGERR( klogErr, rc, "cannot detect value of program option : 'rows'" );
+                }
+                else
+                {
+                    num_gen_parse( cg_ctx->rows, s );
+                }
+            }
+            if ( rc == 0 )
+            {
+                rc = make_sg_lookup( &cg_ctx->lookup ); /* in sg_lookup.c */
+                if ( rc != 0 )
+                {
+                    (void)LOGERR( klogErr, rc, "cannot create spot-group lookup table" );
+                }
+                else
+                {
+                    cg_dump_opts opts;
+                    memset( &opts, 0, sizeof opts );
+                    rc = cg_dump_gather_opts( args, &opts );
+                    if ( rc == 0 )
+                    {
+                        if ( opts.get_last_rowid )
+                        {
+                            rc = cg_dump_discover_last_rowid( cg_ctx->dst );
+                        }
+                        else
+                        {
+                            rc = cg_dump_src_dst_rows( &opts, src, cg_ctx ); /* <================== */
+                        }
+                    }
+
+                    destroy_sg_lookup( cg_ctx->lookup ); /* in sg_lookup.c */
+                }
+            }
+        }
+        num_gen_destroy( cg_ctx->rows );
+    }
+    return rc;
+}
+
+
+rc_t CC KMain ( int argc, char *argv [] )
+{
+    Args * args;
+    rc_t rc = ArgsMakeAndHandle ( &args, argc, argv, 1,
+            DumpOptions, sizeof DumpOptions / sizeof DumpOptions [ 0 ] );
+    if ( rc == 0 )
+    {
+        uint32_t count;
+        rc = ArgsParamCount( args, &count );
+        if ( rc != 0 )
+        {
+            (void)LOGERR( klogErr, rc, "cannot detect count of program arguments" );
+        }
+        else
+        {
+            if ( count != 2 )
+            {
+                Usage ( args );
+            }
+            else
+            {
+                cg_dump_ctx cg_ctx;
+                const char * src;
+
+                memset( &cg_ctx, 0, sizeof cg_ctx );
+                rc = ArgsParamValue( args, 0, &src );
+                if ( rc != 0 )
+                {
+                    (void)LOGERR( klogErr, rc, "cannot detect source - argument" );
+                }
+                else
+                {
+                    rc = ArgsParamValue( args, 1, &cg_ctx.dst );
+                    if ( rc != 0 )
+                    {
+                        (void)LOGERR( klogErr, rc, "cannot detect destination - argument" );
+                    }
+                    else
+                    {
+                        rc = cg_dump_src_dst( args, src, &cg_ctx ); /* <================== */
+                    }
+                }
+            }
+        }
+        ArgsWhack ( args );
+    }
+    return rc;
+}
diff --git a/tools/cg-dump/cg-dump.vers b/tools/cg-dump/cg-dump.vers
new file mode 100644
index 0000000..8e8299d
--- /dev/null
+++ b/tools/cg-dump/cg-dump.vers
@@ -0,0 +1 @@
+2.4.2
diff --git a/tools/cg-dump/last_rowid.c b/tools/cg-dump/last_rowid.c
new file mode 100644
index 0000000..fbbc179
--- /dev/null
+++ b/tools/cg-dump/last_rowid.c
@@ -0,0 +1,353 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <os-native.h>
+#include <sysalloc.h>
+
+#include "last_rowid.h"
+#include "line_token_iter.h"
+#include <klib/log.h>
+#include <klib/out.h>
+#include <klib/text.h>
+#include <klib/printf.h>
+#include <klib/namelist.h>
+
+#include <kfs/directory.h>
+#include <kfs/file.h>
+
+#include <stdlib.h>
+
+
+typedef struct sg_entry
+{
+    BSTNode node;
+
+    const String * spot_group;
+    const String * full_filename;
+    uint32_t batch;
+} sg_entry;
+
+
+static int CC String_entry_cmp ( const void * item, const BSTNode * n )
+{
+    const String * name = ( const String * ) item;
+    const sg_entry * sg = ( const sg_entry * ) n;
+    return StringCompare ( sg->spot_group, name );
+}
+
+
+static int CC entry_entry_cmp ( const BSTNode * item, const BSTNode * n )
+{
+    const sg_entry * sg1 = ( const sg_entry * ) item;
+    const sg_entry * sg2 = ( const sg_entry * ) n;
+    return StringCompare ( sg2->spot_group, sg1->spot_group );
+}
+
+
+static rc_t make_sg_entry( const String * spot_group, const String * full_filename, uint32_t batch, sg_entry ** entry )
+{
+    rc_t rc = 0;
+    ( *entry ) = malloc( sizeof ** entry );
+    if ( *entry == NULL )
+    {
+        rc = RC( rcExe, rcDatabase, rcReading, rcMemory, rcExhausted );
+        (void)LOGERR( klogErr, rc, "memory exhausted when creating new spotgroup-lookup-entry" );
+    }
+    else
+    {
+        rc = StringCopy ( &( ( *entry )->spot_group ), spot_group );
+        if ( rc == 0 )
+            rc = StringCopy ( &( (*entry)->full_filename ), full_filename );
+        if ( rc == 0 )
+            (*entry)->batch = batch;
+    }
+    return rc;
+}
+
+
+rc_t insert_file( BSTree * entries, const char * filename )
+{
+    rc_t rc;
+    String S;
+    struct token_iter ti;
+
+    StringInitCString( &S, filename );
+    rc = token_iter_init( &ti, &S, '.' );
+    if ( rc == 0 )
+    {
+        bool valid;
+        String basename;
+
+        rc = token_iter_get( &ti, &basename, &valid, NULL );
+        if ( rc == 0 && valid )
+        {
+            String sg;
+            const char * ptr;
+            char s_batch[ 4 ];
+            uint32_t batch;
+            sg_entry * entry;
+
+            StringInit( &sg, basename.addr, basename.size - 4, basename.size - 4 );
+            ptr = ( basename.addr + sg.size + 1 );
+            s_batch[ 0 ] = *ptr++;
+            s_batch[ 1 ] = *ptr++;
+            s_batch[ 2 ] = *ptr++;
+            s_batch[ 3 ] = 0;
+            batch = atoi( s_batch );
+
+            entry = ( sg_entry * ) BSTreeFind ( entries, ( void * )&sg, String_entry_cmp );
+            if ( entry == NULL )
+            {
+                rc = make_sg_entry( &sg, &S, batch, &entry );
+                if ( rc == 0 )
+                    rc = BSTreeInsert ( entries, ( BSTNode * )entry, entry_entry_cmp );
+            }
+            else
+            {
+                if ( batch > entry->batch )
+                    entry->batch = batch;
+            }
+        }
+    }
+    return rc;
+}
+
+
+static void CC whack_entry( BSTNode * n, void * data )
+{
+    const sg_entry * sg = ( const sg_entry * ) n;
+    StringWhack ( sg->spot_group );
+    StringWhack ( sg->full_filename );
+    free( ( void * ) sg );
+}
+
+
+typedef struct walk_ctx
+{
+    rc_t rc;
+    int64_t last_row_id;
+    const KDirectory *dir;
+} walk_ctx;
+
+
+enum ft
+{
+    ft_none = 0,    /* it is uncompressed tvs */
+    ft_gzip,        /* use gzip */
+    ft_bzip,        /* use bzip2 */
+    ft_unknown      /* unknown extension */
+};
+
+
+enum ft get_compression( const String * filename )
+{
+    enum ft res = ft_unknown;
+    const char * ptr = filename->addr + ( filename->size - 3 );
+    if ( ptr[ 0 ] == 'b' )
+    {
+        if ( ptr[ 1 ] == 'z' && ptr[ 2 ] == '2' )
+            res = ft_bzip;
+    }
+    else if ( ptr[ 0 ] == 'g' )
+    {
+        if ( ptr[ 1 ] == 'z' )
+            res = ft_gzip;
+    }
+    else if ( ptr[ 0 ] == 't' )
+    {
+        if ( ptr[ 1 ] == 's' && ptr[ 2 ] == 'v' )
+            res = ft_none;
+    }
+    return res;
+}
+
+
+static rc_t raw_extract_last_rowid( const KFile * f, int64_t * row_id )
+{
+    rc_t rc = 0;
+    KOutMsg( "uncompressed tsv-file\n" );
+    return rc;
+}
+
+
+static rc_t gzip_extract_last_rowid( const KFile * f, int64_t * row_id )
+{
+    rc_t rc = 0;
+    KOutMsg( "compressed with gzip\n" );
+    return rc;
+}
+
+
+static rc_t bzip_extract_last_rowid( const KFile * f, int64_t * row_id )
+{
+    const KFile *bz;
+    rc_t rc = KFileMakeBzip2ForRead ( &bz, f );
+    if ( rc != 0 )
+    {
+
+    }
+    else
+    {
+
+    }
+    return rc;
+}
+
+
+static rc_t extract_last_rowid( const KDirectory *dir, const String * filename, int64_t * row_id )
+{
+    const KFile * f;
+    rc_t rc = KDirectoryOpenFileRead ( dir, &f, "%.*s", filename->size, filename->addr );
+    if ( rc != 0 )
+    {
+        (void)PLOGERR( klogErr, ( klogErr, rc, "cannot open $(fn)", "fn=%.*s", filename->size, filename->addr ) );
+    }
+    else
+    {
+        enum ft comp = get_compression( filename );
+        KOutMsg( "file '%S' opened :", filename );
+
+        switch ( comp )
+        {
+            case ft_none : raw_extract_last_rowid( f, row_id ); break;
+            case ft_gzip : gzip_extract_last_rowid( f, row_id ); break;
+            case ft_bzip : bzip_extract_last_rowid( f, row_id ); break;
+            default      : KOutMsg( "unknown file-type\n" ); break;
+        }
+        rc = KFileRelease ( f );
+    }
+    return rc;
+}
+
+
+static bool CC on_file ( BSTNode *n, void *data )
+{
+    walk_ctx * wctx = ( walk_ctx * )data;
+    if ( wctx != NULL && wctx->rc == 0 )
+    {
+        const sg_entry * sg = ( const sg_entry * ) n;
+        if ( sg != NULL )
+        {
+            size_t num_writ, l;
+            l = sg->spot_group->size + 1;
+            wctx->rc = string_printf ( ( char * )( sg->full_filename->addr + l ), 4, &num_writ, "%.03u", sg->batch );
+            if ( wctx->rc == 0 )
+            {
+                int64_t row_id = 0;
+                ( ( char * ) sg->full_filename->addr )[ l + 3 ] = '.';
+                wctx->rc = extract_last_rowid( wctx->dir, sg->full_filename, &row_id );
+                if ( wctx->rc == 0 )
+                {
+                    if ( row_id > wctx->last_row_id )
+                        wctx->last_row_id = row_id;
+                    return false;
+                }
+            }
+        }
+    }
+    return true;
+}
+
+
+rc_t discover_last_rowid( const char * src, int64_t * last_row_id )
+{
+    KDirectory *dir;
+    rc_t rc = KDirectoryNativeDir ( &dir );
+    if ( rc != 0 )
+    {
+        (void)LOGERR( klogErr, rc, "cannot create native directory" );
+    }
+    else
+    {
+        const KDirectory * src_dir;
+        rc = KDirectoryOpenDirRead ( dir, &src_dir, false, "%s", src );
+        if ( rc != 0 )
+        {
+            (void)PLOGERR( klogErr, ( klogErr, rc, "cannot open directory #$(d)", "d=%s", src ) );
+        }
+        else
+        {
+            KNamelist *files;
+            rc = KDirectoryList ( src_dir, &files, NULL, NULL, "." );
+            if ( rc != 0 )
+            {
+                (void)LOGERR( klogErr, rc, "cannot list files in output directory" );
+            }
+            else
+            {
+                uint32_t count;
+                rc = KNamelistCount ( files, &count );
+                if ( rc != 0 )
+                {
+                    (void)LOGERR( klogErr, rc, "cannot count the files in the output directory" );
+                }
+                else
+                {
+                    rc = KOutMsg( "%u files in '%s' found\n", count, src );
+                    if ( rc == 0 )
+                    {
+                        uint32_t idx;
+                        BSTree entries;
+
+                        BSTreeInit( &entries );
+                        for ( idx = 0; idx < count && rc == 0; ++idx )
+                        {
+                            const char * filename;
+                            rc = KNamelistGet ( files, idx, &filename );
+                            if ( rc != 0 )
+                            {
+                                (void)PLOGERR( klogErr, ( klogErr, rc, "cannot retrieve filename #$(idx)", "idx=%u", idx ) );
+                            }
+                            else
+                                rc = insert_file( &entries, filename );
+                        }
+
+                        if ( rc == 0 )
+                        {
+                            walk_ctx wctx;
+
+                            wctx.rc = rc;
+                            wctx.last_row_id = *last_row_id;
+                            wctx.dir = src_dir;
+                            BSTreeDoUntil ( &entries, false, on_file, &wctx );
+                            if ( wctx.rc == 0 )
+                            {
+                                *last_row_id = wctx.last_row_id;
+                            }
+                            else
+                                rc = wctx.rc;
+                        }
+                        BSTreeWhack ( &entries, whack_entry, NULL );
+                    }
+                }
+                KNamelistRelease ( files );
+            }
+            KDirectoryRelease( src_dir );
+        }
+        KDirectoryRelease( dir );
+    }
+    return rc;
+}
\ No newline at end of file
diff --git a/tools/cg-dump/last_rowid.h b/tools/cg-dump/last_rowid.h
new file mode 100644
index 0000000..5ae92f0
--- /dev/null
+++ b/tools/cg-dump/last_rowid.h
@@ -0,0 +1,44 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_last_rowid_
+#define _h_last_rowid_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <klib/rc.h>
+#include <klib/text.h>
+#include <klib/container.h>
+
+rc_t discover_last_rowid( const char * src, int64_t * last_row_id );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/cg-dump/line_token_iter.c b/tools/cg-dump/line_token_iter.c
new file mode 100644
index 0000000..61b1553
--- /dev/null
+++ b/tools/cg-dump/line_token_iter.c
@@ -0,0 +1,148 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <os-native.h>
+#include <sysalloc.h>
+
+#include "line_token_iter.h"
+#include <klib/log.h>
+#include <klib/out.h>
+
+#include <stdlib.h>
+
+/* ---------------------------------------------------------------------------- */
+/* >>>>> buf line iter <<<<< */
+
+rc_t buf_line_iter_init( struct buf_line_iter * self, const char * buffer, size_t len )
+{
+    rc_t rc = 0;
+
+    if ( self == NULL )
+        rc = RC( rcVDB, rcNoTarg, rcConstructing, rcSelf, rcNull );
+    else
+    {
+        /* we do accept null buffer, empty len, we just do not hand out lines later */
+        self->nxt = buffer;
+        self->len = len;
+        self->line_nr = 0;
+    }
+    return rc;
+}
+
+
+rc_t buf_line_iter_get( struct buf_line_iter * self, String * line, bool * valid, uint32_t * line_nr )
+{
+    rc_t rc = 0;
+
+    if ( self == NULL )
+        rc = RC( rcVDB, rcNoTarg, rcConstructing, rcSelf, rcNull );
+    else if ( line == NULL || valid == NULL )
+        rc = RC( rcVDB, rcNoTarg, rcConstructing, rcParam, rcNull );
+    else
+    {
+        *valid = ( self->nxt != NULL && self->len > 0 );
+        if ( *valid )
+        {
+            char * nl = string_chr ( self->nxt, self->len, '\n' );
+            if ( nl == NULL )
+            {
+                /* no newline found... */
+                StringInit( line, self->nxt, self->len, self->len );
+                self->len = 0;  /* next call will return *valid == false */
+            }
+            else
+            {
+                /* we found a newline... */
+                size_t l = ( nl - self->nxt );
+                StringInit( line, self->nxt, l, l );
+                self->len -= ( l + 1 );
+                if ( self->len > 0 )
+                    self->nxt += ( l + 1 );
+            }
+            if ( line_nr != NULL )
+                *line_nr = self->line_nr++;
+        }
+    }
+    return rc;
+}
+
+
+/* ---------------------------------------------------------------------------- */
+/* >>>>> token iter <<<<< */
+
+rc_t token_iter_init( struct token_iter * self, const String * line, char delim )
+{
+    rc_t rc = 0;
+
+    if ( self == NULL )
+        rc = RC( rcVDB, rcNoTarg, rcConstructing, rcSelf, rcNull );
+    else
+    {
+        /* we do accept null buffer, empty len, we just do not hand out lines later */
+        StringInit( &self->line, line->addr, line->size, line->len );
+        self->delim = delim;
+        self->token_nr = 0;
+        self->idx = 0;
+    }
+    return rc;
+}
+
+
+rc_t token_iter_get( struct token_iter * self, String * token, bool * valid, uint32_t * token_nr )
+{
+    rc_t rc = 0;
+
+    if ( self == NULL )
+        rc = RC( rcVDB, rcNoTarg, rcConstructing, rcSelf, rcNull );
+    else if ( token == NULL || valid == NULL )
+        rc = RC( rcVDB, rcNoTarg, rcConstructing, rcParam, rcNull );
+    else
+    {
+        while ( ( self->idx < self->line.len ) && ( self->line.addr[ self->idx ] == self->delim ) )
+            self->idx++;
+        *valid = ( self->idx < self->line.len );
+        if ( *valid )
+        {
+            char * end;
+            size_t l = ( self->line.len - self->idx );
+            token->addr = &( self->line.addr[ self->idx ] );
+            end = string_chr ( token->addr, l, self->delim );
+            if ( end == NULL )
+            {
+                token->size = token->len = l;
+                self->idx = self->line.len;
+            }
+            else
+            {
+                token->size = token->len = ( end - token->addr );
+                self->idx = ( end - self->line.addr );
+            }
+            if ( token_nr != NULL )
+                *token_nr = self->token_nr++;
+        }
+    }
+    return rc;
+}
diff --git a/tools/cg-dump/line_token_iter.h b/tools/cg-dump/line_token_iter.h
new file mode 100644
index 0000000..c5e602d
--- /dev/null
+++ b/tools/cg-dump/line_token_iter.h
@@ -0,0 +1,66 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_line_token_iter_
+#define _h_line_token_iter_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <klib/rc.h>
+#include <klib/text.h>
+
+
+typedef struct buf_line_iter
+{
+    const char * nxt;
+    size_t len;
+    uint32_t line_nr;
+} buf_line_iter;
+
+rc_t buf_line_iter_init( struct buf_line_iter * self, const char * buffer, size_t len );
+rc_t buf_line_iter_get( struct buf_line_iter * self, String * line, bool * valid, uint32_t * line_nr );
+
+
+typedef struct token_iter
+{
+    String line;
+    char delim;
+    uint32_t token_nr;
+    uint32_t idx;
+} token_iter;
+
+rc_t token_iter_init( struct token_iter * self, const String * line, char delim );
+rc_t token_iter_get( struct token_iter * self, String * token, bool * valid, uint32_t * token_nr );
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/cg-dump/num-gen.c b/tools/cg-dump/num-gen.c
new file mode 100644
index 0000000..637fdf1
--- /dev/null
+++ b/tools/cg-dump/num-gen.c
@@ -0,0 +1,848 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "num-gen.h"
+#include <klib/printf.h>
+
+#include <sysalloc.h>
+#include <strtol.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+typedef struct num_gen_node
+{
+    uint64_t start;
+    uint64_t end;
+    uint64_t count; /* 0 ... skip, >0 ... valid */
+} num_gen_node;
+typedef struct num_gen_node * p_num_gen_node;
+
+/* **************************************************************************
+{ start:5,count: 0 } ---> [ ]
+{ start:5,count: 1 } ---> [ 5 ]
+{ start:5,count: 2 } ---> [ 5, 6 ]
+ ************************************************************************** */
+
+struct num_gen
+{
+    Vector nodes;
+};
+
+
+struct num_gen_iter
+{
+    Vector nodes;
+    uint64_t curr_node;
+    uint64_t curr_node_sub_pos;
+    uint64_t total;
+    uint64_t progress;
+};
+
+/* forward decl. for fixing-function */
+static rc_t num_gen_fix_overlaps( num_gen* self, uint32_t *count );
+
+
+/* helper function to destroy a node*/
+static void CC num_gen_node_destroy( void *item, void *data )
+{
+    free( item );
+}
+
+
+/* helper function to create a node from start/count */
+static p_num_gen_node num_gen_make_node( const uint64_t start, const uint64_t count )
+{
+    p_num_gen_node p = ( p_num_gen_node )malloc( sizeof( num_gen_node ) );
+    if ( p )
+    {
+        p->start = start;
+        p->end = start + count - 1;
+        p->count = count;
+    }
+    return p;
+}
+
+
+/* helper callback to compare 2 nodes, lets VectorInsert create a sorted vector */
+static int CC num_gen_insert_helper( const void* item1, const void* item2 )
+{
+    const p_num_gen_node node1 = ( p_num_gen_node )item1;
+    const p_num_gen_node node2 = ( p_num_gen_node )item2;
+    int res = 0;
+    if ( node1->start == node2->start )
+    {
+        if ( node1->count < node2->count )
+            res = -1;
+        else if ( node1->count > node2->count )
+            res = 1;
+    }
+    else if ( node1->start < node2->start )
+        res = -1;
+    else
+        res = 1;
+    return res;
+}
+
+
+/* helper callback to create a deep and conditional copy of a node-vector */
+static void CC num_gen_copy_cb( void *item, void *data )
+{
+    p_num_gen_node node = ( p_num_gen_node )item;
+    if ( node->count > 0 )
+    {
+        Vector * dst = ( Vector *)data;
+        p_num_gen_node new_node = num_gen_make_node( node->start, node->count );
+        if ( new_node != NULL )
+            VectorInsert( dst, new_node, NULL, num_gen_insert_helper );
+    }
+}
+
+
+/* helper function that creates a deep and conditional copy of a node-vector */
+static void num_gen_copy_vector( const Vector * src, Vector * dst )
+{
+    if ( src == NULL || dst == NULL )
+        return;
+    VectorForEach ( src, false, num_gen_copy_cb, dst );    
+}
+
+
+/* helper callback to add up all count values in the vector*/
+static void CC num_gen_total_count_cb( void *item, void *data )
+{
+    p_num_gen_node node = ( p_num_gen_node )item;
+    if ( node != NULL )
+    {
+        uint64_t * total = ( uint64_t *)data;
+        if ( total != NULL )
+            *total += node->count;
+    }
+}
+
+
+/* helper function that adds up all count values in the vector*/
+static uint64_t num_gen_total_count( const Vector * src )
+{
+    uint64_t res = 0;
+    if ( src != NULL )
+        VectorForEach ( src, false, num_gen_total_count_cb, &res );
+    return res;
+}
+
+
+/* helper function for the parse-function */
+static rc_t num_gen_add_node( num_gen* self, const uint64_t from,
+                              const uint64_t to )
+{
+    p_num_gen_node node = NULL;
+    int64_t count = ( to - from );
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcInserting, rcSelf, rcNull );
+
+    if ( count >= 0 )
+        node = num_gen_make_node( from, count + 1 );
+    else
+        node = num_gen_make_node( to, -( count + 1 ) );
+    if ( node == NULL )
+        return RC( rcVDB, rcNoTarg, rcInserting, rcMemory, rcExhausted );
+    return VectorInsert( &(self->nodes), node, NULL, num_gen_insert_helper );
+}
+
+
+#define MAX_NUM_STR 12
+/* helper-structure for num_gen_parse() */
+typedef struct num_gen_parse_ctx
+{
+    uint32_t num_str_idx;
+    bool this_is_the_first_number;
+    uint64_t num1;
+    uint64_t num2;
+    char num_str[ MAX_NUM_STR + 1 ];
+} num_gen_parse_ctx;
+typedef num_gen_parse_ctx* p_num_gen_parse_ctx;
+
+
+/* helper for num_gen_parse() */
+static void num_gen_convert_ctx( p_num_gen_parse_ctx ctx )
+{
+    char *endp;
+    
+    ctx->num_str[ ctx->num_str_idx ] = 0;
+    ctx->num1 = strtou64( ctx->num_str, &endp, 10 );
+    ctx->this_is_the_first_number = false;
+    ctx->num_str_idx = 0;
+}
+
+
+/* helper for num_gen_parse() */
+static rc_t num_gen_convert_and_add_ctx( num_gen* self, p_num_gen_parse_ctx ctx )
+{
+    char *endp;
+    
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcInserting, rcSelf, rcNull );
+    if ( ctx == NULL )
+        return RC( rcVDB, rcNoTarg, rcInserting, rcParam, rcNull );
+    if ( ctx->num_str_idx == 0 )
+        return RC( rcVDB, rcNoTarg, rcInserting, rcParam, rcEmpty );
+
+    /* terminate the source-string */
+    ctx->num_str[ ctx->num_str_idx ] = 0;
+    /* convert the string into a uint64_t */
+    if ( ctx->this_is_the_first_number )
+        {
+        ctx->num1 = strtou64( ctx->num_str, &endp, 10 );
+        ctx->num2 = ctx->num1;
+        }
+    else
+        ctx->num2 = strtou64( ctx->num_str, &endp, 10 );
+    /* empty the source-string to be reused */
+    ctx->num_str_idx = 0;
+    
+    ctx->this_is_the_first_number = true;
+    return num_gen_add_node( self, ctx->num1, ctx->num2 );
+}
+
+
+/* parse the given string and insert the found ranges 
+   into the number-generator, fixes eventual overlaps */
+rc_t num_gen_parse( num_gen* self, const char* src )
+{
+    size_t i, n;
+    num_gen_parse_ctx ctx;
+    rc_t rc = 0;
+
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcParsing, rcSelf, rcNull );
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcParsing, rcParam, rcNull );
+
+    n = string_measure ( src, NULL );
+    if ( n == 0 )
+        return RC( rcVDB, rcNoTarg, rcParsing, rcParam, rcEmpty );
+
+    ctx.num_str_idx = 0;
+    ctx.this_is_the_first_number = true;
+    for ( i = 0; i < n && rc == 0; ++i )
+    {
+        switch ( src[ i ] )
+        {
+        /* a dash switches from N1-mode into N2-mode */
+        case '-' :
+            num_gen_convert_ctx( &ctx );
+            break;
+
+        /* a comma ends a single number or a range */
+        case ',' :
+            rc = num_gen_convert_and_add_ctx( self, &ctx );
+            break;
+
+        /* in both mode add the char to the temp string */
+        default:
+            if ( ( src[i]>='0' )&&( src[i]<='9' )&&( ctx.num_str_idx < MAX_NUM_STR ) )
+                ctx.num_str[ ctx.num_str_idx++ ] = src[ i ];
+            break;
+        }
+    }
+    /* dont forget to add what is left in ctx.num_str ... */
+    if ( ctx.num_str_idx > 0 )
+        rc = num_gen_convert_and_add_ctx( self, &ctx );
+    if ( rc == 0 )
+        rc = num_gen_fix_overlaps( self, NULL );
+    return rc;
+}
+
+
+/* inserts the given ranges into the number-generator,
+   fixes eventual overlaps */
+rc_t num_gen_add( num_gen* self, const uint64_t first, const uint64_t count )
+{
+    rc_t rc;
+    uint64_t num_1 = first;
+    uint64_t num_2 = first;
+
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcInserting, rcSelf, rcNull );
+
+    /* this is necessary because virtual columns which have a
+       infinite row-range, get reported with first=1,count=0 */
+    if ( count > 0 )
+        num_2 = ( first + count - 1 );
+    rc = num_gen_add_node( self, num_1, num_2 );
+    if ( rc == 0 )
+        rc = num_gen_fix_overlaps( self, NULL );
+    return rc;
+}
+
+
+/* helper function for range-check */
+static bool CC num_gen_check_range_start( p_num_gen_node the_node, 
+                                          const uint64_t range_start )
+{
+    bool res = true;
+    uint64_t last_node_row = ( the_node->start + the_node->count - 1 );
+    
+    if ( the_node->start < range_start )
+    {
+        the_node->start = range_start;
+        if ( the_node->start <= last_node_row )
+        {
+            the_node->count = ( last_node_row - the_node->start ) + 1;
+        }
+        else
+        {
+            /* the node becomes invalid ... */
+            the_node->start = 0;
+            the_node->count = 0;
+            res = false;
+        }
+    }
+    return res;
+}
+
+
+/* helper function for range-check */
+static void CC num_gen_check_range_end( p_num_gen_node the_node, 
+                             const uint64_t last_tab_row )
+{
+    uint64_t last_node_row = ( the_node->start + the_node->count - 1 );
+
+    if ( last_node_row > last_tab_row )
+    {
+        last_node_row = last_tab_row;
+        if ( the_node->start <= last_node_row )
+        {
+            the_node->count = ( last_node_row - the_node->start ) + 1;
+        }
+        else
+        {
+            /* the node becomes invalid ... */
+            the_node->start = 0;
+            the_node->count = 0;
+        }
+    }
+}
+
+
+/* helper function for range-check */
+static void CC num_gen_check_range_callback( void *item, void *data )
+{
+    p_num_gen_node the_node = ( p_num_gen_node )item;
+    p_num_gen_node the_range = ( p_num_gen_node )data;
+    uint64_t last_tab_row = ( the_range->start + the_range->count - 1 );
+
+    /* ignore invalid nodes... */
+    if ( the_node->start == 0 || the_node->count == 0 )
+        return;
+        
+    /* check if the start value is not out of range... */
+    if ( num_gen_check_range_start( the_node, the_range->start ) )
+        num_gen_check_range_end( the_node, last_tab_row );
+}
+
+
+/* helper function for range-check */
+static void CC num_gen_count_invalid_nodes( void *item, void *data )
+{
+    p_num_gen_node the_node = ( p_num_gen_node )item;
+    uint32_t *invalid_count = ( uint32_t * )data;
+    
+    if ( ( the_node->start == 0 )&&( the_node->count == 0 ) )
+        ( *invalid_count )++;
+}
+
+
+/* helper function for range-check */
+static void CC num_gen_copy_valid_nodes( void *item, void *data )
+{
+    p_num_gen_node node = ( p_num_gen_node )item;
+    Vector *dest = ( Vector * )data;
+    
+    if ( ( node->start != 0 )&&( node->count != 0 ) )
+        VectorInsert ( dest, node, NULL, num_gen_insert_helper );
+    else
+        free ( node );
+}
+
+
+/* helper function for range-check */
+static void num_gen_remove_invalid_nodes( num_gen* self )
+{
+    Vector temp_nodes;
+    uint32_t count = VectorLength( &(self->nodes) );
+    
+    if ( count < 1 )
+        return;
+    /* create a temp. vector */
+    VectorInit( &temp_nodes, 0, count );
+
+    /* copy all valid nodes into the temp. vector */
+    VectorForEach ( &(self->nodes), false,
+                    num_gen_copy_valid_nodes, &temp_nodes );
+
+    /* clear all nodes so far...,
+       DO NOT PASS num_gen_node_destroy into it */
+    VectorWhack( &(self->nodes), NULL, NULL );
+
+    /* initialize and copy (shallow) the valid nodes back
+       into the generator */
+    VectorCopy ( &temp_nodes, &(self->nodes) );
+
+    /* destroy the temp-vector,
+       DO NOT PASS num_gen_node_destroy into it */
+    VectorWhack ( &temp_nodes, NULL, NULL );
+}
+
+
+/* helper function for trim */
+rc_t num_gen_trim( num_gen* self, const int64_t first, const uint64_t count )
+{
+    num_gen_node trim_range;
+    uint32_t invalid_nodes = 0;
+
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcValidating, rcSelf, rcNull );
+    if ( count == 0 )
+        return RC( rcVDB, rcNoTarg, rcValidating, rcParam, rcNull );
+
+    /* walk all nodes to check for boundaries... */
+    trim_range.start = first;
+    trim_range.count = count;
+
+    VectorForEach ( &(self->nodes), false,
+                    num_gen_check_range_callback, &trim_range );
+
+    VectorForEach ( &(self->nodes), false,
+                    num_gen_count_invalid_nodes, &invalid_nodes );
+    if ( invalid_nodes > 0 )
+        num_gen_remove_invalid_nodes( self );
+ 
+    return 0;
+}
+
+
+rc_t num_gen_make( num_gen** self )
+{
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcConstructing, rcSelf, rcNull );
+
+    *self = calloc( 1, sizeof( num_gen ) );
+    if ( *self == NULL )
+        return RC( rcVDB, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+
+    VectorInit( &((*self)->nodes ), 0, 5 );
+    return 0;
+}
+
+
+rc_t num_gen_make_from_str( num_gen** self, const char *src )
+{
+    rc_t rc = num_gen_make( self );
+    if ( rc == 0 )
+    {
+        rc = num_gen_parse( *self, src );
+        if ( rc == 0 )
+            rc = num_gen_fix_overlaps( *self, NULL );
+     }
+     return rc;
+}
+
+
+rc_t num_gen_make_from_range( num_gen** self, 
+                              const int64_t first, const uint64_t count )
+{
+    rc_t rc = num_gen_make( self );
+    if ( rc != 0 )
+        return rc;
+    return num_gen_add( *self, first, count );
+}
+
+
+rc_t num_gen_clear( num_gen* self )
+{
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcClearing, rcSelf, rcNull );
+
+    if ( VectorLength( &(self->nodes) ) > 0 )
+    {
+        /* clear all nodes so far... */
+        VectorWhack( &(self->nodes), num_gen_node_destroy, NULL );
+
+        /* re-init the vector */
+        VectorInit( &(self->nodes ), 0, 5 );
+    }
+    return 0;
+}
+
+
+rc_t num_gen_destroy( num_gen* self )
+{
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcDestroying, rcSelf, rcNull );
+
+    VectorWhack( &(self->nodes), num_gen_node_destroy, NULL );
+    free( self );
+    return 0;
+}
+
+
+bool num_gen_empty( const num_gen* self )
+{
+    if ( self == NULL )
+        return true;
+    return ( VectorLength( &(self->nodes) ) < 1 );
+}
+
+
+typedef struct overlap_ctx
+{
+    p_num_gen_node prev;
+    uint32_t overlaps;
+} overlap_ctx;
+typedef overlap_ctx* p_overlap_ctx;
+
+
+/* static bool CC num_gen_overlap_fix_cb( void *item, void *data ) */
+static bool CC num_gen_overlap_fix_cb( void *item, void *data )
+{
+    p_num_gen_node node = ( p_num_gen_node )item;
+    p_overlap_ctx ctx = ( p_overlap_ctx )data;
+
+    /* skip invalid nodes */
+    if ( node->count ==0 || node->start == 0 || node->end == 0 )
+        return false;
+    /* if we do not have a previous node, take this one... */
+    if ( ctx->prev == NULL )
+        {
+        ctx->prev = node;
+        return false;
+        }
+    /* if we do not have an overlap,
+       take this node as prev-node and continue */
+    if ( ctx->prev->end < node->start )
+        {
+        ctx->prev = node;
+        return false;
+        }
+    /* we have a overlap, the end of the prev-node is inside
+       the current-node, we fix it by expanding the prev-node
+       to the end of this node, and later declaring this
+       node as invalid */
+    if ( ctx->prev->end < node->end )
+    {
+        ctx->prev->end = node->end;
+        ctx->prev->count = ( ctx->prev->end - ctx->prev->start ) + 1;
+    }
+    /* if the prev-node ends after this node, all we have to
+       do is declaring this node as invalid */
+    node->count = 0;
+    node->start = 0;
+    node->end = 0;
+    return true;
+}
+
+
+static rc_t num_gen_fix_overlaps( num_gen* self, uint32_t *count )
+{
+    overlap_ctx ctx;
+    bool fix_executed = false;
+    
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcReading, rcSelf, rcNull );
+    
+    ctx.overlaps = 0;
+    do
+    {
+        ctx.prev = NULL;
+        fix_executed = VectorDoUntil ( &(self->nodes), false, 
+                                       num_gen_overlap_fix_cb, &ctx );
+    } while ( fix_executed );
+
+    if ( count )
+        *count = ctx.overlaps;
+    return 0;
+}
+
+
+typedef struct string_ctx
+{
+    char *s;
+    uint32_t len;
+} string_ctx;
+typedef string_ctx* p_string_ctx;
+
+
+static void string_ctx_add( p_string_ctx ctx, char *s )
+{
+    uint32_t len = string_measure ( s, NULL );
+    if ( len > 0 )
+    {
+        if ( ctx->len == 0 )
+            ctx->s = malloc( len + 1 );
+        else
+            ctx->s = realloc( ctx->s, ctx->len + len );
+        memcpy( &(ctx->s[ctx->len]), s, len );
+        ctx->len += len;
+    }
+}
+
+
+static void CC num_gen_as_string_cb( void *item, void *data )
+{
+    char temp[40];
+    p_num_gen_node node = ( p_num_gen_node )item;
+    long unsigned int start = node->start;
+    long unsigned int end = ( start + node->count - 1 );
+    switch( node->count )
+    {
+    case 0 : temp[ 0 ] = 0;
+             break;
+    case 1 : string_printf ( temp, sizeof temp, NULL, "%lu,", start );
+             break;
+    default: string_printf ( temp, sizeof temp, NULL, "%lu-%lu,", start, end );
+             break;
+    }
+    string_ctx_add( ( p_string_ctx )data, temp );
+}
+
+
+rc_t num_gen_as_string( const num_gen* self, char **s )
+{
+    string_ctx ctx;
+    
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcReading, rcSelf, rcNull );
+    if ( s == NULL )
+        return RC( rcVDB, rcNoTarg, rcReading, rcParam, rcNull );
+
+    ctx.s = NULL;
+    ctx.len = 0;
+    VectorForEach ( &(self->nodes), false, num_gen_as_string_cb, &ctx );
+    if ( ctx.len == 0 )
+    {
+        *s = NULL;
+        return RC( rcVDB, rcNoTarg, rcReading, rcData, rcEmpty );
+    }
+    ctx.s[ ctx.len ] = 0;
+    *s = ctx.s;
+    return 0;
+}
+
+
+static void CC num_gen_debug_cb( void *item, void *data )
+{
+    char temp[40];
+    p_num_gen_node node = ( p_num_gen_node )item;
+    long unsigned int start = node->start;
+    long unsigned int count = node->count;
+    string_printf ( temp, sizeof temp, NULL, "[s:%lu c:%lu]", start, count );
+    string_ctx_add( ( p_string_ctx )data, temp );
+}
+
+
+rc_t num_gen_debug( const num_gen* self, char **s )
+{
+    string_ctx ctx;
+    
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcReading, rcSelf, rcNull );
+    if ( s == NULL )
+        return RC( rcVDB, rcNoTarg, rcReading, rcParam, rcNull );
+
+    ctx.s = NULL;
+    ctx.len = 0;
+    VectorForEach ( &(self->nodes), false, num_gen_debug_cb, &ctx );
+    if ( ctx.len == 0 )
+    {
+        *s = NULL;
+        return RC( rcVDB, rcNoTarg, rcReading, rcData, rcEmpty );
+    }
+    ctx.s[ ctx.len ] = 0;
+    *s = ctx.s;
+    return 0;
+}
+
+
+static bool CC num_gen_contains_cb( void *item, void *data )
+{
+    bool res = false;
+    p_num_gen_node node = ( p_num_gen_node )item;
+    if ( node->count > 0 )
+    {
+        uint64_t *value = ( uint64_t * )data;
+        uint64_t end = node->start + node->count - 1;
+        res = ( node->start <= *value && *value <= end );
+    }
+    return res;
+}
+
+
+rc_t num_gen_contains_value( const num_gen* self, const uint64_t value )
+{
+    uint64_t temp = value;
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcReading, rcSelf, rcNull );
+    if ( VectorDoUntil ( &(self->nodes), false, 
+                         num_gen_contains_cb, &temp ) )
+        return 0;
+    else
+        return RC( rcVDB, rcNoTarg, rcReading, rcData, rcEmpty );
+}
+
+
+rc_t num_gen_range_check( num_gen* self, 
+                          const int64_t first, const uint64_t count )
+{
+    /* if the user did not specify a row-range, take all rows */
+    if ( num_gen_empty( self ) )
+        return num_gen_add( self, first, count );
+    /* if the user did specify a row-range, check the boundaries */
+    else
+        return num_gen_trim( self, first, count );
+}
+
+
+rc_t num_gen_iterator_make( const num_gen* self, const num_gen_iter **iter )
+{
+    uint32_t count;
+    
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcReading, rcSelf, rcNull );
+    if ( iter == NULL )
+        return RC( rcVDB, rcNoTarg, rcReading, rcParam, rcNull );
+
+    *iter = NULL;
+    count = VectorLength( &(self->nodes) );
+    if ( count < 1 )
+        return RC( rcVDB, rcNoTarg, rcReading, rcParam, rcNull );
+    else
+    {
+        num_gen_iter *temp = calloc( 1, sizeof( num_gen_iter ) );
+        if ( temp == NULL )
+            return RC( rcVDB, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+        VectorInit( &(temp->nodes), 0, count );
+        num_gen_copy_vector( &(self->nodes), &(temp->nodes ) );
+        temp->total = num_gen_total_count( &(temp->nodes ) );
+        *iter = temp;
+    }
+    return 0;
+}
+
+rc_t num_gen_iterator_destroy( const num_gen_iter *self )
+{
+    num_gen_iter *temp;
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcDestroying, rcSelf, rcNull );
+
+    temp = (num_gen_iter *)self;
+    VectorWhack( &(temp->nodes), num_gen_node_destroy, NULL );
+    free( temp );
+    return 0;
+}
+
+rc_t num_gen_iterator_next( const num_gen_iter* self, uint64_t* value )
+{
+    num_gen_iter* temp;
+    p_num_gen_node node;
+    
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcReading, rcSelf, rcNull );
+    if ( value == NULL )
+        return RC( rcVDB, rcNoTarg, rcReading, rcParam, rcNull );
+    if ( self->curr_node >= VectorLength( &(self->nodes) ) )
+        return RC( rcVDB, rcNoTarg, rcReading, rcId, rcInvalid );
+
+    temp = ( num_gen_iter *)self;
+    *value = 0;
+    node = (p_num_gen_node)VectorGet( &(temp->nodes), temp->curr_node );
+    if ( node == NULL )
+        return RC( rcVDB, rcNoTarg, rcReading, rcItem, rcInvalid );
+
+    *value = node->start;
+    if ( node->count < 2 )
+        /* the node is a single-number-node, next node for next time */
+        temp->curr_node++;
+    else
+    {
+        /* the node is a number range, add the sub-position */
+        *value += temp->curr_node_sub_pos++;
+        /* if the sub-positions are use up, switch to next node */
+        if ( temp->curr_node_sub_pos >= node->count )
+        {
+            temp->curr_node++;
+            temp->curr_node_sub_pos = 0;
+        }
+    }
+    (temp->progress)++;
+    return 0;
+}
+
+
+rc_t num_gen_iterator_count( const num_gen_iter* self, uint64_t* count )
+{
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcReading, rcSelf, rcNull );
+    if ( count == NULL )
+        return RC( rcVDB, rcNoTarg, rcReading, rcParam, rcNull );
+    *count = self->total;
+    return 0;
+}
+
+
+rc_t num_gen_iterator_percent( const num_gen_iter* self, 
+                               const uint8_t fract_digits,
+                               uint32_t* value )
+{
+    uint32_t factor = 100;
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcReading, rcSelf, rcNull );
+    if ( value == NULL )
+        return RC( rcVDB, rcNoTarg, rcReading, rcParam, rcNull );
+    if ( fract_digits > 0 )
+    {
+        if ( fract_digits > 1 )
+            factor = 10000;
+        else
+            factor = 1000;
+    }
+        
+    if ( self->total > 0 )
+    {
+        if ( self->progress >= self->total )
+            *value = factor;
+        else
+        {
+            uint64_t temp = self->progress;
+            temp *= factor;
+            temp /= self->total;
+            *value = (uint16_t) temp;
+        }
+    }
+    else
+        *value = 0;
+    return 0;
+}
diff --git a/tools/cg-dump/num-gen.h b/tools/cg-dump/num-gen.h
new file mode 100644
index 0000000..5b0324f
--- /dev/null
+++ b/tools/cg-dump/num-gen.h
@@ -0,0 +1,225 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_num_gen_
+#define _h_num_gen_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _h_klib_vector_
+#include <klib/vector.h>
+#endif
+
+#ifndef _h_klib_rc_
+#include <klib/rc.h>
+#endif
+
+#ifndef _h_klib_text_
+#include <klib/text.h>
+#endif
+
+
+/*--------------------------------------------------------------------------
+ * A NUMBER GENERATOR
+ * 
+ *  input : string, for instance "3,6,8,12,44-49"
+ *  ouptut: sequence of integers, for instance 3,6,8,12,44,45,46,47,48,49
+ */
+
+
+/*--------------------------------------------------------------------------
+ * opaque number-generator and it's iterator
+ */
+typedef struct num_gen num_gen;
+typedef struct num_gen_iter num_gen_iter;
+
+
+/*--------------------------------------------------------------------------
+ * num_gen_make
+ *
+ *  creates a empty number-generator
+ *  or creates a number-generator and parses the string
+ *  or creates and presets it with a range
+ */
+rc_t num_gen_make( num_gen** self );
+rc_t num_gen_make_from_str( num_gen** self, const char *src );
+rc_t num_gen_make_from_range( num_gen** self, 
+                              const int64_t first, const uint64_t count );
+
+
+/*--------------------------------------------------------------------------
+ * num_gen_destroy
+ *
+ *  destroys a number-generator
+ */
+rc_t num_gen_destroy( num_gen* self );
+
+
+/*--------------------------------------------------------------------------
+ * num_gen_clear
+ *
+ *  resets a number-generator, to be empty just like after num_gen_make()
+ */
+rc_t num_gen_clear( num_gen* self );
+
+
+/*--------------------------------------------------------------------------
+ * num_gen_parse
+ *
+ *  parses a given string in this form: "3,6,8,12,44-49"
+ *  does not clear the number-generator before parsing
+ *  eventual overlaps with the previous content are consolidated
+ */
+rc_t num_gen_parse( num_gen* self, const char* src );
+
+
+/*--------------------------------------------------------------------------
+ * num_gen_add
+ *
+ *  inserts the given interval into the number-generator
+ *
+ *  num_gen_add( *g, 10, 30 )
+ *  is equivalent to:
+ *  num_gen_parse( *g, "10-39" );
+ *
+ *  eventual overlaps with the previous content are consolidated 
+ */
+rc_t num_gen_add( num_gen* self, const uint64_t first, const uint64_t count );
+
+
+/*--------------------------------------------------------------------------
+ * num_gen_trim
+ *
+ *  checks if the content of the number-generator is inside the given interval
+ *  removes or shortens internal nodes if necessary
+ */
+rc_t num_gen_trim( num_gen* self, const int64_t first, const uint64_t count );
+
+
+/*--------------------------------------------------------------------------
+ * num_gen_empty
+ *
+ *  checks if the generator has no ranges defined
+ */
+bool num_gen_empty( const num_gen* self );
+
+
+/*--------------------------------------------------------------------------
+ * num_gen_as_string
+ *
+ *  allocates a string that contains the generator as text
+ *  *s = "1-5,20,24-25"
+ *  caller has to free the string
+ */
+rc_t num_gen_as_string( const num_gen* self, char **s );
+
+
+/*--------------------------------------------------------------------------
+ * num_gen_debug
+ *
+ *  allocates a string that contains the internal intervals as text
+ *  *s = "[s:1 c:5][s:20 c:1][s:24 c:2]"
+ *  [s...start-value c:count]
+ *  caller has to free the string 
+ */
+rc_t num_gen_debug( const num_gen* self, char **s );
+
+
+/*--------------------------------------------------------------------------
+ * num_gen_contains_value
+ *
+ *  checks if the generator contains the given value
+ */
+rc_t num_gen_contains_value( const num_gen* self, const uint64_t value );
+
+
+/*--------------------------------------------------------------------------
+ * num_gen_range_check
+ *
+ *  if the generator is empty --> set it to the given range
+ *  if it is not empty ---------> trim it to the given range
+ */
+rc_t num_gen_range_check( num_gen* self, 
+                          const int64_t first, const uint64_t count );
+
+/*--------------------------------------------------------------------------
+ * num_gen_iterator_make
+ *
+ *  creates a iterator from the number-generator
+ *  the iterator contains a constant copy of the number-ranges
+ *  after this call it is safe to destroy or change the number-generator
+ *  returns an error-code if the number-generator was empty,
+ *  and *iter will be NULL
+ */
+rc_t num_gen_iterator_make( const num_gen* self, const num_gen_iter **iter );
+
+
+/*--------------------------------------------------------------------------
+ * num_gen_iterator_destroy
+ *
+ *  destroys the iterator
+ */
+rc_t num_gen_iterator_destroy( const num_gen_iter *self );
+
+
+/*--------------------------------------------------------------------------
+ * num_gen_iterator_count
+ *
+ *  returns how many values the iterator contains
+ */
+rc_t num_gen_iterator_count( const num_gen_iter* self, uint64_t* count );
+
+
+/*--------------------------------------------------------------------------
+ * num_gen_iterator_next
+ *
+ *  pulls the next value out of the iterator...
+ *  returns an error-code if the iterator has no more values
+ */
+rc_t num_gen_iterator_next( const num_gen_iter* self, uint64_t* value );
+
+
+/*--------------------------------------------------------------------------
+ * num_gen_iterator_percent
+ *
+ *  return in value the percentage of the iterator...
+ *  depending on fract-digits the percentage will be:
+ *      fract_digits = 0 ... full percent's
+ *      fract_digits = 1 ... 1/10-th of a percent
+ *      fract_digits = 2 ... 1/100-th of a percent
+ */
+rc_t num_gen_iterator_percent( const num_gen_iter* self,
+                               const uint8_t fract_digits,
+                               uint32_t* value );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/cg-dump/progressbar.c b/tools/cg-dump/progressbar.c
new file mode 100644
index 0000000..973f54d
--- /dev/null
+++ b/tools/cg-dump/progressbar.c
@@ -0,0 +1,140 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <klib/rc.h>
+#include <klib/out.h>
+
+#include <os-native.h>
+#include <sysalloc.h>
+#include <stdlib.h>
+
+typedef struct progressbar
+{
+    bool initialized;
+    uint16_t percent;
+} progressbar;
+
+
+rc_t make_progressbar( progressbar ** pb )
+{
+    if ( pb == NULL )
+        return RC( rcVDB, rcNoTarg, rcConstructing, rcSelf, rcNull );
+    (*pb) = calloc( 1, sizeof( progressbar ) );
+    if ( *pb == NULL )
+        return RC( rcVDB, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+    return 0;
+}
+
+
+rc_t destroy_progressbar( progressbar * pb )
+{
+    if ( pb == NULL )
+        return RC( rcVDB, rcNoTarg, rcDestroying, rcSelf, rcNull );
+    free( pb );
+    return 0;
+}
+
+static void progess_0a( const uint16_t percent )
+{
+    KOutMsg( "| %2u%%", percent );
+}
+
+static void progess_0( const uint16_t percent )
+{
+    if ( percent & 1 )
+        KOutMsg( "\b\b\b\b- %2u%%", percent );
+    else
+        KOutMsg( "\b\b\b%2u%%", percent );
+}
+
+static void progess_1a( const uint16_t percent )
+{
+    uint16_t p1 = percent / 10;
+    uint16_t p0 = percent - ( p1 * 10 );
+    KOutMsg( "| %2u.%01u%%", p1, p0 );
+}
+
+static void progess_1( const uint16_t percent )
+{
+    uint16_t p1 = percent / 10;
+    uint16_t p0 = percent - ( p1 * 10 );
+    if ( ( p1 & 1 )&&( p0 == 0 ) )
+        KOutMsg( "\b\b\b\b\b\b- %2u.%01u%%", p1, p0 );
+    else
+        KOutMsg( "\b\b\b\b\b%2u.%01u%%", p1, p0 );
+}
+
+static void progess_2a( const uint16_t percent )
+{
+    uint16_t p1 = percent / 100;
+    uint16_t p0 = percent - ( p1 * 100 );
+    KOutMsg( "| %2u.%02u%%", p1, p0 );
+}
+
+static void progess_2( const uint16_t percent )
+{
+    uint16_t p1 = percent / 100;
+    uint16_t p0 = percent - ( p1 * 100 );
+    if ( ( p1 & 1 )&&( p0 == 0 ) )
+        KOutMsg( "\b\b\b\b\b\b\b- %2u.%02u%%", p1, p0 );
+    else
+        KOutMsg( "\b\b\b\b\b\b%2u.%02u%%", p1, p0 );
+}
+
+rc_t update_progressbar( progressbar * pb, const uint8_t fract_digits,
+                         const uint16_t percent )
+{
+    uint8_t digits = fract_digits;
+    if ( pb == NULL )
+        return RC( rcVDB, rcNoTarg, rcParsing, rcSelf, rcNull );
+    if ( digits > 2 )
+        digits = 2;
+    if ( pb->initialized )
+    {
+        if ( pb->percent != percent )
+        {
+            pb->percent = percent;
+            switch( digits )
+            {
+            case 0 : progess_0( percent ); break;
+            case 1 : progess_1( percent ); break;
+            case 2 : progess_2( percent ); break;
+            }
+        }
+    }
+    else
+    {
+        pb->percent = percent;
+        switch( digits )
+        {
+        case 0 : progess_0a( percent ); break;
+        case 1 : progess_1a( percent ); break;
+        case 2 : progess_2a( percent ); break;
+        }
+        pb->initialized = true;
+    }
+    return 0;
+}
diff --git a/tools/cg-dump/progressbar.h b/tools/cg-dump/progressbar.h
new file mode 100644
index 0000000..f8bef61
--- /dev/null
+++ b/tools/cg-dump/progressbar.h
@@ -0,0 +1,70 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_progressbar_
+#define _h_progressbar_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct progressbar progressbar;
+
+/*--------------------------------------------------------------------------
+ * make_progressbar
+ *
+ *  creates a progressbar with zero-values inside
+ *  does not output anything
+ */
+rc_t make_progressbar( progressbar ** pb );
+
+
+/*--------------------------------------------------------------------------
+ * destroy_progressbar
+ *
+ *  destroy's the progressbar
+ *  does not output anything
+ */
+rc_t destroy_progressbar( progressbar * pb );
+
+
+/*--------------------------------------------------------------------------
+ * update_progressbar
+ *
+ *  sets the progressbar to a specific percentage
+ *  outputs only if the percentage has changed from the last call
+ *  the precentage is in 1/10-th of a percent ( 21,6% = 216 )
+ *  expects the percents in increasing order ( does not jump back )
+ *  writes a growing bar made from '-'-chars every 2nd percent
+ */
+rc_t update_progressbar( progressbar * pb, const uint8_t fract_digits,
+                         const uint16_t percent );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/cg-dump/sg_lookup.c b/tools/cg-dump/sg_lookup.c
new file mode 100644
index 0000000..431bdcc
--- /dev/null
+++ b/tools/cg-dump/sg_lookup.c
@@ -0,0 +1,277 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <os-native.h>
+#include <sysalloc.h>
+
+#include "sg_lookup.h"
+#include "line_token_iter.h"
+#include <klib/log.h>
+#include <klib/out.h>
+#include <kdb/meta.h>
+
+#include <stdlib.h>
+
+
+typedef struct sg_lookup
+{
+    BSTree spotgroups;
+    const char * buffer;
+    size_t buflen;
+} sg_lookup;
+
+
+rc_t make_sg_lookup( struct sg_lookup ** self )
+{
+    rc_t rc = 0;
+
+    if ( self == NULL )
+        rc = RC( rcVDB, rcNoTarg, rcConstructing, rcSelf, rcNull );
+    else
+    {
+        (*self) = calloc( 1, sizeof( sg_lookup ) );
+        if ( *self == NULL )
+            rc = RC( rcVDB, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+    }
+    return rc;
+}
+
+
+static int CC String_sg_cmp ( const void * item, const BSTNode * n )
+{
+    const String * name = ( const String * ) item;
+    const sg * sg_item = ( const sg * ) n;
+    return StringCompare ( &sg_item->name, name );
+}
+
+
+static int CC sg_sg_cmp ( const BSTNode * item, const BSTNode * n )
+{
+    const sg * sg1 = ( const sg * ) item;
+    const sg * sg2 = ( const sg * ) n;
+    return StringCompare ( &sg2->name, &sg1->name );
+}
+
+
+static sg * find_entry( struct sg_lookup * self, const String * name )
+{
+    return ( sg * )BSTreeFind ( &self->spotgroups, ( void * )name, String_sg_cmp );
+}
+
+
+static rc_t make_sg( String * name, String * field_size, String * lib, String * sample, sg ** entry )
+{
+    rc_t rc = 0;
+    ( *entry ) = malloc( sizeof ** entry );
+    if ( *entry == NULL )
+    {
+        rc = RC( rcExe, rcDatabase, rcReading, rcMemory, rcExhausted );
+        (void)LOGERR( klogErr, rc, "memory exhausted when creating new spotgroup-lookup-entry" );
+    }
+    else
+    {
+        StringInit( ( String * )&( *entry )->name, name->addr, name->size, name->len );
+        StringInit( ( String * )&( *entry )->field_size, field_size->addr, field_size->size, field_size->len );
+        StringInit( ( String * )&( *entry )->lib, lib->addr, lib->size, lib->len );
+        StringInit( ( String * )&( *entry )->sample, sample->addr, sample->size, sample->len );
+    }
+    return rc;
+}
+
+
+static rc_t parse_buffer( struct sg_lookup * self )
+{
+    struct buf_line_iter bli;
+    bool valid = true;
+    rc_t rc = buf_line_iter_init( &bli, self->buffer, self->buflen );
+    while ( ( rc == 0 ) && valid )
+    {
+        String line;
+        uint32_t line_nr;
+        rc = buf_line_iter_get( &bli, &line, &valid, &line_nr );
+        if ( rc == 0 && valid )
+        {
+            token_iter ti;
+            bool ti_valid = true;
+            String name, field_size, lib, sample;
+
+            StringInit( &name, NULL, 0, 0 );
+            StringInit( &field_size, NULL, 0, 0 );
+            StringInit( &lib, NULL, 0, 0 );
+            StringInit( &sample, NULL, 0, 0 );
+
+            rc = token_iter_init( &ti, &line, '\t' );
+            while ( ( rc == 0 ) && ti_valid )
+            {
+                String token;
+                uint32_t token_nr;
+                rc = token_iter_get( &ti, &token, &ti_valid, &token_nr );
+                if ( rc == 0 && ti_valid )
+                {
+                    if ( token_nr == 0 && ( string_cmp( token.addr, token.len, "@RG", 3, 3 ) != 0 ) )
+                        ti_valid = false;
+                    else
+                    {
+                        token_iter sub_ti;
+                        String *value_dst = NULL;
+                        bool sub_ti_valid = true;
+                        rc = token_iter_init( &sub_ti, &token, ':' );
+                        while ( ( rc == 0 ) && sub_ti_valid )
+                        {
+                            String sub_token;
+                            uint32_t sub_token_nr;
+                            rc = token_iter_get( &sub_ti, &sub_token, &sub_ti_valid, &sub_token_nr );
+                            if ( rc == 0 && sub_ti_valid )
+                            {
+                                if ( sub_token_nr == 0 )
+                                {
+                                    if ( string_cmp( sub_token.addr, sub_token.len, "ID", 2, 2 ) == 0 )
+                                        value_dst = &name;
+                                    else if ( string_cmp( sub_token.addr, sub_token.len, "DS", 2, 2 ) == 0 )
+                                        value_dst = &field_size;
+                                    else if ( string_cmp( sub_token.addr, sub_token.len, "LB", 2, 2 ) == 0 )
+                                        value_dst = &lib;
+                                    else if ( string_cmp( sub_token.addr, sub_token.len, "SM", 2, 2 ) == 0 )
+                                        value_dst = &sample;
+                                }
+                                else if ( sub_token_nr == 1 )
+                                {
+                                    if ( value_dst != NULL )
+                                        StringInit( value_dst, sub_token.addr, sub_token.size, sub_token.len );
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+
+            if ( name.addr != NULL && field_size.addr != NULL &&
+                 lib.addr != NULL && sample.addr != NULL )
+            {
+                sg * entry = find_entry( self, &name );
+                /* KOutMsg( "entry: name='%S' fs='%S' lib='%S' sample='%S'\n", &name, &field_size, &lib, &sample ); */
+                if ( entry == NULL )
+                {
+                    rc = make_sg( &name, &field_size, &lib, &sample, &entry );
+                    if ( rc == 0 )
+                    {
+                        rc = BSTreeInsert ( &self->spotgroups, ( BSTNode * )entry, sg_sg_cmp );
+                        if ( rc != 0 )
+                        {
+                            (void)LOGERR( klogErr, rc, "cannot insert new spotgroup" );
+                            free( entry );
+                        }
+                    }
+                }
+                else
+                {
+                    /* so far we ignore it if we find the same spotgroup-name twice in the meta-data */
+                }
+            }
+        }
+    }
+    return rc;
+}
+
+
+rc_t parse_sg_lookup( struct sg_lookup * self, const VDatabase * db )
+{
+    rc_t rc = 0;
+    if ( self == NULL )
+        rc = RC( rcVDB, rcNoTarg, rcConstructing, rcSelf, rcNull );
+    else
+    {
+        const KMetadata *meta;
+        rc_t rc = VDatabaseOpenMetadataRead ( db, &meta );
+        if ( rc != 0 )
+        {
+            (void)LOGERR( klogErr, rc, "cannot open metdata on database" );
+        }
+        else
+        {
+            const KMDataNode *node;
+            rc_t rc1 = KMetadataOpenNodeRead ( meta, &node, "BAM_HEADER" );
+            if ( rc1 == 0 )
+            {
+                size_t num_read;
+                /* explore how much data we must read... */
+                rc = KMDataNodeRead ( node, 0, NULL, 0, &num_read, &self->buflen );
+                if ( rc == 0 )
+                {
+                    if ( self->buffer != NULL )
+                        free( (void *)self->buffer );
+
+                    self->buffer = malloc( self->buflen + 1 );
+                    if ( self->buffer != NULL )
+                    {
+                        size_t num_read2;
+                        rc = KMDataNodeReadCString ( node, (char *)self->buffer, self->buflen + 1, &num_read2 );
+                        if ( rc == 0 )
+                            rc = parse_buffer( self );
+                    }
+                }
+                KMDataNodeRelease ( node );
+            }
+            KMetadataRelease ( meta );
+        }
+    }
+    return rc;
+}
+
+
+rc_t perform_sg_lookup( struct sg_lookup * self, const String * name, sg ** entry )
+{
+    rc_t rc = 0;
+    if ( self == NULL )
+        rc = RC( rcVDB, rcNoTarg, rcConstructing, rcSelf, rcNull );
+    else
+    {
+        ( *entry ) = find_entry( self, name );
+    }
+    return rc;
+}
+
+
+static void CC whack_spotgroup( BSTNode *n, void *data )
+{
+    free( ( void * )n );
+}
+
+
+rc_t destroy_sg_lookup( struct sg_lookup * self )
+{
+    rc_t rc = 0;
+
+    if ( self == NULL )
+        rc = RC( rcVDB, rcNoTarg, rcDestroying, rcSelf, rcNull );
+    else
+    {
+        BSTreeWhack ( &self->spotgroups, whack_spotgroup, NULL );
+        free( (void *)self->buffer );
+        free( self );
+    }
+    return rc;
+}
diff --git a/tools/cg-dump/sg_lookup.h b/tools/cg-dump/sg_lookup.h
new file mode 100644
index 0000000..8191c10
--- /dev/null
+++ b/tools/cg-dump/sg_lookup.h
@@ -0,0 +1,65 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+#ifndef _h_sg_lookup_
+#define _h_sg_lookup_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <klib/rc.h>
+#include <klib/text.h>
+#include <klib/container.h>
+
+#include <vdb/database.h>
+
+struct sg_lookup;
+
+typedef struct sg
+{
+    BSTNode node;
+
+    const String name;
+    const String field_size;
+    const String lib;
+    const String sample;
+} sg;
+
+
+rc_t make_sg_lookup( struct sg_lookup ** self );
+
+rc_t parse_sg_lookup( struct sg_lookup * self, const VDatabase * db );
+
+rc_t perform_sg_lookup( struct sg_lookup * self, const String * name, sg ** entry );
+
+rc_t destroy_sg_lookup( struct sg_lookup * self );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/cg-load/.gitignore b/tools/cg-load/.gitignore
new file mode 100644
index 0000000..718f861
--- /dev/null
+++ b/tools/cg-load/.gitignore
@@ -0,0 +1,2 @@
+*.vers.h
+*.sh
diff --git a/tools/cg-load/Makefile b/tools/cg-load/Makefile
index 38038fa..7713925 100644
--- a/tools/cg-load/Makefile
+++ b/tools/cg-load/Makefile
@@ -25,7 +25,7 @@
 
 default: std
 
-TOP ?= $(shell ../../build/abspath.sh ../..)
+TOP ?= $(abspath ../..)
 MODULE = tools/cg-load
 
 include $(TOP)/build/Makefile.env
@@ -99,9 +99,9 @@ CGLOAD_OBJ = \
 CGLOAD_LIB = \
 	-lkapp \
 	-lload \
-	-lncbi-wvdb \
-	-lxml2 \
+	-sncbi-wvdb \
 	-lm
 
 $(BINDIR)/cg-load: $(CGLOAD_OBJ)
 	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(CGLOAD_LIB)
+
diff --git a/tools/cg-load/cg-load.c b/tools/cg-load/cg-load.c
index 19eac93..378a888 100644
--- a/tools/cg-load/cg-load.c
+++ b/tools/cg-load/cg-load.c
@@ -121,7 +121,7 @@ rc_t DB_Init(const SParam* p, DB_Handle* h)
         LOGERR(klogErr, rc, "failed to create schema");
 
     }
-    else if( (rc = VSchemaParseFile(h->schema, p->schema)) != 0 ) {
+    else if( (rc = VSchemaParseFile(h->schema, "%s", p->schema)) != 0 ) {
         PLOGERR(klogErr, (klogErr, rc, "failed to parse schema file '$(schema)'", PLOG_S(schema), p->schema));
 
     }
@@ -222,7 +222,7 @@ rc_t DB_Fini(const SParam* p, DB_Handle* h, bool drop)
         VSchemaRelease(h->schema);
         h->schema = NULL;
         if( drop || rc != 0 ) {
-            rc2 = VDBManagerDrop(h->mgr, kptDatabase, p->out);
+            rc2 = VDBManagerDrop(h->mgr, kptDatabase, "%s", p->out);
             if( GetRCState(rc2) == rcNotFound ) {
                 /* WHAT WOULD BE THE POINT OF RESETTING "rc" TO ZERO? */
                 rc = 0;
@@ -515,7 +515,7 @@ rc_t CC DirVisitor(const KDirectory *dir, uint32_t type, const char *name, void
             char buf[4096];
             const CGLoaderFile* file = NULL;
             FGroupKey key;
-            if( (rc = KDirectoryResolvePath(dir, true, buf, sizeof(buf), name)) == 0 &&
+            if( (rc = KDirectoryResolvePath(dir, true, buf, sizeof(buf), "%s", name)) == 0 &&
                 (rc = CGLoaderFile_Make(&file, d->dir, buf, NULL, !d->param->no_read_ahead)) == 0 &&
                 (rc = FGroupKey_Make(&key, file, d->param)) == 0 ) {
 
@@ -573,7 +573,7 @@ static bool _FGroupMAPDone(FGroupMAP *self, TCtx ctx, FGroupMAP_LoadData* d) {
     bool eofMapping = true;
     assert(self && d);
     if (d->rc == 0 ||
-        GetRCState(d->rc) != rcDone || GetRCObject(d->rc) != rcData)
+        GetRCState(d->rc) != rcDone || GetRCObject(d->rc) != (enum RCObject)rcData)
     {
         return false;
     }
@@ -705,7 +705,7 @@ bool CC FGroupMAP_LoadEvidence( BSTNode *node, void *data )
                 d->rc = CGWriterEvdDnbs_Write(d->db.wev_dnb, d->db.ev_int, evint_rowid);
             }
         }
-        if( GetRCState(d->rc) == rcDone && GetRCObject(d->rc) == rcData ) {
+        if( GetRCState(d->rc) == rcDone && GetRCObject(d->rc) == (enum RCObject)rcData ) {
             bool eof = false;
             d->rc = 0;
             if( n->align == NULL || ((d->rc = CGLoaderFile_IsEof(n->align, &eof)) == 0 && eof) ) {
@@ -755,10 +755,10 @@ static rc_t copy_library( const KDirectory * src_dir, KDirectory * dst_dir,
 static rc_t open_dir_or_tar( const KDirectory *dir, const KDirectory **sub, const char * name )
 {
     rc_t rc1, rc2;
-    rc1 = KDirectoryOpenDirRead( dir, sub, true, name );
+    rc1 = KDirectoryOpenDirRead( dir, sub, true, "%s", name );
     if ( rc1 != 0 )
     {
-        rc2 = KDirectoryOpenTarArchiveRead( dir, sub, true, name );
+        rc2 = KDirectoryOpenTarArchiveRead( dir, sub, true, "%s", name );
         if ( rc2 == 0 )
             rc1 = rc2;
     }
diff --git a/tools/cg-load/cg-load.vers b/tools/cg-load/cg-load.vers
index cc6c9a4..8e8299d 100644
--- a/tools/cg-load/cg-load.vers
+++ b/tools/cg-load/cg-load.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/cg-load/factory-tag-lfr.c b/tools/cg-load/factory-tag-lfr.c
new file mode 100644
index 0000000..2586571
--- /dev/null
+++ b/tools/cg-load/factory-tag-lfr.c
@@ -0,0 +1,261 @@
+/*==============================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*/
+#include <klib/log.h>
+#include <klib/rc.h>
+#include <klib/printf.h>
+
+typedef struct CGTagLfr CGTagLfr;
+#define CGFILETYPE_IMPL CGTagLfr
+#include "file.h"
+#include "factory-cmn.h"
+#include "factory-tag-lfr.h"
+#include "debug.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <os-native.h>
+
+struct CGTagLfr {
+    CGFileType dad;
+    const CGLoaderFile* file;
+    int64_t start_rowid;
+    char spot_group[512];
+    uint64_t records;
+    /* headers */
+    CGFIELD15_ASSEMBLY_ID assembly_id;
+    CGFIELD15_BATCH_FILE_NUMBER batch_file_number;
+    CGFIELD15_BATCH_OFFSET batch_offset;
+    CGFIELD15_FIELD_SIZE field_size;
+    CGFIELD15_GENERATED_AT generated_at;
+    CGFIELD15_GENERATED_BY generated_by;
+    CGFIELD15_LANE lane;
+    CGFIELD15_LIBRARY library;
+    CGFIELD15_SAMPLE sample;
+    CGFIELD15_SLIDE slide;
+    CGFIELD15_SOFTWARE_VERSION software_version;
+    CGFIELD_WELL_ID wellId;
+};
+
+static
+rc_t CC CGTagLfr_Header(const CGTagLfr* cself, const char* buf, const size_t len)
+{
+    rc_t rc = 0;
+    size_t slen;
+    CGTagLfr* self = (CGTagLfr*)cself;
+
+    if( strncmp("ASSEMBLY_ID\t", buf, slen = 12) == 0 ) {
+        rc = str2buf(&buf[slen], len - slen, self->assembly_id, sizeof(self->assembly_id));
+    } else if( strncmp("BATCH_FILE_NUMBER\t", buf, slen = 18) == 0 ) {
+        rc = str2u32(&buf[slen], len - slen, &self->batch_file_number);
+        if( self->batch_file_number < 1 ) {
+            rc = RC(rcRuntime, rcFile, rcConstructing, rcItem, rcOutofrange);
+        }
+    } else if( strncmp("BATCH_OFFSET\t", buf, slen = 13) == 0 ) {
+        rc = str2u64(&buf[slen], len - slen, &self->batch_offset);
+    } else if( strncmp("FIELD_SIZE\t", buf, slen = 11) == 0 ) {
+        rc = str2u32(&buf[slen], len - slen, &self->field_size);
+    } else if( strncmp("GENERATED_AT\t", buf, slen = 13) == 0 ) {
+        rc = str2buf(&buf[slen], len - slen, self->generated_at, sizeof(self->generated_at));
+    } else if( strncmp("GENERATED_BY\t", buf, slen = 13) == 0 ) {
+        rc = str2buf(&buf[slen], len - slen, self->generated_by, sizeof(self->generated_by));
+    } else if( strncmp("LANE\t", buf, slen = 5) == 0 ) {
+        rc = str2buf(&buf[slen], len - slen, self->lane, sizeof(self->lane));
+    } else if( strncmp("LIBRARY\t", buf, slen = 8) == 0 ) {
+        rc = str2buf(&buf[slen], len - slen, self->library, sizeof(self->library));
+    } else if( strncmp("SAMPLE\t", buf, slen = 7) == 0 ) {
+        rc = str2buf(&buf[slen], len - slen, self->sample, sizeof(self->sample));
+    } else if( strncmp("SLIDE\t", buf, slen = 6) == 0 ) {
+        rc = str2buf(&buf[slen], len - slen, self->slide, sizeof(self->slide));
+    } else if( strncmp("SOFTWARE_VERSION\t", buf, slen = 17) == 0 ) {
+        rc = str2buf(&buf[slen], len - slen, self->software_version, sizeof(self->software_version));
+    } else {
+        rc = RC(rcRuntime, rcFile, rcConstructing, rcName, rcUnrecognized);
+    }
+    return rc;
+}
+
+static
+rc_t CGTagLfr_GetAssemblyId(const CGTagLfr* cself, const CGFIELD_ASSEMBLY_ID_TYPE** assembly_id)
+{
+    if( cself->assembly_id[0] == '\0' ) {
+        return RC(rcRuntime, rcFile, rcReading, rcFormat, rcInvalid);
+    }
+    *assembly_id = cself->assembly_id;
+    return 0;
+}
+
+static
+rc_t CGTagLfr_GetSlide(const CGTagLfr* cself, const CGFIELD_SLIDE_TYPE** slide)
+{
+    if( cself->slide[0] == '\0' ) {
+        return RC(rcRuntime, rcFile, rcReading, rcFormat, rcInvalid);
+    }
+    *slide = cself->slide;
+    return 0;
+}
+
+static
+rc_t CGTagLfr_GetLane(const CGTagLfr* cself, const CGFIELD_LANE_TYPE** lane)
+{
+    if( cself->lane[0] == '\0' ) {
+        return RC(rcRuntime, rcFile, rcReading, rcFormat, rcInvalid);
+    }
+    *lane = cself->lane;
+    return 0;
+}
+
+static
+rc_t CGTagLfr_GetBatchFileNumber(const CGTagLfr* cself, const CGFIELD_BATCH_FILE_NUMBER_TYPE** batch_file_number)
+{
+    *batch_file_number = &cself->batch_file_number;
+    return 0;
+}
+
+static
+rc_t CGTagLfr_GetStartRow(const CGTagLfr* cself, int64_t* rowid)
+{
+    *rowid = cself->start_rowid;
+    return 0;
+}
+
+static
+rc_t CC CGTagLfr_GetTagLfr(const CGFILETYPE_IMPL* cself, TReadsData* data)
+{
+    rc_t rc = 0;
+    uint16_t wellScore = 0;
+    if( cself->start_rowid == 0 ) {
+        ((CGTagLfr*)cself)->start_rowid = data->rowid;
+    }
+    CG_LINE_START(cself->file, b, len, p);
+    if( b == NULL || len == 0) {
+        rc = RC(rcRuntime, rcFile, rcReading, rcData, rcInsufficient);
+        break;
+    }
+    /* reads */
+    CG_LINE_NEXT_FIELD(b, len, p);
+    if (p - b != CG_TAG_LFR_DATA_LEN) {
+        rc = RC(rcRuntime, rcFile, rcReading, rcData, rcInvalid);
+    }
+    /* scores */
+    CG_LINE_NEXT_FIELD(b, len, p);
+    if (p - b != CG_TAG_LFR_DATA_LEN) {
+        rc = RC(rcRuntime, rcFile, rcReading, rcData, rcInvalid);
+    }
+
+    /* wellId */
+    CG_LINE_NEXT_FIELD(b, len, p);
+    if ((rc = str2u16(b, p - b, &((CGTagLfr*)cself)->wellId)) != 0) {
+    }
+    else if (cself->wellId < 0 || cself->wellId > 384) {
+        rc = RC(rcRuntime, rcFile, rcReading, rcData, rcOutofrange);
+    }
+
+    /* wellScore */
+    CG_LINE_LAST_FIELD(b, len, p);
+    rc = str2u16(b, p - b, &wellScore);
+
+    if (rc == 0) {
+        size_t w = 0;
+        if (cself->wellId != 0) {
+            rc = string_printf(((CGTagLfr*)cself)->spot_group,
+                sizeof(cself->spot_group), &w, "%s-%s#%03d",
+                cself->slide, cself->lane, cself->wellId);
+        }
+        else {
+            rc = string_printf(((CGTagLfr*)cself)->spot_group,
+                sizeof(cself->spot_group), &w, "%s-%s",
+                cself->slide, cself->lane);
+        }
+        data->seq.spot_group.buffer = cself->spot_group;
+        data->seq.spot_group.elements = w;
+    }
+
+    ((CGTagLfr*)cself)->records++;
+
+    DEBUG_MSG(10, ("tag-lfr:  '%.*s'\t%d\n",
+        (int32_t)data->seq.spot_group.elements, data->seq.spot_group.buffer, 
+        cself->wellId));
+
+    CG_LINE_END();
+
+    return rc;
+}
+
+static
+void CC CGTagLfr_Release(const CGTagLfr* cself, uint64_t* records)
+{
+    if( cself != NULL ) {
+        CGTagLfr* self = (CGTagLfr*)cself;
+        if( records != NULL ) {
+            *records = cself->records;
+        }
+        free(self);
+    }
+}
+
+static const CGFileType_vt CGTagLfr_vt =
+{
+    CGTagLfr_Header,
+    NULL,
+    CGTagLfr_GetStartRow,
+    NULL,
+    NULL,
+    NULL,
+    CGTagLfr_GetTagLfr, /* tag_lfr */
+    CGTagLfr_GetAssemblyId,
+    CGTagLfr_GetSlide,
+    CGTagLfr_GetLane,
+    CGTagLfr_GetBatchFileNumber,
+    NULL,
+    NULL,
+    CGTagLfr_Release
+};
+
+rc_t CC CGTagLfr_Make(const CGFileType** cself, const CGLoaderFile* file)
+{
+    rc_t rc = 0;
+    CGTagLfr* obj = NULL;
+    
+    if( cself == NULL || file == NULL ) {
+        rc = RC(rcRuntime, rcFile, rcConstructing, rcParam, rcNull);
+    }
+    if( rc == 0 ) {
+        *cself = NULL;
+        if( (obj = calloc(1, sizeof(*obj))) == NULL ) {
+            rc = RC(rcRuntime, rcFile, rcConstructing, rcMemory, rcExhausted);
+        } else {
+            obj->file = file;
+            obj->dad.type = cg_eFileType_TAG_LFR;
+            obj->dad.vt = &CGTagLfr_vt;
+        }
+    }
+    if( rc == 0 ) {
+        *cself = &obj->dad;
+    } else {
+        CGTagLfr_Release(obj, NULL);
+    }
+    return rc;
+}
+
diff --git a/tools/cg-load/factory-tag-lfr.h b/tools/cg-load/factory-tag-lfr.h
new file mode 100644
index 0000000..5188f3a
--- /dev/null
+++ b/tools/cg-load/factory-tag-lfr.h
@@ -0,0 +1,37 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+#ifndef _tools_cg_load_factory_tag_lfr_h_
+#define _tools_cg_load_factory_tag_lfr_h_
+
+#include <klib/defs.h>
+
+struct CGFileType;
+struct CGLoaderFile;
+
+rc_t CC CGTagLfr_Make(const struct CGFileType** self,
+                      const struct CGLoaderFile* file);
+
+#endif /* _tools_cg_load_factory_tag_lfr_h_ */
diff --git a/tools/cg-load/writer-algn.c b/tools/cg-load/writer-algn.c
index cb025dc..b2921ab 100644
--- a/tools/cg-load/writer-algn.c
+++ b/tools/cg-load/writer-algn.c
@@ -30,6 +30,7 @@
 #include <kfs/file.h>
 #include <insdc/insdc.h>
 #include <align/dna-reverse-cmpl.h>
+#include <align/align.h>
 
 #include "defs.h"
 #include "writer-algn.h"
@@ -47,6 +48,7 @@ typedef struct CGWriterAlgn_match_struct {
     INSDC_coord_len read_len;
     bool has_ref_offset[CG_READS_SPOT_LEN];
     int32_t ref_offset[CG_READS_SPOT_LEN];
+    uint8_t ref_offset_type[CG_READS_SPOT_LEN];
     bool has_mismatch[CG_READS_SPOT_LEN];
     char mismatch[CG_READS_SPOT_LEN];
     int64_t ref_id;
@@ -117,6 +119,8 @@ rc_t CGWriterAlgn_Make(const CGWriterAlgn** cself, TMappingsData** data, VDataba
                 
                 self->algn[i].ref_offset.buffer = self->match[i].ref_offset;
                 
+                self->algn[i].ref_offset_type.buffer = self->match[i].ref_offset_type;
+                
                 self->algn[i].ref_id.buffer = &self->match[i].ref_id;
                 
                 self->algn[i].ref_start.buffer = &self->match[i].ref_start;
@@ -218,7 +222,7 @@ rc_t CGWriterAlgn_Save(CGWriterAlgn *const self,
         }
         for(g = 0; g < CG_READS_NGAPS; g++) {
             if( map->gap[g] > 0 ) {
-                cigar[g * 2 + 1] = (map->gap[g] << 4) | 2; /* 'xN' */
+                cigar[g * 2 + 1] = (map->gap[g] << 4) | 3; /* 'xN' */
             } else if( map->gap[g] < 0 ) {
                 cigar[g * 2 + 1] = (-map->gap[g] << 4) | 9; /* 'xB' */
             } else {
@@ -227,7 +231,7 @@ rc_t CGWriterAlgn_Save(CGWriterAlgn *const self,
         }
         algn->ploidy = 0;
         if( (rc = ReferenceMgr_Compress(self->rmgr, ewrefmgr_cmp_Binary,
-                    map->chr, map->offset, read, read_len, cigar, 7, 0, NULL, 0, 0, NULL, 0, algn)) != 0 ) {
+                    map->chr, map->offset, read, read_len, cigar, 7, 0, NULL, 0, 0, NULL, 0, NCBI_align_ro_complete_genomics, algn)) != 0 ) {
             PLOGERR(klogErr, (klogErr, rc, "compression failed $(id) $(o)",
                     PLOG_2(PLOG_S(id),PLOG_I32(o)), map->chr, map->offset));
         }
diff --git a/tools/cg-load/writer-evidence-dnbs.c b/tools/cg-load/writer-evidence-dnbs.c
index 18be548..de989d0 100644
--- a/tools/cg-load/writer-evidence-dnbs.c
+++ b/tools/cg-load/writer-evidence-dnbs.c
@@ -32,6 +32,7 @@
 #include <vdb/table.h>
 #include <align/writer-alignment.h>
 #include <align/dna-reverse-cmpl.h>
+#include <align/align.h>
 
 #include "debug.h"
 #include "defs.h"
@@ -55,6 +56,7 @@ typedef struct CGWriterEvdDnb_match_struct {
     INSDC_coord_len read_len;
     bool has_ref_offset[CG_EVDNC_ALLELE_LEN];
     int32_t ref_offset[CG_EVDNC_ALLELE_LEN];
+    uint8_t ref_offset_type[CG_EVDNC_ALLELE_LEN];
     int64_t ref_id;
     INSDC_coord_zero ref_start;
     bool has_mismatch[CG_EVDNC_ALLELE_LEN];
@@ -101,6 +103,7 @@ rc_t CGWriterEvdDnbs_Make(const CGWriterEvdDnbs** cself, TEvidenceDnbsData** dat
             self->algn.read_len.buffer = &self->match.read_len;
             self->algn.has_ref_offset.buffer = self->match.has_ref_offset;
             self->algn.ref_offset.buffer = self->match.ref_offset;
+            self->algn.ref_offset_type.buffer = self->match.ref_offset_type;
             self->algn.ref_id.buffer = &self->match.ref_id;
             self->algn.ref_id.elements = 1;
             self->algn.ref_start.buffer = &self->match.ref_start;
@@ -204,7 +207,7 @@ rc_t CGWriterEvdDnbs_Write(const CGWriterEvdDnbs* cself, const TEvidenceInterval
                                             ref->allele[ai], ref->allele_length[ai],
 					    cself->data.dnbs[i].offset_in_allele,
                                             ref->allele_alignment[ai], ref->allele_alignment_length[ai],
-                                            &self->algn)) == 0 ) {
+                                            NCBI_align_ro_complete_genomics, &self->algn)) == 0 ) {
                 self->match.mapq = cself->data.dnbs[i].mapping_quality - 33;
                 /* pointer to SEQUENCE table spot and read */
                 self->match.seq_spot_id = cself->data.dnbs[i].seq_spot_id;
diff --git a/tools/cg-load/writer-evidence-intervals.c b/tools/cg-load/writer-evidence-intervals.c
index 070cfc7..d72621a 100644
--- a/tools/cg-load/writer-evidence-intervals.c
+++ b/tools/cg-load/writer-evidence-intervals.c
@@ -28,6 +28,7 @@
 #include <klib/printf.h>
 #include <kfs/file.h>
 #include <vdb/table.h>
+#include <align/align.h>
 
 #include "defs.h"
 #include "writer-evidence-intervals.h"
@@ -47,6 +48,7 @@ typedef struct CGWriterEvdInt_match_struct {
     INSDC_coord_len read_len[CG_EVDNC_PLOIDY];
     bool has_ref_offset[CG_EVDNC_ALLELE_LEN];
     int32_t ref_offset[CG_EVDNC_ALLELE_LEN];
+    uint8_t ref_offset_type[CG_EVDNC_ALLELE_LEN];
     bool has_mismatch[CG_EVDNC_ALLELE_LEN];
     char mismatch[CG_EVDNC_ALLELE_LEN];
     int64_t ref_id;
@@ -84,6 +86,7 @@ rc_t CGWriterEvdInt_Make(const CGWriterEvdInt** cself, TEvidenceIntervalsData**
             self->algn.read_len.buffer = &self->match.read_len;
             self->algn.has_ref_offset.buffer = self->match.has_ref_offset;
             self->algn.ref_offset.buffer = self->match.ref_offset;
+            self->algn.ref_offset_type.buffer = self->match.ref_offset_type;
             self->algn.has_mismatch.buffer = self->match.has_mismatch;
             self->algn.mismatch.buffer = self->match.mismatch;
             self->algn.ref_id.buffer = &self->match.ref_id;
@@ -145,7 +148,7 @@ rc_t CGWriterEvdInt_Write(const CGWriterEvdInt* cself, const TEvidenceDnbsData*
                 self->algn.ploidy = 0;
                 rc = ReferenceMgr_Compress(cself->rmgr, ewrefmgr_cmp_Exact, self->data.chr, self->data.offset, self->data.allele[i], self->data.allele_length[i],
                                            self->data.allele_alignment[i], self->data.allele_alignment_length[i],
-                                           0, NULL, 0, 0, NULL, 0, &self->algn);
+                                           0, NULL, 0, 0, NULL, 0, NCBI_align_ro_intron_unknown, &self->algn);
                 self->data.allele_indexes_to_read_number[i] = 1; /* 1st read */
             }
         }
@@ -168,14 +171,14 @@ rc_t CGWriterEvdInt_Write(const CGWriterEvdInt* cself, const TEvidenceDnbsData*
                 self->algn.ploidy = 0;
                 rc = ReferenceMgr_Compress(cself->rmgr, ewrefmgr_cmp_Exact, self->data.chr, self->data.offset, self->data.allele[i1], self->data.allele_length[i1],
                                            self->data.allele_alignment[i1], self->data.allele_alignment_length[i1],
-                                           0, NULL, 0, 0, NULL, 0, &self->algn);
+                                           0, NULL, 0, 0, NULL, 0, NCBI_align_ro_intron_unknown, &self->algn);
                 self->data.allele_indexes_to_read_number[i1] = 1; /* 1st read */
             }
             if( rc == 0 ) {
 		if ( i2 != i1 ) {
 			rc = ReferenceMgr_Compress(cself->rmgr, ewrefmgr_cmp_Exact, self->data.chr, self->data.offset, self->data.allele[i2], self->data.allele_length[i2],
                                            self->data.allele_alignment[i2], self->data.allele_alignment_length[i2],
-                                           0, NULL, 0, 0, NULL, 0, &self->algn);
+                                           0, NULL, 0, 0, NULL, 0, NCBI_align_ro_intron_unknown, &self->algn);
 			self->data.allele_indexes_to_read_number[i2] = 2; /* 2nd read */
 		} else {
 			self->data.ploidy = 1;
@@ -203,19 +206,19 @@ rc_t CGWriterEvdInt_Write(const CGWriterEvdInt* cself, const TEvidenceDnbsData*
                 self->algn.ploidy = 0;
                 rc = ReferenceMgr_Compress(cself->rmgr, ewrefmgr_cmp_Exact, self->data.chr, self->data.offset, self->data.allele[i1], self->data.allele_length[i1],
                                            self->data.allele_alignment[i1], self->data.allele_alignment_length[i1],
-                                           0, NULL, 0, 0, NULL, 0, &self->algn);
+                                           0, NULL, 0, 0, NULL, 0, NCBI_align_ro_intron_unknown, &self->algn);
                 self->data.allele_indexes_to_read_number[i1] = 1; /* 1st read */
             }
             if( rc == 0 ) {
                 rc = ReferenceMgr_Compress(cself->rmgr, ewrefmgr_cmp_Exact, self->data.chr, self->data.offset, self->data.allele[i2], self->data.allele_length[i2],
                                            self->data.allele_alignment[i2], self->data.allele_alignment_length[i2],
-                                           0, NULL, 0, 0, NULL, 0, &self->algn);
+                                           0, NULL, 0, 0, NULL, 0, NCBI_align_ro_intron_unknown, &self->algn);
                 self->data.allele_indexes_to_read_number[i2] = 2; /* 2nd read */
             }
             if( rc == 0 ) {
                 rc = ReferenceMgr_Compress(cself->rmgr, ewrefmgr_cmp_Exact, self->data.chr, self->data.offset, self->data.allele[i3], self->data.allele_length[i3],
                                            self->data.allele_alignment[i3], self->data.allele_alignment_length[i3],
-                                           0, NULL, 0, 0, NULL, 0, &self->algn);
+                                           0, NULL, 0, 0, NULL, 0, NCBI_align_ro_intron_unknown, &self->algn);
                 self->data.allele_indexes_to_read_number[i3] = 3; /* 3rd read */
             }
         }
diff --git a/tools/check-blob-size/Makefile b/tools/check-blob-size/Makefile
new file mode 100644
index 0000000..0d213eb
--- /dev/null
+++ b/tools/check-blob-size/Makefile
@@ -0,0 +1,103 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: std
+
+TOP ?= $(abspath ../..)
+MODULE = tools/check-blob-size
+
+include $(TOP)/build/Makefile.env
+
+INT_TOOLS = \
+
+EXT_TOOLS = \
+	check-blob-size
+
+ALL_TOOLS = \
+	$(INT_TOOLS) \
+	$(EXT_TOOLS)
+
+#------------------------------------------------------------------------------
+# outer targets
+#
+all std: vers-includes
+	@ $(MAKE_CMD) $(TARGDIR)/$@
+
+$(ALL_TOOLS): vers-includes
+	@ $(MAKE_CMD) $(BINDIR)/$@
+
+.PHONY: all std $(ALL_TOOLS)
+
+#-------------------------------------------------------------------------------
+# all
+#
+$(TARGDIR)/all: \
+	$(addprefix $(BINDIR)/,$(ALL_TOOLS))
+
+.PHONY: $(TARGDIR)/all
+
+#-------------------------------------------------------------------------------
+# std
+#
+$(TARGDIR)/std: \
+	$(addprefix $(BINDIR)/,$(ALL_TOOLS))
+
+.PHONY: $(TARGDIR)/std
+
+#-------------------------------------------------------------------------------
+# vers-includes
+#
+$(TARGDIR)/vers-includes: $(addsuffix .vers.h,$(EXT_TOOLS))
+
+.PHONY: $(TARGDIR)/vers-includes
+
+#-------------------------------------------------------------------------------
+# clean
+#
+clean: stdclean
+
+.PHONY: clean
+
+#-------------------------------------------------------------------------------
+# check-blob-size
+#
+CHECK-BLOB-SIZE_SRC = \
+	check-blob-size \
+
+CHECK-BLOB-SIZE_OBJ = \
+	$(addsuffix .$(OBJX),$(CHECK-BLOB-SIZE_SRC))
+
+CHECK-BLOB-SIZE_LIB = \
+	-lkapp \
+	-lncbi-vdb \
+
+
+check-blob-size.vers.h: check-blob-size.vers
+	$(TOP)/build/make-vers-inc.sh CHECK_BLOB_SIZE_VERS $^ > $@
+
+$(BINDIR)/check-blob-size: $(CHECK-BLOB-SIZE_OBJ)
+	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(CHECK-BLOB-SIZE_LIB)
+
+#-------------------------------------------------------------------------------
diff --git a/tools/check-blob-size/check-blob-size.c b/tools/check-blob-size/check-blob-size.c
new file mode 100644
index 0000000..3f081fa
--- /dev/null
+++ b/tools/check-blob-size/check-blob-size.c
@@ -0,0 +1,332 @@
+/*******************************************************************************
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * =============================================================================
+ */
+
+#include "check-blob-size.vers.h" /* CHECK_BLOB_SIZE_VERS */
+#include <kapp/main.h>
+#include <kdb/manager.h>
+#include <kdb/table.h>
+#include <kdb/column.h>
+#include <kdb/namelist.h> /* KTableListCol */
+#include <klib/namelist.h> /* KNamelistRelease */
+#include <klib/log.h> /* LOGERR */
+#include <klib/out.h> /* OUTMSG */
+#include <klib/debug.h> /* DBGMSG */
+#include <klib/rc.h>
+#include <assert.h>
+#include <string.h> /* memset */
+#include <stdio.h>  /* printf */
+#define DISP_RC(rc, msg) (void)((rc == 0) ? 0 : LOGERR(klogInt, rc, msg))
+#define DISP_RC2(rc, name, msg) (void)((rc == 0) ? 0 : \
+    PLOGERR(klogInt, (klogInt,rc, "$(msg): $(name)","msg=%s,name=%s",msg,name)))
+typedef struct CmdArgs {
+    Args* args;
+    uint32_t count;
+
+    uint32_t i;
+} CmdArgs;
+ver_t CC KAppVersion(void) { return CHECK_BLOB_SIZE_VERS; }
+static void summary(const char* progname) {
+    OUTMSG(("Usage:\n"
+            "  %s [Options] <table>\n", progname));
+}
+const char UsageDefaultName[] = "check-blob-size";
+static const char* def_name = UsageDefaultName;
+ 
+rc_t CC UsageSummary (const char * progname)
+{
+    return 0;
+}
+
+rc_t CC Usage(const Args* args)
+{
+    rc_t rc = 0;
+    const char* progname = def_name;
+    const char* fullpath = def_name;
+    assert(args);
+    rc = ArgsProgram(args, &fullpath, &progname);
+    if (rc)
+    {    progname = fullpath = def_name; }
+    summary(progname);
+    OUTMSG(("\nOptions\n"));
+    HelpOptionsStandard();
+    HelpVersion(fullpath, KAppVersion());
+    return rc;
+}
+/* MINIUSAGE(def_name) */
+static rc_t CmdArgsInit(int argc, char** argv, CmdArgs* cmdArgs)
+{
+    rc_t rc = 0;
+
+    assert(argv && cmdArgs);
+
+    memset(cmdArgs, 0, sizeof *cmdArgs);
+
+    rc = ArgsMakeAndHandle(&cmdArgs->args, argc, argv, 0, NULL, 0);
+    DISP_RC(rc, "while calling ArgsMakeAndHandle");
+
+    if (rc == 0) {
+        do {
+            Args* args = cmdArgs->args;
+            rc = ArgsParamCount(args, &cmdArgs->count);
+            if (rc) {
+                DISP_RC(rc, "while calling ArgsParamCount");
+                break;
+            }
+            if (cmdArgs->count < 1) {
+                rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcInsufficient);
+                LOGERR(klogErr, rc, "Missing table parameter");
+                break;
+            }
+        } while (false);
+    }
+
+    if (rc != 0)
+    {   MiniUsage(cmdArgs->args); }
+
+    return rc;
+}
+static rc_t CmdArgsGetNextTable(CmdArgs* args, const char** table)
+{
+    rc_t rc = 0;
+    assert(args && table);
+    *table = NULL;
+    if (args->i >= args->count) /* no more tables to give :( */
+    {   return rc; }
+    rc = ArgsParamValue(args->args, args->i, table);
+    if (rc) {
+        PLOGERR(klogInt, (klogInt, rc,
+            "while calling ArgsParamValue($(i))", "i=%d", args->i));
+    }
+    ++args->i;
+    return rc;
+}
+static rc_t CmdArgsDestroy(CmdArgs* args)
+{
+    rc_t rc = 0;
+    assert(args);
+    rc = ArgsWhack(args->args);
+    DISP_RC(rc, "while calling ArgsWhack");
+    args->args = NULL;
+    return rc;
+}
+static rc_t CheckBlob(const char* name, const KColumn* col, int64_t id,
+    int64_t* lastId, size_t* blobSize)
+{
+    rc_t rc = 0;
+    int64_t first = 0;
+    uint32_t count = 0;
+    const KColumnBlob* blob = NULL;
+    assert(col && lastId && blobSize);
+    rc = KColumnOpenBlobRead(col, &blob, id);
+    if (rc != 0) {
+        PLOGERR(klogInt, (klogInt, rc,
+            "while calling KColumnOpenBlobRead($(col), $(id))",
+            "col=%s,id=%d", name, id));
+    }
+    else {
+        rc = KColumnBlobIdRange(blob, &first, &count);
+        if (rc != 0) {
+            PLOGERR(klogInt, (klogInt, rc,
+                "while calling KColumnBlobIdRange($(col), $(id))",
+                "col=%s,id=%d", name, id));
+        }
+    }
+    if (rc == 0) {
+        size_t num_read = 0;
+        size_t remaining = 0;
+        rc = KColumnBlobRead(blob, 0, NULL, 0, &num_read, &remaining);
+        if (rc != 0) {
+            PLOGERR(klogInt, (klogInt, rc,
+                "while calling KColumnBlobRead($(col), $(id))",
+                "col=%s,id=%d", name, id));
+        }
+        else {
+            assert(num_read == 0 && remaining);
+            *lastId = first + count - 1;
+            *blobSize = remaining;
+            DBGMSG(DBG_APP, DBG_COND_2,
+                ("first %d, count %d, size %d\n", first, count, remaining));
+        }
+    }
+    {
+        rc_t rc2 = KColumnBlobRelease(blob);
+        DISP_RC(rc2, "while calling KColumnBlobRelease");
+        if (rc == 0)
+        {   rc = rc2; }
+        blob = NULL;
+    }
+    return rc;
+}
+static rc_t CheckCol(const KTable* tbl,
+    const char* name, size_t* maxBlobSize)
+{
+    rc_t rc = 0;
+    uint64_t first = 0;
+    uint64_t count = 0;
+    const KColumn* col = NULL;
+    assert(tbl && name && maxBlobSize);
+    if (rc == 0) {
+        rc = KTableOpenColumnRead(tbl, &col, "%s", name);
+        DISP_RC2(rc, name, "while opening column");
+    }
+    if (rc == 0) {
+        rc = KColumnIdRange(col, &first, &count);
+        DISP_RC2(rc, name, "while calling KColumnIdRange");
+    }
+    if (rc == 0) {
+        uint64_t nBlobs = 0;
+        uint64_t i = 0;
+        *maxBlobSize = 0;
+        DBGMSG(DBG_APP, DBG_COND_1,
+            ("Column %18s: %d(%d)\n", name, first, count));
+        for (i = first; i < first + count && rc == 0;) {
+            int64_t lastId = 0;
+            rc = Quitting();
+            if (rc)
+            {   LOGMSG(klogWarn, "Interrupted"); }
+            else {
+                size_t blobSize = 0;
+                rc = CheckBlob(name, col, i, &lastId, &blobSize);
+                i = lastId + 1;
+                ++nBlobs;
+                if (rc == 0 && blobSize > *maxBlobSize)
+                {   *maxBlobSize = blobSize; }
+            }
+        }
+        if (rc == 0) {
+            PLOGMSG(klogInfo, (klogInfo,
+                "'$(col): $(blobs) blobs (max $(max))",
+                "col=%s,blobs=%d,max=%d", name, nBlobs, *maxBlobSize));
+        }
+    }
+    {
+        rc_t rc2 = KColumnRelease(col);
+        DISP_RC(rc2, "while calling KColumnRelease");
+        if (rc == 0)
+        {   rc = rc2; }
+        col = NULL;
+    }
+    return rc;
+}
+static rc_t Check(const KTable* tbl, size_t* maxBlobSize)
+{
+    rc_t rc = 0;
+    uint32_t cCount = 0;
+    struct KNamelist* columns = NULL;
+    assert(tbl && maxBlobSize);
+    rc = KTableListCol(tbl, &columns);
+    DISP_RC(rc, "while calling KTableListCol");
+    if (rc == 0) {
+        rc = KNamelistCount(columns, &cCount);
+        DISP_RC(rc, "while calling KTableColNamelistCount");
+    }
+    if (rc == 0) {
+        uint32_t iCol = 0;
+        *maxBlobSize = 0;
+        for (iCol = 0; iCol < cCount && rc == 0; ++iCol) {
+            const char* name = NULL;
+            if (rc == 0) {
+                rc = KNamelistGet(columns, iCol, &name);
+                if (rc) {
+                    PLOGERR(klogInt, (klogInt, rc,
+                        "while calling KTableColNamelistGet($(i))",
+                        "i=%d", iCol));
+                }
+            }
+            if (rc == 0) {
+                size_t maxColBlobSize = 0;
+                rc = CheckCol(tbl, name, &maxColBlobSize);
+                if (rc == 0 && maxColBlobSize > *maxBlobSize)
+                {   *maxBlobSize = maxColBlobSize; }
+            }
+        }
+    }
+    {
+        rc_t rc2 = KNamelistRelease(columns);
+        DISP_RC(rc2, "while calling KNamelistRelease");
+        if (rc == 0)
+        {   rc = rc2; }
+        columns = NULL;
+    }
+    return rc;
+}
+rc_t CC KMain(int argc, char* argv[])
+{
+    rc_t rc = 0;
+
+    CmdArgs args;
+    const KDBManager* mgr = NULL;
+
+    assert(argc && argv);
+
+    def_name = argv[0];
+
+    rc = LogLevelSet("info");
+    DISP_RC(rc, "while calling LogLevelSet");
+
+    rc = CmdArgsInit(argc, argv, &args);
+    if (rc == 0) {
+        rc = KDBManagerMakeRead(&mgr, NULL);
+        DISP_RC(rc, "while calling KDBManagerMakeRead");
+    }
+    while (rc == 0) {
+        const char* table = NULL;
+        const KTable* tbl = NULL;
+        rc = CmdArgsGetNextTable(&args, &table);
+        if (table == NULL)
+        {   break; }
+        if (rc == 0) {
+            rc = KDBManagerOpenTableRead(mgr, &tbl, "%s", table);
+            DISP_RC2(rc, table, "while opening table");
+        }
+        if (rc == 0) {
+            size_t maxBlobSize = 0;
+            PLOGMSG(klogInfo, (klogInfo, "'$(table)'", "table=%s", table));
+            rc = Check(tbl, &maxBlobSize);
+            if (rc == 0)
+            {   printf("%lu\t%s\n", maxBlobSize, table); }
+        }
+        {
+            rc_t rc2 = KTableRelease(tbl);
+            DISP_RC(rc2, "while calling KTableRelease");
+            if (rc == 0)
+            {   rc = rc2; }
+            tbl = NULL;
+        }
+    }
+    {
+        rc_t rc2 = KDBManagerRelease(mgr);
+        DISP_RC(rc2, "while calling KDBManagerRelease");
+        if (rc == 0)
+        {   rc = rc2; }
+        mgr = NULL;
+    }
+    {
+        rc_t rc2 = CmdArgsDestroy(&args);
+        if (rc == 0)
+        {   rc = rc2; }
+    }
+    return rc;
+}
diff --git a/tools/check-blob-size/check-blob-size.vers b/tools/check-blob-size/check-blob-size.vers
new file mode 100644
index 0000000..8e8299d
--- /dev/null
+++ b/tools/check-blob-size/check-blob-size.vers
@@ -0,0 +1 @@
+2.4.2
diff --git a/tools/copycat/Makefile b/tools/copycat/Makefile
new file mode 100644
index 0000000..a3d0ca7
--- /dev/null
+++ b/tools/copycat/Makefile
@@ -0,0 +1,109 @@
+# ==============================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: std
+
+TOP ?= $(abspath ../..)
+MODULE = tools/copycat
+
+include $(TOP)/build/Makefile.env
+
+INT_TOOLS =
+
+EXT_TOOLS = 
+
+ifeq (linux,$(OS))
+	EXT_TOOLS += copycat
+endif
+
+
+ALL_TOOLS = \
+	$(INT_TOOLS) \
+	$(EXT_TOOLS)
+
+#-------------------------------------------------------------------------------
+# outer targets
+#
+all std: vers-includes
+	@ $(MAKE_CMD) $(TARGDIR)/std
+
+$(ALL_TOOLS): vers-includes
+	@ $(MAKE_CMD) $(BINDIR)/$@
+
+.PHONY: all std $(ALL_TOOLS)
+
+#-------------------------------------------------------------------------------
+# std
+#
+$(TARGDIR)/std: \
+	$(addprefix $(BINDIR)/,$(ALL_TOOLS))
+
+.PHONY: $(TARGDIR)/std
+
+#-------------------------------------------------------------------------------
+# vers-includes
+#
+$(TARGDIR)/vers-includes: $(addsuffix .vers.h,$(EXT_TOOLS))
+
+.PHONY: $(TARGDIR)/vers-includes
+
+#-------------------------------------------------------------------------------
+# clean
+#
+clean: stdclean
+
+.PHONY: clean
+
+#-------------------------------------------------------------------------------
+# copycat
+#  Copy files from one directory to another while cataloging the contents.
+#  XML files can be redirected as well.
+#
+COPYCAT_SRC = \
+	copycat \
+	ccfileformat \
+	cccat \
+	cctree \
+	cctree-dump \
+	cctar  \
+	ccsra \
+	ccsubchunk \
+	ccfile
+
+COPYCAT_OBJ = \
+	$(addsuffix .$(OBJX),$(COPYCAT_SRC))
+
+COPYCAT_LIB = \
+	-lkapp \
+	-sncbi-vdb \
+	-lkff \
+	-lmagic
+
+
+$(BINDIR)/copycat: $(COPYCAT_OBJ)
+	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(COPYCAT_LIB)
+
+
+
diff --git a/tools/copycat/ccbuffer.c b/tools/copycat/ccbuffer.c
new file mode 100644
index 0000000..b628c2b
--- /dev/null
+++ b/tools/copycat/ccbuffer.c
@@ -0,0 +1,153 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+
+#include <assert.h>
+#include <atomic.h>
+#include <stdlib.h>
+
+
+/* #include <os-native.h> */
+
+/* #include <klib/rc.h> */
+/* #include <kapp/main.h> */
+/* #include <kcont/queue.h> */
+
+#include "copycat-priv.h"
+
+/* ==========
+ * Buffer is a generic buffer to be used to pass data between co-routines or 
+ * threads.
+ */
+struct Buffer
+{
+    /* standard SRA tool kit type reference counter: zero when free and 
+     * in the queue of the BufferMgr */
+    atomic32_t	refcount;
+    /* keep track of manager - by adding a reference when allocated it keeps
+     * the manager alive long enough to free all buffers */
+    BufferMgr *	mgr;
+    /* how large is the payload for the buffer */
+    size_t	payload_size;
+    /* how large is the content of the payload? */
+    size_t	payload_content;
+    /* the payload of the packet is the rest of the packet (and not normally 
+     * a single byte) */
+    char	payload [1];
+};
+
+/* ----------
+ * Constructor/initializer for a buffer: called only from a BufferMgr
+ * Return: rc_t
+ *  buff          pointer to a pointer to hold a reference to the new Buffer
+ *  payload_size  how large to make the data portion of the Buffer
+ *  mgr           a reference back to the manager that will control this buffer
+ */
+rc_t BufferMake (Buffer ** buff, size_t payload_size, BufferMgr * mgr)
+{
+    Buffer * self = NULL;
+    rc_t rc = 0;
+
+    assert (mgr != NULL);
+
+    self = malloc (payload_size + sizeof (Buffer) - 1);
+    if (self == NULL)
+    {
+	rc = RC (rcExe, rcBuffer, rcAllocating, rcMemory, rcExhausted);
+    }
+    else
+    {
+	/* non-standard for SRA Toolkit; refcount is 0 while not allocated */
+	atomic32_set (&self->refcount, 0);
+	self->mgr = mgr;
+	self->payload_size = payload_size;
+	self->payload_content = 0;
+    }
+    *buff = self;
+    return rc;
+}
+
+rc_t BufferAddRef (const Buffer * self)
+{
+    if (self != NULL)
+	atomic32_inc (&((Buffer*)self)->refcount);
+    return 0;
+}
+
+rc_t BufferRelease (const Buffer * cself)
+{
+    Buffer * self = (Buffer *)cself;
+    rc_t rc = 0;
+
+    if (self != NULL)
+    {
+	if (atomic32_dec_and_test (&self->refcount))
+	{
+	    if (self->mgr == NULL)
+		free (self);
+	    else
+	    {
+		/* refcount reaching 0 means to put back in the free_q for the BufferMgr */
+		rc = BufferMgrPutBuffer (self->mgr, self, NULL);
+
+		/* if failed return ownership to last releaser */
+		if (rc != 0)
+		    atomic32_set (&self->refcount, 1);
+	    }
+	}
+    }
+    return rc;
+}
+
+size_t BufferPayloadGetSize (const Buffer * self)
+{
+    assert (self != NULL);
+    return self->payload_size;
+}
+size_t BufferContentGetSize (const Buffer * self)
+{
+    assert (self != NULL);
+    return self->payload_content;
+}
+rc_t BufferContentSetSize (Buffer * self, size_t z)
+{
+    rc_t rc = 0;
+    assert (self != NULL);
+    assert (z <= self->payload_size);
+    self->payload_content = z;
+    return rc;
+}
+/* is it too redundant to have a read and write version? */
+const void * BufferPayload (const Buffer * self)
+{
+    assert (self != NULL);
+    return (const void*)self->payload;
+}
+void * BufferPayloadWrite (Buffer * self)
+{
+    assert (self != NULL);
+    return (void*)self->payload;
+}
+
diff --git a/tools/copycat/ccbuffermgr.c b/tools/copycat/ccbuffermgr.c
new file mode 100644
index 0000000..8323929
--- /dev/null
+++ b/tools/copycat/ccbuffermgr.c
@@ -0,0 +1,234 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#include <stdlib.h>
+#include <assert.h>
+
+#include <atomic.h>
+/* #include <os-native.h> */
+
+/* #include <klib/rc.h> */
+/* #include <kapp/main.h> */
+#include <kcont/queue.h>
+#include <kapp/log.h>
+
+#include "copycat-priv.h"
+
+/* ==========
+ * BufferMgr
+ */
+struct BufferMgr
+{
+    atomic32_t	refcount;
+    uint32_t	timeout;
+    KQueue *	free_q;
+};
+
+
+/* Standard SRA type constructor:
+ * construction of the manager also creates the buffers per specification in the parameters
+ *  buffmgr    where to put a reference to the new BufferMgr
+ *  buffcount  how many Buffers to make as well
+ *  buffsize   how large a payload is desired for the Buffers
+ *  timeout    number of milliseconds of wait time for the operations for this BufferMgr
+ */
+rc_t BufferMgrMake (BufferMgr ** buffmgr, uint32_t buffcount, size_t buffsize, uint32_t timeout)
+{
+    rc_t rc = 0;
+    BufferMgr * self;
+
+    *buffmgr = NULL;
+    self = malloc ( sizeof * self );
+
+    if ( self == NULL)
+    {
+	rc = RC (rcExe, rcBuffer, rcAllocating, rcMemory, rcExhausted);
+	LOGERR (klogErr, rc, "BufferMgrMake: error allocating for buffer manager");
+    }
+    else
+    {
+	atomic32_set (&self->refcount, 1);
+	self->timeout = timeout; /* default timeout */
+	rc = KQueueMake (&self->free_q, buffcount);
+
+	if (rc != 0)
+	    LOGERR (klogErr, rc, "BufferMgrMake: error making KQueue");
+	else
+	{
+	    uint32_t ix;
+	    union
+	    {
+		Buffer * b;
+		void * v;
+	    } bp;
+	    timeout_t tm;
+
+	    for (ix = 0; ix < buffcount; ++ix)
+	    {
+		bp.v = NULL;
+		rc = TimeoutInit (&tm, timeout);
+
+		if (rc == 0)
+		{
+		    rc = BufferMake (&bp.b, buffsize, self);
+		    if (rc == 0)
+		    {
+			rc = KQueuePush (self->free_q, bp.v, &tm);
+			if (rc != 0)
+			    free (bp.v);
+		    }
+		    if (rc != 0)
+			break;
+		}
+	    }
+	    if (ix == buffcount)
+	    {
+		atomic32_set (&self->refcount, 1);
+		*buffmgr = self;
+		return 0;
+	    }
+	    else
+	    {
+		/* failure so undo all */
+		rc_t rc_sub = 0;
+
+		while (rc_sub)
+		{
+		    rc_sub = TimeoutInit (&tm, timeout);
+		    if (rc_sub == 0)
+		    {
+			rc_sub = KQueuePop (self->free_q, &bp.v, &tm);
+			if (rc_sub == 0)
+			    if (bp.v != NULL)
+				free (bp.v);
+		    }
+		}
+	    }	
+	    KQueueRelease (self->free_q);
+	}
+	free (self);
+    }
+    return rc;
+}
+
+rc_t BufferMgrAddRef (const BufferMgr * self)
+{
+    if (self != NULL)
+	atomic32_inc (&((BufferMgr*)self)->refcount);
+    return 0;
+}
+
+rc_t BufferMgrRelease (BufferMgr *self)
+{
+    rc_t rc = 0;
+    void * bp;
+    timeout_t tm;
+    if ( self != NULL )
+    {
+        if ( atomic32_dec_and_test (&self->refcount))
+        {
+	    /* release all allocated buffers here */
+	    while (rc)
+	    {
+		rc = TimeoutInit (&tm, self->timeout);
+		if (rc == 0)
+		{
+		    rc = KQueuePop (self->free_q, &bp, &tm);
+		    if (rc == 0)
+			if (bp != NULL)
+			    free (bp);
+		}
+	    }
+	    if (rc == 0)
+		free (self);
+        }
+    }
+    return rc;
+}
+rc_t BufferMgrPutBuffer (BufferMgr * self, Buffer * buff, timeout_t * tm)
+{
+    rc_t rc = 0;
+    timeout_t t;
+
+    assert (self != NULL);
+    assert (buff != NULL);
+
+    if (tm == NULL)
+    {
+	tm = &t;
+	rc = TimeoutInit (tm, self->timeout);
+    }
+
+    if (rc == 0)
+    {
+	rc = KQueuePush (self->free_q, buff, tm);
+	if (rc == 0)
+	{
+	    /* take ownership of the buffer removing keep alive reference */
+	    BufferMgrRelease (self);
+	}
+    }
+    if (rc != 0)
+	/* assign ownership back to the caller */
+	BufferAddRef(buff);
+
+    return rc;
+}
+rc_t BufferMgrGetBuffer (BufferMgr * self, Buffer ** buff, timeout_t * tm)
+{
+    rc_t rc = 0, orc;
+    timeout_t t;
+    void * bp;
+
+    assert (self != NULL);
+    assert (buff != NULL);
+
+    if (tm == NULL)
+    {
+	tm = &t;
+	rc = TimeoutInit (tm, self->timeout);
+    }
+
+    if (rc == 0)
+    {
+	*buff = NULL;
+
+	rc = KQueuePop (self->free_q, &bp, tm);
+	if (rc == 0)
+	{
+	    /* add a keep alive reference to the buffer */
+	    rc = BufferMgrAddRef (self);
+            if (rc)
+                LOGERR (klogInt, rc, "Error adding reference to buffer manager");
+            else
+                *buff = bp;
+
+	    rc = BufferAddRef(*buff);
+            if (orc)
+                LOGERR (klogInt, rc, "Error adding reference to a buffer");
+	}
+    }
+    return rc;
+}
diff --git a/tools/copycat/ccbufferq.c b/tools/copycat/ccbufferq.c
new file mode 100644
index 0000000..0d3b4cb
--- /dev/null
+++ b/tools/copycat/ccbufferq.c
@@ -0,0 +1,175 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#include <stdlib.h>
+#include <assert.h>
+
+#include <atomic.h>
+#include <os-native.h>
+
+#include <klib/rc.h>
+#include <kapp/log.h>
+#include <kcont/queue.h>
+
+#include "copycat-priv.h"
+
+
+
+struct BufferQ
+{
+    atomic32_t	refcount;	/* how many references to this object */
+    uint32_t	timeout;	/* default timeout in millisecs */
+    KQueue *	q;		/* The underlying thread safe queue */
+};
+
+rc_t BufferQAddRef (const BufferQ * self)
+{
+    if (self != NULL)
+	atomic32_inc (&((BufferQ*)self)->refcount);
+    return 0;
+}
+
+rc_t BufferQRelease (const BufferQ *cself)
+{
+    BufferQ * self  = (BufferQ*)cself;
+    rc_t rc = 0;
+    if ( self != NULL )
+    {
+        if ( atomic32_dec_and_test (&self->refcount))
+        {
+	    const Buffer * b;
+	    while (rc == 0)
+	    {
+		rc = BufferQPopBuffer (self, &b, NULL);
+		BufferRelease (b);
+	    }
+/* this might need rework especially if KQueue changes */
+	    if ((GetRCState(rc) == rcExhausted) && (GetRCObject(rc) == rcTimeout))
+		rc = 0;
+	    if (rc == 0)
+	    {
+		rc = KQueueRelease (self->q);
+		if (rc == 0)
+		{
+		    free (self);
+		    return 0;
+		}
+	    }
+	    atomic32_inc (&((BufferQ*)self)->refcount);
+        }
+    }
+    return rc;
+}
+
+
+rc_t BufferQMake (BufferQ ** q, uint32_t timeout, uint32_t length)
+{
+    rc_t rc = 0;
+    BufferQ * self;
+
+    assert (q != NULL);
+
+    self = malloc (sizeof * self);
+    if (self == NULL)
+	rc = RC (rcExe, rcQueue, rcAllocating, rcMemory, rcExhausted);
+    else
+    {
+	rc = KQueueMake (&self->q, length);
+	if (rc == 0)
+	{
+	    self->timeout = timeout;
+	    atomic32_set (&self->refcount, 1);
+	    *q = self;
+	}
+    }
+
+    return rc;
+}
+
+rc_t BufferQPushBuffer (BufferQ * self, const Buffer * buff, timeout_t * tm)
+{
+    rc_t rc = 0;
+    timeout_t t;
+
+    assert (self != NULL);
+    assert (buff != NULL);
+
+    if (tm == NULL)	/* do we need the default timeout? */
+    {
+	tm = &t;
+	rc = TimeoutInit (tm, self->timeout);
+    }
+
+    if (rc == 0)
+    {
+	rc = KQueuePush (self->q, buff, tm);
+	if (rc == 0)
+	{
+	    /* share ownership of the buffer removing keep alive reference */
+	    rc = BufferAddRef (buff);
+	}
+    }
+
+    return rc;
+}
+rc_t BufferQPopBuffer (BufferQ * self, const Buffer ** buff, timeout_t * tm)
+{
+    rc_t rc = 0;
+    timeout_t t;
+    void * p;
+    LOGMSG (klogDebug10, "BufferQPopBuffer");
+    assert (self != NULL);
+    assert (buff != NULL);
+
+    if (tm == NULL)
+    {
+	LOGMSG (klogDebug10, "BufferQPopBuffer tm was NULL");
+	tm = &t;
+	rc = TimeoutInit (tm, self->timeout);
+    }
+
+    if (rc == 0)
+    {
+	LOGMSG (klogDebug10, "BufferQPopBuffer call KQueuePop");
+	rc = KQueuePop (self->q, &p, tm);
+	PLOGMSG (klogDebug10, "BufferQPopBuffer back from KQueuePop $(rc)", PLOG_U32(rc), rc);
+	if (rc == 0)
+	    *buff = p;
+	else
+	{
+	    *buff = NULL;
+	}
+    }
+    LOGMSG (klogDebug10, "leave BufferQPopBuffer");
+    return rc;
+}
+rc_t BufferQSeal (BufferQ * self)
+{
+    return KQueueSeal (self->q);
+}
+bool BufferQSealed (BufferQ *self)
+{
+    return KQueueSealed (self->q);
+}
diff --git a/tools/copycat/cccat.c b/tools/copycat/cccat.c
new file mode 100644
index 0000000..115474d
--- /dev/null
+++ b/tools/copycat/cccat.c
@@ -0,0 +1,1797 @@
+/*===========================================================================
+ *
+ *                            Public DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+
+#include "copycat-priv.h"
+#include "cctree-priv.h"
+
+#include <vfs/path.h>
+#include <vfs/path-priv.h>
+#include <krypto/key.h>
+#include <krypto/encfile.h>
+#include <krypto/encfile-priv.h>
+#include <krypto/wgaencrypt.h>
+#include <kfs/kfs-priv.h>
+#include <kfs/file.h>
+#include <kfs/teefile.h>
+#include <kfs/gzip.h>
+#include <kfs/bzip.h>
+#include <kfs/md5.h>
+#include <kfs/countfile.h>
+#include <kfs/readheadfile.h>
+#include <kfs/buffile.h>
+#include <kfs/crc.h>
+#include <klib/checksum.h>
+#include <klib/log.h>
+#include <klib/rc.h>
+#include <klib/text.h>
+
+#include <os-native.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+/* make it last include */
+#include "debug.h"
+
+#define EXAMINE_KAR_FILES 0
+#define DECRYPT_FAIL_AS_PLAIN_FILE 0
+/* the readhead file isn't working yet */
+#define USE_KBUFFILE 1
+
+static
+const VPath * src_path = NULL;
+
+static
+const VPath * dst_path = NULL;
+
+static
+bool do_encrypt = false;
+static
+bool do_decrypt = false;
+static
+bool wga_pw_read = false;
+static
+bool src_pw_read = false;
+static
+bool dst_pw_read = false;
+
+static
+char wga_pwd [256];
+static
+char src_pwd [256];
+static
+char dst_pwd [256];
+
+static
+size_t wga_pwd_sz;
+static
+size_t src_pwd_sz;
+static
+size_t dst_pwd_sz;
+
+static
+KKey src_key;
+
+static
+KKey dst_key;
+
+static
+KDirectory * cwd = NULL;
+
+
+static
+rc_t get_password (const VPath * path, char * pw, size_t pwz, size_t * num_read, KKey * key, bool * read)
+{
+    const KFile * pwfile;
+    size_t z;
+    rc_t rc;
+    char obuff [8096];
+
+    if (VPathOption (path, vpopt_encrypted, obuff, sizeof obuff, &z) == 0)
+    {
+        if (VPathOption (path, vpopt_pwpath, obuff, sizeof obuff, &z) == 0)
+            rc = KDirectoryOpenFileRead (cwd, &pwfile, "%s", obuff);
+
+        else if (VPathOption (path, vpopt_pwfd, obuff, sizeof obuff, &z) == 0)
+            rc = KFileMakeFDFileRead (&pwfile, atoi (obuff));
+
+        else
+            rc = RC (rcExe, rcPath, rcAccessing, rcParam, rcUnsupported);
+        if (rc == 0)
+        {
+            rc = KFileRead (pwfile, 0, pw, pwz, num_read);
+
+            if (rc == 0)
+            {
+                char * pc;
+
+                if (*num_read < pwz)
+                    pw[*num_read] = '\0';
+
+                pc = string_chr (pw, *num_read, '\r');
+                if (pc)
+                {
+                    *pc = '\0';
+                    *num_read = pc - pw;
+                }
+
+                pc = string_chr (pw, *num_read, '\n');
+                if (pc)
+                {
+                    *pc = '\0';
+                    *num_read = pc - pw;
+                }
+
+                *read = true;
+                rc = KKeyInitRead (key, kkeyAES128, pw, *num_read);
+            }
+
+            KFileRelease (pwfile);
+        }
+    }
+    else
+        rc = RC (rcExe, rcPath, rcAccessing, rcFunction, rcNotFound);
+    return rc;
+}
+
+
+static
+rc_t wga_password (const VPath * path, char * pw, size_t pwz, size_t * num_read, bool * read)
+{
+    const KFile * pwfile;
+    size_t z;
+    rc_t rc;
+    char obuff [8096];
+
+    if (VPathOption (path, vpopt_encrypted, obuff, sizeof obuff, &z) == 0)
+    {
+        if (VPathOption (path, vpopt_pwpath, obuff, sizeof obuff, &z) == 0)
+            rc = KDirectoryOpenFileRead (cwd, &pwfile, "%s", obuff);
+
+        else if (VPathOption (path, vpopt_pwfd, obuff, sizeof obuff, &z) == 0)
+            rc = KFileMakeFDFileRead (&pwfile, atoi (obuff));
+
+        else
+            rc = RC (rcExe, rcPath, rcAccessing, rcParam, rcUnsupported);
+        if (rc == 0)
+        {
+            rc = KFileRead (pwfile, 0, pw, pwz, num_read);
+
+            if (rc == 0)
+            {
+                char * pc;
+
+                if (*num_read < pwz)
+                    pw[*num_read] = '\0';
+
+                pc = string_chr (pw, *num_read, '\r');
+                if (pc)
+                {
+                    *pc = '\0';
+                    *num_read = pc - pw;
+                }
+
+                pc = string_chr (pw, *num_read, '\n');
+                if (pc)
+                {
+                    *pc = '\0';
+                    *num_read = pc - pw;
+                }
+
+                *read = true;
+            }
+
+            KFileRelease (pwfile);
+        }
+    }
+    else
+        rc = RC (rcExe, rcPath, rcAccessing, rcFunction, rcNotFound);
+    return rc;
+}
+
+
+/*--------------------------------------------------------------------------
+ * copycat
+ */
+static
+rc_t ccat_cache ( CCCachedFileNode **np, const KFile *sf,
+                  enum CCType ntype, CCFileNode *node, const char *name )
+{
+    rc_t rc;
+    KFile *out;
+
+    /* create path */
+    char path [ 256 ];
+    int len = snprintf ( path, sizeof path, "%s", name );
+
+    DEBUG_STATUS (("%s: name '%s'\n", __func__, name));
+
+    if ( len < 0 || len >= sizeof path )
+        return RC ( rcExe, rcFile, rcWriting, rcPath, rcExcessive );
+
+    /* look for a name that has not yet been written */
+    if ( CCTreeFind ( ctree, path ) != NULL )
+    {
+        uint32_t i;
+        const char *ext = strrchr ( name, '.' );
+        if ( ext != NULL )
+        {
+            for ( i = 2; ; ++ i )
+            {
+                len = snprintf ( path, sizeof path, "%.*s-%u%s", ( int ) ( ext - name ), name, i, ext );
+                if ( len < 0 || len >= sizeof path )
+                    return RC ( rcExe, rcFile, rcWriting, rcPath, rcExcessive );
+                if ( CCTreeFind ( ctree, path ) == NULL )
+                    break;
+            }
+        }
+        else
+        {
+            for ( i = 2; ; ++ i )
+            {
+                len = snprintf ( path, sizeof path, "%s-%u", name, i );
+                if ( len < 0 || len >= sizeof path )
+                    return RC ( rcExe, rcFile, rcWriting, rcPath, rcExcessive );
+                if ( CCTreeFind ( ctree, path ) == NULL )
+                    break;
+            }
+        }
+    }
+
+    /* create an output file */
+    rc = KDirectoryCreateFile ( cdir, & out, false, 0640, cm, "%s", path );
+    if ( rc != 0 && GetRCState ( rc ) == rcUnauthorized )
+    {
+        /* respond to a file that has no write privs */
+        uint32_t access;
+        rc_t rc2 = KDirectoryAccess ( cdir, & access, "%s", path );
+        if ( rc2 == 0 )
+        {
+            rc2 = KDirectorySetAccess ( cdir, false, 0640, 0777, "%s", path );
+            if ( rc2 == 0 )
+            {
+                rc = KDirectoryCreateFile ( cdir, & out, false, 0640, cm, "%s", path );
+                if ( rc != 0 )
+                    KDirectorySetAccess ( cdir, false, access, 0777, "%s", path );
+            }
+        }
+    }
+
+    if ( rc != 0 )
+        PLOGERR ( klogErr,  (klogErr, rc, "failed to create cached file '$(path)'", "path=%s", path ));
+    else
+    {
+        const KFile *tee;
+        rc = KFileMakeTeeRead ( & tee, sf, out );
+        if ( rc != 0 )
+            PLOGERR ( klogInt,  (klogInt, rc, "failed to create cache tee file on '$(path)'", "path=%s", path ));
+        else
+        {
+            KFileAddRef ( sf );
+            KFileAddRef ( out );
+            rc = KFileRelease ( tee );
+            if ( rc != 0 )
+                PLOGERR ( klogInt,  (klogInt, rc, "failed to close cache tee file on '$(path)'", "path=%s", path ));
+        }
+
+        KFileRelease ( out );
+
+        if ( rc == 0 )
+        {
+            rc = CCCachedFileNodeMake ( np, path, ntype, node );
+            if ( rc != 0 )
+                LOGERR ( klogInt, rc, "failed to create cached file node" );
+            else
+            {
+                rc = KDirectorySetAccess ( cdir, false, 0440, 0777, "%s", path );
+
+                /* create named entry in ctree */
+                rc = CCTreeInsert ( ctree, 0, ccFile, NULL, path );
+                if ( rc != 0 )
+                    LOGERR ( klogInt, rc, "failed to record cached file" );
+            }
+        }
+    }
+
+    return rc;
+}
+
+
+static
+rc_t ccat_extract_path (char * path, size_t pathz, const char * name)
+{
+    rc_t rc = 0;
+    int len;
+
+    DEBUG_STATUS (("%s: name '%s'\n", __func__, name));
+
+    if (extract_dir)
+        len = snprintf ( path, pathz, "%s%s", epath, name );
+    else
+        len = snprintf ( path, pathz, "%s", name );
+    DEBUG_STATUS (("%s: path '%s'\n",__func__, path));
+
+    if ( len < 0 || len >= pathz )
+        return RC ( rcExe, rcFile, rcWriting, rcPath, rcExcessive );
+
+    /* look for a name that has not yet been written */
+    if ( CCTreeFind ( etree, path ) != NULL )
+    {
+        uint32_t i;
+        const char *ext = strrchr ( name, '.' );
+        if ( ext != NULL )
+        {
+            for ( i = 2; ; ++ i )
+            {
+                len = snprintf ( path, pathz, "%.*s-%u%s", ( int ) ( ext - name ), name, i, ext );
+                if ( len < 0 || len >= pathz )
+                    return RC ( rcExe, rcFile, rcWriting, rcPath, rcExcessive );
+                if ( CCTreeFind ( etree, path ) == NULL )
+                    break;
+            }
+        }
+        else
+        {
+            for ( i = 2; ; ++ i )
+            {
+                len = snprintf ( path, pathz, "%s-%u", name, i );
+                if ( len < 0 || len >= pathz )
+                    return RC ( rcExe, rcFile, rcWriting, rcPath, rcExcessive );
+                if ( CCTreeFind ( etree, path ) == NULL )
+                    break;
+            }
+        }
+    }
+    DEBUG_STATUS (("%s: rc '%u(%R)' path '%s'\n",__func__, rc, rc, path));
+    return rc;
+}
+
+
+static
+rc_t ccat_extract (const KFile *sf, const char * path)
+{
+    rc_t rc;
+    KFile *out;
+
+    rc = KDirectoryCreateFile ( edir, & out, false, 0640, cm, "%s", path );
+    if ( rc != 0 && GetRCState ( rc ) == rcUnauthorized )
+    {
+        /* respond to a file that has no write privs */
+        uint32_t access;
+        rc_t rc2 = KDirectoryAccess ( edir, & access, "%s", path );
+        if ( rc2 == 0 )
+        {
+            rc2 = KDirectorySetAccess ( edir, false, 0640, 0777, "%s", path );
+            if ( rc2 == 0 )
+            {
+                rc = KDirectoryCreateFile ( edir, & out, false, 0640, cm, "%s", path );
+                DBG_KFILE(("%s: called KDirectoryCreateFile rc %R path %s\n",__func__,rc,path));
+                DBG_KFile(out);
+                if ( rc != 0 )
+                    KDirectorySetAccess ( edir, false, access, 0777, "%s", path );
+            }
+        }
+    }
+    if ( rc != 0 )
+        PLOGERR ( klogErr,
+                  ( klogErr, rc,
+                    "failed to create extracted file '$(path)'",
+                    "path=%s", path ));
+    else
+    {
+        const KFile *tee;
+        rc = KFileMakeTeeRead ( & tee, sf, out );
+        DBG_KFILE(("%s: called KFileMakeTeeRead rc %R \n",__func__,rc));
+        DBG_KFile(tee);
+        if ( rc != 0 )
+            PLOGERR ( klogInt,  ( klogInt, rc, "failed to create extract tee file on '$(path)'", "path=%s", path ));
+        else
+        {
+            KFileAddRef ( sf );
+            KFileAddRef ( out );
+            rc = KFileRelease ( tee );
+            if ( rc != 0 )
+                PLOGERR (klogInt,
+                         (klogInt, rc,
+                          "failed to close extract tee file on '$(path)'",
+                          "path=%s", path));
+            else if (!xml_dir)
+            {
+                CCCachedFileNode * np;
+
+                rc = CCCachedFileNodeMake (&np, path, ccCached, NULL );
+                if ( rc != 0 )
+                    LOGERR ( klogInt, rc, "failed to create cached extract file node" );
+                else
+                {
+                    rc = CCTreeInsert (etree, 0, ccFile, NULL, path);
+                    if ( rc != 0 )
+                        LOGERR ( klogInt, rc, "failed to record cached extract file" );
+                }
+            }
+        }
+        KFileRelease ( out );
+    }
+
+    return rc;
+}
+
+static
+rc_t ccat_arc ( CCContainerNode **np, const KFile *sf, KTime_t mtime,
+                enum CCType ntype, CCFileNode *node, const char *name, uint32_t type_id )
+{
+    rc_t rc /*, orc */;
+
+    /* ensure we handle this type of archive */
+    switch ( type_id )
+    {
+    case ccfftaSra:
+#if ! EXAMINE_KAR_FILES
+        * np = NULL;
+        return 0;
+#endif
+    case ccfftaHD5:
+        * np = NULL;
+        return 0;
+    case ccfftaTar:
+        break;
+    default:
+        /* don't recognize archive format - treat as a normal file */
+        PLOGMSG ( klogWarn, ( klogWarn, "archive '$(name)' type '$(ftype)' will not be analyzed: "
+                              "unknown format", "name=%s,ftype=%s", name, node -> ftype ));
+        * np = NULL;
+        return 0;
+    }
+
+    /* create container node */
+    rc = CCContainerNodeMake ( np, ntype, node );
+    if ( rc != 0 )
+        LOGERR ( klogInt, rc, "failed to create container node" );
+    else
+    {
+        CCContainerNode *cont = * np;
+
+        /* orc = 0; */
+        switch ( type_id )
+        {
+        case ccfftaTar:
+            /* orc = */ ccat_tar ( cont, sf, name );
+            break;
+        case ccfftaSra:
+            /* orc = */ ccat_sra (cont, sf, name);
+            break;
+        }
+    }
+
+    return rc;
+}
+
+static
+rc_t ccat_enc ( CCContainerNode **np, const KFile *sf, KTime_t mtime,
+                enum CCType ntype, CCFileNode *node, const char *name,
+                uint32_t type_id )
+{
+    rc_t rc = 0;
+    const KFile *df;
+    uint64_t expected = SIZE_UNKNOWN;      /* assume we won't know */
+
+    switch ( type_id )
+    {
+    case ccffteNCBI:
+        if (!src_pw_read)
+        {
+            rc = get_password (src_path, src_pwd, sizeof src_pwd, &src_pwd_sz, &src_key, &src_pw_read);
+            if (rc)
+            {
+            validate_instead:
+                rc = KFileAddRef (sf);
+                if (rc == 0)
+                {
+                    PLOGMSG ( klogWarn, ( klogWarn, "file '$(name)' type '$(ftype)' will be validated but not be decoded: "
+                                          "no password given", "name=%s,ftype=%s", name, node -> ftype ));
+                    /* can't decompress it - treat it as a normal file */
+                    rc = KEncFileValidate (sf);
+                    if (rc)
+                    {
+                        memmove (node->ftype + sizeof "Errored" - 1, node->ftype, strlen (node->ftype));
+                        memmove (node->ftype, "Errored", sizeof "Errored" - 1);
+                    }
+                    * np = NULL;
+                    return 0;
+                }
+                return rc;
+            }
+        }
+        rc = KEncFileMakeRead (&df, sf, &src_key);
+        if (rc)
+            goto validate_instead;
+        break;
+
+    case ccffteWGA:
+        if (!wga_pw_read)
+            rc = wga_password (src_path, wga_pwd, sizeof wga_pwd, &wga_pwd_sz, &wga_pw_read);
+        if (rc == 0)
+        {
+            rc = KFileMakeWGAEncRead (&df, sf, wga_pwd, wga_pwd_sz);
+            break;
+        }
+        /* can't decompress it - treat it as a normal file */
+        PLOGMSG ( klogWarn, ( klogWarn, "file '$(name)' type '$(ftype)' will not be decoded: "
+                              "no password given", "name=%s,ftype=%s", name, node -> ftype ));
+        * np = NULL;
+        return 0;
+        
+    default:
+        /* can't decrypt it - treat it as a normal file */
+        PLOGMSG ( klogWarn, ( klogWarn, "file '$(name)' type '$(ftype)' will not be decoded: "
+                              "unknown encoding format", "name=%s,ftype=%s", name, node -> ftype ));
+        * np = NULL;
+        return 0;
+    }
+
+    if ( rc != 0 )
+        PLOGERR ( klogInt,  (klogInt, rc, "failed to decode file '$(path)'", "path=%s", name ));
+    else
+    {
+        rc = CCContainerNodeMake ( np, ntype, node );
+        if ( rc != 0 )
+            LOGERR ( klogInt, rc, "failed to create container node" );
+        else
+        {
+            CCContainerNode *cont = * np;
+            CCFileNode *nnode;
+
+            /* now create a new contained file node */
+            rc = CCFileNodeMake ( & nnode, expected );
+            if ( rc != 0 )
+                LOGERR ( klogInt, rc, "failed to create contained file node" );
+            else
+            {
+                int len;
+                char newname [ 256 ];
+
+                /* invent a new name for file */
+                const char *ext = strrchr ( name, '.' );
+                if ( ext == NULL )
+                    len = snprintf ( newname, sizeof newname, "%s", name );
+                else
+                    len = snprintf ( newname, sizeof newname, "%.*s", ( int ) ( ext - name ), name );
+
+                if ( len < 0 || len >= sizeof newname )
+                {
+                    rc = RC ( rcExe, rcNode, rcConstructing, rcName, rcExcessive );
+                    LOGERR ( klogErr, rc, "failed to create contained file node" );
+                }
+                else
+                {
+                    void * save;
+                    const KFile * cf;
+                    /* rc_t krc; */
+
+                    copycat_log_set (&node->logs, &save);
+
+                    rc = CCFileMakeRead (&cf, df, &node->rc);
+                    if (rc == 0)
+                    {
+                        /* recurse with buffer on decoding */
+                        /* krc = */ ccat_buf ( & cont -> sub, cf, mtime,
+                                         ccContFile, nnode, newname);
+
+                        KFileRelease (cf);
+                        /* if successful, "node" ( allocated locally above )
+                           will have been entered into "cont->sub" */
+                    }
+
+                    copycat_log_set (&save, NULL);
+                }
+            }
+        }
+
+        KFileRelease ( df );
+    }
+
+    return rc;
+}
+
+static
+rc_t ccat_cmp ( CCContainerNode **np, const KFile *sf, KTime_t mtime,
+                enum CCType ntype, CCFileNode *node, const char *name, uint32_t type_id )
+{
+    const KFile *zf;    
+    /* use a variable incase we ever get a compression that can be queried 
+     * about file size */
+    uint64_t expected = SIZE_UNKNOWN;
+    rc_t rc;
+
+    switch ( type_id )
+    {
+
+    case ccfftcGzip:
+        /* this code attaches a new reference to "sf" */
+        rc = KFileMakeGzipForRead ( & zf, sf );
+        break;
+    case ccfftcBzip2:
+        /* this code attaches a new reference to "sf" */
+        rc = KFileMakeBzip2ForRead ( & zf, sf );
+        break;
+    default:
+        /* can't decompress it - treat it as a normal file */
+        PLOGMSG ( klogWarn, ( klogWarn, "file '$(name)' type '$(ftype)' will not be decompressed: "
+                              "unknown compression format", "name=%s,ftype=%s", name, node -> ftype ));
+        * np = NULL;
+        return 0;
+    }
+
+    if ( rc != 0 )
+        PLOGERR ( klogInt,  (klogInt, rc, "failed to decompress file '$(path)'", "path=%s", name ));
+    else
+    {
+        rc = CCContainerNodeMake ( np, ntype, node );
+        if ( rc != 0 )
+            LOGERR ( klogInt, rc, "failed to create container node" );
+        else
+        {
+            CCContainerNode *cont = * np;
+            CCFileNode *nnode;
+
+            /* now create a new contained file node */
+            rc = CCFileNodeMake ( & nnode, expected );
+            if ( rc != 0 )
+                LOGERR ( klogInt, rc, "failed to create contained file node" );
+            else
+            {
+                int len;
+                char newname [ 256 ];
+
+                /* invent a new name for file */
+                const char *ext = strrchr ( name, '.' );
+                if ( ext == NULL )
+                    len = snprintf ( newname, sizeof newname, "%s", name );
+                else if ( strcasecmp ( ext, ".tgz" ) == 0 )
+                    len = snprintf ( newname, sizeof newname, "%.*s.tar", ( int ) ( ext - name ), name );
+                else
+                    len = snprintf ( newname, sizeof newname, "%.*s", ( int ) ( ext - name ), name );
+
+                if ( len < 0 || len >= sizeof newname )
+                {
+                    rc = RC ( rcExe, rcNode, rcConstructing, rcName, rcExcessive );
+                    LOGERR ( klogErr, rc, "failed to create contained file node" );
+                }
+                else
+                {
+                    void * save;
+                    const KFile * cf;
+                    /* rc_t krc; */
+
+                    copycat_log_set (&nnode->logs, &save);
+
+                    rc = CCFileMakeRead (&cf, zf, &node->rc);
+                    if (rc == 0)
+                    {
+                        /* recurse with buffer on decompression */
+                        /* krc = */ ccat_buf (& cont -> sub, cf, mtime,
+                                        ccContFile, nnode, newname);
+
+                        KFileRelease (cf);
+                        /* if successful, "node" ( allocated locally above )
+                           will have been entered into "cont->sub" */
+                    }
+
+                    copycat_log_set (save, NULL);
+                }
+            }
+        }
+
+        KFileRelease ( zf );
+    }
+
+    return rc;
+}
+
+static
+rc_t ccat_path_append (const char * name)
+{
+    size_t z;
+    z = string_size (name);
+    DEBUG_STATUS (("%s:in epath %s name %s z %zu \n",__func__, epath, name, z));
+    if (ehere + z + 1 >= epath + sizeof (epath))
+        return RC (rcExe, rcNoTarg, rcConcatenating, rcBuffer, rcTooShort);
+    memcpy(ehere, name, z);
+    ehere += z;
+    *ehere++ = '/';
+    *ehere = '\0';
+    DEBUG_STATUS (("%s: out name %s epath %s\n",__func__,name, epath));
+    return 0;
+}
+
+static
+rc_t ccat_main ( CCTree *tree, const KFile *sf, KTime_t mtime,
+                 enum CCType ntype, CCFileNode *node, const char *name )
+{
+    /* the pointer e_go_back allows us to remove additions to the stored
+     * path built up as we descend into deeper container/archive/directories */
+    char * e_go_back = ehere;
+
+    /* determine file type based upon contents and name */
+    uint32_t type_id, class_id;
+/*     rc_t orc; */
+    rc_t rc = CCFileFormatGetType ( filefmt, sf, name,
+                                    node -> ftype, sizeof node -> ftype, & type_id, & class_id );
+
+    DEBUG_STATUS (("%s: name '%s' type '%s'\n",__func__,name,node->ftype));
+
+    if ( rc != 0 )
+        PLOGERR ( klogErr,  (klogErr, rc, "failed to determine type of file '$(path)'", "path=%s", name ));
+    else
+    {
+        /* file could be a container */
+        CCContainerNode *cont;
+        CCCachedFileNode *cfile;
+
+        /* assume this node will get name */
+        void *entry = node;
+
+        bool xml_insert = false;
+        bool tee_done = false;
+        /* create path */
+        const char * basename;
+        char path [ 8192 + 256 ];
+
+        if ((basename = strrchr (name, '/')) != NULL)
+            ++basename;
+        else
+            basename = name;
+
+
+        /* look for special files */
+        switch ( class_id )
+        {
+        case ccffcEncoded:
+            rc = ccat_path_append (name);
+            if (rc == 0)
+            {
+                rc = ccat_enc ( & cont, sf, mtime, ntype, node, basename, type_id );
+                if ( rc == 0 && cont != NULL )
+                {
+                    ntype = ccContainer;
+                    entry = cont;
+                }
+            }
+            ehere = e_go_back;
+            *ehere = '\0';
+            break;
+        case ccffcCompressed:
+            rc = ccat_path_append (name);
+            if (rc == 0)
+            {
+                rc = ccat_cmp ( & cont, sf, mtime, ntype, node, basename, type_id );
+                if ( rc == 0 && cont != NULL )
+                {
+                    ntype = ccContainer;
+                    entry = cont;
+                }
+            }
+            ehere = e_go_back;
+            *ehere = '\0';
+            break;
+        case ccffcArchive:
+            rc = ccat_path_append (name);
+            if (rc == 0)
+            {
+                rc = ccat_arc ( & cont, sf, mtime, ntype, node, basename, type_id );
+                if ( rc == 0 && cont != NULL )
+                {
+                    ntype = ccArchive;
+                    entry = cont;
+                }
+            }
+            ehere = e_go_back;
+            *ehere = '\0';
+            break;
+        case ccffcCached:
+            if ( cdir != NULL )
+            {
+                rc = ccat_cache ( & cfile, sf, ntype, node, basename );
+                if ( rc == 0 && cont != NULL )
+                {
+                    tee_done = true;
+                    ntype = ccCached;
+                    entry = cfile;
+                }
+            }
+            /* fall through */
+        default:
+            rc = ccat_extract_path (path, sizeof path, name);
+            DEBUG_STATUS (("%s: extract_path '%s'\n",__func__,path));
+            if ((edir != NULL) && (! tee_done))
+            {
+                rc = ccat_extract (sf, path);
+                if (rc == 0)
+                    tee_done = true;
+            }
+            if (rc == 0)
+            {
+                xml_insert = true;
+            }
+            if (!tee_done)
+            {
+                const KFile * cf;
+
+                rc = CCFileMakeRead (&cf, sf, &node->rc);
+                if (rc == 0)
+                {
+                    const KFile * tee;
+
+                    rc = KFileMakeTeeRead (&tee, cf, fnull);
+                    if (rc == 0)
+                    {
+                        rc = KFileAddRef (fnull);
+
+                        KFileRelease (tee);
+                    }
+                }
+            }
+            break;
+        }
+
+        /* create entry into tree */
+        if ( rc == 0 )
+        {
+            if (! xml_dir)
+            {
+                DEBUG_STATUS (("%s: ready to insert '%s'\n",__func__,name));
+                rc = CCTreeInsert ( tree, mtime, ntype, entry, name );
+                /* if we are extracting create a name node with other information being incorrect */
+                if (edir != NULL)
+                {
+                }
+            }
+            else if (xml_insert)
+            {
+                DEBUG_STATUS (("%s: ready to insert '%s' for '%s'\n",__func__,path, name));
+                rc = CCTreeInsert (etree, mtime, ntype, entry, path);
+            }
+
+            if ( rc != 0 )
+                PLOGERR (klogInt,  (klogInt, rc,
+                                    "failed to enter node '$(name)'",
+                                    "name=%s", name ));
+        }
+    }
+
+    return rc;
+}
+
+static
+rc_t ccat_sz ( CCTree *tree, const KFile *sf, KTime_t mtime,
+               enum CCType ntype, CCFileNode *node, const char *name )
+{
+    /* create a counting file to fill out its size */
+    const KFile *sz;
+    rc_t rc, orc;
+
+    rc = KFileMakeCounterRead ( & sz, sf, & node -> size, & node -> lines, true );
+
+
+    if ( rc != 0 )
+        PLOGERR ( klogInt,  (klogInt, rc, "failed to create counting wrapper for '$(path)'", "path=%s", name ));
+    else
+    {
+        /* give the wrapper its own reference
+           rather than taking the one we gave it */
+        rc = KFileAddRef ( sf );
+        if (rc)
+            PLOGERR (klogInt, 
+                     (klogInt, rc, "Error in reference counting for '$(path)'", "path=%s", name ));
+        else
+            /* the main catalog function */
+            rc = ccat_main ( tree, sz, mtime, ntype, node, name );
+
+        /* release the sizer */
+        orc = KFileRelease ( sz );
+        if (orc)
+        {
+            PLOGERR (klogInt, 
+                     (klogInt, orc, "Error in closing byte counting for '$(path)'", "path=%s", name ));
+            if (rc == 0)
+                rc = orc;
+        }
+    }
+
+    return rc;
+}
+
+rc_t ccat_md5 ( CCTree *tree, const KFile *sf, KTime_t mtime,
+                enum CCType ntype, CCFileNode *node, const char *name )
+{
+    /* all files have an MD5 hash for identification.
+       the following code is for expediency.
+       we already have a formatter for output,
+       and to reuse it we simply pipe its output
+       to /dev/null, so to speak */
+    KMD5SumFmt *fmt;
+    rc_t rc, orc;
+
+    /* NEW - there are some cases where md5sums would not be useful
+       and only take up CPU power. */
+    if ( no_md5 )
+        return ccat_sz ( tree, sf, mtime, ntype, node, name );
+
+    /* normal md5 path */
+    rc = KMD5SumFmtMakeUpdate ( & fmt, fnull );
+    if ( rc != 0 )
+        PLOGERR ( klogInt,  (klogInt, rc, "failed to create md5sum formatter for '$(path)'", "path=%s", name ));
+    else
+    {
+        const KFile *md5;
+
+        /* give another fnull reference to formatter */
+        rc = KFileAddRef ( fnull );
+        if (rc)
+            LOGERR (klogInt, rc, "Error referencing MD5 format file");
+        else
+        {
+
+            /* this is the wrapper that calculates MD5 */
+            rc = KFileMakeNewMD5Read ( & md5, sf, fmt, name );
+            if ( rc != 0 )
+                PLOGERR ( klogInt,  (klogInt, rc, "failed to create md5 wrapper for '$(path)'", "path=%s", name ));
+            else
+            {
+                /* give the wrapper its own reference
+                   rather than taking the one we gave it */
+                rc = KFileAddRef ( sf );
+                if (rc)
+                    PLOGERR (klogInt,
+                             (klogInt, rc,
+                              "failure in reference counting file for '$(path)'",
+                              "path=%s", name ));
+                else
+                {
+                    /* continue on to obtaining file size */
+                    rc = ccat_sz ( tree, md5, mtime, ntype, node, name );
+
+                    /* this will drop the MD5 calculator, but not
+                       its source file, and cause the digest to be
+                       written to its formatter */
+                    orc = KFileRelease ( md5 );
+                    if (orc)
+                    {
+                        PLOGERR (klogInt,
+                                 (klogInt, rc,
+                                  "failure in release reference counting file for '$(path)'",
+                                  "path=%s", name ));
+                        if (rc == 0)
+                            rc = orc;
+                    }
+
+                    /* if there were no errors, read the MD5 from formatter.
+                       this must be done AFTER releasing the MD5 file,
+                       or nothing will ever get written */
+                    if ( rc == 0 )
+                    {
+                        bool bin;
+                        rc = KMD5SumFmtFind ( fmt, name, node -> _md5, & bin );
+                    }
+                }
+            }
+        }
+
+        /* dump the formatter, but not fnull */
+        orc = KMD5SumFmtRelease ( fmt );
+        if (orc)
+        {
+            PLOGERR (klogInt,
+                     (klogInt, rc,
+                      "failure in releasing  MD5 format file for '$(path)'",
+                      "path=%s", name ));
+            if (rc == 0)
+                rc = orc;
+        }
+    }
+
+    return rc;
+}
+
+/* buffered recursion entrypoint */
+rc_t ccat_buf ( CCTree *tree, const KFile *sf, KTime_t mtime,
+                enum CCType ntype, CCFileNode *node, const char *name )
+{
+    /* create a buffered file to counter random access */
+    const KFile *buf;
+    rc_t rc, orc;
+
+#if USE_KBUFFILE
+    rc = KBufFileMakeRead (&buf, sf, 2 * 32 * 1024);
+#else
+    rc = KFileMakeReadHead (&buf, sf, 4096);
+#endif
+    if ( rc != 0 )
+        PLOGERR ( klogInt,  (klogInt, rc,
+                             "failed to create buffer for '$(path)'",
+                             "path=%s", name ));
+    else
+    {
+        /* skip ccat */
+        rc = ccat_md5 ( tree, buf, mtime, ntype, node, name );
+
+        /* release the buffer */
+        orc = KFileRelease ( buf );
+        if (orc)
+        {
+            PLOGERR (klogInt, (klogInt, orc, "Error closing buffer for '$(path)'", "path=%s", name ));
+            if (rc == 0)
+                rc = orc;
+        }
+    }
+    return rc;
+}
+
+
+typedef struct copycat_pb
+{
+    CCTree * tree;
+    const KFile * sf;
+    KFile * df;
+    KTime_t mtime;
+    enum CCType ntype;
+    CCFileNode * node;
+    const char * name;
+} copycat_pb;
+
+
+rc_t copycat_add_tee (const copycat_pb * ppb)
+{
+    const KFile * tee;
+    rc_t rc, orc;
+
+    rc = KFileMakeTeeRead (&tee, ppb->sf, ppb->df);
+    if (rc)
+        PLOGERR (klogInt,  
+                 (klogInt, rc, "failed to create encrypter for '$(path)'",
+                  "path=%s", ppb->name ));
+    else
+    {
+        rc = KFileAddRef (ppb->df);
+        if (rc)
+            LOGERR (klogInt, rc, "Reference counting error");
+        else
+        {
+            rc = KFileAddRef (ppb->sf);
+            if (rc)
+                LOGERR (klogInt, rc, "Reference counting error");
+            else
+            {
+                orc = ccat_md5 (ppb->tree, tee, ppb->mtime, ppb->ntype, ppb->node, ppb->name);
+
+                /* report? */
+                orc = KFileRelease (tee);
+                if (orc)
+                    PLOGERR (klogInt, 
+                             (klogInt, orc,
+                              "Error in closing byte counting for '$(path)'",
+                              "path=%s", ppb->name ));
+
+/*                 orc = KFileRelease (ppb->sf); */
+/*                 if (orc) */
+/*                     PLOGERR (klogInt,  */
+/*                              (klogInt, orc, */
+/*                               "Error in closing byte counting of tee source for '$(path)'", */
+/*                               "path=%s", ppb->name )); */
+            }
+/*             orc = KFileRelease (ppb->df); */
+/*             if (orc) */
+/*                 PLOGERR (klogInt,  */
+/*                          (klogInt, orc, */
+/*                           "Error in closing byte counting of tee destination for '$(path)'", */
+/*                           "path=%s", ppb->name )); */
+        }       
+    }
+    return rc;
+}
+
+
+static
+rc_t copycat_add_node (const copycat_pb * ppb)
+{
+    rc_t rc;
+
+    rc = ccat_path_append (ppb->name);
+    if (rc == 0)
+    {
+        CCContainerNode *cont;
+
+        /* make a container node for the encrypted output file */
+        rc = CCContainerNodeMake (&cont, ccFile, ppb->node);
+        if (rc)
+        {
+            PLOGERR (klogInt,
+                     (klogInt, rc, "error creating container node for '$(path)'",
+                      "path=%s", ppb->name));
+        }
+        else
+        {
+            copycat_pb pb = *ppb;
+            uint64_t expected = /*(ppb->node->expected != SIZE_UNKNOWN)
+                                  ? ppb->node->expected :*/ SIZE_UNKNOWN;
+            pb.tree = &cont->sub;
+
+            /* this will be the node for the unencrypted version of the output file */
+            rc = CCFileNodeMake (&pb.node, expected );
+            if (rc)
+                LOGERR (klogInt, rc, "failed to create contained node");
+            else
+            {
+                void * save;
+                size_t len;
+                size_t elen;
+                size_t clen;
+                rc_t orc;
+                char name [ 1024 ];
+
+                len = strlen (pb.name);
+                elen = strlen (ncbi_encryption_extension);
+                clen = len - elen;
+
+                /* 
+                 *if the name had .ncbi_enc at the end remove it
+                 * for the inner node.
+                 */
+                if (strcmp (ncbi_encryption_extension, pb.name + clen) == 0)
+                {
+                    memcpy (name, pb.name, clen);
+                    name[clen] = '\0';
+                }
+                /*
+                 * if it did not, prepend '.' to the name
+                 */
+                else
+                {
+                    name[0] = '.';
+                    if (len > sizeof name - 2)
+                        len = sizeof name - 2;
+                    strncpy (name+1, pb.name, len);
+                    name[len+1] = '\0';
+                }
+                pb.name = name;
+
+                copycat_log_set (&pb.node->logs, &save);
+
+                rc = copycat_add_tee (&pb);
+
+                copycat_log_set (save, NULL);
+
+                orc = CCTreeInsert (ppb->tree, ppb->mtime, ccContainer, cont, ppb->name);
+
+                if (rc == 0)
+                    rc = orc;
+            }
+        }
+    }
+    return rc;
+}
+
+/* -----
+ * copycat_add_enc
+ *
+ * add an encryptor to the copy chain
+ */
+rc_t copycat_add_enc (const copycat_pb * ppb)
+{
+    copycat_pb pb = *ppb;
+    rc_t rc = 0;
+
+    if (!dst_pw_read)
+        rc = get_password (dst_path, dst_pwd, sizeof dst_pwd, &dst_pwd_sz, &dst_key, &dst_pw_read);
+    if (rc)
+        return rc;
+
+    rc = KEncFileMakeWrite (&pb.df, ppb->df, &dst_key);
+    if (rc)
+        PLOGERR (klogInt,
+                 (klogInt, rc, "failed to create encrypter for '$(path)'",
+                  "path=%s", pb.name ));
+    else
+    {
+        strncpy (pb.node->ftype, "Encoded/NCBI", sizeof pb.node->ftype);
+
+
+        /* add the container to the cataloging tree */
+        rc = copycat_add_node (&pb);
+        if (rc == 0)
+        {
+            rc = KFileRelease (pb.df);
+            if (rc)
+            {
+                PLOGERR (klogInt, 
+                         (klogInt, rc,
+                          "Error in closing byte counting for '$(path)'",
+                          "path=%s", pb.name ));
+            }
+        }
+    }
+    return rc;
+}
+
+
+/* -----
+ * copycat_add_sz
+ *
+ * if we are encrypting the output we need to do an actual byte count across the
+ * write side of the encryption so we add a filter into the copy chain.  If we
+ * are not encrypting we do this calculation in the ccat chain for the outside file
+ * and never reach this function.
+ */
+rc_t copycat_add_sz (const copycat_pb * ppb)
+{
+    /* create a counting file to fill out its size */
+    copycat_pb pb = *ppb;
+    rc_t rc, orc;
+
+    rc = KFileMakeCounterWrite (&pb.df, ppb->df, &pb.node->size, &pb.node->lines, true);
+    if (rc)
+        PLOGERR (klogInt,
+                 (klogInt, rc,
+                  "failed to create counting wrapper for '$(path)'",
+                  "path=%s", pb.name ));
+    else
+    {
+        /* give the wrapper its own reference
+           rather than taking the one we gave it */
+        rc = KFileAddRef ( ppb->df );
+        if (rc)
+            PLOGERR (klogInt, 
+                     (klogInt, rc, "Error in reference counting for '$(path)'",
+                      "path=%s", pb.name));
+        else
+            rc = copycat_add_enc (&pb);
+
+        /* release the sizer */
+        orc = KFileRelease (pb.df);
+        if (orc)
+        {
+            PLOGERR (klogInt, 
+                     (klogInt, orc, "Error in closing byte counting "
+                      "(probable read error) for '$(path)'", "path=%s",
+                      pb.name ));
+            /* a failure in the counter destructor might mean a failure
+             * in the copy so return the error */
+            if (rc == 0)
+                rc = orc;
+        }
+    }
+
+    return rc;
+}
+
+
+/* -----
+ * copycat_add_md5
+ *
+ * if we are encrypting the output we need to do an md5 calculation across the
+ * write side of the encryption so we add a filter into the copy chain.  If we
+ * are not encrypting we do the md5 calculation in the ccat chain for the outside file
+ * and never reach this function.
+ */
+rc_t copycat_add_md5 (const copycat_pb * ppb)
+{
+    /* all files have an MD5 hash for identification.
+       the following code is for expediency.
+       we already have a formatter for output,
+       and to reuse it we simply pipe its output
+       to /dev/null, so to speak */
+    KMD5SumFmt *fmt;
+    rc_t rc;
+
+    if ( no_md5 )
+        return copycat_add_sz (ppb);
+
+    rc = KMD5SumFmtMakeUpdate (&fmt, fnull);
+    if ( rc != 0 )
+        PLOGERR (klogInt,
+                 (klogInt, rc,
+                  "failed to create md5sum formatter for '$(path)'",
+                  "path=%s", ppb->name ));
+    else
+    {
+        rc_t orc;
+        /* give another fnull reference to formatter */
+        rc = KFileAddRef (fnull);
+        if (rc)
+            LOGERR (klogInt, rc, "Error referencing MD5 format file");
+        else
+        {
+            copycat_pb pb = *ppb;
+
+            /* this is the wrapper that calculates MD5 */
+            rc = KMD5FileMakeWrite ((struct KMD5File**)&pb.df, ppb->df, fmt, ppb->name );
+            if ( rc != 0 )
+                PLOGERR (klogInt,
+                         (klogInt, rc,
+                          "failed to create md5 wrapper for '$(path)'",
+                          "path=%s", ppb->name ));
+            else
+            {
+                /* give the wrapper its own reference
+                   rather than taking the one we gave it */
+                rc = KFileAddRef (ppb->df);
+                if (rc)
+                    PLOGERR (klogInt,
+                             (klogInt, rc,
+                              "failure in reference counting file for '$(path)'",
+                              "path=%s", ppb->name ));
+                else
+                    /* continue on to obtaining file size */
+                    rc = copycat_add_sz (&pb);
+
+                /* this will drop the MD5 calculator, but not
+                   its source file, and cause the digest to be
+                   written to its formatter */
+                orc = KFileRelease (pb.df);
+                if (orc)
+                {
+                    PLOGERR (klogInt,
+                             (klogInt, orc,
+                              "failure in releasing md5 calculation file for '$(path)'",
+                              "path=%s", ppb->name ));
+                }
+
+                /* if there were no errors, read the MD5 from formatter.
+                   this must be done AFTER releasing the MD5 file,
+                   or nothing will ever get written */
+                if (orc == 0)
+                {
+                    bool bin;
+                    orc = KMD5SumFmtFind (fmt, ppb->name, ppb->node->_md5, &bin);
+                    if (orc)
+                        PLOGERR (klogWarn,
+                                 (klogWarn, orc,
+                                  "Error in obtaining the MD5 for '$(path)'",
+                                  "path=%s", pb.name));
+                }
+            }
+        }
+
+        /* dump the formatter, but not fnull */
+        orc = KMD5SumFmtRelease (fmt);
+        if (orc)
+        {
+            PLOGERR (klogInt,
+                     (klogInt, rc,
+                      "failure in releasing  MD5 format file for '$(path)'",
+                      "path=%s", ppb->name ));
+            /* we can 'forget' this error after logging it */
+            if (rc == 0)
+                rc = orc;
+        }
+    }
+
+    return rc;
+}
+
+/* -----
+ * copycat_add_crc
+ *
+ * this is the first function in building the write side of the copy chain
+ *
+ * We calculate a crc on the outgoing file and none of the interior files
+ * and we do that at this point in the chain regardless of whether we will
+ * encrypt the outgoing file.
+ *
+ * We'll add the crc calculator to the write side stream and then decide
+ * whether to add an encryptor into the chain.  We add one to the write side
+ * of the chain if we have an encrypting password or jump to finishing the
+ * copy chain if we do not
+ */
+rc_t copycat_add_crc (const  copycat_pb * ppb)
+{
+    /* external files have a CRC32 checksum
+       the following code is for expediency.
+       we already have a formatter for output,
+       and to reuse it we simply pipe its output
+       to /dev/null, so to speak */
+    rc_t rc;
+    KCRC32SumFmt * fmt; 
+
+    rc = KCRC32SumFmtMakeUpdate ( &fmt, fnull );
+    if ( rc != 0 )
+        PLOGERR (klogInt,
+                 (klogInt, rc,
+                  "failed to create crc32sum formatter for '$(path)'",
+                  "path=%s", ppb->name ));
+    else
+    {
+        rc_t orc = 0;
+
+        /* give another fnull reference to formatter */
+        rc = KFileAddRef ( fnull );
+        if (rc)
+            PLOGERR (klogInt,
+                     (klogInt, rc, 
+                      "error in reference counting crc formatter fnull for '$(path)'",
+                      "path=%s", ppb->name ));
+        else
+        {
+            copycat_pb pb = *ppb;
+
+            /* this is the wrapper that calculates CRC32 */
+            rc = KCRC32FileMakeWrite ( (KCRC32File**)&pb.df, ppb->df, fmt, ppb->name );
+            if ( rc != 0 )
+                PLOGERR (klogInt,
+                         (klogInt, rc,
+                          "failed to create crc32 wrapper for '$(path)'",
+                          "path=%s", ppb->name ));
+            else
+            {
+                /* give the wrapper its own reference
+                   rather than taking the one we gave it */
+                rc = KFileAddRef (ppb->df);
+                if (rc)
+                    PLOGERR (klogInt,
+                             (klogInt, rc, 
+                              "error in reference counting file for '$(path)'",
+                              "path=%s", ppb->name ));
+                else if (do_encrypt)
+                {
+                    /* add in the size of the enc header */
+                    if (pb.node->expected != SIZE_UNKNOWN)
+                    {
+                        uint64_t temp;
+
+                        temp = pb.node->expected; /* current expected count */
+
+                        temp += (ENC_DATA_BLOCK_SIZE - 1); /* add enough to fill last block */
+                        temp /= ENC_DATA_BLOCK_SIZE; /* how many blocks */
+                        temp *= sizeof (KEncFileBlock); /* size of encrypted blocks */
+                        temp += sizeof (KEncFileHeader) + sizeof (KEncFileFooter);
+                        pb.node->expected = temp;
+                    }
+                    rc = copycat_add_md5 (&pb);
+                }
+                else
+                    rc = copycat_add_tee (&pb);
+
+                /* this will drop the CRC calculator, but not
+                   its source file, and cause the CRC to be
+                   written to its formatter */
+                orc = KFileRelease (pb.df);
+                if (orc)
+                {
+                    LOGERR (klogErr, orc, "Error closing out crc calculator");
+                    /* an error her implies an error in the copy so report it */
+                    rc = orc;
+                }
+            }
+            /* if there were no errors, read the CRC from formatter.
+               this must be done AFTER releasing the CRC file,
+               or nothing will ever get written */
+            if ( orc == 0 )
+            {
+                bool bin;
+                orc = KCRC32SumFmtFind ( fmt, ppb->name, &pb.node->crc32, &bin );
+                if (orc)
+                    PLOGERR (klogWarn,
+                             (klogWarn, orc,
+                              "Error in obtaining the CRC for '$(path)'",
+                              "path=%s", pb.name));
+                /* an error her isn't an error in copy */
+            }
+        }
+        /* dump the formatter, but not fnull */
+        orc = KCRC32SumFmtRelease ( fmt );
+        if (orc)
+            LOGERR (klogWarn, orc, "Error closing off CRC storage");
+        /* this error we do not need to track */
+        if (rc == 0)
+            rc = orc;
+    }
+    return rc;
+}
+
+
+/* -----
+ * copycat_add_buf2
+ *
+ * This function adds buffering to the outermostDecrypted file read so that we
+ * can read the first portion of the file for file type analysis and then
+ * re-read it for cataloging.
+ *
+ * At this point the only file type analysis needed is to determine
+ * whether we have in incoming encrypted file We've already checked for
+ * the existence of the key or we wouldn't get here.
+ */
+rc_t copycat_add_buf2 (const copycat_pb * ppb)
+{
+    copycat_pb pb = *ppb;
+    rc_t rc = 0;
+
+    /* create a buffered file to allow re-reading of the first 128 bytes
+     * a tad overkill */
+#if USE_KBUFFILE
+    rc = KBufFileMakeRead (&pb.sf, ppb->sf, 2*32*1024);
+#else
+    rc = KFileMakeReadHead (&pb.sf, ppb->sf, 4*1024);
+#endif
+    if (rc)
+    {
+        PLOGERR (klogInt,  
+                 (klogInt, rc,
+                  "failed to create buffer for '$(path)'",
+                  "path=%s", pb.name ));
+    }
+    else
+    {
+        rc_t orc;
+
+        rc = copycat_add_crc (&pb);
+
+        orc = KFileRelease (pb.sf);
+        if (orc)
+            PLOGERR (klogInt,  
+                     (klogInt, orc,
+                      "failed to read buffer for '$(path)'",
+                      "path=%s", pb.name ));
+    }
+    return rc;
+}
+
+
+/* -----
+ * copycat_add_dec
+ *
+ * add a decryption to the read side of the copy chain.
+ * no other decisions made here
+ */
+rc_t copycat_add_dec_ncbi (const copycat_pb * ppb)
+{
+    copycat_pb pb = *ppb;
+    rc_t rc = 0;
+
+    if (!src_pw_read)
+        rc = get_password (src_path, src_pwd, sizeof src_pwd, &src_pwd_sz, &src_key, &src_pw_read);
+
+    if (rc == 0)
+    {
+        rc = KEncFileMakeRead (&pb.sf, ppb->sf, &src_key);
+        if (rc)
+            PLOGERR (klogInt,  
+                     (klogInt, rc,
+                      "failed to create decrypter for '$(path)'",
+                      "path=%s", pb.name ));
+    }
+    if (rc == 0)
+    {
+        rc_t orc;
+
+        /* this decryption won't know its output size until it gets there */
+        pb.node->expected = SIZE_UNKNOWN;
+        rc = copycat_add_buf2 (&pb);
+        orc = KFileRelease (pb.sf);
+        if (orc)
+            PLOGERR (klogInt,  
+                     (klogInt, orc,
+                      "failed to close decrypter for '$(path)'",
+                      "path=%s", pb.name ));
+    }
+    return rc;
+}
+
+rc_t copycat_add_dec_wga (const copycat_pb * ppb)
+{
+    copycat_pb pb = *ppb;
+    rc_t rc = 0;
+
+    if (!src_pw_read)
+        rc = wga_password (src_path, src_pwd, sizeof src_pwd, &src_pwd_sz, &src_pw_read);
+
+    if (rc == 0)
+    {
+        rc = KFileMakeWGAEncRead (&pb.sf, ppb->sf, src_pwd, src_pwd_sz);
+        if (rc)
+            PLOGERR (klogInt,  
+                     (klogInt, rc,
+                      "failed to create decrypter for '$(path)'",
+                      "path=%s", pb.name ));
+    }
+    if (rc == 0)
+    {
+        rc_t orc;
+
+        if (pb.node->expected != SIZE_UNKNOWN)
+            pb.node->expected -= 128; /* subtract off the size of the WGA header */
+        rc = copycat_add_buf2 (&pb);
+        orc = KFileRelease (pb.sf);
+        if (orc)
+            PLOGERR (klogInt,  
+                     (klogInt, orc,
+                      "failed to close decrypter for '$(path)'",
+                      "path=%s", pb.name ));
+    }
+    return rc;
+}
+
+/* -----
+ * copycat_add_dec
+ *
+ * At this point the only file type analysis needed is to determine
+ * whether we have in incoming encrypted file We've already checked for
+ * the existence of the key or we wouldn't get here.
+ */
+rc_t copycat_add_dec (const copycat_pb * ppb)
+{
+    copycat_pb pb = *ppb;
+    rc_t rc = 0;
+    size_t num_read;
+    uint8_t buff [128];
+
+    rc = KFileReadAll (pb.sf, 0, buff, sizeof buff, &num_read);
+    if (rc)
+        PLOGERR (klogInt,  
+                 (klogInt, rc,
+                  "failed to read buffer for '$(path)'",
+                  "path=%s", pb.name ));
+    else
+    {
+        rc_t orc;
+
+        /* 
+         * if we have an encrypted file add decryption to the chain
+         * if not jump sraight to the write side of the chain
+         */
+        if (CCFileFormatIsNCBIEncrypted (buff))
+            rc = copycat_add_dec_ncbi (&pb);
+        else if (KFileIsWGAEnc (buff, num_read) == 0)
+            rc = copycat_add_dec_wga (&pb);
+        else
+            rc = copycat_add_crc (&pb);
+
+        orc = KFileRelease (pb.sf);
+        if (orc)
+            PLOGERR (klogInt,  
+                     (klogInt, orc,
+                      "failed to read buffer for '$(path)'",
+                      "path=%s", pb.name ));
+    }
+    return rc;
+}
+
+
+/* -----
+ * copycat
+ *
+ * The copycat function is the actual copy and catalog function.
+ * All before this function is called is building toward this.
+ *
+ * The functions prefixed copycat_add_ are functions used in building the 
+ * chain of KFS and other filters for doing the copy function.  Some 
+ * cataloging is included where the output file is encoded and to
+ * generate the CRC unique to the outer file in the catalog.
+ * The ccat_add_ functions are filters toward the leafs in the catlog 
+ * portion of the program.
+ *
+ * Much of this could be inlined but the indention creep across the screen
+ * and the handling of levels of indention would get intense.  Also some
+ * filters are skipped which also would have made it more unweildy to 
+ * write and maintain.
+ *
+ * In this function we build a node for cataloging the outermost layer of
+ * the output file which may differ from the file as read here if a
+ * decryption and/or encryption is added.
+ *
+ * We then
+ */
+rc_t copycat (CCTree *tree, KTime_t mtime, KDirectory * _cwd,
+              const VPath * src, const KFile *sf,
+              const VPath * dst,  KFile *df,
+              const char *spath, const char *name,
+              uint64_t expected, bool _do_decrypt, bool _do_encrypt)
+{
+    void * save;
+    copycat_pb pb;
+    rc_t rc;
+
+    DEBUG_STATUS (("%s: copy file %s\n",__func__, spath));
+
+    cwd = _cwd;
+    src_path = src;
+    dst_path = dst;
+
+    src_pw_read = false;
+
+    do_decrypt = _do_decrypt;
+    do_encrypt = _do_encrypt;
+
+    /* -----
+     * Create a cataloging node for the outer most file as written
+     */
+    rc = CCFileNodeMake ( &pb.node, expected );
+    if (rc)
+    {
+        LOGERR ( klogInt, rc, "failed to allocate file node" );
+        return rc;
+    }
+
+    pb.tree = tree;
+    pb.mtime = mtime;
+    pb.ntype = ccFile;
+    pb.name = name;
+
+
+    copycat_log_set (&pb.node->logs, &save);
+
+    if (out_block)
+    {
+        rc = KBufWriteFileMakeWrite (&pb.df, df, out_block);
+        if (rc)
+        {
+            PLOGERR (klogInt,  
+                     (klogInt, rc,
+                      "failed to create buffer for '$(path)'",
+                      "path=%s", pb.name ));
+            return rc;
+        }
+    }
+    else
+    {
+        pb.df = df;
+    }
+
+    if (in_block)
+    {
+        rc = KBufReadFileMakeRead (&pb.sf, sf, in_block);
+    }
+    else
+    {
+#if USE_KBUFFILE
+        rc = KBufFileMakeRead (&pb.sf, sf, 2*32*1024);
+#else
+        rc = KFileMakeReadHead (&pb.sf, sf, 4*1024);
+#endif
+    }
+    if (rc)
+    {
+        PLOGERR (klogInt,  
+                 (klogInt, rc,
+                  "failed to create buffer for '$(path)'",
+                  "path=%s", spath ));
+        return rc;
+    }
+    else
+    {
+        /* 
+         * if we have a decryption password prepare a decryption read path
+         * if not jump to preparing the write path
+         */
+        rc = do_decrypt
+            ? copycat_add_dec (&pb)
+            : copycat_add_crc (&pb);
+    }
+    copycat_log_set (save, NULL);
+
+    return rc;
+}
diff --git a/tools/copycat/cccopier.c b/tools/copycat/cccopier.c
new file mode 100644
index 0000000..07c6a21
--- /dev/null
+++ b/tools/copycat/cccopier.c
@@ -0,0 +1,217 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#include <stdlib.h>
+#include <atomic.h>
+
+#include <kapp/main.h>
+#include <kfs/directory.h>
+#include <kfs/file.h>
+#include <kfs/md5.h>
+#include <kapp/log.h>
+
+#include "copycat-priv.h"
+
+
+struct Copier
+{
+    atomic32_t refcount;
+    BufferQ * q;	/* input q for buffers to copy to file */
+    KFile * f;		/* output file (actually a KMD5File) */
+    uint64_t o;		/* how far into the output file are we */
+};
+
+
+rc_t CopierRelease (const Copier * cself)
+{
+    rc_t rc = 0;
+    Copier * self = (Copier*)cself;
+
+    if (self != NULL)
+    {
+	if (atomic32_dec_and_test (&self->refcount))
+	{
+	    rc = KFileRelease (self->f);
+	    if (rc == 0)
+	    {
+		rc = BufferQRelease (self->q);
+		if (rc == 0)
+		{
+		    free (self);
+		}
+	    }
+	}
+    }
+    return rc;
+}
+
+rc_t CopierAddRef (const Copier * self)
+{
+    if (self != NULL)
+	atomic32_inc (&((Copier*)self)->refcount);
+    return 0;
+}
+
+static
+rc_t CopierMakeF (Copier * cp, KDirectory * dir, const char * path)
+{
+    rc_t rc, orc;
+    KFile * fm;
+
+    rc = KDirectoryCreateFile (dir, &fm, true, 0666, kcmCreate|kcmParents,
+				"%s.md5", path);
+    if (rc == 0)
+    {
+	KMD5SumFmt * md5f;
+	rc = KMD5SumFmtMakeUpdate (&md5f, fm);
+	if (rc == 0)
+	{
+	    KFile * f;
+	    rc = KDirectoryCreateFile (dir, &f, false, 0666, kcmCreate, 
+                                    "%s", path);
+	    if (rc == 0)
+	    {
+		KMD5File * fmd5;
+		rc = KMD5FileMakeWrite (&fmd5, f, md5f, path);
+		if (rc == 0)
+		{
+		    cp->f = KMD5FileToKFile (fmd5);
+		    orc = KMD5SumFmtRelease (md5f);
+                    if (orc)
+                        LOGERR (klogInt, orc, "Failure releasing MD5 format");
+		    cp->o = 0; /* start of file */
+		    return rc;
+		}
+		orc = KFileRelease (f);
+                if (orc)
+                    LOGERR (klogInt, orc, "Failure releasing Copier file");
+	    }
+	    orc = KMD5SumFmtRelease (md5f);
+            if (orc)
+                LOGERR (klogInt, orc, "Failure releasing MD5 format");
+	}
+	orc = KFileRelease (fm);
+        if (orc)
+            LOGERR (klogInt, orc, "Failure releasing MD5SUM file");
+    }
+    return rc;
+}
+
+rc_t CopierMake (Copier ** c, KDirectory * dir, const char * path, uint32_t timeout, uint32_t length)
+{
+    rc_t rc = 0, orc;
+    Copier * self;
+
+    self = malloc (sizeof *self);
+    if (self == NULL)
+    {
+	rc = RC (rcExe, rcNoTarg, rcAllocating, rcMemory, rcExhausted);
+    }
+    else
+    {
+	atomic32_set (&self->refcount, 1);
+	self->f = NULL;
+	self->q = NULL;
+	rc = CopierMakeF (self, dir, path);
+	if (rc == 0)
+	{
+	    rc = BufferQMake (&self->q, timeout, length);
+	    if (rc == 0)
+	    {
+		*c = self;
+		atomic32_set (&self->refcount, 1);
+		return rc;
+	    }	    
+	}
+	orc = CopierRelease (self);
+        if (orc)
+            LOGERR (klogInt, orc, "Error releasing Copier");
+    }
+    return rc;
+}
+
+rc_t CopierDoOne (Copier * self)
+{
+    rc_t rc = 0;
+    const Buffer * b;
+
+    LOGMSG (klogDebug10, "CopierDoOne");
+    rc = Quitting();
+    if (rc == 0)
+    {
+	LOGMSG (klogDebug10, "call BufferQPopBuffer");
+	rc = BufferQPopBuffer (self->q, &b, NULL);
+	if (rc == 0)
+	{
+	    size_t w;
+	    size_t z;
+	    LOGMSG (klogDebug10, "call BufferContentGetSize");
+	    z = BufferContentGetSize (b);
+	    rc = KFileWrite (self->f, self->o, b, z, &w);
+	    self->o += w;
+	    if (w != z)
+		rc = RC (rcExe, rcFile, rcWriting, rcTransfer, rcIncomplete);
+	    else
+		rc = BufferRelease (b);
+	}
+	/* ow this is ugly! */
+	/* is the rc a "exhausted" on a timeout? */
+	else if ((GetRCObject(rc) == rcTimeout) && (GetRCState(rc) == rcExhausted))
+	{
+	    rc = 0;
+	    LOGMSG (klogDebug10, "CopierDoOne timeout");
+	    /* if so is the queue also sealed? */
+	    if (BufferQSealed (self->q) == true)
+	    {
+		LOGMSG (klogDebug10, "CopierDoOne sealed");
+		/* if both then we are done and so signal */
+		rc = KFileRelease (self->f);
+		PLOGMSG (klogDebug10, "CopierDoOne back from KFileRelease $(rc)",PLOG_U32(rc),rc);
+		if (rc == 0)
+		{
+		    self->f = NULL;
+		    rc = BufferQRelease (self->q);
+		    if (rc == 0)
+		    {
+			self->q = NULL;
+			rc = RC (rcExe, rcNoTarg, rcCopying, rcNoTarg, rcDone );
+		    }
+		}
+	    }
+	}
+	else
+	    LOGMSG (klogDebug10, "CopierDoOne pop failure");
+
+    }
+    else
+	LOGMSG (klogDebug10, "CopierDoOne: quitting");
+    return rc;
+}
+
+BufferQ * CopierGetQ (Copier *self)
+{
+    return (self->q);
+}
+
diff --git a/tools/copycat/cccopy.c b/tools/copycat/cccopy.c
new file mode 100644
index 0000000..36f6447
--- /dev/null
+++ b/tools/copycat/cccopy.c
@@ -0,0 +1,347 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+
+#include <assert.h>
+#include <atomic.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <kapp/log.h>
+#include <kfs/directory.h>
+#include <kfs/file.h>
+#include <kfs/md5.h>
+#include <kfs/teefile.h>
+#include "copycat.h"
+
+
+/* ======================================================================
+ * CCCopy does up the copy portion of the copycat tool's functionality
+ * and sets up CCCat that does the Catalog portion.
+ */
+struct CCCopy
+{
+    atomic32_t refcount;
+    const KDirectory * in;
+    KDirectory * out;
+    KDirectory * xml;
+    KMD5SumFmt * md5;
+    CCFileFormat * ff;
+    CCTree * tree;
+    uint32_t	timeout;
+    bool force;
+    char path[4096];
+};
+
+rc_t CCCopyAddRef (const CCCopy * self)
+{
+    if (self != NULL)
+	atomic32_inc (&((CCCopy*)self)->refcount);
+    return 0;
+}
+
+rc_t CCCopyRelease (const CCCopy * cself)
+{
+    CCCopy * self = (CCCopy *)cself;
+    rc_t rc = 0;
+    LOGMSG (klogDebug9, "Enter: CCCopyRelease");
+
+    if (self != NULL)
+    {
+	if (atomic32_dec_and_test (&self->refcount))
+	{
+	    KDirectoryRelease (self->in);
+	    KDirectoryRelease (self->out);
+	    KDirectoryRelease (self->xml);
+	    KMD5SumFmtRelease (self->md5);
+	    CCFileFormatRelease (self->ff);
+	    free (self);
+	}
+    }
+    return rc;
+}
+
+rc_t CCCopyMake (CCCopy ** p, const KDirectory * in,  KDirectory * out, 
+		  KDirectory * xml, bool force, KMD5SumFmt * md5,
+		  CCFileFormat * ff, CCTree * tree, const char * path)
+{
+    rc_t rc;
+    size_t pathlen;
+    CCCopy * self;
+    char relpath [4096];
+
+    assert (in != NULL);
+    assert (out != NULL);
+    assert (xml != NULL);
+    assert (path != NULL);
+
+    rc = KDirectoryResolvePath (in, false, relpath, sizeof relpath, "%s", path);
+    if (rc != 0)
+    {
+	pLOGERR (klogErr, rc, "unable to resolve path $(P)", PLOG_S(P), path);
+	return rc;
+    }
+    if ((relpath[0] == '.') && (relpath[1] == '.') && (relpath[2] == '/'))
+    {
+	rc = RC (rcExe, rcDirectory, rcResolving, rcPath, rcOutOfKDirectory);
+	pLOGERR (klogErr, rc, "Path must resolve to current directory or subdirectories $(P)",
+		 PLOG_S(P), relpath);
+	return rc;
+    }
+
+    pathlen = strlen(relpath);
+    self = malloc (sizeof (*self) - sizeof (*self->path) + pathlen + 1);
+    if (self == NULL)
+	rc = RC (rcExe, rcNoTarg, rcAllocating, rcMemory, rcExhausted);
+    else
+    {
+	atomic32_set (&self->refcount, 1);
+	KDirectoryAddRef (in);
+	KDirectoryAddRef (out);
+	KDirectoryAddRef (xml);
+	KMD5SumFmtAddRef (md5);
+	CCFileFormatAddRef (ff);
+	self->in = in;
+	self->out = out;
+	self->xml = xml;
+	self->force = force;
+	self->md5 = md5;
+	self->ff = ff;
+	self->tree = tree;
+	memcpy (self->path, relpath, pathlen+1);
+	*p = self;
+    }
+    return rc;
+}
+static
+rc_t CCCopyDoFile (CCCopy * self)
+{
+    const KFile * original;
+    rc_t rc = 0;
+    enum KCreateMode mode;
+    
+    PLOGMSG (klogDebug9, "CCCopyDoFile $(f)", PLOG_S(f), self->path);
+
+    if (! self->force)
+    {
+	/* if not forced replace mode we fail on existing file */
+	mode = kcmCreate;
+    }
+    else
+    {
+	uint32_t tt;
+
+	tt = KDirectoryPathType (self->out, "%s", self->path);
+	switch (tt)
+	{
+	default:
+	    PLOGMSG (klogWarn, "File exists and will be replaced in output directory $(f)",
+		     PLOG_S(f), self->path);
+	    break;
+	    /* if the path to the file or the file do not exist no warning */
+	case kptNotFound:
+	case kptBadPath:
+	    break;
+	}
+	tt = KDirectoryPathType (self->xml, "%s", self->path);
+	switch (tt)
+	{
+	default:
+	    PLOGMSG (klogWarn, "File exists and might be replaced in xml directory $(f)",
+		     PLOG_S(f), self->path);
+	    break;
+	    /* if the path to the file or the file do not exist no warning */
+	case kptNotFound:
+	case kptBadPath:
+	    break;
+	}
+
+	/* forced mode we create with init instead of create forcing a delete/create effect */
+	mode = kcmInit;
+    }
+
+    /* open original source for read */
+    rc = KDirectoryOpenFileRead (self->in, &original, "%s", self->path);
+    if (rc == 0)
+    {
+	KFile * copy;
+
+	/* create copy output for write */
+	rc = KDirectoryCreateFile (self->out, &copy, false, 0644, mode|kcmParents,
+                                "%s", self->path);
+	if (rc == 0)
+	{
+	    KFile * fm;
+
+	    /* create parallel <path>.md5 */
+	    rc = KDirectoryCreateFile (self->out, &fm, true, 0644, mode, "%s.md5",
+				       self->path);
+	    if (rc == 0)
+	    {
+		KMD5SumFmt * md5f;
+
+		/* make the .md5 an MD5 sum format file */
+		rc = KMD5SumFmtMakeUpdate (&md5f, fm);
+		if (rc == 0)
+		{
+		    union u
+		    {
+			KFile * kf;
+			KMD5File * mf;
+		    } outf;
+
+		    /* combine the copy and MD5 file into our special KFile */
+		    rc = KMD5FileMakeWrite (&outf.mf, copy, md5f, self->path);
+		    if (rc == 0)
+		    {
+			const KFile * inf;
+
+			/* release this outside reference to the MD5SumFMT leaving
+			 * only the one internal to the KMD5File */
+			KMD5SumFmtRelease (md5f);
+
+			/* create the KTeeFile that copies reads from the
+			 * original as writes to the copy.  Reads will be
+			 * made by the cataloging process */
+			rc = KFileMakeTeeRead (&inf, original, outf.kf);
+			if (rc == 0)
+			{
+			    CCCat * po;
+			    KTime_t mtime;
+
+			    /* try to get a modification time for this pathname */
+			    rc = KDirectoryDate (self->in, &mtime, "%s", self->path);
+			    if (rc != 0)
+				mtime = 0;	/* default to ? 0? */
+
+			    /* create the cataloger giving it the infile which
+			     * is the KTeeFile, Indirectory, the XML directory,
+			     * and the original path for the file */
+
+			    rc = CCCatMake (&po, self->in, self->xml, inf, self->md5,
+					    self->ff, mtime, self->tree, false, 0, self->path);
+			    if (rc == 0)
+			    {
+				/* do the catalog (and thus copy) */
+				rc = CCCatDo(po);
+				/* release the cataloger object */
+				CCCatRelease (po);
+			    }
+			    else
+				pLOGERR (klogDebug6, rc, "failure in CCCatMake $(P)",
+				     PLOG_S(P), self->path);
+			    /* release the infile which will complete a  copy 
+			     * regardless of the state of the cataloger */
+			    KFileRelease (inf);
+/* 			    return rc; */
+			}
+			else
+			{
+			    KFileRelease (outf.kf);
+			    KFileRelease (original);
+			    pLOGERR (klogDebug4, rc, "failure with kfilemaketeeread $(P)",
+				     PLOG_S(P), self->path);
+			} /* rc = KFileMakeTeeRead (&inf, original, outf.kf);*/
+		    }
+		    else
+		    {
+			KFileRelease (copy);
+			KMD5SumFmtRelease (md5f);
+			pLOGERR (klogDebug4, rc, "failure with KMD5FileMakeWrite $(P)",
+				 PLOG_S(P), self->path);
+		    } /* KMD5FileMakeWrite (&outf.mf, copy, md5f, self->path); */
+		} /* KDirectoryCreateFile (self->out, &fm, true, 0644, mode, "%s.md5", */
+		else
+		    pLOGERR (klogDebug4, rc, "failure with KMD5SumFmtMakeUpdate $(P)",
+			     PLOG_S(P), self->path);
+
+		KFileRelease (fm);
+	    } /* KDirectoryCreateFile (self->out, &fm, true, 0644, mode, "%s.md5", */
+	    else
+		pLOGERR (klogDebug4, rc, "failure with KDirectoryCreateFile $(P).md5",
+			 PLOG_S(P), self->path);
+	    KFileRelease (copy);
+	} /* rc = KDirectoryVCreateFile (self->out, &copy, false, 0644, mode|kcmParents, */
+	else
+	    pLOGERR (klogDebug4, rc, "failure with KDirectoryVCreateFile $(P)",
+		     PLOG_S(P), self->path);
+	KFileRelease (original);
+    } /* rc = KDirectoryVOpenFileRead (self->in, &original, self->path, NULL); */
+    else
+	pLOGERR (klogDebug4, rc, "failure with KDirectoryVOpenFileRead $(pP)",
+		 PLOG_S(P), self->path);
+    return rc;
+}
+
+static
+rc_t CCCopyDoDirectory (CCCopy * self)
+{
+    rc_t rc = 0;
+    PLOGMSG (klogInfo, "CCCopyDoDirectory $(d)", PLOG_S(d), self->path);
+
+    rc = RC (rcExe, rcDirectory, rcCopying, rcParam, rcUnsupported);
+    return rc;
+}
+rc_t CCCopyDo (CCCopy * self)
+{
+    rc_t rc = 0;
+    enum KPathType type;
+
+    assert (self != NULL);
+    assert (self->path != NULL);
+
+    type = KDirectoryPathType (self->in, "%s", self->path);
+    switch (type & ~kptAlias)
+    {
+    case kptNotFound:
+	rc = RC (rcExe, rcPath, rcAccessing, rcPath, rcNotFound);
+	break;
+    default:
+    case kptBadPath:
+	rc = RC (rcExe, rcPath, rcAccessing, rcPath, rcInvalid);
+	break;
+    case kptFile:
+	rc = CCCopyDoFile (self);
+	break;
+    case kptDir:
+#if 0
+	rc = CCCopyDoDirectory (self);
+#else
+	rc = PLOGMSG (klogInfo, "Ignoring directory $(p)",PLOG_S(p),self->path);
+#endif
+	break;
+    case kptCharDev:
+	rc = PLOGMSG (klogInfo, "Ignoring kptCharDev $(p)",PLOG_S(p),self->path);
+	break;
+    case kptBlockDev:
+	rc = PLOGMSG (klogInfo, "Ignoring kptBlockDev $(p)",PLOG_S(p),self->path);
+	break;
+    case kptFIFO:
+	rc = PLOGMSG (klogInfo, "Ignoring kptFIFO $(p)",PLOG_S(p),self->path);
+	break;
+    }
+    return rc;
+}
+
diff --git a/tools/copycat/ccfile.c b/tools/copycat/ccfile.c
new file mode 100644
index 0000000..22ea5ee
--- /dev/null
+++ b/tools/copycat/ccfile.c
@@ -0,0 +1,271 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ */
+
+#include <klib/log.h>
+#include <klib/debug.h>
+#include <klib/rc.h>
+#include <kfs/file.h>
+#include <kfs/countfile.h>
+#include <sysalloc.h>
+
+#include <assert.h>
+#include <stdlib.h>
+
+/* ======================================================================
+ * CCFile
+ */
+/* -----
+ * define the specific types to be used in the templatish/inheritancish
+ * definition of vtables and their elements
+ */
+typedef struct CCFile CCFile;
+#define KFILE_IMPL struct CCFile
+#include <kfs/impl.h>
+
+
+/*-----------------------------------------------------------------------
+ * CCFile
+ */
+struct CCFile
+{
+    KFile	dad;
+    KFile *	original;
+    rc_t *      prc;
+};
+
+
+/* ----------------------------------------------------------------------
+ * Destroy
+ *
+ */
+static
+rc_t CC CCFileDestroy (CCFile *self)
+{
+    rc_t rc = KFileRelease (self->original);
+    free (self);
+    return rc;
+}
+
+/* ----------------------------------------------------------------------
+ * GetSysFile
+ *  returns an underlying system file object
+ *  and starting offset to contiguous region
+ *  suitable for memory mapping, or NULL if
+ *  no such file is available.
+ *
+ * bytes could not be counted if memory mapped so this is disallowed
+ */
+
+static
+struct KSysFile *CC CCFileGetSysFile (const CCFile *self, uint64_t *offset)
+{
+    return KFileGetSysFile (self->original, offset);
+}
+
+/* ----------------------------------------------------------------------
+ * RandomAccess
+ *
+ *  returns 0 if random access, error code otherwise
+ */
+static
+rc_t CC CCFileRandomAccess (const CCFile *self)
+{
+    assert (self != NULL);
+    assert (self->original != NULL);
+    return KFileRandomAccess (self->original);
+}
+
+/* ----------------------------------------------------------------------
+ * Type
+ *  returns a KFileDesc
+ *  not intended to be a content type,
+ *  but rather an implementation class
+ */
+static
+uint32_t CC CCFileType (const CCFile *self)
+{
+    return KFileType (self->original);
+}
+
+/* ----------------------------------------------------------------------
+ * Size
+ *  returns size in bytes of file
+ *
+ *  "size" [ OUT ] - return parameter for file size
+ */
+static
+rc_t CC CCFileSize (const CCFile *self, uint64_t *size)
+{
+    return KFileSize (self->original, size);
+}
+
+/* ----------------------------------------------------------------------
+ * SetSize
+ *  sets size in bytes of file
+ *
+ *  "size" [ IN ] - new file size
+ */
+static
+rc_t CC CCFileSetSize (CCFile *self, uint64_t size)
+{
+    return KFileSetSize (self->original, size);
+}
+
+/* ----------------------------------------------------------------------
+ * Read
+ *  read file from known position
+ *
+ *  "pos" [ IN ] - starting position within file
+ *
+ *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
+ *
+ *  "num_read" [ OUT, NULL OKAY ] - optional return parameter
+ *  giving number of bytes actually read
+ */
+static
+rc_t CC CCFileRead	(const CCFile *self,
+                         uint64_t pos,
+                         void *buffer,
+                         size_t bsize,
+                         size_t *num_read)
+{
+    rc_t	rc;
+    
+    rc = KFileRead (self->original, pos, buffer, bsize, num_read);
+    if (*self->prc == 0)
+        *((CCFile*)self)->prc = rc;
+    return rc;
+}
+
+/* ----------------------------------------------------------------------
+ * Write
+ *  write file at known position
+ *
+ *  "pos" [ IN ] - starting position within file
+ *
+ *  "buffer" [ IN ] and "size" [ IN ] - data to be written
+ *
+ *  "num_writ" [ OUT, NULL OKAY ] - optional return parameter
+ *  giving number of bytes actually written
+ *
+ */
+static
+rc_t CC CCFileWrite (CCFile *self, uint64_t pos,
+                     const void *buffer, size_t bsize,
+                     size_t *num_writ)
+{
+    rc_t rc;
+
+    rc = KFileWrite (self->original, pos, buffer, bsize, num_writ);
+    if (*self->prc == 0)
+        *self->prc = rc;
+    return rc;
+}
+
+static const KFile_vt_v1 vtCCFile =
+{
+    /* version */
+    1, 1,
+
+    /* 1.0 */
+    CCFileDestroy,
+    CCFileGetSysFile,
+    CCFileRandomAccess,
+    CCFileSize,
+    CCFileSetSize,
+    CCFileRead,
+    CCFileWrite,
+
+    /* 1.1 */
+    CCFileType
+};
+
+/* ----------------------------------------------------------------------
+ * CCFileMake
+ *  create a new file object
+ */
+
+static
+rc_t CCFileMake (CCFile ** pself,
+                 KFile * original,
+                 rc_t * prc)
+{
+    CCFile * self;
+    rc_t rc;
+    /* needs to be better */
+    assert (pself);
+    assert (original);
+    assert (prc);
+
+    self = malloc (sizeof (CCFile));
+    if (self == NULL)	/* allocation failed */
+    {
+	/* fail */
+	rc = RC (rcFS, rcFile, rcConstructing, rcMemory, rcExhausted);
+    }
+    else
+    {
+	rc = KFileInit (&self->dad,			/* initialize base class */
+			(const KFile_vt*)&vtCCFile,/* VTable for CCFile */
+            "CCFile", "no-name",
+			original->read_enabled,
+			original->write_enabled);
+	if (rc == 0)
+	{
+            rc = KFileAddRef (original);
+            if (rc == 0)
+            {
+                self->original = original;
+                self->prc = prc;
+                *pself = self;
+                return *prc = 0;
+            }
+	}
+	/* fail */
+	free (self);
+    }
+    *pself = NULL;
+    *prc = rc;
+    return rc;
+}
+
+LIB_EXPORT rc_t CC CCFileMakeRead (const KFile ** self, const KFile * original,
+                                   rc_t * prc)
+{
+    return CCFileMake ((CCFile **)self, (KFile*)original, prc);
+}
+LIB_EXPORT rc_t CC CCFileMakeUpdate (KFile ** self, KFile * original,
+                                     rc_t * prc)
+{
+    return CCFileMake ((CCFile **)self, (KFile*)original, prc);
+}
+LIB_EXPORT rc_t CC CCFileMakeWrite (KFile ** self, KFile * original,
+                                    rc_t * prc)
+{
+    return CCFileMake ((CCFile **)self, (KFile*)original, prc);
+}
+
+/* end of file countfile.c */
+
diff --git a/tools/copycat/ccfileformat.c b/tools/copycat/ccfileformat.c
new file mode 100644
index 0000000..15eee8c
--- /dev/null
+++ b/tools/copycat/ccfileformat.c
@@ -0,0 +1,383 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <klib/rc.h>
+#include <klib/debug.h>
+#include <klib/log.h>
+#include <kfs/file.h>
+#include <kfs/fileformat.h>
+#include <kfs/ffext.h>
+#include <kfs/ffmagic.h>
+#include <krypto/wgaencrypt.h>
+#include <atomic32.h>
+#include <stddef.h>
+#include "copycat-priv.h"
+#include "debug.h"
+
+bool CCFileFormatIsNCBIEncrypted ( void  * buffer )
+{
+    static const char file_sig[] = "NCBInenc";
+
+    return (memcmp (buffer, file_sig, sizeof file_sig - 1) == 0);
+}
+bool CCFileFormatIsKar ( void  * buffer )
+{
+    static const char file_sig[] = "NCBI.sra";
+
+    return (memcmp (buffer, file_sig, sizeof file_sig - 1) == 0);
+}
+
+
+
+
+CCFileFormat *filefmt;
+
+/* ======================================================================
+ * Process does up the copy portion of the copycat tool's functionality
+ * and sets up ProcessOne that does the Catalog portion.
+ */
+struct CCFileFormat
+{
+    KFileFormat * magic;
+    KFileFormat * ext;
+    atomic32_t	  refcount;
+};
+
+static const char magictable [] = 
+{
+    "Generic Format for Sequence Data (SRF)\tSequenceReadFormat\n"
+    "GNU tar archive\tTapeArchive\n"
+    "POSIX tar archive\tTapeArchive\n"
+    "POSIX tar archive (GNU)\tTapeArchive\n"
+    "Standard Flowgram Format (SFF)\tStandardFlowgramFormat\n"
+    "NCBI kar sequence read archive\tSequenceReadArchive\n"
+    "tar archive\tTapeArchive\n"
+    "XML document text\tExtensibleMarkupLanguage\n"
+    "bzip2 compressed data\tBzip\n"
+    "Zip archive data\tWinZip\n"
+    "gzip compressed data\tGnuZip\n"
+};
+static const char exttable [] = 
+{
+    "Unknown\tUnknown\n"
+    "bam\tBinaryAlignmentMap\n"
+    "bz2\tBzip\n"
+    "gz\tGnuZip\n"
+    "tgz\tGnuZip\n"
+    "sff\tStandardFlowgramFormat\n"
+    "sra\tSequenceReadArchive\n"
+    "srf\tSequenceReadFormat\n"
+    "tar\tTapeArchive\n"
+    "xml\tExtensibleMarkupLanguage\n"
+    "h5\tHD5\n"
+};
+
+static const char classtable [] = 
+{
+    "Archive\n"
+    "Cached\n"
+    "Compressed\n"
+    "Read\n"
+};
+    
+static const char formattable [] = 
+{
+    "BinaryAlignmentMap\tRead\n"
+    "Bzip\tCompressed\n"
+    "GnuZip\tCompressed\n"
+    "WinZip\tRead\n"
+    "ExtensibleMarkupLanguage\tCached\n"
+    "SequenceReadFormat\tRead\n"
+    "SequenceReadArchive\tArchive\n"
+    "StandardFlowgramFormat\tRead\n"
+    "TapeArchive\tArchive\n"
+    "HD5\tArchive\n"
+};
+
+static const char magicpath [] = "/usr/share/misc/magic";
+
+rc_t CCFileFormatAddRef (const CCFileFormat * self)
+{
+    if (self != NULL)
+        atomic32_inc (&((CCFileFormat*)self)->refcount);
+    return 0;
+}
+
+rc_t CCFileFormatRelease (const CCFileFormat * cself)
+{
+    rc_t rc = 0;
+    CCFileFormat *self;
+
+    self = (CCFileFormat *)cself; /* mutable field is ref count */
+    if (self != NULL)
+    {
+        if (atomic32_dec_and_test (&self->refcount))
+        {
+            DEBUG_STATUS(("%s call KFileFormatRelease for extentions\n", __func__));
+            rc = KFileFormatRelease (self->ext);
+            if (rc == 0)
+            {
+                DEBUG_STATUS(("%s call KFileFormatRelease for magic\n", __func__));
+                rc = KFileFormatRelease (self->magic);
+                if (rc == 0)
+                {
+                    free (self);
+                }
+            }
+        }
+    }
+    return rc;
+}
+
+rc_t CCFileFormatMake (CCFileFormat ** p)
+{
+    rc_t rc;
+    CCFileFormat * self;
+
+    DEBUG_ENTRY();
+
+    self = malloc (sizeof *self);
+
+    if (self == NULL)
+    {
+        rc = RC (rcExe, rcFileFormat, rcCreating, rcMemory, rcExhausted);
+    }
+    else
+    {
+        rc = KExtFileFormatMake (&self->ext, exttable, sizeof (exttable) - 1,
+                                 formattable, sizeof (formattable) - 1);
+        if (rc == 0)
+        {
+            rc = KMagicFileFormatMake (&self->magic, magicpath, magictable,
+                                       sizeof (magictable) - 1, 
+                                       formattable, sizeof (formattable) - 1);
+            if (rc == 0)
+            {
+                atomic32_set (&self->refcount , 1);
+                *p = self;
+                return 0;
+            }
+        }
+        free (self);
+    }
+    *p = NULL;
+    return rc;
+}
+
+rc_t CCFileFormatGetType (const CCFileFormat * self, const KFile * file,
+     const char * path, char * buffer, size_t buffsize, uint32_t * ptype, uint32_t * pclass)
+{
+    static const char u_u[] = "Unknown/Unknown";
+    rc_t rc, orc;
+
+    int ret;
+    size_t mtz;
+    size_t etz;
+    size_t num_read;
+    KFileFormatType mtype;
+    KFileFormatType etype;
+    KFileFormatClass mclass;
+    KFileFormatClass eclass;
+    char	mclassbuf	[256];
+    char	mtypebuf	[256];
+    char	eclassbuf	[256];
+    char	etypebuf	[256];
+    uint8_t	preread	[8192];
+
+    DEBUG_ENTRY();
+    DEBUG_STATUS(("%s: getting type for (%s)\n",__func__,path));
+
+    /* initially assume that we don't know the type or class
+     * these are just treated as files with no special processing
+     * more than we that we don't know the type or class */
+
+    *pclass = *ptype = 0;
+    strncpy (buffer, u_u, buffsize);
+    buffer[buffsize-1] = '\0'; /* in case we got truncated in the copy above */
+
+    orc = KFileRead (file, 0, preread, sizeof (preread), &num_read);
+    if (orc == 0)
+    {
+        if (CCFileFormatIsKar (preread))
+        {
+            *pclass = ccffcArchive;
+            *ptype = ccfftaSra;
+            strncpy (buffer, "Archive/SequenceReadArchive", buffsize);
+            return 0;
+        }
+        if (CCFileFormatIsNCBIEncrypted (preread))
+        {
+            *pclass = ccffcEncoded;
+            *ptype = ccffteNCBI;
+            strncpy (buffer, "Encoded/NCBI", buffsize);
+            return 0;
+        }
+        /* Sorta kinda hack to see if the file is WGA encrypted 
+         * We short cut the other stuff if it is WGA encoded
+         */
+        if (KFileIsWGAEnc (preread, num_read) == 0)
+        {
+            *pclass = ccffcEncoded;
+            *ptype = ccffteWGA;
+            strncpy (buffer, "Encoded/WGA", buffsize);
+            return 0;
+        }
+        
+
+        rc = KFileFormatGetTypePath (self->ext, NULL, path, &etype, &eclass,
+                                 etypebuf, sizeof (etypebuf), &etz);
+        if (rc == 0)
+        {
+
+            rc = KFileFormatGetTypeBuff (self->magic, preread, num_read, &mtype, 
+                                         &mclass, mtypebuf, sizeof (mtypebuf), &mtz);
+            if (rc == 0)
+            {
+                rc = KFileFormatGetClassDescr (self->ext, eclass, eclassbuf, sizeof (eclassbuf));
+                if (rc == 0)
+                {
+                    rc = KFileFormatGetClassDescr (self->magic, mclass, mclassbuf, sizeof (mclassbuf));
+                    if (rc == 0)
+                    {
+                        DEBUG_STATUS(("%s: (%s) %s/%s<=%s/%s\n", __func__,
+                                      path, mclassbuf, mtypebuf, eclassbuf, etypebuf));
+
+                        /* first handle known special cases */
+                        if ((strcmp("WinZip", mtypebuf) == 0) &&
+                            (strcmp("GnuZip", etypebuf) == 0))
+                        {
+                            /* we've gotten in too many Zip files with extension gz */
+                            PLOGMSG (klogWarn, 
+                                     (klogWarn, "File '$(path)' is in unzupported winzip/pkzip format",
+                                      "path=%s", path));
+                        }
+                        else if (!strcmp("BinaryAlignmentMap", etypebuf) && !strcmp ("GnuZip", mtypebuf))
+                        {
+				/*** bam files have gnuzip magic, we need to treat them as data files ***/
+				strcpy (mclassbuf, eclassbuf );
+				strcpy (mtypebuf, etypebuf);
+				mtype = etype;
+                                mclass = eclass;
+			}
+                        else if ((strcmp("SequenceReadArchive", etypebuf) == 0) &&
+                                 (strcmp("Unknown", mtypebuf) == 0))
+                        {
+                            /* magic might not detect SRA/KAR files yet */
+                            DEBUG_STATUS(("%s: (%s) %s/%s<=%s/%s\n", __func__,
+                                          path, mclassbuf, mtypebuf, eclassbuf, etypebuf));
+                            strcpy (mclassbuf, eclassbuf);
+                            strcpy (mtypebuf, etypebuf);
+                            mtype = etype;
+                            mclass = eclass;
+                        }
+                        else if ((strcmp("HD5", etypebuf) == 0) &&
+                                 (strcmp("Unknown", mtypebuf) == 0))
+                        {
+                            DEBUG_STATUS(("%s:5 (%s) %s/%s<=%s/%s\n", __func__,
+                                          path, mclassbuf, mtypebuf, eclassbuf, etypebuf));
+                            strcpy (mclassbuf, eclassbuf);
+                            strcpy (mtypebuf, etypebuf);
+                            mtype = etype;
+                            mclass = eclass;
+                        }
+
+                        /* now that we've fixed a few cases use the magic derived
+                         * class and type as the extensions could be wrong and can
+                         * cause failures */
+                        if (strcmp ("Archive", mclassbuf) == 0)
+                        {       
+                            *pclass = ccffcArchive;
+                            if (strcmp ("TapeArchive", mtypebuf) == 0)
+                                *ptype = ccfftaTar;
+                            else if (strcmp ("SequenceReadArchive", mtypebuf) == 0)
+                                *ptype = ccfftaSra;
+                        }
+                        else if (strcmp("Compressed", mclassbuf) == 0)
+                        {
+                            *pclass = ccffcCompressed;
+                            if (strcmp ("Bzip", mtypebuf) == 0)
+                            {
+                                *ptype = ccfftcBzip2;
+                                if ( no_bzip2 )
+                                    * pclass = *ptype = 0;
+                            }
+                            else if (strcmp ("GnuZip", mtypebuf) == 0)
+                                *ptype = ccfftcGzip;
+                        }
+
+                        /* Hmmm... we are using extension to determine XML though
+                         * Probably okay */
+                        else if (strcmp ("Cached", eclassbuf) == 0)
+                        {
+                            *pclass = ccffcCached;
+                            if (strcmp ("ExtensibleMarkupLanguage", etypebuf) == 0)
+                                *ptype = ccfftxXML;
+                            strcpy (mclassbuf, eclassbuf);
+                            strcpy (mtypebuf, etypebuf);
+
+                        }
+
+                        /* build the eventual filetype string - vaguely mime type like */
+#if 1
+                        ret = snprintf (buffer, buffsize, "%s/%s", mclassbuf, mtypebuf);
+                        if (ret >= buffsize)
+                        {
+                            ret = buffsize-1;
+                            buffer[buffsize-1] = '\0';
+                        }
+                        
+#else
+                        ecz = strlen (eclassbuf);
+                        num_read = (ecz < buffsize) ? ecz : buffsize;
+                        strncpy (buffer, eclassbuf, buffsize);
+                        if (num_read >= (buffsize-2))
+                            buffer [num_read] = '\0';
+                        else
+                        {
+                            buffer [num_read++] = '/';
+                            strncpy (buffer+num_read, etypebuf, 
+                                     buffsize - num_read);
+                        }
+                        buffer[buffsize-1] = '\0';
+                        /* 			    buffer [num_read++] = '/'; */
+#endif
+                    }
+                }
+            }
+        }
+        if (rc)
+        {
+            *pclass = *ptype = 0;
+            strncpy (buffer, u_u, buffsize);
+            buffer[buffsize-1] = '\0'; /* in case we got truncated in the copy above */
+        }
+    }
+    return orc;
+}
diff --git a/tools/copycat/ccproc.c b/tools/copycat/ccproc.c
new file mode 100644
index 0000000..a0f64fe
--- /dev/null
+++ b/tools/copycat/ccproc.c
@@ -0,0 +1,319 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+
+#include <assert.h>
+#include <atomic.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <kapp/log.h>
+#include <kfs/directory.h>
+#include <kfs/file.h>
+#include <kfs/md5.h>
+#include <kfs/teefile.h>
+#include "copycat.h"
+
+
+/* ======================================================================
+ * Process does up the copy portion of the copycat tool's functionality
+ * and sets up ProcessOne that does the Catalog portion.
+ */
+struct Process
+{
+    atomic32_t refcount;
+    const KDirectory * in;
+    KDirectory * out;
+    KDirectory * xml;
+    KMD5SumFmt * md5;
+    CCFileFormat * ff;
+    uint32_t	timeout;
+    bool force;
+    char path[4096];
+};
+
+rc_t ProcessAddRef (const Process * self)
+{
+    if (self != NULL)
+	atomic32_inc (&((Process*)self)->refcount);
+    return 0;
+}
+
+rc_t ProcessRelease (const Process * cself)
+{
+    Process * self = (Process *)cself;
+    rc_t rc = 0;
+    LOGMSG (klogDebug10, "Enter: ProcessRelease");
+
+    if (self != NULL)
+    {
+	if (atomic32_dec_and_test (&self->refcount))
+	{
+	    KDirectoryRelease (self->in);
+	    KDirectoryRelease (self->out);
+	    KDirectoryRelease (self->xml);
+	    KMD5SumFmtRelease (self->md5);
+	    CCFileFormatRelease (self->ff);
+	    free (self);
+	}
+    }
+    return rc;
+}
+
+rc_t ProcessMake (Process ** p, const KDirectory * in,  KDirectory * out, 
+		  KDirectory * xml, bool force, KMD5SumFmt * md5,
+		  CCFileFormat * ff, const char * path)
+{
+    rc_t rc;
+    size_t pathlen;
+    Process * self;
+    char relpath [4096];
+
+    assert (in != NULL);
+    assert (out != NULL);
+    assert (xml != NULL);
+    assert (path != NULL);
+
+    rc = KDirectoryResolvePath (in, false, relpath, sizeof relpath, "%s", path);
+    if (rc != 0)
+    {
+	pLOGERR (klogErr, rc, "unable to resolve path $(P)", PLOG_S(P), path);
+	return rc;
+    }
+    if ((relpath[0] == '.') && (relpath[1] == '.') && (relpath[2] == '/'))
+    {
+	rc = RC (rcExe, rcDirectory, rcResolving, rcPath, rcOutOfKDirectory);
+	pLOGERR (klogErr, rc, "Path must resolve to current directory or subdirectories $(P)",
+		 PLOG_S(P), relpath);
+	return rc;
+    }
+
+    pathlen = strlen(relpath);
+    self = malloc (sizeof (*self) - sizeof (*self->path) + pathlen + 1);
+    if (self == NULL)
+	rc = RC (rcExe, rcNoTarg, rcAllocating, rcMemory, rcExhausted);
+    else
+    {
+	atomic32_set (&self->refcount, 1);
+	KDirectoryAddRef (in);
+	KDirectoryAddRef (out);
+	KDirectoryAddRef (xml);
+	KMD5SumFmtAddRef (md5);
+	CCFileFormatAddRef (ff);
+	self->in = in;
+	self->out = out;
+	self->xml = xml;
+	self->force = force;
+	self->md5 = md5;
+	self->ff = ff;
+	memcpy (self->path, relpath, pathlen+1);
+	*p = self;
+    }
+    return rc;
+}
+static
+rc_t ProcessDoFile (Process * self)
+{
+    const KFile * original;
+    rc_t rc = 0;
+    enum KCreateMode mode;
+    
+    PLOGMSG (klogDebug10, "ProcessDoFile $(f)", PLOG_S(f), self->path);
+
+
+    if (! self->force)
+    {
+	/* if not forced replace mode we fail on existing file */
+	mode = kcmCreate;
+    }
+    else
+    {
+	uint32_t tt;
+
+	tt = KDirectoryPathType (self->out, "%s", self->path);
+	switch (tt)
+	{
+	default:
+	    PLOGMSG (klogWarn, "File exists and will be replaced in output directory $(f)",
+		     PLOG_S(f), self->path);
+	    break;
+	    /* if the path to the file or the file do not exist no warning */
+	case kptNotFound:
+	case kptBadPath:
+	    break;
+	}
+	tt = KDirectoryPathType (self->xml, "%s", self->path);
+	switch (tt)
+	{
+	default:
+	    PLOGMSG (klogWarn, "File exists and might be replaced in xml directory $(f)",
+		     PLOG_S(f), self->path);
+	    break;
+	    /* if the path to the file or the file do not exist no warning */
+	case kptNotFound:
+	case kptBadPath:
+	    break;
+	}
+
+	/* forced mode we create with init instead of create forcing a delete/create effect */
+	mode = kcmInit;
+    }
+
+    /* open originial source for read */
+    rc = KDirectoryOpenFileRead (self->in, &original, "%s", self->path);
+    if (rc == 0)
+    {
+	KFile * copy;
+
+	/* create copy output for write */
+	rc = KDirectoryCreateFile (self->out, &copy, false, 0644, mode|kcmParents,
+                               "%s", self->path);
+	if (rc == 0)
+	{
+	    KFile * fm;
+
+	    /* create parallel <path>.md5 */
+	    rc = KDirectoryCreateFile (self->out, &fm, true, 0644, mode, "%s.md5",
+				       self->path);
+	    if (rc == 0)
+	    {
+		KMD5SumFmt * md5f;
+
+		/* make the .md5 an MD5 sum format file */
+		rc = KMD5SumFmtMakeUpdate (&md5f, fm);
+		if (rc == 0)
+		{
+		    union u
+		    {
+			KFile * kf;
+			KMD5File * mf;
+		    } outf;
+
+		    /* combine the copy and MD5 file into our special KFile */
+		    rc = KMD5FileMakeWrite (&outf.mf, copy, md5f, self->path);
+		    if (rc == 0)
+		    {
+			const KFile * inf;
+
+			/* release this outside reference to the MD5SumFMT leaving
+			 * only the one internal to the KMD5File */
+			KMD5SumFmtRelease (md5f);
+
+			/* create the KTeeFile that copies reads from the
+			 * original as writes to the copy.  Reads will be
+			 * made by the cataloging process */
+			rc = KFileMakeTeeRead (&inf, original, outf.kf);
+			if (rc == 0)
+			{
+			    ProcessOne * po;
+
+			    /* create the cataloger giving it the infile which
+			     * is the KTeeFile, Indirectory, the XML directory,
+			     * and the original path for the file */
+			    rc = ProcessOneMake (&po, self->in, self->xml, inf,
+						 self->md5, self->ff, self->path);
+			    if (rc == 0)
+			    {
+				/* do the catalog (and thus copy) */
+				rc = ProcessOneDo(po);
+				/* release the cataloger object */
+				ProcessOneRelease (po);
+			    }
+			    /* release the infile which will complete a  copy 
+			     * regardless of the state of the cataloger */
+			    KFileRelease (inf);
+/* 			    return rc; */
+			}
+			else
+			{
+			    KFileRelease (outf.kf);
+			    KFileRelease (original);
+			} /* rc = KFileMakeTeeRead (&inf, original, outf.kf);*/
+		    }
+		    else
+		    {
+			KFileRelease (copy);
+			KMD5SumFmtRelease (md5f);
+		    } /* KMD5FileMakeWrite (&outf.mf, copy, md5f, self->path); */
+		} /* KDirectoryCreateFile (self->out, &fm, true, 0644, mode, "%s.md5", */
+		KFileRelease (fm);
+	    } /* KDirectoryCreateFile (self->out, &fm, true, 0644, mode, "%s.md5", */
+	    KFileRelease (copy);
+	} /* rc = KDirectoryVCreateFile (self->out, &copy, false, 0644, mode|kcmParents, */
+	KFileRelease (original);
+    } /* rc = KDirectoryVOpenFileRead (self->in, &original, self->path, NULL); */
+    return rc;
+}
+
+static
+rc_t ProcessDoDirectory (Process * self)
+{
+    rc_t rc = 0;
+    PLOGMSG (klogInfo, "ProcessDoDirectory $(d)", PLOG_S(d), self->path);
+
+    rc = RC (rcExe, rcDirectory, rcCopying, rcParam, rcUnsupported);
+    return rc;
+}
+rc_t ProcessDo (Process * self)
+{
+    rc_t rc = 0;
+    enum KPathType type;
+
+    assert (self != NULL);
+    assert (self->path != NULL);
+
+    type = KDirectoryPathType (self->in, "%s", self->path);
+    switch (type & ~kptAlias)
+    {
+    case kptNotFound:
+	rc = RC (rcExe, rcPath, rcAccessing, rcPath, rcNotFound);
+	break;
+    default:
+    case kptBadPath:
+	rc = RC (rcExe, rcPath, rcAccessing, rcPath, rcInvalid);
+	break;
+    case kptFile:
+	rc = ProcessDoFile (self);
+	break;
+    case kptDir:
+#if 0
+	rc = ProcessDoDirectory (self);
+#else
+	rc = PLOGMSG (klogInfo, "Ignoring directory $(p)",PLOG_S(p),self->path);
+#endif
+	break;
+    case kptCharDev:
+	rc = PLOGMSG (klogInfo, "Ignoring kptCharDev $(p)",PLOG_S(p),self->path);
+	break;
+    case kptBlockDev:
+	rc = PLOGMSG (klogInfo, "Ignoring kptBlockDev $(p)",PLOG_S(p),self->path);
+	break;
+    case kptFIFO:
+	rc = PLOGMSG (klogInfo, "Ignoring kptFIFO $(p)",PLOG_S(p),self->path);
+	break;
+    }
+    return rc;
+}
+
diff --git a/tools/copycat/ccprocone.c b/tools/copycat/ccprocone.c
new file mode 100644
index 0000000..57c971f
--- /dev/null
+++ b/tools/copycat/ccprocone.c
@@ -0,0 +1,217 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+
+#include <assert.h>
+#include <atomic.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#include <kapp/log.h>
+#include <kfs/directory.h>
+#include <kfs/file.h>
+#include <kfs/md5.h>
+#include <kfs/teefile.h>
+#include <kfs/buffile.h>
+/* #include <klib/rc.h> */
+
+#include "copycat.h"
+
+/* ==========
+ * Process is a generic buffer to be used to pass data between co-routines or 
+ * threads.
+ */
+
+struct ProcessOne
+{
+    atomic32_t	refcount;	/* how many references to this object */
+    const KDirectory * dir;
+    KDirectory * xml;
+    const KFile * file;
+    CCFileFormat * ff;
+    KMD5SumFmt *md5;
+    char path [4096];
+};
+
+rc_t ProcessOneMake (ProcessOne ** ppo, const KDirectory * dir, KDirectory * xml,
+		     const KFile * file, KMD5SumFmt *md5, CCFileFormat * ff,
+		     const char * path)
+{
+    ProcessOne * self;
+    rc_t rc = 0;
+    size_t pathlen;
+
+    PLOGMSG (klogDebug10, "ProcessOneMake $(f)", PLOG_S(f), path);
+    /* legit seeming inputs? these could be replaced with RC returns */
+    assert (ppo != NULL);
+    assert (file != NULL);
+    assert (path != NULL);
+
+    /* allocate the object */
+    pathlen = strlen (path);
+    self = malloc (sizeof (*self) - sizeof(self->path) + pathlen + 1);
+    if (self == NULL)
+    {
+	rc = RC (rcExe, rcNoTarg, rcAllocating, rcMemory, rcExhausted);
+    }
+    else
+    {
+	atomic32_set (&self->refcount, 1);
+	KDirectoryAddRef (dir);
+	KDirectoryAddRef (xml);
+	KMD5SumFmtAddRef (md5);
+	CCFileFormatAddRef (ff);
+	KFileAddRef (file);
+	self->dir = dir;
+	self->xml = xml;
+	self->md5 = md5;
+	self->file = file;
+	self->ff = ff;
+	memcpy (self->path, path, pathlen);
+	self->path[pathlen] = '\0';
+	rc = 0;
+    }
+    *ppo = self;
+    return rc;
+}
+
+rc_t ProcessOneAddRef (const ProcessOne * self)
+{
+    if (self != NULL)
+	atomic32_inc (&((ProcessOne*)self)->refcount);
+    return 0;
+}
+rc_t ProcessOneRelease (const ProcessOne * cself)
+{
+    ProcessOne * self = (ProcessOne *)cself;
+    rc_t rc = 0;
+
+    if (self != NULL)
+    {
+	PLOGMSG (klogDebug10, "ProcessOneRelease $(f)", PLOG_S(f), self->path);
+	if (atomic32_dec_and_test (&self->refcount))
+	{
+	    KDirectoryRelease (self->dir);
+	    KDirectoryRelease (self->xml);
+	    KMD5SumFmtRelease (self->md5);
+	    CCFileFormatRelease (self->ff);
+	    KFileRelease (self->file);
+	    free (self);
+	}
+    }
+    return rc;
+}
+const char * typeToString (enum KPathType type)
+{
+    switch (type)
+    {
+    default:
+	return "bad-KPathType";
+    case kptNotFound:
+	return "not-found";
+    case kptBadPath:
+	return "bad-path";
+    case kptFile:
+	return "file";
+    case kptDir:
+	return "directory";
+    case kptCharDev:
+	return "character-device";
+    case kptBlockDev:
+	return "block-device";
+    case kptFIFO:
+	return "fifo";
+    case kptAlias|kptNotFound:
+	return "link-to-not-found";
+    case kptAlias|kptBadPath:
+	return "link-to-bad-path";
+    case kptAlias|kptFile:
+	return "link-to-file";
+    case kptAlias|kptDir:
+	return "link-to-directory";
+    case kptAlias|kptCharDev:
+	return "link-to-character-device";
+    case kptAlias|kptBlockDev:
+	return "link-to-block-device";
+    case kptAlias|kptFIFO:
+	return "link-to-fifo";
+    }
+}
+rc_t ProcessOneDoFile (ProcessOne * self)
+{
+    rc_t rc = 0;
+    KFile * mfile;
+    
+    PLOGMSG (klogInfo, "ProcessOneDoFile: $(F)", PLOG_S(F), self->path);
+
+
+    rc = KFileMakeNewMD5Read (&mfile, self->file, self->md5, self->path);
+    if (rc == 0)
+    {
+	const KFile * bfile;
+	rc = KFileMakeBuf (&bfile, mfile, 64*1024);
+	if (rc == 0)
+	{
+	    /* add more here */
+
+	    KFileRelease (bfile);
+	}
+	else
+	{
+	    pLOGERR (klogErr, rc, "Failure to initiate buffer $(F)", PLOG_S(F), self->path);
+	    KFileRelease (mfile);
+	}
+    }
+    else
+	pLOGERR (klogErr, rc, "Failure to initiate MD5 summing $(F)", PLOG_S(F), self->path);
+
+    return rc;
+}
+rc_t ProcessOneDo (ProcessOne * self)
+{
+    static const char F[] = PLOG_2(PLOG_S(p),PLOG_S(t));
+    enum KPathType type;
+    rc_t rc = 0;
+    
+    type = KDirectoryPathType (self->dir, "%s", self->path);
+
+    switch (type)
+    {
+    case kptFile:
+	rc = ProcessOneDoFile (self);
+ 	break;
+/*     case kptDir: */
+/* 	break; */
+/*     case kptAlias|kptFile: */
+/* 	break; */
+/*     case kptAlias|kptDir: */
+/* 	break; */
+    default:
+	PLOGMSG (klogInfo, "+ Skipping $(p) of type $(t)", F, self->path, typeToString(type));
+	break;
+    }
+    return rc;
+}
diff --git a/tools/copycat/ccread.c b/tools/copycat/ccread.c
new file mode 100644
index 0000000..fedaef7
--- /dev/null
+++ b/tools/copycat/ccread.c
@@ -0,0 +1,302 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#include <stdlib.h>
+#include <assert.h>
+#include <atomic.h>
+#include <kapp/main.h>
+#include <kfs/directory.h>
+#include <kfs/file.h>
+#include <kfs/md5.h>
+#include <kapp/log.h>
+#include "copycat-priv.h"
+
+
+struct Reader
+{
+    atomic32_t refcount;
+    const KFile * f;	/* input file */
+    uint64_t o;		/* how far into the input file are we */
+    BufferQ * out;	/* two output queues to copy everything read */
+    BufferQ * xml;
+    BufferMgr * mgr;	/* a manager for allocating a throttling buffer set */
+};
+
+rc_t ReaderRelease (const Reader * cself)
+{
+    rc_t rc = 0;
+    Reader * self = (Reader*)cself;
+
+    if (self != NULL)
+    {
+	if (atomic32_dec_and_test (&self->refcount))
+	{
+	    /* might already have been released */
+	    rc = KFileRelease (self->f);
+	    if (rc == 0)
+	    {
+		rc = BufferQRelease (self->out);
+		if (rc == 0)
+		{
+		    rc = BufferQRelease (self->xml);
+		    if (rc == 0)
+		    {
+			rc = BufferMgrRelease (self->mgr);
+			if (rc == 0)
+			    free (self);
+			else
+			    atomic32_set (&self->refcount, 1);
+		    }
+		}
+	    }
+	}
+    }
+    return rc;
+}
+
+rc_t ReaderAddRef (const Reader * self)
+{
+    if (self != NULL)
+	atomic32_inc (&((Reader*)self)->refcount);
+    return 0;
+}
+
+rc_t ReaderMake (Reader ** r, const KDirectory * d, const char * path, Copier * p,
+		 Cataloger * g, uint32_t c, uint32_t z, uint32_t t)
+{
+    rc_t rc = 0;
+    Reader * self;
+
+    self = malloc (sizeof * self);
+    if (self == NULL)
+    {
+	rc = RC (rcExe, rcNoTarg, rcAllocating, rcMemory, rcExhausted);
+	LOGERR (klogErr, rc, "ReaderMake: error allocating Reader");
+    }
+    else
+    {
+	atomic32_set (&self->refcount, 1);
+	self->o = 0;
+
+	rc = KDirectoryOpenFileRead (d, &self->f, "%s", path);
+	if (rc != 0)
+	{
+	    pLOGERR (klogErr, rc,
+		     "ReaderMake: error open file for read $(f)",
+		     PLOG_S(f), path);
+	}
+	else
+	{
+	    self->out = CopierGetQ(p);
+	    if (self->out == NULL)
+	    {
+		rc = RC (rcExe, rcNoTarg, rcAccessing, rcBuffer, rcCorrupt);
+		LOGERR (klogErr, rc, "ReaderMake: corrupt Copier queue");
+	    }
+	    else
+	    {
+		rc = BufferQAddRef (self->out);
+		if (rc == 0)
+		{
+		    self->xml = CatalogerGetQ(g);
+		    if (self->xml == NULL)
+		    {
+			rc = RC (rcExe, rcNoTarg, rcCreating, rcQueue, rcCorrupt);
+			LOGERR (klogErr, rc, "ReaderMake: corrupt Cataloger queue");
+		    }
+		    else
+		    {
+			rc = BufferQAddRef (self->xml);
+			if (rc == 0)
+			{
+			    rc = BufferMgrMake (&self->mgr, c, z, t);
+			    if (rc == 0)
+			    {
+				atomic32_set (&self->refcount, 1);
+				*r = self;
+				return 0;
+			    }
+			    LOGERR (klogErr, rc, "ReaderMake: error creating buffer manager");
+			    BufferQRelease (self->xml);
+			}
+			LOGERR (klogErr, rc, "ReaderMake: error setting reference to xml queue");
+		    }
+		    LOGERR (klogErr, rc, "ReaderMake: error setting reference to xml queue");
+		    BufferQRelease (self->out);
+		}
+		LOGERR (klogErr, rc, "ReaderMake: error setting reference to out queue");
+	    }
+	    KFileRelease (self->f);
+	}
+	free (self);
+    }
+    return rc;
+}
+
+rc_t ReaderDoOne (Reader * self)
+{
+    rc_t rc = 0;
+
+    assert (self != NULL);
+    assert (self->mgr != NULL);
+
+    rc = Quitting();
+    if (rc == 0)
+    {
+	Buffer * b = NULL;
+
+	rc = BufferMgrGetBuffer (self->mgr, &b, NULL);
+	if (rc != 0)
+	{
+	    /* -----
+	     * if we couldn't get a buffer because we timeout, we don't want to
+	     * signal a failure, so reset the rc and exit with no error
+	     */
+	    if ((GetRCState(rc) == rcExhausted) && (GetRCObject(rc) == rcTimeout))
+	    {
+		rc = 0;
+		LOGMSG (klogInfo,
+			"ReaderDoOne: timeout getting a buffer");
+	    }
+	    else
+		LOGERR (klogErr, rc,
+			"ReaderDoOne: error getting a buffer");
+
+	}
+	else
+	{
+	    size_t t;
+	    size_t r;
+	    char * p;
+
+	    /* -----
+	     * get the limits/values of the buffer we got
+	     */
+	    t = BufferPayloadGetSize (b);
+	    p = BufferPayloadWrite (b);
+	    assert (t > 0);
+	    assert (b != NULL);
+	    
+	    /* attempt to read from the file */
+	    rc = KFileRead (self->f, self->o, p, t, &r);
+	    if (rc == 0)
+	    {
+		PLOGMSG (klogDebug10, 
+			 "ReaderDoOne: back from KFileRead $(z)",
+			 PLOG_U32(z),
+			 r);
+		/* if we have a read of some length send it to our two 
+		 * processor friends: copy and catalog
+		 */
+		if (r != 0)
+		{
+		    self->o += r;
+		    rc = BufferContentSetSize (b, r);
+		    if (rc == 0)
+		    {
+			rc = BufferQPushBuffer (self->out, b, NULL);
+			if (rc == 0)
+			{
+			    rc = BufferQPushBuffer (self->xml, b, NULL);
+			    if (rc != 0)
+				LOGERR (klogErr, rc,
+					"ReaderDoOne: Failure to send bugger to xml queue");
+			}
+			else
+			    LOGERR (klogErr, rc,
+				    "ReaderDoOne: Failure to send bugger to out queue");
+		    }
+		    else
+			LOGERR (klogErr, rc,
+				"ReaderDoOne: Failure to set size of buffer");
+		}
+		/* if we had a successful read of 'nothing' we are at end of file */
+		else
+		{
+		    /* drop the file */
+		    rc = KFileRelease (self->f);
+		    if (rc == 0)
+		    {
+			self->f = NULL;
+			/* seal off and release the two queues */
+			rc = BufferQSeal (self->out);
+			if (rc == 0)
+			{
+			    rc = BufferQRelease (self->out);
+			    if (rc == 0)
+			    {
+				self->out = NULL;
+				rc = BufferQSeal (self->xml);
+				if (rc == 0)
+				{
+				    rc = BufferQRelease (self->xml);
+				    if (rc == 0)
+				    {
+					self->xml = NULL;
+					rc = BufferMgrRelease (self->mgr);
+					if (rc == 0)
+					{
+					    self->mgr = NULL;
+					    rc = RC (rcExe, rcProcess, rcReading, rcThread, rcDone);
+					}
+					else
+					    LOGERR (klogErr, rc,
+						    "ReaderDoOne: Failure to release buffer manager");
+				    }
+				    else
+					LOGERR (klogErr, rc,
+						"ReaderDoOne: Failure to release buffer xml queue");
+				}
+				else
+				    LOGERR (klogErr, rc,
+					    "ReaderDoOne: Failure to seal buffer xml queue");
+			    }
+			    else
+				LOGERR (klogErr, rc,
+					"ReaderDoOne: Failure to release buffer out queue");
+			}
+			else
+			    LOGERR (klogErr, rc,
+				    "ReaderDoOne: Failure to seal buffer out queue");
+		    }
+		    else
+			LOGMSG (klogErr,
+				"ReaderDoOne: Failure to close input file");
+		}
+	    }
+	    else
+		LOGERR (klogErr, rc,
+			"ReaderDoOne: file read error");
+	    BufferRelease (b);
+	}
+    }
+    else
+    {
+	LOGMSG (klogInt, "ReaderDoOne: Reader quitting");
+    }
+    return rc;
+}
+
+
diff --git a/tools/copycat/ccsra.c b/tools/copycat/ccsra.c
new file mode 100644
index 0000000..8936cd3
--- /dev/null
+++ b/tools/copycat/ccsra.c
@@ -0,0 +1,1239 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+
+#include "copycat-priv.h"
+
+#include <klib/rc.h>
+#include <kfs/arc.h>
+#include <kfs/sra.h>
+#include <kfs/toc.h>
+#include <kfs/file.h>
+#include <kfs/subfile.h>
+#include <klib/namelist.h>
+#include <klib/vector.h>
+#include <klib/status.h>
+#include <klib/log.h>
+#include <klib/out.h>
+#include <klib/debug.h>
+#include <klib/text.h>
+#include <klib/printf.h>
+#include <os-native.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+
+typedef struct CCNodeSraDir CCNodeSraDir;
+#define KDIR_IMPL struct CCNodeSraDir
+#include <kfs/impl.h>
+
+/* must be after kfs/impl */
+#include "debug.h"
+
+struct CCNodeSraDir
+{
+    KDirectory dad;
+    const KFile * file;
+    const char * dir_name;
+    const char * sub_name;
+    size_t name_size;
+
+};
+
+static bool CCNodeSraDirLegalPath (const CCNodeSraDir * self, const char * path)
+{
+    if (*path == '/')
+        return (strncmp (self->sub_name, path+1, self->name_size + 1) == 0);
+    else
+        return (strncmp (self->sub_name, path, self->name_size + 1) == 0);
+}
+
+/* ----------------------------------------------------------------------
+ * CCNodeSraDirDestroy
+ */
+static rc_t CC CCNodeSraDirDestroy (CCNodeSraDir *self)
+{
+    if (self)
+    {
+        KFileRelease (self->file);
+        free (self);
+    }
+    return 0;
+}
+
+/* ----------------------------------------------------------------------
+ * CCNodeSraDirList
+ *  create a directory listing
+ *
+ *  "list" [ OUT ] - return parameter for list object
+ *
+ *  "path" [ IN, NULL OKAY ] - optional parameter for target
+ *  directory. if NULL, interpreted to mean "."
+ */
+static
+rc_t CC CCNodeSraDirList (const CCNodeSraDir *self,
+                          KNamelist **listp,
+                          bool (CC* f) (const KDirectory *dir, const char *name, void *data),
+                          void *data,
+                          const char *path,
+                          va_list args)
+{
+    assert (0);
+
+    return 0;
+}
+
+
+/* ----------------------------------------------------------------------
+ * CCNodeSraDirVisit
+ *  visit each path under designated directory,
+ *  recursively if so indicated
+ *
+ *  "recurse" [ IN ] - if non-zero, recursively visit sub-directories
+ *
+ *  "f" [ IN ] and "data" [ IN, OPAQUE ] - function to execute
+ *  on each path. receives a base directory and relative path
+ *  for each entry, where each path is also given the leaf name
+ *  for convenience. if "f" returns non-zero, the iteration will
+ *  terminate and that value will be returned. NB - "dir" will not
+ *  be the same as "self".
+ *
+ *  "path" [ IN ] - NUL terminated string in directory-native character set
+ */
+static 
+rc_t CC CCNodeSraDirVisit (const CCNodeSraDir *self, 
+                           bool recurse,
+                           rc_t (CC* f) (const KDirectory *, uint32_t, const char *, void *), 
+                           void *data,
+                           const char *path,
+                           va_list args)
+{
+    assert (0);
+
+    return 0;
+}
+
+/* ----------------------------------------------------------------------
+ * CCNodeSraDirVisitUpdate
+ */
+static rc_t CC CCNodeSraDirVisitUpdate (CCNodeSraDir *self,
+                                        bool recurse,
+                                        rc_t (CC*f) (KDirectory *,uint32_t,const char *,void *),
+                                        void *data,
+                                        const char *path,
+                                        va_list args)
+{
+    return RC (rcFS, rcDirectory, rcUpdating, rcSelf, rcUnsupported);
+}
+
+/* ----------------------------------------------------------------------
+ * CCNodeSraDirPathType
+ *  returns a KPathType
+ *
+ *  "path" [ IN ] - NUL terminated string in directory-native character set
+ * NOTE: Does not meet a design target of on stack (localized variable) allocation of single 4kb path
+ */
+static uint32_t CC CCNodeSraDirPathType (const CCNodeSraDir *self, const char *path, va_list args)
+{
+    if (CCNodeSraDirLegalPath (self, path))
+        return kptFile;
+    return kptNotFound;
+}
+
+
+/* ----------------------------------------------------------------------
+ * CCNodeSraDirRelativePath
+ *  makes "path" relative to "root"
+ *  both "root" and "path" MUST be absolute
+ *  both "root" and "path" MUST be canonical, i.e. have no "//", "/./" or "/../" sequences
+ */
+/*
+static
+rc_t CCNodeSraDirRelativePath (const CCNodeSraDir *self, enum RCContext ctx,
+                               const char *root, char *path, size_t path_max)
+{
+    assert (0);
+    return 0;
+}
+*/
+
+/* ----------------------------------------------------------------------
+ * CCNodeSraDirResolvePath
+ *
+ *  resolves path to an absolute or directory-relative path
+ *
+ * [IN]  const CCNodeSraDir *self		Objected oriented self
+ * [IN]	 bool 		absolute	if non-zero, always give a path starting
+ *  					with '/'. NB - if the directory is 
+ *					chroot'd, the absolute path
+ *					will still be relative to directory root.
+ * [OUT] char *		resolved	buffer for NUL terminated result path in 
+ *					directory-native character set
+ * [IN]	 size_t		rsize		limiting size of resolved buffer
+ * [IN]  const char *	path		NUL terminated string in directory-native
+ *					character set denoting target path. 
+ *					NB - need not exist.
+ *
+ * NOTE: Does not meet a design target of on stack (localized variable) allocation of single 4kb path
+ */
+static rc_t CC CCNodeSraDirResolvePath (const CCNodeSraDir *self,
+                                        bool absolute,
+                                        char *resolved,
+                                        size_t rsize,
+                                        const char *path_fmt,
+                                        va_list args)
+{
+    char path[4096];
+    int size = args ?
+        vsnprintf ( path, sizeof path, path_fmt, args ) :
+        snprintf  ( path, sizeof path, "%s", path_fmt );
+    if ( size < 0 || size >= (int) sizeof path )
+        return RC (rcFS, rcNoTarg, rcAccessing, rcPath, rcExcessive );
+    if (absolute && (path[0] != '/'))
+    {
+        string_printf (resolved, rsize, NULL, "/%s", path);
+    }       
+    else
+        string_copy (resolved, rsize, path, self->name_size+1);
+    return 0;
+}
+
+/* ----------------------------------------------------------------------
+ * CCNodeSraDirResolveAlias
+ *  resolves an alias path to its immediate target
+ *  NB - the resolved path may be yet another alias
+ *
+ *  "alias" [ IN ] - NUL terminated string in directory-native
+ *  character set denoting an object presumed to be an alias.
+ *
+ *  "resolved" [ OUT ] and "rsize" [ IN ] - buffer for
+ *  NUL terminated result path in directory-native character set
+ *
+ * NOTE: Does not meet a design target of on stack (localized variable) allocation of single 4kb path
+ */
+static rc_t CC CCNodeSraDirResolveAlias (const CCNodeSraDir * self, 
+                                         bool absolute,
+                                         char * resolved,
+                                         size_t rsize,
+                                         const char *alias,
+                                         va_list args)
+{
+    assert (0);
+    return 0;
+}
+
+/* ----------------------------------------------------------------------
+ * CCNodeSraDirRename
+ *  rename an object accessible from directory, replacing
+ *  any existing target object of the same type
+ *
+ *  "from" [ IN ] - NUL terminated string in directory-native
+ *  character set denoting existing object
+ *
+ *  "to" [ IN ] - NUL terminated string in directory-native
+ *  character set denoting existing object
+ */
+static
+rc_t CC CCNodeSraDirRename (CCNodeSraDir *self, bool force, const char *from, const char *to)
+{
+    assert (self != NULL);
+    assert (from != NULL);
+    assert (to != NULL);
+
+    return RC (rcFS, rcNoTarg, rcUpdating, rcSelf, rcUnsupported);
+}
+
+/* ----------------------------------------------------------------------
+ * CCNodeSraDirRemove
+ *  remove an accessible object from its directory
+ *
+ *  "path" [ IN ] - NUL terminated string in directory-native
+ *  character set denoting target object
+ *
+ *  "force" [ IN ] - if non-zero and target is a directory,
+ *  remove recursively
+ */
+static
+rc_t CC CCNodeSraDirRemove (CCNodeSraDir *self, bool force, const char *path, va_list args)
+{
+    assert (self != NULL);
+    assert (path != NULL);
+
+    return RC (rcFS, rcNoTarg, rcUpdating, rcSelf, rcUnsupported);
+}
+
+/* ----------------------------------------------------------------------
+ * CCNodeSraDirClearDir
+ *  remove all directory contents
+ *
+ *  "path" [ IN ] - NUL terminated string in directory-native
+ *  character set denoting target directory
+ *
+ *  "force" [ IN ] - if non-zero and directory entry is a
+ *  sub-directory, remove recursively
+ */
+static
+rc_t CC CCNodeSraDirClearDir (CCNodeSraDir *self, bool force, const char *path, va_list args)
+{
+    assert (self != NULL);
+    assert (path != NULL);
+
+    return RC (rcFS, rcNoTarg, rcUpdating, rcSelf, rcUnsupported);
+}
+
+/* ----------------------------------------------------------------------
+ * CCNodeSraDirAccess
+ *  get access to object
+ *
+ *  "access" [ OUT ] - return parameter for Unix access mode
+ *
+ *  "path" [ IN ] - NUL terminated string in directory-native
+ *  character set denoting target object
+ * NOTE: Does not meet a design target of on stack (localized variable) allocation of single 4kb path
+ */
+static rc_t CC CCNodeSraDirVAccess (const CCNodeSraDir *self,
+                                    uint32_t *access,
+                                    const char *path,
+                                    va_list args)
+{
+    assert (self != NULL);
+    assert (access != NULL);
+    assert (path != NULL);
+
+    return RC (rcFS, rcNoTarg, rcReading, rcSelf, rcUnsupported);
+}
+
+/* ----------------------------------------------------------------------
+ * CCNodeSraDirSetAccess
+ *  set access to object a la Unix "chmod"
+ *
+ *  "path" [ IN ] - NUL terminated string in directory-native
+ *  character set denoting target object
+ *
+ *  "access" [ IN ] and "mask" [ IN ] - definition of change
+ *  where "access" contains new bit values and "mask defines
+ *  which bits should be changed.
+ *
+ *  "recurse" [ IN ] - if non zero and "path" is a directory,
+ *  apply changes recursively.
+ */
+static rc_t CC CCNodeSraDirSetAccess (CCNodeSraDir *self,
+                                      bool recurse,
+                                      uint32_t access,
+                                      uint32_t mask,
+                                      const char *path,
+                                      va_list args)
+{
+    assert (self != NULL);
+    assert (path != NULL);
+
+    return RC (rcFS, rcNoTarg, rcUpdating, rcSelf, rcUnsupported);
+}
+
+
+static	rc_t CC CCNodeSraDirVDate (const CCNodeSraDir *self,
+                                   KTime_t *date,
+                                   const char *path,
+                                   va_list args)
+{
+    assert (self != NULL);
+    assert (date != NULL);
+    assert (path != NULL);
+
+    return RC (rcFS, rcNoTarg, rcReading, rcSelf, rcUnsupported);
+}
+static	rc_t CC CCNodeSraDirSetDate		(CCNodeSraDir *self,
+                                                 bool recurse,
+                                                 KTime_t date,
+                                                 const char *path,
+                                                 va_list args)
+{
+    assert (self != NULL);
+    assert (path != NULL);
+
+    return RC (rcFS, rcNoTarg, rcUpdating, rcSelf, rcUnsupported);
+}
+
+static
+struct KSysDir *CC CCNodeSraDirGetSysDir ( const CCNodeSraDir *self )
+{
+    return NULL;
+}
+
+/* ----------------------------------------------------------------------
+ * CCNodeSraDirCreateAlias
+ *  creates a path alias according to create mode
+ *
+ *  "targ" [ IN ] - NUL terminated string in directory-native
+ *  character set denoting target object
+ *
+ *  "alias" [ IN ] - NUL terminated string in directory-native
+ *  character set denoting target alias
+ *
+ *  "access" [ IN ] - standard Unix directory access mode
+ *  used when "mode" has kcmParents set and alias path does
+ *  not exist.
+ *
+ *  "mode" [ IN ] - a creation mode (see explanation above).
+ */
+static
+rc_t CC CCNodeSraDirCreateAlias (CCNodeSraDir *self,
+                                 uint32_t access,
+                                 KCreateMode mode,
+                                 const char *targ,
+                                 const char *alias)
+{
+    assert (self != NULL);
+    assert (targ != NULL);
+    assert (alias != NULL);
+
+    return RC (rcFS, rcNoTarg, rcCreating, rcSelf, rcUnsupported);
+}
+
+/* ----------------------------------------------------------------------
+ * CCNodeSraDirOpenFileRead
+ *  opens an existing file with read-only access
+ *
+ *  "f" [ OUT ] - return parameter for newly opened file
+ *
+ *  "path" [ IN ] - NUL terminated string in directory-native
+ *  character set denoting target file
+ * NOTE: Does not meet a design target of on stack (localized variable) allocation of single 4kb path
+ */
+static
+rc_t CC CCNodeSraDirOpenFileRead	(const CCNodeSraDir *self,
+					 const KFile **f,
+					 const char *path_fmt,
+					 va_list args)
+{
+    rc_t	rc;
+    char path[4096];
+    int size;
+
+    assert (self != NULL);
+    assert (f != NULL);
+    assert (path_fmt != NULL);
+
+    size = args ?
+        vsnprintf ( path, sizeof path, path_fmt, args ) :
+        snprintf  ( path, sizeof path, "%s", path_fmt );
+    if ( size < 0 || size >= (int) sizeof path )
+        return RC (rcFS, rcNoTarg, rcAccessing, rcPath, rcExcessive );
+
+    if (CCNodeSraDirLegalPath (self, path))
+    {
+        rc = KFileAddRef (self->file);
+        if (rc == 0)
+        {
+            *f = self->file;
+            return 0;
+        }
+        return rc;
+    }
+    else
+        rc = RC (rcFS, rcNoTarg, rcAccessing, rcPath, rcNotFound);
+    *f = NULL;
+    return rc;
+}
+
+/* ----------------------------------------------------------------------
+ * CCNodeSraDirOpenFileWrite
+ *  opens an existing file with write access
+ *
+ *  "f" [ OUT ] - return parameter for newly opened file
+ *
+ *  "path" [ IN ] - NUL terminated string in directory-native
+ *  character set denoting target file
+ *
+ *  "update" [ IN ] - if non-zero, open in read/write mode
+ *  otherwise, open in write-only mode
+ */
+static
+rc_t CC CCNodeSraDirOpenFileWrite	(CCNodeSraDir *self,
+					 KFile **f,
+					 bool update,
+					 const char *path,
+					 va_list args)
+{
+    assert (self != NULL);
+    assert (f != NULL);
+    assert (path != NULL);
+
+    return RC (rcFS, rcNoTarg, rcCreating, rcSelf, rcUnsupported);
+}
+
+/* ----------------------------------------------------------------------
+ * CCNodeSraDirCreateFile
+ *  opens a file with write access
+ *
+ *  "f" [ OUT ] - return parameter for newly opened file
+ *
+ *  "path" [ IN ] - NUL terminated string in directory-native
+ *  character set denoting target file
+ *
+ *  "access" [ IN ] - standard Unix access mode, e.g. 0664
+ *
+ *  "update" [ IN ] - if non-zero, open in read/write mode
+ *  otherwise, open in write-only mode
+ *
+ *  "mode" [ IN ] - a creation mode (see explanation above).
+ */
+static
+rc_t CC CCNodeSraDirCreateFile	(CCNodeSraDir *self,
+                                 KFile **f,
+                                 bool update,
+                                 uint32_t access,
+                                 KCreateMode cmode,
+                                 const char *path,
+                                 va_list args)
+{
+    assert (self != NULL);
+    assert (f != NULL);
+    assert (path != NULL);
+
+    return RC (rcFS, rcNoTarg, rcCreating, rcSelf, rcUnsupported);
+}
+
+/* ----------------------------------------------------------------------
+ * CCNodeSraDirFileLocator
+ *  returns locator in bytes of target file
+ *
+ *  "path" [ IN ] - NUL terminated string in directory-native
+ *  character set denoting target file
+ *
+ *  "locator" [ OUT ] - return parameter for file locator
+ * NOTE: Does not meet a design target of on stack (localized variable) allocation of single 4kb path
+ */
+static
+rc_t CC CCNodeSraDirFileLocator		(const CCNodeSraDir *self,
+					 uint64_t *locator,
+					 const char *path_fmt,
+					 va_list args)
+{
+    char path[4096];
+    int size;
+
+    assert (self != NULL);
+    assert (locator != NULL);
+    assert (path_fmt != NULL);
+
+    size = args ?
+        vsnprintf ( path, sizeof path, path_fmt, args ) :
+        snprintf  ( path, sizeof path, "%s", path_fmt );
+    if ( size < 0 || size >= (int) sizeof path )
+        return RC (rcFS, rcNoTarg, rcAccessing, rcPath, rcExcessive );
+
+    *locator = 0;       /* undefined for this situation */
+    if (CCNodeSraDirLegalPath (self, path))
+        return 0;
+    return RC (rcFS, rcNoTarg, rcAccessing, rcPath, rcNotFound);
+}
+
+/* ----------------------------------------------------------------------
+ * CCNodeSraDirFileSize
+ *  returns size in bytes of target file
+ *
+ *  "path" [ IN ] - NUL terminated string in directory-native
+ *  character set denoting target file
+ *
+ *  "size" [ OUT ] - return parameter for file size
+ * NOTE: Does not meet a design target of on stack (localized variable) allocation of single 4kb path
+ */
+static
+rc_t CC CCNodeSraDirFileSize		(const CCNodeSraDir *self,
+					 uint64_t *size,
+					 const char *path_fmt,
+					 va_list args)
+{
+    char path[4096];
+    int path_size;
+
+    assert (self != NULL);
+    assert (size != NULL);
+    assert (path_fmt != NULL);
+
+    path_size = args ?
+        vsnprintf ( path, sizeof path, path_fmt, args ) :
+        snprintf  ( path, sizeof path, "%s", path_fmt );
+    if ( path_size < 0 || path_size >= (int) sizeof path )
+        return RC (rcFS, rcNoTarg, rcAccessing, rcPath, rcExcessive );
+
+    if (CCNodeSraDirLegalPath (self, path))
+        return (KFileSize (self->file, size)); /* we have to assume physical and logical size are the same */
+
+    *size = 0;
+    return RC (rcFS, rcNoTarg, rcAccessing, rcPath, rcNotFound);
+}
+
+/* ----------------------------------------------------------------------
+ * CCNodeSraDirFileSize
+ *  returns size in bytes of target file
+ *
+ *  "path" [ IN ] - NUL terminated string in directory-native
+ *  character set denoting target file
+ *
+ *  "size" [ OUT ] - return parameter for file size
+ * NOTE: Does not meet a design target of on stack (localized variable) allocation of single 4kb path
+ */
+static
+rc_t CC CCNodeSraDirFilePhysicalSize (const CCNodeSraDir *self,
+                                      uint64_t *size,
+                                      const char *path_fmt,
+                                      va_list args)
+{
+    char path[4096];
+    int path_size;
+
+    assert (self != NULL);
+    assert (size != NULL);
+    assert (path_fmt != NULL);
+
+    path_size = args ?
+        vsnprintf ( path, sizeof path, path_fmt, args ) :
+        snprintf  ( path, sizeof path, "%s", path_fmt );
+    if ( path_size < 0 || path_size >= (int) sizeof path )
+        return RC (rcFS, rcNoTarg, rcAccessing, rcPath, rcExcessive );
+
+    if (CCNodeSraDirLegalPath (self, path))
+        return (KFileSize (self->file, size)); /* we have to assume physical and logical size are the same */
+
+    *size = 0;
+    return RC (rcFS, rcNoTarg, rcAccessing, rcPath, rcNotFound);
+}
+
+/* ----------------------------------------------------------------------
+ * CCNodeSraDirSetFileSize
+ *  sets size in bytes of target file
+ *
+ *  "path" [ IN ] - NUL terminated string in directory-native
+ *  character set denoting target file
+ *
+ *  "size" [ IN ] - new file size
+ */
+static
+rc_t CC CCNodeSraDirSetFileSize	(CCNodeSraDir *self,
+                                 uint64_t size,
+                                 const char *path,
+                                 va_list args)
+{
+    assert (self != NULL);
+    assert (path != NULL);
+
+    return RC (rcFS, rcNoTarg, rcWriting, rcSelf, rcUnsupported);
+}
+
+/* ----------------------------------------------------------------------
+ * CCNodeSraDirOpenDirRead
+ *
+ *  opens a sub-directory
+ *
+ * [IN]  const CCNodeSraDir *	self	Object Oriented C CCNodeSraDir self
+ * [OUT] const KDirectory **	subp	Where to put the new KDirectory/CCNodeSraDir
+ * [IN]  bool			chroot	Create a chroot cage for this new subdirectory
+ * [IN]  const char *		path	Path to the directory to open
+ * [IN]  va_list		args	So far the only use of args is possible additions to path
+ */
+static 
+rc_t CC CCNodeSraDirOpenDirRead	(const CCNodeSraDir *self,
+                                 const KDirectory **subp,
+                                 bool chroot,
+                                 const char *path,
+                                 va_list args)
+{
+    assert (self != NULL);
+    assert (subp != NULL);
+    assert (path != NULL);
+
+    return RC (rcFS, rcNoTarg, rcReading, rcSelf, rcUnsupported);
+}
+
+/* ----------------------------------------------------------------------
+ * CCNodeSraDirOpenDirUpdate
+ *  opens a sub-directory
+ *
+ *  "path" [ IN ] - NUL terminated string in directory-native
+ *  character set denoting target directory
+ *
+ *  "chroot" [ IN ] - if non-zero, the new directory becomes
+ *  chroot'd and will interpret paths beginning with '/'
+ *  relative to itself.
+ */
+static
+rc_t CC CCNodeSraDirOpenDirUpdate	(CCNodeSraDir *self,
+					 KDirectory ** subp, 
+					 bool chroot, 
+					 const char *path, 
+					 va_list args)
+{
+    assert (self != NULL);
+    assert (subp != NULL);
+    assert (path != NULL);
+
+    return RC (rcFS, rcNoTarg, rcUpdating, rcSelf, rcUnsupported);
+}
+
+/* ----------------------------------------------------------------------
+ * CCNodeSraDirCreateDir
+ *  create a sub-directory
+ *
+ *  "path" [ IN ] - NUL terminated string in directory-native
+ *  character set denoting target directory
+ *
+ *  "access" [ IN ] - standard Unix directory permissions
+ *
+ *  "mode" [ IN ] - a creation mode (see explanation above).
+ */
+static
+rc_t CC CCNodeSraDirCreateDir	(CCNodeSraDir *self,
+                                 uint32_t access,
+                                 KCreateMode mode,
+                                 const char *path,
+                                 va_list args)
+{
+    assert (self != NULL);
+    assert (path != NULL);
+
+    return RC (rcFS, rcNoTarg, rcCreating, rcSelf, rcUnsupported);
+}
+
+/* ----------------------------------------------------------------------
+ * CCNodeSraDirDestroyFile
+ */
+static
+rc_t CC CCNodeSraDirDestroyFile	(CCNodeSraDir *self,
+                                 KFile * f)
+{
+    assert (self != NULL);
+    assert (f != NULL);
+
+    return RC (rcFS, rcNoTarg, rcDestroying, rcSelf, rcUnsupported);
+}
+
+/* ----------------------------------------------------------------------
+ * CCNodeSraDirFileContiguous
+ *  
+ *
+ *  "path" [ IN ] - NUL terminated string in directory-native
+ *  character set denoting target file
+ *
+ *  "contiguous" [ OUT ] - return parameter for file status
+ * NOTE: Does not meet a design target of on stack (localized variable) allocation of single 4kb path
+ */
+static
+rc_t CC CCNodeSraDirFileContiguous (const CCNodeSraDir *self,
+                                    bool * contiguous,
+                                    const char *path_fmt,
+                                    va_list args)
+{
+    char path[4096];
+    int size;
+
+    assert (self);
+    assert (contiguous);
+    assert (path_fmt);
+
+    size = args ?
+        vsnprintf ( path, sizeof path, path_fmt, args ) :
+        snprintf  ( path, sizeof path, "%s", path_fmt );
+    if ( size < 0 || size >= (int) sizeof path )
+        return RC (rcFS, rcNoTarg, rcAccessing, rcPath, rcExcessive );
+
+    if (CCNodeSraDirLegalPath (self, path))
+    {
+        *contiguous = true;
+        return 0;
+    }
+    *contiguous = false;
+    return RC (rcFS, rcNoTarg, rcAccessing, rcPath, rcNotFound);
+}
+
+
+static KDirectory_vt_v1 CCNodeSraDir_vt = 
+{
+    /* version 1.0 */
+    1, 3,
+
+    /* start minor version 0 methods*/
+    CCNodeSraDirDestroy,
+    CCNodeSraDirList,
+    CCNodeSraDirVisit,
+    CCNodeSraDirVisitUpdate,
+    CCNodeSraDirPathType,
+    CCNodeSraDirResolvePath,
+    CCNodeSraDirResolveAlias,
+    CCNodeSraDirRename,
+    CCNodeSraDirRemove,
+    CCNodeSraDirClearDir,
+    CCNodeSraDirVAccess,
+    CCNodeSraDirSetAccess,
+    CCNodeSraDirCreateAlias,
+    CCNodeSraDirOpenFileRead,
+    CCNodeSraDirOpenFileWrite,
+    CCNodeSraDirCreateFile,
+    CCNodeSraDirFileSize,
+    CCNodeSraDirSetFileSize,
+    CCNodeSraDirOpenDirRead,
+    CCNodeSraDirOpenDirUpdate,
+    CCNodeSraDirCreateDir,
+    CCNodeSraDirDestroyFile,
+    /* end minor version 0 methods*/
+    /* start minor version 1 methods*/
+    CCNodeSraDirVDate,
+    CCNodeSraDirSetDate,
+    CCNodeSraDirGetSysDir,
+    /* end minor version 2 methods*/
+    CCNodeSraDirFileLocator,
+    /* end minor version 2 methods*/
+    /* end minor version 3 methods*/
+    CCNodeSraDirFilePhysicalSize,
+    CCNodeSraDirFileContiguous
+    /* end minor version 3 methods*/
+};
+static const char root_name[] = "/";
+static
+rc_t KDirectoryMakeSraNodeDir (const KDirectory ** pself, const KFile * file,
+                               const char * name)
+{
+    CCNodeSraDir * self;
+    size_t name_size;
+    rc_t rc;
+
+    assert (pself);
+
+    name_size = string_size (name);
+    self = malloc (sizeof (*self) + name_size + 1);
+    if (self == NULL)
+        rc = RC (rcExe, rcNoTarg, rcAllocating, rcMemory, rcExhausted);
+    else
+    {
+        rc = KFileAddRef (file);
+        if (rc == 0)
+        {
+            rc_t orc;
+            self->file = file;
+            self->dir_name = root_name;
+            self->sub_name = (const char *)(self+1);
+            self->name_size = name_size;
+            strcpy ((char*)self->sub_name, name);
+            rc = KDirectoryInit (&self->dad, (const KDirectory_vt*)&CCNodeSraDir_vt,
+                                 "CCSraNodeDir", root_name, false);
+            if (rc == 0)
+            {
+                *pself = &self->dad;
+                return 0;
+            }
+            orc = KFileRelease (file);
+            if (orc)
+            {
+                PLOGERR (klogErr,
+                         (klogErr, orc,
+                          "Error releaseing sub file '$(F) in a KAR archive",
+                          "F=%s", name));
+                if (rc == 0)
+                    rc = orc;
+            }
+        }
+    }
+    return rc;
+}
+
+
+typedef struct list_item
+{
+    KPathType      type;
+    uint32_t       access;
+    uint64_t       size;
+    uint64_t       loc;
+    KTime_t        mtime;
+    char *         path;
+    char *         link;
+
+} list_item;
+
+static
+void CC list_item_whack (void * item, void * data)
+{
+    free (item);
+}
+static
+int CC list_item_cmp (const void * item, const void * n)
+{
+    const list_item * l = item;
+    const list_item * r = n;
+
+/* a bit of a hack to get around issue with CCTree
+ * it has to have a directory say "dir" inserted before
+ * a file within it say dir/file
+ */
+
+    /* dirs before others */
+    if ((l->type == kptDir) && (r->type != kptDir))
+        return -1;
+    if ((r->type == kptDir) && (l->type != kptDir))
+        return 1;
+    
+    /* then by location */
+    if (l->loc > r->loc)
+        return 1;
+    if (l->loc < r->loc)
+        return -1;
+
+    /* if a file is zero sized, but it before a non-zero sized file */
+    if ((l->size == 0) && (r->size > 0))
+        return -1;
+    if ((r->size == 0) && (l->size > 0))
+        return 1;
+
+    /* if type is the same, location is the same and size is the same
+     * go alphabetically.  This puts dirs before sub dirs since
+     * strcmp says "dir" comes before "dir/dir"
+     */
+    return (strcmp (l->path, r->path));
+}
+
+
+typedef struct list_adata
+{
+    Vector list;
+    Vector sort;
+    bool has_zombies;
+} list_adata;
+
+
+static rc_t list_adata_init (list_adata * self)
+{
+    VectorInit (&self->list, 0, 512);
+    VectorInit (&self->sort, 0, 512);
+    self->has_zombies = false;
+    return 0;
+}
+
+
+static void list_adata_whack (list_adata * self)
+{
+    VectorWhack (&self->list, NULL, NULL);
+    VectorWhack (&self->sort, list_item_whack, NULL);
+}
+
+
+/* filter will let us add the add to and extract by name things to kar */
+static
+rc_t step_through_dir (const KDirectory * dir, const char * path,
+                       rc_t (*action)(const KDirectory *, const char *, void *),
+                       void * adata)
+{
+    rc_t rc;
+    KNamelist * names;
+
+    STSMSG (4, ("step_through_dir %s\n", path));
+
+    rc = KDirectoryList (dir, &names, NULL, NULL, "%s", path);
+    if (rc == 0)
+    {
+        uint32_t limit;
+        rc = KNamelistCount (names, &limit);
+        if (rc == 0)
+        {
+            uint32_t idx;
+            size_t pathlen;
+
+            pathlen = strlen(path);
+            for (idx = 0; (rc == 0) && (idx < limit); idx ++)
+            {
+                const char * name;
+                rc = KNamelistGet (names, idx, &name);
+                if (rc == 0)
+                {
+                    size_t namelen = strlen (name);
+                    size_t new_pathlen = pathlen + 1 + namelen;
+                    char * new_path = malloc (new_pathlen + 1);
+
+                    if (new_path != NULL)
+                    {
+                        char * recur_path;
+                        if (pathlen == 0)
+                        {
+                            memcpy (new_path, name, namelen);
+                            new_path[namelen] = '\0';
+                        }
+                        else
+                        {
+                            memcpy (new_path, path, pathlen);
+                            new_path[pathlen] = '/';
+                            memcpy (new_path + pathlen + 1, name, namelen);
+                            new_path[pathlen+1+namelen] = '\0';
+                        }
+                        recur_path = malloc (pathlen + 1 + namelen + 1);
+                        if (recur_path != NULL)
+                        {
+                            rc = KDirectoryResolvePath (dir, false, recur_path,
+                                                         pathlen + 1 + namelen + 1,
+                                                         "%s", new_path);
+
+                            if (rc == 0)
+                                rc = action (dir, recur_path, adata);
+
+                            free (recur_path);
+                        }
+                        free (new_path);
+                    }
+                }
+            }
+        }
+        KNamelistRelease (names);
+    }
+    return rc;
+}
+static
+rc_t list_action (const KDirectory * dir, const char * path, void * _adata)
+{
+    rc_t           rc = 0;
+    list_adata *   data = _adata;
+    list_item *    item = NULL;
+    KPathType      type  = KDirectoryPathType (dir, "%s", path);
+    size_t         pathlen = strlen (path);
+    size_t         linklen = 0;
+    char           link [2 * 4096]; /* we'll truncate? */
+
+    if (type & kptAlias)
+    {
+        rc = KDirectoryVResolveAlias (dir, false, link, sizeof (link),
+                                      path, NULL);
+        if (rc == 0)
+            linklen = strlen (link);
+    }
+
+    if (rc == 0)
+    {
+        item = calloc (sizeof (*item) + pathlen + linklen + 2, 1); /* usually one too many */
+        if (item == NULL)
+        {
+            rc = RC (rcExe, rcNoTarg, rcAllocating, rcMemory, rcExhausted);
+        }
+        else
+        {
+            do
+            {
+                item->path = (char *)(item+1);
+                strcpy (item->path, path);
+                item->type = type;
+                rc = KDirectoryAccess (dir, &item->access, "%s", path);
+                if (rc) break;
+
+                rc = KDirectoryDate (dir, &item->mtime, "%s", path);
+                if (rc) break;
+
+                if (type & kptAlias)
+                {
+                    item->link = item->path + pathlen + 1;
+                    strcpy (item->link, link);
+                }
+                else switch (type & ~kptAlias)
+                {
+                case kptNotFound:
+                    rc = RC (rcExe, rcDirectory, rcAccessing, rcPath, rcNotFound);
+                    break;
+                case kptBadPath:
+                    rc = RC (rcExe, rcDirectory, rcAccessing, rcPath, rcInvalid);
+                    break;
+                case kptZombieFile:
+                    data->has_zombies = true;
+                case kptFile:
+                    rc = KDirectoryFileSize (dir, &item->size, "%s", path);
+                    if (rc == 0)
+                        rc = KDirectoryFileLocator (dir, &item->loc, "%s", path);
+                    DBGMSG (DBG_APP, 1, ("%s: found file %s size %lu at %lu\n",
+                                         __func__, item->path, item->size, item->loc));
+                    break;
+                case kptDir:
+                    DBGMSG (DBG_APP, 1, ("%s: found directory %s\n",
+                                         __func__, item->path));
+                    break;
+                default:
+                    DBGMSG (DBG_APP, 1, ("%s: found unknown %s\n",
+                                         __func__, item->path));
+                    break;
+                }
+            } while (0);
+        }
+    }
+    if (rc == 0)
+    {
+        VectorAppend (&data->list, NULL, item);
+        VectorInsert (&data->sort, item, NULL, list_item_cmp);
+
+        if (type == kptDir)
+            rc = step_through_dir (dir, path, list_action, data);
+    }
+    return rc;
+}
+
+
+typedef struct CCSra
+{
+    CCTree * tree;
+    const KDirectory * ndir;
+    const KDirectory * adir;
+    const KFile * file;
+} CCSra;
+
+
+static
+rc_t CCSraInit (CCSra ** pself, CCTree * tree, const KFile * sf, const char * name)
+{
+    CCSra * self;
+    rc_t rc;
+
+    assert (pself);
+    assert (sf);
+    assert (name);
+
+    self = malloc (sizeof (*self));
+    if (self == NULL)
+        rc = RC (rcExe, rcMemory, rcAllocating, rcMemory, rcExhausted);
+    else
+    {
+        KFileAddRef (self->file = sf);
+
+        rc = KDirectoryMakeSraNodeDir (&self->ndir, sf, name);
+        if (rc == 0)
+        {
+            rc = KDirectoryOpenSraArchiveReadUnbounded (self->ndir, &self->adir, true, "%s", name);
+            if (rc == 0)
+            {
+                self->tree = tree;
+                *pself = self;
+                return 0;
+            }
+            KDirectoryRelease (self->ndir);
+        }
+        free (self);
+    }
+    return rc; /* error out */
+}
+
+static
+bool CC CCSraOneItem (void * item_, void * data_)
+{
+    CCSra * self = data_;
+    list_item * item = item_;
+    rc_t rc;
+
+    DBGMSG (DBG_APP, 1, ("%s: %s\n", __func__, item->path));
+
+
+    switch (item->type)
+    {
+    default:
+        DBGMSG (DBG_APP, 1, ("%s: item->type not processed (%d)\n", __func__, item->type));
+        rc = 0;
+        break;
+    case kptFile:
+    {
+        CCArcFileNode * node;
+        rc = CCArcFileNodeMake (&node, item->loc, item->size);
+        if (rc == 0)
+        {
+            const KFile * sfile;
+            rc = KFileMakeSubRead (&sfile, self->file, item->loc, item->size);
+            if (rc == 0)
+            {
+                void * save;
+
+                copycat_log_set (&node->dad.logs, &save);
+
+                rc = ccat_md5 (self->tree, sfile, item->mtime, ccArcFile, &node->dad,
+                               item->path);
+
+                copycat_log_set (save, NULL);
+
+                KFileRelease (sfile);
+            }
+        }
+        DBGMSG (DBG_APP, 1, ("%s: kptFile processed %lu at %lu\n", __func__, item->size, item->loc));
+        break;
+    }
+    case kptDir:
+    {
+        CCTree * node;
+        rc = CCTreeMake (&node);
+        if (rc == 0)
+        {
+            rc = CCTreeInsert (self->tree, item->mtime, ccDirectory, node, item->path);
+            DBGMSG (DBG_APP, 1, ("%s: insert directory %s\n", __func__, item->path));
+        }
+        break;
+    }
+    }
+    DBGMSG (DBG_APP, 1, ("%s: exiting rc (%R) (%d)\n", __func__, rc, (rc !=0)));
+    return (rc != 0);
+}
+
+static
+void CCSraWhack (CCSra * self)
+{
+    rc_t rc, orc;
+    rc = KDirectoryRelease (self->ndir);
+    orc = KDirectoryRelease (self->adir);
+    if (rc == 0)
+        rc = orc;
+    orc = KFileRelease (self->file);
+    if (rc == 0)
+        rc = orc;
+    if (rc)
+        LOGERR(klogWarn, rc, "error releaseing CCSra");
+    free (self);
+}
+rc_t ccat_sra ( CCContainerNode *np, const KFile *sf, const char *name )
+{
+    rc_t rc;
+    CCSra * sra;
+
+    rc = CCSraInit (&sra, &np->sub, sf, name);
+
+    if (rc == 0)
+    {
+        list_adata ldata;
+
+        list_adata_init (&ldata);
+        rc = step_through_dir (sra->adir, ".", list_action, &ldata);
+        if (rc == 0)
+        {
+            DBGMSG (DBG_APP, 1, ("Vector sizes list (%u) sort (%u)\n", 
+                                 VectorLength(&ldata.list),
+                                 VectorLength(&ldata.sort)));
+            VectorDoUntil (&ldata.sort, false, CCSraOneItem, sra);
+/*             VectorDoUntil (&ldata.list, false, CCSraOneItem, sra); */
+        }
+        list_adata_whack (&ldata);
+        CCSraWhack (sra);
+    }
+    DBGMSG (DBG_APP, 1, ("Done with %s\n", name));
+    return rc;
+}
+
diff --git a/tools/copycat/ccsubchunk.c b/tools/copycat/ccsubchunk.c
new file mode 100644
index 0000000..c46a661
--- /dev/null
+++ b/tools/copycat/ccsubchunk.c
@@ -0,0 +1,390 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ */
+
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <klib/rc.h>
+#include <kfs/file.h>
+#include <kfs/subfile.h>
+#include <kfs/arc.h>	/* definition of chunks */
+#include "copycat-priv.h"
+/* ======================================================================
+ * KSubChunkedFile
+ *  a chunked file inside an archive not general purpose yet
+ */
+
+/* -----
+ * define the specific types to be used in the templatish/inheritancish
+ * definition of vtables and their elements
+ */
+#define KFILE_IMPL struct KSubChunkFile
+#include <kfs/impl.h>
+
+static rc_t KSubChunkFileDestroy (KSubChunkFile *self);
+static struct KSysFile *KSubChunkFileGetSysFile (const KSubChunkFile *self,
+					    uint64_t *offset);
+static rc_t KSubChunkFileRandomAccess (const KSubChunkFile *self);
+static uint32_t KSubChunkFileType (const KSubChunkFile *self);
+static rc_t KSubChunkFileSize (const KSubChunkFile *self, uint64_t *size);
+static rc_t KSubChunkFileSetSize (KSubChunkFile *self, uint64_t size);
+static rc_t KSubChunkFileRead (const KSubChunkFile *self, uint64_t pos,
+			  void *buffer, size_t bsize, size_t *num_read);
+static rc_t KSubChunkFileWrite (KSubChunkFile *self, uint64_t pos, const void *buffer,
+			   size_t size, size_t *num_writ);
+
+
+static const KFile_vt_v1 vtKSubChunkFile =
+{
+    /* version */
+    1, 1,
+
+    /* 1.0 */
+    KSubChunkFileDestroy,
+    KSubChunkFileGetSysFile,
+    KSubChunkFileRandomAccess,
+    KSubChunkFileSize,
+    KSubChunkFileSetSize,
+    KSubChunkFileRead,
+    KSubChunkFileWrite,
+
+    /* 1.1 */
+    KSubChunkFileType
+};
+
+/*-----------------------------------------------------------------------
+ * KSubChunkFile
+ *  an archive file including tar and sra
+ */
+struct KSubChunkFile
+{
+    KFile		dad;
+    uint64_t		size;
+    const KFile *	original;
+    uint32_t		num_chunks;
+    const KTocChunk 	chunks [1];
+};
+
+/* ----------------------------------------------------------------------
+ * KSubChunkFileMake
+ *  create a new file object
+ */
+
+rc_t KFileMakeChunkRead (const struct KFile ** pself,
+			 const struct KFile * original,
+			 uint64_t size,
+			 uint32_t num_chunks,
+			 struct KTocChunk * chunks)
+{
+    rc_t	rc;
+    KSubChunkFile *	self;
+
+    /* -----
+     */
+    assert (pself != NULL);
+    assert (original != NULL);
+
+    *pself = NULL;
+    rc = 0;
+    /* -----
+     * get space for the object
+     */
+    self = malloc (sizeof (KSubChunkFile) + ((num_chunks-1) * sizeof (KTocChunk)));
+    if (self == NULL)	/* allocation failed */
+    {
+        /* fail */
+        rc = RC (rcFS, rcFile, rcConstructing, rcMemory, rcExhausted);
+    }
+    else
+    {
+        rc = KFileInit (&self->dad,				/* initialize base class */
+			(const KFile_vt*)&vtKSubChunkFile, 	/* VTable for KSubChunkFile */
+                    "KSubChunkFile", "no-name",
+                        true,false);				/* read allowed,write disallowed */
+	if (rc == 0)
+	{
+	    KFileAddRef (original);
+	    /* succeed */
+	    self->size = size;
+	    self->original = original;
+	    self->num_chunks = num_chunks;
+	    memcpy ((struct KTocChunk*)self->chunks, chunks, num_chunks * sizeof (KTocChunk));
+	    *pself = &self->dad;
+	    return 0;
+	}
+	/* fail */
+	free (self);
+    }
+    return rc;
+}
+
+/* ----------------------------------------------------------------------
+ * Destroy
+ *
+ */
+static
+rc_t KSubChunkFileDestroy (KSubChunkFile *self)
+{
+    assert (self != NULL);
+    KFileRelease (self->original);
+    free (self);
+    return 0;
+}
+
+/* ----------------------------------------------------------------------
+ * GetSysFile
+ *  returns an underlying system file object
+ *  and starting offset to contiguous region
+ *  suitable for memory mapping, or NULL if
+ *  no such file is available.
+ *
+ * We cant allow memory mapping a tee file as the read?writes ar needed
+ * to trigger the writes to the copy KFile
+ */
+
+static
+struct KSysFile *KSubChunkFileGetSysFile (const KSubChunkFile *self, uint64_t *offset)
+{
+    /* parameters must be non-NULL */
+    assert (self != NULL);
+    assert (offset != NULL);
+
+    /* not implmenting at this time */
+    return NULL;
+}
+
+/* ----------------------------------------------------------------------
+ * RandomAccess
+ *
+ *  returns 0 if random access, error code otherwise
+ *
+ * Update needs to be able to seek both original and copy while read
+ * only needs to be able to seek the original.
+ */
+static
+rc_t KSubChunkFileRandomAccess (const KSubChunkFile *self)
+{
+    assert (self != NULL);
+    return KFileRandomAccess (self->original);
+}
+
+/* ----------------------------------------------------------------------
+ * Type
+ *  returns a KFileDesc
+ *  not intended to be a content type,
+ *  but rather an implementation class
+ */
+static
+uint32_t KSubChunkFileType (const KSubChunkFile *self)
+{
+    return KFileType (self->original);
+}
+
+
+/* ----------------------------------------------------------------------
+ * Size
+ *  returns size in bytes of file
+ *
+ *  "size" [ OUT ] - return parameter for file size
+ */
+static
+rc_t KSubChunkFileSize (const KSubChunkFile *self, uint64_t *size)
+{
+    assert (self != NULL);
+    assert (size != NULL);
+
+    *size = self->size;
+
+    return 0;;
+}
+
+/* ----------------------------------------------------------------------
+ * SetSize
+ *  sets size in bytes of file
+ *
+ *  "size" [ IN ] - new file size
+ */
+static
+rc_t KSubChunkFileSetSize (KSubChunkFile *self, uint64_t size)
+{
+    return RC (rcFS, rcFile, rcUpdating, rcSelf, rcUnsupported);
+}
+
+/* ----------------------------------------------------------------------
+ * Read
+ *  read file from known position
+ *
+ *  "pos" [ IN ] - starting position within file
+ *
+ *  "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
+ *
+ *  "num_read" [ OUT, NULL OKAY ] - optional return parameter
+ *  giving number of bytes actually read
+ */
+static
+rc_t	KSubChunkFileRead	(const KSubChunkFile *self,
+				 uint64_t pos,
+				 void *buffer,
+				 size_t bsize,
+				 size_t *num_read)
+{
+    size_t	count;		/* how many to read/write in an action */
+    uint8_t *	pbuff;		/* access the buffer as an array of bytes */
+    uint64_t	end;		/* this will be set to the end offset */
+    uint32_t	num_chunks;
+    const KTocChunk * pchunk;
+    rc_t	rc;		/* general purpose return from calls and pass along */
+
+    assert (self != NULL);
+    assert (buffer != NULL);
+    assert (num_read != NULL);
+    assert (bsize != 0);
+
+    /* -----
+     * assume no read/write will happen or rather start with having read none;
+     * this write could be superfluous but we need to prepare *num_read for += operations
+     */
+    *num_read = 0;
+
+    pbuff = buffer;
+    end = pos + bsize;	
+    num_chunks = self->num_chunks;
+    pchunk = self->chunks;
+
+    /* -----
+     * step through the chunks
+     */
+    for (rc = 0; (num_chunks) && (pos < end); --num_chunks, ++pchunk)
+    {
+	uint64_t 	cend;		/* end offset of this chunk */
+
+	/* -----
+	 * determine the end of this chunk
+	 */
+	cend = pchunk->logical_position + pchunk->size;
+
+	/* -----
+	 * if this chunk is entirely before the current position
+	 * we are looking for
+	 * skip to the next (if any) chunk
+	 */
+	if (pos > cend)
+	    continue;
+
+	/* -----
+	 * handle any needed zero fill section before the next chunk
+	 */
+	if (pos < pchunk->logical_position)
+	{
+	    /* -----
+	     * try to fake-read as many bytes of zero as possible
+	     * so start assuming you need enough zeros to reach the next chunk
+	     * but cut it back to the remaining requested if that was too many
+	     */
+	    count = pchunk->logical_position - pos;
+	    if (count > bsize)
+		count = bsize;
+
+	    /* fake read the zeros */
+	    memset (pbuff, 0, count);
+
+	    /* update tracking variables */
+	    pbuff += count;
+	    pos += count;
+	    *num_read += count;
+	}
+
+	/* -----
+	 * handle a chunk section
+	 *
+	 * if we are here, then we still have bytes to get and
+	 * pos >= pchunk_logical_position
+	 *
+	 * Get the most we can from this chunk.
+	 * If there are enough bytes in this chunk to finish the read: do so.
+	 * Else read through the end of the chunk
+	 */
+	count = (end <= cend) ? end - pos : cend - pos;
+
+	/* -----
+	 * a little tricky is we call by value the wanted count and the function
+	 * called will over write that with the actual read count
+	 */
+	rc = KFileRead (self->original, 
+			pchunk->source_position + (pchunk->logical_position - pos), 
+			pbuff, count, &count);
+
+	*num_read += count;
+	if (rc != 0)
+	{
+	    /* failure so abort */
+	    break;
+	}
+	pbuff += count;
+	pos += count;
+	*num_read += count;
+    }
+    /* -----
+     * If eveything so far is okay but we have more bytes to read
+     * yet no more chunks; then fill to the end with zeroes
+     */
+    if ((rc == 0) && (pos < end))
+    {
+	count = end - pos;
+	memset (pbuff, 0, count);
+	*num_read += count;
+    }
+    return rc;
+}
+
+/* ----------------------------------------------------------------------
+ * Write
+ *  write file at known position
+ *
+ *  "pos" [ IN ] - starting position within file
+ *
+ *  "buffer" [ IN ] and "size" [ IN ] - data to be written
+ *
+ *  "num_writ" [ OUT, NULL OKAY ] - optional return parameter
+ *  giving number of bytes actually written
+ *
+ * Unsupported as we now treat archives as READ ONLY
+ */
+static
+rc_t	KSubChunkFileWrite (KSubChunkFile *self, uint64_t pos,
+		       const void *buffer, size_t bsize,
+		       size_t *num_writ)
+{
+    assert (self != NULL);
+    assert (buffer != NULL);
+    assert (num_writ != NULL);
+
+    *num_writ = 0;
+    return RC (rcFS, rcFile, rcWriting, rcSelf, rcUnsupported);
+}
+
+/* end of file subfile.c */
+
diff --git a/tools/copycat/cctar.c b/tools/copycat/cctar.c
new file mode 100644
index 0000000..6dfc3cf
--- /dev/null
+++ b/tools/copycat/cctar.c
@@ -0,0 +1,2199 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+
+#include "copycat-priv.h"
+#include "debug.h"
+
+#include <klib/rc.h>
+#include <kfs/arc.h>
+#include <kfs/toc.h>
+#include <kfs/file.h>
+#include <kfs/subfile.h>
+#include <klib/out.h>
+#include <klib/log.h>
+#include <klib/debug.h>
+#include <os-native.h>
+
+#include <strtol.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+/* ======================================================================
+ *
+ * ======================================================================
+ */
+
+#define	OFFSET_OF(structure,member) ((size_t)((&(((structure*)0)->member))-(0)))
+#define PASTE_2(a,b)   a##b
+#define PASTE_3(a,b,c) a##b##c
+#define STRINGIFY(a)   #a
+#ifdef sun
+#undef sun
+#endif
+typedef struct sparse_data
+{
+    struct sparse_data*	next;
+    uint64_t		offset;
+    uint64_t		size;
+} sparse_data;
+
+typedef struct CCTar
+{
+    CCFileNode *        tar_node; /* so we can flag errors */
+    CCTree *		tree;
+    const KFile *	file;
+    const char *	name;
+    sparse_data * 	sparse_q;
+    struct KTocChunk *	chunks;		/* table of chunks: logical_position, source_position, size */
+    size_t		tar_length;	/* how long should the tar file for proper format */
+    size_t		buffer_length;	/* how long is the window into the buffer */
+    uint32_t		num_chunks;
+    uint64_t		position;	/* current position in the file */
+    uint64_t		position_new;	/* next current position in the file */
+    uint64_t		position_limit;	/* max_position read */
+
+    uint64_t            cursor;         /* where we are by parsing the tar */
+
+    bool		found_zero_block;
+    bool		found_second_zero_block;
+    uint8_t		buffer [8 * 1024];
+
+} CCTar;
+
+
+
+static
+rc_t CCTarMake (CCTar ** pself, CCTree * tree, const KFile * sf,
+                const char * name, CCFileNode * fnode)
+{
+    rc_t rc;
+    CCTar * self;
+
+    /* instead of setting individual fields to 9 allocate it as zeroed */
+    self = calloc (1, sizeof * self);
+    if (self == NULL)
+    {
+        rc = RC (rcExe, 0,0,rcMemory, rcExhausted);
+        PLOGERR (klogErr,
+                 (klogErr, rc,
+                  "No memory for tar parse object for $(P)", PLOG_S(P), name));
+        free (self);
+        *pself = NULL;
+        return rc;
+    }
+    self->tree = tree;
+    self->file = sf;
+    self->name = name;
+    self->tar_length = 1024; /* at init we expect at least two zero blocks */
+    *pself = self;
+    return 0;
+}
+
+
+static
+rc_t CCTarWhack (const CCTar * cself)
+{
+    free ((void*)cself); /* cast away const */
+    return 0;
+}
+
+
+/* ======================================================================
+ * Header format structures
+ *
+ * Tar (tape archiver) started possibly as a unix utility in BSD rivalling
+ * the cpio from the AT&T System III.  The exact derivation is unimportant
+ * and some names might be slightly misleading based on historical 
+ * inaccuracies but successful implmentation is not dependant on such 
+ * accuracy in historical trivia but rather on accuracy in technical details.
+ *
+ * Posix attempted to standardize the growingly divergent variants of tar
+ * but it has led to only slightly more standardized variants with vaguely
+ * compatible extensions.
+ *
+ * For the purposes of this implmentation we will refer to the known to the
+ * author versions of tar and include the tar like aspects of the posix pax 
+ * replacement for tar.
+ *
+ * Cpio support could be added if desired with only some difficulty.
+ *
+ * Supported known variants for this implmentation will be:
+ * 	V7 	- the oldest known common base defitions for a tar header
+ *		   block ( possibly from Unix V7?)
+ *    	POSIX	- Posix.1-1988 initial restandardization of a header block
+ *		  This versio introduced the ustar name for a tar header
+ *		  and includes that term as a "magic" constant.
+ *	PAX	- Posix.1.2001 headers for pax a tar derivative that us a
+ *		  peaceful attempt to unify the tar and cpio formats apparently.
+ *		  It isn't different than POSIX in the ustar block but instead
+ *		  is an introduction of two new values of a link field in the
+ *		  tar header that defines what comes next (see headers defined
+ *		  below).
+ *	SUN	- an extension to the POSIX tar header format from SunOS 5
+ *	STAR 85	- pre-POSIX extensions to tar from Heorg Schilling (ask him its
+ *		  the bestest most greatest tar until STAR94)
+ *	STAR 94	- A redo of star based on the POSIX ustar tar header.  A less
+ *		  broken than most implmentation of a POSIX/ustar tar header
+ *		  based tar. Schilling says its the only real implmentation of
+ *		  a ustar based tar but it isn't fully compliant by design.
+ *	GNU 89	- a selected variant of tar from FSF/GNU that is a broken 
+ *		  implementation of a POSIX/ustar header based tar.
+ *	GNU 01	- A slight redo of the FSF/GNU tar format.  There are actually
+ *		  evolving variants all of which are still somewhat broken
+ *		  implementations of a ustar based tar header format.
+ *
+ * Along with these variants of a tar/ustar semi-standard tar header there are
+ * other header blocks and other significant blocks that are also tracked in
+ * this implmentation of a tar reader.
+ *	ZERO BLOCK - a block of 512 zero bytes that is supposed to be padding at
+ *		  the end of a tar file to meet some super blocksize.  Based on
+ *		  where it fits in it would be found when looking for a header
+ *		  for the next file included in a tar archive.
+ *	RAW	- a convention to mean a header block of a type that has not been 
+ *		  determined.
+ */
+#define TYPES() \
+    type_(UNDEFINED) type_(ZERO_BLOCK) type_(CPIO) type_(V7) type_(POSIX) \
+        type_(SUN) type_(STAR_85) type_(STAR_94)  type_(GNU_89) type_(SPARSE)
+
+
+#define type_(e) PASTE_2(TAR_,e),
+
+typedef enum tar_header_type
+{
+    TYPES()
+    TAR_TYPE_COUNT
+} tar_header_type;
+
+#undef type_
+#define type_(e) STRINGIFY(e),
+static const char *	get_type_string(tar_header_type t)
+{
+    static const char * type_error = "Error";
+    static const char * type_strings[] = 
+        {
+            TYPES()
+        };
+    if ((t < 0) || (t >= TAR_TYPE_COUNT))
+	return type_error;
+    return type_strings[t];
+}
+#undef type_
+#undef TYPES
+
+
+/* =============================================================================
+ * Tar headers are almost ASCII based but definitely byte/octet based so all
+ * elements are best defined as arrays of char and use casts to signed and unsigned
+ * where appropriate in interpretation..
+ * 
+ * All Tar files or streams are divided into blocks of 512 bytes
+ * This is significant in the file data in that the last block 
+ * of a file is supposed to be padded with NUL to fill out a block
+ * and then be followed by two blocks of all NUL bytes.
+ * headers are also 512 bytes with various but fairly consistent 
+ * interpretations of what is where with in that block
+ *
+ * Most tar utilities further define super blocks consisting of a number of blocks
+ * typically 10 of them for a length of 5120 bytes.  This is irrelevant for this
+ * implmentation.  By definition a tar file ends with two "zero blocks" and enough
+ * more after that to fill one of these super blocks.  We ignore all aspects of 
+ * this.
+ */
+#define TAR_BLOCK_SIZE		(512)
+typedef char tar_raw_block [TAR_BLOCK_SIZE];
+#define BLOCKS_FOR_BYTES(byte_count)	((byte_count+TAR_BLOCK_SIZE-1)/TAR_BLOCK_SIZE)
+
+/* --------------------------------------------------------------------------------
+ * lengths of various tar header fields
+ */
+
+/* --------------------
+ * Tar file names are always 100 bytes long and include preceding 
+ * path names.  The utilities do not precluded paths that put the 
+ * files outside of the "base" where the tar file was created.
+ *
+ * To handle tar files made by older tar utilities if the last 
+ * character is '/' then the file should be assumed to be a directory.
+ *
+ * This 'type' is used for both the name of the object being archived
+ * and the link target if it is a hard or soft link.
+ */
+#define	TAR_NAME_LEN		(100)
+typedef char	tar_file_name	[TAR_NAME_LEN];
+
+/* --------------------
+ * Tar mode strings are always 8 bytes long.
+ *
+ * 9 file access permissions bits and three execution mode bits.
+ *
+ * Zero '0' not NUL pre-fill unused bytes.  a user permision of 0644 would be stored as
+ * "0000644" with a NUL terminator.
+ *
+ * The format is 7 octal ASCII bytes with only the last 4 being 
+ * significant.  That is the first three are always '0'.  The 8th 
+ * byte is NUL.
+ *
+ * Older utilities might put preceding ' ' characters or
+ * instead of pre-fill have post fill ' ' or NUL.
+ */
+#define TAR_MODE_LEN		(8)
+typedef char	tar_file_mode	[TAR_MODE_LEN];
+/* -----
+ * These are the bits if the mode is in binary (octal defines for ease of interpretation)
+ * they match the st_mode field from the stat()/fstat() struct stat.
+ *
+ * GNU tar puts the file type bits from the stat structure in the mode of the tar file.
+ * Other tar implmentations might as well though no where is this dktefined as required or
+ * recommended or even supported.
+ */
+#define	TAR_SUID_BIT	(04000)	/* set UID on execution */
+#define	TAR_GUID_BIT	(02000)	/* set GID on execution */
+#define	TAR_STICKY_BIT	(01000)	/* save text / sticky bit */
+/* file permissions */
+#define	TAR_MODE_OREAD	(00400)	/* read by owner */
+#define	TAR_MODE_OWRITE	(00200)	/* write by owner */
+#define	TAR_MODE_OEXEC	(00100)	/* execute by owner */
+#define	TAR_MODE_GREAD	(00040)	/* read by group */
+#define	TAR_MODE_GWRITE	(00020)	/* write by group */
+#define	TAR_MODE_GEXEC	(00010)	/* execute by group */
+#define	TAR_MODE_WREAD	(00004)	/* read by other */
+#define	TAR_MODE_WWRITE	(00002)	/* write by other */
+#define	TAR_MODE_WEXEC	(00001)	/* execute by other */
+
+/* -----
+ * These are the bits once converted into ASCII
+ * with in an ASCII byte these bits are actually usable so no conversion needed
+ * '0' = 0x30 / 060
+ * '1' = 0x31 / 061
+ * '2' = 0x32 / 062
+ * '3' = 0x33 / 063
+ * '4' = 0x34 / 064
+ * '5' = 0x35 / 065
+ * '6' = 0x36 / 066
+ * '7' = 0x37 / 067
+ */
+#define	TAR_MODE_READ		(0x01)
+#define	TAR_MODE_WRITE		(0x02)
+#define	TAR_MODE_EXEC		(0x04)
+#define TAR_MODE_STICKY		(0x01)
+#define TAR_MODE_GUID		(0x02)
+#define TAR_MODE_SUID		(0x04)
+#define	TAR_MODE_OWNER_BYTE	(6)
+#define	TAR_MODE_GROUP_BYTE	(5)
+#define	TAR_MODE_WORLD_BYTE	(4)
+#define	TAR_MODE_USER_BYTE	(3)
+#define	TAR_MODE_EXEC_BYTE	(2)
+
+/* --------------------
+ * Tar user (and group) numeric IDs are put into 8 bytes.
+ *
+ * There is a '0' prefill and as terminating NUL.
+ *
+ * Older utilities might put preceding ' ' characters or
+ * instead of pre-fill have post fill ' ' or NUL.
+ */
+#define TAR_ID_LEN		(8)
+typedef	char	tar_id		[TAR_ID_LEN];
+
+/* --------------------
+ * Tar file size elements are 12 bytes long with 11 used
+ * for octal characters making the maximum size of a file
+ * for pure classic or Posix tar limited to 8 GBytes.  
+ * Various tar utilities handle longer files in different
+ * ways if at all.
+ *
+ * A length of 100 bytes would be stored as "00000000144".
+ *
+ * Links and some other special values are archived with a
+ * length of zero and thus no data blocks.
+ *
+ * There is a '0' prefill and as terminating NUL.
+ *
+ * Older utilities might put preceding ' ' characters or
+ * instead of pre-fill have post fill ' ' or NUL.
+ *
+ * GNU tar implmentations use alternative intrpretatopms of
+ * this and possibly other fields using mime base 64 or
+ * base 256 (big endian nonstandard sized binary)
+ */
+#define	TAR_SIZE_LEN		(12)
+typedef char	tar_size	[TAR_SIZE_LEN];
+#define MAX_TAR_FILE_SIZE	(077777777777)
+
+/* --------------------
+ * Tar file modification/access/creation times are 12 bytes
+ * long.  This holds 11 octal ASCII digits representing the
+ * number of seconds since 01/01/1970 00:00 UTC.
+ *
+ * There is a '0' prefill and as terminating NUL.
+ *
+ * Older utilities might put preceding ' ' characters or
+ * instead of pre-fill have post fill ' ' or NUL.
+ */
+#define TAR_TIME_LEN		(12)
+typedef	char	tar_time	[TAR_TIME_LEN];
+
+/* --------------------
+ * Tar has a weak checksum protection of part of the tar header
+ * that is 8 bytes long and again uses 7 ASCII octal digits.
+ *
+ * There is a '0' prefill and as terminating NUL.
+ *
+ * Older utilities might put preceding ' ' characters or
+ * instead of pre-fill have post fill ' ' or NUL.
+ */
+#define TAR_CSUM_LEN		(8)
+typedef	char	tar_csum	[TAR_CSUM_LEN];
+#define	csum_blanks		("       ")
+
+/* --------------------
+ * The tar link is a single byte that expresses the type of file
+ * or special value represented by this entry.
+ */
+typedef	char	tar_link;
+
+#define LINKS()                   \
+    link_('\0',OLDNORMAL_FILE)    \
+    link_('0',NORMAL_FILE)        \
+    link_('1',HARD_LINK)          \
+    link_('2',SYMBOLIC_LINK)      \
+    link_('3',CHARACTER_SPECIAL)  \
+    link_('4',BLOCK_SPECIAL)      \
+    link_('5',DIRECTORY)          \
+    link_('6',FIFO)               \
+    link_('7',CONTIGUOUS_FILE)    \
+    link_('A',SOLARIS_ACL)        \
+    link_('D',GNU_DUMPDIR)        \
+    link_('E',SOLARIS_ACL_FILE)   \
+    link_('I',INODE_METADATA)     \
+    link_('K',NEXT_LONG_LINK)     \
+    link_('L',NEXT_LONG_NAME)     \
+    link_('M',MULTI_VOLUME)       \
+    link_('N',GNU1989_LONG_NAMES) \
+    link_('S',SPARSE)             \
+    link_('V',VOLUME_NAME)        \
+    link_('X',SUN_XHDR)           \
+    link_('g',PAX_GLOBAL_XHDR)    \
+    link_('x',PAX_XHDR)
+
+#define link_(v,n)      PASTE_2(LINK_,n) = v,
+
+enum e_tar_link
+{
+    LINKS()
+    LINK_TYPE_COUNT
+};
+#undef link_
+
+#define link_(v,n) {STRINGIFY(n), v},
+struct nv_pair
+{
+    const char * name;
+    tar_link  link;
+};
+static const char * get_link_string(tar_link l)
+{
+    static const struct nv_pair pairs[] = 
+        {
+            LINKS()
+            {NULL, 0}
+        };
+    unsigned int ix;
+
+    for (ix = 0; ix < LINK_TYPE_COUNT; ++ix)
+        if (pairs[ix].link == l)
+            return pairs[ix].name;
+    return "UNDEFINED";
+}
+#undef link_
+#undef LINKS
+
+
+/* --------------------
+ * The tar magic string is 6 bytes long.
+ */
+#define	TAR_MAGIC_LEN		(6)
+typedef char	tar_magic	[TAR_MAGIC_LEN];
+#define	POSIX_MAGIC_CONST	"ustar"		/* includes terminating NUL */
+
+/* --------------------
+ * The tar version string is two bytes long and uses both bytes
+ */
+#define	TAR_VERSION_LEN		(2)
+typedef	char	tar_version	[TAR_VERSION_LEN];
+#define	POSIX_VERSION_CONST	"00"		/* does not include terminating NUL */
+
+/* --------------------
+ * The Posix strong user/group name is 32 bytes long
+ */
+#define TAR_STRNAME_LEN		(32)
+typedef	char	tar_strname	[TAR_STRNAME_LEN];
+
+/* --------------------
+ * The dev? strings are 8 bytes long
+ */
+#define	TAR_DEV_LEN		(8)
+typedef	char	tar_dev		[TAR_DEV_LEN];
+
+/* --------------------
+ * Posix prefix is 155 bytes that can be put before the name to give a path of
+ * 255 bytes instad of the smaller limit of 99.
+ */
+#define	TAR_PREFIX_LEN		(155)
+typedef	char	tar_prefix	[TAR_PREFIX_LEN];
+
+/*
+ * Sun extensions
+ */
+
+/* --------------------
+ */
+typedef	char sun_extnum;
+#define	SUN_FULLSIZE_LEN	(10)
+typedef	char	sun_fullsize	[SUN_FULLSIZE_LEN];
+
+/* --------------------
+ * star extensions
+ *
+ * star85 is old star from 1985
+ */
+typedef	char	star85_version;
+#define	STAR85_FILETYPE_LEN	(8)
+typedef char	star85_filetype	[STAR85_FILETYPE_LEN];
+#define	STAR85_TYPE_LEN		(12)
+typedef	char	star85_type	[STAR85_TYPE_LEN];
+#define	STAR85_RDEV_LEN		(12)
+typedef	char	star85_rdev	[STAR85_RDEV_LEN];
+/* ignoring the 11 byte rdev with minor bits */
+#define	STAR85_UNAME_LEN	(16)
+typedef	char	star85_uname	[STAR85_UNAME_LEN];
+#define	STAR85_GNAME_LEN	(15)
+typedef	char	star85_gname	[STAR85_GNAME_LEN];
+#define	STAR_XMAGIC_LEN		(4)
+typedef	char	star_magic	[STAR_XMAGIC_LEN];
+#define	STAR_MAGIC_CONST	("tar")
+#define	NSTAR_PREFIX_LEN	(1)
+typedef	char	nstar_prefix	[NSTAR_PREFIX_LEN];
+
+/* --------------------
+ * gnu extensions
+ */
+#define	GNU89_MAGIC_LEN		(8)
+typedef	char	gnu89_magic	[GNU89_MAGIC_LEN];
+#define	GNU_89_MAGIC_CONST	"ustar  "		/* includes terminating NUL */
+#define	GNU_89_GNUMAGIC_CONST	"GNUtar "		/* includes terminating NUL */
+#define GNU89_LONGNAMES_LEN	(4)
+typedef char	gnu89_longnames	[GNU89_LONGNAMES_LEN];
+
+
+/* --------------------
+ * shared between the feuding star and gnu tar
+ */
+typedef	char	tar_isextended ;
+typedef struct	tar_sparse
+{
+    tar_size	offset;
+    tar_size	num_bytes;
+} tar_sparse;
+#define	GNU_SPARSES_IN_EXTRA_HEADER		(16)
+#define	GNU_SPARSES_IN_OLD_HEADER		(4)
+#define	GNU_SPARSES_IN_SPARSE_HEADER		(21)
+#define	STAR_SPARSES_IN_HEADER			(4)
+#define	STAR_SPARSES_IN_EXT_HEADER		(21)
+
+
+/* ----------------------------------------
+ * The various tar header formats
+ *
+ * Note that in all the tar, posix and pax formats the first 257 bytes are
+ * the same.  In all posix ad almost compliant formats the first
+ * 345 bytes are the same (except GNU 89).  It is abuse of the 155
+ * bytes of the prefix that make star and gnu truly not posix compliant
+ * Sun used the 12 bytes after the prefix so is still psox compliant.
+ */
+typedef	struct	tar_v7_header
+{
+    /* type		member name			 and offset */
+    tar_file_name	name;				/*   0 */
+    tar_file_mode	mode;				/* 100 */
+    tar_id		uid;				/* 108 */
+    tar_id		gid;				/* 116 */
+    tar_size		size;				/* 124 */
+    tar_time		mtime;				/* 136 */
+    tar_csum		csum;				/* 148 */
+    tar_link		link;				/* 156 */
+    tar_file_name	linkname;			/* 157 */
+    /* end of header					// 257 */
+} tar_v7_header;
+
+typedef struct tar_posix_header
+{
+    /* type		member name			 and offset */
+    tar_file_name	name;				/*   0 */
+    tar_file_mode	mode;				/* 100 */
+    tar_id		uid;				/* 108 */
+    tar_id		gid;				/* 116 */
+    tar_size		size;				/* 124 */
+    tar_time		mtime;				/* 136 */
+    tar_csum		csum;				/* 148 */
+    tar_link		link;				/* 156 */
+    tar_file_name	linkname;			/* 157 */
+    tar_magic		magic;				/* 257 */
+    tar_version		version;			/* 263 */
+    tar_strname		uname;				/* 265 */
+    tar_strname		gname;				/* 297 */
+    tar_dev		devmajor;			/* 329 */
+    tar_dev		devminor;			/* 337 */
+    tar_prefix		prefix;				/* 345 */
+    /* end of header					// 500 */
+} tar_posix_header, tar_pax_header;
+
+typedef struct tar_sun_header
+{
+    /* type		member name			 and offset */
+    tar_file_name	name;				/*   0 */
+    tar_file_mode	mode;				/* 100 */
+    tar_id		uid;				/* 108 */
+    tar_id		gid;				/* 116 */
+    tar_size		size;				/* 124 */
+    tar_time		mtime;				/* 136 */
+    tar_csum		csum;				/* 148 */
+    tar_link		link;				/* 156 */
+    tar_file_name	linkname;			/* 157 */
+    tar_magic		magic;				/* 257 */
+    tar_version		version;			/* 263 */
+    tar_strname		uname;				/* 265 */
+    tar_strname		gname;				/* 297 */
+    tar_dev		devmajor;			/* 329 */
+    tar_dev		devminor;			/* 337 */
+    tar_prefix		prefix;				/* 345 */
+    sun_extnum		extnum;				/* 500 non-conformant */
+    sun_extnum		extcount;			/* 501 non-conformant */
+    sun_fullsize	fullsize;			/* 502 non-conformant */
+    /* end of header					// 512 non-conformant */
+} tar_sun_header;
+
+typedef struct tar_star_85_header
+{
+    /* type		member name			 and offset */
+    tar_file_name	name;				/*   0 */
+    tar_file_mode	mode;				/* 100 */
+    tar_id		uid;				/* 108 */
+    tar_id		gid;				/* 116 */
+    tar_size		size;				/* 124 */
+    tar_time		mtime;				/* 136 */
+    tar_csum		csum;				/* 148 */
+    tar_link		link;				/* 156 */
+    tar_file_name	linkname;			/* 157 */
+    star85_version	starversion;			/* 257 non-conformant */
+    star85_filetype	starfiletype;			/* 258 internal type of file? non-conformant */
+    star85_type		startype;			/* 266 type of file (UNIX)? non-conformant */
+    star85_rdev		rdev;				/* 278 non-conformant */
+    tar_time		atime;				/* 290 non-conformant */
+    tar_time		ctime;				/* 302 non-conformant */
+    star85_uname	uname;				/* 314 non-conformant */
+    star85_gname	gname;				/* 330 non-conformant */
+    tar_prefix		prefix;				/* 345 non-conformant */
+    char		___fill0[8];			/* 500 non-conformant */
+    star_magic		xmagic;				/* 508 non-conformant */
+    /* end of header					// 512 non-conformant */
+} tar_star_85_header;
+typedef struct tar_star_94_header
+{
+    /* type		member name			 and offset */
+    tar_file_name	name;				/*   0 */
+    tar_file_mode	mode;				/* 100 */
+    tar_id		uid;				/* 108 */
+    tar_id		gid;				/* 116 */
+    tar_size		size;				/* 124 */
+    tar_time		mtime;				/* 136 */
+    tar_csum		csum;				/* 148 */
+    tar_link		link;				/* 156 */
+    tar_file_name	linkname;			/* 157 */
+    tar_magic		magic;				/* 257 */
+    tar_version		version;			/* 263 */
+    tar_strname		uname;				/* 265 */
+    tar_strname		gname;				/* 297 */
+    tar_dev		devmajor;			/* 329 */
+    tar_dev		devminor;			/* 337 */
+    nstar_prefix	prefix;				/* 345 */
+    char		___fill0;			/* 346 */
+    char		___fill1[8];			/* 347 */
+    tar_isextended	isextended;			/* 355 non-conformant */
+    tar_sparse 		sparse[STAR_SPARSES_IN_HEADER];	/* 356 non-conformant */
+    tar_size		realsize;			/* 452 non-conformant */
+    tar_size		offset;				/* 464 non-conformant */
+    tar_time		atime;				/* 476 non-conformant */
+    tar_time		ctime;				/* 488 non-conformant */
+    char		___fill2[8];			/* 500 */
+    star_magic		xmagic;				/* 508 non-conformant */
+    /* end of header					// 512 */
+} tar_star_94_header;
+
+typedef struct tar_gnu_89_header
+{
+    /* type		member name			 and offset */
+    tar_file_name	name;				/*   0 */
+    tar_file_mode	mode;				/* 100 */
+    tar_id		uid;				/* 108 */
+    tar_id		gid;				/* 116 */
+    tar_size		size;				/* 124 */
+    tar_time		mtime;				/* 136 */
+    tar_csum		csum;				/* 148 */
+    tar_link		link;				/* 156 */
+    tar_file_name	linkname;			/* 157 */
+    gnu89_magic		magic;				/* 257 non-conformant */
+    tar_strname		uname;				/* 265 */
+    tar_strname		gname;				/* 297 */
+    tar_dev		devmajor;			/* 329 */
+    tar_dev		devminor;			/* 337 */
+    tar_time		atime;				/* 345 non-conformant */
+    tar_time		ctime;				/* 357 non-conformant */
+    tar_size		offset;				/* 369 non-conformant */
+    gnu89_longnames	longnames;			/* 381 non-conformant */
+    char		___fill0[1];			/* 385 */
+    tar_sparse		sparse	[GNU_SPARSES_IN_OLD_HEADER];/* 386 optional sparse */
+    tar_isextended	isextended;			/* 482 non-conformant */
+    tar_size		realsize;			/* 483 non-conformant */
+    /* end of header					// 495 */
+} tar_gnu_89_header;
+
+typedef struct tar_gnu_99_header
+{
+    /* type		member name			 and offset */
+    tar_file_name	name;				/*   0 */
+    tar_file_mode	mode;				/* 100 */
+    tar_id		uid;				/* 108 */
+    tar_id		gid;				/* 116 */
+    tar_size		size;				/* 124 */
+    tar_time		mtime;				/* 136 */
+    tar_csum		csum;				/* 148 */
+    tar_link		link;				/* 156 */
+    tar_file_name	linkname;			/* 157 */
+    gnu89_magic		magic;				/* 257 non-conformant */
+    tar_strname		uname;				/* 265 */
+    tar_strname		gname;				/* 297 */
+    tar_dev		devmajor;			/* 329 */
+    tar_dev		devminor;			/* 337 */
+    tar_time		atime;				/* 345 non-conformant */
+    tar_time		ctime;				/* 357 non-conformant */
+    tar_size		offset;				/* 369 non-conformant */
+    gnu89_longnames	longnames;			/* 381 non-conformant */
+    char		___fill0[1];			/* 385 */
+    tar_sparse		sparse	[GNU_SPARSES_IN_OLD_HEADER];/* 386 non-conformant optional sparse */
+    tar_isextended	isextended;			/* 482 non-conformant */
+    tar_size		realsize;			/* 483 non-conformant */
+    /* end of header					// 495 */
+} tar_gnu_99_header;
+
+typedef struct tar_sparse_header
+{
+    /* type		member name			 and offset */
+    tar_sparse		sparse	[STAR_SPARSES_IN_EXT_HEADER];/* 0 */
+    tar_isextended	isextended;			/* 504 */
+} tar_sparse_header;					/* 505 end of header */
+
+typedef struct tar_cpio_header
+{
+    /* type		member name			 and offset */
+    char		magic		[6];		/*   0	must be "070707" */
+#define	TAR_CPIO_MAGIC_CONST ("070707")
+    char		dev		[6];		/*   6  (dev,ino) is unique for each file in archive */
+    char		ino		[6];		/*  12  see dev */
+    char		mode		[6];		/*  18 */
+    char		uid		[6];		/*  24 */
+    char		gif		[6];		/*  30 */
+    char		nlink		[6];		/*  36 */
+    char		rdev		[6];		/*  42 */
+    char		mtime		[11];		/*  48 */
+    char		namesize	[6];		/*  59 */
+    char		filesize	[6];		/*  65 */
+    char		buff		[1];		/*  71  name and file data */
+} tar_cpio_header;
+
+typedef union tar_header
+{
+    /* ----------
+     * The TAR header is to be zero filled by definition but some tar
+     * programs use ' ' instead.
+     *
+     * accept zeros ('0'), spaces (' ') or NULs (0x00) as equivalent where reasonable
+     *
+     * This name refers to the entire header as a single undifferentiated
+     * sequence of bytes.
+     */
+    tar_raw_block	raw;		/* tar block as an array of bytes: used for 0 blocks here */
+    tar_cpio_header	cpio;		/* cpio not really tar */
+    tar_v7_header	tar;		/* classic header back to the beginnings of memory */
+    tar_posix_header	posix;		/* ustar or Posix 1003.1 header */
+    tar_sun_header	suntar;		/* Sun Microsystems tar header */
+    tar_star_85_header	star_85;	/* star header from 1985 (pre-Posix) */
+    tar_star_94_header	star_94;	/* star header from 1994 (post-Posix) */
+    tar_gnu_89_header	gnu_89;		/* gnu header from circa 1989 (post-posix but broken) */
+    tar_gnu_99_header	gnu_99;         /* gnu header from ???? */
+    tar_sparse_header	sparse;		/* star / gnu extended sparses header */
+} tar_header;
+
+
+/* ======================================================================
+ * local module-wide function like macros
+ */
+/* -----
+ * offset of is the count of bytes between the base of a structure and 
+ * a particular member of that structure
+ */
+#define	OFFSET_OF(structure,member) ((size_t)((&(((structure*)0)->member))-(0)))
+
+
+/* ======================================================================
+ * compilation unit local functions
+ */
+
+/* ======================================================================
+ * return the RFC 2045 base 64 value for a byte character 
+ * -1 for any out of range
+ *
+ * base 64 uses A-Z as 0-25, a-z as 26-51, 0-9 as 52-61, + as 62 and / as 63
+ */
+static int64_t decode_base64char (uint8_t byte)
+{
+    /* 
+     * trade off of space for table versus time to upsize the return
+     * and reupsize where it is used
+     */
+    static const int8_t table[] = 
+	{
+	    /*
+	     * 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+	     */
+	    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 00 */
+	    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 10 */
+	    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63, /* 20 */
+	    52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1, /* 30 */
+	    -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14, /* 40 */
+	    15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1, /* 50 */
+	    -1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40, /* 60 */
+	    41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1, /* 70 */
+	    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 80 */
+	    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 90 */
+	    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* A0 */
+	    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* B0 */
+	    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* C0 */
+	    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* D0 */
+	    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* E0 */
+	    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1  /* F0 */
+	};
+    return table[byte];
+}
+
+
+/* ======================================================================
+ * return the RFC 2045 base 64 value of a string at <str> of length <len>
+ *
+ * Interpreted the specification to mean that you simply ignore any out
+ * of range characters.  They are not treated as bytes of 0 as that would
+ * mean a shift of earlier bytes.
+ *
+ * Each character is 6 bits of the final value.
+ */
+static int64_t decode_base64string (const uint8_t* str, size_t len)
+{
+    int64_t 	result = 0;
+    int64_t 	temp = 0;
+    size_t 	ix;
+
+    for (ix = 0; ix < len; ++ix)
+    {
+	if ((temp = decode_base64char(str[ix])) >= 0)
+	{
+	    result <<= 6; /* result *= 64 */
+	    result += temp;
+	}
+    }
+    return result;
+}
+
+
+/* ======================================================================
+ * tar_strtoll
+ *
+ * This function will convert a string in a tar header into a 64 signed
+ * integer.
+ *
+ * The original tar header used just octal numbers in ascii in fixed length
+ * fields.  As normal in the computer software world these "obviously plenty
+ * big" fields became way too small.
+ *
+ * GNU tar invented two approaches to make these numeric fields "bigger" but
+ * only prolonged the pain by squeezing the new numbers into the same fields.
+ *
+ * In the tar v7 and ustar based tar headers the fields are:
+ *	Name	Size	Octal Range	Interpretation
+ *	mode	8	0-2097151 	bit flags
+ *	uid	8	0-2097151
+ *	gid	8	0-2097151
+ *	size	12	0-8589934591	up to 8 Giga-Byte files
+ *	mtime	12	0-8589934591 	1970/01/01 00:00:00 GMT-2242/03/16 12:56:31 GMT
+ *	
+ *	atime	12	0-8589934591 	1970/01/01 00:00:00 GMT-2242/03/16 12:56:31 GMT
+ *	ctime	12	0-8589934591 	1970/01/01 00:00:00 GMT-2242/03/16 12:56:31 GMT
+ *
+ * GNU's first and already obsolete approach was to put Mime base-64 numbers
+ * With these the first byte is '+' or '-' to signal it isn't octal ASCII.
+ *
+ * GNU's second approach is base-256 which is a big endian binary string of lengths other
+ * than the 1, 2, 4 or 8 bytes of the standard integer types.  In this approach the first
+ * byte is either 0x80 for a positive number or 0xFF for a negative number.
+ */
+
+static int64_t tar_strtoll (const uint8_t * str, size_t len)
+{
+    int64_t	result = 0;
+    bool negative = false;
+    uint8_t temp_buff[24];	/* long enough to hold all octal bytes for 64 bit numbers */
+
+    /* -----
+     * force a NUL in case the source doesn't have one; this is for
+     * strtoll() on ASCII Octal
+     */
+    if ( len >= sizeof temp_buff )
+        len = sizeof temp_buff - 1;
+    memcpy (temp_buff, str, len);
+    temp_buff[ len ] = 0x00;
+
+    /* -----
+     * Most are going to be simple ASCII octal using '0'-'7' with NUL terminator
+     * leading 0 is not required but of course is accepted to match tar 
+     * header specifications
+     */
+    if (((temp_buff[0] >= '0')&&(temp_buff[0] <= '7'))||(temp_buff[0] == ' '))
+    {
+        /* use stdlib strtoll - longest expected goes a few bits into the upper longword */
+        result = strtoi64((char*)temp_buff,NULL,8);
+    }
+    /* -----
+     * "base-256" well that is "binary" big endian of some length
+     *
+     * For fields longer than eight bytes upper bytes will shift out of 
+     * significance into the bit bucket.
+     */
+    else if ((temp_buff[0] == 0x80)||(temp_buff[0] == 0xFF)) /* from GNU tar */
+    {
+        unsigned int ix;
+        negative = (bool)((temp_buff[0] == 0xFF) ? true : false);
+        result = temp_buff[0] & 0x7F; /* toss first flag bit */
+        for (ix = 1; ix < len; ++ix)
+        {
+            result <<= 8; /* result *= 256; */
+            result += temp_buff[ix];
+        }
+        if (negative)
+            result = -result;
+    }
+    /* -----
+     * "base-64" an already dumped idea from GNU tar
+     */
+    else if ((temp_buff[0] == '+')||(temp_buff[0] == '-')) /* from GNU tar */
+    {
+        int64_t temp;
+        negative = (bool)((temp_buff[0] == '-') ? true : false);
+        temp = decode_base64string(temp_buff+1,len-1);
+        /* potential overflow */
+        result = negative ? -temp : temp;
+    }
+
+    /* -----
+     * look for an empty field of all NUL
+     */
+    else if (temp_buff[0] == 0x00)
+    {
+        unsigned int ix;
+        for (ix = 1; ix < len; ++ix)
+        {
+            if (temp_buff[ix] != 0x00)
+                goto fail;
+        }
+    }
+    /* -----
+     * no idea what it is then
+     */
+    else
+    {
+    fail:
+        result = 0; /* as good a guess as any */
+        PLOGMSG (klogErr, (klogErr, "unknown integer storage type $(B0)$(B1)$(B2)$(B3)$(B4)$(B5)$(B6)$(B7)",
+                           "B0=%c,B1=%c,B2=%c,B3=%c,B4=%c,B5=%c,B6=%c,B7=%c",
+                           temp_buff[0],temp_buff[1],temp_buff[2],temp_buff[3],
+                           temp_buff[4],temp_buff[5],temp_buff[6],temp_buff[7]));
+    }
+    return result;
+}
+
+
+
+/* ======================================================================
+ * tar_header_type
+ * determine most probable tar header block type
+ */
+static tar_header_type	what_header_type(const tar_header* header)
+{
+    /* -----
+     * we'll assume its bad until we find a better guess
+     */
+    tar_header_type type = TAR_UNDEFINED;
+
+    /* -----
+     * look for a cpio header though we aren't expecting to support it quite yet
+     */
+    if (strncmp(header->cpio.magic, TAR_CPIO_MAGIC_CONST, sizeof(header->cpio.magic)) == 0)
+    {
+	type = TAR_CPIO;
+    }
+    /* -----
+     * look for extended headers of some type
+     *
+     * look for posix based extensions as hopefully most likely
+     */
+    else if (strcmp(header->posix.magic, POSIX_MAGIC_CONST) == 0)
+    {
+	/* -----
+	 * we have a post posix standard tar header but we aren't done yet
+	 *
+	 * First we look for star extensions to the header
+	 */
+	if (strcmp(header->star_94.xmagic, STAR_MAGIC_CONST) == 0)
+	{
+
+	    /* -----
+	     * we have either an old or new star archive
+	     */
+	    if (strcmp(header->star_94.magic, POSIX_MAGIC_CONST) == 0)
+	    {
+		/* -----
+		 * we have a new star type archive
+		 */
+		type = TAR_STAR_94;
+	    }
+	    else
+	    {
+		/* -----
+		 * we have a old star type archive
+		 */
+		type = TAR_STAR_85;
+	    }
+	}
+	/* -----
+	 * Next we look for SunOS5 extensions to the header
+	 */
+	else if (header->suntar.extnum &&
+		 header->suntar.extcount &&
+		 header->suntar.fullsize)
+	{
+	    type = TAR_SUN;
+	}
+	/* -----
+	 * Else it seems to be the generic Posix tar header
+	 */
+	else
+	{
+	    type = TAR_POSIX;
+	}
+    }
+    /* -----
+     * Not a proper magic for a POSIX ustar header so look for the improper magic of GNU's tar
+     */
+    else if (strcmp(header->star_94.magic, GNU_89_MAGIC_CONST) == 0)
+    {
+	/* we have an old GNU not really posix compliant archive type */
+	type = TAR_GNU_89;
+    }
+    /* -----
+     * If there is anything else there we don't know what to do with it
+     */
+    else if (header->posix.magic[0] != 0)
+    {
+	/* -----
+	 * Log an anomaly showing what we found in the magic field
+	 */
+	char temp_str	[9];
+	memset(temp_str,0,sizeof(temp_str));
+	strncpy(temp_str,header->posix.magic,8);
+	type = TAR_UNDEFINED;
+    }
+    /* -----
+     * not knowing what we have lets see if it is a block of all zeroes
+     * knowing we can ignore it
+     */
+    else
+    {
+	/* -----
+	 * If this were a legitimate V7 (well just old style)
+	 * tar header the first character would be non-NUL
+	 * and the link would be on eof the old types
+	 */
+	if ((header->raw[0]>= ' ')&&(header->raw[0] <= '~'))
+	{
+	    switch (header->tar.link)
+	    {
+	    case LINK_OLDNORMAL_FILE:
+	    case LINK_NORMAL_FILE:
+	    case LINK_HARD_LINK:
+	    case LINK_SYMBOLIC_LINK:
+	    case LINK_CHARACTER_SPECIAL:
+	    case LINK_BLOCK_SPECIAL:
+	    case LINK_DIRECTORY:
+	    case LINK_FIFO:
+	    case LINK_CONTIGUOUS_FILE:
+		/* GNU TAR will do this to us */
+	    case LINK_NEXT_LONG_LINK:
+	    case LINK_NEXT_LONG_NAME:
+	    case LINK_GNU1989_LONG_NAMES:
+		type = TAR_V7;
+		break;
+	    default:
+		break;
+	    }
+	}
+	else
+	{
+	    /* -----
+	     * look for anything not zero
+	     */
+	    unsigned int ix;
+
+	    for (ix = 0; ix < sizeof(tar_header); ++ix)
+	    {
+		if (header->raw[ix])
+		{
+		    /* -----
+		     * non-zero so quit looking
+		     */
+		    break;
+		}
+	    }
+	    /* -----
+	     * if we got to the end we know they are all zero so say so
+	     */
+	    if (ix == sizeof(tar_header))
+	    {
+		type = TAR_ZERO_BLOCK;
+	    }
+	}
+    }
+    return type;
+}
+
+
+/* ======================================================================
+ */
+
+static rc_t	sparse_data_make (sparse_data ** new_item, uint64_t offset, uint64_t size)
+{
+    sparse_data * p;
+
+    p = malloc (sizeof (sparse_data));
+    if (p != NULL)
+    {
+	p->offset = offset;
+	p->size = size;
+	p->next = NULL;
+	*new_item = p;
+	return 0;
+    }
+    else
+	return -1;
+}
+
+static rc_t	sparse_data_push(sparse_data ** q, uint64_t offset, uint64_t size)
+{
+    if (q == NULL)
+    {
+	return -1;
+    }
+    else if (*q == NULL)
+    {
+	return sparse_data_make (q, offset, size);
+    }
+    else 
+    {
+	return sparse_data_push (&((*q)->next), offset, size);
+    }
+}
+
+static rc_t	sparse_data_pop (sparse_data ** q, sparse_data **item)
+{
+    if ((q == NULL) || (item == NULL))
+    {
+	return -1;
+    }
+    else
+    {
+	*item = *q;
+	*q = (*item)->next;
+	(*item)->next = NULL;
+	return 0;
+    }
+}
+
+static rc_t	sparse_data_kill (sparse_data ** q)
+{
+    if (q == NULL)
+    {
+	return -1;
+    }
+    if (*q == NULL)
+    {
+	return 0;
+    }
+    if ((*q)->next != NULL)
+    {
+	return sparse_data_kill(&(*q)->next);
+    }
+    free (*q);
+    *q = NULL;
+    return 0;
+}
+
+/* ======================================================================
+ * local module-wide variables (reduction in parameter pushing)
+ *
+ * Module shared variables; kinda like C++ class elements
+ */
+
+static rc_t make_chunk_list(CCTar * self, uint64_t file_offset)
+{
+    uint64_t		count = self->num_chunks;
+    uint64_t		source_position = file_offset;
+    uint64_t		ix;
+    sparse_data * 	psd;
+    rc_t		rc;
+
+    if (self->chunks)
+	free (self->chunks); /* shouldn't happen */
+    self->chunks = malloc( (size_t)( count * sizeof(KTocChunk) ) );
+    if (self->chunks == NULL)
+	return -1;
+
+
+    for (ix = 0; ix < count; ++ix)
+    {
+	rc = sparse_data_pop (&self->sparse_q, &psd);
+	if (rc != 0)
+	    return rc;
+	self->chunks[ix].logical_position = psd->offset;
+	self->chunks[ix].source_position = source_position;
+	self->chunks[ix].size = psd->size;
+	source_position += psd->size;
+	sparse_data_kill(&psd);
+    }
+    return 0;
+}
+
+static void whack_chunk_list(CCTar * self)
+{
+    free (self->chunks);
+    self->chunks = NULL;
+    self->num_chunks = 0;
+}
+
+#if HANDLING_EXTENDED_HEADERS
+/* ======================================================================
+ * mini class for handling pax/posix/ustar 
+ * extended headers and global extended headers
+ *
+ * Many of the values are included to get past range limits imposed by the ustar format
+ * particular for string length and charcter set or shortish integral values.  <ekyword>
+ * and <value> below are UTF-8.
+ *
+ * values in the header are string values written as with a 'printf' using the form
+ *	printf("%d %s=%s\n",<length>,<keyword>,<value>)
+ *
+ * <length> is described ambiguously as 
+ *	"The <length> field shall be the decimal length of the extended header record in octets,
+ *	 including the trailing <newline>."
+ * So does that include the length of <length>? or not?
+ *
+ * The field <keyword> is allowed in a pax Extended Header include but are not limited to
+ *	atime		time_t but with fractional seconds maybe
+ *	charset		enumeration list
+ *	comment		human readable comments
+ *	gid		integer gid allowing numbers greater than ustar limit of 2097151 (07777777)
+ *	gname		over rides xhdr gid and ustar gname and gid
+ *	linkpath
+ *	mtime		time_t but with franctional seconds maybe
+ *	path
+ *	realtime.<ANY>
+ *	security.<ANY>
+ *	size
+ *	uid		integer uid allowing numbers greater than ustar limit of 2097151 (07777777)
+ *	uname
+ * Any other keywords desired can be included but might not be meaningful to many applications.
+ * Keyword can have pretty much any character in it except '='.
+ *
+ * <value> is a UTF-8 string that ends with the '\n'.
+ * 
+ *
+ * charset is limited to (omit the quotation marks)
+ *      <value>			  Formal Standard
+ * "ISO-IR 646 1990"		ISO/IEC 646:1990
+ * "ISO-IR 8859 1 1998"		ISO/IEC 8859-1:1998
+ * "ISO-IR 8859 2 1999"		ISO/IEC 8859-2:1999
+ * "ISO-IR 8859 3 1999"		ISO/IEC 8859-3:1999
+ * "ISO-IR 8859 4 1998"		ISO/IEC 8859-4:1998
+ * "ISO-IR 8859 5 1999"		ISO/IEC 8859-5:1999
+ * "ISO-IR 8859 6 1999"		ISO/IEC 8859-6:1999
+ * "ISO-IR 8859 7 1987"		ISO/IEC 8859-7:1987
+ * "ISO-IR 8859 8 1999"		ISO/IEC 8859-8:1999
+ * "ISO-IR 8859 9 1999"		ISO/IEC 8859-9:1999
+ * "ISO-IR 8859 10 1998"	ISO/IEC 8859-10:1998
+ * "ISO-IR 8859 13 1998"	ISO/IEC 8859-13:1998
+ * "ISO-IR 8859 14 1998"	ISO/IEC 8859-14:1998
+ * "ISO-IR 8859 15 1999"	ISO/IEC 8859-15:1999
+ * "ISO-IR 10646 2000"		ISO/IEC 10646:2000
+ * "ISO-IR 10646 2000 UTF-8"	ISO/IEC 10646, UTF-8 encoding
+ * "BINARY"			None.
+ */
+typedef enum pax_charset
+{
+    PAX_CS_NOT_SPECIFIED,
+    PAX_CS_ISO_IR_646_1990,
+    PAX_CS_ISO_IR_8859_1_1998,
+    PAX_CS_ISO_IR_8859_2_1999,
+    PAX_CS_ISO_IR_8859_3_1999,
+    PAX_CS_ISO_IR_8859_4_1998,
+    PAX_CS_ISO_IR_8859_5_1999,
+    PAX_CS_ISO_IR_8859_6_1999,
+    PAX_CS_PAX_CS_ISO_IR_8859_7_1997,
+    PAX_CS_ISO_IR_8859_8_1999,
+    PAX_CS_ISO_IR_8859_9_1999,
+    PAX_CS_ISO_IR_8859_10_1998,
+    PAX_CS_ISO_IR_8859_13_1998,
+    PAX_CS_ISO_IR_8859_14_1998,
+    PAX_CS_ISO_IR_8859_15_1998,
+    PAX_CS_ISO_IR_1064_2000,
+    PAX_CS_ISO_IR_1064_2000_UTF_8,
+    PAX_CS_BINARY
+} pax_charset;
+
+static const char * pax_charset_strings[] = 
+{
+    "Not Specified",
+    "ISO-IR 646 1990",
+    "ISO-IR 8859 1 1998",
+    "ISO-IR 8859 2 1999",
+    "ISO-IR 8859 3 1999",
+    "ISO-IR 8859 4 1998",
+    "ISO-IR 8859 5 1999",
+    "ISO-IR 8859 6 1999",
+    "ISO-IR 8859 7 1987",
+    "ISO-IR 8859 8 1999",
+    "ISO-IR 8859 9 1999",
+    "ISO-IR 8859 10 1998",
+    "ISO-IR 8859 13 1998",
+    "ISO-IR 8859 14 1998",
+    "ISO-IR 8859 15 1999",
+    "ISO-IR 10646 2000",
+    "ISO-IR 10646 2000 UTF-8",
+    "BINARY",
+    NULL
+};
+
+static pax_charset pax_xhdr_parse_charset_string(char*string)
+{
+    int ix;		/* index */
+    const char * ps;	/* pointer to string */
+
+    for (ps = pax_charset_strings[ix= 0]; ps; ps = pax_charset_strings[++ix])
+	if (strcmp(ps,string) == 0)
+	    return ix;
+    return PAX_CS_NOT_SPECIFIED;	/* matched none so set it to not specified */
+}
+
+typedef struct pax_xheader pax_xheader;
+struct pax_xheader
+{
+    char *	path;		/* supercedes .posix.name */
+    char *	linkpath;	/* supercedes .posix.linkname */
+    char *	uname;		/* user name supercedes .posix.uname uid and .posix.uid */
+    char *	gname;		/* group name supercedes .posix.gname gid and .posix.gid */
+    time_t	atime;		/* supercedes .posix.atime */
+    time_t	mtime;		/* supercedes .posix.mtime */
+    uid_t	uid;		/* supercedes .posix.uid */
+    gid_t	gid;		/* supercedes .posix.gname */
+    off_t	size;		/* supercedes .posix.size */
+    pax_charset	charset;	/* not supported by us? */
+};
+
+static pax_xheader *	pax_xhdr_create (void)
+{
+    pax_xheader * pxv = malloc (sizeof(pax_xheader));
+    memset (pxv,0,sizeof(pax_xheader));
+    return pxv;
+}
+
+static void	pax_xhdr_delete(pax_xheader * self)
+{
+    if (self->path)
+	free (self->path);
+    if (self->linkpath)
+	free (self->linkpath);
+    if (self->uname)
+	free (self->uname);
+    if (self->gname)
+	free (self->gname);
+    free (self);
+}
+
+static rc_t  pax_xhdr_set_general_string (char ** str, const char * val)
+{
+    size_t	len;	/* how much memory */
+    char      *	nl;	/* point to any new line in source */
+    rc_t	rc = 0;	/* return code; assume success */
+
+    if (*str)		/* if already set, free the old value */
+	free (*str);
+    nl = strchr (val, '\n');
+    if (nl)
+    {
+	len = nl - val + 1; /* +1 for NUL */
+    }
+    else
+    {
+	len = strlen (val) + 1;
+    }
+    *str = malloc (len);
+    if (*str)
+    {
+	strncpy (*str, val, len-1);
+	(*str)[len-1] = '\0'; /* if it was a '\n' terminated value this is needed not worth the check if needed */
+    }
+    else
+    {
+	rc = RC(rcFS/*?*/,rcAllocating,0/*?*/,rcNoObj/*?*/,rcNull); /* well its not 0 */
+    }
+    return rc;
+}
+
+/* ----------
+ * new_path points to a string that ends with either a '\n' or a NUL
+ */
+LIB_EXPORT rc_t CC pax_xhdr_set_path(pax_xheader * self, char * new_path)
+{
+    return pax_xhdr_set_general_string(&(self->path),new_path);
+}
+
+/* ----------
+ * new_path points to a string that ends with either a '\n' or a NUL
+ */
+LIB_EXPORT rc_t CC pax_xhdr_set_linkpath(pax_xheader * self, char * new_path)
+{
+    return pax_xhdr_set_general_string(&(self->linkpath),new_path);
+}
+
+/* ----------
+ * new_name points to a string that ends with either a '\n' or a NUL
+ */
+LIB_EXPORT rc_t CC pax_xhdr_set_uname(pax_xheader * self, char * new_name)
+{
+    return pax_xhdr_set_general_string(&(self->uname),new_name);
+}
+
+/* ----------
+ * new_name points to a string that ends with either a '\n' or a NUL
+ */
+LIB_EXPORT rc_t CC pax_xhdr_set_gname(pax_xheader * self, char * new_name)
+{
+    return pax_xhdr_set_general_string(&(self->gname),new_name);
+}
+
+LIB_EXPORT bool CC pax_xhdr_get_general_string (char**src, char**dst, size_t max)
+{
+    if (strlen(*src) > max-1)	/* fail if too big for target */
+    {
+	return false;
+    }
+    strcpy(*dst,*src);
+    return true;
+}
+
+LIB_EXPORT rc_t CC pax_xhdr_get_path(pax_xheader * self, char ** path, size_t max)
+{
+    return (pax_xhdr_get_general_string(&self->path,path,max))? 0 : ~0;
+}
+
+LIB_EXPORT rc_t CC pax_xhdr_get_linkpath(pax_xheader * self, char ** path, size_t max)
+{
+    return (pax_xhdr_get_general_string(&self->linkpath,path,max))? 0 : ~0;
+}
+
+LIB_EXPORT rc_t CC pax_xhdr_get_uname(pax_xheader * self, char ** name, size_t max)
+{
+    return (pax_xhdr_get_general_string(&self->uname,name,max))? 0 : ~0;
+}
+
+LIB_EXPORT rc_t CC pax_xhdr_get_gname(pax_xheader * self, char ** name, size_t max)
+{
+    return (pax_xhdr_get_general_string(&self->gname,name,max))? 0 : ~0;
+}
+
+/* ----------
+ * The mtime and atime <value> is defined as
+ *	The pax utility shall write an mtime record for each file in write
+ *	or copy modes if the file's modification time cannot be represented
+ *	exactly in the ustar header logical record described in ustar
+ *	Interchange Format. This can occur if the time is out of ustar range,
+ *	or if the file system of the underlying implementation supports
+ *	non-integer time granularities and the time is not an integer. All of
+ *	these time records shall be formatted as a decimal representation of
+ *	the time in seconds since the Epoch. If a period ( '.' ) decimal
+ *	point character is present, the digits to the right of the point shall
+ *	represent the units of a subsecond timing granularity, where the first
+ *	digit is tenths of a second and each subsequent digit is a tenth of
+ *	the previous digit. In read or copy mode, the pax utility shall
+ *	truncate the time of a file to the greatest value that is not greater
+ *	than the input header file time. In write or copy mode, the pax
+ *	utility shall output a time exactly if it can be represented exactly
+ *	as a decimal number, and otherwise shall generate only enough digits
+ *	so that the same time shall be recovered if the file is extracted on a
+ *	system whose underlying implementation supports the same time
+ *	granularity.
+ *
+ * So...
+ * Looks like for our purposes we ignore anything after a possible decimal
+ * point and just use the integer part of whatever is there and just not be
+ * to worried about it since we aren't creating any of this, just reading ie.
+ */
+static rc_t	pax_xhdr_set_general_time (const char * ts, time_t * tt)
+{
+    uint64_t temp = strtou64(ts,NULL,10); /* tosses decimal part for us */
+
+    if (temp)
+        *tt = (time_t)temp;
+    return temp ? 0 : ~0;
+}
+
+/* ======================================================================
+ * This is the data accumulated for each entry in a tar file.
+ */
+static struct	tar_entry_data
+{
+    /* -----
+     * We are not using linux (or other O/S specific) type here because the ranges
+     * for the system creating the archive might have larger types than the system
+     * we are running on.  We'll leave it to the outside caller of this program to
+     * "make it fit".
+     */
+
+    
+    entry_type	type;
+
+    char *	path;
+    char *	link;
+
+    uint64_t	size;
+    uint64_t	offset;
+
+    mode_t	mode;
+
+    char *	uname;
+    uid_t	uid;
+
+    char *	gname;
+    gid_t	gid;
+
+    time_t	mtime;
+    time_t	atime;
+    time_t	ctime;
+
+} tar_entry_data;
+#endif
+
+/* ======================================================================
+ *
+ * offset is the byte position within the tar file
+ * hard_limit is the byte position with in the tar file that is not mapped
+ *
+ * This is the ugliest function/method in the whole module.  The extensions
+ * to the tar header are not done in a consistent manner so convolutions
+ * have to be made to support all manner of extensions.
+ */
+static rc_t		process_one_entry		(CCTar * self)
+{
+    rc_t 		rc;
+    char		full_path	[4096];
+    char		full_link	[4096];
+    /* uint64_t		data_offset; */
+    uint64_t		data_position;
+    uint64_t		data_size;
+    int64_t		virtual_data_size;
+    tar_header_type	type;
+    tar_link		link;
+    time_t		mtime;
+    /* mode_t		mode; */
+    uint64_t		current_position;
+    union
+    {
+        const uint8_t *		b;
+        const tar_header *	h;
+    } 			current_header;
+    bool		done;
+    bool		gnu_sparse;
+/*     bool		found_zero_block; */
+
+    DEBUG_ENTRY();
+
+    rc = 0;
+    /* data_offset = */ data_position = virtual_data_size = data_size = 0;
+    type = TAR_UNDEFINED;
+    link = LINK_OLDNORMAL_FILE;
+    mtime = 0;
+    /* mode = 0; */
+    current_position = self->position;
+    done = false;
+    gnu_sparse = false;
+/*     found_zero_block = false; */
+
+    /* -----
+     * clear the full name and link name entries
+     */
+    memset(full_path,0,sizeof(full_path));
+    memset(full_link,0,sizeof(full_link));
+
+    /* -----
+     * set the header at the current TAR block.
+     * That is the map starts at position buffer_start and we are at 
+     * current_position into the file so we take the map as a pointer
+     * and add to it the difference between our current position and the map's
+     * initial position (first header is at map + 0 - 0)
+     */
+    current_header.b = self->buffer;
+
+    /* -----
+     * start processing
+     */
+    do
+    {
+        /* -----
+         * what we will do depends upon the type of this block
+         */
+        type = gnu_sparse ? TAR_SPARSE : what_header_type(current_header.h);
+        if (self->found_zero_block)
+	{
+	    if (self->found_second_zero_block == true)
+	    {
+		type = TAR_ZERO_BLOCK; /* skip anyway */
+	    }
+	    else if (type == TAR_ZERO_BLOCK)
+	    {
+		self->found_second_zero_block = true;
+	    }
+	    else
+	    {
+		rc = RC (rcExe, rcArc, rcParsing, rcFormat, rcUnexpected );
+
+		LOGERR (klogErr, rc,
+			"Found Extra Header after a block of zeros");
+
+                KOutMsg ("header '%lu' position '%lu' limit '%lu'\n", 
+                         self->position + (current_header.b - self->buffer)
+                         ,self->position, self-> position_limit);
+
+		return rc;
+	    }
+        }
+        switch (type)
+        {
+        case TAR_ZERO_BLOCK:
+            self->found_zero_block = true;
+            self->position_new += 512;
+            self->cursor = self->position_new;
+            done = true;
+            return 0;
+        case TAR_SPARSE:
+        {
+            /* -----
+             * If there is an extension header we'll have different work to do
+             */
+            int64_t  ix;
+            uint64_t of;
+            uint64_t sz;
+	    
+            for (ix = 0; ix< GNU_SPARSES_IN_EXTRA_HEADER; ++ix)
+            {
+                rc_t ret;
+                of = tar_strtoll((const uint8_t*)current_header.h->sparse.sparse[ix].offset,
+                                 TAR_SIZE_LEN);
+                sz = tar_strtoll((const uint8_t*)current_header.h->sparse.sparse[ix].num_bytes,
+                                 TAR_SIZE_LEN);
+                if (sz == 0)
+                {
+                    break;
+                }
+                ret = sparse_data_push (&self->sparse_q, of, sz);
+                if (ret)
+                {
+                    sparse_data_kill(&self->sparse_q);
+                    rc = RC (rcExe, rcArc, rcParsing, rcFormat, rcUnexpected );
+                    LOGERR (klogErr, rc, "Problems parsing sparse header");
+                    return rc;
+                }
+                ++self->num_chunks;
+            }
+        }
+        break;
+
+        default:
+            PLOGERR (klogErr,
+                     (klogErr, RC (rcFS, rcArc, rcParsing, rcFormat, rcUnknown),
+                      "unsupported header type $(type) $(string)",
+                      "type=%d,string=%s",
+                      type, get_type_string(type)));
+	    done = true;
+	    break;
+
+        case TAR_GNU_89:
+        case TAR_V7:
+ 	case TAR_POSIX:
+            /* -----
+             * almost anything we do will depend upon the size of the data for this block
+             *
+             * this will be wrong if we ever support cpio...
+             */
+            data_size = (tar_strtoll((uint8_t*)current_header.h->tar.size,TAR_SIZE_LEN));
+            mtime = (tar_strtoll((uint8_t*)current_header.h->tar.mtime,TAR_TIME_LEN));
+            /* mode = (tar_strtoll((uint8_t*)current_header.h->tar.mode,TAR_MODE_LEN)); */
+        }
+        /* -----
+         * Sometimes we are done just by identifying the header type.
+         * If so we break the loop here.
+         */
+        if (done)
+        {
+            /* -----
+             * point at the next header block
+             * Add the size of the header itself plus enough block sizes of data to cover
+             * any associated data.
+             */
+            size_t header_plus_data_block_size = (1+BLOCKS_FOR_BYTES(data_size))*TAR_BLOCK_SIZE;
+            current_position += header_plus_data_block_size;
+            current_header.b += header_plus_data_block_size;
+            break;
+        }
+
+        /* -----
+         * several extensions to USTAR/TAR format headers involve
+         * prepending another header type to give a name longer 
+         * than will fit in tthe header itself.  If we had one of
+         * those use that name.  But if the full path has not been
+         * set use the path from this header.
+         */
+        if (full_path[0] == 0) /* if full_path wasn't filled in by an 'L' long name */
+        {
+            /* -----
+             * if there is a prefix (POSIX style) use it
+             * copy the prefix and then concatenate the name field
+             */
+            if (current_header.h->posix.prefix[0])
+            {
+                /* -----
+                 * copy in the prefix, force a NUL just in case. then add a directory divider 
+                 */
+                strncpy(full_path,current_header.h->posix.prefix,TAR_PREFIX_LEN);
+                full_path[TAR_PREFIX_LEN] = 0x00;
+                strcat(full_path,"/");
+            }
+            strncat(full_path,current_header.h->tar.name,TAR_NAME_LEN);
+        }
+        link = current_header.h->tar.link;
+        switch (link)
+        {
+        case LINK_SPARSE:
+            /* -----
+             * If there is an extension header we'll have different work to do
+             */
+            if (current_header.h->gnu_89.isextended)
+            {
+                /* -----
+                 * If we have an extended header the following makes sure there is room
+                 */
+                if (current_position + (2 * sizeof(tar_header)) > self->position_limit)
+                {
+                    rc = RC (rcExe, rcArc, rcParsing, rcBuffer, rcTooShort);
+                    LOGERR (klogErr, rc, "Tar parsing buffer is too small to parse this file");
+                    return rc;
+                }
+                done = false;
+                gnu_sparse = true;	/* next block will be part of the header and not data */
+                data_position = current_position + 2 * sizeof(tar_header);
+            }
+            else
+            {
+                done = true;
+                gnu_sparse = false;
+                data_position = current_position + sizeof(tar_header);
+            }
+
+            done = (bool)! current_header.h->gnu_89.isextended;
+            {
+                int32_t ix;
+                rc_t	ret;
+
+                virtual_data_size = (tar_strtoll((uint8_t*)current_header.h->gnu_89.realsize,TAR_SIZE_LEN));
+
+                for (ix = 0; ix< GNU_SPARSES_IN_OLD_HEADER; ++ix)
+                {
+                    uint64_t sposition = tar_strtoll((const uint8_t*)current_header.h->gnu_89.sparse[ix].offset,
+                                                     TAR_SIZE_LEN);
+                    uint64_t ssize = tar_strtoll((const uint8_t*)current_header.h->gnu_89.sparse[ix].num_bytes,
+                                                 TAR_SIZE_LEN);
+                    if (ssize == 0)
+                    {
+                        break;
+                    }
+
+                    ret = sparse_data_push (&self->sparse_q, sposition, ssize);
+                    if (ret) 
+                    {
+                        sparse_data_kill(&self->sparse_q);
+                        LOGERR (klogErr, rc, "Error parsing in header sparse data");
+                        return rc;
+                    }
+                    ++self->num_chunks;
+                }
+            }
+            data_position = current_position + sizeof(tar_header);
+            break;
+
+        case LINK_OLDNORMAL_FILE:		/* deprecated normal file */
+            /* -----
+             * this should only happen with LINK_OLDNORMAL_FILE
+             *
+             * If the type is file but the last character in the path is "/"
+             * treat it as a directory instead
+             */
+            if (full_path[strlen(full_path)-2] == '\\')
+            {
+                link = LINK_DIRECTORY;
+            }
+            /* fall through */
+        case LINK_NORMAL_FILE:
+        case LINK_CONTIGUOUS_FILE:
+        case LINK_DIRECTORY:
+            data_position = current_position + sizeof(tar_header);
+            done = true;
+            break;
+
+        case LINK_HARD_LINK:
+        case LINK_SYMBOLIC_LINK:
+            if (full_link[0] == 0)
+            {
+                strncpy(full_link,current_header.h->tar.linkname,TAR_NAME_LEN);
+            }
+            done = true;
+            break;
+
+            /* ----------
+             * These types we ignore
+             */
+        case LINK_CHARACTER_SPECIAL:
+        case LINK_BLOCK_SPECIAL:
+        case LINK_FIFO:
+        case LINK_INODE_METADATA:
+            /* -----
+             * Nothing to be done
+             */
+            PLOGMSG (klogInfo,
+                     (klogInfo,
+                      "ignored link type ($(type)) $(typestring) at $(position)",
+                      "type=$%X,typestring=%s,position=%lld",
+                      (unsigned)(current_header.h->tar.link),
+                      get_link_string(current_header.h->tar.link),
+                      (uint64_t)(current_position)+(uint64_t)(OFFSET_OF(tar_v7_header,link)))); 
+            data_size = 0;
+            done = true;
+            break;
+
+	case LINK_PAX_GLOBAL_XHDR:
+	case LINK_GNU_DUMPDIR: /* we are just gonna ignore this and not treat it like LINK_DIRECTORY */
+	case LINK_SOLARIS_ACL_FILE:
+	case LINK_VOLUME_NAME:
+	case LINK_MULTI_VOLUME:
+            done = true;
+            break;
+
+	case LINK_SOLARIS_ACL:
+	case LINK_PAX_XHDR:	/* posix extended */
+	    break;
+
+        case LINK_NEXT_LONG_LINK:	/* long link name */
+            /* -----
+             * Long link name needs access now to its full set of data blocks, request a window shift 
+             * if it is not currently accessible
+             */
+            if (current_position + sizeof(tar_header) + data_size >  self->position_limit)
+            {
+                rc = RC (rcExe, rcArc, rcParsing, rcBuffer, rcTooShort);
+                LOGERR (klogErr, rc, "Tar parsing buffer is too small to parse this file");
+                return rc;
+            }
+
+            strncpy(full_link, (char*)(current_header.b + sizeof(tar_header)), data_size);
+            /* 	    (void)PLOGMSG ((klogDebug1,"Full linkpath is ($path)","path=%s",full_link)); */
+            break;
+        case LINK_NEXT_LONG_NAME:	/* long path name */
+            /* -----
+             * Long path name needs access now to its full set of data blocks, request a window shift 
+             * if it is not currently accessible
+             */
+            if (current_position + sizeof(tar_header) + data_size > self->position_limit)
+            {
+                rc = RC (rcExe, rcArc, rcParsing, rcBuffer, rcTooShort);
+                LOGERR (klogErr, rc, "Tar parsing buffer is too small to parse this file");
+                return rc;
+            }
+
+            strncpy(full_path, (char*)(current_header.b + sizeof(tar_header)), data_size);
+            break;
+        }
+	
+        /* -----
+         * move the current header position to past the data blocks
+         */
+        if (link == LINK_SPARSE)
+        {
+            current_position += sizeof (tar_header);
+            current_header.b += sizeof(tar_header);
+
+        }
+        else
+        {
+            current_position += sizeof (tar_header)+ ((data_size+TAR_BLOCK_SIZE-1)/TAR_BLOCK_SIZE)*TAR_BLOCK_SIZE;
+            current_header.b += sizeof(tar_header) + ((data_size+TAR_BLOCK_SIZE-1)/TAR_BLOCK_SIZE)*TAR_BLOCK_SIZE;
+        }
+        /* -----
+         * if that is past the currently available
+         * quit the parse of this entry asn ask for a window shift, yeah, we'll redo work
+         * but its far simpler code to just start over than track being in the middle
+         */
+        if ((!done) && (current_position >= self->position_limit))
+        {
+            rc = RC (rcExe, rcArc, rcParsing, rcBuffer, rcTooShort);
+            LOGERR (klogErr, rc, "Tar parsing buffer is too small to parse this file");
+            return rc;
+        }
+    } while (! done);
+
+    /* -----
+     * generate output for this entry
+     */
+    switch (type)
+    {
+    default:
+    case TAR_UNDEFINED:
+        rc = RC (rcFS, rcArc, rcParsing, rcData, rcUnsupported);
+        PLOGERR (klogErr,
+                 (klogErr, rc, "Unhandled Header Block $(typeint)",
+                  "typeint=%u",type));
+        return rc;
+    case TAR_ZERO_BLOCK:
+        /* ignored */
+        break;
+
+    case TAR_CPIO:
+    case TAR_V7:
+    case TAR_POSIX:
+        /* case TAR_PAX: */
+    case TAR_SUN:
+    case TAR_STAR_85:
+    case TAR_STAR_94:
+    case TAR_GNU_89:
+        /*case TAR_GNU_01: */
+    case TAR_SPARSE:
+        /* -----
+         * TODO:
+         *	implement a header checksum routine call it here, and return -1 if the check sum fails
+         */
+        if (gnu_sparse)
+        {
+            link = LINK_SPARSE;	/* faking it for the next section */
+        }
+    
+        switch (link)
+        {
+        case LINK_OLDNORMAL_FILE:
+        case LINK_NORMAL_FILE:
+        case LINK_CONTIGUOUS_FILE:
+	{
+	    uint64_t start;
+	    CCArcFileNode * node;
+
+	    start = data_size ? data_position : 0;
+            /* 	    LOGMSG (klogDebug3, "KArcTOCCreateFile"); */
+            DEBUG_MSG (3, ("about to CreateFile '':$(linkint)\n",
+                      PLOG_2(PLOG_C(link),PLOG_X8(linkint)),
+                      link,link));
+            /* now create a new contained file node */
+            rc = CCArcFileNodeMake ( & node, start, data_size );
+            if ( rc != 0 )
+                LOGERR ( klogInt, rc, "failed to create contained file node" );
+            else
+            {
+		const KFile * sfile;
+		rc = KFileMakeSubRead (&sfile, self->file, start, data_size);
+		if (rc != 0)
+		    LOGERR ( klogInt, rc, "failed to create sub file reader" );
+		else
+		{
+                    void * save;
+                    rc_t orc;
+
+                    copycat_log_set (&node->dad.logs, &save);
+
+		    rc = ccat_md5 ( self->tree, sfile, mtime,
+                                    ccArcFile, &node->dad, full_path);
+
+                    copycat_log_set (save, NULL);
+
+		    orc = KFileRelease (sfile);
+                    if (orc)
+                    {
+                        PLOGERR (klogInt,
+                                 (klogInt, orc,
+                                  "Failure handling a file '$(F) inside of a tar file",
+                                  "F=%s", full_path));
+                        if (rc == 0)
+                            rc = orc;
+                    }
+
+                    self->cursor += node->dad.size;
+
+		}
+		/* if successful, "node" ( allocated locally above )
+		   will have been entered into "cont->sub" */
+	    }
+	    break;
+	}
+	case LINK_HARD_LINK:
+	{
+            DEBUG_MSG (3, ("KArcTOCCreateHardLink"));
+/* 	    rc_t CCTreeSymlink ( CCTree *self, const char *targ, const char *alias ); */
+ 	    rc = CCTreeLink (self->tree, mtime, full_link, full_path);
+	    break;
+	}
+	case LINK_SYMBOLIC_LINK:
+	{
+	    CCSymlinkNode * node;
+
+            DEBUG_MSG (3, ("KArcTOCCreateSoftLink"));
+
+            rc = CCSymlinkNodeMake (&node, full_link);
+            if ( rc != 0 )
+                LOGERR ( klogInt, rc, "failed to create sym link node" );
+	    if ( rc == 0 )
+	    {
+		rc = CCTreeInsert (self->tree, mtime, ccSymlink, node, full_path );
+		if ( rc != 0 )
+		    PLOGERR ( klogInt,  (klogInt, rc, "failed to enter node '$(name)'", "name=%s", full_path ));
+	    }
+	    break;
+	}
+/*
+static
+rc_t KSubChunkFileMake (KSubChunkFile ** pself,
+			const KFile * original,
+			uint64_t size,
+			uint32_t num_chunks)
+*/
+	case LINK_SPARSE:
+	{
+	    CChunkFileNode * node;
+
+            DEBUG_MSG (3, ("LINK_SPARSE KArcTOCCreateChunkedFile"));
+	    rc = CChunkFileNodeMake (&node, virtual_data_size);
+	    if (rc != 0)
+                LOGERR ( klogInt, rc, "failed to create contained chunked file node" );
+            else
+            {
+		const KFile * sfile;
+                void * save;
+
+                copycat_log_set (&node->dad.logs, &save);
+
+		make_chunk_list(self, data_position);
+		whack_chunk_list (self);
+		rc = KFileMakeChunkRead (&sfile, self->file, virtual_data_size, self->num_chunks, self->chunks);
+		if (rc != 0)
+		    LOGERR ( klogInt, rc, "failed to create sub chunk file reader" );
+		else
+		{
+		    rc = ccat_md5 ( self->tree, sfile, mtime,
+                                    ccChunkFile, &node->dad, full_path);
+		    KFileRelease (sfile);
+		}
+		/* if successful, "node" ( allocated locally above )
+		   will have been entered into "cont->sub" */
+
+                copycat_log_set (save, NULL);
+	    }
+	    break;
+	}
+	case LINK_CHARACTER_SPECIAL:
+	case LINK_BLOCK_SPECIAL:
+	case LINK_FIFO:
+	case LINK_VOLUME_NAME:
+	case LINK_SOLARIS_ACL:
+	case LINK_GNU_DUMPDIR:
+	case LINK_SUN_XHDR:
+	case LINK_INODE_METADATA:
+            DEBUG_MSG (1, ("Ignored Entry Type %: named %s",
+		      get_link_string(link),
+		      full_path));
+	    break;
+	case LINK_DIRECTORY:
+	{
+	    CCTree * node;
+            DEBUG_MSG (3, ("KArcTOCCreateDir"));
+
+	    rc = CCTreeMake (&node);
+	    if (rc != 0)
+		LOGERR (klogInt, rc, "failed to make directory node");
+	    else
+	    {
+		rc = CCTreeInsert (self->tree, mtime, ccDirectory, node, full_path);
+		if ( rc != 0 )
+		    PLOGERR ( klogInt,  (klogInt, rc, "failed to enter node '$(name)'", "name=%s", full_path ));
+	    }
+	    break;
+	}
+
+	default:
+	    PLOGMSG (klogInfo,
+		      (klogInfo,
+                       " type ($(type)) name ($(name() link ($(link)) size ($(size)) position ($(position))",
+                       "type=%s,name=%s,link=%s,size=%lld,position=%lld",
+                       get_type_string(type),
+                       full_path,
+                       full_link,
+                       data_size,
+                       data_position));
+	    break;
+	}
+	break;
+    }	
+    self->position_new = current_position;
+    return 0;
+}
+
+static
+rc_t CCTarFillBuffer (CCTar * self)
+{
+    rc_t rc;
+    size_t to_read;
+    size_t to_copy;
+    size_t read;
+    size_t copy_offset;
+
+    assert (self);
+    assert (self->position <= self->position_new);
+
+    /* bring in what we still need from what we already have */
+
+    /* if we are restarting beyond what is in the buffer */
+    if (self->position_new >= self->position_limit)
+    {
+        self->position_limit = self->position_new;
+        to_read = sizeof (self->buffer);
+        to_copy = 0;
+    }
+    /* else we are going to copy some then read some */
+    else
+    {
+        to_copy = self->position_limit - self->position_new;
+        to_read = sizeof (self->buffer) - to_copy;
+        copy_offset = self->position_new - self->position;
+        memmove (self->buffer, self->buffer + copy_offset, to_copy);
+    }
+
+
+    self->position = self->position_new;
+    self->buffer_length = to_copy;
+/*     memset (self->buffer + to_copy, 0, to_read); */
+    rc = KFileReadAll (self->file, self->position_limit, self->buffer + to_copy, to_read, &read);
+    if ((rc == 0) && (read != 0))
+    {
+        self->buffer_length += read;
+        self->position_limit += read;
+    }
+
+    return rc;
+}
+
+
+rc_t ccat_tar ( CCContainerNode *np, const KFile *sf, const char *name )
+{
+    rc_t rc;
+    CCTar * tar;
+    CCFileNode * fnode = np->entry; /* we want the base class FileNode only */
+
+    rc = CCTarMake (&tar, &np->sub, sf, name, fnode);
+    if (rc == 0)
+    {
+        do
+        {
+            rc = CCTarFillBuffer (tar);
+            if (rc != 0) /* this would be a hard 'system' error */
+                break;
+
+            if (tar->position == tar->position_limit) /* EOF */
+                break;
+
+            rc = process_one_entry (tar);
+            if (rc != 0)
+                break;
+
+        } while (!tar->found_second_zero_block);
+
+        /* tar file needs two 512 zero blocks at end
+         * it's a format error if not found */
+        if ( ! tar->found_second_zero_block )
+        {
+            rc_t lrc = RC (rcExe, rcArc, rcAccessing, rcFormat, rcTooShort);
+            fnode->err = true;
+            /* we won't fail copycat over this format error */
+            PLOGERR (klogErr,
+                     (klogErr, lrc,
+                      "tar file '$(F)' missing terminating zero blocks",
+                      "F=%s", name));
+        }
+
+        CCTarWhack (tar);
+    }
+    return rc;
+}
+
diff --git a/tools/copycat/cctree-dump.c b/tools/copycat/cctree-dump.c
new file mode 100644
index 0000000..6545ae2
--- /dev/null
+++ b/tools/copycat/cctree-dump.c
@@ -0,0 +1,1030 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "cctree-priv.h"
+#include "copycat-priv.h"
+#include <klib/printf.h>
+#include <klib/rc.h>
+#include <kapp/main.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+#include <time.h>
+
+
+/*--------------------------------------------------------------------------
+ * fowards
+ */
+static bool CCNameDump ( BSTNode *n, void *data );
+
+
+/*--------------------------------------------------------------------------
+ * CCDumper
+ */
+typedef struct CCDumper CCDumper;
+struct CCDumper
+{
+    rc_t ( * flush ) ( void*, const void*, size_t );
+    void *out;
+
+    const char *sep;
+
+#if ! STORE_ID_IN_NODE
+    uint32_t id;
+#endif
+    uint32_t indent;
+    rc_t rc;
+
+    size_t total;
+    char buffer [ 4096 ];
+};
+
+
+/* Init
+ *  sets up block
+ */
+static
+void CCDumperInit ( CCDumper *self,
+    rc_t ( * flush ) ( void *out, const void *buffer, size_t size ), void *out )
+{
+    self -> flush = flush;
+    self -> out = out;
+    self -> sep = "";
+#if ! STORE_ID_IN_NODE
+    self -> id = 0;
+#endif
+    self -> indent = 0;
+    self -> rc = 0;
+    self -> total = 0;
+}
+
+
+/* Flush
+ */
+static
+rc_t CCDumperFlush ( CCDumper *self )
+{
+    rc_t rc = ( * self -> flush ) ( self -> out, self -> buffer, self -> total );
+    if ( rc == 0 )
+        self -> total = 0;
+    return rc;
+}
+
+static
+rc_t CCDumperFlushLine ( CCDumper *self )
+{
+#if ! _DEBUGGING
+    if ( self -> total < sizeof self -> buffer / 2 )
+        return 0;
+#endif
+    return CCDumperFlush ( self );
+}
+
+
+/* Whack
+ *  flushes buffer if necessary
+ */
+static
+rc_t CCDumperWhack ( CCDumper *self )
+{
+    if ( self -> rc == 0 && self -> total != 0 )
+        return CCDumperFlush ( self );
+    return 0;
+}
+
+
+/* Write
+ *  writes data to buffer, flushes as necessary
+ */
+static
+rc_t CCDumperWrite ( CCDumper *self, const char *buffer, size_t size )
+{
+    rc_t rc;
+    size_t total, num_writ;
+
+    for ( rc = 0, total = 0; total < size; total += num_writ )
+    {
+        if ( self -> total == sizeof self -> buffer )
+        {
+            rc = CCDumperFlush ( self );
+            if ( rc != 0 )
+                break;
+        }
+
+        num_writ = size - total;
+        if ( num_writ > sizeof self -> buffer - self -> total )
+            num_writ = sizeof self -> buffer - self -> total;
+
+        memcpy ( & self -> buffer [ self -> total ], & buffer [ total ], num_writ );
+        self -> total += num_writ;
+    }
+
+    return rc;
+}
+
+/* IndentLevel
+ *  increase or decrease indentation level
+ */
+static
+void CCDumperIncIndentLevel ( CCDumper *self )
+{
+    ++ self -> indent;
+}
+
+static
+void CCDumperDecIndentLevel ( CCDumper *self )
+{
+    if ( self -> indent > 0 )
+        -- self -> indent;
+}
+
+
+/* Indent
+ *  writes indentation spacing
+ */
+static
+rc_t CCDumperIndent ( CCDumper *self )
+{
+    rc_t rc;
+    uint32_t total, num_writ;
+
+    /* use 2 spaces per tab */
+    const char *tabs = "                                ";
+
+    for ( rc = 0, total = 0; total < self -> indent; total += num_writ )
+    {
+        num_writ = ( ( self -> indent - total - 1 ) & 0xF ) + 1;
+        rc = CCDumperWrite ( self, tabs, num_writ + num_writ );
+        if ( rc != 0 )
+            break;
+    }
+
+    return rc;
+}
+
+/* Sep
+ *  write separator string
+ */
+static
+rc_t CCDumperSep ( CCDumper *self )
+{
+    if ( self -> sep == NULL )
+        return 0;
+
+    return CCDumperWrite ( self, self -> sep, strlen ( self -> sep ) );
+}
+
+/* Print
+ *  \t - indent
+ *  \n - end of line
+ *  %d - integer
+ *  %u - unsigned
+ *  %ld - int64_t
+ *  %lu - uint64_t
+ *  %f - double
+ *  %s - null-terminated C-string
+ *  %p - separator
+ *  %S - String*
+ *  %I - unique id
+ *  %T - timestamp
+ *  %M - MD5 digest
+ *  %C - CRC32
+ *  %N - CCName*
+ *  %F - full CCName*
+ */
+static
+rc_t StringPrint ( const String *self, CCDumper *d )
+{
+/* BUFF_WARNING_TRACK has to be larger than all size differences
+ * between a special character and its encoding in XML
+ * 8 is big enough for all I know about when writing this with some
+ * safety margin
+ */
+#define BUFF_WARNING_TRACK 8
+#define BUFF_SIZE (256)
+#define REPLACE_COPY(C,S) \
+    case C: \
+        sp++;\
+        count--;\
+        memcpy (bp,(S),sizeof(S)-1);\
+        bp += sizeof(S)-1;\
+        break
+
+    char buff [256 + 5];
+    char * bp;
+    const char * sp;
+    size_t count;
+    rc_t rc = 0;
+
+    /* start at the beginnings of the string and buffer */
+    sp = self->addr;
+    bp = buff;
+
+    count = self->size;
+
+    while (count > 0)
+    {
+        if ((bp - buff) > (BUFF_SIZE - BUFF_WARNING_TRACK))
+        {
+            rc = CCDumperWrite (d, buff, bp-buff);
+            if (rc)
+                return rc;
+            bp = buff;
+        }
+        switch (*sp)
+        {
+            /* just copy most characters */
+        default:
+            *bp++ = *sp++;
+            count --;
+            break;
+
+            REPLACE_COPY('<',"<");
+            REPLACE_COPY('>',">");
+            REPLACE_COPY('&',"&");
+            REPLACE_COPY('"',""");
+            REPLACE_COPY('\'',"'");
+
+        }
+    }
+    if (bp > buff)
+        rc = CCDumperWrite (d, buff, bp-buff);
+    return rc;
+
+}
+
+static
+rc_t CCNamePrint ( const CCName *self, CCDumper *d )
+{
+    return StringPrint ( & self -> name, d );
+}
+
+static
+rc_t CCNamePrintFull ( const CCName *self, CCDumper *d )
+{
+    if ( self -> dad != NULL )
+    {
+        rc_t rc = CCNamePrintFull ( self -> dad, d );
+        if ( rc == 0 )
+            rc = CCDumperWrite ( d, "/", 1 );
+        if ( rc != 0 )
+            return rc;
+    }
+    return CCNamePrint ( self, d );
+}
+
+static
+rc_t KTimePrint ( KTime_t self, CCDumper *d )
+{
+    int len;
+    char buffer [ 64 ];
+    time_t t = ( time_t ) self;
+
+    struct tm gmt;
+    gmtime_r ( & t, & gmt );
+    len = sprintf ( buffer, "%04d-%02d-%02dT%02d:%02d:%02dZ"
+                    , gmt . tm_year + 1900
+                    , gmt . tm_mon + 1
+                    , gmt . tm_mday
+                    , gmt . tm_hour
+                    , gmt . tm_min
+                    , gmt . tm_sec
+        );
+
+    return CCDumperWrite ( d, buffer, len );
+}
+
+static
+rc_t MD5Print ( const uint8_t *digest, CCDumper *d )
+{
+    int i, len;
+    char buff [ 36 ];
+
+    for ( i = len = 0; i < 16; ++ i )
+        len += sprintf ( & buff [ len ], "%02x", digest [ i ] );
+
+    return CCDumperWrite ( d, buff, 32 );
+}
+
+static
+rc_t CCDumperVPrint ( CCDumper *self, const char *fmt, va_list args )
+{
+    rc_t rc;
+    const char *start, *end;
+
+    for ( rc = 0, start = end = fmt; * end != 0; ++ end )
+    {
+        int len;
+        size_t size;
+        char buffer [ 256 ];
+
+        switch ( * end )
+        {
+        case '\t':
+            if ( end > start )
+                rc = CCDumperWrite ( self, start, end - start );
+            if ( rc == 0 )
+                rc = CCDumperIndent ( self );
+            start = end + 1;
+            break;
+        case '\n':
+            rc = CCDumperWrite ( self, start, end - start + 1 );
+            if ( rc == 0 )
+                rc = CCDumperFlushLine ( self );
+            start = end + 1;
+            break;
+        case '%':
+            if ( end > start )
+            {
+                rc = CCDumperWrite ( self, start, end - start );
+                if ( rc != 0 )
+                    break;
+            }
+            switch ( * ( ++ end ) )
+            {
+            case 'd':
+                len = sprintf ( buffer, "%d", va_arg ( args, int ) );
+                rc = CCDumperWrite ( self, buffer, len );
+                break;
+            case 'u':
+                len = sprintf ( buffer, "%u", va_arg ( args, unsigned int ) );
+                rc = CCDumperWrite ( self, buffer, len );
+                break;
+            case 'x':
+                len = sprintf ( buffer, "%x", va_arg ( args, unsigned int ) );
+                rc = CCDumperWrite ( self, buffer, len );
+                break;
+            case 'f':
+                len = sprintf ( buffer, "%f", va_arg ( args, double ) );
+                rc = CCDumperWrite ( self, buffer, len );
+                break;
+            case 'l':
+                switch ( * ( ++ end ) )
+                {
+                case 'd':
+                    rc = string_printf ( buffer, sizeof buffer, & size, "%ld", va_arg ( args, int64_t ) );
+                    if ( rc == 0 )
+                        rc = CCDumperWrite ( self, buffer, size );
+                    break;
+                case 'u':
+                    rc = string_printf ( buffer, sizeof buffer, & size, "%lu", va_arg ( args, uint64_t ) );
+                    if ( rc == 0 )
+                        rc = CCDumperWrite ( self, buffer, size );
+                    break;
+                }
+                break;
+            case 's':
+                len = sprintf ( buffer, "%s", va_arg ( args, const char* ) );
+                rc = CCDumperWrite ( self, buffer, len );
+                break;
+            case 'p':
+                rc = CCDumperSep ( self );
+                break;
+            case 'S':
+                rc = StringPrint ( va_arg ( args, const String* ), self );
+                break;
+            case 'I':
+#if STORE_ID_IN_NODE
+                len = sprintf ( buffer, "%u", va_arg ( args, uint32_t ) );
+#else
+                len = sprintf ( buffer, "%u", ++ self -> id );
+#endif
+                rc = CCDumperWrite ( self, buffer, len );
+                break;
+            case 'T':
+                rc = KTimePrint ( va_arg ( args, KTime_t ), self );
+                break;
+            case 'M':
+                rc = MD5Print ( va_arg ( args, const uint8_t* ), self );
+                break;
+            case 'C':
+                len = sprintf ( buffer, "%08x", va_arg ( args, unsigned int ) );
+                rc = CCDumperWrite ( self, buffer, len );
+                break;
+            case 'N':
+                rc = CCNamePrint ( va_arg ( args, const CCName* ), self );
+                break;
+            case 'F':
+                rc = CCNamePrintFull ( va_arg ( args, const CCName* ), self );
+                break;
+            case '%':
+                rc = CCDumperWrite ( self, "%", 1 );
+                break;
+            }
+            start = end + 1;
+            break;
+        }
+
+        if ( rc != 0 )
+            break;
+    }
+
+    if ( rc == 0 && end > start )
+    {
+        rc = CCDumperWrite ( self, start, end - start );
+        if ( rc == 0 )
+            rc = CCDumperFlushLine ( self );
+    }
+
+    return rc;
+}
+
+static
+rc_t CCDumperPrint ( CCDumper *self, const char *fmt, ... )
+{
+    rc_t rc;
+    va_list args;
+
+    va_start ( args, fmt );
+    rc = CCDumperVPrint ( self, fmt, args );
+    va_end ( args );
+
+    return rc;
+}
+
+
+/*--------------------------------------------------------------------------
+ * CCFileNode
+ *  a node with a size and modification timestamp
+ *  has a file type determined by magic/etc.
+ *  has an md5 checksum
+ *
+ *  how would an access mode be used? access mode of a file is
+ *  whatever the filesystem says it is, and within an archive,
+ *  it's read-only based upon access mode of outer file...
+ */
+
+/* Dump
+ */
+static
+rc_t CCFileNodeDumpCmn ( const CCFileNode *self, const char *tag,
+    const CCName *name, const String *cached, CCDumper *d )
+{
+    rc_t rc = CCDumperPrint ( d,
+                              "\t<%s "             /* node class */
+                              "id=\"%I\" "         /* unique id  */
+                              "path=\"%F\" "       /* full path  */
+                              "name=\"%N\" "       /* node name  */
+                              , tag
+#if STORE_ID_IN_NODE
+                              , self -> id
+#endif
+                              , name
+                              , name );
+    if ( rc == 0 && cached != NULL )
+        rc = CCDumperPrint ( d,
+                             "cached=\"%S\" "     /* cached name */
+                             , cached );
+    if ( rc == 0 )
+        rc = CCDumperPrint ( d, 
+                             "size=\"%lu\" "
+                             , self->size );
+    if (( rc == 0 ) && ( self->size > 0 ) && ( self->lines != 0 ))
+        rc = CCDumperPrint ( d, 
+                             "lines=\"%lu\" "
+                             , self->lines );
+    if ( rc == 0 )
+        rc = CCDumperPrint ( d,
+                             "mtime=\"%T\" "      /* mod time   */
+                             , name -> mtime );
+    if ( rc == 0 )
+    {
+        if ( self -> rc )
+            rc = CCDumperPrint ( d,
+                                 "filetype=\"Errored%s\" "   /* file type  */
+                                 , self -> ftype );
+        else
+            rc = CCDumperPrint ( d,
+                                 "filetype=\"%s\" "   /* file type  */
+                                 , self -> ftype );
+    }
+    if ( rc == 0 && ! no_md5 )
+        rc = CCDumperPrint ( d,
+                             "md5=\"%M\" "         /* md5 digest */
+                             , self -> _md5 );
+
+    return rc;
+}
+
+typedef struct dump_log_data
+{
+    rc_t rc;
+    CCDumper * d;
+} dump_log_data;
+
+static
+rc_t CCNodeDumpLog ( void * n, CCDumper * d )
+{
+    String s;
+
+    StringInitCString (&s, n); /* cast after add gets past node */
+
+    return CCDumperPrint ( d, "\t<CCError>%S</CCError>\n", &s );
+}
+
+
+static
+rc_t CCFileNodeDump ( const CCFileNode *cself, const char *tag,
+    const CCName *name, const String *cached, CCDumper *d, bool close )
+{
+    rc_t rc;
+    bool trunc;
+    CCFileNode * self = (CCFileNode *)cself;
+
+    trunc = ((self->expected != SIZE_UNKNOWN) && 
+             (self->expected != self->size));
+
+    rc = CCFileNodeDumpCmn ( self, tag, name, cached, d );
+    if ( rc == 0 && self -> crc32 != 0 )
+        rc = CCDumperPrint ( d, " crc32=\"%C\"", self -> crc32 );
+    if ( rc == 0 )
+    {
+        if (self->err || trunc || (self->logs.head != NULL))
+        {
+            do
+            {
+                rc = CCDumperPrint (d, ">\n");
+                if (rc) break;
+
+                if (trunc)
+                {
+                    rc = CCDumperPrint (d, "\t<CCErrSize expected=\"%lu\">"
+                                        "Error in file size expected %lu but got %lu"
+                                        "</CCErrSize>\n", self->expected,
+                                        self->expected, self->size);
+                    if (rc) break;
+                }
+                
+                if (self->err)
+                {
+                    if (self->logs.head != NULL)
+                    {
+                        SLNode* log;
+
+                        while ((log = SLListPopHead (&self->logs)) != NULL)
+                        {
+                            CCNodeDumpLog (log+1, d);
+                            free (log);
+                        }
+                    }
+                    else
+                        rc = CCDumperPrint (d, "\t<CCErr>Not specified</CCErr>\n");
+                }
+                if (rc) break;
+
+                if (close)
+                    rc = CCDumperPrint (d, "\t</%s>\n", tag);
+            } while (0);
+        }
+        else if (close)
+            rc = CCDumperPrint (d, "/>\n");
+        else
+            rc = CCDumperPrint (d, ">\n");                
+    }
+    return rc;
+}
+
+/*--------------------------------------------------------------------------
+ * CCArcFileNode
+ *  a file with an offset into another file
+ */
+
+/* Dump
+ */
+static
+rc_t CCArcFileNodeDump ( const CCArcFileNode *cself, const char *tag,
+    const CCName *name, const String *cached, CCDumper *d, bool close )
+{
+    rc_t rc;
+    bool trunc;
+    CCArcFileNode * self = (CCArcFileNode *)cself;
+
+    trunc = ((self->dad.expected != SIZE_UNKNOWN) && 
+             (self->dad.expected != self->dad.size));
+
+    rc = CCFileNodeDumpCmn ( & self -> dad, tag, name, cached, d );
+    if ( rc == 0 )
+    {
+        if (!xml_dir)
+            rc = CCDumperPrint ( d, " offset=\"%lu\"", self->offset);
+        if (rc == 0) do
+        {
+            if (self->dad.err || trunc || (self->dad.logs.head != NULL))
+            {
+                rc = CCDumperPrint (d, ">\n");
+                if (rc) break;
+
+                if (trunc)
+                {
+                    rc = CCDumperPrint (d, "\t<CCErrSize expected=\"%lu\">"
+                                        "Error in file size expected %lu but got %lu"
+                                        "</CCErrSize>\n", self->dad.expected,
+                                        self->dad.expected, self->dad.size);
+                    if (rc) break;
+                }
+
+                if (self->dad.err)
+                {
+                    if (self->dad.logs.head != NULL)
+                    {
+                        SLNode* log;
+
+                        while ((log = SLListPopHead (&self->dad.logs)) != NULL)
+                        {
+                            CCNodeDumpLog (log+1, d);
+                            free (log);
+                        }
+                    }
+                    else
+                        rc = CCDumperPrint (d, "\t<CCErr>Not specified</CCErr>\n");
+                }
+                if (rc) break;
+
+                if (close)
+                    rc = CCDumperPrint (d, "\t</%s>\n", tag);
+            }
+            else if (close)
+                rc = CCDumperPrint (d, "/>\n");
+            else
+                rc = CCDumperPrint (d, ">\n");                
+        } while (0);
+    }
+    return rc;
+}
+
+
+/*--------------------------------------------------------------------------
+ * CChunkFileNode
+ *  a file with one or more chunks (offset/size) into another file
+ */
+
+/* Dump
+ */
+static
+bool CChunkDump ( SLNode *n, void *data )
+{
+    CCDumper *d = data;
+    const CChunk *self = ( const CChunk* ) n;
+
+    d -> rc = CCDumperPrint ( d, "\t<chunk offset=\"%lu\" size=\"%lu\"/>\n",
+                              self -> offset, self -> size );
+
+    return ( d -> rc != 0 ) ? true : false;
+}
+
+static
+rc_t CChunkFileNodeDump ( const CChunkFileNode *self, const char *tag,
+    const CCName *name, const String *cached, CCDumper *d, bool close )
+{
+    rc_t rc = CCFileNodeDumpCmn ( & self -> dad, tag, name, cached, d );
+    if ( rc == 0 )
+        rc = CCDumperPrint ( d, " size=\"%lu\">\n", self -> dad . size );
+    CCDumperIncIndentLevel ( d );
+    if ( rc == 0 )
+    {
+        if ( SLListDoUntil ( & self -> chunks, CChunkDump, d ) )
+            rc = d -> rc;
+    }
+    CCDumperDecIndentLevel ( d );
+    if ( rc == 0 && close )
+        rc = CCDumperPrint ( d, "\t</%s>\n", tag );
+
+    return rc;
+}
+
+
+/*--------------------------------------------------------------------------
+ * CCCachedFileNode
+ *  a file wrapper with cached file name
+ */
+
+/* Dump
+ */
+#if 0 /* why is this commented out... */
+static
+rc_t CCCachedFileNodeDump ( const CCCachedFileNode *self,
+    const CCName *name, CCDumper *d )
+{
+    rc_t rc;
+    const void *entry = self -> entry;
+
+    switch ( self -> type )
+    {
+    case ccFile:
+    case ccContFile:
+        rc = CCFileNodeDump ( entry, "file", name, & self -> cached, d, true );
+        break;
+    case ccArcFile:
+        rc = CCArcFileNodeDump ( entry, "file", name, & self -> cached, d, true );
+        break;
+    case ccChunkFile:
+        rc = CChunkFileNodeDump ( entry, "file", name, & self -> cached, d, true );
+        break;
+    default:
+        rc = RC ( rcExe, rcTree, rcWriting, rcNode, rcUnrecognized );
+    }
+
+    return rc;
+}
+#endif
+
+/*--------------------------------------------------------------------------
+ * CCContainerNode
+ *  a container/archive file entry
+ *  a file with sub-entries
+ */
+
+/* Dump
+ */
+static
+rc_t CCContainerNodeDump ( const CCContainerNode *self, const char *node,
+    const CCName *name, CCDumper *d )
+{
+    rc_t rc;
+    const void *entry = self -> entry;
+
+    switch ( self -> type )
+    {
+    case ccFile:
+    case ccContFile:
+        rc = CCFileNodeDump ( entry, node, name, NULL, d, false );
+        break;
+    case ccArcFile:
+        rc = CCArcFileNodeDump ( entry, node, name, NULL, d, false );
+        break;
+    case ccChunkFile:
+        rc = CChunkFileNodeDump ( entry, node, name, NULL, d, false );
+        break;
+    default:
+        rc = RC ( rcExe, rcTree, rcWriting, rcNode, rcUnrecognized );
+    }
+
+    if ( rc != 0 )
+        return rc;
+
+    CCDumperIncIndentLevel ( d );
+
+    if ( BSTreeDoUntil ( & self -> sub, false, CCNameDump, d ) )
+        rc = d -> rc;
+
+    CCDumperDecIndentLevel ( d );
+
+    if ( rc == 0 )
+        rc = CCDumperPrint ( d, "\t</%s>\n", node );
+
+    return rc;
+}
+
+
+/*--------------------------------------------------------------------------
+ * CCSymlinkNode
+ *  a directory entry with a substitution path
+ */
+
+/* Dump
+ */
+static
+rc_t CCSymlinkNodeDump ( const CCSymlinkNode *self, const CCName *name, CCDumper *d, bool replaced )
+{
+    const char * tag = replaced ? "replaced-symlink" : "symlink";
+    return CCDumperPrint ( d, "\t<%s name=\"%N\" mtime=\"%T\">%S</%s>\n",
+                           tag, name, name -> mtime, & self -> path, tag );
+}
+
+
+/*--------------------------------------------------------------------------
+ * CCTreeNode
+ *  doesn't actually exist, but is treated separately from tree
+ */
+
+/* Dump
+ */
+static
+rc_t CCTreeNodeDump ( const CCTree *self, const CCName *name, CCDumper *d, bool replaced )
+{
+    const char * tag = replaced ? "replaced-directory" : "directory";
+    rc_t rc = CCDumperPrint ( d, "\t<%s name=\"%N\" mtime=\"%T\">\n",
+                              tag, name, name -> mtime );
+
+    CCDumperIncIndentLevel ( d );
+
+    if ( rc == 0 && BSTreeDoUntil ( self, false, CCNameDump, d ) )
+        rc = d -> rc;
+
+    CCDumperDecIndentLevel ( d );
+
+    if ( rc == 0 )
+        rc = CCDumperPrint ( d, "\t</%s>\n", tag );
+
+    return rc;
+}
+
+
+/*--------------------------------------------------------------------------
+ * CCName
+ *  the main entrypoint
+ */
+
+/* Dump
+ */
+static
+bool CCNameDump ( BSTNode *n, void *data )
+{
+    CCDumper * d = data;
+    const CCName * self = (const CCName*)n;
+    void * entry = self->entry;
+    uint32_t type = self->type;
+    bool replaced = false;
+
+    if (type == ccReplaced)
+    {
+        const CCReplacedNode * node = entry;
+        type = node->type;
+        entry = node->entry;
+        replaced = true;
+    }
+
+    if (type == ccCached)
+    {
+        const CCCachedFileNode * node = entry;
+        type = node->type;
+        entry = node->entry;
+    }
+
+    if ( type == ccHardlink )
+    {
+        do
+        {
+            /* if for some reason the link is broken */
+            if ( self -> entry == NULL )
+                return false;
+            self = self -> entry;
+        }
+        while ( self -> type == ccHardlink );
+
+        entry = self -> entry;
+        type = self -> type;
+        self = ( const CCName* ) n;
+    }
+
+    switch ( type )
+    {
+    case ccFile:
+    case ccContFile:
+        d -> rc = CCFileNodeDump ( entry, replaced ? "replaced-file" : "file", self, NULL, d, true );
+        break;
+    case ccArcFile:
+        d -> rc = CCArcFileNodeDump ( entry, replaced ? "replaced-file" : "file", self, NULL, d, true );
+        break;
+    case ccChunkFile:
+        d -> rc = CChunkFileNodeDump ( entry, replaced ? "replaced-file" : "file", self, NULL, d, true );
+        break;
+    case ccContainer:
+        d -> rc = CCContainerNodeDump ( entry, replaced ? "replaced-container" : "container", self, d );
+        break;
+    case ccArchive:
+        d -> rc = CCContainerNodeDump ( entry, replaced ? "replaced-archive" : "archive", self, d );
+        break;
+    case ccSymlink:
+        d -> rc = CCSymlinkNodeDump ( entry, self, d, replaced );
+        break;
+    case ccDirectory:
+        d -> rc = CCTreeNodeDump ( entry, self, d, replaced );
+        break;
+    case ccCached:
+#if 0
+        d -> rc = CCCachedFileNodeDump ( entry, self, d );
+#else
+        d -> rc = RC ( rcExe, rcTree, rcWriting, rcNode, rcCorrupt );
+#endif
+        break;
+    default:
+        d -> rc = RC ( rcExe, rcTree, rcWriting, rcNode, rcUnrecognized );
+    }
+
+    return ( d -> rc != 0 ) ? true : false;
+}
+
+    
+
+/*--------------------------------------------------------------------------
+ * CCTree
+ *  a binary search tree with CCNodes
+ */
+
+/* Dump
+ *  dump tree using provided callback function
+ *
+ *  "write" [ IN, NULL OKAY ] and "out" [ IN, OPAQUE ] - callback function
+ *  for writing. if "write" is NULL, print to stdout.
+ */
+static
+rc_t CCTreeDumpInt2 ( const CCTree *self, CCDumper *d, SLList * logs )
+{
+    rc_t rc = 0;
+
+    /* print logs attached to this node */
+    if (logs->head != NULL)
+    {
+        SLNode * log;
+        while ((log = SLListPopHead (logs)) != NULL)
+        {
+            CCNodeDumpLog (log+1, d);
+            free (log);
+        }
+    }
+
+    CCDumperIncIndentLevel ( d );
+
+    if ( BSTreeDoUntil ( self, false, CCNameDump, d ) )
+        rc = d -> rc;
+
+    CCDumperDecIndentLevel ( d );
+    
+    return rc;
+}
+
+/* print root node and call out to print what that contains */
+static
+rc_t CCTreeDumpInt ( const CCTree *self, CCDumper *d, SLList * logs )
+{
+    ver_t v = KAppVersion ();
+    rc_t rc = CCDumperPrint ( d, "<ROOT version=\"%u.%u.%u\">\n",
+                              VersionGetMajor(v),
+                              VersionGetMinor(v),
+                              VersionGetRelease(v));
+    if ( rc == 0 )
+    {
+        rc = CCTreeDumpInt2 ( self, d, logs );
+
+        if ( rc == 0 )
+            CCDumperPrint ( d, "</ROOT>\n" );
+    }
+    return rc;
+}
+
+static
+rc_t write_FILE ( void *out, const void *buffer, size_t bytes )
+{
+    size_t num_writ;
+
+    if ( bytes == 0 )
+        return 0;
+
+    num_writ = fwrite ( buffer, 1, bytes, out );
+    if ( num_writ == bytes )
+        return 0;
+    if ( num_writ != 0 )
+        return RC ( rcExe, rcFile, rcWriting, rcTransfer, rcIncomplete );
+    if ( buffer == NULL )
+        return RC ( rcExe, rcFile, rcWriting, rcParam, rcNull );
+
+    return RC ( rcExe, rcFile, rcWriting, rcNoObj, rcUnknown );
+}
+
+rc_t CCTreeDump ( const CCTree *self,
+    rc_t ( * write ) ( void *out, const void *buffer, size_t bytes ),
+                  void *out, SLList * logs )
+{
+    rc_t rc, rc2;
+    CCDumper d;
+
+    if ( write == NULL )
+    {
+        write = write_FILE;
+        out = stdout;
+    }
+
+    CCDumperInit ( & d, write, out );
+
+    rc = CCTreeDumpInt ( self, & d, logs );
+
+    rc2 = CCDumperWhack ( & d );
+
+    return rc ? rc : rc2;
+}
diff --git a/tools/copycat/cctree-priv.h b/tools/copycat/cctree-priv.h
new file mode 100644
index 0000000..897576e
--- /dev/null
+++ b/tools/copycat/cctree-priv.h
@@ -0,0 +1,351 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_cctree_priv_
+#define _h_cctree_priv_
+
+#ifndef _h_klib_container_
+#include <klib/container.h>
+#endif
+
+#ifndef _h_klib_text_
+#include <klib/text.h>
+#endif
+
+#ifndef _h_kfs_directory_
+#include <kfs/directory.h>
+#endif
+
+#define STORE_ID_IN_NODE 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*--------------------------------------------------------------------------
+ * forwards
+ */
+typedef struct BSTree CCTree;
+typedef struct CCName CCName;
+
+
+/*--------------------------------------------------------------------------
+ * CCType
+ *  enum describing entry type
+ */
+enum CCType
+{
+    ccFile,
+    ccContFile,
+    ccArcFile,
+    ccChunkFile,
+    ccContainer,
+    ccArchive,
+    ccSymlink,
+    ccHardlink,
+    ccDirectory,
+    ccCached,
+    ccReplaced  /* a name attached to a replaced file (name twice in tar for example) */
+};
+
+
+/*--------------------------------------------------------------------------
+ * CCFileNode
+ *  a node with a size and modification timestamp
+ *  has a file type determined by magic/etc.
+ *  has an md5 checksum
+ *
+ *  how would an access mode be used? access mode of a file is
+ *  whatever the filesystem says it is, and within an archive,
+ *  it's read-only based upon access mode of outer file...
+ */
+typedef struct CCFileNode CCFileNode;
+struct CCFileNode
+{
+    uint64_t expected;  /* size expected (0 if not known) */
+/* #define SIZE_UNKNOWN    (UINT64_MAX) */
+#define SIZE_UNKNOWN    ((uint64_t)(int64_t)-1)
+    uint64_t size;      /* actual size */
+    uint64_t lines;     /* linecount if ASCII */
+    uint32_t crc32;
+#if STORE_ID_IN_NODE
+    uint32_t id;
+#endif
+    rc_t rc;
+    bool err;          /* errors found while reading/parsing */
+    char ftype [ 252 ];
+    uint8_t _md5 [ 32 ];
+    SLList logs;
+};
+
+
+/* Make
+ *  creates an object with provided properties
+ *  md5 digest needs to be filled in afterward
+ */
+rc_t CCFileNodeMake ( CCFileNode **n, uint64_t expected );
+
+/* Whack
+ */
+#define CCFileNodeWhack( self ) \
+    free ( self )
+
+
+/*--------------------------------------------------------------------------
+ * CCArcFileNode
+ *  a file with an offset into another file
+ */
+typedef struct CCArcFileNode CCArcFileNode;
+struct CCArcFileNode
+{
+    CCFileNode dad;
+    uint64_t offset;
+};
+
+/* Make
+ *  creates an object with provided properties
+ *  md5 digest needs to be filled in afterward
+ */
+rc_t CCArcFileNodeMake ( CCArcFileNode **n,
+    uint64_t offset, uint64_t size );
+
+/* Whack
+ */
+#define CCArcFileNodeWhack( self ) \
+    free ( self )
+
+
+/*--------------------------------------------------------------------------
+ * CChunkFileNode
+ *  a file with one or more chunks (offset/size) into another file
+ */
+typedef struct CChunk CChunk;
+struct CChunk
+{
+    SLNode n;
+    uint64_t offset;
+    uint64_t size;
+};
+
+typedef struct CChunkFileNode CChunkFileNode;
+struct CChunkFileNode
+{
+    CCFileNode dad;
+    SLList chunks;
+};
+
+/* Make
+ *  creates an object with provided properties
+ *  md5 digest needs to be filled in afterward
+ */
+rc_t CChunkFileNodeMake ( CChunkFileNode **n, uint64_t size );
+
+/* AddChunk
+ *  adds a chunk to the chunk file
+ */
+rc_t CChunkFileNodeAddChunk ( CChunkFileNode *self,
+    uint64_t offset, uint64_t size );
+
+/* Whack
+ */
+void CChunkFileNodeWhack ( CChunkFileNode *self );
+
+
+/*--------------------------------------------------------------------------
+ * CCCachedFileNode
+ *  a file wrapper with cached file name
+ */
+typedef struct CCCachedFileNode CCCachedFileNode;
+struct CCCachedFileNode
+{
+    /* cached name */
+    String cached;
+
+    /* container CCFileNode */
+    void *entry;
+    uint32_t type;
+};
+
+/* Make
+ *  creates a cached file wrapper
+ */
+rc_t CCCachedFileNodeMake ( CCCachedFileNode **n,
+    const char *path, enum CCType type, const void *entry );
+
+/* Whack
+ */
+void CCCachedFileNodeWhack ( CCCachedFileNode *self );
+
+
+/*--------------------------------------------------------------------------
+ * CCSymlinkNode
+ *  a directory entry with a substitution path
+ */
+typedef struct CCSymlinkNode CCSymlinkNode;
+struct CCSymlinkNode
+{
+    String path;
+};
+
+/* Make
+ *  creates a symlink object
+ */
+rc_t CCSymlinkNodeMake ( CCSymlinkNode **n, const char *path );
+
+/* Whack
+ */
+#define CCSymlinkNodeWhack( self ) \
+    free ( self )
+
+
+/*--------------------------------------------------------------------------
+ * CCTree
+ *  a binary search tree with CCNodes
+ */
+
+/* Make
+ *  make a root tree or sub-directory
+ */
+rc_t CCTreeMake ( CCTree **t );
+
+/* Insert
+ *  create an entry into a tree
+ *  parses path into required sub-directories
+ *
+ *  "mtime" [ IN ] - modification timestamp
+ *
+ *  "type" [ IN ] and "entry" [ IN ] - typed entry
+ *
+ *  "path" [ IN ] - vararg-style path of the entry, relative
+ *  to "self".
+ *
+ * NB - '..' is not allowed in this implementation.
+ */
+rc_t CCTreeInsert ( CCTree *self, KTime_t mtime,
+    enum CCType type, const void *entry, const char *path, ... );
+
+/* Find
+ *  find a named node
+ *  returns NULL if not found
+ */
+const CCName *CCTreeFind ( const CCTree *self, const char *path, ... );
+
+
+/* Link
+ *  create a symlink to existing node
+ */
+rc_t CCTreeLink ( CCTree *self, KTime_t mtime,
+    const char *targ, const char *alias );
+
+
+/* Whack
+ */
+void CCTreeWhack ( CCTree *self );
+
+/* Dump
+ *  dump tree using provided callback function
+ *
+ *  "write" [ IN, NULL OKAY ] and "out" [ IN, OPAQUE ] - callback function
+ *  for writing. if "write" is NULL, print to stdout.
+ */
+rc_t CCTreeDump ( const CCTree *self,
+                  rc_t ( * write ) ( void *out, const void *buffer, size_t bytes ),
+                  void *out, SLList * logs );
+
+
+/*--------------------------------------------------------------------------
+ * CCContainerNode
+ *  its entry is a container file, i.e. an archive or else processed
+ *  with some sort of envelope such as compression. its sub nodes
+ *  are the contents and have their own names.
+ */
+typedef struct CCContainerNode CCContainerNode;
+struct CCContainerNode
+{
+    /* contents */
+    CCTree sub;
+
+    /* container CCFileNode */
+    void *entry;
+    uint32_t type;
+};
+
+/* Make
+ *  creates an archive object
+ */
+rc_t CCContainerNodeMake ( CCContainerNode **n,
+    enum CCType type, const void *entry );
+
+/* Whack
+ */
+void CCContainerNodeWhack ( CCContainerNode *self );
+
+
+/*--------------------------------------------------------------------------
+ * CCReplacedNode
+ * its entry is any other type.  when a name shows up twice in a tar file
+ * the first version is replaced.
+ */
+typedef struct CCReplacedNode CCReplacedNode;
+struct CCReplacedNode
+{
+    /* container CCFileNode */
+    void *entry;
+    uint32_t type;
+};
+
+/* Make
+ */
+rc_t CCReplacedNodeMake ( CCReplacedNode **n,
+    enum CCType type, const void *entry );
+
+/* Whack
+ */
+void CCReplacedNodeWhack ( CCReplacedNode *self );
+
+
+
+/*--------------------------------------------------------------------------
+ * CCName
+ *  an entry name in a CCTree
+ */
+struct CCName
+{
+    BSTNode n;
+    CCName *dad;
+    KTime_t mtime;
+    void *entry;
+    String name;
+    uint32_t type;
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _h_cctree_priv_ */
diff --git a/tools/copycat/cctree.c b/tools/copycat/cctree.c
new file mode 100644
index 0000000..8dd736b
--- /dev/null
+++ b/tools/copycat/cctree.c
@@ -0,0 +1,754 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "copycat-priv.h"
+#include "cctree-priv.h"
+#include <klib/rc.h>
+#include <klib/log.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+
+/*--------------------------------------------------------------------------
+ * CCFileNode
+ *  a node with a size and modification timestamp
+ *  has a file type determined by magic/etc.
+ *  has an md5 checksum
+ *
+ *  how would an access mode be used? access mode of a file is
+ *  whatever the filesystem says it is, and within an archive,
+ *  it's read-only based upon access mode of outer file...
+ */
+
+static
+void CCFileNodeInit ( CCFileNode *self, uint64_t expected )
+{
+#if STORE_ID_IN_NODE
+    static uint32_t file_id;
+    self -> id = ++ file_id;
+#endif
+    self -> expected = expected;
+    self -> size = 0;   /* we learn this with the counter file */
+    self -> lines = 0;   /* we learn this with the counter file */
+    self -> crc32 = 0;
+    self -> rc = 0;
+    self -> err = false;
+    memset ( self -> ftype, 0, sizeof self -> ftype );
+    memset ( self -> _md5, 0, sizeof self -> _md5 );
+    SLListInit ( &self->logs );
+}
+
+/* Make
+ *  creates an object with provided properties
+ *  md5 digest needs to be filled in afterward
+ */
+rc_t CCFileNodeMake ( CCFileNode **np, uint64_t expected )
+{
+    CCFileNode *n = malloc ( sizeof * n );
+    if ( n == NULL )
+        return RC ( rcExe, rcTree, rcInserting, rcMemory, rcExhausted );
+
+    CCFileNodeInit ( n, expected );
+
+    * np = n;
+    return 0;
+}
+
+/*--------------------------------------------------------------------------
+ * CCArcFileNode
+ *  a file with an offset into another file
+ */
+
+/* Make
+ *  creates an object with provided properties
+ *  md5 digest needs to be filled in afterward
+ */
+rc_t CCArcFileNodeMake ( CCArcFileNode **np,
+    uint64_t offset, uint64_t expected )
+{
+    CCArcFileNode *n = malloc ( sizeof * n );
+    if ( n == NULL )
+        return RC ( rcExe, rcTree, rcInserting, rcMemory, rcExhausted );
+
+    CCFileNodeInit ( & n -> dad, expected );
+    n -> offset = offset;
+
+    * np = n;
+    return 0;
+}
+
+
+/*--------------------------------------------------------------------------
+ * CChunkFileNode
+ *  a file with one or more chunks (offset/size) into another file
+ */
+
+/* Whack
+ */
+static
+void CChunkWhack ( SLNode *n, void *ignore )
+{
+    free ( n );
+}
+
+void CChunkFileNodeWhack ( CChunkFileNode *self )
+{
+    if ( self != NULL )
+    {
+        SLListWhack ( & self -> chunks, CChunkWhack, NULL );
+        CCFileNodeWhack ( & self -> dad );
+    }
+}
+
+/* Make
+ *  creates an object with provided properties
+ *  md5 digest needs to be filled in afterward
+ */
+rc_t CChunkFileNodeMake ( CChunkFileNode **np, uint64_t expected )
+{
+    CChunkFileNode *n = malloc ( sizeof * n );
+    if ( n == NULL )
+        return RC ( rcExe, rcTree, rcInserting, rcMemory, rcExhausted );
+
+    CCFileNodeInit ( & n -> dad, expected );
+    SLListInit ( & n -> chunks );
+
+    * np = n;
+    return 0;
+}
+
+/* AddChunk
+ *  adds a chunk to the chunk file
+ */
+rc_t CChunkFileNodeAddChunk ( CChunkFileNode *self,
+    uint64_t offset, uint64_t size )
+{
+    CChunk *c = malloc ( sizeof * c );
+    if ( c == NULL )
+        return RC ( rcExe, rcTree, rcInserting, rcMemory, rcExhausted );
+
+    c -> offset = offset;
+    c -> size = size;
+
+    SLListPushTail ( & self -> chunks, & c -> n );
+    return 0;
+}
+
+
+/*--------------------------------------------------------------------------
+ * CCCachedFileNode
+ *  a file wrapper with cached file name
+ */
+
+/* Make
+ *  creates a cached file wrapper
+ */
+rc_t CCCachedFileNodeMake ( CCCachedFileNode **np, const char *path,
+    enum CCType type, const void *entry )
+{
+    CCCachedFileNode *n = malloc ( sizeof * n + strlen ( path ) + 1 );
+    if ( n == NULL )
+        return RC ( rcExe, rcTree, rcInserting, rcMemory, rcExhausted );
+
+    strcpy ( ( char* ) ( n + 1 ), path );
+    StringInitCString ( & n -> cached, ( char* ) ( n + 1 ) );
+    n -> entry = ( void* ) entry;
+    n -> type = type;
+
+    * np = n;
+    return 0;
+}
+
+/* Whack
+ */
+void CCCachedFileNodeWhack ( CCCachedFileNode *self )
+{
+    if ( self != NULL )
+    {
+        switch ( self -> type )
+        {
+        case ccFile:
+            CCFileNodeWhack ( self -> entry );
+            break;
+        case ccArcFile:
+            CCArcFileNodeWhack ( self -> entry );
+            break;
+        case ccChunkFile:
+            CChunkFileNodeWhack ( self -> entry );
+            break;
+        }
+        free ( self );
+    }
+}
+
+
+/*--------------------------------------------------------------------------
+ * CCSymlinkNode
+ *  a directory entry with a substitution path
+ */
+
+/* Make
+ *  creates a symlink object
+ */
+rc_t CCSymlinkNodeMake ( CCSymlinkNode **np, const char *path )
+{
+    CCSymlinkNode *n = malloc ( sizeof * n + strlen ( path ) + 1 );
+    if ( n == NULL )
+        return RC ( rcExe, rcTree, rcInserting, rcMemory, rcExhausted );
+
+    strcpy ( ( char* ) ( n + 1 ), path );
+    StringInitCString ( & n -> path, ( char* ) ( n + 1 ) );
+
+    * np = n;
+    return 0;
+}
+
+
+/*--------------------------------------------------------------------------
+ * CCName
+ *  an entry name in a CCTree
+ */
+
+
+/* Whack
+ */
+static
+void CCNameWhack ( BSTNode *n, void *ignore )
+{
+    CCName *self = ( CCName* ) n;
+    if ( self -> entry != NULL ) switch ( self -> type )
+    {
+    case ccFile:
+    case ccContFile:
+        CCFileNodeWhack ( self -> entry );
+        break;
+    case ccArcFile:
+        CCArcFileNodeWhack ( self -> entry );
+        break;
+    case ccChunkFile:
+        CChunkFileNodeWhack ( self -> entry );
+        break;
+    case ccContainer:
+        CCContainerNodeWhack ( self -> entry );
+        break;
+    case ccSymlink:
+        CCSymlinkNodeWhack ( self -> entry );
+        break;
+    case ccHardlink:
+        break;
+    case ccDirectory:
+        CCTreeWhack ( self -> entry );
+        break;
+    }
+
+    free ( self );
+}
+
+
+/* Make
+ *  make a node name
+ */
+static
+rc_t CCNameMake ( CCName **np, KTime_t mtime, CCName *dad,
+    const String *name, enum CCType type, const void *entry )
+{
+    CCName *n = malloc ( sizeof * n + name -> size + 1 );
+    if ( n == NULL )
+        return RC ( rcExe, rcTree, rcInserting, rcMemory, rcExhausted );
+
+    string_copy ( ( char* ) ( n + 1 ), name -> size + 1, name -> addr, name -> size );
+    n -> mtime = mtime;
+    n -> dad = dad;
+    n -> entry = ( void* ) entry;
+    StringInit ( & n -> name, ( char* ) ( n + 1 ), name -> size, name -> len );
+    n -> type = ( uint32_t ) type;
+
+    * np = n;
+    return 0;
+}
+
+/* Cmp
+ * Sort
+ */
+static
+int CCNameCmp ( const void *item, const BSTNode *n )
+{
+    const String *a = item;
+    const CCName *b = ( const CCName* ) n;
+    return StringCompare ( a, & b -> name );
+}
+
+static
+int CCNameSort ( const BSTNode *item, const BSTNode *n )
+{
+    const CCName *a = ( const CCName* ) item;
+    const CCName *b = ( const CCName* ) n;
+    int cmp = StringCompare ( & a -> name, & b -> name );
+    if (cmp != 0)
+        return cmp;
+#if 0
+    if (b->type == ccReplaced)
+        return 1;
+#endif
+    return 1; /* make new item always greater than existing n */
+}
+
+
+/*--------------------------------------------------------------------------
+ * CCContainerNode
+ *  an archive file entry
+ *  a file with a sub-directory
+ */
+
+
+/* Whack
+ */
+void CCContainerNodeWhack ( CCContainerNode *self )
+{
+    if ( self != NULL )
+    {
+        BSTreeWhack ( & self -> sub, CCNameWhack, NULL );
+        switch ( self -> type )
+        {
+        case ccFile:
+            CCFileNodeWhack ( self -> entry );
+            break;
+        case ccArcFile:
+            CCArcFileNodeWhack ( self -> entry );
+            break;
+        case ccChunkFile:
+            CChunkFileNodeWhack ( self -> entry );
+            break;
+        }
+        free ( self );
+    }
+}
+
+/* Make
+ *  creates an archive object
+ */
+rc_t CCContainerNodeMake ( CCContainerNode **np,
+    enum CCType type, const void *entry )
+{
+    CCContainerNode *n = malloc ( sizeof * n );
+    if ( n == NULL )
+        return RC ( rcExe, rcTree, rcInserting, rcMemory, rcExhausted );
+
+    BSTreeInit ( & n -> sub );
+    n -> entry = ( void* ) entry;
+    n -> type = ( uint32_t ) type;
+
+    * np = n;
+    return 0;
+}
+
+
+
+/*--------------------------------------------------------------------------
+ * CCReplacedNode
+ *  an archive file entry
+ *  a file with a sub-directory
+ */
+
+
+/* Whack
+ */
+void CCReplacedNodeWhack ( CCReplacedNode *self )
+{
+    if ( self != NULL )
+    {
+        switch ( self -> type )
+        {
+        case ccFile:
+            CCFileNodeWhack ( self -> entry );
+            break;
+        case ccArcFile:
+            CCArcFileNodeWhack ( self -> entry );
+            break;
+        case ccChunkFile:
+            CChunkFileNodeWhack ( self -> entry );
+            break;
+        }
+        free ( self );
+    }
+}
+
+/* Make
+ *  creates an archive object
+ */
+rc_t CCReplacedNodeMake ( CCReplacedNode **np,
+    enum CCType type, const void *entry )
+{
+    CCReplacedNode *n = malloc ( sizeof * n );
+    if ( n == NULL )
+        return RC ( rcExe, rcTree, rcInserting, rcMemory, rcExhausted );
+
+    n -> entry = ( void* ) entry;
+    n -> type = ( uint32_t ) type;
+
+    * np = n;
+    return 0;
+}
+
+
+
+/*--------------------------------------------------------------------------
+ * CCTree
+ *  a binary search tree with CCNodes
+ */
+
+
+/* Whack
+ */
+void CCTreeWhack ( CCTree *self )
+{
+    if ( self != NULL )
+    {
+        BSTreeWhack ( self, CCNameWhack, NULL );
+        free ( self );
+    }
+}
+
+
+/* Make
+ *  make a root tree or sub-directory
+ */
+rc_t CCTreeMake ( CCTree **tp )
+{
+    CCTree *t = malloc ( sizeof * t );
+    if ( t == NULL )
+        return RC ( rcExe, rcTree, rcInserting, rcMemory, rcExhausted );
+
+    BSTreeInit ( t );
+
+    * tp = t;
+    return 0;
+}
+
+
+/* Insert
+ *  create an entry into a tree
+ *  parses path into required sub-directories
+ */
+static
+void CCTreePatchSubdirPath ( BSTNode *n, void *data )
+{
+    CCName *sym = ( CCName* ) n;
+    sym -> dad = data;
+}
+
+static
+rc_t CCTreeVInsert ( CCTree *self, KTime_t mtime,
+    enum CCType type, const void *entry, const char *fmt, va_list args )
+{
+    rc_t rc;
+    size_t sz;
+    String name;
+    CCName *dad, *sym;
+
+    char path [ 4096 ];
+    int i, j, len = vsnprintf ( path, sizeof path, fmt, args );
+    if ( len < 0 || len >= sizeof path )
+        return RC ( rcExe, rcTree, rcInserting, rcPath, rcExcessive );
+
+    while ( len > 0 && path [ len - 1 ] == '/' )
+        path [ -- len ] = 0;
+
+    /* create/navigate path */
+    for ( dad = NULL, i = 0; i < len; i = j + 1 )
+    {
+        for ( j = i; j < len; ++ j )
+        {
+            if ( path [ j ] == '/' )
+            {
+                /* detect non-empty names */
+                sz = j - i;
+                if ( sz != 0 )
+                {
+                    CCTree *dir;
+
+                    /* ignore '.' */
+                    if ( sz == 1 && path [ i ] == '.' )
+                        break;
+
+                    /* '..' is not allowed */
+                    if ( sz == 2 && path [ i ] == '.' && path [ i + 1 ] == '.' )
+                        return RC ( rcExe, rcTree, rcInserting, rcPath, rcIncorrect );
+
+                    /* get name of directory */
+                    StringInit ( & name, & path [ i ], sz, string_len ( & path [ i ], sz ) );
+
+                    /* find existing */
+                    sym = ( CCName* ) BSTreeFind ( self, & name, CCNameCmp );
+
+                    /* handle a hard link */
+                    while ( sym != NULL && sym -> type == ccHardlink )
+                        sym = sym -> entry;
+
+                    /* should be a directory-ish thing */
+                    if ( sym != NULL )
+                    {
+                        switch ( sym -> type )
+                        {
+                        case ccContainer:
+                        case ccArchive:
+                            self = & ( ( CCContainerNode* ) sym -> entry ) -> sub;
+                            break;
+                        case ccDirectory:
+                            self = sym -> entry;
+                            break;
+                        default:
+                            return RC ( rcExe, rcTree, rcInserting, rcPath, rcIncorrect );
+                        }
+
+                        dad = sym;
+                        break;
+                    }
+
+                    /* create new sub-directory */
+                    rc = CCTreeMake ( & dir );
+                    if ( rc != 0 )
+                        return rc;
+
+                    /* create directory name */
+                    rc = CCNameMake ( & sym, mtime, dad, & name, ccDirectory, dir );
+                    if ( rc != 0 )
+                    {
+                        CCTreeWhack ( dir );
+                        return rc;
+                    }
+
+                    /* enter it into current directory
+                       don't need to validate it's unique */
+                    BSTreeInsert ( self, & sym -> n, CCNameSort );
+                    dad = sym;
+                    self = dir;
+                }
+                break;
+            }
+        }
+
+        if ( j == len )
+            break;
+    }
+
+    /* create entry name */
+    if ( i >= len )
+        return RC ( rcExe, rcTree, rcInserting, rcPath, rcIncorrect );
+    sz = len - i;
+    StringInit ( & name, & path [ i ], sz, string_len ( & path [ i ], sz ) );
+
+
+    /* create named entry */
+    rc = CCNameMake ( & sym, mtime, dad, & name, type, entry );
+    if ( rc == 0 )
+    {
+#if 0
+        /* enter it into tree */
+        rc = BSTreeInsertUnique ( self, & sym -> n, NULL, CCNameSort );
+        if ( rc != 0 )
+            free ( sym );
+#else
+        BSTNode * n = BSTreeFind (self, &sym->name, CCNameCmp);
+        if (n != NULL)
+        {
+            CCReplacedNode * rn;
+            CCName * nn = (CCName*)n;
+
+            switch (nn->type)
+            {
+            case ccDirectory:
+                if (sym->type == ccDirectory)
+                {
+                    /* better would be to capture directory traits then goto */
+                    nn->mtime = sym->mtime;
+
+                    /* we aren't yet handling a directory duplicate other than tar files */
+
+                    if (((CCContainerNode*)sym->entry)->sub.root != NULL)
+                        rc = RC (rcExe, rcTree, rcInserting, rcNode, rcIncorrect);
+
+                    goto skip_insert;
+                }
+            default:
+                rc = CCReplacedNodeMake (&rn, nn->type, nn->entry);
+                if (rc == 0)
+                {
+                    nn->type = ccReplaced;
+                    nn->entry = rn;
+                }
+            }
+        }
+        if (rc == 0)
+            rc = BSTreeInsert (self, &sym->n, CCNameSort);
+    skip_insert:
+        if (rc)
+            free (sym);
+#endif
+        /* if this guy has children, become dad */
+        else if ( entry != NULL ) switch ( type )
+        {
+        case ccContainer:
+        case ccArchive:
+            BSTreeForEach ( & ( ( CCContainerNode* ) entry ) -> sub, false, CCTreePatchSubdirPath, sym );
+            break;
+        case ccDirectory:
+            BSTreeForEach ( entry, false, CCTreePatchSubdirPath, sym );
+            break;
+	default: /* shushing warnings */
+	    break;
+        }
+    }
+
+    return rc;
+}
+
+rc_t CCTreeInsert ( CCTree *self, KTime_t mtime,
+    enum CCType type, const void *entry, const char *path, ... )
+{
+    rc_t rc;
+    va_list args;
+
+    va_start ( args, path );
+    rc = CCTreeVInsert ( self, mtime, type, entry, path, args );
+    va_end ( args );
+
+    return rc;
+}
+
+/* Find
+ *  find a named node
+ *  returns NULL if not found
+ */
+static
+const CCName *CCTreeVFind ( const CCTree *self, const char *fmt, va_list args )
+{
+    size_t sz;
+    String name;
+    CCName /* *dad, */ *sym;
+
+    char path [ 4096 ];
+    int i, j, len = vsnprintf ( path, sizeof path, fmt, args );
+    if ( len < 0 || len >= sizeof path )
+        return NULL;
+
+    while ( len > 0 && path [ len - 1 ] == '/' )
+        path [ -- len ] = 0;
+
+    /* create/navigate path */
+    for ( /* dad = NULL, */ i = 0; i < len; i = j + 1 )
+    {
+        for ( j = i; j < len; ++ j )
+        {
+            if ( path [ j ] == '/' )
+            {
+                /* detect non-empty names */
+                sz = j - i;
+                if ( sz != 0 )
+                {
+                    /* ignore '.' */
+                    if ( sz == 1 && path [ i ] == '.' )
+                        break;
+
+                    /* '..' is not allowed */
+                    if ( sz == 2 && path [ i ] == '.' && path [ i + 1 ] == '.' )
+                        return NULL;
+
+                    /* get name of directory */
+                    StringInit ( & name, & path [ i ], sz, string_len ( & path [ i ], sz ) );
+
+                    /* find existing */
+                    sym = ( CCName* ) BSTreeFind ( self, & name, CCNameCmp );
+
+                    /* handle hard-link */
+                    while ( sym != NULL && sym -> type == ccHardlink )
+                        sym = sym -> entry;
+
+                    /* handle not found */
+                    if ( sym == NULL )
+                        return NULL;
+
+                    /* loop or return the found object */
+                    switch ( sym -> type )
+                    {
+                    case ccContainer:
+                    case ccArchive:
+                        self = & ( ( CCContainerNode* ) sym -> entry ) -> sub;
+                        break;
+                    case ccDirectory:
+                        self = sym -> entry;
+                        break;
+                    default:
+                        return NULL;
+                    }
+                    
+                    /* dad = sym; */
+                    break;
+                }
+            }
+        }
+
+        if ( j == len )
+            break;
+    }
+
+    if ( i >= len )
+        return NULL;
+
+    sz = len - i;
+    StringInit ( & name, & path [ i ], sz, string_len ( & path [ i ], sz ) );
+    return ( const CCName* ) BSTreeFind ( self, & name, CCNameCmp );
+}
+
+
+const CCName *CCTreeFind ( const CCTree *self, const char *path, ... )
+{
+    va_list args;
+    const CCName *name;
+
+    va_start ( args, path );
+    name = CCTreeVFind ( self, path, args );
+    va_end ( args );
+
+    return name;
+}
+
+
+/* Link
+ *  create a symlink to existing node
+ */
+rc_t CCTreeLink ( CCTree *self, KTime_t mtime,
+    const char *targ, const char *alias )
+{
+    const CCName *orig = CCTreeFind ( self, targ );
+    if ( orig == NULL )
+        return RC ( rcExe, rcTree, rcInserting, rcPath, rcNotFound );
+
+    return CCTreeInsert ( self, mtime, ccHardlink, orig, alias );
+}
diff --git a/tools/copycat/copycat-priv.h b/tools/copycat/copycat-priv.h
new file mode 100644
index 0000000..77efc7c
--- /dev/null
+++ b/tools/copycat/copycat-priv.h
@@ -0,0 +1,229 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+
+
+#ifndef _h_copycat_priv_
+#define _h_copycat_priv_
+
+#ifndef _h_cctree_priv_
+#include "cctree-priv.h"
+#endif
+
+#ifndef _h_kfs_directory_
+#include <kfs/directory.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*--------------------------------------------------------------------------
+ * forwards
+ */
+    struct KFile;
+struct KTocChunk;
+
+/*--------------------------------------------------------------------------
+ * globals
+ */
+extern uint32_t in_block;
+extern uint32_t out_block;
+extern int verbose;             /* program-wide access to verbosity level */
+extern CCTree *ctree;           /* tree of nodes as seen while cataloging the input */
+extern CCTree *etree;           /* tree of nodes as extracted */
+extern KDirectory *cdir;        /* here we 'cache' XML files that get tweaked and passed to laoders */
+extern KDirectory *edir;        /* here we extract non container/archive files for use if we can't
+                                 * load without unpacking */ 
+extern bool extract_dir;        /* if set we are adding directories on extraction to match our 
+                                 * normal output XML */
+extern bool xml_dir;            /* if set we will output XML to match our extracted files not
+                                 * the original packed submission */
+extern bool no_bzip2;           /* if true, don't try to decompress bzipped files */
+extern bool no_md5;             /* if true, don't calculate md5 sums */
+extern char epath [8192];       /* we build a path down through containes/archives */
+extern char * ehere;            /* the pointer to the next character in epath during descent */
+extern KCreateMode cm;          
+extern struct KFile *fnull;     /* global reference to "/dev/null" or bit bucket KFile */
+
+extern void * dump_out;
+extern char ncbi_encryption_extension[];
+extern char wga_encryption_extension[];
+
+rc_t CC copycat_log_writer (void * self, const char * buffer, size_t buffer_size,
+                            size_t * num_writ);
+rc_t CC copycat_log_lib_writer  (void * self, const char * buffer, size_t buffer_size,
+                                 size_t * num_writ);
+
+/*--------------------------------------------------------------------------
+ * copycat
+ */
+typedef struct ccat_pb
+{
+    CCTree * tree;
+    const struct KFile * sf;
+    KTime_t mtime;
+    enum CCType ntype;
+    CCFileNode * node;
+    const char * name;
+} ccat_pb;
+
+/* ccat
+ *  non-buffered recursive entrypoint
+ *
+ *  "tree" [ IN ] - immediate parent of node
+ *
+ *  "src" [ IN ] - file to be analyzed
+ *
+ *  "mtime" [ IN ] - modification time of "src"
+ *
+ *  "ntype" [ IN ] and "node" [ IN ] - file node and type
+ *
+ *  "name" [ IN ] - file leaf name
+ *
+ * use this call if buffering of the parent provides buffering of the child
+ * such as archive formats with no compression such as kar or tar
+ */
+rc_t ccat_md5 ( CCTree *tree, const struct KFile *sf, KTime_t mtime,
+                enum CCType ntype, CCFileNode *node, const char *name );
+
+/* ccat_buf
+ *  buffered recursive entrypoint
+ *
+ *  "bsize" [ IN ] - requested buffer size
+ *
+ * use this call when recursing on a type where buffering of the parent won't 
+ * help such as decompression or decryption
+ */
+rc_t ccat_buf ( CCTree *tree, const struct KFile *sf, KTime_t mtime,
+                enum CCType ntype, CCFileNode *node, const char *name);
+
+
+/* -----
+ * copycat
+ *
+ * The copycat function is the actual copy and catalog function.
+ * All before this function is called is building toward this.
+ */
+struct VPath;
+rc_t copycat (CCTree *tree, KTime_t mtime, KDirectory * cwd,
+              const struct VPath * src, const struct KFile *sf, 
+              const struct VPath * dst, struct KFile *df,
+              const char *spath, const char *name, 
+              uint64_t expected_size, bool do_decrypt, bool do_encrypt);
+
+/*--------------------------------------------------------------------------
+ * CCFileFormat
+ */
+typedef struct CCFileFormat CCFileFormat;
+extern CCFileFormat *filefmt;
+
+typedef enum CCFileFormatClass
+{
+    ccffcError = -1,
+    ccffcUnknown,
+    ccffcCompressed,
+    ccffcArchive,
+    ccffcCached,
+    ccffcEncoded
+} CCFileFormatClass;
+
+typedef enum CCFileFormatTypeCompressed
+{
+    ccfftcError = -1,
+    ccfftcUnknown,
+    ccfftcGzip,
+    ccfftcBzip2,
+    ccfftcZip
+} CCFileFormatTypeCompressed;
+
+typedef enum CCFileFormatTypeArchive
+{
+    ccfftaError = -1,
+    ccfftaUnknown,
+    ccfftaTar,
+    ccfftaSra,
+    ccfftaHD5
+} CCFileFormatTypeArchive;
+
+typedef enum CCFileFormatTypeXML
+{
+    ccfftxError = -1,
+    ccfftxUnknown,
+    ccfftxXML
+} CCFileFormatTypeXML;
+
+typedef enum CCFileFormatTypeEncoded
+{
+    ccffteError = -1,
+    ccffteUnknown,
+    ccffteNCBIErrored,
+    ccffteNCBI,
+    ccffteWGAErrored,
+    ccffteWGA
+} CCFileFormatTypeEncoded;
+
+rc_t CCFileFormatMake ( CCFileFormat ** p );
+rc_t CCFileFormatRelease ( const CCFileFormat *self );
+rc_t CCFileFormatGetType ( const CCFileFormat *self, struct KFile const *file,
+    const char *path, char *buffer, size_t buffsize,
+    uint32_t *type, uint32_t *class );
+
+
+rc_t ccat_tar ( CCContainerNode *np, const struct KFile *sf, const char *name );
+rc_t ccat_sra ( CCContainerNode *np, const struct KFile *sf, const char *name );
+
+typedef struct KSubChunkFile KSubChunkFile;
+
+rc_t KFileMakeChunkRead (const struct KFile ** pself,
+			 const struct KFile * original,
+			 uint64_t size,
+			 uint32_t num_chunks,
+			 struct KTocChunk * chunks);
+
+bool CCFileFormatIsNCBIEncrypted ( void  * buffer );
+bool CCFileFormatIsWGAEncrypted ( void  * buffer );
+/*
+ * Use as DEBUG_STATUS(("format",arg,...))
+ */
+#define DEBUG_STATUS(msg)  DBGMSG(DBG_APP,1,msg)
+
+
+rc_t copycat_log_set (void * new, void ** prev);
+
+
+struct KFile;
+rc_t CC CCFileMakeRead (const struct KFile ** self,
+                        const struct KFile * original, rc_t * prc);
+rc_t CC CCFileMakeUpdate (struct KFile ** self,
+                          struct KFile * original, rc_t * prc);
+rc_t CC CCFileMakeWrite (struct KFile ** self,
+                         struct KFile * original, rc_t * prc);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _h_copycat_priv_ */
diff --git a/tools/copycat/copycat.c b/tools/copycat/copycat.c
new file mode 100644
index 0000000..6aa06bc
--- /dev/null
+++ b/tools/copycat/copycat.c
@@ -0,0 +1,1263 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+
+#include "copycat.vers.h"
+#include "copycat-priv.h"
+#include "cctree-priv.h"
+
+#include <vfs/manager.h>
+#include <vfs/path.h>
+#include <vfs/path-priv.h>
+#include <kfs/directory.h>
+#include <kfs/file.h>
+#include <kfs/nullfile.h>
+#include <kfs/crc.h>
+#include <klib/checksum.h>
+#include <klib/writer.h>
+#include <klib/log.h>
+#include <klib/status.h>
+#include <klib/debug.h>
+#include <klib/out.h>
+#include <klib/status.h>
+#include <klib/text.h>
+#include <kapp/main.h>
+#include <kapp/args.h>
+#include <klib/rc.h>
+#include <klib/vector.h>
+
+#include <strtol.h>
+
+#include <time.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+/*
+ * some program globals
+ */
+const char * program_name = "copycat"; /* default it but try to set it */
+const char * full_path = "copycat"; /* default it but try to set it */
+int verbose = 0;
+KFile *fnull;
+
+/* cache information */
+CCTree *ctree;
+KDirectory *cdir;
+
+uint32_t in_block = 0;
+uint32_t out_block = 0;
+
+CCTree *etree;
+KDirectory * edir; /* extracted file base kdir */
+char epath[8192];
+char * ehere;
+bool xml_dir = false;
+bool extract_dir = false;
+bool no_bzip2 = false;
+bool no_md5 = false;
+void * dump_out;
+const char * xml_base = NULL;
+
+char ncbi_encryption_extension[] = ".nenc";
+char wga_encryption_extension[] = ".ncbi_enc";
+
+static
+KWrtWriter  log_writer;
+static
+KWrtWriter  log_lib_writer;
+static
+void * log_data;
+static
+void * log_lib_data;
+
+rc_t CC copycat_log_writer (void * self, const char * buffer, size_t buffer_size,
+                            size_t * num_writ)
+{
+    if (self)
+    {
+        void * bf = malloc (sizeof (SLNode) + buffer_size);
+        if (bf)
+        {
+            const char * ps, * pc;
+            size_t z;
+            ps = strchr (buffer, ' ');
+            if (ps)
+            {
+                ++ps;
+                pc = strchr (ps, '-');
+                if (pc == NULL)
+                    pc = strchr (ps, ':');
+                if (pc)
+                    pc = pc + 2;
+                else
+                    pc = ps;
+            }
+            else
+                pc = buffer;
+            z = buffer_size - (pc - buffer);
+            memcpy ( (void*)(((SLNode*)bf)+1), pc, z);
+            ((char*)(((SLNode*)bf)+1))[z-1] = '\0';
+            SLListPushTail (self, bf);
+        }
+    }
+    return (log_writer != NULL)
+        ? log_writer (log_data, buffer, buffer_size, num_writ) : 0;
+}
+rc_t CC copycat_log_lib_writer  (void * self, const char * buffer, size_t buffer_size,
+                                 size_t * num_writ)
+{
+    if (self)
+    {
+        void * bf = malloc (sizeof (SLNode) + buffer_size);
+        if (bf)
+        {
+            const char * ps, * pc;
+            size_t z;
+            ps = strchr (buffer, ' ');
+            if (ps)
+            {
+                ++ps;
+                pc = strchr (ps, ':');
+                if (pc)
+                    pc = pc + 2;
+                else
+                    pc = ps;
+            }
+            else
+                pc = buffer;
+            z = buffer_size - (pc - buffer);
+            memcpy ( (void*)(((SLNode*)bf)+1), pc, z);
+            ((char*)(((SLNode*)bf)+1))[z-1] = '\0';
+            SLListPushTail (self, bf);
+        }
+    }
+    return (log_lib_writer != NULL)
+        ? log_lib_writer (log_lib_data, buffer, buffer_size, num_writ) : 0;
+}
+
+static
+rc_t copycat_log_unset ()
+{
+    rc_t rc_l, rc_ll;
+
+    rc_l = KLogHandlerSet (log_writer, log_data);
+    rc_ll = KLogHandlerSet (log_lib_writer, log_lib_data);
+
+    return (rc_l != 0) ? rc_l : rc_ll;
+}
+
+rc_t copycat_log_set (void * new, void ** prev)
+{
+    rc_t rc;
+
+    if (prev)
+        *prev = KLogDataGet();
+
+    rc = KLogHandlerSet (copycat_log_writer, new);
+    if (rc == 0)
+        rc = KLogLibHandlerSet (copycat_log_lib_writer, new);
+
+    if (rc)
+        copycat_log_unset ();
+
+    return rc;
+}
+
+/* global create mode */
+KCreateMode cm = kcmParents | kcmCreate;
+
+#define OPTION_CACHE   "cache-dir"
+#define OPTION_FORCE   "force"
+#define OPTION_DEST    "output"
+#define OPTION_EXTRACT "extract"
+#define OPTION_EXTDIR  "extract-to-dir"
+#define OPTION_XMLDIR  "xml-dir"
+#define OPTION_DECPWD  "decryption-password"
+#define OPTION_ENCPWD  "encryption-password"
+#define OPTION_XMLBASE "xml-base-node"
+#define OPTION_INBLOCK "input-buffer"
+#define OPTION_OUTBLOCK "output-buffer"
+#define OPTION_NOBZIP2 "no-bzip2"
+#define OPTION_NOMD5   "no-md5"
+
+#define ALIAS_CACHE   "x"
+#define ALIAS_FORCE   "f"
+#define ALIAS_DEST    "o"
+#define ALIAS_EXTRACT "e"
+#define ALIAS_EXTDIR  "E"
+#define ALIAS_XMLDIR  "X"
+#define ALIAS_DECPWD  ""
+#define ALIAS_ENCPWD  ""
+#define ALIAS_XMLBASE ""
+#define ALIAS_INBLOCK ""
+#define ALIAS_OUTBLOCK ""
+#define ALIAS_NOBZIP2 ""
+#define ALIAS_NOMD5   ""
+
+
+
+static
+const char * extract_usage[] = 
+{ "location of extracted files", NULL };
+static
+const char * cache_usage[] = 
+{ "location of output cached files", NULL };
+static
+const char * force_usage[] = 
+{ "force overwrite of existing files", NULL };
+static
+const char * dest_usage[] = 
+{ "location of output", NULL };
+static
+const char * xmldir_usage[] = 
+{ "XML matches extracted files", NULL };
+static
+const char * extdir_usage[] = 
+{ "extracted directories match normal XML", NULL };
+static
+const char * xmlbase_usage[] = 
+{ "use this to base the XML not destination; can only be used with a single source", NULL };
+static
+const char * inblock_usage[] = 
+{ "system file reads are of blocks of this size", NULL };
+static
+const char * outblock_usage[] = 
+{ "system file writes are of blocks of this size", NULL };
+static
+const char * no_bzip2_usage[] = 
+{ "do not decompress files compressed with bzip2", NULL };
+const char * no_md5_usage[] = 
+{ "do not calculate md5 hashes", NULL };
+
+
+const char UsageDefaultName [] = "copycat";
+
+
+rc_t CC UsageSummary (const char * progname)
+{
+    return KOutMsg (
+        "\n"
+        "Usage:\n"
+        "  %s [options] src-file dst-file\n"
+        "  %s [options] src-file [src-file...] dst-dir\n"
+        "  %s [options] -o dst-dir src-file [src-file...]\n"
+        "\n"
+        "Summary:\n"
+        "  Copies files and/or directories, creating a catalog of the copied files.\n",
+        progname, progname, progname);
+}
+
+rc_t CC Usage (const Args * args)
+{
+    const char * progname = UsageDefaultName;
+    const char * fullpath = UsageDefaultName;
+    rc_t rc;
+
+    if (args == NULL)
+        rc = RC (rcApp, rcArgv, rcAccessing, rcSelf, rcNull);
+    else
+        rc = ArgsProgram (args, &fullpath, &progname);
+
+    UsageSummary (progname);
+
+    HelpOptionLine (ALIAS_CACHE, OPTION_CACHE, "dir-path", cache_usage);
+    HelpOptionLine (ALIAS_FORCE, OPTION_FORCE, NULL, force_usage);
+    HelpOptionLine (ALIAS_DEST, OPTION_DEST, "file-path", dest_usage);
+    HelpOptionLine (ALIAS_EXTRACT, OPTION_EXTRACT, "dir-path", extract_usage);
+    HelpOptionLine (ALIAS_EXTDIR, OPTION_EXTDIR, NULL, extdir_usage);
+    HelpOptionLine (ALIAS_XMLDIR, OPTION_XMLDIR, NULL, xmldir_usage);
+    HelpOptionLine (ALIAS_INBLOCK, OPTION_INBLOCK, "size-in-KB", inblock_usage);
+    HelpOptionLine (ALIAS_OUTBLOCK,OPTION_OUTBLOCK, "size-in-KB", outblock_usage);
+    HelpOptionLine (ALIAS_NOBZIP2,OPTION_NOBZIP2, NULL, no_bzip2_usage);
+    HelpOptionLine (ALIAS_NOMD5,OPTION_NOMD5, NULL, no_md5_usage);
+    HelpOptionsStandard ();
+
+
+
+/*                     1         2         3         4         5         6         7         8 */
+/*            12345678901234567890123456789012345678901234567890123456789012345678901234567890 */
+    OUTMSG (("Use:\n"
+             " Copy and catalog:\n"
+             "  Some quick examples:\n"
+             "    %s dir/file.tar other-dir/file.tar\n"
+             "      copy file.tar from dir to other-dir and write the catalog to stdout\n"
+             "    %s dir/file.tar otherdir/\n"
+             "      the same\n", progname,progname));
+    OUTMSG (("    %s \"ncbi-file:dir/file.tar.nenc?encrypt&pwfile=pw other-dir.file.tar\n"
+             "      copy and decrypt file.tar.nenc from dir to other-dir and catalog\n"
+             "    %s dir/file.tar \"ncbi-file:other-dir/file.tar.nenc?encrypt&pwfile=pw\n"
+             "      copy and encrypt file.tar from dir to other-dir/file.tar.nenc and catalog\n"
+             "    %s \"ncbi-file:dir/file.tar.nenc?encrypt&pwfile=pw1 \\\n"
+             "                   \"ncbi-file:other-dir/file.tar.nenc?encrypt&pwfile=pw2\n"
+             "      copy the file as above while changing the encryption\n"
+             "\n", progname, progname, progname));
+    OUTMSG (("Use:\n"
+             "  Copy source file[s] to a destination file or directory.\n"
+             "  File names can either be typical path names or they can be URLs (IRLs) using\n"
+             "  the standard \"file\" or extended \"ncbi-file\" schemes.\n"
+             "  The catalog is XML output sent by default to stdout.\n"
+             "  As UTF-8 is accepted in the paths they are IRLs for International Resource\n"
+             "  Locators.\n"
+             "\n"));
+    OUTMSG (("  If the specified destination does not exist, there could be an ambiguity\n"
+             "  whether the destination is supposed to be a file or directory.  If the\n"
+             "  entered path ends in a '/' character or if there is more than one source\n"
+             "  it is assumed to mean a directory and is created as such.  If neither of\n"
+             "  of those apply it is assumed to be a file.\n"
+             "\n"));
+    OUTMSG (("  The sources or destination may also be special Unix devices:\n"
+             "    /dev/stdin is supported as a source.\n"
+             "    /dev/stdout and /dev/stderr is supported as a destination.\n"
+             "  Other file descriptor devices can be used in the form:\n"
+             "    /dev/fd/<fd-number>\n"));
+    OUTMSG (("  For example /dev/stdin is synonymous with /dev/fd/0 as a source.\n"
+             "  If /dev/stdout or /dev/fd/1 is used as the destination then the XML\n"
+             "  output is redirected to /dev/stderr (/dev/fd/2).\n"
+             "  Device /dev/null as the destination is treated as a file with only one\n"
+             "  source but as a directory if more than one source.  Using this device\n"
+             "  means no actual file will be copied but the cataloging will be done but\n"
+             "  " OPTION_XMLBASE " must be used.\n"
+             "\n"));
+    OUTMSG (("  These special devices can be entered using the URL (IRL) schemes if\n"
+             "  desired.  This allows the use of 'query' decorators.\n"
+             "  \n"));
+    OUTMSG (("  If a query is added to the URL it will need to be enclosed within '\"\'\n"
+             "  characters on a command line to prevent premature interpretation.\n"
+             "  The query for the 'ncbi-file' extension to the 'file' scheme allows\n"
+             "  encryption and decryption.  The supported query is introduced by the\n"
+             "  standard URI/IRI syntax of a '?' character with a '&' character\n"
+             "  separating individual query-entries.\n"
+             "\n"));
+    OUTMSG (("  The supported query entries are:\n"
+             "    'encrypt' or 'enc' to mean the input may be encrypted or the output\n"
+             "      will be encrypted,\n"
+             "    'pwfile=<path>' gives the path to file containing the password.\n"
+             "    'pwfd=<FD>' gives the numerical file descriptor from which to read\n"
+             "      the password,\n"
+             "\n"));
+    OUTMSG (("  In this program the encrypted input can apply to a file contained within\n"
+             "  the source rather than just the source file itself.  The tool is fully\n"
+             "  compatible with all versions of NCBI encryption.\n"
+             "\n"
+             "  If the output is to be encrypted only the newer FIPS compliant encryption\n"
+             "  will be used and applies to the whole file.\n"
+             "\n"));
+    OUTMSG (("NOTE: Not all combinations of URL specifications will work at this point.\n"
+             "\n"
+             "NOTE: using the same file descriptor for multiple sources or overlapping with\n"
+             "      stdin/stdout/stderr may cause undefined behavior including hanging the\n"
+             "      the program.\n"
+             "\n"));
+    OUTMSG (("  The '-x' option allows small files that are typed as eligible for\n"
+             "  caching to be copied to the cache directory provided. the directory\n"
+             "  will be created if necessary.\n"
+             "  the intent is to capture top-level files, such that files are copied\n"
+             "  into the flat cache directory without regard to where they were found\n"
+             "  in the input hierarchy. in the case of name conflict, output files will\n"
+             "  be renamed.\n"
+             "\n"));
+    OUTMSG (("  To prevent internal decompression of bzipped files, use the option\n"
+             "    '--no-bzip2'\n"
+             "\n"));
+    OUTMSG (("  To prevent calculation of MD5 hashes, use the option\n"
+             "    '--no-md5'\n"
+             "\n"));
+
+    HelpVersion (fullpath, KAppVersion());
+
+    return rc;
+}
+
+static
+OptDef Options[] = 
+{
+    /* name            alias max times oparam required fmtfunc help text loc */
+    { OPTION_EXTRACT, ALIAS_EXTRACT, NULL, extract_usage, 1, true,  false },
+    { OPTION_EXTDIR,  ALIAS_EXTDIR,  NULL, extdir_usage,  0, false, false },
+    { OPTION_XMLDIR,  ALIAS_XMLDIR,  NULL, xmldir_usage,  0, false, false },
+    { OPTION_CACHE,   ALIAS_CACHE,   NULL, cache_usage,   1, true,  false },
+    { OPTION_FORCE,   ALIAS_FORCE,   NULL, force_usage,   0, false, false },
+    { OPTION_DEST,    ALIAS_DEST,    NULL, dest_usage,    1, true,  false },
+    { OPTION_XMLBASE, ALIAS_XMLBASE, NULL, xmlbase_usage, 1, true,  false },
+    { OPTION_INBLOCK, ALIAS_OUTBLOCK,NULL, inblock_usage, 1, true,  false },
+    { OPTION_OUTBLOCK,ALIAS_OUTBLOCK,NULL, outblock_usage,1, true,  false },
+    { OPTION_NOBZIP2, ALIAS_NOBZIP2, NULL, no_bzip2_usage,0, false, false },
+    { OPTION_NOMD5,   ALIAS_NOMD5,   NULL, no_md5_usage,  0, false, false }
+};
+
+/* file2file
+ */
+static
+rc_t copycat_file2file (CCTree * tree,
+                        SLList * logs,
+                        VFSManager * mgr,
+                        VPath * _src,
+                        VPath * _dst,
+                        const char * leaf)
+{
+    size_t sz;
+    rc_t rc;
+    bool do_encrypt;
+    bool do_decrypt;
+    char spath [8192];
+
+    do_decrypt = (VPathOption (_src, vpopt_encrypted, spath, sizeof spath, &sz) == 0);
+    do_encrypt = (VPathOption (_dst, vpopt_encrypted, spath, sizeof spath, &sz) == 0);
+
+    /* we can't use the automagical nature of the VPath and its query part 
+     * because copycat needs to peek under the hood; but we want the automagical
+     * ability to handle it's path part.
+     */
+
+    rc = VPathReadPath (_src, spath, sizeof spath, &sz);
+    if (rc)
+        LOGERR (klogInt, rc, "error rereading built source path");
+    else
+    {
+        char dpath [8192];
+        size_t dz;
+
+        rc = VPathReadPath (_dst, dpath, sizeof dpath, &dz);
+        if (rc)
+            LOGERR (klogInt, rc, "error rereading built source path");
+        else
+        {
+            KDirectory * cwd;
+
+            rc = VFSManagerGetCWD (mgr, &cwd);
+            if (rc)
+                LOGERR (klogInt, rc, "error pulling directory out of manager");
+            else
+            {
+                KTime_t mtime = 0;
+                bool src_dev = false;
+                bool dst_dev = false;
+
+                if (strncmp (spath, "/dev/", sizeof "/dev/"-1) == 0)
+                {
+                    /* get date from file system
+                       [this won't be either the submitter original date
+                       nor the mod-date within the file system, unless
+                       the date gets reset...] */
+                    mtime = time (NULL);
+                    src_dev = true;
+                }
+                else
+                {
+                    rc = KDirectoryDate (cwd, &mtime, "%s", spath);
+                    if (rc)
+                    {
+                        PLOGERR (klogErr,
+                                 (klogErr, rc,
+                                  "failed to determine modtime for '$(path)' continuing", "path=%s", spath ));
+                        mtime = time (NULL);
+                        rc = 0;
+                    }
+                }
+                if (strncmp (dpath, "/dev/", sizeof "/dev/" - 1) == 0)
+                {
+                    if (strcmp(dpath, "/dev/stdout") == 0 ||
+                        strcmp(dpath, "/dev/fd/1") == 0)
+                    {
+                        dump_out = stderr;
+                    }
+                    dst_dev = true;
+
+                    if (src_dev && (xml_base == NULL))
+                    {
+                        rc = RC (rcExe, rcArgv, rcAccessing, rcParam, rcNull);
+                        LOGERR (klogErr, rc, "Must provide " OPTION_XMLBASE
+                                " when using a device stream as output");
+                    }
+                }
+                if (rc == 0)
+                {
+                    char * sleaf;
+                    char * dleaf;
+                    char * ext;
+                    VPath * src;
+                    size_t xz;
+                    char xpath [8192]; /* way over sized - its a leaf only */
+
+                    sleaf = strrchr (spath, '/');
+                    if (sleaf++ == NULL)
+                        sleaf = spath;
+
+                    dleaf = strrchr (dpath, '/');
+                    if (dleaf++ == NULL)
+                        dleaf = dpath;
+
+                    xz = strlen (leaf);
+                    memcpy (xpath, leaf, xz + 1);
+
+                    /* if we are encrypting the output make sure we have an encryption
+                     * extension on the destination.
+                     */
+                    if (do_decrypt)
+                    {
+                        ext = strrchr (xpath, '.');
+                        if (ext == NULL)
+                            ext = xpath;
+                        if ((strcmp (ext, ncbi_encryption_extension) == 0) ||
+                            (strcmp (ext, wga_encryption_extension) == 0))
+                            *ext = '\0';
+                    }
+                    else
+                        ext = xpath + strlen (xpath);
+
+                    if (do_encrypt)
+                    {
+                        strcpy (ext, ncbi_encryption_extension);
+
+                        if (!dst_dev)
+                        {
+                            ext = strrchr (dleaf, '.');
+                            if (ext == NULL)
+                                ext = dleaf + strlen (dleaf);
+
+                            if (strcmp (ext, ncbi_encryption_extension) != 0)
+                                strcat (ext, ncbi_encryption_extension);
+                        }
+                    }
+
+                    rc = VFSManagerMakePath (mgr, &src, "%s", spath);
+                    if (rc)
+                        LOGERR (klogErr, rc, "error rebuilding source path");
+                    else
+                    {
+                        VPath * dst;
+
+                        rc = VFSManagerMakePath (mgr, &dst, "%s", dpath);
+                        if (rc)
+                            LOGERR (klogErr, rc, "error rebuilding source path");
+                        else
+                        {
+
+                            /* never allow overwrite of something already there */
+                            if (CCTreeFind (tree, xpath) != NULL ) /* dleaf? xpath? */
+                            {
+                                rc = RC ( rcExe, rcFile, rcCopying, rcPath, rcExists );
+                                PLOGERR ( klogInt,  (klogInt, rc, "will not overwrite "
+                                                     "just-created '$(path)'", "path=%s", xpath ));
+                            }
+                            else
+                            {
+                                const KFile * sf;
+
+                                rc = VFSManagerOpenFileRead (mgr, &sf, src);
+                                if (rc)
+                                    PLOGERR (klogFatal,
+                                             (klogFatal, rc,
+                                              "error opening input '$(P)'", "P=%s", spath));
+                                else
+                                {
+                                    uint64_t expected;
+
+                                    rc = KFileSize (sf, &expected);
+                                    if (rc)
+                                    {
+                                        if (GetRCState (rc) == rcUnsupported)
+                                        {
+                                            expected = rcUnsupported;
+                                            rc = 0;
+                                        }
+                                    }
+                                    if (rc == 0)
+                                    {
+                                        KFile * df;
+
+                                        rc = VFSManagerCreateFile (mgr, &df, false, 0640, cm, dst);
+                                        if (GetRCState (rc) == rcUnauthorized)
+                                        {
+                                            uint32_t access;
+                                            rc_t orc;
+
+                                            orc = KDirectoryAccess (cwd, &access, "%s", dpath);
+                                            if (orc == 0)
+                                            {
+                                                orc = KDirectorySetAccess (cwd, false, 0640, 0777, "%s", dpath);
+                                                if (orc == 0)
+                                                {
+                                                    rc = VFSManagerCreateFile (mgr, &df, false, 0640, cm, dst);
+                                                    if (rc)
+                                                        KDirectorySetAccess (cwd, false, access, 0777, "%s", dpath);
+                                                }
+                                            }
+                                        }
+                                        if (rc)
+                                            PLOGERR (klogErr,
+                                                     (klogErr, rc, "failed to creat destination file '$(path)'",
+                                                      "path=%s", dpath));
+                                        else
+                                        {
+                                            rc_t orc;
+
+                                            log_writer = KLogWriterGet();
+                                            log_lib_writer = KLogLibWriterGet();
+                                            log_data = KLogDataGet();
+                                            log_lib_data = KLogLibDataGet();
+
+                                            rc = copycat_log_set (logs, NULL);
+                                            if (rc == 0)
+                                            {
+                                                DEBUG_STATUS (("\n-----\n%s: call copycat (tree(%p), mtime(%lu),"
+                                                               " cwd(%p), _src(%p), sf(%p), _dst(%p), df(%p), "
+                                                               "spath(%s), leaf(%s), expected(%lu), do_decrypt(%d)"
+                                                               " do_encrypt(%d))\n\n", __func__,
+                                                               tree, mtime, cwd, _src, sf, _dst, df, spath,
+                                                               xpath, expected, do_decrypt, do_encrypt));
+                                                rc = copycat (tree, mtime, cwd, _src, sf, _dst, df, spath,
+                                                              xpath, expected, do_decrypt, do_encrypt);
+
+                                                orc = copycat_log_unset();
+                                            }
+
+                                            if (rc)
+                                                LOGERR (klogFatal, rc, "copycat function failed");
+                                            else
+                                                rc = orc;
+
+                                            KFileRelease (df);
+                                        }
+                                    }
+                                    KFileRelease (sf);
+                                }
+                            }
+                            VPathRelease (dst);
+                        }
+                        VPathRelease (src);
+                    }
+                }
+                KDirectoryRelease (cwd);
+            }
+        }
+    }
+    return rc;
+}
+
+
+/* files2dir
+ */
+static
+rc_t copycat_files2dir (CCTree * tree, SLList * logs, VFSManager * mgr, Vector * v, VPath * dst)
+{
+    size_t dz;
+    uint32_t ix;
+    rc_t rc;
+    char dbuff [8192];
+
+    /* xml-base only works for a single file */
+    if ((VectorLength (v) > 1) && (xml_base != NULL))
+    {
+        rc = RC (rcExe, rcArgv, rcParsing, rcParam, rcIncorrect);
+        LOGERR (klogErr, rc, "Can only use " OPTION_XMLBASE " with a single source file");
+        return rc;
+    }
+
+    /* get the path out of the destination VPath */
+    rc = VPathReadPath (dst, dbuff, sizeof dbuff, &dz);
+    if (rc)
+        return rc;
+
+    for (ix = 0; ix < VectorLength (v); ++ix)
+    {
+        VPath * new_dst;
+        VPath * src;
+        char * sleaf;
+        size_t sz;
+        char sbuff [8192];
+
+        src = (VPath*) VectorGet (v, ix);
+        if (src == NULL) /* warn? error? abort? */
+            continue;
+
+
+        rc = VPathReadPath (src, sbuff, sizeof sbuff, &sz);
+        if (rc)
+            return rc;
+
+        sleaf = strrchr (sbuff, '/');
+        if (sleaf++ == NULL)
+            sleaf = sbuff;
+
+        /* the special case destination is the null device which we treat 
+         * as if it was a directory at first and then as a file
+         */
+        if (strcmp (dbuff, "/dev/null") == 0)
+        {
+            rc = VPathAddRef (dst);
+            if (rc != 0)
+                break;
+            new_dst = dst;
+        }
+        else
+        {
+            DEBUG_STATUS(("%s: %s (%lu)\n", __func__, dbuff, dz));
+
+            /* fix up the destination path if it's missing a final '/'
+             * this is inside the loop because of the null device special case
+             */
+            if (dbuff [dz-1] != '/')
+            {
+                dbuff [dz++] = '/';
+                dbuff [dz] = '\0';
+            }
+
+            /* append source leaf to destination path */
+            string_copy (dbuff + dz, sizeof dbuff - dz, sleaf, strlen (sleaf));
+
+            DEBUG_STATUS(("%s: %s\n", __func__, dbuff));
+
+            /* make a new VPath - no URI stuff gets transferred here */
+            rc = VFSManagerMakePath (mgr, &new_dst, "%s", dbuff);
+            if (rc)
+                break;
+        }
+
+        /* do this one file copy and catalog now */
+        rc = copycat_file2file (tree, logs, mgr, src, new_dst, xml_base ? xml_base : sleaf);
+
+        VPathRelease (new_dst);
+    }
+    return rc;
+}
+
+
+/* run
+ *
+ * dest will be set if the -o option was used.
+ * 
+ */
+static
+rc_t copycat_run ( CCTree *tree, SLList * logs, VFSManager * mgr, 
+                   const char *cache, VPath * _dest, const char *extract, 
+                   Vector * v)
+{
+    rc_t rc;
+    int dest_type;
+    KDirectory * cwd;
+    VPath * dest;
+    size_t sz;
+    const char * pleaf;
+    char pbuff [4096];
+
+    /* =====
+     * directories aren't yet using the VFSManager to open them
+     * because we have to get more under the covers for our cataloging
+     */
+
+    rc = VFSManagerGetCWD (mgr, &cwd);
+    if (rc)
+        return rc;
+
+    /* if there's a cache path, create directory */
+    if ( cache != NULL )
+    {
+        rc = KDirectoryCreateDir ( cwd, 0775, kcmParents | kcmOpen, "%s", cache );
+        if ( rc == 0 )
+            rc = KDirectoryOpenDirUpdate ( cwd, & cdir, true, "%s", cache );
+        if ( rc != 0 )
+        {
+            PLOGERR (klogErr,
+                     (klogErr, rc, "failed to open cache directory '$(path)'",
+                      "path=%s", cache ));
+            return rc;
+        }
+    }
+    else
+        cdir = NULL;
+
+    /* if there's a extract path, create directory */
+    if ( extract != NULL )
+    {
+        rc = KDirectoryCreateDir (cwd, 0775, kcmParents | kcmOpen, "%s", extract);
+        if ( rc == 0 )
+            rc = KDirectoryOpenDirUpdate (cwd, & edir, true, "%s", extract);
+        if ( rc != 0 )
+        {
+            PLOGERR (klogErr, 
+                     (klogErr, rc,
+                      "failed to open extract directory '$(path)'",
+                      "path=%s", extract ));
+            return rc;
+        }
+    }
+    else
+        edir = NULL;
+
+    dest = _dest;
+    if (dest == NULL)
+    {
+        rc = VectorRemove (v, VectorLength(v) - 1, (void**)&dest);
+        if (rc)
+            return rc;
+    }
+
+    rc = VPathReadPath (dest, pbuff, sizeof pbuff, &sz);
+    if (rc)
+        return rc;
+
+    if (xml_base)
+        pleaf = xml_base;
+    else
+    {
+        pleaf = strrchr (pbuff, '/');
+        if (pleaf++ == NULL)
+            pleaf = pbuff;
+    }
+
+
+    /* check destination type */
+    dest_type = KDirectoryPathType (cwd, "%s", pbuff);
+    DEBUG_STATUS(("%s: checked destination type for '%s' got '%u'\n", __func__, pbuff, dest_type));
+    switch (dest_type & ~ kptAlias)
+    {
+    case kptNotFound:
+        /* this is the potentially ambiguous situation 
+         * if only two arguments and the last isn't definitively a directory 
+         * we assume its supposed to be a file.
+         *
+         * If the target does not exist but it's path ends in '/' or if
+         * there is more than one source we know it is supposed to be a 
+         * directory.
+         */
+        if ((pbuff[sz-1] != '/')
+/*              ((pbuff[sz-1] != '.') */
+
+
+
+/*              ( */
+/* )) */
+            && (VectorLength (v) == 1))
+        {
+            return copycat_file2file (tree, logs, mgr, VectorGet (v, 0), dest, pleaf);
+        }
+
+        /* create a directory at the given path */
+        rc = KDirectoryCreateDir ( cwd, 0775, kcmParents | kcmOpen, "%s", pbuff );
+        if ( rc != 0 )
+            return rc;
+
+        /* fall through */
+    case kptDir:
+        return copycat_files2dir (tree, logs, mgr, v, dest);
+
+
+    case kptCharDev:
+        /*
+         * special case NULL device can act like a directory here
+         * all other 'devices' we treat as a file
+         */
+        if ( strcmp ( pbuff, "/dev/null" ) == 0 )
+        {
+#if 0
+            if (VectorLength (v) > 1)
+#endif
+                return copycat_files2dir (tree, logs, mgr, v, dest);
+        }
+        /* fall through */
+    case kptBlockDev:
+    case kptFIFO:
+    case kptFile:
+        if (VectorLength (v) == 1)
+            return copycat_file2file (tree, logs, mgr, VectorGet (v, 0), dest, pleaf);
+
+        rc = RC (rcExe, rcDirectory, rcAccessing, rcPath, rcNotFound);
+        PLOGERR (klogFatal,
+                 (klogFatal, rc, "copying multiple files, but target argument "
+                  "[$(D)] is not a directory", "D=%s", pbuff));
+        return rc;
+    }
+
+    fprintf ( stderr, "%s: '%s': specified destination path is not a directory\n", program_name, pbuff );
+    return RC ( rcExe, rcDirectory, rcAccessing, rcPath, rcIncorrect );
+}
+/* dump
+ */
+static
+rc_t copycat_fwrite ( void *out, const void *buffer, size_t bytes )
+{
+    size_t writ = fwrite ( buffer, 1, bytes, out );
+    if ( writ != bytes )
+        return RC ( rcExe, rcFile, rcWriting, rcTransfer, rcIncomplete );
+    return 0;
+}
+
+static
+rc_t copycat_dump ( const CCTree *tree, SLList * logs )
+{
+    return CCTreeDump ( tree, copycat_fwrite, dump_out, logs );
+}
+
+static
+void param_whack (void * path, void * ignored)
+{
+    (void)VPathRelease ((const VPath*)path);
+}
+
+/* Version  EXTERN
+ *  return 4-part version code: 0xMMmmrrrr, where
+ *      MM = major release
+ *      mm = minor release
+ *    rrrr = bug-fix release
+ */
+uint32_t KAppVersion ( void )
+{
+    return COPYCAT_VERS;
+}
+
+/* KMain
+ */
+
+rc_t KMain ( int argc, char *argv [] )
+{
+    Args * args;
+    rc_t rc, orc;
+
+    KStsHandlerSetStdErr();
+    KStsLibHandlerSetStdErr();
+
+    rc = ArgsMakeAndHandle (&args, argc, argv, 1, Options, sizeof Options / sizeof (OptDef));
+    if (rc == 0)
+    {
+        /* CS-101: DO WHILE ( 0 ) LOOPS ARE CUTE FOR AVOIDING GOTO,
+           BUT IT MEANS YOU HAVE TO PUT ALL OF YOUR CLEANUP OUTSIDE
+           OF THE LOOP, IN ORDER TO BREAK OUT IN A NON-STRUCTURED WAY */
+        do
+        {
+            const char * dest;
+            const char * cache;
+            const char * extract = NULL;
+
+            uint32_t pcount;
+            CCTree * tree;
+            VFSManager * mgr = NULL;
+            VPath * dp = NULL;
+            Vector params = { NULL, 0, 0, 0};
+            uint32_t ix;
+
+            rc = ArgsProgram (args, &full_path, &program_name);
+            if (rc)
+                break;
+
+            extract_dir = false;
+            xml_dir = false;
+            memset (epath, 0, sizeof (epath));
+            ehere = epath;
+
+            rc = ArgsOptionCount (args, OPTION_CACHE, &pcount);
+            if (rc)
+                break;
+            if (pcount)
+            {
+                rc = ArgsOptionValue (args, OPTION_CACHE, 0, &cache);
+                if (rc)
+                    break;
+            }
+            else
+                cache = NULL;
+
+            rc = ArgsOptionCount (args, OPTION_DEST, &pcount);
+            if (rc)
+                break;
+            if (pcount)
+            {
+                rc = ArgsOptionValue (args, OPTION_DEST, 0, &dest);
+                if (rc)
+                    break;
+            }
+            else
+            {
+                dest = NULL;
+            }
+
+            rc = ArgsOptionCount (args, OPTION_EXTRACT, &pcount);
+            if (rc)
+                break;
+            if (pcount)
+            {
+                rc = ArgsOptionValue (args, OPTION_EXTRACT, 0, &extract);
+                if (rc)
+                    break;
+            }
+
+            rc = ArgsOptionCount (args, OPTION_EXTDIR, &pcount);
+            if (rc)
+                break;
+            extract_dir = pcount > 0;
+
+            rc = ArgsOptionCount (args, OPTION_XMLDIR, &pcount);
+            if (rc)
+                break;
+            xml_dir = pcount > 0;
+
+            rc = ArgsOptionCount (args, OPTION_FORCE, &pcount);
+            if (rc)
+                break;
+            if (pcount)
+                cm = kcmParents | kcmInit;
+
+            rc = ArgsOptionCount (args, OPTION_XMLBASE, &pcount);
+            if (pcount == 1)
+            {
+                rc = ArgsOptionValue (args, OPTION_XMLBASE, 0, &xml_base);
+                if (rc)
+                    break;
+
+                /* we might want a few more checks here... */
+                if (strchr (xml_base, '/') != NULL)
+                {
+                    rc = RC (rcExe, rcArgv, rcAccessing, rcParam, rcInvalid);
+                    break;
+                }
+            }
+
+            rc = ArgsOptionCount (args, OPTION_INBLOCK, &pcount);
+            if (pcount == 1)
+            {
+                const char * start;
+                char * end;
+                uint32_t val;
+
+                rc = ArgsOptionValue (args, OPTION_INBLOCK, 0, &start);
+                if (rc)
+                    break;
+
+                val = strtou32 (start, &end, 10);
+
+                if (*end != '\0')
+                {
+                    rc = RC (rcExe, rcArgv, rcAccessing, rcParam, rcInvalid);
+                    break;
+                }
+                in_block = val * 1024;
+            }
+
+            rc = ArgsOptionCount (args, OPTION_OUTBLOCK, &pcount);
+            if (pcount == 1)
+            {
+                const char * start;
+                char * end;
+                uint32_t val;
+
+                rc = ArgsOptionValue (args, OPTION_OUTBLOCK, 0, &start);
+                if (rc)
+                    break;
+
+                val = strtou32 (start, &end, 10);
+
+                if (*end != '\0')
+                {
+                    rc = RC (rcExe, rcArgv, rcAccessing, rcParam, rcInvalid);
+                    break;
+                }
+                out_block = val * 1024;
+            }
+
+            rc = ArgsOptionCount ( args, OPTION_NOBZIP2, & pcount );
+            if ( pcount > 0 )
+            {
+                no_bzip2 = true;
+            }
+
+            rc = ArgsOptionCount ( args, OPTION_NOMD5, & pcount );
+            if ( pcount > 0 )
+            {
+                no_md5 = true;
+            }
+
+            /* all parameters plus the possible dest option parameter */
+            rc = ArgsParamCount (args, &pcount);
+            if (rc)
+                break;
+
+            if (pcount == 0)
+            {
+                rc = RC ( rcExe, rcArgv, rcReading, rcParam, rcInsufficient );
+                MiniUsage (args);
+                break;
+            }
+
+            if ((dest == NULL) && (extract == NULL) && (pcount < 2))
+            {
+                rc = RC ( rcExe, rcArgv, rcReading, rcParam, rcInvalid );
+                if (pcount)
+                    LOGERR (klogFatal, rc, "missing source and destination arguments\n");
+                else
+                    LOGERR (klogFatal, rc, "missing destination argument[s]\n");
+                break;
+            }
+
+            VectorInit (&params, 0, 8); /* 8 is arbirary - seems long enough for no realloc */
+
+            rc = VFSManagerMake (&mgr);
+            if (rc)
+            {
+                LOGERR (klogFatal, rc,
+                        "unable to build file system manager");
+                break;
+            }
+
+            for (ix = 0; ix < pcount; ++ix)
+            {
+                VPath * kp;
+                const char * pc;
+
+                rc = ArgsParamValue (args, ix, &pc);
+                if (rc)
+                {
+                    LOGERR (klogFatal, rc, "unable to extract path parameter");
+                    break;
+                }
+
+                rc = VFSManagerMakePath (mgr, &kp, "%s", pc);
+                if (rc)
+                {
+                    LOGERR (klogFatal, rc, "unable to build path parameter");
+                    break;
+                }
+
+                rc = VectorSet (&params, ix, kp);
+                if (rc)
+                {
+                    LOGERR (klogFatal, rc, "unable to stow path parameter");
+                    break;
+                }
+            }
+            if (rc == 0)
+            {
+                if (dest)
+                {
+                    rc = VFSManagerMakePath (mgr, &dp, "%s", dest);
+                    if (rc)
+                    {
+                        LOGERR (klogFatal, rc, "unable to build dest parameter");
+                        break;
+                    }
+                }
+                DEBUG_STATUS(("%s: Create file tree\n", __func__));
+                rc = CCTreeMake (&tree);
+                if (rc)
+                {
+                    LOGERR ( klogInt, rc, "failed to create parse tree" );
+                }
+                else
+                {
+                    DEBUG_STATUS(("%s: Create cache file tree\n", __func__));
+
+                    rc = CCTreeMake (&ctree);
+                    if (rc)
+                    {
+                        LOGERR ( klogInt, rc, "failed to create cache tree" );
+                    }
+                    else
+                    {
+                        DEBUG_STATUS(("%s: Create extracted file tree\n",
+                                      __func__));
+
+                        rc = CCTreeMake (&etree);
+                        if (rc)
+                        {
+                            LOGERR ( klogInt, rc,
+                                     "failed to create extract tree" );
+                        }
+                        else
+                        {
+                            DEBUG_STATUS(("%s: Create  NULL output file\n",
+                                          __func__));
+                            rc = KFileMakeNullUpdate (&fnull);
+                            if (rc)
+                                LOGERR (klogInt, rc,
+                                        "failed to create null output");
+                            else
+                            {
+                                DEBUG_STATUS(("%s: Open File Format Tester\n",
+                                              __func__));
+
+                                rc = CCFileFormatMake ( & filefmt );
+                                if ( rc != 0 )
+                                    LOGERR (klogInt, rc,
+                                            "failed to create file format" );
+                                else
+                                {
+                                    SLList logs;
+
+                                    DEBUG_STATUS(("%s: Initialize CRC32\n",
+                                                  __func__));
+
+                                    SLListInit (&logs);
+                                    CRC32Init ();
+
+                                    DEBUG_STATUS(("%s: Copy and catalog\n",
+                                                  __func__));
+
+                                    dump_out = stdout; /* kludge */
+
+                                    rc = copycat_run (tree, &logs, mgr, cache,
+                                                      dp, extract, &params);
+                                    if ( rc == 0 )
+                                        rc = copycat_dump ( xml_dir ? etree : tree, &logs );
+                                    DEBUG_STATUS(("%s: Output XML\n", __func__));
+
+
+                                    CCFileFormatRelease ( filefmt );
+                                }
+
+                                DEBUG_STATUS(("%s: Release NULL output file\n", __func__));
+
+                                orc = KFileRelease ( fnull ), fnull = NULL;
+                                if (rc == 0)
+                                    rc = orc;
+                            } 
+                            DEBUG_STATUS(("%s: Whack extracted file tree;\n", __func__));
+                            CCTreeWhack (etree);
+                        }
+                        DEBUG_STATUS(("%s: Whack cache file tree;\n", __func__));
+                        CCTreeWhack (ctree);
+                    }
+                    DEBUG_STATUS(("%s: Whack file tree;\n", __func__));
+                    CCTreeWhack (tree);
+                }
+
+                VPathRelease (dp);
+            }
+            VFSManagerRelease (mgr);
+            VectorWhack (&params, param_whack, NULL);
+        } while (0);
+    }
+    ArgsWhack (args);
+    orc = KDirectoryRelease (cdir); /* class extren should be NULL if never used */
+    if (orc)
+    {
+        LOGERR (klogInt, rc, "Error shutting file system access");
+        if (rc == 0)
+            rc = orc;
+    }
+    DEBUG_STATUS(("%s: exit rc %R(%x);\n", __func__, rc, rc));
+    return rc;
+}
+
diff --git a/tools/copycat/copycat.vers b/tools/copycat/copycat.vers
new file mode 100644
index 0000000..8e8299d
--- /dev/null
+++ b/tools/copycat/copycat.vers
@@ -0,0 +1 @@
+2.4.2
diff --git a/tools/copycat/debug.h b/tools/copycat/debug.h
new file mode 100644
index 0000000..b47d440
--- /dev/null
+++ b/tools/copycat/debug.h
@@ -0,0 +1,75 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+
+
+#ifndef _h_copycat_debug_
+#define _h_copycat_debug_
+
+#include <klib/debug.h>
+
+#ifndef _h_kfs_impl_
+#include <kfs/impl.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define DEBUG_MSG_PASTE(a,b) a##b
+#define DEBUG_MSG(flag,msg) DBGMSG(DBG_APP,DBG_FLAG(DEBUG_MSG_PASTE(DBG_APP_,flag)), msg)
+#define DEBUG_ENTRY() DEBUG_MSG(10,("Enter: %s\n", __func__))
+
+/*--------------------------------------------------------------------------
+ * application debug stuff
+ */
+
+/* redefine some application flags to be more specialized rather than just numbers */
+#define DBG_CC          DBG_APP
+#define DBG_CC_FILE     DBG_APP_1
+#define DBG_CC_CCTREE   DBG_APP_2
+
+#define DBG_KFILE(msg)  DBGMSG (DBG_CC, DBG_FLAG(DBG_CC_FILE), msg)
+
+#if _DEBUGGING
+#define DBG_KFile(p)    \
+    { DBG_KFILE(("%s: KFile * %p\n", __func__, (p)));   \
+        if (p) { \
+            DBG_KFILE(("  vt:            %p\n",(p)->vt)); \
+            DBG_KFILE(("  dir:            %p\n",(p)->dir)); \
+            DBG_KFILE(("  ref:           %u\n",*(unsigned*)&(p)->refcount));  \
+            DBG_KFILE(("  read_enabled:  %u\n",*(unsigned*)&(p)->read_enabled)); \
+            DBG_KFILE(("  write_enabled: %u\n",*(unsigned*)&(p)->write_enabled));}}
+#else
+#define DBG_KFile(p) 
+#endif
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _h_copycat_debug_ */
diff --git a/tools/deseq/Makefile b/tools/deseq/Makefile
new file mode 100644
index 0000000..01614da
--- /dev/null
+++ b/tools/deseq/Makefile
@@ -0,0 +1,102 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: std
+
+TOP ?= $(abspath ../..)
+MODULE = tools/deseq
+
+include $(TOP)/build/Makefile.env
+
+INT_TOOLS =
+
+EXT_TOOLS = \
+	csra-trim
+
+ALL_TOOLS = \
+	$(INT_TOOLS) \
+	$(EXT_TOOLS)
+
+#-------------------------------------------------------------------------------
+# outer targets
+#
+all std: vers-includes
+	@ $(MAKE_CMD) $(TARGDIR)/std
+
+$(ALL_TOOLS): vers-includes
+	@ $(MAKE_CMD) $(BINDIR)/$@
+
+.PHONY: all std $(ALL_TOOLS)
+
+#-------------------------------------------------------------------------------
+# std
+#
+$(TARGDIR)/std: \
+	$(addprefix $(BINDIR)/,$(ALL_TOOLS))
+
+.PHONY: $(TARGDIR)/std
+
+#-------------------------------------------------------------------------------
+# vers-includes
+#
+$(TARGDIR)/vers-includes: $(addsuffix .vers.h,$(EXT_TOOLS))
+
+.PHONY: $(TARGDIR)/vers-includes
+
+#-------------------------------------------------------------------------------
+# clean
+#
+clean: stdclean
+
+.PHONY: clean
+
+#-------------------------------------------------------------------------------
+# align-info
+#
+CSRA_TRIM_SRC = \
+	deseq
+
+CSRA_TRIM_OBJ = \
+	$(addsuffix .$(OBJX),$(CSRA_TRIM_SRC))
+
+CSRA_TRIM_LIB = \
+	-lkapp \
+	-lalign-reader \
+	-lwvdb \
+	-lwkdb \
+	$(UPDATE_SCHEMA_LIBS) \
+	-lksrch \
+	-lkproc \
+	-lvfs \
+	-lkrypto \
+	-lkfg \
+	-lkfs \
+	-lklib \
+	-lm
+
+
+$(BINDIR)/csra-trim: $(CSRA_TRIM_OBJ)
+	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(CSRA_TRIM_LIB)
+
diff --git a/tools/deseq/csra-trim.vers b/tools/deseq/csra-trim.vers
new file mode 100644
index 0000000..8e8299d
--- /dev/null
+++ b/tools/deseq/csra-trim.vers
@@ -0,0 +1 @@
+2.4.2
diff --git a/tools/deseq/deseq.c b/tools/deseq/deseq.c
new file mode 100644
index 0000000..b59b6bf
--- /dev/null
+++ b/tools/deseq/deseq.c
@@ -0,0 +1,521 @@
+/*==============================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ *==============================================================================
+ */
+
+#include "csra-trim.vers.h"
+
+#include <vdb/manager.h> /* VDBManager */
+#include <vdb/database.h> /* VDatabase */
+#include <vdb/table.h> /* VTable */
+#include <vdb/schema.h> /* VSchema */
+#include <vdb/cursor.h> /* VCursor */
+
+#include <kdb/meta.h>
+
+#include <kapp/main.h>
+
+#include <klib/out.h> /* OUTMSG */
+#include <klib/log.h> /* (void)LOGERR */
+#include <klib/debug.h> /* DBGMSG */
+#include <klib/rc.h> /* RC */
+
+#include <assert.h>
+#include <stdlib.h> /* free */
+#include <string.h> /* strcmp */
+
+struct Params {
+    char const *dbPath;
+    char const *output;
+    bool exclude_secondary;
+} static Params;
+
+typedef struct ColumnInfo_s {
+    char const *col;
+    char const *src;
+    int group;
+} ColumnInfo_t;
+
+static ColumnInfo_t const priCol[] = {
+    /* these columns are independent and are physical copies */
+    { "SEQ_READ_ID"     , NULL, 0 },
+    { "GLOBAL_REF_START", NULL, 0 },
+    { "REF_ORIENTATION" , NULL, 0 },
+    { "MAPQ"            , NULL, 0 },
+
+    /* these columns are pulled in from SEQUENCE */
+    { "SEQ_SPOT_ID"  , NULL, 1 },
+    { "SPOT_GROUP"   , NULL, 1 },
+    { "MATE_ALIGN_ID", NULL, 1 },
+    { "READ_FILTER"  , NULL, 1 },
+
+    /* these columns all rely on clipping */
+    { "(bool)HAS_REF_OFFSET", "(bool)CLIPPED_HAS_REF_OFFSET", 2 },
+    { "(bool)HAS_MISMATCH"  , "(bool)CLIPPED_HAS_MISMATCH"  , 2 },
+    { "REF_OFFSET"          , "CLIPPED_REF_OFFSET"          , 2 },
+    { "MISMATCH"            , "CLIPPED_MISMATCH"            , 2 },
+    { "CMP_QUALITY"         , "CMP_QUALITY"                 , 2 },
+    
+    { NULL, NULL, 0 }
+};
+
+static ColumnInfo_t const secCol[] = {
+    /* these columns are independent and are physical copies */
+    { "SEQ_READ_ID"         , NULL, 0 },
+    { "GLOBAL_REF_START"    , NULL, 0 },
+    { "REF_ORIENTATION"     , NULL, 0 },
+    { "MAPQ"                , NULL, 0 },
+    { "PRIMARY_ALIGNMENT_ID", NULL, 0 },
+    
+    /* these columns are pulled in from SEQUENCE */
+    { "SEQ_SPOT_ID"  , NULL, 1 },
+    { "SPOT_GROUP"   , NULL, 1 },
+    { "MATE_ALIGN_ID", NULL, 1 },
+    { "READ_FILTER"  , NULL, 1 },
+    
+    /* these columns all rely on clipping */
+    { "(bool)HAS_REF_OFFSET", "(bool)CLIPPED_HAS_REF_OFFSET", 2 },
+    { "(bool)HAS_MISMATCH"  , "(bool)CLIPPED_HAS_MISMATCH"  , 2 },
+    { "REF_OFFSET"          , "CLIPPED_REF_OFFSET"          , 2 },
+    { "MISMATCH"            , "CLIPPED_MISMATCH"            , 2 },
+    { "CMP_QUALITY"         , "CMP_QUALITY"                 , 2 },
+    
+    { NULL, NULL, 0 }
+};
+
+
+static ColumnInfo_t const refCol[] = {
+    /* these columns are independent and are physical copies */
+    { "MAX_SEQ_LEN"             , NULL, 0 },
+    { "NAME"                    , NULL, 0 },
+    { "(INSDC:dna:text)CS_KEY"  , NULL, 0 },
+    { "(INSDC:dna:text)CMP_READ", NULL, 0 },
+    { "SEQ_ID"                  , NULL, 0 },
+    { "SEQ_START"               , NULL, 0 },
+    { "SEQ_LEN"                 , NULL, 0 },
+    { "CIRCULAR"                , NULL, 0 },
+    { "CGRAPH_HIGH"             , NULL, 0 },
+    { "CGRAPH_LOW"              , NULL, 0 },
+    { "CGRAPH_MISMATCHES"       , NULL, 0 },
+    { "CGRAPH_INDELS"           , NULL, 0 },
+    { "PRIMARY_ALIGNMENT_IDS"   , NULL, 0 },
+    { "SECONDARY_ALIGNMENT_IDS" , NULL, 0 },
+    { "(bool)PRESERVE_QUAL"     , NULL, 0 },
+    { NULL, NULL, 0 },
+};    
+
+static rc_t CopyCursor(VCursor *dst, uint32_t const dcid[],
+                       VCursor const *src, uint32_t const scid[], unsigned n)
+{
+    rc_t rc;
+    bool done = false;
+    
+    do {
+        rc_t rc2;
+        
+        rc = VCursorOpenRow(dst);
+        while (rc == 0) {
+            unsigned i;
+            int64_t row;
+            
+            rc = VCursorRowId(dst, &row); if (rc) break;
+            for (i = 0; i != n && rc == 0; ++i) {
+                uint32_t elem_bits;
+                void const *data;
+                uint32_t offset;
+                uint32_t rowlen;
+                
+                rc = VCursorCellDataDirect(src, row, scid[i], &elem_bits, &data, &offset, &rowlen);
+                if (GetRCObject(rc) == rcRow && GetRCState(rc) == rcNotFound && i == 0) {
+                    rc = 0;
+                    done = true;
+                    break;
+                }
+                if (rc) break;
+                rc = VCursorWrite(dst, dcid[i], elem_bits, data, offset, rowlen); if (rc) break;
+            }
+            break;
+        }
+        if (rc == 0 && !done) {
+            rc = VCursorCommitRow(dst);
+        }
+        rc2 = VCursorCloseRow(dst); if (rc == 0) rc = rc2;
+    } while (!done && rc == 0 && (rc = Quitting()) == 0);
+    if (rc == 0)
+        rc = VCursorCommit(dst);
+    return rc;
+}
+
+static rc_t CopyTable(VDatabase *dst, VDatabase const *src,
+                      char const tblName[], ColumnInfo_t const col[],
+                      bool required)
+{
+    uint32_t scid[64];
+    uint32_t dcid[64];
+    VTable const *stbl;
+    rc_t rc = VDatabaseOpenTableRead(src, &stbl, "%s", tblName);
+    
+    if (rc == 0) {
+        VTable *dtbl;
+        
+        rc = VDatabaseCreateTable(dst, &dtbl, tblName, kcmCreate, "%s", tblName);
+        if (rc == 0) {
+            unsigned i = 0;
+            bool done = false;
+            
+            rc = VTableColumnCreateParams(dtbl, kcmCreate, kcsCRC32, 0);
+            while (rc == 0 && !done && col[i].col) {
+                unsigned n = 1;
+                unsigned k;
+                int group = col[i].group;
+                VCursor const *scurs;
+                
+                if (group != 0) while (col[i + n].col && col[i + n].group == group) ++n;
+                rc = VTableCreateCursorRead(stbl, &scurs);
+                if (rc) {
+                    (void)PLOGERR(klogErr, (klogErr, rc, "Failed to create read cursor", ""));
+                    done = true;
+                }
+                else {
+                    VCursor *dcurs;
+                    
+                    rc = VTableCreateCursorWrite(dtbl, &dcurs, kcmInsert);
+                    if (rc) {
+                        (void)PLOGERR(klogErr, (klogErr, rc, "Failed to create write cursor", ""));
+                        done = true;
+                    }
+                    else {
+                        for (k = 0; k != n; ++k) {
+                            char const *dcol = col[i + k].col;
+                            char const *scol = col[i + k].src;
+                            
+                            if (scol == NULL) scol = dcol;
+                            (void)PLOGMSG(klogInfo, (klogInfo, "Copying column '$(col)' of table '$(tbl)'", "col=%s,tbl=%s", dcol, tblName));
+                            rc = VCursorAddColumn(scurs, &scid[k], "%s", scol);
+                            if (rc) {
+                                (void)PLOGERR(klogErr, (klogErr, rc, "Failed to add column to read cursor", ""));
+                                done = true;
+                                break;
+                            }
+                            rc = VCursorAddColumn(dcurs, &dcid[k], "%s", dcol);
+                            if (rc) {
+                                (void)PLOGERR(klogErr, (klogErr, rc, "Failed to add column to write cursor", ""));
+                                done = true;
+                                break;
+                            }
+                        }
+                        if (rc == 0) {
+                            rc = VCursorOpen(scurs);
+                            if (rc) {
+                                (void)PLOGERR(klogErr, (klogErr, rc, "Failed to open read cursor", ""));
+                                done = true;
+                            }
+                            else {
+                                rc = VCursorOpen(dcurs);
+                                if (rc) {
+                                    (void)PLOGERR(klogErr, (klogErr, rc, "Failed to open write cursor", ""));
+                                    done = true;
+                                }
+                                else
+                                    rc = CopyCursor(dcurs, dcid, scurs, scid, n);
+                            }
+                        }
+                    }
+                    VCursorRelease(dcurs);
+                }
+                VCursorRelease(scurs);
+                i += n;
+            }
+            if (rc == 0)
+                VTableReindex(dtbl);
+            VTableRelease(dtbl);
+        }
+        VTableRelease(stbl);
+    }
+    else if (!required) {
+        /*
+        (void)PLOGERR(klogInfo, (klogInfo, rc, "Failed to open optional table '$(tbl)'", "tbl=%s", tblName));
+         */
+        rc = 0;
+    }
+    else {
+        (void)PLOGERR(klogErr, (klogErr, rc, "Failed to open required table '$(tbl)'", "tbl=%s", tblName));
+    }
+
+    return rc;
+}
+
+static rc_t OpenDatabases(VDatabase **dst, VDatabase const **src)
+{
+    VDBManager *vdb;
+    rc_t rc = VDBManagerMakeUpdate(&vdb, NULL);
+
+    if (rc == 0) {
+        VSchema *schema;
+        
+        rc = VDBManagerMakeSchema(vdb, &schema);
+        if (rc == 0) {
+            rc = VSchemaParseFile(schema, "align/align.vschema");
+            if (rc == 0) {
+                rc = VDBManagerOpenDBRead(vdb, src, NULL, "%s", Params.dbPath);
+                if (rc == 0) {
+                    rc = VDBManagerCreateDB(vdb, dst, schema,
+                                            "NCBI:align:db:alignment_sorted",
+                                            kcmInit + kcmMD5, "%s", Params.output);
+                    if (rc == 0)
+                        rc = VDatabaseColumnCreateParams(*dst, kcmInit, kcmMD5, 0);
+                    if (rc)
+                        (void)PLOGERR(klogErr, (klogErr, rc, "Failed to create output '$(outname)'", "outname=%s", Params.output));
+                }
+                else
+                    (void)PLOGERR(klogErr, (klogErr, rc, "Failed to open input '$(inname)'", "inname=%s", Params.dbPath));
+            }
+            else
+                (void)PLOGERR(klogErr, (klogErr, rc, "Failed to load schema", ""));
+            VSchemaRelease(schema);
+        }
+        else
+            (void)PLOGERR(klogErr, (klogErr, rc, "Failed to create schema", ""));
+        VDBManagerRelease(vdb);
+    }
+    else
+        (void)PLOGERR(klogErr, (klogErr, rc, "Failed to create manager", ""));
+    return rc;
+}
+
+static rc_t ReadMeta(VDatabase const *src, char const name[], void **value, size_t *size)
+{
+    KMetadata const *meta;
+    rc_t rc = VDatabaseOpenMetadataRead(src, &meta);
+
+    *value = NULL;
+    *size = 0;
+    if (rc == 0) {
+        KMDataNode const *node;
+        
+        rc = KMetadataOpenNodeRead(meta, &node, "%s", name);
+        KMetadataRelease(meta);
+        if (rc == 0) {
+            char dummy;
+            size_t remain;
+            void *buf;
+            size_t bsize;
+            
+            KMDataNodeRead(node, 0, &dummy, 0, &bsize, &remain);
+            if (remain == 0) {
+                (void)LOGMSG(klogErr, "Failed to read metadata");
+                rc = RC(rcApp, rcMetadata, rcReading, rcData, rcNotFound);
+            }
+            else {
+                buf = malloc(remain);
+                if (buf) {
+                    rc = KMDataNodeRead(node, 0, buf, remain, &bsize, &remain);
+                    if (rc == 0) {
+                        *value = buf;
+                        *size = bsize;
+                    }
+                    else
+                        (void)PLOGERR(klogErr, (klogErr, rc, "Failed to read metadata", ""));
+                }
+                else {
+                    rc = RC(rcApp, rcMetadata, rcReading, rcMemory, rcExhausted);
+                    (void)PLOGERR(klogErr, (klogErr, rc, "Failed to read metadata", ""));
+                }
+            }
+            KMDataNodeRelease(node);
+        }
+        else
+            (void)PLOGERR(klogErr, (klogErr, rc, "Failed to load metadata", ""));
+    }
+    else
+        (void)PLOGERR(klogErr, (klogErr, rc, "Failed to load metadata", ""));
+    return rc;
+}
+
+static rc_t WriteMeta(VDatabase *dst, char const name[], void *value, size_t size)
+{
+    KMetadata *meta;
+    rc_t rc = VDatabaseOpenMetadataUpdate(dst, &meta);
+    
+    if (rc == 0) {
+        KMDataNode *node;
+        
+        rc = KMetadataOpenNodeUpdate(meta, &node, "%s", name);
+        KMetadataRelease(meta);
+        if (rc == 0) {
+            rc = KMDataNodeWrite(node, value, size);
+            KMDataNodeRelease(node);
+        }
+    }
+    if (rc)
+        (void)PLOGERR(klogErr, (klogErr, rc, "Failed to write metadata", ""));
+    return rc;
+}
+
+static rc_t CopyBAMHeader(VDatabase *dst, VDatabase const *src)
+{
+    void *header;
+    size_t hsize;
+    rc_t rc = ReadMeta(src, "BAM_HEADER", &header, &hsize);
+    
+    if (rc == 0)
+        rc = WriteMeta(dst, "BAM_HEADER", header, hsize);
+    if (header) free(header);
+    return rc;
+}
+
+static rc_t run(void)
+{
+    VDatabase *dst = NULL;
+    VDatabase const *src = NULL;
+    rc_t rc = OpenDatabases(&dst, &src);
+
+    while (rc == 0) {
+        rc = CopyBAMHeader(dst, src); if (rc) break;
+        rc = CopyTable(dst, src, "REFERENCE", refCol, true); if (rc) break;
+        rc = CopyTable(dst, src, "PRIMARY_ALIGNMENT", priCol, true); if (rc) break;
+        if (!Params.exclude_secondary)
+            rc = CopyTable(dst, src, "SECONDARY_ALIGNMENT", secCol, false); break;
+        break;
+    }
+    VDatabaseRelease(dst);
+    VDatabaseRelease(src);
+    return rc;
+}
+
+static const char* usage_output[] = { "path of output database", NULL };
+static const char* usage_exclude[] = { "exclude secondary alignments", NULL };
+
+static const char* param_usage[] = { "Path to the database" };
+
+OptDef Options[] =
+{
+    { "output", "o", NULL, usage_output, 1, true, true },
+    { "exclude-secondary", "x", NULL, usage_exclude, 1, false, false }
+};
+
+rc_t CC UsageSummary (const char * progname) {
+    return KOutMsg (
+"Usage:\n"
+"  %s [options] <db-path>\n"
+"\n"
+"Summary:\n"
+"  Creates an analysis alignment database from an archive alignment database\n"
+"  by flattening and removing sequence data.\n"
+, progname);
+ }
+
+rc_t CC Usage(const Args* args) { 
+    rc_t rc = 0 ;
+
+    const char* progname = UsageDefaultName;
+    const char* fullpath = UsageDefaultName;
+
+    if (args == NULL)
+    {    rc = RC(rcApp, rcArgv, rcAccessing, rcSelf, rcNull); }
+    else
+    {    rc = ArgsProgram(args, &fullpath, &progname); }
+
+    UsageSummary(progname);
+
+    KOutMsg("Parameters:\n");
+
+    HelpParamLine ("db-path", param_usage);
+
+    KOutMsg ("\nOptions:\n");
+
+    HelpOptionLine ("o", "output", NULL, usage_output);
+
+    HelpOptionsStandard ();
+
+    HelpVersion (fullpath, KAppVersion());
+
+    return rc;
+}
+
+const char UsageDefaultName[] = "csra-trim";
+
+ver_t CC KAppVersion(void) { return CSRA_TRIM_VERS; }
+
+rc_t CC KMain(int argc, char* argv[]) {
+    rc_t rc = 0;
+    Args* args = NULL;
+
+    do {
+        uint32_t pcount = 0;
+
+        rc = ArgsMakeAndHandle(&args, argc, argv, 1,
+            Options, sizeof Options / sizeof (OptDef));
+        if (rc) {
+            (void)LOGERR(klogErr, rc, "While calling ArgsMakeAndHandle");
+            break;
+        }
+        rc = ArgsParamCount(args, &pcount);
+        if (rc) {
+            (void)LOGERR(klogErr, rc, "Failure parsing database name");
+            break;
+        }
+        if (pcount < 1) {
+            rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcInsufficient);
+            MiniUsage(args);
+            break;
+        }
+        if (pcount > 1) {
+            rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcAmbiguous);
+            (void)LOGERR(klogErr, rc, "Too many database parameters");
+            break;
+        }
+        rc = ArgsParamValue(args, 0, &Params.dbPath);
+        if (rc) {
+            (void)LOGERR(klogErr, rc, "Failure retrieving database name");
+            break;
+        }
+
+        rc = ArgsOptionCount (args, "output", &pcount);
+        if (rc) {
+            (void)LOGERR(klogErr, rc, "Failure to get 'output' argument");
+            break;
+        }
+        if (pcount > 1) {
+            rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcAmbiguous);
+            (void)LOGERR(klogErr, rc, "Too many output parameters");
+            break;
+        }
+        rc = ArgsOptionValue(args, "output", 0, &Params.output);
+        if (rc) {
+            (void)LOGERR(klogErr, rc, "Failure retrieving output name");
+            break;
+        }
+        
+        rc = ArgsOptionCount (args, "exclude-secondary", &pcount);
+        if (rc) {
+            (void)LOGERR(klogErr, rc, "Failure to get 'exclude-secondary' argument");
+            break;
+        }
+        Params.exclude_secondary = pcount > 0;
+    } while (false);
+
+    rc = rc ? rc : run();
+    ArgsRelease(args);
+    return rc;
+}
diff --git a/tools/fastq-dump/Makefile b/tools/fastq-dump/Makefile
new file mode 100644
index 0000000..1c84544
--- /dev/null
+++ b/tools/fastq-dump/Makefile
@@ -0,0 +1,106 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: std
+
+TOP ?= $(abspath ../..)
+
+
+MODULE = tools/fastq-dump
+
+include $(TOP)/build/Makefile.env
+
+ALL_TOOLS = \
+	fastq-dump \
+
+#-------------------------------------------------------------------------------
+# outer targets
+#
+all std: vers-includes
+	@ $(MAKE_CMD) $(TARGDIR)/std
+
+$(ALL_TOOLS): vers-includes
+	@ $(MAKE_CMD) $(BINDIR)/$@
+
+.PHONY: all std $(ALL_TOOLS)
+
+#-------------------------------------------------------------------------------
+# std
+#
+$(TARGDIR)/std: \
+	$(addprefix $(BINDIR)/,$(ALL_TOOLS))
+
+.PHONY: $(TARGDIR)/std
+
+#-------------------------------------------------------------------------------
+# vers-includes
+#
+$(TARGDIR)/vers-includes: $(addsuffix .vers.h,$(EXT_TOOLS))
+
+.PHONY: $(TARGDIR)/vers-includes
+
+#-------------------------------------------------------------------------------
+# clean
+#
+clean: stdclean
+
+.PHONY: clean
+
+#-------------------------------------------------------------------------------
+# Common dumper definitions
+#
+DUMP_LIBS = \
+	-lngs-c++-ncbi \
+	-lngs-sdk-ncbi \
+	-lncbi-vdb \
+	-lkapp
+
+DUMP_LIBS = \
+	-L$(LIBDIR)       \
+	-L$(VDB_LIBDIR)   \
+	~/ngs-sdk/x86_64/lib  \
+	-lngs-c++         \
+	-lncbi-ngs-c++    \
+	-lncbi-vdb-static \
+	-lkapp \
+	-lpthread         \
+	-ldl              \
+	-lm
+
+#-------------------------------------------------------------------------------
+# fastq-dump
+#
+FASTQ_DUMP_SRC = \
+	args    \
+	filters \
+	fastq-dump
+
+INCDIRS += -I $(TOP)/ngs/ngs-c++
+
+FASTQ_DUMP_OBJ = \
+	$(addsuffix .$(OBJX),$(FASTQ_DUMP_SRC))
+
+$(BINDIR)/fastq-dump: $(FASTQ_DUMP_OBJ)
+	$(LP) --exe --vers $(SRCDIR) -o $@ $^ $(DUMP_LIBS)
diff --git a/tools/fastq-dump/args.cpp b/tools/fastq-dump/args.cpp
new file mode 100644
index 0000000..eadbc89
--- /dev/null
+++ b/tools/fastq-dump/args.cpp
@@ -0,0 +1,622 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <sysalloc.h>
+
+#ifndef _h_klib_defs_
+#include <klib/defs.h>
+#endif
+
+#include <sstream>
+
+#include <kapp/args.h>
+#include <kapp/main.h>
+
+#include <string.h>
+
+#include "args.hpp"
+
+using namespace ngs;
+
+/*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*/
+/* AOptDef empementation                                       */
+/*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*/
+AOptDef :: AOptDef ()
+{
+    reset ();
+}   /* AOptDef :: AOptDef () */
+
+AOptDef :: AOptDef ( const AOptDef & OptDef )
+{
+    reset ( OptDef );
+}   /* AOptDef :: AOptDef () */
+
+AOptDef :: ~AOptDef ()
+{
+    reset ();
+}   /* AOptDef :: ~AOptDef () */
+
+AOptDef &
+AOptDef :: operator = ( const AOptDef & OptDef )
+{
+    if ( this != & OptDef ) {
+        reset ( OptDef );
+    }
+
+    return * this;
+}   /* AOptDef :: AOptDef () */
+
+void
+AOptDef :: reset ()
+{
+    _M_name . clear ();
+    _M_aliases . clear ();
+    _M_param . clear ();
+    _M_hlp . clear ();
+    _M_max_count = 0;
+    _M_need_value = true;
+    _M_required = true;
+}   /* AOptDef :: reset () */
+
+void
+AOptDef :: reset ( const AOptDef & OptDef )
+{
+    _M_name = OptDef . _M_name;
+    _M_aliases = OptDef . _M_aliases;
+    _M_param = OptDef . _M_param;
+    _M_hlp = OptDef . _M_hlp;
+    _M_max_count = OptDef . _M_max_count;
+    _M_need_value = OptDef . _M_need_value;
+    _M_required = OptDef . _M_required;
+}   /* AOptDef :: reset () */
+
+bool
+AOptDef :: good () const
+{
+    return ! _M_name . empty ();
+}   /* AOptDef :: good () */
+
+/*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*/
+/* AOPBase impementation                                       */
+/*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*/
+AOPBase :: AOPBase ()
+:   _M_exist ( false )
+{
+    reset ();
+}   /* AOPBase () */
+
+AOPBase :: ~AOPBase ()
+{
+    reset ();
+}   /* AOPBase :: ~AOPBase () */
+
+void
+AOPBase :: reset ( const String & , Args * , bool )
+{
+    throw ErrorMsg ( "reset: Unimpemented method" );
+}   /* AOPBase :: reset () */
+
+void
+AOPBase :: reset ()
+{
+    _M_exist = false;
+    _M_name . clear ();
+    _M_val . clear ();
+}   /* AOPBase :: reset () */
+
+void
+AOPBase :: reset ( const AOPBase & Bse )
+{
+    reset ();
+
+    _M_val = Bse . _M_val;
+    _M_name = Bse . _M_name;
+    _M_exist = Bse . _M_exist;
+}   /* AOPBase :: reset () */
+
+uint32_t
+AOPBase :: valCount () const
+{
+/* Not sure about it !!!
+    if ( ! exist () ) {
+        throw ErrorMsg ( "valCount: Value not exits" );
+    }
+
+    return _M_val . size ();
+*/
+
+    return exist () ? _M_val . size () : 0;
+}   /* AOPBase :: valCount () */
+
+const String &
+AOPBase :: val ( uint32_t idx ) const
+{
+    uint32_t cnt = valCount ();
+
+    if ( cnt <= idx ) {
+        throw ErrorMsg ( "val: Invalid index" );
+    }
+
+    return _M_val [ idx ];
+}   /* AOPBase :: val () */
+
+static
+void CC
+__handle_error ( const char * arg, void * data )
+{
+    std :: stringstream str;
+    str << "Can not convert \"" << arg << "\" to int for paramter \"" << ( char * ) data << "\"";
+    throw ErrorMsg ( str . str () );
+}   /* __handle_error () */
+
+uint32_t
+AOPBase :: uint32Val ( uint32_t idx ) const
+{
+    return AsciiToU32 (
+                    val ( idx ) . c_str (),
+                    __handle_error,
+                    ( void * ) _M_name . c_str ()
+                    );
+}   /* AOPBase :: uint32Val () */
+
+int32_t
+AOPBase :: int32Val ( uint32_t idx ) const
+{
+    return AsciiToI32 (
+                    val ( idx ) . c_str (),
+                    __handle_error,
+                    ( void * ) _M_name . c_str ()
+                    );
+}   /* AOPBase :: int32Val () */
+
+uint64_t
+AOPBase :: uint64Val ( uint32_t idx ) const 
+{
+    return AsciiToU64 (
+                    val ( idx ) . c_str (),
+                    __handle_error,
+                    ( void * ) _M_name . c_str ()
+                    );
+}   /* AOPBase :: uint64Val () */
+
+int64_t
+AOPBase :: int64Val ( uint32_t idx ) const
+{
+    return AsciiToI64 (
+                    val ( idx ) . c_str (),
+                    __handle_error,
+                    ( void * ) _M_name . c_str ()
+                    );
+}   /* AOPBase :: int64Val () */
+
+/*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*/
+/* AOptVal impementation                                       */
+/*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*/
+AOptVal :: AOptVal ()
+:   AOPBase ()
+{
+}   /* AOptVal :: AOptVal () */
+
+AOptVal :: AOptVal ( const AOptVal & Val )
+:   AOPBase ()
+{
+    AOPBase :: reset ( Val );
+}   /* AOptVal :: AOptVal () */
+
+AOptVal &
+AOptVal :: operator = ( const AOptVal & Val )
+{
+    if ( this != & Val ) {
+        AOPBase :: reset ( Val );
+    }
+
+    return * this;
+}   /* AOptVal :: operator = () */
+
+void
+AOptVal :: reset ( const String & Name, Args * TheArgs, bool needValue )
+{
+    AOPBase :: reset ();
+
+    if ( TheArgs == NULL ) {
+        throw ErrorMsg ( "reset: NULL args passed" );
+    }
+
+    if ( Name . empty () ) {
+        throw ErrorMsg ( "reset: Empty name passed" );
+    }
+
+    uint32_t count = 0;
+    if ( ArgsOptionCount ( TheArgs, Name . c_str (), & count ) != 0 ) {
+        throw ErrorMsg ( String ( "reset: Can not get count for option \"" ) + Name + "\"" );
+    }
+
+    if ( count == 0 ) {
+        return;
+    }
+
+    _M_val . resize ( count );
+    if ( needValue ) {
+        for ( uint32_t i = 0; i < count; i ++ ) {
+            const char * val = NULL;
+            if ( ArgsOptionValue ( TheArgs, Name . c_str (), i, & val ) != 0 ) {
+                std :: stringstream Vsg;
+                Vsg << "reset: Can not get value for option \"" << Name;
+                Vsg << "\" in series " << i;
+                throw ErrorMsg ( Vsg . str () );
+            }
+
+            _M_val [ i ] = val == NULL ? "" : val;
+        }
+    }
+
+    _M_name = Name;
+    _M_exist = true;
+}   /* AOptVal :: reset () */
+
+/*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*/
+/* AParVal impementation                                       */
+/*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*/
+AParVal :: AParVal ()
+:   AOPBase ()
+{
+}   /* AParVal :: AParVal () */
+
+AParVal :: AParVal ( const AParVal & Val )
+:   AOPBase ()
+{
+    AOPBase :: reset ( Val );
+}   /* AParVal :: AParVal () */
+
+AParVal &
+AParVal :: operator = ( const AParVal & Val )
+{
+    if ( this != & Val ) {
+        AOPBase :: reset ( Val );
+    }
+
+    return * this;
+}   /* AParVal :: operator = () */
+
+void
+AParVal :: reset ( const String & Name, Args * TheArgs, bool )
+{
+    AOPBase :: reset ();
+
+    if ( TheArgs == NULL ) {
+        throw ErrorMsg ( "reset: NULL args passed" );
+    }
+
+    uint32_t count = 0;
+    if ( ArgsParamCount ( TheArgs, & count ) != 0 ) {
+        throw ErrorMsg ( "reset: Can not get count for parameters" );
+    }
+
+    if ( count == 0 ) {
+        return;
+    }
+
+    _M_val . resize ( count );
+    for ( uint32_t i = 0; i < count; i ++ ) {
+        const char * val = NULL;
+        if ( ArgsParamValue ( TheArgs, i, & val ) != 0 ) {
+            std :: stringstream Vsg;
+            Vsg << "reset: Can not get parameter in series " << i;
+            throw ErrorMsg ( Vsg . str () );
+        }
+
+        _M_val [ i ] = val;
+    }
+
+    _M_name = Name;
+    _M_exist = true;
+}   /* AParVal :: reset () */
+
+/*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*/
+/* AArgs impementation                                         */
+/*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*/
+AArgs :: MArgs AArgs :: _sM_args;
+
+AArgs :: AArgs ()
+:   _M_args ( NULL )
+,   _M_standards_added ( false )
+,   _M_progName ( "" )
+{
+}   /* AArgs :: AArgs () */
+
+AArgs :: ~AArgs ()
+{
+    /* We are not disposing Arguments, it should be done manually */
+}   /* AArgs :: ~AArgs () */
+
+void
+AArgs :: init ( bool AddStandardOrguments )
+{
+    if ( good () ) {
+        throw ErrorMsg ( "AArgs: We are good" );
+    }
+
+    Args * TempArgs;
+    if ( ArgsMake ( & TempArgs ) != 0 ) {
+        throw ErrorMsg ( "AArgs: Can not make Args" );
+    }
+
+    if ( TempArgs == NULL ) {
+        throw ErrorMsg ( "AArgs: Can not allocate Args" );
+    }
+
+    if ( AddStandardOrguments ) {
+        try {
+            __addStdOpts ( TempArgs );
+            _M_standards_added = true;
+        }
+        catch ( ... ) {
+            __disposeArgs ( TempArgs );
+
+            throw;
+        }
+    }
+
+    _M_args = TempArgs;
+
+    try {
+        __customInit ();
+    }
+    catch ( ... ) {
+        __disposeArgs ( _M_args );
+
+        _M_args = NULL;
+
+        throw;
+    }
+
+    __regArgs ( _M_args, this );
+
+}   /* AArgs :: init () */
+
+void
+AArgs :: __customInit ()
+{
+}   /* AArgs :: __customInit () */
+
+void
+AArgs :: dispose ()
+{
+    if ( good () ) {
+        __customDispose ();
+
+        Args * TheArgs = _M_args;
+        _M_args = NULL;
+
+        _M_optDefs . clear ();
+        _M_standards_added = false;
+
+        __deregArgs ( TheArgs );
+        __disposeArgs ( TheArgs );
+
+        _M_progName . clear ();
+    }
+}   /* AArgs :: dispose () */
+
+void 
+AArgs :: __customDispose () 
+{
+}   /* AArgs :: __customDispose () */
+
+void 
+AArgs :: __disposeArgs ( Args * TheArgs )
+{
+    if ( TheArgs != NULL ) {
+        ArgsWhack ( TheArgs );
+    }
+}   /* AArgs :: __disposeArgs () */
+
+void
+AArgs :: addStdOpts ()
+{
+    if ( ! good () ) {
+        throw ErrorMsg ( "addStdOpts: Not good" );
+    }
+
+    try {
+        __addStdOpts ( _M_args );
+    }
+    catch ( ... ) {
+        dispose ();
+
+        throw;
+    }
+}   /* AArgs :: addStdOpts () */
+
+static
+void
+__toOpt ( const struct AOptDef & In, OptDef & Out )
+{
+    if ( ! In . good () ) {
+        throw ErrorMsg ( "__toOpt: IN is not good" );
+    }
+
+    memset ( & Out, 0, sizeof ( OptDef ) );
+
+    Out . name = In . getName ();
+    Out . aliases = In . getAliases ();
+    const char * Hlp = In . getHlp ();
+    Out . help = & Hlp;
+    Out . max_count = In . maxCount ();
+    Out . needs_value = In . needValue ();
+    Out . required = In . required ();
+}   /* __toOpt () */
+
+void
+AArgs :: addOpt ( const struct AOptDef & Opt )
+{
+    if ( ! good () ) {
+        throw ErrorMsg ( "addOpt: Not good " );
+    }
+
+    struct OptDef TheOpt;
+    __toOpt ( Opt, TheOpt );
+
+    if ( ArgsAddOptionArray ( _M_args, & TheOpt, 1 ) != 0 ) {
+        throw ErrorMsg ( "addOpt: Can not add option" );
+    }
+
+    _M_optDefs . insert ( _M_optDefs . end (), Opt );
+}   /* AArgs :: addOpt () */
+
+void
+AArgs :: __addStdOpts ( Args * TheArgs )
+{
+    if ( TheArgs == NULL ) {
+        throw ErrorMsg ( "__addStdOpts: Very not good" );
+    }
+
+    if ( ArgsAddStandardOptions ( TheArgs ) != 0 ) {
+        throw ErrorMsg ( "__addStdOpts: Can not add standard options" );
+    }
+}   /* AArgs :: __addStdOpts () */
+
+void
+AArgs :: parse ( int argc, char ** argv )
+{
+    if ( ! good () ) {
+        throw ErrorMsg ( "parseArgs: Not good" );
+    }
+
+    if ( ArgsParse ( _M_args, argc, argv ) != 0 ) {
+        throw ErrorMsg ( "parseArgs: Can not parse arguments" );
+    }
+
+    const char * prog;
+    if ( ArgsProgram ( _M_args, NULL, & prog ) != 0 ) {
+        throw ErrorMsg ( "parseArgs: Can not extract Progname" );
+    }
+    _M_progName =  prog;
+
+        /*) Here we should handle standard argumends
+            NOTE: help and version are managing authomatically
+         (*/
+    if ( _M_standards_added ) {
+        if ( ArgsHandleStandardOptions ( _M_args ) != 0 ) {
+            throw ErrorMsg ( "parseArgs: Can not handle standard options" );
+        }
+    }
+
+    __customParse ();
+}   /* AArgs :: parse () */
+
+void 
+AArgs :: __customParse () 
+{
+    /* nothing to do here */
+}   /* AArgs :: __customParse () */
+
+void
+AArgs :: __regArgs ( Args * TheArgs, AArgs * TheAArgs )
+{
+    if ( __getArgs ( TheArgs ) != NULL ) {
+        throw ErrorMsg ( "__regArgs: Already registered" );
+    }
+
+    _sM_args [ TheArgs ] = TheAArgs;
+}   /* AArgs :: __regArgs () */
+
+AArgs *
+AArgs :: __getArgs ( Args * TheArgs )
+{
+    if ( TheArgs != NULL ) {
+        MArgsI Iter = _sM_args . find ( TheArgs );
+        if ( Iter != _sM_args . end () ) {
+            return ( * Iter ) . second;
+        }
+    }
+    return NULL;
+}   /* AArgs :: __getArgs () */
+
+void
+AArgs :: __deregArgs ( Args * TheArgs )
+{
+    if ( TheArgs != NULL ) {
+        MArgsI Iter = _sM_args . find ( TheArgs );
+        if ( Iter != _sM_args . end () ) {
+            _sM_args . erase ( Iter );
+        }
+    }
+}   /* AArgs :: __deregArgs () */
+
+AOptVal
+AArgs :: optVal ( const char * name ) const
+{
+    if ( ! good () ) {
+        throw ErrorMsg ( "optVal: Not good" );
+    }
+
+    if ( name == NULL ) {
+        throw ErrorMsg ( "optVal: NULL name passed" );
+    }
+
+    AOptVal retVal;
+    retVal . reset ( name, _M_args, optDef ( name ) . needValue () );
+    return retVal;
+}   /* AArgs :: optVal () */
+
+AParVal
+AArgs :: parVal () const
+{
+    if ( ! good () ) {
+        throw ErrorMsg ( "parVal: Not good" );
+    }
+
+    AParVal retVal;
+    retVal . reset ( "parameters", _M_args, true );
+    return retVal;
+}   /* AArgs :: paramVal () */
+
+const AOptDef &
+AArgs :: optDef ( const String & name ) const
+{
+    if ( ! good () ) {
+        throw ErrorMsg ( "optDef: Not good" );
+    }
+
+    for (
+        VOptI S = _M_optDefs . begin ();
+        S != _M_optDefs . end ();
+        S ++
+    ) {
+        if ( ( * S ) . getName () == name ) {
+            return * S;
+        }
+    }
+
+    throw ErrorMsg ( String ( "optDef: Can not find definition for opotion \"" ) + name + "\"" );
+}   /* AArgs :: optDef () */
+
+void
+AArgs :: usage () const
+{
+    :: Usage ( _M_args );
+}   /* AArgs :: Usage () */
diff --git a/tools/fastq-dump/args.hpp b/tools/fastq-dump/args.hpp
new file mode 100644
index 0000000..76723dc
--- /dev/null
+++ b/tools/fastq-dump/args.hpp
@@ -0,0 +1,330 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_outpost_args_
+#define _h_outpost_args_
+
+#ifndef _h_klib_defs_
+#include <klib/defs.h>
+#endif
+
+#include <vector>
+#include <map>
+
+#include <ngs/ErrorMsg.hpp>
+#include <ngs/StringRef.hpp>
+
+/* ##########################################################
+   # Big WARNING : those aren't thread safe classes
+   ########################################################## */
+
+/*))
+ // Right namespace?
+((*/
+namespace ngs {
+
+/*)))
+ ///    These are simple adapters for methods and structures introduced
+ \\\    in kapp/args.h. I agree, these are looks lame, but I will use
+ ///    them ... 
+(((*/
+
+/*))    Adapter for OptDef ... 
+ ((*/
+class AOptDef {
+private :
+    typedef struct OptDef OptDef;
+
+public :
+        /*) Various constructors and destructors 
+         (*/
+    AOptDef ();
+    AOptDef ( const AOptDef & Opt );
+    ~AOptDef ();
+
+    bool good () const;
+
+    AOptDef & operator = ( const AOptDef & Opt );
+
+    void reset ( const AOptDef & Opt );
+    void reset ();
+
+        /*) Various setters/getters
+         (*/
+    inline const char * getName ( ) const
+                {
+                    return _M_name . empty ()
+                                    ? NULL
+                                    : _M_name . c_str ()
+                                    ;
+                };
+    inline void setName ( const char * Name = NULL )
+                {
+                    if ( Name == NULL )
+                        _M_name . clear ();
+                    else 
+                        _M_name = Name;
+                };
+
+    inline const char * getAliases ( ) const
+                {
+                    return _M_aliases . empty ()
+                                    ? NULL
+                                    : _M_aliases . c_str ()
+                                    ;
+                };
+    inline void setAliases ( const char * Aliases = NULL )
+                {
+                    if ( Aliases == NULL )
+                        _M_aliases . clear ();
+                    else 
+                        _M_aliases = Aliases;
+                };
+
+    inline const char * getParam ( ) const
+                {
+                    return _M_param . empty ()
+                                    ? NULL
+                                    : _M_param . c_str ()
+                                    ;
+                };
+    inline void setParam ( const char * Param = NULL )
+                {
+                    if ( Param == NULL )
+                        _M_param . clear ();
+                    else 
+                        _M_param = Param;
+                };
+
+    inline uint16_t maxCount () const
+                {
+                    return _M_max_count;
+                };
+    inline void setMaxCount ( uint16_t MaxCount = 0 )
+                {
+                    _M_max_count = MaxCount;
+                };
+
+    inline bool needValue () const
+                {
+                    return _M_need_value;
+                };
+    inline void setNeedValue ( bool NeedValue = true )
+                {
+                    _M_need_value = NeedValue;
+                };
+
+    inline bool required () const
+                {
+                    return _M_required;
+                };
+    inline void setRequired ( bool Required = true )
+                {
+                    _M_required = Required;
+                 };
+
+    inline const char * getHlp () const
+                {
+                    return _M_hlp.c_str ();
+                };
+
+    inline void setHlp ( const String & HlpStr = "" )
+                {
+                    _M_hlp = HlpStr;
+                };
+private :
+
+    String _M_name;
+    String _M_aliases;
+    String _M_param;
+    String _M_hlp;
+    uint16_t _M_max_count;
+    bool _M_need_value;
+    bool _M_required;
+};  /* class AOptDef */
+
+/*))    Something extra for the same money
+ ((*/
+class AOPBase {
+public :
+    typedef struct Args Args;
+
+    typedef std :: vector < String > VVal;
+    typedef VVal :: const_iterator VValI;
+
+public :
+    AOPBase ();
+    virtual ~AOPBase ();
+
+    virtual void reset (
+                    const String & Name,
+                    Args * TheArgs,
+                    bool needValue
+                    ) = 0;
+
+    inline bool exist () const
+            {
+                return _M_exist;
+            };
+
+    inline const String & name () const
+            { 
+                return _M_name;
+            };
+
+    inline bool hasVal() const
+            {
+                return valCount () != 0;
+            };
+
+    uint32_t valCount () const;
+    const String & val ( uint32_t idx = 0 ) const;
+    uint32_t uint32Val ( uint32_t idx = 0 ) const;
+    int32_t int32Val ( uint32_t idx = 0 ) const;
+    uint64_t uint64Val ( uint32_t idx = 0 ) const;
+    int64_t int64Val ( uint32_t idx = 0 ) const;
+
+protected :
+    void reset ();
+    void reset ( const AOPBase & Bse );
+
+    bool _M_exist;
+
+    String _M_name;
+
+    VVal _M_val;
+};  /* class AOPBase */
+
+class AOptVal : public AOPBase {
+public :
+    AOptVal ();
+    AOptVal ( const AOptVal & Val );
+
+    AOptVal & operator = ( const AOptVal & Val );
+
+    void reset ( const String & Name, Args * TheArgs, bool needValue );
+};  /* class AOptVal */
+
+class AParVal : public AOPBase {
+public :
+    AParVal ();
+    AParVal ( const AParVal & Val );
+
+    AParVal & operator = ( const AParVal & Val );
+
+    void reset ( const String & Name, Args * TheArgs, bool needValue );
+};  /* class AParVal */
+
+/*))))  Adapter for Args structure.
+ ////
+ \\\\   Nothing new, it fully repeats behaviour of Args** methods.
+ ////   There is pattern how to use it :
+ \\\\       a.init (); // initializes Args
+ ////       for ( .... ) {
+ \\\\           a.addOpt ( Opt );
+ ////       }
+ \\\\       a.parseArgs ( argc, argv );
+ ////       a.dispose ();
+((((*/
+class AArgs {
+private :
+    typedef struct Args Args;
+
+    typedef std :: map < Args * , AArgs * > MArgs;
+    typedef MArgs :: iterator MArgsI;
+
+    typedef std :: vector < AOptDef > VOpt;
+    typedef VOpt :: const_iterator VOptI;
+
+    typedef std :: vector < String > VVal;
+    typedef VVal :: const_iterator VValI;
+
+public :
+    AArgs ();
+    virtual ~AArgs ();
+
+        /* Three general stepd to perform : init/parse/dispose
+         */
+    void init ( bool AddStandardOrguments = false );
+    void parse ( int argc, char ** argv );
+    void dispose ();
+
+        /*  Are we good ? virtual ... ouch
+         */
+    inline bool good () const { return _M_args != NULL; };
+
+        /*  Options handling
+         */
+    void addStdOpts ();
+    void addOpt ( const struct AOptDef & Opt );
+
+    inline size_t optDefCount () const
+            { return _M_optDefs . size (); };
+    inline const AOptDef & optDef ( size_t i )
+            { return _M_optDefs [ i ]; };
+
+        /*  Here is program name
+         */
+    inline const String & prog () const
+            { return _M_progName; };
+
+        /* Here are getters for option and paramter values 
+         */
+    AOptVal optVal ( const char * name ) const;
+    AParVal parVal () const;
+
+    void usage () const;
+
+protected :
+    virtual void __customInit ();
+    virtual void __customParse ();
+    virtual void __customDispose ();
+
+private :
+    static MArgs _sM_args;
+
+public :
+    static void __regArgs ( Args * TheArgs, AArgs * TheAArgs );
+    static AArgs * __getArgs ( Args * TheArgs ); 
+    static void __deregArgs ( Args * TheArgs ); 
+
+private :
+    const AOptDef & optDef ( const String & name ) const;
+
+    void __disposeArgs ( Args * TheArgs );
+    void __addStdOpts ( Args * TheArgs );
+
+    Args * _M_args;
+    bool _M_standards_added;
+
+    VOpt _M_optDefs;
+
+    String _M_progName;
+};  /* class AArgs */
+
+};  /* namespace ngs */
+
+#endif /* _h_outpost_args_ */
diff --git a/tools/fastq-dump/fastq-dump.cpp b/tools/fastq-dump/fastq-dump.cpp
new file mode 100644
index 0000000..f9d8bce
--- /dev/null
+++ b/tools/fastq-dump/fastq-dump.cpp
@@ -0,0 +1,633 @@
+#include <ngs/ncbi/NGS.hpp>
+#include <ngs/ReadCollection.hpp>
+
+#include <klib/out.h>
+#include <kfc/defs.h>
+#include <kapp/main.h>
+
+#include <klib/rc.h>
+#include <kfc/rc.h>
+
+
+#include <sysalloc.h>
+
+#include <string.h>         /* strcmp () */
+
+#include "args.hpp"
+#include "filters.hpp"
+
+#include "koutstream"
+
+
+/* Sorry for that ... but it is just a test */
+using namespace std;
+using namespace ncbi;
+using namespace ngs;
+
+namespace ngs {
+
+/*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*/
+/* Arguments                                                   */
+/*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*/
+class DumpArgs : public AArgs {
+public :
+    static const char * _sM_minSpotIdName;
+    static const char * _sM_maxSpotIdName;
+    static const char * _sM_spotIdName;
+    static const char * _sM_minReadLengthName;
+    static const char * _sM_categoryName;
+    static const char * _sM_fastaName;
+    static const char * _sM_legacyReportName;
+
+    static const uint64_t _sM_minSpotIdDefValue = 1;
+    static const uint64_t _sM_maxSpotIdDefValue = ~0;
+
+public :
+    typedef AArgs PAPAHEN;
+    typedef Read :: ReadCategory ReadCategory;
+
+public :
+    DumpArgs ();
+    ~DumpArgs ();
+
+    inline const String & accession () const
+                { return _M_accession; };
+
+    inline uint64_t minSpotId () const
+                { return _M_minSpotId; };
+    inline uint64_t maxSpotId () const
+                { return _M_maxSpotId; };
+
+    inline uint64_t minReadLength () const
+                { return _M_minReadLength; };
+
+    inline ReadCategory category () const
+                { return _M_category; };
+
+    inline bool fastaDump () const
+                { return _M_fasta != 0; };
+
+    inline uint64_t fastaDumpWidth () const
+                { return _M_fasta; };
+
+    inline bool legacyReport () const
+                { return _M_legacyReport; };
+
+protected :
+    void __customInit ();
+    void __customParse ();
+    void __customDispose ();
+
+private :
+    String _M_accession;
+
+        /*) Full Spot Fulters
+         (*/
+    uint64_t _M_minSpotId;      /* -N | --minSpotId < rowid > */
+    uint64_t _M_maxSpotId;      /* -X | --maxSpotId < rowid > */
+    uint64_t _M_minReadLength;  /* -M | --minReadLen <len> */
+    ReadCategory _M_category;   /* -Y | --category */
+    uint64_t _M_fasta;          /* -A | --fasta */
+    bool _M_legacyReport;       /* -L | --legacy-report */
+};
+
+/*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*/
+/* DumpArgs                                                    */
+/*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*/
+
+const char * DumpArgs :: _sM_minSpotIdName = "minSpotId";
+const char * DumpArgs :: _sM_maxSpotIdName = "maxSpotId";
+const char * DumpArgs :: _sM_spotIdName = "spotId";
+const char * DumpArgs :: _sM_minReadLengthName = "minReadLength";
+const char * DumpArgs :: _sM_categoryName = "category";
+const char * DumpArgs :: _sM_fastaName = "fasta";
+const char * DumpArgs :: _sM_legacyReportName = "legacy-report";
+
+DumpArgs :: DumpArgs ()
+:   AArgs ()
+,   _M_accession ( "" )
+,   _M_minSpotId ( _sM_minSpotIdDefValue )
+,   _M_maxSpotId ( _sM_maxSpotIdDefValue )
+,   _M_minReadLength ( 0 )
+,   _M_category ( Read :: all )
+,   _M_fasta ( 0 )
+,   _M_legacyReport ( false )
+{
+}   /* DumpArgs :: DumpArgs () */
+
+DumpArgs :: ~DumpArgs ()
+{
+}   /* DumpArgs :: ~DumpArgs () */
+
+void
+DumpArgs :: __customInit ()
+{
+        /*) Here we are adding some extra options 
+         (*/
+    {
+        AOptDef TheOpt;
+
+        TheOpt . setName ( _sM_minSpotIdName );
+        TheOpt . setAliases ( "N" );
+        TheOpt . setParam ( "rowid" );
+        TheOpt . setNeedValue ( true );
+        TheOpt . setRequired ( false );
+        TheOpt . setHlp ( "Minimum spot id" );
+
+        addOpt ( TheOpt );
+    }
+
+    {
+        AOptDef TheOpt;
+
+        TheOpt . setName ( _sM_maxSpotIdName );
+        TheOpt . setAliases ( "X" );
+        TheOpt . setParam ( "rowid" );
+        TheOpt . setNeedValue ( true );
+        TheOpt . setRequired ( false );
+        TheOpt . setHlp ( "Maximum spot id" );
+        TheOpt . setMaxCount ( 1 );
+
+        addOpt ( TheOpt );
+    }
+
+    {
+        AOptDef TheOpt;
+
+        TheOpt . setName ( _sM_spotIdName );
+        TheOpt . setAliases ( "S" );
+        TheOpt . setParam ( "rowid" );
+        TheOpt . setNeedValue ( true );
+        TheOpt . setRequired ( false );
+        TheOpt . setHlp ( "Spot id" );
+        TheOpt . setMaxCount ( 1 );
+
+        addOpt ( TheOpt );
+    }
+
+    {
+        AOptDef TheOpt;
+
+        TheOpt . setName ( _sM_minReadLengthName );
+        TheOpt . setAliases ( "M" );
+        TheOpt . setParam ( "len" );
+        TheOpt . setNeedValue ( true );
+        TheOpt . setRequired ( false );
+        TheOpt . setHlp ( "Filter by sequence length >= <len>" );
+        TheOpt . setMaxCount ( 1 );
+
+        addOpt ( TheOpt );
+    }
+
+    {
+        AOptDef TheOpt;
+
+        TheOpt . setName ( _sM_categoryName );
+        TheOpt . setAliases ( "Y" );
+        TheOpt . setParam ( "alignment" );
+        TheOpt . setNeedValue ( true );
+        TheOpt . setRequired ( false );
+        TheOpt . setHlp ( "Reads to dump. Accepts these values : <fullyAligned>, <partiallyAligned>, <aligned>, <unaligned>, <all>. Optional, default value <all> " );
+        TheOpt . setMaxCount ( 1 );
+
+        addOpt ( TheOpt );
+    }
+    
+    {
+        AOptDef TheOpt;
+
+        TheOpt . setName ( _sM_fastaName );
+        TheOpt . setAliases ( "A" );
+        TheOpt . setParam ( "width" );
+        TheOpt . setNeedValue ( true );
+        TheOpt . setRequired ( false );
+        TheOpt . setHlp ( "FASTA only, no qualities, optional line wrap width (set to zero for no wrapping)" );
+        TheOpt . setMaxCount ( 1 );
+
+        addOpt ( TheOpt );
+    }
+
+    {
+        AOptDef TheOpt;
+
+        TheOpt . setName ( _sM_legacyReportName );
+        TheOpt . setAliases ( "R" );
+        TheOpt . setNeedValue ( false );
+        TheOpt . setRequired ( false );
+        TheOpt . setHlp ( "Use legacy style 'Written spots' for tool" );
+        TheOpt . setMaxCount ( 1 );
+
+        addOpt ( TheOpt );
+    }
+}   /* DumpArgs :: __customInit () */
+
+void
+DumpArgs :: __customDispose ()
+{
+    _M_accession = "";
+    _M_minSpotId = _sM_minSpotIdDefValue;
+    _M_maxSpotId = _sM_maxSpotIdDefValue;
+    _M_minReadLength = 0;
+    _M_category = Read :: all;
+    _M_fasta = 0;
+    _M_legacyReport = false;
+}   /* DumpArgs :: __customDispose () */
+
+void
+DumpArgs :: __customParse ()
+{
+    if ( ! good () ) {
+        throw ErrorMsg ( "__customParse::reset: Not good" );
+    }
+
+    uint32_t cnt = parVal () . valCount ();
+    if ( cnt == 0 ) {
+        throw ErrorMsg ( "__customParse: Too few paramters" );
+    }
+
+    _M_accession = parVal () . val ( 0 );
+
+    if ( _M_accession . empty () ) {
+        cerr << "ERROR: <accession> is not defined" << endl;
+        throw ErrorMsg ( "__custromParse: ERROR: <accession> is not defined" );
+    }
+
+    AOptVal optV = optVal ( _sM_spotIdName );
+    uint64_t __spotId = ~0;
+
+    if ( optV . exist () ) {
+        if ( optVal ( _sM_minSpotIdName ) . exist () ) {
+            throw ErrorMsg ( String ( "__custromParse: ERROR: parameter \"" ) + _sM_spotIdName + "\" can not coexists with parameter \"" + _sM_minSpotIdName + "\"");
+        }
+
+        if ( optVal ( _sM_maxSpotIdName ) . exist () ) {
+            throw ErrorMsg ( String ( "__custromParse: ERROR: parameter \"" ) + _sM_spotIdName + "\" can not coexists with parameter \"" + _sM_maxSpotIdName + "\"");
+        }
+
+        if ( optV . valCount () != 1 ) {
+            throw ErrorMsg ( String ( "__custromParse: ERROR: Too many \"" ) + _sM_spotIdName + "\" values");
+        }
+
+        __spotId = optV . uint64Val ();
+    }
+
+    optV = optVal ( _sM_minSpotIdName );
+    if ( optV . exist () ) {
+        if ( optV . valCount () != 1 ) {
+            throw ErrorMsg ( String ( "__custromParse: ERROR: Too many \"" ) + _sM_minSpotIdName + "\" values");
+        }
+
+        _M_minSpotId = optV . uint64Val ();
+    }
+
+    optV = optVal ( _sM_maxSpotIdName );
+    if ( optV . exist () ) {
+        if ( optV . valCount () != 1 ) {
+            throw ErrorMsg ( String ( "__custromParse: ERROR: Too many \"" ) + _sM_maxSpotIdName + "\" values");
+        }
+
+        _M_maxSpotId = optV . uint64Val ();
+    }
+
+    if ( __spotId != ( uint64_t ) ~0 ) {
+        _M_minSpotId = __spotId;
+        _M_maxSpotId = __spotId;
+    }
+    else {
+        if ( _M_maxSpotId < _M_minSpotId ) {
+            uint64_t Si = _M_minSpotId;
+            _M_minSpotId = _M_maxSpotId;
+            _M_maxSpotId = Si;
+        }
+    }
+
+    if ( _M_minSpotId == 0 ) {
+        throw ErrorMsg ( String ( "__custromParse: ERROR: Invalid value '0' for \"" ) + _sM_minSpotIdName + "\"");
+    }
+
+    optV = optVal ( _sM_minReadLengthName );
+    if ( optV . exist () ) {
+        if ( optV . valCount () != 1 ) {
+            throw ErrorMsg ( String ( "__custromParse: ERROR: Too many \"" ) + _sM_minReadLengthName + "\" values");
+        }
+
+        _M_minReadLength = optV . uint64Val ();
+    }
+
+    _M_category = Read :: all;
+    optV = optVal ( _sM_categoryName );
+    if ( optV . exist () ) {
+        if ( optV . valCount () != 1 ) {
+            throw ErrorMsg ( String ( "__custromParse: ERROR: Too many \"" ) + _sM_categoryName + "\" values");
+        }
+
+        String __v = optV . val ();
+
+        while ( true ) {
+            if ( __v == "fullyAligned" ) {
+                _M_category = Read :: fullyAligned;
+                break;
+            }
+
+            if ( __v == "partiallyAligned" ) {
+                _M_category = Read :: partiallyAligned;
+                break;
+            }
+
+            if ( __v == "aligned" ) {
+                _M_category = Read :: aligned;
+                break;
+            }
+
+            if ( __v == "unaligned" ) {
+                _M_category = Read :: unaligned;
+                break;
+            }
+
+            if ( __v == "all" ) {
+                _M_category = Read :: all;
+                break;
+            }
+
+            throw ErrorMsg ( String ( "__customParse: ERROR: Invalid value \"" + __v + "\" for option \"" + _sM_categoryName + "\"" ) );
+        }
+    }
+
+    _M_fasta = 0;
+    optV = optVal ( _sM_fastaName );
+    if ( optV . exist () ) {
+        if ( optV . valCount () != 1 ) {
+            throw ErrorMsg ( String ( "__custromParse: ERROR: Too many \"" ) + _sM_fastaName + "\" values");
+        }
+
+        _M_fasta = optV . uint64Val ();
+        if ( _M_fasta == 0 ) {
+            _M_fasta = ~0;
+        }
+    }
+
+    _M_legacyReport = optVal ( _sM_legacyReportName ) . exist ();
+
+}   /* DumpArgs :: __customParse () */
+
+}; /* namespace ngs */
+
+/*))
+ //  KMain, and all other
+((*/
+
+ver_t CC KAppVersion ( void ) { return 0; }
+const char UsageDefaultName[] = "fq-d";
+
+rc_t CC
+UsageSummary ( const char * progname )
+{
+        /*) Standard usage of that program
+         (*/
+    return KOutMsg (
+                "\n"
+                "Usage:\n"
+                "  %s [Options] <Accession>\n"
+                "\n"
+                "Summary:\n"
+                "  Does something incredibly useful or we wouldn't have written it.\n"
+                "  I mean very very useful like pre-slicomg bread.\n"
+                "\n",
+                progname
+                );
+}
+
+rc_t CC
+Usage ( const Args * a )
+{
+    if ( a == NULL ) {
+        throw ngs :: ErrorMsg ( "Usage: NULL args passed" );
+    }
+
+    const char * prog;
+
+    if ( ArgsProgram ( a, NULL, & prog ) != 0 ) {
+        throw ngs :: ErrorMsg ( "Usage: Infalid args passed" );
+    }
+
+    UsageSummary ( prog );
+
+    KOutMsg ( "OPTIONS:\n" );
+
+    HelpOptionsStandard ();
+
+    AArgs * TheArgs = AArgs :: __getArgs ( const_cast < Args * > ( a ) );
+
+    if ( TheArgs == NULL ) {
+        throw ngs :: ErrorMsg ( "Usage: Using unregistered usage" );
+    }
+
+    size_t c = TheArgs -> optDefCount ();
+    for ( size_t i = 0; i < c; i ++ ) {
+        const AOptDef & o = TheArgs -> optDef ( i );
+
+        const char * c [] = { NULL, NULL };
+        c [ 0 ] = o . getHlp ();
+
+        HelpOptionLine (
+                        o . getAliases (),
+                        o . getName (),
+                        o . getParam (),
+                        c
+                        );
+
+    }
+
+    return 0;
+}
+
+static void run ( const DumpArgs & TheArgs );
+
+rc_t
+KMain ( int argc, char * argv [] )
+{
+    try {
+        DumpArgs TheArgs;
+
+        try {
+            TheArgs . init ( true );
+            TheArgs . parse ( argc, argv );
+        }
+        catch ( ... ) {
+            UsageSummary ( TheArgs . prog () . c_str () );
+            throw;
+        }
+
+        if ( ! TheArgs . good () ) {
+            TheArgs . usage ();
+
+            return 1;
+        }
+
+        run ( TheArgs );
+
+        TheArgs . dispose ();
+    }
+    catch ( exception & E ) {
+        cerr << "Hi, I am exception '" << E.what () << "'" << endl;
+
+        return 1;
+    }
+    catch ( ... ) {
+        cerr << "Hi, I am UNKNOWN exception" << endl;
+
+        return 2;
+    }
+
+    return 0;
+}   /* KMain () */
+
+static
+void
+setupFilters ( AFilters & Filters, const DumpArgs & TheArgs )
+{
+    if ( TheArgs . minReadLength () != 0 ) {
+        Filters . addLengthFilter ( TheArgs . minReadLength () );
+    }
+}   /* setupFilters () */
+
+static
+void
+dumpFastQ (
+        uint64_t SpotId,
+        const ngs :: String & CollectionName,
+        const ReadIterator & Iterator
+)
+{
+        /*)  We do not check values for arguments validity!
+         (*/
+    StringRef ReadName = Iterator . getReadName ();
+    StringRef Bases = Iterator . getReadBases ();
+    StringRef Qualities = Iterator . getReadQualities ();
+
+        /*)  First, we are doint base header
+         (*/
+    kout << "@"
+        << CollectionName
+        << "."
+        << SpotId
+        << " "
+        << ReadName
+        << " length="
+        << Bases . size ()
+        << "\n"
+        ;
+
+        /*)  Second is going base itsefl
+         (*/
+    kout << Bases
+        << "\n"
+        ;
+
+        /*)  Third, header for qualities
+         (*/
+    kout << "+"
+        << CollectionName
+        << "."
+        << SpotId
+        << " "
+        << ReadName
+        << " length="
+        << Qualities . size ()
+        << "\n"
+        ;
+
+        /*)  Finally there are qualities
+         (*/
+    kout << Qualities
+        << "\n"
+        ;
+}   /* dumpFastQ () */
+
+static
+void
+dumpFastA (
+        uint64_t SpotId,
+        const ngs :: String & CollectionName,
+        const ReadIterator & Iterator,
+        uint64_t Width
+)
+{
+        /*)  We do not check values for arguments validity!
+         (*/
+    StringRef ReadName = Iterator . getReadName ();
+    StringRef Bases = Iterator . getReadBases ();
+
+    uint64_t __l = Bases . size ();
+
+        /*)  First, we are doint base header
+         (*/
+    kout << "<"
+        << CollectionName
+        << "."
+        << SpotId
+        << " "
+        << ReadName
+        << " length="
+        << __l
+        << "\n"
+        ;
+
+        /*)  Second is going base itsefl by width
+         (*/
+
+    uint64_t __p = 0;
+    const char * __s = Bases . data ();
+
+    while ( __p < __l ) {
+        uint64_t __t = :: min ( Width, __l - __p );
+
+        kout << string ( __s, __p, __t ) << "\n" ;
+
+        __p += __t;
+    }
+
+}   /* dumpFastA () */
+
+/*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*/
+/*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*/
+
+static
+void
+run ( const DumpArgs & TheArgs )
+{
+    if ( ! TheArgs . good () ) {
+        throw ngs :: ErrorMsg ( "Invalid BC object" );
+    }
+
+    ngs :: ReadCollection RCol = NGS :: openReadCollection (
+                                    TheArgs . accession () . c_str ()
+                                    );
+
+    ReadIterator Iterator = RCol.getReadRange (
+                    TheArgs . minSpotId () ,
+                    TheArgs . maxSpotId () - TheArgs . minSpotId () + 1,
+                    TheArgs . category ()
+                    );
+
+    ngs :: String ReadCollectionName = RCol.getName ();
+
+    AFilters Filters ( TheArgs . accession () );
+    setupFilters ( Filters, TheArgs );
+
+    for ( uint64_t llp = TheArgs . minSpotId () ; Iterator.nextRead (); llp ++ ) {
+
+        if ( Filters . checkIt ( Iterator ) ) {
+            if ( TheArgs . fastaDump () ) {
+                dumpFastA ( llp, ReadCollectionName, Iterator, TheArgs . fastaDumpWidth () );
+            }
+            else { 
+                dumpFastQ ( llp, ReadCollectionName, Iterator );
+            }
+        }
+    }
+
+    cerr << Filters . report ( TheArgs . legacyReport () );
+
+}   /* run () */
+
diff --git a/tools/fastq-dump/fastq-dump.vers b/tools/fastq-dump/fastq-dump.vers
new file mode 100644
index 0000000..8e8299d
--- /dev/null
+++ b/tools/fastq-dump/fastq-dump.vers
@@ -0,0 +1 @@
+2.4.2
diff --git a/tools/fastq-dump/filters.cpp b/tools/fastq-dump/filters.cpp
new file mode 100644
index 0000000..710a689
--- /dev/null
+++ b/tools/fastq-dump/filters.cpp
@@ -0,0 +1,300 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <sysalloc.h>
+
+#ifndef _h_klib_defs_
+#include <klib/defs.h>
+#endif
+
+#include <ngs/ReadCollection.hpp>
+
+#include <sstream>
+
+#include "filters.hpp"
+
+using namespace std;
+using namespace ngs;
+
+/*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*/
+/*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*/
+
+/*))
+ //     AFilter
+((*/
+AFilter :: AFilter ()
+:   _M_rejected ( 0 )
+{
+}   /* AFilter :: AFilter () */
+
+AFilter :: ~AFilter ()
+{
+    _M_rejected = 0;
+}   /* AFilter :: ~AFilter () */
+
+bool
+AFilter :: checkIt ( const ReadIterator & pos ) const
+{
+    throw ErrorMsg ( ":: checkIt() - is not implemented for class" );
+}   /* AFilter :: checkIt () */
+
+String
+AFilter :: report () const
+{
+    if ( _M_rejected != 0 ) {
+        stringstream __s;
+        __s << "Rejected "
+            << _M_rejected
+            << ( _M_rejected == 1 ? " SPOT" : " SPOTS" )
+            ;
+        if ( reason () . empty () ) {
+            __s << " reason unknown";
+        }
+        else {
+            __s << " because " << reason ();
+        }
+
+        return __s . str ();
+    }
+    return "";
+}   /* AFilter :: report () */
+
+String
+AFilter :: reason () const
+{
+    return "";
+}   /* AFilter :: reason () */
+
+/*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*/
+/* Place for some predefined filters                             */
+/*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*/
+
+/*))
+ //     Num spots readed filter ... needed as counter only
+((*/
+class __NReadFilter : public AFilter {
+public :
+    __NReadFilter ( const String & source );
+
+    bool checkIt ( const ReadIterator & Rit ) const;
+
+    String report () const;
+
+private :
+    String _M_source;
+};
+
+__NReadFilter :: __NReadFilter ( const string & source )
+:   _M_source ( source )
+{
+}   /* __NReadFilter :: __NReadFilter () */
+
+bool
+__NReadFilter :: checkIt ( const ReadIterator & ) const
+{
+    reject ();
+
+    return true;
+}   /* __NReadFilter :: checkIt () */ 
+
+String
+__NReadFilter :: report () const
+{
+    stringstream __s;
+
+    __s << "Read "
+        << rejected ()
+        << ( rejected () == 1 ? " spot" : " spots" )
+        ;
+
+    if ( ! _M_source . empty () ) {
+        __s << " for " << _M_source;
+    }
+
+    return __s . str ();
+}   /* __NReadFilter :: report () */
+
+/*))
+ //     Num spots readed filter ... needed as counter only
+((*/
+class __SpotLengthFilter : public AFilter {
+public :
+    __SpotLengthFilter ( uint64_t MinLength );
+
+    bool checkIt ( const ReadIterator & Rit ) const;
+
+protected :
+    String reason () const;
+
+private :
+    uint64_t _M_minLength;
+};
+
+__SpotLengthFilter :: __SpotLengthFilter ( uint64_t MinLength )
+:   _M_minLength ( MinLength )
+{
+}   /* __SpotLengthFilter :: __SpotLengthFilter () */
+
+bool
+__SpotLengthFilter :: checkIt ( const ReadIterator & Rit ) const
+{
+    uint64_t __l = Rit . getReadBases () . size ();
+    if ( __l < _M_minLength ) {
+        reject ();
+
+        return false;
+    }
+
+    return true;
+}   /* __SpotLengthFilter :: checkIt () */ 
+
+String
+__SpotLengthFilter :: reason () const
+{
+    stringstream __s;
+
+    __s << "SPOTLEN < " << _M_minLength;
+
+    return __s . str ();
+}   /* __SpotLengthFilter :: reason () */
+
+/*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*/
+/*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*/
+
+/*))
+ //     AFilters
+((*/
+AFilters :: AFilters ( const String & source )
+:   _M_source ( source )
+,   _M_confirmed ( 0 )
+{
+    init ();
+}   /* AFilters :: AFilters () */
+
+AFilters :: ~AFilters ()
+{
+    try {
+        dispose ();
+    }
+    catch ( ... ) {
+        /* Ha! */
+    }
+}   /* AFitlers :: ~AFilters () */
+
+void
+AFilters :: init ()
+{
+        /* Just dispose all previous content
+         */
+    dispose ();
+
+        /* Here we should add some mondaytory filters
+         */
+    addFilter ( new __NReadFilter ( _M_source ) );
+}   /* AFilters :: init () */
+
+void
+AFilters :: dispose ()
+{
+    for ( TVecI __b = _M_filters . begin (); __b != _M_filters . end (); __b ++ ) {
+        AFilter * __f = * __b;
+        if ( __f != NULL ) {
+            delete __f;
+        }
+        * __b = NULL;
+    }
+    _M_filters . clear ();
+
+    _M_confirmed = 0;
+}   /* AFilters :: dispose () */
+
+bool
+AFilters :: checkIt ( const ReadIterator & Rit ) const
+{
+    bool __r = __checkIt ( Rit );
+
+    if ( __r ) {
+        _M_confirmed ++;
+    }
+
+    return __r;
+}   /* AFilters :: checkIt () */
+
+bool
+AFilters :: __checkIt ( const ReadIterator & Rit ) const
+{
+    for ( TVecCI __b = _M_filters . begin (); __b != _M_filters . end (); __b ++ ) {
+        AFilter * __f = * __b;
+
+        if ( __f != NULL ) {
+            if ( ! __f -> checkIt ( Rit ) ) {
+                return false;
+            }
+        }
+    }
+
+    return true;
+}   /* AFilters :: __checkIt () */
+
+void
+AFilters :: addFilter ( AFilter * Flt )
+{
+    if ( Flt != NULL ) {
+        _M_filters . insert ( _M_filters . end (), Flt );
+    }
+}   /* AFilters :: addFilter () */
+
+void
+AFilters :: addLengthFilter ( uint64_t minLength )
+{
+    addFilter ( new __SpotLengthFilter ( minLength ) );
+}   /* AFilters :: addLengthFilter () */
+
+String
+AFilters :: report ( bool legacyStyle ) const
+{
+    stringstream __s;
+
+    if ( ! legacyStyle ) {
+        for ( TVecCI __b = _M_filters . begin (); __b != _M_filters . end (); __b ++ ) {
+            AFilter * __f = * __b;
+            if ( __f != NULL ) {
+                String __r = __f -> report ();
+                if ( ! __r . empty () ) {
+                    __s << __r << "\n";
+                }
+            }
+        }
+    }
+
+    __s << "Written " << _M_confirmed << ( _M_confirmed == 1 ? " spot" : " spots" ) << " for " << _M_source << "\n";
+
+    if ( legacyStyle ) {
+        __s << "Written " << _M_confirmed << ( _M_confirmed == 1 ? " spot" : " spots" ) << " total\n";
+    }
+
+    return __s . str ();
+}   /* AFilters :: report () */
diff --git a/tools/fastq-dump/filters.hpp b/tools/fastq-dump/filters.hpp
new file mode 100644
index 0000000..df58c56
--- /dev/null
+++ b/tools/fastq-dump/filters.hpp
@@ -0,0 +1,114 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_outpost_filters_
+#define _h_outpost_filters_
+
+#include <vector>
+
+#ifndef _h_klib_defs_
+#include <klib/defs.h>
+#endif
+
+#include <ngs/ErrorMsg.hpp>
+#include <ngs/StringRef.hpp>
+
+/*)))   Namespace
+ (((*/
+namespace ngs {
+
+/*))
+ // Some forwards
+((*/
+class ReadIterator;
+
+class AFilter {
+public :
+    AFilter ();
+    virtual ~AFilter ();
+
+    virtual bool checkIt ( const ReadIterator & pos ) const = 0;
+
+    virtual String report () const;
+
+protected :
+        /* That method should be called from 'checkIt()' for stat
+         */
+    inline void reject () const { _M_rejected ++; };
+    inline uint64_t rejected () const { return _M_rejected; };
+
+    virtual String reason () const;
+
+private :
+    mutable uint64_t _M_rejected;
+
+};  /* class AFilter */
+
+class AFilters {
+public :
+    typedef std :: vector < AFilter * > TVec;
+    typedef TVec :: const_iterator TVecCI;
+    typedef TVec :: iterator TVecI;
+
+public :
+    AFilters ( const String & source );
+    virtual ~AFilters ();
+
+    bool checkIt ( const ReadIterator & pos ) const;
+
+        /* Adds new user_defined filter ...
+         */
+    void addFilter ( AFilter * pFilter );
+
+        /* There are some standard predefined filters to add
+         */
+    void addLengthFilter ( uint64_t minLength );
+
+        /* Misc stuff
+         */
+    inline const String & source () const { return _M_source ; }
+
+    String report ( bool legacyStyle = false ) const;
+
+private :
+    void init ();
+    void dispose ();
+
+    bool __checkIt ( const ReadIterator & pos ) const;
+
+private :
+    String _M_source;
+
+    TVec _M_filters;
+
+    mutable uint64_t _M_confirmed;
+};  /* class AFilters */
+
+/*)))   Namespace
+ (((*/
+}; /* namespace ngs */
+
+#endif /* _h_outpost_filters_ */
diff --git a/tools/fastq-dump/koutstream b/tools/fastq-dump/koutstream
new file mode 100644
index 0000000..ad15dc3
--- /dev/null
+++ b/tools/fastq-dump/koutstream
@@ -0,0 +1,281 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_outpost_koutstream_
+#define _h_outpost_koutstream_
+
+#ifndef _h_klib_defs_
+#include <klib/defs.h>
+#endif
+
+#include <ios>
+#include <streambuf>
+#include <ostream>
+
+#include <klib/out.h>
+
+/*)))
+ ///    Something weird. That class will throw exception if any
+ \\\    error will happen. Overwise, You may comment line to return
+ ///    error code instead.
+(((*/
+#define _DO_ALWAYS_THROW_EXCEPTION
+
+#ifdef _DO_ALWAYS_THROW_EXCEPTION
+    /* Using that forward to avoid conflicts with String */
+extern "C" {
+    KLIB_EXTERN rc_t CC string_printf (
+                                    char *dst,
+                                    size_t bsize,
+                                    size_t *num_writ,
+                                    const char *fmt,
+                                    ...
+                                    );
+}
+#endif /* _DO_ALWAYS_THROW_EXCEPTION */
+
+
+/*))))
+ <<<<   Lurics:
+  >>>>  That file created because Kurt want to wrap KOutMsg to 'stream'
+ <<<<
+  >>>>  Important notice ... because it is KOutMsg, that class will
+ <<<<   associate output sequence only with KOutMsg primitive.
+  >>>>  That file contains :
+ <<<<       basic_koutbuf    - buffer
+  >>>>      basic_koutstream - stream
+ <<<<       kout - stream forward
+  >>>>
+ ((((*/
+
+/*)))
+ ///    I think that is valild name for namespace ...
+(((*/
+namespace ngs {
+
+/*))
+ // Buffer
+((*/
+template < typename _CharT, typename _Traits >
+class basic_koutbuf
+    : public std :: basic_streambuf < _CharT, _Traits > {
+
+public :
+    // Typos
+    typedef _CharT      char_type;
+    typedef _Traits     traits_type;
+
+    typedef typename traits_type::int_type int_type;
+
+    typedef std :: allocator < char_type > allocator_type;
+    typedef std :: basic_streambuf < char_type, traits_type > __streambuf_type;
+    typedef basic_koutbuf < char_type, traits_type > __koutbuf_type;
+
+protected :
+
+    static const std :: streamsize _cM_buffer_size = 4096 * 32;
+    char_type * _M_char;
+
+public :
+
+        /* Constructor/destructor */
+    basic_koutbuf ()
+        : __streambuf_type ()
+        , _M_char ( allocator_type () . allocate ( _cM_buffer_size ) )
+        {
+            this -> setbuf ( _M_char, sizeof ( _M_char ) - 1 );
+            __setp ();
+        };
+
+    ~basic_koutbuf ()
+        {
+            try {
+                __sync (); // ?? should we check retval?
+            }
+            catch ( ... ) {
+                // ???? what we should do here ????
+            }
+
+            try {
+                if ( _M_char != NULL ) {
+                    allocator_type () . deallocate (
+                                                    _M_char,
+                                                    _cM_buffer_size
+                                                    );
+                }
+            }
+            catch ( ... ) {
+                // ???? nothing to do 
+            }
+
+            _M_char = NULL;
+        };
+
+    std :: streamsize xsputn ( const char_type * __s, std :: streamsize __n )
+        {
+            std :: streamsize __a = this -> epptr () - this -> pptr ();
+
+            if ( __n < __a ) {
+                    /*)  Here we are adding string to a buffer
+                     (*/
+                traits_type :: copy ( this -> pptr (), __s, __n );
+
+                this -> pbump ( __n );
+            }
+            else {
+                    /*) We are not too effective ...
+                     (*/
+                if ( __sync () == - 1 ) {
+                    return 0;
+                }
+
+                std :: streamsize __q = 0;
+
+                while ( __q < __n ) {
+                    __a = this -> epptr () - this -> pptr ();
+                    std :: streamsize __c = std :: min (
+                                                        __n - __q,
+                                                        __a
+                                                        );
+
+                    traits_type :: copy (
+                                    this -> pbase (),
+                                    __s + __q,
+                                    __c
+                                    );
+                    this -> pbump ( __c );
+
+                    if ( __sync () == - 1 ) {
+                        return 0;
+                    }
+
+                    __q += __c;
+                }
+            }
+
+                /*) We do never fail :lol:
+                 (*/
+            return __n;
+        };
+
+    virtual int sync ()
+        {
+            return __sync ();
+        };
+
+protected :
+
+        int __sync ()
+        {
+            int __ret = 0;
+
+            if ( this -> pbase () < this -> pptr () ) {
+                    /*) KOurMsg is working with null terminated
+                     (*/
+                * ( this -> pptr () ) = 0;
+
+                rc_t __rc = KOutMsg ( "%s", this -> pbase () );
+                if ( __rc != 0 ) {
+#ifdef _DO_ALWAYS_THROW_EXCEPTION
+
+                    /* That was requested by Kurt: I shoud throw
+                       an exception instead of sending overflow
+                       error
+                     */
+                    char __m [ 4096 ];
+                    size_t __n = 0;
+                    string_printf ( __m, sizeof ( __m ), & __n, "%R", __rc );
+                    throw ErrorMsg ( __m );
+#else
+
+                    __ret = - 1;
+#endif /* _DO_ALWAYS_THROW_EXCEPTION */
+                }
+
+                __setp ();
+            }
+
+            return __ret;
+        };
+
+        void __setp ()
+        {
+                /*) the only valid method to set _M_out_cur to zero
+                 /  also, one char reserved for a zero
+                (*/
+            this -> setp ( _M_char, _M_char + sizeof ( _M_char ) - 1 );
+        };
+
+};  /* class basic_koutbuf */
+
+/*))
+ // Stream
+((*/
+template < typename _CharT, typename _Traits >
+class basic_koutstream :
+    public std :: basic_ostream < _CharT, _Traits > {
+
+public :
+    // Typos
+    typedef _CharT      char_type;
+    typedef _Traits     traits_type;
+
+    typedef typename traits_type::int_type int_type;
+
+    typedef basic_koutbuf < char_type, traits_type > __koutbuf_type;
+    typedef std :: basic_ostream < char_type, traits_type > __ostream_type;
+    typedef basic_koutstream < char_type, traits_type > __koutstream_type;
+
+private :
+
+    __koutbuf_type _M_koutbuf;
+
+public :
+
+        /**
+         *  Default constructor, and the only constructor
+         **/
+    basic_koutstream () : __ostream_type ( 0 ), _M_koutbuf ()
+        {
+            this -> init ( & _M_koutbuf );
+        };
+
+    virtual ~basic_koutstream ()
+        {
+        };
+
+};  /* class basic_koutstream */
+
+/*)))
+ ///  Forwards
+(((*/
+typedef basic_koutstream<char, std :: char_traits < char > > koutstream;
+
+koutstream kout;
+
+}   /* namespace ngs */
+
+#endif /* _h_outpost_koutstream_ */
diff --git a/tools/fastq-loader/.gitignore b/tools/fastq-loader/.gitignore
new file mode 100644
index 0000000..f3b5a01
--- /dev/null
+++ b/tools/fastq-loader/.gitignore
@@ -0,0 +1 @@
+fastq-grammar.output
diff --git a/tools/fastq-loader/Makefile b/tools/fastq-loader/Makefile
index 31c50f0..184ab3a 100644
--- a/tools/fastq-loader/Makefile
+++ b/tools/fastq-loader/Makefile
@@ -24,7 +24,7 @@
 
 default: std
 
-TOP ?= $(shell ../../build/abspath.sh ../..)
+TOP ?= $(abspath ../..)
 MODULE = tools/fastq-loader
 
 INT_LIBS = \
@@ -136,12 +136,11 @@ FASTQ_LOAD_OBJ = \
 	$(addsuffix .$(OBJX),$(FASTQ_LOAD_SRC))
 
 FASTQ_LOADER_LIB = \
-	-lkapp \
-    -lloader \
-    -lload \
-	-lncbi-wvdb \
-	-lxml2 \
-	-lm
+	-skapp \
+    -sloader \
+    -sload \
+	-sncbi-wvdb \
+	-sm
 
 $(BINDIR)/latf-load: $(FASTQ_LOAD_OBJ)
 	$(LD) --exe --vers $(SRCDIR)/latf-load.vers -o $@ $^ $(FASTQ_LOADER_LIB)
diff --git a/tools/fastq-loader/fastq-grammar.c b/tools/fastq-loader/fastq-grammar.c
index 6220df2..11cadf0 100644
--- a/tools/fastq-loader/fastq-grammar.c
+++ b/tools/fastq-loader/fastq-grammar.c
@@ -127,16 +127,17 @@
       know about them.  */
    enum yytokentype {
      fqENDOFTEXT = 0,
-     fqNUMBER = 258,
-     fqALPHANUM = 259,
-     fqWS = 260,
-     fqENDLINE = 261,
-     fqBASESEQ = 262,
-     fqCOLORSEQ = 263,
-     fqTOKEN = 264,
-     fqASCQUAL = 265,
-     fqCOORDS = 266,
-     fqUNRECOGNIZED = 267
+     fqRUNDOTSPOT = 258,
+     fqNUMBER = 259,
+     fqALPHANUM = 260,
+     fqWS = 261,
+     fqENDLINE = 262,
+     fqBASESEQ = 263,
+     fqCOLORSEQ = 264,
+     fqTOKEN = 265,
+     fqASCQUAL = 266,
+     fqCOORDS = 267,
+     fqUNRECOGNIZED = 268
    };
 #endif
 
@@ -371,20 +372,20 @@ union yyalloc
 /* YYFINAL -- State number of the termination state.  */
 #define YYFINAL  21
 /* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   111
+#define YYLAST   126
 
 /* YYNTOKENS -- Number of terminals.  */
-#define YYNTOKENS  23
+#define YYNTOKENS  24
 /* YYNNTS -- Number of nonterminals.  */
-#define YYNNTS  53
+#define YYNNTS  54
 /* YYNRULES -- Number of rules.  */
-#define YYNRULES  96
+#define YYNRULES  102
 /* YYNRULES -- Number of states.  */
-#define YYNSTATES  137
+#define YYNSTATES  147
 
 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
 #define YYUNDEFTOK  2
-#define YYMAXUTOK   267
+#define YYMAXUTOK   268
 
 #define YYTRANSLATE(YYX)						\
   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -395,13 +396,13 @@ static const yytype_uint8 yytranslate[] =
        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,    19,     2,     2,     2,     2,
-       2,     2,     2,    22,     2,    18,    17,    20,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,    13,     2,
-       2,    21,    15,     2,    14,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,    20,     2,     2,     2,     2,
+       2,     2,     2,    23,     2,    19,    18,    21,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,    14,     2,
+       2,    22,    16,     2,    15,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,    16,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,    17,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
@@ -418,7 +419,7 @@ static const yytype_uint8 yytranslate[] =
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
-       5,     6,     7,     8,     9,    10,    11,    12
+       5,     6,     7,     8,     9,    10,    11,    12,    13
 };
 
 #if YYDEBUG
@@ -429,60 +430,65 @@ static const yytype_uint16 yyprhs[] =
        0,     0,     3,     6,     8,    10,    11,    12,    13,    14,
       25,    29,    31,    33,    36,    38,    42,    47,    51,    52,
       56,    57,    61,    63,    65,    66,    70,    71,    76,    77,
-      81,    82,    87,    89,    91,    93,    96,    97,   101,   102,
-     107,   108,   114,   115,   121,   122,   128,   129,   135,   136,
-     143,   145,   147,   150,   153,   156,   159,   162,   165,   166,
-     170,   171,   175,   176,   178,   179,   183,   184,   188,   189,
-     194,   195,   199,   200,   205,   206,   207,   208,   209,   210,
-     211,   225,   227,   229,   230,   232,   235,   238,   241,   244,
-     247,   251,   256,   258,   261,   264,   268
+      81,    82,    87,    89,    91,    93,    96,    98,    99,   103,
+     104,   109,   110,   116,   117,   123,   124,   130,   131,   137,
+     138,   145,   147,   149,   152,   155,   158,   161,   164,   167,
+     168,   172,   173,   177,   178,   180,   181,   185,   186,   190,
+     191,   196,   197,   201,   202,   207,   208,   209,   210,   211,
+     212,   213,   227,   229,   231,   232,   234,   237,   240,   243,
+     246,   249,   253,   257,   261,   265,   270,   274,   279,   281,
+     284,   287,   291
 };
 
 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
 static const yytype_int8 yyrhs[] =
 {
-      24,     0,    -1,    31,    72,    -1,    31,    -1,    72,    -1,
-      -1,    -1,    -1,    -1,    52,    25,    11,    26,    13,    27,
-      42,    13,    28,    74,    -1,     4,     1,    30,    -1,    29,
-      -1,     0,    -1,    30,    29,    -1,     6,    -1,    32,    30,
-      35,    -1,    32,    30,     1,    30,    -1,     1,    30,    35,
-      -1,    -1,    14,    33,    43,    -1,    -1,    15,    34,    43,
-      -1,    36,    -1,    39,    -1,    -1,     7,    37,    30,    -1,
-      -1,    36,     7,    38,    30,    -1,    -1,     8,    40,    30,
-      -1,    -1,    39,     8,    41,    30,    -1,     7,    -1,     8,
-      -1,    44,    -1,    44,    56,    -1,    -1,    52,    45,    53,
-      -1,    -1,    52,    11,    46,    53,    -1,    -1,    52,    11,
-      16,    47,    63,    -1,    -1,    52,    11,    13,    48,    53,
-      -1,    -1,    52,    11,    13,    49,    52,    -1,    -1,    52,
-      11,    17,    50,    52,    -1,    -1,    52,    11,    13,    17,
-      51,    52,    -1,     4,    -1,     3,    -1,    52,    16,    -1,
-      52,    18,    -1,    52,    17,    -1,    52,    13,    -1,    52,
-       4,    -1,    52,     3,    -1,    -1,    19,    54,     3,    -1,
-      -1,    19,    55,     4,    -1,    -1,    60,    -1,    -1,     5,
-      57,    63,    -1,    -1,     5,    58,    71,    -1,    -1,    56,
-       5,    59,    71,    -1,    -1,    20,    61,     3,    -1,    -1,
-      60,    20,    62,    52,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,     3,    64,    13,    65,     4,    66,    13,    67,     3,
-      68,    13,    69,    70,    -1,     4,    -1,     3,    -1,    -1,
-       4,    -1,    71,     3,    -1,    71,     4,    -1,    71,    16,
-      -1,    71,    20,    -1,    71,    21,    -1,    73,    30,    74,
-      -1,    73,    30,     1,    30,    -1,    22,    -1,    73,     9,
-      -1,    75,    30,    -1,    74,    75,    30,    -1,    10,    -1
+      25,     0,    -1,    32,    74,    -1,    32,    -1,    74,    -1,
+      -1,    -1,    -1,    -1,    53,    26,    12,    27,    14,    28,
+      43,    14,    29,    76,    -1,     5,     1,    31,    -1,    30,
+      -1,     0,    -1,    31,    30,    -1,     7,    -1,    33,    31,
+      36,    -1,    33,    31,     1,    31,    -1,     1,    31,    36,
+      -1,    -1,    15,    34,    44,    -1,    -1,    16,    35,    44,
+      -1,    37,    -1,    40,    -1,    -1,     8,    38,    31,    -1,
+      -1,    37,     8,    39,    31,    -1,    -1,     9,    41,    31,
+      -1,    -1,    40,     9,    42,    31,    -1,     8,    -1,     9,
+      -1,    45,    -1,    45,    57,    -1,    73,    -1,    -1,    53,
+      46,    54,    -1,    -1,    53,    12,    47,    54,    -1,    -1,
+      53,    12,    17,    48,    64,    -1,    -1,    53,    12,    14,
+      49,    54,    -1,    -1,    53,    12,    14,    50,    53,    -1,
+      -1,    53,    12,    18,    51,    53,    -1,    -1,    53,    12,
+      14,    18,    52,    53,    -1,     5,    -1,     4,    -1,    53,
+      17,    -1,    53,    19,    -1,    53,    18,    -1,    53,    14,
+      -1,    53,     5,    -1,    53,     4,    -1,    -1,    20,    55,
+       4,    -1,    -1,    20,    56,     5,    -1,    -1,    61,    -1,
+      -1,     6,    58,    64,    -1,    -1,     6,    59,    72,    -1,
+      -1,    57,     6,    60,    72,    -1,    -1,    21,    62,     4,
+      -1,    -1,    61,    21,    63,    53,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,     4,    65,    14,    66,     5,    67,    14,
+      68,     4,    69,    14,    70,    71,    -1,     5,    -1,     4,
+      -1,    -1,     5,    -1,    72,     4,    -1,    72,     5,    -1,
+      72,    17,    -1,    72,    21,    -1,    72,    22,    -1,     3,
+      18,     4,    -1,     3,    21,     4,    -1,    73,     6,    72,
+      -1,    73,     6,     4,    -1,    73,     6,     4,    72,    -1,
+      75,    31,    76,    -1,    75,    31,     1,    31,    -1,    23,
+      -1,    75,    10,    -1,    77,    31,    -1,    76,    77,    31,
+      -1,    11,    -1
 };
 
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,    75,    75,    77,    79,    81,    82,    83,    85,    81,
-      88,    90,    94,    95,    99,   103,   104,   105,   109,   109,
-     110,   110,   114,   115,   119,   119,   121,   121,   126,   126,
-     128,   128,   133,   134,   139,   140,   144,   144,   146,   146,
-     149,   148,   155,   155,   157,   157,   159,   159,   161,   161,
-     166,   167,   168,   169,   170,   171,   172,   173,   177,   177,
-     179,   179,   181,   185,   186,   186,   188,   188,   190,   190,
-     195,   194,   207,   206,   218,   219,   220,   221,   222,   223,
-     218,   228,   229,   230,   234,   235,   236,   237,   238,   239,
-     245,   246,   250,   251,   255,   256,   259
+       0,    77,    77,    79,    81,    83,    84,    85,    87,    83,
+      90,    92,    96,    97,   101,   105,   106,   107,   111,   111,
+     112,   112,   116,   117,   121,   121,   123,   123,   128,   128,
+     130,   130,   135,   136,   141,   142,   143,   147,   147,   149,
+     149,   152,   151,   158,   158,   160,   160,   162,   162,   164,
+     164,   169,   170,   171,   172,   173,   174,   175,   176,   180,
+     180,   182,   182,   184,   188,   189,   189,   191,   191,   193,
+     193,   198,   197,   210,   209,   221,   222,   223,   224,   225,
+     226,   221,   231,   232,   233,   237,   238,   239,   240,   241,
+     242,   246,   247,   248,   249,   250,   256,   257,   261,   262,
+     266,   267,   270
 };
 #endif
 
@@ -491,17 +497,18 @@ static const yytype_uint16 yyrline[] =
    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
 static const char *const yytname[] =
 {
-  "fqENDOFTEXT", "error", "$undefined", "fqNUMBER", "fqALPHANUM", "fqWS",
-  "fqENDLINE", "fqBASESEQ", "fqCOLORSEQ", "fqTOKEN", "fqASCQUAL",
-  "fqCOORDS", "fqUNRECOGNIZED", "':'", "'@'", "'>'", "'_'", "'.'", "'-'",
-  "'#'", "'/'", "'='", "'+'", "$accept", "sequence", "$@1", "$@2", "$@3",
-  "$@4", "endfile", "endline", "readLines", "header", "$@5", "$@6", "read",
-  "baseRead", "$@7", "$@8", "csRead", "$@9", "$@10", "inlineRead",
-  "tagLine", "nameSpotGroup", "$@11", "$@12", "$@13", "$@14", "$@15",
-  "$@16", "$@17", "name", "spotGroup", "$@18", "$@19", "readNumberOrTail",
-  "$@20", "$@21", "$@22", "readNumber", "$@23", "$@24", "casava1_8",
-  "$@25", "$@26", "$@27", "$@28", "$@29", "$@30", "indexSequence", "tail",
-  "qualityLines", "qualityHeader", "quality", "qualityLine", 0
+  "fqENDOFTEXT", "error", "$undefined", "fqRUNDOTSPOT", "fqNUMBER",
+  "fqALPHANUM", "fqWS", "fqENDLINE", "fqBASESEQ", "fqCOLORSEQ", "fqTOKEN",
+  "fqASCQUAL", "fqCOORDS", "fqUNRECOGNIZED", "':'", "'@'", "'>'", "'_'",
+  "'.'", "'-'", "'#'", "'/'", "'='", "'+'", "$accept", "sequence", "$@1",
+  "$@2", "$@3", "$@4", "endfile", "endline", "readLines", "header", "$@5",
+  "$@6", "read", "baseRead", "$@7", "$@8", "csRead", "$@9", "$@10",
+  "inlineRead", "tagLine", "nameSpotGroup", "$@11", "$@12", "$@13", "$@14",
+  "$@15", "$@16", "$@17", "name", "spotGroup", "$@18", "$@19",
+  "readNumberOrTail", "$@20", "$@21", "$@22", "readNumber", "$@23", "$@24",
+  "casava1_8", "$@25", "$@26", "$@27", "$@28", "$@29", "$@30",
+  "indexSequence", "tail", "runSpotRead", "qualityLines", "qualityHeader",
+  "quality", "qualityLine", 0
 };
 #endif
 
@@ -511,24 +518,25 @@ static const char *const yytname[] =
 static const yytype_uint16 yytoknum[] =
 {
        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
-     265,   266,   267,    58,    64,    62,    95,    46,    45,    35,
-      47,    61,    43
+     265,   266,   267,   268,    58,    64,    62,    95,    46,    45,
+      35,    47,    61,    43
 };
 # endif
 
 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
 static const yytype_uint8 yyr1[] =
 {
-       0,    23,    24,    24,    24,    25,    26,    27,    28,    24,
-      24,    24,    29,    29,    30,    31,    31,    31,    33,    32,
-      34,    32,    35,    35,    37,    36,    38,    36,    40,    39,
-      41,    39,    42,    42,    43,    43,    45,    44,    46,    44,
-      47,    44,    48,    44,    49,    44,    50,    44,    51,    44,
-      52,    52,    52,    52,    52,    52,    52,    52,    54,    53,
-      55,    53,    53,    56,    57,    56,    58,    56,    59,    56,
-      61,    60,    62,    60,    64,    65,    66,    67,    68,    69,
-      63,    70,    70,    70,    71,    71,    71,    71,    71,    71,
-      72,    72,    73,    73,    74,    74,    75
+       0,    24,    25,    25,    25,    26,    27,    28,    29,    25,
+      25,    25,    30,    30,    31,    32,    32,    32,    34,    33,
+      35,    33,    36,    36,    38,    37,    39,    37,    41,    40,
+      42,    40,    43,    43,    44,    44,    44,    46,    45,    47,
+      45,    48,    45,    49,    45,    50,    45,    51,    45,    52,
+      45,    53,    53,    53,    53,    53,    53,    53,    53,    55,
+      54,    56,    54,    54,    57,    58,    57,    59,    57,    60,
+      57,    62,    61,    63,    61,    65,    66,    67,    68,    69,
+      70,    64,    71,    71,    71,    72,    72,    72,    72,    72,
+      72,    73,    73,    73,    73,    73,    74,    74,    75,    75,
+      76,    76,    77
 };
 
 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
@@ -537,13 +545,14 @@ static const yytype_uint8 yyr2[] =
        0,     2,     2,     1,     1,     0,     0,     0,     0,    10,
        3,     1,     1,     2,     1,     3,     4,     3,     0,     3,
        0,     3,     1,     1,     0,     3,     0,     4,     0,     3,
-       0,     4,     1,     1,     1,     2,     0,     3,     0,     4,
-       0,     5,     0,     5,     0,     5,     0,     5,     0,     6,
-       1,     1,     2,     2,     2,     2,     2,     2,     0,     3,
-       0,     3,     0,     1,     0,     3,     0,     3,     0,     4,
-       0,     3,     0,     4,     0,     0,     0,     0,     0,     0,
-      13,     1,     1,     0,     1,     2,     2,     2,     2,     2,
-       3,     4,     1,     2,     2,     3,     1
+       0,     4,     1,     1,     1,     2,     1,     0,     3,     0,
+       4,     0,     5,     0,     5,     0,     5,     0,     5,     0,
+       6,     1,     1,     2,     2,     2,     2,     2,     2,     0,
+       3,     0,     3,     0,     1,     0,     3,     0,     3,     0,
+       4,     0,     3,     0,     4,     0,     0,     0,     0,     0,
+       0,    13,     1,     1,     0,     1,     2,     2,     2,     2,
+       2,     3,     3,     3,     3,     4,     3,     4,     1,     2,
+       2,     3,     1
 };
 
 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
@@ -551,125 +560,130 @@ static const yytype_uint8 yyr2[] =
    means the default is an error.  */
 static const yytype_uint8 yydefact[] =
 {
-       0,    12,     0,    51,     0,    14,    18,    20,    92,     0,
+       0,    12,     0,    52,     0,    14,    18,    20,    98,     0,
       11,     0,     3,     0,     5,     4,     0,     0,     0,     0,
-       0,     1,    13,     2,     0,    57,    56,    55,    52,    54,
-      53,     0,    93,     0,    24,    28,    17,    22,    23,    10,
-      50,    19,    34,    36,    21,     0,    15,     6,     0,    96,
-      90,     0,     0,     0,    26,    30,    64,    70,    35,    63,
-      38,    62,    16,     0,    91,     0,    94,    25,    29,     0,
-       0,     0,     0,     0,    68,    72,    42,    40,    46,    62,
-      58,    37,     7,    95,    27,    31,    74,    65,    84,    67,
-      71,     0,     0,    48,    62,     0,     0,     0,    39,     0,
-       0,     0,     0,    85,    86,    87,    88,    89,    69,    73,
-       0,    43,    45,    41,    47,    59,    61,    32,    33,     0,
-      75,    49,     8,     0,     0,    76,     9,     0,    77,     0,
-      78,     0,    79,    83,    82,    81,    80
+       0,     1,    13,     2,     0,    58,    57,    56,    53,    55,
+      54,     0,    99,     0,    24,    28,    17,    22,    23,    10,
+       0,    51,    19,    34,    37,    36,    21,     0,    15,     6,
+       0,   102,    96,     0,     0,     0,    26,    30,     0,     0,
+      65,    71,    35,    64,    39,    63,     0,    16,     0,    97,
+       0,   100,    25,    29,     0,     0,    91,    92,     0,     0,
+       0,    69,    73,    43,    41,    47,    63,    59,    38,    94,
+      85,    93,     7,   101,    27,    31,    75,    66,    68,    72,
+       0,     0,    49,    63,     0,     0,     0,    40,     0,     0,
+      95,    86,    87,    88,    89,    90,     0,     0,    70,    74,
+       0,    44,    46,    42,    48,    60,    62,    32,    33,     0,
+      76,    50,     8,     0,     0,    77,     9,     0,    78,     0,
+      79,     0,    80,    84,    83,    82,    81
 };
 
 /* YYDEFGOTO[NTERM-NUM].  */
 static const yytype_int16 yydefgoto[] =
 {
-      -1,     9,    31,    63,   101,   124,    10,    11,    12,    13,
-      19,    20,    36,    37,    52,    69,    38,    53,    70,   119,
-      41,    42,    61,    79,    96,    94,    95,    97,   110,    43,
-      81,    99,   100,    58,    71,    72,    91,    59,    73,    92,
-      87,   102,   123,   127,   129,   131,   133,   136,    89,    15,
-      16,    50,    51
+      -1,     9,    31,    68,   116,   134,    10,    11,    12,    13,
+      19,    20,    36,    37,    54,    74,    38,    55,    75,   129,
+      42,    43,    65,    86,   105,   103,   104,   106,   120,    44,
+      88,   108,   109,    62,    78,    79,   100,    63,    80,   101,
+      97,   117,   133,   137,   139,   141,   143,   146,    91,    45,
+      15,    16,    52,    53
 };
 
 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
    STATE-NUM.  */
-#define YYPACT_NINF -69
+#define YYPACT_NINF -80
 static const yytype_int8 yypact[] =
 {
-       6,   -69,    -1,   -69,    44,   -69,   -69,   -69,   -69,    16,
-     -69,     2,    -4,    -1,    71,   -69,    23,    29,    -1,    38,
-      38,   -69,   -69,   -69,    26,   -69,   -69,   -69,   -69,   -69,
-     -69,    20,   -69,     3,   -69,   -69,   -69,    49,    50,   -69,
-     -69,   -69,    10,    65,   -69,    -1,   -69,   -69,    -1,   -69,
-      53,    -1,    -1,    -1,   -69,   -69,    55,   -69,    59,    45,
-      77,    48,   -69,    60,   -69,    -1,   -69,   -69,   -69,    -1,
-      -1,    69,    75,    82,   -69,   -69,    21,   -69,   -69,    48,
-      76,   -69,   -69,   -69,   -69,   -69,   -69,   -69,   -69,    19,
-     -69,    75,    38,   -69,    48,    38,    69,    38,   -69,    83,
-      87,    36,    85,   -69,   -69,   -69,   -69,   -69,    19,    71,
-      38,   -69,    71,   -69,    71,   -69,   -69,   -69,   -69,    86,
-     -69,    71,   -69,    92,    53,   -69,    53,    88,   -69,    97,
-     -69,    89,   -69,    47,   -69,   -69,   -69
+       5,   -80,    -5,   -80,    21,   -80,   -80,   -80,   -80,    16,
+     -80,     4,    30,    -5,    73,   -80,    42,    23,    -5,    76,
+      76,   -80,   -80,   -80,    33,   -80,   -80,   -80,   -80,   -80,
+     -80,    15,   -80,    12,   -80,   -80,   -80,    50,    59,   -80,
+      45,   -80,   -80,     9,    55,    64,   -80,    -5,   -80,   -80,
+      -5,   -80,    75,    -5,    -5,    -5,   -80,   -80,    91,    92,
+      79,   -80,    93,    77,    29,    82,    60,   -80,    83,   -80,
+      -5,   -80,   -80,   -80,    -5,    -5,   -80,   -80,    96,    98,
+     101,   -80,   -80,    32,   -80,   -80,    82,   102,   -80,    98,
+     -80,    40,   -80,   -80,   -80,   -80,   -80,   -80,    40,   -80,
+      98,    78,   -80,    82,    78,    96,    78,   -80,   104,   105,
+      40,   -80,   -80,   -80,   -80,   -80,    80,    95,    40,    73,
+      78,   -80,    73,   -80,    73,   -80,   -80,   -80,   -80,    97,
+     -80,    73,   -80,   107,    75,   -80,    75,    99,   -80,   110,
+     -80,   103,   -80,    89,   -80,   -80,   -80
 };
 
 /* YYPGOTO[NTERM-NUM].  */
 static const yytype_int8 yypgoto[] =
 {
-     -69,   -69,   -69,   -69,   -69,   -69,    93,     1,   -69,   -69,
-     -69,   -69,    79,   -69,   -69,   -69,   -69,   -69,   -69,   -69,
-      91,   -69,   -69,   -69,   -69,   -69,   -69,   -69,   -69,     0,
-     -68,   -69,   -69,   -69,   -69,   -69,   -69,   -69,   -69,   -69,
-       9,   -69,   -69,   -69,   -69,   -69,   -69,   -69,    15,    95,
-     -69,   -16,   -49
+     -80,   -80,   -80,   -80,   -80,   -80,   108,     1,   -80,   -80,
+     -80,   -80,    94,   -80,   -80,   -80,   -80,   -80,   -80,   -80,
+     106,   -80,   -80,   -80,   -80,   -80,   -80,   -80,   -80,     0,
+     -79,   -80,   -80,   -80,   -80,   -80,   -80,   -80,   -80,   -80,
+      10,   -80,   -80,   -80,   -80,   -80,   -80,   -80,   -71,   -80,
+     109,   -80,   -18,   -51
 };
 
 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
    positive, shift that token.  If negative, reduce the rule which
    number is the opposite.  If YYTABLE_NINF, syntax error.  */
-#define YYTABLE_NINF -67
+#define YYTABLE_NINF -68
 static const yytype_int16 yytable[] =
 {
-      14,    65,     1,    17,    48,     5,     1,     2,     5,     3,
-       4,    98,     5,    49,    24,    56,    21,    33,     8,    39,
-       6,     7,   103,   104,   -44,   -44,   111,    45,     8,     5,
-      57,    47,    32,    34,    35,   105,    34,    35,    93,   106,
-     107,     3,    40,   117,   118,    18,    62,   -50,   -50,    64,
-     134,   135,    66,    67,    68,   -50,    54,   -50,    55,   -66,
-     -50,   -50,   -50,    49,    74,    75,    83,    80,    25,    26,
-      84,    85,    86,    82,    25,    26,    60,    65,    27,    88,
-     -60,    28,    29,    30,    27,    90,   115,    28,    29,    30,
-      76,   116,   109,    77,    78,   112,   125,   114,   120,   122,
-     130,   128,   132,    46,    22,   113,   108,    23,   126,     0,
-     121,    44
+      14,    70,     5,    17,     1,     1,     2,   107,    98,     3,
+       4,     5,     5,    50,    24,    60,    21,    33,   110,    39,
+       6,     7,    18,    51,   121,   -51,   -51,    49,     8,   118,
+      61,    34,    35,   -51,    47,   -51,   -45,   -45,   -51,   -51,
+     -51,    34,    35,    83,   111,   112,    84,    85,    67,     5,
+     102,    69,    32,     8,    71,    72,    73,   113,    56,    25,
+      26,   114,   115,    58,    89,    90,    59,    64,    57,    27,
+      66,    93,    28,    29,    30,    94,    95,    25,    26,    40,
+       3,    41,     3,    41,   -67,    70,    51,    27,   127,   128,
+      28,    29,    30,   144,   145,    76,    77,    92,    82,    81,
+      96,   119,    87,    90,   122,    99,   124,   -61,   125,   130,
+     126,   132,   135,   138,   140,   123,   136,   142,    48,    22,
+     131,    23,     0,     0,     0,     0,    46
 };
 
 #define yypact_value_is_default(yystate) \
-  ((yystate) == (-69))
+  ((yystate) == (-80))
 
 #define yytable_value_is_error(yytable_value) \
   YYID (0)
 
-static const yytype_int8 yycheck[] =
+static const yytype_int16 yycheck[] =
 {
-       0,    50,     0,     2,     1,     6,     0,     1,     6,     3,
-       4,    79,     6,    10,    13,     5,     0,    16,    22,    18,
-      14,    15,     3,     4,     3,     4,    94,     1,    22,     6,
-      20,    11,     9,     7,     8,    16,     7,     8,    17,    20,
-      21,     3,     4,     7,     8,     1,    45,     3,     4,    48,
-       3,     4,    51,    52,    53,    11,     7,    13,     8,     4,
-      16,    17,    18,    10,     5,    20,    65,    19,     3,     4,
-      69,    70,     3,    13,     3,     4,    11,   126,    13,     4,
-       4,    16,    17,    18,    13,     3,     3,    16,    17,    18,
-      13,     4,    92,    16,    17,    95,     4,    97,    13,    13,
-       3,    13,    13,    24,    11,    96,    91,    12,   124,    -1,
-     110,    20
+       0,    52,     7,     2,     0,     0,     1,    86,    79,     4,
+       5,     7,     7,     1,    13,     6,     0,    16,    89,    18,
+      15,    16,     1,    11,   103,     4,     5,    12,    23,   100,
+      21,     8,     9,    12,     1,    14,     4,     5,    17,    18,
+      19,     8,     9,    14,     4,     5,    17,    18,    47,     7,
+      18,    50,    10,    23,    53,    54,    55,    17,     8,     4,
+       5,    21,    22,    18,     4,     5,    21,    12,     9,    14,
+       6,    70,    17,    18,    19,    74,    75,     4,     5,     3,
+       4,     5,     4,     5,     5,   136,    11,    14,     8,     9,
+      17,    18,    19,     4,     5,     4,     4,    14,    21,     6,
+       4,   101,    20,     5,   104,     4,   106,     5,     4,    14,
+       5,    14,     5,    14,     4,   105,   134,    14,    24,    11,
+     120,    12,    -1,    -1,    -1,    -1,    20
 };
 
 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
    symbol of state STATE-NUM.  */
 static const yytype_uint8 yystos[] =
 {
-       0,     0,     1,     3,     4,     6,    14,    15,    22,    24,
-      29,    30,    31,    32,    52,    72,    73,    30,     1,    33,
-      34,     0,    29,    72,    30,     3,     4,    13,    16,    17,
-      18,    25,     9,    30,     7,     8,    35,    36,    39,    30,
-       4,    43,    44,    52,    43,     1,    35,    11,     1,    10,
-      74,    75,    37,    40,     7,     8,     5,    20,    56,    60,
-      11,    45,    30,    26,    30,    75,    30,    30,    30,    38,
-      41,    57,    58,    61,     5,    20,    13,    16,    17,    46,
-      19,    53,    13,    30,    30,    30,     3,    63,     4,    71,
-       3,    59,    62,    17,    48,    49,    47,    50,    53,    54,
-      55,    27,    64,     3,     4,    16,    20,    21,    71,    52,
-      51,    53,    52,    63,    52,     3,     4,     7,     8,    42,
-      13,    52,    13,    65,    28,     4,    74,    66,    13,    67,
-       3,    68,    13,    69,     3,     4,    70
+       0,     0,     1,     4,     5,     7,    15,    16,    23,    25,
+      30,    31,    32,    33,    53,    74,    75,    31,     1,    34,
+      35,     0,    30,    74,    31,     4,     5,    14,    17,    18,
+      19,    26,    10,    31,     8,     9,    36,    37,    40,    31,
+       3,     5,    44,    45,    53,    73,    44,     1,    36,    12,
+       1,    11,    76,    77,    38,    41,     8,     9,    18,    21,
+       6,    21,    57,    61,    12,    46,     6,    31,    27,    31,
+      77,    31,    31,    31,    39,    42,     4,     4,    58,    59,
+      62,     6,    21,    14,    17,    18,    47,    20,    54,     4,
+       5,    72,    14,    31,    31,    31,     4,    64,    72,     4,
+      60,    63,    18,    49,    50,    48,    51,    54,    55,    56,
+      72,     4,     5,    17,    21,    22,    28,    65,    72,    53,
+      52,    54,    53,    64,    53,     4,     5,     8,     9,    43,
+      14,    53,    14,    66,    29,     5,    76,    67,    14,    68,
+       4,    69,    14,    70,     4,     5,    71
 };
 
 #define yyerrok		(yyerrstatus = 0)
@@ -1608,17 +1622,17 @@ yyreduce:
     { SetRead(pb, & (yyvsp[(1) - (1)])); pb->record->seq.is_colorspace = true; }
     break;
 
-  case 36:
+  case 37:
 
     { StopSpotName(pb); }
     break;
 
-  case 38:
+  case 39:
 
     { GrowSpotName(pb, &(yyvsp[(2) - (2)])); StopSpotName(pb); }
     break;
 
-  case 40:
+  case 41:
 
     {   /* another crazy variation by Illumina, this time "_" is used as " /" */
                     GrowSpotName(pb, &(yyvsp[(2) - (3)])); 
@@ -1627,31 +1641,26 @@ yyreduce:
                 }
     break;
 
-  case 42:
+  case 43:
 
     { GrowSpotName(pb, &(yyvsp[(2) - (3)])); GrowSpotName(pb, &(yyvsp[(3) - (3)])); StopSpotName(pb); }
     break;
 
-  case 44:
+  case 45:
 
     { GrowSpotName(pb, &(yyvsp[(2) - (3)])); GrowSpotName(pb, &(yyvsp[(3) - (3)]));}
     break;
 
-  case 46:
+  case 47:
 
     { GrowSpotName(pb, &(yyvsp[(2) - (3)])); GrowSpotName(pb, &(yyvsp[(3) - (3)]));}
     break;
 
-  case 48:
+  case 49:
 
     { GrowSpotName(pb, &(yyvsp[(2) - (4)])); GrowSpotName(pb, &(yyvsp[(3) - (4)])); GrowSpotName(pb, &(yyvsp[(3) - (4)]));}
     break;
 
-  case 50:
-
-    { GrowSpotName(pb, &(yyvsp[(1) - (1)])); }
-    break;
-
   case 51:
 
     { GrowSpotName(pb, &(yyvsp[(1) - (1)])); }
@@ -1659,7 +1668,7 @@ yyreduce:
 
   case 52:
 
-    { GrowSpotName(pb, &(yyvsp[(2) - (2)])); }
+    { GrowSpotName(pb, &(yyvsp[(1) - (1)])); }
     break;
 
   case 53:
@@ -1689,40 +1698,45 @@ yyreduce:
 
   case 58:
 
-    { GrowSpotName(pb, &(yyvsp[(1) - (1)])); }
+    { GrowSpotName(pb, &(yyvsp[(2) - (2)])); }
     break;
 
   case 59:
 
-    { SetSpotGroup(pb, &(yyvsp[(3) - (3)]));  GrowSpotName(pb, &(yyvsp[(3) - (3)])); }
+    { GrowSpotName(pb, &(yyvsp[(1) - (1)])); }
     break;
 
   case 60:
 
-    { GrowSpotName(pb, &(yyvsp[(1) - (1)])); }
+    { SetSpotGroup(pb, &(yyvsp[(3) - (3)]));  GrowSpotName(pb, &(yyvsp[(3) - (3)])); }
     break;
 
   case 61:
 
+    { GrowSpotName(pb, &(yyvsp[(1) - (1)])); }
+    break;
+
+  case 62:
+
     { SetSpotGroup(pb, &(yyvsp[(3) - (3)]));  GrowSpotName(pb, &(yyvsp[(3) - (3)])); }
     break;
 
-  case 64:
+  case 65:
 
     { GrowSpotName(pb, &(yyvsp[(1) - (1)])); }
     break;
 
-  case 66:
+  case 67:
 
     { GrowSpotName(pb, &(yyvsp[(1) - (1)])); }
     break;
 
-  case 68:
+  case 69:
 
     { GrowSpotName(pb, &(yyvsp[(2) - (2)])); }
     break;
 
-  case 70:
+  case 71:
 
     {   /* in PACBIO fastq, the first '/' and the following digits are treated as a continuation of the spot name, not a read number */
             if (IS_PACBIO(pb)) pb->spotNameDone = false; 
@@ -1730,7 +1744,7 @@ yyreduce:
         }
     break;
 
-  case 71:
+  case 72:
 
     { 
             if (!IS_PACBIO(pb)) SetReadNumber(pb, &(yyvsp[(3) - (3)])); 
@@ -1739,7 +1753,7 @@ yyreduce:
         }
     break;
 
-  case 72:
+  case 73:
 
     { 
             if (IS_PACBIO(pb)) pb->spotNameDone = false; 
@@ -1747,61 +1761,56 @@ yyreduce:
         }
     break;
 
-  case 73:
+  case 74:
 
     { 
             if (IS_PACBIO(pb)) StopSpotName(pb); 
         }
     break;
 
-  case 74:
+  case 75:
 
     { SetReadNumber(pb, &(yyvsp[(1) - (1)])); GrowSpotName(pb, &(yyvsp[(1) - (1)])); StopSpotName(pb); }
     break;
 
-  case 75:
+  case 76:
 
     { GrowSpotName(pb, &(yyvsp[(3) - (3)])); }
     break;
 
-  case 76:
+  case 77:
 
     { GrowSpotName(pb, &(yyvsp[(5) - (5)])); if ((yyvsp[(5) - (5)]).tokenLength == 1 && TokenTextPtr(pb, &(yyvsp[(5) - (5)]))[0] == 'Y') pb->record->seq.lowQuality = true; }
     break;
 
-  case 77:
+  case 78:
 
     { GrowSpotName(pb, &(yyvsp[(7) - (7)])); }
     break;
 
-  case 78:
+  case 79:
 
     { GrowSpotName(pb, &(yyvsp[(9) - (9)])); }
     break;
 
-  case 79:
+  case 80:
 
     { GrowSpotName(pb, &(yyvsp[(11) - (11)])); }
     break;
 
-  case 81:
-
-    { SetSpotGroup(pb, &(yyvsp[(1) - (1)])); GrowSpotName(pb, &(yyvsp[(1) - (1)])); }
-    break;
-
   case 82:
 
     { SetSpotGroup(pb, &(yyvsp[(1) - (1)])); GrowSpotName(pb, &(yyvsp[(1) - (1)])); }
     break;
 
-  case 84:
+  case 83:
 
-    { GrowSpotName(pb, &(yyvsp[(1) - (1)])); }
+    { SetSpotGroup(pb, &(yyvsp[(1) - (1)])); GrowSpotName(pb, &(yyvsp[(1) - (1)])); }
     break;
 
   case 85:
 
-    { GrowSpotName(pb, &(yyvsp[(2) - (2)])); }
+    { GrowSpotName(pb, &(yyvsp[(1) - (1)])); }
     break;
 
   case 86:
@@ -1824,7 +1833,22 @@ yyreduce:
     { GrowSpotName(pb, &(yyvsp[(2) - (2)])); }
     break;
 
-  case 96:
+  case 90:
+
+    { GrowSpotName(pb, &(yyvsp[(2) - (2)])); }
+    break;
+
+  case 91:
+
+    { SetReadNumber(pb, &(yyvsp[(3) - (3)])); GrowSpotName(pb, &(yyvsp[(3) - (3)])); StopSpotName(pb); }
+    break;
+
+  case 92:
+
+    { SetReadNumber(pb, &(yyvsp[(3) - (3)])); GrowSpotName(pb, &(yyvsp[(3) - (3)])); StopSpotName(pb); }
+    break;
+
+  case 102:
 
     {  AddQuality(pb, & (yyvsp[(1) - (1)])); }
     break;
diff --git a/tools/fastq-loader/fastq-grammar.y b/tools/fastq-loader/fastq-grammar.y
index 66c36ef..25559f9 100644
--- a/tools/fastq-loader/fastq-grammar.y
+++ b/tools/fastq-loader/fastq-grammar.y
@@ -25,31 +25,39 @@
 */
  
 %{  
+    #include <sysalloc.h>
     #include <ctype.h>
     #include <stdlib.h>
+    #include <string.h>
 
-	#include "fastq-parse.h"
+    #include "fastq-parse.h"
 
-   	#define YYSTYPE FASTQToken
+    #define YYSTYPE FASTQToken
     #define YYLEX_PARAM pb->scanner
     #define YYDEBUG 1
 
-	#include "fastq-tokens.h"
+    #include "fastq-tokens.h"
 
-    static uint64_t string_touint(const char* str, size_t length);
-    static void AddBinaryQuality(FASTQParseBlock* pb, int8_t value);
+    static void AddQuality(FASTQParseBlock* pb, const FASTQToken* token);
     static void SetReadNumber(FASTQParseBlock* pb, const FASTQToken* token);
-    static void SetTagLine(FASTQParseBlock* pb, const char* start, size_t length, const FASTQToken* coords);
+    static void StartSpotName(FASTQParseBlock* pb, size_t offset);
+    static void GrowSpotName(FASTQParseBlock* pb, const FASTQToken* token);
+    static void StopSpotName(FASTQParseBlock* pb);
     static void SetSpotGroup(FASTQParseBlock* pb, const FASTQToken* token);
+    static void SetRead(FASTQParseBlock* pb, const FASTQToken* token);
 
+    #define UNLEX do { if (yychar != YYEMPTY && yychar != YYEOF) FASTQ_unlex(pb, & yylval); } while (0)
+    
+    #define IS_PACBIO(pb) ((pb)->defaultReadNumber == -1)
 %}
 
 %pure-parser
 %parse-param {FASTQParseBlock* pb }
 %lex-param {FASTQParseBlock* pb }
-
+%error-verbose 
 %name-prefix="FASTQ_"
 
+%token fqRUNDOTSPOT
 %token fqNUMBER
 %token fqALPHANUM
 %token fqWS
@@ -57,28 +65,35 @@
 %token fqBASESEQ
 %token fqCOLORSEQ
 %token fqTOKEN
-%token fqASC33QUAL
-%token fqASC64QUAL
+%token fqASCQUAL
+%token fqCOORDS
 %token fqUNRECOGNIZED
 %token fqENDOFTEXT 0
 
+
 %%
 
-sequence
-    : readLines qualityLines    { return 1; }
-    | readLines                 { if (yychar != YYEMPTY && yychar != YYEOF) FASTQ_unlex(pb, & yylval); return 1; }
-    | readQualityLines          { return 1; }
-    | qualityLines              { return 1; } 
-    | name ':' coords ':'           { FASTQScan_inline_sequence(pb); } 
-                 read ':'           { FASTQScan_inline_quality(pb); } 
-                 quality endline    { return 1; }
-    | name error endline        { return 1; }
+sequence /* have to return the lookahead symbol before returning since it belongs to the next record and cannot be dropped */
+    : readLines qualityLines    { UNLEX; return 1; }
+    
+    | readLines                 { UNLEX; return 1; }
+    
+    | qualityLines              { UNLEX; return 1; } 
+    
+    | name                      { StartSpotName(pb, 0); }
+        fqCOORDS                { GrowSpotName(pb, &$3); StopSpotName(pb); }
+        ':'                     { FASTQScan_inline_sequence(pb); } 
+        inlineRead              
+        ':'                     { FASTQScan_inline_quality(pb); } 
+        quality                 { UNLEX; return 1; }
+           
+    | fqALPHANUM error endline  { UNLEX; return 1; }
+           
     | endfile                   { return 0; }
     ;
 
 endfile
     : fqENDOFTEXT
-    | endline fqENDOFTEXT
     | endline endfile
     ;
 
@@ -87,93 +102,158 @@ endline
     ;
 
 readLines
-    : header  endline  read endline  
-    | qheader endline  read endline  
+    : header  endline  read   
     | header  endline error endline
-    | error   endline  read endline
+    | error   endline  read 
     ;
 
-readQualityLines
-    : qheader endline quality endline
-    | qheader endline   error endline
+header 
+    : '@' { StartSpotName(pb, 1); } tagLine
+    | '>' { StartSpotName(pb, 1); } tagLine
     ;
 
 read
-    : fqBASESEQ                  { pb->record->seq.read = string_dup($1.tokenText, $1.tokenLength); pb->record->seq.is_colorspace = false; }
-    | fqCOLORSEQ                 { pb->record->seq.read = string_dup($1.tokenText, $1.tokenLength); pb->record->seq.is_colorspace = true; }
+    : baseRead  { pb->record->seq.is_colorspace = false; }
+    | csRead    { pb->record->seq.is_colorspace = true; }
     ;
 
-header 
-    : headerStart tagLine;
-
-headerStart
-    : '@' { pb->tagStart = $1.tokenText + 1; }
+baseRead
+    : fqBASESEQ { SetRead(pb, & $1); } 
+        endline            
+    | baseRead fqBASESEQ { SetRead(pb, & $2); } 
+        endline  
     ;
-
-qheader 
-    : qheaderStart tagLine;
-
-qheaderStart
-    : '>' { pb->tagStart = $1.tokenText + 1; }
+ 
+csRead
+    : fqCOLORSEQ { SetRead(pb, & $1); } 
+        endline           
+    | csRead fqCOLORSEQ { SetRead(pb, & $2); } 
+        endline
     ;
 
+inlineRead
+    : fqBASESEQ                   { SetRead(pb, & $1); pb->record->seq.is_colorspace = false; }
+    | fqCOLORSEQ                  { SetRead(pb, & $1); pb->record->seq.is_colorspace = true; }
+    ;
+    
+ /*************** tag line rules *****************/
 tagLine    
-    : name ':' coords tail  { SetTagLine(pb, $1.tokenText, $1.tokenLength + $2.tokenLength + $3.tokenLength + $4.tokenLength, &$3); }  
-    | name ':' coords       { SetTagLine(pb, $1.tokenText, $1.tokenLength + $2.tokenLength + $3.tokenLength, &$3); }  
-    | name                  { SetTagLine(pb, $1.tokenText, $1.tokenLength, 0); /* coords may be embbedded in the name with '_' as the separator */ }
-    | coords tail           { SetTagLine(pb, $1.tokenText, $1.tokenLength + $2.tokenLength, &$1); }  
-    | coords                { SetTagLine(pb, $1.tokenText, $1.tokenLength, &$1); }  
+    : nameSpotGroup 
+    | nameSpotGroup readNumberOrTail
+    | runSpotRead
     ;
-
+    
+nameSpotGroup
+    : name { StopSpotName(pb); } 
+        spotGroup 
+    | name fqCOORDS         { GrowSpotName(pb, &$2); StopSpotName(pb); }                                               
+        spotGroup
+    | name fqCOORDS '_' 
+                {   /* another crazy variation by Illumina, this time "_" is used as " /" */
+                    GrowSpotName(pb, &$2); 
+                    StopSpotName(pb);
+                    GrowSpotName(pb, &$3);
+                }    
+                casava1_8
+    | name fqCOORDS ':'     { GrowSpotName(pb, &$2); GrowSpotName(pb, &$3); StopSpotName(pb); }                          
+        spotGroup  
+    | name fqCOORDS ':'     { GrowSpotName(pb, &$2); GrowSpotName(pb, &$3);}                          
+        name
+    | name fqCOORDS '.'     { GrowSpotName(pb, &$2); GrowSpotName(pb, &$3);}                          
+        name
+    | name fqCOORDS ':' '.' { GrowSpotName(pb, &$2); GrowSpotName(pb, &$3); GrowSpotName(pb, &$3);}    
+        name
+    ;
+    
 name
-    : fqALPHANUM        { $$ = $1; }
-    | name '_'          { $$ = $1; $$.tokenLength += $2.tokenLength; }
-    | name '-'          { $$ = $1; $$.tokenLength += $2.tokenLength; }
-    | name fqALPHANUM   { $$ = $1; $$.tokenLength += $2.tokenLength; }
-    | name fqNUMBER     { $$ = $1; $$.tokenLength += $2.tokenLength; }
+    : fqALPHANUM        { GrowSpotName(pb, &$1); }
+    | fqNUMBER          { GrowSpotName(pb, &$1); }
+    | name '_'          { GrowSpotName(pb, &$2); }
+    | name '-'          { GrowSpotName(pb, &$2); }
+    | name '.'          { GrowSpotName(pb, &$2); }
+    | name ':'          { GrowSpotName(pb, &$2); }
+    | name fqALPHANUM   { GrowSpotName(pb, &$2); }
+    | name fqNUMBER     { GrowSpotName(pb, &$2); }
     ;
 
-coords
-    : fqNUMBER ':' fqNUMBER ':' signedNumber ':' signedNumber 
-        { $$ = $1; $$.tokenLength += ($2.tokenLength + $3.tokenLength + $4.tokenLength + $5.tokenLength + $6.tokenLength + $7.tokenLength); }
+spotGroup
+    : '#'           { GrowSpotName(pb, &$1); }
+        fqNUMBER    { SetSpotGroup(pb, &$3);  GrowSpotName(pb, &$3); }
+    | '#'           { GrowSpotName(pb, &$1); }    
+        fqALPHANUM  { SetSpotGroup(pb, &$3);  GrowSpotName(pb, &$3); }    
+    |
     ;
-
-signedNumber
-    : '+' fqNUMBER  { pb->signedNumber =    (int8_t)string_touint($2.tokenText, $2.tokenLength); }
-    | '-' fqNUMBER  { pb->signedNumber =  - (int8_t)string_touint($2.tokenText, $2.tokenLength); }
-    | fqNUMBER      { pb->signedNumber =    (int8_t)string_touint($1.tokenText, $1.tokenLength); }
+    
+readNumberOrTail
+    : readNumber
+    | fqWS  { GrowSpotName(pb, &$1); }    
+        casava1_8
+    | fqWS  { GrowSpotName(pb, &$1); }  
+        tail
+    | readNumberOrTail fqWS { GrowSpotName(pb, &$2); } tail
     ;
 
-tail
-    : tailPiece
-    | tail tailPiece
+readNumber
+    : '/'       
+        {   /* in PACBIO fastq, the first '/' and the following digits are treated as a continuation of the spot name, not a read number */
+            if (IS_PACBIO(pb)) pb->spotNameDone = false; 
+            GrowSpotName(pb, &$1); 
+        } 
+      fqNUMBER  
+        { 
+            if (!IS_PACBIO(pb)) SetReadNumber(pb, &$3); 
+            GrowSpotName(pb, &$3); 
+            StopSpotName(pb); 
+        }
+ 
+    | readNumber '/' 
+        { 
+            if (IS_PACBIO(pb)) pb->spotNameDone = false; 
+            GrowSpotName(pb, &$2); 
+        } 
+        name 
+        { 
+            if (IS_PACBIO(pb)) StopSpotName(pb); 
+        }
     ;
-
-tailPiece
-    : ':'                           { $$ = $1; }
-    | ':' fqNUMBER                  { $$ = $1; $$.tokenLength += $2.tokenLength; }
-    | '.' fqNUMBER                  { $$ = $1; $$.tokenLength += $2.tokenLength; }
     
-    | '#' fqNUMBER                  { $$ = $1; $$.tokenLength += $2.tokenLength; SetSpotGroup(pb, & $2); }
-    | '#' fqALPHANUM                { $$ = $1; $$.tokenLength += $2.tokenLength; SetSpotGroup(pb, & $2); }
-    | '/' fqNUMBER                  { $$ = $1; $$.tokenLength += $2.tokenLength; SetReadNumber(pb, & $2); }
-
-    | fqWS fqALPHANUM '=' value     { $$ = $1; $$.tokenLength += ($2.tokenLength + $3.tokenLength + $4.tokenLength); }
+casava1_8
+    : fqNUMBER          { SetReadNumber(pb, &$1); GrowSpotName(pb, &$1); StopSpotName(pb); }
+     ':'                { GrowSpotName(pb, &$3); }
+     fqALPHANUM         { GrowSpotName(pb, &$5); if ($5.tokenLength == 1 && TokenTextPtr(pb, &$5)[0] == 'Y') pb->record->seq.lowQuality = true; }
+     ':'                { GrowSpotName(pb, &$7); }
+     fqNUMBER           { GrowSpotName(pb, &$9); }
+     ':'                { GrowSpotName(pb, &$11); } 
+     indexSequence
     ;
-
-value
-    : anyToken                      
-    | value anyToken                { $$ = $1; $$.tokenLength += $2.tokenLength; }
+     
+indexSequence
+    : fqALPHANUM        { SetSpotGroup(pb, &$1); GrowSpotName(pb, &$1); } 
+    | fqNUMBER          { SetSpotGroup(pb, &$1); GrowSpotName(pb, &$1); } 
+    |
     ;
-
-anyToken
-    : fqNUMBER
-    | fqALPHANUM
-    |'_'
+    
+tail
+    : fqALPHANUM        { GrowSpotName(pb, &$1); }
+    | tail fqNUMBER          { GrowSpotName(pb, &$2); }
+    | tail fqALPHANUM        { GrowSpotName(pb, &$2); }
+    | tail '_'               { GrowSpotName(pb, &$2); }
+    | tail '/'               { GrowSpotName(pb, &$2); }
+    | tail '='               { GrowSpotName(pb, &$2); }
     ;
+   
+runSpotRead
+    : fqRUNDOTSPOT '.' fqNUMBER     { SetReadNumber(pb, &$3); GrowSpotName(pb, &$3); StopSpotName(pb); }
+    | fqRUNDOTSPOT '/' fqNUMBER     { SetReadNumber(pb, &$3); GrowSpotName(pb, &$3); StopSpotName(pb); }
+    | runSpotRead fqWS tail
+    | runSpotRead fqWS fqNUMBER 
+    | runSpotRead fqWS fqNUMBER tail
+    ;
+    
+ /*************** quality rules *****************/
 
 qualityLines
-    : qualityHeader endline quality endline
+    : qualityHeader endline quality 
     | qualityHeader endline error endline
     ;
 
@@ -183,112 +263,125 @@ qualityHeader
     ;
 
 quality
-    : fqASC33QUAL                { 
-                                    pb->record->seq.qualityBase     = 33; 
-                                    pb->record->seq.qualityType     = QT_Phred; 
-                                    pb->record->seq.quality         = (int8_t*)string_dup($1.tokenText, $1.tokenLength); 
-                                    pb->record->seq.qualityLength   = $1.tokenLength;
-                                 }
-    | fqASC64QUAL                { 
-                                    pb->record->seq.qualityBase     = 64; 
-                                    pb->record->seq.qualityType     = QT_Phred; 
-                                    pb->record->seq.quality         = (int8_t*)string_dup($1.tokenText, $1.tokenLength); 
-                                    pb->record->seq.qualityLength   = $1.tokenLength;
-                                 }
-    | decList                    {  /*consume the quality buffer */
-                                    pb->record->seq.qualityBase     = 0; 
-                                    pb->record->seq.qualityType     = QT_LogOdds; 
-                                    pb->record->seq.quality         = pb->quality.buffer; 
-                                    pb->record->seq.qualityLength   = pb->quality.curIdx;
-                                    pb->quality.buffer = 0; 
-                                    pb->quality.curIdx = 0;
-                                 }
-    ;
-
-decList
-    : signedNumber              { AddBinaryQuality(pb, (int8_t)pb->signedNumber); }
-    | decList signedNumber      { AddBinaryQuality(pb, (int8_t)pb->signedNumber); }
-    | decList ',' signedNumber  { AddBinaryQuality(pb, (int8_t)pb->signedNumber); }
+    : qualityLine endline           
+    | quality qualityLine endline
+    
+qualityLine
+    : fqASCQUAL                {  AddQuality(pb, & $1); }
     ;
 
 %%
 
-static
-uint64_t string_touint(const char* str, size_t length)
+void AddQuality(FASTQParseBlock* pb, const FASTQToken* token)
 {
-    size_t i;
-    uint64_t ret = 0;
-    for (i = 0; i < length; ++i)
+    if (pb->phredOffset != 0)
     {
-        if (isdigit(str[i]))
+        uint8_t floor   = pb->phredOffset == 33 ? MIN_PHRED_33 : MIN_PHRED_64;
+        uint8_t ceiling = pb->maxPhred == 0 ? (pb->phredOffset == 33 ? MAX_PHRED_33 : MAX_PHRED_64) : pb->maxPhred;
+        unsigned int i;
+        for (i=0; i < token->tokenLength; ++i)
         {
-            ret = ret*10 + (str[i] - '0');
+            char buf[200];
+			char ch = TokenTextPtr(pb, token)[i];
+            if (ch < floor || ch > ceiling)
+            {
+                sprintf(buf, "Invalid quality value ('%c'=%d, position %d): for %s, valid range is from %d to %d.", 
+                                                         ch,
+														 ch,
+														 i,
+                                                         pb->phredOffset == 33 ? "Phred33": "Phred64", 
+                                                         floor, 
+                                                         ceiling);
+                pb->fatalError = true;
+                yyerror(pb, buf);
+                return;
+            }
         }
     }
-    return ret;
-}
-
-void AddBinaryQuality(FASTQParseBlock* pb, int8_t value)
-{
-    #define ChunkSize 128
-
-    if (pb->quality.buffer == 0) 
-    {   /* allocate based on the size of the previous buffer, if any */
-        if (pb->quality.bufLen == 0)
-        {
-            pb->quality.bufLen = ChunkSize;
-        }
-        pb->quality.buffer = (int8_t*)malloc(pb->quality.bufLen);
-        pb->quality.curIdx = 0;
+    if (pb->qualityLength == 0)
+    {
+        pb->qualityOffset = token->tokenStart;
+        pb->qualityLength= token->tokenLength;
     }
-    else if (pb->quality.curIdx == pb->quality.bufLen)
-    {   /* grow the buffer */
-        pb->quality.bufLen += ChunkSize;
-        pb->quality.buffer = (int8_t*)realloc(pb->quality.buffer, pb->quality.bufLen);
+    else
+    {
+        pb->qualityLength += token->tokenLength;
     }
-    pb->quality.buffer[pb->quality.curIdx] = value;
-    ++ pb->quality.curIdx;
-
-    #undef ChunkSize
 }
 
 void SetReadNumber(FASTQParseBlock* pb, const FASTQToken* token)
-{
-    if (token->tokenLength == 1)
-    {
-        switch (token->tokenText[0])
+{   /* token is known to be numeric */
+    if (pb->defaultReadNumber != -1)
+    {   /* we will only handle 1-digit read numbers for now*/
+        if (token->tokenLength == 1)
         {
-        case '1': pb->record->seq.readnumber = 1; return;
-        case '2': pb->record->seq.readnumber = 2; return;
+            switch (TokenTextPtr(pb, token)[0])
+            {
+            case '1': 
+                {
+                    pb->record->seq.readnumber = 1; 
+                    break;
+                }
+            case '0': 
+                {
+                    pb->record->seq.readnumber = pb->defaultReadNumber;
+                    break;
+                }
+            default: 
+                {   /* all secondary read numbers should be the same across an input file */
+                    uint8_t readNum = TokenTextPtr(pb, token)[0] - '0';
+                    if (pb->secondaryReadNumber == 0) /* this is the first secondary read observed */
+                    {
+                        pb->secondaryReadNumber = readNum;
+                    }
+                    else if (pb->secondaryReadNumber != readNum)
+                    {
+                        char buf[200];
+                        sprintf(buf, 
+                                "Inconsistent secondary read number: previously used %d, now seen %d", 
+                                pb->secondaryReadNumber, readNum);
+                        pb->fatalError = true;
+                        yyerror(pb, buf);
+                        return;
+                    }
+                    /* all secondary read numbers are internally represented as 2 */
+                    pb->record->seq.readnumber = 2; 
+                    
+                    break;
+                }
+            }
         }
+        else
+            pb->record->seq.readnumber = pb->defaultReadNumber;
     }
-    pb->record->seq.readnumber = 0;
 }
 
-void SetTagLine(FASTQParseBlock* pb, const char* start, size_t length, const FASTQToken* coords)
+void StartSpotName(FASTQParseBlock* pb, size_t offset)
 {
-    pb->record->seq.tagline = string_dup(start, length);
-    if (coords != 0)
-    {   /* assumes that a buffer switch can only happen at a line boundary*/ 
-        StringInit(& pb->record->seq.spotname, pb->record->seq.tagline, coords->tokenText - start + coords->tokenLength + 1, coords->tokenText - start + coords->tokenLength);
-    }
-    else
-    {
-        StringInit(& pb->record->seq.spotname, pb->record->seq.tagline, length + 1, length);
-    }
-    if (pb->spotGroupOffset != 0)
-    {
-        StringInit(& pb->record->seq.spotgroup, pb->record->seq.tagline + pb->spotGroupOffset, pb->spotGroupLength, pb->spotGroupLength);
-        pb->spotGroupOffset = 0;
-    }
-    else
-    {
-        StringInit(& pb->record->seq.spotgroup, 0, 0, 0);
-    }
+    pb->spotNameOffset = offset;
+}
+void GrowSpotName(FASTQParseBlock* pb, const FASTQToken* token)
+{
+    if (!pb->spotNameDone)
+        pb->spotNameLength += token->tokenLength;
+}
+
+void StopSpotName(FASTQParseBlock* pb)
+{   /* there may be more tokens coming, they will not be a part of the spot name */
+    pb->spotNameDone = true;
 }
 
 void SetSpotGroup(FASTQParseBlock* pb, const FASTQToken* token)
 {
-    pb->spotGroupOffset = token->tokenText - pb->tagStart;    
-    pb->spotGroupLength = token->tokenLength;
+    if (token->tokenLength != 1 || TokenTextPtr(pb, token)[0] != '0') /* ignore spot group 0 */
+    {
+        pb->spotGroupOffset = token->tokenStart;    
+        pb->spotGroupLength = token->tokenLength;
+    }
+}
+
+void SetRead(FASTQParseBlock* pb, const FASTQToken* token)
+{ 
+    pb->readOffset = token->tokenStart;
+    pb->readLength = token->tokenLength;
 }
diff --git a/tools/fastq-loader/fastq-lex.c b/tools/fastq-loader/fastq-lex.c
index 0152a84..d157484 100644
--- a/tools/fastq-loader/fastq-lex.c
+++ b/tools/fastq-loader/fastq-lex.c
@@ -361,8 +361,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
 	*yy_cp = '\0'; \
 	yyg->yy_c_buf_p = yy_cp;
 
-#define YY_NUM_RULES 28
-#define YY_END_OF_BUFFER 29
+#define YY_NUM_RULES 29
+#define YY_END_OF_BUFFER 30
 /* This struct is not used in this scanner,
    but its presence is necessary. */
 struct yy_trans_info
@@ -370,44 +370,46 @@ struct yy_trans_info
 	flex_int32_t yy_verify;
 	flex_int32_t yy_nxt;
 	};
-static yyconst flex_int16_t yy_acclist[178] =
+static yyconst flex_int16_t yy_acclist[185] =
     {   0,
-       29,   10,   28,    7,   10,   28,   27,   28,   10,   27,
-       28,    6,   10,   28,    5,    6,   10,   28,   10,   28,
-        3,   10,   28,   10,   28,16392,    2,   10,   28,    1,
-       10,   28,    6,   10,   28,16392,    6,   10,   28,16392,
-        7,   10,   28,   11,   28,   10,   11,   28,   28,   28,
-       15,   28,   28,16398,   28,16396,16398,   28,16396,16398,
-       28,   19,   28,   19,   28,   23,   28,   20,   23,   28,
-       22,   28,   22,   23,   28,   23,   28,16405,   20,   23,
-       28,16405,   16,   28,   16,   28,   26,   28,   20,   26,
-       28,   25,   28,   25,   26,   28,   26,   28,16408,   20,
-
-       26,   28,16408,    7,   27,    6,    5,    6, 8200, 8200,
-    16392,16392,16393,    6,16393,    6,16392,    7,   11,   11,
-       15, 8206,   15, 8206,16398, 8204, 8206,   15, 8204, 8206,
-    16396,16398,16396,16397,16398,16397,16398,   18,   18,   19,
-       20,   22, 8213, 8213,16405,   20,16405,   16,   16,   17,
-       17,   25, 8216, 8216,16408,   20,16408, 8200, 8201, 8200,
-     8201,16393, 8201, 8201, 8204, 8205, 8206,   15, 8204, 8205,
-     8206, 8205, 8206,   15, 8205, 8206,    4
+       30,   11,   29,    8,   11,   29,   28,   29,   11,   28,
+       29,    7,   11,   29,    6,    7,   11,   29,   11,   29,
+        7,   11,   29,    3,   11,   29,   11,   29,16393,    2,
+       11,   29,    1,   11,   29,    7,   11,   29,16393,    7,
+       11,   29,16393,    8,   11,   29,   12,   29,   11,   12,
+       29,   29,   29,   16,   29,   29,16399,   29,16397,16399,
+       29,16397,16399,   29,   20,   29,   20,   29,   24,   29,
+       21,   24,   29,   23,   29,   23,   24,   29,   24,   29,
+    16406,   21,   24,   29,16406,   17,   29,   17,   29,   27,
+       29,   21,   27,   29,   26,   29,   26,   27,   29,   27,
+
+       29,16409,   21,   27,   29,16409,    8,   28,    7,    6,
+        7,    7, 8201, 8201,16393,16393,16394,    7,16394,    7,
+    16393,    8,   12,   12,   16, 8207,   16, 8207,16399, 8205,
+     8207,   16, 8205, 8207,16397,16399,16397,16398,16399,16398,
+    16399,   19,   19,   20,   21,   23, 8214, 8214,16406,   21,
+    16406,   17,   17,   18,   18,   26, 8217, 8217,16409,   21,
+    16409,    7, 8201, 8202, 8201, 8202,16394, 8202, 8202, 8205,
+     8206, 8207,   16, 8205, 8206, 8207, 8206, 8207,   16, 8206,
+     8207,    7,    5,    4
     } ;
 
-static yyconst flex_int16_t yy_accept[121] =
+static yyconst flex_int16_t yy_accept[127] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    2,    4,    7,    9,   12,   15,   19,
-       21,   24,   27,   30,   33,   37,   41,   44,   46,   49,
-       50,   51,   53,   55,   58,   61,   62,   64,   66,   68,
-       71,   73,   76,   79,   83,   85,   87,   89,   92,   94,
-       97,  100,  104,  105,  106,  107,  109,  109,  110,  111,
-      112,  114,  116,  118,  119,  120,  121,  121,  122,  124,
-      125,  126,  129,  131,  133,  136,  138,  138,  139,  141,
-      142,  143,  144,  145,  146,  148,  149,  151,  152,  153,
-
-      154,  155,  156,  158,  158,  160,  162,  163,  164,  165,
-      169,  172,  175,  177,  177,  177,  177,  177,  178,  178
+       21,   24,   27,   30,   33,   36,   40,   44,   47,   49,
+       52,   53,   54,   56,   58,   61,   64,   65,   67,   69,
+       71,   74,   76,   79,   82,   86,   88,   90,   92,   95,
+       97,  100,  103,  107,  108,  109,  110,  112,  112,  113,
+      114,  115,  116,  118,  120,  122,  123,  124,  125,  125,
+      126,  128,  129,  130,  133,  135,  137,  140,  142,  142,
+      143,  145,  146,  147,  148,  149,  150,  152,  153,  155,
+
+      156,  157,  158,  159,  160,  162,  162,  163,  165,  167,
+      168,  169,  170,  174,  177,  180,  182,  182,  183,  183,
+      183,  183,  184,  184,  185,  185
     } ;
 
 static yyconst flex_int32_t yy_ec[256] =
@@ -418,12 +420,12 @@ static yyconst flex_int32_t yy_ec[256] =
         5,    6,    5,    5,    5,    5,    5,    5,    5,    5,
         5,    5,    7,    5,    8,    9,    5,   10,   10,   10,
        10,   11,   11,   11,   11,   11,   11,   12,    5,    5,
-        5,   13,    5,   14,   15,    8,   15,    8,    8,    8,
-       15,    8,    8,    8,    8,    8,    8,   16,    8,    8,
-        8,    8,    8,   15,    8,    8,    8,    8,    8,    8,
+        5,   13,    5,   14,   15,    8,   15,   16,   16,    8,
+       15,    8,    8,    8,    8,    8,    8,   17,    8,    8,
+        8,   18,   16,   15,    8,    8,    8,    8,    8,    8,
         5,    5,    5,    5,    5,    5,   15,    8,   15,    8,
 
-        8,    8,   15,    8,    8,    8,    8,    8,    8,   16,
+        8,    8,   15,    8,    8,    8,    8,    8,    8,   17,
         8,    8,    8,    8,    8,   15,    8,    8,    8,    8,
         8,    8,    5,    5,    5,    5,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
@@ -442,133 +444,139 @@ static yyconst flex_int32_t yy_ec[256] =
         1,    1,    1,    1,    1
     } ;
 
-static yyconst flex_int32_t yy_meta[17] =
+static yyconst flex_int32_t yy_meta[19] =
     {   0,
         1,    1,    2,    2,    3,    3,    3,    4,    5,    6,
-        6,    7,    3,    3,    8,    8
+        6,    7,    3,    3,    8,    4,    8,    4
     } ;
 
-static yyconst flex_int16_t yy_base[136] =
+static yyconst flex_int16_t yy_base[143] =
     {   0,
-        0,   10,   25,   23,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,   39,   17,   30,   54,   60,   58,   66,
-       82,   88,  194,  297,   16,  297,  190,    0,   25,   58,
-      297,   67,  297,  297,   92,   67,  107,  297,  189,  297,
-      188,  297,  113,  117,   69,  183,  297,  182,  297,   91,
-      297,  181,   95,  132,    0,   95,  297,  121,  297,  180,
-      121,  137,  140,  297,    0,    0,  166,  297,  174,  125,
-      144,  158,    0,    0,  297,  149,  141,  297,  297,  134,
-      168,  297,  119,    0,  170,  178,  109,  297,  297,  143,
-      297,  297,  103,  127,    0,    0,    0,  141,  297,  297,
-
-       84,  152,    0,  147,  297,   77,  186,  297,   69,  297,
-       62,  297,   56,   25,  153,   18,  155,  165,  297,  196,
-      204,  212,  220,  228,  233,  240,  248,  256,  264,  271,
-      275,  282,  285,  287,  289
+        0,   12,   28,   26,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,   43,   19,   33,   59,   65,   63,   72,
+       89,   95,  194,  313,   18,  313,  190,    0,   28,   38,
+      174,  313,   47,  313,  313,   99,   44,  116,  313,  188,
+      313,  183,  313,  122,  126,   46,  182,  313,  181,  313,
+       68,  313,  180,   72,  142,    0,   73,  313,   71,  313,
+      164,   81,  147,   98,  313,    0,    0,  140,  129,  313,
+      139,  102,  151,  166,    0,    0,  313,  128,  118,  313,
+      313,  110,  176,  313,   91,    0,  178,  186,   85,  313,
+      313,  130,  313,  313,   83,  108,    0,    0,    0,  124,
+
+      313,  313,   76,  134,    0,  129,  146,  313,   61,  194,
+      313,   56,  313,   54,  313,   39,   28,   24,  148,  152,
+       16,  154,  161,  163,  313,  204,  212,  220,  228,  236,
+      244,  249,  256,  264,  272,  280,  287,  291,  298,  301,
+      303,  305
     } ;
 
-static yyconst flex_int16_t yy_def[136] =
+static yyconst flex_int16_t yy_def[143] =
     {   0,
-      119,    1,    1,    3,  120,  120,  120,  120,  120,  120,
-      120,  120,  120,  119,  121,  121,  122,  123,  120,  120,
-      124,  124,  119,  119,  119,  119,  119,  125,  125,  119,
-      119,  126,  119,  119,  119,   35,  119,  119,  119,  119,
-      127,  119,  128,  128,   44,  129,  119,  129,  119,  119,
-      119,  119,  130,  130,  131,  131,  119,  119,  119,  119,
-      132,  132,  119,  119,  125,   29,  133,  119,  119,  126,
-      119,  125,   36,   37,  119,  119,  127,  119,  119,  127,
-      128,  119,  127,   44,   44,   81,  129,  119,  119,  119,
-      119,  119,  119,  130,   54,  131,   56,  119,  119,  119,
-
-      119,  132,   62,  119,  119,  119,  119,  119,  119,  119,
-      127,  119,  127,  134,  119,  135,  119,  119,    0,  119,
-      119,  119,  119,  119,  119,  119,  119,  119,  119,  119,
-      119,  119,  119,  119,  119
+      125,    1,    1,    3,  126,  126,  126,  126,  126,  126,
+      126,  126,  126,  127,  128,  128,  129,  130,  126,  126,
+      131,  131,  125,  125,  125,  125,  125,  132,  132,  125,
+      132,  125,  133,  125,  125,  125,   36,  125,  125,  125,
+      125,  134,  125,  135,  135,   45,  136,  125,  136,  125,
+      125,  125,  125,  137,  137,  138,  138,  125,  125,  125,
+      125,  139,  139,  125,  125,  132,   29,  140,  132,  125,
+      125,  133,  125,  132,   37,   38,  125,  125,  134,  125,
+      125,  134,  135,  125,  134,   45,   45,   83,  136,  125,
+      125,  125,  125,  125,  125,  137,   55,  138,   57,  125,
+
+      125,  125,  125,  139,   63,  125,  132,  125,  125,  125,
+      125,  125,  125,  134,  125,  134,  141,  107,  125,  125,
+      142,  125,  125,  125,    0,  125,  125,  125,  125,  125,
+      125,  125,  125,  125,  125,  125,  125,  125,  125,  125,
+      125,  125
     } ;
 
-static yyconst flex_int16_t yy_nxt[314] =
+static yyconst flex_int16_t yy_nxt[332] =
     {   0,
        24,   25,   26,   27,   24,   25,   24,   28,   24,   29,
-       29,   30,   24,   24,   28,   28,   31,   63,   32,   47,
-       48,   63,   33,   34,   35,   36,   37,   38,   39,  117,
-       37,   32,   47,   48,   66,   66,  115,   35,   36,   41,
-       41,   42,   41,   43,   43,   43,   43,   44,   43,   43,
-       43,   43,   43,   45,   44,   50,   51,   52,  112,   50,
-       49,   50,   51,   52,  110,   54,   55,   67,   67,   68,
-       69,  108,   56,   55,   55,   70,   65,   85,   86,  105,
-       56,   55,   57,   58,   59,   60,  100,   62,   57,   58,
-       59,   60,   90,   62,   68,   69,   90,   92,   93,   65,
-
-       71,   72,   65,   97,   98,   92,   73,   73,   74,   75,
-       76,   88,   74,   77,   77,   79,   80,   77,   77,   82,
-       83,   82,   90,  100,  101,   84,   90,   68,   69,   92,
-       93,   84,   84,   90,   92,   93,   79,   95,   90,  100,
-      101,   63,  103,   78,   90,   63,  105,  106,   90,   98,
-       98,   75,   71,  107,  100,  101,  114,  114,   70,   70,
-      108,  109,  116,  116,  118,  118,  107,   72,   77,   77,
-       79,   80,  110,  111,  118,  118,   68,  104,   85,   86,
-      112,  113,   99,   91,   89,   88,   86,   86,  108,  109,
-       78,   75,   64,  119,  107,  107,   40,   40,   40,   40,
-
-       40,   40,   40,   40,   46,   46,   46,   46,   46,   46,
-       46,   46,   49,   49,   49,   49,   49,   49,   49,   49,
-       53,   53,   53,   53,   53,   53,   53,   53,   61,   61,
-       61,   61,   61,   61,   61,   61,   65,  119,   65,  119,
-       65,   70,  119,  119,   70,  119,  119,   70,   77,   77,
-       77,   77,   77,   77,   77,   77,   81,   81,   81,   81,
-       81,   81,   81,   81,   87,   87,   87,   87,   87,   87,
-       87,   87,   94,   94,   94,   94,   94,   94,   94,   96,
-      119,  119,   96,  102,  102,  102,  102,  102,  102,  102,
-       67,   67,  114,  114,  116,  116,   23,  119,  119,  119,
-
-      119,  119,  119,  119,  119,  119,  119,  119,  119,  119,
-      119,  119,  119
+       29,   30,   24,   24,   28,   31,   28,   28,   32,   64,
+       33,   48,   49,   64,   34,   35,   36,  123,   37,   38,
+       39,   40,  120,   38,   33,   48,   49,   67,   67,  119,
+       36,  115,   37,   42,   42,   43,   42,   68,   68,   70,
+       71,   45,   72,   66,   87,   88,  113,   46,  111,   45,
+       51,   52,   53,  108,   51,   50,   51,   52,   53,   92,
+       55,   56,   92,   92,   94,   95,   92,   57,  102,   56,
+       56,   99,  100,  102,  103,   94,   57,   90,   56,   58,
+       59,   60,   61,   84,   63,   58,   59,   60,   61,   64,
+
+       63,   70,   71,   64,   70,   71,   66,   73,   74,   66,
+       94,   95,   81,   75,   66,   75,   66,   76,   77,   78,
+       80,   76,   79,   79,   81,   82,   79,   79,   84,   85,
+       77,   92,  100,  100,   86,   92,  102,  103,  117,  117,
+       86,   70,   86,   92,   94,   95,  107,   97,   92,  102,
+      103,  106,  105,  108,  109,  118,  118,  121,  121,   73,
+      110,  122,  122,  122,  122,   72,  101,   72,  111,  112,
+      124,  124,  124,  124,  110,   74,   79,   79,   81,   82,
+      113,  114,   93,   91,   90,   80,   87,   88,  115,  116,
+       77,   69,   65,  125,   88,   88,  111,  112,  125,  125,
+
+      125,  125,  110,  110,   41,   41,   41,   41,   41,   41,
+       41,   41,   44,   44,   44,   44,   44,   44,   44,   44,
+       47,   47,   47,   47,   47,   47,   47,   47,   50,   50,
+       50,   50,   50,   50,   50,   50,   54,   54,   54,   54,
+       54,   54,   54,   54,   62,   62,   62,   62,   62,   62,
+       62,   62,   66,  125,   66,  125,   66,   72,  125,  125,
+       72,  125,  125,   72,   79,   79,   79,   79,   79,   79,
+       79,   79,   83,   83,   83,   83,   83,   83,   83,   83,
+       89,   89,   89,   89,   89,   89,   89,   89,   96,   96,
+       96,   96,   96,   96,   96,   98,  125,  125,   98,  104,
+
+      104,  104,  104,  104,  104,  104,   68,   68,  117,  117,
+      121,  121,   23,  125,  125,  125,  125,  125,  125,  125,
+      125,  125,  125,  125,  125,  125,  125,  125,  125,  125,
+      125
     } ;
 
-static yyconst flex_int16_t yy_chk[314] =
+static yyconst flex_int16_t yy_chk[332] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    2,   25,    2,   15,
-       15,   25,    2,    2,    2,    2,    3,    3,    3,  116,
-        3,    4,   16,   16,   29,   29,  114,    4,    4,   14,
-       14,   14,   14,   14,   14,   14,   14,   14,   14,   14,
-       14,   14,   14,   14,   14,   17,   17,   17,  113,   17,
-       18,   18,   18,   18,  111,   18,   19,   30,   30,   32,
-       32,  109,   19,   19,   20,   36,   36,   45,   45,  106,
-       20,   20,   21,   21,   21,   21,  101,   21,   22,   22,
-       22,   22,   50,   22,   35,   35,   50,   53,   53,   35,
-
-       35,   35,   35,   56,   56,   93,   35,   35,   37,   37,
-       37,   87,   37,   43,   43,   43,   43,   44,   44,   44,
-       44,   83,   58,   61,   61,   44,   58,   70,   70,   94,
-       94,   44,   44,   54,   54,   54,   80,   54,   62,   62,
-       62,   63,   62,   77,   90,   63,   71,   71,   90,   98,
-       98,   76,   71,   71,  102,  102,  104,  104,   71,   71,
-       72,   72,  115,  115,  117,  117,   72,   72,   81,   81,
-       81,   81,   85,   85,  118,  118,   69,   67,   85,   85,
-       86,   86,   60,   52,   48,   46,   86,   86,  107,  107,
-       41,   39,   27,   23,  107,  107,  120,  120,  120,  120,
-
-      120,  120,  120,  120,  121,  121,  121,  121,  121,  121,
-      121,  121,  122,  122,  122,  122,  122,  122,  122,  122,
-      123,  123,  123,  123,  123,  123,  123,  123,  124,  124,
-      124,  124,  124,  124,  124,  124,  125,    0,  125,    0,
-      125,  126,    0,    0,  126,    0,    0,  126,  127,  127,
-      127,  127,  127,  127,  127,  127,  128,  128,  128,  128,
-      128,  128,  128,  128,  129,  129,  129,  129,  129,  129,
-      129,  129,  130,  130,  130,  130,  130,  130,  130,  131,
-        0,    0,  131,  132,  132,  132,  132,  132,  132,  132,
-      133,  133,  134,  134,  135,  135,  119,  119,  119,  119,
-
-      119,  119,  119,  119,  119,  119,  119,  119,  119,  119,
-      119,  119,  119
+        1,    1,    1,    1,    1,    1,    1,    1,    2,   25,
+        2,   15,   15,   25,    2,    2,    2,  121,    2,    3,
+        3,    3,  118,    3,    4,   16,   16,   29,   29,  117,
+        4,  116,    4,   14,   14,   14,   14,   30,   30,   33,
+       33,   14,   37,   37,   46,   46,  114,   14,  112,   14,
+       17,   17,   17,  109,   17,   18,   18,   18,   18,   51,
+       18,   19,   59,   51,   54,   54,   59,   19,  103,   19,
+       20,   57,   57,   62,   62,   95,   20,   89,   20,   21,
+       21,   21,   21,   85,   21,   22,   22,   22,   22,   64,
+
+       22,   36,   36,   64,   72,   72,   36,   36,   36,   36,
+       96,   96,   82,   36,   36,   36,   36,   38,   38,   38,
+       79,   38,   44,   44,   44,   44,   45,   45,   45,   45,
+       78,   92,  100,  100,   45,   92,  104,  104,  106,  106,
+       45,   71,   45,   55,   55,   55,   69,   55,   63,   63,
+       63,   68,   63,   73,   73,  107,  107,  119,  119,   73,
+       73,  120,  120,  122,  122,   73,   61,   73,   74,   74,
+      123,  123,  124,  124,   74,   74,   83,   83,   83,   83,
+       87,   87,   53,   49,   47,   42,   87,   87,   88,   88,
+       40,   31,   27,   23,   88,   88,  110,  110,    0,    0,
+
+        0,    0,  110,  110,  126,  126,  126,  126,  126,  126,
+      126,  126,  127,  127,  127,  127,  127,  127,  127,  127,
+      128,  128,  128,  128,  128,  128,  128,  128,  129,  129,
+      129,  129,  129,  129,  129,  129,  130,  130,  130,  130,
+      130,  130,  130,  130,  131,  131,  131,  131,  131,  131,
+      131,  131,  132,    0,  132,    0,  132,  133,    0,    0,
+      133,    0,    0,  133,  134,  134,  134,  134,  134,  134,
+      134,  134,  135,  135,  135,  135,  135,  135,  135,  135,
+      136,  136,  136,  136,  136,  136,  136,  136,  137,  137,
+      137,  137,  137,  137,  137,  138,    0,    0,  138,  139,
+
+      139,  139,  139,  139,  139,  139,  140,  140,  141,  141,
+      142,  142,  125,  125,  125,  125,  125,  125,  125,  125,
+      125,  125,  125,  125,  125,  125,  125,  125,  125,  125,
+      125
     } ;
 
 /* Table of booleans, true if rule could match eol. */
-static yyconst flex_int32_t yy_rule_can_match_eol[29] =
+static yyconst flex_int32_t yy_rule_can_match_eol[30] =
     {   0,
-0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 
-    0, 1, 1, 0, 1, 1, 0, 1, 0,     };
+0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 
+    1, 0, 1, 1, 0, 1, 1, 0, 1, 0,     };
 
 #define YY_TRAILING_MASK 0x2000
 #define YY_TRAILING_HEAD_MASK 0x4000
@@ -961,14 +969,14 @@ yy_match:
 			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 				{
 				yy_current_state = (int) yy_def[yy_current_state];
-				if ( yy_current_state >= 120 )
+				if ( yy_current_state >= 126 )
 					yy_c = yy_meta[(unsigned int) yy_c];
 				}
 			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 			*yyg->yy_state_ptr++ = yy_current_state;
 			++yy_cp;
 			}
-		while ( yy_current_state != 119 );
+		while ( yy_current_state != 125 );
 
 yy_find_action:
 		yy_current_state = *--yyg->yy_state_ptr;
@@ -1046,53 +1054,57 @@ YY_RULE_SETUP
 	YY_BREAK
 case 5:
 YY_RULE_SETUP
-{ return fqNUMBER; }
+{ return fqRUNDOTSPOT; } 
 	YY_BREAK
 case 6:
 YY_RULE_SETUP
-{ return fqALPHANUM; }
+{ return fqNUMBER; }
 	YY_BREAK
 case 7:
 YY_RULE_SETUP
-{ return fqWS; }
+{ return fqALPHANUM; }
 	YY_BREAK
 case 8:
-/* rule 8 can match eol */
 YY_RULE_SETUP
-{ return fqBASESEQ; }
+{ return fqWS; }
 	YY_BREAK
 case 9:
 /* rule 9 can match eol */
 YY_RULE_SETUP
-{ return fqCOLORSEQ; }
+{ return fqBASESEQ; }
 	YY_BREAK
 case 10:
+/* rule 10 can match eol */
 YY_RULE_SETUP
-{ return yytext[0]; }
+{ return fqCOLORSEQ; }
 	YY_BREAK
-
 case 11:
-/* rule 11 can match eol */
 YY_RULE_SETUP
-{ BEGIN IN_SEQUENCE; ENDLINE; } 
+{ return yytext[0]; }
 	YY_BREAK
 
 case 12:
 /* rule 12 can match eol */
 YY_RULE_SETUP
-{ BEGIN 0; return fqBASESEQ; }
+{ BEGIN IN_SEQUENCE; ENDLINE; } 
 	YY_BREAK
+
 case 13:
 /* rule 13 can match eol */
 YY_RULE_SETUP
-{ BEGIN 0; return fqCOLORSEQ; }
+{ BEGIN 0; return fqBASESEQ; }
 	YY_BREAK
 case 14:
 /* rule 14 can match eol */
 YY_RULE_SETUP
-{ BEGIN 0; return fqASCQUAL; }
+{ BEGIN 0; return fqCOLORSEQ; }
 	YY_BREAK
 case 15:
+/* rule 15 can match eol */
+YY_RULE_SETUP
+{ BEGIN 0; return fqASCQUAL; }
+	YY_BREAK
+case 16:
 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
 yyg->yy_c_buf_p = yy_cp -= 1;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
@@ -1100,40 +1112,40 @@ YY_RULE_SETUP
 { BEGIN 0; return fqUNRECOGNIZED; }
 	YY_BREAK
 
-case 16:
+case 17:
 YY_RULE_SETUP
 { BEGIN 0; return fqBASESEQ; }
 	YY_BREAK
-case 17:
+case 18:
 YY_RULE_SETUP
 { BEGIN 0; return fqCOLORSEQ; }
 	YY_BREAK
 
-case 18:
+case 19:
 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
 yyg->yy_c_buf_p = yy_cp -= 1;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
 { return fqTOKEN; /* do not bother to parse the inside of the line */ }
 	YY_BREAK
-case 19:
-/* rule 19 can match eol */
+case 20:
+/* rule 20 can match eol */
 YY_RULE_SETUP
 { BEGIN IN_QUALITY; ENDLINE }
 	YY_BREAK
 
-case 20:
+case 21:
 YY_RULE_SETUP
 { } 
 	YY_BREAK
 
-case 21:
-/* rule 21 can match eol */
+case 22:
+/* rule 22 can match eol */
 YY_RULE_SETUP
 { return fqASCQUAL; }
 	YY_BREAK
-case 22:
-/* rule 22 can match eol */
+case 23:
+/* rule 23 can match eol */
 YY_RULE_SETUP
 {   /* if read was split across several lines, expect the same number of lines in quality */
                                     if (yyextra->expectedQualityLines <= 1) 
@@ -1143,32 +1155,32 @@ YY_RULE_SETUP
                                     ENDLINE; 
                                 }
 	YY_BREAK
-case 23:
+case 24:
 YY_RULE_SETUP
 { return yytext[0]; }
 	YY_BREAK
 
-case 24:
-/* rule 24 can match eol */
+case 25:
+/* rule 25 can match eol */
 YY_RULE_SETUP
 { return fqASCQUAL; }
 	YY_BREAK
-case 25:
-/* rule 25 can match eol */
+case 26:
+/* rule 26 can match eol */
 YY_RULE_SETUP
 { BEGIN 0; ENDLINE; }
 	YY_BREAK
-case 26:
+case 27:
 YY_RULE_SETUP
 { return yytext[0]; }
 	YY_BREAK
 
-case 27:
-/* rule 27 can match eol */
+case 28:
+/* rule 28 can match eol */
 YY_RULE_SETUP
 { ENDLINE; }
 	YY_BREAK
-case 28:
+case 29:
 YY_RULE_SETUP
 ECHO;
 	YY_BREAK
@@ -1445,7 +1457,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 			{
 			yy_current_state = (int) yy_def[yy_current_state];
-			if ( yy_current_state >= 120 )
+			if ( yy_current_state >= 126 )
 				yy_c = yy_meta[(unsigned int) yy_c];
 			}
 		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1469,11 +1481,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 		{
 		yy_current_state = (int) yy_def[yy_current_state];
-		if ( yy_current_state >= 120 )
+		if ( yy_current_state >= 126 )
 			yy_c = yy_meta[(unsigned int) yy_c];
 		}
 	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-	yy_is_jam = (yy_current_state == 119);
+	yy_is_jam = (yy_current_state == 125);
 	if ( ! yy_is_jam )
 		*yyg->yy_state_ptr++ = yy_current_state;
 
diff --git a/tools/fastq-loader/fastq-lex.l b/tools/fastq-loader/fastq-lex.l
index 64481aa..56b46e3 100644
--- a/tools/fastq-loader/fastq-lex.l
+++ b/tools/fastq-loader/fastq-lex.l
@@ -25,25 +25,21 @@
 */
  
 %{ 
+    #include <sysalloc.h>   
     #include <ctype.h>
     
     #include <klib/rc.h>
+    #include <klib/log.h>
 
-	#include "fastq-parse.h"
-	#include "fastq-tokens.h"    
-	
+    #include "fastq-parse.h"
+    #include "fastq-tokens.h"    
+    
     #define YYSTYPE FASTQToken
 
     /* code to populate token with internal values */
-    #define YY_USER_ACTION              \
-        yylval -> tokenText		= yytext;	\
-        yylval -> tokenLength	= yyleng;	\
-        yylval -> line_no		= yylineno;	\
-        yylval -> column_no		= yyextra -> column; \
-        yyextra -> column += yyleng; \
-        yyextra -> length += yyleng; \
-        yyextra -> lastToken = yylval; 
-
+	static void ConsumeToken(FASTQToken* token, FASTQParseBlock* pb);
+    #define YY_USER_ACTION ConsumeToken(yylval, yyextra);
+	
     #define ENDLINE \
         yyextra -> column=1;\
         return fqENDLINE;
@@ -53,20 +49,9 @@
 
     #define ECHO
 
-    static bool IsDecList(const char*, size_t*, int*);
-
-    #define CHECK_FOR_DECLIST                               \
-        int token;                                          \
-        size_t firstNumLen = yylval -> tokenLength;         \
-        if (IsDecList(yytext, & firstNumLen, & token))      \
-        {                                                   \
-            yyextra -> column -= (yyleng - firstNumLen);    \
-            yyextra -> length -= (yyleng - firstNumLen);    \
-            yylval -> tokenLength   = firstNumLen;          \
-            BEGIN DECLIST;                                  \
-            yyless(firstNumLen);                            \
-            return token;                                   \
-        }
+    static void FASTQ_fatal_error(yyconst char* msg);
+    #define YY_FATAL_ERROR(msg) FASTQ_fatal_error(msg)
+    
 %}
 
 %option never-interactive nounistd yylineno reentrant bison-bridge stack noyywrap
@@ -86,11 +71,10 @@
 %x IN_QUALITY
 %x INLINE_SEQUENCE
 %x INLINE_QUALITY
-%x DECLIST
 
 ws          [ \t]+
 digits      [0-9]+
-alphanum    [A-Za-z0-9]+
+alphanum    [A-Za-z0-9\-]+
 eol         (\r\n|\r|\n)
 
 /* there are more: =ACMGRSVTWYHKDBN. plus lowercase */
@@ -98,8 +82,7 @@ base [ACGTacgtNn.]
 cskey [ACGTacgt]
 color   [0-3.]
 
-asc33qual   [\x0E-\x1F \x21-\x7E]+
-asc64qual   [\x40-\x7E]+
+ascqual   [\x0E-\x1F \x21-\x7E]+
 
 %%
 
@@ -110,23 +93,26 @@ asc64qual   [\x40-\x7E]+
 
 <INITIAL,TAG_LINE>
 {
+    :{digits}:{digits}:{digits}:{digits}                    { return fqCOORDS; }
+    [SDE]RR{digits}\.{digits}   { return fqRUNDOTSPOT; } 
     {digits}                    { return fqNUMBER; }
     {alphanum}                  { return fqALPHANUM; }
     {ws}                        { return fqWS; }
+    ^{base}+/{eol}              { return fqBASESEQ; }
+    ^{cskey}{color}+/{eol}      { return fqCOLORSEQ; }
     .                           { return yytext[0]; }
 }
 
-<TAG_LINE>[ \t]*{eol}           { BEGIN IN_SEQUENCE; ENDLINE; }
+<TAG_LINE>[ \t]*{eol}           { BEGIN IN_SEQUENCE; ENDLINE; } 
 
 <IN_SEQUENCE>
 {
     ^{base}+/{eol}              { BEGIN 0; return fqBASESEQ; }
     ^{cskey}{color}+/{eol}      { BEGIN 0; return fqCOLORSEQ; }
-    ^{asc64qual}/{eol}          { CHECK_FOR_DECLIST; BEGIN 0; return fqASC64QUAL; }
-    ^{asc33qual}/{eol}          { CHECK_FOR_DECLIST; BEGIN 0; return fqASC33QUAL; }
+    ^{ascqual}/{eol}            { BEGIN 0; return fqASCQUAL; }
     ^.*$                        { BEGIN 0; return fqUNRECOGNIZED; }
 }
-
+  
 <INLINE_SEQUENCE>
 {
     {base}+                     { BEGIN 0; return fqBASESEQ; }
@@ -139,32 +125,27 @@ asc64qual   [\x40-\x7E]+
     {eol}                       { BEGIN IN_QUALITY; ENDLINE }
 }
 
-<IN_QUALITY,INLINE_QUALITY,DECLIST>
+<IN_QUALITY,INLINE_QUALITY>
 {
     {ws}                        { } 
-    {digits}                    { BEGIN DECLIST; return fqNUMBER; }
 }
 
 <IN_QUALITY>
 {
-    ^{asc64qual}/{eol}          { CHECK_FOR_DECLIST; return fqASC64QUAL; }
-    ^{asc33qual}/{eol}          { CHECK_FOR_DECLIST; return fqASC33QUAL; }
-    {eol}                       { BEGIN 0; ENDLINE; }
+    ^{ascqual}/{eol}            { return fqASCQUAL; }
+    {eol}                       {   /* if read was split across several lines, expect the same number of lines in quality */
+                                    if (yyextra->expectedQualityLines <= 1) 
+                                        BEGIN 0; 
+                                    else 
+                                        --yyextra->expectedQualityLines;
+                                    ENDLINE; 
+                                }
     .                           { return yytext[0]; }
 }
 
 <INLINE_QUALITY>
 {
-    {digits}/{eol}              { BEGIN DECLIST; return fqNUMBER; }
-    {asc64qual}/{eol}           { CHECK_FOR_DECLIST; return fqASC64QUAL; }
-    {asc33qual}/{eol}           { CHECK_FOR_DECLIST; return fqASC33QUAL; }
-    {eol}                       { BEGIN 0; ENDLINE; }
-    .                           { return yytext[0]; }
-}
-
-<DECLIST>
-{
-    {digits}/{eol}              { return fqNUMBER; }
+    {ascqual}/{eol}             { return fqASCQUAL; }
     {eol}                       { BEGIN 0; ENDLINE; }
     .                           { return yytext[0]; }
 }
@@ -175,30 +156,35 @@ asc64qual   [\x40-\x7E]+
 
 rc_t CC FASTQScan_yylex_init(FASTQParseBlock* sb, bool debug)
 {
-	if (yylex_init_extra(sb, &sb->scanner) != 0)
-	{
-		return RC ( rcKFG, rcMgr, rcParsing, rcMemory, rcExhausted );
-	}		
-
-	yyset_debug(debug ? 1 : 0, sb->scanner);
-
-    yy_push_state(INITIAL, sb->scanner);
+    if (yylex_init_extra(sb, &sb->scanner) != 0)
+    {
+        return RC ( rcApp, rcFile, rcParsing, rcMemory, rcExhausted );
+    }       
 
+    sb->length = 0;
+    sb->lastToken = NULL;
+    sb->record = NULL;
     sb->column = 1;
+     
+    sb->expectedQualityLines = 0;
+    
+    yyset_debug(debug ? 1 : 0, sb->scanner);
 
-	return 0;
+    yy_push_state(INITIAL, sb->scanner);
+    
+    return 0;
 }
 
 void CC FASTQScan_yylex_destroy(FASTQParseBlock* sb)
 {
-	if (sb->scanner)
-	{
-		yylex_destroy(sb->scanner);
-	}		
-	sb->scanner=0;
+    if (sb->scanner)
+    {
+        yylex_destroy(sb->scanner);
+    }       
+    sb->scanner=0;
 }
 
-void CC FASTQScan_inline_sequence(FASTQParseBlock* pb)
+void CC FASTQScan_inline_sequence(FASTQParseBlock* pb) 
 {
     yy_pop_state(pb->scanner);
     yy_push_state(INLINE_SEQUENCE, pb->scanner);
@@ -210,85 +196,42 @@ void CC FASTQScan_inline_quality(FASTQParseBlock* pb)
     yy_push_state(INLINE_QUALITY, pb->scanner);
 }
 
-/* 
- * True if the token appears to be a comma/whitespace separated list of signed decimals, each no longer than 3 decimal positions.
- */
-bool IsDecList(const char* token, size_t* size, int* p_newToken)
-{
-    size_t firstTokenSize = 0;
-    size_t curNumberSize = 0;
-    int newToken;
-    bool inFirstToken = true;
-    size_t i;
-    for (i=0; i < *size; ++i)
-    {
-        char ch=token[i];
-        if (strchr("0123456789, -+", ch) == NULL)
-        {
-            return false;
-        }
-        if (inFirstToken)
-        {
-            if (i == 0)
-            {   /* decide on the first character */ 
-                if (isdigit(ch))
-                {
-                    newToken = fqNUMBER;
-                    firstTokenSize = 1;
-                    curNumberSize = 1;
-                }
-                else if (ch == '-' || ch == '+')
-                {
-                    newToken = ch;
-                    firstTokenSize = 1;
-                    inFirstToken = false;
-                }
-                else
-                {
-                    return false;
-                }
-            }
-            else if (isdigit(ch))
-            {   /* keep on tracking the first token's size */
-                ++firstTokenSize;
-                ++curNumberSize;
-                if (curNumberSize > 3)
-                {
-                    return false;
-                }
-            }
-            else
-            {   /* end of the first token */ 
-                curNumberSize = 0;
-                inFirstToken = false;
-            }
-        }
-        else if (isdigit(ch))
-        {   /* keep on tracking the current number's size */
-            ++curNumberSize;
-            if (curNumberSize > 3)
-            {
-                return false;
-            }
-        }
-        else
-        {
-            curNumberSize = 0;
-        }
-    }
-    *size = firstTokenSize;
-    *p_newToken = newToken;
-    return true;
-}
-
 void CC FASTQ_unlex(FASTQParseBlock* pb, FASTQToken* token)
 {
     size_t i;
     struct yyguts_t* yyg = (struct yyguts_t*)pb->scanner;
     for (i = 0; i < token->tokenLength; ++i)
     {
-        yyunput(token->tokenText[token->tokenLength-1-i], yyg->yytext_r, pb->scanner);
+        yyunput(TokenTextPtr(pb, token)[token->tokenLength - 1 - i], yyg->yytext_r, pb->scanner);
     }
     yyextra -> column -= token->tokenLength; 
     yyextra -> length -= token->tokenLength; 
+	KDataBufferResize( & pb->record->source, KDataBufferBytes( & pb->record->source ) - token->tokenLength );
 }
+
+void FASTQ_fatal_error(yyconst char* msg)
+{
+    rc_t rc = RC ( rcApp, rcFile, rcParsing, rcError, rcUnexpected );
+    if (strcmp(msg, "input buffer overflow, can't enlarge buffer because scanner uses REJECT") == 0)
+        pLogErr(klogErr, rc, "line is too long (maximum line length = $(B) bytes)", "B=%d", YY_BUF_SIZE);
+    else
+        LogErr(klogErr, rc, msg);
+    exit(rc);  
+}
+
+void ConsumeToken(FASTQToken* token, FASTQParseBlock* pb)
+{
+    struct yyguts_t* yyg = (struct yyguts_t*)pb->scanner;
+	
+	token -> tokenStart = KDataBufferBytes( & pb->record->source );
+	token -> tokenLength   = yyleng;   
+	token -> line_no       = yylineno; 
+	token -> column_no     = pb -> column; 
+	
+	KDataBufferResize( & pb->record->source, KDataBufferBytes( & pb->record->source ) + token->tokenLength );
+	strncpy((char*)TokenTextPtr(pb, token), yytext, token->tokenLength);
+    
+	pb -> column += token->tokenLength; 
+	pb -> length += token->tokenLength; 
+	pb -> lastToken = token; 
+}
\ No newline at end of file
diff --git a/tools/fastq-loader/fastq-tokens.h b/tools/fastq-loader/fastq-tokens.h
index 3b6ea48..a78874f 100644
--- a/tools/fastq-loader/fastq-tokens.h
+++ b/tools/fastq-loader/fastq-tokens.h
@@ -38,16 +38,17 @@
       know about them.  */
    enum yytokentype {
      fqENDOFTEXT = 0,
-     fqNUMBER = 258,
-     fqALPHANUM = 259,
-     fqWS = 260,
-     fqENDLINE = 261,
-     fqBASESEQ = 262,
-     fqCOLORSEQ = 263,
-     fqTOKEN = 264,
-     fqASCQUAL = 265,
-     fqCOORDS = 266,
-     fqUNRECOGNIZED = 267
+     fqRUNDOTSPOT = 258,
+     fqNUMBER = 259,
+     fqALPHANUM = 260,
+     fqWS = 261,
+     fqENDLINE = 262,
+     fqBASESEQ = 263,
+     fqCOLORSEQ = 264,
+     fqTOKEN = 265,
+     fqASCQUAL = 266,
+     fqCOORDS = 267,
+     fqUNRECOGNIZED = 268
    };
 #endif
 
diff --git a/tools/fastq-loader/latf-load.vers b/tools/fastq-loader/latf-load.vers
index cc6c9a4..8e8299d 100644
--- a/tools/fastq-loader/latf-load.vers
+++ b/tools/fastq-loader/latf-load.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/fastq-loader/latf-load.vers.h b/tools/fastq-loader/latf-load.vers.h
new file mode 100644
index 0000000..fa26c04
--- /dev/null
+++ b/tools/fastq-loader/latf-load.vers.h
@@ -0,0 +1 @@
+#define LATF_LOAD_VERS 0x02040002
diff --git a/tools/fastq-loader/loader-imp.c b/tools/fastq-loader/loader-imp.c
index fdd39e1..8a03038 100644
--- a/tools/fastq-loader/loader-imp.c
+++ b/tools/fastq-loader/loader-imp.c
@@ -139,7 +139,7 @@ rc_t OpenPath(char const path[], KDirectory **dir)
     rc_t rc = KDirectoryNativeDir(&p);
     
     if (rc == 0) {
-        rc = KDirectoryOpenDirUpdate(p, dir, false, path);
+        rc = KDirectoryOpenDirUpdate(p, dir, false, "%s", path);
         KDirectoryRelease(p);
     }
     return rc;
@@ -171,6 +171,7 @@ rc_t run(char const progName[], CommonWriterSettings* G, unsigned seqFiles, cons
     rc_t rc;
     rc_t rc2;
     char const *db_type = "NCBI:align:db:alignment_sorted"; 
+/*    char const *db_type = "NCBI:align:db:unaligned"; */
     
     rc = VDBManagerMakeUpdate(&mgr, NULL);
     if (rc) {
@@ -184,15 +185,15 @@ rc_t run(char const progName[], CommonWriterSettings* G, unsigned seqFiles, cons
             (void)LOGERR (klogErr, rc, "failed to create schema");
         }
         else {
-            (void)(rc = VSchemaAddIncludePath(schema, G->schemaIncludePath));
-            rc = VSchemaParseFile(schema, G->schemaPath);
+            (void)(rc = VSchemaAddIncludePath(schema, "%s", G->schemaIncludePath));
+            rc = VSchemaParseFile(schema, "%s", G->schemaPath);
             if (rc) {
                 (void)PLOGERR(klogErr, (klogErr, rc, "failed to parse schema file $(file)", "file=%s", G->schemaPath));
             }
             else {
                 VDatabase *db;
                 
-                rc = VDBManagerCreateDB(mgr, &db, schema, db_type, kcmInit + kcmMD5, G->outpath);
+                rc = VDBManagerCreateDB(mgr, &db, schema, db_type, kcmInit + kcmMD5, "%s", G->outpath);
                 rc2 = VSchemaRelease(schema);
                 if (rc2)
                     (void)LOGERR(klogWarn, rc2, "Failed to release schema");
@@ -222,7 +223,7 @@ rc_t run(char const progName[], CommonWriterSettings* G, unsigned seqFiles, cons
                     if (rc == 0) {
                         KDatabase *kdb;
                         
-                        rc = KDBManagerOpenDBUpdate(kmgr, &kdb, G->outpath);
+                        rc = KDBManagerOpenDBUpdate(kmgr, &kdb, "%s", G->outpath);
                         if (rc == 0) {
                             rc = KDatabaseOpenMetadataUpdate(kdb, &meta);
                             KDatabaseRelease(kdb);
diff --git a/tools/fix-run-stat/Makefile b/tools/fix-run-stat/Makefile
new file mode 100644
index 0000000..3b39ff8
--- /dev/null
+++ b/tools/fix-run-stat/Makefile
@@ -0,0 +1,93 @@
+# ==============================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: std
+
+TOP ?= $(abspath ../..)
+MODULE = tools/fix-run-stat
+
+include $(TOP)/build/Makefile.env
+
+INT_TOOLS = \
+
+EXT_TOOLS = \
+	fix-run-stat
+
+ALL_TOOLS = \
+	$(INT_TOOLS) \
+	$(EXT_TOOLS)
+
+#-------------------------------------------------------------------------------
+# outer targets
+#
+all std: vers-includes
+	@ $(MAKE_CMD) $(TARGDIR)/std
+
+$(ALL_TOOLS): vers-includes
+	@ $(MAKE_CMD) $(BINDIR)/$@
+
+.PHONY: all std $(ALL_TOOLS)
+
+#-------------------------------------------------------------------------------
+# std
+#
+$(TARGDIR)/std: \
+	$(addprefix $(BINDIR)/,$(ALL_TOOLS))
+
+.PHONY: $(TARGDIR)/std
+
+#-------------------------------------------------------------------------------
+# vers-includes
+#
+$(TARGDIR)/vers-includes: $(addsuffix .vers.h,$(EXT_TOOLS))
+
+.PHONY: $(TARGDIR)/vers-includes
+
+#-------------------------------------------------------------------------------
+# clean
+#
+clean: stdclean
+
+.PHONY: clean
+
+#-------------------------------------------------------------------------------
+# fix-run-stat
+#  update run STATS metadata
+#
+FIX_RUN_STAT_SRC = \
+	fix-run-stat
+
+FIX_RUN_STAT_OBJ = \
+	$(addsuffix .$(OBJX),$(FIX_RUN_STAT_SRC))
+
+FIX_RUN_STAT_LIB = \
+	-lkapp \
+	-lncbi-wvdb \
+
+
+
+$(BINDIR)/fix-run-stat: $(FIX_RUN_STAT_OBJ)
+	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(FIX_RUN_STAT_LIB)
+
diff --git a/tools/fix-run-stat/fix-run-stat.c b/tools/fix-run-stat/fix-run-stat.c
new file mode 100644
index 0000000..fefefbc
--- /dev/null
+++ b/tools/fix-run-stat/fix-run-stat.c
@@ -0,0 +1,355 @@
+/******************************************************************************/
+#include <kapp/main.h> /* KMain */
+#include <sra/wsradb.h> /* SRAMgr */
+#include <kdb/table.h> /*  KTableRelease */
+#include <kxml/xml.h> /* KXMLMgrRelease */
+#include <kfs/file.h> /* KFileRelease */
+#include <klib/container.h> /* BSTree */
+#include <klib/log.h> /* LOGERR */
+#include <klib/rc.h> /* RC */
+#include <stdlib.h> /* calloc */
+#include <string.h> /* memset */
+#include <assert.h>
+#define DISP_RC(rc, msg) (void)((rc == 0) ? 0 : LOGERR(klogInt, rc, msg))
+#define RELEASE(type, obj) do { rc_t rc2 = type##Release(obj); \
+    if (rc2 && !rc) { rc = rc2; } obj = NULL; } while (false)
+#define FREE(obj) do { free(obj); obj = NULL; } while (false)
+typedef struct SValue {
+    uint64_t val;
+    bool found;
+} SValue;
+typedef struct Meta {
+    SValue base_count;
+    SValue base_count_bio;
+    SValue spot_count;
+    const char* member_name;
+    bool found;
+} Meta;
+typedef struct MetaMember {
+    BSTNode n;
+    char* member_name;
+    bool checked;
+    Meta* meta;
+} MetaMember;
+typedef struct XmlMeta { /* XML data: Just one of root or tr is present */
+    Meta root; /* sra-stat root node attributes */
+    BSTree* tr; /* sra-stat spot-group nodes (Member) attributes */
+} XmlMeta;
+typedef struct SDbMeta { /* DB metadata */
+    const Meta root; /* meta root */
+
+    bool stats_found; /* STATS */
+    const Meta* table; /* STATS/TABLE */
+    const BSTree* tr; /* STATS/SPOT_GROUP */
+} SDbMeta;
+typedef struct AppPrm {
+    const char* path;
+} AppPrm;
+typedef struct AppCtx {
+    SRAMgr* s_mgr;
+    const KXMLMgr* x_mgr;
+    KDirectory* dir;
+} AppCtx;
+static rc_t AppCtxInit(rc_t rc, AppCtx* ctx) {
+    assert(ctx);
+    memset(ctx, 0 , sizeof *ctx);
+    if (rc) {
+        return rc;
+    }
+    if (rc == 0) {
+        rc = SRAMgrMakeUpdate(&ctx->s_mgr, NULL);
+        DISP_RC(rc, "while calling SRAMgrMakeUpdate");
+    }
+    if (rc == 0) {
+        rc = KXMLMgrMakeRead(&ctx->x_mgr);
+        DISP_RC(rc, "while calling KXMLMgrMakeRead");
+    }
+    if (rc == 0) {
+        rc = KDirectoryNativeDir(&ctx->dir);
+        DISP_RC(rc, "while calling KDirectoryNativeDir");
+    }
+    return rc;
+}
+static rc_t AppCtxDestroy(rc_t rc, AppCtx* ctx) {
+    assert(ctx);
+    RELEASE(KDirectory, ctx->dir);
+    RELEASE(KXMLMgr, ctx->x_mgr);
+    RELEASE(SRAMgr, ctx->s_mgr);
+    return rc;
+}
+static int CC MetaMemberCmp(const void *item, const BSTNode *n) {
+    const char *key = item;
+    const MetaMember *a = ( const MetaMember* ) n;
+    return strcmp(key, a->member_name);
+}
+static int CC MetaMemberSort(const BSTNode *item, const BSTNode *n) {
+    const MetaMember *a = (const MetaMember*) item;
+    return MetaMemberCmp(a->member_name, n);
+}
+static rc_t s_KXMLNodeReadAttr(rc_t rc, const KXMLNode* node, const char* name,
+    SValue *val, bool required)
+{
+    return 0;
+}
+static rc_t ParseSraMetaNode(const KXMLNode* node,
+    const char* name, const char* member_name, Meta* meta)
+{
+    rc_t rc = 0;
+    bool required = member_name;
+    rc = s_KXMLNodeReadAttr
+        (rc, node, "base_count", &meta->base_count, required);
+    rc = s_KXMLNodeReadAttr
+        (rc, node, "base_count_bio", &meta->base_count_bio, required);
+    rc = s_KXMLNodeReadAttr
+        (rc, node, "spot_count", &meta->spot_count, required);
+    if (rc == 0) {
+        if (meta->base_count.found != meta->base_count_bio.found ||
+            meta->base_count.found != meta->spot_count.found)
+        {
+            rc = RC(rcExe, rcMetadata, rcReading, rcNode, rcNotFound);
+            if (member_name) {
+                PLOGERR(klogErr, (klogErr, rc, "One of statistics attributes "
+                    "in '$(name)|$(attr)' is missed",
+                    "name=%s,attr=%s", name, member_name));
+            }
+            else {
+                PLOGERR(klogErr, (klogErr, rc,
+                    "One of statistics attributes in '$(name)' is missed",
+                    "name=%s", name));
+            }
+        }
+        else {
+            meta->found = meta->base_count.found;
+        }
+    }
+    return rc;
+}
+static rc_t XmlMetaInitMemser(BSTree* tr,
+    const KXMLNode* node, const char* path, const char* member_name)
+{
+    rc_t rc = 0;
+    MetaMember* member
+        = (MetaMember*)BSTreeFind(tr, member_name, MetaMemberCmp);
+    if (member) {
+        rc = RC(rcExe, rcMetadata, rcReading, rcAttr, rcDuplicate);
+        PLOGERR(klogErr, (
+            klogErr, rc, "Member/@member_name='$(name)'",
+            "name=%s", member_name));
+    }
+    else {
+        member = calloc(1, sizeof(*member));
+        if (member == NULL) {
+            rc = RC(rcExe,
+                rcStorage, rcAllocating, rcMemory, rcExhausted);
+        }
+        if (rc == 0) {
+            member->member_name = strdup(member_name);
+            if (member == NULL) {
+                rc = RC(rcExe,
+                    rcStorage, rcAllocating, rcMemory, rcExhausted);
+            }
+        }
+        if (rc == 0) {
+            member->meta = calloc(1, sizeof(*member->meta));
+            if (member->meta == NULL) {
+                rc = RC(rcExe,
+                    rcStorage, rcAllocating, rcMemory, rcExhausted);
+            }
+        }
+        if (rc == 0) {
+            rc = ParseSraMetaNode(node, path, member_name, member->meta);
+        }
+        if (rc) {
+            if (member) {
+                FREE(member->member_name);
+                FREE(member->meta);
+                FREE(member);
+            }
+        }
+        else {
+            BSTreeInsert(tr, (BSTNode*)member, MetaMemberSort);
+        }
+    }
+    return rc;
+}
+static rc_t XmlMetaInitMembers(BSTree* tr, const KXMLNode* node) {
+    rc_t rc = 0;
+    const char path[] = "Member";
+    uint32_t count = 0;
+    uint32_t idx = 0;
+    const KXMLNodeset *members = NULL;
+    if (rc == 0) {
+        rc = KXMLNodeOpenNodesetRead(node, &members, path);
+        DISP_RC(rc, path);
+    }
+    if (rc == 0) {
+        rc = KXMLNodesetCount(members, &count);
+        DISP_RC(rc, path);
+    }
+    for (idx = 0; idx < count && rc == 0; ++idx) {
+        const KXMLNode *node = NULL;
+        char member_name[256] = "";
+        if (rc == 0) {
+            rc = KXMLNodesetGetNodeRead(members, &node, idx);
+            DISP_RC(rc, path);
+        }
+        if (rc == 0) {
+            size_t size = 0;
+            rc = KXMLNodeReadAttrCString(node, "member_name",
+                member_name, sizeof member_name, &size);
+            if (rc) {
+                if (GetRCState(rc) == rcInsufficient) {
+                    member_name[sizeof member_name - 1] = '\0';
+                    rc = 0;
+                }
+            }
+        }
+        if (rc == 0) {
+            rc = XmlMetaInitMemser(tr, node, path, member_name);
+        }
+        RELEASE(KXMLNode, node);
+    }
+    RELEASE(KXMLNodeset, members);
+    return rc;
+}
+static rc_t XmlMetaInit(rc_t rc, XmlMeta* meta,
+    const AppCtx* ctx, const char* xml)
+{
+    const KFile* f = NULL;
+    const KXMLDoc* doc = NULL;
+    const KXMLNodeset* ns = NULL;
+    const KXMLNode* node = NULL;
+    const char path[] = "/Run";
+    memset(meta, 0, sizeof *meta);
+    if (rc) {
+        return rc;
+    }
+    if (rc == 0) {
+        rc = KDirectoryOpenFileRead(ctx->dir, &f, "%s", xml);
+        DISP_RC(rc, xml);
+    }
+    if (rc == 0) {
+        rc = KXMLMgrMakeDocRead(ctx->x_mgr, &doc, f);
+        DISP_RC(rc, xml);
+    }
+    if (rc == 0) {
+        rc = KXMLDocOpenNodesetRead(doc, &ns, path);
+        DISP_RC(rc, path);
+    }
+    if (rc == 0) {
+        rc = KXMLNodesetGetNodeRead(ns, &node, 0);
+        DISP_RC(rc, path);
+    }
+    if (rc == 0) {
+        rc = ParseSraMetaNode(node, path, NULL, &meta->root);
+    }
+    if (rc == 0 && !meta->root.found) {
+        meta->tr = calloc(1, sizeof *meta->tr);
+        if (meta->tr == NULL) {
+            rc = RC(rcExe, rcStorage, rcAllocating, rcMemory, rcExhausted);
+        }
+        else {
+            BSTreeInit(meta->tr);
+            rc = XmlMetaInitMembers(meta->tr, node);
+        }
+    }
+    RELEASE(KXMLNode, node);
+    RELEASE(KXMLNodeset, ns);
+    RELEASE(KXMLDoc, doc);
+    RELEASE(KFile, f);
+    return rc;
+}
+static rc_t XmlMetaDestroy(rc_t rc, const XmlMeta* meta) {
+    return rc;
+}
+static int Size(const BSTree* tr) { return 0; }
+static bool MetaEqual(const Meta* lhs, const Meta* rhs) { return false; }
+static bool Equal(const Meta* xml, const BSTree* tr, const char* key)
+{ return false; }
+static bool BSTreeEqual(const BSTree* lhs, const BSTree* rhs) { return false; }
+static rc_t CheckMeta(const XmlMeta* xml, const SDbMeta* db, bool* found) {
+    rc_t rc = RC(rcExe, rcMetadata, rcReading, rcMetadata, rcUnequal);
+    assert(xml && db && found);
+    *found = false;
+    if (xml->root.found) { /* has statistics in root node: no spot-groups */
+        if (Size(xml->tr) > 0) { /* should have no Member nodes */
+            rc = RC(rcExe, rcXmlDoc, rcReading, rcXmlDoc, rcInvalid);
+        }
+        else if (db->stats_found) { /* has STATS */
+            if (!MetaEqual(&xml->root, db->table)) {
+                /* xml: Run != STATS/TABLE */
+                rc = RC(rcExe, rcMetadata, rcReading, rcMetadata, rcUnequal);
+            }
+            else if (!Equal(&xml->root, db->tr, "default")) {
+                /* xml: Run != STATS/SPOT_GROUP/default */
+                rc = RC(rcExe, rcMetadata, rcReading, rcMetadata, rcUnequal);
+            }
+            else if (Size(db->tr) != 1) {
+                /* STATS/SPOT_GROUP should have just default subnode */
+                rc = RC(rcExe, rcMetadata, rcReading, rcMetadata, rcInvalid);
+            } else {
+                *found = true;
+                rc = 0;
+            }
+        }
+        else { /* no STATS: check with meta in root */
+            if (!db->root.found) { /* no root meta */
+                rc = 0;
+            }
+            else if (!MetaEqual(&xml->root, &db->root)) {
+                rc = RC(rcExe, rcMetadata, rcReading, rcMetadata, rcUnequal);
+            }
+            else {
+                *found = true;
+                rc = 0;
+            }
+        }
+    }
+    else { /* sra-stat xml has spotgroups info */
+        if (db->root.found) { /* unknown: could it have root meta nodes? */
+            rc = RC(rcExe, rcMetadata, rcReading, rcMetadata, rcInvalid);
+        }
+        else if (Size(db->tr) > 0) { /* exist STATS/SPOT_GROUP/... */
+            if (!BSTreeEqual(xml->tr, db->tr)) {
+                rc = RC(rcExe, rcMetadata, rcReading, rcMetadata, rcUnequal);
+            }
+            /* could add Equal(sum(xml->tr), meta->table) */
+            else {
+                *found = true;
+                rc = 0;
+            }
+        }
+        else { /* no statistics meta */
+            rc = 0;
+        }
+    }
+    return rc;
+}
+static rc_t fix_run_stat(const XmlMeta* xml) {
+    rc_t rc = 0;
+    bool found = false;
+    const SRATable *tbl = NULL;
+    SDbMeta db;
+    memset(&db, 0, sizeof db);
+    rc = CheckMeta(xml, &db, &found);
+    RELEASE(SRATable, tbl);
+    return rc;
+}
+const char UsageDefaultName[] = "fix-run-stat";
+rc_t CC UsageSummary (const char * prog_name) { return 0; }
+rc_t CC Usage ( const Args * args ) { return 0; }
+ver_t CC KAppVersion ( void ) { return 0x01000000; }
+rc_t KMain(int argc, char *argv []) {
+    rc_t rc = 0;
+    AppCtx ctx;
+    XmlMeta meta;
+    rc = AppCtxInit(rc, &ctx);
+    rc = XmlMetaInit(rc,
+        &meta, &ctx, "/home/klymenka/fix-run-stat/SRR331456/SRR331456.xml");
+    if (rc == 0) {
+        rc = fix_run_stat(&meta);
+    }
+    rc = XmlMetaDestroy(rc, &meta);
+    rc = AppCtxDestroy(rc, &ctx);
+    return rc;
+}
diff --git a/tools/fix-run-stat/fix-run-stat.vers b/tools/fix-run-stat/fix-run-stat.vers
new file mode 100644
index 0000000..8e8299d
--- /dev/null
+++ b/tools/fix-run-stat/fix-run-stat.vers
@@ -0,0 +1 @@
+2.4.2
diff --git a/tools/fuse/Makefile b/tools/fuse/Makefile
new file mode 100644
index 0000000..4dde500
--- /dev/null
+++ b/tools/fuse/Makefile
@@ -0,0 +1,179 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: std
+
+TOP ?= $(abspath ../..)
+MODULE = tools/fuse
+
+include $(TOP)/build/Makefile.env
+
+INT_TOOLS =
+
+EXT_TOOLS = \
+	remote-fuser \
+
+ALL_TOOLS = \
+	$(INT_TOOLS) \
+	$(EXT_TOOLS)
+
+#-------------------------------------------------------------------------------
+# outer targets
+#
+all std: vers-includes
+	@ $(MAKE_CMD) $(TARGDIR)/std
+
+$(ALL_TOOLS): vers-includes
+	@ $(MAKE_CMD) $(BINDIR)/$@
+
+.PHONY: all std $(ALL_TOOLS)
+
+#-------------------------------------------------------------------------------
+# std
+#
+$(TARGDIR)/std: \
+	$(addprefix $(BINDIR)/,$(ALL_TOOLS))
+
+.PHONY: $(TARGDIR)/std
+
+#-------------------------------------------------------------------------------
+# vers-includes
+#
+$(TARGDIR)/vers-includes: $(addsuffix .vers.h,$(EXT_TOOLS))
+
+.PHONY: $(TARGDIR)/vers-includes
+
+#-------------------------------------------------------------------------------
+# clean
+#
+clean: stdclean
+
+.PHONY: clean
+
+#-------------------------------------------------------------------------------
+# sra-fuser
+#
+SRA_FUSER_SRC = \
+        zlib-simple \
+        log \
+        node \
+        tar-list \
+        file \
+        tar-file \
+        tar-node \
+        directory \
+        formats \
+        accessor \
+        kfile-accessor \
+        xml \
+        text-file \
+        sra-list \
+        sra-directory \
+        sra-node \
+        sra-fastq \
+        sra-sff \
+        sra-fuser-sys \
+        sra-fuser
+
+SRA_FUSER_OBJ = \
+	$(addsuffix .$(OBJX),$(SRA_FUSER_SRC))
+
+LIBXML = -lxml2
+ifdef NCBI
+CFLAGS += -DSRAFUSER_LOGLOCALTIME
+ifeq (linux,$(OS))
+   LIBXML = -X$(LIBXML_LPATH) -lxml2-static
+endif
+ifeq (sun,$(OS))
+   LIBXML = -X$(LIBXML_LPATH) -lxml2-static
+endif
+endif
+
+SRA_FUSER_LIB = \
+	-lkapp \
+	-sncbi-vdb \
+	-lfuse \
+	-lrt
+
+$(BINDIR)/sra-fuser: $(SRA_FUSER_OBJ)
+	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(SRA_FUSER_LIB)
+
+#-------------------------------------------------------------------------------
+# remote-fuser
+#
+REMOTE_FUSER_SRC = \
+        log \
+        node \
+        accessor \
+        kfile-accessor \
+        remote-xml \
+        remote-cache \
+        remote-link \
+        remote-file \
+        remote-directory \
+        remote-fuser-sys \
+        remote-fuser
+
+REMOTE_FUSER_OBJ = \
+	$(addsuffix .$(OBJX),$(REMOTE_FUSER_SRC))
+
+LIBXML = -lxml2
+ifdef NCBI
+CFLAGS += -DSRAFUSER_LOGLOCALTIME
+ifeq (linux,$(OS))
+   LIBXML = -X$(LIBXML_LPATH) -lxml2-static
+endif
+ifeq (sun,$(OS))
+   LIBXML = -X$(LIBXML_LPATH) -lxml2-static
+endif
+endif
+
+REMOTE_FUSER_LIB = \
+	-lkapp \
+	-sncbi-vdb \
+	-lfuse \
+	-lrt
+
+$(BINDIR)/remote-fuser: $(REMOTE_FUSER_OBJ)
+	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(REMOTE_FUSER_LIB)
+
+#-------------------------------------------------------------------------------
+# sra-fuser
+#
+SRA_MAKEIDX_SRC = \
+    zlib-simple \
+	sra-makeidx
+
+SRA_MAKEIDX_OBJ = \
+	$(addsuffix .$(OBJX),$(SRA_MAKEIDX_SRC))
+
+SRA_MAKEIDX_LIB = \
+	-lkapp \
+	-lncbi-wvdb \
+	-ssrareader \
+
+$(BINDIR)/sra-makeidx: $(SRA_MAKEIDX_OBJ)
+	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(SRA_MAKEIDX_LIB)
+
diff --git a/tools/fuse/accessor.c b/tools/fuse/accessor.c
new file mode 100644
index 0000000..e91ef9a
--- /dev/null
+++ b/tools/fuse/accessor.c
@@ -0,0 +1,134 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#include <stdlib.h>
+#include <string.h>
+
+#include "accessor.h"
+#include "log.h"
+
+/* used to detect correct object pointers */
+const uint32_t SAccessor_MAGIC = 0xFACE5550;
+
+struct SAccessor {
+    uint32_t magic;
+    char* name;
+    AccessorRead* Read;
+    AccessorRelease* Release;
+};
+
+rc_t SAccessor_Make(const SAccessor** cself, size_t size, const char* name, AccessorRead* read, AccessorRelease* release)
+{
+    rc_t rc = 0;
+    SAccessor* self = NULL;
+
+    if( cself == NULL ) {
+        rc = RC(rcExe, rcFile, rcConstructing, rcSelf, rcNull);
+    } else {
+        CALLOC(self, 1, sizeof(*self) + size);
+        if( self == NULL ) {
+            rc = RC(rcExe, rcFile, rcConstructing, rcMemory, rcExhausted);
+        } else {
+            if( (rc = StrDup(name, &self->name)) == 0 ) {
+                self->magic = SAccessor_MAGIC;
+                self->Read = read;
+                self->Release = release;
+                /* shift pointer to after hidden structure */
+                DEBUG_MSG(8, ("%s: %s\n", __func__, self->name));
+                self++;
+            } else {
+                FREE(self);
+            }
+        }
+        *cself = rc ? NULL : self;
+    }
+    return rc;
+}
+
+static
+rc_t SAccessor_ResolveSelf(const SAccessor* self, enum RCContext ctx, SAccessor** resolved)
+{
+    if( self == NULL || resolved == NULL ) {
+        return RC(rcSRA, rcFile, ctx, rcSelf, rcNull);
+    }
+    *resolved = (SAccessor*)--self;
+    /* just to validate that it is full instance */
+    if( (*resolved)->magic != SAccessor_MAGIC ) {
+        *resolved = NULL;
+        return RC(rcSRA, rcFile, ctx, rcSelf, rcCorrupt);
+    }
+    return 0;
+}
+
+
+rc_t SAccessor_Read(const SAccessor* cself, char* buf, size_t size, off_t offset, size_t* num_read)
+{
+    rc_t rc = 0;
+    SAccessor* self = NULL;
+
+    if( buf == NULL || num_read == NULL ) {
+        return RC(rcExe, rcFile, rcReading, rcParam, rcNull);
+    } else if( (rc = SAccessor_ResolveSelf(cself, rcEvaluating, &self)) == 0 ) {
+        DEBUG_MSG(8, ("%s: %s\n", __func__, self->name));
+        if( self->Read ) {
+            *num_read = 0;
+            rc = self->Read(cself, buf, size, offset, num_read);
+        } else {
+            rc = RC(rcExe, rcFile, rcReading, rcInterface, rcUnsupported);
+        }
+    }
+    return rc;
+}
+
+rc_t SAccessor_GetName(const SAccessor* cself, const char** name)
+{
+    rc_t rc = 0;
+    SAccessor* self = NULL;
+
+    if( name == NULL ) {
+        rc = RC(rcExe, rcFile, rcEvaluating, rcParam, rcInvalid);
+    } else if( (rc = SAccessor_ResolveSelf(cself, rcEvaluating, &self)) == 0 ) {
+        *name = self->name;
+    }
+    return rc;
+}
+
+rc_t SAccessor_Release(const SAccessor* cself)
+{
+    rc_t rc = 0;
+    if( cself != NULL ) {
+        SAccessor* self = NULL;
+
+        if( (rc = SAccessor_ResolveSelf(cself, rcReleasing, &self)) == 0 ) {
+            if( self->Release ) {
+                rc = self->Release(cself);
+            }
+            DEBUG_MSG(8, ("%s: %s\n", __func__, self->name));
+            FREE(self->name);
+            FREE(self);
+        }
+    }
+    return rc;
+}
diff --git a/tools/fuse/accessor.h b/tools/fuse/accessor.h
new file mode 100644
index 0000000..c872216
--- /dev/null
+++ b/tools/fuse/accessor.h
@@ -0,0 +1,46 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#ifndef _h_sra_fuse_accessor_
+#define _h_sra_fuse_accessor_
+
+#include <unistd.h>
+
+#include <klib/rc.h>
+
+typedef struct SAccessor SAccessor;
+
+typedef rc_t (AccessorRead)(const SAccessor* cself, char* buf, size_t size, off_t offset, size_t* num_read);
+typedef rc_t (AccessorRelease)(const SAccessor* cself);
+
+rc_t SAccessor_Make(const SAccessor** cself, size_t size, const char* name, AccessorRead* read, AccessorRelease* release);
+
+rc_t SAccessor_GetName(const SAccessor* cself, const char** name);
+
+rc_t SAccessor_Read(const SAccessor* cself, char* buf, size_t size, off_t offset, size_t* num_read);
+
+rc_t SAccessor_Release(const SAccessor* cself);
+
+#endif /* _h_sra_fuse_accessor_ */
diff --git a/tools/fuse/debug.h b/tools/fuse/debug.h
new file mode 100644
index 0000000..ba0375d
--- /dev/null
+++ b/tools/fuse/debug.h
@@ -0,0 +1,53 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+#ifndef _services_sra_fuser_debug_h_
+#define _services_sra_fuser_debug_h_
+
+#include <klib/debug.h>
+
+#if _DEBUGGING
+#define DEBUG_MSG_PASTE(a,b) a##b
+#define DEBUG_MSG(flag,msg) DBGMSG(DBG_APP,DBG_FLAG(DEBUG_MSG_PASTE(DBG_APP_,flag)), msg)
+#define DEBUG_LINE(flag,fmt,...) DEBUG_MSG(flag, ("%s:%u: " fmt "\n", __func__, __LINE__, __VA_ARGS__))
+
+#define MALLOC(ptr, size) ptr = malloc(size); DEBUG_LINE(10, "%p=malloc(%lu)", ptr, size)
+#define CALLOC(ptr, qty, size) ptr = calloc(qty, size); DEBUG_LINE(10, "%p=calloc(%lu)", ptr, qty * size)
+#define REALLOC(ptr, src, size) ptr = realloc(src, size); DEBUG_LINE(10, "%p=realloc(%p, %lu)", ptr, src, size)
+#define FREE(ptr) free(ptr); if(ptr){DEBUG_LINE(10, "0=free(%p)", ptr);}
+
+#else
+
+#define DEBUG_MSG(flag,msg) ((void)0)
+#define DEBUG_LINE(flag,fmt,...) ((void)0)
+
+#define MALLOC(ptr, size) ptr = malloc(size)
+#define CALLOC(ptr, qty, size) ptr = calloc(qty, size)
+#define REALLOC(ptr, src, size) ptr = realloc(src, size)
+#define FREE(ptr) free(ptr)
+
+#endif
+
+#endif /* _services_sra_fuser_debug_h_ */
diff --git a/tools/fuse/directory.c b/tools/fuse/directory.c
new file mode 100644
index 0000000..f309cff
--- /dev/null
+++ b/tools/fuse/directory.c
@@ -0,0 +1,566 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#include <klib/namelist.h>
+#include <klib/printf.h>
+#include <kxml/xml.h>
+#include <klib/container.h>
+#include <kfs/directory.h>
+#include <kfs/file.h>
+#include <kproc/lock.h>
+
+typedef struct DirectoryNode DirectoryNode;
+#define FSNODE_IMPL DirectoryNode
+
+#include "log.h"
+#include "xml.h"
+#include "directory.h"
+#include "tar-node.h"
+#include "kfile-accessor.h"
+
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <time.h>
+
+typedef struct DirNodeChild_struct {
+    BSTNode node;
+    const char* full_name; /* full path to detected file */
+    const char* name; /* file name only within full_name above */
+    const FSNode* child;
+} DirNodeChild;
+
+static
+int DirNodeChild_Sort(const BSTNode *item, const BSTNode *node)
+{
+    return strcmp(((const DirNodeChild*)item)->child->name, ((const DirNodeChild*)node)->child->name);
+}
+
+static
+int DirNodeChild_FindByName(const void *item, const BSTNode *node)
+{
+    return strcmp((const char*)item, ((const DirNodeChild*)node)->child->name);
+}
+
+static
+int DirNodeChild_FindBySrc(const void *item, const BSTNode *node)
+{
+    return strcmp((const char*)item, ((const DirNodeChild*)node)->name);
+}
+
+static
+void DirNodeChild_Whack(BSTNode *node, void *data)
+{
+    DirNodeChild* n = (DirNodeChild*)node;
+
+    if( n != NULL ) {
+        DEBUG_LINE(8, "Releasing auto TAR %s", n->child->name);
+        FSNode_Release(n->child);
+        FREE(n);
+    }
+}
+
+static
+void DirNodeChild_Touch( BSTNode *node, void *data )
+{
+    DirNodeChild* n = (DirNodeChild*)node;
+    BSTree* t = (BSTree*)data;
+    if( FSNode_Touch(n->child) != 0 ) {
+        BSTreeUnlink(t, node);
+        DirNodeChild_Whack(node, NULL);
+    }
+}
+
+struct DirectoryNode {
+    FSNode node;
+    char* path;
+    KTime_t mtime;
+    KRWLock* lock;
+    KTime_t timestamp;
+    /* list of physical files and dirs in 'path' minus those in children list */
+    KNamelist* ls; 
+    BSTree children;
+};
+
+struct DirNodeChild_List_Data {
+    rc_t rc;
+    const DirectoryNode* cself;
+    FSNode_Dir_Visit func;
+    void* data;
+};
+
+static
+bool DirNodeChild_List( BSTNode *node, void *data )
+{
+    DirNodeChild* n = (DirNodeChild*)node;
+    struct DirNodeChild_List_Data* d = (struct DirNodeChild_List_Data*)data;
+    const FSNode* ch;
+    bool hidden = true;
+
+    if( ((d->rc = FSNode_FindChild(&d->cself->node, n->child->name, strlen(n->child->name), &ch, &hidden)) == 0 && hidden) ||
+         (GetRCObject(d->rc) == rcName && GetRCState(d->rc) == rcNotFound) ) {
+        d->rc = d->func(n->child->name, d->data);
+    }
+    return d->rc != 0;
+}
+
+static
+rc_t DirectoryNode_Lock(const DirectoryNode* cself, bool exclusive)
+{
+    DEBUG_LINE(8, "Lock DirectoryNode %s %s", cself->path, exclusive ? "write" : "read");
+    return exclusive ? KRWLockAcquireExcl(((DirectoryNode*)cself)->lock) : KRWLockAcquireShared(((DirectoryNode*)cself)->lock);
+}
+
+static
+rc_t DirectoryNode_Unlock(const DirectoryNode* cself)
+{
+    DEBUG_LINE(8, "Unlocking DirectoryNode %s", cself->path);
+    return KRWLockUnlock(((DirectoryNode*)cself)->lock);
+}
+
+static
+rc_t DirectoryNode_IsChild(const DirectoryNode* cself, const char* subpath, const FSNode** node,
+                           int (*finder)(const void *item, const BSTNode *node))
+{
+    DirNodeChild* n = (DirNodeChild*)BSTreeFind(&cself->children, subpath, finder);
+    if( n != NULL ) {
+        *node = n->child;
+    } else {
+        *node = NULL;
+        return RC(rcExe, rcFile, rcAccessing, rcName, rcNotFound);
+    }
+    return 0;
+}
+
+static
+rc_t CC DirectoryNode_AddTar( const KDirectory *dir, uint32_t type, const char *name, void *data )
+{
+    rc_t rc = 0;
+
+    if( (type & ~kptAlias) == kptFile && name != NULL ) {
+        size_t lnm = strlen(name);
+
+        if( lnm > 8 && strncmp(&name[lnm - 8], ".tar.xml", 8) == 0 ) {
+            DirectoryNode* self = (DirectoryNode*)data;
+            DirNodeChild* n = (DirNodeChild*)BSTreeFind(&self->children, name, DirNodeChild_FindBySrc);
+            if( n == NULL ) {
+                char resolved[4096];
+                if( (rc = KDirectoryResolvePath(dir, true, resolved, sizeof(resolved), "%s/%s", self->path, name)) == 0 ) {
+                    size_t lrs = strlen(resolved);
+                    CALLOC(n, 1, sizeof(*n) + lrs + 1);
+                    if( n == NULL ) {
+                        rc = RC(rcExe, rcArc, rcInserting, rcMemory, rcExhausted);
+                    } else {
+                        char* x = (char*)&n[1];
+                        memcpy(x, resolved, lrs);
+                        x[lrs] = '\0';
+                        n->full_name = x;
+                        n->name = &n->full_name[lrs - lnm];
+                        if( (rc = TarNode_MakeAuto(&n->child, dir, self->path, name, n->full_name)) != 0 ||
+                            (rc = BSTreeInsert(&self->children, &n->node, DirNodeChild_Sort)) != 0 ) {
+                            DirNodeChild_Whack(&n->node, NULL);
+                        }
+                    }
+                }
+            }
+        }
+    }
+    return rc;
+}
+
+static
+bool DirectoryNode_LS( const KDirectory *dir, const char *name, void *data )
+{
+    size_t lnm = name ? strlen(name) : 0;
+    bool ret;
+
+    if( lnm > 8 && strncmp(&name[lnm - 8], ".tar.xml", 8) == 0 ) {
+        DirectoryNode* self = (DirectoryNode*)data;
+        ret = BSTreeFind(&self->children, name, DirNodeChild_FindBySrc) == NULL;
+    } else if( lnm > 4 && strncmp(&name[lnm - 4], ".tar", 4) == 0 ) {
+        DirectoryNode* self = (DirectoryNode*)data;
+        const FSNode* child;
+        /* virtual .tar file hides actual .tar file with same name */
+        ret = DirectoryNode_IsChild(self, name, &child, DirNodeChild_FindByName) != 0;
+    } else {
+        ret = true;
+    }
+    return ret;
+}
+
+static
+rc_t DirectoryNode_Touch(const DirectoryNode* cself)
+{
+    rc_t rc = 0;
+
+    if( cself->path != NULL ) {
+        if( (rc = DirectoryNode_Lock(cself, true)) == 0 ) {
+            KDirectory* dir;
+            /* drop disappeared items, update existing */
+            BSTreeForEach(&cself->children, false, DirNodeChild_Touch, (void*)&cself->children);
+            if( (rc = KDirectoryNativeDir(&dir)) == 0 ) {
+                KTime_t dt = 0;
+                if( (rc = KDirectoryDate(dir, &dt, "%s", cself->path)) == 0 && cself->timestamp != dt ) {
+                    DirectoryNode* self = (DirectoryNode*)cself;
+                    /* re-read directory */
+                    ReleaseComplain(KNamelistRelease, self->ls);
+                    self->ls = NULL;
+                    if( (rc = KDirectoryVisit(dir, false, DirectoryNode_AddTar, self, "%s", self->path)) == 0 ) {
+                        rc = KDirectoryList(dir, &self->ls, DirectoryNode_LS, self, "%s", self->path);
+                    }
+                    self->timestamp = rc == 0 ? dt : 0;
+                }
+                ReleaseComplain(KDirectoryRelease, dir);
+            }
+            ReleaseComplain(DirectoryNode_Unlock, cself);
+        }
+    }
+    return rc;
+}
+
+static
+rc_t DirectoryNode_Attr(const DirectoryNode* cself, const char* subpath, uint32_t* type, KTime_t* ts, uint64_t* file_sz, uint32_t* access, uint64_t* block_sz)
+{
+    rc_t rc = 0;
+
+    *type = kptDir;
+    if( cself->path != NULL ) {
+        KDirectory* dir = NULL;
+        const KDirectory* sub = NULL;
+
+        if( subpath != NULL && (rc = DirectoryNode_Lock(cself, false)) == 0 ) {
+            const FSNode* child = NULL;
+            if( (rc = DirectoryNode_IsChild(cself, subpath, &child, DirNodeChild_FindByName)) == 0 ) {
+                rc = FSNode_Attr(child, NULL, type, ts, file_sz, access, block_sz);
+            }
+            ReleaseComplain(DirectoryNode_Unlock, cself);
+            if( child != NULL ) {
+                return rc;
+            }
+        }
+        if( (rc = KDirectoryNativeDir(&dir)) == 0 &&
+            (rc = KDirectoryOpenDirRead(dir, &sub, true, "%s", cself->path)) == 0 ) {
+            const char* path = subpath ? subpath : ".";
+            DEBUG_LINE(8, "Using full name %s/%s", cself->path, path);
+            if( (rc = KDirectoryDate(sub, ts, "%s", path)) == 0 ) {
+                *type = KDirectoryPathType(sub, "%s", path);
+                if( *type != kptBadPath && *type != kptNotFound ) {
+                    if( (rc = KDirectoryAccess(sub, access, "%s", path)) == 0 ) {
+                        if( *type & kptAlias ) {
+                            bool children;
+                            if( (rc = FSNode_HasChildren(&cself->node, &children)) == 0 ) {
+                                /* if it is pointer to an aliased directory and has no XML children than pass symlink on */
+                                if( children == false || subpath != NULL ) {
+                                    char r[4096];
+                                    if( (rc = KDirectoryResolveAlias(sub, true, r, sizeof(r), "%s", path)) == 0 ) {
+                                         DEBUG_LINE(8, "Symlink name %s", r);
+                                        *file_sz = strlen(r);
+                                    }
+                                } else {
+                                    /* otherwise remove alias bit */
+                                    *type = *type & ~kptAlias;
+                                }
+                            }
+                        } else if( *type == kptFile ) {
+                            rc = KDirectoryFileSize(sub, file_sz, "%s", path);
+                        }
+                    }
+                }
+            }
+        }
+        ReleaseComplain(KDirectoryRelease, sub);
+        ReleaseComplain(KDirectoryRelease, dir);
+    } else if( subpath != NULL ) {
+        rc = RC(rcExe, rcDirectory, rcEvaluating, rcDirEntry, rcNotFound);
+    }
+    if( subpath == NULL && cself->mtime != 0 ) {
+        *ts = cself->mtime;
+    }
+    return rc;
+}
+
+struct DirectoryNode_DirVisit_Data {
+    FSNode_Dir_Visit func;
+    void* data;
+};
+
+static
+rc_t CC DirectoryNode_DirVisit( const KDirectory *dir, uint32_t type, const char *name, void *data )
+{
+    struct DirectoryNode_DirVisit_Data* d = (struct DirectoryNode_DirVisit_Data*)data;
+    return d->func(name, d->data);
+}
+
+static
+rc_t DirectoryNode_Dir(const DirectoryNode* cself, const char* subpath, FSNode_Dir_Visit func, void* data)
+{
+    rc_t rc = 0;
+
+    if( subpath == NULL ) {
+        /* add XML tree children */
+        if( (rc = FSNode_ListChildren(&cself->node, func, data)) == 0 ) {
+            if( (rc = DirectoryNode_Lock(cself, false)) == 0 ) {
+                if( cself->ls != NULL ) {
+                    /* add ls result excluding XML children */
+                    uint32_t i = 0, count = 0;
+                    rc = KNamelistCount(cself->ls, &count);
+                    while(rc == 0 && i < count) {
+                        const char* nm = NULL;
+                        const FSNode* ch;
+                        bool hidden = true;
+                        if( (rc = KNamelistGet(cself->ls, i++, &nm)) == 0 &&
+                            (((rc = FSNode_FindChild(&cself->node, nm, strlen(nm), &ch, &hidden)) == 0 && hidden) ||
+                             (GetRCObject(rc) == rcName && GetRCState(rc) == rcNotFound)) ) {
+                            rc = func(nm, data);
+                        }
+                    }
+                }
+                if( rc == 0 ) {
+                    struct DirNodeChild_List_Data d;
+                    d.rc = 0;
+                    d.cself = cself;
+                    d.func = func;
+                    d.data = data;
+                    /* add detected child nodes excluding XML children */
+                    BSTreeDoUntil(&cself->children, false, DirNodeChild_List, &d);
+                    rc = d.rc;
+                }
+                ReleaseComplain(DirectoryNode_Unlock, cself);
+            }
+        }
+    } else {
+        KDirectory* dir = NULL;
+        if( (rc = KDirectoryNativeDir(&dir)) == 0 ) {
+            struct DirectoryNode_DirVisit_Data d;
+            d.func = func;
+            d.data = data;
+            DEBUG_LINE(8, "Listing kdir path %s/%s", cself->path, subpath);
+            rc = KDirectoryVisit(dir, false, DirectoryNode_DirVisit, &d, "%s/%s", cself->path, subpath);
+            ReleaseComplain(KDirectoryRelease, dir);
+        }
+    }
+    return rc;
+}
+
+static
+rc_t DirectoryNode_Link(const DirectoryNode* cself, const char* subpath, char* buf, size_t buf_sz)
+{
+    rc_t rc = 0;
+    if( cself->path == NULL ) {
+        rc = RC(rcExe, rcPath, rcAliasing, rcDirEntry, rcUnsupported);
+    } else {
+        KDirectory* dir = NULL;
+        if( (rc = KDirectoryNativeDir(&dir)) == 0 ) {
+            if( subpath == NULL ) {
+                DEBUG_LINE(8, "Resolving %s", cself->path);
+                rc = KDirectoryResolveAlias(dir, true, buf, buf_sz, "%s", cself->path);
+            } else {
+                DEBUG_LINE(8, "Resolving %s/%s", cself->path, subpath);
+                rc = KDirectoryResolveAlias(dir, true, buf, buf_sz, "%s/%s", cself->path, subpath);
+            }
+            DEBUG_LINE(8, "Resolved %s", rc == 0 ? buf : NULL);
+            ReleaseComplain(KDirectoryRelease, dir);
+        }
+    }
+    return rc;
+}
+
+static
+rc_t DirectoryNode_Open(const DirectoryNode* cself, const char* subpath, const SAccessor** accessor)
+{
+    rc_t rc = 0;
+
+    if( subpath == NULL ) {
+        rc = RC(rcExe, rcFile, rcOpening, rcDirEntry, rcNotFound);
+    } else {
+        const char* nm = NULL;
+
+        if( (rc = DirectoryNode_Lock(cself, false)) == 0 ) {
+            const FSNode* child = NULL;
+            if( (rc = DirectoryNode_IsChild(cself, subpath, &child, DirNodeChild_FindByName)) == 0 ) {
+                rc = FSNode_Open(child, NULL, accessor);
+            }
+            ReleaseComplain(DirectoryNode_Unlock, cself);
+            if( child != NULL ) {
+                return rc;
+            }
+        }
+        if( (rc = FSNode_GetName(&cself->node, &nm)) == 0 ) {
+            KDirectory* dir = NULL;
+            if( (rc = KDirectoryNativeDir(&dir)) == 0 ) {
+                const KFile* kf = NULL;
+                if( (rc = KDirectoryOpenFileRead(dir, &kf, "%s/%s", cself->path, subpath)) == 0 ) {
+                    if( (rc = KFileAccessor_Make(accessor, nm, kf)) != 0 ) {
+                        ReleaseComplain(KFileRelease, kf);
+                    }
+                }
+                ReleaseComplain(KDirectoryRelease, dir);
+            }
+        }
+    }
+    if( rc != 0 ) {
+        SAccessor_Release(*accessor);
+        *accessor = NULL;
+    }
+    return rc;
+}
+
+static
+rc_t DirectoryNode_Release(DirectoryNode* self)
+{
+    rc_t rc = 0;
+    if( self != NULL ) {
+        BSTreeWhack(&self->children, DirNodeChild_Whack, NULL);
+        ReleaseComplain(KRWLockRelease, self->lock);
+        ReleaseComplain(KNamelistRelease, self->ls);
+        FREE(self->path);
+    }
+    return rc;
+}
+
+static FSNode_vtbl DirectoryNode_vtbl = {
+    sizeof(DirectoryNode),
+    NULL,
+    DirectoryNode_Touch,
+    DirectoryNode_Attr,
+    DirectoryNode_Dir,
+    DirectoryNode_Link,
+    DirectoryNode_Open,
+    DirectoryNode_Release
+};
+
+
+rc_t DirectoryNode_Make(const KXMLNode* xml_node, FSNode** cself, char* errmsg, const char* rel_path,
+                        KTime_t dflt_ktm, EXMLValidate validate)
+{
+    rc_t rc = 0;
+
+    if( xml_node == NULL || cself == NULL ) {
+        rc = RC(rcExe, rcDirectory, rcConstructing, rcParam, rcNull);
+    } else {
+        char* path = NULL, *name = NULL, name_buf[4096];
+        KTime_t ktm = 0;
+        DirectoryNode* ff = NULL;
+
+        if( (rc = KXMLNodeReadAttrCStr(xml_node, "path", &path, NULL)) == 0 ) {
+            if( path[0] == '\0' ) {
+                FREE(path);
+                path = NULL;
+            } else {
+                KDirectory* dir = NULL;
+                if( (rc = KDirectoryNativeDir(&dir)) == 0 ) {
+                    if( path[0] != '/' ) {
+                        char resolved[4096];
+                        if( (rc = KDirectoryResolvePath(dir, true, resolved, sizeof(resolved),
+                                                                  "%s%s", rel_path, path)) == 0 ) {
+                            DEBUG_LINE(8, "%s%s resolved to %s", rel_path, path, resolved);
+                            FREE(path);
+                            rc = StrDup(resolved, &path);
+                        }
+                    }
+                    if( rc == 0 && validate > eXML_NoCheck ) {
+                        uint32_t t = KDirectoryPathType(dir, "%s", path);
+                        if( t != kptDir && t != (kptDir | kptAlias) ) {
+                            if( validate > eXML_NoFail ) {
+                                rc = RC(rcExe, rcDoc, rcValidating, rcDirEntry, t == kptNotFound ? rcNotFound : rcInvalid);
+                            } else {
+                                PLOGMSG(klogErr, (klogErr, "Directory path '$(p)' not found", "p=%s", path));
+                            }
+                        }
+                    }
+                    ReleaseComplain(KDirectoryRelease, dir);
+                }
+            }
+        } else if( GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound ) {
+            rc = 0;
+        }
+        if( rc != 0 ) {
+            strcpy(errmsg, "Directory/@path: '");
+            strcat(errmsg, path ? path : "(null)");
+            strcat(errmsg, "'");
+        }
+        if( rc == 0 ) {
+            size_t sz;
+            rc = KXMLNodeReadAttrCString(xml_node, "name", name_buf, sizeof(name_buf), &sz);
+            if( rc == 0 && name_buf[0] != '\0' ) {
+                name = name_buf;
+            } else if( (GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound)  ) {
+                rc = 0;
+            }
+            if( rc != 0 ) {
+                strcpy(errmsg, "Directory/@name");
+            } else if( name == NULL ) {
+                if( path == NULL ) {
+                    rc = RC(rcExe, rcDoc, rcValidating, rcDirEntry, rcInvalid);
+                } else {
+                    name = strrchr(path, '/');
+                    name = name ? name + 1 : path;
+                }
+            }
+        }
+        if( rc == 0 && (rc = XML_ParseTimestamp(xml_node, "timestamp", &ktm, true)) != 0 ) {
+            strcpy(errmsg, "Directory/@timestamp");
+        }
+        if( rc == 0 ) {
+            struct KNamelist const* attr = NULL;
+            if( (rc = KXMLNodeListAttr(xml_node, &attr)) == 0 ) {
+                uint32_t i = 0, count = 0;
+                if( (rc = KNamelistCount(attr, &count)) == 0 && count > 0 ) {
+                    while( rc == 0 && i < count ) {
+                        const char *attr_nm = NULL;
+                        if( (rc = KNamelistGet(attr, i++, &attr_nm)) != 0 ) {
+                            break;
+                        }
+                        if( strcmp("path", attr_nm) == 0 || strcmp("name", attr_nm) == 0 || strcmp("timestamp", attr_nm) == 0 ) {
+                            continue;
+                        }
+                        rc = RC(rcExe, rcDoc, rcValidating, rcDirEntry, rcInvalid);
+                        strcpy(errmsg, "unknown attribute Directory/@");
+                        strcat(errmsg, attr_nm);
+                    }
+                }
+                ReleaseComplain(KNamelistRelease, attr);
+            }
+        }
+        if( rc == 0 ) {
+            if( (rc = FSNode_Make((FSNode**)&ff, name, &DirectoryNode_vtbl)) == 0 &&
+                (rc = KRWLockMake(&ff->lock)) == 0 ) {
+                ff->path = path;
+                ff->mtime = ktm != 0 ? ktm : (path ? 0 : dflt_ktm);
+                BSTreeInit(&ff->children);
+            } else {
+                strcpy(errmsg, "Directory '");
+                strcat(errmsg, name);
+                strcat(errmsg, "'");
+            }
+        }
+        if( rc == 0 ) {
+            *cself = &ff->node;
+        } else {
+            FREE(path);
+        }
+    }
+    return rc;
+}
diff --git a/tools/fuse/directory.h b/tools/fuse/directory.h
new file mode 100644
index 0000000..9acc3c5
--- /dev/null
+++ b/tools/fuse/directory.h
@@ -0,0 +1,34 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#ifndef _h_sra_fuse_directory_
+#define _h_sra_fuse_directory_
+
+#include "node.h"
+
+rc_t DirectoryNode_Make(const KXMLNode* xml_node, FSNode** cself, char* errmsg, const char* rel_path,
+                        KTime_t ts, EXMLValidate validate);
+
+#endif /* _h_sra_fuse_directory_ */
diff --git a/tools/fuse/dump-idx.c b/tools/fuse/dump-idx.c
new file mode 100644
index 0000000..1f9e260
--- /dev/null
+++ b/tools/fuse/dump-idx.c
@@ -0,0 +1,107 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
+#include <kapp/main.h>
+#include <kapp/log.h>
+#include <klib/rc.h>
+#include <kdb/database.h>
+#include <kdb/table.h>
+#include <kdb/index.h>
+
+#include <sra/sradb.h>
+
+uint32_t KAppVersion(void)
+{
+    return 1;
+}
+
+rc_t KMain ( int argc, char *argv [] )
+{
+    rc_t rc = 0;
+    char const *table_dir = NULL;
+    char const *idx_name = NULL;
+    const KDBManager* kmgr = NULL;
+    const KTable* ktbl = NULL;
+    const KIndex* kidx = NULL;
+
+    if( argc < 3 ) {
+        rc = RC ( rcExe, rcArgv, rcParsing, rcPath, rcNull );
+        PLOGERR((klogErr, rc, "Usage:\n $(a) <path> <index-name>", PLOG_S(a), argv[0]));
+        return rc;
+    }
+
+    table_dir = argv[1];
+    idx_name = argv[2];
+
+    rc = KDBManagerMakeRead(&kmgr, NULL);
+    if( rc == 0 ) {
+        rc = KDBManagerOpenTableRead(kmgr, &ktbl, table_dir);
+        if( rc == 0 ) {
+            PLOGMSG((klogInfo, "Table $(p) index $(i)", PLOG_2(PLOG_S(p),PLOG_S(i)), table_dir, idx_name));
+            rc = KTableOpenIndexRead(ktbl, &kidx, idx_name);
+            if( rc == 0 ) {
+                uint64_t off1 = 0, off2 = 0, sz = 0, id_q = 0;
+                int64_t id = 0;
+                while(true) {
+                    rc = KIndexFindU64(kidx, off1, &off2, &sz, &id, &id_q);
+                    if( rc != 0 ) {
+                        break;
+                    }
+                    PLOGMSG((klogInfo, "$(i) index spot $(s) ($(q)) offset [$(f):$(t)]",
+                            PLOG_5(PLOG_S(i),PLOG_I64(s),PLOG_U64(q),PLOG_U64(f),PLOG_U64(t)), idx_name, id, id_q, off2, off2 + sz - 1));
+                    off1 = off2 + sz + 1;
+                    {{
+                        uint64_t f = off2, t = off2 + sz;
+                        while( f != t ) {
+                            uint64_t o, z;
+                            int64_t newid;
+                            if( (rc = KIndexFindU64(kidx, f, &o, &z, &newid, &id_q)) != 0 ) {
+                                PLOGERR((klogErr, rc, "sub $(f)", PLOG_U64(f), f));
+                                break;
+                            }
+                            if( id != newid ) {
+                                PLOGMSG((klogErr, "no match on offset $(f): $(i) <-> $(n)",
+                                    PLOG_3(PLOG_U64(f),PLOG_I64(i),PLOG_I64(n)), f, id, newid));
+                            }
+                            f++;
+                        }
+                    }}
+                }
+                KIndexRelease(kidx);
+            }
+            KTableRelease(ktbl);
+        }
+        KDBManagerRelease(kmgr);
+    }
+    LOGERR(rc == 0 ? klogInfo : klogErr, rc, "Done");
+    return rc;
+}
diff --git a/tools/fuse/dump-idx.vers b/tools/fuse/dump-idx.vers
new file mode 100644
index 0000000..3eefcb9
--- /dev/null
+++ b/tools/fuse/dump-idx.vers
@@ -0,0 +1 @@
+1.0.0
diff --git a/tools/fuse/dump-idx.vers.h b/tools/fuse/dump-idx.vers.h
new file mode 100644
index 0000000..1fb02c6
--- /dev/null
+++ b/tools/fuse/dump-idx.vers.h
@@ -0,0 +1 @@
+#define DUMP_IDX_VERS 0x01000000
diff --git a/tools/fuse/file.c b/tools/fuse/file.c
new file mode 100644
index 0000000..a7548a5
--- /dev/null
+++ b/tools/fuse/file.c
@@ -0,0 +1,275 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#include <klib/namelist.h>
+#include <klib/printf.h>
+#include <kxml/xml.h>
+#include <kfs/directory.h>
+#include <kfs/file.h>
+#include <krypto/encfile.h>
+#include <krypto/key.h>
+
+typedef struct FileNode FileNode;
+#define FSNODE_IMPL FileNode
+
+#include "log.h"
+#include "xml.h"
+#include "file.h"
+#include "kfile-accessor.h"
+
+#include <string.h>
+#include <stdlib.h>
+#include <time.h>
+
+struct FileNode {
+    FSNode node;
+    char* path;
+    KTime_t mtime;
+    KKey key;
+};
+
+static
+rc_t FileNode_Attr(const FileNode* cself, const char* subpath, uint32_t* type, KTime_t* ts, uint64_t* file_sz, uint32_t* access, uint64_t* block_sz)
+{
+    rc_t rc = 0;
+    KDirectory* dir = NULL;
+
+    if( subpath != NULL ) {
+        rc = RC(rcExe, rcFile, rcEvaluating, rcDirEntry, rcNotFound);
+    } else if( (rc = KDirectoryNativeDir(&dir)) == 0 ) {
+        *type = KDirectoryPathType(dir, "%s", cself->path);
+        DEBUG_LINE(8, "file type %x", *type);
+        if( cself->mtime != 0 ) {
+            *ts = cself->mtime;
+        } else if( (rc = KDirectoryDate(dir, ts, "%s", cself->path)) == 0 ) {
+            DEBUG_LINE(8, "file mtime %u", *ts);
+        }
+        if( rc == 0 && (rc = KDirectoryAccess(dir, access, "%s", cself->path)) == 0 ) {
+            DEBUG_LINE(8, "file access %x", *access);
+            if( *type & kptAlias ) {
+                char r[10240];
+                if( (rc = KDirectoryResolveAlias(dir, true, r, sizeof(r), "%s", cself->path)) == 0 ) {
+                    *file_sz = strlen(r);
+                }
+            } else if( *type == kptFile ) { 
+                rc = KDirectoryFileSize(dir, file_sz, "%s", cself->path);
+            }
+        }
+        ReleaseComplain(KDirectoryRelease, dir);
+    }
+    return rc;
+}
+
+static
+rc_t FileNode_Link(const FileNode* cself, const char* subpath, char* buf, size_t buf_sz)
+{
+    rc_t rc = 0;
+    KDirectory* dir = NULL;
+
+    if( (rc = KDirectoryNativeDir(&dir)) == 0 ) {
+        rc = KDirectoryResolveAlias(dir, true, buf, buf_sz, "%s", cself->path);
+        ReleaseComplain(KDirectoryRelease, dir);
+    }
+    return rc;
+}
+
+static
+rc_t FileNode_Open(const FileNode* cself, const char* subpath, const SAccessor** accessor)
+{
+    rc_t rc = 0;
+
+    if( subpath != NULL ) {
+        rc = RC(rcExe, rcFile, rcOpening, rcDirEntry, rcNotFound);
+    } else {
+        KDirectory* dir = NULL;
+        if( (rc = KDirectoryNativeDir(&dir)) == 0 ) {
+            const KFile* kf = NULL;
+            const KFile* enc_kf = NULL;
+            const KFile* immediate = NULL;
+            if( (rc = KDirectoryOpenFileRead(dir, &kf, "%s", cself->path)) == 0 ) {
+                immediate = kf;
+                if( cself->key.type != kkeyNone ) {
+                    /* TODO: what is the correct way to release KFile objects */
+                    rc = KEncFileMakeRead (&enc_kf, kf, &cself->key);
+                    immediate = enc_kf;
+                }
+                if( rc == 0 ) {
+                    if( (rc = KFileAccessor_Make(accessor, cself->node.name, immediate)) != 0 ) {
+                        ReleaseComplain(KFileRelease, immediate);
+                    }
+                }
+                
+            }
+            ReleaseComplain(KDirectoryRelease, dir);
+        }
+    }
+    if( rc != 0 ) {
+        SAccessor_Release(*accessor);
+        *accessor = NULL;
+    }
+    return rc;
+}
+
+static
+rc_t FileNode_Release(FileNode* self)
+{
+    if( self != NULL ) {
+        FREE(self->path);
+    }
+    return 0;
+}
+
+static FSNode_vtbl FileNode_vtbl = {
+    sizeof(FileNode),
+    NULL,
+    NULL,
+    FileNode_Attr,
+    NULL,
+    FileNode_Link,
+    FileNode_Open,
+    FileNode_Release
+};
+
+rc_t FileNode_Make(const KXMLNode* xml_node, FSNode** cself, char* errmsg, const char* rel_path, EXMLValidate validate)
+{
+    rc_t rc = 0;
+
+    if( xml_node == NULL || cself == NULL || errmsg == NULL || rel_path == NULL ) {
+        rc = RC(rcExe, rcNode, rcConstructing, rcParam, rcNull);
+    } else {
+        char* path = NULL, *name = NULL, name_buf[4096], password[4096];
+        KTime_t ktm = 0;
+        FileNode* ff = NULL;
+        size_t password_sz = 0;
+
+        if( (rc = KXMLNodeReadAttrCStr(xml_node, "path", &path, NULL)) == 0 ) {
+            if( path[0] == '\0' ) {
+                rc = RC(rcExe, rcDoc, rcValidating, rcDirEntry, rcInvalid);
+            } else {
+                KDirectory* dir = NULL;
+                if( (rc = KDirectoryNativeDir(&dir)) == 0 ) {
+                    if( path[0] != '/' ) {
+                        char resolved[4096];
+                        if( (rc = KDirectoryResolvePath(dir, true, resolved, sizeof(resolved),
+                                                                  "%s%s", rel_path, path)) == 0 ) {
+                            DEBUG_LINE(8, "%s%s resolved to %s", rel_path, path, resolved);
+                            FREE(path);
+                            rc = StrDup(resolved, &path);
+                        }
+                    }
+                    if( rc == 0 && validate > eXML_NoCheck ) {
+                        uint32_t t = KDirectoryPathType(dir, "%s", path);
+                        if( (t != kptFile && t != (kptFile | kptAlias)) &&
+                            (t != kptCharDev && t != (kptCharDev | kptAlias)) &&
+                            (t != kptBlockDev && t != (kptBlockDev | kptAlias)) &&
+                            (t != kptFIFO && t != (kptFIFO | kptAlias))  ) {
+                            if( validate > eXML_NoFail ) {
+                                rc = RC(rcExe, rcDoc, rcValidating, rcDirEntry, t == kptNotFound ? rcNotFound : rcInvalid);
+                            } else {
+                                PLOGMSG(klogErr, (klogErr, "File path '$(p)' not found", "p=%s", path));
+                            }
+                        }
+                    }
+                    ReleaseComplain(KDirectoryRelease, dir);
+                }
+            }
+        }
+        if( rc != 0 ) {
+            strcpy(errmsg, "File/@path: '");
+            strcat(errmsg, path ? path : "(null)");
+            strcat(errmsg, "'");
+        }
+        if( rc == 0 ) {
+            rc = KXMLNodeReadAttrCString(xml_node, "name", name_buf, sizeof(name_buf), &password_sz);
+            if( rc == 0 && name_buf[0] != '\0' ) {
+                name = name_buf;
+            } else if( GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound ) {
+                rc = 0;
+            }
+            if( rc != 0 ) {
+                strcpy(errmsg, "File/@name");
+            } else if( name == NULL ) {
+                name = strrchr(path, '/');
+                name = name ? name + 1 : path;
+            }
+        }
+        if( rc == 0 && (rc = XML_ParseTimestamp(xml_node, "timestamp", &ktm, true)) != 0 ) {
+            strcpy(errmsg, "File/@timestamp");
+        }
+        if( rc == 0 ) {
+            rc = KXMLNodeReadAttrCString(xml_node, "password", password, sizeof(password), &password_sz);
+            if( rc == 0 || (GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound) ) {
+                rc = 0;
+                password_sz = 0;
+            } else {
+                strcpy(errmsg, "File/@password");
+            }
+        }
+        if( rc == 0 ) {
+            struct KNamelist const* attr = NULL;
+            if( (rc = KXMLNodeListAttr(xml_node, &attr)) == 0 ) {
+                uint32_t i = 0, count = 0;
+                if( (rc = KNamelistCount(attr, &count)) == 0 && count > 0 ) {
+                    while( rc == 0 && i < count ) {
+                        const char *attr_nm = NULL;
+                        if( (rc = KNamelistGet(attr, i++, &attr_nm)) != 0 ) {
+                            break;
+                        }
+                        if( strcmp("path", attr_nm) == 0 || strcmp("name", attr_nm) == 0 ||
+                            strcmp("timestamp", attr_nm) == 0 || strcmp("password", attr_nm) == 0 ) {
+                            continue;
+                        }
+                        rc = RC(rcExe, rcDoc, rcValidating, rcDirEntry, rcInvalid);
+                        strcpy(errmsg, "unknown attribute File/@");
+                        strcat(errmsg, attr_nm);
+                    }
+                }
+                ReleaseComplain(KNamelistRelease, attr);
+            }
+        }
+        if( rc == 0 ) {
+            if( (rc = FSNode_Make((FSNode**)&ff, name, &FileNode_vtbl)) == 0 ) {
+                ff->path = path;
+                ff->mtime = ktm;
+                if( password_sz > 0 ) {
+                    rc = KKeyInitRead(&ff->key, kkeyAES128, password, password_sz);
+                } else {
+                    memset(&ff->key, 0, sizeof ff->key);
+                    ff->key.type = kkeyNone;
+                }
+            } else {
+                strcpy(errmsg, "File '");
+                strcat(errmsg, name);
+                strcat(errmsg, "'");
+            }
+        }
+        if( rc == 0 ) {
+            *cself = &ff->node;
+        } else {
+            FREE(path);
+        }
+    }
+    return rc;
+}
diff --git a/tools/fuse/file.h b/tools/fuse/file.h
new file mode 100644
index 0000000..9f9d2e4
--- /dev/null
+++ b/tools/fuse/file.h
@@ -0,0 +1,33 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#ifndef _h_sra_fuse_file_
+#define _h_sra_fuse_file_
+
+#include "node.h"
+
+rc_t FileNode_Make(const KXMLNode* xml_node, FSNode** cself, char* errmsg, const char* rel_path, EXMLValidate validate);
+
+#endif /* _h_sra_fuse_file_ */
diff --git a/tools/fuse/formats.c b/tools/fuse/formats.c
new file mode 100644
index 0000000..fd283e0
--- /dev/null
+++ b/tools/fuse/formats.c
@@ -0,0 +1,443 @@
+/*===========================================================================
+ *
+ *                            Public DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ */
+#include <klib/rc.h>
+#include <klib/checksum.h>
+#include <klib/printf.h>
+#include <kfs/file.h>
+#include <kdb/table.h>
+#include <kdb/index.h>
+
+#include <sra/sradb-priv.h>
+
+#include "log.h"
+#include "zlib-simple.h"
+#include "sra-list.h"
+#include "formats.h"
+#include "text-file.h"
+#include "sra-fastq.h"
+#include "sra-sff.h"
+
+#include <string.h>
+#include <assert.h>
+#include <ctype.h>
+#include <stdlib.h>
+
+static
+rc_t FileOptions_MakeSuffix(FileOptions* self, const char* suffix, KTime_t ts)
+{
+    rc_t rc = 0;
+
+    if( suffix == NULL ) {
+        rc = RC(rcExe, rcFormat, rcReading, rcParam, rcNull);
+    } else if( strlen(suffix) > FILEOPTIONS_BUFFER - 2 ) {
+        rc = RC(rcExe, rcFormat, rcReading, rcBuffer, rcInsufficient);
+    } else {
+        strcpy(self->suffix, (isalnum(suffix[0]) && suffix[0] != '_') ? "." : "");
+        strcat(self->suffix, suffix);
+    }
+    return rc;
+}
+
+rc_t FileOptions_Make(FileOptions** self, uint32_t count)
+{
+    assert(self != NULL);
+    CALLOC(*self, count, sizeof(**self));
+    if( *self == NULL ) {
+        return RC(rcExe, rcTable, rcAllocating, rcMemory, rcExhausted);
+    }
+    return 0;
+}
+
+void FileOptions_Release(FileOptions* self)
+{
+    if( self != NULL ) {
+        FREE(self);
+    }
+}
+
+rc_t FileOptions_Clone(FileOptions** self, const FileOptions* src, uint32_t count)
+{
+    rc_t rc = 0;
+
+    if( self == NULL || src == NULL ) {
+        rc = RC(rcExe, rcTable, rcCopying, rcParam, rcNull);
+    } else if( (rc = FileOptions_Make(self, count)) == 0 ) {
+        memcpy(*self, src, sizeof(**self) * count);
+    }
+    return rc;
+}
+
+rc_t FileOptions_SRAArchive(FileOptions* self, const SRATable* tbl, KTime_t ts, bool lite)
+{
+    rc_t rc = 0;
+
+    if( tbl == NULL || self == NULL ) {
+        rc = RC(rcExe, rcFormat, rcReading, rcParam, rcNull);
+    } else {
+        const KFile* sfa = NULL;
+        const char* ext;
+        if( (rc = SRATableMakeSingleFileArchive(tbl, &sfa, lite, &ext)) == 0 ) {
+            if( (rc = KFileSize(sfa, &self->file_sz)) == 0 &&
+                (rc = FileOptions_MakeSuffix(self, ext, ts)) == 0 ) {
+                self->type = lite ? eSRAFuseFmtArcLite : eSRAFuseFmtArc;
+                self->f.sra.lite = lite;
+            }
+            ReleaseComplain(KFileRelease, sfa);
+        }
+    }
+    return rc;
+}
+
+rc_t FileOptions_SRAArchiveInstant(FileOptions* self, FileOptions* fmd5,
+                                   const SRAMgr* mgr, const char* accession, const char* path,
+                                   const bool lite, KTime_t ts, uint64_t size, char md5[32])
+{
+    rc_t rc = 0;
+
+    if( self == NULL || mgr == NULL || accession == NULL || fmd5 == NULL ) {
+        rc = RC(rcExe, rcFormat, rcReading, rcParam, rcNull);
+    } else {
+        const char* ext;
+
+        /* Only support non-lite files, if lite is needed fix this*/
+        /*if (lite)
+        {
+            PLOGERR(klogErr, (klogErr, 0, "lite flag is not supported, get rid of lite flag in xml, in FileOptions_SRAArchiveInstant for path or accession = $(a)", PLOG_S(a), path ? path : accession));
+            abort();
+        }
+        assert(!lite);*/
+        ext = lite ? ".lite.sra" : ".sra";
+
+        if( (rc = FileOptions_MakeSuffix(self, ext, ts)) == 0 ) {
+            self->file_sz = size;
+            self->type = lite ? eSRAFuseFmtArcLite : eSRAFuseFmtArc;
+            self->f.sra.lite = lite;
+            memcpy(self->md5, md5, sizeof(self->md5));
+            if( (rc = FileOptions_AttachMD5(self, accession, fmd5)) == 0 ) {
+                rc = FileOptions_UpdateMD5(self, accession);
+            }
+        }
+    }
+    return rc;
+}
+
+rc_t FileOptions_SRAArchiveUpdate(FileOptions* self, const char* name,
+                                  KTime_t ts, uint64_t size, char md5[32])
+{
+    rc_t rc = 0;
+
+    if( self == NULL || name == NULL ) {
+        rc = RC(rcExe, rcFormat, rcReading, rcParam, rcNull);
+    } else {
+        self->file_sz = size;
+        if( md5 == NULL ) {
+            memset(self->md5, 0, sizeof(self->md5));
+        } else {
+            memcpy(self->md5, md5, sizeof(self->md5));
+        }
+        rc = FileOptions_UpdateMD5(self, name);
+    }
+    return rc;
+}
+
+rc_t FileOptions_AttachMD5(FileOptions* self, const char* name, FileOptions* md5)
+{
+    rc_t rc = 0;
+    if( name == NULL || self == NULL || md5 == NULL ) {
+        rc = RC(rcExe, rcFormat, rcAttaching, rcParam, rcInvalid);
+    } else {
+        switch(self->type) {
+            case eSRAFuseFmtFastq:
+            case eSRAFuseFmtFastqGz:
+                md5->type = eSRAFuseFmtFastqMD5;
+                break;
+            case eSRAFuseFmtSFF:
+            case eSRAFuseFmtSFFGz:
+                md5->type = eSRAFuseFmtSFFMD5;
+                break;
+            case eSRAFuseFmtArc:
+                md5->type = eSRAFuseFmtArcMD5;
+                break;
+            case eSRAFuseFmtArcLite:
+                md5->type = eSRAFuseFmtArcLiteMD5;
+                break;
+            default:
+                rc = RC(rcExe, rcFormat, rcReading, rcType, rcUnexpected);
+        }
+        if( rc == 0 ) {
+            char buf[sizeof(md5->suffix)];
+
+            strcpy(buf, self->suffix);
+            strcat(buf, ".md5");
+            if( (rc = FileOptions_MakeSuffix(md5, buf, 0)) == 0 ) {
+                self->md5_file = md5 - self;
+            }
+        }
+    }
+    return rc;
+}
+
+rc_t FileOptions_CalcMD5(FileOptions* self, const char* name, const SRAListNode* sra)
+{
+    rc_t rc = 0;
+
+    if( self == NULL || sra == NULL || name == NULL ) {
+        rc = RC(rcExe, rcFormat, rcProcessing, rcParam, rcInvalid);
+    } else if( self->md5[0] == '\0' ) {
+        const KFile* kfile;
+        if( (rc = FileOptions_OpenFile(self, sra, &kfile)) == 0 ) {
+            MD5State md5;
+            uint64_t pos = 0;
+            uint8_t buffer[256 * 1024];
+            size_t num_read = 0, x;
+
+            MD5StateInit(&md5);
+            do {
+                if( (rc = KFileRead(kfile, pos, buffer, sizeof(buffer), &num_read)) == 0 ) {
+                    MD5StateAppend(&md5, buffer, num_read);
+                    pos += num_read;
+                }
+            } while(rc == 0 && num_read != 0);
+            if( rc == 0 ) {
+                uint8_t digest[16];
+                char smd5[sizeof(self->md5) + 1];
+                MD5StateFinish(&md5, digest);
+                for(pos = 0, x = 0; rc == 0 && pos < sizeof(digest); pos++) {
+                    rc = string_printf(&smd5[x], sizeof(smd5) - x, &num_read, "%02x", digest[pos]);
+                    x += num_read;
+                }
+                memcpy(self->md5, smd5, sizeof(self->md5));
+                DEBUG_LINE(10, "%s %s %.*s", self->suffix, name, sizeof(self->md5), self->md5);
+            }
+            KFileRelease(kfile);
+        }
+    }
+    return rc;
+}
+
+rc_t FileOptions_UpdateMD5(FileOptions* self, const char* name)
+{
+    rc_t rc = 0;
+    
+    if( self == NULL || name == NULL ) {
+        rc = RC(rcExe, rcFormat, rcUpdating, rcParam, rcInvalid);
+    } else if( self->md5_file != 0 ) {
+        FileOptions* md5 = &self[self->md5_file];
+        if( self->md5[0] != '\0' ) {
+            size_t nw;
+            rc = string_printf(md5->f.txt64b, sizeof(md5->f.txt64b), &nw,
+                "%.*s *%s%s\n", sizeof(self->md5), self->md5, name, self->suffix);
+            md5->file_sz = rc ? 0 : nw;
+        } else {
+            md5->f.txt64b[0] = '\0';
+            md5->file_sz = 0;
+        }
+    }
+    return rc;
+}
+
+rc_t FileOptions_OpenFile(const FileOptions* cself, const struct SRAListNode* sra, const KFile** kfile)
+{
+    rc_t rc = 0;
+
+    assert(cself != NULL);
+    assert(kfile != NULL);
+    *kfile = NULL;
+    switch(cself->type) {
+        case eSRAFuseFmtArc:
+        case eSRAFuseFmtArcLite:
+            {{
+            const SRATable* tbl = NULL;
+            if( (rc = SRAListNode_TableOpen(sra, &tbl)) == 0 ) {
+                rc = SRATableMakeSingleFileArchive(tbl, kfile, cself->f.sra.lite, NULL);
+                ReleaseComplain(SRATableRelease, tbl);
+            }
+            }}
+            break;
+
+        case eSRAFuseFmtFastqMD5:
+        case eSRAFuseFmtSFFMD5:
+        case eSRAFuseFmtArcMD5:
+        case eSRAFuseFmtArcLiteMD5:
+            rc = TextFile_Open(kfile, cself);
+            break;
+
+        case eSRAFuseFmtFastq:
+        case eSRAFuseFmtFastqGz:
+            rc = SRAFastqFile_Open(kfile, sra, cself);
+            break;
+
+        case eSRAFuseFmtSFF:
+        case eSRAFuseFmtSFFGz:
+            rc = SRASFFFile_Open(kfile, sra, cself);
+            break;
+    }
+    return rc;
+}
+
+rc_t FileOptions_ParseMeta(FileOptions* self, const KMDataNode* file, const SRATable* tbl, KTime_t ts, const char* suffix)
+{
+    rc_t rc = 0;
+
+    if( file == NULL || self == NULL || suffix == NULL ) {
+        rc = RC(rcExe, rcFormat, rcReading, rcParam, rcNull);
+    } else if( strlen(suffix) > FILEOPTIONS_BUFFER - 2 ) {
+        rc = RC(rcExe, rcFormat, rcReading, rcBuffer, rcInsufficient);
+    } else if( (rc = FileOptions_MakeSuffix(self, suffix, ts)) == 0 ) {
+        const KMDataNode* format = NULL;
+        if( (rc = KMDataNodeOpenNodeRead(file, &format, "Format")) == 0 ) {
+            char fmt_name[32];
+            size_t read = 0;
+            if( (rc = KMDataNodeReadCString(format, fmt_name, sizeof(fmt_name), &read)) == 0 ) {
+                const KMDataNode* tmp = NULL;
+                fmt_name[read] = '\0';
+                if( rc == 0 && (rc = KMDataNodeOpenNodeRead(file, &tmp, "Size")) == 0 ) {
+                    rc = KMDataNodeReadB64(tmp, &self->file_sz);
+                    ReleaseComplain(KMDataNodeRelease, tmp);
+                }
+                if( rc == 0 && (rc = KMDataNodeOpenNodeRead(file, &tmp, "Buffer")) == 0 ) {
+                    rc = KMDataNodeReadB32(tmp, &self->buffer_sz);
+                    ReleaseComplain(KMDataNodeRelease, tmp);
+                }
+                if( rc == 0 && (rc = KMDataNodeOpenNodeRead(file, &tmp, "Index")) == 0 ) {
+                    if( (rc = KMDataNodeReadCString(tmp, self->index, sizeof(self->index) - 1, &read)) == 0 && tbl != NULL ) {
+                        const KTable* ktbl = NULL;
+                        if( (rc = SRATableGetKTableRead(tbl, &ktbl)) == 0 ) {
+                            const KIndex* kidx = NULL;
+                            if( (rc = KTableOpenIndexRead(ktbl, &kidx, self->index)) == 0 ) {
+                                ReleaseComplain(KIndexRelease, kidx);
+                            }
+                            ReleaseComplain(KTableRelease, ktbl);
+                        }
+                    }
+                    ReleaseComplain(KMDataNodeRelease, tmp);
+                }
+                if( rc == 0 && KMDataNodeOpenNodeRead(file, &tmp, "md5") == 0 ) {
+                    rc = KMDataNodeReadCString(tmp, self->md5, sizeof(self->md5), &read);
+                    ReleaseComplain(KMDataNodeRelease, tmp);
+                }
+                if( rc == 0 ) {
+                    if(strcmp(fmt_name, "fastq") == 0 || strcmp(fmt_name, "fastq-gzip") == 0 ) {
+                        if( strcmp(fmt_name, "fastq-gzip") == 0 ) {
+                            self->type = eSRAFuseFmtFastqGz;
+                            self->f.fastq.gzip = true;
+                            if( (rc = KMDataNodeOpenNodeRead(format, &tmp, "Options/ZlibVersion")) == 0 ) {
+                                uint16_t v = 0;
+                                rc = KMDataNodeReadB16(tmp, &v);
+                                ReleaseComplain(KMDataNodeRelease, tmp);
+                                if( rc == 0 && v > ZLIB_VERNUM ) {
+                                    PLOGMSG(klogWarn, (klogWarn, "ZLib version old: $(v) < $(mj).$(mn).$(b)",
+                                        PLOG_4(PLOG_S(v),PLOG_U8(mj),PLOG_U8(mn),PLOG_U8(b)),
+                                        ZLIB_VERSION, v & 0xF000, v & 0x0F00, v & 0x00FF));
+                                }
+                            }
+                        } else {
+                            self->type = eSRAFuseFmtFastq;
+                        }
+
+                        if( rc == 0 && (rc = KMDataNodeOpenNodeRead(format, &tmp, "Options/accession")) == 0 ) {
+                            rc = KMDataNodeReadCString(tmp, self->f.fastq.accession, sizeof(self->f.fastq.accession) - 1, &read);
+                            ReleaseComplain(KMDataNodeRelease, tmp);
+                        }
+                        if( rc == 0 && (rc = KMDataNodeOpenNodeRead(format, &tmp, "Options/minSpotId")) == 0 ) {
+                            rc = KMDataNodeReadB64(tmp, &self->f.fastq.minSpotId);
+                            ReleaseComplain(KMDataNodeRelease, tmp);
+                        }
+                        if( rc == 0 && (rc = KMDataNodeOpenNodeRead(format, &tmp, "Options/maxSpotId")) == 0 ) {
+                            rc = KMDataNodeReadB64(tmp, &self->f.fastq.maxSpotId);
+                            ReleaseComplain(KMDataNodeRelease, tmp);
+                        }
+                        if( rc == 0 && (rc = KMDataNodeOpenNodeRead(format, &tmp, "Options/colorSpace")) == 0 ) {
+                            rc = KMDataNodeReadB8(tmp, &self->f.fastq.colorSpace);
+                            ReleaseComplain(KMDataNodeRelease, tmp);
+                        }
+                        if( rc == 0 && (rc = KMDataNodeOpenNodeRead(format, &tmp, "Options/colorSpaceKey")) == 0 ) {
+                            rc = KMDataNodeRead(tmp, 0, &self->f.fastq.colorSpaceKey, 1, &read, NULL);
+                            ReleaseComplain(KMDataNodeRelease, tmp);
+                        }
+                        if( rc == 0 && (rc = KMDataNodeOpenNodeRead(format, &tmp, "Options/origFormat")) == 0 ) {
+                            rc = KMDataNodeReadB8(tmp, &self->f.fastq.origFormat);
+                            ReleaseComplain(KMDataNodeRelease, tmp);
+                        }
+                        if( rc == 0 && (rc = KMDataNodeOpenNodeRead(format, &tmp, "Options/printLabel")) == 0 ) {
+                            rc = KMDataNodeReadB8(tmp, &self->f.fastq.printLabel);
+                            ReleaseComplain(KMDataNodeRelease, tmp);
+                        }
+                        if( rc == 0 && (rc = KMDataNodeOpenNodeRead(format, &tmp, "Options/printReadId")) == 0 ) {
+                            rc = KMDataNodeReadB8(tmp, &self->f.fastq.printReadId);
+                            ReleaseComplain(KMDataNodeRelease, tmp);
+                        }
+                        if( rc == 0 && (rc = KMDataNodeOpenNodeRead(format, &tmp, "Options/clipQuality")) == 0 ) {
+                            rc = KMDataNodeReadB8(tmp, &self->f.fastq.clipQuality);
+                            ReleaseComplain(KMDataNodeRelease, tmp);
+                        }
+                        if( rc == 0 && (rc = KMDataNodeOpenNodeRead(format, &tmp, "Options/minReadLen")) == 0 ) {
+                            rc = KMDataNodeReadB32(tmp, &self->f.fastq.minReadLen);
+                            ReleaseComplain(KMDataNodeRelease, tmp);
+                        }
+                        if( rc == 0 && (rc = KMDataNodeOpenNodeRead(format, &tmp, "Options/qualityOffset")) == 0 ) {
+                            rc = KMDataNodeReadB16(tmp, &self->f.fastq.qualityOffset);
+                            ReleaseComplain(KMDataNodeRelease, tmp);
+                        }
+                    } else if(strcmp(fmt_name, "SFF") == 0 || strcmp(fmt_name, "SFF-gzip") == 0 ) {
+                        if( strcmp(fmt_name, "SFF-gzip") == 0 ) {
+                            self->type = eSRAFuseFmtSFFGz;
+                            self->f.sff.gzip = true;
+                            if( (rc = KMDataNodeOpenNodeRead(format, &tmp, "Options/ZlibVersion")) == 0 ) {
+                                uint16_t v = 0;
+                                rc = KMDataNodeReadB16(tmp, &v);
+                                ReleaseComplain(KMDataNodeRelease, tmp);
+                                if( rc == 0 && v > ZLIB_VERNUM ) {
+                                    PLOGMSG(klogWarn, (klogWarn, "ZLib version old: $(v) < $(mj).$(mn).$(b)",
+                                        PLOG_4(PLOG_S(v),PLOG_U8(mj),PLOG_U8(mn),PLOG_U8(b)),
+                                        ZLIB_VERSION, v & 0xF000, v & 0x0F00, v & 0x00FF));
+                                }
+                            }
+                        } else {
+                            self->type = eSRAFuseFmtSFF;
+                        }
+
+                        if( rc == 0 && (rc = KMDataNodeOpenNodeRead(format, &tmp, "Options/accession")) == 0 ) {
+                            rc = KMDataNodeReadCString(tmp, self->f.sff.accession, sizeof(self->f.sff.accession) - 1, &read);
+                            ReleaseComplain(KMDataNodeRelease, tmp);
+                        }
+                        if( rc == 0 && (rc = KMDataNodeOpenNodeRead(format, &tmp, "Options/minSpotId")) == 0 ) {
+                            rc = KMDataNodeReadB64(tmp, &self->f.sff.minSpotId);
+                            ReleaseComplain(KMDataNodeRelease, tmp);
+                        }
+                        if( rc == 0 && (rc = KMDataNodeOpenNodeRead(format, &tmp, "Options/maxSpotId")) == 0 ) {
+                            rc = KMDataNodeReadB64(tmp, &self->f.sff.maxSpotId);
+                            ReleaseComplain(KMDataNodeRelease, tmp);
+                        }
+                    } else {
+                        rc = RC(rcExe, rcFormat, rcReading, rcFormat, rcUnrecognized);
+                    }
+                }
+            }
+            ReleaseComplain(KMDataNodeRelease, format);
+        }
+    }
+    return rc;
+}
diff --git a/tools/fuse/formats.h b/tools/fuse/formats.h
new file mode 100644
index 0000000..fd472f0
--- /dev/null
+++ b/tools/fuse/formats.h
@@ -0,0 +1,157 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+#ifndef _h_sra_fuse_formats_
+#define _h_sra_fuse_formats_
+
+#include <kfs/file.h>
+#include <kdb/meta.h>
+#include <sra/sradb.h>
+
+#define FILEOPTIONS_BUFFER 32
+
+struct SRAListNode;
+
+/* DO NOT CHANGE SIZE OR ELEMENT ORDER OF THIS STRUCTURE
+   CACHE MAY FAIL! see SRAList_Init */
+typedef struct FileOptionsOld {
+    enum {
+        eOldSRAFuseFmtArc         = 0x0001,
+        eOldSRAFuseFmtArcLite     = 0x0002,
+        eOldSRAFuseFmtFastq       = 0x0004,
+        eOldSRAFuseFmtFastqGz     = 0x0008,
+        eOldSRAFuseFmtFastqMD5    = 0x0010,
+        eOldSRAFuseFmtSFF         = 0x0020,
+        eOldSRAFuseFmtSFFGz       = 0x0040,
+        eOldSRAFuseFmtSFFMD5      = 0x0080,
+        eOldSRAFuseFmtArcMD5      = 0x0100,
+        eOldSRAFuseFmtArcLiteMD5  = 0x0200
+    } type;
+    char suffix[FILEOPTIONS_BUFFER];
+    uint64_t file_sz;
+    KTime_t obsolete; /* not removed because cache is binary */
+    char index[FILEOPTIONS_BUFFER];
+    uint32_t buffer_sz;
+    
+    union {
+        char txt64b[FILEOPTIONS_BUFFER * 2];
+        struct {
+            bool lite;
+        } sra;
+        struct {
+            char accession[FILEOPTIONS_BUFFER];
+            uint64_t minSpotId;
+            uint64_t maxSpotId;
+            uint8_t colorSpace;
+            char colorSpaceKey;
+            uint8_t origFormat;
+            uint8_t printLabel;
+            uint8_t printReadId;
+            uint8_t clipQuality;
+            uint32_t minReadLen;
+            uint16_t qualityOffset;
+            bool gzip;
+        } fastq;
+        struct {
+            char accession[FILEOPTIONS_BUFFER];
+            uint64_t minSpotId;
+            uint64_t maxSpotId;
+            bool gzip;
+        } sff;
+    } f;
+} FileOptionsOld;
+
+typedef struct FileOptions {
+    enum {
+        eSRAFuseFmtArc         = 0x0001,
+        eSRAFuseFmtArcLite     = 0x0002,
+        eSRAFuseFmtFastq       = 0x0004,
+        eSRAFuseFmtFastqGz     = 0x0008,
+        eSRAFuseFmtFastqMD5    = 0x0010,
+        eSRAFuseFmtSFF         = 0x0020,
+        eSRAFuseFmtSFFGz       = 0x0040,
+        eSRAFuseFmtSFFMD5      = 0x0080,
+        eSRAFuseFmtArcMD5      = 0x0100,
+        eSRAFuseFmtArcLiteMD5  = 0x0200
+    } type;
+    char suffix[FILEOPTIONS_BUFFER];
+    uint64_t file_sz;
+    KTime_t obsolete; /* not removed because cache is binary */
+    char index[FILEOPTIONS_BUFFER];
+    uint32_t buffer_sz;
+    
+    union {
+        char txt64b[FILEOPTIONS_BUFFER * 2];
+        struct {
+            bool lite;
+        } sra;
+        struct {
+            char accession[FILEOPTIONS_BUFFER];
+            uint64_t minSpotId;
+            uint64_t maxSpotId;
+            uint8_t colorSpace;
+            char colorSpaceKey;
+            uint8_t origFormat;
+            uint8_t printLabel;
+            uint8_t printReadId;
+            uint8_t clipQuality;
+            uint32_t minReadLen;
+            uint16_t qualityOffset;
+            bool gzip;
+        } fastq;
+        struct {
+            char accession[FILEOPTIONS_BUFFER];
+            uint64_t minSpotId;
+            uint64_t maxSpotId;
+            bool gzip;
+        } sff;
+    } f;
+    /* added ver this struct 2: */
+    char md5[32];
+    int8_t md5_file; /* index relative to self with array of structs, 0 - no md5 */
+} FileOptions;
+
+rc_t FileOptions_Make(FileOptions** self, uint32_t count);
+void FileOptions_Release(FileOptions* self);
+
+rc_t FileOptions_Clone(FileOptions** self, const FileOptions* src, uint32_t count);
+
+rc_t FileOptions_SRAArchive(FileOptions* self, const SRATable* tbl, KTime_t ts, bool lite);
+rc_t FileOptions_SRAArchiveInstant(FileOptions* self, FileOptions* fmd5,
+                                   const SRAMgr* mgr, const char* accession, const char* path,
+                                   const bool lite, KTime_t ts, uint64_t size, char md5[32]);
+rc_t FileOptions_SRAArchiveUpdate(FileOptions* self, const char* name,
+                                  KTime_t ts, uint64_t size, char md5[32]);
+
+
+rc_t FileOptions_ParseMeta(FileOptions* self, const KMDataNode* file, const SRATable* tbl, KTime_t ts, const char* suffix);
+
+rc_t FileOptions_AttachMD5(FileOptions* self, const char* name, FileOptions* md5);
+rc_t FileOptions_CalcMD5(FileOptions* self, const char* name, const struct SRAListNode* sra);
+rc_t FileOptions_UpdateMD5(FileOptions* self, const char* name);
+
+rc_t FileOptions_OpenFile(const FileOptions* cself, const struct SRAListNode* sra, const KFile** kfile);
+
+#endif /* _h_sra_fuse_formats_ */
diff --git a/tools/fuse/kfile-accessor.c b/tools/fuse/kfile-accessor.c
new file mode 100644
index 0000000..6540198
--- /dev/null
+++ b/tools/fuse/kfile-accessor.c
@@ -0,0 +1,73 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#include <kfs/file.h>
+
+#include "log.h"
+#include "kfile-accessor.h"
+
+typedef struct KFileAccessor_struct {
+    const KFile* file;
+} KFileAccessor;
+
+static
+rc_t KFileAccessor_Read(const SAccessor* cself, char* buf, size_t size, off_t offset, size_t* num_read)
+{
+    rc_t rc = 0;
+    KFileAccessor* self = (KFileAccessor*)cself;
+    size_t actual = 0;
+
+    do {
+        rc = KFileRead(self->file, offset + *num_read, &buf[*num_read], size - *num_read, &actual);
+        if( rc == 0 && actual == 0 ) {
+            /* EOF */
+            break;
+        }
+        *num_read += actual;
+    } while(rc == 0 && *num_read < size);
+    DEBUG_MSG(10, ("From %lu read %lu bytes\n", offset, *num_read));
+    return rc;
+}
+
+static
+rc_t KFileAccessor_Release(const SAccessor* cself)
+{
+    rc_t rc = 0;
+    if( cself != NULL ) {
+        KFileAccessor* self = (KFileAccessor*)cself;
+        rc = KFileRelease(self->file);
+    }
+    return rc;
+}
+
+rc_t KFileAccessor_Make(const SAccessor** accessor, const char* name, const KFile* kfile)
+{
+    rc_t rc = 0;
+
+    if( (rc = SAccessor_Make(accessor, sizeof(KFileAccessor), name, KFileAccessor_Read, KFileAccessor_Release)) == 0 ) {
+        ((KFileAccessor*)(*accessor))->file = kfile;
+    }
+    return rc;
+}
diff --git a/tools/fuse/kfile-accessor.h b/tools/fuse/kfile-accessor.h
new file mode 100644
index 0000000..e021bbf
--- /dev/null
+++ b/tools/fuse/kfile-accessor.h
@@ -0,0 +1,33 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#ifndef _h_sra_fuse_accessor_kfile_
+#define _h_sra_fuse_accessor_kfile_
+
+#include "accessor.h"
+
+rc_t KFileAccessor_Make(const SAccessor** accessor, const char* name, const KFile* kfile);
+
+#endif /* _h_sra_fuse_accessor_kfile_ */
diff --git a/tools/fuse/log.c b/tools/fuse/log.c
new file mode 100644
index 0000000..9c48c12
--- /dev/null
+++ b/tools/fuse/log.c
@@ -0,0 +1,196 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#include <kfs/directory.h>
+#include <klib/out.h>
+#include <klib/status.h>
+#include <kproc/thread.h>
+
+#include "log.h"
+#include "debug.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <pthread.h>
+
+static unsigned int g_sync = 0;
+static char* g_path = NULL;
+static int g_fd = -1;
+static KThread* g_thread = NULL;
+static bool g_foreground = false;
+
+rc_t StrDup(const char* src, char** dst)
+{
+    if( src == NULL || dst == NULL ) {
+        return RC(rcExe, rcString, rcCopying, rcParam, rcNull);
+    } else {
+        size_t sz = strlen(src);
+        MALLOC(*dst, sz + 1);
+        if( dst == NULL ) {
+            return RC(rcExe, rcString, rcCopying, rcMemory, rcExhausted);
+        }
+        memcpy(*dst, src, sz);
+        (*dst)[sz] = '\0';
+    }
+    return 0;
+}
+
+static
+rc_t LogFileOpen(void)
+{
+    rc_t rc = 0;
+    int old_fd = -1;
+
+    if( g_path != NULL ) {
+        int new_fd = open(g_path, O_WRONLY | O_APPEND | O_CREAT, 0664);
+        if( new_fd < 0 ) {
+            rc = RC(rcExe, rcLog, rcOpening, rcNoObj, rcIncomplete);
+            PLOGERR(klogErr, (klogErr, rc, "'$(s)': $(e)", PLOG_2(PLOG_S(s),PLOG_S(e)), g_path, strerror(errno)));
+        } else {
+            old_fd = g_fd;
+            g_fd = new_fd;
+            
+            DEBUG_MSG(1, ("Log file opened '%s'\n", g_path));
+            
+            if( g_foreground ) {
+                if( dup2(g_fd, STDOUT_FILENO) < 0) {
+                    PLOGMSG(klogErr, (klogErr, "Cannot dup2(stdout) on '$(s)'", PLOG_S(s), g_path));
+                }
+                if( dup2(g_fd, STDERR_FILENO) < 0) {
+                    PLOGMSG(klogErr, (klogErr, "Cannot dup2(stderr) on '$(s)'", PLOG_S(s), g_path));
+                }
+            }
+        }
+    }
+    if( old_fd > -1 ) {
+        sleep(2);
+        close(old_fd);
+    }
+    return rc;
+}
+
+static
+rc_t LogThread( const KThread *self, void *data )
+{
+    PLOGMSG(klogInfo, (klogInfo, "Log rotation thread started with $(s) sec", PLOG_U32(s), g_sync));
+    while( g_sync > 0 ) {
+        sleep(g_sync);
+        DEBUG_MSG(1, ("Log rotation thread checking %s\n", g_path));
+        if( g_sync < 1 || g_path == NULL ) {
+            break;
+        }
+        LogFileOpen();
+    }
+    LOGMSG(klogInfo, "Log rotation thread ended");
+    return 0;
+}
+
+static
+rc_t LogFileWrite(void *self, const char *buffer, size_t bufsize, size_t *num_writ)
+{
+    rc_t rc = 0;
+
+    *num_writ = bufsize;
+    if( g_fd > -1 ) {
+        char tid[64 * 1024];
+        if( bufsize <= (sizeof(tid) - (1 + 5 + 1 + 15 + 2)) ) {
+            int x = sprintf(tid, "[%i/%x] ", getpid(), (unsigned int)pthread_self());
+            memcpy(&tid[x], buffer, bufsize);
+            bufsize += x;
+            if( pwrite(g_fd, tid, bufsize, SEEK_END) != bufsize ) {
+                rc = RC(rcExe, rcLog, rcWriting, rcNoObj, rcIncomplete);
+            }
+        } else {
+            if( pwrite(g_fd, buffer, bufsize, SEEK_END) != bufsize ) {
+                rc = RC(rcExe, rcLog, rcWriting, rcNoObj, rcIncomplete);
+            }
+        }
+    }
+    return rc;
+}
+
+rc_t LogFile_Init(const char* path, unsigned int sync, bool foreground, int* log_fd)
+{
+    rc_t rc = 0;
+
+    if( path != NULL ) {
+        KDirectory *dir = NULL;
+        if( (rc = KDirectoryNativeDir(&dir)) == 0 ) {
+            char buf[4096];
+            if( (rc = KDirectoryResolvePath(dir, true, buf, 4096, "%s", path)) == 0 ) {
+                if( (rc = StrDup(buf, &g_path)) == 0 ) {
+                    if( (rc = KOutHandlerSet(LogFileWrite, NULL)) == 0 &&
+                        (rc = KDbgHandlerSet(LogFileWrite, NULL)) == 0 &&
+                        (rc = KLogHandlerSet(LogFileWrite, NULL)) == 0 &&
+                        (rc = KLogLibHandlerSet(LogFileWrite, NULL)) == 0 &&
+                        (rc = KStsHandlerSet(LogFileWrite, NULL)) == 0 &&
+                        (rc = KStsLibHandlerSet(LogFileWrite, NULL)) == 0 ) {
+                        g_sync = sync;
+                        g_foreground = foreground;
+                        if( g_sync > 0 ) {
+                            PLOGMSG(klogInfo, (klogInfo, "Log $(x) rotation set to $(s) seconds",
+                                     PLOG_2(PLOG_S(x),PLOG_U32(s)), g_path, g_sync));
+                        }
+                    }
+                }
+            }
+            ReleaseComplain(KDirectoryRelease, dir);
+        }
+    }
+    rc = LogFileOpen();
+    if( rc == 0 && path == NULL && g_sync > 0 ) {
+        if( (rc = KThreadMake(&g_thread, LogThread, NULL)) != 0 ) {
+            LOGERR(klogErr, rc, "Log rotation thread");
+        } else {
+            DEBUG_MSG(1, ("Log rotation thread launched %s\n", g_sync));
+        }
+    }
+    if( log_fd != NULL && g_fd != -1) {
+        *log_fd = g_fd;
+    }
+    return rc;
+}
+
+void LogFile_Fini(void)
+{
+    g_sync = 0;
+    if( g_thread != NULL ) {
+        ReleaseComplain(KThreadCancel, g_thread);
+        ReleaseComplain(KThreadRelease, g_thread);
+    }
+    if( g_fd >= 0 ) {
+        close(g_fd);
+    }
+    FREE(g_path);
+    g_path = NULL;
+    g_fd = -1;
+    g_thread = NULL;
+}
diff --git a/tools/fuse/log.h b/tools/fuse/log.h
new file mode 100644
index 0000000..4a42e6d
--- /dev/null
+++ b/tools/fuse/log.h
@@ -0,0 +1,53 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#ifndef _h_services_sra_fuser_log_
+#define _h_services_sra_fuser_log_
+
+#include <klib/rc.h>
+#include <klib/log.h>
+
+#include "debug.h"
+
+#define ReleaseComplain(release, obj) \
+    {{ \
+       rc_t t_rc_ = release(obj); \
+       if( t_rc_ != 0 ) { \
+       PLOGERR(klogWarn, (klogWarn, t_rc_, "$(file):$(line):$(func): " #release "(" #obj ")", \
+                                    "file=%s,line=%u,func=%s", __FILE__, __LINE__, __func__)); \
+       } \
+    }}
+
+rc_t StrDup(const char* src, char** dst);
+
+/*
+ * Set path to logfile and optional (0) log reopen thread timeout
+ * if path is NULL (re)starts watch thread if needed (sync value ignored)
+ */
+rc_t LogFile_Init(const char* path, unsigned int sync, bool foreground, int* log_fd);
+
+void LogFile_Fini(void);
+
+#endif /* _h_services_sra_fuser_log_ */
diff --git a/tools/fuse/node.c b/tools/fuse/node.c
new file mode 100644
index 0000000..4d2f6cf
--- /dev/null
+++ b/tools/fuse/node.c
@@ -0,0 +1,273 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "log.h"
+#include "node.h"
+
+rc_t FSNode_Make(FSNode** self, const char* name, const FSNode_vtbl* vtbl)
+{
+    rc_t rc = 0;
+
+    if( self == NULL || vtbl == NULL ) {
+        rc = RC(rcExe, rcNode, rcConstructing, rcParam, rcNull);
+    } else if( vtbl->Attr == NULL ) {
+        rc = RC(rcExe, rcNode, rcConstructing, rcInterface, rcInsufficient);
+    } else {
+        const char* x = name;
+        while( rc == 0 && *x != '\0' ) {
+            if( *x < 32 || !isascii(*x) || strchr("\"*/:<>?\\|", *x) != NULL ) {
+                rc = RC(rcExe, rcDoc, rcValidating, rcDirEntry, rcInvalid);
+            }
+            x++;
+        }
+        if( rc == 0 ) {
+            CALLOC(*self, 1, vtbl->type_size + (x - name + 1));
+            if( *self == NULL ) {
+                rc = RC(rcExe, rcNode, rcConstructing, rcMemory, rcExhausted);
+            } else {
+                char* x = (char*)(*self);
+                (*self)->vtbl = vtbl;
+                (*self)->name = &x[vtbl->type_size];
+                strcpy(&x[vtbl->type_size], name);
+            }
+        }
+    }
+    return rc;
+}
+
+static
+void FSNode_DropChildren(FSNode* self)
+{
+    if( self != NULL ) {
+        const FSNode* c = self->children;
+        while( c != NULL ) {
+            const FSNode* sib = c->sibling;
+            FSNode_Release(c);
+            c = sib;
+        }
+        self->children = NULL;
+    }
+}
+
+rc_t FSNode_AddChild(FSNode* self, const FSNode* child)
+{
+    rc_t rc = 0;
+    if( self == NULL || child == NULL ) {
+        rc = RC(rcExe, rcNode, rcAttaching, rcParam, rcNull);
+    } else {
+        DEBUG_MSG(8, ("Adding to %s child %s\n", self->name, child->name));
+        if( child->sibling != NULL ) {
+            rc = RC(rcExe, rcDoc, rcAttaching, rcDirEntry, rcAmbiguous);
+        } else if( self->children == NULL ) {
+            self->children = child;
+        } else {
+            const FSNode* ch = self->children;
+            while( rc == 0 && ch != NULL ) {
+                if( strcmp(child->name, ch->name) == 0 ) {
+                    rc = RC(rcExe, rcDoc, rcAttaching, rcDirEntry, rcDuplicate);
+                } else if( ch->sibling == NULL ) {
+                    ((FSNode*)ch)->sibling = child;
+                    break;
+                }
+                ch = ch->sibling;
+            }
+        }
+    }
+    return rc;
+}
+
+rc_t FSNode_GetName(const FSNode* cself, const char** name)
+{
+    rc_t rc = 0;
+
+    if( cself == NULL || name == NULL ) {
+        rc = RC(rcExe, rcNode, rcEvaluating, rcParam, rcNull);
+    } else {
+        *name = cself->name;
+    }
+    return rc;
+}
+
+rc_t FSNode_HasChildren(const FSNode* cself, bool* test)
+{
+    rc_t rc = 0;
+
+    if( cself == NULL || test == NULL ) {
+        rc = RC(rcExe, rcDirectory, rcListing, rcParam, rcNull);
+    } else {
+        *test = cself->children != NULL;
+    }
+    return rc;
+}
+
+rc_t FSNode_ListChildren(const FSNode* cself, FSNode_Dir_Visit func, void* data)
+{
+    rc_t rc = 0;
+
+    if( cself == NULL || func == NULL ) {
+        rc = RC(rcExe, rcDirectory, rcListing, rcParam, rcNull);
+    } else {
+        const FSNode* ch = cself->children;
+        DEBUG_MSG(10, ("Children of %s\n", cself->name));
+        while( rc == 0 && ch != NULL ) {
+            if( ch->vtbl->HasChild ) {
+                rc = FSNode_Dir(ch, NULL, func, data);
+            } else if( (rc = func(ch->name, data)) == 0 ) {
+                DEBUG_MSG(10, ("child '%s'\n", ch->name));
+            }
+            ch = ch->sibling;
+        }
+    }
+    return rc;
+}
+
+rc_t FSNode_FindChild(const FSNode* cself, const char* name, size_t name_len, const FSNode** child, bool* hidden)
+{
+    rc_t rc = 0;
+
+    if( cself == NULL || name == NULL || name_len == 0 || child == NULL || hidden == NULL ) {
+        rc = RC(rcExe, rcDirectory, rcSearching, rcParam, rcInvalid);
+    } else {
+        const FSNode* ch = cself->children;
+        *child = NULL;
+        *hidden = false;
+        while( rc == 0 && ch != NULL && *child == NULL ) {
+            if( ch->vtbl->HasChild ) {
+                if( (rc = ch->vtbl->HasChild(ch, name, name_len)) == 0 ) {
+                    *hidden = true;
+                    *child = ch;
+                } else if( GetRCState(rc) == rcNotFound ) {
+                    rc = 0;
+                }
+            } else if( strlen(ch->name) == name_len && strncmp(ch->name, name, name_len) == 0 ) {
+                *child = ch;
+            }
+            ch = ch->sibling;
+        }
+    }
+    if( rc == 0 && *child == NULL ) {
+        rc = RC(rcExe, rcDirectory, rcEvaluating, rcName, rcNotFound);
+    }
+    return rc;
+}
+
+rc_t FSNode_Touch(const FSNode* cself)
+{
+    rc_t rc = 0;
+
+    if( cself == NULL ) {
+        rc = RC(rcExe, rcNode, rcUpdating, rcParam, rcNull);
+    } else if( cself->vtbl->Touch ) {
+        DEBUG_MSG(10, ("%s: %s\n", __func__, cself->name));
+        rc = cself->vtbl->Touch(cself);
+    }
+    return rc;
+}
+
+rc_t FSNode_Attr(const FSNode* cself, const char* subpath, uint32_t* type, KTime_t* ts, uint64_t* file_sz, uint32_t* access, uint64_t* block_sz)
+{
+    rc_t rc = 0;
+
+    if( cself == NULL || type == NULL || ts == NULL ) {
+        rc = RC(rcExe, rcNode, rcClassifying, rcParam, rcNull);
+    } else {
+        DEBUG_MSG(10, ("%s: %s/%s\n", __func__, cself->name, subpath));
+        if( cself->vtbl->Attr ) {
+            rc = cself->vtbl->Attr(cself, subpath, type, ts, file_sz, access, block_sz);
+        } else {
+            rc = RC(rcExe, rcNode, rcClassifying, rcInterface, rcUnsupported);
+        }
+    }
+    return rc;
+}
+
+rc_t FSNode_Dir(const FSNode* cself, const char* subpath, FSNode_Dir_Visit func, void* data)
+{
+    rc_t rc = 0;
+
+    if( cself == NULL || func == NULL ) {
+        rc = RC(rcExe, rcDirectory, rcListing, rcParam, rcNull);
+    } else {
+        DEBUG_MSG(10, ("%s: %s/%s\n", __func__, cself->name, subpath));
+        if( cself->vtbl->Dir ) {
+            rc = cself->vtbl->Dir(cself, subpath, func, data);
+        } else {
+            rc = RC(rcExe, rcDirectory, rcListing, rcInterface, rcUnsupported);
+        }
+    }
+    return rc;
+}
+
+rc_t FSNode_Link(const FSNode* cself, const char* subpath, char* buf, size_t buf_sz)
+{
+    rc_t rc = 0;
+
+    if( cself == NULL || buf == NULL || buf_sz < 1 ) {
+        rc = RC(rcExe, rcPath, rcAliasing, rcParam, rcInvalid);
+    } else {
+        DEBUG_MSG(10, ("%s: %s/%s\n", __func__, cself->name, subpath));
+        if( cself->vtbl->Link ) {
+            rc = cself->vtbl->Link(cself, subpath, buf, buf_sz);
+            DEBUG_MSG(10, ("%s: %s\n", __func__, buf));
+        } else {
+            rc = RC(rcExe, rcNode, rcAliasing, rcInterface, rcUnsupported);
+        }
+    }
+    return rc;
+}
+
+rc_t FSNode_Open(const FSNode* cself, const char* subpath, const SAccessor** accessor)
+{
+    rc_t rc = 0;
+
+    if( cself == NULL || accessor == NULL ) {
+        rc = RC(rcExe, rcFile, rcOpening, rcParam, rcNull);
+    } else {
+        DEBUG_MSG(10, ("%s: %s/%s\n", __func__, cself->name, subpath));
+        if( cself->vtbl->Open ) {
+            rc = cself->vtbl->Open(cself, subpath, accessor);
+        } else {
+            rc = RC(rcExe, rcFile, rcOpening, rcInterface, rcUnsupported);
+        }
+    }
+    return rc;
+}
+
+void FSNode_Release(const FSNode* cself)
+{
+    if( cself != NULL ) {
+        FSNode* self = (FSNode*)cself;
+        FSNode_DropChildren(self);
+        if( self->vtbl->Release ) {
+            ReleaseComplain(self->vtbl->Release, self);
+        }
+        DEBUG_MSG(10, ("Release FSNode %s\n", self->name));
+        FREE(self);
+    }
+}
diff --git a/tools/fuse/node.h b/tools/fuse/node.h
new file mode 100644
index 0000000..8f02a1f
--- /dev/null
+++ b/tools/fuse/node.h
@@ -0,0 +1,108 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#ifndef _h_sra_fuse_node_
+#define _h_sra_fuse_node_
+
+#include "accessor.h"
+
+struct KDirectory;
+
+typedef struct FSNode_vtbl FSNode_vtbl;
+typedef struct FSNode FSNode;
+
+/* this struct must be 1st element in child objects structs! */
+struct FSNode {
+    const FSNode_vtbl* vtbl;
+    const char* name;
+    const FSNode* children;
+    const FSNode* sibling;
+};
+
+typedef rc_t ( CC * FSNode_Dir_Visit ) ( const char *name, void *data );
+
+#ifndef FSNODE_IMPL
+#define FSNODE_IMPL FSNode
+#endif
+
+struct FSNode_vtbl {
+
+    /* object size */
+    const size_t type_size;
+
+    /* for hidden node asks if a name is within, it doesn't mean that file is really present */
+    rc_t (*HasChild)(const FSNODE_IMPL* cself, const char* name, size_t name_len);
+
+    /* called to update node internal state if found by path search */
+    rc_t (*Touch)(const FSNODE_IMPL* cself);
+
+    /* the only mandatory method for the node */
+    rc_t (*Attr)(const FSNODE_IMPL* cself, const char* subpath, uint32_t* type, KTime_t* ts, uint64_t* file_sz, uint32_t* access, uint64_t* block_sz);
+
+    /* fill lst with subnodes names, terminate with NULL if not filled the list up to lst_sz */
+    rc_t (*Dir)(const FSNODE_IMPL* cself, const char* subpath, FSNode_Dir_Visit func, void* data);
+
+    /* resolve path to real name for a symlink, fill in buf with name */
+    rc_t (*Link)(const FSNODE_IMPL* cself, const char* subpath, char* buf, size_t buf_sz);
+
+    /* open a file for reading */
+    rc_t (*Open)(const FSNODE_IMPL* cself, const char* subpath, const SAccessor** accessor);
+
+    /* releases the object */
+    rc_t (*Release)(FSNODE_IMPL* cself);
+};
+
+/* constructor */
+
+rc_t FSNode_Make(FSNode** self, const char* name, const FSNode_vtbl* vtbl);
+
+/* static methods */
+
+rc_t FSNode_AddChild(FSNode* self, const FSNode* child);
+
+rc_t FSNode_GetName(const FSNode* cself, const char** name);
+
+rc_t FSNode_HasChildren(const FSNode* cself, bool* test);
+
+rc_t FSNode_ListChildren(const FSNode* cself, FSNode_Dir_Visit func, void* data);
+
+rc_t FSNode_FindChild(const FSNode* cself, const char* name, size_t name_len, const FSNode** child, bool* hidden);
+
+/* virtual methods */
+
+rc_t FSNode_Touch(const FSNode* cself);
+
+rc_t FSNode_Attr(const FSNode* cself, const char* subpath, uint32_t* type, KTime_t* ts,
+                 uint64_t* file_sz, uint32_t* access, uint64_t* block_sz);
+
+rc_t FSNode_Dir(const FSNode* cself, const char* subpath, FSNode_Dir_Visit func, void* data);
+
+rc_t FSNode_Link(const FSNode* cself, const char* subpath, char* buf, size_t buf_sz);
+
+rc_t FSNode_Open(const FSNode* cself, const char* subpath, const SAccessor** accessor);
+
+void FSNode_Release(const FSNode* self);
+
+#endif /* _h_sra_fuse_node_ */
diff --git a/tools/fuse/remote-cache.c b/tools/fuse/remote-cache.c
new file mode 100644
index 0000000..e5bde52
--- /dev/null
+++ b/tools/fuse/remote-cache.c
@@ -0,0 +1,1538 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#include <kapp/args.h>
+#include <klib/out.h>
+#include <klib/text.h>
+#include <klib/printf.h>
+#include <klib/rc.h>
+#include <klib/container.h>
+#include <klib/refcount.h>
+#include <kns/manager.h>
+#include <kns/http.h>
+#include <kns/stream.h>
+#include <kfs/directory.h>
+#include <kfs/file.h>
+#include <kfs/cacheteefile.h>
+#include <kproc/lock.h>
+#include <vfs/path.h>
+#include <vfs/manager.h>
+#include <kapp/main.h>
+
+#include <os-native.h>
+
+#include "remote-cache.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <sysalloc.h>
+
+#include "log.h"
+
+/*)))
+ /// Some unusual macroses
+(((*/
+
+/*) There are methods which are using VPath to get schema and host
+ (*/
+
+typedef rc_t ( CC * _PathReader ) (
+                                const VPath * self,
+                                char * Buffer,
+                                size_t BufferSize,
+                                size_t * NumRead
+                                );
+static
+rc_t CC
+_ReadSomething (
+            const char * Path,
+            char * Buffer,
+            size_t BufferSize,
+            _PathReader Reader
+)
+{
+    rc_t RCt;
+    VFSManager * Manager;
+    VPath * ThePath;
+    size_t NumRead;
+
+    RCt = 0;
+    NumRead = 0;
+    Manager = NULL;
+    ThePath = NULL;
+
+    if ( Path == NULL || Buffer == NULL || BufferSize <= 0 || Reader == NULL ) {
+        return RC ( rcExe, rcPath, rcReading, rcParam, rcNull );
+    }
+
+    * Buffer = 0;
+
+    RCt = VFSManagerMake ( & Manager );
+    if ( RCt == 0 ) {
+        RCt = VFSManagerMakePath ( Manager, & ThePath, Path );
+        if ( RCt == 0 ) {
+            RCt = Reader ( ThePath, Buffer, BufferSize, & NumRead );
+
+            ReleaseComplain ( VPathRelease, ThePath );
+        }
+
+        ReleaseComplain ( VFSManagerRelease, Manager );
+    }
+
+    return RCt;
+}   /* _ReadSomething () */
+
+static
+rc_t CC
+_ReadSchema ( const char * Path, char * Buffer, size_t BufferSize )
+{
+    return _ReadSomething ( Path, Buffer, BufferSize, VPathReadScheme );
+}   /* _ReadSchema () */
+
+#ifdef IDDQD
+static
+rc_t CC
+_ReadHost ( const char * Path, char * Buffer, size_t BufferSize )
+{
+    return _ReadSomething ( Path, Buffer, BufferSize, VPathReadHost );
+}   /* _ReadHost () */
+#endif /* IDDQD */
+
+bool CC
+_MatchSchemas ( const char * Schema1, const char * Schema2 )
+{
+    size_t S1Size, S2Size;
+
+    if ( Schema1 == NULL || Schema2 == NULL ) { 
+        return false;
+    }
+
+    S1Size = string_size ( Schema1 );
+    S2Size = string_size ( Schema2 );
+
+    if ( S1Size == S2Size ) {
+        if ( string_cmp (
+                        Schema1,
+                        S1Size,
+                        Schema2,
+                        S1Size,
+                        S1Size
+                        ) == 0 ) {
+            return true;
+        }
+    }
+
+    return false;
+}   /* _MatchSchemas () */
+
+bool CC
+IsRemotePath ( const char * Path )
+{
+    char Schema [ 256 ];
+    bool IsRemote;
+
+
+    IsRemote = false;
+
+    if ( Path == NULL ) {
+        return false;
+    }
+
+    if ( _ReadSchema ( Path, Schema, sizeof ( Schema ) ) != 0 ) {
+        return false;
+    }
+
+    IsRemote = _MatchSchemas ( Schema, "http" );
+
+/* Just for case, he-he ... YAGNI - S!CKS
+    if ( IsRemote == false ) {
+        IsRemote = _MatchSchemas ( Schema, "https" );
+    }
+*/
+    return IsRemote;
+}   /* IsRemotePath () */
+
+bool CC
+IsLocalPath ( const char * Path )
+{
+    KDirectory * NativeDir;
+    uint32_t PathType;
+
+    NativeDir = NULL;
+    PathType = kptNotFound;
+
+        /*  Just checking if Path do exists, and it is a file
+         */
+    if ( Path != NULL ) {
+        if ( KDirectoryNativeDir ( & NativeDir ) == 0 ) {
+            PathType = KDirectoryPathType ( NativeDir, Path );
+
+            KDirectoryRelease ( NativeDir );
+        }
+    }
+
+    return PathType == kptFile;
+}   /* IsLocalPath () */
+
+/*)))
+ ///  Cache ... hmmm
+(((*/
+static KNSManager * _ManagerOfKNS = NULL;
+static BSTree _Cache;
+    /* That lock will be used for adding/searching cache entries */
+static KLock * _CacheLock = NULL;
+
+const char * _CacheEntryClassName = "RCacheEntry_class";
+const char * _CacheDirName = ".cache";
+static char _CacheRoot [ 4096 ];
+static char * _PCacheRoot = NULL;
+static size_t _CacheEntryNo = 0;
+static uint32_t _HttpBlockSize = 0;
+static bool _DisklessMode = false;
+
+struct RCacheEntry {
+    BSTNode AsIs;
+
+    KRefcount refcount;
+    KLock * mutabor;
+
+    char * Name;
+    char * Url;
+
+    const KFile * File;
+};
+
+/*))
+ //  Some extremely useful methods
+((*/
+rc_t CC
+_EGetCachePath (
+            const char * CacheRoot,
+            char * Buffer,
+            size_t BufferSize
+)
+{
+    size_t NumWrit;
+
+    if ( CacheRoot == NULL || Buffer == NULL || BufferSize == 0 ) {
+        return RC ( rcExe, rcString, rcCopying, rcParam, rcNull );
+    }
+
+    return string_printf (
+                        Buffer,
+                        BufferSize,
+                        & NumWrit,
+                        "%s/%s",
+                        CacheRoot,
+                        _CacheDirName
+                        );
+}   /* _EGetCachePath () */
+
+rc_t CC
+_GetCachePath ( char * Buffer, size_t BufferSize )
+{
+    return _EGetCachePath ( RemoteCachePath (), Buffer, BufferSize );
+}   /* _GetCachePath () */
+
+rc_t CC
+_EGetCachePathOld (
+                const char * CacheRoot,
+                char * Buffer,
+                size_t BufferSize
+)
+{
+    size_t NumWrit;
+
+    if ( CacheRoot == NULL || Buffer == NULL || BufferSize == 0 ) {
+        return RC ( rcExe, rcString, rcCopying, rcParam, rcNull );
+    }
+
+    return string_printf (
+                        Buffer,
+                        BufferSize,
+                        & NumWrit,
+                        "%s/%s.old",
+                        CacheRoot,
+                        _CacheDirName
+                        );
+}   /* _EGetCachePathOld () */
+
+rc_t CC
+_GetCachePathOld ( char * Buffer, size_t BufferSize )
+{
+    return _EGetCachePathOld ( RemoteCachePath (), Buffer, BufferSize );
+}   /* _GetCachePathOld () */
+
+rc_t CC
+_CheckCreateDirectory ( const char * Path )
+{
+    rc_t RCt;
+    KDirectory * NativeDir;
+    uint32_t PathType;
+
+    RCt = 0;
+    NativeDir = NULL;
+    PathType = kptNotFound;
+
+    if ( Path == NULL ) {
+        return RC ( rcExe, rcDirectory, rcCreating, rcParam, rcNull );
+    }
+
+    RCt = KDirectoryNativeDir ( & NativeDir );
+    if ( RCt == 0 ) {
+        PathType = KDirectoryPathType ( NativeDir, Path );
+        switch ( PathType ) {
+            case kptNotFound :
+                        RmOutMsg ( "Creating directory '%s'\n", Path );
+                        RCt = KDirectoryCreateDir (
+                                                NativeDir,
+                                                0777,
+                                                kcmCreate,
+                                                Path
+                                                );
+                        break;
+            case kptDir :
+                        break;
+            default :
+                            /* Somtheing is wrong */
+                        RCt = RC ( rcExe, rcDirectory, rcCreating, rcError, rcInvalid );
+                        break;
+        }
+
+        ReleaseComplain ( KDirectoryRelease, NativeDir );
+    }
+
+    return RCt;
+}   /* _CheckCreateDirectory () */
+
+rc_t CC
+_CheckRemoveDirectory ( const char * Path )
+{
+    rc_t RCt;
+    KDirectory * NativeDir;
+    uint32_t PathType;
+
+    RCt = 0;
+    NativeDir = NULL;
+    PathType = kptNotFound;
+
+    if ( Path == NULL ) {
+        return RC ( rcExe, rcDirectory, rcRemoving, rcParam, rcNull );
+    }
+
+    RCt = KDirectoryNativeDir ( & NativeDir );
+    if ( RCt == 0 ) {
+        PathType = KDirectoryPathType ( NativeDir, Path );
+        switch ( PathType ) {
+            case kptNotFound:
+                    /* Everything is good */
+                    break;
+            default:
+                RmOutMsg ( "Removing directory '%s'\n", Path );
+                RCt = KDirectoryRemove ( NativeDir, true, Path );
+                break;
+        }
+
+        ReleaseComplain ( KDirectoryRelease, NativeDir );
+    }
+
+    return RCt;
+}   /* _CheckRemoveDirectory () */
+
+rc_t CC
+_CheckRemoveOldCacheDirectory ( const char * CacheRoot )
+{
+    rc_t RCt;
+    KDirectory * NativeDir;
+    char CacheDir [ 4096 ];
+    char OldCacheDir [ 4096 ];
+
+    RCt = 0;
+    NativeDir = NULL;
+    * CacheDir = 0;
+    * OldCacheDir = 0;
+
+    if ( CacheRoot == NULL ) {
+        return RC ( rcExe, rcDirectory, rcRemoving, rcParam, rcNull );
+    }
+
+    if ( _EGetCachePath ( CacheRoot, CacheDir, sizeof ( CacheDir ) ) != 0
+        || _EGetCachePathOld ( CacheRoot, OldCacheDir, sizeof ( OldCacheDir ) ) )
+    {
+        return RC ( rcExe, rcDirectory, rcRemoving, rcParam, rcInvalid );
+    }
+
+    RCt = KDirectoryNativeDir ( & NativeDir );
+    if ( RCt == 0 ) {
+            /*) Just because I do not know wahat to do in the case if
+            (*) it is impossible to remove directory I am doing that
+            (*) hookup
+            (*/
+        RCt = _CheckRemoveDirectory ( OldCacheDir );
+        if ( RCt == 0 ) {
+            RCt = KDirectoryRename (
+                                NativeDir,
+                                true,
+                                CacheDir,
+                                OldCacheDir
+                                );
+            if ( RCt == 0 ) {
+                RCt = _CheckRemoveDirectory ( OldCacheDir );
+            }
+        }
+
+        ReleaseComplain ( KDirectoryRelease, NativeDir );
+    }
+
+    return RCt;
+}   /* _CheckRemoveOldCacheDirectory () */
+
+#ifdef LOPPPATA
+######
+rc_t CC
+_EGetCachePathToFile (
+                const char * CacheRoot,
+                const char * PathToFile,
+                char * Buffer,
+                size_t BufferSize
+)
+{
+    size_t NumWrit;
+
+    if ( Buffer == NULL
+        || BufferSize == 0
+        || PathToFile == NULL
+        || CacheRoot == NULL
+        )
+    {
+        return RC ( rcExe, rcString, rcCopying, rcParam, rcNull );
+    }
+
+    return string_printf (
+                        Buffer,
+                        BufferSize,
+                        & NumWrit,
+                        "%s/%s/%s",
+                        CacheRoot,
+                        CacheDirName,
+                        PathToFile
+                        );
+}   /* _EGetCachePathToFile () */
+
+rc_t CC
+_GetCachePathToFile (
+                const char * PathToFile,
+                char * Buffer,
+                size_t BufferSize
+)
+{
+    return _EGetCachePathToFile (
+                            RemoteCachePath (),
+                            PathToFile,
+                            Buffer,
+                            BufferSize
+                            );
+}   /* _GetCachePathToFile () */
+#endif /* LOPPPATA */
+
+/*
+ *  Lyrics: This method will set buffer size for HTTP transport
+ *  and return previous value.
+ *  That method is thread unsafe, and it is better to set it once
+ *  on the time of cache initialization
+ */
+uint32_t CC
+RemoteCacheSetHttpBlockSize ( uint32_t HttpBlockSize )
+{
+    uint32_t RetVal = _HttpBlockSize;
+
+    _HttpBlockSize = HttpBlockSize;
+
+    return RetVal;
+}   /* RemoteCacheSetHttpBlockSize () */
+
+/*
+ * Lyrics: Cache initialising: keeping in memory cache path 
+ *         cache path could be a NULL, and in that case no cacheing
+ *         performed
+ */
+rc_t CC
+RemoteCacheInitialize ( const char * Path )
+{
+    rc_t RCt;
+    char Buffer [ 4096 ];
+    struct KDirectory * Directory;
+
+    RCt = 0;
+    * _CacheRoot = 0;
+    * Buffer = 0;
+
+    if ( RemoteCacheIsDisklessMode () ) {
+        LOGMSG ( klogErr, "[RemoteCache] Already initialized in diskless mode" );
+
+        return RC ( rcExe, rcPath, rcInitializing, rcParam, rcNull );
+    }
+
+        /*))
+         //  If path is NULL - diskless mode ... we introduced
+        //   variable for that ... to avoid confusion
+       ((*/
+    if ( Path == NULL ) {
+        LOGMSG ( klogErr, "[RemoteCache] initializing [diskless]" );
+
+        _DisklessMode = true;
+
+        return 0;
+    }
+
+    PLOGMSG ( klogErr, ( klogErr, "[RemoteCache] initializing [$(f)]", PLOG_S(f), Path ) );
+
+        /* we are checking that cache directory already initialized */
+    if ( _PCacheRoot != NULL ) {
+        return RC ( rcExe, rcPath, rcInitializing, rcSelf, rcExists );
+    }
+
+    RCt = KDirectoryNativeDir ( & Directory );
+    if ( RCt == 0 ) {
+        RCt = KDirectoryResolvePath (
+                                Directory,
+                                true,
+                                _CacheRoot,
+                                sizeof ( _CacheRoot ),
+                                Path
+                                );
+    }
+
+    if ( RCt == 0 ) {
+        _PCacheRoot = _CacheRoot;
+    }
+
+    return RCt;
+}   /*  RemoteCacheInitialize () */
+
+static
+rc_t CC
+_InitKNSManager ()
+{
+    rc_t RCt;
+    KNSManager * Manager;
+    ver_t Ver;
+
+    RCt = 0;
+    Manager = NULL;
+    Ver = KAppVersion ();
+
+    if ( _ManagerOfKNS != NULL ) {
+        return RC ( rcExe, rcNS, rcInitializing, rcSelf, rcInvalid );
+    }
+
+    RCt = KNSManagerMake ( & Manager );
+    if ( RCt == 0 ) {
+        RCt = KNSManagerSetUserAgent (
+                                    Manager,
+                                    "sra-toolkit remote-fuser.%V",
+                                    Ver
+                                    );
+        if ( RCt == 0 ) {
+            _ManagerOfKNS = Manager;
+        }
+        else {
+            ReleaseComplain ( KNSManagerRelease, Manager );
+        }
+    }
+
+    return RCt;
+}   /* _InitKNSManager () */
+
+static
+rc_t CC
+_DisposeKNSManager ()
+{
+    KNSManager * Manager = _ManagerOfKNS;
+
+    _ManagerOfKNS = NULL;
+
+    if ( Manager == NULL ) {
+        return 0;
+    }
+
+    ReleaseComplain ( KNSManagerRelease, Manager );
+
+    return 0;
+}   /* _DisposeKNSManager () */
+
+/*
+ * Lyrics: Cache make 
+ * Cache initialisation consists from two steps :
+ *    Creating directory if it does not exist
+ *    Removing content of directory if it is something here
+ */
+rc_t CC
+RemoteCacheCreate ()
+{
+    rc_t RCt;
+    char Buffer [ 4096 ];
+
+    if ( RemoteCacheIsDisklessMode () ) {
+        LOGMSG( klogInfo, "[RemoteCache] entering diskless mode\n" );
+        return 0;
+    }
+
+    LOGMSG( klogInfo, "[RemoteCache] creating\n" );
+
+    RCt = 0;
+    * Buffer = 0;
+
+        /* standard c=ecks */
+        /* we are checking that cache directory already initialized */
+    if ( _PCacheRoot == NULL ) {
+        return RC ( rcExe, rcPath, rcInitializing, rcSelf, rcNull );
+    }
+
+        /* Checking if CacheRoot directory exists and creating if not */
+    RCt = _CheckCreateDirectory ( _PCacheRoot );
+    if ( RCt == 0 ) {
+            /* Here we are moving old cache path
+             */
+        RCt = _CheckRemoveOldCacheDirectory ( _PCacheRoot );
+        if ( RCt ) {
+            RCt = _EGetCachePath (
+                                _PCacheRoot,
+                                Buffer,
+                                sizeof ( Buffer )
+                                );
+            if ( RCt == 0 ) {
+
+                RCt = _CheckCreateDirectory ( Buffer );
+            }
+        }
+    }
+
+    if ( RCt == 0 ) {
+
+        RCt = _InitKNSManager ();
+        if ( RCt == 0 ) {
+
+                /* Initializing BSTree */
+            BSTreeInit ( & _Cache );
+                /* Initializing _CacheLock */
+            RCt = KLockMake ( & _CacheLock );
+        }
+    }
+
+    if ( RCt != 0 ) {
+            /* Endangered specie TODO!!! */
+        RemoteCacheDispose ();
+    }
+
+    return RCt;
+}   /* RemoteCacheCreate () */
+
+rc_t CC _RCacheEntryDestroy ( struct RCacheEntry * Entry );
+
+void CC
+_RcAcHeEnTrYwHaCk ( BSTNode * Node, void * UnusedParam )
+{
+    if ( Node != NULL ) {
+        _RCacheEntryDestroy ( ( struct RCacheEntry * ) Node );
+    }
+}   /* _RcAcHeEnTrYwHaCk () */
+
+/*
+ * Lyrics: Cache finalization 
+ * Cache finalization consists from one step(s) :
+ *    Removing content of cache directory if it exists and
+ *    something is here
+ */
+rc_t CC
+RemoteCacheDispose ()
+{
+    rc_t RCt;
+
+    if ( RemoteCacheIsDisklessMode () ) {
+        LOGMSG( klogInfo, "[RemoteCache] leaving diskless mode\n" );
+    }
+
+    LOGMSG( klogInfo, "[RemoteCache] disposing\n" );
+
+    RCt = 0;
+
+    if ( RemoteCacheIsDisklessMode () ) {
+        _DisklessMode = false;
+
+        return 0;
+    }
+
+        /*) Cache was not initialized
+         (*/
+    if ( _PCacheRoot == NULL ) {
+        return 0;
+    }
+
+    RCt = _CheckRemoveOldCacheDirectory ( _CacheRoot );
+    if ( RCt == 0 ) {
+        * _CacheRoot = 0;
+        _PCacheRoot = NULL;
+    }
+
+        /* Releasing Lock */
+    if ( _CacheLock != NULL ) {
+        ReleaseComplain ( KLockRelease, _CacheLock );
+        _CacheLock = NULL;
+    }
+
+    _DisposeKNSManager ();
+
+    BSTreeWhack ( & _Cache, _RcAcHeEnTrYwHaCk, NULL );
+
+    _CacheEntryNo = 0;
+
+    * _CacheRoot = 0;
+    _PCacheRoot = NULL;
+
+    return RCt;
+}   /* RemoteCacheDispose () */
+
+/*))
+ //  Generates effective name for a file
+((*/
+rc_t CC
+_RCacheEntryGenerateName ( char * Buffer, size_t Size )
+{
+    size_t NumWritten;
+
+    NumWritten = 0;
+
+    if ( Buffer == NULL || Size <= 2 ) {
+        return RC ( rcExe, rcFile, rcInitializing, rcParam, rcNull );
+    }
+
+    return string_printf (
+                        Buffer,
+                        Size,
+                        & NumWritten,
+                        "etwas.%d",
+                        _CacheEntryNo + 1
+                        );
+}   /* _RCacheEntryGenerateName () */
+
+/*))
+ //  This method will destroy CacheEntry and free all resources
+((*/
+rc_t CC
+_RCacheEntryDestroy ( struct RCacheEntry * self )
+{
+    if ( self != NULL ) {
+ /*
+ RmOutMsg ( "++++++DL DESTROY [0x%p] entry\n", self );
+ */
+        /*)) Reverse order. I suppose it will be destoryed only
+         //  in particualr cases, so no locking :|
+        ((*/
+            /*) File
+             (*/
+        if ( self -> File != NULL ) {
+            ReleaseComplain ( KFileRelease, self -> File );
+            self -> File = 0;
+        }
+            /*) Url
+             (*/
+        if ( self -> Url != NULL ) {
+            free ( self -> Url );
+            self -> Url = NULL;
+        }
+            /*) Name
+             (*/
+        if ( self -> Name != NULL ) {
+            free ( self -> Name );
+            self -> Name = NULL;
+        }
+            /*) mutabor
+             (*/
+        if ( self -> mutabor != NULL ) {
+            ReleaseComplain ( KLockRelease, self -> mutabor );
+            self -> mutabor = NULL;
+        }
+            /*) refcount 
+             (*/
+        KRefcountWhack ( & ( self -> refcount ), _CacheEntryClassName ); 
+
+        free ( self );
+    }
+
+    return 0;
+}   /* _RCacheEntryDestroy () */
+
+/*))
+ //  This method will create new CacheEntry
+((*/
+rc_t CC
+_RCacheEntryMake (
+            const char * Url,
+            struct RCacheEntry ** RetEntry
+)
+{
+    rc_t RCt;
+    struct RCacheEntry * Entry;
+    char Buffer [ 4096 ];
+
+    RCt = 0;
+
+    if ( Url == NULL || RetEntry == NULL ) {
+        return RC ( rcExe, rcFile, rcInitializing, rcParam, rcNull );
+    }
+    * RetEntry = NULL;
+
+    if ( ! RemoteCacheIsDisklessMode () ) {
+            /*)  It is better do it here, before any allocation
+             (*/
+        RCt = _RCacheEntryGenerateName ( Buffer, sizeof ( Buffer ) );
+        if ( RCt != 0 ) {
+            return RCt;
+        }
+    }
+
+    Entry = ( struct RCacheEntry * ) calloc (
+                                        1,
+                                        sizeof ( struct RCacheEntry )
+                                        );
+    if ( Entry == NULL ) {
+        return RC ( rcExe, rcFile, rcInitializing, rcMemory, rcExhausted );
+    }
+
+        /*) refcount
+         (*/
+    KRefcountInit (
+                & ( Entry -> refcount ),
+                0,
+                _CacheEntryClassName,
+                "_RCacheEntryMake()",
+                Buffer
+                );
+        /*) mutabor
+         (*/
+    RCt = KLockMake ( & ( Entry -> mutabor ) );
+
+    if ( RCt == 0 ) {
+        if ( ! RemoteCacheIsDisklessMode () ) {
+                /*) Name
+                 (*/
+            Entry -> Name = string_dup_measure ( Buffer, NULL );
+            if ( Entry -> Name == NULL ) {
+                RCt = RC ( rcExe, rcFile, rcInitializing, rcMemory, rcExhausted );
+            }
+        }
+
+        if ( RCt == 0 ) {
+                /*) Url
+                 (*/
+            Entry -> Url = string_dup_measure ( Url, NULL );
+            if ( Entry -> Url == NULL ) {
+                RCt = RC ( rcExe, rcFile, rcInitializing, rcMemory, rcExhausted );
+            }
+            if ( RCt == 0 ) {
+                    /*) File, nothing about file, it will be opened by
+                     /  on demand
+                    (*/
+                    /*) Increasing count and assigning value
+                     (*/
+                _CacheEntryNo ++;
+                * RetEntry = Entry;
+            }
+        }
+    }
+
+    if ( RCt != 0 && Entry != NULL ) {
+        _RCacheEntryDestroy ( Entry );
+    }
+
+    return RCt;
+}   /*  _RCacheEntryMake () */
+
+/*))
+ //  Comparator: common case
+((*/
+int CC
+_RcUrLcMp ( const char * Url1, const char * Url2 )
+{
+    if ( Url1 == NULL || Url2 == NULL ) {
+        if ( Url1 != NULL ) {
+            return 4096;
+        }
+        if ( Url2 != NULL ) {
+            return 4096;
+        }
+        return 0;
+    }
+
+    return strcmp ( Url1, Url2 );
+}   /* _RcUrLcMp () */
+
+/*))
+ //  Comparator: we suppose that 'item' is an Url
+((*/
+int CC
+_RcEnTrYcMp ( const void * item, const BSTNode * node )
+{
+    return _RcUrLcMp (
+                    ( const char * ) item,
+                    node == NULL
+                        ? NULL
+                        : ( ( struct RCacheEntry * ) node ) -> Url
+                    );
+}   /* _RcEnTrYcMp () */
+
+/*))
+ //  Sorter for BSTreeInsert
+((*/
+int CC
+_RcNoDeCmP ( const BSTNode * node1, const BSTNode * node2 )
+{
+    return _RcUrLcMp (
+                    node1 == NULL
+                        ? NULL
+                        : ( ( struct RCacheEntry * ) node1 ) -> Url,
+                    node2 == NULL
+                        ? NULL
+                        : ( ( struct RCacheEntry * ) node2 ) -> Url
+                    );
+}   /* _RcNoDeCmP () */
+
+/*))
+ //  This method suppeosed to find or create Entry
+((*/
+rc_t CC
+RemoteCacheFindOrCreateEntry (
+                            const char * Url,
+                            struct RCacheEntry ** Entry
+)
+{
+    rc_t RCt;
+    struct RCacheEntry * RetEntry;
+
+    RCt = 0;
+    RetEntry = NULL;
+
+    if ( Url == NULL || Entry == NULL ) {
+        return RC ( rcExe, rcPath, rcInitializing, rcParam, rcNull );
+    }
+    * Entry = NULL;
+
+        /*)  Diskless mode
+         (*/
+    if ( RemoteCacheIsDisklessMode () ) {
+        RCt = _RCacheEntryMake ( Url, & RetEntry );
+        if ( RCt == 0 ) {
+ /*
+ RmOutMsg ( "++++++DL CREATE [0x%p][%s] entry\n", RetEntry, Url );
+ */
+            * Entry = RetEntry;
+        }
+
+        return RCt;
+    }
+        /*)  Here we are locking
+         (*/
+    RCt = KLockAcquire ( _CacheLock );
+    if ( RCt == 0 ) {
+            /*)  Here we are 'looking for' and 'fooking lor'
+             (*/
+        RetEntry = ( struct RCacheEntry * ) BSTreeFind (
+                                                    & _Cache,
+                                                    Url,
+                                                    _RcEnTrYcMp
+                                                    );
+/*
+ RmOutMsg ( "++++++ %s entry\n", RetEntry == NULL ? "Creating" : "Loading" );
+*/
+        if ( RetEntry == NULL ) {
+            RCt = _RCacheEntryMake ( Url, & RetEntry );
+            if ( RCt == 0 ) {
+                RCt = BSTreeInsert (
+                                & _Cache,
+                                ( BSTNode * ) RetEntry,
+                                _RcNoDeCmP
+                                );
+            }
+        }
+
+        if ( RCt == 0 ) {
+            * Entry = RetEntry;
+        }
+
+            /*)  First we are trying to find appropriate entry
+             (*/
+        ReleaseComplain ( KLockUnlock, _CacheLock );
+    }
+
+    return RCt;
+}   /* RemoteCacheFindOrCreateEntry () */
+
+const char * CC
+RemoteCachePath ()
+{
+    return RemoteCacheIsDisklessMode() ? NULL : _PCacheRoot;
+}   /* RemoteCachePath () */
+
+bool CC
+RemoteCacheIsDisklessMode ()
+{
+    return _DisklessMode;
+}   /* RemoteCacheIsDisklessMode () */
+
+/*)))
+ ///  Top of the crop methods
+(((*/
+rc_t CC
+RCacheEntryAddRef ( struct RCacheEntry * self )
+{
+    rc_t RCt;
+
+    RCt = 0;
+
+    if ( self != NULL ) {
+        RCt = KLockAcquire ( self -> mutabor );
+
+        if ( RCt == 0 ) {
+ /*
+ RmOutMsg ( "++++++DL ADDREF [0x%p] entry\n", self );
+ */
+            switch ( KRefcountAdd (
+                            & ( self -> refcount ),
+                            _CacheEntryClassName
+                            ) ) {
+                case krefLimit:
+                    RCt = RC ( rcExe, rcFile, rcAttaching, rcRange, rcExcessive );
+                case krefNegative:
+                    RCt = RC ( rcExe, rcFile, rcAttaching, rcSelf, rcInvalid );
+                default:
+                    break;
+            }
+
+            KLockUnlock ( self -> mutabor );
+        }
+    }
+
+    return RCt;
+}   /* RCacheEntryAddRef () */
+
+rc_t CC
+_RCacheEntryReleaseWithoutLock ( struct RCacheEntry * self )
+{
+    /*)) This method called from special place, so no NULL checks
+     ((*/
+
+    if ( self -> File != NULL ) {
+/*
+RmOutMsg ( "|||<-- Releasing [%s][%s]\n", self -> Name, self -> Url );
+*/
+        ReleaseComplain ( KFileRelease, self -> File );
+        self -> File = NULL;
+    }
+
+    return 0;
+}   /*  _RCacheEntryReleaseWithoutLock () */
+
+rc_t CC
+RCacheEntryRelease ( struct RCacheEntry * self )
+{
+    rc_t RCt;
+
+    RCt = 0;
+
+    if ( self != NULL ) {
+        RCt = KLockAcquire ( self -> mutabor );
+
+        if ( RCt == 0 ) {
+            switch ( KRefcountDrop (
+                            & ( self -> refcount ),
+                            _CacheEntryClassName
+                            ) ) {
+                case krefWhack:
+                    _RCacheEntryReleaseWithoutLock ( self );
+                    if ( RemoteCacheIsDisklessMode () ) {
+ /*
+ RmOutMsg ( "++++++DL RELEASE [0x%p] entry\n", self );
+ */
+                        _RCacheEntryDestroy ( self );
+                    }
+                    break;
+                case krefNegative:
+                    RCt = RC ( rcExe, rcFile, rcReleasing, rcRange, rcExcessive );
+                default:
+                    break;
+            }
+
+            KLockUnlock ( self -> mutabor );
+        }
+    }
+
+    return RCt;
+}   /* RCacheEntryRelease () */
+
+rc_t CC
+_RCacheEntryOpenFileReadRemote (
+                            struct RCacheEntry * self,
+                            const char * Path
+)
+{
+    rc_t RCt;
+    struct KDirectory * Directory;
+    const struct KFile * HttpFile, * TeeFile;
+
+    RCt = 0;
+    Directory = NULL;
+    HttpFile = TeeFile = NULL;
+
+    if ( self == NULL ) {
+        return RC ( rcExe, rcFile, rcOpening, rcParam, rcNull );
+    }
+
+    if ( ( ! RemoteCacheIsDisklessMode () ) && Path == NULL ) {
+        return RC ( rcExe, rcFile, rcOpening, rcParam, rcNull );
+    }
+
+/*
+RmOutMsg ( "|||<-- Opening [R] [%s][%s]\n", self -> Name, self -> Url );
+RmOutMsg ( "  |<-- Cache Entry [%s]\n", Path );
+*/
+
+    RCt = KNSManagerMakeHttpFile (
+                                _ManagerOfKNS,
+                                & HttpFile,
+                                NULL, /* no open connections */
+                                0x01010000,
+                                self -> Url
+                                );
+    if ( RCt == 0 ) {
+        if ( RemoteCacheIsDisklessMode () ) {
+            self -> File = ( KFile * ) HttpFile;
+        }
+        else {
+            RCt = KDirectoryNativeDir ( & Directory );
+            if ( RCt == 0 ) {
+                RCt = KDirectoryMakeCacheTee (
+                                    Directory,
+                                    & TeeFile,
+                                    HttpFile,
+                                    NULL,   /* logger */
+                                    _HttpBlockSize, /* blocksize */
+                                    1,      /* cluster */
+                                    false,  /* report */
+                                    Path
+                                    );
+                if ( RCt == 0 ) {
+                    self -> File = ( KFile * ) TeeFile;
+                }
+
+                ReleaseComplain ( KDirectoryRelease, Directory );
+            }
+            ReleaseComplain ( KFileRelease, HttpFile );
+        }
+    }
+
+    return RCt;
+}   /* _RCacneEntryOpenFileReadRemote () */
+
+rc_t CC
+_RCacheEntryOpenFileReadLocal (
+                            struct RCacheEntry * self,
+                            const char * Path
+)
+{
+    rc_t RCt;
+    const struct KFile * File;
+    struct KDirectory * Directory;
+
+    RCt = 0;
+    File = NULL;
+    Directory = NULL;
+
+    if ( self == NULL || Path == NULL ) {
+        return RC ( rcExe, rcFile, rcOpening, rcParam, rcNull );
+    }
+
+/*
+RmOutMsg ( "|||<-- Opening [L] [%s][%s]\n", self -> Name, self -> Url );
+RmOutMsg ( "  |<-- Cache Entry [%s]\n", Path );
+*/
+
+    RCt = KDirectoryNativeDir ( & Directory );
+    if ( RCt == 0 ) {
+        RCt = KDirectoryOpenFileRead ( Directory, & File, Path );
+        if ( RCt == 0 ) {
+            self -> File = File;
+        }
+
+        ReleaseComplain ( KDirectoryRelease, Directory );
+    }
+
+    return RCt;
+}   /* _RCacneEntryOpenFileReadLocal () */
+
+/*((
+   \\  The only way to check that cache file completed, is to check if
+    \\  it exists
+     ((*/
+bool CC
+_RCacheCheckCompleted ( const char * Path )
+{
+    uint32_t PathType;
+    KDirectory * Directory;
+
+    PathType = kptNotFound;
+    Directory = NULL;
+
+    if ( KDirectoryNativeDir ( & Directory ) == 0 ) {
+        PathType = KDirectoryPathType ( Directory, Path );
+        ReleaseComplain ( KDirectoryRelease, Directory );
+    }
+
+    return PathType == kptFile;
+}   /* _RCacheCheckCompleted () */
+
+rc_t CC
+_RCacheEntryOpenFileRead ( struct RCacheEntry * self)
+{
+    rc_t RCt;
+    char Buffer [ 4096 ], ThePath [ 4096 ];
+    size_t TheSize;
+
+    RCt = 0;
+    TheSize = 0;
+    * Buffer = 0;
+    * ThePath = 0;
+
+    if ( self == NULL ) {
+        return RC ( rcExe, rcFile, rcOpening, rcParam, rcNull );
+    }
+
+    if ( self -> File != NULL ) {
+        return 0;
+    }
+
+        /*)  Do that before messing with disk
+         (*/
+    if ( RemoteCacheIsDisklessMode () ) {
+        RCt = _RCacheEntryOpenFileReadRemote ( self, NULL );
+    }
+    else {
+
+            /*)  First we should to make path to real cache file
+             (*/
+        RCt = _GetCachePath ( Buffer, sizeof ( Buffer ) );
+        if ( RCt == 0 ) {
+            RCt = string_printf (
+                                ThePath,
+                                sizeof ( ThePath ),
+                                & TheSize,
+                                "%s/%s",
+                                Buffer,
+                                self -> Name
+                                );
+        }
+
+        if ( RCt != 0 ) {
+            return RCt;
+        }
+
+        if ( _RCacheCheckCompleted ( ThePath ) ) {
+            RCt = _RCacheEntryOpenFileReadLocal ( self, ThePath );
+        }
+        else {
+            RCt = _RCacheEntryOpenFileReadRemote ( self, ThePath );
+        }
+
+    }
+
+    return RCt;
+}   /* _RCacheEntryOpenFileRead () */
+
+rc_t CC
+RCacheEntryRead (
+            struct RCacheEntry * self,
+            char * Buffer,
+            size_t SizeToRead,
+            uint64_t Offset,
+            size_t * NumReaded
+)
+{
+    rc_t RCt;
+    int llp;
+    const int NumAttempts = 3;
+
+    RCt = 0;
+    llp = 0;
+
+    if ( self == NULL ) { 
+        return RC ( rcExe, rcFile, rcReading, rcParam, rcNull );
+    }
+
+        /*)  Here we are locking
+         (*/
+    RCt = KLockAcquire ( self -> mutabor );
+
+    if ( RCt == 0 ) {
+
+        for ( llp = 0; llp < NumAttempts; llp ++ ) {
+                /*) There could be non zero value from previous pass
+                 (*/
+            if ( RCt != 0 ) {
+PLOGMSG ( klogErr, ( klogErr, "|||<- Trying to read file $(n)$(u) at attempt $(l)", PLOG_3(PLOG_S(n),PLOG_S(u),PLOG_I64(l)), self -> Name, self -> Url, llp + 1 ) );
+                RCt = 0;
+            }
+
+                /*) If error happen on previous pass file is released
+                 (*/
+            if ( self -> File == NULL ) {
+                /*)  We are opening file for read here
+                 (*/
+                RCt = _RCacheEntryOpenFileRead ( self );
+/*
+RmOutMsg ( "|||<-- Opening file [%s][%s] [A=%d]\n", self -> Name, self -> Url, RCt );
+*/
+            }
+
+            if ( RCt == 0 ) {
+                RCt = KFileRead (
+                                self -> File,
+                                Offset,
+                                Buffer,
+                                SizeToRead,
+                                NumReaded
+                                );
+/*
+RmOutMsg ( "|||<-- Reading [%s][%s] [O=%d][S=%d][R=%d][A=%d]\n", self -> Name, self -> Url, Offset, SizeToRead, * NumReaded, RCt );
+*/
+                if ( RCt == 0 ) {
+                    break;
+                }
+            }
+/*
+RmOutMsg ( "|||<- Failed to read file [%s][%s] at attempt [%d]\n", self -> Name, self -> Url, llp + 1 );
+*/
+            _RCacheEntryReleaseWithoutLock ( self );
+
+        }
+
+        if ( RCt != 0 ) {
+PLOGMSG ( klogErr, ( klogErr, "|||<- Failed to read file $(n)$(u) after $(l) attempts", PLOG_3(PLOG_S(n),PLOG_S(u),PLOG_I64(l)), self -> Name, self -> Url, llp + 1 ) );
+        }
+
+        KLockUnlock ( self -> mutabor );
+    }
+
+    return RCt;
+}   /* RCacheEntryRead () */
+
+/*)))
+ ///  That method will read KFile into a memory.
+ \\\  He-he, it will allocate +1 byte array and set 0 to last one.
+ ///  It suppose to read text files, so, 0 terminated string
+(((*/
+rc_t CC
+_ReadKFileToMemory (
+                const KFile * File,
+                char ** RetBuffer,
+                uint64_t * RetSize
+)
+{
+    rc_t RCt;
+    char * Buf;
+    size_t BufSize;
+
+    RCt = 0;
+    Buf = NULL;
+    BufSize = 0;
+
+    * RetBuffer = NULL;
+    * RetSize = 0;
+
+    if ( File == NULL || RetBuffer == NULL || RetSize == NULL ) {
+        return RC ( rcExe, rcFile, rcReading, rcParam, rcNull );
+    }
+
+    RCt = KFileSize ( File, & BufSize );
+    if ( RCt == 0 ) {
+
+        if ( BufSize != 0 ) {
+
+            Buf = ( char * ) calloc ( BufSize + 1, sizeof ( char ) );
+            if ( Buf == NULL ) {
+                RCt = RC ( rcExe, rcFile, rcAllocating, rcParam, rcNull );
+            }
+            else {
+                RCt = KFileReadExactly ( File, 0, Buf, BufSize );
+                if ( RCt == 0 ) {
+                    * ( Buf + BufSize ) = 0;
+                    * RetBuffer = Buf;
+                    * RetSize = BufSize;
+                }
+                else {
+                    free ( Buf );
+                    RCt = RC ( rcExe, rcFile, rcReading, rcParam, rcFailed );
+                    Buf = NULL;
+                    BufSize = 0;
+                }
+            }
+        }
+        else {
+            RCt = RC ( rcExe, rcFile, rcReading, rcParam, rcEmpty );
+        }
+    }
+
+    return RCt;
+}   /* _ReadKFileToMemory () */
+
+/*)))
+ ///  We need that method because KXML does not read document properly
+ \\\  from KFile over HTTP
+ ///
+(((*/
+rc_t CC
+ReadHttpFileToMemory (
+                    const char * Url,
+                    char ** RetBuffer,
+                    uint64_t * RetSize
+)
+{
+    rc_t RCt;
+    const KFile * File;
+
+    RCt = 0;
+    File = NULL;
+
+    if ( Url == NULL || RetBuffer == NULL || RetSize == NULL ) {
+        return RC ( rcExe, rcFile, rcReading, rcParam, rcNull );
+    }
+
+    RCt = KNSManagerMakeHttpFile (
+                                _ManagerOfKNS,
+                                & File,
+                                NULL,   /* no open connections */
+                                0x01010000,
+                                Url
+                                );
+    if ( RCt == 0 ) {
+        RCt = _ReadKFileToMemory ( File, RetBuffer, RetSize );
+
+        ReleaseComplain ( KFileRelease, File );
+    }
+
+    return RCt;
+}   /* ReadHttpFileToMemory () */
+
+/*)))
+ ///  We need that method because KXML does not read document properly
+ \\\  from KFile over HTTP
+ ///
+(((*/
+rc_t CC
+ReadLocalFileToMemory (
+                    const char * FileName,
+                    char ** RetBuffer,
+                    uint64_t * RetSize
+)
+{
+    rc_t RCt;
+    KDirectory * NativeDir;
+    const KFile * File;
+
+    RCt = 0;
+    NativeDir = NULL;
+    File = NULL;
+
+    RCt = KDirectoryNativeDir ( & NativeDir );
+    if ( RCt == 0 ) {
+
+        RCt = KDirectoryOpenFileRead ( NativeDir, & File, FileName );
+        if ( RCt == 0 ) {
+
+            RCt = _ReadKFileToMemory ( File, RetBuffer, RetSize );
+
+            KFileRelease ( File );
+        }
+
+        KDirectoryRelease ( NativeDir );
+    }
+
+    return RCt;
+}   /* ReadLocalFileToMemory () */
+
+rc_t CC
+ExecuteCGI ( const char * CGICommand )
+{
+    rc_t RCt;
+    const KFile * File;
+    uint64_t FileSize, ToRead, Pos;
+    char Buffer [ 4096 ];
+    size_t NumRead, BSize;
+
+    RCt = 0;
+    File = NULL;
+    FileSize = ToRead = Pos = 0;
+    NumRead = 0;
+    BSize = sizeof ( Buffer );
+
+    if ( CGICommand == NULL ) {
+        return RC ( rcExe, rcFile, rcReading, rcParam, rcNull );
+    }
+
+    RCt = KNSManagerMakeHttpFile (
+                                _ManagerOfKNS,
+                                & File,
+                                NULL,   /* no open connections */
+                                0x01010000,
+                                CGICommand
+                                );
+    if ( RCt == 0 ) {
+        RCt = KFileSize ( File, & FileSize );
+        if ( RCt == 0 ) {
+            Pos = 0;
+            NumRead = 0;
+
+            while ( 0 <= FileSize ) {
+                ToRead = FileSize < BSize ? FileSize : BSize ;
+                RCt = KFileRead (
+                                File,
+                                Pos,
+                                Buffer,
+                                BSize,
+                                & NumRead
+                                );
+                if ( RCt != 0 ) {
+                    break;
+                }
+
+                Pos += NumRead;
+                FileSize -= NumRead;
+            }
+        }
+
+        ReleaseComplain ( KFileRelease, File );
+    }
+
+    return RCt;
+}   /* ExecuteCGI () */
diff --git a/tools/fuse/remote-cache.h b/tools/fuse/remote-cache.h
new file mode 100644
index 0000000..66fbe30
--- /dev/null
+++ b/tools/fuse/remote-cache.h
@@ -0,0 +1,169 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#ifndef _h_remote_cache_fuser_
+#define _h_remote_cache_fuser_
+
+/*
+ * Lyrics ... because quite exotic requirements of remote file access
+ * which means that we are accessing only files which will be described
+ * in XML file, there are several propositions which were made:
+ *   1) if there -x parameter to fuser contains URL path, we suppose
+ *      that fuser is working in REMOTE MODE
+ *   2) REMOTE MODE required parameter cache directory, and all files
+ *      will be accessed as CACHEDTEE files.
+ *   3) the XML document, which describes filesystem will contain only
+ *      these entries: Directory, File and another XML document.
+ *   4) cached files are valid only on session time, or at the time
+ *      while fuser is working. That means that each time when fuser
+ *      started, it removes all cached files, if those left from
+ *      previous session.
+ *   5) There could be two types of files: plain files and XML
+ *      documents, which represents filesystem node. Files are stored
+ *      in cache directory, and XML documents are loaded and interpreted
+ *      imediately
+ *   6) IMPORTANT: we are not going to initialize and start thread for
+ *      SRA_List, as for checking and updating XML_root document thread
+ *   8) I beleive that it could me much easiest way to write designated
+ *      application for accessing remote files, however, client wants
+ *      it as fuser extention
+ */
+
+/*)))
+ ///   MALICIOUS CODE ON
+(((*/
+
+/*))
+ //  That method will check if path is remote ... starts from "http"
+((*/
+bool CC IsRemotePath ( const char * Path );
+
+/*))
+ //  That method will check if path is local ... exists
+((*/
+bool CC IsLocalPath ( const char * Path );
+
+    /*)))
+     ///  Remote cache initialisation and so on
+    (((*/
+/* Lyrics:
+ * We consider that cache is a directory in local filesystem, which
+ * fully defined by it's path. The content of directory is valid only
+ * for session period, from the time of Cache Initialize to Finalize
+ * Once new session is started, the content of cache left from previous
+ * session is dropped. 
+ * For a moment we do beleive that we do have only one cache directory
+ * per session, which could be initialized only once
+ * UPDATE: from now we allow non-cacheing or diskless mode. In that case
+ *         fuzer will not create any additional files or directories and
+ *         will not use cachetee file, but direct HTTP connection 
+ */
+
+/* That structure will represent CacheFile
+ */
+struct RCacheEntry;
+
+    /*))
+     //  Three methods to work with CacheEntry
+    ((*/
+rc_t CC RCacheEntryAddRef ( struct RCacheEntry * self );
+rc_t CC RCacheEntryRelease ( struct RCacheEntry * self );
+rc_t CC RCacheEntryRead (
+                    struct RCacheEntry * self,
+                    char * Buffer,
+                    size_t BufferSize,
+                    uint64_t Offset,
+                    size_t * NumRead
+                    );
+    /*))
+     //  This method will set block size for HTTP transport
+     \\  If user want to use default block size value, 0 should
+     //  be used. Will return previous value for block size
+    ((*/
+uint32_t CC RemoteCacheSetHttpBlockSize ( uint32_t HttpBlockSize );
+
+    /*))
+     //  This method will set path for local cache dir
+     \\
+     //  NOTE: CachePath could be NULL, then it is diskless mode
+    ((*/
+rc_t CC RemoteCacheInitialize ( const char * CachePath );
+    /*))
+     //  This method will initialize local cache dir:
+     \\    It will create cache directory if it does not exist
+     //    It will remove all leftovers from previous session
+    ((*/
+rc_t CC RemoteCacheCreate ();
+    /*))
+     //  This method will finalise cache and destroy it's content
+    ((*/
+rc_t CC RemoteCacheDispose ();
+
+    /*))
+     //  Misc methods
+    ((*/
+const char * RemoteCachePath ();
+
+bool RemoteCacheIsDisklessMode ();
+
+rc_t CC RemoteCacheFindOrCreateEntry (
+                        const char * Url,
+                        struct RCacheEntry ** Entry
+                    );
+
+
+    /*))
+     //  Found that interesting
+    ((*/
+rc_t CC ReadHttpFileToMemory (
+                            const char * Url,
+                            char ** RetBuffer,
+                            uint64_t * RetSize
+                            );
+
+rc_t CC ReadLocalFileToMemory (
+                            const char * FileName,
+                            char ** RetBuffer,
+                            uint64_t * RetSize
+                            );
+
+rc_t CC ExecuteCGI ( const char * CGICommand );
+
+/*)))
+ ///  Shamefull macro
+(((*/
+ #define RM_DEAF_LGO
+
+ #ifdef RM_DEAF_LGO
+ #define RmOutMsg  KOutMsg
+ #else /* RM_DEAF_LGO */
+ #define RmOutMsg(...)
+ #endif /* RM_DEAF_LGO */
+
+/*)))
+ ///   MALICIOUS CODE OFF
+(((*/
+
+#endif /* _h_remote_cache_fuser_ */
diff --git a/tools/fuse/remote-directory.c b/tools/fuse/remote-directory.c
new file mode 100644
index 0000000..aeb1f57
--- /dev/null
+++ b/tools/fuse/remote-directory.c
@@ -0,0 +1,411 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#include <klib/namelist.h>
+#include <klib/printf.h>
+#include <kxml/xml.h>
+#include <klib/container.h>
+#include <kfs/directory.h>
+#include <kfs/file.h>
+#include <kproc/lock.h>
+
+typedef struct DirectoryNode DirectoryNode;
+#define FSNODE_IMPL DirectoryNode
+
+#include "log.h"
+#include "xml.h"
+#include "remote-directory.h"
+#include "kfile-accessor.h"
+
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <time.h>
+
+typedef struct DirNodeChild_struct {
+    BSTNode node;
+    const char* full_name; /* full path to detected file */
+    const char* name; /* file name only within full_name above */
+    const FSNode* child;
+} DirNodeChild;
+
+
+static
+int DirNodeChild_FindByName(const void *item, const BSTNode *node)
+{
+    return strcmp((const char*)item, ((const DirNodeChild*)node)->child->name);
+}
+
+static
+void DirNodeChild_Whack(BSTNode *node, void *data)
+{
+    DirNodeChild* n = (DirNodeChild*)node;
+
+    if( n != NULL ) {
+        DEBUG_LINE(8, "Releasing auto TAR %s", n->child->name);
+        FSNode_Release(n->child);
+        FREE(n);
+    }
+}
+
+struct DirectoryNode {
+    FSNode node;
+    char* path;
+    KTime_t mtime;
+    KRWLock* lock;
+    KTime_t timestamp;
+    /* list of physical files and dirs in 'path' minus those in children list */
+    KNamelist* ls; 
+    BSTree children;
+};
+
+struct DirNodeChild_List_Data {
+    rc_t rc;
+    const DirectoryNode* cself;
+    FSNode_Dir_Visit func;
+    void* data;
+};
+
+static
+bool DirNodeChild_List( BSTNode *node, void *data )
+{
+    DirNodeChild* n = (DirNodeChild*)node;
+    struct DirNodeChild_List_Data* d = (struct DirNodeChild_List_Data*)data;
+    const FSNode* ch;
+    bool hidden = true;
+
+    if( ((d->rc = FSNode_FindChild(&d->cself->node, n->child->name, strlen(n->child->name), &ch, &hidden)) == 0 && hidden) ||
+         (GetRCObject(d->rc) == rcName && GetRCState(d->rc) == rcNotFound) ) {
+        d->rc = d->func(n->child->name, d->data);
+    }
+    return d->rc != 0;
+}
+
+static
+rc_t DirectoryNode_Lock(const DirectoryNode* cself, bool exclusive)
+{
+    DEBUG_LINE(8, "Lock DirectoryNode %s %s", cself->path, exclusive ? "write" : "read");
+    return exclusive ? KRWLockAcquireExcl(((DirectoryNode*)cself)->lock) : KRWLockAcquireShared(((DirectoryNode*)cself)->lock);
+}
+
+static
+rc_t DirectoryNode_Unlock(const DirectoryNode* cself)
+{
+    DEBUG_LINE(8, "Unlocking DirectoryNode %s", cself->path);
+    return KRWLockUnlock(((DirectoryNode*)cself)->lock);
+}
+
+static
+rc_t DirectoryNode_IsChild(const DirectoryNode* cself, const char* subpath, const FSNode** node,
+                           int (*finder)(const void *item, const BSTNode *node))
+{
+    DirNodeChild* n = (DirNodeChild*)BSTreeFind(&cself->children, subpath, finder);
+    if( n != NULL ) {
+        *node = n->child;
+    } else {
+        *node = NULL;
+        return RC(rcExe, rcFile, rcAccessing, rcName, rcNotFound);
+    }
+    return 0;
+}
+
+static
+rc_t DirectoryNode_Attr(const DirectoryNode* cself, const char* subpath, uint32_t* type, KTime_t* ts, uint64_t* file_sz, uint32_t* access, uint64_t* block_sz)
+{
+    rc_t rc = 0;
+
+    *type = kptDir;
+    if( cself->path != NULL ) {
+        KDirectory* dir = NULL;
+        const KDirectory* sub = NULL;
+
+        if( subpath != NULL && (rc = DirectoryNode_Lock(cself, false)) == 0 ) {
+            const FSNode* child = NULL;
+            if( (rc = DirectoryNode_IsChild(cself, subpath, &child, DirNodeChild_FindByName)) == 0 ) {
+                rc = FSNode_Attr(child, NULL, type, ts, file_sz, access, block_sz);
+            }
+            ReleaseComplain(DirectoryNode_Unlock, cself);
+            if( child != NULL ) {
+                return rc;
+            }
+        }
+        if( (rc = KDirectoryNativeDir(&dir)) == 0 &&
+            (rc = KDirectoryOpenDirRead(dir, &sub, true, "%s", cself->path)) == 0 ) {
+            const char* path = subpath ? subpath : ".";
+            DEBUG_LINE(8, "Using full name %s/%s", cself->path, path);
+            if( (rc = KDirectoryDate(sub, ts, "%s", path)) == 0 ) {
+                *type = KDirectoryPathType(sub, "%s", path);
+                if( *type != kptBadPath && *type != kptNotFound ) {
+                    if( (rc = KDirectoryAccess(sub, access, "%s", path)) == 0 ) {
+                        if( *type & kptAlias ) {
+                            bool children;
+                            if( (rc = FSNode_HasChildren(&cself->node, &children)) == 0 ) {
+                                /* if it is pointer to an aliased directory and has no XML children than pass symlink on */
+                                if( children == false || subpath != NULL ) {
+                                    char r[4096];
+                                    if( (rc = KDirectoryResolveAlias(sub, true, r, sizeof(r), "%s", path)) == 0 ) {
+                                         DEBUG_LINE(8, "Symlink name %s", r);
+                                        *file_sz = strlen(r);
+                                    }
+                                } else {
+                                    /* otherwise remove alias bit */
+                                    *type = *type & ~kptAlias;
+                                }
+                            }
+                        } else if( *type == kptFile ) {
+                            rc = KDirectoryFileSize(sub, file_sz, "%s", path);
+                        }
+                    }
+                }
+            }
+        }
+        ReleaseComplain(KDirectoryRelease, sub);
+        ReleaseComplain(KDirectoryRelease, dir);
+    } else if( subpath != NULL ) {
+        rc = RC(rcExe, rcDirectory, rcEvaluating, rcDirEntry, rcNotFound);
+    }
+    if( subpath == NULL && cself->mtime != 0 ) {
+        *ts = cself->mtime;
+    }
+    return rc;
+}
+
+struct DirectoryNode_DirVisit_Data {
+    FSNode_Dir_Visit func;
+    void* data;
+};
+
+static
+rc_t CC DirectoryNode_DirVisit( const KDirectory *dir, uint32_t type, const char *name, void *data )
+{
+    struct DirectoryNode_DirVisit_Data* d = (struct DirectoryNode_DirVisit_Data*)data;
+    return d->func(name, d->data);
+}
+
+static
+rc_t DirectoryNode_Dir(const DirectoryNode* cself, const char* subpath, FSNode_Dir_Visit func, void* data)
+{
+    rc_t rc = 0;
+
+    if( subpath == NULL ) {
+        /* add XML tree children */
+        if( (rc = FSNode_ListChildren(&cself->node, func, data)) == 0 ) {
+            if( (rc = DirectoryNode_Lock(cself, false)) == 0 ) {
+                if( cself->ls != NULL ) {
+                    /* add ls result excluding XML children */
+                    uint32_t i = 0, count = 0;
+                    rc = KNamelistCount(cself->ls, &count);
+                    while(rc == 0 && i < count) {
+                        const char* nm = NULL;
+                        const FSNode* ch;
+                        bool hidden = true;
+                        if( (rc = KNamelistGet(cself->ls, i++, &nm)) == 0 &&
+                            (((rc = FSNode_FindChild(&cself->node, nm, strlen(nm), &ch, &hidden)) == 0 && hidden) ||
+                             (GetRCObject(rc) == rcName && GetRCState(rc) == rcNotFound)) ) {
+                            rc = func(nm, data);
+                        }
+                    }
+                }
+                if( rc == 0 ) {
+                    struct DirNodeChild_List_Data d;
+                    d.rc = 0;
+                    d.cself = cself;
+                    d.func = func;
+                    d.data = data;
+                    /* add detected child nodes excluding XML children */
+                    BSTreeDoUntil(&cself->children, false, DirNodeChild_List, &d);
+                    rc = d.rc;
+                }
+                ReleaseComplain(DirectoryNode_Unlock, cself);
+            }
+        }
+    } else {
+        KDirectory* dir = NULL;
+        if( (rc = KDirectoryNativeDir(&dir)) == 0 ) {
+            struct DirectoryNode_DirVisit_Data d;
+            d.func = func;
+            d.data = data;
+            DEBUG_LINE(8, "Listing kdir path %s/%s", cself->path, subpath);
+            rc = KDirectoryVisit(dir, false, DirectoryNode_DirVisit, &d, "%s/%s", cself->path, subpath);
+            ReleaseComplain(KDirectoryRelease, dir);
+        }
+    }
+    return rc;
+}
+
+
+static
+rc_t DirectoryNode_Open(const DirectoryNode* cself, const char* subpath, const SAccessor** accessor)
+{
+    rc_t rc = 0;
+
+    if( subpath == NULL ) {
+        rc = RC(rcExe, rcFile, rcOpening, rcDirEntry, rcNotFound);
+    } else {
+        const char* nm = NULL;
+
+        if( (rc = DirectoryNode_Lock(cself, false)) == 0 ) {
+            const FSNode* child = NULL;
+            if( (rc = DirectoryNode_IsChild(cself, subpath, &child, DirNodeChild_FindByName)) == 0 ) {
+                rc = FSNode_Open(child, NULL, accessor);
+            }
+            ReleaseComplain(DirectoryNode_Unlock, cself);
+            if( child != NULL ) {
+                return rc;
+            }
+        }
+        if( (rc = FSNode_GetName(&cself->node, &nm)) == 0 ) {
+            KDirectory* dir = NULL;
+            if( (rc = KDirectoryNativeDir(&dir)) == 0 ) {
+                const KFile* kf = NULL;
+                if( (rc = KDirectoryOpenFileRead(dir, &kf, "%s/%s", cself->path, subpath)) == 0 ) {
+                    if( (rc = KFileAccessor_Make(accessor, nm, kf)) != 0 ) {
+                        ReleaseComplain(KFileRelease, kf);
+                    }
+                }
+                ReleaseComplain(KDirectoryRelease, dir);
+            }
+        }
+    }
+    if( rc != 0 ) {
+        SAccessor_Release(*accessor);
+        *accessor = NULL;
+    }
+    return rc;
+}
+
+static
+rc_t DirectoryNode_Release(DirectoryNode* self)
+{
+    rc_t rc = 0;
+    if( self != NULL ) {
+        BSTreeWhack(&self->children, DirNodeChild_Whack, NULL);
+        ReleaseComplain(KRWLockRelease, self->lock);
+        ReleaseComplain(KNamelistRelease, self->ls);
+        FREE(self->path);
+    }
+    return rc;
+}
+
+static FSNode_vtbl DirectoryNode_vtbl = {
+    sizeof(DirectoryNode),
+    NULL,
+    NULL,
+    DirectoryNode_Attr,
+    DirectoryNode_Dir,
+    NULL,
+    DirectoryNode_Open,
+    DirectoryNode_Release
+};
+
+
+rc_t RemoteDirectoryNode_Make(const KXMLNode* xml_node, FSNode** cself, char* errmsg, const char* rel_path, KTime_t dflt_ktm)
+{
+    rc_t rc = 0;
+
+    if( xml_node == NULL || cself == NULL ) {
+        rc = RC(rcExe, rcDirectory, rcConstructing, rcParam, rcNull);
+    } else {
+        char* path = NULL, *name = NULL, name_buf[4096];
+        KTime_t ktm = 0;
+        DirectoryNode* ff = NULL;
+
+        if( (rc = KXMLNodeReadAttrCStr(xml_node, "path", &path, NULL)) == 0 ) {
+            if( path[0] != '\0' ) {
+                rc = RC(rcExe, rcDoc, rcValidating, rcDirEntry, rcInvalid);
+            }
+            FREE(path);
+            path = NULL;
+        } else if( GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound ) {
+            rc = 0;
+        }
+        if( rc != 0 ) {
+            strcpy(errmsg, "Directory/@path: '");
+            strcat(errmsg, path ? path : "(null)");
+            strcat(errmsg, "'");
+        }
+        if( rc == 0 ) {
+            size_t sz;
+            rc = KXMLNodeReadAttrCString(xml_node, "name", name_buf, sizeof(name_buf), &sz);
+            if( rc == 0 && name_buf[0] != '\0' ) {
+                name = name_buf;
+            } else if( (GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound)  ) {
+                rc = 0;
+            }
+            if( rc != 0 ) {
+                strcpy(errmsg, "Directory/@name");
+            } else if( name == NULL ) {
+                if( path == NULL ) {
+                    rc = RC(rcExe, rcDoc, rcValidating, rcDirEntry, rcInvalid);
+                } else {
+                    name = strrchr(path, '/');
+                    name = name ? name + 1 : path;
+                }
+            }
+        }
+        if( rc == 0 && (rc = XML_ParseTimestamp(xml_node, "timestamp", &ktm, true)) != 0 ) {
+            strcpy(errmsg, "Directory/@timestamp");
+        }
+        if( rc == 0 ) {
+            struct KNamelist const* attr = NULL;
+            if( (rc = KXMLNodeListAttr(xml_node, &attr)) == 0 ) {
+                uint32_t i = 0, count = 0;
+                if( (rc = KNamelistCount(attr, &count)) == 0 && count > 0 ) {
+                    while( rc == 0 && i < count ) {
+                        const char *attr_nm = NULL;
+                        if( (rc = KNamelistGet(attr, i++, &attr_nm)) != 0 ) {
+                            break;
+                        }
+                        if( strcmp("name", attr_nm) == 0 || strcmp("timestamp", attr_nm) == 0 ) {
+                            continue;
+                        }
+                        rc = RC(rcExe, rcDoc, rcValidating, rcDirEntry, rcInvalid);
+                        strcpy(errmsg, "unknown attribute Directory/@");
+                        strcat(errmsg, attr_nm);
+                    }
+                }
+                ReleaseComplain(KNamelistRelease, attr);
+            }
+        }
+        if( rc == 0 ) {
+            if( (rc = FSNode_Make((FSNode**)&ff, name, &DirectoryNode_vtbl)) == 0 &&
+                (rc = KRWLockMake(&ff->lock)) == 0 ) {
+                ff->path = path;
+                ff->mtime = ktm != 0 ? ktm : (path ? 0 : dflt_ktm);
+                BSTreeInit(&ff->children);
+            } else {
+                strcpy(errmsg, "Directory '");
+                strcat(errmsg, name);
+                strcat(errmsg, "'");
+            }
+        }
+        if( rc == 0 ) {
+            *cself = &ff->node;
+        } else {
+            FREE(path);
+        }
+    }
+    return rc;
+}   /* RemoteDirectoryNode_Make () */
diff --git a/tools/fuse/remote-directory.h b/tools/fuse/remote-directory.h
new file mode 100644
index 0000000..bfa0e27
--- /dev/null
+++ b/tools/fuse/remote-directory.h
@@ -0,0 +1,33 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#ifndef _h_sra_fuse_directory_
+#define _h_sra_fuse_directory_
+
+#include "node.h"
+
+rc_t RemoteDirectoryNode_Make(const KXMLNode* xml_node, FSNode** cself, char* errmsg, const char* rel_path, KTime_t ts);
+
+#endif /* _h_sra_fuse_directory_ */
diff --git a/tools/fuse/remote-file.c b/tools/fuse/remote-file.c
new file mode 100644
index 0000000..3a50776
--- /dev/null
+++ b/tools/fuse/remote-file.c
@@ -0,0 +1,300 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#include <klib/namelist.h>
+#include <klib/printf.h>
+#include <kxml/xml.h>
+#include <kfs/directory.h>
+#include <kfs/file.h>
+#include <krypto/encfile.h>
+
+typedef struct RemoteFileNode RemoteFileNode;
+#define FSNODE_IMPL RemoteFileNode
+
+#include "log.h"
+#include "xml.h"
+#include "remote-file.h"
+#include "remote-cache.h"
+#include "kfile-accessor.h"
+
+#include <string.h>
+#include <stdlib.h>
+#include <time.h>
+
+rc_t RemoteFileAccessor_Make(const SAccessor** accessor, const char* name, struct RCacheEntry * rentry, uint64_t size);
+
+struct RemoteFileNode {
+    FSNode node;
+    char* path;
+    KTime_t mtime;
+    uint64_t file_sz;
+};
+
+static
+rc_t RemoteFileNode_Attr(const RemoteFileNode* cself, const char* subpath, uint32_t* type, KTime_t* ts, uint64_t* file_sz, uint32_t* access, uint64_t* block_sz)
+{
+    rc_t rc = 0;
+
+    if( subpath != NULL ) {
+        rc = RC(rcExe, rcFile, rcEvaluating, rcDirEntry, rcNotFound);
+    } else {
+            /* Here we are: all attributes from XML */
+        * type = kptFile;
+        * ts = cself -> mtime;
+        * file_sz = cself -> file_sz; 
+        * access = 0444;
+        * block_sz = ( 32 * 1024 ); /* <<-- Sorry, I borrowed that
+                                     * value from KCacheTeeFile
+                                     */
+    }
+
+    return rc;
+}
+
+static
+rc_t RemoteFileNode_Open(
+                    const RemoteFileNode* cself,
+                    const char* subpath,
+                    const SAccessor** accessor
+)
+{
+    rc_t rc = 0;
+
+    if( subpath != NULL ) {
+        rc = RC(rcExe, rcFile, rcOpening, rcDirEntry, rcNotFound);
+    } else {
+        struct RCacheEntry * ke = NULL;
+        if ( ( rc = RemoteCacheFindOrCreateEntry( cself->path, &ke )) == 0 ) {
+            if( rc == 0 ) {
+                if ( ( rc = RemoteFileAccessor_Make(
+                                                accessor,
+                                                cself->node.name,
+                                                ke,
+                                                cself->file_sz
+                                                ) ) != 0 ) {
+                    ReleaseComplain(RCacheEntryRelease, ke);
+                }
+            }
+            
+        }
+    }
+    if( rc != 0 ) {
+        SAccessor_Release(*accessor);
+        *accessor = NULL;
+    }
+    return rc;
+}
+
+static
+rc_t RemoteFileNode_Release(RemoteFileNode* self)
+{
+    if( self != NULL ) {
+        FREE(self->path);
+    }
+    return 0;
+}
+
+static FSNode_vtbl RemoteFileNode_vtbl = {
+    sizeof(RemoteFileNode),
+    NULL,
+    NULL,
+    RemoteFileNode_Attr,
+    NULL,
+    NULL,   /* Unlike FileNode, there are no links */
+    RemoteFileNode_Open,
+    RemoteFileNode_Release
+};
+
+rc_t RemoteFileNode_Make(const KXMLNode* xml_node, FSNode** cself, char* errmsg, const char* rel_path)
+{
+    rc_t rc = 0;
+
+    if( xml_node == NULL || cself == NULL || errmsg == NULL || rel_path == NULL ) {
+        rc = RC(rcExe, rcNode, rcConstructing, rcParam, rcNull);
+    } else {
+        char* path = NULL, *name = NULL, name_buf[4096];
+        KTime_t ktm = 0;
+        uint64_t fsz = 0;
+        RemoteFileNode* ff = NULL;
+        size_t attribute_sz = 0;
+
+        if( (rc = KXMLNodeReadAttrCStr(xml_node, "path", &path, NULL)) == 0 ) {
+            if( path[0] == '\0' ) {
+                rc = RC(rcExe, rcDoc, rcValidating, rcDirEntry, rcInvalid);
+            } else {
+                /* NOTE: we do not check path for existence */
+                if ( ! IsRemotePath ( path ) ) {
+                    rc = RC(rcExe, rcDoc, rcValidating, rcDirEntry, rcInvalid);
+                }
+            }
+        }
+        if( rc != 0 ) {
+            strcpy(errmsg, "File/@path: '");
+            strcat(errmsg, path ? path : "(null)");
+            strcat(errmsg, "'");
+        }
+        if( rc == 0 ) {
+            rc = KXMLNodeReadAttrCString(xml_node, "name", name_buf, sizeof(name_buf), &attribute_sz);
+            if( rc == 0 && name_buf[0] != '\0' ) {
+                name = name_buf;
+            } else if( GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound ) {
+                rc = 0;
+            }
+            if( rc != 0 ) {
+                strcpy(errmsg, "File/@name");
+            } else if( name == NULL ) {
+                name = strrchr(path, '/');
+                name = name ? name + 1 : path;
+            }
+        }
+        if( rc == 0 && (rc = KXMLNodeReadAttrAsU64(xml_node, "size", &fsz)) != 0 ) {
+            strcpy(errmsg, "File/@size");
+        }
+/* Attributes "size" and "timestamp" are mandatory */
+        if ( fsz <= 0 ) {
+            strcpy(errmsg, "File/@size");
+            rc = RC(rcExe, rcDoc, rcValidating, rcDirEntry, rcInvalid);
+        }
+        if( rc == 0 && (rc = XML_ParseTimestamp(xml_node, "timestamp", &ktm, true)) != 0 ) {
+            strcpy(errmsg, "File/@timestamp");
+        }
+        if ( ktm == 0 ) {
+            strcpy(errmsg, "File/@timestamp");
+            rc = RC(rcExe, rcDoc, rcValidating, rcDirEntry, rcInvalid);
+        }
+/* Attributes "size" and "timestamp" are mandatory */
+        if( rc == 0 ) {
+            struct KNamelist const* attr = NULL;
+            if( (rc = KXMLNodeListAttr(xml_node, &attr)) == 0 ) {
+                uint32_t i = 0, count = 0;
+                if( (rc = KNamelistCount(attr, &count)) == 0 && count > 0 ) {
+                    while( rc == 0 && i < count ) {
+                        const char *attr_nm = NULL;
+                        if( (rc = KNamelistGet(attr, i++, &attr_nm)) != 0 ) {
+                            break;
+                        }
+                        if( strcmp("path", attr_nm) == 0
+                            || strcmp("name", attr_nm) == 0
+                            || strcmp("timestamp", attr_nm) == 0
+                            || strcmp("size", attr_nm) == 0 ) {
+                            continue;
+                        }
+                        rc = RC(rcExe, rcDoc, rcValidating, rcDirEntry, rcInvalid);
+                        strcpy(errmsg, "unknown attribute File/@");
+                        strcat(errmsg, attr_nm);
+                    }
+                }
+                ReleaseComplain(KNamelistRelease, attr);
+            }
+        }
+        if( rc == 0 ) {
+            if( (rc = FSNode_Make((FSNode**)&ff, name, &RemoteFileNode_vtbl)) == 0 ) {
+                ff->path = path;
+                ff->mtime = ktm;
+                ff->file_sz = fsz;
+            } else {
+                strcpy(errmsg, "File '");
+                strcat(errmsg, name);
+                strcat(errmsg, "'");
+            }
+        }
+        if( rc == 0 ) {
+            *cself = &ff->node;
+        } else {
+            FREE(path);
+        }
+    }
+    return rc;
+}
+
+/*)))
+ ///  Remote file accessor. Read behaviour differs from plain file
+(((*/
+
+typedef struct RemoteFileAccessor_struct {
+    struct RCacheEntry* rentry;
+    uint64_t size;
+} RemoteFileAccessor;
+
+static
+rc_t RemoteFileAccessor_Read(const SAccessor* cself, char* buf, size_t size, off_t offset, size_t* num_read)
+{
+    rc_t rc = 0;
+    RemoteFileAccessor* self = (RemoteFileAccessor*)cself;
+    size_t actual = 0;
+    uint64_t actual_file_sz = self -> size;
+
+        /* Here we are truncating size if it is needed */
+    if ( actual_file_sz < offset + size ) {
+        size = actual_file_sz - offset;
+    }
+    do {
+        rc = RCacheEntryRead (
+                    self -> rentry,
+                    &buf[*num_read],
+                    size - * num_read,
+                    offset + * num_read,
+                    &actual
+                    );
+        if( rc == 0 && actual == 0 ) {
+            /* EOF */
+            break;
+        }
+        *num_read += actual;
+    } while(rc == 0 && *num_read < size);
+    DEBUG_MSG(10, ("From %lu read %lu bytes\n", offset, *num_read));
+
+    return rc;
+}
+
+static
+rc_t RemoteFileAccessor_Release(const SAccessor* cself)
+{
+    rc_t rc = 0;
+    if( cself != NULL ) {
+        RemoteFileAccessor* self = (RemoteFileAccessor*)cself;
+        rc = RCacheEntryRelease(self->rentry);
+    }
+    return rc;
+}
+
+rc_t
+RemoteFileAccessor_Make (
+                    const SAccessor** accessor,
+                    const char* name,
+                    struct RCacheEntry * rentry,
+                    uint64_t size
+)
+{
+    rc_t rc = 0;
+
+    if( (rc = SAccessor_Make(accessor, sizeof(RemoteFileAccessor), name, RemoteFileAccessor_Read, RemoteFileAccessor_Release)) == 0 ) {
+        ((RemoteFileAccessor*)(*accessor))->rentry = rentry;
+        ((RemoteFileAccessor*)(*accessor))->size = size;
+
+        RCacheEntryAddRef ( rentry );
+    }
+    return rc;
+}
diff --git a/tools/fuse/remote-file.h b/tools/fuse/remote-file.h
new file mode 100644
index 0000000..f50a24c
--- /dev/null
+++ b/tools/fuse/remote-file.h
@@ -0,0 +1,33 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#ifndef _h_sra_fuse_remote_file_
+#define _h_sra_fuse_remote_file_
+
+#include "node.h"
+
+rc_t RemoteFileNode_Make(const KXMLNode* xml_node, FSNode** cself, char* errmsg, const char* rel_path);
+
+#endif /* _h_sra_fuse_remote_file_ */
diff --git a/tools/fuse/remote-fuser.c b/tools/fuse/remote-fuser.c
new file mode 100644
index 0000000..c769231
--- /dev/null
+++ b/tools/fuse/remote-fuser.c
@@ -0,0 +1,212 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#include <kapp/args.h>
+#include <klib/out.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "remote-fuser.vers.h"
+#include "log.h"
+#include "node.h"
+#include "accessor.h"
+
+#include "remote-xml.h"
+#include "remote-fuser.h"
+#include "remote-cache.h"
+
+typedef struct SRequest_struct {
+    const FSNode* node;
+    const char* subpath;
+} SRequest;
+
+static char* g_work_dir = NULL;
+
+static
+rc_t SRequestMake(SRequest* request, const char* path, bool recur)
+{
+    rc_t rc = 0;
+
+    if( request == NULL ) {
+        rc = RC(rcExe, rcFileDesc, rcConstructing, rcParam, rcNull);
+    } else {
+        rc = XML_FindLock(path, recur, &request->node, &request->subpath);
+    }
+    return rc;
+}
+
+static
+void SRequestRelease(SRequest* request)
+{
+    if( request != NULL ) {
+        XML_FindRelease();
+    }
+}
+
+rc_t Initialize(unsigned int sra_sync, const char* xml_path, const char* cache_dir, const char* heart_beat_url, unsigned int xml_sync, const char* xml_root, uint32_t block_size)
+{
+    rc_t rc = 0;
+    KDirectory* dir = NULL;
+
+    if( (rc = KDirectoryNativeDir(&dir)) == 0 ) {
+        char buf[4096];
+        if( (rc = KDirectoryResolvePath(dir, true, buf, 4096, xml_root)) == 0 ) {
+            /* replace /. at the end to  just / */
+            if( strcmp(&buf[strlen(buf) - 2], "/.") == 0 ) {
+                buf[strlen(buf) - 1] = '\0';
+            }
+            /* add / to the end if missing */
+            if( buf[strlen(buf) - 1] != '/' ) {
+                buf[strlen(buf) + 1] = '\0';
+                buf[strlen(buf)] = '/';
+            }
+            if( (rc = StrDup(buf, &g_work_dir)) == 0 ) {
+                DEBUG_MSG(8, ("Current directory set to '%s'\n", g_work_dir));
+            }
+        }
+
+        if ( rc == 0 ) {
+            rc = RemoteCacheInitialize ( cache_dir );
+            if ( rc == 0 ) {
+                RemoteCacheSetHttpBlockSize ( block_size );
+
+                if ( IsLocalPath ( xml_path ) ) {
+                    KDirectoryResolvePath(dir, true, buf, 4096, xml_path);
+                    rc = XML_Make(dir, g_work_dir, buf, heart_beat_url, xml_sync);
+                }
+                else {
+                    rc = XML_Make(dir, g_work_dir, xml_path, heart_beat_url, xml_sync);
+                }
+            }
+        }
+        ReleaseComplain(KDirectoryRelease, dir);
+    }
+    return rc;
+}
+
+/* =============================================================================== */
+/* system call handlers */
+/* =============================================================================== */
+
+const char UsageDefaultName[] = "remote-fuser";
+
+rc_t CC UsageSummary (const char* progname)
+{
+    return KOutMsg("Usage:\n"
+        "\t%s [options] -o [FUSE options] -x path -m path\n"
+        "\t%s [options] -u -m path\n\n", progname, progname);
+}
+
+rc_t CC Usage ( const Args * args )
+{
+    /* dummy for newer args system will be filled when system is complete!!! */
+    return 0;
+}
+
+uint32_t KAppVersion(void)
+{
+    return REMOTE_FUSER_VERS;
+}
+
+void SRA_FUSER_Init(void)
+{
+    rc_t rc = 0;
+    /* reopen log file and start watch thread(s) */
+    if( (rc = LogFile_Init(NULL, 0, true, NULL)) != 0 ) {
+        LOGERR(klogErr, rc, "log file");
+    }
+    XML_Init();
+    LOGMSG(klogInfo, "Started");
+}
+
+void SRA_FUSER_Fini(void)
+{
+    XML_Fini();
+    LOGMSG(klogInfo, "Stopped");
+    LogFile_Fini();
+    FREE(g_work_dir);
+}
+
+rc_t SRA_FUSER_GetDir(const char* path, FSNode_Dir_Visit func, void* data)
+{
+    rc_t rc = 0;
+    SRequest request;
+
+    if( (rc = SRequestMake(&request, path, true)) == 0 ) {
+        rc = FSNode_Dir(request.node, request.subpath, func, data);
+        SRequestRelease(&request);
+    }
+    return rc;
+}
+
+rc_t SRA_FUSER_GetAttr(const char* path, uint32_t* type, KTime_t* ts, uint64_t* file_sz, uint32_t* access, uint64_t* block_sz)
+{
+    rc_t rc = 0;
+    SRequest request;
+
+    if( (rc = SRequestMake(&request, path, false)) == 0 ) {
+        rc = FSNode_Attr(request.node, request.subpath, type, ts, file_sz, access, block_sz);
+        SRequestRelease(&request);
+    }
+    return rc;
+}
+
+rc_t SRA_FUSER_ResolveLink(const char* path, char* buf, size_t buf_sz)
+{
+    rc_t rc = 0;
+    SRequest request;
+
+    if( (rc = SRequestMake(&request, path, false)) == 0 ) {
+        rc = FSNode_Link(request.node, request.subpath, buf, buf_sz);
+        SRequestRelease(&request);
+    }
+    return rc;
+}
+
+rc_t SRA_FUSER_OpenNode(const char* path, const void** data)
+{
+    rc_t rc = 0;
+    SRequest request;
+
+    if( (rc = SRequestMake(&request, path, false)) == 0 ) {
+        rc = FSNode_Open(request.node, request.subpath, (const SAccessor**)data);
+        SRequestRelease(&request);
+    }
+    return rc;
+}
+
+rc_t SRA_FUSER_ReadNode(const char* path, const void* data, char *buf, size_t size, off_t offset, size_t* num_read)
+{
+    return SAccessor_Read(data, buf, size, offset, num_read);
+}
+
+rc_t SRA_FUSER_CloseNode(const char* path, const void* data)
+{
+/*
+RmOutMsg (")_)_)_)_)__)_) SRA_FUSER_CloseNode\n" );
+*/
+    return SAccessor_Release(data);
+}
diff --git a/tools/fuse/remote-fuser.h b/tools/fuse/remote-fuser.h
new file mode 100644
index 0000000..80badaf
--- /dev/null
+++ b/tools/fuse/remote-fuser.h
@@ -0,0 +1,52 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#ifndef _h_sra_fuse_fuser_
+#define _h_sra_fuse_fuser_
+
+#include "node.h"
+
+uint32_t KAppVersion(void);
+
+/* TBH added cache_dir parameter, and xml_root, and block_size */
+rc_t Initialize(unsigned int sra_sync, const char* xml_path,
+                const char* cache_dir, const char* heart_beat_url,
+                unsigned int xml_sync, const char* xml_root,
+                uint32_t block_size);
+/* TBN */
+
+/* FUSE call backs */
+void SRA_FUSER_Init(void);
+void SRA_FUSER_Fini(void);
+
+rc_t SRA_FUSER_GetAttr(const char* path, uint32_t* type, KTime_t* date, uint64_t* file_sz, uint32_t* access, uint64_t* block_sz);
+rc_t SRA_FUSER_GetDir(const char* path, FSNode_Dir_Visit func, void* data);
+rc_t SRA_FUSER_ResolveLink(const char* path, char* buf, size_t buf_sz);
+
+rc_t SRA_FUSER_OpenNode(const char* path, const void** data);
+rc_t SRA_FUSER_ReadNode(const char* path, const void* data, char *buf, size_t size, off_t offset, size_t* num_read);
+rc_t SRA_FUSER_CloseNode(const char* path, const void* data);
+
+#endif /* _h_sra_fuse_fuser_ */
diff --git a/tools/fuse/remote-fuser.vers b/tools/fuse/remote-fuser.vers
new file mode 100644
index 0000000..8e8299d
--- /dev/null
+++ b/tools/fuse/remote-fuser.vers
@@ -0,0 +1 @@
+2.4.2
diff --git a/tools/fuse/remote-link.c b/tools/fuse/remote-link.c
new file mode 100644
index 0000000..4354627
--- /dev/null
+++ b/tools/fuse/remote-link.c
@@ -0,0 +1,208 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#include <klib/namelist.h>
+#include <klib/printf.h>
+#include <kxml/xml.h>
+#include <kfs/directory.h>
+#include <kfs/file.h>
+#include <krypto/encfile.h>
+
+typedef struct RemoteLinkNode RemoteLinkNode;
+#define FSNODE_IMPL RemoteLinkNode
+
+#include "log.h"
+#include "xml.h"
+#include "remote-link.h"
+#include "remote-cache.h"
+
+#include <string.h>
+#include <stdlib.h>
+#include <time.h>
+
+/**************************************************************
+ * UMBROCHUHVYR
+ * There is some info about links in that application
+ * We suppose that Link is a symbolic link, which have only one
+ * parameter path to the referred node. That path could be :
+ *   absolute - in that case node will be searched from root of
+ *              XML document describing that directory
+ *   relative - in that case node will be searched from current
+ *              link location.
+ **************************************************************/
+
+struct RemoteLinkNode {
+    FSNode node;
+    char* path;
+    KTime_t mtime;
+};
+
+static
+rc_t RemoteLinkNode_Attr(const RemoteLinkNode* cself, const char* subpath, uint32_t* type, KTime_t* ts, uint64_t* file_sz, uint32_t* access, uint64_t* block_sz)
+{
+    rc_t rc = 0;
+
+    if( subpath != NULL ) {
+        rc = RC(rcExe, rcFile, rcEvaluating, rcDirEntry, rcNotFound);
+    } else {
+            /* Here we are: all attributes from XML */
+        * type = kptFile | kptAlias;
+        * ts = cself -> mtime;
+        * file_sz = 5; 
+        * access = 0777;
+        * block_sz = ( 32 * 1024 ); /* <<-- Sorry, I borrowed that
+                                     * value from KCacheTeeFile
+                                     */
+    }
+
+    return rc;
+}
+
+static
+rc_t RemoteLinkNode_Link(
+                    const RemoteLinkNode* cself,
+                    const char* subpath,
+                    char * Buffer,
+                    size_t BufferSize
+)
+{
+    rc_t rc = 0;
+
+    if( subpath != NULL ) {
+        rc = RC(rcExe, rcFile, rcOpening, rcDirEntry, rcNotFound);
+    } else {
+        size_t pathSize = string_measure ( cself -> path, NULL );
+        if ( Buffer == NULL || BufferSize <= pathSize ) {
+            rc = RC(rcExe, rcFile, rcOpening, rcDirEntry, rcInvalid);
+        }
+        else {
+            string_copy ( Buffer, BufferSize, cself -> path, pathSize );
+        }
+    }
+
+    return rc;
+}
+
+static
+rc_t RemoteLinkNode_Release(RemoteLinkNode* self)
+{
+    if( self != NULL ) {
+        FREE(self->path);
+    }
+    return 0;
+}
+
+static FSNode_vtbl RemoteLinkNode_vtbl = {
+    sizeof(RemoteLinkNode),
+    NULL,
+    NULL,
+    RemoteLinkNode_Attr,
+    NULL,
+    RemoteLinkNode_Link,
+    NULL,
+    RemoteLinkNode_Release
+};
+
+rc_t RemoteLinkNode_Make(const KXMLNode* xml_node, FSNode** cself, char* errmsg, const char* rel_path)
+{
+    rc_t rc = 0;
+
+    if( xml_node == NULL || cself == NULL || errmsg == NULL || rel_path == NULL ) {
+        rc = RC(rcExe, rcNode, rcConstructing, rcParam, rcNull);
+    } else {
+        char* path = NULL, *name = NULL, name_buf[4096];
+        KTime_t ktm = 0;
+        RemoteLinkNode* ff = NULL;
+        size_t attribute_sz = 0;
+
+        if( (rc = KXMLNodeReadAttrCStr(xml_node, "path", &path, NULL)) == 0 ) {
+            if( path[0] == '\0' ) {
+                rc = RC(rcExe, rcDoc, rcValidating, rcDirEntry, rcInvalid);
+            }
+        }
+        if( rc != 0 ) {
+            strcpy(errmsg, "File/@path: '");
+            strcat(errmsg, path ? path : "(null)");
+            strcat(errmsg, "'");
+        }
+        if( rc == 0 ) {
+            rc = KXMLNodeReadAttrCString(xml_node, "name", name_buf, sizeof(name_buf), &attribute_sz);
+            if( rc == 0 && name_buf[0] != '\0' ) {
+                name = name_buf;
+            } else if( GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound ) {
+                rc = 0;
+            }
+            if( rc != 0 ) {
+                strcpy(errmsg, "File/@name");
+            } else if( name == NULL ) {
+                name = strrchr(path, '/');
+                name = name ? name + 1 : path;
+            }
+        }
+        if( rc == 0 && (rc = XML_ParseTimestamp(xml_node, "timestamp", &ktm, true)) != 0 ) {
+            strcpy(errmsg, "File/@timestamp");
+        }
+        if( rc == 0 ) {
+            struct KNamelist const* attr = NULL;
+            if( (rc = KXMLNodeListAttr(xml_node, &attr)) == 0 ) {
+                uint32_t i = 0, count = 0;
+                if( (rc = KNamelistCount(attr, &count)) == 0 && count > 0 ) {
+                    while( rc == 0 && i < count ) {
+                        const char *attr_nm = NULL;
+                        if( (rc = KNamelistGet(attr, i++, &attr_nm)) != 0 ) {
+                            break;
+                        }
+                        if( strcmp("path", attr_nm) == 0
+                            || strcmp("name", attr_nm) == 0
+                            || strcmp("timestamp", attr_nm) == 0
+                            ) {
+                            continue;
+                        }
+                        rc = RC(rcExe, rcDoc, rcValidating, rcDirEntry, rcInvalid);
+                        strcpy(errmsg, "unknown attribute File/@");
+                        strcat(errmsg, attr_nm);
+                    }
+                }
+                ReleaseComplain(KNamelistRelease, attr);
+            }
+        }
+        if( rc == 0 ) {
+            if( (rc = FSNode_Make((FSNode**)&ff, name, &RemoteLinkNode_vtbl)) == 0 ) {
+                ff->path = path;
+                ff->mtime = ktm;
+            } else {
+                strcpy(errmsg, "File '");
+                strcat(errmsg, name);
+                strcat(errmsg, "'");
+            }
+        }
+        if( rc == 0 ) {
+            *cself = &ff->node;
+        } else {
+            FREE(path);
+        }
+    }
+    return rc;
+}
diff --git a/tools/fuse/remote-link.h b/tools/fuse/remote-link.h
new file mode 100644
index 0000000..4322713
--- /dev/null
+++ b/tools/fuse/remote-link.h
@@ -0,0 +1,33 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#ifndef _h_sra_fuse_remote_link_
+#define _h_sra_fuse_remote_link_
+
+#include "node.h"
+
+rc_t RemoteLinkNode_Make(const KXMLNode* xml_node, FSNode** cself, char* errmsg, const char* rel_path);
+
+#endif /* _h_sra_fuse_remote_link_ */
diff --git a/tools/fuse/remote-xml.c b/tools/fuse/remote-xml.c
new file mode 100644
index 0000000..7788d3d
--- /dev/null
+++ b/tools/fuse/remote-xml.c
@@ -0,0 +1,603 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#include <kfs/directory.h>
+#include <kfs/file.h>
+#include <klib/namelist.h>
+#include <klib/container.h>
+#include <klib/log.h>
+#include <klib/printf.h>
+#include <klib/out.h>
+#include <kproc/lock.h>
+#include <kproc/thread.h>
+#include <kns/manager.h>
+#include <kns/http.h>
+
+#include "log.h"
+#include "remote-xml.h"
+#include "file.h"
+#include "node.h"
+
+#include "remote-file.h"
+#include "remote-directory.h"
+#include "remote-link.h"
+#include "remote-cache.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+static const KXMLMgr* g_xmlmgr = NULL;
+static const FSNode* g_root = NULL;
+static KRWLock* g_lock = NULL;
+static const char* g_start_dir = NULL;
+
+static unsigned int g_xml_sync = 0;
+/* if g_xml_sync == 0 these are not used: */
+static KTime_t g_xml_mtime = 0;
+static char* g_xml_path = NULL;
+static KThread* g_xml_thread = NULL;
+
+static char g_fuse_version [ 128 ];
+static char g_heart_beat_url_complete [ 4096 ];
+static char * g_heart_beat_url = NULL;
+static char * g_heart_beat_url_complete_p = NULL;
+
+static
+rc_t XMLLock(bool exclusive)
+{
+    DEBUG_MSG(10, ("Lock XML tree %s\n", exclusive ? "write" : "read"));
+    return exclusive ? KRWLockAcquireExcl(g_lock) : KRWLockAcquireShared(g_lock);
+}
+
+static
+void XMLUnlock(void)
+{
+    DEBUG_MSG(10, ("Unlocked XML tree\n"));
+    ReleaseComplain(KRWLockUnlock, g_lock);
+}
+
+void XML_FindRelease(void)
+{
+    XMLUnlock();
+}
+
+rc_t XML_FindLock(const char* path, bool recur, const FSNode** node, const char** subpath)
+{
+    rc_t rc = 0;
+    size_t sz = 0;
+    const char* p0 = NULL, *p = NULL;
+    const FSNode* pn = NULL, *n = NULL;
+    bool hidden = false;
+
+    if( path == NULL || node == NULL || subpath == NULL ) {
+        return RC(rcExe, rcPath, rcResolving, rcParam, rcNull);
+    }
+    sz = strlen(path);
+    if( sz == 0 ) {
+        return RC(rcExe, rcPath, rcResolving, rcParam, rcEmpty);
+    }
+    p0 = path;
+    if( (rc = XMLLock(false)) != 0 ) {
+        return rc;
+    }
+    pn = g_root;
+    do {
+        DEBUG_MSG(8, ("Path: '%s'\n", p0));
+        while( *p0 == '/' && *p0 != '\0' ) {
+            p0++;
+        }
+        if( *p0 == '\0' ) {
+            break;
+        }
+        p = strchr(p0, '/');
+        if( p == NULL ) {
+            p = p0 + strlen(p0);
+        }
+        DEBUG_MSG(8, ("Push: '%.*s'\n", p - p0, p0));
+        if( (rc = FSNode_FindChild(pn, p0, p - p0, &n, &hidden)) == 0 ) {
+            if( hidden ) {
+                pn = n;
+                DEBUG_MSG(8, ("Match! hidden '%s' left '%s'\n", pn->name, p0));
+                break;
+            } else {
+                DEBUG_MSG(8, ("Match! '%.*s' left '%s'\n", p - p0, p0, p));
+            }
+        } else if( GetRCState(rc) == rcNotFound ) {
+            rc = 0;
+            break;
+        }
+        pn = n;
+        p0 = p;
+    } while( rc == 0 && p0 < path + sz );
+
+    if( rc == 0 ) {
+        if( pn == NULL ) {
+            rc = RC(rcExe, rcPath, rcResolving, rcDirEntry, rcNotFound);
+            DEBUG_MSG(10, ("Not found: '%s', in '%s'\n", p0, path));
+        } else {
+            if( (rc = FSNode_Touch(pn)) != 0 ) {
+                PLOGERR(klogWarn, (klogWarn, rc, "touch failed for $(n)", PLOG_S(n), pn->name));
+                rc = 0;
+            }
+            *node = pn;
+            *subpath = (p0 && p0[0] != '\0') ? p0 : NULL;
+#if _DEBUGGING
+            {
+                const char* nm = NULL;
+                FSNode_GetName(pn, &nm);
+                DEBUG_MSG(10, ("Found: '%s', sub '%s'\n", nm, *subpath));
+            }
+#endif
+        }
+    }
+    if( rc != 0 ) {
+        XMLUnlock();
+    }
+    return rc;
+}
+
+static
+rc_t XML_ValidateNode(FSNode* parent, const KXMLNode* n, char* errmsg)
+{
+    rc_t rc = 0;
+    const char* name = NULL;
+    FSNode* fsn = NULL;
+    bool children_allowed = false, should_have_children = false, ignore_children = false;
+
+    if( (rc = KXMLNodeElementName(n, &name)) != 0 ) {
+        return rc;
+    }
+    DEBUG_MSG(8, ("Node: %s\n", name));
+    if( name == NULL ) {
+        return RC(rcExe, rcDoc, rcValidating, rcDirEntry, rcNull);
+    }
+
+    if( strcmp(name, "Directory") == 0 ) {
+        rc = RemoteDirectoryNode_Make(n, &fsn, errmsg, g_start_dir, g_xml_mtime);
+        children_allowed = true;
+    } else if( strcmp(name, "File") == 0 ) {
+        rc = RemoteFileNode_Make(n, &fsn, errmsg, g_start_dir);
+    } else if( strcmp(name, "Link") == 0 ) {
+        rc = RemoteLinkNode_Make(n, &fsn, errmsg, g_start_dir);
+    } else {
+        strcpy(errmsg, name);
+        rc = RC(rcExe, rcDoc, rcValidating, rcTag, rcUnknown);
+    }
+    if( rc == 0 ) {
+        strcpy(errmsg, name);
+        if( fsn == parent || (rc = FSNode_AddChild(parent, fsn)) == 0 ) {
+            uint32_t count = 0;
+            if( (rc = KXMLNodeCountChildNodes(n, &count)) == 0 && count > 0 ) {
+                if( !children_allowed ) {
+                    if( fsn != NULL ) {
+                        FSNode_GetName(fsn, &name);
+                    }
+                    rc = RC(rcExe, rcDoc, rcValidating, rcDirEntry, rcInvalid);
+                    strcpy(errmsg, name);
+                } else if( !ignore_children ) {
+                    uint32_t i = 0;
+                    const KXMLNode* ch = NULL;
+                    while( rc == 0 && i < count ) {
+                        if( (rc = KXMLNodeGetNodeRead(n, &ch, i++)) == 0 ) {
+                            rc = XML_ValidateNode(fsn, ch, errmsg);
+                            ReleaseComplain(KXMLNodeRelease, ch);
+                        }
+                    }
+                }
+            } else if( count == 0 && should_have_children ) {
+                PLOGMSG(klogWarn, (klogWarn, "$(n) may have children", PLOG_S(n), name));
+            }
+        }
+    }
+    return rc;
+}   /* XML_ValidateNode() */
+
+static
+rc_t RootNode_Attr(const FSNode* cself, const char* subpath, uint32_t* type, KTime_t* ts, uint64_t* file_sz, uint32_t* access, uint64_t* block_sz)
+{
+    rc_t rc = 0;
+
+    *type = kptDir;
+    if( subpath != NULL ) {
+        rc = RC(rcExe, rcFile, rcEvaluating, rcDirEntry, rcNotFound);
+    }
+    return rc;
+}
+
+static
+rc_t RootNode_Dir(const FSNode* cself, const char* subpath, FSNode_Dir_Visit func, void* data)
+{
+    if( subpath != NULL ) {
+        return RC(rcExe, rcFile, rcListing, rcDirEntry, rcNotFound);
+    }
+    return FSNode_ListChildren(cself, func, data);
+}
+
+static const FSNode_vtbl RootNode_vtbl = {
+    sizeof(FSNode),
+    NULL,
+    NULL,
+    RootNode_Attr,
+    RootNode_Dir,
+    NULL,
+    NULL,
+    NULL
+};
+
+/*)))
+ ///  I make that method becaue I need also to retrieve version
+(((*/
+static
+rc_t _XML_DocumentOpenAndSomethingElse (
+                            const char * Url,
+                            const KXMLDoc ** Doc
+)
+{
+    rc_t RCt;
+    char * Buffer;
+    uint64_t BufferSize;
+    const KXMLDoc * XmlDoc;
+    const KXMLNodeset * NodeSet;
+    uint32_t NodeCount;
+    size_t AttrSize;
+    const KXMLNode * Node;
+
+    RCt = 0;
+    Buffer = NULL;
+    BufferSize = 0;
+    XmlDoc = NULL;
+    NodeSet = NULL;
+    NodeCount = AttrSize = 0;
+    Node = NULL;
+
+    if ( Url == NULL || Doc == NULL ) {
+        return RC ( rcXML, rcDoc, rcConstructing, rcParam, rcNull );
+    }
+    * Doc = NULL;
+
+    RCt = IsLocalPath ( Url )
+            ? ReadLocalFileToMemory ( Url, & Buffer, & BufferSize )
+            : ReadHttpFileToMemory ( Url, & Buffer, & BufferSize )
+            ;
+    if ( RCt == 0 ) {
+        RCt = KXMLMgrMakeDocReadFromMemory (
+                                        g_xmlmgr,
+                                        & XmlDoc,
+                                        Buffer,
+                                        BufferSize
+                                        );
+        if ( RCt == 0 ) {
+                /* Here we are ... retrieving '/FUSE' node
+                 */
+            RCt = KXMLDocOpenNodesetRead (
+                                        XmlDoc,
+                                        &NodeSet,
+                                        "/FUSE"
+                                        );
+            if ( RCt == 0 ) {
+                RCt = KXMLNodesetCount ( NodeSet, & NodeCount );
+                if ( RCt == 0 ) {
+                    if ( NodeCount != 1 ) {
+                        RCt = RC ( rcXML, rcDoc, rcConstructing, rcFormat, rcInvalid );
+                    }
+                    if ( RCt == 0 ) {
+                            /*  FUSE node is always alone
+                             */
+                        RCt = KXMLNodesetGetNodeRead (
+                                                    NodeSet,
+                                                    & Node,
+                                                    0
+                                                    );
+                        if ( RCt == 0 ) {
+                            RCt = KXMLNodeReadAttrCString (
+                                        Node,
+                                        "version",
+                                        g_fuse_version,
+                                        sizeof ( g_fuse_version ),
+                                        & AttrSize
+                                        );
+                            if ( RCt != 0 ) {
+                                /* There were no version defined */
+                                RmOutMsg ( "WARNING: No version provided\n" );
+                                RCt = 0;
+                            }
+                            else {
+                                /* TODO : set version  */
+                                if ( g_heart_beat_url != NULL ) {
+                                    RCt = string_printf (
+                                        g_heart_beat_url_complete,
+                                        sizeof ( g_heart_beat_url_complete ),
+                                        & AttrSize,
+                                        g_heart_beat_url,
+                                        g_fuse_version
+                                        );
+                                    if ( RCt == 0 ) {
+                                        g_heart_beat_url_complete_p = g_heart_beat_url_complete;
+                                    }
+                                }
+                            }
+
+                            ReleaseComplain ( KXMLNodeRelease, Node );
+                        }
+                    }
+                }
+
+                ReleaseComplain ( KXMLNodesetRelease, NodeSet );
+            }
+        }
+
+        free ( Buffer );
+    }
+
+    if ( RCt == 0 ) {
+        * Doc = XmlDoc;
+    }
+    else {
+        ReleaseComplain ( KXMLDocRelease, XmlDoc );
+    }
+
+    return RCt;
+}   /* _XML_DocumentOpenAndSomethingElse () */
+
+static
+rc_t XML_Open(const char* path, const FSNode** tree)
+{
+    rc_t rc = 0;
+    char errmsg[4096] = "";
+    const KXMLDoc* xmldoc = NULL;
+    
+    PLOGMSG(klogInfo, (klogInfo, "Reading XML file '$(x)'", PLOG_S(x), path));
+    if( (rc = _XML_DocumentOpenAndSomethingElse(path, &xmldoc)) == 0 ) {
+
+        if( (rc = FSNode_Make((FSNode**)tree, "ROOT", &RootNode_vtbl)) == 0 ) {
+            const KXMLNodeset* ns = NULL;
+            if( (rc = KXMLDocOpenNodesetRead(xmldoc, &ns, "/FUSE/*")) == 0 ) {
+                uint32_t count = 0;
+                if( (rc = KXMLNodesetCount(ns, &count)) == 0 ) {
+                    if( count == 0 ) {
+                        rc = RC(rcExe, rcDoc, rcValidating, rcData, rcEmpty);
+                    } else {
+                        uint32_t i = 0;
+                        while(rc == 0 && i < count) {
+                            const KXMLNode* n = NULL;
+                            if( (rc = KXMLNodesetGetNodeRead(ns, &n, i++)) == 0 ) {
+                                errmsg[0] = '\0';
+                                rc = XML_ValidateNode((FSNode*)*tree, n, errmsg);
+                                ReleaseComplain(KXMLNodeRelease, n);
+                            }
+                        }
+                    }
+                }
+                ReleaseComplain(KXMLNodesetRelease, ns);
+            }
+        }
+        if( rc != 0 ) {
+            FSNode_Release(*tree);
+            *tree = NULL;
+        }
+        ReleaseComplain(KXMLDocRelease, xmldoc);
+    }
+    if( rc == 0 ) {
+        PLOGMSG(klogInfo, (klogInfo, "XML file '$(x)' ok", PLOG_S(x), path));
+    } else {
+        if( strlen(errmsg) < 1 ) {
+            strcpy(errmsg, path);
+        }
+        LOGERR(klogErr, rc, errmsg);
+    }
+    return rc;
+}
+
+static
+rc_t XMLThread( const KThread *self, void *data )
+{
+    /* rc_t rc = 0; */
+
+    PLOGMSG(klogInfo, (klogInfo, "Heart beat thread started with $(s) sec", PLOG_U32(s), g_xml_sync));
+
+    do {
+        sleep(g_xml_sync);
+
+        PLOGMSG(klogInfo, (klogInfo, "Heart beat working $(s)", PLOG_S(s), g_heart_beat_url_complete_p));
+
+        if ( g_heart_beat_url_complete_p != NULL ) {
+            /* rc = */ ExecuteCGI ( g_heart_beat_url_complete_p );
+        }
+    } while( g_xml_sync > 0 );
+    LOGMSG(klogInfo, "Heart beat thread ended");
+    return 0;
+}
+
+rc_t XML_Make(KDirectory* dir, const char* const work_dir, const char* xml_path, const char *heart_beat_url, unsigned int sync)
+{
+    rc_t rc = 0; 
+
+    g_xml_sync = sync;
+    if( g_xmlmgr == NULL && (rc = KXMLMgrMakeRead(&g_xmlmgr)) != 0 ) {
+        g_xmlmgr = NULL;
+        LOGERR(klogErr, rc, "XML manager");
+    } else {
+        if( (rc = StrDup(xml_path, &g_xml_path)) == 0 ) {
+            DEBUG_MSG(8, ("XML path set to '%s'\n", g_xml_path));
+        }
+        if ( heart_beat_url != NULL ) {
+            if( (rc = StrDup(heart_beat_url, & g_heart_beat_url) ) == 0 ) {
+                DEBUG_MSG(8, ("Heart Beat path set to '%s'\n", g_heart_beat_url));
+            }
+        }
+        else {
+            g_heart_beat_url = NULL;
+        }
+
+        g_start_dir = work_dir;
+    }
+    if( rc == 0 ) {
+        rc = FSNode_Make((FSNode**)&g_root, "ROOT", &RootNode_vtbl);
+    }
+    return rc;
+}
+
+void FUSER_abort ();
+
+void XML_Init(void)
+{
+    rc_t rc = 0;
+
+    * g_fuse_version = 0;
+    * g_heart_beat_url_complete = 0;
+
+    if( g_lock == NULL && (rc = KRWLockMake(&g_lock)) != 0 ) {
+        g_lock = NULL;
+        LOGERR(klogErr, rc, "XML lock");
+    }
+
+    PLOGMSG(klogInfo, (klogInfo, "XML file is URL '$(x)' ok", PLOG_S(x), g_xml_path));
+
+    rc = RemoteCacheCreate ();
+    if ( rc == 0 ) {
+        rc = XML_Open ( g_xml_path, & g_root );
+        if ( rc == 0 ) {
+                /*) Here we are starting special thtread, only if 
+                 /  users set up URL
+                (*/
+            if ( rc == 0 && g_heart_beat_url_complete_p != NULL ) {
+                if( (rc = KThreadMake(&g_xml_thread, XMLThread, NULL)) != 0 ) {
+                    LOGERR(klogErr, rc, "XML sync thread");
+                }
+            }
+            else {
+                LOGMSG(klogInfo, "Skipping starting of heart beat thread");
+            }
+        }
+    }
+
+    if ( rc != 0 ) {
+        FUSER_abort ();
+    }
+}
+
+void XML_Fini(void)
+{
+
+
+    g_xml_sync = 0;
+    if( g_xml_thread != NULL ) {
+        ReleaseComplain(KThreadCancel, g_xml_thread);
+        ReleaseComplain(KThreadRelease, g_xml_thread);
+    }
+    ReleaseComplain(KXMLMgrRelease, g_xmlmgr);
+    XMLLock(true);
+    FSNode_Release(g_root);
+    XMLUnlock();
+    ReleaseComplain(KRWLockRelease, g_lock);
+    FREE(g_xml_path);
+
+    RemoteCacheDispose ();
+
+    g_root = NULL;
+    g_lock = NULL;
+    g_start_dir = NULL;
+    g_xml_mtime = 0;
+    g_xml_path = NULL;
+    g_xml_thread = NULL;
+
+    * g_fuse_version = 0;
+    if ( g_heart_beat_url != NULL ) {
+        FREE(g_heart_beat_url);
+    }
+    g_heart_beat_url = NULL;
+    * g_heart_beat_url_complete = 0;
+    g_heart_beat_url_complete_p = NULL;
+}
+
+rc_t XML_MgrGet(const KXMLMgr** xmlmgr)
+{
+    if( xmlmgr == NULL ) {
+        return RC(rcExe, rcDoc, rcAccessing, rcParam, rcNull);
+    }
+    if( g_xmlmgr == NULL ) {
+        return RC(rcExe, rcPath, rcAccessing, rcMgr, rcNull);
+    }
+    *xmlmgr = g_xmlmgr;
+    return 0;
+}
+
+rc_t XML_ParseTimestamp(const KXMLNode* xml_node, const char* attr, KTime_t* timestamp, bool optional)
+{
+    rc_t rc;
+    char ts[128];
+    size_t sz;
+
+    if( (rc = KXMLNodeReadAttrCString(xml_node, attr, ts, sizeof(ts), &sz)) == 0 ) {
+        struct tm tm;
+        memset(&tm, 0, sizeof(tm));
+        if( strptime(ts, "%Y-%m-%dT%H:%M:%S", &tm) != NULL ) {
+            *timestamp = mktime(&tm);
+        } else {
+            rc = RC(rcExe, rcDoc, rcReading, rcAttr, rcInvalid);
+        }
+    } else if( optional && GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound ) {
+        rc = 0;
+    }
+    return rc;
+}
+
+rc_t XML_WriteTimestamp(char* dst, size_t bsize, size_t *num_writ, KTime_t ts)
+{
+    struct tm* tm = localtime(&ts);
+
+    *num_writ = strftime(dst, bsize, "%a %Y-%m-%d %H:%M:%S %Z", tm);
+    if( *num_writ < 1 || *num_writ >= bsize ) {
+        return RC(rcExe, rcDoc, rcWriting, rcBuffer, rcInsufficient);
+    }
+    return 0;
+}
+
+rc_t XML_ParseBool(const KXMLNode* xml_node, const char* attr, bool* val, bool optional)
+{
+    rc_t rc;
+    char b[16];
+    size_t sz;
+
+    if( (rc = KXMLNodeReadAttrCString(xml_node, attr, b, sizeof(b), &sz)) == 0 ) {
+        if( strcasecmp(b, "true") == 0 || strcasecmp(b, "on") == 0 || strcasecmp(b, "yes") == 0 ) {
+            *val = true;
+        } else if( strcasecmp(b, "false") == 0 || strcasecmp(b, "off") == 0 || strcasecmp(b, "no") == 0 ) {
+            *val = false;
+        } else {
+            rc = RC(rcExe, rcDoc, rcReading, rcAttr, rcInvalid);
+        }
+    } else if( optional && GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound ) {
+        rc = 0;
+    }
+    return rc;
+}
diff --git a/tools/fuse/remote-xml.h b/tools/fuse/remote-xml.h
new file mode 100644
index 0000000..5434b9c
--- /dev/null
+++ b/tools/fuse/remote-xml.h
@@ -0,0 +1,59 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#ifndef _h_sra_fuse_xml_
+#define _h_sra_fuse_xml_
+
+#include <kxml/xml.h>
+#include <kfs/directory.h>
+
+#include "node.h"
+
+typedef uint32_t EXMLValidate;
+enum {
+    eXML_NoCheck = 0,
+    eXML_NoFail,
+    eXML_Full
+};
+
+rc_t XML_Make(KDirectory* dir, const char* const work_dir, const char* xml_path, const char *heart_beat_url, unsigned int sync);
+
+void XML_Init(void);
+
+rc_t XML_FindLock(const char* path, bool recur, const FSNode** node, const char** subpath);
+
+void XML_FindRelease(void);
+
+rc_t XML_MgrGet(const KXMLMgr** xmlmgr);
+
+rc_t XML_ParseTimestamp(const KXMLNode* xml_node, const char* attr, KTime_t* tm, bool optional);
+
+rc_t XML_WriteTimestamp(char* dst, size_t bsize, size_t *num_writ, KTime_t ts);
+
+rc_t XML_ParseBool(const KXMLNode* xml_node, const char* attr, bool* val, bool optional);
+
+void XML_Fini(void);
+
+#endif /* _h_sra_fuse_xml_ */
diff --git a/tools/fuse/sra-directory.c b/tools/fuse/sra-directory.c
new file mode 100644
index 0000000..2d7e53b
--- /dev/null
+++ b/tools/fuse/sra-directory.c
@@ -0,0 +1,107 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#include <klib/namelist.h>
+#include <kxml/xml.h>
+#include <kfs/directory.h>
+#include <kfs/file.h>
+
+#include <sra/sradb-priv.h>
+
+typedef struct SRADirectoryNode SRADirectoryNode;
+#define FSNODE_IMPL SRADirectoryNode
+
+#include "log.h"
+#include "xml.h"
+#include "sra-list.h"
+#include "sra-directory.h"
+
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <time.h>
+
+struct SRADirectoryNode {
+    FSNode node;
+    const SRAListNode* sra;
+};
+
+static
+rc_t SRADirectoryNode_Attr(const SRADirectoryNode* cself, const char* subpath, uint32_t* type, KTime_t* ts, uint64_t* file_sz, uint32_t* access, uint64_t* block_sz)
+{
+    rc_t rc = 0;
+
+    if( subpath != NULL ) {
+        rc = RC(rcExe, rcFile, rcOpening, rcDirEntry, rcNotFound);
+    } else {
+        *type = kptDir;
+        rc = SRAListNode_TableMTime(cself->sra, ts);
+    }
+    return rc;
+}
+
+static
+rc_t SRADirectoryNode_Dir(const SRADirectoryNode* cself, const char* subpath, FSNode_Dir_Visit func, void* data)
+{
+    if( subpath != NULL ) {
+        return RC(rcExe, rcSRA, rcEvaluating, rcDirEntry, rcInvalid);
+    }
+    return FSNode_ListChildren(&cself->node, func, data);
+}
+
+static
+rc_t SRADirectoryNode_Release(SRADirectoryNode* self)
+{
+    if( self != NULL ) {
+        SRAListNode_Release(self->sra);
+    }
+    return 0;
+}
+
+static FSNode_vtbl SRADirectoryNode_vtbl = {
+    sizeof(SRADirectoryNode),
+    NULL,
+    NULL,
+    SRADirectoryNode_Attr,
+    SRADirectoryNode_Dir,
+    NULL,
+    NULL,
+    SRADirectoryNode_Release
+};
+
+rc_t SRADirectoryNode_Make(FSNode** self, const char* name, const SRAListNode* sra)
+{
+    rc_t rc = 0;
+
+    if( self == NULL || sra == NULL ) {
+        rc = RC(rcExe, rcDirectory, rcConstructing, rcParam, rcNull);
+    } else {
+        if( (rc = FSNode_Make(self, name, &SRADirectoryNode_vtbl)) == 0 ) {
+            SRAListNode_AddRef(sra);
+            ((SRADirectoryNode*)*self)->sra = sra;
+        }
+    }
+    return rc;
+}
diff --git a/tools/fuse/sra-directory.h b/tools/fuse/sra-directory.h
new file mode 100644
index 0000000..7a4b7f7
--- /dev/null
+++ b/tools/fuse/sra-directory.h
@@ -0,0 +1,33 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#ifndef _h_sra_fuse_sra_directory_
+#define _h_sra_fuse_sra_directory_
+
+#include "node.h"
+
+rc_t SRADirectoryNode_Make(FSNode** self, const char* name, const SRAListNode* sra);
+
+#endif /* _h_sra_fuse_sra_directory_ */
diff --git a/tools/fuse/sra-fastq.c b/tools/fuse/sra-fastq.c
new file mode 100644
index 0000000..ebe5ec5
--- /dev/null
+++ b/tools/fuse/sra-fastq.c
@@ -0,0 +1,245 @@
+/*===========================================================================
+ *
+ *                            Public DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ */
+#include <klib/rc.h>
+#include <kfs/file.h>
+#include <kproc/lock.h>
+#include <kdb/table.h>
+#include <kdb/index.h>
+
+#include <sra/sradb-priv.h>
+#include <sra/fastq.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "log.h"
+#include "xml.h"
+#include "sra-list.h"
+#include "sra-fastq.h"
+#include "zlib-simple.h"
+
+typedef struct SRAFastqFile SRAFastqFile;
+#define KFILE_IMPL SRAFastqFile
+#include <kfs/impl.h>
+
+struct SRAFastqFile {
+    KFile dad;
+    uint32_t buffer_sz;
+    uint64_t file_sz;
+    char* gzipped; /* serves as flag and a buffer */
+    KLock* lock;
+    const SRATable* stbl;
+    const KTable* ktbl;
+    const KIndex* kidx;
+    const FastqReader* reader;
+    /* current buf content */
+    uint64_t from;
+    uint64_t size;
+    char* buf;
+};
+
+static
+rc_t SRAFastqFile_Destroy(SRAFastqFile *self)
+{
+    if( KLockAcquire(self->lock) == 0 ) {
+        ReleaseComplain(FastqReaderWhack, self->reader);
+        ReleaseComplain(KIndexRelease, self->kidx);
+        ReleaseComplain(KTableRelease, self->ktbl);
+        ReleaseComplain(SRATableRelease, self->stbl);
+        FREE(self->buf < self->gzipped ? self->buf : self->gzipped);
+        ReleaseComplain(KLockUnlock, self->lock);
+        ReleaseComplain(KLockRelease, self->lock);
+        FREE(self);
+    }
+    return 0;
+}
+
+static
+struct KSysFile* SRAFastqFile_GetSysFile(const SRAFastqFile *self, uint64_t *offset)
+{
+    *offset = 0;
+    return NULL;
+}
+
+static
+rc_t SRAFastqFile_RandomAccess(const SRAFastqFile *self)
+{
+    return 0;
+}
+
+static
+uint32_t SRAFastqFile_Type(const SRAFastqFile *self)
+{
+    return kfdFile;
+}
+
+static
+rc_t SRAFastqFile_Size(const SRAFastqFile *self, uint64_t *size)
+{
+    *size = self->file_sz;
+    return 0;
+}
+
+static
+rc_t SRAFastqFile_SetSize(SRAFastqFile *self, uint64_t size)
+{
+    return RC(rcExe, rcFile, rcUpdating, rcInterface, rcUnsupported);
+}
+
+static
+rc_t SRAFastqFile_Read(const SRAFastqFile* self, uint64_t pos, void *buffer, size_t size, size_t *num_read)
+{
+    rc_t rc = 0;
+
+    if( pos >= self->file_sz ) {
+        *num_read = 0;
+    } else if( (rc = KLockAcquire(self->lock)) == 0 ) {
+        do {
+            if( pos < self->from || pos >= (self->from + self->size) ) {
+                int64_t id = 0;
+                uint64_t id_qty = 0;
+                DEBUG_MSG(10, ("Caching for pos %lu %lu bytes\n", pos, size - *num_read));
+                if( (rc = KIndexFindU64(self->kidx, pos, &((SRAFastqFile*)self)->from, &((SRAFastqFile*)self)->size, &id, &id_qty)) == 0 ) {
+                    DEBUG_MSG(10, ("Caching from %lu:%lu, %lu bytes\n", self->from, self->from + self->size - 1, self->size));
+                    DEBUG_MSG(10, ("Caching spot %ld, %lu spots\n", id, id_qty));
+                    if( (rc = FastqReaderSeekSpot(self->reader, id)) == 0 ) {
+                        size_t inbuf = 0, w = 0;
+                        char* b = self->buf;
+                        uint64_t left = self->buffer_sz;
+                        do {
+                            if( (rc = FastqReader_GetCurrentSpotSplitData(self->reader, b, left, &w)) != 0 ) {
+                                break;
+                            }
+                            b += w; left -= w; inbuf += w; --id_qty;
+                        } while( id_qty > 0 && (rc = FastqReaderNextSpot(self->reader)) == 0);
+                        if( GetRCObject(rc) == rcRow && GetRCState(rc) == rcExhausted ) {
+                            DEBUG_MSG(10, ("No more rows\n"));
+                            rc = 0;
+                        }
+                        DEBUG_MSG(8, ("Cached %u bytes\n", inbuf));
+                        if( self->gzipped != NULL ) {
+                            size_t compressed = 0;
+                            if( (rc = ZLib_DeflateBlock(self->buf, inbuf, self->gzipped, self->buffer_sz, &compressed)) == 0 ) {
+                                char* b = self->buf;
+                                ((SRAFastqFile*)self)->buf = self->gzipped;
+                                ((SRAFastqFile*)self)->gzipped = b;
+                                ((SRAFastqFile*)self)->size = compressed;
+                                DEBUG_MSG(10, ("gzipped %lu bytes\n", self->size));
+                            }
+                        }
+                    }
+                }
+            }
+            if( rc == 0 ) {
+                off_t from = pos - self->from;
+                size_t q = (self->size - from) > (size - *num_read) ? (size - *num_read) : (self->size - from);
+                DEBUG_MSG(10, ("Copying from %lu %u bytes\n", from, q));
+                memcpy(&((char*)buffer)[*num_read], &self->buf[from], q);
+                *num_read = *num_read + q;
+                pos += q;
+            }
+        } while( rc == 0 && *num_read < size && pos < self->file_sz );
+        ReleaseComplain(KLockUnlock, self->lock);
+    }
+    return rc;
+}
+
+static
+rc_t SRAFastqFile_Write(SRAFastqFile *self, uint64_t pos, const void *buffer, size_t size, size_t *num_writ)
+{
+    return RC(rcExe, rcFile, rcWriting, rcInterface, rcUnsupported);
+}
+
+static KFile_vt_v1 SRAFastqFile_vtbl = {
+    1, 1,
+    SRAFastqFile_Destroy,
+    SRAFastqFile_GetSysFile,
+    SRAFastqFile_RandomAccess,
+    SRAFastqFile_Size,
+    SRAFastqFile_SetSize,
+    SRAFastqFile_Read,
+    SRAFastqFile_Write,
+    SRAFastqFile_Type
+};
+
+rc_t SRAFastqFile_Open(const KFile** cself, const SRAListNode* sra, const FileOptions* opt)
+{
+    rc_t rc = 0;
+    SRAFastqFile* self;
+    CALLOC( self, 1, sizeof( *self ) );
+    if( self == NULL )
+    {
+        rc = RC( rcExe, rcFile, rcConstructing, rcMemory, rcExhausted );
+    }
+    else
+    {
+        if ( ( rc = KFileInit( &self->dad, (const KFile_vt*)&SRAFastqFile_vtbl, "SRAFastqFile", "no-name", true, false ) ) == 0 )
+        {
+            if ( ( rc = SRAListNode_TableOpen( sra, &self->stbl ) ) == 0 )
+            {
+                if ( ( rc = SRATableGetKTableRead( self->stbl, &self->ktbl ) ) == 0 )
+                {
+                    if ( ( rc = KTableOpenIndexRead( self->ktbl, &self->kidx, opt->index ) ) == 0 )
+                    {
+                        if ( ( rc = KLockMake( &self->lock ) ) == 0 )
+                        {
+                            MALLOC( self->buf, opt->buffer_sz * ( opt->f.fastq.gzip ? 2 : 1 ) );
+                            if ( self->buf == NULL )
+                            {
+                                rc = RC( rcExe, rcFile, rcOpening, rcMemory, rcExhausted );
+                            }
+                            else
+                            {
+                                self->file_sz = opt->file_sz;
+                                self->buffer_sz = opt->buffer_sz;
+                                if ( opt->f.fastq.gzip )
+                                {
+                                    self->gzipped = &self->buf[ opt->buffer_sz ];
+                                }
+                                self->from = ~0; /* reset position beyond file end */
+                                rc = FastqReaderMake( &self->reader, self->stbl,
+                                                      opt->f.fastq.accession, opt->f.fastq.colorSpace,
+                                                      opt->f.fastq.origFormat, false, opt->f.fastq.printLabel,
+                                                      opt->f.fastq.printReadId, !opt->f.fastq.clipQuality, false,
+                                                      opt->f.fastq.minReadLen, opt->f.fastq.qualityOffset,
+                                                      opt->f.fastq.colorSpaceKey,
+                                                      opt->f.fastq.minSpotId, opt->f.fastq.maxSpotId );
+                            }
+                        }
+                    }
+                }
+            }
+            if ( rc == 0 )
+            {
+                *cself = &self->dad;
+            }
+            else
+            {
+                KFileRelease( &self->dad );
+            }
+        }
+    }
+    return rc;
+}
diff --git a/tools/fuse/sra-fastq.h b/tools/fuse/sra-fastq.h
new file mode 100644
index 0000000..d851575
--- /dev/null
+++ b/tools/fuse/sra-fastq.h
@@ -0,0 +1,34 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_sra_fuse_sra_fastq_
+#define _h_sra_fuse_sra_fastq_
+
+#include "node.h"
+
+rc_t SRAFastqFile_Open(const KFile** cself, const SRAListNode* sra, const FileOptions* opt);
+
+#endif /* _h_sra_fuse_sra_fastq_ */
diff --git a/tools/fuse/sra-fuser-test.c b/tools/fuse/sra-fuser-test.c
new file mode 100644
index 0000000..ef4cc79
--- /dev/null
+++ b/tools/fuse/sra-fuser-test.c
@@ -0,0 +1,100 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <pthread.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+
+#define MAX_THREADS 20
+#define CHUNK_SZ 4200
+
+int fin = 0;
+int fout = 0;
+off_t file_sz;
+off_t step;
+
+typedef struct thread_data_struct {
+    int id;
+} thread_data;
+
+void* thread_func(void *v)
+{
+    char buf[CHUNK_SZ];
+    thread_data* data = v;
+    off_t pos = (data->id - 1) * CHUNK_SZ;
+
+    printf("Thread %i started\n", data->id);
+
+    while( pos < file_sz ) {
+        ssize_t i = pread(fin, buf, CHUNK_SZ, pos);
+        if( i < 0 ) {
+            printf("Thread %i %lu:%lu: %s\n", data->id, pos, pos + CHUNK_SZ - 1, strerror(errno));
+            break;
+        }
+        pwrite(fout, buf, i, pos);
+        pos += step;
+    }
+    printf("Thread %i finished\n", data->id);
+    return v;
+}
+
+
+int main (int argc, char* argv[])
+{
+    pthread_t threads[MAX_THREADS];
+    thread_data threads_data[MAX_THREADS];
+    int i, threads_qty = 0;
+    struct stat stat;
+
+    if( argc < 4 ) {
+        printf("\nUsage:\n\ttest num_threads input_file output_file\n\n");
+        return 1;
+    }
+    threads_qty = atoi(argv[1]);
+    if( threads_qty < 2 || threads_qty > MAX_THREADS ) {
+        printf("num_threads out of range: [2:%i]\n", MAX_THREADS);
+        return 2;
+    }
+    if( (fin = open(argv[2], O_RDONLY, 0)) < 0) {
+        printf("Cannot read file '%s': %s\n", argv[2], strerror(errno));
+        return 3;
+    }
+    if( fstat(fin, &stat) != 0 ) {
+        printf("Cannot stat '%s': %s\n", argv[2], strerror(errno));
+        return 3;
+    }
+    printf("File size: %lu bytes\n", stat.st_size);
+
+    if( stat.st_size / threads_qty / CHUNK_SZ < 10 ) {
+        printf("Need bigger file or less threads to test \n");
+        return 5;
+    }
+    if( (fout = creat(argv[3], 0)) < 0 ) {
+        printf("Cannot write file '%s': %s\n", argv[3], strerror(errno));
+        return 4;
+    }
+    file_sz = stat.st_size;
+    step = threads_qty * CHUNK_SZ;
+
+    for(i = 0; i < threads_qty; i++) {
+        threads_data[i].id = i + 1;
+        if( pthread_create(&threads[i], NULL, thread_func, &threads_data[i]) != 0 ) {
+            printf("Cannot pthread_create %i: %s\n", i + 1, strerror(errno));
+            return 14;
+        }
+    }
+
+    for(i = 0; i < threads_qty; i++) {
+        thread_data* data;
+        if( pthread_join(threads[i], (void**)&data) != 0 ) {
+            printf("Cannot pthread_join %i: %s\n", i + 1, strerror(errno));
+        }
+    }
+
+    close(fin);
+    close(fout);
+    return 0;
+}
diff --git a/tools/fuse/sra-fuser-test.vers b/tools/fuse/sra-fuser-test.vers
new file mode 100644
index 0000000..227cea2
--- /dev/null
+++ b/tools/fuse/sra-fuser-test.vers
@@ -0,0 +1 @@
+2.0.0
diff --git a/tools/fuse/sra-fuser-test.vers.h b/tools/fuse/sra-fuser-test.vers.h
new file mode 100644
index 0000000..f02d05a
--- /dev/null
+++ b/tools/fuse/sra-fuser-test.vers.h
@@ -0,0 +1 @@
+#define SRA_FUSER_TEST_VERS 0x02000000
diff --git a/tools/fuse/sra-fuser.c b/tools/fuse/sra-fuser.c
new file mode 100644
index 0000000..b23e03c
--- /dev/null
+++ b/tools/fuse/sra-fuser.c
@@ -0,0 +1,201 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#include <kapp/args.h>
+#include <klib/out.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "sra-fuser.vers.h"
+#include "xml.h"
+#include "sra-fuser.h"
+#include "log.h"
+#include "node.h"
+#include "accessor.h"
+#include "sra-list.h"
+
+typedef struct SRequest_struct {
+    const FSNode* node;
+    const char* subpath;
+} SRequest;
+
+static char* g_work_dir = NULL;
+
+static
+rc_t SRequestMake(SRequest* request, const char* path, bool recur)
+{
+    rc_t rc = 0;
+
+    if( request == NULL ) {
+        rc = RC(rcExe, rcFileDesc, rcConstructing, rcParam, rcNull);
+    } else {
+        rc = XML_FindLock(path, recur, &request->node, &request->subpath);
+    }
+    return rc;
+}
+
+static
+void SRequestRelease(SRequest* request)
+{
+    if( request != NULL ) {
+        XML_FindRelease();
+    }
+}
+
+rc_t Initialize(unsigned int sra_sync, const char* xml_path, unsigned int xml_sync,
+                const char* SRA_cache_path, const char* xml_root, EXMLValidate xml_validate)
+{
+    rc_t rc = 0;
+    KDirectory* dir = NULL;
+
+    if( (rc = KDirectoryNativeDir(&dir)) == 0 ) {
+        char buf[4096];
+        if( (rc = KDirectoryResolvePath(dir, true, buf, 4096, xml_root)) == 0 ) {
+            /* replace /. at the end to  just / */
+            if( strcmp(&buf[strlen(buf) - 2], "/.") == 0 ) {
+                buf[strlen(buf) - 1] = '\0';
+            }
+            /* add / to the end if missing */
+            if( buf[strlen(buf) - 1] != '/' ) {
+                buf[strlen(buf) + 1] = '\0';
+                buf[strlen(buf)] = '/';
+            }
+            if( (rc = StrDup(buf, &g_work_dir)) == 0 ) {
+                DEBUG_MSG(8, ("Current directory set to '%s'\n", g_work_dir));
+            }
+        }
+        if( rc == 0 && (rc = SRAList_Make(dir, sra_sync, SRA_cache_path)) != 0 ) {
+            LOGERR(klogErr, rc, "SRA");
+        } else {
+            rc = XML_Make(dir, g_work_dir, xml_path, xml_sync, xml_validate);
+        }
+        ReleaseComplain(KDirectoryRelease, dir);
+    }
+    return rc;
+}
+
+/* =============================================================================== */
+/* system call handlers */
+/* =============================================================================== */
+
+const char UsageDefaultName[] = "sra-fuser";
+
+rc_t CC UsageSummary (const char* progname)
+{
+    return KOutMsg("Usage:\n"
+        "\t%s [options] -o [FUSE options] -x file -m path\n"
+        "\t%s [options] -u -m path\n\n", progname, progname);
+}
+
+rc_t CC Usage ( const Args * args )
+{
+    /* dummy for newer args system will be filled when system is complete!!! */
+    return 0;
+}
+
+uint32_t KAppVersion(void)
+{
+    return SRA_FUSER_VERS;
+}
+
+void SRA_FUSER_Init(void)
+{
+    rc_t rc = 0;
+    /* reopen log file and start watch thread(s) */
+    if( (rc = LogFile_Init(NULL, 0, true, NULL)) != 0 ) {
+        LOGERR(klogErr, rc, "log file");
+    }
+    SRAList_Init(); /* this preceeeds XML_Init */
+    XML_Init();     /* or SRAList may become corrupt */
+    LOGMSG(klogInfo, "Started");
+}
+
+void SRA_FUSER_Fini(void)
+{
+    SRAList_Fini();
+    XML_Fini();
+    LOGMSG(klogInfo, "Stopped");
+    LogFile_Fini();
+    FREE(g_work_dir);
+}
+
+rc_t SRA_FUSER_GetDir(const char* path, FSNode_Dir_Visit func, void* data)
+{
+    rc_t rc = 0;
+    SRequest request;
+
+    if( (rc = SRequestMake(&request, path, true)) == 0 ) {
+        rc = FSNode_Dir(request.node, request.subpath, func, data);
+        SRequestRelease(&request);
+    }
+    return rc;
+}
+
+rc_t SRA_FUSER_GetAttr(const char* path, uint32_t* type, KTime_t* ts, uint64_t* file_sz, uint32_t* access, uint64_t* block_sz)
+{
+    rc_t rc = 0;
+    SRequest request;
+
+    if( (rc = SRequestMake(&request, path, false)) == 0 ) {
+        rc = FSNode_Attr(request.node, request.subpath, type, ts, file_sz, access, block_sz);
+        SRequestRelease(&request);
+    }
+    return rc;
+}
+
+rc_t SRA_FUSER_ResolveLink(const char* path, char* buf, size_t buf_sz)
+{
+    rc_t rc = 0;
+    SRequest request;
+
+    if( (rc = SRequestMake(&request, path, false)) == 0 ) {
+        rc = FSNode_Link(request.node, request.subpath, buf, buf_sz);
+        SRequestRelease(&request);
+    }
+    return rc;
+}
+
+rc_t SRA_FUSER_OpenNode(const char* path, const void** data)
+{
+    rc_t rc = 0;
+    SRequest request;
+
+    if( (rc = SRequestMake(&request, path, false)) == 0 ) {
+        rc = FSNode_Open(request.node, request.subpath, (const SAccessor**)data);
+        SRequestRelease(&request);
+    }
+    return rc;
+}
+
+rc_t SRA_FUSER_ReadNode(const char* path, const void* data, char *buf, size_t size, off_t offset, size_t* num_read)
+{
+    return SAccessor_Read(data, buf, size, offset, num_read);
+}
+
+rc_t SRA_FUSER_CloseNode(const char* path, const void* data)
+{
+    return SAccessor_Release(data);
+}
diff --git a/tools/fuse/sra-fuser.h b/tools/fuse/sra-fuser.h
new file mode 100644
index 0000000..7999745
--- /dev/null
+++ b/tools/fuse/sra-fuser.h
@@ -0,0 +1,48 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#ifndef _h_sra_fuse_fuser_
+#define _h_sra_fuse_fuser_
+
+#include "node.h"
+
+uint32_t KAppVersion(void);
+
+rc_t Initialize(unsigned int sra_sync, const char* xml_path, unsigned int xml_sync,
+                const char* SRA_cache_path, const char* xml_root, EXMLValidate xml_validate);
+
+/* FUSE call backs */
+void SRA_FUSER_Init(void);
+void SRA_FUSER_Fini(void);
+
+rc_t SRA_FUSER_GetAttr(const char* path, uint32_t* type, KTime_t* date, uint64_t* file_sz, uint32_t* access, uint64_t* block_sz);
+rc_t SRA_FUSER_GetDir(const char* path, FSNode_Dir_Visit func, void* data);
+rc_t SRA_FUSER_ResolveLink(const char* path, char* buf, size_t buf_sz);
+
+rc_t SRA_FUSER_OpenNode(const char* path, const void** data);
+rc_t SRA_FUSER_ReadNode(const char* path, const void* data, char *buf, size_t size, off_t offset, size_t* num_read);
+rc_t SRA_FUSER_CloseNode(const char* path, const void* data);
+
+#endif /* _h_sra_fuse_fuser_ */
diff --git a/tools/fuse/sra-fuser.vers b/tools/fuse/sra-fuser.vers
new file mode 100644
index 0000000..197c4d5
--- /dev/null
+++ b/tools/fuse/sra-fuser.vers
@@ -0,0 +1 @@
+2.4.0
diff --git a/tools/fuse/sra-fuser.xsd b/tools/fuse/sra-fuser.xsd
new file mode 100644
index 0000000..1935e51
--- /dev/null
+++ b/tools/fuse/sra-fuser.xsd
@@ -0,0 +1,207 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+  <xs:element name="TAR">
+    <xs:annotation>
+      <xs:documentation>This could be used to create an automatic tar archive within directory specified by a physical Directory node in main fuse.xml file.</xs:documentation>
+    </xs:annotation>
+  </xs:element>
+        
+  <xs:element name="FUSE">
+    <xs:annotation>
+      <xs:documentation>Main sra-fuser virtual directory structure root.</xs:documentation>
+    </xs:annotation>
+    <xs:complexType>
+      <xs:complexContent>
+        <xs:extension base="AllEntries">
+          <xs:sequence>
+            <xs:element name="TAR" type="TARType" minOccurs="0" maxOccurs="unbounded"/>
+          </xs:sequence>
+        </xs:extension>
+      </xs:complexContent>
+    </xs:complexType>
+  </xs:element>
+  
+  <xs:complexType name="AllEntries">
+    <xs:sequence minOccurs="0" maxOccurs="unbounded">
+      <xs:element name="Directory" minOccurs="0" maxOccurs="unbounded">
+        <xs:complexType>
+          <xs:complexContent>
+            <xs:extension base="DirectoryType"/>
+          </xs:complexContent>
+        </xs:complexType>
+      </xs:element>
+      <xs:element name="File" minOccurs="0" maxOccurs="unbounded">
+        <xs:complexType>
+          <xs:complexContent>
+            <xs:extension base="FileType"/>
+          </xs:complexContent>
+        </xs:complexType>
+      </xs:element>
+      <xs:element name="SRA" minOccurs="0" maxOccurs="unbounded">
+        <xs:complexType>
+          <xs:complexContent>
+            <xs:extension base="SRAType"/>
+          </xs:complexContent>
+        </xs:complexType>
+      </xs:element>
+      <xs:element name="SRAConfig" minOccurs="0" maxOccurs="1">
+        <xs:complexType>
+          <xs:complexContent>
+            <xs:extension base="SRAConfigType"/>
+          </xs:complexContent>
+        </xs:complexType>
+      </xs:element>
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:complexType name="DirectoryType">
+    <xs:annotation>
+      <xs:documentation>If Directory has path attribute it will detect presence of *.tar.xml files 
+                        with root node TAR (see above) and automatically create .tar file out of detect file's content.</xs:documentation>
+    </xs:annotation>
+    <xs:complexContent>
+      <xs:extension base="AllEntries">
+        <xs:sequence>
+          <xs:element name="TAR" type="TARType" minOccurs="0" maxOccurs="unbounded"/>
+        </xs:sequence>
+        <xs:attribute ref="name" use="optional" >
+          <xs:annotation>
+            <xs:documentation>Must have name OR path, or both</xs:documentation>
+          </xs:annotation>
+        </xs:attribute>
+        <xs:attribute name="path" type="xs:anyURI" use="optional">
+          <xs:annotation>
+            <xs:documentation>absolute or relative path to a physical directory</xs:documentation>
+          </xs:annotation>
+        </xs:attribute>
+        <xs:attribute ref="timestamp" use="optional"/>
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+  
+  <xs:complexType name="FileType">
+    <xs:attribute ref="name" use="optional" >
+      <xs:annotation>
+        <xs:documentation>May be used to override original file name in path</xs:documentation>
+      </xs:annotation>
+    </xs:attribute>
+    <xs:attribute name="path" type="xs:anyURI" use="required">
+      <xs:annotation>
+        <xs:documentation>absolute or relative path to a file</xs:documentation>
+      </xs:annotation>
+    </xs:attribute>
+    <xs:attribute ref="timestamp" use="optional" />
+    <xs:attribute name="password" type="xs:string" use="optional" />
+  </xs:complexType>
+
+  <xs:complexType name="SRAType">
+    <xs:attribute name="accession" use="required" type="xs:NCName" >
+      <xs:annotation>
+        <xs:documentation>SRA accession used to open the run</xs:documentation>
+      </xs:annotation>
+    </xs:attribute>
+    <xs:attribute name="path" type="xs:anyURI" use="optional">
+      <xs:annotation>
+        <xs:documentation>path is used for direct opening of the tables, for automatic search do not specify</xs:documentation>
+      </xs:annotation>
+    </xs:attribute>
+    <!-- next 5 attributes must always come together if present -->
+    <xs:attribute ref="timestamp" use="optional">
+      <xs:annotation>
+        <xs:documentation>time stamp of the size/md5 attribute values</xs:documentation>
+      </xs:annotation>
+    </xs:attribute>
+    <xs:attribute name="size.sra" type ="xs:nonNegativeInteger" use="optional">
+      <xs:annotation>
+        <xs:documentation>file size in bytes</xs:documentation>
+      </xs:annotation>
+    </xs:attribute>
+    <xs:attribute name="md5.sra" type ="xs:hexBinary" use="optional">
+      <xs:annotation>
+        <xs:documentation>MD5 sum of the file</xs:documentation>
+      </xs:annotation>
+    </xs:attribute>
+    <xs:attribute name="size.lite.sra" type ="xs:nonNegativeInteger" use="optional">
+      <xs:annotation>
+        <xs:documentation>file size in bytes</xs:documentation>
+      </xs:annotation>
+    </xs:attribute>
+    <xs:attribute name="md5.lite.sra" type ="xs:hexBinary" use="optional">
+      <xs:annotation>
+        <xs:documentation>MD5 sum of the file</xs:documentation>
+      </xs:annotation>
+    </xs:attribute>
+  </xs:complexType>
+  
+  <xs:complexType name="SRAConfigType">
+    <xs:complexContent>
+      <xs:extension base="AllEntries">
+        <xs:annotation>
+          <xs:documentation>Initially all attributes are TRUE, as first config node is encountered only attributes set to TRUE in THAT node are active all others become FALSE</xs:documentation>
+        </xs:annotation>
+        <xs:attribute name="run-directory" type="xs:boolean" use="optional" default="false" >
+          <xs:annotation>
+            <xs:documentation>Create run directory for the SRA node</xs:documentation>
+          </xs:annotation>
+        </xs:attribute>
+        <xs:attribute name="SRA-archive" type="xs:boolean" use="optional" default="false" />
+        <xs:attribute name="SRA-archive-lite" type="xs:boolean" use="optional" default="false" />
+        <xs:attribute name="fastq" type="xs:boolean" use="optional" default="false" /> 
+        <xs:attribute name="SFF" type="xs:boolean" use="optional" default="false" />
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+  
+  <xs:complexType name="TARType">
+    <xs:complexContent>
+      <xs:extension base="TARItemList">
+        <xs:attribute ref="name" use="required">
+          <xs:annotation>
+            <xs:documentation>Ignored in dynamically loaded .tar.xml files, .tar.xml file name is used, ex: data5.tar.xml -> data5.tar</xs:documentation>
+          </xs:annotation>
+        </xs:attribute>
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+  
+  <xs:complexType name="TARItem">
+    <xs:attribute name="name" type="xs:anyURI" use="optional" >
+      <xs:annotation>
+        <xs:documentation>Cannot start with '/'. If omitted, portion of path after last '/' is used</xs:documentation>
+      </xs:annotation>
+    </xs:attribute>
+    <xs:attribute name="path" type="xs:anyURI" use="required">
+      <xs:annotation>
+        <xs:documentation>Absolute or relative path to a file. In case of automatic tar relative
+                          paths will be resolved to from directory where .tar.xml is located.</xs:documentation>
+      </xs:annotation>
+    </xs:attribute>
+    <xs:attribute ref="timestamp" use="optional"/>
+    <xs:attribute name="size" use="required" type="xs:nonNegativeInteger">
+      <xs:annotation>
+        <xs:documentation>Actual file size is required to pre-calc resulting file .tar size</xs:documentation>
+      </xs:annotation>
+    </xs:attribute>
+    <xs:attribute name="executable" type="xs:boolean" use="optional" default="false">
+        <xs:annotation>
+            <xs:documentation>Indicate if files has executable type</xs:documentation>
+        </xs:annotation>
+    </xs:attribute>
+  </xs:complexType>
+  
+  <xs:complexType name="TARItemList">
+      <xs:sequence>
+        <xs:element name="Item" type="TARItem" minOccurs="1" maxOccurs="unbounded" />
+      </xs:sequence>
+  </xs:complexType>
+  
+  <xs:attribute name="name" type="xs:NCName"/>
+  
+  <xs:attribute name="timestamp" type="xs:dateTime">
+    <xs:annotation>
+      <xs:documentation>Sets timestamp on a node formatted: YYYY-MM-DDTHH:MM:SS</xs:documentation>
+    </xs:annotation>
+  </xs:attribute>
+  
+</xs:schema>
diff --git a/tools/fuse/sra-list.c b/tools/fuse/sra-list.c
new file mode 100644
index 0000000..463af47
--- /dev/null
+++ b/tools/fuse/sra-list.c
@@ -0,0 +1,1225 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#include <klib/namelist.h>
+#include <klib/container.h>
+#include <klib/printf.h>
+#include <klib/refcount.h>
+#include <kxml/xml.h>
+#include <kdb/namelist.h>
+#include <kproc/thread.h>
+#include <kproc/lock.h>
+#include <kproc/cond.h>
+#include <kfs/directory.h>
+#include <kfs/file.h>
+#include <errno.h>
+#include <pthread.h>
+#include <time.h>
+
+#include <sra/sradb-priv.h>
+#include <sra/impl.h>
+
+#include "log.h"
+#include "xml.h"
+#include "sra-list.h"
+#include "sra-directory.h"
+#include "sra-node.h"
+#include "formats.h"
+
+#include <stdlib.h>
+#include <strtol.h>
+#include <string.h>
+#include <assert.h>
+#include <time.h>
+
+static KRWLock* g_lock = NULL;
+static BSTree g_list;
+static uint64_t g_version = 0;
+static const SRAMgr* g_sra_mgr = NULL;
+/* hack to prevent opentable collapse */
+static KLock* g_sra_mgr_lock = NULL;
+/* SRA tables states cache file for quick restart */
+static char* g_cache_file = NULL;
+/* tmp name for cache file */
+static char* g_cache_file_tmp = NULL;
+static const uint32_t g_cache_version = 4;
+
+static unsigned int g_sync = 0;
+static KThread* g_thread = NULL;
+/*async update queue and thread */
+static SLList g_queue;
+static volatile uint64_t g_queue_depth;
+static KCondition* g_queue_cond;
+static KThread* g_queue_thread = NULL;
+static KLock* g_queue_lock = NULL;
+static pthread_mutex_t g_refresh_mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_cond_t g_refresh_cond = PTHREAD_COND_INITIALIZER;
+
+struct SRAListNode {
+    BSTNode dad;
+    atomic32_t refcount;
+    char* accession;
+    char* path;
+    FileOptions* files;
+    uint32_t files_count;
+    KTime_t mtime; /* table mtime */
+    KTime_t utime; /* node update time */
+    uint32_t version; /* source xml version */
+};
+
+typedef struct SRAQueueNode_struct {
+    SLNode dad;
+    SRAListNode* node;
+    KTime_t mtime; /* original node update time */
+} SRAQueueNode;
+
+void CC SRAQueue_Whack( SLNode *n, void *data )
+{
+    if( n != NULL ) {
+        FREE(n);
+    }
+}
+
+static
+rc_t SRAList_Queue_Lock(void)
+{
+    DEBUG_LINE(8, "Lock SRA %s", "queue");
+    return KLockAcquire(g_queue_lock);
+}
+
+static
+void SRAList_Queue_Unlock(void)
+{
+    DEBUG_LINE(8, "Unlock SRA %s", "queue");
+    ReleaseComplain(KLockUnlock, g_queue_lock);
+}
+
+static
+rc_t SRAList_Lock(bool exclusive)
+{
+    DEBUG_LINE(8, "Lock SRA list %s", exclusive ? "write" : "read");
+    return exclusive ? KRWLockAcquireExcl(g_lock) : KRWLockAcquireShared(g_lock);
+}
+
+static
+void SRAList_Unlock(void)
+{
+    DEBUG_LINE(8, "Unlocked SRA list", "");
+    ReleaseComplain(KRWLockUnlock, g_lock);
+}
+
+static
+rc_t SRAList_Mgr(const SRAMgr** mgr)
+{
+    rc_t rc = 0;
+    if( g_sra_mgr_lock == NULL && (rc = KLockMake(&g_sra_mgr_lock)) != 0 ) {
+        g_sra_mgr_lock = NULL;
+        LOGERR(klogErr, rc, "SRA manager lock");
+    } else if( g_sra_mgr == NULL ) {
+        PLOGMSG(klogInfo, (klogInfo, "VDB_CONFIG=$(var)", PLOG_S(var), getenv("VDB_CONFIG")));
+        if( (rc = SRAMgrMakeRead(&g_sra_mgr)) != 0 ) {
+            g_sra_mgr = NULL;
+            LOGERR(klogErr, rc, "SRA manager");
+        } else {
+            DEBUG_LINE(8, "SRA manager created 0x%p", g_sra_mgr);
+        }
+    }
+    if( rc == 0 ) {
+        *mgr = g_sra_mgr;
+    }
+    return rc;
+}
+
+rc_t SRAListNode_TableMTime(const SRAListNode* cself, KTime_t* mtime)
+{
+    rc_t rc = 0;
+
+    if( cself == NULL || mtime == NULL ) {
+        rc = RC(rcExe, rcTable, rcResolving, rcParam, rcNull);
+    } else {
+        const SRAMgr* mgr;
+        DEBUG_LINE(10, "%s path '%s'", cself->accession, cself->path);
+        if( (rc = SRAList_Mgr(&mgr)) == 0 ) {
+            rc = SRAMgrGetTableModDate(mgr, mtime, "%s", cself->path ? cself->path : cself->accession);
+        }
+    }
+    return rc;
+}
+
+rc_t SRAListNode_TableOpen(const SRAListNode* cself, const SRATable** tbl)
+{
+    rc_t rc = 0;
+
+    if( cself == NULL || tbl == NULL ) {
+        rc = RC(rcExe, rcTable, rcOpening, rcParam, rcNull);
+    } else {
+        const SRAMgr* mgr;
+        DEBUG_LINE(10, "%s path '%s'", cself->accession, cself->path);
+        if( (rc = SRAList_Mgr(&mgr)) == 0 && (rc = KLockAcquire(g_sra_mgr_lock)) == 0 ) {
+            KLogLevel lvl = KLogLevelGet();
+            KLogLevelSet(klogInfo - 1);
+            rc = SRAMgrOpenTableRead(mgr, tbl, "%s", cself->path ? cself->path : cself->accession);
+            KLogLevelSet(lvl);
+            ReleaseComplain(KLockUnlock, g_sra_mgr_lock);
+        }
+    }
+    return rc;
+}
+
+static
+rc_t SRAListNode_KConfigReload(void)
+{
+    rc_t rc = 0;
+
+    if( BSTreeFirst(&g_list) != NULL ) {
+        const SRAMgr* mgr;
+        if( (rc = SRAList_Mgr(&mgr)) == 0 && (rc = KLockAcquire(g_sra_mgr_lock)) == 0 ) {
+            DEBUG_LINE(10, "VDB_CONFIG=%s", getenv("VDB_CONFIG"));
+            rc = SRAMgrConfigReload(mgr, NULL);
+            ReleaseComplain(KLockUnlock, g_sra_mgr_lock);
+            if( rc != 0 ) {
+                PLOGERR(klogErr, (klogErr, rc, "SRA config reload with VDB_CONFIG=$(var)", PLOG_S(var), getenv("VDB_CONFIG")));
+            }
+        }
+    }
+    return rc;
+}
+
+rc_t SRAListNode_AddRef(const SRAListNode* cself)
+{
+    if( cself == NULL ) {
+        return RC(rcExe, rcTable, rcAttaching, rcSelf, rcNull);
+    }
+    atomic32_add(&((SRAListNode*)cself)->refcount, 1);
+    return 0;
+}
+
+void SRAListNode_Release(const SRAListNode* cself)
+{
+    SRAListNode* self = (SRAListNode*)cself;
+    if( self != NULL && atomic32_dec_and_test(&self->refcount) ) {
+        DEBUG_LINE(10, "%s: %s", self->accession, self->path);
+        FREE(self->accession);
+        FREE(self->path);
+        FREE(self->files);
+        FREE(self);
+    }
+}
+
+static
+void SRAList_Whack(BSTNode* node, void* data)
+{
+    SRAListNode_Release((SRAListNode*)node);
+}
+
+static
+void SRAListNode_Version(BSTNode* node, void* data)
+{
+    SRAListNode* n = (SRAListNode*)node;
+    uint32_t* qty = (uint32_t*)data;
+
+    if( n->version < g_version ) {
+        BSTreeUnlink(&g_list, node);
+        SRAListNode_Release(n);
+        *qty = *qty + 1;
+    }
+}
+
+rc_t SRAList_NextVersion(void)
+{
+    rc_t rc = 0;
+    uint32_t qty = 0;
+
+    DEBUG_LINE(8, "SRA setting version to %u", g_version + 1);
+    if( (rc = SRAList_Lock(true)) == 0 ) {
+        g_version++;
+        BSTreeForEach(&g_list, false, SRAListNode_Version, &qty);
+        SRAList_Unlock();
+        DEBUG_LINE(8, "SRA version set to %u, %u runs dropped", g_version, qty);
+    }
+    return rc;
+}
+
+typedef struct SRAListNode_FindData_struct {
+    char* accession;
+    char* path;
+    KTime_t timestamp;
+    struct {
+        int type;
+        const char* ext;
+        uint64_t size;
+        char md5[32 + 1];
+    } attr[2];
+} SRAListNode_FindData;
+
+static
+int SRAListNode_Cmp(const SRAListNode_FindData* l, const SRAListNode* r)
+{
+    int d = strcmp(l->accession, r->accession);
+    if( d == 0 && l->path != r->path ) {
+        if( l->path == NULL && r->path != NULL ) {
+            d = -1024;
+        } else if( l->path != NULL && r->path == NULL ) {
+            d = 1024;
+        } else {
+            d = strcmp(l->path, r->path);
+        }
+    }
+    return d;
+}
+
+static
+int SRAListNode_Find(const void* item, const BSTNode* node)
+{
+    return SRAListNode_Cmp((SRAListNode_FindData*)item, (SRAListNode*)node);
+}
+
+static
+int SRAListNode_Sort(const BSTNode *item, const BSTNode *node)
+{
+    SRAListNode* i = (SRAListNode*)item;
+    SRAListNode_FindData data;
+
+    data.accession = i->accession;
+    data.path = i->path;
+
+    return SRAListNode_Cmp(&data, (SRAListNode*)node);
+}
+
+static
+rc_t SRAListNode_Insert(SRAListNode_FindData* data, uint64_t version, SRAListNode** found)
+{
+    rc_t rc = 0;
+
+    *found = NULL; 
+    if( (rc = SRAList_Lock(true)) == 0 ) {
+        *found = (SRAListNode*)BSTreeFind(&g_list, data, SRAListNode_Find);
+        if( *found != NULL ) {
+            DEBUG_LINE(8, "found SRA list node %u. %s, %s", (*found)->version, data->accession, data->path);
+            atomic32_add(&(*found)->refcount, 1); /* for here */
+            if( version > (*found)->version ) {
+                (*found)->version = version;
+            }
+        } else {
+            CALLOC(*found, 1, sizeof(**found));
+            if( *found == NULL ) {
+                rc = RC(rcExe, rcTable, rcInserting, rcMemory, rcExhausted);
+            } else {
+                KRefcountInit(&((*found)->refcount), 1, "SRAListNode", "Make", "");
+                (*found)->accession = data->accession;
+                (*found)->path = data->path;
+                atomic32_set(&(*found)->refcount, 2); /* one for the list and 1 for here */
+                (*found)->version = version;
+                DEBUG_LINE(8, "SRA list new node %u. %s, %s", (*found)->version, (*found)->accession, (*found)->path);
+                BSTreeInsert(&g_list, &(*found)->dad, SRAListNode_Sort);
+                data->accession = NULL;
+                data->path = NULL;
+            }
+        }
+        if( rc == 0 && data->timestamp != 0 && (*found)->mtime != data->timestamp ) {
+            if( (*found)->files_count > 0 ) {
+                uint32_t i, j;
+                for(j = 0; rc == 0 && j < (*found)->files_count; j++) {
+                    for(i = 0; rc == 0 && i < sizeof(data->attr) / sizeof(data->attr[0]); i++) {
+                        if( (*found)->files[j].type == data->attr[i].type ) {
+                            if( (rc = FileOptions_SRAArchiveUpdate(&(*found)->files[j], (*found)->accession,
+                                data->timestamp, data->attr[i].size, data->attr[i].md5)) == 0 ) {
+                                    DEBUG_LINE(10, "updated %s %lu %s", (*found)->accession,
+                                        data->attr[i].size, data->attr[i].md5);
+                            }
+                        }
+                    }
+                }
+            } else {
+                uint32_t i;
+                const SRAMgr* mgr;
+
+                (*found)->files_count = sizeof(data->attr) / sizeof(data->attr[0]) * 2;
+                if( (rc = FileOptions_Make(&(*found)->files, (*found)->files_count)) == 0 &&
+                    (rc = SRAList_Mgr(&mgr)) == 0 ) {
+                    for(i = 0; rc == 0 && i < sizeof(data->attr) / sizeof(data->attr[0]); i++) {
+                        if( (rc = FileOptions_SRAArchiveInstant(&(*found)->files[i * 2], &(*found)->files[i * 2 + 1],
+                           mgr, (*found)->accession, (*found)->path,
+                           data->attr[i].type == eSRAFuseFmtArcLite, data->timestamp, data->attr[i].size, data->attr[i].md5)) == 0 ) {
+                            DEBUG_LINE(10, "added %s %lu %s", (*found)->accession, data->attr[i].size, data->attr[i].md5);
+                        }
+                    }
+                }
+            }
+            if( rc == 0 ) {
+                (*found)->mtime = data->timestamp;
+                DEBUG_LINE(10, "set %s timestamp %lu", (*found)->accession, (*found)->mtime);
+            } else if( data->accession == NULL ) {
+                FREE(*found);
+            }
+        }
+        SRAList_Unlock();
+    }
+    return rc;
+}
+
+static
+rc_t SRAListNode_MakeXML(const KXMLNode* xml_node, SRAListNode_FindData* data, char* errmsg, const char* rel_path, EXMLValidate validate)
+{
+    rc_t rc = 0;
+
+    if( xml_node == NULL || data == NULL ) {
+        rc = RC(rcExe, rcTable, rcConstructing, rcParam, rcNull);
+    } else {
+        uint32_t i, has_attrs = 0;
+        if( (rc = KXMLNodeReadAttrCStr(xml_node, "accession", &data->accession, NULL)) != 0 || data->accession[0] == '\0') {
+            strcpy(errmsg, "attribute 'accession'");
+            rc = rc ? rc : RC(rcExe, rcDoc, rcValidating, rcDirEntry, rcInvalid);
+        }
+        if( rc == 0 ) {
+            data->timestamp = 0;
+            if( (rc = XML_ParseTimestamp(xml_node, "timestamp", &data->timestamp, true)) != 0 ) {
+                strcpy(errmsg, "attribute 'timestamp'");
+            } else if( data->timestamp != 0 ) {
+                has_attrs++;
+            }
+        }
+        for(i = 0; rc == 0 && i < sizeof(data->attr) / sizeof(data->attr[0]); i++) {
+            size_t num_read;
+            char b[128];
+
+            if( (rc = string_printf(b, sizeof(b) - 1, NULL, "md5%s", data->attr[i].ext)) == 0 ) {
+                if( (rc = KXMLNodeReadAttrCString(xml_node, b, data->attr[i].md5, sizeof(data->attr[i].md5), &num_read)) == 0 ) {
+                    has_attrs++;
+                    if( num_read != sizeof(data->attr[i].md5) - 1) {
+                        rc = RC(rcExe, rcDoc, rcValidating, rcChecksum, rcInvalid);
+                    }
+                } else if( GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound ) {
+                    rc = 0;
+                }
+            }
+            if( rc != 0 ) {
+                strcpy(errmsg, "attribute 'md5");
+                strcat(errmsg, data->attr[i].ext);
+                strcat(errmsg, "'");
+            } else {
+                if( (rc = string_printf(b, sizeof(b) - 1, NULL, "size%s", data->attr[i].ext)) == 0 ) {
+                    if( (rc = KXMLNodeReadAttrCString(xml_node, b, b, sizeof(b), &num_read)) == 0 ) {
+                        char* end;
+                        has_attrs++;
+                        data->attr[i].size = strtou64(b, &end, 10);
+                        if( end - b != num_read ) {
+                            rc = RC(rcExe, rcDoc, rcValidating, rcSize, rcInvalid);
+                        }
+                    } else if( GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound ) {
+                        rc = 0;
+                    }
+                }
+                if( rc != 0 ) {
+                    strcpy(errmsg, "attribute 'size");
+                    strcat(errmsg, data->attr[i].ext);
+                    strcat(errmsg, "'");
+                }
+            }
+        }
+        if( rc == 0 && has_attrs != 0 && has_attrs != 3 && has_attrs != 5 ) {
+            if( validate > eXML_NoFail ) {
+                rc = RC(rcExe, rcDoc, rcValidating, rcDirEntry, rcInvalid);
+            } else {
+                data->timestamp = 0;
+                PLOGMSG(klogErr, (klogErr, "SRA node $(a) attributes incomplete", "a=%s", data->accession));
+            }
+        }
+        if( rc == 0 ) {
+            if( (rc = KXMLNodeReadAttrCStr(xml_node, "path", &data->path, "")) == 0 ) {
+                if( data->path[0] == '\0' ) {
+                    free(data->path);
+                    data->path = NULL;
+                } else {
+                    KDirectory* dir = NULL;
+                    if( (rc = KDirectoryNativeDir(&dir)) == 0 ) {
+                        char resolved[4096];
+                        size_t num_writ;
+                        if( data->path[0] == '/' ) {
+                            rc = string_printf(resolved, sizeof(resolved), &num_writ, "%s", data->path);
+                        } else if( (rc = KDirectoryResolvePath(dir, true, resolved, sizeof(resolved),
+                                                                      "%s%s", rel_path, data->path)) == 0 ) {
+                            DEBUG_LINE(8, "%s%s resolved to %s", rel_path, data->path, resolved);
+                        }
+                        if( rc == 0 && validate > eXML_NoCheck ) {
+                            uint32_t typ = KDirectoryPathType(dir, resolved);
+                            if( typ != kptDir && typ != (kptDir | kptAlias) &&
+                                typ != kptFile && typ != (kptFile | kptAlias)) {
+                                if( validate > eXML_NoFail ) {
+                                    rc = RC(rcExe, rcDoc, rcValidating, rcDirEntry, typ == kptNotFound ? rcNotFound : rcInvalid);
+                                } else {
+                                    PLOGMSG(klogErr, (klogErr, "SRA path '$(p)' not found", "p=%s", resolved));
+                                }
+                            }
+                        }
+                        if( rc == 0 ) {
+                            free(data->path);
+                            rc = StrDup(resolved, &data->path);
+                        }
+                        ReleaseComplain(KDirectoryRelease, dir);
+                    }
+                }
+            }
+        }
+        if( rc == 0 ) {
+            struct KNamelist const* attr = NULL;
+            if( (rc = KXMLNodeListAttr(xml_node, &attr)) == 0 ) {
+                uint32_t i = 0, count = 0;
+                if( (rc = KNamelistCount(attr, &count)) == 0 && count > 0 ) {
+                    while( rc == 0 && i < count ) {
+                        const char *attr_nm = NULL;
+                        if( (rc = KNamelistGet(attr, i++, &attr_nm)) != 0 ) {
+                            break;
+                        }
+                        if( strcmp("path", attr_nm) == 0 || strcmp("accession", attr_nm) == 0 ||
+                            strcmp("timestamp", attr_nm) == 0 ||
+                            strncmp("md5.", attr_nm, 4) == 0 || strncmp("size.", attr_nm, 5) == 0 ) {
+                            continue;
+                        }
+                        rc = RC(rcExe, rcDoc, rcValidating, rcDirEntry, rcInvalid);
+                        strcpy(errmsg, "unknown attribute '");
+                        strcat(errmsg, attr_nm);
+                        strcat(errmsg, "'");
+                    }
+                }
+                ReleaseComplain(KNamelistRelease, attr);
+            }
+        }
+    }
+    return rc;
+}
+
+rc_t SRAListNode_Make(const KXMLNode* xml_node, FSNode* parent, SRAConfigFlags flags, char* errmsg,
+                      const char* rel_path, EXMLValidate validate)
+{
+    rc_t rc = 0;
+
+    if( xml_node == NULL || parent == NULL || errmsg == NULL || rel_path == NULL ) {
+        rc = RC(rcExe, rcTable, rcUpdating, rcParam, rcNull);
+    } else {
+        SRAListNode_FindData data;
+        memset(&data, 0, sizeof(data));
+        data.attr[0].ext = ".sra";
+        data.attr[0].type = eSRAFuseFmtArc;
+        data.attr[1].ext = ".lite.sra";
+        data.attr[1].type = eSRAFuseFmtArcLite;
+        if( (rc = SRAListNode_MakeXML(xml_node, &data, errmsg, rel_path, validate)) == 0 ) {
+            SRAListNode* found;
+            if( (rc = SRAListNode_Insert(&data, g_version + 1, &found)) == 0 ) {
+                FSNode* d = parent;
+                if( flags & eSRAFuseRunDir ) {
+                    if( (rc = SRADirectoryNode_Make(&d, found->accession, found)) == 0 ) {
+                        if( (rc = FSNode_AddChild(parent, d)) != 0 ) {
+                            FSNode_Release(d);
+                        }
+                    }
+                }
+                if( rc == 0 ) {
+                    rc = SRANode_Make(d, found->accession, found, flags);
+                }
+            }
+            SRAListNode_Release(found);
+        }
+        free(data.accession);
+        free(data.path);
+    }
+    return rc;
+}
+
+static
+rc_t SRAListNode_Update(SRAListNode* self, KTime_t now)
+{
+    rc_t rc = 0;
+    KTime_t ts = 0;
+    /* weekly forced update */
+    bool forced = now != 0 && (now - self->utime) > (60*24*60*60) && self->utime != 0 /* not new */;
+
+    if( (self->mtime == 0 || now != 0) && (rc = SRAListNode_TableMTime(self, &ts)) == 0 ) {
+        if( self->mtime != ts || forced ) {
+            const SRATable* tbl = NULL;
+            FileOptions* new_files = NULL, *old_files = NULL;
+            uint32_t new_files_count = 0;
+            PLOGMSG(klogInfo, (klogInfo, "Updating sra node, self->mtime = $(mtime), self->utime = $(utime), ts = $(ts), now = $(now), forced = $(forced)",
+                        PLOG_5(PLOG_I64(mtime), PLOG_I64(utime), PLOG_I64(ts), PLOG_I32(forced), PLOG_I64(now)),
+                        (long long)self->mtime,
+                        (long long)self->utime,
+                        (long long)ts,
+                        (int)forced,
+                        (long long)now)
+                    );
+            if( (rc = SRAListNode_TableOpen(self, &tbl)) == 0 ) {
+                const KMDataNode* meta = NULL;
+                if( SRATableOpenMDataNodeRead(tbl, &meta, "/FUSE/root/File") != 0 ) {
+                    rc = SRATableOpenMDataNodeRead(tbl, &meta, "/FUSE");
+                }
+                if( rc == 0 ) {
+                    struct KNamelist* files = NULL;
+                    DEBUG_LINE(10, "Opened SRA table meta %s '%s'", self->accession, self->path);
+                    if( (rc = KMDataNodeListChild(meta, &files)) == 0 ) {
+                        uint32_t files_count = 0;
+                        if( (rc = KNamelistCount(files, &files_count)) == 0 && files_count > 0 ) {
+                            new_files_count = (2 + files_count) * 2; /* (2 are for .sra types + count in meta) + md5 for each in list */
+                            if( (rc = FileOptions_Make(&new_files, new_files_count)) == 0 ) {
+                                uint32_t f = 0;
+                                new_files_count = 4; /* step down for 2 .sra + md5 for them */
+                                while( rc == 0 && f < files_count ) {
+                                    const char *suffix = NULL;
+                                    if( (rc = KNamelistGet(files, f, &suffix)) == 0 ) {
+                                        const KMDataNode* fn = NULL;
+                                        if( (rc = KMDataNodeOpenNodeRead(meta, &fn, suffix)) == 0 ) {
+                                            DEBUG_LINE(10, "Adding %s file type '%s'", self->accession, suffix);
+                                            if( (rc = FileOptions_ParseMeta(&new_files[new_files_count], fn, tbl, ts, suffix)) != 0 ) {
+                                                PLOGERR(klogErr, (klogErr, rc, " node '$(f)'", PLOG_S(f), suffix));
+                                                rc = 0;
+                                            } else {
+                                                if( new_files[new_files_count].md5[0] != '\0' ) {
+                                                    if( (rc = FileOptions_AttachMD5(&new_files[new_files_count],
+                                                                self->accession, &new_files[new_files_count + 1])) != 0 ||
+                                                        (rc = FileOptions_UpdateMD5(&new_files[new_files_count], self->accession)) != 0) {
+                                                        PLOGERR(klogErr, (klogErr, rc, " node md5 '$(f)'", PLOG_S(f), suffix));
+                                                        rc = 0;
+                                                    } else {
+                                                        new_files_count++;
+                                                    }
+                                                }
+                                                new_files_count++;
+                                            }
+                                        }
+                                        f++;
+                                        ReleaseComplain(KMDataNodeRelease, fn);
+                                    }
+                                }
+                            }
+                        }
+                        ReleaseComplain(KNamelistRelease, files);
+                    }
+                    ReleaseComplain(KMDataNodeRelease, meta);
+                } else {
+                    PLOGMSG(klogWarn, (klogWarn, "FUSE meta block not found in '$(t)'", PLOG_S(t), self->accession));
+                    rc = 0;
+                }
+                if( rc == 0 ) {
+                    if( new_files_count == 0 ) {
+                        /* for 2 .sra types + its .md5's */
+                        new_files_count = 4;
+                        rc = FileOptions_Make(&new_files, new_files_count);
+                    }
+                    if( rc == 0 ) {
+                        /* add information for sra archives */
+                        DEBUG_LINE(10, "Adding SRA archive type %s and its .md5", self->accession);
+                        if( (rc = FileOptions_SRAArchive(&new_files[0], tbl, ts, false)) == 0 &&
+                            (rc = FileOptions_AttachMD5(&new_files[0], self->accession, &new_files[1])) == 0 ) {
+                            DEBUG_LINE(10, "Adding SRA lite archive type %s and its .md5", self->accession);
+                            if( (rc = FileOptions_SRAArchive(&new_files[2], tbl, ts, true)) == 0 ) {
+                                rc = FileOptions_AttachMD5(&new_files[2], self->accession, &new_files[3]);
+                            }
+                        }
+                    }
+                }
+                ReleaseComplain(SRATableRelease, tbl);
+            }
+            old_files = new_files;
+            if( rc == 0 ) {
+                SRAQueueNode* q;
+                MALLOC(q, sizeof(*q));
+                if( q == NULL ) {
+                    rc = RC(rcExe, rcTable, rcUpdating, rcMemory, rcExhausted);
+                } else if( (rc = SRAList_Lock(true)) == 0 ) {
+                    if( self->mtime != ts || forced ) {
+                        self->mtime = ts;
+                        old_files = self->files;
+                        self->files = new_files;
+                        self->files_count = new_files_count;
+#if 0
+                        if( self->utime != 0 /* not new */ && g_queue_cond != NULL && (rc = SRAList_Queue_Lock()) == 0 ) {
+                            SRAListNode_AddRef(self);
+                            q->node = self;
+                            q->mtime = self->mtime;
+                            SLListPushTail(&g_queue, &q->dad);
+                            g_queue_depth++;
+                            KConditionSignal(g_queue_cond);
+                            SRAList_Queue_Unlock();
+                            q = NULL;
+                            DEBUG_LINE(10, "%s table queued for async update, queue %lu", self->accession, g_queue_depth);
+                        }
+#endif
+                        self->utime = now ? now : time(NULL);
+                    }
+                    SRAList_Unlock();
+                    DEBUG_LINE(10, "%s table updated %lu %lu", self->accession, self->mtime, self->utime);
+                }
+                FREE(q);
+            }
+            FileOptions_Release(old_files);
+        } else {
+            DEBUG_LINE(10, "%s table is up-to-date: %lu, updated %lu, now %lu",
+                           self->accession, self->mtime, self->utime, time(NULL));
+            rc = RC(rcExe, rcTable, rcUpdating, rcMessage, rcCanceled);
+        }
+    }
+    if( rc != 0 && GetRCState(rc) != rcCanceled ) {
+        PLOGERR(klogErr, (klogErr, rc, "SRA refresh $(a)", PLOG_S(a), self->accession));
+    }
+    return rc;
+}
+
+typedef struct SRAListNode_UpdateData_struct {
+    rc_t rc;
+    KTime_t now;
+    KFile* file;
+    uint64_t pos;
+    uint32_t qty, recs;
+} SRAListNode_UpdateData;
+
+static
+bool SRAListNode_Updater(BSTNode* node, void* data)
+{
+    SRAListNode* n = (SRAListNode*)node;
+    SRAListNode_UpdateData* d = (SRAListNode_UpdateData*)data;
+
+    if( n->version >= g_version ) {
+        if( SRAListNode_Update(n, d->now) == 0 ) {
+            d->qty = d->qty + 1;
+        }
+    }
+    if( d->file != NULL ) {
+        size_t num_writ;
+        uint16_t acc_sz = n->accession ? strlen(n->accession) : 0;
+        uint16_t path_sz = n->path ? strlen(n->path) : 0;
+
+        if( d->recs++ == 0 ) {
+            if( (d->rc = KFileWrite(d->file, d->pos, &g_cache_version, sizeof(g_cache_version), &num_writ)) == 0 ) {
+                d->pos += num_writ;
+            }
+        }
+        if( (d->rc = KFileWrite(d->file, d->pos, &acc_sz, sizeof(acc_sz), &num_writ)) == 0 ) {
+            d->pos += num_writ;
+            if( (d->rc = KFileWrite(d->file, d->pos, n->accession, acc_sz, &num_writ)) == 0 ) {
+                d->pos += num_writ;
+            }
+        }
+        if( (d->rc = KFileWrite(d->file, d->pos, &path_sz, sizeof(path_sz), &num_writ)) == 0 ) {
+            d->pos += num_writ;
+            if( (d->rc = KFileWrite(d->file, d->pos, n->path, path_sz, &num_writ)) == 0 ) {
+                d->pos += num_writ;
+            }
+        }
+        if( (d->rc = KFileWrite(d->file, d->pos, &n->files_count, sizeof(n->files_count), &num_writ)) == 0 ) {
+            d->pos += num_writ;
+            if( n->files_count > 0 &&
+                (d->rc = KFileWrite(d->file, d->pos, n->files, n->files_count * sizeof(*(n->files)), &num_writ)) == 0 ) {
+                d->pos += num_writ;
+            }
+        }
+        if( (d->rc = KFileWrite(d->file, d->pos, &n->mtime, sizeof(n->mtime), &num_writ)) == 0 ) {
+            d->pos += num_writ;
+        }
+        if( (d->rc = KFileWrite(d->file, d->pos, &n->utime, sizeof(n->utime), &num_writ)) == 0 ) {
+            d->pos += num_writ;
+        }
+        /* a'la validation: write record id */
+        if( (d->rc = KFileWrite(d->file, d->pos, &d->recs, sizeof(d->recs), &num_writ)) == 0 ) {
+            d->pos += num_writ;
+        }
+    }
+    return g_sync == 0;
+}
+
+void SRAList_PostRefresh()
+{
+    if (pthread_cond_signal(&g_refresh_cond) == -1)
+        assert(0);
+}
+
+static
+rc_t SRAList_Thread(const KThread *self, void *data)
+{
+
+    PLOGMSG(klogInfo, (klogInfo, "SRA sync thread started with $(s) sec", PLOG_U32(s), g_sync));
+    while( g_sync > 0 ) {
+        KDirectory* dir = NULL;
+        SRAListNode_UpdateData data;
+        struct timespec timeout = {0};
+        if (clock_gettime(CLOCK_REALTIME, &timeout) == -1)
+            assert(0);
+        timeout.tv_sec += g_sync;
+        if (pthread_mutex_lock(&g_refresh_mutex) != 0)
+            assert(0);
+        switch (pthread_cond_timedwait(&g_refresh_cond, &g_refresh_mutex, &timeout))
+        {
+            case 0:
+            case ETIMEDOUT:
+                break;
+            default:
+                assert(0);
+        }
+        if (pthread_mutex_unlock(&g_refresh_mutex) != 0)
+            assert(0);
+        LOGMSG(klogInfo, "Begin refreshing sra list");
+        if( g_lock == NULL ) {
+            break;
+        }
+        memset(&data, 0, sizeof(data));
+        data.now = time(NULL);
+        DEBUG_LINE(10, "SRA sync thread with %u sec, updating version %u @ %lu", g_sync, g_version, data.now);
+        if( g_cache_file != NULL ) {
+            DEBUG_LINE(10, "SRA sync thread writing cache file %s", g_cache_file_tmp);
+            if( (data.rc = KDirectoryNativeDir(&dir)) == 0 ) {
+                data.rc = KDirectoryCreateFile(dir, &data.file, false, 0644, kcmInit, "%s", g_cache_file_tmp);
+            }
+            if( data.rc != 0 ) {
+                data.file = NULL;
+                PLOGERR(klogErr, (klogErr, data.rc, "SRA cache file $(s)", PLOG_S(s), g_cache_file_tmp));
+            }
+        }
+        SRAListNode_KConfigReload();
+        /* scan in reverse to avoid reading threads following update */
+        BSTreeDoUntil(&g_list, true, SRAListNode_Updater, &data);
+        if( data.qty > 0 ) {
+            PLOGMSG(klogInfo, (klogInfo, "SRA sync updated $(q) runs", PLOG_U32(q), data.qty));
+        } else {
+            DEBUG_LINE(10, "SRA sync updated %u runs", data.qty);
+        }
+        if( data.file != NULL ) {
+            rc_t rc;
+            ReleaseComplain(KFileRelease, data.file);
+            rc = KDirectoryRename(dir, true, g_cache_file_tmp, g_cache_file);
+            ReleaseComplain(KDirectoryRelease, dir);
+            data.rc = data.rc ? data.rc : rc;
+            if( data.rc != 0 ) {
+                PLOGERR(klogErr, (klogErr, data.rc, "writing SRA cache file $(s) $(n) records", PLOG_2(PLOG_S(s),PLOG_U32(n)), g_cache_file, data.recs));
+            } else {
+                PLOGMSG(klogInfo, (klogInfo, "created SRA cache file $(s) $(n) records", PLOG_2(PLOG_S(s),PLOG_U32(n)), g_cache_file, data.recs));
+            }
+        }
+    }
+    PLOGMSG(klogInfo, (klogInfo, "SRA sync thread ended v$(s)", PLOG_U64(s), g_version));
+    return 0;
+}
+
+static
+rc_t SRAList_Queue(const KThread *self, void *data)
+{
+    LOGMSG(klogInfo, "SRA queue thread started");
+    while( g_queue_cond != NULL ) {
+        DEBUG_LINE(10, "SRA queue %s", "running");
+        do {
+            SRAQueueNode* q = NULL;
+            if( SRAList_Queue_Lock() == 0 ) {
+                if( g_queue_depth > 0 ) {
+                    q = (SRAQueueNode*)SLListPopHead(&g_queue);
+                    g_queue_depth--;
+                }
+                SRAList_Queue_Unlock();
+                if( q != NULL ) {
+                    if( SRAList_Lock(false) == 0 ) {
+                        PLOGMSG(klogInfo, (klogInfo, "SRA queue $(s) updating", PLOG_S(s), q->node->accession));
+                        if( atomic32_read(&q->node->refcount) == 1 ) {
+                            /* restore value of release below will go negative and leak */
+                            DEBUG_LINE(10, "SRA queue %s dropped - not updated", q->node->accession);
+                        } else if( q->node->mtime == q->mtime ) {
+                            /* update only if not changed since it was put into queue */
+                            uint32_t i, count = q->node->files_count;
+                            FileOptions* opt;
+                            if( FileOptions_Clone(&opt, q->node->files, count) == 0 ) {
+                                SRAList_Unlock();
+                                for(i = 0; i < count; i++) {
+                                    if( opt[i].md5_file != 0 ) {
+                                        rc_t rc = FileOptions_CalcMD5(&opt[i], q->node->accession, q->node);
+                                        if( rc != 0 ) {
+                                            PLOGERR(klogErr, (klogErr, rc, "SRA queue $(s) while obtaining md5",
+                                                PLOG_S(s), q->node->accession));
+                                        } else if( (rc = FileOptions_UpdateMD5(&opt[i], q->node->accession)) != 0 ) {
+                                            PLOGERR(klogErr, (klogErr, rc, "SRA queue $(s) while assigning md5",
+                                                PLOG_S(s), q->node->accession));
+                                        }
+                                    }
+                                }
+                                if( SRAList_Lock(true) == 0 && q->node->mtime == q->mtime ) {
+                                    /* actual update if not changed */
+                                    FREE(q->node->files);
+                                    q->node->files = opt;
+                                    q->node->files_count = count;
+                                    PLOGMSG(klogInfo, (klogInfo, "SRA queue $(s) updated", PLOG_S(s), q->node->accession));
+                                } else {
+                                    FREE(opt);
+                                    DEBUG_LINE(10, "SRA queue %s changed during - not updated", q->node->accession);
+                                }
+                            }
+                        } else {
+                            DEBUG_LINE(10, "SRA queue %s changed - not updated", q->node->accession);
+                        }
+                        SRAList_Unlock();
+                        SRAListNode_Release(q->node);
+                        FREE(q);
+                    }
+                } else {
+                    break;
+                }
+            }
+        } while( g_queue_cond != NULL );
+        if( g_queue_cond != NULL ) {
+            DEBUG_LINE(10, "SRA queue %s", "waiting");
+            SRAList_Queue_Lock();
+            KConditionWait(g_queue_cond, g_queue_lock);
+            SRAList_Queue_Unlock();
+        }
+    }
+    LOGMSG(klogInfo, "SRA queue thread ended");
+    return 0;
+}
+
+rc_t SRAList_Make(KDirectory* dir, unsigned int seconds, const char* cache_path)
+{
+    rc_t rc = 0;
+    BSTreeInit(&g_list);
+    SLListInit(&g_queue);
+    g_sync = seconds;
+
+    assert(dir != NULL);
+
+    if( cache_path != NULL ) {
+        char buf[4096];
+        size_t len;
+        const char* path, *slash = strrchr(cache_path, '/');
+
+        if( slash == NULL ) {
+            slash = cache_path;
+            path = ".";
+            len = 1;
+        } else {
+            path = cache_path;
+            len = slash++ - cache_path;
+        }
+        if( (rc = KDirectoryResolvePath(dir, true, buf, 4096, "%.*s", len, path)) == 0 ) {
+            size_t i = strlen(buf) - 1;
+            while( buf[i] == '.' || buf[i] == '/' ) {
+                i--;
+            }
+            if( i + 2 + strlen(slash) + 4 > sizeof(buf) ) {
+                rc = RC(rcExe, rcPath, rcConstructing, rcBuffer, rcInsufficient);
+            } else {
+                buf[++i] = '/';
+                buf[++i] = '\0';
+                strcat(buf, slash);
+                if( (rc = StrDup(buf, &g_cache_file)) == 0 ) {
+                    DEBUG_LINE(10, "SRA cache file path set to '%s'", g_cache_file);
+                    strcat(buf, ".tmp");
+                    if( (rc = StrDup(buf, &g_cache_file_tmp)) == 0 ) {
+                        DEBUG_LINE(10, "SRA tmp cache file path set to '%s'", g_cache_file_tmp);
+                    }
+                }
+            }
+        }
+    }
+    return rc;
+}
+
+void SRAList_Init(void)
+{
+    rc_t rc = 0;
+
+    if( g_lock == NULL && (rc = KRWLockMake(&g_lock)) != 0 ) {
+        g_lock = NULL;
+        LOGERR(klogErr, rc, "SRA lock");
+    }
+    if( g_queue_cond == NULL && (rc = KConditionMake(&g_queue_cond)) != 0 ) {
+        g_queue_cond = NULL;
+        LOGERR(klogErr, rc, "SRA queue condition");
+    } else if( g_queue_lock == NULL && (rc = KLockMake(&g_queue_lock)) != 0 ) {
+        g_queue_lock = NULL;
+        LOGERR(klogErr, rc, "SRA queue lock");
+    }
+    if( g_cache_file != NULL ) {
+        /* try to load cache */
+        KDirectory* dir = NULL;
+
+        if( (rc = KDirectoryNativeDir(&dir)) == 0 ) {
+            const KFile* f;
+            uint32_t recs = 0;
+
+            if( (rc = KDirectoryOpenFileRead(dir, &f, "%s", g_cache_file)) == 0 ) {
+                uint64_t pos = 0;
+                uint32_t ver = 0, recid;
+                uint16_t obj_sz;
+                size_t num_read = 0;
+                SRAListNode_FindData data;
+                SRAListNode* found;
+
+                assert(sizeof(ver) == sizeof(g_cache_version));
+                do {
+                    memset(&data, 0, sizeof(data));
+                    if( pos == 0 ) {
+                        if( (rc = KFileRead(f, pos, &ver, sizeof(ver), &num_read)) != 0 ||
+                            num_read != sizeof(ver) || ver == 0 || ver > g_cache_version ) {
+                                rc = rc ? rc : RC(rcExe, rcTable, rcReading, rcData,
+                                                  ver != g_cache_version ? rcBadVersion : rcTooShort);
+                            break;
+                        }
+                        pos += num_read;
+                    }
+                    if( (rc = KFileRead(f, pos, &obj_sz, sizeof(obj_sz), &num_read)) != 0 || num_read != sizeof(obj_sz) ) {
+                        if( num_read != 0 ) {
+                            /* if num_read is 0 than it is proper EOF */
+                            rc = rc ? rc : RC(rcExe, rcTable, rcReading, rcData, rcTooShort);
+                        }
+                        break;
+                    }
+                    pos += num_read;
+                    MALLOC(data.accession, obj_sz + 1);
+                    if( data.accession == NULL ) {
+                        rc = RC(rcExe, rcTable, rcReading, rcMemory, rcExhausted);
+                        break;
+                    }
+                    if( (rc = KFileRead(f, pos, data.accession, obj_sz, &num_read)) != 0 || num_read != obj_sz ) {
+                        rc = rc ? rc : RC(rcExe, rcTable, rcReading, rcData, rcTooShort);
+                        break;
+                    }
+                    data.accession[obj_sz] = '\0';
+                    pos += num_read;
+                    if( (rc = KFileRead(f, pos, &obj_sz, sizeof(obj_sz), &num_read)) != 0 || num_read != sizeof(obj_sz) ) {
+                        rc = rc ? rc : RC(rcExe, rcTable, rcReading, rcData, rcTooShort);
+                        break;
+                    }
+                    pos += num_read;
+                    if( obj_sz > 0 ) {
+                        MALLOC(data.path, obj_sz + 1);
+                        if( data.path == NULL ) {
+                            rc = RC(rcExe, rcTable, rcReading, rcMemory, rcExhausted);
+                            break;
+                        }
+                        if( (rc = KFileRead(f, pos, data.path, obj_sz, &num_read)) != 0 || num_read != obj_sz ) {
+                            rc = rc ? rc : RC(rcExe, rcTable, rcReading, rcData, rcTooShort);
+                            break;
+                        }
+                        data.path[obj_sz] = '\0';
+                        pos += num_read;
+                    }
+                    if( (rc = SRAListNode_Insert(&data, 0, &found)) != 0 ) {
+                        break;
+                    } else if( (rc = SRAList_Lock(true)) == 0 ) {
+                        do {
+                            obj_sz = sizeof(found->files_count);
+                            if( (rc = KFileRead(f, pos, &found->files_count, obj_sz, &num_read)) != 0 || num_read != obj_sz ) {
+                                rc = rc ? rc : RC(rcExe, rcTable, rcReading, rcData, rcTooShort);
+                                break;
+                            }
+                            pos += num_read;
+                            if( found->files_count > 0 ) {
+                                if( ver < 4 ) {
+                                    /* size was different for older version */
+                                    obj_sz = sizeof(FileOptionsOld) * found->files_count;
+                                    
+                                } else {
+                                    obj_sz = sizeof(*found->files) * found->files_count;
+                                }
+                                MALLOC(found->files, obj_sz);
+                                if( found->files == NULL ) {
+                                    rc = RC(rcExe, rcTable, rcReading, rcMemory, rcExhausted);
+                                    break;
+                                }
+                                if( (rc = KFileRead(f, pos, found->files, obj_sz, &num_read)) != 0 || num_read != obj_sz ) {
+                                    rc = rc ? rc : RC(rcExe, rcTable, rcReading, rcData, rcTooShort);
+                                    break;
+                                }
+                                pos += num_read;
+                                if( ver < 4 ) {
+                                    FileOptionsOld* fOld = (FileOptionsOld*)found->files;
+                                    if( (rc = FileOptions_Make(&found->files, found->files_count)) != 0 ) {
+                                        FREE(fOld);
+                                        break;
+                                    } else {
+                                        uint32_t i;
+                                        /* old struct size */
+                                        obj_sz = sizeof(FileOptionsOld);
+                                        for(i = 0; i < found->files_count; i++ ) {
+                                            memcpy(&found->files[i], &fOld[i], obj_sz);
+                                            memset(found->files[i].md5, 0, sizeof(found->files[i].md5));
+                                            found->files[i].md5_file = 0;
+                                        }
+                                        FREE(fOld);
+                                    }
+                                }
+                            }
+                            obj_sz = sizeof(found->mtime);
+                            if( (rc = KFileRead(f, pos, &found->mtime, obj_sz, &num_read)) != 0 || num_read != obj_sz ) {
+                                rc = rc ? rc : RC(rcExe, rcTable, rcReading, rcData, rcTooShort);
+                                break;
+                            }
+                            pos += num_read;
+                            if( ver >= 3 ) {
+                                obj_sz = sizeof(found->utime);
+                                if( (rc = KFileRead(f, pos, &found->utime, obj_sz, &num_read)) != 0 || num_read != obj_sz ) {
+                                    rc = rc ? rc : RC(rcExe, rcTable, rcReading, rcData, rcTooShort);
+                                    break;
+                                }
+                                pos += num_read;
+                            }
+                            SRAList_Unlock();
+                            if( ver == 1 ) {
+                                KTime_t l;
+                                obj_sz = sizeof(l);
+                                if( (rc = KFileRead(f, pos, &l, obj_sz, &num_read)) != 0 || num_read != obj_sz ) {
+                                    rc = rc ? rc : RC(rcExe, rcTable, rcReading, rcData, rcTooShort);
+                                    break;
+                                }
+                                pos += num_read;
+                            }
+                            obj_sz = sizeof(recid);
+                            if( (rc = KFileRead(f, pos, &recid, obj_sz, &num_read)) != 0 || num_read != obj_sz ) {
+                                rc = rc ? rc : RC(rcExe, rcTable, rcReading, rcData, rcTooShort);
+                                break;
+                            }
+                            pos += num_read;
+                            if( ++recs != recid ) {
+                                rc = RC(rcExe, rcTable, rcReading, rcData, rcInconsistent);
+                                break;
+                            }
+                        } while(false);
+                    }
+                    FREE(data.accession);
+                    FREE(data.path);
+                    SRAListNode_Release(found);
+                } while(rc == 0);
+                ReleaseComplain(KFileRelease, f);
+            } else if( GetRCState(rc) == rcNotFound ) {
+                rc = 0;
+            }
+            if( rc != 0 ) {
+                PLOGERR(klogErr, (klogErr, rc, "reading SRA cache file $(s) $(n) records",
+                        PLOG_2(PLOG_S(s),PLOG_U32(n)), g_cache_file, recs));
+            } else if( recs > 0 ) {
+                PLOGMSG(klogInfo, (klogInfo, "loaded SRA cache file $(s) $(n) records",
+                        PLOG_2(PLOG_S(s),PLOG_U32(n)), g_cache_file, recs));
+            }
+            ReleaseComplain(KDirectoryRelease, dir);
+        }
+    }
+    if( g_lock != NULL ) {
+        if( g_sync > 0 && (rc = KThreadMake(&g_thread, SRAList_Thread, NULL)) != 0 ) {
+            LOGERR(klogErr, rc, "SRA sync thread");
+        }
+        if( g_queue_cond != NULL && g_queue_lock != NULL &&
+            (rc = KThreadMake(&g_queue_thread, SRAList_Queue, NULL)) != 0 ) {
+            LOGERR(klogErr, rc, "SRA queue thread");
+        }
+    }
+}
+
+void SRAList_Fini(void)
+{
+    g_sync = 0;
+    if( g_thread != NULL ) {
+        ReleaseComplain(KThreadCancel, g_thread);
+        ReleaseComplain(KThreadRelease, g_thread);
+    }
+    if( g_queue_thread != NULL ) {
+        KCondition* x = g_queue_cond;
+        g_queue_cond = NULL;
+        SRAList_Queue_Lock();
+        KConditionSignal(x);
+        SRAList_Queue_Unlock();
+        ReleaseComplain(KThreadCancel, g_queue_thread);
+        ReleaseComplain(KThreadRelease, g_queue_thread);
+        g_queue_cond = x;
+        g_queue_thread = NULL;
+    }
+    ReleaseComplain(KConditionRelease, g_queue_cond);
+    ReleaseComplain(KLockRelease, g_queue_lock);
+    pthread_cond_destroy(&g_refresh_cond);
+    pthread_mutex_destroy(&g_refresh_mutex);
+    if( g_lock != NULL ) {
+        SRAList_Lock(true);
+    }
+    BSTreeWhack(&g_list, SRAList_Whack, NULL);
+    SLListWhack(&g_queue, SRAQueue_Whack, NULL);
+    if( g_lock != NULL ) {
+        SRAList_Unlock();
+        ReleaseComplain(KRWLockRelease, g_lock);
+    }
+    ReleaseComplain(SRAMgrRelease, g_sra_mgr);
+    ReleaseComplain(KLockRelease, g_sra_mgr_lock);
+    FREE(g_cache_file);
+    FREE(g_cache_file_tmp);
+
+    g_queue_cond = NULL;
+    g_queue_lock = NULL;
+    g_version = 0;
+    g_lock = NULL;
+    g_thread = NULL;
+    g_sra_mgr = NULL;
+}
+
+rc_t SRAListNode_GetType(const SRAListNode* cself, SRAConfigFlags flags, const char* suffix, const FileOptions** options)
+{
+    rc_t rc = 0;
+    if( cself == NULL || suffix == NULL || options == NULL ) {
+        rc = RC(rcExe, rcTable, rcSearching, rcParam, rcNull);
+    } else {
+        if( (rc = SRAListNode_Update((SRAListNode*)cself, 0)) == 0 || GetRCState(rc) == rcCanceled ) {
+            DEBUG_LINE(10, "'%s'", suffix);
+            if( (rc = SRAList_Lock(false)) == 0 ) {
+                size_t i;
+                *options = NULL;
+                for(i = 0; i < cself->files_count; i++) {
+                    if( (cself->files[i].type & flags) && strcmp(suffix, cself->files[i].suffix) == 0 ) {
+                        *options = &cself->files[i];
+                        break;
+                    }
+                }
+                SRAList_Unlock();
+            }
+        }
+    }
+    if( rc == 0 && *options == NULL ) {
+        rc = RC(rcExe, rcTable, rcSearching, rcName, rcNotFound);
+    }
+    return rc;
+}
+
+rc_t SRAListNode_ListFiles(const SRAListNode* cself, const char* prefix, int types, FSNode_Dir_Visit func, void* data)
+{
+    rc_t rc = 0;
+    if( cself == NULL ) {
+        rc = RC(rcExe, rcTable, rcListing, rcSelf, rcNull);
+    } else {
+        if( (rc = SRAListNode_Update((SRAListNode*)cself, 0)) == 0 || GetRCState(rc) == rcCanceled ) {
+            DEBUG_LINE(10, "%s", prefix);
+            if( (rc = SRAList_Lock(false)) == 0 ) {
+                char buf[1024];
+                size_t i;
+                for(i = 0; rc == 0 && i < cself->files_count; i++) {
+                    if( (cself->files[i].type & types) && cself->files[i].file_sz > 0 ) {
+                        strcpy(buf, prefix);
+                        strcat(buf, cself->files[i].suffix);
+                        rc = func(buf, data);
+                    }
+                }
+                SRAList_Unlock();
+            }
+        }
+    }
+    return rc;
+}
diff --git a/tools/fuse/sra-list.h b/tools/fuse/sra-list.h
new file mode 100644
index 0000000..3bc3ef0
--- /dev/null
+++ b/tools/fuse/sra-list.h
@@ -0,0 +1,86 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#ifndef _h_sra_fuse_sra_list_
+#define _h_sra_fuse_sra_list_
+
+#include <sra/sradb.h>
+
+#include "xml.h"
+#include "formats.h"
+
+typedef enum {
+    eSRAFuseInitial     = 0x1000,
+    eSRAFuseRunDir      = 0x0001,
+    eSRAFuseFileArc     = 0x0002,
+    eSRAFuseFileArcLite = 0x0004,
+    eSRAFuseFileFastq   = 0x0008,
+    eSRAFuseFileSFF     = 0x0010
+} SRAConfigFlags;
+
+typedef struct SRAListNode SRAListNode;
+
+/*
+ * Initialize run list
+ * if seconds > 0 than a thread is launched to updated run info
+ */
+rc_t SRAList_Make(KDirectory* dir, unsigned int seconds, const char* cache_path);
+
+void SRAList_Init(void);
+
+void SRAList_Fini(void);
+
+/* after processing updated XML set next version so 
+ * that runs dropped from XML could be dropped from the list
+ */
+rc_t SRAList_NextVersion(void);
+
+/*
+ * Attaches to parent file nodes based on flags
+ * xml_node is of type SRA with accession and optional path
+ * maintains internal list of SRA objects keyed on acession-path pairs
+ */
+rc_t SRAListNode_Make(const KXMLNode* xml_node, FSNode* parent, SRAConfigFlags flags, char* errmsg,
+                      const char* rel_path, EXMLValidate validate);
+
+rc_t SRAListNode_TableMTime(const SRAListNode* cself, KTime_t* mtime);
+
+rc_t SRAListNode_TableOpen(const SRAListNode* cself, const SRATable** tbl);
+
+/*
+ * Get type info based on file extension
+ */
+rc_t SRAListNode_GetType(const SRAListNode* cself, SRAConfigFlags flags, const char* suffix, struct FileOptions const** options);
+
+/*
+ * Get list of files using prefix + suffixes filtering by types
+ */
+rc_t SRAListNode_ListFiles(const SRAListNode* cself, const char* prefix, int types, FSNode_Dir_Visit func, void* data);
+
+rc_t SRAListNode_AddRef(const SRAListNode* cself);
+void SRAListNode_Release(const SRAListNode* cself);
+void SRAList_PostRefresh();
+
+#endif /* _h_sra_fuse_sra_list_ */
diff --git a/tools/fuse/sra-makeidx.c b/tools/fuse/sra-makeidx.c
new file mode 100644
index 0000000..72a0baa
--- /dev/null
+++ b/tools/fuse/sra-makeidx.c
@@ -0,0 +1,960 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+#include <kapp/main.h>
+#include <kapp/args.h>
+#include <klib/container.h>
+#include <klib/log.h>
+#include <klib/out.h>
+#include <klib/status.h>
+#include <klib/checksum.h>
+#include <klib/rc.h>
+#include <kdb/manager.h>
+#include <kdb/table.h>
+#include <kdb/meta.h>
+#include <kdb/index.h>
+
+#include <sra/wsradb.h>
+#include <sra/sradb-priv.h>
+#include <sra/fastq.h>
+#include <sra/sff.h>
+
+#include "sra-makeidx.vers.h"
+#include "zlib-simple.h"
+#include "debug.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <errno.h>
+
+uint32_t g_file_block_sz = 32 * 1024;
+const char* g_accession = NULL;
+bool g_dump = false;
+bool g_ungzip = false;
+
+typedef struct SIndexObj_struct {
+    KMDataNode* meta;
+    const char* const file;
+    const char* const format;
+    const char* const index;
+    rc_t (*func)(const SRATable* sratbl, struct SIndexObj_struct* obj, char* buffer, const size_t buffer_sz);
+    uint64_t file_size;
+    uint32_t buffer_sz;
+    uint64_t minSpotId;
+    uint64_t maxSpotId;
+    SLList li;
+    MD5State md5;
+    uint8_t md5_digest[16];
+} SIndexObj;
+
+typedef struct SIndexNode_struct {
+    SLNode n;
+    uint64_t key;
+    uint64_t key_size;
+    int64_t id;
+    uint64_t id_qty;
+} SIndexNode;
+
+typedef struct SIndexData_struct {
+    rc_t rc;
+    KIndex* kidx;
+} SIndexData;
+
+static
+bool InsertIndexData( SLNode *node, void *data )
+{
+    SIndexNode* n = (SIndexNode*)node;
+    SIndexData* d = (SIndexData*)data;
+
+    d->rc = KIndexInsertU64(d->kidx, true, n->key, n->key_size, n->id, n->id_qty);
+    return d->rc == 0 ? false : true;
+}
+
+static
+void WhackIndexData( SLNode *n, void *data )
+{
+    free(n);
+}
+
+static
+rc_t CommitIndex(KTable* ktbl, const char* name, const SLList* li)
+{
+    SIndexData data;
+
+    STSMSG(0, ("Saving index %s", name));
+    data.rc = KTableCreateIndex(ktbl, &data.kidx, kitU64, kcmInit, name);
+    if( data.rc == 0 ) {
+        if( !SLListDoUntil(li, InsertIndexData, &data) ) {
+            data.rc = KIndexCommit(data.kidx);
+        }
+        KIndexRelease(data.kidx);
+    }
+    return data.rc;
+}
+
+rc_t WriteFileMeta(SIndexObj* obj)
+{
+    rc_t rc = 0;
+    KMDataNode* nd = NULL;
+
+    PLOGMSG(klogInfo, (klogInfo, "Meta $(f) on index $(i): file size $(s), buffer $(b)",
+        PLOG_4(PLOG_S(f),PLOG_S(i),PLOG_U64(s),PLOG_U32(b)), obj->file, obj->index, obj->file_size, obj->buffer_sz));
+
+    if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(obj->meta, &nd, "Format")) == 0 ) {
+        KMDataNode* opt = NULL;
+        rc = KMDataNodeWriteCString(nd, obj->format);
+        if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(nd, &opt, "Options")) == 0 ) {
+            KMDataNode* ond = NULL;
+            if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(opt, &ond, "accession")) == 0 ) {
+                rc = KMDataNodeWriteCString(ond, g_accession);
+                KMDataNodeRelease(ond);
+            }
+            if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(opt, &ond, "minSpotId")) == 0 ) {
+                rc = KMDataNodeWriteB64(ond, &obj->minSpotId);
+                KMDataNodeRelease(ond);
+            }
+            if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(opt, &ond, "maxSpotId")) == 0 ) {
+                rc = KMDataNodeWriteB64(ond, &obj->maxSpotId);
+                KMDataNodeRelease(ond);
+            }
+            KMDataNodeRelease(opt);
+        }
+        KMDataNodeRelease(nd);
+    }
+
+    if( rc == 0 && obj->file_size > 0 && (rc = KMDataNodeOpenNodeUpdate(obj->meta, &nd, "Size")) == 0 ) {
+        rc = KMDataNodeWriteB64(nd, &obj->file_size);
+        KMDataNodeRelease(nd);
+    }
+
+    if( rc == 0 && obj->buffer_sz > 0 && (rc = KMDataNodeOpenNodeUpdate(obj->meta, &nd, "Buffer")) == 0 ) {
+        rc = KMDataNodeWriteB32(nd, &obj->buffer_sz);
+        KMDataNodeRelease(nd);
+    }
+
+    if( rc == 0 && strlen(obj->index) > 0 && (rc = KMDataNodeOpenNodeUpdate(obj->meta, &nd, "Index")) == 0 ) {
+        rc = KMDataNodeWriteCString(nd, obj->index);
+        KMDataNodeRelease(nd);
+    }
+
+    if( rc == 0 && obj->file_size > 0 && (rc = KMDataNodeOpenNodeUpdate(obj->meta, &nd, "md5")) == 0 ) {
+        char x[5];
+        int i;
+        for( i = 0; rc == 0 && i < sizeof(obj->md5_digest); i++ ) {
+            int l = snprintf(x, 4, "%02x", obj->md5_digest[i]);
+            rc = KMDataNodeAppend(nd, x, l);
+        }
+        KMDataNodeRelease(nd);
+    }
+    return rc;
+}
+
+static
+rc_t SFF_Idx(const SRATable* sratbl, SIndexObj* obj, char* buffer, const size_t buffer_sz)
+{
+    rc_t rc = 0;
+    const SFFReader* reader = NULL;
+
+    if( (rc = SFFReaderMake(&reader, sratbl, g_accession, obj->minSpotId, obj->maxSpotId)) != 0 ) {
+        return rc;
+    } else {
+        size_t written = 0;
+        uint32_t blk = 0;
+        SIndexNode* inode = NULL;
+
+        while( rc == 0 ) {
+            rc = SFFReader_GetNextSpotData(reader, buffer, buffer_sz, &written);
+            if( blk >= g_file_block_sz || (GetRCObject(rc) == rcRow && GetRCState(rc) == rcExhausted) ) {
+                inode->key_size = blk;
+                SLListPushTail(&obj->li, &inode->n);
+                DEBUG_MSG(5, ("SFF index closed spots %lu, offset %lu, block size %lu\n", inode->id_qty, inode->key, inode->key_size));
+                inode = NULL;
+                if( blk > obj->buffer_sz ) {
+                    obj->buffer_sz = blk;
+                }
+                blk = 0;
+            }
+            if( GetRCObject(rc) == rcRow && GetRCState(rc) == rcExhausted ) {
+                rc = 0;
+                break;
+            }
+            if( inode == NULL ) {
+                spotid_t spotid = 0;
+                if( (rc = SFFReaderCurrentSpot(reader, &spotid)) != 0 ) {
+                    break;
+                }
+                inode = malloc(sizeof(SIndexNode));
+                if( inode == NULL ) {
+                    rc = RC(rcExe, rcIndex, rcConstructing, rcMemory, rcExhausted);
+                    break;
+                }
+                inode->key = obj->file_size;
+                inode->key_size = 0;
+                inode->id = spotid;
+                inode->id_qty = 0;
+                DEBUG_MSG(5, ("SFF index opened spot %ld, offset %lu\n", inode->id, inode->key));
+                if( spotid == 1 ) {
+                    char hd[10240];
+                    size_t hd_sz = 0;
+                    if( (rc = SFFReaderHeader(reader, 0, hd, sizeof(hd), &hd_sz)) == 0 ) {
+                        obj->file_size += hd_sz;
+                        blk += hd_sz;
+                        MD5StateAppend(&obj->md5, hd, hd_sz);
+                        if( g_dump ) {
+                            fwrite(hd, hd_sz, 1, stderr);
+                        }
+                    }
+                }
+            }
+            obj->file_size += written;
+            blk += written;
+            inode->id_qty++;
+            MD5StateAppend(&obj->md5, buffer, written);
+            if( g_dump ) {
+                fwrite(buffer, written, 1, stderr);
+            }
+        }
+        rc = rc ? rc : Quitting();
+        if( rc != 0 ) {
+            spotid_t spot = 0;
+            SFFReaderCurrentSpot(reader, &spot);
+            PLOGERR(klogErr, (klogErr, rc, "spot $(s)", PLOG_U32(s), spot));
+        }
+    }
+    SFFReaderWhack(reader);
+    return rc;
+}
+
+static
+rc_t SFFGzip_Idx(const SRATable* sratbl, SIndexObj* obj, char* buffer, const size_t buffer_sz)
+{
+    rc_t rc = 0;
+    uint16_t zlib_ver = ZLIB_VERNUM;
+    const SFFReader* reader = NULL;
+
+    if( (rc = SFFReaderMake(&reader, sratbl, g_accession, obj->minSpotId, obj->maxSpotId)) != 0 ) {
+        return rc;
+    } else {
+        size_t written = 0;
+        uint32_t blk = 0, spots_per_block = 0, proj_id_qty = 0;
+        SIndexNode* inode = NULL;
+        size_t z_blk = 0;
+        size_t spots_buf_sz = g_file_block_sz * 100;
+        size_t zbuf_sz = spots_buf_sz + 100;
+
+        char* zbuf = malloc(zbuf_sz);
+        char* spots_buf = malloc(spots_buf_sz);
+        bool eof = false;
+
+        if( zbuf == NULL || spots_buf == NULL ) {
+            rc = RC(rcExe, rcIndex, rcConstructing, rcMemory, rcExhausted);
+        }
+        while( rc == 0 ) {
+            if( (rc = SFFReader_GetNextSpotData(reader, buffer, buffer_sz, &written)) == 0 ) {
+                if( inode == NULL ) {
+                    spotid_t spotid = 0;
+                    if( (rc = SFFReaderCurrentSpot(reader, &spotid)) != 0 ) {
+                        break;
+                    }
+                    inode = malloc(sizeof(SIndexNode));
+                    if( inode == NULL ) {
+                        rc = RC(rcExe, rcIndex, rcConstructing, rcMemory, rcExhausted);
+                        break;
+                    }
+                    inode->key = obj->file_size;
+                    inode->key_size = 0;
+                    inode->id = spotid;
+                    inode->id_qty = 0;
+                    DEBUG_MSG(5, ("%s open key: spot %ld, offset %lu\n", obj->index, inode->id, inode->key));
+                    if( spotid == 1 ) {
+                        char hd[10240];
+                        size_t hd_sz = 0;
+                        if( (rc = SFFReaderHeader(reader, 0, hd, sizeof(hd), &hd_sz)) == 0 ) {
+                            if( hd_sz + written > spots_buf_sz ) {
+                                rc = RC(rcExe, rcIndex, rcConstructing, rcMemory, rcInsufficient);
+                                break;
+                            }
+                            memcpy(&spots_buf[blk], hd, hd_sz);
+                            blk += hd_sz;
+                            if( g_dump ) {
+                                fwrite(hd, hd_sz, 1, stderr);
+                            }
+                        }
+                    }
+
+                }
+                if( blk + written > spots_buf_sz ) {
+                    rc = RC(rcExe, rcIndex, rcConstructing, rcMemory, rcInsufficient);
+                    break;
+                }
+                inode->id_qty++;
+                memcpy(&spots_buf[blk], buffer, written);
+                blk += written;
+                if( g_dump ) {
+                    fwrite(buffer, written, 1, stderr);
+                }
+            }
+            if( (eof = (GetRCObject(rc) == rcRow && GetRCState(rc) == rcExhausted)) ) {
+                rc = 0;
+                if( inode == NULL ) {
+                    break;
+                }
+            }
+            if( rc == 0 && (eof || 
+                            (proj_id_qty == 0 && inode->id_qty > (spots_per_block * 0.95)) || 
+                            (proj_id_qty > 0 && inode->id_qty >= proj_id_qty) ) ) {
+                rc = ZLib_DeflateBlock(spots_buf, blk, zbuf, zbuf_sz, &z_blk);
+                if( z_blk < g_file_block_sz ) {
+                    /* project needed id_qty */
+                    proj_id_qty = g_file_block_sz * inode->id_qty / z_blk * 1.05;
+                    DEBUG_MSG(5, ("%s: project id qty %lu\n", obj->index, proj_id_qty));
+                } else {
+                    DEBUG_MSG(10, ("%s: no projection %lu > %lu\n", obj->index, z_blk, g_file_block_sz));
+                }
+            }
+            if( rc == 0 && (eof || z_blk >= g_file_block_sz) ) {
+                obj->file_size += z_blk;
+                MD5StateAppend(&obj->md5, zbuf, z_blk);
+                inode->key_size = z_blk;
+                SLListPushTail(&obj->li, &inode->n);
+                DEBUG_MSG(5, ("%s close key: spots %lu, size %lu, ratio %hu%%, raw %lu\n",
+                         obj->index, inode->id_qty, inode->key_size, (uint16_t)(((float)(blk - z_blk)/blk)*100), blk));
+                spots_per_block = inode->id_qty;
+                inode = NULL;
+                if( blk > obj->buffer_sz ) {
+                    obj->buffer_sz = blk;
+                }
+                blk = 0;
+                z_blk = 0;
+                proj_id_qty = 0;
+            }
+            if( eof ) {
+                break;
+            }
+        }
+        rc = rc ? rc : Quitting();
+        if( rc != 0 ) {
+            spotid_t spot = 0;
+            SFFReaderCurrentSpot(reader, &spot);
+            PLOGERR(klogErr, (klogErr, rc, "spot $(s)", PLOG_U32(s), spot));
+        }
+        free(zbuf);
+        free(spots_buf);
+    }
+    if( rc == 0 ) {
+        KMDataNode* opt = NULL, *nd = NULL;
+
+        if( (rc = KMDataNodeOpenNodeUpdate(obj->meta, &opt, "Format/Options")) != 0 ) {
+            return rc;
+        }
+        if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(opt, &nd, "ZlibVersion")) == 0 ) {
+            rc = KMDataNodeWriteB16(nd, &zlib_ver);
+            KMDataNodeRelease(nd);
+        }
+        KMDataNodeRelease(opt);
+    }
+    SFFReaderWhack(reader);
+    return rc;
+}
+
+static
+rc_t Fastq_Idx(const SRATable* sratbl, SIndexObj* obj, char* buffer, const size_t buffer_sz)
+{
+    rc_t rc = 0;
+    const FastqReader* reader = NULL;
+
+    uint8_t colorSpace = false;
+    char* colorSpaceKey = "\0";
+    uint8_t origFormat = false;
+    uint8_t printLabel = true;
+    uint8_t printReadId = true;
+    uint8_t clipQuality = true;
+    uint32_t minReadLen = 0;
+    uint16_t qualityOffset = 0;
+
+    {{
+        const SRAColumn* c = NULL;
+        const uint8_t *platform = SRA_PLATFORM_UNDEFINED;
+        bitsz_t o, z;
+
+        if( (rc = SRATableOpenColumnRead(sratbl, &c, "PLATFORM", sra_platform_id_t)) != 0 ) {
+            return rc;
+        }
+        if( (rc = SRAColumnRead(c, 1, (const void **)&platform, &o, &z)) != 0 ) {
+            return rc;
+        }
+        if( *platform == SRA_PLATFORM_ABSOLID ) {
+            colorSpace = true;
+        }
+        SRAColumnRelease(c);
+    }}
+
+    if( (rc = FastqReaderMake(&reader, sratbl, g_accession,
+                        colorSpace, origFormat, false, printLabel, printReadId,
+                        !clipQuality, minReadLen, qualityOffset, colorSpaceKey[0],
+                        obj->minSpotId, obj->maxSpotId)) != 0 ) {
+        return rc;
+    } else {
+        KMDataNode* opt = NULL, *nd = NULL;
+
+        if( (rc = KMDataNodeOpenNodeUpdate(obj->meta, &opt, "Format/Options")) != 0 ) {
+            return rc;
+        }
+        if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(opt, &nd, "colorSpace")) == 0 ) {
+            rc = KMDataNodeWriteB8(nd, &colorSpace);
+            KMDataNodeRelease(nd);
+        }
+        if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(opt, &nd, "colorSpaceKey")) == 0 ) {
+            rc = KMDataNodeWrite(nd, colorSpaceKey, 1);
+            KMDataNodeRelease(nd);
+        }
+        if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(opt, &nd, "origFormat")) == 0 ) {
+            rc = KMDataNodeWriteB8(nd, &origFormat);
+            KMDataNodeRelease(nd);
+        }
+        if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(opt, &nd, "printLabel")) == 0 ) {
+            rc = KMDataNodeWriteB8(nd, &printLabel);
+            KMDataNodeRelease(nd);
+        }
+        if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(opt, &nd, "printReadId")) == 0 ) {
+            rc = KMDataNodeWriteB8(nd, &printReadId);
+            KMDataNodeRelease(nd);
+        }
+        if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(opt, &nd, "clipQuality")) == 0 ) {
+            rc = KMDataNodeWriteB8(nd, &clipQuality);
+            KMDataNodeRelease(nd);
+        }
+        if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(opt, &nd, "minReadLen")) == 0 ) {
+            rc = KMDataNodeWriteB32(nd, &minReadLen);
+            KMDataNodeRelease(nd);
+        }
+        if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(opt, &nd, "qualityOffset")) == 0 ) {
+            rc = KMDataNodeWriteB16(nd, &qualityOffset);
+            KMDataNodeRelease(nd);
+        }
+        KMDataNodeRelease(opt);
+    }
+
+    if( rc == 0 ) {
+        size_t written = 0;
+        uint32_t blk = 0;
+        SIndexNode* inode = NULL;
+
+        while( rc == 0 ) {
+            rc = FastqReader_GetNextSpotSplitData(reader, buffer, buffer_sz, &written);
+            if( blk >= g_file_block_sz || (GetRCObject(rc) == rcRow && GetRCState(rc) == rcExhausted) ) {
+                inode->key_size = blk;
+                SLListPushTail(&obj->li, &inode->n);
+                DEBUG_MSG(5, ("Fastq index closed spots %lu, offset %lu, block size %lu\n",
+                                                            inode->id_qty, inode->key, inode->key_size));
+                inode = NULL;
+                if( blk > obj->buffer_sz ) {
+                    obj->buffer_sz = blk;
+                }
+                blk = 0;
+            }
+            if( GetRCObject(rc) == rcRow && GetRCState(rc) == rcExhausted ) {
+                rc = 0;
+                break;
+            }
+            if( inode == NULL ) {
+                spotid_t spotid = 0;
+                if( (rc = FastqReaderCurrentSpot(reader, &spotid)) != 0 ) {
+                    break;
+                }
+                inode = malloc(sizeof(SIndexNode));
+                if( inode == NULL ) {
+                    rc = RC(rcExe, rcIndex, rcConstructing, rcMemory, rcExhausted);
+                    break;
+                }
+                inode->key = obj->file_size;
+                inode->key_size = 0;
+                inode->id = spotid;
+                inode->id_qty = 0;
+                DEBUG_MSG(5, ("Fastq index opened spot %ld, offset %lu\n", inode->id, inode->key));
+            }
+            inode->id_qty++;
+            obj->file_size += written;
+            blk += written;
+            MD5StateAppend(&obj->md5, buffer, written);
+            if( g_dump ) {
+                fwrite(buffer, written, 1, stderr);
+            }
+        }
+        rc = rc ? rc : Quitting();
+        if( rc != 0 ) {
+            spotid_t spot = 0;
+            FastqReaderCurrentSpot(reader, &spot);
+            PLOGERR(klogErr, (klogErr, rc, "spot $(s)", PLOG_U32(s), spot));
+        }
+    }
+    FastqReaderWhack(reader);
+    return rc;
+}
+
+static
+rc_t FastqGzip_Idx(const SRATable* sratbl, SIndexObj* obj, char* buffer, const size_t buffer_sz)
+{
+    rc_t rc = 0;
+    const FastqReader* reader = NULL;
+
+    uint16_t zlib_ver = ZLIB_VERNUM;
+    uint8_t colorSpace = false;
+    char* colorSpaceKey = "\0";
+    uint8_t origFormat = false;
+    uint8_t printLabel = true;
+    uint8_t printReadId = true;
+    uint8_t clipQuality = true;
+    uint32_t minReadLen = 0;
+    uint16_t qualityOffset = 0;
+
+    {{
+        const SRAColumn* c = NULL;
+        const uint8_t *platform = SRA_PLATFORM_UNDEFINED;
+        bitsz_t o, z;
+
+        if( (rc = SRATableOpenColumnRead(sratbl, &c, "PLATFORM", sra_platform_id_t)) != 0 ) {
+            return rc;
+        }
+        if( (rc = SRAColumnRead(c, 1, (const void **)&platform, &o, &z)) != 0 ) {
+            return rc;
+        }
+        if( *platform == SRA_PLATFORM_ABSOLID ) {
+            colorSpace = true;
+        }
+        SRAColumnRelease(c);
+    }}
+
+    if( (rc = FastqReaderMake(&reader, sratbl, g_accession,
+                        colorSpace, origFormat, false, printLabel, printReadId,
+                        !clipQuality, minReadLen, qualityOffset, colorSpaceKey[0],
+                        obj->minSpotId, obj->maxSpotId)) != 0 ) {
+        return rc;
+    } else {
+        size_t written = 0;
+        uint32_t blk = 0, spots_per_block = 0, proj_id_qty = 0;
+        SIndexNode* inode = NULL;
+        size_t z_blk = 0;
+        size_t spots_buf_sz = g_file_block_sz * 100;
+        size_t zbuf_sz = spots_buf_sz + 100;
+        char* zbuf = malloc(zbuf_sz);
+        char* spots_buf = malloc(spots_buf_sz);
+        bool eof = false;
+
+        if( zbuf == NULL || spots_buf == NULL ) {
+            rc = RC(rcExe, rcIndex, rcConstructing, rcMemory, rcExhausted);
+        }
+        while( rc == 0 ) {
+            if( (rc = FastqReader_GetNextSpotSplitData(reader, buffer, buffer_sz, &written)) == 0 ) {
+                if( inode == NULL ) {
+                    spotid_t spotid = 0;
+                    if( (rc = FastqReaderCurrentSpot(reader, &spotid)) != 0 ) {
+                        break;
+                    }
+                    inode = malloc(sizeof(SIndexNode));
+                    if( inode == NULL ) {
+                        rc = RC(rcExe, rcIndex, rcConstructing, rcMemory, rcExhausted);
+                        break;
+                    }
+                    inode->key = obj->file_size;
+                    inode->key_size = 0;
+                    inode->id = spotid;
+                    inode->id_qty = 0;
+                    DEBUG_MSG(5, ("%s open key: spot %ld, offset %lu\n", obj->index, inode->id, inode->key));
+                }
+                if( blk + written > spots_buf_sz ) {
+                    rc = RC(rcExe, rcIndex, rcConstructing, rcMemory, rcInsufficient);
+                    break;
+                }
+                inode->id_qty++;
+                memcpy(&spots_buf[blk], buffer, written);
+                blk += written;
+                if( g_dump ) {
+                    fwrite(buffer, written, 1, stderr);
+                }
+            }
+            if( (eof = (GetRCObject(rc) == rcRow && GetRCState(rc) == rcExhausted)) ) {
+                rc = 0;
+                if( inode == NULL ) {
+                    break;
+                }
+            }
+            if( rc == 0 && (eof || 
+                            (proj_id_qty == 0 && inode->id_qty > (spots_per_block * 0.95)) || 
+                            (proj_id_qty > 0 && inode->id_qty >= proj_id_qty) ) ) {
+                rc = ZLib_DeflateBlock(spots_buf, blk, zbuf, zbuf_sz, &z_blk);
+                if( z_blk < g_file_block_sz ) {
+                    /* project needed id_qty */
+                    proj_id_qty = g_file_block_sz * inode->id_qty / z_blk * 1.05;
+                    DEBUG_MSG(5, ("%s: project id qty %u\n", obj->index, proj_id_qty));
+                } else {
+                    DEBUG_MSG(10, ("%s: no projection %u > %u\n", obj->index, z_blk, g_file_block_sz));
+                }
+            }
+            if( rc == 0 && (eof || z_blk >= g_file_block_sz) ) {
+                obj->file_size += z_blk;
+                MD5StateAppend(&obj->md5, zbuf, z_blk);
+                inode->key_size = z_blk;
+                SLListPushTail(&obj->li, &inode->n);
+                DEBUG_MSG(5, ("%s close key: spots %lu, size %lu, ratio %hu%%, raw %u\n",
+                         obj->index, inode->id_qty, inode->key_size, (uint16_t)(((float)(blk - z_blk)/blk)*100), blk ));
+                spots_per_block = inode->id_qty;
+                inode = NULL;
+                if( blk > obj->buffer_sz ) {
+                    obj->buffer_sz = blk;
+                }
+                blk = 0;
+                z_blk = 0;
+                proj_id_qty = 0;
+            }
+            if( eof ) {
+                break;
+            }
+        }
+        rc = rc ? rc : Quitting();
+        if( rc != 0 ) {
+            spotid_t spot = 0;
+            FastqReaderCurrentSpot(reader, &spot);
+            PLOGERR(klogErr, (klogErr, rc, "spot $(s)", PLOG_U32(s), spot));
+        }
+        free(zbuf);
+        free(spots_buf);
+    }
+    if( rc == 0 ) {
+        KMDataNode* opt = NULL, *nd = NULL;
+
+        if( (rc = KMDataNodeOpenNodeUpdate(obj->meta, &opt, "Format/Options")) != 0 ) {
+            return rc;
+        }
+        if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(opt, &nd, "ZlibVersion")) == 0 ) {
+            rc = KMDataNodeWriteB16(nd, &zlib_ver);
+            KMDataNodeRelease(nd);
+        }
+        if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(opt, &nd, "colorSpace")) == 0 ) {
+            rc = KMDataNodeWriteB8(nd, &colorSpace);
+            KMDataNodeRelease(nd);
+        }
+        if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(opt, &nd, "colorSpaceKey")) == 0 ) {
+            rc = KMDataNodeWrite(nd, colorSpaceKey, 1);
+            KMDataNodeRelease(nd);
+        }
+        if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(opt, &nd, "origFormat")) == 0 ) {
+            rc = KMDataNodeWriteB8(nd, &origFormat);
+            KMDataNodeRelease(nd);
+        }
+        if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(opt, &nd, "printLabel")) == 0 ) {
+            rc = KMDataNodeWriteB8(nd, &printLabel);
+            KMDataNodeRelease(nd);
+        }
+        if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(opt, &nd, "printReadId")) == 0 ) {
+            rc = KMDataNodeWriteB8(nd, &printReadId);
+            KMDataNodeRelease(nd);
+        }
+        if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(opt, &nd, "clipQuality")) == 0 ) {
+            rc = KMDataNodeWriteB8(nd, &clipQuality);
+            KMDataNodeRelease(nd);
+        }
+        if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(opt, &nd, "minReadLen")) == 0 ) {
+            rc = KMDataNodeWriteB32(nd, &minReadLen);
+            KMDataNodeRelease(nd);
+        }
+        if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(opt, &nd, "qualityOffset")) == 0 ) {
+            rc = KMDataNodeWriteB16(nd, &qualityOffset);
+            KMDataNodeRelease(nd);
+        }
+        KMDataNodeRelease(opt);
+    }
+    FastqReaderWhack(reader);
+    return rc;
+}
+
+static
+rc_t MakeIndexes(const SRATable* stbl, KTable* ktbl, KMetadata* meta)
+{
+    rc_t rc = 0;
+    int i;
+    char* buffer = NULL;
+    size_t buffer_sz = g_file_block_sz * 100;
+
+    SIndexObj idx[] = {
+     /*  meta, file,        format,         index,          func,    file_size, buffer_sz, minSpotId, maxSpotId */
+        {NULL, "fastq",    "fastq",      "fuse-fastq",    Fastq_Idx,     0, 0, 0, 0},
+        {NULL, "sff",      "SFF",        "fuse-sff",      SFF_Idx,       0, 0, 0, 0},
+        {NULL, "fastq.gz", "fastq-gzip", "fuse-fastq-gz", FastqGzip_Idx, 0, 0, 0, 0},
+        {NULL, "sff.gz",   "SFF-gzip",   "fuse-sff-gz",   SFFGzip_Idx,   0, 0, 0, 0}
+    };
+
+    for(i = 0; rc == 0 && i < sizeof(idx) / sizeof(idx[0]); i++) {
+        KMDataNode* parent = NULL;
+        if( (rc = KMetadataOpenNodeUpdate(meta, &parent, "/FUSE")) == 0 ) {
+            KMDataNodeDropChild(parent, "root"); /* drop old stuff */
+            if( g_ungzip || strcmp(&idx[i].file[strlen(idx[i].file) - 3], ".gz") == 0 ) {
+                STSMSG(0, ("Preparing index %s", idx[i].index));
+                MD5StateInit(&idx[i].md5);
+                SLListInit(&idx[i].li);
+                KMDataNodeDropChild(parent, "%s.tmp", idx[i].file);
+                if( (rc = KMDataNodeOpenNodeUpdate(parent, &idx[i].meta, "%s.tmp", idx[i].file)) == 0 ) {
+                    if( idx[i].func != NULL ) {
+                        if( buffer == NULL ) {
+                            if( (buffer = malloc(buffer_sz)) == NULL ) {
+                                rc = RC(rcExe, rcIndex, rcConstructing, rcMemory, rcExhausted);
+                                break;
+                            }
+                        }
+                        rc = idx[i].func(stbl, &idx[i], buffer, buffer_sz);
+                        if( rc == 0 ) {
+                            MD5StateFinish(&idx[i].md5, idx[i].md5_digest);
+                            rc = CommitIndex(ktbl, idx[i].index, &idx[i].li);
+                        }
+                    }
+                    if( rc == 0 ) {
+                        rc = WriteFileMeta(&idx[i]);
+                    }
+                    KMDataNodeRelease(idx[i].meta);
+                }
+                if( GetRCState(rc) == rcUnsupported ) {
+                    KMDataNodeDropChild(parent, "%s", idx[i].file);
+                    PLOGERR(klogWarn, (klogWarn, rc, "Index $(i) is not supported for this table", PLOG_S(i), idx[i].index));
+                    rc = 0;
+                } else if( rc == 0 ) {
+                    char f[4096];
+                    strcpy(f, idx[i].file);
+                    strcat(f, ".tmp");
+                    KMDataNodeDropChild(parent, "%s", idx[i].file);
+                    rc = KMDataNodeRenameChild(parent, f, idx[i].file);
+                }
+            } else if( !g_ungzip ) {
+                KTableDropIndex(ktbl, idx[i].index);
+                KMDataNodeDropChild(parent, "%s", idx[i].file);
+            }
+            KMDataNodeDropChild(parent, "%s.tmp", idx[i].file);
+            KMDataNodeRelease(parent);
+        }
+        SLListWhack(&idx[i].li, WhackIndexData, NULL);
+    }
+    free(buffer);
+    return rc;
+}
+
+ver_t CC KAppVersion(void)
+{
+    return SRA_MAKEIDX_VERS;
+}
+const char* blocksize_usage[] = {"Index block size", NULL};
+const char* accession_usage[] = {"Accession", NULL};
+
+/* this enum must have same order as MainArgs array below */
+enum OptDefIndex {
+    eopt_BlockSize = 0,
+    eopt_Accession,
+    eopt_DumpIndex,
+    eopt_noGzip
+};
+
+OptDef MainArgs[] =
+{
+    /* if you change order in this array, rearrange enum above accordingly! */
+    {"block-size", "b", NULL, blocksize_usage, 1, true, false},
+    {"accession", "a", NULL, accession_usage, 1, true, false},
+    {"hidden-dump", "d", NULL, NULL, 1, false, false},
+    {"hidden-nogzip", "g", NULL, NULL, 1, false, false}
+};
+const char* MainParams[] =
+{
+    /* if you change order in this array, rearrange enum above accordingly! */
+    "size",
+    "accession",
+    NULL,
+    NULL
+};
+const size_t MainArgsQty = sizeof(MainArgs) / sizeof(MainArgs[0]);
+
+const char UsageDefaultName[] = "sra-makeidx";
+
+rc_t CC UsageSummary (const char * name)
+{
+    return 0;
+}
+
+rc_t CC Usage(const Args* args)
+{
+    const char * progname = UsageDefaultName;
+    const char * fullpath = UsageDefaultName;
+    rc_t rc;
+    int i;
+
+    if (args == NULL)
+        rc = RC (rcApp, rcArgv, rcAccessing, rcSelf, rcNull);
+    else
+        rc = ArgsProgram (args, &fullpath, &progname);
+
+    OUTMSG(( "\nUsage:\n\t%s [options] <table>\n\n", progname));
+
+    for(i = 0; i < MainArgsQty; i++ ) {
+        if( MainArgs[i].required && MainArgs[i].help ) {
+            HelpOptionLine(MainArgs[i].aliases, MainArgs[i].name, MainParams[i], MainArgs[i].help);
+        }
+    }
+    OUTMSG(("\nOptions:\n"));
+    for(i = 0; i < MainArgsQty; i++ ) {
+        if( !MainArgs[i].required && MainArgs[i].help ) {
+            HelpOptionLine(MainArgs[i].aliases, MainArgs[i].name, MainParams[i], MainArgs[i].help);
+        }
+    }
+    OUTMSG(("\n"));
+    HelpOptionsStandard();
+    HelpVersion(fullpath, KAppVersion());
+    return rc;
+}
+rc_t KMain(int argc, char *argv[])
+{
+    rc_t rc = 0;
+    Args* args = NULL;
+    const char* errmsg = NULL, *table_dir = NULL;
+    char accn[1024];
+    
+    if( (rc = ArgsMakeAndHandle(&args, argc, argv, 1, MainArgs, MainArgsQty)) == 0 ) {
+        const char* blksz = NULL;
+        uint32_t count, dump = 0, gzip = 0;
+
+        if( (rc = ArgsParamCount(args, &count)) != 0 || count != 1 ) {
+            rc = rc ? rc : RC(rcExe, rcArgv, rcParsing, rcParam, count > 1 ? rcExcessive : rcInsufficient);
+            errmsg = "table";
+
+        } else if( (rc = ArgsOptionCount(args, MainArgs[eopt_BlockSize].name, &count)) != 0 || count > 1 ) {
+            rc = rc ? rc : RC(rcExe, rcArgv, rcParsing, rcParam, rcExcessive);
+            errmsg = MainArgs[eopt_BlockSize].name;
+        } else if( count > 0 && (rc = ArgsOptionValue(args, MainArgs[eopt_BlockSize].name, 0, &blksz)) != 0 ) {
+            errmsg = MainArgs[eopt_BlockSize].name;
+
+        } else if( (rc = ArgsOptionCount(args, MainArgs[eopt_Accession].name, &count)) != 0 || count > 1 ) {
+            rc = rc ? rc : RC(rcExe, rcArgv, rcParsing, rcParam, rcExcessive);
+            errmsg = MainArgs[eopt_Accession].name;
+        } else if( count > 0 && (rc = ArgsOptionValue(args, MainArgs[eopt_Accession].name, 0, &g_accession)) != 0 ) {
+            errmsg = MainArgs[eopt_Accession].name;
+
+        } else if( (rc = ArgsOptionCount(args, MainArgs[eopt_DumpIndex].name, &dump)) != 0 ) {
+            errmsg = MainArgs[eopt_DumpIndex].name;
+
+        } else if( (rc = ArgsOptionCount(args, MainArgs[eopt_noGzip].name, &gzip)) != 0 ) {
+            errmsg = MainArgs[eopt_noGzip].name;
+        }
+        while( rc == 0 ) {
+            long val = 0;
+            char* end = NULL;
+
+            if( blksz != NULL ) {
+                errno = 0;
+                val = strtol(blksz, &end, 10);
+                if( errno != 0 || blksz == end || *end != '\0' || val <= 0 ) {
+                    rc = RC(rcExe, rcArgv, rcReading, rcParam, rcInvalid);
+                    errmsg = MainArgs[eopt_BlockSize].name;
+                    break;
+                } else if( val <= 128 || val > (1024 * 1024 * 1024) ) {
+                    rc = RC(rcExe, rcArgv, rcValidating, rcParam, rcEmpty);
+                    errmsg = "block size invalid";
+                    break;
+                }
+                g_file_block_sz = val;
+            }
+            if( (rc = ArgsParamValue(args, 0, &table_dir)) != 0 ) {
+                errmsg = "table";
+                break;
+            }
+            if( g_accession == NULL ) {
+                const char* p = strchr(table_dir, '/');
+                size_t l = 0;
+
+                g_accession = accn;
+                if( p == NULL ) {
+                    p = strchr(table_dir, '\\');
+                }
+                strncpy(accn, p == NULL ? table_dir : p + 1, sizeof(accn) - 1);
+                if( accn[0] == '\0' ) {
+                    rc = RC(rcExe, rcArgv, rcValidating, rcParam, rcEmpty);
+                    errmsg = "accession";
+                }
+                l = strlen(accn);
+                if( accn[l - 1] == '/' || accn[l - 1] == '\\') {
+                    accn[--l] = '\0';
+                }
+                if( strncmp(&accn[l - 9], ".lite.sra", 9) == 0 ) {
+                    accn[l - 9] = '\0';
+                } else if( strncmp(&accn[l - 4], ".sra", 4) == 0 ) {
+                    accn[l - 4] = '\0';
+                }
+            }
+            g_dump = dump > 0;
+            g_ungzip = gzip > 0;
+            break;
+        }
+    }
+    if( rc == 0 ) {
+        SRAMgr* smgr = NULL;
+        KDBManager* kmgr = NULL;
+
+        DEBUG_MSG(5, ("table %s, accession %s\n", table_dir, g_accession));
+        if( (rc = SRAMgrMakeUpdate(&smgr, NULL)) == 0 ) {
+            if( (rc = KDBManagerMakeUpdate(&kmgr, NULL)) == 0 ) {
+                bool relock = true;
+                if( (rc = KDBManagerUnlock(kmgr, table_dir)) != 0 ) {
+                    relock = false;
+                    rc = GetRCState(rc) == rcUnlocked ? 0 : rc;
+                } else {
+                    PLOGMSG(klogInfo, (klogInfo, "Table $(p) locked, unlocking", PLOG_S(p), table_dir));
+                }
+                if( rc == 0 ) {
+                    KTable* ktbl = NULL;
+                    if( (rc = KDBManagerOpenTableUpdate(kmgr, &ktbl, table_dir)) == 0 ) {
+                        KMetadata* meta = NULL;
+                        if( (rc = KTableOpenMetadataUpdate(ktbl, &meta)) == 0 ) {
+                            const SRATable* stbl = NULL;
+                            if( (rc = SRAMgrOpenTableRead(smgr, &stbl, table_dir)) == 0 ) {
+                                rc = MakeIndexes(stbl, ktbl, meta);
+                                SRATableRelease(stbl);
+                            }
+                        }
+                        KMetadataRelease(meta);
+                    }
+                    KTableRelease(ktbl);
+                }
+                if( rc == 0 && relock ) {
+                    rc = KDBManagerLock(kmgr, table_dir);
+                }
+                KDBManagerRelease(kmgr);
+            }
+            SRAMgrRelease(smgr);
+        }
+    }
+    if( rc != 0 && rc != KLogLastErrorCode() ) {
+        if( errmsg ) {
+            Usage(args);
+        }
+        LOGERR(klogErr, rc, errmsg ? errmsg : "stop");
+    }
+    ArgsWhack(args);
+    return rc;
+}
diff --git a/tools/fuse/sra-makeidx.vers b/tools/fuse/sra-makeidx.vers
new file mode 100644
index 0000000..197c455
--- /dev/null
+++ b/tools/fuse/sra-makeidx.vers
@@ -0,0 +1 @@
+2.4.21
diff --git a/tools/fuse/sra-node.c b/tools/fuse/sra-node.c
new file mode 100644
index 0000000..e138ef3
--- /dev/null
+++ b/tools/fuse/sra-node.c
@@ -0,0 +1,165 @@
+/*===========================================================================
+ *
+ *                            Public DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ */
+#include <klib/rc.h>
+#include <kfs/directory.h>
+
+#include <sra/sradb-priv.h>
+
+typedef struct SRANode SRANode;
+#define FSNODE_IMPL SRANode
+
+#include "log.h"
+#include "xml.h"
+#include "sra-list.h"
+#include "formats.h"
+#include "kfile-accessor.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+struct SRANode {
+    FSNode node;
+    SRAConfigFlags flags;
+    const SRAListNode* sra;
+    const char* prefix;
+    size_t prefix_len;
+};
+
+static
+rc_t SRANode_HasChild(const SRANode* cself, const char* name, size_t name_len)
+{
+    rc_t rc = 0;
+
+    if( name == NULL || cself->prefix_len >= name_len || strncmp(cself->prefix, name, cself->prefix_len) != 0 ) {
+        rc = RC(rcExe, rcSRA, rcSearching, rcDirEntry, rcNotFound);
+    } else {
+        const FileOptions* opt;
+        rc = SRAListNode_GetType(cself->sra, cself->flags, &name[cself->prefix_len], &opt);
+    }
+    return rc;
+}
+
+static
+rc_t SRANode_Attr(const SRANode* cself, const char* subpath, uint32_t* type, KTime_t* ts, uint64_t* file_sz, uint32_t* access, uint64_t* block_sz)
+{
+    rc_t rc = 0;
+
+    if( subpath == NULL || strncmp(cself->prefix, subpath, cself->prefix_len) != 0 ) {
+        rc = RC(rcExe, rcSRA, rcEvaluating, rcDirEntry, rcInvalid);
+    } else {
+        const FileOptions* opt;
+        if( (rc = SRAListNode_GetType(cself->sra, cself->flags, &subpath[cself->prefix_len], &opt)) == 0 &&
+            (rc = SRAListNode_TableMTime(cself->sra, ts)) == 0 ) {
+            *type = kptFile;
+            *file_sz = opt->file_sz;
+        }
+    }
+    return rc;
+}
+
+static
+rc_t SRANode_Dir(const SRANode* cself, const char* subpath, FSNode_Dir_Visit func, void* data)
+{
+    if( subpath != NULL ) {
+        return RC(rcExe, rcDirectory, rcListing, rcDirEntry, rcInvalid);
+    }
+    return SRAListNode_ListFiles(cself->sra, cself->prefix, cself->flags, func, data);
+}
+
+static
+rc_t SRANode_Open(const SRANode* cself, const char* subpath, const SAccessor** accessor)
+{
+    rc_t rc = 0;
+
+    if( subpath == NULL || strncmp(cself->prefix, subpath, cself->prefix_len) != 0 ) {
+        rc = RC(rcExe, rcSRA, rcEvaluating, rcDirEntry, rcInvalid);
+    } else {
+        const FileOptions* opt;
+        if( (rc = SRAListNode_GetType(cself->sra, cself->flags, &subpath[cself->prefix_len], &opt)) == 0 ) {
+            const KFile* kf = NULL;
+            if( (rc = FileOptions_OpenFile(opt, cself->sra, &kf)) == 0 &&
+                (rc = KFileAccessor_Make(accessor, cself->prefix, kf)) != 0 ) {
+                ReleaseComplain(KFileRelease, kf);
+            }
+        }
+    }
+    if( rc != 0 ) {
+        SAccessor_Release(*accessor);
+        *accessor = NULL;
+    }
+    return rc;
+}
+
+static
+rc_t SRANode_Release(SRANode* self)
+{
+    if( self != NULL ) {
+        SRAListNode_Release(self->sra);
+    }
+    return 0;
+}
+
+static FSNode_vtbl SRANode_vtbl = {
+    sizeof(SRANode),
+    SRANode_HasChild,
+    NULL,
+    SRANode_Attr,
+    SRANode_Dir,
+    NULL,
+    SRANode_Open,
+    SRANode_Release
+};
+
+rc_t SRANode_Make(FSNode* parent, const char* prefix, const SRAListNode* sra, SRAConfigFlags flags)
+{
+    rc_t rc = 0;
+
+    if( parent == NULL || prefix == NULL || sra == NULL ) {
+        rc = RC(rcExe, rcNode, rcConstructing, rcParam, rcNull);
+    } else {
+        SRANode* ff = NULL;
+        char buf[128];
+
+        strcpy(buf, "SRA-");
+        strcat(buf, prefix);
+        DEBUG_MSG(8, ("Adding %s\n", buf));
+        if( (rc = FSNode_Make((FSNode**)&ff, buf, &SRANode_vtbl)) == 0 ) {
+            ff->flags |= (flags & eSRAFuseFileArc) ? (eSRAFuseFmtArc | eSRAFuseFmtArcMD5) : 0;
+            ff->flags |= (flags & eSRAFuseFileArcLite) ? (eSRAFuseFmtArcLite | eSRAFuseFmtArcLiteMD5) : 0;
+            ff->flags |= (flags & eSRAFuseFileFastq) ? (eSRAFuseFmtFastq | eSRAFuseFmtFastqGz | eSRAFuseFmtFastqMD5) : 0;
+            ff->flags |= (flags & eSRAFuseFileSFF) ? (eSRAFuseFmtSFF | eSRAFuseFmtSFFGz | eSRAFuseFmtSFFMD5) : 0;
+            ff->prefix = prefix;
+            ff->prefix_len = strlen(prefix);
+            if( (rc = SRAListNode_AddRef(sra)) == 0 ) {
+                ff->sra = sra;
+                rc = FSNode_AddChild(parent, &ff->node);
+            }
+            if( rc != 0 ) {
+                FSNode_Release(&ff->node);
+            }
+        }
+    }
+    return rc;
+}
diff --git a/tools/fuse/sra-node.h b/tools/fuse/sra-node.h
new file mode 100644
index 0000000..7ed2df8
--- /dev/null
+++ b/tools/fuse/sra-node.h
@@ -0,0 +1,34 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_sra_fuse_sra_node_
+#define _h_sra_fuse_sra_node_
+
+#include "node.h"
+
+rc_t SRANode_Make(FSNode* parent, const char* prefix, const SRAListNode* sra, SRAConfigFlags flags);
+
+#endif /* _h_sra_fuse_sra_node_ */
diff --git a/tools/fuse/sra-sff.c b/tools/fuse/sra-sff.c
new file mode 100644
index 0000000..bdf8a2d
--- /dev/null
+++ b/tools/fuse/sra-sff.c
@@ -0,0 +1,249 @@
+/*===========================================================================
+ *
+ *                            Public DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ */
+#include <klib/rc.h>
+#include <kfs/file.h>
+#include <kproc/lock.h>
+#include <kdb/table.h>
+#include <kdb/index.h>
+
+#include <sra/sradb-priv.h>
+#include <sra/sff.h>
+
+#include "log.h"
+#include "xml.h"
+#include "sra-list.h"
+#include "sra-sff.h"
+#include "zlib-simple.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+typedef struct SRASFFFile SRASFFFile;
+#define KFILE_IMPL SRASFFFile
+#include <kfs/impl.h>
+
+struct SRASFFFile {
+    KFile dad;
+    uint32_t buffer_sz;
+    uint64_t file_sz;
+    char* gzipped; /* serves as flag and a buffer */
+    KLock* lock;
+    const SRATable* stbl;
+    const KTable* ktbl;
+    const KIndex* kidx;
+    const SFFReader* reader;
+    /* current buf content */
+    uint64_t from;
+    uint64_t size;
+    char* buf;
+};
+
+static
+rc_t SRASFFFile_Destroy(SRASFFFile *self)
+{
+    if( KLockAcquire(self->lock) == 0 ) {
+        ReleaseComplain(SFFReaderWhack, self->reader);
+        ReleaseComplain(KIndexRelease, self->kidx);
+        ReleaseComplain(KTableRelease, self->ktbl);
+        ReleaseComplain(SRATableRelease, self->stbl);
+        FREE(self->buf < self->gzipped ? self->buf : self->gzipped);
+        ReleaseComplain(KLockUnlock, self->lock);
+        ReleaseComplain(KLockRelease, self->lock);
+        FREE(self);
+    }
+    return 0;
+}
+
+static
+struct KSysFile* SRASFFFile_GetSysFile(const SRASFFFile *self, uint64_t *offset)
+{
+    *offset = 0;
+    return NULL;
+}
+
+static
+rc_t SRASFFFile_RandomAccess(const SRASFFFile *self)
+{
+    return 0;
+}
+
+static
+uint32_t SRASFFFile_Type(const SRASFFFile *self)
+{
+    return kfdFile;
+}
+
+static
+rc_t SRASFFFile_Size(const SRASFFFile *self, uint64_t *size)
+{
+    *size = self->file_sz;
+    return 0;
+}
+
+static
+rc_t SRASFFFile_SetSize(SRASFFFile *self, uint64_t size)
+{
+    return RC(rcExe, rcFile, rcUpdating, rcInterface, rcUnsupported);
+}
+
+static
+rc_t SRASFFFile_Read(const SRASFFFile* self, uint64_t pos, void *buffer, size_t size, size_t *num_read)
+{
+    rc_t rc = 0;
+
+    if( pos >= self->file_sz ) {
+        *num_read = 0;
+    } else if( (rc = KLockAcquire(self->lock)) == 0 ) {
+        do {
+            if( pos < self->from || pos >= (self->from + self->size) ) {
+                int64_t id = 0;
+                uint64_t id_qty = 0;
+                DEBUG_MSG(8, ("Caching for pos %lu %lu bytes to go\n", pos, size - *num_read));
+                if( (rc = KIndexFindU64(self->kidx, pos, &((SRASFFFile*)self)->from, &((SRASFFFile*)self)->size, &id, &id_qty)) == 0 ) {
+                    DEBUG_MSG(10, ("Caching from %lu:%lu %lu bytes\n", self->from, self->from + self->size - 1, self->size));
+                    DEBUG_MSG(10, ("Caching spot &ld %lu spots\n", id, id_qty));
+                    if( (rc = SFFReaderSeekSpot(self->reader, id)) == 0 ) {
+                        size_t inbuf = 0, w = 0;
+                        char* b = self->buf;
+                        uint64_t left = self->buffer_sz;
+                        do {
+                            if( id == 1 ) {
+                                if( (rc = SFFReaderHeader(self->reader, 0, b, left, &w)) != 0 ) {
+                                    break;
+                                }
+                                b += w; left -= w; inbuf += w;
+                                DEBUG_MSG(10, ("SFF header cached %lu bytes\n", inbuf));
+                            }
+                            if( (rc = SFFReader_GetCurrentSpotData(self->reader, b, left, &w)) != 0 ) {
+                                break;
+                            }
+                            b += w; left -= w; inbuf += w; --id_qty;
+                            DEBUG_MSG(10, ("SFF spot %ld cached %u bytes\n", id, inbuf));
+                            id++;
+                        } while( id_qty > 0 && (rc = SFFReaderNextSpot(self->reader)) == 0);
+                        if( GetRCObject(rc) == rcRow && GetRCState(rc) == rcExhausted ) {
+                            DEBUG_MSG(10, ("No more rows\n"));
+                            rc = 0;
+                        }
+                        DEBUG_MSG(8, ("Cached %u bytes\n", inbuf));
+                        if( self->gzipped != NULL ) {
+                            size_t compressed = 0;
+                            if( (rc = ZLib_DeflateBlock(self->buf, inbuf, self->gzipped, self->buffer_sz, &compressed)) == 0 ) {
+                                char* b = self->buf;
+                                ((SRASFFFile*)self)->buf = self->gzipped;
+                                ((SRASFFFile*)self)->gzipped = b;
+                                ((SRASFFFile*)self)->size = compressed;
+                                DEBUG_MSG(8, ("gzipped %lu bytes\n", self->size));
+                            }
+                        }
+                    }
+                }
+            }
+            if( rc == 0 ) {
+                off_t from = pos - self->from;
+                size_t q = (self->size - from) > (size - *num_read) ? (size - *num_read) : (self->size - from);
+                DEBUG_MSG(10, ("Copying from %lu %u bytes\n", from, q));
+                memcpy(&((char*)buffer)[*num_read], &self->buf[from], q);
+                *num_read = *num_read + q;
+                pos += q;
+            }
+        } while( rc == 0 && *num_read < size && pos < self->file_sz );
+        ReleaseComplain(KLockUnlock, self->lock);
+    }
+    return rc;
+}
+
+static
+rc_t SRASFFFile_Write(SRASFFFile *self, uint64_t pos, const void *buffer, size_t size, size_t *num_writ)
+{
+    return RC(rcExe, rcFile, rcWriting, rcInterface, rcUnsupported);
+}
+
+static KFile_vt_v1 SRASFFFile_vtbl = {
+    1, 1,
+    SRASFFFile_Destroy,
+    SRASFFFile_GetSysFile,
+    SRASFFFile_RandomAccess,
+    SRASFFFile_Size,
+    SRASFFFile_SetSize,
+    SRASFFFile_Read,
+    SRASFFFile_Write,
+    SRASFFFile_Type
+};
+
+rc_t SRASFFFile_Open(const KFile** cself, const SRAListNode* sra, const FileOptions* opt)
+{
+    rc_t rc = 0;
+    SRASFFFile* self;
+
+    CALLOC( self, 1, sizeof( *self ) );
+    if ( self == NULL )
+    {
+        rc = RC( rcExe, rcFile, rcConstructing, rcMemory, rcExhausted );
+    }
+    else
+    {
+        if ( ( rc = KFileInit(&self->dad, (const KFile_vt*)&SRASFFFile_vtbl, "SRASFFFile", "no-name", true, false ) ) == 0 )
+        {
+            if ( ( rc = SRAListNode_TableOpen( sra, &self->stbl ) ) == 0 )
+            {
+                if ( ( rc = SRATableGetKTableRead( self->stbl, &self->ktbl ) ) == 0 )
+                {
+                    if ( ( rc = KTableOpenIndexRead( self->ktbl, &self->kidx, opt->index ) ) == 0 )
+                    {
+                        if ( ( rc = KLockMake( &self->lock ) ) == 0 )
+                        {
+                            MALLOC( self->buf, opt->buffer_sz * ( opt->f.sff.gzip ? 2 : 1 ) );
+                            if ( self->buf == NULL )
+                            {
+                                rc = RC( rcExe, rcFile, rcOpening, rcMemory, rcExhausted );
+                            }
+                            else
+                            {
+                                self->file_sz = opt->file_sz;
+                                self->buffer_sz = opt->buffer_sz;
+                                if ( opt->f.sff.gzip )
+                                {
+                                    self->gzipped = &self->buf[ opt->buffer_sz ];
+                                }
+                                self->from = ~0; /* reset position beyond file end */
+                                rc = SFFReaderMake( &self->reader, self->stbl, opt->f.sff.accession, opt->f.sff.minSpotId, opt->f.sff.maxSpotId );
+                            }
+                        }
+                    }
+                }
+            }
+            if ( rc == 0 )
+            {
+                *cself = &self->dad;
+            }
+            else
+            {
+                KFileRelease( &self->dad );
+            }
+        }
+    }
+    return rc;
+}
diff --git a/tools/fuse/sra-sff.h b/tools/fuse/sra-sff.h
new file mode 100644
index 0000000..0c00e60
--- /dev/null
+++ b/tools/fuse/sra-sff.h
@@ -0,0 +1,34 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_sra_fuse_sra_sff_
+#define _h_sra_fuse_sra_sff_
+
+#include "node.h"
+
+rc_t SRASFFFile_Open(const KFile** cself, const SRAListNode* sra, const FileOptions* opt);
+
+#endif /* _h_sra_fuse_sra_sff_ */
diff --git a/tools/fuse/tar-file.c b/tools/fuse/tar-file.c
new file mode 100644
index 0000000..df7fc6b
--- /dev/null
+++ b/tools/fuse/tar-file.c
@@ -0,0 +1,127 @@
+/*===========================================================================
+ *
+ *                            Public DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ */
+#include <kfs/file.h>
+
+#include <stdlib.h>
+
+#include "log.h"
+#include "tar-list.h"
+#include "tar-file.h"
+
+typedef struct TarFile TarFile;
+#define KFILE_IMPL TarFile
+#include <kfs/impl.h>
+
+struct TarFile {
+    KFile dad;
+    const TarFileList* list;
+};
+
+static
+rc_t TarFile_Destroy(TarFile *self)
+{
+    TarFileList_Release(self->list);
+    FREE(self);
+    return 0;
+}
+
+static
+struct KSysFile* TarFile_GetSysFile(const TarFile *self, uint64_t *offset)
+{
+    *offset = 0;
+    return NULL;
+}
+
+static
+rc_t TarFile_RandomAccess(const TarFile *self)
+{
+    return 0;
+}
+
+static
+uint32_t TarFile_Type(const TarFile *self)
+{
+    return kfdFile;
+}
+
+static
+rc_t TarFile_Size(const TarFile *self, uint64_t *size)
+{
+    return TarFileList_Size(self->list, size);
+}
+
+static
+rc_t TarFile_SetSize(TarFile *self, uint64_t size)
+{
+    return RC(rcExe, rcFile, rcUpdating, rcInterface, rcUnsupported);
+}
+
+static
+rc_t TarFile_Read(const TarFile* self, uint64_t pos, void *buffer, size_t size, size_t *num_read)
+{
+    return TarFileList_Read(self->list, pos, buffer, size, num_read);
+}
+
+static
+rc_t TarFile_Write(TarFile *self, uint64_t pos, const void *buffer, size_t size, size_t *num_writ)
+{
+    return RC(rcExe, rcFile, rcWriting, rcInterface, rcUnsupported);
+}
+
+static KFile_vt_v1 TarFile_vtbl = {
+    1, 1,
+    TarFile_Destroy,
+    TarFile_GetSysFile,
+    TarFile_RandomAccess,
+    TarFile_Size,
+    TarFile_SetSize,
+    TarFile_Read,
+    TarFile_Write,
+    TarFile_Type
+};
+
+rc_t TarFile_Open( const KFile** cself, const TarFileList* list )
+{
+    rc_t rc = 0;
+    TarFile* self;
+
+    CALLOC(self, 1, sizeof(*self));
+
+    if ( self == NULL )
+    {
+        rc = RC(rcExe, rcFile, rcConstructing, rcMemory, rcExhausted);
+    }
+    else if ( ( rc = KFileInit( &self->dad, (const KFile_vt*)&TarFile_vtbl, "TarFile", "no-name", true, false ) ) == 0 &&
+              ( rc = TarFileList_Open( list ) ) == 0 )
+    {
+        self->list = list;
+        *cself = &self->dad;
+    }
+    else
+    {
+        KFileRelease( &self->dad );
+    }
+    return rc;
+}
diff --git a/tools/fuse/tar-file.h b/tools/fuse/tar-file.h
new file mode 100644
index 0000000..b720161
--- /dev/null
+++ b/tools/fuse/tar-file.h
@@ -0,0 +1,33 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#ifndef _h_sra_fuse_tar_file_
+#define _h_sra_fuse_tar_file_
+
+#include "node.h"
+
+rc_t TarFile_Open(const KFile** cself, const TarFileList* list);
+
+#endif /* _h_sra_fuse_tar_file_ */
diff --git a/tools/fuse/tar-list.c b/tools/fuse/tar-list.c
new file mode 100644
index 0000000..946cc28
--- /dev/null
+++ b/tools/fuse/tar-list.c
@@ -0,0 +1,598 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#include <klib/rc.h>
+#include <klib/container.h>
+#include <klib/refcount.h>
+#include <kproc/lock.h>
+#include <kfs/directory.h>
+#include <kfs/file.h>
+
+#include "log.h"
+#include "tar-list.h"
+
+#include <string.h>
+#include <stdlib.h>
+
+typedef enum ETar_Format {
+    eTar_Unknown = 0,
+    eTar_Legacy  = 1,
+    eTar_OldGNU  = 2,
+    eTar_Ustar   = 4,
+    eTar_Posix   = 5
+} ETar_Format;
+
+/* POSIX "ustar" tar archive member header */
+typedef struct SHeader {
+    char name[100];
+    char mode[8];
+    char uid[8];
+    char gid[8];
+    char size[12];
+    char mtime[12];
+    char checksum[8];
+    char typeflag[1];
+    char linkname[100];
+    char magic[6];
+    char version[2];
+    char uname[32];
+    char gname[32];
+    char devmajor[8];
+    char devminor[8];
+    union {
+        char prefix[155];    /* not valid with old GNU format */
+        struct {             /* old GNU format only */
+            char atime[12];
+            char ctime[12];
+        } gt;
+    } x;
+} SHeader;
+
+#define TAR_BLOCK_SIZE (512)
+#define TAR_TAIL_PAD (TAR_BLOCK_SIZE * 2)
+#define TAR_BLOCK_PAD (TAR_BLOCK_SIZE * 20)
+
+union TarBlock {
+    char buffer[TAR_BLOCK_SIZE];
+    SHeader header;
+};
+
+typedef struct TarEntry {
+    BSTNode node;
+    const char* path;
+    const char* name;
+    uint64_t size;
+    KTime_t mtime;
+    bool executable;
+    int16_t name_fmt; /* 0 - fits, +n - split, -n n-blocks */
+    /* file chunks offsets within archive */
+    /* file_header block(s) | file itself | padding to 512 block size */
+    uint64_t start, data, pad, end;
+} TarEntry;
+
+
+static
+void TarEntry_Init(const TarEntry* entry, uint64_t offset, const char* path, const char* name, uint64_t size, KTime_t mtime, bool executable)
+{
+    SHeader* h = NULL;
+    size_t nlen = strlen(name), alloc = 0;
+    TarEntry* e = (TarEntry*)entry;
+
+    e->name = name;
+    e->path = path;
+    e->size = size;
+    e->mtime = mtime;
+    e->executable = executable;
+
+    if(nlen <= sizeof(h->name)) {
+        /* Name fits! */
+        alloc = 1;
+        e->name_fmt = 0;
+    } else if( nlen <= sizeof(h->x.prefix) + 1 + sizeof(h->name) ) {
+        /* Try to split the long name into a prefix and a short name (POSIX) */
+        size_t split = nlen;
+        if(split > sizeof(h->x.prefix)) {
+            split = sizeof(h->x.prefix);
+        }
+        while(split > 0 && e->name[--split] != '/');
+        if(split && nlen - split <= sizeof(h->name) + 1) {
+            alloc = 1;
+            e->name_fmt = split;
+        }
+    }
+    if( alloc == 0 ) {
+        nlen++;
+        /* 2 pieces: 1st long file name header block + name block(s) and second actual file header block */
+        alloc = nlen / TAR_BLOCK_SIZE;
+        alloc += (nlen % TAR_BLOCK_SIZE) ? 1 : 0;
+        alloc += 2;
+        e->name_fmt = -alloc;
+    }
+    e->start = offset;
+    e->data = e->start + alloc * TAR_BLOCK_SIZE;
+    e->pad = e->data + e->size;
+    e->end = e->size % TAR_BLOCK_SIZE;
+    if( e->end != 0 ) {
+        e->end = e->pad + (TAR_BLOCK_SIZE - e->end) - 1;
+    } else {
+        e->end = e->pad - 1;
+    }
+}
+
+/* Convert a number to an octal string padded to the left
+   with [leading] zeros ('0') and having _no_ trailing '\0'. */
+static
+bool TarEntry_NumToOctal(unsigned long val, char* ptr, size_t len)
+{
+    do {
+        ptr[--len] = '0' + (char)(val & 7);
+        val >>= 3;
+    } while(len);
+    return val ? false : true;
+}
+
+static
+bool TarEntry_NumToBase256(uint64_t val, char* ptr, size_t len)
+{
+    do {
+        ptr[--len] = (unsigned char)(val & 0xFF);
+        val >>= 8;
+    } while(len);
+    *ptr |= '\x80';  /* set base-256 encoding flag */
+    return val ? false : true;
+}
+
+
+/* Return 0 (false) if conversion failed; 1 if the value converted to
+   conventional octal representation (perhaps, with terminating '\0'
+   sacrificed), or -1 if the value converted using base-256. */
+static
+int TarEntry_EncodeUint64(uint64_t val, char* ptr, size_t len)
+{
+    if((unsigned long) val == val) {
+        /* Max file size: */
+        if(TarEntry_NumToOctal((unsigned long) val, ptr, len)) {
+            /* 8GB - 1 */
+            return 1;
+        }
+        if(TarEntry_NumToOctal((unsigned long) val, ptr, ++len)) {
+            /* 64GB - 1  */
+            return 1;
+        }
+    }
+    if(TarEntry_NumToBase256(val, ptr, len)) {
+        /* up to 2^94-1  */
+        return -1;
+    }
+    return 0;
+}
+
+static
+bool TarEntry_TarChecksum(TarBlock* block, bool isgnu)
+{
+    SHeader* h = &block->header;
+    size_t i, len = sizeof(h->checksum) - (isgnu ? 2 : 1);
+    unsigned long checksum = 0;
+    const unsigned char* p = (const unsigned char*)block->buffer;
+
+    /* Compute the checksum */
+    memset(h->checksum, ' ', sizeof(h->checksum));
+    for(i = 0; i < sizeof(block->buffer); i++) {
+        checksum += *p++;
+    }
+    /* ustar: '\0'-terminated checksum
+       GNU special: 6 digits, then '\0', then a space [already in place] */
+    if(!TarEntry_NumToOctal(checksum, h->checksum, len)) {
+        return false;
+    }
+    h->checksum[len] = '\0';
+    return true;
+}
+
+static
+rc_t TarEntry_PackName(const TarEntry* e, TarBlock* block)
+{
+    SHeader* h = &block[0].header;
+
+    if( e->name_fmt == 0 ) {
+        strcpy(h->name, e->name);
+    } else if( e->name_fmt > 0 ) {
+        /* to split the long name into a prefix and a short name (POSIX) */
+        memcpy(h->x.prefix, e->name, e->name_fmt);
+        memcpy(h->name, e->name + e->name_fmt + 1, strlen(e->name) - e->name_fmt - 1);
+    } else {
+        strcpy(h->name, "././@LongLink");
+        TarEntry_NumToOctal(0, h->mode, sizeof(h->mode) - 1);
+        TarEntry_NumToOctal(0, h->uid, sizeof(h->uid) - 1);
+        TarEntry_NumToOctal(0, h->gid, sizeof(h->gid) - 1);
+        /* write terminating '\0' as it can always be made to fit in */
+        if(!TarEntry_EncodeUint64(strlen(e->name) + 1, h->size, sizeof(h->size) - 1)) {
+            return RC(rcExe, rcArc, rcConstructing, rcId, rcOutofrange);
+        }
+        TarEntry_NumToOctal(0, h->mtime, sizeof(h->mtime)- 1);
+        h->typeflag[0] = 'L';
+        /* Old GNU magic protrudes into adjacent version field */
+        memcpy(h->magic, "ustar  ", 8); /* 2 spaces and '\0'-terminated */
+        TarEntry_TarChecksum(block, true);
+        strcpy((char*)(&block[1]), e->name);
+
+        /* Still, store the initial part in the original header */
+        h = &block[-e->name_fmt - 1].header;
+        memcpy(h->name, e->name, sizeof(h->name));
+    }
+    return 0;
+}
+
+static
+rc_t TarEntry_Header(const TarEntry* e, TarBlock* block)
+{
+    rc_t rc = 0;
+    /* Update format as we go */
+
+    ETar_Format fmt = eTar_Ustar;
+    int ok;
+    do {
+        uint32_t size =  e->name_fmt < 0 ? -e->name_fmt : 1;
+        SHeader* h = &block[size - 1].header;
+        memset(block, 0, sizeof(*block) * size);
+        if( (rc = TarEntry_PackName(e, block)) != 0 ) {
+            break;
+        }
+        if( !TarEntry_NumToOctal(e->executable ? 00755 : 00644, h->mode, sizeof(h->mode) - 1) ) {
+            rc = RC(rcExe, rcArc, rcConstructing, rcData, rcInvalid);
+            break;
+        }
+        TarEntry_EncodeUint64(0, h->uid, sizeof(h->uid) - 1);
+        TarEntry_EncodeUint64(0, h->gid, sizeof(h->gid) - 1);
+
+        ok = TarEntry_EncodeUint64(e->size, h->size, sizeof(h->size) - 1);
+        if(!ok) {
+            rc = RC(rcExe, rcArc, rcConstructing, rcFile, rcTooBig);
+            break;
+        }
+        if(ok < 0) {
+            fmt = eTar_OldGNU;
+        }
+        if(fmt != eTar_Ustar && h->x.prefix[0]) {
+            /* cannot downgrade to reflect encoding */
+            fmt  = eTar_Ustar;
+        }
+        /* Modification time */
+        if (!TarEntry_NumToOctal(e->mtime, h->mtime, sizeof(h->mtime) - 1)) {
+            rc = RC(rcExe, rcArc, rcConstructing, rcId, rcOutofrange);
+            break;
+        }
+        /* limited version: expect only normal files !!! */
+        h->typeflag[0] = '0';
+        /* User and group */
+        memcpy(h->uname, "anyone", 6);
+        /* memcpy(h->gname, "?????", 5); */
+
+        /* Device nos to complete the ustar header protocol (all fields ok) */
+        if( fmt != eTar_OldGNU ) {
+            TarEntry_NumToOctal(0, h->devmajor, sizeof(h->devmajor) - 1);
+            TarEntry_NumToOctal(0, h->devminor, sizeof(h->devminor) - 1);
+        }
+        if(fmt != eTar_OldGNU) {
+            /* Magic */
+            strcpy(h->magic, "ustar");
+            /* Version (EXCEPTION:  not '\0' terminated) */
+            memcpy(h->version, "00", 2);
+        } else {
+            /* Old GNU magic protrudes into adjacent version field */
+            memcpy(h->magic, "ustar  ", 8); /* 2 spaces and '\0'-terminated */
+        }
+
+        if( !TarEntry_TarChecksum(&block[size - 1], fmt == eTar_OldGNU ? true : false) ) {
+            rc = RC(rcExe, rcArc, rcConstructing, rcId, rcOutofrange);
+        }
+    } while(false);
+    return rc;
+}
+
+static
+rc_t TarEntry_Read(const TarEntry* entry, TarBlock* header_buf, const KFile* kfile, uint64_t pos, uint8_t* buffer, const size_t size, size_t* num_read)
+{
+    rc_t rc = 0;
+
+    if( pos < entry->data ) {
+        /* insert tar header */
+        if( (rc = TarEntry_Header(entry, header_buf)) == 0 ) {
+            size_t q = entry->data - pos;
+            if( q > (size - *num_read) ) {
+                q = size - *num_read;
+            }
+            memcpy(&buffer[*num_read], &header_buf->buffer[pos - entry->start], q);
+            *num_read = *num_read + q;
+            pos += q;
+            DEBUG_LINE(8, "header: %u bytes", q);
+        }
+    }
+    if( rc == 0 && *num_read < size && pos < entry->pad ) {
+        /* read file data */
+        size_t rd;
+        if( (rc = KFileRead(kfile, pos - entry->data, &buffer[*num_read], size - *num_read, &rd)) == 0 ) {
+            DEBUG_LINE(8, "file: from %lu %u bytes", pos - entry->data, rd);
+            *num_read = *num_read + rd;
+            pos += rd;
+        }
+    }
+    if( rc == 0 && *num_read < size && pos <= entry->end ) {
+        /* pad last block with 0 */
+        size_t q = entry->end - pos + 1;
+        if( q > (size - *num_read) ) {
+            q = size - *num_read;
+        }
+        memset(&buffer[*num_read], 0, q);
+        *num_read = *num_read + q;
+        DEBUG_LINE(8, "padding: %u bytes", q);
+    }
+    return rc;
+}
+
+struct TarFileList {
+    KRefcount refcount;
+    const TarEntry* files;
+    uint32_t count;
+    uint32_t max_count;
+    uint64_t tar_sz;
+    uint16_t tar_10k_pad;
+    char* strings;
+    uint64_t strings_avail;
+    /* used to setup cache in file */
+    uint16_t max_header_blocks;
+    /* current file data/cache */
+    KLock* lock;
+    BSTree btree;
+    TarBlock* header_buf;
+    const TarEntry* cur_entry;
+    const KFile* cur_file;
+};
+
+rc_t TarFileList_Make(const TarFileList** cself, uint32_t max_file_count, const char* name)
+{
+    rc_t rc = 0;
+
+    if( cself == NULL || max_file_count == 0 ) {
+        rc = RC(rcExe, rcArc, rcConstructing, rcParam, rcInvalid);
+    } else {
+        TarFileList* l = NULL;
+        uint64_t strings_sz = max_file_count * 2048;
+        *cself = NULL;
+        CALLOC(l, 1, sizeof(*l) + max_file_count * sizeof(*(l->files)) + strings_sz);
+        if( l == NULL ) {
+            /* allocate self + array of entries + 1024 for path and name */
+            rc = RC(rcExe, rcArc, rcConstructing, rcMemory, rcExhausted);
+        } else if( (rc = KLockMake(&l->lock)) == 0 ) {
+            KRefcountInit(&l->refcount, 1, "TarFileList", "Make", name);
+            l->max_count = max_file_count;
+            l->tar_sz = TAR_TAIL_PAD;
+            l->files = (TarEntry*)&l[1]; /* files array follows self */
+            l->strings_avail = strings_sz;
+            l->strings = (char*)&l->files[l->max_count]; /* string table follows last entry */
+            l->max_header_blocks = 1;
+            *cself = l;
+        }
+    }
+    return rc;
+}
+
+void TarFileList_Release(const TarFileList* cself)
+{
+    if( cself != NULL ) {
+        TarFileList* self = (TarFileList*)cself;
+        if( KLockAcquire(self->lock) == 0 ) {
+            int x = KRefcountDropDep(&self->refcount, "TarFileList");
+            if( atomic32_read(&self->refcount) < 2 ) {
+                self->cur_entry = NULL;
+                ReleaseComplain(KFileRelease, self->cur_file);
+                self->cur_file = NULL;
+            }
+            if( x == krefWhack ) {
+                KRefcountWhack(&self->refcount, "TarFileList");
+                FREE(self->header_buf);
+                BSTreeWhack(&self->btree, NULL, NULL);
+                ReleaseComplain(KLockUnlock, self->lock);
+                ReleaseComplain(KLockRelease, self->lock);
+                FREE(self);
+            } else {
+                ReleaseComplain(KLockUnlock, self->lock);
+            }
+        }
+    }
+}
+
+rc_t TarFileList_Add(const TarFileList* cself, const char* path, const char* name, uint64_t size, KTime_t mtime, bool executable)
+{
+    rc_t rc = 0;
+
+    if( cself == NULL || path == NULL || name == NULL ) {
+        rc = RC(rcExe, rcArc, rcRegistering, rcParam, rcInvalid);
+    } else if( (rc = KLockAcquire(cself->lock)) == 0 ) {
+        if( cself->count >= cself->max_count ) {
+            rc = RC(rcExe, rcArc, rcRegistering, rcDirEntry, rcExcessive);
+        } else if( cself->header_buf != NULL ) {
+            rc = RC(rcExe, rcArc, rcRegistering, rcDirEntry, rcReadonly);
+        } else {
+            TarFileList* self = (TarFileList*)cself;
+            size_t lp = strlen(path) + 1, ln = strlen(name) + 1;
+
+            if( lp + ln  >= cself->strings_avail ) {
+                rc = RC(rcExe, rcArc, rcRegistering, rcName, rcExcessive);
+            } else {
+                const TarEntry* e = &cself->files[cself->count];
+
+                /* copy path/name to internal buffer */
+                strncpy(cself->strings, path, lp);
+                path = cself->strings;
+                self->strings += lp;
+                self->strings_avail -= lp;
+                strncpy(cself->strings, name, ln);
+                name = cself->strings;
+                self->strings += ln;
+                self->strings_avail -= ln;
+
+                TarEntry_Init(e, cself->tar_sz - TAR_TAIL_PAD, path, name, size, mtime, executable);
+                self->tar_sz += e->end - e->start + 1;
+                self->tar_10k_pad = self->tar_sz % TAR_BLOCK_PAD;
+                if( self->tar_10k_pad != 0 ) {
+                    self->tar_10k_pad = TAR_BLOCK_PAD - self->tar_10k_pad;
+                }
+                if( e->name_fmt < 0 && cself->max_header_blocks < -e->name_fmt ) {
+                    self->max_header_blocks = -e->name_fmt;
+                }
+                self->count++;
+            }
+        }
+        ReleaseComplain(KLockUnlock, cself->lock);
+    }
+    return rc;
+}
+
+rc_t TarFileList_Size(const TarFileList* cself, uint64_t* file_sz)
+{
+    if( cself == NULL || file_sz == NULL ) {
+        return RC(rcExe, rcArc, rcAccessing, rcParam, rcInvalid);
+    }
+    *file_sz = cself->tar_sz + cself->tar_10k_pad;
+    return 0;
+}
+
+static
+int TarFileList_Sort(const BSTNode *item, const BSTNode *node)
+{
+    const TarEntry* i = (const TarEntry*)item;
+    const TarEntry* n = (const TarEntry*)node;
+
+    if( i->start > n->end ) {
+        return 1;
+    } else if( i->end < n->start ) {
+        return -1;
+    }
+    /* fails on insert! */
+    return 0;
+}
+
+rc_t TarFileList_Open(const TarFileList* cself)
+{
+    rc_t rc = 0;
+    if( cself == NULL ) {
+        rc = RC(rcExe, rcArc, rcOpening, rcParam, rcInvalid);
+    } else if( (rc = KLockAcquire(cself->lock)) == 0 ) {
+        TarFileList* self = (TarFileList*)cself;
+        if( self->header_buf == NULL ) {
+            MALLOC(self->header_buf, self->max_header_blocks * TAR_BLOCK_SIZE);
+            if( self->header_buf == NULL ) {
+                rc = RC(rcExe, rcArc, rcOpening, rcMemory, rcExhausted);
+            } else {
+                /* build file offset search tree */
+                uint32_t i;
+                BSTreeInit(&self->btree);
+                /* adjust last file size to include archive-end of 2 512 blocks + 10k block padding */
+                ((TarEntry*)(self->files + self->count - 1))->end += TAR_TAIL_PAD + self->tar_10k_pad;
+                self->tar_sz += self->tar_10k_pad;
+                self->tar_10k_pad = 0;
+                for(i = 0; rc == 0 && i < self->count; i++) {
+                    rc = BSTreeInsertUnique(&self->btree, (BSTNode*)&self->files[i].node, NULL, TarFileList_Sort);
+                }
+            }
+        }
+        if( rc == 0 && KRefcountAddDep(&self->refcount, "TarFileList") != krefOkay ) {
+            rc = RC(rcExe, rcArc, rcOpening, rcRefcount, rcFailed);
+        }
+        ReleaseComplain(KLockUnlock, cself->lock);
+    }
+    return rc;
+}
+
+static
+int TarFileList_Find(const void *item, const BSTNode *node)
+{
+    uint64_t pos = *(uint64_t*)item;
+    const TarEntry* n = (const TarEntry*)node;
+    if( pos < n->start ) {
+        return -1;
+    } else if( pos > n->end ) {
+        return 1;
+    }
+    return 0;
+}
+
+rc_t TarFileList_Read(const TarFileList* cself, uint64_t pos, uint8_t* buffer, size_t size, size_t* num_read)
+{
+    rc_t rc = 0;
+
+    if( cself == NULL ) {
+        rc = RC(rcExe, rcArc, rcReading, rcParam, rcInvalid);
+    } else if( (rc = KLockAcquire(cself->lock)) == 0 ) {
+        *num_read = 0;
+        if( cself->header_buf == NULL ) {
+            rc = RC(rcExe, rcArc, rcReading, rcBuffer, rcNull);
+        } else if( pos < cself->tar_sz ) {
+            while( rc == 0 && *num_read < size && pos < cself->tar_sz ) {
+                if( cself->cur_entry == NULL || pos < cself->cur_entry->start || pos > cself->cur_entry->end ) {
+                    KFileRelease(cself->cur_file);
+                    ((TarFileList*)cself)->cur_entry = (const TarEntry*)BSTreeFind(&cself->btree, &pos, TarFileList_Find);
+                    if( cself->cur_entry != NULL ) {
+                        KDirectory* dir;
+                        DEBUG_LINE(8, "Open: '%s'", cself->cur_entry->path);
+                        if( (rc = KDirectoryNativeDir(&dir)) == 0 ) {
+                            if( (rc = KDirectoryOpenFileRead(dir, &((TarFileList*)cself)->cur_file, "%s", cself->cur_entry->path)) == 0 ) {
+                                uint64_t size = 0;
+                                if( (rc = KFileSize(cself->cur_file, &size)) == 0 ) {
+                                    if( cself->cur_entry->size != size ) {
+                                        rc = RC(rcExe, rcArc, rcReading, rcFileDesc, rcInvalid);
+                                        PLOGERR(klogErr, (klogErr, rc, "Source file size differ in XML $(p)", PLOG_S(p), cself->cur_entry->path));
+                                    }
+                                }
+                            } else {
+                                PLOGERR(klogErr, (klogErr, rc, "$(p)", PLOG_S(p), cself->cur_entry->path));
+                            }
+                            ReleaseComplain(KDirectoryRelease, dir);
+                        }
+                    } else {
+                        rc = RC(rcExe, rcArc, rcReading, rcOffset, rcInvalid);
+                    }
+                }
+                if( rc == 0 ) {
+                    size_t rd = *num_read;
+                    DEBUG_LINE(8, "Reading: '%s'", cself->cur_entry->path);
+                    if( (rc = TarEntry_Read(cself->cur_entry, cself->header_buf, cself->cur_file, pos, buffer, size, num_read)) == 0 ) {
+                        DEBUG_LINE(8, "read: %u bytes", *num_read);
+                        pos += *num_read - rd;
+                    }
+                }
+            }
+        }
+        ReleaseComplain(KLockUnlock, cself->lock);
+#if _DEBUGGING
+        if( rc == 0 && size < *num_read ) {
+            PLOGERR(klogErr, (klogErr, RC(rcExe, rcArc, rcReading, rcData, rcTooLong),
+                "file $(f) at pos $(p): $(s) < $(n)", "p=%lu,s=%lu,n=%lu,f=%s", pos, size, *num_read, cself->cur_entry->path));
+        }
+#endif
+    }
+    return rc;
+}
diff --git a/tools/fuse/tar-list.h b/tools/fuse/tar-list.h
new file mode 100644
index 0000000..7fcfbea
--- /dev/null
+++ b/tools/fuse/tar-list.h
@@ -0,0 +1,49 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#ifndef _h_sra_fuse_tar_list_
+#define _h_sra_fuse_tar_list_
+
+#include <klib/rc.h>
+
+#define TAR_BLOCK_SIZE (512)
+
+typedef union TarBlock TarBlock;
+
+typedef struct TarFileList TarFileList;
+
+rc_t TarFileList_Make(const TarFileList** cself, uint32_t max_file_count, const char* name);
+
+void TarFileList_Release(const TarFileList* cself);
+
+rc_t TarFileList_Add(const TarFileList* cself, const char* path, const char* name, uint64_t size, KTime_t mtime, bool executable);
+
+rc_t TarFileList_Size(const TarFileList* cself, uint64_t* file_sz);
+
+rc_t TarFileList_Open(const TarFileList* cself);
+
+rc_t TarFileList_Read(const TarFileList* cself, uint64_t pos, uint8_t* buffer, size_t size, size_t* num_read);
+
+#endif /* _h_sra_fuse_tar_list_ */
diff --git a/tools/fuse/tar-node.c b/tools/fuse/tar-node.c
new file mode 100644
index 0000000..aff3fd1
--- /dev/null
+++ b/tools/fuse/tar-node.c
@@ -0,0 +1,320 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#include <klib/namelist.h>
+#include <klib/printf.h>
+#include <kxml/xml.h>
+#include <kfs/directory.h>
+#include <kfs/file.h>
+
+typedef struct TarNode TarNode;
+#define FSNODE_IMPL TarNode
+
+#include "log.h"
+#include "xml.h"
+#include "tar-node.h"
+#include "tar-list.h"
+#include "tar-file.h"
+#include "kfile-accessor.h"
+
+#include <string.h>
+#include <stdlib.h>
+#include <time.h>
+
+struct TarNode {
+    FSNode node;
+    const TarFileList* files;
+    const char* rel_path;
+    /* used only in case of auto-detected .tar.xml file */
+    KTime_t mtime;
+    const char* xml_path;
+};
+
+static
+rc_t TarNode_MakeFileList(const KXMLNode* xml_node, const TarFileList** files, char* errmsg, const char* rel_path, const char* name)
+{
+    rc_t rc = 0;
+    time_t now = time(NULL);
+    uint32_t count = 0;
+
+    *files = NULL;
+    if( (rc = KXMLNodeCountChildNodes(xml_node, &count)) == 0 ) {
+        if( count == 0 ) {
+            rc = RC(rcExe, rcDoc, rcValidating, rcData, rcEmpty);
+        } else if( (rc = TarFileList_Make(files, count, name)) == 0 ) {
+            uint32_t i = 0;
+            while(rc == 0 && i < count) {
+                const KXMLNode* n = NULL;
+                const char* n_name;
+                if( (rc = KXMLNodeGetNodeRead(xml_node, &n, i++)) == 0 && (rc = KXMLNodeElementName(n, &n_name)) == 0 ) {
+                    if( strcmp(n_name, "Item") != 0 ) {
+                        rc = RC(rcExe, rcDoc, rcValidating, rcNode, rcUnexpected);
+                        strcpy(errmsg, n_name);
+                    } else {
+                        size_t sz_read;
+                        char path[4096], name[4096];
+                        KTime_t ts = now;
+                        uint64_t fsz = 0;
+                        bool exec = false;
+
+                        if( (rc = KXMLNodeReadAttrCString(n, "path", name, sizeof(name), &sz_read)) == 0 ) {
+                            if( name[0] == '\0' ) {
+                                rc = RC(rcExe, rcDoc, rcValidating, rcAttr, rcEmpty);
+                            } else if( name[0] == '/' ) {
+                                memcpy(path, name, sz_read + 1);
+                            } else {
+                                KDirectory* dir = NULL;
+                                if( (rc = KDirectoryNativeDir(&dir)) == 0 &&
+                                    (rc = KDirectoryResolvePath(dir, true, path, sizeof(path), "%s/%s", rel_path, name)) == 0 ) {
+                                    DEBUG_LINE(8, "%s/%s resolved to %s", rel_path, name, path);
+                                }
+                                KDirectoryRelease(dir);
+                            }
+                            if( rc != 0 ) {
+                                strcpy(errmsg, "TAR/Item/@path");
+                            }
+                        }
+                        if( rc == 0 && (rc = XML_ParseTimestamp(n, "timestamp", &ts, true)) != 0 ) {
+                            strcpy(errmsg, "TAR/Item/@timestamp");
+                        }
+                        if( rc == 0 && (rc = XML_ParseBool(n, "executable", &exec, true)) != 0 ) {
+                            strcpy(errmsg, "TAR/Item/@executable");
+                        }
+                        if( rc == 0 && (rc = KXMLNodeReadAttrAsU64(n, "size", &fsz)) != 0 ) {
+                            strcpy(errmsg, "TAR/Item/@size");
+                        }
+                        if( rc == 0 ) {
+                            name[0] = '\0';
+                            rc = KXMLNodeReadAttrCString(n, "name", name, sizeof(name), &sz_read);
+                            if( (GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound) || name[0] == '\0' ) {
+                                char* x = strrchr(path, '/');
+                                strcpy(name, x ? x + 1 : path);
+                                rc = 0;
+                            } else if( rc == 0 && name[0] == '/' ) {
+                                strcat(errmsg, "Item/@name cannot be absolute");
+                                rc = RC(rcExe, rcDoc, rcValidating, rcName, rcInvalid);
+                            } else if( rc != 0 ) {
+                                strcpy(errmsg, "Item/@name");
+                            }
+                        }
+                        if( rc == 0 ) {
+                            const KNamelist* attr = NULL;
+                            if( (rc = KXMLNodeListAttr(n, &attr)) == 0 ) {
+                                uint32_t j = 0, count = 0;
+                                if( (rc = KNamelistCount(attr, &count)) == 0 && count > 0 ) {
+                                    while( rc == 0 && j < count ) {
+                                        const char *attr_nm = NULL;
+                                        if( (rc = KNamelistGet(attr, j++, &attr_nm)) != 0 ) {
+                                            break;
+                                        }
+                                        if( strcmp("path", attr_nm) == 0 || strcmp("name", attr_nm) == 0 ||
+                                            strcmp("timestamp", attr_nm) == 0 || strcmp("size", attr_nm) == 0 ||
+                                            strcmp("executable", attr_nm) == 0 ) {
+                                            continue;
+                                        }
+                                        rc = RC(rcExe, rcDoc, rcValidating, rcDirEntry, rcInvalid);
+                                        strcpy(errmsg, "unknown attribute TAR/Item/@");
+                                        strcat(errmsg, attr_nm);
+                                    }
+                                }
+                                ReleaseComplain(KNamelistRelease, attr);
+                            }
+                        }
+                        if( rc == 0 && (rc = TarFileList_Add(*files, path, name, fsz, ts, exec)) != 0 ) {
+                            strcpy(errmsg, "adding to TAR");
+                        }
+                    }
+                    ReleaseComplain(KXMLNodeRelease, n);
+                }
+            }
+            if( rc != 0 ) {
+                TarFileList_Release(*files);
+                *files = NULL;
+            }
+        }
+    }
+    return rc;
+}
+
+static
+rc_t TarNode_Touch(const TarNode* cself)
+{
+    rc_t rc = 0;
+
+    if( cself->xml_path != NULL ) {
+        KDirectory* dir = NULL;
+        if( (rc = KDirectoryNativeDir(&dir)) == 0 ) {
+            KTime_t dt;
+            if( (rc = KDirectoryDate(dir, &dt, "%s", cself->xml_path)) == 0 ) {
+                if( dt != cself->mtime ) {
+                    const KFile* kfile = NULL;
+                    DEBUG_MSG(8, ("%s: updating tar %s\n", __func__, cself->xml_path));
+                    if( (rc = KDirectoryOpenFileRead(dir, &kfile, "%s", cself->xml_path)) == 0 ) {
+                        const KXMLMgr* xmlmgr;
+                        if( (rc = XML_MgrGet(&xmlmgr)) == 0 ) {
+                            const KXMLDoc* xmldoc = NULL;
+                            if( (rc = KXMLMgrMakeDocRead(xmlmgr, &xmldoc, kfile)) == 0 ) {
+                                const KXMLNodeset* ns = NULL;
+                                if( (rc = KXMLDocOpenNodesetRead(xmldoc, &ns, "/TAR")) == 0 ) {
+                                    uint32_t count = 0;
+                                    if( (rc = KXMLNodesetCount(ns, &count)) == 0 ) {
+                                        if( count != 1 ) {
+                                            rc = RC(rcExe, rcDoc, rcValidating, rcData, rcInvalid);
+                                        } else {
+                                            const KXMLNode* n = NULL;
+                                            if( (rc = KXMLNodesetGetNodeRead(ns, &n, 0)) == 0 ) {
+                                                char errmsg[4096];
+                                                const TarFileList* new_files;
+                                                if( (rc = TarNode_MakeFileList(n, &new_files, errmsg, cself->rel_path, cself->node.name)) != 0 ) {
+                                                    LOGERR(klogErr, rc, errmsg);
+                                                } else {
+                                                    TarFileList_Release(cself->files);
+                                                    ((TarNode*)cself)->files = new_files;
+                                                    ((TarNode*)cself)->mtime = dt;
+                                                }
+                                                ReleaseComplain(KXMLNodeRelease, n);
+                                            }
+                                        }
+                                    }
+                                    ReleaseComplain(KXMLNodesetRelease, ns);
+                                }
+                                ReleaseComplain(KXMLDocRelease, xmldoc);
+                            }
+                        }
+                        ReleaseComplain(KFileRelease, kfile);
+                    }
+                }
+            }
+            ReleaseComplain(KDirectoryRelease, dir);
+        }
+    }
+    return rc;
+}
+
+static
+rc_t TarNode_Attr(const TarNode* cself, const char* subpath, uint32_t* type, KTime_t* ts, uint64_t* file_sz, uint32_t* access, uint64_t* block_sz)
+{
+    rc_t rc = 0;
+
+    if( subpath != NULL ) {
+        rc = RC(rcExe, rcFile, rcEvaluating, rcDirEntry, rcNotFound);
+    } else {
+        *type = kptFile;
+        rc = TarFileList_Size(cself->files, file_sz);
+        if( cself->xml_path != NULL ) {
+            *ts = cself->mtime;
+        }
+    }
+    return rc;
+}
+
+static
+rc_t TarNode_Open(const TarNode* cself, const char* subpath, const SAccessor** accessor)
+{
+    rc_t rc = 0;
+
+    if( subpath != NULL ) {
+        rc = RC(rcExe, rcFile, rcOpening, rcDirEntry, rcNotFound);
+    } else {
+        const KFile* kf = NULL;
+        if( (rc = TarFile_Open(&kf, cself->files)) == 0 ) {
+            if( (rc = KFileAccessor_Make(accessor, cself->node.name, kf)) != 0 ) {
+                ReleaseComplain(KFileRelease, kf);
+            }
+        }
+    }
+    if( rc != 0 ) {
+        SAccessor_Release(*accessor);
+        *accessor = NULL;
+    }
+    return rc;
+}
+
+static
+rc_t TarNode_Release(TarNode* self)
+{
+    if( self != NULL ) {
+        DEBUG_MSG(8, ("%s: %s\n", __func__, self->xml_path));
+        TarFileList_Release(self->files);
+    }
+    return 0;
+}
+
+static FSNode_vtbl TarNode_vtbl = {
+    sizeof(TarNode),
+    NULL,
+    TarNode_Touch,
+    TarNode_Attr,
+    NULL,
+    NULL,
+    TarNode_Open,
+    TarNode_Release
+};
+
+rc_t TarNode_MakeXML(const KXMLNode* xml_node, FSNode** self, char* errmsg, const char* rel_path)
+{
+    rc_t rc = 0;
+
+    if( xml_node == NULL || self == NULL ) {
+        rc = RC(rcExe, rcNode, rcConstructing, rcParam, rcNull);
+    } else {
+        char name[4096];
+        size_t sz;
+
+        rc = KXMLNodeReadAttrCString(xml_node, "name", name, sizeof(name), &sz);
+        if( rc != 0 || sz == 0 || name[0] == '\0' ) {
+            strcpy(errmsg, "attribute 'name'");
+            rc = rc ? rc : RC(rcExe, rcDoc, rcValidating, rcAttr, rcInvalid);
+        } else if( (rc = FSNode_Make(self, name, &TarNode_vtbl)) == 0 ) {
+            ((TarNode*)*self)->rel_path = rel_path;
+            strcpy(errmsg, "processing Item(s)");
+            if( (rc = TarNode_MakeFileList(xml_node, &((TarNode*)*self)->files, errmsg, rel_path, (*self)->name)) != 0 ) {
+                FSNode_Release(*self);
+                *self = NULL;
+            }
+        }
+    }
+    return rc;
+}
+
+rc_t TarNode_MakeAuto(const FSNode** cself, const KDirectory* dir, const char* path, const char* file, const char* xml_path)
+{
+    rc_t rc = 0;
+
+    if( cself == NULL || dir == NULL || path == NULL || file == NULL || xml_path == NULL ) {
+        rc = RC(rcExe, rcNode, rcConstructing, rcParam, rcNull);
+    } else {
+        if( (rc = FSNode_Make((FSNode**)cself, file, &TarNode_vtbl)) == 0 ) {
+            ((char*)((*cself)->name))[strlen(file) - 4] = '\0'; /* -= .xml */
+            ((TarNode*)*cself)->xml_path = xml_path;
+            ((TarNode*)*cself)->rel_path = path;
+            if( (rc = FSNode_Touch(*cself)) != 0 ) {
+                FSNode_Release(*cself);
+                *cself = NULL;
+            }
+        }
+    }
+    return rc;
+}
diff --git a/tools/fuse/tar-node.h b/tools/fuse/tar-node.h
new file mode 100644
index 0000000..d8a5552
--- /dev/null
+++ b/tools/fuse/tar-node.h
@@ -0,0 +1,35 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#ifndef _h_sra_fuse_tar_node_
+#define _h_sra_fuse_tar_node_
+
+#include "node.h"
+
+rc_t TarNode_MakeXML(const KXMLNode* xml_node, FSNode** cself, char* errmsg, const char* rel_path);
+
+rc_t TarNode_MakeAuto(const FSNode** cself, const KDirectory* dir, const char* path, const char* file, const char* xml_path);
+
+#endif /* _h_sra_fuse_tar_node_ */
diff --git a/tools/fuse/text-file.c b/tools/fuse/text-file.c
new file mode 100644
index 0000000..dc5efb2
--- /dev/null
+++ b/tools/fuse/text-file.c
@@ -0,0 +1,134 @@
+/*===========================================================================
+ *
+ *                            Public DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ */
+#include <klib/rc.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "log.h"
+#include "formats.h"
+#include "text-file.h"
+
+typedef struct TextFile TextFile;
+#define KFILE_IMPL TextFile
+#include <kfs/impl.h>
+
+struct TextFile {
+    KFile dad;
+    char* data;
+};
+
+static
+rc_t TextFile_Destroy(TextFile *self)
+{
+    FREE(self->data);
+    FREE(self);
+    return 0;
+}
+
+static
+struct KSysFile* TextFile_GetSysFile(const TextFile *self, uint64_t *offset)
+{
+    *offset = 0;
+    return NULL;
+}
+
+static
+rc_t TextFile_RandomAccess(const TextFile *self)
+{
+    return 0;
+}
+
+static
+uint32_t TextFile_Type(const TextFile *self)
+{
+    return kfdFile;
+}
+
+static
+rc_t TextFile_Size(const TextFile *self, uint64_t *size)
+{
+    *size = strlen(self->data);
+    return 0;
+}
+
+static
+rc_t TextFile_SetSize(TextFile *self, uint64_t size)
+{
+    return RC(rcExe, rcFile, rcUpdating, rcInterface, rcUnsupported);
+}
+
+static
+rc_t TextFile_Read(const TextFile *self, uint64_t pos, void *buffer, size_t bsize, size_t *num_read)
+{
+    *num_read = strlen(self->data);
+    if( pos < *num_read ) {
+        *num_read = (*num_read < bsize) ? *num_read : bsize;
+        memcpy(buffer, &self->data[pos], *num_read);
+    } else {
+        *num_read = 0;
+    }
+    return 0;
+}
+
+static
+rc_t TextFile_Write(TextFile *self, uint64_t pos, const void *buffer, size_t size, size_t *num_writ)
+{
+    return RC(rcExe, rcFile, rcWriting, rcInterface, rcUnsupported);
+}
+
+static KFile_vt_v1 TextFile_vtbl = {
+    1, 1,
+    TextFile_Destroy,
+    TextFile_GetSysFile,
+    TextFile_RandomAccess,
+    TextFile_Size,
+    TextFile_SetSize,
+    TextFile_Read,
+    TextFile_Write,
+    TextFile_Type
+};
+
+
+rc_t TextFile_Open( const KFile** cself, const FileOptions* opt )
+{
+    rc_t rc = 0;
+    TextFile* self;
+    CALLOC(self, 1, sizeof(*self));
+    if( self == NULL )
+    {
+        rc = RC(rcExe, rcFile, rcConstructing, rcMemory, rcExhausted );
+    }
+    else if ( ( rc = KFileInit( &self->dad, (const KFile_vt*)&TextFile_vtbl, "TextFile", "no-name", true, false ) ) != 0 ||
+              ( rc = StrDup( opt->f.txt64b, &self->data ) ) != 0 )
+    {
+        KFileRelease( &self->dad );
+    }
+    else
+    {
+        *cself = &self->dad;
+    }
+    return rc;
+}
diff --git a/tools/fuse/text-file.h b/tools/fuse/text-file.h
new file mode 100644
index 0000000..78a6cc1
--- /dev/null
+++ b/tools/fuse/text-file.h
@@ -0,0 +1,36 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_sra_fuse_text_file_
+#define _h_sra_fuse_text_file_
+
+#include <kfs/file.h>
+
+#include "node.h"
+
+rc_t TextFile_Open(const KFile** cself, const FileOptions* opt);
+
+#endif /* _h_sra_fuse_text_file_ */
diff --git a/tools/fuse/unix/remote-fuser-sys.c b/tools/fuse/unix/remote-fuser-sys.c
new file mode 100644
index 0000000..6031f98
--- /dev/null
+++ b/tools/fuse/unix/remote-fuser-sys.c
@@ -0,0 +1,696 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#include <kapp/main.h>
+#include <kapp/args.h>
+#include <klib/log.h>
+#include <klib/out.h>
+#include <klib/status.h>
+#include <klib/text.h>
+#include <klib/printf.h>
+#include <kfs/directory.h>
+
+#define FUSE_USE_VERSION 25
+#include <fuse.h>
+
+#include "xml.h"
+#include "remote-fuser.h"
+#include "log.h"
+
+#include "remote-cache.h"
+
+#include <atomic.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+/* we will preserve mount point value */
+static char g_mount_point [ 4096 ];
+
+static struct stat g_mount_point_stat;
+static struct stat g_dflt_file_stat;
+static atomic64_t num_open_files;
+
+static
+int ConvertRC2errno(rc_t rc)
+{
+    switch(GetRCState(rc)) {
+        case rcNoErr:
+            return 0;
+        case rcNotFound:
+            return ENOENT;
+        case rcNull:
+            return EFAULT;
+        case rcInvalid:
+            return EINVAL;
+        case rcInsufficient:
+            return ENAMETOOLONG;
+        case rcReadonly:
+            return EROFS;
+        case rcUnauthorized:
+            return EACCES;
+        case rcCorrupt:
+        default:
+            return EBADF;
+    }
+}
+
+/* Kinda scary thing, but whomknows */
+void FUSER_abort ()
+{
+    LOGMSG(klogInfo, "Aborting remote fuser by request");
+    fuse_unmount ( g_mount_point );
+    exit ( 1 );
+}
+
+void* UX_FUSE_init(void)
+{
+    atomic64_set(&num_open_files, 0);
+    SRA_FUSER_Init();
+    return NULL;
+}
+
+void UX_FUSE_destroy(void* x)
+{
+    uint64_t q = atomic64_read(&num_open_files);
+    if( q > 0 ) {
+        PLOGMSG(klogInfo, (klogInfo, "$(q) files still opened", PLOG_U64(q), q));
+    }
+    SRA_FUSER_Fini();
+}
+
+struct UX_FUSE_readdir_callback_data {
+    const char *path;
+    void *buf;
+    fuse_fill_dir_t filler;
+};
+
+static
+rc_t CC UX_FUSE_readdir_callback( const char *name, void *data )
+{
+    struct UX_FUSE_readdir_callback_data* d = (struct UX_FUSE_readdir_callback_data*)data;
+    int r = d->filler(d->buf, name, NULL, 0);
+    DEBUG_MSG(10, ("%s %s entry: '%s'\n", __func__, d->path, name));
+    return r != 0 ? RC(rcExe, rcDirectory, rcReading, rcBuffer, rcInsufficient) : 0;
+}
+
+int UX_FUSE_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
+                     off_t offset, struct fuse_file_info *fi)
+{
+    rc_t rc = 0;
+    struct UX_FUSE_readdir_callback_data data;
+
+    DEBUG_MSG(8, ("%s: %s\n", __func__, path));
+
+    data.path = path;
+    data.filler = filler;
+    data.buf = buf;
+
+    if( (rc = UX_FUSE_readdir_callback(".", &data)) == 0 &&
+        (rc = UX_FUSE_readdir_callback("..", &data)) == 0 ) {
+        rc = SRA_FUSER_GetDir(path, UX_FUSE_readdir_callback, &data);
+    }
+    if( rc != 0 ) {
+        errno = ConvertRC2errno(rc);
+        PLOGERR(klogErr, (klogErr, rc, "$(f): $(p) - $(e)", PLOG_3(PLOG_S(f),PLOG_S(p),PLOG_S(e)), __func__, path, strerror(errno)));
+        return -errno;
+    }
+    return 0;
+}
+
+int UX_FUSE_getattr(const char *path, struct stat *stbuf)
+{
+    rc_t rc = 0;
+
+    DEBUG_MSG(8, ("%s: %s\n", __func__, path));
+    if( stbuf == NULL) {
+        rc = RC(rcExe, rcFileDesc, rcClassifying, rcParam, rcNull);
+    } else if( strcmp(path, "/") == 0 ) {
+        /* root is known as mount point */
+        memcpy(stbuf, &g_mount_point_stat, sizeof(g_mount_point_stat));
+    } else {
+        uint32_t type = kptBadPath, access = 0;
+        KTime_t ts = 0;
+        uint64_t file_sz = 0, block_sz = 0;
+        if( (rc = SRA_FUSER_GetAttr(path, &type, &ts, &file_sz, &access, &block_sz)) == 0 ) {
+            bool symlink = (type & kptAlias);
+            if( symlink ) {
+                type = type & ~kptAlias;
+            }
+            if( type == kptDir ) {
+                memcpy(stbuf, &g_mount_point_stat, sizeof(g_mount_point_stat));
+                stbuf->st_mode = S_IFDIR | (0007555 & (access == 0 ? stbuf->st_mode : access));
+            } else {
+                memcpy(stbuf, &g_dflt_file_stat, sizeof(g_dflt_file_stat));
+                if( access == 0 ) {
+                    access = stbuf->st_mode;
+                }
+                stbuf->st_mode = 0007555 & (access == 0 ? stbuf->st_mode : access);
+                if( type == kptFile ) {
+                    stbuf->st_mode |= S_IFREG;
+                } else if( type == kptCharDev ) {
+                    stbuf->st_mode |= S_IFCHR;
+                } else if( type == kptBlockDev ) {
+                    stbuf->st_mode |= S_IFBLK;
+                } else if( type == kptFIFO ) {
+                    stbuf->st_mode |= S_IFIFO;
+                } else {
+                    rc = RC(rcExe, rcFileDesc, rcClassifying, rcDirEntry, rcUnknown);
+                }
+            }
+            if( rc == 0 ) {
+                if( symlink ) {
+                    stbuf->st_mode = S_IFLNK | (stbuf->st_mode & 07777);
+                }
+                stbuf->st_size = file_sz;
+                if( ts != 0 ) {
+                    stbuf->st_mtime = stbuf->st_atime = stbuf->st_ctime = ts;
+                }
+                if( block_sz > 0 ) {
+                    stbuf->st_blksize = block_sz;
+                }
+                DEBUG_MSG(8, ("%s: %s type: %s %lu bytes\n", __func__, path,
+                    (S_ISDIR(stbuf->st_mode) ? "dir" : (S_ISLNK(stbuf->st_mode) ? " symlink" : "file")), stbuf->st_size));
+            }
+        }
+    }
+    if( rc != 0 ) {
+        errno = ConvertRC2errno(rc);
+        PLOGERR(klogErr, (klogErr, rc, "$(f): $(p) - $(e)", PLOG_3(PLOG_S(f),PLOG_S(p),PLOG_S(e)), __func__, path, strerror(errno)));
+        return -errno;
+    }
+    return 0;
+}
+
+int UX_FUSE_readlink(const char *path, char *buf, size_t buf_sz)
+{
+    rc_t rc = 0;
+
+    DEBUG_MSG(8, ("%s: %s\n", __func__, path));
+    if( buf == NULL ) {
+        rc = RC(rcExe, rcFile, rcAliasing, rcParam, rcNull);
+    } else if( buf_sz < 1 ) {
+        rc = RC(rcExe, rcFile, rcAliasing, rcParam, rcInvalid);
+    } else {
+        rc = SRA_FUSER_ResolveLink(path, buf, buf_sz);
+        if ( rc == 0 ) { 
+            if ( * buf == '/' ) {
+                /*)  Here we suppose to add mount point to path
+                 (*/
+                char TmpBuf [ 4096 ];
+                size_t NumWrit = 0;
+
+                rc = string_printf (
+                                TmpBuf,
+                                sizeof ( TmpBuf ),
+                                & NumWrit,
+                                "%s%s",
+                                g_mount_point,
+                                buf
+                                );
+                if ( rc == 0 ) {
+                    string_copy_measure ( buf, buf_sz, TmpBuf );
+                }
+            }
+        }
+    }
+    if( rc != 0 ) {
+        errno = ConvertRC2errno(rc);
+        PLOGERR(klogErr, (klogErr, rc, "$(f): $(p) - $(e)", PLOG_3(PLOG_S(f),PLOG_S(p),PLOG_S(e)), __func__, path, strerror(errno)));
+        return -errno;
+    }
+    return 0;
+}
+
+int UX_FUSE_open(const char *path, struct fuse_file_info* fi)
+{
+    rc_t rc = 0;
+    uint64_t q;
+
+    DEBUG_MSG(8, ("%s: %s\n", __func__, path));
+    if( fi == NULL) {
+        rc = RC(rcExe, rcFile, rcOpening, rcParam, rcNull);
+    } else if( fi->flags & (O_CREAT | O_EXCL | O_TRUNC | O_APPEND)) { 
+        rc = RC(rcExe, rcFile, rcOpening, rcDirEntry, rcReadonly);
+    } else {
+        const void* data = NULL;
+        if( (rc = SRA_FUSER_OpenNode(path, &data)) == 0 ) {
+            fi->fh = (uint64_t)data;
+        }
+    }
+    if( rc != 0 ) {
+        errno = ConvertRC2errno(rc);
+        PLOGERR(klogErr, (klogErr, rc, "$(f): $(p) - $(e)", PLOG_3(PLOG_S(f),PLOG_S(p),PLOG_S(e)), __func__, path, strerror(errno)));
+        return -errno;
+    }
+    q = atomic64_add_and_read(&num_open_files, 1);
+    PLOGMSG(klogInfo, (klogInfo, "opened $(n), total open $(q)", PLOG_2(PLOG_S(n),PLOG_U64(q)), path, q));
+    return 0;
+}
+
+int UX_FUSE_read(const char *path, char *buf, size_t size, off_t offset, struct fuse_file_info *fi)
+{
+    rc_t rc = 0;
+    const void* data = NULL;
+    size_t num_read = 0;
+
+    DEBUG_MSG(8, ("%s: %s from %lu %lu bytes\n", __func__, path, offset, size));
+    if( fi == NULL || buf == NULL ) {
+        rc = RC(rcExe, rcFile, rcReading, rcParam, rcNull);
+    } else if( (data = (const void*)fi->fh) == NULL ) {
+        rc = RC(rcExe, rcFile, rcReading, rcParam, rcCorrupt);
+    } else {
+        rc = SRA_FUSER_ReadNode(path, data, buf, size, offset, &num_read);
+    }
+    if( rc != 0 ) {
+        errno = ConvertRC2errno(rc);
+        PLOGERR(klogErr, (klogErr, rc, "$(f): $(p) - $(e)", PLOG_3(PLOG_S(f),PLOG_S(p),PLOG_S(e)), __func__, path, strerror(errno)));
+        return -errno;
+    }
+    return num_read;
+}
+
+int UX_FUSE_release(const char *path, struct fuse_file_info *fi)
+{
+    rc_t rc = 0;
+    const void* data = NULL;
+    uint64_t q;
+
+    DEBUG_MSG(8, ("%s: %s\n", __func__, path));
+    if( fi == NULL) {
+        rc = RC(rcExe, rcFile, rcReleasing, rcParam, rcNull);
+    } else if( (data = (const void*)fi->fh) == NULL ) {
+        rc = RC(rcExe, rcFile, rcReading, rcParam, rcCorrupt);
+    } else {
+        rc = SRA_FUSER_CloseNode(path, data);
+    }
+    fi->fh = 0;
+    if( rc != 0 ) {
+        errno = ConvertRC2errno(rc);
+        PLOGERR(klogErr, (klogErr, rc, "$(f): $(p) - $(e)", PLOG_3(PLOG_S(f),PLOG_S(p),PLOG_S(e)), __func__, path, strerror(errno)));
+        return -errno;
+    }
+    atomic64_dec(&num_open_files);
+    q = atomic64_read(&num_open_files);
+    PLOGMSG(klogInfo, (klogInfo, "closed $(n), total open $(q)", PLOG_2(PLOG_S(n),PLOG_U64(q)), path, q));
+    return 0;
+}
+
+int UX_FUSE_mknod(const char *path, mode_t m, dev_t d)
+{
+    return -EROFS;
+}
+
+int UX_FUSE_mkdir(const char *path, mode_t m)
+{
+    return -EROFS;
+}
+
+int UX_FUSE_unlink(const char *path)
+{
+    return -EROFS;
+}
+
+int UX_FUSE_rmdir(const char *path)
+{
+    return -EROFS;
+}
+
+int UX_FUSE_symlink(const char *path, const char *x)
+{
+    return -EROFS;
+}
+
+int UX_FUSE_rename(const char *path, const char *x)
+{
+    return -EROFS;
+}
+
+int UX_FUSE_link(const char *path, const char *x)
+{
+    return -EROFS;
+}
+
+int UX_FUSE_chmod(const char *path, mode_t m)
+{
+    return -EROFS;
+}
+
+int UX_FUSE_chown(const char *path, uid_t u, gid_t g)
+{
+    return -EROFS;
+}
+
+int UX_FUSE_truncate(const char *path, off_t o)
+{
+    return -EROFS;
+}
+
+int UX_FUSE_utime(const char *path, struct utimbuf *b)
+{
+    return -EROFS;
+}
+
+int UX_FUSE_write(const char *path, const char *b, size_t s, off_t o, struct fuse_file_info *fi)
+{
+    return -EROFS;
+}
+
+int UX_FUSE_flush(const char *path, struct fuse_file_info *fi)
+{
+    return 0;
+}
+
+int UX_FUSE_create(const char *path, mode_t m, struct fuse_file_info *fi)
+{
+    return -EROFS;
+}
+
+int UX_FUSE_ftruncate(const char *path, off_t o, struct fuse_file_info *fi)
+{
+    return -EROFS;
+}
+
+static
+void CoreUsage(int fd, const char *progName, bool showHelp, bool showVersion, bool fail)
+{
+    /* used only for FUSE built-in help and version printing */
+    struct fuse_operations ops;
+    struct fuse_args args;
+    memset(&args, 0, sizeof(struct fuse_args));
+    fuse_opt_add_arg(&args, progName); /* fake mount point */
+
+
+    if( fd != STDOUT_FILENO ) {
+        /* redirect usage to log file if it was specified */
+        dup2(fd, STDOUT_FILENO);
+    }
+    if( showHelp ) {
+        const char* p = strrchr(progName, '/');
+        if( p++ == NULL ) {
+            p = progName;
+        }
+        UsageSummary(p);
+        if( !fail ) {
+            fuse_opt_add_arg(&args, "-ho");
+            KOutMsg("\n"
+                "    -x|--xml-dir <url>                 XML file with virtual directory structure\n"
+                "                                       string. Local file or valid URL (http)\n"
+                "    -m|--mount-point <path>            path to a mount directory \n"
+                );
+            KOutMsg(
+                "    -u|--unmount                       Unmount only and exit (only -m required)\n");
+            KOutMsg(
+                "    -b|--hard-bot <url>                URL where report 'heart-beat' ( version )\n"
+                "                                       optional, if not defined - not report\n"
+                "                                       combination '%%s' will be substituted\n"
+                "                                       with XML file version \n"
+                );
+            KOutMsg("\nOptions:\n"
+                "    -e|--cache-dir <path>              Path to directory where to store cached\n"
+                "                                       data from remote files\n"
+                "                                       Programm will work in diskless mode\n"
+                "                                       without cacheing if parameter omitted\n");
+                KOutMsg("    -c|--hard-bot-check <minutes>      Execute 'heart-beat' URL every <arg> minutes,\n"
+                "                                       inteder larger than 0, default: 30.\n"
+                "    -r|--xml-root  <path>              Base directory for a 'path' attributes in XML.\n"
+                "                                       default: '.'\n"
+                );
+            KOutMsg(
+                "    -B|--Blevel <level>                Set block size level for HTTP transport.\n"
+                "                                       level is an integer value from 1 to 10,\n"
+                "                                       which correspond to block sizes:\n"
+                "                                       32K,64K,128K,256K,512K,1M,2M,4M,8M,16M\n"
+                );
+            KOutMsg(
+                "    --SRA-check <secs>                 Check SRA config and runs for update\n"
+                "                                       every <arg> seconds, default: 0 - never.\n" );
+            KOutMsg(
+                "    -L|--log-level                     Logging level as number or enum string. One\n"
+                "                                       of (fatal|sys|int|err|warn|info) or (0-5)\n"
+                "                                       Current/default is warn.\n"
+                "    -l|--log-file <path>               Use log file specified by path.\n"
+                "    -g|--log-reopen <secs>             Reopened log file every <arg> seconds\n"
+                "                                       (external log rotation), default: 0 - never.\n"
+                );
+            KOutMsg(
+    #if _DEBUGGING
+                "    -+|--debug <Module[-Flag]>         Turn on debug output for module. All flags\n"
+                "                                       if not specified.\n"
+    #endif
+                "    -v|--verbose                       Increase the verbosity level of the program.\n"
+                "                                       Use multiple times for more verbosity.\n"
+                "    -V|--version                       Display the version of the program then quit.\n"
+                "    -h|--help                          Output brief explantion for the program.\n"
+                "\n"
+                );
+        }
+    }
+    if( showVersion && !fail ) {
+        HelpVersion(progName, KAppVersion());
+        fuse_opt_add_arg(&args, "--version");
+    }
+    /* force help preceed fuse help */
+    fflush(stdout);
+    /* hack to force fuse lib to output to stdout */
+    dup2(fd, STDERR_FILENO);
+    if( !fail ) {
+        memset(&ops, 0, sizeof(struct fuse_operations));
+        fuse_main(args.argc, args.argv, &ops);
+    }
+    exit(fail ? rcArgv : 0);
+}
+
+/*******************************************************************************
+ * KMain - defined for use with kapp library
+ *******************************************************************************/
+rc_t CC KMain(int argc, char *argv[])
+{
+    int i;
+    rc_t rc;
+
+    bool showHelp = argc < 2, showVersion = false, unmount = false, foreground = false;
+    const char* mount_point = NULL, *xml_path = NULL, *log_file = NULL;
+    const char* xml_root = ".";
+    const char* cache_dir = NULL, *heart_beat_url = NULL;
+    char** fargs = (char**)calloc(argc, sizeof(char*));
+    uint32_t heart_beat_check = 30, log_sync = 0, sra_sync = 0;
+    int log_fd = STDOUT_FILENO;
+    uint32_t block_level = 0, block_size = 0;
+
+#ifdef SRAFUSER_LOGLOCALTIME
+    KLogFmtFlagsSet(klogFmtLocalTimestamp);
+    KLogLibFmtFlagsSet(klogFmtLocalTimestamp);
+    KStsFmtFlagsSet(kstsFmtLocalTimestamp);
+    KStsLibFmtFlagsSet(kstsFmtLocalTimestamp);
+#endif
+
+    for(i = 1; i < argc; i++) {
+        if(!strcmp(argv[i], "-x") || !strcmp(argv[i], "--xml-dir")) {
+            xml_path = argv[++i];
+        } else if(!strcmp(argv[i], "-m") || !strcmp(argv[i], "--mount-point")) {
+            mount_point = argv[++i];
+        } else if(!strcmp(argv[i], "-e") || !strcmp(argv[i], "--cache-dir")) {
+            cache_dir = argv[++i];
+        } else if(!strcmp(argv[i], "-b") || !strcmp(argv[i], "--hard-bot")) {
+            heart_beat_url = argv[++i];
+        } else if(!strcmp(argv[i], "-xs") || !strcmp(argv[i], "-c") || !strcmp(argv[i], "--xml-check")) {
+            heart_beat_check = AsciiToU32(argv[++i], NULL, NULL);
+        } else if(!strcmp(argv[i], "-r") || !strcmp(argv[i], "--xml-root")) {
+            xml_root = argv[++i];
+        } else if(!strcmp(argv[i], "-B") || !strcmp(argv[i], "--Blevel")) {
+            block_level = AsciiToU32(argv[++i], NULL, NULL);
+        } else if(!strcmp(argv[i], "-ds") || !strcmp(argv[i], "--SRA-check")) {
+            sra_sync = AsciiToU32(argv[++i], NULL, NULL);
+        } else if(!strcmp(argv[i], "-u") || !strcmp (argv[i], "--unmount")) {
+            unmount = true;
+        } else if(!strcmp(argv[i], "-L") || !strcmp (argv[i], "--log-level")) {
+            if( i == argc - 1 ) {
+                rc = RC(rcExe, rcArgv, rcValidating, rcParam, rcInsufficient);
+                LOGERR(klogErr, rc, "missing log level");
+                CoreUsage(log_fd, argv[0], true, false, true);
+            } else if( (rc = LogLevelSet(argv[++i])) != 0 ) {
+                PLOGERR(klogErr, (klogErr, rc, "log level $(lvl)", PLOG_S(lvl), argv[i]));
+                CoreUsage(log_fd, argv[0], true, false, true);
+            }
+        } else if(!strcmp(argv[i], "-+") || !strcmp (argv[i], "--debug")) {
+#ifdef _DEBUGGING
+            if( i == argc - 1 ) {
+                rc = RC(rcExe, rcArgv, rcValidating, rcParam, rcInsufficient);
+                LOGERR(klogErr, rc, "missing debug level");
+                CoreUsage(log_fd, argv[0], true, false, true);
+            } else if( (rc = KDbgSetString(argv[++i])) != 0 ) {
+                PLOGERR(klogErr, (klogErr, rc, "debug level $(lvl)", PLOG_S(lvl), argv[i]));
+                CoreUsage(log_fd, argv[0], true, false, true);
+            }
+#else
+            i++;
+#endif
+        } else if(!strcmp(argv[i], "-lf") || !strcmp(argv[i], "-l") || !strcmp (argv[i], "--log-file")) {
+            log_file = argv[++i];
+        } else if(!strcmp(argv[i], "-ls") || !strcmp(argv[i], "-g") || !strcmp(argv[i], "--log-reopen")) {
+            log_sync = AsciiToU32(argv[++i], NULL, NULL);
+        } else if(!strcmp(argv[i], "-V") || !strcmp(argv[i], "--version")) {
+            showVersion = true;
+        } else if(!strcmp(argv[i], "-v") || !strcmp(argv[i], "--verbose")) {
+            KStsLevel l = KStsLevelGet();
+            KStsLevelSet(++l);
+        } else if(!strcmp(argv[i], "-h") || !strcmp(argv[i], "-ho") || !strcmp(argv[i], "--help")) {
+            showHelp = true;
+        } else {
+            /* save arg for FUSE */
+            fargs[i] = argv[i];
+            if( !strcmp(argv[i], "-d") || !strcmp(argv[i], "-f") ||
+                (!strcmp(argv[i], "-o") && (i > argc - 1) && !strcmp(argv[i + 1], "debug")) ) {
+                foreground = true;
+            }
+        }
+    }
+    if( showHelp || showVersion ) {
+        CoreUsage(log_fd, argv[0], showHelp, showVersion, false);
+    }
+    if( (rc = LogFile_Init(log_file, log_sync, foreground, &log_fd)) != 0 ) {
+        LOGERR(klogErr, rc, log_file ? log_file : "no log");
+        CoreUsage(log_fd, argv[0], true, false, true);
+    }
+    if( mount_point == NULL ) {
+        LOGERR(klogErr, RC(rcExe, rcArgv, rcValidating, rcParam, rcInsufficient), "mountpoint");
+        CoreUsage(log_fd, argv[0], true, false, true);
+    }
+    if( unmount ) {
+        fuse_unmount(mount_point);
+        exit(0);
+    }
+    if( xml_path == NULL ) {
+        LOGERR(klogErr, RC(rcExe, rcArgv, rcValidating, rcParam, rcInsufficient), "virtual directory XML");
+        CoreUsage(log_fd, argv[0], true, false, true);
+    }
+    if ( ! IsRemotePath ( xml_path ) ) {
+        if ( ! IsLocalPath ( xml_path ) ) {
+            LOGERR(klogErr, RC(rcExe, rcArgv, rcValidating, rcParam, rcInvalid), "virtual directory XML file is neither local nor remote");
+            CoreUsage(log_fd, argv[0], true, false, true);
+        }
+    }
+    if ( heart_beat_check <= 0 ) {
+        LOGERR(klogErr, RC(rcExe, rcArgv, rcValidating, rcParam, rcInvalid), "heart beat check value");
+        CoreUsage(log_fd, argv[0], true, false, true);
+    }
+    if ( block_level != 0 ) {
+        if ( 10 < block_level ) {
+            LOGERR(klogErr, RC(rcExe, rcArgv, rcValidating, rcParam, rcInvalid), "buffering level value");
+            CoreUsage(log_fd, argv[0], true, false, true);
+        }
+        block_size = ( 1 << ( block_level - 1 ) ) * 1024 * 32;
+        KOutMsg ( "Buffering level is %d. Using buffe of size %d\n", block_level, block_size );
+    }
+    else {
+        block_size = 0;
+    }
+    if( i != argc ) {
+        LOGERR(klogErr, RC(rcExe, rcArgv, rcValidating, rcParam, rcExcessive), argv[i]);
+        CoreUsage(log_fd, argv[0], true, false, true);
+    }
+    if( stat(mount_point, &g_mount_point_stat) < 0 ) {
+        PLOGMSG(klogErr, (klogErr, "$(p): $(e)", PLOG_2(PLOG_S(p),PLOG_S(e)), mount_point, strerror(errno)));
+        CoreUsage(log_fd, argv[0], true, false, true);
+    }
+    g_mount_point_stat.st_dev = 0;
+    g_mount_point_stat.st_ino = 0;
+    g_mount_point_stat.st_mode = S_IFDIR | 0555; /* execute read-only */
+     /* find needs more links to search in subdir */
+    g_mount_point_stat.st_nlink = 1024 * 1024 * 1024;
+
+     /* Here we are preserving mount point */
+    string_copy_measure (
+                    g_mount_point,
+                    sizeof ( g_mount_point ),
+                    mount_point
+                    );
+
+        /*  And here we should initialize some 'stat' structure
+         *  BTW, seems that Anton inherited only GID and GID from
+         *  original XML file, I think that 'getuid' and 'getgid'
+         *  will work here well
+         */
+    memset ( & g_dflt_file_stat, 0, sizeof ( struct stat ) );
+
+    g_dflt_file_stat.st_uid = getuid ();
+    g_dflt_file_stat.st_gid = getgid ();
+    g_dflt_file_stat.st_mode = S_IFREG | 0444; /* read-only */
+    g_dflt_file_stat.st_nlink = 1;
+
+    if( (rc = Initialize(sra_sync, xml_path, cache_dir, heart_beat_url, heart_beat_check * 60, xml_root, block_size)) != 0 ) {
+        LOGERR(klogErr, rc, "at initialization");
+        CoreUsage(log_fd, argv[0], true, false, true);
+    }
+    DEBUG_MSG(8, ("Mount point set to '%s'\n", mount_point));
+
+    {{ /* FUSE start */
+        struct fuse_operations ops;
+        struct fuse_args args;
+
+        memset(&args, 0, sizeof(struct fuse_args));
+        fuse_opt_add_arg(&args, argv[0]);
+        /* mount point for fuse_main */
+        fuse_opt_add_arg(&args, mount_point);
+        /* save mopunt point dir and program stat */
+        for(i = 0; i < argc; i++) {
+            if( fargs[i] ) {
+                fuse_opt_add_arg(&args, fargs[i]);
+            }
+        }
+        free(fargs);
+        memset(&ops, 0, sizeof(struct fuse_operations));
+        ops.init     = UX_FUSE_init;
+        ops.destroy  = UX_FUSE_destroy;
+        ops.getattr  = UX_FUSE_getattr;
+        ops.readdir  = UX_FUSE_readdir;
+        ops.readlink = UX_FUSE_readlink;
+        ops.open     = UX_FUSE_open;
+        ops.read     = UX_FUSE_read;
+        ops.release  = UX_FUSE_release;
+        ops.mknod = UX_FUSE_mknod;
+        ops.mkdir = UX_FUSE_mkdir;
+        ops.unlink = UX_FUSE_unlink;
+        ops.rmdir = UX_FUSE_rmdir;
+        ops.symlink = UX_FUSE_symlink;
+        ops.rename = UX_FUSE_rename;
+        ops.link = UX_FUSE_link;
+        ops.chmod = UX_FUSE_chmod;
+        ops.chown = UX_FUSE_chown;
+        ops.truncate = UX_FUSE_truncate;
+        ops.utime = UX_FUSE_utime;
+        ops.write = UX_FUSE_write;
+        ops.flush = UX_FUSE_flush;
+        ops.create = UX_FUSE_create;
+        ops.ftruncate = UX_FUSE_ftruncate;
+        rc = fuse_main(args.argc, args.argv, &ops);
+    }}
+    return rc;
+}
diff --git a/tools/fuse/unix/sra-fuser-sys.c b/tools/fuse/unix/sra-fuser-sys.c
new file mode 100644
index 0000000..d058be6
--- /dev/null
+++ b/tools/fuse/unix/sra-fuser-sys.c
@@ -0,0 +1,634 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#include <kapp/main.h>
+#include <kapp/args.h>
+#include <klib/log.h>
+#include <klib/out.h>
+#include <klib/status.h>
+#include <kfs/directory.h>
+
+#define FUSE_USE_VERSION 25
+#include <fuse.h>
+
+#include "xml.h"
+#include "sra-fuser.h"
+#include "log.h"
+
+#include <atomic.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+static struct stat g_mount_point_stat;
+static struct stat g_dflt_file_stat;
+static atomic64_t num_open_files;
+
+static
+int ConvertRC2errno(rc_t rc)
+{
+    switch(GetRCState(rc)) {
+        case rcNoErr:
+            return 0;
+        case rcNotFound:
+            return ENOENT;
+        case rcNull:
+            return EFAULT;
+        case rcInvalid:
+            return EINVAL;
+        case rcInsufficient:
+            return ENAMETOOLONG;
+        case rcReadonly:
+            return EROFS;
+        case rcUnauthorized:
+            return EACCES;
+        case rcCorrupt:
+        default:
+            return EBADF;
+    }
+}
+
+void* UX_FUSE_init(void)
+{
+    atomic64_set(&num_open_files, 0);
+    SRA_FUSER_Init();
+    return NULL;
+}
+
+void UX_FUSE_destroy(void* x)
+{
+    uint64_t q = atomic64_read(&num_open_files);
+    if( q > 0 ) {
+        PLOGMSG(klogInfo, (klogInfo, "$(q) files still opened", PLOG_U64(q), q));
+    }
+    SRA_FUSER_Fini();
+}
+
+struct UX_FUSE_readdir_callback_data {
+    const char *path;
+    void *buf;
+    fuse_fill_dir_t filler;
+};
+
+static
+rc_t CC UX_FUSE_readdir_callback( const char *name, void *data )
+{
+    struct UX_FUSE_readdir_callback_data* d = (struct UX_FUSE_readdir_callback_data*)data;
+    int r = d->filler(d->buf, name, NULL, 0);
+    DEBUG_MSG(10, ("%s %s entry: '%s'\n", __func__, d->path, name));
+    return r != 0 ? RC(rcExe, rcDirectory, rcReading, rcBuffer, rcInsufficient) : 0;
+}
+
+int UX_FUSE_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
+                     off_t offset, struct fuse_file_info *fi)
+{
+    rc_t rc = 0;
+    struct UX_FUSE_readdir_callback_data data;
+
+    DEBUG_MSG(8, ("%s: %s\n", __func__, path));
+
+    data.path = path;
+    data.filler = filler;
+    data.buf = buf;
+
+    if( (rc = UX_FUSE_readdir_callback(".", &data)) == 0 &&
+        (rc = UX_FUSE_readdir_callback("..", &data)) == 0 ) {
+        rc = SRA_FUSER_GetDir(path, UX_FUSE_readdir_callback, &data);
+    }
+    if( rc != 0 ) {
+        errno = ConvertRC2errno(rc);
+        PLOGERR(klogErr, (klogErr, rc, "$(f): $(p) - $(e)", PLOG_3(PLOG_S(f),PLOG_S(p),PLOG_S(e)), __func__, path, strerror(errno)));
+        return -errno;
+    }
+    return 0;
+}
+
+int UX_FUSE_getattr(const char *path, struct stat *stbuf)
+{
+    rc_t rc = 0;
+
+    DEBUG_MSG(8, ("%s: %s\n", __func__, path));
+    if( stbuf == NULL) {
+        rc = RC(rcExe, rcFileDesc, rcClassifying, rcParam, rcNull);
+    } else if( strcmp(path, "/") == 0 ) {
+        /* root is known as mount point */
+        memcpy(stbuf, &g_mount_point_stat, sizeof(g_mount_point_stat));
+    } else {
+        uint32_t type = kptBadPath, access = 0;
+        KTime_t ts = 0;
+        uint64_t file_sz = 0, block_sz = 0;
+        if( (rc = SRA_FUSER_GetAttr(path, &type, &ts, &file_sz, &access, &block_sz)) == 0 ) {
+            bool symlink = (type & kptAlias);
+            if( symlink ) {
+                type = type & ~kptAlias;
+            }
+            if( type == kptDir ) {
+                memcpy(stbuf, &g_mount_point_stat, sizeof(g_mount_point_stat));
+                stbuf->st_mode = S_IFDIR | (0007555 & (access == 0 ? stbuf->st_mode : access));
+            } else {
+                memcpy(stbuf, &g_dflt_file_stat, sizeof(g_dflt_file_stat));
+                if( access == 0 ) {
+                    access = stbuf->st_mode;
+                }
+                stbuf->st_mode = 0007555 & (access == 0 ? stbuf->st_mode : access);
+                if( type == kptFile ) {
+                    stbuf->st_mode |= S_IFREG;
+                } else if( type == kptCharDev ) {
+                    stbuf->st_mode |= S_IFCHR;
+                } else if( type == kptBlockDev ) {
+                    stbuf->st_mode |= S_IFBLK;
+                } else if( type == kptFIFO ) {
+                    stbuf->st_mode |= S_IFIFO;
+                } else {
+                    rc = RC(rcExe, rcFileDesc, rcClassifying, rcDirEntry, rcUnknown);
+                }
+            }
+            if( rc == 0 ) {
+                if( symlink ) {
+                    stbuf->st_mode = S_IFLNK | (stbuf->st_mode & 07777);
+                }
+                stbuf->st_size = file_sz;
+                if( ts != 0 ) {
+                    stbuf->st_mtime = stbuf->st_atime = stbuf->st_ctime = ts;
+                }
+                if( block_sz > 0 ) {
+                    stbuf->st_blksize = block_sz;
+                }
+                DEBUG_MSG(8, ("%s: %s type: %s %lu bytes\n", __func__, path,
+                    (S_ISDIR(stbuf->st_mode) ? "dir" : (S_ISLNK(stbuf->st_mode) ? " symlink" : "file")), stbuf->st_size));
+            }
+        }
+    }
+    if( rc != 0 ) {
+        errno = ConvertRC2errno(rc);
+        PLOGERR(klogErr, (klogErr, rc, "$(f): $(p) - $(e)", PLOG_3(PLOG_S(f),PLOG_S(p),PLOG_S(e)), __func__, path, strerror(errno)));
+        return -errno;
+    }
+    return 0;
+}
+
+int UX_FUSE_readlink(const char *path, char *buf, size_t buf_sz)
+{
+    rc_t rc = 0;
+
+    DEBUG_MSG(8, ("%s: %s\n", __func__, path));
+    if( buf == NULL ) {
+        rc = RC(rcExe, rcFile, rcAliasing, rcParam, rcNull);
+    } else if( buf_sz < 1 ) {
+        rc = RC(rcExe, rcFile, rcAliasing, rcParam, rcInvalid);
+    } else {
+        rc = SRA_FUSER_ResolveLink(path, buf, buf_sz);
+    }
+    if( rc != 0 ) {
+        errno = ConvertRC2errno(rc);
+        PLOGERR(klogErr, (klogErr, rc, "$(f): $(p) - $(e)", PLOG_3(PLOG_S(f),PLOG_S(p),PLOG_S(e)), __func__, path, strerror(errno)));
+        return -errno;
+    }
+    return 0;
+}
+
+int UX_FUSE_open(const char *path, struct fuse_file_info* fi)
+{
+    rc_t rc = 0;
+    uint64_t q;
+
+    DEBUG_MSG(8, ("%s: %s\n", __func__, path));
+    if( fi == NULL) {
+        rc = RC(rcExe, rcFile, rcOpening, rcParam, rcNull);
+    } else if( fi->flags & (O_CREAT | O_EXCL | O_TRUNC | O_APPEND)) { 
+        rc = RC(rcExe, rcFile, rcOpening, rcDirEntry, rcReadonly);
+    } else {
+        const void* data = NULL;
+        if( (rc = SRA_FUSER_OpenNode(path, &data)) == 0 ) {
+            fi->fh = (uint64_t)data;
+        }
+    }
+    if( rc != 0 ) {
+        errno = ConvertRC2errno(rc);
+        PLOGERR(klogErr, (klogErr, rc, "$(f): $(p) - $(e)", PLOG_3(PLOG_S(f),PLOG_S(p),PLOG_S(e)), __func__, path, strerror(errno)));
+        return -errno;
+    }
+    q = atomic64_add_and_read(&num_open_files, 1);
+    PLOGMSG(klogInfo, (klogInfo, "opened $(n), total open $(q)", PLOG_2(PLOG_S(n),PLOG_U64(q)), path, q));
+    return 0;
+}
+
+int UX_FUSE_read(const char *path, char *buf, size_t size, off_t offset, struct fuse_file_info *fi)
+{
+    rc_t rc = 0;
+    const void* data = NULL;
+    size_t num_read = 0;
+
+    DEBUG_MSG(8, ("%s: %s from %lu %lu bytes\n", __func__, path, offset, size));
+    if( fi == NULL || buf == NULL ) {
+        rc = RC(rcExe, rcFile, rcReading, rcParam, rcNull);
+    } else if( (data = (const void*)fi->fh) == NULL ) {
+        rc = RC(rcExe, rcFile, rcReading, rcParam, rcCorrupt);
+    } else {
+        rc = SRA_FUSER_ReadNode(path, data, buf, size, offset, &num_read);
+    }
+    if( rc != 0 ) {
+        errno = ConvertRC2errno(rc);
+        PLOGERR(klogErr, (klogErr, rc, "$(f): $(p) - $(e)", PLOG_3(PLOG_S(f),PLOG_S(p),PLOG_S(e)), __func__, path, strerror(errno)));
+        return -errno;
+    }
+    return num_read;
+}
+
+int UX_FUSE_release(const char *path, struct fuse_file_info *fi)
+{
+    rc_t rc = 0;
+    const void* data = NULL;
+    uint64_t q;
+
+    DEBUG_MSG(8, ("%s: %s\n", __func__, path));
+    if( fi == NULL) {
+        rc = RC(rcExe, rcFile, rcReleasing, rcParam, rcNull);
+    } else if( (data = (const void*)fi->fh) == NULL ) {
+        rc = RC(rcExe, rcFile, rcReading, rcParam, rcCorrupt);
+    } else {
+        rc = SRA_FUSER_CloseNode(path, data);
+    }
+    fi->fh = 0;
+    if( rc != 0 ) {
+        errno = ConvertRC2errno(rc);
+        PLOGERR(klogErr, (klogErr, rc, "$(f): $(p) - $(e)", PLOG_3(PLOG_S(f),PLOG_S(p),PLOG_S(e)), __func__, path, strerror(errno)));
+        return -errno;
+    }
+    atomic64_dec(&num_open_files);
+    q = atomic64_read(&num_open_files);
+    PLOGMSG(klogInfo, (klogInfo, "closed $(n), total open $(q)", PLOG_2(PLOG_S(n),PLOG_U64(q)), path, q));
+    return 0;
+}
+
+int UX_FUSE_mknod(const char *path, mode_t m, dev_t d)
+{
+    return -EROFS;
+}
+
+int UX_FUSE_mkdir(const char *path, mode_t m)
+{
+    return -EROFS;
+}
+
+int UX_FUSE_unlink(const char *path)
+{
+    return -EROFS;
+}
+
+int UX_FUSE_rmdir(const char *path)
+{
+    return -EROFS;
+}
+
+int UX_FUSE_symlink(const char *path, const char *x)
+{
+    return -EROFS;
+}
+
+int UX_FUSE_rename(const char *path, const char *x)
+{
+    return -EROFS;
+}
+
+int UX_FUSE_link(const char *path, const char *x)
+{
+    return -EROFS;
+}
+
+int UX_FUSE_chmod(const char *path, mode_t m)
+{
+    return -EROFS;
+}
+
+int UX_FUSE_chown(const char *path, uid_t u, gid_t g)
+{
+    return -EROFS;
+}
+
+int UX_FUSE_truncate(const char *path, off_t o)
+{
+    return -EROFS;
+}
+
+int UX_FUSE_utime(const char *path, struct utimbuf *b)
+{
+    return -EROFS;
+}
+
+int UX_FUSE_write(const char *path, const char *b, size_t s, off_t o, struct fuse_file_info *fi)
+{
+    return -EROFS;
+}
+
+int UX_FUSE_flush(const char *path, struct fuse_file_info *fi)
+{
+    return 0;
+}
+
+int UX_FUSE_create(const char *path, mode_t m, struct fuse_file_info *fi)
+{
+    return -EROFS;
+}
+
+int UX_FUSE_ftruncate(const char *path, off_t o, struct fuse_file_info *fi)
+{
+    return -EROFS;
+}
+
+static
+void CoreUsage(int fd, const char *progName, bool showHelp, bool showVersion, bool fail)
+{
+    /* used only for FUSE built-in help and version printing */
+    struct fuse_operations ops;
+    struct fuse_args args;
+    memset(&args, 0, sizeof(struct fuse_args));
+    fuse_opt_add_arg(&args, progName); /* fake mount point */
+
+
+    if( fd != STDOUT_FILENO ) {
+        /* redirect usage to log file if it was specified */
+        dup2(fd, STDOUT_FILENO);
+    }
+    if( showHelp ) {
+        const char* p = strrchr(progName, '/');
+        if( p++ == NULL ) {
+            p = progName;
+        }
+        UsageSummary(p);
+        if( !fail ) {
+            fuse_opt_add_arg(&args, "-ho");
+            KOutMsg("\n"
+                "    -x|--xml-dir <path>                XML file with virtual directory structure\n"
+                "    -m|--mount-point <path>            path to a mount directory \n"
+                "    -u|--unmount                       Unmount only and exit (only -m required)\n"
+                );
+            KOutMsg("\nOptions:\n"
+                "    -c|--xml-check <secs>              Check XML for update every <arg> seconds,\n"
+                "                                       default: 0 - never.\n"
+                "    -r|--xml-root  <path>              Base directory for a 'path' attributes in XML.\n"
+                "                                       default: '.'\n"
+                );
+            KOutMsg(
+                "    -i|--xml-validate <nocheck|ignore> XML validation on load:\n"
+                "                                       nocheck - do not check presence of dir/file in path attribute;\n"
+                "                                       ignore - only report missing dir/file in path attribute;\n"
+                "                                       default behaivour is to fail loading XML if dir/file is not found.\n"
+                );
+            KOutMsg(
+                "    --SRA-check <secs>                 Check SRA config and runs for update\n"
+                "                                       every <arg> seconds, default: 0 - never.\n"
+                "    --SRA-cache <path>                 Write SRA update info to a file.\n"
+                "                                       Must have --SRA-check option value of non-zero.\n"
+                );
+            KOutMsg(
+                "    -L|--log-level                     Logging level as number or enum string. One\n"
+                "                                       of (fatal|sys|int|err|warn|info) or (0-5)\n"
+                "                                       Current/default is warn.\n"
+                "    -l|--log-file <path>               Use log file specified by path.\n"
+                "    -g|--log-reopen <secs>             Reopened log file every <arg> seconds\n"
+                "                                       (external log rotation), default: 0 - never.\n"
+                );
+            KOutMsg(
+    #if _DEBUGGING
+                "    -+|--debug <Module[-Flag]>         Turn on debug output for module. All flags\n"
+                "                                       if not specified.\n"
+    #endif
+                "    -v|--verbose                       Increase the verbosity level of the program.\n"
+                "                                       Use multiple times for more verbosity.\n"
+                "    -V|--version                       Display the version of the program then quit.\n"
+                "    -h|--help                          Output brief explantion for the program.\n"
+                "\n"
+                );
+        }
+    }
+    if( showVersion && !fail ) {
+        HelpVersion(progName, KAppVersion());
+        fuse_opt_add_arg(&args, "--version");
+    }
+    /* force help preceed fuse help */
+    fflush(stdout);
+    /* hack to force fuse lib to output to stdout */
+    dup2(fd, STDERR_FILENO);
+    if( !fail ) {
+        memset(&ops, 0, sizeof(struct fuse_operations));
+        fuse_main(args.argc, args.argv, &ops);
+    }
+    exit(fail ? rcArgv : 0);
+}
+
+/*******************************************************************************
+ * KMain - defined for use with kapp library
+ *******************************************************************************/
+rc_t CC KMain(int argc, char *argv[])
+{
+    int i;
+    rc_t rc;
+
+    bool showHelp = argc < 2, showVersion = false, unmount = false, foreground = false;
+    const char* mount_point = NULL, *xml_path = NULL, *log_file = NULL;
+    const char* sra_cache = NULL, *xml_root = ".";
+    char** fargs = (char**)calloc(argc, sizeof(char*));
+    uint32_t xml_sync = 0, log_sync = 0, sra_sync = 0;
+    EXMLValidate xml_validate = eXML_Full;
+    int log_fd = STDOUT_FILENO;
+
+#ifdef SRAFUSER_LOGLOCALTIME
+    KLogFmtFlagsSet(klogFmtLocalTimestamp);
+    KLogLibFmtFlagsSet(klogFmtLocalTimestamp);
+    KStsFmtFlagsSet(kstsFmtLocalTimestamp);
+    KStsLibFmtFlagsSet(kstsFmtLocalTimestamp);
+#endif
+
+    for(i = 1; i < argc; i++) {
+        if(!strcmp(argv[i], "-x") || !strcmp(argv[i], "--xml-dir")) {
+            xml_path = argv[++i];
+        } else if(!strcmp(argv[i], "-m") || !strcmp(argv[i], "--mount-point")) {
+            mount_point = argv[++i];
+        } else if(!strcmp(argv[i], "-xs") || !strcmp(argv[i], "-c") || !strcmp(argv[i], "--xml-check")) {
+            xml_sync = AsciiToU32(argv[++i], NULL, NULL);
+        } else if(!strcmp(argv[i], "-r") || !strcmp(argv[i], "--xml-root")) {
+            xml_root = argv[++i];
+        } else if(!strcmp(argv[i], "-i") || !strcmp(argv[i], "--xml-validate")) {
+            if( i++ == argc - 1 ) {
+                rc = RC(rcExe, rcArgv, rcValidating, rcParam, rcInsufficient);
+                LOGERR(klogErr, rc, "XML validation setting value");
+                CoreUsage(log_fd, argv[0], true, false, true);
+            } else if( !strcmp(argv[i], "ignore") ) {
+                xml_validate = eXML_NoFail;
+            } else if( !strcmp(argv[i], "nocheck") ) {
+                xml_validate = eXML_NoCheck;
+            } else {
+                rc = RC(rcExe, rcArgv, rcValidating, rcParam, rcUnrecognized);
+                PLOGERR(klogErr, (klogErr, rc, "XML validation setting value '$(lvl)'", PLOG_S(lvl), argv[i]));
+                CoreUsage(log_fd, argv[0], true, false, true);
+            }
+        } else if(!strcmp(argv[i], "-ds") || !strcmp(argv[i], "--SRA-check")) {
+            sra_sync = AsciiToU32(argv[++i], NULL, NULL);
+        } else if(!strcmp(argv[i], "-df") || !strcmp(argv[i], "--SRA-cache")) {
+            sra_cache = argv[++i];
+        } else if(!strcmp(argv[i], "-u") || !strcmp (argv[i], "--unmount")) {
+            unmount = true;
+        } else if(!strcmp(argv[i], "-L") || !strcmp (argv[i], "--log-level")) {
+            if( i == argc - 1 ) {
+                rc = RC(rcExe, rcArgv, rcValidating, rcParam, rcInsufficient);
+                LOGERR(klogErr, rc, "missing log level");
+                CoreUsage(log_fd, argv[0], true, false, true);
+            } else if( (rc = LogLevelSet(argv[++i])) != 0 ) {
+                PLOGERR(klogErr, (klogErr, rc, "log level $(lvl)", PLOG_S(lvl), argv[i]));
+                CoreUsage(log_fd, argv[0], true, false, true);
+            }
+        } else if(!strcmp(argv[i], "-+") || !strcmp (argv[i], "--debug")) {
+#ifdef _DEBUGGING
+            if( i == argc - 1 ) {
+                rc = RC(rcExe, rcArgv, rcValidating, rcParam, rcInsufficient);
+                LOGERR(klogErr, rc, "missing debug level");
+                CoreUsage(log_fd, argv[0], true, false, true);
+            } else if( (rc = KDbgSetString(argv[++i])) != 0 ) {
+                PLOGERR(klogErr, (klogErr, rc, "debug level $(lvl)", PLOG_S(lvl), argv[i]));
+                CoreUsage(log_fd, argv[0], true, false, true);
+            }
+#else
+            i++;
+#endif
+        } else if(!strcmp(argv[i], "-lf") || !strcmp(argv[i], "-l") || !strcmp (argv[i], "--log-file")) {
+            log_file = argv[++i];
+        } else if(!strcmp(argv[i], "-ls") || !strcmp(argv[i], "-g") || !strcmp(argv[i], "--log-reopen")) {
+            log_sync = AsciiToU32(argv[++i], NULL, NULL);
+        } else if(!strcmp(argv[i], "-V") || !strcmp(argv[i], "--version")) {
+            showVersion = true;
+        } else if(!strcmp(argv[i], "-v") || !strcmp(argv[i], "--verbose")) {
+            KStsLevel l = KStsLevelGet();
+            KStsLevelSet(++l);
+        } else if(!strcmp(argv[i], "-h") || !strcmp(argv[i], "-ho") || !strcmp(argv[i], "--help")) {
+            showHelp = true;
+        } else {
+            /* save arg for FUSE */
+            fargs[i] = argv[i];
+            if( !strcmp(argv[i], "-d") || !strcmp(argv[i], "-f") ||
+                (!strcmp(argv[i], "-o") && (i > argc - 1) && !strcmp(argv[i + 1], "debug")) ) {
+                foreground = true;
+            }
+        }
+    }
+    if( showHelp || showVersion ) {
+        CoreUsage(log_fd, argv[0], showHelp, showVersion, false);
+    }
+    if( (rc = LogFile_Init(log_file, log_sync, foreground, &log_fd)) != 0 ) {
+        LOGERR(klogErr, rc, log_file ? log_file : "no log");
+        CoreUsage(log_fd, argv[0], true, false, true);
+    }
+    if( mount_point == NULL ) {
+        LOGERR(klogErr, RC(rcExe, rcArgv, rcValidating, rcParam, rcInsufficient), "mountpoint");
+        CoreUsage(log_fd, argv[0], true, false, true);
+    }
+    if( unmount ) {
+        fuse_unmount(mount_point);
+        exit(0);
+    }
+    if( xml_path == NULL ) {
+        LOGERR(klogErr, RC(rcExe, rcArgv, rcValidating, rcParam, rcInsufficient), "virtual directory XML");
+        CoreUsage(log_fd, argv[0], true, false, true);
+    }
+    if( i != argc ) {
+        LOGERR(klogErr, RC(rcExe, rcArgv, rcValidating, rcParam, rcExcessive), argv[i]);
+        CoreUsage(log_fd, argv[0], true, false, true);
+    }
+    if( stat(mount_point, &g_mount_point_stat) < 0 ) {
+        PLOGMSG(klogErr, (klogErr, "$(p): $(e)", PLOG_2(PLOG_S(p),PLOG_S(e)), mount_point, strerror(errno)));
+        CoreUsage(log_fd, argv[0], true, false, true);
+    }
+    g_mount_point_stat.st_dev = 0;
+    g_mount_point_stat.st_ino = 0;
+    g_mount_point_stat.st_mode = S_IFDIR | 0555; /* execute read-only */
+     /* find needs more links to search in subdir */
+    g_mount_point_stat.st_nlink = 1024 * 1024 * 1024;
+    
+    if( stat(xml_path, &g_dflt_file_stat) < 0 ) {
+        PLOGMSG(klogErr, (klogErr, "$(p): $(e)", PLOG_2(PLOG_S(p),PLOG_S(e)), xml_path, strerror(errno)));
+        CoreUsage(log_fd, argv[0], true, false, true);
+    }
+    g_dflt_file_stat.st_dev = 0;
+    g_dflt_file_stat.st_ino = 0;
+    g_dflt_file_stat.st_mode = S_IFREG | 0444; /* read-only */
+    g_dflt_file_stat.st_nlink = 1;
+    g_dflt_file_stat.st_rdev = 0;
+    g_dflt_file_stat.st_size = 0;
+    g_dflt_file_stat.st_blksize = 0;
+    g_dflt_file_stat.st_blocks = 0;
+
+    if( (rc = Initialize(sra_sync, xml_path, xml_sync, sra_cache, xml_root, xml_validate)) != 0 ) {
+        LOGERR(klogErr, rc, "at initialization");
+        CoreUsage(log_fd, argv[0], true, false, true);
+    }
+    DEBUG_MSG(8, ("Mount point set to '%s'\n", mount_point));
+
+    {{ /* FUSE start */
+        struct fuse_operations ops;
+        struct fuse_args args;
+
+        memset(&args, 0, sizeof(struct fuse_args));
+        fuse_opt_add_arg(&args, argv[0]);
+        /* mount point for fuse_main */
+        fuse_opt_add_arg(&args, mount_point);
+        /* save mopunt point dir and program stat */
+        for(i = 0; i < argc; i++) {
+            if( fargs[i] ) {
+                fuse_opt_add_arg(&args, fargs[i]);
+            }
+        }
+        free(fargs);
+        memset(&ops, 0, sizeof(struct fuse_operations));
+        ops.init     = UX_FUSE_init;
+        ops.destroy  = UX_FUSE_destroy;
+        ops.getattr  = UX_FUSE_getattr;
+        ops.readdir  = UX_FUSE_readdir;
+        ops.readlink = UX_FUSE_readlink;
+        ops.open     = UX_FUSE_open;
+        ops.read     = UX_FUSE_read;
+        ops.release  = UX_FUSE_release;
+        ops.mknod = UX_FUSE_mknod;
+        ops.mkdir = UX_FUSE_mkdir;
+        ops.unlink = UX_FUSE_unlink;
+        ops.rmdir = UX_FUSE_rmdir;
+        ops.symlink = UX_FUSE_symlink;
+        ops.rename = UX_FUSE_rename;
+        ops.link = UX_FUSE_link;
+        ops.chmod = UX_FUSE_chmod;
+        ops.chown = UX_FUSE_chown;
+        ops.truncate = UX_FUSE_truncate;
+        ops.utime = UX_FUSE_utime;
+        ops.write = UX_FUSE_write;
+        ops.flush = UX_FUSE_flush;
+        ops.create = UX_FUSE_create;
+        ops.ftruncate = UX_FUSE_ftruncate;
+        rc = fuse_main(args.argc, args.argv, &ops);
+    }}
+    return rc;
+}
diff --git a/tools/fuse/xml.c b/tools/fuse/xml.c
new file mode 100644
index 0000000..5df98bc
--- /dev/null
+++ b/tools/fuse/xml.c
@@ -0,0 +1,516 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#include <kfs/directory.h>
+#include <kfs/file.h>
+#include <klib/namelist.h>
+#include <klib/container.h>
+#include <klib/log.h>
+#include <kproc/lock.h>
+#include <kproc/thread.h>
+
+#include "log.h"
+#include "xml.h"
+#include "file.h"
+#include "directory.h"
+#include "tar-node.h"
+#include "sra-list.h"
+#include "node.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+static const KXMLMgr* g_xmlmgr = NULL;
+static const FSNode* g_root = NULL;
+static KRWLock* g_lock = NULL;
+static const char* g_start_dir = NULL;
+static uint32_t g_xml_validate = 0;
+
+static unsigned int g_xml_sync = 0;
+/* if g_xml_sync == 0 these are not used: */
+static KTime_t g_xml_mtime = 0;
+static char* g_xml_path = NULL;
+static KThread* g_xml_thread = NULL;
+
+static
+rc_t XMLLock(bool exclusive)
+{
+    DEBUG_MSG(10, ("Lock XML tree %s\n", exclusive ? "write" : "read"));
+    return exclusive ? KRWLockAcquireExcl(g_lock) : KRWLockAcquireShared(g_lock);
+}
+
+static
+void XMLUnlock(void)
+{
+    DEBUG_MSG(10, ("Unlocked XML tree\n"));
+    ReleaseComplain(KRWLockUnlock, g_lock);
+}
+
+void XML_FindRelease(void)
+{
+    XMLUnlock();
+}
+
+rc_t XML_FindLock(const char* path, bool recur, const FSNode** node, const char** subpath)
+{
+    rc_t rc = 0;
+    size_t sz = 0;
+    const char* p0 = NULL, *p = NULL;
+    const FSNode* pn = NULL, *n = NULL;
+    bool hidden = false;
+
+    if( path == NULL || node == NULL || subpath == NULL ) {
+        return RC(rcExe, rcPath, rcResolving, rcParam, rcNull);
+    }
+    sz = strlen(path);
+    if( sz == 0 ) {
+        return RC(rcExe, rcPath, rcResolving, rcParam, rcEmpty);
+    }
+    p0 = path;
+    if( (rc = XMLLock(false)) != 0 ) {
+        return rc;
+    }
+    pn = g_root;
+    do {
+        DEBUG_MSG(8, ("Path: '%s'\n", p0));
+        while( *p0 == '/' && *p0 != '\0' ) {
+            p0++;
+        }
+        if( *p0 == '\0' ) {
+            break;
+        }
+        p = strchr(p0, '/');
+        if( p == NULL ) {
+            p = p0 + strlen(p0);
+        }
+        DEBUG_MSG(8, ("Push: '%.*s'\n", p - p0, p0));
+        if( (rc = FSNode_FindChild(pn, p0, p - p0, &n, &hidden)) == 0 ) {
+            if( hidden ) {
+                pn = n;
+                DEBUG_MSG(8, ("Match! hidden '%s' left '%s'\n", pn->name, p0));
+                break;
+            } else {
+                DEBUG_MSG(8, ("Match! '%.*s' left '%s'\n", p - p0, p0, p));
+            }
+        } else if( GetRCState(rc) == rcNotFound ) {
+            rc = 0;
+            break;
+        }
+        pn = n;
+        p0 = p;
+    } while( rc == 0 && p0 < path + sz );
+
+    if( rc == 0 ) {
+        if( pn == NULL ) {
+            rc = RC(rcExe, rcPath, rcResolving, rcDirEntry, rcNotFound);
+            DEBUG_MSG(10, ("Not found: '%s', in '%s'\n", p0, path));
+        } else {
+            if( (rc = FSNode_Touch(pn)) != 0 ) {
+                PLOGERR(klogWarn, (klogWarn, rc, "touch failed for $(n)", PLOG_S(n), pn->name));
+                rc = 0;
+            }
+            *node = pn;
+            *subpath = (p0 && p0[0] != '\0') ? p0 : NULL;
+#if _DEBUGGING
+            {
+                const char* nm = NULL;
+                FSNode_GetName(pn, &nm);
+                DEBUG_MSG(10, ("Found: '%s', sub '%s'\n", nm, *subpath));
+            }
+#endif
+        }
+    }
+    if( rc != 0 ) {
+        XMLUnlock();
+    }
+    return rc;
+}
+
+static
+rc_t SRAConfigParse(const KXMLNode* xml_node, SRAConfigFlags* flags, char* errmsg)
+{
+    rc_t rc = 0;
+    uint32_t i;
+    char at[4096];
+    size_t sz;
+    char* attr_name[]         = { "run-directory", "SRA-archive",   "SRA-archive-lite",  "fastq",           "SFF" };
+    SRAConfigFlags attr_val[] = { eSRAFuseRunDir,  eSRAFuseFileArc, eSRAFuseFileArcLite, eSRAFuseFileFastq, eSRAFuseFileSFF };
+
+    if( *flags & eSRAFuseInitial ) {
+        *flags = 0;
+    }
+    for(i = 0; rc == 0 && i < sizeof(attr_name)/sizeof(attr_name[0]); i++) {
+        if( (rc = KXMLNodeReadAttrCString(xml_node, attr_name[i], at, sizeof(at), &sz)) == 0 ) {
+            if( strcasecmp(at, "true") == 0 ) {
+                *flags = *flags | attr_val[i];
+            } else if( strcasecmp(at, "false") == 0 ) {
+                *flags = *flags & ~(attr_val[i]);
+            } else {
+                strcpy(errmsg, "SRAConfig attribute ");
+                strcat(errmsg,  attr_name[i]);
+                strcat(errmsg, " value '");
+                strcat(errmsg, at);
+                strcat(errmsg, "'");
+                rc = RC(rcExe, rcDoc, rcReading, rcData, rcInvalid);
+            }
+        } else if( GetRCState(rc) == rcNotFound ) {
+            rc = 0;
+        }
+    }
+    return rc;
+}
+
+static
+rc_t XML_ValidateNode(FSNode* parent, const KXMLNode* n, SRAConfigFlags flags, char* errmsg)
+{
+    rc_t rc = 0;
+    const char* name = NULL;
+    FSNode* fsn = NULL;
+    bool children_allowed = false, should_have_children = false, ignore_children = false;
+
+    if( (rc = KXMLNodeElementName(n, &name)) != 0 ) {
+        return rc;
+    }
+    DEBUG_MSG(8, ("Node: %s\n", name));
+    if( name == NULL ) {
+        return RC(rcExe, rcDoc, rcValidating, rcDirEntry, rcNull);
+    }
+
+    if( strcmp(name, "Directory") == 0 ) {
+        rc = DirectoryNode_Make(n, &fsn, errmsg, g_start_dir, g_xml_mtime, g_xml_validate);
+        children_allowed = true;
+    } else if( strcmp(name, "File") == 0 ) {
+        rc = FileNode_Make(n, &fsn, errmsg, g_start_dir, g_xml_validate);
+    } else if( strcmp(name, "SRA") == 0 ) {
+        if( (rc = SRAListNode_Make(n, parent, flags, errmsg, g_start_dir, g_xml_validate)) == 0 ) {
+            fsn = parent;
+        }
+    } else if( strcmp(name, "TAR") == 0 ) {
+        /* tar nodes do not validate on creation */
+        rc = TarNode_MakeXML(n, &fsn, errmsg, g_start_dir);
+        children_allowed = true;
+        ignore_children = true;
+    } else if( strcmp(name, "SRAConfig") == 0 ) {
+        if( (rc = SRAConfigParse(n, &flags, errmsg)) == 0 ) {
+            fsn = parent;
+            children_allowed = true;
+            should_have_children = true;
+        }
+    } else {
+        strcpy(errmsg, name);
+        rc = RC(rcExe, rcDoc, rcValidating, rcTag, rcUnknown);
+    }
+    if( rc == 0 ) {
+        strcpy(errmsg, name);
+        if( fsn == parent || (rc = FSNode_AddChild(parent, fsn)) == 0 ) {
+            uint32_t count = 0;
+            if( (rc = KXMLNodeCountChildNodes(n, &count)) == 0 && count > 0 ) {
+                if( !children_allowed ) {
+                    if( fsn != NULL ) {
+                        FSNode_GetName(fsn, &name);
+                    }
+                    rc = RC(rcExe, rcDoc, rcValidating, rcDirEntry, rcInvalid);
+                    strcpy(errmsg, name);
+                } else if( !ignore_children ) {
+                    uint32_t i = 0;
+                    const KXMLNode* ch = NULL;
+                    while( rc == 0 && i < count ) {
+                        if( (rc = KXMLNodeGetNodeRead(n, &ch, i++)) == 0 ) {
+                            rc = XML_ValidateNode(fsn, ch, flags, errmsg);
+                            ReleaseComplain(KXMLNodeRelease, ch);
+                        }
+                    }
+                }
+            } else if( count == 0 && should_have_children ) {
+                PLOGMSG(klogWarn, (klogWarn, "$(n) may have children", PLOG_S(n), name));
+            }
+        }
+    }
+    return rc;
+}
+
+static
+rc_t RootNode_Attr(const FSNode* cself, const char* subpath, uint32_t* type, KTime_t* ts, uint64_t* file_sz, uint32_t* access, uint64_t* block_sz)
+{
+    rc_t rc = 0;
+
+    *type = kptDir;
+    if( subpath != NULL ) {
+        rc = RC(rcExe, rcFile, rcEvaluating, rcDirEntry, rcNotFound);
+    }
+    return rc;
+}
+
+static
+rc_t RootNode_Dir(const FSNode* cself, const char* subpath, FSNode_Dir_Visit func, void* data)
+{
+    if( subpath != NULL ) {
+        return RC(rcExe, rcFile, rcListing, rcDirEntry, rcNotFound);
+    }
+    return FSNode_ListChildren(cself, func, data);
+}
+
+static const FSNode_vtbl RootNode_vtbl = {
+    sizeof(FSNode),
+    NULL,
+    NULL,
+    RootNode_Attr,
+    RootNode_Dir,
+    NULL,
+    NULL,
+    NULL
+};
+
+static
+rc_t XML_Open(const char* path, const FSNode** tree)
+{
+    rc_t rc = 0;
+    char errmsg[4096] = "";
+    KDirectory *dir = NULL;
+    
+    PLOGMSG(klogInfo, (klogInfo, "Reading XML file '$(x)'", PLOG_S(x), path));
+    if( (rc = KDirectoryNativeDir(&dir)) == 0 ) {
+        const KFile* file = NULL;
+        if( (rc = KDirectoryOpenFileRead(dir, &file, "%s", path)) == 0 ) {
+            if( (rc = FSNode_Make((FSNode**)tree, "ROOT", &RootNode_vtbl)) == 0 ) {
+                const KXMLDoc* xmldoc = NULL;
+                if( (rc = KXMLMgrMakeDocRead(g_xmlmgr, &xmldoc, file)) == 0 ) {
+                    const KXMLNodeset* ns = NULL;
+                    if( (rc = KXMLDocOpenNodesetRead(xmldoc, &ns, "/FUSE/*")) == 0 ) {
+                        uint32_t count = 0;
+                        if( (rc = KXMLNodesetCount(ns, &count)) == 0 ) {
+                            if( count == 0 ) {
+                                rc = RC(rcExe, rcDoc, rcValidating, rcData, rcEmpty);
+                            } else {
+                                uint32_t i = 0;
+                                while(rc == 0 && i < count) {
+                                    const KXMLNode* n = NULL;
+                                    if( (rc = KXMLNodesetGetNodeRead(ns, &n, i++)) == 0 ) {
+                                        SRAConfigFlags flags = ~0;
+                                        errmsg[0] = '\0';
+                                        rc = XML_ValidateNode((FSNode*)*tree, n, flags, errmsg);
+                                        ReleaseComplain(KXMLNodeRelease, n);
+                                    }
+                                }
+                                if( rc == 0 ) {
+                                    rc = SRAList_NextVersion();
+                                }
+                            }
+                        }
+                        ReleaseComplain(KXMLNodesetRelease, ns);
+                    }
+                    ReleaseComplain(KXMLDocRelease, xmldoc);
+                }
+                if( rc != 0 ) {
+                    FSNode_Release(*tree);
+                    *tree = NULL;
+                }
+            }
+            ReleaseComplain(KFileRelease, file);
+        }
+        ReleaseComplain(KDirectoryRelease, dir);
+    }
+    if( rc == 0 ) {
+        PLOGMSG(klogInfo, (klogInfo, "XML file '$(x)' ok", PLOG_S(x), path));
+    } else {
+        if( strlen(errmsg) < 1 ) {
+            strcpy(errmsg, path);
+        }
+        LOGERR(klogErr, rc, errmsg);
+    }
+    return rc;
+}
+
+static
+rc_t XMLThread( const KThread *self, void *data )
+{
+    KDirectory *dir = NULL;
+
+    PLOGMSG(klogInfo, (klogInfo, "XML sync thread started with $(s) sec", PLOG_U32(s), g_xml_sync));
+    do {
+        rc_t rc = 0;
+        KTime_t dt = 0;
+
+        DEBUG_MSG(8, ("XML sync thread checking %s\n", g_xml_path));
+        if( (rc = KDirectoryNativeDir(&dir)) == 0 ) {
+            rc = KDirectoryDate(dir, &dt, "%s", g_xml_path);
+            ReleaseComplain(KDirectoryRelease, dir);
+        }
+        if( rc == 0 ) {
+            if( dt != g_xml_mtime ) {
+                const FSNode* new_root = NULL;
+                PLOGMSG(klogInfo, (klogInfo, "File $(f) changed ($(m) <> $(d)), updating...",
+                    PLOG_3(PLOG_S(f),PLOG_I64(m),PLOG_I64(d)), g_xml_path, g_xml_mtime, dt));
+                if( XML_Open(g_xml_path, &new_root) == 0 ) {
+                    if( (rc = XMLLock(true)) == 0 ) {
+                        const FSNode* old_root = g_root;
+                        g_root = new_root;
+                        g_xml_mtime = dt;
+                        XMLUnlock();
+                        FSNode_Release(old_root);
+                        PLOGMSG(klogInfo, (klogInfo, "Data from $(f) updated successfully", PLOG_S(f), g_xml_path));
+                    }
+                }
+            } else {
+                DEBUG_MSG(8, ("XML sync thread up-to-date %s\n", g_xml_path));
+            }
+        } else {
+            LOGERR(klogErr, rc, g_xml_path);
+        }
+        SRAList_PostRefresh();
+        sleep(g_xml_sync);
+    } while( g_xml_sync > 0 );
+    LOGMSG(klogInfo, "XML sync thread ended");
+    return 0;
+}
+
+rc_t XML_Make(KDirectory* dir, const char* const work_dir, const char* xml_path, unsigned int sync, uint32_t xml_validate)
+{
+    rc_t rc = 0; 
+
+    g_xml_sync = sync;
+    if( g_xmlmgr == NULL && (rc = KXMLMgrMakeRead(&g_xmlmgr)) != 0 ) {
+        g_xmlmgr = NULL;
+        LOGERR(klogErr, rc, "XML manager");
+    } else {
+        char buf[4096];
+        if( (rc = KDirectoryResolvePath(dir, true, buf, 4096, "%s", xml_path)) == 0 ) {
+            if( (rc = StrDup(buf, &g_xml_path)) == 0 ) {
+                DEBUG_MSG(8, ("XML path set to '%s'\n", g_xml_path));
+            }
+        }
+        g_start_dir = work_dir;
+        g_xml_validate = xml_validate;
+    }
+    if( rc == 0 ) {
+        rc = FSNode_Make((FSNode**)&g_root, "ROOT", &RootNode_vtbl);
+    }
+    return rc;
+}
+
+void XML_Init(void)
+{
+    rc_t rc = 0;
+
+    if( g_lock == NULL && (rc = KRWLockMake(&g_lock)) != 0 ) {
+        g_lock = NULL;
+        LOGERR(klogErr, rc, "XML lock");
+    }
+    if( (rc = KThreadMake(&g_xml_thread, XMLThread, NULL)) != 0 ) {
+        LOGERR(klogErr, rc, "XML sync thread");
+    }
+}
+
+void XML_Fini(void)
+{
+    g_xml_sync = 0;
+    if( g_xml_thread != NULL ) {
+        ReleaseComplain(KThreadCancel, g_xml_thread);
+        ReleaseComplain(KThreadRelease, g_xml_thread);
+    }
+    ReleaseComplain(KXMLMgrRelease, g_xmlmgr);
+    XMLLock(true);
+    FSNode_Release(g_root);
+    XMLUnlock();
+    ReleaseComplain(KRWLockRelease, g_lock);
+    FREE(g_xml_path);
+
+    g_root = NULL;
+    g_lock = NULL;
+    g_start_dir = NULL;
+    g_xml_mtime = 0;
+    g_xml_path = NULL;
+    g_xml_thread = NULL;
+}
+
+rc_t XML_MgrGet(const KXMLMgr** xmlmgr)
+{
+    if( xmlmgr == NULL ) {
+        return RC(rcExe, rcDoc, rcAccessing, rcParam, rcNull);
+    }
+    if( g_xmlmgr == NULL ) {
+        return RC(rcExe, rcPath, rcAccessing, rcMgr, rcNull);
+    }
+    *xmlmgr = g_xmlmgr;
+    return 0;
+}
+
+rc_t XML_ParseTimestamp(const KXMLNode* xml_node, const char* attr, KTime_t* timestamp, bool optional)
+{
+    rc_t rc;
+    char ts[128];
+    size_t sz;
+
+    if( (rc = KXMLNodeReadAttrCString(xml_node, attr, ts, sizeof(ts), &sz)) == 0 ) {
+        struct tm tm;
+        memset(&tm, 0, sizeof(tm));
+        if( strptime(ts, "%Y-%m-%dT%H:%M:%S", &tm) != NULL ) {
+            *timestamp = mktime(&tm);
+        } else {
+            rc = RC(rcExe, rcDoc, rcReading, rcAttr, rcInvalid);
+        }
+    } else if( optional && GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound ) {
+        rc = 0;
+    }
+    return rc;
+}
+
+rc_t XML_WriteTimestamp(char* dst, size_t bsize, size_t *num_writ, KTime_t ts)
+{
+    struct tm* tm = localtime(&ts);
+
+    *num_writ = strftime(dst, bsize, "%a %Y-%m-%d %H:%M:%S %Z", tm);
+    if( *num_writ < 1 || *num_writ >= bsize ) {
+        return RC(rcExe, rcDoc, rcWriting, rcBuffer, rcInsufficient);
+    }
+    return 0;
+}
+
+rc_t XML_ParseBool(const KXMLNode* xml_node, const char* attr, bool* val, bool optional)
+{
+    rc_t rc;
+    char b[16];
+    size_t sz;
+
+    if( (rc = KXMLNodeReadAttrCString(xml_node, attr, b, sizeof(b), &sz)) == 0 ) {
+        if( strcasecmp(b, "true") == 0 || strcasecmp(b, "on") == 0 || strcasecmp(b, "yes") == 0 ) {
+            *val = true;
+        } else if( strcasecmp(b, "false") == 0 || strcasecmp(b, "off") == 0 || strcasecmp(b, "no") == 0 ) {
+            *val = false;
+        } else {
+            rc = RC(rcExe, rcDoc, rcReading, rcAttr, rcInvalid);
+        }
+    } else if( optional && GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound ) {
+        rc = 0;
+    }
+    return rc;
+}
diff --git a/tools/fuse/xml.h b/tools/fuse/xml.h
new file mode 100644
index 0000000..a945e24
--- /dev/null
+++ b/tools/fuse/xml.h
@@ -0,0 +1,60 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#ifndef _h_sra_fuse_xml_
+#define _h_sra_fuse_xml_
+
+#include <kxml/xml.h>
+#include <kfs/directory.h>
+
+#include "node.h"
+
+typedef uint32_t EXMLValidate;
+enum {
+    eXML_NoCheck = 0,
+    eXML_NoFail,
+    eXML_Full
+};
+
+rc_t XML_Make(KDirectory* dir, const char* const work_dir, const char* xml_path,
+              unsigned int sync, EXMLValidate xml_validate);
+
+void XML_Init(void);
+
+rc_t XML_FindLock(const char* path, bool recur, const FSNode** node, const char** subpath);
+
+void XML_FindRelease(void);
+
+rc_t XML_MgrGet(const KXMLMgr** xmlmgr);
+
+rc_t XML_ParseTimestamp(const KXMLNode* xml_node, const char* attr, KTime_t* tm, bool optional);
+
+rc_t XML_WriteTimestamp(char* dst, size_t bsize, size_t *num_writ, KTime_t ts);
+
+rc_t XML_ParseBool(const KXMLNode* xml_node, const char* attr, bool* val, bool optional);
+
+void XML_Fini(void);
+
+#endif /* _h_sra_fuse_xml_ */
diff --git a/tools/fuse/zlib-simple.c b/tools/fuse/zlib-simple.c
new file mode 100644
index 0000000..aa671ea
--- /dev/null
+++ b/tools/fuse/zlib-simple.c
@@ -0,0 +1,65 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+#include <klib/log.h>
+#include <klib/rc.h>
+
+#include "debug.h"
+#include "zlib-simple.h"
+
+rc_t ZLib_DeflateBlock(const char* src, size_t src_sz, char* dst, size_t dst_sz, size_t* written)
+{
+    rc_t rc = 0;
+    z_stream z_strm;
+    int z_err = Z_OK;
+
+    if( src == NULL || dst == NULL || written == NULL ) {
+        rc = RC(rcExe, rcFunction, rcConstructing, rcParam, rcNull);
+    } else {
+        z_strm.next_in = (unsigned char*)src;
+        z_strm.zalloc = Z_NULL;
+        z_strm.zfree = Z_NULL;
+        z_strm.opaque = Z_NULL;
+        z_err = deflateInit2(&z_strm, Z_DEFAULT_COMPRESSION, Z_DEFLATED, 15 + 16, 8, Z_DEFAULT_STRATEGY);
+        if( z_err != Z_OK ) {
+            rc = RC(rcExe, rcFunction, rcConstructing, rcInterface, rcUnexpected);
+            DEBUG_MSG(3, ("deflateInit2: %R %d\n", rc, z_err));
+        } else {
+            z_strm.avail_in = src_sz;
+            z_strm.next_out = (unsigned char*)dst;
+            z_strm.avail_out = dst_sz;
+            if( (z_err = deflate(&z_strm, Z_FINISH)) != Z_STREAM_END ) {
+                rc = RC(rcExe, rcFunction, rcExecuting, rcInterface, rcUnexpected);
+                DEBUG_MSG(3, ("deflate(Z_FINISH): %R %d\n", rc, z_err));
+            }
+            *written = dst_sz - z_strm.avail_out;
+            if( (z_err = deflateEnd(&z_strm)) != Z_OK ) {
+                rc = RC(rcExe, rcFunction, rcDestroying, rcInterface, rcUnexpected);
+                DEBUG_MSG(3, ("deflateEnd: %r %d\n", rc, z_err));
+            }
+        }
+    }
+    return rc;
+}
diff --git a/tools/fuse/zlib-simple.h b/tools/fuse/zlib-simple.h
new file mode 100644
index 0000000..178218d
--- /dev/null
+++ b/tools/fuse/zlib-simple.h
@@ -0,0 +1,33 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#ifndef _h_sra_fuse_zlib_simple_
+#define _h_sra_fuse_zlib_simple_
+
+#include <zlib.h>
+
+rc_t ZLib_DeflateBlock(const char* src, size_t src_sz, char* dst, size_t dst_sz, size_t* written);
+
+#endif /* _h_sra_fuse_zlib_simple_ */
diff --git a/tools/kar/Makefile b/tools/kar/Makefile
index 04fc22f..9e43623 100644
--- a/tools/kar/Makefile
+++ b/tools/kar/Makefile
@@ -25,7 +25,7 @@
 
 default: std
 
-TOP ?= $(shell ../../build/abspath.sh ../..)
+TOP ?= $(abspath ../..)
 MODULE = tools/kar
 
 include $(TOP)/build/Makefile.env
@@ -85,7 +85,7 @@ KAR_OBJ = \
 
 KAR_LIB = \
 	-lkapp \
-	-lncbi-vdb \
+	-sncbi-vdb \
 
 
 $(BINDIR)/kar: $(KAR_OBJ)
@@ -104,7 +104,7 @@ SRA_KAR_OBJ = \
 
 SRA_KAR_LIB = \
 	-skapp \
-	-lncbi-vdb \
+	-sncbi-vdb \
 
 $(BINDIR)/sra-kar: $(SRA_KAR_OBJ)
 	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(SRA_KAR_LIB)
diff --git a/tools/kar/kar.c b/tools/kar/kar.c
index 3cca677..c83a780 100644
--- a/tools/kar/kar.c
+++ b/tools/kar/kar.c
@@ -363,11 +363,11 @@ static KSRAFileAlignment get_alignment (const char * str)
 static
 int CC sort_cmp (const void ** l, const void ** r, void * data)
 {
-    KDirectory * d;
+/*  KDirectory * d; */
     uint64_t lz, rz;
     rc_t rc;
 
-    d = data;
+/*    d = data; */
 /*     lz = l; */
 /*     rz = r; */
 
@@ -1003,10 +1003,10 @@ rc_t CC list_action (const KDirectory * dir, const char * path, void * _adata)
     }
     if (rc == 0)
     {
-        rc = KDirectoryVAccess (dir, &access, path, NULL);
+        rc = KDirectoryAccess (dir, &access, "%s", path);
         if (rc == 0)
         {
-            rc = KDirectoryVDate (dir, &mtime, path, NULL);
+            rc = KDirectoryDate (dir, &mtime, "%s", path);
 
             if (rc == 0)
             {
diff --git a/tools/kar/kar.vers b/tools/kar/kar.vers
index cc6c9a4..8e8299d 100644
--- a/tools/kar/kar.vers
+++ b/tools/kar/kar.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/kar/kar.vers.h b/tools/kar/kar.vers.h
new file mode 100644
index 0000000..3b56111
--- /dev/null
+++ b/tools/kar/kar.vers.h
@@ -0,0 +1 @@
+#define KAR_VERS 0x02040002
diff --git a/tools/kar/sra-kar.c b/tools/kar/sra-kar.c
index 67d8745..ab6da3a 100644
--- a/tools/kar/sra-kar.c
+++ b/tools/kar/sra-kar.c
@@ -127,7 +127,7 @@ rc_t run ( srakar_parms *pb )
     else
     {
         const SRATable *tbl;
-        rc = SRAMgrOpenTableRead ( mgr, & tbl, pb -> src_path );
+        rc = SRAMgrOpenTableRead ( mgr, & tbl, "%s", pb -> src_path );
         if ( rc != 0 )
             PLOGERR ( klogInt, (klogInt, rc,
                 "failed to open SRATable '$(spec)'", "spec=%s",
@@ -135,7 +135,7 @@ rc_t run ( srakar_parms *pb )
         else
         {
             rc = KDirectoryCreateFile (pb->dir, &outfile, false, 0446,
-                kcmParents | ( pb->force ? kcmInit : kcmCreate) , pb->dst_path);
+                                       kcmParents | ( pb->force ? kcmInit : kcmCreate) , "%s", pb->dst_path);
             if (rc == 0)
             {
                 const KFile * archive;
@@ -154,7 +154,7 @@ rc_t run ( srakar_parms *pb )
         SRAMgrRelease (mgr);
     }
 /*
-    rc = KDirectoryCreateFile (pb->dir, &outfile, false, 0446, kcmParents | ( pb->force ? kcmInit : kcmCreate) , pb->dst_path);
+    rc = KDirectoryCreateFile (pb->dir, &outfile, false, 0446, kcmParents | ( pb->force ? kcmInit : kcmCreate) , "%s", pb->dst_path);
 
     if (rc == 0)
     {
@@ -166,7 +166,7 @@ rc_t run ( srakar_parms *pb )
         else
         {
             const SRATable *tbl;
-            rc = SRAMgrOpenTableRead ( mgr, & tbl, pb -> src_path );
+            rc = SRAMgrOpenTableRead ( mgr, & tbl, "%s", pb -> src_path );
             if ( rc != 0 )
                 PLOGERR ( klogInt, (klogInt, rc, "failed to open SRATable '$(spec)'", "spec=%s", pb -> src_path ));
             else
@@ -389,7 +389,7 @@ rc_t CC Usage (const Args * args)
             {
                 KPathType kpt;
 
-                kpt = KDirectoryPathType (pwd, pb.dst_path);
+                kpt = KDirectoryPathType (pwd, "%s", pb.dst_path);
 
                 switch (kpt & ~kptAlias)
                 {
diff --git a/tools/kar/sra-kar.vers b/tools/kar/sra-kar.vers
index cc6c9a4..8e8299d 100644
--- a/tools/kar/sra-kar.vers
+++ b/tools/kar/sra-kar.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/kar/sra-kar.vers.h b/tools/kar/sra-kar.vers.h
new file mode 100644
index 0000000..855bafb
--- /dev/null
+++ b/tools/kar/sra-kar.vers.h
@@ -0,0 +1 @@
+#define SRA_KAR_VERS 0x02040002
diff --git a/tools/keyring-srv/Makefile b/tools/keyring-srv/Makefile
new file mode 100644
index 0000000..c5334ce
--- /dev/null
+++ b/tools/keyring-srv/Makefile
@@ -0,0 +1,106 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+default: std
+
+TOP ?= $(abspath ../..)
+MODULE = tools/keyring-srv
+
+INT_LIBS = \
+
+ALL_LIBS = \
+	$(INT_LIBS) \
+	$(EXT_LIBS)
+
+EXT_TOOLS = \
+    keyring-srv
+
+ALL_TOOLS = \
+	$(INT_TOOLS) \
+	$(EXT_TOOLS)    
+
+include $(TOP)/build/Makefile.env
+
+#-------------------------------------------------------------------------------
+# outer targets
+#
+all std: vers-includes 
+	@ $(MAKE_CMD) $(TARGDIR)/std
+
+$(INT_LIBS): vers-includes
+	@ $(MAKE_CMD) $(ILIBDIR)/$@
+
+$(EXT_TOOLS): vers-includes
+	@ $(MAKE_CMD) $(BINDIR)/$@    
+
+ALL_TOOLS = \
+	$(INT_TOOLS) \
+	$(EXT_TOOLS)
+
+.PHONY: all std $(ALL_LIBS) 
+
+#-------------------------------------------------------------------------------
+# std
+#
+$(TARGDIR)/std: \
+	$(addprefix $(ILIBDIR)/,$(INT_LIBS)) \
+	$(addprefix $(LIBDIR)/,$(EXT_LIBS)) \
+	$(addprefix $(BINDIR)/,$(ALL_TOOLS))
+
+.PHONY: $(TARGDIR)/std
+
+#-------------------------------------------------------------------------------
+# vers-includes
+#
+$(TARGDIR)/vers-includes: $(addsuffix .vers.h,$(ALL_TOOLS))
+
+.PHONY: $(TARGDIR)/vers-includes
+
+#-------------------------------------------------------------------------------
+# clean
+#
+clean: stdclean
+
+.PHONY: clean
+
+#------------------------------------------------------------------------------
+# keyring-srv
+#
+KEYRING_SRV_SRC = \
+	keyring-srv \
+	keyring-data \
+	keyring-database \
+	keyring-srv-main \
+
+KEYRING_SRV_OBJ = \
+	$(addsuffix .$(OBJX),$(KEYRING_SRV_SRC))
+
+KEYRING_SRV_LIB = \
+	-skapp \
+	-lncbi-wvdb \
+
+
+$(BINDIR)/keyring-srv: $(KEYRING_SRV_OBJ)
+	$(LD) --exe --vers $(SRCDIR)/keyring-srv.vers -o $@ $^ $(KEYRING_SRV_LIB)
+
diff --git a/tools/keyring-srv/keyring-data.c b/tools/keyring-srv/keyring-data.c
new file mode 100644
index 0000000..f1920c1
--- /dev/null
+++ b/tools/keyring-srv/keyring-data.c
@@ -0,0 +1,346 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ * 
+ */
+
+#include "keyring-data.h"
+
+#include <sysalloc.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <klib/rc.h>
+
+rc_t KeyRingDataInit ( KeyRingData* self )
+{
+    BSTreeInit( & self->projects );
+    BSTreeInit( & self->objects );
+    self->next_projectId = 0;
+    self->next_objectId = 0;
+    return 0;
+}
+
+void KeyRingDataWhack ( KeyRingData* self )
+{
+    BSTreeWhack ( & self->projects, ProjectWhack, NULL );
+    BSTreeWhack ( & self->objects, ObjectWhack, NULL );
+}
+
+int CC FindProject ( const void *item, const BSTNode *n )
+{
+    return StringCompare((const String*)item, ((const Project*)n)->name);
+}
+int CC SortProjects ( const BSTNode *item, const BSTNode *n )
+{
+    return StringCompare(((const Project*)item)->name, ((const Project*)n)->name);
+}
+
+const Project* KeyRingDataGetProject (const KeyRingData* data, const String* name)
+{
+    return (const Project*)BSTreeFind(&data->projects, name, FindProject);
+}
+
+rc_t KeyRingDataInsertProject (ProjectTable*  data, 
+                               uint32_t      p_id, 
+                               const String* name, 
+                               const String* download_ticket, 
+                               const String* encryption_key)
+{
+    rc_t rc = 0;
+    Project* p = (Project*) malloc(sizeof(Project));
+    if (p != NULL)
+    {
+        rc = ProjectInit(p, p_id, name, download_ticket, encryption_key);
+        if (rc == 0)
+        {
+            rc = BSTreeInsert(data, &p->dad, SortProjects);
+            if (rc != 0)
+                ProjectWhack(&p->dad, NULL);
+        }
+        if (rc != 0)
+            free(p);
+    }
+    else
+        rc = RC ( rcApp, rcDatabase, rcUpdating, rcMemory, rcExhausted );
+    return rc;
+}                               
+
+rc_t KeyRingDataAddProject(KeyRingData* data, const String* name, const String* download_ticket, const String* encryption_key)
+{
+    rc_t rc = 0;
+    Project* p;
+
+    p = (Project*)BSTreeFind(&data->projects, name, FindProject);
+    if (p != NULL)
+    {
+        bool rewrite = false;
+        String* dl = NULL;
+        String* enc = NULL;
+        if (StringCompare(p->download_ticket, download_ticket) != 0)
+        {
+            dl = p->download_ticket;
+            rc = StringCopy((const String**)&p->download_ticket, download_ticket);
+            if (rc == 0)
+                rewrite = true;
+            else
+                dl = NULL;
+        }
+        if (rc == 0 && StringCompare(p->encryption_key, encryption_key) != 0)
+        {
+            enc = p->encryption_key;
+            rc = StringCopy((const String**)&p->encryption_key, encryption_key);
+            if (rc == 0)
+                rewrite = true;
+            else
+                enc = NULL;
+        }
+        if (rc == 0 && rewrite)
+        {
+            if (dl)
+                StringWhack(dl);
+            if (enc)
+                StringWhack(enc);
+        }
+    }
+    else /* insert new */
+    {
+        rc = KeyRingDataInsertProject (&data->projects, data->next_projectId, name, download_ticket, encryption_key);
+        if (rc == 0)
+            ++data->next_projectId;
+    }
+    return rc;
+}
+
+rc_t ProjectInit ( Project* self, uint32_t p_id, const String* name, const String* download_ticket, const String* encryption_key )
+{
+    rc_t rc = 0;
+    memset(self, 0, sizeof(Project)); 
+    self->id = p_id;
+    rc = StringCopy((const String**)&self->name, name);
+    if (rc == 0)
+    {
+        rc = StringCopy((const String**)&self->download_ticket, download_ticket);
+        if (rc == 0)
+        {
+            rc = StringCopy((const String**)&self->encryption_key, encryption_key);
+            if (rc != 0)
+                StringWhack(self->download_ticket);
+        }
+        else
+            StringWhack(self->name);
+    }
+    return rc;
+}
+
+void ProjectWhack ( BSTNode *n, void *data )
+{
+    Project* self = (Project*)n;
+    StringWhack(self->name);
+    StringWhack(self->download_ticket);
+    StringWhack(self->encryption_key);
+    free(self);
+}
+
+rc_t ObjectInit ( Object* self, 
+                  uint32_t p_id, 
+                  const String* p_name, 
+                  const String* p_project, 
+                  const String* p_display_name,
+                  uint64_t p_size,
+                  const String* p_checksum,
+                  const String* p_encryption_key)
+{
+    rc_t rc = 0;
+    memset(self, 0, sizeof(Project)); 
+    self->id = p_id;
+    rc = StringCopy((const String**)&self->name, p_name);
+    if (rc == 0)
+    {
+        rc = StringCopy((const String**)&self->project, p_project);
+        if (rc == 0)
+        {
+            rc = StringCopy((const String**)&self->display_name, p_display_name);
+            if (rc == 0)
+            {
+                self->size = p_size;
+                rc = StringCopy((const String**)&self->checksum, p_checksum);
+                if (rc == 0)
+                {
+                    rc = StringCopy((const String**)&self->encryption_key, p_encryption_key);
+                    if (rc != 0)
+                        StringWhack(self->checksum);
+                }
+                if (rc != 0)
+                    StringWhack(self->display_name);
+            }
+            if (rc != 0)
+                StringWhack(self->project);
+        }
+        if (rc != 0)
+            StringWhack(self->name);
+    }
+    return rc;
+}                         
+                         
+void ObjectWhack ( BSTNode *n, void *data )
+{
+    Object* self = (Object*)n;
+    StringWhack(self->name);
+    StringWhack(self->project);
+    StringWhack(self->display_name);
+    StringWhack(self->checksum);
+    StringWhack(self->encryption_key);
+    free(self);
+}
+
+int CC FindObject( const void *item, const BSTNode *n )
+{
+    return StringCompare((const String*)item, ((const Object*)n)->name);
+}
+int CC SortObjects( const BSTNode *item, const BSTNode *n )
+{
+    return StringCompare(((const Project*)item)->name, ((const Object*)n)->name);
+}
+
+rc_t KeyRingDataInsertObject(ObjectTable*  data, 
+                             uint32_t      p_id, 
+                             const String* name, 
+                             const String* project, 
+                             const String* display_name,
+                             uint64_t      size,
+                             const String* checksum,
+                             const String* encryption_key)
+{
+    rc_t rc = 0;
+    Object* obj = (Object*) malloc(sizeof(Object));
+    if (obj != NULL)
+    {
+        rc = ObjectInit(obj, p_id, name, project, display_name, size, checksum, encryption_key);
+        if (rc == 0)
+        {
+            rc = BSTreeInsert(data, &obj->dad, SortObjects);
+            if (rc != 0)
+                ProjectWhack(&obj->dad, NULL);
+        }
+        else
+            free(obj);
+    }
+    else
+        rc = RC ( rcApp, rcDatabase, rcUpdating, rcMemory, rcExhausted );
+    return rc;
+}                             
+
+
+rc_t KeyRingDataAddObject (KeyRingData*  data, 
+                           const String* name, 
+                           const String* project, 
+                           const String* display_name,
+                           uint64_t      size,
+                           const String* checksum,
+                           const String* encryption_key)
+{
+    rc_t rc = 0;
+    Object* obj;
+
+    obj = (Object*)BSTreeFind(&data->objects, name, FindObject);
+    if (obj != NULL)
+    {
+        bool rewrite = false;
+        String* proj = NULL;
+        String* disp = NULL;
+        String* csum = NULL;
+        String* encr = NULL;
+        if (StringCompare(obj->project, project) != 0)
+        {
+            proj = obj->project;
+            rc = StringCopy((const String**)&obj->project, project);
+            if (rc == 0)
+                rewrite = true;
+            else
+                proj = NULL;
+        }
+        if (StringCompare(obj->display_name, display_name) != 0)
+        {
+            disp = obj->display_name;
+            rc = StringCopy((const String**)&obj->display_name, display_name);
+            if (rc == 0)
+                rewrite = true;
+            else
+                disp = NULL;
+        }
+        if (size != obj->size)
+        {
+            obj->size = size;
+            rewrite = true;
+        }
+        if (StringCompare(obj->checksum, checksum) != 0)
+        {
+            csum = obj->checksum;
+            rc = StringCopy((const String**)&obj->checksum, checksum);
+            if (rc == 0)
+                rewrite = true;
+            else
+                csum = NULL;
+        }
+        if (StringCompare(obj->encryption_key, encryption_key) != 0)
+        {
+            encr = obj->encryption_key;
+            rc = StringCopy((const String**)&obj->encryption_key, encryption_key);
+            if (rc == 0)
+                rewrite = true;
+            else
+                encr = NULL;
+        }
+        if (rc == 0 && rewrite)
+        {
+            if (proj)
+                StringWhack(proj);
+            if (disp)
+                StringWhack(disp);
+            if (csum)
+                StringWhack(csum);
+            if (encr)
+                StringWhack(encr);
+        }
+    }
+    else /* insert new */
+    {
+        rc = KeyRingDataInsertObject(&data->objects, 
+                                     data->next_objectId, 
+                                     name, 
+                                     project, 
+                                     display_name,
+                                     size,
+                                     checksum,
+                                     encryption_key);
+        if (rc == 0)
+            ++data->next_objectId;
+    }
+    return rc;
+}                           
+                                  
+const Object* KeyRingDataGetObject (const KeyRingData*  data, const String* name)
+{
+    return (const Object*)BSTreeFind(&data->objects, name, FindObject);
+}
diff --git a/tools/keyring-srv/keyring-data.h b/tools/keyring-srv/keyring-data.h
new file mode 100644
index 0000000..6e58316
--- /dev/null
+++ b/tools/keyring-srv/keyring-data.h
@@ -0,0 +1,130 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+
+#ifndef _h_keyring_data_
+#define _h_keyring_data_
+
+#include <klib/defs.h>
+#include <klib/container.h>
+#include <klib/text.h>
+
+struct VDatabase;
+
+typedef struct Project Project;
+struct Project
+{
+    BSTNode dad;
+
+    uint32_t id;
+    String* name;
+    /*TODO: replace Strings with key-ids */
+    String* download_ticket;
+    String* encryption_key;
+};
+extern rc_t ProjectInit ( Project* self, 
+                          uint32_t p_id, 
+                          const String* p_name, 
+                          const String* p_download_ticket, 
+                          const String* p_encyption_key );
+extern void ProjectWhack ( BSTNode *n, void *data );
+
+typedef struct Object Object;
+struct Object
+{
+    BSTNode dad;
+
+    uint32_t id;
+    String* name;
+    String* project;
+    String* display_name; 
+    uint64_t size; 
+    String* checksum;
+    /*TODO: replace String with key-id */
+    String* encryption_key;
+};
+extern rc_t ObjectInit ( Object*        self, 
+                         uint32_t       id, 
+                         const String*  name, 
+                         const String*  project, 
+                         const String*  display_name,
+                         uint64_t       size,
+                         const String*  checksum,
+                         const String*  encryption_key);
+extern void ObjectWhack ( BSTNode *n, void *data );
+
+typedef BSTree ProjectTable;
+typedef BSTree ObjectTable;
+
+typedef struct KeyRingData KeyRingData;
+struct KeyRingData
+{
+    ProjectTable projects;
+    ObjectTable objects;
+    
+    uint32_t next_projectId;
+    uint32_t next_objectId;
+};
+
+extern rc_t KeyRingDataInit ( KeyRingData* self );
+extern void KeyRingDataWhack ( KeyRingData* self ); /* does not call free(self) */
+
+/* make sure does not exist, assign an id*/
+extern rc_t KeyRingDataAddProject (KeyRingData*  data, 
+                                   const String* name, 
+                                   const String* download_ticket, 
+                                   const String* encryption_key);
+
+/* known to be new, id assigned*/
+extern rc_t KeyRingDataInsertProject (ProjectTable*  data, 
+                                      uint32_t      p_id, 
+                                      const String* name, 
+                                      const String* download_ticket, 
+                                      const String* encryption_key);
+
+extern const Project* KeyRingDataGetProject (const KeyRingData* data, const String* name);
+
+/* make sure does not exist, assign an id*/
+extern rc_t KeyRingDataAddObject (KeyRingData*  data, 
+                                  const String* name, 
+                                  const String* project, 
+                                  const String* display_name,
+                                  uint64_t      size,
+                                  const String* checksum,
+                                  const String* encryption_key);
+/* known to be new, id assigned*/
+extern rc_t KeyRingDataInsertObject(ObjectTable*  data, 
+                                    uint32_t      p_id, 
+                                    const String* name, 
+                                    const String* project, 
+                                    const String* display_name,
+                                    uint64_t      size,
+                                    const String* checksum,
+                                    const String* encryption_key);
+                                  
+extern const Object* KeyRingDataGetObject (const KeyRingData*  data, const String* name);
+
+
+#endif /* _h_keyring_data_ */
diff --git a/tools/keyring-srv/keyring-database.c b/tools/keyring-srv/keyring-database.c
new file mode 100644
index 0000000..0816a7d
--- /dev/null
+++ b/tools/keyring-srv/keyring-database.c
@@ -0,0 +1,441 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ * 
+ */
+
+#include "keyring-database.h"
+
+#include <vdb/database.h>
+#include <vdb/table.h>
+#include <vdb/manager.h>
+#include <vdb/schema.h>
+#include <vdb/cursor.h>
+
+#include "keyring-data.h"
+
+static const char schema_text[] =
+"version 1; "
+
+" table projects : MyProjects #1 { "
+"     extern column U32 id = .id;"
+"     physical column U32 .id = id;"
+
+"     extern    column ascii name = .name;"
+"     physical  column ascii .name = name;"
+
+"     extern    column ascii download_ticket = .download_ticket;"
+"     physical  column ascii .download_ticket = download_ticket;"
+
+"     extern    column ascii encryption_key = .encryption_key;"
+"     physical  column ascii .encryption_key = encryption_key;"
+" };"
+
+" table objects : MyObjects #1 { "
+"     extern    column U32 id = .id;"
+"     physical  column U32 .id = id;"
+
+"     extern    column ascii name = .name;"
+"     physical  column ascii .name = name;"
+
+"     extern    column ascii project = .project;"
+"     physical  column ascii .project = project;"
+
+"     extern    column ascii display_name = .display_name;"
+"     physical  column ascii .display_name = display_name;"
+
+"     extern    column U64   size = .size;"
+"     physical  column U64   .size = size;"
+
+"     extern    column ascii checksum = .checksum;"
+"     physical  column ascii .checksum = checksum;"
+
+"     extern    column ascii encryption_key = .encryption_key;"
+"     physical  column ascii .encryption_key = encryption_key;"
+" };"
+
+" table keys : MyKeys #1 { "
+"     physical column U32   .id;"
+"     physical column ascii .value;"
+" };"
+"database keyring : KEYRING #1 { "
+"    table objects: MyObjects   #1 object_inst;"
+"    table projects: MyProjects #1 project_inst;"
+"    table keys : MyKeys        #1 keys_inst;"
+"};";
+
+static rc_t SaveProjects( const ProjectTable* data, VDatabase* db );
+static rc_t SaveObjects ( const ObjectTable* data,  VDatabase* db );
+static rc_t LoadProjects( ProjectTable* data, const VDatabase* db );
+static rc_t LoadObjects ( ObjectTable* data,  const VDatabase* db );
+
+rc_t KeyRingDatabaseSave ( struct KeyRingData* self, struct KDirectory* wd, const char* path )
+{
+    rc_t rc;
+    VDBManager* vdbMgr;
+    rc = VDBManagerMakeUpdate( &vdbMgr, wd );
+    if (rc == 0)
+    {
+        VSchema* schema;
+        rc = VDBManagerMakeSchema(vdbMgr, &schema);
+        if (rc == 0)
+        {
+            rc = VSchemaParseText ( schema, "keyring_schema", schema_text, string_measure(schema_text, NULL) );
+            if (rc == 0)
+            {   /* create a database */
+                VDatabase* db;
+                rc = VDBManagerCreateDB(vdbMgr, & db, schema, "keyring:KEYRING", kcmCreate | kcmMD5, path);
+                if (rc == 0)
+                {   
+                    rc_t rc2;
+                    rc = SaveProjects(&self->projects, db);
+                    if (rc == 0)
+                        rc = SaveObjects(&self->objects, db);
+                    /*TODO: SaveKeys */
+                    rc2 = VDatabaseRelease(db);
+                    if (rc == 0)
+                        rc = rc2;
+                }
+
+            }
+            VSchemaRelease(schema);
+        }
+        VDBManagerRelease(vdbMgr);
+    }
+
+    return rc;
+}
+
+rc_t KeyRingDatabaseLoad ( struct KeyRingData* self, const struct KDirectory* dir, const char* path )
+{
+    VDBManager* innerMgr;
+    rc_t rc = VDBManagerMakeUpdate( &innerMgr, (KDirectory*)dir );
+    if (rc == 0)
+    {
+        rc_t rc2;
+        const VDatabase* db;
+        rc = VDBManagerOpenDBRead(innerMgr, & db, NULL, "%s", path);
+        if (rc == 0)
+        {
+            rc = LoadProjects(&self->projects, db);
+            if (rc == 0)
+                rc = LoadObjects(&self->objects, db);
+            /*TODO: LoadKeys */
+            rc2 = VDatabaseRelease(db);
+            if (rc == 0)
+                rc = rc2;
+        }
+        rc2 = VDBManagerRelease(innerMgr);
+        if (rc == 0)
+            rc = rc2;
+    }
+
+    return rc;
+}
+
+static 
+rc_t SaveProjects( const ProjectTable* data, VDatabase* db )
+{
+    VTable* tbl;
+    rc_t rc = VDatabaseCreateTable(db, &tbl, "project_inst", kcmCreate | kcmMD5, "PROJECTS");
+    if (rc == 0)
+    {
+        rc_t rc2;
+        VCursor *cur;
+        rc = VTableCreateCursorWrite( tbl, &cur, kcmInsert );
+        if (rc == 0)
+        {
+            uint32_t id_idx, name_idx, dl_idx, enc_idx;
+            rc = VCursorAddColumn( cur, &id_idx, "id" );
+            rc = VCursorAddColumn( cur, &name_idx, "name" );
+            rc = VCursorAddColumn( cur, &dl_idx, "download_ticket" );
+            rc = VCursorAddColumn( cur, &enc_idx, "encryption_key" );
+            if (rc == 0)
+            {
+                rc = VCursorOpen( cur );
+                if (rc == 0)
+                {
+                    const Project* p = (const Project*)BSTreeFirst(data);
+                    while (rc == 0 && p != NULL)
+                    {
+                        rc = VCursorOpenRow( cur );
+                        
+                        if (rc == 0) rc = VCursorWrite( cur, id_idx,    sizeof(p->id) * 8,                      &p->id,                     0, 1);
+                        if (rc == 0) rc = VCursorWrite( cur, name_idx,  StringLength(p->name) * 8,              p->name->addr,              0, 1);
+                        if (rc == 0) rc = VCursorWrite( cur, dl_idx,    StringLength(p->download_ticket) * 8,   p->download_ticket->addr,   0, 1);
+                        if (rc == 0) rc = VCursorWrite( cur, enc_idx,   StringLength(p->encryption_key) * 8,    p->encryption_key->addr,    0, 1);
+                        
+                        if (rc == 0) rc = VCursorCommitRow( cur );
+                        if (rc == 0) rc = VCursorCloseRow( cur );
+                        
+                        p = (const Project*)BSTNodeNext(&p->dad);
+                    }
+                    if (rc == 0)
+                        rc = VCursorCommit( cur );
+                }
+            }
+            rc2 = VCursorRelease(cur);
+            if (rc == 0)
+                rc = rc2;
+        }
+        
+        rc2 = VTableRelease(tbl);
+        if (rc == 0)
+            rc = rc2;
+    }
+    return rc;
+}
+
+static 
+rc_t SaveObjects ( const ObjectTable* data,  VDatabase* db )
+{
+    VTable* tbl;
+    rc_t rc = VDatabaseCreateTable(db, &tbl, "object_inst", kcmCreate | kcmMD5, "OBJECTS");
+    if (rc == 0)
+    {
+        rc_t rc2;
+        VCursor *cur;
+        rc = VTableCreateCursorWrite( tbl, &cur, kcmInsert );
+        if (rc == 0)
+        {
+            uint32_t id_idx, name_idx, proj_idx, dname_idx, size_idx, csum_idx, enc_idx;
+            if (rc == 0) rc = VCursorAddColumn( cur, &id_idx,    "id" );
+            if (rc == 0) rc = VCursorAddColumn( cur, &name_idx,  "name" );
+            if (rc == 0) rc = VCursorAddColumn( cur, &proj_idx,    "project" );
+            if (rc == 0) rc = VCursorAddColumn( cur, &dname_idx, "display_name" );
+            if (rc == 0) rc = VCursorAddColumn( cur, &size_idx,  "size" );
+            if (rc == 0) rc = VCursorAddColumn( cur, &csum_idx,  "checksum" );
+            if (rc == 0) rc = VCursorAddColumn( cur, &enc_idx,   "encryption_key" );
+
+            if (rc == 0)
+            {
+                rc = VCursorOpen( cur );
+                if (rc == 0)
+                {
+                    const Object* obj = (const Object*)BSTreeFirst(data);
+                    while (rc == 0 && obj != NULL)
+                    {
+                        rc = VCursorOpenRow( cur );
+                        
+                        if (rc == 0) rc = VCursorWrite( cur, id_idx,    sizeof(obj->id) * 8,                   &obj->id,                  0, 1);
+                        if (rc == 0) rc = VCursorWrite( cur, name_idx,  StringLength(obj->name) * 8,           obj->name->addr,           0, 1);
+                        if (rc == 0) rc = VCursorWrite( cur, proj_idx,  StringLength(obj->project) * 8,        obj->project->addr,        0, 1);
+                        if (rc == 0) rc = VCursorWrite( cur, dname_idx, StringLength(obj->display_name) * 8,   obj->display_name->addr,   0, 1);
+                        if (rc == 0) rc = VCursorWrite( cur, size_idx,  sizeof(obj->size) * 8,                 &obj->size,                0, 1);
+                        if (rc == 0) rc = VCursorWrite( cur, csum_idx,  StringLength(obj->encryption_key) * 8, obj->encryption_key->addr, 0, 1);
+                        if (rc == 0) rc = VCursorWrite( cur, enc_idx,   StringLength(obj->encryption_key) * 8, obj->encryption_key->addr, 0, 1);
+                        
+                        if (rc == 0) rc = VCursorCommitRow( cur );
+                        if (rc == 0) rc = VCursorCloseRow( cur );
+                        
+                        obj = (const Object*)BSTNodeNext(&obj->dad);
+                    }
+                    if (rc == 0) rc = VCursorCommit( cur );
+                }
+            }
+            rc2 = VCursorRelease(cur);
+            if (rc == 0)
+                rc = rc2;
+        }
+        
+        rc2 = VTableRelease(tbl);
+        if (rc == 0)
+            rc = rc2;
+    }
+    return rc;
+}
+
+static size_t CursorCacheSize = 32*1024;
+
+static
+bool HasData(const VTable* tbl)
+{
+    bool ret = false;
+    KNamelist *names;
+    if (VTableListCol(tbl, &names) == 0) 
+    {
+        uint32_t n;
+        ret = KNamelistCount( names, &n ) == 0 && n > 0;
+    }
+    KNamelistRelease( names );
+    return ret;
+}
+
+static 
+rc_t LoadProjects( ProjectTable* data, const VDatabase* db )
+{
+    const VTable* tbl;
+    rc_t rc = VDatabaseOpenTableRead(db, &tbl, "PROJECTS");
+    if (rc == 0)
+    {
+        rc_t rc2;
+        const VCursor *cur;
+
+        rc = VTableCreateCachedCursorRead( tbl, &cur, CursorCacheSize );
+        if (rc == 0)
+        {
+            uint32_t id_idx, name_idx, dl_idx, enc_idx;
+            rc = VCursorAddColumn( cur, &id_idx,    "id" );
+            if (rc == 0) rc = VCursorAddColumn( cur, &name_idx,  "name" );
+            if (rc == 0) rc = VCursorAddColumn( cur, &dl_idx,    "download_ticket" );
+            if (rc == 0) rc = VCursorAddColumn( cur, &enc_idx,   "encryption_key" );
+            if (rc == 0 && HasData(tbl))
+            {
+                rc = VCursorOpen( cur );
+                if (rc == 0)
+                {
+                    int64_t  first;
+                    uint64_t count;
+                    rc = VCursorIdRange( cur, 0, &first, &count );
+                    if (rc == 0)
+                    {
+                        uint64_t i;
+                        for (i=0; i < count; ++i)
+                        {
+                            const void* ptr;
+                            uint32_t elem_count;
+                            uint32_t id;
+                            String name;
+                            String download_ticket;
+                            String encryption_key;
+
+                            rc = VCursorSetRowId(cur, first + i);
+                            if (rc == 0) rc = VCursorOpenRow( cur );
+                            
+                            if (rc == 0) rc = VCursorCellData( cur, id_idx, NULL, &ptr, NULL, NULL);
+                            if (rc == 0) id = *(uint32_t*)ptr;
+                            if (rc == 0) rc = VCursorCellData( cur, name_idx, NULL, &ptr, NULL, &elem_count);
+                            if (rc == 0) StringInit(&name, (const char*)ptr, elem_count, elem_count);
+                            if (rc == 0) rc = VCursorCellData( cur, dl_idx, NULL, &ptr, NULL, &elem_count);
+                            if (rc == 0) StringInit(&download_ticket, (const char*)ptr, elem_count, elem_count);
+                            if (rc == 0) rc = VCursorCellData( cur, enc_idx, NULL, &ptr, NULL, &elem_count);
+                            if (rc == 0) StringInit(&encryption_key, (const char*)ptr, elem_count, elem_count);
+                            
+                            if (rc == 0) rc = KeyRingDataInsertProject(data, id, &name, &download_ticket, &encryption_key);
+                            if (rc == 0) rc = VCursorCloseRow( cur );
+                            if (rc != 0) 
+                                break;
+                        }
+                    }
+                }
+            }
+            rc2 = VCursorRelease(cur);
+            if (rc == 0)
+                rc = rc2;
+        }
+        
+        rc2 = VTableRelease(tbl);
+        if (rc == 0)
+            rc = rc2;
+    }
+    return rc;
+}
+
+static 
+rc_t LoadObjects ( ObjectTable* data,  const VDatabase* db )
+{
+    const VTable* tbl;
+    rc_t rc = VDatabaseOpenTableRead(db, &tbl, "OBJECTS");
+    if (rc == 0)
+    {
+        rc_t rc2;
+        const VCursor *cur;
+
+        rc = VTableCreateCachedCursorRead( tbl, &cur, CursorCacheSize );
+        if (rc == 0)
+        {
+            uint32_t id_idx, name_idx, proj_idx, dname_idx, size_idx, csum_idx, enc_idx;
+            if (rc == 0) rc = VCursorAddColumn( cur, &id_idx,    "id" );
+            if (rc == 0) rc = VCursorAddColumn( cur, &name_idx,  "name" );
+            if (rc == 0) rc = VCursorAddColumn( cur, &proj_idx,    "project" );
+            if (rc == 0) rc = VCursorAddColumn( cur, &dname_idx, "display_name" );
+            if (rc == 0) rc = VCursorAddColumn( cur, &size_idx,  "size" );
+            if (rc == 0) rc = VCursorAddColumn( cur, &csum_idx,  "checksum" );
+            if (rc == 0) rc = VCursorAddColumn( cur, &enc_idx,   "encryption_key" );
+            if (rc == 0 && HasData(tbl))
+            {
+                rc = VCursorOpen( cur );
+                if (rc == 0)
+                {
+                    int64_t  first;
+                    uint64_t count;
+                    rc = VCursorIdRange( cur, 0, &first, &count );
+                    if (rc == 0)
+                    {
+                        uint64_t i;
+                        for (i=0; i < count; ++i)
+                        {
+                            const void* ptr;
+                            uint32_t elem_count;
+                            uint32_t id;
+                            String name;
+                            String project;
+                            String display_name;
+                            uint64_t size;
+                            String checksum;
+                            String encryption_key;
+
+                            rc = VCursorSetRowId(cur, first + i);
+                            if (rc == 0) rc = VCursorOpenRow( cur );
+                            
+                            if (rc == 0) rc = VCursorCellData( cur, id_idx, NULL, &ptr, NULL, NULL);
+                            if (rc == 0) id = *(uint32_t*)ptr;
+                            
+                            if (rc == 0) rc = VCursorCellData( cur, name_idx, NULL, &ptr, NULL, &elem_count);
+                            if (rc == 0) StringInit(&name, (const char*)ptr, elem_count, elem_count);
+                            
+                            if (rc == 0) rc = VCursorCellData( cur, proj_idx, NULL, &ptr, NULL, &elem_count);
+                            if (rc == 0) StringInit(&project, (const char*)ptr, elem_count, elem_count);
+                            
+                            if (rc == 0) rc = VCursorCellData( cur, dname_idx, NULL, &ptr, NULL, &elem_count);
+                            if (rc == 0) StringInit(&display_name, (const char*)ptr, elem_count, elem_count);
+                            
+                            if (rc == 0) rc = VCursorCellData( cur, size_idx, NULL, &ptr, NULL, NULL);
+                            if (rc == 0) size = *(uint32_t*)ptr;
+                            
+                            if (rc == 0) rc = VCursorCellData( cur, enc_idx, NULL, &ptr, NULL, &elem_count);
+                            if (rc == 0) StringInit(&encryption_key, (const char*)ptr, elem_count, elem_count);
+                            
+                            if (rc == 0) rc = VCursorCellData( cur, csum_idx, NULL, &ptr, NULL, &elem_count);
+                            if (rc == 0) StringInit(&checksum, (const char*)ptr, elem_count, elem_count);
+
+                            if (rc == 0) rc = KeyRingDataInsertObject(data, id, &name, &project, &display_name, size, &checksum, &encryption_key);
+                            if (rc == 0) rc = VCursorCloseRow( cur );
+                            if (rc != 0)
+                                break;
+                        }
+                    }
+                }
+            }
+            rc2 = VCursorRelease(cur);
+            if (rc == 0)
+                rc = rc2;
+        }
+        
+        rc2 = VTableRelease(tbl);
+        if (rc == 0)
+            rc = rc2;
+    }
+    return rc;
+}
+
diff --git a/tools/keyring-srv/keyring-database.h b/tools/keyring-srv/keyring-database.h
new file mode 100644
index 0000000..3af12ab
--- /dev/null
+++ b/tools/keyring-srv/keyring-database.h
@@ -0,0 +1,45 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+
+#ifndef _h_keyring_database_
+#define _h_keyring_database_
+
+#include <klib/rc.h>
+
+struct KDirectory;
+struct KeyRingData;
+
+/*
+ * Save into a (non-archived) directory
+ */
+extern rc_t KeyRingDatabaseSave ( struct KeyRingData* self, struct KDirectory* dir, const char* path );
+
+/*
+ * Load from a directory (possibly archived/encrypted)
+*/
+extern rc_t KeyRingDatabaseLoad ( struct KeyRingData* self, const struct KDirectory* dir, const char* path);
+
+#endif /* _h_keyring_database_ */
diff --git a/tools/keyring-srv/keyring-srv-main.c b/tools/keyring-srv/keyring-srv-main.c
new file mode 100644
index 0000000..c34aa4d
--- /dev/null
+++ b/tools/keyring-srv/keyring-srv-main.c
@@ -0,0 +1,340 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ * 
+ */
+ 
+/* KeyRing Server process
+ *  - install an IPC socket listener (name = "vdb-keyring")
+ *  - listen for incoming IPC connections
+ *  - handle IPC requests
+ *      Request format: 
+ *          <uint16_t length><body> 
+ *      Request body:
+ *          - "I" - init
+ *          - "X" - shutDown
+ *          - "PA<uint8 length>name<uint8 length>dl_ticket<uint8 length>enc_key" - add project
+ *      Response format:
+ *          <uint8_t length><body>
+ *      Response body:
+ *          - "IY" init successful
+ *          - "IN" init failed (bad password?)
+ */
+
+#include "keyring-srv.vers.h"
+
+#include "keyring-srv.h"
+
+#include <klib/text.h>
+#include <klib/log.h>
+#include <klib/printf.h>
+
+#include <kproc/thread.h>
+
+#include <kns/manager.h>
+#include <kns/socket.h>
+#include <kns/endpoint.h>
+#include <kns/stream.h>
+
+#include <kfs/directory.h>
+#include <kfs/file.h>
+#include <kfs/lockfile.h>
+
+#include <vfs/keyring-priv.h>
+
+#include <kapp/args.h>
+
+#ifndef MAX_PATH
+#define MAX_PATH 4096
+#endif
+
+static rc_t WorkerThreadFn ( const KThread *self, void *data );
+
+static bool shutDown = false;
+
+/*TODO: add pid to log messages? */
+static const char* initMsgSuccess = "\x02IY";
+static const char* initMsgFailure = "\x02IN";
+
+char keyRingFileName[MAX_PATH];
+KKeyRing* keyring = NULL;
+
+static 
+rc_t 
+Server( KNSManager* mgr )  
+{   
+    rc_t rc = 0;
+    KEndPoint ep;
+    String name; 
+
+    CONST_STRING(&name, KEYRING_IPC_NAME);
+    rc = KNSManagerInitIPCEndpoint(mgr, &ep, &name);
+    if (rc == 0)
+    {
+        KSocket* listener;
+        rc = KNSMakeListener ( &listener, &ep );
+        if (rc == 0)
+        {
+            shutDown = false;
+            while (!shutDown && rc == 0)
+            {
+                KStream* stream;
+                LogMsg ( klogInfo, "KeyringServer: listening");
+                rc = KNSListen ( listener, &stream ); /* may not return from here if no more incoming connections arrive */
+                if (rc == 0)
+                {
+                    KThread* worker;
+                    LogMsg ( klogInfo, "KeyringServer: detected connection");
+                    rc = KThreadMake ( &worker, WorkerThreadFn, stream);
+                    if (rc == 0 && worker != NULL)
+                    {
+                        KThreadWait(worker, NULL);
+                        LogMsg ( klogInfo, "KeyringServer: out of worker");
+                    }
+                    else
+                        LogErr(klogErr, rc, "KeyringServer: KThreadMake failed");
+                }
+                else
+                    LogErr(klogErr, rc, "KeyringServer: KNSListen failed");
+            }
+            LogMsg ( klogInfo, "KeyringServer: shutting down");
+            
+            /* TODO: make sure no incoming messages get dropped (stop accepting connections? wait for all active threads to exit?) 
+                - lock the server */
+                
+            if (keyring != NULL)
+            {
+                KeyRingRelease(keyring);
+                keyring = NULL;
+            }
+                
+            KSocketRelease(listener);
+        }
+        else
+            LogErr(klogErr, rc, "KeyringServer: KNSMakeListener failed");
+    }
+    else
+        LogErr(klogErr, rc, "KeyringServer: KNSManagerInitIPCEndpoint failed");
+    LogMsg ( klogInfo, "KeyringServer: listener shut down");
+    return rc;
+}
+    
+static 
+rc_t 
+WorkerThreadFn ( const KThread *self, void *data )  
+{
+    KStream* stream = (KStream*)data;
+    char buf[256];
+    size_t num;
+    rc_t rc = KStreamReadAll(stream, buf, 1, &num);
+    if (rc == 0)
+    {
+        if (num == 1) 
+        {
+            size_t toRead = (unsigned char)buf[0];
+            pLogMsg(klogInfo, "KeyringServer: worker received length=$(l)\n", "l=%d", toRead);
+            rc = KStreamReadAll(stream, buf, toRead, &num);
+            if (rc == 0)
+            {
+                /*pLogMsg(klogInfo, "KeyringServer: worker received msg='$(buf)'\n", "buf=%.*s", num, buf);*/
+                switch (buf[0])
+                {
+                case 'I':
+                    if (buf[0] == 'I') /* init */
+                    {
+                        LogMsg ( klogInfo, "KeyringServer: received Init");
+
+                        if (keyring == 0)
+                        {
+                            const KFile* std_in;
+                            
+                            rc = KFileMakeStdIn ( &std_in );
+                            if (rc == 0)
+                            {
+                                KFile* std_out;
+                                rc = KFileMakeStdOut ( &std_out );
+                                if (rc == 0)
+                                {
+                                    rc = KeyRingOpen(&keyring, keyRingFileName, std_in, std_out);
+                                    if (rc == 0)
+                                    {
+                                        LogMsg ( klogInfo, "KeyringServer: Init successful");
+                                        pLogMsg(klogInfo, "KeyringServer: sending '$(buf)'\n", "buf=%.*s", string_size(initMsgSuccess), initMsgSuccess);
+                                        rc = KStreamWrite(stream, initMsgSuccess, string_size(initMsgSuccess), NULL);
+                                    }
+                                    else
+                                    {
+                                        rc_t rc2;
+                                        LogErr(klogErr, rc, "KeyringServer: Init failed");
+                                        rc2 = KStreamWrite(stream, initMsgFailure, string_size(initMsgFailure), NULL);
+                                        if (rc == 0)
+                                            rc = rc2;
+                                    }
+                                    KFileRelease(std_out);
+                                }
+                                KFileRelease(std_in);
+                            }
+                        }
+                        else
+                        {   /* already running */
+                            LogMsg ( klogInfo, "KeyringServer: Init successful");
+                            rc = KStreamWrite(stream, initMsgSuccess, string_size(initMsgSuccess), NULL);
+                        }
+                    }
+                    break;
+                case 'X':
+                    if (buf[0] == 'X') /* shutDown */
+                    {
+                        LogMsg ( klogInfo, "KeyringServer: received Shutdown");
+                        shutDown = true;
+                    }
+                    break;
+                case 'P': /* project */
+                    if (toRead > 1 && buf[1] == 'A') /* Add */
+                    {
+                        String pkey;
+                        String dlkey;
+                        String enckey;
+
+                        size_t idx = 2;
+                        /*TODO: make sure idx is in range*/
+                        StringInit(&pkey, buf + idx + 1, buf[idx], buf[idx]);
+                        pkey.len = string_len(pkey.addr, pkey.size);
+
+                        idx += pkey.size + 1;
+                        /*TODO: make sure idx is in range*/
+                        StringInit(&dlkey, buf + idx + 1, buf[idx], buf[idx]);
+                        dlkey.len = string_len(dlkey.addr, dlkey.size);
+                        
+                        idx += dlkey.size + 1;
+                        /*TODO: make sure idx is in range*/
+                        StringInit(&enckey, buf + idx + 1, buf[idx], buf[idx]);
+                        enckey.len = string_len(enckey.addr, enckey.size);
+                        
+                        pLogMsg(klogInfo,  
+                                "KeyringServer: received Project Add(pkey='$(pkey)',dlkey='$(dlkey)',enckey='$(.....)')'\n",
+                                "pkey=%.*s,dlkey=%.*s,enckey=%.*s", 
+                                pkey.len, pkey.addr, dlkey.len, dlkey.addr, enckey.len, enckey.addr);
+                        
+                        rc = KeyRingAddProject(keyring, &pkey, &dlkey, &enckey);
+                        if (rc != 0)
+                            LogErr(klogErr, rc, "KeyringServer: KeyRingAddProject() failed");
+                    }
+                    break;
+                default:
+                    LogMsg ( klogInfo, "KeyringServer: unrecognised message received");
+                    break;
+                }
+            }
+            else
+                LogErr(klogErr, rc, "KeyringServer: KStreamRead(body) failed");
+        }
+        else /* end of stream = the client closed the connection */
+            LogMsg(klogInfo, "KeyringServer: worker received EOF\n");
+    }
+    else
+        LogErr(klogErr, rc, "KeyringServer: KStreamRead(length) failed");
+    LogMsg ( klogInfo, "KeyringServer: worker done");
+    return KThreadRelease(self);
+}
+
+
+rc_t UsageSummary (char const * progname)
+{
+    return 0;
+}
+
+char const UsageDefaultName[] = "keyring-srv";
+
+rc_t CC Usage (const Args * args)
+{
+    return 0;
+}
+
+uint32_t CC KAppVersion (void)
+{
+    return KEYRING_SRV_VERS;
+}
+
+/*TODO: handle signals */
+/*TODO: handle stale lock files */
+
+rc_t CC KMain (int argc, char * argv[])
+{
+    rc_t rc = 0;
+    KDirectory* wd;
+    
+    KLogLevelSet(klogInfo);
+    LogMsg ( klogInfo, "KeyringServer: starting");
+
+    rc = KDirectoryNativeDir (&wd);
+    if (rc == 0)
+    {
+        KFile* lockedFile;
+        const char* dataDir;
+        
+        char lockFileName[MAX_PATH];
+        if (argc < 2 || argv[1] == NULL)
+            dataDir = KeyRingDefaultDataDir;
+        else
+            dataDir = argv[1];
+        rc = string_printf(lockFileName, sizeof(lockFileName)-1, NULL, "%s/keyring_lock", dataDir);
+        if (rc == 0)
+        {
+            rc = KDirectoryCreateExclusiveAccessFile(wd, &lockedFile, true, 0600, kcmOpen, "%s", lockFileName);
+            if (rc == 0)
+            {
+                KNSManager* mgr;
+                rc = KNSManagerMake(&mgr);
+                if (rc == 0)
+                {
+                    rc = string_printf(keyRingFileName, sizeof(keyRingFileName)-1, NULL, "%s/keyring", dataDir);
+                    if (rc == 0)
+                        rc = Server(mgr);
+                    KNSManagerRelease(mgr);
+                }
+                else
+                    LogErr(klogErr, rc, "KeyringServer: KNSManagerMake failed");
+                KFileRelease(lockedFile); 
+                LogMsg ( klogInfo, "KeyringServer: removing lock file.");
+                KDirectoryRemove(wd, true, "%s", lockFileName);
+            }
+            else
+            {   /*TODO: check for stale lock file*/
+                LogMsg ( klogInfo, "KeyringServer: another instance appears to be running.");
+                rc = 0;
+            }
+        }
+        else
+            LogErr ( klogErr, rc, "KeyringServer: failed to build the lock file name" );
+        
+        KDirectoryRelease(wd);
+    }
+    else
+        LogErr(klogErr, rc, "KeyringServer: KDirectoryNativeDir failed");
+    
+    LogMsg ( klogInfo, "KeyringServer: finishing");
+    
+    return rc;
+}
+
diff --git a/tools/keyring-srv/keyring-srv.c b/tools/keyring-srv/keyring-srv.c
new file mode 100644
index 0000000..d899d43
--- /dev/null
+++ b/tools/keyring-srv/keyring-srv.c
@@ -0,0 +1,522 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ * 
+ */
+
+#include "keyring-srv.h"
+
+#include <sysalloc.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+#include <klib/text.h>
+#include <klib/log.h>
+
+#include <kfs/file.h>
+#include <kfs/toc.h>
+#include <kfs/arc.h>
+#include <kfs/tar.h>
+#include <kfs/impl.h>
+
+#include <krypto/key.h>
+#include <krypto/encfile.h>
+
+#include "keyring-data.h"
+#include "keyring-database.h"
+
+static rc_t KeyRingInit     ( KKeyRing* self, const char* path );
+static rc_t KeyRingWhack    ( KKeyRing* self );
+static rc_t CreateDatabase  ( KKeyRing* self );
+static rc_t OpenDatabase    ( KKeyRing* self );
+
+#define MaxPwdSize 512
+
+struct KKeyRing {
+    KRefcount refcount;
+    
+    KDirectory* wd; 
+    char* path;
+    char passwd[MaxPwdSize];
+    
+    KeyRingData* data;
+};
+
+/* location of the temporary database (pre archiving+encryption */
+const char tmp_path[] = "keyring.temp";
+
+/* returns a NUL-terminated password fitting in the buffer */
+static
+rc_t
+ReadPassword(const struct KFile* pwd_in, size_t* last_pos, char* buf, size_t buf_size)
+{
+string_copy(buf, buf_size, "screwuahole", string_size("screwuahole")); return 0;
+
+    rc_t rc = 0;
+    size_t i =0;
+    do
+    {
+        size_t num_read;
+        if (i == buf_size)
+            return RC(rcApp, rcEncryptionKey, rcReading, rcParam, rcTooLong);
+            
+        rc = KFileRead( pwd_in, *last_pos, & buf[i], 1, &num_read );
+        if (rc == 0)
+        {
+            if (num_read != 1)
+                return RC(rcApp, rcEncryptionKey, rcReading, rcSize, rcInvalid);
+
+            if (buf[i] == '\n')
+            {
+                buf[i] = 0;
+                ++ *last_pos;
+                break;
+            }
+        }
+        ++ *last_pos;
+        ++ i;
+    }
+    while(rc == 0);
+    return rc;
+}
+
+static
+rc_t GetNewPassword(const struct KFile* pwd_in, struct KFile* pwd_out, char* buf)
+{
+    rc_t rc = KFileWrite ( pwd_out, 0, KR_PWD_PROMPT_1, string_measure(KR_PWD_PROMPT_1, NULL), NULL);
+    if (rc == 0)
+    {
+        char buf1[MaxPwdSize];
+        size_t last_pos = 0;
+        rc = ReadPassword(pwd_in, & last_pos, buf1, MaxPwdSize);
+        if (rc == 0)
+        {
+            rc = KFileWrite ( pwd_out, 
+                              string_measure(KR_PWD_PROMPT_1, NULL), 
+                              KR_PWD_PROMPT_2, string_measure(KR_PWD_PROMPT_2, NULL), NULL );
+            if (rc == 0)
+            {
+                char buf2[MaxPwdSize];
+                rc = ReadPassword(pwd_in, & last_pos, buf2, sizeof(buf2));
+                if (rc == 0)
+                {
+                    size_t pwd_size = string_measure(buf1, NULL);
+                    if (string_cmp(buf1, pwd_size, buf2, string_measure(buf2, NULL), MaxPwdSize) != 0)
+                        rc = RC(rcApp, rcEncryptionKey, rcCreating, rcParam, rcInconsistent);
+                    else
+                        string_copy(buf, MaxPwdSize, buf1, pwd_size + 1);
+                }
+            }
+        }
+    }
+    return rc;
+}
+
+static
+rc_t GetPassword(const struct KFile* pwd_in, struct KFile* pwd_out, char* buf)
+{
+    rc_t rc = KFileWrite ( pwd_out, 0, KR_PWD_PROMPT_1, string_measure(KR_PWD_PROMPT_1, NULL), NULL);
+    if (rc == 0)
+    {
+        char buf1[MaxPwdSize];
+        size_t last_pos = 0;
+        rc = ReadPassword(pwd_in, & last_pos, buf1, MaxPwdSize);
+        if (rc == 0)
+            string_copy(buf, MaxPwdSize, buf1, string_measure(buf1, NULL) + 1);
+    }
+    return rc;
+}
+
+rc_t KeyRingOpen(KKeyRing** self, const char* path, const struct KFile* pwd_in, struct KFile* pwd_out)
+{
+    rc_t rc; 
+    assert(self && path && pwd_in && pwd_out);
+
+    *self = (KKeyRing*) malloc(sizeof(**self));
+    if (*self)
+    { 
+        rc = KeyRingInit(*self, path);
+        if (rc == 0)
+        {
+            rc = KeyRingAddRef(*self);
+            if (rc == 0)
+            {
+                KDirectory* wd; 
+                rc = KDirectoryNativeDir(&wd);
+                if (rc == 0)
+                {   /* open the database */
+                    if (KDirectoryPathType(wd, "%s", (*self)->path) == kptFile)
+                        rc = GetPassword(pwd_in, pwd_out, (*self)->passwd);
+                    else /* does not exist; create first */
+                    {   
+                        rc = GetNewPassword(pwd_in, pwd_out, (*self)->passwd);
+                        if (rc == 0)
+                            rc = CreateDatabase(*self);
+                    }
+                    if (rc == 0)
+                        rc = OpenDatabase(*self);
+                        
+                    {
+                        rc_t rc2;
+                        rc2 = KDirectoryRelease(wd);
+                        if (rc == 0)
+                            rc = rc2;
+                    }
+                }
+            }
+            
+            if (rc != 0)
+            {
+                KeyRingWhack(*self);
+                *self = NULL;
+            }
+        }
+        else
+        {
+            free(*self);
+            *self = NULL;
+        }
+    }
+    else
+        rc = RC ( rcApp, rcDatabase, rcOpening, rcMemory, rcExhausted );
+
+    return rc;
+}
+
+rc_t KeyRingInit ( KKeyRing* self, const char* path )
+{
+    rc_t rc;
+    
+    memset ( self, 0, sizeof * self );
+    KRefcountInit ( & self -> refcount, 0, "KKeyRing", "init", "" );
+    
+    rc = KDirectoryNativeDir(&self->wd);
+    if (rc == 0)
+    {
+        self->path = string_dup(path, string_size(path));
+        if (self->path)
+        {
+            self->data = (KeyRingData*) malloc(sizeof(*self->data));
+            if (self->data)
+            {
+                rc = KeyRingDataInit ( self->data );
+                if (rc != 0)
+                    free(self->data);
+            }
+            else
+                rc = RC ( rcApp, rcDatabase, rcOpening, rcMemory, rcExhausted );
+                
+            if (rc != 0)
+                free(self->path);
+        }
+        else
+            rc = RC ( rcApp, rcDatabase, rcOpening, rcMemory, rcExhausted );
+            
+        if (rc != 0)
+            KDirectoryRelease(self->wd);
+    }
+        
+    return rc;
+}
+
+rc_t KeyRingWhack(KKeyRing* self)
+{
+    KeyRingDataWhack( self->data );
+    free(self->data);
+    free(self->path);
+    KDirectoryRelease(self->wd);
+    free(self);
+    return 0;
+}
+
+rc_t KeyRingAddRef(KKeyRing* self)
+{
+    if ( self != NULL )
+    {
+        switch ( KRefcountAdd ( & self -> refcount, "KKeyRing" ) )
+        {
+        case krefLimit:
+            return RC ( rcApp, rcEncryptionKey, rcAttaching, rcRange, rcExcessive );
+        }
+    }
+    return 0;
+}
+
+rc_t KeyRingRelease(KKeyRing* self)
+{
+    if ( self != NULL )
+    {
+        switch ( KRefcountDrop ( & self -> refcount, "KKeyRing" ) )
+        {
+        case krefWhack:
+            KeyRingWhack ( self );
+        break;
+        case krefNegative:
+            return RC ( rcApp, rcEncryptionKey, rcReleasing, rcRange, rcExcessive );
+        }
+    }
+    return 0;
+}
+
+static
+rc_t copy_file (const KFile * fin, KFile *fout)
+{
+    rc_t rc;
+    uint8_t	buff	[64 * 1024];
+    size_t	num_read;
+    uint64_t	inpos;
+    uint64_t	outpos;
+
+    assert (fin != NULL);
+    assert (fout != NULL);
+
+    inpos = 0;
+    outpos = 0;
+
+    do
+    {
+        rc = KFileRead (fin, inpos, buff, sizeof (buff), &num_read);
+        if (rc != 0)
+        {
+            PLOGERR (klogErr, (klogErr, rc,
+                     "Failed to read from directory structure in creating archive at $(P)",
+                               PLOG_U64(P), inpos));
+            break;
+        }
+        else if (num_read > 0)
+        {
+            size_t to_write;
+
+            inpos += (uint64_t)num_read;
+
+            to_write = num_read;
+            while (to_write > 0)
+            {
+                size_t num_writ;
+                rc = KFileWrite (fout, outpos, buff, num_read, &num_writ);
+                if (rc != 0)
+                {
+                    PLOGERR (klogErr, (klogErr, rc,
+                             "Failed to write to archive in creating archive at $(P)",
+                                       PLOG_U64(P), outpos));
+                    break;
+                }
+                outpos += num_writ;
+                to_write -= num_writ;
+            }
+        }
+        if (rc != 0)
+            break;
+    } while (num_read != 0);
+    return rc;
+}
+
+rc_t ArchiveAndEncrypt(KDirectory* wd, const char* inpath, const char* outpath, const char* passwd)
+{
+    const KDirectory* d;
+    rc_t rc = KDirectoryOpenDirRead (wd, &d, false, "%s", inpath);
+    if (rc == 0)
+    {
+        const KFile* infile;
+        rc_t rc2;
+    
+        rc = KDirectoryOpenTocFileRead (d, &infile, 4, NULL, NULL, NULL);
+        if (rc == 0)
+        {
+            KFile* outfile;
+                
+            /* if the file exists, add write access */
+            KDirectorySetAccess( wd, false, 0600, 0777, "%s", outpath );
+            rc = KDirectoryCreateFile(wd, &outfile, false, 0600, kcmCreate|kcmInit, "%s", outpath);
+            if ( rc == 0 )
+            {
+                KFile* enc_outfile;
+                KKey key;
+                rc = KKeyInitRead(&key, kkeyAES256, passwd, string_measure(passwd, NULL));
+                if ( rc == 0 )
+                    rc = KEncFileMakeWrite(&enc_outfile, outfile, &key);
+                    
+                if (rc == 0)
+                    rc = copy_file(infile, enc_outfile);
+        
+                rc2 = KFileRelease(outfile);
+                if (rc == 0)
+                    rc = rc2;
+                /* remove write access */
+                rc2 = KDirectorySetAccess( wd, false, 0400, 0777, "%s", outpath );
+                if (rc == 0)
+                    rc = rc2;
+                rc2 = KFileRelease(enc_outfile);
+                if (rc == 0)
+                    rc = rc2;
+            }
+            rc2 = KFileRelease(infile);
+            if (rc == 0)
+                rc = rc2;
+        }
+        rc2 = KDirectoryRelease(d);
+        if (rc == 0)
+            rc = rc2;
+    }
+    return rc;
+}
+
+rc_t CreateDatabase(KKeyRing* self)
+{   /* database is presumed write-locked */
+    rc_t rc;
+    
+    assert(self);
+    
+    KDirectoryRemove(self->wd, true, "%s", tmp_path); /* in case exists */
+    rc = KeyRingDatabaseSave(self->data, self->wd, tmp_path);
+    if (rc == 0)
+    {
+        rc_t rc2;
+        rc = ArchiveAndEncrypt(self->wd, tmp_path, self->path, self->passwd);
+        
+        rc2 = KDirectoryRemove(self->wd, true, "%s", tmp_path);
+        if (rc == 0)
+            rc = rc2;
+    }
+    return rc;
+}
+
+rc_t OpenDatabase(KKeyRing* self)
+{
+    rc_t rc;
+    const KFile* enc_infile;
+    
+    assert(self);
+    rc = KDirectoryOpenFileRead(self->wd, &enc_infile, "%s", self->path);
+    if ( rc == 0)
+    {
+        rc_t rc2;
+        const KFile* infile;
+        KKey key;
+        rc = KKeyInitRead(&key, kkeyAES256, self->passwd, string_measure(self->passwd, NULL));
+        if ( rc == 0 )
+        {
+            rc = KEncFileMakeRead (&infile, enc_infile, &key);
+            if (rc == 0)
+            {   
+                const KDirectory* arc;
+                rc = KDirectoryOpenArcDirRead_silent_preopened(self->wd, &arc, true, "/keyring", tocKFile, (void*)infile, KArcParseSRA, NULL, NULL);
+                if (rc == 0)
+                {
+                    /*  Hack: we violate the KDirectory object interface in order for VDBManagerMakeUpdate to succeed,
+                        since it would refuse to open a read-only dir (i.e. archive);
+                        We will only read from the object, though.
+                    */
+                    ((KDirectory*)arc)->read_only = false;
+                    rc = KeyRingDatabaseLoad(self->data, arc, "/keyring");
+                    rc2 = KDirectoryRelease(arc);
+                    if (rc == 0)
+                        rc = rc2;
+                }
+                rc2 = KFileRelease(infile);
+                if (rc == 0)
+                    rc = rc2;
+            }
+        }
+            
+        rc2 = KFileRelease(enc_infile);
+        if (rc == 0)
+            rc = rc2;
+    }
+    return rc;
+}
+
+rc_t KeyRingAddProject(KKeyRing* self, const String* name, const String* download_ticket, const String* encryption_key)
+{   
+    rc_t rc = 0;
+    
+    assert(self && name && download_ticket && encryption_key);
+    
+    /*TODO: write-lock database */
+    rc = KeyRingDataAddProject(self->data, name, download_ticket, encryption_key);
+    if (rc == 0)
+        rc = CreateDatabase(self); 
+    /*TODO: unlock database */
+    return rc;
+}
+
+rc_t KeyRingGetProject(KKeyRing* self, const String* name, String* download_ticket, String* encryption_key)
+{   
+    rc_t rc = 0;
+    const Project* p;
+    
+    assert(self && name && download_ticket && encryption_key);
+    
+    p = KeyRingDataGetProject(self->data, name);
+    if (p != NULL)
+    {
+        StringInit(download_ticket, p->download_ticket->addr, p->download_ticket->len, p->download_ticket->size);
+        StringInit(encryption_key, p->encryption_key->addr, p->encryption_key->len, p->encryption_key->size);
+    }
+    else
+        rc = RC(rcApp, rcDatabase, rcSearching, rcName, rcNotFound);
+    return rc;
+}
+
+rc_t KeyRingAddObject(KKeyRing* self, 
+                      const struct String* object_name, 
+                      const struct String* project_name, 
+                      const struct String* display_name, 
+                      uint64_t size, 
+                      const struct String* checksum)
+{
+    rc_t rc = 0;
+    const Project* p;
+    
+    assert(self && object_name && project_name && display_name && checksum);
+    
+    /*TODO: write-lock database */
+    p = KeyRingDataGetProject(self->data, project_name);
+    if (p != NULL)
+    {
+        rc = KeyRingDataAddObject(self->data, object_name, project_name, display_name, size, checksum, p->encryption_key);
+        if (rc == 0)
+            rc = CreateDatabase(self); 
+    }
+    else
+        rc = RC(rcApp, rcDatabase, rcSearching, rcName, rcNotFound);
+    /*TODO: unlock database */
+    
+    return rc;
+}                      
+                     
+rc_t KeyRingGetKey(KKeyRing* self, const struct String* object_name, struct String* encryption_key)
+{
+    rc_t rc = 0;
+    const Object* obj;
+
+    assert(self && object_name && encryption_key);
+    
+    obj = KeyRingDataGetObject(self->data, object_name);
+    if (obj != NULL)
+        StringInit(encryption_key, obj->encryption_key->addr, obj->encryption_key->len, obj->encryption_key->size);
+    else
+        rc = RC(rcApp, rcDatabase, rcSearching, rcName, rcNotFound);
+    return rc;
+}
diff --git a/tools/keyring-srv/keyring-srv.h b/tools/keyring-srv/keyring-srv.h
new file mode 100644
index 0000000..11dea86
--- /dev/null
+++ b/tools/keyring-srv/keyring-srv.h
@@ -0,0 +1,101 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+
+#ifndef _h_keyring_srv_
+#define _h_keyring_srv_
+
+#include <klib/rc.h>
+#include <klib/refcount.h>
+
+struct KFile;
+struct String;
+
+typedef struct KKeyRing KKeyRing;
+struct KKeyRing;
+
+#define KR_PWD_PROMPT_1 "Password:\n"
+#define KR_PWD_PROMPT_2 "Retype Password:\n"
+
+/* KeyRingOpen 
+ * kr - [ OUT ] the keyring object
+ * path - [ IN ] the POSIX path to the database file
+ * pwd_in - [ IN ] a file object to read database password from
+ * pwd_out - [ IN ] a file object to print password prompts to
+ *
+ * If the database file exists, will prompt to pwd_out for a password, read the password from pwd_in, and use the password to open the database
+ * If the database file does not exist, will prompt for a password twice and create the database if passwords match
+ *
+ * returns:
+ *  - database file exists, the supplied password is incorrect
+ *  - database file does not exist, passwords do not match
+ */
+extern rc_t KeyRingOpen(KKeyRing** kr, const char* path, const struct KFile* pwd_in, struct KFile* pwd_out); 
+
+/* KeyRingAddRef
+ */
+extern rc_t KeyRingAddRef(KKeyRing* kr);
+
+/* KeyRingRelease
+ */
+extern rc_t KeyRingRelease(KKeyRing* kr);
+
+/* KeyRingAddProject
+ * Saves the project with associated download ticket and encryption key. 
+ * If the project under this name already exists, the ticket/key will be overwritten as necessary.
+ * Will update the database file. May block/timeout if the file is locked.
+ */
+extern rc_t KeyRingAddProject(KKeyRing* kr, 
+                              const struct String* name, 
+                              const struct String* download_ticket, 
+                              const struct String* encryption_key);
+
+/* KeyRingGetProject
+ *  Retrieves a project's download ticket and encryption key by the project's name.
+ *  (TODO: Keys are returned as pointers into shared memory)
+ *  (TODO: Should it check if the database file needs to be reloaded?)
+ */
+extern rc_t KeyRingGetProject(KKeyRing* kr, const struct String* name, struct String* download_ticket, struct String* encryption_key);
+
+/* KeyRingAddObject
+ *  Saves an object in association with a project.
+ *  If the project under this name already exists, it will be overwritten as necessary.
+ *  Will update the database file. May block/timeout if the file is locked.
+ */
+extern rc_t KeyRingAddObject(KKeyRing* kr, 
+                             const struct String* object_name, 
+                             const struct String* project_name, 
+                             const struct String* display_name, 
+                             uint64_t size, 
+                             const struct String* checksum);
+
+/* KeyRingGetKey
+ *  Retrieves an encryption key associated with the given object.
+ *  (TODO: Keys are returned as pointers into shared memory)
+ *  (TODO: Should it check if the database file needs to be reloaded?)
+ */
+extern rc_t KeyRingGetKey(KKeyRing* kr, const struct String* object_name, struct String* encryption_key);
+                             
+#endif /* _h_keyring_srv_ */
diff --git a/tools/keyring-srv/keyring-srv.vers b/tools/keyring-srv/keyring-srv.vers
new file mode 100644
index 0000000..8e8299d
--- /dev/null
+++ b/tools/keyring-srv/keyring-srv.vers
@@ -0,0 +1 @@
+2.4.2
diff --git a/tools/kqsh/.gitignore b/tools/kqsh/.gitignore
new file mode 100644
index 0000000..e601f91
--- /dev/null
+++ b/tools/kqsh/.gitignore
@@ -0,0 +1,7 @@
+*.vers.h
+kqsh-kdb.c
+kqsh-kdb.h
+kqsh-vdb.c
+kqsh-vdb.h
+kqsh-sra.c
+kqsh-sra.h
diff --git a/tools/kqsh/Makefile b/tools/kqsh/Makefile
new file mode 100644
index 0000000..c580b9f
--- /dev/null
+++ b/tools/kqsh/Makefile
@@ -0,0 +1,221 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: std
+
+TOP ?= $(abspath ../..)
+MODULE = tools/kqsh
+
+include $(TOP)/build/Makefile.env
+
+INT_TOOLS =
+
+EXT_TOOLS = \
+	kqsh
+
+ALL_TOOLS = \
+	$(INT_TOOLS) \
+	$(EXT_TOOLS)
+
+#-------------------------------------------------------------------------------
+# outer targets
+#
+all std: vers-includes kqsh-thunks
+	@ $(MAKE_CMD) $(TARGDIR)/std
+
+$(ALL_TOOLS): vers-includes kqsh-thunks
+	@ $(MAKE_CMD) $(BINDIR)/$@
+
+.PHONY: all std $(ALL_TOOLS)
+
+#-------------------------------------------------------------------------------
+# std
+#
+$(TARGDIR)/std: \
+	$(addprefix $(BINDIR)/,$(ALL_TOOLS))
+
+.PHONY: $(TARGDIR)/std
+
+#-------------------------------------------------------------------------------
+# vers-includes
+#
+$(TARGDIR)/vers-includes: $(addsuffix .vers.h,$(EXT_TOOLS))
+
+.PHONY: $(TARGDIR)/vers-includes
+
+#-------------------------------------------------------------------------------
+# clean
+#
+clean: stdclean
+	@ rm -f $(SRCDIR)/kqsh-[kv]db.[ch]
+
+.PHONY: clean
+
+#-------------------------------------------------------------------------------
+# kqsh-thunks
+#
+KDB_THUNK_SRC = \
+	manager.h \
+	database.h \
+	table.h \
+	column.h \
+	index.h \
+	meta.h \
+	namelist.h
+
+KDB_THUNK_INCS = \
+	$(addprefix kdb/,$(KDB_THUNK_SRC))
+
+KDB_THUNK_DEPS = \
+	$(addprefix $(ITF)/,$(KDB_THUNK_INCS)) \
+	kqsh-thunk.pl \
+	Makefile
+
+KDB_THUNK_OBJ = \
+	:KDBManager=mgr \
+	:KDatabase=db \
+	:KTable=tbl \
+	:KColumn=col \
+	:KColumnBlob=blob \
+	:KIndex=idx \
+	:KMetadata=meta \
+	:KMDataNode=node
+
+kqsh-kdb.c: $(KDB_THUNK_DEPS)
+	perl kqsh-thunk.pl -mkdb -I$(ITF) $(addprefix -i,$(KDB_THUNK_INCS)) \
+	  $(KDB_THUNK_OBJ) -h kqsh-kdb.h -c $@ || rm $@
+
+kqsh-kdb.h: kqsh-kdb.c
+
+VDB_THUNK_SRC = \
+	manager.h \
+	database.h \
+	schema.h \
+	table.h \
+	cursor.h
+
+VDB_THUNK_INCS = \
+	$(addprefix vdb/,$(VDB_THUNK_SRC))
+
+VDB_THUNK_DEPS = \
+	$(addprefix $(ITF)/,$(VDB_THUNK_INCS)) \
+	kqsh-thunk.pl \
+	Makefile
+
+VDB_THUNK_OBJ = \
+	:VDBManager=mgr \
+	VSchemaRuntimeTable=srtt \
+	VSchema=schema \
+	VTypedecl=td \
+	VTypedesc=tdesc \
+	:VDatabase=db \
+	:VTable=tbl \
+	:VCursor=curs
+
+kqsh-vdb.c: $(VDB_THUNK_DEPS)
+	perl kqsh-thunk.pl -mvdb -I$(ITF) $(addprefix -i,$(VDB_THUNK_INCS)) \
+	  $(VDB_THUNK_OBJ) -h kqsh-vdb.h -c $@ || rm $@
+
+kqsh-vdb.h: kqsh-vdb.c
+
+SRA_THUNK_SRC = \
+	sradb.h \
+	wsradb.h \
+	sraschema.h
+
+SRA_THUNK_INCS = \
+	$(addprefix sra/,$(SRA_THUNK_SRC))
+
+SRA_THUNK_DEPS = \
+	$(addprefix $(ITF)/,$(SRA_THUNK_INCS)) \
+	kqsh-thunk.pl \
+	Makefile
+
+SRA_THUNK_OBJ = \
+	:SRAMgr=mgr \
+	SRANamelist=nmlist \
+	:SRATable=tbl \
+	SRAColumn=col \
+	VDBManager=vmgr
+
+kqsh-sra.c: $(SRA_THUNK_DEPS)
+	perl kqsh-thunk.pl -msra -I$(ITF) $(addprefix -i,$(SRA_THUNK_INCS)) \
+	  $(SRA_THUNK_OBJ) -h kqsh-sra.h -c $@ || rm $@
+
+kqsh-sra.h: kqsh-sra.c
+
+kqsh-thunks: kqsh-kdb.h kqsh-vdb.h kqsh-sra.h
+
+#-------------------------------------------------------------------------------
+# kqsh-load
+#  special rules to tell kqsh how to load libraries
+#
+
+#KQSH_LIBNAMES = \
+	-DLIBKDB=$(LPFX)kdb.$(SHLX) \
+	-DLIBWKDB=$(LPFX)wkdb.$(SHLX) \
+	-DLIBVDB=$(LPFX)vdb.$(SHLX) \
+	-DLIBWVDB=$(LPFX)wvdb.$(SHLX) \
+	-DLIBSRADB=$(LPFX)sradb.$(SHLX) \
+	-DLIBWSRADB=$(LPFX)wsradb.$(SHLX)
+
+KQSH_LIBNAMES = \
+	-DLIBNCBI_VDB=$(LPFX)ncbi-vdb.$(SHLX) \
+	-DLIBNCBI_WVDB=$(LPFX)ncbi-wvdb.$(SHLX)
+
+kqsh-load.$(OBJX): $(SRCDIR)/kqsh-load.c
+	$(CC) -o $@ $(OPT) $(KQSH_LIBNAMES) -D_LOGGING $<
+
+
+#-------------------------------------------------------------------------------
+# kqsh - query shell
+#
+KQSH_SRC = \
+	kqsh-print \
+	kqsh-tok \
+	kqsh-parse \
+	kqsh-alter \
+	kqsh-close \
+	kqsh-help \
+	kqsh-load \
+	kqsh-open \
+	kqsh-create \
+	kqsh-show \
+	kqsh-write \
+	kqsh-kdb \
+	kqsh-vdb \
+	kqsh-sra \
+	kqsh
+
+KQSH_OBJ = \
+	$(addsuffix .$(OBJX),$(KQSH_SRC))
+
+KQSH_LIB = \
+	-skapp \
+	-sncbi-vdb \
+
+
+$(BINDIR)/kqsh: $(KQSH_OBJ)
+	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(KQSH_LIB)
diff --git a/tools/kqsh/kqsh-alter.c b/tools/kqsh/kqsh-alter.c
new file mode 100644
index 0000000..3df5743
--- /dev/null
+++ b/tools/kqsh/kqsh-alter.c
@@ -0,0 +1,347 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "kqsh-priv.h"
+#include "kqsh-tok.h"
+#include "kqsh-kdb.h"
+#include "kqsh-vdb.h"
+
+#include <klib/symbol.h>
+#include <klib/symtab.h>
+#include <klib/token.h>
+
+#include <klib/log.h>
+#include <klib/rc.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+
+/* alter cursor
+ *  'alter <cursor> add column [ ( <typedecl> ) ] NAME;'
+ *
+ *  all data after the 'column' keyword are gathered into
+ *  ( typedecl, name ) pairs. we are going to allow comma
+ *  separation, but otherwise just gather everything up to
+ *  the semi-colon.
+ */
+static
+rc_t kqsh_alter_cursor_add_column ( KSymTable *tbl, KTokenSource *src, KToken *t, KSymbol *cursor )
+{
+    rc_t rc;
+
+    do
+    {
+        size_t i;
+        uint32_t idx;
+        char coldecl [ 256 ];
+
+        for ( i = 0; i < sizeof coldecl - 1; )
+        {
+            /* end of column */
+            if ( t -> id == eSemiColon || t -> id == eComma )
+                break;
+
+            /* accumulate */
+            i += string_copy ( & coldecl [ i ],
+                sizeof coldecl - i, t -> str . addr, t -> str . size );
+
+            next_token ( tbl, src, t );
+        }
+
+        /* the name needs to fit in our buffer */
+        if ( i == sizeof coldecl - 1 )
+        {
+            rc = RC ( rcExe, rcCursor, rcUpdating, rcName, rcExcessive );
+            if ( interactive )
+            {
+                kqsh_printf ( "this is really hard to believe, but you managed to request\n"
+                              "a column with a %u byte expression. please stop trying to abuse me.\n",
+                              ( unsigned int ) i );
+            }
+            else
+            {
+                LOGERR ( klogErr, rc, "failed to add column to cursor" );
+            }
+            return rc;
+        }
+
+        /* perform the task */
+        rc = _VCursorAddColumn ( cursor -> u . obj, & idx, coldecl );
+        if ( rc != 0 )
+        {
+            PLOGERR ( klogErr,  (klogErr, rc, "cannot add column '$(expr)' to cursor '$(curs)'",
+                      "expr=%s,curs=%.*s"
+                      , coldecl
+                                 , ( int ) cursor -> name . size, cursor -> name . addr));
+        }
+
+        else if ( interactive )
+        {
+            kqsh_printf ( "added column '%s' ( idx %u ) to cursor '%N' ( %p )\n"
+                          , coldecl
+                          , idx
+                          , cursor
+                          , cursor -> u . obj
+                );
+        }
+    }
+    while ( t -> id == eComma );
+
+    if ( t -> id != eSemiColon )
+        return expected ( t, klogErr, ";" );
+
+    return 0;
+}
+
+static
+rc_t kqsh_alter_cursor_add ( KSymTable *tbl, KTokenSource *src, KToken *t, KSymbol *cursor )
+{
+    switch ( t -> id )
+    {
+    case kw_column:
+        return kqsh_alter_cursor_add_column ( tbl, src, next_token ( tbl, src, t ), cursor );
+    }
+
+    return expected ( t, klogErr, "column" );
+}
+
+static
+rc_t kqsh_alter_cursor ( KSymTable *tbl, KTokenSource *src, KToken *t, KSymbol *cursor )
+{
+    switch ( t -> id )
+    {
+    case kw_add:
+        return kqsh_alter_cursor_add ( tbl, src, next_token ( tbl, src, t ), cursor );
+    }
+
+    return expected ( t, klogErr, "add" );
+}
+
+/* alter schema add path
+ *  'alter <schema> add include [ path ] STRING'
+ *  'alter <schema> add path STRING'
+ */
+static
+rc_t kqsh_alter_schema_add_path ( KSymTable *tbl, KTokenSource *src, KToken *t, KSymbol *sym )
+{
+    rc_t rc;
+    String path;
+    struct VSchema *schema = ( void* ) sym -> u . obj;
+
+    switch ( t -> id )
+    {
+    case eString:
+    case eEscapedString:
+        path = t -> str;
+        path . addr += 1;
+        path . size -= 2;
+        break;
+
+    case eUntermString:
+    case eUntermEscapedString:
+        CONST_STRING ( & t -> str, "<unterminated string>" );
+    default:
+        return expected ( t, klogErr, "path string" );
+    }
+
+    /* consume semi-colon */
+    if ( next_token ( tbl, src, t ) -> id != eSemiColon )
+        return expected ( t, klogErr, ";" );
+
+    rc = _VSchemaAddIncludePath ( schema, "%.*s", ( int ) path . size, path . addr );
+    if ( rc != 0 )
+    {
+        PLOGERR ( klogErr,  (klogErr, rc, "cannot add search path '$(path)' to schema '$(name)'",
+                  "path=%.*s,name=%.*s"
+                  , ( int ) path . size, path . addr
+                             , ( int ) sym -> name . size, sym -> name . addr));
+    }
+    else if ( interactive )
+    {
+        kqsh_printf ( "added search path '%S' to schema '%N' ( %p )\n",
+                      & path, sym, schema );
+    }
+
+    return rc;
+}
+
+/* alter schema add text
+ *  'alter <schema> add text STRING'
+ */
+static
+rc_t kqsh_alter_schema_add_text ( KSymTable *tbl, KTokenSource *src, KToken *t, KSymbol *sym )
+{
+    rc_t rc;
+    String text;
+    struct VSchema *schema = ( void* ) sym -> u . obj;
+
+    switch ( t -> id )
+    {
+    case eString:
+    case eEscapedString:
+        text = t -> str;
+        text . addr += 1;
+        text . size -= 2;
+        break;
+
+    case eUntermString:
+    case eUntermEscapedString:
+        CONST_STRING ( & t -> str, "<unterminated string>" );
+    default:
+        return expected ( t, klogErr, "schema text string" );
+    }
+
+    /* consume semi-colon */
+    if ( next_token ( tbl, src, t ) -> id != eSemiColon )
+        return expected ( t, klogErr, ";" );
+
+    /* parse text */
+    rc = _VSchemaParseText ( schema, "kqsh-console", text . addr, text . size );
+    if ( rc != 0 )
+    {
+        PLOGERR ( klogErr,  (klogErr, rc, "cannot add text into schema '$(name)'",
+                             "name=%.*s", ( int ) sym -> name . size, sym -> name . addr));
+    }
+    else if ( interactive )
+    {
+        kqsh_printf ( "added text to schema '%N' ( %p )\n", sym, schema );
+    }
+
+    return rc;
+}
+
+/* alter schema add
+ */
+static
+rc_t kqsh_alter_schema_add ( KSymTable *tbl, KTokenSource *src, KToken *t, KSymbol *schema )
+{
+    switch ( t -> id )
+    {
+    case kw_include:
+        if ( next_token ( tbl, src, t ) -> id == kw_path )
+    case kw_path:
+            next_token ( tbl, src, t );
+        return kqsh_alter_schema_add_path ( tbl, src, t, schema );
+    case kw_text:
+        return kqsh_alter_schema_add_text ( tbl, src, next_token ( tbl, src, t ), schema );
+    }
+
+    return expected ( t, klogErr, "include, path or text" );
+}
+
+
+/* alter schema load
+ *  'alter <schema> load STRING'
+ */
+static
+rc_t kqsh_alter_schema_load ( KSymTable *tbl, KTokenSource *src, KToken *t, KSymbol *sym )
+{
+    rc_t rc;
+    String path;
+    struct VSchema *schema = ( void* ) sym -> u . obj;
+
+    switch ( t -> id )
+    {
+    case eString:
+    case eEscapedString:
+        path = t -> str;
+        path . addr += 1;
+        path . size -= 2;
+        break;
+
+    case eUntermString:
+    case eUntermEscapedString:
+        CONST_STRING ( & t -> str, "<unterminated string>" );
+    default:
+        return expected ( t, klogErr, "path string" );
+    }
+
+    /* consume semi-colon */
+    if ( next_token ( tbl, src, t ) -> id != eSemiColon )
+        return expected ( t, klogErr, ";" );
+
+    rc = _VSchemaParseFile ( schema, "%.*s", ( int ) path . size, path . addr );
+    if ( rc != 0 )
+    {
+        PLOGERR ( klogErr,  (klogErr, rc, "cannot load file '$(path)' into schema '$(name)'",
+                  "path=%.*s,name=%.*s"
+                  , ( int ) path . size, path . addr
+                             , ( int ) sym -> name . size, sym -> name . addr));
+    }
+    else if ( interactive )
+    {
+        kqsh_printf ( "loaded file '%S' into schema '%N' ( %p )\n",
+                      & path, sym, schema );
+    }
+
+    return rc;
+}
+
+/* alter schema
+ */
+static
+rc_t kqsh_alter_schema ( KSymTable *tbl, KTokenSource *src, KToken *t, KSymbol *schema )
+{
+    switch ( t -> id )
+    {
+    case kw_add:
+        return kqsh_alter_schema_add ( tbl, src, next_token ( tbl, src, t ), schema );
+    case kw_load:
+        return kqsh_alter_schema_load ( tbl, src, next_token ( tbl, src, t ), schema );
+    }
+
+    return expected ( t, klogErr, "add or load" );
+}
+
+
+/* alter
+ */
+rc_t kqsh_alter ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    KSymbol *sym = t -> sym;
+
+    switch ( t -> id )
+    {
+    case kw_cursor:
+        if ( next_token ( tbl, src, t ) -> id != obj_VCursor )
+            break;
+        sym = t -> sym;
+    case obj_VCursor:
+        return kqsh_alter_cursor ( tbl, src, next_token ( tbl, src, t ), sym );
+
+    case kw_schema:
+        if ( next_token ( tbl, src, t ) -> id != obj_VSchema )
+            break;
+        sym = t -> sym;
+    case obj_VSchema:
+        return kqsh_alter_schema ( tbl, src, next_token ( tbl, src, t ), sym );
+    }
+
+    return expected ( t, klogErr, "cursor or schema" );
+}
diff --git a/tools/kqsh/kqsh-close.c b/tools/kqsh/kqsh-close.c
new file mode 100644
index 0000000..244a407
--- /dev/null
+++ b/tools/kqsh/kqsh-close.c
@@ -0,0 +1,186 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "kqsh-priv.h"
+#include "kqsh-tok.h"
+#include "kqsh-kdb.h"
+#include "kqsh-vdb.h"
+#include "kqsh-sra.h"
+
+#include <klib/container.h>
+#include <klib/symbol.h>
+#include <klib/symtab.h>
+#include <klib/token.h>
+
+#include <klib/log.h>
+#include <klib/rc.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+/* close row
+ */
+static
+rc_t kqsh_close_row ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    rc_t rc = 0;
+    KSymbol *curs;
+
+    /* accept optional "on" keyword */
+    if ( next_token ( tbl, src, t ) -> id == kw_on )
+        next_token ( tbl, src, t );
+
+    /* expect cursor object */
+    switch ( t -> id )
+    {
+    case obj_VCursor:
+        curs = t -> sym;
+        break;
+    default:
+        return expected ( t, klogErr, "cursor" );
+    }
+
+    if ( next_token ( tbl, src, t ) -> id != eSemiColon )
+        return expected ( t, klogErr, ";" );
+
+    switch ( curs -> type )
+    {
+    case obj_VCursor:
+        rc = _VCursorCloseRow ( curs -> u . obj );
+        break;
+    }
+
+    if ( rc != 0 )
+    {
+        PLOGERR ( klogInt,  (klogInt, rc,
+                  "failed to close row on cursor '$(name)' ( $(addr) )"
+                  , "name=%.*s,addr=0x%zX"
+                  , ( int ) curs -> name . size, curs -> name . addr
+                  , ( size_t ) curs -> u . obj ));
+    }
+    else if ( interactive )
+    {
+        kqsh_printf ( "closed row on cursor '%N' ( %p )\n"
+                      , curs, curs -> u . obj );
+    }
+
+    return rc;
+}
+
+
+/* whackobj
+ *  whacks created/opened objects
+ */
+void CC kqsh_whackobj ( BSTNode *n, void *ignore )
+{
+    KSymbol *sym = ( KSymbol* ) n;
+
+    switch ( sym -> type )
+    {
+    case obj_KDBManager:
+        _KDBManagerRelease ( sym -> u . obj );
+        break;
+    case obj_VDBManager:
+        _VDBManagerRelease ( sym -> u . obj );
+        break;
+    case obj_SRAManager:
+        _SRAMgrRelease ( sym -> u . obj );
+        break;
+    case obj_VSchema:
+        _VSchemaRelease ( sym -> u . obj );
+        break;
+
+    case obj_KTable:
+        _KTableRelease ( sym -> u . obj );
+        break;
+    case obj_VTable:
+        _VTableRelease ( sym -> u . obj );
+        break;
+
+    case obj_VCursor:
+        _VCursorRelease ( sym -> u . obj );
+        break;
+    }
+
+    KSymbolWhack ( & sym -> n, ignore );
+}
+
+/* close
+ */
+rc_t kqsh_close ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    KSymbol *sym;
+
+    /* handle close row */
+    if ( t -> id == kw_row )
+        return kqsh_close_row ( tbl, src, t );
+
+    /* expect normal object */
+    sym = t -> sym;
+
+    if ( sym == NULL || t -> id < rsrv_first )
+        return expected ( t, klogErr, "object id" );
+
+    if ( next_token ( tbl, src, t ) -> id != eSemiColon )
+        return expected ( t, klogErr, ";" );
+
+    if ( sym -> type >= obj_first )
+    {
+        if ( interactive )
+        {
+            const char *type;
+            switch ( sym -> type )
+            {
+            case obj_KDBManager:
+                type = "kdb manager"; break;
+            case obj_VDBManager:
+                type = "vdb manager"; break;
+            case obj_VSchema:
+                type = "schema"; break;
+            case obj_KTable:
+            case obj_VTable:
+                type = "table"; break;
+            case obj_VCursor:
+                type = "cursor"; break;
+            default:
+                type = "object";
+            }
+
+            kqsh_printf ( "closing %s '%N' ( %p )\n", type, sym, sym -> u . obj );
+        }
+
+        KSymTableRemoveSymbol ( tbl, sym );
+        kqsh_whackobj ( & sym -> n, NULL );
+    }
+    else if ( interactive )
+    {
+        kqsh_printf ( "reserved object '%N' is not open\n", sym );
+    }
+
+    return 0;
+}
diff --git a/tools/kqsh/kqsh-create.c b/tools/kqsh/kqsh-create.c
new file mode 100644
index 0000000..290b02e
--- /dev/null
+++ b/tools/kqsh/kqsh-create.c
@@ -0,0 +1,680 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "kqsh-priv.h"
+#include "kqsh-tok.h"
+#include "kqsh-kdb.h"
+#include "kqsh-vdb.h"
+#include "kqsh-sra.h"
+
+#include <klib/symbol.h>
+#include <klib/symtab.h>
+#include <klib/token.h>
+
+#include <klib/log.h>
+#include <klib/rc.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+
+/* create cursor
+ *
+ *  'create cursor ID on TBL [ for update ];'
+ */
+static
+rc_t kqsh_create_cursor ( KSymTable *tbl, KTokenSource *src, KToken *t, uint32_t mode )
+{
+    rc_t rc = 0;
+
+    void *obj;
+    String name;
+    bool for_write;
+    uint32_t obj_type;
+    KSymbol *using, *existing;
+
+    /* looking for a cursor name */
+    switch ( t -> id )
+    {
+    case eIdent:
+    case obj_VCursor:
+        name = t -> str;
+        existing = t -> sym;
+        break;
+    default:
+        return expected ( t, klogErr, "cursor name" );
+    }
+
+    /* get table */
+    if ( next_token ( tbl, src, t ) -> id != kw_on )
+        return expected ( t, klogErr, "on");
+
+    switch ( next_token ( tbl, src, t ) -> id )
+    {
+    case obj_VTable:
+        obj_type = obj_VCursor;
+        using = t -> sym;
+        break;
+    default:
+        return expected ( t, klogErr, "cursor capable table" );
+    }
+
+    /* look for update flag */
+    for_write = false;
+    if ( next_token ( tbl, src, t ) -> id == kw_for )
+    {
+        if ( next_token ( tbl, src, t ) -> id != kw_update )
+            return expected ( t, klogErr, "update" );
+        if ( read_only )
+        {
+            rc = RC ( rcExe, rcTable, rcOpening, rcMgr, rcReadonly );
+            if ( interactive )
+            {
+                kqsh_printf ( "you are executing in read-only mode.\n"
+                              "cannot create cursor for write.\n"
+                              "you can relaunch kqsh with the '-u' option to enable updates.\n"
+                    );
+            }
+            else
+            {
+                PLOGERR ( klogErr,  (klogErr, rc, "failed to create cursor '$(name)'",
+                                     "name=%.*s", ( int ) name . size, name . addr ));
+            }
+            return rc;
+        }
+
+        for_write = true;
+        next_token ( tbl, src, t );
+    }
+
+    /* now we're done parsing */
+    if ( t -> id != eSemiColon )
+        return expected ( t, klogErr, ";" );
+
+    if ( existing != NULL ) switch ( mode )
+    {
+    case kcmOpen:
+        if ( interactive )
+        {
+            kqsh_printf ( "opened cursor '%N' ( %p )\n"
+                          , existing, existing -> u . obj );
+        }
+        return 0;
+    case kcmInit:
+        kqsh_whackobj ( & existing -> n, NULL );
+        break;
+    case kcmCreate:
+        rc = RC ( rcExe, rcTable, rcOpening, rcCursor, rcExists );
+        if ( interactive )
+            kqsh_printf ( "cursor '%N' already exists.\n", existing );
+        else
+        {
+            PLOGERR ( klogErr,  (klogErr, rc, "cursor '$(name)' could not be created",
+                                 "name=%.*s", ( int ) existing -> name . size, existing -> name . addr ));
+        }
+        return rc;
+    }
+
+    /* create the cursor */
+    switch ( using -> type )
+    {
+    case obj_VTable:
+        rc = for_write ?
+            _VTableCreateCursorWrite ( ( void* ) using -> u . obj, ( VCursor** ) & obj, kcmInsert ):
+            _VTableCreateCursorRead ( using -> u . obj, ( const VCursor** ) & obj );
+        break;
+    }
+
+    if ( rc == 0 )
+    {
+        KSymbol *sym;
+
+        /* create symbol */
+        rc = KSymTableCreateSymbol ( tbl, & sym, & name, obj_type, obj );
+        if ( rc == 0 )
+        {
+            if ( interactive )
+            {
+                kqsh_printf ( "created cursor '%N' ( %p )\n"
+                              , sym, sym -> u . obj );
+            }
+            return 0;
+        }
+
+        /* whack instance */
+        switch ( obj_type )
+        {
+        case obj_VCursor:
+            _VCursorRelease ( obj );
+            break;
+        }
+    }
+
+    PLOGERR ( klogInt,  (klogInt, rc,
+              "failed to create cursor '$(name)' on $(targ)"
+              , "name=%.*s,targ=%.*s"
+              , ( int ) name . size, name . addr
+                         , ( int ) using -> name . size, using -> name . addr ));
+
+    return rc;
+}
+
+/* create table
+ *
+ *  'create table PATH [ as ID ] [ with schema ID[.ID] ] [ using ID ];'
+ */
+static
+rc_t kqsh_create_table ( KSymTable *tbl, KTokenSource *src, KToken *t, uint32_t mode )
+{
+    rc_t rc = 0;
+    /* bool have_as; */
+    String path, name;
+
+    KSymbol *schema;
+    String schema_tbl;
+    char schema_tbl_str [ 256 ];
+
+    KSymbol *using, *existing;
+
+    void *obj;
+    uint32_t obj_type = 0;
+
+    /* looking for a table path */
+    if ( t -> id != eString )
+        return expected ( t, klogErr, "table path string or name string" );
+    StringSubstr ( & t -> str, & path, 1, t -> str . len - 2 );
+
+    /* look for kqsh object id */
+    if ( next_token ( tbl, src, t ) -> id != kw_as )
+    {
+        /* not renamed - take path leaf as kqsh variable name */
+        const char *slash = string_rchr ( path . addr, path . size, '/' );
+        if ( slash ++ == NULL )
+            name = path;
+        else
+        {
+            size_t size = path . size - ( slash - path . addr );
+            StringInit ( & name, slash, size, string_len ( slash, size ) );
+        }
+
+        existing = KSymTableFind ( tbl, & name );
+        /* have_as = false; */
+    }
+
+    /* require a name of some sort, allow redefine for the moment */
+    else if ( next_token ( tbl, src, t ) -> id != eIdent && t -> sym == NULL )
+        return expected ( t, klogErr, "table id" );
+    else
+    {
+        name = t -> str;
+        existing = t -> sym;
+        next_token ( tbl, src, t );
+        /* have_as = true; */
+    }
+
+    /* check to see if name is in use */
+    if ( existing != NULL )
+    {
+        KMetadata *meta;
+
+        /* use a kludgy test for being open for update */
+        switch ( existing -> type )
+        {
+        case obj_KTable:
+            rc = _KTableOpenMetadataUpdate ( ( void* ) existing -> u . obj, & meta );
+            break;
+        case obj_VTable:
+            rc = _VTableOpenMetadataUpdate ( ( void* ) existing -> u . obj, & meta );
+            break;
+        default:
+            return expected ( t, klogErr, "table id" );
+        }
+
+        _KMetadataRelease ( meta );
+        if ( rc != 0 )
+        {
+            /* table is open, but is ( most likely ) read-only */
+            if ( interactive )
+                kqsh_printf ( "table '%N' is currently open for read", existing );
+            else
+            {
+                rc = RC ( rcExe, rcTable, rcCreating, rcTable, rcBusy );
+                PLOGERR ( klogErr,  (klogErr, rc, "cannot create table '$(name)'", "name=%.*s"
+                                     , ( int ) name . size, name . addr ));
+                return rc;
+            }
+        }
+    }
+
+    /* look for schema spec */
+    schema = NULL;
+    CONST_STRING ( & schema_tbl, "" );
+    if ( t -> id == kw_with )
+    {
+        /* should see keyword 'schema' */
+        if ( next_token ( tbl, src, t ) -> id == kw_schema )
+            next_token ( tbl, src, t );
+
+        /* accept any id, but look for schema object */
+        if ( t -> id == obj_VSchema )
+        {
+            schema = t -> sym;
+            if ( next_token ( tbl, src, t ) -> id == ePeriod )
+            {
+                if ( next_token ( tbl, src, t ) -> id != eIdent && t -> sym == NULL )
+                    return expected ( t, klogErr, "schema table id" );
+                schema_tbl = t -> str;
+                next_token ( tbl, src, t );
+            }
+        }
+        else if ( t -> id != eIdent && t -> sym == NULL )
+            return expected ( t, klogErr, "schema table id" );
+        else
+        {
+            schema_tbl = t -> str;
+            next_token ( tbl, src, t );
+        }
+    }
+
+    /* look for 'using' clause' */
+    using = NULL;
+    if ( t -> id == kw_using )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case obj_KDBManager:
+            /* if table exists but is not a KTable, it's an error */
+            if ( existing != NULL ) switch ( existing -> type )
+            {
+            case obj_KTable:
+                break;
+            case obj_VTable:
+                return expected ( t, klogErr, "vdb manager or database" );
+            }
+            /* both schema and tbl name require vdb+ manager */
+            if ( schema != NULL && schema_tbl . len != 0 )
+                return expected ( t, klogErr, "schema capable manager" );
+            /* schema alone could be mgr with default name
+               or db where table name collides with kqsh id */
+            if ( schema != NULL )
+                return expected ( t, klogErr, "schema capable manager or database" );
+            /* no schema but tbl name requires database */
+            if ( schema_tbl . len != 0 )
+                return expected ( t, klogErr, "schema capable database" );
+
+            /* this is the target object */
+            using = t -> sym;
+            break;
+
+        case obj_VDBManager:
+            /* if table exists but is not a VTable, it's an error */
+            if ( existing != NULL ) switch ( existing -> type )
+            {
+            case obj_KTable:
+                return expected ( t, klogErr, "kdb manager or database" );
+            case obj_VTable:
+                break;
+            }
+            /* neither schema nor tbl requires kdb mgr or db */
+            if ( schema == NULL && schema_tbl . len == 0 )
+                return expected ( t, klogErr, "kdb manager or database" );
+            /* table name alone requires vdb+ database */
+            if ( schema == NULL )
+                return expected ( t, klogErr, "schema capable database" );
+
+            /* schema alone implies default table
+               schema plus table name is standard */
+            using = t -> sym;
+            break;
+
+#if 0
+        case obj_VDatabase:
+            /* if table exists but is not a VTable, it's an error */
+            if ( existing != NULL ) switch ( existing -> type )
+            {
+            case obj_KTable:
+                return expected ( t, klogErr, "kdb manager or database" );
+            case obj_VTable:
+                break;
+            }
+            /* neither schema nor tbl requires kdb mgr or db */
+            if ( schema == NULL && schema_tbl . len == 0 )
+                return expected ( t, klogErr, "kdb manager or database" );
+            /* schema alone is reinterpreted as table name */
+            if ( schema_tbl . len == 0 )
+            {
+                schema_tbl = schema -> name;
+                schema = NULL;
+            }
+            /* schema plus table name requires vdb+ manager */
+            else if ( schema != NULL )
+                return expected ( t, klogErr, "schema capable manager" );
+
+            /* database with no schema but table name */
+            using = t -> sym;
+            break;
+#endif
+        default:
+            if ( schema == NULL )
+            {
+                return expected ( t, klogErr, ( schema_tbl . len == 0 ) ?
+                    "kdb manager or database" : "schema capable database" );
+            }
+
+            return expected ( t, klogErr, ( schema_tbl . len == 0 ) ?
+                "schema capable manager or database" : "schema capable manager" );
+        }
+
+        next_token ( tbl, src, t );
+    }
+
+    /* expect target object */
+    if ( using == NULL )
+    {
+        if ( schema == NULL )
+        {
+            return expected ( t, klogErr, ( schema_tbl . len == 0 ) ?
+                "kdb manager or database" : "schema capable database" );
+        }
+
+        return expected ( t, klogErr, ( schema_tbl . len == 0 ) ?
+            "schema capable manager or database" : "schema capable manager" );
+    }
+
+    /* close off statement */
+    if ( t -> id != eSemiColon )
+        return expected ( t, klogErr, ";" );
+
+    /* if in read-only mode, this whole thing will fail */
+    if ( read_only )
+    {
+        rc = RC ( rcExe, rcTable, rcOpening, rcMgr, rcReadonly );
+        if ( interactive )
+        {
+            kqsh_printf ( "you are executing in read-only mode.\n"
+                          "table creation is not supported.\n"
+                          "you can relaunch kqsh with the '-u' option to enable updates.\n"
+                );
+        }
+        else
+        {
+            PLOGERR ( klogErr,  (klogErr, rc, "failed to create table '$(path)' as '$(name)'",
+                      "path=%.*s,name=%.*s"
+                      , ( int ) path . size, path . addr
+                                 , ( int ) name . size, name . addr ));
+        }
+        return rc;
+    }
+
+    /* prepare schema table string */
+    if ( schema_tbl . size >= sizeof schema_tbl_str )
+    {
+        rc = RC ( rcExe, rcTable, rcCreating, rcString, rcExcessive );
+        PLOGERR ( klogErr,  (klogErr, rc, "schema name length = $(len)", "len=%zu", schema_tbl . size ));
+        return rc;
+    }
+    string_copy ( schema_tbl_str, sizeof schema_tbl_str,
+                  schema_tbl . addr, schema_tbl . size );
+
+
+    /* handle existing table */
+    if ( existing != NULL )  switch ( mode )
+    {
+    case kcmOpen:
+        if ( interactive )
+        {
+            kqsh_printf ( "opened table '%N' ( %p )\n"
+                          , existing, existing -> u . obj );
+        }
+        return 0;
+    case kcmInit:
+        kqsh_whackobj ( & existing -> n, NULL );
+        break;
+    case kcmCreate:
+        rc = RC ( rcExe, rcTable, rcCreating, rcTable, rcExists );
+        if ( interactive )
+            kqsh_printf ( "table '%N' is already open", existing );
+        else
+        {
+            PLOGERR ( klogErr,  (klogErr, rc, "table '$(name)' could not be created",
+                                 "name=%.*s", ( int ) existing -> name . size, existing -> name . addr ));
+        }
+        return rc;
+    }
+
+    /* dispatch */
+    switch ( using -> type )
+    {
+    case obj_KDBManager:
+        obj_type = obj_KTable;
+        rc = _KDBManagerCreateTable ( ( void* ) using -> u . obj, ( KTable** ) & obj,
+            mode | kcmParents,"%.*s", ( int ) path . size, path . addr );
+        break;
+    case obj_VDBManager:
+        obj_type = obj_VTable;
+        assert ( schema != NULL );
+        rc = _VDBManagerCreateTable ( ( void* ) using -> u . obj, ( VTable** ) & obj,
+            schema -> u . obj, schema_tbl_str [ 0 ] ? schema_tbl_str : NULL,
+            mode | kcmParents,"%.*s", ( int ) path . size, path . addr );
+        break;
+    }
+
+    if ( rc == 0 )
+    {
+        KSymbol *sym;
+
+        /* create symbol */
+        rc = KSymTableCreateSymbol ( tbl, & sym, & name, obj_type, obj );
+        if ( rc == 0 )
+        {
+            if ( interactive )
+            {
+                kqsh_printf ( "created table '%N' ( %p )\n"
+                              , sym, sym -> u . obj );
+            }
+            return 0;
+        }
+
+        /* whack instance */
+        switch ( obj_type )
+        {
+        case obj_KTable:
+            _KTableRelease ( obj );
+            break;
+        case obj_VTable:
+            _VTableRelease ( obj );
+            break;
+        }
+    }
+
+    PLOGERR ( klogInt,  (klogInt, rc,
+              "failed to create table '$(name)' using $(targ)"
+              , "name=%.*s,targ=%.*s"
+              , ( int ) name . size, name . addr
+                         , ( int ) using -> name . size, using -> name . addr ));
+
+    return rc;
+}
+
+
+/* create schema
+ *
+ *  'create schema [ as ] ID [ using MGR ];'
+ */
+static
+rc_t kqsh_create_schema ( KSymTable *tbl, KTokenSource *src, KToken *t, uint32_t mode )
+{
+    rc_t rc = 0;
+    String name;
+    KSymbol *existing;
+    const KSymbol *mgr;
+    struct VSchema *schema;
+
+    /* shouldn't be here, but don't choke on it */
+    if ( t -> id == kw_as )
+        next_token ( tbl, src, t );
+
+    /* get schema object name */
+    switch ( t -> id )
+    {
+    case eIdent:
+    case obj_VSchema:
+        name = t -> str;
+        existing = t -> sym;
+        break;
+    default:
+        return expected ( t, klogErr, "schema name" );
+    }
+
+    /* there is no implicit mgr yet */
+    mgr = NULL;
+
+    /* get using clause */
+    if ( next_token ( tbl, src, t ) -> id == kw_using )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case obj_VDBManager:
+        case obj_SRAManager:
+            mgr = t -> sym;
+            break;
+        default:
+            return expected ( t, klogErr, "open vdb or sra manager" );
+        }
+
+        next_token ( tbl, src, t );
+    }
+    else if ( mgr == NULL )
+    {
+        return expected ( t, klogErr, "using" );
+    }
+
+    /* expect ';' */
+    if ( t -> id != eSemiColon )
+        return expected ( t, klogErr, ";" );
+
+    /* if the schema already exists, then look at mode */
+    if ( existing != NULL ) switch ( mode )
+    {
+    case kcmOpen:
+        if ( interactive )
+        {
+            kqsh_printf ( "opened schema '%N' ( %p )\n"
+                          , existing, existing -> u . obj );
+        }
+        return 0;
+    case kcmInit:
+        kqsh_whackobj ( & existing -> n, NULL );
+        break;
+    case kcmCreate:
+        rc = RC ( rcExe, rcSchema, rcCreating, rcSchema, rcExists );
+        if ( interactive )
+            kqsh_printf ( "schema '%N' already exists", existing );
+        else
+        {
+            PLOGERR ( klogErr,  (klogErr, rc, "schema '$(name)' could not be created",
+                                 "name=%.*s", ( int ) existing -> name . size, existing -> name . addr ));
+        }
+        return rc;
+    }
+
+    /* now process the request */
+    switch ( mgr -> type )
+    {
+    case obj_VDBManager:
+        rc = _VDBManagerMakeSchema ( mgr -> u . obj, & schema );
+        break;
+    case obj_SRAManager:
+        rc = _SRAMgrMakeSRASchema ( mgr -> u . obj, & schema );
+        break;
+    }
+
+    if ( rc == 0 )
+    {
+        KSymbol *sym;
+
+        /* create symbol */
+        rc = KSymTableCreateSymbol ( tbl, & sym, & name, obj_VSchema, schema );
+        if ( rc == 0 )
+        {
+            if ( interactive )
+            {
+                kqsh_printf ( "created schema '%N' ( %p )\n"
+                              , sym, sym -> u . obj );
+            }
+            return 0;
+        }
+
+        /* whack instance */
+        _VSchemaRelease ( schema );
+    }
+
+    PLOGERR ( klogInt,  (klogInt, rc,
+              "failed to create schema '$(name)' using $(mgr)"
+              , "name=%.*s,mgr=%.*s"
+              , ( int ) name . size, name . addr
+                         , ( int ) mgr -> name . size, mgr -> name . addr ));
+
+    return rc;
+}
+
+/* create
+ */
+rc_t kqsh_create ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    uint32_t mode = kcmCreate;
+
+    if ( t -> id == kw_or )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case kw_replace:
+            mode = kcmInit;
+            break;
+        case kw_open:
+            mode = kcmOpen;
+            break;
+        default:
+            return expected ( t, klogErr, "replace or open" );
+        }
+
+        next_token ( tbl, src, t );
+    }
+
+    switch ( t -> id )
+    {
+    case kw_cursor:
+        return kqsh_create_cursor ( tbl, src, next_token ( tbl, src, t ), mode );
+    case kw_schema:
+        return kqsh_create_schema ( tbl, src, next_token ( tbl, src, t ), mode );
+    case kw_table:
+        return kqsh_create_table ( tbl, src, next_token ( tbl, src, t ), mode );
+    }
+
+    return expected ( t, klogErr, "cursor, schema or table" );
+}
diff --git a/tools/kqsh/kqsh-help.c b/tools/kqsh/kqsh-help.c
new file mode 100644
index 0000000..49edeb7
--- /dev/null
+++ b/tools/kqsh/kqsh-help.c
@@ -0,0 +1,1292 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "kqsh-priv.h"
+#include "kqsh-tok.h"
+
+#include <klib/container.h>
+#include <klib/symbol.h>
+#include <klib/symtab.h>
+#include <klib/token.h>
+
+#include <klib/log.h>
+#include <klib/rc.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+
+/* alias
+ */
+static
+rc_t kqsh_help_alias ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+        default:
+            return expected ( t, klogWarn, ";" );
+        }
+    }
+
+    printf ( "create a new name for an existing object\n"
+             "  THIS FEATURE IS NOT YET IMPLEMENTED.\n"
+        );
+
+    return 0;
+}
+
+
+/* alter
+ */
+static
+rc_t kqsh_help_alter_cursor ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+        default:
+            return expected ( t, klogWarn, ";" );
+        }
+    }
+
+    printf ( "alter a cursor\n"
+             "\n"
+             "usage:\n"
+             "  'alter <cursor> add column [ ( TYPEDECL ) ] NAME;'\n"
+             "\n"
+             "  the 'alter <cursor> add' command allows addition of columns\n"
+             "  before the cursor has been opened for use.\n"
+        );
+
+    return 0;
+}
+static
+rc_t kqsh_help_alter_schema ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+        default:
+            return expected ( t, klogWarn, ";" );
+        }
+    }
+
+    printf ( "alter an open schema\n"
+             "\n%s%s%s%s",
+             "usage:\n"
+             "  'alter <schema> add include [ path ] PATH;'\n"
+             "  'alter <schema> add path PATH;'\n"
+             "  'alter <schema> load PATH;'\n"
+             "\n",
+             "  the 'alter <schema> add' command allows addition of new\n"
+             "  search paths that affect loading and schema include directives.\n"
+             "\n",
+             "  the 'alter <schema> load' command will load schema from the\n"
+             "  indicated file.\n",
+             "\n"
+             "  the keywords 'alter schema' may be used instead of 'alter' alone.\n"
+        );
+
+    return 0;
+}
+
+static
+rc_t kqsh_help_alter ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+
+        case kw_cursor:
+            return kqsh_help_alter_cursor ( tbl, src, t );
+        case kw_schema:
+            return kqsh_help_alter_schema ( tbl, src, t );
+
+        default:
+            return expected ( t, klogWarn, "cursor or schema" );
+        }
+    }
+
+    printf ( "alter an open object\n"
+             "\n%s%s",
+             "usage:\n"
+             "  alter <vdb manager>...\n"
+             "  alter <sra manager> ...\n"
+             "  alter <cursor> ...\n"
+             "  alter <schema> ...\n"
+             "\n",
+             "  the alter command is used to modify open objects in some way.\n"
+             "\n"
+             "  type 'help alter <object>;' for more information about that command.\n"
+        );
+
+    return 0;
+}
+
+
+/* close
+ */
+static
+rc_t kqsh_help_close ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+        default:
+            return expected ( t, klogWarn, ";" );
+        }
+    }
+
+    printf ( "close an open object or cursor row\n"
+             "\n"
+             "usage:\n"
+             "  'close ID;'\n"
+             "  'close row [ on ] <cursor>;\n"
+        );
+
+    return 0;
+}
+
+
+/* create
+ */
+static
+rc_t kqsh_help_create_column ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+        default:
+            return expected ( t, klogWarn, ";" );
+        }
+    }
+
+    printf ( "create or open a stand-alone column using kdb manager (OBSCURE)\n"
+             "\n"
+             "usage:\n"
+             "  'create column PATH [ as ID ] [ using KDB-MGR ];'\n"
+             "\n"
+             "  create a column using implicit or named kdb manager.\n"
+             "  type 'help create;' for information on create semantics.\n"
+             "\n"
+             "  THIS FEATURE IS NOT YET IMPLEMENTED.\n"
+        );
+
+    return 0;
+}
+
+static
+rc_t kqsh_help_create_cursor ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+        default:
+            return expected ( t, klogWarn, ";" );
+        }
+    }
+
+    printf ( "create a row cursor upon a table\n"
+             "\n"
+             "usage:\n"
+             "  'create cursor ID on TBL [ for update ];'\n"
+             "\n"
+             "  create a named cursor on the given table. the default cursor mode is\n"
+             "  read-only, but may be used for write 'for update' is specified.\n"
+        );
+
+    return 0;
+}
+
+static
+rc_t kqsh_help_create_database ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+        default:
+            return expected ( t, klogWarn, ";" );
+        }
+    }
+
+    printf ( "create or open a databse\n"
+             "\n%s%s",
+             "usage:\n"
+             "  'create database PATH [ as ID ] [ using KDB-MGR ];'\n"
+             "  'create database PATH [ as ID ]\n"
+             "     [ with ] schema ID.ID [ using MGR ];'\n"
+             "  'create database ID [ as ID ] [ using KDB-DB ];'\n"
+             "  'create database ID [ as ID ]\n"
+             "     [ with ] schema ID [ using DB ];'\n"
+             "\n",
+             "  create a database using implicit or named manager or database.\n"
+             "  type 'help create;' for information on create semantics.\n"
+             "  when using a database schema, the target object may be any\n"
+             "  manager or database above kdb level.\n"
+             "\n"
+             "  THIS FEATURE IS NOT YET IMPLEMENTED.\n"
+        );
+
+    return 0;
+}
+
+static
+rc_t kqsh_help_create_schema ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+        default:
+            return expected ( t, klogWarn, ";" );
+        }
+    }
+
+    printf ( "create an empty schema object\n"
+             "\n"
+             "usage:\n"
+             "  'create schema as ID [ using MGR ];'\n"
+             "\n"
+             "  create a new schema populated only by intrinsic definitions.\n"
+             "  the manager used must be above kdb level.\n"
+        );
+
+    return 0;
+}
+
+static
+rc_t kqsh_help_create_table ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+        default:
+            return expected ( t, klogWarn, ";" );
+        }
+    }
+
+    printf ( "create or open a table\n"
+             "\n%s%s",
+             "usage:\n"
+             "  'create table PATH [ as ID ] [ using KDB-MGR ];'\n"
+             "  'create table PATH [ as ID ]\n"
+             "     [ with ] schema ID.ID [ using MGR ];'\n"
+             "  'create table ID [ as ID ] [ using KDB-DB ];'\n"
+             "  'create table ID [ as ID ]\n"
+             "     [ with ] schema ID [ using DB ];'\n"
+             "\n",
+             "  create a table using implicit or named manager or database.\n"
+             "  type 'help create;' for information on create semantics.\n"
+             "  when using a table schema, the target object may be any\n"
+             "  manager or database above kdb level.\n"
+        );
+
+    return 0;
+}
+
+static
+rc_t kqsh_help_create ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+
+        case kw_column:
+            return kqsh_help_create_column ( tbl, src, t );
+        case kw_cursor:
+            return kqsh_help_create_cursor ( tbl, src, t );
+        case kw_database:
+            return kqsh_help_create_database ( tbl, src, t );
+        case kw_schema:
+            return kqsh_help_create_schema ( tbl, src, t );
+        case kw_table:
+            return kqsh_help_create_table ( tbl, src, t );
+
+        default:
+            return expected ( t, klogWarn, "column, cursor, database, schema, table or ;" );
+        }
+    }
+
+    printf ( "create a new object or open/reinitialize an existing one\n"
+             "\n%s%s%s%s",
+             "usage:\n"
+             "  create ...            - create a new object or fail if it already exists.\n"
+             "  create or replace ... - create a new object or reinitialize existing one.\n"
+             "  create or open ...    - create a new object or open existing one for update.\n"
+             "\n",
+             "  create column ...\n"
+             "  create cursor ...\n"
+             "  create database ...\n"
+             "  create schema ...\n"
+             "  create table ...\n"
+             "\n",
+             "  the create command is used primarily to create new objects, but may\n"
+             "  also be used to open and optionally reinitialize certain types of\n"
+             "  existing objects, namely database, tables and columns.\n"
+             "\n",
+             "semantic variations on databases, tables or columns:\n"
+             "  create or open - create if not there, open otherwise [ open ( O_CREAT ) ]\n"
+             "  create or init - create if not there, reinitialize otherwise [ open ( O_CREAT | O_TRUNC ) ]\n"
+             "\n"
+             "  type 'help create <object>;' for more information about that command.\n"
+        );
+
+    return 0;
+}
+
+/* delete
+ */
+static
+rc_t kqsh_help_delete ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+        default:
+            return expected ( t, klogWarn, ";" );
+        }
+    }
+
+    printf ( "delete rows or nodes\n"
+             "  THIS FEATURE IS NOT YET IMPLEMENTED.\n"
+        );
+
+    return 0;
+}
+
+
+/* drop
+ */
+static
+rc_t kqsh_help_drop ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+        default:
+            return expected ( t, klogWarn, ";" );
+        }
+    }
+
+    printf ( "remove an object from the file system\n"
+             "  THIS FEATURE IS NOT YET IMPLEMENTED.\n"
+        );
+
+    return 0;
+}
+
+
+/* execute
+ */
+static
+rc_t kqsh_help_execute ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+        default:
+            return expected ( t, klogWarn, ";" );
+        }
+    }
+
+    printf ( "run a kqsh script in a sub-scope\n"
+        );
+
+    return 0;
+}
+
+
+/* help
+ */
+static
+rc_t kqsh_help_help ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+        default:
+            return expected ( t, klogWarn, ";" );
+        }
+    }
+
+    printf ( "print help\n"
+             "\n"
+             "usage:\n"
+             "  'help <topic>;'\n"
+        );
+
+    return 0;
+}
+
+
+/* open
+ */
+static
+rc_t kqsh_help_open_mgr ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+        default:
+            return expected ( t, klogWarn, ";" );
+        }
+    }
+
+    printf ( "open a library manager\n"
+             "\n%s%s%s",
+             "usage:\n"
+             "  'open kdb [ manager ] [ as ID ];'\n"
+             "  'open vdb [ manager ] [ as ID ];'\n"
+             "  'open sra [ manager ] [ as ID ];'\n"
+             "  'open sra path [ manager ] [ as ID ];'\n"
+             "\n",
+             "  this command opens a manager object for the indicated library,\n"
+             "  dynamically loading the library if required. the library operational\n"
+             "  mode (read-only or update) is selected at kqsh launch time by using\n"
+             "  the '-u' switch for update (default is read-only).\n"
+             "\n",
+             "  the sra manager can optionally work with a path manager to convert\n"
+             "  table accession strings into runtime paths. type 'help open sra;' for\n"
+             "  more information.\n"
+        );
+
+    return 0;
+}
+
+static
+rc_t kqsh_help_open_path_mgr ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+
+        case kw_manager:
+            return kqsh_help_open_mgr ( tbl, src, t );
+
+        case kw_path:
+            if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+            {
+                switch ( next_token ( tbl, src, t ) -> id )
+                {
+                case eEndOfInput:
+                case eSemiColon:
+                case kw_manager:
+                    break;
+                default:
+                    return expected ( t, klogWarn, "manager" );
+                }
+            }
+            break;
+
+        default:
+            return expected ( t, klogWarn, ";" );
+        }
+    }
+
+    printf ( "open a library or path manager\n"
+             "\n%s%s%s%s%s",
+             "usage:\n"
+             "  'open sra [ manager ] [ as ID ];'\n"
+             "  'open sra path [ manager ] [ as ID ];'\n"
+             "\n",
+             "  this command opens a manager object for the indicated library,\n"
+             "  dynamically loading the library if required. the library operational\n"
+             "  mode (read-only or update) is selected at kqsh launch time by using\n"
+             "  the '-u' switch for update (default is read-only).\n"
+             "\n",
+             "  the path manager may be opened along with its related db manager.\n"
+             "  its purpose is to transform object paths given in open commands from\n"
+             "  accessions into runtime paths. for example:\n"
+             "\n",
+             "    > 'open sra manager; open sra path manager;'\n"
+             "    > 'open table \"SRR000001\" using sramgr;'\n"
+             "\n",
+             "  the commands above will open the sra manager under its default name,\n"
+             "  then open the installation specific sra path manager and associate the\n"
+             "  two, such that the next open table command will convert the given path\n"
+             "  from an accession 'SRR000001' to a full file system path.\n"
+        );
+
+    return 0;
+}
+
+static
+rc_t kqsh_help_open_cursor ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+
+        default:
+            return expected ( t, klogWarn, ";" );
+        }
+    }
+
+    printf ( "open a cursor\n"
+             "\n"
+             "usage:\n"
+             "  'open ID at ROW;'\n"
+             "\n"
+             "  this command will cause a cursor to be opened at the given starting row.\n"
+        );
+
+    return 0;
+}
+
+static
+rc_t kqsh_help_open_row ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+
+        default:
+            return expected ( t, klogWarn, ";" );
+        }
+    }
+
+    printf ( "open a row on cursor\n"
+             "\n"
+             "usage:\n"
+             "  'open row [ ROW ] [ on ] <cursor>;'\n"
+             "\n"
+             "  this command will cause a cursor row to be opened.\n"
+             "\n"
+             "  if no row id is specified, the current cursor row marker will be used.\n"
+             "  otherwise, the cursor marker will be preset to given row id before the\n"
+             "  row is opened.\n"
+             "\n"
+             "  if the cursor row is already open, the command will succeed provided\n"
+             "  that the current row id matches the requested row id.\n"
+        );
+
+    return 0;
+}
+
+static
+rc_t kqsh_help_open ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+
+        case kw_sra:
+            return kqsh_help_open_path_mgr ( tbl, src, t );
+        case kw_kdb:
+        case kw_vdb:
+            if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+            {
+                switch ( next_token ( tbl, src, t ) -> id )
+                {
+                case eEndOfInput:
+                case eSemiColon:
+                case kw_manager:
+                    break;
+                    return expected ( t, klogWarn, "manager" );
+                }
+            }
+        case kw_manager:
+            return kqsh_help_open_mgr ( tbl, src, t );
+
+        case kw_cursor:
+            return kqsh_help_open_cursor ( tbl, src, t );
+
+        case kw_row:
+            return kqsh_help_open_row ( tbl, src, t );
+
+        default:
+            return expected ( t, klogWarn, ";" );
+        }
+    }
+
+    printf ( "open an existing object\n"
+             "\n"
+             "usage:\n"
+             "  'open kdb [ manager ] [ as ID ];'\n"
+             "  'open vdb [ manager ] [ as ID ];'\n"
+             "  'open sra [ manager ] [ as ID ];'\n"
+             "  'open sra path [ manager ] [ as ID ];'\n"
+             "  'open column' ...\n"
+             "  'open database' ...\n"
+             "  'open metadata' ...\n"
+             "  'open row' ...\n"
+             "  'open schema' ...\n"
+             "  'open table' ...\n"
+             "  'open cursor' ...\n"
+             "\n"
+             "  type 'help open manager;' for more information about those commands,\n"
+             "  type 'help open <object>;' for more information about remaining command.\n"
+        );
+
+    return 0;
+}
+
+/* quit aka exit
+ */
+static
+rc_t kqsh_help_quit ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+        default:
+            return expected ( t, klogWarn, ";" );
+        }
+    }
+
+    printf ( "exit kqsh\n"
+             "\n"
+             "usage:\n"
+             "  'quit;'\n"
+             "  'exit;'\n"
+        );
+
+    return 0;
+}
+
+#define kqsh_help_exit( tbl, src, t ) \
+    kqsh_help_quit ( tbl, src, t )
+
+
+/* rename
+ */
+static
+rc_t kqsh_help_rename ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+        default:
+            return expected ( t, klogWarn, ";" );
+        }
+    }
+
+    printf ( "rename an object within file system\n"
+             "  THIS FEATURE IS NOT YET IMPLEMENTED.\n"
+        );
+
+    return 0;
+}
+
+
+/* show
+ */
+static
+rc_t kqsh_help_show_mgr ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+
+        default:
+            return expected ( t, klogWarn, ";" );
+        }
+    }
+
+    printf ( "show library manager properties\n"
+             "\n"
+             "usage:\n"
+             "  'show <mgr> version;'\n"
+        );
+
+    return 0;
+}
+
+static
+rc_t kqsh_help_show_path_mgr ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+        case kw_manager:
+            return kqsh_help_show_mgr ( tbl, src, t );
+
+        case kw_path:
+            if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+            {
+                switch ( next_token ( tbl, src, t ) -> id )
+                {
+                case eEndOfInput:
+                case eSemiColon:
+                case kw_manager:
+                    break;
+                default:
+                    return expected ( t, klogWarn, "manager" );
+                }
+            }
+            break;
+
+        default:
+            return expected ( t, klogWarn, ";" );
+        }
+    }
+    else
+    {
+        return kqsh_help_show_mgr ( tbl, src, t );
+    }
+
+    printf ( "show path manager properties\n"
+             "\n"
+             "usage:\n"
+             "  NO USAGE AVAILABLE\n"
+        );
+
+    return 0;
+}
+
+static
+rc_t kqsh_help_show_schema ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+
+
+        default:
+            return expected ( t, klogWarn, ";" );
+        }
+    }
+
+    printf ( "inspect an open schema\n"
+             "\n"
+             "usage:\n"
+             "  'show <schema>;'\n"
+             "  'show <schema> types;'\n"
+             "  'show <schema> typesets;'\n"
+             "  'show <schema> formats;'\n"
+             "  'show <schema> constants;'\n"
+             "  'show <schema> functions;'\n"
+             "  'show <schema> columns;'\n"
+             "  'show <schema> tables;'\n"
+             "  'show <schema> databases;'\n"
+             "  'show <schema> . NAME;'\n"
+             "  'show <schema> . NAME # VERSION;'\n"
+             "\n"
+             "  this command allows inspection of schema contents by listing object\n"
+             "  names or dumping their declarations.\n"
+        );
+
+    return 0;
+}
+
+static
+rc_t kqsh_help_show ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+
+        case kw_sra:
+            return kqsh_help_show_path_mgr ( tbl, src, t );
+
+        case kw_kdb:
+        case kw_vdb:
+            if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+            {
+                switch ( next_token ( tbl, src, t ) -> id )
+                {
+                case eEndOfInput:
+                case eSemiColon:
+                case kw_manager:
+                    break;
+                    return expected ( t, klogWarn, "manager" );
+                }
+            }
+        case kw_manager:
+            return kqsh_help_show_mgr ( tbl, src, t );
+
+        case kw_schema:
+            return kqsh_help_show_schema ( tbl, src, t );
+
+        default:
+            return expected ( t, klogWarn, "object or ;" );
+        }
+    }
+
+    printf ( "display an object\n"
+             "\n"
+             "usage:\n"
+             "  'show manager ...'\n"
+             "  'show schema ...'\n"
+             "\n"
+             "  type 'help show manager;' for more information about those commands,\n"
+             "  type 'help show <object>;' for more information about remaining command.\n"
+        );
+
+    return 0;
+}
+
+/* write
+ */
+static
+rc_t kqsh_help_write ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+        default:
+            return expected ( t, klogWarn, ";" );
+        }
+    }
+
+    printf ( "write or append row data to column or node\n"
+             "%s%s%s%s%s",
+             "\n"
+             "usage:\n"
+             "  'write <cursor>.<column> ROW'\n"
+             "  'write <cursor>.IDX ROW'\n"
+             "\n",
+             "ROW:\n"
+             "  STRING              - character data\n"
+             "  <bin-elem>          - non-character datum\n"
+             "  '[' <bin-elems> ']' - a vector of non-character data\n"
+             "\n",
+             "bin-elem:\n"
+             "  BOOLEAN             - the constants 'true' or 'false'\n"
+             "  INTEGER             - signed or unsigned integer value\n"
+             "  FLOAT               - floating point value\n"
+             "\n",
+             "bin-elems:\n"
+             "  <bin-elem> [ ',' <bin-elems> ]\n"
+             "\n",
+             "  specify an open cursor and column by name or ordinal index.\n"
+             "  the row data given will be appended to that column.\n"
+        );
+
+    return 0;
+}
+
+
+/* use
+ */
+static
+rc_t kqsh_help_use ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+        default:
+            return expected ( t, klogWarn, ";" );
+        }
+    }
+
+    printf ( "make object the implicit target of 'using' clause\n"
+             "  THIS FEATURE IS NOT YET IMPLEMENTED.\n"
+        );
+
+    return 0;
+}
+
+
+/* macro for generating switch statements */
+#define KQSH_HELP_KEYWORD( topic ) \
+    case kw_ ## topic: return kqsh_help_ ## topic ( tbl, src, t )
+
+/* commands
+ */
+static
+rc_t kqsh_help_commands ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+
+        KQSH_HELP_KEYWORD ( alias );
+        KQSH_HELP_KEYWORD ( alter );
+        KQSH_HELP_KEYWORD ( close );
+        KQSH_HELP_KEYWORD ( create );
+        KQSH_HELP_KEYWORD ( delete );
+        KQSH_HELP_KEYWORD ( drop );
+        KQSH_HELP_KEYWORD ( execute );
+        KQSH_HELP_KEYWORD ( exit );
+        KQSH_HELP_KEYWORD ( help );
+        KQSH_HELP_KEYWORD ( open );
+        KQSH_HELP_KEYWORD ( quit );
+        KQSH_HELP_KEYWORD ( rename );
+        KQSH_HELP_KEYWORD ( show );
+        KQSH_HELP_KEYWORD ( use );
+        KQSH_HELP_KEYWORD ( write );
+
+        default:
+            return expected ( t, klogWarn, "command topic" );
+        }
+    }
+
+    printf ( "kqsh commands:\n"
+             "%s%s%s",
+             "  alter - alter an open object\n"
+             "  close - close an open object\n"
+             "  create - create a new object\n"
+             "  execute - execute a kqsh script in a new scope\n"
+             "  help - print this list\n"
+             "  open - open an existing object\n"
+             "  quit - exit shell\n"
+             "  show - display object data\n"
+             "  write - write a row of data to a column\n"
+             "\n",
+             "unimplemented commands:\n"
+             "  alias - create a new name to an file system object\n"
+             "  delete - delete rows or nodes\n"
+             "  drop - remove an object from the file system\n"
+             "  rename - rename an object within file system\n"
+             "  use - make object the implicit target of 'using' clause\n"
+             "\n",
+             "  type 'help <command>;' for more information about that command.\n"
+        );
+
+    return 0;
+}
+
+/* kdb
+ */
+static
+rc_t kqsh_help_kdb ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+        default:
+            return expected ( t, klogWarn, ";" );
+        }
+    }
+
+    printf ( "kdb objects:\n"
+             "  kdb manager - root object of kdb\n"
+             "  kdb database - raw, physical database\n"
+             "  kdb table - raw, physical table\n"
+             "  kdb column - raw, physical column with opaque data\n"
+             "  kdb metadata - associated with manager, database, table and column\n"
+             "\n"
+             "  NB - in some tables with early version columns, metadata may not be present.\n"
+        );
+
+    return 0;
+}
+
+
+/* vdb
+ */
+static
+rc_t kqsh_help_vdb ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+        default:
+            return expected ( t, klogWarn, ";" );
+        }
+    }
+
+    printf ( "vdb objects:\n"
+             "  vdb manager - root object of vdb\n"
+             "  vdb schema - describes other objects\n"
+             "  vdb database - can contain tables, indices and sub-databases\n"
+             "  vdb table - can contain columns and indices\n"
+             "  vdb cursor - a group of user-selected columns\n"
+             "\n"
+             "  the vdb manager builds upon the kdb manager. it allows use\n"
+             "  and definition of schema objects which describe the shape and\n"
+             "  behavior of other objects that may be created or opened under vdb.\n"
+        );
+
+    return 0;
+}
+
+
+/* sra
+ */
+static
+rc_t kqsh_help_sra ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+        default:
+            return expected ( t, klogWarn, ";" );
+        }
+    }
+
+    printf ( "sra objects:\n"
+             "  sra manager - root object of sra\n"
+             "  sra path manager - installation specific path translator\n"
+             "  sra table - can contain columns and indices\n"
+             "\n"
+             "  the sra manager builds upon the vdb manager. it has a pre-defined\n"
+             "  schema within the sra domain and the objects provide some interface\n"
+             "  refinements of their vdb counterparts.\n"
+             "\n"
+             "  not all installations will have an sra path manager for translating\n"
+             "  paths given to the open command. when not available or used, open paths\n"
+             "  will be used as given.\n"
+        );
+
+    return 0;
+}
+
+
+/* objects
+ */
+static
+rc_t kqsh_help_objects ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+
+        KQSH_HELP_KEYWORD ( kdb );
+        KQSH_HELP_KEYWORD ( vdb );
+        KQSH_HELP_KEYWORD ( sra );
+
+#if 0
+        KQSH_HELP_KEYWORD ( column );
+        KQSH_HELP_KEYWORD ( database );
+        KQSH_HELP_KEYWORD ( metadata );
+        KQSH_HELP_KEYWORD ( schema );
+        KQSH_HELP_KEYWORD ( table );
+#endif
+
+        default:
+            return expected ( t, klogWarn, "object class" );
+        }
+    }
+
+    printf ( "kqsh objects:\n"
+             "  kdb ...\n"
+             "  vdb ...\n"
+             "  sra ...\n"
+             "  column\n"
+             "  cursor\n"
+             "  database\n"
+             "  metadata\n"
+             "  schema\n"
+             "  table\n"
+             "\n"
+             "  type 'help <object>;' for more information about that object.\n"
+        );
+
+    return 0;
+}
+
+/* kqsh
+ */
+rc_t kqsh_help ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    /* this is one command where we don't insist on a trailing ';'
+       because the user might just be getting it figured out */
+    if ( ! interactive || KTokenSourceAvail ( src ) > 1 )
+    {
+        /* this command could still block */
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eEndOfInput:
+        case eSemiColon:
+            break;
+
+        KQSH_HELP_KEYWORD ( commands );
+        KQSH_HELP_KEYWORD ( objects );
+
+        KQSH_HELP_KEYWORD ( alias );
+        KQSH_HELP_KEYWORD ( alter );
+        KQSH_HELP_KEYWORD ( close );
+        KQSH_HELP_KEYWORD ( create );
+        KQSH_HELP_KEYWORD ( delete );
+        KQSH_HELP_KEYWORD ( drop );
+        KQSH_HELP_KEYWORD ( execute );
+        KQSH_HELP_KEYWORD ( help );
+        KQSH_HELP_KEYWORD ( open );
+        KQSH_HELP_KEYWORD ( quit );
+        KQSH_HELP_KEYWORD ( rename );
+        KQSH_HELP_KEYWORD ( show );
+        KQSH_HELP_KEYWORD ( use );
+        KQSH_HELP_KEYWORD ( write );
+
+        KQSH_HELP_KEYWORD ( kdb );
+        KQSH_HELP_KEYWORD ( vdb );
+        KQSH_HELP_KEYWORD ( sra );
+
+#if 0
+        KQSH_HELP_KEYWORD ( column );
+        KQSH_HELP_KEYWORD ( database );
+        KQSH_HELP_KEYWORD ( metadata );
+        KQSH_HELP_KEYWORD ( schema );
+        KQSH_HELP_KEYWORD ( table );
+#endif
+
+        default:
+            return expected ( t, klogWarn, "help topic" );
+        }
+    }
+
+    /* general help */
+    printf ( "kqsh help:\n"
+             "\n"
+             "  topics:\n"
+             "    commands -- list shell commands\n"
+             "    objects -- list objects and their usage\n"
+             "\n"
+             "  the command processor expects a semi-colon ( ';' ) to process each command.\n"
+             "  this is not intended to be irritating, but the shell itself is NOT line oriented\n"
+             "  which requires a statement terminator. the 'help' and 'quit' commands are the only\n"
+             "  exceptions to this rule.\n"
+             "\n"
+             "  type 'help <topic>;' for more information about that topic.\n"
+        );
+
+    return 0;
+}
diff --git a/tools/kqsh/kqsh-load.c b/tools/kqsh/kqsh-load.c
new file mode 100644
index 0000000..88c32c5
--- /dev/null
+++ b/tools/kqsh/kqsh-load.c
@@ -0,0 +1,410 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "kqsh-priv.h"
+#include "kqsh-tok.h"
+#include "kqsh-kdb.h"
+#include "kqsh-vdb.h"
+#include "kqsh-sra.h"
+
+#include <klib/symbol.h>
+#include <klib/symtab.h>
+#include <klib/token.h>
+
+#include <kdb/manager.h>
+#include <vdb/manager.h>
+
+#include <kfs/directory.h>
+#include <kfs/dyload.h>
+#include <klib/log.h>
+#include <klib/vector.h>
+#include <klib/rc.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+/* library names on disk */
+#define LIBSTR2( str ) # str
+#define LIBSTR( str ) LIBSTR2 ( str )
+
+#if defined LIBKDB
+
+#define LIBKDBSTR LIBSTR ( LIBKDB )
+#define LIBWKDBSTR LIBSTR ( LIBWKDB )
+#define LIBVDBSTR LIBSTR ( LIBVDB )
+#define LIBWVDBSTR LIBSTR ( LIBWVDB )
+#define LIBSRADBSTR LIBSTR ( LIBSRADB )
+#define LIBWSRADBSTR LIBSTR ( LIBWSRADB )
+
+#elif defined LIBNCBI_VDB
+
+#define LIBKDBSTR LIBSTR ( LIBNCBI_VDB )
+#define LIBWKDBSTR LIBSTR ( LIBNCBI_WVDB )
+#define LIBVDBSTR LIBSTR ( LIBNCBI_VDB )
+#define LIBWVDBSTR LIBSTR ( LIBNCBI_WVDB )
+#define LIBSRADBSTR LIBSTR ( LIBNCBI_VDB )
+#define LIBWSRADBSTR LIBSTR ( LIBNCBI_WVDB )
+
+#else
+#error need a library name
+#endif
+
+/* dynamic loader */
+static KDyld *dl;
+
+
+/* init_libpath
+ *  initialize the library path
+ */
+rc_t kqsh_init_libpath ( void )
+{
+    return KDyldMake ( & dl );
+}
+
+
+/* whack_libpath
+ */
+void kqsh_whack_libpath ( void )
+{
+    KDyldRelease ( dl );
+    dl = NULL;
+}
+
+/* update_libpath
+ */
+rc_t kqsh_update_libpath ( const char *path )
+{
+    const char *end;
+    for ( end = strchr ( path, ':' ); end != NULL; end = strchr ( path = end + 1, ':' ) )
+    {
+        if ( path < end )
+            KDyldAddSearchPath ( dl, "%.*s", ( int ) ( end - path ), path );
+    }
+
+    if ( path [ 0 ] != 0 )
+        KDyldAddSearchPath ( dl, path );
+
+    return 0;
+}
+
+
+/* system_libpath
+ */
+rc_t kqsh_system_libpath ( void )
+{
+    const char *LD_LIBRARY_PATH = getenv ( "LD_LIBRARY_PATH" );
+
+    if ( LD_LIBRARY_PATH == NULL )
+        return 0;
+
+    return kqsh_update_libpath ( LD_LIBRARY_PATH );
+}
+
+/* load_lib
+ *  loads the library
+ *  fetches function to make manager
+ */
+static
+rc_t kqsh_load_lib ( KDylib **lib, const char *libname, char *path, size_t path_size )
+{
+    rc_t rc = KDyldLoadLib ( dl, lib, libname );
+    if ( rc == 0 )
+    {
+        /* return path to caller */
+        rc = KDylibFullPath ( * lib, path, path_size );
+        if ( rc != 0 )
+            path [ 0 ] = 0;
+
+        return 0;
+    }
+
+    return rc;
+}
+
+static
+rc_t kqsh_import_sym ( const KDylib *lib, fptr_t *addr, const char *name )
+{
+    KSymAddr *sym;
+    rc_t rc = KDylibSymbol ( lib, & sym, name );
+    if ( rc == 0 )
+    {
+        KSymAddrAsFunc ( sym, addr );
+        KSymAddrRelease ( sym );
+    }
+    return rc;
+}
+
+#if 0
+static
+void kqsh_set_lib_log_handler ( const KDylib *lib )
+{
+    const KWrtHandler *handler = KLogHandlerGet ();
+    rc_t ( CC * klogLibHandlerSet ) ( KWrtWriter writer, void *data );
+    rc_t rc = kqsh_import_sym ( lib, ( fptr_t* ) & klogLibHandlerSet, "KLogLibHandlerSet" );
+    if ( rc == 0 )
+    {
+        rc_t ( CC * klogLibFmtHandlerSetDefault ) ( void );
+        rc = kqsh_import_sym ( lib, ( fptr_t* ) & klogLibFmtHandlerSetDefault, "KLogLibFmtHandlerSetDefault" );
+        if ( rc == 0 )
+        {
+            ( * klogLibHandlerSet ) ( handler -> writer, handler -> data );
+            ( * klogLibFmtHandlerSetDefault ) ();
+        }
+    }
+}
+#endif
+
+static
+rc_t kqsh_import_lib ( kqsh_libdata *libdata, const char *libname )
+{
+    /* load the library */
+    char path [ 4096 ];
+    rc_t rc = kqsh_load_lib ( & libdata -> lib, libname, path, sizeof path );
+    if ( rc != 0 )
+        PLOGERR ( klogErr,  (klogErr, rc, "failed to load library '$(lib)'", "lib=%s", libname ));
+    else
+    {
+        int i;
+        bool done_update = read_only;
+        fptr_t *vt = libdata -> cvt;
+        const char *msg, **msgv = & libdata -> msg [ 1 ];
+#if 0
+        /* tell library to log to stderr */
+        kqsh_set_lib_log_handler ( libdata -> lib );
+#endif
+        /* import first symbol according to operating mode */
+        msg = msgv [ read_only ? -1 : 0 ];
+        rc = kqsh_import_sym ( libdata -> lib, & vt [ 0 ], msg );
+
+        /* import remaining symbols */
+        for ( i = 1; rc == 0; ++ i )
+        {
+            /* detect end of list */
+            msg = msgv [ i ];
+            if ( msgv [ i ] == NULL )
+            {
+                /* exit if both const and update sides done */
+                if ( done_update )
+                {
+                    if ( interactive )
+                        kqsh_printf ( "loaded library '%s'\n", path );
+                    return 0;
+                }
+
+                /* switch to update side */
+                vt = libdata -> wvt;
+                msgv = libdata -> wmsg;
+                done_update = true;
+                i = -1;
+                continue;
+            }
+
+            /* import symbol */
+            rc = kqsh_import_sym ( libdata -> lib, & vt [ i ], msg );
+        }
+
+        /* failed to find symbol */
+        PLOGERR ( klogInt,  (klogInt, rc,
+                  "failed to resolve symbol $(msg) in library '$(path)'"
+                             , "msg=%s,path=%s", msg, path ));
+    }
+
+    return rc;
+}
+
+/* load
+ *  expects "t" to describe a library class, i.e.
+ *    'open <lib> mgr...'
+ *            ^
+ */
+rc_t kqsh_load ( struct KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    rc_t rc = 0;
+    void *mgr;
+    String name;
+    uint32_t type;
+    const char *libtype;
+    KSymbol *existing;
+
+    /* for loading library */
+    struct { kqsh_libdata *data; const char *ro, *rw; } libs [ 3 ] =
+    {
+        { & kdb_data, LIBKDBSTR, LIBWKDBSTR },
+        { & vdb_data, LIBVDBSTR, LIBWVDBSTR },
+        { & sra_data, LIBSRADBSTR, LIBWSRADBSTR }
+    };
+
+    uint32_t lib_idx;
+
+    /* select which library */
+    switch ( t -> id )
+    {
+    case kw_kdb:
+        CONST_STRING ( & name, "kmgr" );
+        libtype = "kdb";
+        lib_idx = 0;
+        type = obj_KDBManager;
+        break;
+    case kw_vdb:
+        CONST_STRING ( & name, "vmgr" );
+        libtype = "vdb";
+        lib_idx = 1;
+        type = obj_VDBManager;
+        break;
+    case kw_sra:
+        CONST_STRING ( & name, "sramgr" );
+        libtype = "sra";
+        lib_idx = 2;
+        type = obj_SRAManager;
+        break;
+    default:
+        return expected ( t, klogErr, "kdb, vdb or sra" );
+    }
+
+    /* treat 'manager' as optional - it's understood */
+    if ( next_token ( tbl, src, t ) -> id == kw_manager )
+        next_token ( tbl, src, t );
+
+    /* capture optional manager name */
+    switch ( t -> id )
+    {
+    case kw_as:
+        switch ( next_token ( tbl, src, t ) -> id )
+        {
+        case eIdent:
+            break;
+
+        case rsrv_kmgr:
+        case obj_KDBManager:
+            if ( type == obj_KDBManager )
+                break;
+            return expected ( t, klogErr, "identifier" );
+
+        case rsrv_vmgr:
+        case obj_VDBManager:
+            if ( type == obj_VDBManager )
+                break;
+
+        case rsrv_sramgr:
+        case obj_SRAManager:
+            if ( type == obj_SRAManager )
+                break;
+
+        default:
+            return expected ( t, klogErr, "identifier" );
+        }
+
+        name = t -> str;
+        existing = t -> sym;
+
+        next_token ( tbl, src, t );
+        break;
+
+    default:
+        existing = KSymTableFind ( tbl, & name );
+    }
+
+    /* process existing */
+    if ( existing != NULL && existing -> type >= obj_first )
+    {
+        kqsh_printf ( "%s manager '%N' ( %p ) is already open.\n",
+            libtype, existing, existing -> u . obj );
+        libs [ lib_idx ] . data -> dflt = existing;
+        return 0;
+    }
+
+    /* load library if required */
+    if ( libs [ lib_idx ] . data -> lib == NULL )
+    {
+        uint32_t i;
+        for ( i = 0; i <= lib_idx; ++ i )
+        {
+            rc = kqsh_import_lib ( libs [ i ] . data,
+                read_only ? libs [ i ] .  ro : libs [ i ] . rw );
+            if ( rc != 0 )
+                return rc;
+        }
+    }
+
+    /* create mgr object */
+    switch ( type )
+    {
+    case obj_KDBManager:
+        rc = _KDBManagerMake ( ( struct KDBManager** ) & mgr, NULL );
+        break;
+    case obj_VDBManager:
+        rc = _VDBManagerMake ( ( struct VDBManager** ) & mgr, NULL );
+        break;
+    case obj_SRAManager:
+        rc = _SRAMgrMake ( ( struct SRAMgr** ) & mgr, NULL );
+        break;
+    }
+
+    if ( rc == 0 )
+    {
+        KSymbol *sym;
+
+        /* create symbol */
+        rc = KSymTableCreateSymbol ( tbl, & sym, & name, type, mgr );
+        if ( rc == 0 )
+        {
+            libs [ lib_idx ] . data -> dflt = sym;
+            if ( interactive )
+            {
+                kqsh_printf ( "opened %s manager '%N' ( %p ) for %s\n"
+                              , libtype
+                              , sym, sym -> u . obj
+                              , read_only ? "read" : "update" );
+            }
+            return 0;
+        }
+
+        /* whack instance */
+        switch ( type )
+        {
+        case obj_KDBManager:
+            _KDBManagerRelease ( ( const void* ) mgr );
+            break;
+        case obj_VDBManager:
+            _VDBManagerRelease ( ( const void* ) mgr );
+            break;
+        case obj_SRAManager:
+            _SRAMgrRelease ( ( const void* ) mgr );
+            break;
+        }
+    }
+
+    PLOGERR ( klogInt,  (klogInt, rc,
+              "failed to open $(type) manager '$(name)' for $(mode)"
+              , "type=%s,name=%.*s,mode=%s"
+              , libtype
+              , ( int ) name . size, name . addr
+                         , read_only ? "read" : "update" ));
+
+    return rc;
+}
diff --git a/tools/kqsh/kqsh-open.c b/tools/kqsh/kqsh-open.c
new file mode 100644
index 0000000..2ea2687
--- /dev/null
+++ b/tools/kqsh/kqsh-open.c
@@ -0,0 +1,199 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "kqsh-priv.h"
+#include "kqsh-tok.h"
+#include "kqsh-kdb.h"
+#include "kqsh-vdb.h"
+
+#include <klib/symbol.h>
+#include <klib/symtab.h>
+#include <klib/token.h>
+
+#include <klib/log.h>
+#include <klib/rc.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+/* open cursor
+ *  open ID;
+ */
+static
+rc_t kqsh_open_cursor ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    rc_t rc;
+    KSymbol *sym = t -> sym;
+
+    if ( next_token ( tbl, src, t ) -> id != eSemiColon )
+        return expected ( t, klogErr, ";" );
+
+    rc = _VCursorOpen ( sym -> u . obj );
+    if ( rc != 0 )
+    {
+        PLOGERR ( klogInt,  (klogInt, rc,
+                  "failed to open cursor '$(name)' ( $(addr) )"
+                  , "name=%.*s,addr=0x%zX"
+                  , ( int ) sym -> name . size, sym -> name . addr
+                             , ( size_t ) sym -> u . obj ));
+    }
+    else if ( interactive )
+    {
+        kqsh_printf ( "opened cursor '%N' ( %p )\n"
+                      , sym, sym -> u . obj );
+    }
+
+    return rc;
+}
+
+static
+rc_t kqsh_open_row ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    rc_t rc = 0;
+    KSymbol *curs;
+    int64_t row_id;
+    bool has_row_id = false;
+    bool negate = false;
+
+    switch ( next_token ( tbl, src, t ) -> id )
+    {
+    case eMinus:
+        negate = true;
+    case ePlus:
+        next_token ( tbl, src, t );
+        break;
+    }
+
+    switch ( t -> id )
+    {
+    case eHex:
+        if ( negate )
+            LOGMSG ( klogWarn, "negative hex integer" );
+    case eDecimal:
+    case eOctal:
+        rc = KTokenToI64 ( t, & row_id );
+        if ( rc != 0 )
+            return expected ( t, klogErr, "integer row id" );
+        if ( negate )
+            row_id = - row_id;
+        has_row_id = true;
+        next_token ( tbl, src, t );
+        break;
+    default:
+        if ( negate )
+            return expected ( t, klogErr, "integer row id" );
+    }
+
+    if ( t -> id == kw_on )
+        next_token ( tbl, src, t );
+
+    switch ( t -> id )
+    {
+    case obj_VCursor:
+        curs = t -> sym;
+        break;
+    default:
+        return expected ( t, klogErr, "cursor" );
+    }
+
+    if ( next_token ( tbl, src, t ) -> id != eSemiColon )
+        return expected ( t, klogErr, ";" );
+
+    if ( has_row_id )
+    {
+        switch ( curs -> type )
+        {
+        case obj_VCursor:
+            rc = _VCursorSetRowId ( curs -> u . obj, row_id );
+            break;
+        }
+        if ( rc != 0 )
+        {
+            PLOGERR ( klogInt,  (klogInt, rc,
+                      "failed to open row $(id) on cursor '$(name)' ( $(addr) )"
+                      , "id=%ld,name=%.*s,addr=0x%zX"
+                      , row_id
+                      , ( int ) curs -> name . size, curs -> name . addr
+                      , ( size_t ) curs -> u . obj ));
+            return rc;
+        }
+    }
+
+    switch ( curs -> type )
+    {
+    case obj_VCursor:
+        rc = _VCursorOpenRow ( curs -> u . obj );
+        break;
+    }
+
+    if ( rc != 0 )
+    {
+        PLOGERR ( klogInt,  (klogInt, rc,
+                  "failed to open row on cursor '$(name)' ( $(addr) )"
+                  , "name=%.*s,addr=0x%zX"
+                  , ( int ) curs -> name . size, curs -> name . addr
+                  , ( size_t ) curs -> u . obj ));
+    }
+    else if ( interactive )
+    {
+        if ( has_row_id )
+        {
+            kqsh_printf ( "opened row %ld on cursor '%N' ( %p )\n"
+                          , row_id, curs, curs -> u . obj );
+        }
+        else
+        {
+            kqsh_printf ( "opened row on cursor '%N' ( %p )\n"
+                          , curs, curs -> u . obj );
+        }
+    }
+
+    return rc;
+}
+
+/* open
+ */
+rc_t kqsh_open ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    switch ( t -> id )
+    {
+    case kw_kdb:
+    case kw_vdb:
+    case kw_sra:
+        /* handle open manager as a load library */
+        return kqsh_load ( tbl, src, t );
+
+    case kw_row:
+        return kqsh_open_row ( tbl, src, t );
+
+    case obj_VCursor:
+        return kqsh_open_cursor ( tbl, src, t );
+    }
+
+    return expected ( t, klogErr, "manager or cursor or row" );
+}
diff --git a/tools/kqsh/kqsh-parse.c b/tools/kqsh/kqsh-parse.c
new file mode 100644
index 0000000..8c0fbec
--- /dev/null
+++ b/tools/kqsh/kqsh-parse.c
@@ -0,0 +1,198 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "kqsh-priv.h"
+#include "kqsh-tok.h"
+
+#include <klib/symbol.h>
+#include <klib/symtab.h>
+#include <klib/token.h>
+
+#include <kfs/directory.h>
+#include <kfs/file.h>
+#include <kfs/mmap.h>
+#include <kapp/main.h>
+#include <klib/log.h>
+#include <klib/rc.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+
+/* kqsh_execute
+ *
+ *  'execute' PATH ';'
+ */
+static
+rc_t kqsh_execute ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    String path;
+
+    if ( t -> id != eString )
+        return expected ( t, klogErr, "file path" );
+
+    path = t -> str;
+    path . addr += 1;
+    path . size -= 2;
+    path . len -= 2;
+
+    if ( next_token ( tbl, src, t ) -> id != eSemiColon )
+        return expected ( t, klogErr, ";" );
+
+    return kqsh_exec_file ( tbl, & path );
+}
+
+
+/* macro for generating switch statements */
+#define KQSH_CMD_KEYWORD( cmd ) \
+    case kw_ ## cmd: \
+        rc = kqsh_ ## cmd ( tbl, src, next_token ( tbl, src, & t ) ); \
+        break
+
+/* case for unimplemented commands */
+#define UNIMPL_CMD_KEYWORD( cmd ) \
+    case kw_ ## cmd: ( void ) 0
+
+/* kqsh
+ *  main loop for shell
+ */
+static
+rc_t kqsh_parse ( KSymTable *tbl, KTokenSource *src, kqsh_stack *frame )
+{
+    rc_t rc;
+    KToken t;
+
+    for ( rc = 0, frame -> cmd_num = 1; rc == 0; ++ frame -> cmd_num )
+    {
+        /* check for signals */
+        rc = Quitting ();
+        if ( rc != 0 )
+            break;
+
+        /* issue prompt */
+        /* the prompt should allow db.db.tbl.obj stack or 'kqsh' when empty */
+        if ( interactive )
+            kqsh_printf ( "\nkqsh|%F> ", frame );
+
+        /* process input */
+        next_token ( tbl, src, & t );
+        if ( interactive )
+            kqsh_printf ( "\n" );
+
+        switch ( t . id )
+        {
+        case eEndOfInput:
+            return 0;
+        case eSemiColon:
+            break;
+
+        case eHash:
+            while ( 1 )
+            {
+                KTokenizerNext ( kLineTokenizer, src, & t );
+                if ( t . id == eEndOfLine || t . id == eEndOfInput )
+                    break;
+            }
+            break;
+
+        /* implemented commands */
+        KQSH_CMD_KEYWORD ( alter );
+        KQSH_CMD_KEYWORD ( close );
+        KQSH_CMD_KEYWORD ( create );
+        KQSH_CMD_KEYWORD ( execute );
+        KQSH_CMD_KEYWORD ( open );
+        KQSH_CMD_KEYWORD ( show );
+        KQSH_CMD_KEYWORD ( write );
+
+        /* unimplemented commands */
+        UNIMPL_CMD_KEYWORD ( alias );
+        UNIMPL_CMD_KEYWORD ( delete );
+        UNIMPL_CMD_KEYWORD ( drop );
+        UNIMPL_CMD_KEYWORD ( insert );
+        UNIMPL_CMD_KEYWORD ( rename );
+        UNIMPL_CMD_KEYWORD ( update );
+        UNIMPL_CMD_KEYWORD ( use );
+            if ( interactive )
+                kqsh_printf ( "the %S command is not yet implemented.\n", & t . str );
+            rc = RC ( rcExe, rcNoTarg, rcExecuting, rcFunction, rcIncomplete );
+            break;
+
+        /* help and quit are special
+           in that they don't require a semi-colon
+           and thus can't use look-ahead which might block */
+        case kw_help:
+            rc = kqsh_help ( tbl, src, & t );
+            break;
+        case kw_exit:
+        case kw_quit:
+            return 0;
+
+        default:
+            rc = expected ( & t, klogErr, "command" );
+        }
+
+        /* tolerate errors in interactive mode */
+        if ( rc != 0 && interactive )
+        {
+            KTokenSourceConsume ( src );
+            rc = 0;
+        }
+    }
+    
+    return rc;
+}
+
+
+rc_t kqsh ( KSymTable *tbl, KTokenSource *src )
+{
+    rc_t rc;
+    BSTree scope;
+
+    kqsh_stack frame;
+    static kqsh_stack const *stk = NULL;
+
+    frame . prev = stk;
+    stk = & frame;
+
+    BSTreeInit ( & scope );
+
+    rc = KSymTablePushScope ( tbl, & scope );
+    if ( rc != 0 )
+        LOGERR ( klogInt, rc, "failed to initialize symbol table" );
+    else
+    {
+        rc = kqsh_parse ( tbl, src, & frame );
+
+        KSymTablePopScope ( tbl );
+        BSTreeWhack ( & scope, kqsh_whackobj, NULL );
+    }
+
+    stk = frame . prev;
+
+    return rc;
+}
diff --git a/tools/kqsh/kqsh-print.c b/tools/kqsh/kqsh-print.c
new file mode 100644
index 0000000..696bcbc
--- /dev/null
+++ b/tools/kqsh/kqsh-print.c
@@ -0,0 +1,170 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "kqsh-priv.h"
+
+#include <klib/symbol.h>
+#include <klib/out.h>
+#include <klib/rc.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+#include <assert.h>
+#include <ctype.h>
+
+
+/* printf
+ *  understands printing KSymbol
+ */
+static
+int kqsh_print_frame ( const kqsh_stack *frame )
+{
+    assert ( frame != NULL );
+
+    if ( frame -> prev != NULL )
+    {
+        int status = kqsh_print_frame ( frame -> prev );
+        if ( status != 0 )
+            return status;
+        return KOutMsg ( ".%u", frame -> cmd_num );
+    }
+
+    return KOutMsg ( "%u", frame -> cmd_num );
+}
+
+static
+int kqsh_vprintf ( const char *format, va_list args )
+{
+    int status;
+    const char *start, *end;
+
+    for ( status = 0, start = end = format; * end != 0; ++ end )
+    {
+        /* const String *s; */
+
+        switch ( * end )
+        {
+        case '%':
+            if ( end > start )
+            {
+                status = KOutMsg ( "%.*s", ( uint32_t ) ( end - start ), start );
+                if ( status != 0 )
+                    break;
+            }
+            switch ( * ( ++ end ) )
+            {
+            case 'd':
+                status = KOutMsg ( "%d", va_arg ( args, int ) );
+                break;
+            case 'u':
+                status = KOutMsg ( "%u", va_arg ( args, unsigned int ) );
+                break;
+            case 'x':
+                status = KOutMsg ( "%x", va_arg ( args, unsigned int ) );
+                break;
+            case 'X':
+                status = KOutMsg ( "%X", va_arg ( args, unsigned int ) );
+                break;
+            case 'f':
+                status = KOutMsg ( "%f", va_arg ( args, double ) );
+                break;
+            case 'l':
+                switch ( * ( ++ end ) )
+                {
+                case 'd':
+                    status = KOutMsg ( "%ld", va_arg ( args, int64_t ) );
+                    break;
+                case 'u':
+                    status = KOutMsg ( "%lu", va_arg ( args, uint64_t ) );
+                    break;
+                case 'x':
+                    status = KOutMsg ( "%lx", va_arg ( args, uint64_t ) );
+                    break;
+                case 'X':
+                    status = KOutMsg ( "%lX", va_arg ( args, uint64_t ) );
+                    break;
+                }
+                break;
+            case 'p':
+                status = KOutMsg ( "0x%lX", va_arg ( args, size_t ) );
+                break;
+            case 's':
+                status = KOutMsg ( "%s", va_arg ( args, const char* ) );
+                break;
+            case '.':
+                if ( end [ 1 ] == '*' && end [ 2 ] == 's' )
+                {
+                    end += 2;
+                    status = va_arg ( args, int );
+                    status = KOutMsg ( "%.*s", status, va_arg ( args, const char* ) );
+                    break;
+                }
+                /* not handling anything else */
+                status = KOutMsg ( "%%." );
+                break;
+            case 'S':
+                status = KOutMsg ( "%S", va_arg ( args, const String* ) );
+                break;
+            case 'N':
+                status = KOutMsg ( "%N", va_arg ( args, const KSymbol* ) );
+                break;
+            case 'F':
+                status = kqsh_print_frame ( va_arg ( args, const kqsh_stack* ) );
+                break;
+            case '%':
+                status = KOutMsg ( "%%" );
+                break;
+            }
+
+            start = end + 1;
+            break;
+        }
+
+        if ( status < 0 )
+            break;
+    }
+
+    if ( status >= 0 && end > start )
+        status = KOutMsg ( "%.*s", ( uint32_t ) ( end - start ), start );
+
+    fflush ( stdout );
+
+    return status;
+}
+
+int kqsh_printf ( const char *format, ... )
+{
+    int status;
+    va_list args;
+
+    va_start ( args, format );
+    status = kqsh_vprintf ( format, args );
+    va_end ( args );
+
+    return status;
+}
diff --git a/tools/kqsh/kqsh-priv.h b/tools/kqsh/kqsh-priv.h
new file mode 100644
index 0000000..eb40a01
--- /dev/null
+++ b/tools/kqsh/kqsh-priv.h
@@ -0,0 +1,151 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_kqsh_priv_
+#define _h_kqsh_priv_
+
+#ifndef _h_klib_token_
+#include <klib/token.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+/*--------------------------------------------------------------------------
+ * forwards
+ */
+struct Vector;
+struct BSTNode;
+struct KDylib;
+struct KSymTable;
+struct KDirectory;
+
+
+/*--------------------------------------------------------------------------
+ * library data
+ */
+typedef struct kqsh_libdata kqsh_libdata;
+struct kqsh_libdata
+{
+    /* library */
+    struct KDylib *lib;
+
+    /* default manager */
+    struct KSymbol *dflt;
+
+    /* const messages */
+    const char **msg;
+    fptr_t *cvt;
+
+    /* update messages */
+    const char **wmsg;
+    fptr_t *wvt;
+};
+
+/*--------------------------------------------------------------------------
+ * kqsh
+ */
+
+/* globals
+ *  "read_only" - true if update operations are not available
+ *
+ *  "interactive" - true if (apparently) using console interface
+ *
+ *  "*_data" - data for the individual libraries
+ */
+extern bool read_only;
+extern bool interactive;
+extern kqsh_libdata kdb_data;
+extern kqsh_libdata vdb_data;
+extern kqsh_libdata sra_data;
+
+/* stack frame
+ *  for recursive kqsh'ing
+ */
+typedef struct kqsh_stack kqsh_stack;
+struct kqsh_stack
+{
+    const kqsh_stack *prev;
+    uint32_t cmd_num;
+};
+
+/* kqsh
+ *  main shell
+ */
+rc_t kqsh ( struct KSymTable *tbl, KTokenSource *src );
+rc_t kqsh_exec_file ( struct KSymTable *tbl, const String *path );
+
+/* kqsh-print
+ *  understands printing KSymbol
+ */
+int kqsh_printf ( const char *format, ... );
+
+/* kqsh-alter
+ */
+rc_t kqsh_alter ( struct KSymTable *tbl, KTokenSource *src, KToken *t );
+
+/* kqsh-close
+ */
+void CC kqsh_whackobj ( struct BSTNode *n, void *ignore );
+rc_t kqsh_close ( struct KSymTable *tbl, KTokenSource *src, KToken *t );
+
+/* kqsh-help
+ *  help for commands and objects
+ */
+rc_t kqsh_help ( struct KSymTable *tbl, KTokenSource *src, KToken *t );
+
+/* kqsh-load
+ *  dylib loading and manager open
+ */
+rc_t kqsh_init_libpath ( void );
+void kqsh_whack_libpath ( void );
+rc_t kqsh_update_libpath ( const char *path );
+rc_t kqsh_system_libpath ( void );
+rc_t kqsh_load ( struct KSymTable *tbl, KTokenSource *src, KToken *t );
+
+/* kqsh-open
+ *  create and open described objects
+ */
+rc_t kqsh_create ( struct KSymTable *tbl, KTokenSource *src, KToken *t );
+rc_t kqsh_open ( struct KSymTable *tbl, KTokenSource *src, KToken *t );
+
+/* kqsh-show
+ */
+rc_t kqsh_show ( struct KSymTable *tbl, KTokenSource *src, KToken *t );
+
+/* kqsh-write
+ */
+rc_t kqsh_write ( struct KSymTable *tbl, KTokenSource *src, KToken *t );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _h_kqsh_priv_ */
diff --git a/tools/kqsh/kqsh-show.c b/tools/kqsh/kqsh-show.c
new file mode 100644
index 0000000..141493e
--- /dev/null
+++ b/tools/kqsh/kqsh-show.c
@@ -0,0 +1,290 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "kqsh-priv.h"
+#include "kqsh-tok.h"
+#include "kqsh-kdb.h"
+#include "kqsh-vdb.h"
+
+#include <vdb/schema.h>
+#include <klib/symbol.h>
+#include <klib/symtab.h>
+#include <klib/token.h>
+
+#include <klib/log.h>
+#include <klib/rc.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+
+/*--------------------------------------------------------------------------
+ * KDBManager
+ */
+
+static
+rc_t kqsh_show_kmgr_version ( KSymTable *tbl, KTokenSource *src, KToken *t, KSymbol *sym )
+{
+    rc_t rc;
+    uint32_t vers;
+
+    if ( t -> id != eSemiColon )
+        return expected ( t, klogErr, ";" );
+
+    rc = _KDBManagerVersion ( sym -> u . obj, & vers );
+    if ( rc == 0 )
+    {
+        if ( ( vers & 0xFFFF ) != 0 )
+            kqsh_printf ( "kdb manager '%N' v%u.%u.%u\n", sym, vers >> 24, ( vers >> 16 ) & 0xFF, vers & 0xFFFF );
+        else
+            kqsh_printf ( "kdb manager '%N' v%u.%u\n", sym, vers >> 24, ( vers >> 16 ) & 0xFF );
+    }
+    else
+    {
+        PLOGERR ( klogInt,  (klogInt, rc, "failed to obtain version of kdb manager '$(name)'",
+                             "name=%.*s", ( int ) sym -> name . size, sym -> name . addr ));
+    }
+
+    return rc;
+}
+
+static
+rc_t kqsh_show_kmgr ( KSymTable *tbl, KTokenSource *src, KToken *t, KSymbol *sym )
+{
+    switch ( t -> id )
+    {
+    case kw_version:
+        return kqsh_show_kmgr_version ( tbl, src, next_token ( tbl, src, t ), sym );
+    }
+
+    return expected ( t, klogErr, "version" );
+}
+
+/*--------------------------------------------------------------------------
+ * VDBManager
+ */
+
+static
+rc_t kqsh_show_vmgr_version ( KSymTable *tbl, KTokenSource *src, KToken *t, KSymbol *sym )
+{
+    rc_t rc;
+    uint32_t vers;
+
+    if ( t -> id != eSemiColon )
+        return expected ( t, klogErr, ";" );
+
+    rc = _VDBManagerVersion ( sym -> u . obj, & vers );
+    if ( rc == 0 )
+    {
+        if ( ( vers & 0xFFFF ) != 0 )
+            kqsh_printf ( "vdb manager '%N' v%u.%u.%u\n", sym, vers >> 24, ( vers >> 16 ) & 0xFF, vers & 0xFFFF );
+        else
+            kqsh_printf ( "vdb manager '%N' v%u.%u\n", sym, vers >> 24, ( vers >> 16 ) & 0xFF );
+    }
+    else
+    {
+        PLOGERR ( klogInt,  (klogInt, rc, "failed to obtain version of vdb manager '$(name)'",
+                             "name=%.*s", ( int ) sym -> name . size, sym -> name . addr ));
+    }
+
+    return rc;
+}
+
+static
+rc_t kqsh_show_vmgr ( KSymTable *tbl, KTokenSource *src, KToken *t, KSymbol *sym )
+{
+    switch ( t -> id )
+    {
+    case kw_version:
+        return kqsh_show_vmgr_version ( tbl, src, next_token ( tbl, src, t ), sym );
+    }
+
+    return expected ( t, klogErr, "version" );
+}
+
+/*--------------------------------------------------------------------------
+ * VSchema
+ */
+
+static
+rc_t CC kqsh_flush_schema ( void *f, const void *buffer, size_t bsize )
+{
+    size_t num_writ, total;
+
+    for ( total = 0; total < bsize; total += num_writ )
+    {
+        num_writ = fwrite ( buffer, 1, bsize, f );
+        if ( num_writ == 0 )
+            return RC ( rcExe, rcFile, rcWriting, rcNoObj, rcUnknown );
+    }
+
+    return 0;
+}
+
+static
+rc_t kqsh_dump_schema ( KSymbol *sym, uint32_t mode, const String *decl )
+{
+    rc_t rc;
+    char buffer [ 256 ];
+
+    if ( decl -> size != 0 )
+    {
+        string_copy ( buffer, sizeof buffer, decl -> addr, decl -> size );
+        buffer [ sizeof buffer - 1 ] = 0;
+    }
+
+    if ( interactive )
+        putchar ( '\n' );
+
+    rc = _VSchemaDump ( sym -> u . obj, mode,
+        decl -> size ? buffer : NULL, kqsh_flush_schema, stdout );
+
+    if ( rc != 0 )
+    {
+        printf ( "\n\n\n***** ABORTED *****\n\n" );
+        PLOGERR ( klogInt,  (klogInt, rc, "failed to dump schema '$(name)'",
+                             "name=%.*s", ( int ) sym -> name . size, sym -> name . addr ));
+    }
+
+    if ( interactive )
+        putchar ( '\n' );
+
+    return rc;
+}
+
+enum VSchemaDumpClass
+{
+    sdcTypes = 1,
+    sdcTypesets,
+    sdcFormats,
+    sdcConstants,
+    sdcFunctions,
+    sdcColumns,
+    sdcTables,
+    sdcDatabases
+};
+
+static
+rc_t kqsh_show_schema ( KSymTable *tbl, KTokenSource *src, KToken *t, KSymbol *sym, uint32_t mode )
+{
+    String decl;
+    CONST_STRING ( & decl, "" );
+
+    switch ( t -> id )
+    {
+    case eSemiColon:
+        break;
+    case kw_types:
+        mode |= sdcTypes << 8;
+        break;
+    case kw_typesets:
+        mode |= sdcTypesets << 8;
+        break;
+    case kw_formats:
+        mode |= sdcFormats << 8;
+        break;
+    case kw_constants:
+        mode |= sdcConstants << 8;
+        break;
+    case kw_functions:
+        mode |= sdcFunctions << 8;
+        break;
+    case kw_columns:
+        mode |= sdcColumns << 8;
+        break;
+    case kw_tables:
+        mode |= sdcTables << 8;
+        break;
+    case kw_databases:
+        mode |= sdcDatabases << 8;
+        break;
+    case ePeriod:
+        if ( next_token ( tbl, src, t ) -> id != eSemiColon )
+        {
+            decl = t -> str;
+            while ( next_token ( tbl, src, t ) -> id != eSemiColon )
+                decl . size = t -> str . addr + t -> str . size - decl . addr;
+            decl . len = string_len ( decl . addr, decl . size );
+            break;
+        }
+    default:
+        return expected ( t, klogErr, "formats or types or typesets or constants or functions or columns or tables or databases" );
+    }
+
+    return kqsh_dump_schema ( sym, mode, & decl );
+}
+
+/*--------------------------------------------------------------------------
+ * kqsh
+ */
+
+/* show
+ */
+rc_t kqsh_show ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    uint32_t mode = sdmPrint;
+    KSymbol *sym = t -> sym;
+
+    switch ( t -> id )
+    {
+    case kw_manager:
+        sym = next_token ( tbl, src, t ) -> sym;
+        switch ( t -> id )
+        {
+        case obj_KDBManager:
+            return kqsh_show_kmgr ( tbl, src, next_token ( tbl, src, t ), sym );
+        case obj_VDBManager:
+            return kqsh_show_vmgr ( tbl, src, next_token ( tbl, src, t ), sym );
+        }
+        break;
+    case obj_KDBManager:
+        return kqsh_show_kmgr ( tbl, src, next_token ( tbl, src, t ), sym );
+    case obj_VDBManager:
+        return kqsh_show_vmgr ( tbl, src, next_token ( tbl, src, t ), sym );
+
+    case kw_compact:
+        mode = sdmCompact;
+        if ( next_token ( tbl, src, t ) -> id != kw_schema )
+        {
+            if ( t -> id != obj_VSchema )
+                break;
+            sym = t -> sym;
+            return kqsh_show_schema ( tbl, src, next_token ( tbl, src, t ), sym, mode );
+        }
+        /* no break */
+    case kw_schema:
+        if ( next_token ( tbl, src, t ) -> id != obj_VSchema )
+            break;
+        sym = t -> sym;
+    case obj_VSchema:
+        return kqsh_show_schema ( tbl, src, next_token ( tbl, src, t ), sym, mode );
+    }
+
+    return expected ( t, klogErr, "object" );
+}
+
diff --git a/tools/kqsh/kqsh-thunk.pl b/tools/kqsh/kqsh-thunk.pl
new file mode 100755
index 0000000..429ab55
--- /dev/null
+++ b/tools/kqsh/kqsh-thunk.pl
@@ -0,0 +1,662 @@
+#!/usr/bin/perl
+#============================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+#
+#
+
+sub lower_case_sym
+{
+    my $sym;
+    my $in = @_ [ 0 ];
+
+    # split at leading lower case
+    if ( $in =~ /^([^A-Z]*)([A-Z].*)/ )
+    {
+        $sym = $1;
+        $in = $2;
+    }
+    else
+    {
+        return $in;
+    }
+
+    while ( $in )
+    {
+        # split off series of leading upper case
+        if ( $in =~ /^([A-Z][A-Z]*)([A-Z][^A-Z].*)/ )
+        {
+            $sym and $sym .= "_";
+            $sym .= lc $1;
+            $in = $2;
+        }
+
+        # lower case next word
+        if ( $in =~ /^([A-Z][^A-Z][^A-Z]*)([A-Z].*)/ )
+        {
+            $sym and $sym .= "_";
+            $sym .= lc $1;
+            $in = $2;
+        }
+        else
+        {
+            $sym and $sym .= "_";
+            $sym .= lc $in;
+            $in = '';
+        }
+    }
+
+    return $sym;
+}
+
+my @classes;
+$num_classes = 0;
+
+my @inc_paths;
+my @src_files;
+
+my $h_out;
+my $c_out;
+my $module;
+
+while ( $arg = shift )
+{
+    if ( $arg =~ /-(..*)/ )
+    {
+        $arg = $1;
+        while ( $arg =~ /(.)(.*)/ )
+        {
+            $sw = $1;
+            $arg = $2;
+
+            if ( $sw eq "I" )
+            {
+                $arg or $arg = shift;
+                $arg or die "expected include path";
+                push @inc_paths, split ( ':', $arg );
+                $arg = '';
+            }
+            elsif ( $sw eq "i" )
+            {
+                $arg or $arg = shift;
+                $arg or die "expected interface file path";
+                push @src_files, split ( ':', $arg );
+                $arg = '';
+            }
+            elsif ( $sw eq "h" )
+            {
+                $arg or $arg = shift;
+                $arg or die "expected h file path";
+                $h_out = $arg;
+                $arg = '';
+            }
+            elsif ( $sw eq "c" )
+            {
+                $arg or $arg = shift;
+                $arg or die "expected c file path";
+                $c_out = $arg;
+                $arg = '';
+            }
+            elsif ( $sw eq "m" )
+            {
+                $arg or $arg = shift;
+                $arg or die "expected module name";
+                $module = $arg;
+                $arg = '';
+            }
+            else
+            {
+                print STDERR "unrecognized switch: '$sw'\n";
+                exit 3;
+            }
+        }
+    }
+    else
+    {
+        if ( $arg =~ /:(..*)/ )
+        {
+            $classes [ $num_classes ] [ 2 ] = 1;
+            $arg = $1;
+        }
+        else
+        {
+            $classes [ $num_classes ] [ 2 ] = 0;
+        }
+
+        if ( $arg =~ /(.[^=]*)=(..*)/ )
+        {
+            $classes [ $num_classes ] [ 0 ] = $1;
+            $classes [ $num_classes ] [ 1 ] = lower_case_sym $2;
+        }
+        else
+        {
+            $classes [ $num_classes ] [ 0 ] = $arg;
+            $classes [ $num_classes ] [ 1 ] = lower_case_sym $arg;
+        }
+
+        ++ $num_classes;
+    }
+}
+
+$num_paths = scalar @inc_paths;
+$num_files = scalar @src_files;
+
+# validate parameters
+$num_classes or die "no object class specified";
+$module or die "no module name specified";
+
+# open output files
+if ( $h_out )
+{
+    open $H, ">$h_out" or die "failed to open file '$h_out' for output";
+}
+if ( $c_out )
+{
+    open $C, ">$c_out" or die "failed to open file '$c_out' for output";
+}
+else
+{
+    $C = STDOUT;
+}
+
+if ( $src_file )
+{
+    open $in, $src_file;
+}
+else
+{
+    $in = STDIN;
+}
+
+# create function accumulator
+my @funcs;
+$num_funcs = 0;
+
+# process files
+for ( $fidx = 0; $fidx == 0 || $fidx < $num_files; ++ $fidx )
+{
+    # open files or stdin
+    if ( $num_files )
+    {
+        # file to open
+        $src_file = $src_files [ $fidx ];
+
+        # locate it first
+        $st = stat $src_file;
+        for ( $i = 0; ! $st && $i < $num_paths; ++ $i )
+        {
+            $inc_path = $inc_paths [ $i ];
+            $st = stat "$inc_path/$src_file";
+            $st and $src_file = "$inc_path/$src_file";
+        }
+
+        # open input file
+        open $IN, $src_file or die "failed to open file '$src_file' for input";
+    }
+    else
+    {
+        $IN = STDIN;
+    }
+
+    while ( $line = <$IN> )
+    {
+        chomp $line;
+        $line =~ s/^\s+//;
+        $line =~ s/\s+$//;
+
+        if ( ! $line )
+        {
+            # skip empty lines
+        }
+        elsif ( $line =~/^extern.*/ )
+        {
+            # skip over open of 'extern "C"'
+        }
+        elsif ( $line =~/^[#}].*/ )
+        {
+            # skip over preprocessor lines
+            # and close of 'extern "C"'
+        }
+        elsif ( $line =~ /^typedef .*/ )
+        {
+            # skip over typedefs
+        }
+        else
+        {
+            # consume comments here
+            while ( $line =~ /^(.*)\/\*(.*)$/ )
+            {
+                $line = $1;
+                $cmt = $2;
+                until ( ! $cmt || $cmt =~ /^.*\*\/(.*)$/ )
+                {
+                    $cmt = <$IN>;
+                }
+
+                $line and $1 and $line .= " ";
+                $line .= "$1";
+
+                chomp $line;
+                $line =~ s/^\s+//;
+                $line =~ s/\s+$//;
+            }
+            if ( ! $line )
+            {
+                # skip of comment line was empty
+            }
+            else
+            {
+                # assemble line
+                until ( $line =~ /^(.*;)(.*)$/ )
+                {
+                    $cont = <$IN>;
+                    chomp $cont;
+                    $cont =~ s/^\s+//;
+                    $cont =~ s/\s+$//;
+                    $line .= " $cont";
+                }
+
+                # look for a function prototype
+                if ( $line =~ /^[A-Z]+_EXTERN ([^\(]+)\s+CC ([A-Za-z_][A-Za-z0-9_]*)\s*\(\s*(.*)\s+\);/ ||
+                     $line =~ /^[A-Z]+_EXTERN ([^\(]+\*+)CC ([A-Za-z_][A-Za-z0-9_]*)\s*\(\s*(.*)\s+\);/ ||
+                     $line =~ /^([^\(]+)\s+([A-Za-z_][A-Za-z0-9_]*)\s*\(\s*(.*)\s+\);/ ||
+                     $line =~ /^([^\(]+\*+)([A-Za-z_][A-Za-z0-9_]*)\s*\(\s*(.*)\s+\);/ )
+                {
+                    $rt = $1;
+                    $func = $2;
+                    $formals = $3;
+
+                    $msg = '';
+                    $cid = 0;
+                    $cls = '';
+                    $dual = 0;
+
+                    for ( $i = 0; ! $msg && $i < $num_classes; ++ $i )
+                    {
+                        $cls = $classes [ $i ] [ 0 ];
+                        if ( $func =~ /^$cls(..*)/ )
+                        {
+                            $cid = $i;
+                            $msg = $1;
+                            $dual = $classes [ $i ] [ 2 ];
+                        }
+                    }
+
+                    $penult = '';
+                    $vararg = '';
+                    $update = 0;
+                    $params = '';
+                    $tformals = '';
+
+                    $formals2 = '';
+                    $tmplist = $formals;
+                    while ( $tmplist =~ /([^\(]*\()([^\)]*)(\).*)/ )
+                    {
+                        $formals2 .= $1;
+                        $pparms = $2;
+                        $tmplist = $3;
+                        $pparms =~ s/,/#/g;
+                        $formals2 .= "$pparms";
+                    }
+                    $formals2 .= $tmplist;
+
+                    @paramlist = split ( ',', $formals2 );
+                    while ( $param = shift @paramlist )
+                    {
+                        # trim parameter
+                        $param =~ s/^\s+//;
+                        $param =~ s/\s+$//;
+
+                        # catch vararg parameter
+                        if ( $param eq '...' )
+                        {
+                            $vararg = $penult;
+                            $params .= ", args";
+                            $tformals = '';
+                        }
+                        else
+                        {
+                            # correct hidden commas
+                            $param =~ s/#/,/g;
+
+                            # strip off vector expr
+                            if ( $param =~ /([^\[]*)\s*(\[.*\])$/ )
+                            {
+                                $param = $1;
+                                $vect = $2;
+                            }
+
+
+                            # strip off param name
+                            if ( $param =~ /^(.*)\s*(\([^\(]*\))$/ )
+                            {
+                                $param = $1;
+                                $pparms = $2;
+                                $param =~ /^(.*)\(\s*CC\s*\*\s*([A-Za-z0-9_]+)\s*\)/ or die "failed to determine name of parameter '$param'";
+                                $param = "$1( CC * ) $pparms";
+                                $penult = $2;
+                            }
+                            else
+                            {
+                                $param =~ /(.*[^A-Za-z0-9_]+)([A-Za-z0-9_]+)$/ or die "failed to determine name of parameter '$param'";
+                                $param = $1;
+                                $penult = $2;
+                            }
+
+                            $params and $params .= ", ";
+                            $params .= $penult;
+                            
+
+                            # process typedecl
+                            $param =~ s/\s+$//;
+                            if ( $param =~ /(.*)\s+(\*+)$/ )
+                            {
+                                $param = "$1$2";
+                            }
+                            $vect and $param .= " $vect";
+                            $tformals and $tformals .= ", ";
+                            $tformals .= $param;
+
+                            # finally, decide if the function is for read or update
+                            if ( $param =~ /^$cls/ || $param =~ /^struct\s+$cls\*+/ )
+                            {
+                                $update = $dual;
+                            }
+                        }
+                    }
+
+                    $funcs [ $num_funcs ] [ 0 ] = $cid;
+                    $funcs [ $num_funcs ] [ 1 ] = $msg;
+                    $funcs [ $num_funcs ] [ 2 ] = $rt;
+                    $funcs [ $num_funcs ] [ 3 ] = $formals;
+                    $funcs [ $num_funcs ] [ 4 ] = $tformals;
+                    $funcs [ $num_funcs ] [ 5 ] = $vararg;
+                    $funcs [ $num_funcs ] [ 6 ] = $params;
+                    $funcs [ $num_funcs ] [ 7 ] = $update;
+
+                    ++ $num_funcs;
+                }
+            }
+        }
+    }
+
+    if ( $num_files )
+    {
+        close $IN;
+        $IN = '';
+    }
+}
+
+# generate text into arrays
+my @msgs;
+my @cvt;
+my @wmsgs;
+my @wvt;
+my @decls;
+my @thunks;
+$mgr = 'mgr';
+
+for ( $num_thunks = 0, $num_ro = 0, $i = 0; $i < $num_funcs; ++ $i )
+{
+    # extract information
+    $cid = $funcs [ $i ] [ 0 ];
+    $msg = $funcs [ $i ] [ 1 ];
+    $rt = $funcs [ $i ] [ 2 ];
+    $formals = $funcs [ $i ] [ 3 ];
+    $tformals = $funcs [ $i ] [ 4 ];
+    $vararg = $funcs [ $i ] [ 5 ];
+    $params = $funcs [ $i ] [ 6 ];
+    $update = $funcs [ $i ] [ 7 ];
+
+    $cls = $classes [ $cid ] [ 0 ];
+    $prefix = $classes [ $cid ] [ 1 ];
+    $dual = $classes [ $cid ] [ 2 ];
+
+    # constructor flag
+    $constructor = 3;
+
+    # msg symbol
+    $sym = "$cls$msg";
+    $tname = "_$sym";
+
+    # vt
+    $vt = $module;
+    $update == 0 and $vt .= "_cvt";
+    $update == 1 and $vt .= "_wvt";
+
+    # vt member
+    $vt_mbr = $prefix;
+    $vt_mbr .= '_';
+    if ( $dual && ( $msg eq "MakeRead" || $msg eq "MakeUpdate" ) )
+    {
+        # detect special library constructor
+        if ( $tformals =~ /^$cls\*\*,/ )
+        {
+            $constructor = 2;
+            $vt = $module . "_cvt";
+            $vt_mbr .= "make";
+            $tname = "_$cls" . "Make";
+        }
+        elsif ( $tformals =~ /^const\s+$cls\*\*,/ )
+        {
+            $constructor = 0;
+            $vt_mbr .= "make";
+        }
+        elsif ( $tformals =~ /^const\s+$cls\*\*$/ )
+        {
+            $constructor = 1;
+            $vt_mbr .= "make";
+        }
+        else
+        {
+            $vararg and $vt_mbr .= "v_";
+            $vt_mbr .= lower_case_sym $msg;
+        }
+    }
+    else
+    {
+        $vararg and $vt_mbr .= "v_";
+        $vt_mbr .= lower_case_sym $msg;
+    }
+
+    # vt function
+    $vt_func = "$rt ( CC * $vt_mbr ) ( $tformals )";
+
+    # dispatch
+    $disp = "( * $vt . f . $vt_mbr ) ( $params )";
+
+    # function declaration
+    $decl = "$rt $tname ( $formals )";
+
+    # thunk
+    $thunk = "$decl\n{\n";
+    if ( $vararg )
+    {
+        $thunk .= "    $rt ret;\n    va_list args;\n    va_start ( args, $vararg );\n";
+        $thunk .= "    assert ( $vt . f . $vt_mbr != NULL );\n";
+        $thunk .= "    ret = $disp;\n    va_end ( args );\n    return ret;\n";
+    }
+    else
+    {
+        $thunk .= "    assert ( $vt . f . $vt_mbr != NULL );\n";
+        $thunk .= "    return $disp;\n";
+    }
+    $thunk .= "}";
+
+    # handle library constructors specially
+    if ( $constructor == 0 )
+    {
+        $msgs [ 0 ] = $sym;
+    }
+    elsif ( $constructor == 1 )
+    {
+        my $subst_sym;
+        $subst_sym = $sym .= "WithDir";
+        $msgs [ 0 ] = $subst_sym;
+    }
+    elsif ( $constructor == 2 )
+    {
+        $msgs [ 1 ] = $sym;
+        $cvt [ 0 ] = $vt_func;
+        $decls [ 0 ] = $decl;
+        $thunks [ 0 ] = $thunk;
+        @pnames = split ( ',', $params );
+        $mgr = $pnames [ 0 ];
+    }
+    elsif ( $vararg )
+    {
+        $decls [ $num_thunks + 1 ] = $decl;
+        $thunks [ $num_thunks + 1 ] = $thunk;
+        ++ $num_thunks;
+    }
+    elsif ( $update == 1 )
+    {
+        push @wmsgs, $sym;
+        push @wvt, $vt_func;
+
+        $decls [ $num_thunks + 1 ] = $decl;
+        $thunks [ $num_thunks + 1 ] = $thunk;
+        ++ $num_thunks;
+    }
+    else
+    {
+        $msgs [ $num_ro + 2 ] = $sym;
+        $cvt [ $num_ro + 1 ] = $vt_func;
+        ++ $num_ro;
+
+        $decls [ $num_thunks + 1 ] = $decl;
+        $thunks [ $num_thunks + 1 ] = $thunk;
+        ++ $num_thunks;
+    }
+}
+
+# create warning comment
+$warn_cmt = "/* THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT */\n";
+
+# write include file
+if ( $h_out )
+{
+    $def = "_h_$h_out";
+    $def =~ s/\.h$//;
+    $def .= '_';
+    $def =~ s/[\/-]/_/g;
+    print $H "$warn_cmt\n#ifndef $def\n#define $def\n\n";
+
+    while ( $src_file = shift @src_files )
+    {
+        $src_def = "_h_$src_file";
+        $src_def =~ s/\.h$//;
+        $src_def .= '_';
+        $src_def =~ s/[\/-]/_/g;
+        print $H "#ifndef $src_def\n#include <$src_file>\n#endif\n\n";
+    }
+
+    print $H "#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n";
+
+    while ( $decl = shift @decls )
+    {
+        print $H "$decl;\n"
+    }
+
+    print $H "\n#ifdef __cplusplus\n}\n#endif\n\n";
+
+    print $H "#endif /* $def */\n";
+
+    close $H;
+}
+
+# write thunk file
+if ( $h_out )
+{
+    print $C "$warn_cmt\n#include \"$h_out\"\n";
+}
+else
+{
+    print $C "$warn_cmt\n#include \"kqsh-$module.h\"\n";
+}
+print $C "#include \"kqsh-priv.h\"\n";
+print $C "#include <klib/rc.h>\n";
+print $C "#include <assert.h>\n\n";
+
+# read-only messages
+print $C "static const char *$module" . "_msgs [] =\n{\n";
+while ( $msg = shift @msgs )
+{
+    print $C "    \"$msg\",\n";
+}
+print $C "    NULL\n};\n\n";
+
+# read-only vtable
+print $C "static union\n{\n";
+print $C "    fptr_t slots [ sizeof $module" . "_msgs / sizeof $module" . "_msgs [ 0 ] - 2 ];\n\n";
+print $C "    struct\n    {\n";
+while ( $vt_func = shift @cvt )
+{
+    print $C "        $vt_func;\n"
+}
+print $C "    } f;\n\n} $module" . "_cvt;\n\n";
+
+# update messages
+print $C "static const char *$module" . "_wmsgs [] =\n{\n";
+while ( $msg = shift @wmsgs )
+{
+    print $C "    \"$msg\",\n";
+}
+print $C "    NULL\n};\n\n";
+
+# update vtable
+print $C "static union\n{\n";
+print $C "    fptr_t slots [ sizeof $module" . "_wmsgs / sizeof $module" . "_wmsgs [ 0 ] - 1 ];\n\n";
+print $C "    struct\n    {\n";
+while ( $vt_func = shift @wvt )
+{
+    print $C "        $vt_func;\n"
+}
+print $C "    } f;\n\n} $module" . "_wvt;\n\n";
+
+# libdata
+print $C "kqsh_libdata $module" . "_data =\n{\n";
+print $C "    NULL, NULL,\n";
+print $C "    $module" . "_msgs, $module" . "_cvt . slots,\n";
+print $C "    $module" . "_wmsgs, $module" . "_wvt . slots\n";
+print $C "};\n\n";
+
+# special library construct thunk
+$thunk = shift @thunks;
+ at lines = split ( '\n', $thunk );
+print $C $lines [ 0 ] . "\n{\n";
+print $C "    if ( sizeof $module" . "_cvt . slots != sizeof $module" . "_cvt . f ||\n";
+print $C "         sizeof $module" . "_wvt . slots != sizeof $module" . "_wvt . f )\n";
+print $C "    {\n";
+print $C "        * $mgr = NULL;\n";
+print $C "        return RC ( rcExe, rcMgr, rcConstructing, rcInterface, rcCorrupt );\n";
+print $C "    }\n\n";
+print $C $lines [ 2 ] . "\n";
+print $C $lines [ 3 ] . "\n";
+print $C "}\n\n";
+
+# remainder of thunks
+while ( $thunk = shift @thunks )
+{
+    print $C "$thunk\n\n";
+}
diff --git a/tools/kqsh/kqsh-tok.c b/tools/kqsh/kqsh-tok.c
new file mode 100644
index 0000000..0be5a65
--- /dev/null
+++ b/tools/kqsh/kqsh-tok.c
@@ -0,0 +1,99 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "kqsh-tok.h"
+#include "kqsh-priv.h"
+
+#include <klib/symbol.h>
+#include <klib/symtab.h>
+#include <klib/token.h>
+
+#include <kfs/dyload.h>
+#include <klib/log.h>
+#include <klib/rc.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+
+/* next_token
+ */
+KToken *next_token ( struct KSymTable const *tbl, KTokenSource *src, KToken *t )
+{
+    if ( KTokenizerNext ( kDefaultTokenizer, src, t ) -> id == eIdent )
+    {
+        KSymbol *sym = KSymTableFind ( tbl, & t -> str );
+        t -> sym = sym;
+        if ( sym != NULL )
+            t -> id = sym -> type;
+    }
+
+    return t;
+}
+
+KToken *next_shallow_token ( struct KSymTable const *tbl, KTokenSource *src, KToken *t )
+{
+    if ( KTokenizerNext ( kDefaultTokenizer, src, t ) -> id == eIdent || t -> id == eName )
+    {
+        KSymbol *sym = KSymTableFindShallow ( tbl, & t -> str );
+        t -> sym = sym;
+        if ( sym != NULL )
+            t -> id = sym -> type;
+    }
+
+    return t;
+}
+
+/* expected
+ */
+rc_t expected ( const KToken *self, KLogLevel lvl, const char *expected )
+{
+    String eof;
+    const String *str = & self -> str;
+
+    if ( self -> id == eEndOfInput )
+    {
+        CONST_STRING ( & eof, "EOF" );
+        str = & eof;
+    }
+
+    if ( interactive )
+        kqsh_printf ( "expected '%s' but found '%S'\n", expected, str );
+    else
+    {
+        PLOGMSG ( lvl, ( lvl, "$(file):$(lineno): "
+                         "expected '$(expected)' but found '$(found)'",
+                         "file=%.*s,lineno=%u,expected=%s,found=%.*s"
+                         , ( int ) self -> txt -> path . size, self -> txt -> path . addr
+                         , self -> lineno
+                         , expected
+                         , ( int ) str -> size, str -> addr ));
+    }
+
+    return RC ( rcExe, rcText, rcParsing, rcToken, rcUnexpected );
+}
diff --git a/tools/kqsh/kqsh-tok.h b/tools/kqsh/kqsh-tok.h
new file mode 100644
index 0000000..121899f
--- /dev/null
+++ b/tools/kqsh/kqsh-tok.h
@@ -0,0 +1,155 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_kqsh_tok_
+#define _h_kqsh_tok_
+
+#ifndef _h_klib_token_
+#include <klib/token.h>
+#endif
+
+#ifndef _h_klib_log_
+#include <klib/log.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+/*--------------------------------------------------------------------------
+ * forwards
+ */
+struct KSymTable;
+
+
+/*--------------------------------------------------------------------------
+ * kqsh tokens
+ */
+enum kqsh_tokens
+{
+    /* alphabetical list of commands */
+    kw_add = eNumSymtabIDs,
+    kw_alias,
+    kw_alter,
+    kw_as,
+    kw_at,
+    kw_close,
+    kw_column,
+    kw_columns,
+    kw_commands,
+    kw_compact,
+    kw_constants,
+    kw_create,
+    kw_cursor,
+    kw_database,
+    kw_databases,
+    kw_delete,
+    kw_drop,
+    kw_execute,
+    kw_exit,
+    kw_for,
+    kw_formats,
+    kw_functions,
+    kw_help,
+    kw_include,
+    kw_initialize,
+    kw_insert,
+    kw_kdb,
+    kw_library,
+    kw_load,
+    kw_manager,
+    kw_metadata,
+    kw_objects,
+    kw_on,
+    kw_open,
+    kw_or,
+    kw_path,
+    kw_quit,
+    kw_rename,
+    kw_replace,
+    kw_row,
+    kw_schema,
+    kw_show,
+    kw_sra,
+    kw_table,
+    kw_tables,
+    kw_text,
+    kw_types,
+    kw_typesets,
+    kw_update,
+    kw_use,
+    kw_using,
+    kw_version,
+    kw_vdb,
+    kw_with,
+    kw_write,
+
+    rsrv_first,
+    /* reserved names */
+    rsrv_kmgr = rsrv_first,
+    rsrv_vmgr,
+    rsrv_sramgr,
+    rsrv_srapath,
+
+    obj_first,
+    /* object types */
+    obj_KDBManager = obj_first,
+    obj_VDBManager,
+    obj_SRAManager,
+    obj_VSchema,
+    obj_KTable,
+    obj_VTable,
+    obj_VCursor,
+
+    /* accepted abbreviations */
+    kw_col = kw_column,
+    kw_cols = kw_columns,
+    kw_db = kw_database,
+    kw_dbs = kw_databases,
+    kw_exec = kw_execute,
+    kw_init = kw_initialize,
+    kw_lib = kw_library,
+    kw_mgr = kw_manager,
+    kw_tbl = kw_table
+};
+
+/* next_token
+ */
+KToken *next_token ( struct KSymTable const *tbl, KTokenSource *src, KToken *t );
+KToken *next_shallow_token ( struct KSymTable const *tbl, KTokenSource *src, KToken *t );
+
+/* expected
+ */
+rc_t expected ( const KToken *self, KLogLevel lvl, const char *expected );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _h_kqsh_tok_ */
diff --git a/tools/kqsh/kqsh-write.c b/tools/kqsh/kqsh-write.c
new file mode 100644
index 0000000..2e63262
--- /dev/null
+++ b/tools/kqsh/kqsh-write.c
@@ -0,0 +1,321 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "kqsh-priv.h"
+#include "kqsh-tok.h"
+#include "kqsh-kdb.h"
+#include "kqsh-vdb.h"
+
+#include <klib/symbol.h>
+#include <klib/symtab.h>
+#include <klib/token.h>
+
+#include <kfs/directory.h>
+#include <klib/log.h>
+#include <klib/vector.h>
+#include <klib/rc.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+
+/* write_cursor_xxx
+ */
+static
+rc_t kqsh_write_cursor_array ( KSymTable *tbl, KTokenSource *src, KToken *t,
+    const KSymbol *curs, uint32_t idx, const VTypedesc *desc,
+    rc_t ( * write ) ( KSymTable*, KTokenSource*, KToken*, const KSymbol*, uint32_t, const VTypedesc* ) )
+{
+    rc_t rc;
+
+    /* allow empty array */
+    if ( next_token ( tbl, src, t ) -> id == eRightSquare )
+        return 0;
+
+    /* write elements */
+    while ( 1 )
+    {
+        /* write the element */
+        rc = ( * write ) ( tbl, src, t, curs, idx, desc );
+        if ( rc != 0 )
+            break;
+
+        /* punctuation */
+        if ( next_token ( tbl, src, t ) -> id != eComma )
+            break;
+
+        /* next element */
+        next_token ( tbl, src, t );
+    }
+
+    /* expect ']' */
+    if ( rc == 0 && t -> id != eRightSquare )
+        rc = expected ( t, klogErr, "]" );
+
+    return rc;
+}
+
+static
+rc_t kqsh_write_cursor_bool ( KSymTable *tbl, KTokenSource *src, KToken *t,
+    const KSymbol *curs, uint32_t idx, const VTypedesc *desc )
+{
+    if ( t -> id == eLeftSquare )
+        return kqsh_write_cursor_array ( tbl, src, t, curs, idx, desc, kqsh_write_cursor_bool );
+
+    assert ( desc -> intrinsic_bits == 8 );
+    return -1;
+}
+
+static
+rc_t kqsh_write_cursor_uint ( KSymTable *tbl, KTokenSource *src, KToken *t,
+    const KSymbol *curs, uint32_t idx, const VTypedesc *desc )
+{
+    if ( t -> id == eLeftSquare )
+        return kqsh_write_cursor_array ( tbl, src, t, curs, idx, desc, kqsh_write_cursor_uint );
+    return -1;
+}
+
+static
+rc_t kqsh_write_cursor_int ( KSymTable *tbl, KTokenSource *src, KToken *t,
+    const KSymbol *curs, uint32_t idx, const VTypedesc *desc )
+{
+    if ( t -> id == eLeftSquare )
+        return kqsh_write_cursor_array ( tbl, src, t, curs, idx, desc, kqsh_write_cursor_int );
+    return -1;
+}
+
+static
+rc_t kqsh_write_cursor_float ( KSymTable *tbl, KTokenSource *src, KToken *t,
+    const KSymbol *curs, uint32_t idx, const VTypedesc *desc )
+{
+    if ( t -> id == eLeftSquare )
+        return kqsh_write_cursor_array ( tbl, src, t, curs, idx, desc, kqsh_write_cursor_float );
+    return -1;
+}
+
+static
+rc_t kqsh_write_cursor_ascii ( KSymTable *tbl, KTokenSource *src, KToken *t,
+    const KSymbol *curs, uint32_t idx, const VTypedesc *desc )
+{
+    rc_t rc;
+
+    switch ( t -> id )
+    {
+    case eUntermString:
+    case eUntermEscapedString:
+        return expected ( t, klogErr, "terminated string" );
+    case eString:
+        rc = _VCursorWrite ( ( void* ) curs -> u . obj, idx, 8, t -> str . addr + 1, 0, t -> str . len - 2 );
+        if ( rc == 0 )
+            return 0;
+        break;
+    case eEscapedString:
+        rc = 0;
+        break;
+    default:
+        return expected ( t, klogErr, "string" );
+    }
+
+    if ( rc == 0 )
+    {
+        char buffer [ 256 ], *p = buffer;
+        size_t size = sizeof buffer;
+        if ( t -> str . size >= sizeof buffer )
+        {
+            p = malloc ( size = t -> str . size + 1 );
+            if ( p == NULL )
+                rc = RC ( rcExe, rcCursor, rcWriting, rcMemory, rcExhausted );
+        }
+
+        if ( rc == 0 )
+        {
+            rc = KTokenToString ( t, p, size, & size );
+            if ( rc == 0 )
+                rc = _VCursorWrite ( ( void* ) curs -> u . obj, idx, 8, p, 0, size );
+            if ( p != buffer )
+                free ( p );
+        }
+    }
+
+    if ( rc != 0 )
+    {
+        PLOGERR ( klogInt,  (klogInt, rc,
+                  "failed to write string '$(str)' to cursor '$(curs)' ( $(addr) )"
+                  , "str=%.*s,curs=%.*s,addr=0x%zX"
+                  , ( int ) t -> str . size, t -> str . addr
+                  , ( int ) curs -> name . size, curs -> name . addr
+                  , ( size_t ) curs -> u . obj ));
+   }
+
+    return rc;
+}
+
+static
+rc_t kqsh_write_cursor_unicode ( KSymTable *tbl, KTokenSource *src, KToken *t,
+    const KSymbol *curs, uint32_t idx, const VTypedesc *desc )
+{
+    if ( desc -> intrinsic_bits == 8 )
+        return kqsh_write_cursor_ascii ( tbl, src, t, curs, idx, desc );
+
+    return -1;
+}
+
+/* write_cursor
+ */
+static
+rc_t kqsh_write_cursor ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    rc_t rc = 0;
+    uint32_t idx;
+    VTypedecl td;
+    VTypedesc desc;
+
+    /* have cursor object */
+    KSymbol *curs = t -> sym;
+
+    /* error if read-only */
+    if ( read_only )
+    {
+        rc = RC ( rcExe, rcCursor, rcWriting, rcCursor, rcReadonly );
+        PLOGERR ( klogInt,  (klogInt, rc,
+                  "failed to write to cursor '$(curs)' ( $(addr) )"
+                  , "curs=%.*s,addr=0x%zX"
+                  , ( int ) curs -> name . size, curs -> name . addr
+                  , ( size_t ) curs -> u . obj ));
+        return rc;
+    }
+
+    /* separator */
+    if ( next_token ( tbl, src, t ) -> id != ePeriod )
+        return expected ( t, klogErr, ". <colname> or IDX" );
+
+    /* get column spec */
+    switch ( next_token ( tbl, src, t ) -> id )
+    {
+        /* take integer index */
+    case eDecimal:
+    case eHex:
+    case eOctal:
+        rc = KTokenToU32 ( t, & idx );
+        if ( rc != 0 )
+            return expected ( t, klogErr, "integer column index" );
+        break;
+
+        /* take column name */
+    default:
+        if ( t -> sym == NULL )
+            return expected ( t, klogErr, "column name" );
+    case eIdent:
+        switch ( curs -> type )
+        {
+        case obj_VCursor:
+            rc = _VCursorGetColumnIdx ( curs -> u . obj, & idx, "%.*s",
+                ( int ) t -> str . size, t -> str . addr );
+            break;
+        }
+        if ( rc != 0 )
+        {
+            PLOGERR ( klogInt,  (klogInt, rc,
+                      "failed to write to column '$(col)' on cursor '$(curs)' ( $(addr) )"
+                      , "col=%.*s,curs=%.*s,addr=0x%zX"
+                      , ( int ) t -> str . size, t -> str . addr
+                      , ( int ) curs -> name . size, curs -> name . addr
+                      , ( size_t ) curs -> u . obj ));
+            return rc;
+        }
+        break;
+    }
+
+    /* access column object */
+    switch ( curs -> type )
+    {
+    case obj_VCursor:
+        rc = _VCursorDatatype ( curs -> u . obj, idx, & td, & desc );
+        break;
+    }
+
+    if ( rc != 0 )
+    {
+        PLOGERR ( klogInt,  (klogInt, rc,
+                  "failed to access datatype of column $(idx) on cursor '$(curs)' ( $(addr) )"
+                  , "idx=%u,curs=%.*s,addr=0x%zX"
+                  , idx
+                  , ( int ) curs -> name . size, curs -> name . addr
+                  , ( size_t ) curs -> u . obj ));
+        return rc;
+    }
+
+    /* move on to first token of row */
+    next_token ( tbl, src, t );
+
+    /* switch on datatype */
+    switch ( desc . domain )
+    {
+    case vtdBool:
+        rc = kqsh_write_cursor_bool ( tbl, src, t, curs, idx, & desc );
+        break;
+    case vtdUint:
+        rc = kqsh_write_cursor_uint ( tbl, src, t, curs, idx, & desc );
+        break;
+    case vtdInt:
+        rc = kqsh_write_cursor_int ( tbl, src, t, curs, idx, & desc );
+        break;
+    case vtdFloat:
+        rc = kqsh_write_cursor_float ( tbl, src, t, curs, idx, & desc );
+        break;
+    case vtdAscii:
+        rc = kqsh_write_cursor_ascii ( tbl, src, t, curs, idx, & desc );
+        break;
+    case vtdUnicode:
+        rc = kqsh_write_cursor_unicode ( tbl, src, t, curs, idx, & desc );
+        break;
+    }
+
+    /* expect semicolon */
+    if ( rc == 0 )
+    {
+        if ( next_token ( tbl, src, t ) -> id != eSemiColon )
+            return expected ( t, klogErr, ";" );
+    }
+
+    return rc;
+}
+
+
+/* write
+ */
+rc_t kqsh_write ( KSymTable *tbl, KTokenSource *src, KToken *t )
+{
+    switch ( t -> id )
+    {
+    case obj_VCursor:
+        return kqsh_write_cursor ( tbl, src, t );
+    }
+
+    return expected ( t, klogErr, "cursor" );
+}
diff --git a/tools/kqsh/kqsh.c b/tools/kqsh/kqsh.c
new file mode 100644
index 0000000..47d26fb
--- /dev/null
+++ b/tools/kqsh/kqsh.c
@@ -0,0 +1,530 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "kqsh.vers.h"
+#include "kqsh-priv.h"
+#include "kqsh-tok.h"
+
+#include <klib/container.h>
+#include <klib/symbol.h>
+#include <klib/symtab.h>
+#include <klib/token.h>
+
+#include <kfs/directory.h>
+#include <kfs/file.h>
+#include <kfs/mmap.h>
+#include <kapp/main.h>
+#include <kapp/args.h>
+#include <klib/rc.h>
+#include <klib/log.h>
+#include <klib/out.h>
+#include <klib/status.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+bool read_only;
+bool interactive;
+
+
+/* exec_file
+ *  execute a named file
+ */
+rc_t kqsh_exec_file ( KSymTable *tbl, const String *path )
+{
+    KDirectory *wd;
+    rc_t rc = KDirectoryNativeDir ( & wd );
+    if ( rc != 0 )
+        LOGERR ( klogInt, rc, "failed to open working directory" );
+    else
+    {
+        const KFile *f;
+        rc = KDirectoryOpenFileRead ( wd, & f, "%.*s"
+            , ( int ) path -> size, path -> addr );
+        if ( rc != 0 )
+        {
+            PLOGERR ( klogErr,  (klogErr, rc, "failed to open file '$(path)'", "path=%.*s"
+                                 , ( int ) path -> size, path -> addr ));
+        }
+        else
+        {
+            const KMMap *mm;
+            rc = KMMapMakeRead ( & mm, f );
+            if ( rc != 0 )
+            {
+                PLOGERR ( klogErr,  (klogErr, rc, "failed to map file '$(path)'", "path=%.*s"
+                                     , ( int ) path -> size, path -> addr ));
+            }
+            else
+            {
+                const void *addr;
+                rc = KMMapAddrRead ( mm, & addr );
+                if ( rc != 0 )
+                    LOGERR ( klogInt, rc, "failed to obtain mmap addr" );
+                else
+                {
+                    size_t size;
+                    rc = KMMapSize ( mm, & size );
+                    if ( rc != 0 )
+                        LOGERR ( klogInt, rc, "failed to obtain mmap size" );
+                    else
+                    {
+                        String text;
+                        KTokenText tt;
+                        KTokenSource src;
+
+                        StringInit ( & text, addr, ( size_t ) size,
+                            string_len ( addr, ( size_t ) size ) );
+                        KTokenTextInit ( & tt, & text, path );
+                        KTokenSourceInit ( & src, & tt );
+
+                        rc = kqsh ( tbl, & src );
+                    }
+                }
+
+                KMMapRelease ( mm );
+            }
+
+            KFileRelease ( f );
+        }
+
+        KDirectoryRelease ( wd );
+    }
+
+    return rc;
+}
+
+/* init_symtable
+ *  initialize tool table
+ */
+static
+rc_t kqsh_init_keywords ( KSymTable *tbl )
+{
+    int i;
+    static struct
+    {
+        const char *keyword;
+        int id;
+    } kw [] =
+    {
+#define KEYWORD( word ) \
+        { # word, kw_ ## word }
+#define RESERVED( word ) \
+        { # word, rsrv_ ## word }
+
+        /* keywords */
+        KEYWORD ( add ),
+        KEYWORD ( alias ),
+        KEYWORD ( alter ),
+        KEYWORD ( as ),
+        KEYWORD ( at ),
+        KEYWORD ( close ),
+        KEYWORD ( column ),
+        KEYWORD ( columns ),
+        KEYWORD ( commands ),
+        KEYWORD ( compact ),
+        KEYWORD ( constants ),
+        KEYWORD ( create ),
+        KEYWORD ( cursor ),
+        KEYWORD ( database ),
+        KEYWORD ( databases ),
+        KEYWORD ( delete ),
+        KEYWORD ( drop ),
+        KEYWORD ( execute ),
+        KEYWORD ( exit ),
+        KEYWORD ( for ),
+        KEYWORD ( formats ),
+        KEYWORD ( functions ),
+        KEYWORD ( help ),
+        KEYWORD ( include ),
+        KEYWORD ( initialize ),
+        KEYWORD ( insert ),
+        KEYWORD ( kdb ),
+        KEYWORD ( library ),
+        KEYWORD ( load ),
+        KEYWORD ( manager ),
+        KEYWORD ( metadata ),
+        KEYWORD ( objects ),
+        KEYWORD ( on ),
+        KEYWORD ( open ),
+        KEYWORD ( or ),
+        KEYWORD ( path ),
+        KEYWORD ( quit ),
+        KEYWORD ( rename ),
+        KEYWORD ( replace ),
+        KEYWORD ( row ),
+        KEYWORD ( schema ),
+        KEYWORD ( show ),
+        KEYWORD ( sra ),
+        KEYWORD ( table ),
+        KEYWORD ( tables ),
+        KEYWORD ( text ),
+        KEYWORD ( types ),
+        KEYWORD ( typesets ),
+        KEYWORD ( update ),
+        KEYWORD ( use ),
+        KEYWORD ( using ),
+        KEYWORD ( version ),
+        KEYWORD ( vdb ),
+        KEYWORD ( with ),
+        KEYWORD ( write ),
+
+        /* reserved names */
+        RESERVED ( kmgr ),
+        RESERVED ( vmgr ),
+        RESERVED ( sramgr ),
+        RESERVED ( srapath ),
+
+        /* abbreviations */
+        KEYWORD ( col ),
+        KEYWORD ( cols ),
+        KEYWORD ( db ),
+        KEYWORD ( dbs ),
+        KEYWORD ( exec ),
+        KEYWORD ( init ),
+        KEYWORD ( lib ),
+        KEYWORD ( mgr ),
+        KEYWORD ( tbl )
+
+#undef KEYWORD
+#undef RESERVED
+    };
+
+
+    /* define keywords */
+    for ( i = 0; i < sizeof kw / sizeof kw [ 0 ]; ++ i )
+    {
+        rc_t rc;
+
+        String name;
+        StringInitCString ( & name, kw [ i ] . keyword );
+        rc = KSymTableCreateSymbol ( tbl, NULL, & name, kw [ i ] . id, NULL );
+        if ( rc != 0 )
+            return rc;
+    }
+
+    return 0;
+}
+
+static
+rc_t kqsh_init_symtable ( KSymTable *tbl, BSTree *intrinsic )
+{
+    rc_t rc = KSymTablePushScope ( tbl, intrinsic );
+    if ( rc != 0 )
+        LOGERR ( klogInt, rc, "failed to initialize symbol table" );
+    else
+    {
+        rc = kqsh_init_keywords ( tbl );
+
+        KSymTablePopScope ( tbl );
+    }
+
+    return rc;
+}
+
+
+/* whackobj
+ *  whacks created/opened objects
+ */
+static
+rc_t CC kqsh_read_stdin ( void *data, KTokenText *tt, size_t save )
+{
+    rc_t rc;
+    size_t num_read;
+    const KFile *self = ( const void* ) data;
+
+    /* manage stdin for the process */
+    static uint64_t pos;
+    static char buff [ 4096 ];
+
+    /* save any characters not yet consumed */
+    if ( save != 0 )
+    {
+        assert ( save < sizeof buff );
+        memmove ( buff, & tt -> str . addr [ tt -> str . size - save ], save );
+    }
+
+    /* read as many characters as are available */
+    rc = KFileRead ( self, pos, & buff [ save ], sizeof buff - save, & num_read );
+    if ( rc != 0 )
+        LOGERR ( klogErr, rc, "failed to read stdin" );
+    else
+    {
+        /* reset the buffer in "tt" */
+        tt -> str . addr = buff;
+        tt -> str . size = save + num_read;
+        tt -> str . len = string_len ( buff, save + num_read );
+        pos += num_read;
+    }
+
+    return rc;
+}
+
+/* init_console
+ */
+static
+rc_t kqsh_init_console ( KTokenText *console )
+{
+    const KFile *std_in;
+    rc_t rc = KFileMakeStdIn ( & std_in );
+    if ( rc != 0 )
+        LOGERR ( klogErr, rc, "failed to init stdin" );
+    else
+    {
+        KTokenTextInitCString ( console, "", "stdin" );
+        console -> read = kqsh_read_stdin;
+        console -> data = ( void* ) std_in;
+
+        if ( KFileType ( std_in ) == kfdCharDev )
+            interactive = true;
+    }
+    return rc;
+}
+
+
+/* Version  EXTERN
+ *  return 4-part version code: 0xMMmmrrrr, where
+ *      MM = major release
+ *      mm = minor release
+ *    rrrr = bug-fix release
+ */
+rc_t CC KAppVersion ( void )
+{
+    return KQSH_VERS;
+}
+    
+
+#define OPTION_UPDATE  "update"
+#define OPTION_LIBPATH "lib-path"
+#define ALIAS_UPDATE   "u"
+#define ALIAS_LIBPATH  "l"
+
+static const char * update_usage[] = { "use update managers", NULL };
+static const char * libpath_usage[] = { "add to load library path", NULL };
+
+OptDef MyOptions [] = 
+{
+    { OPTION_UPDATE,  ALIAS_UPDATE,  NULL, update_usage,  0, false, false },
+    { OPTION_LIBPATH, ALIAS_LIBPATH, NULL, libpath_usage, 0, true, false }
+};
+
+const char UsageDefaultName[] = "kqsh";
+
+rc_t CC UsageSummary (const char * progname)
+{
+    return KOutMsg ("\n"
+                    "Usage:\n"
+                    "  %s [ options ] [ file ... ]\n"
+                    "\n", progname);
+}
+
+rc_t CC Usage (const Args * args)
+{
+    const char * progname = UsageDefaultName;
+    const char * fullpath = UsageDefaultName;
+    rc_t rc;
+
+    if (args == NULL)
+        rc = RC (rcApp, rcArgv, rcAccessing, rcSelf, rcNull);
+    else
+        rc = ArgsProgram (args, &fullpath, &progname);
+    if (rc)
+        progname = fullpath = UsageDefaultName;
+
+    UsageSummary (progname);
+
+    KOutMsg ("Options:\n");
+
+    HelpOptionLine (ALIAS_UPDATE, OPTION_UPDATE, NULL, update_usage);
+
+    HelpOptionLine (ALIAS_LIBPATH, OPTION_LIBPATH, "path", libpath_usage);
+
+    HelpOptionsStandard ();
+
+    HelpVersion (fullpath, KAppVersion());
+
+    return rc;
+}
+
+
+/* KMain - EXTERN
+ *  executable entrypoint "main" is implemented by
+ *  an OS-specific wrapper that takes care of establishing
+ *  signal handlers, logging, etc.
+ *
+ *  in turn, OS-specific "main" will invoke "KMain" as
+ *  platform independent main entrypoint.
+ *
+ *  "argc" [ IN ] - the number of textual parameters in "argv"
+ *  should never be < 0, but has been left as a signed int
+ *  for reasons of tradition.
+ *
+ *  "argv" [ IN ] - array of NUL terminated strings expected
+ *  to be in the shell-native character set: ASCII or UTF-8
+ *  element 0 is expected to be executable identity or path.
+ */
+static
+rc_t kqsh_main ( int argc, char *argv [] )
+{
+    rc_t rc;
+    Args *args;
+
+    rc = ArgsMakeAndHandle ( & args, argc, argv, 1, MyOptions,
+        sizeof MyOptions / sizeof MyOptions [ 0 ] );
+    if ( rc == 0 ) do 
+    {
+        uint32_t ix;
+        uint32_t pcount;
+        const char * pc;
+
+        /* did anyone ask to open update managers? */
+        rc = ArgsOptionCount ( args, OPTION_UPDATE, & pcount );
+        if ( rc != 0 )
+        {
+            PLOGERR ( klogInt, ( klogInt, rc, "failed to retrieve '$(option)' option count", "option=" OPTION_UPDATE ) );
+            break;
+        }
+
+        /* record zero count as read-only */
+        read_only = ( pcount == 0 );
+
+        /* did anyone ask to add a custom library search path? */
+        rc = ArgsOptionCount ( args, OPTION_LIBPATH, & pcount );
+        if ( rc != 0 )
+        {
+            PLOGERR ( klogInt, ( klogInt, rc, "failed to retrieve '$(option)' option count", "option=" OPTION_LIBPATH ) );
+            break;
+        }
+
+        /* add each path in order */
+        for ( ix = 0; ix < pcount; ++ ix )
+        {
+            rc = ArgsOptionValue ( args, OPTION_LIBPATH, ix, & pc );
+            if ( rc != 0 )
+            {
+                PLOGERR ( klogInt, ( klogInt, rc, "failed to retrieve '$(option)' option value [ $(idx) ]", "option=" OPTION_LIBPATH ",idx=%u", ix ) );
+                break;
+            }
+
+            rc = kqsh_update_libpath ( pc );
+            if ( rc != 0 )
+                break;
+        }
+
+        /* add system library path */
+        if ( rc == 0 )
+            rc = kqsh_system_libpath ();
+        if ( rc == 0 )
+        {
+            KSymTable tbl;
+
+            BSTree intrinsic;
+            BSTreeInit ( & intrinsic );
+
+            rc = KSymTableInit ( & tbl, & intrinsic );
+            if ( rc != 0 )
+                LOGERR ( klogInt, rc, "failed to initialize symbol table" );
+            else
+            {
+                rc = kqsh_init_symtable ( & tbl, & intrinsic );
+                while ( rc == 0 )
+                {
+                    rc = ArgsParamCount ( args, & pcount );
+                    if ( rc != 0 )
+                    {
+                        LOGERR ( klogInt, rc, "failed to retrieve parameter count" );
+                        break;
+                    }
+
+                    if ( pcount == 0 )
+                    {
+                        KTokenText console;
+                        
+                        rc = kqsh_init_console ( & console );
+                        if ( rc == 0 )
+                        {
+                            KTokenSource src;
+                            
+                            KTokenSourceInit ( & src, & console );
+                                
+                            if ( interactive )
+                            {
+                                uint32_t vers = KAppVersion ();
+                                
+                                kqsh_printf ( "\nkqsh version %u.%u"
+                                              , ( vers >> 24 )
+                                              , ( vers >> 16 ) & 0xFF );
+                                if ( ( vers & 0xFFFF ) != 0 )
+                                    kqsh_printf ( ".%u", vers & 0xFFFF );
+                            }
+                            
+                            rc = kqsh ( & tbl, & src );
+                            KFileRelease ( console . data );
+                        }
+                    }
+            
+                    else for ( ix = 1; ix <= pcount; ++ ix )
+                    {
+                        const char *file = argv [ ix ];
+
+                        String path;
+                        StringInitCString ( & path, file );
+
+                        rc = kqsh_exec_file ( & tbl, & path );
+                        if ( rc != 0 )
+                            break;
+                    }
+
+                    KSymTableWhack ( & tbl );
+                    break; /* never really loop */
+                }
+
+                BSTreeWhack ( & intrinsic, KSymbolWhack, NULL );
+            }
+        }
+
+    } while ( 0 );
+
+    return rc;
+}
+
+rc_t CC KMain ( int argc, char *argv [] )
+{
+    rc_t rc;
+
+    KLogHandlerSetStdErr ();
+    KLogLibHandlerSetStdErr ();
+
+    rc = kqsh_init_libpath ();
+    if ( rc == 0 )
+    {
+        read_only = true;
+        rc = kqsh_main ( argc, argv );
+        kqsh_whack_libpath ();
+    }
+    return rc;
+}
diff --git a/tools/kqsh/kqsh.vers b/tools/kqsh/kqsh.vers
new file mode 100644
index 0000000..8e8299d
--- /dev/null
+++ b/tools/kqsh/kqsh.vers
@@ -0,0 +1 @@
+2.4.2
diff --git a/tools/meta-sync/Makefile b/tools/meta-sync/Makefile
new file mode 100644
index 0000000..372d4b6
--- /dev/null
+++ b/tools/meta-sync/Makefile
@@ -0,0 +1,114 @@
+# ==============================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: std
+
+TOP ?= $(abspath ../..)
+MODULE = tools/meta-sync
+
+include $(TOP)/build/Makefile.env
+
+INT_TOOLS = \
+
+EXT_TOOLS = \
+	meta-sync
+
+ALL_TOOLS = \
+	$(INT_TOOLS) \
+	$(EXT_TOOLS)
+
+#------------------------------------------------------------------------------
+# outer targets
+#
+all std: vers-includes
+	@ $(MAKE_CMD) $(TARGDIR)/$@
+
+$(ALL_TOOLS): vers-includes
+	@ $(MAKE_CMD) $(BINDIR)/$@
+
+.PHONY: all std $(ALL_TOOLS)
+
+#-------------------------------------------------------------------------------
+# all
+#
+$(TARGDIR)/all: \
+	$(addprefix $(BINDIR)/,$(ALL_TOOLS))
+
+.PHONY: $(TARGDIR)/all
+
+#-------------------------------------------------------------------------------
+# std
+#
+$(TARGDIR)/std: \
+	$(addprefix $(BINDIR)/,$(EXT_TOOLS))
+
+.PHONY: $(TARGDIR)/std
+
+#-------------------------------------------------------------------------------
+# vers-includes
+#
+$(TARGDIR)/vers-includes: $(addsuffix .vers.h,$(EXT_TOOLS))
+
+.PHONY: $(TARGDIR)/vers-includes
+
+#-------------------------------------------------------------------------------
+# clean
+#
+clean: stdclean
+
+.PHONY: clean
+
+#-------------------------------------------------------------------------------
+# meta-sync
+#
+META_SYNC_SRC = \
+	meta-sync \
+
+META_SYNC_OBJ = \
+	$(addsuffix .$(OBJX),$(META_SYNC_SRC))
+
+META_SYNC_LIB = \
+	-lkapp \
+	-dvxf \
+	-lsraschema \
+	-lvdb \
+	-lkdb \
+	-ssrapath \
+    -lvfs \
+	-lkxml \
+	-lkfg \
+	-lkfs \
+	-lrdbms \
+	-lklib \
+	-X/export/home/sybase/clients-mssql/current/lib -lct\
+	-lm
+
+meta-sync.vers.h: meta-sync.vers
+	$(TOP)/build/make-vers-inc.sh META_SYNC_VERS $^ > $@
+
+$(BINDIR)/meta-sync: $(META_SYNC_OBJ)
+	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(META_SYNC_LIB)
+
+#-------------------------------------------------------------------------------
diff --git a/tools/meta-sync/meta-sync.c b/tools/meta-sync/meta-sync.c
new file mode 100644
index 0000000..f652b7f
--- /dev/null
+++ b/tools/meta-sync/meta-sync.c
@@ -0,0 +1,1517 @@
+/*******************************************************************************
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * =============================================================================
+ */
+
+#include "meta-sync.vers.h" /* META_SYNC_VERS */
+#include <kapp/main.h>
+#include <sra/srapath.h>
+#include <sra/sraschema.h> /* VDBManagerMakeSRASchema */
+#include <vdb/manager.h> /* VDBManager */
+#include <vdb/database.h> /* VDatabase */
+#include <vdb/table.h> /* VTable */
+#include <vdb/schema.h> /* VSchemaRelease */
+#include <vdb/cursor.h> /* VCursor */
+#include <rdbms/sybase.h> /* SybaseInit */
+#include <kfs/directory.h> /* KDirectory */
+#include <kfs/file.h> /* KFile */
+#include <kxml/xml.h> /* KXMLMgr */
+#include <klib/log.h> /* LOGERR */
+#include <klib/out.h> /* OUTMSG */
+#include <klib/debug.h> /* DBGMSG */
+#include <klib/rc.h> /* RC */
+#include <insdc/sra.h> /* SRA_READ_TYPE_... */
+#include <assert.h>
+#include <stdio.h> /* vspnrintf */
+#include <stdlib.h> /* malloc */
+#include <string.h> /* memset */
+#include <os-native.h> /* strncasecmp on Windows */
+
+#define DISP_RC(rc, msg) (void)((rc == 0) ? 0 : LOGERR(klogInt, rc, msg))
+#define DISP_RC2(rc, name, msg) (void)((rc == 0) ? 0 : \
+    PLOGERR(klogInt, (klogInt,rc, "$(msg): $(name)","msg=%s,name=%s",msg,name)))
+#define DESTRUCT(type, obj) do { rc_t rc2 = type##Release(obj); \
+    if (rc2 && !rc) { rc = rc2; } obj = NULL; } while (false)
+
+enum ECol {
+      eFIXED_SPOT_LEN
+    , eLABEL
+    , eLABEL_LEN
+    , eLABEL_START
+    , eLINKER_SEQUENCE
+/*  , eNREADS */
+    , ePLATFORM
+    , eREAD_LEN
+    , eREAD_START
+    , eREAD_TYPE
+    , eSPOT_GROUP
+    , eSPOT_LEN
+};
+/*enum EType {
+      eUndetected
+    , e454_2
+    , e454_2_AA
+    , e454_4_FollowingLinker
+    , e454_4_ForwardForward
+    , e454_4_RelativeOrder
+    , e454_4_FFLF
+    , eIllumina_1
+};*/
+enum EColType {
+      eAscii
+    , eReadType
+    , eUint8
+    , eUint32
+};
+typedef struct Col {
+    enum ECol type;
+    const char* name;
+    enum EColType datatype;
+    bool isArray;
+    uint32_t idx;
+    char buffer[70];
+    uint32_t row_len;
+    bool exists;
+} Col;
+enum ELabel {
+      eUnsetL
+    , eInvalidF7L
+    , eAdapterL
+    , eBarcodeL
+    , eFL
+    , eF3L
+    , eForwardL
+    , eFragmentL
+    , eLinkerL
+    , eMate1L
+    , eMate2L
+    , eR3L
+    , eReverseL
+    , erRNA_primerL
+};
+enum EReadType {
+      eUnknownRT
+    , eAdapterRT
+    , eBarCodeRT
+    , eForwardRT
+    , eLinkerRT
+    , ePrimerRT
+    , eReverseRT
+};
+#define unsetReadClass -1
+#define MAX_NREADS 5
+typedef struct SReadXml {
+    bool used;
+
+    /* SRA_READ_TYPE_TECHNICAL SRA_READ_TYPE_BIOLOGICAL;
+    unsetReadClass is a special value */
+    int readClass;
+
+    enum EReadType readType;
+} SReadXml;
+typedef struct MetaDataXml {
+    INSDC_SRA_platform_id platform;
+    uint32_t nreads;
+    SReadXml read[MAX_NREADS];
+    bool variableReadLen;
+} MetaDataXml;
+typedef struct SReadDb {
+    bool used;
+                                    /* READ_TYPE */
+    /* SRA_READ_TYPE_TECHNICAL SRA_READ_TYPE_BIOLOGICAL;
+    unsetReadClass is a special value */
+    int readClass; 
+    int readOrientation; /* SRA_READ_TYPE_FORWARD SRA_READ_TYPE_REVERSE */
+    enum ELabel label;              /* LABEL, LABEL_START, LABEL_LEN */
+} SReadDb;
+typedef struct MetaDataDb {
+    INSDC_SRA_platform_id platform; /* PLATFORM */
+    uint32_t nreads;                 /* number of READ_START elements */
+    SReadDb read[MAX_NREADS];
+} MetaDataDb;
+typedef struct CmdLine {
+    bool notFound;
+    const char* tbl;
+	const char* exp;
+	const char* run;
+    const char* acc;
+} CmdLine;
+/* true if differ */
+static bool Compare(const char* sample, const char* test, size_t test_len)
+{
+    if (!sample || !test || !test_len)
+    {   return true; }
+    if (strlen(sample) != test_len)
+    {   return true; }
+    return strncasecmp(test, sample, test_len);
+}
+typedef struct LabelStrEnum {
+    enum ELabel e;
+    const char* s;
+} LabelStrEnum;
+typedef struct PlatfromStrEnum {
+    INSDC_SRA_platform_id e;
+    const char* s;
+} PlatfromStrEnum;
+typedef struct ReadTypeStrEnum {
+    enum EReadType e;
+    const char* s;
+} ReadTypeStrEnum;
+#define TYPE_STR_CONVERT(name, elm, table) \
+    static const char* Enum##name##2Str(elm e) { \
+        int i = 0; \
+        for (i = 0; i < sizeof table / sizeof table[0]; ++i) { \
+            if (table[i].e == e) { return table[i].s; } \
+        } \
+        assert(0); \
+        return NULL; \
+    } \
+    static elm Str##name##2Enum(const char* s) { \
+        int i = 0; \
+        assert(s); \
+        for (i = 0; i < sizeof table / sizeof table[0]; ++i) { \
+            assert(table[i].s); \
+            if (strcmp(table[i].s, s) == 0) { return table[i].e; } \
+        } \
+        assert(0); \
+        return 0; \
+    } \
+    static elm Strn##name##2Enum(const char* s, size_t l) { \
+        int i = 0; \
+        assert(s && l); \
+        for (i = 0; i < sizeof table / sizeof table[0]; ++i) { \
+            assert(table[i].s); \
+            if (!Compare(table[i].s, s, l)) { return table[i].e; } \
+        } \
+     /* printf("Strn" #name "2Enum(%s) failed\n", s); \
+        assert(0); */ \
+        return 0; \
+    }
+#define ENUM_STR_CONVERT(name, elm, table) TYPE_STR_CONVERT(name,enum elm,table)
+static PlatfromStrEnum platforms[] = {
+      { SRA_PLATFORM_454              , "LS454"             }
+    , { SRA_PLATFORM_ABSOLID          , "ABI_SOLID"         }
+    , { SRA_PLATFORM_COMPLETE_GENOMICS, "COMPLETE_GENOMICS" }
+    , { SRA_PLATFORM_HELICOS          , "HELICOS"           }
+    , { SRA_PLATFORM_ILLUMINA         , "ILLUMINA"          }
+    , { SRA_PLATFORM_PACBIO_SMRT      , "PACBIO_SMRT"       }
+};
+TYPE_STR_CONVERT(Platform, INSDC_SRA_platform_id, platforms)
+static ReadTypeStrEnum readTypes[] = {
+      { eAdapterRT, "Adapter" }
+    , { eBarCodeRT, "Barcode" }
+    , { eForwardRT, "Forward" }
+    , { eLinkerRT , "Linker"  }
+    , { ePrimerRT , "Primer"  }
+    , { eReverseRT, "Reverse" }
+};
+ENUM_STR_CONVERT(ReadType, EReadType, readTypes)
+static LabelStrEnum labels[] = {
+      { eAdapterL,     "Adapter"     }
+    , { eBarcodeL    , "Barcode"     }
+    , { eFL          , "F"           }
+    , { eF3L         , "F3"          }
+    , { eForwardL    , "Fragment"    }
+    , { eFragmentL   , "Forward"     }
+    , { eLinkerL     , "Linker"      }
+    , { eMate1L      , "Mate1"       }
+    , { eMate2L      , "Mate2"       }
+    , { eR3L         , "R3"          }
+    , { eReverseL    , "Reverse"     }
+    , { erRNA_primerL, "Rrna_primer" }
+};
+ENUM_STR_CONVERT(Label, ELabel, labels)
+static rc_t ParseSpotDesc(const KXMLNode* nodeSpotDesc,
+    MetaDataXml* md)
+{
+    rc_t rc = 0;
+    const KXMLNodeset* eNs = NULL;
+    assert(nodeSpotDesc);
+    if (rc == 0) {
+        uint32_t i = 0;
+        const char path[] = "SPOT_DECODE_SPEC/READ_SPEC";
+        rc = KXMLNodeOpenNodesetRead(nodeSpotDesc, &eNs, path);
+        DISP_RC2(rc, path, "while opening Nodeset");
+        if (rc == 0) {
+            uint32_t n = 0;
+            rc = KXMLNodesetCount(eNs, &n);
+            DISP_RC2(rc, path, "while counting Nodeset");
+            if (rc == 0) {
+                DBGMSG(DBG_APP, DBG_COND_1, ("READ_SPEC Count = %d\n", n));
+                md->nreads = n;
+            }
+            for (i = 0; i < n && rc == 0; ++i) {
+                const KXMLNode* node = NULL;
+                rc = KXMLNodesetGetNodeRead(eNs, &node, i);
+                if (rc != 0) {
+                    PLOGERR(klogInt, (klogInt, rc,
+                        "while reading node $(n) of $(path)", "n=%d,path=%s",
+                        i, path));
+                }
+                else {
+                    uint32_t index = UINT32_MAX;
+                    char* rclass = NULL;
+                    char* rtype = NULL;
+                    uint32_t j, c = 0;
+                    rc = KXMLNodeCountChildNodes(node, &c);
+                    DISP_RC2(rc, path, "while counting Children");
+                    for (j = 0; j < c && rc == 0; ++j) {
+                        const KXMLNode* child;
+                        rc = KXMLNodeGetNodeRead(node, &child, j);
+                        if (rc != 0) {
+                            PLOGERR(klogInt, (klogInt, rc,
+                                "while reading child $(n) of $(path)",
+                                "n=%d,path=%s", j, path));
+                        }
+                        else {
+                            const char* name = NULL;
+                            rc = KXMLNodeElementName(child, &name);
+                            if (rc != 0) {
+                                PLOGERR(klogInt, (klogInt, rc,
+                                  "while reading name of child $(n) of $(path)",
+                                  "n=%d,path=%s", j, path));
+                            }
+                            else {
+                                if (!strcmp(name, "BASE_COORD")) {
+                                }
+                                else if (!strcmp(name,
+                                    "EXPECTED_BASECALL"))
+                                {}
+                                else if (!strcmp(name,
+                                    "EXPECTED_BASECALL_TABLE"))
+                                {}
+                                else if (!strcmp(name, "READ_CLASS")) {
+                                    rc = KXMLNodeReadCStr(child, &rclass, NULL);
+                                    DISP_RC2(rc, name, "reading as CString");
+                                    DBGMSG(DBG_APP, DBG_COND_1,
+                                        ("%d %s %s\n", i, name, rclass));
+                                }
+                                else if (!strcmp(name, "READ_INDEX")) {
+                                    rc = KXMLNodeReadAsU32(child, &index);
+                                    DISP_RC2(rc, name, "reading as U32");
+                                    DBGMSG(DBG_APP, DBG_COND_1,
+                                        ("%d %s %d\n", i, name, index));
+                                }
+                                else if (!strcmp(name, "READ_LABEL")) {
+                                }
+                                else if (!strcmp(name, "READ_TYPE")) {
+                                    rc = KXMLNodeReadCStr(child, &rtype, NULL);
+                                    DISP_RC2(rc, name, "reading as CString");
+                                    DBGMSG(DBG_APP, DBG_COND_1,
+                                        ("%d %s %s\n", i, name, rtype));
+                                }
+                                else if (!strcmp(name, "RELATIVE_ORDER")) {
+                                }
+                                else {
+                                    rc = RC(rcExe, rcXmlDoc,
+                                        rcParsing, rcName, rcUnexpected);
+                                    PLOGERR(klogInt, (klogInt, rc,
+                                        "$(name)", "name=%s", name));
+                                }
+                            }
+                        }
+                        {
+                            rc_t rc2 = KXMLNodeRelease(child);
+                            if (rc2 && !rc)
+                            {   rc = rc2; }
+                            child = NULL;
+                        }
+                    }
+                    if (rc == 0) {
+                        /*if (bsCoord && expBCall) {
+                            rc = RC(rcExe,
+                                rcXmlDoc, rcParsing, rcData, rcInvalid);
+                            LOGERR(klogInt, rc,
+                                "both BASE_COORD and EXPECTED_BASECALL "
+                                "are present");
+                        }
+                        else*/ if (index == UINT32_MAX
+                            || index >= sizeof md->read / sizeof md->read[0]
+                            || md->read[index].used)
+                        {
+                            RC(rcExe, rcXmlDoc, rcParsing, rcData, rcDuplicate);
+                            PLOGERR(klogInt, (klogInt, rc,
+                                "READ_INDEX $(i)", "i=%d", index));
+                        }
+                        /*else if (bsCoord) {
+                            DBGMSG(DBG_APP, DBG_COND_1, ("%d %s %s bk=%d\n",
+                                index, rclass, rtype, bsCoord));
+                            md->read[index].baseCoord = bsCoord;
+                        }
+                        else if (expBCall) {
+                            md->read[index].expectedBaseCall = expBCall;
+                            DBGMSG(DBG_APP, DBG_COND_1,
+                               ("%d %s %s eb=%s(%lu)\n", index,
+                                rclass, rtype, expBCall, strlen(expBCall)));
+                        }
+                        else if (reltOrder) {
+                            md->read[index].relativeOrder = true;
+                        }
+                        else {
+                            rc = RC(rcExe,
+                                rcXmlDoc, rcParsing, rcData, rcUnexpected);
+                            LOGERR(klogInt, rc,
+                                "XML Read coordinates were not recognized");
+                        }*/
+                    }
+                    if (rc == 0) {
+                        SReadXml* r = &md->read[index];
+                        int readClass = unsetReadClass;
+                        enum EReadType readType = eUnknownRT;
+
+                        r->used = true;
+
+                        if (!strcmp(rclass, "Technical Read"))
+                        {   readClass = SRA_READ_TYPE_TECHNICAL; }
+                        else if (!strcmp(rclass, "Application Read"))
+                        {   readClass = SRA_READ_TYPE_BIOLOGICAL; }
+                        r->readClass = readClass;
+
+/*                      readType = ; TODO */
+                        if (!strcmp(rtype, "Adapter"))
+                        {   readType = eAdapterRT; }
+                        else if (!strcmp(rtype, "BarCode"))
+                        {   readType = eBarCodeRT; }
+                        else if (!strcmp(rtype, "Forward"))
+                        {   readType = eForwardRT; }
+                        else if (!strcmp(rtype, "Linker"))
+                        {   readType = eLinkerRT; }
+                        else if (!strcmp(rtype, "Primer"))
+                        {   readType = ePrimerRT; }
+                        else if (!strcmp(rtype, "Reverse"))
+                        {   readType = eReverseRT; }
+                        else {
+                            rc = RC(rcExe,
+                                rcXmlDoc, rcParsing, rcData, rcUnexpected);
+                            PLOGERR(klogInt, (klogInt, rc,
+                                "READ_TYPE value: $(val)", "val=%s", rtype));
+                        }
+                        r->readType = readType;
+                    }
+                }
+                {
+                    rc_t rc2 = KXMLNodeRelease(node);
+                    if (rc2 && !rc)
+                    {   rc = rc2; }
+                    node = NULL;
+                }
+            }
+        }
+        for (i = 0; i < md->nreads && rc == 0; ++i) {
+            SReadXml* r = &md->read[i];
+            if (!r->used) {
+                rc = RC(rcExe, rcXmlDoc, rcParsing, rcData, rcInconsistent);
+                PLOGERR(klogInt,
+                    (klogInt, rc, "READ_INDEX $(i)", "i=%d", i));
+            }
+        }
+    }
+    DESTRUCT(KXMLNodeset, eNs);
+    return rc;
+}
+
+static rc_t ParseXml(const KXMLDoc* exp, const KXMLDoc* run,
+    MetaDataXml* md)
+{
+    rc_t rc = 0;
+    const KXMLNode* nodeExp = NULL;
+    const KXMLNode* nodeSpotDesc = NULL;
+    assert(exp && run && md);
+    if (rc == 0) {
+        const KXMLNodeset* ns = NULL;
+        const char runNode[] = "/RUN/SPOT_DESCRIPTOR";
+        rc = KXMLDocOpenNodesetRead(run, &ns, runNode);
+        DISP_RC2(rc, runNode, "while opening Nodeset");
+        if (rc == 0) {
+            uint32_t n = 0;
+            rc = KXMLNodesetCount(ns, &n);
+            DISP_RC2(rc, runNode, "while counting Nodeset");
+            if (rc == 0) {
+                if (n > 1) {
+                    rc = RC(rcExe, rcXmlDoc, rcReading, rcNode, rcExcessive);
+                    PLOGERR(klogInt, (klogInt, rc,
+                        "$(path) in run XML", "path=%s", runNode));
+                }
+                else if (n == 1) {
+                    rc = KXMLNodesetGetNodeRead(ns, &nodeSpotDesc, 0);
+                    if (rc == 0) {
+                        DBGMSG(DBG_APP, DBG_COND_1,
+                            ("Use RUN SPOT_DECSRIPTOR\n"));
+                        rc = ParseSpotDesc(nodeSpotDesc, md);
+                    }
+                }
+            }
+        }
+        DESTRUCT(KXMLNodeset, ns);
+    }
+    if (rc == 0) {
+        const char path[] = "/EXPERIMENT";
+        const KXMLNodeset* ns = NULL;
+        rc = KXMLDocOpenNodesetRead(exp, &ns, path);
+        DISP_RC2(rc, path, "while opening Nodeset");
+        if (rc == 0) {
+            rc = KXMLNodesetGetNodeRead(ns, &nodeExp, 0);
+            DISP_RC2(rc, path, "while accessing Node 0");
+        }
+    }
+    if (rc == 0) {
+        const char path[] = "PLATFORM";
+        const KXMLNode* node = NULL;
+        rc = KXMLNodeGetFirstChildNodeRead(nodeExp, &node, path);
+        DISP_RC2(rc, path, "while accessing first Node");
+        if (rc == 0) {
+            const KNamelist* children = NULL;
+            rc = KXMLNodeListChild(node, &children);
+            DISP_RC2(rc, path, "while listing children");
+            if (rc == 0) {
+                const char* name = NULL;
+                rc = KNamelistGet(children, 0, &name);
+                DISP_RC2(rc, path, "while getting child[0]");
+                if (rc == 0) {
+                    DBGMSG(DBG_APP, DBG_COND_1, ("PLATFORM = %s\n", name));
+                    md->platform = StrPlatform2Enum(name);
+                    if (md->platform == SRA_PLATFORM_UNDEFINED) {
+                        rc = RC(rcExe,
+                            rcXmlDoc, rcParsing, rcId, rcUnrecognized);
+                        DISP_RC2(rc, name, "PLATFORM");
+                    }
+                }
+            }
+        }
+    }
+    if (rc == 0 && nodeSpotDesc == NULL) {
+        const char path[] = "DESIGN/SPOT_DESCRIPTOR";
+        rc = KXMLNodeGetFirstChildNodeRead(nodeExp, &nodeSpotDesc, path);
+        DISP_RC2(rc, path, "while accessing first Node");
+        if (rc == 0) {
+            DBGMSG(DBG_APP, DBG_COND_1, ("Use EXPERIMENT SPOT_DESCRIPTOR\n"));
+            rc = ParseSpotDesc(nodeSpotDesc, md);
+        }
+    }
+    DESTRUCT(KXMLNode, nodeExp);
+    DESTRUCT(KXMLNode, nodeSpotDesc);
+    return rc;
+}
+
+static void ReportDiff(const CmdLine* aArgs, const MetaDataXml* xml,
+    const char *format, ...)
+{
+    static bool called = false;
+    char buffer[256];
+    va_list args;
+    va_start(args, format);
+    assert(aArgs && xml && format);
+    if (!called) {
+        called = true;
+        OUTMSG(("%s %s ", aArgs->acc, EnumPlatform2Str(xml->platform)));
+    }
+    else { OUTMSG((" ")); }
+    vsnprintf(buffer, sizeof buffer, format, args);
+    OUTMSG((buffer));
+    va_end(args);
+}
+
+static bool AnalyzeNReport(const MetaDataDb* db, const MetaDataXml* xml,
+    const CmdLine* args)
+{
+    ReportDiff(args, xml, "NREADS(X:%d/M:%d)", xml->nreads, db->nreads);
+    if (db->platform == SRA_PLATFORM_ABSOLID
+        && xml->nreads == 2 && db->nreads == 1
+        && xml->read[0].readClass == SRA_READ_TYPE_BIOLOGICAL
+        && xml->read[0].readType == eForwardRT
+        && xml->read[1].readClass == SRA_READ_TYPE_BIOLOGICAL
+        && xml->read[1].readType == eForwardRT
+        && db ->read[0].readClass == SRA_READ_TYPE_BIOLOGICAL
+        && db ->read[0].readOrientation == 0
+        &&(db ->read[0].label == eF3L || db ->read[0].label == eR3L)
+    ) /* 1/2: BioFw,BioFw / BioF3|R3 */
+    {   ReportDiff(args, xml, "[FF-F]"); } /* ForwardForward-Fwd */
+    else if (db->platform == SRA_PLATFORM_454
+        && xml->nreads == 1 && db->nreads == 2
+        && xml->read[0].readClass == SRA_READ_TYPE_BIOLOGICAL
+        && xml->read[0].readType == eForwardRT
+        && db ->read[0].readClass == SRA_READ_TYPE_TECHNICAL
+        && db ->read[0].readOrientation == 0
+        && db ->read[0].label == eAdapterL
+        && db ->read[1].readClass == SRA_READ_TYPE_BIOLOGICAL
+        && db ->read[1].readOrientation == 0
+        && db ->read[1].label == eFragmentL
+    ) /* 1/2: BioFw / TecAda,BioFra */
+    {   ReportDiff(args, xml, "[F-AF]"); } /* Forward-AdapterFragment */
+    else if (db->platform == SRA_PLATFORM_454
+        && xml->nreads == 3 && db->nreads == 2
+        && xml->read[0].readClass == SRA_READ_TYPE_TECHNICAL
+        && xml->read[0].readType == eAdapterRT
+        && xml->read[1].readClass == SRA_READ_TYPE_TECHNICAL
+        && xml->read[1].readType == eBarCodeRT
+        && xml->read[2].readClass == SRA_READ_TYPE_BIOLOGICAL
+        && xml->read[2].readType == eForwardRT
+        && db ->read[0].readClass == SRA_READ_TYPE_TECHNICAL
+        && db ->read[0].readOrientation == 0
+        && db ->read[0].label == eAdapterL
+        && db ->read[1].readClass == SRA_READ_TYPE_BIOLOGICAL
+        && db ->read[1].readOrientation == 0
+        && db ->read[1].label == eFragmentL
+    ) /* 3/2: TecAd,TecBc,BioFw / TecAda,BioFra */
+    {   ReportDiff(args, xml, "[BF]"); } /* BarcodeForward */
+    else if (db->platform == SRA_PLATFORM_454
+        && xml->nreads == 3 && db->nreads == 2
+        && xml->read[0].readClass == SRA_READ_TYPE_TECHNICAL
+        && xml->read[0].readType == eAdapterRT
+        && xml->read[1].readClass == SRA_READ_TYPE_TECHNICAL
+        && xml->read[1].readType == ePrimerRT
+        && xml->read[2].readClass == SRA_READ_TYPE_BIOLOGICAL
+        && xml->read[2].readType == eAdapterRT
+        && db ->read[0].readClass == SRA_READ_TYPE_TECHNICAL
+        && db ->read[0].readOrientation == 0
+        && db ->read[0].label == eAdapterL
+        && db ->read[1].readClass == SRA_READ_TYPE_BIOLOGICAL
+        && db ->read[1].readOrientation == 0
+        && db ->read[1].label == eFragmentL
+    ) /* 3/2: TecAd,TecPr,BioAd / TecAda,BioFra */
+    {   ReportDiff(args, xml, "[PA]"); } /* PrimerAdapter */
+    else if (db->platform == SRA_PLATFORM_454
+        && xml->nreads == 4 && db->nreads == 2
+        && xml->read[0].readClass == SRA_READ_TYPE_TECHNICAL
+        && xml->read[1].readClass == SRA_READ_TYPE_BIOLOGICAL
+        && xml->read[1].readType == eForwardRT
+        && xml->read[2].readClass == SRA_READ_TYPE_TECHNICAL
+        && xml->read[2].readType == eLinkerRT
+        && xml->read[3].readClass == SRA_READ_TYPE_BIOLOGICAL
+        && db ->read[0].readClass == SRA_READ_TYPE_TECHNICAL
+        && db ->read[0].readOrientation == 0
+        && db ->read[0].label == eAdapterL
+        && db ->read[1].readClass == SRA_READ_TYPE_BIOLOGICAL
+        && db ->read[1].readOrientation == 0
+        && db ->read[1].label == eFragmentL
+        && (xml->read[0].readType == eAdapterRT ||
+            xml->read[0].readType == eForwardRT)
+        && (xml->read[3].readType == eForwardRT ||
+            xml->read[3].readType == eReverseRT)
+    ) /* 4/2: TecAd|Fw,BioFw,TecLn,BioFw|Rv, TecAda,BioFra */
+    {   ReportDiff(args, xml, "[FLF]"); } /* ForwardLinkerForward */
+    else if (db->platform == SRA_PLATFORM_454
+        && xml->nreads == 5 && db->nreads == 2
+        && xml->read[0].readClass == SRA_READ_TYPE_TECHNICAL
+        && xml->read[0].readType == eAdapterRT
+        && xml->read[1].readClass == SRA_READ_TYPE_TECHNICAL
+        && xml->read[1].readType == eBarCodeRT
+        && xml->read[2].readClass == SRA_READ_TYPE_BIOLOGICAL
+        && xml->read[2].readType == eForwardRT
+        && xml->read[3].readClass == SRA_READ_TYPE_TECHNICAL
+        && xml->read[3].readType == eLinkerRT
+        && xml->read[4].readClass == SRA_READ_TYPE_BIOLOGICAL
+        && xml->read[4].readType == eReverseRT
+        && db ->read[0].readClass == SRA_READ_TYPE_TECHNICAL
+        && db ->read[0].readOrientation == 0
+        && db ->read[0].label == eAdapterL
+        && db ->read[1].readClass == SRA_READ_TYPE_BIOLOGICAL
+        && db ->read[1].readOrientation == 0
+        && db ->read[1].label == eFragmentL
+    ) /* 5/2: TecAd,TecBc,BioFw,TecLn,BioRv / TecAda,BioFra */
+    /* BarcodeForwardLinkerReverse-Fragment */
+    {   ReportDiff(args, xml, "[BFLR-F]"); }
+    else if (db->platform == SRA_PLATFORM_454
+        && xml->nreads == 2 && db->nreads == 4
+        && xml->read[0].readClass == SRA_READ_TYPE_TECHNICAL
+        && xml->read[0].readType == eAdapterRT
+        && xml->read[1].readClass == SRA_READ_TYPE_BIOLOGICAL
+        && xml->read[1].readType == eForwardRT
+        && db ->read[0].readClass == SRA_READ_TYPE_TECHNICAL
+        && db ->read[0].readOrientation == 0
+        && db ->read[0].label == eAdapterL
+        && db ->read[1].readClass == SRA_READ_TYPE_BIOLOGICAL
+        && db ->read[1].readOrientation == 0
+        && db ->read[1].label == eMate1L
+        && db ->read[2].readClass == SRA_READ_TYPE_TECHNICAL
+        && db ->read[2].readOrientation == 0
+        && db ->read[2].label == eLinkerL
+        && db ->read[3].readClass == SRA_READ_TYPE_BIOLOGICAL
+        && db ->read[3].readOrientation == 0
+        && db ->read[3].label == eMate2L
+    ) /* 2/4: TecAd,BioFw / TecAda,BioMt1,TecLin,MioMt2 */
+    {   ReportDiff(args, xml, "[F-MLM]"); } /* Forward-MateLinkerMate */
+    else if (db->platform == SRA_PLATFORM_454
+        && xml->nreads == 5 && db->nreads == 4
+        && xml->read[0].readClass == SRA_READ_TYPE_TECHNICAL
+        && xml->read[0].readType == eAdapterRT
+        && xml->read[1].readClass == SRA_READ_TYPE_TECHNICAL
+        && xml->read[1].readType == eBarCodeRT
+        && xml->read[2].readClass == SRA_READ_TYPE_BIOLOGICAL
+        && xml->read[2].readType == eForwardRT
+        && xml->read[3].readClass == SRA_READ_TYPE_TECHNICAL
+        && xml->read[3].readType == eLinkerRT
+        && xml->read[4].readClass == SRA_READ_TYPE_BIOLOGICAL
+        && xml->read[4].readType == eReverseRT
+        && db ->read[0].readClass == SRA_READ_TYPE_TECHNICAL
+        && db ->read[0].readOrientation == 0
+        && db ->read[0].label == eAdapterL
+        && db ->read[1].readClass == SRA_READ_TYPE_BIOLOGICAL
+        && db ->read[1].readOrientation == 0
+        && db ->read[1].label == eMate1L
+        && db ->read[2].readClass == SRA_READ_TYPE_TECHNICAL
+        && db ->read[2].readOrientation == 0
+        && db ->read[2].label == eLinkerL
+        && db ->read[3].readClass == SRA_READ_TYPE_BIOLOGICAL
+        && db ->read[3].readOrientation == 0
+        && db ->read[3].label == eMate2L
+    ) /* 5/4: TecAd,TecBc,BioFw,TecLn,BioRv / TecAda,BioMt1,TecLin,MioMt2 */
+    {   ReportDiff(args, xml, "[BF-M]"); } /* BarcodeForward-Mate */
+    else {
+        int i = 0;
+        ReportDiff(args, xml, "UNKNOWN X{");
+        for (i = 0; i < xml->nreads; ++i) {
+            if (i != 0)
+            {   ReportDiff(args, xml, ","); }
+            ReportDiff(args, xml, "%d:", i);
+            switch (xml->read[i].readClass) {
+                case SRA_READ_TYPE_BIOLOGICAL:
+                    ReportDiff(args, xml, "BIO"); break;
+                case SRA_READ_TYPE_TECHNICAL:
+                    ReportDiff(args, xml, "TEC"); break;
+                default: assert(0);
+            }
+            switch (xml->read[i].readType) {
+                case eAdapterRT:
+                    ReportDiff(args, xml, "AD"); break;
+                case eBarCodeRT:
+                    ReportDiff(args, xml, "BC"); break;
+                case eForwardRT:
+                    ReportDiff(args, xml, "FW"); break;
+                case eLinkerRT:
+                    ReportDiff(args, xml, "LN"); break;
+                case ePrimerRT:
+                    ReportDiff(args, xml, "PR"); break;
+                case eReverseRT:
+                    ReportDiff(args, xml, "RV"); break;
+                default: assert(0);
+            }
+        }
+        ReportDiff(args, xml, "} D{");
+        for (i = 0; i < db->nreads; ++i) {
+            if (i != 0)
+            {   ReportDiff(args, xml, ","); }
+            ReportDiff(args, xml, "%d:", i);
+            switch (db->read[i].readClass) {
+                case SRA_READ_TYPE_BIOLOGICAL:
+                    ReportDiff(args, xml, "BIO"); break;
+                case SRA_READ_TYPE_TECHNICAL:
+                    ReportDiff(args, xml, "TEC"); break;
+                default: assert(0);
+            }
+            {
+                const char* l = EnumLabel2Str(db->read[i].label);
+                assert(l);
+                ReportDiff(args, xml, l);
+            }
+            /*switch (db->read[i].label) {
+                case eAdapterL:
+                    ReportDiff(args, xml, "ADA"); break;
+                case eF3L:
+                    ReportDiff(args, xml, "F3"); break;
+                case eFragmentL:
+                    ReportDiff(args, xml, "FRA"); break;
+                case eLinkerL:
+                    ReportDiff(args, xml, "LNK"); break;
+                case eMate1L:
+                    ReportDiff(args, xml, "MT1"); break;
+                case eMate2L:
+                    ReportDiff(args, xml, "MT2"); break;
+                case eR3L:
+                    ReportDiff(args, xml, "R3"); break;
+                default: assert(0);
+            }*/
+        }
+        ReportDiff(args, xml, "}");
+        return false;
+    }
+    return true;
+}
+static bool MDCompare(const MetaDataDb* db, const MetaDataXml* xml,
+    const CmdLine* args)
+{
+    bool res = true;
+    if (db->platform != xml->platform) {
+        ReportDiff(args, xml, "PLATFORM");
+        res = false;
+    }
+    if (db->platform != SRA_PLATFORM_PACBIO_SMRT) {
+        if (db->nreads != xml->nreads) {
+            bool k = AnalyzeNReport(db, xml, args);
+            if (!k)
+            {   OUTMSG(("\n")); }
+            assert(k);
+            res = false;
+        }
+        else {
+            int i = 0;
+            for (i = 0; i < db->nreads; ++i) {
+                if (db->read[i].label == eInvalidF7L) {
+                    ReportDiff(args, xml, "ERROR label=F,length=7");
+                    res = false;
+                }
+            }
+        }
+    }
+    if (res == true) {
+        OUTMSG(("%s %s ", args->acc, EnumPlatform2Str(xml->platform)));
+        if (db->platform != SRA_PLATFORM_PACBIO_SMRT)
+        {   OUTMSG(("%d ", db->nreads));    }
+        OUTMSG(("EQUALS\n"));
+    }
+    else { OUTMSG(("\n")); }
+    return res;
+}
+
+static void MetaDataXmlInit(MetaDataXml* md)
+{
+    int i = 0;
+    assert(md);
+    memset(md, 0, sizeof *md);
+    for (i = 0; i < sizeof md->read / sizeof md->read[0]; ++i) {
+        SReadXml* r = &md->read[i];
+        r->readClass = unsetReadClass;
+    }
+}
+
+static void MetaDataDbInit(MetaDataDb* md)
+{
+    int i = 0;
+    assert(md);
+    memset(md, 0, sizeof *md);
+    for (i = 0; i < sizeof md->read / sizeof md->read[0]; ++i) {
+        SReadDb* r = &md->read[i];
+        r->readClass = unsetReadClass;
+    }
+}
+
+static rc_t ReadColumns(const VTable* tbl,
+    Col* columns, int n, MetaDataDb* md, bool variableReadLen)
+{
+    rc_t rc = 0;
+    const VCursor* curs = NULL;
+    KNamelist* names = NULL;
+    uint32_t nreads = 0;
+    int i = 0;
+    int colLabel = -1, colLabelLen = -1, colLabelStart = -1;
+    assert(tbl && columns && md);
+    rc = VTableListCol(tbl, &names);
+    DISP_RC(rc, "while listing columns");
+    if (rc == 0) {
+        int i = 0;
+        uint32_t count = 0;
+        rc = KNamelistCount(names, &count);
+        DISP_RC(rc, "while counting column list");
+        for (i = 0; i < count && rc == 0; ++i) {
+            int j = 0;
+            const char* name = NULL;
+            rc = KNamelistGet(names, i, &name);
+            DISP_RC(rc, "while getting column name");
+            for (j = 0; j < n && rc == 0; ++j) {
+                if (strcmp(columns[j].name, name) == 0) {
+                    columns[j].exists = true;
+                    break;
+                }
+            }
+        }
+        DESTRUCT(KNamelist, names);
+    }
+    if (rc == 0) {
+        rc = VTableCreateCursorRead(tbl, &curs);
+        DISP_RC(rc, "while creating cursor");
+    }
+    for (i = 0; i < n && rc == 0; ++i) {
+        Col* col = columns + i;
+        assert(col);
+        if (!col->exists)
+        {   continue; }
+        rc = VCursorAddColumn(curs, &col->idx, "%s", col->name);
+        DISP_RC2(rc, col->name, "while adding column to cursor");
+    }
+    if (rc == 0) {
+        rc = VCursorOpen(curs);
+        DISP_RC(rc, "while opening cursor");
+    }
+    for (i = 0; i < n && rc == 0; ++i) {
+        Col* col = &columns[i];
+        int64_t row_id = 1;
+        uint32_t elem_bits = 8;
+        col->row_len = 0;
+        if (!col->exists)
+        {   continue; }
+        if (rc == 0) {
+            rc = VCursorReadDirect(curs, row_id, col->idx,
+                elem_bits, col->buffer, sizeof col->buffer, &col->row_len);
+            if (rc) {
+                PLOGERR(klogInt,
+                    (klogInt, rc, "$(col): $(expected)", "col=%s,expected=%d",
+                     col->name, col->row_len));
+            }
+        }
+        if (rc == 0 && col->type == eREAD_START) {
+            nreads = col->row_len / 4;
+            assert(col->row_len % 4 == 0);
+            md->nreads = nreads;
+            if (nreads > sizeof md->read / sizeof md->read[0]) {
+                rc = RC
+                    (rcExe, rcColumn, rcReading, rcBuffer, rcInsufficient);
+                PLOGERR(klogInt, (klogInt, rc,
+                    "while reading NREADS: received $(nreads)",
+                    "nreads=%d", nreads));
+            }
+        }
+        if (rc == 0) {
+            int64_t expected = -1;
+            int64_t max = sizeof col->buffer;
+            switch (col->datatype) {
+                case eAscii:
+                    --max;
+                    expected = 0; break;
+                case eReadType:
+                case eUint8:
+                    expected = 1; break;
+                case eUint32:
+                    expected = 4; break;
+                default:
+                    assert(0)   ; break;
+            }
+            if (expected) {
+                assert((expected * (1 + col->isArray * (nreads - 1)))
+                    == col->row_len);
+            }
+            if (col->row_len > max) {
+                rc = RC(rcExe, rcColumn, rcReading, rcBuffer, rcInsufficient);
+                PLOGERR(klogInt, (klogInt, rc,
+                    "while reading $(column): received $(len)",
+                    "column=%s,len=%d", col->name, col->row_len));
+            }
+            else if (col->datatype == eAscii)
+            {   col->buffer[col->row_len] = '\0'; }
+            switch (col->type) {
+                case eLABEL:
+                    colLabel = i;
+                    break;
+                case eLABEL_LEN:
+                    colLabelLen = i;
+                    break;
+                case eLABEL_START:
+                    colLabelStart = i;
+                    break;
+                default: /* does not matter */
+                    break;
+            }
+        }
+    }
+    for (i = 0; i < n && rc == 0; ++i) {
+        Col* col = &columns[i];
+        switch (col->datatype) {
+            case eAscii: {
+                const char* data = (char*)col->buffer;
+                DBGMSG(DBG_APP, DBG_COND_1, ("%s: %s\n", col->name, data));
+                break;
+            }
+            case eReadType: {
+                uint8_t i = 0;
+                char* data = (char*)col->buffer;
+                for (i = 0; i < nreads; ++i) {
+                    char t[64] = "";
+                    if (data[i] & SRA_READ_TYPE_BIOLOGICAL) {
+                        strcpy(t, "SRA_READ_TYPE_BIOLOGICAL");
+                        data[i] &= ~SRA_READ_TYPE_BIOLOGICAL;
+                        md->read[i].readClass = SRA_READ_TYPE_BIOLOGICAL;
+                    } else {
+                        assert(SRA_READ_TYPE_TECHNICAL == 0);
+                        strcpy(t, "SRA_READ_TYPE_TECHNICAL");
+                        data[i] &= ~SRA_READ_TYPE_TECHNICAL;
+                        md->read[i].readClass = SRA_READ_TYPE_TECHNICAL;
+                    }
+                    if (data[i] & SRA_READ_TYPE_FORWARD) {
+                        strcat(t, "|SRA_READ_TYPE_FORWARD");
+                        data[i] &= ~SRA_READ_TYPE_FORWARD;
+                        md->read[i].readOrientation = SRA_READ_TYPE_FORWARD;
+                    }
+                    if (data[i] & SRA_READ_TYPE_REVERSE) {
+                        strcat(t, "|SRA_READ_TYPE_REVERSE");
+                        data[i] &= ~SRA_READ_TYPE_REVERSE;
+                        md->read[i].readOrientation = SRA_READ_TYPE_REVERSE;
+                    }
+                    if (data[i]) {
+                        rc = RC(rcExe,
+                            rcColumn, rcReading, rcData, rcUnexpected);
+                        LOGERR(klogInt, rc, "unexpected READ_TYPE value");
+                    }
+                    else {
+                        if (i == 0) {
+                            DBGMSG(DBG_APP, DBG_COND_1,
+                                ("%s: %s", col->name, t));
+                        } else {    DBGMSG(DBG_APP, DBG_COND_1, (", %s", t)); }
+                    }
+                }
+                DBGMSG(DBG_APP, DBG_COND_1, ("\n"));
+                break;
+            }
+            case eUint8:
+                DBGMSG(DBG_APP, DBG_COND_1,
+                    ("%s: %d\n", col->name, *(uint8_t*)col->buffer));
+                break;
+            case eUint32: {
+                uint8_t i = 0;
+                uint32_t* data = (uint32_t*)col->buffer;
+                DBGMSG(DBG_APP, DBG_COND_1, ("%s: %d", col->name, data[0]));
+                for (i = 1; col->isArray && i < nreads; ++i)
+                {   DBGMSG(DBG_APP, DBG_COND_1, (", %d", data[i])); }
+                DBGMSG(DBG_APP, DBG_COND_1, ("\n"));
+                break;
+            }
+            default:
+                assert(0);
+                break;
+        }
+        switch (col->type) {
+            case ePLATFORM:
+                md->platform = *(uint8_t*)col->buffer;
+                break;
+            default: /* does not matter */
+                break;
+        }
+    }
+    if (rc == 0) {
+        if (colLabel == -1 && colLabelLen == -1 && colLabelStart == -1)
+        {}
+        else if (colLabel == -1
+            || colLabelLen == -1 || colLabelStart == -1)
+        {
+            rc = RC(rcExe, rcCursor, rcReading, rcColumn, rcNotFound);
+            LOGERR(klogInt, rc, "(one of LABEL columns)");
+        }
+        else {
+            int j = 0;
+            int labell = 0;
+            const char* label = (const char*)columns[colLabel].buffer;
+            const uint32_t* labelLen
+                = (const uint32_t*)columns[colLabelLen].buffer;
+            const uint32_t* labelStart
+                = (const uint32_t*)columns[colLabelStart].buffer;
+            for (j = 0; j < nreads; ++j) {
+                enum ELabel elabel = eUnsetL;
+                if (labelLen[j]) {
+                    if (labelStart[j] == 0 && labelLen[j] == 7
+                        && label[0] == 'F' && label[1] == '\0')
+                    {   elabel = eInvalidF7L; }
+                    else {
+                        elabel =
+                            StrnLabel2Enum(label + labelStart[j], labelLen[j]);
+                    }
+                    /* if (!Compare("Adapter", label + labelStart[j],
+                        labelLen[j]))
+                    {   elabel = eAdapterL; }
+                    else if (!Compare("barcode", label + labelStart[j],
+                        labelLen[j]))
+                    {   elabel = eBarcodeL; }
+                    else if (!Compare("F", label + labelStart[j],
+                        labelLen[j]))
+                    {   elabel = eFL; }
+                    else if (!Compare("F3", label + labelStart[j],
+                        labelLen[j]))
+                    {   elabel = eF3L; }
+                    else if (!Compare("Fragment", label + labelStart[j],
+                        labelLen[j]))
+                    {   elabel = eFragmentL; }
+                    else if (!Compare("forward", label + labelStart[j],
+                        labelLen[j]))
+                    {   elabel = eForwardL; }
+                    else if (!Compare("Linker", label + labelStart[j],
+                        labelLen[j]))
+                    {   elabel = eLinkerL; }
+                    else if (!Compare("Mate1", label + labelStart[j],
+                        labelLen[j]))
+                    {   elabel = eMate1L; }
+                    else if (!Compare("Mate2", label + labelStart[j],
+                        labelLen[j]))
+                    {   elabel = eMate2L; }
+                    else if (!Compare("R3", label + labelStart[j],
+                        labelLen[j]))
+                    {   elabel = eR3L; }
+                    else if (!Compare("reverse", label + labelStart[j],
+                        labelLen[j]))
+                    {   elabel = eReverseL; }
+                    else if (!Compare("rRNA_primer", label + labelStart[j],
+                        labelLen[j]))
+                    {   elabel = erRNA_primerL; }
+                    else*/
+                    if (elabel == eUnsetL) {
+                        rc = RC(rcExe, rcData, rcParsing, rcData, rcUnexpected);
+                        PLOGERR(klogInt,
+                            (klogInt, rc, "LABEL value: $(val), length: $(len)",
+                             "val=%.*s,len=%d",
+                            labelLen[j], label + labelStart[j], labelLen[j]));
+                    }
+                }
+                md->read[j].label = elabel;
+                labell += labelLen[j];
+            }
+        }
+    }
+    DESTRUCT(VCursor, curs);
+    return rc;
+}
+
+static rc_t MakeXmlDocs(const CmdLine* args,
+    const KXMLDoc** exp, const KXMLDoc** run)
+{
+    rc_t rc = 0;
+    const KXMLMgr* mgr = NULL;
+    assert(args && exp && run);
+    rc = KXMLMgrMakeRead(&mgr);
+    DISP_RC(rc, "while calling KXMLMgrMakeRead");
+    if (rc)
+    {   return rc; }
+    if (args->exp && args->run) {
+        KDirectory* dir = NULL;
+        const KFile* expF = NULL;
+        const KFile* runF = NULL;
+        if (rc == 0) {
+            rc = KDirectoryNativeDir(&dir);
+            DISP_RC(rc, "while calling KDirectoryNativeDir");
+        }
+        if (rc == 0) {
+            rc = KDirectoryOpenFileRead(dir, &expF, args->exp);
+            DISP_RC2(rc, args->exp, "while opening file");
+        }
+        if (rc == 0) {
+            rc = KDirectoryOpenFileRead(dir, &runF, args->run);
+            DISP_RC2(rc, args->run, "while opening file");
+        }
+        if (rc == 0) {
+            rc = KXMLMgrMakeDocRead(mgr, exp, expF);
+            DISP_RC2(rc, args->exp, "while making experiment XML doc");
+        }
+        if (rc == 0) {
+            rc = KXMLMgrMakeDocRead(mgr, run, runF);
+            DISP_RC2(rc, args->run, "while making run XML doc");
+        }
+        {
+            rc_t rc2 = KFileRelease(runF);
+            if (rc2 != 0 && rc == 0)
+            {   rc = rc2; }
+            runF = NULL;
+        }
+        {
+            rc_t rc2 = KFileRelease(expF);
+            if (rc2 != 0 && rc == 0)
+            {   rc = rc2; }
+            expF = NULL;
+        }
+        {
+            rc_t rc2 = KDirectoryRelease(dir);
+            if (rc2 != 0 && rc == 0)
+            {   rc = rc2; }
+            dir = NULL;
+        }
+    }
+    else if (args->acc) {
+        const DBManager* dbMgr = NULL;
+        if (rc == 0) {
+            rc = SybaseInit(OS_CS_VERSION);
+            if (rc != 0)
+            {   LOGERR(klogInt, rc, "failed to init Sybase"); }
+        }
+        if (rc == 0) {
+            rc = DBManagerInit(&dbMgr, "sybase");
+            if (rc != 0) {
+                LOGERR(klogInt, rc, "failed to init Sybase");
+            }
+        }
+        if (rc == 0) {
+            Database* info = NULL;
+            const char server[] = "NIHMS2";
+            const char dbname[] = "SRA_Main";
+            const char user[] = "anyone";
+            rc = DBManagerConnect
+                (dbMgr, server, dbname, user, "allowed", &info);
+            if (rc != 0) {
+                PLOGERR(klogInt, (klogInt, rc,
+                    "failed to connect to $(srv).$(db) as user $(usr)",
+                    "srv=%s,db=%s,usr=%s", server, dbname, user));
+            }
+            if (rc == 0) {
+                DBResultSet* rs = NULL;
+                rc = DatabaseExecute(info, &rs, "set textsize 1310720");
+                DISP_RC(rc, "while setting DB textsize");
+            }
+            if (rc == 0) {
+                DBResultSet* rs = NULL;
+                rc = DatabaseExecute(info, &rs,
+                    "SELECT r.meta, e.meta FROM Run r, Experiment e "
+                    "WHERE r.acc = '%s' AND e.acc = r.experiment_ref",
+                    args->acc);
+                if (rc != 0) {
+                    LOGERR(klogInt, rc, "metadata selecting");
+                }
+                else {
+                    while (rc == 0) {
+                        const String* runS = NULL;
+                        const String* expS = NULL;
+                        DBRow* row = NULL;
+                        rc = DBResultSetNextRow(rs, &row);
+                        if (rc != 0) {
+                            if (rc == RC(rcRDBMS,
+                                  rcData, rcRetrieving, rcData, rcNotAvailable))
+                                rc = 0;
+                            break;
+                        }
+                        rc = DBRowGetAsString(row, 0, &runS);
+                        if (rc != 0) {
+                            LOGERR(klogInt, rc, "accessing run meta");
+                        }
+                        else {
+                            rc = KXMLMgrMakeDocReadFromMemory
+                                (mgr, run, runS->addr, runS->size);
+                            if (rc != 0)
+                            {   LOGERR(klogInt, rc, "run.xml"); }
+                        }
+                        if (rc == 0) {
+                            rc = DBRowGetAsString(row, 1, &expS);
+                            if (rc != 0) {
+                                LOGERR(klogInt, rc, "accessing exp meta");
+                            }
+                            else {
+                                rc = KXMLMgrMakeDocReadFromMemory
+                                    (mgr, exp, expS->addr, expS->size);
+                            }
+                        }
+                    }
+                    if (rc != 0)
+                    {   LOGERR(klogInt, rc, "metadata retieving"); }
+                }
+            }
+        }
+        {
+            rc_t rc2 = DBManagerRelease(dbMgr);
+            if (rc2 != 0 && rc == 0)
+            {   rc = rc2; }
+            dbMgr = NULL;
+        }
+    }
+    else { rc = RC(rcExe, rcArgv, rcParsing, rcArgv, rcInconsistent); }
+    {
+        rc_t rc2 = KXMLMgrRelease(mgr);
+        if (rc2 != 0 && rc == 0)
+        {   rc = rc2; }
+        mgr = NULL;
+    }
+    return rc;
+}
+
+rc_t CC UsageSummary (const char * progname)
+{
+    rc_t rc = 0;
+    return rc;
+}
+const char UsageDefaultName[] = "meta-sync";
+rc_t CC Usage(const Args* args)
+{
+    rc_t rc = 0;
+    return rc;
+}
+
+ver_t CC KAppVersion(void) { return META_SYNC_VERS; }
+
+static char *vdm_translate_accession( SRAPath* my_sra_path,
+    const char* accession,  const size_t bufsize, rc_t* rc)
+{
+    char* res = malloc(bufsize);
+    if (res != NULL) {
+        *rc = SRAPathFind(my_sra_path, accession, res, bufsize);
+        if (GetRCState(*rc) == rcNotFound) {
+            free(res);
+            res = NULL;
+        }
+        else if (GetRCState(*rc) == rcInsufficient) {
+            DBGMSG(DBG_APP, 0, ("bufsize %lu was insufficient\n", bufsize));
+            free(res);
+            res = vdm_translate_accession
+                (my_sra_path, accession, bufsize * 2, rc);
+        }
+        else if (*rc != 0) {
+            free(res);
+            res = NULL;
+        }
+    }
+    return res;
+}
+
+#define OPTION_EXPERIMENT  "experiment"
+#define ALIAS_EXPERIMENT   "e"
+static const char* experiment_usage [] = { "experiment.xml file" , NULL };
+#define OPTION_RUN  "run"
+#define ALIAS_RUN   "r"
+static const char* run_usage [] = { "run.xml file" , NULL };
+#define OPTION_ACC  "accession"
+#define ALIAS_ACC   "a"
+static const char* acc_usage [] = { "run accession" , NULL };
+OptDef Options[] =  {
+     { OPTION_ACC, ALIAS_ACC, NULL, acc_usage       , 1, true , true },
+     { OPTION_EXPERIMENT,
+            ALIAS_EXPERIMENT, NULL, experiment_usage, 1, true , true },
+     { OPTION_RUN, ALIAS_RUN, NULL, run_usage       , 1, true , true }
+};
+static rc_t CmdLineInit(const Args* args, CmdLine* cmdArgs)
+{
+    rc_t rc = 0;
+    bool acc_exp_runError = false;
+    assert(args && cmdArgs);
+
+    memset(cmdArgs, 0, sizeof *cmdArgs);
+
+    while (rc == 0) {
+        uint32_t pcount = 0;
+        uint32_t acccount = 0;
+        uint32_t expcount = 0;
+        uint32_t runcount = 0;
+
+        /* table path parameter */
+        rc = ArgsParamCount(args, &pcount);
+        if (rc) {
+            LOGERR(klogErr, rc, "Failure parsing table name");
+            break;
+        }
+        if (pcount < 1) {
+            rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcInsufficient);
+            LOGERR(klogErr, rc, "Missing table parameter");
+            break;
+        }
+        if (pcount > 1) {
+            rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcAmbiguous);
+            LOGERR(klogErr, rc, "Too many table parameters");
+            break;
+        }
+        rc = ArgsParamValue(args, 0, &cmdArgs->tbl);
+        if (rc) {
+            LOGERR(klogErr, rc, "Failure retrieving table name");
+            break;
+        }
+
+        /* run accession parameter */
+        rc = ArgsOptionCount(args, OPTION_ACC, &acccount);
+        if (rc) {
+            LOGERR(klogErr, rc, "Failure parsing run accession");
+            break;
+        }
+        if (acccount > 1) {
+            rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcAmbiguous);
+            LOGERR(klogErr, rc, "Too many run accession parameters");
+            break;
+        }
+
+        /* experiment file parameter */
+        rc = ArgsOptionCount(args, OPTION_EXPERIMENT, &expcount);
+        if (rc) {
+            LOGERR(klogErr, rc, "Failure parsing experiment file name");
+            break;
+        }
+        if (expcount > 1) {
+            rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcAmbiguous);
+            LOGERR(klogErr, rc, "Too many experiment parameters");
+            break;
+        }
+
+        /* run file parameter */
+        rc = ArgsOptionCount(args, OPTION_RUN, &runcount);
+        if (rc) {
+            LOGERR(klogErr, rc, "Failure parsing run file name");
+            break;
+        }
+        if (runcount > 1) {
+            rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcAmbiguous);
+            LOGERR(klogErr, rc, "Too many run parameters");
+            break;
+        }
+
+        if (acccount < 1) {
+            if (expcount < 1) {
+                acc_exp_runError = true;
+                break;
+            }
+            else if (runcount < 1) {
+                acc_exp_runError = true;
+                break;
+            }
+            else {
+                rc = ArgsOptionValue(args, OPTION_EXPERIMENT, 0, &cmdArgs->exp);
+                if (rc) {
+                    LOGERR(klogErr, rc,
+                        "Failure retrieving experiment file name");
+                    break;
+                }
+
+                rc = ArgsOptionValue (args, OPTION_RUN, 0, &cmdArgs->run);
+                if (rc) {
+                    LOGERR(klogErr, rc, "Failure retrieving run file name");
+                    break;
+                }
+            }
+        }
+        else {
+            rc = ArgsOptionValue (args, OPTION_ACC, 0, &cmdArgs->acc);
+            if (rc) {
+                LOGERR(klogErr, rc, "Failure retrieving run accession");
+                break;
+            }
+        }
+
+        break;
+    }
+
+    if (rc == 0) {
+        if (strchr(cmdArgs->tbl, '/') == NULL) {
+            SRAPath* sraPath = NULL;
+            rc = SRAPathMake(&sraPath, NULL);
+            if (rc == 0) {
+                if (!SRAPathTest(sraPath, cmdArgs->tbl)) {
+                    char* buf =
+                        vdm_translate_accession(sraPath, cmdArgs->tbl, 64, &rc);
+                    if (buf != NULL) {
+                        DBGMSG
+                            (DBG_APP, 0, ("sra-accession found! >%s<\n", buf));
+                        if (acc_exp_runError) {
+                            cmdArgs->acc = cmdArgs->tbl;
+                            acc_exp_runError = false;
+                        }
+                        cmdArgs->tbl = buf;
+                    }
+                    else if (GetRCState(rc) == rcNotFound) {
+                        OUTMSG(("%s NOT FOUND\n", cmdArgs->tbl));
+                        cmdArgs->notFound = true;
+                        rc = 0;
+                    }
+                    DISP_RC2(rc, cmdArgs->tbl, "while looking for table");
+                }
+            }
+            else {
+                if (GetRCState(rc) != rcNotFound ||
+                    GetRCTarget(rc) != rcDylib)
+                {   LOGERR( klogInt, rc, "SRAPathMake failed" ); }
+                else { rc = 0; }
+            }
+        }
+    }
+    if (cmdArgs->notFound == false && rc == 0 && acc_exp_runError) {
+        rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcInsufficient);
+        LOGERR(klogErr, rc,
+            "Either accession or run/experiment XML should be specified");
+    }
+/*
+    else
+    {   MiniUsage (args); }
+*/
+    return rc;
+}
+
+static void ShutUp(void) {
+                         StrLabel2Enum   (0); StrnPlatform2Enum(0, 0);
+    EnumReadType2Str(0); StrReadType2Enum(0); StrnReadType2Enum(0, 0);
+}
+
+rc_t CC KMain(int argc, char* argv[])
+{
+    rc_t rc = 0;
+    Args* args = NULL;
+    CmdLine cmdArgs;
+    Col columns[] = {
+/*        { eNREADS         ,"NREADS"         , eUint8   , false } , */
+        /* READ_START should be the first column in the array */
+          { eREAD_START     ,"READ_START"     , eUint32  , true  }
+        , { eFIXED_SPOT_LEN ,"FIXED_SPOT_LEN" , eUint32  , false }
+        , { eLABEL          ,"LABEL"          , eAscii   , false }
+        , { eLABEL_LEN      ,"LABEL_LEN"      , eUint32  , true  }
+        , { eLABEL_START    ,"LABEL_START"    , eUint32  , true  }
+        , { eLINKER_SEQUENCE,"LINKER_SEQUENCE", eAscii   , false }
+        , { ePLATFORM       ,"PLATFORM"       , eUint8   , false }
+        , { eREAD_LEN       ,"READ_LEN"       , eUint32  , true  }
+        , { eREAD_TYPE      ,"READ_TYPE"      , eReadType, true  }
+        , { eSPOT_GROUP     ,"SPOT_GROUP"     , eAscii   , false }
+        , { eSPOT_LEN       ,"SPOT_LEN"       , eUint32  , false }
+    };
+    rc = ArgsMakeAndHandle
+        (&args, argc, argv, 1, Options, sizeof Options / sizeof(Options[0]));
+    if (rc == 0)
+    {   rc = CmdLineInit(args, &cmdArgs); }
+    if (cmdArgs.notFound == false) {
+        bool equal = true;
+        const KXMLDoc* exp = NULL;
+        const KXMLDoc* run = NULL;
+        const VDBManager* mgr = NULL;
+        const VDatabase *db = NULL;
+        const VTable* tbl = NULL;
+        VSchema* schema = NULL;
+        MetaDataXml xmlMd;
+        MetaDataDb  runMd;
+        MetaDataXmlInit(&xmlMd);
+        MetaDataDbInit (&runMd);
+        if (rc == 0)
+        {   rc = MakeXmlDocs(&cmdArgs, &exp, &run); }
+        if (rc == 0)
+        {   rc = ParseXml(exp, run, &xmlMd); }
+        if (rc == 0) {
+            rc = VDBManagerMakeRead(&mgr, NULL);
+        }
+        if (rc == 0) {
+            rc = VDBManagerMakeSRASchema(mgr, &schema);
+        }
+        if (rc == 0) {
+            rc = VDBManagerOpenDBRead(mgr, &db, schema, "%s", cmdArgs.tbl);
+            if (rc == 0) {
+                const char path[] = "SEQUENCE";
+                rc = VDatabaseOpenTableRead(db, &tbl, path);
+                DISP_RC2(rc, cmdArgs.tbl, "while opening DB table SEQUENCE");
+            }
+            else {
+                rc = VDBManagerOpenTableRead(mgr, &tbl, schema, "%s", cmdArgs.tbl);
+                DISP_RC2(rc, cmdArgs.tbl, "while opening table");
+            }
+        }
+        if (rc == 0) {
+            rc = ReadColumns(tbl, columns, sizeof columns / sizeof columns[0],
+                &runMd, xmlMd.variableReadLen);
+        }
+        if (rc == 0)
+        {   equal = MDCompare(&runMd, &xmlMd, &cmdArgs); }
+        DESTRUCT(VTable, tbl);
+        DESTRUCT(VDatabase, db);
+        DESTRUCT(VSchema, schema);
+        DESTRUCT(VDBManager, mgr);
+        DESTRUCT(KXMLDoc, run);
+        DESTRUCT(KXMLDoc, exp);
+    }
+    {
+        rc_t rc2 = ArgsWhack(args);
+        if (rc2 != 0 && rc == 0) {
+            rc = rc2;
+            ShutUp();
+        }
+    }
+    return rc;
+}
+
+/************************************ EOF ****************** ******************/
diff --git a/tools/meta-sync/meta-sync.pl b/tools/meta-sync/meta-sync.pl
new file mode 100755
index 0000000..508ac7e
--- /dev/null
+++ b/tools/meta-sync/meta-sync.pl
@@ -0,0 +1,41 @@
+#!/usr/local/bin/perl -w
+use strict;
+use lib '/export/home/sybase/clients-mssql/current64/perl';
+use DBI;
+my $db;
+my $start = `date`;
+my $S =      1;
+my $L = 315142; # $S <= R <= $L
+my $INI = 'meta-sync.ini';
+if (-e $INI) {
+    $S = `cat $INI`;
+    chomp $S;
+}
+for (my $i = $S; $i <= $L; ++$i) {
+  my $A = sprintf "SRR%06d", ($i);
+  if ($i == 305952) {
+#   print "$A SKIP\n"; next;
+  }
+  my $res = system "meta-sync $A"; # -+ APP 
+  if ($res) {
+    `echo $i > $INI`;
+    die "$i $A";
+  }
+  if ($i == $L) {
+    $db = DBI->connect("dbi:Sybase:server=NIHMS2", "anyone", "allowed",
+        { syb_err_handler => \&err_handler }) unless ($db);
+    die unless ($db);
+    my $sth = $db->prepare("select max(acc) from SRA_Main..Run") || die;
+    my $rv  = $sth->execute || die;
+    my @res = $sth->fetchrow_array || die;
+    die if ($#res != 0);
+    $res[0] =~ /^(...)(.{7})$/;
+    die unless ($1 && $2 && $1 eq 'SRR');
+    $L = $2;
+  }
+}
+sub err_handler {
+    my($err, $sev, $state, $line, $server, $proc, $msg, $sql, $err_type) = @_;
+    print "$msg $proc\n";
+    1
+}
diff --git a/tools/meta-sync/meta-sync.vers b/tools/meta-sync/meta-sync.vers
new file mode 100644
index 0000000..8e8299d
--- /dev/null
+++ b/tools/meta-sync/meta-sync.vers
@@ -0,0 +1 @@
+2.4.2
diff --git a/tools/nenctool/Makefile b/tools/nenctool/Makefile
index 0d9833a..ebc93ed 100644
--- a/tools/nenctool/Makefile
+++ b/tools/nenctool/Makefile
@@ -27,7 +27,7 @@ default: std
 
 USE_GCC_IF_ICC = 1
 
-TOP ?= $(shell ../../build/abspath.sh ../..)
+TOP ?= $(abspath ../..)
 MODULE = tools/nenctool
 
 include $(TOP)/build/Makefile.env
@@ -37,10 +37,18 @@ INT_TOOLS =
 EXT_TOOLS = \
 	nenctool
 
+ifeq ($(OS),linux)
+EXT_TOOLS += \
+	nenctest
+endif
+
 ALL_TOOLS = \
 	$(INT_TOOLS) \
 	$(EXT_TOOLS)
 
+
+
+
 #-------------------------------------------------------------------------------
 # outer targets
 #
@@ -98,6 +106,7 @@ NENCTOOL_LIB = \
 $(BINDIR)/nenctool: $(NENCTOOL_OBJ)
 	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(NENCTOOL_LIB)
 
+
 #-------------------------------------------------------------------------------
 # nenctest
 #  Copy files from one directory to another while cataloging the contents.
@@ -121,3 +130,4 @@ NENCTEST_LIB = \
 
 $(BINDIR)/nenctest: $(NENCTEST_OBJ)
 	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(NENCTEST_LIB)
+
diff --git a/tools/nenctool/nenctest.c b/tools/nenctool/nenctest.c
index 89f1286..081040a 100644
--- a/tools/nenctool/nenctest.c
+++ b/tools/nenctool/nenctest.c
@@ -332,7 +332,7 @@ rc_t nenctest (const char * srcstr, const char * dststr, bool force)
     {
         VPath * srcpath;
 
-        rc = VFSManagerMakePath (mgr, &srcpath, srcstr);
+        rc = VFSManagerMakePath (mgr, &srcpath, "%s", srcstr);
         if (rc)
             PLOGERR (klogErr,
                      (klogErr, rc, "Failed to parse source path '$(path)'",
@@ -341,7 +341,7 @@ rc_t nenctest (const char * srcstr, const char * dststr, bool force)
         {
             VPath * dstpath;
 
-            rc = VFSManagerMakePath (mgr, &dstpath, dststr);
+            rc = VFSManagerMakePath (mgr, &dstpath, "%s", dststr);
             if (rc)
                 PLOGERR (klogErr,
                          (klogErr, rc, "Failed to parse destination path '$(path)'",
diff --git a/tools/nenctool/nenctest.vers b/tools/nenctool/nenctest.vers
index cc6c9a4..8e8299d 100644
--- a/tools/nenctool/nenctest.vers
+++ b/tools/nenctool/nenctest.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/nenctool/nenctool.c b/tools/nenctool/nenctool.c
index 2b51bdb..4ebab3c 100644
--- a/tools/nenctool/nenctool.c
+++ b/tools/nenctool/nenctool.c
@@ -313,7 +313,7 @@ rc_t nenctool (const char * srcstr, const char * dststr, bool force)
     {
         VPath * srcpath;
 
-        rc = VFSManagerMakePath (mgr, &srcpath, srcstr);
+        rc = VFSManagerMakePath (mgr, &srcpath, "%s", srcstr);
         if (rc)
             PLOGERR (klogErr,
                      (klogErr, rc, "Failed to parse source path '$(path)'",
@@ -322,7 +322,7 @@ rc_t nenctool (const char * srcstr, const char * dststr, bool force)
         {
             VPath * dstpath;
 
-            rc = VFSManagerMakePath (mgr, &dstpath, dststr);
+            rc = VFSManagerMakePath (mgr, &dstpath, "%s", dststr);
             if (rc)
                 PLOGERR (klogErr,
                          (klogErr, rc, "Failed to parse destination path '$(path)'",
diff --git a/tools/nenctool/nenctool.vers b/tools/nenctool/nenctool.vers
index cc6c9a4..8e8299d 100644
--- a/tools/nenctool/nenctool.vers
+++ b/tools/nenctool/nenctool.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/nencvalid/Makefile b/tools/nencvalid/Makefile
index f231dab..82bad7c 100644
--- a/tools/nencvalid/Makefile
+++ b/tools/nencvalid/Makefile
@@ -25,7 +25,7 @@
 
 default: std
 
-TOP ?= $(shell ../../build/abspath.sh ../..)
+TOP ?= $(abspath ../..)
 MODULE = tools/nencvalid
 
 include $(TOP)/build/Makefile.env
diff --git a/tools/nencvalid/nencvalid.c b/tools/nencvalid/nencvalid.c
index c33dc41..cc1fcf1 100644
--- a/tools/nencvalid/nencvalid.c
+++ b/tools/nencvalid/nencvalid.c
@@ -279,7 +279,7 @@ rc_t HandleOneFile (VFSManager * mgr, const char * path, bool decrypt_bin_compat
     rc_t rc;
     VPath * vpath;
 
-    rc = VFSManagerMakePath (mgr, &vpath, path);
+    rc = VFSManagerMakePath (mgr, &vpath, "%s", path);
     if (rc)
         PLOGERR (klogErr,
                  (klogErr, rc, "failed to parse path "
diff --git a/tools/nencvalid/nencvalid.vers b/tools/nencvalid/nencvalid.vers
index cc6c9a4..8e8299d 100644
--- a/tools/nencvalid/nencvalid.vers
+++ b/tools/nencvalid/nencvalid.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/pacbio-load/.gitignore b/tools/pacbio-load/.gitignore
new file mode 100644
index 0000000..e40acaf
--- /dev/null
+++ b/tools/pacbio-load/.gitignore
@@ -0,0 +1,7 @@
+*.vers.h
+*.bin
+*.txt
+*.sh
+*.h5
+dst
+pacbio1
diff --git a/tools/pacbio-load/Makefile b/tools/pacbio-load/Makefile
new file mode 100644
index 0000000..6dc272b
--- /dev/null
+++ b/tools/pacbio-load/Makefile
@@ -0,0 +1,140 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: std
+
+TOP ?= $(abspath ../..)
+MODULE = tools/pacbio-load
+
+include $(TOP)/build/Makefile.env
+
+INT_TOOLS = \
+
+EXT_TOOLS = \
+	pacbio-load
+
+ALL_TOOLS = \
+	$(INT_TOOLS) \
+	$(EXT_TOOLS)
+
+
+#-------------------------------------------------------------------------------
+# where to find hdf5 libs
+#
+ifdef NCBI
+ifeq (dbg,$(BUILD))
+	LIBHDF5_LPATH = $(NCBI)/hdf5/Debug/lib
+else
+	LIBHDF5_LPATH = $(NCBI)/hdf5/Release/lib
+endif
+endif
+
+#-------------------------------------------------------------------------------
+# outer targets
+#
+ifeq (1,$(HAVE_HDF5))
+
+all std: vers-includes
+	@ $(MAKE_CMD) $(TARGDIR)/$@
+
+$(ALL_TOOLS): vers-includes
+	@ $(MAKE_CMD) $(BINDIR)/$@
+
+else
+
+all std: $(ALL_TOOLS)
+
+$(ALL_TOOLS):
+	@ echo "NOTE - $(@F) cannot be built:"                          \
+	       "It requires our internal library 'libkdf5'"             \
+	       "which requires 'libhdf5' and its development headers."
+endif
+
+.PHONY: all std $(ALL_TOOLS)
+
+#-------------------------------------------------------------------------------
+# all
+#
+$(TARGDIR)/all: \
+	$(addprefix $(BINDIR)/,$(ALL_TOOLS))
+
+.PHONY: $(TARGDIR)/all
+
+#-------------------------------------------------------------------------------
+# std
+#
+$(TARGDIR)/std: \
+	$(addprefix $(BINDIR)/,$(EXT_TOOLS))
+
+.PHONY: $(TARGDIR)/std
+
+#-------------------------------------------------------------------------------
+# vers-includes
+#
+$(TARGDIR)/vers-includes: $(addsuffix .vers.h,$(EXT_TOOLS))
+
+.PHONY: $(TARGDIR)/vers-includes
+
+#-------------------------------------------------------------------------------
+# clean
+#
+clean: stdclean
+
+.PHONY: clean
+
+#-------------------------------------------------------------------------------
+# vdb-copy
+#  vdb copy tool
+#
+PACBIO_LOAD_SRC = \
+	pl-context \
+	pl-tools \
+	pl-zmw \
+	pl-basecalls_cmn \
+	pl-sequence \
+	pl-consensus \
+	pl-passes \
+	pl-metrics \
+	pl-regions \
+	pl-progress \
+	pacbio-load
+
+PACBIO_LOAD_OBJ = \
+	$(addsuffix .$(OBJX),$(PACBIO_LOAD_SRC))
+
+PACBIO_LOAD_LIB = \
+	-lkapp \
+	-skdf5 \
+	-lload \
+	-sncbi-wvdb \
+	-lm \
+	-lhdf5 \
+
+ifdef HDF5_LIBDIR
+	PACBIO_LOAD_LIB += $(addprefix -L,$(HDF5_LIBDIR))
+endif
+
+$(BINDIR)/pacbio-load: $(PACBIO_LOAD_OBJ)
+	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(PACBIO_LOAD_LIB)
diff --git a/tools/pacbio-load/pacbio-load.c b/tools/pacbio-load/pacbio-load.c
new file mode 100644
index 0000000..6e3256a
--- /dev/null
+++ b/tools/pacbio-load/pacbio-load.c
@@ -0,0 +1,638 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data", the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties", express or implied", including
+*  warranties of performance", merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "pacbio-load.vers.h"
+
+#include "pl-context.h"
+#include "pl-tools.h"
+#include "pl-zmw.h"
+#include "pl-basecalls_cmn.h"
+#include "pl-sequence.h"
+#include "pl-consensus.h"
+#include "pl-passes.h"
+#include "pl-metrics.h"
+
+#include <klib/out.h>
+#include <klib/namelist.h>
+#include <klib/text.h>
+#include <klib/rc.h>
+#include <klib/log.h>
+
+#include <kdb/meta.h>
+#include <kdb/database.h>
+
+#include <vdb/vdb-priv.h>
+#include <vdb/manager.h>
+#include <vdb/schema.h>
+#include <vdb/database.h>
+#include <vdb/table.h>
+#include <vdb/cursor.h>
+
+#include <sra/sraschema.h>
+
+#include <kapp/main.h>
+#include <kapp/args.h>
+#include <kapp/loader-meta.h>
+
+#include <hdf5/kdf5.h>
+
+#include <kfs/arrayfile.h>
+
+#include <sysalloc.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+const char UsageDefaultName[] = "pacbio-load";
+
+rc_t CC UsageSummary ( const char * progname )
+{
+    OUTMSG ( ("\n"
+        "Usage:\n"
+        "  %s <hdf5-file> -o<target>\n"
+        "\n", progname) );
+    return 0;
+}
+
+static const char* schema_usage[] = { "schema-name to be used", NULL };
+static const char* output_usage[] = { "target to be created", NULL };
+static const char* force_usage[] = { "forces an existing target to be overwritten", NULL };
+static const char* tabs_usage[] = { "load only these tabs (SCPM), dflt=all", 
+                                     " S...Sequence",
+                                     " C...Consensus", 
+                                     " P...Passes", 
+                                     " M...Metrics", NULL };
+static const char* progress_usage[] = { "show load-progress", NULL };
+
+
+rc_t CC Usage ( const Args * args )
+{
+    const char * progname = UsageDefaultName;
+    const char * fullpath = UsageDefaultName;
+    rc_t rc;
+
+    if (args == NULL)
+        rc = RC (rcApp, rcArgv, rcAccessing, rcSelf, rcNull);
+    else
+        rc = ArgsProgram (args, &fullpath, &progname);
+    if (rc)
+        progname = fullpath = UsageDefaultName;
+
+    UsageSummary (progname);
+
+    KOutMsg ("Options:\n");
+
+    HelpOptionLine ( ALIAS_OUTPUT, OPTION_OUTPUT, "output", output_usage );
+
+    HelpOptionLine ( ALIAS_SCHEMA, OPTION_SCHEMA, "schema", schema_usage );
+    HelpOptionLine ( ALIAS_FORCE, OPTION_FORCE, "force", force_usage );
+    HelpOptionLine ( ALIAS_TABS, OPTION_TABS, "tabs", tabs_usage );
+    HelpOptionLine ( ALIAS_WITH_PROGRESS, OPTION_WITH_PROGRESS, 
+                     "load-progress", progress_usage );
+    XMLLogger_Usage();
+    HelpOptionsStandard ();
+    HelpVersion ( fullpath, KAppVersion() );
+    return rc;
+}
+
+
+/* Version  EXTERN
+ *  return 4-part version code: 0xMMmmrrrr, where
+ *      MM = major release
+ *      mm = minor release
+ *    rrrr = bug-fix release
+ */
+ver_t CC KAppVersion ( void )
+{
+    return PACBIO_LOAD_VERS;
+}
+
+
+static bool pacbio_is_schema_dflt( const char * schema )
+{
+    size_t asize = string_size ( schema );
+    size_t bsize = string_size ( DFLT_SCHEMA );
+    uint32_t max_chars = ( asize > bsize ) ? asize : bsize;
+    return ( string_cmp ( schema, asize, DFLT_SCHEMA, bsize, max_chars ) == 0 );
+}
+
+
+static rc_t pacbio_extract_path( const KDirectory *dir, const char *schema_name,
+                                 char * dst, size_t dst_len )
+{
+    rc_t rc = KDirectoryResolvePath ( dir, true, dst, dst_len, "%s", schema_name );
+    if ( rc != 0 )
+        PLOGERR( klogErr, ( klogErr, rc, "cannot resolve path to schema-file '$(name)'",
+                            "name=%s", schema_name ));
+    else
+    {
+        char *ptr = strrchr ( dst, '/' );
+        if ( ptr == 0 )
+        {
+            rc = RC( rcExe, rcNoTarg, rcAllocating, rcParam, rcInvalid );
+            PLOGERR( klogErr, ( klogErr, rc, "cannot extract the path of '$(name)'",
+                                "name=%s", schema_name ));
+        }
+        else
+            *ptr = 0;
+    }
+    return rc;
+}
+
+
+static rc_t pacbio_load_schema( KDirectory * wd, VDBManager * vdb_mgr, VSchema ** schema, const char * schema_name )
+{
+    rc_t rc;
+
+    if ( pacbio_is_schema_dflt( schema_name ) )
+    {
+        rc = VDBManagerMakeSRASchema ( vdb_mgr, schema );
+        if ( rc != 0 )
+            LOGERR( klogErr, rc, "cannot create sra-schema" );
+
+        if ( rc == 0 )
+        {
+            rc = VSchemaParseFile ( *schema, "%s", schema_name );
+            if ( rc != 0 )
+                PLOGERR( klogErr, ( klogErr, rc, "cannot parse schema file '$(schema)'",
+                                    "schema=%s", schema_name ) );
+        }
+    }
+    else
+    {
+        rc = VDBManagerMakeSchema ( vdb_mgr, schema );
+        if ( rc != 0 )
+            LOGERR( klogErr, rc, "cannot create sra-schema" );
+        else
+        {
+            char path[ 4096 ];
+            rc = pacbio_extract_path( wd, schema_name, path, sizeof path );
+            if ( rc == 0 )
+            {
+                rc = VSchemaAddIncludePath ( *schema, "%s", path );
+                if ( rc != 0 )
+                    PLOGERR( klogErr, ( klogErr, rc, "cannot add schema-include-path '$(path)'",
+                                        "path=%s", path ) );
+                else
+                {
+                    rc = VSchemaParseFile ( *schema, "%s", schema_name );
+                    if ( rc != 0 )
+                        PLOGERR( klogErr, ( klogErr, rc, "cannot parse schema file '$(schema)'",
+                                            "schema=%s", schema_name ) );
+                }
+            }
+        }
+    }
+    return rc;
+}
+
+
+static rc_t pacbio_meta_entry( VDatabase * db, const char * toolname )
+{
+    KMetadata* meta = NULL;
+    rc_t rc = VDatabaseOpenMetadataUpdate( db, &meta );
+    if ( rc != 0 )
+    {
+        LOGERR( klogErr, rc, "Cannot open database-metadata" );
+    }
+    else
+    {
+        KMDataNode *node = NULL;
+
+        rc = KMetadataOpenNodeUpdate( meta, &node, "/" );
+        if ( rc != 0 )
+        {
+            LOGERR( klogErr, rc, "Cannot open database-metadata-root" );
+        }
+        else
+        {
+            rc = KLoaderMeta_Write( node, toolname, __DATE__, "PacBio HDF5", PACBIO_LOAD_VERS );
+            if ( rc != 0 )
+            {
+                LOGERR( klogErr, rc, "Cannot write pacbio metadata node" );
+            }
+            KMDataNodeRelease( node );
+        }
+        KMetadataRelease( meta );
+    }
+    return rc;
+}
+
+
+/* the context that has the context of all 4 sub-tables (SEQUENCE,CONSENSU,PASSES,METRICS) */
+typedef struct seq_con_pas_met
+{
+    seq_ctx sequence;       /* from pl-sequence.h */
+    con_ctx consensus;      /* from pl-consensus.h */
+    pas_ctx passes;         /* from pl-passes.h */
+    met_ctx metrics;        /* from pl-metrics.h */
+} seq_con_pas_met;
+
+
+/* we have to pass in the first hdf5-source, because prepare of sequences needs it */
+static rc_t pacbio_prepare( VDatabase * database, seq_con_pas_met * dst, KDirectory * first_src, ld_context *lctx )
+{
+    rc_t rc;
+
+    dst->sequence.cursor = NULL;
+    dst->consensus.cursor = NULL;
+    dst->passes.cursor = NULL;
+    dst->metrics.cursor = NULL;
+
+    rc = prepare_seq( database, &dst->sequence, first_src, lctx ); /* pl-sequence.c */
+    if ( rc == 0 )
+        rc = prepare_consensus( database, &dst->consensus, lctx ); /* pl-consensus.c */
+    if ( rc == 0 )
+        rc = prepare_passes( database, &dst->passes, lctx ); /* pl-passes.c */
+    if ( rc == 0 )
+        rc = prepare_metrics( database, &dst->metrics, lctx ); /* pl-metrics.c */
+    return rc;
+}
+
+
+static rc_t pacbio_load_src( context *ctx, seq_con_pas_met * dst, KDirectory * src, bool * consensus_present )
+{
+    rc_t rc1, rc = 0;
+
+    if ( ctx_ld_sequence( ctx ) )
+        rc = load_seq_src( &dst->sequence, src ); /* pl-sequence.c */
+
+    if ( rc == 0 && ctx_ld_consensus( ctx ) )
+    {
+        rc1 = load_consensus_src( &dst->consensus, src ); /* pl-consensus.c */
+        if ( rc1 == 0 )
+            *consensus_present = true;
+        else
+            LOGMSG( klogWarn, "the consensus-group is missing" );
+    }
+
+    if ( rc == 0 && ctx_ld_passes( ctx ) && *consensus_present )
+    {
+        rc1 = load_passes_src( &dst->passes, src ); /* pl-passes.c */
+        if ( rc1 != 0 )
+            LOGMSG( klogWarn, "the passes-table is missing" );
+    }
+
+    if ( rc == 0 && ctx_ld_metrics( ctx ) && *consensus_present )
+    {
+        rc1 = load_metrics_src( &dst->metrics, src ); /* pl-metrics.c */
+        if ( rc1 != 0 )
+            LOGMSG( klogWarn, "the metrics-table is missing" );
+    }
+    return rc;
+}
+
+
+static rc_t pacbio_finish( seq_con_pas_met * dst )
+{
+    rc_t rc = finish_seq( &dst->sequence ); /* pl-sequence.c */
+    if ( rc == 0 )
+        rc = finish_consensus( &dst->consensus ); /* pl-consensus.c */
+    if ( rc == 0 )
+        rc = finish_passes( &dst->passes ); /* pl-passes.c */
+    if ( rc == 0 )
+        rc = finish_metrics( &dst->metrics ); /* pl-metrics.c */
+    return rc;
+}
+
+
+static rc_t pacbio_get_hdf5_src( KDirectory * wd, const VNamelist * path_list, uint32_t idx, KDirectory ** hdf5_src )
+{
+    const char * src_path;
+    rc_t rc = VNameListGet ( path_list, idx, &src_path );
+    if ( rc == 0 && src_path != NULL )
+    {
+        rc = MakeHDF5RootDir ( wd, hdf5_src, false, src_path );
+        if ( rc != 0 )
+        {
+            PLOGERR( klogErr, ( klogErr, rc, "cannot open hdf5-source-file '$(srcfile)'",
+                                "srcfile=%s", src_path ) );
+        }
+    }
+    return rc;
+}
+
+
+static bool pacbio_has_MultiParts( KDirectory * hdf5_src )
+{
+    uint32_t pt = KDirectoryPathType ( hdf5_src, "MultiPart/Parts" );
+    return ( pt == kptDataset );
+}
+
+
+static rc_t pacbio_get_MultiParts( KDirectory * hdf5_src, VNamelist * parts )
+{
+    struct KFile const *f;      /* the fake "file" from a HDF5-dir */
+    rc_t rc = KDirectoryOpenFileRead ( hdf5_src, &f, "MultiPart/Parts" );
+    if ( rc == 0 )
+    {
+        struct KArrayFile *af;      /* the arrayfile made from f */
+        rc = MakeHDF5ArrayFile ( f, &af );
+        if ( rc == 0 )
+        {
+            uint8_t dimensionality;
+            rc = KArrayFileDimensionality ( af, &dimensionality );
+            if ( rc == 0 && dimensionality == 1 )
+            {
+                uint64_t extents[ 1 ];
+                rc = KArrayFileDimExtents ( af, dimensionality, extents );
+                if ( rc == 0 )
+                {
+                    uint64_t pos[ 1 ];
+                    for ( pos[ 0 ] = 0; pos[ 0 ] < extents[ 0 ] && rc == 0; pos[ 0 ] += 1 )
+                    {
+                        char buffer[ 1024 ];
+                        uint64_t num_read;
+                        rc = KArrayFileRead_v ( af, 1, pos, buffer, sizeof buffer, &num_read );
+                        if ( rc == 0 )
+                            rc = VNamelistAppend ( parts, buffer );
+                    }
+                }
+            }
+            KArrayFileRelease( af );
+        }
+        KFileRelease( f );
+    }
+    return rc;
+}
+
+
+static rc_t pacbio_load_multipart( context * ctx, KDirectory * wd, VDatabase * database,
+                                   KDirectory ** hdf5_src, bool * consensus_present, 
+                                   ld_context * lctx, uint32_t count )
+{
+    seq_con_pas_met dst;
+    uint32_t idx = 0;
+    /* the loop is complicated, because pacbio_prepare needs the first hdf5-src opened ! */
+    rc_t rc = pacbio_prepare( database, &dst, *hdf5_src, lctx );
+    while ( idx < count && rc == 0 )
+    {
+        rc = pacbio_load_src( ctx, &dst, *hdf5_src, consensus_present );
+        idx++;
+        if ( rc == 0 && idx < count )
+        {
+            KDirectoryRelease ( *hdf5_src );
+            rc = pacbio_get_hdf5_src( wd, ctx->src_paths, idx, hdf5_src );
+        }
+    }
+    pacbio_finish( &dst );
+    KDirectoryRelease ( *hdf5_src );
+    return rc;
+}
+
+
+static rc_t pacbio_load( context *ctx, KDirectory * wd, ld_context *lctx, const char * toolname )
+{
+    VDBManager * vdb_mgr = NULL;
+    VSchema * schema = NULL;
+    VDatabase * database = NULL;
+
+    rc_t rc = VDBManagerMakeUpdate ( &vdb_mgr, wd );
+    if ( rc != 0 )
+    {
+        LOGERR( klogErr, rc, "cannot create vdb-update-manager" );
+    }
+
+    if ( rc == 0 )
+        rc = pacbio_load_schema( wd, vdb_mgr, &schema, ctx->schema_name );
+
+
+    /* creates the output vdb database */
+    if ( rc == 0 )
+    {
+        KCreateMode cmode = kcmMD5 | kcmParents;
+        if ( ctx->force )
+            cmode |= kcmInit;
+        else
+            cmode |= kcmCreate;
+        rc = VDBManagerCreateDB( vdb_mgr, &database, schema, 
+                                 PACBIO_SCHEMA_DB, cmode, "%s", ctx->dst_path );
+        if ( rc != 0 )
+            PLOGERR( klogErr, ( klogErr, rc, "cannot create output-database '$(dst)'",
+                                "dst=%s", ctx->dst_path ) );
+    }
+
+
+    /* creates the 4 output vdb tables... SEQUENCE, CONSENSUS, PASSES and METRICS */
+    if ( rc == 0 )
+    {
+        bool consensus_present = false;
+        uint32_t count;
+        KDirectory * hdf5_src;
+
+        rc = VNameListCount ( ctx->src_paths, &count );
+        if ( rc == 0 && count > 0 )
+        {
+            rc = pacbio_get_hdf5_src( wd, ctx->src_paths, 0, &hdf5_src );
+            if ( rc == 0 )
+            {
+                if ( pacbio_has_MultiParts( hdf5_src ) )
+                {
+                    VNamelist * parts;
+                    rc = VNamelistMake ( &parts, 5 );
+                    if ( rc == 0 )
+                    {
+                        rc = pacbio_get_MultiParts( hdf5_src, parts );
+                        if ( rc == 0 )
+                        {
+                            VNamelistRelease ( ctx->src_paths );
+                            ctx->src_paths = parts;
+                        }
+                    }
+                }
+                KDirectoryRelease( hdf5_src );
+            }
+        }
+
+        if ( rc == 0 )
+        {
+            rc = VNameListCount ( ctx->src_paths, &count );
+            if ( rc == 0 && count > 0 )
+            {
+                ctx_show( ctx );
+                rc = pacbio_get_hdf5_src( wd, ctx->src_paths, 0, &hdf5_src );
+                if ( rc == 0 )
+                    rc = pacbio_load_multipart( ctx, wd, database, &hdf5_src, &consensus_present, lctx, count );
+            }
+        }
+
+        if ( !consensus_present )
+            VDatabaseDropTable ( database, "CONSENSUS" );
+    }
+
+    if ( rc == 0 )
+        seq_report_totals( lctx );
+
+    if ( rc == 0 )
+        rc = pacbio_meta_entry( database, toolname );
+
+    if ( database != NULL )
+        VDatabaseRelease ( database );
+
+    if ( schema != NULL )
+        VSchemaRelease ( schema );
+
+    if ( vdb_mgr != NULL )
+        VDBManagerRelease ( vdb_mgr );
+    return rc;
+}
+
+
+static rc_t pacbio_check_sourcefile( const KDirectory * dir, char ** path )
+{
+    rc_t rc = 0;
+    uint32_t src_path_type = KDirectoryPathType ( dir, "%s", *path );
+    if ( ( src_path_type & kptFile ) == 0 )
+    {
+        rc = RC ( rcExe, rcFile, rcValidating, rcItem, rcNotFound );
+        LOGERR( klogErr, rc, "source-file not found" );
+    }
+    else
+    {
+        if ( ( src_path_type & kptAlias ) != 0 )
+        {
+            char resolved[ 4096 ];
+            rc = KDirectoryResolveAlias ( dir, true, resolved,
+                                          sizeof resolved, "%s", *path );
+            if ( rc != 0 )
+            {
+                LOGERR( klogErr, rc, "cannot resolve srcfile-link" );
+            }
+            else
+            {
+                free( *path );
+                *path = string_dup_measure ( resolved, NULL );
+            }
+        }
+    }
+    return rc;
+}
+
+
+static rc_t pacbio_check_sourcefile_list( const KDirectory * dir, VNamelist ** list )
+{
+    VNamelist * temp;
+    rc_t rc = VNamelistMake ( &temp, 5 );
+    if ( rc == 0 )
+    {
+        uint32_t idx, count;
+        rc = VNameListCount ( *list, &count );
+        for ( idx = 0; rc == 0 && idx < count; ++idx )
+        {
+            const char * name = NULL;
+            rc = VNameListGet ( *list, idx, &name );
+            if ( rc == 0 && name != NULL )
+            {
+                char * path = string_dup_measure ( name, NULL );
+                rc = pacbio_check_sourcefile( dir, &path );
+                if ( rc == 0 )
+                    rc = VNamelistAppend ( temp, path );
+            }
+        }
+        if ( rc == 0 )
+        {
+            rc = VNamelistRelease ( *list );
+            *list = temp;
+        }
+    }
+    return rc;
+}
+
+
+OptDef MyOptions[] =
+{
+    { OPTION_SCHEMA, ALIAS_SCHEMA, NULL, schema_usage, 5, true, false },
+    { OPTION_FORCE, ALIAS_FORCE, NULL, force_usage, 1, false, false },
+    { OPTION_WITH_PROGRESS, ALIAS_WITH_PROGRESS, NULL, progress_usage, 1, false, false },
+    { OPTION_TABS, ALIAS_TABS, NULL, tabs_usage, 1, true, false },
+    { OPTION_OUTPUT, ALIAS_OUTPUT, NULL, output_usage, 1, true, true }
+};
+
+
+rc_t CC KMain ( int argc, char *argv [] )
+{
+    Args * args;
+
+    rc_t rc = ArgsMakeAndHandle ( &args, argc, argv, 2,
+                                  MyOptions, sizeof MyOptions / sizeof ( OptDef ),
+                                  XMLLogger_Args, XMLLogger_ArgsQty  );
+
+    KLogHandlerSetStdErr();
+    if ( rc != 0 )
+    {
+        LOGERR( klogErr, rc, "error creating internal structure" );
+    }
+    else
+    {
+        KDirectory * wd;
+        rc = KDirectoryNativeDir ( &wd );
+        if ( rc != 0 )
+        {
+            LOGERR( klogErr, rc, "error creating internal structure" );
+        }
+        else
+        {
+            ld_context lctx;
+            lctx_init( &lctx );
+            rc = XMLLogger_Make( &lctx.xml_logger, wd, args );
+            if ( rc != 0 )
+            {
+                LOGERR( klogErr, rc, "error creating internal structure" );
+            }
+            else
+            {
+                context ctx;
+                rc = ctx_init( args, &ctx );
+                if ( rc == 0 )
+                {
+                    rc = pacbio_check_sourcefile_list( wd, &ctx.src_paths );
+                    if ( rc == 0 )
+                    {
+                        lctx.with_progress = ctx.with_progress;
+                        lctx.dst_path = ctx.dst_path;
+                        lctx.cache_content = false;
+                        lctx.check_src_obj = false;
+
+                        rc = KLoadProgressbar_Make( &lctx.xml_progress, 0 );
+                        if ( rc != 0 )
+                        {
+                            LOGERR( klogErr, rc, "cannot create LoadProgressBar" );
+                        }
+                        else
+                            rc = pacbio_load( &ctx, wd, &lctx, argv[ 0 ] );
+
+                    }
+                    ctx_free( &ctx );
+                }
+            }
+            KDirectoryRelease ( wd );
+            lctx_free( &lctx );
+        }
+        ArgsWhack ( args );
+    }
+    return rc;
+}
diff --git a/tools/pacbio-load/pacbio-load.vers b/tools/pacbio-load/pacbio-load.vers
new file mode 100644
index 0000000..8e8299d
--- /dev/null
+++ b/tools/pacbio-load/pacbio-load.vers
@@ -0,0 +1 @@
+2.4.2
diff --git a/tools/pacbio-load/pl-basecalls_cmn.c b/tools/pacbio-load/pl-basecalls_cmn.c
new file mode 100644
index 0000000..7980d3c
--- /dev/null
+++ b/tools/pacbio-load/pl-basecalls_cmn.c
@@ -0,0 +1,97 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "pl-basecalls_cmn.h"
+#include <sysalloc.h>
+
+void init_BaseCalls_cmn( BaseCalls_cmn *tab )
+{
+    zmw_init( &tab->zmw );
+    init_array_file( &tab->Basecall );
+    init_array_file( &tab->QualityValue );
+    init_array_file( &tab->DeletionQV );
+    init_array_file( &tab->DeletionTag );
+    init_array_file( &tab->InsertionQV );
+    init_array_file( &tab->SubstitutionQV );
+    init_array_file( &tab->SubstitutionTag );
+}
+
+
+void close_BaseCalls_cmn( BaseCalls_cmn *tab )
+{
+    zmw_close( &tab->zmw );
+    free_array_file( &tab->Basecall );
+    free_array_file( &tab->QualityValue );
+    free_array_file( &tab->DeletionQV );
+    free_array_file( &tab->DeletionTag );
+    free_array_file( &tab->InsertionQV );
+    free_array_file( &tab->SubstitutionQV );
+    free_array_file( &tab->SubstitutionTag );
+}
+
+
+rc_t open_BaseCalls_cmn( const KDirectory *hdf5_dir, BaseCalls_cmn *tab,
+                         const bool num_passes, const char * path,
+                         bool cache_content, bool supress_err_msg )
+{
+    rc_t rc;
+
+    init_BaseCalls_cmn( tab );
+    rc = zmw_open( hdf5_dir, &tab->zmw, num_passes, path, supress_err_msg );
+    if ( rc == 0 )
+        rc = open_element( hdf5_dir, &tab->Basecall, path, "Basecall", 
+                           BASECALL_BITSIZE, BASECALL_COLS,
+                           true, cache_content, supress_err_msg );
+    if ( rc == 0 )
+        rc = open_element( hdf5_dir, &tab->QualityValue, path, "QualityValue", 
+                           QUALITY_VALUE_BITSIZE, QUALITY_VALUE_COLS,
+                           true, cache_content, supress_err_msg );
+    if ( rc == 0 )
+    {
+        open_element( hdf5_dir, &tab->DeletionQV, path, "DeletionQV",
+                           DELETION_QV_BITSIZE, DELETION_QV_COLS,
+                           true, cache_content, true );
+
+        open_element( hdf5_dir, &tab->DeletionTag, path, "DeletionTag", 
+                           DELETION_TAG_BITSIZE, DELETION_TAG_COLS,
+                           true, cache_content, true );
+
+        open_element( hdf5_dir, &tab->InsertionQV, path, "InsertionQV", 
+                           INSERTION_QV_BITSIZE, INSERTION_QV_COLS,
+                           true, cache_content, true );
+
+        open_element( hdf5_dir, &tab->SubstitutionQV, path, "SubstitutionQV",
+                           SUBSTITUTION_QV_BITZISE, SUBSTITUTION_QV_COLS,
+                           true, cache_content, true );
+
+        open_element( hdf5_dir, &tab->SubstitutionTag, path, "SubstitutionTag",
+                           SUBSTITUTION_TAG_BITSIZE, SUBSTITUTION_TAG_COLS,
+                           true, cache_content, true );
+    }
+    if ( rc != 0 )
+        close_BaseCalls_cmn( tab ); /* releases only initialized elements */
+    return rc;
+}
diff --git a/tools/pacbio-load/pl-basecalls_cmn.h b/tools/pacbio-load/pl-basecalls_cmn.h
new file mode 100644
index 0000000..f9965cc
--- /dev/null
+++ b/tools/pacbio-load/pl-basecalls_cmn.h
@@ -0,0 +1,60 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+#ifndef _h_pl_basecalls_cmn_
+#define _h_pl_basecalls_cmn_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "pl-tools.h"
+#include "pl-zmw.h"
+#include <klib/rc.h>
+
+typedef struct BaseCalls_cmn
+{
+    zmw_tab zmw;
+    af_data Basecall;
+    af_data QualityValue;
+    af_data DeletionQV;
+    af_data DeletionTag;
+    af_data InsertionQV;
+    af_data SubstitutionQV;
+    af_data SubstitutionTag;
+} BaseCalls_cmn;
+
+
+void init_BaseCalls_cmn( BaseCalls_cmn *tab );
+void close_BaseCalls_cmn( BaseCalls_cmn *tab );
+rc_t open_BaseCalls_cmn( const KDirectory *hdf5_dir, BaseCalls_cmn *tab,
+                         const bool num_passes, const char * path,
+                         bool cache_content, bool supress_err_msg );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/pacbio-load/pl-consensus.c b/tools/pacbio-load/pl-consensus.c
new file mode 100644
index 0000000..ed7c26f
--- /dev/null
+++ b/tools/pacbio-load/pl-consensus.c
@@ -0,0 +1,413 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "pl-consensus.h"
+#include <sysalloc.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+
+const char * consensus_tab_names[] = 
+{ 
+    /* base-space */
+    "READ",
+    "QUALITY",
+    "NREADS",
+    "READ_TYPE",
+    "READ_START",
+    "READ_LEN",
+    "(INSDC:SRA:platform_id)PLATFORM",
+    "READ_FILTER",
+
+    /* consensus-space */
+    "HOLE_NUMBER",
+    "HOLE_STATUS",
+    "HOLE_XY",
+    "NUM_PASSES",
+    "INSERTION_QV",
+    "DELETION_QV",
+    "DELETION_TAG",
+    "SUBSTITUTION_QV",
+    "SUBSTITUTION_TAG"
+};
+
+
+static bool check_Consensus_totalcount( BaseCalls_cmn *tab, const uint64_t expected )
+{
+    bool res = check_table_count( &tab->Basecall, "Basecall", expected );
+    if ( res )
+        res = check_table_count( &tab->DeletionQV, "DeletionQV", expected );
+    if ( res )
+        res = check_table_count( &tab->DeletionTag, "DeletionTag", expected );
+    if ( res )
+        res = check_table_count( &tab->InsertionQV, "InsertionQV", expected );
+    if ( res )
+        res = check_table_count( &tab->QualityValue, "QualityValue", expected );
+    if ( res )
+        res = check_table_count( &tab->SubstitutionQV, "SubstitutionQV", expected );
+    if ( res )
+        res = check_table_count( &tab->SubstitutionTag, "SubstitutionTag", expected );
+    return res;
+}
+
+
+static rc_t consensus_load_zero_bases( VCursor *cursor, const uint32_t *col_idx )
+{
+    uint32_t dummy_src; 
+    INSDC_SRA_read_filter filter = SRA_READ_FILTER_CRITERIA;
+
+    rc_t rc = vdb_write_value( cursor, col_idx[ consensus_tab_READ ],
+                               &dummy_src, BASECALL_BITSIZE, 0, "consensus.Basecall" );
+    if ( rc == 0 )
+        rc = vdb_write_value( cursor, col_idx[ consensus_tab_QUALITY ],
+                               &dummy_src, QUALITY_VALUE_BITSIZE, 0, "QualityValue" );
+    if ( rc == 0 )
+        rc = vdb_write_value( cursor, col_idx[ consensus_tab_INSERTION_QV ],
+                               &dummy_src, INSERTION_QV_BITSIZE, 0, "consensus.InsertionQV" );
+    if ( rc == 0 )
+        rc = vdb_write_value( cursor, col_idx[ consensus_tab_DELETION_QV ],
+                               &dummy_src, DELETION_QV_BITSIZE, 0, "consensus.DeletionQV" );
+    if ( rc == 0 )
+        rc = vdb_write_value( cursor, col_idx[ consensus_tab_DELETION_TAG ],
+                               &dummy_src, DELETION_TAG_BITSIZE, 0, "consensus.DeletionTag" );
+    if ( rc == 0 )
+        rc = vdb_write_value( cursor, col_idx[ consensus_tab_SUBSTITUTION_QV ],
+                               &dummy_src, SUBSTITUTION_QV_BITZISE, 0, "consensus.SubstitutionQV" );
+    if ( rc == 0 )
+        rc = vdb_write_value( cursor, col_idx[ consensus_tab_SUBSTITUTION_TAG ],
+                               &dummy_src, SUBSTITUTION_TAG_BITSIZE, 0, "consensus.SubstitutionTag" );
+    if ( rc == 0 )
+        rc = vdb_write_value( cursor, col_idx[ consensus_tab_READ_FILTER ],
+                               &filter, sizeof filter * 8, 1, "consensus.READ_FILTER" );
+    return rc;
+}
+
+
+static rc_t consensus_load_spot_bases( VCursor *cursor, BaseCalls_cmn *tab,
+                                       const uint32_t *col_idx, zmw_row * spot )
+{
+    rc_t rc = 0;
+    /* we make a buffer to store NumEvent 8-bit-values
+      (that is so far the biggest value we have to read per DNA-BASE) */
+    char * buffer = malloc( spot->NumEvent );
+    if ( buffer == NULL )
+    {
+        rc = RC( rcExe, rcNoTarg, rcAllocating, rcMemory, rcExhausted );
+        PLOGERR( klogErr, ( klogErr, rc, "cannot allocate $(numbytes) to read seq-data",
+                            "numbytes=%u", spot->NumEvent ) );
+    }
+    if ( rc == 0 )
+        rc = transfer_bits( cursor, col_idx[ consensus_tab_READ ],
+            &tab->Basecall, buffer, spot->offset, spot->NumEvent,
+            BASECALL_BITSIZE, "consensus.Basecall" );
+    if ( rc == 0 )
+        rc = transfer_bits( cursor, col_idx[ consensus_tab_QUALITY ],
+            &tab->QualityValue, buffer, spot->offset, spot->NumEvent,
+            QUALITY_VALUE_BITSIZE, "consensus.QualityValue" );
+    if ( rc == 0 )
+        rc = transfer_bits( cursor, col_idx[ consensus_tab_INSERTION_QV ],
+            &tab->InsertionQV, buffer, spot->offset, spot->NumEvent,
+            INSERTION_QV_BITSIZE, "consensus.InsertionQV" );
+    if ( rc == 0 )
+        rc = transfer_bits( cursor, col_idx[ consensus_tab_DELETION_QV ],
+            &tab->DeletionQV, buffer, spot->offset, spot->NumEvent,
+            DELETION_QV_BITSIZE, "consensus.DeletionQV" );
+    if ( rc == 0 )
+        rc = transfer_bits( cursor, col_idx[ consensus_tab_DELETION_TAG ],
+            &tab->DeletionTag, buffer, spot->offset, spot->NumEvent,
+            DELETION_TAG_BITSIZE, "consensus.DeletionTag" );
+    if ( rc == 0 )
+        rc = transfer_bits( cursor, col_idx[ consensus_tab_SUBSTITUTION_QV ],
+            &tab->SubstitutionQV, buffer, spot->offset, spot->NumEvent,
+            SUBSTITUTION_QV_BITZISE, "consensus.SubstitutionQV" );
+    if ( rc == 0 )
+        rc = transfer_bits( cursor, col_idx[ consensus_tab_SUBSTITUTION_TAG ],
+            &tab->SubstitutionTag, buffer, spot->offset, spot->NumEvent,
+            SUBSTITUTION_TAG_BITSIZE, "consensus.SubstitutionTag" );
+
+    if ( buffer != NULL )
+        free( buffer );
+    return rc;
+}
+
+
+static rc_t consensus_load_spot( VCursor *cursor, const uint32_t *col_idx,
+                                 region_type_mapping *mapping, zmw_row * spot, 
+                                 void * data )
+{
+    BaseCalls_cmn *tab = (BaseCalls_cmn *)data;
+    rc_t rc = VCursorOpenRow( cursor );
+    if ( rc != 0 )
+        PLOGERR( klogErr, ( klogErr, rc, "cannot open consensus-row on spot# $(spotnr)",
+                            "spotnr=%u", spot->spot_nr ) );
+
+    if ( rc == 0 )
+        rc = vdb_write_uint32( cursor, col_idx[ consensus_tab_HOLE_NUMBER ],
+                               spot->HoleNumber, "consensus.HOLE_NUMBER" );
+    if ( rc == 0 )
+        rc = vdb_write_uint8( cursor, col_idx[ consensus_tab_HOLE_STATUS ],
+                              spot->HoleStatus, "consensus.HOLE_STATUS" );
+    if ( rc == 0 )
+        rc = vdb_write_value( cursor, col_idx[ consensus_tab_HOLE_XY ],
+                              &spot->HoleXY, HOLE_XY_BITSIZE, 2, "consensus.HOLE_XY" );
+
+    /* has to be read ... from "PulseData/ConsensusBaesCalls/Passes/NumPasses" */
+    if ( rc == 0 )
+        rc = vdb_write_uint32( cursor, col_idx[ consensus_tab_NUM_PASSES ],
+                               spot->NumPasses, "consensus.NUM_PASSES" );
+
+    if ( rc == 0 )
+    {
+        if ( spot->NumEvent > 0 )
+            rc = consensus_load_spot_bases( cursor, tab, col_idx, spot );
+        else
+            rc = consensus_load_zero_bases( cursor, col_idx );
+    }
+
+    if ( rc == 0 )
+        rc = vdb_write_uint8( cursor, col_idx[ consensus_tab_NREADS ],
+                              1, "consensus.NREADS" );
+    if ( rc == 0 )
+        rc = vdb_write_uint32( cursor, col_idx[ consensus_tab_READ_START ],
+                               0, "consensus.READ_START" );
+    if ( rc == 0 )
+        rc = vdb_write_uint32( cursor, col_idx[ consensus_tab_READ_LEN ],
+                               spot->NumEvent, "consensus.READ_LEN" );
+    if ( rc == 0 )
+        rc = vdb_write_uint8( cursor, col_idx[ consensus_tab_READ_TYPE ],
+                              SRA_READ_TYPE_BIOLOGICAL, "consensus.READ_TYPE" );
+
+    if ( rc == 0 )
+    {
+        rc = VCursorCommitRow( cursor );
+        if ( rc != 0 )
+            PLOGERR( klogErr, ( klogErr, rc, "cannot commit consensus-row on spot# $(spotnr)",
+                                "spotnr=%u", spot->spot_nr ) );
+    }
+
+    if ( rc == 0 )
+    {
+        rc = VCursorCloseRow( cursor );
+        if ( rc != 0 )
+            PLOGERR( klogErr, ( klogErr, rc, "cannot close consensus-row on spot# $(spotnr)",
+                                "spotnr=%u", spot->spot_nr ) );
+
+    }
+    return rc;
+}
+
+
+static rc_t consensus_loader( ld_context *lctx, KDirectory * hdf5_src, VCursor * cursor, const char * table_name )
+{
+    uint32_t col_idx[ consensus_tab_count ];
+    rc_t rc = add_columns( cursor, consensus_tab_count, -1, col_idx, consensus_tab_names );
+    if ( rc == 0 )
+    {
+        rc = VCursorOpen( cursor );
+        if ( rc != 0 )
+            LOGERR( klogErr, rc, "cannot open cursor on consensus-table" );
+
+        else
+        {
+            BaseCalls_cmn ConsensusTab;
+            const INSDC_SRA_platform_id platform = SRA_PLATFORM_PACBIO_SMRT;
+
+            rc = VCursorDefault ( cursor, col_idx[ consensus_tab_PLATFORM ],
+                                  sizeof platform * 8, &platform, 0, 1 );
+            if ( rc != 0 )
+                LOGERR( klogErr, rc, "cannot set cursor-default on consensus-table for platform-column" );
+            else
+            {
+                const INSDC_SRA_read_filter filter = SRA_READ_FILTER_PASS;
+                rc = VCursorDefault ( cursor, col_idx[ consensus_tab_READ_FILTER ],
+                                  sizeof filter * 8, &filter, 0, 1 );
+                if ( rc != 0 )
+                    LOGERR( klogErr, rc, "cannot set cursor-default on consensus-table for read-filter-column" );
+            }
+
+            if ( rc == 0 )
+                rc = open_BaseCalls_cmn( hdf5_src, &ConsensusTab, true,
+                                     "PulseData/ConsensusBaseCalls", lctx->cache_content, true );
+
+            if ( rc == 0 )
+            {
+                uint64_t total_bases = zmw_total( &ConsensusTab.zmw );
+                uint64_t total_spots = ConsensusTab.zmw.NumEvent.extents[ 0 ];
+
+                KLogLevel tmp_lvl = KLogLevelGet();
+                KLogLevelSet( klogInfo );
+                PLOGMSG( klogInfo, ( klogInfo,
+                         "loading consensus-table ( $(bases) bases / $(spots) spots ):",
+                         "bases=%lu,spots=%lu", total_bases, total_spots ));
+                KLogLevelSet( tmp_lvl );
+
+                if ( check_Consensus_totalcount( &ConsensusTab, total_bases ) )
+                    rc = zmw_for_each( &ConsensusTab.zmw, &lctx->xml_progress, cursor,
+                                       lctx->with_progress, col_idx, NULL,
+                                       true, consensus_load_spot, &ConsensusTab );
+                else
+                    rc = RC( rcExe, rcNoTarg, rcAllocating, rcParam, rcInvalid );
+                close_BaseCalls_cmn( &ConsensusTab );
+            }
+        }
+    }
+    return rc;
+}
+
+
+/* HDF5-Groups and tables used to load the CONSENSUS-table */
+static const char * consensus_groups_to_check[] = 
+{ 
+    "PulseData",
+    "PulseData/ConsensusBaseCalls",
+    "PulseData/ConsensusBaseCalls/ZMW",
+    "PulseData/ConsensusBaseCalls/Passes",
+    NULL
+};
+
+
+static const char * consensus_tables_to_check[] = 
+{ 
+    "PulseData/ConsensusBaseCalls/Basecall",
+    "PulseData/ConsensusBaseCalls/DeletionQV",
+    "PulseData/ConsensusBaseCalls/DeletionTag",
+    "PulseData/ConsensusBaseCalls/InsertionQV",
+    "PulseData/ConsensusBaseCalls/QualityValue",
+    "PulseData/ConsensusBaseCalls/SubstitutionQV",
+    "PulseData/ConsensusBaseCalls/SubstitutionTag",
+    "PulseData/ConsensusBaseCalls/ZMW/HoleNumber",
+    "PulseData/ConsensusBaseCalls/ZMW/HoleStatus",
+    "PulseData/ConsensusBaseCalls/ZMW/HoleXY",
+    "PulseData/ConsensusBaseCalls/ZMW/NumEvent",
+    "PulseData/ConsensusBaseCalls/Passes/NumPasses",
+    NULL
+};
+
+
+static const char * consensus_schema_template = "CONSENSUS";
+static const char * consensus_table_to_create = "CONSENSUS";
+
+
+rc_t prepare_consensus( VDatabase * database, con_ctx * sctx, ld_context *lctx )
+{
+    rc_t rc = prepare_table( database, &sctx->cursor,
+            consensus_schema_template, consensus_table_to_create ); /* pl-tools.c ... this creates the cursor */
+    if ( rc == 0 )
+    {
+        rc = add_columns( sctx->cursor, consensus_tab_count, -1, sctx->col_idx, consensus_tab_names );
+        if ( rc == 0 )
+        {
+            rc = VCursorOpen( sctx->cursor );
+            if ( rc != 0 )
+            {
+                LOGERR( klogErr, rc, "cannot open cursor on consensus-table" );
+            }
+            else
+            {
+                const INSDC_SRA_platform_id platform = SRA_PLATFORM_PACBIO_SMRT;
+
+                rc = VCursorDefault ( sctx->cursor, sctx->col_idx[ consensus_tab_PLATFORM ],
+                                      sizeof platform * 8, &platform, 0, 1 );
+                if ( rc != 0 )
+                {
+                    LOGERR( klogErr, rc, "cannot set cursor-default on consensus-table for platform-column" );
+                }
+                else
+                {
+                    const INSDC_SRA_read_filter filter = SRA_READ_FILTER_PASS;
+                    rc = VCursorDefault ( sctx->cursor, sctx->col_idx[ consensus_tab_READ_FILTER ],
+                                      sizeof filter * 8, &filter, 0, 1 );
+                    if ( rc != 0 )
+                    {
+                        LOGERR( klogErr, rc, "cannot set cursor-default on consensus-table for read-filter-column" );
+                    }
+                    else
+                    {
+                        sctx->lctx = lctx;
+                    }
+                }
+            }
+        }
+    }
+    return rc;
+}
+
+
+rc_t load_consensus_src( con_ctx * sctx, KDirectory * hdf5_src )
+{
+    BaseCalls_cmn ConsensusTab;
+
+    rc_t rc = 0;
+    if ( sctx->lctx->check_src_obj )
+        rc = check_src_objects( hdf5_src, consensus_groups_to_check, 
+                                consensus_tables_to_check, false );
+    if ( rc == 0 )
+        rc = open_BaseCalls_cmn( hdf5_src, &ConsensusTab, true,
+                                 "PulseData/ConsensusBaseCalls", sctx->lctx->cache_content, true );
+    if ( rc == 0 )
+    {
+        uint64_t total_bases = zmw_total( &ConsensusTab.zmw );
+        uint64_t total_spots = ConsensusTab.zmw.NumEvent.extents[ 0 ];
+
+        KLogLevel tmp_lvl = KLogLevelGet();
+        KLogLevelSet( klogInfo );
+        PLOGMSG( klogInfo, ( klogInfo,
+                 "loading consensus-table ( $(bases) bases / $(spots) spots ):",
+                 "bases=%lu,spots=%lu", total_bases, total_spots ));
+        KLogLevelSet( tmp_lvl );
+
+        if ( !check_Consensus_totalcount( &ConsensusTab, total_bases ) )
+            rc = RC( rcExe, rcNoTarg, rcAllocating, rcParam, rcInvalid );
+        else
+            rc = zmw_for_each( &ConsensusTab.zmw, &sctx->lctx->xml_progress, sctx->cursor,
+                               sctx->lctx->with_progress, sctx->col_idx, NULL,
+                               true, consensus_load_spot, &ConsensusTab );
+        close_BaseCalls_cmn( &ConsensusTab );
+    }
+    return rc;
+}
+
+
+rc_t finish_consensus( con_ctx * sctx )
+{
+    VCursorRelease( sctx->cursor );
+    return 0;
+}
+
+
+rc_t load_consensus( VDatabase * database, KDirectory * hdf5_src, ld_context *lctx )
+{
+    rc_t rc = 0;
+    if ( lctx->check_src_obj )
+        rc = check_src_objects( hdf5_src, consensus_groups_to_check, 
+                                consensus_tables_to_check, false );
+    if ( rc == 0 )
+        rc = load_table( database, hdf5_src, lctx, consensus_schema_template, 
+                         consensus_table_to_create, consensus_loader );
+    return rc;
+}
diff --git a/tools/pacbio-load/pl-consensus.h b/tools/pacbio-load/pl-consensus.h
new file mode 100644
index 0000000..5b38745
--- /dev/null
+++ b/tools/pacbio-load/pl-consensus.h
@@ -0,0 +1,83 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+#ifndef _h_pl_consensus_
+#define _h_pl_consensus_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "pl-tools.h"
+#include "pl-zmw.h"
+#include "pl-basecalls_cmn.h"
+#include <klib/rc.h>
+#include <insdc/sra.h>
+
+/* enumeration of the columns of the consensus-table */
+enum
+{
+    /* base-space */
+    consensus_tab_READ = 0,
+    consensus_tab_QUALITY,
+    consensus_tab_NREADS,
+    consensus_tab_READ_TYPE,
+    consensus_tab_READ_START,
+    consensus_tab_READ_LEN,
+    consensus_tab_PLATFORM,
+    consensus_tab_READ_FILTER,
+
+    /* consensus-space */
+    consensus_tab_HOLE_NUMBER,
+    consensus_tab_HOLE_STATUS,
+    consensus_tab_HOLE_XY,
+    consensus_tab_NUM_PASSES,
+    consensus_tab_INSERTION_QV,
+    consensus_tab_DELETION_QV,
+    consensus_tab_DELETION_TAG,
+    consensus_tab_SUBSTITUTION_QV,
+    consensus_tab_SUBSTITUTION_TAG,
+    consensus_tab_count
+};
+
+
+typedef struct con_ctx
+{
+    VCursor * cursor;
+    ld_context *lctx;
+    uint32_t col_idx[ consensus_tab_count ];
+} con_ctx;
+
+rc_t prepare_consensus( VDatabase * database, con_ctx * sctx, ld_context *lctx );
+rc_t load_consensus_src( con_ctx * sctx, KDirectory * hdf5_src );
+rc_t finish_consensus( con_ctx * sctx );
+
+rc_t load_consensus( VDatabase * database, KDirectory * hdf5_src, ld_context *lctx );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/pacbio-load/pl-context.c b/tools/pacbio-load/pl-context.c
new file mode 100644
index 0000000..c789389
--- /dev/null
+++ b/tools/pacbio-load/pl-context.c
@@ -0,0 +1,211 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "pl-context.h"
+#include <sysalloc.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+
+static char * ctx_set_str( const char *src, const char *dflt )
+{
+    char * res = NULL;
+    if ( src != NULL && src[0] != 0 )
+        res = string_dup_measure ( src, NULL );
+    else if ( dflt != NULL && dflt[0] != 0 )
+        res = string_dup_measure ( dflt, NULL );
+    return res;
+}
+
+
+static rc_t ctx_get_params( const Args * args, context *ctx )
+{
+    uint32_t idx, count;
+    rc_t rc = ArgsParamCount( args, &count );
+    if ( rc != 0 )
+        LOGERR( klogErr, rc, "ArgsParamCount failed" );
+    else
+    {
+        if ( count < 1 )
+        {
+            rc = RC( rcExe, rcNoTarg, rcAllocating, rcParam, rcInvalid );
+            LOGERR( klogErr, rc, "hdf5-source-file missing" );
+            Usage ( args );
+        }
+        else for ( idx = 0; idx < count; ++idx )
+        {
+            const char *parameter = NULL;
+            rc = ArgsParamValue( args, idx, &parameter );
+            if ( rc != 0 )
+                LOGERR( klogErr, rc, "error reading commandline-parameter" );
+            else
+                rc = VNamelistAppend ( ctx->src_paths, parameter );
+        }
+    }
+    return rc;
+}
+
+
+static bool ctx_get_bool( const Args *args, const char *name, const bool def )
+{
+    uint32_t count = 0;
+    if ( ArgsOptionCount( args, name, &count ) == 0 )
+        return ( count > 0 );
+    else
+        return def;
+}
+
+
+static const char* ctx_get_str( const Args *args, const char *name, const char *def )
+{
+    const char * res = def;
+    uint32_t count = 0;
+    if ( ArgsOptionCount( args, name, &count ) == 0 && count > 0 )
+    {
+        if ( ArgsOptionValue( args, name, 0, &res ) != 0 )
+            res = def;
+    }
+    return res;
+}
+
+
+void ctx_free( context *ctx )
+{
+    if ( ctx->dst_path != NULL )
+        free( ctx->dst_path );
+    if ( ctx->schema_name != NULL )
+        free( ctx->schema_name );
+    if ( ctx->tabs != NULL )
+        free( ctx->tabs );
+    VNamelistRelease ( ctx->src_paths );
+}
+
+
+rc_t ctx_init( const Args * args, context *ctx )
+{
+    rc_t rc;
+
+    ctx->dst_path = NULL;
+    ctx->schema_name = NULL;
+    ctx->tabs = NULL;
+    ctx->force = false;
+    ctx->with_progress = false;
+
+    rc = VNamelistMake ( &ctx->src_paths, 5 );
+    if ( rc == 0 )
+    {
+        rc = ctx_get_params( args, ctx );
+        if ( rc == 0 )
+        {
+            ctx->force = ctx_get_bool( args, OPTION_FORCE, false );
+            ctx->with_progress = ctx_get_bool( args, OPTION_WITH_PROGRESS, false );
+            ctx->schema_name = ctx_set_str( ctx_get_str( args, OPTION_SCHEMA, DFLT_SCHEMA ), DFLT_SCHEMA );
+            ctx->dst_path = ctx_set_str( ctx_get_str( args, OPTION_OUTPUT, NULL ), NULL );
+            ctx->tabs = ctx_set_str( ctx_get_str( args, OPTION_TABS, NULL ), NULL );
+        }
+        if ( rc == 0 )
+        {
+            if ( ctx->dst_path == NULL )
+            {
+                rc = RC( rcExe, rcArgv, rcReading, rcParam, rcInvalid );
+                LOGMSG( klogErr, "vdb-output-directory missing!" );
+            }
+        }
+    }
+    if ( rc != 0 )
+        ctx_free( ctx );
+    return rc;
+}
+
+
+rc_t ctx_show( context * ctx )
+{
+    rc_t rc;
+    uint32_t idx, count;
+
+    KLogLevel tmp_lvl = KLogLevelGet();
+    KLogLevelSet( klogInfo );
+
+    LOGMSG( klogInfo, "pacbio-load:" );
+
+    rc = VNameListCount ( ctx->src_paths, &count );
+    if ( rc == 0 && count > 0 )
+    {
+        for ( idx = 0; idx < count && rc == 0; ++idx )
+        {
+            const char * name = NULL;
+            rc = VNameListGet ( ctx->src_paths, idx, &name );
+            if ( rc == 0 && name != NULL )
+                PLOGMSG( klogInfo, ( klogInfo, "   from    : '$(SRC)'", "SRC=%s", name ));
+        }
+    }
+
+    PLOGMSG( klogInfo, ( klogInfo, "   into    : '$(SRC)'", "SRC=%s", ctx->dst_path ));
+    PLOGMSG( klogInfo, ( klogInfo, "   schema  : '$(SRC)'", "SRC=%s", ctx->schema_name ));
+    if ( ctx->force )
+        LOGMSG( klogInfo, "   force   : 'yes'" );
+    else
+        LOGMSG( klogInfo, "   force   : 'no'" );
+    if ( ctx->tabs != NULL )
+        PLOGMSG( klogInfo, ( klogInfo, "   tabs    : '$(SRC)'", "SRC=%s", ctx->tabs ));
+
+    KLogLevelSet( tmp_lvl );
+    return rc;
+}
+
+
+static bool ctx_ld_module( context * ctx, const char c )
+{
+    if ( ctx->tabs == NULL )
+        return true;
+    else
+        return ( strchr( ctx->tabs, c ) != NULL );
+}
+
+
+bool ctx_ld_sequence( context * ctx )
+{
+    return ctx_ld_module( ctx, 'S' );
+}
+
+
+bool ctx_ld_consensus( context * ctx )
+{
+    return ctx_ld_module( ctx, 'C' );
+}
+
+
+bool ctx_ld_passes( context * ctx )
+{
+    return ctx_ld_module( ctx, 'P' );
+}
+
+
+bool ctx_ld_metrics( context * ctx )
+{
+    return ctx_ld_module( ctx, 'M' );
+}
diff --git a/tools/pacbio-load/pl-context.h b/tools/pacbio-load/pl-context.h
new file mode 100644
index 0000000..abca8de
--- /dev/null
+++ b/tools/pacbio-load/pl-context.h
@@ -0,0 +1,87 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_pl_context_
+#define _h_pl_context_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <klib/out.h>
+#include <klib/rc.h>
+#include <klib/text.h>
+#include <klib/log.h>
+#include <klib/namelist.h>
+
+#include <kapp/args.h>
+
+
+#define OPTION_SCHEMA       "schema"
+#define OPTION_FORCE        "force"
+#define OPTION_TABS         "tabs"
+#define OPTION_WITH_PROGRESS  "with_progressbar"
+#define OPTION_OUTPUT       "output"
+
+#define ALIAS_SCHEMA        "S"
+#define ALIAS_FORCE         "f"
+#define ALIAS_TABS          "t"
+#define ALIAS_WITH_PROGRESS "p"
+#define ALIAS_OUTPUT        "o"
+
+#define DFLT_SCHEMA         "sra/pacbio.vschema"
+#define PACBIO_SCHEMA_DB    "NCBI:SRA:PacBio:smrt:db"
+
+
+/* *******************************************************************
+the parameter-context contains all informations needed to load
+******************************************************************* */
+typedef struct context
+{
+    char *dst_path;     /* the vdb-database-path to create */
+    char *schema_name;  /* name of a schema-file to use", if different from std */
+    char *tabs;         /* load only these tabs... */
+    VNamelist * src_paths;  /* list of source-paths */
+    bool force;         /* if true", overwrite eventually existing output-db */
+    bool with_progress; /* if true", use the pl_progressbar */
+} context;
+
+
+rc_t ctx_init( const Args * args, context *ctx );
+void ctx_free( context *ctx );
+
+rc_t ctx_show( context * ctx );
+bool ctx_ld_sequence( context * ctx );
+bool ctx_ld_consensus( context * ctx );
+bool ctx_ld_passes( context * ctx );
+bool ctx_ld_metrics( context * ctx );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/pacbio-load/pl-metrics.c b/tools/pacbio-load/pl-metrics.c
new file mode 100644
index 0000000..30d70ac
--- /dev/null
+++ b/tools/pacbio-load/pl-metrics.c
@@ -0,0 +1,779 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "pl-metrics.h"
+#include <sysalloc.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+const char * metrics_tab_names[] = 
+{ 
+    "BASE_FRACTION",
+    "BASE_IPD",
+    "BASE_RATE",
+    "BASE_WIDTH",
+    "CHAN_BASE_QV",
+    "CHAN_DEL_QV",
+    "CHAN_INS_QV",
+    "CHAN_SUB_QV",
+    "LOCAL_BASE_RATE",
+    "DARK_BASE_RATE",
+    "HQ_RGN_START_TIME",
+    "HQ_RGN_END_TIME",
+    "HQ_RGN_SNR",
+    "PRODUCTIVITY",
+    "READ_SCORE",
+    "READ_BASE_QV",
+    "READ_DEL_QV",
+    "READ_INS_QV",
+    "READ_SUB_QV"
+};
+
+
+typedef struct Metrics_src
+{
+    af_data BaseFraction;
+    af_data BaseIpd;
+    af_data BaseRate;
+    af_data BaseWidth;
+    af_data CmBasQV;
+    af_data CmDelQV;
+    af_data CmInsQV;
+    af_data CmSubQV;
+    af_data LocalBaseRate;
+    af_data DarkBaseRate;
+    af_data HQRegionStartTime;
+    af_data HQRegionEndTime;
+    af_data HQRegionSNR;
+    af_data Productivity;
+    af_data ReadScore;
+    af_data RmBasQV;
+    af_data RmDelQV;
+    af_data RmInsQV;
+    af_data RmSubQV;
+} Metrics_src;
+
+
+static void init_Metrics_src( Metrics_src *tab )
+{
+    init_array_file( &tab->BaseFraction );
+    init_array_file( &tab->BaseIpd );
+    init_array_file( &tab->BaseRate );
+    init_array_file( &tab->BaseWidth );
+    init_array_file( &tab->CmBasQV );
+    init_array_file( &tab->CmDelQV );
+    init_array_file( &tab->CmInsQV );
+    init_array_file( &tab->CmSubQV );
+    init_array_file( &tab->LocalBaseRate );
+    init_array_file( &tab->DarkBaseRate );
+    init_array_file( &tab->HQRegionStartTime );
+    init_array_file( &tab->HQRegionEndTime );
+    init_array_file( &tab->HQRegionSNR );
+    init_array_file( &tab->Productivity );
+    init_array_file( &tab->ReadScore );
+    init_array_file( &tab->RmBasQV );
+    init_array_file( &tab->RmDelQV );
+    init_array_file( &tab->RmInsQV );
+    init_array_file( &tab->RmSubQV );
+}
+
+
+static void close_Metrics_src( Metrics_src *tab )
+{
+    free_array_file( &tab->BaseFraction );
+    free_array_file( &tab->BaseIpd );
+    free_array_file( &tab->BaseRate );
+    free_array_file( &tab->BaseWidth );
+    free_array_file( &tab->CmBasQV );
+    free_array_file( &tab->CmDelQV );
+    free_array_file( &tab->CmInsQV );
+    free_array_file( &tab->CmSubQV );
+    free_array_file( &tab->LocalBaseRate );
+    free_array_file( &tab->DarkBaseRate );
+    free_array_file( &tab->HQRegionStartTime );
+    free_array_file( &tab->HQRegionEndTime );
+    free_array_file( &tab->HQRegionSNR );
+    free_array_file( &tab->Productivity );
+    free_array_file( &tab->ReadScore );
+    free_array_file( &tab->RmBasQV );
+    free_array_file( &tab->RmDelQV );
+    free_array_file( &tab->RmInsQV );
+    free_array_file( &tab->RmSubQV );
+}
+
+
+static rc_t open_Metrics_src( const KDirectory *hdf5_dir, Metrics_src *tab,
+                              const char * path, bool cache_content )
+{
+    rc_t rc, rc_none;
+    init_Metrics_src( tab );
+
+    rc = open_element( hdf5_dir, &tab->BaseFraction, path, "BaseFraction", 
+                  BASE_FRACTION_BITSIZE, BASE_FRACTION_COLS,
+                  true, cache_content, false );
+
+    /* it is ok if BaseIpd is missing !!! */
+    if ( rc == 0 )
+    {
+        rc_none = open_element( hdf5_dir, &tab->BaseIpd, path, "BaseIpd", 
+                    BASE_IPD_BITSIZE, BASE_IPD_COLS,
+                    true, cache_content, true );
+        if ( rc_none != 0 )
+        {
+            print_log_info( "metrics -> BaseIpd is missing" );
+        }
+    }
+
+    if ( rc == 0 )
+        rc = open_element( hdf5_dir, &tab->BaseRate, path, "BaseRate", 
+                  BASE_RATE_BITSIZE, BASE_RATE_COLS,
+                  true, cache_content, false );
+    if ( rc == 0 )
+        rc = open_element( hdf5_dir, &tab->BaseWidth, path, "BaseWidth", 
+                  BASE_WIDTH_BITSIZE, BASE_WIDTH_COLS,
+                  true, cache_content, false );
+    if ( rc == 0 )
+        rc = open_element( hdf5_dir, &tab->CmBasQV, path, "CmBasQv", 
+                  CM_BAS_QV_BITSIZE, CM_BAS_QV_COLS,
+                  true, cache_content, false );
+    if ( rc == 0 )
+        rc = open_element( hdf5_dir, &tab->CmDelQV, path, "CmDelQv",
+                  CM_DEL_QV_BITSIZE, CM_DEL_QV_COLS,
+                  true, cache_content, false );
+    if ( rc == 0 )
+        rc = open_element( hdf5_dir, &tab->CmInsQV, path, "CmInsQv",
+                  CM_INS_QV_BITSIZE, CM_INS_QV_COLS,
+                  true, cache_content, false );
+    if ( rc == 0 )
+        rc = open_element( hdf5_dir, &tab->CmSubQV, path, "CmSubQv",
+                  CM_SUB_QV_BITSIZE, CM_SUB_QV_COLS,
+                  true, cache_content, false );
+
+    if ( rc == 0 )
+    {
+        /* it is ok if LocalBaseRate is missing !!! */
+        rc_none = open_element( hdf5_dir, &tab->LocalBaseRate, path, "LocalBaseRate",
+                  LOCAL_BASE_RATE_BITSIZE, LOCAL_BASE_RATE_COLS,
+                  true, cache_content, true );
+        if ( rc_none != 0 )
+        {
+            print_log_info( "metrics -> LocalBaseRate is missing" );
+        }
+
+        /* it is ok if DarkBaseRate is missing !!! */
+        rc_none = open_element( hdf5_dir, &tab->DarkBaseRate, path, "DarkBaseRate",
+                      DARK_BASE_RATE_BITSIZE, DARK_BASE_RATE_COLS,
+                      true, cache_content, true );
+        if ( rc_none != 0 )
+        {
+            print_log_info( "metrics -> DarkBaseRate is missing" );
+        }
+
+        /* it is ok if HQRegionStartTime is missing !!! */
+        rc_none = open_element( hdf5_dir, &tab->HQRegionStartTime, path, "HQRegionStartTime",
+                      HQ_REGION_START_TIME_BITSIZE, HQ_REGION_START_TIME_COLS,
+                      true, cache_content, true );
+        if ( rc_none != 0 )
+        {
+            print_log_info( "metrics -> HQRegionStartTime is missing" );
+        }
+
+        /* it is ok if HQRegionEndTime is missing !!! */
+        rc_none = open_element( hdf5_dir, &tab->HQRegionEndTime, path, "HQRegionEndTime",
+                      HQ_REGION_END_TIME_BITSIZE, HQ_REGION_END_TIME_COLS,
+                      true, cache_content, true );
+        if ( rc_none != 0 )
+        {
+            print_log_info( "metrics -> HQRegionEndTime is missing" );
+        }
+
+        /* it is ok of HQRegionSNR is missing !!! ( discovered 12/16/2011 )*/
+        rc_none = open_element( hdf5_dir, &tab->HQRegionSNR, path, "HQRegionSNR",
+                    HQ_REGION_SNR_BITSIZE, HQ_REGION_SNR_COLS,
+                    true, cache_content, true );
+        if ( rc_none != 0 )
+        {
+            print_log_info( "metrics -> HQRegionSNR is missing" );
+        }
+    }
+
+    if ( rc == 0 )
+        rc = open_element( hdf5_dir, &tab->Productivity, path, "Productivity",
+                  PRODUCTIVITY_BITSIZE, PRODUCTIVITY_COLS,
+                  true, cache_content, false );
+    if ( rc == 0 )
+        rc = open_element( hdf5_dir, &tab->ReadScore, path, "ReadScore",
+                  READ_SCORE_BITSIZE, READ_SCORE_COLS,
+                  true, cache_content, false );
+    if ( rc == 0 )
+        rc = open_element( hdf5_dir, &tab->RmBasQV, path, "RmBasQv", 
+                  RM_BAS_QV_BITSIZE, RM_BAS_QV_COLS,
+                  true, cache_content, false );
+    if ( rc == 0 )
+        rc = open_element( hdf5_dir, &tab->RmDelQV, path, "RmDelQv",
+                  RM_DEL_QV_BITSIZE, RM_DEL_QV_COLS,
+                  true, cache_content, false );
+    if ( rc == 0 )
+        rc = open_element( hdf5_dir, &tab->RmInsQV, path, "RmInsQv",
+                  RM_INS_QV_BITSIZE, RM_INS_QV_COLS,
+                  true, cache_content, false );
+    if ( rc == 0 )
+        rc = open_element( hdf5_dir, &tab->RmSubQV, path, "RmSubQv",
+                  RM_SUB_QV_BITSIZE, RM_SUB_QV_COLS,
+                  true, cache_content, false );
+    if ( rc != 0 )
+        close_Metrics_src( tab );
+    return rc;
+}
+
+
+static bool check_Metrics_ext( af_data *af, bool *needed, uint64_t *expected,
+                               const char * s )
+{
+    bool res = true;
+
+    if ( *needed )
+    {
+        *expected = af->extents[ 0 ];
+        *needed = false;
+    }
+    else
+        res = check_table_count( af, s, *expected );
+    return res;
+}
+
+static bool check_Metrics_extents( Metrics_src *tab )
+{
+    bool res = true;
+    bool needed = true;
+    uint64_t expected = 0;
+
+    if ( tab->BaseFraction.rc == 0 && res )
+        res = check_Metrics_ext( &tab->BaseFraction, &needed, &expected, "BaseFraction" );
+
+    if ( tab->BaseIpd.rc == 0 && res )
+        res = check_Metrics_ext( &tab->BaseIpd, &needed, &expected, "BaseIpd" );
+
+    if ( tab->BaseRate.rc == 0 && res )
+        res = check_Metrics_ext( &tab->BaseRate, &needed, &expected, "BaseRate" );
+
+    if ( tab->BaseWidth.rc == 0 && res )
+        res = check_Metrics_ext( &tab->BaseWidth, &needed, &expected, "BaseWidth" );
+
+    if ( tab->CmBasQV.rc == 0 && res )
+        res = check_Metrics_ext( &tab->CmBasQV, &needed, &expected, "CmBasQV" );
+
+    if ( tab->CmDelQV.rc == 0 && res )
+        res = check_Metrics_ext( &tab->CmDelQV, &needed, &expected, "CmDelQV" );
+
+    if ( tab->CmInsQV.rc == 0 && res )
+        res = check_Metrics_ext( &tab->CmInsQV, &needed, &expected, "CmInsQV" );
+
+    if ( tab->CmSubQV.rc == 0 && res )
+        res = check_Metrics_ext( &tab->CmSubQV, &needed, &expected, "CmSubQV" );
+
+    if ( tab->LocalBaseRate.rc == 0 && res )
+        res = check_Metrics_ext( &tab->LocalBaseRate, &needed, &expected, "LocalBaseRate" );
+
+    if ( tab->DarkBaseRate.rc == 0 && res )
+        res = check_Metrics_ext( &tab->DarkBaseRate, &needed, &expected, "DarkBaseRate" );
+
+    if ( tab->HQRegionStartTime.rc == 0 && res )
+        res = check_Metrics_ext( &tab->HQRegionStartTime, &needed, &expected, "HQRegionStartTime" );
+
+    if ( tab->HQRegionEndTime.rc == 0 && res )
+        res = check_Metrics_ext( &tab->HQRegionEndTime, &needed, &expected, "HQRegionEndTime" );
+
+    if ( tab->HQRegionSNR.rc == 0 && res )
+        res = check_Metrics_ext( &tab->HQRegionSNR, &needed, &expected, "HQRegionSNR" );
+
+    if ( tab->Productivity.rc == 0 && res )
+        res = check_Metrics_ext( &tab->Productivity, &needed, &expected, "Productivity" );
+
+    if ( tab->ReadScore.rc == 0 && res )
+        res = check_Metrics_ext( &tab->ReadScore, &needed, &expected, "ReadScore" );
+
+    if ( tab->RmBasQV.rc == 0 && res )
+        res = check_Metrics_ext( &tab->RmBasQV, &needed, &expected, "RmBasQV" );
+
+    if ( tab->RmDelQV.rc == 0 && res )
+        res = check_Metrics_ext( &tab->RmDelQV, &needed, &expected, "RmDelQV" );
+
+    if ( tab->RmInsQV.rc == 0 && res )
+        res = check_Metrics_ext( &tab->RmInsQV, &needed, &expected, "RmInsQV" );
+
+    if ( tab->RmSubQV.rc == 0 && res )
+        res = check_Metrics_ext( &tab->RmSubQV, &needed, &expected, "RmSubQV" );
+
+    return res;
+}
+
+
+#define METRICS_BLOCK_SIZE 1024
+
+typedef struct metrics_block
+{
+    float   BaseFraction[ METRICS_BLOCK_SIZE ][4];
+    float   BaseIpd[ METRICS_BLOCK_SIZE ];
+    float   BaseRate[ METRICS_BLOCK_SIZE ];
+    float   BaseWidth[ METRICS_BLOCK_SIZE ];
+    float   CmBasQV[ METRICS_BLOCK_SIZE ][4];
+    float   CmDelQV[ METRICS_BLOCK_SIZE ][4];
+    float   CmInsQV[ METRICS_BLOCK_SIZE ][4];
+    float   CmSubQV[ METRICS_BLOCK_SIZE ][4];
+    float   LocalBaseRate[ METRICS_BLOCK_SIZE ];
+    float   DarkBaseRate[ METRICS_BLOCK_SIZE ];
+    float   HQRegionStartTime[ METRICS_BLOCK_SIZE ];
+    float   HQRegionEndTime[ METRICS_BLOCK_SIZE ];
+    float   HQRegionSNR[ METRICS_BLOCK_SIZE ][4];
+    uint8_t Productivity[ METRICS_BLOCK_SIZE ];
+    float   ReadScore[ METRICS_BLOCK_SIZE ];
+    float   RmBasQV[ METRICS_BLOCK_SIZE ];
+    float   RmDelQV[ METRICS_BLOCK_SIZE ];
+    float   RmInsQV[ METRICS_BLOCK_SIZE ];
+    float   RmSubQV[ METRICS_BLOCK_SIZE ];
+    uint64_t n_read;
+} metrics_block;
+
+
+
+static rc_t metrics_block_read_from_src( Metrics_src *tab,
+                                      const uint64_t total_rows,
+                                      const uint64_t pos,
+                                      metrics_block * block )
+{
+    rc_t rc = 0 ;
+    uint64_t to_read = METRICS_BLOCK_SIZE;
+    uint64_t read;
+
+    block->n_read = 0;
+    if ( ( pos + to_read ) >= total_rows )
+        to_read = ( total_rows - pos );
+
+    if ( tab->BaseFraction.rc == 0 )
+        rc = array_file_read_dim2( &tab->BaseFraction, pos, 
+                                   &block->BaseFraction[0][0],
+                                   to_read, 4, &read );
+    else
+        memset( &block->BaseFraction[0][0], 0, to_read * 4 * sizeof( float ) );
+
+    if ( rc == 0 && tab->BaseIpd.rc == 0 )
+        rc = array_file_read_dim1( &tab->BaseIpd, pos, 
+                                   &block->BaseIpd[0],
+                                   to_read, &read );
+    else
+        memset( &block->BaseIpd[0], 0, to_read * sizeof( float ) );
+
+    if ( rc == 0 && tab->BaseRate.rc == 0 )
+        rc = array_file_read_dim1( &tab->BaseRate, pos, 
+                                   &block->BaseRate[0],
+                                   to_read, &read );
+    else
+        memset( &block->BaseRate[0], 0, to_read * sizeof( float ) );
+
+    if ( rc == 0 && tab->BaseWidth.rc == 0 )
+        rc = array_file_read_dim1( &tab->BaseWidth, pos, 
+                                   &block->BaseWidth[0],
+                                   to_read, &read );
+    else
+        memset( &block->BaseWidth[0], 0, to_read * sizeof( float ) );
+
+    if ( rc == 0 && tab->CmBasQV.rc == 0 )
+        rc = array_file_read_dim2( &tab->CmBasQV, pos, 
+                                   &block->CmBasQV[0][0],
+                                   to_read, 4, &read );
+    else
+        memset( &block->CmBasQV[0][0], 0, to_read * 4 * sizeof( float ) );
+
+    if ( rc == 0 && tab->CmDelQV.rc == 0 )
+        rc = array_file_read_dim2( &tab->CmDelQV, pos, 
+                                   &block->CmDelQV[0][0],
+                                   to_read, 4, &read );
+    else
+        memset( &block->CmDelQV[0][0], 0, to_read * 4 * sizeof( float ) );
+
+    if ( rc == 0 && tab->CmInsQV.rc == 0 )
+        rc = array_file_read_dim2( &tab->CmInsQV, pos, 
+                                   &block->CmInsQV[0][0],
+                                   to_read, 4, &read );
+    else
+        memset( &block->CmInsQV[0][0], 0, to_read * 4 * sizeof( float ) );
+
+    if ( rc == 0 && tab->CmSubQV.rc == 0 )
+        rc = array_file_read_dim2( &tab->CmSubQV, pos, 
+                                   &block->CmSubQV[0][0],
+                                   to_read, 4, &read );
+    else
+        memset( &block->CmSubQV[0][0], 0, to_read * 4 * sizeof( float ) );
+
+    if ( rc == 0 && tab->LocalBaseRate.rc == 0 )
+        rc = array_file_read_dim1( &tab->LocalBaseRate, pos, 
+                                   &block->LocalBaseRate[0],
+                                   to_read, &read );
+    else
+        memset( &block->LocalBaseRate[0], 0, to_read * sizeof( float ) );
+
+    if ( rc == 0 && tab->DarkBaseRate.rc == 0 )
+        rc = array_file_read_dim1( &tab->DarkBaseRate, pos, 
+                                   &block->DarkBaseRate[0],
+                                   to_read, &read );
+    else
+        memset( &block->DarkBaseRate[0], 0, to_read * sizeof( float ) );
+
+    if ( rc == 0 && tab->HQRegionStartTime.rc == 0 )
+        rc = array_file_read_dim1( &tab->HQRegionStartTime, pos, 
+                                   &block->HQRegionStartTime[0],
+                                   to_read, &read );
+    else
+        memset( &block->HQRegionStartTime[0], 0, to_read * sizeof( float ) );
+
+    if ( rc == 0 && tab->HQRegionEndTime.rc == 0 )
+        rc = array_file_read_dim1( &tab->HQRegionEndTime, pos, 
+                                   &block->HQRegionEndTime[0],
+                                   to_read, &read );
+    else
+        memset( &block->HQRegionEndTime[0], 0, to_read * sizeof( float ) );
+
+    if ( rc == 0 && tab->HQRegionSNR.rc == 0 )
+        rc = array_file_read_dim2( &tab->HQRegionSNR, pos, 
+                                   &block->HQRegionSNR[0][0],
+                                   to_read, 4, &read );
+    else
+        memset( &block->HQRegionSNR[0], 0, to_read * 4 * sizeof( float ) );
+
+    if ( rc == 0 && tab->Productivity.rc == 0 )
+        rc = array_file_read_dim1( &tab->Productivity, pos, 
+                                   &block->Productivity[0],
+                                   to_read, &read );
+    else
+        memset( &block->Productivity[0], 0, to_read * sizeof( uint8_t ) );
+
+    if ( rc == 0 && tab->ReadScore.rc == 0 )
+        rc = array_file_read_dim1( &tab->ReadScore, pos, 
+                                   &block->ReadScore[0],
+                                   to_read, &read );
+    else
+        memset( &block->ReadScore[0], 0, to_read * sizeof( float ) );
+
+    if ( rc == 0 && tab->RmBasQV.rc == 0 )
+        rc = array_file_read_dim1( &tab->RmBasQV, pos, 
+                                   &block->RmBasQV[0],
+                                   to_read, &read );
+    else
+        memset( &block->RmBasQV[0], 0, to_read * sizeof( float ) );
+
+    if ( rc == 0 && tab->RmDelQV.rc == 0 )
+        rc = array_file_read_dim1( &tab->RmDelQV, pos, 
+                                   &block->RmDelQV[0],
+                                   to_read, &read );
+    else
+        memset( &block->RmDelQV[0], 0, to_read * sizeof( float ) );
+
+    if ( rc == 0 && tab->RmInsQV.rc == 0 )
+        rc = array_file_read_dim1( &tab->RmInsQV, pos, 
+                                   &block->RmInsQV[0],
+                                   to_read, &read );
+    else
+        memset( &block->RmInsQV[0], 0, to_read * sizeof( float ) );
+
+    if ( rc == 0 && tab->RmSubQV.rc == 0 )
+        rc = array_file_read_dim1( &tab->RmSubQV, pos, 
+                                   &block->RmSubQV[0],
+                                   to_read, &read );
+    else
+        memset( &block->RmSubQV[0], 0, to_read * sizeof( float ) );
+
+    if ( rc == 0 )
+        block->n_read = read;
+    return rc;
+}
+
+
+static rc_t metrics_load( VCursor *cursor, metrics_block *block,
+                          const uint32_t idx, uint32_t *col_idx )
+{
+    rc_t rc = VCursorOpenRow( cursor );
+    if ( rc != 0 )
+        LOGERR( klogErr, rc, "cannot open metrics-row" );
+
+    if ( rc == 0 )
+        rc = vdb_write_value( cursor, col_idx[ metrics_tab_BASE_FRACTION ],
+                              &block->BaseFraction[idx][0], 32, 4, 
+                              "metrics.BaseFraction" );
+    if ( rc == 0 )
+        rc = vdb_write_float32( cursor, col_idx[ metrics_tab_BASE_IPD ],
+                                block->BaseIpd[idx], "metrics.BaseIpd" );
+    if ( rc == 0 )
+        rc = vdb_write_float32( cursor, col_idx[ metrics_tab_BASE_RATE ],
+                                block->BaseRate[idx], "metrics.BaseRate" );
+    if ( rc == 0 )
+        rc = vdb_write_float32( cursor, col_idx[ metrics_tab_BASE_WIDTH ],
+                                block->BaseWidth[idx], "metrics.BaseWidth" );
+    if ( rc == 0 )
+        rc = vdb_write_value( cursor, col_idx[ metrics_tab_CHAN_BASE_QV ],
+                              &block->CmBasQV[idx][0], CM_BAS_QV_BITSIZE, 4, 
+                              "metrics.CmBasQv" );
+    if ( rc == 0 )
+        rc = vdb_write_value( cursor, col_idx[ metrics_tab_CHAN_DEL_QV ],
+                              &block->CmDelQV[idx][0], CM_DEL_QV_BITSIZE, 4, 
+                              "metrics.CmDelQv" );
+    if ( rc == 0 )
+        rc = vdb_write_value( cursor, col_idx[ metrics_tab_CHAN_INS_QV ],
+                              &block->CmInsQV[idx][0], CM_INS_QV_BITSIZE, 4, 
+                              "metrics.CmInsQv" );
+    if ( rc == 0 )
+        rc = vdb_write_value( cursor, col_idx[ metrics_tab_CHAN_SUB_QV ],
+                              &block->CmSubQV[idx][0], CM_SUB_QV_BITSIZE, 4, 
+                              "metrics.CmSubQv" );
+    if ( rc == 0 )
+        rc = vdb_write_float32( cursor, col_idx[ metrics_tab_LOCAL_BASE_RATE ],
+                                block->LocalBaseRate[idx],
+                                "metrics.LocalBaseRate" );
+    if ( rc == 0 )
+        rc = vdb_write_float32( cursor, col_idx[ metrics_tab_DARK_BASE_RATE ],
+                                block->DarkBaseRate[idx],
+                                "metrics.DarkBaseRate" );
+    if ( rc == 0 )
+        rc = vdb_write_float32( cursor, col_idx[ metrics_tab_HQ_RGN_START_TIME ],
+                                block->HQRegionStartTime[idx], 
+                                "metrics.HQRegionStartTime" );
+    if ( rc == 0 )
+        rc = vdb_write_float32( cursor, col_idx[ metrics_tab_HQ_RGN_END_TIME ],
+                                block->HQRegionEndTime[idx], 
+                                "metrics.HQRegionEndTime" );
+    if ( rc == 0 )
+        rc = vdb_write_value( cursor, col_idx[ metrics_tab_HQ_RGN_SNR ],
+                              &block->HQRegionSNR[idx][0], HQ_REGION_SNR_BITSIZE, 4, 
+                              "metrics.HQRegionSNR" );
+    if ( rc == 0 )
+        rc = vdb_write_uint8( cursor, col_idx[ metrics_tab_PRODUCTIVITY ],
+                              block->Productivity[idx], 
+                              "metrics.Productivity" );
+    if ( rc == 0 )
+        rc = vdb_write_float32( cursor, col_idx[ metrics_tab_READ_SCORE ],
+                                block->ReadScore[idx], 
+                                "metrics.ReadScore" );
+    if ( rc == 0 )
+        rc = vdb_write_float32( cursor, col_idx[ metrics_tab_READ_BASE_QV ],
+                                block->RmBasQV[idx], 
+                                "metrics.RmBasQV" );
+    if ( rc == 0 )
+        rc = vdb_write_float32( cursor, col_idx[ metrics_tab_READ_DEL_QV ],
+                                block->RmDelQV[idx], 
+                                "metrics.RmDelQV" );
+    if ( rc == 0 )
+        rc = vdb_write_float32( cursor, col_idx[ metrics_tab_READ_INS_QV ],
+                                block->RmInsQV[idx], 
+                                "metrics.RmInsQV" );
+    if ( rc == 0 )
+        rc = vdb_write_float32( cursor, col_idx[ metrics_tab_READ_SUB_QV ],
+                                block->RmSubQV[idx], 
+                                "metrics.RmSubQV" );
+
+    if ( rc == 0 )
+    {
+        rc = VCursorCommitRow( cursor );
+        if ( rc != 0 )
+            LOGERR( klogErr, rc, "cannot commit metrics-row" );
+    }
+    if ( rc == 0 )
+    {
+        rc = VCursorCloseRow( cursor );
+        if ( rc != 0 )
+            LOGERR( klogErr, rc, "cannot close metrics-row" );
+    }
+
+    return rc;
+}
+
+
+static rc_t metrics_load_loop( ld_context *lctx, VCursor * cursor, Metrics_src *tab,
+                               uint32_t *col_idx )
+{
+    rc_t rc = 0;
+    KLogLevel tmp_lvl;
+    metrics_block block;
+    pl_progress *progress;
+    uint64_t pos = 0;
+    uint64_t total_rows = tab->BaseFraction.extents[0];
+
+    pl_progress_make( &progress, total_rows );
+    rc = progress_chunk( &lctx->xml_progress, total_rows );
+
+    tmp_lvl = KLogLevelGet();
+    KLogLevelSet( klogInfo );
+    PLOGMSG( klogInfo, ( klogInfo,
+                         "loading metrics-table ( $(rows) rows ) :",
+                         "rows=%lu", total_rows   ));
+    KLogLevelSet( tmp_lvl );
+
+    while( pos < total_rows && rc == 0 )
+    {
+        rc = metrics_block_read_from_src( tab, total_rows, pos, &block );
+        if ( rc == 0 )
+        {
+            uint32_t i;
+            for ( i = 0; i < block.n_read && rc == 0; ++i )
+            {
+                rc = Quitting();
+                if ( rc == 0 )
+                {
+                    /* to be replaced with progressbar action... */
+                    rc = metrics_load( cursor, &block, i, col_idx );
+                    if ( rc == 0 )
+                    {
+                        rc = progress_step( lctx->xml_progress );
+                        if ( lctx->with_progress )
+                            pl_progress_increment( progress, 1 );
+                    }
+                }
+                else
+                    LOGERR( klogErr, rc, "...loading metrics interrupted" );
+            }
+            pos += block.n_read;
+        }
+    }
+
+    pl_progress_destroy( progress );
+
+    if ( rc == 0 )
+    {
+        rc = VCursorCommit( cursor );
+        if ( rc != 0 )
+            LOGERR( klogErr, rc, "cannot commit cursor on metrics-tab" );
+    }
+    return rc;
+}
+
+
+static rc_t metrics_loader( ld_context *lctx, KDirectory * hdf5_src, VCursor * cursor, const char * table_name )
+{
+    uint32_t col_idx[ metrics_tab_count ];
+    rc_t rc = add_columns( cursor, metrics_tab_count, -1, col_idx, metrics_tab_names );
+    if ( rc == 0 )
+    {
+        rc = VCursorOpen( cursor );
+        if ( rc != 0 )
+            LOGERR( klogErr, rc, "cannot open cursor on metrics-tab" );
+        else
+        {
+            Metrics_src Metrics;
+            rc = open_Metrics_src( hdf5_src, &Metrics,
+                                   "PulseData/BaseCalls/ZMWMetrics",
+                                   lctx->cache_content );
+            if ( rc == 0 )
+            {
+                if ( check_Metrics_extents( &Metrics ) )
+                    rc = metrics_load_loop( lctx, cursor, &Metrics, col_idx );
+                else
+                    rc = RC( rcExe, rcNoTarg, rcAllocating, rcParam, rcInvalid );
+                close_Metrics_src( &Metrics );
+            }
+        }
+    }
+    return rc;
+}
+
+
+/* HDF5-Groups and tables used to load the METRICS-table */
+static const char * metrics_groups_to_check[] = 
+{ 
+    "PulseData/BaseCalls/ZMWMetrics",
+    NULL
+};
+
+
+static const char * metrics_schema_template = "ZMW_METRICS";
+static const char * metrics_table_to_create = "ZMW_METRICS";
+
+rc_t prepare_metrics( VDatabase * database, met_ctx * sctx, ld_context *lctx )
+{
+    rc_t rc = prepare_table( database, &sctx->cursor,
+            metrics_schema_template, metrics_table_to_create ); /* pl-tools.c ... this creates the cursor */
+    if ( rc == 0 )
+        rc = add_columns( sctx->cursor, metrics_tab_count, -1, sctx->col_idx, metrics_tab_names );
+    if ( rc == 0 )
+    {
+        rc = VCursorOpen( sctx->cursor );
+        if ( rc != 0 )
+        {
+            LOGERR( klogErr, rc, "cannot open cursor on metrics-tab" );
+        }
+        else
+        {
+            sctx->lctx = lctx;
+        }
+    }
+    return rc;
+}
+
+
+rc_t load_metrics_src( met_ctx * sctx, KDirectory * hdf5_src )
+{
+    Metrics_src Metrics;
+    rc_t rc = 0;
+
+    if ( sctx->lctx->check_src_obj )
+        /* in case of metrics any combination of columns can be missing... */
+        rc = check_src_objects( hdf5_src, metrics_groups_to_check, NULL, false );
+
+    if ( rc == 0 )
+        rc = open_Metrics_src( hdf5_src, &Metrics, "PulseData/BaseCalls/ZMWMetrics",
+                               sctx->lctx->cache_content );
+    if ( rc == 0 )
+    {
+        if ( check_Metrics_extents( &Metrics ) )
+            rc = metrics_load_loop( sctx->lctx, sctx->cursor, &Metrics, sctx->col_idx );
+        else
+            rc = RC( rcExe, rcNoTarg, rcAllocating, rcParam, rcInvalid );
+        close_Metrics_src( &Metrics );
+    }
+    return rc;
+}
+
+
+rc_t finish_metrics( met_ctx * sctx )
+{
+    VCursorRelease( sctx->cursor );
+    return 0;
+}
+
+
+rc_t load_metrics( VDatabase * database, KDirectory * hdf5_src, ld_context *lctx )
+{
+    rc_t rc = 0;
+    if ( lctx->check_src_obj )
+        /* in case of metrics any combination of columns can be missing... */
+        rc = check_src_objects( hdf5_src, metrics_groups_to_check, 
+                                NULL, false );
+
+    if ( rc == 0 )
+        rc = load_table( database, hdf5_src, lctx, metrics_schema_template, 
+                         metrics_table_to_create, metrics_loader );
+    return rc;
+}
diff --git a/tools/pacbio-load/pl-metrics.h b/tools/pacbio-load/pl-metrics.h
new file mode 100644
index 0000000..b52c269
--- /dev/null
+++ b/tools/pacbio-load/pl-metrics.h
@@ -0,0 +1,83 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+#ifndef _h_pl_metrics_
+#define _h_pl_metrics_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "pl-tools.h"
+#include "pl-progress.h"
+#include <kapp/main.h>
+#include <klib/rc.h>
+
+/* enumeration of the columns of the metrics-table */
+enum
+{
+    /* metrix-space */
+    metrics_tab_BASE_FRACTION,
+    metrics_tab_BASE_IPD,
+    metrics_tab_BASE_RATE,
+    metrics_tab_BASE_WIDTH,
+    metrics_tab_CHAN_BASE_QV,
+    metrics_tab_CHAN_DEL_QV,
+    metrics_tab_CHAN_INS_QV,
+    metrics_tab_CHAN_SUB_QV,
+    metrics_tab_LOCAL_BASE_RATE,
+    metrics_tab_DARK_BASE_RATE,
+    metrics_tab_HQ_RGN_START_TIME,
+    metrics_tab_HQ_RGN_END_TIME,
+    metrics_tab_HQ_RGN_SNR,
+    metrics_tab_PRODUCTIVITY,
+    metrics_tab_READ_SCORE,
+    metrics_tab_READ_BASE_QV,
+    metrics_tab_READ_DEL_QV,
+    metrics_tab_READ_INS_QV,
+    metrics_tab_READ_SUB_QV,
+    metrics_tab_count
+};
+
+
+typedef struct met_ctx
+{
+    VCursor * cursor;
+    ld_context *lctx;
+    uint32_t col_idx[ metrics_tab_count ];
+} met_ctx;
+
+
+rc_t prepare_metrics( VDatabase * database, met_ctx * sctx, ld_context *lctx );
+rc_t load_metrics_src( met_ctx * sctx, KDirectory * hdf5_src );
+rc_t finish_metrics( met_ctx * sctx );
+
+rc_t load_metrics( VDatabase * database, KDirectory * hdf5_src, ld_context *lctx );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/pacbio-load/pl-passes.c b/tools/pacbio-load/pl-passes.c
new file mode 100644
index 0000000..83fb195
--- /dev/null
+++ b/tools/pacbio-load/pl-passes.c
@@ -0,0 +1,437 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "pl-passes.h"
+#include <sysalloc.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+
+const char * passes_tab_names[] = 
+{ 
+    "ADAPTER_HIT_BEFORE",
+    "ADAPTER_HIT_AFTER",
+    "PASS_DIRECTION",
+    "PASS_NUM_BASES",
+    "PASS_START_BASE"
+};
+
+
+typedef struct Passes_src
+{
+    af_data AdapterHitBefore;
+    af_data AdapterHitAfter;
+    af_data PassDirection;
+    af_data PassNumBases;
+    af_data PassStartBase;
+} Passes_src;
+
+
+static void init_Passes_src( Passes_src *tab )
+{
+    init_array_file( &tab->AdapterHitBefore );
+    init_array_file( &tab->AdapterHitAfter );
+    init_array_file( &tab->PassDirection );
+    init_array_file( &tab->PassNumBases );
+    init_array_file( &tab->PassStartBase );
+}
+
+
+static void close_Passes_src( Passes_src *tab )
+{
+    free_array_file( &tab->AdapterHitBefore );
+    free_array_file( &tab->AdapterHitAfter );
+    free_array_file( &tab->PassDirection );
+    free_array_file( &tab->PassNumBases );
+    free_array_file( &tab->PassStartBase );
+}
+
+static rc_t open_Passes_src( const KDirectory *hdf5_dir, Passes_src *tab,
+                             const char * path, bool cache_content )
+{
+    rc_t rc;
+
+    init_Passes_src( tab );
+
+    rc = open_element( hdf5_dir, &tab->AdapterHitBefore, path, "AdapterHitBefore",
+                  ADAPTER_HIT_BEFORE_BITSIZE, ADAPTER_HIT_BEFORE_COLS, 
+                  true, cache_content, false );
+    if ( rc == 0 )
+        rc = open_element( hdf5_dir, &tab->AdapterHitAfter, path, "AdapterHitAfter",
+                  ADAPTER_HIT_AFTER_BITSIZE, ADAPTER_HIT_AFTER_COLS,
+                  true, cache_content, false );
+    if ( rc == 0 )    
+        rc = open_element( hdf5_dir, &tab->PassDirection, path, "PassDirection",
+                  PASS_DIRECTION_BITSIZE, PASS_DIRECTION_COLS,
+                  true, cache_content, false );
+    if ( rc == 0 )    
+        rc = open_element( hdf5_dir, &tab->PassNumBases, path, "PassNumBases",
+                  PASS_NUM_BASES_BITSIZE, PASS_NUM_BASES_COLS,
+                  true, cache_content, false );
+    if ( rc == 0 )
+        rc = open_element( hdf5_dir, &tab->PassStartBase, path, "PassStartBase",
+                  PASS_START_BASE_BITSIZE, PASS_START_BASE_COLS,
+                  true, cache_content, false );
+    if ( rc != 0 )
+        close_Passes_src( tab );
+    return rc;
+}
+
+
+static bool check_Passes_ext( af_data *af, bool *needed, uint64_t *expected,
+                              const char * s )
+{
+    bool res = true;
+
+    if ( *needed )
+    {
+        *expected = af->extents[ 0 ];
+        *needed = false;
+    }
+    else
+        res = check_table_count( af, s, *expected );
+    return res;
+}
+
+
+static bool check_Passes_extents( Passes_src *tab )
+{
+    bool res = true;
+    bool needed = true;
+    uint64_t expected = 0;
+
+    if ( tab->AdapterHitBefore.rc == 0 && res )
+        res = check_Passes_ext( &tab->AdapterHitBefore, &needed, &expected, "AdapterHitBefore" );
+
+    if ( tab->AdapterHitAfter.rc == 0 && res )
+        res = check_Passes_ext( &tab->AdapterHitAfter, &needed, &expected, "AdapterHitAfter" );
+
+    if ( tab->PassDirection.rc == 0 && res )
+        res = check_Passes_ext( &tab->PassDirection, &needed, &expected, "PassDirection" );
+
+    if ( tab->PassNumBases.rc == 0 && res )
+        res = check_Passes_ext( &tab->PassNumBases, &needed, &expected, "PassNumBases" );
+
+    if ( tab->PassStartBase.rc == 0 && res )
+        res = check_Passes_ext( &tab->PassStartBase, &needed, &expected, "PassStartBase" );
+
+    return res;
+}
+
+
+#define PASS_BLOCK_SIZE 1024
+
+typedef struct pass_block
+{
+    uint8_t  AdapterHitBefore[ PASS_BLOCK_SIZE ];
+    uint8_t  AdapterHitAfter[ PASS_BLOCK_SIZE ];
+    uint8_t  PassDirection[ PASS_BLOCK_SIZE ];
+    uint32_t PassNumBases[ PASS_BLOCK_SIZE ];
+    uint32_t PassStartBase[ PASS_BLOCK_SIZE ];
+    uint64_t n_read;
+} pass_block;
+
+
+static rc_t pass_block_read_from_src( Passes_src *tab,
+                                      const uint64_t total_passes,
+                                      const uint64_t pos,
+                                      pass_block * block )
+{
+    rc_t rc = 0;
+    uint64_t to_read = PASS_BLOCK_SIZE;
+    uint64_t read; 
+
+    block->n_read = 0;
+    if ( ( pos + to_read ) >= total_passes )
+        to_read = ( total_passes - pos );
+
+    if ( tab->AdapterHitBefore.rc == 0 )
+        rc = array_file_read_dim1( &tab->AdapterHitBefore, pos, 
+                                   &block->AdapterHitBefore[0],
+                                   to_read, &read );
+    else
+        memset( &block->AdapterHitBefore[0], 0, to_read * sizeof( uint8_t ) );
+
+
+    if ( rc == 0 && tab->AdapterHitAfter.rc == 0 )
+        rc = array_file_read_dim1( &tab->AdapterHitAfter, pos, 
+                                   &block->AdapterHitAfter[0],
+                                   to_read, &read );
+    else
+        memset( &block->AdapterHitAfter[0], 0, to_read * sizeof( uint8_t ) );
+
+    if ( rc == 0 && tab->PassDirection.rc == 0 )
+        rc = array_file_read_dim1( &tab->PassDirection, pos, 
+                                   &block->PassDirection[0],
+                                   to_read, &read );
+    else
+        memset( &block->PassDirection[0], 0, to_read * sizeof( uint8_t ) );
+
+    if ( rc == 0 && tab->PassNumBases.rc == 0 )
+        rc = array_file_read_dim1( &tab->PassNumBases, pos, 
+                                   &block->PassNumBases[0],
+                                   to_read, &read );
+    else
+        memset( &block->PassNumBases[0], 0, to_read * sizeof( uint32_t ) );
+
+    if ( rc == 0 && tab->PassStartBase.rc == 0 )
+        rc = array_file_read_dim1( &tab->PassStartBase, pos, 
+                                   &block->PassStartBase[0],
+                                   to_read, &read );
+    else
+        memset( &block->PassStartBase[0], 0, to_read * sizeof( uint32_t ) );
+
+    if ( rc == 0 )
+        block->n_read = read;
+
+    return rc;
+}
+
+
+static rc_t passes_load_pass( VCursor *cursor, pass_block *block,
+                              const uint32_t idx, uint32_t *col_idx )
+{
+    rc_t rc = VCursorOpenRow( cursor );
+    if ( rc != 0 )
+        LOGERR( klogErr, rc, "cannot open passes-row" );
+
+    if ( rc == 0 )
+        rc = vdb_write_uint8( cursor, 
+                        col_idx[ passes_tab_ADAPTER_HIT_BEFORE ],
+                        block->AdapterHitBefore[ idx ],
+                        "passes.AdapterHitBefore" );
+    if ( rc == 0 )
+        rc = vdb_write_uint8( cursor, 
+                        col_idx[ passes_tab_ADAPTER_HIT_AFTER ],
+                        block->AdapterHitAfter[ idx ],
+                        "passes.AdapterHitAfter" );
+    if ( rc == 0 )
+        rc = vdb_write_uint8( cursor, 
+                        col_idx[ passes_tab_PASS_DIRECTION ],
+                        block->PassDirection[ idx ],
+                        "passes.PassDirection" );
+    if ( rc == 0 )
+        rc = vdb_write_uint32( cursor, 
+                        col_idx[ passes_tab_PASS_NUM_BASES ],
+                        block->PassNumBases[ idx ],
+                        "passes.PassNumBases" );
+    if ( rc == 0 )
+        rc = vdb_write_uint32( cursor, 
+                        col_idx[ passes_tab_PASS_START_BASE ],
+                        block->PassStartBase[ idx ],
+                        "passes.PassStartBase" );
+
+    if ( rc == 0 )
+    {
+        rc = VCursorCommitRow( cursor );
+        if ( rc != 0 )
+            LOGERR( klogErr, rc, "cannot commit passes-row" );
+    }
+    if ( rc == 0 )
+    {
+        rc = VCursorCloseRow( cursor );
+        if ( rc != 0 )
+            LOGERR( klogErr, rc, "cannot close passes-row" );
+    }
+
+    return rc;
+}
+
+
+static rc_t passes_load_loop( ld_context *lctx, VCursor * cursor, Passes_src *tab,
+                              uint32_t *col_idx )
+{
+    rc_t rc = 0;
+    KLogLevel tmp_lvl;
+    pass_block block;
+    pl_progress *progress;
+    uint64_t pos = 0;
+    uint64_t total_passes = tab->AdapterHitBefore.extents[0];
+
+    pl_progress_make( &progress, total_passes );
+    rc = progress_chunk( &lctx->xml_progress, total_passes );
+
+    tmp_lvl = KLogLevelGet();
+    KLogLevelSet( klogInfo );
+    PLOGMSG( klogInfo, ( klogInfo,
+                         "loading passes-table ( $(rows) rows ) :",
+                         "rows=%lu", total_passes ));
+    KLogLevelSet( tmp_lvl );
+
+    while( pos < total_passes && rc == 0 )
+    {
+        rc = pass_block_read_from_src( tab, total_passes, pos, &block );
+        if ( rc == 0 )
+        {
+            uint32_t i;
+            for ( i = 0; i < block.n_read && rc == 0; ++i )
+            {
+                rc = Quitting();
+                if ( rc == 0 )
+                {
+                    rc = passes_load_pass( cursor, &block, i, col_idx );
+                    if ( rc == 0 )
+                    {
+                        rc = progress_step( lctx->xml_progress );
+                        if ( lctx->with_progress )
+                            pl_progress_increment( progress, 1 );
+                    }
+                }
+                else
+                    LOGERR( klogErr, rc, "...loading passes interrupted" );
+            }
+            pos += block.n_read;
+        }
+    }
+
+    pl_progress_destroy( progress );
+
+    if ( rc == 0 )
+    {
+        rc = VCursorCommit( cursor );
+        if ( rc != 0 )
+            LOGERR( klogErr, rc, "cannot commit cursor on PASSES-tab" );
+    }
+    return rc;
+}
+
+
+static rc_t passes_loader( ld_context * lctx, KDirectory * hdf5_src, VCursor * cursor, const char * table_name )
+{
+    uint32_t col_idx[ passes_tab_count ];
+    rc_t rc = add_columns( cursor, passes_tab_count, -1, col_idx, passes_tab_names );
+    if ( rc == 0 )
+    {
+        rc = VCursorOpen( cursor );
+        if ( rc != 0 )
+            LOGERR( klogErr, rc, "cannot open cursor on PASSES-tab" );
+        else
+        {
+            Passes_src Passes;
+            rc = open_Passes_src( hdf5_src, &Passes,
+                                  "PulseData/ConsensusBaseCalls/Passes",
+                                  lctx->cache_content );
+            if ( rc == 0 )
+            {
+                if ( check_Passes_extents( &Passes ) )
+                    rc = passes_load_loop( lctx, cursor, &Passes, col_idx );
+                else
+                    rc = RC( rcExe, rcNoTarg, rcAllocating, rcParam, rcInvalid );
+                close_Passes_src( &Passes );
+            }
+        }
+    }
+    return rc;
+}
+
+/* HDF5-Groups and tables used to load the PASSES-table */
+static const char * passes_groups_to_check[] = 
+{ 
+    "PulseData/ConsensusBaseCalls/Passes",
+    NULL
+};
+
+static const char * passes_tables_to_check[] = 
+{ 
+    "PulseData/ConsensusBaseCalls/Passes/AdapterHitAfter",
+    "PulseData/ConsensusBaseCalls/Passes/AdapterHitBefore",
+    "PulseData/ConsensusBaseCalls/Passes/PassDirection",
+    "PulseData/ConsensusBaseCalls/Passes/PassNumBases",
+    "PulseData/ConsensusBaseCalls/Passes/PassStartBase",
+    NULL
+};
+
+static const char * passes_schema_template = "PASSES";
+static const char * passes_table_to_create = "PASSES";
+
+
+rc_t prepare_passes( VDatabase * database, pas_ctx * sctx, ld_context *lctx )
+{
+    rc_t rc = prepare_table( database, &sctx->cursor,
+            passes_schema_template, passes_table_to_create ); /* pl-tools.c ... this creates the cursor */
+    if ( rc == 0 )
+    {
+        rc = add_columns( sctx->cursor, passes_tab_count, -1, sctx->col_idx, passes_tab_names );
+        if ( rc == 0 )
+        {
+            rc = VCursorOpen( sctx->cursor );
+            if ( rc != 0 )
+            {
+                LOGERR( klogErr, rc, "cannot open cursor on PASSES-tab" );
+            }
+            else
+            {
+                sctx->lctx = lctx;
+            }
+        }
+    }
+    return rc;
+}
+
+
+rc_t load_passes_src( pas_ctx * sctx, KDirectory * hdf5_src )
+{
+    Passes_src Passes;
+    rc_t rc = 0;
+
+    if ( sctx->lctx->check_src_obj )
+        rc = check_src_objects( hdf5_src, passes_groups_to_check, 
+                                passes_tables_to_check, false );
+    if ( rc == 0 )
+        rc = open_Passes_src( hdf5_src, &Passes, "PulseData/ConsensusBaseCalls/Passes",
+                               sctx->lctx->cache_content );
+    if ( rc == 0 )
+    {
+        if ( check_Passes_extents( &Passes ) )
+            rc = passes_load_loop( sctx->lctx, sctx->cursor, &Passes, sctx->col_idx );
+        else
+            rc = RC( rcExe, rcNoTarg, rcAllocating, rcParam, rcInvalid );
+        close_Passes_src( &Passes );
+    }
+    return rc;
+}
+
+
+rc_t finish_passes( pas_ctx * sctx )
+{
+    VCursorRelease( sctx->cursor );
+    return 0;
+}
+
+
+rc_t load_passes( VDatabase * database, KDirectory * hdf5_src, ld_context *lctx )
+{
+    rc_t rc = 0;
+    if ( lctx->check_src_obj )
+        rc = check_src_objects( hdf5_src, passes_groups_to_check, 
+                                passes_tables_to_check, false );
+    if ( rc == 0 )
+        rc = load_table( database, hdf5_src, lctx, passes_schema_template, 
+                         passes_table_to_create, passes_loader );
+    return rc;
+}
diff --git a/tools/pacbio-load/pl-passes.h b/tools/pacbio-load/pl-passes.h
new file mode 100644
index 0000000..6bb6c1c
--- /dev/null
+++ b/tools/pacbio-load/pl-passes.h
@@ -0,0 +1,70 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+#ifndef _h_pl_passes_
+#define _h_pl_passes_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "pl-tools.h"
+#include "pl-progress.h"
+#include <klib/rc.h>
+#include <kapp/main.h>
+
+/* enumeration of the columns of the passes-table */
+enum
+{
+    /* consensus-space */
+    passes_tab_ADAPTER_HIT_BEFORE,
+    passes_tab_ADAPTER_HIT_AFTER,
+    passes_tab_PASS_DIRECTION,
+    passes_tab_PASS_NUM_BASES,
+    passes_tab_PASS_START_BASE,
+    passes_tab_count
+};
+
+
+typedef struct pas_ctx
+{
+    VCursor * cursor;
+    ld_context *lctx;
+    uint32_t col_idx[ passes_tab_count ];
+} pas_ctx;
+
+
+rc_t prepare_passes( VDatabase * database, pas_ctx * sctx, ld_context *lctx );
+rc_t load_passes_src( pas_ctx * sctx, KDirectory * hdf5_src );
+rc_t finish_passes( pas_ctx * sctx );
+
+
+rc_t load_passes( VDatabase * database, KDirectory * hdf5_src, ld_context *lctx );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/pacbio-load/pl-progress.c b/tools/pacbio-load/pl-progress.c
new file mode 100644
index 0000000..f905614
--- /dev/null
+++ b/tools/pacbio-load/pl-progress.c
@@ -0,0 +1,195 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <klib/rc.h>
+#include <klib/out.h>
+#include <sysalloc.h>
+#include <stdlib.h>
+
+
+typedef struct pl_progress
+{
+    bool initialized;
+    uint8_t fract_digits;
+    uint64_t count;
+    uint64_t position;
+    uint16_t percent;
+} pl_progress;
+
+
+static uint8_t pl_calc_fract_digits( const uint64_t count )
+{
+    uint8_t res = 0;
+    if ( count > 10000 )
+    {
+        if ( count > 100000 )
+            res = 2;
+        else
+            res = 1;
+    }
+    return res;
+}
+
+
+rc_t pl_progress_make( pl_progress ** pb, const uint64_t count )
+{
+    if ( pb == NULL )
+        return RC( rcVDB, rcNoTarg, rcConstructing, rcSelf, rcNull );
+    (*pb) = calloc( 1, sizeof( struct pl_progress ) );
+    if ( *pb == NULL )
+        return RC( rcVDB, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+    (*pb)->count = count;
+    (*pb)->fract_digits = pl_calc_fract_digits( count );
+    (*pb)->position = 0;
+    return 0;
+}
+
+
+rc_t pl_progress_destroy( pl_progress * pb )
+{
+    if ( pb == NULL )
+        return RC( rcVDB, rcNoTarg, rcDestroying, rcSelf, rcNull );
+    free( pb );
+    return KOutMsg( "\n" );
+    return 0;
+}
+
+
+static void progess_0a( const uint16_t percent )
+{
+    KOutMsg( "| %2u%%", percent );
+}
+
+
+static void progess_0( const uint16_t percent )
+{
+    if ( percent & 1 )
+        KOutMsg( "\b\b\b\b- %2u%%", percent );
+    else
+        KOutMsg( "\b\b\b%2u%%", percent );
+}
+
+
+static void progess_1a( const uint16_t percent )
+{
+    uint16_t p1 = percent / 10;
+    uint16_t p0 = percent - ( p1 * 10 );
+    KOutMsg( "| %2u.%01u%%", p1, p0 );
+}
+
+
+static void progess_1( const uint16_t percent )
+{
+    uint16_t p1 = percent / 10;
+    uint16_t p0 = percent - ( p1 * 10 );
+    if ( ( p1 & 1 )&&( p0 == 0 ) )
+        KOutMsg( "\b\b\b\b\b\b- %2u.%01u%%", p1, p0 );
+    else
+        KOutMsg( "\b\b\b\b\b%2u.%01u%%", p1, p0 );
+}
+
+
+static void progess_2a( const uint16_t percent )
+{
+    uint16_t p1 = percent / 100;
+    uint16_t p0 = percent - ( p1 * 100 );
+    KOutMsg( "| %2u.%02u%%", p1, p0 );
+}
+
+
+static void progess_2( const uint16_t percent )
+{
+    uint16_t p1 = percent / 100;
+    uint16_t p0 = percent - ( p1 * 100 );
+    if ( ( p1 & 1 )&&( p0 == 0 ) )
+        KOutMsg( "\b\b\b\b\b\b\b- %2u.%02u%%", p1, p0 );
+    else
+        KOutMsg( "\b\b\b\b\b\b%2u.%02u%%", p1, p0 );
+}
+
+
+uint32_t calc_percent( pl_progress * pb )
+{
+    uint32_t res = 0;
+    uint32_t factor = 100;
+    if ( pb->fract_digits > 0 )
+    {
+        if ( pb->fract_digits > 1 )
+            factor = 10000;
+        else
+            factor = 1000;
+    }
+        
+    if ( pb->count > 0 )
+    {
+        if ( pb->position >= pb->count )
+            res = factor;
+        else
+        {
+            uint64_t temp = pb->position;
+            temp *= factor;
+            temp /= pb->count;
+            res = (uint32_t) temp;
+        }
+    }
+    return res;
+}
+
+
+rc_t pl_progress_increment( pl_progress * pb, const uint64_t step )
+{
+    uint32_t percent;
+    if ( pb == NULL )
+        return RC( rcVDB, rcNoTarg, rcParsing, rcSelf, rcNull );
+
+    pb->position += step;
+    percent = calc_percent( pb );
+    if ( pb->initialized )
+    {
+        if ( pb->percent != percent )
+        {
+            pb->percent = percent;
+            switch( pb->fract_digits )
+            {
+            case 0 : progess_0( percent ); break;
+            case 1 : progess_1( percent ); break;
+            case 2 : progess_2( percent ); break;
+            }
+        }
+    }
+    else
+    {
+        pb->percent = percent;
+        switch( pb->fract_digits )
+        {
+        case 0 : progess_0a( percent ); break;
+        case 1 : progess_1a( percent ); break;
+        case 2 : progess_2a( percent ); break;
+        }
+        pb->initialized = true;
+    }
+    return 0;
+}
diff --git a/tools/pacbio-load/pl-progress.h b/tools/pacbio-load/pl-progress.h
new file mode 100644
index 0000000..e4c05b6
--- /dev/null
+++ b/tools/pacbio-load/pl-progress.h
@@ -0,0 +1,70 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_pl_progress_
+#define _h_pl_progress_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct pl_progress pl_progress;
+
+/*--------------------------------------------------------------------------
+ * make_progressbar
+ *
+ *  creates a progressbar with zero-values inside
+ *  does not output anything
+ */
+rc_t pl_progress_make( pl_progress ** pb, const uint64_t count );
+
+
+/*--------------------------------------------------------------------------
+ * destroy_progressbar
+ *
+ *  destroy's the progressbar
+ *  does not output anything
+ */
+rc_t pl_progress_destroy( pl_progress * pb );
+
+
+/*--------------------------------------------------------------------------
+ * update_progressbar
+ *
+ *  sets the progressbar to a specific percentage
+ *  outputs only if the percentage has changed from the last call
+ *  the precentage is in 1/10-th of a percent ( 21,6% = 216 )
+ *  expects the percents in increasing order ( does not jump back )
+ *  writes a growing bar made from '-'-chars every 2nd percent
+ */
+rc_t pl_progress_increment( pl_progress * pb, const uint64_t step );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/pacbio-load/pl-regions.c b/tools/pacbio-load/pl-regions.c
new file mode 100644
index 0000000..4cf66ea
--- /dev/null
+++ b/tools/pacbio-load/pl-regions.c
@@ -0,0 +1,1048 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "pl-regions.h"
+#include <insdc/sra.h>
+#include <sysalloc.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+enum
+{
+    pacbio_idx_spot_id = 0,
+    pacbio_idx_type,
+    pacbio_idx_start,
+    pacbio_idx_end,
+    pacbio_idx_score
+};
+
+
+/* HDF5-Groups and tables used to use the REGIONS-table */
+static const char * region_groups_to_check[] = 
+{ 
+    "PulseData",
+    NULL
+};
+
+static const char * region_tables_to_check[] = 
+{ 
+    "PulseData/Regions",
+    NULL
+};
+
+
+void rgn_stat_init( regions_stat * stat )
+{
+    stat->inserts = 0;
+    stat->expands_a = 0;
+    stat->expands_i = 0;
+    stat->inserts_spots = 0;
+    stat->expands_spots = 0;
+    stat->end_gap = 0;
+    stat->overlapps = 0;
+    stat->removed = 0;
+}
+
+
+void rgn_init( regions *rgn )
+{
+    init_array_file( &rgn->hdf5_regions );
+
+    VectorInit ( &rgn->read_Regions, 0, 5 );
+    VectorInit ( &rgn->sort_Regions, 0, 5 );
+    VectorInit ( &rgn->stock_Regions, 0, 5 );
+
+    rgn->data_32 = NULL;
+    rgn->data_32_len = 0;
+    rgn->data_8 = NULL;
+    rgn->data_8_len = 0;
+
+    rgn->offset = 0;
+    rgn->spot_id = 0;
+    rgn->spot_len = 0;
+    rgn->hq_rgn.start = 0;
+    rgn->hq_rgn.end = 0;
+
+    rgn_stat_init( &( rgn->stat ) );
+
+    rgn->complete_table = NULL;
+    rgn->table_index = NULL;
+}
+
+
+static void CC region_whack( void * item, void * data )
+{
+    free( item );
+}
+
+
+static rc_t rgn_vector_move( Vector * src, Vector * dst )
+{
+    rc_t rc = 0;
+    while ( VectorLength( src ) > 0 && rc == 0 )
+    {
+        region *ptr;
+        rc = VectorRemove ( src, 0, (void**)&ptr );
+        if ( rc == 0 )
+            rc = VectorAppend ( dst, NULL, ptr );
+    }
+    return rc;
+}
+
+
+void rgn_free( regions *rgn )
+{
+    free_array_file( &rgn->hdf5_regions );
+
+    VectorWhack ( &rgn->read_Regions, region_whack, NULL );
+    VectorWhack ( &rgn->sort_Regions, region_whack, NULL );
+    VectorWhack ( &rgn->stock_Regions, region_whack, NULL );
+
+    if ( rgn->data_32 != NULL )
+        free( rgn->data_32 );
+    if ( rgn->data_8 != NULL )
+        free( rgn->data_8 );
+
+    if ( rgn->complete_table != NULL )
+        free( rgn->complete_table );
+    if ( rgn->table_index != NULL )
+        free( rgn->table_index );
+}
+
+
+static
+int CC rgn_sort_callback( const void *p1, const void *p2, void * data )
+{
+    regions *rgn = ( regions * ) data;
+    int32_t idx1 = *( int32_t * ) p1;
+    int32_t idx2 = *( int32_t * ) p2;
+    int32_t spot_id1 = rgn->complete_table[ idx1 * RGN_COLUMN_COUNT ];
+    int32_t spot_id2 = rgn->complete_table[ idx2 * RGN_COLUMN_COUNT ];
+    if ( spot_id1 == spot_id2 )
+        return ( idx1 - idx2 );
+    return ( spot_id1 - spot_id2 );
+}
+
+
+static
+rc_t rgn_read_complete_table( regions *rgn )
+{
+    rc_t rc;
+    uint32_t rowcount = rgn->hdf5_regions.extents[ 0 ];
+    uint32_t rowsize = sizeof( int32_t ) * RGN_COLUMN_COUNT;
+
+    rgn->complete_table = malloc( rowcount * rowsize );
+    if ( rgn->complete_table == NULL )
+        rc = RC( rcExe, rcNoTarg, rcLoading, rcMemory, rcExhausted );
+    else
+    {
+        rgn->table_index = malloc( sizeof( uint32_t ) * rowcount );
+        if ( rgn->table_index == NULL )
+        {
+            free( rgn->complete_table );
+            rgn->complete_table = NULL;
+            rc = RC( rcExe, rcNoTarg, rcLoading, rcMemory, rcExhausted );
+        }
+        else
+        {
+            uint64_t n_read = 0;
+
+            /* now let's read the whole table... */
+            rc = array_file_read_dim2( &(rgn->hdf5_regions), 0, rgn->complete_table,
+                                       rowcount, RGN_COLUMN_COUNT, &n_read );
+            if ( rc == 0 )
+            {
+                uint32_t idx, first_spot_id;
+
+                first_spot_id = rgn->complete_table[ pacbio_idx_spot_id ];
+                if ( first_spot_id != 0 )
+                {
+                    /* in case the file we are loading is part of a multi-file submission */
+                    for ( idx = 0; idx < rowcount; ++idx )
+                        rgn->complete_table[ ( idx * RGN_COLUMN_COUNT ) + pacbio_idx_spot_id ] -= first_spot_id;
+                }
+                
+                /* first let's fill the index, first with ascending row-id's */
+                for ( idx = 0; idx < rowcount; ++idx )
+                    rgn->table_index[ idx ] = idx;
+
+                /* now sort the index-array by the content's spot-id's */
+                ksort ( rgn->table_index, rowcount, sizeof( uint32_t ),
+                        rgn_sort_callback, rgn );
+                
+                /* left here to print a debug-output of the sorted table-index */
+                /*
+                for ( idx = rowcount - 128; idx < rowcount; ++idx )
+                    OUTMSG(( "idx[%i] = %i -> %i\n", 
+                             idx, rgn->table_index[ idx ], 
+                             rgn->complete_table[ rgn->table_index[ idx ] * RGN_COLUMN_COUNT ] ));
+                */
+
+                /* the table and the index is now ready to use... */
+            }
+        }
+    }
+    return rc;
+}
+
+
+rc_t rgn_open( const KDirectory *hdf5_dir, regions *rgn )
+{
+    rc_t rc;
+    rgn_init( rgn );
+    /* check if the necessary groups/tables are there */
+    rc = check_src_objects( hdf5_dir, region_groups_to_check, 
+                            region_tables_to_check, false );
+    if ( rc == 0 )
+    {
+        /* open the region-table... */
+        rc = open_element( hdf5_dir, &rgn->hdf5_regions,
+                           region_groups_to_check[ 0 ], "Regions", 
+                           REGIONS_BITSIZE, REGIONS_COLS, true, false, true );
+        if ( rc == 0 )
+            rc = rgn_read_complete_table( rgn );
+    }
+    if ( rc != 0 )
+        rgn_free( rgn );
+    return rc;
+}
+
+
+static rc_t rgn_get_or_make( Vector * stock, region ** r )
+{
+    rc_t rc = 0;
+    /* take it out of the stock or make a new one... */
+    if ( VectorLength( stock ) > 0 )
+        rc = VectorRemove ( stock, 0, (void**)r );
+    else
+        *r = malloc( sizeof ** r );
+
+    if ( *r == NULL )
+        rc = RC( rcExe, rcNoTarg, rcLoading, rcMemory, rcExhausted );
+    return rc;
+}
+
+
+static int CC rgn_sort_by_start( const void *item, const void *n )
+{
+    region * v1 = ( region * )item;
+    region * v2 = ( region * )n;
+    if ( v1 -> start != v2 -> start )
+        return ( v1->start - v2->start );
+    return ( v1->end - v2->end );
+}
+
+
+static rc_t rgn_store_bio_or_adapter( Vector * stock, Vector * to,
+                                      const int32_t * block, int32_t sra_read_type )
+{
+    rc_t rc = 0;
+
+    if ( block[ pacbio_idx_start ] < block[ pacbio_idx_end ] )
+    {
+        region * a_region;
+        rc = rgn_get_or_make( stock, &a_region );
+        if ( rc == 0 )
+        {
+            a_region->spot_id = block[ pacbio_idx_spot_id ];
+            a_region->type    = sra_read_type;
+            a_region->start   = block[ pacbio_idx_start ];
+            a_region->end     = block[ pacbio_idx_end ];
+
+            /* see every region shorter as MIN_BIOLOGICAL_LEN 
+               as a technical (adapter) region */
+            if ( ( a_region->end - a_region->start ) <= MIN_BIOLOGICAL_LEN )
+                a_region->type = SRA_READ_TYPE_TECHNICAL;
+
+            a_region->filter  = SRA_READ_FILTER_PASS;
+            rc = VectorInsert ( to, a_region, NULL, rgn_sort_by_start );
+        }
+    }
+    return rc;
+}
+
+static rc_t rgn_store_block( Vector * stock, Vector * to, hq_region * hq,
+                             const int32_t * block, region_type_mapping *mapping,
+                             bool *have_high_quality )
+{
+    rc_t rc = 0;
+    int32_t type = block[ pacbio_idx_type ];
+
+    if ( mapping->rgn_type_hq >=0 && type == mapping->rgn_type_hq )
+    {
+        /* it is an error if we have more than one high-quality-region! */
+        assert ( ! * have_high_quality );
+
+        if ( * have_high_quality )
+        {
+            rc = RC ( rcExe, rcNoTarg, rcLoading, rcData, rcInconsistent );
+            LOGERR( klogErr, rc, "(* have_high_quality) in rgn_store_block()'" );
+            return rc;
+        }
+
+        hq->start = block[ pacbio_idx_start ];
+        hq->end   = block[ pacbio_idx_end ];
+        * have_high_quality = true;
+    }
+    else if ( mapping->rgn_type_ga >= 0 && type == mapping->rgn_type_ga )
+    {   /* so far do nothing with the "global accuracy" region */
+    }
+    else if ( mapping->rgn_type_adapter >= 0 && type == mapping->rgn_type_adapter )
+    {   /* it is an adapter */
+        rc = rgn_store_bio_or_adapter( stock, to, block, SRA_READ_TYPE_TECHNICAL );
+    }
+    else if ( mapping->rgn_type_insert >= 0 && type == mapping->rgn_type_insert )
+    {   /* it is an insert */
+        rc = rgn_store_bio_or_adapter( stock, to, block, SRA_READ_TYPE_BIOLOGICAL );
+    }
+    else
+    {   /* the type is unknown */
+        ( mapping->count_of_unknown_rgn_types )++;
+        /*
+        rc = RC ( rcExe, rcNoTarg, rcLoading, rcData, rcInconsistent );
+        LOGERR( klogErr, rc, "( region type is unknown ) in rgn_store_block()'" );
+        */
+    }
+    return rc;
+}
+
+
+/* inserts the generated region into the sort_Regions */
+static rc_t rgn_generate( Vector * stock, Vector * dst,
+                          const int32_t spot_id, const uint32_t start, const uint32_t len )
+{
+    region * a_region;
+    rc_t rc = rgn_get_or_make( stock, &a_region );
+    if ( rc == 0 )
+    {
+        a_region->spot_id = spot_id;
+        a_region->type    = SRA_READ_TYPE_TECHNICAL; /*means "i dont know"*/
+        a_region->start   = start;
+        a_region->end     = start + len;
+        a_region->filter  = SRA_READ_FILTER_CRITERIA;
+        rc = VectorInsert ( dst, a_region, NULL, rgn_sort_by_start );
+    }
+    return rc;
+}
+
+
+/* *************************************************************
+declares all regions inside and touching the HQ-Regions as
+    SRA_READ_FILTER_PASS outside becomes SRA_READ_FILTER_CRITERIA;
+************************************************************* */
+#if 0
+static rc_t rgn_apply_filter( Vector * stock, Vector * v, hq_region * hq,
+                              const int32_t spot_id, const uint32_t spot_len )
+{
+    rc_t rc = 0;
+
+    if ( hq->start == 0 && hq->end == 0 )
+    {
+        /* we have no HQ-Region, discard everything and create one
+           READ for the whole spot, that will be TECHNICAL... */
+        rgn_vector_move( v, stock );
+
+        if ( spot_len > 0 )
+            /* inserts the generated region into the sort_Regions */
+            rc = rgn_generate( stock, v, spot_id, 0, spot_len );
+    }
+    else
+    {
+        uint32_t i, count = VectorLength ( v );
+        for ( i = 0; i < count; ++ i )
+        {
+            region * a_region = VectorGet ( v, i );
+            if ( a_region != NULL )
+            {
+                bool set_invalid = ( ( a_region->end <= hq->start ) ||
+                                     ( a_region->start >= hq->end ) );
+                if ( set_invalid )
+                {
+                    /* the region is before the hq-region
+                       ---> set to SRA_READ_FILTER_CRITERIA */
+                    a_region->filter = SRA_READ_FILTER_CRITERIA;
+                    a_region->type = SRA_READ_TYPE_TECHNICAL;
+                }
+                else
+                {
+                    /* the region intersects with the hq-region 
+                       ---> set to SRA_READ_FILTER_PASS */
+                    a_region->filter = SRA_READ_FILTER_PASS;
+                }
+            }
+        }
+    }
+    return rc;
+}
+#endif
+
+static bool rgn_expand_last_rgn_by_1( Vector * v, int32_t *expands_a, int32_t *expands_i )
+{
+    region * a_region = VectorLast ( v );
+    bool res = ( a_region != NULL );
+    if ( res )
+    {
+        a_region->end += 1;
+        if ( a_region->type == SRA_READ_TYPE_TECHNICAL )
+            (*expands_a)++;
+        else
+            (*expands_i)++;
+    }
+    return res;
+}
+
+
+/* *************************************************************
+if gap is 1, expand previous region by 1 (correct off-by-1)
+fill in gaps > 1 ( regions are not consecutive )
+correct overlapping regions
+fill in a gap at the end, if the last region does not reach spotlen
+
+    INTPUT : rgn->read_Regions
+    OUTPUT : rgn->sort_Regions
+************************************************************* */
+static rc_t rgn_correct( Vector * stock, Vector * from, Vector * to,
+                         const uint32_t spot_id, const uint32_t spot_len,
+                         regions_stat * stats )
+{
+    rc_t rc;
+    int32_t start, expands_a = 0, expands_i = 0, inserts = 0;
+    uint32_t i, count = VectorLength ( from );
+
+    for ( rc = 0, start = 0, i = 0; i < count && rc == 0; ++ i )
+    {
+        region * a_region;
+
+        /* take the region out of rgn->read_Regions*/
+        rc = VectorRemove ( from, 0, (void**)&a_region );
+        if ( rc == 0 )
+        {
+            int32_t gap_len = ( a_region->start - start );
+
+            if ( gap_len == 1 )
+            {
+                /* the gap-length is one, try to expand the previous region */
+                if ( !rgn_expand_last_rgn_by_1( to, &expands_a, &expands_i ) )
+                {
+                    /* there is no previous region ! */
+                    rc = rgn_generate( stock, to, spot_id, start, gap_len );
+                }
+            }
+            else if ( gap_len > 1 )
+            {
+                /* generate a artificial gap in the middle or the start of the spot */
+                rc = rgn_generate( stock, to, spot_id, start, gap_len );
+                inserts++;
+            }
+            else if ( gap_len < 0 )
+            {
+                /* a negative gap would be an error in the sorting of the regions,
+                   or an overlapp of regions */
+                if ( ( a_region->start - gap_len )  > a_region->end )
+                {
+                    rc = RC ( rcExe, rcNoTarg, rcLoading, rcData, rcInconsistent );
+                    LOGERR( klogErr, rc, "((a_region->start-gap_len)>a_region->end) in rgn_correct()'" );
+                }
+                else /** move the start point ***/
+                {
+                    a_region->start -= gap_len;
+                    stats->overlapps++;
+                }
+            }
+            
+            if ( rc == 0 )
+            {
+                rc = VectorInsert ( to, a_region, NULL, rgn_sort_by_start );
+                if ( rc != 0 )
+                    LOGERR( klogErr, rc, "VectorInsert(rgn_sort_by_start) in rgn_correct()'" );
+                start = a_region->end;
+            }
+            else
+            {
+                rc_t rc1 = VectorInsert( stock, a_region, NULL, NULL );
+                if ( rc1 != 0 )
+                    LOGERR( klogErr, rc, "VectorInsert(NULL) in rgn_correct()'" );
+            }
+        }
+    }
+
+    if ( rc == 0 )
+    {
+        /* if the last region does not reach to the end of the spot */
+        if ( start < spot_len )
+        {
+            int32_t gap_len = ( spot_len - start );
+            if ( gap_len == 1 )
+            {
+                /* !!! this can also happen if spot_len == 1 !!! */
+                /* the gap-length is one, try to expand the previous region */
+                if ( ! rgn_expand_last_rgn_by_1( to, &expands_a, &expands_i ) )
+                {
+                    /* there is no previous region ! */
+                    rc = rgn_generate( stock, to, spot_id, start, gap_len );
+                    stats->end_gap++;
+                }
+            }
+            else if ( gap_len > 0 )
+            {
+                /* fill the gap to the end... */
+                rc = rgn_generate( stock, to, spot_id, start, gap_len );
+                stats->end_gap++;
+            }
+            else if ( gap_len < 0 )
+            {
+                /* a negative gap would be an error in the sorting of the regions,
+                   or an overlapp of regions */
+                rc = RC ( rcExe, rcNoTarg, rcLoading, rcData, rcInconsistent );
+                LOGERR( klogErr, rc, "(gap_len<0) in rgn_correct()'" );
+            }
+        }
+    }
+
+    /* do some statistics */
+    if ( ( expands_i + expands_a ) > 0 )
+    {
+        stats->expands_a += expands_a;
+        stats->expands_i += expands_i;
+        stats->expands_spots++;
+    }
+    if ( inserts > 0 )
+    {
+        stats->inserts += inserts;
+        stats->inserts_spots++;
+    }
+
+    return rc;
+}
+
+
+/* *************************************************************
+tries to merge overlapping adapter-regions...
+( uses rgn->read_Regions as scratch-pad )
+
+    INTPUT : rgn->sort_Regions
+    OUTPUT : rgn->sort_Regions
+************************************************************* */
+static rc_t rgn_merge_consecutive_regions( Vector * stock, Vector * from, Vector * to )
+{
+    rc_t rc = 0;
+    uint32_t i, count = VectorLength ( from );
+    region * a_region = NULL;
+    region * prev_region = NULL;
+
+    for ( i = 0; i < count && rc == 0; ++ i )
+    {
+        /* take the region out of rgn->sort_Regions*/
+        rc = VectorRemove ( from, 0, (void**)&a_region );
+        if ( rc == 0 )
+        {
+            bool copy = true;
+            if ( prev_region != NULL )
+            {
+                if ( ( a_region->start <= prev_region->end ) &&
+                     ( a_region->type == prev_region->type ) &&
+                     ( a_region->filter == prev_region->filter ) )
+                {
+                    prev_region->end = a_region->end;
+                    /* put the now unused region back into the stock */
+                    VectorAppend ( stock, NULL, a_region );
+                    /* and keep prev-region! */
+                    copy = false;
+                }
+            }
+            if ( copy )
+            {
+                prev_region = a_region;
+                rc = VectorInsert ( to, a_region, NULL, rgn_sort_by_start );
+            }
+        }
+    }
+    return rc;
+}
+
+/* *************************************************************
+tests that the spot-len is covered with regions that
+are not overlapping, have no gaps, start is ascending
+the regions to check are in rgn->sort_Regions
+************************************************************* */
+static rc_t rgn_check( const Vector * v, const uint32_t spot_len )
+{
+    rc_t rc = 0;
+    uint32_t i, count = VectorLength ( v );
+    region * a_region = NULL;
+    int32_t start = 0;
+
+    /* special case, if the spot is empty there are not regions */
+    if ( spot_len == 0 )
+    {
+        if ( count != 0 )
+        {
+            rc = RC ( rcExe, rcNoTarg, rcLoading, rcData, rcInconsistent );
+            LOGERR( klogErr, rc, "(spot_len == 0)&&(count!=0) in region-check()'" );
+        }
+        return rc;
+    }
+
+    /* check that we have at least one region in the spot */
+    if ( count < 1 )
+    {
+        rc = RC ( rcExe, rcNoTarg, rcLoading, rcData, rcInconsistent );
+        LOGERR( klogErr, rc, "(count<1) in region-check()'" );
+    }
+
+    for ( i = 0; i < count && rc == 0; ++ i )
+    {
+        a_region = VectorGet ( v, i );
+        if ( a_region == NULL )
+        {
+            rc = RC ( rcExe, rcNoTarg, rcLoading, rcData, rcInconsistent );
+            LOGERR( klogErr, rc, "(a_region==NULL) in region-check()'" );
+        }
+        else
+        {
+            /* check that the region has no gap and is not overlapping */
+            if ( a_region->start != start )
+            {
+                rc = RC ( rcExe, rcNoTarg, rcLoading, rcData, rcInconsistent );
+                PLOGERR( klogErr, ( klogErr, rc, "(a_region->start($(rstart))!=start($(start))) in region-check()'",
+                         "rstart=%u,start=%u", a_region->start, start ) );
+            }
+            else
+            {
+                /* check that the region is ascending */
+                if ( a_region->end < start )
+                {
+                    rc = RC ( rcExe, rcNoTarg, rcLoading, rcData, rcInconsistent );
+                    LOGERR( klogErr, rc, "(a_region->end<start) in region-check()'" );
+                }
+                start = a_region->end;
+            }
+        }
+    }
+
+    if ( rc == 0 )
+    {
+        /* check that the region is fully covered */
+        if ( a_region->end != spot_len )
+        {
+            rc = RC ( rcExe, rcNoTarg, rcLoading, rcData, rcInconsistent );
+            LOGERR( klogErr, rc, "(a_region->end!=spot_len) in region-check()'" );
+        }
+    }
+    return rc;
+}
+
+
+rc_t rgn_load( regions *rgn, const uint32_t spot_id, 
+               region_type_mapping *mapping, const uint32_t spot_len )
+{
+    rc_t rc;
+    uint64_t row_count = rgn->hdf5_regions.extents[ 0 ];
+
+    /* predefine that we have no HQ-regions read */
+    rgn->hq_rgn.start = 0;
+    rgn->hq_rgn.end = 0;
+
+    /* clear out the read and the sorted vector */
+    rc = rgn_vector_move( &rgn->read_Regions, &rgn->stock_Regions );
+    if ( rc == 0 )
+        rc = rgn_vector_move( &rgn->sort_Regions, &rgn->stock_Regions );
+
+    if ( rc == 0 )
+    {
+        if ( !( rgn->spot_id == 0 || rgn->spot_id == ( spot_id - 1 ) ) )
+            rc = RC( rcExe, rcNoTarg, rcLoading, rcParam, rcInvalid );
+    }
+
+    if ( rc == 0 )
+    {
+        int32_t * block;
+        bool have_high_quality = false;
+        do
+        {
+            int32_t idx = rgn->table_index[ rgn->offset ];
+            block = &( rgn->complete_table[ idx * RGN_COLUMN_COUNT ] );
+            if ( block[ pacbio_idx_spot_id ] == spot_id )
+            {
+                rc = rgn_store_block( &(rgn->stock_Regions), &(rgn->read_Regions),
+                                      &(rgn->hq_rgn), block,
+                                      mapping, & have_high_quality );
+                if ( rc == 0 )
+                    rgn->offset++;
+            }
+
+        } while( rc == 0 && 
+                 block[ pacbio_idx_spot_id ] == spot_id &&
+                 rgn->offset < row_count );
+        rgn->spot_id  = spot_id;
+        rgn->spot_len = spot_len;
+    }
+
+    if ( rc == 0 )
+    {
+#if 0  /**** does not seem to match PacBio ***/
+        /* changes READ_FILTER and READ_TYPE if a region is completely
+           outside of the hq-region... ( if we have one ) 
+           if there is none the whole spot becomes one CRITERIA/TECHNICAL-read */
+        rc = rgn_apply_filter( &(rgn->stock_Regions), &(rgn->read_Regions),
+                               &(rgn->hq_rgn), rgn->spot_id, rgn->spot_len );
+#endif
+
+
+        /* INPUT : rgn->read_Regions / OUTPUT : rgn->sort_Regions */
+        /* fills gaps, corrects off-by-1-errors and overlapping regions */
+        if ( rc == 0 )
+            rc = rgn_correct( &(rgn->stock_Regions), 
+                              &(rgn->read_Regions), &(rgn->sort_Regions), 
+                              rgn->spot_id, rgn->spot_len, &(rgn->stat) );
+
+        /* INPUT : rgn->sort_Regions / OUTPUT : rgn->read_Regions */
+        /* merges consecutive regions if READ_TYPE/READ_FILTER are the same */
+        if ( rc == 0 )
+            rc = rgn_merge_consecutive_regions( &(rgn->stock_Regions),
+                                                &(rgn->sort_Regions),
+                                                &(rgn->read_Regions) );
+
+        /* INPUT : rgn->read_Regions */
+        /* checks that the whole spot is covered, no overlapps/gaps occur,
+           regions have to be sorted in ascending order */
+
+        if ( rc == 0 )
+            rc = rgn_check( &(rgn->read_Regions), rgn->spot_len );
+
+    }
+    return rc;
+}
+
+
+static rc_t rgn_resize_data_32( regions *rgn )
+{
+    rc_t rc = 0;
+    size_t needed_len;
+
+    needed_len = ( sizeof( *rgn->data_32 ) * VectorLength( &rgn->read_Regions ) );
+    if ( rgn->data_32 == NULL )
+    {
+        rgn->data_32 = malloc( needed_len );
+    }
+    else if ( rgn->data_32_len < VectorLength( &rgn->read_Regions ) )
+    {
+        rgn->data_32 = realloc ( rgn->data_32, needed_len );
+    }
+    if ( rgn->data_32 == NULL )
+        rc = RC( rcExe, rcNoTarg, rcLoading, rcMemory, rcExhausted );
+    else
+        rgn->data_32_len = VectorLength( &rgn->read_Regions );
+    return rc;
+}
+
+
+void rgn_set_filter_value_for_all( regions *rgn, const uint32_t filter_value )
+{
+    uint32_t i, n = VectorLength( &rgn->read_Regions );
+    for ( i = 0; i < n; ++i )
+    {
+        region * a_region = VectorGet ( &rgn->read_Regions, i );
+        if ( a_region != NULL )
+            a_region->filter = filter_value;
+    }
+}
+
+
+static rc_t rgn_resize_data_8( regions *rgn )
+{
+    rc_t rc = 0;
+    size_t needed_len;
+
+    needed_len = ( sizeof( *rgn->data_8 ) * VectorLength( &rgn->read_Regions ) );
+    needed_len = (needed_len + 3 ) & ~3; /** to make valgrind happy ***/
+    if ( rgn->data_8 == NULL )
+    {
+        rgn->data_8 = malloc( needed_len );
+    }
+    else if ( rgn->data_8_len < VectorLength( &rgn->read_Regions ) )
+    {
+        rgn->data_8 = realloc ( rgn->data_8, needed_len );
+    }
+    if ( rgn->data_8 == NULL )
+        rc = RC( rcExe, rcNoTarg, rcLoading, rcMemory, rcExhausted );
+    else
+        rgn->data_8_len = VectorLength( &rgn->read_Regions );
+    return rc;
+}
+
+
+rc_t rgn_start_data( regions *rgn, uint32_t *count )
+{
+    rc_t rc = rgn_resize_data_32( rgn );
+    if ( rc == 0 )
+    {
+        uint32_t i;
+        uint32_t *ptr = rgn->data_32;
+        *count = VectorLength( &rgn->read_Regions );
+        for ( i = 0; i < (*count); ++i )
+        {
+            region * a_region = VectorGet ( &rgn->read_Regions, i );
+            if ( a_region != NULL )
+                ptr[ i ] = a_region->start;
+        }
+    }
+    return rc;
+}
+
+
+rc_t rgn_len_data( regions *rgn, uint32_t *count )
+{
+    rc_t rc = rgn_resize_data_32( rgn );
+    if ( rc == 0 )
+    {
+        uint32_t i;
+        uint32_t *ptr = rgn->data_32;
+        *count = VectorLength( &rgn->read_Regions );
+        for ( i = 0; i < (*count); ++i )
+        {
+            region * a_region = VectorGet ( &rgn->read_Regions, i );
+            if ( a_region != NULL )
+                ptr[ i ] = ( a_region->end - a_region->start );
+        }
+    }
+    return rc;
+}
+
+
+rc_t rgn_type_data( regions *rgn, uint32_t *count )
+{
+    rc_t rc = rgn_resize_data_8( rgn );
+    if ( rc == 0 )
+    {
+        uint32_t i;
+        uint8_t *ptr = rgn->data_8;
+
+        *count = VectorLength( &rgn->read_Regions );
+        for ( i = 0; i < (*count); ++i )
+        {
+            region * a_region = VectorGet ( &rgn->read_Regions, i );
+            if ( a_region != NULL )
+                ptr[ i ] = a_region->type;
+        }
+    }
+    return rc;
+}
+
+
+rc_t rgn_filter_data( regions *rgn, uint32_t *count )
+{
+    rc_t rc = rgn_resize_data_8( rgn );
+    if ( rc == 0 )
+    {
+        uint32_t i;
+        uint8_t *ptr = rgn->data_8;
+
+        *count = VectorLength( &rgn->read_Regions );
+        for ( i = 0; i < (*count); ++i )
+        {
+            region * a_region = VectorGet ( &rgn->read_Regions, i );
+            if ( a_region != NULL )
+                ptr[ i ] = a_region->filter;
+        }
+    }
+    return rc;
+}
+
+
+rc_t rgn_label_start_data( regions *rgn, uint32_t *count )
+{
+    rc_t rc = rgn_resize_data_32( rgn );
+    if ( rc == 0 )
+    {
+        uint32_t i;
+        uint32_t *ptr = rgn->data_32;
+        uint32_t value;
+
+        *count = VectorLength( &rgn->read_Regions );
+        for ( i = 0; i < (*count); ++i )
+        {
+            region * a_region = VectorGet ( &rgn->read_Regions, i );
+            value = label_lowquality_start; /* default value */
+            if ( a_region != NULL )
+                switch( a_region->type )
+                {
+                case SRA_READ_TYPE_BIOLOGICAL : 
+                    value = label_insert_start;
+                    break;
+                case SRA_READ_TYPE_TECHNICAL  :
+                    value = label_adapter_start;
+/*
+                    if ( a_region->filter == SRA_READ_FILTER_PASS )
+                        value = label_adapter_start;
+                    else
+                        value = label_lowquality_start;
+*/
+                    break;
+                }
+            ptr[ i ] = value;
+        }
+    }
+    return rc;
+}
+
+
+rc_t rgn_label_len_data( regions *rgn, uint32_t *count )
+{
+    rc_t rc = rgn_resize_data_32( rgn );
+    if ( rc == 0 )
+    {
+        uint32_t i;
+        uint32_t *ptr = rgn->data_32;
+        uint32_t value;
+
+        *count = VectorLength( &rgn->read_Regions );
+        for ( i = 0; i < (*count); ++i )
+        {
+            region * a_region = VectorGet ( &rgn->read_Regions, i );
+            value = label_lowquality_len; /* default value */
+            if ( a_region != NULL )
+                switch ( a_region->type )
+                {
+                case SRA_READ_TYPE_BIOLOGICAL : 
+                    value = label_insert_len;
+                    break;
+                case SRA_READ_TYPE_TECHNICAL  : 
+                    value = label_adapter_len;
+/*
+                    if ( a_region->filter == SRA_READ_FILTER_PASS )
+                        value = label_adapter_len;
+                    else
+                        value = label_lowquality_len;
+*/
+                    break;
+                }
+            ptr[ i ] = value;
+        }
+    }
+    return rc;
+}
+
+
+static const char rgn_string_adapter[] = "Adapter";
+static const char rgn_string_insert[] = "Insert";
+static const char rgn_string_hq[] = "HQRegion";
+static const char rgn_string_ga[] = "GlobalAccuracy";
+
+
+static int rgn_str_cmp( const char *a, const char *b )
+{
+    size_t asize = string_size ( a );
+    size_t bsize = string_size ( b );
+    return strcase_cmp ( a, asize, b, bsize, ( asize > bsize ) ? asize : bsize );
+}
+
+
+static rc_t rgn_set_type_code( int32_t *dst, const uint32_t type_idx )
+{
+    if ( *dst == -1 )
+    {
+        *dst = type_idx;
+        return 0;
+    }
+    else
+        return RC( rcExe, rcNoTarg, rcLoading, rcName, rcDuplicate );
+}
+
+
+static rc_t rgn_type_string( const char *type_string, uint32_t type_idx, 
+                             region_type_mapping *mapping )
+{
+    if ( rgn_str_cmp( type_string, rgn_string_adapter ) == 0 )
+        return rgn_set_type_code( &(mapping->rgn_type_adapter), type_idx );
+
+    if ( rgn_str_cmp( type_string, rgn_string_insert ) == 0 )
+        return rgn_set_type_code( &(mapping->rgn_type_insert), type_idx );
+
+    if ( rgn_str_cmp( type_string, rgn_string_hq ) == 0 )
+        return rgn_set_type_code( &(mapping->rgn_type_hq), type_idx );
+
+    if ( rgn_str_cmp( type_string, rgn_string_ga ) == 0 )
+        return rgn_set_type_code( &(mapping->rgn_type_ga), type_idx );
+
+    return RC( rcExe, rcNoTarg, rcLoading, rcName, rcUnknown );
+}
+
+
+/* read the mapping out of the region-types out of a string... */
+rc_t rgn_extract_type_mappings( const KNamelist *rgn_names,
+                                region_type_mapping *mapping, bool check_completenes )
+{
+    rc_t rc = 0;
+    uint32_t count, idx;
+
+    mapping->rgn_type_adapter = -1;
+    mapping->rgn_type_insert  = -1;
+    mapping->rgn_type_hq      = -1;
+    mapping->rgn_type_ga      = -1;
+
+    rc = KNamelistCount ( rgn_names, &count );
+    for ( idx = 0; idx < count && rc == 0; ++idx )
+    {
+        const char *name;
+        rc = KNamelistGet ( rgn_names, idx, &name );
+        if ( rc == 0 )
+            rgn_type_string( name, idx, mapping );
+    }
+
+    if ( rc == 0 && check_completenes )
+    {
+        if ( mapping->rgn_type_adapter == -1 ||
+             mapping->rgn_type_insert == -1 ||
+             mapping->rgn_type_hq == -1 )
+            rc = RC( rcExe, rcNoTarg, rcLoading, rcName, rcIncomplete );
+    }
+
+    mapping->count_of_unknown_rgn_types = 0;
+    return rc;
+}
+
+
+
+rc_t rgn_show_type_mappings( region_type_mapping *mapping )
+{
+    rc_t rc;
+    if ( mapping == NULL )
+        rc = RC( rcExe, rcNoTarg, rcLoading, rcParam, rcInvalid );
+    else
+        rc = KOutMsg( "rgn-type-mapping->adapter   = %i\n", mapping->rgn_type_adapter );
+    if ( rc == 0 )
+        rc = KOutMsg( "rgn-type-mapping->insert    = %i\n", mapping->rgn_type_insert );
+    if ( rc == 0 )
+        rc = KOutMsg( "rgn-type-mapping->high_qual = %i\n", mapping->rgn_type_hq );
+    if ( rc == 0 )
+        rc = KOutMsg( "rgn-type-mapping->globe_acc = %i\n", mapping->rgn_type_ga );
+    return rc;
+}
+
diff --git a/tools/pacbio-load/pl-regions.h b/tools/pacbio-load/pl-regions.h
new file mode 100644
index 0000000..464ac5e
--- /dev/null
+++ b/tools/pacbio-load/pl-regions.h
@@ -0,0 +1,140 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+#ifndef _h_pl_regions_
+#define _h_pl_regions_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "pl-tools.h"
+#include <klib/vector.h>
+#include <klib/sort.h>
+#include <klib/rc.h>
+#include <insdc/sra.h>
+
+
+#define RGN_COLUMN_COUNT 5
+#define MIN_BIOLOGICAL_LEN 10
+
+typedef struct region_type_mapping
+{
+    int32_t rgn_type_adapter;   /* technical */
+    int32_t rgn_type_insert;    /* biological */
+    int32_t rgn_type_hq;        /* HighQualityRegion */
+    int32_t rgn_type_ga;        /* GlobalAccuracy ??? */
+
+    uint64_t count_of_unknown_rgn_types;
+} region_type_mapping;
+
+
+typedef struct region
+{
+    int32_t spot_id;
+    int32_t type;
+    int32_t start;
+    int32_t end;
+    int32_t filter;
+} region;
+
+
+typedef struct regions_stat
+{
+    uint32_t inserts;
+    uint32_t inserts_spots;
+    uint32_t expands_a;
+    uint32_t expands_i;
+    uint32_t expands_spots;
+    uint32_t end_gap;
+    uint32_t overlapps;
+    uint32_t removed;
+} regions_stat;
+
+
+typedef struct hq_region
+{
+    uint32_t start;
+    uint32_t end;
+} hq_region;
+
+
+typedef struct regions
+{
+    af_data hdf5_regions;
+    Vector read_Regions;
+    Vector sort_Regions;
+    Vector stock_Regions;
+    hq_region hq_rgn;
+    uint64_t offset;
+    uint32_t spot_id;
+    uint32_t spot_len;
+    uint32_t * data_32;
+    uint8_t * data_8;
+    size_t data_32_len;
+    size_t data_8_len;
+
+    regions_stat stat;
+
+    int32_t * complete_table;
+    int32_t * table_index;
+} regions;
+
+
+void rgn_init( regions *rgn );
+void rgn_free( regions *rgn );
+
+static const char def_label[] = "AdapterInsertLowQuality";
+static const size_t def_label_len = 23;
+
+static const uint32_t label_adapter_start    = 0;
+static const uint32_t label_adapter_len      = 7;
+static const uint32_t label_insert_start     = 7;
+static const uint32_t label_insert_len       = 6;
+static const uint32_t label_lowquality_start = 13;
+static const uint32_t label_lowquality_len   = 10;
+
+rc_t rgn_open( const KDirectory *hdf5_dir, regions *rgn );
+
+rc_t rgn_load( regions *rgn, const uint32_t spot_id, 
+               region_type_mapping *mapping, const uint32_t spot_len );
+
+void rgn_set_filter_value_for_all( regions *rgn, const uint32_t filter_value );
+
+rc_t rgn_start_data( regions *rgn, uint32_t *count );
+rc_t rgn_len_data( regions *rgn, uint32_t *count );
+rc_t rgn_type_data( regions *rgn, uint32_t *count );
+rc_t rgn_filter_data( regions *rgn, uint32_t *count );
+rc_t rgn_label_start_data( regions *rgn, uint32_t *count );
+rc_t rgn_label_len_data( regions *rgn, uint32_t *count );
+
+rc_t rgn_extract_type_mappings( const KNamelist *rgn_names, region_type_mapping *mapping, bool check_completenes );
+rc_t rgn_show_type_mappings( region_type_mapping *mapping );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/pacbio-load/pl-sequence.c b/tools/pacbio-load/pl-sequence.c
new file mode 100644
index 0000000..050bc17
--- /dev/null
+++ b/tools/pacbio-load/pl-sequence.c
@@ -0,0 +1,928 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "pl-sequence.h"
+#include "pl-regions.h"
+#include <kfs/kfs-priv.h>       /* access to getmeta of KArrayfile*/
+#include <sra/pacbio.h>
+#include <sysalloc.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+
+const char * seq_tab_names[] = 
+{ 
+    /* base-space */
+    "READ",
+    "QUALITY",
+    "NREADS",
+    "(INSDC:SRA:platform_id)PLATFORM",
+    "LABEL",
+    "LABEL_START",
+    "LABEL_LEN",
+    "READ_TYPE",
+    "READ_START",
+    "READ_LEN",
+    "CLIP_QUALITY_LEFT",
+    "CLIP_QUALITY_RIGHT",
+    "READ_FILTER",
+
+    /* pulse-space */
+    "PRE_BASE_FRAMES",
+    "WIDTH_IN_FRAMES",
+    "(U16)PULSE_INDEX",
+    "PULSE_INDEX",
+    "HOLE_NUMBER",
+    "HOLE_STATUS",
+    "HOLE_XY",
+    "INSERTION_QV",
+    "DELETION_QV",
+    "DELETION_TAG",
+    "SUBSTITUTION_QV",
+    "SUBSTITUTION_TAG"
+};
+
+
+static void init_BaseCalls( BaseCalls *tab )
+{
+    init_BaseCalls_cmn( &tab->cmn );
+    rgn_init( &tab->rgn );
+    init_array_file( &tab->PreBaseFrames );
+    init_array_file( &tab->PulseIndex );
+    init_array_file( &tab->WidthInFrames );
+}
+
+
+static void close_BaseCalls( BaseCalls *tab )
+{
+    close_BaseCalls_cmn( &tab->cmn );
+    rgn_free( &tab->rgn );
+    free_array_file( &tab->PreBaseFrames );
+    free_array_file( &tab->PulseIndex );
+    free_array_file( &tab->WidthInFrames );
+}
+
+
+static rc_t open_BaseCalls( const KDirectory *hdf5_dir, BaseCalls *tab,
+                            const char * path, bool cache_content, bool * rgn_present )
+{
+    rc_t rc;
+
+    init_BaseCalls( tab );
+    rc = open_BaseCalls_cmn( hdf5_dir, &tab->cmn, false, path, cache_content, false );
+    if ( rc == 0 )
+    {
+        rc_t rc1 = rgn_open( hdf5_dir, &tab->rgn );
+        if ( rgn_present != NULL )
+            *rgn_present = ( rc1 == 0 );
+
+        open_element( hdf5_dir, &tab->PreBaseFrames, path, "PreBaseFrames", 
+                               PRE_BASE_FRAMES_BITSIZE, PRE_BASE_FRAMES_COLS,
+                               true, cache_content, true );
+
+        if ( rc == 0 )
+        {
+            rc = open_element( hdf5_dir, &tab->PulseIndex, path, "PulseIndex", 
+                               PULSE_INDEX_BITSIZE_16, PULSE_INDEX_COLS,
+                               false, cache_content, false );
+            /* try again if it is not 16 bit! */
+            if ( rc != 0 )
+                rc = open_element( hdf5_dir, &tab->PulseIndex, path, "PulseIndex", 
+                                   PULSE_INDEX_BITSIZE_32, PULSE_INDEX_COLS,
+                                   true, cache_content, false );
+        }
+
+        open_element( hdf5_dir, &tab->WidthInFrames, path, "WidthInFrames",
+                               WIDTH_IN_FRAMES_BITSIZE, WIDTH_IN_FRAMES_COLS,
+                               true, cache_content, true );
+
+        if ( rc != 0 )
+            close_BaseCalls( tab ); /* releases only initialized elements */
+    }
+    return rc;
+}
+
+
+static bool check_BaseCall_totalcount( BaseCalls *tab, const uint64_t expected )
+{
+    bool res = true;
+
+    if ( tab->PreBaseFrames.rc == 0 )
+        res = check_table_count( &tab->PreBaseFrames, "PreBaseFrames", expected );
+
+    if ( res && tab->PulseIndex.rc == 0 )
+        res = check_table_count( &tab->PulseIndex, "PulseIndex", expected );
+
+    if ( res && tab->WidthInFrames.rc == 0 )
+        res = check_table_count( &tab->WidthInFrames, "WidthInFrames", expected );
+
+    if ( res && tab->cmn.Basecall.rc == 0 )
+        res = check_table_count( &tab->cmn.Basecall, "Basecall", expected );
+
+    if ( res && tab->cmn.DeletionQV.rc == 0 )
+        res = check_table_count( &tab->cmn.DeletionQV, "DeletionQV", expected );
+
+    if ( res && tab->cmn.DeletionTag.rc == 0 )
+        res = check_table_count( &tab->cmn.DeletionTag, "DeletionTag", expected );
+
+    if ( res && tab->cmn.InsertionQV.rc == 0 )
+        res = check_table_count( &tab->cmn.InsertionQV, "InsertionQV", expected );
+
+    if ( res && tab->cmn.QualityValue.rc == 0 )
+        res = check_table_count( &tab->cmn.QualityValue, "QualityValue", expected );
+
+    if ( res && tab->cmn.SubstitutionQV.rc == 0 )
+        res = check_table_count( &tab->cmn.SubstitutionQV, "SubstitutionQV", expected );
+
+    if ( res && tab->cmn.SubstitutionTag.rc == 0 )
+        res = check_table_count( &tab->cmn.SubstitutionTag, "SubstitutionTag", expected );
+    return res;
+}
+
+
+static rc_t seq_load_zero_bases( VCursor *cursor, BaseCalls *tab,
+                                 const uint32_t *col_idx )
+{
+    uint32_t dummy_src;
+    rc_t rc = vdb_write_value( cursor, col_idx[ seq_tab_READ ],
+                               &dummy_src, BASECALL_BITSIZE, 0, "seq.Basecall" );
+    if ( rc == 0 )
+        rc = vdb_write_value( cursor, col_idx[ seq_tab_QUALITY ],
+                              &dummy_src, QUALITY_VALUE_BITSIZE, 0, "seq.QualityValue" );
+
+    if ( rc == 0 )
+        rc = vdb_write_value( cursor, col_idx[ seq_tab_INSERTION_QV ],
+                              &dummy_src, INSERTION_QV_BITSIZE, 0, "seq.InsertionQV" );
+
+    if ( rc == 0 )
+        rc = vdb_write_value( cursor, col_idx[ seq_tab_DELETION_QV ],
+                              &dummy_src, DELETION_QV_BITSIZE, 0, "seq.DeletionQV" );
+
+    if ( rc == 0 )
+        rc = vdb_write_value( cursor, col_idx[ seq_tab_DELETION_TAG ],
+                              &dummy_src, DELETION_TAG_BITSIZE, 0, "seq.DeletionTag" );
+
+    if ( rc == 0 )
+        rc = vdb_write_value( cursor, col_idx[ seq_tab_SUBSTITUTION_QV ],
+                              &dummy_src, SUBSTITUTION_QV_BITZISE, 0, "seq.SubstitutionQV" );
+
+    if ( rc == 0 )
+        rc = vdb_write_value( cursor, col_idx[ seq_tab_SUBSTITUTION_TAG ],
+                              &dummy_src, SUBSTITUTION_TAG_BITSIZE, 0, "seq.SubstitutionTag" );
+
+    if ( rc == 0 )
+        rc = vdb_write_value( cursor, col_idx[ seq_tab_PRE_BASE_FRAMES ],
+                              &dummy_src, PRE_BASE_FRAMES_BITSIZE, 0, "seq.PreBaseFrames" );
+
+    if ( rc == 0 )
+        rc = vdb_write_value( cursor, col_idx[ seq_tab_WIDTH_IN_FRAMES ],
+                              &dummy_src, WIDTH_IN_FRAMES_BITSIZE, 0, "seq.WidthInFrames" );
+
+    if ( rc == 0 )
+    {
+        if ( tab->PulseIndex.element_bits == PULSE_INDEX_BITSIZE_16 )
+            rc = vdb_write_value( cursor, col_idx[ seq_tab_PULSE_INDEX_16 ],
+                                  &dummy_src, PULSE_INDEX_BITSIZE_16, 0, "seq.PulseIndex16" );
+        else
+            rc = vdb_write_value( cursor, col_idx[ seq_tab_PULSE_INDEX_32 ],
+                                  &dummy_src, PULSE_INDEX_BITSIZE_32, 0, "seq.PulseIndex32" );
+    }
+    return rc;
+}
+
+
+static rc_t seq_load_spot_bases( VCursor *cursor, BaseCalls *tab,
+                                 const uint32_t *col_idx, zmw_row * spot )
+{
+    rc_t rc = 0;
+    size_t n_bytes = spot->NumEvent * 4;
+
+    /* we make a buffer to store NumEvent 32-bit-values
+      (that is so far the biggest value we have to read per DNA-BASE) */
+    char * buffer = malloc( n_bytes );
+    if ( buffer == NULL )
+    {
+        rc = RC( rcExe, rcNoTarg, rcAllocating, rcMemory, rcExhausted );
+        PLOGERR( klogErr, ( klogErr, rc, "cannot allocate $(nbytes) bytes to read seq-data",
+                            "nbytes=%u", n_bytes ) );
+    }
+
+    if ( rc == 0 )
+        rc = transfer_bits( cursor, col_idx[ seq_tab_READ ],
+            &tab->cmn.Basecall, buffer, spot->offset, spot->NumEvent,
+            BASECALL_BITSIZE, "seq.Basecall" );
+
+    if ( rc == 0 )
+        rc = transfer_bits( cursor, col_idx[ seq_tab_QUALITY ],
+            &tab->cmn.QualityValue, buffer, spot->offset, spot->NumEvent,
+            QUALITY_VALUE_BITSIZE, "seq.QualityValue" );
+
+    /* this is all optional! ( but we are writing zero's into it if we have no source ... )---> */
+    if ( rc == 0 )
+    {
+        if ( tab->cmn.InsertionQV.rc == 0 )
+            rc = transfer_bits( cursor, col_idx[ seq_tab_INSERTION_QV ],
+                &tab->cmn.InsertionQV, buffer, spot->offset, spot->NumEvent,
+                INSERTION_QV_BITSIZE, "seq.InsertionQV" );
+        else
+            rc = vdb_write_value( cursor, col_idx[ seq_tab_INSERTION_QV ],
+                buffer, INSERTION_QV_BITSIZE, 0, "seq.InsertionQV" );
+    }
+
+    if ( rc == 0 )
+    {
+        if ( tab->cmn.DeletionQV.rc == 0 )
+            rc = transfer_bits( cursor, col_idx[ seq_tab_DELETION_QV ],
+                &tab->cmn.DeletionQV, buffer, spot->offset, spot->NumEvent,
+                DELETION_QV_BITSIZE, "seq.DeletionQV" );
+        else
+            rc = vdb_write_value( cursor, col_idx[ seq_tab_DELETION_QV ],
+                buffer, DELETION_QV_BITSIZE, 0, "seq.DeletionQV" );
+    }
+
+    if ( rc == 0 )
+    {
+        if ( tab->cmn.DeletionTag.rc == 0 )
+            rc = transfer_bits( cursor, col_idx[ seq_tab_DELETION_TAG ],
+                &tab->cmn.DeletionTag, buffer, spot->offset, spot->NumEvent,
+                DELETION_TAG_BITSIZE, "seq.DeletionTag" );
+        else
+            rc = vdb_write_value( cursor, col_idx[ seq_tab_DELETION_TAG ],
+                buffer, DELETION_TAG_BITSIZE, 0, "seq.DeletionTag" );
+    }
+
+    if ( rc == 0 )
+    {
+        if ( tab->cmn.SubstitutionQV.rc == 0 )
+            rc = transfer_bits( cursor, col_idx[ seq_tab_SUBSTITUTION_QV ],
+                &tab->cmn.SubstitutionQV, buffer, spot->offset, spot->NumEvent,
+                SUBSTITUTION_QV_BITZISE, "seq.SubstitutionQV" );
+        else
+            rc = vdb_write_value( cursor, col_idx[ seq_tab_SUBSTITUTION_QV ],
+                buffer, SUBSTITUTION_QV_BITZISE, 0, "seq.SubstitutionQV" );
+    }
+
+    if ( rc == 0 )
+    {
+        if ( tab->cmn.SubstitutionTag.rc == 0 )
+            rc = transfer_bits( cursor, col_idx[ seq_tab_SUBSTITUTION_TAG ],
+                &tab->cmn.SubstitutionTag, buffer, spot->offset, spot->NumEvent,
+                SUBSTITUTION_TAG_BITSIZE, "seq.SubstitutionTag" );
+        else
+            rc = vdb_write_value( cursor, col_idx[ seq_tab_SUBSTITUTION_TAG ],
+                buffer, SUBSTITUTION_TAG_BITSIZE, 0, "seq.SubstitutionTag" );
+    }
+
+    if ( rc == 0 )
+    {
+        if ( tab->PreBaseFrames.rc == 0 )
+            rc = transfer_bits( cursor, col_idx[ seq_tab_PRE_BASE_FRAMES ],
+                &tab->PreBaseFrames, buffer, spot->offset, spot->NumEvent,
+                PRE_BASE_FRAMES_BITSIZE, "seq.PreBaseFrames" );
+        else
+            rc = vdb_write_value( cursor, col_idx[ seq_tab_PRE_BASE_FRAMES ],
+                buffer, PRE_BASE_FRAMES_BITSIZE, 0, "seq.PreBaseFrames" );
+    }
+
+    if ( rc == 0 )
+    {
+        if ( tab->WidthInFrames.rc == 0 )
+            rc = transfer_bits( cursor, col_idx[ seq_tab_WIDTH_IN_FRAMES ],
+                &tab->WidthInFrames, buffer, spot->offset, spot->NumEvent,
+                WIDTH_IN_FRAMES_BITSIZE, "seq.WidthInFrames" );
+        else
+            rc = vdb_write_value( cursor, col_idx[ seq_tab_WIDTH_IN_FRAMES ],
+                buffer, WIDTH_IN_FRAMES_BITSIZE, 0, "seq.WidthInFrames" );
+    }
+    /* <--- this is all optional! */
+
+
+    if ( rc == 0 )
+    {
+        if ( tab->PulseIndex.element_bits == PULSE_INDEX_BITSIZE_16 )
+            rc = transfer_bits( cursor, col_idx[ seq_tab_PULSE_INDEX_16 ],
+                &tab->PulseIndex, buffer, spot->offset, spot->NumEvent,
+                PULSE_INDEX_BITSIZE_16, "seq.PulsIndex16" );
+        else
+            rc = transfer_bits( cursor, col_idx[ seq_tab_PULSE_INDEX_32 ],
+                &tab->PulseIndex, buffer, spot->offset, spot->NumEvent,
+                PULSE_INDEX_BITSIZE_32, "seq.PulsIndex32" );
+    }
+
+    if ( buffer != NULL )
+        free( buffer );
+    return rc;
+}
+
+
+static rc_t seq_load_read_desc( VCursor *cursor, const uint32_t *col_idx,
+                                region_type_mapping *mapping,
+                                zmw_row * spot, BaseCalls *tab )
+{
+    uint32_t n;
+    /* take the spot-descriptors out of the region-table
+       and write them... */
+
+    rc_t rc = rgn_load( &tab->rgn, spot->spot_nr, mapping, spot->NumEvent );
+    if ( rc != 0 )
+        PLOGERR( klogErr, ( klogErr, rc, "rgn_load( spot #$(spotnr) ) failed",
+                            "spotnr=%u", spot->spot_nr ) );
+
+    if ( rc == 0 )
+    {
+        uint32_t filter_value = SRA_READ_FILTER_PASS;
+        if ( spot->HoleStatus != SRA_PACBIO_HOLE_SEQUENCING )
+        {
+            filter_value = SRA_READ_FILTER_CRITERIA;
+        }
+        rgn_set_filter_value_for_all( &tab->rgn, filter_value );
+    }
+
+    if ( rc == 0 )
+    {
+        /* write the READ_START - vector */
+        rc = rgn_start_data( &tab->rgn, &n );
+
+/*
+        if ( n > 255 )
+            OUTMSG(( "spot #%lu has %u READS\n", spot->spot_nr, n ));
+*/
+
+        if ( rc != 0 )
+            PLOGERR( klogErr, ( klogErr, rc, "rgn_start_data( $(spotnr) ) failed",
+                                "spotnr=%u", spot->spot_nr ) );
+        else
+            rc = vdb_write_value( cursor, col_idx[ seq_tab_READ_START ],
+                                  tab->rgn.data_32, 32, n, "seq.READ_START" );
+    }
+
+    /* write the READ_LEN - vector */
+    if ( rc == 0 )
+    {
+        rc = rgn_len_data( &tab->rgn, &n );
+        if ( rc != 0 )
+            PLOGERR( klogErr, ( klogErr, rc, "rgn_len_data( $(spotnr) ) failed",
+                                "spotnr=%u", spot->spot_nr ) );
+        else
+            rc = vdb_write_value( cursor, col_idx[ seq_tab_READ_LEN ],
+                                  tab->rgn.data_32, 32, n, "seq.READ_LEN" );
+    }
+
+    /* write the READ_TYPE - vector */
+    if ( rc == 0 )
+    {
+        rc = rgn_type_data( &tab->rgn, &n );
+        if ( rc != 0 )
+            PLOGERR( klogErr, ( klogErr, rc, "rgn_type_data( $(spotnr) ) failed",
+                                "spotnr=%u", spot->spot_nr ) );
+        else
+            rc = vdb_write_value( cursor, col_idx[ seq_tab_READ_TYPE ],
+                                  tab->rgn.data_8, 8, n, "seq.READ_TYPE" );
+
+    }
+
+    /* write the READ_FILTER - vector */
+    if ( rc == 0 )
+    {
+        rc = rgn_filter_data( &tab->rgn, &n );
+        if ( rc != 0 )
+            PLOGERR( klogErr, ( klogErr, rc, "rgn_filter_data( $(spotnr) ) failed",
+                                "spotnr=%u", spot->spot_nr ) );
+        else
+            rc = vdb_write_value( cursor, col_idx[ seq_tab_READ_FILTER ],
+                                  tab->rgn.data_8, 8, n, "seq.READ_FILTER" );
+    }
+
+
+    /* write the LABEL ( a constant string defined in pl-regions.h" ) */
+    if ( rc == 0 )
+    {
+        rc = vdb_write_value( cursor, col_idx[ seq_tab_LABEL ],
+                              (void*)def_label, 8, def_label_len, "seq.LABEL" );
+    }
+
+    /* write the LABEL_START ( index into LABEL for every read ) */
+    if ( rc == 0 )
+    {
+        rc = rgn_label_start_data( &tab->rgn, &n );
+        if ( rc != 0 )
+            PLOGERR( klogErr, ( klogErr, rc, "rgn_label_start_data( $(spotnr) ) failed",
+                                "spotnr=%u", spot->spot_nr ) );
+        else
+            rc = vdb_write_value( cursor, col_idx[ seq_tab_LABEL_START ],
+                                  tab->rgn.data_32, 32, n, "seq.LABEL_START" );
+    }
+
+    /* write the LABEL_LEN ( index into LABEL for every read ) */
+    if ( rc == 0 )
+    {
+        rc = rgn_label_len_data( &tab->rgn, &n );
+        if ( rc != 0 )
+            PLOGERR( klogErr, ( klogErr, rc, "rgn_label_len_data( $(spotnr) ) failed",
+                                "spotnr=%u", spot->spot_nr ) );
+        else
+            rc = vdb_write_value( cursor, col_idx[ seq_tab_LABEL_LEN ],
+                                  tab->rgn.data_32, 32, n, "seq.LABEL_LEN" );
+    }
+
+    /* write how many regions(pacbio)/reads(ncbi) this spot has */
+    if ( rc == 0 )
+    {
+        if ( n > 255 )
+            n = 255;
+        rc = vdb_write_uint8( cursor, col_idx[ seq_tab_NREADS ],
+                              (uint8_t)n, "seq.NREADS" );
+    }
+
+    /* write hq-start/hq-end into CLIP_QUALITY_LEFT/RIGHT */
+    if ( rc == 0 )
+        rc = vdb_write_uint32( cursor, col_idx[ seq_tab_CLIP_QUALITY_LEFT ],
+                               tab->rgn.hq_rgn.start, "seq.CLIP_QUALITY_LEFT" );
+
+    if ( rc == 0 )
+        rc = vdb_write_uint32( cursor, col_idx[ seq_tab_CLIP_QUALITY_RIGHT ],
+                               tab->rgn.hq_rgn.end, "seq.CLIP_QUALITY_RIGHT" );
+
+    return rc;
+}
+
+
+static rc_t seq_load_one_spot( VCursor *cursor, const uint32_t *col_idx,
+                               zmw_row * spot, BaseCalls *tab )
+{
+    rc_t rc = vdb_write_uint32( cursor, col_idx[ seq_tab_READ_START ],
+                                0, "seq.READ_START" );
+    if ( rc == 0 )
+        rc = vdb_write_uint32( cursor, col_idx[ seq_tab_READ_LEN ],
+                               spot->NumEvent, "seq.READ_LEN" );
+    if ( rc == 0 )
+        rc = vdb_write_uint8( cursor, col_idx[ seq_tab_READ_TYPE ],
+                              SRA_READ_TYPE_BIOLOGICAL, "seq.READ_TYPE" );
+    if ( rc == 0 )
+        rc = vdb_write_uint8( cursor, col_idx[ seq_tab_READ_FILTER ],
+                              SRA_READ_FILTER_PASS, "seq.READ_FILTER" );
+    /* write the LABEL ( a constant string defined in pl-regions.h" ) */
+    if ( rc == 0 )
+        rc = vdb_write_value( cursor, col_idx[ seq_tab_LABEL ],
+                              (void*)def_label, 8, def_label_len, "seq.LABEL" );
+    if ( rc == 0 )
+        rc = vdb_write_uint32( cursor, col_idx[ seq_tab_LABEL_START ],
+                               label_insert_start, "seq.LABEL_START" );
+    if ( rc == 0 )
+        rc = vdb_write_uint32( cursor, col_idx[ seq_tab_LABEL_LEN ],
+                               label_insert_len, "seq.LABEL_LEN" );
+    if ( rc == 0 )
+        rc = vdb_write_uint8( cursor, col_idx[ seq_tab_NREADS ],
+                              1, "seq.NREADS" );
+    if ( rc == 0 )
+        rc = vdb_write_uint32( cursor, col_idx[ seq_tab_CLIP_QUALITY_LEFT ],
+                               1, "seq.CLIP_QUALITY_LEFT" );
+    if ( rc == 0 )
+        rc = vdb_write_uint32( cursor, col_idx[ seq_tab_CLIP_QUALITY_RIGHT ],
+                               spot->NumEvent -1, "seq.CLIP_QUALITY_RIGHT" );
+    return rc;
+}
+
+
+static rc_t seq_load_spot( VCursor *cursor, const uint32_t *col_idx,
+                           region_type_mapping *mapping, zmw_row * spot, 
+                           void * data )
+{
+    BaseCalls *tab = (BaseCalls *)data;
+    rc_t rc = VCursorOpenRow( cursor );
+    if ( rc != 0 )
+        PLOGERR( klogErr, ( klogErr, rc, "cannot open seq-row on spot# $(spotnr)",
+                            "spotnr=%u", spot->spot_nr ) );
+
+    if ( rc == 0 )
+        rc = vdb_write_uint32( cursor, col_idx[ seq_tab_HOLE_NUMBER ],
+                               spot->HoleNumber, "seq.HOLE_NUMBER" );
+    if ( rc == 0 )
+        rc = vdb_write_uint8( cursor, col_idx[ seq_tab_HOLE_STATUS ],
+                              spot->HoleStatus, "seq.HOLE_STATUS" );
+    if ( rc == 0 )
+        rc = vdb_write_value( cursor, col_idx[ seq_tab_HOLE_XY ],
+                              &spot->HoleXY, HOLE_XY_BITSIZE, 2, "seq.HOLE_XY" );
+
+    if ( rc == 0 )
+    {
+        /* we load the bases / quality-values and other data belonging
+           to this hole(bacbio)/spot(ncbi) */
+        if ( spot->NumEvent > 0 )
+            rc = seq_load_spot_bases( cursor, tab, col_idx, spot );
+        else
+            rc = seq_load_zero_bases( cursor, tab, col_idx );
+
+        /* we try to divide the spot into regions(pacbio)/reads(ncbi) */
+        if ( rc == 0 )
+        {
+            if ( mapping != NULL )
+                rc = seq_load_read_desc( cursor, col_idx, mapping, spot, tab );
+            else
+                rc = seq_load_one_spot( cursor, col_idx, spot, tab );
+        }
+    }
+
+    if ( rc == 0 )
+    {
+        rc = VCursorCommitRow( cursor );
+        if ( rc != 0 )
+            PLOGERR( klogErr, ( klogErr, rc, "cannot commit seq-row on spot# $(spotnr)",
+                                "spotnr=%u", spot->spot_nr ) );
+    }
+
+    if ( rc == 0 )
+    {
+        rc = VCursorCloseRow( cursor );
+        if ( rc != 0 )
+            PLOGERR( klogErr, ( klogErr, rc, "cannot close seq-row on spot# $(spotnr)",
+                                "spotnr=%u", spot->spot_nr ) );
+    }
+    return rc;
+}
+
+
+static void seq_load_info( regions_stat * stat )
+{
+    KLogLevel tmp_lvl = KLogLevelGet();
+    KLogLevelSet( klogInfo );
+
+    if ( stat->expands_a > 0 )
+        PLOGMSG( klogInfo, ( klogInfo,
+             "adapter expanded: $(times) ( in $(spots) spots )",
+             "times=%u,spots=%u",
+             stat->expands_a, stat->expands_spots ));
+    if ( stat->expands_i > 0 )
+        PLOGMSG( klogInfo, ( klogInfo,
+             "insert expanded : $(times) ( in $(spots) spots )",
+             "times=%u,spots=%u",
+              stat->expands_i, stat->expands_spots ));
+    if ( stat->inserts > 0 )
+        PLOGMSG( klogInfo, ( klogInfo,
+             "regions inserted: $(times) ( in $(spots) spots )",
+             "times=%u,spots=%u",
+             stat->inserts, stat->inserts_spots ));
+    if ( stat->end_gap > 0 )
+        PLOGMSG( klogInfo, ( klogInfo,
+             "end-gap inserted: $(times)",
+             "times=%u", stat->end_gap ));
+    if ( stat->overlapps > 0 )
+        PLOGMSG( klogInfo, ( klogInfo,
+             "overlapping rngs: $(times)",
+             "times=%u", stat->overlapps ));
+    if ( stat->removed > 0 )
+        PLOGMSG( klogInfo, ( klogInfo,
+             "removed rgns    : $(times)",
+             "times=%u", stat->removed ));
+
+    KLogLevelSet( tmp_lvl );
+}
+
+
+
+void seq_report_totals( ld_context *lctx )
+{
+    const char* accession;
+    KLogLevel tmp_lvl = KLogLevelGet();
+    KLogLevelSet( klogInfo );
+
+    accession = strrchr( lctx->dst_path, '/' );
+    if( accession == NULL )
+        accession = lctx->dst_path;
+    else
+        accession++;
+
+    PLOGMSG( klogInfo, ( klogInfo, "loaded",
+            "severity=total,status=success,accession=%s,spot_count=%lu,base_count=%lu,bad_spots=0",
+             accession, lctx->total_seq_spots, lctx->total_seq_bases ));
+
+    KLogLevelSet( tmp_lvl );
+}
+
+
+static rc_t seq_loader( ld_context *lctx, KDirectory * hdf5_src, VCursor * cursor, const char * table_name )
+{
+    BaseCalls BaseCallsTab;
+    bool rgn_present;
+
+    /* opens all hdf5-tables, which are needed to load the sequence-table */
+    rc_t rc = open_BaseCalls( hdf5_src, &BaseCallsTab,
+                              "PulseData/BaseCalls", lctx->cache_content, &rgn_present );
+    if ( rc == 0 )
+    {
+        /* calculates the total number of bases, according to the zmw-table */
+        uint64_t total_bases = zmw_total( &BaseCallsTab.cmn.zmw );
+        /* calculates the total number of spots, according to the zmw-table */
+        uint64_t total_spots = BaseCallsTab.cmn.zmw.NumEvent.extents[ 0 ];
+
+        KLogLevel tmp_lvl = KLogLevelGet();
+        KLogLevelSet( klogInfo );
+        PLOGMSG( klogInfo, ( klogInfo,
+                 "loading sequence-table ( $(bases) bases / $(spots) spots ):",
+                 "bases=%lu,spots=%lu", total_bases, total_spots ));
+        KLogLevelSet( tmp_lvl );
+
+        /* checks that all tables, which are loaded do have the correct
+           number of values (the number that the zmw-table requests) */
+        if ( check_BaseCall_totalcount( &BaseCallsTab, total_bases ) )
+        {
+            region_type_mapping mapping;
+
+            if ( rgn_present )
+            {
+                const KNamelist *region_types;
+                /* read the meta-data-entry "RegionTypes" of the hdf5-regions-table
+                   into a KNamelist */
+                rc = KArrayFileGetMeta ( BaseCallsTab.rgn.hdf5_regions.af, "RegionTypes", &region_types );
+                if ( rc != 0 )
+                {
+                    LOGERR( klogErr, rc, "cannot read Regions.RegionTypes" );
+                }
+                else
+                {
+                    /* extract the region-type-mapping out of the read KNamelist */
+                    rc = rgn_extract_type_mappings( region_types, &mapping, false );
+                    KNamelistRelease ( region_types );
+                    if ( rc != 0 )
+                    {
+                        LOGERR( klogErr, rc, "cannot map regions-types" );
+                    }
+                }
+            }
+
+            if ( rc == 0 )
+            {
+                /* holds the vdb-column-index for every column we write */
+                uint32_t col_idx[ seq_tab_count ];
+                int32_t to_exclude;
+
+                /* depending on the bit-size of the PulseIndex-table in HDF5
+                   exclude the opposite column from VDB */
+                if ( BaseCallsTab.PulseIndex.element_bits == PULSE_INDEX_BITSIZE_16 )
+                    to_exclude = seq_tab_PULSE_INDEX_32;
+                else
+                    to_exclude = seq_tab_PULSE_INDEX_16;
+
+                /* add all columns to the vdb-cursor */
+                rc = add_columns( cursor, seq_tab_count, to_exclude, col_idx, seq_tab_names );
+                if ( rc == 0 )
+                {
+                    rc = VCursorOpen( cursor );
+                    if ( rc != 0 )
+                        LOGERR( klogErr, rc, "cannot open cursor on seq-table" );
+                    else
+                    {
+                        const uint8_t platform = SRA_PLATFORM_PACBIO_SMRT;
+
+                        rc = VCursorDefault ( cursor, col_idx[ seq_tab_PLATFORM ], 8, &platform, 0, 1 );
+                        if ( rc != 0 )
+                            LOGERR( klogErr, rc, "cannot set cursor-default on seq-table for platform-column" );
+                        else
+                        {
+                            region_type_mapping *mapping_ptr = NULL;
+        
+                            if ( rgn_present )
+                            {
+                                mapping_ptr = &mapping;
+                            }
+                            /* call for every spot the function >seq_load_spot< */
+                            rc = zmw_for_each( &BaseCallsTab.cmn.zmw, &lctx->xml_progress, cursor,
+                                               lctx->with_progress, col_idx, mapping_ptr, false, seq_load_spot, &BaseCallsTab );
+                        }
+                    }
+                }
+            }
+
+            if ( rgn_present )
+            {
+                seq_load_info( &BaseCallsTab.rgn.stat );
+
+                if ( mapping.count_of_unknown_rgn_types > 0 )
+                {
+                    KLogLevel tmp_lvl = KLogLevelGet();
+                    KLogLevelSet( klogInfo );
+
+                    PLOGMSG( klogInfo, ( klogInfo,
+                        "$(times) x unknown region types encountered",
+                        "times=%i", mapping.count_of_unknown_rgn_types ) );
+                    KLogLevelSet( tmp_lvl );
+
+                }
+            }
+
+            lctx->total_seq_bases += total_bases;
+            lctx->total_seq_spots += total_spots;
+        }   
+        else
+            rc = RC( rcExe, rcNoTarg, rcAllocating, rcParam, rcInvalid );
+        close_BaseCalls( &BaseCallsTab );
+    }
+
+    return rc;
+}
+
+
+/* HDF5-Groups and tables used to load the PULSE-table */
+static const char * seq_groups_to_check[] = 
+{ 
+    "PulseData",
+    "PulseData/BaseCalls",
+    "PulseData/BaseCalls/ZMW",
+    NULL
+};
+
+static const char * seq_tables_to_check[] = 
+{ 
+    "PulseData/BaseCalls/Basecall",
+    "PulseData/BaseCalls/DeletionQV",
+    "PulseData/BaseCalls/DeletionTag",
+    "PulseData/BaseCalls/InsertionQV",
+    "PulseData/BaseCalls/PreBaseFrames",
+    "PulseData/BaseCalls/PulseIndex",
+    "PulseData/BaseCalls/QualityValue",
+    "PulseData/BaseCalls/SubstitutionQV",
+    "PulseData/BaseCalls/SubstitutionTag",
+    "PulseData/BaseCalls/WidthInFrames",
+    "PulseData/BaseCalls/ZMW/HoleNumber",
+    "PulseData/BaseCalls/ZMW/HoleStatus",
+    "PulseData/BaseCalls/ZMW/HoleXY",
+    "PulseData/BaseCalls/ZMW/NumEvent",
+    NULL
+};
+
+
+static const char * seq_schema_template = "SEQUENCE";
+static const char * seq_table_to_create = "SEQUENCE";
+
+
+/* special case for SEQUENCE: in order to prepare the cursor correctly, we have to know the first HDF5-source-obj !*/
+rc_t prepare_seq( VDatabase * database, seq_ctx * sctx, KDirectory * hdf5_src, ld_context *lctx )
+{
+    rc_t rc = prepare_table( database, &sctx->cursor, seq_schema_template, seq_table_to_create ); /* pl-tools.c ... this creates the cursor */
+    sctx->src_open = false;
+    if ( rc == 0 )
+    {
+        rc = open_BaseCalls( hdf5_src, &sctx->BaseCallsTab, "PulseData/BaseCalls", lctx->cache_content, &sctx->rgn_present );
+        if ( rc == 0 )
+        {
+            int32_t to_exclude;
+
+            /* depending on the bit-size of the PulseIndex-table in HDF5
+               exclude the opposite column from VDB */
+            if ( sctx->BaseCallsTab.PulseIndex.element_bits == PULSE_INDEX_BITSIZE_16 )
+                to_exclude = seq_tab_PULSE_INDEX_32;
+            else
+                to_exclude = seq_tab_PULSE_INDEX_16;
+
+            /* add all columns to the vdb-cursor */
+            rc = add_columns( sctx->cursor, seq_tab_count, to_exclude, sctx->col_idx, seq_tab_names );
+            if ( rc == 0 )
+            {
+                rc = VCursorOpen( sctx->cursor );
+                if ( rc != 0 )
+                {
+                    LOGERR( klogErr, rc, "cannot open cursor on seq-table" );
+                }
+                else
+                {
+                    const uint8_t platform = SRA_PLATFORM_PACBIO_SMRT;
+
+                    rc = VCursorDefault ( sctx->cursor, sctx->col_idx[ seq_tab_PLATFORM ], 8, &platform, 0, 1 );
+                    if ( rc != 0 )
+                    {
+                        LOGERR( klogErr, rc, "cannot set cursor-default on seq-table for platform-column" );
+                    }
+                    else
+                    {
+                        sctx->src_open = true;
+                        sctx->lctx = lctx;
+                    }
+                }
+            }
+        }
+    }
+    return rc;
+}
+
+
+rc_t load_seq_src( seq_ctx * sctx, KDirectory * hdf5_src )
+{
+    rc_t rc = 0;
+    if ( sctx->lctx->check_src_obj )
+        rc = check_src_objects( hdf5_src, seq_groups_to_check, seq_tables_to_check, true );
+
+    if ( rc == 0 && !sctx->src_open )
+        rc = open_BaseCalls( hdf5_src, &sctx->BaseCallsTab, "PulseData/BaseCalls", sctx->lctx->cache_content, &sctx->rgn_present );
+    if ( rc == 0 )
+    {
+        /* calculates the total number of bases, according to the zmw-table */
+        uint64_t total_bases = zmw_total( &sctx->BaseCallsTab.cmn.zmw );
+        /* calculates the total number of spots, according to the zmw-table */
+        uint64_t total_spots = sctx->BaseCallsTab.cmn.zmw.NumEvent.extents[ 0 ];
+
+        KLogLevel tmp_lvl = KLogLevelGet();
+        KLogLevelSet( klogInfo );
+        PLOGMSG( klogInfo, ( klogInfo,
+                 "loading sequence-table ( $(bases) bases / $(spots) spots ):",
+                 "bases=%lu,spots=%lu", total_bases, total_spots ));
+        KLogLevelSet( tmp_lvl );
+
+        /* checks that all tables, which are loaded do have the correct
+           number of values (the number that the zmw-table requests) */
+        if ( !check_BaseCall_totalcount( &sctx->BaseCallsTab, total_bases ) )
+            rc = RC( rcExe, rcNoTarg, rcAllocating, rcParam, rcInvalid );
+        else
+        {
+            region_type_mapping mapping;
+
+            if ( sctx->rgn_present )
+            {
+                const KNamelist *region_types;
+                /* read the meta-data-entry "RegionTypes" of the hdf5-regions-table
+                   into a KNamelist */
+                rc = KArrayFileGetMeta ( sctx->BaseCallsTab.rgn.hdf5_regions.af, "RegionTypes", &region_types );
+                if ( rc != 0 )
+                {
+                    LOGERR( klogErr, rc, "cannot read Regions.RegionTypes" );
+                }
+                else
+                {
+                    /* extract the region-type-mapping out of the read KNamelist */
+                    rc = rgn_extract_type_mappings( region_types, &mapping, false );
+                    KNamelistRelease ( region_types );
+                    if ( rc != 0 )
+                    {
+                        LOGERR( klogErr, rc, "cannot map regions-types" );
+                    }
+                }
+            }
+
+            if ( rc == 0 )
+            {
+                region_type_mapping *mapping_ptr = NULL;
+
+                if ( sctx->rgn_present )
+                    mapping_ptr = &mapping;
+
+                /* call for every spot the function >seq_load_spot< */
+                rc = zmw_for_each( &sctx->BaseCallsTab.cmn.zmw, &sctx->lctx->xml_progress, sctx->cursor,
+                                   sctx->lctx->with_progress, sctx->col_idx, mapping_ptr, false,
+                                   seq_load_spot, &sctx->BaseCallsTab );
+            }
+
+            if ( sctx->rgn_present )
+                seq_load_info( &sctx->BaseCallsTab.rgn.stat );
+
+            sctx->lctx->total_seq_bases += total_bases;
+            sctx->lctx->total_seq_spots += total_spots;
+        }   
+        close_BaseCalls( &sctx->BaseCallsTab );
+        sctx->src_open = false;
+    }
+    return rc;
+}
+
+
+rc_t finish_seq( seq_ctx * sctx )
+{
+    VCursorRelease( sctx->cursor );
+    return 0;
+}
+
+
+rc_t load_seq( VDatabase * database, KDirectory * hdf5_src, ld_context *lctx )
+{
+    rc_t rc = 0;
+    if ( lctx->check_src_obj )
+        rc = check_src_objects( hdf5_src, seq_groups_to_check, seq_tables_to_check, true );
+    if ( rc == 0 )
+        /* in pl-tools.c */
+        rc = load_table( database, hdf5_src, lctx, seq_schema_template, 
+                         seq_table_to_create, seq_loader );
+    return rc;
+}
diff --git a/tools/pacbio-load/pl-sequence.h b/tools/pacbio-load/pl-sequence.h
new file mode 100644
index 0000000..f093859
--- /dev/null
+++ b/tools/pacbio-load/pl-sequence.h
@@ -0,0 +1,110 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+#ifndef _h_pl_sequence_
+#define _h_pl_sequence_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "pl-tools.h"
+#include "pl-zmw.h"
+#include "pl-basecalls_cmn.h"
+#include "pl-regions.h"
+#include <klib/rc.h>
+#include <insdc/sra.h>
+
+/* enumeration of the columns of the pulse-table */
+enum
+{
+    /* base-space */
+    seq_tab_READ = 0,
+    seq_tab_QUALITY,
+    seq_tab_NREADS,
+    seq_tab_PLATFORM,
+
+    seq_tab_LABEL,
+    seq_tab_LABEL_START,
+    seq_tab_LABEL_LEN,
+    seq_tab_READ_TYPE,
+    seq_tab_READ_START,
+    seq_tab_READ_LEN,
+    seq_tab_CLIP_QUALITY_LEFT,
+    seq_tab_CLIP_QUALITY_RIGHT,
+    seq_tab_READ_FILTER,
+
+    /* pulse-space */
+    seq_tab_PRE_BASE_FRAMES,
+    seq_tab_WIDTH_IN_FRAMES,
+    seq_tab_PULSE_INDEX_16,
+    seq_tab_PULSE_INDEX_32,
+    seq_tab_HOLE_NUMBER,
+    seq_tab_HOLE_STATUS,
+    seq_tab_HOLE_XY,
+    seq_tab_INSERTION_QV,
+    seq_tab_DELETION_QV,
+    seq_tab_DELETION_TAG,
+    seq_tab_SUBSTITUTION_QV,
+    seq_tab_SUBSTITUTION_TAG,
+    seq_tab_count
+};
+
+
+typedef struct BaseCalls
+{
+    BaseCalls_cmn cmn;
+    regions rgn;
+    af_data PreBaseFrames;
+    af_data PulseIndex;
+    af_data WidthInFrames;
+} BaseCalls;
+
+
+typedef struct seq_ctx
+{
+    VCursor * cursor;
+    ld_context *lctx;
+    BaseCalls BaseCallsTab;
+    uint32_t col_idx[ seq_tab_count ];
+    bool rgn_present;
+    bool src_open;
+} seq_ctx;
+
+
+/* special case for SEQUENCE: in order to prepare the cursor correctly, we have to know the first HDF5-source-obj !*/
+rc_t prepare_seq( VDatabase * database, seq_ctx * sctx, KDirectory * hdf5_src, ld_context *lctx );
+rc_t load_seq_src( seq_ctx * sctx, KDirectory * hdf5_src );
+rc_t finish_seq( seq_ctx * sctx );
+
+void seq_report_totals( ld_context *lctx );
+
+rc_t load_seq( VDatabase * database, KDirectory * hdf5_src, ld_context *lctx );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/pacbio-load/pl-tools.c b/tools/pacbio-load/pl-tools.c
new file mode 100644
index 0000000..96b1032
--- /dev/null
+++ b/tools/pacbio-load/pl-tools.c
@@ -0,0 +1,616 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "pl-tools.h"
+#include <klib/printf.h>
+#include <sysalloc.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <kdb/database.h>
+#include <vdb/database.h>
+#include <vdb/vdb-priv.h>
+
+void lctx_init( ld_context * lctx )
+{
+    lctx->xml_logger = NULL;
+    lctx->xml_progress = NULL;
+    lctx->with_progress = false;
+    lctx->total_printed = false;
+    lctx->cache_content = false;
+    lctx->check_src_obj = false;
+    lctx->total_seq_bases = 0;
+    lctx->total_seq_spots = 0;
+}
+
+
+void lctx_free( ld_context * lctx )
+{
+    if ( lctx->xml_logger != NULL )
+    {
+        XMLLogger_Release( lctx->xml_logger );
+        lctx->xml_logger = NULL;
+    }
+    if ( lctx->xml_progress != NULL )
+    {
+        KLoadProgressbar_Release( lctx->xml_progress, false );
+        lctx->xml_progress = NULL;
+    }
+}
+
+
+rc_t check_src_objects( const KDirectory *hdf5_dir,
+                        const char ** groups, 
+                        const char **tables,
+                        bool show_not_found )
+{
+    rc_t rc = 0;
+    uint16_t idx = 0;
+    uint32_t pt;
+
+    if ( groups != NULL )
+    {
+        while ( groups[ idx ] != NULL && rc == 0 )
+        {
+            pt = KDirectoryPathType ( hdf5_dir, "%s", groups[idx] );
+            if ( pt != kptDir )
+            {
+                rc = RC( rcExe, rcNoTarg, rcAllocating, rcParam, rcInvalid );
+                if ( show_not_found )
+                    PLOGERR( klogErr, ( klogErr, rc, "hdf5-group '$(grp)' not found",
+                                    "grp=%s", groups[ idx ] ) );
+                else
+                    PLOGERR( klogWarn, ( klogWarn, rc, "hdf5-group '$(grp)' not found",
+                                    "grp=%s", groups[ idx ] ) );
+            }
+            else
+                idx++;
+        }
+    }
+
+    idx = 0;
+    if ( tables != NULL && rc == 0 )
+    {
+        while ( tables[ idx ] != NULL && rc == 0 )
+        {
+            pt = KDirectoryPathType ( hdf5_dir, "%s", tables[idx] );
+            if ( pt != kptDataset )
+            {
+                rc = RC( rcExe, rcNoTarg, rcAllocating, rcParam, rcInvalid );
+                if ( show_not_found )
+                    PLOGERR( klogErr, ( klogErr, rc, "hdf5-table '$(tbl)' not found",
+                                    "tbl=%s", tables[ idx ] ) );
+                else
+                    PLOGERR( klogWarn, ( klogWarn, rc, "hdf5-table '$(tbl)' not found",
+                                    "tbl=%s", tables[ idx ] ) );
+            }
+            else
+                idx++;
+        }
+    }
+
+    return rc;
+}
+
+
+void init_array_file( af_data * af )
+{
+    af->f  = NULL;
+    af->af = NULL;
+    af->extents = NULL;
+    af->rc = -1;
+    af->content = NULL;
+}
+
+
+void free_array_file( af_data * af )
+{
+    if ( af->af != NULL )
+    {
+        KArrayFileRelease( af->af );
+        af->af = NULL;
+    }
+    if ( af->f != NULL )
+    {
+        KFileRelease( af->f );
+        af->f = NULL;
+    }
+    if ( af->extents != NULL )
+    {
+        free( af->extents );
+        af->extents = NULL;
+    }
+    if ( af->content != NULL )
+    {
+        free( af->content );
+        af->content = NULL;
+    }
+}
+
+
+static rc_t read_cache_content( af_data * af )
+{
+    rc_t rc = 0;
+    uint64_t filesize = ( af->element_bits >> 3 ) * ( af->extents[ 0 ] );
+    if ( af->dimensionality == 2 )
+        filesize *= af->extents[ 1 ];
+    af->content = malloc( filesize );
+    if ( af->content == NULL )
+        rc = RC ( rcApp, rcArgv, rcAccessing, rcMemory, rcExhausted );
+    else
+    {
+        uint64_t pos2[ 2 ];
+        uint64_t read2[ 2 ];
+        uint64_t count2[ 2 ];
+        rc_t rc;
+
+        pos2[ 0 ] = 0;
+        pos2[ 1 ] = 0;
+        count2[ 0 ] = af->extents[ 0 ];
+        if ( af->dimensionality == 2 )
+            count2[ 1 ] = af->extents[ 1 ];
+        else
+            count2[ 1 ] = 0;
+
+        rc = KArrayFileRead ( af->af, af->dimensionality, pos2, 
+                              af->content, count2, read2 );
+        if ( rc != 0 )
+            LOGERR( klogErr, rc, "error reading arrayfile-data int cache" );
+    }
+    return rc;
+}
+
+
+rc_t open_array_file( const KDirectory *dir,
+                      const char *name,
+                      af_data * af,
+                      const uint64_t expected_element_bits,
+                      const uint64_t expected_cols,
+                      bool disp_wrong_bitsize,
+                      bool cache_content,
+                      bool supress_err_msg )
+{
+    rc_t rc;
+
+    init_array_file( af );
+    /* open the requested "File" (actually a hdf5-table) as KFile 
+       the works because the given KDirectory is a HDF5-Directory */
+    rc = KDirectoryOpenFileRead ( dir, &af->f, "%s", name );
+    if ( rc != 0 )
+    {
+        if ( !supress_err_msg )
+        {
+            PLOGERR( klogErr, ( klogErr, rc, "cannot open hdf5-dataset '$(name)'",
+                            "name=%s", name ) );
+        }
+        return rc;
+    }
+    /* cast the KFile into a KArrayFile */
+    rc = MakeHDF5ArrayFile ( af->f, &af->af );
+    if ( rc != 0 )
+    {
+        PLOGERR( klogErr, ( klogErr, rc, "cannot open hdf5-arrayfile '$(name)'",
+                            "name=%s", name ) );
+        free_array_file( af );
+        return rc;
+    }
+    /* detect the dimensionality of the array-file */
+    rc = KArrayFileDimensionality ( af->af, &af->dimensionality );
+    if ( rc != 0 )
+    {
+        PLOGERR( klogErr, ( klogErr, rc, "cannot retrieve dimensionality on '$(name)'",
+                            "name=%s", name ) );
+        free_array_file( af );
+        return rc;
+    }
+    /* make a array to hold the extent in every dimension */
+    af->extents = malloc( af->dimensionality * ( sizeof ( uint64_t ) ) );
+    if ( af->extents == NULL )
+    {
+        rc = RC ( rcApp, rcArgv, rcAccessing, rcMemory, rcExhausted );
+        PLOGERR( klogErr, ( klogErr, rc, "cannot allocate enough memory for extents of '$(name)'",
+                            "name=%s", name ) );
+        free_array_file( af );
+        return rc;
+    }
+    /* read the actuall extents into the created array */
+    rc = KArrayFileDimExtents ( af->af, af->dimensionality, af->extents );
+    if ( rc != 0 )
+    {
+        PLOGERR( klogErr, ( klogErr, rc, "cannot retrieve extents of '$(name)'",
+                            "name=%s", name ) );
+        free_array_file( af );
+        return rc;
+    }
+    /* request the size of the element in bits */
+    rc = KArrayFileElementSize ( af->af, &af->element_bits );
+    if ( rc != 0 )
+    {
+        PLOGERR( klogErr, ( klogErr, rc, "cannot retrieve element-size of '$(name)'",
+                            "name=%s", name ) );
+        free_array_file( af );
+        return rc;
+    }
+    /* compare the discovered bit-size with the expected one */
+    if ( af->element_bits != expected_element_bits )
+    {
+        rc = RC ( rcExe, rcNoTarg, rcLoading, rcData, rcInconsistent );
+
+        /* display the wrong bitsize only if wanted 
+           ( this function can be called to probe the bitsize:
+             in this case the wrong one should not be shown as an error )*/
+        if ( disp_wrong_bitsize )
+            PLOGERR( klogErr, ( klogErr, rc, "unexpected element-bits of $(bsize) in '$(name)'",
+                     "bsize=%lu,name=%s", af->element_bits, name ) );
+
+        free_array_file( af );
+        return rc;
+    }
+
+    /* not generic, we handle only dimensionality of 1 and 2 */
+    if ( expected_cols == 1 )
+    {
+        /* the dimensionality has to be 1 in this case */
+        if ( af->dimensionality != 1 )
+        {
+            rc = RC ( rcExe, rcNoTarg, rcLoading, rcData, rcInconsistent );
+            PLOGERR( klogErr, ( klogErr, rc, "unexpected dimensionality of $(dim) in '$(name)'",
+                                "dim=%lu,name=%s", af->dimensionality, name ) );
+            free_array_file( af );
+            return rc;
+        }
+    }
+    else
+    {
+        /* the dimensionality has to be 2 in this case */
+        if ( af->dimensionality != 2 )
+        {
+            rc = RC ( rcExe, rcNoTarg, rcLoading, rcData, rcInconsistent );
+            PLOGERR( klogErr, ( klogErr, rc, "unexpected dimensionality of $(dim) in '$(name)'",
+                                "dim=%lu,name=%s", af->dimensionality, name ) );
+            free_array_file( af );
+            return rc;
+        }
+        else
+        {
+            if ( af->extents[ 1 ] != expected_cols )
+            {
+                rc = RC ( rcExe, rcNoTarg, rcLoading, rcData, rcInconsistent );
+                PLOGERR( klogErr, ( klogErr, rc, "unexpected extent[1] of $(ext) in '$(name)'",
+                                    "ext=%lu,name=%s", af->extents[ 1 ], name ) );
+                free_array_file( af );
+                return rc;
+            }
+        }
+    }
+    if ( rc == 0 && cache_content )
+    {
+        rc = read_cache_content( af );
+    }
+    return rc;
+}
+
+
+/* assembles the 'absolute' path to the requested array-file before opening it */
+rc_t open_element( const KDirectory *hdf5_dir, 
+                   af_data *element, 
+                   const char * path,
+                   const char * name, 
+                   const uint64_t expected_element_bits,
+                   const uint64_t expected_cols,
+                   bool disp_wrong_bitsize,
+                   bool cache_content,
+                   bool supress_err_msg )
+{
+    char src_path[ 64 ];
+    size_t num_writ;
+
+    element->rc = string_printf ( src_path, sizeof src_path, &num_writ, "%s/%s", path, name );
+    if ( element->rc != 0 )
+        LOGERR( klogErr, element->rc, "cannot assemble hdf5-element-name" );
+    else
+        element->rc = open_array_file( hdf5_dir, src_path, element, 
+                                       expected_element_bits, expected_cols,
+                                       disp_wrong_bitsize,
+                                       cache_content,
+                                       supress_err_msg );
+    return element->rc;
+}
+
+
+/* we are reading data from an array-file,
+   the underlying array-file knows the size of an element */
+rc_t array_file_read_dim1( af_data * af, const uint64_t pos,
+                           void *dst, const uint64_t count,
+                           uint64_t *n_read )
+{
+    rc_t rc = 0;
+    if ( af->content == NULL )
+        rc = KArrayFileRead ( af->af, 1, &pos, dst, &count, n_read );
+    else
+    {
+        if ( ( pos + count ) > af->extents[ 0 ] )
+            rc = RC ( rcExe, rcNoTarg, rcLoading, rcData, rcInconsistent );
+        else
+        {
+            uint64_t buf_idx = ( af->element_bits >> 3 ) * pos;
+            size_t num = ( af->element_bits >> 3 ) * count;
+            char * src = af->content;
+            src+=buf_idx;
+            memcpy( dst, src, num );
+            *n_read = count;
+        }
+    }
+    if ( rc != 0 )
+        LOGERR( klogErr, rc, "error reading arrayfile-data (1 dim)" );
+    return rc;
+}
+
+
+/* we are reading values in 2 dimensions from the array-file */
+rc_t array_file_read_dim2( af_data * af, const uint64_t pos,
+                           void *dst, const uint64_t count,
+                           const uint64_t ext2, uint64_t *n_read )
+{
+    rc_t rc = 0;
+    if ( af->content == NULL )
+    {
+        uint64_t pos2[ 2 ];
+        uint64_t read2[ 2 ];
+        uint64_t count2[ 2 ];
+        rc_t rc;
+
+        pos2[ 0 ] = pos;
+        pos2[ 1 ] = 0;
+        count2[ 0 ] = count;
+        count2[ 1 ] = ext2;
+        rc = KArrayFileRead ( af->af, 2, pos2, dst, count2, read2 );
+        if ( rc != 0 )
+            LOGERR( klogErr, rc, "error reading arrayfile-data (2 dim)" );
+        *n_read = read2[ 0 ];
+    }
+    else
+    {
+        if ( ( pos + count ) > af->extents[ 0 ] )
+            rc = RC ( rcExe, rcNoTarg, rcLoading, rcData, rcInconsistent );
+        else
+        {
+            uint64_t buf_idx = ( af->element_bits >> 3 ) * pos * af->extents[ 1 ];
+            size_t num = ( af->element_bits >> 3 ) * count * af->extents[ 1 ];
+            char * src = af->content;
+            src+=buf_idx;
+            memcpy( dst, src, num );
+            *n_read = count * af->extents[ 1 ];
+        }
+    }
+    return rc;
+}
+
+
+rc_t add_columns( VCursor * cursor, uint32_t count, int32_t exclude_this,
+                  uint32_t * idx_vector, const char ** names )
+{
+    rc_t rc = 0;
+    uint32_t i;
+    for ( i = 0; i < count && rc == 0; ++i )
+    {
+        if ( i != exclude_this )
+        {
+            rc = VCursorAddColumn( cursor, &(idx_vector[i]), "%s", names[i] );
+            if ( rc != 0 )
+                PLOGERR( klogErr, ( klogErr, rc, "cannot add column '$(name)' to vdb-cursor",
+                                    "name=%s", names[i] ) );
+        }
+    }
+    return rc;
+}
+
+bool check_table_count( af_data *tab, const char * name,
+                        const uint64_t expected )
+{
+    bool res = ( tab->extents[ 0 ] == expected );
+    if ( !res )
+    {
+        rc_t rc = RC( rcExe, rcNoTarg, rcAllocating, rcParam, rcInvalid );
+        PLOGERR( klogErr, ( klogErr, rc, "'$(name)'.count != expected",
+                            "name=%s", name ) );
+    }
+    return res;
+}
+
+
+rc_t transfer_bits( VCursor *cursor, const uint32_t col_idx,
+    af_data *src, char * buffer, const uint64_t offset, const uint64_t count,
+    const uint32_t n_bits, const char * explanation )
+{
+    uint64_t n_read;
+    rc_t rc = array_file_read_dim1( src, offset, buffer, count, &n_read );
+    if ( rc == 0 )
+    {
+        if ( count != n_read )
+        {
+            rc = RC( rcExe, rcNoTarg, rcAllocating, rcParam, rcInvalid );
+            PLOGERR( klogErr, ( klogErr, rc, "cannot read enought data from hdf5-table for '$(name)'",
+                                "name=%s", explanation ) );
+        }
+        if ( rc == 0 )
+        {
+            rc = VCursorWrite( cursor, col_idx, n_bits, buffer, 0, count );
+            if ( rc != 0 )
+                PLOGERR( klogErr, ( klogErr, rc, "cannot write data to vdb for '$(name)'",
+                                    "name=%s", explanation ) );
+        }
+    }
+    return rc;
+}
+
+
+rc_t vdb_write_value( VCursor *cursor, const uint32_t col_idx,
+                      void * src, const uint32_t n_bits,
+                      const uint32_t n_elem, const char *explanation )
+{
+    rc_t rc = VCursorWrite( cursor, col_idx, n_bits, src, 0, n_elem );
+    if ( rc != 0 )
+        PLOGERR( klogErr, ( klogErr, rc, "cannot write data to vdb for '$(name)'",
+                            "name=%s", explanation ) );
+    return rc;
+}
+
+
+rc_t vdb_write_uint32( VCursor *cursor, const uint32_t col_idx,
+                       uint32_t value, const char *explanation )
+{
+    return vdb_write_value( cursor, col_idx, &value, 32, 1, explanation );
+}
+
+
+rc_t vdb_write_uint16( VCursor *cursor, const uint32_t col_idx,
+                       uint16_t value, const char *explanation )
+{
+    return vdb_write_value( cursor, col_idx, &value, 16, 1, explanation );
+}
+
+
+rc_t vdb_write_uint8( VCursor *cursor, const uint32_t col_idx,
+                      uint8_t value, const char *explanation )
+{
+    return vdb_write_value( cursor, col_idx, &value, 8, 1, explanation );
+}
+
+
+rc_t vdb_write_float32( VCursor *cursor, const uint32_t col_idx,
+                        float value, const char *explanation )
+{
+    return vdb_write_value( cursor, col_idx, &value, 32, 1, explanation );
+}
+
+
+rc_t prepare_table( VDatabase * database, VCursor ** cursor,
+                    const char * template_name,
+                    const char * table_name )
+{
+    VTable * table;
+    rc_t rc = VDatabaseCreateTable( database, &table, template_name, 
+                                    kcmInit | kcmMD5 | kcmParents, "%s", table_name );
+    if ( rc != 0 )
+    {
+        PLOGERR( klogErr, ( klogErr, rc, "cannot create vdb-table '$(name)'",
+                            "name=%s", table_name ) );
+    }
+    else
+    {
+        rc = VTableCreateCursorWrite( table, cursor, kcmInsert );
+        if ( rc != 0 )
+        {
+            PLOGERR( klogErr, ( klogErr, rc, "cannot create vdb-cursor for '$(name)'",
+                                "name=%s", table_name ) );
+        }
+        VTableRelease( table );
+    }
+    return rc;
+}
+
+
+rc_t load_table( VDatabase * database, KDirectory * hdf5_src, ld_context *lctx,
+                 const char * template_name, const char * table_name, loader_func func )
+{
+    VTable * table;
+    rc_t rc = VDatabaseCreateTable( database, &table, template_name, 
+                                    kcmInit | kcmMD5 | kcmParents, "%s", table_name );
+    if ( rc != 0 )
+        PLOGERR( klogErr, ( klogErr, rc, "cannot create vdb-table '$(name)'",
+                            "name=%s", table_name ) );
+    else
+    {
+        VCursor * cursor;
+        rc = VTableCreateCursorWrite( table, &cursor, kcmInsert );
+        if ( rc != 0 )
+            PLOGERR( klogErr, ( klogErr, rc, "cannot create vdb-cursor for '$(name)'",
+                                "name=%s", table_name ) );
+        else
+        {
+            VTableRelease( table );
+            rc = func( lctx, hdf5_src, cursor, table_name ); /* the callback does the job! */
+            VCursorRelease( cursor );
+        }
+    }
+    return rc;
+}
+
+
+rc_t progress_chunk( const KLoadProgressbar ** xml_progress, const uint64_t chunk )
+{
+    rc_t rc;
+    /* release the old progressbar... */
+    if ( *xml_progress != NULL )
+    {
+        KLoadProgressbar_Release( *xml_progress, false );
+        *xml_progress = NULL;
+    }
+    rc = KLoadProgressbar_Make( xml_progress, 0 );
+    if ( rc == 0 )
+        rc = KLoadProgressbar_Append( *xml_progress, chunk );
+    else
+        LOGERR( klogErr, rc, "cannot make KLoadProgressbar" );
+
+    return rc;
+}
+
+
+rc_t progress_step( const KLoadProgressbar * xml_progress )
+{
+    if ( xml_progress != NULL )
+       return KLoadProgressbar_Process( xml_progress, 1, false );
+    else
+        return 0;
+}
+
+
+void print_log_info( const char * info )
+{
+    KLogLevel tmp_lvl = KLogLevelGet();
+    KLogLevelSet( klogInfo );
+    LOGMSG( klogInfo, info );
+    KLogLevelSet( tmp_lvl );
+}
+
+
+/* was once intended to make the SEQ-table a alias to the CONSENSU-table,
+   this step was removed, but the decision could be reinstate again
+   because of that the function to do so is still here */
+rc_t pacbio_make_alias( VDatabase * vdb_db,
+                        const char *existing_obj, const char *alias_to_create )
+{
+    KDatabase *kdb;
+    rc_t rc = VDatabaseOpenKDatabaseUpdate ( vdb_db, & kdb );
+    if ( rc == 0 )
+    {
+        rc = KDatabaseAliasTable ( kdb, existing_obj, alias_to_create );
+        KDatabaseRelease ( kdb );
+    }
+    return rc;
+}
diff --git a/tools/pacbio-load/pl-tools.h b/tools/pacbio-load/pl-tools.h
new file mode 100644
index 0000000..5b8618f
--- /dev/null
+++ b/tools/pacbio-load/pl-tools.h
@@ -0,0 +1,291 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_pl_tools_
+#define _h_pl_tools_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <klib/out.h>
+#include <klib/rc.h>
+#include <klib/text.h>
+#include <klib/log.h>
+#include <vdb/manager.h>
+#include <vdb/schema.h>
+#include <vdb/database.h>
+#include <vdb/table.h>
+#include <vdb/cursor.h>
+#include <kfs/file.h>
+#include <kfs/arrayfile.h>
+#include <hdf5/kdf5.h>
+#include <kapp/log-xml.h>
+#include <kapp/progressbar.h>
+
+/* for zmw */
+#define HOLE_NUMBER_BITSIZE 32
+#define HOLE_NUMBER_COLS 1
+
+#define HOLE_STATUS_BITSIZE 8
+#define HOLE_STATUS_COLS 1
+
+#define HOLE_XY_BITSIZE 16
+#define HOLE_XY_COLS 2
+
+#define NUMEVENT_BITSIZE 32
+#define NUMEVENT_COLS 1
+
+#define NUMPASSES_BITSIZE 32
+#define NUMPASSES_COLS 1
+
+/* for BaseCalls_cmn */
+#define BASECALL_BITSIZE 8
+#define BASECALL_COLS 1
+
+#define QUALITY_VALUE_BITSIZE 8
+#define QUALITY_VALUE_COLS 1
+
+#define DELETION_QV_BITSIZE 8
+#define DELETION_QV_COLS 1
+
+#define DELETION_TAG_BITSIZE 8
+#define DELETION_TAG_COLS 1
+
+#define INSERTION_QV_BITSIZE 8
+#define INSERTION_QV_COLS 1
+
+#define SUBSTITUTION_QV_BITZISE 8
+#define SUBSTITUTION_QV_COLS 1
+
+#define SUBSTITUTION_TAG_BITSIZE 8
+#define SUBSTITUTION_TAG_COLS 1
+
+/* for regions */
+#define REGIONS_BITSIZE 32
+#define REGIONS_COLS 5
+
+/* for sequence */
+#define PRE_BASE_FRAMES_BITSIZE 16
+#define PRE_BASE_FRAMES_COLS 1
+
+#define PULSE_INDEX_BITSIZE_16 16
+#define PULSE_INDEX_BITSIZE_32 32
+#define PULSE_INDEX_COLS 1
+
+#define WIDTH_IN_FRAMES_BITSIZE 16
+#define WIDTH_IN_FRAMES_COLS 1
+
+/* for metrics */
+#define BASE_FRACTION_BITSIZE 32
+#define BASE_FRACTION_COLS 4
+
+#define BASE_IPD_BITSIZE 32
+#define BASE_IPD_COLS 1
+
+#define BASE_RATE_BITSIZE 32
+#define BASE_RATE_COLS 1
+
+#define BASE_WIDTH_BITSIZE 32
+#define BASE_WIDTH_COLS 1
+
+#define CM_BAS_QV_BITSIZE 32
+#define CM_BAS_QV_COLS 4
+
+#define CM_DEL_QV_BITSIZE 32
+#define CM_DEL_QV_COLS 4
+
+#define CM_INS_QV_BITSIZE 32
+#define CM_INS_QV_COLS 4
+
+#define CM_SUB_QV_BITSIZE 32
+#define CM_SUB_QV_COLS 4
+
+#define LOCAL_BASE_RATE_BITSIZE 32
+#define LOCAL_BASE_RATE_COLS 1
+
+#define DARK_BASE_RATE_BITSIZE 32
+#define DARK_BASE_RATE_COLS 1
+
+#define HQ_REGION_START_TIME_BITSIZE 32
+#define HQ_REGION_START_TIME_COLS 1
+
+#define HQ_REGION_END_TIME_BITSIZE 32
+#define HQ_REGION_END_TIME_COLS 1
+
+#define HQ_REGION_SNR_BITSIZE 32
+#define HQ_REGION_SNR_COLS 4
+
+#define PRODUCTIVITY_BITSIZE 8
+#define PRODUCTIVITY_COLS 1
+
+#define READ_SCORE_BITSIZE 32
+#define READ_SCORE_COLS 1
+
+#define RM_BAS_QV_BITSIZE 32
+#define RM_BAS_QV_COLS 1
+
+#define RM_DEL_QV_BITSIZE 32
+#define RM_DEL_QV_COLS 1
+
+#define RM_INS_QV_BITSIZE 32
+#define RM_INS_QV_COLS 1
+
+#define RM_SUB_QV_BITSIZE 32
+#define RM_SUB_QV_COLS 1
+
+/* for passes */
+#define ADAPTER_HIT_AFTER_BITSIZE 8
+#define ADAPTER_HIT_AFTER_COLS 1
+
+#define ADAPTER_HIT_BEFORE_BITSIZE 8
+#define ADAPTER_HIT_BEFORE_COLS 1
+
+#define PASS_DIRECTION_BITSIZE 8
+#define PASS_DIRECTION_COLS 1
+
+#define PASS_NUM_BASES_BITSIZE 32
+#define PASS_NUM_BASES_COLS 1
+
+#define PASS_START_BASE_BITSIZE 32
+#define PASS_START_BASE_COLS 1
+
+typedef struct ld_context
+{
+    const XMLLogger* xml_logger;
+    const KLoadProgressbar *xml_progress;
+    const char *dst_path;
+    uint64_t total_seq_bases;
+    uint64_t total_seq_spots;
+    bool with_progress;
+    bool total_printed;
+    bool cache_content;
+    bool check_src_obj;
+} ld_context;
+
+
+void lctx_init( ld_context * lctx );
+void lctx_free( ld_context * lctx );
+
+
+rc_t check_src_objects( const KDirectory *hdf5_dir,
+                        const char ** groups, 
+                        const char **tables,
+                        bool show_not_found );
+
+typedef struct af_data
+{
+    struct KFile const *f;      /* the fake "file" from a HDF5-dir */
+    struct KArrayFile *af;      /* the arrayfile made from f */
+    rc_t rc;
+    uint8_t dimensionality;     /* how many dimensions the HDF5-dataset has */
+    uint64_t * extents;         /* the extension in every dimension */
+    uint64_t element_bits;      /* how big in bits is the element */
+    void * content;             /* read the whole thing into memory */
+} af_data;
+
+
+void init_array_file( af_data * af );
+void free_array_file( af_data * af );
+
+rc_t open_array_file( const KDirectory *dir, 
+                      const char *name,
+                      af_data * af,
+                      const uint64_t expected_element_bits,
+                      const uint64_t expected_cols,
+                      bool disp_wrong_bitsize,
+                      bool cache_content,
+                      bool supress_err_msg );
+
+rc_t open_element( const KDirectory *hdf5_dir,
+                   af_data *element, 
+                   const char * path,
+                   const char * name, 
+                   const uint64_t expected_element_bits,
+                   const uint64_t expected_cols,
+                   bool disp_wrong_bitsize,
+                   bool cache_content,
+                   bool supress_err_msg );
+
+rc_t array_file_read_dim1( af_data * af, const uint64_t pos,
+                           void *dst, const uint64_t count,
+                           uint64_t *n_read );
+
+rc_t array_file_read_dim2( af_data * af, const uint64_t pos,
+                           void *dst, const uint64_t count,
+                           const uint64_t ext2, uint64_t *n_read );
+
+rc_t add_columns( VCursor * cursor, uint32_t count, int32_t exclude_this,
+                  uint32_t * idx_vector, const char ** names );
+
+bool check_table_count( af_data *tab, const char * name,
+                        const uint64_t expected );
+
+rc_t transfer_bits( VCursor *cursor, const uint32_t col_idx,
+    af_data *src, char * buffer, const uint64_t offset, const uint64_t count,
+    const uint32_t n_bits, const char * explanation );
+
+rc_t vdb_write_value( VCursor *cursor, const uint32_t col_idx,
+                      void * src, const uint32_t n_bits,
+                      const uint32_t n_elem, const char *explanation );
+
+rc_t vdb_write_uint32( VCursor *cursor, const uint32_t col_idx,
+                       uint32_t value, const char *explanation );
+
+rc_t vdb_write_uint16( VCursor *cursor, const uint32_t col_idx,
+                       uint16_t value, const char *explanation );
+
+rc_t vdb_write_uint8( VCursor *cursor, const uint32_t col_idx,
+                      uint8_t value, const char *explanation );
+
+rc_t vdb_write_float32( VCursor *cursor, const uint32_t col_idx,
+                        float value, const char *explanation );
+
+typedef rc_t (*loader_func)( ld_context *lctx,
+                             KDirectory * hdf5_src, VCursor * cursor,
+                             const char * table_name );
+                        
+rc_t prepare_table( VDatabase * database, VCursor ** cursor,
+                    const char * template_name,
+                    const char * table_name );
+
+rc_t load_table( VDatabase * database, KDirectory * hdf5_src, ld_context *lctx,
+                 const char * template_name, const char * table_name,
+                 loader_func func );
+
+rc_t progress_chunk( const KLoadProgressbar ** xml_progress, const uint64_t chunk );
+rc_t progress_step( const KLoadProgressbar * xml_progress );
+
+void print_log_info( const char * info );
+
+rc_t pacbio_make_alias( VDatabase * vdb_db,
+                        const char *existing_obj, const char *alias_to_create );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/pacbio-load/pl-zmw.c b/tools/pacbio-load/pl-zmw.c
new file mode 100644
index 0000000..6322c57
--- /dev/null
+++ b/tools/pacbio-load/pl-zmw.c
@@ -0,0 +1,221 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "pl-zmw.h"
+#include <sysalloc.h>
+
+void zmw_init( zmw_tab *tab )
+{
+    init_array_file( &tab->HoleNumber );
+    init_array_file( &tab->HoleStatus );
+    init_array_file( &tab->HoleXY );
+    init_array_file( &tab->NumEvent );
+    init_array_file( &tab->NumPasses );
+}
+
+
+void zmw_close( zmw_tab *tab )
+{
+    free_array_file( &tab->HoleNumber );
+    free_array_file( &tab->HoleStatus );
+    free_array_file( &tab->HoleXY );
+    free_array_file( &tab->NumEvent );
+    free_array_file( &tab->NumPasses );
+}
+
+
+rc_t zmw_open( const KDirectory *hdf5_dir, zmw_tab *tab,
+               const bool num_passes, const char * path, bool supress_err_msg )
+{
+    rc_t rc;
+
+    zmw_init( tab );
+    rc = open_element( hdf5_dir, &tab->HoleNumber, path, "ZMW/HoleNumber", 
+                       HOLE_NUMBER_BITSIZE, HOLE_NUMBER_COLS, true, false, supress_err_msg );
+    if ( rc == 0 )
+        rc = open_element( hdf5_dir, &tab->HoleStatus, path, "ZMW/HoleStatus", 
+                           HOLE_STATUS_BITSIZE, HOLE_STATUS_COLS, true, false, supress_err_msg );
+    if ( rc == 0 )
+        rc = open_element( hdf5_dir, &tab->HoleXY, path, "ZMW/HoleXY",
+                           HOLE_XY_BITSIZE, HOLE_XY_COLS, true, false, supress_err_msg );
+    if ( rc == 0 )
+        rc = open_element( hdf5_dir, &tab->NumEvent, path, "ZMW/NumEvent",
+                           NUMEVENT_BITSIZE, NUMEVENT_COLS, true, false, supress_err_msg );
+    if ( rc == 0 && num_passes )
+        rc = open_element( hdf5_dir, &tab->NumPasses, path, "Passes/NumPasses", 
+                           NUMPASSES_BITSIZE, NUMPASSES_COLS, true, false, supress_err_msg );
+
+    if ( rc != 0 )
+        zmw_close( tab ); /* releases only initialized elements */
+    return rc;
+}
+
+
+uint64_t zmw_total( zmw_tab *tab )
+{
+    rc_t rc = 0;
+    uint64_t res = 0, pos = 0;
+    uint64_t num_entries = tab->NumEvent.extents[0];
+
+    while( pos < num_entries && rc == 0 )
+    {
+        uint64_t n_read, to_read = ZMW_BLOCK_SIZE;
+        uint32_t d[ ZMW_BLOCK_SIZE ];
+
+        if ( ( pos + to_read ) >= num_entries )
+            to_read = ( num_entries - pos );
+        rc = array_file_read_dim1( &tab->NumEvent, pos, d, to_read, &n_read );
+        if ( rc == 0 )
+        {
+            uint32_t i;
+            pos+=n_read;
+            for ( i = 0; i < n_read; ++i )
+                res += d[ i ];
+        }
+    }
+    return res;
+}
+
+
+rc_t zmw_read_block( zmw_tab *tab, zmw_block * block,
+                     const uint64_t total_spots,
+                     const uint64_t pos,
+                     const bool with_num_passes )
+{
+    rc_t rc;
+    uint64_t to_read = ZMW_BLOCK_SIZE;
+    uint64_t read_NumEvent, read_HoleNumber, read_HoleStatus, 
+             read_HoleXY, read_NumPasses;
+
+    block->n_read = 0;
+    if ( ( pos + to_read ) >= total_spots )
+        to_read = ( total_spots - pos );
+    rc = array_file_read_dim1( &tab->NumEvent, pos, &block->NumEvent[0],
+                                to_read, &read_NumEvent );
+    if ( rc == 0 )
+        rc = array_file_read_dim1( &tab->HoleNumber, pos, &block->HoleNumber[0],
+                                    to_read, &read_HoleNumber );
+    if ( rc == 0 )
+        rc = array_file_read_dim1( &tab->HoleStatus, pos, &block->HoleStatus[0],
+                                    to_read, &read_HoleStatus );
+    if ( rc == 0 )
+        rc = array_file_read_dim2( &tab->HoleXY, pos, &block->HoleXY[0],
+                                   to_read, 2, &read_HoleXY );
+    if ( rc == 0 && with_num_passes )
+        rc = array_file_read_dim1( &tab->NumPasses, pos, &block->NumPasses[0],
+                                    to_read, &read_NumPasses );
+    if ( rc == 0 )
+    {
+        if ( ( read_NumEvent != read_HoleNumber ) ||
+             ( read_NumEvent != read_HoleStatus ) ||
+             ( read_NumEvent != read_HoleXY ) )
+        {
+            rc = RC( rcExe, rcNoTarg, rcAllocating, rcParam, rcInvalid );
+            LOGERR( klogErr, rc, "Diff in NumEvents/HoleNumber/HoleStatus/HoleXY" );
+        }
+        else
+        {
+            if ( with_num_passes && read_NumEvent != read_NumPasses )
+            {
+                rc = RC( rcExe, rcNoTarg, rcAllocating, rcParam, rcInvalid );
+                LOGERR( klogErr, rc, "Diff in NumEvents/NumPasses" );
+            }
+            else
+                block->n_read = read_NumEvent;
+        }
+    }
+    return rc;
+}
+
+
+void zmw_block_row( zmw_block * block, zmw_row * row, 
+                    const uint32_t idx )
+{
+    row->NumEvent    = block->NumEvent[ idx ];
+    row->HoleNumber  = block->HoleNumber[ idx ];
+    row->HoleStatus  = block->HoleStatus[ idx ];
+    row->HoleXY[ 0 ] = block->HoleXY[ idx * 2 ];
+    row->HoleXY[ 1 ] = block->HoleXY[ idx * 2 + 1 ];
+    row->NumPasses   = block->NumPasses[ idx ];
+}
+
+
+
+rc_t zmw_for_each( zmw_tab *tab, const KLoadProgressbar ** xml_progress, VCursor * cursor,
+                   bool with_progress, const uint32_t *col_idx, region_type_mapping *mapping,
+                   const bool with_num_passes, zmw_on_row on_row, void * data )
+{
+    zmw_block block;
+    zmw_row row;
+    pl_progress *progress;
+    uint64_t pos = 0;
+    uint64_t total_rows = tab->NumEvent.extents[0];
+
+    rc_t rc = progress_chunk( xml_progress, total_rows );
+    if ( with_progress )
+        pl_progress_make( &progress, total_rows );
+    row.spot_nr = 0;
+    row.offset = 0;
+    while( pos < total_rows && rc == 0 )
+    {
+        rc = zmw_read_block( tab, &block, total_rows, pos, with_num_passes );
+        if ( rc == 0 )
+        {
+            uint32_t i;
+            for ( i = 0; i < block.n_read && rc == 0; ++i )
+            {
+                rc = Quitting();
+                if ( rc == 0 )
+                {
+                    zmw_block_row( &block, &row, i );
+                    rc = on_row( cursor, col_idx, mapping, &row, data );
+                    if ( rc == 0 )
+                    {
+                        rc = progress_step( *xml_progress );
+                        if ( with_progress )
+                            pl_progress_increment( progress, 1 );
+                    }
+                    row.offset += block.NumEvent[ i ];
+                    row.spot_nr ++;
+                }
+                else
+                    LOGERR( klogErr, rc, "...loading ZMW-table interrupted" );
+            }
+            pos += block.n_read;
+        }
+    }
+
+    if ( with_progress )
+        pl_progress_destroy( progress );
+
+    if ( rc == 0 )
+    {
+        rc = VCursorCommit( cursor );
+        if ( rc != 0 )
+            LOGERR( klogErr, rc, "cannot commit vdb-cursor on ZMW-table" );
+    }
+    return rc;
+}
diff --git a/tools/pacbio-load/pl-zmw.h b/tools/pacbio-load/pl-zmw.h
new file mode 100644
index 0000000..aebf7dd
--- /dev/null
+++ b/tools/pacbio-load/pl-zmw.h
@@ -0,0 +1,105 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+#ifndef _h_pl_zmw_
+#define _h_pl_zmw_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "pl-tools.h"
+#include "pl-progress.h"
+#include "pl-regions.h"
+#include <kapp/main.h>
+#include <klib/rc.h>
+
+typedef struct zmw_tab
+{
+    af_data HoleNumber;
+    af_data HoleStatus;
+    af_data HoleXY;
+    af_data NumEvent;
+    af_data NumPasses;
+} zmw_tab;
+
+
+#define ZMW_BLOCK_SIZE 8192
+
+typedef struct zmw_block
+{
+    uint32_t NumEvent[ ZMW_BLOCK_SIZE ];
+    uint32_t HoleNumber[ ZMW_BLOCK_SIZE ];
+    uint8_t  HoleStatus[ ZMW_BLOCK_SIZE ];
+    uint16_t HoleXY[ ZMW_BLOCK_SIZE * 2 ];
+    uint32_t NumPasses[ ZMW_BLOCK_SIZE ];
+    uint64_t n_read;
+} zmw_block;
+
+
+typedef struct zmw_row
+{
+    uint64_t offset;
+    uint64_t spot_nr;
+
+    uint32_t NumEvent;
+    uint32_t HoleNumber;
+    uint16_t HoleXY[ 2 ];
+    uint8_t  HoleStatus;
+    uint32_t NumPasses;
+} zmw_row;
+
+
+typedef rc_t (*zmw_on_row)( VCursor *cursor, const uint32_t *col_idx,
+                            region_type_mapping *mapping,
+                            zmw_row *row, void * data );
+
+
+void zmw_init( zmw_tab *tab );
+void zmw_close( zmw_tab *tab );
+
+rc_t zmw_open( const KDirectory *hdf5_dir, zmw_tab *tab,
+               const bool num_passes, const char * path, bool supress_err_msg );
+
+uint64_t zmw_total( zmw_tab *tab );
+
+rc_t zmw_read_block( zmw_tab *tab, zmw_block * block,
+                     const uint64_t total_spots,
+                     const uint64_t pos,
+                     const bool with_num_passes );
+
+void zmw_block_row( zmw_block * block, zmw_row * row,
+                    const uint32_t idx );
+
+
+rc_t zmw_for_each( zmw_tab *tab, const KLoadProgressbar ** xml_progress, VCursor * cursor,
+                   bool with_progress, const uint32_t *col_idx, region_type_mapping *mapping,
+                   const bool with_num_passes, zmw_on_row on_row, void * data );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/pacbio-load/verify/ins_nl.pl b/tools/pacbio-load/verify/ins_nl.pl
new file mode 100755
index 0000000..f523787
--- /dev/null
+++ b/tools/pacbio-load/verify/ins_nl.pl
@@ -0,0 +1,15 @@
+#!/usr/bin/perl -w
+
+my $buffer = "";
+my $F_pos;
+my $F_in;
+
+open ( F_pos, $ARGV[1] ) or die "Could not open $ARGV[1]: $!\n";
+open ( F_in, $ARGV[0] ) or die "Could not open $ARGV[0]: $!\n";
+binmode( F_in );
+foreach $line ( <F_pos> )
+{
+    chomp ( $line );  # remove the newline from $line.
+    read ( F_in, $buffer, $line ); # read as many bytes as the line says...
+    print "$buffer\n";
+}
diff --git a/tools/pacbio-load/verify/ins_nl_1.pl b/tools/pacbio-load/verify/ins_nl_1.pl
new file mode 100755
index 0000000..9856a02
--- /dev/null
+++ b/tools/pacbio-load/verify/ins_nl_1.pl
@@ -0,0 +1,30 @@
+#!/usr/bin/perl -w
+
+my $buffer = "";
+my $F_pos;
+my $F_in;
+my $firstvalue;
+
+open ( F_pos, $ARGV[1] ) or die "Could not open $ARGV[1]: $!\n";
+open ( F_in, $ARGV[0] ) or die "Could not open $ARGV[0]: $!\n";
+binmode( F_in );
+foreach $line ( <F_pos> )
+{
+    chomp ( $line );  # remove the newline from $line.
+    read ( F_in, $buffer, $line ); # read as many bytes as the line says...
+    @charbuf = split( //, $buffer ); # split the buffer into an array of char's
+    $firstvalue = 1;
+    foreach ( @charbuf )
+    {
+        if ( $firstvalue == 1 )
+        {
+            printf ( "%d", ord( $_ ) );
+            $firstvalue = 0;
+        }
+        else
+        {
+            printf ( ", %d", ord( $_ ) );
+        }
+    }
+    print "\n";
+}
diff --git a/tools/pacbio-load/verify/ins_nl_2.pl b/tools/pacbio-load/verify/ins_nl_2.pl
new file mode 100755
index 0000000..a78f2fd
--- /dev/null
+++ b/tools/pacbio-load/verify/ins_nl_2.pl
@@ -0,0 +1,24 @@
+#!/usr/bin/perl -w
+
+my $buffer = "";
+my $F_pos;
+my $F_in;
+my $nr;
+my $intval;
+
+open ( F_pos, $ARGV[1] ) or die "Could not open $ARGV[1]: $!\n";
+open ( F_in, $ARGV[0] ) or die "Could not open $ARGV[0]: $!\n";
+binmode( F_in );
+foreach $line ( <F_pos> )
+{
+    chomp ( $line );  # remove the newline from $line.
+    read ( F_in, $buffer, $line * 2 ); # read as many int16's as the line says...
+    for ( $nr = 0; $nr < $line; $nr++ )
+    {
+        if ( $nr > 0 ) { print ", "; }
+        # take 2 bytes (int16) from the buffer
+        $intval = substr( $buffer, $nr * 2, 2 );
+        print ( unpack( S, $intval ) ); # S ... unsigned int16
+    }
+    print "\n";
+}
diff --git a/tools/pacbio-load/verify/ins_nl_4.pl b/tools/pacbio-load/verify/ins_nl_4.pl
new file mode 100755
index 0000000..1f6e9a7
--- /dev/null
+++ b/tools/pacbio-load/verify/ins_nl_4.pl
@@ -0,0 +1,24 @@
+#!/usr/bin/perl -w
+
+my $buffer = "";
+my $F_pos;
+my $F_in;
+my $nr;
+my $intval;
+
+open ( F_pos, $ARGV[1] ) or die "Could not open $ARGV[1]: $!\n";
+open ( F_in, $ARGV[0] ) or die "Could not open $ARGV[0]: $!\n";
+binmode( F_in );
+foreach $line ( <F_pos> )
+{
+    chomp ( $line );  # remove the newline from $line.
+    read ( F_in, $buffer, $line * 4 ); # read as many int32's as the line says...
+    for ( $nr = 0; $nr < $line; $nr++ )
+    {
+        if ( $nr > 0 ) { print ", "; }
+        # take 4 bytes (int32) from the buffer
+        $intval = substr( $buffer, $nr * 4, 4 );
+        print ( unpack( L, $intval ) ); # L ... unsigned int32
+    }
+    print "\n";
+}
diff --git a/tools/pacbio-load/verify/ins_nl_f.pl b/tools/pacbio-load/verify/ins_nl_f.pl
new file mode 100755
index 0000000..85aaa95
--- /dev/null
+++ b/tools/pacbio-load/verify/ins_nl_f.pl
@@ -0,0 +1,27 @@
+#!/usr/bin/perl -w
+
+my $buffer = "";
+my $F_in;
+my $nr;
+my $floatbuf;
+my $floatval;
+
+open ( F_in, $ARGV[0] ) or die "Could not open $ARGV[0]: $!\n";
+binmode( F_in );
+while ( <F_in> )
+{
+    if ( read ( F_in, $buffer, 16 ) == 16 ) # read 16 bytes = 4 x float 32
+    {
+        print "[";
+        for ( $nr = 0; $nr < 4; $nr++ )
+        {
+            if ( $nr > 0 ) { print ", "; }
+            # take 4 bytes (float32) from the buffer
+            $floatbuf = substr( $buffer, $nr * 4, 4 );
+            $floatval = unpack( 'f', $floatbuf ); # f ... float int32-bit
+            print $floatval;
+        }
+        print "]\n";
+    }
+}
+close ( F_in );
diff --git a/tools/prefetch/Makefile b/tools/prefetch/Makefile
index f8e7d0c..301e9ee 100644
--- a/tools/prefetch/Makefile
+++ b/tools/prefetch/Makefile
@@ -25,7 +25,7 @@
 
 default: std
 
-TOP ?= $(shell ../../build/abspath.sh ../..)
+TOP ?= $(abspath ../..)
 MODULE = tools/prefetch
 
 include $(TOP)/build/Makefile.env
@@ -33,7 +33,8 @@ include $(TOP)/build/Makefile.env
 INT_TOOLS = \
 
 EXT_TOOLS = \
-	prefetch
+	prefetch \
+#	aget
 
 ALL_TOOLS = \
 	$(INT_TOOLS) \
@@ -91,10 +92,23 @@ PREFETCH_OBJ = \
 
 PREFETCH_LIB = \
 	-lkapp \
-	-lncbi-vdb \
-	-lxml2 \
+	-sncbi-vdb \
 	-lm
 
 
 $(BINDIR)/prefetch: $(PREFETCH_OBJ)
 	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(PREFETCH_LIB)
+
+#-------------------------------------------------------------------------------
+# aget
+#
+GET_SRC = \
+	aget \
+	getAscp
+
+GET_OBJ = \
+	$(addsuffix .$(OBJX),$(GET_SRC))
+
+$(BINDIR)/aget: $(GET_OBJ)
+	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(PREFETCH_LIB)
+
diff --git a/tools/prefetch/prefetch.c b/tools/prefetch/prefetch.c
index 3537943..5219a27 100644
--- a/tools/prefetch/prefetch.c
+++ b/tools/prefetch/prefetch.c
@@ -46,6 +46,7 @@
 
 #include <kns/ascp.h> /* ascp_locate */
 #include <kns/manager.h>
+#include <kns/kns-mgr-priv.h>
 #include <kns/http.h>
 
 #include <kfs/file.h> /* KFile */
@@ -272,7 +273,7 @@ rc_t _KFileOpenRemote(const KFile **self, KNSManager *kns, const char *path)
     if (*self != NULL) {
         return 0;
     }
-    rc = KNSManagerMakeHttpFile(kns, self, NULL, 0x01010000, path);
+    rc = KNSManagerMakeReliableHttpFile(kns, self, NULL, 0x01010000, path);
     return rc;
 }
 
@@ -321,7 +322,7 @@ static rc_t _KDirectoryMkTmpName(const KDirectory *self,
                 "s=%s", prefix->addr));
             return rc;
         }
-        if (KDirectoryPathType(self, out) == kptNotFound) {
+        if (KDirectoryPathType(self, "%s", out) == kptNotFound) {
             break;
         }
         if (++i > 999) {
@@ -373,9 +374,9 @@ rc_t _KDirectoryCleanCache(KDirectory *self, const String *local)
         DISP_RC2(rc, "string_printf(.cache)", local->addr);
     }
 
-    if (rc == 0 && KDirectoryPathType(self, cache) != kptNotFound) {
+    if (rc == 0 && KDirectoryPathType(self, "%s", cache) != kptNotFound) {
         STSMSG(STS_DBG, ("removing %s", cache));
-        rc = KDirectoryRemove(self, false, cache);
+        rc = KDirectoryRemove(self, false, "%s", cache);
     }
 
     return rc;
@@ -417,19 +418,19 @@ static rc_t _KDirectoryClean(KDirectory *self, const String *cache,
         tmpPfxLen = strlen(tmpPfx);
     }
 
-    if (tmp != NULL && KDirectoryPathType(self, tmp) != kptNotFound) {
+    if (tmp != NULL && KDirectoryPathType(self, "%s", tmp) != kptNotFound) {
         rc_t rc3 = 0;
         STSMSG(STS_DBG, ("removing %s", tmp));
-        rc3 = KDirectoryRemove(self, false, tmp);
+        rc3 = KDirectoryRemove(self, false, "%s", tmp);
         if (rc2 == 0 && rc3 != 0) {
             rc2 = rc3;
         }
     }
 
-    if (rmSelf && KDirectoryPathType(self, cache->addr) != kptNotFound) {
+    if (rmSelf && KDirectoryPathType(self, "%s", cache->addr) != kptNotFound) {
         rc_t rc3 = 0;
         STSMSG(STS_DBG, ("removing %s", cache->addr));
-        rc3 = KDirectoryRemove(self, false, cache->addr);
+        rc3 = KDirectoryRemove(self, false, "%s", cache->addr);
         if (rc2 == 0 && rc3 != 0) {
             rc2 = rc3;
         }
@@ -440,7 +441,7 @@ static rc_t _KDirectoryClean(KDirectory *self, const String *cache,
         uint32_t i = 0;
         KNamelist *list = NULL;
         STSMSG(STS_DBG, ("listing %s for old temporary files", dir));
-        rc = KDirectoryList(self, &list, NULL, NULL, dir);
+        rc = KDirectoryList(self, &list, NULL, NULL, "%s", dir);
         DISP_RC2(rc, "KDirectoryList", dir);
 
         if (rc == 0) {
@@ -470,10 +471,10 @@ static rc_t _KDirectoryClean(KDirectory *self, const String *cache,
         RELEASE(KNamelist, list);
     }
 
-    if (lock != NULL && KDirectoryPathType(self, lock) != kptNotFound) {
+    if (lock != NULL && KDirectoryPathType(self, "%s", lock) != kptNotFound) {
         rc_t rc3 = 0;
         STSMSG(STS_DBG, ("removing %s", lock));
-        rc3 = KDirectoryRemove(self, false, lock);
+        rc3 = KDirectoryRemove(self, false, "%s", lock);
         if (rc2 == 0 && rc3 != 0) {
             rc2 = rc3;
         }
@@ -797,7 +798,7 @@ static rc_t ResolvedLocal(const Resolved *self,
     rc = VPathReadPath(self->local.path, path, sizeof path, NULL);
     DISP_RC(rc, "VPathReadPath");
 
-    if (rc == 0 && KDirectoryPathType(dir, path) != kptFile) {
+    if (rc == 0 && KDirectoryPathType(dir, "%s", path) != kptFile) {
         if (force == eForceNo) {
             STSMSG(STS_TOP,
                 ("%s (not a file) is found locally: consider it complete",
@@ -823,7 +824,7 @@ static rc_t ResolvedLocal(const Resolved *self,
     }
 
     if (rc == 0) {
-        rc = KDirectoryOpenFileRead(dir, &local, path);
+        rc = KDirectoryOpenFileRead(dir, &local, "%s", path);
         DISP_RC2(rc, "KDirectoryOpenFileRead", path);
     }
 
@@ -945,7 +946,7 @@ static rc_t MainDownloadFile(Resolved *self,
     if (rc == 0) {
         STSMSG(STS_DBG, ("creating %s", to));
         rc = KDirectoryCreateFile(main->dir, &out,
-            false, 0664, kcmInit | kcmParents, to);
+                                  false, 0664, kcmInit | kcmParents, "%s", to);
         DISP_RC2(rc, "Cannot OpenFileWrite", to);
     }
 
@@ -1048,10 +1049,10 @@ static rc_t MainDownload(Resolved *self, Main *main) {
         rc = _KDirectoryMkTmpName(main->dir, self->cache, tmp, sizeof tmp);
     }
 
-    if (KDirectoryPathType(main->dir, lock) != kptNotFound) {
+    if (KDirectoryPathType(main->dir, "%s", lock) != kptNotFound) {
         if (main->force != eForceYES) {
             KTime_t date = 0;
-            rc = KDirectoryDate(main->dir, &date, lock);
+            rc = KDirectoryDate(main->dir, &date, "%s", lock);
             if (rc == 0) {
                 time_t t = time(NULL) - date;
                 if (t < 60 * 60 * 24) { /* 24 hours */
@@ -1085,7 +1086,7 @@ static rc_t MainDownload(Resolved *self, Main *main) {
     if (rc == 0) {
         STSMSG(STS_DBG, ("creating %s", lock));
         rc = KDirectoryCreateFile(main->dir, &flock,
-            false, 0664, kcmInit | kcmParents, lock);
+                                  false, 0664, kcmInit | kcmParents, "%s", lock);
         DISP_RC2(rc, "Cannot OpenFileWrite", lock);
     }
 
@@ -1174,11 +1175,11 @@ static rc_t MainDependenciesList(const Main *self,
 
     assert(self && path && deps);
 
-    if ((VDBManagerPathType(self->mgr, path) & ~kptAlias) != kptDatabase) {
+    if ((VDBManagerPathType(self->mgr, "%s", path) & ~kptAlias) != kptDatabase) {
         return 0;
     }
 
-    rc = VDBManagerOpenDBRead(self->mgr, &db, NULL, path);
+    rc = VDBManagerOpenDBRead(self->mgr, &db, NULL, "%s", path);
     if (rc != 0) {
         if (rc == SILENT_RC(rcDB, rcMgr, rcOpening, rcDatabase, rcIncorrect)) {
             isDb = false;
@@ -1265,7 +1266,7 @@ static rc_t _ItemSetResolverAndAssessionInResolved(Item *item,
     resolved = &item->resolved;
 
     if (item->desc != NULL) {
-        rc = VFSManagerMakePath(vfs, &resolved->accession, item->desc);
+        rc = VFSManagerMakePath(vfs, &resolved->accession, "%s", item->desc);
         DISP_RC2(rc, "VFSManagerMakePath", item->desc);
         if (rc == 0) {
             rc = VResolverAddRef(resolver);
@@ -1442,14 +1443,14 @@ static rc_t ItemInitResolved(Item *self, VResolver *resolver,
     
     assert(resolved->type != eRunTypeUnknown);
 
-    type = KDirectoryPathType(dir, self->desc) & ~kptAlias;
+    type = KDirectoryPathType(dir, "%s", self->desc) & ~kptAlias;
     if (type == kptFile || type == kptDir) {
         resolved->path = self->desc;
         resolved->existing = true;
         if (resolved->type != eRunTypeDownload) {
             uint64_t s = -1;
             const KFile *f = NULL;
-            rc = KDirectoryOpenFileRead(dir, &f, self->desc);
+            rc = KDirectoryOpenFileRead(dir, &f, "%s", self->desc);
             if (rc == 0) {
                 rc = KFileSize(f, &s);
             }
@@ -1546,6 +1547,8 @@ static rc_t ItemDownload(Item *item) {
     assert(self->type);
 
     if (rc == 0) {
+        bool skip = false;
+
         if (self->existing) {
             self->path = item->desc;
             return rc;
@@ -1555,17 +1558,23 @@ static rc_t ItemDownload(Item *item) {
             STSMSG(STS_TOP,
                ("%d) '%s' (%,zu KB) is smaller than minimum allowed: skipped\n",
                 n, self->name, self->remoteSz / 1024));
-            return rc;
+            skip = true;
         }
-
-        if (self->oversized) {
+        else if (self->oversized) {
             STSMSG(STS_TOP,
                 ("%d) '%s' (%,zu KB) is larger than maximum allowed: skipped\n",
                 n, self->name, self->remoteSz / 1024));
-            return rc;
+            skip = true;
         }
 
-        rc = ResolvedLocal(self, item->main->dir, &isLocal, item->main->force);
+        rc = ResolvedLocal(self, item->main->dir, &isLocal,
+            skip ? eForceNo : item->main->force);
+
+        if (rc == 0) {
+            if (skip && !isLocal) {
+                return rc;
+            }
+        }
     }
 
     if (rc == 0) {
@@ -1678,13 +1687,13 @@ static rc_t ItemPostDownload(Item *item, int32_t row) {
         }
         else if (resolved->oversized) {
             item->main->oversized = true;
-            return rc;
         }
         else if (resolved->undersized) {
             item->main->undersized = true;
-            return rc;
         }
-        rc = MainDependenciesList(item->main, resolved->path, &deps);
+        if (resolved->path != NULL) {
+            rc = MainDependenciesList(item->main, resolved->path, &deps);
+        }
     }
 
     /* resolve dependencies (refseqs) */
@@ -1793,7 +1802,7 @@ rc_t IteratorInit(Iterator *self, const char *obj, const Main *main)
 
 #ifdef _DEBUGGING
     if (obj == NULL && main->textkart) {
-        type = KDirectoryPathType(main->dir, main->textkart);
+        type = KDirectoryPathType(main->dir, "%s", main->textkart);
         if ((type & ~kptAlias) != kptFile) {
             rc = RC(rcExe, rcFile, rcOpening, rcFile, rcNotFound);
             DISP_RC(rc, main->textkart);
@@ -1815,9 +1824,9 @@ rc_t IteratorInit(Iterator *self, const char *obj, const Main *main)
 #endif
 
     assert(obj);
-    type = KDirectoryPathType(main->dir, obj);
+    type = KDirectoryPathType(main->dir, "%s", obj);
     if ((type & ~kptAlias) == kptFile) {
-        type = VDBManagerPathType(main->mgr, obj);
+        type = VDBManagerPathType(main->mgr, "%s", obj);
         if ((type & ~kptAlias) == kptFile) {
             rc = KartMake(main->dir, obj, &self->kart, &self->isKart);
             if (!self->isKart) {
@@ -2641,15 +2650,22 @@ static rc_t MainRun(Main *self, const char *arg, const char *realArg) {
             }
                 
             for (n = 1; ; ++n) {
+                rc_t rc2 = 0;
                 rc_t rc3 = 0;
                 bool done = false;
                 Item *item = NULL;
-                rc = Quitting();
-                if (rc != 0) {
+                rc_t rcq = Quitting();
+                if (rcq != 0) {
+                    if (rc == 0) {
+                        rc = rcq;
+                    }
                     break;
                 }
-                rc = IteratorNext(&it, &item, &done);
-                if (rc != 0 || done) {
+                rc2 = IteratorNext(&it, &item, &done);
+                if (rc2 != 0 || done) {
+                    if (rc == 0 && rc2 != 0) {
+                        rc = rc2;
+                    }
                     break;
                 }
                 done = ! NumIteratorNext(&nit, n);
@@ -2674,7 +2690,9 @@ static rc_t MainRun(Main *self, const char *arg, const char *realArg) {
                ("%d) '%s' (%,zu KB) is smaller than minimum allowed: skipped\n",
                 n, item->resolved.name, item->resolved.remoteSz / 1024));
                         }
-                        else if (item->resolved.oversized) {
+                        else if (item->resolved.oversized &&
+                             type == eRunTypeGetSize)
+                        {
                             STSMSG(STS_TOP,
                 ("%d) '%s' (%,zu KB) is larger than maximum allowed: skipped\n",
                 n, item->resolved.name, item->resolved.remoteSz / 1024));
@@ -2774,7 +2792,10 @@ rc_t CC KMain(int argc, char *argv[]) {
             rc_t rc2 = ArgsParamValue(pars.args, i, &obj);
             DISP_RC(rc2, "ArgsParamValue");
             if (rc2 == 0) {
-                rc = MainRun(&pars, obj, obj);
+                rc2 = MainRun(&pars, obj, obj);
+                if (rc2 != 0 && rc == 0) {
+                    rc = rc2;
+                }
             }
         }
 
diff --git a/tools/prefetch/prefetch.vers b/tools/prefetch/prefetch.vers
index cc6c9a4..8e8299d 100644
--- a/tools/prefetch/prefetch.vers
+++ b/tools/prefetch/prefetch.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/prefetch/prefetch.vers.h b/tools/prefetch/prefetch.vers.h
new file mode 100644
index 0000000..10ae6d4
--- /dev/null
+++ b/tools/prefetch/prefetch.vers.h
@@ -0,0 +1 @@
+#define PREFETCH_VERS 0x02040002
diff --git a/tools/qual-recal/Makefile b/tools/qual-recal/Makefile
new file mode 100644
index 0000000..cfc2d61
--- /dev/null
+++ b/tools/qual-recal/Makefile
@@ -0,0 +1,101 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: std
+
+TOP ?= $(abspath ../..)
+MODULE = tools/qual-recal
+
+include $(TOP)/build/Makefile.env
+
+INT_TOOLS = \
+	qual-recal
+
+EXT_TOOLS =
+
+ALL_TOOLS = \
+	$(INT_TOOLS) \
+	$(EXT_TOOLS)
+
+#-------------------------------------------------------------------------------
+# outer targets
+#
+all std: vers-includes
+	@ $(MAKE_CMD) $(TARGDIR)/std
+
+$(ALL_TOOLS): vers-includes
+	@ $(MAKE_CMD) $(BINDIR)/$@
+
+.PHONY: all std $(ALL_TOOLS)
+
+#-------------------------------------------------------------------------------
+# std
+#
+$(TARGDIR)/std: \
+	$(addprefix $(BINDIR)/,$(ALL_TOOLS))
+
+.PHONY: $(TARGDIR)/std
+
+#-------------------------------------------------------------------------------
+# vers-includes
+#
+$(TARGDIR)/vers-includes: $(addsuffix .vers.h,$(EXT_TOOLS))
+
+.PHONY: $(TARGDIR)/vers-includes
+
+#-------------------------------------------------------------------------------
+# clean
+#
+clean: stdclean
+
+.PHONY: clean
+
+#-------------------------------------------------------------------------------
+# align-info
+#
+QUAL_RECAL_SRC = \
+	qual-recal
+
+QUAL_RECAL_OBJ = \
+	$(addsuffix .$(OBJX),$(QUAL_RECAL_SRC))
+
+QUAL_RECAL_LIB = \
+	-lkapp \
+	-lwvdb \
+	-lwkdb \
+	$(UPDATE_SCHEMA_LIBS) \
+	-lksrch \
+	-lkproc \
+	-lvfs \
+	-lkrypto \
+	-lkfg \
+	-lkfs \
+	-lklib \
+	-lm
+
+
+$(BINDIR)/qual-recal: $(QUAL_RECAL_OBJ)
+	$(LD) --exe -o $@ $^ $(QUAL_RECAL_LIB)
+
diff --git a/tools/qual-recal/make_histo_data.sh b/tools/qual-recal/make_histo_data.sh
new file mode 100644
index 0000000..886cf4b
--- /dev/null
+++ b/tools/qual-recal/make_histo_data.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+echo qual-recalib-stat -p -o qstat.${$}.txt -m file -g 8 "${@}" || exit ${?};
+qual-recalib-stat -p -o qstat.${$}.txt -m file -g 8 "${@}" || exit ${?};
+tail -n +2 qstat.${$}.txt > qstat.${$}.headless.txt
+(echo -n "SPOTGROUPS: " ; cut -f 1 qstat.${$}.headless.txt | sort    | uniq | wc -l)  >qstat.${$}.hdr
+(echo -n "MAX_POS: "    ; cut -f 2 qstat.${$}.headless.txt | sort -n | tail -n 1   ) >>qstat.${$}.hdr
+(echo -n "MAX_READ: "   ; cut -f 3 qstat.${$}.headless.txt | sort -n | tail -n 1   ) >>qstat.${$}.hdr
+(cat qstat.${$}.hdr; echo ""; cat qstat.${$}.headless.txt) >qstat.${$}.hdr.text
+rm qstat.${$}.headless.txt qstat.${$}.hdr
+echo qual-recal -s qstat.${$}.hdr.text "${1}"
+qual-recal -s qstat.${$}.hdr.text "${1}"
diff --git a/tools/qual-recal/qual-recal.c b/tools/qual-recal/qual-recal.c
new file mode 100644
index 0000000..e10b250
--- /dev/null
+++ b/tools/qual-recal/qual-recal.c
@@ -0,0 +1,654 @@
+/*==============================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ *==============================================================================
+ */
+
+#include <vdb/manager.h> /* VDBManager */
+#include <vdb/database.h> /* VDatabase */
+#include <vdb/table.h> /* VTable */
+#include <vdb/schema.h> /* VSchema */
+#include <vdb/cursor.h> /* VCursor */
+#include <insdc/insdc.h>
+
+#include <kdb/meta.h>
+
+#include <kapp/main.h>
+
+#include <kfs/file.h>
+#include <klib/out.h> /* OUTMSG */
+#include <klib/log.h> /* (void)LOGERR */
+#include <klib/debug.h> /* DBGMSG */
+#include <klib/rc.h> /* RC */
+
+#include <assert.h>
+#include <stdlib.h> /* free */
+#include <string.h> /* strcmp */
+#include <stdio.h>
+#include <math.h>
+
+#define MIN_HITS (10000)
+
+struct Params {
+    char const *statPath;
+    char const *dbPath;
+} static Params;
+
+typedef struct stats_t {
+    unsigned hits;
+    unsigned miss;
+} stats_t;
+
+typedef struct {
+    stats_t total;
+    struct {
+        stats_t total;
+        struct {
+            stats_t total;
+            struct {
+                stats_t hp_r[8];
+                stats_t total;
+            } gc_c[8];
+        } dmer[25];
+        unsigned qual[41];
+        unsigned rcal[41];
+        unsigned diff[82];
+    } read[2];
+} read_node_t;
+
+unsigned qurc[41][41];
+
+typedef struct {
+    char *spot_group;
+    unsigned positions;
+    unsigned reads;
+    read_node_t position[1];
+} top_node_t;
+
+static unsigned spot_groups;
+static top_node_t **stats;
+
+static top_node_t *alloc_top_node_t(unsigned positions)
+{
+    top_node_t *self = calloc(1, sizeof(*self) - sizeof(self->position) + positions * sizeof(self->position[0]));
+    return self;
+}
+
+static top_node_t *new_top_node_t(unsigned positions, unsigned reads, char const sgnm[])
+{
+    top_node_t *self = alloc_top_node_t(positions);
+    if (self) {
+        self->spot_group = strdup(sgnm);
+        self->positions = positions;
+        self->reads = reads;
+    }
+    return self;
+}
+
+unsigned base2number(int base)
+{
+    switch (base) {
+    case 'A':
+        return 0;
+    case 'C':
+        return 1;
+    case 'G':
+        return 2;
+    case 'T':
+        return 3;
+    default:
+        return 4;
+    }
+}
+
+static rc_t LoadStats(KFile const *kf)
+{
+    char buf[16 * 4096];
+    unsigned bsz = 0;
+    uint64_t fpos = 0;
+    bool inheader = true;
+    unsigned reads;
+    unsigned positions;
+    unsigned nsgrp;
+    unsigned line = 1;
+
+    for ( ; ; ) {
+        unsigned cur = 0;
+        unsigned len;
+
+        {
+            size_t nread;
+            rc_t rc = KFileRead(kf, fpos, &buf[bsz], sizeof(buf) - bsz, &nread);
+            
+            if (rc) return rc;
+            if (nread == 0)
+                return 0;
+            bsz += nread;
+            fpos += nread;
+        }
+        do {
+            for (len = 0; len + cur < bsz; ++len) {
+                if (buf[cur + len] == '\n') {
+                    buf[cur + len] = '\0';
+                    ++len;
+                    ++line;
+                    goto PROCESS_LINE;
+                }
+            }
+            memmove(buf, &buf[cur], bsz -= cur);
+            break;
+        PROCESS_LINE:
+            if (inheader) {
+                unsigned val;
+
+                if (buf[cur] == '\0')
+                    inheader = false;
+                else if (sscanf(buf + cur, "MAX_POS: %u", &val) == 1)
+                    positions = val + 1;
+                else if (sscanf(buf + cur, "SPOTGROUPS: %u", &val) == 1) {
+                    spot_groups = val;
+                    stats = malloc(spot_groups * sizeof(stats[0]));
+                    if (stats == NULL)
+                        return RC(rcApp, rcFile, rcReading, rcMemory, rcExhausted);
+                    nsgrp = 0;
+                }
+                else if (sscanf(buf + cur, "MAX_READ: %u", &val) == 1)
+                    reads = val + 1;
+                else
+                    return RC(rcApp, rcFile, rcReading, rcData, rcInvalid);
+            }
+            else {
+                unsigned hits;
+                unsigned miss;
+                unsigned bpos;
+                unsigned read;
+                unsigned hp_r;
+                unsigned gc_c;
+                unsigned dmer;
+                char dimer[2];
+                char sgnm[256];
+                int i;
+                
+                i = sscanf(buf + cur, "%256s %u %u %2s %u %u %*u %*u %u %u",
+                           sgnm,
+                           &bpos,
+                           &read,
+                           dimer,
+                           &gc_c,
+                           &hp_r,
+                           &hits,
+                           &miss
+                           );
+                
+                if (i != 8) {
+                    fprintf(stderr, "error at line %u: %s\n", line, buf + cur);
+                    return RC(rcApp, rcFile, rcReading, rcData, rcInvalid);
+                }
+                dmer = base2number(dimer[0]) * 5 + base2number(dimer[1]);
+                if (nsgrp == 0) {
+                    fprintf(stderr, "spot group: %s\n", sgnm);
+                    stats[0] = new_top_node_t(positions, reads, sgnm);
+                    if (stats[0] == NULL)
+                        return RC(rcApp, rcFile, rcReading, rcMemory, rcExhausted);
+                    ++nsgrp;
+                }
+                else {
+                    if (strcmp(stats[nsgrp-1]->spot_group, sgnm) != 0) {
+                        fprintf(stderr, "spot group: %s\n", sgnm);
+                        if (nsgrp == spot_groups)
+                            return RC(rcApp, rcFile, rcReading, rcData, rcInvalid);
+                        stats[nsgrp] = new_top_node_t(positions, reads, sgnm);
+                        if (stats[nsgrp] == NULL)
+                            return RC(rcApp, rcFile, rcReading, rcMemory, rcExhausted);
+                        ++nsgrp;
+                    }
+                }
+                assert(bpos < positions);
+                assert(read < reads);
+                assert(gc_c < 8);
+                assert(hp_r < 8);
+
+                stats[nsgrp-1]->position[bpos].total.hits += hits;
+                stats[nsgrp-1]->position[bpos].total.miss += miss;
+                stats[nsgrp-1]->position[bpos].read[read].total.hits += hits;
+                stats[nsgrp-1]->position[bpos].read[read].total.miss += miss;
+                stats[nsgrp-1]->position[bpos].read[read].dmer[dmer].total.hits += hits;
+                stats[nsgrp-1]->position[bpos].read[read].dmer[dmer].total.miss += miss;
+                stats[nsgrp-1]->position[bpos].read[read].dmer[dmer].gc_c[gc_c].total.hits += hits;
+                stats[nsgrp-1]->position[bpos].read[read].dmer[dmer].gc_c[gc_c].total.miss += miss;
+                stats[nsgrp-1]->position[bpos].read[read].dmer[dmer].gc_c[gc_c].hp_r[hp_r].hits += hits;
+                stats[nsgrp-1]->position[bpos].read[read].dmer[dmer].gc_c[gc_c].hp_r[hp_r].miss += miss;
+            }
+            cur += len;
+        } while (1);
+    }
+}
+
+static rc_t compute(char const sgnm[], char const seqbin[], uint8_t const qual[], unsigned read, unsigned len)
+{
+    unsigned last_base = 4;
+    unsigned i;
+    unsigned hp_r = 0;
+    unsigned gc_c = 0;
+    static unsigned sgrp = 0;
+
+    if (strcmp(stats[sgrp]->spot_group, sgnm) != 0) {
+        for (i = 1; i != spot_groups; ++i) {
+            if (strcmp(stats[(i + sgrp)%spot_groups]->spot_group, sgnm) == 0) {
+                sgrp = (i + sgrp)%spot_groups;
+                break;
+            }
+        }
+        if (sgrp == spot_groups)
+            return RC(rcApp, rcTable, rcReading, rcData, rcInvalid);
+    }
+    assert(len <= stats[sgrp]->positions);
+    assert(read < stats[sgrp]->reads);
+
+    for (i = 0; i != len; ++i) {
+        unsigned base = base2number(seqbin[i]);
+        unsigned dmer = last_base * 5 + base;
+        unsigned hits = stats[sgrp]->position[i].read[read].total.hits;
+        unsigned miss = stats[sgrp]->position[i].read[read].total.miss;
+        unsigned recalQ;
+        int diff;
+
+#if 1
+        if (last_base == base)
+            ++hp_r;
+        else
+            hp_r = 0;
+
+        if (i >= 8 && (seqbin[i - 8] == 'G' || seqbin[i - 8] == 'C')) {
+            assert(gc_c > 0);
+            --gc_c;
+        }
+        assert(gc_c < 8);
+
+        if (stats[sgrp]->position[i].read[read].dmer[dmer].total.hits >= MIN_HITS) {
+            hits = stats[sgrp]->position[i].read[read].dmer[dmer].total.hits;
+            miss = stats[sgrp]->position[i].read[read].dmer[dmer].total.miss;
+
+            if (stats[sgrp]->position[i].read[read].dmer[dmer].gc_c[gc_c].total.hits >= MIN_HITS) {
+                unsigned const hpr = hp_r > 7 ? 7 : hp_r;
+
+                hits = stats[sgrp]->position[i].read[read].dmer[dmer].gc_c[gc_c].total.hits;
+                miss = stats[sgrp]->position[i].read[read].dmer[dmer].gc_c[gc_c].total.miss;
+
+                if (stats[sgrp]->position[i].read[read].dmer[dmer].gc_c[gc_c].hp_r[hpr].hits >= MIN_HITS) {
+                    hits = stats[sgrp]->position[i].read[read].dmer[dmer].gc_c[gc_c].hp_r[hpr].hits;
+                    miss = stats[sgrp]->position[i].read[read].dmer[dmer].gc_c[gc_c].hp_r[hpr].miss;
+                }
+            }
+        }
+        if (seqbin[i] == 'G' || seqbin[i] == 'C')
+            ++gc_c;
+        last_base = base;
+#endif
+        recalQ = floor(-10.0*log10(miss/(double)hits));
+
+        diff = recalQ - qual[i];
+        if (qual[i] == 2)
+            diff = 41;
+        if (diff < -40)
+            diff = -40;
+        else if (diff > 40)
+            diff = 40;
+
+        if (recalQ > 40)
+            recalQ = 40;
+
+        ++stats[sgrp]->position[i].read[read].qual[qual[i]];
+        ++stats[sgrp]->position[i].read[read].rcal[recalQ];
+        ++stats[sgrp]->position[i].read[read].diff[diff + 40];
+        ++qurc[qual[i]][recalQ];
+    }
+    return 0;
+}
+
+static void print(void)
+{
+    FILE *Q = fopen("qual.histo.txt", "w");
+    if (Q) {
+        FILE *R = fopen("rcal.histo.txt", "w");
+        if (R) {
+            FILE *D = fopen("diff.histo.txt", "w");
+            if (D) {
+                unsigned sg;
+
+                for (sg = 0; sg < spot_groups; ++sg) {
+                    unsigned read;
+
+                    for (read = 0; read < stats[sg]->reads; ++read) {
+                        unsigned pos;
+
+                        for (pos = 0; pos < stats[sg]->positions; ++pos) {
+                            unsigned i;
+
+                            for (i = 0; i < 41; ++i) {
+                                if (stats[sg]->position[pos].read[read].qual[i])
+                                    fprintf(Q, "%s\t%u\t%u\t%u\t%u\n", stats[sg]->spot_group, read, pos, i, stats[sg]->position[pos].read[read].qual[i]);
+                                if (stats[sg]->position[pos].read[read].rcal[i])
+                                    fprintf(R, "%s\t%u\t%u\t%u\t%u\n", stats[sg]->spot_group, read, pos, i, stats[sg]->position[pos].read[read].rcal[i]);
+                            }
+                            for (i = 0; i < 81; ++i) {
+                                if (stats[sg]->position[pos].read[read].diff[i])
+                                    fprintf(D, "%s\t%u\t%u\t%i\t%u\n", stats[sg]->spot_group, read, pos, (int)i - 40, stats[sg]->position[pos].read[read].diff[i]);
+                            }
+                            if (stats[sg]->position[pos].read[read].diff[81])
+                                fprintf(D, "%s\t%u\t%u\t-128\t%u\n", stats[sg]->spot_group, read, pos, stats[sg]->position[pos].read[read].diff[81]);
+                        }
+                    }
+                }
+                fclose(D);
+            }
+            fclose(R);
+        }
+        fclose(Q);
+    }
+    Q = fopen("qurc.histo.txt", "w");
+    if (Q) {
+        unsigned q, r;
+
+        for (q = 0; q != 41; ++q) {
+            for (r = 0; r != 41; ++r) {
+                if (qurc[q][r])
+                    fprintf(Q, "%u\t%u\t%u\n", q, r, qurc[q][r]);
+            }
+        }
+        fclose(Q);
+    }
+}
+
+static rc_t process(VTable *dst, VTable const *src)
+{
+    VCursor const *curs;
+    rc_t rc = VTableCreateCursorRead(src, &curs);
+
+    if (rc == 0) {
+        uint32_t idx[5];
+        
+        while (1) {
+            rc = VCursorAddColumn(curs, idx + 0, "SPOT_GROUP"); if (rc) break;
+            rc = VCursorAddColumn(curs, idx + 1, "(INSDC:dna:text)READ"); if (rc) break;
+            rc = VCursorAddColumn(curs, idx + 2, "QUALITY"); if (rc) break;
+            rc = VCursorAddColumn(curs, idx + 3, "(INSDC:coord:len)READ_LEN"); if (rc) break;
+            rc = VCursorAddColumn(curs, idx + 4, "(INSDC:coord:zero)READ_START"); if (rc) break;
+            rc = VCursorOpen(curs);
+            break;
+        }
+        while (rc == 0) {
+            rc = VCursorOpenRow(curs);
+            while (rc == 0) {
+                char sgnm[256];
+                char const *read;
+                unsigned readlen;
+                unsigned nreads;
+                unsigned i;
+                uint8_t const *qual;
+                INSDC_coord_len const *read_len;
+                INSDC_coord_zero const *read_start;
+                uint32_t bits;
+                uint32_t boff;
+                uint32_t rlen;
+
+                rc = VCursorRead(curs, idx[0], 8, sgnm, 256, &rlen); if (rc) break;
+                sgnm[rlen] = '\0';
+
+                rc = VCursorCellData(curs, idx[1], &bits, (void const **)&read, &boff, &rlen); if (rc) break;
+                readlen = rlen;
+                assert(bits == 8);
+                assert(boff == 0);
+
+                rc = VCursorCellData(curs, idx[2], &bits, (void const **)&qual, &boff, &rlen); if (rc) break;
+                assert(readlen == rlen);
+                assert(bits == 8);
+                assert(boff == 0);
+
+                rc = VCursorCellData(curs, idx[3], &bits, (void const **)&read_len, &boff, &rlen); if (rc) break;
+                nreads = rlen;
+                assert(bits == 32);
+                assert(boff == 0);
+
+                rc = VCursorCellData(curs, idx[4], &bits, (void const **)&read_start, &boff, &rlen); if (rc) break;
+                assert(nreads == rlen);
+                assert(bits == 32);
+                assert(boff == 0);
+
+                for (i = 0; i != nreads && rc == 0; ++i) {
+                    rc = compute(sgnm, read + read_start[i], qual + read_start[i], i, read_len[i]);
+                }
+                break;
+            }
+            if (GetRCState(rc) == rcNotFound && GetRCObject(rc) == rcRow) {
+                print();
+                rc = 0;
+                break;
+            }
+            rc = VCursorCloseRow(curs);
+        }
+        VCursorRelease(curs);
+    }
+    return rc;
+}
+
+static rc_t ModifySchema(VSchema *schema)
+{
+    VSchemaRuntimeTable *tschema;
+    rc_t rc = VSchemaMakeRuntimeTable(schema, &tschema, "NCBI:align:tbl:seq:qc", NULL);
+    
+    if (rc == 0) {
+        rc = VSchemaRuntimeTableAddIntegerColumn(tschema, 16, true, "DELTA_Q");
+        if (rc == 0) {
+            rc = VSchemaRuntimeTableCommit(tschema);
+        }
+        VSchemaRuntimeTableClose(tschema);
+    }
+    return rc;
+}
+
+static rc_t OpenDatabaseAndTable(VTable **tbl, VDatabase const **db)
+{
+    VDBManager *vdb;
+    rc_t rc = VDBManagerMakeUpdate(&vdb, NULL);
+
+    if (rc == 0) {
+        rc = VDBManagerOpenDBRead(vdb, db, NULL, "%s", Params.dbPath);
+        if (rc == 0) {
+#if 0
+            VSchema *schema;
+            
+            rc = VDBManagerMakeSchema(vdb, &schema);
+            if (rc == 0) {
+                rc = VSchemaParseFile(schema, "align/align.vschema");
+                if (rc == 0) {
+                    rc = ModifySchema(schema);
+                    if (rc == 0) {
+                        rc = VDBManagerCreateTable(vdb, tbl, schema, "NCBI:align:tbl:seq:qc", kcmInit + kcmMD5, "%s/%s", Params.dbPath, ".TEMP");
+                        if (rc == 0)
+                            rc = VTableColumnCreateParams(*tbl, kcmInit, kcmMD5, 0);
+                        if (rc)
+                            (void)PLOGERR(klogErr, (klogErr, rc, "Failed to create output '$(outname)'", "outname=%s/%s", Params.dbPath, ".TEMP"));
+                    }
+                }
+                else
+                    (void)PLOGERR(klogErr, (klogErr, rc, "Failed to load schema", ""));
+                VSchemaRelease(schema);
+            }
+            else
+                (void)PLOGERR(klogErr, (klogErr, rc, "Failed to create schema", ""));
+#endif
+        }
+        else
+            (void)PLOGERR(klogErr, (klogErr, rc, "Failed to open input '$(inname)'", "inname=%s", Params.dbPath));
+        VDBManagerRelease(vdb);
+    }
+    else
+        (void)PLOGERR(klogErr, (klogErr, rc, "Failed to create manager", ""));
+    return rc;
+}
+
+rc_t KFileOpenRead(KFile const **kfp, char const fname[])
+{
+    KDirectory *dir;
+    rc_t rc = KDirectoryNativeDir(&dir);
+    
+    if (rc == 0) {
+        rc = KDirectoryOpenFileRead(dir, kfp, "%s", fname);
+        KDirectoryRelease(dir);
+    }
+    return rc;
+}
+
+static rc_t run(void)
+{
+    KFile const *kf;
+    rc_t rc = KFileOpenRead(&kf, Params.statPath);
+
+    if (rc == 0) {
+        rc = LoadStats(kf);
+        KFileRelease(kf);
+        if (rc == 0) {
+            VTable *dst = NULL;
+            VDatabase const *src = NULL;
+            rc_t rc = OpenDatabaseAndTable(&dst, &src);
+
+            if (rc == 0) {
+                VTable const *seq;
+
+                rc = VDatabaseOpenTableRead(src, &seq, "SEQUENCE");
+                if (rc == 0) {
+                    rc = process(dst, seq);
+                    VTableRelease(seq);
+                }
+            }
+            VTableRelease(dst);
+            VDatabaseRelease(src);
+        }
+    }
+    return rc;
+}
+ 
+static const char* param_usage[] = { "Path to the database" };
+static const char* stats_usage[] = { "Path to the statistics file" };
+
+static OptDef const Options[] =
+{
+    { "stats", "s", NULL, stats_usage, 1, true, true }
+};
+
+rc_t CC UsageSummary (const char * progname) {
+    return KOutMsg (
+"Usage:\n"
+"  %s <db-path>\n"
+, progname);
+ }
+
+rc_t CC Usage(const Args* args) { 
+    rc_t rc = 0 ;
+
+    const char* progname = UsageDefaultName;
+    const char* fullpath = UsageDefaultName;
+
+    if (args == NULL)
+    {    rc = RC(rcApp, rcArgv, rcAccessing, rcSelf, rcNull); }
+    else
+    {    rc = ArgsProgram(args, &fullpath, &progname); }
+
+    UsageSummary(progname);
+
+    KOutMsg("Parameters:\n");
+
+    HelpParamLine ("db-path", param_usage);
+
+    KOutMsg ("\nOptions:\n");
+
+    HelpOptionLine ("s", "stats", NULL, stats_usage);
+
+    HelpOptionsStandard ();
+
+    HelpVersion (fullpath, KAppVersion());
+
+    return rc;
+}
+
+const char UsageDefaultName[] = "qual-recal";
+
+ver_t CC KAppVersion(void) { return 0x1000000; }
+
+static rc_t ArgsRelease(Args* self) { return ArgsWhack(self); }
+
+rc_t CC KMain(int argc, char* argv[]) {
+    rc_t rc = 0;
+    Args* args = NULL;
+
+    do {
+        uint32_t pcount = 0;
+
+        rc = ArgsMakeAndHandle(&args, argc, argv, 1,
+            Options, sizeof Options / sizeof (OptDef));
+        if (rc) {
+            (void)LOGERR(klogErr, rc, "While calling ArgsMakeAndHandle");
+            break;
+        }
+        rc = ArgsParamCount(args, &pcount);
+        if (rc) {
+            (void)LOGERR(klogErr, rc, "Failure parsing database name");
+            break;
+        }
+        if (pcount < 1) {
+            rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcInsufficient);
+            MiniUsage(args);
+            break;
+        }
+        if (pcount > 1) {
+            rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcAmbiguous);
+            (void)LOGERR(klogErr, rc, "Too many database parameters");
+            break;
+        }
+        rc = ArgsParamValue(args, 0, &Params.dbPath);
+        if (rc) {
+            (void)LOGERR(klogErr, rc, "Failure retrieving database name");
+            break;
+        }
+        
+        rc = ArgsOptionCount (args, "stats", &pcount);
+        if (rc) {
+            (void)LOGERR(klogErr, rc, "Failure to get 'stats' argument");
+            break;
+        }
+        if (pcount > 1) {
+            rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcAmbiguous);
+            (void)LOGERR(klogErr, rc, "Too many output parameters");
+            break;
+        }
+        rc = ArgsOptionValue(args, "stats", 0, &Params.statPath);
+        if (rc) {
+            (void)LOGERR(klogErr, rc, "Failure retrieving stats file name");
+            break;
+        }
+    } while (false);
+
+    rc = rc ? rc : run();
+    ArgsRelease(args);
+    return rc;
+}
diff --git a/tools/qual-recalib-stat/.gitignore b/tools/qual-recalib-stat/.gitignore
new file mode 100644
index 0000000..c1e9d15
--- /dev/null
+++ b/tools/qual-recalib-stat/.gitignore
@@ -0,0 +1,3 @@
+*.sh
+*.txt
+stat-table
diff --git a/tools/qual-recalib-stat/Makefile b/tools/qual-recalib-stat/Makefile
new file mode 100644
index 0000000..e3c9215
--- /dev/null
+++ b/tools/qual-recalib-stat/Makefile
@@ -0,0 +1,100 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: std
+
+TOP ?= $(abspath ../..)
+MODULE = tools/qual-recalib-stat
+
+include $(TOP)/build/Makefile.env
+
+INT_TOOLS =
+
+EXT_TOOLS = \
+	qual-recalib-stat
+
+ALL_TOOLS = \
+	$(INT_TOOLS) \
+	$(EXT_TOOLS)
+
+#-------------------------------------------------------------------------------
+# outer targets
+#
+all std: vers-includes
+	@ $(MAKE_CMD) $(TARGDIR)/std
+
+$(ALL_TOOLS): vers-includes
+	@ $(MAKE_CMD) $(BINDIR)/$@
+
+.PHONY: all std $(ALL_TOOLS)
+
+#-------------------------------------------------------------------------------
+# std
+#
+$(TARGDIR)/std: \
+	$(addprefix $(BINDIR)/,$(ALL_TOOLS))
+
+.PHONY: $(TARGDIR)/std
+
+#-------------------------------------------------------------------------------
+# vers-includes
+#
+$(TARGDIR)/vers-includes: $(addsuffix .vers.h,$(EXT_TOOLS))
+
+.PHONY: $(TARGDIR)/vers-includes
+
+#-------------------------------------------------------------------------------
+# clean
+#
+clean: stdclean
+
+.PHONY: clean
+
+#-------------------------------------------------------------------------------
+# vdb-config
+#
+Q_RECAL_STAT_SRC = \
+	namelist_tools \
+	progressbar \
+	num-gen \
+	context \
+	columns \
+	ref_exclude \
+	spot_position \
+	stat_mod_2 \
+	reader \
+	writer \
+	qual-recalib-stat
+
+Q_RECAL_STAT_OBJ = \
+	$(addsuffix .$(OBJX),$(Q_RECAL_STAT_SRC))
+
+Q_RECAL_STAT_LIB = \
+	-lkapp \
+	-sncbi-wvdb \
+	-lm
+
+$(BINDIR)/qual-recalib-stat: $(Q_RECAL_STAT_OBJ)
+	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(Q_RECAL_STAT_LIB)
diff --git a/tools/qual-recalib-stat/columns.c b/tools/qual-recalib-stat/columns.c
new file mode 100644
index 0000000..d606822
--- /dev/null
+++ b/tools/qual-recalib-stat/columns.c
@@ -0,0 +1,94 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+#include "columns.h"
+#include <sysalloc.h>
+#include <stdlib.h>
+#include <string.h>
+#include <klib/log.h>
+
+rc_t add_column( const VCursor *cursor, col *column, const char *name )
+{
+    rc_t rc = VCursorAddColumn ( cursor, &column->idx, "%s", name );
+    if ( rc != 0 )
+        PLOGERR( klogInt, ( klogInt, rc, 
+                            "VCursorAddColumn($(name)) failed", "name=%s", name ) );
+    return rc;
+}
+
+
+rc_t add_columns( const VCursor *cursor,
+                  col *columns, const char **names, uint32_t n_columns )
+{
+    rc_t rc = 0;
+    uint32_t idx;
+
+    for ( idx = 0; idx < n_columns && rc == 0; ++idx )
+    {
+        rc = add_column( cursor, &columns[ idx ], names[ idx ] );
+    }
+    return rc;
+}
+
+
+rc_t read_cell( const VCursor *my_cursor,
+                int64_t row_id,
+                col *column,
+                const char * name )
+{
+    rc_t rc = VCursorCellDataDirect ( my_cursor, row_id,
+            column->idx, &column->elem_bits, &column->base,
+            &column->bit_offset, &column->row_len );
+    if ( rc != 0 )
+        PLOGERR( klogInt, ( klogInt, rc, 
+                            "VCursorCellDataDirect($(name),$(rowid)) failed", 
+                            "name=%s,rowid=%lu", name, row_id ) );
+    return rc;
+}
+
+
+rc_t read_cells( const VCursor *my_cursor, int64_t row_id,
+                 col *columns, const char **names, uint32_t n_columns )
+{
+    rc_t rc = 0;
+    uint32_t idx;
+
+    for ( idx = 0; idx < n_columns && rc == 0; ++idx )
+    {
+        rc = read_cell( my_cursor, row_id, &columns[ idx ], names[ idx ] );
+    }
+    return rc;
+}
+
+
+rc_t write_to_cursor( VCursor * cursor, uint32_t idx, uint32_t bsize,
+                      void * src, uint32_t count, const char * name )
+{
+    rc_t rc = VCursorWrite( cursor, idx, bsize, src, 0, count );
+    if ( rc != 0 )
+        PLOGERR( klogInt, ( klogInt, rc, 
+                            "VCursorWrite($(name)) failed", "name=%s", name ) );
+    return rc;
+}
diff --git a/tools/qual-recalib-stat/columns.h b/tools/qual-recalib-stat/columns.h
new file mode 100644
index 0000000..44e85c5
--- /dev/null
+++ b/tools/qual-recalib-stat/columns.h
@@ -0,0 +1,67 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_columns_
+#define _h_columns_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <klib/rc.h>
+#include <vdb/cursor.h>
+
+typedef struct col
+{
+    uint32_t idx;
+    uint32_t elem_bits;
+    uint32_t bit_offset;
+    uint32_t row_len;
+    const void * base;
+} col;
+
+
+rc_t add_column( const VCursor *cursor, col *column, const char *name );
+
+rc_t add_columns( const VCursor *cursor,
+                  col *columns, const char **names, uint32_t n_columns );
+
+rc_t read_cell( const VCursor *my_cursor,
+                int64_t row_id,
+                col *column,
+                const char * name );
+
+rc_t read_cells( const VCursor *my_cursor, int64_t row_id,
+                 col *columns, const char **names, uint32_t n_columns );
+
+rc_t write_to_cursor( VCursor * cursor, uint32_t idx, uint32_t bsize,
+                      void * src, uint32_t count, const char * name );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/qual-recalib-stat/context.c b/tools/qual-recalib-stat/context.c
new file mode 100644
index 0000000..c9079f5
--- /dev/null
+++ b/tools/qual-recalib-stat/context.c
@@ -0,0 +1,330 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "context.h"
+#include <sysalloc.h>
+#include <stdlib.h>
+
+
+/*
+ * helper-function to set a string inside the context
+ * ( makes a copy ) with error detection
+*/
+static rc_t context_set_str( char **dst, const char *src )
+{
+    size_t len;
+    if ( dst == NULL )
+        return RC( rcVDB, rcNoTarg, rcWriting, rcParam, rcNull );
+
+    if ( *dst != NULL )
+    {
+        free( *dst );
+        *dst = NULL;
+    }
+    if ( src == NULL )
+        return RC( rcVDB, rcNoTarg, rcWriting, rcParam, rcNull );
+
+    *dst = string_dup_measure ( src, &len );
+ 
+    if ( len == 0 )
+        return RC( rcVDB, rcNoTarg, rcWriting, rcItem, rcEmpty );
+    if ( *dst == NULL )
+        return RC( rcVDB, rcNoTarg, rcWriting, rcMemory, rcExhausted );
+    return 0;
+}
+
+
+/*
+ * generates a new context, initializes values
+*/
+rc_t context_init( context **ctx )
+{
+    rc_t rc;
+
+    if ( ctx == NULL )
+        return RC( rcVDB, rcNoTarg, rcConstructing, rcParam, rcNull );
+    (*ctx) = (p_context)calloc( 1, sizeof **ctx );
+    if ( *ctx == NULL )
+        return RC( rcVDB, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+
+    /* because of calloc the context is zero'd out
+       default-values can be set here: */
+
+    rc = num_gen_make( &((*ctx)->row_generator) );
+    if ( rc != 0 )
+        OUTMSG(( "num_gen_make() failed %r\n", rc ));
+    return rc;
+}
+
+
+/*
+ * destroys a context, frees all pointers the context owns
+*/
+rc_t context_destroy( p_context ctx )
+{
+    if ( ctx == NULL )
+        return RC( rcVDB, rcNoTarg, rcDestroying, rcParam, rcNull );
+
+    if ( ctx->src_path != NULL )
+    {
+        free( (void*)ctx->src_path );
+        ctx->src_path = NULL;
+    }
+    if ( ctx->output_file_path != NULL )
+    {
+        free( (void*)ctx->output_file_path );
+        ctx->output_file_path = NULL;
+    }
+    if ( ctx->output_mode != NULL )
+    {
+        free( (void*)ctx->output_mode );
+        ctx->output_mode = NULL;
+    }
+    if ( ctx->src_schema_list != NULL )
+    {
+        KNamelistRelease( ctx->src_schema_list );
+        ctx->src_schema_list = NULL;
+    }
+    num_gen_destroy( ctx->row_generator );
+    free( ctx );
+    return 0;
+}
+
+
+/*
+ * clear's the number-generator and sets the given intervall
+*/
+rc_t context_set_range( p_context ctx, 
+                        const int64_t first, const uint64_t count )
+{
+    rc_t rc = num_gen_clear( ctx->row_generator );
+    if ( rc == 0 )
+        rc = num_gen_add( ctx->row_generator, first, count );
+    return rc;
+}
+
+
+/*
+ * performs the range check to trim the internal number
+ * generator to the given range
+*/
+rc_t context_range_check( p_context ctx, 
+                          const int64_t first, const uint64_t count )
+{
+    return num_gen_range_check( ctx->row_generator, first, count );
+}
+
+
+/*
+ * helper-function to set the source-path
+*/
+static rc_t context_set_src_path( p_context ctx, const char *src )
+{
+    return context_set_str( (char**)&(ctx->src_path), src );
+}
+
+/*
+ * helper-function to set the output-path
+*/
+static rc_t context_set_out_file_path( p_context ctx, const char *src )
+{
+    return context_set_str( (char**)&(ctx->output_file_path), src );
+}
+
+
+/*
+ * helper-function to set the output-mode
+*/
+static rc_t context_set_out_mode( p_context ctx, const char *src )
+{
+    return context_set_str( (char**)&(ctx->output_mode), src );
+}
+
+
+/*
+ * helper-function to set path to exclude-db
+*/
+static rc_t context_set_exclude_path( p_context ctx, const char *src )
+{
+    return context_set_str( (char**)&(ctx->exclude_file_path), src );
+}
+
+
+static rc_t context_set_row_range( p_context ctx, const char *src )
+{
+    if ( ( ctx == NULL )||( src == NULL ) )
+        return RC( rcVDB, rcNoTarg, rcWriting, rcParam, rcNull );
+    return num_gen_parse( ctx->row_generator, src );
+}
+
+
+static bool context_check_if_usage_necessary( p_context ctx )
+{
+    if ( ctx == NULL ) return false;
+    if ( ctx->src_path == NULL )
+        ctx->usage_requested = true;
+    return ctx->usage_requested;
+}
+
+
+static rc_t context_evaluate_arguments( const Args *my_args, p_context ctx )
+{
+    uint32_t count, idx;
+    
+    rc_t rc = ArgsParamCount( my_args, &count );
+    if ( rc != 0 )
+    {
+        OUTMSG(( "ArgsParamCount() failed %R\n", rc ));
+        return rc;
+    }
+
+    for ( idx = 0; idx < count && rc == 0; ++idx )
+    {
+        const char *value = NULL;
+        rc = ArgsParamValue( my_args, idx, &value );
+        if ( rc != 0 )
+        {
+            OUTMSG(( "ArgsParamValue() failed %R\n", rc ));
+        }
+        else
+        {
+            switch( idx )
+            {
+            case 0 : rc = context_set_src_path( ctx, value );
+                     if ( rc != 0 )
+                        OUTMSG(( "context_set_src_path() failed %R\n", rc ));
+                     break;
+            }
+        }
+    }
+    return rc;
+}
+
+
+static bool context_get_bool_option( const Args *my_args,
+                                     const char *name,
+                                     const bool def )
+{
+    bool res = def;
+    uint32_t count = 0;
+    rc_t rc = ArgsOptionCount( my_args, name, &count );
+    if ( rc == 0 && count > 0 )
+        res = true;
+    return res;
+}
+
+
+static const char* context_get_str_option( const Args *my_args,
+                                           const char *name )
+{
+    const char* res = NULL;
+    uint32_t count;
+    rc_t rc = ArgsOptionCount( my_args, name, &count );
+    if ( ( rc == 0 )&&( count > 0 ) )
+    {
+        rc = ArgsOptionValue( my_args, name, 0, &res );
+    }
+    return res;
+}
+
+
+static uint32_t context_get_int_option( const Args *my_args,
+                                        const char *name,
+                                        const uint32_t def )
+{
+    uint32_t count, res = def;
+    rc_t rc = ArgsOptionCount( my_args, name, &count );
+    if ( ( rc == 0 )&&( count > 0 ) )
+    {
+        const char *s;
+        rc = ArgsOptionValue( my_args, name, 0,  &s );
+        if ( rc == 0 ) res = atoi( s );
+    }
+    return res;
+}
+
+
+/*
+ * returns the number of schema's given on the commandline
+*/
+uint32_t context_schema_count( p_context ctx )
+{
+    uint32_t res = 0;
+    if ( ctx != NULL )
+        if ( ctx->src_schema_list != 0 )
+        {
+            uint32_t count;
+            if ( KNamelistCount( ctx->src_schema_list, &count ) == 0 )
+                res = count;
+        }
+    return res;
+}
+
+
+static void context_evaluate_options( const Args *my_args, p_context ctx )
+{
+    if ( my_args == NULL ) return;
+    if ( ctx == NULL ) return;
+
+    ctx->show_progress = context_get_bool_option( my_args, OPTION_SHOW_PROGRESS, false );
+    ctx->info = context_get_bool_option( my_args, OPTION_INFO, false );
+    ctx->ignore_mismatch = context_get_bool_option( my_args, OPTION_IGNORE_MISMATCH, false );
+    context_set_row_range( ctx, context_get_str_option( my_args, OPTION_ROWS ) );
+    nlt_make_namelist_from_string( &(ctx->src_schema_list), 
+                                   context_get_str_option( my_args, OPTION_SCHEMA ) );
+    context_set_out_file_path( ctx, context_get_str_option( my_args, OPTION_OUTFILE ) );
+    context_set_out_mode( ctx, context_get_str_option( my_args, OPTION_OUTMODE ) );
+    if ( ctx->output_mode == NULL )
+        context_set_out_mode( ctx, "file" );
+    ctx->gc_window = context_get_int_option( my_args, OPTION_GCWINDOW, 7 );
+    context_set_exclude_path( ctx, context_get_str_option( my_args, OPTION_EXCLUDE ) );
+}
+
+
+/*
+ * reads all arguments and options, fills the context
+ * with copies (if strings) of this data
+*/
+rc_t context_capture_arguments_and_options( const Args * args, p_context ctx )
+{
+    rc_t rc;
+
+    rc = context_evaluate_arguments( args, ctx );
+    if ( rc != 0 )
+    {
+        OUTMSG(( "context_evaluate_arguments() failed %R\n", rc ));
+    }
+    else
+    {
+        context_evaluate_options( args, ctx );
+        context_check_if_usage_necessary( ctx );
+
+        rc = ArgsHandleLogLevel( args );
+        if ( rc != 0 )
+            OUTMSG(( "ArgsHandleLogLevel() failed %R\n", rc ));
+    }
+    return rc;
+}
diff --git a/tools/qual-recalib-stat/context.h b/tools/qual-recalib-stat/context.h
new file mode 100644
index 0000000..861678f
--- /dev/null
+++ b/tools/qual-recalib-stat/context.h
@@ -0,0 +1,120 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_context_
+#define _h_context_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <kapp/args.h>
+#include <klib/namelist.h>
+#include <klib/out.h>
+#include "namelist_tools.h"
+#include "num-gen.h"
+
+#define OPTION_ROWS              "rows"
+#define OPTION_SCHEMA            "schema"
+#define OPTION_SHOW_PROGRESS     "show_progress"
+#define OPTION_OUTFILE           "output_file"
+#define OPTION_OUTMODE           "mode"
+#define OPTION_GCWINDOW          "gcwindow"
+#define OPTION_EXCLUDE           "exclude"
+#define OPTION_INFO              "info"
+#define OPTION_IGNORE_MISMATCH   "ignore_mismatch"
+
+#define ALIAS_ROWS              "R"
+#define ALIAS_SCHEMA            "S"
+#define ALIAS_SHOW_PROGRESS     "p"
+#define ALIAS_OUTFILE           "o"
+#define ALIAS_OUTMODE           "m"
+#define ALIAS_GCWINDOW          "g"
+#define ALIAS_EXCLUDE           "x"
+#define ALIAS_INFO              "i"
+#define ALIAS_IGNORE_MISMATCH   "n"
+
+/* *******************************************************************
+the context contains all informations needed to execute the run
+******************************************************************* */
+typedef struct context
+{
+    /* read from commandline */
+    char *src_path;
+    char *output_file_path;
+    char *output_mode;
+    char *exclude_file_path;
+    const KNamelist *src_schema_list;
+    num_gen *row_generator;
+    bool usage_requested;
+    bool show_progress;
+    bool info;
+    bool ignore_mismatch;
+    uint32_t gc_window;
+} context;
+typedef context* p_context;
+
+
+/*
+ * generates a new context, initializes values
+*/
+rc_t context_init( context **ctx );
+
+
+/*
+ * destroys a context, frees all pointers the context owns
+*/
+rc_t context_destroy( p_context ctx );
+
+
+/*
+ * performs the range check to trim the internal number
+ * generator to the given range
+*/
+rc_t context_range_check( p_context ctx, 
+                          const int64_t first, const uint64_t count );
+
+
+rc_t context_set_range( p_context ctx, 
+                        const int64_t first, const uint64_t count );
+
+/*
+ * returns the number of schema's given on the commandline
+*/
+uint32_t context_schema_count( p_context ctx );
+
+
+/*
+ * reads all arguments and options, fills the context
+ * with copies (if strings) of this data
+*/
+rc_t context_capture_arguments_and_options( const Args * args, p_context ctx );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/qual-recalib-stat/fasta_dump.pl b/tools/qual-recalib-stat/fasta_dump.pl
new file mode 100755
index 0000000..25c9c0a
--- /dev/null
+++ b/tools/qual-recalib-stat/fasta_dump.pl
@@ -0,0 +1,81 @@
+#!/usr/bin/perl -w
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+use File::Path;
+
+my $nargs = scalar @ARGV;
+
+if ( $nargs < 2  )
+{
+    print( "\n-------------------------------------------------------------------------\n" );
+    print( "USAGE: fasta_dump.pl src bases\n" );
+    print( "src   ... absolute-path to a reference-table\n" );
+    print( "bases ... how many bases to dump\n" );
+    print( "-------------------------------------------------------------------------\n\n" );
+}
+else
+{
+    my $ref = $ARGV[ 0 ];
+    my $cnt = $ARGV[ 1 ];
+    my $len = 79;
+    my ( $n_rows, $cmd, $row, $s, $line );
+
+    #calculate how many rows have to be dumped...
+    {
+        use integer;
+        $n_rows = ( $cnt / 5000 ) + 1;
+    }
+
+    #dump the sequence-name
+    $cmd = "vdb-dump $ref -C SEQ_ID -f csv -R 1";
+    open ( DUMP, "-|", "$cmd" ) or die "$cmd failed";
+    while ( ( $row = <DUMP> ), defined( $row ) )
+    {
+        chomp( $row );
+        print( ">$row\n" );
+    }
+    close ( DUMP );
+
+    #dump the rows
+    $cmd = "vdb-dump $ref -C READ -f tab -R 1-$n_rows";
+    open ( DUMP, "-|", "$cmd" ) or die "$cmd failed";
+    while ( ( $row = <DUMP> ), defined( $row ) )
+    {
+        chomp( $row );
+        $s .= $row;
+        while( length( $s ) >= $len )
+        {
+            $line = substr( $s, 0, $len, "" );
+            print( "$line\n" );
+
+        }
+    }
+    close ( DUMP );
+
+    #dump the remainder of bases
+    if ( length( $s ) > 0 )
+    {
+        print( "$s\n" );
+    }
+}
\ No newline at end of file
diff --git a/tools/qual-recalib-stat/namelist_tools.c b/tools/qual-recalib-stat/namelist_tools.c
new file mode 100644
index 0000000..270449b
--- /dev/null
+++ b/tools/qual-recalib-stat/namelist_tools.c
@@ -0,0 +1,187 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+#include "namelist_tools.h"
+
+#include <sysalloc.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+
+int nlt_strcmp( const char* s1, const char* s2 )
+{
+    size_t n1 = string_size ( s1 );
+    size_t n2 = string_size ( s2 );
+    return string_cmp ( s1, n1, s2, n2, ( n1 < n2 ) ? n2 : n1 );
+}
+
+
+rc_t nlt_make_namelist_from_string( const KNamelist **list, const char * src )
+{
+    VNamelist *v_names;
+    rc_t rc = VNamelistMake ( &v_names, 5 );
+    if ( rc == 0 )
+    {
+        char * s = string_dup_measure ( src, NULL );
+        if ( s )
+        {
+            uint32_t str_begin = 0;
+            uint32_t str_end = 0;
+            char c;
+            do
+            {
+                c = s[ str_end ];
+                if ( c == ',' || c == 0 )
+                {
+                    if ( str_begin < str_end )
+                    {
+                        char c_temp = c;
+                        s[ str_end ] = 0;
+                        rc = VNamelistAppend ( v_names, &(s[str_begin]) );
+                        s[ str_end ] = c_temp;
+                    }
+                    str_begin = str_end + 1;
+                }
+                str_end++;
+            } while ( c != 0 && rc == 0 );
+            free( s );
+        }
+        rc = VNamelistToConstNamelist ( v_names, list );
+        VNamelistRelease( v_names );
+    }
+    return rc;
+}
+
+bool nlt_is_name_in_namelist( const KNamelist *list,
+                             const char *name_to_find )
+{
+    uint32_t count, idx;
+    bool res = false;
+    if ( list == NULL || name_to_find == NULL )
+        return res;
+    if ( KNamelistCount( list, &count ) == 0 )
+    {
+        for ( idx = 0; idx < count && res == false; ++idx )
+        {
+            const char *item_name;
+            if ( KNamelistGet( list, idx, &item_name ) == 0 )
+            {
+                if ( nlt_strcmp( item_name, name_to_find ) == 0 )
+                    res = true;
+            }
+        }
+    }
+    return res;
+}
+
+/*
+    - list1 and list2 containts strings
+    - if one of the strings in list2 is contained ( partial match, strstr() )
+      in one of the strings in list1 the function returns true...
+*/
+bool nlt_namelist_intersect( const KNamelist *list1, const KNamelist *list2 )
+{
+    uint32_t count1;
+    bool res = false;
+    if ( list1 == NULL || list2 == NULL )
+        return res;
+    if ( KNamelistCount( list1, &count1 ) == 0 )
+    {
+        uint32_t idx1;
+        for ( idx1 = 0; idx1 < count1 && res == false; ++idx1 )
+        {
+            const char *string1;
+            if ( KNamelistGet( list1, idx1, &string1 ) == 0 )
+            {
+                uint32_t count2;
+                if ( KNamelistCount( list2, &count2 ) == 0 )
+                {
+                    uint32_t idx2;
+                    for ( idx2 = 0; idx2 < count2 && res == false; ++idx2 )
+                    {
+                        const char *string2;
+                        if ( KNamelistGet( list2, idx2, &string2 ) == 0 )
+                        {
+                            if ( strstr( string1, string2 ) != NULL )
+                                res = true;
+                        }
+                    }
+                }
+            }
+        }
+    }
+    return res;
+}
+
+rc_t nlt_remove_names_from_namelist( const KNamelist *source,
+            const KNamelist **dest, const KNamelist *to_remove )
+{
+    rc_t rc = 0;
+    uint32_t count;
+    
+    if ( source == NULL || dest == NULL || to_remove == NULL )
+        return RC( rcVDB, rcNoTarg, rcConstructing, rcParam, rcNull );
+    *dest = NULL;
+    rc = KNamelistCount( source, &count );
+    if ( rc == 0 && count > 0 )
+    {
+        VNamelist *cleaned;
+        rc = VNamelistMake ( &cleaned, count );
+        if ( rc == 0 )
+        {
+            uint32_t idx;
+            for ( idx = 0; idx < count && rc == 0; ++idx )
+            {
+                const char *s;
+                rc = KNamelistGet( source, idx, &s );
+                if ( rc == 0 )
+                {
+                    if ( !nlt_is_name_in_namelist( to_remove, s ) )
+                        rc = VNamelistAppend ( cleaned, s );
+                }
+                rc = VNamelistToConstNamelist ( cleaned, dest );
+            }
+        }
+    }
+    return rc;
+}
+
+rc_t nlt_remove_strings_from_namelist( const KNamelist *source,
+            const KNamelist **dest, const char *items_to_remove )
+{
+    rc_t rc = 0;
+    const KNamelist *to_remove;
+    
+    if ( source == NULL || dest == NULL || items_to_remove == NULL )
+        return RC( rcVDB, rcNoTarg, rcConstructing, rcParam, rcNull );
+    rc = nlt_make_namelist_from_string( &to_remove, items_to_remove );
+    if ( rc == 0 )
+    {
+        rc = nlt_remove_names_from_namelist( source, dest, to_remove );
+        KNamelistRelease( to_remove );
+    }
+    return rc;
+}
diff --git a/tools/qual-recalib-stat/namelist_tools.h b/tools/qual-recalib-stat/namelist_tools.h
new file mode 100644
index 0000000..7392a3c
--- /dev/null
+++ b/tools/qual-recalib-stat/namelist_tools.h
@@ -0,0 +1,53 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+#ifndef _h_namelist_tools_
+#define _h_namelist_tools_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <klib/namelist.h>
+#include <klib/out.h>
+#include <klib/text.h>
+#include <klib/rc.h>
+
+int nlt_strcmp( const char* s1, const char* s2 );
+rc_t nlt_make_namelist_from_string( const KNamelist **list, const char * src );
+bool nlt_is_name_in_namelist( const KNamelist *list, const char *name_to_find );
+bool nlt_namelist_intersect( const KNamelist *list1, const KNamelist *list2 );
+
+rc_t nlt_remove_names_from_namelist( const KNamelist *source,
+            const KNamelist **dest, const KNamelist *to_remove );
+
+rc_t nlt_remove_strings_from_namelist( const KNamelist *source,
+            const KNamelist **dest, const char *items_to_remove );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/qual-recalib-stat/num-gen.c b/tools/qual-recalib-stat/num-gen.c
new file mode 100644
index 0000000..baa4aa2
--- /dev/null
+++ b/tools/qual-recalib-stat/num-gen.c
@@ -0,0 +1,848 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "num-gen.h"
+#include <klib/printf.h>
+
+#include <sysalloc.h>
+#include <strtol.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+typedef struct num_gen_node
+{
+    uint64_t start;
+    uint64_t end;
+    uint64_t count; /* 0 ... skip, >0 ... valid */
+} num_gen_node;
+typedef struct num_gen_node * p_num_gen_node;
+
+/* **************************************************************************
+{ start:5,count: 0 } ---> [ ]
+{ start:5,count: 1 } ---> [ 5 ]
+{ start:5,count: 2 } ---> [ 5, 6 ]
+ ************************************************************************** */
+
+struct num_gen
+{
+    Vector nodes;
+};
+
+
+struct num_gen_iter
+{
+    Vector nodes;
+    uint32_t curr_node;
+    uint32_t curr_node_sub_pos;
+    uint64_t total;
+    uint64_t progress;
+};
+
+/* forward decl. for fixing-function */
+static rc_t num_gen_fix_overlaps( num_gen* self, uint32_t *count );
+
+
+/* helper function to destroy a node*/
+static void CC num_gen_node_destroy( void *item, void *data )
+{
+    free( item );
+}
+
+
+/* helper function to create a node from start/count */
+static p_num_gen_node num_gen_make_node( const uint64_t start, const uint64_t count )
+{
+    p_num_gen_node p = ( p_num_gen_node )malloc( sizeof( num_gen_node ) );
+    if ( p )
+    {
+        p->start = start;
+        p->end = start + count - 1;
+        p->count = count;
+    }
+    return p;
+}
+
+
+/* helper callback to compare 2 nodes, lets VectorInsert create a sorted vector */
+static int CC num_gen_insert_helper( const void* item1, const void* item2 )
+{
+    const p_num_gen_node node1 = ( p_num_gen_node )item1;
+    const p_num_gen_node node2 = ( p_num_gen_node )item2;
+    int res = 0;
+    if ( node1->start == node2->start )
+    {
+        if ( node1->count < node2->count )
+            res = -1;
+        else if ( node1->count > node2->count )
+            res = 1;
+    }
+    else if ( node1->start < node2->start )
+        res = -1;
+    else
+        res = 1;
+    return res;
+}
+
+
+/* helper callback to create a deep and conditional copy of a node-vector */
+static void CC num_gen_copy_cb( void *item, void *data )
+{
+    p_num_gen_node node = ( p_num_gen_node )item;
+    if ( node->count > 0 )
+    {
+        Vector * dst = ( Vector *)data;
+        p_num_gen_node new_node = num_gen_make_node( node->start, node->count );
+        if ( new_node != NULL )
+            VectorInsert( dst, new_node, NULL, num_gen_insert_helper );
+    }
+}
+
+
+/* helper function that creates a deep and conditional copy of a node-vector */
+static void num_gen_copy_vector( const Vector * src, Vector * dst )
+{
+    if ( src == NULL || dst == NULL )
+        return;
+    VectorForEach ( src, false, num_gen_copy_cb, dst );    
+}
+
+
+/* helper callback to add up all count values in the vector*/
+static void CC num_gen_total_count_cb( void *item, void *data )
+{
+    p_num_gen_node node = ( p_num_gen_node )item;
+    if ( node != NULL )
+    {
+        uint64_t * total = ( uint64_t *)data;
+        if ( total != NULL )
+            *total += node->count;
+    }
+}
+
+
+/* helper function that adds up all count values in the vector*/
+static uint64_t num_gen_total_count( const Vector * src )
+{
+    uint64_t res = 0;
+    if ( src != NULL )
+        VectorForEach ( src, false, num_gen_total_count_cb, &res );
+    return res;
+}
+
+
+/* helper function for the parse-function */
+static rc_t num_gen_add_node( num_gen* self, const uint64_t from,
+                              const uint64_t to )
+{
+    p_num_gen_node node = NULL;
+    int64_t count = ( to - from );
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcInserting, rcSelf, rcNull );
+
+    if ( count >= 0 )
+        node = num_gen_make_node( from, count + 1 );
+    else
+        node = num_gen_make_node( to, -( count + 1 ) );
+    if ( node == NULL )
+        return RC( rcVDB, rcNoTarg, rcInserting, rcMemory, rcExhausted );
+    return VectorInsert( &(self->nodes), node, NULL, num_gen_insert_helper );
+}
+
+
+#define MAX_NUM_STR 12
+/* helper-structure for num_gen_parse() */
+typedef struct num_gen_parse_ctx
+{
+    uint32_t num_str_idx;
+    bool this_is_the_first_number;
+    uint64_t num1;
+    uint64_t num2;
+    char num_str[ MAX_NUM_STR + 1 ];
+} num_gen_parse_ctx;
+typedef num_gen_parse_ctx* p_num_gen_parse_ctx;
+
+
+/* helper for num_gen_parse() */
+static void num_gen_convert_ctx( p_num_gen_parse_ctx ctx )
+{
+    char *endp;
+    
+    ctx->num_str[ ctx->num_str_idx ] = 0;
+    ctx->num1 = strtou64( ctx->num_str, &endp, 10 );
+    ctx->this_is_the_first_number = false;
+    ctx->num_str_idx = 0;
+}
+
+
+/* helper for num_gen_parse() */
+static rc_t num_gen_convert_and_add_ctx( num_gen* self, p_num_gen_parse_ctx ctx )
+{
+    char *endp;
+    
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcInserting, rcSelf, rcNull );
+    if ( ctx == NULL )
+        return RC( rcVDB, rcNoTarg, rcInserting, rcParam, rcNull );
+    if ( ctx->num_str_idx == 0 )
+        return RC( rcVDB, rcNoTarg, rcInserting, rcParam, rcEmpty );
+
+    /* terminate the source-string */
+    ctx->num_str[ ctx->num_str_idx ] = 0;
+    /* convert the string into a uint64_t */
+    if ( ctx->this_is_the_first_number )
+        {
+        ctx->num1 = strtou64( ctx->num_str, &endp, 10 );
+        ctx->num2 = ctx->num1;
+        }
+    else
+        ctx->num2 = strtou64( ctx->num_str, &endp, 10 );
+    /* empty the source-string to be reused */
+    ctx->num_str_idx = 0;
+    
+    ctx->this_is_the_first_number = true;
+    return num_gen_add_node( self, ctx->num1, ctx->num2 );
+}
+
+
+/* parse the given string and insert the found ranges 
+   into the number-generator, fixes eventual overlaps */
+rc_t num_gen_parse( num_gen* self, const char* src )
+{
+    size_t i, n;
+    num_gen_parse_ctx ctx;
+    rc_t rc = 0;
+
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcParsing, rcSelf, rcNull );
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcParsing, rcParam, rcNull );
+
+    n = string_measure ( src, NULL );
+    if ( n == 0 )
+        return RC( rcVDB, rcNoTarg, rcParsing, rcParam, rcEmpty );
+
+    ctx.num_str_idx = 0;
+    ctx.this_is_the_first_number = true;
+    for ( i = 0; i < n && rc == 0; ++i )
+    {
+        switch ( src[ i ] )
+        {
+        /* a dash switches from N1-mode into N2-mode */
+        case '-' :
+            num_gen_convert_ctx( &ctx );
+            break;
+
+        /* a comma ends a single number or a range */
+        case ',' :
+            rc = num_gen_convert_and_add_ctx( self, &ctx );
+            break;
+
+        /* in both mode add the char to the temp string */
+        default:
+            if ( ( src[i]>='0' )&&( src[i]<='9' )&&( ctx.num_str_idx < MAX_NUM_STR ) )
+                ctx.num_str[ ctx.num_str_idx++ ] = src[ i ];
+            break;
+        }
+    }
+    /* dont forget to add what is left in ctx.num_str ... */
+    if ( ctx.num_str_idx > 0 )
+        rc = num_gen_convert_and_add_ctx( self, &ctx );
+    if ( rc == 0 )
+        rc = num_gen_fix_overlaps( self, NULL );
+    return rc;
+}
+
+
+/* inserts the given ranges into the number-generator,
+   fixes eventual overlaps */
+rc_t num_gen_add( num_gen* self, const uint64_t first, const uint64_t count )
+{
+    rc_t rc;
+    uint64_t num_1 = first;
+    uint64_t num_2 = first;
+
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcInserting, rcSelf, rcNull );
+
+    /* this is necessary because virtual columns which have a
+       infinite row-range, get reported with first=1,count=0 */
+    if ( count > 0 )
+        num_2 = ( first + count - 1 );
+    rc = num_gen_add_node( self, num_1, num_2 );
+    if ( rc == 0 )
+        rc = num_gen_fix_overlaps( self, NULL );
+    return rc;
+}
+
+
+/* helper function for range-check */
+static bool CC num_gen_check_range_start( p_num_gen_node the_node, 
+                                          const uint64_t range_start )
+{
+    bool res = true;
+    uint64_t last_node_row = ( the_node->start + the_node->count - 1 );
+    
+    if ( the_node->start < range_start )
+    {
+        the_node->start = range_start;
+        if ( the_node->start <= last_node_row )
+        {
+            the_node->count = ( last_node_row - the_node->start ) + 1;
+        }
+        else
+        {
+            /* the node becomes invalid ... */
+            the_node->start = 0;
+            the_node->count = 0;
+            res = false;
+        }
+    }
+    return res;
+}
+
+
+/* helper function for range-check */
+static void CC num_gen_check_range_end( p_num_gen_node the_node, 
+                             const uint64_t last_tab_row )
+{
+    uint64_t last_node_row = ( the_node->start + the_node->count - 1 );
+
+    if ( last_node_row > last_tab_row )
+    {
+        last_node_row = last_tab_row;
+        if ( the_node->start <= last_node_row )
+        {
+            the_node->count = ( last_node_row - the_node->start ) + 1;
+        }
+        else
+        {
+            /* the node becomes invalid ... */
+            the_node->start = 0;
+            the_node->count = 0;
+        }
+    }
+}
+
+
+/* helper function for range-check */
+static void CC num_gen_check_range_callback( void *item, void *data )
+{
+    p_num_gen_node the_node = ( p_num_gen_node )item;
+    p_num_gen_node the_range = ( p_num_gen_node )data;
+    uint64_t last_tab_row = ( the_range->start + the_range->count - 1 );
+
+    /* ignore invalid nodes... */
+    if ( the_node->start == 0 || the_node->count == 0 )
+        return;
+        
+    /* check if the start value is not out of range... */
+    if ( num_gen_check_range_start( the_node, the_range->start ) )
+        num_gen_check_range_end( the_node, last_tab_row );
+}
+
+
+/* helper function for range-check */
+static void CC num_gen_count_invalid_nodes( void *item, void *data )
+{
+    p_num_gen_node the_node = ( p_num_gen_node )item;
+    uint32_t *invalid_count = ( uint32_t * )data;
+    
+    if ( ( the_node->start == 0 )&&( the_node->count == 0 ) )
+        ( *invalid_count )++;
+}
+
+
+/* helper function for range-check */
+static void CC num_gen_copy_valid_nodes( void *item, void *data )
+{
+    p_num_gen_node node = ( p_num_gen_node )item;
+    Vector *dest = ( Vector * )data;
+    
+    if ( ( node->start != 0 )&&( node->count != 0 ) )
+        VectorInsert ( dest, node, NULL, num_gen_insert_helper );
+    else
+        free ( node );
+}
+
+
+/* helper function for range-check */
+static void num_gen_remove_invalid_nodes( num_gen* self )
+{
+    Vector temp_nodes;
+    uint32_t count = VectorLength( &(self->nodes) );
+    
+    if ( count < 1 )
+        return;
+    /* create a temp. vector */
+    VectorInit( &temp_nodes, 0, count );
+
+    /* copy all valid nodes into the temp. vector */
+    VectorForEach ( &(self->nodes), false,
+                    num_gen_copy_valid_nodes, &temp_nodes );
+
+    /* clear all nodes so far...,
+       DO NOT PASS num_gen_node_destroy into it */
+    VectorWhack( &(self->nodes), NULL, NULL );
+
+    /* initialize and copy (shallow) the valid nodes back
+       into the generator */
+    VectorCopy ( &temp_nodes, &(self->nodes) );
+
+    /* destroy the temp-vector,
+       DO NOT PASS num_gen_node_destroy into it */
+    VectorWhack ( &temp_nodes, NULL, NULL );
+}
+
+
+/* helper function for trim */
+rc_t num_gen_trim( num_gen* self, const int64_t first, const uint64_t count )
+{
+    num_gen_node trim_range;
+    uint32_t invalid_nodes = 0;
+
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcValidating, rcSelf, rcNull );
+    if ( count == 0 )
+        return RC( rcVDB, rcNoTarg, rcValidating, rcParam, rcNull );
+
+    /* walk all nodes to check for boundaries... */
+    trim_range.start = first;
+    trim_range.count = count;
+
+    VectorForEach ( &(self->nodes), false,
+                    num_gen_check_range_callback, &trim_range );
+
+    VectorForEach ( &(self->nodes), false,
+                    num_gen_count_invalid_nodes, &invalid_nodes );
+    if ( invalid_nodes > 0 )
+        num_gen_remove_invalid_nodes( self );
+ 
+    return 0;
+}
+
+
+rc_t num_gen_make( num_gen** self )
+{
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcConstructing, rcSelf, rcNull );
+
+    *self = calloc( 1, sizeof( num_gen ) );
+    if ( *self == NULL )
+        return RC( rcVDB, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+
+    VectorInit( &((*self)->nodes ), 0, 5 );
+    return 0;
+}
+
+
+rc_t num_gen_make_from_str( num_gen** self, const char *src )
+{
+    rc_t rc = num_gen_make( self );
+    if ( rc == 0 )
+    {
+        rc = num_gen_parse( *self, src );
+        if ( rc == 0 )
+            rc = num_gen_fix_overlaps( *self, NULL );
+     }
+     return rc;
+}
+
+
+rc_t num_gen_make_from_range( num_gen** self, 
+                              const int64_t first, const uint64_t count )
+{
+    rc_t rc = num_gen_make( self );
+    if ( rc != 0 )
+        return rc;
+    return num_gen_add( *self, first, count );
+}
+
+
+rc_t num_gen_clear( num_gen* self )
+{
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcClearing, rcSelf, rcNull );
+
+    if ( VectorLength( &(self->nodes) ) > 0 )
+    {
+        /* clear all nodes so far... */
+        VectorWhack( &(self->nodes), num_gen_node_destroy, NULL );
+
+        /* re-init the vector */
+        VectorInit( &(self->nodes ), 0, 5 );
+    }
+    return 0;
+}
+
+
+rc_t num_gen_destroy( num_gen* self )
+{
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcDestroying, rcSelf, rcNull );
+
+    VectorWhack( &(self->nodes), num_gen_node_destroy, NULL );
+    free( self );
+    return 0;
+}
+
+
+bool num_gen_empty( const num_gen* self )
+{
+    if ( self == NULL )
+        return true;
+    return ( VectorLength( &(self->nodes) ) < 1 );
+}
+
+
+typedef struct overlap_ctx
+{
+    p_num_gen_node prev;
+    uint32_t overlaps;
+} overlap_ctx;
+typedef overlap_ctx* p_overlap_ctx;
+
+
+/* static bool CC num_gen_overlap_fix_cb( void *item, void *data ) */
+static bool CC num_gen_overlap_fix_cb( void *item, void *data )
+{
+    p_num_gen_node node = ( p_num_gen_node )item;
+    p_overlap_ctx ctx = ( p_overlap_ctx )data;
+
+    /* skip invalid nodes */
+    if ( node->count ==0 || node->start == 0 || node->end == 0 )
+        return false;
+    /* if we do not have a previous node, take this one... */
+    if ( ctx->prev == NULL )
+        {
+        ctx->prev = node;
+        return false;
+        }
+    /* if we do not have an overlap,
+       take this node as prev-node and continue */
+    if ( ctx->prev->end < node->start )
+        {
+        ctx->prev = node;
+        return false;
+        }
+    /* we have a overlap, the end of the prev-node is inside
+       the current-node, we fix it by expanding the prev-node
+       to the end of this node, and later declaring this
+       node as invalid */
+    if ( ctx->prev->end < node->end )
+    {
+        ctx->prev->end = node->end;
+        ctx->prev->count = ( ctx->prev->end - ctx->prev->start ) + 1;
+    }
+    /* if the prev-node ends after this node, all we have to
+       do is declaring this node as invalid */
+    node->count = 0;
+    node->start = 0;
+    node->end = 0;
+    return true;
+}
+
+
+static rc_t num_gen_fix_overlaps( num_gen* self, uint32_t *count )
+{
+    overlap_ctx ctx;
+    bool fix_executed = false;
+    
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcReading, rcSelf, rcNull );
+    
+    ctx.overlaps = 0;
+    do
+    {
+        ctx.prev = NULL;
+        fix_executed = VectorDoUntil ( &(self->nodes), false, 
+                                       num_gen_overlap_fix_cb, &ctx );
+    } while ( fix_executed );
+
+    if ( count )
+        *count = ctx.overlaps;
+    return 0;
+}
+
+
+typedef struct string_ctx
+{
+    char *s;
+    uint32_t len;
+} string_ctx;
+typedef string_ctx* p_string_ctx;
+
+
+static void string_ctx_add( p_string_ctx ctx, char *s )
+{
+    uint32_t len = string_measure ( s, NULL );
+    if ( len > 0 )
+    {
+        if ( ctx->len == 0 )
+            ctx->s = malloc( len + 1 );
+        else
+            ctx->s = realloc( ctx->s, ctx->len + len );
+        memcpy( &(ctx->s[ctx->len]), s, len );
+        ctx->len += len;
+    }
+}
+
+
+static void CC num_gen_as_string_cb( void *item, void *data )
+{
+    char temp[40];
+    p_num_gen_node node = ( p_num_gen_node )item;
+    long unsigned int start = node->start;
+    long unsigned int end = ( start + node->count - 1 );
+    switch( node->count )
+    {
+    case 0 : temp[0]=0;
+             break;
+    case 1 : string_printf ( temp, sizeof temp, NULL, "%lu,", start );
+             break;
+    default: string_printf ( temp, sizeof temp, NULL, "%lu-%lu,", start, end );
+             break;
+    }
+    string_ctx_add( ( p_string_ctx )data, temp );
+}
+
+
+rc_t num_gen_as_string( const num_gen* self, char **s )
+{
+    string_ctx ctx;
+    
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcReading, rcSelf, rcNull );
+    if ( s == NULL )
+        return RC( rcVDB, rcNoTarg, rcReading, rcParam, rcNull );
+
+    ctx.s = NULL;
+    ctx.len = 0;
+    VectorForEach ( &(self->nodes), false, num_gen_as_string_cb, &ctx );
+    if ( ctx.len == 0 )
+    {
+        *s = NULL;
+        return RC( rcVDB, rcNoTarg, rcReading, rcData, rcEmpty );
+    }
+    ctx.s[ ctx.len ] = 0;
+    *s = ctx.s;
+    return 0;
+}
+
+
+static void CC num_gen_debug_cb( void *item, void *data )
+{
+    char temp[40];
+    p_num_gen_node node = ( p_num_gen_node )item;
+    long unsigned int start = node->start;
+    long unsigned int count = node->count;
+    string_printf ( temp, sizeof temp, NULL, "[s:%lu c:%lu]", start, count );
+    string_ctx_add( ( p_string_ctx )data, temp );
+}
+
+
+rc_t num_gen_debug( const num_gen* self, char **s )
+{
+    string_ctx ctx;
+    
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcReading, rcSelf, rcNull );
+    if ( s == NULL )
+        return RC( rcVDB, rcNoTarg, rcReading, rcParam, rcNull );
+
+    ctx.s = NULL;
+    ctx.len = 0;
+    VectorForEach ( &(self->nodes), false, num_gen_debug_cb, &ctx );
+    if ( ctx.len == 0 )
+    {
+        *s = NULL;
+        return RC( rcVDB, rcNoTarg, rcReading, rcData, rcEmpty );
+    }
+    ctx.s[ ctx.len ] = 0;
+    *s = ctx.s;
+    return 0;
+}
+
+
+static bool CC num_gen_contains_cb( void *item, void *data )
+{
+    bool res = false;
+    p_num_gen_node node = ( p_num_gen_node )item;
+    if ( node->count > 0 )
+    {
+        uint64_t *value = ( uint64_t * )data;
+        uint64_t end = node->start + node->count - 1;
+        res = ( node->start <= *value && *value <= end );
+    }
+    return res;
+}
+
+
+rc_t num_gen_contains_value( const num_gen* self, const uint64_t value )
+{
+    uint64_t temp = value;
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcReading, rcSelf, rcNull );
+    if ( VectorDoUntil ( &(self->nodes), false, 
+                         num_gen_contains_cb, &temp ) )
+        return 0;
+    else
+        return RC( rcVDB, rcNoTarg, rcReading, rcData, rcEmpty );
+}
+
+
+rc_t num_gen_range_check( num_gen* self, 
+                          const int64_t first, const uint64_t count )
+{
+    /* if the user did not specify a row-range, take all rows */
+    if ( num_gen_empty( self ) )
+        return num_gen_add( self, first, count );
+    /* if the user did specify a row-range, check the boundaries */
+    else
+        return num_gen_trim( self, first, count );
+}
+
+
+rc_t num_gen_iterator_make( const num_gen* self, const num_gen_iter **iter )
+{
+    uint32_t count;
+    
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcReading, rcSelf, rcNull );
+    if ( iter == NULL )
+        return RC( rcVDB, rcNoTarg, rcReading, rcParam, rcNull );
+
+    *iter = NULL;
+    count = VectorLength( &(self->nodes) );
+    if ( count < 1 )
+        return RC( rcVDB, rcNoTarg, rcReading, rcParam, rcNull );
+    else
+    {
+        num_gen_iter *temp = calloc( 1, sizeof( num_gen_iter ) );
+        if ( temp == NULL )
+            return RC( rcVDB, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+        VectorInit( &(temp->nodes), 0, count );
+        num_gen_copy_vector( &(self->nodes), &(temp->nodes ) );
+        temp->total = num_gen_total_count( &(temp->nodes ) );
+        *iter = temp;
+    }
+    return 0;
+}
+
+rc_t num_gen_iterator_destroy( const num_gen_iter *self )
+{
+    num_gen_iter *temp;
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcDestroying, rcSelf, rcNull );
+
+    temp = (num_gen_iter *)self;
+    VectorWhack( &(temp->nodes), num_gen_node_destroy, NULL );
+    free( temp );
+    return 0;
+}
+
+rc_t num_gen_iterator_next( const num_gen_iter* self, uint64_t* value )
+{
+    num_gen_iter* temp;
+    p_num_gen_node node;
+    
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcReading, rcSelf, rcNull );
+    if ( value == NULL )
+        return RC( rcVDB, rcNoTarg, rcReading, rcParam, rcNull );
+    if ( self->curr_node >= VectorLength( &(self->nodes) ) )
+        return RC( rcVDB, rcNoTarg, rcReading, rcId, rcInvalid );
+
+    temp = ( num_gen_iter *)self;
+    *value = 0;
+    node = (p_num_gen_node)VectorGet( &(temp->nodes), temp->curr_node );
+    if ( node == NULL )
+        return RC( rcVDB, rcNoTarg, rcReading, rcItem, rcInvalid );
+
+    *value = node->start;
+    if ( node->count < 2 )
+        /* the node is a single-number-node, next node for next time */
+        temp->curr_node++;
+    else
+    {
+        /* the node is a number range, add the sub-position */
+        *value += temp->curr_node_sub_pos++;
+        /* if the sub-positions are use up, switch to next node */
+        if ( temp->curr_node_sub_pos >= node->count )
+        {
+            temp->curr_node++;
+            temp->curr_node_sub_pos = 0;
+        }
+    }
+    (temp->progress)++;
+    return 0;
+}
+
+
+rc_t num_gen_iterator_count( const num_gen_iter* self, uint64_t* count )
+{
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcReading, rcSelf, rcNull );
+    if ( count == NULL )
+        return RC( rcVDB, rcNoTarg, rcReading, rcParam, rcNull );
+    *count = self->total;
+    return 0;
+}
+
+
+rc_t num_gen_iterator_percent( const num_gen_iter* self, 
+                               const uint8_t fract_digits,
+                               uint32_t* value )
+{
+    uint32_t factor = 100;
+    if ( self == NULL )
+        return RC( rcVDB, rcNoTarg, rcReading, rcSelf, rcNull );
+    if ( value == NULL )
+        return RC( rcVDB, rcNoTarg, rcReading, rcParam, rcNull );
+    if ( fract_digits > 0 )
+    {
+        if ( fract_digits > 1 )
+            factor = 10000;
+        else
+            factor = 1000;
+    }
+        
+    if ( self->total > 0 )
+    {
+        if ( self->progress >= self->total )
+            *value = factor;
+        else
+        {
+            uint64_t temp = self->progress;
+            temp *= factor;
+            temp /= self->total;
+            *value = (uint16_t) temp;
+        }
+    }
+    else
+        *value = 0;
+    return 0;
+}
diff --git a/tools/qual-recalib-stat/num-gen.h b/tools/qual-recalib-stat/num-gen.h
new file mode 100644
index 0000000..5b0324f
--- /dev/null
+++ b/tools/qual-recalib-stat/num-gen.h
@@ -0,0 +1,225 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_num_gen_
+#define _h_num_gen_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _h_klib_vector_
+#include <klib/vector.h>
+#endif
+
+#ifndef _h_klib_rc_
+#include <klib/rc.h>
+#endif
+
+#ifndef _h_klib_text_
+#include <klib/text.h>
+#endif
+
+
+/*--------------------------------------------------------------------------
+ * A NUMBER GENERATOR
+ * 
+ *  input : string, for instance "3,6,8,12,44-49"
+ *  ouptut: sequence of integers, for instance 3,6,8,12,44,45,46,47,48,49
+ */
+
+
+/*--------------------------------------------------------------------------
+ * opaque number-generator and it's iterator
+ */
+typedef struct num_gen num_gen;
+typedef struct num_gen_iter num_gen_iter;
+
+
+/*--------------------------------------------------------------------------
+ * num_gen_make
+ *
+ *  creates a empty number-generator
+ *  or creates a number-generator and parses the string
+ *  or creates and presets it with a range
+ */
+rc_t num_gen_make( num_gen** self );
+rc_t num_gen_make_from_str( num_gen** self, const char *src );
+rc_t num_gen_make_from_range( num_gen** self, 
+                              const int64_t first, const uint64_t count );
+
+
+/*--------------------------------------------------------------------------
+ * num_gen_destroy
+ *
+ *  destroys a number-generator
+ */
+rc_t num_gen_destroy( num_gen* self );
+
+
+/*--------------------------------------------------------------------------
+ * num_gen_clear
+ *
+ *  resets a number-generator, to be empty just like after num_gen_make()
+ */
+rc_t num_gen_clear( num_gen* self );
+
+
+/*--------------------------------------------------------------------------
+ * num_gen_parse
+ *
+ *  parses a given string in this form: "3,6,8,12,44-49"
+ *  does not clear the number-generator before parsing
+ *  eventual overlaps with the previous content are consolidated
+ */
+rc_t num_gen_parse( num_gen* self, const char* src );
+
+
+/*--------------------------------------------------------------------------
+ * num_gen_add
+ *
+ *  inserts the given interval into the number-generator
+ *
+ *  num_gen_add( *g, 10, 30 )
+ *  is equivalent to:
+ *  num_gen_parse( *g, "10-39" );
+ *
+ *  eventual overlaps with the previous content are consolidated 
+ */
+rc_t num_gen_add( num_gen* self, const uint64_t first, const uint64_t count );
+
+
+/*--------------------------------------------------------------------------
+ * num_gen_trim
+ *
+ *  checks if the content of the number-generator is inside the given interval
+ *  removes or shortens internal nodes if necessary
+ */
+rc_t num_gen_trim( num_gen* self, const int64_t first, const uint64_t count );
+
+
+/*--------------------------------------------------------------------------
+ * num_gen_empty
+ *
+ *  checks if the generator has no ranges defined
+ */
+bool num_gen_empty( const num_gen* self );
+
+
+/*--------------------------------------------------------------------------
+ * num_gen_as_string
+ *
+ *  allocates a string that contains the generator as text
+ *  *s = "1-5,20,24-25"
+ *  caller has to free the string
+ */
+rc_t num_gen_as_string( const num_gen* self, char **s );
+
+
+/*--------------------------------------------------------------------------
+ * num_gen_debug
+ *
+ *  allocates a string that contains the internal intervals as text
+ *  *s = "[s:1 c:5][s:20 c:1][s:24 c:2]"
+ *  [s...start-value c:count]
+ *  caller has to free the string 
+ */
+rc_t num_gen_debug( const num_gen* self, char **s );
+
+
+/*--------------------------------------------------------------------------
+ * num_gen_contains_value
+ *
+ *  checks if the generator contains the given value
+ */
+rc_t num_gen_contains_value( const num_gen* self, const uint64_t value );
+
+
+/*--------------------------------------------------------------------------
+ * num_gen_range_check
+ *
+ *  if the generator is empty --> set it to the given range
+ *  if it is not empty ---------> trim it to the given range
+ */
+rc_t num_gen_range_check( num_gen* self, 
+                          const int64_t first, const uint64_t count );
+
+/*--------------------------------------------------------------------------
+ * num_gen_iterator_make
+ *
+ *  creates a iterator from the number-generator
+ *  the iterator contains a constant copy of the number-ranges
+ *  after this call it is safe to destroy or change the number-generator
+ *  returns an error-code if the number-generator was empty,
+ *  and *iter will be NULL
+ */
+rc_t num_gen_iterator_make( const num_gen* self, const num_gen_iter **iter );
+
+
+/*--------------------------------------------------------------------------
+ * num_gen_iterator_destroy
+ *
+ *  destroys the iterator
+ */
+rc_t num_gen_iterator_destroy( const num_gen_iter *self );
+
+
+/*--------------------------------------------------------------------------
+ * num_gen_iterator_count
+ *
+ *  returns how many values the iterator contains
+ */
+rc_t num_gen_iterator_count( const num_gen_iter* self, uint64_t* count );
+
+
+/*--------------------------------------------------------------------------
+ * num_gen_iterator_next
+ *
+ *  pulls the next value out of the iterator...
+ *  returns an error-code if the iterator has no more values
+ */
+rc_t num_gen_iterator_next( const num_gen_iter* self, uint64_t* value );
+
+
+/*--------------------------------------------------------------------------
+ * num_gen_iterator_percent
+ *
+ *  return in value the percentage of the iterator...
+ *  depending on fract-digits the percentage will be:
+ *      fract_digits = 0 ... full percent's
+ *      fract_digits = 1 ... 1/10-th of a percent
+ *      fract_digits = 2 ... 1/100-th of a percent
+ */
+rc_t num_gen_iterator_percent( const num_gen_iter* self,
+                               const uint8_t fract_digits,
+                               uint32_t* value );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/qual-recalib-stat/progressbar.c b/tools/qual-recalib-stat/progressbar.c
new file mode 100644
index 0000000..7e0ab38
--- /dev/null
+++ b/tools/qual-recalib-stat/progressbar.c
@@ -0,0 +1,182 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <klib/out.h>
+#include <klib/rc.h>
+#include <sysalloc.h>
+#include <stdlib.h>
+
+typedef struct progressbar
+{
+    bool initialized;
+    uint16_t percent;
+} progressbar;
+
+
+rc_t make_progressbar( progressbar ** pb )
+{
+    if ( pb == NULL )
+        return RC( rcVDB, rcNoTarg, rcConstructing, rcSelf, rcNull );
+    (*pb) = calloc( 1, sizeof( progressbar ) );
+    if ( *pb == NULL )
+        return RC( rcVDB, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+    return 0;
+}
+
+
+rc_t destroy_progressbar( progressbar * pb )
+{
+    if ( pb == NULL )
+        return RC( rcVDB, rcNoTarg, rcDestroying, rcSelf, rcNull );
+    free( pb );
+    return 0;
+}
+
+static void progess_0a( const uint16_t percent )
+{
+    OUTMSG (( "| %2u%%", percent ));
+}
+
+static void progess_0( const uint16_t percent )
+{
+    if ( percent & 1 )
+        OUTMSG (( "\b\b\b\b- %2u%%", percent ));
+    else
+        OUTMSG (( "\b\b\b%2u%%", percent ));
+}
+
+static void progess_1a( const uint16_t percent )
+{
+    uint16_t p1 = percent / 10;
+    uint16_t p0 = percent - ( p1 * 10 );
+    OUTMSG (( "| %2u.%01u%%", p1, p0 ));
+}
+
+static void progess_1( const uint16_t percent )
+{
+    uint16_t p1 = percent / 10;
+    uint16_t p0 = percent - ( p1 * 10 );
+    if ( ( p1 & 1 )&&( p0 == 0 ) )
+        OUTMSG (( "\b\b\b\b\b\b- %2u.%01u%%", p1, p0 ));
+    else
+        OUTMSG (( "\b\b\b\b\b%2u.%01u%%", p1, p0 ));
+}
+
+static void progess_2a( const uint16_t percent )
+{
+    uint16_t p1 = percent / 100;
+    uint16_t p0 = percent - ( p1 * 100 );
+    OUTMSG (( "| %2u.%02u%%", p1, p0 ));
+}
+
+static void progess_2( const uint16_t percent )
+{
+    uint16_t p1 = percent / 100;
+    uint16_t p0 = percent - ( p1 * 100 );
+    if ( ( p1 & 1 )&&( p0 == 0 ) )
+        OUTMSG (( "\b\b\b\b\b\b\b- %2u.%02u%%", p1, p0 ));
+    else
+        OUTMSG (( "\b\b\b\b\b\b%2u.%02u%%", p1, p0 ));
+}
+
+rc_t update_progressbar( progressbar * pb, const uint8_t fract_digits,
+                         const uint16_t percent )
+{
+    uint8_t digits = fract_digits;
+    if ( pb == NULL )
+        return RC( rcVDB, rcNoTarg, rcParsing, rcSelf, rcNull );
+    if ( digits > 2 )
+        digits = 2;
+    if ( pb->initialized )
+    {
+        if ( pb->percent != percent )
+        {
+            pb->percent = percent;
+            switch( digits )
+            {
+            case 0 : progess_0( percent ); break;
+            case 1 : progess_1( percent ); break;
+            case 2 : progess_2( percent ); break;
+            }
+        }
+    }
+    else
+    {
+        pb->percent = percent;
+        switch( digits )
+        {
+        case 0 : progess_0a( percent ); break;
+        case 1 : progess_1a( percent ); break;
+        case 2 : progess_2a( percent ); break;
+        }
+        pb->initialized = true;
+    }
+    return 0;
+}
+
+
+uint8_t progressbar_calc_fract_digits( const uint64_t count )
+{
+    uint8_t res = 0;
+    if ( count > 10000 )
+    {
+        if ( count > 100000 )
+            res = 2;
+        else
+            res = 1;
+    }
+    return res;
+}
+
+
+uint32_t progressbar_percent( const uint64_t count, const uint64_t value,
+                              const uint8_t fract_digits )
+{
+    uint32_t factor = 100;
+    uint32_t res = 0;
+
+    if ( fract_digits > 0 )
+    {
+        if ( fract_digits > 1 )
+            factor = 10000;
+        else
+            factor = 1000;
+    }
+        
+    if ( count > 0 )
+    {
+        if ( value >= count )
+            res = factor;
+        else
+        {
+            uint64_t temp = value;
+            temp *= factor;
+            temp /= count;
+            res = (uint16_t) temp;
+        }
+    }
+    return res;
+}
diff --git a/tools/qual-recalib-stat/progressbar.h b/tools/qual-recalib-stat/progressbar.h
new file mode 100644
index 0000000..f5f04bc
--- /dev/null
+++ b/tools/qual-recalib-stat/progressbar.h
@@ -0,0 +1,75 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_progressbar_
+#define _h_progressbar_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct progressbar progressbar;
+
+/*--------------------------------------------------------------------------
+ * make_progressbar
+ *
+ *  creates a progressbar with zero-values inside
+ *  does not output anything
+ */
+rc_t make_progressbar( progressbar ** pb );
+
+
+/*--------------------------------------------------------------------------
+ * destroy_progressbar
+ *
+ *  destroy's the progressbar
+ *  does not output anything
+ */
+rc_t destroy_progressbar( progressbar * pb );
+
+
+/*--------------------------------------------------------------------------
+ * update_progressbar
+ *
+ *  sets the progressbar to a specific percentage
+ *  outputs only if the percentage has changed from the last call
+ *  the precentage is in 1/10-th of a percent ( 21,6% = 216 )
+ *  expects the percents in increasing order ( does not jump back )
+ *  writes a growing bar made from '-'-chars every 2nd percent
+ */
+rc_t update_progressbar( progressbar * pb, const uint8_t fract_digits,
+                         const uint16_t percent );
+
+uint8_t progressbar_calc_fract_digits( const uint64_t count );
+
+uint32_t progressbar_percent( const uint64_t count, const uint64_t value,
+                              const uint8_t fract_digits );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/qual-recalib-stat/qual-recalib-stat.c b/tools/qual-recalib-stat/qual-recalib-stat.c
new file mode 100644
index 0000000..f926883
--- /dev/null
+++ b/tools/qual-recalib-stat/qual-recalib-stat.c
@@ -0,0 +1,421 @@
+/*==============================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+#include "qual-recalib-stat.vers.h"
+#include <kapp/main.h>
+
+#include <vdb/manager.h>
+#include <vdb/schema.h>
+#include <vdb/database.h>
+#include <vdb/table.h>
+#include <vdb/cursor.h>
+
+#include <kfs/directory.h>
+#include <kfs/file.h>
+#include <klib/log.h>
+#include <klib/out.h>
+#include <klib/printf.h>
+
+#include "context.h"
+#include "progressbar.h"
+#include "stat_mod_2.h"
+#include "reader.h"
+#include "writer.h"
+
+#include <sysalloc.h>
+#include <stdlib.h>
+#include <string.h>
+
+const char UsageDefaultName[] = "qual-recalib-stat";
+
+static const char * rows_usage[] = { "set of rows to be analyzed (default = all)", NULL };
+static const char * schema_usage[] = { "schema-names", NULL };
+static const char * show_progress_usage[] = { "show progress in percent while analyzing", NULL };
+static const char * outfile_usage[] = { "file to write output into", NULL };
+static const char * outmode_usage[] = { "where to write [file,db,tab] (dflt = file)", NULL };
+static const char * gcwindow_usage[] = { "how many bases are counted (dflt = 7)", NULL };
+static const char * exclude_usage[] = { "path to db with ref-positions to be excluded", NULL };
+static const char * info_usage[] = { "display info's after the process", NULL };
+static const char * ignore_mismatch_usage[] = { "ignore mismatches", NULL };
+
+OptDef MyOptions[] =
+{
+    { OPTION_ROWS, ALIAS_ROWS, NULL, rows_usage, 1, true, false },
+    { OPTION_SCHEMA, ALIAS_SCHEMA, NULL, schema_usage, 5, true, false },
+    { OPTION_SHOW_PROGRESS, ALIAS_SHOW_PROGRESS, NULL, show_progress_usage, 1, false, false },
+    { OPTION_OUTFILE, ALIAS_OUTFILE, NULL, outfile_usage, 1, true, false },
+    { OPTION_OUTMODE, ALIAS_OUTMODE, NULL, outmode_usage, 1, true, false },
+    { OPTION_GCWINDOW, ALIAS_GCWINDOW, NULL, gcwindow_usage, 1, true, false },
+    { OPTION_EXCLUDE, ALIAS_EXCLUDE, NULL, exclude_usage, 1, true, false },
+    { OPTION_INFO, ALIAS_INFO, NULL, info_usage, 1, false, false },
+    { OPTION_IGNORE_MISMATCH, ALIAS_IGNORE_MISMATCH, NULL, ignore_mismatch_usage, 1, false, false }
+};
+
+
+rc_t CC UsageSummary ( const char * progname )
+{
+    return KOutMsg ( "\n"
+                     "Usage:\n"
+                     "  %s <path> [options]\n"
+                     "\n", progname );
+}
+
+
+rc_t CC Usage( const Args * args  )
+{
+    const char * progname = UsageDefaultName;
+    const char * fullpath = UsageDefaultName;
+    rc_t rc;
+
+    if ( args == NULL )
+        rc = RC ( rcApp, rcArgv, rcAccessing, rcSelf, rcNull );
+    else
+        rc = ArgsProgram( args, &fullpath, &progname );
+    if ( rc != 0 )
+        progname = fullpath = UsageDefaultName;
+
+    UsageSummary( progname );
+    KOutMsg ("Options:\n");
+    HelpOptionLine ( ALIAS_ROWS, OPTION_ROWS, "rows", rows_usage );
+    HelpOptionLine ( ALIAS_SCHEMA, OPTION_SCHEMA, "schema", schema_usage );
+    HelpOptionLine ( ALIAS_SHOW_PROGRESS, OPTION_SHOW_PROGRESS, NULL, show_progress_usage );
+    HelpOptionLine ( ALIAS_OUTFILE, OPTION_OUTFILE, NULL, outfile_usage );
+    HelpOptionLine ( ALIAS_OUTMODE, OPTION_OUTMODE, NULL, outmode_usage );
+    HelpOptionLine ( ALIAS_GCWINDOW, OPTION_GCWINDOW, NULL, gcwindow_usage );
+    HelpOptionLine ( ALIAS_EXCLUDE, OPTION_EXCLUDE, NULL, exclude_usage );
+    HelpOptionLine ( ALIAS_INFO, OPTION_INFO, NULL, info_usage );
+    HelpOptionLine ( ALIAS_IGNORE_MISMATCH, OPTION_IGNORE_MISMATCH, NULL, ignore_mismatch_usage );
+    HelpOptionsStandard();
+    HelpVersion( fullpath, KAppVersion() );
+    return rc;
+}
+
+
+/* Version  EXTERN
+ *  return 4-part version code: 0xMMmmrrrr, where
+ *      MM = major release
+ *      mm = minor release
+ *    rrrr = bug-fix release
+ */
+ver_t CC KAppVersion ( void )
+{
+    return QUAL_RECALIB_STAT_VERS;
+}
+
+
+static uint8_t calc_fract_digits( const num_gen_iter *iter )
+{
+    uint8_t res = 0;
+    uint64_t count;
+    if ( num_gen_iterator_count( iter, &count ) == 0 )
+    {
+        res = progressbar_calc_fract_digits( count );
+    }
+    return res;
+}
+
+
+static rc_t read_loop( statistic * data,
+                       context *ctx,
+                       statistic_reader *reader,
+                       const VCursor *my_cursor )
+{
+    int64_t first;
+    uint64_t count;
+    rc_t rc = query_reader_rowrange( reader, &first, &count );
+    if ( rc != 0 )
+        LogErr( klogInt, rc, "query_statistic_rowrange() failed\n" );
+    else
+    {
+        if ( num_gen_empty( ctx->row_generator ) )
+        {
+            rc = num_gen_add( ctx->row_generator, first, count );
+            if ( rc != 0 )
+                LogErr( klogInt, rc, "num_gen_add() failed() failed\n" );
+        }
+        else
+        {
+            rc = num_gen_trim( ctx->row_generator, first, count );
+            if ( rc != 0 )
+                LogErr( klogInt, rc, "num_gen_trim() failed() failed\n" );
+        }
+
+        if ( rc == 0 )
+        {
+            const num_gen_iter *iter;
+            rc = num_gen_iterator_make( ctx->row_generator, &iter );
+            if ( rc != 0 )
+                LogErr( klogInt, rc, "num_gen_iterator_make() failed\n" );
+            else
+            {
+                uint64_t row_id;
+                progressbar * progress;
+
+                rc = make_progressbar( &progress );
+                if ( rc != 0 )
+                    LogErr( klogInt, rc, "make_progressbar() failed\n" );
+                else
+                {
+                    uint8_t fract_digits = calc_fract_digits( iter );
+                    uint32_t percent;
+                    row_input row_data;
+
+                    while ( ( num_gen_iterator_next( iter, &row_id ) == 0 )&&
+                            ( rc == 0 ) )
+                    {
+                        rc = Quitting();
+                        if ( rc == 0 )
+                        {
+                            /* ******************************************** */
+                            rc = reader_get_data( reader, &row_data, row_id );
+                            if ( rc == 0 )
+                            {
+                                rc = extract_statistic_from_row( data, &row_data, row_id );
+                            }
+                            /* ******************************************** */
+                            if ( ctx->show_progress )
+                                if ( num_gen_iterator_percent( iter, fract_digits, &percent ) == 0 )
+                                    update_progressbar( progress, fract_digits, percent );
+                        }
+                    }
+                    destroy_progressbar( progress );
+                    if ( ctx->show_progress )
+                        OUTMSG(( "\n" ));
+                }
+                num_gen_iterator_destroy( iter );
+            }
+        }
+    }
+    return rc;
+}
+
+
+static rc_t read_statistic_from_table( statistic * data,
+                                       KDirectory *dir,
+                                       context *ctx,
+                                       const VDatabase *my_database,
+                                       const char *table_name )
+{
+    const VTable *my_table;
+    rc_t rc = VDatabaseOpenTableRead( my_database, &my_table, "%s", table_name );
+    if ( rc != 0 )
+    {
+        LogErr( klogInt, rc, "VDatabaseOpenTableRead() failed\n" );
+    }
+    else
+    {
+        const VCursor *my_cursor;
+        rc = VTableCreateCursorRead( my_table, &my_cursor );
+        if ( rc != 0 )
+            LogErr( klogInt, rc, "VTableCreateCursorRead() failed\n" );
+        else
+        {
+/*
+            spot_pos sequence;
+
+            rc = make_spot_pos( &sequence, my_database );
+            if ( rc == 0 )
+            {
+*/
+                statistic_reader reader;
+
+/*
+                rc = make_statistic_reader( &reader, &sequence, dir, my_cursor,
+                            ctx->exclude_file_path, ctx->info );
+*/
+                rc = make_statistic_reader( &reader, NULL, dir, my_cursor,
+                            ctx->exclude_file_path, ctx->info );
+
+                if ( rc == 0 )
+                {
+                    /* ******************************************************* */
+                    rc = read_loop( data, ctx, &reader, my_cursor );
+                    /* ******************************************************* */
+                    whack_reader( &reader );
+                }
+/*
+                whack_spot_pos( &sequence );
+            }
+*/
+            VCursorRelease( my_cursor );
+        }
+        VTableRelease( my_table );
+    }
+    return rc;
+}
+
+
+static rc_t gather_statistic( statistic * data,
+                              KDirectory *dir,
+                              context *ctx )
+{
+    VDBManager *my_manager;
+    /* because this tool is linked against the write-version
+       of vdb and kdb, there is no Read-Manager available... */
+    rc_t rc = VDBManagerMakeUpdate ( &my_manager, dir );
+    if ( rc != 0 )
+        LogErr( klogInt, rc, "VDBManagerMakeUpdate() failed\n" );
+    else
+    {
+        const VDatabase *my_database;
+        rc = VDBManagerOpenDBRead( my_manager, &my_database, NULL, "%s", ctx->src_path );
+        if ( rc != 0 )
+            LogErr( klogInt, rc, "VDBManagerOpenDBRead() failed\n" );
+        else
+        {
+            /* ******************************************************* */
+            rc = read_statistic_from_table( data, dir, ctx, my_database,
+                                            "PRIMARY_ALIGNMENT" );
+            /* ******************************************************* */
+            VDatabaseRelease( my_database );
+        }
+        VDBManagerRelease( my_manager );
+    }
+    return rc;
+}
+
+
+static rc_t gater_and_write( context *ctx )
+{
+    KDirectory *dir;
+    rc_t rc = KDirectoryNativeDir( &dir );
+    if ( rc != 0 )
+        LogErr( klogInt, rc, "KDirectoryNativeDir() failed\n" );
+    else
+    {
+        statistic data;
+        rc = make_statistic( &data, ctx->gc_window, ctx->ignore_mismatch );
+        if ( rc == 0 )
+        {
+            rc = gather_statistic( &data, dir, ctx ); /* <--- the meat */
+            if ( rc == 0 )
+            {
+                uint64_t written;
+
+                if ( ctx->show_progress )
+                {
+                    OUTMSG(( "%lu statistic-entries gathered\n", data.entries ));
+                    OUTMSG(( "max. cycles per read = %u\n", data.max_cycle ));
+                }
+
+                switch( ctx->output_mode[ 0 ] )
+                {
+                case 'f' :  if ( ctx->output_file_path != NULL )
+                            {
+                                rc = write_output_file( dir, &data,
+                                        ctx->output_file_path, &written );
+                                if ( rc == 0 && ctx->info )
+                                {
+                                    OUTMSG(( "%lu lines written to '%s'\n", 
+                                            written, ctx->output_file_path ));
+                                }
+                            }
+                            else
+                                OUTMSG(( "the output-path is missing!\n" ));
+                            break;
+
+                case 'd' :  rc = write_statistic_into_db( dir, &data,
+                                    ctx->src_schema_list, ctx->src_path, &written,
+                                    ctx->show_progress );
+                            if ( rc == 0 && ctx->info )
+                            {
+                                OUTMSG(( "%lu rows written to database\n", written ));
+                            }
+                            break;
+
+                case 't' :  if ( ctx->output_file_path != NULL )
+                            {
+                                rc = write_statistic_into_tab( dir, &data, 
+                                        ctx->src_schema_list, ctx->output_file_path, &written,
+                                        ctx->show_progress );
+                                if ( rc == 0 && ctx->info )
+                                {
+                                    OUTMSG(( "%lu rows written to table\n", written ));
+                                }
+                            }
+                            else
+                            {
+                                OUTMSG(( "the output-path is missing!\n" ));
+                            }
+                            break;
+                }
+            }
+            whack_statistic( &data );
+        }
+        KDirectoryRelease( dir );
+    }
+    return rc;
+}
+
+
+rc_t CC KMain( int argc, char * argv[] )
+{
+    Args * args;
+    rc_t rc = ArgsMakeAndHandle ( &args, argc, argv, 1,
+                             MyOptions, sizeof MyOptions / sizeof ( OptDef ) );
+    if ( rc != 0 )
+        LogErr( klogInt, rc, "ArgsMakeAndHandle() failed\n" );
+    else
+    {
+        context *ctx;
+        KLogHandlerSetStdErr();
+        rc = context_init( &ctx );
+        if ( rc != 0 )
+            LogErr( klogInt, rc, "context_init() failed\n" );
+        else
+        {
+            rc = context_capture_arguments_and_options( args, ctx );
+            if ( rc != 0 )
+                LogErr( klogInt, rc, "context_capture_arguments_and_options() failed\n" );
+            else
+            {
+                if ( ctx->usage_requested )
+                    MiniUsage( args );
+                else
+                {
+                    switch( ctx->output_mode[ 0 ] )
+                    {
+                        case 'd' :
+                        case 't' : if ( context_schema_count( ctx ) == 0 )
+                                    {
+                                        OUTMSG(( "cannot write, schema-file is missing:\n" ));
+                                        Usage( args  );
+                                        rc = RC( rcApp, rcNoTarg, rcConstructing, rcSelf, rcNull );
+                                    }
+                    }
+                    if ( rc == 0 )
+                    {
+                        /* ************************* */
+                        rc = gater_and_write( ctx );
+                        /* ************************* */
+                    }
+                }
+            }
+            context_destroy ( ctx );
+        }
+        ArgsWhack ( args );
+    }
+    return rc;
+}
diff --git a/tools/qual-recalib-stat/qual-recalib-stat.vers b/tools/qual-recalib-stat/qual-recalib-stat.vers
new file mode 100644
index 0000000..8e8299d
--- /dev/null
+++ b/tools/qual-recalib-stat/qual-recalib-stat.vers
@@ -0,0 +1 @@
+2.4.2
diff --git a/tools/qual-recalib-stat/qual-recalib-stat.vers.h b/tools/qual-recalib-stat/qual-recalib-stat.vers.h
new file mode 100644
index 0000000..bb1ba3d
--- /dev/null
+++ b/tools/qual-recalib-stat/qual-recalib-stat.vers.h
@@ -0,0 +1 @@
+#define QUAL_RECALIB_STAT_VERS 0x02040002
diff --git a/tools/qual-recalib-stat/reader.c b/tools/qual-recalib-stat/reader.c
new file mode 100644
index 0000000..fe32a69
--- /dev/null
+++ b/tools/qual-recalib-stat/reader.c
@@ -0,0 +1,241 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "reader.h"
+
+#include <sysalloc.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+static const char * ridx_names[ N_RIDX ] =
+{
+    "RAW_READ",
+    "QUALITY",
+    "(bool)HAS_MISMATCH",
+    "SEQ_SPOT_ID",
+    "SPOT_GROUP",
+    "SEQ_SPOT_GROUP",
+    "REF_ORIENTATION",
+    "READ_LEN",
+    "SEQ_READ_ID",
+    "(bool)HAS_REF_OFFSET",
+    "REF_OFFSET",
+    "REF_POS",
+    "REF_SEQ_ID",
+    "REF_LEN"
+};
+
+static rc_t make_vector( void ** ptr, uint32_t *len, uint32_t new_len )
+{
+    rc_t rc = 0;
+
+    *len = new_len;
+    *ptr = calloc( 1, new_len );
+    if ( *ptr == NULL )
+    {
+        *len = 0;
+        rc = RC( rcApp, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+        LogErr( klogInt, rc, "failed to make large enough exclude-vector\n" );
+    }
+    return rc;
+}
+
+
+static rc_t expand_and_clear_vector( void **v, uint32_t *len, uint32_t new_len, bool clear )
+{
+    rc_t rc = 0;
+    if ( *v != NULL )
+    {
+        if ( *len < new_len )
+        {
+            *len += new_len;
+            *v = realloc( *v, *len );
+            if ( *v == NULL )
+            {
+                rc = RC( rcApp, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+                LogErr( klogInt, rc, "failed to expand (uint8_t)vector\n" );
+            }
+        }
+        if ( rc == 0 && clear )
+            memset( *v, 0, *len ); 
+    }
+    return rc;
+}
+
+
+rc_t make_statistic_reader( statistic_reader *self,
+                            spot_pos *sequence,
+                            KDirectory *dir,
+                            const VCursor * cursor,
+                            const char * exclude_db,
+                            bool info )
+{
+    rc_t rc;
+
+    memset( &self->rd_col, 0, sizeof self->rd_col );
+    self->cursor = cursor;
+    self->ref_exclude_used = false;
+    self->exclude_vector = NULL;
+    self->exclude_vector_len = 0;
+    self->active_exclusions = 0;
+    self->sequence = sequence;
+
+    rc = add_columns( cursor, self->rd_col, ridx_names, N_RIDX );
+    if ( rc == 0 )
+    {
+        rc = VCursorOpen ( cursor );
+        if ( rc != 0 )
+            LogErr( klogInt, rc, "VCursorOpen failed in reader\n" );
+    }
+    if ( rc == 0 )
+    if ( exclude_db != NULL )
+    {
+        make_ref_exclude( &self->exclude, dir, exclude_db, info );
+        rc = make_vector( (void**)&self->exclude_vector, &self->exclude_vector_len, 512 );
+        self->ref_exclude_used = true;
+    }
+
+    return rc;
+}
+
+
+void whack_reader( statistic_reader *self )
+{
+    if ( self->ref_exclude_used )
+    {
+        whack_ref_exclude( &self->exclude );
+        if ( self->exclude_vector != NULL )
+        {
+            free( self->exclude_vector );
+        }
+    }
+}
+
+
+void reader_set_spot_pos( statistic_reader *self, spot_pos * sequence )
+{
+    self->sequence = sequence;
+}
+
+rc_t query_reader_rowrange( statistic_reader *self, int64_t *first, uint64_t * count )
+{
+    rc_t rc = VCursorIdRange ( self->cursor, self->rd_col[ RIDX_READ ].idx,
+                               first, count );
+    if ( rc != 0 )
+        LogErr( klogInt, rc, "VCursorIdRange() failed in reader\n" );
+    return rc;
+}
+
+
+rc_t reader_get_data( statistic_reader *self, row_input * row_data,
+                      uint64_t row_id )
+{
+    rc_t rc = read_cells( self->cursor, row_id, self->rd_col, ridx_names, N_RIDX );
+    if ( rc == 0 )
+    {
+        bool * reverse;
+
+        row_data->spotgroup = (char *)self->rd_col[ RIDX_SPOT_GROUP ].base;
+        row_data->spotgroup_len = self->rd_col[ RIDX_SPOT_GROUP ].row_len;
+
+        row_data->seq_spotgroup = (char *)self->rd_col[ RIDX_SEQ_SPOT_GROUP ].base;
+        row_data->seq_spotgroup_len = self->rd_col[ RIDX_SEQ_SPOT_GROUP ].row_len;
+
+        row_data->read = (char *)self->rd_col[ RIDX_READ ].base;
+        row_data->read_len = self->rd_col[ RIDX_READ ].row_len;
+
+        row_data->quality = (uint8_t *)self->rd_col[ RIDX_QUALITY ].base;
+        row_data->quality_len = self->rd_col[ RIDX_QUALITY ].row_len;
+
+        row_data->has_mismatch = (bool *)self->rd_col[ RIDX_HAS_MISMATCH ].base;
+        row_data->has_mismatch_len = self->rd_col[ RIDX_HAS_MISMATCH ].row_len;
+
+        row_data->has_roffs = (bool *)self->rd_col[ RIDX_HAS_REF_OFFSET ].base;
+        row_data->has_roffs_len = self->rd_col[ RIDX_HAS_REF_OFFSET ].row_len;
+
+        row_data->roffs = (int32_t *)self->rd_col[ RIDX_REF_OFFSET ].base;
+        row_data->roffs_len = self->rd_col[ RIDX_REF_OFFSET ].row_len;
+
+        reverse = (bool *)self->rd_col[ RIDX_REF_ORIENTATION ].base;
+        row_data->reversed = *reverse;
+
+        row_data->seq_read_id = *( ( uint32_t * )self->rd_col[ RIDX_SEQ_READ_ID ].base );
+        row_data->spot_id = *( ( uint32_t * )self->rd_col[ RIDX_SEQ_SPOT_ID ].base );
+        row_data->base_pos_offset = 0;
+        row_data->ref_len = *( ( uint32_t *)self->rd_col[ RIDX_REF_LEN ].base );
+#ifdef LOOKUP_ALL_SEQ_READ_ID
+        if ( row_data->seq_read_id > 0 )
+#else
+        if ( row_data->seq_read_id > 1 )
+#endif
+        {
+            if ( self->sequence != NULL )
+            {
+                query_spot_pos( self->sequence, row_data->seq_read_id,
+                            row_data->spot_id, &(row_data->base_pos_offset) );
+            }
+        }
+
+        if ( self->ref_exclude_used )
+        {
+            String s_ref_name;
+
+            const char * ref_name_base = ( const char * )self->rd_col[ RIDX_REF_SEQ_ID ].base;
+            uint32_t ref_name_len = self->rd_col[ RIDX_REF_SEQ_ID ].row_len;
+            int32_t ref_offset = *( ( int32_t *)self->rd_col[ RIDX_REF_POS ].base );
+            uint32_t ref_len = *( ( uint32_t *)self->rd_col[ RIDX_REF_LEN ].base );
+
+            StringInit( &s_ref_name, ref_name_base, ref_name_len, ref_name_len );
+
+            /* make the ref-exclude-vector longer if necessary */
+            rc = expand_and_clear_vector( (void**)&self->exclude_vector,
+                                          &self->exclude_vector_len,
+                                          ref_len,
+                                          true );
+            if ( rc == 0 )
+            {
+                rc = get_ref_exclude( &self->exclude,
+                                      &s_ref_name,
+                                      ref_offset,
+                                      ref_len,
+                                      self->exclude_vector,
+                                      &self->active_exclusions );
+                if ( rc == 0 )
+                {
+                    row_data->exclude = self->exclude_vector;
+                    row_data->exclude_len = ref_len;
+                }
+            }
+        }
+        else
+        {
+            row_data->exclude = NULL;
+            row_data->exclude_len = 0;
+        }
+    }
+    return rc;
+}
diff --git a/tools/qual-recalib-stat/reader.h b/tools/qual-recalib-stat/reader.h
new file mode 100644
index 0000000..7dea1c7
--- /dev/null
+++ b/tools/qual-recalib-stat/reader.h
@@ -0,0 +1,88 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_stat_reader_
+#define _h_stat_reader_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <klib/rc.h>
+#include <vdb/cursor.h>
+#include "columns.h"
+#include "ref_exclude.h"
+#include "stat_mod_2.h"
+#include "spot_position.h"
+
+#define RIDX_READ            0
+#define RIDX_QUALITY         1
+#define RIDX_HAS_MISMATCH    2
+#define RIDX_SEQ_SPOT_ID     3
+#define RIDX_SPOT_GROUP      4
+#define RIDX_SEQ_SPOT_GROUP  5
+#define RIDX_REF_ORIENTATION 6
+#define RIDX_READ_LEN        7
+#define RIDX_SEQ_READ_ID     8
+#define RIDX_HAS_REF_OFFSET  9
+#define RIDX_REF_OFFSET     10
+#define RIDX_REF_POS        11
+#define RIDX_REF_SEQ_ID     12
+#define RIDX_REF_LEN        13
+#define N_RIDX              14
+
+typedef struct statistic_reader
+{
+    ref_exclude exclude;
+    uint8_t *exclude_vector;
+    uint32_t exclude_vector_len;
+    uint32_t active_exclusions;
+    bool ref_exclude_used;
+    const VCursor *cursor;
+    col rd_col[ N_RIDX ];
+    spot_pos * sequence;
+} statistic_reader;
+
+rc_t make_statistic_reader( statistic_reader *self,
+                            spot_pos *sequence,
+                            KDirectory *dir,
+                            const VCursor * cursor,
+                            const char * exclude_db,
+                            bool info );
+
+void whack_reader( statistic_reader *self );
+
+void reader_set_spot_pos( statistic_reader *self, spot_pos * sequence );
+
+rc_t query_reader_rowrange( statistic_reader *self, int64_t *first, uint64_t * count );
+
+rc_t reader_get_data( statistic_reader *self, row_input * row_data, uint64_t row_id );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/qual-recalib-stat/ref_exclude.c b/tools/qual-recalib-stat/ref_exclude.c
new file mode 100644
index 0000000..327b0c0
--- /dev/null
+++ b/tools/qual-recalib-stat/ref_exclude.c
@@ -0,0 +1,561 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "ref_exclude.h"
+#include "columns.h"
+#include <klib/printf.h>
+#include <klib/out.h>
+#include <sysalloc.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define MAXLEN_COLUMN   "MAX_SEQ_LEN"
+#define HITS_COLUMN     "HITS"
+#define HITMAP_TAB      "HITMAP"
+
+
+typedef struct trans_node
+{
+    BSTNode node;
+    String chromosome;
+    String translation;
+} trans_node;
+
+
+static trans_node * make_trans_node( const char * chromosome, const char * translation )
+{
+    trans_node * res = calloc( 1, sizeof * res );
+    if ( res != NULL )
+    {
+        StringInitCString( &(res->chromosome), chromosome );
+        StringInitCString( &(res->translation), translation );
+    }
+    return res;
+}
+
+
+static void CC whack_trans_node( BSTNode *n, void *data )
+{
+    free( n );
+}
+
+
+static int CC trans_node_find( const void *item, const BSTNode *n )
+{
+    trans_node * node = ( trans_node * ) n;
+    return StringCompare ( ( String * ) item, &node->chromosome );
+}
+
+
+#define N_TRANS_NODES 24
+
+static const char * chromosomes[ N_TRANS_NODES ] =
+{
+    "CM000663.1",
+    "CM000664.1",
+    "CM000665.1",
+    "CM000666.1",
+    "CM000667.1",
+    "CM000668.1",
+    "CM000669.1",
+    "CM000670.1",
+    "CM000671.1",
+    "CM000672.1",
+    "CM000673.1",
+    "CM000675.1",
+    "CM000674.1",
+    "CM000676.1",
+    "CM000677.1",
+    "CM000678.1",
+    "CM000679.1",
+    "CM000680.1",
+    "CM000681.1",
+    "CM000682.1",
+    "CM000683.1",
+    "CM000684.1",
+    "CM000685.1",
+    "CM000686.1"
+};
+
+
+static const char * translations[ N_TRANS_NODES ] =
+{
+    "NC_000001.10",
+    "NC_000002.11",
+    "NC_000003.11",
+    "NC_000004.11",
+    "NC_000005.9",
+    "NC_000006.11",
+    "NC_000007.13",
+    "NC_000008.10",
+    "NC_000009.11",
+    "NC_000010.10",
+    "NC_000011.9",
+    "NC_000013.10",
+    "NC_000012.11",
+    "NC_000014.8",
+    "NC_000015.9",
+    "NC_000016.9",
+    "NC_000017.10",
+    "NC_000018.9",
+    "NC_000019.9",
+    "NC_000020.10",
+    "NC_000021.8",
+    "NC_000022.10",
+    "NC_000023.10",
+    "NC_000024.9"
+};
+
+
+static int CC trans_node_sort( const BSTNode *item, const BSTNode *n )
+{
+    trans_node * rn1 = ( trans_node* ) item;
+    trans_node * rn2 = ( trans_node* ) n;
+    return StringCompare ( &rn1->chromosome, &rn2->chromosome );
+}
+
+
+static rc_t insert_trans_nodes( BSTree *tree )
+{
+    rc_t rc = 0;
+    uint32_t idx;
+    for ( idx = 0; idx < N_TRANS_NODES && rc == 0; ++idx )
+    {
+        trans_node * node = make_trans_node( chromosomes[ idx ], translations[ idx ] );
+        if ( node != NULL )
+        {
+            rc = BSTreeInsert ( tree, (BSTNode *)node, trans_node_sort );
+        }
+    }
+    return rc;
+}
+
+/******************************************************************************/
+
+typedef struct ref_node
+{
+    BSTNode node;
+    const String *name;
+    bool valid;
+    const VDatabase *db;
+    const VTable *tab;
+    const VCursor *cur;
+    uint32_t hits_idx;
+    uint32_t read_len;
+    uint64_t bytes_requested;
+    uint64_t active_positions;
+} ref_node;
+
+
+static rc_t detect_read_len( ref_node *node )
+{
+    const VCursor *temp_cursor;
+    rc_t rc = VTableCreateCursorRead ( node->tab, &temp_cursor );
+    if ( rc != 0 )
+    {
+        PLOGERR( klogInt, ( klogInt, rc, 
+             "error to create cursor on table $(tab_name)",
+             "tab_name=%S", node->name ) );
+    }
+    else
+    {
+        uint32_t idx;
+        rc = VCursorAddColumn ( temp_cursor, &idx, MAXLEN_COLUMN );
+        if ( rc != 0 )
+        {
+            PLOGERR( klogInt, ( klogInt, rc, 
+                 "error to add column $(col_name) to cursor for table $(db_name).$(tab_name)",
+                 "col_name=%s,db_name=%S,tab_name=%s",
+                 MAXLEN_COLUMN, node->name, HITMAP_TAB ) );
+        }
+        else
+        {
+            rc = VCursorOpen( temp_cursor );
+            if ( rc != 0 )
+            {
+                PLOGERR( klogInt, ( klogInt, rc, 
+                     "error to open cursor for table $(db_name).$(tab_name to read $(col_name)",
+                     "col_name=%s,db_name=%S,tab_name=%s",
+                     MAXLEN_COLUMN, node->name, HITMAP_TAB ) );
+            }
+            else
+            {
+                uint32_t elem_bits, boff, row_len;
+                const void *base;
+                rc = VCursorCellDataDirect ( temp_cursor, 1, idx,
+                                             &elem_bits, &base, &boff, &row_len );
+                if ( rc != 0 )
+                {
+                    PLOGERR( klogInt, ( klogInt, rc, 
+                         "error to read $(col_name) from 1st row in table $(db_name).$(tab_name)",
+                         "col_name=%s,db_name=%S,tab_name=%s",
+                         MAXLEN_COLUMN, node->name, HITMAP_TAB ) );
+                }
+                else
+                {
+                    node->read_len = *((uint32_t *)base);
+                    if ( node->read_len == 0 )
+                    {
+                        rc = RC( rcApp, rcNoTarg, rcReading, rcParam, rcInvalid );
+                        PLOGERR( klogInt, ( klogInt, rc, 
+                             "$(col_name) == 0 discoverd in table $(db_name).$(tab_name)",
+                             "col_name=%s,db_name=%S,tab_name=%s",
+                             MAXLEN_COLUMN, node->name, HITMAP_TAB ) );
+                    }
+                }
+            }
+        }
+        VCursorRelease( temp_cursor );
+    }
+    return rc;
+}
+
+
+static rc_t prepare_ref_node( ref_node * node )
+{
+    rc_t rc = VTableCreateCursorRead ( node->tab, &node->cur );
+    if ( rc != 0 )
+    {
+        PLOGERR( klogInt, ( klogInt, rc, 
+             "error to create cursor on table $(db_name).$(tab_name)",
+             "db_name=%S,tab_name=%s",
+             node->name, HITMAP_TAB ) );
+    }
+    else
+    {
+        rc = VCursorAddColumn ( node->cur, &node->hits_idx, HITS_COLUMN );
+        if ( rc != 0 )
+        {
+            PLOGERR( klogInt, ( klogInt, rc, 
+                 "error to add column $(col_name) to cursor for table $(db_name).$(tab_name)",
+                 "col_name=%s,db_name=%S,tab_name=%s",
+                 HITS_COLUMN, node->name, HITMAP_TAB ) );
+        }
+        else
+        {
+            rc = VCursorOpen( node->cur );
+            if ( rc != 0 )
+            {
+                PLOGERR( klogInt, ( klogInt, rc, 
+                     "error to open cursor for table $(tab_name)",
+                     "tab_name=%S", node->name ) );
+            }
+            else
+            {
+                node->valid = true;
+            }
+        }
+    }
+    return rc;
+}
+
+
+static ref_node * make_ref_node( ref_exclude *exclude, const String * s )
+{
+    ref_node * res = calloc( 1, sizeof * res );
+    if ( res != NULL )
+    {
+        if ( StringCopy ( &res->name, s ) != 0 )
+        {
+            free( res );
+            res = NULL;
+        }
+    }
+    if ( res != NULL && exclude->path != NULL )
+    {
+        char buf[ 1024 ];
+        size_t num_writ;
+        rc_t rc = string_printf ( buf, sizeof buf, &num_writ, 
+                                  "%s/%S", exclude->path, s );
+        if ( rc != 0 )
+        {
+            PLOGERR( klogInt, ( klogInt, rc, 
+                 "error to assemble path to exclude-table $(tab_name)",
+                 "tab_name=%S", s ) );
+        }
+        else
+        {
+            rc = VDBManagerOpenDBRead ( exclude->mgr, &res->db, NULL, "%s", buf );
+            if ( rc != 0 )
+            {
+                PLOGERR( klogInt, ( klogInt, rc, 
+                     "error to open exclude-table $(db_name)",
+                     "db_name=%s", buf ) );
+                /*
+                it can be OK if the database/table cannot be found!
+                */
+                rc = 0;
+            }
+            else
+            {
+                rc = VDatabaseOpenTableRead ( res->db, &res->tab, "HITMAP" );
+                if ( rc != 0 )
+                {
+                    PLOGERR( klogInt, ( klogInt, rc, 
+                         "error to open exclude-table 'HITMAP' in $(db_name)",
+                         "db_name=%s", buf ) );
+                    /*
+                    it can be OK if the database/table cannot be found!
+                    */
+                    rc = 0;
+                }
+                else
+                {
+                    rc = detect_read_len( res );
+                    if ( rc == 0 )
+                    {
+                        rc = prepare_ref_node( res );
+                    }
+                }
+            }
+        }
+    }
+    return res;
+}
+
+
+static rc_t read_from_ref_node( ref_node * node, 
+                                int32_t ref_offset, uint32_t ref_len,
+                                uint8_t *exclude_vector,
+                                uint32_t *active )
+{
+    rc_t rc = 0;
+    uint64_t row_id = ( ref_offset / node->read_len ) + 1;
+    uint8_t *dst = exclude_vector;
+    uint32_t remaining = ref_len;
+    uint32_t src_ofs = ref_offset % node->read_len;
+
+    while ( remaining > 0 && rc == 0 )
+    {
+        uint32_t elem_bits, boff, rlen;
+        const uint8_t *src;
+        rc = VCursorCellDataDirect ( node->cur, row_id, node->hits_idx,
+                                     &elem_bits, (const void**)&src, &boff, &rlen );
+        if ( rc != 0 )
+        {
+            PLOGERR( klogInt, ( klogInt, rc, 
+                 "error to read $(col_name) from 1st row in table $(db_name).$(tab_name)",
+                 "col_name=%s,db_name=%S,tab_name=%s",
+                 HITS_COLUMN, node->name, HITMAP_TAB ) );
+        }
+        else
+        {
+            if ( src_ofs >= rlen )
+            {
+                rc = RC( rcApp, rcNoTarg, rcReading, rcParam, rcInvalid );
+                PLOGERR( klogInt, ( klogInt, rc, 
+                     "error: try to read more data than are in var-loc $(tab_name)",
+                     "tab_name=%S", node->name ) );
+            }
+            else
+            {
+                uint32_t to_copy = ( rlen - src_ofs );
+                if ( to_copy > remaining )
+                {
+                    to_copy = remaining;
+                }
+                src += src_ofs;
+
+                memcpy( dst, src, to_copy );
+                dst += to_copy;
+                remaining -= to_copy;
+                src_ofs = 0;
+                row_id ++;
+
+                node->bytes_requested += to_copy;
+            }
+        }
+    }
+    *active = 0;
+    if ( rc == 0 )
+    {
+        for ( src_ofs = 0; src_ofs < ref_len; ++src_ofs )
+        {
+            if ( exclude_vector[ src_ofs ] > 0 )
+            {
+                ( *active )++;
+            }
+        }
+    }
+
+    return rc;
+}
+
+
+static void CC whack_ref_node( BSTNode *n, void *data )
+{
+    ref_node * node = ( ref_node * )n;
+    bool * info = ( bool * )data;
+
+    if ( *info )
+    {
+        OUTMSG(( "node >%S< used for %lu bytes (%lu active)\n",
+                  node->name, node->bytes_requested, node->active_positions ));
+    }
+
+    if ( node->cur != NULL )
+    {
+        VCursorRelease( node->cur );
+    }
+    if ( node->tab != NULL )
+    {
+        VTableRelease( node->tab );
+    }
+    if ( node->name != NULL )
+    {
+        StringWhack ( node->name );
+    }
+    free( n );
+}
+
+
+static int CC ref_node_find( const void *item, const BSTNode *n )
+{
+    ref_node * node = ( ref_node * ) n;
+    return StringCompare ( ( String * ) item, node->name );
+}
+
+
+static ref_node * find_ref_node( ref_exclude *exclude, const String * s )
+{
+    BSTNode *node;
+
+    if ( exclude->last_used_ref_node != NULL )
+    {
+        ref_node * node = ( ref_node * )exclude->last_used_ref_node;
+        if ( StringCompare ( s, node->name ) == 0 )
+            return node;
+    }
+
+    node = BSTreeFind ( &exclude->ref_nodes, s, ref_node_find );
+    if ( node == NULL )
+        return NULL;
+    else
+    {
+        exclude->last_used_ref_node = node;
+        return ( ref_node * ) node;
+    }
+}
+
+
+rc_t make_ref_exclude( ref_exclude *exclude, KDirectory *dir,
+                       const char * path, bool info )
+{
+    rc_t rc;
+
+    BSTreeInit( &exclude->ref_nodes );
+    BSTreeInit( &exclude->translations );
+
+    exclude->last_used_ref_node = NULL;
+    exclude->info = info;
+    rc = VDBManagerMakeUpdate ( &exclude->mgr, dir );
+    if ( rc != 0 )
+    {
+        LogErr( klogInt, rc, "VDBManagerMakeUpdate() in make_ref_exclude() failed\n" );
+    }
+    else
+    {
+        insert_trans_nodes( &exclude->translations );
+        exclude->path = string_dup_measure ( path, NULL );
+    }
+    return rc;
+}
+
+
+static int CC ref_node_sort( const BSTNode *item, const BSTNode *n )
+{
+    ref_node * rn1 = ( ref_node* ) item;
+    ref_node * rn2 = ( ref_node* ) n;
+    return StringCompare ( rn1->name, rn2->name );
+}
+
+
+static rc_t find_or_make_by_name( ref_exclude *exclude,
+                          const String * name,
+                          ref_node ** node )
+{
+    rc_t rc = 0;
+    *node = find_ref_node( exclude, name );
+    if ( *node == NULL )
+    {
+        /* if not found: make such a node... */
+        *node = make_ref_node( exclude, name );
+        if ( *node == NULL )
+        {
+            rc = RC( rcApp, rcNoTarg, rcConstructing, rcSelf, rcNull );
+        }
+        else
+        {
+            /* if node was successfully made, insert it into our tree */
+            rc = BSTreeInsert ( &exclude->ref_nodes, (BSTNode *)( *node ), ref_node_sort );
+        }
+    }
+    return rc;
+}
+
+rc_t get_ref_exclude( ref_exclude *exclude,
+                      const String * name,
+                      int32_t ref_offset, uint32_t ref_len,
+                      uint8_t *exclude_vector,
+                      uint32_t *active )
+{
+    rc_t rc = 0;
+    ref_node *node = NULL;
+
+    /* look if we already have a node with the given name */
+    trans_node *t_node = ( trans_node * )BSTreeFind ( &exclude->translations, name, trans_node_find );
+    if ( t_node != NULL )
+    {
+        rc = find_or_make_by_name( exclude, &t_node->translation, &node );
+    }
+    else
+    {
+        rc = find_or_make_by_name( exclude, name, &node );
+    }
+
+    if ( rc == 0 && node->valid )
+    {
+        /* read the necessary row(s) and fill it into the exclude_vector */
+        rc = read_from_ref_node( node, ref_offset, ref_len, exclude_vector, active );
+        if ( rc == 0 )
+        {
+            node->active_positions += *active;
+        }
+    }
+    return rc;
+}
+
+
+rc_t whack_ref_exclude( ref_exclude *exclude )
+{
+    BSTreeWhack ( &exclude->ref_nodes, whack_ref_node, &exclude->info );
+    BSTreeWhack ( &exclude->translations, whack_trans_node, NULL );
+    if ( exclude->mgr != NULL )
+        VDBManagerRelease( exclude->mgr );
+    if ( exclude->path != NULL )
+        free( exclude->path );
+    return 0;
+}
diff --git a/tools/qual-recalib-stat/ref_exclude.h b/tools/qual-recalib-stat/ref_exclude.h
new file mode 100644
index 0000000..a957ce9
--- /dev/null
+++ b/tools/qual-recalib-stat/ref_exclude.h
@@ -0,0 +1,71 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_ref_exclude_
+#define _h_ref_exclude_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <klib/rc.h>
+#include <klib/container.h>
+#include <klib/text.h>
+#include <klib/log.h>
+#include <kfs/directory.h>
+#include <vdb/manager.h>
+#include <vdb/database.h>
+#include <vdb/table.h>
+#include <vdb/cursor.h>
+
+typedef struct ref_exclude
+{
+    BSTree ref_nodes;
+    BSTree translations;
+    VDBManager *mgr;
+    char * path;
+    void * last_used_ref_node;
+    bool info;
+} ref_exclude;
+
+
+rc_t make_ref_exclude( ref_exclude *exclude, KDirectory *dir,
+                       const char * path, bool info );
+
+
+rc_t get_ref_exclude( ref_exclude *exclude, 
+                      const String * name,
+                      int32_t ref_offset, uint32_t ref_len,
+                      uint8_t *exclude_vector,
+                      uint32_t *active );
+
+rc_t whack_ref_exclude( ref_exclude *exclude );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/qual-recalib-stat/ref_grab.pl b/tools/qual-recalib-stat/ref_grab.pl
new file mode 100755
index 0000000..e71f2a4
--- /dev/null
+++ b/tools/qual-recalib-stat/ref_grab.pl
@@ -0,0 +1,82 @@
+#!/usr/bin/perl -w
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+use File::Path;
+
+my $nargs = scalar @ARGV;
+
+if ( $nargs < 2  )
+{
+    print( "\n-------------------------------------------------------------------------\n" );
+    print( "USAGE: ref_grab.pl src position bases\n" );
+    print( "src      ... absolute-path to a reference-table\n" );
+    print( "position ... from what absolute positoin in the reference to grab\n" );
+    print( "bases    ... how many bases to grab\n" );
+    print( "-------------------------------------------------------------------------\n\n" );
+}
+else
+{
+    my $ref = $ARGV[ 0 ];
+    my $cnt = $ARGV[ 1 ];
+    my $len = 79;
+    my ( $n_rows, $cmd, $row, $s, $line );
+
+    #calculate how many rows have to be dumped...
+    {
+        use integer;
+        $n_rows = ( $cnt / 5000 ) + 1;
+    }
+
+    #dump the sequence-name
+    $cmd = "vdb-dump $ref -C SEQ_ID -f csv -R 1";
+    open ( DUMP, "-|", "$cmd" ) or die "$cmd failed";
+    while ( ( $row = <DUMP> ), defined( $row ) )
+    {
+        chomp( $row );
+        print( ">$row\n" );
+    }
+    close ( DUMP );
+
+    #dump the rows
+    $cmd = "vdb-dump $ref -C READ -f tab -R 1-$n_rows";
+    open ( DUMP, "-|", "$cmd" ) or die "$cmd failed";
+    while ( ( $row = <DUMP> ), defined( $row ) )
+    {
+        chomp( $row );
+        $s .= $row;
+        while( length( $s ) >= $len )
+        {
+            $line = substr( $s, 0, $len, "" );
+            print( "$line\n" );
+
+        }
+    }
+    close ( DUMP );
+
+    #dump the remainder of bases
+    if ( length( $s ) > 0 )
+    {
+        print( "$s\n" );
+    }
+}
\ No newline at end of file
diff --git a/tools/qual-recalib-stat/spot_position.c b/tools/qual-recalib-stat/spot_position.c
new file mode 100644
index 0000000..dd3ac1f
--- /dev/null
+++ b/tools/qual-recalib-stat/spot_position.c
@@ -0,0 +1,121 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "spot_position.h"
+#include <sysalloc.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+static const char * sidx_names[ N_SIDX ] =
+{
+    "READ_START"
+};
+
+
+rc_t make_spot_pos( spot_pos *self,
+                    const VDatabase * db )
+{
+    rc_t rc = VDatabaseOpenTableRead( db, &self->table, "SEQUENCE" );
+    if ( rc != 0 )
+    {
+        LogErr( klogInt, rc, "VDatabaseOpenTableRead(SEQUENCE) failed\n" );
+        self->table = NULL;
+        self->cursor = NULL;
+    }
+    else
+    {
+        rc = VTableCreateCursorRead( self->table, &self->cursor );
+        if ( rc != 0 )
+            LogErr( klogInt, rc, "VTableCreateCursorRead(SEQUENCE) failed\n" );
+        else
+        {
+            rc = add_columns( self->cursor, self->columns, sidx_names, N_SIDX );
+            if ( rc == 0 )
+            {
+                rc = VCursorOpen ( self->cursor );
+                if ( rc != 0 )
+                {
+                    LogErr( klogInt, rc, "cannot open cursor on SEQUENCE\n" );
+                }
+            }
+        }
+    }
+    return rc;
+}
+
+
+rc_t query_spot_pos( spot_pos *self,
+                     const uint32_t seq_read_id,
+                     const uint64_t spot_id,
+                     uint32_t *pos_offset )
+{
+    rc_t rc;
+    if ( self->cursor == NULL )
+    {
+        rc = RC ( rcApp, rcNoTarg, rcAccessing, rcParam, rcNull );
+        LogErr( klogInt, rc, "cannot query spot-position, cursor is NULL\n" );
+    }
+    else
+    {
+        rc = read_cells( self->cursor, spot_id, self->columns, sidx_names, N_SIDX );
+        if ( rc == 0 )
+        {
+            const uint32_t * rd_start   = self->columns[ SIDX_READ_START ].base;
+            uint32_t rd_start_len = self->columns[ SIDX_READ_START ].row_len;
+            if ( seq_read_id > rd_start_len )
+            {
+                rc = RC ( rcApp, rcNoTarg, rcAccessing, rcParam, rcInvalid );
+                PLOGERR( klogInt, ( klogInt, rc, 
+                     "asking for read_start of read #$(read_nr) but we only have $(n_read) reads at row #$(row_nr)",
+                     "read_nr=%u,n_read=%u,row_nr=%lu", seq_read_id, rd_start_len, spot_id ) );
+            }
+            else
+            {
+                *pos_offset = rd_start[ seq_read_id - 1 ];
+                /*
+                OUTMSG(( "SPOT_ID %lu / SEQ_READ_ID %u ---> %u\n",
+                         spot_id, seq_read_id, *pos_offset ));
+                */
+            }
+        }
+        else
+        {
+            PLOGERR( klogInt, ( klogInt, rc, 
+                 "cannot read sequence row #$(row_nr)", "row_nr=%lu", spot_id ) );
+        }
+    }
+    return rc;
+}
+
+
+void whack_spot_pos( spot_pos *self )
+{
+    if ( self->cursor != NULL )
+        VCursorRelease( self->cursor );
+    if ( self->table != NULL )
+        VTableRelease( self->table );
+}
diff --git a/tools/qual-recalib-stat/spot_position.h b/tools/qual-recalib-stat/spot_position.h
new file mode 100644
index 0000000..e6e9953
--- /dev/null
+++ b/tools/qual-recalib-stat/spot_position.h
@@ -0,0 +1,68 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+#ifndef _h_spot_position_
+#define _h_spot_position_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <klib/rc.h>
+#include <klib/text.h>
+#include <klib/log.h>
+#include <klib/out.h>
+#include <vdb/cursor.h>
+#include <vdb/table.h>
+#include <vdb/database.h>
+#include "columns.h"
+
+
+#define SIDX_READ_START      0
+#define N_SIDX               1
+
+
+typedef struct spot_pos
+{
+    const VTable *table;
+    const VCursor *cursor;
+    col columns[ N_SIDX ];
+} spot_pos;
+
+
+rc_t make_spot_pos( spot_pos *self, const VDatabase * db );
+
+rc_t query_spot_pos( spot_pos *self,
+                     const uint32_t seq_read_id,
+                     const uint64_t spot_id,
+                     uint32_t *pos_offset );
+
+void whack_spot_pos( spot_pos *self );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/qual-recalib-stat/stat_mod.c b/tools/qual-recalib-stat/stat_mod.c
new file mode 100644
index 0000000..0d86725
--- /dev/null
+++ b/tools/qual-recalib-stat/stat_mod.c
@@ -0,0 +1,883 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "stat_mod.h"
+#include <sysalloc.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+static const char * ridx_names[ N_RIDX ] =
+{
+    "READ",
+    "QUALITY",
+    "HAS_MISMATCH",
+    "SPOT_GROUP",
+    "SEQ_SPOT_GROUP",
+    "REF_ORIENTATION",
+    "READ_LEN",
+    "SEQ_READ_ID",
+    "HAS_REF_OFFSET",
+    "REF_OFFSET",
+    "REF_POS",
+    "REF_SEQ_ID",
+    "REF_LEN"
+};
+
+
+static const char * widx_names[ N_WIDX ] =
+{
+    "SPOT_GROUP",
+    "KMER",
+    "ORIG_QUAL",
+    "TOTAL_COUNT",
+    "MISMATCH_COUNT",
+    "CYCLE",
+    "HPRUN",
+    "GC_CONTENT"
+};
+
+typedef struct qual
+{
+    uint32_t mismatches;
+    uint32_t count;
+} qual;
+
+
+typedef struct pos_vector
+{
+    uint32_t len;
+    struct qual *v;
+} pos_vector;
+
+
+typedef struct spotgrp
+{
+    BSTNode node;
+    const String *name;
+    pos_vector dimers[N_DIMER_VALUES][N_QUAL_VALUES][N_GC_VALUES][N_HP_VALUES];
+} spotgrp;
+
+
+static const uint8_t char_2_base_bin[26] =
+{
+   /* 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*/
+      0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0
+};
+
+
+static const char * dimer_2_ascii[] = 
+{ "AA", "AC", "AG", "AT", 
+  "CA", "CC", "CG", "CT",
+  "GA", "GC", "GG", "GT",
+  "TA", "TC", "TG", "TT", "XX" };
+
+
+static void CC whack_spotgroup( BSTNode *n, void *data )
+{
+    spotgrp * sg = ( spotgrp * )n;
+    uint8_t dimer_idx;
+    for ( dimer_idx = 0; dimer_idx < N_DIMER_VALUES; ++dimer_idx )
+    {
+        uint8_t qual_idx;
+        for ( qual_idx = 0; qual_idx < N_QUAL_VALUES; ++qual_idx )
+        {
+            uint8_t gc_idx;
+            for ( gc_idx = 0; gc_idx < N_GC_VALUES; ++gc_idx )
+            {
+                uint8_t hp_idx;
+                for ( hp_idx = 0; hp_idx < N_HP_VALUES; ++hp_idx )
+                {
+                    pos_vector *pv = &sg->dimers[dimer_idx][qual_idx][gc_idx][hp_idx];
+                    if ( pv->v != NULL )
+                        free( pv->v );
+                }
+            }
+        }
+    }
+    if ( sg->name != NULL )
+        StringWhack ( sg->name );
+    free( n );
+}
+
+
+rc_t make_statistic( statistic *data, uint32_t gc_window,
+                     KDirectory *dir, const char * exclude_db )
+{
+    rc_t rc = 0;
+    BSTreeInit( &data->spotgroups );
+    data->last_used_spotgroup = NULL;
+    memset( &data->rd_col, 0, sizeof data->rd_col );
+    make_ref_exclude( &data->exclude, dir, exclude_db );
+    data->gc_window = gc_window;
+
+    data->exclude_vector_len = 512;
+    data->exclude_vector = calloc( 1, data->exclude_vector_len );
+    if ( data->exclude_vector == NULL )
+    {
+        data->exclude_vector_len = 0;
+        rc = RC( rcApp, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+        LogErr( klogInt, rc, "failed to make large enough exclude-vector\n" );
+    }
+
+    if ( rc == 0 )
+    {
+        data->case_vector_len = 512;
+        data->case_vector = calloc( 1, data->case_vector_len );
+        if ( data->case_vector == NULL )
+        {
+            data->case_vector_len = 0;
+            rc = RC( rcApp, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+            LogErr( klogInt, rc, "failed to make large enough case-vector\n" );
+        }
+    }
+
+    return rc;
+}
+
+
+void whack_statistic( statistic *data )
+{
+    BSTreeWhack ( &data->spotgroups, whack_spotgroup, NULL );
+    whack_ref_exclude( &data->exclude );
+    if ( data->exclude_vector != NULL )
+    {
+        free( data->exclude_vector );
+        data->exclude_vector = NULL;
+        data->exclude_vector_len = 0;
+    }
+    if ( data->case_vector != NULL )
+    {
+        free( data->case_vector );
+        data->case_vector = NULL;
+        data->case_vector_len = 0;
+    }
+}
+
+
+static spotgrp * make_spotgrp( const char *src, const size_t len )
+{
+    spotgrp * res = calloc( 1, sizeof * res );
+    if ( res != NULL )
+    {
+        String s;
+        StringInit( &s, src, len, len );
+        if ( StringCopy ( &res->name, &s ) != 0 )
+        {
+            free( res );
+            res = NULL;
+        }
+    }
+    return res;
+}
+
+
+static int CC spotgroup_find( const void *item, const BSTNode *n )
+{
+    spotgrp * sg = ( spotgrp* ) n;
+    return StringCompare ( ( String* ) item, sg->name );
+}
+
+
+static spotgrp * find_spotgrp( statistic *data, const char *src, const size_t len )
+{
+    String s;
+    BSTNode *node;
+
+    StringInit( &s, src, len, len );
+    if ( data->last_used_spotgroup != NULL )
+    {
+        spotgrp * sg = ( spotgrp* )data->last_used_spotgroup;
+        if ( StringCompare ( &s, sg->name ) == 0 )
+            return sg;
+    }
+
+    node = BSTreeFind ( &data->spotgroups, &s, spotgroup_find );
+    if ( node == NULL )
+        return NULL;
+    else
+    {
+        data->last_used_spotgroup = node;
+        return ( spotgrp *) node;
+    }
+}
+
+
+static uint8_t dimer_2_bin( const char * dimer )
+{
+    uint8_t res = 0;
+    char c0 = dimer[ 0 ];
+    char c1 = dimer[ 1 ];
+    if ( c0 == 'N' || c1 == 'N' )
+        res = 16;
+    else
+    {
+        if ( c0 >= 'A' && c0 <= 'Z' )
+            res |= char_2_base_bin[ (uint8_t)( c0 - 'A' ) ];
+        res <<= 2;
+        if ( c1 >= 'A' && c1 <= 'Z' )
+            res |= char_2_base_bin[ (uint8_t)( c1 - 'A' ) ];
+    }
+    return res;
+}
+
+
+static rc_t spotgroup_enter_values( spotgrp * sg, 
+                                    stat_row * row, 
+                                    uint8_t dimer_idx,
+                                    uint8_t rd_case,
+                                    uint32_t base_pos_offset )
+{
+    rc_t rc = 0;
+    pos_vector *pv;
+    uint32_t base_pos = row->base_pos + base_pos_offset;
+
+    if ( row->quality >= N_QUAL_VALUES )
+        row->quality = N_QUAL_VALUES - 1;
+    if ( row->gc_content >= N_GC_VALUES )
+        row->gc_content = N_GC_VALUES - 1;
+    if ( row->hp_run >= N_HP_VALUES )
+        row->hp_run = N_HP_VALUES - 1;
+
+    pv = &sg->dimers[ dimer_idx ][ row->quality ][ row->gc_content ][ row->hp_run ];
+    if ( pv->len == 0 )
+    {
+        /* vector was not used before */
+        pv->len = ( ( base_pos + 1 ) / POS_VECTOR_INC ) + 1;
+        pv->len *= POS_VECTOR_INC;
+        pv->v = calloc( pv->len, sizeof pv->v[0] );
+        if ( pv->v == NULL )
+        {
+            rc = RC( rcApp, rcSelf, rcConstructing, rcMemory, rcExhausted );
+        }
+    }
+    else if ( pv->len < ( base_pos + 1 ) )
+    {
+        void * tmp;
+        /* vector has to be increased */
+        uint32_t org_len = pv->len;
+        pv->len = ( ( base_pos + 1 ) / POS_VECTOR_INC ) + 1;
+        pv->len *= POS_VECTOR_INC;
+        /* prevent from leaking memory by capturing the new pointer in temp. var. */
+        tmp = realloc( pv->v, pv->len * ( sizeof pv->v[0] ) );
+        if ( tmp == NULL )
+        {
+            rc = RC( rcApp, rcSelf, rcConstructing, rcMemory, rcExhausted );
+        }
+        else
+        {
+            pv->v = tmp;
+            /* the added part has to be set to zero */
+            qual *to_zero = pv->v;
+            to_zero += org_len;
+            memset( to_zero, 0, ( pv->len - org_len ) * ( sizeof pv->v[0] ) );
+        }
+    }
+
+    if ( rc == 0 )
+    {
+        qual *q = &pv->v[ base_pos ];
+        switch( rd_case )
+        {
+            case CASE_MISMATCH : q->mismatches++; /* no break intented! */
+            case CASE_MATCH    : q->count++;
+                                 break;
+        }
+    }
+    else
+    {
+        pv->len = 0;
+    }
+    return rc;
+}
+
+
+static int CC spotgroup_sort( const BSTNode *item, const BSTNode *n )
+{
+    spotgrp * sg1 = ( spotgrp* ) item;
+    spotgrp * sg2 = ( spotgrp* ) n;
+    return StringCompare ( sg1->name, sg2->name );
+}
+
+
+static rc_t expand_and_clear_vector( uint8_t **v, uint32_t *len, uint32_t new_len )
+{
+    rc_t rc = 0;
+    if ( *len < new_len )
+    {
+        *len += new_len;
+        *v = realloc( *v, *len );
+        if ( *v == NULL )
+        {
+            rc = RC( rcApp, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+            LogErr( klogInt, rc, "failed to expand (uint8_t)vector\n" );
+        }
+    }
+    if ( rc == 0 )
+        memset( *v, 0, *len ); 
+    return rc;
+}
+
+
+static rc_t get_exlude_vector( statistic * data, uint32_t *ref_len )
+{
+    /* we need: REF_OFFSET, REF_LEN and REF_NAME for that */
+    rc_t rc;
+    String s_ref_name;
+
+    const char * ref_name_base = ( const char * )data->rd_col[ RIDX_REF_SEQ_ID ].base;
+    uint32_t ref_name_len = data->rd_col[ RIDX_REF_SEQ_ID ].row_len;
+
+    int32_t ref_offset = *( ( int32_t *)data->rd_col[ RIDX_REF_POS ].base );
+    *ref_len = *( ( uint32_t *)data->rd_col[ RIDX_REF_LEN ].base );
+
+    StringInit( &s_ref_name, ref_name_base, ref_name_len, ref_name_len );
+
+    /* make the ref-exclude-vector longer if necessary */
+    rc = expand_and_clear_vector( &data->exclude_vector,
+                                  &data->exclude_vector_len,
+                                  *ref_len );
+    if ( rc == 0 )
+        rc = get_ref_exclude( &data->exclude,
+                              &s_ref_name,
+                              ref_offset,
+                              *ref_len,
+                              data->exclude_vector );
+
+    return rc;
+}
+
+
+static rc_t walk_exclude_vector( statistic * data,
+                                 uint32_t n_bases,
+                                 uint32_t ref_len )
+{
+    rc_t rc = 0;
+    /* we need: HAS_REF_OFFSET, REF_OFFSET and HAS_MISMATCH for that */
+
+    const char * has_roffs = ( const char * )data->rd_col[ RIDX_HAS_REF_OFFSET ].base;
+    uint32_t has_roffs_len = data->rd_col[ RIDX_HAS_REF_OFFSET ].row_len;
+
+    const int32_t * roffs = ( const int32_t * )data->rd_col[ RIDX_REF_OFFSET ].base;
+    uint32_t roffs_len = data->rd_col[ RIDX_REF_OFFSET ].row_len;
+
+    const char * has_mm = ( const char * )data->rd_col[ RIDX_HAS_MISMATCH ].base;
+    uint32_t has_mm_len = data->rd_col[ RIDX_HAS_MISMATCH ].row_len;
+
+    if ( has_roffs_len != n_bases || has_mm_len != n_bases )
+    {
+        rc = RC( rcApp, rcNoTarg, rcConstructing, rcParam, rcInvalid );
+        LogErr( klogInt, rc, "number of bases does not match length of HAS_REF_OFFSET or HAS_MISMATCH\n" );
+    }
+    else
+    {
+        /* we count how many REF_OFFSETS have to be there... */
+        uint32_t hro_count = 0;
+        uint32_t idx;
+        for ( idx = 0; idx < n_bases; ++idx )
+        {
+            if ( has_roffs[ idx ] == '1' )
+                hro_count++;
+        }
+        if ( hro_count != roffs_len )
+        {
+            rc = RC( rcApp, rcNoTarg, rcConstructing, rcParam, rcInvalid );
+            LogErr( klogInt, rc, "number of HAS_REF_OFFSET=1 does not match length of REF_OFFSET\n" );
+        }
+    }
+
+    /* */
+    if ( rc == 0 )
+    {
+        int32_t ref_idx = 0;
+        uint32_t base_idx = 0;
+        uint32_t roffs_idx = 0;
+        while ( ref_idx < (int32_t)ref_len )
+        {
+            /* before we handle the reference, apply the ref-offset to the
+               iterator ( in this case: ref_idx ) */
+            if ( has_roffs[ base_idx ] == '1' )
+            {
+                /* this handles the left-clipping (... ref_idx < 0 )*/
+                for ( ref_idx += roffs[ roffs_idx++ ]; ref_idx < 0; ++ref_idx )
+                {
+                    data->case_vector[ base_idx++ ] = CASE_IGNORE;
+                }
+            }
+            assert( ref_idx >= 0 );
+            /* all the calculation is only done to put the IGNORE-flags
+               into the right base-position (if necessary): */
+            if ( data->exclude_vector[ ref_idx++ ] > 0 )
+                data->case_vector[ base_idx ] = CASE_IGNORE;
+            base_idx++;
+        }
+        /* walk backwards from the end to apply right-clipping */
+        assert( n_bases > 0 );
+        base_idx = n_bases - 1;
+        while ( base_idx > 0 && has_mm[ base_idx ] == '1' )
+        {
+            data->case_vector[ base_idx-- ] = CASE_IGNORE;
+        }
+    }
+
+    /* enter the mis-matches into the case-vector,
+       but only where the base-position is not ignored... */
+    if ( rc == 0 )
+    {
+        uint32_t base_idx;
+        for ( base_idx = 0; base_idx < n_bases; ++base_idx )
+        {
+            if ( has_mm[ base_idx ] == '1' &&
+                 data->case_vector[ base_idx ] != CASE_IGNORE )
+            {
+                data->case_vector[ base_idx ] = CASE_MISMATCH;
+            }
+        }
+    }
+    return rc;
+}
+
+
+static const char base_complement[26] =
+{
+   /* ABCDEFGHIJKLMNOPQRSTUVWXYZ*/
+     "TBGDEFCHIJKLMNOPQRSAUVWXYZ"
+};
+
+
+static char complement( const char base )
+{
+    if ( base >= 'A' && base <= 'Z' )
+        return base_complement[ base - 'A' ];
+    else
+        return 'N';
+}
+
+
+static void reverse_read_and_case( statistic * data,
+                                   char * rd_ptr,
+                                   uint8_t *qual_ptr,
+                                   uint32_t n_bases )
+{
+    uint32_t p1;
+    uint32_t p2 = n_bases - 1;
+    uint32_t n = ( n_bases / 2 );
+    for ( p1 = 0; p1 < n; ++p1, --p2 )
+    {
+        char rd_temp = rd_ptr[ p1 ];
+        uint8_t c_temp = data->case_vector[ p1 ];
+        uint8_t q_temp = qual_ptr[ p1 ];
+
+        rd_ptr[ p1 ] = complement( rd_ptr[ p2 ] );
+        data->case_vector[ p1 ] = data->case_vector[ p2 ];
+        qual_ptr[ p1 ] = qual_ptr[ p2 ];
+
+        rd_ptr[ p2 ] = complement( rd_temp );
+        data->case_vector[ p2 ] = c_temp;
+        qual_ptr[ p2 ] = q_temp;
+    }
+    /* don't forget to complement the base in the middle (if n_bases is odd) */
+    if ( n_bases & 1 )
+        rd_ptr[ n ] = complement( rd_ptr[ n ] );
+}
+
+
+static rc_t loop_through_base_calls( spotgrp *sg,
+                       uint32_t gc_window,
+                       char * read_ptr,
+                       uint32_t n_bases,
+                       uint8_t * qual_ptr,
+                       uint8_t * case_ptr,
+                       uint32_t base_pos_offset )
+{
+    rc_t rc = 0;
+    char prev_char = 0;
+    stat_row row;
+    char *gc_ptr = read_ptr;
+    memset( &row, 0, sizeof row );
+
+    for ( row.base_pos = 0; row.base_pos < ( n_bases - 1 ) && rc == 0; ++row.base_pos )
+    {
+        /* calculate the hp-run-count */
+        if ( prev_char == *read_ptr )
+        {
+            row.hp_run++;
+            assert( row.hp_run <= n_bases );
+        }
+        else
+        {
+            prev_char = *read_ptr;
+            row.hp_run = 0;
+        }
+
+        /* advance the "window" */
+        if ( row.base_pos >= ( gc_window + 1 ) )
+        {
+            if ( *gc_ptr == 'G' || *gc_ptr == 'C' )
+            {
+                assert( row.gc_content > 0 );
+                row.gc_content--;
+            }
+            gc_ptr++;
+        }
+
+        if ( case_ptr[0] != CASE_IGNORE && case_ptr[1] != CASE_IGNORE )
+        {
+            row.quality = *qual_ptr;
+            rc = spotgroup_enter_values( sg,
+                                    &row, 
+                                    dimer_2_bin( read_ptr ),
+                                    *case_ptr,
+                                    base_pos_offset );
+        }
+
+        /* handle the current base-position after the record was entered
+           because we do not include the current base into the gc-content */
+        if ( *read_ptr == 'G' || *read_ptr == 'C' )
+            row.gc_content++;
+
+        qual_ptr++;
+        read_ptr++;
+        case_ptr++;
+    }
+    return rc;
+}
+
+
+static rc_t extract_spotgroup_statistic( statistic * data,
+                                         spotgrp *sg,
+                                         uint32_t n_bases )
+{
+    uint32_t ref_len, base_pos_offset = 0;
+    char *read_ptr = ( char * )data->rd_col[ RIDX_READ ].base;
+    uint8_t *qual_ptr = ( uint8_t * )data->rd_col[ RIDX_QUALITY ].base;
+
+    /* (1) ... get the exclusion-list for this read */
+    rc_t rc = get_exlude_vector( data, &ref_len );
+
+    /* (2) ... make the case-vector longer if necessary */
+    if ( rc == 0 )
+    {
+        rc = expand_and_clear_vector( &data->case_vector,
+                                      &data->case_vector_len,
+                                      n_bases );
+    }
+
+    /* (3) ... walk the exclusion-list and Mismatch-vector to build the case-vector */
+    if ( rc == 0 )
+    {
+        rc = walk_exclude_vector( data, n_bases, ref_len );
+    }
+
+    /* (4) ... if we have to, we reverse case-vector and revers/complement the read-vector */
+    if ( rc == 0 )
+    {
+        const bool * reverse = data->rd_col[ RIDX_REF_ORIENTATION ].base;
+        if ( *reverse )
+        {
+            reverse_read_and_case( data, read_ptr, qual_ptr, n_bases );
+        }
+    }
+
+    /* (5) ... check if we are in SEQ_READ_ID == 2 */
+    if ( *( ( uint32_t * )data->rd_col[ RIDX_SEQ_READ_ID ].base ) == 2 )
+    {
+        base_pos_offset = n_bases;
+    }
+    /* TBD: make it more general for more than 2 reads per spot of different sized reads */
+
+    /* (6) ... */
+    if ( rc == 0 )
+    {
+        rc = loop_through_base_calls( sg, data->gc_window, read_ptr, n_bases, 
+                   qual_ptr, data->case_vector, base_pos_offset );
+    }
+    return rc;
+}
+
+
+static rc_t extract_statistic_from_row( statistic * data )
+{
+    rc_t rc = 0;
+    spotgrp *sg;
+
+    /* first try the SPOT_GROUP column (correct for newer db's) */
+    const char * spotgrp_base  = data->rd_col[ RIDX_SPOT_GROUP ].base;
+    uint32_t spotgrp_len = data->rd_col[ RIDX_SPOT_GROUP ].row_len;
+    if ( spotgrp_len < 1 || *spotgrp_base == 0 )
+    {
+        /* if empty try with SEQ_SPOT_GROUP column (correct for older db's) */
+        spotgrp_base  = data->rd_col[ RIDX_SEQ_SPOT_GROUP ].base;
+        spotgrp_len = data->rd_col[ RIDX_SEQ_SPOT_GROUP ].row_len;
+    }
+
+    sg = find_spotgrp( data, spotgrp_base, spotgrp_len );
+    if ( sg == NULL )
+    {
+        sg = make_spotgrp( spotgrp_base, spotgrp_len );
+        if ( sg == NULL )
+            rc = RC( rcApp, rcSelf, rcConstructing, rcMemory, rcExhausted );
+        else
+            rc = BSTreeInsert ( &data->spotgroups, (BSTNode *)sg, spotgroup_sort );
+    }
+    if ( rc == 0 )
+    {
+        uint32_t n_bases  = data->rd_col[ RIDX_READ ].row_len;
+        uint32_t qual_len = data->rd_col[ RIDX_QUALITY ].row_len;
+        uint32_t hmis_len = data->rd_col[ RIDX_HAS_MISMATCH ].row_len;
+
+        if ( ( n_bases == qual_len ) &&  ( n_bases == hmis_len ) )
+        {
+            rc = extract_spotgroup_statistic( data, sg, n_bases );
+        }
+        else
+        {
+            rc = RC( rcApp, rcNoTarg, rcConstructing, rcData, rcInvalid );
+            LogErr( klogInt, rc, "number of bases, quality and has_mismatch is not the same\n" );
+        }
+    }
+    return rc;
+}
+
+
+rc_t read_and_extract_statistic_from_row( statistic * data, const VCursor *my_cursor, 
+                         const int64_t row_id )
+{
+    rc_t rc = read_cells( my_cursor, row_id, data->rd_col, ridx_names, N_RIDX );
+    if ( rc == 0 )
+    {
+        rc = extract_statistic_from_row( data );
+    }
+    return rc;
+}
+
+
+rc_t query_statistic_rowrange( statistic * data, const VCursor *my_cursor, 
+                               int64_t *first, uint64_t * count )
+{
+    rc_t rc = VCursorIdRange ( my_cursor, data->rd_col[ RIDX_READ ].idx, first, count );
+    if ( rc != 0 )
+        LogErr( klogInt, rc, "VCursorIdRange() failed\n" );
+    return rc;
+}
+
+
+rc_t open_statistic_cursor( statistic * data, const VCursor *my_cursor )
+{
+    rc_t rc = add_columns( my_cursor, data->rd_col, ridx_names, N_RIDX );
+    if ( rc == 0 )
+    {
+        rc = VCursorOpen ( my_cursor );
+        if ( rc != 0 )
+            LogErr( klogInt, rc, "VCursorOpen failed\n" );
+    }
+    return rc;
+}
+
+
+typedef struct iter_ctx
+{
+    bool ( CC * f ) ( stat_row * row, void *data );
+    void * data;
+    uint64_t n;
+} iter_ctx;
+
+
+static void CC spotgroup_iter( BSTNode *n, void *data )
+{
+    spotgrp *sg = ( spotgrp * ) n;
+    iter_ctx *ctx = ( iter_ctx * )data;
+    bool run = true;
+    const char * name = sg->name->addr;
+    uint8_t dimer_idx;
+    for ( dimer_idx = 0; dimer_idx < N_DIMER_VALUES && run; ++dimer_idx )
+    {
+        uint8_t qual_idx;
+        for ( qual_idx = 0; qual_idx < N_QUAL_VALUES && run ; ++qual_idx )
+        {
+            uint8_t gc_idx;
+            for ( gc_idx = 0; gc_idx < N_GC_VALUES && run ; ++gc_idx )
+            {
+                uint8_t hp_idx;
+                for ( hp_idx = 0; hp_idx < N_HP_VALUES && run ; ++hp_idx )
+                {
+                    pos_vector *pv = &sg->dimers[dimer_idx][qual_idx][gc_idx][hp_idx];
+                    if ( pv->v != NULL )
+                    {
+                        uint32_t pos_idx;
+                        for ( pos_idx = 0; pos_idx < pv->len && run; ++pos_idx )
+                        {
+                            qual *q = &pv->v[pos_idx];
+                            if ( q->count > 0 )
+                            {
+                                stat_row row;
+                                /* the parameters */
+                                row.spotgroup  = (char *)name;
+                                row.dimer      = (char *)dimer_2_ascii[dimer_idx];
+                                row.quality    = qual_idx;
+                                row.hp_run     = hp_idx;
+                                row.gc_content = gc_idx;
+                                row.base_pos   = pos_idx;
+
+                                /* the counters */
+                                row.count      = q->count;
+                                row.mismatch_count = q->mismatches;
+
+                                run = ctx->f( &row, ctx->data );
+                                ctx->n++;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
+
+
+uint64_t foreach_statistic( statistic * data,
+    bool ( CC * f ) ( stat_row * row, void * f_data ), void *f_data )
+{
+    iter_ctx ctx;
+    ctx.f = f;
+    ctx.data = f_data;
+    ctx.n = 0;
+    BSTreeForEach ( &data->spotgroups, false, spotgroup_iter, &ctx );
+    return ctx.n;
+}
+
+
+/************** WRITER **********************************************/
+static rc_t open_writer_cursor( statistic_writer *writer )
+{
+    rc_t rc = 0;
+    uint32_t idx;
+
+    for ( idx = 0; idx < N_WIDX && rc == 0; ++idx )
+    {
+        rc = add_column( writer->cursor, &writer->wr_col[ idx ], widx_names[ idx ] );
+    }
+    if ( rc == 0 )
+    {
+        rc = VCursorOpen ( writer->cursor );
+        if ( rc != 0 )
+            LogErr( klogInt, rc, "VCursorOpen failed\n" );
+    }
+    return rc;
+}
+
+
+rc_t make_statistic_writer( statistic_writer *writer, VCursor * cursor )
+{
+    writer->cursor = cursor;
+    memset( &writer->wr_col, 0, sizeof writer->wr_col );
+    return open_writer_cursor( writer );
+}
+
+
+typedef struct writer_ctx
+{
+    statistic_writer *writer;
+    rc_t rc;
+} writer_ctx;
+
+
+static bool CC write_cb( stat_row * row, void * data )
+{
+    writer_ctx * ctx = ( writer_ctx * ) data;
+    col * cols = ( col * )&ctx->writer->wr_col;
+    VCursor * cursor = ctx->writer->cursor;
+  
+    rc_t rc = VCursorOpenRow( cursor );
+    if ( rc != 0 )
+        LogErr( klogInt, rc, "VCursorOpen() failed\n" );
+    if ( rc == 0 )
+        rc = write_to_cursor( cursor, cols[ WIDX_SPOT_GROUP ].idx, 8,
+                              row->spotgroup, string_size( row->spotgroup ),
+                              widx_names[ WIDX_SPOT_GROUP ] );
+    if ( rc == 0 )
+        rc = write_to_cursor( cursor, cols[ WIDX_KMER ].idx, 8,
+                              row->dimer, string_size( row->dimer ),
+                              widx_names[ WIDX_KMER ] );
+    if ( rc == 0 )
+        rc = write_to_cursor( cursor, cols[ WIDX_ORIG_QUAL ].idx, 8,
+                              &row->quality, 1, widx_names[ WIDX_ORIG_QUAL ] );
+    if ( rc == 0 )
+        rc = write_to_cursor( cursor, cols[ WIDX_CYCLE ].idx, 32,
+                              &row->base_pos, 1, widx_names[ WIDX_CYCLE ] );
+    if ( rc == 0 )
+        rc = write_to_cursor( cursor, cols[ WIDX_TOTAL_COUNT ].idx, 32,
+                              &row->count, 1, widx_names[ WIDX_TOTAL_COUNT ] );
+    if ( rc == 0 )
+        rc = write_to_cursor( cursor, cols[ WIDX_MISMATCH_COUNT ].idx, 32,
+                              &row->mismatch_count, 1,
+                              widx_names[ WIDX_MISMATCH_COUNT ] );
+    if ( rc == 0 )
+        rc = write_to_cursor( cursor, cols[ WIDX_HPRUN ].idx, 32,
+                              &row->hp_run, 1, widx_names[ WIDX_HPRUN ] );
+    if ( rc == 0 )
+        rc = write_to_cursor( cursor, cols[ WIDX_GC_CONTENT ].idx, 32,
+                              &row->gc_content, 1, widx_names[ WIDX_GC_CONTENT ] );
+    if ( rc == 0 )
+    {
+        rc = VCursorCommitRow( cursor );
+        if ( rc != 0 )
+            LogErr( klogInt, rc, "VCursorCommitRow() failed\n" );
+    }
+    if ( rc == 0 )
+    {
+        rc = VCursorCloseRow( cursor );
+        if ( rc != 0 )
+            LogErr( klogInt, rc, "VCursorCloseRow() failed\n" );
+    }
+
+    ctx->rc = rc;
+    return ( rc == 0 );
+}
+
+
+rc_t write_statistic( statistic_writer *writer, statistic *data,
+                      uint64_t * written )
+{
+    writer_ctx ctx;
+    uint64_t count;
+
+    ctx.writer = writer;
+    ctx.rc = 0;
+    count = foreach_statistic( data, write_cb, &ctx );
+    if ( written != NULL ) *written = count;
+
+    return ctx.rc;
+}
+
+
+rc_t whack_statistic_writer( statistic_writer *writer )
+{
+    rc_t rc = VCursorCommit( writer->cursor );
+    if ( rc != 0 )
+        LogErr( klogInt, rc, "VCursorCommit() failed\n" );
+    return rc;
+}
diff --git a/tools/qual-recalib-stat/stat_mod.h b/tools/qual-recalib-stat/stat_mod.h
new file mode 100644
index 0000000..9bec173
--- /dev/null
+++ b/tools/qual-recalib-stat/stat_mod.h
@@ -0,0 +1,148 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_stat_mod_
+#define _h_stat_mod_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <klib/rc.h>
+#include <klib/container.h>
+#include <klib/text.h>
+#include <klib/log.h>
+#include <klib/out.h>
+#include <vdb/cursor.h>
+#include "ref_exclude.h"
+#include "columns.h"
+
+#define N_QUAL_VALUES 40
+#define N_DIMER_VALUES 17
+#define N_GC_VALUES 8
+#define N_HP_VALUES 16
+
+#define POS_VECTOR_INC 50
+
+#define RIDX_READ            0
+#define RIDX_QUALITY         1
+#define RIDX_HAS_MISMATCH    2
+#define RIDX_SPOT_GROUP      3
+#define RIDX_SEQ_SPOT_GROUP  4
+#define RIDX_REF_ORIENTATION 5
+#define RIDX_READ_LEN        6
+#define RIDX_SEQ_READ_ID     7
+#define RIDX_HAS_REF_OFFSET  8
+#define RIDX_REF_OFFSET      9
+#define RIDX_REF_POS        10
+#define RIDX_REF_SEQ_ID     11
+#define RIDX_REF_LEN        12
+#define N_RIDX              13
+
+#define WIDX_SPOT_GROUP      0
+#define WIDX_KMER            1
+#define WIDX_ORIG_QUAL       2
+#define WIDX_TOTAL_COUNT     3
+#define WIDX_MISMATCH_COUNT  4
+#define WIDX_CYCLE           5
+#define WIDX_HPRUN           6
+#define WIDX_GC_CONTENT      7
+#define N_WIDX               8
+
+#define CASE_MATCH      0
+#define CASE_IGNORE     1
+#define CASE_MISMATCH   2
+
+
+typedef struct stat_row
+{
+    char * spotgroup;
+    char * dimer;
+    uint8_t quality;
+    uint32_t base_pos;
+    uint32_t count;
+    uint32_t mismatch_count;
+    uint32_t hp_run;
+    uint32_t gc_content;
+} stat_row;
+
+
+typedef struct statistic
+{
+    BSTree spotgroups;
+    col rd_col[ N_RIDX ];
+
+    ref_exclude exclude;
+    uint32_t gc_window;
+
+    uint8_t *exclude_vector;
+    uint32_t exclude_vector_len;
+
+    uint8_t *case_vector;
+    uint32_t case_vector_len;
+
+    void * last_used_spotgroup;
+} statistic;
+
+
+typedef struct statistic_writer
+{
+    VCursor *cursor;
+    col wr_col[ N_WIDX ];
+} statistic_writer;
+
+
+/*************** the READER ***************/
+rc_t make_statistic( statistic *data, uint32_t gc_window,
+                     KDirectory *dir, const char * exclude_db );
+
+rc_t open_statistic_cursor( statistic * data, const VCursor *my_cursor );
+
+rc_t query_statistic_rowrange( statistic * data, const VCursor *my_cursor, 
+                               int64_t *first, uint64_t * count );
+
+rc_t read_and_extract_statistic_from_row( statistic * data,
+                const VCursor *my_cursor, const int64_t row_id );
+
+uint64_t foreach_statistic( statistic * data,
+    bool ( CC * f ) ( stat_row * row, void * f_data ), void *f_data );
+
+void whack_statistic( statistic *data );
+
+
+/*************** the WRITER ***************/
+rc_t make_statistic_writer( statistic_writer *writer, VCursor * cursor );
+
+rc_t write_statistic( statistic_writer *writer, statistic *data,
+                      uint64_t * written );
+
+rc_t whack_statistic_writer( statistic_writer *writer );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/qual-recalib-stat/stat_mod_1.c b/tools/qual-recalib-stat/stat_mod_1.c
new file mode 100644
index 0000000..3862c33
--- /dev/null
+++ b/tools/qual-recalib-stat/stat_mod_1.c
@@ -0,0 +1,962 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "stat_mod_1.h"
+#include <sysalloc.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+static const char * ridx_names[ N_RIDX ] =
+{
+    "RAW_READ",
+    "QUALITY",
+    "HAS_MISMATCH",
+    "SEQ_SPOT_ID",
+    "SPOT_GROUP",
+    "SEQ_SPOT_GROUP",
+    "REF_ORIENTATION",
+    "READ_LEN",
+    "SEQ_READ_ID",
+    "HAS_REF_OFFSET",
+    "REF_OFFSET",
+    "REF_POS",
+    "REF_SEQ_ID",
+    "REF_LEN"
+};
+
+
+static const char * widx_names[ N_WIDX ] =
+{
+    "SPOT_GROUP",
+    "KMER",
+    "ORIG_QUAL",
+    "TOTAL_COUNT",
+    "MISMATCH_COUNT",
+    "CYCLE",
+    "HPRUN",
+    "GC_CONTENT"
+};
+
+
+typedef struct counter
+{
+    uint32_t mismatches;
+    uint32_t count;
+} counter;
+
+
+typedef struct counter_vector
+{
+    counter *v;
+    uint32_t n_counters;
+} counter_vector;
+
+
+typedef struct spotgrp
+{
+    BSTNode node;
+    const String *name;
+    counter_vector cnv[ N_DIMER_VALUES ][ N_GC_VALUES ][ N_HP_VALUES ][ N_QUAL_VALUES ];
+} spotgrp;
+
+
+static const uint8_t char_2_base_bin[26] =
+{
+   /* 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*/
+      0, 4, 1, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4
+};
+
+
+static uint8_t dimer_2_bin( char c0, char c1 )
+{
+    uint8_t res = 16;
+
+    if ( c0 >= 'A' && c0 <= 'Z' && c1 >= 'A' && c1 <= 'Z' )
+    {
+        uint8_t t1 = char_2_base_bin[ (uint8_t)( c0 - 'A' ) ];
+        uint8_t t2 = char_2_base_bin[ (uint8_t)( c1 - 'A' ) ];
+        if ( t1 < 4 && t2 < 4 )
+        {
+            res = t1;
+            res <<= 2;
+            res |= t2;
+        }
+    }
+    return res;
+}
+
+
+static const char * dimer_2_ascii[] = 
+{ "AA", "AC", "AG", "AT", 
+  "CA", "CC", "CG", "CT",
+  "GA", "GC", "GG", "GT",
+  "TA", "TC", "TG", "TT", "XX" };
+
+
+/******************************************************************************
+    for the spot-group ( tree-node ), contains a tree of counter's
+******************************************************************************/
+static void CC whack_spotgroup( BSTNode *n, void *data )
+{
+    spotgrp * sg = ( spotgrp * )n;
+    uint32_t idx, count;
+    count = ( ( sizeof sg->cnv ) / sizeof( sg->cnv[0] ) );
+    for ( idx = 0; idx < count; ++idx )
+    {
+        counter_vector * cv = (counter_vector *)&( sg->cnv[ idx ] );
+        if ( cv->v != NULL )
+        {
+            free( cv->v );
+        }
+    }
+    if ( sg->name != NULL )
+        StringWhack ( sg->name );
+    free( n );
+}
+
+
+static spotgrp * make_spotgrp( const char *src, const size_t len )
+{
+    spotgrp * sg = calloc( 1, sizeof sg[ 0 ] );
+    if ( sg != NULL )
+    {
+        String s;
+        StringInit( &s, src, len, len );
+        if ( StringCopy ( &sg->name, &s ) != 0 )
+        {
+            free( sg );
+            sg = NULL;
+        }
+    }
+    return sg;
+}
+
+
+static int CC spotgroup_find( const void *item, const BSTNode *n )
+{
+    spotgrp * sg = ( spotgrp* ) n;
+    return StringCompare ( ( String* ) item, sg->name );
+}
+
+
+static spotgrp * find_spotgroup( statistic *data, const char *src, const size_t len )
+{
+    String s;
+    BSTNode *node;
+
+    StringInit( &s, src, len, len );
+    if ( data->last_used_spotgroup != NULL )
+    {
+        spotgrp * sg = ( spotgrp* )data->last_used_spotgroup;
+        if ( StringCompare ( &s, sg->name ) == 0 )
+            return sg;
+    }
+
+    node = BSTreeFind ( &data->spotgroups, &s, spotgroup_find );
+    if ( node == NULL )
+        return NULL;
+    else
+    {
+        data->last_used_spotgroup = node;
+        return ( spotgrp *) node;
+    }
+}
+
+
+static rc_t spotgroup_enter_values( spotgrp * spotgroup,
+                                    const uint8_t quality,
+                                    const uint8_t dimer_code,
+                                    const uint8_t gc_content,
+                                    const uint8_t hp_run,
+                                    const uint32_t cycle,
+                                    const uint8_t rd_case,
+                                    const uint64_t row_id )
+{
+    rc_t rc = 0;
+    uint8_t q = quality;
+    uint8_t d = dimer_code;
+    uint8_t g = gc_content;
+    uint8_t h = hp_run;
+    counter_vector * cv;
+
+    if ( q >= N_QUAL_VALUES ) q = ( N_QUAL_VALUES - 1 );
+    if ( d >= N_DIMER_VALUES ) d = ( N_DIMER_VALUES - 1 );
+    if ( g >= N_GC_VALUES ) g = ( N_GC_VALUES - 1 );
+    if ( h >= N_HP_VALUES ) h = ( N_HP_VALUES - 1 );
+    cv = &( spotgroup->cnv[ d ][ g ][ h ][ q ] );
+
+    if ( cv->v ==  NULL )
+    {
+        /* the counter-block was not used before at all */
+        cv->n_counters = ( ( cycle / COUNTER_BLOCK_SIZE ) + 1 ) * COUNTER_BLOCK_SIZE;
+        cv->v = calloc( cv->n_counters, sizeof cv->v[0] );
+        if ( cv->v == NULL )
+        {
+            rc = RC( rcApp, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+            PLOGERR( klogInt, ( klogInt, rc, 
+                     "calloc() failed at row#$(row_nr) cycle#$(cycle)",
+                     "row_nr=%lu,cycle=%u", row_id, cycle ) );
+        }
+    }
+    else
+    {
+        if ( cycle >= cv->n_counters )
+        {
+            /* the counter-block has to be extended */
+            void * tmp;
+            uint32_t org_len = cv->n_counters;
+            cv->n_counters = ( ( cycle / COUNTER_BLOCK_SIZE ) + 1 ) * COUNTER_BLOCK_SIZE;
+            /* prevent from leaking memory by capturing the new pointer in temp. var. */
+            tmp = realloc( cv->v, cv->n_counters * ( sizeof cv->v[0] ) );
+            if ( tmp == NULL )
+            {
+                rc = RC( rcApp, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+                PLOGERR( klogInt, ( klogInt, rc, 
+                         "realloc() failed at row#$(row_nr) cycle#$(cycle)",
+                         "row_nr=%lu,cycle=%u", row_id, cycle ) );
+            }
+            else
+            {
+                /* the added part has to be set to zero */
+                counter * to_zero_out = tmp;
+                to_zero_out += org_len;
+                memset( to_zero_out, 0, ( cv->n_counters - org_len ) * ( sizeof *to_zero_out ) );
+                cv->v = tmp;
+            }
+        }
+    }
+    assert( cycle < cv->n_counters );
+
+    if ( rc == 0 )
+    {
+        counter * cnt = &( cv->v[ cycle ] );
+        switch( rd_case )
+        {
+            case CASE_MISMATCH : cnt->mismatches++; /* no break intented! */
+            case CASE_MATCH    : cnt->count++;
+                                 break;
+        }
+    }
+    return rc;
+}
+
+
+static int CC spotgroup_sort( const BSTNode *item, const BSTNode *n )
+{
+    spotgrp * sg1 = ( spotgrp* ) item;
+    spotgrp * sg2 = ( spotgrp* ) n;
+    return StringCompare ( sg1->name, sg2->name );
+}
+
+
+/******************************************************************************
+    for the statistic ( tree-node ), contains a tree of spot-groups's
+******************************************************************************/
+static rc_t make_vector( void ** ptr, uint32_t *len, uint32_t new_len )
+{
+    rc_t rc = 0;
+
+    *len = new_len;
+    *ptr = calloc( 1, new_len );
+    if ( *ptr == NULL )
+    {
+        *len = 0;
+        rc = RC( rcApp, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+        LogErr( klogInt, rc, "failed to make large enough exclude-vector\n" );
+    }
+    return rc;
+}
+
+
+rc_t make_statistic( statistic *data, uint32_t gc_window, uint8_t cycle_offset,
+                     KDirectory *dir, const char * exclude_db,
+                     bool info, bool ignore_mismatches )
+{
+    rc_t rc = 0;
+    memset( data, 0, sizeof *data );
+    BSTreeInit( &data->spotgroups );
+    data->last_used_spotgroup = NULL;
+    data->sequence = NULL;
+    data->ignore_mismatches = ignore_mismatches;
+    memset( &data->rd_col, 0, sizeof data->rd_col );
+    if ( exclude_db != NULL )
+    {
+        make_ref_exclude( &data->exclude, dir, exclude_db, info );
+        data->ref_exclude_used = true;
+    }
+    data->gc_window = gc_window;
+    if ( data->gc_window >= N_GC_VALUES )
+    {
+        data->gc_window = ( N_GC_VALUES - 1 );
+    }
+    data->cycle_offset = cycle_offset;
+    if ( data->cycle_offset > 1 )
+    {
+        data->cycle_offset = 1;
+    }
+
+    if ( rc == 0 && data->ref_exclude_used )
+    {
+        rc = make_vector( (void**)&data->exclude_vector, &data->exclude_vector_len, 512 );
+    }
+    if ( rc == 0 )
+    {
+        rc = make_vector( (void**)&data->case_vector, &data->case_vector_len, 512 );
+    }
+    return rc;
+}
+
+
+void set_spot_pos_statistic( statistic *data, spot_pos * sequence )
+{
+    data->sequence = sequence;
+}
+
+
+void whack_statistic( statistic *data )
+{
+    BSTreeWhack ( &data->spotgroups, whack_spotgroup, NULL );
+    if ( data->ref_exclude_used )
+    {
+        whack_ref_exclude( &data->exclude );
+    }
+    if ( data->exclude_vector != NULL )
+    {
+        free( data->exclude_vector );
+    }
+    if ( data->case_vector != NULL )
+    {
+        free( data->case_vector );
+    }
+}
+
+
+static rc_t expand_and_clear_vector( void **v, uint32_t *len, uint32_t new_len, bool clear )
+{
+    rc_t rc = 0;
+    if ( *v != NULL )
+    {
+        if ( *len < new_len )
+        {
+            *len += new_len;
+            *v = realloc( *v, *len );
+            if ( *v == NULL )
+            {
+                rc = RC( rcApp, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+                LogErr( klogInt, rc, "failed to expand (uint8_t)vector\n" );
+            }
+        }
+        if ( rc == 0 && clear )
+            memset( *v, 0, *len ); 
+    }
+    return rc;
+}
+
+
+static rc_t get_exlude_vector( statistic * data, uint32_t *ref_len )
+{
+    /* we need: REF_OFFSET, REF_LEN and REF_NAME for that */
+    rc_t rc = 0;
+
+    if ( data->ref_exclude_used )
+    {
+        String s_ref_name;
+        const char * ref_name_base = ( const char * )data->rd_col[ RIDX_REF_SEQ_ID ].base;
+        uint32_t ref_name_len = data->rd_col[ RIDX_REF_SEQ_ID ].row_len;
+
+        int32_t ref_offset = *( ( int32_t *)data->rd_col[ RIDX_REF_POS ].base );
+        *ref_len = *( ( uint32_t *)data->rd_col[ RIDX_REF_LEN ].base );
+
+        StringInit( &s_ref_name, ref_name_base, ref_name_len, ref_name_len );
+
+        /* make the ref-exclude-vector longer if necessary */
+        rc = expand_and_clear_vector( (void**)&data->exclude_vector,
+                                      &data->exclude_vector_len,
+                                      *ref_len,
+                                      true );
+        if ( rc == 0 )
+            rc = get_ref_exclude( &data->exclude,
+                                  &s_ref_name,
+                                  ref_offset,
+                                  *ref_len,
+                                  data->exclude_vector,
+                                  &data->active_exclusions );
+    }
+
+    return rc;
+}
+
+
+static rc_t walk_exclude_vector( statistic * data,
+                                 uint32_t n_bases,
+                                 uint32_t ref_len )
+{
+    rc_t rc = 0;
+    /* we need: HAS_REF_OFFSET, REF_OFFSET and HAS_MISMATCH for that */
+
+    const char * has_roffs = ( const char * )data->rd_col[ RIDX_HAS_REF_OFFSET ].base;
+    uint32_t has_roffs_len = data->rd_col[ RIDX_HAS_REF_OFFSET ].row_len;
+
+    const int32_t * roffs = ( const int32_t * )data->rd_col[ RIDX_REF_OFFSET ].base;
+    uint32_t roffs_len = data->rd_col[ RIDX_REF_OFFSET ].row_len;
+
+    const char * has_mm = ( const char * )data->rd_col[ RIDX_HAS_MISMATCH ].base;
+    uint32_t has_mm_len = data->rd_col[ RIDX_HAS_MISMATCH ].row_len;
+
+    if ( has_roffs_len != n_bases || has_mm_len != n_bases )
+    {
+        rc = RC( rcApp, rcNoTarg, rcConstructing, rcParam, rcInvalid );
+        LogErr( klogInt, rc, "number of bases does not match length of HAS_REF_OFFSET or HAS_MISMATCH\n" );
+    }
+    else
+    {
+        /* we count how many REF_OFFSETS have to be there... */
+        uint32_t hro_count = 0;
+        uint32_t idx;
+        for ( idx = 0; idx < n_bases; ++idx )
+        {
+            if ( has_roffs[ idx ] == '1' )
+                hro_count++;
+        }
+        if ( hro_count != roffs_len )
+        {
+            rc = RC( rcApp, rcNoTarg, rcConstructing, rcParam, rcInvalid );
+            LogErr( klogInt, rc, "number of HAS_REF_OFFSET=1 does not match length of REF_OFFSET\n" );
+        }
+    }
+
+    /* */
+    if ( rc == 0 )
+    {
+        int32_t ref_idx = 0;
+        uint32_t base_idx;
+        uint32_t roffs_idx = 0;
+
+        /* walk backwards from the end to apply right-clipping */
+        assert( n_bases > 0 );
+        base_idx = n_bases - 1;
+        while ( base_idx > 0 && has_mm[ base_idx ] == '1' )
+        {
+            data->case_vector[ base_idx-- ] = CASE_IGNORE;
+            n_bases--;
+        }
+
+        base_idx = 0;
+        while ( ref_idx < (int32_t)ref_len && base_idx < n_bases )
+        {
+            /* before we handle the reference, apply the ref-offset to the
+               iterator ( in this case: ref_idx ) */
+            if ( has_roffs[ base_idx ] == '1' )
+            {
+                int32_t roffs_value = roffs[ roffs_idx++ ];
+                /* this handles the left-clipping and inserts */
+                if ( roffs_value < 0 )
+                {
+                    while( roffs_value++ < 0 )
+                    {
+                        data->case_vector[ base_idx++ ] = CASE_IGNORE;
+                    }
+                }
+                else
+                {
+                    ref_idx += roffs_value;
+                }
+            }
+            assert( ref_idx >= 0 );
+            /* right now ref_idx and base_idx points to corresponding positions */
+
+            /* all the calculation is only done to put the IGNORE-flags
+               into the right base-position (if necessary): */
+            if ( data->exclude_vector[ ref_idx++ ] > 0 )
+            {
+                data->case_vector[ base_idx ] = CASE_IGNORE;
+            }
+            else
+            {
+                /* enter the mis-matches into the case-vector */
+                if ( has_mm[ base_idx ] == '1' )
+                {
+                    data->case_vector[ base_idx ] = CASE_MISMATCH;
+                }
+            }
+            ++base_idx;
+        }
+    }
+    return rc;
+}
+
+
+static rc_t loop_through_base_calls( spotgrp *sg,
+                        uint32_t gc_window,
+                        uint8_t cycle_offset,
+                        char * read_ptr,    /* points at begin of array */
+                        uint32_t n_bases,
+                        uint8_t * qual_ptr, /* points at begin of array */
+                        uint8_t * case_ptr, /* points at begin of array */
+                        uint32_t base_pos_offset,
+                        const int64_t row_id,
+                        const int32_t ofs )
+{
+    rc_t rc = 0;
+    uint32_t base_pos;
+    char prev_char = 0;
+    char * gc_ptr = read_ptr;
+    uint8_t gc_content = 0;
+    uint8_t hp_run = 0;
+    bool enter_value;
+
+    for ( base_pos = 0; base_pos < ( n_bases - 1 ) && rc == 0; ++base_pos )
+    {
+        /* calculate the hp-run-count */
+        if ( prev_char == *read_ptr )
+        {
+            hp_run++;
+            assert( hp_run <= n_bases );
+        }
+        else
+        {
+            prev_char = *read_ptr;
+            hp_run = 0;
+        }
+
+        /* advance the "window" */
+        if ( base_pos >= ( gc_window + 1 ) )
+        {
+            if ( *gc_ptr == 'G' || *gc_ptr == 'C' )
+            {
+                assert( gc_content > 0 );
+                gc_content--;
+            }
+            gc_ptr++;
+        }
+
+        if ( case_ptr != NULL )
+        {
+            enter_value = ( case_ptr[0] != CASE_IGNORE && case_ptr[ofs] != CASE_IGNORE );
+        }
+        else
+        {
+            enter_value = true;
+        }
+
+        if ( enter_value )
+        {
+            uint8_t case_value = CASE_MATCH;
+            if ( case_ptr != NULL )
+            {
+                case_value = case_ptr[1];
+            }
+            rc = spotgroup_enter_values( sg,
+                                         qual_ptr[1],
+                                         dimer_2_bin( read_ptr[0], read_ptr[1] ),
+                                         gc_content,
+                                         hp_run,
+                                         base_pos + base_pos_offset + cycle_offset,
+                                         case_value,
+                                         row_id );
+        }
+
+        /* handle the current base-position after the record was entered
+           because we do not include the current base into the gc-content */
+        if ( *read_ptr == 'G' || *read_ptr == 'C' )
+            gc_content++;
+
+        qual_ptr += ofs;
+        read_ptr++;
+        if ( case_ptr != NULL )
+        {
+            case_ptr += ofs;
+        }
+    }
+    return rc;
+}
+
+
+static rc_t extract_spotgroup_statistic( statistic * data,
+                                         spotgrp *sg,
+                                         uint32_t n_bases,
+                                         const int64_t row_id )
+{
+    uint32_t ref_len, seq_read_id, base_pos_offset = 0;
+    char *read_ptr = ( char * )data->rd_col[ RIDX_READ ].base;
+    uint8_t *qual_ptr = ( uint8_t * )data->rd_col[ RIDX_QUALITY ].base;
+    const bool * reverse = data->rd_col[ RIDX_REF_ORIENTATION ].base;
+
+    /* (1) ... make the case-vector longer if necessary */
+    rc_t rc = expand_and_clear_vector( (void**)&data->case_vector,
+                                      &data->case_vector_len,
+                                      n_bases,
+                                      true );
+    if ( rc != 0 )
+    {
+        PLOGERR( klogInt, ( klogInt, rc, 
+             "expand_and_clear_vector( case_vector ) failed at row $(row_nr)",
+             "row_nr=%lu", row_id ) );
+    }
+
+    /* (2) ... get the exclusion-list for this read */
+    if ( data->ref_exclude_used )
+    {
+        rc = get_exlude_vector( data, &ref_len );
+        if ( rc != 0 )
+        {
+            PLOGERR( klogInt, ( klogInt, rc, 
+                 "get_exlude_vector() failed at row $(row_nr)",
+                 "row_nr=%lu", row_id ) );
+        }
+
+        /* (3) ... walk the exclusion-list and Mismatch-vector to build the case-vector */
+        if ( rc == 0 )
+        {
+            rc = walk_exclude_vector( data, n_bases, ref_len );
+            if ( rc != 0 )
+            {
+                PLOGERR( klogInt, ( klogInt, rc, 
+                     "walk_exclude_vector failed at row $(row_nr)",
+                     "row_nr=%lu", row_id ) );
+            }
+        }
+    }
+    else
+    {
+        if ( !data->ignore_mismatches )
+        {
+            const char * has_mm = ( const char * )data->rd_col[ RIDX_HAS_MISMATCH ].base;
+            uint32_t has_mm_len = data->rd_col[ RIDX_HAS_MISMATCH ].row_len;
+            uint32_t base_idx;
+            for ( base_idx = 0; base_idx < n_bases && base_idx < has_mm_len; ++base_idx )
+            {
+                if ( has_mm[ base_idx ] == '1' )
+                {
+                    data->case_vector[ base_idx ] = CASE_MISMATCH;
+                }
+            }
+        }
+    }
+
+    /* (4) ... query the base-postion of this read in the spot from the SEQUENCE-table */
+    seq_read_id = *( ( uint32_t * )data->rd_col[ RIDX_SEQ_READ_ID ].base );
+#ifdef LOOKUP_ALL_SEQ_READ_ID
+    if ( seq_read_id > 0 )
+#else
+    if ( seq_read_id > 1 )
+#endif
+    {
+        uint32_t spot_id = *( ( uint32_t * )data->rd_col[ RIDX_SEQ_SPOT_ID ].base );
+        rc = query_spot_pos( data->sequence, seq_read_id, spot_id, &base_pos_offset );
+    }
+
+    /* (5) ... looping throuhg the bases ( forward/backward ) */
+    if ( rc == 0 )
+    {
+
+        if ( *reverse )
+        {
+            uint8_t * loc_case_vector = data->case_vector + ( n_bases - 1 );
+            qual_ptr += ( n_bases - 1 );
+            rc = loop_through_base_calls( sg, data->gc_window, data->cycle_offset,
+                    read_ptr, n_bases, qual_ptr, loc_case_vector,
+                    base_pos_offset, row_id, -1 );
+
+        }
+        else
+        {
+            rc = loop_through_base_calls( sg, data->gc_window, data->cycle_offset,
+                    read_ptr, n_bases, qual_ptr, data->case_vector, 
+                    base_pos_offset, row_id, +1 );
+        }
+    }
+    return rc;
+}
+
+
+static rc_t extract_statistic_from_row( statistic * data, const int64_t row_id )
+{
+    rc_t rc = 0;
+    spotgrp *sg;
+
+    /* first try the SPOT_GROUP column (correct for newer db's) */
+    const char * spotgrp_base  = data->rd_col[ RIDX_SPOT_GROUP ].base;
+    uint32_t spotgrp_len = data->rd_col[ RIDX_SPOT_GROUP ].row_len;
+    if ( spotgrp_len < 1 || *spotgrp_base == 0 )
+    {
+        /* if empty try with SEQ_SPOT_GROUP column (correct for older db's) */
+        spotgrp_base  = data->rd_col[ RIDX_SEQ_SPOT_GROUP ].base;
+        spotgrp_len = data->rd_col[ RIDX_SEQ_SPOT_GROUP ].row_len;
+    }
+
+    sg = find_spotgroup( data, spotgrp_base, spotgrp_len );
+    if ( sg == NULL )
+    {
+        sg = make_spotgrp( spotgrp_base, spotgrp_len );
+        if ( sg == NULL )
+        {
+            rc = RC( rcApp, rcSelf, rcConstructing, rcMemory, rcExhausted );
+            PLOGERR( klogInt, ( klogInt, rc, 
+                     "make_spotgrp failed at row $(row_nr)", "row_nr=%lu", row_id ) );
+        }
+        else
+        {
+            rc = BSTreeInsert ( &data->spotgroups, (BSTNode *)sg, spotgroup_sort );
+            if ( rc != 0 )
+            {
+                PLOGERR( klogInt, ( klogInt, rc, 
+                     "BSTreeInsert( new spotgroup ) at row $(row_nr)", "row_nr=%lu", row_id ) );
+            }
+        }
+    }
+    if ( rc == 0 )
+    {
+        uint32_t n_bases  = data->rd_col[ RIDX_READ ].row_len;
+        uint32_t qual_len = data->rd_col[ RIDX_QUALITY ].row_len;
+        uint32_t hmis_len = data->rd_col[ RIDX_HAS_MISMATCH ].row_len;
+
+        if ( ( n_bases == qual_len ) &&  ( n_bases == hmis_len ) )
+        {
+            rc = extract_spotgroup_statistic( data, sg, n_bases, row_id );
+        }
+        else
+        {
+            rc = RC( rcApp, rcNoTarg, rcConstructing, rcData, rcInvalid );
+            PLOGERR( klogInt, ( klogInt, rc, 
+                 "number of bases, quality and has_mismatch is not the same at row $(row_nr)",
+                 "row_nr=%lu", row_id ) );
+        }
+    }
+    return rc;
+}
+
+
+rc_t read_and_extract_statistic_from_row( statistic * data, const VCursor *my_cursor, 
+                         const int64_t row_id )
+{
+    rc_t rc = read_cells( my_cursor, row_id, data->rd_col, ridx_names, N_RIDX );
+    if ( rc == 0 )
+    {
+        rc = extract_statistic_from_row( data, row_id );
+    }
+    return rc;
+}
+
+
+rc_t query_statistic_rowrange( statistic * data, const VCursor *my_cursor, 
+                               int64_t *first, uint64_t * count )
+{
+    rc_t rc = VCursorIdRange ( my_cursor, data->rd_col[ RIDX_READ ].idx, first, count );
+    if ( rc != 0 )
+        LogErr( klogInt, rc, "VCursorIdRange() failed\n" );
+    return rc;
+}
+
+
+rc_t open_statistic_cursor( statistic * data, const VCursor *my_cursor )
+{
+    rc_t rc = add_columns( my_cursor, data->rd_col, ridx_names, N_RIDX );
+    if ( rc == 0 )
+    {
+        rc = VCursorOpen ( my_cursor );
+        if ( rc != 0 )
+            LogErr( klogInt, rc, "VCursorOpen failed\n" );
+    }
+    return rc;
+}
+
+
+typedef struct iter_ctx
+{
+    bool ( CC * f ) ( stat_row * row, void *data );
+    void * data;
+    const char * name;
+    bool run;
+    stat_row row;
+    uint64_t n;
+} iter_ctx;
+
+
+static bool CC spotgroup_iter( BSTNode *n, void *data )
+{
+    spotgrp *sg = ( spotgrp * ) n;
+    iter_ctx *ctx = ( iter_ctx * )data;
+
+    ctx->row.spotgroup = (char *)sg->name->addr;
+    for ( ctx->row.quality = 0; ctx->row.quality < N_QUAL_VALUES && ctx->run; ++ctx->row.quality )
+    {
+        uint8_t dimer_nr;
+        for ( dimer_nr = 0; dimer_nr < N_DIMER_VALUES && ctx->run; ++dimer_nr )
+        {
+            ctx->row.dimer = (char *)dimer_2_ascii[ dimer_nr ];
+            for( ctx->row.gc_content = 0; ctx->row.gc_content < N_GC_VALUES; ++ctx->row.gc_content )
+            {
+                for ( ctx->row.hp_run = 0; ctx->row.hp_run < N_HP_VALUES && ctx->run; ++ctx->row.hp_run )
+                {
+                    uint32_t pos;
+                    counter_vector * cv = &sg->cnv[ dimer_nr ][ ctx->row.gc_content ][ ctx->row.hp_run ][ ctx->row.quality ];
+                    for ( pos = 0; pos < cv->n_counters; ++pos )
+                    {
+                        counter * c = &cv->v[ pos ];
+                        if ( c->count > 0 )
+                        {
+                            ctx->row.base_pos = pos;
+                            ctx->row.count = c->count;
+                            ctx->row.mismatch_count = c->mismatches;
+
+                            ctx->run = ctx->f( &ctx->row, ctx->data );
+                            ctx->n++;
+                         }
+                    }
+                }
+            }
+        }
+    }
+    return( !ctx->run );
+}
+
+
+uint64_t foreach_statistic( statistic * data,
+    bool ( CC * f ) ( stat_row * row, void * f_data ), void *f_data )
+{
+    iter_ctx ctx;
+    ctx.f = f;
+    ctx.data = f_data;
+    ctx.run = true;
+    ctx.n = 0;
+    BSTreeDoUntil ( &data->spotgroups, false, spotgroup_iter, &ctx );
+    return ctx.n;
+}
+
+
+/************** WRITER **********************************************/
+static rc_t open_writer_cursor( statistic_writer *writer )
+{
+    rc_t rc = 0;
+    uint32_t idx;
+
+    for ( idx = 0; idx < N_WIDX && rc == 0; ++idx )
+    {
+        rc = add_column( writer->cursor, &writer->wr_col[ idx ], widx_names[ idx ] );
+    }
+    if ( rc == 0 )
+    {
+        rc = VCursorOpen ( writer->cursor );
+        if ( rc != 0 )
+            LogErr( klogInt, rc, "VCursorOpen failed\n" );
+    }
+    return rc;
+}
+
+
+rc_t make_statistic_writer( statistic_writer *writer, VCursor * cursor )
+{
+    writer->cursor = cursor;
+    memset( &writer->wr_col, 0, sizeof writer->wr_col );
+    return open_writer_cursor( writer );
+}
+
+
+typedef struct writer_ctx
+{
+    statistic_writer *writer;
+    rc_t rc;
+} writer_ctx;
+
+
+static bool CC write_cb( stat_row * row, void * data )
+{
+    writer_ctx * ctx = ( writer_ctx * ) data;
+    col * cols = ( col * )&ctx->writer->wr_col;
+    VCursor * cursor = ctx->writer->cursor;
+  
+    rc_t rc = VCursorOpenRow( cursor );
+    if ( rc != 0 )
+        LogErr( klogInt, rc, "VCursorOpen() failed\n" );
+    if ( rc == 0 )
+        rc = write_to_cursor( cursor, cols[ WIDX_SPOT_GROUP ].idx, 8,
+                              row->spotgroup, string_size( row->spotgroup ),
+                              widx_names[ WIDX_SPOT_GROUP ] );
+    if ( rc == 0 )
+        rc = write_to_cursor( cursor, cols[ WIDX_KMER ].idx, 8,
+                              row->dimer, string_size( row->dimer ),
+                              widx_names[ WIDX_KMER ] );
+    if ( rc == 0 )
+        rc = write_to_cursor( cursor, cols[ WIDX_ORIG_QUAL ].idx, 8,
+                              &row->quality, 1, widx_names[ WIDX_ORIG_QUAL ] );
+    if ( rc == 0 )
+        rc = write_to_cursor( cursor, cols[ WIDX_CYCLE ].idx, 32,
+                              &row->base_pos, 1, widx_names[ WIDX_CYCLE ] );
+    if ( rc == 0 )
+        rc = write_to_cursor( cursor, cols[ WIDX_TOTAL_COUNT ].idx, 32,
+                              &row->count, 1, widx_names[ WIDX_TOTAL_COUNT ] );
+    if ( rc == 0 )
+        rc = write_to_cursor( cursor, cols[ WIDX_MISMATCH_COUNT ].idx, 32,
+                              &row->mismatch_count, 1,
+                              widx_names[ WIDX_MISMATCH_COUNT ] );
+    if ( rc == 0 )
+        rc = write_to_cursor( cursor, cols[ WIDX_HPRUN ].idx, 32,
+                              &row->hp_run, 1, widx_names[ WIDX_HPRUN ] );
+    if ( rc == 0 )
+        rc = write_to_cursor( cursor, cols[ WIDX_GC_CONTENT ].idx, 32,
+                              &row->gc_content, 1, widx_names[ WIDX_GC_CONTENT ] );
+    if ( rc == 0 )
+    {
+        rc = VCursorCommitRow( cursor );
+        if ( rc != 0 )
+            LogErr( klogInt, rc, "VCursorCommitRow() failed\n" );
+    }
+    if ( rc == 0 )
+    {
+        rc = VCursorCloseRow( cursor );
+        if ( rc != 0 )
+            LogErr( klogInt, rc, "VCursorCloseRow() failed\n" );
+    }
+
+    ctx->rc = rc;
+    return ( rc == 0 );
+}
+
+
+rc_t write_statistic( statistic_writer *writer, statistic *data,
+                      uint64_t * written )
+{
+    writer_ctx ctx;
+    uint64_t count;
+
+    ctx.writer = writer;
+    ctx.rc = 0;
+    count = foreach_statistic( data, write_cb, &ctx );
+    if ( written != NULL ) *written = count;
+
+    return ctx.rc;
+}
+
+
+rc_t whack_statistic_writer( statistic_writer *writer )
+{
+    rc_t rc = VCursorCommit( writer->cursor );
+    if ( rc != 0 )
+        LogErr( klogInt, rc, "VCursorCommit() failed\n" );
+    return rc;
+}
diff --git a/tools/qual-recalib-stat/stat_mod_1.h b/tools/qual-recalib-stat/stat_mod_1.h
new file mode 100644
index 0000000..82cfa1c
--- /dev/null
+++ b/tools/qual-recalib-stat/stat_mod_1.h
@@ -0,0 +1,160 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_stat_mod_
+#define _h_stat_mod_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <klib/rc.h>
+#include <klib/container.h>
+#include <klib/text.h>
+#include <klib/log.h>
+#include <klib/out.h>
+#include <vdb/cursor.h>
+#include "ref_exclude.h"
+#include "columns.h"
+#include "spot_position.h"
+
+#define N_QUAL_VALUES 41
+#define N_DIMER_VALUES 17
+#define N_GC_VALUES 16
+#define N_HP_VALUES 25
+#define COUNTER_BLOCK_SIZE 100
+
+#define RIDX_READ            0
+#define RIDX_QUALITY         1
+#define RIDX_HAS_MISMATCH    2
+#define RIDX_SEQ_SPOT_ID     3
+#define RIDX_SPOT_GROUP      4
+#define RIDX_SEQ_SPOT_GROUP  5
+#define RIDX_REF_ORIENTATION 6
+#define RIDX_READ_LEN        7
+#define RIDX_SEQ_READ_ID     8
+#define RIDX_HAS_REF_OFFSET  9
+#define RIDX_REF_OFFSET     10
+#define RIDX_REF_POS        11
+#define RIDX_REF_SEQ_ID     12
+#define RIDX_REF_LEN        13
+#define N_RIDX              14
+
+#define WIDX_SPOT_GROUP      0
+#define WIDX_KMER            1
+#define WIDX_ORIG_QUAL       2
+#define WIDX_TOTAL_COUNT     3
+#define WIDX_MISMATCH_COUNT  4
+#define WIDX_CYCLE           5
+#define WIDX_HPRUN           6
+#define WIDX_GC_CONTENT      7
+#define N_WIDX               8
+
+#define CASE_MATCH      0
+#define CASE_IGNORE     1
+#define CASE_MISMATCH   2
+
+
+typedef struct stat_row
+{
+    char * spotgroup;
+    char * dimer;
+    uint8_t quality;
+    uint32_t base_pos;
+    uint32_t count;
+    uint32_t mismatch_count;
+    uint8_t hp_run;
+    uint8_t gc_content;
+} stat_row;
+
+
+typedef struct statistic
+{
+    BSTree spotgroups;      /* the tree contains 'spotgrp'-node, it collects the statistic */
+    col rd_col[ N_RIDX ];   /* a list of vdb-columns, the input-data per read */
+
+    bool ref_exclude_used;  /* flag indicating that the (VARLOC) exclude-vector is in use */
+    bool ignore_mismatches;
+
+    ref_exclude exclude;
+    uint32_t gc_window;
+    uint8_t cycle_offset;
+
+    uint8_t *exclude_vector;
+    uint32_t exclude_vector_len;
+    uint32_t active_exclusions;
+
+    uint8_t *case_vector;
+    uint32_t case_vector_len;
+
+    void * last_used_spotgroup;
+
+    spot_pos * sequence;
+} statistic;
+
+
+typedef struct statistic_writer
+{
+    VCursor *cursor;
+    col wr_col[ N_WIDX ];
+} statistic_writer;
+
+
+/*************** the READER ***************/
+rc_t make_statistic( statistic *data,
+                     uint32_t gc_window, uint8_t cycle_offset,
+                     KDirectory *dir, const char * exclude_db,
+                     bool info, bool ignore_mismatches );
+
+void set_spot_pos_statistic( statistic *data, spot_pos * sequence );
+
+rc_t open_statistic_cursor( statistic * data, const VCursor *my_cursor );
+
+rc_t query_statistic_rowrange( statistic * data, const VCursor *my_cursor, 
+                               int64_t *first, uint64_t * count );
+
+rc_t read_and_extract_statistic_from_row( statistic * data,
+                const VCursor *my_cursor, const int64_t row_id );
+
+uint64_t foreach_statistic( statistic * data,
+    bool ( CC * f ) ( stat_row * row, void * f_data ), void *f_data );
+
+void whack_statistic( statistic *data );
+
+
+/*************** the WRITER ***************/
+rc_t make_statistic_writer( statistic_writer *writer, VCursor * cursor );
+
+rc_t write_statistic( statistic_writer *writer, statistic *data,
+                      uint64_t * written );
+
+rc_t whack_statistic_writer( statistic_writer *writer );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/qual-recalib-stat/stat_mod_2.c b/tools/qual-recalib-stat/stat_mod_2.c
new file mode 100644
index 0000000..aeffbd3
--- /dev/null
+++ b/tools/qual-recalib-stat/stat_mod_2.c
@@ -0,0 +1,1041 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "stat_mod_2.h"
+#include <sysalloc.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <assert.h>
+
+typedef struct counter
+{
+    uint32_t mismatches;
+    uint32_t count;
+} counter;
+
+
+typedef struct counter_vector
+{
+    counter *v;
+    uint32_t n_counters;
+} counter_vector;
+
+#define USE_JUDY 1
+
+typedef struct spotgrp
+{
+    BSTNode node;
+    const String *name;
+#ifdef USE_JUDY
+    KVector *v;
+#else
+    counter_vector cnv[ N_MAX_QUAL_VALUES ][ N_READS ][ N_DIMER_VALUES ][ N_GC_VALUES ][ N_HP_VALUES ][ N_QUAL_VALUES ];
+#endif
+} spotgrp;
+
+
+static const uint8_t char_2_base_bin[26] =
+{
+   /* 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*/
+      0, 4, 1, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4
+};
+
+
+/*
+    AA ...  0       CA ...  5       GA ... 10       TA ... 15       NA ... 20
+    AC ...  1       CC ...  6       GC ... 11       TC ... 16       NC ... 21
+    AG ...  2       CG ...  7       GG ... 12       TG ... 17       NG ... 22
+    AT ...  3       CT ...  8       GT ... 13       TT ... 18       NT ... 23
+    AN ...  4       CN ...  9       GN ... 14       TN ... 19       NN ... 24
+
+    dimer-code = ( lookup( co ) * 5 ) + lookup( c1 )
+    dimer-code = 0 ... 24
+*/
+static uint8_t dimer_2_bin( char c0, char c1 )
+{
+    uint8_t lookup0, lookup1;
+
+    if ( c0 >= 'A' && c0 <= 'Z' )
+    {
+        lookup0 = char_2_base_bin[ (uint8_t)( c0 - 'A' ) ];
+    }
+    else
+    {
+        lookup0 = 4;
+    }
+
+    if ( c1 >= 'A' && c1 <= 'Z' )
+    {
+        lookup1 = char_2_base_bin[ (uint8_t)( c1 - 'A' ) ];
+    }
+    else
+    {
+        lookup1 = 4;
+    }
+
+    return ( ( lookup0 << 2 ) + lookup0 ) + lookup1;
+}
+
+static const char * dimer_2_ascii[] = 
+{ "AA", "AC", "AG", "AT", "AN",
+  "CA", "CC", "CG", "CT", "CN",
+  "GA", "GC", "GG", "GT", "GN",
+  "TA", "TC", "TG", "TT", "TN",
+  "NA", "NC", "NG", "NT", "NN" };
+
+/********************************************************************************
+  6666.5555.5555.5544.4444.4444.3333.3333.3322.2222.2222.1111.1111.1100.0000.0000
+  3210.9876.5432.1098.7654.3210.9876.5432.1098.7654.3210.9876.5432.1098.7654.3210
+  CCCC CCCC CCCC CCCC CCCC CCCC CCCC CCCC RRRR RRDD DDDG GGGH HHHH MMMM MMQQ QQQQ
+
+  C ... cycle ( 32 bit )
+  R ... nread ( 6 bit )
+  D ... dimer ( 5 bit )
+  G ... gc-content ( 4 bit )
+  H ... hp-run ( 5 bit )
+  M ... max. qual ( 6 bit )
+  Q ... quality ( 6 bit )
+*********************************************************************************/
+#ifdef USE_JUDY
+
+static uint64_t encode_key( const uint32_t pos,
+                            const uint8_t max_q,
+                            const uint8_t nread,
+                            const uint8_t dimer,
+                            const uint8_t gc,
+                            const uint8_t hp,
+                            const uint8_t qual )
+{
+    uint64_t res = pos;
+    res <<= 6;
+    res |= ( nread & 0x3F );
+    res <<= 5;
+    res |= ( dimer & 0x1F );
+    res <<= 4;
+    res |= ( gc & 0xF );
+    res <<= 5;
+    res |= ( hp & 0x1F );
+    res <<= 6;
+    res |= ( max_q & 0x3F );
+    res <<= 6;
+    res |= ( qual & 0x3F );
+    return res;
+}
+
+
+static void decode_key( const uint64_t key,
+                        uint32_t *pos,
+                        uint8_t *max_q,
+                        uint8_t *nread,
+                        uint8_t *dimer,
+                        uint8_t *gc,
+                        uint8_t *hp,
+                        uint8_t *qual )
+{
+    uint64_t temp = key;
+    *qual = temp & 0x3F;
+    temp >>= 6;
+    *max_q = temp & 0x3F;
+    temp >>= 6;
+    *hp = temp & 0x1F;
+    temp >>= 5;
+    *gc = temp & 0xF;
+    temp >>= 4;
+    *dimer = temp & 0x1F;
+    temp >>= 5;
+    *nread = temp & 0x3F;
+    temp >>= 6;
+    *pos = temp & 0xFFFFFFFF;
+}
+
+
+typedef struct two_counters
+{
+    uint32_t total;
+    uint32_t mismatch;
+} two_counters;
+
+typedef union counter_union
+{
+    uint64_t value;
+    two_counters counters;
+} counter_union;
+
+
+static bool set_counter( KVector *v,
+                         const uint32_t pos,
+                         const uint8_t max_q,
+                         const uint8_t nread,
+                         const uint8_t dimer,
+                         const uint8_t gc,
+                         const uint8_t hp,
+                         const uint8_t qual,
+                         bool mismatch )
+{
+    bool res = false;
+    counter_union u;
+    uint64_t key = encode_key( pos, max_q, nread, dimer, gc, hp, qual );
+    if ( KVectorGetU64 ( v, key, &(u.value) ) == 0 )
+    {
+        u.counters.total++;
+        if ( mismatch )
+        {
+            u.counters.mismatch++;
+        }
+    }
+    else
+    {
+        u.counters.total = 1;
+        res = true;
+        if ( mismatch )
+        {
+            u.counters.mismatch = 1;
+        }
+        else
+        {
+            u.counters.mismatch = 0;
+        }
+    }
+    KVectorSetU64 ( v, key, u.value );
+    return res;
+}
+
+#if 0
+static void get_counter( KVector *v,
+                         const uint32_t pos,
+                         const uint8_t max_q,
+                         const uint8_t nread,
+                         const uint8_t dimer,
+                         const uint8_t gc,
+                         const uint8_t hp,
+                         const uint8_t qual,
+                         uint32_t *total,
+                         uint32_t *mismatch )
+{
+    counter_union u;
+    uint64_t key = encode_key( pos, max_q, nread, dimer, gc, hp, qual );
+    if ( KVectorGetU64 ( v, key, &(u.value) ) == 0 )
+    {
+        *total = u.counters.total;
+        *mismatch = u.counters.mismatch;
+    }
+    else
+    {
+        *total = 0;
+        *mismatch = 0;
+    }
+}
+#endif
+
+#endif
+
+/******************************************************************************
+    for the spot-group ( tree-node ), contains a tree of counter's
+******************************************************************************/
+static void CC whack_spotgroup( BSTNode *n, void *data )
+{
+    spotgrp * sg = ( spotgrp * )n;
+
+#ifdef USE_JUDY
+    KVectorRelease ( sg->v );
+#else
+    uint32_t idx, count;
+    count = ( ( sizeof sg->cnv ) / sizeof( sg->cnv[0] ) );
+    for ( idx = 0; idx < count; ++idx )
+    {
+        counter_vector * cv = (counter_vector *)&( sg->cnv[ idx ] );
+        if ( cv->v != NULL )
+        {
+            free( cv->v );
+        }
+    }
+#endif
+
+    if ( sg->name != NULL )
+        StringWhack ( sg->name );
+    free( n );
+}
+
+
+static spotgrp * make_spotgrp( const char *src, const size_t len )
+{
+    spotgrp * sg = calloc( 1, sizeof sg[ 0 ] );
+    if ( sg != NULL )
+    {
+        String s;
+        StringInit( &s, src, len, len );
+        if ( StringCopy ( &sg->name, &s ) != 0 )
+        {
+            free( sg );
+            sg = NULL;
+        }
+#ifdef USE_JUDY
+        else
+        {
+            KVectorMake ( &sg->v );
+        }
+#endif
+    }
+    return sg;
+}
+
+
+static int CC spotgroup_find( const void *item, const BSTNode *n )
+{
+    spotgrp * sg = ( spotgrp* ) n;
+    return StringCompare ( ( String* ) item, sg->name );
+}
+
+
+static spotgrp * find_spotgroup( statistic *data, const char *src, const size_t len )
+{
+    String s;
+    BSTNode *node;
+
+    StringInit( &s, src, len, len );
+    if ( data->last_used_spotgroup != NULL )
+    {
+        spotgrp * sg = ( spotgrp* )data->last_used_spotgroup;
+        if ( StringCompare ( &s, sg->name ) == 0 )
+            return sg;
+    }
+
+    node = BSTreeFind ( &data->spotgroups, &s, spotgroup_find );
+    if ( node == NULL )
+        return NULL;
+    else
+    {
+        data->last_used_spotgroup = node;
+        return ( spotgrp *) node;
+    }
+}
+
+
+static rc_t spotgroup_enter_values( spotgrp * spotgroup,
+                                    uint64_t *entries,
+                                    const uint8_t quality,
+                                    const uint8_t dimer_code,
+                                    const uint8_t gc_content,
+                                    const uint8_t hp_run,
+                                    const uint8_t max_quality,
+                                    const uint8_t n_read,
+                                    const uint32_t cycle,
+                                    const uint8_t rd_case,
+                                    const uint64_t row_id )
+{
+    rc_t rc = 0;
+    uint8_t q = quality;
+    uint8_t d = dimer_code;
+    uint8_t g = gc_content;
+    uint8_t h = hp_run;
+    uint8_t m = max_quality;
+    uint8_t n = n_read;
+
+#ifdef USE_JUDY
+    bool mismatch;
+#else
+    counter_vector * cv;
+#endif
+
+    if ( q >= N_QUAL_VALUES ) q = ( N_QUAL_VALUES - 1 );
+    if ( d >= N_DIMER_VALUES ) d = ( N_DIMER_VALUES - 1 );
+    if ( g >= N_GC_VALUES ) g = ( N_GC_VALUES - 1 );
+    if ( h >= N_HP_VALUES ) h = ( N_HP_VALUES - 1 );
+    if ( m >= N_MAX_QUAL_VALUES ) m = ( N_MAX_QUAL_VALUES - 1 );
+    if ( n >= N_READS ) n = ( N_READS - 1 );
+
+
+#ifdef USE_JUDY
+    mismatch = false;
+    switch( rd_case )
+    {
+        case CASE_MISMATCH : mismatch = true; /* no break intented! */
+        case CASE_MATCH    : if ( set_counter( spotgroup->v, cycle, m, n, d, g, h, q, mismatch ) )
+                             {
+                                (*entries)++;
+                             }
+                             break;
+    }
+#else
+    cv = &( spotgroup->cnv[ m ][ n ][ d ][ g ][ h ][ q ] );
+
+    if ( cv->v ==  NULL )
+    {
+        /* the counter-block was not used before at all */
+        cv->n_counters = ( ( cycle / COUNTER_BLOCK_SIZE ) + 1 ) * COUNTER_BLOCK_SIZE;
+        cv->v = calloc( cv->n_counters, sizeof cv->v[0] );
+        if ( cv->v == NULL )
+        {
+            rc = RC( rcApp, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+            PLOGERR( klogInt, ( klogInt, rc, 
+                     "calloc() failed at row#$(row_nr) cycle#$(cycle)",
+                     "row_nr=%lu,cycle=%u", row_id, cycle ) );
+        }
+    }
+    else
+    {
+        if ( cycle >= cv->n_counters )
+        {
+            /* the counter-block has to be extended */
+            void * tmp;
+            uint32_t org_len = cv->n_counters;
+            cv->n_counters = ( ( cycle / COUNTER_BLOCK_SIZE ) + 1 ) * COUNTER_BLOCK_SIZE;
+            /* prevent from leaking memory by capturing the new pointer in temp. var. */
+            tmp = realloc( cv->v, cv->n_counters * ( sizeof cv->v[0] ) );
+            if ( tmp == NULL )
+            {
+                rc = RC( rcApp, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+                PLOGERR( klogInt, ( klogInt, rc, 
+                         "realloc() failed at row#$(row_nr) cycle#$(cycle)",
+                         "row_nr=%lu,cycle=%u", row_id, cycle ) );
+            }
+            else
+            {
+                /* the added part has to be set to zero */
+                counter * to_zero_out = tmp;
+                to_zero_out += org_len;
+                memset( to_zero_out, 0, ( cv->n_counters - org_len ) * ( sizeof *to_zero_out ) );
+                cv->v = tmp;
+            }
+        }
+    }
+    assert( cycle < cv->n_counters );
+
+    if ( rc == 0 )
+    {
+        counter * cnt = &( cv->v[ cycle ] );
+        switch( rd_case )
+        {
+            case CASE_MISMATCH : cnt->mismatches++; /* no break intented! */
+            case CASE_MATCH    : if ( cnt->count == 0 )
+                                 {
+                                    (*entries)++;
+                                 }
+                                 cnt->count++;
+                                 break;
+        }
+    }
+#endif
+    return rc;
+}
+
+
+static int CC spotgroup_sort( const BSTNode *item, const BSTNode *n )
+{
+    spotgrp * sg1 = ( spotgrp* ) item;
+    spotgrp * sg2 = ( spotgrp* ) n;
+    return StringCompare ( sg1->name, sg2->name );
+}
+
+
+/******************************************************************************
+    for the statistic ( tree-node ), contains a tree of spot-groups's
+******************************************************************************/
+static rc_t make_vector( void ** ptr, uint32_t *len, uint32_t new_len )
+{
+    rc_t rc = 0;
+
+    *len = new_len;
+    *ptr = calloc( 1, new_len );
+    if ( *ptr == NULL )
+    {
+        *len = 0;
+        rc = RC( rcApp, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+        LogErr( klogInt, rc, "failed to make large enough exclude-vector\n" );
+    }
+    return rc;
+}
+
+
+rc_t make_statistic( statistic *data,
+                     uint32_t gc_window,
+                     bool ignore_mismatches )
+{
+    rc_t rc = 0;
+    memset( data, 0, sizeof *data );
+    BSTreeInit( &data->spotgroups );
+    data->last_used_spotgroup = NULL;
+    data->ignore_mismatches = ignore_mismatches;
+    data->gc_window = gc_window;
+    if ( data->gc_window >= N_GC_VALUES )
+    {
+        data->gc_window = ( N_GC_VALUES - 1 );
+    }
+    if ( rc == 0 )
+    {
+        rc = make_vector( (void**)&data->case_vector, &data->case_vector_len, 512 );
+    }
+    return rc;
+}
+
+
+void whack_statistic( statistic *data )
+{
+    BSTreeWhack ( &data->spotgroups, whack_spotgroup, NULL );
+    if ( data->case_vector != NULL )
+    {
+        free( data->case_vector );
+    }
+}
+
+
+static rc_t expand_and_clear_vector( void **v, uint32_t *len, uint32_t new_len, bool clear )
+{
+    rc_t rc = 0;
+    if ( *v != NULL )
+    {
+        if ( *len < new_len )
+        {
+            *len += new_len;
+            *v = realloc( *v, *len );
+            if ( *v == NULL )
+            {
+                rc = RC( rcApp, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+                LogErr( klogInt, rc, "failed to expand (uint8_t)vector\n" );
+            }
+        }
+        if ( rc == 0 && clear )
+            memset( *v, 0, *len ); 
+    }
+    return rc;
+}
+
+#if 0
+static rc_t walk_exclude_vector( statistic * data,
+                                 uint32_t n_bases,
+                                 row_input * row_data )
+{
+    rc_t rc = 0;
+
+    if ( row_data->has_roffs_len != n_bases || 
+         row_data->has_mismatch_len != n_bases )
+    {
+        rc = RC( rcApp, rcNoTarg, rcConstructing, rcParam, rcInvalid );
+        LogErr( klogInt, rc, "number of bases does not match length of HAS_REF_OFFSET or HAS_MISMATCH\n" );
+    }
+    else
+    {
+        /* we count how many REF_OFFSETS have to be there... */
+        uint32_t hro_count = 0;
+        uint32_t idx;
+        for ( idx = 0; idx < n_bases; ++idx )
+        {
+            if ( row_data->has_roffs[ idx ] )
+                hro_count++;
+        }
+        if ( hro_count != row_data->roffs_len )
+        {
+            rc = RC( rcApp, rcNoTarg, rcConstructing, rcParam, rcInvalid );
+            LogErr( klogInt, rc, "number of HAS_REF_OFFSET=1 does not match length of REF_OFFSET\n" );
+        }
+    }
+
+    /* */
+    if ( rc == 0 )
+    {
+        int32_t ref_idx = 0;
+        uint32_t base_idx;
+        uint32_t roffs_idx = 0;
+
+        /* walk backwards from the end to apply right-clipping */
+        assert( n_bases > 0 );
+        base_idx = n_bases - 1;
+        while ( base_idx > 0 && row_data->has_mismatch[ base_idx ] )
+        {
+            data->case_vector[ base_idx-- ] = CASE_IGNORE;
+            n_bases--;
+        }
+
+        base_idx = 0;
+        while ( ref_idx < (int32_t)row_data->exclude_len && base_idx < n_bases )
+        {
+            /* before we handle the reference, apply the ref-offset to the
+               iterator ( in this case: ref_idx ) */
+            if ( row_data->has_roffs[ base_idx ] )
+            {
+                int32_t roffs_value = row_data->roffs[ roffs_idx++ ];
+                /* this handles the left-clipping and inserts */
+                if ( roffs_value < 0 )
+                {
+                    while( roffs_value++ < 0 )
+                    {
+                        data->case_vector[ base_idx++ ] = CASE_IGNORE;
+                    }
+                }
+                else
+                {
+                    ref_idx += roffs_value;
+                }
+            }
+            assert( ref_idx >= 0 );
+            /* right now ref_idx and base_idx points to corresponding positions */
+
+            /* all the calculation is only done to put the IGNORE-flags
+               into the right base-position (if necessary): */
+            if ( row_data->exclude[ ref_idx++ ] > 0 )
+            {
+                data->case_vector[ base_idx ] = CASE_IGNORE;
+            }
+            else
+            {
+                /* enter the mis-matches into the case-vector */
+                if ( row_data->has_mismatch[ base_idx ] )
+                {
+                    data->case_vector[ base_idx ] = CASE_MISMATCH;
+                }
+            }
+            ++base_idx;
+        }
+    }
+    return rc;
+}
+#endif
+
+static rc_t loop_through_base_calls( spotgrp *sg,
+                        uint64_t *entries,
+                        uint32_t gc_window,
+                        char * read_ptr,    /* points at begin of array */
+                        uint32_t n_bases,
+                        uint8_t * qual_ptr, /* points at begin of array */
+                        uint8_t * case_ptr, /* points at begin of array */
+                        uint32_t base_pos_offset,
+                        uint8_t n_read,     /* the number of the read (0/1) */
+                        const int64_t row_id,
+                        const int32_t ofs )
+{
+    rc_t rc = 0;
+    uint32_t base_pos;
+    char prev_char;
+    char * gc_ptr = read_ptr;
+    uint8_t gc_content = 0;
+    uint8_t hp_run = 0;
+    uint8_t max_qual_value = 0;
+    bool enter_value;
+    uint8_t *saved_qual_ptr = qual_ptr;
+
+    /* calculate the max. quality value, befor we loop through the bases a 2nd time */
+    for ( base_pos = 0; base_pos < n_bases; ++base_pos )
+    {
+        if ( max_qual_value < *qual_ptr )
+        {
+            max_qual_value = *qual_ptr;
+        }
+        qual_ptr += ofs; /* because of going from forward or reverse */
+    }
+    /* restore qual_ptr */
+    qual_ptr = saved_qual_ptr;
+
+    prev_char = 'N';
+    for ( base_pos = 0; base_pos < n_bases && rc == 0; ++base_pos )
+    {
+        /* calculate the hp-run-count */
+        if ( prev_char == *read_ptr )
+        {
+            hp_run++;
+            assert( hp_run <= n_bases );
+        }
+        else
+        {
+            hp_run = 0;
+        }
+
+        /* advance the "window" */
+        if ( base_pos >= ( gc_window + 1 ) )
+        {
+            if ( *gc_ptr == 'G' || *gc_ptr == 'C' )
+            {
+                assert( gc_content > 0 );
+                gc_content--;
+            }
+            gc_ptr++;
+        }
+
+        if ( case_ptr != NULL )
+        {
+            enter_value = ( case_ptr[0] != CASE_IGNORE && case_ptr[ofs] != CASE_IGNORE );
+        }
+        else
+        {
+            enter_value = true;
+        }
+
+        if ( enter_value )
+        {
+            uint8_t case_value = CASE_MATCH;
+            if ( case_ptr != NULL )
+            {
+                case_value = case_ptr[ 1 ];
+            }
+            rc = spotgroup_enter_values( sg, entries,
+                                         *qual_ptr,
+                                         dimer_2_bin( prev_char, *read_ptr ),
+                                         gc_content,
+                                         hp_run,
+                                         max_qual_value,
+                                         n_read,
+                                         base_pos + base_pos_offset,
+                                         case_value,
+                                         row_id );
+        }
+
+        /* handle the current base-position after the record was entered
+           because we do not include the current base into the gc-content */
+        if ( *read_ptr == 'G' || *read_ptr == 'C' )
+            gc_content++;
+
+        qual_ptr += ofs;
+        prev_char = *read_ptr;
+        read_ptr++;
+        if ( case_ptr != NULL )
+        {
+            case_ptr += ofs;
+        }
+    }
+    return rc;
+}
+
+
+static rc_t extract_spotgroup_statistic( statistic * data,
+                                         spotgrp *sg,
+                                         uint32_t n_bases,
+                                         row_input * row_data,
+                                         const int64_t row_id )
+{
+    /* (1) ... make the case-vector longer if necessary */
+    rc_t rc = expand_and_clear_vector( (void**)&data->case_vector,
+                                      &data->case_vector_len,
+                                      n_bases,
+                                      true );
+    if ( rc != 0 )
+    {
+        PLOGERR( klogInt, ( klogInt, rc, 
+                           "expand_and_clear_vector( case_vector ) failed at row $(row_nr)",
+                           "row_nr=%lu", row_id ) );
+    }
+    
+#if 1
+    if (rc == 0 && !data->ignore_mismatches) {
+        unsigned si;
+        unsigned ri;
+        unsigned j;
+        
+        for (si = ri = j = 0; si < n_bases && ri < row_data->ref_len; ) {
+            if (row_data->has_roffs[si]) {
+                int const offset = row_data->roffs[j++];
+                
+                if (offset < 0) {
+                    unsigned const n = -offset;
+                    unsigned k;
+
+                    /* set inserts to ignore (handles left soft clip) */
+                    for (k = 0; k < n && si + k < n_bases; ++k)
+                        data->case_vector[si + k] = CASE_IGNORE;
+                    si += k;
+                    continue;
+                }
+                ri += offset;
+            }
+            if (row_data->read[si] == 'N' || (row_data->exclude && row_data->exclude[ri]))
+                data->case_vector[si] = CASE_IGNORE;
+            else if (row_data->has_mismatch[si])
+                data->case_vector[si] = CASE_MISMATCH;
+            else
+                data->case_vector[si] = CASE_MATCH;
+            ++si;
+            ++ri;
+        }
+        /* handle right soft clip */
+        for ( ; si < n_bases; ++si)
+            data->case_vector[si] = CASE_IGNORE;
+    }
+#else
+    /* (2) ... get the exclusion-list for this read */
+    if ( row_data->exclude != NULL )
+    {
+        /* (3) ... walk the exclusion-list and Mismatch-vector to build the case-vector */
+        if ( rc == 0 )
+        {
+            rc = walk_exclude_vector( data, n_bases, row_data );
+            if ( rc != 0 )
+            {
+                PLOGERR( klogInt, ( klogInt, rc, 
+                     "walk_exclude_vector failed at row $(row_nr)",
+                     "row_nr=%lu", row_id ) );
+            }
+        }
+    }
+    else
+    {
+        if ( !data->ignore_mismatches )
+        {
+            uint32_t base_idx;
+            
+            for ( base_idx = 0;
+                  base_idx < n_bases && base_idx < row_data->has_mismatch_len;
+                  ++base_idx )
+            {
+                if ( row_data->has_mismatch[ base_idx ] )
+                {
+                    data->case_vector[ base_idx ] = CASE_MISMATCH;
+                }
+            }
+            /* handle left soft clip */
+            for ( base_idx = 0;
+                 base_idx < n_bases && base_idx < row_data->has_mismatch_len;
+                 ++base_idx )
+            {
+                if (!row_data->has_mismatch[base_idx]) {
+                    break;
+                }
+                data->case_vector[base_idx] = CASE_IGNORE;
+            }
+            /* handle right soft clip */
+            for ( base_idx = 0;
+                 base_idx < n_bases && base_idx < row_data->has_mismatch_len;
+                 ++base_idx )
+            {
+                if (!row_data->has_mismatch[row_data->has_mismatch_len - base_idx - 1]) {
+                    break;
+                }
+                data->case_vector[row_data->has_mismatch_len - base_idx - 1] = CASE_IGNORE;
+            }
+        }
+    }
+#endif
+
+    /* (4) ... looping throuhg the bases ( forward/backward ) */
+    if ( rc == 0 )
+    {
+        uint8_t *qual_ptr = row_data->quality;
+        if ( row_data->reversed )
+        {
+            uint8_t * loc_case_vector = data->case_vector + ( n_bases - 1 );
+            qual_ptr += ( n_bases - 1 );
+            rc = loop_through_base_calls( sg, &data->entries,
+                    data->gc_window, row_data->read, n_bases, qual_ptr, loc_case_vector,
+                    row_data->base_pos_offset, row_data->seq_read_id - 1, row_id, -1 );
+
+        }
+        else
+        {
+            rc = loop_through_base_calls( sg, &data->entries,
+                    data->gc_window, row_data->read, n_bases, qual_ptr, data->case_vector, 
+                    row_data->base_pos_offset, row_data->seq_read_id - 1, row_id, +1 );
+        }
+    }
+
+    if ( rc == 0 )
+    {
+        if ( n_bases > data->max_cycle )
+        {
+            data->max_cycle = n_bases;
+        }
+    }
+
+    return rc;
+}
+
+
+rc_t extract_statistic_from_row( statistic * data, 
+                                 row_input * row_data,
+                                 const int64_t row_id )
+{
+    rc_t rc = 0;
+    spotgrp *sg;
+
+    /* first try the SPOT_GROUP column (correct for newer db's) */
+    char * spotgrp_base = row_data->spotgroup;
+    uint32_t spotgrp_len = row_data->spotgroup_len;
+    /* first try the SPOT_GROUP column (correct for newer db's) */
+    if ( spotgrp_len < 1 || *spotgrp_base == 0 )
+    {
+        /* if empty try with SEQ_SPOT_GROUP column (correct for older db's) */
+        spotgrp_base  = row_data->seq_spotgroup;
+        spotgrp_len = row_data->seq_spotgroup_len;
+    }
+
+    sg = find_spotgroup( data, spotgrp_base, spotgrp_len );
+    if ( sg == NULL )
+    {
+        sg = make_spotgrp( spotgrp_base, spotgrp_len );
+        if ( sg == NULL )
+        {
+            rc = RC( rcApp, rcSelf, rcConstructing, rcMemory, rcExhausted );
+            PLOGERR( klogInt, ( klogInt, rc, 
+                     "make_spotgrp failed at row $(row_nr)", "row_nr=%lu", row_id ) );
+        }
+        else
+        {
+            rc = BSTreeInsert ( &data->spotgroups, (BSTNode *)sg, spotgroup_sort );
+            if ( rc != 0 )
+            {
+                PLOGERR( klogInt, ( klogInt, rc, 
+                     "BSTreeInsert( new spotgroup ) at row $(row_nr)", "row_nr=%lu", row_id ) );
+            }
+        }
+    }
+    if ( rc == 0 )
+    {
+        uint32_t n_bases  = row_data->read_len;
+
+        if ( ( n_bases == row_data->quality_len ) &&
+             ( n_bases == row_data->has_mismatch_len ) )
+        {
+            rc = extract_spotgroup_statistic( data, sg, n_bases, row_data, row_id );
+        }
+        else
+        {
+            rc = RC( rcApp, rcNoTarg, rcConstructing, rcData, rcInvalid );
+            PLOGERR( klogInt, ( klogInt, rc, 
+                 "number of bases, quality and has_mismatch is not the same at row $(row_nr)",
+                 "row_nr=%lu", row_id ) );
+        }
+    }
+    return rc;
+}
+
+
+typedef struct iter_ctx
+{
+    bool ( CC * f ) ( stat_row * row, void *data );
+    void * data;
+    const char * name;
+    bool run;
+    stat_row row;
+    uint64_t n;
+    uint32_t max_cycle;
+} iter_ctx;
+
+
+#ifdef USE_JUDY
+static rc_t CC counter_visit( uint64_t key, uint64_t value, void * data )
+{
+    uint8_t q, dimer, gc, hp, mq, nr;
+    uint32_t pos;
+    iter_ctx *ctx = ( iter_ctx * )data;
+    counter_union u;
+
+    decode_key( key, &pos, &mq, &nr, &dimer, &gc, &hp, &q );
+    u.value = value;
+
+    ctx->row.dimer = (char *)dimer_2_ascii[ dimer ];
+    ctx->row.quality = q;
+    ctx->row.gc_content = gc;
+    ctx->row.hp_run = hp;
+    ctx->row.max_qual_value = mq;
+    ctx->row.n_read = nr;
+    ctx->row.base_pos = pos;
+    ctx->row.count = u.counters.total;
+    ctx->row.mismatch_count = u.counters.mismatch;
+
+    ctx->run = ctx->f( &ctx->row, ctx->data );
+    ctx->n++;
+    return 0;
+}
+#endif
+
+
+static bool CC spotgroup_iter( BSTNode *n, void *data )
+{
+    spotgrp *sg = ( spotgrp * ) n;
+    iter_ctx *ctx = ( iter_ctx * )data;
+
+#ifndef USE_JUDY
+    uint8_t q, dimer, gc, hp, mq, nr;
+    uint32_t pos;
+#endif
+
+    ctx->row.spotgroup = (char *)sg->name->addr;
+
+#ifdef USE_JUDY
+    KVectorVisitU64 ( sg->v, false, counter_visit, data );
+#else
+    for ( pos = 0; pos <= ctx->max_cycle; ++pos )
+    {
+        for ( nr = 0; nr < N_READS; ++nr )
+        {
+            for ( dimer = 0; dimer < N_DIMER_VALUES; ++dimer )
+            {
+                for( gc = 0; gc < N_GC_VALUES; ++gc )
+                {
+                    for ( hp = 0; hp < N_HP_VALUES; ++hp )
+                    {
+                        for ( mq = 0; mq < N_MAX_QUAL_VALUES; ++mq )
+                        {
+                            for ( q = 0; q < N_QUAL_VALUES; ++q )
+                            {
+                                counter_vector * cv = &sg->cnv[ mq ][ nr ][ dimer ][ gc ][ hp ][ q ];
+                                if ( cv != NULL )
+                                {
+                                    if ( pos < cv->n_counters )
+                                    {
+                                        counter * c = &cv->v[ pos ];
+                                        if ( c->count > 0 )
+                                        {
+                                            ctx->row.dimer = (char *)dimer_2_ascii[ dimer ];
+                                            ctx->row.quality = q;
+                                            ctx->row.gc_content = gc;
+                                            ctx->row.hp_run = hp;
+                                            ctx->row.max_qual_value = mq;
+                                            ctx->row.n_read = nr;
+                                            ctx->row.base_pos = pos;
+                                            ctx->row.count = c->count;
+                                            ctx->row.mismatch_count = c->mismatches;
+
+                                            ctx->run = ctx->f( &ctx->row, ctx->data );
+                                            ctx->n++;
+                                         }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+#endif
+
+    return( !ctx->run );
+}
+
+
+uint64_t foreach_statistic( statistic * data,
+    bool ( CC * f ) ( stat_row * row, void * f_data ), void *f_data )
+{
+    iter_ctx ctx;
+    ctx.n = 0;
+    if ( f != NULL )
+    {
+        ctx.f = f;
+        ctx.data = f_data;
+        ctx.max_cycle = data->max_cycle;
+        ctx.run = true;
+        BSTreeDoUntil ( &data->spotgroups, false, spotgroup_iter, &ctx );
+    }
+    return ctx.n;
+}
diff --git a/tools/qual-recalib-stat/stat_mod_2.h b/tools/qual-recalib-stat/stat_mod_2.h
new file mode 100644
index 0000000..cc19d3a
--- /dev/null
+++ b/tools/qual-recalib-stat/stat_mod_2.h
@@ -0,0 +1,141 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_stat_mod_
+#define _h_stat_mod_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <klib/rc.h>
+#include <klib/container.h>
+#include <klib/text.h>
+#include <klib/log.h>
+#include <klib/out.h>
+#include <klib/vector.h>
+#include <vdb/cursor.h>
+#include "columns.h"
+
+#define N_QUAL_VALUES 41
+#define N_DIMER_VALUES 25
+#define N_GC_VALUES 8
+#define N_HP_VALUES 8
+#define N_READS 2
+#define N_MAX_QUAL_VALUES 41
+#define COUNTER_BLOCK_SIZE 100
+
+#define CASE_MATCH      0
+#define CASE_IGNORE     1
+#define CASE_MISMATCH   2
+
+
+typedef struct row_input
+{
+    char * spotgroup;
+    uint32_t spotgroup_len;
+
+    char * seq_spotgroup;
+    uint32_t seq_spotgroup_len;
+
+    char * read;
+    uint32_t read_len;
+
+    uint8_t * quality;
+    uint32_t quality_len;
+
+    bool * has_mismatch;
+    uint32_t has_mismatch_len;
+
+    bool * has_roffs;
+    uint32_t has_roffs_len;
+
+    int32_t * roffs;
+    uint32_t roffs_len;
+
+    uint8_t * exclude;
+    uint32_t exclude_len;
+
+    bool reversed;
+    uint32_t seq_read_id;
+    uint32_t spot_id;
+    uint32_t base_pos_offset;
+    uint32_t ref_len;
+} row_input;
+
+
+typedef struct stat_row
+{
+    char * spotgroup;
+    char * dimer;
+    uint8_t quality;
+    uint32_t base_pos;
+    uint32_t count;
+    uint32_t mismatch_count;
+    uint8_t hp_run;
+    uint8_t gc_content;
+    uint8_t max_qual_value;
+    uint8_t n_read;
+} stat_row;
+
+
+typedef struct statistic
+{
+    BSTree spotgroups;      /* the tree contains 'spotgrp'-node, it collects the statistic */
+
+    bool ignore_mismatches;
+
+    uint32_t gc_window;
+
+    uint8_t *case_vector;
+    uint32_t case_vector_len;
+
+    void * last_used_spotgroup;
+    uint64_t entries;
+    uint32_t max_cycle;
+} statistic;
+
+
+/*************** the STATISTIC GATHERER ***************/
+rc_t make_statistic( statistic *data,
+                     uint32_t gc_window,
+                     bool ignore_mismatches );
+
+
+rc_t extract_statistic_from_row( statistic * data, 
+                                 row_input * row_data,
+                                 const int64_t row_id );
+
+uint64_t foreach_statistic( statistic * data,
+    bool ( CC * f ) ( stat_row * row, void * f_data ), void *f_data );
+
+void whack_statistic( statistic *data );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/qual-recalib-stat/writer.c b/tools/qual-recalib-stat/writer.c
new file mode 100644
index 0000000..92c5050
--- /dev/null
+++ b/tools/qual-recalib-stat/writer.c
@@ -0,0 +1,436 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "writer.h"
+
+#include <klib/printf.h>
+#include <kfs/file.h>
+
+#include <sysalloc.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+static const char * widx_names[ N_WIDX ] =
+{
+    "SPOT_GROUP",
+    "KMER",
+    "ORIG_QUAL",
+    "TOTAL_COUNT",
+    "MISMATCH_COUNT",
+    "CYCLE",
+    "HPRUN",
+    "GC_CONTENT",
+    "MAX_QUAL",
+    "NREAD"
+};
+
+
+static rc_t open_writer_cursor( statistic_writer *writer )
+{
+    rc_t rc = 0;
+    uint32_t idx;
+
+    for ( idx = 0; idx < N_WIDX && rc == 0; ++idx )
+    {
+        rc = add_column( writer->cursor, &writer->wr_col[ idx ], widx_names[ idx ] );
+    }
+    if ( rc == 0 )
+    {
+        rc = VCursorOpen ( writer->cursor );
+        if ( rc != 0 )
+            LogErr( klogInt, rc, "VCursorOpen failed\n" );
+    }
+    return rc;
+}
+
+
+static rc_t make_statistic_writer( statistic_writer *writer, VCursor * cursor )
+{
+    memset( &writer->wr_col, 0, sizeof writer->wr_col );
+    writer->cursor = cursor;
+    return open_writer_cursor( writer );
+}
+
+
+typedef struct writer_ctx
+{
+    statistic_writer *writer;
+    rc_t rc;
+
+    progressbar *progress;
+    uint64_t entries;
+    uint64_t n;
+    uint8_t fract_digits;
+} writer_ctx;
+
+
+static bool CC write_cb( stat_row * row, void * data )
+{
+    writer_ctx * ctx = ( writer_ctx * ) data;
+    col * cols = ( col * )&ctx->writer->wr_col;
+    VCursor * cursor = ctx->writer->cursor;
+  
+    rc_t rc = VCursorOpenRow( cursor );
+    if ( rc != 0 )
+        LogErr( klogInt, rc, "VCursorOpen() failed\n" );
+
+    if ( rc == 0 )
+        rc = write_to_cursor( cursor, cols[ WIDX_SPOT_GROUP ].idx, 8,
+                              row->spotgroup, string_size( row->spotgroup ),
+                              widx_names[ WIDX_SPOT_GROUP ] );
+    if ( rc == 0 )
+        rc = write_to_cursor( cursor, cols[ WIDX_KMER ].idx, 8,
+                              row->dimer, string_size( row->dimer ),
+                              widx_names[ WIDX_KMER ] );
+    if ( rc == 0 )
+        rc = write_to_cursor( cursor, cols[ WIDX_ORIG_QUAL ].idx, 8,
+                              &row->quality, 1, widx_names[ WIDX_ORIG_QUAL ] );
+    if ( rc == 0 )
+        rc = write_to_cursor( cursor, cols[ WIDX_CYCLE ].idx, 32,
+                              &row->base_pos, 1, widx_names[ WIDX_CYCLE ] );
+    if ( rc == 0 )
+        rc = write_to_cursor( cursor, cols[ WIDX_TOTAL_COUNT ].idx, 32,
+                              &row->count, 1, widx_names[ WIDX_TOTAL_COUNT ] );
+    if ( rc == 0 )
+        rc = write_to_cursor( cursor, cols[ WIDX_MISMATCH_COUNT ].idx, 32,
+                              &row->mismatch_count, 1,
+                              widx_names[ WIDX_MISMATCH_COUNT ] );
+    if ( rc == 0 )
+        rc = write_to_cursor( cursor, cols[ WIDX_HPRUN ].idx, 32,
+                              &row->hp_run, 1, widx_names[ WIDX_HPRUN ] );
+    if ( rc == 0 )
+        rc = write_to_cursor( cursor, cols[ WIDX_GC_CONTENT ].idx, 32,
+                              &row->gc_content, 1, widx_names[ WIDX_GC_CONTENT ] );
+    if ( rc == 0 )
+        rc = write_to_cursor( cursor, cols[ WIDX_MAX_QUAL ].idx, 8,
+                              &row->max_qual_value, 1, widx_names[ WIDX_MAX_QUAL ] );
+    if ( rc == 0 )
+        rc = write_to_cursor( cursor, cols[ WIDX_NREAD ].idx, 8,
+                              &row->n_read, 1, widx_names[ WIDX_NREAD ] );
+
+
+    if ( rc == 0 )
+    {
+        rc = VCursorCommitRow( cursor );
+        if ( rc != 0 )
+            LogErr( klogInt, rc, "VCursorCommitRow() failed\n" );
+    }
+    if ( rc == 0 )
+    {
+        rc = VCursorCloseRow( cursor );
+        if ( rc != 0 )
+            LogErr( klogInt, rc, "VCursorCloseRow() failed\n" );
+    }
+
+    ctx->rc = rc;
+    if ( ctx->progress != NULL && rc == 0 )
+    {
+        uint32_t percent = progressbar_percent( ctx->entries, ++( ctx->n ), ctx->fract_digits );
+        update_progressbar( ctx->progress, ctx->fract_digits, percent );
+    }
+
+    return ( rc == 0 );
+}
+
+
+static rc_t write_statistic( statistic_writer *writer, statistic *data,
+                             uint64_t * written, bool show_progress )
+{
+    writer_ctx ctx;
+    uint64_t count;
+
+    ctx.writer = writer;
+    ctx.rc = 0;
+    ctx.progress = NULL;
+
+    if ( show_progress )
+    {
+        make_progressbar( &ctx.progress );
+        ctx.entries = data->entries;
+        ctx.fract_digits = progressbar_calc_fract_digits( ctx.entries );
+        ctx.n = 0;
+    }
+
+    count = foreach_statistic( data, write_cb, &ctx );
+
+    if ( show_progress )
+    {
+        destroy_progressbar( ctx.progress );
+        OUTMSG(( "\n" ));
+    }
+
+    if ( written != NULL ) *written = count;
+
+    return ctx.rc;
+}
+
+
+static rc_t whack_statistic_writer( statistic_writer *writer )
+{
+    rc_t rc = VCursorCommit( writer->cursor );
+    if ( rc != 0 )
+        LogErr( klogInt, rc, "VCursorCommit() failed\n" );
+    return rc;
+}
+
+
+typedef struct write_ctx
+{
+    KFile *out;
+    uint64_t pos;
+    uint64_t lines;
+
+    progressbar *progress;
+    uint64_t entries;
+    uint8_t fract_digits;
+} write_ctx;
+
+
+static bool CC write_to_file_cb( stat_row * row, void * f_data )
+{
+    write_ctx * wctx = ( write_ctx * ) f_data;
+    char buffer[ 256 ];
+    size_t num_writ;
+
+    rc_t rc = string_printf ( buffer, sizeof buffer, &num_writ,
+                                "%s\t%u\t%u\t%s\t%u\t%u\t%u\t%u\t%u\t%u\n", 
+                                row->spotgroup, 
+                                row->base_pos,
+                                row->n_read,
+                                row->dimer,
+                                row->gc_content,
+                                row->hp_run,
+                                row->max_qual_value,
+                                row->quality,
+                                row->count,
+                                row->mismatch_count );
+
+    if ( rc == 0 )
+    {
+        size_t f_writ;
+        rc = KFileWrite ( wctx->out, wctx->pos, buffer, num_writ, &f_writ );
+        if ( rc == 0 )
+        {
+            uint32_t percent = progressbar_percent( wctx->entries, ++wctx->lines, wctx->fract_digits );
+            update_progressbar( wctx->progress, wctx->fract_digits, percent );
+            wctx->pos += f_writ;
+        }
+    }
+    return ( rc == 0 );
+}
+
+
+rc_t write_output_file( KDirectory *dir, statistic * data,
+                        const char * path, uint64_t * written )
+{
+    write_ctx wctx;
+    rc_t rc;
+
+    if ( written != NULL )
+    {
+        *written = 0;
+    }
+    wctx.out = NULL;
+    wctx.pos = 0;
+    wctx.lines = 0;
+    rc = KDirectoryCreateFile ( dir, &wctx.out, false, 0664, kcmInit, "%s", path );
+    if ( rc != 0 )
+        LogErr( klogInt, rc, "KDirectoryCreateFile() failed\n" );
+    else
+    {
+        char buffer[ 256 ];
+        size_t num_writ;
+        rc = string_printf ( buffer, sizeof buffer, &num_writ,
+          "SPOTGROUP\tCYCLE\tNRead\tDIMER\tGC_CONTENT\tHP_RUN\tMaxQ\tQuality\tTOTAL\tMISMATCH\n" );
+        if ( rc == 0 )
+        {
+            size_t f_writ;
+            rc = KFileWrite ( wctx.out, wctx.pos, buffer, num_writ, &f_writ );
+            if ( rc == 0 )
+            {
+                if ( written != NULL ) *written = f_writ;
+                wctx.pos += f_writ;
+
+                make_progressbar( &wctx.progress );
+                wctx.entries = data->entries;
+                wctx.fract_digits = progressbar_calc_fract_digits( wctx.entries );
+
+                foreach_statistic( data, write_to_file_cb, &wctx );
+
+                destroy_progressbar( wctx.progress );
+                OUTMSG(( "\n" ));
+
+                KFileRelease ( wctx.out );
+                if ( written != NULL )
+                {
+                    *written = wctx.lines;
+                }
+            }
+        }
+    }
+    return rc;
+}
+
+
+static rc_t make_schema( const KNamelist * schema_list,
+                  VDBManager *my_manager, VSchema ** schema )
+{
+    rc_t rc = VDBManagerMakeSchema ( my_manager, schema );
+    if ( rc != 0 )
+        LogErr( klogInt, rc, "VDBManagerMakeSchema() failed\n" );
+    else
+    {
+        uint32_t count;
+        rc = KNamelistCount ( schema_list, &count );
+        if ( rc !=0 )
+            LogErr( klogInt, rc, "KNamelistCount(schema-list) failed\n" );
+        else
+        {
+            uint32_t i;
+            for ( i = 0; i < count && rc == 0; ++i )
+            {
+                const char * name;
+                rc = KNamelistGet ( schema_list, i, &name );
+                if ( rc !=0 )
+                    LogErr( klogInt, rc, "KNamelistGet(schema-list) failed\n" );
+                else
+                {
+                    rc = VSchemaParseFile ( *schema, "%s", name );
+                    if ( rc !=0 )
+                        LogErr( klogInt, rc, "VSchemaParseFile() failed\n" );
+                }
+            }
+        }
+    }
+    return rc;
+}
+
+
+static rc_t write_statistic_cmn( VTable * my_table, statistic * data,
+                          uint64_t * written, bool show_progress )
+{
+    VCursor *my_cursor;
+    rc_t rc = VTableCreateCursorWrite( my_table, &my_cursor, kcmInsert );
+    if ( rc != 0 )
+        LogErr( klogInt, rc, "VTableCreateCursorWrite() failed\n" );
+    else
+    {
+        statistic_writer writer;
+        rc = make_statistic_writer( &writer, my_cursor );
+        if ( rc == 0 )
+        {
+            rc = write_statistic( &writer, data, written, show_progress );
+            if ( rc == 0 )
+                rc = whack_statistic_writer( &writer );
+        }
+        VCursorRelease( my_cursor );
+    }
+    return rc;
+}
+
+
+rc_t write_statistic_into_tab( KDirectory *dir, statistic * data,
+        const KNamelist *schema_list, const char *output_file_path,
+        uint64_t * written, bool show_progress )
+{
+    VDBManager *my_manager;
+    rc_t rc;
+
+    if ( written != NULL ) *written = 0;
+    rc = VDBManagerMakeUpdate ( &my_manager, dir );
+    if ( rc != 0 )
+        LogErr( klogInt, rc, "VDBManagerMakeUpdate() failed\n" );
+    else
+    {
+        VSchema * my_schema;
+        rc = make_schema( schema_list, my_manager, &my_schema );
+        if ( rc == 0 )
+        {
+            VTable * my_table;
+            rc = VDBManagerCreateTable( my_manager, &my_table, my_schema, 
+                                        "NCBI:align:tbl:qstat",
+                                        kcmInit | kcmParents,
+                                        "%s", output_file_path );
+            if ( rc != 0 )
+                LogErr( klogInt, rc, "VDBManagerCreateTable() failed\n" );
+            else
+            {
+                rc = write_statistic_cmn( my_table, data, written, show_progress );
+                VTableRelease( my_table );
+            }
+            VSchemaRelease( my_schema );
+        }
+        VDBManagerRelease( my_manager );
+    }
+    return rc;
+}
+
+
+rc_t write_statistic_into_db( KDirectory *dir, statistic * data,
+         const KNamelist *schema_list, const char *src_path,
+        uint64_t * written, bool show_progress )
+{
+    VDBManager *my_manager;
+    rc_t rc;
+
+    if ( written != NULL ) *written = 0;
+    rc = VDBManagerMakeUpdate ( &my_manager, dir );
+    if ( rc != 0 )
+        LogErr( klogInt, rc, "VDBManagerMakeUpdate() failed\n" );
+    else
+    {
+        VSchema * my_schema;
+        rc = make_schema( schema_list, my_manager, &my_schema );
+        if ( rc == 0 )
+        {
+            VDatabase *my_database;
+            rc = VDBManagerOpenDBUpdate( my_manager, &my_database, 
+                                         my_schema, "%s", src_path );
+            if ( rc != 0 )
+                LogErr( klogInt, rc, "VDBManagerOpenDBUpdate() failed\n" );
+            else
+            {
+                VTable * my_table;
+                rc = VDatabaseCreateTable( my_database, &my_table,
+                                           "QUAL_STAT",
+                                           kcmOpen | kcmParents,
+                                           "QUAL_STAT" );
+                if ( rc !=0 )
+                    LogErr( klogInt, rc, "VDatabaseCreateTable() failed\n" );
+                else
+                {
+                    rc = write_statistic_cmn( my_table, data, written, show_progress );
+                    VTableRelease( my_table );
+                }
+                VDatabaseRelease( my_database );
+            }
+            VSchemaRelease( my_schema );
+        }
+        VDBManagerRelease( my_manager );
+    }
+    return rc;
+}
diff --git a/tools/qual-recalib-stat/writer.h b/tools/qual-recalib-stat/writer.h
new file mode 100644
index 0000000..a3c4583
--- /dev/null
+++ b/tools/qual-recalib-stat/writer.h
@@ -0,0 +1,80 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_stat_writer_
+#define _h_stat_writer_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <klib/rc.h>
+#include <klib/namelist.h>
+#include <kfs/directory.h>
+#include <vdb/cursor.h>
+#include <vdb/schema.h>
+#include <vdb/manager.h>
+#include <vdb/table.h>
+#include <vdb/database.h>
+#include "columns.h"
+#include "stat_mod_2.h"
+#include "progressbar.h"
+
+#define WIDX_SPOT_GROUP      0
+#define WIDX_KMER            1
+#define WIDX_ORIG_QUAL       2
+#define WIDX_TOTAL_COUNT     3
+#define WIDX_MISMATCH_COUNT  4
+#define WIDX_CYCLE           5
+#define WIDX_HPRUN           6
+#define WIDX_GC_CONTENT      7
+#define WIDX_MAX_QUAL        8
+#define WIDX_NREAD           9
+#define N_WIDX               10
+
+typedef struct statistic_writer
+{
+    VCursor *cursor;
+    col wr_col[ N_WIDX ];
+} statistic_writer;
+
+
+rc_t write_output_file( KDirectory *dir, statistic * data,
+                        const char * path, uint64_t * written );
+
+rc_t write_statistic_into_tab( KDirectory *dir, statistic * data,
+        const KNamelist *schema_list, const char *output_file_path,
+        uint64_t * written, bool show_progress );
+
+rc_t write_statistic_into_db( KDirectory *dir, statistic * data,
+         const KNamelist *schema_list, const char *src_path,
+        uint64_t * written, bool show_progress );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/rd-filter-redact/Makefile b/tools/rd-filter-redact/Makefile
new file mode 100644
index 0000000..d38c7f2
--- /dev/null
+++ b/tools/rd-filter-redact/Makefile
@@ -0,0 +1,122 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: std
+
+TOP ?= $(abspath ../..)
+MODULE = tools/rd-filter-redact
+
+include $(TOP)/build/Makefile.env
+
+INT_TOOLS = \
+	test-read-write-cursor
+
+EXT_TOOLS = \
+	read-filter-redact
+
+ALL_TOOLS = \
+	$(INT_TOOLS) \
+	$(EXT_TOOLS)
+
+#------------------------------------------------------------------------------
+# outer targets
+#
+all std: vers-includes
+	@ $(MAKE_CMD) $(TARGDIR)/$@
+
+$(ALL_TOOLS): vers-includes
+	@ $(MAKE_CMD) $(BINDIR)/$@
+
+.PHONY: all std $(ALL_TOOLS)
+
+#-------------------------------------------------------------------------------
+# all
+#
+$(TARGDIR)/all: \
+	$(addprefix $(BINDIR)/,$(ALL_TOOLS))
+
+.PHONY: $(TARGDIR)/all
+
+#-------------------------------------------------------------------------------
+# std
+#
+$(TARGDIR)/std: \
+	$(addprefix $(BINDIR)/,$(EXT_TOOLS))
+
+.PHONY: $(TARGDIR)/std
+
+#-------------------------------------------------------------------------------
+# vers-includes
+#
+$(TARGDIR)/vers-includes: $(addsuffix .vers.h,$(EXT_TOOLS))
+
+.PHONY: $(TARGDIR)/vers-includes
+
+#-------------------------------------------------------------------------------
+# clean
+#
+clean: stdclean
+
+.PHONY: clean
+
+#-------------------------------------------------------------------------------
+# read-filter-redact
+#
+READ_FILTER_REDACT_SRC = \
+	read-filter-redact \
+
+READ_FILTER_REDACT_OBJ = \
+	$(addsuffix .$(OBJX),$(READ_FILTER_REDACT_SRC))
+
+READ_FILTER_REDACT_LIB = \
+	-lkapp \
+	-sncbi-wvdb \
+	-lm
+
+read-filter-redact.vers.h: read-filter-redact.vers
+	$(TOP)/build/make-vers-inc.sh READ_FILTER_REDACT_VERS $^ > $@
+
+$(BINDIR)/read-filter-redact: $(READ_FILTER_REDACT_OBJ)
+	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(READ_FILTER_REDACT_LIB)
+
+#-------------------------------------------------------------------------------
+# test-read-write-cursor
+#
+TEST_READ_WRITE_CURSOR_SRC = \
+	test-read-write-cursor \
+
+TEST_READ_WRITE_CURSOR_OBJ = \
+	$(addsuffix .$(OBJX),$(TEST_READ_WRITE_CURSOR_SRC))
+
+TEST_READ_WRITE_CURSOR_LIB = \
+	-lkapp \
+	-lncbi-wvdb \
+
+test-read-write-cursor.vers.h: test-read-write-cursor.vers
+	$(TOP)/build/make-vers-inc.sh TEST_READ_WRITE_CURSOR_VERS $^ > $@
+
+$(BINDIR)/test-read-write-cursor: $(TEST_READ_WRITE_CURSOR_OBJ)
+	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(TEST_READ_WRITE_CURSOR_LIB)
+
diff --git a/tools/rd-filter-redact/rd-filter-redact.c b/tools/rd-filter-redact/rd-filter-redact.c
new file mode 100644
index 0000000..cc12686
--- /dev/null
+++ b/tools/rd-filter-redact/rd-filter-redact.c
@@ -0,0 +1,1355 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ */
+
+#include "rd-filter-redact.vers.h" /* RD_FILTER_REDACT_VERS */
+#include <kapp/main.h> /* KMain */
+#include <kapp/log.h> /* plogmsg */
+#include <kfs/file.h> /* KFile */
+#include <klib/rc.h> /* GetRCState */
+#include <sra/wsradb.h> /* SRAMgr */
+#include <sra/sradb-priv.h> /* SRATableGetKTableUpdate */
+#include <vdb/types.h> /* vdb_uint8_t */
+#include <kdb/database.h> /* KDBManagerMakeUpdate */
+#include <kdb/table.h> /*  KTableRelease */
+#include <ctype.h> /* isdigit */
+#include <string.h> /* memset */
+#include <stdio.h> /* sscanf */
+#include <assert.h>
+#include <sys/stat.h> /* umask */
+
+#include <stdlib.h> /* system */
+
+
+typedef struct Context
+{
+    const char* file_path;
+    const char* table_path;
+    const char * schema_path;
+
+    KDirectory * pwd;
+    VDBManager * mgr;
+    VSchema * schema;
+    VTable * table;
+
+
+    const KFile * file;
+
+
+
+    bool force;
+    
+} Context
+
+struct SArgs {
+};
+struct SData {
+    SRATable* _wrTbl;
+    const SRATable* _rdTbl;
+    const SRAColumn* _origFilterCol;
+    const SRAColumn* _NReadsCol;
+    const char* _origFilterColName;
+    bool _existedRD_FILTER;
+    bool _locked;
+};
+
+
+
+static KDirectory* __SpotIteratorDirectory = NULL;
+/** SpotIterator: iterate spot numbers from 1 to max;
+input spots to reduct from the file */
+struct SpotIterator {
+    spotid_t m_crnSpotId;
+    spotid_t m_maxSpotId;
+
+    spotid_t m_spotToReduct;
+
+    const char* m_filename;
+    size_t m_line;
+    const KFile* m_file;
+    size_t m_filePos;
+    bool m_eof;
+
+    char m_buffer[512];
+    size_t m_inBuffer;
+    char m_ch;
+    bool m_hasCh;
+};
+
+/** Init the static directory object */
+static rc_t SpotIteratorInitDirectory   (void)
+{
+    if (__SpotIteratorDirectory)
+    {
+        return 0;
+    }
+    else
+    {
+        rc_t rc = KDirectoryNativeDir(&__SpotIteratorDirectory);
+        if (rc != 0)
+        {
+            logerr(klogErr, rc, "while calling KDirectoryNativeDir");
+        }
+        return rc;
+    }
+}
+
+static
+bool PathExists (const KDirectory * dir, KPathType desired_type, const char * path, ...)
+{
+    KPathType found_type;
+    bool found;
+    va_list args;
+
+    va_start (args, path);
+
+    found_type = KDirectoryVPathType (dir, path, args);
+    found_type &= ~kptAlias;
+
+    found = (found_type == desired_type)
+
+    va_end (args);
+    return found;
+}
+
+
+
+/** Check file existance */
+static bool SpotIteratorFileExists(const char* path, ...)
+{
+    bool found = false;
+    if (SpotIteratorInitDirectory() == 0)
+    {
+        uint32_t type
+        va_list args;
+        va_start(args, path);
+
+        type = KDirectoryVPathType(__SpotIteratorDirectory, path, args);
+        found = (type != kptNotFound);
+        va_end(args);
+    }
+    return found;
+}
+
+static bool SpotIteratorBufferAdd(struct SpotIterator* self, char ch)
+{
+    assert(self);
+
+    if (self->m_inBuffer >= (sizeof self->m_buffer - 1))
+    {
+        return false;
+    }
+
+    self->m_buffer[self->m_inBuffer++] = ch;
+    self->m_buffer[self->m_inBuffer] = '\0';
+
+    return true;
+}
+
+/** Read a character from the input file */
+static rc_t SpotIteratorFileReadWithEof(struct SpotIterator* self,
+    void* buffer, size_t bsize)
+{
+    rc_t rc = 0;
+    size_t num_read = 0;
+
+    assert(self);
+
+    rc = KFileRead(self->m_file, self->m_filePos, buffer, bsize, &num_read);
+    if (rc == 0)
+    {
+        if (num_read == 0)
+        {
+            self->m_eof = true;
+        }
+        else
+        {
+            self->m_filePos += num_read;
+        }
+    }
+    else
+    {
+        plogerr(klogErr, rc, "on line $(lineno) while reading file '$(path)'",
+                PLOG_U64(lineno) ",path=%s", self->m_line, self->m_filename);
+    }
+
+    return rc;
+}
+
+/** Read a line from the input file */
+static rc_t SpotIteratorReadLine(struct SpotIterator* self)
+{
+    rc_t rc = 0;
+    bool ok = true; /* ok means 'no input buffer overflow' */
+
+    /* to skip leading/traling spaces */
+    enum ELane
+    {
+        eBefore,
+        eIn,
+        eAfter
+    } state = eBefore;
+
+    if (self->m_eof) {
+        return rc;
+    }
+
+    assert(self);
+
+    ++self->m_line;
+    self->m_inBuffer = 0;
+
+    /* get back the saved character */
+    if (self->m_hasCh) {
+        SpotIteratorBufferAdd(self, self->m_ch);
+        if (!isblank(self->m_ch)) {
+            state = eIn;
+        }
+        self->m_hasCh = false;
+    }
+
+    while (ok && !self->m_eof) /* do until in-buffer overflow or EOF*/{
+        char ch = 0;
+        /* get next characted */
+        if ((rc = SpotIteratorFileReadWithEof(self, &ch, 1)) != 0) {
+            return rc;
+        }
+
+        if (!self->m_eof) {
+            /* treat leading/trailing spaces */
+            switch (state) {
+                /* skip leading spaces */
+                case eBefore:
+                    if (isblank(ch)) {
+                        continue;
+                    }
+                    else {
+                        state = eIn;
+                    }
+                    break;
+                case eIn:
+                    if (isblank(ch)) {
+                        state = eAfter;
+                        continue;
+                    }
+                    break;
+                /* skip trailing spaces */
+                case eAfter:
+                    if (isblank(ch)) {
+                        continue;
+                    }
+                    else if (ch != '\n' && ch != '\r') {
+                        rc = RC(rcExe, rcFile, rcReading, rcChar, rcUnexpected);
+                        plogerr(klogErr, rc, "bad symbol '$(char)' "
+                            "on line $(lineno) in file '$(path)': '$(line)...'",
+                            "char=%c," PLOG_U64(lineno) ",path=%s,line=%s",
+                            ch, self->m_line, self->m_filename, self->m_buffer);
+                        return rc;
+                    }
+                    break;
+            }
+
+            /* add next non-blank characted */
+            if ((ok = SpotIteratorBufferAdd(self, ch))) {
+      /* all combinations as "\r", "\n", "\r\n", "\n\r" are considered as EOL */
+                if (ch == '\n' || ch == '\r') {
+                    char c1 = 0;
+                    if ((rc = SpotIteratorFileReadWithEof(self, &c1, 1)) != 0) {
+                        return rc;
+                    }
+                    if (self->m_eof) {
+                        break;
+                    }
+                    else if ((c1 != '\n' && c1 != '\r') || (ch == c1)) {
+       /* save the character when EOL is a single character (WINDOWS) */
+                        self->m_ch = c1;
+                        self->m_hasCh = true;
+                        break;
+                    }
+                    else {
+                        ok = SpotIteratorBufferAdd(self, c1);
+                        break;
+                    }
+                }
+            }
+        }
+    }
+
+    /* remove EOL */
+    if (ok) {
+        bool done = false;
+
+        while (self->m_inBuffer > 0 && !done) {
+            switch (self->m_buffer[self->m_inBuffer - 1]) {
+                case '\n': case '\r':
+                    self->m_buffer[--self->m_inBuffer] = '\0';
+                    break;
+                default:
+                    done = true;
+                    break;
+            }
+        }
+    }
+    else {
+        rc = RC(rcExe, rcFile, rcReading, rcString, rcTooLong);
+        plogerr(klogErr, rc,
+            "on line $(lineno) while reading file '$(path)': '$(line)...'",
+            PLOG_U64(lineno) ",path=%s,line=%s",
+            self->m_line, self->m_filename, self->m_buffer);
+    }
+
+    return rc;
+}
+
+/** Get next spot from the input file */
+static rc_t SpotIteratorReadSpotToRedact(struct SpotIterator* self)
+{
+    rc_t rc = 0;
+
+    assert(self);
+
+    while (rc == 0 && ! self->m_eof) {
+        rc = SpotIteratorReadLine(self);
+
+                         /* skip empty lines */ 
+        if ((rc == 0) && (self->m_inBuffer > 0)) {
+            spotid_t spot = 0;
+
+            /* make sure the line contains digits only */
+            int i = 0;
+            for (i = 0; i < self->m_inBuffer; ++i) {
+                if (!isdigit(self->m_buffer[i])) {
+                    rc = RC(rcExe, rcFile, rcReading, rcChar, rcUnexpected);
+                    plogerr(klogErr, rc, "character '$(char)' on line $(lineno)"
+                            " while reading file '$(path)': '$(line)'",
+                        "char=%c," PLOG_U64(lineno) ",path=%s,line=%s",
+                        self->m_buffer[i], self->m_line,
+                        self->m_filename, self->m_buffer);
+                    return rc;
+                }
+            }
+
+            sscanf(self->m_buffer, "%uld", &spot);
+
+            if (spot == 0) {
+                rc = RC(rcExe, rcFile, rcReading, rcString, rcInvalid);
+                plogerr(klogErr, rc,
+                    "bad spot id '0' on line $(lineno) "
+                    "while reading file '$(path)': '$(line)'",
+                    PLOG_U64(lineno) ",path=%s,line=%s",
+                    self->m_line, self->m_filename, self->m_buffer);
+            }
+            else if (spot == self->m_spotToReduct) {
+                rc = RC(rcExe, rcFile, rcReading, rcString, rcInvalid);
+                plogerr(klogErr, rc, "duplicated spot id '$(spot)' "
+                    "on line $(lineno) while reading file '$(path)': '$(line)'",
+                    PLOG_U32(spot) "," PLOG_U64(lineno) ",path=%s,line=%s",
+                    spot, self->m_line, self->m_filename, self->m_buffer);
+            }
+            else if (spot < self->m_spotToReduct) {
+                rc = RC(rcExe, rcFile, rcReading, rcString, rcInvalid);
+                plogerr(klogErr, rc, "File '$(path)' is unsorted. "
+                    "$(id) < $(last). See line $(lineno): '$(line)'",
+                    "path=%s," PLOG_U32(id) "," PLOG_U32(last) ","
+                        PLOG_U64(lineno) ",line=%s",
+                    self->m_filename, spot, self->m_spotToReduct,
+                    self->m_line, self->m_buffer);
+            }
+            else if (spot > self->m_maxSpotId) {
+                rc = RC(rcExe, rcFile, rcReading, rcString, rcInvalid);
+                plogerr(klogErr, rc, "spotId $(spot) on line $(lineno) "
+                    "of file '$(path)' is bigger that the max spotId $(max): "
+                        "'$(line)'",
+                    PLOG_U32(spot) "," PLOG_U64(lineno) ",path=%s,"
+                    PLOG_U32(max) ",line=%s",
+                    spot, self->m_line, self->m_filename, self->m_maxSpotId,
+                    self->m_buffer);
+            }
+            else {
+                self->m_spotToReduct = spot;
+                self->m_inBuffer = 0;
+            }
+            break;
+        }
+    }
+
+    return rc;
+}
+
+static rc_t SpotIteratorInit(struct SpotIterator* self,
+    const SRATable* tbl, const char* redactFileName)
+{
+    rc_t rc = 0;
+
+    assert(self && tbl && redactFileName);
+
+    memset(self, 0, sizeof *self);
+
+    self->m_crnSpotId = 1;
+
+    rc = SRATableMaxSpotId(tbl, &self->m_maxSpotId);
+    if (rc != 0) {
+        logerr(klogErr, rc, "while calling SRATableMaxSpotId");
+    }
+    else {
+        plogmsg(klogInfo,
+            "MaxSpotId = $(spot)", PLOG_U32(spot), self->m_maxSpotId);
+    }
+
+    if (rc == 0) {
+        rc = SpotIteratorInitDirectory();
+    }
+
+    if (rc == 0) {
+        self->m_filename = redactFileName;
+        plogmsg(klogInfo, "Opening '$(path)'", "path=%s", self->m_filename);
+        rc = KDirectoryOpenFileRead(
+            __SpotIteratorDirectory, &self->m_file, "%s", self->m_filename);
+        if (rc != 0) {
+            plogerr(klogErr, rc,
+                "while opening file '$(path)'", "path=%s", self->m_filename);
+        }
+    }
+
+    if (rc == 0) {
+        rc = SpotIteratorReadSpotToRedact(self);
+    }
+
+    return rc;
+}
+
+/** Get next spot id, check whether it should be redacted.
+Returns false if maxSpotId reached */
+static bool SpotIteratorNext(struct SpotIterator* self, rc_t* rc,
+    spotid_t* spot, bool* toRedact)
+{
+    bool hasNext = false;
+
+    assert(self && rc && spot && toRedact);
+
+    *rc = 0;
+    *toRedact = false;
+
+    if (self->m_crnSpotId <= self->m_maxSpotId) {
+        hasNext = true;
+        *spot = self->m_crnSpotId++;
+    }
+
+    if (*spot == self->m_spotToReduct) {
+        *toRedact = true;
+        *rc = SpotIteratorReadSpotToRedact(self);
+        if (*rc != 0) {
+            hasNext = false;
+        }
+    }
+
+    return hasNext;
+}
+
+static rc_t SpotIteratorDestroy(struct SpotIterator* self)
+{
+    assert(self);
+    KDirectoryRelease(__SpotIteratorDirectory);
+    __SpotIteratorDirectory = NULL;
+    return KFileRelease(self->m_file);
+}
+
+/** The main data structure */
+
+static rc_t SDataInit(struct SData* self,
+    const char* tablePath, const SRAMgr* rdMgr, rc_t rc)
+{
+    SRAMgr* wrMgr = NULL;
+
+    assert(self);
+    memset(self, 0, sizeof *self);
+    if (rc)
+    {   return rc; }
+
+    rc = SRAMgrMakeUpdate(&wrMgr, NULL);
+    if (rc != 0) {
+        logerr(klogErr, rc, "while calling SRAMgrMakeUpdate");
+    }
+    else {
+        plogmsg(klogInfo,
+            "Opening Table $(path) for read", "path=%s", tablePath);
+        rc = SRAMgrOpenTableRead(rdMgr, &self->_rdTbl, "%s", tablePath);
+        if (rc != 0) {
+            plogerr(klogErr, rc,
+                "cannot open table $(path) for read", "path=%s", tablePath);
+        }
+    }
+
+    if (rc == 0) {
+        plogmsg(klogInfo,
+            "Opening Table $(path) for update", "path=%s", tablePath);
+        rc = SRAMgrOpenTableUpdate(wrMgr, &self->_wrTbl, "%s", tablePath);
+        if (rc != 0) {
+            plogerr(klogErr, rc,
+                "cannot open table $(path) for update", "path=%s", tablePath);
+        }
+    }
+
+    SRAMgrRelease(wrMgr);
+
+    return rc;
+}
+
+static rc_t SDataPrepareCols(struct SData* self,
+    const char* rdFilterName, const char* readFilterName)
+{
+    rc_t rc = 0;
+
+    assert(self);
+
+    if (rc == 0) {
+        const char name[] = "NREADS";
+        rc = SRATableOpenColumnRead(self->_rdTbl,
+            &self->_NReadsCol, name, vdb_uint8_t);
+        if (rc != 0) {
+            if (GetRCState(rc) == rcNotFound) {
+                rc = 0;
+            }
+            else {
+                plogerr(klogErr, rc,
+                    "while calling SRATableOpenColumnRead($name)", "name=%s",
+                    name);
+            }
+        }
+    }
+
+    /* It the physical column exists, open it */
+    if (rc == 0) {
+        rc = SRATableOpenColumnRead(self->_rdTbl,
+            &self->_origFilterCol, rdFilterName, sra_read_filter_t);
+        if (rc == 0) {
+            plogmsg(klogDebug1,
+                "Found '$(name)' column", "name=%s", rdFilterName);
+            self->_existedRD_FILTER = true;
+            self->_origFilterColName = rdFilterName;
+        }
+        else if (GetRCState(rc) == rcNotFound) {
+            plogmsg(klogDebug1,
+                "Column '$(name)' does not exist", "name=%s", rdFilterName);
+            rc = 0;
+        }
+        else {
+            plogerr(klogErr, rc, "while calling SRATableOpenColumnRead($name)",
+                "name=%s", rdFilterName);
+        }
+    }
+
+    /* Otherwise open the virtual one */
+    if (rc == 0 && ! self->_existedRD_FILTER) {
+        rc = SRATableOpenColumnRead(self->_rdTbl,
+            &self->_origFilterCol, readFilterName, sra_read_filter_t);
+        if (rc != 0) {
+            plogerr(klogErr, rc,
+                "while calling SRATableOpenColumnRead($name)", "name=%s",
+                readFilterName);
+        }
+    }
+
+    return rc;
+}
+
+/** Keeps track when to cut the blob */
+struct SBlob {
+    bool m_new;
+    spotid_t m_maxSpotId;
+    const struct SData* m_data;
+};
+
+static rc_t SBlobInit(struct SBlob* self,
+    const struct SData* data, const struct SpotIterator* it)
+{
+    rc_t rc = 0;
+    bool newColumn = true;
+
+    assert(self && data && it);
+
+    memset(self, 0, sizeof *self);
+
+    if (data->_existedRD_FILTER) {
+        /* blob range will be read from the existing blob */
+        newColumn = false;
+    }
+
+    self->m_new = newColumn;
+    self->m_maxSpotId = it->m_maxSpotId;
+    self->m_data = data;
+
+    return rc;
+}
+
+static rc_t SBlobGetRange(const struct SBlob* self,
+    spotid_t id, spotid_t* last)
+{
+    rc_t rc = 0;
+    spotid_t first = 0;
+
+    assert(self && last);
+
+    if (self->m_new) {
+        first = (id & ~0xFFFF) + 1;
+        *last = first + 0xFFFF;
+        if (*last > self->m_maxSpotId) {
+            *last = self->m_maxSpotId;
+        }
+        plogmsg(klogDebug1, "New blob range for spot $(id) is "
+                "$(first) - $(last) ($(xfirst) - $(xlast))",
+            PLOG_U32(id) "," PLOG_U32(first) "," PLOG_U32(last) ","
+                PLOG_X32(xfirst) "," PLOG_X32(xlast),
+            id, first, *last, first, *last);
+    }
+    else {
+        assert(self->m_data && self->m_data->_origFilterCol);
+        rc = SRAColumnGetRange(self->m_data->_origFilterCol, id, &first, last);
+        if (rc != 0) {
+            plogerr(klogErr, rc, "Cannot SRAColumnGetRange $(id)",
+                PLOG_U32(id), id);
+        }
+        else {
+            plogmsg(klogDebug1, "Existing blob range for spot $(id) is "
+                    "$(first) - $(last) ($(xfirst) - $(xlast))",
+                PLOG_U32(id) "," PLOG_U32(first) "," PLOG_U32(last) ","
+                    PLOG_X32(xfirst) "," PLOG_X32(xlast),
+                id, first, *last, first, *last);
+        }
+    }
+
+    return rc;
+}
+
+static rc_t SDataUpdate(struct SData* self,
+    const char* newColName, const char* redactFileName,
+    spotid_t* redactedSpots, spotid_t* all)
+{
+    struct SBlob blob;
+    uint8_t filter[32];
+    rc_t rc = 0, rc2 = 0;
+    uint32_t colIdx = 0;
+    spotid_t spot = 0, last = 0;
+    bool toRedact = false;
+    struct SpotIterator it;
+
+    assert(self && redactedSpots && all);
+
+    memset(filter, SRA_READ_FILTER_REDACTED, sizeof filter);
+
+    if ((rc = SpotIteratorInit(&it, self->_rdTbl, redactFileName))
+        == 0)
+    {
+        rc = SRATableOpenColumnWrite
+            (self->_wrTbl, &colIdx, NULL, newColName, sra_read_filter_t);
+        if (rc != 0) {
+            plogerr(klogErr, rc,
+                "cannot open Column $(path) for Write", "path=%s", newColName);
+            return rc;
+        }
+    }
+    else {
+        return rc;
+    }
+
+    rc = SBlobInit(&blob, self, &it);
+    if (rc != 0) {
+        return rc;
+    }
+
+    while (rc == 0 && SpotIteratorNext(&it, &rc, &spot, &toRedact)) {
+        bitsz_t offset = 0, size = 0;
+        const void *base = NULL;
+        uint8_t nReads = 0;
+
+        if (rc != 0) {
+            break;
+        }
+
+        plogmsg(klogDebug2, "Spot $(spot): $(action)",
+            PLOG_U32(spot) ",action=%s",
+            spot, toRedact ? "redact" : "original");
+
+        /* GET NEXT BLOB RANGE */
+        if (spot == 1 || spot > last) {
+            rc = SBlobGetRange(&blob, spot, &last);
+            if (rc != 0) {
+                break;
+            }
+        }
+
+        assert(spot <= last);
+
+        /* GET NREADS */
+        if ((rc = SRAColumnRead
+            (self->_NReadsCol, spot, &base, &offset, &size)) != 0)
+        {
+            logerr(klogErr, rc, "cannot SRAColumnRead");
+            break;
+        }
+        else if (offset != 0 || size != sizeof nReads * 8) {
+            rc = RC(rcExe, rcColumn, rcReading, rcData, rcInvalid);
+            plogerr(klogErr, rc,
+                "Bad SRAColumnRead(\"NREADS\", $(spot)) result",
+                PLOG_U32(spot), spot);
+        }
+        else {
+            nReads = *((uint8_t*) base);
+            if (spot == 1) {
+                if (nReads == 1) {
+                    plogmsg(klogInfo, "The first spot has $(nreads) read",
+                        "nreads=%d", nReads);
+                }
+                else {
+                    plogmsg(klogInfo, "The first spot has $(nreads) reads",
+                        "nreads=%d", nReads);
+                }
+            }
+        }
+
+        /* GET READ_FILTER */
+        if (toRedact) {
+            base = filter;
+            ++(*redactedSpots);
+        }
+        else {
+            if ((rc = SRAColumnRead(self->_origFilterCol,
+                spot, &base, &offset, &size)) != 0)
+            {
+                plogerr(klogErr, rc,
+                    "while calling SRAColumnRead($(name))", "name=%s",
+                    "READ_FILTER");
+                break;
+            }
+            else if (offset != 0
+                  || size != sizeof (uint8_t) * 8 * nReads)
+            {
+                rc = RC(rcExe, rcColumn, rcReading, rcData, rcInvalid);
+                plogerr(klogErr, rc, "Bad SRAColumnRead($(spot)) result",
+                    PLOG_U32(spot), spot);
+            }
+        }
+
+        if ((rc = SRATableOpenSpot(self->_wrTbl, spot)) != 0) {
+            plogerr(klogErr, rc, "cannot open Spot $(id)", PLOG_U32(id), spot);
+            break;
+        }
+        if ((rc = SRATableWriteIdxColumn(self->_wrTbl,
+            colIdx, base, 0, sizeof (uint8_t) * 8 * nReads)) != 0)
+        {
+            logerr(klogErr, rc, "cannot SRATableWriteIdxColumn");
+            break;
+        }
+        if ((rc = SRATableCloseSpot(self->_wrTbl)) != 0) {
+            logerr(klogErr, rc, "cannot SRATableCloseSpot");
+            break;
+        }
+
+        /* CUT THE BLOB */
+        if (spot == last) {
+            rc = SRATableCloseCursor(self->_wrTbl);
+            if (rc != 0) {
+                plogerr(klogErr, rc, "cannot SRATableCloseCursor $(id)",
+                    PLOG_U32(id), spot);
+                break;
+            }
+        }
+    }
+
+    rc2 = SpotIteratorDestroy(&it);
+    if (rc == 0)
+    {   rc = rc2; }
+
+    *all = spot;
+
+    return rc;
+}
+
+static rc_t SDataDestroy(struct SData* self, bool commit) {
+    rc_t rc = 0, rc2 = 0;
+    assert(self);
+
+    rc2 = SRAColumnRelease(self->_origFilterCol);
+    self->_origFilterCol = NULL;
+    if (rc == 0)
+    { rc = rc2; }
+
+    rc2 = SRAColumnRelease(self->_NReadsCol);
+    self->_NReadsCol = NULL;
+    if (rc == 0)
+    { rc = rc2; }
+
+    rc2 = SRATableRelease(self->_rdTbl);
+    self->_rdTbl = NULL;
+    if (rc == 0)
+    { rc = rc2; }
+
+    if (commit && rc == 0) {
+        rc = SRATableCommit(self->_wrTbl);
+    }
+
+    rc2 = SRATableRelease(self->_wrTbl);
+    self->_wrTbl = NULL;
+    if (rc == 0)
+    { rc = rc2; }
+
+    return rc;
+}
+
+/** Command line arguments */
+
+
+static bool __BadLogLevel = false;
+static const char *__dummy4NextLogLevel(void *data)
+{
+    __BadLogLevel = true;
+    return "info";
+}
+
+static KLogLevel __defaultLogLevel;
+
+static void Usage(const char *argv0, const char *msg, ...)
+{
+    if (msg) {
+        va_list args;
+        va_start(args, msg);
+        vfprintf(stderr, msg, args);
+        fprintf(stderr, "\n\n");
+        va_end(args);
+    }
+
+    fprintf(stderr, "Usage:\n"
+        "%s -D <table> -F <file> [ -l <level> ]\n"
+        "\t-D --table-path\tSRA Table directory path\n"
+        "\t-F --file      \tFile containing SpotId-s to redact\n"
+        "\t-f --force     \tForce overwriting of already redacted table\n"
+        "\t-l --level     \t"
+                 "Log level: 0-13 or fatal|sys|int|err|warn|info|debug[1-10].",
+        argv0);
+
+    {
+        char logLevel[64];
+        rc_t rc = KLogLevelExplain
+            (__defaultLogLevel, logLevel, sizeof logLevel, NULL);
+        if (rc == 0) {
+            fprintf(stderr, " Default: %s", logLevel);
+        }
+    }
+
+    fprintf(stderr, "\n");
+}
+
+/** Get command line key with argument */
+static bool GetArg(int* argI, int argc, char* argv[],
+    const char* shortArg, const char* longArg,
+    const char** out, const char* error, rc_t* errorRc)
+{
+    bool found = false;
+
+    assert(argI && (*argI < argc) && longArg && argv && out && errorRc);
+
+    if (strcmp(argv[*argI], longArg) == 0) {
+        found = true;
+    }
+    else if (shortArg && (strcmp(argv[*argI], shortArg) == 0)) {
+        found = true;
+    }
+    if (!found) {
+        return false;
+    }
+
+    if ((*argI + 1) >= argc) {
+        Usage(argv[0], error);
+        *errorRc = RC(rcExe, rcArgv, rcReading, rcParam, rcInvalid);
+    }
+    else {
+        *out = argv[++(*argI)];
+    }
+
+    return true;
+}
+
+#define OPTION_TABLE "table-path"
+#define ALIAS_TABLE  "D"
+
+#define OPTION_FILE  "file"
+#define ALIAS_FILE   "F"
+
+#define OPTION_SCHEMA  "schema"
+#define ALIAS_SCHEMA   "S"
+
+#define OPTION_FORCE  "force"
+#define ALIAS_FORCE   "F"
+
+OptDef Options[] = 
+{
+    { OPTION_TABLE,  ALIAS_TABLE,  NULL, table_usage,  1, true,  true },
+    { OPTION_FILE,   ALIAS_FILE,   NULL, file_usage,   1, true,  true },
+    { OPTION_SCHEMA, ALIAS_SCHEMA, NULL, schema_usage, 1, true,  true },
+    { OPTION_FORCE,  ALIAS_FORCE,  NULL, force_usage,  0, false, false }
+};
+
+
+static
+rc_t open_and_run (Context * context)
+{
+    KDirectory * pwd;
+    rc_t rc;
+
+    rc = KDirectoryNativeDir (&pwd);
+    if (rc)
+        LOGERR (klogFatal, rc, "Unable to open file system");
+    else
+    {
+        if (PathExists (pwd, kptDile, context->file_path))
+        {
+            if (PathExists (pwd, kptDile, context->file_path))
+            {
+                VDBManager * vmgr;
+
+                rc = VDBManagerMakeUpdate (&vmgr, pwd);
+                if (rc)
+                    LOGERR (kptInt, "Failed to create a database manager");
+                else
+                {
+                    VSchema * vschema;
+
+                    rc = VDBManagerMakeSchema (vmgr, &vschema);
+                    if (rc)
+                        LOGERR (kptInt, "Failed to create schema");
+                    else
+                    {
+                        rc = VSchemaParseFile (vschema, args->schema);
+                        if (rc)
+                            PLOGERR (klogFatal, (klogFatal, 
+                                                 "Unable to parse schema file ($S)",
+                                                 "S=%s", args->schema));
+                        else
+                        {
+                            VTable * vtable;
+                            rc = VDBManagerOpenTableUpdate (vmgr, &vtable, SCHEMA, args->table);
+                            if (rc)
+                                PLOGERR (klogFatal, (klogFatal, "Unable to open table ($T)",
+                                             "T=%s", args->table));
+                            else
+                            {
+
+                        
+                                VTableRelease (vtable);
+                            }
+                        }
+                        VSchemaRelease (vschema);
+                    }
+                    VDBManagerRelease (vmgr);
+                }
+            }
+            else
+                PLOGERR (kptFatal, (kptFatal, "table paramaeter is not a table directory ($F)",
+                                    "F=%s", args->table));
+        }
+        else
+            PLOGERR (kptFatal, (kptFatal, "file paramaeter is not a file ($F)",
+                                "F=%s", context->file_path));
+
+
+
+        KPathType pt;
+
+        pt = KDirectoryPathType (arg->file);
+        if ((pt & ~kptAlias) != kptFile)
+        else
+        {
+        }
+        KDirectoryRelease (pwd);
+    }
+    return rc;
+}
+
+    rc_t rc = 0;
+
+    spotid_t all = 0, redacted = 0;
+    bool locked = false;
+
+    SRAMgr* rdMgr = NULL;
+    KTable* ktbl = NULL;
+
+    struct SData data;
+
+    const char readFilterName   [] = "READ_FILTER";
+    const char rdFilterName     [] = "RD_FILTER";
+    const char readFilterNameNew[] = "TMP_READ_FILTER";
+    const char rdFilterNameNew  [] = "TMP_RD_FILTER";
+    const char colNameSave      [] = "RD_FILTER_BAK";
+
+    const char* redactFileName = NULL;
+    const char* tablePath = NULL;
+
+    struct SArgs args;
+
+    /* PARSE COMMAND LINE, MAKE SURE INPUTS EXIST */
+    rc = SArgsMake(&args, argc, argv);
+    if (rc)
+    {   return rc; }
+
+    tablePath      = args._table;
+    redactFileName = args.file;
+
+    /* WAS THIS RUN ALREADY REDUCTED ? */
+    if (! args._force
+        && SpotIteratorFileExists("%s/col/%s", tablePath, colNameSave))
+    {
+        rc = RC(rcExe, rcTable, rcOpening, rcColumn, rcExists);
+        plogerr(klogErr, rc,
+            "'$(path)' was redacted already", "path=%s", tablePath);
+    }
+
+    umask(2);
+
+    /* OPEN THE MANAGER */
+    if (rc == 0) {
+        rc = SRAMgrMakeUpdate(&rdMgr, NULL);
+        if (rc != 0) {
+            logerr(klogErr, rc, "while calling SRAMgrMakeUpdate(rd)");
+        }
+    }
+
+    /* UNLOCK THE RUN */
+    if (rc == 0) {
+        rc = SRAMgrUnlock(rdMgr, "%s", tablePath);
+        if (rc) {
+            if (GetRCState(rc) == rcUnlocked) {
+                plogmsg(klogInfo,
+                    "'$(path)' was not locked", "path=%s", tablePath);
+                rc = 0;
+            }
+            else {
+                plogerr(klogErr, rc, "while calling SRAMgrUnlock($(path))",
+                    "path=%s", tablePath);
+            }
+        }
+        else {
+            plogmsg(klogInfo, "'$(path)' was unlocked", "path=%s", tablePath);
+            locked = true;
+        }
+    }
+
+    /* INITIALIZE */
+    rc = SDataInit(&data, tablePath, rdMgr, rc);
+
+    if (rc == 0) {
+        logmsg(klogDebug2, "Calling SRATableGetKTableUpdate");
+        rc = SRATableGetKTableUpdate(data._wrTbl, &ktbl);
+        if (rc != 0) {
+            logerr(klogErr, rc, "while calling SRATableGetKTableUpdate");
+        }
+    }
+
+    /* OPEN INPUT COLUMNS */
+    if (rc == 0) {
+        rc = SDataPrepareCols(&data, rdFilterName, readFilterName);
+    }
+
+    if (rc == 0) {
+        /* just for fun, tell ktable to drop this column */
+        KTableDropColumn(ktbl, "%s", rdFilterNameNew);
+        KTableDropColumn(ktbl, "%s", colNameSave);
+
+        /* THE MAIN WORKING FUNCTION */
+        rc = SDataUpdate
+            (&data, readFilterNameNew, redactFileName, &redacted, &all);
+    }
+
+    /* CLEANUP */
+
+    {
+        rc_t rc2 = SDataDestroy(&data, rc == 0);
+        if (rc == 0) {
+            rc = rc2;
+        }
+    }
+
+    /* REMAME THE PHYSICAL COLUMNS */
+    if (rc == 0) {
+        if (data._existedRD_FILTER) {
+            plogmsg(klogDebug1, "Renaming '$(from)' to '$(to)'",
+                "from=%s,to=%s", rdFilterName, colNameSave);
+            rc = KTableRenameColumn(ktbl, rdFilterName, colNameSave);
+            if (rc != 0) {
+                plogerr(klogErr, rc,
+                    "while renaming column from '$(from)' to '$(to)'",
+                    "from=%s,to=%s", rdFilterName, colNameSave);
+            }
+        }
+        if (rc == 0) {
+            plogmsg(klogDebug1, "Renaming '$(from)' to '$(to)'",
+                "from=%s,to=%s",
+                rdFilterNameNew, rdFilterName);
+            rc = KTableRenameColumn(ktbl, rdFilterNameNew, rdFilterName);
+            if (rc != 0) {
+                plogerr(klogErr, rc,
+                    "while renaming column from '$(from)' to '$(to)'",
+                    "from=%s,to=%s", rdFilterNameNew, rdFilterName);
+            }
+        }
+    }
+    else if (ktbl) {
+        rc_t rc2 = KTableDropColumn(ktbl, "%s", rdFilterNameNew);
+        if (rc2 != 0) {
+            plogerr(klogErr, rc2, "while dropping column '$(name)'",
+                "name=%s", rdFilterNameNew);
+        }
+    }
+
+    {
+        rc_t rc2 = KTableRelease(ktbl);
+        if (rc == 0)
+        { rc = rc2; }
+    }
+
+    if (locked) {
+        rc_t rc2 = 0;
+        plogmsg(klogInfo, "Relocking '$(path)'", "path=%s", tablePath);
+        rc2 = SRAMgrLock(rdMgr, "%s", tablePath);
+        if (rc2 != 0) {
+            plogerr(klogErr, rc2, "while calling SRAMgrLock($(path))",
+                "path=%s", tablePath);
+            if (rc == 0)
+            { rc = rc2; }
+        }
+    }
+
+    {
+        rc_t rc2 = SRAMgrRelease(rdMgr);
+        if (rc == 0)
+        { rc = rc2; }
+    }
+
+    if (rc == 0) {
+        plogmsg(klogInfo, "'$(path)': redacted $(redacted) spots out of $(all)",
+            "path=%s," PLOG_U32(redacted) "," PLOG_U32(all),
+            tablePath, redacted, all);
+    }
+    else {
+        plogmsg(klogInfo, "Failed to redact '$(path)'", "path=%s", tablePath);
+    }
+
+    return rc;
+}
+
+
+uint32_t KAppVersion(void)
+{ return RD_FILTER_REDACT_VERS; }
+
+
+static
+rc_t run (Context * context)
+{
+    rc_t rc;
+
+    return rc;
+}
+
+
+static
+rc_t open_and_run (Context * context)
+{
+    KDirectory * pwd;
+    rc_t rc;
+
+    /* first get a toe hold in the file system */
+    rc = KDirectoryNativeDir (&context->pwd);
+    if (rc)
+        LOGERR (klogFatal, rc, "Unable to open file system");
+    else
+    {
+        /* try to open the file of redactions */
+        rc = KDirectoryOpenFileRead (context->pwd, &context->file, "%s", conext->file_path);
+        if (rc)
+            PLOGERR (kptFatal, (kptFatal, rc, "Failed to open redactions file ($(F))",
+                                context->file_path));
+        else
+        {
+            /* okay we've got the non-data base stuff up so get
+             * a toe hold in the VDatabase */
+            rc = VDBManagerMakeUpdate (&context->mgr, context->pwd);
+            if (rc)
+                LOGERR (kptInt, "Failed to create a database manager");
+            else
+            {
+                /* build a schema object */
+                rc = VDBManagerMakeSchema (context->mgr, &ontext->schema);
+                if (rc)
+                    LOGERR (kptInt, "Failed to create schema");
+                else
+                {
+                    /* fill it with the specified schema */
+                    rc = VSchemaParseFile (context->schema, "%s", context->schema_path);
+                    if (rc)
+                        PLOGERR (klogFatal, (klogFatal, 
+                                             "Unable to parse schema file ($S)",
+                                             "S=%s", args->schema));
+                    else
+                    {
+                        /* now open the table with that schema */
+                        rc = VDBManagerOpenTableUpdate (context->mgr, &context->table,
+                                                        context->schema, "%s", context->table_path);
+                        if (rc)
+                            PLOGERR (klogFatal, (klogFatal, "Unable to open table ($T)",
+                                                 "T=%s", args->table));
+                        else
+                        {
+                            /* most stuff is open */
+                            rc = run (context);
+
+                            VTableRelease (context->table);
+                        }
+                    }
+                    VSchemaRelease (context->schema);
+                }
+                VDBManagerRelease (context->mgr);
+            }
+            KFileRelease (context->file);
+        }
+    }
+    return rc;
+}
+
+rc_t KMain(int argc, char* argv[])
+{
+    Args * args;
+    rc_t rc;
+
+    rc = ArgsMakeAndHandle (&args, argc, argv, 1, Options, sizeof Options / sizeof (Options[0]));
+    if (rc)
+        LOGERR (klogFatal, rc, "Failure reading command line");
+    else do
+    {
+        Context context;
+        uint32_t pcount;
+
+        /* force option: Replace extisting redact column */
+        rc = ArgsOptionCount (args, OPTION_FORCE, &pcount);
+        if (rc)
+        {
+            LOGERR (klogFatal, rc, "Failure parsing force name");
+            break;
+        }
+        if ((context.force = (pcount > 0)) != false)
+            STSMSG (1, ("Using force option"));
+
+        /* table path parameter */
+        rc = ArgsOptionCount (args, OPTION_TABLE, &pcount);
+        if (rc)
+        {
+            LOGERR (klogFatal, rc, "Failure parsing table name");
+            break;
+        }
+        if (pcount < 1)
+        {
+            rc = RC (rcExe, rcArgv, rcParsing, rcParam, rcInsufficient);
+            LOGERR (klogFatal, rc, "Missing table parameter");
+            break;
+        }
+        if (pcount > 1)
+        {
+            rc = RC (rcExe, rcArgv, rcParsing, rcParam, rcAmbiguous);
+            LOGERR (klogFatal, rc, "Too many table parameters");
+            break;
+        }
+        rc = ArgsOptionValue (args, OPTION_TABLE, 0, &sargs.table);
+        if (rc)
+        {
+            LOGERR (klogFatal, rc, "Failure retrieving table name");
+            break;
+        }
+
+        /* file path parameter */
+        rc = ArgsOptionCount (args, OPTION_FILE, &pcount);
+        if (rc)
+        {
+            LOGERR (klogFatal, rc, "Failure parsing file name");
+            break;
+        }
+        if (pcount < 1)
+        {
+            rc = RC (rcExe, rcArgv, rcParsing, rcParam, rcInsufficient);
+            LOGERR (klogFatal, rc, "Missing file parameter");
+            break;
+        }
+        if (pcount > 1)
+        {
+            rc = RC (rcExe, rcArgv, rcParsing, rcParam, rcAmbiguous);
+            LOGERR (klogFatal, rc, "Too many file parameters");
+            break;
+        }
+        rc = ArgsOptionValue (args, OPTION_FILE, 0, &context.file_path);
+        if (rc)
+        {
+            LOGERR (klogFatal, rc, "Failure retrieving file name");
+            break;
+        }
+
+
+        /* schema path parameter */
+        rc = ArgsOptionCount (args, OPTION_SCHEMA, &pcount);
+        if (rc)
+        {
+            LOGERR (klogFatal, rc, "Failure parsing schema name");
+            break;
+        }
+        if (pcount < 1)
+        {
+            rc = RC (rcExe, rcArgv, rcParsing, rcParam, rcInsufficient);
+            LOGERR (klogFatal, rc, "Missing schema parameter");
+            break;
+        }
+        if (pcount > 1)
+        {
+            rc = RC (rcExe, rcArgv, rcParsing, rcParam, rcAmbiguous);
+            LOGERR (klogFatal, rc, "Too many schema parameters");
+            break;
+        }
+        rc = ArgsOptionValue (args, OPTION_SCHEMA, 0, &context.schema_path);
+        if (rc)
+        {
+            LOGERR (klogFatal, rc, "Failure retrieving schema name");
+            break;
+        }
+
+        /* now that we have parameter values: open the file and table
+         * then run */
+        rc = open_and_run (&context);
+
+        KArgsRelease (args);
+
+    } while (0);
+
+    if (rc)
+        LOGERR (klogErr, rc, "Exiting with an error");
+    else
+        STSMSG (1, ("Exiting %R\n", rc));
+    return rc;
+}
+
+/* EOF */
diff --git a/tools/rd-filter-redact/rd-filter-redact.vers b/tools/rd-filter-redact/rd-filter-redact.vers
new file mode 100644
index 0000000..8e8299d
--- /dev/null
+++ b/tools/rd-filter-redact/rd-filter-redact.vers
@@ -0,0 +1 @@
+2.4.2
diff --git a/tools/rd-filter-redact/read-filter-redact.c b/tools/rd-filter-redact/read-filter-redact.c
new file mode 100644
index 0000000..a6515d5
--- /dev/null
+++ b/tools/rd-filter-redact/read-filter-redact.c
@@ -0,0 +1,865 @@
+/*******************************************************************************
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * =============================================================================
+ */
+
+#include "read-filter-redact.vers.h" /* READ_FILTER_REDACT_VERS */
+
+#include <kapp/main.h>
+
+#include <sra/wsradb.h> /* spotid_t */
+#include <sra/sradb-priv.h> /* SRASchemaMake */
+
+#include <vdb/manager.h> /* VDBManager */
+#include <vdb/table.h> /* VDBTable */
+#include <vdb/database.h> /* VDatabase */
+#include <vdb/cursor.h> /* VCursor */
+#include <vdb/schema.h> /* VSchemaRelease */
+
+#include <kdb/manager.h> /* KDBPathType */
+
+#include <kfs/directory.h> /* KDirectory */
+#include <kfs/file.h> /* KFile */
+
+#include <klib/log.h> /* LOGERR */
+#include <klib/out.h> /* OUTMSG */
+#include <klib/status.h> /* STSMSG */
+#include <klib/debug.h> /* DBGMSG */
+#include <klib/rc.h> /* RC */
+#include <os-native.h>
+
+#include <assert.h>
+#include <ctype.h> /* isblank */
+#include <stdio.h> /* sscanf */
+#include <stdlib.h> /* exit */
+#include <string.h> /* memset */
+
+#define DISP_RC(rc,msg) (void)((rc == 0) ? 0 : LOGERR(klogInt, rc, msg))
+
+static KDirectory* __SpotIteratorDirectory = NULL;
+
+typedef struct CmdLine {
+	const char* table;
+	const char* file;
+} CmdLine;
+typedef struct SpotIterator {
+    spotid_t crnSpotId;
+    spotid_t spotToReduct;
+
+    const char* filename;
+    const KFile* file;
+
+    uint64_t maxSpotId;
+
+    char buffer[256];
+    size_t inBuffer; /* characters in buffer */
+
+    size_t filePos;
+    bool eof;
+    size_t line;
+
+    bool hasCh;
+    char ch;
+} SpotIterator;
+typedef struct Db {
+    const char* table;
+
+    VDBManager* mgr;
+    VTable *tbl;
+
+    const VCursor *rCursor;
+    uint32_t rFilterIdx;
+
+    VCursor *wCursor;
+    uint32_t wIdx;
+
+    bool locked;
+
+    spotid_t nSpots;
+    spotid_t redactedSpots;
+} Db;
+/** Init the static directory object */
+static rc_t SpotIteratorInitDirectory(void) {
+    if (__SpotIteratorDirectory) {
+        return 0;
+    }
+    else {
+        rc_t rc = KDirectoryNativeDir(&__SpotIteratorDirectory);
+        DISP_RC(rc, "while calling KDirectoryNativeDir");
+        return rc;
+    }
+}
+
+/** Check file existance */
+static bool SpotIteratorFileExists(const char* path, ...) {
+    bool found = false;
+
+    if (SpotIteratorInitDirectory() == 0) {
+        va_list args;
+        va_start(args, path);
+        {
+            uint32_t type
+                = KDirectoryVPathType(__SpotIteratorDirectory, path, args);
+            found = (type != kptNotFound);
+            va_end(args);
+        }
+    }
+
+    return found;
+}
+
+static bool SpotIteratorBufferAdd(SpotIterator* self, char ch)
+{
+    assert(self);
+
+    if (self->inBuffer >= (sizeof self->buffer - 1))
+    {   return false; }
+
+    self->buffer[self->inBuffer++] = ch;
+    self->buffer[self->inBuffer] = '\0';
+
+    return true;
+}
+
+/** Read a character from input file */
+static rc_t SpotIteratorFileReadCharWithEof(SpotIterator* self,
+    char* buffer)
+{
+    rc_t rc = 0;
+    size_t num_read = 0;
+
+    assert(self);
+
+    /* get back the saved character */
+    if (self->hasCh) {
+        buffer[0] = self->ch;
+        self->hasCh = false;
+    }
+    else {
+        rc = KFileRead(self->file, self->filePos, buffer, 1, &num_read);
+        if (rc == 0) {
+            if (num_read == 0) {
+                self->eof = true;
+            }
+            else { self->filePos += num_read; }
+        }
+        else {
+            PLOGERR(klogErr, (klogErr, rc,
+                "on line $(lineno) while reading file '$(path)'",
+                PLOG_U64(lineno) ",path=%s", self->line, self->filename));
+        }
+    }
+
+    return rc;
+}
+
+/** Read a line from input file */
+static rc_t SpotIteratorReadLine(SpotIterator* self)
+{
+    rc_t rc = 0;
+    bool overflow = false; /* input buffer overflow */
+
+    /* to skip leading/traling spaces */
+    enum ELane {
+        eBefore,
+        eIn,
+        eAfter
+    } state = eBefore;
+
+    if (self->eof) {
+        return rc;
+    }
+
+    assert(self);
+
+    ++self->line;
+    self->inBuffer = 0;
+
+    while (!overflow && !self->eof) /* do until in-buffer overflow or EOF*/{
+        char ch = 0;
+        /* get next characted */
+        if ((rc = SpotIteratorFileReadCharWithEof(self, &ch)) != 0) {
+            return rc;
+        }
+
+        if (!self->eof) {
+            /* treat leading/trailing spaces */
+            switch (state) {
+                /* skip leading spaces */
+                case eBefore:
+                    if (isblank(ch)) {
+                        continue;
+                    }
+                    else {
+                        state = eIn;
+                    }
+                    break;
+                case eIn:
+                    if (isblank(ch)) {
+                        state = eAfter;
+                        continue;
+                    }
+                    break;
+                /* skip trailing spaces */
+                case eAfter:
+                    if (isblank(ch)) {
+                        continue;
+                    }
+                    else if (ch != '\n' && ch != '\r') {
+                        rc = RC(rcExe, rcFile, rcReading, rcChar, rcUnexpected);
+                        PLOGERR(klogErr, (klogErr, rc, "bad symbol '$(char)' "
+                            "on line $(lineno) in file '$(path)': '$(line)...'",
+                            "char=%c," PLOG_U64(lineno) ",path=%s,line=%s",
+                            ch, self->line, self->filename, self->buffer))
+                        ;
+                        return rc;
+                    }
+                    break;
+            }
+
+            /* add next non-blank characted */
+            overflow = !SpotIteratorBufferAdd(self, ch);
+            if (!overflow) {
+      /* all combinations as "\r", "\n", "\r\n", "\n\r" are considered as EOL */
+                if (ch == '\n' || ch == '\r') {
+                    char c1 = 0;
+                    if ((rc = SpotIteratorFileReadCharWithEof(self, &c1)) != 0)
+                    {
+                        return rc;
+                    }
+                    if (self->eof) {
+                        break;
+                    }
+                    else if ((c1 != '\n' && c1 != '\r') || (ch == c1)) {
+       /* save the character when EOL is a single character (WINDOWS):
+          will be get back in SpotIteratorFileReadCharWithEof */
+                        self->ch = c1;
+                        self->hasCh = true;
+                        break;
+                    }
+                    else {
+                        overflow = !SpotIteratorBufferAdd(self, c1);
+                        break;
+                    }
+                }
+            }
+        }
+    }
+
+    /* remove EOL */
+    if (!overflow) {
+        bool done = false;
+
+        while (self->inBuffer > 0 && !done) {
+            switch (self->buffer[self->inBuffer - 1]) {
+                case '\n': case '\r':
+                    self->buffer[--self->inBuffer] = '\0';
+                    break;
+                default:
+                    done = true;
+                    break;
+            }
+        }
+    }
+    else {
+        rc = RC(rcExe, rcFile, rcReading, rcString, rcTooLong);
+        PLOGERR(klogErr, (klogErr, rc,
+            "on line $(lineno) while reading file '$(path)': '$(line)...'",
+            PLOG_U64(lineno) ",path=%s,line=%s",
+            self->line, self->filename, self->buffer));
+    }
+
+    return rc;
+}
+
+/** Get next spot from input file */
+static rc_t SpotIteratorReadSpotToRedact(SpotIterator* self)
+{
+    rc_t rc = 0;
+
+    assert(self);
+
+    while (rc == 0 && ! self->eof) {
+        rc = SpotIteratorReadLine(self);
+
+        /* skip empty lines */ 
+        if ((rc == 0) && (self->inBuffer > 0)) {
+            spotid_t spot = 0;
+
+            /* make sure the line contains digits only */
+            int i = 0;
+            for (i = 0; i < self->inBuffer; ++i) {
+                if (!isdigit(self->buffer[i])) {
+                    rc = RC(rcExe, rcFile, rcReading, rcChar, rcUnexpected);
+                    PLOGERR(klogErr, (klogErr, rc,
+                            "character '$(char)' on line $(lineno)"
+                            " while reading file '$(path)': '$(line)'",
+                        "char=%c," PLOG_U64(lineno) ",path=%s,line=%s",
+                        self->buffer[i], self->line,
+                        self->filename, self->buffer));
+                    return rc;
+                }
+            }
+
+            sscanf(self->buffer, "%uld", &spot);
+
+            if (spot == 0) {
+                rc = RC(rcExe, rcFile, rcReading, rcString, rcInvalid);
+                PLOGERR(klogErr, (klogErr, rc,
+                    "bad spot id '0' on line $(lineno) "
+                    "while reading file '$(path)': '$(line)'",
+                    PLOG_U64(lineno) ",path=%s,line=%s",
+                    self->line, self->filename, self->buffer));
+            }
+            else if (spot == self->spotToReduct) {
+                rc = RC(rcExe, rcFile, rcReading, rcString, rcInvalid);
+                PLOGERR(klogErr, (klogErr, rc, "duplicated spot id '$(spot)' "
+                    "on line $(lineno) while reading file '$(path)': '$(line)'",
+                    PLOG_U32(spot) "," PLOG_U64(lineno) ",path=%s,line=%s",
+                    spot, self->line, self->filename, self->buffer));
+            }
+            else if (spot < self->spotToReduct) {
+                rc = RC(rcExe, rcFile, rcReading, rcString, rcInvalid);
+                PLOGERR(klogErr, (klogErr, rc, "File '$(path)' is unsorted. "
+                    "$(id) < $(last). See line $(lineno): '$(line)'",
+                    "path=%s," PLOG_U32(id) "," PLOG_U32(last) ","
+                        PLOG_U64(lineno) ",line=%s",
+                    self->filename, spot, self->spotToReduct,
+                    self->line, self->buffer));
+            }
+            else if (spot > self->maxSpotId) {
+                rc = RC(rcExe, rcFile, rcReading, rcString, rcInvalid);
+                PLOGERR(klogErr, (klogErr, rc,
+                    "spotId $(spot) on line $(lineno) "
+                    "of file '$(path)' is bigger that the max spotId $(max): "
+                        "'$(line)'",
+                    PLOG_U32(spot) "," PLOG_U64(lineno) ",path=%s,"
+                    PLOG_U32(max) ",line=%s",
+                    spot, self->line, self->filename, self->maxSpotId,
+                    self->buffer));
+            }
+            else {
+                self->spotToReduct = spot;
+                self->inBuffer = 0;
+            }
+            break;
+        }
+    }
+
+    return rc;
+}
+
+
+static rc_t SpotIteratorInit(const char* redactFileName,
+    const Db* db, SpotIterator* self)
+{
+    rc_t rc = 0;
+    int64_t first = 0;
+
+    assert(self && db);
+
+    memset(self, 0, sizeof *self);
+
+    self->crnSpotId = 1;
+
+    rc = VCursorIdRange
+        (db->rCursor, db->rFilterIdx, &first, &self->maxSpotId);
+    DISP_RC(rc, "while calling VCursorIdRange");
+
+    self->spotToReduct = first - 1;
+
+    if (rc == 0) {
+        rc = SpotIteratorInitDirectory();
+    }
+
+    if (rc == 0) {
+        self->filename = redactFileName;
+        rc = KDirectoryOpenFileRead
+            (__SpotIteratorDirectory, &self->file, "%s", self->filename);
+        if (rc != 0) {
+            PLOGERR(klogErr, (klogErr, rc,
+                "while opening file '$(path)'", "path=%s", self->filename));
+        }
+    }
+
+    if (rc == 0) {
+        rc = SpotIteratorReadSpotToRedact(self);
+    }
+
+    return rc;
+}
+
+static rc_t SpotIteratorDestroy(SpotIterator* it)
+{
+    rc_t rc = 0;
+
+    assert(it);
+
+    rc = KFileRelease(it->file);
+
+    it->file = NULL;
+    it->inBuffer = 0;
+    it->hasCh = false;
+
+    {
+        rc_t rc2 = KDirectoryRelease(__SpotIteratorDirectory);
+        if (rc == 0)
+        {   rc = rc2; }
+        __SpotIteratorDirectory = NULL;
+    }
+
+    return rc;
+}
+
+/** Get next spot id, check whether it should be redacted.
+Returns false if maxSpotId reached */
+static bool SpotIteratorNext(SpotIterator* self, rc_t* rc,
+    int64_t* spot, bool* toRedact)
+{
+    bool hasNext = false;
+
+    assert(self && rc && spot && toRedact);
+
+    *rc = 0;
+    *toRedact = false;
+
+    if (self->crnSpotId <= self->maxSpotId) {
+        hasNext = true;
+        *spot = self->crnSpotId++;
+    }
+
+    if (*spot == self->spotToReduct) {
+        *toRedact = true;
+        *rc = SpotIteratorReadSpotToRedact(self);
+        if (*rc != 0) {
+            hasNext = false;
+        }
+    }
+
+    return hasNext;
+}
+
+static rc_t DbInit(rc_t rc, const CmdLine* args, Db* db)
+{
+    const char name[] = "READ_FILTER";
+
+    assert(args && db);
+
+    memset(db, 0, sizeof *db);
+
+    if (rc != 0)
+    {   return rc; }
+
+    db->table = args->table;
+
+    if (rc == 0) {
+        rc = VDBManagerMakeUpdate(&db->mgr, NULL);
+        DISP_RC(rc, "while calling VDBManagerMakeUpdate");
+    }
+
+    if (rc == 0) {
+        rc = VDBManagerWritable(db->mgr, args->table);
+        if (rc != 0) {
+            if (GetRCState(rc) == rcLocked)
+            {
+                rc = VDBManagerUnlock(db->mgr, args->table);
+                if (rc != 0) {
+                    PLOGERR(klogErr, (klogErr, rc,
+                        "while calling VDBManagerUnlock('$(table)')",
+                        "table=%s", args->table));
+                }
+                db->locked = true;
+            }
+            else {
+                PLOGERR(klogErr, (klogErr, rc,
+                    "while calling VDBManagerWritable('$(table)')",
+                    "table=%s", args->table));
+                if (rc == RC(rcDB, rcPath, rcAccessing, rcPath, rcReadonly)) {
+                    PLOGERR(klogErr, (klogErr, rc,
+                        "N.B. It is possible '$(table)' was not locked properly"
+                        , "table=%s", args->table));
+                }
+            }
+        }
+    }
+
+    if (rc == 0) {
+        db->locked = true; /* has to be locked in production mode */
+        rc = VDBManagerOpenTableUpdate (db->mgr, &db->tbl, NULL, args->table);
+        if (rc != 0) {
+	    VDatabase *vdb;
+	    rc_t rc2 = VDBManagerOpenDBUpdate ( db->mgr, &vdb, NULL , args->table );
+	    if( rc2 == 0) {
+		rc2 = VDatabaseOpenTableUpdate ( vdb, &db->tbl, "SEQUENCE" );
+		if (rc2 == 0 ) rc = 0;
+		VDatabaseRelease ( vdb );
+	    }
+        }
+	if(rc != 0){
+            PLOGERR(klogErr, (klogErr, rc,
+                "while opening VTable '$(table)'", "table=%s", args->table));
+	}
+    } 
+    if( rc == 0) {
+        rc = VTableCreateCursorRead(db->tbl, &db->rCursor);
+        DISP_RC(rc, "while creating read cursor");
+        if (rc == 0) {
+            rc = VCursorAddColumn(db->rCursor, &db->rFilterIdx, "%s", name);
+            if (rc != 0) {
+                PLOGERR(klogErr, (klogErr, rc,
+                    "while adding $(name) to read cursor", "name=%s", name));
+            }
+        }
+        if (rc == 0) {
+            rc = VCursorOpen(db->rCursor);
+            DISP_RC(rc, "while opening read cursor");
+        }
+    }
+    if (rc == 0) {
+        rc = VTableCreateCursorWrite(db->tbl, &db->wCursor, kcmInsert);
+        DISP_RC(rc, "while creating write cursor");
+        if (rc == 0) {
+            rc = VCursorAddColumn(db->wCursor, &db->wIdx, "%s", name);
+            if (rc != 0) {
+                PLOGERR(klogErr, (klogErr, rc,
+                    "while adding $(name) to write cursor", "name=%s", name));
+            }
+        }
+        if (rc == 0) {
+            rc = VCursorOpen(db->wCursor);
+            DISP_RC(rc, "while opening write cursor");
+        }
+    }
+
+    return rc;
+}
+
+static rc_t DbDestroy(Db* db)
+{
+    rc_t rc = 0;
+
+    assert(db);
+
+    {
+        rc_t rc2 = VCursorRelease(db->rCursor);
+        db->rCursor = NULL;
+        if (rc == 0)
+        {   rc = rc2; }
+    }
+
+    {
+        rc_t rc2 = VCursorRelease(db->wCursor);
+        db->wCursor = NULL;
+        if (rc == 0)
+        {   rc = rc2; }
+    }
+
+    {
+        rc_t rc2 = VTableRelease(db->tbl);
+        db->tbl = NULL;
+        if (rc == 0)
+        {   rc = rc2; }
+    }
+
+    if (db->locked) {
+        rc_t rc2 = VDBManagerLock(db->mgr, "%s", db->table);
+        if (rc == 0)
+        {   rc = rc2; }
+    }
+
+    {
+        rc_t rc2 = VDBManagerRelease(db->mgr);
+        db->mgr = NULL;
+        if (rc == 0)
+        {   rc = rc2; }
+    }
+
+    return rc;
+}
+
+static rc_t Work(Db* db, SpotIterator* it)
+{
+    rc_t rc = 0;
+    bool toRedact = false;
+    int64_t row_id = 0;
+    spotid_t nSpots = 0;
+    spotid_t redactedSpots = 0;
+
+    uint8_t filter[64];
+    memset(filter, SRA_READ_FILTER_REDACTED, sizeof filter);
+
+    assert(it);
+
+    while (rc == 0 && SpotIteratorNext(it, &rc, &row_id, &toRedact)) {
+        uint8_t nreads = 0;
+        char bufferIn[64];
+        void* buffer = NULL;
+        uint32_t row_len = 0;
+
+        rc = Quitting();
+
+        ++nSpots;
+
+        if (rc == 0) {
+            uint32_t elem_bits = 8;
+            rc = VCursorReadDirect(db->rCursor, row_id, db->rFilterIdx,
+                elem_bits, bufferIn, sizeof bufferIn, &row_len);
+            DISP_RC(rc, "while reading READ_FILTER");
+	    nreads = row_len;
+        }
+        if (toRedact) {
+            buffer = filter;
+            ++redactedSpots;
+            DBGMSG(DBG_APP,DBG_COND_1,
+                ("Redacting spot %d: %d reads\n",row_id,nreads));
+        }
+        else {
+            buffer = bufferIn;
+        }
+        if (rc == 0) {
+            rc = VCursorOpenRow(db->wCursor);
+            DISP_RC(rc, "while opening row to write");
+            if (rc == 0) {
+                rc = VCursorWrite
+                    (db->wCursor, db->wIdx, 8 * nreads, buffer, 0, 1);
+                DISP_RC(rc, "while writing READ_FILTER");
+            }
+            if (rc == 0) {
+                rc = VCursorCommitRow(db->wCursor);
+                DISP_RC(rc, "while committing row");
+            }
+            if (rc == 0) {
+                rc = VCursorCloseRow(db->wCursor);
+                DISP_RC(rc, "while closing row");
+            }
+        }
+    }
+
+    db->nSpots = nSpots;
+    db->redactedSpots = redactedSpots;
+
+    if (rc == 0) {
+        rc = VCursorCommit(db->wCursor);
+        DISP_RC(rc, "while committing cursor");
+    }
+
+    return rc;
+}
+
+static rc_t Run(const CmdLine* args)
+{
+    rc_t rc = 0;
+
+    Db db;
+    SpotIterator it;
+
+    assert(args);
+
+    if (!SpotIteratorFileExists(args->file)) {
+        rc = RC(rcExe, rcFile, rcOpening, rcFile, rcNotFound);
+        PLOGERR(klogErr,
+            (klogErr, rc, "Cannot find '$(path)'", "path=%s", args->file));
+    }
+    else if (!SpotIteratorFileExists(args->table)) {
+        rc = RC(rcExe, rcTable, rcOpening, rcTable, rcNotFound);
+        PLOGERR(klogErr,
+            (klogErr, rc, "Cannot find '$(path)'", "path=%s", args->table));
+    }
+
+    {
+        rc_t rc2 = DbInit(rc, args, &db);
+        if (rc == 0)
+        {   rc = rc2; }
+    }
+
+    if (rc == 0) {
+        rc = SpotIteratorInit(args->file, &db, &it);
+    }
+
+    if (rc == 0) {
+        rc = Work(&db, &it);
+    }
+
+    if (rc == 0) {
+        PLOGMSG(klogInfo, (klogInfo,
+            "Success: redacted $(redacted) spots out of $(all)",
+            "redacted=%d,all=%d", db.redactedSpots, db.nSpots));
+    }
+
+    {
+        rc_t rc2 = SpotIteratorDestroy(&it);
+        if (rc == 0)
+        {   rc = rc2; }
+    }
+
+    {
+        rc_t rc2 = DbDestroy(&db);
+        if (rc == 0)
+        {   rc = rc2; }
+    }
+
+    return rc;
+}
+
+ver_t CC KAppVersion(void) { return READ_FILTER_REDACT_VERS; }
+
+#define OPTION_FILE  "file"
+#define ALIAS_FILE   "F"
+
+static const char* file_usage []
+    = { "File containing SpotId-s to redact" , NULL };
+
+OptDef Options[] =  {
+     { OPTION_FILE , ALIAS_FILE , NULL, file_usage,  1, true , true }
+};
+
+rc_t CC UsageSummary (const char* progname)
+{
+    return KOutMsg (
+        "Usage:\n"
+        "  %s [Options] -" ALIAS_FILE " <file> <table>\n", progname);
+}
+
+const char UsageDefaultName[] = "rd-filter-redact";
+
+rc_t CC Usage(const Args* args)
+{
+    const char * progname = UsageDefaultName;
+    const char * fullpath = UsageDefaultName;
+    rc_t rc;
+
+    if (args == NULL)
+        rc = RC (rcApp, rcArgv, rcAccessing, rcSelf, rcNull);
+    else
+        rc = ArgsProgram (args, &fullpath, &progname);
+    if (rc)
+        progname = fullpath = UsageDefaultName;
+
+    UsageSummary (progname);
+
+    KOutMsg ("Options:\n");
+
+    HelpOptionLine(ALIAS_FILE, OPTION_FILE, "file", file_usage);
+
+    HelpOptionsStandard();
+
+    HelpVersion(fullpath, KAppVersion());
+
+    return rc;
+}
+
+
+static rc_t CmdLineInit(const Args* args, CmdLine* cmdArgs)
+{
+    rc_t rc = 0;
+
+    assert(args && cmdArgs);
+
+    memset(cmdArgs, 0, sizeof *cmdArgs);
+
+    while (rc == 0) {
+        uint32_t pcount = 0;
+
+        /* file path parameter */
+        rc = ArgsOptionCount(args, OPTION_FILE, &pcount);
+        if (rc) {
+            LOGERR(klogErr, rc, "Failure parsing file name");
+            break;
+        }
+        if (pcount < 1) {
+            rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcInsufficient);
+            LOGERR(klogErr, rc, "Missing file parameter");
+            break;
+        }
+        if (pcount > 1) {
+            rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcAmbiguous);
+            LOGERR(klogErr, rc, "Too many file parameters");
+            break;
+        }
+        rc = ArgsOptionValue (args, OPTION_FILE, 0, &cmdArgs->file);
+        if (rc) {
+            LOGERR(klogErr, rc, "Failure retrieving file name");
+            break;
+        }
+
+        /* table path parameter */
+        rc = ArgsParamCount(args, &pcount);
+        if (rc) {
+            LOGERR(klogErr, rc, "Failure parsing table name");
+            break;
+        }
+        if (pcount < 1) {
+            rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcInsufficient);
+            LOGERR(klogErr, rc, "Missing table parameter");
+            break;
+        }
+        if (pcount > 1) {
+            rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcAmbiguous);
+            LOGERR(klogErr, rc, "Too many table parameters");
+            break;
+        }
+        rc = ArgsParamValue(args, 0, &cmdArgs->table);
+        if (rc) {
+            LOGERR(klogErr, rc, "Failure retrieving table name");
+            break;
+        }
+
+        break;
+    }
+
+    if (rc != 0) {
+        MiniUsage (args);
+    }
+
+    return rc;
+}
+
+rc_t CC KMain(int argc, char* argv[])
+{
+    rc_t rc = 0;
+    Args* args = NULL;
+
+    CmdLine cmdArgs;
+
+    LogLevelSet("info");
+
+    rc = ArgsMakeAndHandle
+        (&args, argc, argv, 1, Options, sizeof Options / sizeof(Options[0]));
+
+    if (rc == 0) {
+        rc = CmdLineInit(args, &cmdArgs);
+    }
+
+    if (rc == 0) {
+        rc = Run(&cmdArgs);
+    }
+
+    ArgsWhack(args);
+
+    if (rc == RC(rcVDB, rcTable, rcOpening, rcSchema, rcNotFound))
+    {   exit(10); }
+
+    return rc;
+}
+
+/************************************ EOF ****************** ******************/
diff --git a/tools/rd-filter-redact/read-filter-redact.vers b/tools/rd-filter-redact/read-filter-redact.vers
new file mode 100644
index 0000000..8e8299d
--- /dev/null
+++ b/tools/rd-filter-redact/read-filter-redact.vers
@@ -0,0 +1 @@
+2.4.2
diff --git a/tools/rd-filter-redact/read-filter-redact.vers.h b/tools/rd-filter-redact/read-filter-redact.vers.h
new file mode 100644
index 0000000..74de6b5
--- /dev/null
+++ b/tools/rd-filter-redact/read-filter-redact.vers.h
@@ -0,0 +1 @@
+#define READ_FILTER_REDACT_VERS 0x02040002
diff --git a/tools/rd-filter-redact/test-read-write-cursor.c b/tools/rd-filter-redact/test-read-write-cursor.c
new file mode 100644
index 0000000..bd528d6
--- /dev/null
+++ b/tools/rd-filter-redact/test-read-write-cursor.c
@@ -0,0 +1,222 @@
+/******************************************************************************/
+#include <kapp/main.h>
+
+#include <sra/wsradb.h> /* spotid_t */
+
+#include <vdb/manager.h> /* VDBManager */
+#include <vdb/table.h> /* VDBTable */
+#include <vdb/cursor.h> /* VCursor */
+#include <kfs/directory.h> /* KDirectory */
+#include <kfs/file.h> /* KFile */
+
+#include <klib/log.h> /* LOGERR */
+#include <klib/out.h> /* OUTMSG */
+#include <klib/status.h> /* STSMSG */
+#include <klib/debug.h> /* KDbgSetString */
+#include <klib/rc.h> /* RC */
+
+#include <ctype.h> /* isblank */
+#include <string.h> /* memset */
+#include <stdio.h> /* sscanf */
+#include <assert.h>
+
+#define DISP_RC(lvl,rc,msg) (void)((rc == 0) ? 0 : LOGERR(lvl, rc, msg))
+#define DISP_RC_INT(rc,msg) DISP_RC(klogInt,rc,msg)
+
+ver_t CC KAppVersion(void) { return 0; }
+
+const char UsageDefaultName[] = "test-read-write-cursor";
+rc_t CC UsageSummary (const char * progname)
+{
+    return 0;
+}
+
+rc_t CC Usage(const Args* args) { return 0; }
+
+rc_t CC KMain(int argc, char* argv[])
+{
+    const char table[] = "/home/klymenka/REDACT-IN";
+    const char name[] = "READ_FILTER";
+
+    rc_t rc = 0;
+
+    bool locked = false;
+
+    VDBManager* mgr;
+    VTable *tbl;
+    const VCursor *rCursor = NULL;
+
+    int i;
+
+    LogLevelSet("info");
+
+    for (i = 1; i < argc; ++i) {
+        if (!strcmp(argv[i], "-+")) {
+            if (++i <= argc) {
+#if _DEBUGGING
+	        KDbgSetString(argv[i]);
+#endif
+	    }
+        }
+    }
+
+  /*KDbgSetString("VDB");*/
+
+    if (rc == 0) {
+/* +01: ManagerMake */
+        LOGMSG(klogInfo, "VDBManagerMakeUpdate");
+        rc = VDBManagerMakeUpdate(&mgr, NULL);
+        DISP_RC_INT(rc, "while calling VDBManagerMakeUpdate");
+    }
+
+    if (rc == 0) {
+        rc = VDBManagerWritable(mgr, "%s", table);
+        if (GetRCState(rc) == rcLocked) {
+            LOGMSG(klogInfo, "VDBManagerUnlock");
+            rc = VDBManagerUnlock(mgr, "%s", table);
+            DISP_RC_INT(rc, "while calling VDBManagerUnlock");
+            locked = true;
+        }
+    }
+
+    if (rc == 0) {
+/* +02: OpenTable */
+        PLOGMSG(klogInfo, (klogInfo,
+            "VDBManagerOpenTableUpdate(\"$(t)\")", "t=%s", table));
+        rc = VDBManagerOpenTableUpdate
+            (mgr, &tbl, NULL, "%s", table);
+        if (rc != 0) {
+            PLOGERR(klogErr, (klogErr, rc,
+                "while opening VTable '$(path)'", "path=%s", table));
+        }
+    }
+
+    if (rc == 0) {
+/* +03: CreateCursorRead */
+        LOGMSG(klogInfo, "VDBManagerUnlock");
+        rc = VTableCreateCursorRead(tbl, &rCursor);
+        DISP_RC_INT(rc, "while creating read cursor");
+
+#if 1
+        if (rc == 0) {
+            uint32_t idx;
+            PLOGMSG(klogInfo, (klogInfo,
+                "VCursorAddColumn(read cursor, \"$(n)\")", "n=%s", name));
+            rc = VCursorAddColumn(rCursor, &idx, "%s", name);
+            if (rc != 0) {
+                PLOGERR(klogErr, (klogErr, rc,
+                    "while adding $(name) to read cursor", "name=%s", name));
+            }
+        }
+#endif
+        if (rc == 0) {
+            LOGMSG(klogInfo, "VCursorOpen(read cursor)");
+            rc = VCursorOpen(rCursor);
+            DISP_RC_INT(rc, "while opening read cursor");
+        }
+    }
+
+    if (rc == 0) {
+        VCursor *cursor;
+        uint32_t idx;
+/* +04: CreateCursorWrite */
+        LOGMSG(klogInfo, "VTableCreateCursorWrite");
+        rc = VTableCreateCursorWrite(tbl, &cursor, kcmInsert);
+        DISP_RC_INT(rc, "while creating write cursor");
+        if (rc == 0) {
+            PLOGMSG(klogInfo, (klogInfo,
+                "VCursorAddColumn(write cursor, \"$(n)\")", "n=%s", name));
+            rc = VCursorAddColumn(cursor, &idx, "%s", name);
+            if (rc != 0) {
+                PLOGERR(klogErr, (klogErr, rc,
+                    "while adding $(name) to write cursor", "name=%s", name));
+            }
+        }
+        if (rc == 0) {
+            LOGMSG(klogInfo, "VCursorOpen(write cursor)");
+            rc = VCursorOpen(cursor);
+            DISP_RC_INT(rc, "while opening write cursor");
+        }
+#if 1
+        for (i = 0; i < 3 && rc == 0; ++i) {
+            if (rc == 0) {
+                PLOGMSG(klogInfo, (klogInfo,
+                    "VCursorOpenRow(write cursor) $(i)", "i=%d", i));
+                rc = VCursorOpenRow(cursor);
+                DISP_RC_INT(rc, "while opening row to write");
+            }
+            if (rc == 0) {
+                char buffer[1];
+                char b;
+                switch (i) {
+                    case 0:
+                        buffer[0] = SRA_READ_FILTER_CRITERIA;
+                        buffer[0] = SRA_READ_FILTER_REJECT;
+                        break;
+                    case 1:
+                        buffer[0] = SRA_READ_FILTER_REJECT;
+                        buffer[0] = SRA_READ_FILTER_CRITERIA;
+                        break;
+                    case 2:
+                        buffer[0] = SRA_READ_FILTER_REDACTED;
+                        break;
+                }
+                buffer[0] = SRA_READ_FILTER_PASS;
+                b = buffer[0];
+                PLOGMSG(klogInfo, (klogInfo,
+                    "VCursorWrite('$(v)') $(i)", "v=%s,i=%d",
+                    b == SRA_READ_FILTER_REDACTED ? "SRA_READ_FILTER_REDACTED" :
+                        "?",
+                    i));
+                rc = VCursorWrite(cursor, idx, 8, buffer, 0, 1);
+                DISP_RC_INT(rc, "while writing");
+            }
+            if (rc == 0) {
+                PLOGMSG(klogInfo, (klogInfo,
+                    "VCursorCommitRow(write cursor) $(i)", "i=%d", i));
+                rc = VCursorCommitRow(cursor);
+                DISP_RC_INT(rc, "while committing row");
+            }
+            PLOGMSG(klogInfo, (klogInfo,
+                "VCursorCloseRow(write cursor) $(i)", "i=%d", i));
+            {
+                rc_t rc2 = VCursorCloseRow(cursor);
+                DISP_RC_INT(rc2, "while closing row");
+                if (rc == 0)
+                {   rc = rc2; }
+            }
+        }
+#endif
+        LOGMSG(klogInfo, "VCursorRelease(read cursor)");
+/* -03: CreateCursorRead */
+        VCursorRelease(rCursor);
+        if (rc == 0) {
+            LOGMSG(klogInfo, "VCursorCommit(write cursor)");
+            rc = VCursorCommit(cursor);
+            DISP_RC_INT(rc, "while committing cursor");
+        }
+        LOGMSG(klogInfo, "VCursorRelease(write cursor)");
+/* -04: CreateCursorWrite */
+        VCursorRelease(cursor);
+    }
+
+    LOGMSG(klogInfo, "VTableRelease");
+/* -02: OpenTable */
+    VTableRelease(tbl);
+    LOGMSG(klogInfo, "VDBManagerLock");
+    if (locked) {
+        rc_t rc2 = VDBManagerLock(mgr, "%s", table);
+        DISP_RC_INT(rc2, "while VDBManagerLock");
+    }
+
+/* -01: ManagerMake */
+    LOGMSG(klogInfo, "VDBManagerRelease");
+    VDBManagerRelease(mgr);
+
+    if (rc == 0) {
+        LOGMSG(klogInfo, "SUCCESS");
+    }
+    else { LOGMSG(klogInfo, "FAILURE"); }
+
+    return rc;
+}
diff --git a/tools/rd-filter-redact/test-read-write-cursor.vers b/tools/rd-filter-redact/test-read-write-cursor.vers
new file mode 100644
index 0000000..8e8299d
--- /dev/null
+++ b/tools/rd-filter-redact/test-read-write-cursor.vers
@@ -0,0 +1 @@
+2.4.2
diff --git a/tools/run-stat/.gitignore b/tools/run-stat/.gitignore
new file mode 100644
index 0000000..c5f06c0
--- /dev/null
+++ b/tools/run-stat/.gitignore
@@ -0,0 +1,6 @@
+*.sh
+*.txt
+*.svg
+*.xml
+*.json
+*.csv
diff --git a/tools/run-stat/Makefile b/tools/run-stat/Makefile
new file mode 100644
index 0000000..ec65302
--- /dev/null
+++ b/tools/run-stat/Makefile
@@ -0,0 +1,120 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: std
+
+TOP ?= $(abspath ../..)
+MODULE = tools/run-stat
+
+include $(TOP)/build/Makefile.env
+
+INT_TOOLS = 
+
+EXT_TOOLS = \
+	run-stat
+
+ALL_TOOLS = \
+	$(INT_TOOLS) \
+	$(EXT_TOOLS)
+
+#-------------------------------------------------------------------------------
+# outer targets
+#
+all std: vers-includes
+	@ $(MAKE_CMD) $(TARGDIR)/$@
+
+$(ALL_TOOLS): vers-includes
+	@ $(MAKE_CMD) $(BINDIR)/$@
+
+.PHONY: all std $(ALL_TOOLS)
+
+#-------------------------------------------------------------------------------
+# all
+#
+$(TARGDIR)/all: \
+	$(addprefix $(BINDIR)/,$(ALL_TOOLS))
+
+.PHONY: $(TARGDIR)/all
+
+#-------------------------------------------------------------------------------
+# std
+#
+$(TARGDIR)/std: \
+	$(addprefix $(BINDIR)/,$(EXT_TOOLS))
+
+.PHONY: $(TARGDIR)/std
+
+#-------------------------------------------------------------------------------
+# vers-includes
+#
+$(TARGDIR)/vers-includes: $(addsuffix .vers.h,$(EXT_TOOLS))
+
+.PHONY: $(TARGDIR)/vers-includes
+
+#-------------------------------------------------------------------------------
+# clean
+#
+clean: stdclean
+
+.PHONY: clean
+
+#-------------------------------------------------------------------------------
+# run-stat
+#
+RUN_STAT_SRC = \
+	num-gen \
+	context \
+	helper \
+	progressbar \
+	mod_cmn \
+	key_value \
+	rd_filter \
+	mod_reads_helper \
+	mod_reads \
+	svg \
+	chart \
+	run-stat
+
+RUN_STAT_OBJ = \
+	$(addsuffix .$(OBJX),$(RUN_STAT_SRC))
+
+RUN_STAT_LIB = \
+	-ssrapath \
+	-ssraschema \
+	-dalign-reader \
+	$(READONLY_SCHEMA_LIBS) \
+	-lvdb \
+	-lkdb \
+	-lkapp \
+	-lkfg \
+	-lkfs \
+	-lvfs \
+	-lksrch \
+	-lklib \
+	-lm
+
+$(BINDIR)/run-stat: $(RUN_STAT_OBJ)
+	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(RUN_STAT_LIB)
+
diff --git a/tools/run-stat/chart.c b/tools/run-stat/chart.c
new file mode 100644
index 0000000..0c709ac
--- /dev/null
+++ b/tools/run-stat/chart.c
@@ -0,0 +1,465 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <klib/log.h>
+#include <klib/text.h>
+#include <klib/printf.h>
+#include <klib/out.h>
+
+#include <os-native.h>
+#include <sysalloc.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "chart.h"
+
+
+char * create_line_style( p_chart chart, const char * color, const uint32_t width )
+{
+    size_t name_size = string_size( color ) + 10;
+    char * name = malloc( name_size );
+    if ( name != NULL )
+    {
+        rc_t rc = string_printf( name, name_size, NULL, ".line_%s", color );
+        if ( rc == 0 )
+        {
+            size_t value_size = name_size + 48;
+            char * value = malloc( value_size );
+            if ( value != NULL )
+            {
+                rc = string_printf( value, value_size, NULL,
+                                    "fill:none; stroke: %s; stroke-width: %d;",
+                                    color, width );
+                if ( rc == 0 )
+                    rc = svg_set_style( &chart->grafic, name, value );
+                free( value );
+            }
+            else
+                rc = -1;
+        }
+        if ( rc != 0 )
+        {
+            free( name );
+            name = NULL;
+        }
+    }
+    return name;
+}
+
+
+char * create_fill_style( p_chart chart, const char * line_color, 
+                          const char * fill_color, const uint32_t width )
+{
+    size_t name_size = string_size( fill_color ) + 10;
+    char * name = malloc( name_size );
+    if ( name != NULL )
+    {
+        rc_t rc = string_printf( name, name_size, NULL, ".fill_%s", fill_color );
+        if ( rc == 0 )
+        {
+            size_t value_size = name_size + string_size( line_color ) + 48;
+            char * value = malloc( value_size );
+            if ( value != NULL )
+            {
+                rc = string_printf( value, value_size, NULL,
+                                    "fill: %s; stroke: %s; stroke-width: %d;",
+                                    fill_color, line_color, width );
+                if ( rc == 0 )
+                    rc = svg_set_style( &chart->grafic, name, value );
+                free( value );
+            }
+            else
+                rc = -1;
+        }
+        if ( rc != 0 )
+        {
+            free( name );
+            name = NULL;
+        }
+    }
+    return name;
+}
+
+
+static void chart_styles( p_chart chart )
+{
+    /* populate the styles */
+    svg_set_style( &chart->grafic,
+                   ".thick", "stroke: black; stroke-width: 3;" );
+    svg_set_style( &chart->grafic,
+                   ".medium", "stroke: black; stroke-width: 2;" );
+    svg_set_style( &chart->grafic,
+                   ".thin", "stroke: black; stroke-width: 1;" );
+
+    svg_set_style( &chart->grafic, ".big", "font-size: 24; text-anchor: middle;" );
+    svg_set_style( &chart->grafic, ".small", "font-size: 12;" );
+    svg_set_style( &chart->grafic, ".small_m", "font-size: 12; text-anchor: middle;" );
+    svg_set_style( &chart->grafic, ".small_e", "font-size: 12; text-anchor: end;" );
+}
+
+
+static void chart_axis( p_chart chart )
+{
+    svg_line( &chart->grafic,
+              chart->xofs, chart->yofs,
+              chart->xofs, chart->yofs + chart->dy,
+              "thick" );
+    svg_line( &chart->grafic,
+              chart->xofs, chart->yofs + chart->dy,
+              chart->xofs + chart->dx, chart->yofs + chart->dy,
+              "thick" );
+}
+
+
+rc_t chart_init( p_chart chart,
+                 uint32_t xofs, uint32_t yofs, uint32_t dx, uint32_t dy )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( chart != NULL )
+    {
+        rc = svg_init( &chart->grafic );
+        if ( rc == 0 )
+        {
+            chart->xofs = xofs;
+            chart->yofs = yofs;
+            chart->dx = dx;
+            chart->dy = dy;
+            chart->entries = 0;
+
+            chart_styles( chart );
+            chart_axis( chart );
+        }
+    }
+    return rc;
+}
+
+
+void chart_destroy( p_chart chart )
+{
+    if ( chart != NULL )
+        svg_destroy( &chart->grafic );
+}
+
+
+rc_t chart_write( p_chart chart, const char * filename )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( chart != NULL && filename != NULL )
+    {
+        rc = svg_write( &chart->grafic, filename );
+    }
+    return rc;
+}
+
+
+rc_t chart_captions( p_chart chart,
+                     const char * caption, 
+                     const char * caption_x,
+                     const char * caption_y )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( chart != NULL )
+    {
+        /* the main caption centered, 24pt below the upper line (center-aligned)*/
+        svg_text( &chart->grafic,
+                  chart->xofs + ( chart->dx / 2 ), chart->yofs + 24,
+                  caption, "big" );
+        /* caption of the y-axis, 12pt below the upper line (end-aligned)*/
+        svg_text( &chart->grafic,
+                  chart->xofs -5, chart->yofs + 12,
+                  caption_y, "small_e" );
+        /* caption of the x-axis, 6pt above the x-axis (end-aligned) */
+        svg_text( &chart->grafic,
+                  chart->xofs + chart->dx, chart->yofs + chart->dy - 6,
+                  caption_x, "small_e" );
+    }
+    return rc;
+}
+
+
+long chart_round( double x )
+{
+    if ( x >= 0 )
+      return (long) ( x+0.5 );
+    return (long) ( x-0.5 );
+}
+
+
+uint32_t chart_calc_y( const uint32_t value, double factor )
+{
+    return ( chart_round( factor * value ) );
+}
+
+
+/* the scale of the y-axis */
+rc_t chart_vruler( p_chart chart,
+                   uint32_t from, uint32_t to,
+                   double factor,
+                   uint32_t spread,
+                   const char * ext )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( chart != NULL )
+    {
+        svg_path path;
+        rc = svg_path_init( &path );
+        if ( rc == 0 )
+        {
+            uint32_t idx;
+            uint32_t x = chart->xofs;
+            uint32_t y = chart->yofs + chart->dy;
+
+            for ( idx = from; idx <= to && rc == 0; idx += spread )
+            {
+                char temp[ 32 ];
+                uint32_t y1 = y - chart_calc_y( idx, factor );
+
+                svg_path_move_to( &path, true, x, y1 );
+                svg_path_hline_to( &path, false, -5 );
+
+                if ( ext != NULL )
+                    rc = string_printf( temp, sizeof( temp ), NULL, "%u%s", idx, ext );
+                else
+                    rc = string_printf( temp, sizeof( temp ), NULL, "%u", idx );
+                if ( rc == 0 )
+                    svg_text( &chart->grafic, x - 10, y1, temp, "small_e" );
+            }
+            svg_set_path( &chart->grafic, &path, "thin" );
+            svg_path_destroy( &path );
+        }
+    }
+    return rc;
+}
+
+
+/* the scale of the y-axis */
+rc_t chart_vruler1( p_chart chart,
+                   uint32_t max_y, uint32_t step_y, uint32_t max_value,
+                   const char * ext )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( chart != NULL )
+    {
+        svg_path path;
+        rc = svg_path_init( &path );
+        if ( rc == 0 )
+        {
+            uint32_t idx;
+            uint32_t x = chart->xofs;
+            uint32_t y = chart->yofs + chart->dy;
+
+            for ( idx = 0; idx <= max_y && rc == 0; idx += step_y )
+            {
+                char temp[ 32 ];
+                uint64_t value = max_value;
+                value *= idx;
+                value /= max_y;
+
+                svg_path_move_to( &path, true, x, y - idx );
+                svg_path_hline_to( &path, false, -5 );
+
+                if ( ext != NULL )
+                    rc = string_printf( temp, sizeof( temp ), NULL, "%u%s", value, ext );
+                else
+                    rc = string_printf( temp, sizeof( temp ), NULL, "%u", value );
+                if ( rc == 0 )
+                    svg_text( &chart->grafic, x - 10, y - idx, temp, "small_e" );
+            }
+            svg_set_path( &chart->grafic, &path, "thin" );
+            svg_path_destroy( &path );
+        }
+    }
+    return rc;
+}
+
+
+/* the scale of the x-axis */
+rc_t chart_hruler( p_chart chart,
+                   uint32_t *values, uint32_t n_values,
+                   uint32_t xofs, uint32_t spread )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( chart != NULL && values != NULL )
+    {
+        svg_path path;
+        rc = svg_path_init( &path );
+        if ( rc == 0 )
+        {
+            uint32_t idx;
+            uint32_t y = chart->yofs + chart->dy;
+            uint32_t x = chart->xofs + xofs;
+            rc = 0;
+            for ( idx = 0; idx < n_values && rc == 0; ++idx )
+            {
+                char temp[ 16 ];
+
+                svg_path_move_to( &path, true, x, y );
+                svg_path_vline_to( &path, false, 5 );
+
+                rc = string_printf( temp, sizeof( temp ), NULL, "%u", values[ idx ] );
+                if ( rc == 0 )
+                {
+                    if ( ( idx & 1 ) == 0 )
+                        svg_text( &chart->grafic, x, y + 20, temp, "small_m" );
+                    else
+                        svg_text( &chart->grafic, x, y + 30, temp, "small_m" );
+                }
+
+                x += spread;
+            }
+            svg_set_path( &chart->grafic, &path, "thin" );
+            svg_path_destroy( &path );
+        }
+    }
+    return rc;
+}
+
+
+rc_t chart_line( p_chart chart,
+                 const uint32_t * values,
+                 uint32_t n_values,
+                 double factor,
+                 uint32_t spread,
+                 const char * color,
+                 const char * name  )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( chart != NULL && values != NULL && color != NULL && name != NULL )
+    {
+        /* create a style for every line with the requested color */
+        char * style_name = create_line_style( chart, color, 1 );
+        if ( style_name != NULL )
+        {
+            /* translate the given values (factor) into an array of 
+               xy-coordinates, render that as polyline */
+            uint32_t y = chart->yofs + chart->dy;
+            uint32_t * points = malloc( sizeof( values[ 0 ] ) * n_values * 2 );
+            if ( points != NULL )
+            {
+                uint32_t idx, x = chart->xofs;
+                for ( idx = 0; idx < n_values; ++idx )
+                {
+                    points[ idx * 2 ] = x;
+                    points[ idx * 2 + 1 ] = y - chart_calc_y( values[ idx ], factor ); 
+                    x += spread;
+                }
+                rc = svg_polyline( &chart->grafic, &style_name[ 1 ],
+                                   points, n_values * 2 );
+                free( points );
+            }
+
+            if ( rc == 0 )
+            {
+                /* print a short line with the right color, follow by the name */
+                uint32_t x = chart->xofs + ( chart->entries * 100 );
+                y += 50;
+                svg_line( &chart->grafic, x, y, x + 20, y, &style_name[ 1 ] );
+                svg_text( &chart->grafic, x +25, y, name, "small" );
+                chart->entries++;
+            }
+            free( style_name );
+        }
+    }
+    return rc;
+}
+
+
+rc_t chart_bar2d( p_chart chart,
+                  const uint32_t x,
+                  const uint32_t h,
+                  const uint32_t dx,
+                  double factor,
+                  const char * line_color,
+                  const char * fill_color,
+                  const char * name )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( chart != NULL && line_color != NULL && fill_color!= NULL && name != NULL )
+    {
+        /* create a style for every line with the requested color */
+        char * style_name = create_fill_style( chart, line_color, fill_color, 1 );
+        if ( style_name != NULL )
+        {
+            uint32_t y  = chart->yofs + chart->dy;
+            uint32_t dy = chart_calc_y( h, factor );
+            uint32_t x1 = x + chart->xofs;
+            rc = svg_rect( &chart->grafic, x1, y - dy, dx, dy,
+                           &(style_name[ 1 ]) );
+            free( style_name );
+        }
+    }
+    return rc;
+}
+
+
+rc_t chart_box_whisker( p_chart chart,
+                      const uint32_t x,
+                      const uint32_t dx,
+                      const uint32_t p_low,
+                      const uint32_t p_high,
+                      const uint32_t q_low,
+                      const uint32_t q_high,
+                      const uint32_t median,
+                      double factor,
+                      const char * box_style,
+                      const char * median_style )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( chart != NULL && box_style != NULL && median_style != NULL )
+    {
+        uint32_t y = chart->yofs + chart->dy;
+        uint32_t y1 = y - chart_calc_y( p_low, factor );
+        uint32_t y2 = y - chart_calc_y( p_high, factor );
+        uint32_t x1 = x + chart->xofs + dx / 2;
+
+        /* draw the "whisker"*/
+        rc = svg_line( &chart->grafic, x1, y1, x1, y2, "thin" );
+        if ( rc == 0 )
+            rc = svg_line( &chart->grafic, x1 - ( dx / 4 ), y1, 
+                           x1 + ( dx / 4 ), y1, "thin" );
+        if ( rc == 0 )
+            rc = svg_line( &chart->grafic, x1 - ( dx / 4 ), y2, 
+                           x1 + ( dx / 4 ), y2, "thin" );
+        
+        /* draw the "box" over the "whisker" */
+        if ( rc == 0 )
+        {
+            x1 = x + chart->xofs;
+            y1 = y - chart_calc_y( q_low, factor );
+            y2 = y - chart_calc_y( q_high, factor );
+            rc = svg_rect( &chart->grafic, x1, y2, dx, y1-y2, box_style );
+        }
+
+        /* draw the "median" over the "box" */
+        if ( rc == 0 )
+        {
+            y1 = y - chart_calc_y( median, factor );
+            rc = svg_line( &chart->grafic, x1, y1, x1 + dx, y1, median_style );
+        }
+    }
+    return rc;
+}
diff --git a/tools/run-stat/chart.h b/tools/run-stat/chart.h
new file mode 100644
index 0000000..972e7d9
--- /dev/null
+++ b/tools/run-stat/chart.h
@@ -0,0 +1,109 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_chart_
+#define _h_chart_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "svg.h"
+
+typedef struct chart
+{
+    svg grafic;
+    uint32_t xofs, yofs;
+    uint32_t dx, dy;
+    uint32_t entries;
+} chart;
+typedef chart* p_chart;
+
+rc_t chart_init( p_chart chart,
+                 uint32_t xofs, uint32_t yofs, uint32_t dx, uint32_t dy );
+
+void chart_destroy( p_chart chart );
+
+rc_t chart_write( p_chart chart, const char * filename );
+
+rc_t chart_captions( p_chart chart,
+                     const char * caption, 
+                     const char * caption_x,
+                     const char * caption_y );
+
+long chart_round( double x );
+uint32_t chart_calc_y( const uint32_t value, double factor );
+
+rc_t chart_vruler( p_chart chart,
+                   uint32_t from, uint32_t to,
+                   double factor,
+                   uint32_t spread,
+                   const char * ext );
+
+rc_t chart_vruler1( p_chart chart,
+                   uint32_t max_y, uint32_t step_y, uint32_t max_value,
+                   const char * ext );
+
+rc_t chart_hruler( p_chart chart,
+                   uint32_t *values, uint32_t n_values,
+                   uint32_t xofs, uint32_t spread );
+
+char * create_line_style( p_chart chart, const char * color,
+                          const uint32_t width );
+
+char * create_fill_style( p_chart chart, const char * line_color, 
+                          const char * fill_color, const uint32_t width );
+
+rc_t chart_line( p_chart chart,
+                 const uint32_t * values,
+                 uint32_t n_values,
+                 double factor,
+                 uint32_t spread,
+                 const char * color,
+                 const char * name  );
+
+rc_t chart_bar2d( p_chart chart,
+                  const uint32_t x,
+                  const uint32_t h,
+                  const uint32_t dx,
+                  double factor,
+                  const char * line_color,
+                  const char * fill_color,
+                  const char * name );
+
+rc_t chart_box_whisker( p_chart chart,
+                      const uint32_t x,
+                      const uint32_t dx,
+                      const uint32_t p_low,
+                      const uint32_t p_high,
+                      const uint32_t q_low,
+                      const uint32_t q_high,
+                      const uint32_t median,
+                      double factor,
+                      const char * box_style,
+                      const char * median_style );
+
+#endif
diff --git a/tools/run-stat/context.c b/tools/run-stat/context.c
new file mode 100644
index 0000000..3a41419
--- /dev/null
+++ b/tools/run-stat/context.c
@@ -0,0 +1,439 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "context.h"
+
+#include <klib/rc.h>
+#include <klib/log.h>
+#include <klib/status.h>
+#include <klib/text.h>
+#include <kapp/args.h>
+#include <os-native.h>
+#include <sysalloc.h>
+
+#include "helper.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+
+static rc_t ctx_set_str( char **dst, const char *src )
+{
+    size_t len;
+    if ( dst == NULL )
+    {
+        return RC( rcVDB, rcNoTarg, rcWriting, rcParam, rcNull );
+    }
+    if ( *dst != NULL )
+    {
+        free( *dst );
+        *dst = NULL;
+    }
+    if ( src == NULL )
+    {
+        return RC( rcVDB, rcNoTarg, rcWriting, rcParam, rcNull );
+    }
+    len = strlen( src );
+    if ( len == 0 )
+    {
+        return RC( rcVDB, rcNoTarg, rcWriting, rcItem, rcEmpty );
+    }
+    *dst = (char*)malloc( len + 1 );
+    if ( *dst == NULL )
+    {
+        return RC( rcVDB, rcNoTarg, rcWriting, rcMemory, rcExhausted );
+    }
+    strcpy( *dst, src );
+    return 0;
+}
+
+
+static void ctx_init_values( p_stat_ctx ctx )
+{
+    ctx->path = NULL;
+    ctx->table = NULL;
+    ctx->schema_list = NULL;
+    ctx->module_list = NULL;
+    ctx->output_path = NULL;
+    ctx->name_prefix = NULL;
+
+    ctx->usage_requested = false;
+    ctx->dont_check_accession = false;
+    ctx->show_progress = false;
+}
+
+rc_t ctx_init( stat_ctx **ctx )
+{
+    rc_t rc = 0;
+    if ( ctx == NULL )
+    {
+        rc = RC( rcVDB, rcNoTarg, rcConstructing, rcParam, rcNull );
+    }
+    if ( rc == 0 )
+    {
+        (*ctx) = (p_stat_ctx)calloc( 1, sizeof( stat_ctx ) );
+        if ( *ctx == NULL )
+        {
+            rc = RC( rcVDB, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+        }
+        if ( rc == 0 )
+        {
+            ctx_init_values( *ctx );
+            rc = ng_make( &((*ctx)->row_generator) );
+            DISP_RC( rc, "num_gen_make() failed" );
+        }
+    }
+    return rc;
+}
+
+
+rc_t ctx_destroy( p_stat_ctx ctx )
+{
+    rc_t rc = 0;
+    if ( ctx == NULL )
+    {
+        rc = RC( rcVDB, rcNoTarg, rcDestroying, rcParam, rcNull );
+    }
+    if ( rc == 0 )
+    {
+        if ( ctx->path != NULL )
+        {
+            free( (void*)ctx->path );
+            ctx->path = NULL;
+        }
+
+        if ( ctx->table != NULL )
+        {
+            free( (void*)ctx->table );
+            ctx->table = NULL;
+        }
+
+        if ( ctx->name_prefix != NULL )
+        {
+            free( (void*)ctx->name_prefix );
+            ctx->name_prefix = NULL;
+        }
+
+        if ( ctx->output_path != NULL )
+        {
+            free( (void*)ctx->output_path );
+            ctx->output_path = NULL;
+        }
+
+        if ( ctx->schema_list != NULL )
+        {
+            KNamelistRelease( ctx->schema_list );
+            ctx->schema_list = NULL;
+        }
+
+        if ( ctx->module_list != NULL )
+        {
+            KNamelistRelease( ctx->module_list );
+            ctx->module_list = NULL;
+        }
+
+        ng_destroy( ctx->row_generator );
+        free( ctx );
+    }
+    return rc;
+}
+
+
+static rc_t ctx_set_path( p_stat_ctx ctx, const char *src )
+{
+    rc_t rc = RC( rcVDB, rcNoTarg, rcWriting, rcParam, rcNull );
+    if ( ctx != NULL && src != NULL )
+    {
+        rc = ctx_set_str( (char**)&(ctx->path), src );
+        DISP_RC( rc, "dump_context_set_str() failed" );
+    }
+    return rc;
+}
+
+
+/* not static because can be called directly from run-stat.c */
+rc_t ctx_set_table( p_stat_ctx ctx, const char *src )
+{
+    rc_t rc = RC( rcVDB, rcNoTarg, rcWriting, rcParam, rcNull );
+    if ( ctx != NULL && src != NULL )
+    {
+        rc = ctx_set_str( (char**)&(ctx->table), src );
+        DISP_RC( rc, "stat_context_set_str() failed" );
+    }
+    return rc;
+}
+
+
+static rc_t ctx_set_row_range( p_stat_ctx ctx, const char *src )
+{
+    rc_t rc = RC( rcVDB, rcNoTarg, rcWriting, rcParam, rcNull );
+    if ( ctx != NULL && src != NULL )
+    {
+        ng_parse( ctx->row_generator, src );
+        rc = 0;
+    }
+    return rc;
+}
+
+
+static rc_t ctx_set_name_prefix( p_stat_ctx ctx, const char *src )
+{
+    rc_t rc = RC( rcVDB, rcNoTarg, rcWriting, rcParam, rcNull );
+    if ( ctx != NULL )
+    {
+        if ( src != NULL )
+        {
+            rc = ctx_set_str( (char**)&(ctx->name_prefix), src );
+            DISP_RC( rc, "dump_context_set_str() failed" );
+        }
+        else
+        {
+            ctx->name_prefix = string_dup_measure( DEFAULT_REPORT_PREFIX, NULL );
+            rc = 0;
+        }
+    }
+    return rc;
+}
+
+
+static rc_t ctx_set_output_path( p_stat_ctx ctx, const char *src )
+{
+    rc_t rc = RC( rcVDB, rcNoTarg, rcWriting, rcParam, rcNull );
+    if ( ctx != NULL && src != NULL )
+    {
+        rc = ctx_set_str( (char**)&(ctx->output_path), src );
+        DISP_RC( rc, "dump_context_set_str() failed" );
+    }
+    return rc;
+}
+
+
+static rc_t ctx_set_report_type( p_stat_ctx ctx, const char *src )
+{
+    rc_t rc = RC( rcVDB, rcNoTarg, rcWriting, rcParam, rcNull );
+    if ( ctx != NULL )
+    {
+        ctx->report_type = RT_TXT; /* default */
+        if ( src != NULL )
+        {
+            if ( strcmp( src, "csv" ) == 0 )
+                ctx->report_type = RT_CSV;
+            else if ( strcmp( src, "xml" ) == 0 )
+                ctx->report_type = RT_XML;
+            else if ( strcmp( src, "json" ) == 0 )
+                ctx->report_type = RT_JSO;
+        }
+        rc = 0;
+    }
+    return rc;
+}
+
+
+static bool ctx_check_if_usage_necessary( p_stat_ctx ctx )
+{
+    if ( ctx == NULL ) return false;
+    if ( ctx->path == NULL ) ctx->usage_requested = true;
+    return ctx->usage_requested;
+}
+
+
+static rc_t ctx_evaluate_arguments( const Args *my_args,
+                                    p_stat_ctx ctx )
+{
+    uint32_t count;
+    rc_t rc = ArgsParamCount( my_args, &count );
+    DISP_RC( rc, "ArgsParamCount() failed" );
+    if ( rc == 0 )
+    {
+        uint32_t idx;
+        for ( idx=0; idx < count; ++idx )
+        {
+            const char *value = NULL;
+            rc = ArgsParamValue( my_args, idx, &value );
+            DISP_RC( rc, "ArgsParamValue() failed" );
+            if ( rc == 0 )
+            {
+                switch( idx )
+                {
+                    case 0 : rc = ctx_set_path( ctx, value );
+                        DISP_RC( rc, "ctx_set_path() failed" );
+                        break;
+                }
+            }
+        }
+    }
+    return rc;
+}
+
+
+static bool ctx_get_bool_option( const Args *my_args,
+                                 const char *name,
+                                 const bool def )
+{
+    bool res = def;
+    uint32_t count;
+    rc_t rc = ArgsOptionCount( my_args, name, &count );
+    DISP_RC( rc, "ArgsOptionCount() failed" );
+    if ( rc == 0 )
+        res = ( count > 0 );
+    return res;
+}
+
+
+#if 0
+static bool ctx_get_bool_neg_option( const Args *my_args,
+                                     const char *name,
+                                     const bool def )
+{
+    bool res = def;
+    uint32_t count;
+    rc_t rc = ArgsOptionCount( my_args, name, &count );
+    DISP_RC( rc, "ArgsOptionCount() failed" );
+    if ( rc == 0 )
+        res = ( count == 0 );
+    return res;
+}
+
+
+static uint16_t ctx_get_uint16_option( const Args *my_args,
+                                       const char *name,
+                                       const uint16_t def )
+{
+    uint16_t res = def;
+    uint32_t count;
+    rc_t rc = ArgsOptionCount( my_args, name, &count );
+    DISP_RC( rc, "ArgsOptionCount() failed" );
+    if ( ( rc == 0 )&&( count > 0 ) )
+    {
+        const char *s;
+        rc = ArgsOptionValue( my_args, name, 0,  &s );
+        DISP_RC( rc, "ArgsOptionValue() failed" );
+        if ( rc == 0 ) res = atoi( s );
+    }
+    return res;
+}
+#endif
+
+static const char* ctx_get_str_option( const Args *my_args,
+                                       const char *name )
+{
+    const char* res = NULL;
+    uint32_t count;
+    rc_t rc = ArgsOptionCount( my_args, name, &count );
+    DISP_RC( rc, "ArgsOptionCount() failed" );
+    if ( ( rc == 0 )&&( count > 0 ) )
+    {
+        rc = ArgsOptionValue( my_args, name, 0, &res );
+        DISP_RC( rc, "ArgsOptionValue() failed" );
+    }
+    return res;
+}
+
+
+uint32_t context_schema_count( p_stat_ctx ctx )
+{
+    uint32_t res = 0;
+    if ( ctx != NULL )
+        if ( ctx->schema_list != 0 )
+        {
+            uint32_t count;
+            if ( KNamelistCount( ctx->schema_list, &count ) == 0 )
+                res = count;
+        }
+    return res;
+}
+
+
+static void ctx_evaluate_modules( const Args *my_args, p_stat_ctx ctx )
+{
+    uint32_t count;
+    rc_t rc = ArgsOptionCount( my_args, OPTION_MODULE, &count );
+    DISP_RC( rc, "ArgsOptionCount( OPTION_MODULE ) failed" );
+    if ( ( rc == 0 )&( count > 0 ) )
+    {
+        VNamelist *v_names;
+        rc_t rc = VNamelistMake ( &v_names, 5 );
+        if ( rc == 0 )
+        {
+            uint32_t i;
+            for ( i = 0; i < count; ++i )
+            {
+                const char *s;
+                rc = ArgsOptionValue( my_args, OPTION_MODULE, i,  &s );
+                DISP_RC( rc, "ArgsOptionValue(OPTION_MODULE) failed" );
+                if ( rc == 0 )
+                    VNamelistAppend ( v_names, s );
+            }
+            VNamelistToConstNamelist ( v_names, &ctx->module_list );
+            VNamelistRelease( v_names );
+        }
+    }
+}   
+
+
+static void ctx_evaluate_options( const Args *my_args, p_stat_ctx ctx )
+{
+    if ( my_args == NULL ) return;
+    if ( ctx == NULL ) return;
+
+    ctx->dont_check_accession = ctx_get_bool_option( my_args,
+                    OPTION_WITHOUT_ACCESSION, false );
+    ctx->show_progress = ctx_get_bool_option( my_args,
+                    OPTION_PROGRESS, false );
+
+    ctx_set_table( ctx, ctx_get_str_option( my_args, OPTION_TABLE ) );
+    ctx_set_row_range( ctx, ctx_get_str_option( my_args, OPTION_ROWS ) );
+
+    helper_make_namelist_from_string( &(ctx->schema_list), 
+                    ctx_get_str_option( my_args, OPTION_SCHEMA ), ',' );
+
+    ctx_evaluate_modules( my_args, ctx );
+
+    ctx->produce_grafic = ctx_get_bool_option( my_args, OPTION_GRAFIC, false );
+    ctx_set_report_type( ctx, ctx_get_str_option( my_args, OPTION_REPORT ) );
+    ctx_set_output_path( ctx, ctx_get_str_option( my_args, OPTION_OUTPUT ) );
+    ctx_set_name_prefix( ctx, ctx_get_str_option( my_args, OPTION_PREFIX ) );
+}
+
+
+rc_t ctx_capture_arguments_and_options( const Args * args, p_stat_ctx ctx )
+{
+    rc_t rc;
+
+    rc = ctx_evaluate_arguments( args, ctx );
+    DISP_RC( rc, "ctx_evaluate_arguments() failed" );
+    if ( rc == 0 )
+    {
+        ctx_evaluate_options( args, ctx );
+        ctx_check_if_usage_necessary( ctx );
+
+        rc = ArgsHandleLogLevel( args );
+        DISP_RC( rc, "ArgsHandleLogLevel() failed" );
+    }
+    return rc;
+}
diff --git a/tools/run-stat/context.h b/tools/run-stat/context.h
new file mode 100644
index 0000000..841ee3b
--- /dev/null
+++ b/tools/run-stat/context.h
@@ -0,0 +1,98 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_run_stat_context_
+#define _h_run_stat_context_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+#include <kapp/args.h>
+#include <klib/vector.h>
+#include <klib/namelist.h>
+#include "definitions.h"
+#include "num-gen.h"
+
+#define OPTION_TABLE             "table"
+#define OPTION_ROWS              "rows"
+#define OPTION_SCHEMA            "schema"
+#define OPTION_WITHOUT_ACCESSION "without_accession"
+#define OPTION_PROGRESS          "progress"
+#define OPTION_MODULE            "module"
+#define OPTION_GRAFIC            "grafic"
+#define OPTION_REPORT            "report"
+#define OPTION_OUTPUT            "output"
+#define OPTION_PREFIX            "prefix"
+
+
+#define ALIAS_TABLE             "T"
+#define ALIAS_ROWS              "R"
+#define ALIAS_SCHEMA            "S"
+#define ALIAS_WITHOUT_ACCESSION "a"
+#define ALIAS_PROGRESS          "p"
+#define ALIAS_MODULE            "m"
+#define ALIAS_GRAFIC            "g"
+#define ALIAS_RREPORT           "r"
+#define ALIAS_OUTPUT            "o"
+#define ALIAS_PREFIX            "b"
+
+/********************************************************************
+the dump context contains all informations needed to execute the dump
+********************************************************************/
+typedef struct stat_ctx
+{
+    const char *path;
+    const KNamelist *schema_list;
+    const KNamelist *module_list;
+    const char *table;
+    p_ng row_generator;
+
+    bool usage_requested;
+    bool dont_check_accession;
+    bool show_progress;
+    bool produce_grafic;
+    uint32_t report_type;
+
+    const char *output_path;
+    const char *name_prefix;
+} stat_ctx;
+typedef stat_ctx* p_stat_ctx;
+
+
+rc_t ctx_init( stat_ctx **ctx );
+rc_t ctx_destroy( p_stat_ctx ctx );
+
+uint32_t context_schema_count( p_stat_ctx ctx );
+
+rc_t ctx_set_table( p_stat_ctx ctx, const char *src );
+
+rc_t ctx_capture_arguments_and_options( const Args * args, p_stat_ctx ctx );
+
+#endif
diff --git a/tools/run-stat/definitions.h b/tools/run-stat/definitions.h
new file mode 100644
index 0000000..af23257
--- /dev/null
+++ b/tools/run-stat/definitions.h
@@ -0,0 +1,78 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_definitions_
+#define _h_definitions_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _h_klib_defs_
+#include <klib/defs.h>
+#endif
+
+#ifndef _h_klib_out_
+#include <klib/out.h>
+#endif
+
+#ifndef _h_klib_rc_
+#include <klib/rc.h>
+#endif
+
+#define DISP_RC(rc,err) (void)((rc == 0) ? 0 : LogErr( klogInt, rc, err ))
+
+#define DISP_RC2(rc,err,succ) \
+    (void)((rc != 0)? 0 : (succ) ? LOGMSG( klogInfo, succ ) : LogErr( klogInt, rc, err ))
+
+#define RUN_STAT_COLS "READ,QUALITY,READ_LEN,READ_START,READ_TYPE"
+
+#define SRA_PF_UNDEF 0
+#define SRA_PF_454 1
+#define SRA_PF_ILLUMINA 2
+#define SRA_PF_ABSOLID 3
+#define SRA_PF_COMPLETE_GENOMICS 4
+#define SRA_PF_HELICOS 5
+#define SRA_PF_UNKNOWN 6
+
+#define SRA_READ_FILTER_PASS 0
+#define SRA_READ_FILTER_REJECT 1
+#define SRA_READ_FILTER_CRITERIA 2
+#define SRA_READ_FILTER_REDACTED 3
+
+/* report output formats */
+#define RT_TXT 0
+#define RT_CSV 1
+#define RT_XML 2
+#define RT_JSO 3
+
+#define DEFAULT_REPORT_PREFIX "report"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/run-stat/helper.c b/tools/run-stat/helper.c
new file mode 100644
index 0000000..2376e43
--- /dev/null
+++ b/tools/run-stat/helper.c
@@ -0,0 +1,715 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "helper.h"
+#include "context.h"
+
+#include <kfs/file.h>
+#include <klib/printf.h>
+#include <os-native.h>
+
+#include <sysalloc.h>
+#include <bitstr.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+
+int helper_str_cmp( const char *a, const char *b )
+{
+    size_t asize = string_size ( a );
+    size_t bsize = string_size ( b );
+    return strcase_cmp ( a, asize, b, bsize, ( asize > bsize ) ? asize : bsize );
+}
+
+
+rc_t char_buffer_init( p_char_buffer buffer, const size_t size )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( buffer != NULL )
+    {
+        buffer->len  = 0;
+        rc = 0;
+        if ( size > 0 )
+        {
+            buffer->ptr  = malloc( size );
+            if ( buffer->ptr != NULL )
+                buffer->size = size;
+            else
+                rc = RC( rcExe, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+        }
+        else
+        {
+            buffer->ptr  = NULL;
+            buffer->size = 0;
+        }
+        buffer->trans_ptr = buffer->ptr;
+    }
+    return rc;
+}
+
+
+void char_buffer_destroy( p_char_buffer buffer )
+{
+    if ( buffer != NULL )
+    {
+        free( buffer->ptr );
+        buffer->ptr = NULL;
+        buffer->len  = 0;
+        buffer->size = 0;
+    }
+}
+
+
+rc_t char_buffer_realloc( p_char_buffer buffer, const size_t new_size )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( buffer != NULL )
+    {
+        if ( buffer->ptr == NULL )
+            rc = char_buffer_init( buffer, new_size );
+        else
+        {
+            rc = 0;
+            if ( new_size > buffer->size )
+            {
+                buffer->ptr = realloc( buffer->ptr, new_size );
+                if ( buffer->ptr != NULL )
+                {
+                    buffer->size = new_size;
+                    buffer->trans_ptr = buffer->ptr;
+                }
+                else
+                    rc = RC( rcExe, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+            }
+        }
+    }
+    return rc;
+}
+
+
+rc_t char_buffer_append_cstring( p_char_buffer buffer, const char * s )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( buffer != NULL )
+    {
+        size_t s_len = string_size( s );
+        if ( s_len > 0 )
+        {
+            if ( buffer->ptr == NULL )
+            {
+                rc = char_buffer_init( buffer, s_len + 1 );
+                if ( rc == 0 )
+                {
+                    string_copy ( buffer->ptr, buffer->size, s, s_len );
+                }
+            }
+            else
+            {
+                size_t needed = buffer->len + s_len + 1;
+                if ( needed < buffer->size )
+                {
+                    string_copy ( buffer->ptr + buffer->len, 
+                                  buffer->size - buffer->len, s, s_len );
+                    buffer->len += s_len;
+                    rc = 0;
+                }
+                else
+                {
+                    rc = char_buffer_realloc( buffer, needed );
+                    if ( rc == 0 )
+                    {
+                        string_copy ( buffer->ptr + buffer->len, 
+                                      buffer->size - buffer->len, s, s_len );
+                        buffer->len += s_len;
+                    }
+                }
+            }
+        }
+    }
+    return rc;
+}
+
+
+rc_t char_buffer_printfv( p_char_buffer buffer, const size_t estimated_len,
+                          const char * fmt, va_list args )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( buffer != NULL )
+    {
+        bool done = false;
+        size_t len = estimated_len + 1;
+
+        while ( !done )
+        {
+            if ( buffer->ptr == NULL )
+                rc = char_buffer_init( buffer, len );
+            else
+            {
+                size_t needed = buffer->len + len;
+                rc = 0;
+                if ( needed > buffer->size )
+                    rc = char_buffer_realloc( buffer, needed );
+            }
+            done = ( rc != 0 );
+            if ( !done )
+            {
+                size_t written;
+                rc = string_vprintf ( buffer->ptr + buffer->len,
+                                      buffer->size - buffer->len,
+                                      &written,
+                                      fmt,
+                                      args );
+                done = ( rc == 0 );
+                if ( done )
+                    buffer->len += written;
+                else
+                    len += len;
+            }
+        }
+    }
+    return rc;
+}
+
+
+rc_t char_buffer_printf( p_char_buffer buffer, const size_t estimated_len,
+                         const char * fmt, ... )
+{
+    rc_t rc;
+    va_list args;
+    va_start ( args, fmt );
+    rc = char_buffer_printfv( buffer, estimated_len, fmt, args );
+    va_end ( args );
+    return rc;
+}
+
+
+rc_t char_buffer_saveto( p_char_buffer buffer, const char * filename )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( buffer != NULL && buffer->len > 0 && filename != NULL )
+    {
+        KDirectory * dir;
+        rc = KDirectoryNativeDir ( &dir );
+        if ( rc == 0 )
+        {
+            KFile * f;
+            rc = KDirectoryCreateFile ( dir, &f, true, 0664, kcmInit, "%s", filename );
+            if ( rc == 0 )
+            {
+                rc = KFileWrite ( f, 0, buffer->ptr, buffer->len, NULL );
+                KFileRelease( f );
+            }
+            KDirectoryRelease( dir );
+        }
+    }
+    return rc;
+}
+
+
+rc_t int_buffer_init( p_int_buffer buffer, const size_t size )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( buffer != NULL )
+    {
+        buffer->len  = 0;
+        rc = 0;
+        if ( size > 0 )
+        {
+            buffer->ptr  = malloc( size * sizeof( buffer->ptr[ 0 ] ) );
+            if ( buffer->ptr != NULL )
+                buffer->size = size;
+            else
+                rc = RC( rcExe, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+        }
+        else
+        {
+            buffer->ptr  = NULL;
+            buffer->size = 0;
+        }
+    }
+    return rc;
+
+}
+
+
+void int_buffer_destroy( p_int_buffer buffer )
+{
+    if ( buffer != NULL )
+    {
+        free( buffer->ptr );
+        buffer->ptr = NULL;
+        buffer->len  = 0;
+        buffer->size = 0;
+    }
+}
+
+
+rc_t int_buffer_realloc( p_int_buffer buffer, const size_t new_size )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( buffer != NULL )
+    {
+        if ( buffer->ptr == NULL )
+            rc = int_buffer_init( buffer, new_size );
+        else
+        {
+            rc = 0;
+            if ( new_size > buffer->size )
+            {
+                buffer->ptr = realloc( buffer->ptr, new_size * sizeof( buffer->ptr[ 0 ] ) );
+                if ( buffer->ptr != NULL )
+                    buffer->size = new_size;
+                else
+                    rc= RC( rcExe, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+            }
+        }
+    }
+    return rc;
+}
+
+
+/*
+ * calls the given manager to create a new SRA-schema
+ * takes the list of user-supplied schema's (which can be empty)
+ * and let the created schema parse all of them
+*/
+rc_t helper_parse_schema( const VDBManager *my_manager,
+                          VSchema **new_schema,
+                          const KNamelist *schema_list )
+{
+    rc_t rc;
+    if ( my_manager == NULL )
+        return RC( rcVDB, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( new_schema == NULL )
+        return RC( rcVDB, rcNoTarg, rcConstructing, rcParam, rcNull );
+
+    rc = VDBManagerMakeSRASchema( my_manager, new_schema );
+    DISP_RC( rc, "VDBManagerMakeSRASchema() failed" );
+
+    if ( ( rc == 0 )&&( schema_list != NULL ) )
+    {
+        uint32_t count;
+        if ( KNamelistCount( schema_list, &count ) == 0 )
+        {
+            uint32_t idx;
+            for ( idx = 0; idx < count && rc == 0; ++idx )
+            {
+                const char *s;
+                if ( KNamelistGet( schema_list, idx, &s ) == 0 )
+                {
+                    rc = VSchemaParseFile( *new_schema, "%s", s );
+                    DISP_RC( rc, "VSchemaParseFile() failed" );
+                }
+            }
+        }
+    }
+    return rc;
+}
+
+
+rc_t helper_make_namelist_from_string( const KNamelist **list, 
+                                       const char * src,
+                                       const char split_char )
+{
+    VNamelist *v_names;
+    rc_t rc = VNamelistMake ( &v_names, 5 );
+    if ( rc == 0 )
+    {
+        if ( ( src != NULL )&&( src[ 0 ] != 0 ) )
+        {
+            char * s = string_dup_measure ( src, NULL );
+            if ( s )
+            {
+                uint32_t str_begin = 0;
+                uint32_t str_end = 0;
+                char c;
+                do
+                {
+                    c = s[ str_end ];
+                    if ( c == split_char || c == 0 )
+                    {
+                        if ( str_begin < str_end )
+                        {
+                            char c_temp = c;
+                            s[ str_end ] = 0;
+                            rc = VNamelistAppend ( v_names, &(s[str_begin]) );
+                            s[ str_end ] = c_temp;
+                        }
+                        str_begin = str_end + 1;
+                    }
+                    str_end++;
+                } while ( c != 0 && rc == 0 );
+                free( s );
+            }
+        }
+        rc = VNamelistToConstNamelist ( v_names, list );
+        VNamelistRelease( v_names );
+    }
+    return rc;
+}
+
+
+/*************************************************************************************
+helper-function to check if a given table is in the list of tables
+if found put that name into the dump-context
+*************************************************************************************/
+bool helper_take_this_table_from_db( const VDatabase * db,
+                                     p_stat_ctx ctx,
+                                     const char * table_to_find )
+{
+    bool we_found_a_table = false;
+    KNamelist *tbl_names;
+    rc_t rc = VDatabaseListTbl( db, &tbl_names );
+    DISP_RC( rc, "VDatabaseListTbl() failed" );
+    if ( rc == 0 )
+    {
+        uint32_t n;
+        rc = KNamelistCount( tbl_names, &n );
+        DISP_RC( rc, "KNamelistCount() failed" );
+        if ( ( rc == 0 )&&( n > 0 ) )
+        {
+            uint32_t i;
+            for ( i = 0; i < n && rc == 0 && !we_found_a_table; ++i )
+            {
+                const char *tbl_name;
+                rc = KNamelistGet( tbl_names, i, &tbl_name );
+                DISP_RC( rc, "KNamelistGet() failed" );
+                if ( rc == 0 )
+                {
+                    if ( helper_str_cmp( tbl_name, table_to_find ) == 0 )
+                    {
+                        ctx_set_table( ctx, tbl_name );
+                        we_found_a_table = true;
+                    }
+                }
+            }
+        }
+        rc = KNamelistRelease( tbl_names );
+        DISP_RC( rc, "KNamelistRelease() failed" );
+    }
+    return we_found_a_table;
+}
+
+
+bool helper_take_1st_table_from_db( const VDatabase *db,
+                                    p_stat_ctx ctx )
+{
+    bool we_found_a_table = false;
+    KNamelist *tbl_names;
+    rc_t rc = VDatabaseListTbl( db, &tbl_names );
+    DISP_RC( rc, "VDatabaseListTbl() failed" );
+    if ( rc == 0 )
+    {
+        uint32_t n;
+        rc = KNamelistCount( tbl_names, &n );
+        DISP_RC( rc, "KNamelistCount() failed" );
+        if ( ( rc == 0 )&&( n > 0 ) )
+        {
+            const char *tbl_name;
+            rc = KNamelistGet( tbl_names, 0, &tbl_name );
+            DISP_RC( rc, "KNamelistGet() failed" );
+            if ( rc == 0 )
+            {
+                ctx_set_table( ctx, tbl_name );
+                we_found_a_table = true;
+            }
+        }
+        rc = KNamelistRelease( tbl_names );
+        DISP_RC( rc, "KNamelistRelease() failed" );
+    }
+    return we_found_a_table;
+}
+
+
+char * helper_concat( const char * s1, const char * s2 )
+{
+    size_t l1 = string_size ( s1 );
+    size_t l2 = string_size ( s2 );
+    size_t l = l1 + l2 + 1;
+    char * res = malloc( l );
+    if ( res != NULL )
+    {
+        size_t l3 = string_copy ( res, l, s1, l1 );
+        string_copy ( res + l3, l - l3, s2, l2 );
+    }
+    return res;
+}
+
+
+double percent( const uint64_t value, const uint64_t sum )
+{
+    double res = 0.0;
+    if ( sum > 0 && value > 0 )
+    {
+        res = value;
+        res *= 100;
+        res /= sum;
+    }
+    return res;
+}
+
+
+/*********************************************************************************
+    "bases(bio)" ---> module = "bases", param = "bio"
+*********************************************************************************/
+rc_t helper_split_by_parenthesis( const char * src, char ** module, char ** param )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( src != NULL && module != NULL && param!= NULL )
+    {
+        size_t src_size = string_size( src );
+        *module = NULL;
+        *param  = NULL;
+        if ( src_size < 1 )
+            rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcEmpty );
+        else
+        {
+            rc = RC( rcExe, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+            *module = malloc( src_size + 1 );
+            if ( *module != NULL )
+            {
+                *param = malloc( src_size + 1 );
+                if ( *param == NULL )
+                {
+                    free( *module );
+                    *module = NULL;
+                }
+                else
+                {
+                    size_t src_idx, dst_idx;
+                    bool b_module = true;
+                    dst_idx = 0;
+                    for ( src_idx = 0; src_idx < src_size; ++src_idx )
+                    {
+                        char c = src[ src_idx ];
+                        if ( b_module )
+                        {
+                            if ( c == '(' )
+                            {
+                                (*module)[ dst_idx ] = 0;
+                                dst_idx = 0;
+                                b_module = false;
+                            }
+                            else
+                                (*module)[ dst_idx++ ] = c;
+                        }
+                        else
+                        {
+                            if ( c != ')' )
+                                (*param)[ dst_idx++ ] = c;
+                        }
+                    }
+                    if ( b_module )
+                    {
+                        (*module)[ dst_idx ] = 0;
+                        free( *param );
+                        *param = NULL;
+                    }
+                    else
+                        (*param)[ dst_idx ] = 0;
+
+                    rc = 0;
+                }
+            }
+        }
+    }
+    return rc;
+}
+
+
+static rc_t read_value( void * dst, const VCursor * cur, 
+                        const uint32_t cur_idx, const uint32_t dst_bits )
+{
+    uint32_t elem_bits, boff, elem_count;
+    const void * base;
+    rc_t rc = VCursorCellData ( cur, cur_idx, &elem_bits,
+                                &base, &boff, &elem_count );
+    if ( rc == 0 )
+    {
+        if ( elem_bits > dst_bits )
+            rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcInvalid );
+        else
+        {
+            if ( boff == 0 )
+                memmove( dst, base, elem_bits >> 3 );
+            else
+                bitcpy ( dst, 0, base, boff, elem_bits );
+        }
+    }
+    return rc;
+}
+
+
+rc_t helper_read_uint64( const VCursor * cur, const uint32_t cur_idx,
+                         uint64_t *value )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( cur != NULL && value != NULL )
+    {
+        *value = 0;
+        rc = read_value( value, cur, cur_idx, 64 );
+    }
+    return rc;
+}
+
+
+rc_t helper_read_uint32( const VCursor * cur, const uint32_t cur_idx,
+                         uint32_t *value )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( cur != NULL && value != NULL )
+    {
+        *value = 0;
+        rc = read_value( value, cur, cur_idx, 32 );
+    }
+    return rc;
+}
+
+
+static rc_t read_int32_values( p_int_buffer buf, const void * base,
+                               uint32_t boff, uint32_t elem_count )
+{
+    rc_t rc = 0;
+    if ( boff == 0 )
+    {
+        buf->trans_ptr = base;
+        buf->len = elem_count;
+    }
+    else
+    {
+        if ( buf->size < elem_count )
+            rc = int_buffer_realloc( buf, elem_count );
+        if ( rc == 0 )
+        {
+            bitcpy ( buf->ptr, 0, base, boff, elem_count << 2 );
+            buf->trans_ptr = buf->ptr;
+            buf->len = elem_count;
+        }
+    }
+    return rc;
+}
+
+
+static rc_t read_int8_values( p_int_buffer buf, const void * base,
+                              uint32_t boff, uint32_t elem_count )
+{
+    rc_t rc = 0;
+
+    if ( buf->size < elem_count )
+        rc = int_buffer_realloc( buf, elem_count );
+    if ( rc == 0 )
+    {
+        if ( boff == 0 )
+        {
+            const uint8_t * src = base;
+            uint32_t idx;
+            for ( idx = 0; idx < elem_count; idx++ )
+                buf->ptr[ idx ] = src[ idx ];
+        }
+        else
+        {
+            uint8_t * src = malloc( elem_count );
+            if ( src != NULL )
+            {
+                uint32_t idx;
+                bitcpy ( src, 0, base, boff, elem_count );
+                for ( idx = 0; idx < elem_count; idx++ )
+                    buf->ptr[ idx ] = src[ idx ];
+                free( src );
+            }
+            else
+                rc = RC( rcExe, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+        }
+    }
+    if ( rc == 0 )
+    {
+        buf->trans_ptr = buf->ptr;
+        buf->len = elem_count;
+    }
+    return rc;
+}
+
+
+rc_t helper_read_int32_values( const VCursor * cur, const uint32_t cur_idx,
+                               p_int_buffer buf )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( cur != NULL && buf != NULL )
+    {
+        uint32_t elem_bits, boff, elem_count;
+        const void * base;
+        rc = VCursorCellData ( cur, cur_idx, &elem_bits,
+                               &base, &boff, &elem_count );
+        if ( rc == 0 )
+        {
+            switch( elem_bits )
+            {
+            case 32 : rc = read_int32_values( buf, base, boff, elem_count ); break;
+            case  8 : rc = read_int8_values( buf, base, boff, elem_count ); break;
+            }
+        }
+        else
+            buf->len = 0;
+    }
+    return rc;
+}
+
+
+rc_t helper_read_char_values( const VCursor * cur, const uint32_t cur_idx,
+                              p_char_buffer buf )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( cur != NULL && buf != NULL )
+    {
+        uint32_t elem_bits, boff, elem_count;
+        const void * base;
+        rc = VCursorCellData ( cur, cur_idx, &elem_bits,
+                               &base, &boff, &elem_count );
+        if ( rc ==  0 )
+        {
+            if ( boff == 0 )
+            {
+                buf->trans_ptr = base;
+                buf->len = elem_count;
+            }
+            else
+            {
+                if ( buf->size < elem_count )
+                    rc = char_buffer_realloc( buf, elem_count );
+                if ( rc == 0 )
+                {
+                    bitcpy ( buf->ptr, 0, base, boff, elem_count * elem_bits );
+                    buf->trans_ptr = buf->ptr;
+                    buf->len = elem_count;
+                }
+            }
+        }
+        else
+            buf->len = 0;
+    }
+    return rc;
+}
diff --git a/tools/run-stat/helper.h b/tools/run-stat/helper.h
new file mode 100644
index 0000000..ce01552
--- /dev/null
+++ b/tools/run-stat/helper.h
@@ -0,0 +1,126 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_helper_
+#define _h_helper_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <klib/namelist.h>
+#include <klib/rc.h>
+#include <klib/log.h>
+#include <klib/text.h>
+#include <vdb/manager.h>
+#include <vdb/schema.h>
+#include <vdb/database.h>
+#include <vdb/cursor.h>
+#include <sra/sraschema.h>
+#include "definitions.h"
+#include "context.h"
+
+
+typedef struct char_buffer
+{
+    char *ptr;
+    const char *trans_ptr;
+    size_t len;         /* how many bytes are used... */
+    size_t size;        /* how much is allocated... */
+} char_buffer;
+typedef char_buffer* p_char_buffer;
+
+rc_t char_buffer_init( p_char_buffer buffer, const size_t size );
+void char_buffer_destroy( p_char_buffer buffer );
+rc_t char_buffer_realloc( p_char_buffer buffer, const size_t by );
+rc_t char_buffer_append_cstring( p_char_buffer buffer, const char * s );
+rc_t char_buffer_printfv( p_char_buffer buffer, const size_t estimated_len,
+                          const char * fmt, va_list args );
+rc_t char_buffer_printf( p_char_buffer buffer, const size_t estimated_len,
+                         const char * fmt, ... );
+rc_t char_buffer_saveto( p_char_buffer buffer, const char * filename );
+
+
+typedef struct int_buffer
+{
+    uint32_t *ptr;
+    const uint32_t *trans_ptr;
+    size_t len;         /* how many ints are used... */
+    size_t size;        /* how much is allocated... */
+} int_buffer;
+typedef int_buffer* p_int_buffer;
+
+rc_t int_buffer_init( p_int_buffer buffer, const size_t size );
+void int_buffer_destroy( p_int_buffer buffer );
+rc_t int_buffer_realloc( p_int_buffer buffer, const size_t by );
+
+int helper_str_cmp( const char *a, const char *b );
+
+/*
+ * calls the given manager to create a new SRA-schema
+ * takes the list of user-supplied schema's (which can be empty)
+ * and let the created schema parse all of them
+*/
+rc_t helper_parse_schema( const VDBManager *my_manager,
+                          VSchema **new_schema,
+                          const KNamelist *schema_list );
+
+
+rc_t helper_make_namelist_from_string( const KNamelist **list, 
+                                       const char * src,
+                                       const char split_char );
+
+bool helper_take_this_table_from_db( const VDatabase * db,
+                                     p_stat_ctx ctx,
+                                     const char * table_to_find );
+
+bool helper_take_1st_table_from_db( const VDatabase * db,
+                                    p_stat_ctx ctx );
+
+char * helper_concat( const char * s1, const char * s2 );
+
+double percent( const uint64_t value, const uint64_t sum );
+
+rc_t helper_split_by_parenthesis( const char * src, char ** module, char ** param );
+
+rc_t helper_read_uint32( const VCursor * cur, const uint32_t cur_idx,
+                         uint32_t *value );
+
+rc_t helper_read_uint64( const VCursor * cur, const uint32_t cur_idx,
+                         uint64_t *value );
+
+rc_t helper_read_int32_values( const VCursor * cur, const uint32_t cur_idx,
+                               p_int_buffer buf );
+
+rc_t helper_read_char_values( const VCursor * cur, const uint32_t cur_idx,
+                              p_char_buffer buf );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/run-stat/key_value.c b/tools/run-stat/key_value.c
new file mode 100644
index 0000000..5126350
--- /dev/null
+++ b/tools/run-stat/key_value.c
@@ -0,0 +1,549 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <klib/out.h>
+#include <klib/text.h>
+#include <klib/printf.h>
+#include <klib/namelist.h>
+#include <sysalloc.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "key_value.h"
+
+
+rc_t report_init( p_report * self, uint32_t prealloc )
+{
+    rc_t rc = 0;
+    if ( self != NULL )
+    {
+        *self = calloc( 1, sizeof **self );
+        if ( *self != NULL )
+            VectorInit ( &( (*self)->data ), 0, prealloc );
+        else
+            rc = RC( rcExe, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+    }
+    else
+        rc = RC( rcExe, rcNoTarg, rcConstructing, rcSelf, rcNull );
+    return rc;
+}
+
+
+static void CC report_data_whack( void *item, void *data )
+{
+    const VNamelist * values = item;
+    if ( values != NULL )
+        VNamelistRelease ( values );
+}
+
+
+rc_t report_clear( p_report self )
+{
+    rc_t rc = 0;
+    if ( self != NULL )
+    {
+        VectorWhack ( &(self->data), report_data_whack, NULL );
+        VNamelistRelease ( self->columns ); /* ignores NULL */
+        if ( self->max_width != NULL )
+        {
+            free( self->max_width );
+            self->max_width = NULL;
+        }
+    }
+    else
+        rc = RC( rcExe, rcNoTarg, rcConstructing, rcSelf, rcNull );
+    return rc;
+}
+
+
+rc_t report_destroy( p_report self )
+{
+    rc_t rc;
+    if ( self != NULL )
+    {
+        rc = report_clear( self );
+        free( self );
+    }
+    else
+        rc = RC( rcExe, rcNoTarg, rcConstructing, rcSelf, rcNull );
+    return rc;
+}
+
+
+rc_t report_set_columns( p_report self, size_t count, ... )
+{
+    rc_t rc;
+    if ( self != NULL )
+    {
+        VNamelistRelease ( self->columns ); /* ignores NULL */
+        rc = VNamelistMake ( &self->columns, count );
+        if ( rc == 0 )
+        {
+            self->col_count = count;
+            if ( self->max_width != NULL )
+                free( self->max_width );
+            self->max_width = malloc( count * sizeof( *self->max_width ) );
+            if ( self->max_width == NULL )
+                rc = RC( rcExe, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+
+            if ( rc == 0 )
+            {
+                size_t idx;
+                va_list args;
+
+                va_start ( args, count );
+                for ( idx = 0; idx < count && rc == 0; ++idx )
+                {
+                    const char * s = va_arg( args, const char * );
+                    if ( s != NULL )
+                    {
+                        rc = VNamelistAppend ( self->columns, s );
+                        self->max_width[ idx ] = string_size( s );
+                    }
+                    else
+                    {
+                        rc = VNamelistAppend ( self->columns, "." );
+                        self->max_width[ idx ] = 1;
+                    }
+                }
+                va_end ( args );
+            }
+        }
+    }
+    else
+        rc = RC( rcExe, rcNoTarg, rcConstructing, rcSelf, rcNull );
+    return rc;
+}
+
+
+rc_t report_new_data( p_report self )
+{
+    rc_t rc;
+    if ( self != NULL )
+    {
+        if ( self->columns != NULL )
+        {
+            uint32_t count;
+            rc = VNameListCount ( self->columns, &count );
+            if ( rc == 0 && count > 0 )
+            {
+                VNamelist * new_row;
+                rc = VNamelistMake ( &new_row, count );
+                if ( rc == 0 )
+                    rc = VectorAppend ( &self->data, NULL, new_row );
+            }
+        }
+        else
+            rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcInvalid );
+    }
+    else
+        rc = RC( rcExe, rcNoTarg, rcConstructing, rcSelf, rcNull );
+    return rc;
+}
+
+
+rc_t report_add_data( p_report self, const size_t estimated_len, const char * fmt, ... )
+{
+    rc_t rc = 0;
+    if ( self != NULL )
+    {
+        uint32_t n_data = VectorLength( &self->data );
+        if ( n_data == 0 )
+        {
+            rc = report_new_data( self );
+            n_data++;
+        }
+        if ( rc == 0 )
+        {
+            VNamelist * last_row = VectorGet ( &self->data, n_data - 1 );
+            if ( last_row != NULL )
+            {
+                uint32_t n_col;
+
+                VNameListCount ( last_row, &n_col );
+                if ( n_col < self->col_count )
+                {
+                    va_list args;
+                    size_t len = estimated_len;
+                    bool done = false;
+                    char * s;
+
+                    va_start ( args, fmt );
+                    while( !done )
+                    {
+                        s = malloc( len );
+                        done = ( s == NULL );
+                        if ( !done )
+                        {
+                            size_t written;
+                            rc = string_vprintf ( s, estimated_len, &written, fmt, args );
+                            done = ( rc == 0 );
+                            if ( done )
+                            {
+                                rc = VNamelistAppend ( last_row, s );
+                                if ( self->max_width[ n_col ] < written )
+                                    self->max_width[ n_col ] = written;
+                            }
+                            else
+                            {
+                                free( s );
+                                len += len;
+                            }
+                        }
+                        else
+                            rc = RC( rcExe, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+                    }
+                    va_end ( args );
+                }
+            }
+            else
+                rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcInvalid );
+        }
+    }
+    else
+        rc = RC( rcExe, rcNoTarg, rcConstructing, rcSelf, rcNull );
+    return rc;
+}
+
+
+static rc_t report_print_column_names( p_report self, p_char_buffer dst,
+                                   const uint32_t n_col, const char delim )
+{
+    rc_t rc = 0;
+    uint32_t col_idx;
+    /* print the column-names */
+    for ( col_idx = 0; col_idx < n_col && rc == 0; ++col_idx )
+    {
+        const char * s;
+        rc = VNameListGet ( self->columns, col_idx, &s );
+        if ( rc == 0 )
+        {
+            size_t len = string_size( s );
+            if ( col_idx < n_col - 1 )
+                rc = char_buffer_printf( dst, len + 5, "%s%c", s, delim );
+            else
+                rc = char_buffer_printf( dst, len + 5, "%s\n", s );
+        }
+    }
+    return rc;
+}
+
+static rc_t report_print_tabed_column_names( p_report self, p_char_buffer dst,
+                                   const uint32_t n_col, const char delim )
+{
+    rc_t rc = 0;
+    uint32_t col_idx;
+    /* print the column-names */
+    for ( col_idx = 0; col_idx < n_col && rc == 0; ++col_idx )
+    {
+        const char * s;
+        rc = VNameListGet ( self->columns, col_idx, &s );
+        if ( rc == 0 )
+        {
+            uint32_t w = self->max_width[ col_idx ];
+            if ( col_idx < n_col - 1 )
+                rc = char_buffer_printf( dst, w + 5, "%*s%c", w, s, delim );
+            else
+                rc = char_buffer_printf( dst, w + 5, "%*s\n", w, s );
+        }
+    }
+    return rc;
+}
+
+
+static rc_t report_print_data_rows( p_report self, p_char_buffer dst,
+                                const uint32_t n_data, const char delim )
+{
+    rc_t rc = 0;
+    uint32_t d_idx;
+    for ( d_idx = 0; d_idx < n_data && rc == 0; ++d_idx )
+    {
+        VNamelist * row = VectorGet ( &self->data, d_idx );
+        if ( row != NULL )
+        {
+            uint32_t nc_data;
+            rc = VNameListCount ( row, &nc_data );
+            if ( rc == 0 )
+            {
+                uint32_t col_idx;
+                for ( col_idx = 0; col_idx < nc_data && rc == 0; ++col_idx )
+                {
+                    const char * s;
+                    rc = VNameListGet ( row, col_idx, &s );
+                    if ( rc == 0 )
+                    {
+                        size_t len = string_size( s );
+                        if ( col_idx < nc_data - 1 )
+                            rc = char_buffer_printf( dst, len + 5, "%s%c", s, delim );
+                        else
+                            rc = char_buffer_printf( dst, len + 5, "%s\n", s );
+                    }
+                }
+            }
+        }
+    }
+    return rc;
+}
+
+
+static rc_t report_print_tabed_data_rows( p_report self, p_char_buffer dst,
+                                const uint32_t n_data, const char delim )
+{
+    rc_t rc = 0;
+    uint32_t d_idx;
+    for ( d_idx = 0; d_idx < n_data && rc == 0; ++d_idx )
+    {
+        VNamelist * row = VectorGet ( &self->data, d_idx );
+        if ( row != NULL )
+        {
+            uint32_t nc_data;
+            rc = VNameListCount ( row, &nc_data );
+            if ( rc == 0 )
+            {
+                uint32_t col_idx;
+                for ( col_idx = 0; col_idx < nc_data && rc == 0; ++col_idx )
+                {
+                    const char * s;
+                    rc = VNameListGet ( row, col_idx, &s );
+                    if ( rc == 0 )
+                    {
+                        uint32_t w = self->max_width[ col_idx ];
+                        if ( col_idx < nc_data - 1 )
+                            rc = char_buffer_printf( dst, w + 5, "%*s%c", w, s, delim );
+                        else
+                            rc = char_buffer_printf( dst, w + 5, "%*s\n", w, s );
+                    }
+                }
+            }
+        }
+    }
+    return rc;
+}
+
+
+static rc_t report_print_column_names_row0( p_report self, p_char_buffer dst,
+                                            const uint32_t n_col )
+{
+    rc_t rc = 0;
+    uint32_t i, w = 0;
+    VNamelist * row;
+
+    for ( i = 0; i < n_col && rc == 0; ++i )
+    {
+        const char * s;
+        rc = VNameListGet ( self->columns, i, &s );
+        if ( rc == 0 )
+        {
+            size_t len = string_size( s );
+        if ( len > w ) w = len;
+        }
+    }
+    row = VectorGet ( &self->data, 0 );
+    if ( row != NULL )
+    {
+        for ( i = 0; i < n_col && rc == 0; ++i )
+        {
+            const char * s_col;
+            rc = VNameListGet ( self->columns, i, &s_col );
+            if ( rc == 0 )
+            {
+                const char * s_value;
+                rc = VNameListGet ( row, i, &s_value );
+                if ( rc == 0 )
+                {
+                    size_t len = string_size( s_value ) + w + 5;
+                    rc = char_buffer_printf( dst, len, "%*s : %s\n", w, s_col, s_value );
+                }
+            }
+        }
+    }
+    return rc;
+}
+
+static rc_t report_print_txt( p_report self, p_char_buffer dst,
+                            const uint32_t n_col, const uint32_t n_data )
+{
+    rc_t rc;
+    uint32_t rows = VectorLength( &self->data );
+    switch( rows )
+    {
+        case 0  : rc = report_print_tabed_column_names( self, dst, n_col, ' ' );
+                  break;
+        case 1  : rc = report_print_column_names_row0( self, dst, n_col );
+                  break;
+        default : rc = report_print_tabed_column_names( self, dst, n_col, ' ' );
+                  if ( rc == 0 )
+                    rc = report_print_tabed_data_rows( self, dst, n_data, ' ' );
+    }
+    return rc;
+}
+
+
+static rc_t report_print_csv( p_report self, p_char_buffer dst,
+                            const uint32_t n_col, const uint32_t n_data )
+{
+    rc_t rc = report_print_column_names( self, dst, n_col, ',' );
+    if ( rc == 0 )
+        rc = report_print_data_rows( self, dst, n_data, ',' );
+    return rc;
+}
+
+
+
+static rc_t report_print_xml( p_report self, p_char_buffer dst,
+                            const uint32_t n_col, const uint32_t n_data )
+{
+    rc_t rc = 0;
+    uint32_t d_idx;
+    for ( d_idx = 0; d_idx < n_data && rc == 0; ++d_idx )
+    {
+        VNamelist * row = VectorGet ( &self->data, d_idx );
+        if ( row != NULL )
+        {
+            /* open the row-xml node */
+            rc = char_buffer_printf( dst, 20, "<row_%u>\n", d_idx );
+            if ( rc == 0 )
+            {
+                uint32_t nc_data;
+                rc = VNameListCount ( row, &nc_data );
+                if ( rc == 0 )
+                {
+                    uint32_t col_idx;
+                    for ( col_idx = 0; col_idx < nc_data && rc == 0; ++col_idx )
+                    {
+                        const char * s_col;
+                        rc = VNameListGet ( self->columns, col_idx, &s_col );
+                        if ( rc == 0 )
+                        {
+                            const char * s;
+                            size_t col_len = string_size( s_col );
+                            rc = VNameListGet ( row, col_idx, &s );
+                            if ( rc == 0 )
+                            {
+                                size_t len = string_size( s );
+                                /* print the value */
+                                rc = char_buffer_printf( dst, col_len * 2 + len + 20, 
+                                    " <%s>%s</%s>\n", s_col, s, s_col );
+                            }
+                        }
+                    }
+                }
+                /* close the row-xml node */
+                rc = char_buffer_printf( dst, 20, "</row_%u>\n\n", d_idx );
+            }
+        }
+    }
+    return rc;
+}
+
+
+static rc_t report_print_jso( p_report self, p_char_buffer dst,
+                            const uint32_t n_col, const uint32_t n_data )
+{
+    rc_t rc = 0;
+    uint32_t d_idx;
+    for ( d_idx = 0; d_idx < n_data && rc == 0; ++d_idx )
+    {
+        VNamelist * row = VectorGet ( &self->data, d_idx );
+        if ( row != NULL )
+        {
+            /* open the json node */
+            rc = char_buffer_printf( dst, 20, "{\n", d_idx );
+            if ( rc == 0 )
+            {
+                uint32_t nc_data;
+                rc = VNameListCount ( row, &nc_data );
+                if ( rc == 0 )
+                {
+                    uint32_t col_idx;
+                    for ( col_idx = 0; col_idx < nc_data && rc == 0; ++col_idx )
+                    {
+                        const char * s_col;
+                        rc = VNameListGet ( self->columns, col_idx, &s_col );
+                        if ( rc == 0 )
+                        {
+                            const char * s;
+                            size_t col_len = string_size( s_col );
+                            rc = VNameListGet ( row, col_idx, &s );
+                            if ( rc == 0 )
+                            {
+                                size_t len = string_size( s );
+                                /* print the value */
+                                if ( col_idx < nc_data -1 )
+                                    rc = char_buffer_printf( dst, col_len + len + 10, 
+                                        " \"%s\":%s,\n", s_col, s );
+                                else
+                                    rc = char_buffer_printf( dst, col_len + len + 10, 
+                                        " \"%s\":%s\n", s_col, s );
+                            }
+                        }
+                    }
+                }
+                /* close the json-node */
+                if ( d_idx < n_data - 1 )
+                    rc = char_buffer_printf( dst, 20, "},\n\n", d_idx );
+                else
+                    rc = char_buffer_printf( dst, 20, "}\n", d_idx );
+            }
+        }
+    }
+    return rc;
+}
+
+
+rc_t report_print( p_report self, p_char_buffer dst, uint32_t mode )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcSelf, rcNull );
+    if ( self != NULL )
+    {
+        rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+        if ( dst != NULL )
+        {
+            uint32_t n_col;
+            rc = VNameListCount ( self->columns, &n_col );
+            if ( rc == 0 )
+            {
+                rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcInvalid );
+                if ( n_col > 0 )
+                {
+                    uint32_t n_data = VectorLength( &self->data );
+                    if ( n_data >= 0 )
+                    {
+                        switch( mode )
+                        {
+                        case RT_TXT : rc = report_print_txt( self, dst, n_col, n_data ); break;
+                        case RT_CSV : rc = report_print_csv( self, dst, n_col, n_data ); break;
+                        case RT_XML : rc = report_print_xml( self, dst, n_col, n_data ); break;
+                        case RT_JSO : rc = report_print_jso( self, dst, n_col, n_data ); break;
+                        default : rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcInvalid );
+                        }
+                    }
+                }
+            }
+        }
+    }
+    return rc;
+}
\ No newline at end of file
diff --git a/tools/run-stat/key_value.h b/tools/run-stat/key_value.h
new file mode 100644
index 0000000..35e6719
--- /dev/null
+++ b/tools/run-stat/key_value.h
@@ -0,0 +1,64 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_key_value_
+#define _h_key_value_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+#include <klib/rc.h>
+#include "helper.h"
+
+typedef struct report
+{
+    VNamelist * columns;
+    uint32_t col_count;
+    Vector data;
+    uint32_t *max_width;
+} report;
+typedef report* p_report;
+
+
+rc_t report_init( p_report * self, uint32_t prealloc );
+
+rc_t report_destroy( p_report self );
+
+rc_t report_clear( p_report self );
+
+rc_t report_set_columns( p_report self, size_t count, ... );
+
+rc_t report_new_data( p_report self );
+
+rc_t report_add_data( p_report self, const size_t estimated_len, const char * fmt, ... );
+
+rc_t report_print( p_report self, p_char_buffer dst, uint32_t mode );
+
+#endif
\ No newline at end of file
diff --git a/tools/run-stat/mod_cmn.c b/tools/run-stat/mod_cmn.c
new file mode 100644
index 0000000..1fece24
--- /dev/null
+++ b/tools/run-stat/mod_cmn.c
@@ -0,0 +1,329 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <klib/out.h>
+#include <klib/text.h>
+#include <sysalloc.h>
+#include <stdlib.h>
+
+#include "mod_cmn.h"
+#include "mod_reads.h"
+
+
+static rc_t module_init( p_module * new_module, const char * name )
+{
+    rc_t rc = rc = RC( rcExe, rcData, rcAllocating, rcParam, rcNull );
+    if ( new_module != NULL && name != NULL )
+    {
+        rc = RC( rcExe, rcData, rcAllocating, rcMemory, rcExhausted );
+        (*new_module) = calloc( 1, sizeof( module ) );
+        if ( *new_module != NULL )
+        {
+            char * s_module;
+            char * param;
+            /* we have to split the name into mod-name and parameters */
+            rc = helper_split_by_parenthesis( name, &s_module, &param );
+            if ( rc == 0 )
+            {
+                (*new_module)->name = string_dup_measure ( s_module, NULL );
+                /* here we hardcode the build-in modules */
+                if ( helper_str_cmp( s_module, "bases" ) == 0 )
+                {
+                    rc = mod_reads_init( *new_module, param );
+                }
+                free( s_module );
+                if ( param != NULL )
+                    free( param );
+            }
+        }
+    }
+    return rc;
+}
+
+
+static void destroy_module( p_module a_mod )
+{
+    if ( a_mod != NULL )
+    {
+        /* free the name... */
+        if ( a_mod->name != NULL )
+            free( a_mod->name );
+        /* call the function to free the context-pointer */
+        if ( a_mod->f_free != NULL )
+            a_mod->f_free( a_mod );
+        free( a_mod );
+    }
+}
+
+
+static void CC destroy_module_cb( void* node, void* data )
+{
+    destroy_module( ( p_module )node );
+}
+
+
+static rc_t modules_init_loop( p_mod_list self, const KNamelist * names )
+{
+    uint32_t count;
+    rc_t rc = KNamelistCount ( names, &count );
+    if ( rc == 0 )
+    {
+        uint32_t i;
+        for ( i = 0; i < count && rc == 0; ++i )
+        {
+            const char * s;
+            rc = KNamelistGet ( names, i, &s );
+            if ( rc == 0 )
+            {
+                p_module a_module;
+                rc = module_init( &a_module, s );
+                if ( rc == 0 )
+                {
+                    rc = VectorAppend( &(self->list), NULL, a_module );
+                    if ( rc != 0 )
+                        destroy_module( a_module );
+                }
+            }
+        }
+    }
+    return rc;
+}
+
+
+rc_t mod_list_init( p_mod_list * self, const KNamelist * names )
+{
+    rc_t rc = RC( rcExe, rcData, rcAllocating, rcParam, rcNull );
+    if ( self != NULL )
+    {
+        rc = RC( rcExe, rcData, rcAllocating, rcMemory, rcExhausted );
+        (*self) = calloc( 1, sizeof( mod_list ) );
+        if ( *self != NULL )
+        {
+            VectorInit( &( (*self)->list ), 0, 5 );
+            rc = modules_init_loop( *self, names );
+            if ( rc != 0 )
+            {
+                VectorWhack( &( (*self)->list ), destroy_module_cb, NULL );
+                free( *self );
+                *self = NULL;
+            }
+        }
+    }
+    return rc;
+}
+
+
+rc_t mod_list_destroy( p_mod_list list )
+{
+    VectorWhack( &(list->list), destroy_module_cb, NULL );
+    free( list );
+    return 0;
+}
+
+
+rc_t mod_list_pre_open( p_mod_list self, 
+                        const VCursor * cur )
+{
+    rc_t rc = RC( rcExe, rcData, rcAllocating, rcParam, rcNull );
+    if ( self != NULL && cur != NULL )
+    {
+        uint32_t len = VectorLength( &(self->list) );
+        rc = 0;
+        if ( len > 0 )
+        {
+            uint32_t m_idx;
+            for ( m_idx = 0; m_idx < len && rc == 0; ++m_idx )
+            {
+                p_module a_module = VectorGet ( &(self->list), m_idx );
+                if ( a_module != NULL && a_module->f_pre_open != NULL )
+                {
+                    rc = a_module->f_pre_open( a_module, cur );
+                }
+            }
+        }
+    }
+    return rc;
+}
+
+
+rc_t mod_list_post_rows( p_mod_list self )
+{
+    rc_t rc = RC( rcExe, rcData, rcAllocating, rcParam, rcNull );
+    if ( self != NULL )
+    {
+        uint32_t len = VectorLength( &(self->list) );
+        rc = 0;
+        if ( len > 0 )
+        {
+            uint32_t m_idx;
+            for ( m_idx = 0; m_idx < len && rc == 0; ++m_idx )
+            {
+                p_module a_module = VectorGet ( &(self->list), m_idx );
+                if ( a_module != NULL && a_module->f_post_rows != NULL )
+                {
+                    rc = a_module->f_post_rows( a_module );
+                }
+            }
+        }
+    }
+    return rc;
+}
+
+
+rc_t mod_list_count( p_mod_list self, uint32_t * count )
+{
+    rc_t rc = RC( rcExe, rcData, rcAllocating, rcParam, rcNull );
+    if ( self != NULL && count != NULL )
+    {
+        *count = VectorLength( &(self->list) );
+        rc = 0;
+    }
+    return rc;
+}
+
+
+static p_module mod_list_get( p_mod_list self, const uint32_t idx )
+{
+    p_module res = NULL;
+    if ( self != NULL )
+    {
+        if ( idx < VectorLength( &(self->list) ) )
+            res = VectorGet ( &(self->list), idx );
+    }
+    return res;
+}
+
+
+rc_t mod_list_name( p_mod_list self, const uint32_t idx,
+                    char ** name )
+{
+    rc_t rc = RC( rcExe, rcData, rcAllocating, rcParam, rcNull );
+    if ( self != NULL && name != NULL )
+    {
+        p_module a_module = mod_list_get( self, idx );
+        if ( a_module == NULL )
+            rc = RC( rcExe, rcData, rcAllocating, rcParam, rcInvalid );
+        else
+        {
+            (*name) = string_dup_measure ( a_module->name, NULL );
+            rc = 0;
+        }
+    }
+    return rc;
+}
+
+
+rc_t mod_list_subreport_count( p_mod_list self, const uint32_t idx,
+                               uint32_t * count )
+{
+    rc_t rc = RC( rcExe, rcData, rcAllocating, rcParam, rcNull );
+    if ( self != NULL && count != NULL )
+    {
+        p_module a_module = mod_list_get( self, idx );
+        rc = RC( rcExe, rcData, rcAllocating, rcParam, rcInvalid );
+        if ( a_module != NULL && a_module->f_count != NULL )
+            rc = a_module->f_count( a_module, count );
+    }
+    return rc;
+}
+
+
+rc_t mod_list_subreport_name( p_mod_list self, const uint32_t m_idx,
+                              const uint32_t r_idx, char ** name )
+{
+    rc_t rc = RC( rcExe, rcData, rcAllocating, rcParam, rcNull );
+    if ( self != NULL && name != NULL )
+    {
+        p_module a_module = mod_list_get( self, m_idx );
+        rc = RC( rcExe, rcData, rcAllocating, rcParam, rcInvalid );
+        if ( a_module != NULL && a_module->f_name != NULL )
+            rc = a_module->f_name( a_module, r_idx, name );
+    }
+    return rc;
+}
+
+
+rc_t mod_list_subreport( p_mod_list self,
+                         const uint32_t m_idx,
+                         const uint32_t r_idx,
+                         p_char_buffer dst,
+                         const uint32_t mode )
+{
+    rc_t rc = RC( rcExe, rcData, rcAllocating, rcParam, rcNull );
+    if ( self != NULL && dst != NULL )
+    {
+        p_module a_module = mod_list_get( self, m_idx );
+        rc = RC( rcExe, rcData, rcAllocating, rcParam, rcInvalid );
+        if ( a_module != NULL && a_module->f_report != NULL )
+        {
+            p_report report;
+            rc = report_init( &report, 50 );
+            if ( rc == 0 )
+            {
+                rc = a_module->f_report( a_module, report, r_idx );
+                if ( rc == 0 )
+                    rc = report_print( report, dst, mode );
+                report_destroy( report );
+            }
+        }
+    }
+    return rc;
+}
+
+
+rc_t mod_list_graph( p_mod_list self, const uint32_t m_idx,
+                     const uint32_t r_idx, const char * filename )
+{
+    rc_t rc = RC( rcExe, rcData, rcAllocating, rcParam, rcNull );
+    if ( self != NULL && filename != NULL )
+    {
+        p_module a_module = mod_list_get( self, m_idx );
+        rc = RC( rcExe, rcData, rcAllocating, rcParam, rcInvalid );
+        if ( a_module != NULL && a_module->f_graph != NULL )
+            rc = a_module->f_graph( a_module, r_idx, filename );
+    }
+    return rc;
+}
+
+
+rc_t mod_list_row( p_mod_list self, const VCursor * cur )
+{
+    rc_t rc = 0;
+    uint32_t len = VectorLength( &(self->list) );
+    if ( len > 0 )
+    {
+        uint32_t m_idx;
+        for ( m_idx = 0; m_idx < len && rc == 0; ++m_idx )
+        {
+            p_module a_module = VectorGet ( &(self->list), m_idx );
+            if ( a_module != NULL && a_module->f_row != NULL )
+            {
+                rc = a_module->f_row( a_module, cur );
+            }
+        }
+    }
+    return rc;
+}
diff --git a/tools/run-stat/mod_cmn.h b/tools/run-stat/mod_cmn.h
new file mode 100644
index 0000000..9d8559c
--- /dev/null
+++ b/tools/run-stat/mod_cmn.h
@@ -0,0 +1,149 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_stat_mod_cmn_
+#define _h_stat_mod_cmn_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+#include <klib/rc.h>
+#include <klib/vector.h>
+#include <klib/namelist.h>
+#include <vdb/cursor.h>
+#include "helper.h"
+#include "key_value.h"
+
+struct module;
+
+/* the type of the callback-function to called before the cursor is open */
+typedef rc_t ( CC * mod_pre_open ) ( struct module * self,
+                                     const VCursor * cur );
+
+/* the type of the callback-function to be performed on every row */
+typedef rc_t ( CC * mod_row ) ( struct module * self,
+                                const VCursor * cur );
+
+/* the type of the callback-function to be performed on after all rows are read */
+typedef rc_t ( CC * mod_post_rows ) ( struct module * self );
+
+
+/* the type of the callback-function to query how many sub-reports
+   a statistic-module can produce */
+typedef rc_t ( CC * mod_query_report_count ) ( struct module * self,
+                                               uint32_t * count );
+
+/* the type of the callback-function to query the name of one
+   of the sub-reports */
+typedef rc_t ( CC * mod_query_report_name ) ( struct module * self,
+                                              uint32_t n, char ** name );
+
+/* the type of the callback-function to produce a sub-report */
+typedef rc_t ( CC * mod_report ) ( struct module * self,
+                                   p_report report,
+                                   const uint32_t sub_select );
+
+/* the type of the callback-function to produce a grafic-file */
+typedef rc_t ( CC * mod_graph ) ( struct module * self,
+                                  uint32_t n, const char * filename );
+
+
+/* the type of the callback-function to be performed free the module-context */
+typedef rc_t ( CC * mod_free ) ( struct module * self );
+
+
+/********************************************************************
+this structure represents a statistic-module
+********************************************************************/
+typedef struct module
+{
+    char *name;             /* every module puts its name in here */
+    void * mod_ctx;         /* every module puts its module-context here */
+    bool active;            /* if the module can be used (all necessary columns found)*/
+
+    mod_pre_open f_pre_open; /* request the uses columns etc. */
+
+    mod_row  f_row;         /* called for every row */
+
+    mod_post_rows f_post_rows; /* called after all rows are read */
+
+    mod_query_report_count f_count;
+                            /* how many reports does the module produce */
+
+    mod_query_report_name  f_name;
+                            /* name of a report */
+
+    mod_report f_report;    /* create a sub-report */
+
+    mod_graph f_graph;      /* create a grafic for a sub-report */
+
+    mod_free f_free;        /* called to free the context */
+} module;
+typedef module* p_module;
+
+
+typedef struct mod_list
+{
+    Vector list;         /* the list of modules... */
+} mod_list;
+typedef mod_list* p_mod_list;
+
+
+rc_t mod_list_init( p_mod_list * self, const KNamelist * names );
+
+rc_t mod_list_destroy( p_mod_list self );
+
+rc_t mod_list_pre_open( p_mod_list self, const VCursor * cur );
+
+rc_t mod_list_row( p_mod_list self, const VCursor * cur );
+
+rc_t mod_list_post_rows( p_mod_list self );
+
+rc_t mod_list_count( p_mod_list self, uint32_t * count );
+
+rc_t mod_list_name( p_mod_list self, const uint32_t idx,
+                    char ** name );
+
+rc_t mod_list_subreport_count( p_mod_list self, const uint32_t idx,
+                               uint32_t * count );
+
+rc_t mod_list_subreport_name( p_mod_list self, const uint32_t m_idx,
+                              const uint32_t r_idx, char ** name );
+
+rc_t mod_list_subreport( p_mod_list self,
+                         const uint32_t m_idx,
+                         const uint32_t r_idx,
+                         p_char_buffer dst,
+                         const uint32_t mode );
+
+rc_t mod_list_graph( p_mod_list self, const uint32_t m_idx,
+                        const uint32_t r_idx, const char * filename );
+
+#endif
diff --git a/tools/run-stat/mod_reads.c b/tools/run-stat/mod_reads.c
new file mode 100644
index 0000000..ef1db56
--- /dev/null
+++ b/tools/run-stat/mod_reads.c
@@ -0,0 +1,747 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <sysalloc.h>
+#include <stdlib.h>
+
+#include "key_value.h"
+#include "mod_cmn.h"
+#include "mod_reads.h"
+#include "mod_reads_defs.h"
+#include "mod_reads_helper.h"
+#include "helper.h"
+#include "chart.h"
+
+
+/* this is called for every single row in a table */
+static rc_t CC mod_reads_row ( p_module self,
+                               const VCursor * cur )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( self != NULL && cur != NULL )
+    {
+        if ( self->mod_ctx != NULL )
+        {
+            p_reads_data data = ( p_reads_data )self->mod_ctx;
+            /* in here we read the data (bases/quality and read-start/len)... */
+            rc = rd_filter_read( &data->filter, cur );
+            if ( rc == 0 )
+            {
+                uint32_t base_pos;
+                uint32_t read_len = filter_get_read_len( &data->filter );
+                uint16_t kmer = 0;
+
+                /* count the number of READS/SEQUENCES */
+                data->sum_reads++;
+
+                /* count the bases total and per sequence-position */
+                for ( base_pos = 0; base_pos < read_len; ++base_pos )
+                {
+                    char base = filter_get_base( &data->filter, base_pos );
+                    uint8_t qual = filter_get_quality( &data->filter, base_pos );
+                    uint8_t compressed_base_pos = compress_base_pos( base_pos );
+
+                    /* clip the quality to fit between MIN(2) and MAX(40) */
+                    if ( qual < MIN_QUALITY ) qual = MIN_QUALITY;
+                    if ( qual > MAX_QUALITY ) qual = MAX_QUALITY;
+
+                    /* count the base-postion-related base-data */
+                    count_base( &data->bp_data[ compressed_base_pos ], base, qual );
+
+                    /* count the total base-data */
+                    count_base( &data->total, base, qual );
+
+                    /* handle the kmer's */
+                    kmer = count_kmer( data, kmer, compressed_base_pos, base );
+
+                    /* detect min. and max. quality */
+                    if ( qual < data->min_quality )
+                        data->min_quality = qual;
+                    if ( qual > data->max_quality )
+                        data->max_quality = qual;
+                }
+
+                /* detect min. and max. read-len */
+                if ( read_len < data->min_read_len )
+                    data->min_read_len = read_len;
+                if ( read_len > data->max_read_len )
+                    data->max_read_len = read_len;
+
+                /* count how often a particular read-len occurs */
+                data->bp_data[ compress_base_pos( read_len ) ].read_count++;
+            }
+        }
+    }
+    return rc;
+}
+
+
+/* this is called once, after all rows are handled */
+static rc_t CC mod_reads_post_rows ( p_module self )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( self != NULL && self->mod_ctx != NULL )
+    {
+        p_reads_data data = self->mod_ctx; 
+        p_base_pos bp;
+        uint32_t base_pos;
+
+        /* first we calculate for every base-position:
+           for quality: mean/median/quarat/centile
+           for bases  : percentage */
+        for ( base_pos = 0; base_pos < MAX_COMPRESSED_BASE_POS; ++base_pos )
+        {
+            bp = &data->bp_data[ base_pos ];
+            calculate_quality_mean_median_quart_centile( bp );
+            calculate_bases_percentage( bp );
+        }
+
+        /* then we calculate for the sum:
+           for quality: mean/median/quarat/centile
+           for bases  : percentage and probability 
+           for kmers  : observed vs. expected occurance */
+        bp = &data->total;
+        calculate_quality_mean_median_quart_centile( bp );
+        calculate_bases_percentage( bp );
+        calculate_base_probability( data );
+        calculate_kmer_observed_vs_expected( data );
+
+        data->mean_read_len = bp->count;
+        data->mean_read_len /= data->sum_reads;
+
+        rc = 0;
+    }
+    return rc;
+}
+
+
+static rc_t print_totals( p_reads_data data, p_report report )
+{
+    uint8_t i;
+    p_base_pos bp = &( data->total );
+
+    rc_t rc = report_set_columns( report, 21, 
+        "bases", "reads", "mean_readlen", "min_readlen", "max_readlen", 
+        "GC", "GC_percent", "A", "A_percent", "C", "C_percent", 
+        "G", "G_percent", "T", "T_percent", "N", "N_percent",
+        "mean_quality", "median_quality", "min_quality", "max_quality" );
+
+    if ( rc == 0 )
+        rc = report_new_data( report );
+
+    if ( rc == 0 )
+        rc = report_add_data( report, 20, "%lu", bp->count );
+    if ( rc == 0 )
+        rc = report_add_data( report, 20, "%lu", data->sum_reads );
+    if ( rc == 0 )
+        rc = report_add_data( report, 20, "%.2f", data->mean_read_len );
+    if ( rc == 0 )
+        rc = report_add_data( report, 20, "%lu", data->min_read_len );
+    if ( rc == 0 )
+        rc = report_add_data( report, 20, "%lu", data->max_read_len );
+
+    if ( rc == 0 )
+        rc = report_add_data( report, 40, "%lu", 
+                    bp->base_sum[ IDX_G ] + bp->base_sum[ IDX_C ] );
+    if ( rc == 0 )
+        rc = report_add_data( report, 40, "%.2f", 
+                    bp->base_percent[ IDX_G ] + bp->base_percent[ IDX_C ] );
+
+    for ( i = IDX_A; i <= IDX_N && rc == 0 ; ++i )
+    {
+        rc = report_add_data( report, 20, "%lu", bp->base_sum[ i ] );
+        if ( rc == 0 )
+            rc = report_add_data( report, 20, "%.2f", bp->base_percent[ i ] );
+    }
+
+    if ( rc == 0 )
+        rc = report_add_data( report, 20, "%.2f", bp->mean );
+    if ( rc == 0 )
+        rc = report_add_data( report, 20, "%.2f", bp->median );
+    if ( rc == 0 )
+        rc = report_add_data( report, 20, "%u", data->min_quality );
+    if ( rc == 0 )
+        rc = report_add_data( report, 20, "%u", data->max_quality );
+
+    return rc;
+}
+
+
+static rc_t print_pos_bases( p_reads_data data, p_report report )
+{
+    rc_t rc = report_set_columns( report, 8, "from", "to", "A", "C", "G", "T", "N", "reads" );
+    if ( rc == 0 )
+    {
+        uint8_t i, max_i = compress_base_pos( data->max_read_len );
+        for ( i = 0; i <= max_i && rc == 0 ; ++i )
+        {
+            uint8_t j;
+            p_base_pos bp = &data->bp_data[ i ];
+            uint32_t to = bp->to;
+            if ( to > MAX_BASE_POS ) to = MAX_BASE_POS;
+
+            if ( rc == 0 )
+                rc = report_new_data( report );
+            if ( rc == 0 )
+                rc = report_add_data( report, 20, "%u", bp->from );
+            if ( rc == 0 )
+                rc = report_add_data( report, 20, "%u", to );
+
+            for ( j = IDX_A; j <= IDX_N && rc == 0; ++j )
+                rc = report_add_data( report, 20, "%.1f", bp->base_percent[ j ] );
+
+            if ( rc == 0 )
+                rc = report_add_data( report, 20, "%u", bp->read_count );
+        }
+    }
+    return rc;
+}
+
+
+static void prepare_hruler( uint32_t * pp, uint32_t n, uint32_t spread )
+{
+    uint8_t idx;
+    for ( idx = 0; idx < n; ++idx )
+        pp[ idx ] = compress_start_lookup( idx * spread );
+}
+
+
+static void prepare_pos_bases_line( p_reads_data data, uint32_t * pp, 
+                                    uint32_t select )
+{
+    uint8_t i;
+    for ( i = 0; i <= MAX_COMPRESSED_BASE_POS; ++i )
+    {
+        p_base_pos bp = &data->bp_data[ i ];
+        double value;
+        if ( select <= IDX_N )
+            value = bp->base_percent[ select ];
+        else
+            value = bp->base_percent[ IDX_C ] + bp->base_percent[ IDX_G ];
+        if ( value > 60 )
+            value = 0;
+        pp[ i ] = ( value * 10 );
+    }
+}
+
+
+static rc_t graph_pos_bases( p_reads_data data, const char * filename )
+{
+    chart c;
+    rc_t rc = chart_init( &c, 100, 100, 600, 500 );
+    if ( rc == 0 )
+    {
+        double factor = 0.7;
+        uint32_t pp[ MAX_COMPRESSED_BASE_POS + 1 ];
+        uint8_t max_i = compress_base_pos( data->max_read_len );
+        uint32_t h_spread = 600 / max_i;
+
+        chart_captions( &c, "bases per position", "base-pos", "%" );
+        chart_vruler( &c, 0, 60, factor * 10, 10, "%" );
+        prepare_hruler( pp, max_i / 2, 2 );
+        chart_hruler( &c, pp, max_i / 2, 0, h_spread * 2 );
+
+        prepare_pos_bases_line( data, pp, IDX_A );
+        chart_line( &c, pp, max_i, factor, h_spread, "red", "A" );
+
+        prepare_pos_bases_line( data, pp, IDX_C );
+        chart_line( &c, pp, max_i, factor, h_spread, "green", "C" );
+
+        prepare_pos_bases_line( data, pp, IDX_G );
+        chart_line( &c, pp, max_i, factor, h_spread, "blue", "G" );
+
+        prepare_pos_bases_line( data, pp, IDX_T );
+        chart_line( &c, pp, max_i, factor, h_spread, "yellow", "T" );
+
+        prepare_pos_bases_line( data, pp, IDX_N );
+        chart_line( &c, pp, max_i, factor, h_spread, "orange", "N" );
+
+        prepare_pos_bases_line( data, pp, 5 );
+        chart_line( &c, pp, max_i, factor, h_spread, "pink", "GC" );
+
+        rc = chart_write( &c, filename );
+        chart_destroy( &c );
+    }
+    return rc;
+}
+
+
+static rc_t graph_pos_quality( p_reads_data data, const char * filename )
+{
+    chart c;
+    rc_t rc = chart_init( &c, 100, 100, 600, 500 );
+    if ( rc == 0 )
+    {
+        char * box_style = create_fill_style( &c, "black", "yellow", 1 );
+        if ( box_style != NULL )
+        {
+            char * median_style = create_line_style( &c, "red", 4 );
+            if ( median_style != NULL )
+            {
+                uint32_t i;
+                uint32_t pp[ MAX_COMPRESSED_BASE_POS + 1 ];
+                uint8_t max_i = compress_base_pos( data->max_read_len );
+                uint32_t h_spread = ( 600 - 10 ) / max_i;
+
+                chart_captions( &c, "quality per position", "base-pos", "phred" );
+                chart_vruler( &c, 0, MAX_QUALITY, 10.0, 5, NULL );
+                prepare_hruler( pp, ( max_i / 2 ) + 1, 2 );
+                chart_hruler( &c, pp, ( max_i / 2 ) + 1, 
+                              5 + ( h_spread / 2 ), h_spread * 2 );
+                for ( i = 0; i <= max_i; ++i )
+                {
+                    p_base_pos bp = &data->bp_data[ i ];
+                    chart_box_whisker( &c,
+                               5 + ( i * h_spread ) + 2, /* x */
+                               h_spread - 2,         /* dx */
+                               bp->lower_centile,    /* p_low */
+                               bp->upper_centile,    /* p_high */
+                               bp->lower_quart,      /* q_low */
+                               bp->upper_quart,      /* q_high */
+                               bp->median,           /* median */
+                               10.0,                 /* factor */
+                               &( box_style[1] ),
+                               &( median_style[1] ) );
+                }
+                rc = chart_write( &c, filename );
+                free( median_style );
+            }
+            free( box_style );
+        }
+        chart_destroy( &c );
+    }
+    return rc;
+}
+
+
+static rc_t print_pos_quality( p_reads_data data, p_report report )
+{
+    rc_t rc = report_set_columns( report, 10, "from", "to", "mean", "median",
+                "mode", "q-up", "q-low", "c-up", "c-low", "reads" );
+    if ( rc == 0 )
+    {
+        uint8_t i, max_i = compress_base_pos( data->max_read_len );
+        for ( i = 0; i <= max_i && rc == 0 ; ++i )
+        {
+            p_base_pos bp = &data->bp_data[ i ];
+            uint32_t to = bp->to;
+            if ( to > MAX_BASE_POS ) to = MAX_BASE_POS;
+
+            if ( rc == 0 )
+                rc = report_new_data( report );
+            if ( rc == 0 )
+                rc = report_add_data( report, 20, "%u", bp->from );
+            if ( rc == 0 )
+                rc = report_add_data( report, 20, "%u", to );
+            if ( rc == 0 )
+                rc = report_add_data( report, 20, "%.2f", bp->mean );
+            if ( rc == 0 )
+                rc = report_add_data( report, 20, "%.2f", bp->median );
+            if ( rc == 0 )
+                rc = report_add_data( report, 20, "%.2f", bp->mode );
+            if ( rc == 0 )
+                rc = report_add_data( report, 20, "%.2f", bp->upper_quart );
+            if ( rc == 0 )
+                rc = report_add_data( report, 20, "%.2f", bp->lower_quart );
+            if ( rc == 0 )
+                rc = report_add_data( report, 20, "%.2f", bp->upper_centile );
+            if ( rc == 0 )
+                rc = report_add_data( report, 20, "%.2f", bp->lower_centile );
+            if ( rc == 0 )
+                rc = report_add_data( report, 20, "%u", bp->count );
+        }
+    }
+    return rc;
+}
+
+
+static uint64_t max_count_of_read_length( p_reads_data data )
+{
+    uint32_t res = 0;
+    uint8_t i;
+    for ( i = 0; i <= MAX_COMPRESSED_BASE_POS; ++i )
+    {
+        p_base_pos bp = &data->bp_data[ i ];
+        if ( bp->read_count > res )
+            res = bp->read_count;
+    }
+    return res;
+}
+
+
+static rc_t graph_read_length( p_reads_data data, const char * filename )
+{
+    chart c;
+    rc_t rc = chart_init( &c, 100, 100, 600, 500 );
+    if ( rc == 0 )
+    {
+        double factor;
+        uint8_t i;
+        uint32_t pp[ MAX_COMPRESSED_BASE_POS + 1 ];
+        uint32_t h_spread = 12;
+        uint64_t max_value = max_count_of_read_length( data );
+
+        chart_captions( &c, "distribution of read-length", "read-length", "count" );
+        factor = max_value;
+        factor /= 450;
+
+        /*               max_y, step_y, max_value */
+        chart_vruler1( &c, 450, 50, max_value, NULL );
+        prepare_hruler( pp, ( MAX_COMPRESSED_BASE_POS + 1 ) / 2, 2 );
+        chart_hruler( &c, pp, ( MAX_COMPRESSED_BASE_POS + 1 ) / 2,
+                      0, h_spread * 2 );
+
+        /* prepare the one and only line to draw */
+        for ( i = 0; i <= MAX_COMPRESSED_BASE_POS; ++i )
+        {
+            p_base_pos bp = &data->bp_data[ i ];
+            uint64_t value = bp->read_count;
+            value *= 450;
+            value /= max_value;
+            pp[ i ] = (uint32_t) value;
+        }
+        chart_line( &c, pp, MAX_COMPRESSED_BASE_POS + 1, 1.0, 
+                    h_spread, "blue", "read-length" );
+
+        rc = chart_write( &c, filename );
+        chart_destroy( &c );
+    }
+    return rc;
+}
+
+
+static rc_t print_read_length( p_reads_data data, p_report report )
+{
+    uint8_t i;
+    rc_t rc = report_set_columns( report, 3, "from", "to", "reads" );
+    if ( rc == 0 )
+    {
+        for ( i = 0; i <= MAX_COMPRESSED_BASE_POS && rc == 0 ; ++i )
+        {
+            p_base_pos bp = &data->bp_data[ i ];
+            uint32_t to = bp->to;
+            if ( to > MAX_BASE_POS ) to = MAX_BASE_POS;
+            if ( rc == 0 )
+                rc = report_new_data( report );
+            if ( rc == 0 )
+                rc = report_add_data( report, 20, "%u", bp->from );
+            if ( rc == 0 )
+                rc = report_add_data( report, 20, "%u", to );
+            if ( rc == 0 )
+                rc = report_add_data( report, 20, "%u", bp->read_count );
+        }
+    }
+    return rc;
+}
+
+
+static uint64_t max_count_of_quality( p_reads_data data )
+{
+    uint32_t res = 0;
+    uint8_t i;
+    for ( i = 0; i <= 40; ++i )
+    {
+        if ( data->total.qual[ i ] > res )
+            res = data->total.qual[ i ];
+    }
+    return res;
+}
+
+
+static rc_t graph_qual_distr( p_reads_data data, const char * filename )
+{
+    chart c;
+    rc_t rc = chart_init( &c, 100, 100, 600, 500 );
+    if ( rc == 0 )
+    {
+        double factor;
+        uint8_t i;
+        uint32_t pp[ 42 ];
+        uint32_t h_spread = 12;
+        uint32_t max_value = max_count_of_quality( data );
+
+        chart_captions( &c, "distribution of quality", "quality", "count" );
+        factor = max_value;
+        factor /= 450;
+
+        /*               max_y, step_y, max_value */
+        chart_vruler1( &c, 450, 50, max_value, NULL );
+        for ( i = 0; i <= 21; ++i )
+            pp[ i ] = i * 2;
+        chart_hruler( &c, pp, 21, 0, h_spread * 2 );
+
+        /* prepare the one and only line to draw */
+        for ( i = 0; i <= 41; ++i )
+        {
+            uint64_t value = data->total.qual[ i ];
+            value *= 450;
+            value /= max_value;
+            pp[ i ] = (uint32_t) value;
+        }
+        chart_line( &c, pp, 41, 1.0, h_spread, "blue", "count of quality" );
+
+        rc = chart_write( &c, filename );
+        chart_destroy( &c );
+    }
+    return rc;
+}
+
+
+static rc_t print_qual_distr( p_reads_data data, p_report report )
+{
+    uint8_t i;
+    rc_t rc = report_set_columns( report, 2, "quality_value", "count" );
+    if ( rc == 0 )
+    {
+        for ( i = 0; i < 41 && rc == 0 ; ++i )
+        {
+            rc = report_new_data( report );
+            if ( rc == 0 )
+                rc = report_add_data( report, 20, "%u", i );
+            if ( rc == 0 )
+                rc = report_add_data( report, 20, "%u", data->total.qual[ i ] );
+        }
+    }
+    return rc;
+}
+
+
+static rc_t print_kmers( p_reads_data data, p_report report )
+{
+    uint16_t i;
+    rc_t rc = report_set_columns( report, 7, 
+        "sequence", "count", "probability", "expected", 
+        "observed-vs-expected",  "max-obs-vs-exp", "at" );
+    if ( rc == 0 )
+    {
+        for ( i = 0; i < NKMER5 && rc == 0 ; ++i )
+        {
+            uint16_t idx = data->kmer5_idx[ i ];
+            p_kmer5_count k = &( data->kmer5[ idx ] );
+
+            rc = report_new_data( report );
+            if ( rc == 0 )
+            {
+                char s[ 6 ];
+                kmer_int_2_ascii( idx, s );
+                rc = report_add_data( report, 10, "%s", s );
+            }
+            if ( rc == 0 )
+                rc = report_add_data( report, 20, "%lu", k->total_count );
+            if ( rc == 0 )
+                rc = report_add_data( report, 20, "%f", k->probability );
+            if ( rc == 0 )
+                rc = report_add_data( report, 20, "%.0f", k->expected );
+            if ( rc == 0 )
+                rc = report_add_data( report, 20, "%f", k->observed_vs_expected );
+            if ( rc == 0 )
+                rc = report_add_data( report, 20, "%f", k->max_bp_obs_vs_exp );
+            if ( rc == 0 )
+            {
+                uint32_t from, to;
+                from = compress_start_lookup( k->max_bp_obs_vs_exp_at );
+                to   = compress_end_lookup( k->max_bp_obs_vs_exp_at );
+                if ( from == to )
+                    rc = report_add_data( report, 20, "%d", from );
+                else
+                    rc = report_add_data( report, 20, "%d .. %d", from, to );
+            }
+        }
+    }
+    return rc;
+}
+
+
+static rc_t CC mod_reads_free ( p_module self )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( self != NULL )
+    {
+        if ( self->mod_ctx != NULL )
+        {
+            p_reads_data data = self->mod_ctx; 
+            rd_filter_destroy( &data->filter );
+            free( self->mod_ctx );
+        }
+        rc = 0;
+    }
+    return rc;
+}
+
+
+static rc_t analyze_param( p_reads_data data, const char * param )
+{
+    const KNamelist *plist;
+    rc_t rc = helper_make_namelist_from_string( &plist, param, '/' );
+    if ( rc ==  0 )
+    {
+        uint32_t count;
+        rc = KNamelistCount( plist, &count );
+        if ( rc == 0 )
+        {
+            uint32_t i;
+            for ( i = 0; i < count && rc == 0; ++i )
+            {
+                const char * s;
+                rc = KNamelistGet( plist, i, &s );
+                if ( rc == 0 )
+                {
+                    if ( helper_str_cmp( s, "bio" ) == 0 )
+                        data->bio = true;
+                    else if ( helper_str_cmp( s, "trim" ) == 0 )
+                        data->trim = true;
+                    else if ( helper_str_cmp( s, "cut" ) == 0 )
+                        data->cut = true;
+                }
+            }
+        }
+        KNamelistRelease( plist );
+    }
+    return rc;
+}
+
+
+static rc_t CC mod_reads_count( p_module self, uint32_t * count )
+{
+    *count = 6;
+    return 0;
+}
+
+
+static rc_t CC mod_reads_name( p_module self, uint32_t n, char ** name )
+{
+    switch ( n )
+    {
+        case 0 : *name = string_dup_measure ( "global", NULL ); break;
+        case 1 : *name = string_dup_measure ( "bases", NULL ); break;
+        case 2 : *name = string_dup_measure ( "quality", NULL ); break;
+        case 3 : *name = string_dup_measure ( "readlength", NULL ); break;
+        case 4 : *name = string_dup_measure ( "qual_dist", NULL ); break;
+        case 5 : *name = string_dup_measure ( "k_mer", NULL ); break;
+        default : *name = string_dup_measure ( "unknown", NULL ); break;
+    }
+    return 0;
+}
+
+
+static rc_t CC mod_reads_report( p_module self, 
+                                 p_report report,
+                                 const uint32_t sub_select )
+{
+    rc_t rc = RC( rcExe, rcData, rcAllocating, rcParam, rcInvalid );
+    p_reads_data data = (p_reads_data)self->mod_ctx;
+    if ( data != NULL && report != NULL )
+    {
+        switch( sub_select )
+        {
+            case 0 : rc = print_totals( data, report ); break;
+            case 1 : rc = print_pos_bases( data, report ); break;
+            case 2 : rc = print_pos_quality( data, report ); break;
+            case 3 : rc = print_read_length( data, report ); break;
+            case 4 : rc = print_qual_distr( data, report ); break;
+            case 5 : rc = print_kmers( data, report ); break;
+        }
+    }
+    return rc;
+}
+
+
+static rc_t CC mod_reads_graph( p_module self, uint32_t n, const char * filename )
+{
+    rc_t rc = RC( rcExe, rcData, rcAllocating, rcParam, rcUnsupported );
+    p_reads_data data = (p_reads_data)self->mod_ctx;
+    switch( n )
+    {
+        case 1 : rc = graph_pos_bases( data, filename ); break;
+        case 2 : rc = graph_pos_quality( data, filename ); break;
+        case 3 : rc = graph_read_length( data, filename ); break;
+        case 4 : rc = graph_qual_distr( data, filename ); break;
+    }
+    return rc;
+}
+
+
+static rc_t CC mod_reads_pre_open( p_module self, const VCursor * cur )
+{
+    rc_t rc = RC( rcExe, rcData, rcAllocating, rcParam, rcNull );
+    if ( self != NULL && cur != NULL )
+    {
+        p_reads_data data = self->mod_ctx;
+        rc = rd_filter_pre_open( &data->filter, cur );
+    }
+    return rc;
+}
+
+
+rc_t mod_reads_init( p_module self, const char * param )
+{
+    rc_t rc = 0;
+
+    /* put in it's name */
+    self->name = string_dup_measure ( "bases", NULL );
+
+    /* connect the callback-functions */
+    self->f_pre_open = mod_reads_pre_open;
+    self->f_row    = mod_reads_row;
+    self->f_post_rows = mod_reads_post_rows;
+    self->f_count  = mod_reads_count;
+    self->f_name   = mod_reads_name;
+    self->f_report = mod_reads_report;
+    self->f_graph  = mod_reads_graph;
+    self->f_free   = mod_reads_free;
+
+    /* initialize the module context */
+    self->mod_ctx  = calloc( 1, sizeof( struct reads_data ) );
+    if ( self->mod_ctx == NULL )
+    {
+        rc = RC( rcExe, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+    }
+    else
+    {
+        p_reads_data data = self->mod_ctx;
+        /* this is done in 2 steps to work on 32-bit-compilers too
+           ( no 64-bit literals in 32-bit-compilers ) */
+        data->min_read_len = 0xFFFFFFFF;
+        data->min_read_len <<= 32;
+        data->min_read_len |= 0xFFFFFFFF;
+        data->min_quality = 0xFF;
+        setup_bp_array( data->bp_data, MAX_COMPRESSED_BASE_POS );
+
+        rc = rd_filter_init( &data->filter );
+        if ( rc == 0 && param != NULL )
+            rc = analyze_param( data, param );
+        if ( rc == 0 )
+            rc = rd_filter_set_flags( &data->filter, data->bio, data->trim, data->cut );
+        if ( rc == 0 )
+        {
+            if ( param != NULL )
+                OUTMSG(( "module 'bases' initialized (%s)\n", param ));
+            else
+                OUTMSG(( "module 'bases' initialized\n" ));
+        }
+    }
+    return rc;
+}
diff --git a/tools/run-stat/mod_reads.h b/tools/run-stat/mod_reads.h
new file mode 100644
index 0000000..4dec794
--- /dev/null
+++ b/tools/run-stat/mod_reads.h
@@ -0,0 +1,42 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_stat_mod_reads_
+#define _h_stat_mod_reads_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+#include <klib/rc.h>
+
+rc_t mod_reads_init( p_module self, const char *param );
+
+
+#endif
diff --git a/tools/run-stat/mod_reads_defs.h b/tools/run-stat/mod_reads_defs.h
new file mode 100644
index 0000000..07e6b74
--- /dev/null
+++ b/tools/run-stat/mod_reads_defs.h
@@ -0,0 +1,128 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_stat_mod_reads_defs_
+#define _h_stat_mod_reads_defs_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+#include "rd_filter.h"
+
+#define MAX_COMPRESSED_BASE_POS 49
+#define MAX_BASE_POS 1899
+
+#define MIN_QUALITY 2
+#define MAX_QUALITY 40
+
+#define IDX_A 0
+#define IDX_C 1
+#define IDX_G 2
+#define IDX_T 3
+#define IDX_N 4
+
+typedef struct base_pos
+{
+    uint32_t from;
+    uint32_t to;
+
+    uint64_t read_count;
+    uint64_t count;
+
+    uint64_t qual[ MAX_QUALITY + 1 ];    /* qual 0...MAX_QUALITY */
+    double mean;
+    double median;
+    uint8_t mode;
+    double upper_quart;
+    double lower_quart;
+    double upper_centile;
+    double lower_centile;
+
+    uint64_t base_sum[ IDX_N + 1 ];
+    double base_percent[ IDX_N + 1 ];
+} base_pos;
+typedef base_pos* p_base_pos;
+
+
+#define NKMER5 1024
+
+
+typedef struct kmer5_count
+{
+    uint64_t count[ MAX_COMPRESSED_BASE_POS + 1 ];
+    double bp_expected[ MAX_COMPRESSED_BASE_POS + 1 ];
+    double bp_obs_vs_exp[ MAX_COMPRESSED_BASE_POS + 1 ];
+    uint64_t total_count;
+    double probability;
+    double expected;
+    double observed_vs_expected;
+    double max_bp_obs_vs_exp;
+    uint16_t max_bp_obs_vs_exp_at;
+} kmer5_count;
+typedef kmer5_count* p_kmer5_count;
+
+
+typedef struct reads_data
+{
+    /* the statistical data to be collected */
+    uint64_t sum_reads;
+    uint64_t min_read_len;
+    uint64_t max_read_len;
+    double mean_read_len;
+
+    uint8_t min_quality;
+    uint8_t max_quality;
+
+    /* for the whole sequence */
+    base_pos total;
+    double base_prob[ IDX_N + 1 ];
+
+    /* for a specific base-position */
+    base_pos bp_data[ MAX_COMPRESSED_BASE_POS + 1 ];
+
+    /* to count the Kmer's */
+    uint64_t bp_total_kmers[ MAX_COMPRESSED_BASE_POS + 1 ];
+    kmer5_count kmer5[ NKMER5 ];
+    uint16_t kmer5_idx[ NKMER5 ];
+    uint64_t total_kmers;
+
+    /* the filtered read-data */
+    rd_filter filter;
+
+    /* flags how to process the data */
+    bool bio;
+    bool trim;
+    bool cut;
+
+} reads_data;
+typedef reads_data* p_reads_data;
+
+
+#endif
diff --git a/tools/run-stat/mod_reads_helper.c b/tools/run-stat/mod_reads_helper.c
new file mode 100644
index 0000000..1a0b756
--- /dev/null
+++ b/tools/run-stat/mod_reads_helper.c
@@ -0,0 +1,575 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <klib/sort.h>
+#include <sysalloc.h>
+#include <stdlib.h>
+#include "mod_reads_defs.h"
+
+uint8_t CompressedBasePos_Lookup[ MAX_BASE_POS + 1 ] =
+{
+   /*        0   1   2   3   4   5   6   7   8   9 */
+   /*  0 */   0,  1,  2,  3,  4,  5,  6,  7,  8,  9,
+   /*  1 */  10, 10, 10, 10, 10, 11, 11, 11, 11, 11,
+   /*  2 */  12, 12, 12, 12, 12, 13, 13, 13, 13, 13,
+   /*  3 */  14, 14, 14, 14, 14, 15, 15, 15, 15, 15,
+   /*  4 */  16, 16, 16, 16, 16, 17, 17, 17, 17, 17,
+   /*  5 */  18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+   /*  6 */  19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+   /*  7 */  20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   /*  8 */  21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+   /*  9 */  22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+   /* 10 */  23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+   /* 11 */  23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+   /* 12 */  23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+   /* 13 */  23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+   /* 14 */  23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+   /* 15 */  24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+   /* 16 */  24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+   /* 17 */  24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+   /* 18 */  24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+   /* 19 */  24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+   /* 20 */  25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+   /* 21 */  25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+   /* 22 */  25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+   /* 23 */  25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+   /* 24 */  25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+   /* 25 */  26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+   /* 26 */  26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+   /* 27 */  26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+   /* 28 */  26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+   /* 29 */  26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+   /* 30 */  27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+   /* 31 */  27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+   /* 32 */  27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+   /* 33 */  27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+   /* 34 */  27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+   /* 35 */  28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+   /* 36 */  28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+   /* 37 */  28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+   /* 38 */  28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+   /* 39 */  28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+   /* 40 */  29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+   /* 41 */  29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+   /* 42 */  29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+   /* 43 */  29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+   /* 44 */  29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+   /* 45 */  30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+   /* 46 */  30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+   /* 47 */  30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+   /* 48 */  30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+   /* 49 */  30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+   /* 50 */  31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
+   /* 51 */  31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
+   /* 52 */  31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
+   /* 53 */  31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
+   /* 54 */  31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
+   /* 55 */  32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+   /* 56 */  32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+   /* 57 */  32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+   /* 58 */  32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+   /* 59 */  32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+   /* 60 */  33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
+   /* 61 */  33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
+   /* 62 */  33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
+   /* 63 */  33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
+   /* 64 */  33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
+   /* 65 */  34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
+   /* 66 */  34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
+   /* 67 */  34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
+   /* 68 */  34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
+   /* 69 */  34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
+   /* 70 */  35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
+   /* 71 */  35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
+   /* 72 */  35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
+   /* 73 */  35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
+   /* 74 */  35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
+   /* 75 */  36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
+   /* 76 */  36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
+   /* 77 */  36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
+   /* 78 */  36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
+   /* 79 */  36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
+   /* 80 */  37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+   /* 81 */  37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+   /* 82 */  37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+   /* 83 */  37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+   /* 84 */  37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+   /* 85 */  38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
+   /* 86 */  38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
+   /* 87 */  38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
+   /* 88 */  38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
+   /* 89 */  38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
+   /* 90 */  39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+   /* 91 */  39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+   /* 92 */  39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+   /* 93 */  39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+   /* 94 */  39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+   /* 95 */  40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+   /* 96 */  40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+   /* 97 */  40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+   /* 98 */  40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+   /* 99 */  40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+   /*100 */  41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
+   /*101 */  41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
+   /*102 */  41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
+   /*103 */  41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
+   /*104 */  41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
+   /*105 */  41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
+   /*106 */  41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
+   /*107 */  41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
+   /*108 */  41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
+   /*109 */  41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
+   /*110 */  42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
+   /*111 */  42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
+   /*112 */  42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
+   /*113 */  42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
+   /*114 */  42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
+   /*115 */  42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
+   /*116 */  42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
+   /*117 */  42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
+   /*118 */  42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
+   /*119 */  42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
+   /*120 */  43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+   /*121 */  43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+   /*122 */  43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+   /*123 */  43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+   /*124 */  43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+   /*125 */  43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+   /*126 */  43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+   /*127 */  43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+   /*128 */  43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+   /*129 */  43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+   /*130 */  44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
+   /*131 */  44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
+   /*132 */  44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
+   /*133 */  44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
+   /*134 */  44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
+   /*135 */  44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
+   /*136 */  44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
+   /*137 */  44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
+   /*138 */  44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
+   /*139 */  44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
+   /*140 */  45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+   /*141 */  45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+   /*142 */  45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+   /*143 */  45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+   /*144 */  45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+   /*145 */  45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+   /*146 */  45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+   /*147 */  45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+   /*148 */  45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+   /*149 */  45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+   /*150 */  46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
+   /*151 */  46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
+   /*152 */  46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
+   /*153 */  46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
+   /*154 */  46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
+   /*155 */  46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
+   /*156 */  46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
+   /*157 */  46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
+   /*158 */  46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
+   /*159 */  46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
+   /*160 */  47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
+   /*161 */  47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
+   /*162 */  47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
+   /*163 */  47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
+   /*164 */  47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
+   /*165 */  47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
+   /*166 */  47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
+   /*167 */  47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
+   /*168 */  47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
+   /*169 */  47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
+   /*170 */  48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
+   /*171 */  48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
+   /*172 */  48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
+   /*173 */  48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
+   /*174 */  48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
+   /*175 */  48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
+   /*176 */  48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
+   /*177 */  48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
+   /*178 */  48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
+   /*179 */  48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
+   /*180 */  49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
+   /*181 */  49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
+   /*182 */  49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
+   /*183 */  49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
+   /*184 */  49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
+   /*185 */  49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
+   /*186 */  49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
+   /*187 */  49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
+   /*188 */  49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
+   /*189 */  49, 49, 49, 49, 49, 49, 49, 49, 49, 49
+};
+
+uint32_t CompressedStart_Lookup[ MAX_COMPRESSED_BASE_POS + 1 ] =
+{
+   /*          0     1     2     3     4     5     6     7     8     9 */
+   /*  0 */    0,    1,    2,    3,    4,    5,    6,    7,    8,    9,
+   /*  1 */   10,   15,   20,   25,   30,   35,   40,   45,   50,   60,
+   /*  2 */   70,   80,   90,  100,  150,  200,  250,  300,  350,  400,
+   /*  3 */  450,  500,  550,  600,  650,  700,  750,  800,  850,  900,
+   /*  4 */  950, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800
+};
+
+uint32_t CompressedEnd_Lookup[ MAX_COMPRESSED_BASE_POS + 1 ] =
+{
+   /*          0     1     2     3     4     5     6     7     8     9 */
+   /*  0 */    0,    1,    2,    3,    4,    5,    6,    7,    8,    9,
+   /*  1 */   14,   19,   24,   29,   34,   39,   44,   49,   59,   69,
+   /*  2 */   79,   89,   99,  149,  199,  249,  299,  349,  399,  449,
+   /*  3 */  499,  549,  599,  649,  699,  749,  799,  849,  899,  949,
+   /*  4 */ 1000, 1099, 1199, 1299, 1399, 1499, 1599, 1699, 1799, 0xFFFFFFFF
+};
+
+uint8_t compress_base_pos( const uint32_t src )
+{
+    if ( src > MAX_BASE_POS )
+        return MAX_COMPRESSED_BASE_POS;
+    else
+        return CompressedBasePos_Lookup[ src ];
+}
+
+uint32_t compress_start_lookup( const uint8_t idx )
+{
+    if ( idx <= MAX_COMPRESSED_BASE_POS )
+        return CompressedStart_Lookup[ idx ];
+    else
+        return CompressedStart_Lookup[ MAX_COMPRESSED_BASE_POS ];
+}
+
+uint32_t compress_end_lookup( const uint8_t idx )
+{
+    if ( idx <= MAX_COMPRESSED_BASE_POS )
+        return CompressedEnd_Lookup[ idx ];
+    else
+        return CompressedEnd_Lookup[ MAX_COMPRESSED_BASE_POS ];
+}
+
+
+static uint8_t Kmer_Ascii_Lookup[ 26 ] =
+{
+   /*  A   B   C   D   E   F   G   H   I   J   K   L   M  */
+       0,  0,  1,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,
+   /*  N   O   P   Q   R   S   T   U   V   W   X   Y   Z */
+       4,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0
+};
+
+uint16_t kmer_ascii_2_int( char * s )
+{
+    uint16_t res = Kmer_Ascii_Lookup[ s[ 0 ] - 'A' ];
+    res <<= 2;
+    res |= Kmer_Ascii_Lookup[ s[ 1 ] - 'A' ];
+    res <<= 2;
+    res |= Kmer_Ascii_Lookup[ s[ 2 ] - 'A' ];
+    res <<= 2;
+    res |= Kmer_Ascii_Lookup[ s[ 3 ] - 'A' ];
+    res <<= 2;
+    res |= Kmer_Ascii_Lookup[ s[ 4 ] - 'A' ];
+    return res;
+}
+
+static char Kmer_int_Lookup[ 4 ] = { 'A', 'C', 'G', 'T' };
+
+void kmer_int_2_ascii( const uint16_t kmer, char * s )
+{
+    uint16_t value = kmer;
+    s[ 5 ] = 0;
+    s[ 4 ] = Kmer_int_Lookup[ value & 3 ];
+    value >>= 2;
+    s[ 3 ] = Kmer_int_Lookup[ value & 3 ];
+    value >>= 2;
+    s[ 2 ] = Kmer_int_Lookup[ value & 3 ];
+    value >>= 2;
+    s[ 1 ] = Kmer_int_Lookup[ value & 3 ];
+    value >>= 2;
+    s[ 0 ] = Kmer_int_Lookup[ value & 3 ];
+}
+
+
+uint16_t kmer_add_base( const uint16_t kmer, const char c )
+{
+    uint16_t res = ( ( kmer << 2 ) & 0x3FC );
+    return ( res | ( Kmer_Ascii_Lookup[ c - 'A' ] & 0x03 ) );
+}
+
+
+static double calc_mean_qual( uint64_t * qual, uint64_t count )
+{
+    uint8_t idx;
+    double sum = 0.0;
+    for ( idx = 1; idx <= MAX_QUALITY; ++ idx )
+    {
+        sum += ( qual[ idx ] * idx );
+    }
+    sum /= count;
+    return sum;
+}
+
+
+static uint8_t get_qual_at_flat_pos( uint64_t * qual, uint64_t flat_pos )
+{
+    uint8_t idx, res = 0;
+    uint64_t pos = 0;
+    bool found = false;
+    for ( idx = 0; idx <= MAX_QUALITY && !found; ++ idx )
+    {
+        found = ( ( pos <= flat_pos )  && ( flat_pos < ( pos + qual[ idx ] ) ) );
+        if ( found )
+            res = idx;
+        else
+            pos += qual[ idx ];
+    }
+    return res;
+}
+
+
+static double calc_median_qual_between( uint64_t * qual, uint64_t from, uint64_t to )
+{
+    double res;
+    uint64_t count = ( to - from );
+    if ( ( count & 1 ) == 0 )
+    {
+        uint64_t median_pos = ( from + ( count >> 1 ) ) - 1; /* even */
+        res = get_qual_at_flat_pos( qual, median_pos );
+        res += get_qual_at_flat_pos( qual, median_pos + 1 );
+        res /= 2;
+    }
+    else
+    {
+        uint64_t median_pos = ( from + ( ( count + 1 ) >> 1 ) ) - 1; /* odd */
+        res = get_qual_at_flat_pos( qual, median_pos );
+    }
+    return res;
+}
+
+
+static double calc_median_qual( uint64_t * qual, uint64_t count )
+{
+    return calc_median_qual_between( qual, 0, count );
+}
+
+
+static uint8_t calc_mode( uint64_t * qual, uint64_t count )
+{
+    uint8_t idx, max = 0, res = 0;
+    for ( idx = 1; idx <= MAX_QUALITY; ++ idx )
+    {
+        if ( max < qual[ idx ] )
+        {
+            max = qual[ idx ];
+            res = idx;
+        }
+    }
+    return res;
+}
+
+
+static double calc_upper_quart( uint64_t * qual, uint64_t count )
+{
+    uint64_t half = count >> 1;
+    return calc_median_qual_between( qual, half, count );
+}
+
+
+static double calc_lower_quart( uint64_t * qual, uint64_t count )
+{
+    uint64_t half = count >> 1;
+    return calc_median_qual_between( qual, 0, half );
+}
+
+
+static double calc_upper_centile( uint64_t * qual, uint64_t count )
+{
+    uint64_t tenth = count / 10;
+    return get_qual_at_flat_pos( qual, count - tenth );
+}
+
+
+static double calc_lower_centile( uint64_t * qual, uint64_t count )
+{
+    uint64_t tenth = count / 10;
+    return get_qual_at_flat_pos( qual, tenth );
+}
+
+
+void setup_bp_array( p_base_pos bp, const uint8_t count )
+{
+    uint8_t i;
+    for ( i = 0; i <= count; ++i )
+    {
+        bp[ i ].from = compress_start_lookup( i );
+        bp[ i ].to   = compress_end_lookup( i );
+    }
+}
+
+
+/* base_prob points to a array of base-probabilities in the order A,C,G,T */
+double kmer_probability( const uint16_t kmer, double * base_prob )
+{
+    double res = 1.0;
+    uint16_t temp = kmer;
+    
+    res *= base_prob[ temp & 3 ];
+    temp >>= 2;
+    res *= base_prob[ temp & 3 ];
+    temp >>= 2;
+    res *= base_prob[ temp & 3 ];
+    temp >>= 2;
+    res *= base_prob[ temp & 3 ];
+    temp >>= 2;
+    res *= base_prob[ temp & 3 ];
+    return res;
+}
+
+
+void count_base( p_base_pos bp, const char base, const uint8_t quality )
+{
+    bp->count++;
+    switch( base )
+    {
+    case 'A' : bp->base_sum[ IDX_A ]++; break;
+    case 'C' : bp->base_sum[ IDX_C ]++; break;
+    case 'G' : bp->base_sum[ IDX_G ]++; break;
+    case 'T' : bp->base_sum[ IDX_T ]++; break;
+    case 'N' : bp->base_sum[ IDX_N ]++; break;
+    }
+    if ( quality <= MAX_QUALITY )
+        bp->qual[ quality ]++;
+    else
+        bp->qual[ MAX_QUALITY ]++;
+}
+
+
+uint16_t count_kmer( p_reads_data data,
+                     const uint16_t kmer,
+                     const uint8_t base_pos, 
+                     const char base )
+{
+    uint16_t res = kmer_add_base( kmer, base );
+    if ( base_pos > 3 )
+    {
+        /* pointer to the conter for this K-mer */
+        p_kmer5_count cnt = &data->kmer5[ res ];
+        /* count how often this K-mer occures at all */
+        cnt->total_count++;
+        /* count how often this K-mer occures at the given base-position */
+        cnt->count[ base_pos ]++;
+        /* count how many K-mers at all we have at this base-position */
+        data->bp_total_kmers[ base_pos ]++;
+    }
+    return res;
+}
+
+
+void calculate_quality_mean_median_quart_centile( p_base_pos bp )
+{
+    bp->mean = calc_mean_qual( bp->qual, bp->count );
+    bp->median = calc_median_qual( bp->qual, bp->count );
+    bp->mode = calc_mode( bp->qual, bp->count );
+    bp->upper_quart = calc_upper_quart( bp->qual, bp->count );
+    bp->lower_quart = calc_lower_quart( bp->qual, bp->count );
+    bp->upper_centile = calc_upper_centile( bp->qual, bp->count );
+    bp->lower_centile = calc_lower_centile( bp->qual, bp->count );
+}
+
+
+void calculate_bases_percentage( p_base_pos bp )
+{
+    uint8_t i;
+    for ( i = IDX_A; i <= IDX_N; ++i )
+        bp->base_percent[ i ] = percent( bp->base_sum[ i ], bp->count );
+}
+
+
+void calculate_base_probability( p_reads_data data )
+{
+    uint8_t i;
+    uint64_t value, total_acgt = 0;
+    for ( i = IDX_A; i <= IDX_T; ++i )
+    {
+        value = data->total.base_sum[ i ];
+        total_acgt += value;
+        data->base_prob[ i ] = value;
+    }
+    /* do not merge the 2 loops, in the first one we calculate total_acgt 
+       int the second loop we use it on every item */
+    for ( i = IDX_A; i <= IDX_T; ++i )
+        data->base_prob[ i ] /= total_acgt;
+}
+
+
+int CC kmer_sort_callback( const void *p1, const void *p2, void * data )
+{
+    p_reads_data rdata = data;
+    int16_t idx1 = *( int16_t * ) p1;
+    int16_t idx2 = *( int16_t * ) p2;
+    p_kmer5_count k1 = &( rdata->kmer5[ idx1 ] );
+    p_kmer5_count k2 = &( rdata->kmer5[ idx2 ] );
+    if ( k1->observed_vs_expected < k2->observed_vs_expected )
+        return 1;
+    if ( k1->observed_vs_expected > k2->observed_vs_expected )
+        return -1;
+    return ( idx1 - idx2 );
+}
+
+
+void calculate_kmer_observed_vs_expected( p_reads_data data )
+{
+    uint16_t idx;
+    for ( idx = 0; idx < NKMER5; ++idx )
+    {
+        data->kmer5[ idx ].probability = kmer_probability( idx, data->base_prob );
+        data->total_kmers += data->kmer5[ idx ].total_count;
+        data->kmer5_idx[ idx ] = idx;
+    }
+    /* do not merge the 2 loops, we need to calculate total_kmers first ! */
+    for ( idx = 0; idx < NKMER5; ++idx )
+    {
+        uint16_t i;
+        p_kmer5_count k = &( data->kmer5[ idx ] );
+
+        k->expected = data->total_kmers;
+        k->expected *= k->probability;
+        k->observed_vs_expected = k->total_count;
+        k->observed_vs_expected /= k->expected;
+        for ( i = 0; i < MAX_COMPRESSED_BASE_POS; ++i )
+        {
+            k->bp_expected[ i ] = data->bp_total_kmers[ i ];
+            k->bp_expected[ i ] *= k->probability;
+            k->bp_obs_vs_exp[ i ] = k->count[ i ];
+            k->bp_obs_vs_exp[ i ] /= k->bp_expected[ i ];
+            if ( k->bp_obs_vs_exp[ i ] > k->max_bp_obs_vs_exp )
+            {
+                k->max_bp_obs_vs_exp = k->bp_obs_vs_exp[ i ];
+                k->max_bp_obs_vs_exp_at = i;
+            }
+        }
+    }
+
+    /* sort the kmer-idx-array by the observed-vs-expected value of the kmer */
+    ksort ( data->kmer5_idx, NKMER5, sizeof( uint16_t ),
+            kmer_sort_callback, data );
+}
diff --git a/tools/run-stat/mod_reads_helper.h b/tools/run-stat/mod_reads_helper.h
new file mode 100644
index 0000000..5b21407
--- /dev/null
+++ b/tools/run-stat/mod_reads_helper.h
@@ -0,0 +1,61 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_stat_mod_reads_helper_
+#define _h_stat_mod_reads_helper_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+#include <klib/rc.h>
+#include "mod_reads_defs.h"
+
+uint8_t compress_base_pos( const uint32_t src );
+uint32_t compress_start_lookup( const uint8_t idx );
+uint32_t compress_end_lookup( const uint8_t idx );
+
+uint16_t kmer_ascii_2_int( char * s );
+void kmer_int_2_ascii( const uint16_t kmer, char * s );
+uint16_t kmer_add_base( const uint16_t kmer, const char c );
+
+void setup_bp_array( p_base_pos bp, const uint8_t count );
+double kmer_probability( const uint16_t kmer, double * base_prob );
+void count_base( p_base_pos bp, const char base, const uint8_t quality );
+uint16_t count_kmer( p_reads_data data,
+                     const uint16_t kmer,
+                     const uint8_t base_pos, 
+                     const char base );
+
+void calculate_quality_mean_median_quart_centile( p_base_pos bp );
+void calculate_bases_percentage( p_base_pos bp );
+void calculate_base_probability( p_reads_data data );
+void calculate_kmer_observed_vs_expected( p_reads_data data );
+
+#endif
diff --git a/tools/run-stat/num-gen.c b/tools/run-stat/num-gen.c
new file mode 100644
index 0000000..adfa016
--- /dev/null
+++ b/tools/run-stat/num-gen.c
@@ -0,0 +1,497 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "num-gen.h"
+
+#include <klib/vector.h>
+#include <klib/log.h>
+#include <klib/rc.h>
+#include <klib/out.h>
+#include <strtol.h>
+#include <sysalloc.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+static void CC ng_node_destroy( void *item, void *data )
+{
+    free( item );
+}
+
+static p_ng_node ng_make_node( const uint64_t start, const uint64_t count )
+{
+    p_ng_node p = ( p_ng_node )malloc( sizeof( ng_node ) );
+    if ( p )
+    {
+        p->start = start;
+        p->count = count;
+    }
+    return p;
+}
+
+
+static int CC ng_insert_helper( const void* item1, const void* item2 )
+{
+    int res = 0;
+    p_ng_node node1 = (p_ng_node)item1;
+    p_ng_node node2 = (p_ng_node)item2;
+    if ( node1->start < node2->start )
+        res = -1;
+    else if ( node1->start > node2->start )
+        res = 1;
+    return res;
+}
+
+
+static bool ng_add_node( p_ng generator, const uint64_t num_1, const uint64_t num_2 )
+{
+    bool res = false;
+
+    if ( generator != NULL )
+    {
+        p_ng_node node;
+        if ( num_1 == num_2 )
+        {
+            node = ng_make_node( num_1, 1 );
+        }
+        else if ( num_1 < num_2 )
+        {
+            node = ng_make_node( num_1, ( num_2 - num_1 ) + 1 );
+        }
+        else
+        {
+            node = ng_make_node( num_2, ( num_1 - num_2 ) + 1 );
+        }
+        if ( node != NULL )
+        {
+            res = ( VectorInsert( &(generator->nodes), node, NULL, ng_insert_helper ) == 0 );
+            if ( res )
+            {
+                generator->node_count++;
+            }
+        }
+    }
+    return res;
+}
+
+
+#define MAX_NUM_STR 12
+/* helper-structure for vdn_parse() */
+typedef struct ng_parse_ctx
+{
+    size_t num_str_idx, num_count;
+    uint64_t num[ 2 ];
+    char num_str[ MAX_NUM_STR + 1 ];
+} ng_parse_ctx;
+typedef ng_parse_ctx* p_ng_parse_ctx;
+
+
+/* helper for ng_parse() */
+static void ng_convert_ctx( p_ng_parse_ctx ctx )
+{
+    char *endp;
+    
+    ctx->num_str[ ctx->num_str_idx ] = 0;
+    ctx->num[ 0 ] = strtou64( ctx->num_str, &endp, 10 );
+    ctx->num_count = 1;
+    ctx->num_str_idx = 0;
+}
+
+
+/* helper for ng_parse() */
+static uint32_t ng_convert_and_add_ctx( p_ng generator, p_ng_parse_ctx ctx )
+{
+    uint32_t res = 0;
+    char *endp;
+    
+    if ( ctx->num_str_idx > 0 )
+    {
+        ctx->num_str[ ctx->num_str_idx ] = 0;
+        ctx->num[ ctx->num_count ] = strtou64( ctx->num_str, &endp, 10 );
+        ctx->num_str_idx = 0;
+        if ( ctx->num_count == 0 )
+        {
+            ctx->num[1] = ctx->num[0];
+        }
+        if ( ng_add_node( generator, ctx->num[0], ctx->num[1] ) )
+        {
+            res++;
+        }
+        ctx->num_count = 0;
+    }
+    return res;
+}
+
+
+uint32_t ng_parse( p_ng generator, const char* src )
+{
+    size_t i, n;
+    ng_parse_ctx ctx;
+    uint32_t res = 0;
+    
+    if ( generator == NULL ) return res;
+    if ( src == NULL ) return res;
+    n = strlen( src );
+    generator->node_count = 0;
+    generator->curr_node = 0;
+    generator->curr_node_sub_pos = 0;
+    if ( n == 0 ) return res;
+
+    ctx.num_str_idx = 0;
+    ctx.num_count = 0;
+    
+    for ( i=0; i<n; ++i )
+    {
+        switch ( src[i] )
+        {
+        /* a dash switches from N1-mode into N2-mode */
+        case '-' :
+            ng_convert_ctx( &ctx );
+            break;
+
+        /* a comma ends a single number or a range */
+        case ',' :
+            res += ng_convert_and_add_ctx( generator, &ctx );
+            break;
+
+        /* in both mode add the char to the temp string */
+        default:
+            if ( ( src[i]>='0' )&&( src[i]<='9' )&&( ctx.num_str_idx < MAX_NUM_STR ) )
+            {
+                ctx.num_str[ ctx.num_str_idx++ ] = src[ i ];
+            }
+            break;
+        }
+    }
+    res += ng_convert_and_add_ctx( generator, &ctx );
+    return res;
+}
+
+
+bool ng_set_range( p_ng generator,
+                   const int64_t first, const uint64_t count )
+{
+    bool res = ( generator != NULL );
+    if ( res )
+    {
+        uint64_t num_1 = first;
+        uint64_t num_2;
+
+        /* this is necessary because virtual columns which have a
+           infinite row-range, get reported with first=1,count=0 */
+        if ( count > 0 )
+        {
+            num_2 = first + count - 1;
+        }
+        else
+        {
+            num_2 = first;
+        }
+        
+        /* clear all nodes so far... */
+        VectorWhack( &(generator->nodes), ng_node_destroy, NULL );
+        /* re-init the vector */
+        VectorInit( &(generator->nodes ), 0, 5 );
+        generator->node_count = 0;
+        generator->curr_node = 0;
+        generator->curr_node_sub_pos = 0;
+
+        res = ng_add_node( generator, num_1, num_2 );
+    }
+    return res;
+}
+
+
+static bool CC ng_check_range_start( p_ng_node the_node, 
+                                     const uint64_t range_start )
+{
+    bool res = true;
+    uint64_t last_node_row = ( the_node->start + the_node->count - 1 );
+    
+    if ( the_node->start < range_start )
+    {
+        the_node->start = range_start;
+        if ( the_node->start <= last_node_row )
+        {
+            the_node->count = ( last_node_row - the_node->start ) + 1;
+        }
+        else
+        {
+            /* the node becomes invalid ... */
+            the_node->start = 0;
+            the_node->count = 0;
+            res = false;
+        }
+    }
+    return res;
+}
+
+
+static void CC ng_check_range_end( p_ng_node the_node, 
+                                   const uint64_t last_tab_row )
+{
+    uint64_t last_node_row = ( the_node->start + the_node->count - 1 );
+
+    if ( last_node_row > last_tab_row )
+    {
+        last_node_row = last_tab_row;
+        if ( the_node->start <= last_node_row )
+        {
+            the_node->count = ( last_node_row - the_node->start ) + 1;
+        }
+        else
+        {
+            /* the node becomes invalid ... */
+            the_node->start = 0;
+            the_node->count = 0;
+        }
+    }
+}
+
+
+static void CC ng_check_range_callback( void *item, void *data )
+{
+    p_ng_node the_node  = ( p_ng_node )item;
+    p_ng_node the_range = ( p_ng_node )data;
+    uint64_t last_tab_row = ( the_range->start + the_range->count - 1 );
+
+    /* check if the start value is not out of range... */
+    if ( ng_check_range_start( the_node, the_range->start ) )
+    {
+        ng_check_range_end( the_node, last_tab_row );
+    }
+}
+
+
+static void CC ng_count_invalid_nodes( void *item, void *data )
+{
+    p_ng_node the_node = ( p_ng_node )item;
+    uint32_t *invalid_count = ( uint32_t * )data;
+    
+    if ( ( the_node->start == 0 )&&( the_node->count == 0 ) )
+        ( *invalid_count )++;
+}
+
+
+static void CC ng_copy_valid_nodes( void *item, void *data )
+{
+    p_ng_node the_node = ( p_ng_node )item;
+    Vector *p_temp_nodes = ( Vector * )data;
+    
+    if ( ( the_node->start != 0 )&&( the_node->count != 0 ) )
+    {
+        p_ng_node new_node = ng_make_node( the_node->start, the_node->count );
+        if ( new_node )
+        {
+            VectorInsert( p_temp_nodes, new_node, NULL, ng_insert_helper );
+        }
+    }
+}
+
+
+static void ng_remove_invalid_nodes( p_ng generator, const uint32_t invalid_nodes )
+{
+    Vector temp_nodes;
+            
+    /* create a temp. vector */
+    VectorInit( &temp_nodes, 0, 5 );
+
+    /* copy all valid nodes into the temp. vector */
+    VectorForEach ( &(generator->nodes), false,
+                    ng_copy_valid_nodes, &temp_nodes );
+
+    /* clear all nodes so far... */
+    VectorWhack( &(generator->nodes), ng_node_destroy, NULL );
+
+    /* re-init the vector */
+    VectorInit( &(generator->nodes ), 0, 5 );
+
+    /* copy (swallow) the valid nodes back into the generator */
+    VectorCopy ( &temp_nodes, &(generator->nodes) );
+
+    /* correct the node count */
+    generator->node_count -= invalid_nodes;
+
+    /* destroy the temp-vector, DO NOT PASS vdn_node_destroy into it */            
+    VectorWhack ( &temp_nodes, NULL, NULL );
+}
+
+
+bool ng_check_range( p_ng generator,
+                     const int64_t first, const uint64_t count )
+{
+    bool res = ( generator != NULL );
+    if ( res )
+    {
+        ng_node defined_range;
+        uint32_t invalid_nodes = 0;
+
+        if ( count > 0 )
+        {
+            /* walk all nodes to check for boundaries... */
+            defined_range.start = first;
+            defined_range.count = count;
+
+            VectorForEach ( &(generator->nodes), false,
+                        ng_check_range_callback, &defined_range );
+
+            VectorForEach ( &(generator->nodes), false,
+                        ng_count_invalid_nodes, &invalid_nodes );
+            if ( invalid_nodes > 0 )
+            {
+                ng_remove_invalid_nodes( generator, invalid_nodes );
+            }
+        }
+    }
+    return res;
+}
+
+
+rc_t ng_make( ng** generator )
+{
+    if ( generator == NULL )
+    {
+        return RC( rcVDB, rcNoTarg, rcConstructing, rcParam, rcNull );
+    }
+    (*generator) = calloc( 1, sizeof( ng ) );
+    if ( *generator == NULL )
+    {
+        return RC( rcVDB, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+    }
+    VectorInit( &((*generator)->nodes ), 0, 5 );
+    return 0;
+}
+
+
+rc_t ng_destroy( p_ng generator )
+{
+    if ( generator == NULL )
+    {
+        return RC( rcVDB, rcNoTarg, rcDestroying, rcParam, rcNull );
+    }
+    VectorWhack( &(generator->nodes), ng_node_destroy, NULL );
+    free( generator );
+    return 0;
+}
+
+
+bool ng_start( p_ng generator )
+{
+    if ( generator == NULL ) return false;
+    generator->curr_node = ( generator->node_count > 0 ? 0 : 1 );
+    generator->curr_node_sub_pos = 0;
+    return true;
+}
+
+
+static bool ng_next_node( p_ng generator, uint64_t* value )
+{
+    bool res = false;
+    if ( generator->curr_node < generator->node_count )
+    {
+        p_ng_node node = (p_ng_node)VectorGet( &(generator->nodes), 
+                                               (uint32_t)generator->curr_node );
+        if ( node != NULL )
+        {
+            uint64_t ret_value = node->start;
+            if ( node->count < 2 )
+            {
+                /* the node is a single-number-node */
+                generator->curr_node++;
+            }
+            else
+            {
+                /* the node is a number range */
+                ret_value += generator->curr_node_sub_pos++;
+                if ( generator->curr_node_sub_pos >= node->count )
+                {
+                    generator->curr_node++;
+                    generator->curr_node_sub_pos = 0;
+                }
+            }
+            if ( value ) *value = ret_value;
+            res = true;
+        }
+    }
+    return res;
+}
+
+
+bool ng_range_defined( p_ng generator )
+{
+    bool res = false;
+    if ( generator != NULL )
+    {
+        res = ( generator->node_count > 0 );
+    }
+    return res;
+}
+
+
+bool ng_next( p_ng generator, uint64_t* value )
+{
+    bool res = false;
+    if ( generator != NULL )
+    {
+        uint64_t ret_value = 0;
+        if ( ng_range_defined( generator ) )
+        {
+            /* there are nodes (number-ranges) defined */
+            res = ng_next_node( generator, &ret_value );
+        }
+        else
+        {
+            /* endless mode, there are NO nodes (number-ranges) defined */
+            ret_value = generator->curr_node++;
+            res = true;
+        }
+        if ( value ) *value = ret_value;
+    }
+    return res;
+}
+
+
+static void CC ng_count_callback( void *item, void *data )
+{
+    p_ng_node the_node = ( p_ng_node )item;
+    uint64_t *res = ( uint64_t * )data;
+    
+    *res += the_node->count;
+}
+
+
+uint64_t ng_count( p_ng generator )
+{
+    uint64_t res = 0;
+
+    if ( generator != NULL )
+    {
+        VectorForEach ( &(generator->nodes), false, ng_count_callback, &res );
+    }
+    return res;
+}
diff --git a/tools/run-stat/num-gen.h b/tools/run-stat/num-gen.h
new file mode 100644
index 0000000..03f994b
--- /dev/null
+++ b/tools/run-stat/num-gen.h
@@ -0,0 +1,81 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_num_gen_
+#define _h_num_gen_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <klib/vector.h>
+
+/********************************************************************************
+
+                   A NUMBER GENERATOR
+
+input : string, for instance "3,6,8,12,44-49"
+ouptut: sequence of integers, for instance 3,6,8,12,44,45,46,47,48,49
+
+********************************************************************************/
+typedef struct ng_node
+{
+    uint64_t start;
+    uint64_t count;
+} ng_node;
+typedef ng_node* p_ng_node;
+
+
+typedef struct ng
+{
+    Vector nodes;
+    uint32_t node_count;
+    uint64_t curr_node;
+    uint32_t curr_node_sub_pos;
+} ng;
+typedef ng* p_ng;
+
+
+rc_t ng_make( ng** generator );
+rc_t ng_destroy( p_ng generator );
+
+uint32_t ng_parse( p_ng generator, const char* src );
+
+bool ng_set_range( p_ng generator,
+                   const int64_t first, const uint64_t count );
+
+bool ng_check_range( p_ng generator,
+                     const int64_t first, const uint64_t count );
+
+bool ng_start( p_ng generator );
+
+bool ng_next( p_ng generator, uint64_t* value );
+
+bool ng_range_defined( p_ng generator );
+
+uint64_t ng_count( p_ng generator );
+
+#endif
diff --git a/tools/run-stat/progressbar.c b/tools/run-stat/progressbar.c
new file mode 100644
index 0000000..65a7895
--- /dev/null
+++ b/tools/run-stat/progressbar.c
@@ -0,0 +1,191 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <klib/rc.h>
+#include <klib/out.h>
+#include <sysalloc.h>
+#include <stdlib.h>
+
+typedef struct progressbar
+{
+    bool initialized;
+    uint16_t percent;
+} progressbar;
+
+
+rc_t make_progressbar( progressbar ** pb )
+{
+    if ( pb == NULL )
+        return RC( rcVDB, rcNoTarg, rcConstructing, rcSelf, rcNull );
+    (*pb) = calloc( 1, sizeof( progressbar ) );
+    if ( *pb == NULL )
+        return RC( rcVDB, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+    return 0;
+}
+
+
+rc_t destroy_progressbar( progressbar * pb )
+{
+    if ( pb == NULL )
+        return RC( rcVDB, rcNoTarg, rcDestroying, rcSelf, rcNull );
+    free( pb );
+    return 0;
+}
+
+
+uint8_t calc_progressbar_digits( uint64_t count )
+{
+    uint8_t res = 0;
+
+    if ( count > 10000 )
+    {
+        if ( count > 100000 )
+            res = 2;
+        else
+            res = 1;
+    }
+    return res;
+}
+
+
+uint16_t percent_progressbar( const uint64_t total, const uint64_t progress,
+                              const uint8_t digits )
+{
+    uint16_t res = 0;
+    uint32_t factor = 100;
+
+    if ( digits > 0 )
+    {
+        if ( digits > 1 )
+            factor = 10000;
+        else
+            factor = 1000;
+    }
+        
+    if ( total > 0 )
+    {
+        if ( progress >= total )
+            res = factor;
+        else
+        {
+            uint64_t temp = progress;
+            temp *= factor;
+            temp /= total;
+            res = (uint16_t) temp;
+        }
+    }
+
+    return res;
+}
+
+
+static void progess_0a( const uint16_t percent )
+{
+    OUTMSG (( "| %2u%%", percent ));
+}
+
+
+static void progess_0( const uint16_t percent )
+{
+    if ( percent & 1 )
+        OUTMSG (( "\b\b\b\b- %2u%%", percent ));
+    else
+        OUTMSG (( "\b\b\b%2u%%", percent ));
+}
+
+
+static void progess_1a( const uint16_t percent )
+{
+    uint16_t p1 = percent / 10;
+    uint16_t p0 = percent - ( p1 * 10 );
+    OUTMSG (( "| %2u.%01u%%", p1, p0 ));
+}
+
+
+static void progess_1( const uint16_t percent )
+{
+    uint16_t p1 = percent / 10;
+    uint16_t p0 = percent - ( p1 * 10 );
+    if ( ( p1 & 1 )&&( p0 == 0 ) )
+        OUTMSG (( "\b\b\b\b\b\b- %2u.%01u%%", p1, p0 ));
+    else
+        OUTMSG (( "\b\b\b\b\b%2u.%01u%%", p1, p0 ));
+}
+
+
+static void progess_2a( const uint16_t percent )
+{
+    uint16_t p1 = percent / 100;
+    uint16_t p0 = percent - ( p1 * 100 );
+    OUTMSG (( "| %2u.%02u%%", p1, p0 ));
+}
+
+
+static void progess_2( const uint16_t percent )
+{
+    uint16_t p1 = percent / 100;
+    uint16_t p0 = percent - ( p1 * 100 );
+    if ( ( p1 & 1 )&&( p0 == 0 ) )
+        OUTMSG (( "\b\b\b\b\b\b\b- %2u.%02u%%", p1, p0 ));
+    else
+        OUTMSG (( "\b\b\b\b\b\b%2u.%02u%%", p1, p0 ));
+}
+
+
+rc_t update_progressbar( progressbar * pb, const uint8_t fract_digits,
+                         const uint16_t percent )
+{
+    uint8_t digits = fract_digits;
+    if ( pb == NULL )
+        return RC( rcVDB, rcNoTarg, rcParsing, rcSelf, rcNull );
+    if ( digits > 2 )
+        digits = 2;
+    if ( pb->initialized )
+    {
+        if ( pb->percent != percent )
+        {
+            pb->percent = percent;
+            switch( digits )
+            {
+            case 0 : progess_0( percent ); break;
+            case 1 : progess_1( percent ); break;
+            case 2 : progess_2( percent ); break;
+            }
+        }
+    }
+    else
+    {
+        pb->percent = percent;
+        switch( digits )
+        {
+        case 0 : progess_0a( percent ); break;
+        case 1 : progess_1a( percent ); break;
+        case 2 : progess_2a( percent ); break;
+        }
+        pb->initialized = true;
+    }
+    return 0;
+}
diff --git a/tools/run-stat/progressbar.h b/tools/run-stat/progressbar.h
new file mode 100644
index 0000000..f3681d8
--- /dev/null
+++ b/tools/run-stat/progressbar.h
@@ -0,0 +1,76 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_progressbar_
+#define _h_progressbar_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct progressbar progressbar;
+
+/*--------------------------------------------------------------------------
+ * make_progressbar
+ *
+ *  creates a progressbar with zero-values inside
+ *  does not output anything
+ */
+rc_t make_progressbar( progressbar ** pb );
+
+
+/*--------------------------------------------------------------------------
+ * destroy_progressbar
+ *
+ *  destroy's the progressbar
+ *  does not output anything
+ */
+rc_t destroy_progressbar( progressbar * pb );
+
+
+/*--------------------------------------------------------------------------
+ * update_progressbar
+ *
+ *  sets the progressbar to a specific percentage
+ *  outputs only if the percentage has changed from the last call
+ *  the precentage is in 1/10-th of a percent ( 21.6% = 216 )
+ *  expects the percents in increasing order ( does not jump back )
+ *  writes a growing bar made from '-'-chars every 2nd percent
+ */
+rc_t update_progressbar( progressbar * pb, const uint8_t fract_digits,
+                         const uint16_t percent );
+
+
+uint8_t calc_progressbar_digits( uint64_t count );
+
+uint16_t percent_progressbar( const uint64_t total, const uint64_t progress,
+                              const uint8_t digits );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/run-stat/rd_filter.c b/tools/run-stat/rd_filter.c
new file mode 100644
index 0000000..69d3e28
--- /dev/null
+++ b/tools/run-stat/rd_filter.c
@@ -0,0 +1,243 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "rd_filter.h"
+
+#include <os-native.h>
+/* #include <insdc/sra.h> */
+
+#include <sysalloc.h>
+#include <bitstr.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+
+static rc_t add_2_cur( p_rd_filter self, const VCursor * cur )
+{
+    rc_t rc = VCursorAddColumn( cur, &self->idx_READ, "(INSDC:dna:text)READ" );
+    if ( rc == 0 )
+        rc = VCursorAddColumn( cur, &self->idx_QUALITY, "(INSDC:quality:phred)QUALITY" );
+    if ( rc == 0 )
+        rc = VCursorAddColumn( cur, &self->idx_TRIM_START, "TRIM_START" );
+    if ( rc == 0 )
+        rc = VCursorAddColumn( cur, &self->idx_TRIM_LEN, "TRIM_LEN" );
+    if ( rc == 0 )
+        rc = VCursorAddColumn( cur, &self->idx_READ_START, "READ_START" );
+    if ( rc == 0 )
+        rc = VCursorAddColumn( cur, &self->idx_READ_LEN, "READ_LEN" );
+    if ( rc == 0 )
+        rc = VCursorAddColumn( cur, &self->idx_READ_FILTER, "READ_FILTER" );
+    if ( rc == 0 )
+        rc = VCursorAddColumn( cur, &self->idx_READ_TYPE, "READ_TYPE" );
+
+    return rc;
+}
+
+
+rc_t rd_filter_init( p_rd_filter self )
+{
+    rc_t rc = char_buffer_init( &self->bases, 0 );
+    if ( rc == 0 )
+        rc = char_buffer_init( &self->filtered_bases, 5 );
+    if ( rc == 0 )
+        rc = char_buffer_init( &self->quality, 0 );
+    if ( rc == 0 )
+        rc = char_buffer_init( &self->filtered_quality, 0 );
+    if ( rc == 0 )
+        rc = char_buffer_init( &self->quality, 5 );
+    if ( rc == 0 )
+        rc = char_buffer_init( &self->filtered_quality, 5 );
+    if ( rc == 0 )
+        rc = int_buffer_init( &self->read_start, 5 );
+    if ( rc == 0 )
+        rc = int_buffer_init( &self->read_len, 5 );
+    if ( rc == 0 )
+        rc = int_buffer_init( &self->read_filter, 5 );
+    if ( rc == 0 )
+        rc = int_buffer_init( &self->read_type, 5 );
+    return rc;
+}
+
+
+void rd_filter_destroy( p_rd_filter self )
+{
+    char_buffer_destroy( &self->bases );
+    char_buffer_destroy( &self->filtered_bases );
+    char_buffer_destroy( &self->quality );
+    char_buffer_destroy( &self->filtered_quality );
+
+    int_buffer_destroy( &self->read_start );
+    int_buffer_destroy( &self->read_len );
+    int_buffer_destroy( &self->read_filter );
+    int_buffer_destroy( &self->read_type );
+}
+
+
+rc_t rd_filter_pre_open( p_rd_filter self, const VCursor * cur )
+{
+    return add_2_cur( self, cur );
+    /* return get_cur_idx( self, cur ); */
+}
+
+#define SRA_READ_TYPE_BIOLOGICAL 1
+
+static bool rd_filter_restrict( p_rd_filter self, uint32_t ridx,
+                                uint32_t * start, uint32_t * end )
+{
+    bool res = true;
+
+    if ( self->bio )
+        res = ( self->read_type.trans_ptr[ ridx ] == SRA_READ_TYPE_BIOLOGICAL );
+    if ( res )
+    {
+        *start = self->read_start.trans_ptr[ ridx ];
+        *end   = *start + self->read_len.trans_ptr[ ridx ];
+        if ( self->trim )
+        {
+            if ( *end < self->trim_start || *start > self->trim_end )
+                res = false;
+            else
+            {
+                if ( *start < self->trim_start )
+                    *start = self->trim_start;
+                if ( *end > self->trim_end )
+                    *end = self->trim_end;
+            }
+        }
+        if ( res && self->cut )
+        {
+            res = ( ( *end - *start ) > 25 );
+        }
+    }
+
+    return res;
+}
+
+
+static rc_t rd_filter_apply( p_rd_filter self )
+{
+    p_char_buffer b_src = &self->bases;
+    p_char_buffer b_dst = &self->filtered_bases;
+    p_char_buffer q_src = &self->quality;
+    p_char_buffer q_dst = &self->filtered_quality;
+
+    rc_t rc = char_buffer_realloc( b_dst, b_src->len );
+    if ( rc == 0 )
+    {
+        b_dst->len = 0;
+        rc = char_buffer_realloc( q_dst, q_src->len );
+        if ( rc == 0 )
+        {
+            uint32_t ridx, n = self->read_start.len;
+            q_dst->len = 0;
+            for ( ridx = 0; ridx < n; ++ridx )
+            {
+                /* walk the READS */
+                uint32_t start, end;
+                if ( rd_filter_restrict( self, ridx, &start, &end ) )
+                {
+                    uint32_t pos;
+                    for ( pos = start; pos < end; ++pos )
+                    {
+                        b_dst->ptr[ b_dst->len++ ] = b_src->trans_ptr[ pos ];
+                        q_dst->ptr[ q_dst->len++ ] = q_src->trans_ptr[ pos ];
+                    }
+                }
+            }
+        }
+    }
+    return rc;
+}
+
+
+rc_t rd_filter_read( p_rd_filter self, const VCursor * cur )
+{
+    /* first read the trim-values */
+    rc_t rc = helper_read_uint32( cur, self->idx_TRIM_START, &self->trim_start );
+    if ( rc == 0 )
+    {
+        rc = helper_read_uint32( cur, self->idx_TRIM_LEN, &self->trim_end );
+        if ( rc == 0 )
+            self->trim_end += self->trim_start;
+    }
+
+    /* then read the READ-SEGMENT-COLUMNs */
+    if ( rc == 0 )
+        rc = helper_read_int32_values( cur, self->idx_READ_START, &self->read_start );
+    if ( rc == 0 )
+        rc = helper_read_int32_values( cur, self->idx_READ_LEN, &self->read_len );
+    if ( rc == 0 )
+        rc = helper_read_int32_values( cur, self->idx_READ_FILTER, &self->read_filter );
+    if ( rc == 0 )
+        rc = helper_read_int32_values( cur, self->idx_READ_TYPE, &self->read_type );
+
+    /* then read the BASES */
+    if ( rc == 0 )
+        rc = helper_read_char_values( cur, self->idx_READ, &self->bases );
+
+    /* the read the QULAITY */
+    if ( rc == 0 )
+        rc = helper_read_char_values( cur, self->idx_QUALITY, &self->quality );
+
+    if ( rc == 0 )
+        rc = rd_filter_apply( self );
+
+    return rc;
+}
+
+
+rc_t rd_filter_set_flags( p_rd_filter self, bool bio, bool trim, bool cut )
+{
+    self->bio  = bio;
+    self->trim = trim;
+    self->cut  = cut;
+    return 0;
+}
+
+
+uint32_t filter_get_read_len( p_rd_filter self )
+{
+    return self->filtered_bases.len;
+}
+
+
+char filter_get_base( p_rd_filter self, const uint32_t idx )
+{
+    if ( idx < self->filtered_bases.len )
+        return self->filtered_bases.ptr[ idx ];
+    else
+        return 0;
+}
+
+
+uint8_t filter_get_quality( p_rd_filter self, const uint32_t idx )
+{
+    if ( idx < self->filtered_quality.len )
+        return (uint8_t)self->filtered_quality.ptr[ idx ];
+    else
+        return 0;
+}
diff --git a/tools/run-stat/rd_filter.h b/tools/run-stat/rd_filter.h
new file mode 100644
index 0000000..0f10128
--- /dev/null
+++ b/tools/run-stat/rd_filter.h
@@ -0,0 +1,98 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_rd_filter_
+#define _h_rd_filter_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <klib/namelist.h>
+#include <klib/rc.h>
+#include <klib/log.h>
+#include <klib/text.h>
+#include <vdb/cursor.h>
+#include "definitions.h"
+#include "helper.h"
+
+typedef struct rd_filter
+{
+    /* the index of the columns needed */
+    uint32_t idx_READ;
+    uint32_t idx_QUALITY;
+
+    uint32_t idx_TRIM_START;
+    uint32_t idx_TRIM_LEN;
+
+    uint32_t idx_READ_START;
+    uint32_t idx_READ_LEN;
+    uint32_t idx_READ_FILTER;
+    uint32_t idx_READ_TYPE;
+
+    /* the data to be read */
+    char_buffer bases;
+    char_buffer filtered_bases;
+    char_buffer quality;
+    char_buffer filtered_quality;
+    uint32_t trim_start;
+    uint32_t trim_end;
+
+    int_buffer read_start;
+    int_buffer read_len;
+    int_buffer read_filter;
+    int_buffer read_type;
+
+    /* flags, how the read is to be processed */
+    bool bio;
+    bool trim;
+    bool cut;
+
+} rd_filter;
+typedef rd_filter* p_rd_filter;
+
+
+rc_t rd_filter_init( p_rd_filter self );
+
+void rd_filter_destroy( p_rd_filter self );
+
+rc_t rd_filter_pre_open( p_rd_filter self, const VCursor * cur );
+
+rc_t rd_filter_read( p_rd_filter self, const VCursor * cur );
+
+rc_t rd_filter_set_flags( p_rd_filter self, bool bio, bool trim, bool cut );
+
+uint32_t filter_get_read_len( p_rd_filter self );
+
+char filter_get_base( p_rd_filter self, const uint32_t idx );
+
+uint8_t filter_get_quality( p_rd_filter self, const uint32_t idx );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/run-stat/run-stat.c b/tools/run-stat/run-stat.c
new file mode 100644
index 0000000..0a9c882
--- /dev/null
+++ b/tools/run-stat/run-stat.c
@@ -0,0 +1,703 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "run-stat.vers.h"
+
+#include <vdb/manager.h>
+#include <vdb/schema.h>
+#include <vdb/table.h>
+#include <vdb/cursor.h>
+#include <vdb/database.h>
+#include <kfs/directory.h>
+#include <kapp/main.h>
+#include <kapp/args.h>
+#include <klib/container.h>
+#include <klib/vector.h>
+#include <klib/log.h>
+#include <klib/out.h>
+#include <klib/debug.h>
+#include <klib/status.h>
+#include <klib/text.h>
+#include <klib/rc.h>
+#include <klib/namelist.h>
+#include <sra/srapath.h>
+
+#include <os-native.h>
+#include <sysalloc.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+#include <bitstr.h>
+
+#include "context.h"
+#include "helper.h"
+#include "progressbar.h"
+#include "mod_cmn.h"
+
+static const char * table_usage[] = { "table-name (if src is a database)", NULL };
+static const char * rows_usage[] = { "rows (default = all)", NULL };
+static const char * schema_usage[] = { "schema to be used on sourc-table", NULL };
+static const char * without_accession_usage[] = { "without accession-test", NULL };
+static const char * progress_usage[] = { "show a progress-bar (default: no)", NULL };
+static const char * module_usage[] = { "selects a statistic-module (default all build-in)", NULL };
+static const char * grafic_usage[] = { "enables output of grafic-files", NULL };
+static const char * report_usage[] = { "output-format of the report-files:", 
+                                       "txt..text (default), cvs..comma-sep.-format",
+                                       "xml..xml-format, json...json-format",
+                                       NULL };
+static const char * output_usage[] = { "location of report/grafics", 
+                                       "default = current directory",
+                                       NULL };
+
+static const char * prefix_usage[] = { "name-prefix for generated files", 
+                                       "default = 'report'",
+                                       NULL };
+
+OptDef StatOptions[] =
+{
+    { OPTION_TABLE, ALIAS_TABLE, NULL, table_usage, 1, true, false },
+    { OPTION_ROWS, ALIAS_ROWS, NULL, rows_usage, 1, true, false },
+    { OPTION_SCHEMA, ALIAS_SCHEMA, NULL, schema_usage, 5, true, false },
+    { OPTION_PROGRESS, ALIAS_PROGRESS, NULL, progress_usage, 1, false, false },
+    { OPTION_MODULE, ALIAS_MODULE, NULL, module_usage, 0, true, false },
+    { OPTION_WITHOUT_ACCESSION, ALIAS_WITHOUT_ACCESSION, NULL, without_accession_usage, 1, false, false },
+    { OPTION_GRAFIC, ALIAS_GRAFIC, NULL, grafic_usage, 1, false, false },
+    { OPTION_REPORT, ALIAS_RREPORT, NULL, report_usage, 1, true, false },
+    { OPTION_OUTPUT, ALIAS_OUTPUT, NULL, output_usage, 1, true, false },
+    { OPTION_PREFIX, ALIAS_PREFIX, NULL, prefix_usage, 1, true, false }
+};
+
+
+const char UsageDefaultName[] = "run-stat";
+
+rc_t CC UsageSummary ( const char * progname )
+{
+    return KOutMsg ("\n"
+                    "Usage:\n"
+                    "  %s <path> [options]\n"
+                    "\n", progname);
+}
+
+rc_t CC Usage (const Args * args)
+{
+    const char * progname;
+    const char * fullpath;
+    rc_t rc;
+
+    if (args == NULL)
+        rc = RC ( rcApp, rcArgv, rcAccessing, rcSelf, rcNull );
+    else
+        rc = ArgsProgram ( args, &fullpath, &progname );
+    if ( rc )
+        progname = fullpath = UsageDefaultName;
+
+    UsageSummary (progname);
+
+    KOutMsg (( "Options:\n" ));
+    HelpOptionLine ( ALIAS_TABLE, OPTION_TABLE, "table", table_usage );
+    HelpOptionLine ( ALIAS_ROWS, OPTION_ROWS, "rows", rows_usage );
+    HelpOptionLine ( ALIAS_SCHEMA, OPTION_SCHEMA, "schema", schema_usage );
+    HelpOptionLine ( ALIAS_PROGRESS, OPTION_PROGRESS, "progress", progress_usage );
+    HelpOptionLine ( ALIAS_MODULE, OPTION_MODULE, "module", module_usage );
+    HelpOptionLine ( ALIAS_WITHOUT_ACCESSION, OPTION_WITHOUT_ACCESSION, NULL, without_accession_usage );
+    HelpOptionLine ( ALIAS_GRAFIC, OPTION_GRAFIC, NULL, grafic_usage );
+    HelpOptionLine ( ALIAS_REPORT, OPTION_REPORT, NULL, report_usage );
+    HelpOptionLine ( ALIAS_OUTPUT, OPTION_OUTPUT, NULL, output_usage );
+    HelpOptionLine ( ALIAS_PREFIX, OPTION_PREFIX, NULL, prefix_usage );
+
+    HelpOptionsStandard ();
+
+    HelpVersion (fullpath, KAppVersion());
+
+    return rc;
+}
+
+
+/* Version  EXTERN
+ *  return 4-part version code: 0xMMmmrrrr, where
+ *      MM = major release
+ *      mm = minor release
+ *    rrrr = bug-fix release
+ */
+ver_t CC KAppVersion ( void )
+{
+    return RUN_STAT_VERS;
+}
+
+
+#if TOOLS_USE_SRAPATH != 0
+static char *translate_accession( SRAPath *my_sra_path,
+                                  const char *accession,
+                                  const size_t bufsize )
+{
+    char *res = malloc( bufsize );
+    if ( res != NULL )
+    {
+        rc_t rc = SRAPathFind( my_sra_path, accession, res, bufsize );
+        if ( GetRCState( rc ) == rcNotFound )
+        {
+            free( res );
+            res = NULL;
+        }
+        else if ( GetRCState( rc ) == rcInsufficient )
+        {
+            DBGMSG ( DBG_APP, 0,  ( "bufsize %lu was insufficient\n", bufsize ) );
+            free( res );
+            res = translate_accession( my_sra_path, accession, bufsize * 2 );
+        }
+        else if ( rc != 0 )
+        {
+            free( res );
+            res = NULL;
+        }
+    }
+    return res;
+}
+#endif
+
+
+#if TOOLS_USE_SRAPATH != 0
+static rc_t check_accession( p_stat_ctx ctx, const KDirectory *my_dir )
+{
+    rc_t rc = 0;
+    if ( strchr ( ctx->path, '/' ) == NULL )
+    {
+        SRAPath *my_sra_path;
+        rc = SRAPathMake( &my_sra_path, my_dir );
+        if ( rc != 0 )
+        {
+            if ( GetRCState ( rc ) != rcNotFound || GetRCTarget ( rc ) != rcDylib )
+                LOGERR( klogInt, rc, "SRAPathMake() failed" );
+            else
+                rc = 0;
+        }
+        else
+        {
+            if ( !SRAPathTest( my_sra_path, ctx->path ) )
+            {
+                char *buf = translate_accession( my_sra_path, ctx->path, 64 );
+                if ( buf != NULL )
+                {
+                    DBGMSG ( DBG_APP, 0,  ( "sra-accession found! >%s<\n", buf ) );
+                    free( (char*)ctx->path );
+                    ctx->path = buf;
+                }
+            }
+            SRAPathRelease( my_sra_path );
+        }
+    }
+    return rc;
+}
+#endif
+
+
+static void row_error( const char * fmt, rc_t rc, uint64_t row_id )
+{
+    PLOGERR( klogInt, ( klogInt, rc, fmt, "row_nr=%lu", row_id ) );
+}
+
+
+static rc_t run_stat_rows( const VCursor * cur,
+                           p_mod_list list,
+                           p_ng row_generator,
+                           bool show_progress )
+{
+    rc_t rc = 0;
+    uint64_t row_id, requested;
+    uint64_t processed = 0;
+    progressbar *pb = NULL;
+    uint8_t digits = 0;
+
+    requested = ng_count( row_generator );
+    OUTMSG(( "we will read: %lu rows\n", requested ));
+
+    if ( show_progress )
+    {
+        rc = make_progressbar( &pb );
+        DISP_RC( rc, "run_stat_rows:make_progressbar() failed" );
+        if ( rc == 0 )
+            digits = calc_progressbar_digits( requested );
+    }
+    if ( rc == 0 )
+    {
+        ng_start( row_generator );
+        while ( ( ng_next( row_generator, &row_id ) )&&( rc == 0 ) )
+        {
+            rc = Quitting();
+            if ( rc == 0 )
+            {
+                rc = VCursorSetRowId( cur, row_id );
+                if ( rc != 0 )
+                    row_error( "VCursorSetRowId( row#$(row_nr) ) failed", rc, row_id );
+                else
+                {
+                    rc = VCursorOpenRow( cur );
+                    if ( rc != 0 )
+                        row_error( "VCursorOpenRow( row#$(row_nr) ) failed", rc, row_id );
+                    else
+                    {
+                        /*****************************************************/
+                        /* pass every row on to the list of modules          */
+                        rc_t rc1 = mod_list_row( list, cur );
+                        /*****************************************************/
+                        if ( rc1 != 0 )
+                            row_error( "stat_module_row( row#$(row_nr) ) failed", rc1, row_id );
+                        else
+                        {
+                            if ( pb != NULL )
+                            {
+                                uint16_t percent = percent_progressbar( requested, 
+                                                                        ++processed,
+                                                                        digits );
+                                update_progressbar( pb, digits, percent );
+                            }
+                        }
+                        rc = VCursorCloseRow( cur );
+                        if ( rc != 0 )
+                            row_error( "VCursorCloseRow( row#$(row_nr) ) failed",  rc, row_id );
+                        else
+                            rc = rc1;
+                    }
+                }
+            }
+        }
+        if ( pb != 0 )
+        {
+            rc_t rc1 = destroy_progressbar( pb );
+            DISP_RC( rc1, "run_stat_rows:destroy_progressbar() failed" );
+        }
+    }
+    if ( show_progress )
+        OUTMSG(( "\n" ));
+    return rc;
+}
+
+
+static rc_t run_stat_check_range( p_ng row_generator, const VCursor * cur )
+{
+    int64_t  first;
+    uint64_t count;
+    rc_t rc = VCursorIdRange( cur, 0, &first, &count );
+    DISP_RC( rc, "run_stat_check_range:VCursorIdRange() failed" );
+    if ( rc == 0 )
+    {
+        /* if the user did not specify a row-range, take all rows */
+        if ( ng_range_defined( row_generator ) == false )
+        {
+            ng_set_range( row_generator, first, count );
+        }
+        /* if the user did specify a row-range, check the boundaries */
+        else
+        {
+            ng_check_range( row_generator, first, count );
+        }
+
+        if ( !ng_range_defined( row_generator ) )
+        {
+            rc = RC( rcExe, rcDatabase, rcReading, rcRange, rcEmpty );
+            DISP_RC( rc, "run_stat_check_range:ng_range_defined() failed" );
+        }
+
+    }
+    return rc;
+}
+
+
+static rc_t run_stat_tab( p_stat_ctx ctx,
+                          const VTable * tab,
+                          p_mod_list m_list )
+{
+    const VCursor *cur;
+    rc_t rc = VTableCreateCursorRead( tab, &cur );
+    DISP_RC( rc, "run_stat_tab:VTableCreateCursorRead() failed" );
+    if ( rc == 0 )
+    {
+        rc = mod_list_pre_open( m_list, cur );
+        if ( rc == 0 )
+        {
+                rc = VCursorOpen( cur );
+                DISP_RC( rc, "run_stat_tab:VCursorOpen() failed" );
+                if ( rc == 0 )
+                {
+                    rc = run_stat_check_range( ctx->row_generator, cur );
+                    if ( rc == 0 )
+                    {
+                        /***************************************/
+                        rc = run_stat_rows( cur,
+                                            m_list,
+                                            ctx->row_generator,
+                                            ctx->show_progress );
+
+                        if ( rc == 0 )
+                            rc = mod_list_post_rows( m_list );
+                        /***************************************/
+                    }
+                }
+        }
+        {
+            rc_t rc1 = VCursorRelease( cur );
+            DISP_RC( rc1, "run_stat_tab:VCursorRelease() failed" );
+        }
+    }
+    return 0;
+}
+
+
+static rc_t run_stat_db( p_stat_ctx ctx,
+                         const VDatabase * db,
+                         p_mod_list m_list )
+{
+    rc_t rc = 0;
+    bool table_defined = ( ctx->table != NULL );
+    if ( !table_defined )
+    {
+        table_defined = helper_take_this_table_from_db( db, ctx, "SEQUENCE" );
+        if ( !table_defined )
+            table_defined = helper_take_1st_table_from_db( db, ctx );
+    }
+    if ( table_defined )
+    {
+        const VTable *tab;
+        rc = VDatabaseOpenTableRead( db, &tab, "%s", ctx->table );
+        DISP_RC( rc, "run_stat_db:VDatabaseOpenTableRead() failed" );
+        if ( rc == 0 )
+        {
+            /************************************/
+            rc = run_stat_tab( ctx, tab, m_list );
+            /************************************/
+            {
+                rc_t rc1 = VTableRelease( tab );
+                DISP_RC( rc1, "run_stat_db:VTableRelease() failed" );
+            }
+        }
+    }
+    else
+    {
+        rc = RC( rcVDB, rcNoTarg, rcCopying, rcItem, rcNotFound );
+        LOGMSG( klogInfo, "opened as vdb-dabase, but no table found" );
+    }
+    return rc;
+}
+
+
+static rc_t run_stat_collect_data( p_stat_ctx ctx,
+                              const VDBManager * mgr,
+                              p_mod_list m_list )
+{
+    VSchema * dflt_schema;
+    rc_t rc = helper_parse_schema( mgr, &dflt_schema, ctx->schema_list );
+    DISP_RC( rc, "run_stat_collect_data:helper_parse_schema() failed" );
+    if ( rc == 0 )
+    {
+        const VDatabase * db;
+        /* try to open it as a database */
+        rc = VDBManagerOpenDBRead ( mgr, &db, dflt_schema, "%s", ctx->path );
+        if ( rc == 0 )
+        {
+            /* if it succeeds it is a database, continue ... */
+            /**********************************/
+            rc = run_stat_db( ctx, db, m_list );
+            /**********************************/
+            VDatabaseRelease( db );
+        }
+        else
+        {
+            const VTable * tab;
+            /* try to open it as a table */
+            rc = VDBManagerOpenTableRead( mgr, &tab, dflt_schema, "%s", ctx->path );
+            /* if it succeeds it is a table, continue ... */
+            if ( rc == 0 )
+            {
+                /************************************/
+                rc = run_stat_tab( ctx, tab, m_list );
+                /************************************/
+                VTableRelease( tab );
+            }
+            else
+            {
+                rc = RC( rcVDB, rcNoTarg, rcCopying, rcItem, rcNotFound );
+                PLOGERR( klogInt, ( klogInt, rc,
+                         "\nthe path '$(path)' cannot be opened as vdb-database or vdb-table",
+                         "path=%s", ctx->path ));
+            }
+        }
+        {
+            rc_t rc1 = VSchemaRelease( dflt_schema );
+            DISP_RC( rc1, "run_stat_perform:VSchemaRelease(dflt) failed" );
+        }
+    }
+    return rc;
+}
+
+static const char * ext_txt = "txt";
+static const char * ext_csv = "csv";
+static const char * ext_xml = "xml";
+static const char * ext_jso = "json";
+
+static const char * run_stat_ext( const uint32_t report_type )
+{
+    const char * res = ext_txt;
+    switch( report_type )
+    {
+    case RT_CSV : res = ext_csv; break;
+    case RT_XML : res = ext_xml; break;
+    case RT_JSO : res = ext_jso; break;
+    }
+    return res;
+}
+
+static rc_t run_stat_assemble_filename( p_char_buffer buf, p_stat_ctx ctx,
+                                 const char * module_name,
+                                 const char * report_name,
+                                 const char * ext )
+{
+    rc_t rc;
+    size_t size = string_size( ctx->output_path );
+    size += string_size( ctx->name_prefix );
+    size += string_size( module_name );
+    size += string_size( report_name );
+    size += string_size( ext );
+    size += 6;
+
+    if ( ctx->output_path == NULL )
+        rc = char_buffer_printf( buf, size, 
+            "%s_%s_%s.%s", ctx->name_prefix, module_name, report_name, ext );
+    else
+        rc = char_buffer_printf( buf, size, 
+            "%s/%s_%s_%s.%s", ctx->output_path, ctx->name_prefix, module_name, 
+                              report_name, ext );
+    return rc;
+}
+
+
+static rc_t run_stat_module_sub_report( p_stat_ctx ctx, p_mod_list m_list,
+    const char * module_name, uint32_t m_idx, uint32_t r_idx, p_char_buffer buffer )
+{
+    char * report_name;
+    rc_t rc = mod_list_subreport_name( m_list, m_idx, r_idx, &report_name );
+    if ( rc == 0 )
+    {
+        buffer->len = 0;
+        rc = mod_list_subreport( m_list, m_idx, r_idx, buffer, ctx->report_type );
+        if ( rc == 0 )
+        {
+            char_buffer fn;
+            rc = char_buffer_init( &fn, 1024 );
+            if ( rc == 0 )
+            {
+                const char * ext = run_stat_ext( ctx->report_type );
+                rc = run_stat_assemble_filename( &fn, ctx,
+                                    module_name, report_name, ext );
+                if ( rc == 0 )
+                {
+                    if ( buffer->len > 0 )
+                    {
+                        rc = char_buffer_saveto( buffer, fn.ptr );
+                        if ( rc == 0 )
+                            OUTMSG(( "written: %s\n", fn.ptr ));
+                    }
+                    fn.len = 0;
+                }
+
+                if ( ctx->produce_grafic )
+                {
+                    rc = run_stat_assemble_filename( &fn, ctx,
+                                            module_name, report_name, "svg" );
+                    if ( rc == 0 )
+                    {
+                        rc_t rc1 = mod_list_graph( m_list, m_idx, r_idx, fn.ptr );
+                        if ( rc1 == 0 )
+                            OUTMSG(( "written: %s\n", fn.ptr ));
+                    }
+                }
+                char_buffer_destroy( &fn );
+            }
+        }
+        free( report_name );
+    }
+    return rc;
+}
+
+
+static rc_t run_stat_module_report( p_stat_ctx ctx, p_mod_list m_list,
+                                uint32_t m_idx, p_char_buffer buffer )
+{
+    char * module_name;
+    rc_t rc = mod_list_name( m_list, m_idx, &module_name );
+    if ( rc == 0 )
+    {
+        uint32_t r_count;
+        rc = mod_list_subreport_count( m_list, m_idx, &r_count );
+        if ( rc == 0 )
+        {
+            uint32_t r_idx;
+            for ( r_idx = 0; r_idx < r_count && rc == 0; ++r_idx )
+            {
+                rc = run_stat_module_sub_report( ctx, m_list,
+                            module_name, m_idx, r_idx, buffer );
+            }
+        }
+        free( module_name );
+    }
+    return rc;
+}
+
+
+static rc_t run_stat_report( p_stat_ctx ctx, p_mod_list m_list )
+{
+    char_buffer buffer;
+    rc_t rc = char_buffer_init( &buffer, 4096 ); /* preallocate */
+    DISP_RC( rc, "run_stat_report:char_buffer_init(finalized) failed" );
+    if ( rc == 0 )
+    {
+        uint32_t m_count;
+        rc = mod_list_count( m_list, &m_count );
+        if ( rc ==  0 )
+        {
+            uint32_t m_idx;
+            for ( m_idx = 0; m_idx < m_count && rc == 0; ++m_idx )
+            {
+                rc = run_stat_module_report( ctx, m_list, m_idx, &buffer );
+            }
+        }
+        /* free the collected output... */
+        char_buffer_destroy( &buffer );
+    }
+    return rc;
+}
+
+
+static rc_t run_stat_main( p_stat_ctx ctx )
+{
+    KDirectory *dir;
+    rc_t rc = KDirectoryNativeDir( &dir );
+    DISP_RC( rc, "run_stat_main:KDirectoryNativeDir() failed" );
+    if ( rc == 0 )
+    {
+        const VDBManager *mgr;
+
+#if TOOLS_USE_SRAPATH != 0
+        if ( ctx->dont_check_accession == false )
+        {
+            rc_t rc1 = check_accession( ctx, dir );
+            DISP_RC( rc1, "run_stat_main:check_accession() failed" );
+        }
+#endif
+
+        rc = VDBManagerMakeRead ( &mgr, dir );
+        DISP_RC( rc, "run_stat_main:VDBManagerMakeRead() failed" );
+        if ( rc == 0 )
+        {
+            p_mod_list m_list;
+            rc = mod_list_init( &m_list, ctx->module_list );
+            if ( rc == 0 )
+            {
+                /********************************/
+                rc = run_stat_collect_data( ctx, mgr, m_list );
+                /********************************/
+
+                if ( rc == 0 )
+                    rc = run_stat_report( ctx, m_list );
+
+                mod_list_destroy( m_list );
+            }
+            {
+                rc_t rc1 = VDBManagerRelease( mgr );
+                DISP_RC( rc1, "run_stat_main:VDBManagerRelease() failed" );
+            }
+        }
+        {
+            rc_t rc1 = KDirectoryRelease( dir );
+            DISP_RC( rc1, "run_stat_main:KDirectoryRelease() failed" );
+        }
+    }
+    return rc;
+}
+
+
+/* for KOutHandlerSet... */
+static
+rc_t CC write_to_FILE ( void *f, const char *buffer, size_t bytes, size_t *num_writ )
+{
+    * num_writ = fwrite ( buffer, 1, bytes, f );
+    if ( * num_writ != bytes )
+        return RC ( rcExe, rcFile, rcWriting, rcTransfer, rcIncomplete );
+    return 0;
+}
+
+
+rc_t CC KMain ( int argc, char *argv [] )
+{
+    Args * args;
+
+    rc_t rc = KOutHandlerSet ( write_to_FILE, stdout );
+    DISP_RC( rc, "KMain:KOutHandlerSet() failed" );
+    if ( rc == 0 )
+        rc = ArgsMakeAndHandle ( &args, argc, argv, 1,
+            StatOptions, sizeof StatOptions / sizeof StatOptions [ 0 ] );
+    if ( rc == 0 )
+    {
+        stat_ctx *ctx;
+
+        rc = ctx_init( &ctx );
+        DISP_RC( rc, "KMain:ctx_init() failed" );
+
+        if ( rc == 0 )
+        {
+            rc = ctx_capture_arguments_and_options( args, ctx );
+            DISP_RC( rc, "KMain:ctx_capture_arguments_and_options() failed" );
+            if ( rc == 0 )
+            {
+                if ( ctx->usage_requested )
+                {
+                    MiniUsage(args);
+                }
+                else
+                {
+                    KLogHandlerSetStdErr();
+                    if ( ctx->module_list == NULL )
+                    {
+                        helper_make_namelist_from_string( &(ctx->module_list), 
+                                        "bases,qualities", ',' );
+                    }
+                    if ( rc == 0 )
+                    {
+                        /************************/
+                        rc = run_stat_main( ctx );
+                        /************************/
+                    }
+                }
+            }
+            ctx_destroy( ctx );
+        }
+        ArgsWhack (args);
+    }
+
+    return rc;
+}
+
diff --git a/tools/run-stat/run-stat.vers b/tools/run-stat/run-stat.vers
new file mode 100644
index 0000000..8e8299d
--- /dev/null
+++ b/tools/run-stat/run-stat.vers
@@ -0,0 +1 @@
+2.4.2
diff --git a/tools/run-stat/svg.c b/tools/run-stat/svg.c
new file mode 100644
index 0000000..0b1cc0d
--- /dev/null
+++ b/tools/run-stat/svg.c
@@ -0,0 +1,753 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <klib/log.h>
+#include <klib/text.h>
+#include <klib/printf.h>
+#include <klib/out.h>
+#include <kfs/directory.h>
+#include <kfs/file.h>
+
+#include <os-native.h>
+
+#include <sysalloc.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "svg.h"
+
+rc_t svg_path_init( p_svg_path path )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( path != NULL )
+        rc = char_buffer_init( &path->buf, 250 );
+    return rc;
+}
+
+void svg_path_destroy( p_svg_path path )
+{
+    if ( path != NULL )
+        char_buffer_destroy( &path->buf );
+}
+
+
+rc_t svg_path_close( p_svg_path path )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( path != NULL )
+        rc = char_buffer_printf( &path->buf, 2, "Z " );
+    return rc;
+}
+
+
+static rc_t svg_path_2_to( p_svg_path path, const char c, int32_t x, int32_t y )
+{
+    if ( path != NULL )
+        return char_buffer_printf( &path->buf, 25, "%c%d %d ", c, x, y );
+    else
+        return RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+}
+
+
+rc_t svg_path_move_to( p_svg_path path, bool absolute, int32_t x, int32_t y )
+{
+    return svg_path_2_to( path, absolute ? 'M' : 'm', x, y );
+}
+
+
+rc_t svg_path_line_to( p_svg_path path, bool absolute, int32_t x, int32_t y )
+{
+    return svg_path_2_to( path, absolute ? 'L' : 'l', x, y );
+}
+
+
+static rc_t svg_path_1_to( p_svg_path path, const char c, int32_t x )
+{
+    if ( path != NULL )
+        return char_buffer_printf( &path->buf, 25, "%c%d ", c, x );
+    else
+        return RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+}
+
+
+rc_t svg_path_hline_to( p_svg_path path, bool absolute, int32_t x )
+{
+    return svg_path_1_to( path, absolute ? 'H' : 'h', x );
+}
+
+
+rc_t svg_path_vline_to( p_svg_path path, bool absolute, int32_t y )
+{
+    return svg_path_1_to( path, absolute ? 'V' : 'v', y );
+}
+
+
+rc_t svg_path_smooth_to( p_svg_path path, bool absolute, int32_t x, int32_t y )
+{
+    return svg_path_2_to( path, absolute ? 'T' : 't', x, y );
+}
+
+
+static rc_t svg_path_4_to( p_svg_path path, const char c, int32_t x1, int32_t y1,
+                           int32_t x, int32_t y )
+{
+    if ( path != NULL )
+        return char_buffer_printf( &path->buf, 50, "%c%d,%d %d,%d ", c, x1, y1, x, y );
+    else
+        return RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+}
+
+/* cubic bezier curve (x1,y1 ... control point / x,y ... endpoint ) */
+rc_t svg_path_bez3_to( p_svg_path path, bool absolute,
+                       int32_t x1, int32_t y1, int32_t x, int32_t y )
+{
+    return svg_path_4_to( path, absolute ? 'S' : 's', x1, y1, x, y );
+}
+
+/* quadratic bezier curve (x1,y1 ... control point / x,y ... endpoint ) */
+rc_t svg_path_bez2_to( p_svg_path path, bool absolute,
+                       int32_t x1, int32_t y1, int32_t x, int32_t y )
+{
+    return svg_path_4_to( path, absolute ? 'Q' : 'q', x1, y1, x, y );
+}
+
+
+/* quadratic bezier curve (x1,y1 x2,y2 ... control point / x,y ... endpoint ) */
+rc_t svg_path_curve_to( p_svg_path path, bool absolute,
+        int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t x, int32_t y )
+{
+    if ( path != NULL )
+    {
+        char c = absolute ? 'C' : 'c';
+        return char_buffer_printf( &path->buf, 75, "%c%d,%d %d,%d %d,%d ",
+                                   c, x1, y1, x2, y2, x, y );
+    }
+    else
+        return RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+}
+
+
+/* arc ( rx, ry ....... elliptical radius in x/y-direction
+         rotx   ....... rotation around x-axis
+         large-flag ... choose the large section of the arc
+         sweep-flag ... draw in positive-angle-direction
+         x,y .......... endpoint ) */
+rc_t svg_path_arc( p_svg_path path, bool absolute,
+                   int32_t rx, int32_t ry, int32_t rot_x, 
+                   bool large_flag, bool sweep_flag,
+                   int32_t x, int32_t y )
+{
+    if ( path != NULL )
+    {
+        char c = absolute ? 'A' : 'a';
+        int32_t lf = large_flag ? 1 : 0;
+        int32_t sf = sweep_flag ? 1 : 0;
+        return char_buffer_printf( &path->buf, 75, "%c%d,%d %d %d,%d %d,%d ",
+                                   c, rx, ry, rot_x, lf, sf, x, y );
+    }
+    else
+        return RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+}
+
+typedef struct svg_write_ctx
+{
+    KFile * f;
+    uint64_t pos;
+} svg_write_ctx;
+typedef svg_write_ctx* p_svg_write_ctx;
+
+
+static rc_t svg_write_txt( p_svg_write_ctx ctx, const char * s )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( ctx != NULL && s != NULL )
+    {
+        size_t num_writ;
+        size_t len = string_size( s );
+        rc = KFileWrite ( ctx->f, ctx->pos, s, len, &num_writ );
+        if ( rc == 0 )
+            ctx->pos += num_writ;
+    }
+    return rc;
+}
+
+typedef struct svg_style
+{
+    char * name;
+    char * style;
+} svg_style;
+typedef svg_style* p_svg_style;
+
+
+static p_svg_style svg_make_style( const char * name, const char * style )
+{
+    p_svg_style res = calloc( 1, sizeof( struct svg_style ) );
+    if ( res != NULL )
+    {
+        res->name  = string_dup_measure( name, NULL );
+        res->style = string_dup_measure( style, NULL );
+    }
+    return res;
+}
+
+
+static void CC svg_style_whack( void *item, void *data )
+{
+    p_svg_style style = item;
+    if ( style != NULL )
+    {
+        if ( style->name  != NULL ) free( style->name );
+        if ( style->style != NULL ) free( style->style );
+        free( style );
+    }
+}
+
+static const char * svg_style_fmt = "%s{ %s }\n";
+static void CC svg_write_style( void *item, void * data )
+{
+    p_svg_style style = item;
+    p_svg_write_ctx ctx = data;
+    if ( style != NULL && ctx != NULL )
+    {
+        char temp[ 240 ];
+        rc_t rc = string_printf( temp, sizeof( temp ), NULL, svg_style_fmt,
+                    style->name, style->style );
+        if ( rc == 0 )
+            svg_write_txt( ctx, temp );
+    }
+}
+
+
+static const char * svg_style_prefix  = "<style type=\"text/css\"><![CDATA[\n";
+static const char * svg_style_postfix = "]]></style>\n\n";
+
+static rc_t svg_write_styles( Vector * styles, p_svg_write_ctx ctx )
+{
+    rc_t rc = svg_write_txt( ctx, svg_style_prefix );
+    if ( rc == 0 )
+    {
+        VectorForEach ( styles, false, svg_write_style, ctx );
+        rc = svg_write_txt( ctx, svg_style_postfix );
+    }
+    return rc;
+}
+
+
+static rc_t svg_add_style( Vector * styles, p_svg_style style )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( styles != NULL && style != NULL )
+    {
+        rc = VectorAppend ( styles, NULL, style );
+        if ( rc != 0 )
+            svg_style_whack( style, NULL );
+    }
+    return rc;
+}
+
+struct svg_elem;
+
+/* the type of the callback-function to be performed on every row */
+typedef void ( CC * svg_elem_wr ) ( struct svg_elem * elem, p_svg_write_ctx ctx );
+
+typedef struct svg_elem
+{
+    svg_elem_wr writer;
+    uint32_t * values;
+    uint32_t n_values;
+    char * txt;
+    char * style;
+} svg_elem;
+typedef svg_elem* p_svg_elem;
+
+
+static p_svg_elem svg_make_elem( const char * style,
+                                 svg_elem_wr writer,
+                                 const uint32_t * values,
+                                 uint32_t n_values )
+{
+    p_svg_elem res = calloc( 1, sizeof( struct svg_elem ) );
+    if ( res != NULL )
+    {
+        if ( n_values > 0 )
+        {
+            size_t size = ( sizeof ( res->values[ 0 ] ) * n_values );
+            res->values = malloc( size );
+            if ( res->values != NULL )
+            {
+                memcpy( res->values, values, size );
+                res->n_values = n_values;
+            }
+        }
+        if ( style != NULL )
+            res->style = string_dup_measure ( style, NULL );
+        res->writer = writer;
+    }
+    return res;
+}
+
+
+static p_svg_elem svg_make_elemv( const char * style,
+                                  svg_elem_wr writer,
+                                  uint32_t n_values, ... )
+{
+    p_svg_elem res = calloc( 1, sizeof( struct svg_elem ) );
+    va_list v;
+    va_start( v, n_values );
+    if ( res != NULL )
+    {
+        size_t size = ( sizeof ( res->values[ 0 ] ) * n_values );
+        res->values = malloc( size );
+        if ( res->values != NULL )
+        {
+            int32_t i;
+            for ( i = 0; i < n_values; ++i )
+                res->values[ i ] = va_arg( v, uint32_t );
+            res->n_values = n_values;
+        }
+        res->style = string_dup_measure ( style, NULL );
+        res->writer = writer;
+    }
+    va_end( v );
+    return res;
+}
+
+
+static void CC svg_elem_whack( void *item, void *data )
+{
+    p_svg_elem elem = item;
+    if ( elem )
+    {
+        if ( elem->values != NULL ) free( elem->values );
+        if ( elem->style != NULL ) free( elem->style );
+        if ( elem->txt != NULL ) free( elem->txt );
+        free( elem );
+    }
+}
+
+
+static rc_t svg_add_elem( Vector * elements, p_svg_elem elem )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( elements != NULL && elem != NULL )
+    {
+        rc = VectorAppend ( elements, NULL, elem );
+        if ( rc != 0 )
+            svg_elem_whack( elem, NULL );
+    }
+    return rc;
+}
+
+
+static const char * svg_circle_fmt_c =
+    "<circle cx=\"%d\" cy=\"%d\" r=\"%d\" class=\"%s\"/>\n\n";
+static const char * svg_circle_fmt =
+    "<circle cx=\"%d\" cy=\"%d\" r=\"%d\"/>\n\n";
+
+
+static void svg_elem_wr_circle( p_svg_elem elem, p_svg_write_ctx ctx )
+{
+    if ( elem != NULL && ctx != NULL && 
+         elem->values != NULL && elem->n_values > 2 )
+    {
+        char temp[ 120 ];
+        rc_t rc;
+        if ( elem->style != NULL )
+            rc = string_printf( temp, sizeof( temp ), NULL, svg_circle_fmt_c,
+                    elem->values[0], elem->values[1], elem->values[2], elem->style );
+        else
+            rc = string_printf( temp, sizeof( temp ), NULL, svg_circle_fmt,
+                    elem->values[0], elem->values[1], elem->values[2] );
+        if ( rc == 0 )
+            svg_write_txt( ctx, temp );
+    }
+}
+
+
+static const char * svg_rect_fmt_c =
+    "<rect x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" class=\"%s\"/>\n\n";
+static const char * svg_rect_fmt =
+    "<rect x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\"/>\n\n";
+
+static void svg_elem_wr_rect( p_svg_elem elem, p_svg_write_ctx ctx )
+{
+    if ( elem != NULL && ctx != NULL &&
+         elem->values != NULL && elem->n_values > 3 )
+    {
+        char temp[ 120 ];
+        rc_t rc;
+        if ( elem->style != NULL )
+            rc = string_printf( temp, sizeof( temp ), NULL, svg_rect_fmt_c,
+                    elem->values[0], elem->values[1], elem->values[2],
+                    elem->values[3], elem->style );
+        else
+            rc = string_printf( temp, sizeof( temp ), NULL, svg_rect_fmt,
+                    elem->values[0], elem->values[1], elem->values[2],
+                    elem->values[3] );
+        if ( rc == 0 )
+            svg_write_txt( ctx, temp );
+    }
+}
+
+
+static const char * svg_ell_fmt_c =
+    "<ellipse cx=\"%d\" cy=\"%d\" rx=\"%d\" ry=\"%d\" class=\"%s\"/>\n\n";
+static const char * svg_ell_fmt =
+    "<ellipse cx=\"%d\" cy=\"%d\" rx=\"%d\" ry=\"%d\"/>\n\n";
+
+
+static void svg_elem_wr_ellipse( p_svg_elem elem, p_svg_write_ctx ctx )
+{
+    if ( elem != NULL && ctx != NULL &&
+         elem->values != NULL && elem->n_values > 3 )
+    {
+        char temp[ 120 ];
+        rc_t rc;
+        if ( elem->style != NULL )
+            rc = string_printf( temp, sizeof( temp ), NULL, svg_ell_fmt_c,
+                    elem->values[0], elem->values[1], elem->values[2],
+                    elem->values[3], elem->style );
+            rc = string_printf( temp, sizeof( temp ), NULL, svg_ell_fmt,
+                    elem->values[0], elem->values[1], elem->values[2],
+                    elem->values[3] );
+        if ( rc == 0 )
+            svg_write_txt( ctx, temp );
+    }
+}
+
+
+static const char * svg_line_fmt_c =
+    "<line x1=\"%d\" y1=\"%d\" x2=\"%d\" y2=\"%d\" class=\"%s\"/>\n\n";
+static const char * svg_line_fmt =
+    "<line x1=\"%d\" y1=\"%d\" x2=\"%d\" y2=\"%d\"/>\n\n";
+
+static void svg_elem_wr_line( p_svg_elem elem, p_svg_write_ctx ctx )
+{
+    if ( elem != NULL && ctx != NULL &&
+         elem->values != NULL && elem->n_values > 3 )
+    {
+        char temp[ 120 ];
+        rc_t rc;
+        if ( elem->style != NULL )
+            rc = string_printf( temp, sizeof( temp ), NULL, svg_line_fmt_c,
+                    elem->values[0], elem->values[1], elem->values[2],
+                    elem->values[3], elem->style );
+        else
+            rc = string_printf( temp, sizeof( temp ), NULL, svg_line_fmt,
+                    elem->values[0], elem->values[1], elem->values[2],
+                    elem->values[3] );
+        if ( rc == 0 )
+            svg_write_txt( ctx, temp );
+    }
+}
+
+
+static const char * svg_point_fmt ="%d,%d ";
+
+static char * svg_make_points_str( const uint32_t * values,
+                                   const uint32_t n_values )
+{
+    size_t size = ( n_values * 10 );
+    char * res = malloc( size );
+    if ( res )
+    {
+        rc_t rc = 0;
+        size_t ofs = 0;
+        uint32_t i, n = ( n_values >> 1 );
+        for ( i = 0; i < n && rc == 0; ++i )
+        {
+            size_t written;
+            rc = string_printf( &res[ofs], size-ofs, &written, svg_point_fmt,
+                                values[ i*2 ], values[ i*2 + 1 ] );
+            if ( rc == 0 )
+                ofs+=written;
+        }
+    }
+    return res;
+}
+
+static const char * svg_pline_fmt_c =
+    "<polyline points=\"%s\" class=\"%s\"/>\n\n";
+static const char * svg_pline_fmt =
+    "<polyline points=\"%s\"/>\n\n";
+
+static void svg_elem_wr_polyline( p_svg_elem elem, p_svg_write_ctx ctx )
+{
+    if ( elem != NULL && ctx != NULL &&
+         elem->values != NULL && elem->n_values > 1 )
+    {
+        char * point_str = svg_make_points_str( elem->values, elem->n_values );
+        if ( point_str != NULL )
+        {
+            size_t size = string_size( point_str ) + string_size( elem->style ) + 40;
+            char * temp = malloc( size );
+            if ( temp != NULL )
+            {
+                rc_t rc;
+                if ( elem->style != NULL )
+                    rc = string_printf( temp, size, NULL, svg_pline_fmt_c,
+                                        point_str, elem->style );
+                else
+                    rc = string_printf( temp, size, NULL, svg_pline_fmt,
+                                        point_str );
+                if ( rc == 0 )
+                    svg_write_txt( ctx, temp );
+                free( temp );
+            }
+            free( point_str );
+        }
+    }
+}
+
+
+static const char * svg_text_fmt_c =
+    "<text x=\"%d\" y=\"%d\" class=\"%s\">%s</text>\n\n";
+static const char * svg_text_fmt =
+    "<text x=\"%d\" y=\"%d\">%s</text>\n\n";
+
+static void svg_elem_wr_text( p_svg_elem elem, p_svg_write_ctx ctx )
+{
+    if ( elem != NULL && ctx != NULL &&
+         elem->values != NULL && elem->n_values > 1 )
+    {
+        size_t size = string_size( elem->txt ) + string_size( elem->style ) + 50;
+        char * temp = malloc( size );
+        if ( temp != NULL )
+        {
+            rc_t rc;
+            if ( elem->style != NULL )
+                rc = string_printf( temp, size, NULL, svg_text_fmt_c,
+                        elem->values[0], elem->values[1], elem->style, elem->txt );
+            else
+                rc = string_printf( temp, size, NULL, svg_text_fmt,
+                        elem->values[0], elem->values[1], elem->txt );
+
+            if ( rc == 0 )
+                svg_write_txt( ctx, temp );
+            free( temp );
+        }
+    }
+}
+
+
+static const char * svg_path_fmt_c =
+    "<path d=\"%s\" class=\"%s\"/>\n\n";
+static const char * svg_path_fmt =
+    "<path d=\"%s\"/>\n\n";
+
+static void svg_elem_wr_path( p_svg_elem elem, p_svg_write_ctx ctx )
+{
+    if ( elem != NULL && ctx != NULL &&  elem->txt != NULL )
+    {
+        size_t size = string_size( elem->txt ) + string_size( elem->style ) + 50;
+        char * temp = malloc( size );
+        if ( temp != NULL )
+        {
+            rc_t rc;
+            if ( elem->style != NULL )
+                rc = string_printf( temp, size, NULL, svg_path_fmt_c,
+                        elem->txt, elem->style );
+            else
+                rc = string_printf( temp, size, NULL, svg_path_fmt,
+                        elem->txt );
+            if ( rc == 0 )
+                svg_write_txt( ctx, temp );
+            free( temp );
+        }
+    }
+}
+
+
+rc_t svg_init( p_svg grafic )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( grafic != NULL )
+    {
+        VectorInit ( &grafic->elements, 0, 20 );
+        VectorInit ( &grafic->styles, 0, 5 );
+        rc = 0;
+    }
+    return rc;
+}
+
+
+void svg_destroy( p_svg grafic )
+{
+    if ( grafic != NULL )
+    {
+        VectorWhack ( &grafic->styles, svg_style_whack, NULL );
+        VectorWhack ( &grafic->elements, svg_elem_whack, NULL );
+    }
+}
+
+
+static rc_t svg_write_lines( p_svg_write_ctx ctx, const char ** lines )
+{
+    rc_t rc = 0;
+    const char **s = lines;
+    while ( *s != NULL && rc == 0 )
+    {
+        rc = svg_write_txt( ctx, *s );
+        s++;
+    }
+    return rc;
+}
+
+
+static const char * svg_prefix[] =
+{ 
+    "<?xml version=\"1.0\" standalone=\"no\"?>\n\n",
+    "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
+    "\"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n\n",
+    "<svg width=\"100%\" height=\"100%\" version=\"1.1\"\n",
+    "xmlns=\"http://www.w3.org/2000/svg\">\n\n",
+    NULL
+};
+
+
+static void CC svg_write_elem( void *item, void * data )
+{
+    p_svg_elem elem = item;
+    p_svg_write_ctx ctx = data;
+    if ( elem != NULL && ctx != NULL )
+    {
+        if ( elem->writer != NULL )
+            elem->writer( elem, ctx );
+    }
+}
+
+rc_t svg_write( p_svg grafic, const char * filename )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    if ( grafic != NULL && filename != NULL )
+    {
+        KDirectory * dir;
+        rc = KDirectoryNativeDir ( &dir );
+        if ( rc == 0 )
+        {
+            svg_write_ctx ctx;
+            ctx.pos = 0;
+            rc = KDirectoryCreateFile ( dir, &ctx.f, true, 0664, kcmInit, "%s", filename );
+            if ( rc == 0 )
+            {
+                rc = svg_write_lines( &ctx, svg_prefix );
+                if ( rc == 0 )
+                {
+                    rc = svg_write_styles( &grafic->styles, &ctx );
+                    if ( rc == 0 )
+                    {
+                        VectorForEach ( &grafic->elements, false, svg_write_elem, &ctx );
+                        rc = svg_write_txt( &ctx, "</svg>\n" );
+                    }
+                }
+                KFileRelease( ctx.f );
+            }
+            KDirectoryRelease( dir );
+        }
+    }
+    return rc;
+}
+
+
+rc_t svg_set_style( p_svg grafic, const char * name, const char * style )
+{
+    return svg_add_style( &grafic->styles,
+                          svg_make_style( name, style ) );
+}
+
+
+rc_t svg_circle( p_svg grafic, uint32_t x, uint32_t y, uint32_t r,
+                 const char * style )
+{
+    return svg_add_elem( &grafic->elements,
+                     svg_make_elemv( style, svg_elem_wr_circle,
+                                     3, x, y, r ) );
+}
+
+
+rc_t svg_rect( p_svg grafic, uint32_t x, uint32_t y, uint32_t dx, uint32_t dy,
+               const char * style )
+{
+    return svg_add_elem( &grafic->elements,
+                    svg_make_elemv( style, svg_elem_wr_rect,
+                                    4, x, y, dx, dy ) );
+}
+
+
+rc_t svg_ellipse( p_svg grafic, uint32_t x, uint32_t y, uint32_t rx, uint32_t ry,
+               const char * style )
+{
+    return svg_add_elem( &grafic->elements,
+                    svg_make_elemv( style, svg_elem_wr_ellipse,
+                                    4, x, y, rx, ry ) );
+}
+
+
+rc_t svg_line( p_svg grafic, uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2,
+               const char * style )
+{
+    return svg_add_elem( &grafic->elements,
+                    svg_make_elemv( style, svg_elem_wr_line,
+                                    4, x1, y1, x2, y2 ) );
+}
+
+
+rc_t svg_polyline( p_svg grafic, const char * style,
+                   const uint32_t * values, const uint32_t n_values )
+{
+    return svg_add_elem( &grafic->elements,
+                    svg_make_elem( style, svg_elem_wr_polyline,
+                                   values, n_values ) );
+}
+
+
+rc_t svg_text( p_svg grafic, uint32_t x, uint32_t y, const char * txt,
+               const char * style )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+    p_svg_elem elem = svg_make_elemv( style, svg_elem_wr_text, 2, x, y );
+    if ( elem != NULL )
+    {
+        elem->txt = string_dup_measure ( txt, NULL );
+        rc = svg_add_elem( &grafic->elements, elem );
+    }
+    return rc;
+}
+
+
+rc_t svg_set_path( p_svg grafic, p_svg_path path, const char * style )
+{
+    rc_t rc = RC( rcExe, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+    p_svg_elem elem = svg_make_elem( style, svg_elem_wr_path, NULL, 0 );
+    if ( elem != NULL )
+    {
+        elem->txt = string_dup_measure ( path->buf.ptr, NULL );
+        rc = svg_add_elem( &grafic->elements, elem );
+    }
+    return rc;
+
+}
diff --git a/tools/run-stat/svg.h b/tools/run-stat/svg.h
new file mode 100644
index 0000000..a34ce5b
--- /dev/null
+++ b/tools/run-stat/svg.h
@@ -0,0 +1,117 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_svg_
+#define _h_svg_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <klib/rc.h>
+#include <klib/vector.h>
+#include <helper.h>
+
+typedef struct svg_path
+{
+    char_buffer buf;
+} svg_path;
+typedef svg_path* p_svg_path;
+
+rc_t svg_path_init( p_svg_path path );
+
+void svg_path_destroy( p_svg_path path );
+
+rc_t svg_path_close( p_svg_path path );
+rc_t svg_path_move_to( p_svg_path path, bool absolute, int32_t x, int32_t y );
+rc_t svg_path_line_to( p_svg_path path, bool absolute, int32_t x, int32_t y );
+rc_t svg_path_hline_to( p_svg_path path, bool absolute, int32_t x );
+rc_t svg_path_vline_to( p_svg_path path, bool absolute, int32_t y );
+rc_t svg_path_smooth_to( p_svg_path path, bool absolute, int32_t x, int32_t y );
+
+/* cubic bezier curve (x1,y1 ... control point / x,y ... endpoint )*/
+rc_t svg_path_bez3_to( p_svg_path path, bool absolute,
+                       int32_t x1, int32_t y1, int32_t x, int32_t y );
+
+/* quadratic bezier curve (x1,y1 ... control point / x,y ... endpoint )*/
+rc_t svg_path_bez2_to( p_svg_path path, bool absolute,
+                       int32_t x1, int32_t y1, int32_t x, int32_t y );
+
+/* quadratic bezier curve (x1,y1 x2,y2 ... control point / x,y ... endpoint )*/
+rc_t svg_path_curve_to( p_svg_path path, bool absolute,
+        int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t x, int32_t y );
+
+/* arc ( rx, ry ....... elliptical radius in x/y-direction
+         rotx   ....... rotation around x-axis
+         large-flag ... choose the large section of the arc
+         sweep-flag ... draw in positive-angle-direction
+         x,y .......... endpoint ) */
+rc_t svg_path_arc( p_svg_path path, bool absolute,
+                   int32_t rx, int32_t ry, int32_t rot_x, 
+                   bool large_flag, bool sweep_flag,
+                   int32_t x, int32_t y );
+
+
+typedef struct svg
+{
+    Vector styles;
+    Vector elements;
+} svg;
+typedef svg* p_svg;
+
+rc_t svg_init( p_svg grafic );
+
+void svg_destroy( p_svg grafic );
+
+rc_t svg_set_style( p_svg grafic, const char * name, const char * style );
+
+rc_t svg_circle( p_svg grafic, uint32_t x, uint32_t y, uint32_t r,
+                 const char * style );
+
+rc_t svg_rect( p_svg grafic, uint32_t x, uint32_t y, uint32_t dx, uint32_t dy,
+               const char * style );
+
+rc_t svg_ellipse( p_svg grafic, uint32_t x, uint32_t y, uint32_t rx, uint32_t ry,
+               const char * style );
+
+rc_t svg_line( p_svg grafic, uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2,
+               const char * style );
+
+rc_t svg_polyline( p_svg grafic, const char * style,
+                   const uint32_t * values, const uint32_t n_values );
+
+rc_t svg_text( p_svg grafic, uint32_t x, uint32_t y, const char * txt,
+               const char * style );
+
+rc_t svg_set_path( p_svg grafic, p_svg_path path, const char * style );
+
+rc_t svg_write( p_svg grafic, const char * filename );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/sam-dump/Makefile b/tools/sam-dump/Makefile
index 8d1d212..03f7d69 100644
--- a/tools/sam-dump/Makefile
+++ b/tools/sam-dump/Makefile
@@ -25,7 +25,7 @@
 
 default: std
 
-TOP ?= $(shell ../../build/abspath.sh ../..)
+TOP ?= $(abspath ../..)
 MODULE = tools/sam-dump
 
 include $(TOP)/build/Makefile.env
@@ -100,3 +100,4 @@ SAMDUMP_LIB = \
 
 $(BINDIR)/sam-dump: $(SAMDUMP_OBJ)
 	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(SAMDUMP_LIB)
+
diff --git a/tools/sam-dump/sam-dump.c b/tools/sam-dump/sam-dump.c
index 5c2bf2a..ee96043 100644
--- a/tools/sam-dump/sam-dump.c
+++ b/tools/sam-dump/sam-dump.c
@@ -659,7 +659,7 @@ static void Cache_Unpack( uint64_t val, int64_t mate_id, SCurs const *curs, SCol
 #if 0
 static rc_t OpenVTable( VDatabase const *db, STable* tbl, char const *name, bool optional )
 {
-    rc_t rc = VDatabaseOpenTableRead( db, &tbl->vtbl, name );
+    rc_t rc = VDatabaseOpenTableRead( db, &tbl->vtbl, "%s", name );
     if ( GetRCState( rc ) == rcNotFound && optional )
     {
         rc = 0;
@@ -711,7 +711,7 @@ static rc_t Cursor_Open( STable const *const tbl, SCurs *const curs, SCol cols[]
     {
         if ( cols[ i ].name[ 0 ] == 0 )
             continue;
-        rc = VCursorAddColumn( curs->vcurs, &cols[ i ].idx, cols[ i ].name );
+        rc = VCursorAddColumn( curs->vcurs, &cols[ i ].idx, "%s", cols[ i ].name );
         if ( GetRCObject( rc ) == rcColumn )
         {
             switch ( GetRCState( rc ) )
@@ -3443,7 +3443,7 @@ static rc_t ProcessTable( VDBManager const *mgr, char const fullPath[],
                           char const accession[], char const readGroup[] )
 {
     VTable const *tbl;
-    rc_t rc = VDBManagerOpenTableRead( mgr, &tbl, 0, fullPath );
+    rc_t rc = VDBManagerOpenTableRead( mgr, &tbl, 0, "%s", fullPath );
     
     if ( rc != 0 )
     {
@@ -3452,7 +3452,7 @@ static rc_t ProcessTable( VDBManager const *mgr, char const fullPath[],
         rc = VDBManagerMakeSRASchema( mgr, &schema );
         if ( rc == 0 )
         {
-            rc = VDBManagerOpenTableRead( mgr, &tbl, schema, fullPath );
+            rc = VDBManagerOpenTableRead( mgr, &tbl, schema, "%s", fullPath );
             VSchemaRelease( schema );
         }
     }
@@ -3599,7 +3599,7 @@ static rc_t ProcessDB( VDatabase const *db, char const fullPath[],
     
     if ( ctx.seq.tbl.name )
     {
-        rc = VDatabaseOpenTableRead( db, &ctx.seq.tbl.vtbl, ctx.seq.tbl.name );
+        rc = VDatabaseOpenTableRead( db, &ctx.seq.tbl.vtbl, "%s", ctx.seq.tbl.name );
         if ( rc == 0 )
         {
             ctx.seq.cols = seq_cols;
@@ -3618,13 +3618,13 @@ static rc_t ProcessDB( VDatabase const *db, char const fullPath[],
     SetupColumns( &ctx.eva, edstt_EvidenceAlignment );
     
     if ( ctx.pri.tbl.name )
-        VDatabaseOpenTableRead( db, &ctx.pri.tbl.vtbl, ctx.pri.tbl.name );
+        VDatabaseOpenTableRead( db, &ctx.pri.tbl.vtbl, "%s", ctx.pri.tbl.name );
     if ( ctx.sec.tbl.name )
-        VDatabaseOpenTableRead( db, &ctx.sec.tbl.vtbl, ctx.sec.tbl.name );
+        VDatabaseOpenTableRead( db, &ctx.sec.tbl.vtbl, "%s", ctx.sec.tbl.name );
     if ( ctx.evi.tbl.name )
-        VDatabaseOpenTableRead( db, &ctx.evi.tbl.vtbl, ctx.evi.tbl.name );
+        VDatabaseOpenTableRead( db, &ctx.evi.tbl.vtbl, "%s", ctx.evi.tbl.name );
     if ( ctx.eva.tbl.name )
-        VDatabaseOpenTableRead( db, &ctx.eva.tbl.vtbl, ctx.eva.tbl.name );
+        VDatabaseOpenTableRead( db, &ctx.eva.tbl.vtbl, "%s", ctx.eva.tbl.name );
     
     if (   ctx.pri.tbl.vtbl == NULL
         && ctx.sec.tbl.vtbl == NULL
@@ -3635,7 +3635,7 @@ static rc_t ProcessDB( VDatabase const *db, char const fullPath[],
         if ( ctx.seq.tbl.name == NULL )
         {
             ctx.seq.tbl.name = "SEQUENCE";
-            rc = VDatabaseOpenTableRead( db, &ctx.seq.tbl.vtbl, ctx.seq.tbl.name );
+            rc = VDatabaseOpenTableRead( db, &ctx.seq.tbl.vtbl, "%s", ctx.seq.tbl.name );
         }
         if ( rc == 0 )
         {
@@ -3656,7 +3656,7 @@ static rc_t ProcessDB( VDatabase const *db, char const fullPath[],
     
     if ( ctx.ref.tbl.name )
     {
-        rc = VDatabaseOpenTableRead( db, &ctx.ref.tbl.vtbl, ctx.ref.tbl.name );
+        rc = VDatabaseOpenTableRead( db, &ctx.ref.tbl.vtbl, "%s", ctx.ref.tbl.name );
         ctx.ref.type = edstt_Reference;
     }
     if ( rc == 0 )
@@ -3808,7 +3808,7 @@ static rc_t ProcessPath( VDBManager const *mgr, char const Path[] )
                     break;
                 }
             }
-            rc = VDBManagerOpenDBRead( mgr, &db, NULL, fullPath );
+            rc = VDBManagerOpenDBRead( mgr, &db, NULL, "%s", fullPath );
             if ( rc == 0 )
             {
                 rc = ProcessDB( db, fullPath, accession, readGroup );
@@ -3895,7 +3895,7 @@ static rc_t ProcessPath( VDBManager const *mgr, char const Path[] )
                     break;
                 }
             }
-            rc = VDBManagerOpenDBRead( mgr, &db, NULL, path );
+            rc = VDBManagerOpenDBRead( mgr, &db, NULL, "%s", path );
             if ( rc == 0 )
             {
                 rc = ProcessDB( db, path, accession, readGroup );
@@ -4013,7 +4013,7 @@ static rc_t ProcessPath( VDBManager const *mgr, char const Path[] )
                     {
                         VDatabase const *db;
 
-                        rc = VDBManagerOpenDBRead( mgr, &db, NULL, Path );
+                        rc = VDBManagerOpenDBRead( mgr, &db, NULL, "%s", Path );
                         if ( rc == 0 )
                         {
                             rc = ProcessDB( db, Path, basename, readgroup );
diff --git a/tools/sam-dump/sam-dump.vers b/tools/sam-dump/sam-dump.vers
index 5859406..8e8299d 100644
--- a/tools/sam-dump/sam-dump.vers
+++ b/tools/sam-dump/sam-dump.vers
@@ -1 +1 @@
-2.2.3
+2.4.2
diff --git a/tools/sra-dbcc/Makefile b/tools/sra-dbcc/Makefile
index cb3c92d..4d4646e 100644
--- a/tools/sra-dbcc/Makefile
+++ b/tools/sra-dbcc/Makefile
@@ -25,13 +25,14 @@
 
 default: std
 
-TOP ?= $(shell ../../build/abspath.sh ../..)
+TOP ?= $(abspath ../..)
 MODULE = tools/sra-dbcc
 
 include $(TOP)/build/Makefile.env
 
 INT_TOOLS = \
 
+
 EXT_TOOLS = \
 	sra-dbcc
 
@@ -98,3 +99,4 @@ sra-dbcc.vers.h: sra-dbcc.vers
 
 $(BINDIR)/sra-dbcc: $(SRA_DBCC_OBJ)
 	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(SRA_DBCC_LIB)
+
diff --git a/tools/sra-dbcc/sra-dbcc.c b/tools/sra-dbcc/sra-dbcc.c
index 869a787..50a90b4 100644
--- a/tools/sra-dbcc/sra-dbcc.c
+++ b/tools/sra-dbcc/sra-dbcc.c
@@ -328,13 +328,13 @@ rc_t kdbcc(const KDirectory *dir, char const name[], uint32_t mode, bool *is_db,
         ctx.nodes = &nodes[0];
         ctx.names = &names[0];
 
-        * is_db = KDBManagerExists ( mgr, kptDatabase, name );
+        * is_db = KDBManagerExists ( mgr, kptDatabase, "%s", name );
         if ( * is_db )
         {
             const KDatabase *db;
             
             objtype = "database";
-            rc = KDBManagerOpenDBRead ( mgr, & db, name );
+            rc = KDBManagerOpenDBRead ( mgr, & db, "%s", name );
             if ( rc == 0 )
             {
                 rc = KDatabaseConsistencyCheck ( db, 0, level, report, & ctx );
@@ -351,7 +351,7 @@ rc_t kdbcc(const KDirectory *dir, char const name[], uint32_t mode, bool *is_db,
             const KTable *tbl;
 
             objtype = "table";
-            rc = KDBManagerOpenTableRead ( mgr, & tbl, name );
+            rc = KDBManagerOpenTableRead ( mgr, & tbl, "%s", name );
             if ( rc == 0 )
             {
                 rc = KTableConsistencyCheck ( tbl, 0, level, report, & ctx,
@@ -390,7 +390,7 @@ rc_t vdbcc(const KDirectory *dir, char const name[], uint32_t mode, bool is_db,
         if (rc == 0) {
             const VTable *tbl;
             
-            rc = VDBManagerOpenTableRead(mgr, &tbl, NULL, name);
+            rc = VDBManagerOpenTableRead(mgr, &tbl, NULL, "%s", name);
             if (rc == 0)
                 rc = VTableConsistencyCheck(tbl, 2);
         }
@@ -460,12 +460,12 @@ static rc_t init_dbcc(KDirectory const *dir, char const name[], bool is_file, no
     rc_t rc;
     
     if (is_file) {
-        rc = KDirectoryOpenSraArchiveRead_silent(dir, &obj, false, name);
+        rc = KDirectoryOpenSraArchiveRead_silent(dir, &obj, false, "%s", name);
         if (rc)
-            rc = KDirectoryOpenTarArchiveRead_silent(dir, &obj, false, name);
+            rc = KDirectoryOpenTarArchiveRead_silent(dir, &obj, false, "%s", name);
     }
     else {
-        rc = KDirectoryOpenDirRead(dir, &obj, false, name);
+        rc = KDirectoryOpenDirRead(dir, &obj, false, "%s", name);
     }
     if (rc)
         return rc;
@@ -553,7 +553,7 @@ static rc_t sra_dbcc_fastq(VTable const *tbl, char const name[])
         memset(cols, 0, sizeof(cols));
         for (i = 0; i < n; ++i) {
             cols[i].name = cn_FastQ[i];
-            VCursorAddColumn(curs, &cols[i].idx, cols[i].name);
+            VCursorAddColumn(curs, &cols[i].idx, "%s", cols[i].name);
         }
         rc = VCursorOpen(curs);
         if (rc == 0) {
@@ -650,7 +650,7 @@ static rc_t verify_mgr_table(VDBManager const *mgr, char const name[])
     VSchema *sra_schema = NULL;
     
     for ( ; ; ) {
-        rc_t rc = VDBManagerOpenTableRead(mgr, &tbl, sra_schema, name);
+        rc_t rc = VDBManagerOpenTableRead(mgr, &tbl, sra_schema, "%s", name);
         VSchemaRelease(sra_schema);
         if (rc == 0) {
             rc = verify_table(tbl, name);
@@ -675,7 +675,7 @@ static rc_t verify_mgr_table(VDBManager const *mgr, char const name[])
 static rc_t verify_db_table(VDatabase const *db, char const name[])
 {
     VTable const *tbl;
-    rc_t rc = VDatabaseOpenTableRead(db, &tbl, name);
+    rc_t rc = VDatabaseOpenTableRead(db, &tbl, "%s", name);
     
     if (rc == 0) {
         rc = verify_table(tbl, name);
@@ -715,7 +715,7 @@ static rc_t align_dbcc_primary_alignment(VTable const *tbl, char const name[])
         memset(cols, 0, sizeof(cols));
         for (i = 0; i < n; ++i) {
             cols[i].name = cn_SAM[i];
-            VCursorAddColumn(curs, &cols[i].idx, cols[i].name);
+            VCursorAddColumn(curs, &cols[i].idx, "%s", cols[i].name);
         }
         rc = VCursorOpen(curs);
         if (rc == 0) {
@@ -813,7 +813,7 @@ static rc_t ric_align_ref_and_align(char const dbname[],
                 
                 rc = VTableCreateCursorRead(ref, &curs);
                 if (rc == 0)
-                    rc = VCursorAddColumn(curs, &ci.idx, id_col_name);
+                    rc = VCursorAddColumn(curs, &ci.idx, "%s", id_col_name);
                 if (rc == 0)
                     rc = VCursorOpen(curs);
                 if (rc == 0)
@@ -1134,7 +1134,7 @@ static rc_t verify_database(VDatabase const *db, char const name[], node_t const
 static rc_t verify_mgr_database(VDBManager const *mgr, char const name[], node_t const nodes[], char const names[])
 {
     VDatabase const *child;
-    rc_t rc = VDBManagerOpenDBRead(mgr, &child, NULL, name);
+    rc_t rc = VDBManagerOpenDBRead(mgr, &child, NULL, "%s", name);
     
     if (rc == 0) {
         rc = verify_database(child, name, nodes, names);
@@ -1176,7 +1176,7 @@ rc_t get_platform(const KDirectory *dir, const VDBManager *aMgr,
     if (tbl == NULL) {
         VSchema *sra_schema = NULL;
         for ( ; rc == 0; ) {
-            rc = VDBManagerOpenTableRead(mgr, &tbl, sra_schema, name);
+            rc = VDBManagerOpenTableRead(mgr, &tbl, sra_schema, "%s", name);
             VSchemaRelease(sra_schema);
             if (rc == 0) {
                 rc = VTable_get_platform(tbl, platform);
@@ -1376,7 +1376,7 @@ rc_t CC KMain ( int argc, char *argv [] )
                 else
                 {
                     uint32_t type
-                        = KDirectoryPathType(dir, src_path) & ~kptAlias;
+                        = KDirectoryPathType(dir, "%s", src_path) & ~kptAlias;
                     if (type != kptFile && type != kptDir) {
                         /* check for accession */
                         VPath *acc = NULL;
@@ -1432,7 +1432,7 @@ rc_t CC KMain ( int argc, char *argv [] )
                     else {
                         char full[PATH_MAX];
                         rc = KDirectoryResolvePath(dir, true,
-                            full, sizeof full, src_path);
+                                                   full, sizeof full, "%s", src_path);
                         if (rc == 0) {
                             PLOGMSG(klogInfo, (klogInfo,
                                 "Validating '$(path)'...", PLOG_S(path),
@@ -1465,7 +1465,7 @@ rc_t CC KMain ( int argc, char *argv [] )
                     }
                 }
                 
-                rc = KDirectoryOpenDirRead(dir, &src_dir, false, src_dir_path);
+                rc = KDirectoryOpenDirRead(dir, &src_dir, false, "%s", src_dir_path);
                 KDirectoryRelease(dir);
                 if (rc) {
                     (void)PLOGERR(klogErr, (klogErr, rc,
@@ -1473,7 +1473,7 @@ rc_t CC KMain ( int argc, char *argv [] )
                     break;
                 }
                 else {
-                    uint32_t const obj_type = KDirectoryPathType(src_dir, obj_name) & (~((uint32_t)kptAlias));
+                    uint32_t const obj_type = KDirectoryPathType(src_dir, "%s", obj_name) & (~((uint32_t)kptAlias));
                     
                     switch (obj_type) {
                     case kptFile:
diff --git a/tools/sra-dbcc/sra-dbcc.vers b/tools/sra-dbcc/sra-dbcc.vers
index cc6c9a4..8e8299d 100644
--- a/tools/sra-dbcc/sra-dbcc.vers
+++ b/tools/sra-dbcc/sra-dbcc.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/sra-dump/.gitignore b/tools/sra-dump/.gitignore
new file mode 100644
index 0000000..c97f963
--- /dev/null
+++ b/tools/sra-dump/.gitignore
@@ -0,0 +1 @@
+*.sh
diff --git a/tools/sra-dump/Makefile b/tools/sra-dump/Makefile
index 13c5713..a9d0abb 100644
--- a/tools/sra-dump/Makefile
+++ b/tools/sra-dump/Makefile
@@ -25,7 +25,7 @@
 
 default: std
 
-TOP ?= $(shell ../../build/abspath.sh ../..)
+TOP ?= $(abspath ../..)
 MODULE = tools/sra-dump
 
 include $(TOP)/build/Makefile.env
@@ -85,8 +85,7 @@ DUMP_COMMON_SRC = \
 
 DUMP_COMMON_LIB = \
 	-lkapp \
-	-lncbi-vdb \
-	-lxml2 \
+	-sncbi-vdb \
 	-lm
 
 #-------------------------------------------------------------------------------
diff --git a/tools/sra-dump/abi-dump.vers b/tools/sra-dump/abi-dump.vers
index cc6c9a4..8e8299d 100644
--- a/tools/sra-dump/abi-dump.vers
+++ b/tools/sra-dump/abi-dump.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/sra-dump/abi-dump.vers.h b/tools/sra-dump/abi-dump.vers.h
new file mode 100644
index 0000000..bfbcf41
--- /dev/null
+++ b/tools/sra-dump/abi-dump.vers.h
@@ -0,0 +1 @@
+#define ABI_DUMP_VERS 0x02040002
diff --git a/tools/sra-dump/abi.c b/tools/sra-dump/abi.c
index 39e2715..7fd50b9 100644
--- a/tools/sra-dump/abi.c
+++ b/tools/sra-dump/abi.c
@@ -806,7 +806,7 @@ rc_t AbsolidDumper_Factories(const SRADumperFmt* fmt, const SRASplitterFactory**
                 }
             }
             SRAColumnRelease(c);
-        } else if( GetRCState(rc) == rcNotFound && GetRCObject(rc) == rcColumn ) {
+        } else if( GetRCState(rc) == rcNotFound && GetRCObject(rc) == ( enum RCObject )rcColumn ) {
             rc = 0;
         }
     }
diff --git a/tools/sra-dump/core.c b/tools/sra-dump/core.c
index a8dbde3..fdf807b 100644
--- a/tools/sra-dump/core.c
+++ b/tools/sra-dump/core.c
@@ -31,14 +31,17 @@
 #include <vdb/vdb-priv.h> /* VDBManagerDisablePagemapThread() */
 #include <kdb/manager.h> /* for different path-types */
 #include <vdb/dependencies.h> /* UIError */
-#include <klib/report.h> /* ReportInit */
 #include <vdb/report.h>
 #include <vdb/database.h>
+
 #include <klib/container.h>
 #include <klib/log.h>
+#include <klib/misc.h> /* SetHttpTries */
+#include <klib/report.h> /* ReportInit */
 #include <klib/out.h>
 #include <klib/status.h>
 #include <klib/text.h>
+
 #include <kapp/main.h>
 #include <kfs/directory.h>
 #include <sra/sradb-priv.h>
@@ -643,7 +646,7 @@ static rc_t SRADumper_DumpRun( const SRATable* table,
             if ( ( GetRCModule( rc ) == rcXF ) &&
                  ( GetRCTarget( rc ) == rcFunction ) &&
                  ( GetRCContext( rc ) == rcExecuting ) &&
-                 ( GetRCObject( rc ) == rcData ) &&
+                 ( GetRCObject( rc ) == ( enum RCObject )rcData ) &&
                  ( GetRCState( rc ) == rcInconsistent ) )
             {
                 rc = 0;
@@ -684,6 +687,7 @@ static const SRADumperFmt_Arg KMainArgs[] =
                                                   "Current/default is warn", NULL } },
     { "v",   "verbose",         NULL,           { "Increase the verbosity level of the program",
                                                    "Use multiple times for more verbosity", NULL } },
+    { NULL,   TRIES_OPTION,     TRIES_ARGUMENT, { TRIES_HELP, NULL } },
     { NULL, OPTION_REPORT,     NULL,           { "Control program execution environment report generation (if implemented).",
                                                    "One of (never|error|always). Default is error", NULL } },
 #if _DEBUGGING
@@ -923,7 +927,7 @@ static bool database_contains_table_name( const VDBManager * vmgr, const char *
     if ( ( vmgr != NULL ) && ( acc_or_path != NULL ) && ( tablename != NULL ) )
     {
         const VDatabase * db;
-        rc_t rc = VDBManagerOpenDBRead( vmgr, &db, NULL, acc_or_path );
+        rc_t rc = VDBManagerOpenDBRead( vmgr, &db, NULL, "%s", acc_or_path );
         if ( rc == 0 )
         {
             KNamelist * tbl_names;
@@ -1066,6 +1070,11 @@ rc_t CC KMain ( int argc, char* argv[] )
                 goto Catch;
             }
         }
+        else if
+            (SRADumper_GetArg(&fmt, NULL, TRIES_OPTION, &i, argc, argv, &arg ))
+        {
+            SetHttpTries(AsciiToU32(arg, NULL, NULL));
+        }
         else if ( SRADumper_GetArg( &fmt, NULL, "disable-multithreading", &i, argc, argv, NULL ) )
         {
             no_mt = true;
@@ -1351,7 +1360,7 @@ rc_t CC KMain ( int argc, char* argv[] )
             a CONSENSUS-table ( only PacBio-Runs have one ! )...
         */
 
-        path_type = ( VDBManagerPathType ( vmgr, table_path[ i ] ) & ~ kptAlias );
+        path_type = ( VDBManagerPathType ( vmgr, "%s", table_path[ i ] ) & ~ kptAlias );
         switch ( path_type )
         {
             case kptDatabase        :   ;   /* types defined in <kdb/manager.h> */
@@ -1376,7 +1385,7 @@ rc_t CC KMain ( int argc, char* argv[] )
             }
             if ( table_to_open != NULL )
             {
-                rc = SRAMgrOpenAltTableRead( sraMGR, &fmt.table, table_to_open, table_path[ i ] ); /* from sradb-priv.h */
+                rc = SRAMgrOpenAltTableRead( sraMGR, &fmt.table, table_to_open, "%s", table_path[ i ] ); /* from sradb-priv.h */
                 if ( rc != 0 )
                 {
                     PLOGERR( klogErr, ( klogErr, rc, 
@@ -1392,7 +1401,7 @@ rc_t CC KMain ( int argc, char* argv[] )
 
         if ( fmt.table == NULL )
         {
-            rc = SRAMgrOpenTableRead( sraMGR, &fmt.table, table_path[ i ] );
+            rc = SRAMgrOpenTableRead( sraMGR, &fmt.table, "%s", table_path[ i ] );
             if ( rc != 0 )
             {
                 if ( UIError( rc, NULL, NULL ) )
@@ -1552,7 +1561,7 @@ rc_t CC KMain ( int argc, char* argv[] )
                     }
                     SRAColumnRelease( c );
                 }
-                else if ( GetRCState( rc ) == rcNotFound && GetRCObject( rc ) == rcColumn )
+                else if ( GetRCState( rc ) == rcNotFound && GetRCObject( rc ) == ( enum RCObject )rcColumn )
                 {
                     rc = 0;
                 }
diff --git a/tools/sra-dump/factory.c b/tools/sra-dump/factory.c
index 96e6b95..9404435 100644
--- a/tools/sra-dump/factory.c
+++ b/tools/sra-dump/factory.c
@@ -376,9 +376,9 @@ rc_t SRASplitterFiler_GetCurrFile(const SRASplitterFile** out_file)
                     if( g_filer->path[i][0] != '\0' ) {
                         char* ndir = NULL;
                         if( (rc = SRASplitterFiler_FixFSName(g_filer->path[i], &ndir)) == 0 ) {
-                            if( (rc = KDirectoryCreateDir(sub, 0775, kcmCreate, ndir)) == 0 ||
-                                (GetRCObject(rc) == rcDirectory && GetRCState(rc) == rcExists) ) {
-                                if( (rc = KDirectoryOpenDirUpdate(sub, &file->dir, true, ndir)) == 0 ) {
+                            if( (rc = KDirectoryCreateDir(sub, 0775, kcmCreate, "%s", ndir)) == 0 ||
+                                (GetRCObject(rc) == ( enum RCObject )rcDirectory && GetRCState(rc) == rcExists) ) {
+                                if( (rc = KDirectoryOpenDirUpdate(sub, &file->dir, true, "%s", ndir)) == 0 ) {
                                     KDirectoryRelease(i == 0 ? NULL : sub);
                                     sub = file->dir;
                                 }
@@ -483,7 +483,7 @@ rc_t SRASplitterFactory_FilerInit(bool to_stdout, bool gzip, bool bzip2, bool ke
                 va_list args;
                 va_start(args, path);
                 if( (rc = KDirectoryVCreateDir(g_filer->dir, 0775, kcmCreate | kcmParents, path, args)) == 0 ||
-                    (GetRCObject(rc) == rcDirectory && GetRCState(rc) == rcExists) ) {
+                    (GetRCObject(rc) == ( enum RCObject )rcDirectory && GetRCState(rc) == rcExists) ) {
                     KDirectory* sub = NULL;
                     va_end(args);
                     va_start(args, path);
diff --git a/tools/sra-dump/factory.h b/tools/sra-dump/factory.h
index c315f47..d3075c0 100644
--- a/tools/sra-dump/factory.h
+++ b/tools/sra-dump/factory.h
@@ -36,7 +36,7 @@
 /* KDataBuffer is used as byte buffer-only here! */
 #define IF_BUF(expr, buf, writ) \
     while( (rc = (expr)) != 0 && \
-           (GetRCObject(rc) == rcMemory || GetRCObject(rc) == rcBuffer) && \
+           (GetRCObject(rc) == rcMemory || GetRCObject(rc) == ( enum RCObject )rcBuffer) && \
            (GetRCState(rc) == rcInsufficient || GetRCState(rc) == rcExhausted) ) { \
         SRA_DUMP_DBG(10, ("\n%s grow buffer from %u to %u\n", __func__, buf->elem_count, writ + DATABUFFER_INC_SZ)); \
         if( (rc = KDataBufferResize(buf, writ + DATABUFFER_INC_SZ)) != 0 ) { \
diff --git a/tools/sra-dump/fastq-dump.vers b/tools/sra-dump/fastq-dump.vers
index cc6c9a4..8e8299d 100644
--- a/tools/sra-dump/fastq-dump.vers
+++ b/tools/sra-dump/fastq-dump.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/sra-dump/fastq-dump.vers.h b/tools/sra-dump/fastq-dump.vers.h
new file mode 100644
index 0000000..c74e051
--- /dev/null
+++ b/tools/sra-dump/fastq-dump.vers.h
@@ -0,0 +1 @@
+#define FASTQ_DUMP_VERS 0x02040002
diff --git a/tools/sra-dump/fastq.c b/tools/sra-dump/fastq.c
index e4e55d7..b415d64 100644
--- a/tools/sra-dump/fastq.c
+++ b/tools/sra-dump/fastq.c
@@ -3425,7 +3425,7 @@ rc_t FastqDumper_Factories( const SRADumperFmt* fmt, const SRASplitterFactory**
             }
             SRAColumnRelease( c );
         }
-        else if ( GetRCState( rc ) == rcNotFound && GetRCObject( rc ) == rcColumn )
+        else if ( GetRCState( rc ) == rcNotFound && GetRCObject( rc ) == ( enum RCObject )rcColumn )
         {
             rc = 0;
         }
diff --git a/tools/sra-dump/illumina-dump.vers b/tools/sra-dump/illumina-dump.vers
index cc6c9a4..8e8299d 100644
--- a/tools/sra-dump/illumina-dump.vers
+++ b/tools/sra-dump/illumina-dump.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/sra-dump/illumina-dump.vers.h b/tools/sra-dump/illumina-dump.vers.h
new file mode 100644
index 0000000..d977721
--- /dev/null
+++ b/tools/sra-dump/illumina-dump.vers.h
@@ -0,0 +1 @@
+#define ILLUMINA_DUMP_VERS 0x02040002
diff --git a/tools/sra-dump/illumina.c b/tools/sra-dump/illumina.c
index 17e8d23..0b76720 100644
--- a/tools/sra-dump/illumina.c
+++ b/tools/sra-dump/illumina.c
@@ -309,23 +309,61 @@ typedef struct IlluminaFormatterFactory_struct {
     KDataBuffer buf;
 } IlluminaFormatterFactory;
 
-static
-rc_t IlluminaFormatterFactory_Init(const SRASplitterFactory* cself)
-{
-    rc_t rc = 0;
-    IlluminaFormatterFactory* self = (IlluminaFormatterFactory*)cself;
+
+/* refactored June 13 2014 by Wolfgang to fix a mysterious bug on windows where b_qseq resolved into false on windows
+   and true on posix! The original code was this:
 
     if( self == NULL ) {
-        rc = RC(rcSRA, rcType, rcConstructing, rcParam, rcNull);
-    } else if( (rc = IlluminaReaderMake(&self->reader, self->table, self->accession,
-                                IlluminaArgs.opt & eRead, IlluminaArgs.opt & (eQual1_S | eQual1_M), IlluminaArgs.opt & eQual4, 
-                                IlluminaArgs.opt & eIntensity, IlluminaArgs.opt & eNoise, IlluminaArgs.opt & eSignal,
-                                IlluminaArgs.opt & (eQSeq_S | eQSeq_M), 0, 0)) == 0 ) {
-        rc = KDataBufferMakeBytes(&self->buf, DATABUFFERINITSIZE);
+          rc = RC(rcSRA, rcType, rcConstructing, rcParam, rcNull);
+      } else if( (rc = IlluminaReaderMake(&self->reader, self->table, self->accession,
+                                  IlluminaArgs.opt & eRead, IlluminaArgs.opt & (eQual1_S | eQual1_M), IlluminaArgs.opt & eQual4, 
+                                  IlluminaArgs.opt & eIntensity, IlluminaArgs.opt & eNoise, IlluminaArgs.opt & eSignal,
+                                  IlluminaArgs.opt & (eQSeq_S | eQSeq_M), 0, 0)) == 0 ) {
+          rc = KDataBufferMakeBytes(&self->buf, DATABUFFERINITSIZE);
+        }
+
+    Anton's old, more dense version should do the same, but it does not on Windows!
+
+    eQSeq_M is an enum, defined at the top of this file to have the value 0x100.
+    It will be type-casted into bool because that is the type IlluminaReaderMake() wants.
+    ( bool )eQSeq_M is true for GCC/LLVM and false for the MS-compiler!
+    Casting enum's directly without comparison into boolean does not work for the MS-compiler.
+*/
+static rc_t IlluminaFormatterFactory_Init( const SRASplitterFactory * cself )
+{
+    rc_t rc = 0;
+    IlluminaFormatterFactory * self = ( IlluminaFormatterFactory * )cself;
+
+    if ( self == NULL )
+        rc = RC( rcSRA, rcType, rcConstructing, rcParam, rcNull );
+    else
+    {
+        bool b_read = ( ( IlluminaArgs.opt & eRead ) != 0 );
+        bool b_qual1 = ( ( IlluminaArgs.opt & ( eQual1_S | eQual1_M ) ) != 0 );
+        bool b_qual4 = ( ( IlluminaArgs.opt & eQual4 ) != 0 );
+        bool b_intensity = ( ( IlluminaArgs.opt & eIntensity ) != 0 );
+        bool b_noise = ( ( IlluminaArgs.opt & eNoise ) != 0 );
+        bool b_signal = ( ( IlluminaArgs.opt & eSignal ) != 0 );
+        bool b_qseq = ( ( IlluminaArgs.opt & ( eQSeq_S | eQSeq_M ) ) != 0 );
+        rc = IlluminaReaderMake( &self->reader,
+                                self->table,
+                                self->accession,
+                                b_read,
+                                b_qual1,
+                                b_qual4,
+                                b_intensity,
+                                b_noise,
+                                b_signal,
+                                b_qseq,
+                                0,
+                                0 );
+        if ( rc == 0 )
+            rc = KDataBufferMakeBytes( &self->buf, DATABUFFERINITSIZE );
     }
     return rc;
 }
 
+
 static
 rc_t IlluminaFormatterFactory_NewObj(const SRASplitterFactory* cself, const SRASplitter** splitter)
 {
diff --git a/tools/sra-dump/sff-dump.vers b/tools/sra-dump/sff-dump.vers
index cc6c9a4..8e8299d 100644
--- a/tools/sra-dump/sff-dump.vers
+++ b/tools/sra-dump/sff-dump.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/sra-dump/sff-dump.vers.h b/tools/sra-dump/sff-dump.vers.h
new file mode 100644
index 0000000..1589515
--- /dev/null
+++ b/tools/sra-dump/sff-dump.vers.h
@@ -0,0 +1 @@
+#define SFF_DUMP_VERS 0x02040002
diff --git a/tools/sra-dump/sra-dump.c b/tools/sra-dump/sra-dump.c
index 8355511..c2a8f09 100644
--- a/tools/sra-dump/sra-dump.c
+++ b/tools/sra-dump/sra-dump.c
@@ -774,7 +774,7 @@ rc_t run ( sradump_parms *pb )
         else
         {
             const SRATable *tbl;
-            rc = SRAMgrOpenTableRead ( mgr, & tbl, pb -> src_path );
+            rc = SRAMgrOpenTableRead ( mgr, & tbl, "%s", pb -> src_path );
             if ( rc != 0 )
                 PLOGERR ( klogInt,
                           ( klogInt, rc, "failed to open SRATable '$(spec)'", "spec=%s", pb -> src_path));
diff --git a/tools/sra-dump/sra-dump.vers b/tools/sra-dump/sra-dump.vers
index cc6c9a4..8e8299d 100644
--- a/tools/sra-dump/sra-dump.vers
+++ b/tools/sra-dump/sra-dump.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/sra-load/Makefile b/tools/sra-load/Makefile
index 02805e8..fa486fd 100644
--- a/tools/sra-load/Makefile
+++ b/tools/sra-load/Makefile
@@ -24,7 +24,7 @@
 
 default: std
 
-TOP ?= $(shell ../../build/abspath.sh ../..)
+TOP ?= $(abspath ../..)
 MODULE = tools/sra-load
 
 include $(TOP)/build/Makefile.env
@@ -37,7 +37,8 @@ EXT_TOOLS = \
 	srf-load \
 	abi-load \
 	sff-load \
-	helicos-load
+	helicos-load \
+	pacbio-loadxml
 
 ALL_TOOLS = \
 	$(INT_TOOLS) \
@@ -98,10 +99,12 @@ LOADER_SRC = \
 LOADER_OBJ = \
 	$(addsuffix .$(OBJX),$(LOADER_SRC))
 
+LIBXML = -lkxfs -lkxml -lxml2
+    
 LOADER_LIB = \
 	-lkapp \
 	-lload \
-	-lncbi-wvdb \
+	-sncbi-wvdb \
 	$(LIBXML) \
 	-lm
 
@@ -199,3 +202,16 @@ HELICOS_LOAD_OBJ = \
 
 $(BINDIR)/helicos-load: $(HELICOS_LOAD_OBJ)
 	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(LOADER_LIB)
+
+#------------------------------------------------------------------------------
+# pacbio-loadxml
+#
+PACBIO_LOADXML_SRC = \
+	$(LOADER_SRC) \
+	pacbio-fmt
+
+PACBIO_LOADXML_OBJ = \
+	$(addsuffix .$(OBJX),$(PACBIO_LOADXML_SRC))
+
+$(BINDIR)/pacbio-loadxml: $(PACBIO_LOADXML_OBJ)
+	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(LOADER_LIB)
diff --git a/tools/sra-load/abi-load.vers b/tools/sra-load/abi-load.vers
index cc6c9a4..8e8299d 100644
--- a/tools/sra-load/abi-load.vers
+++ b/tools/sra-load/abi-load.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/sra-load/common-xml.c b/tools/sra-load/common-xml.c
index 9b1b389..51366ad 100644
--- a/tools/sra-load/common-xml.c
+++ b/tools/sra-load/common-xml.c
@@ -337,12 +337,12 @@ rc_t parse_BASECALL(const KXMLNode* node, ReadSpecXML_read_BASECALL_TABLE* table
         return rc;
     }
     rc = KXMLNodeReadAttrCStr(node, "read_group_tag", &bc.read_group_tag, NULL);
-    if( rc != 0 && !(GetRCObject(rc) == rcAttr && GetRCState(rc) == rcNotFound) ) {
+    if( rc != 0 && !(GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound) ) {
         LOGERR(klogErr, rc, "BASECALL @read_group_tag");
         return rc;
     }
     rc = KXMLNodeReadAttrAsU32(node, "min_match", &bc.min_match);
-    if( rc != 0 && !(GetRCObject(rc) == rcAttr && GetRCState(rc) == rcNotFound) ) {
+    if( rc != 0 && !(GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound) ) {
         LOGERR(klogErr, rc, "BASECALL @min_match");
         return rc;
     } else if(bc.min_match > strlen(bc.basecall)) {
@@ -353,7 +353,7 @@ rc_t parse_BASECALL(const KXMLNode* node, ReadSpecXML_read_BASECALL_TABLE* table
         bc.min_match = strlen(bc.basecall);
     }
     rc = KXMLNodeReadAttrAsU32(node, "max_mismatch", &bc.max_mismatch);
-    if( rc != 0 && !(GetRCObject(rc) == rcAttr && GetRCState(rc) == rcNotFound) ) {
+    if( rc != 0 && !(GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound) ) {
         LOGERR(klogErr, rc, "BASECALL @max_mismatch");
         return rc;
     } else if(bc.max_mismatch >= strlen(bc.basecall)) {
@@ -368,7 +368,7 @@ rc_t parse_BASECALL(const KXMLNode* node, ReadSpecXML_read_BASECALL_TABLE* table
         bc.min_match = strlen(bc.basecall) - bc.max_mismatch;
     }
     rc = KXMLNodeReadAttrCStr(node, "match_edge", &match_edge, NULL);
-    if( rc != 0 && !(GetRCObject(rc) == rcAttr && GetRCState(rc) == rcNotFound) ) {
+    if( rc != 0 && !(GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound) ) {
         LOGERR(klogErr, rc, "BASECALL @match_edge");
     } else if( match_edge == NULL || strcmp(match_edge, "full") == 0 ) {
         bc.match_edge = match_edge_Full;
diff --git a/tools/sra-load/experiment-xml.c b/tools/sra-load/experiment-xml.c
index 3995c90..567ee1b 100644
--- a/tools/sra-load/experiment-xml.c
+++ b/tools/sra-load/experiment-xml.c
@@ -1228,7 +1228,7 @@ rc_t Experiment_ReadSegDefault(const ExperimentXML* self, SRASegment* seg)
             spot_len -= len;
             if( spot_len < 0 || len < 0 ) {
                 rc = RC(rcSRA, rcFormatter, rcConstructing, rcData, rcInconsistent);
-                LOGERR(klogErr, rc, "cummulative read lengths and SEQUENCE_LENGTH");
+                LOGERR(klogErr, rc, "cumulative read lengths and SEQUENCE_LENGTH");
                 return rc;
             } else {
                 seg[i].start = spot_len;
diff --git a/tools/sra-load/fastq-load.vers b/tools/sra-load/fastq-load.vers
index cc6c9a4..8e8299d 100644
--- a/tools/sra-load/fastq-load.vers
+++ b/tools/sra-load/fastq-load.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/sra-load/helicos-load.vers b/tools/sra-load/helicos-load.vers
index cc6c9a4..8e8299d 100644
--- a/tools/sra-load/helicos-load.vers
+++ b/tools/sra-load/helicos-load.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/sra-load/illumina-load.vers b/tools/sra-load/illumina-load.vers
index cc6c9a4..8e8299d 100644
--- a/tools/sra-load/illumina-load.vers
+++ b/tools/sra-load/illumina-load.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/sra-load/loader.c b/tools/sra-load/loader.c
index 9c9c888..b838444 100644
--- a/tools/sra-load/loader.c
+++ b/tools/sra-load/loader.c
@@ -498,7 +498,7 @@ static rc_t s_KXMLDocMake(const KXMLDoc **doc, const char *path)
         return RC(rcExe, rcXmlDoc, rcConstructing, rcParam, rcNull);
     }
     if (rc == 0) {
-        rc = KDirectoryOpenFileRead(s_Directory, &file, path);
+        rc = KDirectoryOpenFileRead(s_Directory, &file, "%s", path);
         if (rc != 0) {
             PLOGERR(klogErr, (klogErr, rc, "Cannot open file $(file)", "file=%s", path));
         }
@@ -706,7 +706,7 @@ rc_t SInputOpen_TarVisit(const KDirectory *dir, uint32_t type, const char *name,
         }
         if( rc == 0 ) {
             char buf[1024];
-            if( (rc = KDirectoryResolvePath(dir, true, buf, sizeof(buf), name)) == 0 ) { 
+            if( (rc = KDirectoryResolvePath(dir, true, buf, sizeof(buf), "%s", name)) == 0 ) { 
                 d->files[d->count++] = strdup(buf);
                 if( d->files[d->count - 1] == NULL ) {
                     rc = RC(rcExe, rcStorage, rcAllocating, rcMemory, rcExhausted);
@@ -770,7 +770,7 @@ rc_t SInputOpen(const SInput **cself, TArgs *args)
                                     int r = snprintf(base_path, sizeof base_path, "%s/", b->files[j].cc_xml);
                                     if (r >= sizeof base_path) {
                                         rc = RC(rcExe, rcStorage, rcAllocating, rcFile, rcTooLong);
-                                    } else if ((rc = KDirectoryOpenXTocDirRead(args->_input_dir, &ccdirs[ccdirs_qty].xdir, false, kf, base_path)) == 0 ) {
+                                    } else if ((rc = KDirectoryOpenXTocDirRead(args->_input_dir, &ccdirs[ccdirs_qty].xdir, false, kf, "%s", base_path)) == 0 ) {
                                         cd = ccdirs_qty++;
                                         ccdirs[cd].uid = b->files[j].cc_xml;
                                         KFileRelease(kf);
@@ -1053,7 +1053,7 @@ rc_t KMain(int argc, char *argv[])
                 }
                 if (rc == 0) {
                     rc = SRATableCommit(table);
-                    if( GetRCObject(rc) == rcCursor && GetRCState(rc) == rcNotOpen ) {
+                    if( GetRCObject(rc) == (enum RCObject)rcCursor && GetRCState(rc) == rcNotOpen ) {
                         rc = 0;
                     }
                 }
diff --git a/tools/sra-load/pacbio-fmt.c b/tools/sra-load/pacbio-fmt.c
new file mode 100644
index 0000000..bfbc6fa
--- /dev/null
+++ b/tools/sra-load/pacbio-fmt.c
@@ -0,0 +1,146 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#include <klib/log.h>
+#include <klib/rc.h>
+#include <klib/text.h>
+#include <os-native.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <string.h>
+#include <errno.h>
+#include <limits.h>
+
+typedef struct PacBioLoaderXmlFmt PacBioLoaderXmlFmt;
+#define SRALOADERFMT_IMPL PacBioLoaderXmlFmt
+#include "loader-fmt.h"
+
+#include "pacbio-loadxml.vers.h"
+#include "debug.h"
+
+struct PacBioLoaderXmlFmt {
+    SRALoaderFmt dad;
+};
+
+static
+rc_t PacBioLoaderXmlFmt_ExecPrep(const PacBioLoaderXmlFmt *self, const TArgs* args, const SInput* input,
+                                 const char** path, const char* eargs[], size_t max_eargs)
+{
+    rc_t rc = 0;
+    uint32_t i = 0;
+    ERunFileType type = rft_Unknown;
+
+    *path = "pacbio-load";
+
+    /* accept only single file submissions */
+    if( input->count != 1 ) {
+        rc = RC(rcSRA, rcFormatter, rcExecuting, rcParam, input->count ? rcExcessive : rcInsufficient);
+    } else if( input->blocks[0].count != 1 ) {
+        rc = RC(rcSRA, rcFormatter, rcExecuting, rcParam, input->blocks[0].count ? rcExcessive : rcInsufficient);
+    } else if( (rc = SRALoaderFile_FileType(input->blocks[0].files[0], &type)) == 0 && type != rft_PacBio_HDF5 ) {
+        rc = RC(rcSRA, rcFormatter, rcExecuting, rcFormat, rcUnsupported);
+    } else {
+        char resolved[4096];
+        size_t il = string_copy_measure(resolved, sizeof(resolved), args->_input_path);
+        resolved[il++] = '/';
+        if( (rc = SRALoaderFileResolveName(input->blocks[0].files[0], &resolved[il], sizeof(resolved) - il)) == 0 ) {
+            eargs[i] = strdup(resolved);
+            if( eargs[i++] == NULL ) {
+                rc = RC(rcSRA, rcFormatter, rcExecuting, rcMemory, rcExhausted);
+            }
+        }
+        if( rc == 0 ) {
+            eargs[i++] = "-o";
+            eargs[i++] = args->_target;
+
+            if( args->_force_target ) {
+                eargs[i++] = "-f";
+            }
+            eargs[i] = NULL;
+        }
+    }
+    return rc;
+}
+
+static
+rc_t PacBioLoaderXmlFmt_Whack(PacBioLoaderXmlFmt *self, SRATable** table)
+{
+    free(self);
+    return 0;
+}
+
+const char UsageDefaultName[] = "pacbio-loadxml";
+
+uint32_t KAppVersion(void)
+{
+    return PACBIO_LOADXML_VERS;
+}
+
+static
+rc_t PacBioLoaderXmlFmt_Version (const PacBioLoaderXmlFmt* self, uint32_t *vers, const char** name )
+{
+    *vers = PACBIO_LOADXML_VERS;
+    *name = "PacBioXml";
+    return 0;
+}
+
+static SRALoaderFmt_vt_v1 vtPacBioLoaderXmlFmt =
+{
+    1, 0,
+    PacBioLoaderXmlFmt_Whack,
+    PacBioLoaderXmlFmt_Version,
+    PacBioLoaderXmlFmt_ExecPrep,
+    NULL
+};
+
+rc_t SRALoaderFmtMake(SRALoaderFmt **self, const SRALoaderConfig *config)
+{
+    rc_t rc = 0;
+    const PlatformXML* platform;
+
+    if( self == NULL || config == NULL ) {
+        rc = RC(rcSRA, rcFormatter, rcConstructing, rcParam, rcNull);
+    } else if( (rc = Experiment_GetPlatform(config->experiment, &platform)) != 0 ) {
+    } else if( platform->id != SRA_PLATFORM_PACBIO_SMRT ) {
+        rc = RC(rcSRA, rcFormatter, rcConstructing, rcParam, rcInvalid);
+        LOGERR(klogInt, rc, "platform type");
+    } else {
+        PacBioLoaderXmlFmt* fmt;
+
+        *self = NULL;
+        fmt = calloc(1, sizeof(*fmt));
+        if(fmt == NULL) {
+            rc = RC(rcSRA, rcFormatter, rcConstructing, rcMemory, rcExhausted);
+        } else if( (rc = SRALoaderFmtInit(&fmt->dad, (const SRALoaderFmt_vt*)&vtPacBioLoaderXmlFmt)) != 0 ) {
+            LOGERR(klogInt, rc, "failed to initialize parent object");
+            PacBioLoaderXmlFmt_Whack(fmt, NULL);
+        } else {
+            *self = &fmt->dad;
+        }
+    }
+    return rc;
+}
diff --git a/tools/sra-load/pacbio-loadxml.vers b/tools/sra-load/pacbio-loadxml.vers
index cc6c9a4..8e8299d 100644
--- a/tools/sra-load/pacbio-loadxml.vers
+++ b/tools/sra-load/pacbio-loadxml.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/sra-load/run-xml.c b/tools/sra-load/run-xml.c
index 12399eb..2c97ee1 100644
--- a/tools/sra-load/run-xml.c
+++ b/tools/sra-load/run-xml.c
@@ -122,14 +122,14 @@ rc_t parse_FILE(const KXMLNode* FILE, DataBlockFile* file)
 
 /* <!-- custom pipeline attributes, not from schema! */
     } else if( (rc = KXMLNodeReadAttrCStr(FILE, "upload_id", &file->cc_xml, NULL)) != 0 &&
-               !(GetRCObject(rc) == rcAttr && GetRCState(rc) == rcNotFound) ) {
+               !(GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound) ) {
         PLOGERR(klogErr, (klogErr, rc, "FILE $(file) @upload_id", PLOG_S(file), file->filename));
     } else if( file->cc_xml != NULL && file->cc_xml[0] == '\0' ) {
         rc = RC(rcExe, rcStorage, rcConstructing, rcTag, rcInvalid);
         PLOGERR(klogErr, (klogErr, rc, "FILE $(file) @upload_id", PLOG_S(file), file->filename));
 
     } else if( (rc = KXMLNodeReadAttrCStr(FILE, "cc_path", &file->cc_path, NULL)) != 0 &&
-                !(GetRCObject(rc) == rcAttr && GetRCState(rc) == rcNotFound) ) {
+                !(GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound) ) {
         PLOGERR(klogErr, (klogErr, rc, "FILE $(file) @cc_path", PLOG_S(file), file->filename));
     } else if( ((file->cc_path == NULL || file->cc_path[0] == '\0') && file->cc_xml != NULL) || 
                 (file->cc_path != NULL && file->cc_xml == NULL) ) {
@@ -138,20 +138,20 @@ rc_t parse_FILE(const KXMLNode* FILE, DataBlockFile* file)
 /* --> */
 
     } else if( (rc = KXMLNodeReadAttrCStr(FILE, "quality_scoring_system", &quality_scoring_system, NULL)) != 0 &&
-                !(GetRCObject(rc) == rcAttr && GetRCState(rc) == rcNotFound) ) {
+                !(GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound) ) {
         PLOGERR(klogErr, (klogErr, rc, "FILE $(file) @quality_scoring_system", PLOG_S(file), file->filename));
     } else if( (rc = KXMLNodeReadAttrCStr(FILE, "quality_encoding", &quality_encoding, NULL)) != 0 &&
-                !(GetRCObject(rc) == rcAttr && GetRCState(rc) == rcNotFound) ) {
+                !(GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound) ) {
         PLOGERR(klogErr, (klogErr, rc, "FILE $(file) @quality_encoding", PLOG_S(file), file->filename));
     } else if( (rc = KXMLNodeReadAttrCStr(FILE, "ascii_offset", &ascii_offset, NULL)) != 0 &&
-                !(GetRCObject(rc) == rcAttr && GetRCState(rc) == rcNotFound) ) {
+                !(GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound) ) {
         PLOGERR(klogErr, (klogErr, rc, "FILE $(file) @ascii_offset", PLOG_S(file), file->filename));
 
     } else if( (rc = KXMLNodeReadAttrCStr(FILE, "checksum_method", &checksum_method, NULL)) != 0 &&
-                !(GetRCObject(rc) == rcAttr && GetRCState(rc) == rcNotFound) ) {
+                !(GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound) ) {
         PLOGERR(klogErr, (klogErr, rc, "FILE $(file) @checksum_method", PLOG_S(file), file->filename));
     } else if( (rc = KXMLNodeReadAttrCStr(FILE, "checksum", &checksum, NULL)) != 0 &&
-                !(GetRCObject(rc) == rcAttr && GetRCState(rc) == rcNotFound) ) {
+                !(GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound) ) {
         PLOGERR(klogErr, (klogErr, rc, "FILE $(file) @checksum", PLOG_S(file), file->filename));
     } else if( checksum_method != NULL && strcasecmp(checksum_method, "MD5") != 0 ) {
         rc = RC(rcExe, rcStorage, rcConstructing, rcData, rcInvalid);
@@ -270,12 +270,12 @@ rc_t parse_DATA_BLOCK(const KXMLNode* DATA_BLOCK, DataBlock* datablock)
     const KXMLNodeset* FILES;
 
     rc = KXMLNodeReadAttrCStr(DATA_BLOCK, "name", &datablock->name, NULL);
-    if( rc != 0 && !(GetRCObject(rc) == rcAttr && GetRCState(rc) == rcNotFound) ) {
+    if( rc != 0 && !(GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound) ) {
         LOGERR(klogErr, rc, "DATA_BLOCK @name");
         return rc;
     }
     rc = KXMLNodeReadAttrCStr(DATA_BLOCK, "member_name", &datablock->member_name, NULL);
-    if( rc != 0 && !(GetRCObject(rc) == rcAttr && GetRCState(rc) == rcNotFound) ) {
+    if( rc != 0 && !(GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound) ) {
         LOGERR(klogErr, rc, "DATA_BLOCK @member_name");
         return rc;
     }
@@ -284,19 +284,19 @@ rc_t parse_DATA_BLOCK(const KXMLNode* DATA_BLOCK, DataBlock* datablock)
     }
     datablock->serial = ~0; /* file w/o serial pushed to end of list */
     rc = KXMLNodeReadAttrAsU32(DATA_BLOCK, "serial", &datablock->serial);
-    if( rc != 0 && !(GetRCObject(rc) == rcAttr && GetRCState(rc) == rcNotFound) ) {
+    if( rc != 0 && !(GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound) ) {
         LOGERR(klogErr, rc, "DATA_BLOCK @serial");
         return rc;
     }
     datablock->sector = -1;
     rc = KXMLNodeReadAttrAsU64(DATA_BLOCK, "sector", (uint64_t*)&datablock->sector);
-    if( rc != 0 && !(GetRCObject(rc) == rcAttr && GetRCState(rc) == rcNotFound) ) {
+    if( rc != 0 && !(GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound) ) {
         LOGERR(klogErr, rc, "DATA_BLOCK @sector");
         return rc;
     }
     datablock->region = -1;
     rc = KXMLNodeReadAttrAsU64(DATA_BLOCK, "region", (uint64_t*)&datablock->region);
-    if( rc != 0 && !(GetRCObject(rc) == rcAttr && GetRCState(rc) == rcNotFound) ) {
+    if( rc != 0 && !(GetRCObject(rc) == (enum RCObject)rcAttr && GetRCState(rc) == rcNotFound) ) {
         LOGERR(klogErr, rc, "DATA_BLOCK @region");
         return rc;
     }
diff --git a/tools/sra-load/sff-fmt.c b/tools/sra-load/sff-fmt.c
index 49ce718..523766c 100644
--- a/tools/sra-load/sff-fmt.c
+++ b/tools/sra-load/sff-fmt.c
@@ -355,7 +355,7 @@ rc_t SFFLoaderFmtWriteDataFile(SFFLoaderFmt* self, const SRALoaderFile* file)
                 DEBUG_MSG (5, ("%s: Common header ok: %u reads\n", self->file_name, self->header.number_of_reads));
                 DEBUG_MSG (8, ("%s: flow_chars: [%hu] %s\n", self->file_name, self->header.num_flows_per_read, self->flow_chars.data));
                 DEBUG_MSG (8, ("%s: key_seq: [%hu] %s\n", self->file_name, self->header.key_length, self->key_seq.data));
-            } else if( GetRCObject(rc) == rcData && GetRCState(rc) == rcIgnored ) {
+            } else if( GetRCObject(rc) == (enum RCObject)rcData && GetRCState(rc) == rcIgnored ) {
                 rc = 0;
                 break;
             }
diff --git a/tools/sra-load/sff-load.vers b/tools/sra-load/sff-load.vers
index cc6c9a4..8e8299d 100644
--- a/tools/sra-load/sff-load.vers
+++ b/tools/sra-load/sff-load.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/sra-load/sra-writer.c b/tools/sra-load/sra-writer.c
index 3f29211..bbfcb5b 100644
--- a/tools/sra-load/sra-writer.c
+++ b/tools/sra-load/sra-writer.c
@@ -99,9 +99,9 @@ rc_t SRAWriter_CreateTable(SRAWriter* self, const char* schema)
         rc = RC( rcSRA, rcFormatter, rcWriting, rcSelf, rcNull);
     } else {
 retry:
-        rc = SRAMgrCreateTable(self->config->sra_mgr, &self->table, schema, self->config->table_path);
-        if( GetRCObject(rc) == rcTable && GetRCState(rc) == rcExists && self->config->force_table_overwrite ) {
-            if( (rc = SRAMgrDropTable(self->config->sra_mgr, true, self->config->table_path)) == 0 ) {
+        rc = SRAMgrCreateTable(self->config->sra_mgr, &self->table, schema, "%s", self->config->table_path);
+        if( GetRCObject(rc) == (enum RCObject)rcTable && GetRCState(rc) == rcExists && self->config->force_table_overwrite ) {
+            if( (rc = SRAMgrDropTable(self->config->sra_mgr, true, "%s", self->config->table_path)) == 0 ) {
                 goto retry;
             }
         }
@@ -222,7 +222,7 @@ rc_t SRAWriter_WriteDefaults(SRAWriter* self)
                 read_start[i] = read_segs[i].start;
                 read_len[i] = read_segs[i].len;
             }
-        } else if( GetRCObject(rc) == rcData && GetRCState(rc) == rcUnsupported ) {
+        } else if( GetRCObject(rc) == (enum RCObject)rcData && GetRCState(rc) == rcUnsupported ) {
             rc = 0;
         }
     }
diff --git a/tools/sra-load/srf-fmt.c b/tools/sra-load/srf-fmt.c
index 19252f3..0291611 100644
--- a/tools/sra-load/srf-fmt.c
+++ b/tools/sra-load/srf-fmt.c
@@ -96,7 +96,7 @@ rc_t SRF_parse_prepdata(SRF_context* ctx, uint64_t bsize, const uint8_t** data,
     /* prepare bsize bytes in buffer */
     rc = SRALoaderFileRead(ctx->file, *skipover, bsize, (const void**)&ctx->file_buf, &ctx->file_buf_sz);
     if( rc != 0 || ctx->file_buf == NULL || ctx->file_buf_sz == 0 || ctx->file_buf_sz > bsize ) {
-        if( GetRCObject(rc) != rcBuffer || GetRCState(rc) != rcInsufficient ) {
+        if( GetRCObject(rc) != (enum RCObject)rcBuffer || GetRCState(rc) != rcInsufficient ) {
             rc = rc ? rc : RC(rcSRA, rcFormatter, rcParsing, rcData, ctx->file_buf_sz > bsize ? rcExcessive : rcInsufficient);
             SRALoaderFile_LOG(ctx->file, klogErr, rc, "expected $(expected) bytes chunk", PLOG_U64(expected), bsize);
             return rc;
@@ -129,7 +129,7 @@ rc_t SRF_parse_prepdata(SRF_context* ctx, uint64_t bsize, const uint8_t** data,
             inbuf += x;
             rc = SRALoaderFileRead(ctx->file, x, to_read, (const void**)&ctx->file_buf, &ctx->file_buf_sz);
             if( rc != 0 || ((ctx->file_buf == NULL || ctx->file_buf_sz == 0) && to_read > 0) ) {
-                if( GetRCObject(rc) != rcBuffer || GetRCState(rc) != rcInsufficient ) {
+                if( GetRCObject(rc) != (enum RCObject)rcBuffer || GetRCState(rc) != rcInsufficient ) {
                     rc = rc ? rc : RC(rcSRA, rcFormatter, rcParsing, rcData, rcInsufficient);
                     SRALoaderFile_LOG(ctx->file, klogErr, rc, "expected $(expected) bytes of $(chunk) chunk",
                                       PLOG_2(PLOG_U64(expected),PLOG_U64(chunk)), to_read, bsize);
diff --git a/tools/sra-load/srf-illumina.c b/tools/sra-load/srf-illumina.c
index 0294dc2..65b8fa3 100644
--- a/tools/sra-load/srf-illumina.c
+++ b/tools/sra-load/srf-illumina.c
@@ -151,7 +151,7 @@ rc_t parse_header(SRF_context *ctx, ZTR_Context *ztr_ctx, const uint8_t *data, s
 
     while (rc == 0 && !ZTR_BufferIsEmpty(ztr_ctx)) {
         if((rc = ZTR_ParseBlock(ztr_ctx, &ztr_raw)) != 0) {
-            if(GetRCState(rc) == rcInsufficient && GetRCObject(rc) == rcData)
+            if(GetRCState(rc) == rcInsufficient && GetRCObject(rc) == (enum RCObject)rcData)
                 rc = ZTR_BufferGetRemainder(ztr_ctx, &fe->defered, &fe->defered_len);
             break;
         }
diff --git a/tools/sra-load/srf-load.vers b/tools/sra-load/srf-load.vers
index cc6c9a4..8e8299d 100644
--- a/tools/sra-load/srf-load.vers
+++ b/tools/sra-load/srf-load.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/sra-load/writer-illumina.c b/tools/sra-load/writer-illumina.c
index b6c3ef4..b7162ac 100644
--- a/tools/sra-load/writer-illumina.c
+++ b/tools/sra-load/writer-illumina.c
@@ -357,7 +357,8 @@ typedef struct IlluminaWriterSpot_struct {
 } IlluminaWriterSpot;
 
 static
-rc_t SRAWriterIllumina_Check(SRAWriterIllumina* self, IlluminaSpot* spot, IlluminaWriterSpot* final)
+rc_t SRAWriterIllumina_Check(SRAWriterIllumina* self,
+    IlluminaSpot* spot, IlluminaWriterSpot* final)
 {
     rc_t rc = 0;
     bool done, inject_barcode = false;
@@ -433,12 +434,20 @@ rc_t SRAWriterIllumina_Check(SRAWriterIllumina* self, IlluminaSpot* spot, Illumi
         final->adjust_last_read_len = false;
         if( self->sequence_length != spot_len ) {
             uint16_t barc_len = member_basecall ? strlen(member_basecall) : 0;
-            if( self->sequence_length != (spot_len + barc_len) ) {
+            if ((self->sequence_length != (spot_len + barc_len))
+
+             || (self->barcode_read_id == ILLUMINAWRITER_READID_NONE))
+      /* Otherwise inject_barcode is set
+         and when it is inserted below, it uses read_seg[self->barcode_read_id].
+         I.e. barcode_read_id should be >= 0
+         while ILLUMINAWRITER_READID_NONE == -1 */
+
+            {
                 if( spot_len > self->sequence_length ) {
                     what = "spot too long";
                     rc = RC(rcSRA, rcFormatter, rcValidating, rcData, rcExcessive);
                     PLOGERR(klogErr, (klogErr, rc,
-                        "cummulative length of reads data in file(s): $(l) is greater than"
+                        "cumulative length of reads data in file(s): $(l) is greater than"
                         " spot length declared in experiment: $(e) in spot '$(spot)'",
                         "l=%d,e=%u,spot=%.*s", spot_len, self->sequence_length,
                         (uint32_t)spot->name->len, spot->name->data));
@@ -451,7 +460,7 @@ rc_t SRAWriterIllumina_Check(SRAWriterIllumina* self, IlluminaSpot* spot, Illumi
                     what = "spot too short";
                     rc = RC(rcSRA, rcFormatter, rcValidating, rcData, rcInconsistent);
                     PLOGERR(klogErr, (klogErr, rc,
-                        "cummulative length of reads data in file(s): $(l) is less than"
+                        "cumulative length of reads data in file(s): $(l) is less than"
                         " spot length declared in experiment: $(e), most probably $(x) is absent in spot '$(spot)'",
                         "l=%d,e=%u,spot=%.*s,x=%s", spot_len, self->sequence_length,
                         (uint32_t)spot->name->len, spot->name->data,
diff --git a/tools/sra-pileup/.gitignore b/tools/sra-pileup/.gitignore
new file mode 100644
index 0000000..c112998
--- /dev/null
+++ b/tools/sra-pileup/.gitignore
@@ -0,0 +1,2 @@
+*.txt
+*.sh
diff --git a/tools/sra-pileup/4na_ascii.c b/tools/sra-pileup/4na_ascii.c
new file mode 100644
index 0000000..6a1d02a
--- /dev/null
+++ b/tools/sra-pileup/4na_ascii.c
@@ -0,0 +1,95 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <os-native.h>
+#include <insdc/sra.h>
+
+/***************************************
+    N (0x4E)  n (0x6E)  <--> 0x0
+    A (0x41)  a (0x61)  <--> 0x1
+    C (0x43)  c (0x63)  <--> 0x2
+    M (0x4D)  m (0x6D)  <--> 0x3
+    G (0x47)  g (0x67)  <--> 0x4
+    R (0x52)  r (0x72)  <--> 0x5
+    S (0x53)  s (0x73)  <--> 0x6
+    V (0x56)  v (0x76)  <--> 0x7
+    T (0x54)  t (0x74)  <--> 0x8
+    W (0x57)  w (0x77)  <--> 0x9
+    Y (0x59)  y (0x79)  <--> 0xA
+    H (0x48)  h (0x68)  <--> 0xB
+    K (0x4B)  k (0x6B)  <--> 0xC
+    D (0x44)  d (0x64)  <--> 0xD
+    B (0x42)  b (0x62)  <--> 0xE
+    N (0x4E)  n (0x6E)  <--> 0xF
+***************************************/
+
+
+static char _4na_2_ascii_tab[] =
+{
+/*  0x0  0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F */
+    'N', 'A', 'C', 'M', 'G', 'R', 'S', 'V', 'T', 'W', 'Y', 'H', 'K', 'D', 'B', 'N',
+    'n', 'a', 'c', 'm', 'g', 'r', 's', 'v', 't', 'w', 'y', 'h', 'k', 'd', 'b', 'n'
+};
+
+
+/***************************************
+    N (0x4E)  n (0x6E)  <--> 0x0
+    A (0x41)  a (0x61)  <--> 0x0
+    C (0x43)  c (0x63)  <--> 0x1
+    M (0x4D)  m (0x6D)  <--> 0x0
+    G (0x47)  g (0x67)  <--> 0x2
+    R (0x52)  r (0x72)  <--> 0x0
+    S (0x53)  s (0x73)  <--> 0x0
+    V (0x56)  v (0x76)  <--> 0x0
+    T (0x54)  t (0x74)  <--> 0x3
+    W (0x57)  w (0x77)  <--> 0x0
+    Y (0x59)  y (0x79)  <--> 0x0
+    H (0x48)  h (0x68)  <--> 0x0
+    K (0x4B)  k (0x6B)  <--> 0x0
+    D (0x44)  d (0x64)  <--> 0x0
+    B (0x42)  b (0x62)  <--> 0x0
+    N (0x4E)  n (0x6E)  <--> 0x0
+***************************************/
+
+
+static uint32_t _4na_2_index_tab[] =
+{
+/*  0x0  0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F */
+     0,   0,   1,   0,   2,   0,  0,   0,   3,   0,   0,   0,   0,   0,   0,   0 
+};
+
+
+/* ------------------------------------------------------------------------------------- */
+
+char _4na_to_ascii( INSDC_4na_bin c, bool reverse )
+{
+    return _4na_2_ascii_tab[ ( c & 0x0F ) | ( reverse ? 0x10 : 0 ) ];
+}
+
+uint32_t _4na_to_index( INSDC_4na_bin c )
+{
+    return _4na_2_index_tab[ ( c & 0x0F ) ];
+}
diff --git a/tools/sra-pileup/4na_ascii.h b/tools/sra-pileup/4na_ascii.h
new file mode 100644
index 0000000..8146778
--- /dev/null
+++ b/tools/sra-pileup/4na_ascii.h
@@ -0,0 +1,44 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_4na_ascii_
+#define _h_4na_ascii_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <os-native.h>
+#include <insdc/sra.h>
+
+char _4na_to_ascii( INSDC_4na_bin c, bool reverse );
+uint32_t _4na_to_index( INSDC_4na_bin c );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*  _h_4na_ascii_ */
diff --git a/tools/sra-pileup/Makefile b/tools/sra-pileup/Makefile
index 21129ec..194656d 100644
--- a/tools/sra-pileup/Makefile
+++ b/tools/sra-pileup/Makefile
@@ -25,7 +25,7 @@
 
 default: std
 
-TOP ?= $(shell ../../build/abspath.sh ../..)
+TOP ?= $(abspath ../..)
 MODULE = tools/sra-pileup
 
 include $(TOP)/build/Makefile.env
@@ -35,6 +35,7 @@ INT_TOOLS = \
 EXT_TOOLS = \
 	sra-pileup \
 	sam-dump
+#	sam-dump2
 
 ALL_TOOLS = \
 	$(INT_TOOLS) \
@@ -85,10 +86,22 @@ clean: stdclean
 # sra-pileup
 #
 TOOL_SRC = \
+	dyn_string \
 	cmdline_cmn \
+	perf_log \
 	reref \
+	cg_tools \
+	report_deletes \
 	ref_regions \
+	4na_ascii \
+	ref_walker_0 \
 	ref_walker \
+	walk_debug \
+	pileup_counters \
+	pileup_index \
+	pileup_varcount \
+	pileup_stat \
+	pileup_v2 \
 	sra-pileup
 
 TOOL_OBJ = \
@@ -96,18 +109,42 @@ TOOL_OBJ = \
 
 TOOL_LIB = \
 	-lkapp \
-	-lncbi-vdb \
-	-lxml2 \
+	-sncbi-vdb \
 	-lm
 
 $(BINDIR)/sra-pileup: $(TOOL_OBJ)
 	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(TOOL_LIB)
 
 #-------------------------------------------------------------------------------
+# sam-dump2
+#
+SAMDUMP2_SRC = \
+	cmdline_cmn \
+	writer \
+	sam-dump
+
+SAMDUMP2_OBJ = \
+	$(addsuffix .$(OBJX),$(SAMDUMP2_SRC))
+
+SAMDUMP2_LIB = \
+	-lkapp \
+	-sncbi-vdb \
+	-lm
+
+ifdef NCBI
+CFLAGS += -DNCBI
+endif
+
+$(BINDIR)/sam-dump2: $(SAMDUMP2_OBJ)
+	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(SAMDUMP2_LIB)
+
+#-------------------------------------------------------------------------------
 # sam-dump
 #
 SAMDUMP3_SRC = \
 	inputfiles \
+	perf_log \
+	rna_splice_log \
 	sam-dump-opts \
 	out_redir \
 	sam-hdr \
@@ -124,9 +161,13 @@ SAMDUMP3_OBJ = \
 
 SAMDUMP3_LIB = \
 	-lkapp \
-	-lncbi-vdb \
-	-lxml2 \
+	-sncbi-vdb \
 	-lm
 
+ifdef NCBI
+CFLAGS += -DNCBI
+endif
+
 $(BINDIR)/sam-dump: $(SAMDUMP3_OBJ)
 	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(SAMDUMP3_LIB)
+
diff --git a/tools/sra-pileup/cg_tools.c b/tools/sra-pileup/cg_tools.c
index 9a2316b..667af70 100644
--- a/tools/sra-pileup/cg_tools.c
+++ b/tools/sra-pileup/cg_tools.c
@@ -26,6 +26,7 @@
 
 #include "cg_tools.h"
 #include "debug.h"
+#include <klib/out.h>
 
 #include <klib/printf.h>
 #include <sysalloc.h>
@@ -143,6 +144,7 @@ typedef struct cg_cigar_temp
     unsigned opCnt;
     unsigned S_adjust;
     unsigned CG_adjust;
+    bool     has_ref_offset_type;
 } cg_cigar_temp;
 
 
@@ -156,6 +158,7 @@ static rc_t CIGAR_to_CG_Ops( const cg_cigar_input * input,
     tmp->opCnt = 0;
     tmp->S_adjust = 0;
     tmp->CG_adjust = 0;
+    tmp->has_ref_offset_type = false;
     for ( i = 0; i < input->p_cigar.len; ++ops )
     {
         char opChar = 0;
@@ -191,7 +194,7 @@ static rc_t CIGAR_to_CG_Ops( const cg_cigar_input * input,
             case 'I' :  tmp->cigOp[ ops ].type = 1;
                         tmp->cigOp[ ops ].code = 'I';
                         break;
-
+	    case 'N':   tmp->has_ref_offset_type = true;
             case 'D':   tmp->cigOp[ ops ].type = 2;
                         break;
 
@@ -305,7 +308,7 @@ static rc_t CIGAR_to_CG_Ops( const cg_cigar_input * input,
                     }
                 }
             }
-            if ( ( fwd == 0 && rev == 0 ) || ( fwd != 0 && rev != 0 ) )
+            if ( !tmp->has_ref_offset_type && (( fwd == 0 && rev == 0 ) || ( fwd != 0 && rev != 0 ) ))
             {
                 for ( i = 0; i < ops; ++i )
                 {
@@ -523,7 +526,7 @@ rc_t make_cg_cigar( const cg_cigar_input * input, cg_cigar_output * output )
     }
     else if ( rc == 0 )
     {
-        if ( tmp.CG_adjust == 0 )
+        if ( tmp.CG_adjust == 0 && !tmp.has_ref_offset_type)
         {
             if ( tmp.gap[ 0 ] < tmp.opCnt )
                 tmp.CG_adjust = tmp.cigOp[ tmp.gap[ 0 ] ].length;
@@ -770,7 +773,7 @@ rc_t merge_cg_cigar( const cg_cigar_input * input, cg_cigar_output * output )
     else if ( rc == 0 )
     {
 
-        if ( tmp.CG_adjust == 0 )
+        if ( tmp.CG_adjust == 0  && !tmp.has_ref_offset_type )
         {
             if ( tmp.gap[ 0 ] < tmp.opCnt )
                 tmp.CG_adjust = tmp.cigOp[ tmp.gap[ 0 ] ].length;
@@ -807,7 +810,7 @@ rc_t make_cg_merge( const cg_cigar_input * input, cg_cigar_output * output )
     else if ( rc == 0 )
     {
 
-        if ( tmp.CG_adjust == 0 )
+        if ( tmp.CG_adjust == 0  && !tmp.has_ref_offset_type )
         {
             if ( tmp.gap[ 0 ] < tmp.opCnt )
                 tmp.CG_adjust = tmp.cigOp[ tmp.gap[ 0 ] ].length;
@@ -918,73 +921,803 @@ rc_t make_cg_merge( const cg_cigar_input * input, cg_cigar_output * output )
     return rc;
 }
 
-#define MAX_RNA_SPLICE_CIGOPS 200
+
+/* A-->0x00, C-->0x01 G-->0x02 T-->0x03 */
+
+static const uint8_t ASCII_to_2na[] = {
+/*      00  01  02  03  04  05  06  07  08  09  0A  0B  0C  0D  0E  0F  */
+        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+
+/*      10  11  12  13  14  15  16  17  18  19  1A  1B  1C  1D  1E  1F  */
+        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+
+/*      20  21  22  23  24  25  26  27  28  29  2A  2B  2C  2D  2E  2F  */
+        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+
+/*      30  31  32  33  34  35  36  37  38  39  3A  3B  3C  3D  3E  3F  */
+        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+
+/*      40  41  42  43  44  45  46  47  48  49  4A  4B  4C  4D  4E  4F  */
+        0,  0,  0,  1,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,
+
+/*      50  51  52  53  54  55  56  57  58  59  5A  5B  5C  5D  5E  5F  */
+        0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+
+/*      60  61  62  63  64  65  66  67  68  69  6A  6B  6C  6D  6E  6F  */
+        0,  0,  0,  1,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,
+
+/*      70  71  72  73  74  75  76  77  78  79  7A  7B  7C  7D  7E  7F  */
+        0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
+};
+
+static uint8_t compress_4_bases_to_byte( uint8_t * bases )
+{
+    uint8_t res = ASCII_to_2na[ bases[ 0 ] & 0x7F ];
+    res <<= 2;
+    res |= ASCII_to_2na[ bases[ 1 ] & 0x7F ];
+    res <<= 2;
+    res |= ASCII_to_2na[ bases[ 2 ] & 0x7F ];
+    res <<= 2;
+    res |= ASCII_to_2na[ bases[ 3 ] & 0x7F ];
+    return res;
+}
+
+
+static const uint8_t compressed_to_fwd_reverse_0[] = {
+
+    /* 0000.0000    0x00 ... AAAA */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 0000.0001    0x01 ... AAAC */ ( RNA_SPLICE_FWD | 0x10 ),
+    /* 0000.0010    0x02 ... AAAG */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 0000.0011    0x03 ... AAAT */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 0000.0100    0x04 ... AACA */ RNA_SPLICE_UNKNOWN,
+    /* 0000.0101    0x05 ... AACC */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 0000.0110    0x06 ... AACG */ RNA_SPLICE_UNKNOWN,
+    /* 0000.0111    0x07 ... AACT */ RNA_SPLICE_UNKNOWN,
+    /* 0000.1000    0x08 ... AAGA */ RNA_SPLICE_UNKNOWN,
+    /* 0000.1001    0x09 ... AAGC */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 0000.1010    0x0A ... AAGG */ RNA_SPLICE_UNKNOWN,
+    /* 0000.1011    0x0B ... AAGT */ RNA_SPLICE_UNKNOWN,
+    /* 0000.1100    0x0C ... AATA */ RNA_SPLICE_UNKNOWN,
+    /* 0000.1101    0x0D ... AATC */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 0000.1110    0x0E ... AATG */ RNA_SPLICE_UNKNOWN,
+    /* 0000.1111    0x0F ... AATT */ RNA_SPLICE_UNKNOWN,
+
+    /* 0001.0000    0x10 ... ACAA */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 0001.0001    0x11 ... ACAC */ ( RNA_SPLICE_FWD | 0x10 ),
+    /* 0001.0010    0x12 ... ACAG */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 0001.0011    0x13 ... ACAT */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 0001.0100    0x14 ... ACCA */ RNA_SPLICE_UNKNOWN,
+    /* 0001.0101    0x15 ... ACCC */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 0001.0110    0x16 ... ACCG */ RNA_SPLICE_UNKNOWN,
+    /* 0001.0111    0x17 ... ACCT */ RNA_SPLICE_UNKNOWN,
+    /* 0001.1000    0x18 ... ACGA */ RNA_SPLICE_UNKNOWN,
+    /* 0001.1001    0x19 ... ACGC */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 0001.1010    0x1A ... ACGG */ RNA_SPLICE_UNKNOWN,
+    /* 0001.1011    0x1B ... ACGT */ RNA_SPLICE_UNKNOWN,
+    /* 0001.1100    0x1C ... ACTA */ RNA_SPLICE_UNKNOWN,
+    /* 0001.1101    0x1D ... ACTC */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 0001.1110    0x1E ... ACTG */ RNA_SPLICE_UNKNOWN,
+    /* 0001.1111    0x1F ... ACTT */ RNA_SPLICE_UNKNOWN,
+
+    /* 0010.0000    0x20 ... AGAA */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 0010.0001    0x21 ... AGAC */ ( RNA_SPLICE_FWD | 0x10 ),
+    /* 0010.0010    0x22 ... AGAG */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 0010.0011    0x23 ... AGAT */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 0010.0100    0x24 ... AGCA */ RNA_SPLICE_UNKNOWN,
+    /* 0010.0101    0x25 ... AGCC */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 0010.0110    0x26 ... AGCG */ RNA_SPLICE_UNKNOWN,
+    /* 0010.0111    0x27 ... AGCT */ RNA_SPLICE_UNKNOWN,
+    /* 0010.1000    0x28 ... AGGA */ RNA_SPLICE_UNKNOWN,
+    /* 0010.1001    0x29 ... AGGC */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 0010.1010    0x2A ... AGGG */ RNA_SPLICE_UNKNOWN,
+    /* 0010.1011    0x2B ... AGGT */ RNA_SPLICE_UNKNOWN,
+    /* 0010.1100    0x2C ... AGTA */ RNA_SPLICE_UNKNOWN,
+    /* 0010.1101    0x2D ... AGTC */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 0010.1110    0x2E ... AGTG */ RNA_SPLICE_UNKNOWN,
+    /* 0010.1111    0x2F ... AGTT */ RNA_SPLICE_UNKNOWN,
+
+    /* 0011.0000    0x30 ... ATAA */ ( RNA_SPLICE_FWD | 0x10 ),
+    /* 0011.0001    0x31 ... ATAC */ RNA_SPLICE_FWD,            /* MINOR forward */
+    /* 0011.0010    0x32 ... ATAG */ ( RNA_SPLICE_FWD | 0x10 ),
+    /* 0011.0011    0x33 ... ATAT */ ( RNA_SPLICE_FWD | 0x10 ),
+    /* 0011.0100    0x34 ... ATCA */ RNA_SPLICE_UNKNOWN,
+    /* 0011.0101    0x35 ... ATCC */ ( RNA_SPLICE_FWD | 0x10 ),
+    /* 0011.0110    0x36 ... ATCG */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 0011.0111    0x37 ... ATCT */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 0011.1000    0x38 ... ATGA */ RNA_SPLICE_UNKNOWN,
+    /* 0011.1001    0x39 ... ATGC */ ( RNA_SPLICE_FWD | 0x10 ),
+    /* 0011.1010    0x3A ... ATGG */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 0011.1011    0x3B ... ATGT */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 0011.1100    0x3C ... ATTA */ RNA_SPLICE_UNKNOWN,
+    /* 0011.1101    0x3D ... ATTC */ ( RNA_SPLICE_FWD | 0x10 ),
+    /* 0011.1110    0x3E ... ATTG */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 0011.1111    0x3F ... ATTT */ ( RNA_SPLICE_REV | 0x20 ),
+
+    /* 0100.0000    0x40 ... CAAA */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 0100.0001    0x41 ... CAAC */ ( RNA_SPLICE_REV | 0x10 ),
+    /* 0100.0010    0x42 ... CAAG */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 0100.0011    0x43 ... CAAT */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 0100.0100    0x44 ... CACA */ RNA_SPLICE_UNKNOWN,
+    /* 0100.0101    0x45 ... CACC */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 0100.0110    0x46 ... CACG */ RNA_SPLICE_UNKNOWN,
+    /* 0100.0111    0x47 ... CACT */ RNA_SPLICE_UNKNOWN,
+    /* 0100.1000    0x48 ... CAGA */ RNA_SPLICE_UNKNOWN,
+    /* 0100.1001    0x49 ... CAGC */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 0100.1010    0x4A ... CAGG */ RNA_SPLICE_UNKNOWN,
+    /* 0100.1011    0x4B ... CAGT */ RNA_SPLICE_UNKNOWN,
+    /* 0100.1100    0x4C ... CATA */ RNA_SPLICE_UNKNOWN,
+    /* 0100.1101    0x4D ... CATC */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 0100.1110    0x4E ... CATG */ RNA_SPLICE_UNKNOWN,
+    /* 0100.1111    0x4F ... CATT */ RNA_SPLICE_UNKNOWN,
+
+    /* 0101.0000    0x50 ... CCAA */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 0101.0001    0x51 ... CCAC */ ( RNA_SPLICE_REV | 0x10 ),
+    /* 0101.0010    0x52 ... CCAG */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 0101.0011    0x53 ... CCAT */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 0101.0100    0x54 ... CCCA */ RNA_SPLICE_UNKNOWN,
+    /* 0101.0101    0x55 ... CCCC */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 0101.0110    0x56 ... CCCG */ RNA_SPLICE_UNKNOWN,
+    /* 0101.0111    0x57 ... CCCT */ RNA_SPLICE_UNKNOWN,
+    /* 0101.1000    0x58 ... CCGA */ RNA_SPLICE_UNKNOWN,
+    /* 0101.1001    0x59 ... CCGC */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 0101.1010    0x5A ... CCGG */ RNA_SPLICE_UNKNOWN,
+    /* 0101.1011    0x5B ... CCGT */ RNA_SPLICE_UNKNOWN,
+    /* 0101.1100    0x5C ... CCTA */ RNA_SPLICE_UNKNOWN,
+    /* 0101.1101    0x5D ... CCTC */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 0101.1110    0x5E ... CCTG */ RNA_SPLICE_UNKNOWN,
+    /* 0101.1111    0x5F ... CCTT */ RNA_SPLICE_UNKNOWN,
+
+    /* 0110.0000    0x60 ... CGAA */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 0110.0001    0x61 ... CGAC */ ( RNA_SPLICE_REV | 0x10 ),
+    /* 0110.0010    0x62 ... CGAG */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 0110.0011    0x63 ... CGAT */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 0110.0100    0x64 ... CGCA */ RNA_SPLICE_UNKNOWN,
+    /* 0110.0101    0x65 ... CGCC */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 0110.0110    0x66 ... CGCG */ RNA_SPLICE_UNKNOWN,
+    /* 0110.0111    0x67 ... CGCT */ RNA_SPLICE_UNKNOWN,
+    /* 0110.1000    0x68 ... CGGA */ RNA_SPLICE_UNKNOWN,
+    /* 0110.1001    0x69 ... CGGC */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 0110.1010    0x6A ... CGGG */ RNA_SPLICE_UNKNOWN,
+    /* 0110.1011    0x6B ... CGGT */ RNA_SPLICE_UNKNOWN,
+    /* 0110.1100    0x6C ... CGTA */ RNA_SPLICE_UNKNOWN,
+    /* 0110.1101    0x6D ... CGTC */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 0110.1110    0x6E ... CGTG */ RNA_SPLICE_UNKNOWN,
+    /* 0110.1111    0x6F ... CGTT */ RNA_SPLICE_UNKNOWN,
+
+    /* 0111.0000    0x70 ... CTAA */ ( RNA_SPLICE_REV | 0x10 ),
+    /* 0111.0001    0x71 ... CTAC */ RNA_SPLICE_REV,            /* MAJOR reverse */
+    /* 0111.0010    0x72 ... CTAG */ ( RNA_SPLICE_FWD | 0x10 ),
+    /* 0111.0011    0x73 ... CTAT */ ( RNA_SPLICE_REV | 0x10 ),
+    /* 0111.0100    0x74 ... CTCA */ RNA_SPLICE_UNKNOWN,
+    /* 0111.0101    0x75 ... CTCC */ ( RNA_SPLICE_REV | 0x10 ),
+    /* 0111.0110    0x76 ... CTCG */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 0111.0111    0x77 ... CTCT */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 0111.1000    0x78 ... CTGA */ RNA_SPLICE_UNKNOWN,
+    /* 0111.1001    0x79 ... CTGC */ ( RNA_SPLICE_REV | 0x10 ),
+    /* 0111.1010    0x7A ... CTGG */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 0111.1011    0x7B ... CTGT */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 0111.1100    0x7C ... CTTA */ RNA_SPLICE_UNKNOWN,
+    /* 0111.1101    0x7D ... CTTC */ ( RNA_SPLICE_REV | 0x10 ),
+    /* 0111.1110    0x7E ... CTTG */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 0111.1111    0x7F ... CTTT */ ( RNA_SPLICE_REV | 0x20 ),
+
+    /* 1000.0000    0x80 ... GAAA */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 1000.0001    0x81 ... GAAC */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 1000.0010    0x82 ... GAAG */ ( RNA_SPLICE_FWD | 0x10 ),
+    /* 1000.0011    0x83 ... GAAT */ ( RNA_SPLICE_REV | 0x10 ),
+    /* 1000.0100    0x84 ... GACA */ RNA_SPLICE_UNKNOWN,
+    /* 1000.0101    0x85 ... GACC */ RNA_SPLICE_UNKNOWN,
+    /* 1000.0110    0x86 ... GACG */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 1000.0111    0x87 ... GACT */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 1000.1000    0x88 ... GAGA */ RNA_SPLICE_UNKNOWN,
+    /* 1000.1001    0x89 ... GAGC */ RNA_SPLICE_UNKNOWN,
+    /* 1000.1010    0x8A ... GAGG */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 1000.1011    0x8B ... GAGT */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 1000.1100    0x8C ... GATA */ RNA_SPLICE_UNKNOWN,
+    /* 1000.1101    0x8D ... GATC */ RNA_SPLICE_UNKNOWN,
+    /* 1000.1110    0x8E ... GATG */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 1000.1111    0x8F ... GATT */ ( RNA_SPLICE_REV | 0x20 ),
+
+    /* 1001.0000    0x90 ... GCAA */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 1001.0001    0x91 ... GCAC */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 1001.0010    0x92 ... GCAG */ ( RNA_SPLICE_FWD | 0x10 ),
+    /* 1001.0011    0x93 ... GCAT */ ( RNA_SPLICE_REV | 0x10 ),
+    /* 1001.0100    0x94 ... GCCA */ RNA_SPLICE_UNKNOWN,
+    /* 1001.0101    0x95 ... GCCC */ RNA_SPLICE_UNKNOWN,
+    /* 1001.0110    0x96 ... GCCG */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 1001.0111    0x97 ... GCCT */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 1001.1000    0x98 ... GCGA */ RNA_SPLICE_UNKNOWN,
+    /* 1001.1001    0x99 ... GCGC */ RNA_SPLICE_UNKNOWN,
+    /* 1001.1010    0x9A ... GCGG */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 1001.1011    0x9B ... GCGT */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 1001.1100    0x9C ... GCTA */ RNA_SPLICE_UNKNOWN,
+    /* 1001.1101    0x9D ... GCTC */ RNA_SPLICE_UNKNOWN,
+    /* 1001.1110    0x9E ... GCTG */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 1001.1111    0x9F ... GCTT */ ( RNA_SPLICE_REV | 0x20 ),
+
+    /* 1010.0000    0xA0 ... GGAA */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 1010.0001    0xA1 ... GGAC */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 1010.0010    0xA2 ... GGAG */ ( RNA_SPLICE_FWD | 0x10 ),
+    /* 1010.0011    0xA3 ... GGAT */ ( RNA_SPLICE_REV | 0x10 ),
+    /* 1010.0100    0xA4 ... GGCA */ RNA_SPLICE_UNKNOWN,
+    /* 1010.0101    0xA5 ... GGCC */ RNA_SPLICE_UNKNOWN,
+    /* 1010.0110    0xA6 ... GGCG */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 1010.0111    0xA7 ... GGCT */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 1010.1000    0xA8 ... GGGA */ RNA_SPLICE_UNKNOWN,
+    /* 1010.1001    0xA9 ... GGGC */ RNA_SPLICE_UNKNOWN,
+    /* 1010.1010    0xAA ... GGGG */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 1010.1011    0xAB ... GGGT */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 1010.1100    0xAC ... GGTA */ RNA_SPLICE_UNKNOWN,
+    /* 1010.1101    0xAD ... GGTC */ RNA_SPLICE_UNKNOWN,
+    /* 1010.1110    0xAE ... GGTG */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 1010.1111    0xAF ... GGTT */ ( RNA_SPLICE_REV | 0x20 ),
+
+    /* 1011.0000    0xB0 ... GTAA */ ( RNA_SPLICE_FWD | 0x10 ),
+    /* 1011.0001    0xB1 ... GTAC */ ( RNA_SPLICE_FWD | 0x10 ),
+    /* 1011.0010    0xB2 ... GTAG */ RNA_SPLICE_FWD,            /* MAJOR forward */
+    /* 1011.0011    0xB3 ... GTAT */ RNA_SPLICE_REV,            /* MINOR reverse */
+    /* 1011.0100    0xB4 ... GTCA */ RNA_SPLICE_UNKNOWN,
+    /* 1011.0101    0xB5 ... GTCC */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 1011.0110    0xB6 ... GTCG */ ( RNA_SPLICE_FWD | 0x10 ),
+    /* 1011.0111    0xB7 ... GTCT */ ( RNA_SPLICE_REV | 0x10 ),
+    /* 1011.1000    0xB8 ... GTGA */ RNA_SPLICE_UNKNOWN,
+    /* 1011.1001    0xB9 ... GTGC */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 1011.1010    0xBA ... GTGG */ ( RNA_SPLICE_FWD | 0x10 ),
+    /* 1011.1011    0xBB ... GTGT */ ( RNA_SPLICE_REV | 0x10 ),
+    /* 1011.1100    0xBC ... GTTA */ RNA_SPLICE_UNKNOWN,
+    /* 1011.1101    0xBD ... GTTC */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 1011.1110    0xBE ... GTTG */ ( RNA_SPLICE_FWD | 0x10 ),
+    /* 1011.1111    0xBF ... GTTT */ ( RNA_SPLICE_REV | 0x10 ),
+
+    /* 1100.0000    0xC0 ... TAAA */ RNA_SPLICE_UNKNOWN,
+    /* 1100.0001    0xC1 ... TAAC */ RNA_SPLICE_UNKNOWN,
+    /* 1100.0010    0xC2 ... TAAG */ RNA_SPLICE_UNKNOWN,
+    /* 1100.0011    0xC3 ... TAAT */ RNA_SPLICE_UNKNOWN,
+    /* 1100.0100    0xC4 ... TACA */ RNA_SPLICE_UNKNOWN,
+    /* 1100.0101    0xC5 ... TACC */ RNA_SPLICE_UNKNOWN,
+    /* 1100.0110    0xC6 ... TACG */ RNA_SPLICE_UNKNOWN,
+    /* 1100.0111    0xC7 ... TACT */ RNA_SPLICE_UNKNOWN,
+    /* 1100.1000    0xC8 ... TAGA */ RNA_SPLICE_UNKNOWN,
+    /* 1100.1001    0xC9 ... TAGC */ RNA_SPLICE_UNKNOWN,
+    /* 1100.1010    0xCA ... TAGG */ RNA_SPLICE_UNKNOWN,
+    /* 1100.1011    0xCB ... TAGT */ RNA_SPLICE_UNKNOWN,
+    /* 1100.1100    0xCC ... TATA */ RNA_SPLICE_UNKNOWN,
+    /* 1100.1101    0xCD ... TATC */ RNA_SPLICE_UNKNOWN,
+    /* 1100.1110    0xCE ... TATG */ RNA_SPLICE_UNKNOWN,
+    /* 1100.1111    0xCF ... TATT */ RNA_SPLICE_UNKNOWN,
+
+    /* 1101.0000    0xE0 ... TCAA */ RNA_SPLICE_UNKNOWN,
+    /* 1101.0001    0xE1 ... TCAC */ RNA_SPLICE_UNKNOWN,
+    /* 1101.0010    0xE2 ... TCAG */ RNA_SPLICE_UNKNOWN,
+    /* 1101.0011    0xE3 ... TCAT */ RNA_SPLICE_UNKNOWN,
+    /* 1101.0100    0xE4 ... TCCA */ RNA_SPLICE_UNKNOWN,
+    /* 1101.0101    0xE5 ... TCCC */ RNA_SPLICE_UNKNOWN,
+    /* 1101.0110    0xE6 ... TCCG */ RNA_SPLICE_UNKNOWN,
+    /* 1101.0111    0xE7 ... TCCT */ RNA_SPLICE_UNKNOWN,
+    /* 1101.1000    0xE8 ... TCGA */ RNA_SPLICE_UNKNOWN,
+    /* 1101.1001    0xE9 ... TCGC */ RNA_SPLICE_UNKNOWN,
+    /* 1101.1010    0xEA ... TCGG */ RNA_SPLICE_UNKNOWN,
+    /* 1101.1011    0xEB ... TCGT */ RNA_SPLICE_UNKNOWN,
+    /* 1101.1100    0xEC ... TCTA */ RNA_SPLICE_UNKNOWN,
+    /* 1101.1101    0xED ... TCTC */ RNA_SPLICE_UNKNOWN,
+    /* 1101.1110    0xEE ... TCTG */ RNA_SPLICE_UNKNOWN,
+    /* 1101.1111    0xEF ... TCTT */ RNA_SPLICE_UNKNOWN,
+
+    /* 1111.0000    0xF0 ... TTAA */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 1111.0001    0xF1 ... TTAC */ ( RNA_SPLICE_REV | 0x10 ),
+    /* 1111.0010    0xF2 ... TTAG */ ( RNA_SPLICE_FWD | 0x10 ),
+    /* 1111.0011    0xF3 ... TTAT */ ( RNA_SPLICE_REV | 0x10 ),
+    /* 1111.0100    0xF4 ... TTCA */ RNA_SPLICE_UNKNOWN,
+    /* 1111.0101    0xF5 ... TTCC */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 1111.0110    0xF6 ... TTCG */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 1111.0111    0xF7 ... TTCT */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 1111.1000    0xF8 ... TTGA */ RNA_SPLICE_UNKNOWN,
+    /* 1111.1001    0xF9 ... TTGC */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 1111.1010    0xFA ... TTGG */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 1111.1011    0xFB ... TTGT */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 1111.1100    0xFC ... TTTA */ RNA_SPLICE_UNKNOWN,
+    /* 1111.1101    0xFD ... TTTC */ ( RNA_SPLICE_REV | 0x20 ),
+    /* 1111.1110    0xFE ... TTTG */ ( RNA_SPLICE_FWD | 0x20 ),
+    /* 1111.1111    0xFF ... TTTT */ ( RNA_SPLICE_REV | 0x20 )
+};
+
+
+/*************************************************************
+    RNA-splice detector:
+
+    base  0   1   .......  n-2  n-1     direction
+
+          G   T             A    G      forward
+          A   T             A    C      forward
+
+          C   T             A    C      reverse
+          G   T             A    T      reverse
+
+
+    =========================================================
+
+    zero mismatches ( aka full matches ) :
+
+    ATAC    ... MINOR   [0x31]=RNA_SPLICE_FWD
+    CTAC    ... MAJOR   [0x71]=RNA_SPLICE_REV
+    GTAG    ... MAJOR   [0xB2]=RNA_SPLICE_FWD
+    GTAT    ... MINOR   [0xB3]=RNA_SPLICE_REV
+
+    =========================================================
+
+    one mismatch:
+
+    ATAC    ... MINOR, forward
+
+        *
+        CTAC ( is also MAJOR reverse ... )
+        GTAC ( is alow MAJOR reverse, 1 mismatch )
+        TTAC ( is alow MAJOR reverse, 1 mismatch )
+
+         *
+        AAAC [0x01]=( RNA_SPLICE_FWD | 0x10 )
+        ACAC [0x11]=( RNA_SPLICE_FWD | 0x10 )
+        AGAC [0x21]=( RNA_SPLICE_FWD | 0x10 )
+
+          *
+        ATCC [0x35]=( RNA_SPLICE_FWD | 0x10 )
+        ATGC [0x39]=( RNA_SPLICE_FWD | 0x10 )
+        ATTC [0x3D]=( RNA_SPLICE_FWD | 0x10 )
+
+           *
+        ATAA [0x30]=( RNA_SPLICE_FWD | 0x10 )
+        ATAG ( is also MAJOR forward, 1 mismatch )
+        ATAT [0x33]=( RNA_SPLICE_FWD | 0x10 )
+
+    -----------------------------------------------------------
+    CTAC    ... MAJOR, reverse
+
+        *
+        ATAC ( is also MINOR forward, full match )
+        GTAC ( is also MAJOR forward, 1 mismatch )
+        TTAC [0xF1]=( RNA_SPLICE_REV | 0x10 )
+
+         *
+        CAAC [0x41]=( RNA_SPLICE_REV | 0x10 )
+        CCAC [0x51]=( RNA_SPLICE_REV | 0x10 )
+        CGAC [0x61]=( RNA_SPLICE_REV | 0x10 )
+
+          *
+        CTCC [0x75]=( RNA_SPLICE_REV | 0x10 )
+        CTGC [0x79]=( RNA_SPLICE_REV | 0x10 )
+        CTTC [0x7D]=( RNA_SPLICE_REV | 0x10 )
+
+           *
+        CTAA [0x70]=( RNA_SPLICE_REV | 0x10 )
+        CTAG ( is also MAJOR forward, 1 mismatch )
+        CTAT [0x73]=( RNA_SPLICE_REV | 0x10 )
+
+    -----------------------------------------------------------
+    GTAG    ... MAJOR, forward
+
+        *
+        ATAG [0x32]=( RNA_SPLICE_FWD | 0x10 )
+        CTAG [0x72]=( RNA_SPLICE_FWD | 0x10 )
+        TTAG [0xF2]=( RNA_SPLICE_FWD | 0x10 )
+
+         *
+        GAAG [0x82]=( RNA_SPLICE_FWD | 0x10 )
+        GCAG [0x92]=( RNA_SPLICE_FWD | 0x10 )
+        GGAG [0xA2]=( RNA_SPLICE_FWD | 0x10 )
+
+          *
+        GTCG [0xB6]=( RNA_SPLICE_FWD | 0x10 )
+        GTGG [0xBA]=( RNA_SPLICE_FWD | 0x10 )
+        GTTG [0xBE]=( RNA_SPLICE_FWD | 0x10 )
+
+           *
+        GTAA [0xB0]=( RNA_SPLICE_FWD | 0x10 )
+        GTAC [0xB1]=( RNA_SPLICE_FWD | 0x10 )
+        GTAT ( is also MINOR reverse, full match )
+
+    -----------------------------------------------------------
+    GTAT    ... MINOR, reverse
+
+        *
+        ATAT ( is also MINOR forward, 1 mismatch )
+        CTAT ( is also MAJOR reverse, 1 mismatch )
+        TTAT [0xF3]=( RNA_SPLICE_REV | 0x10 )
+
+         *
+        GAAT [0x83]=( RNA_SPLICE_REV | 0x10 )
+        GCAT [0x93]=( RNA_SPLICE_REV | 0x10 )
+        GGAT [0xA3]=( RNA_SPLICE_REV | 0x10 )
+
+          *
+        GTCT [0xB7]=( RNA_SPLICE_REV | 0x10 )
+        GTGT [0xBB]=( RNA_SPLICE_REV | 0x10 )
+        GTTT [0xBF]=( RNA_SPLICE_REV | 0x10 )
+
+           *
+        GTAA ( is also MAJOR forward, 1 mismatch )
+        GTAC ( is also MAJOR forward, 1 mismatch )
+        GTAG ( is also MAJOR forward, full match )
+
+    =========================================================
+
+    two mismatches:
+
+    ATAC    ... MINOR, forward
+
+        * *
+        CTAC ( is also MAJOR reverse, full match )
+        CTCC ( is also MAJOR reverse, 1 mismatch )
+        CTGC ( is also MAJOR reverse, 1 mismatch )
+        CTTC ( is also MAJOR reverse, 1 mismatch )
+        GTAC ( is also MAJOR forward, 1 mismatch )
+        GTCC ( is also MAJOR reverse, 2 mismatches )
+        GTGC ( is also MAJOR reverse, 2 mismatches )
+        GTTC ( is also MAJOR reverse, 2 mismatches )
+        TTAC ( is also MAJOR reverse, 1 mismatch )
+        TTCC ( is also MAJOR reverse, 2 mismatches )
+        TTGC ( is also MAJOR reverse, 2 mismatches )
+        TTTC ( is also MAJOR reverse, 2 mismatches )
+
+         **
+        AAAC ( is also MAJOR forward, 1 mismatch )
+        AACC [0x05]=( RNA_SPLICE_FWD | 0x20 )
+        AAGC [0x09]=( RNA_SPLICE_FWD | 0x20 )
+        AATC [0x0D]=( RNA_SPLICE_FWD | 0x20 )
+        ACAC ( is also MINOR forward, 1 mismatch )
+        ACCC [0x15]=( RNA_SPLICE_FWD | 0x20 )
+        ACGC [0x19]=( RNA_SPLICE_FWD | 0x20 )
+        ACTC [0x1D]=( RNA_SPLICE_FWD | 0x20 )
+        AGAC ( is also MINOR forward, 1 mismatch )
+        AGCC [0x25]=( RNA_SPLICE_FWD | 0x20 )
+        AGGC [0x29]=( RNA_SPLICE_FWD | 0x20 )
+        AGTC [0x2D]=( RNA_SPLICE_FWD | 0x20 )
+
+        *  *
+        CTAA ( is also MAJOR reverse, 1 mismatch )
+        CTAC ( is also MAJOR reverse, full match )
+        CTAG ( is also MAJOR forward, 1 mismatch )
+        CTAT ( is also MAJOR reverse, 1 mismatch )
+        GTAA ( is also MAJOR forward, 1 mismatch )
+        GTAC ( is also MAJOR forward, 1 mismatch )
+        GTAG ( is also MAJOR forward, full match )
+        GTAT ( is also MINOR reverse, full match )
+        TTAA ( is also MAJOR reverse, 2 mismatches )
+        TTAC ( is also MAJOR reverse, 1 mismatch )
+        TTAG ( is also MAJOR forward, 1 mismatch )
+        TTAT ( is also MINOR reverse, 1 mismatch )
+
+         * *
+        AAAA [0x00]=( RNA_SPLICE_FWD | 0x20 )
+        AAAC ( is also MAJOR forward, 1 mismatch )
+        AAAG [0x02]=( RNA_SPLICE_FWD | 0x20 )
+        AAAT [0x03]=( RNA_SPLICE_FWD | 0x20 )
+        ACAA [0x10]=( RNA_SPLICE_FWD | 0x20 )
+        ACAC ( is also MINOR forward, 1 mismatch )
+        ACAG [0x12]=( RNA_SPLICE_FWD | 0x20 )
+        ACAT [0x13]=( RNA_SPLICE_FWD | 0x20 )
+        AGAA [0x20]=( RNA_SPLICE_FWD | 0x20 )
+        AGAC ( is also MINOR forward, 1 mismatch )
+        AGAG [0x22]=( RNA_SPLICE_FWD | 0x20 )
+        AGAT [0x23]=( RNA_SPLICE_FWD | 0x20 )
+
+    -----------------------------------------------------------
+    CTAC    ... MAJOR, reverse
+
+        * *
+        ATAC ( is also MINOR forward, full match )
+        ATCC ( is also MINOR forward, 1 mismatch )
+        ATGC ( is also MINOR forward, 1 mismatch )
+        ATTC ( is also MINOR forward, 1 mismatch )
+        GTAC ( is also MAJOR forward, 1 mismatch )
+        GTCC [0xB5]=( RNA_SPLICE_REV | 0x20 )
+        GTGC [0xB9]=( RNA_SPLICE_REV | 0x20 )
+        GTTC [0xBD]=( RNA_SPLICE_REV | 0x20 )
+        TTAC ( is also MAJOR reverse, 1 mismatch )
+        TTCC [0xF5]=( RNA_SPLICE_REV | 0x20 )
+        TTGC [0xF9]=( RNA_SPLICE_REV | 0x20 )
+        TTTC [0xFD]=( RNA_SPLICE_REV | 0x20 )
+
+         **
+        CAAC ( is also MAJOR reverse, 1 mismatch )
+        CACC [0x45]=( RNA_SPLICE_REV | 0x20 )
+        CAGC [0x49]=( RNA_SPLICE_REV | 0x20 )
+        CATC [0x4D]=( RNA_SPLICE_REV | 0x20 )
+        CCAC ( is also MAJOR reverse, 1 mismatch )
+        CCCC [0x55]=( RNA_SPLICE_REV | 0x20 )
+        CCGC [0x59]=( RNA_SPLICE_REV | 0x20 )
+        CCTC [0x5D]=( RNA_SPLICE_REV | 0x20 )
+        CGAC ( is also MAJOR reverse, 1 mismatch )
+        CGCC [0x65]=( RNA_SPLICE_REV | 0x20 )
+        CGGC [0x69]=( RNA_SPLICE_REV | 0x20 )
+        CGTC [0x6D]=( RNA_SPLICE_REV | 0x20 )
+
+        *  *
+        ATAA ( is also MINOR forward, 1 mismatch )
+        ATAC ( is also MINOR forward, full match )
+        ATAG ( is also MAJOR forward, 1 mismatch )
+        ATAT ( is also MINOR forward, 1 mismatch )
+        GTAA ( is also MAJOR forward, 1 mismatch )
+        GTAC ( is also MAJOR forward, 1 mismatch )
+        GTAG ( is also MAJOR forward, full match )
+        GTAT ( is also MINOR reverse, full match )
+        TTAA ( is also MAJOR forward, 2 mismatches )
+        TTAC ( is also MAJOR reverse, 1 mismatch )
+        TTAG ( is also MAJOR forward, 1 mismatch )
+        TTAT ( is also MINOR reverse, 1 mismatch )
+
+         * *
+        CAAA [0x40]=( RNA_SPLICE_REV | 0x20 )
+        CAAC ( is also MAJOR reverse, 1 mismatch )
+        CAAG [0x42]=( RNA_SPLICE_REV | 0x20 )
+        CAAT [0x43]=( RNA_SPLICE_REV | 0x20 )
+        CCAA [0x50]=( RNA_SPLICE_REV | 0x20 )
+        CCAC ( is also MAJOR reverse, 1 mismatch )
+        CCAG [0x52]=( RNA_SPLICE_REV | 0x20 )
+        CCAT [0x53]=( RNA_SPLICE_REV | 0x20 )
+        CGAA [0x60]=( RNA_SPLICE_REV | 0x20 )
+        CGAC ( is also MAJOR reverse, 1 mismatch )
+        CGAG [0x62]=( RNA_SPLICE_REV | 0x20 )
+        CGAT [0x63]=( RNA_SPLICE_REV | 0x20 )
+
+    -----------------------------------------------------------
+    GTAG    ... MAJOR, forward
+
+        * *
+        ATAG ( is also MAJOR forward, 1 mismatch )
+        ATCG [0x36]=( RNA_SPLICE_FWD | 0x20 )
+        ATGG [0x3A]=( RNA_SPLICE_FWD | 0x20 )
+        ATTG [0x3E]=( RNA_SPLICE_FWD | 0x20 )
+        CTAG ( is also MAJOR forward, 1 mismatch )
+        CTCG [0x76]=( RNA_SPLICE_FWD | 0x20 )
+        CTGG [0x7A]=( RNA_SPLICE_FWD | 0x20 )
+        CTTG [0x7E]=( RNA_SPLICE_FWD | 0x20 )
+        TTAG ( is also MAJOR forward, 1 mismatch )
+        TTCG [0xF6]=( RNA_SPLICE_FWD | 0x20 )
+        TTGG [0xFA]=( RNA_SPLICE_FWD | 0x20 )
+        TTTG [0xFE]=( RNA_SPLICE_FWD | 0x20 )
+
+         **
+        GAAG ( is also MAJOR forward, 1 mismatch )
+        GACG [0x86]=( RNA_SPLICE_FWD | 0x20 )
+        GAGG [0x8A]=( RNA_SPLICE_FWD | 0x20 )
+        GATG [0x8E]=( RNA_SPLICE_FWD | 0x20 )
+        GCAG ( is also MAJOR forward, 1 mismatch )
+        GCCG [0x96]=( RNA_SPLICE_FWD | 0x20 )
+        GCGG [0x9A]=( RNA_SPLICE_FWD | 0x20 )
+        GCTG [0x9E]=( RNA_SPLICE_FWD | 0x20 )
+        GGAG ( is also MAJOR forward, 1 mismatch )
+        GGCG [0xA6]=( RNA_SPLICE_FWD | 0x20 )
+        GGGG [0xAA]=( RNA_SPLICE_FWD | 0x20 )
+        GGTG [0xAE]=( RNA_SPLICE_FWD | 0x20 )
+
+        *  *
+        ATAA ( is also MINOR forward, 1 mismatch )
+        ATAC ( is also MINOR forward, full match )
+        ATAG ( is also MAJOR forward, 1 mismatch )
+        ATAT ( is also MINOR forward, 1 mismatch )
+        CTAA ( is also MAJOR reverse, 1 mismatch )
+        CTAC ( is also MAJOR reverse, full match )
+        CTAG ( is also MAJOR forward, 1 mismatch )
+        CTAT ( is also MAJOR reverse, 1 mismatch )
+        TTAA [0xF0]=( RNA_SPLICE_FWD | 0x20 )
+        TTAC ( is also MAJOR reverse, 1 mismatch )
+        TTAG ( is also MAJOR forward, 1 mismatch )
+        TTAT ( is also MINOR reverse, 1 mismatch )
+
+         * *
+        GAAA [0x80]=( RNA_SPLICE_FWD | 0x20 )
+        GAAC [0x81]=( RNA_SPLICE_FWD | 0x20 )
+        GAAG ( is also MAJOR forward, 1 mismatch )
+        GAAT ( is also MINOR reverse, 1 mismatch )
+        GCAA [0x90]=( RNA_SPLICE_FWD | 0x20 )
+        GCAC [0x91]=( RNA_SPLICE_FWD | 0x20 )
+        GCAG ( is also MAJOR forward, 1 mismatch )
+        GCAT ( is also MINOR reverse, 1 mismatch )
+        GGAA [0xA0]=( RNA_SPLICE_FWD | 0x20 )
+        GGAC [0xA1]=( RNA_SPLICE_FWD | 0x20 )
+        GGAG ( is also MAJOR forward, 1 mismatch )
+        GGAT ( is also MINOR reverse, 1 mismatch )
+
+    -----------------------------------------------------------
+    GTAT    ... MINOR, reverse
+
+        * *
+        ATAT ( is also MINOR forward, 1 mismatch )
+        ATCT [0x37]=( RNA_SPLICE_REV | 0x20 )
+        ATGT [0x3B]=( RNA_SPLICE_REV | 0x20 )
+        ATTT [0x3F]=( RNA_SPLICE_REV | 0x20 )
+        CTAT ( is also MAJOR reverse, 1 mismatch )
+        CTCT [0x77]=( RNA_SPLICE_REV | 0x20 )
+        CTGT [0x7B]=( RNA_SPLICE_REV | 0x20 )
+        CTTT [0x7F]=( RNA_SPLICE_REV | 0x20 )
+        TTAT ( is also MINOR reverse, 1 mismatch )
+        TTCT [0xF7]=( RNA_SPLICE_REV | 0x20 )
+        TTGT [0xFB]=( RNA_SPLICE_REV | 0x20 )
+        TTTT [0xFF]=( RNA_SPLICE_REV | 0x20 )
+
+         **
+        GAAT ( is also MINOR reverse, 1 mismatch )
+        GACT [0x87]=( RNA_SPLICE_REV | 0x20 )
+        GAGT [0x8B]=( RNA_SPLICE_REV | 0x20 )
+        GATT [0x8F]=( RNA_SPLICE_REV | 0x20 )
+        GCAT ( is also MINOR reverse, 1 mismatch )
+        GCCT [0x97]=( RNA_SPLICE_REV | 0x20 )
+        GCGT [0x9B]=( RNA_SPLICE_REV | 0x20 )
+        GCTT [0x9F]=( RNA_SPLICE_REV | 0x20 )
+        GGAT ( is also MINOR reverse, 1 mismatch )
+        GGCT [0xA7]=( RNA_SPLICE_REV | 0x20 )
+        GGGT [0xAB]=( RNA_SPLICE_REV | 0x20 )
+        GGTT [0xAF]=( RNA_SPLICE_REV | 0x20 )
+
+        *  *
+        ATAA ( is also MINOR forward, 1 mismatch )
+        ATAC ( is also MINOR forward, full match )
+        ATAG ( is also MAJOR forward, 1 mismatch )
+        ATAT ( is also MINOR forward, 1 mismatch )
+        CTAA ( is also MAJOR reverse, 1 mismatch )
+        CTAC ( is also MAJOR reverse, full match )
+        CTAG ( is also MAJOR forward, 1 mismatch )
+        CTAT ( is also MAJOR reverse, 1 mismatch )
+        TTAA ( is also MAJOR forward, 2 mismatches )
+        TTAC ( is also MAJOR reverse, 1 mismatch )
+        TTAG ( is also MAJOR forward, 1 mismatch )
+        TTAT ( is also MINOR reverse, 1 mismatch )
+
+         * *
+        GAAA ( is also MAJOR forward, 2 mismatches )
+        GAAC ( is also MAJOR forward, 2 mismatches )
+        GAAG ( is also MAJOR forward, 1 mismatch )
+        GAAT ( is also MINOR reverse, 1 mismatch )
+        GCAA ( is also MAJOR forward, 2 mismatches )
+        GCAC ( is also MAJOR forward, 2 mismatches )
+        GCAG ( is also MAJOR forward, 1 mismatch )
+        GCAT ( is also MINOR reverse, 1 mismatch )
+        GGAA ( is also MAJOR forward, 2 mismatches )
+        GGAC ( is also MAJOR forward, 2 mismatches )
+        GGAG ( is also MAJOR forward, 1 mismatch )
+        GGAT ( is also MINOR reverse, 1 mismatch )
+
+*************************************************************/
+
+rc_t check_rna_splicing_candidates_against_ref( struct ReferenceObj const * ref_obj,
+                                                uint32_t splice_level, /* 0, 1, 2 ... allowed mismatches */
+                                                INSDC_coord_zero pos,
+                                                rna_splice_candidates * candidates )
+{
+    rc_t rc = 0;
+    uint32_t idx;
+    for ( idx = 0; idx < candidates->count && rc == 0; ++idx )
+    {
+        uint8_t splice[ 4 ];
+        INSDC_coord_len written;
+        rna_splice_candidate * rsc = &candidates->candidates[ idx ];
+        INSDC_coord_zero rd_pos = ( pos + rsc->ref_offset );
+        rc = ReferenceObj_Read( ref_obj, rd_pos, 2, splice, &written );
+        if ( rc == 0 && written == 2 )
+        {
+            rd_pos += ( rsc->len - 2 );
+            rc = ReferenceObj_Read( ref_obj, rd_pos, 2, &splice[ 2 ], &written );
+            if ( rc == 0 && written == 2 )
+            {
+                uint8_t compressed = compress_4_bases_to_byte( splice );   /* 4 bases --> 1 byte */
+                uint8_t match = compressed_to_fwd_reverse_0[ compressed ]; /* table lookup */
+                uint8_t mismatches = ( match >> 4 );
+
+                if ( mismatches <= splice_level )
+                {
+                    rsc->matched = match;
+
+                    if ( ( match & RNA_SPLICE_FWD ) == RNA_SPLICE_FWD )
+                        candidates->fwd_matched++;
+                    else if ( ( match & RNA_SPLICE_REV ) == RNA_SPLICE_REV )
+                        candidates->rev_matched++;
+                }
+            }
+        }
+    }
+    return rc;
+}
+
 
 rc_t discover_rna_splicing_candidates( uint32_t cigar_len, const char * cigar, uint32_t min_len, rna_splice_candidates * candidates )
 {
     rc_t rc = 0;
-    uint32_t cigops_len = cigar_len / 2 + 1;
-    CigOps * cigops = malloc( ( sizeof * cigops ) * cigops_len );
-    if ( cigops == NULL )
+    candidates->cigops_len = ( cigar_len / 2 ) + 1;
+    candidates->cigops = malloc( ( sizeof * candidates->cigops ) * candidates->cigops_len );
+    if ( candidates->cigops == NULL )
         rc = RC( rcExe, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
     else
     {
+        uint32_t ref_offset = 0;
         int32_t op_idx;
-        uint32_t offset = 0;
-        int32_t n_cigops = ExplodeCIGAR( cigops, cigops_len, cigar, cigar_len );
+        CigOps * cigops = candidates->cigops;
+
+        candidates->n_cigops = ExplodeCIGAR( cigops, candidates->cigops_len, cigar, cigar_len );
         candidates->count = 0;
-        for ( op_idx = 0; op_idx < ( n_cigops - 1 ); op_idx++ )
+        for ( op_idx = 0; op_idx < ( candidates->n_cigops - 1 ); op_idx++ )
         {
             char op_code = cigops[ op_idx ].op;
             uint32_t op_len = cigops[ op_idx ].oplen;
             if ( op_code == 'D' && op_len >= min_len && candidates->count < MAX_RNA_SPLICE_CANDIDATES )
             {
                 rna_splice_candidate * rsc = &candidates->candidates[ candidates->count++ ];
-                rsc->offset = offset;
+                rsc->ref_offset = ref_offset;
                 rsc->len = op_len;
                 rsc->op_idx = op_idx;
-                rsc->matched = 0;
+                rsc->matched = RNA_SPLICE_UNKNOWN;  /* we dont know that yet, caller has to do that ( sam-aligned.c ) */
             }
             if ( op_code == 'M' || op_code == 'X' || op_code == '=' || op_code == 'D' || op_code == 'N' )
-                offset += op_len;
+                ref_offset += op_len;
         }
-        free( cigops );
     }
     return rc;
 }
 
 
+
 rc_t change_rna_splicing_cigar( uint32_t cigar_len, char * cigar, rna_splice_candidates * candidates, uint32_t * NM_adjustment )
 {
     rc_t rc = 0;
-    uint32_t cigops_len = cigar_len / 2;
-    uint32_t sum_of_n_lengths = 0;
-    CigOps * cigops = malloc( ( sizeof * cigops ) * cigops_len );
-    if ( cigops == NULL )
-        rc = RC( rcExe, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+    uint32_t winner, sum_of_n_lengths = 0;
+    int32_t idx, dst;
+    CigOps * cigops = candidates->cigops;
+
+    /* handle the special case that we do have forward and reverse candidates in one alignement, that cannot be!
+       we declare a winner ( the direction that occurs most ), zero out the looser(s) and give a warning */
+    if ( candidates->fwd_matched > candidates->rev_matched )
+        winner = RNA_SPLICE_FWD;
     else
+        winner = RNA_SPLICE_REV;
+
+    for ( idx = 0; idx < candidates->count; ++idx )    
     {
-        int32_t idx, dst;
-        int32_t n_cigops = ExplodeCIGAR( cigops, MAX_RNA_SPLICE_CIGOPS, cigar, cigar_len );
-        for ( idx = 0; idx < candidates->count; ++idx )    
+        rna_splice_candidate * rsc = &candidates->candidates[ idx ];
+        if ( ( rsc->matched & 0x0F ) == winner && cigops[ rsc->op_idx ].op == 'D' )
         {
-            rna_splice_candidate * rsc = &candidates->candidates[ idx ];
-            if ( rsc->matched != 0 && cigops[ rsc->op_idx ].op == 'D' )
-            {
-                cigops[ rsc->op_idx ].op = 'N';
-                sum_of_n_lengths += cigops[ rsc->op_idx ].oplen;
-            }
+            cigops[ rsc->op_idx ].op = 'N';
+            sum_of_n_lengths += rsc->len;
         }
+    }
 
-        for ( idx = 0, dst = 0; idx < ( n_cigops - 1 ) && rc == 0; ++idx )
-        {
-            size_t sz;
-            rc = string_printf( &cigar[ dst ], cigar_len + 1 - dst, &sz, "%u%c", cigops[ idx ].oplen, cigops[ idx ].op );
-            dst += sz;
-        }
-        free( cigops );
+    for ( idx = 0, dst = 0; idx < ( candidates->n_cigops - 1 ) && rc == 0; ++idx )
+    {
+        size_t sz;
+        rc = string_printf( &cigar[ dst ], cigar_len + 1 - dst, &sz, "%u%c", cigops[ idx ].oplen, cigops[ idx ].op );
+        dst += sz;
     }
     if ( NM_adjustment != NULL )
         *NM_adjustment = sum_of_n_lengths;
     return rc;
 }
+rc_t cg_canonical_print_cigar( const char * cigar, size_t cigar_len)
+{
+    rc_t rc;
+    if ( cigar_len > 0 )
+    {
+        int i,total_cnt,cnt;
+        char op;
+        for(i=0,cnt=0,op=0,cnt=0;i<cigar_len;i++){
+                if(isdigit(cigar[i])){
+                        cnt=cnt*10+(cigar[i]-'0');
+                } else if(isalpha(cigar[i])){
+                        if(op=='\0'){ /** first op **/
+                                total_cnt=cnt;
+                        } else if(op==cigar[i]){ /** merging consequitive ops **/
+                                total_cnt+=cnt;
+                        } else {
+                                if(total_cnt > 0) KOutMsg( "%d%c", total_cnt,op );
+                                total_cnt=cnt;
+                        }
+                        op=cigar[i];
+                        cnt=0;
+                } else {
+                        assert(0); /*** should never happen inside this function ***/
+                }
+        }
+        if(total_cnt && op) KOutMsg( "%d%c", total_cnt,op );
+    }
+    else
+        rc = KOutMsg( "*" );
+    return rc;
+}
+
diff --git a/tools/sra-pileup/cg_tools.h b/tools/sra-pileup/cg_tools.h
index 5fac13a..9f7bd66 100644
--- a/tools/sra-pileup/cg_tools.h
+++ b/tools/sra-pileup/cg_tools.h
@@ -36,6 +36,8 @@ extern "C" {
 
 #include <klib/rc.h>
 #include <insdc/sra.h>
+#include <insdc/sra.h>
+#include <align/reference.h>
 
 #define MAX_CG_CIGAR_LEN ( ( 11 * 35 ) + 1 )
 #define MAX_GC_LEN ( ( 11 * 3 ) + 1 )
@@ -98,27 +100,38 @@ int32_t ExplodeCIGAR( CigOps dst[], uint32_t len, char const cigar[], uint32_t c
 uint32_t CombineCIGAR( char dst[], CigOps const seqOp[], uint32_t seq_len,
                        uint32_t refPos, CigOps const refOp[], uint32_t ref_len );
 
+#define RNA_SPLICE_UNKNOWN 0
+#define RNA_SPLICE_FWD 1
+#define RNA_SPLICE_REV 2
 
 typedef struct rna_splice_candidate
 {
-    uint32_t offset;
+    uint32_t ref_offset;
     uint32_t len;
     uint32_t op_idx;
-    uint32_t matched;
+    uint32_t matched;   /* 0..unknown, 1..fwd, 2..rev */
 } rna_splice_candidate;
 
 
-#define MAX_RNA_SPLICE_CANDIDATES 10
+#define MAX_RNA_SPLICE_CANDIDATES 20
 
 typedef struct rna_splice_candidates
 {
     rna_splice_candidate candidates[ MAX_RNA_SPLICE_CANDIDATES ];
-    uint32_t count, fwd_matched, rev_matched;
+    CigOps * cigops;
+    uint32_t count, fwd_matched, rev_matched, cigops_len;
+    int32_t n_cigops;
 } rna_splice_candidates;
 
 
 rc_t discover_rna_splicing_candidates( uint32_t cigar_len, const char * cigar, uint32_t min_len, rna_splice_candidates * candidates );
 
+rc_t check_rna_splicing_candidates_against_ref( struct ReferenceObj const * ref_obj,
+                                                uint32_t splice_level,
+                                                INSDC_coord_zero pos,
+                                                rna_splice_candidates * candidates );
+
 rc_t change_rna_splicing_cigar( uint32_t cigar_len, char * cigar, rna_splice_candidates * candidates, uint32_t * NM_adjustment );
+rc_t cg_canonical_print_cigar( const char * cigar, size_t cigar_len);
 
 #endif
diff --git a/tools/sra-pileup/cmdline_cmn.c b/tools/sra-pileup/cmdline_cmn.c
index 3a93b03..30ce3da 100644
--- a/tools/sra-pileup/cmdline_cmn.c
+++ b/tools/sra-pileup/cmdline_cmn.c
@@ -71,6 +71,7 @@ const char * schema_usage[] = { "optional schema-file to be used", NULL };
 
 const char * no_mt_usage[] = { "disable multithreading", NULL };
 
+const char * timing_usage[] = { "write timing log-file", NULL };
 
 #define OPTION_OUTF    "outfile"
 #define ALIAS_OUTF     "o"
@@ -91,6 +92,7 @@ const char * no_mt_usage[] = { "disable multithreading", NULL };
 #define ALIAS_SCHEMA  "S"
 
 #define OPTION_NO_MT  "disable-multithreading"
+#define OPTION_TIMING "timing"
 
 OptDef CommonOptions[] =
 {
@@ -102,7 +104,8 @@ OptDef CommonOptions[] =
     { OPTION_BZIP,    ALIAS_BZIP,    NULL, bzip_usage,    1,        false,       false },
     { OPTION_INF,     ALIAS_INF,     NULL, inf_usage,     0,        true,        false },
     { OPTION_SCHEMA,  ALIAS_SCHEMA,  NULL, schema_usage,  1,        true,        false },
-    { OPTION_NO_MT,   NULL,          NULL, no_mt_usage,   1,        false,       false }    
+    { OPTION_NO_MT,   NULL,          NULL, no_mt_usage,   1,        false,       false },  
+    { OPTION_TIMING,  NULL,          NULL, timing_usage,  1,        true,        false }
 };
 
 
@@ -169,6 +172,9 @@ rc_t get_common_options( Args * args, common_options *opts )
         rc = get_str_option( args, OPTION_SCHEMA, &opts->schema_file );
 
     if ( rc == 0 )
+        rc = get_str_option( args, OPTION_TIMING, &opts->timing_file );
+
+    if ( rc == 0 )
     {
         const char * table2use = NULL;
         rc = get_str_option( args, OPTION_TABLE, &table2use );
@@ -201,7 +207,8 @@ void print_common_helplines( void )
     HelpOptionLine ( ALIAS_TABLE, OPTION_TABLE, "shortcut", table_usage );
     HelpOptionLine ( ALIAS_BZIP, OPTION_BZIP, NULL, bzip_usage );
     HelpOptionLine ( ALIAS_GZIP, OPTION_GZIP, NULL, gzip_usage );
-    HelpOptionLine ( NULL, OPTION_NO_MT, NULL, no_mt_usage );    
+    HelpOptionLine ( NULL, OPTION_NO_MT, NULL, no_mt_usage );
+    HelpOptionLine ( NULL, OPTION_TIMING, NULL, timing_usage );
 }
 
 
@@ -218,7 +225,7 @@ size_t CommonOptions_count( void )
 
 /* =========================================================================================== */
 
-
+#if 0
 static int cmp_pchar( const char * a, const char * b )
 {
     int res = 0;
@@ -230,7 +237,7 @@ static int cmp_pchar( const char * a, const char * b )
     }
     return res;
 }
-
+#endif
 
 /* =========================================================================================== */
 
@@ -456,7 +463,7 @@ static rc_t split_argument_into_path_and_readgroup( const char *argument, char *
         if ( rc == 0 )
         {
             VPath * vpath;
-            rc = VFSManagerMakePath ( mgr, &vpath, argument );
+            rc = VFSManagerMakePath ( mgr, &vpath, "%s", argument );
             if ( rc == 0 )
             {
                 rc = test_split_vpath_into_path_and_readgroup( vpath, argument, path, attribute );
@@ -563,7 +570,7 @@ static rc_t prepare_whole_file( prepare_ctx * ctx )
                 }
                 else
                 {
-                    rc = ctx->on_section( ctx, 0, 0 );
+                    rc = ctx->on_section( ctx, NULL );
                     if ( rc == 0 )
                         ReferenceObj_Release( ctx->refobj );
                 }
@@ -573,23 +580,23 @@ static rc_t prepare_whole_file( prepare_ctx * ctx )
     else
     {
         ctx->refobj = NULL;
-        rc = ctx->on_section( ctx, 0, 0 );
+        rc = ctx->on_section( ctx, NULL );
     }
     return rc;
 }
 
 
-static rc_t CC prepare_region_cb( const char * name, uint32_t start, uint32_t end, void * data )
+static rc_t CC prepare_region_cb( const char * name, const struct reference_range * range, void * data )
 {
     prepare_ctx * ctx = ( prepare_ctx * )data;
     rc_t rc = ReferenceList_Find( ctx->reflist, &ctx->refobj, name, string_size( name ) );
     if ( rc != 0 )
     {
-        LOGERR( klogInt, rc, "ReferenceList_Find() failed" );
+        rc = 0;
     }
     else
     {
-        rc = ctx->on_section( ctx, start, end );
+        rc = ctx->on_section( ctx, range );
         if ( rc == 0 )
             ReferenceObj_Release( ctx->refobj );
     }
@@ -681,7 +688,7 @@ rc_t prepare_ref_iter( prepare_ctx *ctx,
             else
             {
                 /* pick only the requested ranges... */
-                rc = foreach_ref_region( regions, prepare_region_cb, ctx );
+                rc = foreach_ref_region( regions, prepare_region_cb, ctx ); /* ref_regions.c */
             }
         }
         if ( ctx->reflist != NULL )
diff --git a/tools/sra-pileup/cmdline_cmn.h b/tools/sra-pileup/cmdline_cmn.h
index 7dd71e2..364bfcc 100644
--- a/tools/sra-pileup/cmdline_cmn.h
+++ b/tools/sra-pileup/cmdline_cmn.h
@@ -71,6 +71,7 @@ typedef struct common_options
     const char * output_file;
     const char * input_file;
     const char * schema_file;
+    const char * timing_file;
 } common_options;
 
 
@@ -86,6 +87,15 @@ rc_t init_ref_regions( BSTree * regions, Args * args );
 rc_t foreach_argument( Args * args, KDirectory *dir, bool div_by_spotgrp, bool * empty,
     rc_t ( CC * on_argument ) ( const char * path, const char * spot_group, void * data ), void * data );
 
+
+typedef struct pileup_col_ids
+{
+    uint32_t idx_quality;
+    uint32_t idx_ref_orientation;
+    uint32_t idx_read_filter;
+    uint32_t idx_template_len;
+} pileup_col_ids;
+
     
 typedef struct prepare_ctx
 {
@@ -93,6 +103,15 @@ typedef struct prepare_ctx
     PlacementSetIterator *plset_iter;
     const VDatabase *db;
     const VTable *seq_tab;
+
+    const VCursor *prim_cur;
+    const VCursor *sec_cur;
+    const VCursor *ev_cur;
+
+    pileup_col_ids *prim_cur_ids;
+    pileup_col_ids *sec_cur_ids;
+    pileup_col_ids *ev_cur_ids;
+
     const ReferenceList *reflist;
     const ReferenceObj *refobj;
     const char * spot_group;
@@ -103,7 +122,7 @@ typedef struct prepare_ctx
     bool use_evidence_alignments;
     void * data;
     const char *path;
-    rc_t ( CC * on_section ) ( struct prepare_ctx * ctx, uint32_t start, uint32_t end );
+    rc_t ( CC * on_section ) ( struct prepare_ctx * ctx, const struct reference_range * range );
 } prepare_ctx;
 
 
diff --git a/tools/sra-pileup/dyn_string.c b/tools/sra-pileup/dyn_string.c
new file mode 100644
index 0000000..6cb4bd7
--- /dev/null
+++ b/tools/sra-pileup/dyn_string.c
@@ -0,0 +1,186 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "dyn_string.h"
+#include <klib/text.h>
+#include <klib/printf.h>
+#include <klib/out.h>
+
+typedef struct dyn_string
+{
+    char * data;
+    size_t allocated;
+    size_t data_len;
+} dyn_string;
+
+
+rc_t allocated_dyn_string ( struct dyn_string **self, size_t size )
+{
+    rc_t rc = 0;
+    struct dyn_string * res = malloc( sizeof *res );
+    *self = NULL;
+    if ( res == NULL )
+        rc = RC( rcApp, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+    else
+    {
+        res->data_len = 0;
+        res->data = malloc( size );
+        if ( res->data != NULL )
+            res->allocated = size;
+        else
+        {
+            res->allocated = 0;
+            rc = RC( rcApp, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+        }
+        if ( rc != 0 )
+            free( res );
+        else
+            *self = res;
+    }
+    return rc;
+}
+
+
+void free_dyn_string ( struct dyn_string *self )
+{
+    free( self->data );
+    self->data = NULL;
+    self->allocated = 0;
+    self->data_len = 0;
+    free( ( void * ) self );
+}
+
+
+void reset_dyn_string( struct dyn_string *self )
+{
+    self->data_len = 0;
+}
+
+
+rc_t expand_dyn_string( struct dyn_string *self, size_t new_size )
+{
+    rc_t rc = 0;
+    if ( new_size > self->allocated )
+    {
+        self->data = realloc ( self->data, new_size );
+        if ( self->data != NULL )
+        {
+            self->allocated = new_size;
+        }
+        else
+        {
+            self->allocated = 0;
+            self->data_len = 0;
+            rc = RC( rcApp, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+        }
+    }
+    return rc;
+}
+
+
+rc_t add_char_2_dyn_string( struct dyn_string *self, const char c )
+{
+    /* does nothing if self->data_len + 2 < self->allocated */
+    rc_t rc = expand_dyn_string( self, self->data_len + 2 );
+    if ( rc == 0 )
+    {
+        self->data[ self->data_len++ ] = c;
+        self->data[ self->data_len ] = 0;
+    }
+    return rc;
+}
+
+
+char * dyn_string_char( struct dyn_string *self, uint32_t idx )
+{
+    return( &self->data[ idx ] );
+}
+
+
+rc_t add_string_2_dyn_string( struct dyn_string *self, const char * s )
+{
+    rc_t rc;
+    size_t size = string_size ( s );
+    /* does nothing if self->data_len + size + 1 < self->allocated */
+    rc = expand_dyn_string( self, self->data_len + size + 1 );
+    if ( rc == 0 )
+    {
+        string_copy ( &(self->data[ self->data_len ]), self->allocated, s, size );
+        self->data_len += size;
+        self->data[ self->data_len ] = 0;
+    }
+    return rc;
+}
+
+
+rc_t print_2_dyn_string( struct dyn_string * self, const char *fmt, ... )
+{
+    rc_t rc = 0;
+    bool not_enough;
+
+    do
+    {
+        size_t num_writ;
+        va_list args;
+        va_start ( args, fmt );
+        rc = string_vprintf ( &(self->data[ self->data_len ]), 
+                              self->allocated - ( self->data_len + 1 ),
+                              &num_writ,
+                              fmt,
+                              args );
+        va_end ( args );
+
+        if ( rc == 0 )
+        {
+            self->data_len += num_writ;
+            self->data[ self->data_len ] = 0;
+        }
+        not_enough = ( GetRCState( rc ) == rcInsufficient );
+        if ( not_enough )
+        {
+            rc = expand_dyn_string( self, self->allocated + ( num_writ * 2 ) );
+        }
+    } while ( not_enough && rc == 0 );
+    return rc;
+}
+
+
+rc_t print_dyn_string( struct dyn_string * self )
+{
+    if ( self != NULL )
+        return KOutMsg( "%.*s", self->data_len, self->data );
+    else
+        return 0;
+}
+
+
+size_t dyn_string_len( struct dyn_string * self )
+{
+    if ( self != NULL )
+        return self->data_len;
+    else
+        return 0;
+}
diff --git a/tools/sra-pileup/dyn_string.h b/tools/sra-pileup/dyn_string.h
new file mode 100644
index 0000000..b51cd99
--- /dev/null
+++ b/tools/sra-pileup/dyn_string.h
@@ -0,0 +1,54 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_dyn_string_
+#define _h_dyn_string_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <klib/rc.h>
+
+struct dyn_string;
+
+rc_t allocated_dyn_string ( struct dyn_string **self, size_t size );
+void free_dyn_string ( struct dyn_string *self );
+
+void reset_dyn_string( struct dyn_string *self );
+rc_t expand_dyn_string( struct dyn_string *self, size_t new_size );
+rc_t add_char_2_dyn_string( struct dyn_string *self, const char c );
+char * dyn_string_char( struct dyn_string *self, uint32_t idx );
+rc_t add_string_2_dyn_string( struct dyn_string *self, const char * s );
+rc_t print_2_dyn_string( struct dyn_string * self, const char *fmt, ... );
+rc_t print_dyn_string( struct dyn_string * self );
+size_t dyn_string_len( struct dyn_string * self );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* dyn_string_ */
diff --git a/tools/sra-pileup/inputfiles.c b/tools/sra-pileup/inputfiles.c
index 0c8ba0d..12c9584 100644
--- a/tools/sra-pileup/inputfiles.c
+++ b/tools/sra-pileup/inputfiles.c
@@ -299,7 +299,7 @@ static rc_t split_input_files( input_files *self, const VDBManager *mgr,
             rc = VNameListGet( src, src_idx, &path );
             if ( rc == 0 && path != NULL )
             {
-                int path_type = VDBManagerPathType ( mgr, path );
+                int path_type = VDBManagerPathType ( mgr, "%s", path );
                 if ( rc == 0 )
                 {
                     switch( path_type )
diff --git a/tools/sra-pileup/make_opt.pl b/tools/sra-pileup/make_opt.pl
new file mode 100755
index 0000000..cc2a7c9
--- /dev/null
+++ b/tools/sra-pileup/make_opt.pl
@@ -0,0 +1,13 @@
+#!/usr/bin/perl -w
+
+my $ref    =  $ARGV[ 0 ];
+my $start  =  $ARGV[ 1 ];
+my $length =  $ARGV[ 2 ];
+my $space  =  $ARGV[ 3 ];
+my $count  =  $ARGV[ 4 ];
+
+for ( my $i = 0; $i < $count; $i++ )
+{
+    printf "-r %s:%d-%d\n", $ref, $start, $start + $length;
+    $start += $space;
+}
diff --git a/tools/sra-pileup/perf_log.c b/tools/sra-pileup/perf_log.c
new file mode 100644
index 0000000..e21b475
--- /dev/null
+++ b/tools/sra-pileup/perf_log.c
@@ -0,0 +1,273 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <klib/rc.h>
+#include <klib/time.h>
+#include <klib/printf.h>
+
+#include <kfs/directory.h>
+#include <kfs/file.h>
+
+#include <stdarg.h>
+
+typedef struct perf_log perf_log;
+struct perf_log
+{
+    KFile * perf_log_file;
+    KTime time_stamp;
+    const char * tool_name;
+    const char * section_name;
+    const char * sub_section_name;
+
+    KTime_t tool_start;
+    KTime_t section_start;
+    KTime_t sub_section_start;
+    KTime_t chunk_start;
+
+    uint64_t file_pos;
+    uint64_t counter;
+    uint64_t limit;
+};
+
+
+const char * perf_log_unknown = "unknown";
+
+static const char * value_or_unknown( const char * value )
+{
+    const char * s;
+    if ( value == NULL ) s = perf_log_unknown; else s = value;
+    return s;
+}
+
+
+static void perf_log_write_args( struct perf_log * pl, const char *fmt, va_list vargs )
+{
+    if ( pl != NULL )
+    {
+        char buffer[ 1024 ];
+        size_t num_writ;
+        rc_t rc = string_vprintf ( buffer, sizeof buffer, &num_writ, fmt, vargs );
+        if ( rc == 0 )
+        {
+            size_t num_writ_2;
+            rc = KFileWriteAll ( pl->perf_log_file, pl->file_pos, buffer, num_writ, &num_writ_2 );
+            if ( rc == 0 )
+                pl->file_pos += num_writ_2;
+        }
+    }
+}
+
+
+static void perf_log_write( struct perf_log * pl, const char *fmt, ... )
+{
+    if ( pl != NULL )
+    {
+        va_list args;
+
+        va_start ( args, fmt );
+        perf_log_write_args ( pl, fmt, args );
+        va_end ( args );
+    }
+}
+
+
+static void write_tool_start( struct perf_log * pl )
+{
+    KTime t;
+    KTimeLocal ( &t, pl->tool_start );
+    perf_log_write( pl, "start >%s< at %T\n", value_or_unknown( pl->tool_name ), &t );
+}
+
+
+static void write_tool_end( struct perf_log * pl )
+{
+    KTime_t tool_end = KTimeStamp();
+    KTime t;
+    KTimeLocal ( &t, tool_end );
+    perf_log_write( pl, "end.. >%s< at %T ( %lu seconds )\n",
+                    value_or_unknown( pl->tool_name ), &t, ( tool_end - pl->tool_start ) );
+}
+
+struct perf_log * make_perf_log( const char * filename, const char * toolname )
+{
+    struct perf_log * res = NULL;
+    KDirectory * dir;
+    rc_t rc = KDirectoryNativeDir ( &dir );
+    if ( rc == 0 )
+    {
+        KFile * f;
+        rc = KDirectoryCreateFile ( dir, &f, false, 0664, kcmInit, "%s", filename );
+        if ( rc == 0 )
+        {
+            res = malloc( sizeof * res );
+            if ( res != NULL )
+            {
+                res->perf_log_file = f;
+                KTimeLocal ( &res->time_stamp, KTimeStamp() );
+                if ( toolname != NULL )
+                    res->tool_name = string_dup_measure ( toolname, NULL );
+                else
+                    res->tool_name = NULL;
+                res->section_name = NULL;
+                res->sub_section_name = NULL;
+                res->tool_start = KTimeStamp();
+                res->section_start = res->tool_start;
+                res->sub_section_start = res->tool_start;
+                res->chunk_start = res->tool_start;
+
+                res->file_pos = 0;
+                res->counter = 0;
+                res->limit = 10000;
+                write_tool_start( res );
+            }
+            else
+                KFileRelease ( f );
+        }
+        KDirectoryRelease ( dir );
+    }
+    return res;
+}
+
+
+void free_perf_log( struct perf_log * pl )
+{
+    if ( pl != NULL )
+    {
+        write_tool_end( pl );
+        KFileRelease ( pl->perf_log_file );
+        if ( pl->tool_name != NULL ) free( ( void * )pl->tool_name );
+        free( ( void * ) pl );
+    }
+}
+
+
+void perf_log_start_section( struct perf_log * pl, const char * section_name )
+{
+    if ( pl != NULL )
+    {
+        KTime t;
+        pl->section_start = KTimeStamp();
+        KTimeLocal ( &t, pl->section_start );
+
+        if ( pl->section_name != NULL ) free( ( void * ) pl->section_name );
+        if ( section_name != NULL )
+            pl->section_name = string_dup_measure ( section_name, NULL );
+        else
+            pl->section_name = NULL;
+
+        perf_log_write( pl, "start [%s] at %T\n",
+                        value_or_unknown( pl->section_name ), &t );
+    }
+}
+
+
+void perf_log_end_section( struct perf_log * pl )
+{
+    if ( pl != NULL )
+    {
+        KTime_t section_end = KTimeStamp();
+        KTime t;
+        KTimeLocal ( &t, section_end );
+        perf_log_write( pl, "end.. [%s] at %T ( %lu seconds )\n",
+                        value_or_unknown( pl->section_name ), &t, ( section_end - pl->section_start ) );
+
+        if ( pl->section_name != NULL )
+        {
+            free( ( void * ) pl->section_name );
+            pl->section_name = NULL;
+        }
+    }
+}
+
+
+void perf_log_start_sub_section( struct perf_log * pl, const char * sub_section_name )
+{
+    if ( pl != NULL )
+    {
+        KTime t;
+        pl->sub_section_start = KTimeStamp();
+        pl->chunk_start = pl->sub_section_start;
+        pl->counter = 0;
+        KTimeLocal ( &t, pl->sub_section_start );
+
+        if ( pl->sub_section_name != NULL ) free( ( void * ) pl->sub_section_name );
+        if ( sub_section_name != NULL )
+            pl->sub_section_name = string_dup_measure ( sub_section_name, NULL );
+        else
+            pl->sub_section_name = NULL;
+
+        perf_log_write( pl, "start (%s) at %T\n",
+                        value_or_unknown( pl->sub_section_name ), &t );
+    }
+}
+
+
+void perf_log_end_sub_section( struct perf_log * pl )
+{
+    if ( pl != NULL )
+    {
+        KTime_t sub_section_end = KTimeStamp();
+        KTime t;
+        KTimeLocal ( &t, sub_section_end );
+        perf_log_write( pl, "end.. (%s) at %T ( %lu seconds )\n",
+                        value_or_unknown( pl->sub_section_name ), &t, ( sub_section_end - pl->sub_section_start ) );
+
+        if ( pl->sub_section_name != NULL )
+        {
+            free( ( void * ) pl->sub_section_name );
+            pl->sub_section_name = NULL;
+        }
+    }
+}
+
+
+static uint64_t lpm( uint64_t seconds, uint64_t written )
+{
+    uint64_t res = 0;
+    if ( seconds > 0 )
+        res = ( written * 60 ) / seconds;
+    return res;
+}
+
+
+void perf_log_line( struct perf_log * pl, uint64_t pos )
+{
+    if ( pl != NULL )
+    {
+        pl->counter++;
+        if ( pl->counter > pl->limit )
+        {
+            KTime_t chunk_end = KTimeStamp();
+            uint64_t seconds = ( chunk_end - pl->chunk_start );
+            
+            perf_log_write( pl, "%lu lines in %lu seconds, at %lu, lpm = %lu\n",
+                            pl->limit, seconds, pos, lpm( seconds, pl->counter ) );
+
+            pl->counter = 0;
+            pl->chunk_start = chunk_end;
+        }
+    }
+}
\ No newline at end of file
diff --git a/tools/sra-pileup/perf_log.h b/tools/sra-pileup/perf_log.h
new file mode 100644
index 0000000..7ca9d13
--- /dev/null
+++ b/tools/sra-pileup/perf_log.h
@@ -0,0 +1,52 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_perf_log_
+#define _h_perf_log_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct perf_log;
+
+struct perf_log * make_perf_log( const char * filename, const char * toolname );
+void free_perf_log( struct perf_log * pl );
+
+void perf_log_start_section( struct perf_log * pl, const char * section_name );
+void perf_log_end_section( struct perf_log * pl );
+
+void perf_log_start_sub_section( struct perf_log * pl, const char * sub_section_name );
+void perf_log_end_sub_section( struct perf_log * pl );
+
+void perf_log_line( struct perf_log * pl, uint64_t pos );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*  _h_perf_log_ */
diff --git a/tools/sra-pileup/pileup_counters.c b/tools/sra-pileup/pileup_counters.c
new file mode 100644
index 0000000..f63cbab
--- /dev/null
+++ b/tools/sra-pileup/pileup_counters.c
@@ -0,0 +1,447 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <klib/out.h>
+
+#include "ref_walker_0.h"
+#include "4na_ascii.h"
+
+static uint32_t percent( uint32_t v1, uint32_t v2 )
+{
+    uint32_t sum = v1 + v2;
+    uint32_t res = 0;
+    if ( sum > 0 )
+        res = ( ( v1 * 100 ) / sum );
+    return res;
+}
+
+typedef struct indel_fragment
+{
+    BSTNode node;
+    const char * bases;
+    uint32_t len;
+    uint32_t count;
+} indel_fragment;
+
+
+static indel_fragment * make_indel_fragment( const char * bases, uint32_t len )
+{
+    indel_fragment * res = malloc( sizeof * res );
+    if ( res != NULL )
+    {
+        res->bases = string_dup ( bases, len );
+        if ( res->bases == NULL )
+        {
+            free( res );
+            res = NULL;
+        }
+        else
+        {
+            res->len = len;
+            res->count = 1;
+        }
+    }
+    return res;
+}
+
+
+static void CC free_indel_fragment( BSTNode * n, void * data )
+{
+    indel_fragment * fragment = ( indel_fragment * ) n;
+    if ( fragment != NULL )
+    {
+        free( ( void * ) fragment->bases );
+        free( fragment );
+    }
+}
+
+
+static void free_fragments( BSTree * fragments )
+{    
+    BSTreeWhack ( fragments, free_indel_fragment, NULL );
+}
+
+
+typedef struct find_fragment_ctx
+{
+    const char * bases;
+    uint32_t len;
+} find_fragment_ctx;
+
+
+static int CC cmp_fragment_vs_find_ctx( const void *item, const BSTNode *n )
+{
+    const indel_fragment * fragment = ( const indel_fragment * )n;
+    const find_fragment_ctx * fctx = ( const find_fragment_ctx * )item;
+    return string_cmp ( fctx->bases, fctx->len, fragment->bases, fragment->len, -1 );
+}
+
+
+static int CC cmp_fragment_vs_fragment( const BSTNode *item, const BSTNode *n )
+{
+    const indel_fragment * f1 = ( const indel_fragment * )item;
+    const indel_fragment * f2 = ( const indel_fragment * )n;
+    return string_cmp ( f1->bases, f1->len, f2->bases, f2->len, -1 );
+}
+
+
+static void count_indel_fragment( BSTree * fragments, const INSDC_4na_bin *bases, uint32_t len )
+{
+    find_fragment_ctx fctx;
+
+    fctx.bases = malloc( len );
+    if ( fctx.bases != NULL )
+    {
+        indel_fragment * fragment;
+        uint32_t i;
+
+        fctx.len = len;
+        for ( i = 0; i < len; ++i )
+            ( ( char * )fctx.bases )[ i ] = _4na_to_ascii( bases[ i ], false );
+
+        fragment = ( indel_fragment * ) BSTreeFind ( fragments, &fctx, cmp_fragment_vs_find_ctx );
+        if ( fragment == NULL )
+        {
+            fragment = make_indel_fragment( fctx.bases, len );
+            if ( fragment != NULL )
+            {
+                rc_t rc = BSTreeInsert ( fragments, ( BSTNode * )fragment, cmp_fragment_vs_fragment );
+                if ( rc != 0 )
+                    free_indel_fragment( ( BSTNode * )fragment, NULL );
+            }
+        }
+        else
+            fragment->count++;
+
+        free( ( void * ) fctx.bases );
+    }
+}
+
+
+typedef struct walk_fragment_ctx
+{
+    rc_t rc;
+    uint32_t n;
+} walk_fragment_ctx;
+
+
+static void CC on_fragment( BSTNode *n, void *data )
+{
+    walk_fragment_ctx * wctx = data;
+    const indel_fragment * fragment = ( const indel_fragment * )n;
+    if ( wctx->rc == 0 )
+    {
+        if ( wctx->n == 0 )
+            wctx->rc = KOutMsg( "%u-%.*s", fragment->count, fragment->len, fragment->bases );
+        else
+            wctx->rc = KOutMsg( "|%u-%.*s", fragment->count, fragment->len, fragment->bases );
+        wctx->n++;
+    }
+}
+
+
+static rc_t print_fragments( BSTree * fragments )
+{
+    walk_fragment_ctx wctx;
+    wctx.rc = 0;
+    wctx.n = 0;
+    BSTreeForEach ( fragments, false, on_fragment, &wctx );
+    return wctx.rc;
+}
+
+/* =========================================================================================== */
+
+typedef struct pileup_counters
+{
+    uint32_t matches;
+    uint32_t mismatches[ 4 ];
+    uint32_t inserts;
+    uint32_t deletes;
+    uint32_t forward;
+    uint32_t reverse;
+    uint32_t starting;
+    uint32_t ending;
+    BSTree insert_fragments;
+    BSTree delete_fragments;
+} pileup_counters;
+
+
+static void clear_counters( pileup_counters * counters )
+{
+    uint32_t i;
+
+    counters->matches = 0;
+    for ( i = 0; i < 4; ++i )
+        counters->mismatches[ i ] = 0;
+    counters->inserts = 0;
+    counters->deletes = 0;
+    counters->forward = 0;
+    counters->reverse = 0;
+    counters->starting = 0;
+    counters->ending = 0;
+    BSTreeInit( &(counters->insert_fragments) );
+    BSTreeInit( &(counters->delete_fragments) );
+}
+
+
+static void walk_counter_state( ReferenceIterator *ref_iter, int32_t state, bool reverse,
+                                pileup_counters * counters )
+{
+    if ( ( state & align_iter_invalid ) == align_iter_invalid )
+        return;
+
+    if ( ( state & align_iter_skip ) != align_iter_skip )
+    {
+        if ( ( state & align_iter_match ) == align_iter_match )
+            (counters->matches)++;
+        else
+        {
+            char c = _4na_to_ascii( state, false );
+            switch( c )
+            {
+                case 'A' : ( counters->mismatches[ 0 ] )++; break;
+                case 'C' : ( counters->mismatches[ 1 ] )++; break;
+                case 'G' : ( counters->mismatches[ 2 ] )++; break;
+                case 'T' : ( counters->mismatches[ 3 ] )++; break;
+            }
+        }
+    }
+
+    if ( reverse )
+        (counters->reverse)++;
+    else
+        (counters->forward)++;
+
+    if ( ( state & align_iter_insert ) == align_iter_insert )
+    {
+        const INSDC_4na_bin *bases;
+        uint32_t n = ReferenceIteratorBasesInserted ( ref_iter, &bases );
+        (counters->inserts) += n;
+        count_indel_fragment( &(counters->insert_fragments), bases, n );
+    }
+
+    if ( ( state & align_iter_delete ) == align_iter_delete )
+    {
+        const INSDC_4na_bin *bases;
+        INSDC_coord_zero ref_pos;
+        uint32_t n = ReferenceIteratorBasesDeleted ( ref_iter, &ref_pos, &bases );
+        if ( bases != NULL )
+        {
+            (counters->deletes) += n;
+            count_indel_fragment( &(counters->delete_fragments), bases, n );
+            free( (void *) bases );
+        }
+    }
+
+    if ( ( state & align_iter_first ) == align_iter_first )
+        ( counters->starting)++;
+
+    if ( ( state & align_iter_last ) == align_iter_last )
+        ( counters->ending)++;
+}
+
+
+static rc_t print_counter_line( const char * ref_name,
+                                INSDC_coord_zero ref_pos,
+                                INSDC_4na_bin ref_base,
+                                uint32_t depth,
+                                pileup_counters * counters )
+{
+    char c = _4na_to_ascii( ref_base, false );
+
+    rc_t rc = KOutMsg( "%s\t%u\t%c\t%u\t", ref_name, ref_pos + 1, c, depth );
+
+    if ( rc == 0 && counters->matches > 0 )
+        rc = KOutMsg( "%u", counters->matches );
+
+    if ( rc == 0 /* && counters->mismatches[ 0 ] > 0 */ )
+        rc = KOutMsg( "\t%u-A", counters->mismatches[ 0 ] );
+
+    if ( rc == 0 /* && counters->mismatches[ 1 ] > 0 */ )
+        rc = KOutMsg( "\t%u-C", counters->mismatches[ 1 ] );
+
+    if ( rc == 0 /* && counters->mismatches[ 2 ] > 0 */ )
+        rc = KOutMsg( "\t%u-G", counters->mismatches[ 2 ] );
+
+    if ( rc == 0 /* && counters->mismatches[ 3 ] > 0 */ )
+        rc = KOutMsg( "\t%u-T", counters->mismatches[ 3 ] );
+
+    if ( rc == 0 )
+        rc = KOutMsg( "\tI:" );
+    if ( rc == 0 )
+        rc = print_fragments( &(counters->insert_fragments) );
+
+    if ( rc == 0 )
+        rc = KOutMsg( "\tD:" );
+    if ( rc == 0 )
+        rc = print_fragments( &(counters->delete_fragments) );
+
+    if ( rc == 0 )
+        rc = KOutMsg( "\t%u%%", percent( counters->forward, counters->reverse ) );
+
+    if ( rc == 0 && counters->starting > 0 )
+        rc = KOutMsg( "\tS%u", counters->starting );
+
+    if ( rc == 0 && counters->ending > 0 )
+        rc = KOutMsg( "\tE%u", counters->ending );
+
+    if ( rc == 0 )
+        rc = KOutMsg( "\n" );
+
+    free_fragments( &(counters->insert_fragments) );
+    free_fragments( &(counters->delete_fragments) );
+
+    return rc;
+}
+
+
+/* ........................................................................................... */
+
+
+static rc_t CC walk_counters_enter_ref_pos( walk_data * data )
+{
+    clear_counters( data->data );
+    return 0;
+}
+
+static rc_t CC walk_counters_exit_ref_pos( walk_data * data )
+{
+    rc_t rc = print_counter_line( data->ref_name, data->ref_pos, data->ref_base, data->depth, data->data );
+    return rc;
+}
+
+static rc_t CC walk_counters_placement( walk_data * data )
+{
+    walk_counter_state( data->ref_iter, data->state, data->xrec->reverse, data->data );
+    return 0;
+}
+
+rc_t walk_counters( ReferenceIterator *ref_iter, pileup_options *options )
+{
+    walk_data data;
+    walk_funcs funcs;
+    pileup_counters counters;
+
+    data.ref_iter = ref_iter;
+    data.options = options;
+    data.data = &counters;
+
+    funcs.on_enter_ref = NULL;
+    funcs.on_exit_ref = NULL;
+
+    funcs.on_enter_ref_window = NULL;
+    funcs.on_exit_ref_window = NULL;
+
+    funcs.on_enter_ref_pos = walk_counters_enter_ref_pos;
+    funcs.on_exit_ref_pos = walk_counters_exit_ref_pos;
+
+    funcs.on_enter_spotgroup = NULL;
+    funcs.on_exit_spotgroup = NULL;
+
+    funcs.on_placement = walk_counters_placement;
+
+    return walk_0( &data, &funcs );
+}
+
+
+/* =========================================================================================== */
+
+
+static rc_t print_mismatches_line( const char * ref_name,
+                                   INSDC_coord_zero ref_pos,
+                                   uint32_t depth,
+                                   uint32_t min_mismatch_percent,
+                                   pileup_counters * counters )
+{
+    rc_t rc = 0;
+    if ( depth > 0 )
+    {
+        uint32_t total_mismatches = counters->mismatches[ 0 ] +
+                                    counters->mismatches[ 1 ] +
+                                    counters->mismatches[ 2 ] +
+                                    counters->mismatches[ 3 ];
+	if ( total_mismatches * 100 >= min_mismatch_percent * depth) 
+        {
+                rc = KOutMsg( "%s\t%u\t%u\t%u\n", ref_name, ref_pos + 1, depth, total_mismatches );
+        }
+    }
+    
+    free_fragments( &(counters->insert_fragments) );
+    free_fragments( &(counters->delete_fragments) );
+
+    return rc;
+}
+
+
+/* ........................................................................................... */
+
+
+static rc_t CC walk_mismatches_enter_ref_pos( walk_data * data )
+{
+    clear_counters( data->data );
+    return 0;
+}
+
+static rc_t CC walk_mismatches_exit_ref_pos( walk_data * data )
+{
+    rc_t rc = print_mismatches_line( data->ref_name, data->ref_pos,
+                                     data->depth, data->options->min_mismatch, data->data );
+    return rc;
+}
+
+static rc_t CC walk_mismatches_placement( walk_data * data )
+{
+    walk_counter_state( data->ref_iter, data->state, data->xrec->reverse, data->data );
+    return 0;
+}
+
+
+rc_t walk_mismatches( ReferenceIterator *ref_iter, pileup_options * options )
+{
+    walk_data data;
+    walk_funcs funcs;
+    pileup_counters counters;
+
+    data.ref_iter = ref_iter;
+    data.options = options;
+    data.data = &counters;
+
+    funcs.on_enter_ref = NULL;
+    funcs.on_exit_ref = NULL;
+
+    funcs.on_enter_ref_window = NULL;
+    funcs.on_exit_ref_window = NULL;
+
+    funcs.on_enter_ref_pos = walk_mismatches_enter_ref_pos;
+    funcs.on_exit_ref_pos = walk_mismatches_exit_ref_pos;
+
+    funcs.on_enter_spotgroup = NULL;
+    funcs.on_exit_spotgroup = NULL;
+
+    funcs.on_placement = walk_mismatches_placement;
+
+    return walk_0( &data, &funcs );
+}
diff --git a/tools/sra-pileup/pileup_counters.h b/tools/sra-pileup/pileup_counters.h
new file mode 100644
index 0000000..f70f3a7
--- /dev/null
+++ b/tools/sra-pileup/pileup_counters.h
@@ -0,0 +1,41 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_pileup_counters_
+#define _h_pileup_counters_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+rc_t walk_counters( ReferenceIterator *ref_iter, pileup_options *options );
+rc_t walk_mismatches( ReferenceIterator *ref_iter, pileup_options * options );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*  _h_pileup_counters_ */
diff --git a/tools/sra-pileup/pileup_index.c b/tools/sra-pileup/pileup_index.c
new file mode 100644
index 0000000..7534c85
--- /dev/null
+++ b/tools/sra-pileup/pileup_index.c
@@ -0,0 +1,122 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <klib/out.h>
+
+#include "ref_walker_0.h"
+#include "4na_ascii.h"
+
+static uint32_t percent( uint32_t v1, uint32_t v2 )
+{
+    uint32_t sum = v1 + v2;
+    uint32_t res = 0;
+    if ( sum > 0 )
+        res = ( ( v1 * 100 ) / sum );
+    return res;
+}
+
+
+typedef struct index_counters
+{
+    uint32_t base_counts[ 4 ];   /* 0...A, 1...C, 2...G, 3...T */
+    uint32_t inserts;
+    uint32_t deletes;
+    uint32_t forward;
+    uint32_t reverse;
+} index_counters;
+
+
+static rc_t CC walk_index_enter_ref_pos( walk_data * data )
+{
+    index_counters * ic = data->data;
+    memset( ic, 0, sizeof *ic );
+    return 0;
+}
+
+
+static rc_t CC walk_index_exit_ref_pos( walk_data * data )
+{
+    index_counters * ic = data->data;
+    if ( ic->forward + ic->reverse == 0 )
+        return 0;
+    else
+        return KOutMsg( "%s\t%u\t%u\t%u\t%u\t%u\t%u\t%u\t%u\n", 
+                     data->ref_name, data->ref_pos + 1, 
+                     ic->base_counts[ 0 ], ic->base_counts[ 1 ], ic->base_counts[ 2 ], ic->base_counts[ 3 ],
+                     ic->inserts, ic->deletes, percent( ic->forward, ic->reverse ) );
+}
+
+
+static rc_t CC walk_index_placement( walk_data * data )
+{
+    int32_t state = data->state;
+    if ( ( state & align_iter_invalid ) != align_iter_invalid )
+    {
+        index_counters * ic = data->data;
+
+        if ( ( state & align_iter_skip ) == align_iter_skip )
+            ( ic->deletes ) ++;
+        else
+            ic->base_counts[ _4na_to_index( state ) ] ++;
+
+        if ( data->xrec->reverse )
+            ( ic->reverse )++;
+        else
+            ( ic->forward )++;
+
+        if ( ( state & align_iter_insert ) == align_iter_insert )
+            ( ic->inserts )++;
+    }
+    return 0;
+}
+
+
+rc_t walk_index( ReferenceIterator *ref_iter, pileup_options * options )
+{
+    walk_data data;
+    walk_funcs funcs;
+    index_counters i_counters;
+
+    data.ref_iter = ref_iter;
+    data.options = options;
+    data.data = &i_counters;
+
+    funcs.on_enter_ref = NULL;
+    funcs.on_exit_ref = NULL;
+
+    funcs.on_enter_ref_window = NULL;
+    funcs.on_exit_ref_window = NULL;
+
+    funcs.on_enter_ref_pos = walk_index_enter_ref_pos;
+    funcs.on_exit_ref_pos = walk_index_exit_ref_pos;
+
+    funcs.on_enter_spotgroup = NULL;
+    funcs.on_exit_spotgroup = NULL;
+
+    funcs.on_placement = walk_index_placement;
+
+    return walk_0( &data, &funcs );
+}
diff --git a/tools/sra-pileup/pileup_index.h b/tools/sra-pileup/pileup_index.h
new file mode 100644
index 0000000..7e07bc9
--- /dev/null
+++ b/tools/sra-pileup/pileup_index.h
@@ -0,0 +1,40 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_pileup_index_
+#define _h_pileup_index_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+rc_t walk_index( ReferenceIterator *ref_iter, pileup_options * options );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*  _h_pileup_index_ */
diff --git a/tools/sra-pileup/pileup_options.h b/tools/sra-pileup/pileup_options.h
new file mode 100644
index 0000000..6d66595
--- /dev/null
+++ b/tools/sra-pileup/pileup_options.h
@@ -0,0 +1,61 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_pileup_options_
+#define _h_pileup_options_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "ref_regions.h"
+#include "cmdline_cmn.h"
+
+typedef struct pileup_options
+{
+    common_options cmn;     /* from cmdline_cmn.h */
+    bool process_dups;
+    bool omit_qualities;
+    bool read_tlen;
+    bool no_skip;
+    bool show_id;
+    bool div_by_spotgrp;
+    bool use_seq_name;
+    uint32_t minmapq;
+    uint32_t min_mismatch;
+    uint32_t merge_dist;
+    uint32_t source_table;
+    uint32_t function;  /* sra_pileup_samtools, sra_pileup_counters, sra_pileup_stat, 
+                           sra_pileup_report_ref, sra_pileup_report_ref_ext, sra_pileup_debug, etc */
+    struct skiplist * skiplist;     /* from ref_regions.h */
+} pileup_options;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*  pileup_options_ */
diff --git a/tools/sra-pileup/pileup_stat.c b/tools/sra-pileup/pileup_stat.c
new file mode 100644
index 0000000..8e74124
--- /dev/null
+++ b/tools/sra-pileup/pileup_stat.c
@@ -0,0 +1,391 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <klib/out.h>
+#include <klib/sort.h>
+
+#include "ref_walker_0.h"
+#include "4na_ascii.h"
+
+static uint32_t percent( uint32_t v1, uint32_t v2 )
+{
+    uint32_t sum = v1 + v2;
+    uint32_t res = 0;
+    if ( sum > 0 )
+        res = ( ( v1 * 100 ) / sum );
+    return res;
+}
+
+typedef struct tlen_array
+{
+    uint32_t * values;
+    uint32_t capacity;
+    uint32_t members;
+    uint32_t zeros;
+} tlen_array;
+
+
+static rc_t init_tlen_array( tlen_array * a, uint32_t init_capacity )
+{
+    rc_t rc = 0;
+    a->values = malloc( sizeof ( a->values[ 0 ] ) * init_capacity );
+    if ( a->values == NULL )
+        rc = RC ( rcApp, rcArgv, rcAccessing, rcMemory, rcExhausted );
+    else
+    {
+        a->capacity = init_capacity;
+        a->members = 0;
+        a->zeros = 0;
+    }
+    return rc;
+}
+
+
+static void finish_tlen_array( tlen_array * a )
+{
+    if ( a->values != NULL )
+    {
+        free( a->values );
+        a->values = NULL;
+    }
+}
+
+
+static rc_t realloc_tlen_array( tlen_array * a, uint32_t new_depth )
+{
+    rc_t rc = 0;
+    if ( new_depth > a->capacity )
+    {
+        void * p = realloc( a->values, ( sizeof ( a->values[ 0 ] ) ) * new_depth );
+        if ( a->values == NULL )
+            rc = RC ( rcApp, rcArgv, rcAccessing, rcMemory, rcExhausted );
+        else
+        {
+            a->values = p;
+            a->capacity = new_depth;
+        }
+    }
+    return rc;
+}
+
+
+static void remove_from_tlen_array( tlen_array * a, uint32_t count )
+{
+    if ( count > 0 )
+    {
+        if ( a->members < count )
+            a->members = 0;
+        else
+        {
+            a->members -= count;
+            memmove( &(a->values[ 0 ]), &(a->values[ count ]), a->members * ( sizeof a->values[ 0 ] ) );
+        }
+    }
+}
+
+
+static bool add_tlen_to_array( tlen_array * a, uint32_t value )
+{
+    bool res = ( value != 0 );
+    if ( !res )
+        a->zeros++;
+    else
+        a->values[ a->members++ ] = value;
+    return res;
+}
+
+
+#define INIT_WINDOW_SIZE 50
+#define MAX_SEQLEN_COUNT 500000
+
+typedef struct strand
+{
+    uint32_t alignment_count, window_size, window_max, seq_len_accu_count;
+    uint64_t seq_len_accu;
+    tlen_array tlen_w;          /* tlen accumulater for all alignmnts starting/ending in window ending at current position */
+    tlen_array tlen_l;          /* array holding the length of all position-slices in the window */
+    tlen_array zeros;
+} strand;
+
+
+typedef struct stat_counters
+{
+    strand pos;
+    strand neg;
+} stat_counters;
+
+
+static rc_t prepare_strand( strand * strand, uint32_t initial_size )
+{
+    rc_t rc = init_tlen_array( &strand->tlen_w, initial_size );
+    if ( rc == 0 )
+        rc = init_tlen_array( &strand->tlen_l, initial_size );
+    if ( rc == 0 )
+        rc = init_tlen_array( &strand->zeros, initial_size );
+    if ( rc == 0 )
+    {
+        strand->window_size = 0;
+        strand->window_max = INIT_WINDOW_SIZE;
+        strand->seq_len_accu_count = 0;
+        strand->seq_len_accu = 0;
+    }
+    return rc;
+}
+
+
+static rc_t prepare_stat_counters( stat_counters * counters, uint32_t initial_size )
+{
+    rc_t rc = prepare_strand( &counters->pos, initial_size );
+    if ( rc == 0 )
+        rc = prepare_strand( &counters->neg, initial_size );
+    return rc;
+}
+
+
+static void finish_strand( strand * strand )
+{
+    finish_tlen_array( &strand->tlen_w );
+    finish_tlen_array( &strand->tlen_l );
+    finish_tlen_array( &strand->zeros );
+}
+
+
+static void finish_stat_counters( stat_counters * counters )
+{
+    finish_strand( &counters->pos );
+    finish_strand( &counters->neg );
+}
+
+
+static rc_t realloc_strand( strand * strand, uint32_t new_depth )
+{
+    rc_t rc = realloc_tlen_array( &strand->tlen_w, strand->tlen_w.members + new_depth );
+    if ( rc == 0 )
+        rc = realloc_tlen_array( &strand->tlen_l, strand->tlen_l.members + new_depth );
+    if ( rc == 0 )
+        rc = realloc_tlen_array( &strand->zeros, strand->zeros.members + new_depth );
+    strand->alignment_count = 0;
+    return rc;
+}
+
+
+static void on_new_ref_position_strand( strand * strand )
+{
+    if ( ( strand->seq_len_accu_count < MAX_SEQLEN_COUNT ) && ( strand->seq_len_accu_count > 0 ) )
+    {
+        uint64_t w = ( strand->seq_len_accu / strand->seq_len_accu_count );
+        if ( w > strand->window_max )
+            strand->window_max = w;
+    }
+
+    if ( strand->window_size >= strand->window_max )
+    {
+        uint32_t to_remove = strand->tlen_l.values[ 0 ];
+        remove_from_tlen_array( &strand->tlen_w, to_remove );
+        remove_from_tlen_array( &strand->tlen_l, 1 );
+
+        to_remove = strand->zeros.values[ 0 ];
+        strand->tlen_w.zeros -= to_remove;
+        remove_from_tlen_array( &strand->zeros, 1 );
+    }
+    else
+        strand->window_size++;
+    strand->tlen_l.values[ strand->tlen_l.members++ ] = 0;
+    strand->zeros.values[ strand->zeros.members++ ] = 0;
+}
+
+
+static uint32_t medium( tlen_array * a )
+{
+    if ( a->members == 0 )
+        return 0;
+    else
+        return a->values[ a->members >> 1 ];
+}
+
+
+static uint32_t percentil( tlen_array * a, uint32_t p )
+{
+    if ( a->members == 0 )
+        return 0;
+    else
+        return a->values[ ( a->members * p ) / 100 ];
+}
+
+
+static rc_t print_header_line( void )
+{
+    return KOutMsg( "\nREFNAME----\tREFPOS\tREFBASE\tDEPTH\tSTRAND%%\tTL+#0\tTL+10%%\tTL+MED\tTL+90%%\tTL-#0\tTL-10%%\tTL-MED\tTL-90%%\n\n" );
+}
+
+
+/* ........................................................................................... */
+
+
+static rc_t CC walk_stat_enter_ref_window( walk_data * data )
+{
+    stat_counters * counters = data->data;
+    counters->pos.tlen_w.members = 0;
+    counters->pos.tlen_l.members = 0;
+    counters->neg.tlen_w.members = 0;
+    counters->neg.tlen_l.members = 0;
+    return 0;
+}
+
+
+static rc_t CC walk_stat_enter_ref_pos( walk_data * data )
+{
+    rc_t rc;
+    stat_counters * counters = data->data;
+
+    on_new_ref_position_strand( &counters->pos );
+    on_new_ref_position_strand( &counters->neg );
+
+    rc = realloc_strand( &counters->pos, data->depth );
+    if ( rc == 0 )
+        rc = realloc_strand( &counters->neg, data->depth );
+
+    return rc;
+}
+
+
+static rc_t CC walk_stat_exit_ref_pos( walk_data * data )
+{
+    char c = _4na_to_ascii( data->ref_base, false );
+    stat_counters * counters = data->data;
+
+    /* REF-NAME, REF-POS, REF-BASE, DEPTH */
+    rc_t rc = KOutMsg( "%s\t%u\t%c\t%u\t", data->ref_name, data->ref_pos + 1, c, data->depth );
+
+    /* STRAND-ness */
+    if ( rc == 0 )
+        rc = KOutMsg( "%u%%\t", percent( counters->pos.alignment_count, counters->neg.alignment_count ) );
+
+    /* TLEN-Statistic for sliding window, only starting/ending placements */
+    if ( rc == 0 )
+    {
+        tlen_array * a = &counters->pos.tlen_w;
+        if ( a->members > 1 )
+            ksort_uint32_t ( a->values, a->members );
+
+        rc = KOutMsg( "%u\t%u\t%u\t%u\t", a->zeros, percentil( a, 10 ), medium( a ), percentil( a, 90 ) );
+        if ( rc == 0 )
+        {
+            a = &counters->neg.tlen_w;
+            if ( a->members > 1 )
+                ksort_uint32_t ( a->values, a->members );
+            rc = KOutMsg( "%u\t%u\t%u\t%u\t", a->zeros, percentil( a, 10 ), medium( a ), percentil( a, 90 ) );
+        }
+    }
+
+/*
+    KOutMsg( "( %u,%u )\t", counters->pos.window_max, counters->neg.window_max );
+    KOutMsg( "< %u.%u, %u.%u ( %u.%u, %u.%u ) >",
+            counters->pos.tlen_w.members, counters->pos.tlen_w.capacity, counters->neg.tlen_w.members, counters->neg.tlen_w.capacity,
+            counters->pos.tlen_l.members, counters->pos.tlen_l.capacity, counters->neg.tlen_l.members, counters->neg.tlen_l.capacity );
+*/
+
+    if ( rc == 0 )
+        rc = KOutMsg( "\n" );
+
+    return rc;
+}
+
+
+static void walk_strand_placement( strand * strand, int32_t tlen, INSDC_coord_len seq_len )
+{
+    tlen_array * a;
+    uint32_t value =  ( tlen < 0 ) ? -tlen : tlen;
+    if ( add_tlen_to_array( &strand->tlen_w, value ) )
+        a = &strand->tlen_l;
+    else
+        a = &strand->zeros;
+    a->values[ a->members - 1 ]++;
+
+    if ( strand->seq_len_accu_count < MAX_SEQLEN_COUNT )
+    {
+        strand->seq_len_accu += seq_len;
+        strand->seq_len_accu_count++;
+    }
+}
+
+
+static rc_t CC walk_stat_placement( walk_data * data )
+{
+    int32_t state = data->state;
+    if ( ( state & align_iter_invalid ) != align_iter_invalid )
+    {
+        bool reverse = data->xrec->reverse;
+        stat_counters * counters = data->data;
+        strand * strand = ( reverse ) ? &counters->neg : &counters->pos;
+
+        strand->alignment_count++;
+
+        /* for TLEN-statistic on starting/ending placements at this pos */
+        if ( ( ( state & align_iter_last ) == align_iter_last )&&( reverse ) )
+            walk_strand_placement( strand, data->xrec->tlen, data->rec->len );
+        else if ( ( ( state & align_iter_first ) == align_iter_first )&&( !reverse ) )
+            walk_strand_placement( strand, data->xrec->tlen, data->rec->len );
+    }
+    return 0;
+}
+
+
+rc_t walk_stat( ReferenceIterator *ref_iter, pileup_options *options )
+{
+    walk_data data;
+    walk_funcs funcs;
+    stat_counters counters;
+
+    rc_t rc = print_header_line();
+    if ( rc == 0 )
+        rc = prepare_stat_counters( &counters, 1024 );
+    if ( rc == 0 )
+    {
+        data.ref_iter = ref_iter;
+        data.options = options;
+        data.data = &counters;
+
+        funcs.on_enter_ref = NULL;
+        funcs.on_exit_ref = NULL;
+
+        funcs.on_enter_ref_window = walk_stat_enter_ref_window;
+        funcs.on_exit_ref_window = NULL;
+
+        funcs.on_enter_ref_pos = walk_stat_enter_ref_pos;
+        funcs.on_exit_ref_pos = walk_stat_exit_ref_pos;
+
+        funcs.on_enter_spotgroup = NULL;
+        funcs.on_exit_spotgroup = NULL;
+
+        funcs.on_placement = walk_stat_placement;
+
+        rc = walk_0( &data, &funcs );
+
+        finish_stat_counters( &counters );
+    }
+    return rc;
+}
\ No newline at end of file
diff --git a/tools/sra-pileup/pileup_stat.h b/tools/sra-pileup/pileup_stat.h
new file mode 100644
index 0000000..7575822
--- /dev/null
+++ b/tools/sra-pileup/pileup_stat.h
@@ -0,0 +1,40 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_pileup_stat_
+#define _h_pileup_stat_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+rc_t walk_stat( ReferenceIterator *ref_iter, pileup_options *options );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*  _h_pileup_stat_ */
diff --git a/tools/sra-pileup/pileup_v2.c b/tools/sra-pileup/pileup_v2.c
new file mode 100644
index 0000000..937052d
--- /dev/null
+++ b/tools/sra-pileup/pileup_v2.c
@@ -0,0 +1,382 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <klib/out.h>
+#include <kapp/args.h>
+
+#include "pileup_options.h"
+#include "dyn_string.h"
+#include "ref_walker.h"
+#include "4na_ascii.h"
+
+/*
+static rc_t CC pileup_test_enter_ref( ref_walker_data * rwd )
+{
+    return KOutMsg( "\nentering >%s<\n", rwd->ref_name );
+}
+
+static rc_t CC pileup_test_exit_ref( ref_walker_data * rwd )
+{
+    return KOutMsg( "exit >%s<\n", rwd->ref_name );
+}
+
+static rc_t CC pileup_test_enter_ref_window( ref_walker_data * rwd )
+{
+    return KOutMsg( "   enter window >%s< [ %,lu ... %,lu ]\n", rwd->ref_name, rwd->ref_start, rwd->ref_end );
+}
+
+static rc_t CC pileup_test_exit_ref_window( ref_walker_data * rwd )
+{
+    return KOutMsg( "   exit window >%s< [ %,lu ... %,lu ]\n", rwd->ref_name, rwd->ref_start, rwd->ref_end );
+}
+
+static rc_t CC pileup_test_enter_ref_pos( ref_walker_data * rwd )
+{
+    return KOutMsg( "   enter pos [ %,lu ], d=%u\n", rwd->pos, rwd->depth );
+}
+
+static rc_t CC pileup_test_exit_ref_pos( ref_walker_data * rwd )
+{
+    return KOutMsg( "   exit pos [ %,lu ], d=%u\n", rwd->pos, rwd->depth );
+}
+
+static rc_t CC pileup_test_enter_spot_group( ref_walker_data * rwd )
+{
+    return KOutMsg( "       enter spot-group [ %,lu ], %.*s\n", rwd->pos, rwd->spot_group_len, rwd->spot_group );
+}
+
+static rc_t CC pileup_test_exit_spot_group( ref_walker_data * rwd )
+{
+    return KOutMsg( "       exit spot-group [ %,lu ], %.*s\n", rwd->pos, rwd->spot_group_len, rwd->spot_group );
+}
+
+static rc_t CC pileup_test_alignment( ref_walker_data * rwd )
+{
+    rc_t rc = KOutMsg( "          alignment\t" );
+    if ( rc == 0 )
+    {
+        if ( !rwd->valid )
+        {
+            KOutMsg( "invalid" );
+        }
+        else
+        {
+            KOutMsg( "%s%s", rwd->reverse ? "<" : ">", rwd->match ? "." : "!" );
+        }
+    }
+    KOutMsg( "\n" );
+    return rc;
+}
+
+static rc_t pileup_test( Args * args, pileup_options *options )
+{
+    struct ref_walker * walker;
+    rc_t rc = ref_walker_create( &walker );
+    if ( rc == 0 )
+    {
+        uint32_t idx, count;
+        rc = ArgsParamCount( args, &count );
+        for ( idx = 0; idx < count && rc == 0; ++idx )
+        {
+            const char * src = NULL;
+            rc = ArgsParamValue( args, idx, &src );
+            if ( rc == 0 && src != NULL )
+                rc = ref_walker_add_source( walker, src );
+        }
+
+        if ( rc == 0 )
+        {
+            rc = ArgsOptionCount( args, OPTION_REF, &count );
+            for ( idx = 0; idx < count && rc == 0; ++idx )
+            {
+                const char * s = NULL;
+                rc = ArgsOptionValue( args, OPTION_REF, idx, &s );
+                if ( rc == 0 && s != NULL )
+                    rc = ref_walker_parse_and_add_range( walker, s );
+            }
+        }
+
+        if ( rc == 0 )
+        {
+            ref_walker_callbacks callbacks = 
+                {   pileup_test_enter_ref,
+                    pileup_test_exit_ref,
+                    pileup_test_enter_ref_window,
+                    pileup_test_exit_ref_window,
+                    pileup_test_enter_ref_pos,
+                    pileup_test_exit_ref_pos,
+                    pileup_test_enter_spot_group,
+                    pileup_test_exit_spot_group,
+                    pileup_test_alignment };
+            rc = ref_walker_set_callbacks( walker, &callbacks );
+        }
+
+        if ( rc == 0 )
+            rc = ref_walker_walk( walker, NULL );
+
+        ref_walker_destroy( walker );
+    }
+    return rc;
+}
+*/
+
+
+/* =========================================================================================== */
+
+
+typedef struct pileup_v2_ctx
+{
+    struct dyn_string * bases;
+    struct dyn_string * qual;
+    bool print_qual;
+    bool div_by_spotgrp;
+    bool debug;
+} pileup_v2_ctx;
+
+
+static rc_t CC pileup_v2_enter_ref_pos( ref_walker_data * rwd )
+{
+    pileup_v2_ctx * ctx = rwd->data;
+    /* make shure that bases/qual have the necessary length ( depth * 2 ) */
+    uint32_t l = ( rwd->depth * 2 );
+    rc_t rc = expand_dyn_string( ctx->bases, l );
+    if ( rc == 0 )
+        reset_dyn_string( ctx->bases );
+    if ( rc == 0 && ctx->print_qual )
+    {
+        rc = expand_dyn_string( ctx->qual, l );
+        if ( rc == 0 )
+            reset_dyn_string( ctx->qual );
+    }
+    return rc;
+}
+
+
+static rc_t CC pileup_v2_exit_ref_pos( ref_walker_data * rwd )
+{
+    pileup_v2_ctx * ctx = rwd->data;
+    rc_t rc = KOutMsg( "%s\t%u\t%c\t%u\t", rwd->ref_name, rwd->pos + 1, rwd->ascii_ref_base, rwd->depth );
+    if ( rc == 0 )
+        rc = print_dyn_string( ctx->bases );
+    if ( rc == 0 && ctx->print_qual )
+    {
+        rc = KOutMsg( "\t" );
+        if ( rc == 0 )
+            rc = print_dyn_string( ctx->qual );
+    }
+    if ( rc == 0 )
+        rc = KOutMsg( "\n" );
+    return rc;
+}
+
+
+static rc_t CC pileup_v2_enter_spot_group( ref_walker_data * rwd )
+{
+    rc_t rc = 0;
+    pileup_v2_ctx * ctx = rwd->data;
+    if ( ctx->div_by_spotgrp )
+    {
+        if ( dyn_string_len( ctx->bases ) > 0 )
+            rc = add_char_2_dyn_string( ctx->bases, '\t' );
+        if ( rc == 0 && ctx->print_qual && dyn_string_len( ctx->qual ) > 0 )
+            rc = add_char_2_dyn_string( ctx->qual, '\t' );
+    }
+    return rc;
+}
+
+
+static rc_t CC pileup_v2_alignment( ref_walker_data * rwd )
+{
+    rc_t rc = 0;
+    pileup_v2_ctx * ctx = rwd->data;
+
+    if ( !rwd->valid )
+    {
+        rc = add_char_2_dyn_string( ctx->bases, '?' );
+        if ( rc == 0 && ctx->print_qual )
+            rc = add_char_2_dyn_string( ctx->qual, '?' );
+    }
+    else
+    {
+        if ( rwd->first )
+        {
+            char s[ 3 ];
+            int32_t c = rwd->mapq + 33;
+            if ( c > '~' ) { c = '~'; }
+            if ( c < 33 ) { c = 33; }
+            s[ 0 ] = '^';
+            s[ 1 ] = c;
+            s[ 2 ] = 0;
+            rc = add_string_2_dyn_string( ctx->bases, s );
+        }
+
+
+        if ( rc == 0 )
+        {
+            if ( rwd->skip )
+            {
+                if ( rwd->reverse )
+                    rc = add_char_2_dyn_string( ctx->bases, '<' );
+                else
+                    rc = add_char_2_dyn_string( ctx->bases, '>' );
+            }
+            else
+            {
+                if ( rwd->match )
+                    rc = add_char_2_dyn_string( ctx->bases, ( rwd->reverse ? ',' : '.' ) );
+                else
+                    rc = add_char_2_dyn_string( ctx->bases, rwd->ascii_alignment_base );
+            }
+        }
+
+        if ( rc == 0 && rwd->ins )
+        {
+            uint32_t i, n = rwd->ins_bases_count;
+            
+            rc = print_2_dyn_string( ctx->bases, "+%u", rwd->ins_bases_count );
+            for ( i = 0; i < n && rc == 0; ++i )
+                rc = add_char_2_dyn_string( ctx->bases, _4na_to_ascii( rwd->ins_bases[ i ], rwd->reverse ) );
+        }
+
+        if ( rc == 0 && rwd->del && rwd->del_bases_count > 0 && rwd->del_bases != NULL )
+        {
+            uint32_t i, n = rwd->del_bases_count;
+            rc = print_2_dyn_string( ctx->bases, "-%u", n );
+            for ( i = 0; i < n && rc == 0; ++i )
+                rc = add_char_2_dyn_string( ctx->bases, _4na_to_ascii( rwd->del_bases[ i ], rwd->reverse ) );
+        }
+
+        if ( rc == 0 && rwd->last )
+            rc = add_char_2_dyn_string( ctx->bases, '$' );
+
+        if ( rc == 0 && ctx->print_qual )
+        {
+            rc = add_char_2_dyn_string( ctx->qual, rwd->quality );
+        }
+    }
+
+    return rc;
+}
+
+
+rc_t pileup_v2( Args * args, pileup_options *options )
+{
+    struct ref_walker * walker;
+
+    /* create walker */
+    rc_t rc = ref_walker_create( &walker );
+    if ( rc == 0 )
+    {
+        uint32_t idx, count;
+
+        /* add sources to walker */
+        rc = ArgsParamCount( args, &count );
+        for ( idx = 0; idx < count && rc == 0; ++idx )
+        {
+            const char * src = NULL;
+            rc = ArgsParamValue( args, idx, &src );
+            if ( rc == 0 && src != NULL )
+                rc = ref_walker_add_source( walker, src );
+        }
+
+        /* add ranges to walker */
+        if ( rc == 0 )
+        {
+            rc = ArgsOptionCount( args, OPTION_REF, &count );
+            for ( idx = 0; idx < count && rc == 0; ++idx )
+            {
+                const char * s = NULL;
+                rc = ArgsOptionValue( args, OPTION_REF, idx, &s );
+                if ( rc == 0 && s != NULL )
+                    rc = ref_walker_parse_and_add_range( walker, s );
+            }
+        }
+
+        /* set callbacks for walker */
+        if ( rc == 0 )
+        {
+            ref_walker_callbacks callbacks = 
+                {   NULL,
+                    NULL,
+                    NULL,
+                    NULL,
+                    pileup_v2_enter_ref_pos,
+                    pileup_v2_exit_ref_pos,
+                    pileup_v2_enter_spot_group,
+                    NULL,
+                    pileup_v2_alignment };
+            rc = ref_walker_set_callbacks( walker, &callbacks );
+        }
+
+        /* translate the commandline options into walker 'INTERESTS' */
+        if ( rc == 0 )
+        {
+            uint32_t interest = RW_INTEREST_INDEL | RW_INTEREST_BASE;
+
+            if ( options->process_dups ) interest |= RW_INTEREST_DUPS;
+            if ( !options->omit_qualities ) interest |= RW_INTEREST_QUAL;
+            if ( !options->no_skip ) interest |= RW_INTEREST_SKIP;
+            if ( options->show_id ) interest |= RW_INTEREST_DEBUG;
+            if ( options->use_seq_name ) interest |= RW_INTEREST_SEQNAME;
+            if ( options->cmn.tab_select & primary_ats ) interest |= RW_INTEREST_PRIM;
+            if ( options->cmn.tab_select & secondary_ats ) interest |= RW_INTEREST_SEC;
+            if ( options->cmn.tab_select & evidence_ats ) interest |= RW_INTEREST_EV;
+
+            rc = ref_walker_set_interest( walker, interest );
+            if ( rc == 0 )
+                rc = ref_walker_set_min_mapq( walker, options->minmapq );
+        }
+
+        /* let the walker call the callbacks while iterating over the sources/ranges */
+        if ( rc == 0 )
+        {
+            pileup_v2_ctx ctx;
+            memset( &ctx, 0, sizeof ctx );
+            rc = allocated_dyn_string ( &ctx.bases, 1000 );
+            if ( rc == 0 )
+            {
+                rc = allocated_dyn_string ( &ctx.qual, 1000 );
+                if ( rc == 0 )
+                {
+                    ctx.print_qual = !options->omit_qualities;
+                    ctx.div_by_spotgrp = options->div_by_spotgrp;
+                    ctx.debug = options->show_id;
+
+                    /***********************************/
+                    rc = ref_walker_walk( walker, &ctx );
+                    /***********************************/
+
+                    free_dyn_string ( ctx.qual );
+                }
+                free_dyn_string ( ctx.bases );
+            }
+        }
+
+        /* destroy the walker */
+        ref_walker_destroy( walker );
+    }
+    return rc;
+}
diff --git a/tools/sra-pileup/pileup_v2.h b/tools/sra-pileup/pileup_v2.h
new file mode 100644
index 0000000..7b1313c
--- /dev/null
+++ b/tools/sra-pileup/pileup_v2.h
@@ -0,0 +1,40 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_pileup_v2_
+#define _h_pileup_v2_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+rc_t pileup_v2( Args * args, pileup_options *options );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*  _h_pileup_v2_ */
diff --git a/tools/sra-pileup/pileup_varcount.c b/tools/sra-pileup/pileup_varcount.c
new file mode 100644
index 0000000..a905e01
--- /dev/null
+++ b/tools/sra-pileup/pileup_varcount.c
@@ -0,0 +1,139 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <klib/out.h>
+
+#include "ref_walker_0.h"
+#include "4na_ascii.h"
+
+typedef struct var_counters
+{
+    uint32_t coverage;
+    uint32_t base_counts[ 4 ];      /* 0...A, 1...C, 2...G, 3...T */
+    uint32_t deletes;
+    uint32_t inserts;
+    uint32_t insert_after[ 4 ];     /* 0...A, 1...C, 2...G, 3...T */
+} var_counters;
+
+
+static rc_t CC walk_varcount_enter_ref_pos( walk_data * data )
+{
+    var_counters * vc = data->data;
+    memset( vc, 0, sizeof *vc );
+    return 0;
+}
+
+
+static rc_t CC walk_varcount_exit_ref_pos( walk_data * data )
+{
+    if ( data->depth == 0 )
+        return 0;
+    else
+    {
+        var_counters * vc = data->data;
+        char ref_base = _4na_to_ascii( data->ref_base, false );
+
+/*
+        A ... ref-name
+        B ... ref-pos
+        C ... ref-base
+        D ... coverage
+
+        E ... A ( match or mismatch )
+        F ... C ( match or mismatch )
+        G ... G ( match or mismatch )
+        H ... T ( match or mismatch )
+
+        I ... total deletes
+        J ... total insertes
+
+        K ... inserts after A
+        L ... inserts after C
+        M ... inserts after G
+        N ... inserts after T
+
+                          A   B   C   D   E   F   G   H   I   J   K   L   M   N
+*/                         
+        return KOutMsg( "%s\t%u\t%c\t%u\t%u\t%u\t%u\t%u\t%u\t%u\t%u\t%u\t%u\t%u\n", 
+                     data->ref_name, data->ref_pos + 1, ref_base, data->depth,
+
+                     vc->base_counts[ 0 ], vc->base_counts[ 1 ], vc->base_counts[ 2 ], vc->base_counts[ 3 ],
+                     vc->deletes, vc->inserts,
+                     vc->insert_after[ 0 ], vc->insert_after[ 1 ], vc->insert_after[ 2 ], vc->insert_after[ 3 ] );
+    }
+}
+
+
+static rc_t CC walk_varcount_placement( walk_data * data )
+{
+    int32_t state = data->state;
+    if ( ( state & align_iter_invalid ) != align_iter_invalid )
+    {
+        var_counters * vc = data->data;
+        uint32_t idx = _4na_to_index( state );
+
+        if ( ( state & align_iter_skip ) == align_iter_skip )
+            ( vc->deletes ) ++;
+        else if ( ( state & align_iter_match ) != align_iter_match )
+            vc->base_counts[ idx ] ++;
+
+        if ( ( state & align_iter_insert ) == align_iter_insert )
+        {
+            ( vc->inserts )++;
+            vc->insert_after[ idx ] ++;
+        }
+    }
+    return 0;
+}
+
+
+rc_t walk_varcount( ReferenceIterator *ref_iter, pileup_options * options )
+{
+    walk_data data;
+    walk_funcs funcs;
+
+    var_counters v_counters;
+
+    data.ref_iter = ref_iter;
+    data.options = options;
+    data.data = &v_counters;
+
+    funcs.on_enter_ref = NULL;
+    funcs.on_exit_ref = NULL;
+
+    funcs.on_enter_ref_window = NULL;
+    funcs.on_exit_ref_window = NULL;
+
+    funcs.on_enter_ref_pos = walk_varcount_enter_ref_pos;
+    funcs.on_exit_ref_pos = walk_varcount_exit_ref_pos;
+
+    funcs.on_enter_spotgroup = NULL;
+    funcs.on_exit_spotgroup = NULL;
+
+    funcs.on_placement = walk_varcount_placement;
+
+    return walk_0( &data, &funcs );
+}
diff --git a/tools/sra-pileup/pileup_varcount.h b/tools/sra-pileup/pileup_varcount.h
new file mode 100644
index 0000000..a89ca9a
--- /dev/null
+++ b/tools/sra-pileup/pileup_varcount.h
@@ -0,0 +1,40 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_pileup_varcount_
+#define _h_pileup_varcount_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+rc_t walk_varcount( ReferenceIterator *ref_iter, pileup_options * options );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*  _h_pileup_varcount_ */
diff --git a/tools/sra-pileup/read_fkt.c b/tools/sra-pileup/read_fkt.c
index df114aa..63db54f 100644
--- a/tools/sra-pileup/read_fkt.c
+++ b/tools/sra-pileup/read_fkt.c
@@ -1,718 +1,718 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include "read_fkt.h"
-#include <sysalloc.h>
-
-/* ------------------------------------------------------------------------------------------------------------------- */
-
-rc_t read_bool( int64_t row_id, const VCursor * cursor, uint32_t idx, bool *res, bool dflt, const char * hint )
-{
-	rc_t rc;
-	if ( idx == INVALID_COLUMN )
-	{
-		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
-        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) bool",
-            "tr=%li,hi=%s", row_id, hint ) );
-	}
-	else
-	{
-		const bool * value;
-		uint32_t elem_bits, boff, row_len;
-		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
-		if ( rc != 0 )
-		{
-			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) bool failed", 
-				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
-		}
-		else
-		{
-			*res = ( row_len > 0 ) ? *value : dflt;
-		}
-	}
-    return rc;
-}
-
-
-rc_t read_bool_ptr( int64_t row_id, const VCursor * cursor, uint32_t idx, const bool **res, uint32_t *res_len, const char * hint )
-{
-	rc_t rc;
-	if ( idx == INVALID_COLUMN )
-	{
-		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
-        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) bool ptr",
-            "tr=%li,hi=%s", row_id, hint ) );
-	}
-	else
-	{
-		bool * value;
-		uint32_t elem_bits, boff, row_len;
-		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
-		if ( rc != 0 )
-		{
-			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) failed", 
-				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
-		}
-		else
-		{
-			if ( row_len > 0 )
-				*res = value;
-			if ( res_len != NULL )
-				*res_len = row_len;
-		}
-	}
-    return rc;
-}
-
-
-/* ------------------------------------------------------------------------------------------------------------------- */
-
-
-rc_t read_uint8( int64_t row_id, const VCursor * cursor, uint32_t idx, uint8_t *res, uint8_t dflt, const char * hint )
-{
-	rc_t rc;
-	if ( idx == INVALID_COLUMN )
-	{
-		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
-        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) uint8",
-            "tr=%li,hi=%s", row_id, hint ) );
-	}
-	else
-	{
-		const uint8_t * value;
-		uint32_t elem_bits, boff, row_len;
-		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
-		if ( rc != 0 )
-		{
-			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) char_ptr failed", 
-				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
-		}
-		else
-		{
-			*res = ( row_len > 0 ) ? *value : dflt;
-		}
-	}
-    return rc;
-}
-
-
-rc_t read_uint8_ptr( int64_t row_id, const VCursor * cursor, uint32_t idx, const uint8_t **res, uint32_t *len, const char * hint )
-{
-	rc_t rc;
-	if ( idx == INVALID_COLUMN )
-	{
-		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
-        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) uint8 ptr",
-            "tr=%li,hi=%s", row_id, hint ) );
-	}
-	else
-	{
-		const uint8_t * value;
-		uint32_t elem_bits, boff, row_len;
-		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
-		if ( rc != 0 )
-		{
-			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) char_ptr failed", 
-				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
-		}
-		else
-		{
-			if ( row_len > 0 )
-				*res = value;
-			if ( len != NULL )
-				*len = row_len;
-		}
-	}
-    return rc;
-}
-
-
-/* ------------------------------------------------------------------------------------------------------------------- */
-
-
-rc_t read_uint32( int64_t row_id, const VCursor * cursor, uint32_t idx, uint32_t *res, uint32_t dflt, const char * hint )
-{
-	rc_t rc;
-	if ( idx == INVALID_COLUMN )
-	{
-		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
-        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) uint32",
-            "tr=%li,hi=%s", row_id, hint ) );
-	}
-	else
-	{
-		uint32_t * value;
-		uint32_t elem_bits, boff, row_len;
-		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
-		if ( rc != 0 )
-		{
-			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) uint32_t failed", 
-				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
-		}
-		else
-		{
-			*res = ( row_len > 0 ) ? *value : dflt;
-		}
-	}
-    return rc;
-}
-
-
-rc_t read_uint32_ptr( int64_t row_id, const VCursor * cursor, uint32_t idx, const uint32_t **res, uint32_t *len, const char * hint )
-{
-	rc_t rc;
-	if ( idx == INVALID_COLUMN )
-	{
-		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
-        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) uint32 ptr",
-            "tr=%li,hi=%s", row_id, hint ) );
-	}
-	else
-	{
-		uint32_t * value;
-		uint32_t elem_bits, boff, row_len;
-		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
-		if ( rc != 0 )
-		{
-			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) uint32_t (ptr) failed", 
-				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
-		}
-		else
-		{
-			if ( row_len > 0 )
-				*res = value;
-			if ( len != NULL )
-				*len = row_len;
-		}
-	}
-    return rc;
-}
-
-
-/* ------------------------------------------------------------------------------------------------------------------- */
-
-
-rc_t read_int32( int64_t row_id, const VCursor * cursor, uint32_t idx, int32_t *res, int32_t dflt, const char * hint )
-{
-	rc_t rc;
-	if ( idx == INVALID_COLUMN )
-	{
-		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
-        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) int32",
-            "tr=%li,hi=%s", row_id, hint ) );
-	}
-	else
-	{
-		int32_t * value;
-		uint32_t elem_bits, boff, row_len;
-		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
-		if ( rc != 0 )
-		{
-			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) uint32_t failed", 
-				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
-		}
-		else
-		{
-			*res = ( row_len > 0 ) ? *value : dflt;
-		}
-	}
-    return rc;
-}
-
-
-rc_t read_int32_ptr( int64_t row_id, const VCursor * cursor, uint32_t idx, const int32_t **res, uint32_t *len, const char * hint )
-{
-	rc_t rc;
-	if ( idx == INVALID_COLUMN )
-	{
-		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
-        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) int32 ptr",
-            "tr=%li,hi=%s", row_id, hint ) );
-	}
-	else
-	{
-		int32_t * value;
-		uint32_t elem_bits, boff, row_len;
-		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
-		if ( rc != 0 )
-		{
-			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) uint32_t (ptr) failed", 
-				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
-		}
-		else
-		{
-			if ( row_len > 0 )
-				*res = value;
-			if ( len != NULL )
-				*len = row_len;
-		}
-	}
-    return rc;
-}
-
-
-/* ------------------------------------------------------------------------------------------------------------------- */
-
-
-rc_t read_int64( int64_t row_id, const VCursor * cursor, uint32_t idx, int64_t *res, int64_t dflt, const char * hint )
-{
-	rc_t rc;
-	if ( idx == INVALID_COLUMN )
-	{
-		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
-        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) int64",
-            "tr=%li,hi=%s", row_id, hint ) );
-	}
-	else
-	{
-		const int64_t *value;
-		uint32_t elem_bits, boff, row_len;
-		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
-		if ( rc != 0 )
-		{
-			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) int64 failed", 
-				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
-		}
-		else
-		{
-			*res = ( row_len > 0 ) ? *value : dflt;
-		}
-	}
-    return rc;
-}
-
-
-rc_t read_int64_ptr( int64_t row_id, const VCursor * cursor, uint32_t idx, const int64_t **res, uint32_t *len, const char * hint )
-{
-	rc_t rc;
-	if ( idx == INVALID_COLUMN )
-	{
-		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
-        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) int64 ptr",
-            "tr=%li,hi=%s", row_id, hint ) );
-	}
-	else
-	{
-		int64_t * value;
-		uint32_t elem_bits, boff, row_len;
-		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
-		if ( rc != 0 )
-		{
-			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) uint64_t (ptr) failed", 
-				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
-		}
-		else
-		{
-			if ( row_len > 0 )
-				*res = value;
-			if ( len != NULL )
-				*len = row_len;
-		}
-	}
-    return rc;
-}
-
-
-/* ------------------------------------------------------------------------------------------------------------------- */
-
-
-rc_t read_char_ptr( int64_t row_id, const VCursor * cursor, uint32_t idx, const char **res, uint32_t *len, const char * hint )
-{
-	rc_t rc;
-	if ( idx == INVALID_COLUMN )
-	{
-		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
-        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) char ptr",
-            "tr=%li,hi=%s", row_id, hint ) );
-	}
-	else
-	{
-		const char * value;
-		uint32_t elem_bits, boff, row_len;
-		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
-		if ( rc != 0 )
-		{
-			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) char_ptr failed", 
-				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
-		}
-		else
-		{
-			if ( row_len > 0 )
-				*res = value;
-			if ( len != NULL )
-				*len = row_len;
-		}
-	}
-    return rc;
-}
-
-
-/* ------------------------------------------------------------------------------------------------------------------- */
-
-
-rc_t read_INSDC_coord_zero( int64_t row_id, const VCursor * cursor, uint32_t idx, INSDC_coord_zero *res, INSDC_coord_zero dflt, const char * hint )
-{
-	rc_t rc;
-	if ( idx == INVALID_COLUMN )
-	{
-		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
-        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) INSDC_coord_zero",
-            "tr=%li,hi=%s", row_id, hint ) );
-	}
-	else
-	{
-		INSDC_coord_zero * value;
-		uint32_t elem_bits, boff, row_len;
-		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
-		if ( rc != 0 )
-		{
-			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) INSDC_coord_zero failed", 
-				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
-		}
-		else
-		{
-			*res = ( row_len > 0 ) ? *value : dflt;
-		}
-	}
-    return rc;
-}
-
-
-rc_t read_INSDC_coord_zero_ptr( int64_t row_id, const VCursor * cursor, uint32_t idx, const INSDC_coord_zero **res, uint32_t *len, const char * hint )
-{
-	rc_t rc;
-	if ( idx == INVALID_COLUMN )
-	{
-		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
-        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) INSDC_coord_zero (ptr)",
-            "tr=%li,hi=%s", row_id, hint ) );
-	}
-	else
-	{
-		const INSDC_coord_zero * value;
-		uint32_t elem_bits, boff, row_len;
-		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
-		if ( rc != 0 )
-		{
-			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) INSDC_coord_zero (ptr) failed", 
-				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
-		}
-		else
-		{
-			if ( row_len > 0 )
-				*res = value;
-			if ( len != NULL )
-				*len = row_len;
-		}
-	}
-    return rc;
-}
-
-
-/* ------------------------------------------------------------------------------------------------------------------- */
-
-
-rc_t read_INSDC_coord_one( int64_t row_id, const VCursor * cursor, uint32_t idx, INSDC_coord_one *res, INSDC_coord_one dflt, const char * hint )
-{
-	rc_t rc;
-	if ( idx == INVALID_COLUMN )
-	{
-		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
-        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) INSDC_coord_one",
-            "tr=%li,hi=%s", row_id, hint ) );
-	}
-	else
-	{
-		INSDC_coord_one * value;
-		uint32_t elem_bits, boff, row_len;
-		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
-		if ( rc != 0 )
-		{
-			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) INSDC_coord_one failed", 
-				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
-		}
-		else
-		{
-			*res = ( row_len > 0 ) ? *value : dflt;
-		}
-	}
-    return rc;
-}
-
-
-rc_t read_INSDC_coord_one_ptr( int64_t row_id, const VCursor * cursor, uint32_t idx, INSDC_coord_one **res, uint32_t *len, const char * hint )
-{
-	rc_t rc;
-	if ( idx == INVALID_COLUMN )
-	{
-		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
-        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) INSDC_coord_one (ptr)",
-            "tr=%li,hi=%s", row_id, hint ) );
-	}
-	else
-	{
-		INSDC_coord_one * value;
-		uint32_t elem_bits, boff, row_len;
-		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
-		if ( rc != 0 )
-		{
-			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) INSDC_coord_one (ptr) failed", 
-				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
-		}
-		else
-		{
-			if ( row_len > 0 )
-				*res = value;
-			if ( len != NULL )
-				*len = row_len;
-		}
-	}
-    return rc;
-}
-
-
-
-/* ------------------------------------------------------------------------------------------------------------------- */
-
-
-rc_t read_INSDC_coord_len( int64_t row_id, const VCursor * cursor, uint32_t idx, INSDC_coord_len *res, INSDC_coord_len dflt, const char * hint )
-{
-	rc_t rc;
-	if ( idx == INVALID_COLUMN )
-	{
-		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
-        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) INSDC_coord_len", 
-            "tr=%li,hi=%s", row_id, hint ) );
-	}
-	else
-	{
-		INSDC_coord_len * value;
-		uint32_t elem_bits, boff, row_len;
-		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
-		if ( rc != 0 )
-		{
-			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) INSDC_coord_len failed", 
-				"tr=%li,ti=%u,hi=$u", row_id, idx, hint ) );
-		}
-		else
-		{
-			*res = ( row_len > 0 ) ? *value : dflt;
-		}
-	}
-    return rc;
-}
-
-
-rc_t read_INSDC_coord_len_ptr( int64_t row_id, const VCursor * cursor, uint32_t idx, const INSDC_coord_len **res, uint32_t *len, const char * hint )
-{
-	rc_t rc;
-	if ( idx == INVALID_COLUMN )
-	{
-		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
-        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) INSDC_coord_len (ptr)", 
-            "tr=%li,hi=%s", row_id, hint ) );
-	}
-	else
-	{
-		const INSDC_coord_len * value;
-		uint32_t elem_bits, boff, row_len;
-		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
-		if ( rc != 0 )
-		{
-			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) INSDC_coord_len (ptr) failed", 
-				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
-		}
-		else
-		{
-			if ( row_len > 0 )
-				*res = value;
-			if ( len != NULL )
-				*len = row_len;
-		}
-	}
-    return rc;
-}
-
-
-/* ------------------------------------------------------------------------------------------------------------------- */
-
-
-rc_t read_INSDC_read_type_ptr( int64_t row_id, const VCursor * cursor, uint32_t idx, const INSDC_read_type **res, uint32_t *len, const char * hint )
-{
-	rc_t rc;
-	if ( idx == INVALID_COLUMN )
-	{
-		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
-        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) INSDC_read_type (ptr)", 
-            "tr=%li,hi=%s", row_id, hint ) );
-	}
-	else
-	{
-		const INSDC_read_type * value;
-		uint32_t elem_bits, boff, row_len;
-		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
-		if ( rc != 0 )
-		{
-			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) INSDC_read_type (ptr) failed", 
-				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
-		}
-		else
-		{
-			if ( row_len > 0 )
-				*res = value;
-			if ( len != NULL )
-				*len = row_len;
-		}
-	}
-    return rc;
-}
-
-
-rc_t read_INSDC_read_filter_ptr( int64_t row_id, const VCursor * cursor, uint32_t idx, const INSDC_read_filter **res, uint32_t *len, const char * hint )
-{
-	rc_t rc;
-	if ( idx == INVALID_COLUMN )
-	{
-		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
-        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) INSDC_read_filter (ptr)",
-            "tr=%li,hi=%s", row_id, hint ) );
-	}
-	else
-	{
-		const INSDC_read_filter * value;
-		uint32_t elem_bits, boff, row_len;
-		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
-		if ( rc != 0 )
-		{
-			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) INSDC_read_filter (ptr) failed", 
-				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
-		}
-		else
-		{
-			if ( row_len > 0 )
-				*res = value;
-			if ( len != NULL )
-				*len = row_len;
-		}
-	}
-    return rc;
-}
-
-
-rc_t read_INSDC_dna_text_ptr( int64_t row_id, const VCursor * cursor, uint32_t idx, const INSDC_dna_text **res, uint32_t *len, const char * hint )
-{
-	rc_t rc;
-	if ( idx == INVALID_COLUMN )
-	{
-		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
-        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) INSDC_dna_text (ptr)",
-            "tr=%li,hi=%s", row_id, hint ) );
-	}
-	else
-	{
-		const INSDC_dna_text * value;
-		uint32_t elem_bits, boff, row_len;
-		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
-		if ( rc != 0 )
-		{
-			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) INSDC_dna_text (ptr) failed", 
-				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
-		}
-		else
-		{
-			if ( row_len > 0 )
-				*res = value;
-			if ( len != NULL )
-				*len = row_len;
-		}
-	}
-    return rc;
-}
-
-
-/* ------------------------------------------------------------------------------------------------------------------- */
-
-bool namelist_contains( const KNamelist *names, const char * a_name )
-{
-    bool res = false;
-    uint32_t count;
-    rc_t rc = KNamelistCount( names, &count );
-    if ( rc == 0 && count > 0 )
-    {
-        uint32_t idx;
-        size_t a_name_len = string_size( a_name );
-        for ( idx = 0; idx < count && rc == 0 && !res; ++idx )
-        {
-            const char * s;
-            rc = KNamelistGet( names, idx, &s );
-            if ( rc == 0 && s != NULL )
-            {
-                size_t s_len = string_size( s );
-                size_t max_len = a_name_len > s_len ? a_name_len : s_len;
-                int cmp = string_cmp( a_name, a_name_len, s, s_len, max_len );
-                if ( cmp == 0 )
-                    res = true;
-            }
-        }
-    }
-    return res;
-}
-
-
-rc_t add_column( const VCursor * cursor, const char *colname, uint32_t * idx )
-{
-    rc_t rc = VCursorAddColumn( cursor, idx, colname );
-    if ( rc != 0 )
-    {
-        (void)PLOGERR( klogInt, ( klogInt, rc, "VCursorAddColumn( $(cn) ) failed", "cn=%s", colname ) );
-    }
-    return rc;
-}
-
-
-static const char * col_name_without_type( const char * colname )
-{
-	const char * res = colname;
-	const char * s = string_chr( colname, string_size( colname ), ')' );
-	if ( s != NULL )
-		res = ++s;
-	return res;
-}
-
-void add_opt_column( const VCursor * cursor, const KNamelist *names, const char *colname, uint32_t * idx )
-{
-    bool available = namelist_contains( names, col_name_without_type( colname ) );
-    if ( available )
-    {
-        rc_t rc = VCursorAddColumn( cursor, idx, colname );
-        if ( rc != 0 )
-            *idx = COL_NOT_AVAILABLE;
-    }
-    else
-    {
-        *idx = COL_NOT_AVAILABLE;
-    }
-}
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "read_fkt.h"
+#include <sysalloc.h>
+
+/* ------------------------------------------------------------------------------------------------------------------- */
+
+rc_t read_bool( int64_t row_id, const VCursor * cursor, uint32_t idx, bool *res, bool dflt, const char * hint )
+{
+	rc_t rc;
+	if ( idx == INVALID_COLUMN )
+	{
+		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
+        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) bool",
+            "tr=%li,hi=%s", row_id, hint ) );
+	}
+	else
+	{
+		const bool * value;
+		uint32_t elem_bits, boff, row_len;
+		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
+		if ( rc != 0 )
+		{
+			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) bool failed", 
+				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
+		}
+		else
+		{
+			*res = ( row_len > 0 ) ? *value : dflt;
+		}
+	}
+    return rc;
+}
+
+
+rc_t read_bool_ptr( int64_t row_id, const VCursor * cursor, uint32_t idx, const bool **res, uint32_t *res_len, const char * hint )
+{
+	rc_t rc;
+	if ( idx == INVALID_COLUMN )
+	{
+		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
+        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) bool ptr",
+            "tr=%li,hi=%s", row_id, hint ) );
+	}
+	else
+	{
+		bool * value;
+		uint32_t elem_bits, boff, row_len;
+		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
+		if ( rc != 0 )
+		{
+			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) failed", 
+				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
+		}
+		else
+		{
+			if ( row_len > 0 )
+				*res = value;
+			if ( res_len != NULL )
+				*res_len = row_len;
+		}
+	}
+    return rc;
+}
+
+
+/* ------------------------------------------------------------------------------------------------------------------- */
+
+
+rc_t read_uint8( int64_t row_id, const VCursor * cursor, uint32_t idx, uint8_t *res, uint8_t dflt, const char * hint )
+{
+	rc_t rc;
+	if ( idx == INVALID_COLUMN )
+	{
+		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
+        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) uint8",
+            "tr=%li,hi=%s", row_id, hint ) );
+	}
+	else
+	{
+		const uint8_t * value;
+		uint32_t elem_bits, boff, row_len;
+		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
+		if ( rc != 0 )
+		{
+			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) char_ptr failed", 
+				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
+		}
+		else
+		{
+			*res = ( row_len > 0 ) ? *value : dflt;
+		}
+	}
+    return rc;
+}
+
+
+rc_t read_uint8_ptr( int64_t row_id, const VCursor * cursor, uint32_t idx, const uint8_t **res, uint32_t *len, const char * hint )
+{
+	rc_t rc;
+	if ( idx == INVALID_COLUMN )
+	{
+		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
+        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) uint8 ptr",
+            "tr=%li,hi=%s", row_id, hint ) );
+	}
+	else
+	{
+		const uint8_t * value;
+		uint32_t elem_bits, boff, row_len;
+		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
+		if ( rc != 0 )
+		{
+			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) char_ptr failed", 
+				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
+		}
+		else
+		{
+			if ( row_len > 0 )
+				*res = value;
+			if ( len != NULL )
+				*len = row_len;
+		}
+	}
+    return rc;
+}
+
+
+/* ------------------------------------------------------------------------------------------------------------------- */
+
+
+rc_t read_uint32( int64_t row_id, const VCursor * cursor, uint32_t idx, uint32_t *res, uint32_t dflt, const char * hint )
+{
+	rc_t rc;
+	if ( idx == INVALID_COLUMN )
+	{
+		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
+        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) uint32",
+            "tr=%li,hi=%s", row_id, hint ) );
+	}
+	else
+	{
+		uint32_t * value;
+		uint32_t elem_bits, boff, row_len;
+		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
+		if ( rc != 0 )
+		{
+			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) uint32_t failed", 
+				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
+		}
+		else
+		{
+			*res = ( row_len > 0 ) ? *value : dflt;
+		}
+	}
+    return rc;
+}
+
+
+rc_t read_uint32_ptr( int64_t row_id, const VCursor * cursor, uint32_t idx, const uint32_t **res, uint32_t *len, const char * hint )
+{
+	rc_t rc;
+	if ( idx == INVALID_COLUMN )
+	{
+		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
+        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) uint32 ptr",
+            "tr=%li,hi=%s", row_id, hint ) );
+	}
+	else
+	{
+		uint32_t * value;
+		uint32_t elem_bits, boff, row_len;
+		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
+		if ( rc != 0 )
+		{
+			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) uint32_t (ptr) failed", 
+				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
+		}
+		else
+		{
+			if ( row_len > 0 )
+				*res = value;
+			if ( len != NULL )
+				*len = row_len;
+		}
+	}
+    return rc;
+}
+
+
+/* ------------------------------------------------------------------------------------------------------------------- */
+
+
+rc_t read_int32( int64_t row_id, const VCursor * cursor, uint32_t idx, int32_t *res, int32_t dflt, const char * hint )
+{
+	rc_t rc;
+	if ( idx == INVALID_COLUMN )
+	{
+		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
+        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) int32",
+            "tr=%li,hi=%s", row_id, hint ) );
+	}
+	else
+	{
+		int32_t * value;
+		uint32_t elem_bits, boff, row_len;
+		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
+		if ( rc != 0 )
+		{
+			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) uint32_t failed", 
+				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
+		}
+		else
+		{
+			*res = ( row_len > 0 ) ? *value : dflt;
+		}
+	}
+    return rc;
+}
+
+
+rc_t read_int32_ptr( int64_t row_id, const VCursor * cursor, uint32_t idx, const int32_t **res, uint32_t *len, const char * hint )
+{
+	rc_t rc;
+	if ( idx == INVALID_COLUMN )
+	{
+		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
+        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) int32 ptr",
+            "tr=%li,hi=%s", row_id, hint ) );
+	}
+	else
+	{
+		int32_t * value;
+		uint32_t elem_bits, boff, row_len;
+		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
+		if ( rc != 0 )
+		{
+			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) uint32_t (ptr) failed", 
+				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
+		}
+		else
+		{
+			if ( row_len > 0 )
+				*res = value;
+			if ( len != NULL )
+				*len = row_len;
+		}
+	}
+    return rc;
+}
+
+
+/* ------------------------------------------------------------------------------------------------------------------- */
+
+
+rc_t read_int64( int64_t row_id, const VCursor * cursor, uint32_t idx, int64_t *res, int64_t dflt, const char * hint )
+{
+	rc_t rc;
+	if ( idx == INVALID_COLUMN )
+	{
+		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
+        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) int64",
+            "tr=%li,hi=%s", row_id, hint ) );
+	}
+	else
+	{
+		const int64_t *value;
+		uint32_t elem_bits, boff, row_len;
+		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
+		if ( rc != 0 )
+		{
+			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) int64 failed", 
+				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
+		}
+		else
+		{
+			*res = ( row_len > 0 ) ? *value : dflt;
+		}
+	}
+    return rc;
+}
+
+
+rc_t read_int64_ptr( int64_t row_id, const VCursor * cursor, uint32_t idx, const int64_t **res, uint32_t *len, const char * hint )
+{
+	rc_t rc;
+	if ( idx == INVALID_COLUMN )
+	{
+		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
+        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) int64 ptr",
+            "tr=%li,hi=%s", row_id, hint ) );
+	}
+	else
+	{
+		int64_t * value;
+		uint32_t elem_bits, boff, row_len;
+		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
+		if ( rc != 0 )
+		{
+			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) uint64_t (ptr) failed", 
+				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
+		}
+		else
+		{
+			if ( row_len > 0 )
+				*res = value;
+			if ( len != NULL )
+				*len = row_len;
+		}
+	}
+    return rc;
+}
+
+
+/* ------------------------------------------------------------------------------------------------------------------- */
+
+
+rc_t read_char_ptr( int64_t row_id, const VCursor * cursor, uint32_t idx, const char **res, uint32_t *len, const char * hint )
+{
+	rc_t rc;
+	if ( idx == INVALID_COLUMN )
+	{
+		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
+        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) char ptr",
+            "tr=%li,hi=%s", row_id, hint ) );
+	}
+	else
+	{
+		const char * value;
+		uint32_t elem_bits, boff, row_len;
+		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
+		if ( rc != 0 )
+		{
+			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) char_ptr failed", 
+				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
+		}
+		else
+		{
+			if ( row_len > 0 )
+				*res = value;
+			if ( len != NULL )
+				*len = row_len;
+		}
+	}
+    return rc;
+}
+
+
+/* ------------------------------------------------------------------------------------------------------------------- */
+
+
+rc_t read_INSDC_coord_zero( int64_t row_id, const VCursor * cursor, uint32_t idx, INSDC_coord_zero *res, INSDC_coord_zero dflt, const char * hint )
+{
+	rc_t rc;
+	if ( idx == INVALID_COLUMN )
+	{
+		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
+        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) INSDC_coord_zero",
+            "tr=%li,hi=%s", row_id, hint ) );
+	}
+	else
+	{
+		INSDC_coord_zero * value;
+		uint32_t elem_bits, boff, row_len;
+		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
+		if ( rc != 0 )
+		{
+			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) INSDC_coord_zero failed", 
+				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
+		}
+		else
+		{
+			*res = ( row_len > 0 ) ? *value : dflt;
+		}
+	}
+    return rc;
+}
+
+
+rc_t read_INSDC_coord_zero_ptr( int64_t row_id, const VCursor * cursor, uint32_t idx, const INSDC_coord_zero **res, uint32_t *len, const char * hint )
+{
+	rc_t rc;
+	if ( idx == INVALID_COLUMN )
+	{
+		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
+        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) INSDC_coord_zero (ptr)",
+            "tr=%li,hi=%s", row_id, hint ) );
+	}
+	else
+	{
+		const INSDC_coord_zero * value;
+		uint32_t elem_bits, boff, row_len;
+		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
+		if ( rc != 0 )
+		{
+			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) INSDC_coord_zero (ptr) failed", 
+				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
+		}
+		else
+		{
+			if ( row_len > 0 )
+				*res = value;
+			if ( len != NULL )
+				*len = row_len;
+		}
+	}
+    return rc;
+}
+
+
+/* ------------------------------------------------------------------------------------------------------------------- */
+
+
+rc_t read_INSDC_coord_one( int64_t row_id, const VCursor * cursor, uint32_t idx, INSDC_coord_one *res, INSDC_coord_one dflt, const char * hint )
+{
+	rc_t rc;
+	if ( idx == INVALID_COLUMN )
+	{
+		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
+        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) INSDC_coord_one",
+            "tr=%li,hi=%s", row_id, hint ) );
+	}
+	else
+	{
+		INSDC_coord_one * value;
+		uint32_t elem_bits, boff, row_len;
+		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
+		if ( rc != 0 )
+		{
+			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) INSDC_coord_one failed", 
+				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
+		}
+		else
+		{
+			*res = ( row_len > 0 ) ? *value : dflt;
+		}
+	}
+    return rc;
+}
+
+
+rc_t read_INSDC_coord_one_ptr( int64_t row_id, const VCursor * cursor, uint32_t idx, INSDC_coord_one **res, uint32_t *len, const char * hint )
+{
+	rc_t rc;
+	if ( idx == INVALID_COLUMN )
+	{
+		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
+        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) INSDC_coord_one (ptr)",
+            "tr=%li,hi=%s", row_id, hint ) );
+	}
+	else
+	{
+		INSDC_coord_one * value;
+		uint32_t elem_bits, boff, row_len;
+		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
+		if ( rc != 0 )
+		{
+			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) INSDC_coord_one (ptr) failed", 
+				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
+		}
+		else
+		{
+			if ( row_len > 0 )
+				*res = value;
+			if ( len != NULL )
+				*len = row_len;
+		}
+	}
+    return rc;
+}
+
+
+
+/* ------------------------------------------------------------------------------------------------------------------- */
+
+
+rc_t read_INSDC_coord_len( int64_t row_id, const VCursor * cursor, uint32_t idx, INSDC_coord_len *res, INSDC_coord_len dflt, const char * hint )
+{
+	rc_t rc;
+	if ( idx == INVALID_COLUMN )
+	{
+		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
+        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) INSDC_coord_len", 
+            "tr=%li,hi=%s", row_id, hint ) );
+	}
+	else
+	{
+		INSDC_coord_len * value;
+		uint32_t elem_bits, boff, row_len;
+		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
+		if ( rc != 0 )
+		{
+			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) INSDC_coord_len failed", 
+				"tr=%li,ti=%u,hi=$u", row_id, idx, hint ) );
+		}
+		else
+		{
+			*res = ( row_len > 0 ) ? *value : dflt;
+		}
+	}
+    return rc;
+}
+
+
+rc_t read_INSDC_coord_len_ptr( int64_t row_id, const VCursor * cursor, uint32_t idx, const INSDC_coord_len **res, uint32_t *len, const char * hint )
+{
+	rc_t rc;
+	if ( idx == INVALID_COLUMN )
+	{
+		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
+        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) INSDC_coord_len (ptr)", 
+            "tr=%li,hi=%s", row_id, hint ) );
+	}
+	else
+	{
+		const INSDC_coord_len * value;
+		uint32_t elem_bits, boff, row_len;
+		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
+		if ( rc != 0 )
+		{
+			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) INSDC_coord_len (ptr) failed", 
+				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
+		}
+		else
+		{
+			if ( row_len > 0 )
+				*res = value;
+			if ( len != NULL )
+				*len = row_len;
+		}
+	}
+    return rc;
+}
+
+
+/* ------------------------------------------------------------------------------------------------------------------- */
+
+
+rc_t read_INSDC_read_type_ptr( int64_t row_id, const VCursor * cursor, uint32_t idx, const INSDC_read_type **res, uint32_t *len, const char * hint )
+{
+	rc_t rc;
+	if ( idx == INVALID_COLUMN )
+	{
+		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
+        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) INSDC_read_type (ptr)", 
+            "tr=%li,hi=%s", row_id, hint ) );
+	}
+	else
+	{
+		const INSDC_read_type * value;
+		uint32_t elem_bits, boff, row_len;
+		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
+		if ( rc != 0 )
+		{
+			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) INSDC_read_type (ptr) failed", 
+				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
+		}
+		else
+		{
+			if ( row_len > 0 )
+				*res = value;
+			if ( len != NULL )
+				*len = row_len;
+		}
+	}
+    return rc;
+}
+
+
+rc_t read_INSDC_read_filter_ptr( int64_t row_id, const VCursor * cursor, uint32_t idx, const INSDC_read_filter **res, uint32_t *len, const char * hint )
+{
+	rc_t rc;
+	if ( idx == INVALID_COLUMN )
+	{
+		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
+        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) INSDC_read_filter (ptr)",
+            "tr=%li,hi=%s", row_id, hint ) );
+	}
+	else
+	{
+		const INSDC_read_filter * value;
+		uint32_t elem_bits, boff, row_len;
+		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
+		if ( rc != 0 )
+		{
+			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) INSDC_read_filter (ptr) failed", 
+				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
+		}
+		else
+		{
+			if ( row_len > 0 )
+				*res = value;
+			if ( len != NULL )
+				*len = row_len;
+		}
+	}
+    return rc;
+}
+
+
+rc_t read_INSDC_dna_text_ptr( int64_t row_id, const VCursor * cursor, uint32_t idx, const INSDC_dna_text **res, uint32_t *len, const char * hint )
+{
+	rc_t rc;
+	if ( idx == INVALID_COLUMN )
+	{
+		rc = RC( rcExe, rcNoTarg, rcReading, rcItem, rcInvalid );	
+        (void)PLOGERR( klogInt, ( klogInt, rc, "column idx invalid at row#$(tr) . $(hi) ) INSDC_dna_text (ptr)",
+            "tr=%li,hi=%s", row_id, hint ) );
+	}
+	else
+	{
+		const INSDC_dna_text * value;
+		uint32_t elem_bits, boff, row_len;
+		rc = VCursorCellDataDirect( cursor, row_id, idx, &elem_bits, (const void**)&value, &boff, &row_len );
+		if ( rc != 0 )
+		{
+			(void)PLOGERR( klogInt, ( klogInt, rc, "VCursorCellDataDirect( row#$(tr) . idx#$(ti) . $(hi) ) INSDC_dna_text (ptr) failed", 
+				"tr=%li,ti=%u,hi=%s", row_id, idx, hint ) );
+		}
+		else
+		{
+			if ( row_len > 0 )
+				*res = value;
+			if ( len != NULL )
+				*len = row_len;
+		}
+	}
+    return rc;
+}
+
+
+/* ------------------------------------------------------------------------------------------------------------------- */
+
+bool namelist_contains( const KNamelist *names, const char * a_name )
+{
+    bool res = false;
+    uint32_t count;
+    rc_t rc = KNamelistCount( names, &count );
+    if ( rc == 0 && count > 0 )
+    {
+        uint32_t idx;
+        size_t a_name_len = string_size( a_name );
+        for ( idx = 0; idx < count && rc == 0 && !res; ++idx )
+        {
+            const char * s;
+            rc = KNamelistGet( names, idx, &s );
+            if ( rc == 0 && s != NULL )
+            {
+                size_t s_len = string_size( s );
+                size_t max_len = a_name_len > s_len ? a_name_len : s_len;
+                int cmp = string_cmp( a_name, a_name_len, s, s_len, max_len );
+                if ( cmp == 0 )
+                    res = true;
+            }
+        }
+    }
+    return res;
+}
+
+
+rc_t add_column( const VCursor * cursor, const char *colname, uint32_t * idx )
+{
+    rc_t rc = VCursorAddColumn( cursor, idx, "%s", colname );
+    if ( rc != 0 )
+    {
+        (void)PLOGERR( klogInt, ( klogInt, rc, "VCursorAddColumn( $(cn) ) failed", "cn=%s", colname ) );
+    }
+    return rc;
+}
+
+
+static const char * col_name_without_type( const char * colname )
+{
+	const char * res = colname;
+	const char * s = string_chr( colname, string_size( colname ), ')' );
+	if ( s != NULL )
+		res = ++s;
+	return res;
+}
+
+void add_opt_column( const VCursor * cursor, const KNamelist *names, const char *colname, uint32_t * idx )
+{
+    bool available = namelist_contains( names, col_name_without_type( colname ) );
+    if ( available )
+    {
+        rc_t rc = VCursorAddColumn( cursor, idx, "%s", colname );
+        if ( rc != 0 )
+            *idx = COL_NOT_AVAILABLE;
+    }
+    else
+    {
+        *idx = COL_NOT_AVAILABLE;
+    }
+}
diff --git a/tools/sra-pileup/ref_regions.c b/tools/sra-pileup/ref_regions.c
index d505760..5a39432 100644
--- a/tools/sra-pileup/ref_regions.c
+++ b/tools/sra-pileup/ref_regions.c
@@ -26,6 +26,7 @@
 #include "ref_regions.h"
 
 #include <klib/rc.h>
+#include <klib/out.h>
 #include <klib/text.h>
 #include <klib/vector.h>
 #include <klib/container.h>
@@ -52,12 +53,32 @@ static int cmp_pchar( const char * a, const char * b )
 }
 
 
+struct skip_range
+{
+    uint64_t start;
+    uint64_t end;
+} skip_range;
+
+
+static struct skip_range * make_skip_range( const uint64_t start, const uint64_t end )
+{
+    struct skip_range *res = calloc( 1, sizeof *res );
+    if ( res != NULL )
+    {
+        res->start = start;
+        res->end = end;
+    }
+    return res;
+}
+
+
 /* =========================================================================================== */
 
 struct reference_range
 {
     uint64_t start;
     uint64_t end;
+    Vector skip;
 } reference_range;
 
 
@@ -68,11 +89,20 @@ static struct reference_range * make_range( const uint64_t start, const uint64_t
     {
         res->start = start;
         res->end = end;
+        VectorInit ( &res->skip, 0, 5 );
     }
     return res;
 }
 
 
+static void CC release_skip( void * item, void * data ) { free( item ); }
+
+static void free_range( struct reference_range * self )
+{
+    VectorWhack ( &self->skip, release_skip, NULL );
+    free( self );
+}
+
 static int cmp_range( const struct reference_range * a, const struct reference_range * b )
 {
 
@@ -93,6 +123,11 @@ static bool range_overlapp( const struct reference_range * a, const struct refer
 }
 
 
+static uint64_t range_distance( const struct reference_range * a, const struct reference_range * b )
+{
+    return ( b->start - a->end );
+}
+
 /* =========================================================================================== */
 
 struct reference_region
@@ -229,21 +264,17 @@ static void parse_definition( const char *s, char * name, size_t len,
 }
 
 
-static void CC release_range_wrapper( void * item, void * data )
-{
-    free( item );
-}
-
+static void CC release_ranges_wrapper( void * item, void * data ) { free_range( item ); }
 
 static void free_reference_region( struct reference_region * self )
 {
     free( (void*)self->name );
-    VectorWhack ( &self->ranges, release_range_wrapper, NULL );
+    VectorWhack ( &self->ranges, release_ranges_wrapper, NULL );
     free( self );
 }
 
 
-static void check_ref_region_ranges( struct reference_region * self )
+static void merge_overlapping_ranges( struct reference_region * self )
 {
     uint32_t n = VectorLength( &self->ranges );
     uint32_t i = 0;
@@ -273,6 +304,46 @@ static void check_ref_region_ranges( struct reference_region * self )
 }
 
 
+static void merge_close_ranges_and_create_filter( struct reference_region * self, uint64_t merge_diff )
+{
+    uint32_t n = VectorLength( &self->ranges );
+    uint32_t i = 0;
+    struct reference_range * a = NULL;
+    while ( i < n )
+    {
+        struct reference_range * b = VectorGet ( &self->ranges, i );
+        bool remove = false;
+        if ( a != NULL )
+        {
+            /* get the distance between a and b */
+            uint64_t d = range_distance( a, b );
+            remove = ( d < merge_diff );
+            if ( remove )
+            {
+                struct reference_range * r;
+
+                /* add the gap to the skip-vector of a */
+                struct skip_range * sr = make_skip_range( a->end + 1, b->start - 1 );
+                VectorAppend ( &( a->skip ), NULL, sr );
+
+                /* expand a to merge with b */
+                a->end = b->end;
+
+                /* remove b */
+                VectorRemove ( &self->ranges, i, (void**)&r );
+                free( r );
+                n--;
+            }
+        }
+        if ( !remove )
+        {
+            a = b;
+            ++i;
+        }
+    }
+}
+
+
 /* =========================================================================================== */
 
 static int CC reference_vs_pchar_wrapper( const void *item, const BSTNode *n )
@@ -334,15 +405,52 @@ rc_t parse_and_add_region( BSTree * regions, const char * s )
 /* =========================================================================================== */
 
 
+static void CC slice_report_wrapper( BSTNode *n, void *data )
+{
+    const struct reference_region * r = ( const struct reference_region * )n;
+    uint32_t nr = VectorLength( &( r->ranges ) );
+
+    KOutMsg( "\n-[%s]:\n", r->name );
+    if ( nr == 0 )
+        KOutMsg( " no ranges!\n" );
+    else
+    {
+        uint32_t i, j;
+        for ( i = 0; i < nr; ++i )
+        {
+            const struct reference_range * rr = ( const struct reference_range * ) VectorGet ( &( r->ranges ), i );
+            uint32_t ns = VectorLength( &( rr->skip ) );
+            KOutMsg( "  %u ... %u\n", rr->start, rr->end );
+            for ( j = 0; j < ns; ++j )
+            {
+                const struct skip_range * sr = ( const struct skip_range * ) VectorGet ( &( rr->skip ), j );
+                KOutMsg( "  ___skip %u ... %u\n", sr->start, sr->end );
+            }
+        }
+    }
+}
+
+
+void slice_report( BSTree * regions )
+{
+    KOutMsg( "\n\nstart slice-report:\n" );
+    BSTreeForEach ( regions, false, slice_report_wrapper, NULL );
+    KOutMsg( "\nend slice-report\n\n" );
+}
+
 static void CC check_refrange_wrapper( BSTNode *n, void *data )
 {
-    check_ref_region_ranges( ( struct reference_region * ) n );
+    struct reference_region * rr = ( struct reference_region * )n;
+    uint64_t * merge_diff = data;
+    merge_overlapping_ranges( rr );
+    if ( *merge_diff > 0 )
+        merge_close_ranges_and_create_filter( rr, *merge_diff );
 }
 
 
-void check_ref_regions( BSTree * regions )
+void check_ref_regions( BSTree * regions, uint64_t merge_diff )
 {
-    BSTreeForEach ( regions, false, check_refrange_wrapper, NULL );
+    BSTreeForEach ( regions, false, check_refrange_wrapper, &merge_diff );
 }
 
 
@@ -385,40 +493,33 @@ uint32_t count_ref_regions( BSTree * regions )
 
 typedef struct foreach_ref_region_func
 {
-    rc_t ( CC * on_region ) ( const char * name, uint32_t start, uint32_t end, void *data );
-    const char * name;
+    rc_t ( CC * on_region ) ( const char * name, const struct reference_range * range, void *data );
     void * data;
     rc_t rc;
 } foreach_ref_region_func;
 
 
-static void CC foreach_range_vector_wrapper( void *item, void *data )
-{
-    struct reference_range * r = ( struct reference_range * ) item;
-    foreach_ref_region_func * func = ( foreach_ref_region_func * )data;
-
-    if ( func->rc == 0 )
-    {
-        func->rc = func->on_region( func->name, r->start, r->end, func->data );
-    }
-}
-
-
-static void CC foreach_ref_region_wrapper( BSTNode *n, void *data )
+static bool CC foreach_ref_region_wrapper( BSTNode *n, void *data )
 {   
     struct reference_region * r = ( struct reference_region * ) n;
     foreach_ref_region_func * func = ( foreach_ref_region_func * )data;
 
     if ( func->rc == 0 )
     {
-        func->name = r->name;
-        VectorForEach ( &(r->ranges), false, foreach_range_vector_wrapper, data );
+        uint32_t i, v_count = VectorLength( &( r->ranges ) );
+
+        for ( i = 0; i < v_count && func->rc == 0; ++i )
+        {
+            struct reference_range * rr = VectorGet ( &( r->ranges ), i );
+            func->rc = func->on_region( r->name, rr, func->data );    
+        }
     }
+    return ( func->rc != 0 );
 }
 
 
 rc_t foreach_ref_region( BSTree * regions,
-    rc_t ( CC * on_region ) ( const char * name, uint32_t start, uint32_t end, void *data ), 
+    rc_t ( CC * on_region ) ( const char * name, const struct reference_range * range, void *data ), 
     void *data )
 {
     foreach_ref_region_func func;
@@ -426,7 +527,7 @@ rc_t foreach_ref_region( BSTree * regions,
     func.on_region = on_region;
     func.data = data;
     func.rc = 0;
-    BSTreeForEach ( regions, false, foreach_ref_region_wrapper, &func );
+    BSTreeDoUntil ( regions, false, foreach_ref_region_wrapper, &func );
     return func.rc;
 }
 
@@ -489,3 +590,218 @@ uint64_t get_ref_range_end( const struct reference_range * range )
         res = range->end;
     return res;
 }
+
+
+/* =========================================================================================== */
+
+
+struct skiplist_ref_node
+{
+    BSTNode node;
+    const char * name;
+    int32_t current_id;
+    const struct skip_range * current_skip_range;
+    Vector skip_ranges;     /* holds skip_range structs */
+} skiplist_ref_node;
+
+
+struct skiplist
+{
+    BSTree nodes;           /* a tree of skiplist_ref_node 's */
+    uint32_t node_count;
+    struct skiplist_ref_node * current;
+} skiplist;
+
+
+/* helper func to detect if the given reference_region has ranges to be skiped */
+static bool reference_region_has_skip_ranges( const struct reference_region * r )
+{
+    bool res = false;
+    uint32_t i, n = VectorLength( &r->ranges );
+    for ( i = 0; i < n && !res; ++i )
+    {
+        const struct reference_range * rr = VectorGet ( &( r->ranges ), i );
+        if ( VectorLength( &rr->skip ) > 0 ) res = true;
+    }
+    return res;
+}
+
+
+/* helper to create a skiplist-node, walk the given the ref-region fo find and enter all skip positions */
+static struct skiplist_ref_node * make_skiplist_ref_node( const struct reference_region * r )
+{
+    struct skiplist_ref_node * res = calloc( 1, sizeof *res );
+    if ( res != NULL )
+    {
+        uint32_t i, n = VectorLength( &r->ranges );
+        res->name = string_dup_measure ( r->name, NULL );
+        VectorInit ( &res->skip_ranges, 0, 5 );
+        /* walk the ranges-Vector of the reference-region */
+        for ( i = 0; i < n; ++i )
+        {
+            const struct reference_range * rr = VectorGet ( &( r->ranges ), i );
+            /* walk the skip-Vector of the reference-range */
+            uint32_t j, n1 = VectorLength( &rr->skip );
+            for ( j = 0; j < n1; ++j )
+            {
+                const struct skip_range * sr = VectorGet ( &( rr->skip ), j );
+                if ( sr != NULL )
+                {
+                    struct skip_range * csr = make_skip_range( sr->start, sr->end );
+                    if ( csr != NULL )
+                        VectorAppend ( &( res->skip_ranges ), NULL, csr );
+                }
+            }
+        }
+        res->current_id = 0;
+        res->current_skip_range = VectorGet ( &( res->skip_ranges ), 0 );
+    }
+    return res;
+}
+
+
+/* helper call back for BSTreeInsert into skiplist->nodes */
+static int CC srn_vs_srn_wrapper( const BSTNode *item, const BSTNode *n )
+{
+   const struct skiplist_ref_node * a = ( const struct skiplist_ref_node * )item;
+   const struct skiplist_ref_node * b = ( const struct skiplist_ref_node * )n;
+   return cmp_pchar( a->name, b->name );
+}
+
+
+/* call back for each reference-region to generate eventually a skiplist_ref_node */
+static void CC visit_region_node_for_skiplist( BSTNode *n, void *data )
+{
+    const struct reference_region * r = ( const struct reference_region * ) n;
+    struct skiplist * skl = ( struct skiplist * ) data;
+    if ( r != NULL && skl != NULL )
+    {
+        /* walk the reference-region, detect if we even have something to skip in here */
+        if ( reference_region_has_skip_ranges( r ) )
+        {
+            struct skiplist_ref_node * srn = make_skiplist_ref_node( r );
+            if ( srn != NULL )
+            {
+                BSTreeInsert ( &(skl->nodes), ( BSTNode * )srn, srn_vs_srn_wrapper );
+                skl->node_count++;
+            }
+        }
+    }
+}
+
+struct skiplist * skiplist_make( BSTree * regions )
+{
+    struct skiplist *res = calloc( 1, sizeof *res );
+    if ( res != NULL )
+    {
+        BSTreeInit( &(res->nodes) );
+        res->current = NULL;
+        res->node_count = 0;
+
+        /* walk the given regions-tree to generate the skip-list */
+        BSTreeForEach ( regions, false, visit_region_node_for_skiplist, res );
+        if ( res->node_count == 0 )
+        {
+            skiplist_release( res );
+            res = NULL;
+        }
+    }
+    return res;
+}
+
+
+static void CC release_skiplist_entry( BSTNode * n, void * data )
+{
+    struct skiplist_ref_node * node = ( struct skiplist_ref_node * )n;
+    if ( node->name != NULL ) free( ( void * ) node->name );
+    VectorWhack ( &node->skip_ranges, release_skip, NULL );     /* wrapper callback reused from above */
+    free( ( void * ) node );
+}
+
+
+void skiplist_release( struct skiplist * list )
+{
+    if ( list != NULL )
+    {
+        BSTreeWhack ( &(list->nodes), release_skiplist_entry, NULL );
+        free( ( void * ) list );
+    }
+}
+
+
+static int CC pchar_vs_srn_cmp( const void * item, const BSTNode * n )
+{
+   const char * name = item;
+   const struct skiplist_ref_node * b = ( const struct skiplist_ref_node * )n;
+   return cmp_pchar( name, b->name );
+
+}
+
+
+void skiplist_enter_ref( struct skiplist * list, const char * name )
+{
+    if ( list != NULL )
+    {
+        if ( name == NULL )
+            list->current = NULL;
+        else
+        {
+            struct skiplist_ref_node * cur_node = ( struct skiplist_ref_node * )BSTreeFind ( &( list->nodes ), name, pchar_vs_srn_cmp );
+            list->current = cur_node;
+            cur_node->current_id = 0;
+            cur_node->current_skip_range = VectorGet ( &( cur_node->skip_ranges ), 0 );
+        }
+    }
+}
+
+
+bool skiplist_is_skip_position( struct skiplist * list, uint64_t pos )
+{
+    if ( list != NULL )
+    {
+        struct skiplist_ref_node * cur_node = list->current;
+        if ( cur_node != NULL )
+        {
+            const struct skip_range * curr_skip_range = cur_node->current_skip_range;
+            if ( curr_skip_range != NULL )
+            {
+                if ( pos < curr_skip_range->start ) return false;
+                if ( pos <= curr_skip_range->end ) return true;
+                cur_node->current_id++;
+                cur_node->current_skip_range = VectorGet ( &( cur_node->skip_ranges ), cur_node->current_id );
+            }
+        }
+    }
+    return false;
+}
+
+
+static void CC skiplist_report_cb( BSTNode *n, void *data )
+{
+    const struct skiplist_ref_node * node = ( const struct skiplist_ref_node * )n;
+    uint32_t nr = VectorLength( &( node->skip_ranges ) );
+
+    KOutMsg( "\n-[%s]:\n", node->name );
+    if ( n == 0 )
+        KOutMsg( " no ranges!\n" );
+    else
+    {
+        uint32_t i;
+        for ( i = 0; i < nr; ++i )
+        {
+            const struct skip_range * sr = ( const struct skip_range * ) VectorGet ( &( node->skip_ranges ), i );
+            KOutMsg( "  %u ... %u\n", sr->start, sr->end );
+        }
+    }
+}
+
+
+void skiplist_report( const struct skiplist * list )
+{
+    if ( list != NULL )
+    {
+        KOutMsg( "\n\nstart skiplist-report:\n" );
+        BSTreeForEach ( &( list->nodes ), false, skiplist_report_cb, NULL );
+        KOutMsg( "\nend skiplist-report\n\n" );
+    }
+}
diff --git a/tools/sra-pileup/ref_regions.h b/tools/sra-pileup/ref_regions.h
index 0081091..178c3b2 100644
--- a/tools/sra-pileup/ref_regions.h
+++ b/tools/sra-pileup/ref_regions.h
@@ -33,42 +33,37 @@
 extern "C" {
 #endif
 
-rc_t parse_and_add_region( BSTree * regions, const char * s );
+struct reference_range;
+struct reference_region;
+struct skiplist;
 
+rc_t parse_and_add_region( BSTree * regions, const char * s );
 rc_t add_region( BSTree * regions, const char * name, const uint64_t start, const uint64_t end );
-
-void check_ref_regions( BSTree * regions );
-
+void check_ref_regions( BSTree * regions, uint64_t merge_diff );
 void free_ref_regions( BSTree * regions );
-
 uint32_t count_ref_regions( BSTree * regions );
-
 rc_t foreach_ref_region( BSTree * regions,
-    rc_t ( CC * on_region ) ( const char * name, uint32_t start, uint32_t end, void *data ), 
+    rc_t ( CC * on_region ) ( const char * name, const struct reference_range * range, void *data ), 
     void *data );
 
 
-struct reference_region;
-
 const struct reference_region * get_first_ref_node( const BSTree * regions );
-
 const struct reference_region * get_next_ref_node( const struct reference_region * node );
-    
 const char * get_ref_node_name( const struct reference_region * node );
-
 uint32_t get_ref_node_range_count( const struct reference_region * node );
 
 
-
-struct reference_range;
-
 const struct reference_range * get_ref_range( const struct reference_region * node, uint32_t idx );
-
 uint64_t get_ref_range_start( const struct reference_range * range );
-
 uint64_t get_ref_range_end( const struct reference_range * range );
 
 
+struct skiplist * skiplist_make( BSTree * regions );
+void skiplist_release( struct skiplist * list );
+void skiplist_enter_ref( struct skiplist * list, const char * name );
+bool skiplist_is_skip_position( struct skiplist * list, uint64_t pos );
+void skiplist_report( const struct skiplist * list );
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/tools/sra-pileup/ref_walker.c b/tools/sra-pileup/ref_walker.c
index 1d74a9f..4723343 100644
--- a/tools/sra-pileup/ref_walker.c
+++ b/tools/sra-pileup/ref_walker.c
@@ -107,18 +107,13 @@ struct ref_walker
     const AlignMgr * amgr;
     VFSManager * vfs_mgr;
     PlacementRecordExtendFuncs cb_block;
+    struct skiplist * skiplist;
     
     /* options for the Reference-Iterator */
     int32_t min_mapq;
-    bool omit_quality;
+    uint32_t interest;
+    uint64_t merge_diff;
     bool prepared;
-    bool read_tlen;
-    bool process_dups;
-    bool use_seq_name;
-    bool no_skip;
-    bool primary_alignments;
-    bool secondary_alignments;
-    bool evidence_alignments;
     char * spot_group;
 
     /* manages the sources and regions requested */
@@ -158,6 +153,7 @@ static void ref_walker_release( struct ref_walker * self )
     VNamelistRelease ( self->sources );
     free_ref_regions( &self->regions );
     free( ( void * )self->spot_group );
+    if ( self->skiplist != NULL ) skiplist_release( self->skiplist );
 }
 
 
@@ -214,7 +210,7 @@ static rc_t CC populate_data( void *obj, const PlacementRecord *placement,
     rc_t rc = 0;
 
     rec->quality = NULL;
-    if ( !walker->process_dups )
+    if ( !( walker->interest & RW_INTEREST_DUPS ) )
     {
         const uint8_t * read_filter;
         uint32_t read_filter_len;
@@ -239,7 +235,7 @@ static rc_t CC populate_data( void *obj, const PlacementRecord *placement,
             rec->reverse = *orientation;
     }
 
-    if ( rc == 0 && !walker->omit_quality )
+    if ( rc == 0 && ( walker->interest & RW_INTEREST_QUAL ) )
     {
         const uint8_t * quality;
         uint32_t quality_len;
@@ -254,7 +250,7 @@ static rc_t CC populate_data( void *obj, const PlacementRecord *placement,
         }
     }
 
-    if ( rc == 0 && walker->read_tlen )
+    if ( rc == 0 && ( walker->interest & RW_INTEREST_TLEN ) )
     {
         const int32_t * tlen;
         uint32_t tlen_len;
@@ -282,7 +278,7 @@ static rc_t CC alloc_size( struct VCursor const *curs, int64_t row_id, size_t *
     walker_col_ids * col_ids = placement_ctx;
     *size = ( sizeof *rec );
 
-    if ( !walker->omit_quality )
+    if ( walker->interest & RW_INTEREST_QUAL )
     {
         uint32_t q_len;
         rc = read_base_and_len( curs, col_ids->idx_quality, row_id, NULL, &q_len );
@@ -317,7 +313,9 @@ static rc_t ref_walker_init( struct ref_walker * self )
     self->cb_block.fixed_size = 0;
 
     BSTreeInit( &self->regions );
-    self->primary_alignments = true;
+    self->interest = RW_INTEREST_PRIM;
+    self->skiplist = 0;
+    self->merge_diff = 0;
     
     if ( rc != 0 )
         ref_walker_release( self );
@@ -360,92 +358,47 @@ rc_t ref_walker_create( struct ref_walker ** self )
 rc_t ref_walker_set_min_mapq( struct ref_walker * self, int32_t min_mapq )
 {
     if ( self == NULL )
-        return RC( rcApp, rcNoTarg, rcConstructing, rcParam, rcNull );
+        return RC( rcApp, rcNoTarg, rcAccessing, rcSelf, rcNull );
     self->min_mapq = min_mapq;
     return 0;
 }
 
 
-rc_t ref_walker_set_omit_quality( struct ref_walker * self, bool omit_quality )
-{
-    if ( self == NULL )
-        return RC( rcApp, rcNoTarg, rcConstructing, rcParam, rcNull );
-    self->omit_quality = omit_quality;
-    return 0;
-}
-
-
-rc_t ref_walker_set_read_tlen( struct ref_walker * self, bool read_tlen )
-{
-    if ( self == NULL )
-        return RC( rcApp, rcNoTarg, rcConstructing, rcParam, rcNull );
-    self->read_tlen = read_tlen;
-    return 0;
-}
-
-
-rc_t ref_walker_set_process_dups( struct ref_walker * self, bool process_dups )
-{
-    if ( self == NULL )
-        return RC( rcApp, rcNoTarg, rcConstructing, rcParam, rcNull );
-    self->process_dups = process_dups;
-    return 0;
-}
-
-
-rc_t ref_walker_set_use_seq_name( struct ref_walker * self, bool use_seq_name )
-{
-    if ( self == NULL )
-        return RC( rcApp, rcNoTarg, rcConstructing, rcParam, rcNull );
-    self->use_seq_name = use_seq_name;
-    return 0;
-}
-
-
-rc_t ref_walker_set_no_skip( struct ref_walker * self, bool no_skip )
-{
-    if ( self == NULL )
-        return RC( rcApp, rcNoTarg, rcConstructing, rcParam, rcNull );
-    self->no_skip = no_skip;
-    return 0;
-}
-
-
-rc_t ref_walker_set_primary_alignments( struct ref_walker * self, bool enabled )
+rc_t ref_walker_set_spot_group( struct ref_walker * self, const char * spot_group )
 {
     if ( self == NULL )
-        return RC( rcApp, rcNoTarg, rcConstructing, rcParam, rcNull );
-    self->primary_alignments = enabled;
+        return RC( rcApp, rcNoTarg, rcAccessing, rcSelf, rcNull );
+    self->spot_group = string_dup ( spot_group, string_size( spot_group ) );
     return 0;
 }
+    
 
-
-rc_t ref_walker_set_secondary_alignments( struct ref_walker * self, bool enabled )
+rc_t ref_walker_set_merge_diff( struct ref_walker * self, uint64_t merge_diff )
 {
     if ( self == NULL )
-        return RC( rcApp, rcNoTarg, rcConstructing, rcParam, rcNull );
-    self->secondary_alignments = enabled;
+        return RC( rcApp, rcNoTarg, rcAccessing, rcSelf, rcNull );
+    self->merge_diff = merge_diff;
     return 0;
 }
 
-
-rc_t ref_walker_set_evidence_alignments( struct ref_walker * self, bool enabled )
+rc_t ref_walker_set_interest( struct ref_walker * self, uint32_t interest )
 {
     if ( self == NULL )
-        return RC( rcApp, rcNoTarg, rcConstructing, rcParam, rcNull );
-    self->evidence_alignments = enabled;
+        return RC( rcApp, rcNoTarg, rcAccessing, rcSelf, rcNull );
+    self->interest = interest;
     return 0;
 }
 
 
-rc_t ref_walker_set_spot_group( struct ref_walker * self, const char * spot_group )
+rc_t ref_walker_get_interest( struct ref_walker * self, uint32_t * interest )
 {
     if ( self == NULL )
-        return RC( rcApp, rcNoTarg, rcConstructing, rcParam, rcNull );
-    self->spot_group = string_dup ( spot_group, string_size( spot_group ) );
+        return RC( rcApp, rcNoTarg, rcAccessing, rcSelf, rcNull );
+    if ( interest == NULL )
+        return RC( rcApp, rcNoTarg, rcAccessing, rcParam, rcNull );
+    *interest = self->interest;
     return 0;
 }
-    
 
 /* ================================================================================================ */
 
@@ -453,9 +406,9 @@ rc_t ref_walker_set_spot_group( struct ref_walker * self, const char * spot_grou
 rc_t ref_walker_set_callbacks( struct ref_walker * self, ref_walker_callbacks * callbacks )
 {
     if ( self == NULL )
-        return RC( rcApp, rcNoTarg, rcConstructing, rcSelf, rcNull );
+        return RC( rcApp, rcNoTarg, rcAccessing, rcSelf, rcNull );
     if ( callbacks == NULL )
-        return RC( rcApp, rcNoTarg, rcConstructing, rcParam, rcNull );
+        return RC( rcApp, rcNoTarg, rcAccessing, rcParam, rcNull );
 
     self->on_enter_ref = callbacks->on_enter_ref;
     self->on_exit_ref = callbacks->on_exit_ref;
@@ -478,7 +431,7 @@ rc_t ref_walker_add_source( struct ref_walker * self, const char * src )
 {
     rc_t rc = 0;
     if ( self == NULL )
-        rc = RC( rcApp, rcNoTarg, rcConstructing, rcParam, rcNull );
+        rc = RC( rcApp, rcNoTarg, rcConstructing, rcSelf, rcNull );
     else
         rc = VNamelistAppend ( self->sources, src );
     return rc;
@@ -489,7 +442,7 @@ rc_t ref_walker_parse_and_add_range( struct ref_walker * self, const char * rang
 {
     rc_t rc = 0;
     if ( self == NULL )
-        rc = RC( rcApp, rcNoTarg, rcConstructing, rcParam, rcNull );
+        rc = RC( rcApp, rcNoTarg, rcConstructing, rcSelf, rcNull );
     else
         rc = parse_and_add_region( &self->regions, range );
     return rc;
@@ -500,7 +453,7 @@ rc_t ref_walker_add_range( struct ref_walker * self, const char * name, const ui
 {
     rc_t rc = 0;
     if ( self == NULL )
-        rc = RC( rcApp, rcNoTarg, rcConstructing, rcParam, rcNull );
+        rc = RC( rcApp, rcNoTarg, rcConstructing, rcSelf, rcNull );
     else
         rc = add_region( &self->regions, name, start, end );
     return rc;
@@ -615,7 +568,9 @@ static rc_t ref_walker_prepare( struct ref_walker * self )
                 }
             }
         }
-        check_ref_regions( &self->regions );
+        check_ref_regions( &self->regions, self->merge_diff );
+        if ( self->merge_diff > 0 )
+            self->skiplist = skiplist_make( &self->regions );
         self->prepared = ( rc == 0 );
     }
     return rc;
@@ -626,13 +581,13 @@ static uint32_t ref_walker_make_reflist_options( struct ref_walker * self )
 {
     uint32_t res = ereferencelist_4na;
 
-    if ( self->primary_alignments )
+    if ( self->interest & RW_INTEREST_PRIM )
         res |= ereferencelist_usePrimaryIds;
 
-    if ( self->secondary_alignments )
+    if ( self->interest & RW_INTEREST_SEC )
         res |= ereferencelist_useSecondaryIds;
 
-    if ( self->evidence_alignments )
+    if ( self->interest & RW_INTEREST_EV )
         res |= ereferencelist_useEvidenceIds;
 
     return res;
@@ -670,7 +625,7 @@ static rc_t add_required_columns( struct ref_walker * self, const VTable *tbl, c
         LOGERR( klogInt, rc, "VTableCreateCursorRead() failed" );
     }
 
-    if ( rc == 0 && !self->omit_quality )
+    if ( rc == 0 && ( self->interest & RW_INTEREST_QUAL ) )
     {
         rc = VCursorAddColumn ( *cursor, &cursor_ids->idx_quality, COL_QUALITY );
         if ( rc != 0 )
@@ -697,7 +652,7 @@ static rc_t add_required_columns( struct ref_walker * self, const VTable *tbl, c
         }
     }
 
-    if ( rc == 0 && self->read_tlen )
+    if ( rc == 0 && ( self->interest & RW_INTEREST_TLEN ) )
     {
         rc = VCursorAddColumn ( *cursor, &cursor_ids->idx_template_len, COL_TEMPLATE_LEN );
         if ( rc != 0 )
@@ -719,7 +674,7 @@ static rc_t ref_walker_add_iterator( struct ref_walker * self, const char * ref_
     if ( rc == 0 )
     {
         const VTable *tbl;
-        rc_t rc = VDatabaseOpenTableRead ( db, &tbl, table_name );
+        rc_t rc = VDatabaseOpenTableRead ( db, &tbl, "%s", table_name );
         if ( rc == 0 )
         {
             const VCursor *cursor;
@@ -756,23 +711,76 @@ static rc_t ref_walker_walk_alignment( struct ref_walker * self,
                                        const PlacementRecord * rec,
                                        ref_walker_data * rwd )
 {
+    rc_t rc;
+
+    /* cast the generic record comming from the iterator into the tool-specific one */
     walker_rec * xrec = PlacementRecordCast ( rec, placementRecordExtension1 );
+
+    /* get all the state of the ref_iter out */
     rwd->state = ReferenceIteratorState ( ref_iter, &rwd->seq_pos );
     rwd->valid = ( ( rwd->state & align_iter_invalid ) == 0 );
-    rwd->reverse = xrec->reverse;
+
     rwd->first = ( ( rwd->state & align_iter_first ) == align_iter_first );
     rwd->last  = ( ( rwd->state & align_iter_last ) == align_iter_last );
-    rwd->skip = ( ( rwd->state & align_iter_skip ) == align_iter_skip );
+
     rwd->match = ( ( rwd->state & align_iter_match ) == align_iter_match );
-    rwd->bin_alignment_base = ( rwd->state & 0x0F );
-    rwd->ascii_alignment_base = _4na_to_ascii( rwd->state, rwd->reverse );
-    if ( !self->omit_quality )
-        rwd->quality = xrec->quality[ rwd->seq_pos ];
+    rwd->skip  = ( ( rwd->state & align_iter_skip ) == align_iter_skip );
+
+    rwd->reverse = xrec->reverse;
+
+    if ( self->interest & RW_INTEREST_BASE )
+    {
+        rwd->bin_alignment_base = ( rwd->state & 0x0F );
+        if ( !rwd->match )
+            rwd->ascii_alignment_base = _4na_to_ascii( rwd->state, rwd->reverse );
+        else
+            rwd->ascii_alignment_base = rwd->ascii_ref_base;
+    }
+
+    if ( self->interest & RW_INTEREST_QUAL )
+    {
+        if ( rwd->skip )
+            rwd->quality = ( xrec->quality[ rwd->seq_pos + 1 ] + 33 );
+        else
+            rwd->quality = ( xrec->quality[ rwd->seq_pos ] + 33 );
+    }
+
     rwd->mapq = rec->mapq;
-    return self->on_alignment( rwd );
+
+    if ( self->interest & RW_INTEREST_INDEL )
+    {
+        rwd->ins   = ( ( rwd->state & align_iter_insert ) == align_iter_insert );
+        rwd->del   = ( ( rwd->state & align_iter_delete ) == align_iter_delete );
+
+        if ( rwd->ins )
+            rwd->ins_bases_count = ReferenceIteratorBasesInserted ( ref_iter, &rwd->ins_bases );
+        if ( rwd->del )
+            rwd->del_bases_count = ReferenceIteratorBasesDeleted ( ref_iter, &rwd->del_ref_pos, &rwd->del_bases );
+    }
+
+    if ( self->interest & RW_INTEREST_DEBUG )
+    {
+        rwd->alignment_id = rec->id;
+        rwd->alignment_start_pos = rec->pos;
+        rwd->alignment_len = rec->len;
+    }
+
+    rc = self->on_alignment( rwd );
+
+    if ( self->interest & RW_INTEREST_INDEL && rwd->del && ( rwd->del_bases_count > 0 ) )
+        free( ( void * )rwd->del_bases );
+
+    return rc;
 }
 
 
+/* free all cursor-ids-blocks created in parallel with the alignment-cursor */
+static void CC cur_id_vector_entry_whack( void *item, void *data )
+{
+    walker_col_ids * ids = item;
+    free( ids );
+}
+
 static rc_t ref_walker_walk_ref_range( struct ref_walker * self, ref_walker_data * rwd )
 {
     ReferenceIterator * ref_iter;
@@ -814,15 +822,15 @@ static rc_t ref_walker_walk_ref_range( struct ref_walker * self, ref_walker_data
                                 if ( ( rwd->ref_end == 0 )||( rwd->ref_end > len + 1 ) )
                                     rwd->ref_end = ( len - rwd->ref_start ) + 1;
 
-                                if ( self->primary_alignments )
+                                if ( self->interest & RW_INTEREST_PRIM )
                                     rc = ref_walker_add_iterator( self, rwd->ref_name, rwd->ref_start, rwd->ref_end, src_name, 
                                             &cur_id_vector, db, ref_obj, ref_iter, TBL_PRIM, primary_align_ids );
 
-                                if ( rc == 0 && self->secondary_alignments )
+                                if ( rc == 0 && ( self->interest & RW_INTEREST_SEC ) )
                                     rc = ref_walker_add_iterator( self, rwd->ref_name, rwd->ref_start, rwd->ref_end, src_name, 
                                             &cur_id_vector, db, ref_obj, ref_iter, TBL_SEC, secondary_align_ids );
 
-                                if ( rc == 0 && self->evidence_alignments )
+                                if ( rc == 0 && ( self->interest & RW_INTEREST_EV ) )
                                     rc = ref_walker_add_iterator( self, rwd->ref_name, rwd->ref_start, rwd->ref_end, src_name, 
                                             &cur_id_vector, db, ref_obj, ref_iter, TBL_EV, evidence_align_ids );
 
@@ -839,66 +847,86 @@ static rc_t ref_walker_walk_ref_range( struct ref_walker * self, ref_walker_data
         if ( rc == 0 )
         {
             /* walk the reference iterator */
+            
+            /* because in this strategy, each ref-iter contains only 1 ref-obj, no need for a loop */
             struct ReferenceObj const * ref_obj;
             rc = ReferenceIteratorNextReference( ref_iter, NULL, NULL, &ref_obj );
             if ( rc == 0 && ref_obj != NULL )
             {
-                if ( self->use_seq_name )
+
+                if ( self->interest & RW_INTEREST_SEQNAME )
                     rc = ReferenceObj_Name( ref_obj, &rwd->ref_name );
                 else
                     rc = ReferenceObj_SeqId( ref_obj, &rwd->ref_name );
+
                 if ( rc == 0 )
                 {
                     INSDC_coord_zero first_pos;
                     INSDC_coord_len len;
-                    rc_t rc_w = ReferenceIteratorNextWindow ( ref_iter, &first_pos, &len );
+                    rc_t rc_w = 0, rc_p;
                     while ( rc == 0 && rc_w == 0 )
                     {
-                        rc_t rc_p = ReferenceIteratorNextPos ( ref_iter, !self->no_skip );
-                        if ( rc_p == 0 )
+                        rc_w = ReferenceIteratorNextWindow ( ref_iter, &first_pos, &len );
+                        if ( rc_w == 0 )
                         {
-                            rc = ReferenceIteratorPosition ( ref_iter, &rwd->pos, &rwd->depth, &rwd->bin_ref_base );
-                            if ( rwd->depth > 0 && rc == 0 )
+                            rc_p = 0;
+                            while( rc == 0 && rc_p == 0 )
                             {
-                                rc_t rc_sg = 0;
-                                rwd->ascii_ref_base = _4na_to_ascii( rwd->bin_ref_base, false );
-                                if ( self->on_enter_ref_pos != NULL )
-                                    rc = self->on_enter_ref_pos( rwd );
-
-                                while ( rc_sg == 0 && rc == 0 )
+                                rc_p = ReferenceIteratorNextPos ( ref_iter, ( self->interest & RW_INTEREST_SKIP ) );
+                                if ( rc_p == 0 )
                                 {
-                                    rc_sg = ReferenceIteratorNextSpotGroup ( ref_iter, &rwd->spot_group, &rwd->spot_group_len );
-                                    if ( rc_sg == 0 )
+                                    rc = ReferenceIteratorPosition ( ref_iter, &rwd->pos, &rwd->depth, &rwd->bin_ref_base );
+                                    if ( rwd->depth > 0 && rc == 0 )
                                     {
-                                        rc_t rc_pr = 0;
-                                        if ( self->on_enter_spot_group != NULL )
-                                            rc = self->on_enter_spot_group( rwd );
+                                        rc_t rc_sg = 0;
+                                        bool skip = false;
+
+                                        if ( self->skiplist != NULL )
+                                            skip = skiplist_is_skip_position( self->skiplist, rwd->pos + 1 );
 
-                                        while ( rc == 0 && rc_pr == 0 )
+                                        if ( !skip )
                                         {
-                                            const PlacementRecord * rec;
-                                            rc_pr = ReferenceIteratorNextPlacement ( ref_iter, &rec );
-                                            if ( rc_pr == 0 && self->on_alignment != NULL )
-                                                rc = ref_walker_walk_alignment( self, ref_iter, rec, rwd );
+                                            rwd->ascii_ref_base = _4na_to_ascii( rwd->bin_ref_base, false );
+                                            if ( self->on_enter_ref_pos != NULL )
+                                                rc = self->on_enter_ref_pos( rwd );
+
+                                            while ( rc_sg == 0 && rc == 0 )
+                                            {
+                                                rc_sg = ReferenceIteratorNextSpotGroup ( ref_iter, &rwd->spot_group, &rwd->spot_group_len );
+                                                if ( rc_sg == 0 )
+                                                {
+                                                    rc_t rc_pr = 0;
+                                                    if ( self->on_enter_spot_group != NULL )
+                                                        rc = self->on_enter_spot_group( rwd );
+
+                                                    while ( rc == 0 && rc_pr == 0 )
+                                                    {
+                                                        const PlacementRecord * rec;
+                                                        rc_pr = ReferenceIteratorNextPlacement ( ref_iter, &rec );
+                                                        if ( rc_pr == 0 && self->on_alignment != NULL )
+                                                            rc = ref_walker_walk_alignment( self, ref_iter, rec, rwd );
+                                                    }
+
+                                                    if ( self->on_exit_spot_group != NULL )
+                                                        rc = self->on_exit_spot_group( rwd );
+                                                }
+                                            }
+                                            if ( self->on_exit_ref_pos != NULL )
+                                                rc = self->on_exit_ref_pos( rwd );
                                         }
-
-                                        if ( self->on_exit_spot_group != NULL )
-                                            rc = self->on_exit_spot_group( rwd );
                                     }
+                                    rc = Quitting();
                                 }
-                                if ( self->on_exit_ref_pos != NULL )
-                                    rc = self->on_exit_ref_pos( rwd );
                             }
-                            rc = Quitting();
                         }
                     }
                 }
             }
         }
+        ReferenceIteratorRelease ( ref_iter );
 
         /* free cur_id_vector */
-
-        ReferenceIteratorRelease ( ref_iter );
+        VectorWhack ( &cur_id_vector, cur_id_vector_entry_whack, NULL );
     }
     return rc;
 }
@@ -927,6 +955,9 @@ static rc_t ref_walker_walk_ref_region( struct ref_walker * self,
 
     if ( rc == 0 )
     {
+        if ( self->skiplist != NULL )
+            skiplist_enter_ref( self->skiplist, rwd->ref_name );
+
         for ( idx = 0; idx < count; ++ idx )
         {
             const struct reference_range * range = get_ref_range( region, idx );
diff --git a/tools/sra-pileup/ref_walker.h b/tools/sra-pileup/ref_walker.h
index 2067995..db109a9 100644
--- a/tools/sra-pileup/ref_walker.h
+++ b/tools/sra-pileup/ref_walker.h
@@ -40,6 +40,17 @@ struct ref_walker;
 /* create the ref-walker ( not ref-counted ) */
 rc_t ref_walker_create( struct ref_walker ** self );
 
+#define RW_INTEREST_INDEL   0x0001
+#define RW_INTEREST_DEBUG   0x0002
+#define RW_INTEREST_BASE    0x0004
+#define RW_INTEREST_QUAL    0x0008
+#define RW_INTEREST_SKIP    0x0010
+#define RW_INTEREST_DUPS    0x0020
+#define RW_INTEREST_TLEN    0x0040
+#define RW_INTEREST_SEQNAME 0x0080
+#define RW_INTEREST_PRIM    0x0100
+#define RW_INTEREST_SEC     0x0200
+#define RW_INTEREST_EV      0x0400
 
 typedef struct ref_walker_data
 {
@@ -64,7 +75,20 @@ typedef struct ref_walker_data
     char ascii_alignment_base;
     char quality;
     INSDC_coord_zero seq_pos;
-    bool reverse, first, last, skip, match, valid;
+    bool ins, del, reverse, first, last, skip, match, valid;
+
+    /* indels for alignment */
+    const INSDC_4na_bin * ins_bases;
+    uint32_t ins_bases_count;
+
+    INSDC_coord_zero del_ref_pos;
+    const INSDC_4na_bin * del_bases;
+    uint32_t del_bases_count;
+
+    /* for debugging purpose */
+    uint64_t alignment_id;
+    uint32_t alignment_start_pos;
+    uint32_t alignment_len;
 
     void * data;
 } ref_walker_data;
@@ -93,15 +117,10 @@ typedef struct ref_walker_callbacks
 
 /* set boolean / numeric parameters */
 rc_t ref_walker_set_min_mapq( struct ref_walker * self, int32_t min_mapq );
-rc_t ref_walker_set_omit_quality( struct ref_walker * self, bool omit_quality );
-rc_t ref_walker_set_read_tlen( struct ref_walker * self, bool read_tlen );
-rc_t ref_walker_set_process_dups( struct ref_walker * self, bool process_dups );
-rc_t ref_walker_set_use_seq_name( struct ref_walker * self, bool use_seq_name );
-rc_t ref_walker_set_no_skip( struct ref_walker * self, bool no_skip );
-rc_t ref_walker_set_primary_alignments( struct ref_walker * self, bool enabled );
-rc_t ref_walker_set_secondary_alignments( struct ref_walker * self, bool enabled );
-rc_t ref_walker_set_evidence_alignments( struct ref_walker * self, bool enabled );
 rc_t ref_walker_set_spot_group( struct ref_walker * self, const char * spot_group );
+rc_t ref_walker_set_merge_diff( struct ref_walker * self, uint64_t merge_diff );
+rc_t ref_walker_set_interest( struct ref_walker * self, uint32_t interest );
+rc_t ref_walker_get_interest( struct ref_walker * self, uint32_t * interest );
 
 /* set callbacks */
 rc_t ref_walker_set_callbacks( struct ref_walker * self, ref_walker_callbacks * callbacks );
diff --git a/tools/sra-pileup/ref_walker_0.c b/tools/sra-pileup/ref_walker_0.c
new file mode 100644
index 0000000..d5b3886
--- /dev/null
+++ b/tools/sra-pileup/ref_walker_0.c
@@ -0,0 +1,223 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "ref_walker_0.h"
+
+rc_t CC Quitting( void );
+
+static rc_t walk_placements( walk_data * data, walk_funcs * funcs )
+{
+    rc_t rc;
+    do
+    {
+        rc = ReferenceIteratorNextPlacement ( data->ref_iter, &data->rec );
+        if ( GetRCState( rc ) != rcDone )
+        {
+            if ( rc != 0 )
+            {
+                LOGERR( klogInt, rc, "ReferenceIteratorNextPlacement() failed" );
+            }
+            else
+            {
+                data->state = ReferenceIteratorState ( data->ref_iter, &data->seq_pos );
+                data->xrec = ( tool_rec * ) PlacementRecordCast ( data->rec, placementRecordExtension1 );
+                if ( funcs->on_placement != NULL )
+                    rc = funcs->on_placement( data );
+            }
+        }
+    } while ( rc == 0 );
+    if ( GetRCState( rc ) == rcDone ) { rc = 0; }
+    return rc;
+}
+
+
+static rc_t walk_spot_group( walk_data * data, walk_funcs * funcs )
+{
+    rc_t rc;
+    do
+    {
+        rc = ReferenceIteratorNextSpotGroup ( data->ref_iter, &data->spotgroup, &data->spotgroup_len );
+        if ( GetRCState( rc ) != rcDone )
+        {
+            if ( rc != 0 )
+            {
+                LOGERR( klogInt, rc, "ReferenceIteratorNextPos() failed" );
+            }
+            else
+            {
+                if ( funcs->on_enter_spotgroup != NULL )
+                    rc = funcs->on_enter_spotgroup( data );
+                if ( rc == 0 )
+                    rc = walk_placements( data, funcs );
+                if ( rc == 0 && funcs->on_exit_spotgroup != NULL )
+                    rc = funcs->on_exit_spotgroup( data );
+            }
+        }
+    } while ( rc == 0 );
+    if ( GetRCState( rc ) == rcDone ) { rc = 0; }
+    return rc;
+}
+
+
+static rc_t walk_ref_pos( walk_data * data, walk_funcs * funcs )
+{
+    rc_t rc;
+    do
+    {
+        rc = ReferenceIteratorNextPos ( data->ref_iter, !data->options->no_skip );
+        if ( GetRCState( rc ) != rcDone )
+        {
+            if ( rc != 0 )
+            {
+                LOGERR( klogInt, rc, "ReferenceIteratorNextPos() failed" );
+            }
+            else
+            {
+                rc = ReferenceIteratorPosition ( data->ref_iter, &data->ref_pos, &data->depth, &data->ref_base );
+                if ( rc != 0 )
+                {
+                    LOGERR( klogInt, rc, "ReferenceIteratorPosition() failed" );
+                }
+                else if ( data->depth > 0 )
+                {
+                    bool skip = false;
+
+                    if ( data->options->skiplist != NULL )
+                        skip = skiplist_is_skip_position( data->options->skiplist, data->ref_pos + 1 );
+
+                    if ( !skip )
+                    {
+                        if ( funcs->on_enter_ref_pos != NULL )
+                            rc = funcs->on_enter_ref_pos( data );
+                        if ( rc == 0 )
+                            rc = walk_spot_group( data, funcs );
+                        if ( rc == 0 && funcs->on_exit_ref_pos != NULL )
+                            rc = funcs->on_exit_ref_pos( data );
+                    }
+                }
+            }
+            if ( rc == 0 ) { rc = Quitting(); }
+        }
+    } while ( rc == 0 );
+    if ( GetRCState( rc ) == rcDone ) { rc = 0; }
+    return rc;
+}
+
+
+static rc_t walk_ref_window( walk_data * data, walk_funcs * funcs )
+{
+    rc_t rc;
+    do
+    {
+        rc = ReferenceIteratorNextWindow ( data->ref_iter, &data->ref_window_start, &data->ref_window_len );
+        if ( GetRCState( rc ) != rcDone )
+        {
+            if ( rc != 0 )
+            {
+                LOGERR( klogInt, rc, "ReferenceIteratorNextWindow() failed" );
+            }
+            else
+            {
+                if ( funcs->on_enter_ref_window != NULL )
+                    rc = funcs->on_enter_ref_window( data );
+                if ( rc == 0 )
+                    rc = walk_ref_pos( data, funcs );
+                if ( rc == 0 && funcs->on_exit_ref_window != NULL )
+                    rc = funcs->on_exit_ref_window( data );
+            }
+        }
+    } while ( rc == 0 );
+    if ( GetRCState( rc ) == rcDone ) { rc = 0; }
+    return rc;
+}
+
+
+rc_t walk_0( walk_data * data, walk_funcs * funcs )
+{
+    rc_t rc;
+
+    data->ref_start = 0;
+    data->ref_len = 0;
+    data->ref_name = NULL;
+    data->ref_obj = NULL;
+    data->ref_window_start = 0;
+    data->ref_window_len = 0;
+    data->ref_pos = 0;
+    data->depth = 0;
+    data->ref_base = 0;
+    data->spotgroup = NULL;
+    data->spotgroup_len = 0;
+    data->rec = NULL;
+    data->xrec = NULL;
+    data->state = 0;
+    data->seq_pos = 0;
+
+    do
+    {
+        rc = ReferenceIteratorNextReference( data->ref_iter, &data->ref_start, &data->ref_len, &data->ref_obj );
+        if ( GetRCState( rc ) != rcDone )
+        {
+            if ( rc != 0 )
+            {
+                LOGERR( klogInt, rc, "ReferenceIteratorNextReference() failed" );
+            }
+            else if ( data->ref_obj != NULL )
+            {
+                if ( data->options->use_seq_name )
+                    rc = ReferenceObj_Name( data->ref_obj, &data->ref_name );
+                else
+                    rc = ReferenceObj_SeqId( data->ref_obj, &data->ref_name );
+
+                if ( data->options->skiplist != NULL )
+                    skiplist_enter_ref( data->options->skiplist, data->ref_name );
+
+                if ( rc != 0 )
+                {
+                    if ( data->options->use_seq_name )
+                    {
+                        LOGERR( klogInt, rc, "ReferenceObj_Name() failed" );
+                    }
+                    else
+                    {
+                        LOGERR( klogInt, rc, "ReferenceObj_SeqId() failed" );
+                    }
+                }
+                else
+                {
+                    if ( funcs->on_enter_ref != NULL )
+                        rc = funcs->on_enter_ref( data );
+                    if ( rc == 0 )
+                        rc = walk_ref_window( data, funcs );
+                    if ( rc == 0 && funcs->on_exit_ref != NULL )
+                        rc = funcs->on_exit_ref( data );
+                }
+            }
+        }
+    } while ( rc == 0 );
+    if ( GetRCState( rc ) == rcDone ) { rc = 0; }
+    if ( GetRCState( rc ) == rcCanceled ) { rc = 0; }
+    return rc;
+}
diff --git a/tools/sra-pileup/ref_walker_0.h b/tools/sra-pileup/ref_walker_0.h
new file mode 100644
index 0000000..e7c0253
--- /dev/null
+++ b/tools/sra-pileup/ref_walker_0.h
@@ -0,0 +1,107 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_ref_walker_0_
+#define _h_ref_walker_0_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "pileup_options.h"
+
+#include <insdc/sra.h>
+
+#include <stdlib.h>
+#include <sysalloc.h>
+#include <string.h>
+#include <os-native.h>
+
+typedef struct tool_rec tool_rec;
+struct tool_rec
+{
+    bool reverse;   /* orientation towards reference ( false...in ref-orientation / true...reverse) */
+    int32_t tlen;   /* template-len, for statistical analysis */
+    uint32_t quality_len;
+    uint8_t * quality;  /* ptr to quality... ( for sam-output ) */
+};
+
+
+typedef struct walk_data walk_data;
+struct walk_data
+{
+    void *data;                             /* opaque pointer to data passed to each function */
+    ReferenceIterator *ref_iter;            /* the global reference-iter */
+    pileup_options *options;                /* the tool-options */
+    struct ReferenceObj const * ref_obj;    /* the current reference-object */
+    const char * ref_name;                  /* the name of the current reference */
+    INSDC_coord_zero ref_start;             /* start of the current reference */
+    INSDC_coord_len ref_len;                /* length of the current reference */
+    INSDC_coord_zero ref_window_start;      /* start of the current reference-window */
+    INSDC_coord_len ref_window_len;         /* length of the current reference-window */
+    INSDC_coord_zero ref_pos;               /* current position on the reference */
+    uint32_t depth;                         /* coverage at the current position */
+    INSDC_4na_bin ref_base;                 /* reference-base at the current position */
+    const char * spotgroup;                 /* name of the current spotgroup ( can be NULL! ) */
+    size_t spotgroup_len;                   /* length of the name of the current spotgroup ( can be 0 ) */
+    const PlacementRecord *rec;             /* current placement-record */
+    tool_rec * xrec;                        /* current extended placement-record (orientation, quality...) */
+    int32_t state;                          /* state of the current placement at the current ref-pos ( bitmasked!) */
+    INSDC_coord_zero seq_pos;               /* position inside the alignment at the current ref-pos */
+};
+
+
+typedef struct walk_funcs walk_funcs;
+struct walk_funcs
+{
+    /* changing reference */
+    rc_t ( CC * on_enter_ref ) ( walk_data * data );
+    rc_t ( CC * on_exit_ref ) ( walk_data * data );
+
+    /* changing reference-window */
+    rc_t ( CC * on_enter_ref_window ) ( walk_data * data );
+    rc_t ( CC * on_exit_ref_window ) ( walk_data * data );
+
+    /* changing reference-position */
+    rc_t ( CC * on_enter_ref_pos ) ( walk_data * data );
+    rc_t ( CC * on_exit_ref_pos ) ( walk_data * data );
+
+    /* changing spot-group */
+    rc_t ( CC * on_enter_spotgroup ) ( walk_data * data );
+    rc_t ( CC * on_exit_spotgroup ) ( walk_data * data );
+
+    /* on each alignment */
+    rc_t ( CC * on_placement ) ( walk_data * data );
+};
+
+
+rc_t walk_0( walk_data * data, walk_funcs * funcs );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*  _h_ref_walker_0_ */
diff --git a/tools/sra-pileup/report_deletes.c b/tools/sra-pileup/report_deletes.c
new file mode 100644
index 0000000..3aef209
--- /dev/null
+++ b/tools/sra-pileup/report_deletes.c
@@ -0,0 +1,259 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "report_deletes.h"
+#include "cg_tools.h"
+
+#include <klib/text.h>
+#include <klib/log.h>
+#include <klib/out.h>
+#include <kfs/file.h>
+
+#include <vfs/manager.h>
+#include <vfs/path.h>
+#include <vfs/resolver.h>
+
+#include <kdb/manager.h>
+#include <vdb/manager.h>
+#include <vdb/vdb-priv.h>
+#include <vdb/database.h>
+#include <vdb/table.h>
+#include <vdb/cursor.h>
+
+#include <sysalloc.h>
+#include <stdlib.h>
+
+rc_t CC Quitting ( void );
+
+static rc_t cigar_loop( const VCursor *cur,
+                        uint32_t cigar_idx,
+                        int64_t first,
+                        uint64_t count,
+                        uint32_t min_len )
+{
+    rc_t rc = 0;
+    int64_t row_id, last_row = ( first + count );
+    rna_splice_candidates candidates;
+
+    for ( row_id = first; ( row_id < last_row ) && ( rc == 0 ) && ( Quitting() == 0 ); row_id++ )
+    {
+        const char * cigar;
+        uint32_t row_len;
+        rc = VCursorCellDataDirect ( cur, row_id, cigar_idx, NULL, ( const void ** )&cigar, NULL, &row_len );
+        if ( rc == 0 )
+        {
+            candidates.count = 0;
+            candidates.fwd_matched = 0;
+            candidates.rev_matched = 0;
+
+            rc = discover_rna_splicing_candidates( row_len, cigar, min_len, &candidates );
+            if ( rc == 0 && candidates.count > 0 )
+            {
+                rc = KOutMsg( "%d rna-splice-candidates at row #%ld : %.*s\n", candidates.count, row_id, row_len, cigar );
+            }
+        }
+    }
+    return rc;
+}
+
+
+static rc_t report_deletes_db( const VDBManager *vdb_mgr,
+                               const char * path,
+                               uint32_t min_len )
+{
+    const VDatabase *db;
+    rc_t rc = VDBManagerOpenDBRead( vdb_mgr, &db, NULL, "%s", path );
+    if ( rc != 0 )
+    {
+        (void)PLOGERR( klogErr,
+                 ( klogInt, rc, "cannot open database $(db_name)", "db_name=%s", path ) );
+    }
+    else
+    {
+        const VTable *tab;
+        rc = VDatabaseOpenTableRead( db, &tab, "PRIMARY_ALIGNMENT" );
+        if ( rc != 0 )
+        {
+            (void)LOGERR( klogErr, rc, "cannot open table PRIMARY_ALIGNMENT" );
+        }
+        else
+        {
+            const VCursor *cur;
+            rc = VTableCreateCursorRead( tab, &cur );
+            if ( rc != 0 )
+            {
+                (void)LOGERR( klogErr, rc, "cannot open cursor on table PRIMARY_ALIGNMENT" );
+            }
+            else
+            {
+                uint32_t cigar_idx;
+                rc = VCursorAddColumn( cur, &cigar_idx, "CIGAR_SHORT" );
+                if ( rc != 0 )
+                {
+                    (void)LOGERR( klogErr, rc, "cannot add CIGAR_SHORT to cursor" );
+                }
+                else
+                {
+                    rc = VCursorOpen( cur );
+                    if ( rc != 0 )
+                    {
+                        (void)LOGERR( klogErr, rc, "cannot open cursor" );
+                    }
+                    else
+                    {
+                        int64_t first;
+                        uint64_t count;
+                        rc = VCursorIdRange ( cur, cigar_idx, &first, &count );
+                        if ( rc != 0 )
+                        {
+                            (void)LOGERR( klogErr, rc, "cannot detect row-range" );
+                        }
+                        else
+                        {
+                            rc = cigar_loop( cur, cigar_idx, first, count, min_len );
+                        }
+                    }
+                }
+                VCursorRelease( cur );
+            }
+            VTableRelease( tab );
+        }
+        VDatabaseRelease( db );
+    }
+    return rc;
+}
+
+
+static rc_t report_deletes_spec( const VDBManager *vdb_mgr,
+                                 VFSManager * vfs_mgr,
+                                 const char * spec,
+                                 uint32_t min_len )
+{
+    rc_t rc = KOutMsg( "\nreporting deletes of '%s'\n", spec );
+    if ( rc == 0 )
+    {
+        VPath * path = NULL;
+        const VPath * local_cache = NULL;
+        const KFile * remote_file = NULL;
+        rc = VFSManagerResolveSpec ( vfs_mgr, spec, &path, &remote_file, &local_cache, true );
+        if ( rc != 0 )
+        {
+            (void)LOGERR( klogErr, rc, "cannot resolve spec via VFSManager" );
+        }
+        else
+        {
+            char buffer[ 4096 ];
+            size_t num_read;
+            rc = VPathReadPath ( path, buffer, sizeof buffer, &num_read );
+            if ( rc != 0 )
+            {
+                (void)LOGERR( klogErr, rc, "cannot read path from vpath" );
+            }
+            else
+            {
+                int path_type = ( VDBManagerPathType ( vdb_mgr, "%s", buffer ) & ~ kptAlias );
+                switch( path_type )
+                {
+                    case kptDatabase : rc = report_deletes_db( vdb_mgr, buffer, min_len ); break;
+
+                    case kptTable    : KOutMsg( "cannot report deletes on a table-object\n" );
+                                        rc = RC ( rcApp, rcNoTarg, rcAccessing, rcParam, rcInvalid );
+                                        (void)LOGERR( klogErr, rc, "cannot report references on a table-object" );
+                                       break;
+
+                    default          : KOutMsg( "the given object is not a vdb-database\n" );
+                                        rc = RC ( rcApp, rcNoTarg, rcAccessing, rcParam, rcInvalid );
+                                        (void)LOGERR( klogErr, rc, "the given object is not a vdb-database" );
+                                       break;
+                }
+            }
+            KFileRelease( remote_file );
+            VPathRelease ( local_cache );
+            VPathRelease ( path );
+        }
+    }
+    return rc;
+
+}
+
+
+rc_t report_deletes( Args * args, uint32_t min_len )
+{
+    uint32_t count;
+    rc_t rc = ArgsParamCount( args, &count );
+    if ( rc != 0 )
+    {
+        LOGERR( klogInt, rc, "ArgsParamCount() failed" );
+    }
+    else
+    {
+        KDirectory *dir; 
+        rc = KDirectoryNativeDir( &dir );
+        if ( rc != 0 )
+        {
+            LOGERR( klogInt, rc, "KDirectoryNativeDir() failed" );
+        }
+        else
+        {
+            const VDBManager *vdb_mgr;
+            rc = VDBManagerMakeRead ( &vdb_mgr, dir );
+            if ( rc != 0 )
+            {
+                LOGERR( klogInt, rc, "VDBManagerMakeRead() failed" );
+            }
+            else
+            {
+                VFSManager * vfs_mgr;
+                rc =  VFSManagerMake ( &vfs_mgr );
+                if ( rc != 0 )
+                {
+                    (void)LOGERR( klogErr, rc, "cannot make vfs-manager" );
+                }
+                else
+                {
+                    uint32_t idx;
+                    for ( idx = 0; idx < count && rc == 0; ++idx )
+                    {
+                        const char *param = NULL;
+                        rc = ArgsParamValue( args, idx, &param );
+                        if ( rc != 0 )
+                        {
+                            LOGERR( klogInt, rc, "ArgsParamvalue() failed" );
+                        }
+                        else
+                        {
+                            rc = report_deletes_spec( vdb_mgr, vfs_mgr, param, min_len );
+                        }
+                    }
+                    VFSManagerRelease ( vfs_mgr );
+                }
+                VDBManagerRelease( vdb_mgr );
+            }
+            KDirectoryRelease( dir );
+        }
+    }
+    return rc;
+}
diff --git a/tools/sra-pileup/report_deletes.h b/tools/sra-pileup/report_deletes.h
new file mode 100644
index 0000000..9cc12ac
--- /dev/null
+++ b/tools/sra-pileup/report_deletes.h
@@ -0,0 +1,41 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+#ifndef _h_report_deletes_
+#define _h_report_deletes_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+#include <kapp/args.h>
+#include <klib/rc.h>
+
+rc_t report_deletes( Args * args, uint32_t min_len );
+
+#endif
diff --git a/tools/sra-pileup/reref.c b/tools/sra-pileup/reref.c
index a3eb225..5dd034b 100644
--- a/tools/sra-pileup/reref.c
+++ b/tools/sra-pileup/reref.c
@@ -438,10 +438,14 @@ static rc_t report_references( const VDBManager *vdb_mgr, VFSManager * vfs_mgr,
                         case kptDatabase : rc = report_ref_database( vdb_mgr, vfs_mgr, buffer, extended );
                                            break;
 
-                        case kptTable    : rc = KOutMsg( "cannot report references on a table-object\n" );
+                        case kptTable    : KOutMsg( "cannot report references on a table-object\n" );
+                                            rc = RC ( rcApp, rcNoTarg, rcAccessing, rcParam, rcInvalid );
+                                            (void)LOGERR( klogErr, rc, "cannot report references on a table-object" );
                                            break;
 
-                        default          : rc = KOutMsg( "the given object is not a vdb-database\n" );
+                        default          : KOutMsg( "the given object is not a vdb-database\n" );
+                                            rc = RC ( rcApp, rcNoTarg, rcAccessing, rcParam, rcInvalid );
+                                            (void)LOGERR( klogErr, rc, "the given object is not a vdb-database" );
                                            break;
                     }
                 }
@@ -500,8 +504,7 @@ rc_t report_on_reference( Args * args, bool extended )
                         }
                         else
                         {
-                            /* rc value not used, because it can be something that has no references */
-                            report_references( vdb_mgr, vfs_mgr, param, extended );
+                            rc = report_references( vdb_mgr, vfs_mgr, param, extended );
                         }
                     }
                     VFSManagerRelease ( vfs_mgr );
diff --git a/tools/sra-pileup/rna_splice_log.c b/tools/sra-pileup/rna_splice_log.c
new file mode 100644
index 0000000..ba26440
--- /dev/null
+++ b/tools/sra-pileup/rna_splice_log.c
@@ -0,0 +1,374 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <klib/rc.h>
+#include <klib/printf.h>
+#include <klib/vector.h>
+
+#include <kfs/directory.h>
+#include <kfs/file.h>
+
+#include <string.h>
+
+#include "rna_splice_log.h"
+
+typedef struct rna_splice_dict rna_splice_dict;
+struct rna_splice_dict
+{
+    KVector * v;
+};
+
+
+struct rna_splice_dict * make_rna_splice_dict( void )
+{
+    struct rna_splice_dict * res = NULL;
+    KVector * v;
+    rc_t rc = KVectorMake ( &v );
+    if ( rc == 0 )
+    {
+        res = calloc( 1, sizeof * res );
+        if ( res != NULL )
+        {
+            res->v = v;
+        }
+        else
+        {
+            KVectorRelease ( v );
+        }
+    }
+    return res;
+}
+
+
+void free_rna_splice_dict( struct rna_splice_dict * dict )
+{
+    if ( dict != NULL )
+    {
+        KVectorRelease ( dict->v );
+        free( dict );
+    }
+}
+
+
+typedef struct splice_dict_key splice_dict_key;
+struct splice_dict_key
+{
+    uint32_t len;
+    uint32_t pos;
+};
+
+union dict_key_union
+{
+    uint64_t key;
+    splice_dict_key key_struct;
+};
+
+union dict_value_union
+{
+    uint64_t value;
+    splice_dict_entry entry;
+};
+
+
+bool rna_splice_dict_get( struct rna_splice_dict * dict,
+                          uint32_t pos, uint32_t len, splice_dict_entry * entry )
+{
+    bool res = false;
+    if ( dict != NULL )
+    {
+        rc_t rc;
+        union dict_key_union ku;
+        union dict_value_union vu;
+
+        ku.key_struct.pos = pos;
+        ku.key_struct.len = len;
+        rc = KVectorGetU64 ( dict->v, ku.key, &(vu.value) );
+        res = ( rc == 0 );
+        if ( res && entry != NULL )
+        {
+            entry->count = vu.entry.count;
+            entry->intron_type = vu.entry.intron_type;
+        }
+    }
+    return res;
+}
+
+
+void rna_splice_dict_set( struct rna_splice_dict * dict,
+                          uint32_t pos, uint32_t len, const splice_dict_entry * entry )
+{
+    if ( dict != NULL && entry != NULL )
+    {
+        union dict_key_union ku;
+        union dict_value_union vu;
+
+        ku.key_struct.pos = pos;
+        ku.key_struct.len = len;
+        vu.entry.count = entry->count;
+        vu.entry.intron_type = entry->intron_type;
+        KVectorSetU64 ( dict->v, ku.key, vu.value );
+    }
+}
+
+
+/* --------------------------------------------------------------------------- */
+
+
+typedef struct rna_splice_log rna_splice_log;
+struct rna_splice_log
+{
+    KFile * log_file;
+    const char * tool_name;
+    struct ReferenceObj const * ref_obj;
+
+    char ref_name[ 1024 ];
+    uint64_t log_file_pos;
+};
+
+
+struct rna_splice_log * make_rna_splice_log( const char * filename, const char * toolname )
+{
+    struct rna_splice_log * res = NULL;
+    KDirectory * dir;
+    rc_t rc = KDirectoryNativeDir ( &dir );
+    if ( rc == 0 )
+    {
+        KFile * f;
+        rc = KDirectoryCreateFile ( dir, &f, false, 0664, kcmInit, "%s", filename );
+        if ( rc == 0 )
+        {
+            res = calloc( 1, sizeof * res );
+            if ( res != NULL )
+            {
+                res->log_file = f;
+                if ( toolname != NULL )
+                    res->tool_name = string_dup_measure ( toolname, NULL );
+            }
+            else
+                KFileRelease ( f );
+        }
+        KDirectoryRelease ( dir );
+    }
+    return res;
+}
+
+
+void free_rna_splice_log( struct rna_splice_log * sl )
+{
+    if ( sl != NULL )
+    {
+        KFileRelease ( sl->log_file );
+        if ( sl->tool_name != NULL ) free( ( void * )sl->tool_name );
+        free( ( void * ) sl );
+    }
+}
+
+
+void rna_splice_log_enter_ref( struct rna_splice_log * sl,
+                               const char * ref_name,
+                               struct ReferenceObj const * ref_obj )
+{
+    if ( sl != NULL )
+    {
+        if ( ref_name != NULL )
+            string_copy_measure ( sl->ref_name, sizeof( sl->ref_name ), ref_name );
+        else
+            sl->ref_name[ 0 ] = 0;
+
+        sl->ref_obj = ref_obj;
+    }
+}
+
+
+static void copy_read_and_reverse_complement( uint8_t * dst, const uint8_t * const src, INSDC_coord_len const count )
+{
+    static char const compl[] = {
+         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
+         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
+         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
+         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
+         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
+         0 ,  0 ,  0 ,  0 ,  0 ,  0 , '.',  0 , 
+        '0', '1', '2', '3',  0 ,  0 ,  0 ,  0 , 
+         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
+         0 , 'T', 'V', 'G', 'H',  0 ,  0 , 'C', 
+        'D',  0 ,  0 , 'M',  0 , 'K', 'N',  0 , 
+         0 ,  0 , 'Y', 'S', 'A', 'A', 'B', 'W', 
+         0 , 'R',  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
+         0 , 'T', 'V', 'G', 'H',  0 ,  0 , 'C', 
+        'D',  0 ,  0 , 'M',  0 , 'K', 'N',  0 , 
+         0 ,  0 , 'Y', 'S', 'A', 'A', 'B', 'W', 
+         0 , 'R',  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
+         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
+         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
+         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
+         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
+         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
+         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
+         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
+         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
+         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
+         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
+         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
+         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
+         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
+         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
+         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , 
+         0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  0
+    };
+
+    INSDC_coord_len i, j;
+    
+    for ( i = 0, j = count - 1; i != count; ++i, --j )
+    {
+        dst[ i ] = compl[ src[ j ] ];
+    }
+}
+
+
+#define PRE_POST_LEN 10
+#define EDGE_LEN ( ( PRE_POST_LEN * 2 ) + 2 )
+
+
+static rc_t write_to_file( struct rna_splice_log * sl, const uint8_t * src, size_t len )
+{
+    size_t num_writ;
+    rc_t rc = KFileWriteAll( sl->log_file, sl->log_file_pos, src, len, &num_writ );
+    if ( rc == 0 )
+        sl->log_file_pos += num_writ;
+    return rc;
+}
+
+static rc_t print_edge( struct rna_splice_log * sl,
+                        INSDC_coord_zero pos,
+                        bool const reverse_complement,
+                        bool const add_newline )
+{
+    rc_t rc;
+    INSDC_coord_len from_ref_obj, to_read;
+    uint8_t buffer[ EDGE_LEN + 1 ];
+    INSDC_coord_zero rd_pos = 0;
+    uint32_t pre_len = PRE_POST_LEN;
+    uint32_t post_len = PRE_POST_LEN;
+
+    if ( pos >= PRE_POST_LEN )
+        rd_pos = ( pos - PRE_POST_LEN ); /* in the rare case the delete is at the very beginning of the alignment */
+    else
+        pre_len = pos; /* rd_pos is still 0, what we want*/
+
+    to_read = pre_len + post_len + 2;
+    rc = ReferenceObj_Read( sl->ref_obj, rd_pos, to_read, buffer, &from_ref_obj );
+    if ( rc == 0 )
+    {
+        uint8_t complement[ EDGE_LEN + 1 ];
+        uint8_t to_write[ EDGE_LEN + 5 ];
+        uint8_t * ref_bytes = buffer;
+
+        if ( from_ref_obj < to_read )
+            post_len -= ( to_read - from_ref_obj );
+
+        if ( reverse_complement )
+        {
+            copy_read_and_reverse_complement( complement, buffer, from_ref_obj );
+            ref_bytes = complement;
+        }
+        memcpy( to_write, ref_bytes, pre_len );
+        to_write[ pre_len ] = '\t';
+        to_write[ pre_len + 1 ] = ref_bytes[ pre_len ];
+        to_write[ pre_len + 2 ] = ref_bytes[ pre_len + 1 ];
+        to_write[ pre_len + 3 ] = '\t';
+        memcpy( &( to_write[ pre_len + 4 ] ), &( ref_bytes[ pre_len + 2 ] ), post_len );
+
+        if ( add_newline )
+            to_write[ pre_len + post_len + 4 ] = '\n';
+        else
+            to_write[ pre_len + post_len + 4 ] = '\t';
+
+        rc = write_to_file( sl, to_write, pre_len + post_len + 5 );
+    }
+    return rc;
+}
+
+
+/*
+#define INTRON_UNKNOWN 0
+#define INTRON_FWD 1
+#define INTRON_REV 2
+*/
+
+static const char intron_type_to_ascii[] = { 'u', '+', '-', 'u' };
+
+static rc_t CC on_dict_key_value( uint64_t key, uint64_t value, void * user_data )
+{
+    rc_t rc = 0;
+    struct rna_splice_log * sl = ( struct rna_splice_log * )user_data;
+    if ( sl != NULL )
+    {
+        char tmp[ 512 ];
+        size_t num_writ;
+        union dict_key_union ku;
+        union dict_value_union vu;
+        char intron;
+        bool reverse_complement;
+
+        ku.key = key;
+        vu.value = value;
+        intron = intron_type_to_ascii[ vu.entry.intron_type & 0x03 ];
+        reverse_complement = ( ( vu.entry.intron_type & 0x03 ) == INTRON_REV );
+
+        rc = string_printf ( tmp, sizeof tmp, &num_writ,
+                             "%s\t%u\t%u\t%u\t%c\t",
+                             sl->ref_name, ku.key_struct.pos + 1, ku.key_struct.len, vu.entry.count, intron );
+        if ( rc == 0 )
+            rc = write_to_file( sl, ( uint8_t * )tmp, num_writ );
+
+        if ( reverse_complement )
+        {
+            if ( rc == 0 )
+                rc = print_edge( sl, ku.key_struct.pos + ku.key_struct.len - 2, true, false );
+            if ( rc == 0 )
+                rc = print_edge( sl, ku.key_struct.pos, true, true );
+        }
+        else
+        {
+            if ( rc == 0 )
+                rc = print_edge( sl, ku.key_struct.pos, false, false );
+            if ( rc == 0 )
+                rc = print_edge( sl, ku.key_struct.pos + ku.key_struct.len - 2, false, true );
+        }
+    }
+    return rc;
+}
+
+
+void rna_splice_log_exit_ref( struct rna_splice_log * sl, struct rna_splice_dict * dict )
+{
+    if ( sl != NULL && dict != NULL )
+    {
+        KVectorVisitU64 ( dict->v, false, on_dict_key_value, sl );
+    }
+}
+
diff --git a/tools/sra-pileup/rna_splice_log.h b/tools/sra-pileup/rna_splice_log.h
new file mode 100644
index 0000000..feb98eb
--- /dev/null
+++ b/tools/sra-pileup/rna_splice_log.h
@@ -0,0 +1,87 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_rna_splice_log_
+#define _h_rna_splice_log_
+
+#include <insdc/insdc.h>
+#include <align/reference.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define INTRON_UNKNOWN 0
+#define INTRON_FWD 1
+#define INTRON_REV 2
+
+typedef struct splice_dict_entry splice_dict_entry;
+struct splice_dict_entry
+{
+    uint32_t count;
+    uint32_t intron_type;
+};
+
+struct rna_splice_dict;
+
+struct rna_splice_dict * make_rna_splice_dict( void );
+
+void free_rna_splice_dict( struct rna_splice_dict * dict );
+
+bool rna_splice_dict_get( struct rna_splice_dict * dict,
+                          uint32_t pos,
+                          uint32_t len,
+                          splice_dict_entry * entry );
+
+void rna_splice_dict_set( struct rna_splice_dict * dict,
+                          uint32_t pos,
+                          uint32_t len,
+                          const splice_dict_entry * entry );
+
+/* --------------------------------------------------------------------------- */
+
+
+struct rna_splice_log;
+
+struct rna_splice_log * make_rna_splice_log( const char * filename,
+                                             const char * toolname );
+
+void free_rna_splice_log( struct rna_splice_log * sl );
+
+void rna_splice_log_enter_ref( struct rna_splice_log * sl,
+                               const char * ref_name,
+                               struct ReferenceObj const * ref_obj );
+
+void rna_splice_log_exit_ref( struct rna_splice_log * sl,
+                              struct rna_splice_dict * dict );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*  _h_rna_splice_log_ */
diff --git a/tools/sra-pileup/sam-aligned.c b/tools/sra-pileup/sam-aligned.c
index c1b878a..cda6494 100644
--- a/tools/sra-pileup/sam-aligned.c
+++ b/tools/sra-pileup/sam-aligned.c
@@ -1,2134 +1,2296 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-
-#include <align/manager.h>
-#include <align/iterator.h>
-#include <kapp/main.h>
-#include <sysalloc.h>
-
-#include "read_fkt.h"
-#include "cg_tools.h"
-#include "sam-aligned.h"
-
-const char * PRIM_TABLE = "PRIMARY_ALIGNMENT";
-const char * SEC_TABLE = "SECONDARY_ALIGNMENT";
-const char * EV_INT_TABLE = "EVIDENCE_INTERVAL";
-const char * EV_AL_TABLE = "EVIDENCE_ALIGNMENT";
-
-
-/* -------------------------------------------------------------------------------------------
-    column                      PRIM    SEC     EV_INT      EV_ALIGN ( outside of iterator )
-
-    SEQ_SPOT_ID                 X       X       -           X
-    SAM_FLAGS                   X       X       -           -
-    CIGAR_LONG                  X       X       X           X 
-    CIGAR_SHORT                 X       X       X           X
-    CIGAR_LONG_LEN              X       X       X           X 
-    CIGAR_SHORT_LEN             X       X       X           X
-    MATE_ALIGN_ID               X       X       -           -
-    MATE_REF_NAME               X       X       -           -
-    MATE_REF_POS                X       X       -           -
-    TEMPLATE_LEN                X       X       -           -
-    READ                        X       X       X           X
-    READ_LEN                    X       X       X           X
-    MISMATCH_READ               X       X       X           X
-    SAM_QUALITY                 X       X       X           X
-    REF_ORIENTATION             X       X       X           X
-    EDIT_DISTANCE               X       X       X           X
-    SEQ_SPOT_GROUP              X       X       -           X
-    SEQ_READ_ID                 X       X       -           X
-    RAW_READ                    X       X       X           X
-    READ_FILTER                 X       X       X           X
-    EVIDENCE_ALIGNMENT_IDS      -       -       X           -
-    REF_POS                                                 o
-    REF_PLOIDY                                              o
-    ALIGNMENT_COUNT             X       X       -           X
-    SEQ_NAME                                                X
-    MAPQ                                                    X
-    ALIGN_GROUP                 X       -       -           -
-    
-   -------------------------------------------------------------------------------------------*/
-
-
-#define COL_NOT_AVAILABLE 0xFFFFFFFF
-
-#define COL_SEQ_SPOT_ID "(I64)SEQ_SPOT_ID"
-#define COL_SAM_FLAGS "(U32)SAM_FLAGS"
-#define COL_LONG_CIGAR "(ascii)CIGAR_LONG"
-#define COL_SHORT_CIGAR "(ascii)CIGAR_SHORT"
-#define COL_MATE_ALIGN_ID "(I64)MATE_ALIGN_ID"
-#define COL_MATE_REF_NAME "(ascii)MATE_REF_NAME"
-#define COL_MATE_REF_POS "(INSDC:coord:zero)MATE_REF_POS"
-#define COL_TEMPLATE_LEN "(I32)TEMPLATE_LEN"
-#define COL_MISMATCH_READ "(ascii)MISMATCH_READ"
-#define COL_SAM_QUALITY "(INSDC:quality:text:phred_33)SAM_QUALITY"
-#define COL_REF_ORIENTATION "(bool)REF_ORIENTATION"
-#define COL_EDIT_DIST "(U32)EDIT_DISTANCE"
-#define COL_SEQ_SPOT_GROUP "(ascii)SEQ_SPOT_GROUP"
-#define COL_SEQ_READ_ID "(INSDC:coord:one)SEQ_READ_ID"
-#define COL_RAW_READ "(INSDC:dna:text)RAW_READ"
-#define COL_PLOIDY "(NCBI:align:ploidy)PLOIDY"
-#define COL_CIGAR_LONG_LEN "(INSDC:coord:len)CIGAR_LONG_LEN"
-#define COL_CIGAR_SHORT_LEN "(INSDC:coord:len)CIGAR_SHORT_LEN"
-#define COL_READ_LEN "(INSDC:coord:len)READ_LEN"
-#define COL_EV_ALIGNMENTS "(I64)EVIDENCE_ALIGNMENT_IDS"
-#define COL_REF_POS "(INSDC:coord:zero)REF_POS"
-#define COL_REF_PLOIDY "(U32)REF_PLOIDY"
-#define COL_READ_FILTER "(INSDC:SRA:read_filter)READ_FILTER"
-#define COL_AL_COUNT "(U8)ALIGNMENT_COUNT"
-#define COL_SEQ_NAME "(ascii)SEQ_NAME"
-#define COL_MAPQ "(I32)MAPQ"
-#define COL_ALIGN_GROUP "(ascii)ALIGN_GROUP"
-
-enum align_table_type
-{
-    att_primary = 0,
-    att_secondary,
-    att_evidence
-};
-
-
-/* the part common to prim/sec/ev-alignment */
-typedef struct align_cmn_context
-{
-    const VCursor * cursor;
-
-    uint32_t seq_spot_id_idx;
-    uint32_t cigar_idx;
-    uint32_t cigar_len_idx;
-    uint32_t read_idx;
-    uint32_t read_len_idx;
-    uint32_t edit_dist_idx;
-    uint32_t seq_spot_group_idx;
-    uint32_t seq_read_id_idx;
-    uint32_t raw_read_idx;
-    uint32_t sam_quality_idx;
-    uint32_t ref_orientation_idx;
-    uint32_t read_filter_idx;
-    uint32_t al_count_idx;
-} align_cmn_context;
-
-
-typedef struct align_table_context
-{
-    CigOps * cig_op_buffer;
-    uint32_t cig_op_buffer_len;
-
-    /* which Reference-Obj in the ReferenceList we are aligning against... */
-    const ReferenceObj* ref_obj;
-    uint32_t ref_idx;
-
-    /* which index into the input-files object / needed to distinguish cache entries with the same number
-       but comming from different input-files */
-    uint32_t db_idx;
-
-    /* objects of which table are we aligning PRIM/SEC/EV ? */
-    enum align_table_type align_table_type;
-
-    /* the part common to prim/sec/ev-alignment */
-    align_cmn_context cmn;
-
-    /* this is specific to pim/sec */
-    uint32_t sam_flags_idx;
-    uint32_t mate_align_id_idx;
-    uint32_t mate_ref_name_idx;
-    uint32_t mate_ref_pos_idx;
-    uint32_t tlen_idx;
-
-    /* this is only in prim */
-    uint32_t al_group_idx;
-    
-    /* this is specific to ev-interval/ev-alignmnet */
-    uint32_t ploidy_idx;
-    uint32_t ev_alignments_idx;
-    uint32_t ref_pos_idx;
-    uint32_t ref_ploidy_idx;
-    uint32_t seq_name_idx;
-    uint32_t mapq_idx;
-
-    /* the common part repeats for evidence-alignment */
-    align_cmn_context eval;
-} align_table_context;
-
-
-static void invalidate_all_cmn_column_idx( align_cmn_context * const actx )
-{
-    actx->seq_spot_id_idx       = COL_NOT_AVAILABLE;
-    actx->cigar_idx             = COL_NOT_AVAILABLE;    
-    actx->cigar_len_idx         = COL_NOT_AVAILABLE;
-    actx->read_idx              = COL_NOT_AVAILABLE;
-    actx->read_len_idx          = COL_NOT_AVAILABLE;    
-    actx->edit_dist_idx         = COL_NOT_AVAILABLE;
-    actx->seq_spot_group_idx    = COL_NOT_AVAILABLE;
-    actx->seq_read_id_idx       = COL_NOT_AVAILABLE;
-    actx->raw_read_idx          = COL_NOT_AVAILABLE;
-    actx->sam_quality_idx       = COL_NOT_AVAILABLE;
-    actx->ref_orientation_idx   = COL_NOT_AVAILABLE;
-    actx->read_filter_idx       = COL_NOT_AVAILABLE;
-    actx->al_count_idx          = COL_NOT_AVAILABLE;
-}
-
-static void invalidate_all_column_idx( align_table_context * const atx )
-{
-    atx->sam_flags_idx      = COL_NOT_AVAILABLE;
-    atx->mate_align_id_idx  = COL_NOT_AVAILABLE;
-    atx->mate_ref_name_idx  = COL_NOT_AVAILABLE;
-    atx->mate_ref_pos_idx   = COL_NOT_AVAILABLE;
-    atx->tlen_idx           = COL_NOT_AVAILABLE;
-    atx->ploidy_idx         = COL_NOT_AVAILABLE;
-    atx->ev_alignments_idx  = COL_NOT_AVAILABLE;
-    atx->ref_pos_idx        = COL_NOT_AVAILABLE;
-    atx->ref_ploidy_idx     = COL_NOT_AVAILABLE;
-    atx->seq_name_idx       = COL_NOT_AVAILABLE;
-    atx->mapq_idx           = COL_NOT_AVAILABLE;
-    atx->al_group_idx       = COL_NOT_AVAILABLE;
-    invalidate_all_cmn_column_idx( &atx->cmn );
-    invalidate_all_cmn_column_idx( &atx->eval );
-}
-
-
-static void init_align_table_context( align_table_context * const atx, const uint32_t db_idx, const ReferenceObj* ref_obj )
-{
-    atx->db_idx = db_idx;
-    atx->ref_obj = ref_obj;
-    atx->cig_op_buffer = NULL;
-    atx->cig_op_buffer_len = 0;
-    invalidate_all_column_idx( atx );
-}
-
-
-static void free_align_table_context( align_table_context * atx )
-{
-    if ( atx != NULL )
-    {
-        if ( atx->cig_op_buffer != NULL )
-            free( atx->cig_op_buffer );
-
-        VCursorRelease( atx->cmn.cursor );
-        VCursorRelease( atx->eval.cursor );
-        free( atx );
-    }
-}
-
-
-static rc_t adjust_align_table_context_cig_op_buffer( align_table_context * atx, uint32_t read_len )
-{
-    rc_t rc = 0;
-
-    uint32_t reqested = ( read_len * 3 );
-    if ( reqested < 1024 ) reqested = 1024;
-
-    if ( atx->cig_op_buffer_len < reqested )
-    {
-        void * org_buffer = NULL;
-
-        if ( atx->cig_op_buffer == NULL )
-            atx->cig_op_buffer = malloc( reqested );
-        else
-        {
-            org_buffer = atx->cig_op_buffer;
-            atx->cig_op_buffer = realloc( org_buffer, reqested );
-        }
-
-        if ( atx->cig_op_buffer == NULL )
-        {
-            rc = RC( rcExe, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
-            (void)LOGERR( klogInt, rc, "cigar-op-buffer-allocation failed" );
-            if ( org_buffer != NULL )
-                free( org_buffer );
-        }
-        else
-        {
-            atx->cig_op_buffer_len = reqested;
-        }
-    }
-
-    return rc;
-}
-
-
-/* src: 'P'rimary, 'S'econdary, Evidence_'I'nterval, Evidence_'A'lignment */
-static rc_t prepare_cmn_table_rows( const samdump_opts * const opts, const VTable *tbl,
-                                    align_cmn_context * const cmn, char src,
-                                    struct KNamelist * available_columns )
-{
-    rc_t rc = 0;
-    const VCursor * cursor = cmn->cursor;
-
-    if ( src == 'P' || src == 'S' )
-        rc = add_column( cursor, COL_SEQ_SPOT_ID, &cmn->seq_spot_id_idx );
-
-    if ( rc == 0 )
-    {
-        if ( opts->use_long_cigar )
-        {
-            rc = add_column( cursor, COL_LONG_CIGAR, &cmn->cigar_idx );
-            if ( rc == 0 && ( src == 'I' || src == 'A' ) )
-                rc = add_column( cursor, COL_CIGAR_LONG_LEN, &cmn->cigar_len_idx );
-        }
-        else
-        {
-            rc = add_column( cursor, COL_SHORT_CIGAR, &cmn->cigar_idx );
-            if ( rc == 0 && ( src == 'I' || src == 'A' ) )
-                rc = add_column( cursor, COL_CIGAR_SHORT_LEN, &cmn->cigar_len_idx );
-        }
-    }
-
-    if ( rc == 0 )
-    {
-        if ( opts->print_matches_as_equal_sign )
-            rc = add_column( cursor, COL_MISMATCH_READ, &cmn->read_idx );
-        else
-            rc = add_column( cursor, COL_READ, &cmn->read_idx );
-    }
-
-    if ( rc == 0 )
-        rc = add_column( cursor, COL_READ_LEN, &cmn->read_len_idx );
-
-    if ( rc == 0 )
-        rc = add_column( cursor, COL_SAM_QUALITY, &cmn->sam_quality_idx );
-
-    if ( rc == 0 )
-        rc = add_column( cursor, COL_REF_ORIENTATION, &cmn->ref_orientation_idx );
-
-    if ( rc == 0 )
-        rc = add_column( cursor, COL_EDIT_DIST, &cmn->edit_dist_idx );
-
-    if ( rc == 0 && ( src == 'P' || src == 'S' || src == 'A' ) )
-        rc = add_column( cursor, COL_SEQ_SPOT_GROUP, &cmn->seq_spot_group_idx );
-
-    if ( rc == 0 && ( src == 'P' || src == 'S' || src == 'A' ) )
-        rc = add_column( cursor, COL_SEQ_READ_ID, &cmn->seq_read_id_idx );
-
-    if ( rc == 0 )
-        rc = add_column( cursor, COL_RAW_READ, &cmn->raw_read_idx );
-
-    if ( rc == 0 )
-        rc = add_column( cursor, COL_READ_FILTER, &cmn->read_filter_idx );
-
-    if ( rc == 0 && ( src == 'P' || src == 'S' || src == 'A' ) )
-        add_opt_column( cursor, available_columns, COL_AL_COUNT, &cmn->al_count_idx );
-
-    return rc;
-}
-
-
-static rc_t prepare_prim_sec_table_cursor( const samdump_opts * const opts, const VDatabase * db,
-                                           const char * table_name, align_table_context * const atx )
-{
-    const VTable *tbl;
-    rc_t rc = VDatabaseOpenTableRead( db, &tbl, table_name );
-    if ( rc != 0 )
-    {
-        (void)PLOGERR( klogInt, ( klogInt, rc, "VDatabaseOpenTableRead( $(tn) ) failed", "tn=%s", table_name ) );
-    }
-    else
-    {
-        if ( opts->cursor_cache_size == 0 )
-            rc = VTableCreateCursorRead( tbl, &atx->cmn.cursor );
-        else
-            rc = VTableCreateCachedCursorRead( tbl, &atx->cmn.cursor, opts->cursor_cache_size );
-        if ( rc != 0 )
-        {
-            (void)PLOGERR( klogInt, ( klogInt, rc, "VTableCreateCursorRead( $(tn) ) failed", "tn=%s", table_name ) );
-        }
-        else
-        {
-            struct KNamelist * available_columns;
-            char table_char = 'P';
-            const VCursor * cursor = atx->cmn.cursor;
-            
-            if ( cmp_pchar( table_name, "SECONDARY_ALIGNMENT" ) == 0 )
-                table_char = 'S';
-            
-            rc = VTableListReadableColumns ( tbl, &available_columns );
-            if ( rc != 0 )
-            {
-                (void)PLOGERR( klogInt, ( klogInt, rc, 
-                    "VTableListReadableColumns( $(src) ) failed", "src=%c", table_char ) );
-            }
-            else
-            {
-                rc = prepare_cmn_table_rows( opts, tbl, &atx->cmn, table_char, available_columns );
-
-                if ( rc == 0 )
-                    rc = add_column( cursor, COL_SAM_FLAGS, &atx->sam_flags_idx );
-
-                /*  i don't have to add REF_NAME or REF_SEQ_ID, because i have it from the ref_obj later
-                    i don't have to add REF_POS, because i have it from the iterator later
-                    i don't have to add MAPQ, it is in the PlacementRecord later
-                        ... when walking the iterator ...
-                */
-                if ( rc == 0 )
-                    rc = add_column( cursor, COL_MATE_ALIGN_ID, &atx->mate_align_id_idx );
-                if ( rc == 0 )
-                    rc = add_column( cursor, COL_MATE_REF_NAME, &atx->mate_ref_name_idx );
-                if ( rc == 0 )
-                    rc = add_column( cursor, COL_MATE_REF_POS, &atx->mate_ref_pos_idx );
-                if ( rc == 0 )
-                    rc = add_column( cursor, COL_TEMPLATE_LEN, &atx->tlen_idx );
-
-                if ( rc == 0 && ( table_char == 'P' ) )
-                    add_opt_column( cursor, available_columns, COL_ALIGN_GROUP, &atx->al_group_idx );
-                    
-                KNamelistRelease( available_columns );
-            }
-            if ( rc != 0 )
-                VCursorRelease( cursor );
-        }
-        VTableRelease ( tbl ); /* the cursor keeps the table alive */
-    }
-    return rc;
-}
-
-
-static rc_t prepare_sub_ev_alignment_table_cursor( const samdump_opts * const opts, const VDatabase * db,
-                                                   align_table_context * const atx )
-{
-    rc_t rc = add_column( atx->cmn.cursor, COL_EV_ALIGNMENTS, &atx->ev_alignments_idx );
-    if ( rc == 0 )
-    {
-        const VTable *evidence_alignment_tbl;
-        rc = VDatabaseOpenTableRead( db, &evidence_alignment_tbl, EV_AL_TABLE );
-        if ( rc != 0 )
-        {
-            (void)PLOGERR( klogInt, ( klogInt, rc, "VDatabaseOpenTableRead( $(tn) ) failed", "tn=%s", EV_AL_TABLE ) );
-        }
-        else
-        {
-            if ( opts->cursor_cache_size == 0 )
-                rc = VTableCreateCursorRead( evidence_alignment_tbl, &atx->eval.cursor );
-            else
-                rc = VTableCreateCachedCursorRead( evidence_alignment_tbl, &atx->eval.cursor, opts->cursor_cache_size );
-            if ( rc != 0 )
-            {
-                (void)PLOGERR( klogInt, ( klogInt, rc, "VTableCreateCursorRead( $(tn) ) failed", "tn=%s", EV_AL_TABLE ) );
-            }
-            else
-            {
-                struct KNamelist * available_columns;
-
-                rc = VTableListReadableColumns ( evidence_alignment_tbl, &available_columns );
-                if ( rc != 0 )
-                {
-                    (void)PLOGERR( klogInt, ( klogInt, rc, 
-                        "VTableListReadableColumns( $(src) ) failed", "src=%c", 'A' ) );
-                }
-                else
-                {
-                    rc = prepare_cmn_table_rows( opts, evidence_alignment_tbl, &atx->eval,
-                                'A', available_columns ); /* common to prim/sec/ev-align */
-                    KNamelistRelease( available_columns );
-                }
-                
-                if ( rc == 0 )
-                {
-                    /* special to ev-align */
-                    rc = add_column( atx->eval.cursor, COL_REF_POS, &atx->ref_pos_idx );
-                    if ( rc == 0 )
-                        rc = add_column( atx->eval.cursor, COL_REF_PLOIDY, &atx->ref_ploidy_idx );
-                    if ( rc == 0 )
-                        rc = add_column( atx->eval.cursor, COL_SEQ_NAME, &atx->seq_name_idx );
-                    if ( rc == 0 )
-                        rc = add_column( atx->eval.cursor, COL_MAPQ, &atx->mapq_idx );
-                }
-                rc = VCursorOpen( atx->eval.cursor );
-                if ( rc != 0 )
-                {
-                    (void)PLOGERR( klogInt, ( klogInt, rc, "VCursorOpen( $(tn) ) failed", "tn=%s", EV_AL_TABLE ) );
-                }
-            }
-            VTableRelease ( evidence_alignment_tbl ); /* the cursor keeps the table alive */
-        }
-    }
-    return rc;
-}
-
-
-static rc_t prepare_evidence_table_cursor( const samdump_opts * const opts, const VDatabase * db,
-                                           const char * table_name, align_table_context * const atx )
-{
-    const VTable *evidence_interval_tbl;
-    rc_t rc = VDatabaseOpenTableRead( db, &evidence_interval_tbl, table_name );
-    if ( rc != 0 )
-    {
-        (void)PLOGERR( klogInt, ( klogInt, rc, "VDatabaseOpenTableRead( $(tn) ) failed", "tn=%s", table_name ) );
-    }
-    else
-    {
-        if ( opts->cursor_cache_size == 0 )
-            rc = VTableCreateCursorRead( evidence_interval_tbl, &atx->cmn.cursor );
-        else
-            rc = VTableCreateCachedCursorRead( evidence_interval_tbl, &atx->cmn.cursor, opts->cursor_cache_size );
-        if ( rc != 0 )
-        {
-            (void)PLOGERR( klogInt, ( klogInt, rc, "VTableCreateCursorRead( $(tn) ) failed", "tn=%s", table_name ) );
-        }
-        else
-        {
-            struct KNamelist * available_columns;
-
-            rc = VTableListReadableColumns ( evidence_interval_tbl, &available_columns );
-            if ( rc != 0 )
-            {
-                (void)PLOGERR( klogInt, ( klogInt, rc, 
-                    "VTableListReadableColumns( $(src) ) failed", "src=%c", 'I' ) );
-            }
-            else
-            {
-                rc = prepare_cmn_table_rows( opts, evidence_interval_tbl, &atx->cmn,
-                            'I', available_columns ); /* common to prim/sec/ev-align */
-                KNamelistRelease( available_columns );
-            }
-        
-            if ( rc == 0 )
-                rc = add_column( atx->cmn.cursor, COL_PLOIDY, &atx->ploidy_idx );            
-
-            if ( rc == 0 && ( opts->dump_cg_sam || opts->dump_cg_ev_dnb ) )
-                rc = prepare_sub_ev_alignment_table_cursor( opts, db, atx );
-
-            if ( rc != 0 )
-                VCursorRelease( atx->cmn.cursor );
-        }
-        VTableRelease ( evidence_interval_tbl ); /* the cursor keeps the table alive */
-    }
-    return rc;
-}
-
-
-static rc_t add_table_pl_iter( const samdump_opts * const opts, PlacementSetIterator * const set_iter,
-                               const ReferenceObj * const ref_obj, const input_database * const idb,
-                               INSDC_coord_zero ref_pos, INSDC_coord_len ref_len, const char * spot_group,
-                               const char * table_name, align_id_src id_src_selector, Vector * const context_list )
-{
-    rc_t rc = 0;
-    align_table_context * atx;
-    PlacementRecordExtendFuncs ext_0; /* ReferenceObj_MakePlacementIterator makes copies of the elements */
-
-    memset( &ext_0, 0, sizeof ext_0 );
-    atx = calloc( 1, sizeof * atx );
-    if ( atx == NULL )
-    {
-        rc = RC( rcExe, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
-        (void)PLOGERR( klogInt, ( klogInt, rc, "align-context-allocation for $(tn) failed", "tn=%s", table_name ) );
-    }
-    else
-    {
-        init_align_table_context( atx, idb->db_idx, ref_obj );
-        rc = ReferenceObj_Idx( ref_obj, &atx->ref_idx );
-        if ( rc != 0 )
-        {
-            (void)PLOGERR( klogInt, ( klogInt, rc, "failed to detect ref-idx for $(tn) failed", "tn=%s", table_name ) );
-        }
-        else
-        {
-            switch( id_src_selector )
-            {
-                case primary_align_ids   :  atx->align_table_type = att_primary;
-                                            rc = prepare_prim_sec_table_cursor( opts, idb->db, table_name, atx );
-                                            break;
-
-                case secondary_align_ids :  atx->align_table_type = att_secondary;
-                                            rc = prepare_prim_sec_table_cursor( opts, idb->db, table_name, atx );
-                                            break;
-
-                case evidence_align_ids  :  atx->align_table_type = att_evidence;
-                                            rc = prepare_evidence_table_cursor( opts, idb->db, table_name, atx );
-                                            break;
-            }
-        }
-        if ( rc == 0 )
-        {
-            ext_0.data = atx;
-            /* we must put the atx-ptr into a global list, in order to close everything later at the end... */
-        }
-        else
-            free_align_table_context( atx );
-    }
-
-    if ( rc == 0 )
-    {
-        int32_t min_mapq = 0;
-        PlacementIterator *pl_iter;
-
-        if ( opts->use_min_mapq )
-            min_mapq = opts->min_mapq;
-
-        rc = ReferenceObj_MakePlacementIterator( ref_obj, /* the reference-obj it is made from */
-            &pl_iter,           /* the placement-iterator we want to make */
-            ref_pos,            /* where it starts on the reference */
-            ref_len,            /* the whole length of this reference/chromosome */
-            min_mapq,           /* no minimal mapping-quality to filter out */
-            NULL,               /* no special reference-cursor */
-            atx->cmn.cursor,    /* a cursor into the PRIMARY/SECONDARY/EVIDENCE-table */
-            id_src_selector,    /* what ID-source to select from REFERENCE-table (ref_obj) */
-            &ext_0,             /* placement-record extensions #0 with data-ptr pointing to cursor/index-struct */
-            NULL,               /* no placement-record extensions #1 */
-            spot_group,         /* optional spotgroup re-grouping */
-            NULL                /* source-cursor specific data/context */
-            );
-        if ( rc == 0 )
-        {
-            rc = PlacementSetIteratorAddPlacementIterator ( set_iter, pl_iter );
-            if ( GetRCState( rc ) == rcDone ) { rc = 0; }
-        }
-    }
-
-    if ( rc == 0 )
-        rc = VectorAppend ( context_list, NULL, atx );
-    return rc;
-}
-
-
-static rc_t add_pl_iters( const samdump_opts * const opts, PlacementSetIterator * const set_iter,
-                          const ReferenceObj * const ref_obj, const input_database * const idb,
-                          INSDC_coord_zero ref_pos, INSDC_coord_len ref_len,
-                          const char * spot_group, Vector * const context_list )
-{
-    KNamelist *tables;
-    rc_t rc = VDatabaseListTbl( idb->db, &tables );
-    if ( rc != 0 )
-    {
-        (void)PLOGERR( klogInt, ( klogInt, rc, "VDatabaseListTbl( $(tn) ) failed", "tn=%s", idb->path ) );
-    }
-    else
-    {
-        if ( opts->dump_primary_alignments && namelist_contains( tables, PRIM_TABLE ) ) /* read_fkt.c */
-        {
-            rc = add_table_pl_iter( opts, set_iter, ref_obj, idb, ref_pos, ref_len, spot_group, 
-                                    PRIM_TABLE, primary_align_ids, context_list );
-        }
-
-        if ( rc == 0 && opts->dump_secondary_alignments && namelist_contains( tables, SEC_TABLE ) )
-        {
-            rc = add_table_pl_iter( opts, set_iter, ref_obj, idb, ref_pos, ref_len, spot_group, 
-                                    SEC_TABLE, secondary_align_ids, context_list );
-        }
-
-        if ( rc == 0 )
-        {
-            bool b0 = ( opts->dump_cg_evidence && 
-                        namelist_contains( tables, EV_INT_TABLE ) );
-
-            bool b1 = ( ( opts->dump_cg_sam || opts->dump_cg_ev_dnb ) && 
-                        namelist_contains( tables, EV_INT_TABLE ) &&
-                        namelist_contains( tables, EV_AL_TABLE ) );
-
-            if ( b0 || b1 )
-            {
-                rc = add_table_pl_iter( opts, set_iter, ref_obj, idb, ref_pos, ref_len, spot_group, 
-                                        EV_INT_TABLE, evidence_align_ids, context_list );
-            }
-        }
-        KNamelistRelease( tables );
-    }
-    return rc;
-}
-
-
-/* the user did not specify ranges on the reference, that means the whole file has to be dumped...
-   the reflist is iterated over all ref-objects it contains ... */
-static rc_t prepare_whole_files( const samdump_opts * const opts, const input_files * const ifs,
-                                 PlacementSetIterator * const set_iter, Vector * const context_list )
-{
-    rc_t rc = 0;
-    uint32_t db_idx;
-    /* we now loop through all input-databases... */
-    for ( db_idx = 0; db_idx < ifs->database_count && rc == 0; ++db_idx )
-    {
-        const input_database * idb = VectorGet( &ifs->dbs, db_idx );
-        if ( idb != NULL )
-        {
-            uint32_t refobj_count;
-            rc = ReferenceList_Count( idb->reflist, &refobj_count );
-            if ( rc == 0 && refobj_count > 0 )
-            {
-                uint32_t ref_idx;
-                for ( ref_idx = 0; ref_idx < refobj_count && rc == 0; ++ref_idx )
-                {
-                    const ReferenceObj* ref_obj;
-                    rc = ReferenceList_Get( idb->reflist, &ref_obj, ref_idx );
-                    if ( rc == 0 && ref_obj != NULL )
-                    {
-                        INSDC_coord_len ref_len;
-                        rc = ReferenceObj_SeqLength( ref_obj, &ref_len );
-                        if ( rc == 0 )
-                            rc = add_pl_iters( opts,
-                                set_iter,
-                                ref_obj,
-                                idb,
-                                0,                  /* where it starts on the reference */
-                                ref_len,            /* the whole length of this reference/chromosome */
-                                NULL,               /* no spotgroup re-grouping (yet) */
-                                context_list
-                                );
-                        ReferenceObj_Release( ref_obj );
-                    }
-                }
-            }
-        }
-    }
-    return rc;
-}
-
-
-typedef struct on_region_ctx
-{
-    rc_t rc;
-    const samdump_opts * opts;
-    input_database * idb;
-    PlacementSetIterator * set_iter;
-    Vector *context_list;
-} on_region_ctx;
-
-
-static void CC on_region( BSTNode *n, void *data )
-{
-    on_region_ctx * rctx = data;
-    if ( rctx->rc == 0 )
-    {
-        reference_region * ref_rgn = ( reference_region * )n;
-        const ReferenceObj * ref_obj;
-        rctx->rc = ReferenceList_Find( rctx->idb->reflist, &ref_obj, ref_rgn->name, string_size( ref_rgn->name ) );
-        if ( rctx->rc == 0 )
-        {
-            uint32_t range_idx, range_count = VectorLength( &ref_rgn->ranges );
-            for ( range_idx = 0; range_idx < range_count && rctx->rc == 0; ++range_idx )
-            {
-                range * r = VectorGet( &ref_rgn->ranges, range_idx );
-                if ( r != NULL )
-                {
-                    INSDC_coord_len len;
-                    if ( r->start == 0 && r->end == 0 )
-                    {
-                        r->start = 1;
-                        rctx->rc = ReferenceObj_SeqLength( ref_obj, &len );
-                        if ( rctx->rc == 0 )
-                            r->end = ( r->start + len );
-                    }
-                    else
-                    {
-                        len = ( r->end - r->start + 1 );
-                    }
-                    if ( rctx->rc == 0 )
-                    {
-                        rctx->rc = add_pl_iters( rctx->opts, rctx->set_iter, ref_obj, rctx->idb,
-                            r->start,           /* where the range starts on the reference */
-                            len,                /* the length of this range */
-                            NULL,               /* no spotgroup re-grouping (yet) */
-                            rctx->context_list
-                            );
-                    }
-                }
-            }
-            ReferenceObj_Release( ref_obj );
-        }
-        else
-        {
-            if ( GetRCState( rctx->rc ) == rcNotFound ) rctx->rc = 0;
-        }
-    }
-}
-
-
-static rc_t prepare_regions( const samdump_opts * const opts, const input_files * const ifs,
-                             PlacementSetIterator * const set_iter, Vector * const context_list )
-{
-    uint32_t db_idx;
-    on_region_ctx rctx;
-
-    rctx.rc = 0;
-    rctx.opts = opts;
-    rctx.set_iter = set_iter;
-    rctx.context_list = context_list;
-    /* we now loop through all input-databases... */
-    for ( db_idx = 0; db_idx < ifs->database_count && rctx.rc == 0; ++db_idx )
-    {
-        rctx.idb = VectorGet( &ifs->dbs, db_idx );
-        if ( rctx.idb != NULL )
-            BSTreeForEach( ( BSTree * ) &opts->regions, false, on_region, &rctx );
-    }
-    return rctx.rc;
-}
-
-
-static uint32_t calc_mate_flags( uint32_t flags )
-{
-    uint32_t res = ( flags & 0x1 ) |
-                   ( flags & 0x2 ) |
-                   ( ( flags & 0x8 ) >> 1 ) |
-                   ( ( flags & 0x4 ) << 1 ) |
-                   ( ( flags & 0x20 ) >> 1 ) |
-                   ( ( flags & 0x10 ) << 1 ) |
-                   ( ( flags & 0x40 ) ? 0x80 : 0x40 ) |
-                   ( flags & 0x700 );
-    return res;
-}
-
-
-static const char *equal_sign = "=";
-
-
-static rc_t print_qslice( const samdump_opts * const opts, bool reverse, const char * source, uint32_t source_str_len,
-                          uint32_t *source_offset, const uint32_t * source_len_vector,
-                          uint32_t source_len_vector_len, uint32_t slice_nr )
-{
-    rc_t rc = 0;
-    if ( *source_offset > source_str_len || slice_nr >= source_len_vector_len )
-        rc = RC( rcExe, rcNoTarg, rcReading, rcParam, rcInvalid );
-    else
-    {
-        uint32_t len = source_len_vector[ slice_nr ];
-        if ( len > 0 )
-        {
-            const char * ptr = &source[ *source_offset ];
-            rc = dump_quality_33( opts, ptr, len, reverse ); /* sam-dump-opts.c */
-            if ( rc == 0 )
-            {
-                rc = KOutMsg( "\t" );
-                if ( rc == 0 )
-                    *source_offset += len;
-            }
-        }
-        else
-            rc = KOutMsg( "*\t" );
-    }
-    return rc;
-}
-
-
-static rc_t modify_and_print_cigar( const char * cigar, size_t cigar_len,
-                                    CigOps *ref_cig, int32_t ref_cig_len, INSDC_coord_zero ref_pos, uint32_t read_len )
-{
-    rc_t rc;
-    if ( cigar_len > 0 )
-    {
-        char cigbuf[ MAX_CG_CIGAR_LEN ];
-        uint32_t combined_len;
-        CigOps al_cig[ 1024 ];
-        ExplodeCIGAR( al_cig, 1024, cigar, cigar_len );
-        combined_len = CombineCIGAR( cigbuf, al_cig, read_len, ref_pos, ref_cig, ref_cig_len );
-        rc = KOutMsg( "%s\t", cigbuf );
-    }
-    else
-        rc = KOutMsg( "*\t" );
-    return rc;
-}
-
-
-static rc_t get_READ_QUALITY_EDIT_DIST( cg_cigar_output * cgc_output, int64_t align_id, const align_cmn_context * acc )
-{
-    /* get READ, QUALITY and EIDT_DIST before cigar manipulation because we need/change these values */
-    rc_t rc = read_char_ptr( align_id, acc->cursor, acc->read_idx, &cgc_output->p_read.ptr, &cgc_output->p_read.len, "READ" );
-    if ( rc == 0 )
-        rc = read_char_ptr( align_id, acc->cursor, acc->sam_quality_idx, &cgc_output->p_quality.ptr, &cgc_output->p_quality.len, "SAM_QUALITY" );
-    if ( rc == 0 )
-        rc = read_int32( align_id, acc->cursor, acc->edit_dist_idx, &cgc_output->edit_dist, 0, "EDIT_DIST" );
-    cgc_output->p_tags.len = 0;
-    return rc;
-}
-
-
-static rc_t read_ref_orientation_and_seq_read_id( cg_cigar_input * cgc_input, int64_t align_id, const align_cmn_context * acc )
-{
-    rc_t rc = read_bool( align_id, acc->cursor, acc->ref_orientation_idx, &cgc_input->orientation, false, "REF_ORIENT" );
-    if ( rc == 0 )
-        rc = read_INSDC_coord_one( align_id, acc->cursor, acc->seq_read_id_idx, &cgc_input->seq_req_id, 0, "SEQ_READ_ID" );
-    return rc;
-}
-
-/* this function expects:
-    READ        in : cgc_output->p_read.ptr, cgc_output->p_read.len
-    SAM_QUALITY in : cgc_output->p_quality.ptr, cgc_output->p_quality.len
-    CIGAR       in : cgc_input->p_cigar.ptr, cgc_input->p_cigar.len
-    EDIT_DIST   in : cgc_output->edit_dist
-*/
-static rc_t cg_cigar_treatments( enum cigar_treatment what_treatment, cg_cigar_input * cgc_input, cg_cigar_output * cgc_output,
-                                 int64_t align_id, const align_cmn_context * acc )
-{
-    rc_t rc = 0;
-    switch ( what_treatment )
-    {
-        case ct_unchanged : cgc_output->p_cigar.len  = cgc_input->p_cigar.len;
-                            cgc_output->p_cigar.ptr = cgc_input->p_cigar.ptr;
-                            break;
-
-        case ct_cg_style  : rc = read_ref_orientation_and_seq_read_id( cgc_input, align_id, acc );
-                            if ( rc == 0 )
-                            {
-                                cgc_input->edit_dist_available = true;
-                                cgc_input->edit_dist = cgc_output->edit_dist;
-                                rc = make_cg_cigar( cgc_input, cgc_output );
-                                if ( rc == 0 )
-                                {
-                                    cgc_output->p_cigar.len = cgc_output->cigar_len;
-                                    cgc_output->p_cigar.ptr = cgc_output->cigar;
-                                }
-                            }
-                            break;
-
-        case ct_cg_merge :  rc = read_ref_orientation_and_seq_read_id( cgc_input, align_id, acc );
-                            if ( rc == 0 )
-                            {
-                                cgc_input->p_read.ptr = cgc_output->p_read.ptr;
-                                cgc_input->p_read.len = cgc_output->p_read.len;
-                                cgc_input->p_quality.ptr = cgc_output->p_quality.ptr;
-                                cgc_input->p_quality.len = cgc_output->p_quality.len;
-                                cgc_input->edit_dist_available = true;
-                                cgc_input->edit_dist = cgc_output->edit_dist;
-                                rc = make_cg_merge( cgc_input, cgc_output );
-                                if ( rc == 0 )
-                                {
-                                    cgc_output->p_cigar.len = cgc_output->cigar_len;
-                                    cgc_output->p_cigar.ptr = cgc_output->cigar;
-                                }
-                            }
-                            break;
-    }
-    return rc;
-}
-
-
-/* triggered by option "--CG-SAM" */
-static rc_t print_evidence_alignment_cg_sam( const samdump_opts * const opts, const PlacementRecord * const rec,
-                                      const align_table_context * const atx, int64_t align_id, uint32_t ploidy_idx,
-                                      const char * ref_name, INSDC_coord_zero allele_pos, int32_t ref_cig_len )
-{
-    const VCursor * cursor = atx->eval.cursor;
-    INSDC_coord_zero ref_pos;
-    uint32_t seq_name_len, sam_flags, spot_group_len = 0;
-    const char * seq_name, * spot_group;
-    int32_t mapq;
-    cg_cigar_output cgc_output;
-
-    rc_t rc = read_char_ptr( align_id, cursor, atx->seq_name_idx, &seq_name, &seq_name_len, "SEQ_NAME" );
-    if ( rc == 0 && atx->eval.seq_spot_group_idx != COL_NOT_AVAILABLE )
-        rc = read_char_ptr( align_id, cursor, atx->eval.seq_spot_group_idx, &spot_group, &spot_group_len, "SEQ_SPOT_GROUP" );
-
-    if ( rc == 0 )
-    {
-        if ( opts->print_cg_names )
-        {
-            if ( spot_group_len > 0 )
-                /* SAM-FIELD: QNAME     constructed from spot-group/seq-name */
-                rc = KOutMsg( "%.*s-1:%.*s\t", spot_group_len, spot_group, seq_name_len, seq_name );
-
-        }
-        else
-        {
-            if ( seq_name_len > 0 )
-                /* SAM-FIELD: QNAME     constructed from allel-id/sub-id */
-                rc = KOutMsg( "%.*s/ALLELE_%li.%u\t", seq_name_len, seq_name, rec->id, ploidy_idx );
-        }
-    }
-
-    if ( rc == 0 )
-        rc = read_INSDC_coord_zero( align_id, cursor, atx->ref_pos_idx, &ref_pos, 0, "REF_POS" );
-
-    if ( rc == 0 )
-        rc = read_int32( align_id, cursor, atx->mapq_idx, &mapq, 0, "MAPQ" );
-
-    if ( rc == 0 )
-    {
-        uint8_t ref_orient;
-        rc = read_uint8( align_id, cursor, atx->eval.ref_orientation_idx, &ref_orient, 0, "REF_ORIENT" );
-        if ( rc == 0 )
-        {
-            INSDC_coord_one seq_read_id;
-            bool cmpl = ref_orient;
-            rc = read_INSDC_coord_one( align_id, cursor, atx->eval.seq_read_id_idx, &seq_read_id, 0, "SEQ_READ_ID" );
-            sam_flags = ( 1 | ( cmpl ? 0x10 : 0 ) | ( seq_read_id == 1 ? 0x40 : 0x80 ) );
-        }
-    }
-
-    /* SAM-FIELD: FLAG      SRA-column: SAM_FLAGS ( uint32 ) */
-    /* SAM-FIELD: RNAME     SRA-column: ALLEL-NAME.ploidy_idx */
-    /* SAM-FIELD: POS       SRA-column: REF_POS + 1 */
-    /* SAM-FIELD: MAPQ      SRA-column: MAPQ ( from evidence-alignment-table, not from allel! ) */
-    if ( rc == 0 )
-        rc = KOutMsg( "%u\t%s\t%i\t%d\t", sam_flags, ref_name, allele_pos + ref_pos + 1, mapq );
-
-    /* get READ, QUALITY and EIDT_DIST before cigar manipulation because we need/change these values */
-    if ( rc == 0 )
-        rc = get_READ_QUALITY_EDIT_DIST( &cgc_output, align_id, &atx->eval );
-
-    /* SAM-FIELD: CIGAR     SRA-column: CIGAR_SHORT / with special treatment */
-    if ( rc == 0 )
-    {
-        cg_cigar_input cgc_input;
-        rc = read_char_ptr( align_id, cursor, atx->eval.cigar_idx, &cgc_input.p_cigar.ptr, &cgc_input.p_cigar.len, "CIGAR" );
-        if ( rc == 0 )
-            rc = cg_cigar_treatments( opts->cigar_treatment, &cgc_input, &cgc_output, align_id, &atx->eval );
-        if ( rc == 0 )
-            rc = modify_and_print_cigar( cgc_output.p_cigar.ptr, cgc_output.p_cigar.len,
-                                         atx->cig_op_buffer, ref_cig_len, ref_pos, cgc_output.p_read.len );
-    }
-
-    /* SAM-FIELD: RNEXT     SRA-column: MATE_REF_NAME '*' no mates! */
-    /* SAM-FIELD: PNEXT     SRA-column: MATE_REF_POS + 1 '0' no mates */
-    /* SAM-FIELD: TLEN      SRA-column: TEMPLATE_LEN '0' not in table */
-    /* SAM-FIELD: SEQ       SRA-column: READ  */
-    if ( rc == 0 )
-        rc = KOutMsg( "*\t0\t0\t%.*s\t", cgc_output.p_read.len, cgc_output.p_read.ptr );
-
-    /* SAM-FIELD: QUAL      SRA-column: SAM_QUALITY */
-    if ( rc == 0 && cgc_output.p_quality.len > 0 )
-        rc = dump_quality_33( opts, cgc_output.p_quality.ptr, cgc_output.p_quality.len, false ); /* sam-dump-opts.c */
-
-    /* OPT SAM-FIELD: RG     SRA-column: SEQ_SPOT_GROUP */
-    if ( rc == 0 && spot_group_len > 0 )
-        rc = KOutMsg( "\tRG:Z:%.*s", spot_group_len, spot_group );
-
-    if ( rc == 0 && cgc_output.p_tags.len > 0 )
-        rc = KOutMsg( "\t%.*s", cgc_output.p_tags.len, cgc_output.p_tags.ptr );
-
-    /* OPT SAM-FIELD: ZI     SRA-column: rec->id */
-    /* OPT SAM-FIELD: ZA     SRA-column: ploidy_idx */
-    if ( rc == 0 )
-        rc = KOutMsg( "\tZI:i:%li\tZA:i:%u", rec->id, ploidy_idx );
-
-    /* OPT SAM-FIELD: NH     SRA-column: ALIGNMENT_COUNT */
-    if ( rc == 0 && atx->eval.al_count_idx != COL_NOT_AVAILABLE )
-    {
-        const uint8_t * al_count;
-        uint32_t al_count_len;
-        rc = read_uint8_ptr( align_id, cursor, atx->eval.al_count_idx, &al_count, &al_count_len, "ALIGNMENT_COUNT" );
-        if ( rc == 0 && al_count_len > 0 )
-            rc = KOutMsg( "\tNH:i:%u", *al_count );
-    }
-
-    /* OPT SAM-FIELD: NM     SRA-column: EDIT_DISTANCE */
-    if ( rc == 0 )
-        rc = KOutMsg( "\tNM:i:%u", cgc_output.edit_dist );
-
-    /* OPT SAM-FIELD: XI     SRA-column: ALIGN_ID */
-    if ( rc == 0 && opts->print_alignment_id_in_column_xi )
-        rc = KOutMsg( "\tXI:i:%u", align_id );
-
-    if ( rc == 0 )
-        rc = KOutMsg( "\n" );
-
-    return rc;
-}
-
-
-/*  triggered by option --CG-evidence-dnb */
-static rc_t print_evidence_alignment_cg_ev_dnb( const samdump_opts * const opts, const PlacementRecord * const rec,
-                                      const align_table_context * const atx, int64_t align_id, uint32_t ploidy_idx )
-{
-    const VCursor * cursor = atx->eval.cursor;
-    INSDC_coord_zero ref_pos;
-    uint32_t seq_name_len, sam_flags, spot_group_len = 0;
-    int32_t mapq;
-    const char * seq_name, * spot_group;
-    cg_cigar_output cgc_output;
-
-    rc_t rc = read_char_ptr( align_id, cursor, atx->seq_name_idx, &seq_name, &seq_name_len, "SEQ_NAME" );
-    if ( rc == 0 && atx->eval.seq_spot_group_idx != COL_NOT_AVAILABLE )
-        rc = read_char_ptr( align_id, cursor, atx->eval.seq_spot_group_idx, &spot_group, &spot_group_len, "SEQ_SPOT_GROUP" );
-
-    if ( rc == 0 )
-    {
-        if ( opts->print_cg_names )
-        {
-            if ( spot_group_len > 0 )
-                /* SAM-FIELD: QNAME     constructed from spot-group/seq-name */
-                rc = KOutMsg( "%.*s-1:%.*s\t", spot_group_len, spot_group, seq_name_len, seq_name );
-
-        }
-        else
-        {
-            if ( seq_name_len > 0 )
-                /* SAM-FIELD: QNAME     constructed from allel-id/sub-id */
-                rc = KOutMsg( "%.*s/ALLELE_%li.%u\t", seq_name_len, seq_name, rec->id, ploidy_idx );
-        }
-    }
-
-    if ( rc == 0 )
-        rc = read_INSDC_coord_zero( align_id, cursor, atx->ref_pos_idx, &ref_pos, 0, "REF_POS" );
-
-    if ( rc == 0 )
-        rc = read_int32( align_id, cursor, atx->mapq_idx, &mapq, 0, "MAPQ" );
-
-    if ( rc == 0 )
-    {
-        uint8_t ref_orient;
-        rc = read_uint8( align_id, cursor, atx->eval.ref_orientation_idx, &ref_orient, 0, "REF_ORIENT" );
-        if ( rc == 0 )
-        {
-            INSDC_coord_one seq_read_id;
-            bool cmpl = ref_orient;
-            rc = read_INSDC_coord_one( align_id, cursor, atx->eval.seq_read_id_idx, &seq_read_id, 0, "SEQ_READ_ID" );
-            sam_flags = ( 1 | ( cmpl ? 0x10 : 0 ) | ( seq_read_id == 1 ? 0x40 : 0x80 ) );
-        }
-    }
-
-    /* SAM-FIELD: FLAG      SRA-column: SAM_FLAGS ( uint32 ) */
-    /* SAM-FIELD: RNAME     SRA-column: ALLEL-NAME.ploidy_idx */
-    /* SAM-FIELD: POS       SRA-column: REF_POS + 1 */
-    /* SAM-FIELD: MAPQ      SRA-column: MAPQ ( from evidence-alignment-table, not from allel! ) */
-    if ( rc == 0 )
-        rc = KOutMsg( "%u\tALLELE_%li.%u\t%i\t%d\t", sam_flags, rec->id, ploidy_idx, ref_pos + 1, mapq );
-
-    /* get READ, QUALITY and EIDT_DIST before cigar manipulation because we need/change these values */
-    if ( rc == 0 )
-        rc = get_READ_QUALITY_EDIT_DIST( &cgc_output, align_id, &atx->eval );
-
-    /* SAM-FIELD: CIGAR     SRA-column: CIGAR_SHORT / with or without treatment */
-    if ( rc == 0 )
-    {
-        cg_cigar_input cgc_input;
-        rc = read_char_ptr( align_id, cursor, atx->eval.cigar_idx, &cgc_input.p_cigar.ptr, &cgc_input.p_cigar.len, "CIGAR" );
-        if ( rc == 0 )
-        rc = cg_cigar_treatments( opts->cigar_treatment, &cgc_input, &cgc_output, align_id, &atx->eval );
-        if ( rc == 0 )
-            rc = KOutMsg( "%.*s\t", cgc_output.p_cigar.len, cgc_output.p_cigar.ptr );
-    }
-
-    /* SAM-FIELD: RNEXT     SRA-column: MATE_REF_NAME '*' no mates! */
-    /* SAM-FIELD: PNEXT     SRA-column: MATE_REF_POS + 1 '0' no mates */
-    /* SAM-FIELD: TLEN      SRA-column: TEMPLATE_LEN '0' not in table */
-    /* SAM-FIELD: SEQ       SRA-column: READ  */
-    if ( rc == 0 )
-        rc = KOutMsg( "*\t0\t0\t%.*s\t", cgc_output.p_read.len, cgc_output.p_read.ptr );
-
-    /* SAM-FIELD: QUAL      SRA-column: SAM_QUALITY */
-    if ( rc == 0 && cgc_output.p_quality.len > 0 )
-        rc = dump_quality_33( opts, cgc_output.p_quality.ptr, cgc_output.p_quality.len, false ); /* sam-dump-opts.c */
-
-    /* OPT SAM-FIELD: RG     SRA-column: SEQ_SPOT_GROUP */
-    if ( rc == 0 && spot_group_len > 0 )
-        rc = KOutMsg( "\tRG:Z:%.*s", spot_group_len, spot_group );
-
-    if ( rc == 0 && cgc_output.p_tags.len > 0 )
-        rc = KOutMsg( "\t%.*s", cgc_output.p_tags.len, cgc_output.p_tags.ptr );
-
-    /* OPT SAM-FIELD: NH     SRA-column: ALIGNMENT_COUNT */
-    if ( rc == 0 && atx->eval.al_count_idx != COL_NOT_AVAILABLE )
-    {
-        const uint8_t * al_count;
-        uint32_t al_count_len;
-        rc = read_uint8_ptr( align_id, cursor, atx->eval.al_count_idx, &al_count, &al_count_len, "ALIGNMENT_COUNT" );
-        if ( rc == 0 && al_count_len > 0 )
-            rc = KOutMsg( "\tNH:i:%u", *al_count );
-    }
-
-    /* OPT SAM-FIELD: NM     SRA-column: EDIT_DISTANCE */
-    if ( rc == 0 )
-        rc = KOutMsg( "\tNM:i:%u", cgc_output.edit_dist );
-
-    /* OPT SAM-FIELD: XI     SRA-column: ALIGN_ID */
-    if ( rc == 0 && opts->print_alignment_id_in_column_xi )
-        rc = KOutMsg( "\tXI:i:%u", align_id );
-
-    if ( rc == 0 )
-        rc = KOutMsg( "\n" );
-
-    return rc;
-}
-
-
-/* print minimal one alignment from the EVIDENCE-INTERVAL / EVIDENCE-ALIGNMENT - table(s) 
-   triggered by option "--CG-SAM / --CG-evidence / --CG-evidence-dnb */
-static rc_t print_alignment_sam_ev( const samdump_opts * const opts, const char * ref_name,
-                                    INSDC_coord_zero pos,
-                                    const PlacementRecord * const rec, align_table_context * const atx,
-                                    uint64_t * const rows_so_far )
-{
-    uint32_t ploidy;
-    const VCursor * cursor = atx->cmn.cursor;
-    rc_t rc = read_uint32( rec->id, cursor, atx->ploidy_idx, &ploidy, 0, "PLOIDY" );
-    if ( rc == 0 && ploidy > 0 )
-    {
-        uint32_t ploidy_idx, cigar_len_vector_len, read_len_vector_len, edit_dist_vector_len, cigar_str_len, read_len, quality_str_len;
-        uint32_t quality_offset = 0;
-        const uint32_t *cigar_len_vector, *read_len_vector, *edit_dist_vector;
-        const char * cigar, *read, *quality;
-        char * transformed_cigar = NULL;
-        char * org_transformed_cigar = NULL;
-        
-        rc = read_char_ptr( rec->id, cursor, atx->cmn.cigar_idx, &cigar, &cigar_str_len, "CIGAR" );
-        if ( rc == 0 )
-        {
-            org_transformed_cigar = string_dup ( cigar, cigar_str_len );
-            if ( org_transformed_cigar != NULL )
-            {
-                uint32_t i;
-                for ( i = 0; i < cigar_str_len; ++i )
-                {
-                    if ( org_transformed_cigar[ i ] == 'S' ) org_transformed_cigar[ i ] = 'I';
-                }
-                transformed_cigar = org_transformed_cigar;
-            }
-        }
-        
-        if ( rc == 0 )
-            rc = read_uint32_ptr( rec->id, cursor, atx->cmn.cigar_len_idx, &cigar_len_vector, &cigar_len_vector_len, "CIGAR_LEN" );
-        if ( rc == 0 )
-            rc = read_char_ptr( rec->id, cursor, atx->cmn.read_idx, &read, &read_len, "READ" );
-        if ( rc == 0 )
-            rc = read_uint32_ptr( rec->id, cursor, atx->cmn.read_len_idx, &read_len_vector, &read_len_vector_len, "READ_LEN" );
-        if ( rc == 0 )
-            rc = read_char_ptr( rec->id, cursor, atx->cmn.sam_quality_idx, &quality, &quality_str_len, "QUALITY" );
-        if ( rc == 0 )
-            rc = read_uint32_ptr( rec->id, cursor, atx->cmn.edit_dist_idx, &edit_dist_vector, &edit_dist_vector_len, "EDIT_DIST" );
-
-        for ( ploidy_idx = 0; ploidy_idx < ploidy && rc == 0; ++ploidy_idx )
-        {
-            uint32_t cigar_slice_len = cigar_len_vector[ ploidy_idx ];
-            uint32_t read_slice_len = read_len_vector[ ploidy_idx ];
-            if ( opts->dump_cg_evidence )
-            {
-                /* SAM-FIELD: QNAME     SRA-column: eventually prefixed row-id into EVIDENCE_INTERVAL - table */
-                /* SAM-FIELD: FLAG      SRA-column: SAM_FLAGS ( uint32 ) */
-                /* SAM-FIELD: RNAME     SRA-column: REF_NAME / REF_SEQ_ID ( char * ) */
-                /* SAM-FIELD: POS       SRA-column: REF_POS + 1 */
-                /* SAM-FIELD: MAPQ      SRA-column: MAPQ */
-                if ( rc == 0 )
-                {
-                    if ( opts->print_cg_names )
-                        rc = KOutMsg( "-1:0\t" );
-                    else
-                        rc = KOutMsg( "ALLELE_%li.%u\t", rec->id, ploidy_idx + 1 );
-                }
-
-                if ( rc == 0 )
-                    rc = KOutMsg( "0\t%s\t%u\t%d\t", ref_name, pos + 1, rec->mapq );
-
-                /* SAM-FIELD: CIGAR     SRA-column: CIGAR_SHORT / CIGAR_LONG sliced!!! */
-                if ( rc == 0 )
-                    rc = KOutMsg( "%.*s\t", cigar_slice_len, transformed_cigar );
-
-                /* SAM-FIELD: RNEXT     SRA-column: MATE_REF_NAME ( !!! row_len can be zero !!! ) */
-                /* SAM-FIELD: PNEXT     SRA-column: MATE_REF_POS + 1 ( !!! row_len can be zero !!! ) */
-                /* SAM-FIELD: TLEN      SRA-column: TEMPLATE_LEN ( !!! row_len can be zero !!! ) */
-                /* SAM-FIELD: SEQ       SRA-column: READ sliced!!! */
-                if ( rc == 0 )
-                    rc = KOutMsg( "*\t0\t0\t%.*s\t", read_slice_len, read );
-
-                /* SAM-FIELD: QUAL      SRA-column: SAM_QUALITY sliced!!! */
-                if ( rc == 0 )
-                    rc = print_qslice( opts, false, quality, quality_str_len, &quality_offset, read_len_vector, read_len_vector_len, ploidy_idx );
-
-                /* OPT SAM-FIELD: RG     SRA-column: ploidy_idx */
-                if ( rc == 0 )
-                    rc = KOutMsg( "RG:Z:ALLELE_%u", ploidy_idx + 1 );
-
-                /* OPT SAM-FIELD: XI     SRA-column: ALIGN_ID */
-                if ( rc == 0 && opts->print_alignment_id_in_column_xi )
-                    rc = KOutMsg( "\tXI:i:%u", rec->id );
-
-                /* OPT SAM-FIELD: NM     SRA-column: EDIT_DISTANCE sliced!!! */
-                if ( rc == 0 && ( ploidy_idx < edit_dist_vector_len ) )
-                    rc = KOutMsg( "\tNM:i:%u", edit_dist_vector[ ploidy_idx ] );
-
-                if ( rc == 0 )
-                    rc = KOutMsg( "\n" );
-
-                (*rows_so_far)++;
-            }
-
-            /* we do that here per ALLEL-READ, not at the end per ALLEL, because we have to test which alignments
-               fit the ploidy_idx */
-
-            if ( rc == 0 && ( opts->dump_cg_sam || opts->dump_cg_ev_dnb ) )
-            {
-                const int64_t *ev_al_ids;
-                uint32_t ev_al_ids_count, read_id;
-
-                rc = read_int64_ptr( rec->id, atx->cmn.cursor, atx->ev_alignments_idx, &ev_al_ids, &ev_al_ids_count, "EV_ALIGNMENTS" );
-                for ( read_id = 0; read_id < ev_al_ids_count && rc == 0; ++read_id )
-                {
-                    uint32_t ref_ploidy;
-                    int64_t align_id = ev_al_ids[ read_id ];
-                    rc = read_uint32( align_id, atx->eval.cursor, atx->ref_ploidy_idx, &ref_ploidy, 0, "PLOIDY" );
-
-                    if ( rc == 0 && ( ref_ploidy == ( ploidy_idx + 1 ) ) )
-                    {
-                        if ( rc == 0 && opts->dump_cg_sam )
-                        {
-                            rc = adjust_align_table_context_cig_op_buffer( atx, read_slice_len );
-                            if ( rc == 0 )
-                            {
-                                int32_t ref_cig_len = ExplodeCIGAR( atx->cig_op_buffer, atx->cig_op_buffer_len, cigar, cigar_slice_len );
-                                rc = print_evidence_alignment_cg_sam( opts, rec, atx, align_id, ploidy_idx + 1, ref_name, pos, ref_cig_len );
-                            }
-                        }
-
-                        if ( rc == 0 && opts->dump_cg_ev_dnb )
-                            rc = print_evidence_alignment_cg_ev_dnb( opts, rec, atx, align_id, ploidy_idx + 1 );
-                    }
-                }
-            }
-
-            /* advance the cigar-slice... */
-            cigar += cigar_slice_len;
-            if ( transformed_cigar != NULL )
-                transformed_cigar += cigar_slice_len;
-            read += read_slice_len;
-        }
-        if ( org_transformed_cigar != NULL )
-            free( org_transformed_cigar );
-    }
-    return rc;
-}
-
-
-static rc_t check_rna_splicing_candidates_against_ref( struct ReferenceObj const * ref_obj,
-                                                       INSDC_coord_zero pos, rna_splice_candidates * candidates )
-{
-    rc_t rc = 0;
-    uint32_t idx;
-    for ( idx = 0; idx < candidates->count && rc == 0; ++idx )
-    {
-        uint8_t splice[ 4 ];
-        INSDC_coord_len written;
-        rna_splice_candidate * rsc = &candidates->candidates[ idx ];
-        rc = ReferenceObj_Read( ref_obj, pos + rsc->offset, 2, splice, &written );
-        if ( rc == 0 && written == 2 )
-        {
-            rc = ReferenceObj_Read( ref_obj, pos + rsc->offset + rsc->len - 2, 2, &splice[2], &written );
-            if ( rc == 0 && written == 2 && splice[ 1 ] == 'T' && splice[ 2 ] == 'A' )
-            {
-                if ( splice[ 0 ] == 'G' && splice[ 3 ] == 'G' )
-                {
-                    rsc->matched = 1;
-                }
-                else if ( splice[ 0 ] == 'A' && splice[ 3 ] == 'C' )
-                {
-                    rsc->matched = 1;
-                }
-                else if ( splice[ 0 ] == 'C' && splice[ 3 ] == 'C' )
-                {
-                    rsc->matched = 2;
-                }
-                else if ( splice[ 0 ] == 'G' && splice[ 3 ] == 'T' )
-                {
-                    rsc->matched = 2;
-                }
-                if ( rsc->matched == 1 )
-                    candidates->fwd_matched++;
-                else if ( rsc->matched == 2 )
-                    candidates->rev_matched++;
-            }
-        }
-    }
-    return rc;
-}
-
-
-static rc_t print_alignment_sam_ps( const samdump_opts * const opts, const char * ref_name,
-                                    INSDC_coord_zero pos, matecache * const mc,
-                                    const PlacementRecord * const rec, const align_table_context * const atx,
-                                    uint64_t * const rows_so_far )
-{
-    uint32_t sam_flags = 0, NM_adjustments = 0, seq_spot_id_len, mate_ref_pos_len = 0, mate_ref_name_len = string_size( ref_name );
-    INSDC_coord_zero mate_ref_pos = 0;
-    INSDC_coord_len tlen = 0;
-    int64_t mate_align_id = 0, id = rec->id;
-    const int64_t * seq_spot_id;
-    const char * mate_ref_name = ref_name;
-    const VCursor * cursor = atx->cmn.cursor;
-    cg_cigar_output cgc_output;
-    rna_splice_candidates candidates;
-
-    /* SAM-FIELD: NONE      SRA-column: MATE_ALIGN_ID ( int64 ) ... for cache lookup's */
-    rc_t rc = read_int64( id, cursor, atx->mate_align_id_idx, &mate_align_id, 0, "MATE_ALIGN_ID" );
-
-    candidates.count = 0;
-    candidates.fwd_matched = 0;
-    candidates.rev_matched = 0;
-
-    /* pre-read seq-spot-id, needed for unaligned cache and SAM-field QNAME */
-    if ( rc == 0 )
-        rc = read_int64_ptr( id, cursor, atx->cmn.seq_spot_id_idx, &seq_spot_id, &seq_spot_id_len, "SEQ_SPOT_ID" );
-
-    /* try to find the info about the mate in the CACHE... */
-    if ( rc == 0 )
-    {
-        if ( mate_align_id != 0 )
-        {
-            if ( opts->use_mate_cache && mc != NULL )
-            {
-                rc = matecache_lookup_same_ref( mc, atx->db_idx, mate_align_id, &mate_ref_pos, &sam_flags, &tlen );
-                if ( rc == 0 )
-                {
-                    /* we found it in the the sam-ref-matecache */
-                    const INSDC_read_filter * read_filter;
-                    uint32_t read_filter_len;
-
-                    /* cache entry-found! (on the same reference) -> that means we have now mate_ref_pos, flags and tlen */
-                    matecache_remove_same_ref( mc, atx->db_idx, mate_align_id );
-                    mate_ref_name = equal_sign;
-                    mate_ref_name_len = 1;
-                    mate_ref_pos_len = 1;
-
-                    /* read the read-filter column and adjust the sam-flags value to reflect the presense
-                       of the flag SRA_READ_FILTER_REJECT, if it is there switch 0x200 on, of not switch 0x200 off */
-                    rc = read_INSDC_read_filter_ptr( id, cursor, atx->cmn.read_filter_idx, &read_filter, &read_filter_len, "RD_FILTER" );
-                    if ( rc == 0 && read_filter_len > 0 )
-                    {
-                        if ( ( read_filter[ 0 ] & READ_FILTER_REJECT ) == READ_FILTER_REJECT )
-                            sam_flags |= 0x200;
-                        else
-                            sam_flags &= ~0x200;
-
-                        if ( ( read_filter[ 0 ] & READ_FILTER_CRITERIA ) == READ_FILTER_CRITERIA )
-                            sam_flags |= 0x400;
-                        else
-                            sam_flags &= ~0x400;
-                    }
-                }
-                else
-                {
-                    /* we did not find it in the the sam-ref-matecache */
-                    rc = RC( rcApp, rcNoTarg, rcAccessing, rcItem, rcNotFound );
-                }
-            }
-            else
-            {
-                rc = RC( rcApp, rcNoTarg, rcAccessing, rcItem, rcNotFound );
-            }
-        }
-
-        if ( ( mate_align_id != 0 && GetRCState( rc ) == rcNotFound )||( mate_align_id == 0 ) )
-        {
-            /* no cache entry-found OR do not use mate-cache
-               ---> that means we have to read it from the table... */
-
-            rc = read_char_ptr( id, cursor, atx->mate_ref_name_idx, &mate_ref_name, &mate_ref_name_len, "REF_NAME" );
-            if ( rc == 0 )
-                rc = read_INSDC_coord_zero( id, cursor, atx->mate_ref_pos_idx, &mate_ref_pos, 0, "REF_POS" );
-            if ( rc == 0 )
-                rc = read_INSDC_coord_len( id, cursor, atx->tlen_idx, &tlen, 0, "TLEN" );
-            if ( rc == 0 )
-                rc = read_uint32( id, cursor, atx->sam_flags_idx, &sam_flags, 0, "SAM_FLAGS" );
-
-            if ( rc == 0 )
-            {
-                int32_t cmp = -1;
-                if ( mate_ref_name_len > 0 )
-                {
-                    size_t ref_name_len = string_size( ref_name );
-                    size_t cmp_len = ( mate_ref_name_len > ref_name_len ? mate_ref_name_len : ref_name_len );
-                    cmp = string_cmp( mate_ref_name, mate_ref_name_len, ref_name, ref_name_len, cmp_len );
-                    if ( cmp == 0 )
-                    {
-                        mate_ref_name = equal_sign;
-                        mate_ref_name_len = 1;
-                    }
-                }
-
-                if ( opts->use_mate_cache )
-                {
-                    if ( mate_align_id != 0 && mate_ref_name_len > 0 && cmp == 0 )
-                    {
-                        /* now that we have the data, store it in sam-ref-cache it the mate is on the same ref. */
-                        uint32_t mate_flags = calc_mate_flags( sam_flags );
-                        rc = matecache_insert_same_ref( mc, atx->db_idx, id, pos, mate_flags, -tlen );
-                    }
-
-                    if ( mate_align_id == 0 && mate_ref_name_len == 0 && opts->print_half_unaligned_reads &&
-                         atx->align_table_type == att_primary )
-                    {
-                        int64_t key = id;
-                        rc = matecache_insert_unaligned( mc, atx->db_idx, key, pos, atx->ref_idx, *seq_spot_id );
-                    }
-                }
-            }
-        }
-    }
-
-    if ( rc == 0 && opts->use_matepair_filter && !filter_by_matepair_dist( opts, tlen ) )
-        return 0;
-
-    (*rows_so_far)++;
-
-    /* SAM-FIELD: QNAME     SRA-column: SEQ_SPOT_ID ( int64 ) */
-    if ( rc == 0 )
-    {
-        if ( seq_spot_id_len > 0 )
-        {
-            if ( opts->print_spot_group_in_name | opts->print_cg_names )
-            {
-                const char * spot_group;
-                uint32_t spot_group_len;
-                rc = read_char_ptr( id, cursor, atx->cmn.seq_spot_group_idx, &spot_group, &spot_group_len, "SPOT_GROUP" );
-                if ( rc == 0 )
-                    rc = dump_name( opts, *seq_spot_id, spot_group, spot_group_len ); /* sam-dump-opts.c */
-            }
-            else
-                rc = dump_name( opts, *seq_spot_id, NULL, 0 ); /* sam-dump-opts.c */
-        }
-        else
-            rc = KOutMsg( "*" );
-    }
-
-    if ( rc == 0 )
-        rc = KOutMsg( "\t" );
-
-    /* massage the sam-flag if we are not dumping unaligned reads... */
-    if ( !opts->dump_unaligned_reads    /** not going to dump unaligned **/
-         && ( sam_flags & 0x1 )         /** but we have sequenced multiple fragments **/
-         && ( sam_flags & 0x8 ) )       /** and not all of them align **/
-        /*** remove flags talking about multiple reads **/
-        /* turn off 0x001 0x008 0x040 0x080 */
-        sam_flags &= ~0xC9;
-
-    /* SAM-FIELD: FLAG      SRA-column: SAM_FLAGS ( uint32 ) */
-    /* SAM-FIELD: RNAME     SRA-column: REF_NAME / REF_SEQ_ID ( char * ) */
-    /* SAM-FIELD: POS       SRA-column: REF_POS + 1 */
-    /* SAM-FIELD: MAPQ      SRA-column: MAPQ */
-    if ( rc == 0 )
-        rc = KOutMsg( "%u\t%s\t%u\t%d\t", sam_flags, ref_name, pos + 1, rec->mapq );
-
-    /* get READ, QUALITY and EIDT_DIST before cigar manipulation because we need/change these values */
-    if ( rc == 0 )
-        rc = get_READ_QUALITY_EDIT_DIST( &cgc_output, rec->id, &atx->cmn );
-
-    /* SAM-FIELD: CIGAR     SRA-column: CIGAR_SHORT / with or without treatment */
-    if ( rc == 0 )
-    {
-        cg_cigar_input cgc_input;
-        char * temp_cigar = NULL;
-        static char const *bogus_quality = "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!";
-
-        rc = read_char_ptr( id, cursor, atx->cmn.cigar_idx, &cgc_input.p_cigar.ptr, &cgc_input.p_cigar.len, "CIGAR" );
-        if ( rc == 0 )
-        {
-            if ( cgc_output.p_quality.len == 0 )
-            {
-                cgc_output.p_quality.ptr = bogus_quality;
-                cgc_output.p_quality.len = 35;
-            }
-            rc = cg_cigar_treatments( opts->cigar_treatment, &cgc_input, &cgc_output, rec->id, &atx->cmn );
-        }
-
-        if ( opts->rna_splicing )
-        {
-            rc = discover_rna_splicing_candidates( cgc_output.p_cigar.len, cgc_output.p_cigar.ptr, 10, &candidates ); /* cg_tools.c */
-            if ( rc == 0 && candidates.count > 0 )
-            {
-                rc = check_rna_splicing_candidates_against_ref( rec->ref, pos, &candidates );
-                if ( rc == 0 && ( candidates.fwd_matched > 0 || candidates.rev_matched > 0 ) )
-                {
-                    temp_cigar = malloc( cgc_output.p_cigar.len + 1 );
-                    if ( temp_cigar != NULL )
-                    {
-                        memcpy( temp_cigar, cgc_output.p_cigar.ptr, cgc_output.p_cigar.len );
-                        rc = change_rna_splicing_cigar( cgc_output.p_cigar.len, temp_cigar, &candidates, &NM_adjustments ); /* cg_tools.c */
-                        if ( rc == 0 )
-                            cgc_output.p_cigar.ptr = temp_cigar;
-                    }
-                }
-            }
-        }
-        if ( rc == 0 )
-            rc = KOutMsg( "%.*s\t", cgc_output.p_cigar.len, cgc_output.p_cigar.ptr );
-        if ( temp_cigar != NULL )
-            free( temp_cigar );
-    }
-
-    /* SAM-FIELD: RNEXT     SRA-column: MATE_REF_NAME ( !!! row_len can be zero !!! ) */
-    /* SAM-FIELD: PNEXT     SRA-column: MATE_REF_POS + 1 ( !!! row_len can be zero !!! ) */
-    /* SAM-FIELD: TLEN      SRA-column: TEMPLATE_LEN ( !!! row_len can be zero !!! ) */
-    if ( rc == 0 )
-    {
-        if ( mate_ref_name_len > 0 )
-        {
-            rc = KOutMsg( "%.*s\t%u\t%d\t", mate_ref_name_len, mate_ref_name, mate_ref_pos + 1, tlen );
-        }
-        else
-        {
-            if ( mate_ref_pos_len == 0 )
-                rc = KOutMsg( "*\t0\t%d\t", tlen );
-            else
-                rc = KOutMsg( "*\t%u\t%d\t", mate_ref_pos, tlen );
-        }
-    }
-
-    /* SAM-FIELD: SEQ       SRA-column: READ */
-    if ( rc == 0 )
-        rc = KOutMsg( "%.*s\t", cgc_output.p_read.len, cgc_output.p_read.ptr );
-
-    /* SAM-FIELD: QUAL      SRA-column: SAM_QUALITY */
-    if ( rc == 0 )
-    {
-        if ( cgc_output.p_quality.len > 0 )
-            rc = dump_quality_33( opts, cgc_output.p_quality.ptr, cgc_output.p_quality.len, false );
-        else
-            rc = KOutMsg( "*" );
-    }
-
-    /* OPT SAM-FIELD: RG     SRA-column: SPOT_GROUP */
-    if ( rc == 0 && ( atx->cmn.seq_spot_group_idx != COL_NOT_AVAILABLE ) )
-    {
-        const char * spot_grp = NULL;
-        uint32_t spot_grp_len;
-        rc = read_char_ptr( id, cursor, atx->cmn.seq_spot_group_idx, &spot_grp, &spot_grp_len, "SPOT_GROUP" );
-        if ( rc == 0 && spot_grp_len > 0 )
-            rc = KOutMsg( "\tRG:Z:%.*s", spot_grp_len, spot_grp );
-    }
-
-    if ( rc == 0 && cgc_output.p_tags.len > 0 )
-        rc = KOutMsg( "\t%.*s", cgc_output.p_tags.len, cgc_output.p_tags.ptr );
-
-    /* OPT SAM-FIELD: XI     SRA-column: ALIGN_ID */
-    if ( rc == 0 && opts->print_alignment_id_in_column_xi )
-        rc = KOutMsg( "\tXI:i:%u", id );
-
-    /* to match sam-tools output: in case we are dumping this in CG-mode.... */
-    if ( rc == 0 && ( opts->cigar_treatment != ct_unchanged ) && ( atx->al_group_idx != COL_NOT_AVAILABLE ) )
-    {
-        const char * align_grp;
-        uint32_t align_grp_len;
-        rc = read_char_ptr( id, cursor, atx->al_group_idx, &align_grp, &align_grp_len, "ALIGN_GROUP" );
-        if ( rc == 0 && align_grp_len > 0 )
-        {
-            uint32_t i;
-            for ( i = 0; rc == 0 && i < align_grp_len - 1; ++i )
-            {
-                if ( align_grp[ i ] == '_' )
-                {
-                    rc = KOutMsg( "\tZI:i:%.*s\tZA:i:%.1s", i, align_grp, align_grp + i + 1 );
-                    break;
-                }
-            }
-        }
-    }
-    
-    /* OPT SAM-FIELD: NH     SRA-column: ALIGNMENT_COUNT */
-    if ( rc == 0 && atx->cmn.al_count_idx != COL_NOT_AVAILABLE )
-    {
-        const uint8_t * al_count;
-        uint32_t al_count_len;
-        rc = read_uint8_ptr( id, cursor, atx->cmn.al_count_idx, &al_count, &al_count_len, "ALIGNMENT_COUNT" );
-        if ( rc == 0 && al_count_len > 0 )
-            rc = KOutMsg( "\tNH:i:%u", *al_count );
-    }
-
-    /* OPT SAM-FIELD: NM     SRA-column: EDIT_DISTANCE */
-    if ( rc == 0 )
-        rc = KOutMsg( "\tNM:i:%u", ( cgc_output.edit_dist - NM_adjustments ) );
-
-    /* OPT SAM-FIELD: XS:A:+/-  SRA-column: RNA-SPLICING detected via computation */
-    if ( rc == 0 && opts->rna_splicing && ( candidates.fwd_matched > 0 || candidates.rev_matched > 0 ) )
-    {
-        if ( candidates.fwd_matched > 0 )
-            rc = KOutMsg( "\tXS:A:+" );
-        else 
-            rc = KOutMsg( "\tXS:A:-" );
-/*
-        uint32_t i;
-        KOutMsg( "\tXS:A:" );
-        for ( i = 0; i < candidates.count; ++i )
-        {
-            rna_splice_candidate * rsc = &candidates.candidates[ i ];
-            KOutMsg( "( offs=%u | len=%u | op_idx=%u | matech=%u )", rsc->offset, rsc->len, rsc->op_idx, rsc->matched );
-        }
-*/
-    }
-
-    if ( rc == 0 )
-        rc = KOutMsg( "\n" );
-    return rc;
-}
-
-
-static rc_t print_alignment_fastx( const samdump_opts * const opts, const char * ref_name,
-                                   INSDC_coord_zero pos, matecache * const mc,
-                                   const PlacementRecord * const rec, const align_table_context * const atx,
-                                   uint64_t * const rows_so_far )
-{
-    bool orientation;
-    const VCursor *cursor = atx->cmn.cursor;
-    int64_t mate_align_id;
-    const int64_t * seq_spot_id;
-    uint32_t seq_spot_id_len;
-
-    rc_t rc = read_int64_ptr( rec->id, cursor, atx->cmn.seq_spot_id_idx, &seq_spot_id, &seq_spot_id_len, "SEQ_SPOT_ID" );
-
-    /* this is here to detect if the mate is aligned, if NOT, we want to put it into the unaligned-cache! */
-    if ( rc == 0 && opts->print_half_unaligned_reads )
-    {
-        rc = read_int64( rec->id, cursor, atx->mate_align_id_idx, &mate_align_id, 0, "MATE_ALIGN_ID" );
-        if ( rc == 0 && mate_align_id == 0 && mc != NULL && opts->use_mate_cache )
-        {
-            rc = matecache_insert_unaligned( mc, atx->db_idx, rec->id, pos, atx->ref_idx, *seq_spot_id );
-        }
-    }
-
-    ( *rows_so_far )++;
-
-    if ( opts->output_format == of_fastq )
-        rc = KOutMsg( "@" );
-    else
-        rc = KOutMsg( ">" );
-
-    /* SAM-FIELD: QNAME     1.row: name */
-    if ( rc == 0 )
-    {
-        if ( seq_spot_id_len > 0 )
-        {
-            if ( opts->print_spot_group_in_name )
-            {
-                const char * spot_grp;
-                uint32_t spot_grp_len;
-                rc = read_char_ptr( rec->id, cursor, atx->cmn.seq_spot_group_idx, &spot_grp, &spot_grp_len, "SEQ_SPOT_GROUP" );
-                if ( rc == 0 )
-                    rc = dump_name( opts, *seq_spot_id, spot_grp, spot_grp_len ); /* sam-dump-opts.c */
-            }
-            else
-                rc = dump_name( opts, *seq_spot_id, NULL, 0 ); /* sam-dump-opts.c */
-        }
-        else
-            rc = KOutMsg( "*" );
-
-        if ( rc == 0 )
-        {
-            uint32_t seq_read_id;
-            rc = read_uint32( rec->id, cursor, atx->cmn.seq_read_id_idx, &seq_read_id, 0, "SEQ_READ_ID" );
-            if ( rc == 0 )
-                rc = KOutMsg( "/%u", seq_read_id );
-        }
-    }
-
-    /* SRA-column: REF_ORIENTATION ( bool ) ... needed for quality */
-    if ( rc == 0 )
-        rc = read_bool( rec->id, cursor, atx->cmn.ref_orientation_idx, &orientation, false, "REF_ORIENT" );
-
-    /* source of the alignment: primary/secondary/evidence */
-    if ( rc == 0 )
-    {
-        switch( atx->align_table_type )
-        {
-        case att_primary    :   rc = KOutMsg( " primary" ); break;
-        case att_secondary  :   rc = KOutMsg( " secondary" ); break;
-        case att_evidence   :   rc = KOutMsg( " evidence" ); break;
-        }
-    }
-
-    /* against what reference aligned, at what position, with what mapping-quality */
-    if ( rc == 0 )
-        rc = KOutMsg( " ref=%s pos=%u mapq=%i\n", ref_name, pos + 1, rec->mapq );
-
-    /* READ at a new line */
-    if ( rc == 0 )
-    {
-        const char * read;
-        uint32_t read_size;
-        rc = read_char_ptr( rec->id, cursor, atx->cmn.raw_read_idx, &read, &read_size, "RAW_READ" );
-        if ( rc == 0 )
-        {
-            if ( read_size > 0 )
-                rc = KOutMsg( "%.*s\n", read_size, read );
-            else
-                rc = KOutMsg( "*\n" );
-        }
-    }
-
-    /* QUALITY on a new line if in fastq-mode */
-    if ( rc == 0 && opts->output_format == of_fastq )
-    {
-        rc = KOutMsg( "+\n" );
-        if ( rc == 0 )
-        {
-            const char * quality;
-            uint32_t quality_size;
-            rc = read_char_ptr( rec->id, cursor, atx->cmn.sam_quality_idx, &quality, &quality_size, "SAM_QUALITY" );
-            if ( rc == 0 )
-            {
-                if ( quality_size > 0 )
-                    rc = dump_quality_33( opts, quality, quality_size, false );
-                else
-                    rc = KOutMsg( "*" );
-            }
-            if ( rc == 0 )
-                rc = KOutMsg( "\n" );
-        }
-    }
-
-    return rc;
-}
-
-
-/* print one record of alignment-information in SAM-format */
-static rc_t walk_position( const samdump_opts * const opts, PlacementSetIterator * const set_iter,
-                           const char * ref_name, INSDC_coord_zero pos,
-                           matecache * const mc, uint64_t * const rows_so_far,
-                           INSDC_coord_zero first_pos, INSDC_coord_len len )
-{
-    rc_t rc = 0;
-    while ( rc == 0 && !test_limit_reached( opts, *rows_so_far ) )
-    {
-        rc = Quitting ();
-        if ( rc == 0 )
-        {
-            const PlacementRecord *rec;
-            rc = PlacementSetIteratorNextRecordAt( set_iter, pos, &rec );
-            if ( rc != 0 )
-            {
-                if ( GetRCState( rc ) != rcDone )
-                {
-                    LOGERR( klogInt, rc, "PlacementSetIteratorNextRecordAt() failed" );
-                }
-            }
-            else
-            {
-                /* We have to do this here, becasue the nature of the iterator is to return all alignments that
-                   touch ( stick into ) the requested interval. But: sam-dump has to dump alignments that
-                   !! start !! in the requested interval. */
-                if ( pos >= first_pos )
-                {
-                    align_table_context * atx = PlacementRecord_get_ext_data_ptr( rec, placementRecordExtension0 );
-                    if ( atx == NULL )
-                    {
-                        rc = RC( rcExe, rcNoTarg, rcReading, rcParam, rcNull );
-                        LOGERR( klogInt, rc, "no placement-record-context available" );
-                    }
-                    else
-                    {
-                        if ( opts->output_format == of_sam )
-                        {
-                            if ( atx->align_table_type == att_evidence )
-                                rc = print_alignment_sam_ev( opts, ref_name, pos, rec, atx, rows_so_far );
-                            else
-                                rc = print_alignment_sam_ps( opts, ref_name, pos, mc, rec, atx, rows_so_far );
-                        }
-                        else
-                            rc = print_alignment_fastx( opts, ref_name, pos, mc, rec, atx, rows_so_far );
-                    }
-                }
-                PlacementRecordWhack ( rec );
-            }
-        }
-    }
-    if ( GetRCState( rc ) == rcDone ) rc = 0;
-    return rc;
-}
-
-
-static rc_t walk_window( const samdump_opts * const opts, PlacementSetIterator * const set_iter,
-                         const char * ref_name, matecache * const mc, uint64_t * const rows_so_far,
-                         INSDC_coord_zero first_pos, INSDC_coord_len len )
-{
-    rc_t rc = 0;
-    while ( rc == 0 && !test_limit_reached( opts, *rows_so_far ) )
-    {
-        rc = Quitting ();
-        if ( rc == 0 )
-        {
-            INSDC_coord_zero pos;
-            rc = PlacementSetIteratorNextAvailPos( set_iter, &pos, NULL );
-            if ( rc != 0 )
-            {
-                if ( GetRCState( rc ) != rcDone )
-                {
-                    LOGERR( klogInt, rc, "PlacementSetIteratorNextAvailPos() failed" );
-                }
-            }
-            else
-            {
-                rc = walk_position( opts, set_iter, ref_name, pos, mc, rows_so_far, first_pos, len );
-            }
-        }
-    }
-    if ( GetRCState( rc ) == rcDone ) rc = 0;
-    return rc;
-}
-
-
-static rc_t walk_reference( const samdump_opts * const opts, PlacementSetIterator * const set_iter,
-                            const char * ref_name, matecache * const mc, uint64_t * const rows_so_far )
-{
-    rc_t rc = 0;
-    while ( rc == 0 && !test_limit_reached( opts, *rows_so_far ) )
-    {
-        rc = Quitting ();
-        if ( rc == 0 )
-        {
-            INSDC_coord_zero first_pos;
-            INSDC_coord_len len;
-            rc = PlacementSetIteratorNextWindow( set_iter, &first_pos, &len );
-            if ( rc != 0 )
-            {
-                if ( GetRCState( rc ) != rcDone )
-                {
-                    LOGERR( klogInt, rc, "PlacementSetIteratorNextWindow() failed" );
-                }
-            }
-            else
-                rc = walk_window( opts, set_iter, ref_name, mc, rows_so_far, first_pos, len );
-        }
-    }
-    if ( GetRCState( rc ) == rcDone ) rc = 0;
-
-    if ( rc == 0 && mc != NULL && opts->use_mate_cache )
-        rc = matecache_clear_same_ref( mc );
-
-    return rc;
-}
-
-
-static rc_t walk_placements( const samdump_opts * const opts, PlacementSetIterator * const set_iter,
-                             matecache * const mc, uint64_t * const rows_so_far )
-{
-    rc_t rc = 0;
-    while ( rc == 0 && !test_limit_reached( opts, *rows_so_far ) )
-    {
-        struct ReferenceObj const * ref_obj;
-
-        rc = PlacementSetIteratorNextReference( set_iter, NULL, NULL, &ref_obj );
-        if ( rc == 0 )
-        {
-            if ( ref_obj != NULL )
-            {
-                const char * ref_name = NULL;
-                if ( opts->use_seqid_as_refname )
-                    rc = ReferenceObj_SeqId( ref_obj, &ref_name );
-                else
-                    rc = ReferenceObj_Name( ref_obj, &ref_name );
-
-                if ( rc == 0 )
-                    rc = walk_reference( opts, set_iter, ref_name, mc, rows_so_far );
-                else
-                {
-                    if ( opts->use_seqid_as_refname )
-                    {
-                        (void)LOGERR( klogInt, rc, "ReferenceObj_SeqId() failed" );
-                    }
-                    else
-                    {
-                        (void)LOGERR( klogInt, rc, "ReferenceObj_Name() failed" );
-                    }
-                }
-            }
-        }
-        else if ( GetRCState( rc ) != rcDone )
-        {
-            (void)LOGERR( klogInt, rc, "ReferenceIteratorNextReference() failed" );
-        }
-    }
-
-    if ( GetRCState( rc ) == rcDone )
-        rc = 0;
-    return rc;
-}
-
-
-
-static void CC destroy_align_table_context( void *item, void *data )
-{
-    align_table_context * atx = item;
-    free_align_table_context( atx );
-}
-
-
-static rc_t print_all_aligned_spots_of_this_reference( const samdump_opts * const opts, const input_database * const ids,
-                                                       matecache * const mc, const AlignMgr * const a_mgr,
-                                                       const ReferenceObj * const ref_obj, uint64_t * const rows_so_far )
-{
-    PlacementSetIterator * set_iter;
-    /* the we ask the alignment-manager to produce a placement-set-iterator... */
-    rc_t rc = AlignMgrMakePlacementSetIterator( a_mgr, &set_iter );
-    if ( rc != 0 )
-    {
-        (void)LOGERR( klogErr, rc, "cannot create PlacementSetIterator" );
-    }
-    else
-    {
-        /* here we need a vector to passed along into the creation of the iterators */
-        Vector context_list;
-        INSDC_coord_len ref_len;
-
-        VectorInit ( &context_list, 0, 5 );
-
-        rc = ReferenceObj_SeqLength( ref_obj, &ref_len );
-        if ( rc == 0 )
-        {
-            rc = add_pl_iters( opts, set_iter, ref_obj, ids,
-                0,                  /* where it starts on the reference */
-                ref_len,            /* the whole length of this reference/chromosome */
-                NULL,               /* no spotgroup re-grouping (yet) */
-                &context_list
-                );
-            if ( rc == 0 )
-                rc = walk_placements( opts, set_iter, mc, rows_so_far );
-        }
-
-        /* walk the context_list to free the align_table_context records, close/free the cursors... */
-        VectorWhack ( &context_list, destroy_align_table_context, NULL );
-        PlacementSetIteratorRelease( set_iter );
-    }
-    return rc;
-}
-
-
-/*
-   the user did not specify regions, print all alignments from all input-files
-   this is strategy #1 to do this, create a ref_iter for every reference each
-    + ... less cursors will be open at the same time, more resource efficient
-    - ... if more than one input-file, the output will be sorted only within each reference
-*/
-static rc_t print_all_aligned_spots_0( const samdump_opts * const opts, const input_files * const ifs,
-                                       matecache * const mc, const AlignMgr * const a_mgr, uint64_t * const rows_so_far )
-{
-    rc_t rc = 0;
-    uint32_t db_idx;
-    /* we now loop through all input-databases... */
-    for ( db_idx = 0; db_idx < ifs->database_count && rc == 0; ++db_idx )
-    {
-        const input_database * ids = VectorGet( &ifs->dbs, db_idx );
-        if ( ids != NULL )
-        {
-            uint32_t refobj_count;
-            rc = ReferenceList_Count( ids->reflist, &refobj_count );
-            if ( rc == 0 && refobj_count > 0 )
-            {
-                uint32_t ref_idx;
-                for ( ref_idx = 0; ref_idx < refobj_count && rc == 0; ++ref_idx )
-                {
-                    const ReferenceObj * ref_obj;
-                    rc = ReferenceList_Get( ids->reflist, &ref_obj, ref_idx );
-                    if ( rc == 0 && ref_obj != NULL )
-                    {
-                        rc = print_all_aligned_spots_of_this_reference( opts, ids, mc, a_mgr, ref_obj, rows_so_far );
-                        ReferenceObj_Release( ref_obj );
-                    }
-                }
-            }
-        }
-    }
-    return rc;
-}
-
-
-/*
-   the user did not specify regions, print all alignments from all input-files
-   this is strategy #2 to do this, throw all iterators for all input-files and all there references
-   into one set_iter.
-    + ... if more than one input-file, everything will be sorted
-    - ... creates a large number of open cursors ( because of sub-cursors due to schema-functions )
-          this can result in not beeing able to perform the functions at all because of running out of resources
-    - ... a long delay at start up, before the 1st alignment is printed ( all the cursors have to be opened )
-*/
-static rc_t print_all_aligned_spots_1( const samdump_opts * const opts, const input_files * const ifs,
-                                       matecache * const mc, const AlignMgr * const a_mgr, uint64_t * const rows_so_far )
-{
-    PlacementSetIterator * set_iter;
-    /* the we ask the alignment-manager to produce a placement-set-iterator... */
-    rc_t rc = AlignMgrMakePlacementSetIterator( a_mgr, &set_iter );
-    if ( rc != 0 )
-    {
-        (void)LOGERR( klogErr, rc, "cannot create PlacementSetIterator" );
-    }
-    else
-    {
-        /* here we need a vector to passed along into the creation of the iterators */
-        Vector context_list;
-        VectorInit ( &context_list, 0, 5 );
-
-        rc = prepare_whole_files( opts, ifs, set_iter, &context_list );
-
-        if ( rc == 0 )
-            rc = walk_placements( opts, set_iter, mc, rows_so_far );
-
-        /* walk the context_list to free the align_table_context records, close/free the cursors... */
-        VectorWhack ( &context_list, destroy_align_table_context, NULL );
-        PlacementSetIteratorRelease( set_iter );
-    }
-    return rc;
-}
-
-
-/*
-   the user has specified certain regions on the references,
-   print only alignments, that start in these regions
-*/
-static rc_t print_selected_aligned_spots( const samdump_opts * const opts, const input_files * const ifs,
-                                          matecache * const mc, const AlignMgr * const a_mgr, uint64_t * const rows_so_far )
-{
-    PlacementSetIterator * set_iter;
-    /* the we ask the alignment-manager to produce a placement-set-iterator... */
-    rc_t rc = AlignMgrMakePlacementSetIterator( a_mgr, &set_iter );
-    if ( rc != 0 )
-    {
-        (void)LOGERR( klogErr, rc, "cannot create PlacementSetIterator" );
-    }
-    else
-    {
-        /* here we need a vector to passed along into the creation of the iterators */
-        Vector context_list;
-        VectorInit ( &context_list, 0, 5 );
-
-        rc = prepare_regions( opts, ifs, set_iter, &context_list );
-
-        if ( rc == 0 )
-            rc = walk_placements( opts, set_iter, mc, rows_so_far );
-
-        /* walk the context_list to free the align_table_context records, close/free the cursors... */
-        VectorWhack ( &context_list, destroy_align_table_context, NULL );
-
-        PlacementSetIteratorRelease( set_iter );
-    }
-    return rc;
-}
-
-
-/*
-   this is called from sam-dump3.c, it prepares the iterators and then walks them
-   ---> only entry into this module <--- 
-*/
-rc_t print_aligned_spots( const samdump_opts * const opts, const input_files * const ifs,
-                          matecache * const mc, uint64_t * const rows_so_far )
-{
-    const AlignMgr * a_mgr;
-    /* first we make an alignment-manager */
-    rc_t rc = AlignMgrMakeRead( &a_mgr );
-    if ( rc != 0 )
-    {
-        (void)LOGERR( klogErr, rc, "cannot create alignment-manager" );
-    }
-    else
-    {
-        if ( opts->region_count == 0 )
-        {
-            /* the user did not specify regions to be printed ==> print all alignments */
-            switch( opts->dump_mode )
-            {
-                case dm_one_ref_at_a_time : rc = print_all_aligned_spots_0( opts, ifs, mc, a_mgr, rows_so_far ); break;
-                case dm_prepare_all_refs  : rc = print_all_aligned_spots_1( opts, ifs, mc, a_mgr, rows_so_far ); break;
-            }
-        }
-        else
-        {
-            /* the user did specify regions to be printed ==> print only the alignments in these regions */
-            rc = print_selected_aligned_spots( opts, ifs, mc, a_mgr, rows_so_far );
-        }
-        AlignMgrRelease( a_mgr );
-    }
-    return rc;
-}
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <align/manager.h>
+#include <align/iterator.h>
+#include <kapp/main.h>
+#include <ctype.h>
+#include <sysalloc.h>
+
+#include "read_fkt.h"
+#include "cg_tools.h"
+#include "rna_splice_log.h"
+#include "sam-aligned.h"
+
+const char * PRIM_TABLE = "PRIMARY_ALIGNMENT";
+const char * SEC_TABLE = "SECONDARY_ALIGNMENT";
+const char * EV_INT_TABLE = "EVIDENCE_INTERVAL";
+const char * EV_AL_TABLE = "EVIDENCE_ALIGNMENT";
+
+
+/* -------------------------------------------------------------------------------------------
+    column                      PRIM    SEC     EV_INT      EV_ALIGN ( outside of iterator )
+
+    SEQ_SPOT_ID                 X       X       -           X
+    SAM_FLAGS                   X       X       -           -
+    CIGAR_LONG                  X       X       X           X 
+    CIGAR_SHORT                 X       X       X           X
+    CIGAR_LONG_LEN              X       X       X           X 
+    CIGAR_SHORT_LEN             X       X       X           X
+    MATE_ALIGN_ID               X       X       -           -
+    MATE_REF_NAME               X       X       -           -
+    MATE_REF_POS                X       X       -           -
+    TEMPLATE_LEN                X       X       -           -
+    READ                        X       X       X           X
+    READ_LEN                    X       X       X           X
+    MISMATCH_READ               X       X       X           X
+    SAM_QUALITY                 X       X       X           X
+    REF_ORIENTATION             X       X       X           X
+    EDIT_DISTANCE               X       X       X           X
+    SEQ_SPOT_GROUP              X       X       -           X
+    SEQ_READ_ID                 X       X       -           X
+    RAW_READ                    X       X       X           X
+    READ_FILTER                 X       X       X           X
+    EVIDENCE_ALIGNMENT_IDS      -       -       X           -
+    REF_POS                                                 o
+    REF_PLOIDY                                              o
+    ALIGNMENT_COUNT             X       X       -           X
+    SEQ_NAME                                                X
+    MAPQ                                                    X
+    ALIGN_GROUP                 X       -       -           -
+    RNA_ORIENTATION             X       X
+
+   -------------------------------------------------------------------------------------------*/
+
+
+#define COL_NOT_AVAILABLE 0xFFFFFFFF
+
+#define COL_SEQ_SPOT_ID "(I64)SEQ_SPOT_ID"
+#define COL_SAM_FLAGS "(U32)SAM_FLAGS"
+#define COL_LONG_CIGAR "(ascii)CIGAR_LONG"
+#define COL_SHORT_CIGAR "(ascii)CIGAR_SHORT"
+#define COL_MATE_ALIGN_ID "(I64)MATE_ALIGN_ID"
+#define COL_MATE_REF_NAME "(ascii)MATE_REF_NAME"
+#define COL_MATE_REF_POS "(INSDC:coord:zero)MATE_REF_POS"
+#define COL_TEMPLATE_LEN "(I32)TEMPLATE_LEN"
+#define COL_MISMATCH_READ "(ascii)MISMATCH_READ"
+#define COL_SAM_QUALITY "(INSDC:quality:text:phred_33)SAM_QUALITY"
+#define COL_REF_ORIENTATION "(bool)REF_ORIENTATION"
+#define COL_EDIT_DIST "(U32)EDIT_DISTANCE"
+#define COL_SEQ_SPOT_GROUP "(ascii)SEQ_SPOT_GROUP"
+#define COL_SEQ_READ_ID "(INSDC:coord:one)SEQ_READ_ID"
+#define COL_RAW_READ "(INSDC:dna:text)RAW_READ"
+#define COL_PLOIDY "(NCBI:align:ploidy)PLOIDY"
+#define COL_CIGAR_LONG_LEN "(INSDC:coord:len)CIGAR_LONG_LEN"
+#define COL_CIGAR_SHORT_LEN "(INSDC:coord:len)CIGAR_SHORT_LEN"
+#define COL_READ_LEN "(INSDC:coord:len)READ_LEN"
+#define COL_EV_ALIGNMENTS "(I64)EVIDENCE_ALIGNMENT_IDS"
+#define COL_REF_POS "(INSDC:coord:zero)REF_POS"
+#define COL_REF_PLOIDY "(U32)REF_PLOIDY"
+#define COL_READ_FILTER "(INSDC:SRA:read_filter)READ_FILTER"
+#define COL_AL_COUNT "(U8)ALIGNMENT_COUNT"
+#define COL_SEQ_NAME "(ascii)SEQ_NAME"
+#define COL_MAPQ "(I32)MAPQ"
+#define COL_ALIGN_GROUP "(ascii)ALIGN_GROUP"
+#define COL_RNA_ORIENTATION "(ascii)RNA_ORIENTATION"
+
+enum align_table_type
+{
+    att_primary = 0,
+    att_secondary,
+    att_evidence
+};
+
+
+/* the part common to prim/sec/ev-alignment */
+typedef struct align_cmn_context
+{
+    const VCursor * cursor;
+
+    uint32_t seq_spot_id_idx;
+    uint32_t cigar_idx;
+    uint32_t cigar_len_idx;
+    uint32_t read_idx;
+    uint32_t read_len_idx;
+    uint32_t edit_dist_idx;
+    uint32_t seq_spot_group_idx;
+    uint32_t seq_read_id_idx;
+    uint32_t raw_read_idx;
+    uint32_t sam_quality_idx;
+    uint32_t ref_orientation_idx;
+    uint32_t read_filter_idx;
+    uint32_t al_count_idx;
+} align_cmn_context;
+
+
+typedef struct align_table_context
+{
+    CigOps * cig_op_buffer;
+    uint32_t cig_op_buffer_len;
+
+    /* which Reference-Obj in the ReferenceList we are aligning against... */
+    const ReferenceObj* ref_obj;
+    uint32_t ref_idx;
+
+    /* which index into the input-files object / needed to distinguish cache entries with the same number
+       but comming from different input-files */
+    uint32_t db_idx;
+
+    /* objects of which table are we aligning PRIM/SEC/EV ? */
+    enum align_table_type align_table_type;
+
+    /* the part common to prim/sec/ev-alignment */
+    align_cmn_context cmn;
+
+    /* this is specific to pim/sec */
+    uint32_t sam_flags_idx;
+    uint32_t mate_align_id_idx;
+    uint32_t mate_ref_name_idx;
+    uint32_t mate_ref_pos_idx;
+    uint32_t tlen_idx;
+    uint32_t rna_orientation_idx;
+
+    /* this is only in prim */
+    uint32_t al_group_idx;
+    
+    /* this is specific to ev-interval/ev-alignmnet */
+    uint32_t ploidy_idx;
+    uint32_t ev_alignments_idx;
+    uint32_t ref_pos_idx;
+    uint32_t ref_ploidy_idx;
+    uint32_t seq_name_idx;
+    uint32_t mapq_idx;
+
+    /* the common part repeats for evidence-alignment */
+    align_cmn_context eval;
+} align_table_context;
+
+
+static void invalidate_all_cmn_column_idx( align_cmn_context * const actx )
+{
+    actx->seq_spot_id_idx       = COL_NOT_AVAILABLE;
+    actx->cigar_idx             = COL_NOT_AVAILABLE;    
+    actx->cigar_len_idx         = COL_NOT_AVAILABLE;
+    actx->read_idx              = COL_NOT_AVAILABLE;
+    actx->read_len_idx          = COL_NOT_AVAILABLE;    
+    actx->edit_dist_idx         = COL_NOT_AVAILABLE;
+    actx->seq_spot_group_idx    = COL_NOT_AVAILABLE;
+    actx->seq_read_id_idx       = COL_NOT_AVAILABLE;
+    actx->raw_read_idx          = COL_NOT_AVAILABLE;
+    actx->sam_quality_idx       = COL_NOT_AVAILABLE;
+    actx->ref_orientation_idx   = COL_NOT_AVAILABLE;
+    actx->read_filter_idx       = COL_NOT_AVAILABLE;
+    actx->al_count_idx          = COL_NOT_AVAILABLE;
+}
+
+static void invalidate_all_column_idx( align_table_context * const atx )
+{
+    atx->sam_flags_idx      = COL_NOT_AVAILABLE;
+    atx->mate_align_id_idx  = COL_NOT_AVAILABLE;
+    atx->mate_ref_name_idx  = COL_NOT_AVAILABLE;
+    atx->mate_ref_pos_idx   = COL_NOT_AVAILABLE;
+    atx->tlen_idx           = COL_NOT_AVAILABLE;
+    atx->rna_orientation_idx= COL_NOT_AVAILABLE;
+    atx->ploidy_idx         = COL_NOT_AVAILABLE;
+    atx->ev_alignments_idx  = COL_NOT_AVAILABLE;
+    atx->ref_pos_idx        = COL_NOT_AVAILABLE;
+    atx->ref_ploidy_idx     = COL_NOT_AVAILABLE;
+    atx->seq_name_idx       = COL_NOT_AVAILABLE;
+    atx->mapq_idx           = COL_NOT_AVAILABLE;
+    atx->al_group_idx       = COL_NOT_AVAILABLE;
+    invalidate_all_cmn_column_idx( &atx->cmn );
+    invalidate_all_cmn_column_idx( &atx->eval );
+}
+
+
+static void init_align_table_context( align_table_context * const atx,
+                                      const uint32_t db_idx,
+                                      const ReferenceObj* ref_obj )
+{
+    atx->db_idx = db_idx;
+    atx->ref_obj = ref_obj;
+    atx->cig_op_buffer = NULL;
+    atx->cig_op_buffer_len = 0;
+    invalidate_all_column_idx( atx );
+}
+
+
+static void free_align_table_context( align_table_context * atx )
+{
+    if ( atx != NULL )
+    {
+        if ( atx->cig_op_buffer != NULL )
+            free( atx->cig_op_buffer );
+
+        VCursorRelease( atx->cmn.cursor );
+        VCursorRelease( atx->eval.cursor );
+        free( atx );
+    }
+}
+
+
+static rc_t adjust_align_table_context_cig_op_buffer( align_table_context * atx, uint32_t read_len )
+{
+    rc_t rc = 0;
+
+    uint32_t reqested = ( read_len * 3 );
+    if ( reqested < 1024 ) reqested = 1024;
+
+    if ( atx->cig_op_buffer_len < reqested )
+    {
+        void * org_buffer = NULL;
+
+        if ( atx->cig_op_buffer == NULL )
+            atx->cig_op_buffer = malloc( reqested );
+        else
+        {
+            org_buffer = atx->cig_op_buffer;
+            atx->cig_op_buffer = realloc( org_buffer, reqested );
+        }
+
+        if ( atx->cig_op_buffer == NULL )
+        {
+            rc = RC( rcExe, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+            (void)LOGERR( klogInt, rc, "cigar-op-buffer-allocation failed" );
+            if ( org_buffer != NULL )
+                free( org_buffer );
+        }
+        else
+        {
+            atx->cig_op_buffer_len = reqested;
+        }
+    }
+
+    return rc;
+}
+
+
+/* src: 'P'rimary, 'S'econdary, Evidence_'I'nterval, Evidence_'A'lignment */
+static rc_t prepare_cmn_table_rows( const samdump_opts * const opts,
+                                    const VTable * tbl,
+                                    align_cmn_context * const cmn,
+                                    char src,
+                                    struct KNamelist * available_columns )
+{
+    rc_t rc = 0;
+    const VCursor * cursor = cmn->cursor;
+
+    if ( src == 'P' || src == 'S' )
+        rc = add_column( cursor, COL_SEQ_SPOT_ID, &cmn->seq_spot_id_idx );
+
+    if ( rc == 0 )
+    {
+        if ( opts->use_long_cigar )
+        {
+            rc = add_column( cursor, COL_LONG_CIGAR, &cmn->cigar_idx );
+            if ( rc == 0 && ( src == 'I' || src == 'A' ) )
+                rc = add_column( cursor, COL_CIGAR_LONG_LEN, &cmn->cigar_len_idx );
+        }
+        else
+        {
+            rc = add_column( cursor, COL_SHORT_CIGAR, &cmn->cigar_idx );
+            if ( rc == 0 && ( src == 'I' || src == 'A' ) )
+                rc = add_column( cursor, COL_CIGAR_SHORT_LEN, &cmn->cigar_len_idx );
+        }
+    }
+
+    if ( rc == 0 )
+    {
+        if ( opts->print_matches_as_equal_sign )
+            rc = add_column( cursor, COL_MISMATCH_READ, &cmn->read_idx );
+        else
+            rc = add_column( cursor, COL_READ, &cmn->read_idx );
+    }
+
+    if ( rc == 0 )
+        rc = add_column( cursor, COL_READ_LEN, &cmn->read_len_idx );
+
+    if ( rc == 0 )
+        rc = add_column( cursor, COL_SAM_QUALITY, &cmn->sam_quality_idx );
+
+    if ( rc == 0 )
+        rc = add_column( cursor, COL_REF_ORIENTATION, &cmn->ref_orientation_idx );
+
+    if ( rc == 0 )
+        rc = add_column( cursor, COL_EDIT_DIST, &cmn->edit_dist_idx );
+
+    if ( rc == 0 && ( src == 'P' || src == 'S' || src == 'A' ) )
+        rc = add_column( cursor, COL_SEQ_SPOT_GROUP, &cmn->seq_spot_group_idx );
+
+    if ( rc == 0 && ( src == 'P' || src == 'S' || src == 'A' ) )
+        rc = add_column( cursor, COL_SEQ_READ_ID, &cmn->seq_read_id_idx );
+
+    if ( rc == 0 )
+        rc = add_column( cursor, COL_RAW_READ, &cmn->raw_read_idx );
+
+    if ( rc == 0 )
+        rc = add_column( cursor, COL_READ_FILTER, &cmn->read_filter_idx );
+
+    if ( rc == 0 && ( src == 'P' || src == 'S' || src == 'A' ) )
+        add_opt_column( cursor, available_columns, COL_AL_COUNT, &cmn->al_count_idx );
+
+    return rc;
+}
+
+
+static rc_t prepare_prim_sec_table_cursor( const samdump_opts * const opts,
+                                           const VDatabase * db,
+                                           const char * table_name,
+                                           align_table_context * const atx )
+{
+    const VTable *tbl;
+    rc_t rc = VDatabaseOpenTableRead( db, &tbl, "%s", table_name );
+    if ( rc != 0 )
+    {
+        (void)PLOGERR( klogInt, ( klogInt, rc, "VDatabaseOpenTableRead( $(tn) ) failed", "tn=%s", table_name ) );
+    }
+    else
+    {
+        if ( opts->cursor_cache_size == 0 )
+            rc = VTableCreateCursorRead( tbl, &atx->cmn.cursor );
+        else
+            rc = VTableCreateCachedCursorRead( tbl, &atx->cmn.cursor, opts->cursor_cache_size );
+        if ( rc != 0 )
+        {
+            (void)PLOGERR( klogInt, ( klogInt, rc, "VTableCreateCursorRead( $(tn) ) failed", "tn=%s", table_name ) );
+        }
+        else
+        {
+            struct KNamelist * available_columns;
+            char table_char = 'P';
+            const VCursor * cursor = atx->cmn.cursor;
+            
+            if ( cmp_pchar( table_name, "SECONDARY_ALIGNMENT" ) == 0 )
+                table_char = 'S';
+            
+            rc = VTableListReadableColumns ( tbl, &available_columns );
+            if ( rc != 0 )
+            {
+                (void)PLOGERR( klogInt, ( klogInt, rc, 
+                    "VTableListReadableColumns( $(src) ) failed", "src=%c", table_char ) );
+            }
+            else
+            {
+                rc = prepare_cmn_table_rows( opts, tbl, &atx->cmn, table_char, available_columns );
+
+                if ( rc == 0 )
+                    rc = add_column( cursor, COL_SAM_FLAGS, &atx->sam_flags_idx );
+
+                /*  i don't have to add REF_NAME or REF_SEQ_ID, because i have it from the ref_obj later
+                    i don't have to add REF_POS, because i have it from the iterator later
+                    i don't have to add MAPQ, it is in the PlacementRecord later
+                        ... when walking the iterator ...
+                */
+                if ( rc == 0 )
+                    rc = add_column( cursor, COL_MATE_ALIGN_ID, &atx->mate_align_id_idx );
+                if ( rc == 0 )
+                    rc = add_column( cursor, COL_MATE_REF_NAME, &atx->mate_ref_name_idx );
+                if ( rc == 0 )
+                    rc = add_column( cursor, COL_MATE_REF_POS, &atx->mate_ref_pos_idx );
+                if ( rc == 0 )
+                    rc = add_column( cursor, COL_TEMPLATE_LEN, &atx->tlen_idx );
+                if ( rc == 0 )
+                    add_opt_column( cursor, available_columns, COL_RNA_ORIENTATION, &atx->rna_orientation_idx );
+
+                if ( rc == 0 && ( table_char == 'P' ) )
+                    add_opt_column( cursor, available_columns, COL_ALIGN_GROUP, &atx->al_group_idx );
+                    
+                KNamelistRelease( available_columns );
+            }
+            if ( rc != 0 )
+                VCursorRelease( cursor );
+        }
+        VTableRelease ( tbl ); /* the cursor keeps the table alive */
+    }
+    return rc;
+}
+
+
+static rc_t prepare_sub_ev_alignment_table_cursor( const samdump_opts * const opts,
+                                                   const VDatabase * db,
+                                                   align_table_context * const atx )
+{
+    rc_t rc = add_column( atx->cmn.cursor, COL_EV_ALIGNMENTS, &atx->ev_alignments_idx );
+    if ( rc == 0 )
+    {
+        const VTable *evidence_alignment_tbl;
+        rc = VDatabaseOpenTableRead( db, &evidence_alignment_tbl, EV_AL_TABLE );
+        if ( rc != 0 )
+        {
+            (void)PLOGERR( klogInt, ( klogInt, rc, "VDatabaseOpenTableRead( $(tn) ) failed", "tn=%s", EV_AL_TABLE ) );
+        }
+        else
+        {
+            if ( opts->cursor_cache_size == 0 )
+                rc = VTableCreateCursorRead( evidence_alignment_tbl, &atx->eval.cursor );
+            else
+                rc = VTableCreateCachedCursorRead( evidence_alignment_tbl, &atx->eval.cursor, opts->cursor_cache_size );
+            if ( rc != 0 )
+            {
+                (void)PLOGERR( klogInt, ( klogInt, rc, "VTableCreateCursorRead( $(tn) ) failed", "tn=%s", EV_AL_TABLE ) );
+            }
+            else
+            {
+                struct KNamelist * available_columns;
+
+                rc = VTableListReadableColumns ( evidence_alignment_tbl, &available_columns );
+                if ( rc != 0 )
+                {
+                    (void)PLOGERR( klogInt, ( klogInt, rc, 
+                        "VTableListReadableColumns( $(src) ) failed", "src=%c", 'A' ) );
+                }
+                else
+                {
+                    rc = prepare_cmn_table_rows( opts, evidence_alignment_tbl, &atx->eval,
+                                'A', available_columns ); /* common to prim/sec/ev-align */
+                    KNamelistRelease( available_columns );
+                }
+                
+                if ( rc == 0 )
+                {
+                    /* special to ev-align */
+                    rc = add_column( atx->eval.cursor, COL_REF_POS, &atx->ref_pos_idx );
+                    if ( rc == 0 )
+                        rc = add_column( atx->eval.cursor, COL_REF_PLOIDY, &atx->ref_ploidy_idx );
+                    if ( rc == 0 )
+                        rc = add_column( atx->eval.cursor, COL_SEQ_NAME, &atx->seq_name_idx );
+                    if ( rc == 0 )
+                        rc = add_column( atx->eval.cursor, COL_MAPQ, &atx->mapq_idx );
+                }
+                rc = VCursorOpen( atx->eval.cursor );
+                if ( rc != 0 )
+                {
+                    (void)PLOGERR( klogInt, ( klogInt, rc, "VCursorOpen( $(tn) ) failed", "tn=%s", EV_AL_TABLE ) );
+                }
+            }
+            VTableRelease ( evidence_alignment_tbl ); /* the cursor keeps the table alive */
+        }
+    }
+    return rc;
+}
+
+
+static rc_t prepare_evidence_table_cursor( const samdump_opts * const opts,
+                                           const VDatabase * db,
+                                           const char * table_name,
+                                           align_table_context * const atx )
+{
+    const VTable *evidence_interval_tbl;
+    rc_t rc = VDatabaseOpenTableRead( db, &evidence_interval_tbl, "%s", table_name );
+    if ( rc != 0 )
+    {
+        (void)PLOGERR( klogInt, ( klogInt, rc, "VDatabaseOpenTableRead( $(tn) ) failed", "tn=%s", table_name ) );
+    }
+    else
+    {
+        if ( opts->cursor_cache_size == 0 )
+            rc = VTableCreateCursorRead( evidence_interval_tbl, &atx->cmn.cursor );
+        else
+            rc = VTableCreateCachedCursorRead( evidence_interval_tbl, &atx->cmn.cursor, opts->cursor_cache_size );
+        if ( rc != 0 )
+        {
+            (void)PLOGERR( klogInt, ( klogInt, rc, "VTableCreateCursorRead( $(tn) ) failed", "tn=%s", table_name ) );
+        }
+        else
+        {
+            struct KNamelist * available_columns;
+
+            rc = VTableListReadableColumns ( evidence_interval_tbl, &available_columns );
+            if ( rc != 0 )
+            {
+                (void)PLOGERR( klogInt, ( klogInt, rc, 
+                    "VTableListReadableColumns( $(src) ) failed", "src=%c", 'I' ) );
+            }
+            else
+            {
+                rc = prepare_cmn_table_rows( opts, evidence_interval_tbl, &atx->cmn,
+                            'I', available_columns ); /* common to prim/sec/ev-align */
+                KNamelistRelease( available_columns );
+            }
+        
+            if ( rc == 0 )
+                rc = add_column( atx->cmn.cursor, COL_PLOIDY, &atx->ploidy_idx );            
+
+            if ( rc == 0 && ( opts->dump_cg_sam || opts->dump_cg_ev_dnb ) )
+                rc = prepare_sub_ev_alignment_table_cursor( opts, db, atx );
+
+            if ( rc != 0 )
+                VCursorRelease( atx->cmn.cursor );
+        }
+        VTableRelease ( evidence_interval_tbl ); /* the cursor keeps the table alive */
+    }
+    return rc;
+}
+
+
+static rc_t add_table_pl_iter( const samdump_opts * const opts,
+                               PlacementSetIterator * const set_iter,
+                               const ReferenceObj * const ref_obj,
+                               const input_database * const idb,
+                               INSDC_coord_zero ref_pos,
+                               INSDC_coord_len ref_len,
+                               const char * spot_group,
+                               const char * table_name,
+                               align_id_src id_src_selector,
+                               Vector * const context_list )
+{
+    rc_t rc = 0;
+    align_table_context * atx;
+    PlacementRecordExtendFuncs ext_0; /* ReferenceObj_MakePlacementIterator makes copies of the elements */
+
+    memset( &ext_0, 0, sizeof ext_0 );
+    atx = calloc( 1, sizeof * atx );
+    if ( atx == NULL )
+    {
+        rc = RC( rcExe, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+        (void)PLOGERR( klogInt, ( klogInt, rc, "align-context-allocation for $(tn) failed", "tn=%s", table_name ) );
+    }
+    else
+    {
+        init_align_table_context( atx, idb->db_idx, ref_obj );
+        rc = ReferenceObj_Idx( ref_obj, &atx->ref_idx );
+        if ( rc != 0 )
+        {
+            (void)PLOGERR( klogInt, ( klogInt, rc, "failed to detect ref-idx for $(tn) failed", "tn=%s", table_name ) );
+        }
+        else
+        {
+            switch( id_src_selector )
+            {
+                case primary_align_ids   :  atx->align_table_type = att_primary;
+                                            rc = prepare_prim_sec_table_cursor( opts, idb->db, table_name, atx );
+                                            break;
+
+                case secondary_align_ids :  atx->align_table_type = att_secondary;
+                                            rc = prepare_prim_sec_table_cursor( opts, idb->db, table_name, atx );
+                                            break;
+
+                case evidence_align_ids  :  atx->align_table_type = att_evidence;
+                                            rc = prepare_evidence_table_cursor( opts, idb->db, table_name, atx );
+                                            break;
+            }
+        }
+        if ( rc == 0 )
+        {
+            ext_0.data = atx;
+            /* we must put the atx-ptr into a global list, in order to close everything later at the end... */
+        }
+        else
+            free_align_table_context( atx );
+    }
+
+    if ( rc == 0 )
+    {
+        int32_t min_mapq = 0;
+        PlacementIterator *pl_iter;
+
+        if ( opts->use_min_mapq )
+            min_mapq = opts->min_mapq;
+
+        rc = ReferenceObj_MakePlacementIterator( ref_obj, /* the reference-obj it is made from */
+            &pl_iter,           /* the placement-iterator we want to make */
+            ref_pos,            /* where it starts on the reference */
+            ref_len,            /* the whole length of this reference/chromosome */
+            min_mapq,           /* no minimal mapping-quality to filter out */
+            NULL,               /* no special reference-cursor */
+            atx->cmn.cursor,    /* a cursor into the PRIMARY/SECONDARY/EVIDENCE-table */
+            id_src_selector,    /* what ID-source to select from REFERENCE-table (ref_obj) */
+            &ext_0,             /* placement-record extensions #0 with data-ptr pointing to cursor/index-struct */
+            NULL,               /* no placement-record extensions #1 */
+            spot_group,         /* optional spotgroup re-grouping */
+            NULL                /* source-cursor specific data/context */
+            );
+        if ( rc == 0 )
+        {
+            rc = PlacementSetIteratorAddPlacementIterator ( set_iter, pl_iter );
+            if ( GetRCState( rc ) == rcDone ) { rc = 0; }
+        }
+    }
+
+    if ( rc == 0 )
+        rc = VectorAppend ( context_list, NULL, atx );
+    return rc;
+}
+
+
+static rc_t add_pl_iters( const samdump_opts * const opts,
+                          PlacementSetIterator * const set_iter,
+                          const ReferenceObj * const ref_obj,
+                          const input_database * const idb,
+                          INSDC_coord_zero ref_pos,
+                          INSDC_coord_len ref_len,
+                          const char * spot_group,
+                          Vector * const context_list )
+{
+    KNamelist *tables;
+    rc_t rc = VDatabaseListTbl( idb->db, &tables );
+    if ( rc != 0 )
+    {
+        (void)PLOGERR( klogInt, ( klogInt, rc, "VDatabaseListTbl( $(tn) ) failed", "tn=%s", idb->path ) );
+    }
+    else
+    {
+        if ( opts->dump_primary_alignments && namelist_contains( tables, PRIM_TABLE ) ) /* read_fkt.c */
+        {
+            rc = add_table_pl_iter( opts, set_iter, ref_obj, idb, ref_pos, ref_len, spot_group, 
+                                    PRIM_TABLE, primary_align_ids, context_list );
+        }
+
+        if ( rc == 0 && opts->dump_secondary_alignments && namelist_contains( tables, SEC_TABLE ) )
+        {
+            rc = add_table_pl_iter( opts, set_iter, ref_obj, idb, ref_pos, ref_len, spot_group, 
+                                    SEC_TABLE, secondary_align_ids, context_list );
+        }
+
+        if ( rc == 0 )
+        {
+            bool b0 = ( opts->dump_cg_evidence && 
+                        namelist_contains( tables, EV_INT_TABLE ) );
+
+            bool b1 = ( ( opts->dump_cg_sam || opts->dump_cg_ev_dnb ) && 
+                        namelist_contains( tables, EV_INT_TABLE ) &&
+                        namelist_contains( tables, EV_AL_TABLE ) );
+
+            if ( b0 || b1 )
+            {
+                rc = add_table_pl_iter( opts, set_iter, ref_obj, idb, ref_pos, ref_len, spot_group, 
+                                        EV_INT_TABLE, evidence_align_ids, context_list );
+            }
+        }
+        KNamelistRelease( tables );
+    }
+    return rc;
+}
+
+
+/* the user did not specify ranges on the reference, that means the whole file has to be dumped...
+   the reflist is iterated over all ref-objects it contains ... */
+static rc_t prepare_whole_files( const samdump_opts * const opts,
+                                 const input_files * const ifs,
+                                 PlacementSetIterator * const set_iter,
+                                 Vector * const context_list )
+{
+    rc_t rc = 0;
+    uint32_t db_idx;
+    /* we now loop through all input-databases... */
+    for ( db_idx = 0; db_idx < ifs->database_count && rc == 0; ++db_idx )
+    {
+        const input_database * idb = VectorGet( &ifs->dbs, db_idx );
+        if ( idb != NULL )
+        {
+            uint32_t refobj_count;
+            rc = ReferenceList_Count( idb->reflist, &refobj_count );
+            if ( rc == 0 && refobj_count > 0 )
+            {
+                uint32_t ref_idx;
+                for ( ref_idx = 0; ref_idx < refobj_count && rc == 0; ++ref_idx )
+                {
+                    const ReferenceObj* ref_obj;
+                    rc = ReferenceList_Get( idb->reflist, &ref_obj, ref_idx );
+                    if ( rc == 0 && ref_obj != NULL )
+                    {
+                        INSDC_coord_len ref_len;
+                        rc = ReferenceObj_SeqLength( ref_obj, &ref_len );
+                        if ( rc == 0 )
+                            rc = add_pl_iters( opts,
+                                set_iter,
+                                ref_obj,
+                                idb,
+                                0,                  /* where it starts on the reference */
+                                ref_len,            /* the whole length of this reference/chromosome */
+                                NULL,               /* no spotgroup re-grouping (yet) */
+                                context_list
+                                );
+                        ReferenceObj_Release( ref_obj );
+                    }
+                }
+            }
+        }
+    }
+    return rc;
+}
+
+
+typedef struct on_region_ctx
+{
+    rc_t rc;
+    const samdump_opts * opts;
+    input_database * idb;
+    PlacementSetIterator * set_iter;
+    Vector *context_list;
+} on_region_ctx;
+
+
+static void CC on_region( BSTNode *n, void *data )
+{
+    on_region_ctx * rctx = data;
+    if ( rctx->rc == 0 )
+    {
+        reference_region * ref_rgn = ( reference_region * )n;
+        const ReferenceObj * ref_obj;
+        rctx->rc = ReferenceList_Find( rctx->idb->reflist, &ref_obj, ref_rgn->name, string_size( ref_rgn->name ) );
+        if ( rctx->rc == 0 )
+        {
+            uint32_t range_idx, range_count = VectorLength( &ref_rgn->ranges );
+            for ( range_idx = 0; range_idx < range_count && rctx->rc == 0; ++range_idx )
+            {
+                range * r = VectorGet( &ref_rgn->ranges, range_idx );
+                if ( r != NULL )
+                {
+                    INSDC_coord_len len;
+                    if ( r->start == 0 && r->end == 0 )
+                    {
+                        r->start = 1;
+                        rctx->rc = ReferenceObj_SeqLength( ref_obj, &len );
+                        if ( rctx->rc == 0 )
+                            r->end = ( r->start + len );
+                    }
+                    else
+                    {
+                        len = ( r->end - r->start + 1 );
+                    }
+                    if ( rctx->rc == 0 )
+                    {
+                        rctx->rc = add_pl_iters( rctx->opts, rctx->set_iter, ref_obj, rctx->idb,
+                            r->start,           /* where the range starts on the reference */
+                            len,                /* the length of this range */
+                            NULL,               /* no spotgroup re-grouping (yet) */
+                            rctx->context_list
+                            );
+                    }
+                }
+            }
+            ReferenceObj_Release( ref_obj );
+        }
+        else
+        {
+            if ( GetRCState( rctx->rc ) == rcNotFound ) rctx->rc = 0;
+        }
+    }
+}
+
+
+static rc_t prepare_regions( const samdump_opts * const opts,
+                             const input_files * const ifs,
+                             PlacementSetIterator * const set_iter,
+                             Vector * const context_list )
+{
+    uint32_t db_idx;
+    on_region_ctx rctx;
+
+    rctx.rc = 0;
+    rctx.opts = opts;
+    rctx.set_iter = set_iter;
+    rctx.context_list = context_list;
+    /* we now loop through all input-databases... */
+    for ( db_idx = 0; db_idx < ifs->database_count && rctx.rc == 0; ++db_idx )
+    {
+        rctx.idb = VectorGet( &ifs->dbs, db_idx );
+        if ( rctx.idb != NULL )
+            BSTreeForEach( ( BSTree * ) &opts->regions, false, on_region, &rctx );
+    }
+    return rctx.rc;
+}
+
+
+static uint32_t calc_mate_flags( uint32_t flags )
+{
+    uint32_t res = ( flags & 0x1 ) |
+                   ( flags & 0x2 ) |
+                   ( ( flags & 0x8 ) >> 1 ) |
+                   ( ( flags & 0x4 ) << 1 ) |
+                   ( ( flags & 0x20 ) >> 1 ) |
+                   ( ( flags & 0x10 ) << 1 ) |
+                   ( ( flags & 0x40 ) ? 0x80 : 0x40 ) |
+                   ( flags & 0x700 );
+    return res;
+}
+
+
+static const char *equal_sign = "=";
+
+
+static rc_t print_qslice( const samdump_opts * const opts,
+                          bool reverse,
+                          const char * source,
+                          uint32_t source_str_len,
+                          uint32_t * source_offset,
+                          const uint32_t * source_len_vector,
+                          uint32_t source_len_vector_len,
+                          uint32_t slice_nr )
+{
+    rc_t rc = 0;
+    if ( *source_offset > source_str_len || slice_nr >= source_len_vector_len )
+        rc = RC( rcExe, rcNoTarg, rcReading, rcParam, rcInvalid );
+    else
+    {
+        uint32_t len = source_len_vector[ slice_nr ];
+        if ( len > 0 )
+        {
+            const char * ptr = &source[ *source_offset ];
+            rc = dump_quality_33( opts, ptr, len, reverse ); /* sam-dump-opts.c */
+            if ( rc == 0 )
+            {
+                rc = KOutMsg( "\t" );
+                if ( rc == 0 )
+                    *source_offset += len;
+            }
+        }
+        else
+            rc = KOutMsg( "*\t" );
+    }
+    return rc;
+}
+
+
+static rc_t modify_and_print_cigar( const char * cigar,
+                                    size_t cigar_len,
+                                    CigOps *ref_cig,
+                                    int32_t ref_cig_len,
+                                    INSDC_coord_zero ref_pos,
+                                    uint32_t read_len )
+{
+    rc_t rc;
+    if ( cigar_len > 0 )
+    {
+        char cigbuf[ MAX_CG_CIGAR_LEN ];
+        CigOps al_cig[ 1024 ];
+        ExplodeCIGAR( al_cig, 1024, cigar, cigar_len );
+        CombineCIGAR( cigbuf, al_cig, read_len, ref_pos, ref_cig, ref_cig_len );
+        rc = KOutMsg( "%s\t", cigbuf );
+    }
+    else
+        rc = KOutMsg( "*\t" );
+    return rc;
+}
+
+
+static rc_t get_READ_QUALITY_EDIT_DIST( cg_cigar_output * cgc_output,
+                                        int64_t align_id,
+                                        const align_cmn_context * acc )
+{
+    /* get READ, QUALITY and EIDT_DIST before cigar manipulation because we need/change these values */
+    rc_t rc = read_char_ptr( align_id, acc->cursor, acc->read_idx, &cgc_output->p_read.ptr, &cgc_output->p_read.len, "READ" );
+    if ( rc == 0 )
+        rc = read_char_ptr( align_id, acc->cursor, acc->sam_quality_idx, &cgc_output->p_quality.ptr, &cgc_output->p_quality.len, "SAM_QUALITY" );
+    if ( rc == 0 )
+        rc = read_int32( align_id, acc->cursor, acc->edit_dist_idx, &cgc_output->edit_dist, 0, "EDIT_DIST" );
+    cgc_output->p_tags.len = 0;
+    return rc;
+}
+
+
+static rc_t read_ref_orientation_and_seq_read_id( cg_cigar_input * cgc_input,
+                                                  int64_t align_id,
+                                                  const align_cmn_context * acc )
+{
+    rc_t rc = read_bool( align_id, acc->cursor, acc->ref_orientation_idx, &cgc_input->orientation, false, "REF_ORIENT" );
+    if ( rc == 0 )
+        rc = read_INSDC_coord_one( align_id, acc->cursor, acc->seq_read_id_idx, &cgc_input->seq_req_id, 0, "SEQ_READ_ID" );
+    return rc;
+}
+
+/* this function expects:
+    READ        in : cgc_output->p_read.ptr, cgc_output->p_read.len
+    SAM_QUALITY in : cgc_output->p_quality.ptr, cgc_output->p_quality.len
+    CIGAR       in : cgc_input->p_cigar.ptr, cgc_input->p_cigar.len
+    EDIT_DIST   in : cgc_output->edit_dist
+*/
+static rc_t cg_cigar_treatments( enum cigar_treatment what_treatment,
+                                 cg_cigar_input * cgc_input,
+                                 cg_cigar_output * cgc_output,
+                                 int64_t align_id,
+                                 const align_cmn_context * acc )
+{
+    rc_t rc = 0;
+    switch ( what_treatment )
+    {
+        case ct_unchanged : cgc_output->p_cigar.len  = cgc_input->p_cigar.len;
+                            cgc_output->p_cigar.ptr = cgc_input->p_cigar.ptr;
+                            break;
+
+        case ct_cg_style  : rc = read_ref_orientation_and_seq_read_id( cgc_input, align_id, acc );
+                            if ( rc == 0 )
+                            {
+                                cgc_input->edit_dist_available = true;
+                                cgc_input->edit_dist = cgc_output->edit_dist;
+                                rc = make_cg_cigar( cgc_input, cgc_output );
+                                if ( rc == 0 )
+                                {
+                                    cgc_output->p_cigar.len = cgc_output->cigar_len;
+                                    cgc_output->p_cigar.ptr = cgc_output->cigar;
+                                }
+                            }
+                            break;
+
+        case ct_cg_merge :  rc = read_ref_orientation_and_seq_read_id( cgc_input, align_id, acc );
+                            if ( rc == 0 )
+                            {
+                                cgc_input->p_read.ptr = cgc_output->p_read.ptr;
+                                cgc_input->p_read.len = cgc_output->p_read.len;
+                                cgc_input->p_quality.ptr = cgc_output->p_quality.ptr;
+                                cgc_input->p_quality.len = cgc_output->p_quality.len;
+                                cgc_input->edit_dist_available = true;
+                                cgc_input->edit_dist = cgc_output->edit_dist;
+                                rc = make_cg_merge( cgc_input, cgc_output );
+                                if ( rc == 0 )
+                                {
+                                    cgc_output->p_cigar.len = cgc_output->cigar_len;
+                                    cgc_output->p_cigar.ptr = cgc_output->cigar;
+                                }
+                            }
+                            break;
+    }
+    return rc;
+}
+
+
+/* triggered by option "--CG-SAM" */
+static rc_t print_evidence_alignment_cg_sam( const samdump_opts * const opts,
+                                             const PlacementRecord * const rec,
+                                             const align_table_context * const atx,
+                                             int64_t align_id,
+                                             uint32_t ploidy_idx,
+                                             const char * ref_name,
+                                             INSDC_coord_zero allele_pos,
+                                             int32_t ref_cig_len )
+{
+    const VCursor * cursor = atx->eval.cursor;
+    INSDC_coord_zero ref_pos;
+    uint32_t seq_name_len, sam_flags, spot_group_len = 0;
+    const char * seq_name, * spot_group;
+    int32_t mapq;
+    cg_cigar_output cgc_output;
+
+    rc_t rc = read_char_ptr( align_id, cursor, atx->seq_name_idx, &seq_name, &seq_name_len, "SEQ_NAME" );
+    if ( rc == 0 && atx->eval.seq_spot_group_idx != COL_NOT_AVAILABLE )
+        rc = read_char_ptr( align_id, cursor, atx->eval.seq_spot_group_idx, &spot_group, &spot_group_len, "SEQ_SPOT_GROUP" );
+
+    if ( rc == 0 )
+    {
+        if ( opts->print_cg_names )
+        {
+            if ( spot_group_len > 0 )
+                /* SAM-FIELD: QNAME     constructed from spot-group/seq-name */
+                rc = KOutMsg( "%.*s-1:%.*s\t", spot_group_len, spot_group, seq_name_len, seq_name );
+
+        }
+        else
+        {
+            if ( seq_name_len > 0 )
+                /* SAM-FIELD: QNAME     constructed from allel-id/sub-id */
+                rc = KOutMsg( "%.*s/ALLELE_%li.%u\t", seq_name_len, seq_name, rec->id, ploidy_idx );
+        }
+    }
+
+    if ( rc == 0 )
+        rc = read_INSDC_coord_zero( align_id, cursor, atx->ref_pos_idx, &ref_pos, 0, "REF_POS" );
+
+    if ( rc == 0 )
+        rc = read_int32( align_id, cursor, atx->mapq_idx, &mapq, 0, "MAPQ" );
+
+    if ( rc == 0 )
+    {
+        uint8_t ref_orient;
+        rc = read_uint8( align_id, cursor, atx->eval.ref_orientation_idx, &ref_orient, 0, "REF_ORIENT" );
+        if ( rc == 0 )
+        {
+            INSDC_coord_one seq_read_id;
+            bool cmpl = ref_orient;
+            rc = read_INSDC_coord_one( align_id, cursor, atx->eval.seq_read_id_idx, &seq_read_id, 0, "SEQ_READ_ID" );
+            sam_flags = ( 1 | ( cmpl ? 0x10 : 0 ) | ( seq_read_id == 1 ? 0x40 : 0x80 ) );
+        }
+    }
+
+    /* SAM-FIELD: FLAG      SRA-column: SAM_FLAGS ( uint32 ) */
+    /* SAM-FIELD: RNAME     SRA-column: ALLEL-NAME.ploidy_idx */
+    /* SAM-FIELD: POS       SRA-column: REF_POS + 1 */
+    /* SAM-FIELD: MAPQ      SRA-column: MAPQ ( from evidence-alignment-table, not from allel! ) */
+    if ( rc == 0 )
+        rc = KOutMsg( "%u\t%s\t%i\t%d\t", sam_flags, ref_name, allele_pos + ref_pos + 1, mapq );
+
+    /* get READ, QUALITY and EIDT_DIST before cigar manipulation because we need/change these values */
+    if ( rc == 0 )
+        rc = get_READ_QUALITY_EDIT_DIST( &cgc_output, align_id, &atx->eval );
+
+    /* SAM-FIELD: CIGAR     SRA-column: CIGAR_SHORT / with special treatment */
+    if ( rc == 0 )
+    {
+        cg_cigar_input cgc_input;
+        rc = read_char_ptr( align_id, cursor, atx->eval.cigar_idx, &cgc_input.p_cigar.ptr, &cgc_input.p_cigar.len, "CIGAR" );
+        if ( rc == 0 )
+            rc = cg_cigar_treatments( opts->cigar_treatment, &cgc_input, &cgc_output, align_id, &atx->eval );
+        if ( rc == 0 )
+            rc = modify_and_print_cigar( cgc_output.p_cigar.ptr, cgc_output.p_cigar.len,
+                                         atx->cig_op_buffer, ref_cig_len, ref_pos, cgc_output.p_read.len );
+    }
+
+    /* SAM-FIELD: RNEXT     SRA-column: MATE_REF_NAME '*' no mates! */
+    /* SAM-FIELD: PNEXT     SRA-column: MATE_REF_POS + 1 '0' no mates */
+    /* SAM-FIELD: TLEN      SRA-column: TEMPLATE_LEN '0' not in table */
+    /* SAM-FIELD: SEQ       SRA-column: READ  */
+    if ( rc == 0 )
+        rc = KOutMsg( "*\t0\t0\t%.*s\t", cgc_output.p_read.len, cgc_output.p_read.ptr );
+
+    /* SAM-FIELD: QUAL      SRA-column: SAM_QUALITY */
+    if ( rc == 0 && cgc_output.p_quality.len > 0 )
+        rc = dump_quality_33( opts, cgc_output.p_quality.ptr, cgc_output.p_quality.len, false ); /* sam-dump-opts.c */
+
+    /* OPT SAM-FIELD: RG     SRA-column: SEQ_SPOT_GROUP */
+    if ( rc == 0 && spot_group_len > 0 )
+        rc = KOutMsg( "\tRG:Z:%.*s", spot_group_len, spot_group );
+
+    if ( rc == 0 && cgc_output.p_tags.len > 0 )
+        rc = KOutMsg( "\t%.*s", cgc_output.p_tags.len, cgc_output.p_tags.ptr );
+
+    /* OPT SAM-FIELD: ZI     SRA-column: rec->id */
+    /* OPT SAM-FIELD: ZA     SRA-column: ploidy_idx */
+    if ( rc == 0 )
+        rc = KOutMsg( "\tZI:i:%li\tZA:i:%u", rec->id, ploidy_idx );
+
+    /* OPT SAM-FIELD: NH     SRA-column: ALIGNMENT_COUNT */
+    if ( rc == 0 && atx->eval.al_count_idx != COL_NOT_AVAILABLE )
+    {
+        const uint8_t * al_count;
+        uint32_t al_count_len;
+        rc = read_uint8_ptr( align_id, cursor, atx->eval.al_count_idx, &al_count, &al_count_len, "ALIGNMENT_COUNT" );
+        if ( rc == 0 && al_count_len > 0 )
+            rc = KOutMsg( "\tNH:i:%u", *al_count );
+    }
+
+    /* OPT SAM-FIELD: NM     SRA-column: EDIT_DISTANCE */
+    if ( rc == 0 )
+        rc = KOutMsg( "\tNM:i:%u", cgc_output.edit_dist );
+
+    /* OPT SAM-FIELD: XI     SRA-column: ALIGN_ID */
+    if ( rc == 0 && opts->print_alignment_id_in_column_xi )
+        rc = KOutMsg( "\tXI:i:%u", align_id );
+
+    if ( rc == 0 )
+        rc = KOutMsg( "\n" );
+
+    return rc;
+}
+
+
+/*  triggered by option --CG-evidence-dnb */
+static rc_t print_evidence_alignment_cg_ev_dnb( const samdump_opts * const opts,
+                                                const PlacementRecord * const rec,
+                                                const align_table_context * const atx,
+                                                int64_t align_id,
+                                                uint32_t ploidy_idx )
+{
+    const VCursor * cursor = atx->eval.cursor;
+    INSDC_coord_zero ref_pos;
+    uint32_t seq_name_len, sam_flags, spot_group_len = 0;
+    int32_t mapq;
+    const char * seq_name, * spot_group;
+    cg_cigar_output cgc_output;
+
+    rc_t rc = read_char_ptr( align_id, cursor, atx->seq_name_idx, &seq_name, &seq_name_len, "SEQ_NAME" );
+    if ( rc == 0 && atx->eval.seq_spot_group_idx != COL_NOT_AVAILABLE )
+        rc = read_char_ptr( align_id, cursor, atx->eval.seq_spot_group_idx, &spot_group, &spot_group_len, "SEQ_SPOT_GROUP" );
+
+    if ( rc == 0 )
+    {
+        if ( opts->print_cg_names )
+        {
+            if ( spot_group_len > 0 )
+                /* SAM-FIELD: QNAME     constructed from spot-group/seq-name */
+                rc = KOutMsg( "%.*s-1:%.*s\t", spot_group_len, spot_group, seq_name_len, seq_name );
+
+        }
+        else
+        {
+            if ( seq_name_len > 0 )
+                /* SAM-FIELD: QNAME     constructed from allel-id/sub-id */
+                rc = KOutMsg( "%.*s/ALLELE_%li.%u\t", seq_name_len, seq_name, rec->id, ploidy_idx );
+        }
+    }
+
+    if ( rc == 0 )
+        rc = read_INSDC_coord_zero( align_id, cursor, atx->ref_pos_idx, &ref_pos, 0, "REF_POS" );
+
+    if ( rc == 0 )
+        rc = read_int32( align_id, cursor, atx->mapq_idx, &mapq, 0, "MAPQ" );
+
+    if ( rc == 0 )
+    {
+        uint8_t ref_orient;
+        rc = read_uint8( align_id, cursor, atx->eval.ref_orientation_idx, &ref_orient, 0, "REF_ORIENT" );
+        if ( rc == 0 )
+        {
+            INSDC_coord_one seq_read_id;
+            bool cmpl = ref_orient;
+            rc = read_INSDC_coord_one( align_id, cursor, atx->eval.seq_read_id_idx, &seq_read_id, 0, "SEQ_READ_ID" );
+            sam_flags = ( 1 | ( cmpl ? 0x10 : 0 ) | ( seq_read_id == 1 ? 0x40 : 0x80 ) );
+        }
+    }
+
+    /* SAM-FIELD: FLAG      SRA-column: SAM_FLAGS ( uint32 ) */
+    /* SAM-FIELD: RNAME     SRA-column: ALLEL-NAME.ploidy_idx */
+    /* SAM-FIELD: POS       SRA-column: REF_POS + 1 */
+    /* SAM-FIELD: MAPQ      SRA-column: MAPQ ( from evidence-alignment-table, not from allel! ) */
+    if ( rc == 0 )
+        rc = KOutMsg( "%u\tALLELE_%li.%u\t%i\t%d\t", sam_flags, rec->id, ploidy_idx, ref_pos + 1, mapq );
+
+    /* get READ, QUALITY and EIDT_DIST before cigar manipulation because we need/change these values */
+    if ( rc == 0 )
+        rc = get_READ_QUALITY_EDIT_DIST( &cgc_output, align_id, &atx->eval );
+
+    /* SAM-FIELD: CIGAR     SRA-column: CIGAR_SHORT / with or without treatment */
+    if ( rc == 0 )
+    {
+        cg_cigar_input cgc_input;
+        rc = read_char_ptr( align_id, cursor, atx->eval.cigar_idx, &cgc_input.p_cigar.ptr, &cgc_input.p_cigar.len, "CIGAR" );
+        if ( rc == 0 )
+        rc = cg_cigar_treatments( opts->cigar_treatment, &cgc_input, &cgc_output, align_id, &atx->eval );
+        if ( rc == 0 )
+            rc = cg_canonical_print_cigar( cgc_output.p_cigar.ptr, cgc_output.p_cigar.len);
+	    if(rc == 0) rc = KOutMsg( "\t");
+    }
+
+    /* SAM-FIELD: RNEXT     SRA-column: MATE_REF_NAME '*' no mates! */
+    /* SAM-FIELD: PNEXT     SRA-column: MATE_REF_POS + 1 '0' no mates */
+    /* SAM-FIELD: TLEN      SRA-column: TEMPLATE_LEN '0' not in table */
+    /* SAM-FIELD: SEQ       SRA-column: READ  */
+    if ( rc == 0 )
+        rc = KOutMsg( "*\t0\t0\t%.*s\t", cgc_output.p_read.len, cgc_output.p_read.ptr );
+
+    /* SAM-FIELD: QUAL      SRA-column: SAM_QUALITY */
+    if ( rc == 0 && cgc_output.p_quality.len > 0 )
+        rc = dump_quality_33( opts, cgc_output.p_quality.ptr, cgc_output.p_quality.len, false ); /* sam-dump-opts.c */
+
+    /* OPT SAM-FIELD: RG     SRA-column: SEQ_SPOT_GROUP */
+    if ( rc == 0 && spot_group_len > 0 )
+        rc = KOutMsg( "\tRG:Z:%.*s", spot_group_len, spot_group );
+
+    if ( rc == 0 && cgc_output.p_tags.len > 0 )
+        rc = KOutMsg( "\t%.*s", cgc_output.p_tags.len, cgc_output.p_tags.ptr );
+
+    /* OPT SAM-FIELD: NH     SRA-column: ALIGNMENT_COUNT */
+    if ( rc == 0 && atx->eval.al_count_idx != COL_NOT_AVAILABLE )
+    {
+        const uint8_t * al_count;
+        uint32_t al_count_len;
+        rc = read_uint8_ptr( align_id, cursor, atx->eval.al_count_idx, &al_count, &al_count_len, "ALIGNMENT_COUNT" );
+        if ( rc == 0 && al_count_len > 0 )
+            rc = KOutMsg( "\tNH:i:%u", *al_count );
+    }
+
+    /* OPT SAM-FIELD: NM     SRA-column: EDIT_DISTANCE */
+    if ( rc == 0 )
+        rc = KOutMsg( "\tNM:i:%u", cgc_output.edit_dist );
+
+    /* OPT SAM-FIELD: XI     SRA-column: ALIGN_ID */
+    if ( rc == 0 && opts->print_alignment_id_in_column_xi )
+        rc = KOutMsg( "\tXI:i:%u", align_id );
+
+    if ( rc == 0 )
+        rc = KOutMsg( "\n" );
+
+    return rc;
+}
+
+
+/* print minimal one alignment from the EVIDENCE-INTERVAL / EVIDENCE-ALIGNMENT - table(s) 
+   triggered by option "--CG-SAM / --CG-evidence / --CG-evidence-dnb */
+static rc_t print_alignment_sam_ev( const samdump_opts * const opts,
+                                    const char * ref_name,
+                                    INSDC_coord_zero pos,
+                                    const PlacementRecord * const rec,
+                                    align_table_context * const atx )
+{
+    uint32_t ploidy;
+    const VCursor * cursor = atx->cmn.cursor;
+    rc_t rc = read_uint32( rec->id, cursor, atx->ploidy_idx, &ploidy, 0, "PLOIDY" );
+    if ( rc == 0 && ploidy > 0 )
+    {
+        uint32_t ploidy_idx, cigar_len_vector_len, read_len_vector_len, edit_dist_vector_len, cigar_str_len, read_len, quality_str_len;
+        uint32_t quality_offset = 0;
+        const uint32_t *cigar_len_vector, *read_len_vector, *edit_dist_vector;
+        const char * cigar, *read, *quality;
+        char * transformed_cigar = NULL;
+        char * org_transformed_cigar = NULL;
+        
+        rc = read_char_ptr( rec->id, cursor, atx->cmn.cigar_idx, &cigar, &cigar_str_len, "CIGAR" );
+        if ( rc == 0 )
+        {
+            org_transformed_cigar = string_dup ( cigar, cigar_str_len );
+            if ( org_transformed_cigar != NULL )
+            {
+                uint32_t i;
+                for ( i = 0; i < cigar_str_len; ++i )
+                {
+                    if ( org_transformed_cigar[ i ] == 'S' ) org_transformed_cigar[ i ] = 'I';
+                }
+                transformed_cigar = org_transformed_cigar;
+            }
+        }
+        
+        if ( rc == 0 )
+            rc = read_uint32_ptr( rec->id, cursor, atx->cmn.cigar_len_idx, &cigar_len_vector, &cigar_len_vector_len, "CIGAR_LEN" );
+        if ( rc == 0 )
+            rc = read_char_ptr( rec->id, cursor, atx->cmn.read_idx, &read, &read_len, "READ" );
+        if ( rc == 0 )
+            rc = read_uint32_ptr( rec->id, cursor, atx->cmn.read_len_idx, &read_len_vector, &read_len_vector_len, "READ_LEN" );
+        if ( rc == 0 )
+            rc = read_char_ptr( rec->id, cursor, atx->cmn.sam_quality_idx, &quality, &quality_str_len, "QUALITY" );
+        if ( rc == 0 )
+            rc = read_uint32_ptr( rec->id, cursor, atx->cmn.edit_dist_idx, &edit_dist_vector, &edit_dist_vector_len, "EDIT_DIST" );
+
+        for ( ploidy_idx = 0; ploidy_idx < ploidy && rc == 0; ++ploidy_idx )
+        {
+            uint32_t cigar_slice_len = cigar_len_vector[ ploidy_idx ];
+            uint32_t read_slice_len = read_len_vector[ ploidy_idx ];
+            if ( opts->dump_cg_evidence )
+            {
+                /* SAM-FIELD: QNAME     SRA-column: eventually prefixed row-id into EVIDENCE_INTERVAL - table */
+                /* SAM-FIELD: FLAG      SRA-column: SAM_FLAGS ( uint32 ) */
+                /* SAM-FIELD: RNAME     SRA-column: REF_NAME / REF_SEQ_ID ( char * ) */
+                /* SAM-FIELD: POS       SRA-column: REF_POS + 1 */
+                /* SAM-FIELD: MAPQ      SRA-column: MAPQ */
+                if ( rc == 0 )
+                {
+                    if ( opts->print_cg_names )
+                        rc = KOutMsg( "-1:0\t" );
+                    else
+                        rc = KOutMsg( "ALLELE_%li.%u\t", rec->id, ploidy_idx + 1 );
+                }
+
+                if ( rc == 0 )
+                    rc = KOutMsg( "0\t%s\t%u\t%d\t", ref_name, pos + 1, rec->mapq );
+
+                /* SAM-FIELD: CIGAR     SRA-column: CIGAR_SHORT / CIGAR_LONG sliced!!! */
+                if ( rc == 0 )
+                    rc = KOutMsg( "%.*s\t", cigar_slice_len, transformed_cigar );
+
+                /* SAM-FIELD: RNEXT     SRA-column: MATE_REF_NAME ( !!! row_len can be zero !!! ) */
+                /* SAM-FIELD: PNEXT     SRA-column: MATE_REF_POS + 1 ( !!! row_len can be zero !!! ) */
+                /* SAM-FIELD: TLEN      SRA-column: TEMPLATE_LEN ( !!! row_len can be zero !!! ) */
+                /* SAM-FIELD: SEQ       SRA-column: READ sliced!!! */
+                if ( rc == 0 )
+                    rc = KOutMsg( "*\t0\t0\t%.*s\t", read_slice_len, read );
+
+                /* SAM-FIELD: QUAL      SRA-column: SAM_QUALITY sliced!!! */
+                if ( rc == 0 )
+                    rc = print_qslice( opts, false, quality, quality_str_len, &quality_offset, read_len_vector, read_len_vector_len, ploidy_idx );
+
+                /* OPT SAM-FIELD: RG     SRA-column: ploidy_idx */
+                if ( rc == 0 )
+                    rc = KOutMsg( "RG:Z:ALLELE_%u", ploidy_idx + 1 );
+
+                /* OPT SAM-FIELD: XI     SRA-column: ALIGN_ID */
+                if ( rc == 0 && opts->print_alignment_id_in_column_xi )
+                    rc = KOutMsg( "\tXI:i:%u", rec->id );
+
+                /* OPT SAM-FIELD: NM     SRA-column: EDIT_DISTANCE sliced!!! */
+                if ( rc == 0 && ( ploidy_idx < edit_dist_vector_len ) )
+                    rc = KOutMsg( "\tNM:i:%u", edit_dist_vector[ ploidy_idx ] );
+
+                if ( rc == 0 )
+                    rc = KOutMsg( "\n" );
+            }
+
+            /* we do that here per ALLEL-READ, not at the end per ALLEL, because we have to test which alignments
+               fit the ploidy_idx */
+
+            if ( rc == 0 && ( opts->dump_cg_sam || opts->dump_cg_ev_dnb ) )
+            {
+                const int64_t *ev_al_ids;
+                uint32_t ev_al_ids_count, read_id;
+
+                rc = read_int64_ptr( rec->id, atx->cmn.cursor, atx->ev_alignments_idx, &ev_al_ids, &ev_al_ids_count, "EV_ALIGNMENTS" );
+                for ( read_id = 0; read_id < ev_al_ids_count && rc == 0; ++read_id )
+                {
+                    uint32_t ref_ploidy;
+                    int64_t align_id = ev_al_ids[ read_id ];
+                    rc = read_uint32( align_id, atx->eval.cursor, atx->ref_ploidy_idx, &ref_ploidy, 0, "PLOIDY" );
+
+                    if ( rc == 0 && ( ref_ploidy == ( ploidy_idx + 1 ) ) )
+                    {
+                        if ( rc == 0 && opts->dump_cg_sam )
+                        {
+                            rc = adjust_align_table_context_cig_op_buffer( atx, read_slice_len );
+                            if ( rc == 0 )
+                            {
+                                int32_t ref_cig_len = ExplodeCIGAR( atx->cig_op_buffer, atx->cig_op_buffer_len, cigar, cigar_slice_len );
+                                rc = print_evidence_alignment_cg_sam( opts, rec, atx, align_id, ploidy_idx + 1, ref_name, pos, ref_cig_len );
+                            }
+                        }
+
+                        if ( rc == 0 && opts->dump_cg_ev_dnb )
+                            rc = print_evidence_alignment_cg_ev_dnb( opts, rec, atx, align_id, ploidy_idx + 1 );
+                    }
+                }
+            }
+
+            /* advance the cigar-slice... */
+            cigar += cigar_slice_len;
+            if ( transformed_cigar != NULL )
+                transformed_cigar += cigar_slice_len;
+            read += read_slice_len;
+        }
+        if ( org_transformed_cigar != NULL )
+            free( org_transformed_cigar );
+    }
+    return rc;
+}
+
+
+static rc_t print_alignment_sam_ps( const samdump_opts * const opts,
+                                    const char * ref_name,
+                                    INSDC_coord_zero pos,
+                                    matecache * const mc,
+                                    struct rna_splice_dict * splice_dict,
+                                    const PlacementRecord * const rec,
+                                    const align_table_context * const atx )
+{
+    uint32_t sam_flags = 0, NM_adjustments = 0, seq_spot_id_len, mate_ref_pos_len = 0, mate_ref_name_len = string_size( ref_name );
+    INSDC_coord_zero mate_ref_pos = 0;
+    INSDC_coord_len tlen = 0;
+    int64_t mate_align_id = 0, id = rec->id;
+    const int64_t * seq_spot_id;
+    const char * mate_ref_name = ref_name;
+    const VCursor * cursor = atx->cmn.cursor;
+    cg_cigar_output cgc_output;
+    rna_splice_candidates candidates; /* in cg_tools.h */
+    bool rna_not_homogeneous_flag = false;
+
+    /* SAM-FIELD: NONE      SRA-column: MATE_ALIGN_ID ( int64 ) ... for cache lookup's */
+    rc_t rc = read_int64( id, cursor, atx->mate_align_id_idx, &mate_align_id, 0, "MATE_ALIGN_ID" );
+
+    candidates.count = 0;
+    candidates.fwd_matched = 0;
+    candidates.rev_matched = 0;
+
+    /* pre-read seq-spot-id, needed for unaligned cache and SAM-field QNAME */
+    if ( rc == 0 )
+        rc = read_int64_ptr( id, cursor, atx->cmn.seq_spot_id_idx, &seq_spot_id, &seq_spot_id_len, "SEQ_SPOT_ID" );
+
+    /* try to find the info about the mate in the CACHE... */
+    if ( rc == 0 )
+    {
+        if ( mate_align_id != 0 )
+        {
+            if ( opts->use_mate_cache && mc != NULL )
+            {
+                rc = matecache_lookup_same_ref( mc, atx->db_idx, mate_align_id, &mate_ref_pos, &sam_flags, &tlen );
+                if ( rc == 0 )
+                {
+                    /* we found it in the the sam-ref-matecache */
+                    const INSDC_read_filter * read_filter;
+                    uint32_t read_filter_len;
+
+                    /* cache entry-found! (on the same reference) -> that means we have now mate_ref_pos, flags and tlen */
+                    matecache_remove_same_ref( mc, atx->db_idx, mate_align_id );
+                    mate_ref_name = equal_sign;
+                    mate_ref_name_len = 1;
+                    mate_ref_pos_len = 1;
+
+                    /* read the read-filter column and adjust the sam-flags value to reflect the presense
+                       of the flag SRA_READ_FILTER_REJECT, if it is there switch 0x200 on, of not switch 0x200 off */
+                    rc = read_INSDC_read_filter_ptr( id, cursor, atx->cmn.read_filter_idx, &read_filter, &read_filter_len, "RD_FILTER" );
+                    if ( rc == 0 && read_filter_len > 0 )
+                    {
+                        if ( ( read_filter[ 0 ] & READ_FILTER_REJECT ) == READ_FILTER_REJECT )
+                            sam_flags |= 0x200;
+                        else
+                            sam_flags &= ~0x200;
+
+                        if ( ( read_filter[ 0 ] & READ_FILTER_CRITERIA ) == READ_FILTER_CRITERIA )
+                            sam_flags |= 0x400;
+                        else
+                            sam_flags &= ~0x400;
+                    }
+                }
+                else
+                {
+                    /* we did not find it in the the sam-ref-matecache */
+                    rc = RC( rcApp, rcNoTarg, rcAccessing, rcItem, rcNotFound );
+                }
+            }
+            else
+            {
+                rc = RC( rcApp, rcNoTarg, rcAccessing, rcItem, rcNotFound );
+            }
+        }
+
+        if ( ( mate_align_id != 0 && GetRCState( rc ) == rcNotFound )||( mate_align_id == 0 ) )
+        {
+            /* no cache entry-found OR do not use mate-cache
+               ---> that means we have to read it from the table... */
+
+            rc = read_char_ptr( id, cursor, atx->mate_ref_name_idx, &mate_ref_name, &mate_ref_name_len, "MATE_REF_NAME" );
+            if ( rc == 0 )
+                rc = read_INSDC_coord_zero( id, cursor, atx->mate_ref_pos_idx, &mate_ref_pos, 0, "MATE_REF_POS" );
+            if ( rc == 0 )
+                rc = read_INSDC_coord_len( id, cursor, atx->tlen_idx, &tlen, 0, "TLEN" );
+            if ( rc == 0 )
+                rc = read_uint32( id, cursor, atx->sam_flags_idx, &sam_flags, 0, "SAM_FLAGS" );
+
+            if ( rc == 0 )
+            {
+                int32_t cmp = -1;
+                if ( mate_ref_name_len > 0 )
+                {
+                    size_t ref_name_len = string_size( ref_name );
+                    size_t cmp_len = ( mate_ref_name_len > ref_name_len ? mate_ref_name_len : ref_name_len );
+                    cmp = string_cmp( mate_ref_name, mate_ref_name_len, ref_name, ref_name_len, cmp_len );
+                    if ( cmp == 0 )
+                    {
+                        mate_ref_name = equal_sign;
+                        mate_ref_name_len = 1;
+                    }
+                }
+
+                if ( opts->use_mate_cache )
+                {
+                    if ( mate_align_id != 0 && mate_ref_name_len > 0 && cmp == 0 )
+                    {
+                        /* now that we have the data, store it in sam-ref-cache it the mate is on the same ref. */
+                        uint32_t mate_flags = calc_mate_flags( sam_flags );
+                        rc = matecache_insert_same_ref( mc, atx->db_idx, id, pos, mate_flags, -tlen );
+                    }
+
+                    if ( mate_align_id == 0 && mate_ref_name_len == 0 && opts->print_half_unaligned_reads &&
+                         atx->align_table_type == att_primary )
+                    {
+                        int64_t key = id;
+                        rc = matecache_insert_unaligned( mc, atx->db_idx, key, pos, atx->ref_idx, *seq_spot_id );
+                    }
+                }
+            }
+        }
+    }
+
+    if ( rc == 0 && opts->use_matepair_filter && !filter_by_matepair_dist( opts, tlen ) )
+        return 0;
+
+    /* SAM-FIELD: QNAME     SRA-column: SEQ_SPOT_ID ( int64 ) */
+    if ( rc == 0 )
+    {
+        if ( seq_spot_id_len > 0 )
+        {
+            if ( opts->print_spot_group_in_name | opts->print_cg_names )
+            {
+                const char * spot_group;
+                uint32_t spot_group_len;
+                rc = read_char_ptr( id, cursor, atx->cmn.seq_spot_group_idx, &spot_group, &spot_group_len, "SPOT_GROUP" );
+                if ( rc == 0 )
+                    rc = dump_name( opts, *seq_spot_id, spot_group, spot_group_len ); /* sam-dump-opts.c */
+            }
+            else
+                rc = dump_name( opts, *seq_spot_id, NULL, 0 ); /* sam-dump-opts.c */
+        }
+        else
+            rc = KOutMsg( "*" );
+    }
+
+    if ( rc == 0 )
+        rc = KOutMsg( "\t" );
+
+    /* massage the sam-flag if we are not dumping unaligned reads... */
+    if ( !opts->dump_unaligned_reads    /** not going to dump unaligned **/
+         && ( sam_flags & 0x1 )         /** but we have sequenced multiple fragments **/
+         && ( sam_flags & 0x8 ) )       /** and not all of them align **/
+        /*** remove flags talking about multiple reads **/
+        /* turn off 0x001 0x008 0x040 0x080 */
+        sam_flags &= ~0xC9;
+
+    /* SAM-FIELD: FLAG      SRA-column: SAM_FLAGS ( uint32 ) */
+    /* SAM-FIELD: RNAME     SRA-column: REF_NAME / REF_SEQ_ID ( char * ) */
+    /* SAM-FIELD: POS       SRA-column: REF_POS + 1 */
+    /* SAM-FIELD: MAPQ      SRA-column: MAPQ */
+    if ( rc == 0 )
+        rc = KOutMsg( "%u\t%s\t%u\t%d\t", sam_flags, ref_name, pos + 1, rec->mapq );
+
+    /* get READ, QUALITY and EIDT_DIST before cigar manipulation because we need/change these values */
+    if ( rc == 0 )
+        rc = get_READ_QUALITY_EDIT_DIST( &cgc_output, id, &atx->cmn );
+
+    /* SAM-FIELD: CIGAR     SRA-column: CIGAR_SHORT / with or without treatment */
+    if ( rc == 0 )
+    {
+        cg_cigar_input cgc_input;
+        char * temp_cigar = NULL;
+        static char const *bogus_quality = "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!";
+
+        rc = read_char_ptr( id, cursor, atx->cmn.cigar_idx, &cgc_input.p_cigar.ptr, &cgc_input.p_cigar.len, "CIGAR" );
+        if ( rc == 0 )
+        {
+            if ( cgc_output.p_quality.len == 0 )
+            {
+                cgc_output.p_quality.ptr = bogus_quality;
+                cgc_output.p_quality.len = 35;
+            }
+            rc = cg_cigar_treatments( opts->cigar_treatment, &cgc_input, &cgc_output, id, &atx->cmn );
+        }
+
+        if ( opts->rna_splicing )
+        {
+	    { /*** reset previous identification of N to D ***/
+		int i;
+		char *c=cgc_output.p_cigar.ptr;
+		for(i=0;i< cgc_output.p_cigar.len;i++){
+		    if(c[i]=='N') c[i]='D';
+		}
+	    }
+            /* discover which cigar-operations could be a RNA-splice ( it is a D-operation with min length of 10 ) */
+            rc = discover_rna_splicing_candidates( cgc_output.p_cigar.len, cgc_output.p_cigar.ptr, 10, &candidates ); /* cg_tools.c */
+            if ( rc == 0 && candidates.count > 0 )
+            {
+                /* we discover by comparing against the reference if a candidate is a RNA-splice and if it is forward or reverse */
+                rc = check_rna_splicing_candidates_against_ref( rec->ref, opts->rna_splice_level, pos, &candidates ); /* cg_tools.c */
+                if ( rc == 0 && ( candidates.fwd_matched > 0 || candidates.rev_matched > 0 ) )
+                {
+                    /* set the warning-flag that we have an alignment with not homogeneous RNA-splices */
+                    if ( candidates.fwd_matched > 0 && candidates.rev_matched > 0 )
+                        rna_not_homogeneous_flag = true;
+
+                    temp_cigar = malloc( cgc_output.p_cigar.len + 1 ); /* temp_cigar will be released at the end of this block */
+                    if ( temp_cigar != NULL )
+                    {
+                        /* create a new cigarstring by applying the candidates to the cigar-string */
+                        rc = change_rna_splicing_cigar( cgc_output.p_cigar.len, temp_cigar, &candidates, &NM_adjustments ); /* cg_tools.c */
+                        if ( rc == 0 )
+                            cgc_output.p_cigar.ptr = temp_cigar;
+                    }
+                }
+
+                /* rna-splice-log */
+                if ( opts->rna_splice_log != NULL )
+                {
+                    /* record all the candidates... */
+                    uint32_t c_idx;
+                    for ( c_idx = 0; c_idx < candidates.count; c_idx++ )
+                    {
+                        rna_splice_candidate * candidate = &( candidates.candidates[ c_idx ] );
+                        splice_dict_entry entry;
+                        uint32_t intron_pos = pos + candidate->ref_offset;
+                        if ( rna_splice_dict_get( splice_dict, intron_pos, candidate->len, &entry ) )
+                        {
+                            entry.count += 1;
+                            rna_splice_dict_set( splice_dict, intron_pos, candidate->len, &entry );
+                        }
+                        else
+                        {
+                            entry.count = 1;
+                            entry.intron_type = candidate->matched;
+                            rna_splice_dict_set( splice_dict, intron_pos, candidate->len, &entry );
+                        }
+                    }
+                }
+
+            }
+            if ( candidates.cigops != NULL )
+                free( ( void * ) candidates.cigops );
+        }
+        if ( rc == 0 )
+            rc = KOutMsg( "%.*s\t", cgc_output.p_cigar.len, cgc_output.p_cigar.ptr );
+
+        if ( temp_cigar != NULL )
+            free( temp_cigar );
+    }
+
+    /* SAM-FIELD: RNEXT     SRA-column: MATE_REF_NAME ( !!! row_len can be zero !!! ) */
+    /* SAM-FIELD: PNEXT     SRA-column: MATE_REF_POS + 1 ( !!! row_len can be zero !!! ) */
+    /* SAM-FIELD: TLEN      SRA-column: TEMPLATE_LEN ( !!! row_len can be zero !!! ) */
+    if ( rc == 0 )
+    {
+        if ( mate_ref_name_len > 0 )
+        {
+            rc = KOutMsg( "%.*s\t%u\t%d\t", mate_ref_name_len, mate_ref_name, mate_ref_pos + 1, tlen );
+        }
+        else
+        {
+            if ( mate_ref_pos_len == 0 )
+                rc = KOutMsg( "*\t0\t%d\t", tlen );
+            else
+                rc = KOutMsg( "*\t%u\t%d\t", mate_ref_pos, tlen );
+        }
+    }
+
+    /* SAM-FIELD: SEQ       SRA-column: READ */
+    if ( rc == 0 )
+        rc = KOutMsg( "%.*s\t", cgc_output.p_read.len, cgc_output.p_read.ptr );
+
+    /* SAM-FIELD: QUAL      SRA-column: SAM_QUALITY */
+    if ( rc == 0 )
+    {
+        if ( cgc_output.p_quality.len > 0 )
+            rc = dump_quality_33( opts, cgc_output.p_quality.ptr, cgc_output.p_quality.len, false );
+        else
+            rc = KOutMsg( "*" );
+    }
+
+    /* OPT SAM-FIELD: RG     SRA-column: SPOT_GROUP */
+    if ( rc == 0 && ( atx->cmn.seq_spot_group_idx != COL_NOT_AVAILABLE ) )
+    {
+        const char * spot_grp = NULL;
+        uint32_t spot_grp_len;
+        rc = read_char_ptr( id, cursor, atx->cmn.seq_spot_group_idx, &spot_grp, &spot_grp_len, "SPOT_GROUP" );
+        if ( rc == 0 && spot_grp_len > 0 )
+            rc = KOutMsg( "\tRG:Z:%.*s", spot_grp_len, spot_grp );
+    }
+
+    if ( rc == 0 && cgc_output.p_tags.len > 0 )
+        rc = KOutMsg( "\t%.*s", cgc_output.p_tags.len, cgc_output.p_tags.ptr );
+
+    /* OPT SAM-FIELD: XI     SRA-column: ALIGN_ID */
+    if ( rc == 0 && opts->print_alignment_id_in_column_xi )
+        rc = KOutMsg( "\tXI:i:%u", id );
+
+    /* to match sam-tools output: in case we are dumping this in CG-mode.... */
+    if ( rc == 0 && ( opts->cigar_treatment != ct_unchanged ) && ( atx->al_group_idx != COL_NOT_AVAILABLE ) )
+    {
+        const char * align_grp;
+        uint32_t align_grp_len;
+        rc = read_char_ptr( id, cursor, atx->al_group_idx, &align_grp, &align_grp_len, "ALIGN_GROUP" );
+        if ( rc == 0 && align_grp_len > 0 )
+        {
+            uint32_t i;
+            for ( i = 0; rc == 0 && i < align_grp_len - 1; ++i )
+            {
+                if ( align_grp[ i ] == '_' )
+                {
+                    rc = KOutMsg( "\tZI:i:%.*s\tZA:i:%.1s", i, align_grp, align_grp + i + 1 );
+                    break;
+                }
+            }
+        }
+    }
+    
+    /* OPT SAM-FIELD: NH     SRA-column: ALIGNMENT_COUNT */
+    if ( rc == 0 && atx->cmn.al_count_idx != COL_NOT_AVAILABLE )
+    {
+        const uint8_t * al_count;
+        uint32_t al_count_len;
+        rc = read_uint8_ptr( id, cursor, atx->cmn.al_count_idx, &al_count, &al_count_len, "ALIGNMENT_COUNT" );
+        if ( rc == 0 && al_count_len > 0 )
+            rc = KOutMsg( "\tNH:i:%u", *al_count );
+    }
+
+    /* OPT SAM-FIELD: NM     SRA-column: EDIT_DISTANCE */
+    if ( rc == 0 )
+        rc = KOutMsg( "\tNM:i:%u", ( cgc_output.edit_dist - NM_adjustments ) );
+
+    /* OPT SAM-FIELD: XS:A:+/-  SRA-column: RNA-SPLICING detected via computation, or from the RNA_ORIENTATION - column */
+    if ( rc == 0 )
+    {
+        if ( opts->rna_splicing )
+        {
+            /* analysis of rna-splicing explicitly requested at the commandline */
+            if ( candidates.fwd_matched > 0 || candidates.rev_matched > 0 )
+            {
+                if ( candidates.fwd_matched > 0 )
+                    rc = KOutMsg( "\tXS:A:+" );
+                else 
+                    rc = KOutMsg( "\tXS:A:-" );
+            }
+/*
+            uint32_t i;
+            KOutMsg( "\tXS:A:" );
+            for ( i = 0; i < candidates.count; ++i )
+            {
+                rna_splice_candidate * rsc = &candidates.candidates[ i ];
+                KOutMsg( "( offs=%u | len=%u | op_idx=%u | matech=%u )", rsc->offset, rsc->len, rsc->op_idx, rsc->matched );
+            }
+*/
+
+        }
+        else
+        {
+            /* have a look if we have a RNA_ORIENTATION - column available */
+            if ( atx->rna_orientation_idx != COL_NOT_AVAILABLE )
+            {
+                const char * rna_orientation;
+                uint32_t rna_orientation_len;
+                rc = read_char_ptr( id, cursor, atx->rna_orientation_idx,
+                                    &rna_orientation, &rna_orientation_len, "RNA_ORIENTATION" );
+                if ( rc == 0 && rna_orientation_len > 0 )
+                {
+                    rc = KOutMsg( "\tXS:A:%c", rna_orientation[ 0 ] );
+                }
+            }
+        }
+    }
+
+    if ( rc == 0 )
+        rc = KOutMsg( "\n" );
+
+    /* print a log-info if have to because RNA-splicing is requested and we have not homogeneous bits */
+    if ( rna_not_homogeneous_flag )
+    {
+        KLogLevel tmp_lvl = KLogLevelGet();
+        KLogLevelSet( klogInfo );
+
+        (void)PLOGMSG( klogInfo, ( klogInfo, "not homogeneous RNA-splices found in alignment #$(an) at $(ref).$(pos)", 
+                        "an=%lu,ref=%s,pos=%u", id, ref_name, pos ) );
+
+        KLogLevelSet( tmp_lvl );
+    }
+
+    return rc;
+}
+
+
+static rc_t print_alignment_fastx( const samdump_opts * const opts,
+                                   const char * ref_name,
+                                   INSDC_coord_zero pos,
+                                   matecache * const mc,
+                                   const PlacementRecord * const rec,
+                                   const align_table_context * const atx )
+{
+    bool orientation;
+    const VCursor *cursor = atx->cmn.cursor;
+    int64_t mate_align_id;
+    const int64_t * seq_spot_id;
+    uint32_t seq_spot_id_len;
+
+    rc_t rc = read_int64_ptr( rec->id, cursor, atx->cmn.seq_spot_id_idx, &seq_spot_id, &seq_spot_id_len, "SEQ_SPOT_ID" );
+
+    /* this is here to detect if the mate is aligned, if NOT, we want to put it into the unaligned-cache! */
+    if ( rc == 0 && opts->print_half_unaligned_reads )
+    {
+        rc = read_int64( rec->id, cursor, atx->mate_align_id_idx, &mate_align_id, 0, "MATE_ALIGN_ID" );
+        if ( rc == 0 && mate_align_id == 0 && mc != NULL && opts->use_mate_cache )
+        {
+            rc = matecache_insert_unaligned( mc, atx->db_idx, rec->id, pos, atx->ref_idx, *seq_spot_id );
+        }
+    }
+
+    if ( opts->output_format == of_fastq )
+        rc = KOutMsg( "@" );
+    else
+        rc = KOutMsg( ">" );
+
+    /* SAM-FIELD: QNAME     1.row: name */
+    if ( rc == 0 )
+    {
+        if ( seq_spot_id_len > 0 )
+        {
+            if ( opts->print_spot_group_in_name )
+            {
+                const char * spot_grp;
+                uint32_t spot_grp_len;
+                rc = read_char_ptr( rec->id, cursor, atx->cmn.seq_spot_group_idx, &spot_grp, &spot_grp_len, "SEQ_SPOT_GROUP" );
+                if ( rc == 0 )
+                    rc = dump_name( opts, *seq_spot_id, spot_grp, spot_grp_len ); /* sam-dump-opts.c */
+            }
+            else
+                rc = dump_name( opts, *seq_spot_id, NULL, 0 ); /* sam-dump-opts.c */
+        }
+        else
+            rc = KOutMsg( "*" );
+
+        if ( rc == 0 )
+        {
+            uint32_t seq_read_id;
+            rc = read_uint32( rec->id, cursor, atx->cmn.seq_read_id_idx, &seq_read_id, 0, "SEQ_READ_ID" );
+            if ( rc == 0 )
+                rc = KOutMsg( "/%u", seq_read_id );
+        }
+    }
+
+    /* SRA-column: REF_ORIENTATION ( bool ) ... needed for quality */
+    if ( rc == 0 )
+        rc = read_bool( rec->id, cursor, atx->cmn.ref_orientation_idx, &orientation, false, "REF_ORIENT" );
+
+    /* source of the alignment: primary/secondary/evidence */
+    if ( rc == 0 )
+    {
+        switch( atx->align_table_type )
+        {
+        case att_primary    :   rc = KOutMsg( " primary" ); break;
+        case att_secondary  :   rc = KOutMsg( " secondary" ); break;
+        case att_evidence   :   rc = KOutMsg( " evidence" ); break;
+        }
+    }
+
+    /* against what reference aligned, at what position, with what mapping-quality */
+    if ( rc == 0 )
+        rc = KOutMsg( " ref=%s pos=%u mapq=%i\n", ref_name, pos + 1, rec->mapq );
+
+    /* READ at a new line */
+    if ( rc == 0 )
+    {
+        const char * read;
+        uint32_t read_size;
+        rc = read_char_ptr( rec->id, cursor, atx->cmn.raw_read_idx, &read, &read_size, "RAW_READ" );
+        if ( rc == 0 )
+        {
+            if ( read_size > 0 )
+                rc = KOutMsg( "%.*s\n", read_size, read );
+            else
+                rc = KOutMsg( "*\n" );
+        }
+    }
+
+    /* QUALITY on a new line if in fastq-mode */
+    if ( rc == 0 && opts->output_format == of_fastq )
+    {
+        rc = KOutMsg( "+\n" );
+        if ( rc == 0 )
+        {
+            const char * quality;
+            uint32_t quality_size;
+            rc = read_char_ptr( rec->id, cursor, atx->cmn.sam_quality_idx, &quality, &quality_size, "SAM_QUALITY" );
+            if ( rc == 0 )
+            {
+                if ( quality_size > 0 )
+                    rc = dump_quality_33( opts, quality, quality_size, false );
+                else
+                    rc = KOutMsg( "*" );
+            }
+            if ( rc == 0 )
+                rc = KOutMsg( "\n" );
+        }
+    }
+
+    return rc;
+}
+
+
+/* print one record of alignment-information in SAM-format */
+static rc_t walk_position( const samdump_opts * const opts,
+                           PlacementSetIterator * const set_iter,
+                           const char * ref_name,
+                           INSDC_coord_zero pos,
+                           matecache * const mc,
+                           struct rna_splice_dict * splice_dict,
+                           INSDC_coord_zero first_pos,
+                           INSDC_coord_len len )
+{
+    rc_t rc = 0;
+    while ( rc == 0 )
+    {
+        rc = Quitting ();
+        if ( rc == 0 )
+        {
+            const PlacementRecord *rec;
+            rc = PlacementSetIteratorNextRecordAt( set_iter, pos, &rec );
+            if ( rc != 0 )
+            {
+                if ( GetRCState( rc ) != rcDone )
+                {
+                    LOGERR( klogInt, rc, "PlacementSetIteratorNextRecordAt() failed" );
+                }
+            }
+            else
+            {
+
+#if _DEBUGGING
+                if ( opts->perf_log != NULL )
+                    perf_log_line( opts->perf_log, pos );
+#endif
+
+                /* We have to do this here, becasue the nature of the iterator is to return all alignments that
+                   touch ( stick into ) the requested interval. But: sam-dump has to dump alignments that
+                   !! start !! in the requested interval. */
+                if ( pos >= first_pos )
+                {
+                    align_table_context * atx = PlacementRecord_get_ext_data_ptr( rec, placementRecordExtension0 );
+                    if ( atx == NULL )
+                    {
+                        rc = RC( rcExe, rcNoTarg, rcReading, rcParam, rcNull );
+                        LOGERR( klogInt, rc, "no placement-record-context available" );
+                    }
+                    else
+                    {
+                        if ( opts->output_format == of_sam )
+                        {
+                            if ( atx->align_table_type == att_evidence )
+                                rc = print_alignment_sam_ev( opts, ref_name, pos, rec, atx );
+                            else
+                                rc = print_alignment_sam_ps( opts, ref_name, pos, mc, splice_dict, rec, atx );
+                        }
+                        else
+                            rc = print_alignment_fastx( opts, ref_name, pos, mc, rec, atx );
+                    }
+                }
+                PlacementRecordWhack ( rec );
+
+
+            }
+        }
+    }
+    if ( GetRCState( rc ) == rcDone ) rc = 0;
+    return rc;
+}
+
+
+static rc_t walk_window( const samdump_opts * const opts,
+                         PlacementSetIterator * const set_iter,
+                         const char * ref_name,
+                         matecache * const mc,
+                         struct rna_splice_dict * splice_dict,
+                         INSDC_coord_zero first_pos,
+                         INSDC_coord_len len )
+{
+    rc_t rc = 0;
+    while ( rc == 0 )
+    {
+        rc = Quitting ();
+        if ( rc == 0 )
+        {
+            INSDC_coord_zero pos;
+            rc = PlacementSetIteratorNextAvailPos( set_iter, &pos, NULL );
+            if ( rc != 0 )
+            {
+                if ( GetRCState( rc ) != rcDone )
+                {
+                    LOGERR( klogInt, rc, "PlacementSetIteratorNextAvailPos() failed" );
+                }
+            }
+            else
+            {
+                rc = walk_position( opts, set_iter, ref_name, pos, mc, splice_dict, first_pos, len );
+            }
+        }
+    }
+    if ( GetRCState( rc ) == rcDone ) rc = 0;
+    return rc;
+}
+
+
+static rc_t walk_reference( const samdump_opts * const opts,
+                            PlacementSetIterator * const set_iter,
+                            struct ReferenceObj const * ref_obj,
+                            const char * ref_name,
+                            matecache * const mc )
+{
+    rc_t rc = 0;
+    struct rna_splice_dict * splice_dict = NULL;
+
+    if ( opts->rna_splicing )
+    {
+        splice_dict = make_rna_splice_dict();
+        /* rna-splice-log */
+        if ( opts->rna_splice_log != NULL )
+            rna_splice_log_enter_ref( opts->rna_splice_log, ref_name, ref_obj );
+    }
+
+    while ( rc == 0 )
+    {
+        rc = Quitting ();
+        if ( rc == 0 )
+        {
+            INSDC_coord_zero first_pos;
+            INSDC_coord_len len;
+            rc = PlacementSetIteratorNextWindow( set_iter, &first_pos, &len );
+            if ( rc != 0 )
+            {
+                if ( GetRCState( rc ) != rcDone )
+                {
+                    LOGERR( klogInt, rc, "PlacementSetIteratorNextWindow() failed" );
+                }
+            }
+            else
+                rc = walk_window( opts, set_iter, ref_name, mc, splice_dict, first_pos, len );
+        }
+    }
+    if ( GetRCState( rc ) == rcDone ) rc = 0;
+
+    if ( rc == 0 && mc != NULL && opts->use_mate_cache )
+        rc = matecache_clear_same_ref( mc );
+
+    if ( splice_dict != NULL )
+    {
+        /* rna-splice-log */
+        if ( opts->rna_splice_log != NULL )
+            rna_splice_log_exit_ref( opts->rna_splice_log, splice_dict );
+        free_rna_splice_dict( splice_dict );
+    }
+
+    return rc;
+}
+
+
+static rc_t walk_placements( const samdump_opts * const opts,
+                             PlacementSetIterator * const set_iter,
+                             matecache * const mc )
+{
+    rc_t rc = 0;
+    while ( rc == 0 )
+    {
+        struct ReferenceObj const * ref_obj;
+
+        rc = PlacementSetIteratorNextReference( set_iter, NULL, NULL, &ref_obj );
+        if ( rc == 0 )
+        {
+            if ( ref_obj != NULL )
+            {
+                const char * ref_name = NULL;
+                if ( opts->use_seqid_as_refname )
+                    rc = ReferenceObj_SeqId( ref_obj, &ref_name );
+                else
+                    rc = ReferenceObj_Name( ref_obj, &ref_name );
+
+                if ( rc == 0 )
+                {
+#if _DEBUGGING
+                    if ( opts->perf_log != NULL )
+                        perf_log_start_sub_section( opts->perf_log, ref_name );
+#endif
+
+                    rc = walk_reference( opts, set_iter, ref_obj, ref_name, mc );
+
+#if _DEBUGGING
+                    if ( opts->perf_log != NULL )
+                        perf_log_end_sub_section( opts->perf_log );
+#endif
+                }
+                else
+                {
+                    if ( opts->use_seqid_as_refname )
+                    {
+                        (void)LOGERR( klogInt, rc, "ReferenceObj_SeqId() failed" );
+                    }
+                    else
+                    {
+                        (void)LOGERR( klogInt, rc, "ReferenceObj_Name() failed" );
+                    }
+                }
+            }
+        }
+        else if ( GetRCState( rc ) != rcDone )
+        {
+            (void)LOGERR( klogInt, rc, "ReferenceIteratorNextReference() failed" );
+        }
+    }
+
+    if ( GetRCState( rc ) == rcDone )
+        rc = 0;
+    return rc;
+}
+
+
+
+static void CC destroy_align_table_context( void *item, void *data )
+{
+    align_table_context * atx = item;
+    free_align_table_context( atx );
+}
+
+
+static rc_t print_all_aligned_spots_of_this_reference( const samdump_opts * const opts,
+                                                       const input_database * const ids,
+                                                       matecache * const mc,
+                                                       const AlignMgr * const a_mgr,
+                                                       const ReferenceObj * const ref_obj )
+{
+    PlacementSetIterator * set_iter;
+    /* the we ask the alignment-manager to produce a placement-set-iterator... */
+    rc_t rc = AlignMgrMakePlacementSetIterator( a_mgr, &set_iter );
+    if ( rc != 0 )
+    {
+        (void)LOGERR( klogErr, rc, "cannot create PlacementSetIterator" );
+    }
+    else
+    {
+        /* here we need a vector to passed along into the creation of the iterators */
+        Vector context_list;
+        INSDC_coord_len ref_len;
+
+        VectorInit ( &context_list, 0, 5 );
+
+        rc = ReferenceObj_SeqLength( ref_obj, &ref_len );
+        if ( rc == 0 )
+        {
+            rc = add_pl_iters( opts, set_iter, ref_obj, ids,
+                0,                  /* where it starts on the reference */
+                ref_len,            /* the whole length of this reference/chromosome */
+                NULL,               /* no spotgroup re-grouping (yet) */
+                &context_list
+                );
+            if ( rc == 0 )
+                rc = walk_placements( opts, set_iter, mc );
+        }
+
+        /* walk the context_list to free the align_table_context records, close/free the cursors... */
+        VectorWhack ( &context_list, destroy_align_table_context, NULL );
+        PlacementSetIteratorRelease( set_iter );
+    }
+    return rc;
+}
+
+
+/*
+   the user did not specify regions, print all alignments from all input-files
+   this is strategy #1 to do this, create a ref_iter for every reference each
+    + ... less cursors will be open at the same time, more resource efficient
+    - ... if more than one input-file, the output will be sorted only within each reference
+*/
+static rc_t print_all_aligned_spots_0( const samdump_opts * const opts,
+                                       const input_files * const ifs,
+                                       matecache * const mc,
+                                       const AlignMgr * const a_mgr )
+{
+    rc_t rc = 0;
+    uint32_t db_idx;
+    /* we now loop through all input-databases... */
+    for ( db_idx = 0; db_idx < ifs->database_count && rc == 0; ++db_idx )
+    {
+        const input_database * ids = VectorGet( &ifs->dbs, db_idx );
+        if ( ids != NULL )
+        {
+            uint32_t refobj_count;
+            rc = ReferenceList_Count( ids->reflist, &refobj_count );
+            if ( rc == 0 && refobj_count > 0 )
+            {
+                uint32_t ref_idx;
+                for ( ref_idx = 0; ref_idx < refobj_count && rc == 0; ++ref_idx )
+                {
+                    const ReferenceObj * ref_obj;
+                    rc = ReferenceList_Get( ids->reflist, &ref_obj, ref_idx );
+                    if ( rc == 0 && ref_obj != NULL )
+                    {
+                        rc = print_all_aligned_spots_of_this_reference( opts, ids, mc, a_mgr, ref_obj );
+                        ReferenceObj_Release( ref_obj );
+                    }
+                }
+            }
+        }
+    }
+    return rc;
+}
+
+
+/*
+   the user did not specify regions, print all alignments from all input-files
+   this is strategy #2 to do this, throw all iterators for all input-files and all there references
+   into one set_iter.
+    + ... if more than one input-file, everything will be sorted
+    - ... creates a large number of open cursors ( because of sub-cursors due to schema-functions )
+          this can result in not beeing able to perform the functions at all because of running out of resources
+    - ... a long delay at start up, before the 1st alignment is printed ( all the cursors have to be opened )
+*/
+static rc_t print_all_aligned_spots_1( const samdump_opts * const opts,
+                                       const input_files * const ifs,
+                                       matecache * const mc,
+                                       const AlignMgr * const a_mgr )
+{
+    PlacementSetIterator * set_iter;
+    /* the we ask the alignment-manager to produce a placement-set-iterator... */
+    rc_t rc = AlignMgrMakePlacementSetIterator( a_mgr, &set_iter );
+    if ( rc != 0 )
+    {
+        (void)LOGERR( klogErr, rc, "cannot create PlacementSetIterator" );
+    }
+    else
+    {
+        /* here we need a vector to passed along into the creation of the iterators */
+        Vector context_list;
+        VectorInit ( &context_list, 0, 5 );
+
+        rc = prepare_whole_files( opts, ifs, set_iter, &context_list );
+
+        if ( rc == 0 )
+            rc = walk_placements( opts, set_iter, mc );
+
+        /* walk the context_list to free the align_table_context records, close/free the cursors... */
+        VectorWhack ( &context_list, destroy_align_table_context, NULL );
+        PlacementSetIteratorRelease( set_iter );
+    }
+    return rc;
+}
+
+
+/*
+   the user has specified certain regions on the references,
+   print only alignments, that start in these regions
+*/
+static rc_t print_selected_aligned_spots( const samdump_opts * const opts,
+                                          const input_files * const ifs,
+                                          matecache * const mc,
+                                          const AlignMgr * const a_mgr )
+{
+    PlacementSetIterator * set_iter;
+    /* the we ask the alignment-manager to produce a placement-set-iterator... */
+    rc_t rc = AlignMgrMakePlacementSetIterator( a_mgr, &set_iter );
+    if ( rc != 0 )
+    {
+        (void)LOGERR( klogErr, rc, "cannot create PlacementSetIterator" );
+    }
+    else
+    {
+        /* here we need a vector to passed along into the creation of the iterators */
+        Vector context_list;
+        VectorInit ( &context_list, 0, 5 );
+
+        rc = prepare_regions( opts, ifs, set_iter, &context_list );
+
+        if ( rc == 0 )
+            rc = walk_placements( opts, set_iter, mc );
+
+        /* walk the context_list to free the align_table_context records, close/free the cursors... */
+        VectorWhack ( &context_list, destroy_align_table_context, NULL );
+
+        PlacementSetIteratorRelease( set_iter );
+    }
+    return rc;
+}
+
+
+/*
+   this is called from sam-dump3.c, it prepares the iterators and then walks them
+   ---> only entry into this module <--- 
+*/
+rc_t print_aligned_spots( const samdump_opts * const opts,
+                          const input_files * const ifs,
+                          matecache * const mc )
+{
+    rc_t rc;
+    const AlignMgr * a_mgr;
+
+#if _DEBUGGING
+    if ( opts->perf_log != NULL )
+        perf_log_start_section( opts->perf_log, "aligned spots" );
+#endif
+
+    /* first we make an alignment-manager */
+    rc = AlignMgrMakeRead( &a_mgr );
+    if ( rc != 0 )
+    {
+        (void)LOGERR( klogErr, rc, "cannot create alignment-manager" );
+    }
+    else
+    {
+        if ( opts->region_count == 0 )
+        {
+            /* the user did not specify regions to be printed ==> print all alignments */
+            switch( opts->dump_mode )
+            {
+                case dm_one_ref_at_a_time : rc = print_all_aligned_spots_0( opts, ifs, mc, a_mgr ); break;
+                case dm_prepare_all_refs  : rc = print_all_aligned_spots_1( opts, ifs, mc, a_mgr ); break;
+            }
+        }
+        else
+        {
+            /* the user did specify regions to be printed ==> print only the alignments in these regions */
+            rc = print_selected_aligned_spots( opts, ifs, mc, a_mgr );
+        }
+        AlignMgrRelease( a_mgr );
+    }
+
+#if _DEBUGGING
+    if ( opts->perf_log != NULL )
+        perf_log_end_section( opts->perf_log );
+#endif
+
+    return rc;
+}
diff --git a/tools/sra-pileup/sam-aligned.h b/tools/sra-pileup/sam-aligned.h
index afccab4..0ef4204 100644
--- a/tools/sra-pileup/sam-aligned.h
+++ b/tools/sra-pileup/sam-aligned.h
@@ -39,7 +39,8 @@ extern "C" {
 
 #define COL_READ "(INSDC:dna:text)READ"
 
-rc_t print_aligned_spots( const samdump_opts * const opts, const input_files * const ifs,
-                          matecache * const mc, uint64_t * const rows_so_far );
+rc_t print_aligned_spots( const samdump_opts * const opts,
+                          const input_files * const ifs,
+                          matecache * const mc );
 
 #endif
diff --git a/tools/sra-pileup/sam-dump-opts.c b/tools/sra-pileup/sam-dump-opts.c
index d0f0815..e0e63e7 100644
--- a/tools/sra-pileup/sam-dump-opts.c
+++ b/tools/sra-pileup/sam-dump-opts.c
@@ -26,6 +26,9 @@
 
 
 #include "sam-dump-opts.h"
+#include "perf_log.h"
+
+#include <klib/time.h>
 #include <align/quality-quantizer.h>
 #include <sysalloc.h>
 
@@ -803,6 +806,15 @@ static rc_t gather_flag_options( Args * args, samdump_opts * opts )
     /* do we disable multi-threading */    
     rc = get_bool_option( args, OPT_NO_MT, &opts->no_mt );
     
+    /* forcing to use the legacy code in case of Evidence-Dnb was requested */
+    if ( rc == 0 )
+    {
+        if ( opts->dump_cg_ev_dnb )
+        {
+            opts->force_legacy = true;
+            opts->force_new = false;
+        }
+    }
     return rc;
 }
 
@@ -829,7 +841,7 @@ static rc_t get_str_option( Args * args, const char * name, const char ** s )
 }
 
 
-static rc_t get_int_option( Args * args, const char * name, uint32_t def, uint32_t * value, bool dflt_if_zero )
+static rc_t get_uint32_option( Args * args, const char * name, uint32_t def, uint32_t * value, bool dflt_if_zero )
 {
     const char * s;
     rc_t rc = get_str_option( args, name, &s );
@@ -865,13 +877,14 @@ static rc_t get_int32_options( Args * args, const char * name, int32_t * value,
         }
         else
         {
-            *used = true;
+            if ( used != NULL )
+                *used = true;
         }
     }
     return rc;
 }
 
-
+/*
 static rc_t get_int64_option( Args * args, const char * name, uint64_t def, uint64_t * value )
 {
     const char * s;
@@ -891,26 +904,26 @@ static rc_t get_int64_option( Args * args, const char * name, uint64_t def, uint
     }
     return rc;
 }
-
+*/
 
 static rc_t gather_int_options( Args * args, samdump_opts * opts )
 {
-    rc_t rc = get_int_option( args, OPT_MATE_GAP, 10000, &opts->mape_gap_cache_limit, true );
+    rc_t rc = get_uint32_option( args, OPT_MATE_GAP, 10000, &opts->mape_gap_cache_limit, true );
     if ( rc == 0 )
-        rc = get_int64_option( args, OPT_TEST_ROWS, 0, &opts->test_rows );
-    if ( rc == 0 )
-        rc = get_int_option( args, OPT_OUTBUFSIZE, 1024 * 32, &opts->output_buffer_size, false );
+        rc = get_uint32_option( args, OPT_OUTBUFSIZE, 1024 * 32, &opts->output_buffer_size, false );
+
     if ( rc == 0 )
     {
         uint32_t cs;
-        rc = get_int_option( args, OPT_CURSOR_CACHE, CURSOR_CACHE_SIZE, &cs, false );
+        rc = get_uint32_option( args, OPT_CURSOR_CACHE, CURSOR_CACHE_SIZE, &cs, false );
         if ( rc == 0 )
             opts->cursor_cache_size = ( size_t )cs;
     }
+
     if ( rc == 0 )
     {
         uint32_t mode;
-        rc = get_int_option( args, OPT_DUMP_MODE, 0, &mode, true );
+        rc = get_uint32_option( args, OPT_DUMP_MODE, 0, &mode, true );
         if ( rc == 0 )
         {
             switch( mode )
@@ -921,10 +934,13 @@ static rc_t gather_int_options( Args * args, samdump_opts * opts )
             }
         }
     }
+
     if ( rc == 0 )
-    {
         rc = get_int32_options( args, OPT_MIN_MAPQ, &opts->min_mapq, &opts->use_min_mapq );
-    }
+
+    if ( rc == 0 )
+        rc = get_uint32_option( args, OPT_RNA_SPLICEL, 0, &opts->rna_splice_level, true );
+
     return rc;
 }
 
@@ -1058,7 +1074,7 @@ static rc_t gather_string_options( Args * args, samdump_opts * opts )
         if ( opts->cigar_test == NULL )
         {
             rc = RC( rcExe, rcNoTarg, rcValidating, rcMemory, rcExhausted );
-            (void)LOGERR( klogErr, rc, "error storing CIGAR-TEST" );
+            (void)LOGERR( klogErr, rc, "error storing CIGAR-TEST into sam-dump-options" );
         }
     }
 
@@ -1069,12 +1085,42 @@ static rc_t gather_string_options( Args * args, samdump_opts * opts )
         if ( opts->header_file == NULL )
         {
             rc = RC( rcExe, rcNoTarg, rcValidating, rcMemory, rcExhausted );
-            (void)LOGERR( klogErr, rc, "error storing HDR-FILE" );
+            (void)LOGERR( klogErr, rc, "error storing HDR-FILE into sam-dump-options" );
         }
         else
             opts->header_mode = hm_file;
     }
 
+    opts->perf_log = NULL;
+
+#if _DEBUGGING
+    rc = get_str_option( args, OPT_TIMING, &s );
+    if ( rc == 0 && s != NULL )
+    {
+        opts->timing_file = string_dup_measure( s, NULL );
+        if ( opts->timing_file == NULL )
+        {
+            rc = RC( rcExe, rcNoTarg, rcValidating, rcMemory, rcExhausted );
+            (void)LOGERR( klogErr, rc, "error storing timing-FILE into sam-dump-options" );
+        }
+        else
+            opts->perf_log = make_perf_log( opts->timing_file, "sam-dump" );
+    }
+#endif
+
+    rc = get_str_option( args, OPT_RNA_SPLICE_LOG, &s );
+    if ( rc == 0 && s != NULL )
+    {
+        opts->rna_splice_log_file = string_dup_measure( s, NULL );
+        if ( opts->rna_splice_log_file == NULL )
+        {
+            rc = RC( rcExe, rcNoTarg, rcValidating, rcMemory, rcExhausted );
+            (void)LOGERR( klogErr, rc, "error storing rna-splice-log-FILE into sam-dump-options" );
+        }
+        else
+            opts->rna_splice_log = make_rna_splice_log( opts->rna_splice_log_file, "sam-dump" );
+    }
+
     return rc;
 }
 
@@ -1276,7 +1322,6 @@ void report_options( const samdump_opts * opts )
     }
 
     KOutMsg( "mate-gap-cache-limit  : %u\n",  opts->mape_gap_cache_limit );
-    KOutMsg( "test-row limit        : %u\n",  opts->test_rows );
     KOutMsg( "outputfile            : %s\n",  opts->outputfile );
     KOutMsg( "outputbuffer-size     : %u\n",  opts->output_buffer_size );
     KOutMsg( "cursor-cache-size     : %u\n",  opts->cursor_cache_size );
@@ -1286,8 +1331,18 @@ void report_options( const samdump_opts * opts )
     KOutMsg( "use min-mapq          : %s\n",  opts->use_min_mapq ? "YES" : "NO" );
     KOutMsg( "min-mapq              : %i\n",  opts->min_mapq );
     KOutMsg( "rna-splicing          : %s\n",  opts->rna_splicing ? "YES" : "NO" );
+    KOutMsg( "rna-splice-level      : %u\n",  opts->rna_splice_level );
+    KOutMsg( "rna-splice-log        : %s\n",  opts->rna_splice_log_file );
 
     KOutMsg( "multithreading        : %s\n",  opts->no_mt ? "NO" : "YES" );    
+
+#if _DEBUGGING
+    if ( opts->timing_file != NULL )
+        KOutMsg( "timing-file           : '%s'\n",  opts->timing_file );
+    else
+        KOutMsg( "timing-file           : NONE\n" );
+#endif
+
 }
 
 
@@ -1305,6 +1360,19 @@ void release_options( samdump_opts * opts )
         free( (void*)opts->outputfile );
     if( opts->header_file != NULL )
         free( (void*)opts->header_file );
+    if( opts->timing_file != NULL )
+        free( (void*)opts->timing_file );
+    if( opts->rna_splice_log_file != NULL )
+        free( (void*)opts->rna_splice_log_file );
+
+#if _DEBUGGING
+    if ( opts->perf_log != NULL )
+        free_perf_log( opts->perf_log );
+#endif
+
+    if ( opts->rna_splice_log != NULL )
+        free_rna_splice_log( opts->rna_splice_log );
+
     VNamelistRelease( opts->hdr_comments );
     VNamelistRelease( opts->input_files );
     VectorWhack ( &opts->mp_dist, release_range_wrapper, NULL );
@@ -1355,15 +1423,6 @@ bool is_this_alignment_requested( const samdump_opts * opts, const char *refname
 }
 
 
-bool test_limit_reached( const samdump_opts * opts, uint64_t rows_so_far )
-{
-    bool res = false;
-    if ( opts->test_rows > 0 )
-        res = ( rows_so_far >= opts->test_rows );
-    return res;
-}
-
-
 rc_t dump_name( const samdump_opts * opts, int64_t seq_spot_id,
                 const char * spot_group, uint32_t spot_group_len )
 {
diff --git a/tools/sra-pileup/sam-dump-opts.h b/tools/sra-pileup/sam-dump-opts.h
index 71891d9..09c66cf 100644
--- a/tools/sra-pileup/sam-dump-opts.h
+++ b/tools/sra-pileup/sam-dump-opts.h
@@ -43,6 +43,8 @@ extern "C" {
 #include <klib/namelist.h>
 
 #include <kapp/args.h>
+#include "perf_log.h"
+#include "rna_splice_log.h"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -70,7 +72,6 @@ extern "C" {
 #define OPT_REVERSE     "reverse"
 #define OPT_SPOTGRP     "spot-group"
 #define OPT_MATE_GAP    "mate-cache-row-gap"
-#define OPT_TEST_ROWS   "test-rows"
 #define OPT_XI_DEBUG    "XI"
 #define OPT_Q_QUANT     "qual-quant"
 #define OPT_GZIP        "gzip"
@@ -93,7 +94,10 @@ extern "C" {
 #define OPT_LEGACY      "legacy"
 #define OPT_NEW         "new"
 #define OPT_RNA_SPLICE  "rna-splicing"
+#define OPT_RNA_SPLICEL "rna-splice-level"
+#define OPT_RNA_SPLICE_LOG "rna-splice-log"
 #define OPT_NO_MT       "disable-multithreading"
+#define OPT_TIMING      "timing"
 
 typedef struct range
 {
@@ -177,8 +181,21 @@ typedef struct samdump_opts
     /* cigar-test >>> not advertized! */
     const char * cigar_test;
 
+    /* timing-file >>> not advertized! */
+    const char * timing_file;
+
+    /* log file for rna-splicing-events */
+    const char * rna_splice_log_file;
+
+    /* timing-performane-log, created if timing_file given */
+    struct perf_log * perf_log;
+
+    /* logging of rna-splicing on reqest */
+    struct rna_splice_log * rna_splice_log;
+
     uint32_t region_count;
     uint32_t input_file_count;
+    uint32_t rna_splice_level;  /* can be 0 || 1 || 2 */
 
     int32_t min_mapq;
 
@@ -188,10 +205,6 @@ typedef struct samdump_opts
     /* mate's farther apart than this are not cached */
     uint32_t mape_gap_cache_limit;
 
-    /* limit the output of each table to max. this number of rows, if set to a vaue greater than zero */
-    uint64_t test_rows;
-    uint64_t rows_so_far;
-
     size_t cursor_cache_size;
 
     /* how the sam-headers are treated */
@@ -277,10 +290,9 @@ bool filter_by_matepair_dist( const samdump_opts * opts, int32_t tlen );
 bool is_this_alignment_requested( const samdump_opts * opts, const char *refname, uint32_t refname_len,
                                   uint64_t start, uint64_t len );
 
-bool test_limit_reached( const samdump_opts * opts, uint64_t rows_so_far );
-
 rc_t dump_name( const samdump_opts * opts, int64_t seq_spot_id,
                 const char * spot_group, uint32_t spot_group_len );
+
 rc_t dump_name_legacy( const samdump_opts * opts, const char * name, size_t name_len,
                        const char * spot_group, uint32_t spot_group_len );
 
diff --git a/tools/sra-pileup/sam-dump.c b/tools/sra-pileup/sam-dump.c
index 9be83a4..203a38a 100644
--- a/tools/sra-pileup/sam-dump.c
+++ b/tools/sra-pileup/sam-dump.c
@@ -85,6 +85,8 @@
 #define CURSOR_CACHE (256 * 1024 * 1024)
 #endif
 
+rc_t cg_canonical_print_cigar( const char * cigar, size_t cigar_len);
+
 
 
 typedef struct TAlignedRegion_struct
@@ -660,7 +662,7 @@ static void Cache_Unpack( uint64_t val, int64_t mate_id, SCurs const *curs, SCol
 #if 0
 static rc_t OpenVTable( VDatabase const *db, STable* tbl, char const *name, bool optional )
 {
-    rc_t rc = VDatabaseOpenTableRead( db, &tbl->vtbl, name );
+    rc_t rc = VDatabaseOpenTableRead( db, &tbl->vtbl, "%s", name );
     if ( GetRCState( rc ) == rcNotFound && optional )
     {
         rc = 0;
@@ -712,8 +714,8 @@ static rc_t Cursor_Open( STable const *const tbl, SCurs *const curs, SCol cols[]
     {
         if ( cols[ i ].name[ 0 ] == 0 )
             continue;
-        rc = VCursorAddColumn( curs->vcurs, &cols[ i ].idx, cols[ i ].name );
-        if ( GetRCObject( rc ) == rcColumn )
+        rc = VCursorAddColumn( curs->vcurs, &cols[ i ].idx, "%s", cols[ i ].name );
+        if ( GetRCObject( rc ) == ( enum RCObject ) rcColumn )
         {
             switch ( GetRCState( rc ) )
             {
@@ -1557,6 +1559,10 @@ rc_t DumpAlignedSAM( SAM_dump_ctx_t *const ctx,
                 rc = BufferedWriter(NULL, &ch, 1, NULL);
             }
         }
+	else if(ds->type == edstt_EvidenceAlignment)
+	{
+		rc = cg_canonical_print_cigar(cigar,cigLen);
+	}
         else
         {
             if ( rc == 0 )
@@ -1923,7 +1929,8 @@ static rc_t CIGAR_to_CG_Ops( cgOp op[], unsigned const maxOps,
                              unsigned *const S_adjust,
                              unsigned *const CG_adjust,
                              unsigned const read,
-                             bool const reversed )
+                             bool const reversed,
+			     bool * has_ref_offset_type)
 {
     unsigned i;
     unsigned ops = 0;
@@ -1964,6 +1971,8 @@ static rc_t CIGAR_to_CG_Ops( cgOp op[], unsigned const maxOps,
             op[ ops ].type = 1;
             op[ ops ].code = 'I';
             break;
+	case 'N':
+	    *has_ref_offset_type=true;
         case 'D':
             op[ ops ].type = 2;
             break;
@@ -2075,7 +2084,7 @@ static rc_t CIGAR_to_CG_Ops( cgOp op[], unsigned const maxOps,
             }
             if ( ( fwd == 0 && rev == 0 ) || ( fwd != 0 && rev != 0 ) )
             {
-                for ( i = 0; i < ops; ++i )
+                if(!(*has_ref_offset_type)) for ( i = 0; i < ops; ++i )
                 {
                     if ( op[ i ].type == 2 )
                     {
@@ -2237,10 +2246,11 @@ static rc_t GenerateCGData( SCol cols[], unsigned style )
         unsigned CG_adjust = 0;
         unsigned const read = cols[ alg_SEQ_READ_ID ].len && cols[ alg_REVERSED ].len ? cols[ alg_SEQ_READ_ID ].base.coord1[ 0 ] : 0;
         bool const reversed = cols[ alg_REVERSED ].len ? cols[ alg_REVERSED ].base.u8[ 0 ] : false;
+	bool has_ref_offset_type = false;
         
         rc = CIGAR_to_CG_Ops( cigOp, sizeof( cigOp ) / sizeof( cigOp[ 0 ] ), &opCnt, gap,
                               cols[ alg_CIGAR ].base.str, cols[ alg_CIGAR ].len,
-                              &S_adjust, &CG_adjust, read, reversed );
+                              &S_adjust, &CG_adjust, read, reversed, &has_ref_offset_type );
         if ( GetRCState( rc ) == rcNotFound && GetRCObject( rc ) == rcFormat )
         {
             rc = 0;
@@ -2252,7 +2262,7 @@ static rc_t GenerateCGData( SCol cols[], unsigned style )
         if ( rc != 0 )
             return 0;
 
-        if ( CG_adjust == 0 )
+        if ( !has_ref_offset_type && CG_adjust == 0 )
             CG_adjust = ( gap[ 0 ] < opCnt ? cigOp[ gap[ 0 ] ].length : 0 )
                       + ( gap[ 1 ] < opCnt ? cigOp[ gap[ 1 ] ].length : 0 )
                       + ( gap[ 2 ] < opCnt ? cigOp[ gap[ 2 ] ].length : 0 );
@@ -2344,7 +2354,7 @@ static rc_t GenerateCGData( SCol cols[], unsigned style )
                         len = 0;
                     }
                 }
-                CG_adjust -= cigOp[ gap[ 0 ] ].length;
+                if(!has_ref_offset_type) CG_adjust -= cigOp[ gap[ 0 ] ].length;
             }
         }
         if ( rc == 0 )
@@ -3488,7 +3498,7 @@ static rc_t ProcessTable( VDBManager const *mgr, char const fullPath[],
                           char const accession[], char const readGroup[] )
 {
     VTable const *tbl;
-    rc_t rc = VDBManagerOpenTableRead( mgr, &tbl, 0, fullPath );
+    rc_t rc = VDBManagerOpenTableRead( mgr, &tbl, 0, "%s", fullPath );
     
     if ( rc != 0 )
     {
@@ -3497,7 +3507,7 @@ static rc_t ProcessTable( VDBManager const *mgr, char const fullPath[],
         rc = VDBManagerMakeSRASchema( mgr, &schema );
         if ( rc == 0 )
         {
-            rc = VDBManagerOpenTableRead( mgr, &tbl, schema, fullPath );
+            rc = VDBManagerOpenTableRead( mgr, &tbl, schema, "%s", fullPath );
             VSchemaRelease( schema );
         }
     }
@@ -3644,7 +3654,7 @@ static rc_t ProcessDB( VDatabase const *db, char const fullPath[],
     
     if ( ctx.seq.tbl.name )
     {
-        rc = VDatabaseOpenTableRead( db, &ctx.seq.tbl.vtbl, ctx.seq.tbl.name );
+        rc = VDatabaseOpenTableRead( db, &ctx.seq.tbl.vtbl, "%s", ctx.seq.tbl.name );
         if ( rc == 0 )
         {
             ctx.seq.cols = seq_cols;
@@ -3663,13 +3673,13 @@ static rc_t ProcessDB( VDatabase const *db, char const fullPath[],
     SetupColumns( &ctx.eva, edstt_EvidenceAlignment );
     
     if ( ctx.pri.tbl.name )
-        VDatabaseOpenTableRead( db, &ctx.pri.tbl.vtbl, ctx.pri.tbl.name );
+        VDatabaseOpenTableRead( db, &ctx.pri.tbl.vtbl, "%s", ctx.pri.tbl.name );
     if ( ctx.sec.tbl.name )
-        VDatabaseOpenTableRead( db, &ctx.sec.tbl.vtbl, ctx.sec.tbl.name );
+        VDatabaseOpenTableRead( db, &ctx.sec.tbl.vtbl, "%s", ctx.sec.tbl.name );
     if ( ctx.evi.tbl.name )
-        VDatabaseOpenTableRead( db, &ctx.evi.tbl.vtbl, ctx.evi.tbl.name );
+        VDatabaseOpenTableRead( db, &ctx.evi.tbl.vtbl, "%s", ctx.evi.tbl.name );
     if ( ctx.eva.tbl.name )
-        VDatabaseOpenTableRead( db, &ctx.eva.tbl.vtbl, ctx.eva.tbl.name );
+        VDatabaseOpenTableRead( db, &ctx.eva.tbl.vtbl, "%s", ctx.eva.tbl.name );
     
     if (   ctx.pri.tbl.vtbl == NULL
         && ctx.sec.tbl.vtbl == NULL
@@ -3680,7 +3690,7 @@ static rc_t ProcessDB( VDatabase const *db, char const fullPath[],
         if ( ctx.seq.tbl.name == NULL )
         {
             ctx.seq.tbl.name = "SEQUENCE";
-            rc = VDatabaseOpenTableRead( db, &ctx.seq.tbl.vtbl, ctx.seq.tbl.name );
+            rc = VDatabaseOpenTableRead( db, &ctx.seq.tbl.vtbl, "%s", ctx.seq.tbl.name );
         }
         if ( rc == 0 )
         {
@@ -3701,7 +3711,7 @@ static rc_t ProcessDB( VDatabase const *db, char const fullPath[],
     
     if ( ctx.ref.tbl.name )
     {
-        rc = VDatabaseOpenTableRead( db, &ctx.ref.tbl.vtbl, ctx.ref.tbl.name );
+        rc = VDatabaseOpenTableRead( db, &ctx.ref.tbl.vtbl, "%s", ctx.ref.tbl.name );
         ctx.ref.type = edstt_Reference;
     }
     if ( rc == 0 )
@@ -3853,7 +3863,7 @@ static rc_t ProcessPath( VDBManager const *mgr, char const Path[] )
                     break;
                 }
             }
-            rc = VDBManagerOpenDBRead( mgr, &db, NULL, fullPath );
+            rc = VDBManagerOpenDBRead( mgr, &db, NULL, "%s", fullPath );
             if ( rc == 0 )
             {
                 rc = ProcessDB( db, fullPath, accession, readGroup );
@@ -3938,7 +3948,7 @@ static rc_t ProcessPath( VDBManager const *mgr, char const Path[] )
                     break;
                 }
             }
-            rc = VDBManagerOpenDBRead( mgr, &db, NULL, path );
+            rc = VDBManagerOpenDBRead( mgr, &db, NULL, "%s", path );
             if ( rc == 0 )
             {
                 rc = ProcessDB( db, path, accession, readGroup );
@@ -3973,7 +3983,7 @@ static rc_t ProcessPath( VDBManager const *mgr, char const Path[] )
             char readgroup_ [257];
             char * readgroup;
 
-            rc = VFSManagerMakePath (vfs, &vpath, Path);
+            rc = VFSManagerMakePath (vfs, &vpath, "%s", Path);
             VFSManagerRelease ( vfs );
             if ( rc == 0 )
             {
@@ -4036,7 +4046,7 @@ static rc_t ProcessPath( VDBManager const *mgr, char const Path[] )
                     {
                         VDatabase const *db;
                         
-                        rc = VDBManagerOpenDBRead( mgr, &db, NULL, Path );
+                        rc = VDBManagerOpenDBRead( mgr, &db, NULL, "%s", Path );
                         if ( rc == 0 )
                         {
                             rc = ProcessDB( db, Path, basename, readgroup );
diff --git a/tools/sra-pileup/sam-dump.vers b/tools/sra-pileup/sam-dump.vers
index cc6c9a4..8e8299d 100644
--- a/tools/sra-pileup/sam-dump.vers
+++ b/tools/sra-pileup/sam-dump.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/sra-pileup/sam-dump.vers.h b/tools/sra-pileup/sam-dump.vers.h
new file mode 100644
index 0000000..d8a5034
--- /dev/null
+++ b/tools/sra-pileup/sam-dump.vers.h
@@ -0,0 +1 @@
+#define SAM_DUMP_VERS 0x02040002
diff --git a/tools/sra-pileup/sam-dump2.vers b/tools/sra-pileup/sam-dump2.vers
new file mode 100644
index 0000000..8e8299d
--- /dev/null
+++ b/tools/sra-pileup/sam-dump2.vers
@@ -0,0 +1 @@
+2.4.2
diff --git a/tools/sra-pileup/sam-dump3.c b/tools/sra-pileup/sam-dump3.c
index 8d51c9b..67087d2 100644
--- a/tools/sra-pileup/sam-dump3.c
+++ b/tools/sra-pileup/sam-dump3.c
@@ -151,10 +151,20 @@ char const *sd_min_mapq_usage[]       = { "min. mapq an alignment has to have, t
 char const *sd_no_mate_cache_usage[]  = { "do not use a mate-cache, slower but less memory usage",
                                        NULL };
 
-char const *rna_splice_usage[]        = { "modify cigar-string and output flags if rna-splicing detected",
+char const *rna_splice_usage[]        = { "modify cigar-string (replace .D. with .N.) and add output flags (XS:A:+/-) ",
+                                           "when rna-splicing is detected by match to spliceosome recognition sites",
                                        NULL };
 
+char const *rna_splicel_usage[]       = { "level of rna-splicing detection (0,1,2)",
+                                           "when testing for spliceosome recognition sites ",
+                                           "0=perfect match, 1=one mismatch, 2=two mismatches ",
+                                           "one on each site",
+                                       NULL };
+
+char const *rna_splice_log_usage[]    = { "file, into which rna-splice events are written", NULL };
+
 char const *no_mt_usage[]             = { "disable multithreading", NULL };                                       
+
                                       
 OptDef SamDumpArgs[] =
 {
@@ -177,7 +187,6 @@ OptDef SamDumpArgs[] =
     { OPT_FASTA,        NULL, NULL, sd_fasta_usage,          0, false, false },  /* output-format = fasta ( instead of SAM ) */
     { OPT_PREFIX,        "p", NULL, sd_prefix_usage,         0, true,  false },  /* prefix QNAME with this string */
     { OPT_REVERSE,      NULL, NULL, sd_reverse_usage,        0, false, false },  /* reverse unaligned reads if reverse-flag set*/
-    { OPT_TEST_ROWS,    NULL, NULL, NULL,                    0, true,  false },  /* test-rows, if >0 limit output to this amount of rows */
     { OPT_MATE_GAP,     NULL, NULL, NULL,                    0, true,  false },  /* int value, mate's farther apart than this are not cached */
     { OPT_CIGAR_CG_M,   NULL, NULL, sd_cigarCGMerge_usage,   0, false, false },  /* transform cg-data(length of read/patterns in cigar) into valid SAM (cigar/READ/QUALITY)*/
     { OPT_XI_DEBUG,     NULL, NULL, sd_XI_usage,             0, false, false },  /* output alignment id for debugging... XI:I:NNNNNNN */
@@ -196,11 +205,14 @@ OptDef SamDumpArgs[] =
     { OPT_MIN_MAPQ,     NULL, NULL, sd_min_mapq_usage,       0, true,  false },  /* minimal mapping quality */
     { OPT_NO_MATE_CACHE,NULL, NULL, sd_no_mate_cache_usage,  0, false, false },  /* do not use mate-cache */
     { OPT_RNA_SPLICE,   NULL, NULL, rna_splice_usage,        0, false, false },  /* detect rna-splicing in sequence */
+    { OPT_RNA_SPLICEL,  NULL, NULL, rna_splicel_usage,       0, true,  false },  /* level of rna-splicing detection */
+    { OPT_RNA_SPLICE_LOG,  NULL, NULL, rna_splice_log_usage, 0, true,  false },  /* filename to log rna-splice events into */
     { OPT_NO_MT,        NULL, NULL, no_mt_usage,              0, false, false },   /* force new code-path */    
     { OPT_DUMP_MODE,    NULL, NULL, NULL,                    0, true,  false },  /* how to produce aligned reads if no regions given */
     { OPT_CIGAR_TEST,   NULL, NULL, NULL,                    0, true,  false },  /* test cg-treatment of cigar string */
     { OPT_LEGACY,       NULL, NULL, NULL,                    0, false, false },  /* force legacy code-path */
     { OPT_NEW,          NULL, NULL, NULL,                    0, false, false },   /* force new code-path */
+    { OPT_TIMING,       NULL, NULL, NULL,                    0, true, false }    /* optional timing */
 };
 
 char const *sd_usage_params[] =
@@ -224,7 +236,6 @@ char const *sd_usage_params[] =
     NULL,                       /* fastq */
     "prefix",                   /* prefix */
     NULL,                       /* reverse */
-    NULL,                       /* test-rows */
     NULL,                       /* mate-row-gap-cacheable */
     NULL,                       /* cigarCGMerge */
     NULL,                       /* XI */
@@ -243,11 +254,14 @@ char const *sd_usage_params[] =
     NULL,                       /* min_mapq */
     NULL,                       /* no mate-cache */
     NULL,                       /* detect rna-splicing in sequence */
+    NULL,                       /* level of rna-splicing detection */
+    NULL,                       /* file to log rna-splice-events into */
     NULL,                       /* no-mt */    
     NULL,                       /* dump_mode */
     NULL,                       /* cigar test */
     NULL,                       /* force legacy code path */
-    NULL                        /* force new code path */
+    NULL,                       /* force new code path */
+    NULL                        /* optional timing */
 };
 
 ver_t CC KAppVersion( void )
@@ -377,8 +391,6 @@ static rc_t print_samdump( const samdump_opts * const opts )
 
                         if ( rc == 0 )
                         {
-                            uint64_t rows_so_far = 0;
-
                             /* print output of header */
                             if ( ( opts->output_format == of_sam )  &&
                                  ( ifs->database_count > 0 )        &&
@@ -394,7 +406,7 @@ static rc_t print_samdump( const samdump_opts * const opts )
                                  ifs->database_count > 0 && 
                                  !opts->dump_unaligned_only )
                             /* ------------------------------------------------------ */
-                                rc = print_aligned_spots( opts, ifs, mc, &rows_so_far ); /* sam-aligned.c */
+                                rc = print_aligned_spots( opts, ifs, mc ); /* sam-aligned.c */
                             /* ------------------------------------------------------ */
 
 
@@ -402,7 +414,7 @@ static rc_t print_samdump( const samdump_opts * const opts )
                             if ( rc == 0 )
                             {
                                 /* ------------------------------------------------------ */
-                                rc = print_unaligned_spots( opts, ifs, mc, &rows_so_far ); /* sam-unaligned.c */
+                                rc = print_unaligned_spots( opts, ifs, mc ); /* sam-unaligned.c */
                                 /* ------------------------------------------------------ */
                             }
 
diff --git a/tools/sra-pileup/sam-dump3.vers b/tools/sra-pileup/sam-dump3.vers
new file mode 100644
index 0000000..4a36342
--- /dev/null
+++ b/tools/sra-pileup/sam-dump3.vers
@@ -0,0 +1 @@
+3.0.0
diff --git a/tools/sra-pileup/sam-hdr.c b/tools/sra-pileup/sam-hdr.c
index faad998..ab9ec8e 100644
--- a/tools/sra-pileup/sam-hdr.c
+++ b/tools/sra-pileup/sam-hdr.c
@@ -24,7 +24,9 @@
 *
 */
 
+#include <klib/time.h>
 #include <kfs/file.h>
+#include <kfs/filetools.h>
 #include <kdb/meta.h>
 #include <kdb/namelist.h>
 #include <align/reference.h>
@@ -33,7 +35,6 @@
 #include "sam-dump-opts.h"
 #include "inputfiles.h"
 
-
 static rc_t print_headers_from_metadata( const VDatabase * db, bool * recalc, const char * path )
 {
     const KMetadata * meta;
@@ -683,6 +684,12 @@ static rc_t print_org_headers( const samdump_opts * opts, input_files * ifs )
 rc_t print_headers( const samdump_opts * opts, input_files * ifs )
 {
     rc_t rc = 0;
+
+#if _DEBUGGING
+    if ( opts->perf_log != NULL )
+        perf_log_start_section( opts->perf_log, "headers" );
+#endif
+
     switch( opts->header_mode )
     {
         case hm_dump    :  rc = print_org_headers( opts, ifs ); break;
@@ -711,5 +718,11 @@ rc_t print_headers( const samdump_opts * opts, input_files * ifs )
             }
         }
     }
+
+#if _DEBUGGING
+    if ( opts->perf_log != NULL )
+        perf_log_end_section( opts->perf_log );
+#endif
+
     return rc;
 }
diff --git a/tools/sra-pileup/sam-unaligned.c b/tools/sra-pileup/sam-unaligned.c
index 53cf05c..9511f40 100644
--- a/tools/sra-pileup/sam-unaligned.c
+++ b/tools/sra-pileup/sam-unaligned.c
@@ -45,7 +45,9 @@ typedef struct prim_table_ctx
 } prim_table_ctx;
 
 
-static rc_t prepare_prim_table_ctx( const samdump_opts * const opts, const input_table * const itab, prim_table_ctx * const ptx )
+static rc_t prepare_prim_table_ctx( const samdump_opts * const opts,
+                                    const input_table * const itab,
+                                    prim_table_ctx * const ptx )
 {
     rc_t rc;
 
@@ -106,7 +108,9 @@ typedef struct seq_table_ctx
 } seq_table_ctx;
 
 
-static rc_t prepare_seq_table_ctx( const samdump_opts * const opts, const input_table * const itab, seq_table_ctx * const stx, bool legacy )
+static rc_t prepare_seq_table_ctx( const samdump_opts * const opts,
+                                   const input_table * const itab,
+                                   seq_table_ctx * const stx )
 {
     struct KNamelist * available_columns;
     rc_t rc = VTableListReadableColumns ( itab->tab, &available_columns );
@@ -170,7 +174,10 @@ static rc_t complain_size_diff( int64_t row_id, const char * txt )
 }
 
 
-static rc_t read_seq_row( const samdump_opts * const opts, const seq_table_ctx * const stx, const int64_t row_id, seq_row * const row )
+static rc_t read_seq_row( const samdump_opts * const opts,
+                          const seq_table_ctx * const stx,
+                          const int64_t row_id,
+                          seq_row * const row )
 {
     rc_t rc = 0;
 
@@ -250,8 +257,10 @@ static rc_t read_seq_row( const samdump_opts * const opts, const seq_table_ctx *
             ( column 'READ_FILTER' has bit READ_FILTER_CRITERIA set )
 
 **********************************************************************************/
-static uint32_t calculate_unaligned_sam_flags_db( uint32_t nreads, uint32_t read_idx,
-                                                  uint32_t mate_idx, int64_t mate_id,
+static uint32_t calculate_unaligned_sam_flags_db( uint32_t nreads,
+                                                  uint32_t read_idx,
+                                                  uint32_t mate_idx,
+                                                  int64_t mate_id,
                                                   const INSDC_read_type * read_type,
                                                   bool reverse_flag,
                                                   const INSDC_read_filter * read_filter )
@@ -285,9 +294,15 @@ static uint32_t calculate_unaligned_sam_flags_db( uint32_t nreads, uint32_t read
 
 const char * ref_name_star = "*";
 
-static rc_t get_mate_info( const prim_table_ctx * const ptx, const matecache * const mc,
-                           const input_database * const ids, const int64_t row_id, const int64_t mate_id, const uint32_t nreads,
-                           const char ** mate_ref_name, uint32_t * const mate_ref_name_len, INSDC_coord_zero * const mate_ref_pos )
+static rc_t get_mate_info( const prim_table_ctx * const ptx,
+                           const matecache * const mc,
+                           const input_database * const ids,
+                           const int64_t row_id,
+                           const int64_t mate_id,
+                           const uint32_t nreads,
+                           const char ** mate_ref_name,
+                           uint32_t * const mate_ref_name_len,
+                           INSDC_coord_zero * const mate_ref_pos )
 {
     rc_t rc = 0;
 
@@ -353,8 +368,11 @@ static rc_t get_mate_info( const prim_table_ctx * const ptx, const matecache * c
 }
 
 
-static rc_t print_sliced_read( const INSDC_dna_text * read, uint32_t read_idx,
-                               bool reverse, const INSDC_coord_zero * read_start, const INSDC_coord_len * read_len )
+static rc_t print_sliced_read( const INSDC_dna_text * read,
+                               uint32_t read_idx,
+                               bool reverse,
+                               const INSDC_coord_zero * read_start,
+                               const INSDC_coord_len * read_len )
 {
     rc_t rc = 0;
     const INSDC_dna_text * ptr = read + read_start[ read_idx ];
@@ -392,16 +410,22 @@ static rc_t print_sliced_read( const INSDC_dna_text * read, uint32_t read_idx,
 }
 
 
-static rc_t print_sliced_quality( const samdump_opts * const opts, const char * quality, uint32_t read_idx,
-                                  bool reverse, const INSDC_coord_zero * read_start, const INSDC_coord_len * read_len )
+static rc_t print_sliced_quality( const samdump_opts * const opts,
+                                  const char * quality,
+                                  uint32_t read_idx,
+                                  bool reverse,
+                                  const INSDC_coord_zero * read_start,
+                                  const INSDC_coord_len * read_len )
 {
     const char * ptr = quality + read_start[ read_idx ];
     return dump_quality( opts, ptr, read_len[ read_idx ], reverse ); /* sam-dump-opts.c */
 }
 
 
-static rc_t dump_the_other_read( const seq_table_ctx * const stx, const prim_table_ctx * const ptx,
-                                 const int64_t row_id, const uint32_t mate_idx )
+static rc_t dump_the_other_read( const seq_table_ctx * const stx,
+                                 const prim_table_ctx * const ptx,
+                                 const int64_t row_id,
+                                 const uint32_t mate_idx )
 {
     uint32_t row_len;
     const int64_t *prim_al_id_ptr;
@@ -464,7 +488,9 @@ static uint32_t calc_mate_idx( const uint32_t n_reads, const uint32_t read_idx )
 
 
 static rc_t read_quality( const seq_table_ctx * const stx,
-                          const int64_t row_id, const char **quality, const uint32_t read_len )
+                          const int64_t row_id,
+                          const char **quality,
+                          const uint32_t read_len )
 {
     uint32_t quality_len;
     rc_t rc = read_char_ptr( row_id, stx->cursor, stx->quality_idx, quality, &quality_len, "QUALITY" );
@@ -475,7 +501,9 @@ static rc_t read_quality( const seq_table_ctx * const stx,
 
 
 static rc_t read_read_type( const seq_table_ctx * const stx,
-                            const int64_t row_id, const INSDC_read_type **read_type, const uint32_t read_len )
+                            const int64_t row_id,
+                            const INSDC_read_type **read_type,
+                            const uint32_t read_len )
 {
     uint32_t read_type_len;
     rc_t rc = read_INSDC_read_type_ptr( row_id, stx->cursor, stx->read_type_idx, read_type, &read_type_len, "READ_TYPE" );
@@ -486,7 +514,9 @@ static rc_t read_read_type( const seq_table_ctx * const stx,
 
 
 static rc_t read_read_filter( const seq_table_ctx * const stx,
-                              const int64_t row_id, const INSDC_read_filter **read_filter, const uint32_t read_len )
+                              const int64_t row_id,
+                              const INSDC_read_filter **read_filter,
+                              const uint32_t read_len )
 {
     uint32_t read_filter_len;
     rc_t rc = read_INSDC_read_filter_ptr( row_id, stx->cursor, stx->read_filter_idx, read_filter, &read_filter_len, "READ_FILTER" );
@@ -497,7 +527,9 @@ static rc_t read_read_filter( const seq_table_ctx * const stx,
 
 
 static rc_t read_read_start( const seq_table_ctx * const stx,
-                             const int64_t row_id, const INSDC_coord_zero **read_start, const uint32_t nreads )
+                             const int64_t row_id,
+                             const INSDC_coord_zero **read_start,
+                             const uint32_t nreads )
 {
     uint32_t read_start_len;
     rc_t rc = read_INSDC_coord_zero_ptr( row_id, stx->cursor, stx->read_start_idx, read_start, &read_start_len, "READ_START" );
@@ -508,7 +540,9 @@ static rc_t read_read_start( const seq_table_ctx * const stx,
 
 
 static rc_t read_read_len( const seq_table_ctx * const stx,
-                           const int64_t row_id, const INSDC_coord_len **read_len, const uint32_t nreads )
+                           const int64_t row_id,
+                           const INSDC_coord_len **read_len,
+                           const uint32_t nreads )
 {
     uint32_t read_len_len;
     rc_t rc = read_INSDC_coord_len_ptr( row_id, stx->cursor, stx->read_len_idx, read_len, &read_len_len, "READ_LEN" );
@@ -518,7 +552,9 @@ static rc_t read_read_len( const seq_table_ctx * const stx,
 }
 
 
-static bool calc_reverse_flag( const samdump_opts * const opts, const uint32_t read_idx, const INSDC_read_type * read_type )
+static bool calc_reverse_flag( const samdump_opts * const opts,
+                               const uint32_t read_idx,
+                               const INSDC_read_type * read_type )
 {
     bool res = ( ( read_type[ read_idx ] & READ_TYPE_REVERSE ) == READ_TYPE_REVERSE );
     if ( res )
@@ -527,10 +563,13 @@ static bool calc_reverse_flag( const samdump_opts * const opts, const uint32_t r
 }
 
 
-static rc_t dump_seq_row_sam_filtered( const samdump_opts * const opts, const seq_table_ctx * const stx,
-                                       const prim_table_ctx * const ptx, const matecache * const mc,
-                                       const input_database * const ids, const int64_t row_id, const uint32_t nreads,
-                                       uint64_t * const printed )
+static rc_t dump_seq_row_sam_filtered( const samdump_opts * const opts,
+                                       const seq_table_ctx * const stx,
+                                       const prim_table_ctx * const ptx,
+                                       const matecache * const mc,
+                                       const input_database * const ids,
+                                       const int64_t row_id,
+                                       const uint32_t nreads )
 {
     uint32_t read_idx, rd_len, prim_align_ids_len, spot_group_len;
     const int64_t * prim_align_ids;
@@ -656,9 +695,6 @@ static rc_t dump_seq_row_sam_filtered( const samdump_opts * const opts, const se
 
                             if ( rc == 0 )
                                 rc = KOutMsg( "\n" );
-
-                            if ( rc == 0 )
-                                (*printed)++;
                         }
                     }
                 }
@@ -673,10 +709,13 @@ static rc_t dump_seq_row_sam_filtered( const samdump_opts * const opts, const se
 }
 
 
-static rc_t dump_seq_prim_row_sam( const samdump_opts * const opts, const seq_table_ctx * const stx,
-                                   const prim_table_ctx * const ptx, const matecache * const mc,
-                                   const input_database * const ids, const int64_t row_id, const uint32_t nreads,
-                                   uint64_t * const printed )
+static rc_t dump_seq_prim_row_sam( const samdump_opts * const opts,
+                                   const seq_table_ctx * const stx,
+                                   const prim_table_ctx * const ptx,
+                                   const matecache * const mc,
+                                   const input_database * const ids,
+                                   const int64_t row_id,
+                                   const uint32_t nreads )
 {
     uint32_t read_idx, rd_len, prim_align_ids_len, spot_group_len;
     const int64_t * prim_align_ids;
@@ -818,9 +857,6 @@ static rc_t dump_seq_prim_row_sam( const samdump_opts * const opts, const seq_ta
 
             if ( rc == 0 )
                 rc = KOutMsg( "\n" );
-
-            if ( rc == 0 )
-                (*printed)++;
         }
     }
     return rc;
@@ -828,8 +864,10 @@ static rc_t dump_seq_prim_row_sam( const samdump_opts * const opts, const seq_ta
 
 
 /* called if we are dumping from a legacy table instead from a database */
-static rc_t dump_seq_row_sam( const samdump_opts * const opts, const seq_table_ctx * const stx,
-                              const int64_t row_id, const uint32_t nreads, uint64_t * const printed )
+static rc_t dump_seq_row_sam( const samdump_opts * const opts,
+                              const seq_table_ctx * const stx,
+                              const int64_t row_id,
+                              const uint32_t nreads )
 {
     uint32_t read_idx, rd_len, spot_group_len, name_len;
     const char * spot_group = NULL;
@@ -932,19 +970,19 @@ static rc_t dump_seq_row_sam( const samdump_opts * const opts, const seq_table_c
 
             if ( rc == 0 )
                 rc = KOutMsg( "\n" );
-
-            if ( rc == 0 )
-                (*printed)++;
         }
     }
     return rc;
 }
 
 
-static rc_t dump_seq_row_fastx_filtered( const samdump_opts * const opts, const seq_table_ctx * const stx,
-                                         const prim_table_ctx * const ptx, const matecache * const mc,
+static rc_t dump_seq_row_fastx_filtered( const samdump_opts * const opts,
+                                         const seq_table_ctx * const stx,
+                                         const prim_table_ctx * const ptx,
+                                         const matecache * const mc,
                                          const input_database * const ids,
-                                         const int64_t row_id, const uint32_t nreads, uint64_t * const printed )
+                                         const int64_t row_id,
+                                         const uint32_t nreads )
 {
     uint32_t read_idx, rd_len, prim_align_ids_len, spot_group_len = 0;
     const int64_t * prim_align_ids;
@@ -1020,7 +1058,6 @@ static rc_t dump_seq_row_fastx_filtered( const samdump_opts * const opts, const
                         if ( rc == 0 )
                             rc = KOutMsg( "\n" );
                     }
-                    (*printed)++;
                 }
                 else
                 {
@@ -1033,8 +1070,10 @@ static rc_t dump_seq_row_fastx_filtered( const samdump_opts * const opts, const
 }
 
 
-static rc_t dump_seq_row_fastx( const samdump_opts * const opts, const seq_table_ctx * const stx,
-                                const int64_t row_id, const uint32_t nreads, uint64_t * const printed )
+static rc_t dump_seq_row_fastx( const samdump_opts * const opts,
+                                const seq_table_ctx * const stx,
+                                const int64_t row_id,
+                                const uint32_t nreads )
 {
     uint32_t read_idx, rd_len, prim_align_ids_len, spot_group_len = 0;
     const int64_t * prim_align_ids;
@@ -1099,15 +1138,16 @@ static rc_t dump_seq_row_fastx( const samdump_opts * const opts, const seq_table
                 if ( rc == 0 )
                     rc = KOutMsg( "\n" );
             }
-            (*printed)++;
         }
     }
     return rc;
 }
 
 
-static rc_t dump_seq_tab_row_fastx( const samdump_opts * const opts, const seq_table_ctx * const stx,
-                                    const int64_t row_id, const uint32_t nreads, uint64_t * const printed )
+static rc_t dump_seq_tab_row_fastx( const samdump_opts * const opts,
+                                    const seq_table_ctx * const stx,
+                                    const int64_t row_id,
+                                    const uint32_t nreads )
 {
     uint32_t read_idx, rd_len, name_len, spot_group_len = 0;
     const char * quality = NULL;
@@ -1175,7 +1215,6 @@ static rc_t dump_seq_tab_row_fastx( const samdump_opts * const opts, const seq_t
                 if ( rc == 0 )
                     rc = KOutMsg( "\n" );
             }
-            (*printed)++;
         }
     }
     return rc;
@@ -1189,7 +1228,6 @@ typedef struct unaligned_callback_ctx
     const matecache * mc;
     seq_table_ctx * stx;
     prim_table_ctx * ptx;
-    uint64_t * rows_so_far;
 } unaligned_callback_ctx;
 
 
@@ -1205,9 +1243,9 @@ static rc_t CC on_unaligned_seq_id( int64_t seq_id, int64_t al_id, void * user_d
         {
             switch( u_ctx->opts->output_format )
             {
-                case of_sam   : rc = dump_seq_row_sam_filtered( u_ctx->opts, u_ctx->stx, u_ctx->ptx, u_ctx->mc, u_ctx->ids, seq_id, row.nreads, u_ctx->rows_so_far ); break;
+                case of_sam   : rc = dump_seq_row_sam_filtered( u_ctx->opts, u_ctx->stx, u_ctx->ptx, u_ctx->mc, u_ctx->ids, seq_id, row.nreads ); break;
                 case of_fasta : /* fall through intended ! */
-                case of_fastq : rc = dump_seq_row_fastx_filtered( u_ctx->opts, u_ctx->stx, u_ctx->ptx, u_ctx->mc, u_ctx->ids, seq_id, row.nreads, u_ctx->rows_so_far ); break;
+                case of_fastq : rc = dump_seq_row_fastx_filtered( u_ctx->opts, u_ctx->stx, u_ctx->ptx, u_ctx->mc, u_ctx->ids, seq_id, row.nreads ); break;
             }
         }
     }
@@ -1215,12 +1253,14 @@ static rc_t CC on_unaligned_seq_id( int64_t seq_id, int64_t al_id, void * user_d
 }
 
 
-static rc_t print_unaligned_database_filtered_2( const samdump_opts * const opts, const input_table * const seq,
-                                                 const input_table * const prim, const matecache * const mc,
-                                                 const input_database * const ids, uint64_t * const rows_so_far )
+static rc_t print_unaligned_database_filtered_2( const samdump_opts * const opts,
+                                                 const input_table * const seq,
+                                                 const input_table * const prim,
+                                                 const matecache * const mc,
+                                                 const input_database * const ids )
 {
     seq_table_ctx stx;
-    rc_t rc = prepare_seq_table_ctx( opts, seq, &stx, ( prim == NULL ) );
+    rc_t rc = prepare_seq_table_ctx( opts, seq, &stx );
     if ( rc == 0 )
     {
         rc = VCursorOpen( stx.cursor );
@@ -1240,7 +1280,6 @@ static rc_t print_unaligned_database_filtered_2( const samdump_opts * const opts
                 u_ctx.mc = mc;
                 u_ctx.stx = &stx;
                 u_ctx.ptx = &ptx;
-                u_ctx.rows_so_far = rows_so_far;
                 rc = foreach_unaligned_entry( mc, ids->db_idx, on_unaligned_seq_id, &u_ctx );
                 VCursorRelease( ptx.cursor );
             }
@@ -1251,14 +1290,16 @@ static rc_t print_unaligned_database_filtered_2( const samdump_opts * const opts
 
 
 /* we are printing from a sra-database, we print half aligned reads only if we find them in the mate-cache */
-static rc_t print_unaligned_database_filtered( const samdump_opts * const opts, const input_table * const seq,
-                                               const input_table * const prim, const matecache * const mc,
-                                               const input_database * const ids, uint64_t * const rows_so_far )
+static rc_t print_unaligned_database_filtered( const samdump_opts * const opts,
+                                               const input_table * const seq,
+                                               const input_table * const prim,
+                                               const matecache * const mc,
+                                               const input_database * const ids )
 {
-    return print_unaligned_database_filtered_2( opts, seq, prim, mc, ids, rows_so_far );
+    return print_unaligned_database_filtered_2( opts, seq, prim, mc, ids );
 #if 0
     seq_table_ctx stx;
-    rc_t rc = prepare_seq_table_ctx( opts, seq, &stx, ( prim == NULL ) );
+    rc_t rc = prepare_seq_table_ctx( opts, seq, &stx );
     if ( rc == 0 )
     {
         rc = VCursorOpen( stx.cursor );
@@ -1284,7 +1325,7 @@ static rc_t print_unaligned_database_filtered( const samdump_opts * const opts,
                     int64_t row_id;
                     seq_row row;
 
-                    for ( row_id = first_row; ( ( row_id - first_row ) < row_count ) && rc == 0 && !test_limit_reached( opts, *rows_so_far ); ++row_id )
+                    for ( row_id = first_row; ( ( row_id - first_row ) < row_count ) && rc == 0; ++row_id )
                     {
                         rc = Quitting();
                         if ( rc == 0 )
@@ -1294,9 +1335,9 @@ static rc_t print_unaligned_database_filtered( const samdump_opts * const opts,
                             {
                                 switch( opts->output_format )
                                 {
-                                    case of_sam   : rc = dump_seq_row_sam_filtered( opts, &stx, &ptx, mc, ids, row_id, row.nreads, rows_so_far ); break;
+                                    case of_sam   : rc = dump_seq_row_sam_filtered( opts, &stx, &ptx, mc, ids, row_id, row.nreads ); break;
                                     case of_fasta : /* fall through intended ! */
-                                    case of_fastq : rc = dump_seq_row_fastx_filtered( opts, &stx, &ptx, mc, ids, row_id, row.nreads, rows_so_far ); break;
+                                    case of_fastq : rc = dump_seq_row_fastx_filtered( opts, &stx, &ptx, mc, ids, row_id, row.nreads ); break;
                                 }
                             }
                         }
@@ -1313,12 +1354,14 @@ static rc_t print_unaligned_database_filtered( const samdump_opts * const opts,
 
 
 /* we are printing from a sra-database, we print all unaligned read we can find */
-static rc_t print_unaligned_database_full( const samdump_opts * const opts, const input_table * const seq,
-                                           const input_table * const prim, const matecache * const mc,
-                                           const input_database * const ids, uint64_t * const rows_so_far )
+static rc_t print_unaligned_database_full( const samdump_opts * const opts,
+                                           const input_table * const seq,
+                                           const input_table * const prim,
+                                           const matecache * const mc,
+                                           const input_database * const ids )
 {
     seq_table_ctx stx;
-    rc_t rc = prepare_seq_table_ctx( opts, seq, &stx, ( prim == NULL ) );
+    rc_t rc = prepare_seq_table_ctx( opts, seq, &stx );
     if ( rc == 0 )
     {
         rc = VCursorOpen( stx.cursor );
@@ -1343,7 +1386,7 @@ static rc_t print_unaligned_database_full( const samdump_opts * const opts, cons
                 else
                 {
                     seq_row row;
-                    for ( row_id = first_row; ( ( row_id - first_row ) < row_count ) && rc == 0 && !test_limit_reached( opts, *rows_so_far ); ++row_id )
+                    for ( row_id = first_row; ( ( row_id - first_row ) < row_count ) && rc == 0; ++row_id )
                     {
                         rc = Quitting();
                         if ( rc == 0 )
@@ -1353,9 +1396,9 @@ static rc_t print_unaligned_database_full( const samdump_opts * const opts, cons
                             {
                                 switch( opts->output_format )
                                 {
-                                    case of_sam   : rc = dump_seq_prim_row_sam( opts, &stx, &ptx, mc, ids, row_id, row.nreads, rows_so_far ); break;
+                                    case of_sam   : rc = dump_seq_prim_row_sam( opts, &stx, &ptx, mc, ids, row_id, row.nreads ); break;
                                     case of_fasta : /* fall through intended ! */
-                                    case of_fastq : rc = dump_seq_row_fastx( opts, &stx, row_id, row.nreads, rows_so_far ); break;
+                                    case of_fastq : rc = dump_seq_row_fastx( opts, &stx, row_id, row.nreads ); break;
                                 }
                             }
                         }
@@ -1372,10 +1415,11 @@ static rc_t print_unaligned_database_full( const samdump_opts * const opts, cons
 
 
 /* we are printing from a (legacy) table not from a database! */
-static rc_t print_unaligned_table( const samdump_opts * const opts, const input_table * const seq, uint64_t * const rows_so_far )
+static rc_t print_unaligned_table( const samdump_opts * const opts,
+                                   const input_table * const seq )
 {
     seq_table_ctx stx;
-    rc_t rc = prepare_seq_table_ctx( opts, seq, &stx, true ); /* true ... this is a legacy table, not a database */
+    rc_t rc = prepare_seq_table_ctx( opts, seq, &stx );
     if ( rc == 0 )
     {
         rc = VCursorOpen( stx.cursor );
@@ -1395,7 +1439,7 @@ static rc_t print_unaligned_table( const samdump_opts * const opts, const input_
             else
             {
                 seq_row row;
-                for ( row_id = first_row; ( ( row_id - first_row ) < row_count ) && rc == 0 && !test_limit_reached( opts, *rows_so_far ); ++row_id )
+                for ( row_id = first_row; ( ( row_id - first_row ) < row_count ) && rc == 0; ++row_id )
                 {
                     rc = Quitting();
                     if ( rc == 0 )
@@ -1405,9 +1449,9 @@ static rc_t print_unaligned_table( const samdump_opts * const opts, const input_
                         {
                             switch( opts->output_format )
                             {
-                                case of_sam   : rc = dump_seq_row_sam( opts, &stx, row_id, row.nreads, rows_so_far ); break;
+                                case of_sam   : rc = dump_seq_row_sam( opts, &stx, row_id, row.nreads ); break;
                                 case of_fasta : /* fall through intended ! */
-                                case of_fastq : rc = dump_seq_tab_row_fastx( opts, &stx, row_id, row.nreads, rows_so_far ); break;
+                                case of_fastq : rc = dump_seq_tab_row_fastx( opts, &stx, row_id, row.nreads ); break;
                             }
                         }
                     }
@@ -1421,10 +1465,17 @@ static rc_t print_unaligned_table( const samdump_opts * const opts, const input_
 
 
 /* entry point from sam-dump3.c */
-rc_t print_unaligned_spots( const samdump_opts * const opts, const input_files * const ifs,
-                            const matecache * const mc, uint64_t * const rows_so_far )
+rc_t print_unaligned_spots( const samdump_opts * const opts,
+                            const input_files * const ifs,
+                            const matecache * const mc )
 {
     rc_t rc = 0;
+
+#if _DEBUGGING
+    if ( opts->perf_log != NULL )
+        perf_log_start_section( opts->perf_log, "unaligned spots" );
+#endif
+
     if ( ( ifs->database_count > 0 ) && ( opts->dump_unaligned_reads || opts->dump_unaligned_only ) )
     {
         uint32_t db_idx;
@@ -1454,11 +1505,11 @@ rc_t print_unaligned_spots( const samdump_opts * const opts, const input_files *
                     {
                         if ( opts->region_count > 0 )
                         {
-                            rc = print_unaligned_database_filtered( opts, &seq, &prim, mc, ids, rows_so_far );
+                            rc = print_unaligned_database_filtered( opts, &seq, &prim, mc, ids );
                         }
                         else
                         {
-                            rc = print_unaligned_database_full( opts, &seq, &prim, mc, ids, rows_so_far );
+                            rc = print_unaligned_database_full( opts, &seq, &prim, mc, ids );
                         }
                         VTableRelease( prim.tab );
                     }
@@ -1475,8 +1526,14 @@ rc_t print_unaligned_spots( const samdump_opts * const opts, const input_files *
         {
             input_table * itab = VectorGet( &ifs->tabs, tab_idx );
             if ( itab != NULL )
-                rc = print_unaligned_table( opts, itab, rows_so_far );
+                rc = print_unaligned_table( opts, itab );
         }
     }
+
+#if _DEBUGGING
+    if ( opts->perf_log != NULL )
+        perf_log_end_section( opts->perf_log );
+#endif
+
     return rc;
 }
diff --git a/tools/sra-pileup/sam-unaligned.h b/tools/sra-pileup/sam-unaligned.h
index 47b8b3d..98624be 100644
--- a/tools/sra-pileup/sam-unaligned.h
+++ b/tools/sra-pileup/sam-unaligned.h
@@ -37,7 +37,8 @@ extern "C" {
 #include "inputfiles.h"
 #include "matecache.h"
 
-rc_t print_unaligned_spots( const samdump_opts * const opts, const input_files * const ifs,
-                            const matecache * const mc, uint64_t * const rows_so_far );
+rc_t print_unaligned_spots( const samdump_opts * const opts,
+                            const input_files * const ifs,
+                            const matecache * const mc );
 
 #endif
diff --git a/tools/sra-pileup/splitfastq.pl b/tools/sra-pileup/splitfastq.pl
new file mode 100755
index 0000000..c110599
--- /dev/null
+++ b/tools/sra-pileup/splitfastq.pl
@@ -0,0 +1,46 @@
+#!/usr/bin/perl -w
+
+use IO::File;
+
+my $line;
+my $state = 0;
+my %filehandles;
+my $current_filehandle;
+my $base =  $ARGV[ 0 ];
+
+if ( !defined ( $base ) )
+{
+    $base = "out";
+}
+
+while ( defined ( $line = <STDIN> ) )
+{
+    #remove line-feeds, white space etc.
+    chomp( $line );
+
+    if ( $state == 0 )
+    {
+        # get the first word
+        my $word0 = ( split( /\s+/, $line ) )[ 0 ];
+
+        # start with the beginning of the word, until '/' found, continue with numbers to end of string
+        if ( $word0 =~ /^[^\/]+\/(\d+)$/ )
+        {
+            # grep what matched after the '/'
+            my $selector = $1;
+            if ( !defined ( $filehandles{$selector}) )
+            {
+                $filehandles{$selector} = new IO::File( "$base.$selector.fastq", "w" );
+            }
+            $current_filehandle = $filehandles{$selector};
+        }
+    }
+
+    if ( defined( $current_filehandle ) )
+    {
+        $current_filehandle -> print( "$line\n" );
+    }
+
+    $state ++;
+    $state &= 0x3;
+}
\ No newline at end of file
diff --git a/tools/sra-pileup/sra-pileup.c b/tools/sra-pileup/sra-pileup.c
index 82918ab..e93dfc3 100644
--- a/tools/sra-pileup/sra-pileup.c
+++ b/tools/sra-pileup/sra-pileup.c
@@ -28,15 +28,25 @@
 
 #include "ref_regions.h"
 #include "cmdline_cmn.h"
+#include "pileup_options.h"
+#include "dyn_string.h"
 #include "reref.h"
+#include "report_deletes.h"
+#include "ref_walker_0.h"
 #include "ref_walker.h"
+#include "walk_debug.h"
+#include "4na_ascii.h"
+#include "pileup_counters.h"
+#include "pileup_index.h"
+#include "pileup_varcount.h"
+#include "pileup_stat.h"
+#include "pileup_v2.h"
 
 #include <kapp/main.h>
 
 #include <klib/out.h>
 #include <klib/printf.h>
 #include <klib/report.h>
-#include <klib/sort.h>
 #include <klib/vector.h>
 
 #include <kfs/file.h>
@@ -87,6 +97,7 @@
 #define ALIAS_SEQNAME  "e"
 
 #define OPTION_MIN_M   "minmismatch"
+#define OPTION_MERGE   "merge-dist"
 
 #define OPTION_FUNC    "function"
 #define ALIAS_FUNC     NULL
@@ -97,7 +108,10 @@
 #define FUNC_RE_REF_EXT "ref-ex"
 #define FUNC_DEBUG      "debug"
 #define FUNC_MISMATCH   "mismatch"
+#define FUNC_INDEX      "index"
 #define FUNC_TEST       "test"
+#define FUNC_VARCOUNT   "varcount"
+#define FUNC_DELETES    "deletes"
 
 enum
 {
@@ -108,14 +122,17 @@ enum
     sra_pileup_report_ref_ext = 4,
     sra_pileup_debug = 5,
     sra_pileup_mismatch = 6,
-    sra_pileup_test = 7
+    sra_pileup_index = 7,
+    sra_pileup_test = 8,
+    sra_pileup_varcount = 9,
+    sra_pileup_deletes = 10
 };
 
 static const char * minmapq_usage[]         = { "Minimum mapq-value, ", 
                                                 "alignments with lower mapq",
                                                 "will be ignored (default=0)", NULL };
 
-static const char * dups_usage[]            = { "process duplicates ( 0...off/1..on )", NULL };
+static const char * dups_usage[]            = { "process duplicates 0..off/1..on", NULL };
 
 static const char * noqual_usage[]          = { "Omit qualities in output", NULL };
 
@@ -127,13 +144,27 @@ static const char * spotgrp_usage[]         = { "divide by spotgroups", NULL };
 
 static const char * seqname_usage[]         = { "use original seq-name", NULL };
 
-static const char * min_m_usage[]           = { "min percent of mismatches used in function mismatch, def is 5%", NULL };
+static const char * min_m_usage[]           = { "min percent of mismatches used in function mismatch, default is 5%", NULL };
+
+static const char * merge_usage[]           = { "If adjacent slices are closer than this, ",
+                                                "they are merged and a skiplist is created. ", 
+                                                "a value of zero disables the feature, default is 10000", NULL };
 
 static const char * func_ref_usage[]        = { "list references", NULL };
 static const char * func_ref_ex_usage[]     = { "list references + coverage", NULL };
 static const char * func_count_usage[]      = { "sort pileup with counters", NULL };
 static const char * func_stat_usage[]       = { "strand/tlen statistic", NULL };
 static const char * func_mismatch_usage[]   = { "only lines with mismatch", NULL };
+static const char * func_index_usage[]      = { "list deletion counts", NULL };
+
+static const char * func_varcount_usage[]   = { "variation counters: ", 
+                                                "ref-name, ref-pos, ref-base, coverage, ",
+                                                "mismatch A, mismatch C, mismatch G, mismatch T,",
+                                                "deletes, inserts,",
+                                                "ins after A, ins after C, ins after G, ins after T", NULL };
+
+static const char * func_deletes_usage[]    = { "list deletions greater then 20", NULL };
+
 static const char * func_usage[]            = { "alternative functionality", NULL };
 
 OptDef MyOptions[] =
@@ -146,30 +177,13 @@ OptDef MyOptions[] =
     { OPTION_SHOWID,  ALIAS_SHOWID,  NULL, showid_usage,  1,        false,       false },
     { OPTION_SPOTGRP, ALIAS_SPOTGRP, NULL, spotgrp_usage, 1,        false,       false },
     { OPTION_SEQNAME, ALIAS_SEQNAME, NULL, seqname_usage, 1,        false,       false },
-    { OPTION_MIN_M,   NULL,          NULL, min_m_usage,   1,        true,        false },    
+    { OPTION_MIN_M,   NULL,          NULL, min_m_usage,   1,        true,        false },
+    { OPTION_MERGE,   NULL,          NULL, merge_usage,   1,        true,        false },
     { OPTION_FUNC,    ALIAS_FUNC,    NULL, func_usage,    1,        true,        false }
 };
 
 /* =========================================================================================== */
 
-typedef struct pileup_options
-{
-    common_options cmn;
-    bool process_dups;
-    bool omit_qualities;
-    bool read_tlen;
-    bool no_skip;
-    bool show_id;
-    bool div_by_spotgrp;
-    bool use_seq_name;
-    uint32_t minmapq;
-    uint32_t min_mismatch;
-    uint32_t source_table;
-    uint32_t function;  /* sra_pileup_samtools, sra_pileup_counters, sra_pileup_stat, 
-                           sra_pileup_report_ref, sra_pileup_report_ref_ext, sra_pileup_debug */
-} pileup_options;
-
-
 typedef struct pileup_callback_data
 {
     const AlignMgr *almgr;
@@ -177,15 +191,6 @@ typedef struct pileup_callback_data
 } pileup_callback_data;
 
 
-typedef struct pileup_col_ids
-{
-    uint32_t idx_quality;
-    uint32_t idx_ref_orientation;
-    uint32_t idx_read_filter;
-    uint32_t idx_template_len;
-} pileup_col_ids;
-
-
 /* =========================================================================================== */
 
 static rc_t get_str_option( const Args *args, const char *name, const char ** res )
@@ -266,6 +271,9 @@ static rc_t get_pileup_options( Args * args, pileup_options *opts )
 
     if ( rc == 0 )
         rc = get_uint32_option( args, OPTION_MIN_M, &opts->min_mismatch, 5 );
+
+    if ( rc == 0 )
+        rc = get_uint32_option( args, OPTION_MERGE, &opts->merge_dist, 10000 );
         
     if ( rc == 0 )
         rc = get_bool_option( args, OPTION_DUPS, &opts->process_dups, false );
@@ -303,8 +311,15 @@ static rc_t get_pileup_options( Args * args, pileup_options *opts )
                 opts->function = sra_pileup_debug;
             else if ( cmp_pchar( fkt, FUNC_MISMATCH ) == 0 )
                 opts->function = sra_pileup_mismatch;
+            else if ( cmp_pchar( fkt, FUNC_INDEX ) == 0 )
+                opts->function = sra_pileup_index;
             else if ( cmp_pchar( fkt, FUNC_TEST ) == 0 )
                 opts->function = sra_pileup_test;
+            else if ( cmp_pchar( fkt, FUNC_VARCOUNT ) == 0 )
+                opts->function = sra_pileup_varcount;
+            else if ( cmp_pchar( fkt, FUNC_DELETES ) == 0 )
+                opts->function = sra_pileup_deletes;
+
         }
     }
     return rc;
@@ -351,13 +366,20 @@ rc_t CC Usage ( const Args * args )
     HelpOptionLine ( ALIAS_SPOTGRP, OPTION_SPOTGRP, "spotgroups-modes", spotgrp_usage );
     HelpOptionLine ( ALIAS_SEQNAME, OPTION_SEQNAME, NULL, seqname_usage );
     HelpOptionLine ( NULL, OPTION_MIN_M, NULL, min_m_usage );
+    HelpOptionLine ( NULL, OPTION_MERGE, NULL, merge_usage );
     
     HelpOptionLine ( NULL, "function ref",      NULL, func_ref_usage );
     HelpOptionLine ( NULL, "function ref-ex",   NULL, func_ref_ex_usage );
     HelpOptionLine ( NULL, "function count",    NULL, func_count_usage );
     HelpOptionLine ( NULL, "function stat",     NULL, func_stat_usage );
     HelpOptionLine ( NULL, "function mismatch", NULL, func_mismatch_usage );
-    
+    HelpOptionLine ( NULL, "function index",    NULL, func_index_usage );
+    HelpOptionLine ( NULL, "function varcount", NULL, func_varcount_usage );
+    HelpOptionLine ( NULL, "function deletes",  NULL, func_deletes_usage );
+
+    KOutMsg ( "\nGrouping of accessions into artificial spotgroups:\n" );
+    KOutMsg ( "  sra-pileup SRRXXXXXX=a SRRYYYYYY=b SRRZZZZZZ=a\n\n" );
+
     HelpOptionsStandard ();
     HelpVersion ( fullpath, KAppVersion() );
     return rc;
@@ -375,162 +397,6 @@ ver_t CC KAppVersion ( void )
     return SRA_PILEUP_VERS;
 }
 
-/***************************************
-    N (0x4E)  n (0x6E)  <--> 0x0
-    A (0x41)  a (0x61)  <--> 0x1
-    C (0x43)  c (0x63)  <--> 0x2
-    M (0x4D)  m (0x6D)  <--> 0x3
-    G (0x47)  g (0x67)  <--> 0x4
-    R (0x52)  r (0x72)  <--> 0x5
-    S (0x53)  s (0x73)  <--> 0x6
-    V (0x56)  v (0x76)  <--> 0x7
-    T (0x54)  t (0x74)  <--> 0x8
-    W (0x57)  w (0x77)  <--> 0x9
-    Y (0x59)  y (0x79)  <--> 0xA
-    H (0x48)  h (0x68)  <--> 0xB
-    K (0x4B)  k (0x6B)  <--> 0xC
-    D (0x44)  d (0x64)  <--> 0xD
-    B (0x42)  b (0x62)  <--> 0xE
-    N (0x4E)  n (0x6E)  <--> 0xF
-***************************************/
-
-
-static char _4na_2_ascii_tab[] =
-{
-/*  0x0  0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F */
-    'N', 'A', 'C', 'M', 'G', 'R', 'S', 'V', 'T', 'W', 'Y', 'H', 'K', 'D', 'B', 'N',
-    'n', 'a', 'c', 'm', 'g', 'r', 's', 'v', 't', 'w', 'y', 'h', 'k', 'd', 'b', 'n'
-};
-
-
-static char _4na_to_ascii( INSDC_4na_bin c, bool reverse )
-{
-    return _4na_2_ascii_tab[ ( c & 0x0F ) | ( reverse ? 0x10 : 0 ) ];
-}
-
-
-/* =========================================================================================== */
-
-
-typedef struct dyn_string
-{
-    char * data;
-    size_t allocated;
-    size_t data_len;
-} dyn_string;
-
-
-static rc_t allocated_dyn_string ( dyn_string *self, size_t size )
-{
-    rc_t rc = 0;
-    self->data_len = 0;
-    self->data = malloc( size );
-    if ( self->data != NULL )
-    {
-        self->allocated = size;
-    }
-    else
-    {
-        self->allocated = 0;
-        rc = RC( rcApp, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
-    }
-    return rc;
-}
-
-static void free_dyn_string ( dyn_string *self )
-{
-    free( self->data );
-    self->data = NULL;
-    self->allocated = 0;
-    self->data_len = 0;
-}
-
-static void reset_dyn_string( dyn_string *self )
-{
-    self->data_len = 0;
-}
-
-static rc_t expand_dyn_string( dyn_string *self, size_t new_size )
-{
-    rc_t rc = 0;
-    if ( new_size > self->allocated )
-    {
-        self->data = realloc ( self->data, new_size );
-        if ( self->data != NULL )
-        {
-            self->allocated = new_size;
-        }
-        else
-        {
-            self->allocated = 0;
-            self->data_len = 0;
-            rc = RC( rcApp, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
-        }
-    }
-    return rc;
-}
-
-
-static rc_t add_char_2_dyn_string( dyn_string *self, const char c )
-{
-    /* does nothing if self->data_len + 2 < self->allocated */
-    rc_t rc = expand_dyn_string( self, self->data_len + 2 );
-    if ( rc == 0 )
-    {
-        self->data[ self->data_len++ ] = c;
-        self->data[ self->data_len ] = 0;
-    }
-    return rc;
-}
-
-
-static rc_t add_string_2_dyn_string( dyn_string *self, const char * s )
-{
-    rc_t rc;
-    size_t size = string_size ( s );
-    /* does nothing if self->data_len + size + 1 < self->allocated */
-    rc = expand_dyn_string( self, self->data_len + size + 1 );
-    if ( rc == 0 )
-    {
-        string_copy ( &(self->data[ self->data_len ]), self->allocated, s, size );
-        self->data_len += size;
-        self->data[ self->data_len ] = 0;
-    }
-    return rc;
-}
-
-
-static rc_t print_2_dyn_string( dyn_string * self, const char *fmt, ... )
-{
-    rc_t rc = 0;
-    bool not_enough;
-
-    do
-    {
-        size_t num_writ;
-        va_list args;
-        va_start ( args, fmt );
-        rc = string_vprintf ( &(self->data[ self->data_len ]), 
-                              self->allocated - ( self->data_len + 1 ),
-                              &num_writ,
-                              fmt,
-                              args );
-        va_end ( args );
-
-        if ( rc == 0 )
-        {
-            self->data_len += num_writ;
-            self->data[ self->data_len ] = 0;
-        }
-        not_enough = ( GetRCState( rc ) == rcInsufficient );
-        if ( not_enough )
-        {
-            rc = expand_dyn_string( self, self->allocated + ( num_writ * 2 ) );
-        }
-    } while ( not_enough && rc == 0 );
-    return rc;
-}
-
 
 /* =========================================================================================== */
 
@@ -642,15 +508,6 @@ static rc_t CC write_to_FILE( void *f, const char *buffer, size_t bytes, size_t
 /* =========================================================================================== */
 
 
-typedef struct tool_rec tool_rec;
-struct tool_rec
-{
-    bool reverse;   /* orientation towards reference ( false...in ref-orientation / true...reverse) */
-    int32_t tlen;   /* template-len, for statistical analysis */
-    uint8_t * quality;  /* ptr to quality... ( for sam-output ) */
-};
-
-
 static rc_t read_base_and_len( struct VCursor const *curs,
                                uint32_t column_idx,
                                int64_t row_id,
@@ -711,15 +568,15 @@ static rc_t CC populate_tooldata( void *obj, const PlacementRecord *placement,
     if ( rc == 0 && !cb_data->options->omit_qualities )
     {
         const uint8_t * quality;
-        uint32_t quality_len;
+        /*uint32_t quality_len;*/
 
         rc = read_base_and_len( curs, col_ids->idx_quality, placement->id,
-                                (const void **)&quality, &quality_len );
+                                (const void **)&quality, &rec->quality_len );
         if ( rc == 0 )
         {
             rec->quality = ( uint8_t * )rec;
             rec->quality += sizeof ( * rec );
-            memcpy( rec->quality, quality, quality_len );
+            memcpy( rec->quality, quality, rec->quality_len );
         }
     }
 
@@ -763,7 +620,7 @@ static rc_t CC alloc_size( struct VCursor const *curs, int64_t row_id, size_t *
 
 static rc_t walk_ref_position( ReferenceIterator *ref_iter,
                                const PlacementRecord *rec,
-                               dyn_string *line,
+                               struct dyn_string *line,
                                char * qual,
                                pileup_options *options )
 {
@@ -775,7 +632,10 @@ static rc_t walk_ref_position( ReferenceIterator *ref_iter,
 
     if ( !options->omit_qualities )
     {
-        *qual = xrec->quality[ seq_pos ];
+        if ( seq_pos < xrec->quality_len )
+            *qual = xrec->quality[ seq_pos ];
+        else
+            *qual = 2;
     }
 
     if ( ( state & align_iter_invalid ) == align_iter_invalid )
@@ -857,8 +717,8 @@ static rc_t walk_ref_position( ReferenceIterator *ref_iter,
 
 
 static rc_t walk_alignments( ReferenceIterator *ref_iter,
-                             dyn_string *line,
-                             dyn_string *qualities,
+                             struct dyn_string *line,
+                             struct dyn_string *qualities,
                              pileup_options *options )
 {
     uint32_t depth = 0;
@@ -868,7 +728,7 @@ static rc_t walk_alignments( ReferenceIterator *ref_iter,
         const PlacementRecord *rec;
         rc = ReferenceIteratorNextPlacement ( ref_iter, &rec );
         if ( rc == 0 )
-            rc = walk_ref_position( ref_iter, rec, line, &( qualities->data[ depth++ ] ), options );
+            rc = walk_ref_position( ref_iter, rec, line, dyn_string_char( qualities, depth++ ), options );
         if ( rc == 0 )
             rc = Quitting();
     } while ( rc == 0 );
@@ -879,7 +739,8 @@ static rc_t walk_alignments( ReferenceIterator *ref_iter,
         add_char_2_dyn_string( line, '\t' );
         for ( i = 0; i < depth; ++i )
         {
-            add_char_2_dyn_string( line, qualities->data[ i ] + 33 );
+            char * c = dyn_string_char( qualities, i );
+            add_char_2_dyn_string( line, *c + 33 );
         }
     }
 
@@ -889,9 +750,9 @@ static rc_t walk_alignments( ReferenceIterator *ref_iter,
 
 
 static rc_t walk_spot_groups( ReferenceIterator *ref_iter,
-                             dyn_string *line,
-                             dyn_string *qualities,
-                             pileup_options *options )
+                              struct dyn_string *line,
+                              struct dyn_string *qualities,
+                              pileup_options *options )
 {
     rc_t rc;
     do
@@ -910,8 +771,8 @@ static rc_t walk_spot_groups( ReferenceIterator *ref_iter,
 
 static rc_t walk_position( ReferenceIterator *ref_iter,
                            const char * refname,
-                           dyn_string *line,
-                           dyn_string *qualities,
+                           struct dyn_string *line,
+                           struct dyn_string *qualities,
                            pileup_options *options )
 {
     INSDC_coord_zero pos;
@@ -928,32 +789,30 @@ static rc_t walk_position( ReferenceIterator *ref_iter,
     }
     else if ( ( depth > 0 )||( options->no_skip ) )
     {
-        rc = expand_dyn_string( line, ( 5 * depth ) + 100 );
-        if ( rc == 0 )
+        bool skip = skiplist_is_skip_position( options->skiplist, pos + 1 );
+        if ( !skip )
         {
-            rc = expand_dyn_string( qualities, depth + 100 );
+            rc = expand_dyn_string( line, ( 5 * depth ) + 100 );
             if ( rc == 0 )
             {
-                char c = _4na_to_ascii( base, false );
-
-                reset_dyn_string( line );
-                rc = print_2_dyn_string( line, "%s\t%u\t%c\t%u", refname, pos + 1, c, depth );
+                rc = expand_dyn_string( qualities, depth + 100 );
                 if ( rc == 0 )
                 {
-                    if ( depth > 0 )
-                    {
-                        rc = walk_spot_groups( ref_iter, line, qualities, options );
-                    }
+                    char c = _4na_to_ascii( base, false );
 
+                    reset_dyn_string( line );
+                    rc = print_2_dyn_string( line, "%s\t%u\t%c\t%u", refname, pos + 1, c, depth );
                     if ( rc == 0 )
                     {
+                        if ( depth > 0 )
+                            rc = walk_spot_groups( ref_iter, line, qualities, options );
+
                         /* only one KOutMsg() per line... */
-                        KOutMsg( "%s\n", line->data );
-                    }
+                        if ( rc == 0 )
+                            rc = KOutMsg( "%s\n", dyn_string_char( line, 0 ) );
 
-                    if ( GetRCState( rc ) == rcDone )
-                    {
-                        rc = 0;
+                        if ( GetRCState( rc ) == rcDone )
+                            rc = 0;
                     }
                 }
             }
@@ -965,8 +824,8 @@ static rc_t walk_position( ReferenceIterator *ref_iter,
 
 static rc_t walk_reference_window( ReferenceIterator *ref_iter,
                                    const char * refname,
-                                   dyn_string *line,
-                                   dyn_string *qualities,
+                                   struct dyn_string *line,
+                                   struct dyn_string *qualities,
                                    pileup_options *options )
 {
     rc_t rc = 0;
@@ -998,11 +857,11 @@ static rc_t walk_reference( ReferenceIterator *ref_iter,
                             const char * refname,
                             pileup_options *options )
 {
-    dyn_string line;
+    struct dyn_string * line;
     rc_t rc = allocated_dyn_string ( &line, 4096 );
     if ( rc == 0 )
     {
-        dyn_string qualities;
+        struct dyn_string * qualities;
         rc = allocated_dyn_string ( &qualities, 4096 );
         if ( rc == 0 )
         {
@@ -1022,14 +881,12 @@ static rc_t walk_reference( ReferenceIterator *ref_iter,
                         }
                     }
                     else
-                    {
-                        rc = walk_reference_window( ref_iter, refname, &line, &qualities, options );
-                    }
+                        rc = walk_reference_window( ref_iter, refname, line, qualities, options );
                 }
             }
-            free_dyn_string ( &qualities );
+            free_dyn_string ( qualities );
         }
-        free_dyn_string ( &line );
+        free_dyn_string ( line );
     }
     if ( GetRCState( rc ) == rcDone ) rc = 0;
     return rc;
@@ -1060,7 +917,11 @@ static rc_t walk_ref_iter( ReferenceIterator *ref_iter, pileup_options *options
                     rc = ReferenceObj_SeqId( refobj, &refname );
 
                 if ( rc == 0 )
+                {
+                    if ( options->skiplist != NULL )
+                        skiplist_enter_ref( options->skiplist, refname );
                     rc = walk_reference( ref_iter, refname, options );
+                }
                 else
                 {
                     if ( options->use_seq_name )
@@ -1090,1192 +951,110 @@ static rc_t walk_ref_iter( ReferenceIterator *ref_iter, pileup_options *options
 
 /* =========================================================================================== */
 
-typedef struct walk_data walk_data;
-struct walk_data
-{
-    void *data;                             /* opaque pointer to data passed to each function */
-    ReferenceIterator *ref_iter;            /* the global reference-iter */
-    pileup_options *options;                /* the tool-options */
-    struct ReferenceObj const * ref_obj;    /* the current reference-object */
-    const char * ref_name;                  /* the name of the current reference */
-    INSDC_coord_zero ref_start;             /* start of the current reference */
-    INSDC_coord_len ref_len;                /* length of the current reference */
-    INSDC_coord_zero ref_window_start;      /* start of the current reference-window */
-    INSDC_coord_len ref_window_len;         /* length of the current reference-window */
-    INSDC_coord_zero ref_pos;               /* current position on the reference */
-    uint32_t depth;                         /* coverage at the current position */
-    INSDC_4na_bin ref_base;                 /* reference-base at the current position */
-    const char * spotgroup;                 /* name of the current spotgroup ( can be NULL! ) */
-    size_t spotgroup_len;                   /* length of the name of the current spotgroup ( can be 0 ) */
-    const PlacementRecord *rec;             /* current placement-record */
-    tool_rec * xrec;                        /* current extended placement-record (orientation, quality...) */
-    int32_t state;                          /* state of the current placement at the current ref-pos ( bitmasked!) */
-    INSDC_coord_zero seq_pos;               /* position inside the alignment at the current ref-pos */
-};
-
-
-typedef struct walk_funcs walk_funcs;
-struct walk_funcs
+static rc_t add_quality_and_orientation( const VTable *tbl, const VCursor ** cursor,
+                                         bool omit_qualities, bool read_tlen, pileup_col_ids * cursor_ids )
 {
-    /* changing reference */
-    rc_t ( CC * on_enter_ref ) ( walk_data * data );
-    rc_t ( CC * on_exit_ref ) ( walk_data * data );
-
-    /* changing reference-window */
-    rc_t ( CC * on_enter_ref_window ) ( walk_data * data );
-    rc_t ( CC * on_exit_ref_window ) ( walk_data * data );
-
-    /* changing reference-position */
-    rc_t ( CC * on_enter_ref_pos ) ( walk_data * data );
-    rc_t ( CC * on_exit_ref_pos ) ( walk_data * data );
+    rc_t rc = VTableCreateCursorRead ( tbl, cursor );
+    if ( rc != 0 )
+    {
+        LOGERR( klogInt, rc, "VTableCreateCursorRead() failed" );
+    }
 
-    /* changing spot-group */
-    rc_t ( CC * on_enter_spotgroup ) ( walk_data * data );
-    rc_t ( CC * on_exit_spotgroup ) ( walk_data * data );
+    if ( rc == 0 && !omit_qualities )
+    {
+        rc = VCursorAddColumn ( *cursor, &cursor_ids->idx_quality, COL_QUALITY );
+        if ( rc != 0 )
+        {
+            LOGERR( klogInt, rc, "VCursorAddColumn(QUALITY) failed" );
+        }
+    }
 
-    /* on each alignment */
-    rc_t ( CC * on_placement ) ( walk_data * data );
-};
+    if ( rc == 0 )
+    {
+        rc = VCursorAddColumn ( *cursor, &cursor_ids->idx_ref_orientation, COL_REF_ORIENTATION );
+        if ( rc != 0 )
+        {
+            LOGERR( klogInt, rc, "VCursorAddColumn(REF_ORIENTATION) failed" );
+        }
+    }
 
+    if ( rc == 0 )
+    {
+        rc = VCursorAddColumn ( *cursor, &cursor_ids->idx_read_filter, COL_READ_FILTER );
+        if ( rc != 0 )
+        {
+            LOGERR( klogInt, rc, "VCursorAddColumn(READ_FILTER) failed" );
+        }
+    }
 
-static rc_t walk_placements( walk_data * data, walk_funcs * funcs )
-{
-    rc_t rc;
-    do
+    if ( rc == 0 && read_tlen )
     {
-        rc = ReferenceIteratorNextPlacement ( data->ref_iter, &data->rec );
-        if ( GetRCState( rc ) != rcDone )
+        rc = VCursorAddColumn ( *cursor, &cursor_ids->idx_template_len, COL_TEMPLATE_LEN );
+        if ( rc != 0 )
         {
-            if ( rc != 0 )
-            {
-                LOGERR( klogInt, rc, "ReferenceIteratorNextPlacement() failed" );
-            }
-            else
-            {
-                data->state = ReferenceIteratorState ( data->ref_iter, &data->seq_pos );
-                data->xrec = ( tool_rec * ) PlacementRecordCast ( data->rec, placementRecordExtension1 );
-                if ( funcs->on_placement != NULL )
-                    rc = funcs->on_placement( data );
-            }
+            LOGERR( klogInt, rc, "VCursorAddColumn(TEMPLATE_LEN) failed" );
         }
-    } while ( rc == 0 );
-    if ( GetRCState( rc ) == rcDone ) { rc = 0; }
+    }
     return rc;
 }
 
 
-static rc_t walk_spot_group( walk_data * data, walk_funcs * funcs )
+static rc_t prepare_prim_cursor( const VDatabase *db, const VCursor ** cursor,
+                                 bool omit_qualities, bool read_tlen, pileup_col_ids * cursor_ids )
 {
-    rc_t rc;
-    do
+    const VTable *tbl;
+    rc_t rc = VDatabaseOpenTableRead ( db, &tbl, "PRIMARY_ALIGNMENT" );
+    if ( rc != 0 )
     {
-        rc = ReferenceIteratorNextSpotGroup ( data->ref_iter, &data->spotgroup, &data->spotgroup_len );
-        if ( GetRCState( rc ) != rcDone )
-        {
-            if ( rc != 0 )
-            {
-                LOGERR( klogInt, rc, "ReferenceIteratorNextPos() failed" );
-            }
-            else
-            {
-                if ( funcs->on_enter_spotgroup != NULL )
-                    rc = funcs->on_enter_spotgroup( data );
-                if ( rc == 0 )
-                    rc = walk_placements( data, funcs );
-                if ( rc == 0 && funcs->on_exit_spotgroup != NULL )
-                    rc = funcs->on_exit_spotgroup( data );
-            }
-        }
-    } while ( rc == 0 );
-    if ( GetRCState( rc ) == rcDone ) { rc = 0; }
+        LOGERR( klogInt, rc, "VDatabaseOpenTableRead(PRIMARY_ALIGNMENT) failed" );
+    }
+    else
+    {
+        rc = add_quality_and_orientation( tbl, cursor, omit_qualities, read_tlen, cursor_ids );
+        VTableRelease ( tbl );
+    }
     return rc;
 }
 
 
-static rc_t walk_ref_pos( walk_data * data, walk_funcs * funcs )
+static rc_t prepare_sec_cursor( const VDatabase *db, const VCursor ** cursor,
+                                bool omit_qualities, bool read_tlen, pileup_col_ids * cursor_ids )
 {
-    rc_t rc;
-    do
+    const VTable *tbl;
+    rc_t rc = VDatabaseOpenTableRead ( db, &tbl, "SECONDARY_ALIGNMENT" );
+    if ( rc != 0 )
     {
-        rc = ReferenceIteratorNextPos ( data->ref_iter, !data->options->no_skip );
-        if ( GetRCState( rc ) != rcDone )
-        {
-            if ( rc != 0 )
-            {
-                LOGERR( klogInt, rc, "ReferenceIteratorNextPos() failed" );
-            }
-            else
-            {
-                rc = ReferenceIteratorPosition ( data->ref_iter, &data->ref_pos, &data->depth, &data->ref_base );
-                if ( rc != 0 )
-                {
-                    LOGERR( klogInt, rc, "ReferenceIteratorPosition() failed" );
-                }
-                else
-                {
-                    if ( funcs->on_enter_ref_pos != NULL )
-                        rc = funcs->on_enter_ref_pos( data );
-                    if ( rc == 0 )
-                        rc = walk_spot_group( data, funcs );
-                    if ( rc == 0 && funcs->on_exit_ref_pos != NULL )
-                        rc = funcs->on_exit_ref_pos( data );
-                }
-            }
-            if ( rc == 0 ) { rc = Quitting(); }
-        }
-    } while ( rc == 0 );
-    if ( GetRCState( rc ) == rcDone ) { rc = 0; }
+        LOGERR( klogInt, rc, "VDatabaseOpenTableRead(SECONDARY_ALIGNMENT) failed" );
+    }
+    else
+    {
+        rc = add_quality_and_orientation( tbl, cursor, omit_qualities, read_tlen, cursor_ids );
+        VTableRelease ( tbl );
+    }
     return rc;
 }
 
 
-static rc_t walk_ref_window( walk_data * data, walk_funcs * funcs )
+static rc_t prepare_evidence_cursor( const VDatabase *db, const VCursor ** cursor,
+                                     bool omit_qualities, bool read_tlen, pileup_col_ids * cursor_ids )
 {
-    rc_t rc;
-    do
+    const VTable *tbl;
+    rc_t rc = VDatabaseOpenTableRead ( db, &tbl, "EVIDENCE_ALIGNMENT" );
+    if ( rc != 0 )
     {
-        rc = ReferenceIteratorNextWindow ( data->ref_iter, &data->ref_window_start, &data->ref_window_len );
-        if ( GetRCState( rc ) != rcDone )
-        {
-            if ( rc != 0 )
-            {
-                LOGERR( klogInt, rc, "ReferenceIteratorNextWindow() failed" );
-            }
-            else
-            {
-                if ( funcs->on_enter_ref_window != NULL )
-                    rc = funcs->on_enter_ref_window( data );
-                if ( rc == 0 )
-                    rc = walk_ref_pos( data, funcs );
-                if ( rc == 0 && funcs->on_exit_ref_window != NULL )
-                    rc = funcs->on_exit_ref_window( data );
-            }
-        }
-    } while ( rc == 0 );
-    if ( GetRCState( rc ) == rcDone ) { rc = 0; }
+        LOGERR( klogInt, rc, "VDatabaseOpenTableRead(EVIDENCE) failed" );
+    }
+    else
+    {
+        rc = add_quality_and_orientation( tbl, cursor, omit_qualities, read_tlen, cursor_ids );
+        VTableRelease ( tbl );
+    }
     return rc;
 }
 
-
-static rc_t walk( walk_data * data, walk_funcs * funcs )
-{
-    rc_t rc;
-
-    data->ref_start = 0;
-    data->ref_len = 0;
-    data->ref_name = NULL;
-    data->ref_obj = NULL;
-    data->ref_window_start = 0;
-    data->ref_window_len = 0;
-    data->ref_pos = 0;
-    data->depth = 0;
-    data->ref_base = 0;
-    data->spotgroup = NULL;
-    data->spotgroup_len = 0;
-    data->rec = NULL;
-    data->xrec = NULL;
-    data->state = 0;
-    data->seq_pos = 0;
-
-    do
-    {
-        rc = ReferenceIteratorNextReference( data->ref_iter, &data->ref_start, &data->ref_len, &data->ref_obj );
-        if ( GetRCState( rc ) != rcDone )
-        {
-            if ( rc != 0 )
-            {
-                LOGERR( klogInt, rc, "ReferenceIteratorNextReference() failed" );
-            }
-            else if ( data->ref_obj != NULL )
-            {
-                if ( data->options->use_seq_name )
-                    rc = ReferenceObj_Name( data->ref_obj, &data->ref_name );
-                else
-                    rc = ReferenceObj_SeqId( data->ref_obj, &data->ref_name );
-                if ( rc != 0 )
-                {
-                    if ( data->options->use_seq_name )
-                    {
-                        LOGERR( klogInt, rc, "ReferenceObj_Name() failed" );
-                    }
-                    else
-                    {
-                        LOGERR( klogInt, rc, "ReferenceObj_SeqId() failed" );
-                    }
-                }
-                else
-                {
-                    if ( funcs->on_enter_ref != NULL )
-                        rc = funcs->on_enter_ref( data );
-                    if ( rc == 0 )
-                        rc = walk_ref_window( data, funcs );
-                    if ( rc == 0 && funcs->on_exit_ref != NULL )
-                        rc = funcs->on_exit_ref( data );
-                }
-            }
-        }
-    } while ( rc == 0 );
-    if ( GetRCState( rc ) == rcDone ) { rc = 0; }
-    if ( GetRCState( rc ) == rcCanceled ) { rc = 0; }
-    return rc;
-}
-
-
-/* =========================================================================================== */
-
-static rc_t CC walk_debug_enter_ref( walk_data * data )
-{   return KOutMsg( "ENTER REF '%s' ( %u.%u )\n", data->ref_name, data->ref_start, data->ref_len );   }
-
-static rc_t CC walk_debug_exit_ref( walk_data * data )
-{   return KOutMsg( "EXIT  REF '%s' ( %u.%u )\n", data->ref_name, data->ref_start, data->ref_len );   }
-
-static rc_t CC walk_debug_enter_ref_window( walk_data * data )
-{   return KOutMsg( "  ENTER REF-WINDOW ( %u.%u )\n", data->ref_window_start, data->ref_window_len );   }
-
-static rc_t CC walk_debug_exit_ref_window( walk_data * data )
-{   return KOutMsg( "  EXIT  REF-WINDOW ( %u.%u )\n", data->ref_window_start, data->ref_window_len );   }
-
-static rc_t CC walk_debug_enter_ref_pos( walk_data * data )
-{   return KOutMsg( "    ENTER REF-POS ( %u / d=%u / '%c' )\n", data->ref_pos, data->depth, _4na_to_ascii( data->ref_base, false ) );   }
-
-static rc_t CC walk_debug_exit_ref_pos( walk_data * data )
-{   return KOutMsg( "    EXIT  REF-POS ( %u / d=%u / '%c' )\n", data->ref_pos, data->depth, _4na_to_ascii( data->ref_base, false ) );   }
-
-static rc_t CC walk_debug_enter_sg( walk_data * data )
-{   return KOutMsg( "      ENTER SPOTGROUP '%s'\n", data->spotgroup );   }
-
-static rc_t CC walk_debug_exit_sg( walk_data * data )
-{   return KOutMsg( "      EXIT SPOTGROUP '%s'\n", data->spotgroup );   }
-
-static rc_t CC walk_debug_placement( walk_data * data )
-{
-    char c = ( data->xrec->reverse ? 'R' : 'F' );
-    return KOutMsg( "        PLACEMENT #%lu %c ( TLEN %i )\n", data->rec->id, c, data->xrec->tlen );
-}
-
-
-static rc_t walk_debug( ReferenceIterator *ref_iter, pileup_options *options )
-{
-    rc_t rc;
-    walk_data data;
-    walk_funcs funcs;
-
-    data.ref_iter = ref_iter;
-    data.options = options;
-    
-    funcs.on_enter_ref = walk_debug_enter_ref;
-    funcs.on_exit_ref = walk_debug_exit_ref;
-
-    funcs.on_enter_ref_window = walk_debug_enter_ref_window;
-    funcs.on_exit_ref_window = walk_debug_exit_ref_window;
-
-    funcs.on_enter_ref_pos = walk_debug_enter_ref_pos;
-    funcs.on_exit_ref_pos = walk_debug_exit_ref_pos;
-
-    funcs.on_enter_spotgroup = walk_debug_enter_sg;
-    funcs.on_exit_spotgroup = walk_debug_exit_sg;
-    
-    funcs.on_placement = walk_debug_placement;
-
-    rc = walk( &data, &funcs );
-    return rc;
-}
-
-
-static uint32_t percent( uint32_t v1, uint32_t v2 )
-{
-    uint32_t sum = v1 + v2;
-    uint32_t res = 0;
-    if ( sum > 0 )
-        res = ( ( v1 * 100 ) / sum );
-    return res;
-}
-
-/* =========================================================================================== */
-
-typedef struct indel_fragment
-{
-    BSTNode node;
-    const char * bases;
-    uint32_t len;
-    uint32_t count;
-} indel_fragment;
-
-
-static indel_fragment * make_indel_fragment( const char * bases, uint32_t len )
-{
-    indel_fragment * res = malloc( sizeof * res );
-    if ( res != NULL )
-    {
-        res->bases = string_dup ( bases, len );
-        if ( res->bases == NULL )
-        {
-            free( res );
-            res = NULL;
-        }
-        else
-        {
-            res->len = len;
-            res->count = 1;
-        }
-    }
-    return res;
-}
-
-
-static void CC free_indel_fragment( BSTNode * n, void * data )
-{
-    indel_fragment * fragment = ( indel_fragment * ) n;
-    if ( fragment != NULL )
-    {
-        free( ( void * ) fragment->bases );
-        free( fragment );
-    }
-}
-
-
-static void free_fragments( BSTree * fragments )
-{    
-    BSTreeWhack ( fragments, free_indel_fragment, NULL );
-}
-
-
-typedef struct find_fragment_ctx
-{
-    const char * bases;
-    uint32_t len;
-} find_fragment_ctx;
-
-
-static int CC cmp_fragment_vs_find_ctx( const void *item, const BSTNode *n )
-{
-    const indel_fragment * fragment = ( const indel_fragment * )n;
-    const find_fragment_ctx * fctx = ( const find_fragment_ctx * )item;
-    return string_cmp ( fctx->bases, fctx->len, fragment->bases, fragment->len, -1 );
-}
-
-
-static int CC cmp_fragment_vs_fragment( const BSTNode *item, const BSTNode *n )
-{
-    const indel_fragment * f1 = ( const indel_fragment * )item;
-    const indel_fragment * f2 = ( const indel_fragment * )n;
-    return string_cmp ( f1->bases, f1->len, f2->bases, f2->len, -1 );
-}
-
-
-static void count_indel_fragment( BSTree * fragments, const INSDC_4na_bin *bases, uint32_t len )
-{
-    find_fragment_ctx fctx;
-
-    fctx.bases = malloc( len );
-    if ( fctx.bases != NULL )
-    {
-        indel_fragment * fragment;
-        uint32_t i;
-
-        fctx.len = len;
-        for ( i = 0; i < len; ++i )
-            ( ( char * )fctx.bases )[ i ] = _4na_to_ascii( bases[ i ], false );
-
-        fragment = ( indel_fragment * ) BSTreeFind ( fragments, &fctx, cmp_fragment_vs_find_ctx );
-        if ( fragment == NULL )
-        {
-            fragment = make_indel_fragment( fctx.bases, len );
-            if ( fragment != NULL )
-            {
-                rc_t rc = BSTreeInsert ( fragments, ( BSTNode * )fragment, cmp_fragment_vs_fragment );
-                if ( rc != 0 )
-                    free_indel_fragment( ( BSTNode * )fragment, NULL );
-            }
-        }
-        else
-            fragment->count++;
-
-        free( ( void * ) fctx.bases );
-    }
-}
-
-
-typedef struct walk_fragment_ctx
-{
-    rc_t rc;
-    uint32_t n;
-} walk_fragment_ctx;
-
-
-static void CC on_fragment( BSTNode *n, void *data )
-{
-    walk_fragment_ctx * wctx = data;
-    const indel_fragment * fragment = ( const indel_fragment * )n;
-    if ( wctx->rc == 0 )
-    {
-        if ( wctx->n == 0 )
-            wctx->rc = KOutMsg( "%u-%.*s", fragment->count, fragment->len, fragment->bases );
-        else
-            wctx->rc = KOutMsg( "|%u-%.*s", fragment->count, fragment->len, fragment->bases );
-        wctx->n++;
-    }
-}
-
-
-static rc_t print_fragments( BSTree * fragments )
-{
-    walk_fragment_ctx wctx;
-    wctx.rc = 0;
-    wctx.n = 0;
-    BSTreeForEach ( fragments, false, on_fragment, &wctx );
-    return wctx.rc;
-}
-
-/* =========================================================================================== */
-
-typedef struct pileup_counters
-{
-    uint32_t matches;
-    uint32_t mismatches[ 4 ];
-    uint32_t inserts;
-    uint32_t deletes;
-    uint32_t forward;
-    uint32_t reverse;
-    uint32_t starting;
-    uint32_t ending;
-    BSTree insert_fragments;
-    BSTree delete_fragments;
-} pileup_counters;
-
-
-static void clear_counters( pileup_counters * counters )
-{
-    uint32_t i;
-
-    counters->matches = 0;
-    for ( i = 0; i < 4; ++i )
-        counters->mismatches[ i ] = 0;
-    counters->inserts = 0;
-    counters->deletes = 0;
-    counters->forward = 0;
-    counters->reverse = 0;
-    counters->starting = 0;
-    counters->ending = 0;
-    BSTreeInit( &(counters->insert_fragments) );
-    BSTreeInit( &(counters->delete_fragments) );
-}
-
-
-static void walk_counter_state( ReferenceIterator *ref_iter, int32_t state, bool reverse,
-                                pileup_counters * counters )
-{
-    if ( ( state & align_iter_invalid ) == align_iter_invalid )
-        return;
-
-    if ( ( state & align_iter_skip ) != align_iter_skip )
-    {
-        if ( ( state & align_iter_match ) == align_iter_match )
-            (counters->matches)++;
-        else
-        {
-            char c = _4na_to_ascii( state, false );
-            switch( c )
-            {
-                case 'A' : ( counters->mismatches[ 0 ] )++; break;
-                case 'C' : ( counters->mismatches[ 1 ] )++; break;
-                case 'G' : ( counters->mismatches[ 2 ] )++; break;
-                case 'T' : ( counters->mismatches[ 3 ] )++; break;
-            }
-        }
-    }
-
-    if ( reverse )
-        (counters->reverse)++;
-    else
-        (counters->forward)++;
-
-    if ( ( state & align_iter_insert ) == align_iter_insert )
-    {
-        const INSDC_4na_bin *bases;
-        uint32_t n = ReferenceIteratorBasesInserted ( ref_iter, &bases );
-        (counters->inserts) += n;
-        count_indel_fragment( &(counters->insert_fragments), bases, n );
-    }
-
-    if ( ( state & align_iter_delete ) == align_iter_delete )
-    {
-        const INSDC_4na_bin *bases;
-        INSDC_coord_zero ref_pos;
-        uint32_t n = ReferenceIteratorBasesDeleted ( ref_iter, &ref_pos, &bases );
-        if ( bases != NULL )
-        {
-            (counters->deletes) += n;
-            count_indel_fragment( &(counters->delete_fragments), bases, n );
-            free( (void *) bases );
-        }
-    }
-
-    if ( ( state & align_iter_first ) == align_iter_first )
-        ( counters->starting)++;
-
-    if ( ( state & align_iter_last ) == align_iter_last )
-        ( counters->ending)++;
-}
-
-
-static rc_t print_counter_line( const char * ref_name,
-                                INSDC_coord_zero ref_pos,
-                                INSDC_4na_bin ref_base,
-                                uint32_t depth,
-                                pileup_counters * counters )
-{
-    char c = _4na_to_ascii( ref_base, false );
-
-    rc_t rc = KOutMsg( "%s\t%u\t%c\t%u\t", ref_name, ref_pos + 1, c, depth );
-
-    if ( rc == 0 && counters->matches > 0 )
-        rc = KOutMsg( "%u", counters->matches );
-
-    if ( rc == 0 /* && counters->mismatches[ 0 ] > 0 */ )
-        rc = KOutMsg( "\t%u-A", counters->mismatches[ 0 ] );
-
-    if ( rc == 0 /* && counters->mismatches[ 1 ] > 0 */ )
-        rc = KOutMsg( "\t%u-C", counters->mismatches[ 1 ] );
-
-    if ( rc == 0 /* && counters->mismatches[ 2 ] > 0 */ )
-        rc = KOutMsg( "\t%u-G", counters->mismatches[ 2 ] );
-
-    if ( rc == 0 /* && counters->mismatches[ 3 ] > 0 */ )
-        rc = KOutMsg( "\t%u-T", counters->mismatches[ 3 ] );
-
-    if ( rc == 0 )
-        rc = KOutMsg( "\tI:" );
-    if ( rc == 0 )
-        rc = print_fragments( &(counters->insert_fragments) );
-
-    if ( rc == 0 )
-        rc = KOutMsg( "\tD:" );
-    if ( rc == 0 )
-        rc = print_fragments( &(counters->delete_fragments) );
-
-    if ( rc == 0 )
-        rc = KOutMsg( "\t%u%%", percent( counters->forward, counters->reverse ) );
-
-    if ( rc == 0 && counters->starting > 0 )
-        rc = KOutMsg( "\tS%u", counters->starting );
-
-    if ( rc == 0 && counters->ending > 0 )
-        rc = KOutMsg( "\tE%u", counters->ending );
-
-    if ( rc == 0 )
-        rc = KOutMsg( "\n" );
-
-    free_fragments( &(counters->insert_fragments) );
-    free_fragments( &(counters->delete_fragments) );
-
-    return rc;
-}
-
-
-/* ........................................................................................... */
-
-
-static rc_t CC walk_counters_enter_ref_pos( walk_data * data )
-{
-    clear_counters( data->data );
-    return 0;
-}
-
-static rc_t CC walk_counters_exit_ref_pos( walk_data * data )
-{
-    rc_t rc = print_counter_line( data->ref_name, data->ref_pos, data->ref_base, data->depth, data->data );
-    return rc;
-}
-
-static rc_t CC walk_counters_placement( walk_data * data )
-{
-    walk_counter_state( data->ref_iter, data->state, data->xrec->reverse, data->data );
-    return 0;
-}
-
-static rc_t walk_counters( ReferenceIterator *ref_iter, pileup_options *options )
-{
-    walk_data data;
-    walk_funcs funcs;
-    pileup_counters counters;
-
-    data.ref_iter = ref_iter;
-    data.options = options;
-    data.data = &counters;
-
-    funcs.on_enter_ref = NULL;
-    funcs.on_exit_ref = NULL;
-
-    funcs.on_enter_ref_window = NULL;
-    funcs.on_exit_ref_window = NULL;
-
-    funcs.on_enter_ref_pos = walk_counters_enter_ref_pos;
-    funcs.on_exit_ref_pos = walk_counters_exit_ref_pos;
-
-    funcs.on_enter_spotgroup = NULL;
-    funcs.on_exit_spotgroup = NULL;
-
-    funcs.on_placement = walk_counters_placement;
-
-    return walk( &data, &funcs );
-}
-
-
-/* =========================================================================================== */
-
-
-static rc_t print_mismatches_line( const char * ref_name,
-                                   INSDC_coord_zero ref_pos,
-                                   uint32_t depth,
-                                   uint32_t min_mismatch_percent,
-                                   pileup_counters * counters )
-{
-    rc_t rc = 0;
-    if ( depth > 0 )
-    {
-        uint32_t total_mismatches = counters->mismatches[ 0 ] +
-                                    counters->mismatches[ 1 ] +
-                                    counters->mismatches[ 2 ] +
-                                    counters->mismatches[ 3 ];
-	if ( total_mismatches * 100 >= min_mismatch_percent * depth) 
-        {
-                rc = KOutMsg( "%s\t%u\t%u\t%u\n", ref_name, ref_pos + 1, depth, total_mismatches );
-        }
-    }
-    
-    free_fragments( &(counters->insert_fragments) );
-    free_fragments( &(counters->delete_fragments) );
-
-    return rc;
-}
-
-
-/* ........................................................................................... */
-
-
-static rc_t CC walk_mismatches_enter_ref_pos( walk_data * data )
-{
-    clear_counters( data->data );
-    return 0;
-}
-
-static rc_t CC walk_mismatches_exit_ref_pos( walk_data * data )
-{
-    rc_t rc = print_mismatches_line( data->ref_name, data->ref_pos,
-                                     data->depth, data->options->min_mismatch, data->data );
-    return rc;
-}
-
-static rc_t CC walk_mismatches_placement( walk_data * data )
-{
-    walk_counter_state( data->ref_iter, data->state, data->xrec->reverse, data->data );
-    return 0;
-}
-
-static rc_t walk_mismatches( ReferenceIterator *ref_iter, pileup_options * options )
-{
-    walk_data data;
-    walk_funcs funcs;
-    pileup_counters counters;
-
-    data.ref_iter = ref_iter;
-    data.options = options;
-    data.data = &counters;
-
-    funcs.on_enter_ref = NULL;
-    funcs.on_exit_ref = NULL;
-
-    funcs.on_enter_ref_window = NULL;
-    funcs.on_exit_ref_window = NULL;
-
-    funcs.on_enter_ref_pos = walk_mismatches_enter_ref_pos;
-    funcs.on_exit_ref_pos = walk_mismatches_exit_ref_pos;
-
-    funcs.on_enter_spotgroup = NULL;
-    funcs.on_exit_spotgroup = NULL;
-
-    funcs.on_placement = walk_mismatches_placement;
-
-    return walk( &data, &funcs );
-}
-
-
-/* =========================================================================================== */
-
-
-typedef struct tlen_array
-{
-    uint32_t * values;
-    uint32_t capacity;
-    uint32_t members;
-    uint32_t zeros;
-} tlen_array;
-
-
-static rc_t init_tlen_array( tlen_array * a, uint32_t init_capacity )
-{
-    rc_t rc = 0;
-    a->values = malloc( sizeof ( a->values[ 0 ] ) * init_capacity );
-    if ( a->values == NULL )
-        rc = RC ( rcApp, rcArgv, rcAccessing, rcMemory, rcExhausted );
-    else
-    {
-        a->capacity = init_capacity;
-        a->members = 0;
-        a->zeros = 0;
-    }
-    return rc;
-}
-
-
-static void finish_tlen_array( tlen_array * a )
-{
-    if ( a->values != NULL )
-    {
-        free( a->values );
-        a->values = NULL;
-    }
-}
-
-
-static rc_t realloc_tlen_array( tlen_array * a, uint32_t new_depth )
-{
-    rc_t rc = 0;
-    if ( new_depth > a->capacity )
-    {
-        void * p = realloc( a->values, ( sizeof ( a->values[ 0 ] ) ) * new_depth );
-        if ( a->values == NULL )
-            rc = RC ( rcApp, rcArgv, rcAccessing, rcMemory, rcExhausted );
-        else
-        {
-            a->values = p;
-            a->capacity = new_depth;
-        }
-    }
-    return rc;
-}
-
-
-static void remove_from_tlen_array( tlen_array * a, uint32_t count )
-{
-    if ( count > 0 )
-    {
-        if ( a->members < count )
-            a->members = 0;
-        else
-        {
-            a->members -= count;
-            memmove( &(a->values[ 0 ]), &(a->values[ count ]), a->members * ( sizeof a->values[ 0 ] ) );
-        }
-    }
-}
-
-
-static bool add_tlen_to_array( tlen_array * a, uint32_t value )
-{
-    bool res = ( value != 0 );
-    if ( !res )
-        a->zeros++;
-    else
-        a->values[ a->members++ ] = value;
-    return res;
-}
-
-
-#define INIT_WINDOW_SIZE 50
-#define MAX_SEQLEN_COUNT 500000
-
-typedef struct strand
-{
-    uint32_t alignment_count, window_size, window_max, seq_len_accu_count;
-    uint64_t seq_len_accu;
-    tlen_array tlen_w;          /* tlen accumulater for all alignmnts starting/ending in window ending at current position */
-    tlen_array tlen_l;          /* array holding the length of all position-slices in the window */
-    tlen_array zeros;
-} strand;
-
-
-typedef struct stat_counters
-{
-    strand pos;
-    strand neg;
-} stat_counters;
-
-
-static rc_t prepare_strand( strand * strand, uint32_t initial_size )
-{
-    rc_t rc = init_tlen_array( &strand->tlen_w, initial_size );
-    if ( rc == 0 )
-        rc = init_tlen_array( &strand->tlen_l, initial_size );
-    if ( rc == 0 )
-        rc = init_tlen_array( &strand->zeros, initial_size );
-    if ( rc == 0 )
-    {
-        strand->window_size = 0;
-        strand->window_max = INIT_WINDOW_SIZE;
-        strand->seq_len_accu_count = 0;
-        strand->seq_len_accu = 0;
-    }
-    return rc;
-}
-
-
-static rc_t prepare_stat_counters( stat_counters * counters, uint32_t initial_size )
-{
-    rc_t rc = prepare_strand( &counters->pos, initial_size );
-    if ( rc == 0 )
-        rc = prepare_strand( &counters->neg, initial_size );
-    return rc;
-}
-
-
-static void finish_strand( strand * strand )
-{
-    finish_tlen_array( &strand->tlen_w );
-    finish_tlen_array( &strand->tlen_l );
-    finish_tlen_array( &strand->zeros );
-}
-
-
-static void finish_stat_counters( stat_counters * counters )
-{
-    finish_strand( &counters->pos );
-    finish_strand( &counters->neg );
-}
-
-
-static rc_t realloc_strand( strand * strand, uint32_t new_depth )
-{
-    rc_t rc = realloc_tlen_array( &strand->tlen_w, strand->tlen_w.members + new_depth );
-    if ( rc == 0 )
-        rc = realloc_tlen_array( &strand->tlen_l, strand->tlen_l.members + new_depth );
-    if ( rc == 0 )
-        rc = realloc_tlen_array( &strand->zeros, strand->zeros.members + new_depth );
-    strand->alignment_count = 0;
-    return rc;
-}
-
-
-static void on_new_ref_position_strand( strand * strand )
-{
-    if ( ( strand->seq_len_accu_count < MAX_SEQLEN_COUNT ) && ( strand->seq_len_accu_count > 0 ) )
-    {
-        uint64_t w = ( strand->seq_len_accu / strand->seq_len_accu_count );
-        if ( w > strand->window_max )
-            strand->window_max = w;
-    }
-
-    if ( strand->window_size >= strand->window_max )
-    {
-        uint32_t to_remove = strand->tlen_l.values[ 0 ];
-        remove_from_tlen_array( &strand->tlen_w, to_remove );
-        remove_from_tlen_array( &strand->tlen_l, 1 );
-
-        to_remove = strand->zeros.values[ 0 ];
-        strand->tlen_w.zeros -= to_remove;
-        remove_from_tlen_array( &strand->zeros, 1 );
-    }
-    else
-        strand->window_size++;
-    strand->tlen_l.values[ strand->tlen_l.members++ ] = 0;
-    strand->zeros.values[ strand->zeros.members++ ] = 0;
-}
-
-
-/*
-static int32_t avg( tlen_array * a )
-{
-    int64_t sum = 0;
-    int32_t i;
-    for ( i = 0; i < a->members; ++i )
-        sum += a->values[ i ];
-    if ( a->members > 1 )
-        sum /= a->members;
-    return (int32_t) sum;
-}
-*/
-
-
-static uint32_t medium( tlen_array * a )
-{
-    if ( a->members == 0 )
-        return 0;
-    else
-        return a->values[ a->members >> 1 ];
-}
-
-
-static uint32_t percentil( tlen_array * a, uint32_t p )
-{
-    if ( a->members == 0 )
-        return 0;
-    else
-        return a->values[ ( a->members * p ) / 100 ];
-}
-
-
-static rc_t print_header_line( void )
-{
-    return KOutMsg( "\nREFNAME----\tREFPOS\tREFBASE\tDEPTH\tSTRAND%%\tTL+#0\tTL+10%%\tTL+MED\tTL+90%%\tTL-#0\tTL-10%%\tTL-MED\tTL-90%%\n\n" );
-}
-
-
-/* ........................................................................................... */
-
-
-static rc_t CC walk_stat_enter_ref_window( walk_data * data )
-{
-    stat_counters * counters = data->data;
-    counters->pos.tlen_w.members = 0;
-    counters->pos.tlen_l.members = 0;
-    counters->neg.tlen_w.members = 0;
-    counters->neg.tlen_l.members = 0;
-    return 0;
-}
-
-
-static rc_t CC walk_stat_enter_ref_pos( walk_data * data )
-{
-    rc_t rc;
-    stat_counters * counters = data->data;
-
-    on_new_ref_position_strand( &counters->pos );
-    on_new_ref_position_strand( &counters->neg );
-
-    rc = realloc_strand( &counters->pos, data->depth );
-    if ( rc == 0 )
-        rc = realloc_strand( &counters->neg, data->depth );
-
-    return rc;
-}
-
-
-static rc_t CC walk_stat_exit_ref_pos( walk_data * data )
-{
-    char c = _4na_to_ascii( data->ref_base, false );
-    stat_counters * counters = data->data;
-
-    /* REF-NAME, REF-POS, REF-BASE, DEPTH */
-    rc_t rc = KOutMsg( "%s\t%u\t%c\t%u\t", data->ref_name, data->ref_pos + 1, c, data->depth );
-
-    /* STRAND-ness */
-    if ( rc == 0 )
-        rc = KOutMsg( "%u%%\t", percent( counters->pos.alignment_count, counters->neg.alignment_count ) );
-
-    /* TLEN-Statistic for sliding window, only starting/ending placements */
-    if ( rc == 0 )
-    {
-        tlen_array * a = &counters->pos.tlen_w;
-        if ( a->members > 1 )
-            ksort_uint32_t ( a->values, a->members );
-
-        rc = KOutMsg( "%u\t%u\t%u\t%u\t", a->zeros, percentil( a, 10 ), medium( a ), percentil( a, 90 ) );
-        if ( rc == 0 )
-        {
-            a = &counters->neg.tlen_w;
-            if ( a->members > 1 )
-                ksort_uint32_t ( a->values, a->members );
-            rc = KOutMsg( "%u\t%u\t%u\t%u\t", a->zeros, percentil( a, 10 ), medium( a ), percentil( a, 90 ) );
-        }
-    }
-
-/*
-    KOutMsg( "( %u,%u )\t", counters->pos.window_max, counters->neg.window_max );
-    KOutMsg( "< %u.%u, %u.%u ( %u.%u, %u.%u ) >",
-            counters->pos.tlen_w.members, counters->pos.tlen_w.capacity, counters->neg.tlen_w.members, counters->neg.tlen_w.capacity,
-            counters->pos.tlen_l.members, counters->pos.tlen_l.capacity, counters->neg.tlen_l.members, counters->neg.tlen_l.capacity );
-*/
-
-    if ( rc == 0 )
-        rc = KOutMsg( "\n" );
-
-    return rc;
-}
-
-
-static void walk_strand_placement( strand * strand, int32_t tlen, INSDC_coord_len seq_len )
-{
-    tlen_array * a;
-    uint32_t value =  ( tlen < 0 ) ? -tlen : tlen;
-    if ( add_tlen_to_array( &strand->tlen_w, value ) )
-        a = &strand->tlen_l;
-    else
-        a = &strand->zeros;
-    a->values[ a->members - 1 ]++;
-
-    if ( strand->seq_len_accu_count < MAX_SEQLEN_COUNT )
-    {
-        strand->seq_len_accu += seq_len;
-        strand->seq_len_accu_count++;
-    }
-}
-
-
-static rc_t CC walk_stat_placement( walk_data * data )
-{
-    int32_t state = data->state;
-    if ( ( state & align_iter_invalid ) != align_iter_invalid )
-    {
-        bool reverse = data->xrec->reverse;
-        stat_counters * counters = data->data;
-        strand * strand = ( reverse ) ? &counters->neg : &counters->pos;
-
-        strand->alignment_count++;
-
-        /* for TLEN-statistic on starting/ending placements at this pos */
-        if ( ( ( state & align_iter_last ) == align_iter_last )&&( reverse ) )
-            walk_strand_placement( strand, data->xrec->tlen, data->rec->len );
-        else if ( ( ( state & align_iter_first ) == align_iter_first )&&( !reverse ) )
-            walk_strand_placement( strand, data->xrec->tlen, data->rec->len );
-    }
-    return 0;
-}
-
-
-static rc_t walk_stat( ReferenceIterator *ref_iter, pileup_options *options )
-{
-    walk_data data;
-    walk_funcs funcs;
-    stat_counters counters;
-
-    rc_t rc = print_header_line();
-    if ( rc == 0 )
-        rc = prepare_stat_counters( &counters, 1024 );
-    if ( rc == 0 )
-    {
-        data.ref_iter = ref_iter;
-        data.options = options;
-        data.data = &counters;
-
-        funcs.on_enter_ref = NULL;
-        funcs.on_exit_ref = NULL;
-
-        funcs.on_enter_ref_window = walk_stat_enter_ref_window;
-        funcs.on_exit_ref_window = NULL;
-
-        funcs.on_enter_ref_pos = walk_stat_enter_ref_pos;
-        funcs.on_exit_ref_pos = walk_stat_exit_ref_pos;
-
-        funcs.on_enter_spotgroup = NULL;
-        funcs.on_exit_spotgroup = NULL;
-
-        funcs.on_placement = walk_stat_placement;
-
-        rc = walk( &data, &funcs );
-
-        finish_stat_counters( &counters );
-    }
-    return rc;
-}
-
-
-/* =========================================================================================== */
-
-static rc_t add_quality_and_orientation( const VTable *tbl, const VCursor ** cursor,
-                                         bool omit_qualities, bool read_tlen, pileup_col_ids * cursor_ids )
-{
-    rc_t rc = VTableCreateCursorRead ( tbl, cursor );
-    if ( rc != 0 )
-    {
-        LOGERR( klogInt, rc, "VTableCreateCursorRead() failed" );
-    }
-
-    if ( rc == 0 && !omit_qualities )
-    {
-        rc = VCursorAddColumn ( *cursor, &cursor_ids->idx_quality, COL_QUALITY );
-        if ( rc != 0 )
-        {
-            LOGERR( klogInt, rc, "VCursorAddColumn(QUALITY) failed" );
-        }
-    }
-
-    if ( rc == 0 )
-    {
-        rc = VCursorAddColumn ( *cursor, &cursor_ids->idx_ref_orientation, COL_REF_ORIENTATION );
-        if ( rc != 0 )
-        {
-            LOGERR( klogInt, rc, "VCursorAddColumn(REF_ORIENTATION) failed" );
-        }
-    }
-
-    if ( rc == 0 )
-    {
-        rc = VCursorAddColumn ( *cursor, &cursor_ids->idx_read_filter, COL_READ_FILTER );
-        if ( rc != 0 )
-        {
-            LOGERR( klogInt, rc, "VCursorAddColumn(READ_FILTER) failed" );
-        }
-    }
-
-    if ( rc == 0 && read_tlen )
-    {
-        rc = VCursorAddColumn ( *cursor, &cursor_ids->idx_template_len, COL_TEMPLATE_LEN );
-        if ( rc != 0 )
-        {
-            LOGERR( klogInt, rc, "VCursorAddColumn(TEMPLATE_LEN) failed" );
-        }
-    }
-    return rc;
-}
-
-
-static rc_t prepare_prim_cursor( const VDatabase *db, const VCursor ** cursor,
-                                 bool omit_qualities, bool read_tlen, pileup_col_ids * cursor_ids )
-{
-    const VTable *tbl;
-    rc_t rc = VDatabaseOpenTableRead ( db, &tbl, "PRIMARY_ALIGNMENT" );
-    if ( rc != 0 )
-    {
-        LOGERR( klogInt, rc, "VDatabaseOpenTableRead(PRIMARY_ALIGNMENT) failed" );
-    }
-    else
-    {
-        rc = add_quality_and_orientation( tbl, cursor, omit_qualities, read_tlen, cursor_ids );
-        VTableRelease ( tbl );
-    }
-    return rc;
-}
-
-
-static rc_t prepare_sec_cursor( const VDatabase *db, const VCursor ** cursor,
-                                bool omit_qualities, bool read_tlen, pileup_col_ids * cursor_ids )
-{
-    const VTable *tbl;
-    rc_t rc = VDatabaseOpenTableRead ( db, &tbl, "SECONDARY_ALIGNMENT" );
-    if ( rc != 0 )
-    {
-        LOGERR( klogInt, rc, "VDatabaseOpenTableRead(SECONDARY_ALIGNMENT) failed" );
-    }
-    else
-    {
-        rc = add_quality_and_orientation( tbl, cursor, omit_qualities, read_tlen, cursor_ids );
-        VTableRelease ( tbl );
-    }
-    return rc;
-}
-
-
-static rc_t prepare_evidence_cursor( const VDatabase *db, const VCursor ** cursor,
-                                     bool omit_qualities, bool read_tlen, pileup_col_ids * cursor_ids )
-{
-    const VTable *tbl;
-    rc_t rc = VDatabaseOpenTableRead ( db, &tbl, "EVIDENCE_ALIGNMENT" );
-    if ( rc != 0 )
-    {
-        LOGERR( klogInt, rc, "VDatabaseOpenTableRead(EVIDENCE) failed" );
-    }
-    else
-    {
-        rc = add_quality_and_orientation( tbl, cursor, omit_qualities, read_tlen, cursor_ids );
-        VTableRelease ( tbl );
-    }
-    return rc;
-}
-
-#if 0
-static void show_placement_params( const char * prefix, const ReferenceObj *refobj,
-                                   uint32_t start, uint32_t end )
+#if 0
+static void show_placement_params( const char * prefix, const ReferenceObj *refobj,
+                                   uint32_t start, uint32_t end )
 {
     const char * name;
     rc_t rc = ReferenceObj_SeqId( refobj, &name );
@@ -2309,7 +1088,7 @@ static rc_t make_cursor_ids( Vector *cursor_id_vector, pileup_col_ids ** cursor_
 }
 
 
-static rc_t CC prepare_section_cb( prepare_ctx * ctx, uint32_t start, uint32_t end )
+static rc_t CC prepare_section_cb( prepare_ctx * ctx, const struct reference_range * range )
 {
     rc_t rc = 0;
     INSDC_coord_len len;
@@ -2330,111 +1109,125 @@ static rc_t CC prepare_section_cb( prepare_ctx * ctx, uint32_t start, uint32_t e
         }
         else
         {
+            uint32_t start, end;
             rc_t rc1 = 0, rc2 = 0, rc3 = 0;
-            pileup_col_ids * cursor_ids;
+
+            if ( range == NULL )
+            {
+                start = 1;
+                end = ( len - start ) + 1;
+            }
+            else
+            {
+                start = get_ref_range_start( range );
+                end   = get_ref_range_end( range );
+            }
 
             if ( start == 0 ) start = 1;
             if ( ( end == 0 )||( end > len + 1 ) )
             {
                 end = ( len - start ) + 1;
             }
-
+            
             /* depending on ctx->select prepare primary, secondary or both... */
             if ( ctx->use_primary_alignments )
             {
-                const VCursor * prim_align_cursor = NULL;
-                rc1 = make_cursor_ids( ctx->data, &cursor_ids );
-                if ( rc1 != 0 )
+                if ( ctx->prim_cur == NULL )
                 {
-                    LOGERR( klogInt, rc1, "cannot create cursor-ids for prim. alignment cursor" );
+                    rc1 = make_cursor_ids( ctx->data, &ctx->prim_cur_ids );
+                    if ( rc1 != 0 )
+                    {
+                        LOGERR( klogInt, rc1, "cannot create cursor-ids for prim. alignment cursor" );
+                    }
+                    else
+                        rc1 = prepare_prim_cursor( ctx->db, &ctx->prim_cur, ctx->omit_qualities,
+                                                   ctx->read_tlen, ctx->prim_cur_ids );
                 }
-                else
+
+                if ( rc1 == 0 )
                 {
-                    rc1 = prepare_prim_cursor( ctx->db, &prim_align_cursor, ctx->omit_qualities, ctx->read_tlen, cursor_ids );
-                    if ( rc1 == 0 )
+                    /* show_placement_params( "primary", ctx->refobj, start, end ); */
+                    rc1 = ReferenceIteratorAddPlacements ( ctx->ref_iter,       /* the outer ref-iter */
+                                                          ctx->refobj,          /* the ref-obj for this chromosome */
+                                                          start - 1,            /* start ( zero-based ) */
+                                                          end - start + 1,      /* length */
+                                                          NULL,                 /* ref-cursor */
+                                                          ctx->prim_cur,        /* align-cursor */
+                                                          primary_align_ids,    /* which id's */
+                                                          ctx->spot_group,      /* what read-group */
+                                                          ctx->prim_cur_ids     /* placement-context */
+                                                         );
+                    if ( rc1 != 0 )
                     {
-        /*                show_placement_params( "primary", ctx->refobj, start, end ); */
-                        rc1 = ReferenceIteratorAddPlacements ( ctx->ref_iter,       /* the outer ref-iter */
-                                                              ctx->refobj,          /* the ref-obj for this chromosome */
-                                                              start - 1,            /* start ( zero-based ) */
-                                                              end - start + 1,      /* length */
-                                                              NULL,                 /* ref-cursor */
-                                                              prim_align_cursor,    /* align-cursor */
-                                                              primary_align_ids,    /* which id's */
-                                                              ctx->spot_group,      /* what read-group */
-                                                              cursor_ids            /* placement-context */
-                                                             );
-                        if ( rc1 != 0 )
-                        {
-                            LOGERR( klogInt, rc1, "ReferenceIteratorAddPlacements(prim) failed" );
-                        }
-                        VCursorRelease( prim_align_cursor );
+                        LOGERR( klogInt, rc1, "ReferenceIteratorAddPlacements(prim) failed" );
                     }
                 }
             }
 
             if ( ctx->use_secondary_alignments )
             {
-                const VCursor * sec_align_cursor = NULL;
-                rc2 = make_cursor_ids( ctx->data, &cursor_ids );
-                if ( rc2 != 0 )
+                if ( ctx->sec_cur == NULL )
                 {
-                    LOGERR( klogInt, rc2, "cannot create cursor-ids for sec. alignment cursor" );
+                    rc2 = make_cursor_ids( ctx->data, &ctx->sec_cur_ids );
+                    if ( rc2 != 0 )
+                    {
+                        LOGERR( klogInt, rc2, "cannot create cursor-ids for sec. alignment cursor" );
+                    }
+                    else
+                        rc2 = prepare_sec_cursor( ctx->db, &ctx->sec_cur, ctx->omit_qualities,
+                                                  ctx->read_tlen, ctx->sec_cur_ids );
                 }
-                else
+
+                if ( rc2 == 0 )
                 {
-                    rc2 = prepare_sec_cursor( ctx->db, &sec_align_cursor, ctx->omit_qualities, ctx->read_tlen, cursor_ids );
-                    if ( rc2 == 0 )
+                    /* show_placement_params( "secondary", ctx->refobj, start, end ); */
+                    rc2 = ReferenceIteratorAddPlacements ( ctx->ref_iter,       /* the outer ref-iter */
+                                                          ctx->refobj,          /* the ref-obj for this chromosome */
+                                                          start - 1,            /* start ( zero-based ) */
+                                                          end - start + 1,      /* length */
+                                                          NULL,                 /* ref-cursor */
+                                                          ctx->sec_cur,         /* align-cursor */
+                                                          secondary_align_ids,  /* which id's */
+                                                          ctx->spot_group,      /* what read-group */
+                                                          ctx->sec_cur_ids      /* placement-context */
+                                                         );
+                    if ( rc2 != 0 )
                     {
-        /*                show_placement_params( "secondary", ctx->refobj, start, end ); */
-                        rc2 = ReferenceIteratorAddPlacements ( ctx->ref_iter,       /* the outer ref-iter */
-                                                              ctx->refobj,          /* the ref-obj for this chromosome */
-                                                              start - 1,            /* start ( zero-based ) */
-                                                              end - start + 1,      /* length */
-                                                              NULL,                 /* ref-cursor */
-                                                              sec_align_cursor,     /* align-cursor */
-                                                              secondary_align_ids,  /* which id's */
-                                                              ctx->spot_group,      /* what read-group */
-                                                              cursor_ids            /* placement-context */
-                                                             );
-                        if ( rc2 != 0 )
-                        {
-                            LOGERR( klogInt, rc2, "ReferenceIteratorAddPlacements(sec) failed" );
-                        }
-                        VCursorRelease( sec_align_cursor );
+                        LOGERR( klogInt, rc2, "ReferenceIteratorAddPlacements(sec) failed" );
                     }
                 }
             }
 
             if ( ctx->use_evidence_alignments )
             {
-                const VCursor * ev_align_cursor = NULL;
-                rc3 = make_cursor_ids( ctx->data, &cursor_ids );
-                if ( rc3 != 0 )
+                if ( ctx->ev_cur == NULL )
                 {
-                    LOGERR( klogInt, rc3, "cannot create cursor-ids for ev. alignment cursor" );
+                    rc3 = make_cursor_ids( ctx->data, &ctx->ev_cur_ids );
+                    if ( rc3 != 0 )
+                    {
+                        LOGERR( klogInt, rc3, "cannot create cursor-ids for ev. alignment cursor" );
+                    }
+                    else
+                        rc3 = prepare_evidence_cursor( ctx->db, &ctx->ev_cur, ctx->omit_qualities,
+                                                       ctx->read_tlen, ctx->ev_cur_ids );
                 }
-                else
+
+                if ( rc3 == 0 )
                 {
-                    rc3 = prepare_evidence_cursor( ctx->db, &ev_align_cursor, ctx->omit_qualities, ctx->read_tlen, cursor_ids );
-                    if ( rc3 == 0 )
+                    /* show_placement_params( "evidende", ctx->refobj, start, end ); */
+                    rc3 = ReferenceIteratorAddPlacements ( ctx->ref_iter,       /* the outer ref-iter */
+                                                          ctx->refobj,          /* the ref-obj for this chromosome */
+                                                          start - 1,            /* start ( zero-based ) */
+                                                          end - start + 1,      /* length */
+                                                          NULL,                 /* ref-cursor */
+                                                          ctx->ev_cur,          /* align-cursor */
+                                                          evidence_align_ids,   /* which id's */
+                                                          ctx->spot_group,      /* what read-group */
+                                                          ctx->ev_cur_ids       /* placement-context */
+                                                         );
+                    if ( rc3 != 0 )
                     {
-        /*                show_placement_params( "evidende", ctx->refobj, start, end ); */
-                        rc3 = ReferenceIteratorAddPlacements ( ctx->ref_iter,       /* the outer ref-iter */
-                                                              ctx->refobj,          /* the ref-obj for this chromosome */
-                                                              start - 1,            /* start ( zero-based ) */
-                                                              end - start + 1,      /* length */
-                                                              NULL,                 /* ref-cursor */
-                                                              ev_align_cursor,      /* align-cursor */
-                                                              evidence_align_ids,   /* which id's */
-                                                              ctx->spot_group,      /* what read-group */
-                                                              cursor_ids            /* placement-context */
-                                                             );
-                        if ( rc3 != 0 )
-                        {
-                            LOGERR( klogInt, rc3, "ReferenceIteratorAddPlacements(evidence) failed" );
-                        }
-                        VCursorRelease( ev_align_cursor );
+                        LOGERR( klogInt, rc3, "ReferenceIteratorAddPlacements(evidence) failed" );
                     }
                 }
             }
@@ -2512,7 +1305,10 @@ static rc_t CC on_argument( const char * path, const char * spot_group, void * d
                 prep.on_section = prepare_section_cb;
                 prep.data = ctx->cursor_ids;
                 prep.path = path;
-
+                prep.db = NULL;
+                prep.prim_cur = NULL;
+                prep.sec_cur = NULL;
+                prep.ev_cur = NULL;
                 
                 rc = prepare_ref_iter( &prep, ctx->vdb_mgr, ctx->vdb_schema, path, ctx->ranges ); /* cmdline_cmn.c */
                 if ( rc == 0 && prep.db == NULL )
@@ -2520,6 +1316,9 @@ static rc_t CC on_argument( const char * path, const char * spot_group, void * d
                     rc = RC ( rcApp, rcNoTarg, rcOpening, rcSelf, rcInvalid );
                     LOGERR( klogInt, rc, "unsupported source" );
                 }
+                if ( prep.prim_cur != NULL ) VCursorRelease( prep.prim_cur );
+                if ( prep.sec_cur != NULL ) VCursorRelease( prep.sec_cur );
+                if ( prep.ev_cur != NULL ) VCursorRelease( prep.ev_cur );
             }
         }
     }
@@ -2528,7 +1327,7 @@ static rc_t CC on_argument( const char * path, const char * spot_group, void * d
 
 
 /* free all cursor-ids-blocks created in parallel with the alignment-cursor */
-void CC cur_id_vector_entry_whack( void *item, void *data )
+static void CC cur_id_vector_entry_whack( void *item, void *data )
 {
     pileup_col_ids * ids = item;
     free( ids );
@@ -2539,7 +1338,7 @@ static rc_t pileup_main( Args * args, pileup_options *options )
 {
     foreach_arg_ctx arg_ctx;
     pileup_callback_data cb_data;
-    KDirectory *dir;
+    KDirectory * dir = NULL;
     Vector cur_ids_vector;
 
     /* (1) make the align-manager ( necessary to make a ReferenceIterator... ) */
@@ -2617,7 +1416,7 @@ static rc_t pileup_main( Args * args, pileup_options *options )
         }
         else if ( options->cmn.schema_file != NULL )
         {
-            rc = VSchemaParseFile( arg_ctx.vdb_schema, options->cmn.schema_file );
+            rc = VSchemaParseFile( arg_ctx.vdb_schema, "%s", options->cmn.schema_file );
             if ( rc != 0 )
             {
                 LOGERR( klogInt, rc, "VSchemaParseFile() failed" );
@@ -2647,6 +1446,14 @@ static rc_t pileup_main( Args * args, pileup_options *options )
             case sra_pileup_mismatch    :  options->omit_qualities = true;
                                           options->read_tlen = false;
                                           break;
+
+            case sra_pileup_index      :  options->omit_qualities = true;
+                                          options->read_tlen = false;
+                                          break;
+
+            case sra_pileup_varcount   :  options->omit_qualities = true;
+                                          options->read_tlen = false;
+                                          break;
         }
     }
 
@@ -2658,7 +1465,10 @@ static rc_t pileup_main( Args * args, pileup_options *options )
         if ( rc == 0 )
         {
             bool empty = false;
-            check_ref_regions( &regions ); /* sanitize input... */
+
+            check_ref_regions( &regions, options->merge_dist ); /* sanitize input, merge slices... */
+            options->skiplist = skiplist_make( &regions ); /* create skiplist for neighboring slices */
+
             arg_ctx.ranges = ®ions;
             rc = foreach_argument( args, dir, options->div_by_spotgrp, &empty, on_argument, &arg_ctx ); /* cmdline_cmn.c */
             if ( empty )
@@ -2679,6 +1489,8 @@ static rc_t pileup_main( Args * args, pileup_options *options )
             case sra_pileup_counters    : rc = walk_counters( arg_ctx.ref_iter, options ); break;
             case sra_pileup_debug       : rc = walk_debug( arg_ctx.ref_iter, options ); break;
             case sra_pileup_mismatch    : rc = walk_mismatches( arg_ctx.ref_iter, options ); break;
+            case sra_pileup_index       : rc = walk_index( arg_ctx.ref_iter, options ); break;
+            case sra_pileup_varcount    : rc = walk_varcount( arg_ctx.ref_iter, options ); break;
             default :  rc = walk_ref_iter( arg_ctx.ref_iter, options ); break;
         }
         /* ============================================== */
@@ -2697,114 +1509,6 @@ static rc_t pileup_main( Args * args, pileup_options *options )
 
 /* =========================================================================================== */
 
-static rc_t CC pileup_test_enter_ref( ref_walker_data * rwd )
-{
-    return KOutMsg( "\nentering >%s<\n", rwd->ref_name );
-}
-
-static rc_t CC pileup_test_exit_ref( ref_walker_data * rwd )
-{
-    return KOutMsg( "exit >%s<\n", rwd->ref_name );
-}
-
-static rc_t CC pileup_test_enter_ref_window( ref_walker_data * rwd )
-{
-    return KOutMsg( "   enter window >%s< [ %,lu ... %,lu ]\n", rwd->ref_name, rwd->ref_start, rwd->ref_end );
-}
-
-static rc_t CC pileup_test_exit_ref_window( ref_walker_data * rwd )
-{
-    return KOutMsg( "   exit window >%s< [ %,lu ... %,lu ]\n", rwd->ref_name, rwd->ref_start, rwd->ref_end );
-}
-
-static rc_t CC pileup_test_enter_ref_pos( ref_walker_data * rwd )
-{
-    return KOutMsg( "   enter pos [ %,lu ], d=%u\n", rwd->pos, rwd->depth );
-}
-
-static rc_t CC pileup_test_exit_ref_pos( ref_walker_data * rwd )
-{
-    return KOutMsg( "   exit pos [ %,lu ], d=%u\n", rwd->pos, rwd->depth );
-}
-
-static rc_t CC pileup_test_enter_spot_group( ref_walker_data * rwd )
-{
-    return KOutMsg( "       enter spot-group [ %,lu ], %.*s\n", rwd->pos, rwd->spot_group_len, rwd->spot_group );
-}
-
-static rc_t CC pileup_test_exit_spot_group( ref_walker_data * rwd )
-{
-    return KOutMsg( "       exit spot-group [ %,lu ], %.*s\n", rwd->pos, rwd->spot_group_len, rwd->spot_group );
-}
-
-static rc_t CC pileup_test_alignment( ref_walker_data * rwd )
-{
-    return KOutMsg( "          alignment\n" );
-}
-
-
-static rc_t pileup_test( Args * args, pileup_options *options )
-{
-    struct ref_walker * walker;
-
-    /* create walker */
-    rc_t rc = ref_walker_create( &walker );
-    if ( rc == 0 )
-    {
-        uint32_t idx, count;
-
-        /* add sources to walker */
-        rc = ArgsParamCount( args, &count );
-        for ( idx = 0; idx < count && rc == 0; ++idx )
-        {
-            const char * src = NULL;
-            rc = ArgsParamValue( args, idx, &src );
-            if ( rc == 0 && src != NULL )
-                rc = ref_walker_add_source( walker, src );
-        }
-
-        /* add ranges to walker */
-        if ( rc == 0 )
-        {
-            rc = ArgsOptionCount( args, OPTION_REF, &count );
-            for ( idx = 0; idx < count && rc == 0; ++idx )
-            {
-                const char * s = NULL;
-                rc = ArgsOptionValue( args, OPTION_REF, idx, &s );
-                if ( rc == 0 && s != NULL )
-                    rc = ref_walker_parse_and_add_range( walker, s );
-            }
-        }
-
-        /* set callbacks for walker */
-        if ( rc == 0 )
-        {
-            ref_walker_callbacks callbacks = 
-                {   pileup_test_enter_ref,
-                    pileup_test_exit_ref,
-                    pileup_test_enter_ref_window,
-                    pileup_test_exit_ref_window,
-                    pileup_test_enter_ref_pos,
-                    pileup_test_exit_ref_pos,
-                    pileup_test_enter_spot_group,
-                    pileup_test_exit_spot_group,
-                    pileup_test_alignment };
-            rc = ref_walker_set_callbacks( walker, &callbacks );
-        }
-
-        /* let the walker call the callbacks while iterating over the sources/ranges */
-        if ( rc == 0 )
-            rc = ref_walker_walk( walker, NULL );
-
-        /* destroy the walker */
-        ref_walker_destroy( walker );
-    }
-    return rc;
-}
-
-
-/* =========================================================================================== */
-
 
 rc_t CC KMain( int argc, char *argv [] )
 {
@@ -2831,6 +1535,7 @@ rc_t CC KMain( int argc, char *argv [] )
                 rc = get_pileup_options( args, &options );
                 if ( rc == 0 )
                 {
+                    options.skiplist = NULL;
                     if ( options.cmn.output_file != NULL )
                     {
                         rc = set_stdout_to( options.cmn.gzip_output,
@@ -2846,9 +1551,13 @@ rc_t CC KMain( int argc, char *argv [] )
                         {
                             rc = report_on_reference( args, options.function == sra_pileup_report_ref_ext ); /* reref.c */
                         }
+                        else if ( options.function == sra_pileup_deletes )
+                        {
+                            rc = report_deletes( args, 10 ); /* see above */
+                        }
                         else if ( options.function == sra_pileup_test )
                         {
-                            rc = pileup_test( args, &options ); /* see above */
+                            rc = pileup_v2( args, &options ); /* see above */
                         }
                         else
                         {
@@ -2860,6 +1569,9 @@ rc_t CC KMain( int argc, char *argv [] )
 
                     if ( options.cmn.output_file != NULL )
                         release_stdout_redirection();
+
+                    if ( options.skiplist != NULL )
+                        skiplist_release( options.skiplist );
                 }
             }
             ArgsWhack( args );
diff --git a/tools/sra-pileup/sra-pileup.vers b/tools/sra-pileup/sra-pileup.vers
index cc6c9a4..8e8299d 100644
--- a/tools/sra-pileup/sra-pileup.vers
+++ b/tools/sra-pileup/sra-pileup.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/sra-pileup/sra-pileup.vers.h b/tools/sra-pileup/sra-pileup.vers.h
new file mode 100644
index 0000000..5329110
--- /dev/null
+++ b/tools/sra-pileup/sra-pileup.vers.h
@@ -0,0 +1 @@
+#define SRA_PILEUP_VERS 0x02040002
diff --git a/tools/sra-pileup/walk_debug.c b/tools/sra-pileup/walk_debug.c
new file mode 100644
index 0000000..c993362
--- /dev/null
+++ b/tools/sra-pileup/walk_debug.c
@@ -0,0 +1,88 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "ref_walker_0.h"
+#include "4na_ascii.h"
+
+#include <klib/out.h>
+
+static rc_t CC walk_debug_enter_ref( walk_data * data )
+{   return KOutMsg( "ENTER REF '%s' ( %u.%u )\n", data->ref_name, data->ref_start, data->ref_len );   }
+
+static rc_t CC walk_debug_exit_ref( walk_data * data )
+{   return KOutMsg( "EXIT  REF '%s' ( %u.%u )\n", data->ref_name, data->ref_start, data->ref_len );   }
+
+static rc_t CC walk_debug_enter_ref_window( walk_data * data )
+{   return KOutMsg( "  ENTER REF-WINDOW ( %u.%u )\n", data->ref_window_start, data->ref_window_len );   }
+
+static rc_t CC walk_debug_exit_ref_window( walk_data * data )
+{   return KOutMsg( "  EXIT  REF-WINDOW ( %u.%u )\n", data->ref_window_start, data->ref_window_len );   }
+
+static rc_t CC walk_debug_enter_ref_pos( walk_data * data )
+{   return KOutMsg( "    ENTER REF-POS ( %u / d=%u / '%c' )\n", data->ref_pos, data->depth, _4na_to_ascii( data->ref_base, false ) );   }
+
+static rc_t CC walk_debug_exit_ref_pos( walk_data * data )
+{   return KOutMsg( "    EXIT  REF-POS ( %u / d=%u / '%c' )\n", data->ref_pos, data->depth, _4na_to_ascii( data->ref_base, false ) );   }
+
+static rc_t CC walk_debug_enter_sg( walk_data * data )
+{   return KOutMsg( "      ENTER SPOTGROUP '%s'\n", data->spotgroup );   }
+
+static rc_t CC walk_debug_exit_sg( walk_data * data )
+{   return KOutMsg( "      EXIT SPOTGROUP '%s'\n", data->spotgroup );   }
+
+static rc_t CC walk_debug_placement( walk_data * data )
+{
+    char c = ( data->xrec->reverse ? 'R' : 'F' );
+    return KOutMsg( "        PLACEMENT #%lu %c ( TLEN %i )\n", data->rec->id, c, data->xrec->tlen );
+}
+
+
+rc_t walk_debug( ReferenceIterator *ref_iter, pileup_options *options )
+{
+    rc_t rc;
+    walk_data data;
+    walk_funcs funcs;
+
+    data.ref_iter = ref_iter;
+    data.options = options;
+    
+    funcs.on_enter_ref = walk_debug_enter_ref;
+    funcs.on_exit_ref = walk_debug_exit_ref;
+
+    funcs.on_enter_ref_window = walk_debug_enter_ref_window;
+    funcs.on_exit_ref_window = walk_debug_exit_ref_window;
+
+    funcs.on_enter_ref_pos = walk_debug_enter_ref_pos;
+    funcs.on_exit_ref_pos = walk_debug_exit_ref_pos;
+
+    funcs.on_enter_spotgroup = walk_debug_enter_sg;
+    funcs.on_exit_spotgroup = walk_debug_exit_sg;
+    
+    funcs.on_placement = walk_debug_placement;
+
+    rc = walk_0( &data, &funcs );
+    return rc;
+}
diff --git a/tools/sra-pileup/walk_debug.h b/tools/sra-pileup/walk_debug.h
new file mode 100644
index 0000000..03fc1b0
--- /dev/null
+++ b/tools/sra-pileup/walk_debug.h
@@ -0,0 +1,42 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_walk_debug_
+#define _h_walk_debug_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "ref_walker_0.h"
+
+rc_t walk_debug( ReferenceIterator *ref_iter, pileup_options *options );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*  _h_walk_debug_ */
diff --git a/tools/sra-pileup/writer.c b/tools/sra-pileup/writer.c
new file mode 100644
index 0000000..b24c1d9
--- /dev/null
+++ b/tools/sra-pileup/writer.c
@@ -0,0 +1,137 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+#include <klib/report.h>
+#include <klib/container.h>
+#include <klib/log.h>
+#include <klib/debug.h>
+#include <klib/out.h>
+#include <klib/status.h>
+#include <kfs/file.h>
+#include <kfs/directory.h>
+#include <kfs/buffile.h>
+#include <kfs/gzip.h>
+#include <kfs/bzip.h>
+#include <kapp/main.h>
+#include <kapp/args.h>
+#include <os-native.h>
+#include <sysalloc.h>
+
+#include "cmdline_cmn.h"
+#include "writer.h"
+
+struct {
+    KWrtWriter writer;
+    void* data;
+    KFile* kfile;
+    uint64_t pos;
+} g_out_writer = {NULL};
+
+static
+rc_t CC BufferedWriter(void* self, const char* buffer, size_t bufsize, size_t* num_writ)
+{
+    rc_t rc = 0;
+
+    assert(buffer != NULL);
+    assert(num_writ != NULL);
+
+    do {
+        if( (rc = KFileWrite(g_out_writer.kfile, g_out_writer.pos, buffer, bufsize, num_writ)) == 0 ) {
+            buffer += *num_writ;
+            bufsize -= *num_writ;
+            g_out_writer.pos += *num_writ;
+        }
+    } while(rc == 0 && bufsize > 0);
+    return rc;
+}
+
+rc_t OUTSTR_(const char* buf, size_t buf_sz)
+{
+    size_t nm;
+    return BufferedWriter(NULL, buf, buf_sz, &nm);
+}
+
+rc_t BufferedWriterMake(const common_options* opt)
+{
+    rc_t rc = 0;
+
+    if( opt == NULL || (opt->gzip_output && opt->bzip_output) ) {
+        rc = RC(rcApp, rcFile, rcConstructing, rcParam, rcInvalid);
+    } else if( g_out_writer.writer != NULL ) {
+        rc = RC(rcApp, rcFile, rcConstructing, rcParam, rcAmbiguous);
+    }
+    if( opt->output_file != NULL ) {
+        KDirectory *dir;
+        if( (rc = KDirectoryNativeDir(&dir)) == 0 ) {
+            rc = KDirectoryCreateFile(dir, &g_out_writer.kfile, false, 0664, kcmInit, "%s", opt->output_file);
+            KDirectoryRelease(dir);
+        }
+    } else {
+        KOutHandlerSetStdOut();
+        KStsHandlerSetStdErr();
+        KLogHandlerSetStdErr();
+        KDbgHandlerSetStdErr();
+        rc = KFileMakeStdOut(&g_out_writer.kfile);
+    }
+    if( rc == 0 ) {
+        g_out_writer.pos = 0;
+        if( opt->gzip_output ) {
+            KFile* gz;
+            if( (rc = KFileMakeGzipForWrite(&gz, g_out_writer.kfile)) == 0 ) {
+                KFileRelease(g_out_writer.kfile);
+                g_out_writer.kfile = gz;
+            }
+        } else if( opt->bzip_output ) {
+            KFile* bz;
+            if( (rc = KFileMakeBzip2ForWrite(&bz, g_out_writer.kfile)) == 0 ) {
+                KFileRelease(g_out_writer.kfile);
+                g_out_writer.kfile = bz;
+            }
+        }
+        if( rc == 0 ) {
+            KFile* buf;
+            if( (rc = KBufFileMakeWrite(&buf, g_out_writer.kfile, false, 128 * 1024)) == 0 ) {
+                KFileRelease(g_out_writer.kfile);
+                g_out_writer.kfile = buf;
+                g_out_writer.writer = KOutWriterGet();
+                g_out_writer.data = KOutDataGet();
+                rc = KOutHandlerSet(BufferedWriter, &g_out_writer);
+            }
+        }
+    }
+    return rc;
+}
+
+void BufferedWriterRelease( bool flush )
+{
+    if( flush ) {
+        /* avoid flushing buffered data after failure */
+        KFileRelease(g_out_writer.kfile);
+    }
+    if( g_out_writer.writer != NULL ) {
+        KOutHandlerSet(g_out_writer.writer, g_out_writer.data);
+    }
+    g_out_writer.writer = NULL;
+}
diff --git a/tools/sra-pileup/writer.h b/tools/sra-pileup/writer.h
new file mode 100644
index 0000000..9ef8a0c
--- /dev/null
+++ b/tools/sra-pileup/writer.h
@@ -0,0 +1,32 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+#include <klib/rc.h>
+
+rc_t BufferedWriterMake(const common_options* opt);
+
+void BufferedWriterRelease(bool flush);
+
+rc_t OUTSTR_(const char* buf, size_t buf_sz);
diff --git a/tools/sra-shell/Makefile b/tools/sra-shell/Makefile
new file mode 100644
index 0000000..a3f9d33
--- /dev/null
+++ b/tools/sra-shell/Makefile
@@ -0,0 +1,58 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+TOP ?= $(abspath ../..)
+MODULE = tools/sra-shell
+
+include $(TOP)/build/Makefile.shell
+
+
+#-------------------------------------------------------------------------------
+# default
+#
+SUBDIRS = \
+	parser \
+	job-exec \
+	sra-shell \
+	turboVision \
+	guilib \
+	sra-gui
+
+
+# common targets for non-leaf Makefiles; must follow a definition of SUBDIRS
+include $(TOP)/build/Makefile.targets
+
+$(SUBDIRS):
+	@ $(MAKE) -C $@
+
+.PHONY: default $(SUBDIRS) 
+
+#-------------------------------------------------------------------------------
+# pass-through
+#
+out debug profile release GCC ICC VC++:
+	@ $(MAKE) TOP=$(TOP) -f $(TOP)/build/Makefile.env $@
+
+.PHONY: out debug profile release GCC ICC VC++
diff --git a/tools/sra-shell/guilib/Makefile b/tools/sra-shell/guilib/Makefile
new file mode 100644
index 0000000..6910c3d
--- /dev/null
+++ b/tools/sra-shell/guilib/Makefile
@@ -0,0 +1,71 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+default: std
+
+TOP ?= $(abspath ../../..)
+MODULE = tools/sra-shell/guilib
+
+include $(TOP)/build/Makefile.env
+
+INT_LIBS = \
+	guilib
+
+#-------------------------------------------------------------------------------
+# outer targets
+#
+all std: makedirs
+	@ $(MAKE_CMD) $(TARGDIR)/std
+	
+$(INT_LIBS): makedirs
+	@ $(MAKE_CMD) $(ILIBDIR)/$@
+
+.PHONY: all std $(INT_LIBS)
+
+#-------------------------------------------------------------------------------
+# std
+#
+$(TARGDIR)/std: \
+	$(addprefix $(ILIBDIR)/,$(INT_LIBS))
+
+.PHONY: $(TARGDIR)/std
+
+#-------------------------------------------------------------------------------
+# clean
+#
+clean: stdclean
+
+.PHONY: clean
+
+#-------------------------------------------------------------------------------
+# guilib
+#
+
+GUILIB_SRC = \
+
+GUILIB_OBJ = \
+	$(addsuffix .$(OBJX),$(GUILIB_SRC))
+
+$(ILIBDIR)/guilib: $(GUILIB_OBJ)
+	$(LP) --slib -o $@ $^ 
diff --git a/tools/sra-shell/job-exec/Makefile b/tools/sra-shell/job-exec/Makefile
new file mode 100644
index 0000000..5b900d8
--- /dev/null
+++ b/tools/sra-shell/job-exec/Makefile
@@ -0,0 +1,71 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+default: std
+
+TOP ?= $(abspath ../../..)
+MODULE = tools/sra-shell/job-exec
+
+include $(TOP)/build/Makefile.env
+
+INT_LIBS = \
+	job-exec
+
+#-------------------------------------------------------------------------------
+# outer targets
+#
+all std: makedirs
+	@ $(MAKE_CMD) $(TARGDIR)/std
+	
+$(INT_LIBS): makedirs
+	@ $(MAKE_CMD) $(ILIBDIR)/$@
+
+.PHONY: all std $(INT_LIBS)
+
+#-------------------------------------------------------------------------------
+# std
+#
+$(TARGDIR)/std: \
+	$(addprefix $(ILIBDIR)/,$(INT_LIBS))
+
+.PHONY: $(TARGDIR)/std
+
+#-------------------------------------------------------------------------------
+# clean
+#
+clean: stdclean
+
+.PHONY: clean
+
+#-------------------------------------------------------------------------------
+# job-exec
+#
+
+JOB_EXEC_SRC = \
+
+JOB_EXEC_OBJ = \
+	$(addsuffix .$(OBJX),$(JOB_EXEC_SRC))
+
+$(ILIBDIR)/job-exec: $(JOB_EXEC_OBJ)
+	$(LP) --slib -o $@ $^ 
diff --git a/tools/sra-shell/parser/Makefile b/tools/sra-shell/parser/Makefile
new file mode 100644
index 0000000..741d0f1
--- /dev/null
+++ b/tools/sra-shell/parser/Makefile
@@ -0,0 +1,71 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+default: std
+
+TOP ?= $(abspath ../../..)
+MODULE = tools/sra-shell/parser
+
+include $(TOP)/build/Makefile.env
+
+INT_LIBS = \
+	sra-shell-parser
+
+#-------------------------------------------------------------------------------
+# outer targets
+#
+all std: makedirs
+	@ $(MAKE_CMD) $(TARGDIR)/std
+	
+$(INT_LIBS): makedirs
+	@ $(MAKE_CMD) $(ILIBDIR)/$@
+
+.PHONY: all std $(INT_LIBS)
+
+#-------------------------------------------------------------------------------
+# std
+#
+$(TARGDIR)/std: \
+	$(addprefix $(ILIBDIR)/,$(INT_LIBS))
+
+.PHONY: $(TARGDIR)/std
+
+#-------------------------------------------------------------------------------
+# clean
+#
+clean: stdclean
+
+.PHONY: clean
+
+#-------------------------------------------------------------------------------
+# sra-shell-parser
+#
+
+PARSER_SRC = \
+
+PARSER_OBJ = \
+	$(addsuffix .$(OBJX),$(PARSER_SRC))
+
+$(ILIBDIR)/sra-shell-parser: $(PARSER_OBJ)
+	$(LP) --slib -o $@ $^ 
diff --git a/tools/sra-shell/parser/sra-shell-lex.l b/tools/sra-shell/parser/sra-shell-lex.l
new file mode 100644
index 0000000..a2f883f
--- /dev/null
+++ b/tools/sra-shell/parser/sra-shell-lex.l
@@ -0,0 +1,103 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+ 
+%{ 
+    #include "sra-shell-parse.h"
+    #include "sra-shell-tokens.h"    
+    
+    #define YYSTYPE SRAShellToken
+
+    /* code to populate token with internal values */
+    #define YY_USER_ACTION              \
+        yylval -> tokenText     = yytext;   \
+        yylval -> tokenLength   = yyleng;   \
+        yylval -> line_no       = yylineno; \
+        yylval -> column_no     = yyextra -> column; \
+        yyextra -> column += yyleng; \
+        yyextra -> length += yyleng; \
+        yyextra -> lastToken = yylval; 
+
+    #define ENDLINE \
+        yyextra -> column=1;\
+        return shENDLINE;
+
+    #define YY_INPUT(buf, result, max_size) \
+        result = yyextra->input(yyextra, buf, max_size)
+
+    #define ECHO
+
+    static void SRAShell_fatal_error(yyconst char* msg);
+    #define YY_FATAL_ERROR(msg) SRAShell_fatal_error(msg)
+    
+%}
+
+%option never-interactive nounistd yylineno reentrant bison-bridge stack noyywrap
+
+%option prefix="SRAShell"
+%option extra-type="SRAShellParseBlock*"
+
+ /*%option debug*/
+
+ws          [ \t]+
+digits      [0-9]+
+alphanum    [A-Za-z0-9\-_]+
+eol         (\r\n|\r|\n)
+
+%%
+
+. { return yytext[0]; }
+
+{eol} { ENDLINE; }
+
+%%    
+
+rc_t CC SRAShellScan_yylex_init(SRAShellParseBlock* sb, bool debug)
+{
+    if (yylex_init_extra(sb, &sb->scanner) != 0)
+    {
+        return RC ( rcApp, rcFile, rcParsing, rcMemory, rcExhausted );
+    }       
+
+    yyset_debug(debug ? 1 : 0, sb->scanner);
+
+    return 0;
+}
+
+void CC SRAShellScan_yylex_destroy(SRAShellParseBlock* sb)
+{
+    if (sb->scanner)
+    {
+        yylex_destroy(sb->scanner);
+    }       
+    sb->scanner=0;
+}
+
+void SRAShell_fatal_error(yyconst char* msg)
+{
+    rc_t rc = RC ( rcApp, rcFile, rcParsing, rcError, rcUnexpected );
+    LogErr(klogErr, rc, msg);
+    exit(rc);  
+}
diff --git a/tools/sra-shell/parser/sra-shell.y b/tools/sra-shell/parser/sra-shell.y
new file mode 100644
index 0000000..cf72beb
--- /dev/null
+++ b/tools/sra-shell/parser/sra-shell.y
@@ -0,0 +1,54 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+ 
+%{  
+    #include "sra-shell-parse.h"
+
+    #define YYSTYPE SRAShellToken
+    #define YYLEX_PARAM pb->scanner
+    #define YYDEBUG 1
+
+    #include "sra-shell-tokens.h"
+%}
+
+%pure-parser
+%parse-param {SRAShellParseBlock* pb }
+%lex-param {SRAShellParseBlock* pb }
+%error-verbose 
+%name-prefix="SRAShell"
+
+%token shNUMBER
+%token shALPHANUM
+%token shWS
+%token shENDLINE
+%token shTOKEN
+%token shUNRECOGNIZED
+%token shENDOFTEXT 0
+
+%%
+
+%%
+
diff --git a/tools/sra-shell/sra-gui/Makefile b/tools/sra-shell/sra-gui/Makefile
new file mode 100644
index 0000000..2b09e0b
--- /dev/null
+++ b/tools/sra-shell/sra-gui/Makefile
@@ -0,0 +1,94 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+default: std
+
+TOP ?= $(abspath ../../..)
+MODULE = tools/sra-shell/sra-gui
+
+EXT_TOOLS = \
+    sra-gui
+
+ALL_TOOLS = \
+	$(INT_TOOLS) \
+	$(EXT_TOOLS)    
+
+include $(TOP)/build/Makefile.env
+
+#-------------------------------------------------------------------------------
+# outer targets
+#
+all std: vers-includes 
+	@ $(MAKE_CMD) $(TARGDIR)/std
+
+$(INT_LIBS): vers-includes
+	@ $(MAKE_CMD) $(ILIBDIR)/$@
+
+$(EXT_TOOLS): vers-includes
+	@ $(MAKE_CMD) $(BINDIR)/$@    
+
+ALL_TOOLS = \
+	$(INT_TOOLS) \
+	$(EXT_TOOLS)
+
+.PHONY: all std $(ALL_LIBS) 
+
+#-------------------------------------------------------------------------------
+# std
+#
+$(TARGDIR)/std: \
+	$(addprefix $(BINDIR)/,$(ALL_TOOLS))
+
+.PHONY: $(TARGDIR)/std
+
+#-------------------------------------------------------------------------------
+# vers-includes
+#
+$(TARGDIR)/vers-includes: $(addsuffix .vers.h,$(ALL_TOOLS))
+
+.PHONY: $(TARGDIR)/vers-includes
+
+#-------------------------------------------------------------------------------
+# clean
+#
+clean: stdclean
+
+.PHONY: clean
+
+#------------------------------------------------------------------------------
+# sra-gui
+#
+SRA_GUI_SRC = \
+	sra-gui
+
+SRA_GUI_OBJ = \
+	$(addsuffix .$(OBJX),$(SRA_GUI_SRC))
+
+SRA_GUI_LIB = \
+	-lkapp \
+	-lncbi-vdb \
+
+$(BINDIR)/sra-gui: $(SRA_GUI_OBJ)
+	$(LD) --exe --vers $(SRCDIR)/sra-gui.vers -o $@ $^ $(SRA_GUI_LIB)
+
diff --git a/tools/sra-shell/sra-gui/sra-gui.c b/tools/sra-shell/sra-gui/sra-gui.c
new file mode 100644
index 0000000..895a4d2
--- /dev/null
+++ b/tools/sra-shell/sra-gui/sra-gui.c
@@ -0,0 +1,56 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+
+#include <klib/out.h>
+
+#include <kapp/main.h>
+#include <kapp/args.h>
+
+#include "sra-gui.vers.h"
+
+uint32_t CC KAppVersion ( void )
+{
+    return SRA_GUI_VERS;
+}
+
+rc_t CC Usage ( const Args * args )
+{
+    return 0;
+}
+
+const char UsageDefaultName[] = "sra-gui";
+
+rc_t CC UsageSummary(const char *prog_name)
+{
+    return KOutMsg ( "Usage: %s [options] path [ path... ]\n"
+                     "\n"
+                     , prog_name );
+}
+
+rc_t CC KMain ( int argc, char *argv [] )
+{
+    return 0;
+}
diff --git a/tools/sra-shell/sra-gui/sra-gui.vers b/tools/sra-shell/sra-gui/sra-gui.vers
new file mode 100644
index 0000000..8acdd82
--- /dev/null
+++ b/tools/sra-shell/sra-gui/sra-gui.vers
@@ -0,0 +1 @@
+0.0.1
diff --git a/tools/sra-shell/sra-shell/Makefile b/tools/sra-shell/sra-shell/Makefile
new file mode 100644
index 0000000..907cf01
--- /dev/null
+++ b/tools/sra-shell/sra-shell/Makefile
@@ -0,0 +1,101 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+default: std
+
+TOP ?= $(abspath ../../..)
+MODULE = tools/sra-shell/sra-shell
+
+EXT_TOOLS = \
+    sra-shell
+
+ALL_TOOLS = \
+	$(INT_TOOLS) \
+	$(EXT_TOOLS)    
+
+include $(TOP)/build/Makefile.env
+
+#-------------------------------------------------------------------------------
+# outer targets
+#
+all std: vers-includes 
+	@ $(MAKE_CMD) $(TARGDIR)/std
+
+$(INT_LIBS): vers-includes
+	@ $(MAKE_CMD) $(ILIBDIR)/$@
+
+$(EXT_TOOLS): vers-includes
+	@ $(MAKE_CMD) $(BINDIR)/$@    
+
+ALL_TOOLS = \
+	$(INT_TOOLS) \
+	$(EXT_TOOLS)
+
+.PHONY: all std $(ALL_LIBS) 
+
+#-------------------------------------------------------------------------------
+# std
+#
+$(TARGDIR)/std: \
+	$(addprefix $(BINDIR)/,$(ALL_TOOLS))
+
+.PHONY: $(TARGDIR)/std
+
+#-------------------------------------------------------------------------------
+# vers-includes
+#
+$(TARGDIR)/vers-includes: $(addsuffix .vers.h,$(ALL_TOOLS))
+
+.PHONY: $(TARGDIR)/vers-includes
+
+#-------------------------------------------------------------------------------
+# clean
+#
+INTERM_SRC = \
+	$(SRCDIR)/shell-lex.c \
+	$(SRCDIR)/shell-grammar.c \
+	$(SRCDIR)/shell-tokens.h 
+
+clean: stdclean
+
+.PHONY: clean
+
+.PRECIOUS: $(INTERM_SRC)
+
+#------------------------------------------------------------------------------
+# sra-shell
+#
+SRA_SHELL_SRC = \
+	sra-shell
+
+SRA_SHELL_OBJ = \
+	$(addsuffix .$(OBJX),$(SRA_SHELL_SRC))
+
+SRA_SHELL_LIB = \
+	-lkapp \
+	-lncbi-vdb \
+
+$(BINDIR)/sra-shell: $(SRA_SHELL_OBJ)
+	$(LD) --exe --vers $(SRCDIR)/sra-shell.vers -o $@ $^ $(SRA_SHELL_LIB)
+
diff --git a/tools/sra-shell/sra-shell/sra-shell.c b/tools/sra-shell/sra-shell/sra-shell.c
new file mode 100644
index 0000000..8db1bcb
--- /dev/null
+++ b/tools/sra-shell/sra-shell/sra-shell.c
@@ -0,0 +1,56 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+
+#include <klib/out.h>
+
+#include <kapp/main.h>
+#include <kapp/args.h>
+
+#include "sra-shell.vers.h"
+
+uint32_t CC KAppVersion ( void )
+{
+    return SRA_SHELL_VERS;
+}
+
+rc_t CC Usage ( const Args * args )
+{
+    return 0;
+}
+
+const char UsageDefaultName[] = "sra-shell";
+
+rc_t CC UsageSummary(const char *prog_name)
+{
+    return KOutMsg ( "Usage: %s [options] path [ path... ]\n"
+                     "\n"
+                     , prog_name );
+}
+
+rc_t CC KMain ( int argc, char *argv [] )
+{
+    return 0;
+}
diff --git a/tools/sra-shell/sra-shell/sra-shell.vers b/tools/sra-shell/sra-shell/sra-shell.vers
new file mode 100644
index 0000000..8acdd82
--- /dev/null
+++ b/tools/sra-shell/sra-shell/sra-shell.vers
@@ -0,0 +1 @@
+0.0.1
diff --git a/tools/sra-shell/turboVision/Makefile b/tools/sra-shell/turboVision/Makefile
new file mode 100644
index 0000000..9ff9c76
--- /dev/null
+++ b/tools/sra-shell/turboVision/Makefile
@@ -0,0 +1,71 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+default: std
+
+TOP ?= $(abspath ../../..)
+MODULE = tools/sra-shell/turboVision
+
+include $(TOP)/build/Makefile.env
+
+INT_LIBS = \
+	turboVision
+
+#-------------------------------------------------------------------------------
+# outer targets
+#
+all std: makedirs
+	@ $(MAKE_CMD) $(TARGDIR)/std
+	
+$(INT_LIBS): makedirs
+	@ $(MAKE_CMD) $(ILIBDIR)/$@
+
+.PHONY: all std $(INT_LIBS)
+
+#-------------------------------------------------------------------------------
+# std
+#
+$(TARGDIR)/std: \
+	$(addprefix $(ILIBDIR)/,$(INT_LIBS))
+
+.PHONY: $(TARGDIR)/std
+
+#-------------------------------------------------------------------------------
+# clean
+#
+clean: stdclean
+
+.PHONY: clean
+
+#-------------------------------------------------------------------------------
+# turboVision
+#
+
+TURBOVISION_SRC = \
+
+TURBOVISION_OBJ = \
+	$(addsuffix .$(OBJX),$(TURBOVISION_SRC))
+
+$(ILIBDIR)/turboVision: $(TURBOVISION_OBJ)
+	$(LP) --slib -o $@ $^ 
diff --git a/tools/sra-sort/Makefile b/tools/sra-sort/Makefile
index 457e53d..8407ed9 100644
--- a/tools/sra-sort/Makefile
+++ b/tools/sra-sort/Makefile
@@ -25,13 +25,14 @@
 
 default: std
 
-TOP ?= $(shell ../../build/abspath.sh ../..)
+TOP ?= $(abspath ../..)
 MODULE = tools/sra-sort
 
 include $(TOP)/build/Makefile.env
 include $(SRCDIR)/Makefile.$(COMP)
 
 INT_TOOLS = \
+	dump-blob-boundaries
 
 EXT_TOOLS = \
 
@@ -122,9 +123,23 @@ SRA_SORT_OBJ = \
 
 SRA_SORT_LIB = \
 	-lkapp \
-	-lncbi-wvdb \
-	-lxml2 \
+	-sncbi-wvdb \
 	-lm
 
 $(BINDIR)/sra-sort: $(SRA_SORT_OBJ)
 	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(SRA_SORT_LIB)
+
+#-------------------------------------------------------------------------------
+# dump-blob-boundaries
+#
+DBB_SRC = \
+	dump-blob-boundaries
+
+DBB_OBJ = \
+	$(addsuffix .$(OBJX),$(DBB_SRC))
+
+DBB_LIB = \
+	-lncbi-vdb \
+
+$(BINDIR)/dump-blob-boundaries: $(DBB_OBJ)
+	$(LD) --exe -o $@ $^ $(DBB_LIB)
diff --git a/tools/sra-sort/col-pair.c b/tools/sra-sort/col-pair.c
index 11e7779..6cedbb3 100644
--- a/tools/sra-sort/col-pair.c
+++ b/tools/sra-sort/col-pair.c
@@ -182,7 +182,7 @@ ColumnReader *TablePairMakeColumnReader ( TablePair *self, const ctx_t *ctx,
     else
     {
         uint32_t idx;
-        rc = VCursorAddColumn ( curs, & idx, colspec );
+        rc = VCursorAddColumn ( curs, & idx, "%s", colspec );
         if ( rc != 0 && GetRCState ( rc ) != rcExists )
         {
             if ( required )
@@ -473,7 +473,7 @@ ColumnWriter *TablePairMakeColumnWriter ( TablePair *self, const ctx_t *ctx,
     else
     {
         uint32_t idx;
-        rc = VCursorAddColumn ( curs, & idx, colspec );
+        rc = VCursorAddColumn ( curs, & idx, "%s", colspec );
         if ( rc != 0 )
             ERROR ( rc, "failed to add column 'dst.%s.%s' to cursor", self -> full_spec, colspec );
         else
diff --git a/tools/sra-sort/csra-tbl.c b/tools/sra-sort/csra-tbl.c
index 3365163..f8db2ea 100644
--- a/tools/sra-sort/csra-tbl.c
+++ b/tools/sra-sort/csra-tbl.c
@@ -608,7 +608,7 @@ void cSRATblPairPostCopySeq ( cSRATblPair *self, const ctx_t *ctx )
         MetaPair *meta = self -> dad . meta;
         KMDataNode *unaligned_node;
         const char *node_path = "unaligned";
-        rc_t rc = KMetadataOpenNodeUpdate ( meta -> dmeta, & unaligned_node, node_path );
+        rc_t rc = KMetadataOpenNodeUpdate ( meta -> dmeta, & unaligned_node, "%s", node_path );
         if ( rc != 0 )
             INTERNAL_ERROR ( rc, "KMetadataOpenNodeUpdate failed to open '%s'", node_path );
         else
@@ -617,7 +617,7 @@ void cSRATblPairPostCopySeq ( cSRATblPair *self, const ctx_t *ctx )
             if ( csra -> first_half_aligned_spot != 0 )
             {
                 node_path = "first-half-aligned";
-                rc = KMDataNodeOpenNodeUpdate ( unaligned_node, & node, node_path );
+                rc = KMDataNodeOpenNodeUpdate ( unaligned_node, & node, "%s", node_path );
                 if ( rc != 0 )
                     INTERNAL_ERROR ( rc, "KMDataNodeOpenNodeUpdate failed to open 'unaligned/%s'", node_path );
                 else
@@ -633,7 +633,7 @@ void cSRATblPairPostCopySeq ( cSRATblPair *self, const ctx_t *ctx )
             if ( ! FAILED () && csra -> first_unaligned_spot != 0 )
             {
                 node_path = "first-unaligned";
-                rc = KMDataNodeOpenNodeUpdate ( unaligned_node, & node, node_path );
+                rc = KMDataNodeOpenNodeUpdate ( unaligned_node, & node, "%s", node_path );
                 if ( rc != 0 )
                     INTERNAL_ERROR ( rc, "KMDataNodeOpenNodeUpdate failed to open 'unaligned/%s'", node_path );
                 else
diff --git a/tools/sra-sort/db-pair.c b/tools/sra-sort/db-pair.c
index b350da1..7be477d 100644
--- a/tools/sra-sort/db-pair.c
+++ b/tools/sra-sort/db-pair.c
@@ -330,6 +330,7 @@ bool CC DbPairPreExplodeTablePair ( void *item, void *data )
     return true;
 }
 
+#if 0
 static
 void DbPairDefaultExplodeDB ( DbPair *self, const ctx_t *ctx )
 {
@@ -390,6 +391,7 @@ void DbPairDefaultExplodeDB ( DbPair *self, const ctx_t *ctx )
         KNamelistRelease ( names );
     }
 }
+#endif
 
 static
 void DbPairDefaultExplodeTbl ( DbPair *self, const ctx_t *ctx )
@@ -540,7 +542,7 @@ DbPair *DbPairMakeDbPair ( DbPair *self, const ctx_t *ctx, const char *member, c
     DbPair *db = NULL;
                 
     STATUS ( 4, "creating db pair '%s.%s'", self -> full_spec, name );
-    rc = VDatabaseOpenDBRead ( self -> sdb, & src, name );
+    rc = VDatabaseOpenDBRead ( self -> sdb, & src, "%s", name );
     if ( rc != 0 )
     {
         if ( required )
@@ -559,7 +561,7 @@ DbPair *DbPairMakeDbPair ( DbPair *self, const ctx_t *ctx, const char *member, c
         {
             VDatabase *dst;
             const Tool *tp = ctx -> caps -> tool;
-            rc = VDatabaseCreateDB ( self -> ddb, & dst, member, kcmOpen | ( tp -> db . cmode & kcmMD5 ), name );
+            rc = VDatabaseCreateDB ( self -> ddb, & dst, member, kcmOpen | ( tp -> db . cmode & kcmMD5 ), "%s", name );
             if ( rc != 0 )
                 ERROR ( rc, "VDatabaseCreateDB: failed to create %s db '%s.%s'", member, self -> full_spec, name );
             else
@@ -589,7 +591,7 @@ TablePair *DbPairMakeTablePair ( DbPair *self, const ctx_t *ctx, const char *mem
     TablePair *tbl = NULL;
                 
     STATUS ( 4, "creating table pair '%s.%s'", self -> full_spec, name );
-    rc = VDatabaseOpenTableRead ( self -> sdb, & src, name );
+    rc = VDatabaseOpenTableRead ( self -> sdb, & src, "%s", name );
     if ( rc != 0 )
     {
         if ( required )
@@ -606,7 +608,7 @@ TablePair *DbPairMakeTablePair ( DbPair *self, const ctx_t *ctx, const char *mem
         {
             VTable *dst;
             const Tool *tp = ctx -> caps -> tool;
-            rc = VDatabaseCreateTable ( self -> ddb, & dst, member, kcmOpen | ( tp -> db . cmode & kcmMD5 ), name );
+            rc = VDatabaseCreateTable ( self -> ddb, & dst, member, kcmOpen | ( tp -> db . cmode & kcmMD5 ), "%s", name );
             if ( rc != 0 )
                 ERROR ( rc, "VDatabaseCreateTable: failed to create %s table '%s.%s'", member, self -> full_spec, name );
             else
@@ -695,7 +697,7 @@ DirPair *DbPairMakeDirPair ( DbPair *self, const ctx_t *ctx, const char *name, b
                     INTERNAL_ERROR ( rc, "KDatabaseOpenDirectoryUpdate: failed to access KDirectory 'dst.%s'", self -> full_spec );
                 else
                 {
-                    switch ( KDirectoryPathType ( sdir, name ) )
+                    switch ( KDirectoryPathType ( sdir, "%s", name ) )
                     {
                     case kptNotFound:
                         if ( required )
diff --git a/tools/sra-sort/dir-pair.c b/tools/sra-sort/dir-pair.c
index 5f7f63a..da46b74 100644
--- a/tools/sra-sort/dir-pair.c
+++ b/tools/sra-sort/dir-pair.c
@@ -174,7 +174,7 @@ rc_t DirPairCopyFile ( const DirPair *self, const ctx_t *ctx,
 
     /* get source access mode */
     uint32_t access;
-    rc_t rc = KDirectoryAccess ( src, & access, relpath );
+    rc_t rc = KDirectoryAccess ( src, & access, "%s", relpath );
     if ( rc != 0 )
     {
         ERROR ( rc, "failed to determine access mode of file 'dst.%.*s%s'",
@@ -183,7 +183,7 @@ rc_t DirPairCopyFile ( const DirPair *self, const ctx_t *ctx,
     else
     {
         KFile *d;
-        rc = KDirectoryCreateFile ( dst, & d, false, access, kcmInit | kcmParents, relpath );
+        rc = KDirectoryCreateFile ( dst, & d, false, access, kcmInit | kcmParents, "%s", relpath );
         if ( rc != 0 )
         {
             ERROR ( rc, "failed to create file 'dst.%.*s%s'",
@@ -193,7 +193,7 @@ rc_t DirPairCopyFile ( const DirPair *self, const ctx_t *ctx,
         {
             const KFile *s;
             /* open source */
-            rc = KDirectoryOpenFileRead ( src, & s, relpath );
+            rc = KDirectoryOpenFileRead ( src, & s, "%s", relpath );
             if ( rc != 0 )
             {
                 ERROR ( rc, "failed to open file 'src.%.*s%s'",
@@ -304,7 +304,7 @@ rc_t DirPairCopyAlias ( const DirPair *self, const ctx_t *ctx,
     char apath [ 4096 ];
 
     /* resolve the alias */
-    rc = KDirectoryResolveAlias ( src, false, apath, sizeof apath, relpath );    
+    rc = KDirectoryResolveAlias ( src, false, apath, sizeof apath, "%s", relpath );    
     if ( rc != 0 )
     {
         ERROR ( rc, "failed to resolve alias 'src.%.*s%s'",
@@ -373,7 +373,7 @@ rc_t DirPairCopyDir ( const DirPair *self, const ctx_t *ctx,
 
     /* get source access mode */
     uint32_t access;
-    rc_t rc = KDirectoryAccess ( src, & access, relpath );
+    rc_t rc = KDirectoryAccess ( src, & access, "%s", relpath );
     if ( rc != 0 )
     {
         ERROR ( rc, "failed to determine access mode of directory 'src.%.*s%s'",
@@ -382,7 +382,7 @@ rc_t DirPairCopyDir ( const DirPair *self, const ctx_t *ctx,
     else
     {
         /* create the destination directory */
-        rc = KDirectoryCreateDir ( dst, access, kcmOpen | kcmParents, relpath );
+        rc = KDirectoryCreateDir ( dst, access, kcmOpen | kcmParents, "%s", relpath );
         if ( rc != 0 )
             ERROR ( rc, "failed to create directory 'dst.%.*s%s'",
                     self -> owner_spec_size, self -> full_spec, relpath );
@@ -398,7 +398,7 @@ rc_t DirPairCopyDir ( const DirPair *self, const ctx_t *ctx,
             pb . dst = dst;
 
             /* going to perform shallow copy */
-            rc = KDirectoryVisit ( src, false, DirPairCopyEntry, & pb, relpath );
+            rc = KDirectoryVisit ( src, false, DirPairCopyEntry, & pb, "%s", relpath );
         }
     }
 
diff --git a/tools/sra-sort/dump-blob-boundaries.c b/tools/sra-sort/dump-blob-boundaries.c
index 6639d8a..76cef4e 100644
--- a/tools/sra-sort/dump-blob-boundaries.c
+++ b/tools/sra-sort/dump-blob-boundaries.c
@@ -65,7 +65,7 @@ static
 void dump_col_name ( const KTable *tbl, const char *dbname, const char *tblname, const char *colname )
 {
     const KColumn *col;
-    rc_t rc = KTableOpenColumnRead ( tbl, & col, colname );
+    rc_t rc = KTableOpenColumnRead ( tbl, & col, "%s", colname );
     if ( rc != 0 )
         fprintf ( stderr, "failed to open column '%s.%s.%s'\n", dbname, tblname, colname );
     else
@@ -127,7 +127,7 @@ static
 void dump_tbl_name ( const KDatabase *db, const char *tblname, int argc, char *argv [] )
 {
     const KTable *tbl;
-    rc_t rc = KDatabaseOpenTableRead ( db, & tbl, tblname );
+    rc_t rc = KDatabaseOpenTableRead ( db, & tbl, "%s", tblname );
     if ( rc != 0 )
         fprintf ( stderr, "failed to open table '%s.%s'\n", argv [ 1 ], tblname );
     else
@@ -186,7 +186,7 @@ int main ( int argc, char *argv [] )
         if ( rc == 0 )
         {
             const KDatabase *db;
-            rc = KDBManagerOpenDBRead ( mgr, & db, argv [ 1 ] );
+            rc = KDBManagerOpenDBRead ( mgr, & db, "%s", argv [ 1 ] );
             if ( rc != 0 )
                 fprintf ( stderr, "failed to open database '%s'\n", argv [ 1 ] );
             else
diff --git a/tools/sra-sort/meta-pair.c b/tools/sra-sort/meta-pair.c
index b4ca027..ac37903 100644
--- a/tools/sra-sort/meta-pair.c
+++ b/tools/sra-sort/meta-pair.c
@@ -390,12 +390,12 @@ void copy_meta_node ( const KMDataNode *src, const ctx_t *ctx, KMDataNode *dst,
                                 if ( name == NULL )
                                     continue;
 
-                                rc = KMDataNodeOpenNodeRead ( src, & schild, name );
+                                rc = KMDataNodeOpenNodeRead ( src, & schild, "%s", name );
                                 if ( rc != 0 )
                                     ERROR ( rc, "failed to open source metadata node '%s'", name );
                                 else
                                 {
-                                    rc = KMDataNodeOpenNodeUpdate ( dst, & dchild, name );
+                                    rc = KMDataNodeOpenNodeUpdate ( dst, & dchild, "%s", name );
                                     if ( rc != 0 )
                                         ERROR ( rc, "failed to open destination metadata node '%s'", name );
                                     else
diff --git a/tools/sra-sort/run.c b/tools/sra-sort/run.c
index 8b55da7..e64d31d 100644
--- a/tools/sra-sort/run.c
+++ b/tools/sra-sort/run.c
@@ -195,7 +195,7 @@ VSchema *map_schema_types ( TypeParams *type, const ctx_t *ctx, const VSchema *s
             ERROR ( rc, "VDBManagerMakeSchema failed" );
         else
         {
-            rc = VSchemaParseFile ( dst_schema, schema_src );
+            rc = VSchemaParseFile ( dst_schema, "%s", schema_src );
             if ( rc != 0 )
                 ERROR ( rc, "VSchemaParseFile failed adding file '%s' for destination", src_schema );
             else
@@ -208,7 +208,7 @@ VSchema *map_schema_types ( TypeParams *type, const ctx_t *ctx, const VSchema *s
                         return dst_schema;
                     }
 
-                    rc = VSchemaParseFile ( dst_schema, schema_src );
+                    rc = VSchemaParseFile ( dst_schema, "%s", schema_src );
                     if ( rc == 0 )
                         return dst_schema;
 
@@ -269,7 +269,7 @@ void open_db ( const ctx_t *ctx, const VDatabase **srcp )
                     {
                         src_schema = dst_schema;
                         VDatabaseRelease ( src );
-                        rc = VDBManagerOpenDBRead ( ctx -> caps -> vdb, srcp, src_schema, tp -> src_path );
+                        rc = VDBManagerOpenDBRead ( ctx -> caps -> vdb, srcp, src_schema, "%s", tp -> src_path );
                         if ( rc != 0 )
                             ERROR ( rc, "VDBManagerOpenDBRead failed reopening db '%s'", tp -> src_path );
                         src = *srcp;
@@ -280,7 +280,7 @@ void open_db ( const ctx_t *ctx, const VDatabase **srcp )
                 {
                     VDatabase *dst;
                     rc = VDBManagerCreateDB ( ctx -> caps -> vdb, & dst, dst_schema,
-                        type . dst_type, tp -> db . cmode, tp -> dst_path );
+                                              type . dst_type, tp -> db . cmode, "%s", tp -> dst_path );
                     if ( rc != 0 )
                         ERROR ( rc, "VDBManagerCreateDB failed to create '%s' with type '%s'", tp -> dst_path, type . dst_type );
                     else
@@ -348,7 +348,7 @@ void run ( const ctx_t *ctx )
     const Tool *tp = ctx -> caps -> tool;
 
     const VDatabase *db;
-    rc_t rc = VDBManagerOpenDBRead ( mgr, & db, NULL, tp -> src_path );
+    rc_t rc = VDBManagerOpenDBRead ( mgr, & db, NULL, "%s", tp -> src_path );
     if ( rc == 0 )
     {
         open_db ( ctx, & db );
@@ -357,7 +357,7 @@ void run ( const ctx_t *ctx )
     else
     {
         const VTable *tbl;
-        rc_t rc2 = VDBManagerOpenTableRead ( mgr, & tbl, NULL, tp -> src_path );
+        rc_t rc2 = VDBManagerOpenTableRead ( mgr, & tbl, NULL, "%s", tp -> src_path );
         if ( rc2 == 0 )
         {
             rc = 0;
@@ -370,7 +370,7 @@ void run ( const ctx_t *ctx )
             rc2 = VDBManagerMakeSRASchema ( mgr, & sra_dflt );
             if ( rc2 == 0 )
             {
-                rc2 = VDBManagerOpenTableRead ( mgr, & tbl, sra_dflt, tp -> src_path );
+                rc2 = VDBManagerOpenTableRead ( mgr, & tbl, sra_dflt, "%s", tp -> src_path );
                 if ( rc2 == 0 )
                 {
                     rc = 0;
diff --git a/tools/sra-sort/sort-defs.h b/tools/sra-sort/sort-defs.h
index 80157a5..329143d 100644
--- a/tools/sra-sort/sort-defs.h
+++ b/tools/sra-sort/sort-defs.h
@@ -40,6 +40,18 @@
 /* prevent inclusion of <kfc/defs.h> */
 #define _h_kfc_defs_ 1
 
+
+/*--------------------------------------------------------------------------
+ * NAME_VERS
+ *  synthesize versioned type and message names
+ */
+#define NAME_VERS( name, maj_vers ) \
+    MAKE_NAME_VERS1 ( name, maj_vers )
+#define MAKE_NAME_VERS1( name, maj_vers ) \
+    MAKE_NAME_VERS2 ( name, maj_vers )
+#define MAKE_NAME_VERS2( name, maj_vers ) \
+    name ## _v ## maj_vers
+
 typedef uint32_t rc_t, ver_t;
 
 #ifndef _h_klib_defs_
diff --git a/tools/sra-sort/sra-sort.c b/tools/sra-sort/sra-sort.c
index 0c7eb92..0c72310 100644
--- a/tools/sra-sort/sra-sort.c
+++ b/tools/sra-sort/sra-sort.c
@@ -594,7 +594,7 @@ rc_t CC KMain ( int argc, char *argv [] )
                                         enum RCTarget targ = rcNoTarg;
 
                                         bool dst_is_dir = false;
-                                        int dst_type = KDBManagerPathType ( caps . kdb, dst ) & ~ kptAlias;
+                                        int dst_type = KDBManagerPathType ( caps . kdb, "%s", dst ) & ~ kptAlias;
                                         if ( dst_type == kptDir )
                                             dst_is_dir = true;
                                         else if ( count != 2 )
@@ -711,7 +711,7 @@ rc_t CC KMain ( int argc, char *argv [] )
                                                     {
                                                     case kptDatabase:
                                                     case kptTable:
-                                                        src_type = KDBManagerPathType ( caps . kdb, tp . src_path ) & ~ kptAlias;
+                                                        src_type = KDBManagerPathType ( caps . kdb, "%s", tp . src_path ) & ~ kptAlias;
                                                         if ( src_type == kptPrereleaseTbl )
                                                             src_type = kptTable;
                                                         if ( src_type != dst_type )
diff --git a/tools/sra-sort/sra-sort.vers b/tools/sra-sort/sra-sort.vers
index cc6c9a4..8e8299d 100644
--- a/tools/sra-sort/sra-sort.vers
+++ b/tools/sra-sort/sra-sort.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/sra-sort/tbl-pair.c b/tools/sra-sort/tbl-pair.c
index f0c6597..01e2a0a 100644
--- a/tools/sra-sort/tbl-pair.c
+++ b/tools/sra-sort/tbl-pair.c
@@ -697,7 +697,7 @@ ColumnPair *TablePairMatchColumnPair ( TablePair *self, const ctx_t *ctx, const
                                 break;
                             }
 
-                            rc = VCursorAddColumn ( scurs, & idx, colspec );
+                            rc = VCursorAddColumn ( scurs, & idx, "%s", colspec );
                             if ( rc == 0 )
                             {
                                 ColumnReader *reader;
diff --git a/tools/sra-stat/Makefile b/tools/sra-stat/Makefile
index 1f5aeb7..65224db 100644
--- a/tools/sra-stat/Makefile
+++ b/tools/sra-stat/Makefile
@@ -25,7 +25,7 @@
 
 default: std
 
-TOP ?= $(shell ../../build/abspath.sh ../..)
+TOP ?= $(abspath ../..)
 MODULE = tools/sra-stat
 
 include $(TOP)/build/Makefile.env
@@ -84,9 +84,9 @@ SRASTAT_OBJ = \
 
 SRASTAT_LIB = \
 	-lkapp \
-	-lncbi-vdb \
-	-lxml2 \
+	-sncbi-vdb \
 	-lm
 
 $(BINDIR)/sra-stat: $(SRASTAT_OBJ)
 	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(SRASTAT_LIB)
+
diff --git a/tools/sra-stat/sra-stat.c b/tools/sra-stat/sra-stat.c
index 14322ce..fa517e9 100644
--- a/tools/sra-stat/sra-stat.c
+++ b/tools/sra-stat/sra-stat.c
@@ -420,10 +420,11 @@ void BasesAdd(Bases *self, spotid_t spotid)
     }
 }
 
-static
-void BasesPrint(const Bases *self,
+static rc_t BasesPrint(const Bases *self,
     uint64_t base_count, const char* indent)
 {
+    rc_t rc = 0;
+
     const char tag[] = "Bases";
     const char *name = NULL;
     int i = ~0;
@@ -433,16 +434,16 @@ void BasesPrint(const Bases *self,
     if (!self->finalized) {
         LOGMSG(klogInfo, "Bases statistics will not be printed : "
             "Bases object was not finalized during BasesPrint()");
-        return;
+        return rc;
     }
 
     if (self->cnt[0] + self->cnt[1] + self->cnt[2] +
         self->cnt[3] + self->cnt[4] != base_count)
     {
-        rc_t rc = RC(rcExe, rcNumeral, rcComparing, rcData, rcInvalid);
+        rc = RC(rcExe, rcNumeral, rcComparing, rcData, rcInvalid);
         LOGERR(klogErr, rc,
             "BASE_COUNT MISMATCH DURING BASES COUNT CALCULATION");
-        return;
+        return rc;
     }
 
     name = self->CS_NATIVE ? "0123." : "ACGTN";
@@ -454,6 +455,8 @@ void BasesPrint(const Bases *self,
             indent, name[i], self->cnt[i]));
     }
     OUTMSG(("%s</%s>\n", indent, tag));
+
+    return rc;
 }
 
 typedef struct {
@@ -953,7 +956,7 @@ rc_t QualityStatsRead1(QualityStats* self,
 {
     const KMDataNode* node = NULL;
 
-    rc_t rc = KMDataNodeOpenNodeRead(parent, &node, name);
+    rc_t rc = KMDataNodeOpenNodeRead(parent, &node, "%s", name);
     DISP_RC2(rc, name, "while calling KMDataNodeOpenNodeRead");
 
     if (rc == 0) {
@@ -1004,7 +1007,7 @@ rc_t QualityStatsRead(QualityStats* self, const KMetadata* meta)
 
     memset(self, 0, sizeof *self);
 
-    rc = KMetadataOpenNodeRead(meta, &node, name);
+    rc = KMetadataOpenNodeRead(meta, &node, "%s", name);
 
     if (rc != 0) {
         if (GetRCState(rc) == rcNotFound) {
@@ -1096,7 +1099,7 @@ rc_t CountRead(Count* self, const char* name, const KMDataNode* parent)
 
     memset(self, 0, sizeof *self);
 
-    rc = KMDataNodeOpenNodeRead(parent, &node, name);
+    rc = KMDataNodeOpenNodeRead(parent, &node, "%s", name);
     if (rc != 0) {
         if (GetRCState(rc) == rcNotFound) {
             DBGMSG(DBG_APP,DBG_COND_1, ("%s: not found\n", name));
@@ -1124,7 +1127,7 @@ rc_t TableCountsRead1(TableCounts* self,
     const KMetadata* meta = NULL;
     const char name[] = "STATS/TABLE";
     const KMDataNode* node = NULL;
-    rc_t rc = VDatabaseOpenTableRead(db, &tbl, tableName);
+    rc_t rc = VDatabaseOpenTableRead(db, &tbl, "%s", tableName);
     DISP_RC2(rc, tableName, "while calling VDatabaseOpenTableRead");
 
     if (rc == 0) {
@@ -1159,7 +1162,7 @@ rc_t TableCountsRead1(TableCounts* self,
         DISP_RC2(rc, name, "while calling VTableOpenMetadataRead");
     }
     if (rc == 0) {
-        rc = KMetadataOpenNodeRead(meta, &node, name);
+        rc = KMetadataOpenNodeRead(meta, &node, "%s", name);
         if (rc != 0) {
             if (GetRCState(rc) == rcNotFound) {
                 DBGMSG(DBG_APP,DBG_COND_1, ("%s: not found\n", name));
@@ -1345,7 +1348,7 @@ rc_t parse_bam_header(const VDatabase* db,
     }
 
     if (rc == 0) {
-        rc = KMetadataOpenNodeRead(meta, &node, name);
+        rc = KMetadataOpenNodeRead(meta, &node, "%s", name);
         if (rc != 0) {
             if (GetRCState(rc) == rcNotFound) {
                 return 0;
@@ -1460,7 +1463,7 @@ rc_t CC fileSizeVisitor(const KDirectory* dir,
     switch (type) {
         case kptFile: {
             uint64_t size = 0;
-            rc = KDirectoryFileSize(dir, &size, name);
+            rc = KDirectoryFileSize(dir, &size, "%s", name);
             DISP_RC2(rc, name, "while calling KDirectoryFileSize");
             if (rc == 0) {
                 sizes->size += size;
@@ -1471,7 +1474,7 @@ rc_t CC fileSizeVisitor(const KDirectory* dir,
         }
         case kptDir: 
             DBGMSG(DBG_APP, DBG_COND_1, ("Dir '%s'\n", name));
-            rc = KDirectoryVisit(dir, false, fileSizeVisitor, sizes, name);
+            rc = KDirectoryVisit(dir, false, fileSizeVisitor, sizes, "%s", name);
             DISP_RC2(rc, name, "while calling KDirectoryVisit");
             break;
         default:
@@ -1625,7 +1628,7 @@ rc_t get_load_info(const KMetadata* meta, SraMeta* info)
                     break;
                 case 2: {
                     const char name[] = "SOFTWARE/loader";
-                    rc = KMetadataOpenNodeRead(meta, &node, name);
+                    rc = KMetadataOpenNodeRead(meta, &node, "%s", name);
                     if (rc != 0) {
                         if (GetRCState(rc) == rcNotFound) {
                             DBGMSG(DBG_APP,DBG_COND_1,("%s: not found\n",name));
@@ -1681,7 +1684,7 @@ rc_t get_load_info(const KMetadata* meta, SraMeta* info)
     if (rc == 0) {
         const char name[] = "SOFTWARE/formatter";
         RELEASE(KMDataNode, node);
-        rc = KMetadataOpenNodeRead(meta, &node, name);
+        rc = KMetadataOpenNodeRead(meta, &node, "%s", name);
         if (rc != 0) {
             if (GetRCState(rc) == rcNotFound ) {
                 DBGMSG(DBG_APP,DBG_COND_1,("%s: not found\n",name));
@@ -1714,7 +1717,7 @@ rc_t get_load_info(const KMetadata* meta, SraMeta* info)
     if (rc == 0) {
         const char name[] = "LOAD/timestamp";
         RELEASE(KMDataNode, node);
-        rc = KMetadataOpenNodeRead(meta, &node, name);
+        rc = KMetadataOpenNodeRead(meta, &node, "%s", name);
         if (rc != 0) {
             if (GetRCState(rc) == rcNotFound ) {
                 DBGMSG(DBG_APP,DBG_COND_1,("%s: not found\n",name));
@@ -1750,7 +1753,7 @@ rc_t get_load_info(const KMetadata* meta, SraMeta* info)
 
 static
 rc_t readStatsMetaNode(const KMDataNode* parent, const char* parentName,
-    const char* name, uint64_t* result, bool quick, bool optional)
+                       const char* name, uint64_t* result, bool quick, bool optional)
 {
     rc_t rc = 0;
 
@@ -1758,7 +1761,7 @@ rc_t readStatsMetaNode(const KMDataNode* parent, const char* parentName,
 
     assert(parent && parentName && name && result);
 
-    rc = KMDataNodeOpenNodeRead(parent, &node, name);
+    rc = KMDataNodeOpenNodeRead(parent, &node, "%s", name);
     if (rc != 0)
     {
         if (GetRCState(rc) == rcNotFound && optional)
@@ -1769,7 +1772,7 @@ rc_t readStatsMetaNode(const KMDataNode* parent, const char* parentName,
         else if ( quick )
         {
             PLOGERR(klogInt, (klogInt, rc, "while opening $(parent)/$(child)",
-                "parent=%s,child=%s", parentName, name));
+                              "parent=%s,child=%s", parentName, name));
         }
     }
     else {
@@ -1781,11 +1784,53 @@ rc_t readStatsMetaNode(const KMDataNode* parent, const char* parentName,
         if ( rc != 0 && quick )
         {
             PLOGERR(klogInt, (klogInt, rc, "while reading $(parent)/$(child)",
-                "parent=%s,child=%s", parentName, name));
+                              "parent=%s,child=%s", parentName, name));
         }
     }
-
+    
     RELEASE(KMDataNode, node);
+    
+    return rc;
+}
+
+static
+rc_t readStatsMetaAttr(const KMDataNode* parent, const char* parentName,
+    const char* name, char ** result, bool quick, bool optional)
+{
+    rc_t rc = 0;
+    char temp[4096];
+    size_t actsize;
+
+    assert(parent && parentName && name && result);
+
+    rc = KMDataNodeReadAttr(parent, name, temp, sizeof(temp), &actsize);
+    if (GetRCState(rc) == rcInsufficient)
+    {
+        *result = malloc(actsize + 1);
+        if (*result)
+            rc = KMDataNodeReadAttr(parent, name, *result, actsize, &actsize);
+    }
+    else if (rc == 0)
+    {
+        *result = strdup(temp);
+    }
+    if (rc == 0 && *result == NULL)
+    {
+        rc = RC(rcExe, rcStorage, rcAllocating, rcMemory, rcExhausted);
+    }
+    else if (rc != 0)
+    {
+        if (GetRCState(rc) == rcNotFound && optional)
+        {
+            *result = 0;
+            rc = 0;
+        }
+        else
+        {
+            PLOGERR(klogInt, (klogInt, rc, "while opening $(parent)[$(child)]",
+                "parent=%s,child=%s", parentName, name));
+        }
+    }
 
     return rc;
 }
@@ -1795,17 +1840,23 @@ rc_t readStatsMetaNodes(const KMDataNode* parent, const char* name,
                         SraStatsMeta* stats, bool quick)
 {
     rc_t rc = 0;
-    const char* parentName = name;
+    const char *const parentName = name ? name : "STATS/TABLE";
 
     assert(parent && stats);
 
-    if (parentName == NULL)
-    {   parentName = "STATS/TABLE"; }
+    if (name) {
+        char *tempname;
 
-    if (rc == 0 && name) {
-        stats->spot_group = strdup(name);
-        if (stats->spot_group == NULL)
-        {   rc = RC(rcExe, rcStorage, rcAllocating, rcMemory, rcExhausted); }
+        rc = readStatsMetaAttr(parent, parentName, "name", &tempname, quick, true);
+        if (rc == 0) {
+            if (tempname)
+                stats->spot_group = tempname;
+            else {
+                stats->spot_group = strdup(name);
+                if (stats->spot_group == NULL)
+                {   rc = RC(rcExe, rcStorage, rcAllocating, rcMemory, rcExhausted); }
+            }
+        }
     }
 
     if (rc == 0) {
@@ -1843,7 +1894,7 @@ rc_t get_stats_meta(const KMetadata* meta,
     if (rc == 0) {
         const char name[] = "STATS/TABLE";
         const KMDataNode* node = NULL;
-        rc = KMetadataOpenNodeRead(meta, &node, name);
+        rc = KMetadataOpenNodeRead(meta, &node, "%s", name);
         if (rc != 0) {
             if (GetRCState(rc) == rcNotFound) {
                 DBGMSG(DBG_APP,DBG_COND_1, ("%s: not found\n", name));
@@ -1859,7 +1910,7 @@ rc_t get_stats_meta(const KMetadata* meta,
     if (rc == 0) {
         const char name[] = "STATS/SPOT_GROUP";
         const KMDataNode* parent = NULL;
-        rc = KMetadataOpenNodeRead(meta, &parent, name);
+        rc = KMetadataOpenNodeRead(meta, &parent, "%s", name);
         if (rc != 0) {
             if (GetRCState(rc) == rcNotFound) {
                 DBGMSG(DBG_APP,DBG_COND_1, ("%s: not found\n", name));
@@ -1896,7 +1947,7 @@ rc_t get_stats_meta(const KMetadata* meta,
                         "idx=%i", i));
                 }
                 else {
-                    rc = KMDataNodeOpenNodeRead(parent, &node, child);
+                    rc = KMDataNodeOpenNodeRead(parent, &node, "%s", child);
                     DISP_RC2(rc, child, "while calling KMDataNodeOpenNodeRead");
                 }
                 if (rc == 0) {
@@ -2103,6 +2154,7 @@ static
 rc_t print_results(const Ctx* ctx)
 {
     rc_t rc = 0;
+    rc_t rc2 = 0;
     bool mismatch = false;
 
     assert(ctx && ctx->pb
@@ -2123,10 +2175,12 @@ rc_t print_results(const Ctx* ctx)
         bool mismatch = false;
         SraStats* ss = (SraStats*)BSTreeFind(ctx->tr, "", srastats_cmp);
         const SraStatsMeta* m = &ctx->meta->table;
-        if (ctx->total->BASE_COUNT != m->BASE_COUNT
-            || ctx->total->BIO_BASE_COUNT != m->BIO_BASE_COUNT
-            || ctx->total->spot_count != m->spot_count
-            || ctx->total->total_cmp_len != m->CMP_BASE_COUNT)
+        if (ctx->total->BASE_COUNT != m->BASE_COUNT)
+        { mismatch = true; }
+        if (ctx->total->BIO_BASE_COUNT != m->BIO_BASE_COUNT)
+        { mismatch = true; }
+        if (ctx->total->spot_count != m->spot_count ||
+            ctx->total->total_cmp_len != m->CMP_BASE_COUNT)
         { mismatch = true; }
         if (ss != NULL) {
             const SraStatsMeta* m = &ctx->meta->table;
@@ -2295,7 +2349,8 @@ rc_t print_results(const Ctx* ctx)
             OUTMSG(("    </Meta>\n  </Table>\n"));
         }
         if (rc == 0 && !ctx->pb->quick) {
-            BasesPrint(&ctx->total->bases_count, ctx->total->BASE_COUNT, "  ");
+            rc2 = BasesPrint(&ctx->total->bases_count,
+                ctx->total->BASE_COUNT, "  ");
         }
         if (rc == 0 && !ctx->pb->skip_alignment) {
             rc = process_align_info("  ", ctx);
@@ -2334,6 +2389,9 @@ rc_t print_results(const Ctx* ctx)
         LOGMSG(klogWarn,
             "Mismatch between calculated and recorded statistics");
     }
+    if (rc == 0 && rc2 != 0) {
+        rc = rc2;
+    }
     return rc;
 }
 
@@ -2806,7 +2864,7 @@ rc_t run(srastat_parms* pb)
         SraMeta info;
         const SRATable* tbl = NULL;
 
-        rc = SRAMgrOpenTableRead(mgr, &tbl, pb->table_path);
+        rc = SRAMgrOpenTableRead(mgr, &tbl, "%s", pb->table_path);
         if (rc != 0) {
             PLOGERR(klogInt, (klogInt, rc,
                 "'$(spec)'", "spec=%s", pb->table_path));
diff --git a/tools/sra-stat/sra-stat.vers b/tools/sra-stat/sra-stat.vers
index cc6c9a4..8e8299d 100644
--- a/tools/sra-stat/sra-stat.vers
+++ b/tools/sra-stat/sra-stat.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/sra-stat/sra-stat.vers.h b/tools/sra-stat/sra-stat.vers.h
new file mode 100644
index 0000000..62358e7
--- /dev/null
+++ b/tools/sra-stat/sra-stat.vers.h
@@ -0,0 +1 @@
+#define SRA_STAT_VERS 0x02040002
diff --git a/tools/sra/Makefile b/tools/sra/Makefile
new file mode 100644
index 0000000..3b0ef8f
--- /dev/null
+++ b/tools/sra/Makefile
@@ -0,0 +1,109 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: std
+
+TOP ?= $(abspath ../..)
+MODULE = tools/sra
+
+include $(TOP)/build/Makefile.env
+
+INT_TOOLS = \
+
+EXT_TOOLS = \
+	table-vers
+
+ALL_TOOLS = \
+	$(INT_TOOLS) \
+	$(EXT_TOOLS)
+
+#------------------------------------------------------------------------------
+# outer targets
+#
+all std: vers-includes
+	@ $(MAKE_CMD) $(TARGDIR)/$@
+
+$(ALL_TOOLS): vers-includes
+	@ $(MAKE_CMD) $(BINDIR)/$@
+
+.PHONY: all std $(ALL_TOOLS)
+
+#-------------------------------------------------------------------------------
+# all
+#
+$(TARGDIR)/all: \
+	$(addprefix $(BINDIR)/,$(ALL_TOOLS))
+
+.PHONY: $(TARGDIR)/all
+
+#-------------------------------------------------------------------------------
+# std
+#
+$(TARGDIR)/std: \
+	$(addprefix $(BINDIR)/,$(EXT_TOOLS))
+
+.PHONY: $(TARGDIR)/std
+
+#-------------------------------------------------------------------------------
+# vers-includes
+#
+$(TARGDIR)/vers-includes: $(addsuffix .vers.h,$(EXT_TOOLS))
+
+.PHONY: $(TARGDIR)/vers-includes
+
+#-------------------------------------------------------------------------------
+# clean
+#
+clean: stdclean
+
+.PHONY: clean
+
+#-------------------------------------------------------------------------------
+# table-vers
+#
+TABLE_VERS_SRC = \
+	table-vers
+
+TABLE_VERS_OBJ = \
+	$(addsuffix .$(OBJX),$(TABLE_VERS_SRC))
+
+TABLE_VERS_LIB = \
+	-dvxf \
+	-lvdb \
+	-lkdb \
+	-lvfs \
+	-lkapp \
+	-lkfg \
+	-lkfs \
+	-lkrypto \
+	-lklib \
+	-lm
+
+table-vers.vers.h: table-vers.vers
+	$(TOP)/build/make-vers-inc.sh TABLE_VERS_VERS $^ > $@
+
+$(BINDIR)/table-vers: $(TABLE_VERS_OBJ)
+	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(TABLE_VERS_LIB)
+
diff --git a/tools/sra/sra-dbcc.c b/tools/sra/sra-dbcc.c
new file mode 100644
index 0000000..f13dcdf
--- /dev/null
+++ b/tools/sra/sra-dbcc.c
@@ -0,0 +1,442 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+#include <kapp/main.h>
+#include <klib/log.h>
+#include <klib/rc.h>
+#include <klib/namelist.h>
+#include <klib/container.h>
+#include <klib/debug.h>
+#include <kdb/manager.h>
+#include <kdb/database.h>
+#include <kdb/table.h>
+#include <kdb/column.h>
+#include <kdb/namelist.h>
+#include <kdb/meta.h>
+#include <kfs/directory.h>
+#include <kfs/file.h>
+#include <kfs/md5.h>
+#include <kfs/arc.h>
+#include <kfs/sra.h>
+#include <sysalloc.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "sra-dbcc.vers.h"
+
+rc_t CC Usage ( struct Args const * args ) { return 0; }
+
+static rc_t ValidateColumn(const KColumn *col,
+                           const char *name,
+                           int64_t start, int64_t stop,
+                           int64_t *min, int64_t *max,
+                           bool *gapped)
+{
+    rc_t rc;
+    int64_t row;
+    const KColumnBlob *blob;
+    
+    for (row = start; (rc = Quitting()) == 0 && row < stop; ) {
+        int64_t first;
+        uint32_t count;
+        
+        rc = KColumnOpenBlobRead(col, &blob, row);
+        if (rc == 0) {
+            rc = KColumnBlobIdRange(blob, &first, &count);
+            if (rc == 0)
+                rc = KColumnBlobValidate(blob);
+            rc = KColumnBlobRelease(blob);
+        }
+        if (rc) {
+            PLOGERR(klogErr, (klogErr, rc, "$(column) rows $(start) to $(stop)", PLOG_3(PLOG_S(column), PLOG_I64(start), PLOG_I64(stop)), name, first, first + count));
+            return rc;
+        }
+        if (row != first)
+            *gapped |= true;
+        if (row == start)
+            *min = first;
+        row = first + count;
+        *max = row;
+    }
+    if (row != stop)
+        *gapped |= true;
+    return rc;
+}
+
+static
+rc_t CheckTable(const char path[])
+{
+    rc_t rc;
+    const KDBManager *mgr;
+    bool gapped = false;
+    bool allsame = true;
+    int64_t first_row;
+    int64_t last_row;
+    
+    PLOGMSG(klogInfo, (klogInfo, "verifying column data for '$(path)'", PLOG_S(path), path));
+    rc = KDBManagerMakeRead(&mgr, NULL);
+    if (rc == 0) {
+        const KTable* tbl;
+        
+        rc = KDBManagerOpenTableRead(mgr, &tbl, "%s", path);
+        if (rc == 0) {
+            KNamelist *names;
+            
+            rc = KTableListCol(tbl, &names);
+            if (rc == 0) {
+                uint32_t count;
+                rc = KNamelistCount(names, &count);
+                if (rc == 0) {
+                    unsigned i;
+                    const char *colname;
+                    
+                    for (i = 0; i != count && rc == 0; ++i) {
+                        rc = KNamelistGet(names, i, &colname);
+                        if (rc == 0) {
+                            const KColumn *kcol;
+                            
+                            rc = KTableOpenColumnRead(tbl, &kcol, "%s", colname);
+                            if (rc == 0) {
+                                int64_t start;
+                                uint64_t rcount;
+                                int64_t min;
+                                int64_t max;
+                                
+                                rc = KColumnIdRange(kcol, &start, &rcount);
+                                if (rc == 0) {
+                                    PLOGMSG(klogInfo, (klogInfo, "validating data for column '$(name)'...", PLOG_S(name), colname));
+                                    rc = ValidateColumn(kcol, colname, start, start + rcount, &min, &max, &gapped);
+                                    if (rc == 0) {
+                                        PLOGMSG(klogInfo, (klogInfo, "data for column '$(name)' ok", PLOG_S(name), colname));
+                                        if (i == 0) {
+                                            first_row = min;
+                                            last_row = max;
+                                        }
+                                        else if (first_row != min || last_row != max)
+                                            allsame = false;
+                                    }
+                                    else {
+                                        PLOGERR(klogErr, (klogErr, rc, "data for column '$(name)'", PLOG_S(name), colname));
+                                    }
+
+                                    rc = 0;
+                                }
+                                else {
+                                    PLOGERR(klogErr, (klogErr, rc, "KColumn '$(name)'", PLOG_S(name), colname));
+                                    rc = 0;
+                                }
+                                KColumnRelease(kcol);
+                            }
+                            else {
+                                PLOGERR(klogErr, (klogErr, rc, "KColumn '$(name)'", PLOG_S(name), colname));
+                                rc = 0;
+                            }
+                        }
+                        else {
+                            PLOGERR(klogErr, (klogErr, rc, "KColumn #$(number)", PLOG_U32(number), (uint32_t)i));
+                            rc = 0;
+                        }
+                    }
+                }
+                else {
+                    PLOGERR(klogErr, (klogErr, rc, "KNamelistCount", ""));
+                }
+            }
+            KTableRelease(tbl);
+        }
+        else {
+            PLOGERR(klogErr, (klogErr, rc, "KTable '$(name)'", PLOG_S(name), path));
+        }
+        KDBManagerRelease(mgr);
+    }
+    else {
+        PLOGERR(klogErr, (klogErr, rc, "KDBManagerMakeRead", ""));
+    }
+    return rc;
+}
+
+typedef struct CheckMD5Node_struct {
+    BSTNode dad;
+    char file[4096];
+    bool md5;
+    uint8_t digest[16];
+} CheckMD5Node;
+
+typedef struct CheckMD5_Data_struct {
+    BSTree files;
+    bool md5;
+    uint8_t digest[16];
+} CheckMD5_Data;
+
+static
+int CC CheckMD5Node_Cmp( const BSTNode *item, const BSTNode *n )
+{
+    return strcmp(((CheckMD5Node*)item)->file, ((CheckMD5Node*)n)->file);
+}
+
+static
+rc_t CC CheckMD5Visitor(const KDirectory *dir, uint32_t type, const char *name, void *data)
+{
+    rc_t rc = 0;
+    CheckMD5_Data* d = (CheckMD5_Data*)data;
+    
+    if(type == kptFile ) {
+        if( strcmp(name, "md5") == 0 || strcmp(&name[strlen(name) - 4], ".md5") == 0 ) {
+            const KFile* kfmd5;
+            if( (rc = KDirectoryOpenFileRead(dir, &kfmd5, "%s", name)) == 0 ) {
+                const KMD5SumFmt *md5;
+                if( (rc = KMD5SumFmtMakeRead(&md5, kfmd5)) == 0 ) {
+                    uint32_t count = 0;
+                    if( (rc = KMD5SumFmtCount(md5, &count)) == 0 ) {
+                        char buf[4096];
+                        bool bin;
+                        do {
+                            if( (rc = KMD5SumFmtGet(md5, --count, buf, sizeof(buf) - 1, d->digest, &bin)) == 0 ) {
+                                DBGMSG(DBG_APP, 0, ("md5 for $(nm) ", PLOG_S(nm), buf));
+                                d->md5 = true;
+                                rc = CheckMD5Visitor(dir, kptFile, buf, data);
+                                d->md5 = false;
+                            }
+                        } while( rc == 0 && count > 0 );
+                    }
+                    rc = KMD5SumFmtRelease(md5);
+                } else {
+                    KFileRelease(kfmd5);
+                }
+            }
+        } else {
+            CheckMD5Node* node = calloc(1, sizeof(*node));
+            if( (rc = KDirectoryResolvePath(dir, true, node->file, sizeof(node->file) - 1, "%s", name)) == 0 ) {
+                BSTNode* existing = NULL;
+                if( (rc = BSTreeInsertUnique(&d->files, &node->dad, &existing, CheckMD5Node_Cmp)) == 0 ) {
+                    DBGMSG(DBG_APP, 0, ("adding $(nm) ", PLOG_S(nm), node->file));
+                    if( d->md5 ) {
+                        node->md5 = true;
+                        memcpy(node->digest, d->digest, sizeof(d->digest));
+                    }
+                } else if( GetRCState(rc) == rcExists ) {
+                    DBGMSG(DBG_APP, 0, ("updating $(nm) ", PLOG_S(nm), node->file));
+                    if( d->md5 ) {
+                        ((CheckMD5Node*)existing)->md5 = true;
+                        memcpy(((CheckMD5Node*)existing)->digest, d->digest, sizeof(d->digest));
+                    }
+                    free(node);
+                    rc = 0;
+                }
+                if( rc != 0 ) {
+                    free(node);
+                }
+            }
+        }
+    } else if( (type != kptDir) && !(type & kptAlias) ) {
+        rc = RC(rcExe, rcTable, rcVisiting, rcDirEntry, rcInvalid);
+        PLOGERR(klogInfo, (klogInfo, rc, "$(nm)", PLOG_S(nm), name));
+    }
+    return rc;
+}
+
+typedef struct CheckMD5_WalkData_struct {
+    const KDirectory* dir;
+    rc_t rc;
+} CheckMD5_WalkData;
+
+static
+bool CC CheckMD5_Walk( BSTNode *n, void *data )
+{
+    rc_t rc = 0;
+    CheckMD5Node* m = (CheckMD5Node*)n;
+    CheckMD5_WalkData* d = (CheckMD5_WalkData*)data;
+    
+    if( m->md5 ) {
+        const KFile* kf;
+        DBGMSG(DBG_APP, 0, ("verifying $(nm) ", PLOG_S(nm), m->file));
+        if( (rc = KDirectoryOpenFileRead(d->dir, &kf, "%s", m->file)) == 0 ) {
+            const KFile* kfmd5;
+            if( (rc = KFileMakeMD5Read(&kfmd5, kf, m->digest)) == 0 ) {
+                char buf[10240];
+                size_t nr;
+                if( (rc = KFileRead(kfmd5, ~0, buf, sizeof(buf), &nr)) != 0 ) {
+                    PLOGERR(klogErr, (klogErr, rc, "MD5 check failed for file $(name)", PLOG_S(name), m->file));
+                }
+                KFileRelease(kfmd5);
+            } else {
+                KFileRelease(kf);
+            }
+        }
+    } else if( strcmp(&m->file[strlen(m->file) - 5 ], "/lock") != 0 &&
+              strcmp(&m->file[strlen(m->file) - 7 ], "/sealed") != 0) {
+        rc = RC(rcExe, rcTable, rcValidating, rcConstraint, rcInconsistent);
+        PLOGERR(klogWarn, (klogWarn, rc, "missing MD5 for file $(name)", PLOG_S(name), m->file));
+    }
+    d->rc = rc ? rc : d->rc;
+    if( d->rc == 0 && (d->rc = Quitting()) != 0 ) {
+        return true;
+    }
+    return false;
+}
+
+static
+rc_t CheckMD5(const char* path)
+{
+    rc_t rc = 0;
+    const KDirectory* dir = NULL;
+    
+    PLOGMSG(klogInfo, (klogInfo, "verifying MD5 for '$(path)'", PLOG_S(path), path));
+    if( (rc = KDirectoryNativeDir((KDirectory**)&dir)) == 0 ) {
+        uint32_t type = KDirectoryPathType(dir, "%s", path) & ~kptAlias;
+        
+        if( type == kptFile ) {
+            const KDirectory* adir = NULL;
+            
+            rc = KDirectoryOpenSraArchiveRead(dir, &adir, true, "%s", path);
+            if (rc == 0 ) {
+                KDirectoryRelease(dir);
+                dir = adir;
+                path = ".";
+            }
+        } else if( type != kptDir ) {
+            rc = RC(rcExe, rcTable, rcValidating, rcArc, rcUnknown);
+        }
+        if( rc == 0 ) {
+            CheckMD5_Data data;
+            BSTreeInit(&data.files);
+            data.md5 = false;
+            if( (rc = KDirectoryVisit(dir, true, CheckMD5Visitor, &data, "%s", path)) == 0 ) {
+                CheckMD5_WalkData wd;
+                wd.dir = dir;
+                wd.rc = 0;
+                BSTreeDoUntil(&data.files, false, CheckMD5_Walk, &wd);
+                rc = wd.rc;
+                LOGERR(rc ? klogErr : klogInfo, rc, "verifying MD5");
+            }
+        }
+        KDirectoryRelease(dir);
+    }
+    return rc;
+}
+
+
+static char const* const defaultLogLevel = 
+#if _DEBUGGING
+"debug5";
+#else
+"info";
+#endif
+
+/*******************************************************************************
+ * Usage
+ *******************************************************************************/
+static void usage(const char *progName)
+{
+    const char* p = strrchr(progName, '/');
+    p = p ? p + 1 : progName;
+    printf("\nUsage: %s [options] table\n\n", p);
+    printf(
+           "    -5, --md5        Check components md5s if present, fail otherwise, unless other checks are requested (default: yes)\n"
+           "    -b, --blob-crc   Check blobs CRC32 (default: no)\n"
+/*           "    -i, --index      Check 'skey' index (default: no)\n"*/
+           "\n"
+           "    -h, --help       This help\n"
+           "    -v, --version    Program version\n"
+           "\n");
+}
+
+uint32_t CC KAppVersion(void)
+{
+    return SRA_DBCC_VERS;
+}
+
+rc_t CC KMain ( int argc, char *argv [] )
+{
+    rc_t rc = 0;
+    int i;
+    const char* arg;
+    const char* src_path = "missing parameter";
+    bool md5_chk = true, md5_chk_explicit = false;
+    bool blob_crc = false;
+    bool index_chk = false;
+
+    KLogLevelSet(klogInfo);
+    
+    for(i = 1; rc == 0 && i < argc; i++) {
+        if( argv[i][0] != '-' ) {
+            src_path = argv[i];
+            break;
+        } else if(strcmp(argv[i], "-5") == 0 || strcmp(argv[i], "--md5") == 0 ) {
+            md5_chk_explicit = true;
+        } else if(strcmp(argv[i], "-b") == 0 || strcmp(argv[i], "--blob-crc") == 0 ) {
+            blob_crc = true;
+/*        } else if(strcmp(argv[i], "-i") == 0 || strcmp(argv[i], "--index") == 0 ) {
+            index_chk = true;
+*/
+        } else if(strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0 ) {
+            usage(argv[0]);
+            return 0;
+        } else if(strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0 ) {
+            printf("Version: %u.%u.%u\n", KAppVersion() >> 24, (KAppVersion() >> 16) & 0xFF, KAppVersion() & 0xFFFF);
+            return 0;
+        } else {
+            usage(argv[0]);
+            rc = RC(rcExe, rcArgv, rcReading, rcParam, rcUnknown);
+        }
+    }
+    if(i != argc - 1) {
+        usage(argv[0]);
+        rc = RC(rcExe, rcArgv, rcReading, rcParam, rcUnexpected);
+    }
+    
+    if( rc != 0 ) {
+    }
+    else if( src_path == NULL ) {
+        rc = RC(rcExe, rcArgv, rcReading, rcParam, rcNotFound);
+    }
+    else {
+        if( blob_crc || index_chk ) {
+            /* if blob or index is requested, md5 is off unless explicitly requested */
+            md5_chk = md5_chk_explicit;
+        }
+        if( md5_chk ) {
+            rc = CheckMD5(src_path);
+            if( GetRCObject(rc) == rcConstraint && GetRCState(rc) == rcInconsistent ) {
+                blob_crc = true;
+                rc = 0;
+            }
+        }
+        if (rc == 0 && blob_crc) {
+            rc = CheckTable(src_path);
+        }
+        if (rc == 0 && index_chk) {
+            /* rc = ValidateSKeyIndex(tbl); */
+        }
+    }
+    if( rc == 0 ) {
+        LOGMSG(klogInfo, "check ok");
+    } else {
+        PLOGERR(klogErr, (klogErr, rc, "check failed: '$(table)'", PLOG_S(table), src_path));
+    }
+    return rc;
+}
diff --git a/tools/sra/table-vers.c b/tools/sra/table-vers.c
new file mode 100644
index 0000000..c41335f
--- /dev/null
+++ b/tools/sra/table-vers.c
@@ -0,0 +1,236 @@
+/*******************************************************************************
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * =============================================================================
+ */
+
+#include "table-vers.vers.h" /* TABLE_VERS_VERS */
+
+#include <kapp/main.h>
+
+#include <vdb/manager.h> /* VDBManager */
+
+#include <kdb/database.h> /* KDatabase */
+#include <kdb/table.h> /* KDBTable */
+
+#include <klib/log.h> /* LOGERR */
+#include <klib/out.h> /* OUTMSG */
+#include <klib/debug.h> /* DBGMSG */
+#include <klib/rc.h> /* RC */
+
+#include <assert.h>
+#include <stdio.h> /* printf */
+#include <string.h> /* memset */
+
+#define DISP_RC(rc,msg) (void)((rc == 0) ? 0 : LOGERR(klogInt, rc, msg))
+#define RELEASE(type, obj) do { rc_t rc2 = type##Release(obj); \
+    if (rc2 && !rc) { rc = rc2; } obj = NULL; } while (false)
+
+typedef enum EOutType {
+    eTxt,
+    eXml
+} EOutType;
+
+typedef struct CmdLine {
+	const char* table;
+    EOutType outType;
+} CmdLine;
+
+ver_t CC KAppVersion(void) { return TABLE_VERS_VERS; }
+
+#define OPTION_OUTPUT  "output"
+#define ALIAS_OUTPUT   "o"
+
+static const char* output_usage[] = {
+    "Output type: one of (t | x)", "where 't' - text (default), 'x' - xml", NULL
+};
+
+OptDef Options[] =  {
+     { OPTION_OUTPUT, ALIAS_OUTPUT, NULL, output_usage, 1, true, false }
+};
+
+const char UsageDefaultName[] = "vable-vers";
+
+rc_t CC UsageSummary (const char * progname)
+{
+    return KOutMsg("Usage:\n"
+            "  %s [Options] <table>\n", progname);
+}
+
+rc_t CC Usage(const Args* args)
+{
+    rc_t rc = 0;
+    const char* progname = UsageDefaultName;
+    const char* fullpath = UsageDefaultName;
+
+    assert(args);
+
+    rc = ArgsProgram(args, &fullpath, &progname);
+    if (rc)
+    {    progname = fullpath = UsageDefaultName; }
+
+    UsageSummary(progname);
+
+    OUTMSG(("\nOptions\n"));
+
+    HelpOptionLine(ALIAS_OUTPUT, OPTION_OUTPUT, "type", output_usage);
+
+    HelpOptionsStandard();
+
+    HelpVersion(fullpath, KAppVersion());
+
+    return rc;
+}
+
+static rc_t CmdLineInit(const Args* args, CmdLine* cmdArgs)
+{
+    rc_t rc = 0;
+
+    assert(args && cmdArgs);
+
+    memset(cmdArgs, 0, sizeof *cmdArgs);
+
+    while (rc == 0) {
+        const char* outType = NULL;
+        uint32_t pcount = 0;
+
+        /* output type */
+        rc = ArgsOptionCount(args, OPTION_OUTPUT, &pcount);
+        if (rc) {
+            LOGERR(klogErr, rc, "Failure parsing output type");
+            break;
+        }
+        if (pcount > 1) {
+            rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcAmbiguous);
+            LOGERR(klogErr, rc, "Too many output type parameters");
+            break;
+        }
+        else if (pcount == 1) {
+            rc = ArgsOptionValue(args, OPTION_OUTPUT, 0, &outType);
+            if (rc) {
+                LOGERR(klogErr, rc, "Failure retrieving output type");
+                break;
+            }
+            else if (outType != NULL) {
+                if (strncmp(outType, "x", 1) == 0) {
+                    cmdArgs->outType = eXml;
+                }
+                else if (strncmp(outType, "t", 1) == 0) {
+                    cmdArgs->outType = eTxt;
+                }
+                else {
+                    rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcInvalid);
+                    LOGERR(klogErr, rc, "Bad output type value");
+                    break;
+                }
+            }
+        }
+
+        /* table path parameter */
+        rc = ArgsParamCount(args, &pcount);
+        if (rc) {
+            LOGERR(klogErr, rc, "Failure parsing table name");
+            break;
+        }
+        if (pcount < 1) {
+            rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcInsufficient);
+            LOGERR(klogErr, rc, "Missing table parameter");
+            break;
+        }
+        if (pcount > 1) {
+            rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcAmbiguous);
+            LOGERR(klogErr, rc, "Too many table parameters");
+            break;
+        }
+        rc = ArgsParamValue(args, 0, &cmdArgs->table);
+        if (rc) {
+            LOGERR(klogErr, rc, "Failure retrieving table name");
+            break;
+        }
+
+        break;
+    }
+
+    if (rc != 0) {
+        MiniUsage (args);
+    }
+
+    return rc;
+}
+
+rc_t CC KMain(int argc, char* argv[])
+{
+    rc_t rc = 0;
+    Args* args = NULL;
+    const VDBManager* mgr = NULL;
+
+    CmdLine cmdArgs;
+
+    LogLevelSet("info");
+
+    rc = ArgsMakeAndHandle
+        (&args, argc, argv, 1, Options, sizeof Options / sizeof(Options[0]));
+
+    if (rc == 0) {
+        rc = CmdLineInit(args, &cmdArgs);
+    }
+    if (rc == 0) {
+        DBGMSG(DBG_APP,DBG_COND_1, ("out type = '%d'\n",cmdArgs.outType));
+        PLOGMSG
+            (klogInfo,(klogInfo, "Checking $(tbl)", "tbl=%s", cmdArgs.table));
+        rc = VDBManagerMakeRead(&mgr, NULL);
+        DISP_RC(rc, "while calling VDBManagerMakeRead");
+    }
+    if (rc == 0) {
+        ver_t version = 0;
+        rc = VDBManagerGetObjVersion(mgr, &version, cmdArgs.table);
+        if (rc == 0) {
+            uint32_t maj =  version >> 24;
+            uint32_t min = (version >> 16) & 0xFF;
+            uint32_t rel =  version & 0xFFFF;
+            switch (cmdArgs.outType) {
+                case eTxt:
+                    OUTMSG(("v%d\n", maj));
+                    break;
+                case eXml:
+                    OUTMSG(("<Object vers=\"%u\" path=\"%s\">",
+                        maj, cmdArgs.table));
+                    if (min || rel) {
+                        OUTMSG(("<loader vers=\"%u.%u.%u\"/>", maj, min, rel));
+                    }
+                    OUTMSG(("</Object>\n"));
+                    break;
+            }
+        } else {
+            PLOGERR(klogErr,
+                (klogErr, rc, "'$(path)'", "path=%s", cmdArgs.table));
+        }
+    }
+
+    RELEASE(VDBManager, mgr);
+
+    ArgsWhack(args);
+
+    return rc;
+}
+
+/************************************ EOF ****************** ******************/
diff --git a/tools/sra/table-vers.vers b/tools/sra/table-vers.vers
new file mode 100644
index 0000000..8e8299d
--- /dev/null
+++ b/tools/sra/table-vers.vers
@@ -0,0 +1 @@
+2.4.2
diff --git a/tools/srapath/Makefile b/tools/srapath/Makefile
index 4c20189..d99117f 100644
--- a/tools/srapath/Makefile
+++ b/tools/srapath/Makefile
@@ -25,7 +25,7 @@
 
 default: std
 
-TOP ?= $(shell ../../build/abspath.sh ../..)
+TOP ?= $(abspath ../..)
 MODULE = tools/srapath
 
 include $(TOP)/build/Makefile.env
@@ -84,7 +84,8 @@ SRAPATH_OBJ = \
 
 SRAPATH_LIB += \
 	-lkapp \
-	-lncbi-vdb \
+	-sncbi-vdb \
 
 $(BINDIR)/srapath: $(SRAPATH_OBJ)
 	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(SRAPATH_LIB)
+
diff --git a/tools/srapath/srapath.c b/tools/srapath/srapath.c
index ba1e2d2..bf60b87 100644
--- a/tools/srapath/srapath.c
+++ b/tools/srapath/srapath.c
@@ -167,7 +167,7 @@ rc_t CC KMain ( int argc, char *argv [] )
                         else
                         {
                             const VPath * upath;
-                            rc = VFSManagerMakePath ( mgr, (VPath**)&upath, pc);
+                            rc = VFSManagerMakePath ( mgr, (VPath**)&upath, "%s", pc);
                             if (rc == 0)
                             {
                                 const VPath * local;
@@ -228,7 +228,7 @@ rc_t CC KMain ( int argc, char *argv [] )
                                     else {
                                         char resolved[PATH_MAX] = "";
                                         rc = KDirectoryResolvePath(cwd, true,
-                                            resolved, sizeof resolved, pc);
+                                                                   resolved, sizeof resolved, "%s", pc);
                                         if (rc == 0) {
                                             STSMSG(1, ("'%s': found in "
                                                 "the current directory at '%s'",
diff --git a/tools/srapath/srapath.vers b/tools/srapath/srapath.vers
index cc6c9a4..8e8299d 100644
--- a/tools/srapath/srapath.vers
+++ b/tools/srapath/srapath.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/srapath/srapath.vers.h b/tools/srapath/srapath.vers.h
new file mode 100644
index 0000000..6718499
--- /dev/null
+++ b/tools/srapath/srapath.vers.h
@@ -0,0 +1 @@
+#define SRAPATH_VERS 0x02040002
diff --git a/tools/update-schema/Makefile b/tools/update-schema/Makefile
new file mode 100644
index 0000000..31b480e
--- /dev/null
+++ b/tools/update-schema/Makefile
@@ -0,0 +1,102 @@
+# ==============================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: std
+
+TOP ?= $(abspath ../..)
+MODULE = tools/update-schema
+
+include $(TOP)/build/Makefile.env
+
+INT_TOOLS =
+
+EXT_TOOLS = \
+	vdb-update-schema
+
+ALL_TOOLS = \
+	$(INT_TOOLS) \
+	$(EXT_TOOLS)
+
+#------------------------------------------------------------------------------
+# outer targets
+#
+all std: vers-includes
+	@ $(MAKE_CMD) $(TARGDIR)/$@
+
+$(ALL_TOOLS): vers-includes
+	@ $(MAKE_CMD) $(BINDIR)/$@
+
+.PHONY: all std $(ALL_TOOLS)
+
+#-------------------------------------------------------------------------------
+# all
+#
+$(TARGDIR)/all: \
+	$(addprefix $(BINDIR)/,$(ALL_TOOLS))
+
+.PHONY: $(TARGDIR)/all
+
+#-------------------------------------------------------------------------------
+# std
+#
+$(TARGDIR)/std: \
+	$(addprefix $(BINDIR)/,$(EXT_TOOLS))
+
+.PHONY: $(TARGDIR)/std
+
+#-------------------------------------------------------------------------------
+# vers-includes
+#
+$(TARGDIR)/vers-includes: $(addsuffix .vers.h,$(EXT_TOOLS))
+
+.PHONY: $(TARGDIR)/vers-includes
+
+#-------------------------------------------------------------------------------
+# clean
+#
+clean: stdclean
+
+.PHONY: clean
+
+#-------------------------------------------------------------------------------
+# update-schema
+#
+UPDATE_SCHEMA_SRC = \
+	update-schema \
+
+UPDATE_SCHEMA_OBJ = \
+	$(addsuffix .$(OBJX),$(UPDATE_SCHEMA_SRC))
+
+UPDATE_SCHEMA_LIB = \
+	-lkapp \
+	-lncbi-wvdb \
+    
+update-schema.vers.h: update-schema.vers
+	$(TOP)/build/make-vers-inc.sh UPDATE_SCHEMA_VERS $^ > $@
+
+$(BINDIR)/vdb-update-schema: $(UPDATE_SCHEMA_OBJ)
+	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(UPDATE_SCHEMA_LIB)
+
+#-------------------------------------------------------------------------------
diff --git a/tools/update-schema/update-schema.c b/tools/update-schema/update-schema.c
new file mode 100644
index 0000000..962aef2
--- /dev/null
+++ b/tools/update-schema/update-schema.c
@@ -0,0 +1,452 @@
+/*==============================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "vdb-update-schema.vers.h"
+#include <kapp/main.h>
+#include <vdb/vdb-priv.h> /* VTableStoreSchema */
+#include <vdb/manager.h> /* VDBManager */
+#include <vdb/table.h>
+#include <vdb/schema.h> /* VSchema */
+#include <kdb/meta.h>
+#include <klib/out.h> /* OUTMSG */
+#include <klib/log.h> /* LOGERR */
+#include <klib/rc.h>
+#include <insdc/sra.h> /* SRA_PLATFORM_ ... */
+#include <assert.h>
+#include <string.h> /* memset */
+
+#define DISP_RC(rc, msg) (void)((rc == 0) ? 0 : LOGERR(klogInt, rc, msg))
+#define DISP_RC2(rc, name, msg) (void)((rc == 0) ? 0 : \
+    PLOGERR(klogInt, (klogInt,rc, "$(msg): $(name)","msg=%s,name=%s",msg,name)))
+#define DESTRUCT(type, obj) do { rc_t rc2 = type##Release(obj); \
+    if (rc2 && !rc) { rc = rc2; } obj = NULL; } while (false)
+
+typedef struct CmdArgs {
+    const char* run;
+    const char* schema;
+    const char* sPlatform;
+    uint8_t platform;
+    Args* args;
+    uint32_t count;
+    uint32_t i;
+} CmdArgs;
+typedef struct Db {
+    VDBManager* mgr;
+    VSchema* schema;
+    VTable* tbl;
+    KMetadata* meta;
+    bool frozen;
+    bool updatedPlatf;
+    bool deletedSchema;
+} Db;
+ver_t CC KAppVersion(void) { return VDB_UPDATE_SCHEMA_VERS; }
+#define OPTION_PLATF "platform"
+#define ALIAS_PLATF  "p"
+static const char* platf_usage[] = { "Platform: LS454 | ILLUMINA | HELICOS",
+    " | ABI_SOLID | COMPLETE_GENOMICS", " | PACBIO_SMRT | ION_TORRENT", NULL };
+#define OPTION_SCHEMA "schema"
+#define ALIAS_SCHEMA  "s"
+static const char* schema_usage[] = { "Schema", NULL };
+#define OPTION_RUN   "out"
+#define ALIAS_RUN    "o"
+static const char* run_usage   [] = { "Run", NULL };
+OptDef Options[] =  {
+      { OPTION_RUN   , ALIAS_RUN   , NULL, run_usage   , 1, true , true }
+    , { OPTION_SCHEMA, ALIAS_SCHEMA, NULL, schema_usage, 1, true , true }
+    , { OPTION_PLATF , ALIAS_PLATF , NULL, platf_usage , 1, true , true }
+};
+
+rc_t CC UsageSummary (const char * progname)
+{    
+    OUTMSG (("\n"
+             "Usage:\n"
+             "  %s -o <run> [ -s <schema-table-or-db-spec>\n"
+             "      [ -p <platform-name> ] ] <schema-file> ...\n"
+             "\n"
+             "Summary:\n"
+             "  Update table schema\n"
+             "\n", progname));
+    return 0;
+}
+
+const char UsageDefaultName[] = "check-blob-size";
+#define def_name UsageDefaultName
+
+rc_t CC Usage(const Args* args)
+{
+    rc_t rc = 0;
+    const char* progname = def_name;
+    const char* fullpath = def_name;
+    assert(args);
+    rc = ArgsProgram(args, &fullpath, &progname);
+    if (rc)
+    {    progname = fullpath = def_name; }
+    UsageSummary(progname);
+    OUTMSG(("\nOptions\n"));
+    HelpOptionLine(ALIAS_RUN, OPTION_RUN   , "run"              , run_usage);
+    HelpOptionLine
+               (ALIAS_SCHEMA, OPTION_SCHEMA, "schema-table-spec", schema_usage);
+    HelpOptionLine(ALIAS_PLATF, OPTION_PLATF, "platform-name"   , platf_usage);
+    HelpOptionsStandard();
+    HelpVersion(fullpath, KAppVersion());
+    return rc;
+}
+
+/* MINIUSAGE(def_name) */
+static rc_t CmdArgsInit(int argc, char** argv, CmdArgs* cmdArgs)
+{
+    rc_t rc = 0;
+    Args* args = NULL;
+    assert(argv && cmdArgs);
+
+    memset(cmdArgs, 0, sizeof *cmdArgs);
+
+    rc = ArgsMakeAndHandle(&cmdArgs->args,
+        argc, argv, 1, Options, sizeof Options / sizeof Options[0]);
+    DISP_RC(rc, "while calling ArgsMakeAndHandle");
+    args = cmdArgs->args;
+
+    while (rc == 0) {
+        uint32_t pcount = 0;
+
+        /* run parameter */
+        rc = ArgsOptionCount(args, OPTION_RUN, &pcount);
+        if (rc) {
+            LOGERR(klogErr, rc, "Failure parsing run name");
+            break;
+        }
+        if (pcount < 1) {
+            rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcInsufficient);
+            LOGERR(klogErr, rc, "Missing run parameter");
+            break;
+        }
+        if (pcount > 1) {
+            rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcAmbiguous);
+            LOGERR(klogErr, rc, "Too many run parameters");
+            break;
+        }
+        rc = ArgsOptionValue (args, OPTION_RUN, 0, &cmdArgs->run);
+        if (rc) {
+            LOGERR(klogErr, rc, "Failure retrieving run name");
+            break;
+        }
+
+        /* platform parameter */
+        rc = ArgsOptionCount(args, OPTION_PLATF, &pcount);
+        if (rc) {
+            LOGERR(klogErr, rc, "Failure parsing platform");
+            break;
+        }
+        if (pcount > 1) {
+            rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcAmbiguous);
+            LOGERR(klogErr, rc, "Too many platform parameters");
+            break;
+        }
+        assert(SRA_PLATFORM_UNDEFINED == 0);
+        if (pcount == 1) {
+            uint8_t p = SRA_PLATFORM_UNDEFINED;
+            const char* arg = NULL;
+            rc = ArgsOptionValue(args, OPTION_PLATF, 0, &arg);
+            if (rc) {
+                LOGERR(klogErr, rc, "Failure retrieving platform");
+                break;
+            }
+            if      (!strcmp(arg, "454"))
+            {   p = SRA_PLATFORM_454; }
+            else if (!strcmp(arg, "LS454"))
+            {   p = SRA_PLATFORM_454; }
+            else if (!strcmp(arg, "ILLUMINA"))
+            {   p = SRA_PLATFORM_ILLUMINA; }
+            else if (!strcmp(arg, "HELICOS"))
+            {   p = SRA_PLATFORM_HELICOS; }
+            else if (!strcmp(arg, "ABI_SOLID"))
+            {   p = SRA_PLATFORM_ABSOLID; }
+            else if (!strcmp(arg, "COMPLETE_GENOMICS"))
+            {   p = SRA_PLATFORM_COMPLETE_GENOMICS; }
+            else if (!strcmp(arg, "PACBIO_SMRT"))
+            {   p = SRA_PLATFORM_PACBIO_SMRT; }
+            else if (!strcmp(arg, "ION_TORRENT"))
+            {   p = SRA_PLATFORM_ION_TORRENT; }
+            else {
+                rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcInvalid);
+                PLOGERR(klogInt, (klogInt, rc, "Invalid platform: $(name)",
+                    "name=%s", arg));
+                break;
+            }
+            cmdArgs->platform = p;
+            cmdArgs->sPlatform = arg;
+        }
+
+        /* schema parameter */
+        rc = ArgsOptionCount(args, OPTION_SCHEMA, &pcount);
+        if (rc) {
+            LOGERR(klogErr, rc, "Failure parsing schema");
+            break;
+        }
+        if (pcount > 1) {
+            rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcAmbiguous);
+            LOGERR(klogErr, rc, "Too many schema parameters");
+            break;
+        }
+        else if (pcount == 1) {
+            rc = ArgsOptionValue(args, OPTION_SCHEMA, 0, &cmdArgs->schema);
+            if (rc) {
+                LOGERR(klogErr, rc, "Failure retrieving schema");
+                break;
+            }
+        }
+        else if (/* pcount < 0 && */ cmdArgs->platform) {
+            rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcInsufficient);
+            LOGERR
+                (klogErr, rc, "Schema is required when platform is specified");
+        }
+
+        break;
+    }
+
+    if (rc == 0) {
+        do {
+            rc = ArgsParamCount(args, &cmdArgs->count);
+            if (rc) {
+                DISP_RC(rc, "while calling ArgsParamCount");
+                break;
+            }
+            if (cmdArgs->count < 1) {
+                rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcInsufficient);
+                LOGERR(klogErr, rc, "Missing schema parameter");
+                break;
+            }
+        } while (false);
+    }
+
+    if (rc != 0)
+    {   MiniUsage(cmdArgs->args); }
+
+    return rc;
+}
+
+static rc_t CmdArgsGetNextParam(CmdArgs* args, const char** param)
+{
+    rc_t rc = 0;
+    assert(args && param);
+    *param = NULL;
+    if (args->i >= args->count) /* no more parameters to give :( */
+    {   return rc; }
+    rc = ArgsParamValue(args->args, args->i, param);
+    if (rc) {
+        PLOGERR(klogInt, (klogInt, rc,
+            "while calling ArgsParamValue($(i))", "i=%d", args->i));
+    }
+    ++args->i;
+    return rc;
+}
+
+static rc_t DbConstruct(Db* db, CmdArgs* args) {
+    rc_t rc = 0;
+    assert(db && args);
+    memset(db, 0, sizeof *db);
+    if (rc == 0) {
+        rc = VDBManagerMakeUpdate(&db->mgr, NULL);
+        DISP_RC(rc, "While calling VDBManagerMakeUpdate");
+    }
+    if (rc == 0) {
+        rc = VDBManagerMakeSchema(db->mgr, &db->schema);
+        DISP_RC(rc, "While calling VDBManagerMakeSchema");
+    }
+    while (rc == 0) {
+        const char* param = NULL;
+        rc = CmdArgsGetNextParam(args, &param);
+        if (param == NULL)
+        {   break; }
+        rc = VSchemaParseFile(db->schema, "%s", param);
+        DISP_RC2(rc, param, "While calling VSchemaParseFile");
+    }
+    if (rc == 0) {
+        rc =
+            VDBManagerOpenTableUpdate(db->mgr, &db->tbl, db->schema, args->run);
+        DISP_RC2(rc, args->run, "While calling VDBManagerOpenTableUpdate");
+    }
+    if (rc == 0) {
+        rc = VTableOpenMetadataUpdate(db->tbl, &db->meta);
+        DISP_RC(rc, "While calling VTableOpenMetadataUpdate");
+    }
+    return rc;
+}
+
+static rc_t DbBeginTran(Db* self)
+{
+    rc_t rc = 0;
+    assert(self);
+    if (rc == 0) {
+        rc = KMetadataFreeze(self->meta);
+        DISP_RC(rc, "While calling KMetadataFreeze");
+        if (rc == 0)
+        {   self->frozen = true; }
+    }
+    return rc;
+}
+
+static rc_t DbUpdatePlatform(Db* self, const CmdArgs* args)
+{
+    rc_t rc = 0;
+    bool toUpdate = false;
+    const char path[] = "col/PLATFORM/row";
+    const KMDataNode* rNode = NULL;
+    KMDataNode* uNode = NULL;
+    assert(self && args);
+    if (rc == 0) {
+        rc = KMetadataOpenNodeRead(self->meta, &rNode, "%s", path);
+        DISP_RC2(rc, path, "While calling KMetadataOpenNodeRead");
+    }
+    if (rc == 0) {
+        uint8_t p = SRA_PLATFORM_UNDEFINED;
+        rc = KMDataNodeReadB8(rNode, &p);
+        DISP_RC2(rc, path, "While reading KMetaNode");
+        if (rc == 0 && p == args->platform) {
+            PLOGMSG(klogWarn, (klogWarn,
+                "PLATFORM is set already to $(PLATFORM)",
+                "PLATFORM=%s", args->sPlatform));
+        }
+        else { toUpdate = true; }
+    }
+    DESTRUCT(KMDataNode, rNode);
+    if (toUpdate) {
+        if (rc == 0) {
+            rc = KMetadataOpenNodeUpdate(self->meta, &uNode, "%s", path);
+            DISP_RC2(rc, path, "While calling KMetadataOpenNodeUpdate");
+        }
+        if (rc == 0) {
+            rc = KMDataNodeWriteB8(uNode, &args->platform);
+            DISP_RC2(rc, path, "While writing KMetaNode");
+            if (rc == 0)
+            {   self->updatedPlatf = true; }
+        }
+    }
+    DESTRUCT(KMDataNode, uNode);
+    return rc;
+}
+
+static rc_t DbDeleteSchema(Db* self)
+{
+    rc_t rc = 0;
+    KMDataNode* uNode = NULL;
+    const char path[] = "schema";
+    assert(self);
+    if (rc == 0) {
+        rc = KMetadataOpenNodeUpdate(self->meta, &uNode, "%s", path);
+        DISP_RC2(rc, path, "While calling KMetadataOpenNodeUpdate");
+    }
+    if (rc == 0) {
+        rc = KMDataNodeDropAll(uNode);
+        DISP_RC2(rc, path, "While calling KMDataNodeDropAll");
+        if (rc == 0)
+        {   self->deletedSchema = true; }
+    }
+    DESTRUCT(KMDataNode, uNode);
+    return rc;
+}
+
+static rc_t DbCloseTbl(Db* self)
+{
+    rc_t rc = 0;
+    assert(self);
+    DESTRUCT(KMetadata, self->meta);
+    DESTRUCT(VTable, self->tbl);
+    return rc;
+}
+
+static rc_t DbDestruct(Db* self) {
+    rc_t rc = 0;
+    assert(self);
+    DESTRUCT(KMetadata, self->meta);
+    DESTRUCT(VTable, self->tbl);
+    DESTRUCT(VSchema, self->schema);
+    DESTRUCT(VDBManager, self->mgr);
+    return rc;
+}
+
+static rc_t DbStoreSchema(Db* self, const CmdArgs* args)
+{
+    rc_t rc = 0;
+    bool metaUpdated = false;
+    assert(self && args);
+    if (self->updatedPlatf || self->deletedSchema)
+    {   metaUpdated = true; }
+    if (metaUpdated) {
+        if (rc == 0) {
+            rc = DbCloseTbl(self);
+            DISP_RC(rc, "While calling VTableRelease");
+        }
+        if (rc == 0) {
+            rc = VDBManagerCreateTable(self->mgr,
+                                       &self->tbl, self->schema, args->schema, kcmOpen, "%s", args->run);
+            DISP_RC2(rc, args->run, "While calling VDBManagerCreateTable");
+        }
+    }
+    else {
+        rc = VTableStoreSchema(self->tbl);
+        DISP_RC(rc, "While calling VTableStoreSchema");
+    }
+    return rc;
+}
+
+static rc_t DbRollbackTran(Db* self)
+{
+    rc_t rc = 0;
+    assert(self);
+    return rc;
+}
+
+rc_t CC KMain(int argc, char* argv[])
+{
+    rc_t rc = 0;
+    CmdArgs args;
+    Db db;
+    memset(&db, 0, sizeof db);
+    if (rc == 0)
+    {   rc = CmdArgsInit(argc, argv, &args); }
+    if (rc == 0)
+    {   rc = DbConstruct(&db, &args); }
+    if (rc == 0) {
+        rc = DbBeginTran(&db);
+        if (rc == 0 && args.platform)
+        {   rc = DbUpdatePlatform(&db, &args); }
+        if (rc == 0 && args.schema)
+        {   rc = DbDeleteSchema(&db); }
+        if (rc == 0)
+        {   rc = DbStoreSchema(&db, &args); }
+        if (rc != 0)
+        {   DbRollbackTran(&db); }
+    }
+    {
+        rc_t rc2 = DbDestruct(&db);
+        if (rc2 != 0 && rc == 0)
+        {   rc = rc2; }
+    }
+    return rc;
+}
+
+/* EOF */
diff --git a/tools/update-schema/vdb-update-schema.vers b/tools/update-schema/vdb-update-schema.vers
new file mode 100644
index 0000000..8e8299d
--- /dev/null
+++ b/tools/update-schema/vdb-update-schema.vers
@@ -0,0 +1 @@
+2.4.2
diff --git a/tools/util/Makefile b/tools/util/Makefile
index 3a44760..24f7f90 100644
--- a/tools/util/Makefile
+++ b/tools/util/Makefile
@@ -25,18 +25,26 @@
 
 default: std
 
-TOP ?= $(shell ../../build/abspath.sh ../..)
+TOP ?= $(abspath ../..)
 MODULE = tools/util
 
 include $(TOP)/build/Makefile.env
 
 INT_TOOLS = \
+	testld \
+	txt2kdb \
+	rowwritetest \
+	sortreadtest \
+	pacbio-correct \
+	crc32sum \
 
 EXT_TOOLS = \
 	rcexplain \
 	kdbmeta \
+	md5cp \
 	vdb-lock \
 	vdb-unlock \
+	schema-replace \
 	test-sra \
 	vdb-passwd
 
@@ -96,7 +104,7 @@ RCEXPLAIN_OBJ = \
 
 RCEXPLAIN_LIB = \
 	-skapp \
-	-lncbi-vdb \
+	-sncbi-vdb \
 
 $(BINDIR)/rcexplain: $(RCEXPLAIN_OBJ)
 	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(RCEXPLAIN_LIB)
@@ -113,8 +121,7 @@ KDBMETA_OBJ = \
 
 KDBMETA_LIB = \
 	-skapp \
-	-lncbi-wvdb \
-	-lxml2 \
+	-sncbi-wvdb \
 	-lm
 
 $(BINDIR)/kdbmeta: $(KDBMETA_OBJ)
@@ -133,8 +140,7 @@ VDB_LOCK_OBJ = \
 
 VDB_LOCK_LIB = \
 	-skapp \
-	-lncbi-wvdb \
-	-lxml2 \
+	-sncbi-wvdb \
 	-lm
 
 $(BINDIR)/vdb-lock: $(VDB_LOCK_OBJ)
@@ -153,13 +159,31 @@ VDB_UNLOCK_OBJ = \
 
 VDB_UNLOCK_LIB = \
 	-skapp \
-	-lncbi-wvdb \
-	-lxml2 \
+	-sncbi-wvdb \
 	-lm
 
 $(BINDIR)/vdb-unlock: $(VDB_UNLOCK_OBJ)
 	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(VDB_UNLOCK_LIB)
 
+
+#-------------------------------------------------------------------------------
+# testld - test dynamic load of libraries
+#
+TESTLD_SRC = \
+	testld
+
+TESTLD_OBJ = \
+	$(addsuffix .$(OBJX),$(TESTLD_SRC))
+
+TESTLD_LIB = \
+	-skapp \
+	-sncbi-vdb \
+
+
+$(BINDIR)/testld: $(TESTLD_OBJ)
+	$(LD) --exe -o $@ $^ $(TESTLD_LIB)
+
+
 #-------------------------------------------------------------------------------
 # test-sra: print config, resolve sra, check dependencies
 #
@@ -173,13 +197,102 @@ T_OBJ = \
 
 T_LIB = \
 	-lkapp \
-	-lncbi-vdb \
-	-lxml2 \
+	-sncbi-vdb \
 	-lm
 
 $(BINDIR)/test-sra: $(T_OBJ)
 	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(T_LIB)
 
+#-------------------------------------------------------------------------------
+# txt2kdb - test dynamic load of libraries
+#
+TXT2KDB_SRC = \
+	txt2kdb
+
+TXT2KDB_OBJ = \
+	$(addsuffix .$(OBJX),$(TXT2KDB_SRC))
+
+TXT2KDB_LIB = \
+	-skapp \
+	-sncbi-wvdb \
+
+
+$(BINDIR)/txt2kdb: $(TXT2KDB_OBJ)
+	$(LD) --exe -o $@ $^ $(TXT2KDB_LIB)
+
+#----------------------------------------------------------------
+# md5cp
+#
+MD5CP_SRC = \
+	md5cp
+
+MD5CP_OBJ = \
+	$(addsuffix .$(OBJX),$(MD5CP_SRC))
+
+MD5CP_LIB = \
+	-skapp \
+	-sncbi-vdb \
+
+
+$(BINDIR)/md5cp: $(MD5CP_OBJ)
+	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(MD5CP_LIB)
+
+
+#----------------------------------------------------------------
+# rowwritetest
+#
+ROWWRITETEST_SRC = \
+	rowwritetest
+
+ROWWRITETEST_OBJ = \
+	$(addsuffix .$(OBJX),$(ROWWRITETEST_SRC))
+
+ROWWRITETEST_LIB = \
+	-skapp \
+	-sncbi-wvdb \
+
+
+$(BINDIR)/rowwritetest: $(ROWWRITETEST_OBJ)
+	$(LD) --exe -o $@ $^ $(ROWWRITETEST_LIB)
+
+
+#-------------------------------------------------------------------------------
+# crc32sum 
+#  behaves a lot like md5sum
+#
+CRC32SUM_SRC = \
+	crc32sum
+
+CRC32SUM_OBJ = \
+	$(addsuffix .$(OBJX),$(CRC32SUM_SRC))
+
+CRC32SUM_LIB = \
+	-lkapp \
+	-sncbi-vdb \
+
+
+$(BINDIR)/crc32sum: $(CRC32SUM_OBJ)
+	$(LD) --exe -o $@ $^ $(CRC32SUM_LIB)
+
+
+#----------------------------------------------------------------
+# sortreadtest
+#
+SORTREADTEST_SRC = \
+	sortreadtest
+
+SORTREADTEST_OBJ = \
+	$(addsuffix .$(OBJX),$(SORTREADTEST_SRC))
+
+SORTREADTEST_LIB = \
+	-skapp \
+	-sncbi-wvdb \
+
+
+$(BINDIR)/sortreadtest: $(SORTREADTEST_OBJ)
+	$(LD) --exe -o $@ $^ $(SORTREADTEST_LIB)
+
+
 #----------------------------------------------------------------
 # vdb-passwd
 #
@@ -192,8 +305,43 @@ VDB_PASSWD_OBJ = \
 
 VDB_PASSWD_LIB = \
 	-skapp \
-	-lncbi-vdb \
+	-sncbi-vdb \
 
 
 $(BINDIR)/vdb-passwd: $(VDB_PASSWD_OBJ)
 	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(VDB_PASSWD_LIB)
+
+
+#----------------------------------------------------------------
+# schema-replace
+#
+SCHEMA_REPLACE_SRC = \
+	schema-replace
+
+SCHEMA_REPLACE_OBJ = \
+	$(addsuffix .$(OBJX),$(SCHEMA_REPLACE_SRC))
+
+SCHEMA_REPLACE_LIB = \
+	-lkapp \
+	-sncbi-wvdb \
+	-lm
+
+$(BINDIR)/schema-replace: $(SCHEMA_REPLACE_OBJ)
+	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(SCHEMA_REPLACE_LIB)
+
+#-------------------------------------------------------------------------------
+# pacbio-correct-tool
+#
+PACBIO_CORRECT_SRC = \
+	pacbio-correct
+
+PACBIO_CORRECT_OBJ = \
+	$(addsuffix .$(OBJX),$(PACBIO_CORRECT_SRC))
+
+PACBIO_CORRECT_LIB = \
+	-lkapp \
+	-sncbi-wvdb \
+
+
+$(BINDIR)/pacbio-correct: $(PACBIO_CORRECT_OBJ)
+	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(PACBIO_CORRECT_LIB)
diff --git a/tools/util/crc32sum.c b/tools/util/crc32sum.c
new file mode 100644
index 0000000..887a177
--- /dev/null
+++ b/tools/util/crc32sum.c
@@ -0,0 +1,279 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <kapp/args.h>
+#include <klib/checksum.h>
+#include <klib/status.h>
+#include <klib/out.h>
+#include <klib/rc.h>
+#include <kapp/main.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <ctype.h>
+#include <assert.h>
+
+static
+int crc32sum_calc ( FILE *in, uint32_t *crc32 )
+{
+    int status;
+    char *buff = malloc ( 32 * 1024 );
+    if ( buff == NULL )
+        return errno;
+
+    for ( status = 0, * crc32 = 0;; )
+    {
+        size_t num_read = fread ( buff, 1, 32 * 1024, in );
+        if ( num_read == 0 )
+        {
+            if ( ! feof ( in ) )
+                status = ferror ( in );
+            break;
+        }
+
+        * crc32 = CRC32 ( * crc32, buff, num_read );
+    }
+
+    free ( buff );
+
+    return status;
+}
+
+static
+int crc32sum_check ( FILE *in, const char *fname )
+{
+    int cnt, mismatches;
+    char line [ 5 * 1024 ];
+    for ( cnt = mismatches = 0; fgets ( line, sizeof line, in ) != NULL; ++ cnt )
+    {
+        char *p;
+        FILE *src;
+        int status, bin = 0;
+        uint32_t prior, crc32;
+
+        if ( line [ 0 ] == 0 )
+        {
+            -- cnt;
+            continue;
+        }
+
+        p = strrchr ( line, '\n' );
+        if ( p != 0 )
+            * p = 0;
+
+        prior = strtoul ( line, & p, 16 );
+        if ( ( p - line ) != 8 || p [ 0 ] != ' ' )
+        {
+            fprintf ( stderr, "badly formatted file '%s'\n", fname );
+            return EINVAL;
+        }
+
+        if ( p [ 1 ] == '*' )
+            bin = 1;
+        else if ( p [ 1 ] != ' ' )
+        {
+            fprintf ( stderr, "badly formatted file '%s'\n", fname );
+            return EINVAL;
+        }
+ 
+        src = fopen ( p += 2, bin ? "rb" : "r" );
+        if ( src == NULL )
+        {
+            status = errno;
+            fprintf ( stderr, "failed to open file '%s': %s\n", p, strerror ( status ) );
+            return status;
+        }
+
+        status = crc32sum_calc ( src, & crc32 );
+
+        fclose ( src );
+
+        if ( status != 0 )
+            fprintf ( stderr, "error processing file '%s': %s\n", p, strerror ( status ) );
+        else
+        {
+            printf ( "%s: %s\n", p, ( crc32 == prior ) ? "OK" : "FAILED" );
+            if ( crc32 != prior )
+                ++ mismatches;
+        }
+    }
+
+    if ( mismatches != 0 )
+        fprintf ( stderr, "WARNING: %d of %d computed checksums did NOT match\n", mismatches, cnt );
+
+    if ( ! feof ( in ) )
+        return ferror ( in );
+    return 0;
+}
+
+static
+int crc32sum_gen ( FILE *in, const char *fname, int bin )
+{
+    uint32_t crc32;
+    int status = crc32sum_calc ( in, & crc32 );
+    if ( status != 0 )
+        fprintf ( stderr, "error processing file '%s': %s\n", fname, strerror ( status ) );
+    else
+        printf ( "%08x %c%s\n", crc32, bin ? '*' : ' ', fname );
+    return status;
+}
+
+
+#define OPTION_BINARY "binary"
+#define OPTION_CHECK  "check"
+#define ALIAS_BINARY  "b"
+#define ALIAS_CHECK   "c"
+
+static const char * binary_usage[] = { "open file in binary mode", NULL };
+static const char * check_usage[]  = { "check CRC32 against given list", NULL };
+
+OptDef Options[] =
+{
+    { OPTION_BINARY, ALIAS_BINARY, NULL, binary_usage, 0, false, false },
+    { OPTION_CHECK,  ALIAS_CHECK,  NULL, check_usage,  0, false, false }
+};
+
+
+
+const char UsageDefaultName[] = "crc32sum";
+
+rc_t CC UsageSummary (const char * progname)
+{
+    return KOutMsg("\n"
+                   "Usage:\n"
+                   "  %s [Options] File [File ...]\n"
+                   "\n"
+                   "Summary:\n"
+                   "  Generate or test crc32 file checks\n"
+                   "\n", progname);
+}
+
+
+rc_t CC Usage ( const Args * args )
+{
+    const char * progname = UsageDefaultName;
+    const char * fullpath = UsageDefaultName;
+    rc_t rc;
+
+    if (args == NULL)
+        rc = RC (rcApp, rcArgv, rcAccessing, rcSelf, rcNull);
+    else
+        rc = ArgsProgram (args, &fullpath, &progname);
+
+    UsageSummary (progname);
+
+    KOutMsg ("Options\n");
+
+    HelpOptionLine (ALIAS_BINARY, OPTION_BINARY, NULL, binary_usage);
+
+    HelpOptionLine (ALIAS_CHECK, OPTION_CHECK, NULL, check_usage);
+
+    HelpOptionsStandard ();
+
+    HelpVersion (fullpath, KAppVersion());
+
+    return rc;
+}
+
+
+ver_t CC KAppVersion ( void )
+{
+    return 0;
+}
+
+
+rc_t CC KMain (int argc, char * argv [])
+{
+    Args *args;
+    rc_t rc;
+
+    rc = ArgsMakeAndHandle (&args, argc, argv, 1,
+                            Options, sizeof (Options) / sizeof (OptDef));
+    if (rc == 0)
+    {
+        do
+        {
+            uint32_t pcount;
+            int check;
+            int bin;
+
+            rc = ArgsOptionCount (args, OPTION_BINARY, &pcount);
+            if (rc) break;
+
+            bin = (pcount != 0);
+
+            rc = ArgsOptionCount (args, OPTION_CHECK, &pcount);
+            if (rc) break;
+
+            check = (pcount != 0);
+
+            rc = ArgsParamCount (args, &pcount);
+            if (rc) break;
+
+            if (pcount == 0)
+            {
+                MiniUsage(args);
+            }
+            else
+            {
+                uint32_t i;
+
+                CRC32Init ();
+           
+                for ( i = 0; i < pcount; ++ i )
+                {
+
+                    int status;
+                    const char *fname;
+                    FILE *in;
+
+                    rc = ArgsParamValue (args, i, &fname);
+
+                    in = fopen ( fname, bin ? "rb" : "r" );
+
+                    if ( in == NULL )
+                    {
+                        fprintf ( stderr, "failed to open file '%s'\n", fname );
+                        return -1;
+                    }
+
+                    status = check ?
+                        crc32sum_check ( in, fname ):
+                        crc32sum_gen ( in, fname, bin );
+
+                    fclose ( in );
+
+                    if ( status != 0 )
+                        return status;
+                }
+            }
+        } while (0);
+    }
+
+    return 0;
+}
diff --git a/tools/util/kdbmeta.c b/tools/util/kdbmeta.c
index da99020..f403042 100644
--- a/tools/util/kdbmeta.c
+++ b/tools/util/kdbmeta.c
@@ -285,10 +285,10 @@ void value_select ( const char *value, size_t vlen, uint32_t num_children, bool
         /* text */
         else
         {
-            int tab_stop;
+            /* int tab_stop; */
 
             OUTMSG (( "'" ));
-            for ( tab_stop = 0, i = 0; i < vlen; ++ i )
+            for ( /* tab_stop = 0, */ i = 0; i < vlen; ++ i )
             {
                 switch ( value [ i ] )
                 {
@@ -302,7 +302,7 @@ void value_select ( const char *value, size_t vlen, uint32_t num_children, bool
                     indent ();
                     if ( i + 1 < vlen )
                         OUTMSG (( " " ));
-                    tab_stop = 0;
+                    /* tab_stop = 0; */
                     break;
                 default:
                     value_print(value[i]);
@@ -508,7 +508,7 @@ rc_t md_select_expr ( const KMDataNode *node, char *path, size_t psize, int plen
             else
             {
                 const KMDataNode *child;
-                rc = KMDataNodeOpenNodeRead ( node, & child, name );
+                rc = KMDataNodeOpenNodeRead ( node, & child, "%s", name );
                 if ( rc != 0 )
                 {
                     KNamelistRelease ( children );
@@ -683,7 +683,7 @@ bool CC md_select ( void *item, void *data )
                 return true;
             }
 
-            pb -> rc = KMDataNodeOpenNodeUpdate ( root, & node, path );
+            pb -> rc = KMDataNodeOpenNodeUpdate ( root, & node, "%s", path );
             KMDataNodeRelease ( root );
 
             if ( pb -> rc != 0 )
@@ -705,7 +705,7 @@ bool CC md_select ( void *item, void *data )
         else
         {
             const KMDataNode *root = node;
-            pb -> rc = KMDataNodeOpenNodeRead ( root, ( const KMDataNode** ) & node, path );
+            pb -> rc = KMDataNodeOpenNodeRead ( root, ( const KMDataNode** ) & node, "%s", path );
             KMDataNodeRelease ( root );
 
             if ( pb -> rc != 0 )
@@ -741,13 +741,13 @@ rc_t col_select ( KDBMetaParms * pb)
     if ( ! read_only_arg ) {
         read_only = false;
 
-        rc = KDBManagerOpenColumnUpdate ( pb -> mgr, & col, pb->targ );
+        rc = KDBManagerOpenColumnUpdate ( pb -> mgr, & col, "%s", pb->targ );
         if ( rc != 0 )
             read_only = true;
     }
 #endif
     if ( read_only )
-        rc = KDBManagerOpenColumnRead ( pb -> mgr, ( const KColumn** ) & col, pb->targ );
+        rc = KDBManagerOpenColumnRead ( pb -> mgr, ( const KColumn** ) & col, "%s", pb->targ );
     if ( rc != 0 )
         PLOGERR ( klogErr,  (klogErr, rc, "failed to open column '$(col)'", "col=%s", pb->targ ));
     else
@@ -793,13 +793,13 @@ rc_t tbl_select ( KDBMetaParms * pb)
     if ( ! read_only_arg ) {
         read_only = false;
 
-        rc = KDBManagerOpenTableUpdate ( pb -> mgr, & tbl, pb->targ );
+        rc = KDBManagerOpenTableUpdate ( pb -> mgr, & tbl, "%s", pb->targ );
         if ( rc != 0 )
             read_only = true;
     }
 #endif
     if ( read_only )
-        rc = KDBManagerOpenTableRead ( pb -> mgr, ( const KTable** ) & tbl, pb->targ );
+        rc = KDBManagerOpenTableRead ( pb -> mgr, ( const KTable** ) & tbl, "%s", pb->targ );
     if ( rc != 0 )
         PLOGERR ( klogErr,  (klogErr, rc, "failed to open table '$(tbl)'", "tbl=%s", pb->targ ));
     else
@@ -846,13 +846,13 @@ rc_t db_select (KDBMetaParms * pb)
     if ( ! read_only_arg ) {
         read_only = false;
 
-        rc = KDBManagerOpenDBUpdate ( pb -> mgr, & db, pb->targ );
+        rc = KDBManagerOpenDBUpdate ( pb -> mgr, & db, "%s", pb->targ );
         if ( rc != 0 )
             read_only = true;
     }
 #endif
     if ( read_only )
-        rc = KDBManagerOpenDBRead ( pb -> mgr, ( const KDatabase** ) & db, pb->targ );
+        rc = KDBManagerOpenDBRead ( pb -> mgr, ( const KDatabase** ) & db, "%s", pb->targ );
     if ( rc != 0 ) {
         PLOGERR ( klogErr,  (klogErr, rc, "failed to open db '$(db)'",
             "db=%s", pb->targ ));
@@ -864,13 +864,13 @@ rc_t db_select (KDBMetaParms * pb)
 #if ALLOW_UPDATE
             if ( ! read_only_arg ) {
                 read_only = false;
-                rc = KDatabaseOpenTableUpdate ( db, &tbl, table_arg );
+                rc = KDatabaseOpenTableUpdate ( db, &tbl, "%s", table_arg );
                 if ( rc != 0 )
                     read_only = true;
             }
 #endif
             if ( read_only )
-                rc = KDatabaseOpenTableRead ( db, ( const KTable** ) &tbl, table_arg );
+                rc = KDatabaseOpenTableRead ( db, ( const KTable** ) &tbl, "%s", table_arg );
             if ( rc != 0 ) {
                 PLOGERR ( klogErr,  (klogErr, rc,
                     "failed to open table '$(table)'", "table=%s", table_arg ));
@@ -1225,11 +1225,9 @@ rc_t CC KMain ( int argc, char *argv [] )
 
                         found = false;
 
-#if ! WINDOWS /* TOOLS_USE_SRAPATH != 0 */
-/* done? warning fix kdbmanagerVPathType to understand accessions */
                         {
                             const VFSManager * vfs;
-                            rc = KDBManagerGetVFSManager ( mgr, & vfs );
+                            rc = KDBManagerGetVFSManager ( mgr, ( VFSManager ** )&vfs );
                             if ( rc == 0 )
                             {
                                 VResolver * resolver;
@@ -1267,16 +1265,15 @@ rc_t CC KMain ( int argc, char *argv [] )
 
                         if ( ! found)
                         {
-                            rc = KDirectoryVResolvePath (curwd, true, objpath,
-                                                         sizeof objpath, pc, NULL);
+                            rc = KDirectoryResolvePath (curwd, true, objpath,
+                                                        sizeof objpath, "%s", pc);
 
                             if (rc)
-                                LOGERR (klogFatal, rc, "Unable to resolved target path");
+                                LOGERR (klogFatal, rc,
+                                    "Unable to resolved target path");
                         }
-#endif
-
 
-                        type = KDBManagerVPathType (mgr, objpath, NULL);
+                        type = KDBManagerPathType (mgr, "%s", objpath);
                             
                         switch (type)
                         {
diff --git a/tools/util/kdbmeta.vers b/tools/util/kdbmeta.vers
index cc6c9a4..8e8299d 100644
--- a/tools/util/kdbmeta.vers
+++ b/tools/util/kdbmeta.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/util/kdbmeta.vers.h b/tools/util/kdbmeta.vers.h
new file mode 100644
index 0000000..c16defb
--- /dev/null
+++ b/tools/util/kdbmeta.vers.h
@@ -0,0 +1 @@
+#define KDBMETA_VERS 0x02040002
diff --git a/tools/util/md5cp.c b/tools/util/md5cp.c
new file mode 100644
index 0000000..a0ccb25
--- /dev/null
+++ b/tools/util/md5cp.c
@@ -0,0 +1,714 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "md5cp.vers.h"
+#include <kapp/main.h>
+#include <kapp/args.h>
+#include <klib/log.h>
+#include <klib/out.h>
+#include <klib/status.h>
+#include <klib/rc.h>
+
+#include <klib/vector.h>
+#include <klib/impl.h>
+#include <kfs/directory.h>
+#include <kfs/file.h>
+#include <kfs/md5.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#define MD5EXTENSION "md5"
+#define DEFAULTMODE 0664
+#define DEFAULT_DIR_MODE 0775
+
+/*
+Trying to mimic cp behavior, with a few differences, 
+mainly, that if -f not specified and target exists,
+we do not clobber files, but instead print something about it on the
+output.
+
+cp -r dir1 dir2 makes dir2/dir1
+cp -r dir1 <nonexistent-name> just "renames" directory dir1 to name
+-r not specified and dir copied from, ignores that directory.
+
+If multiple things are specified (more than 2)
+then the last one should exist and be a directory.
+
+-i should still be available, to ask what to do about things that would be clobbered.
+
+Need to think what to do when inputs are relative and absolute
+
+This needs to work with backslashes as well (i.e. independent of
+target platform).
+
+Need to worry about copying from a directory to itself
+Definitely don't want to copy a file from itself to itself
+
+Need also to worry about loops in references (when walking trees)
+
+What to do about symbolic links
+
+DONE: Need to make mode of file copied
+
+Need to make return code of executable be useful to scripts
+
+TESTS:
+
+copy file to nonexistent name (should create, and .md5 as well)
+do it again, make sure missing -f works (doesn't clobber).
+do it again with -f to see it clobbers.
+
+Make sure copying a directory to a file causes an error.
+
+make a directory with 2 files, copy to new (non-existent) name
+  without -r switch (should ignore directory)
+add -r switch, see creates the new name dir
+do it again, should create a subdirectory
+
+Check that mode is preserved on copying directory to new (nonexistent) name
+Check that mode is preserved on new files (created files)
+
+On existing files, the mode will be preserved on the TARGET file,
+unless -p is specified, in which case (like -f) the source will clobber
+the target protections.
+
+ */
+
+int interacative = 0;
+int force = 0;
+int recurse = 0;
+int test = 0;
+int clobber_protections = 0;
+int followlinks = 1;
+
+rc_t CopyDirectoryToExistingDirectory( const KDirectory *top, const char *inname, KDirectory *targettop, const char *outname );
+rc_t CopyFileToFile( const KDirectory *top, const char *inname, KDirectory *targettop, const char *outname );
+
+#define BUFSIZE 8192
+
+char buffer[BUFSIZE];
+
+/* Version  EXTERN
+ *  return 4-part version code: 0xMMmmrrrr, where
+ *      MM = major release
+ *      mm = minor release
+ *    rrrr = bug-fix release
+ */
+ver_t CC KAppVersion ( void )
+{
+    return MD5CP_VERS;
+}
+
+/*
+ * out is a pre-allocated buffer.
+ */
+void JustTheName(const char *in, char *out) 
+{
+  int len;
+  int end;
+  int begin;
+  int i;
+  
+  len = strlen(in);
+  end = len;
+  end--;
+  while (end > 0 && in[end] == '/') {
+    end--;
+  }
+  begin = end;
+  while (begin > 0 && in[begin-1] != '/') {
+    begin--;
+  }
+  for (i=begin; i<=end; i++) {
+    *out++ = in[i];
+  }
+  *out++ = '\0';
+}
+
+bool PathIsMD5File(const KDirectory *dir, const char *inname)
+{
+  int extlen;
+  int inlen;
+
+  inlen = strlen(inname);
+  extlen = strlen(MD5EXTENSION);
+  if (strlen(inname) > extlen+1 &&
+      inname[inlen - extlen - 1] == '.' &&
+      0 == strcmp(inname+inlen-extlen, MD5EXTENSION)) {
+    return true;
+  }
+  return false;
+}
+
+bool CC PathIsFile( const KDirectory *dir, const char *name, void *data ) 
+{
+  uint32_t pathtype;
+  pathtype = KDirectoryPathType( dir, "%s", name );
+  return ((pathtype & ~kptAlias) == kptFile);
+}
+
+
+bool CC PathIsDir(const KDirectory *dir, const char *name, void *data) 
+{
+  uint32_t pathtype;
+  pathtype = KDirectoryPathType( dir, "%s", name );
+  return ((pathtype & ~kptAlias) == kptDir);
+}
+
+rc_t CopyMode( const KDirectory *source, const char *sourcename,
+	       KDirectory *target, char *targetname )
+{
+  /* Make sure they both exist and are the same type */
+  uint32_t src_pathtype;
+  uint32_t dest_pathtype;
+  uint32_t mode;
+  rc_t rc;
+
+  src_pathtype = KDirectoryPathType( source, "%s", sourcename );
+  dest_pathtype = KDirectoryPathType( target, "%s", targetname );
+  if ((src_pathtype & ~kptAlias) != (dest_pathtype & ~kptAlias)) {
+    return -1;
+  }
+  rc = KDirectoryAccess( source, &mode, "%s", sourcename );
+  if (rc != 0)
+    {
+      LOGERR ( klogInt, rc, sourcename );
+      return rc;
+    }
+  KDirectorySetAccess( target, false, mode, 0777, "%s", targetname );
+  return 0;
+}
+
+
+rc_t CopyDirectoryFiles( const KDirectory *source, KDirectory *dest ) {
+  rc_t rc;
+  KNamelist *list;
+  const char *name;
+  int i;
+  uint32_t count;
+  char resolved[1024];
+
+  rc = KDirectoryList( source, &list, PathIsFile, NULL, ".");
+  if (rc != 0)
+    {
+      /* This doesn't do what I thought. */
+      KDirectoryResolvePath( source, false, resolved, 1024, ".");
+      LOGERR ( klogInt, rc, resolved );
+      return rc;
+    }
+  KNamelistCount(list, &count);
+  for (i=0; i<count; i++) {
+    KNamelistGet(list, i, &name);
+    if (test) {
+      fprintf(stderr, "Will copy %s\n", name);
+    } else {
+      CopyFileToFile( source, name, dest, (char *)name );
+    }
+  }
+  return 0;
+}
+
+rc_t CopyDirectoryDirectories( const KDirectory *source, KDirectory *dest ) {
+  rc_t rc;
+  KNamelist *list;
+  const char *name;
+  int i;
+  uint32_t count;
+  uint32_t mode;
+  uint32_t pathtype;
+
+  KDirectoryList( source, &list, PathIsDir, NULL, ".");
+  KNamelistCount(list, &count);
+  for (i=0; i<count; i++) {
+    KNamelistGet(list, i, &name);
+    /* fprintf(stderr, "Creating directory %s\n", name); */
+    mode = DEFAULT_DIR_MODE;
+    rc = KDirectoryAccess( source, &mode, "%s", name);
+    if (rc != 0)
+      {
+	LOGERR ( klogInt, rc, name );
+	return rc;
+      }
+    pathtype = KDirectoryPathType( dest, "%s", name );
+    if ((pathtype & ~kptAlias) == kptNotFound) {
+        rc = KDirectoryCreateDir( dest, mode, kcmOpen, "%s", name );
+      if (rc != 0)
+	{
+	  LOGERR ( klogInt, rc, name );
+	  return rc;
+	}
+    } else if ((pathtype & ~kptAlias) == kptDir) {
+      if (clobber_protections) {
+          KDirectorySetAccess( dest, false, mode, 0777, "%s", name);
+      }
+    }
+    CopyDirectoryToExistingDirectory( source, name, dest, (char *)name);
+  }
+  return 0;
+}
+
+
+
+
+rc_t CopyFileToFile( const KDirectory *top, const char *inname, KDirectory *targettop, const char *outname )
+{
+  const KFile *in = NULL;
+  KFile *out = NULL;
+  KFile *md5file = NULL;
+  KMD5File *md5out = NULL;
+  KMD5SumFmt *md5sumfmt = NULL;
+  char md5filename[1024];
+  rc_t rc = 0;
+  uint32_t mode = 0;
+  uint32_t pathtype = 0;
+  uint32_t failed = 0;
+
+  if (PathIsMD5File(top, inname)) {
+    /* Skip it */
+    return 0;
+  }
+  
+  rc = KDirectoryOpenFileRead( top, &in, "%s", inname );
+  if (rc != 0) {
+    failed = rc;
+    goto FAIL;
+  }
+  mode = DEFAULTMODE;
+  rc = KDirectoryAccess( top, &mode, inname);
+  if (rc != 0) {
+    failed = rc;
+    goto FAIL;
+  }
+
+  /*
+   * Not sure here -- does kcmInit re-initialize the file mode as we specify?
+   * Or does it preserve the existing mode (and do we want it to)?
+   */
+  if (clobber_protections) {
+      pathtype = KDirectoryPathType( targettop, "%s", outname );
+    if ((pathtype & ~kptAlias) == kptFile) {
+        rc = KDirectorySetAccess( targettop, false, mode, 0777, "%s", outname);
+      if (rc != 0) {
+	failed = rc;
+	goto FAIL;
+      }
+    }
+  }
+
+  rc = KDirectoryCreateFile( targettop, &out, false, mode, (force? kcmInit: kcmCreate), "%s", outname );
+  if (rc != 0) {
+    failed = rc;
+    goto FAIL;
+  }
+  sprintf(md5filename, "%s.md5", outname);
+  rc = KDirectoryCreateFile( targettop, &md5file, false, DEFAULTMODE, (force? kcmInit: kcmCreate), "%s", md5filename);
+  if (rc != 0) {
+    failed = rc;
+    goto FAIL;
+  }
+
+  rc = KMD5SumFmtMakeUpdate( &md5sumfmt, md5file);
+  if (rc != 0) {
+    failed = rc;
+    goto FAIL;
+  }
+
+  rc = KMD5FileMakeWrite( &md5out, out, md5sumfmt, outname );
+  if (rc != 0) {
+    failed = rc;
+    goto FAIL;
+  }
+    
+  {  
+    uint64_t rpos = 0;
+    uint64_t wpos = 0;
+      
+    size_t numread;
+
+    while (true) {
+      rc = KFileRead( in, rpos, buffer, BUFSIZE, &numread );
+      /* fprintf(stderr, "Read %d bytes.\n", numread); */
+      if (rc == 0 && numread == 0) 
+	break;
+      if (rc != 0) {
+	failed = rc;
+	goto FAIL;
+      }
+      rpos += numread;
+
+      {
+	size_t numwritten = 0;
+	int written = 0;
+	while (written < numread) {
+	  rc = KFileWrite( (KFile *)md5out, wpos, buffer+written, numread-written, &numwritten );
+	  if (rc != 0) {
+	    failed = rc;
+	    break;
+	  }
+	  if (numwritten == 0) {
+	    fprintf(stderr, "Didn't write anything.\n");
+	    failed = -1;
+	    goto FAIL;
+	  }
+	  wpos += numwritten;
+	  written += numwritten;
+	}
+      }
+    }
+  }
+
+  /* Success also, check the value of failed to see if failed */
+ FAIL:
+
+  if (NULL != md5out) {
+    KFileRelease((KFile *)md5out);
+    md5out = NULL;
+  }
+
+  /*KFileRelease(out); */
+  if (NULL != md5sumfmt) {
+    KMD5SumFmtRelease(md5sumfmt);
+    md5sumfmt = NULL;
+  }
+  /*  KFileRelease(md5file); */
+  if (NULL != in) {
+    KFileRelease(in);
+    in = NULL;
+  }
+  /* KDirectoryRelease(top); */
+
+  if (failed) {
+      KDirectoryRemove( targettop, false, "%s", md5filename );
+      KDirectoryRemove( targettop, false, "%s", outname);
+  }
+
+  return failed;
+
+}  
+
+/*
+ * copies top/inname (a directory) 
+ * to targettop/outname, i.e. creates outname as a copy of that directory.
+ */
+rc_t CopyDirectoryToExistingDirectory( const KDirectory *top, const char *inname, KDirectory *targettop, const char *outname )
+{
+  rc_t rc;
+  uint32_t mode;
+  const KDirectory *source;
+  KDirectory *dest;
+  rc = KDirectoryOpenDirRead(top, &source, true, "%s", (const char *)inname);
+  if (rc != 0)
+    {
+      LOGERR ( klogInt, rc, "can't open input directory" );
+      return rc;
+    }
+  mode = DEFAULT_DIR_MODE;
+  rc = KDirectoryAccess( top, &mode, "%s", inname);
+  if (rc != 0)
+    {
+      LOGERR ( klogInt, rc, inname );
+      return rc;
+    }
+  rc = KDirectoryCreateDir( targettop, mode, kcmOpen, "%s", outname );
+  if (rc != 0)
+    {
+      LOGERR ( klogInt, rc, "can't create output directory" );
+      return rc;
+    }
+  if (clobber_protections) {
+      KDirectorySetAccess( targettop, false, mode, 0777, "%s", outname);
+  }
+  rc = KDirectoryOpenDirUpdate(targettop, &dest, true, "%s", outname);
+  if (rc != 0)
+    {
+      LOGERR ( klogInt, rc, "can't open directory for write" );
+      return rc;
+    }
+  CopyDirectoryFiles(source, dest);
+  CopyDirectoryDirectories( source, dest );
+
+  KDirectoryRelease( dest );
+  KDirectoryRelease( source );
+  return 0;
+}  
+
+#define OPTION_FORCE    "force"
+#define OPTION_RECURSE  "recursive"
+#define OPTION_PRESERVE "preserve"
+#define OPTION_TEST     "test"
+#define ALIAS_FORCE     "f"
+#define ALIAS_RECURSE   "r"
+#define ALIAS_PRESERVE  "p"
+#define ALIAS_TEST      "t"
+
+static const char * force_usage[]    = { "overwrite existing columns", NULL };
+static const char * recurse_usage[]  = { "Recurses over source directories",
+                                         "(directories are ignored otherwise).", NULL };
+static const char * preserve_usage[] = { "force replacement of existing modes on files", " and directories", NULL };
+static const char * test_usage[]     = { "?", NULL };
+
+
+OptDef Options[] = 
+{
+    { OPTION_FORCE,    ALIAS_FORCE,    NULL, force_usage,    0, false, false },
+    { OPTION_RECURSE,  ALIAS_RECURSE,  NULL, recurse_usage,  0, false, false },
+    { OPTION_PRESERVE, ALIAS_PRESERVE, NULL, preserve_usage, 0, false, false },
+    { OPTION_TEST,     ALIAS_TEST,     NULL, test_usage,     0, false, false }
+};
+
+
+const char UsageDefaultName[] = "md5cp";
+
+
+rc_t CC UsageSummary (const char * progname)
+{
+    return KOutMsg ("\n"
+                    "Usage:\n"
+                    "  %s Options [file|directory ...] directory\n"
+                    "\n"
+                    "Summary:\n"
+                    "  Copies files and/or directories, creating an md5sum checksum\n"
+                    "  (named file.md5) for all copied files.\n",
+                    progname);
+}
+
+
+rc_t CC Usage (const Args * args)
+{
+    const char * progname = UsageDefaultName;
+    const char * fullpath = UsageDefaultName;
+    rc_t rc;
+
+    if (args == NULL)
+        rc = RC (rcApp, rcArgv, rcAccessing, rcSelf, rcNull);
+    else
+        rc = ArgsProgram (args, &fullpath, &progname);
+
+    UsageSummary (progname);
+
+    KOutMsg ("\n"
+             "Option:\n");
+
+    HelpOptionLine (ALIAS_FORCE, OPTION_FORCE, NULL, force_usage);
+    HelpOptionLine (ALIAS_PRESERVE, OPTION_PRESERVE, NULL, preserve_usage);
+    HelpOptionLine (ALIAS_RECURSE, OPTION_RECURSE, NULL, recurse_usage);
+    HelpOptionLine (ALIAS_TEST, OPTION_TEST, NULL, test_usage);
+
+    HelpOptionsStandard ();
+
+    HelpVersion (fullpath, KAppVersion());
+
+    return rc;
+}
+
+
+rc_t run (Args * args)
+{
+    rc_t rc;
+
+    do 
+    {
+        const char * outname;
+        const char * source;
+        uint32_t pathtype;
+        KDirectory *top;
+        KDirectory *targettop;
+        uint32_t pcount;
+        uint32_t ix;
+        char sourcename [1024];
+
+        rc = KDirectoryNativeDir (&top);
+        if (rc)
+            break;
+        rc = ArgsParamCount (args, &pcount);
+        if (rc)
+            break;
+
+        if (pcount < 2)
+        {
+            MiniUsage (args);
+            rc = RC (rcExe, rcArgv, rcParsing, rcParam, rcInsufficient);
+            break;
+        }
+
+        rc = ArgsParamValue (args, 0, &outname);
+        if (rc)
+            break;
+
+        pathtype = KDirectoryPathType (top, "%s", outname);
+        if ((pathtype & ~kptAlias) == kptDir)
+        {
+            /* 
+             * Copying things into an existing directory.
+             */
+            rc = KDirectoryOpenDirUpdate( top, &targettop, true, outname);
+            if (rc)
+            {
+                LOGERR (klogFatal, rc, outname);
+                break;
+            }
+
+            for (ix = 1; ix < pcount; ++ix)
+            {
+                
+                rc = ArgsParamValue (args, ix, &source);
+                if (rc)
+                    break;
+
+                JustTheName (source, sourcename);
+                pathtype = KDirectoryPathType (top, "%s", sourcename);
+                if ((pathtype & ~kptAlias) == kptFile)
+                {
+                    CopyFileToFile (top, source, targettop, sourcename);
+                }
+                else if ((pathtype & ~kptAlias) == kptDir)
+                {
+                    if (!recurse)
+                    {
+                        STSMSG (0, ("Skipping directory %s\n", source));
+                        continue;
+                    }
+                    CopyDirectoryToExistingDirectory (top, source, targettop, sourcename);
+                }
+            }
+            if (rc)
+                break;
+
+            rc = KDirectoryRelease (targettop);
+/* this looks wrong */
+            if (rc)
+                LOGERR (klogInt, rc, outname);
+        }
+        else if ((pathtype * ~kptAlias) == kptFile)
+        {
+            if (!force)
+            {
+                STSMSG (0, ("File exists -- %s\n", outname));
+                break;
+            }
+            if (pcount > 2)
+            {
+                STSMSG (0, ("Target %s is a file. Too many parameters/\n", outname));
+                break;
+            }
+
+            rc = ArgsParamValue (args, 1, &source);
+            if (rc)
+                break;
+
+            pathtype = KDirectoryPathType (top, "%s", source);
+
+            if ((pathtype & ~kptAlias) == kptDir)
+            {
+                STSMSG (0, ("Cannot overwrite file with directory %s\n", source));
+                break;
+            }
+            if ((pathtype & ~kptAlias) == kptFile)
+            {
+                CopyFileToFile (top, source, top, outname);
+            }
+        }
+        else if ((pathtype & ~kptAlias) == kptNotFound)
+        {
+            if (pcount > 2)
+            {
+                STSMSG (0, ("Directory %s does not exist.\n", outname));
+                break;
+            }
+
+            rc = ArgsParamValue (args, 1, &source);
+            if (rc)
+                break;
+
+            pathtype = KDirectoryPathType (top, "%s", source);
+            if ((pathtype & ~kptAlias) == kptFile)
+            {
+                CopyFileToFile (top, source, top, outname);
+            }
+            else if ((pathtype & ~kptAlias) == kptDir)
+            {
+                if (!recurse)
+                {
+                    STSMSG (0, ("Skipping directory %s\n", source));
+                    break;
+                }
+                CopyDirectoryToExistingDirectory (top, source, top, outname);
+            }
+        }
+
+    } while (0);
+    return rc;
+}
+
+rc_t CC KMain ( int argc, char *argv [] )
+{
+    Args * args;
+    rc_t rc;
+
+    rc = ArgsMakeAndHandle (&args, argc, argv, 1, 
+                            Options, sizeof (Options) / sizeof (OptDef));
+    if (rc == 0)
+    {
+        do
+        {
+            uint32_t pcount;
+
+            rc = ArgsOptionCount (args, OPTION_FORCE, &pcount);
+            if (rc)
+                break;
+
+            force = (pcount > 0);
+
+            rc = ArgsOptionCount (args, OPTION_RECURSE, &pcount);
+            if (rc)
+                break;
+
+            recurse = (pcount > 0);
+
+
+            rc = ArgsOptionCount (args, OPTION_TEST, &pcount);
+            if (rc)
+                break;
+
+            test = (pcount > 0);
+
+            rc = ArgsOptionCount (args, OPTION_PRESERVE, &pcount);
+            if (rc)
+                break;
+
+            clobber_protections = (pcount > 0);
+
+            rc  = run (args);
+
+        }while (0);
+
+        ArgsWhack (args);
+    }
+    return rc;
+}
+
diff --git a/tools/util/md5cp.vers b/tools/util/md5cp.vers
index cc6c9a4..8e8299d 100644
--- a/tools/util/md5cp.vers
+++ b/tools/util/md5cp.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/util/md5cp.vers.h b/tools/util/md5cp.vers.h
new file mode 100644
index 0000000..83cdbf6
--- /dev/null
+++ b/tools/util/md5cp.vers.h
@@ -0,0 +1 @@
+#define MD5CP_VERS 0x02040002
diff --git a/tools/util/pacbio-correct.c b/tools/util/pacbio-correct.c
new file mode 100644
index 0000000..d5eb5c0
--- /dev/null
+++ b/tools/util/pacbio-correct.c
@@ -0,0 +1,221 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data", the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties", express or implied", including
+*  warranties of performance", merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <klib/out.h>
+#include <klib/rc.h>
+#include <klib/log.h>
+
+#include <kdb/database.h>
+#include <kdb/manager.h>
+
+#include <vdb/vdb-priv.h>
+#include <vdb/manager.h>
+#include <vdb/database.h>
+
+#include <kapp/main.h>
+#include <kapp/args.h>
+
+#include <sysalloc.h>
+
+const char UsageDefaultName[] = "pacbio-correct";
+
+rc_t CC UsageSummary ( const char * progname )
+{
+    OUTMSG ( ("\n"
+        "Usage:\n"
+        "  %s writable_object(s)\n"
+        "\n", progname) );
+    return 0;
+}
+
+
+rc_t CC Usage ( const Args * args )
+{
+    const char * progname = UsageDefaultName;
+    const char * fullpath = UsageDefaultName;
+    rc_t rc;
+
+    if ( args == NULL )
+        rc = RC ( rcApp, rcArgv, rcAccessing, rcSelf, rcNull );
+    else
+        rc = ArgsProgram ( args, &fullpath, &progname );
+    if ( rc )
+        progname = fullpath = UsageDefaultName;
+
+    UsageSummary ( progname );
+
+    KOutMsg ( "Options:\n" );
+
+    HelpOptionsStandard ();
+    HelpVersion ( fullpath, KAppVersion() );
+    return rc;
+}
+
+
+/* Version  EXTERN
+ *  return 4-part version code: 0xMMmmrrrr, where
+ *      MM = major release
+ *      mm = minor release
+ *    rrrr = bug-fix release
+ */
+ver_t CC KAppVersion ( void )
+{
+    return 0x10010001;
+}
+
+
+const char CONSENSUS[] = "CONSENSUS";
+const char PULSE[] = "PULSE";
+const char SEQUENCE[] = "SEQUENCE";
+
+rc_t correct( const char * obj )
+{
+    KDirectory * dir;
+    rc_t rc = KDirectoryNativeDir( &dir );
+    if ( rc != 0 )
+    {
+        LOGERR( klogErr, rc, "creation of KDirectory failed" );
+    }
+    else
+    {
+        VDBManager * vdb_mgr;
+        rc = VDBManagerMakeUpdate ( &vdb_mgr, dir );
+        if ( rc != 0 )
+        {
+            LOGERR( klogErr, rc, "creation of VDBManager failed" );
+        }
+        else
+        {
+            VDatabase * vdb_db;
+            rc = VDBManagerOpenDBUpdate ( vdb_mgr, &vdb_db, NULL, "%s", obj );
+            if ( rc != 0 )
+            {
+                LOGERR( klogErr, rc, "vdb: open for update failed" );
+            }
+            else
+            {
+                KDatabase *kdb;
+                rc = VDatabaseOpenKDatabaseUpdate ( vdb_db, & kdb );
+                if ( rc != 0 )
+                {
+                    LOGERR( klogErr, rc, "kdb: open for update failed" );
+                }
+                else
+                {
+                    if ( KDatabaseExists ( kdb, kptTable, CONSENSUS ) )
+                    {
+                        if ( KDatabaseExists ( kdb, kptTable, PULSE ) )
+                        {
+                            OUTMSG(( "table >%s< does already exist in >%s<\n", PULSE, obj ));
+                        }
+                        else
+                        {
+                            if ( KDatabaseExists ( kdb, kptTable, SEQUENCE ) )
+                            {
+                                rc = KDatabaseRenameTable ( kdb, true, SEQUENCE, PULSE );
+                                if ( rc != 0 )
+                                {
+                                    LOGERR( klogErr, rc, "kdb: renaming table failed" );
+                                }
+                                else
+                                {
+                                    OUTMSG(( "table >%s< renamed to >%s< in >%s<\n", SEQUENCE, PULSE, obj ));
+                                }
+                                if ( rc == 0 )
+                                {
+                                    rc = KDatabaseAliasTable ( kdb, CONSENSUS, SEQUENCE );
+                                    if ( rc != 0 )
+                                    {
+                                        LOGERR( klogErr, rc, "kdb: creating table-alias failed" );
+                                    }
+                                    else
+                                    {
+                                        OUTMSG(( "alias >%s< created for >%s< in >%s<\n", SEQUENCE, CONSENSUS, obj ));
+                                    }
+                                }
+                            }
+                        }
+                    }
+                    else
+                    {
+                        OUTMSG(( "table >%s< does not exist in >%s<\n", CONSENSUS, obj ));
+                    }
+                    KDatabaseRelease ( kdb );
+                }
+                VDatabaseRelease( vdb_db );
+            }
+            VDBManagerRelease( vdb_mgr );
+        }
+        KDirectoryRelease( dir );
+    }
+    return rc;
+}
+
+
+rc_t CC KMain ( int argc, char *argv [] )
+{
+    Args * args;
+
+    rc_t rc = ArgsMakeAndHandle ( &args, argc, argv, 0 );
+
+    KLogHandlerSetStdErr();
+    if ( rc != 0 )
+    {
+        LOGERR( klogErr, rc, "error creating internal structure" );
+    }
+    else
+    {
+        uint32_t count;
+        rc = ArgsParamCount( args, &count );
+        if ( rc != 0 )
+            LOGERR( klogErr, rc, "ArgsParamCount failed" );
+        else
+        {
+            if ( count < 1 )
+            {
+                rc = RC( rcExe, rcNoTarg, rcAllocating, rcParam, rcInvalid );
+                LOGERR( klogErr, rc, "object(s) missing" );
+                Usage ( args );
+            }
+            else
+            {
+                uint32_t idx;
+                for ( idx = 0; idx < count && rc == 0; ++idx )
+                {
+                    const char *obj;
+                    rc = ArgsParamValue( args, idx, &obj );
+                    if ( rc != 0 )
+                        LOGERR( klogErr, rc, "error reading commandline-parameter" );
+                    else
+                        rc = correct( obj ); /* ** <<<<<<<<<<<<<<<<<< ** */
+                }
+            }
+        }
+        ArgsWhack ( args );
+    }
+
+    return rc;
+}
diff --git a/tools/util/pacbio-correct.vers b/tools/util/pacbio-correct.vers
new file mode 100644
index 0000000..8e8299d
--- /dev/null
+++ b/tools/util/pacbio-correct.vers
@@ -0,0 +1 @@
+2.4.2
diff --git a/tools/util/rcexplain.c b/tools/util/rcexplain.c
index 4068ac8..c3fd4da 100644
--- a/tools/util/rcexplain.c
+++ b/tools/util/rcexplain.c
@@ -104,8 +104,10 @@ rc_t CC KMain ( int argc, char *argv [] )
             if (rc)
                 break;
             
-            if (pcount == 0)
-                rc = MiniUsage(args);
+            if (pcount == 0) {
+                MiniUsage(args);
+                rc = RC(rcExe, rcNoTarg, rcAllocating, rcParam, rcInvalid);
+            }
             else
             {
                 const char * pc;
diff --git a/tools/util/rcexplain.vers b/tools/util/rcexplain.vers
index cc6c9a4..8e8299d 100644
--- a/tools/util/rcexplain.vers
+++ b/tools/util/rcexplain.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/util/rcexplain.vers.h b/tools/util/rcexplain.vers.h
new file mode 100644
index 0000000..3afa312
--- /dev/null
+++ b/tools/util/rcexplain.vers.h
@@ -0,0 +1 @@
+#define RCEXPLAIN_VERS 0x02040002
diff --git a/tools/util/rowwritetest.c b/tools/util/rowwritetest.c
index 9d8a3e3..2758495 100644
--- a/tools/util/rowwritetest.c
+++ b/tools/util/rowwritetest.c
@@ -165,7 +165,7 @@ rc_t run (const char * table_path, uint64_t N )
         char col[3];
         sprintf(col, "C%d", i + 1);
         STSMSG(2,("Adding column %s to cursor", col));
-        rc = VCursorAddColumn(cursor, &idx[i], col);
+        rc = VCursorAddColumn(cursor, &idx[i], "%s", col);
         if (rc != 0)
             PLOGERR(klogInt, (klogInt, rc,
                               "failed to add $(c) to cursor", "c=%s", col));
@@ -291,7 +291,7 @@ rc_t run (const char * table_path, uint64_t N )
 
                 sprintf(name, "C%d", i);
                 STSMSG (1, STATUS("checking "));
-                rc = KDirectoryFileSize(dir, &size, FORMAT, tablePath, name);
+                rc = KDirectoryFileSize(dir, &size, FORMAT, tablePath, "%s", name);
                 if (rc != 0) {
                     if (GetRCState(rc) == rcNotFound) {
                         STSMSG (2, STATUS("not found "));
diff --git a/tools/util/rowwritetest.vers b/tools/util/rowwritetest.vers
index cc6c9a4..8e8299d 100644
--- a/tools/util/rowwritetest.vers
+++ b/tools/util/rowwritetest.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/util/schema-replace.c b/tools/util/schema-replace.c
new file mode 100644
index 0000000..53137cb
--- /dev/null
+++ b/tools/util/schema-replace.c
@@ -0,0 +1,394 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "schema-replace.vers.h"
+
+#include <vdb/manager.h>
+#include <vdb/schema.h>
+#include <vdb/database.h>
+#include <vdb/vdb-priv.h>
+#include <kdb/manager.h>
+#include <kdb/database.h>
+#include <kdb/table.h>
+#include <kdb/meta.h>
+#include <kfs/directory.h>
+#include <kapp/main.h>
+#include <kapp/args.h>
+#include <klib/out.h>
+#include <klib/text.h>
+#include <klib/rc.h>
+#include <os-native.h>
+#include <sysalloc.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+#define OPTION_SCHEMA         "schema"
+#define OPTION_DB_TYPE        "db_type"
+#define OPTION_TAB_TYPE       "tab_type"
+#define OPTION_TAB_NAME       "tab_name"
+
+#define ALIAS_SCHEMA          "s"
+#define ALIAS_DB_TYPE         "d"
+#define ALIAS_TAB_TYPE        "t"
+#define ALIAS_TAB_NAME        "n"
+
+static const char * schema_usage[] = { "path to file, that contains new schema", NULL };
+static const char * db_type_usage[] = { "string, specifies the type of the database", NULL };
+static const char * tab_type_usage[] = { "string, specifies the type of the selected table", NULL };
+static const char * tab_name_usage[] = { "string, specifies the name of the table to be processed", NULL };
+
+OptDef SchemaUpOptions[] =
+{
+    { OPTION_SCHEMA, ALIAS_SCHEMA, NULL, schema_usage, 1, true, true },
+    { OPTION_DB_TYPE, ALIAS_DB_TYPE, NULL, db_type_usage, 1, true, true },
+    { OPTION_TAB_TYPE, ALIAS_TAB_TYPE, NULL, tab_type_usage, 1, true, true },
+    { OPTION_TAB_NAME, ALIAS_TAB_NAME, NULL, tab_name_usage, 1, true, true }
+};
+
+const char UsageDefaultName[] = "schema-update";
+
+
+rc_t CC UsageSummary ( const char * progname )
+{
+    return KOutMsg ("\n"
+                    "Usage:\n"
+                    "  %s <path> [options]\n"
+                    "\n", progname);
+}
+
+
+rc_t CC Usage( const Args * args  )
+{
+    const char * progname = UsageDefaultName;
+    const char * fullpath = UsageDefaultName;
+    rc_t rc;
+
+    if ( args == NULL )
+        rc = RC ( rcApp, rcArgv, rcAccessing, rcSelf, rcNull );
+    else
+        rc = ArgsProgram( args, &fullpath, &progname );
+    if (rc)
+        progname = fullpath = UsageDefaultName;
+
+    UsageSummary( progname );
+
+    KOutMsg ("Options:\n");
+
+    HelpOptionLine ( ALIAS_SCHEMA, OPTION_SCHEMA, NULL, schema_usage );
+    HelpOptionLine ( ALIAS_DB_TYPE, OPTION_DB_TYPE, NULL, db_type_usage );
+    HelpOptionLine ( ALIAS_TAB_TYPE, OPTION_TAB_TYPE, NULL, tab_type_usage );
+    HelpOptionLine ( ALIAS_TAB_NAME, OPTION_TAB_NAME, NULL, tab_name_usage );
+
+    HelpOptionsStandard();
+
+    HelpVersion( fullpath, KAppVersion() );
+    return rc;
+}
+
+
+/* Version  EXTERN
+ *  return 4-part version code: 0xMMmmrrrr, where
+ *      MM = major release
+ *      mm = minor release
+ *    rrrr = bug-fix release
+ */
+ver_t CC KAppVersion ( void )
+{
+    return SCHEMA_REPLACE_VERS;
+}
+
+
+static const char* get_str_option( const Args *my_args,
+                                   const char *name )
+{
+    const char* res = NULL;
+    uint32_t count;
+    rc_t rc = ArgsOptionCount( my_args, name, &count );
+    if ( ( rc == 0 )&&( count > 0 ) )
+    {
+        rc = ArgsOptionValue( my_args, name, 0, &res );
+    }
+    return res;
+}
+
+
+typedef struct ctx
+{
+    VDBManager * vdb_mgr;
+    KDBManager * kdb_mgr;
+    VSchema *schema;
+
+    const char *db_type;
+    const char *tab_type;
+    const char *tab_name;
+
+    char * db_schema_buff;
+    size_t db_schema_len;
+    char * tab_schema_buff;
+    size_t tab_schema_len;
+} ctx;
+typedef ctx* p_ctx;
+
+
+static rc_t write_schema( KMetadata *meta, const char * schema_dump, size_t schema_len )
+{
+    KMDataNode *schema_node;
+    rc_t rc = KMetadataOpenNodeUpdate ( meta, &schema_node, "schema" );
+    if ( rc == 0 )
+    {
+        rc = KMDataNodeWrite ( schema_node, schema_dump, schema_len );
+        KMDataNodeRelease ( schema_node );
+    }
+    else
+        OUTMSG(( "error KMetadataOpenNodeUpdate: %R\n", rc ));
+    return rc;
+}
+
+
+static rc_t process_csra( p_ctx ctx, const char *csra )
+{
+    KDatabase *this_kdb;
+    rc_t rc = KDBManagerOpenDBUpdate ( ctx->kdb_mgr, &this_kdb, "%s", csra );
+    if ( rc == 0 )
+    {
+        /* do it for the whole database ... */
+        KMetadata *meta;
+        KTable *this_tab;
+
+        rc = KDatabaseOpenMetadataUpdate ( this_kdb, &meta );
+        if ( rc == 0 )
+        {
+            rc = write_schema( meta, ctx->db_schema_buff, ctx->db_schema_len );
+            KMetadataRelease ( meta );
+        }
+        else
+            OUTMSG(( "error KDatabaseOpenMetadataUpdate: %R\n", rc ));
+
+        /* do it for the selected table ... */
+        if ( rc == 0 )
+        {
+            rc = KDatabaseOpenTableUpdate ( this_kdb, &this_tab, "%s", ctx->tab_name );
+            if ( rc == 0 )
+            {
+                rc = KTableOpenMetadataUpdate ( this_tab, &meta );
+                if ( rc == 0 )
+                {
+                    rc = write_schema( meta, ctx->tab_schema_buff, ctx->tab_schema_len );
+                    KMetadataRelease ( meta );
+                }
+                else
+                    OUTMSG(( "error KTableOpenMetadataUpdate: %R\n", rc ));
+            }
+            else
+                OUTMSG(( "error KDatabaseOpenTableUpdate: %R\n", rc ));
+        }
+
+        KDatabaseRelease ( this_kdb );
+    }
+        else OUTMSG(( "error KDBManagerOpenDBUpdate: %R\n", rc ));
+    return rc;
+}
+
+
+static rc_t process_files( p_ctx ctx, Args * args )
+{
+    uint32_t count;
+    rc_t rc = ArgsParamCount( args, &count );
+    if ( rc == 0 )
+    {
+        uint32_t idx;
+        for ( idx = 0; idx < count && rc == 0; ++idx )
+        {
+            const char *csra = NULL;
+            rc = ArgsParamValue( args, idx, &csra );
+            if ( rc == 0 )
+            {
+                OUTMSG(( "\nprocessing: %s\n", csra ));
+                rc = process_csra( ctx, csra );
+                if ( rc == 0 )
+                    OUTMSG(( "processed: %s\n", csra ));
+            }
+        }
+    }
+/*
+    if ( ctx->db_schema_buff != NULL )
+        OUTMSG(( "%s\n", ctx->db_schema_buff ));
+    if ( ctx->tab_schema_buff != NULL )
+        OUTMSG(( "%s\n", ctx->tab_schema_buff ));
+*/
+    return rc;
+}
+
+
+typedef struct dump_ctx
+{
+    char *buffer;
+    size_t len;
+    size_t size;
+} dump_ctx;
+typedef dump_ctx* p_dump_ctx;
+
+
+static rc_t CC schema_dump_flush( void *dst, const void *buffer, size_t bsize )
+{
+    rc_t rc = -1;
+    p_dump_ctx ctx = dst;
+    if ( ctx->buffer == NULL )
+    {
+        ctx->size = bsize + 1;
+        ctx->buffer = malloc( ctx->size );
+        if ( ctx->buffer != NULL )
+        {
+            memcpy ( ctx->buffer, buffer, bsize );
+            ctx->len = bsize;
+            rc = 0;
+        }
+    }
+    else
+    {
+        ctx->size += bsize;
+        ctx->buffer = realloc( ctx->buffer, ctx->size );
+        if ( ctx->buffer != NULL )
+        {
+            memcpy ( &(ctx->buffer[ctx->len]), buffer, bsize );
+            ctx->len += bsize;
+            rc = 0;
+        }
+    }
+    return rc;
+}
+
+
+static rc_t predump_schema( VSchema *schema, const char * type,
+                            char **buffer, size_t *len )
+{
+    rc_t rc;
+    dump_ctx ctx;
+    ctx.buffer = NULL;
+    ctx.len = 0;
+    ctx.size = 0;
+
+    *buffer = NULL;
+    *len = 0;
+    rc = VSchemaDump( schema, sdmCompact, type, schema_dump_flush, &ctx );
+    if ( rc == 0 )
+    {
+        if ( ctx.buffer != NULL )
+        {
+            ctx.buffer[ ctx.len ] = 0;
+            *buffer = ctx.buffer;
+            *len = ctx.len;
+        }
+    }
+    else
+    {
+        if ( ctx.buffer != NULL )
+            free( ctx.buffer );
+    }
+    return rc;
+}
+
+
+rc_t CC KMain ( int argc, char *argv [] )
+{
+    Args * args;
+
+    rc_t rc = ArgsMakeAndHandle ( &args, argc, argv, 1,
+            SchemaUpOptions, sizeof SchemaUpOptions / sizeof SchemaUpOptions [ 0 ] );
+    if ( rc == 0 )
+    {
+        ctx ctx;
+        const char * schema_name = get_str_option( args, OPTION_SCHEMA );
+        ctx.db_type = get_str_option( args, OPTION_DB_TYPE );
+        ctx.tab_type = get_str_option( args, OPTION_TAB_TYPE );
+        ctx.tab_name = get_str_option( args, OPTION_TAB_NAME );
+
+        if ( schema_name != NULL && ctx.db_type != NULL &&
+             ctx.tab_type != NULL && ctx.tab_name )
+        {
+            KDirectory * directory;
+            OUTMSG(( "schema   : %s\n", schema_name ));
+            OUTMSG(( "db-type  : %s\n", ctx.db_type ));
+            OUTMSG(( "tab-type : %s\n", ctx.tab_type ));
+            OUTMSG(( "tab-name : %s\n", ctx.tab_name ));
+
+            rc = KDirectoryNativeDir( &directory );
+            if ( rc == 0 )
+            {
+                rc = VDBManagerMakeUpdate ( &ctx.vdb_mgr, directory );
+                if ( rc == 0 )
+                {
+                    rc = VDBManagerOpenKDBManagerUpdate ( ctx.vdb_mgr, &ctx.kdb_mgr );
+                    if ( rc ==  0 )
+                    {
+                        rc = VDBManagerMakeSchema( ctx.vdb_mgr, &ctx.schema );
+                        if ( rc == 0 )
+                        {
+                            rc = VSchemaParseFile( ctx.schema, "%s", schema_name );
+                            if ( rc == 0 )
+                            {
+                                rc = predump_schema( ctx.schema, ctx.db_type, 
+                                        &ctx.db_schema_buff, &ctx.db_schema_len );
+                                if ( rc == 0 )
+                                {
+                                    rc = predump_schema( ctx.schema, ctx.tab_type, 
+                                        &ctx.tab_schema_buff, &ctx.tab_schema_len );
+                                    if ( rc == 0 )
+                                    {
+                                        rc = process_files( &ctx, args );
+                                        free( ctx.tab_schema_buff );
+                                    }
+                                    free( ctx.db_schema_buff );
+                                }
+                            }
+                            else
+                                OUTMSG(( "error VSchemaParseFile %R\n", rc ));
+                            VSchemaRelease( ctx.schema );
+                        }
+                        else
+                            OUTMSG(( "error VDBManagerMakeSchema %R\n", rc ));
+                     }
+                    else
+                        OUTMSG(( "error VDBManagerOpenKDBManagerUpdate %R\n", rc ));
+                    VDBManagerRelease( ctx.vdb_mgr );
+                }
+                else
+                    OUTMSG(( "error VDBManagerMakeUpdate %R\n", rc ));
+                KDirectoryRelease( directory );
+            }
+            else
+                OUTMSG(( "error KDirectoryNativeDir %R\n", rc ));
+        }
+        else
+            OUTMSG(( "error obtaining arguments\n" ));
+        ArgsWhack( args );
+    }
+    return rc;
+}
+
diff --git a/tools/util/schema-replace.sh b/tools/util/schema-replace.sh
new file mode 100755
index 0000000..da44f39
--- /dev/null
+++ b/tools/util/schema-replace.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+execute()
+{
+    echo $1
+    eval $1
+}
+
+SRC=$1
+DST=$2
+TMP=$3
+SCHEMA="align/align.vschema"
+DB_TYPE="NCBI:align:db:alignment_sorted#1"
+TAB_TYPE="NCBI:align:tbl:align_sorted#1"
+
+[ $# -gt 3 ] && SCHEMA=$4
+
+execute "kar -fx $SRC -d $TMP" || exit $?
+execute "chmod +w -R $TMP" || exit $?
+execute "schema-replace -s $SCHEMA -d $DB_TYPE -t $TAB_TYPE $TMP" || exit $?
+execute "kar -fd $TMP -c $DST" || exit $?
+execute "rm -rf $TMP"
diff --git a/tools/util/schema-replace.vers b/tools/util/schema-replace.vers
index cc6c9a4..8e8299d 100644
--- a/tools/util/schema-replace.vers
+++ b/tools/util/schema-replace.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/util/schema-replace.vers.h b/tools/util/schema-replace.vers.h
new file mode 100644
index 0000000..c00938b
--- /dev/null
+++ b/tools/util/schema-replace.vers.h
@@ -0,0 +1 @@
+#define SCHEMA_REPLACE_VERS 0x02040002
diff --git a/tools/util/sortreadtest.c b/tools/util/sortreadtest.c
new file mode 100644
index 0000000..1342791
--- /dev/null
+++ b/tools/util/sortreadtest.c
@@ -0,0 +1,355 @@
+#include <kapp/main.h>
+#include <kapp/args.h>
+
+#include <kfs/directory.h>
+#include <kfs/file.h>
+#include <kfs/mmap.h>
+
+#include <vdb/manager.h>
+#include <vdb/schema.h>
+#include <vdb/table.h>
+#include <vdb/cursor.h>
+#include <klib/log.h>
+#include <klib/out.h>
+#include <klib/status.h>
+#include <klib/rc.h>
+#include <klib/text.h>
+
+#include <assert.h>
+#include <os-native.h>
+
+
+/*
+
+  default file is "ncbi/seq.vschema"
+  default table-spec "NCBI:tbl:base_space#2"
+
+*/
+#define SCHEMASPEC "ncbi/seq.vschema"
+#define TYPESPEC "NCBI:tbl:base_space#2"
+
+const char UsageDefaultName[] = "sortreadtest";
+
+
+rc_t CC UsageSummary (const char * progname)
+{
+    return KOutMsg ("\n"
+                    "Usage:\n"
+                    "  %s [OPTIONS] file-path table-path [schema-path]\n"
+                    "\n"
+                    "Summary:\n"
+                    "  Write lines from file as rows to table using schema\n"
+                    "\n", progname);
+}
+
+
+rc_t CC Usage (const Args * args)
+{
+    const char * progname = UsageDefaultName;
+    const char * fullpath = UsageDefaultName;
+    rc_t rc;
+
+    if (args == NULL)
+        rc = RC (rcApp, rcArgv, rcAccessing, rcSelf, rcNull);
+    else
+        rc = ArgsProgram (args, &fullpath, &progname);
+
+    UsageSummary (progname);
+
+    OUTMSG (("Options:\n"));
+
+    HelpOptionsStandard ();
+
+    return rc;
+}
+
+
+ver_t CC KAppVersion(void) { return 0; }
+
+
+typedef struct param_block
+{
+    const char * file_path;
+    const char * table_path;
+    const char * schema_path;
+
+    KDirectory * pwd;
+    const KFile * file;
+    const KMMap * mmap;
+    VDBManager * mgr;
+    VSchema * schema;
+    VTable * table;
+    VCursor * cursor;
+
+    const char * seq;
+    const char * eof;
+    size_t seq_size;
+
+
+    uint32_t    idx; /* column idx in the cursor for READ (should be 0 */
+
+}  param_block;
+
+rc_t get_a_sequence (param_block * pb)
+{
+    char * eol;
+    rc_t rc = 0;
+    if (pb->seq == NULL)        /* first call */
+    {
+        const void * annoying;
+        uint64_t file_pos;
+        size_t map_size;
+        uint64_t file_size;
+
+        rc = KFileSize (pb->file, &file_size);
+        if (rc)
+            return rc;
+
+        rc = KMMapAddrRead (pb->mmap, &annoying);
+        if (rc)
+            return rc;
+
+        pb->seq = annoying;
+
+        if (pb->seq == NULL)
+            return 0;
+
+        rc = KMMapPosition (pb->mmap, &file_pos);
+        if (rc)
+            return rc;
+
+        if (file_pos != 0)
+        {
+            rc = RC (rcExe, rcMemMap, rcAccessing, rcOffset, rcInvalid);
+            return rc;
+        }
+
+        rc = KMMapSize (pb->mmap, &map_size);
+        if (rc)
+            return rc;
+
+        if (map_size != file_size)
+        {
+            rc = RC (rcExe, rcMemMap, rcAccessing, rcFile, rcInvalid);
+            return rc;
+        }
+        pb->eof = pb->seq + map_size;
+    }
+    else
+    {
+        pb->seq += pb->seq_size + 1;
+
+        if (pb->seq >= pb->eof)
+        {
+            pb->seq = NULL;
+            return 0;
+        }
+    }
+
+    eol = string_chr (pb->seq, pb->eof - pb->seq, '\n');
+    if (eol == NULL)
+        pb->seq_size = pb->eof - pb->seq;
+    else
+        pb->seq_size = eol - pb->seq;
+
+    return rc;
+}
+
+
+rc_t write_rows (param_block * pb)
+{
+    rc_t rc = 0;
+
+    pb->seq = NULL;
+
+    do
+    {
+        rc = get_a_sequence (pb);
+        if (rc)
+        {
+            LOGERR (klogFatal, rc, "Failed to read a sequence");
+        }
+        else
+        {
+            if (pb->seq == NULL)
+                break;
+            rc = VCursorOpenRow (pb->cursor);
+            if (rc)
+            {
+                LOGERR (klogFatal, rc, "Failed to open row");
+                break;
+            }
+            else
+            {
+                rc_t rc2;
+                rc = VCursorWrite (pb->cursor, pb->idx, 8, pb->seq, 0, pb->seq_size);
+                if (rc)
+                    LOGERR (klogFatal, rc, "Failed to write row");
+                else
+                    rc = VCursorCommitRow (pb->cursor);
+                rc2 = VCursorCloseRow (pb->cursor);
+                if (rc == 0)
+                    rc = rc2;
+            }
+        }
+    } while (rc == 0);
+    
+    return rc;
+}
+
+
+rc_t open (param_block * pb)
+{
+    rc_t rc;
+
+    rc = KDirectoryNativeDir (&pb->pwd);
+    if (rc)
+        LOGERR (klogFatal, rc, "Failed to open file system");
+    else
+    {
+        rc = KDirectoryOpenFileRead (pb->pwd, &pb->file, "%s", pb->file_path);
+        if (rc)
+            LOGERR (klogFatal, rc, "Failed to open input file");
+        else
+        {
+            rc = KMMapMakeRead (&pb->mmap, pb->file);
+            if (rc)
+                LOGERR (klogFatal, rc, "unable to map file");
+            else
+            {
+                rc = VDBManagerMakeUpdate (&pb->mgr, pb->pwd);
+                if (rc)
+                    LOGERR (klogFatal, rc, "Failed to open DB Manager");
+                else
+                {
+                    rc = VDBManagerMakeSchema (pb->mgr, &pb->schema);
+                    if (rc)
+                        LOGERR (klogFatal, rc, "Failed to create a schema object");
+                    else
+                    {
+                        VSchemaAddIncludePath (pb->schema, "interfaces");
+
+                        rc = VSchemaParseFile (pb->schema, "%s", pb->schema_path);
+                        if (rc)
+                            LOGERR (klogFatal, rc, "Failed to parse schema");
+                        else
+                        {
+                            rc = VDBManagerCreateTable (pb->mgr, &pb->table, pb->schema,
+                                                        TYPESPEC, kcmCreate, "%s", pb->table_path);
+                            if (rc)
+                                LOGERR (klogFatal, rc, "Failed to create table");
+                            else
+                            {
+                                rc = VTableCreateCursorWrite (pb->table, &pb->cursor, kcmCreate);
+                                if (rc)
+                                    LOGERR (klogFatal, rc, "Failed to create cursor");
+                                else
+                                {
+                                    rc = VCursorAddColumn (pb->cursor, &pb->idx, "READ");
+                                    if (rc)
+                                        LOGERR (klogFatal, rc, "Failed to add READ to cursor");
+                                    else
+                                    {
+                                        rc = VCursorOpen (pb->cursor);
+                                        if (rc)
+                                            LOGERR (klogFatal, rc, "Failed to open cursor");
+                                        else
+                                        {
+                                            rc = write_rows (pb);
+                                            if (rc == 0)
+                                                VCursorCommit (pb->cursor);
+                                        }
+                                    }
+                                    VCursorRelease (pb->cursor);
+                                }
+                                VTableRelease (pb->table);
+                            }
+                        }
+                        VSchemaRelease (pb->schema);
+                    }
+                    VDBManagerRelease (pb->mgr);
+                }
+                KMMapRelease (pb->mmap);
+            }
+            KFileRelease (pb->file);
+        }
+        KDirectoryRelease (pb->pwd);
+    }
+    return rc;
+}
+
+rc_t CC KMain ( int argc, char *argv[] )
+{
+    Args * args;
+    rc_t rc = 0;
+
+    rc = ArgsMakeAndHandle (&args, argc, argv, 0 /*1, Options, sizeof Options / sizeof (&Options[1])*/);
+    if (rc)
+    {
+        LOGERR (klogInt, rc, "Failed to parse parameters");
+        return rc;
+    }
+    else
+    {
+        do
+        {
+            param_block pb;
+            uint32_t pcount;
+
+            rc = ArgsParamCount (args, &pcount);
+            if (rc)
+            {
+                LOGERR (klogInt, rc, "Failed to get paramater count");
+                break;
+            }
+            switch (pcount)
+            {
+            default:
+                rc = MiniUsage (args);
+                goto bailout;
+                
+            case 2:
+                pb.schema_path = SCHEMASPEC;
+                break;
+
+            case 3:
+                pb.schema_path = NULL;
+                break;
+            }
+        
+            rc = ArgsParamValue (args, 0, &pb.file_path);
+            if (rc)
+            {
+                LOGERR (klogInt,rc, "Failed to get file path");
+                break;
+            }
+
+            rc = ArgsParamValue (args, 1, &pb.table_path);
+            if (rc)
+            {
+                LOGERR (klogInt,rc, "Failed to get table path");
+                break;
+            }
+            if (pb.schema_path == NULL)
+            {
+                rc = ArgsParamValue (args, 2, &pb.schema_path);
+                if (rc)
+                {
+                    LOGERR (klogInt,rc, "Failed to get schema path");
+                    break;
+                }
+            }
+            rc = open (&pb);
+
+        } while (0);
+    bailout:
+        ArgsWhack (args);
+    }
+    if (rc)
+        LOGERR (klogFatal, rc, "Failed!");
+    else
+        KStsMsg("Exit success %R");
+
+
+    return rc;
+}
diff --git a/tools/util/test-sra.c b/tools/util/test-sra.c
index 4956951..0ecca77 100644
--- a/tools/util/test-sra.c
+++ b/tools/util/test-sra.c
@@ -20,7 +20,7 @@
 *
 *  Please cite the author in any work or product based on this material.
 *
-* ===========================================================================
+* ==============================================================================
 *
 */
 
@@ -166,10 +166,10 @@ rc_t CC Usage(const Args *args) {
         "  u - print operation system information\n"
         "  c - print configuration\n"
         "  n - print NCBI error report\n"
-        "  k - print curl info\n"
         "  f - print ascp information\n"
         "  F - print verbose ascp information\n"
         "  t - print object types\n");
+//      "  k - print curl info\n"
     if (rc == 0 && rc2 != 0) {
         rc = rc2;
     }
@@ -590,7 +590,7 @@ static rc_t MainQuickResolveQuery(const Main *self, const char *acc) {
     const VPath *remote = NULL;
     const VPath *cache = NULL;
     assert(self && acc);
-    rc = VFSManagerMakePath(self->vMgr, &query, acc);
+    rc = VFSManagerMakePath(self->vMgr, &query, "%s", acc);
     if (rc == 0) {
         if (!self->allowCaching) {
             VResolverCacheEnable(self->resolver, self->cacheState);
@@ -633,7 +633,7 @@ static rc_t MainQuickCheck(const Main *self) {
     const char path[] = "/repository/remote/protected/CGI/resolver-cgi";
     const KConfigNode *node = NULL;
     assert(self);
-    rc = KConfigOpenNodeRead(self->cfg, &node, path);
+    rc = KConfigOpenNodeRead(self->cfg, &node, "%s", path);
     if (rc == 0) {
         OUTMSG(("configuration: found\n"));
     }
@@ -814,7 +814,7 @@ static rc_t _KDirectoryReport(const KDirectory *self,
         size = &dummy;
     }
 
-    *type = KDirectoryPathType(self, name);
+    *type = KDirectoryPathType(self, "%s", name);
 
     if (*type & kptAlias) {
         OUTMSG(("alias|"));
@@ -825,7 +825,7 @@ static rc_t _KDirectoryReport(const KDirectory *self,
     rc = _KDBPathTypePrint("", *type, " ");
 
     if (*type == kptFile) {
-        rc = KDirectoryOpenFileRead(self, &f, name);
+        rc = KDirectoryOpenFileRead(self, &f, "%s", name);
         if (rc != 0) {
             OUTMSG(("KDirectoryOpenFileRead("));
             printString(name);
@@ -861,7 +861,7 @@ static rc_t _VDBManagerReport(const VDBManager *self,
         type = &dummy;
     }
 
-    *type = VDBManagerPathType(self, name);
+    *type = VDBManagerPathType(self, "%s", name);
 
     *type &= ~kptAlias;
 
@@ -879,7 +879,7 @@ rc_t _KDirectoryFileHeaderReport(const KDirectory *self, const char *path)
 
     assert(self && path);
 
-    rc = KDirectoryOpenFileRead(self, &f, path);
+    rc = KDirectoryOpenFileRead(self, &f, "%s", path);
     if (rc != 0) {
         OUTMSG(("KDirectoryOpenFileRead(%s) = %R\n", path, rc));
         return rc;
@@ -937,12 +937,12 @@ static rc_t MainOpenAs(const Main *self, const char *name, bool isDb) {
     }
 
     if (isDb) {
-        rc = VDBManagerOpenDBRead(self->mgr, &db, schema, name);
+        rc = VDBManagerOpenDBRead(self->mgr, &db, schema, "%s", name);
         ReportResetDatabase(name, db);
         OUTMSG(("VDBManagerOpenDBRead(%s) = ", name));
     }
     else {
-        rc = VDBManagerOpenTableRead(self->mgr, &tbl, schema, name);
+        rc = VDBManagerOpenTableRead(self->mgr, &tbl, schema, "%s", name);
         ReportResetTable(name, tbl);
         OUTMSG(("VDBManagerOpenTableRead(%s) = ", name));
     }
@@ -1344,7 +1344,7 @@ static rc_t MainResolve(const Main *self, const KartItem *item,
                     "ncbi-acc:%s?vdb-ctx=refseq", name);
             }
             else {
-                rc = VFSManagerMakePath(self->vMgr, &acc, name);
+                rc = VFSManagerMakePath(self->vMgr, &acc, "%s", name);
             }
             if (rc != 0) {
                 OUTMSG(("VFSManagerMakePath(%s) = %R\n", name, rc));
@@ -1465,7 +1465,7 @@ rc_t MainDepend(const Main *self, const char *name, bool missing)
     }
 
     if (rc == 0) {
-        rc = VDBManagerOpenDBRead(self->mgr, &db, NULL, name);
+        rc = VDBManagerOpenDBRead(self->mgr, &db, NULL, "%s", name);
         if (rc != 0) {
             if (rc == SILENT_RC(rcVFS,rcMgr,rcOpening,rcDirectory,rcNotFound)) {
                 return 0;
@@ -1883,7 +1883,7 @@ rc_t MainExec(const Main *self, const KartItem *item, const char *aArg, ...)
         uint32_t i = 0;
         uint32_t count = 0;
         KNamelist *list = NULL;
-        rc = KDirectoryList(self->dir, &list, NULL, NULL, arg);
+        rc = KDirectoryList(self->dir, &list, NULL, NULL, "%s", arg);
         if (rc != 0) {
             OUTMSG(("KDirectoryList(%s)=%R ", arg, rc));
         }
diff --git a/tools/util/test-sra.vers b/tools/util/test-sra.vers
index cc6c9a4..8e8299d 100644
--- a/tools/util/test-sra.vers
+++ b/tools/util/test-sra.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/util/test-sra.vers.h b/tools/util/test-sra.vers.h
new file mode 100644
index 0000000..a76cf32
--- /dev/null
+++ b/tools/util/test-sra.vers.h
@@ -0,0 +1 @@
+#define TEST_SRA_VERS 0x02040000
diff --git a/tools/util/testld.vers b/tools/util/testld.vers
index cc6c9a4..8e8299d 100644
--- a/tools/util/testld.vers
+++ b/tools/util/testld.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/util/txt2kdb.c b/tools/util/txt2kdb.c
index d8daad9..498994e 100644
--- a/tools/util/txt2kdb.c
+++ b/tools/util/txt2kdb.c
@@ -197,7 +197,7 @@ rc_t txt2kdb_kfs (void)
     }
     else
     {
-        rc = KDirectoryOpenFileRead (G.dir, &G.txt, G.txtpath);
+        rc = KDirectoryOpenFileRead (G.dir, &G.txt, "%s", G.txtpath);
         if (rc != 0)
         {
             G.txt = NULL;
@@ -217,7 +217,7 @@ rc_t txt2kdb_kfs (void)
                 KPathType kpt;
                 const char * err = "";
 
-                kpt = KDirectoryPathType (G.dir, G.colpath) & ~ kptAlias;
+                kpt = KDirectoryPathType (G.dir, "%s", G.colpath) & ~ kptAlias;
                 kcm = kcmCreate;
 /* Force means replace if exists */
 /* Append means open in append mode if it exists */
@@ -260,7 +260,7 @@ rc_t txt2kdb_kfs (void)
                 }
                 if (rc == 0)
                 {
-                    rc = KDBManagerCreateColumn (G.mgr, &G.col, kcm, kcsNone, 0, G.colpath);
+                    rc = KDBManagerCreateColumn (G.mgr, &G.col, kcm, kcsNone, 0, "%s", G.colpath);
                     if (rc)
                         err = "Manager can not open column";
                 }
diff --git a/tools/util/txt2kdb.vers b/tools/util/txt2kdb.vers
index cc6c9a4..8e8299d 100644
--- a/tools/util/txt2kdb.vers
+++ b/tools/util/txt2kdb.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/util/vdb-lock.c b/tools/util/vdb-lock.c
index 2c82a18..a440e4f 100644
--- a/tools/util/vdb-lock.c
+++ b/tools/util/vdb-lock.c
@@ -137,7 +137,7 @@ rc_t CC KMain ( int argc, char *argv [] )
                         LogErr ( klogInt, rc, "failed to open VDB manager" );
                     else
                     {
-                        rc = VDBManagerLock ( mgr, target );
+                        rc = VDBManagerLock ( mgr, "%s", target );
                         if ( rc == 0 )
                             pLogMsg ( klogInfo, "locked '$(target)'", "target=%s", target );
                         else switch ( GetRCState ( rc ) )
diff --git a/tools/util/vdb-lock.vers b/tools/util/vdb-lock.vers
index cc6c9a4..8e8299d 100644
--- a/tools/util/vdb-lock.vers
+++ b/tools/util/vdb-lock.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/util/vdb-lock.vers.h b/tools/util/vdb-lock.vers.h
new file mode 100644
index 0000000..33b803c
--- /dev/null
+++ b/tools/util/vdb-lock.vers.h
@@ -0,0 +1 @@
+#define VDB_LOCK_VERS 0x02040002
diff --git a/tools/util/vdb-passwd.vers b/tools/util/vdb-passwd.vers
index cc6c9a4..8e8299d 100644
--- a/tools/util/vdb-passwd.vers
+++ b/tools/util/vdb-passwd.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/util/vdb-passwd.vers.h b/tools/util/vdb-passwd.vers.h
new file mode 100644
index 0000000..45ef0cc
--- /dev/null
+++ b/tools/util/vdb-passwd.vers.h
@@ -0,0 +1 @@
+#define VDB_PASSWD_VERS 0x02040002
diff --git a/tools/util/vdb-unlock.c b/tools/util/vdb-unlock.c
index cdcba36..ca481b6 100644
--- a/tools/util/vdb-unlock.c
+++ b/tools/util/vdb-unlock.c
@@ -139,7 +139,7 @@ rc_t CC KMain ( int argc, char *argv [] )
                         LogErr ( klogInt, rc, "failed to open VDB manager" );
                     else
                     {
-                        rc = VDBManagerUnlock ( mgr, target );
+                        rc = VDBManagerUnlock ( mgr, "%s", target );
                         if ( rc == 0 )
                             pLogMsg ( klogInfo, "unlocked '$(target)'", "target=%s", target );
                         else switch ( GetRCState ( rc ) )
diff --git a/tools/util/vdb-unlock.vers b/tools/util/vdb-unlock.vers
index cc6c9a4..8e8299d 100644
--- a/tools/util/vdb-unlock.vers
+++ b/tools/util/vdb-unlock.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/util/vdb-unlock.vers.h b/tools/util/vdb-unlock.vers.h
new file mode 100644
index 0000000..8f72686
--- /dev/null
+++ b/tools/util/vdb-unlock.vers.h
@@ -0,0 +1 @@
+#define VDB_UNLOCK_VERS 0x02040002
diff --git a/tools/util/win/PrintOS.c b/tools/util/win/PrintOS.c
index 3b8aae6..ca1d402 100644
--- a/tools/util/win/PrintOS.c
+++ b/tools/util/win/PrintOS.c
@@ -24,7 +24,7 @@
 *
 */
 
-#include "test-sra-priv.h" /* PrintOS */
+#include "../test-sra-priv.h" /* PrintOS */
 
 #include <klib/out.h> /* OUTMSG */
 
diff --git a/tools/util/win/syspass.c b/tools/util/win/syspass.c
index 745b0cc..b6d943b 100644
--- a/tools/util/win/syspass.c
+++ b/tools/util/win/syspass.c
@@ -24,7 +24,7 @@
 *
 */
 
-#include "syspass-priv.h" /* get_pass */
+#include "../syspass-priv.h" /* get_pass */
 
 #include <klib/rc.h>
 
diff --git a/tools/vcf-loader/Makefile b/tools/vcf-loader/Makefile
new file mode 100644
index 0000000..f20f0f6
--- /dev/null
+++ b/tools/vcf-loader/Makefile
@@ -0,0 +1,118 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+default: std
+
+TOP ?= $(abspath ../..)
+MODULE = tools/vcf-loader
+
+INT_LIBS = \
+	libvcfloader
+    
+ALL_LIBS = \
+	$(INT_LIBS) \
+	$(EXT_LIBS)
+
+EXT_TOOLS = \
+
+ALL_TOOLS = \
+	$(INT_TOOLS) \
+	$(EXT_TOOLS)    
+
+include $(TOP)/build/Makefile.env
+
+#-------------------------------------------------------------------------------
+# outer targets
+#
+all std: vers-includes 
+	@ $(MAKE_CMD) $(TARGDIR)/std
+
+$(INT_LIBS): vers-includes
+	@ $(MAKE_CMD) $(ILIBDIR)/$@
+
+$(EXT_TOOLS): vers-includes
+	@ $(MAKE_CMD) $(BINDIR)/$@    
+
+ALL_TOOLS = \
+	$(INT_TOOLS) \
+	$(EXT_TOOLS)
+
+.PHONY: all std $(ALL_LIBS) 
+
+#-------------------------------------------------------------------------------
+# std
+#
+$(TARGDIR)/std: \
+	$(addprefix $(ILIBDIR)/,$(INT_LIBS)) \
+	$(addprefix $(LIBDIR)/,$(EXT_LIBS)) \
+	$(addprefix $(BINDIR)/,$(ALL_TOOLS))
+
+.PHONY: $(TARGDIR)/std
+
+#-------------------------------------------------------------------------------
+# vers-includes
+#
+$(TARGDIR)/vers-includes: $(addsuffix .vers.h,$(ALL_TOOLS))
+
+.PHONY: $(TARGDIR)/vers-includes
+
+#-------------------------------------------------------------------------------
+# clean
+#
+INTERM_SRC = \
+	$(SRCDIR)/vcf-lex.c \
+	$(SRCDIR)/vcf-grammar.c \
+	$(SRCDIR)/vcf-grammar.h 
+
+clean: stdclean
+
+.PHONY: clean
+
+.PRECIOUS: $(INTERM_SRC)
+
+#-------------------------------------------------------------------------------
+# libvcfloader
+#
+$(ILIBDIR)/libvcfloader: $(ILIBDIR)/libvcfloader.$(LIBX)
+
+LIBVCF_SRC = \
+	vcf-grammar \
+	vcf-lex \
+    vcf-reader \
+    vcf-database
+    
+$(SRCDIR)/vcf-grammar.c $(SRCDIR)/vcf-grammar.h: $(SRCDIR)/vcf-grammar.y
+	$(YACC) -o $(SRCDIR)/vcf-grammar.c --defines=$(SRCDIR)/vcf-grammar.h -v $^    
+
+LIBVCF_OBJ = \
+	$(addsuffix .$(LOBX),$(LIBVCF_SRC))
+
+LIBVCF_LIB = \
+
+$(ILIBDIR)/libvcfloader.$(SHLX): $(INTERM_SRC) $(LIBVCF_OBJ)
+	$(LD) --dlib -o $@ $^ $(LIBVCF_LIB)
+
+$(ILIBDIR)/libvcfloader.$(LIBX): $(INTERM_SRC) $(LIBVCF_OBJ)
+	$(LD) --slib -o $@ $^ $(LIBVCF_LIB)
+
diff --git a/tools/vcf-loader/vcf-database.c b/tools/vcf-loader/vcf-database.c
new file mode 100644
index 0000000..b4ec7ca
--- /dev/null
+++ b/tools/vcf-loader/vcf-database.c
@@ -0,0 +1,165 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ * 
+ */
+
+#include "vcf-database.h"
+
+#include <vdb/manager.h>
+#include <vdb/database.h>
+#include <vdb/table.h>
+#include <vdb/cursor.h>
+
+#include <align/writer-reference.h>
+
+#include "vcf-reader.h"
+
+static rc_t SaveVariants        ( const VcfReader* reader, const char configPath[], VDatabase* db, VDBManager* dbMgr );
+static rc_t SaveVariantPhases   ( const VcfReader* reader, VDatabase* db, VDBManager* dbMgr );
+static rc_t SaveAlignments      ( const VcfReader* reader, VDatabase* db, VDBManager* dbMgr );
+
+rc_t VcfDatabaseSave ( const struct VcfReader* reader, const char configPath[], VDatabase* db )
+{
+    VDBManager* dbMgr;
+    rc_t rc = VDatabaseOpenManagerUpdate(db, &dbMgr);
+    if (rc == 0)
+    {
+        rc_t rc2;
+        
+        rc = SaveVariants(reader, configPath, db, dbMgr);
+        if (rc == 0)
+            rc = SaveVariantPhases(reader, db, dbMgr);
+        if (rc == 0)
+            rc = SaveAlignments(reader, db, dbMgr);
+            
+        rc2 = VDBManagerRelease(dbMgr);
+        if (rc == 0)
+            rc = rc2;
+    }
+    return rc;
+}
+
+rc_t SaveVariants( const VcfReader* reader, const char configPath[], VDatabase* db, VDBManager* dbMgr )
+{
+    VTable* tbl;
+    rc_t rc = VDatabaseCreateTable(db, &tbl, "VARIANT", kcmCreate | kcmMD5, "VARIANT");
+    if (rc == 0)
+    {
+        rc_t rc2;
+        VCursor *cur;
+        rc = VTableCreateCursorWrite( tbl, &cur, kcmInsert );
+        if (rc == 0)
+        {
+            uint32_t ref_id_idx, position_idx, length_idx, sequence_idx;
+            rc = VCursorAddColumn( cur, &ref_id_idx, "ref_id" );
+            if (rc == 0) rc = VCursorAddColumn( cur, &position_idx, "position" );
+            if (rc == 0) rc = VCursorAddColumn( cur, &length_idx, "length" );
+            if (rc == 0) rc = VCursorAddColumn( cur, &sequence_idx, "sequence" );
+
+            if (rc == 0)
+            {
+                rc = VCursorOpen( cur );
+                if (rc == 0)
+                {
+                    uint32_t count;
+                    rc_t rc = VcfReaderGetDataLineCount(reader, &count);
+                    if (rc == 0)
+                    {   
+                        const ReferenceMgr* refMgr;
+                        rc = ReferenceMgr_Make(&refMgr, db, dbMgr, 0, configPath, NULL, 0, 0, 0);
+                        if (rc == 0)
+                        {
+                            uint32_t i;
+                            for (i = 0; i < count; ++i)
+                            {
+                                const VcfDataLine* line;
+                                rc = VcfReaderGetDataLine(reader, i, &line);            
+
+                                if (rc == 0)
+                                {
+                                    const ReferenceSeq* seq;
+                                    #define MAX_CHROMOSOME_NAME_LENGTH 1024
+                                    char chromName[MAX_CHROMOSOME_NAME_LENGTH];
+                                    string_copy(chromName, sizeof(chromName), line->chromosome.addr, line->chromosome.size);
+                                    rc = (ReferenceMgr_GetSeq(refMgr, &seq, chromName));
+                                    if (rc == 0)
+                                    {
+                                        int64_t ref_id;
+                                        INSDC_coord_zero ref_start;
+                                        rc = ReferenceSeq_TranslateOffset_int(seq, line->position, &ref_id, &ref_start, NULL);
+                                        if (rc == 0)
+                                        {
+                                            rc = VCursorOpenRow( cur );
+                                        
+                                            if (rc == 0) 
+                                                rc = VCursorWrite( cur, ref_id_idx,    sizeof(ref_id) * 8, &ref_id, 0, 1);
+                                            if (rc == 0) 
+                                                rc = VCursorWrite( cur, position_idx,  sizeof(ref_start) * 8, &ref_start, 0, 1);
+                                            if (rc == 0) 
+                                                rc = VCursorWrite( cur, length_idx,    sizeof(line->altBases.len) * 8,   &line->altBases.len,   0, 1);
+                                            if (rc == 0) 
+                                                rc = VCursorWrite( cur, sequence_idx,  line->altBases.len * 8,    line->altBases.addr,    0, 1);
+                                        }
+                                        rc2 = ReferenceSeq_Release(seq);
+                                        if (rc == 0)
+                                            rc = rc2;
+                                    }    
+                                    if (rc == 0) rc = VCursorCommitRow( cur );
+                                    if (rc == 0) rc = VCursorCloseRow( cur );
+                                }
+                                if (rc != 0)
+                                    break;
+                            }
+                            rc2 = ReferenceMgr_Release(refMgr, rc == 0, NULL, false, NULL);
+                            if (rc == 0)
+                                rc = rc2;
+                        }
+                    }
+                    if (rc == 0)
+                        rc = VCursorCommit( cur );
+                }
+            }
+            rc2 = VCursorRelease(cur);
+            if (rc == 0)
+                rc = rc2;
+        }
+        
+        rc2 = VTableRelease(tbl);
+        if (rc == 0)
+            rc = rc2;
+    }
+            
+    return rc;
+}
+
+rc_t SaveVariantPhases( const VcfReader* reader, VDatabase* db, VDBManager* dbMgr )
+{
+    return 0;
+}
+
+rc_t SaveAlignments( const VcfReader* reader, VDatabase* db, VDBManager* dbMgr )
+{
+    return 0;
+}
+
diff --git a/tools/vcf-loader/vcf-database.h b/tools/vcf-loader/vcf-database.h
new file mode 100644
index 0000000..fb3bb4c
--- /dev/null
+++ b/tools/vcf-loader/vcf-database.h
@@ -0,0 +1,40 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+
+#ifndef _h_vcf_database_
+#define _h_vcf_database_
+
+#include <klib/rc.h>
+
+struct VcfReader;
+struct VDatabase;
+
+/*
+ * Save into a database
+ */
+extern rc_t VcfDatabaseSave ( const struct VcfReader* reader, const char configPath[], struct VDatabase* db );
+
+#endif /* _h_vcf_database_ */
diff --git a/tools/vcf-loader/vcf-grammar.c b/tools/vcf-loader/vcf-grammar.c
new file mode 100644
index 0000000..5a9f56f
--- /dev/null
+++ b/tools/vcf-loader/vcf-grammar.c
@@ -0,0 +1,1686 @@
+/* A Bison parser, made by GNU Bison 2.5.  */
+
+/* Bison implementation for Yacc-like parsers in C
+   
+      Copyright (C) 1984, 1989-1990, 2000-2011 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 3 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, see <http://www.gnu.org/licenses/>.  */
+
+/* As a special exception, you may create a larger work that contains
+   part or all of the Bison parser skeleton and distribute that work
+   under terms of your choice, so long as that work isn't itself a
+   parser generator using the skeleton or a modified version thereof
+   as a parser skeleton.  Alternatively, if you modify or redistribute
+   the parser skeleton itself, you may (at your option) remove this
+   special exception, which will cause the skeleton and the resulting
+   Bison output files to be licensed under the GNU General Public
+   License without this special exception.
+   
+   This special exception was added by the Free Software Foundation in
+   version 2.2 of Bison.  */
+
+/* C LALR(1) parser skeleton written by Richard Stallman, by
+   simplifying the original so-called "semantic" parser.  */
+
+/* All symbols defined below should begin with yy or YY, to avoid
+   infringing on user name space.  This should be done even for local
+   variables, as they might otherwise be expanded by user macros.
+   There are some unavoidable exceptions within include files to
+   define necessary library symbols; they are noted "INFRINGES ON
+   USER NAME SPACE" below.  */
+
+/* Identify Bison output.  */
+#define YYBISON 1
+
+/* Bison version.  */
+#define YYBISON_VERSION "2.5"
+
+/* Skeleton name.  */
+#define YYSKELETON_NAME "yacc.c"
+
+/* Pure parsers.  */
+#define YYPURE 1
+
+/* Push parsers.  */
+#define YYPUSH 0
+
+/* Pull parsers.  */
+#define YYPULL 1
+
+/* Using locations.  */
+#define YYLSP_NEEDED 0
+
+/* Substitute the variable and function names.  */
+#define yyparse         VCF_parse
+#define yylex           VCF_lex
+#define yyerror         VCF_error
+#define yylval          VCF_lval
+#define yychar          VCF_char
+#define yydebug         VCF_debug
+#define yynerrs         VCF_nerrs
+
+
+/* Copy the first part of user declarations.  */
+
+  
+    #include "vcf-parse.h"
+
+    #define YYSTYPE VCFToken
+    #define YYLEX_PARAM pb->scanner
+    #define YYDEBUG 1
+
+    #include "vcf-grammar.h"
+
+
+
+/* Enabling traces.  */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+
+/* Enabling verbose error messages.  */
+#ifdef YYERROR_VERBOSE
+# undef YYERROR_VERBOSE
+# define YYERROR_VERBOSE 1
+#else
+# define YYERROR_VERBOSE 1
+#endif
+
+/* Enabling the token table.  */
+#ifndef YYTOKEN_TABLE
+# define YYTOKEN_TABLE 0
+#endif
+
+
+/* Tokens.  */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+   /* Put the tokens into the symbol table, so that GDB and other debuggers
+      know about them.  */
+   enum yytokentype {
+     vcfENDOFTEXT = 0,
+     vcfMETAKEY_FORMAT = 258,
+     vcfMETAKEY = 259,
+     vcfMETAVALUE = 260,
+     vcfHEADERITEM = 261,
+     vcfDATAITEM = 262,
+     vcfENDLINE = 263
+   };
+#endif
+
+
+
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+typedef int YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+
+/* Copy the second part of user declarations.  */
+
+
+
+#ifdef short
+# undef short
+#endif
+
+#ifdef YYTYPE_UINT8
+typedef YYTYPE_UINT8 yytype_uint8;
+#else
+typedef unsigned char yytype_uint8;
+#endif
+
+#ifdef YYTYPE_INT8
+typedef YYTYPE_INT8 yytype_int8;
+#elif (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+typedef signed char yytype_int8;
+#else
+typedef short int yytype_int8;
+#endif
+
+#ifdef YYTYPE_UINT16
+typedef YYTYPE_UINT16 yytype_uint16;
+#else
+typedef unsigned short int yytype_uint16;
+#endif
+
+#ifdef YYTYPE_INT16
+typedef YYTYPE_INT16 yytype_int16;
+#else
+typedef short int yytype_int16;
+#endif
+
+#ifndef YYSIZE_T
+# ifdef __SIZE_TYPE__
+#  define YYSIZE_T __SIZE_TYPE__
+# elif defined size_t
+#  define YYSIZE_T size_t
+# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+#  define YYSIZE_T size_t
+# else
+#  define YYSIZE_T unsigned int
+# endif
+#endif
+
+#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
+
+#ifndef YY_
+# if defined YYENABLE_NLS && YYENABLE_NLS
+#  if ENABLE_NLS
+#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
+#   define YY_(msgid) dgettext ("bison-runtime", msgid)
+#  endif
+# endif
+# ifndef YY_
+#  define YY_(msgid) msgid
+# endif
+#endif
+
+/* Suppress unused-variable warnings by "using" E.  */
+#if ! defined lint || defined __GNUC__
+# define YYUSE(e) ((void) (e))
+#else
+# define YYUSE(e) /* empty */
+#endif
+
+/* Identity function, used to suppress warnings about constant conditions.  */
+#ifndef lint
+# define YYID(n) (n)
+#else
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static int
+YYID (int yyi)
+#else
+static int
+YYID (yyi)
+    int yyi;
+#endif
+{
+  return yyi;
+}
+#endif
+
+#if ! defined yyoverflow || YYERROR_VERBOSE
+
+/* The parser invokes alloca or malloc; define the necessary symbols.  */
+
+# ifdef YYSTACK_USE_ALLOCA
+#  if YYSTACK_USE_ALLOCA
+#   ifdef __GNUC__
+#    define YYSTACK_ALLOC __builtin_alloca
+#   elif defined __BUILTIN_VA_ARG_INCR
+#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
+#   elif defined _AIX
+#    define YYSTACK_ALLOC __alloca
+#   elif defined _MSC_VER
+#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
+#    define alloca _alloca
+#   else
+#    define YYSTACK_ALLOC alloca
+#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+#     ifndef EXIT_SUCCESS
+#      define EXIT_SUCCESS 0
+#     endif
+#    endif
+#   endif
+#  endif
+# endif
+
+# ifdef YYSTACK_ALLOC
+   /* Pacify GCC's `empty if-body' warning.  */
+#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
+#  ifndef YYSTACK_ALLOC_MAXIMUM
+    /* The OS might guarantee only one guard page at the bottom of the stack,
+       and a page size can be as small as 4096 bytes.  So we cannot safely
+       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
+       to allow for a few compiler-allocated temporary stack slots.  */
+#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
+#  endif
+# else
+#  define YYSTACK_ALLOC YYMALLOC
+#  define YYSTACK_FREE YYFREE
+#  ifndef YYSTACK_ALLOC_MAXIMUM
+#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
+#  endif
+#  if (defined __cplusplus && ! defined EXIT_SUCCESS \
+       && ! ((defined YYMALLOC || defined malloc) \
+	     && (defined YYFREE || defined free)))
+#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+#   ifndef EXIT_SUCCESS
+#    define EXIT_SUCCESS 0
+#   endif
+#  endif
+#  ifndef YYMALLOC
+#   define YYMALLOC malloc
+#   if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+#   endif
+#  endif
+#  ifndef YYFREE
+#   define YYFREE free
+#   if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+void free (void *); /* INFRINGES ON USER NAME SPACE */
+#   endif
+#  endif
+# endif
+#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
+
+
+#if (! defined yyoverflow \
+     && (! defined __cplusplus \
+	 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+
+/* A type that is properly aligned for any stack member.  */
+union yyalloc
+{
+  yytype_int16 yyss_alloc;
+  YYSTYPE yyvs_alloc;
+};
+
+/* The size of the maximum gap between one aligned stack and the next.  */
+# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
+
+/* The size of an array large to enough to hold all stacks, each with
+   N elements.  */
+# define YYSTACK_BYTES(N) \
+     ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
+      + YYSTACK_GAP_MAXIMUM)
+
+# define YYCOPY_NEEDED 1
+
+/* Relocate STACK from its old location to the new one.  The
+   local variables YYSIZE and YYSTACKSIZE give the old and new number of
+   elements in the stack, and YYPTR gives the new location of the
+   stack.  Advance YYPTR to a properly aligned location for the next
+   stack.  */
+# define YYSTACK_RELOCATE(Stack_alloc, Stack)				\
+    do									\
+      {									\
+	YYSIZE_T yynewbytes;						\
+	YYCOPY (&yyptr->Stack_alloc, Stack, yysize);			\
+	Stack = &yyptr->Stack_alloc;					\
+	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+	yyptr += yynewbytes / sizeof (*yyptr);				\
+      }									\
+    while (YYID (0))
+
+#endif
+
+#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
+/* Copy COUNT objects from FROM to TO.  The source and destination do
+   not overlap.  */
+# ifndef YYCOPY
+#  if defined __GNUC__ && 1 < __GNUC__
+#   define YYCOPY(To, From, Count) \
+      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
+#  else
+#   define YYCOPY(To, From, Count)		\
+      do					\
+	{					\
+	  YYSIZE_T yyi;				\
+	  for (yyi = 0; yyi < (Count); yyi++)	\
+	    (To)[yyi] = (From)[yyi];		\
+	}					\
+      while (YYID (0))
+#  endif
+# endif
+#endif /* !YYCOPY_NEEDED */
+
+/* YYFINAL -- State number of the termination state.  */
+#define YYFINAL  6
+/* YYLAST -- Last index in YYTABLE.  */
+#define YYLAST   28
+
+/* YYNTOKENS -- Number of terminals.  */
+#define YYNTOKENS  13
+/* YYNNTS -- Number of nonterminals.  */
+#define YYNNTS  14
+/* YYNRULES -- Number of rules.  */
+#define YYNRULES  23
+/* YYNRULES -- Number of states.  */
+#define YYNSTATES  41
+
+/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
+#define YYUNDEFTOK  2
+#define YYMAXUTOK   263
+
+#define YYTRANSLATE(YYX)						\
+  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+
+/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
+static const yytype_uint8 yytranslate[] =
+{
+       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,    12,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+      10,     9,    11,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
+       5,     6,     7,     8
+};
+
+#if YYDEBUG
+/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
+   YYRHS.  */
+static const yytype_uint8 yyprhs[] =
+{
+       0,     0,     3,     9,    11,    12,    17,    19,    20,    22,
+      25,    30,    31,    39,    41,    45,    49,    52,    54,    57,
+      59,    62,    65,    67
+};
+
+/* YYRHS -- A `-1'-separated list of the rules' RHS.  */
+static const yytype_int8 yyrhs[] =
+{
+      14,     0,    -1,    15,    16,    22,    24,     0,    -1,     1,
+      -1,    -1,     3,     9,     5,     8,    -1,    17,    -1,    -1,
+      18,    -1,    17,    18,    -1,     4,     9,     5,     8,    -1,
+      -1,     4,     9,    10,    19,    20,    11,     8,    -1,    21,
+      -1,    20,    12,    21,    -1,     4,     9,     5,    -1,    23,
+       8,    -1,     6,    -1,    23,     6,    -1,    25,    -1,    24,
+      25,    -1,    26,     8,    -1,     7,    -1,    26,     7,    -1
+};
+
+/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
+static const yytype_uint8 yyrline[] =
+{
+       0,    54,    54,    61,    63,    67,    71,    72,    76,    77,
+      81,    82,    82,    86,    87,    91,    95,    99,   100,   104,
+     105,   109,   113,   114
+};
+#endif
+
+#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
+/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
+static const char *const yytname[] =
+{
+  "vcfENDOFTEXT", "error", "$undefined", "vcfMETAKEY_FORMAT",
+  "vcfMETAKEY", "vcfMETAVALUE", "vcfHEADERITEM", "vcfDATAITEM",
+  "vcfENDLINE", "'='", "'<'", "'>'", "','", "$accept", "vcfFile",
+  "fileFormatLine", "metaLinesOpt", "metaLines", "metaLine", "$@1",
+  "keyValuePairs", "keyValue", "headerLine", "headerItems", "dataLines",
+  "dataLine", "dataItems", 0
+};
+#endif
+
+# ifdef YYPRINT
+/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
+   token YYLEX-NUM.  */
+static const yytype_uint16 yytoknum[] =
+{
+       0,   256,   257,   258,   259,   260,   261,   262,   263,    61,
+      60,    62,    44
+};
+# endif
+
+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
+static const yytype_uint8 yyr1[] =
+{
+       0,    13,    14,    14,    14,    15,    16,    16,    17,    17,
+      18,    19,    18,    20,    20,    21,    22,    23,    23,    24,
+      24,    25,    26,    26
+};
+
+/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
+static const yytype_uint8 yyr2[] =
+{
+       0,     2,     5,     1,     0,     4,     1,     0,     1,     2,
+       4,     0,     7,     1,     3,     3,     2,     1,     2,     1,
+       2,     2,     1,     2
+};
+
+/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
+   Performed when YYTABLE doesn't specify something else to do.  Zero
+   means the default is an error.  */
+static const yytype_uint8 yydefact[] =
+{
+       0,     3,     0,     0,     7,     0,     1,     0,     0,     6,
+       8,     0,     0,    17,     0,     0,     9,     5,     0,    11,
+      22,     0,    19,     0,    18,    16,    10,     0,     2,    20,
+      23,    21,     0,     0,    13,     0,     0,     0,    15,    12,
+      14
+};
+
+/* YYDEFGOTO[NTERM-NUM].  */
+static const yytype_int8 yydefgoto[] =
+{
+      -1,     3,     4,     8,     9,    10,    27,    33,    34,    14,
+      15,    21,    22,    23
+};
+
+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+   STATE-NUM.  */
+#define YYPACT_NINF -14
+static const yytype_int8 yypact[] =
+{
+       2,   -14,    -5,     8,     6,     9,   -14,    10,    11,     6,
+     -14,    12,    -4,   -14,    14,     3,   -14,   -14,    15,   -14,
+     -14,     0,   -14,     5,   -14,   -14,   -14,    18,   -14,   -14,
+     -14,   -14,    16,     4,   -14,    13,    19,    18,   -14,   -14,
+     -14
+};
+
+/* YYPGOTO[NTERM-NUM].  */
+static const yytype_int8 yypgoto[] =
+{
+     -14,   -14,   -14,   -14,   -14,    17,   -14,   -14,   -13,   -14,
+     -14,   -14,     7,   -14
+};
+
+/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
+   positive, shift that token.  If negative, reduce the rule which
+   number is the opposite.  If YYTABLE_NINF, syntax error.  */
+#define YYTABLE_NINF -5
+static const yytype_int8 yytable[] =
+{
+      28,    18,    -4,     1,     5,     2,    19,    20,     6,    24,
+       7,    25,    30,    31,    11,    36,    37,    13,    38,    12,
+      17,    20,    32,    26,    40,    35,    16,    39,    29
+};
+
+#define yypact_value_is_default(yystate) \
+  ((yystate) == (-14))
+
+#define yytable_value_is_error(yytable_value) \
+  YYID (0)
+
+static const yytype_uint8 yycheck[] =
+{
+       0,     5,     0,     1,     9,     3,    10,     7,     0,     6,
+       4,     8,     7,     8,     5,    11,    12,     6,     5,     9,
+       8,     7,     4,     8,    37,     9,     9,     8,    21
+};
+
+/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+   symbol of state STATE-NUM.  */
+static const yytype_uint8 yystos[] =
+{
+       0,     1,     3,    14,    15,     9,     0,     4,    16,    17,
+      18,     5,     9,     6,    22,    23,    18,     8,     5,    10,
+       7,    24,    25,    26,     6,     8,     8,    19,     0,    25,
+       7,     8,     4,    20,    21,     9,    11,    12,     5,     8,
+      21
+};
+
+#define yyerrok		(yyerrstatus = 0)
+#define yyclearin	(yychar = YYEMPTY)
+#define YYEMPTY		(-2)
+#define YYEOF		0
+
+#define YYACCEPT	goto yyacceptlab
+#define YYABORT		goto yyabortlab
+#define YYERROR		goto yyerrorlab
+
+
+/* Like YYERROR except do call yyerror.  This remains here temporarily
+   to ease the transition to the new meaning of YYERROR, for GCC.
+   Once GCC version 2 has supplanted version 1, this can go.  However,
+   YYFAIL appears to be in use.  Nevertheless, it is formally deprecated
+   in Bison 2.4.2's NEWS entry, where a plan to phase it out is
+   discussed.  */
+
+#define YYFAIL		goto yyerrlab
+#if defined YYFAIL
+  /* This is here to suppress warnings from the GCC cpp's
+     -Wunused-macros.  Normally we don't worry about that warning, but
+     some users do, and we want to make it easy for users to remove
+     YYFAIL uses, which will produce warnings from Bison 2.5.  */
+#endif
+
+#define YYRECOVERING()  (!!yyerrstatus)
+
+#define YYBACKUP(Token, Value)					\
+do								\
+  if (yychar == YYEMPTY && yylen == 1)				\
+    {								\
+      yychar = (Token);						\
+      yylval = (Value);						\
+      YYPOPSTACK (1);						\
+      goto yybackup;						\
+    }								\
+  else								\
+    {								\
+      yyerror (pb, YY_("syntax error: cannot back up")); \
+      YYERROR;							\
+    }								\
+while (YYID (0))
+
+
+#define YYTERROR	1
+#define YYERRCODE	256
+
+
+/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
+   If N is 0, then set CURRENT to the empty location which ends
+   the previous symbol: RHS[0] (always defined).  */
+
+#define YYRHSLOC(Rhs, K) ((Rhs)[K])
+#ifndef YYLLOC_DEFAULT
+# define YYLLOC_DEFAULT(Current, Rhs, N)				\
+    do									\
+      if (YYID (N))                                                    \
+	{								\
+	  (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;	\
+	  (Current).first_column = YYRHSLOC (Rhs, 1).first_column;	\
+	  (Current).last_line    = YYRHSLOC (Rhs, N).last_line;		\
+	  (Current).last_column  = YYRHSLOC (Rhs, N).last_column;	\
+	}								\
+      else								\
+	{								\
+	  (Current).first_line   = (Current).last_line   =		\
+	    YYRHSLOC (Rhs, 0).last_line;				\
+	  (Current).first_column = (Current).last_column =		\
+	    YYRHSLOC (Rhs, 0).last_column;				\
+	}								\
+    while (YYID (0))
+#endif
+
+
+/* This macro is provided for backward compatibility. */
+
+#ifndef YY_LOCATION_PRINT
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+#endif
+
+
+/* YYLEX -- calling `yylex' with the right arguments.  */
+
+#ifdef YYLEX_PARAM
+# define YYLEX yylex (&yylval, YYLEX_PARAM)
+#else
+# define YYLEX yylex (&yylval, pb)
+#endif
+
+/* Enable debugging if requested.  */
+#if YYDEBUG
+
+# ifndef YYFPRINTF
+#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
+#  define YYFPRINTF fprintf
+# endif
+
+# define YYDPRINTF(Args)			\
+do {						\
+  if (yydebug)					\
+    YYFPRINTF Args;				\
+} while (YYID (0))
+
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)			  \
+do {									  \
+  if (yydebug)								  \
+    {									  \
+      YYFPRINTF (stderr, "%s ", Title);					  \
+      yy_symbol_print (stderr,						  \
+		  Type, Value, pb); \
+      YYFPRINTF (stderr, "\n");						  \
+    }									  \
+} while (YYID (0))
+
+
+/*--------------------------------.
+| Print this symbol on YYOUTPUT.  |
+`--------------------------------*/
+
+/*ARGSUSED*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static void
+yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, VCFParseBlock* pb)
+#else
+static void
+yy_symbol_value_print (yyoutput, yytype, yyvaluep, pb)
+    FILE *yyoutput;
+    int yytype;
+    YYSTYPE const * const yyvaluep;
+    VCFParseBlock* pb;
+#endif
+{
+  if (!yyvaluep)
+    return;
+  YYUSE (pb);
+# ifdef YYPRINT
+  if (yytype < YYNTOKENS)
+    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+# else
+  YYUSE (yyoutput);
+# endif
+  switch (yytype)
+    {
+      default:
+	break;
+    }
+}
+
+
+/*--------------------------------.
+| Print this symbol on YYOUTPUT.  |
+`--------------------------------*/
+
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static void
+yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, VCFParseBlock* pb)
+#else
+static void
+yy_symbol_print (yyoutput, yytype, yyvaluep, pb)
+    FILE *yyoutput;
+    int yytype;
+    YYSTYPE const * const yyvaluep;
+    VCFParseBlock* pb;
+#endif
+{
+  if (yytype < YYNTOKENS)
+    YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
+  else
+    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
+
+  yy_symbol_value_print (yyoutput, yytype, yyvaluep, pb);
+  YYFPRINTF (yyoutput, ")");
+}
+
+/*------------------------------------------------------------------.
+| yy_stack_print -- Print the state stack from its BOTTOM up to its |
+| TOP (included).                                                   |
+`------------------------------------------------------------------*/
+
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static void
+yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
+#else
+static void
+yy_stack_print (yybottom, yytop)
+    yytype_int16 *yybottom;
+    yytype_int16 *yytop;
+#endif
+{
+  YYFPRINTF (stderr, "Stack now");
+  for (; yybottom <= yytop; yybottom++)
+    {
+      int yybot = *yybottom;
+      YYFPRINTF (stderr, " %d", yybot);
+    }
+  YYFPRINTF (stderr, "\n");
+}
+
+# define YY_STACK_PRINT(Bottom, Top)				\
+do {								\
+  if (yydebug)							\
+    yy_stack_print ((Bottom), (Top));				\
+} while (YYID (0))
+
+
+/*------------------------------------------------.
+| Report that the YYRULE is going to be reduced.  |
+`------------------------------------------------*/
+
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static void
+yy_reduce_print (YYSTYPE *yyvsp, int yyrule, VCFParseBlock* pb)
+#else
+static void
+yy_reduce_print (yyvsp, yyrule, pb)
+    YYSTYPE *yyvsp;
+    int yyrule;
+    VCFParseBlock* pb;
+#endif
+{
+  int yynrhs = yyr2[yyrule];
+  int yyi;
+  unsigned long int yylno = yyrline[yyrule];
+  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
+	     yyrule - 1, yylno);
+  /* The symbols being reduced.  */
+  for (yyi = 0; yyi < yynrhs; yyi++)
+    {
+      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
+      yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
+		       &(yyvsp[(yyi + 1) - (yynrhs)])
+		       		       , pb);
+      YYFPRINTF (stderr, "\n");
+    }
+}
+
+# define YY_REDUCE_PRINT(Rule)		\
+do {					\
+  if (yydebug)				\
+    yy_reduce_print (yyvsp, Rule, pb); \
+} while (YYID (0))
+
+/* Nonzero means print parse trace.  It is left uninitialized so that
+   multiple parsers can coexist.  */
+int yydebug;
+#else /* !YYDEBUG */
+# define YYDPRINTF(Args)
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
+# define YY_STACK_PRINT(Bottom, Top)
+# define YY_REDUCE_PRINT(Rule)
+#endif /* !YYDEBUG */
+
+
+/* YYINITDEPTH -- initial size of the parser's stacks.  */
+#ifndef	YYINITDEPTH
+# define YYINITDEPTH 200
+#endif
+
+/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
+   if the built-in stack extension method is used).
+
+   Do not make this value too large; the results are undefined if
+   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
+   evaluated with infinite-precision integer arithmetic.  */
+
+#ifndef YYMAXDEPTH
+# define YYMAXDEPTH 10000
+#endif
+
+
+#if YYERROR_VERBOSE
+
+# ifndef yystrlen
+#  if defined __GLIBC__ && defined _STRING_H
+#   define yystrlen strlen
+#  else
+/* Return the length of YYSTR.  */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static YYSIZE_T
+yystrlen (const char *yystr)
+#else
+static YYSIZE_T
+yystrlen (yystr)
+    const char *yystr;
+#endif
+{
+  YYSIZE_T yylen;
+  for (yylen = 0; yystr[yylen]; yylen++)
+    continue;
+  return yylen;
+}
+#  endif
+# endif
+
+# ifndef yystpcpy
+#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
+#   define yystpcpy stpcpy
+#  else
+/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
+   YYDEST.  */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static char *
+yystpcpy (char *yydest, const char *yysrc)
+#else
+static char *
+yystpcpy (yydest, yysrc)
+    char *yydest;
+    const char *yysrc;
+#endif
+{
+  char *yyd = yydest;
+  const char *yys = yysrc;
+
+  while ((*yyd++ = *yys++) != '\0')
+    continue;
+
+  return yyd - 1;
+}
+#  endif
+# endif
+
+# ifndef yytnamerr
+/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
+   quotes and backslashes, so that it's suitable for yyerror.  The
+   heuristic is that double-quoting is unnecessary unless the string
+   contains an apostrophe, a comma, or backslash (other than
+   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
+   null, do not copy; instead, return the length of what the result
+   would have been.  */
+static YYSIZE_T
+yytnamerr (char *yyres, const char *yystr)
+{
+  if (*yystr == '"')
+    {
+      YYSIZE_T yyn = 0;
+      char const *yyp = yystr;
+
+      for (;;)
+	switch (*++yyp)
+	  {
+	  case '\'':
+	  case ',':
+	    goto do_not_strip_quotes;
+
+	  case '\\':
+	    if (*++yyp != '\\')
+	      goto do_not_strip_quotes;
+	    /* Fall through.  */
+	  default:
+	    if (yyres)
+	      yyres[yyn] = *yyp;
+	    yyn++;
+	    break;
+
+	  case '"':
+	    if (yyres)
+	      yyres[yyn] = '\0';
+	    return yyn;
+	  }
+    do_not_strip_quotes: ;
+    }
+
+  if (! yyres)
+    return yystrlen (yystr);
+
+  return yystpcpy (yyres, yystr) - yyres;
+}
+# endif
+
+/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
+   about the unexpected token YYTOKEN for the state stack whose top is
+   YYSSP.
+
+   Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
+   not large enough to hold the message.  In that case, also set
+   *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
+   required number of bytes is too large to store.  */
+static int
+yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
+                yytype_int16 *yyssp, int yytoken)
+{
+  YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
+  YYSIZE_T yysize = yysize0;
+  YYSIZE_T yysize1;
+  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+  /* Internationalized format string. */
+  const char *yyformat = 0;
+  /* Arguments of yyformat. */
+  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+  /* Number of reported tokens (one for the "unexpected", one per
+     "expected"). */
+  int yycount = 0;
+
+  /* There are many possibilities here to consider:
+     - Assume YYFAIL is not used.  It's too flawed to consider.  See
+       <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
+       for details.  YYERROR is fine as it does not invoke this
+       function.
+     - If this state is a consistent state with a default action, then
+       the only way this function was invoked is if the default action
+       is an error action.  In that case, don't check for expected
+       tokens because there are none.
+     - The only way there can be no lookahead present (in yychar) is if
+       this state is a consistent state with a default action.  Thus,
+       detecting the absence of a lookahead is sufficient to determine
+       that there is no unexpected or expected token to report.  In that
+       case, just report a simple "syntax error".
+     - Don't assume there isn't a lookahead just because this state is a
+       consistent state with a default action.  There might have been a
+       previous inconsistent state, consistent state with a non-default
+       action, or user semantic action that manipulated yychar.
+     - Of course, the expected token list depends on states to have
+       correct lookahead information, and it depends on the parser not
+       to perform extra reductions after fetching a lookahead from the
+       scanner and before detecting a syntax error.  Thus, state merging
+       (from LALR or IELR) and default reductions corrupt the expected
+       token list.  However, the list is correct for canonical LR with
+       one exception: it will still contain any token that will not be
+       accepted due to an error action in a later state.
+  */
+  if (yytoken != YYEMPTY)
+    {
+      int yyn = yypact[*yyssp];
+      yyarg[yycount++] = yytname[yytoken];
+      if (!yypact_value_is_default (yyn))
+        {
+          /* Start YYX at -YYN if negative to avoid negative indexes in
+             YYCHECK.  In other words, skip the first -YYN actions for
+             this state because they are default actions.  */
+          int yyxbegin = yyn < 0 ? -yyn : 0;
+          /* Stay within bounds of both yycheck and yytname.  */
+          int yychecklim = YYLAST - yyn + 1;
+          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+          int yyx;
+
+          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
+                && !yytable_value_is_error (yytable[yyx + yyn]))
+              {
+                if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+                  {
+                    yycount = 1;
+                    yysize = yysize0;
+                    break;
+                  }
+                yyarg[yycount++] = yytname[yyx];
+                yysize1 = yysize + yytnamerr (0, yytname[yyx]);
+                if (! (yysize <= yysize1
+                       && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+                  return 2;
+                yysize = yysize1;
+              }
+        }
+    }
+
+  switch (yycount)
+    {
+# define YYCASE_(N, S)                      \
+      case N:                               \
+        yyformat = S;                       \
+      break
+      YYCASE_(0, YY_("syntax error"));
+      YYCASE_(1, YY_("syntax error, unexpected %s"));
+      YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
+      YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
+      YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
+      YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
+# undef YYCASE_
+    }
+
+  yysize1 = yysize + yystrlen (yyformat);
+  if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+    return 2;
+  yysize = yysize1;
+
+  if (*yymsg_alloc < yysize)
+    {
+      *yymsg_alloc = 2 * yysize;
+      if (! (yysize <= *yymsg_alloc
+             && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
+        *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
+      return 1;
+    }
+
+  /* Avoid sprintf, as that infringes on the user's name space.
+     Don't have undefined behavior even if the translation
+     produced a string with the wrong number of "%s"s.  */
+  {
+    char *yyp = *yymsg;
+    int yyi = 0;
+    while ((*yyp = *yyformat) != '\0')
+      if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
+        {
+          yyp += yytnamerr (yyp, yyarg[yyi++]);
+          yyformat += 2;
+        }
+      else
+        {
+          yyp++;
+          yyformat++;
+        }
+  }
+  return 0;
+}
+#endif /* YYERROR_VERBOSE */
+
+/*-----------------------------------------------.
+| Release the memory associated to this symbol.  |
+`-----------------------------------------------*/
+
+/*ARGSUSED*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static void
+yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, VCFParseBlock* pb)
+#else
+static void
+yydestruct (yymsg, yytype, yyvaluep, pb)
+    const char *yymsg;
+    int yytype;
+    YYSTYPE *yyvaluep;
+    VCFParseBlock* pb;
+#endif
+{
+  YYUSE (yyvaluep);
+  YYUSE (pb);
+
+  if (!yymsg)
+    yymsg = "Deleting";
+  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+
+  switch (yytype)
+    {
+
+      default:
+	break;
+    }
+}
+
+
+/* Prevent warnings from -Wmissing-prototypes.  */
+#ifdef YYPARSE_PARAM
+#if defined __STDC__ || defined __cplusplus
+int yyparse (void *YYPARSE_PARAM);
+#else
+int yyparse ();
+#endif
+#else /* ! YYPARSE_PARAM */
+#if defined __STDC__ || defined __cplusplus
+int yyparse (VCFParseBlock* pb);
+#else
+int yyparse ();
+#endif
+#endif /* ! YYPARSE_PARAM */
+
+
+/*----------.
+| yyparse.  |
+`----------*/
+
+#ifdef YYPARSE_PARAM
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+int
+yyparse (void *YYPARSE_PARAM)
+#else
+int
+yyparse (YYPARSE_PARAM)
+    void *YYPARSE_PARAM;
+#endif
+#else /* ! YYPARSE_PARAM */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+int
+yyparse (VCFParseBlock* pb)
+#else
+int
+yyparse (pb)
+    VCFParseBlock* pb;
+#endif
+#endif
+{
+/* The lookahead symbol.  */
+int yychar;
+
+/* The semantic value of the lookahead symbol.  */
+YYSTYPE yylval;
+
+    /* Number of syntax errors so far.  */
+    int yynerrs;
+
+    int yystate;
+    /* Number of tokens to shift before error messages enabled.  */
+    int yyerrstatus;
+
+    /* The stacks and their tools:
+       `yyss': related to states.
+       `yyvs': related to semantic values.
+
+       Refer to the stacks thru separate pointers, to allow yyoverflow
+       to reallocate them elsewhere.  */
+
+    /* The state stack.  */
+    yytype_int16 yyssa[YYINITDEPTH];
+    yytype_int16 *yyss;
+    yytype_int16 *yyssp;
+
+    /* The semantic value stack.  */
+    YYSTYPE yyvsa[YYINITDEPTH];
+    YYSTYPE *yyvs;
+    YYSTYPE *yyvsp;
+
+    YYSIZE_T yystacksize;
+
+  int yyn;
+  int yyresult;
+  /* Lookahead token as an internal (translated) token number.  */
+  int yytoken;
+  /* The variables used to return semantic value and location from the
+     action routines.  */
+  YYSTYPE yyval;
+
+#if YYERROR_VERBOSE
+  /* Buffer for error messages, and its allocated size.  */
+  char yymsgbuf[128];
+  char *yymsg = yymsgbuf;
+  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+#endif
+
+#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
+
+  /* The number of symbols on the RHS of the reduced rule.
+     Keep to zero when no symbol should be popped.  */
+  int yylen = 0;
+
+  yytoken = 0;
+  yyss = yyssa;
+  yyvs = yyvsa;
+  yystacksize = YYINITDEPTH;
+
+  YYDPRINTF ((stderr, "Starting parse\n"));
+
+  yystate = 0;
+  yyerrstatus = 0;
+  yynerrs = 0;
+  yychar = YYEMPTY; /* Cause a token to be read.  */
+
+  /* Initialize stack pointers.
+     Waste one element of value and location stack
+     so that they stay on the same level as the state stack.
+     The wasted elements are never initialized.  */
+  yyssp = yyss;
+  yyvsp = yyvs;
+
+  goto yysetstate;
+
+/*------------------------------------------------------------.
+| yynewstate -- Push a new state, which is found in yystate.  |
+`------------------------------------------------------------*/
+ yynewstate:
+  /* In all cases, when you get here, the value and location stacks
+     have just been pushed.  So pushing a state here evens the stacks.  */
+  yyssp++;
+
+ yysetstate:
+  *yyssp = yystate;
+
+  if (yyss + yystacksize - 1 <= yyssp)
+    {
+      /* Get the current used size of the three stacks, in elements.  */
+      YYSIZE_T yysize = yyssp - yyss + 1;
+
+#ifdef yyoverflow
+      {
+	/* Give user a chance to reallocate the stack.  Use copies of
+	   these so that the &'s don't force the real ones into
+	   memory.  */
+	YYSTYPE *yyvs1 = yyvs;
+	yytype_int16 *yyss1 = yyss;
+
+	/* Each stack pointer address is followed by the size of the
+	   data in use in that stack, in bytes.  This used to be a
+	   conditional around just the two extra args, but that might
+	   be undefined if yyoverflow is a macro.  */
+	yyoverflow (YY_("memory exhausted"),
+		    &yyss1, yysize * sizeof (*yyssp),
+		    &yyvs1, yysize * sizeof (*yyvsp),
+		    &yystacksize);
+
+	yyss = yyss1;
+	yyvs = yyvs1;
+      }
+#else /* no yyoverflow */
+# ifndef YYSTACK_RELOCATE
+      goto yyexhaustedlab;
+# else
+      /* Extend the stack our own way.  */
+      if (YYMAXDEPTH <= yystacksize)
+	goto yyexhaustedlab;
+      yystacksize *= 2;
+      if (YYMAXDEPTH < yystacksize)
+	yystacksize = YYMAXDEPTH;
+
+      {
+	yytype_int16 *yyss1 = yyss;
+	union yyalloc *yyptr =
+	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+	if (! yyptr)
+	  goto yyexhaustedlab;
+	YYSTACK_RELOCATE (yyss_alloc, yyss);
+	YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+#  undef YYSTACK_RELOCATE
+	if (yyss1 != yyssa)
+	  YYSTACK_FREE (yyss1);
+      }
+# endif
+#endif /* no yyoverflow */
+
+      yyssp = yyss + yysize - 1;
+      yyvsp = yyvs + yysize - 1;
+
+      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
+		  (unsigned long int) yystacksize));
+
+      if (yyss + yystacksize - 1 <= yyssp)
+	YYABORT;
+    }
+
+  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+
+  if (yystate == YYFINAL)
+    YYACCEPT;
+
+  goto yybackup;
+
+/*-----------.
+| yybackup.  |
+`-----------*/
+yybackup:
+
+  /* Do appropriate processing given the current state.  Read a
+     lookahead token if we need one and don't already have one.  */
+
+  /* First try to decide what to do without reference to lookahead token.  */
+  yyn = yypact[yystate];
+  if (yypact_value_is_default (yyn))
+    goto yydefault;
+
+  /* Not known => get a lookahead token if don't already have one.  */
+
+  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
+  if (yychar == YYEMPTY)
+    {
+      YYDPRINTF ((stderr, "Reading a token: "));
+      yychar = YYLEX;
+    }
+
+  if (yychar <= YYEOF)
+    {
+      yychar = yytoken = YYEOF;
+      YYDPRINTF ((stderr, "Now at end of input.\n"));
+    }
+  else
+    {
+      yytoken = YYTRANSLATE (yychar);
+      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
+    }
+
+  /* If the proper action on seeing token YYTOKEN is to reduce or to
+     detect an error, take that action.  */
+  yyn += yytoken;
+  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
+    goto yydefault;
+  yyn = yytable[yyn];
+  if (yyn <= 0)
+    {
+      if (yytable_value_is_error (yyn))
+        goto yyerrlab;
+      yyn = -yyn;
+      goto yyreduce;
+    }
+
+  /* Count tokens shifted since error; after three, turn off error
+     status.  */
+  if (yyerrstatus)
+    yyerrstatus--;
+
+  /* Shift the lookahead token.  */
+  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+
+  /* Discard the shifted token.  */
+  yychar = YYEMPTY;
+
+  yystate = yyn;
+  *++yyvsp = yylval;
+
+  goto yynewstate;
+
+
+/*-----------------------------------------------------------.
+| yydefault -- do the default action for the current state.  |
+`-----------------------------------------------------------*/
+yydefault:
+  yyn = yydefact[yystate];
+  if (yyn == 0)
+    goto yyerrlab;
+  goto yyreduce;
+
+
+/*-----------------------------.
+| yyreduce -- Do a reduction.  |
+`-----------------------------*/
+yyreduce:
+  /* yyn is the number of a rule to reduce with.  */
+  yylen = yyr2[yyn];
+
+  /* If YYLEN is nonzero, implement the default value of the action:
+     `$$ = $1'.
+
+     Otherwise, the following line sets YYVAL to garbage.
+     This behavior is undocumented and Bison
+     users should not rely upon it.  Assigning to YYVAL
+     unconditionally makes the parser a bit smaller, and it avoids a
+     GCC warning that YYVAL may be used uninitialized.  */
+  yyval = yyvsp[1-yylen];
+
+
+  YY_REDUCE_PRINT (yyn);
+  switch (yyn)
+    {
+        case 2:
+
+    { return 1; }
+    break;
+
+  case 3:
+
+    { return 0; }
+    break;
+
+  case 4:
+
+    { yyerror(pb, "no input found"); return 0; }
+    break;
+
+  case 5:
+
+    { pb->metaLine(pb, & (yyvsp[(1) - (4)]), &(yyvsp[(3) - (4)])); }
+    break;
+
+  case 10:
+
+    { pb->metaLine(pb, & (yyvsp[(1) - (4)]), &(yyvsp[(3) - (4)])); }
+    break;
+
+  case 11:
+
+    { pb->openMetaLine(pb, &(yyvsp[(1) - (3)])); }
+    break;
+
+  case 12:
+
+    { pb->closeMetaLine(pb); }
+    break;
+
+  case 15:
+
+    { pb->keyValue(pb, & (yyvsp[(1) - (3)]), &(yyvsp[(3) - (3)])); }
+    break;
+
+  case 17:
+
+    { pb->headerItem(pb, & (yyvsp[(1) - (1)])); }
+    break;
+
+  case 18:
+
+    { pb->headerItem(pb, & (yyvsp[(2) - (2)])); }
+    break;
+
+  case 21:
+
+    { pb->closeDataLine(pb); }
+    break;
+
+  case 22:
+
+    { pb->openDataLine(pb); pb->dataItem(pb, & (yyvsp[(1) - (1)])); }
+    break;
+
+  case 23:
+
+    { pb->dataItem(pb, & (yyvsp[(2) - (2)])); }
+    break;
+
+
+
+      default: break;
+    }
+  /* User semantic actions sometimes alter yychar, and that requires
+     that yytoken be updated with the new translation.  We take the
+     approach of translating immediately before every use of yytoken.
+     One alternative is translating here after every semantic action,
+     but that translation would be missed if the semantic action invokes
+     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
+     incorrect destructor might then be invoked immediately.  In the
+     case of YYERROR or YYBACKUP, subsequent parser actions might lead
+     to an incorrect destructor call or verbose syntax error message
+     before the lookahead is translated.  */
+  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
+
+  YYPOPSTACK (yylen);
+  yylen = 0;
+  YY_STACK_PRINT (yyss, yyssp);
+
+  *++yyvsp = yyval;
+
+  /* Now `shift' the result of the reduction.  Determine what state
+     that goes to, based on the state we popped back to and the rule
+     number reduced by.  */
+
+  yyn = yyr1[yyn];
+
+  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
+  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+    yystate = yytable[yystate];
+  else
+    yystate = yydefgoto[yyn - YYNTOKENS];
+
+  goto yynewstate;
+
+
+/*------------------------------------.
+| yyerrlab -- here on detecting error |
+`------------------------------------*/
+yyerrlab:
+  /* Make sure we have latest lookahead translation.  See comments at
+     user semantic actions for why this is necessary.  */
+  yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
+
+  /* If not already recovering from an error, report this error.  */
+  if (!yyerrstatus)
+    {
+      ++yynerrs;
+#if ! YYERROR_VERBOSE
+      yyerror (pb, YY_("syntax error"));
+#else
+# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
+                                        yyssp, yytoken)
+      {
+        char const *yymsgp = YY_("syntax error");
+        int yysyntax_error_status;
+        yysyntax_error_status = YYSYNTAX_ERROR;
+        if (yysyntax_error_status == 0)
+          yymsgp = yymsg;
+        else if (yysyntax_error_status == 1)
+          {
+            if (yymsg != yymsgbuf)
+              YYSTACK_FREE (yymsg);
+            yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
+            if (!yymsg)
+              {
+                yymsg = yymsgbuf;
+                yymsg_alloc = sizeof yymsgbuf;
+                yysyntax_error_status = 2;
+              }
+            else
+              {
+                yysyntax_error_status = YYSYNTAX_ERROR;
+                yymsgp = yymsg;
+              }
+          }
+        yyerror (pb, yymsgp);
+        if (yysyntax_error_status == 2)
+          goto yyexhaustedlab;
+      }
+# undef YYSYNTAX_ERROR
+#endif
+    }
+
+
+
+  if (yyerrstatus == 3)
+    {
+      /* If just tried and failed to reuse lookahead token after an
+	 error, discard it.  */
+
+      if (yychar <= YYEOF)
+	{
+	  /* Return failure if at end of input.  */
+	  if (yychar == YYEOF)
+	    YYABORT;
+	}
+      else
+	{
+	  yydestruct ("Error: discarding",
+		      yytoken, &yylval, pb);
+	  yychar = YYEMPTY;
+	}
+    }
+
+  /* Else will try to reuse lookahead token after shifting the error
+     token.  */
+  goto yyerrlab1;
+
+
+/*---------------------------------------------------.
+| yyerrorlab -- error raised explicitly by YYERROR.  |
+`---------------------------------------------------*/
+yyerrorlab:
+
+  /* Pacify compilers like GCC when the user code never invokes
+     YYERROR and the label yyerrorlab therefore never appears in user
+     code.  */
+  if (/*CONSTCOND*/ 0)
+     goto yyerrorlab;
+
+  /* Do not reclaim the symbols of the rule which action triggered
+     this YYERROR.  */
+  YYPOPSTACK (yylen);
+  yylen = 0;
+  YY_STACK_PRINT (yyss, yyssp);
+  yystate = *yyssp;
+  goto yyerrlab1;
+
+
+/*-------------------------------------------------------------.
+| yyerrlab1 -- common code for both syntax error and YYERROR.  |
+`-------------------------------------------------------------*/
+yyerrlab1:
+  yyerrstatus = 3;	/* Each real token shifted decrements this.  */
+
+  for (;;)
+    {
+      yyn = yypact[yystate];
+      if (!yypact_value_is_default (yyn))
+	{
+	  yyn += YYTERROR;
+	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+	    {
+	      yyn = yytable[yyn];
+	      if (0 < yyn)
+		break;
+	    }
+	}
+
+      /* Pop the current state because it cannot handle the error token.  */
+      if (yyssp == yyss)
+	YYABORT;
+
+
+      yydestruct ("Error: popping",
+		  yystos[yystate], yyvsp, pb);
+      YYPOPSTACK (1);
+      yystate = *yyssp;
+      YY_STACK_PRINT (yyss, yyssp);
+    }
+
+  *++yyvsp = yylval;
+
+
+  /* Shift the error token.  */
+  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
+
+  yystate = yyn;
+  goto yynewstate;
+
+
+/*-------------------------------------.
+| yyacceptlab -- YYACCEPT comes here.  |
+`-------------------------------------*/
+yyacceptlab:
+  yyresult = 0;
+  goto yyreturn;
+
+/*-----------------------------------.
+| yyabortlab -- YYABORT comes here.  |
+`-----------------------------------*/
+yyabortlab:
+  yyresult = 1;
+  goto yyreturn;
+
+#if !defined(yyoverflow) || YYERROR_VERBOSE
+/*-------------------------------------------------.
+| yyexhaustedlab -- memory exhaustion comes here.  |
+`-------------------------------------------------*/
+yyexhaustedlab:
+  yyerror (pb, YY_("memory exhausted"));
+  yyresult = 2;
+  /* Fall through.  */
+#endif
+
+yyreturn:
+  if (yychar != YYEMPTY)
+    {
+      /* Make sure we have latest lookahead translation.  See comments at
+         user semantic actions for why this is necessary.  */
+      yytoken = YYTRANSLATE (yychar);
+      yydestruct ("Cleanup: discarding lookahead",
+                  yytoken, &yylval, pb);
+    }
+  /* Do not reclaim the symbols of the rule which action triggered
+     this YYABORT or YYACCEPT.  */
+  YYPOPSTACK (yylen);
+  YY_STACK_PRINT (yyss, yyssp);
+  while (yyssp != yyss)
+    {
+      yydestruct ("Cleanup: popping",
+		  yystos[*yyssp], yyvsp, pb);
+      YYPOPSTACK (1);
+    }
+#ifndef yyoverflow
+  if (yyss != yyssa)
+    YYSTACK_FREE (yyss);
+#endif
+#if YYERROR_VERBOSE
+  if (yymsg != yymsgbuf)
+    YYSTACK_FREE (yymsg);
+#endif
+  /* Make sure YYID is used.  */
+  return YYID (yyresult);
+}
+
+
+
+
+
+void CC VCF_error(struct VCFParseBlock* pb, const char* msg)
+{
+    if (pb && pb->error)
+        pb->error(pb, msg);
+}
+
diff --git a/tools/vcf-loader/vcf-grammar.h b/tools/vcf-loader/vcf-grammar.h
new file mode 100644
index 0000000..f64e939
--- /dev/null
+++ b/tools/vcf-loader/vcf-grammar.h
@@ -0,0 +1,61 @@
+/* A Bison parser, made by GNU Bison 2.5.  */
+
+/* Bison interface for Yacc-like parsers in C
+   
+      Copyright (C) 1984, 1989-1990, 2000-2011 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 3 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, see <http://www.gnu.org/licenses/>.  */
+
+/* As a special exception, you may create a larger work that contains
+   part or all of the Bison parser skeleton and distribute that work
+   under terms of your choice, so long as that work isn't itself a
+   parser generator using the skeleton or a modified version thereof
+   as a parser skeleton.  Alternatively, if you modify or redistribute
+   the parser skeleton itself, you may (at your option) remove this
+   special exception, which will cause the skeleton and the resulting
+   Bison output files to be licensed under the GNU General Public
+   License without this special exception.
+   
+   This special exception was added by the Free Software Foundation in
+   version 2.2 of Bison.  */
+
+
+/* Tokens.  */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+   /* Put the tokens into the symbol table, so that GDB and other debuggers
+      know about them.  */
+   enum yytokentype {
+     vcfENDOFTEXT = 0,
+     vcfMETAKEY_FORMAT = 258,
+     vcfMETAKEY = 259,
+     vcfMETAVALUE = 260,
+     vcfHEADERITEM = 261,
+     vcfDATAITEM = 262,
+     vcfENDLINE = 263
+   };
+#endif
+
+
+
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+typedef int YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+
+
+
diff --git a/tools/vcf-loader/vcf-grammar.y b/tools/vcf-loader/vcf-grammar.y
new file mode 100644
index 0000000..f277c36
--- /dev/null
+++ b/tools/vcf-loader/vcf-grammar.y
@@ -0,0 +1,123 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+ 
+%{  
+    #include "vcf-parse.h"
+
+    #define YYSTYPE VCFToken
+    #define YYLEX_PARAM pb->scanner
+    #define YYDEBUG 1
+
+    #include "vcf-grammar.h"
+%}
+
+%pure-parser
+%parse-param {VCFParseBlock* pb }
+%lex-param {VCFParseBlock* pb }
+%error-verbose 
+%name-prefix="VCF_"
+
+%token vcfMETAKEY_FORMAT
+%token vcfMETAKEY
+%token vcfMETAVALUE
+%token vcfHEADERITEM
+%token vcfDATAITEM
+%token vcfENDLINE
+%token vcfENDOFTEXT 0
+
+%%
+
+vcfFile: 
+        fileFormatLine
+        metaLinesOpt           
+        headerLine
+        dataLines
+        vcfENDOFTEXT
+            { return 1; }  
+    |
+        error { return 0; } 
+    |
+        { yyerror(pb, "no input found"); return 0; }
+    ;
+
+fileFormatLine:
+        vcfMETAKEY_FORMAT '=' vcfMETAVALUE vcfENDLINE   { pb->metaLine(pb, & $1, &$3); }
+    ;
+    
+metaLinesOpt:
+    metaLines
+    |
+    ;
+
+metaLines:
+        metaLine
+    |   metaLines metaLine
+    ;
+    
+metaLine:
+        vcfMETAKEY '=' vcfMETAVALUE vcfENDLINE         { pb->metaLine(pb, & $1, &$3); }                          
+    |   vcfMETAKEY '=' '<' { pb->openMetaLine(pb, &$1); } keyValuePairs '>' vcfENDLINE { pb->closeMetaLine(pb); }         
+    ;
+
+keyValuePairs:
+        keyValue
+    |   keyValuePairs ',' keyValue
+    ;    
+    
+keyValue:
+    vcfMETAKEY '=' vcfMETAVALUE { pb->keyValue(pb, & $1, &$3); }                          
+    ;
+    
+headerLine:    
+    headerItems vcfENDLINE 
+    ;
+
+headerItems:    
+        vcfHEADERITEM               { pb->headerItem(pb, & $1); }  
+    |   headerItems vcfHEADERITEM   { pb->headerItem(pb, & $2); }  
+    ;    
+
+dataLines:
+        dataLine
+    |   dataLines dataLine  
+    ;
+    
+dataLine:
+    dataItems vcfENDLINE        { pb->closeDataLine(pb); }    
+    ;
+    
+dataItems:    
+        vcfDATAITEM             { pb->openDataLine(pb); pb->dataItem(pb, & $1); }  
+    |   dataItems vcfDATAITEM   { pb->dataItem(pb, & $2); }  
+    ;
+    
+%%
+
+void CC VCF_error(struct VCFParseBlock* pb, const char* msg)
+{
+    if (pb && pb->error)
+        pb->error(pb, msg);
+}
diff --git a/tools/vcf-loader/vcf-lex.c b/tools/vcf-loader/vcf-lex.c
new file mode 100644
index 0000000..49ae8df
--- /dev/null
+++ b/tools/vcf-loader/vcf-lex.c
@@ -0,0 +1,2516 @@
+
+
+#define YY_BUF_SIZE 16777216
+#define  YY_INT_ALIGNED short int
+
+/* A lexical scanner generated by flex */
+
+/* %not-for-header */
+
+/* %if-c-only */
+/* %if-not-reentrant */
+/* %endif */
+/* %endif */
+/* %ok-for-header */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+#define YY_FLEX_SUBMINOR_VERSION 35
+#if YY_FLEX_SUBMINOR_VERSION > 0
+#define FLEX_BETA
+#endif
+
+/* %if-c++-only */
+/* %endif */
+
+/* %if-c-only */
+    
+/* %endif */
+
+/* %if-c-only */
+
+/* %endif */
+
+/* First, we deal with  platform-specific or compiler-specific issues. */
+
+/* begin standard C headers. */
+/* %if-c-only */
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+/* %endif */
+
+/* %if-tables-serialization */
+/* %endif */
+/* end standard C headers. */
+
+/* %if-c-or-c++ */
+/* flex integer type definitions */
+
+#ifndef FLEXINT_H
+#define FLEXINT_H
+
+/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
+
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+
+/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+ * if you want the limit (max/min) macros for int types. 
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS 1
+#endif
+
+#include <inttypes.h>
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
+typedef uint16_t flex_uint16_t;
+typedef int32_t flex_int32_t;
+typedef uint32_t flex_uint32_t;
+#else
+typedef signed char flex_int8_t;
+typedef short int flex_int16_t;
+typedef int flex_int32_t;
+typedef unsigned char flex_uint8_t; 
+typedef unsigned short int flex_uint16_t;
+typedef unsigned int flex_uint32_t;
+#endif /* ! C99 */
+
+/* Limits of integral types. */
+#ifndef INT8_MIN
+#define INT8_MIN               (-128)
+#endif
+#ifndef INT16_MIN
+#define INT16_MIN              (-32767-1)
+#endif
+#ifndef INT32_MIN
+#define INT32_MIN              (-2147483647-1)
+#endif
+#ifndef INT8_MAX
+#define INT8_MAX               (127)
+#endif
+#ifndef INT16_MAX
+#define INT16_MAX              (32767)
+#endif
+#ifndef INT32_MAX
+#define INT32_MAX              (2147483647)
+#endif
+#ifndef UINT8_MAX
+#define UINT8_MAX              (255U)
+#endif
+#ifndef UINT16_MAX
+#define UINT16_MAX             (65535U)
+#endif
+#ifndef UINT32_MAX
+#define UINT32_MAX             (4294967295U)
+#endif
+
+#endif /* ! FLEXINT_H */
+
+/* %endif */
+
+/* %if-c++-only */
+/* %endif */
+
+#ifdef __cplusplus
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else	/* ! __cplusplus */
+
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
+
+#define YY_USE_CONST
+
+#endif	/* defined (__STDC__) */
+#endif	/* ! __cplusplus */
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+/* %not-for-header */
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+/* %ok-for-header */
+
+/* %not-for-header */
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index.  If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+/* %ok-for-header */
+
+/* %if-reentrant */
+
+/* An opaque pointer. */
+#ifndef YY_TYPEDEF_YY_SCANNER_T
+#define YY_TYPEDEF_YY_SCANNER_T
+typedef void* yyscan_t;
+#endif
+
+/* For convenience, these vars (plus the bison vars far below)
+   are macros in the reentrant scanner. */
+#define yyin yyg->yyin_r
+#define yyout yyg->yyout_r
+#define yyextra yyg->yyextra_r
+#define yyleng yyg->yyleng_r
+#define yytext yyg->yytext_r
+#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
+#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
+#define yy_flex_debug yyg->yy_flex_debug_r
+
+/* %endif */
+
+/* %if-not-reentrant */
+/* %endif */
+
+/* Enter a start condition.  This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN yyg->yy_start = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state.  The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START ((yyg->yy_start - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE VCF_restart(yyin ,yyscanner )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#ifndef YY_BUF_SIZE
+#define YY_BUF_SIZE 16384
+#endif
+
+/* The state buf must be large enough to hold one state per character in the main buffer.
+ */
+#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
+
+#ifndef YY_TYPEDEF_YY_BUFFER_STATE
+#define YY_TYPEDEF_YY_BUFFER_STATE
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+#endif
+
+/* %if-not-reentrant */
+/* %endif */
+
+/* %if-c-only */
+/* %if-not-reentrant */
+/* %endif */
+/* %endif */
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+    /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
+     *       access to the local variable yy_act. Since yyless() is a macro, it would break
+     *       existing scanners that call yyless() from OUTSIDE VCF_lex. 
+     *       One obvious solution it to make yy_act a global. I tried that, and saw
+     *       a 5% performance hit in a non-yylineno scanner, because yy_act is
+     *       normally declared as a register variable-- so it is not worth it.
+     */
+    #define  YY_LESS_LINENO(n) \
+            do { \
+                int yyl;\
+                for ( yyl = n; yyl < yyleng; ++yyl )\
+                    if ( yytext[yyl] == '\n' )\
+                        --yylineno;\
+            }while(0)
+    
+/* Return all but the first "n" matched characters back to the input stream. */
+#define yyless(n) \
+	do \
+		{ \
+		/* Undo effects of setting up yytext. */ \
+        int yyless_macro_arg = (n); \
+        YY_LESS_LINENO(yyless_macro_arg);\
+		*yy_cp = yyg->yy_hold_char; \
+		YY_RESTORE_YY_MORE_OFFSET \
+		yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
+		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+		} \
+	while ( 0 )
+
+#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
+
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
+#ifndef YY_STRUCT_YY_BUFFER_STATE
+#define YY_STRUCT_YY_BUFFER_STATE
+struct yy_buffer_state
+	{
+/* %if-c-only */
+	FILE *yy_input_file;
+/* %endif */
+
+/* %if-c++-only */
+/* %endif */
+
+	char *yy_ch_buf;		/* input buffer */
+	char *yy_buf_pos;		/* current position in input buffer */
+
+	/* Size of input buffer in bytes, not including room for EOB
+	 * characters.
+	 */
+	yy_size_t yy_buf_size;
+
+	/* Number of characters read into yy_ch_buf, not including EOB
+	 * characters.
+	 */
+	int yy_n_chars;
+
+	/* Whether we "own" the buffer - i.e., we know we created it,
+	 * and can realloc() it to grow it, and should free() it to
+	 * delete it.
+	 */
+	int yy_is_our_buffer;
+
+	/* Whether this is an "interactive" input source; if so, and
+	 * if we're using stdio for input, then we want to use getc()
+	 * instead of fread(), to make sure we stop fetching input after
+	 * each newline.
+	 */
+	int yy_is_interactive;
+
+	/* Whether we're considered to be at the beginning of a line.
+	 * If so, '^' rules will be active on the next match, otherwise
+	 * not.
+	 */
+	int yy_at_bol;
+
+    int yy_bs_lineno; /**< The line count. */
+    int yy_bs_column; /**< The column count. */
+    
+	/* Whether to try to fill the input buffer when we reach the
+	 * end of it.
+	 */
+	int yy_fill_buffer;
+
+	int yy_buffer_status;
+
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+	/* When an EOF's been seen but there's still some text to process
+	 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+	 * shouldn't try reading from the input source any more.  We might
+	 * still have a bunch of tokens to match, though, because of
+	 * possible backing-up.
+	 *
+	 * When we actually see the EOF, we change the status to "new"
+	 * (via VCF_restart()), so that the user can continue scanning by
+	 * just pointing yyin at a new input file.
+	 */
+#define YY_BUFFER_EOF_PENDING 2
+
+	};
+#endif /* !YY_STRUCT_YY_BUFFER_STATE */
+
+/* %if-c-only Standard (non-C++) definition */
+/* %not-for-header */
+
+/* %if-not-reentrant */
+/* %endif */
+/* %ok-for-header */
+
+/* %endif */
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ *
+ * Returns the top of the stack, or NULL.
+ */
+#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
+                          ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
+                          : NULL)
+
+/* Same as previous macro, but useful when we know that the buffer stack is not
+ * NULL or when we need an lvalue. For internal use only.
+ */
+#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
+
+/* %if-c-only Standard (non-C++) definition */
+
+/* %if-not-reentrant */
+/* %not-for-header */
+
+/* %ok-for-header */
+
+/* %endif */
+
+void VCF_restart (FILE *input_file ,yyscan_t yyscanner );
+void VCF__switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
+YY_BUFFER_STATE VCF__create_buffer (FILE *file,int size ,yyscan_t yyscanner );
+void VCF__delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
+void VCF__flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
+void VCF_push_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
+void VCF_pop_buffer_state (yyscan_t yyscanner );
+
+static void VCF_ensure_buffer_stack (yyscan_t yyscanner );
+static void VCF__load_buffer_state (yyscan_t yyscanner );
+static void VCF__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
+
+#define YY_FLUSH_BUFFER VCF__flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
+
+YY_BUFFER_STATE VCF__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
+YY_BUFFER_STATE VCF__scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
+YY_BUFFER_STATE VCF__scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
+
+/* %endif */
+
+void *VCF_alloc (yy_size_t ,yyscan_t yyscanner );
+void *VCF_realloc (void *,yy_size_t ,yyscan_t yyscanner );
+void VCF_free (void * ,yyscan_t yyscanner );
+
+#define yy_new_buffer VCF__create_buffer
+
+#define yy_set_interactive(is_interactive) \
+	{ \
+	if ( ! YY_CURRENT_BUFFER ){ \
+        VCF_ensure_buffer_stack (yyscanner); \
+		YY_CURRENT_BUFFER_LVALUE =    \
+            VCF__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
+	} \
+	YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
+	}
+
+#define yy_set_bol(at_bol) \
+	{ \
+	if ( ! YY_CURRENT_BUFFER ){\
+        VCF_ensure_buffer_stack (yyscanner); \
+		YY_CURRENT_BUFFER_LVALUE =    \
+            VCF__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
+	} \
+	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
+	}
+
+#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
+
+/* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */
+/* Begin user sect3 */
+
+#define VCF_wrap(n) 1
+#define YY_SKIP_YYWRAP
+
+#define FLEX_DEBUG
+
+typedef unsigned char YY_CHAR;
+
+typedef int yy_state_type;
+
+#define yytext_ptr yytext_r
+
+/* %if-c-only Standard (non-C++) definition */
+
+static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
+static yy_state_type yy_try_NUL_trans (yy_state_type current_state  ,yyscan_t yyscanner);
+static int yy_get_next_buffer (yyscan_t yyscanner );
+static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
+
+/* %endif */
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+	yyg->yytext_ptr = yy_bp; \
+/* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */\
+	yyleng = (size_t) (yy_cp - yy_bp); \
+	yyg->yy_hold_char = *yy_cp; \
+	*yy_cp = '\0'; \
+/* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\
+	yyg->yy_c_buf_p = yy_cp;
+
+/* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */
+#define YY_NUM_RULES 17
+#define YY_END_OF_BUFFER 18
+/* This struct is not used in this scanner,
+   but its presence is necessary. */
+struct yy_trans_info
+	{
+	flex_int32_t yy_verify;
+	flex_int32_t yy_nxt;
+	};
+static yyconst flex_int16_t yy_accept[57] =
+    {   0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,   18,   15,   11,   12,   15,    3,    3,    3,
+        3,    2,   15,    4,   15,   15,    8,    8,   10,   10,
+       10,   14,   13,    3,    3,    1,   16,    4,    0,    6,
+        0,    8,   10,   10,    9,    7,    0,    0,    0,    0,
+        0,    0,    0,    0,    5,    0
+    } ;
+
+static yyconst flex_int32_t yy_ec[256] =
+    {   0,
+        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
+        1,    1,    4,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    5,    1,    1,    1,    1,    1,
+        1,    1,    1,    6,    7,    1,    1,    7,    7,    7,
+        7,    7,    7,    7,    7,    7,    7,    1,    1,    8,
+        9,    6,    1,    1,    7,    7,    7,    7,    7,    7,
+        7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
+        7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
+        1,    1,    1,    1,    7,    1,   10,    7,    7,    7,
+
+       11,   12,    7,    7,   13,    7,    7,   14,   15,    7,
+       16,    7,    7,   17,    7,   18,    7,    7,    7,    7,
+        7,    7,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1
+    } ;
+
+static yyconst flex_int32_t yy_meta[19] =
+    {   0,
+        1,    2,    3,    3,    1,    4,    5,    4,    6,    5,
+        5,    5,    5,    5,    5,    5,    5,    5
+    } ;
+
+static yyconst flex_int16_t yy_base[71] =
+    {   0,
+        0,    3,    7,   10,   13,   16,   20,    0,   37,   45,
+       54,    0,  148,  177,  177,  177,  134,    0,    0,    0,
+       71,  131,    0,    0,   88,   67,    0,    0,    0,    0,
+       80,  177,  177,    0,    0,  177,    0,    0,   87,   87,
+       36,    0,    0,   89,  177,  177,   33,   74,   68,   34,
+       78,   43,   70,   83,   70,  177,   98,  104,  110,  116,
+      122,  128,  134,  140,  146,  152,  154,  160,  165,  170
+    } ;
+
+static yyconst flex_int16_t yy_def[71] =
+    {   0,
+       57,   58,   59,   59,   60,   60,   56,    7,   61,   61,
+       56,   11,   56,   56,   56,   56,   62,   63,   63,   63,
+       64,   56,   65,   66,   67,   67,   68,   68,   69,   69,
+       70,   56,   56,   63,   63,   56,   65,   66,   67,   56,
+       67,   68,   69,   70,   56,   56,   67,   67,   67,   67,
+       67,   67,   67,   67,   56,    0,   56,   56,   56,   56,
+       56,   56,   56,   56,   56,   56,   56,   56,   56,   56
+    } ;
+
+static yyconst flex_int16_t yy_nxt[196] =
+    {   0,
+       56,   15,   16,   17,   19,   20,   21,   22,   15,   16,
+       17,   15,   16,   17,   15,   16,   17,   15,   16,   17,
+       14,   15,   16,   17,   14,   14,   25,   14,   14,   25,
+       25,   26,   25,   25,   25,   25,   25,   25,   28,   16,
+       17,   40,   40,   48,   40,   14,   28,   16,   17,   47,
+       51,   40,   53,   14,   29,   30,   16,   17,   29,   14,
+       31,   14,   14,   31,   31,   31,   31,   31,   31,   31,
+       31,   31,   32,   33,   32,   40,   40,   46,   40,   41,
+       43,   43,   40,   50,   43,   49,   40,   54,   45,   43,
+       43,   55,   52,   43,   46,   40,   40,   45,   14,   14,
+
+       14,   14,   14,   14,   18,   18,   18,   18,   18,   18,
+       23,   23,   23,   23,   23,   23,   24,   24,   24,   24,
+       24,   24,   27,   27,   27,   27,   27,   27,   32,   32,
+       32,   32,   32,   32,   34,   36,   33,   34,   34,   34,
+       35,   35,   35,   35,   35,   35,   37,   56,   56,   37,
+       37,   37,   38,   56,   56,   38,   38,   38,   39,   39,
+       42,   42,   56,   42,   42,   43,   43,   56,   56,   43,
+       44,   44,   56,   56,   44,   44,   13,   56,   56,   56,
+       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,
+       56,   56,   56,   56,   56
+
+    } ;
+
+static yyconst flex_int16_t yy_chk[196] =
+    {   0,
+        0,    1,    1,    1,    2,    2,    2,    2,    3,    3,
+        3,    4,    4,    4,    5,    5,    5,    6,    6,    6,
+        7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
+        7,    7,    7,    7,    7,    7,    7,    7,    9,    9,
+        9,   47,   50,   47,   41,    9,   10,   10,   10,   41,
+       50,   52,   52,   10,   11,   11,   11,   11,   11,   11,
+       11,   11,   11,   11,   11,   11,   11,   11,   11,   11,
+       11,   11,   21,   21,   21,   26,   49,   55,   53,   26,
+       31,   31,   48,   49,   31,   48,   51,   53,   31,   44,
+       44,   54,   51,   44,   40,   39,   25,   44,   57,   57,
+
+       57,   57,   57,   57,   58,   58,   58,   58,   58,   58,
+       59,   59,   59,   59,   59,   59,   60,   60,   60,   60,
+       60,   60,   61,   61,   61,   61,   61,   61,   62,   62,
+       62,   62,   62,   62,   63,   22,   17,   63,   63,   63,
+       64,   64,   64,   64,   64,   64,   65,   13,    0,   65,
+       65,   65,   66,    0,    0,   66,   66,   66,   67,   67,
+       68,   68,    0,   68,   68,   69,   69,    0,    0,   69,
+       70,   70,    0,    0,   70,   70,   56,   56,   56,   56,
+       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,
+       56,   56,   56,   56,   56
+
+    } ;
+
+/* Table of booleans, true if rule could match eol. */
+static yyconst flex_int32_t yy_rule_can_match_eol[18] =
+    {   0,
+0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0,     };
+
+static yyconst flex_int16_t yy_rule_linenum[17] =
+    {   0,
+       76,   77,   79,   81,   83,   84,   85,   89,   93,   94,
+       99,  100,  101,  102,  103,  106
+    } ;
+
+/* The intent behind this definition is that it'll catch
+ * any uses of REJECT which flex missed.
+ */
+#define REJECT reject_used_but_not_detected
+#define yymore() yymore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+    #include <klib/rc.h>
+    #include <klib/text.h>
+    
+	#include "vcf-parse.h"
+	#include "vcf-grammar.h"    
+
+    #define YYSTYPE VCFToken
+
+    /* code to populate token with internal values */
+    #define YY_USER_ACTION              \
+        yylval -> tokenText     = yytext; \
+        yylval -> tokenStart    = yyextra->offset; \
+        yylval -> tokenLength	= yyleng;	\
+        yylval -> line_no		= yylineno;	\
+        yylval -> column_no		= yyextra -> column; \
+        yyextra -> lastToken = yylval; \
+        yyextra -> offset += yyleng; \
+        yyextra -> column += yyleng; 
+
+    #define ENDLINE \
+        yyextra -> column=1; \
+        return vcfENDLINE;
+
+    #define YY_INPUT(buf, result, max_size) \
+        result = yyextra->input(yyextra, buf, max_size)
+
+    #define ECHO
+
+    #define YY_NO_INPUT
+#define YY_NO_UNISTD_H 1
+
+#define INITIAL 0
+#define HEADER 1
+#define DATA 2
+#define META 3
+#define META_SIMPLE 4
+#define META_COMPOSITE 5
+
+#ifndef YY_NO_UNISTD_H
+/* Special case for "unistd.h", since it is non-ANSI. We include it way
+ * down here because we want the user's section 1 to have been scanned first.
+ * The user has a chance to override it with an option.
+ */
+/* %if-c-only */
+#include <unistd.h>
+/* %endif */
+/* %if-c++-only */
+/* %endif */
+#endif
+
+#define YY_EXTRA_TYPE VCFParseBlock*
+
+/* %if-c-only Reentrant structure and macros (non-C++). */
+/* %if-reentrant */
+
+/* Holds the entire state of the reentrant scanner. */
+struct yyguts_t
+    {
+
+    /* User-defined. Not touched by flex. */
+    YY_EXTRA_TYPE yyextra_r;
+
+    /* The rest are the same as the globals declared in the non-reentrant scanner. */
+    FILE *yyin_r, *yyout_r;
+    size_t yy_buffer_stack_top; /**< index of top of stack. */
+    size_t yy_buffer_stack_max; /**< capacity of stack. */
+    YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
+    char yy_hold_char;
+    int yy_n_chars;
+    int yyleng_r;
+    char *yy_c_buf_p;
+    int yy_init;
+    int yy_start;
+    int yy_did_buffer_switch_on_eof;
+    int yy_start_stack_ptr;
+    int yy_start_stack_depth;
+    int *yy_start_stack;
+    yy_state_type yy_last_accepting_state;
+    char* yy_last_accepting_cpos;
+
+    int yylineno_r;
+    int yy_flex_debug_r;
+
+    char *yytext_r;
+    int yy_more_flag;
+    int yy_more_len;
+
+    YYSTYPE * yylval_r;
+
+    }; /* end struct yyguts_t */
+
+/* %if-c-only */
+
+static int yy_init_globals (yyscan_t yyscanner );
+
+/* %endif */
+
+/* %if-reentrant */
+
+    /* This must go here because YYSTYPE and YYLTYPE are included
+     * from bison output in section 1.*/
+    #    define yylval yyg->yylval_r
+    
+int VCF_lex_init (yyscan_t* scanner);
+
+int VCF_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
+
+/* %endif */
+
+/* %endif End reentrant structures and macros. */
+
+/* Accessor methods to globals.
+   These are made visible to non-reentrant scanners for convenience. */
+
+int VCF_lex_destroy (yyscan_t yyscanner );
+
+int VCF_get_debug (yyscan_t yyscanner );
+
+void VCF_set_debug (int debug_flag ,yyscan_t yyscanner );
+
+YY_EXTRA_TYPE VCF_get_extra (yyscan_t yyscanner );
+
+void VCF_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
+
+FILE *VCF_get_in (yyscan_t yyscanner );
+
+void VCF_set_in  (FILE * in_str ,yyscan_t yyscanner );
+
+FILE *VCF_get_out (yyscan_t yyscanner );
+
+void VCF_set_out  (FILE * out_str ,yyscan_t yyscanner );
+
+int VCF_get_leng (yyscan_t yyscanner );
+
+char *VCF_get_text (yyscan_t yyscanner );
+
+int VCF_get_lineno (yyscan_t yyscanner );
+
+void VCF_set_lineno (int line_number ,yyscan_t yyscanner );
+
+/* %if-bison-bridge */
+
+YYSTYPE * VCF_get_lval (yyscan_t yyscanner );
+
+void VCF_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
+
+/* %endif */
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+#ifdef __cplusplus
+extern "C" int VCF_wrap (yyscan_t yyscanner );
+#else
+extern int VCF_wrap (yyscan_t yyscanner );
+#endif
+#endif
+
+/* %not-for-header */
+
+    static void yyunput (int c,char *buf_ptr  ,yyscan_t yyscanner);
+    
+/* %ok-for-header */
+
+/* %endif */
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
+#endif
+
+#ifndef YY_NO_INPUT
+/* %if-c-only Standard (non-C++) definition */
+/* %not-for-header */
+
+#ifdef __cplusplus
+static int yyinput (yyscan_t yyscanner );
+#else
+static int input (yyscan_t yyscanner );
+#endif
+/* %ok-for-header */
+
+/* %endif */
+#endif
+
+/* %if-c-only */
+
+/* %endif */
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#define YY_READ_BUF_SIZE 8192
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+#ifndef ECHO
+/* %if-c-only Standard (non-C++) definition */
+/* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+#define ECHO fwrite( yytext, yyleng, 1, yyout )
+/* %endif */
+/* %if-c++-only C++ definition */
+/* %endif */
+#endif
+
+/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+/* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\
+	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
+		{ \
+		int c = '*'; \
+		int n; \
+		for ( n = 0; n < max_size && \
+			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+			buf[n] = (char) c; \
+		if ( c == '\n' ) \
+			buf[n++] = (char) c; \
+		if ( c == EOF && ferror( yyin ) ) \
+			YY_FATAL_ERROR( "input in flex scanner failed" ); \
+		result = n; \
+		} \
+	else \
+		{ \
+		errno=0; \
+		while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
+			{ \
+			if( errno != EINTR) \
+				{ \
+				YY_FATAL_ERROR( "input in flex scanner failed" ); \
+				break; \
+				} \
+			errno=0; \
+			clearerr(yyin); \
+			} \
+		}\
+\
+/* %if-c++-only C++ definition \ */\
+/* %endif */
+
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+/* %if-c-only */
+#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
+/* %endif */
+/* %if-c++-only */
+/* %endif */
+#endif
+
+/* %if-tables-serialization structures and prototypes */
+/* %not-for-header */
+
+/* %ok-for-header */
+
+/* %not-for-header */
+
+/* %tables-yydmap generated elements */
+/* %endif */
+/* end tables serialization structures and prototypes */
+
+/* %ok-for-header */
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL_IS_OURS 1
+/* %if-c-only Standard (non-C++) definition */
+
+extern int VCF_lex \
+               (YYSTYPE * yylval_param ,yyscan_t yyscanner);
+
+#define YY_DECL int VCF_lex \
+               (YYSTYPE * yylval_param , yyscan_t yyscanner)
+/* %endif */
+/* %if-c++-only C++ definition */
+/* %endif */
+#endif /* !YY_DECL */
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK break;
+#endif
+
+/* %% [6.0] YY_RULE_SETUP definition goes here */
+#define YY_RULE_SETUP \
+	if ( yyleng > 0 ) \
+		YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
+				(yytext[yyleng - 1] == '\n'); \
+	YY_USER_ACTION
+
+/* %not-for-header */
+
+/** The main scanner function which does all the work.
+ */
+YY_DECL
+{
+	register yy_state_type yy_current_state;
+	register char *yy_cp, *yy_bp;
+	register int yy_act;
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+/* %% [7.0] user's declarations go here */
+
+    yylval = yylval_param;
+
+	if ( !yyg->yy_init )
+		{
+		yyg->yy_init = 1;
+
+#ifdef YY_USER_INIT
+		YY_USER_INIT;
+#endif
+
+		if ( ! yyg->yy_start )
+			yyg->yy_start = 1;	/* first start state */
+
+		if ( ! yyin )
+/* %if-c-only */
+			yyin = stdin;
+/* %endif */
+/* %if-c++-only */
+/* %endif */
+
+		if ( ! yyout )
+/* %if-c-only */
+			yyout = stdout;
+/* %endif */
+/* %if-c++-only */
+/* %endif */
+
+		if ( ! YY_CURRENT_BUFFER ) {
+			VCF_ensure_buffer_stack (yyscanner);
+			YY_CURRENT_BUFFER_LVALUE =
+				VCF__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
+		}
+
+		VCF__load_buffer_state(yyscanner );
+		}
+
+	while ( 1 )		/* loops until end-of-file is reached */
+		{
+/* %% [8.0] yymore()-related code goes here */
+		yy_cp = yyg->yy_c_buf_p;
+
+		/* Support of yytext. */
+		*yy_cp = yyg->yy_hold_char;
+
+		/* yy_bp points to the position in yy_ch_buf of the start of
+		 * the current run.
+		 */
+		yy_bp = yy_cp;
+
+/* %% [9.0] code to set up and find next match goes here */
+		yy_current_state = yyg->yy_start;
+		yy_current_state += YY_AT_BOL();
+yy_match:
+		do
+			{
+			register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+			if ( yy_accept[yy_current_state] )
+				{
+				yyg->yy_last_accepting_state = yy_current_state;
+				yyg->yy_last_accepting_cpos = yy_cp;
+				}
+			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+				{
+				yy_current_state = (int) yy_def[yy_current_state];
+				if ( yy_current_state >= 57 )
+					yy_c = yy_meta[(unsigned int) yy_c];
+				}
+			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+			++yy_cp;
+			}
+		while ( yy_current_state != 56 );
+		yy_cp = yyg->yy_last_accepting_cpos;
+		yy_current_state = yyg->yy_last_accepting_state;
+
+yy_find_action:
+/* %% [10.0] code to find the action number goes here */
+		yy_act = yy_accept[yy_current_state];
+
+		YY_DO_BEFORE_ACTION;
+
+/* %% [11.0] code for yylineno update goes here */
+
+		if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
+			{
+			int yyl;
+			for ( yyl = 0; yyl < yyleng; ++yyl )
+				if ( yytext[yyl] == '\n' )
+					   
+    do{ yylineno++;
+        yycolumn=0;
+    }while(0)
+;
+			}
+
+do_action:	/* This label is used only to access EOF actions. */
+
+/* %% [12.0] debug code goes here */
+		if ( yy_flex_debug )
+			{
+			if ( yy_act == 0 )
+				fprintf( stderr, "--scanner backing up\n" );
+			else if ( yy_act < 17 )
+				fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n",
+				         (long)yy_rule_linenum[yy_act], yytext );
+			else if ( yy_act == 17 )
+				fprintf( stderr, "--accepting default rule (\"%s\")\n",
+				         yytext );
+			else if ( yy_act == 18 )
+				fprintf( stderr, "--(end of buffer or a NUL)\n" );
+			else
+				fprintf( stderr, "--EOF (start condition %d)\n", YY_START );
+			}
+
+		switch ( yy_act )
+	{ /* beginning of action switch */
+/* %% [13.0] actions go here */
+			case 0: /* must back up */
+			/* undo the effects of YY_DO_BEFORE_ACTION */
+			*yy_cp = yyg->yy_hold_char;
+			yy_cp = yyg->yy_last_accepting_cpos;
+			yy_current_state = yyg->yy_last_accepting_state;
+			goto yy_find_action;
+
+case 1:
+YY_RULE_SETUP
+{ BEGIN META; }
+	YY_BREAK
+case 2:
+YY_RULE_SETUP
+{ BEGIN HEADER; }
+	YY_BREAK
+case 3:
+/* rule 3 can match eol */
+YY_RULE_SETUP
+{ BEGIN DATA; return vcfDATAITEM; }
+	YY_BREAK
+case 4:
+YY_RULE_SETUP
+{ return vcfDATAITEM; }
+	YY_BREAK
+case 5:
+*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
+yyg->yy_c_buf_p = yy_cp = yy_bp + 10;
+YY_DO_BEFORE_ACTION; /* set up yytext again */
+YY_RULE_SETUP
+{ BEGIN META_SIMPLE; return vcfMETAKEY_FORMAT; }
+	YY_BREAK
+case 6:
+*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
+yyg->yy_c_buf_p = yy_cp -= 1;
+YY_DO_BEFORE_ACTION; /* set up yytext again */
+YY_RULE_SETUP
+{ BEGIN META_SIMPLE; return vcfMETAKEY; }
+	YY_BREAK
+case 7:
+*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
+yyg->yy_c_buf_p = yy_cp -= 2;
+YY_DO_BEFORE_ACTION; /* set up yytext again */
+YY_RULE_SETUP
+{ BEGIN META_COMPOSITE; return vcfMETAKEY; }
+	YY_BREAK
+
+case 8:
+YY_RULE_SETUP
+{ return vcfMETAVALUE; }
+	YY_BREAK
+
+case 9:
+*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
+yyg->yy_c_buf_p = yy_cp -= 1;
+YY_DO_BEFORE_ACTION; /* set up yytext again */
+YY_RULE_SETUP
+{ return vcfMETAKEY; }
+	YY_BREAK
+case 10:
+YY_RULE_SETUP
+{ return vcfMETAVALUE; }
+	YY_BREAK
+
+case 11:
+YY_RULE_SETUP
+
+	YY_BREAK
+case 12:
+/* rule 12 can match eol */
+YY_RULE_SETUP
+{ BEGIN 0; ENDLINE; }
+	YY_BREAK
+case 13:
+/* rule 13 can match eol */
+YY_RULE_SETUP
+{ BEGIN 0; ENDLINE; }
+	YY_BREAK
+case 14:
+*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
+yyg->yy_c_buf_p = yy_cp = yy_bp + 1;
+YY_DO_BEFORE_ACTION; /* set up yytext again */
+YY_RULE_SETUP
+{ BEGIN 0; ENDLINE; }
+	YY_BREAK
+case 15:
+YY_RULE_SETUP
+{ return yytext[0]; }
+	YY_BREAK
+
+case 16:
+YY_RULE_SETUP
+{ return vcfHEADERITEM; }
+	YY_BREAK
+case 17:
+YY_RULE_SETUP
+ECHO;
+	YY_BREAK
+case YY_STATE_EOF(INITIAL):
+case YY_STATE_EOF(HEADER):
+case YY_STATE_EOF(DATA):
+case YY_STATE_EOF(META):
+case YY_STATE_EOF(META_SIMPLE):
+case YY_STATE_EOF(META_COMPOSITE):
+	yyterminate();
+
+	case YY_END_OF_BUFFER:
+		{
+		/* Amount of text matched not including the EOB char. */
+		int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
+
+		/* Undo the effects of YY_DO_BEFORE_ACTION. */
+		*yy_cp = yyg->yy_hold_char;
+		YY_RESTORE_YY_MORE_OFFSET
+
+		if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
+			{
+			/* We're scanning a new file or input source.  It's
+			 * possible that this happened because the user
+			 * just pointed yyin at a new source and called
+			 * VCF_lex().  If so, then we have to assure
+			 * consistency between YY_CURRENT_BUFFER and our
+			 * globals.  Here is the right place to do so, because
+			 * this is the first action (other than possibly a
+			 * back-up) that will match for the new input source.
+			 */
+			yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+			YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
+			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
+			}
+
+		/* Note that here we test for yy_c_buf_p "<=" to the position
+		 * of the first EOB in the buffer, since yy_c_buf_p will
+		 * already have been incremented past the NUL character
+		 * (since all states make transitions on EOB to the
+		 * end-of-buffer state).  Contrast this with the test
+		 * in input().
+		 */
+		if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
+			{ /* This was really a NUL. */
+			yy_state_type yy_next_state;
+
+			yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
+
+			yy_current_state = yy_get_previous_state( yyscanner );
+
+			/* Okay, we're now positioned to make the NUL
+			 * transition.  We couldn't have
+			 * yy_get_previous_state() go ahead and do it
+			 * for us because it doesn't know how to deal
+			 * with the possibility of jamming (and we don't
+			 * want to build jamming into it because then it
+			 * will run more slowly).
+			 */
+
+			yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
+
+			yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
+
+			if ( yy_next_state )
+				{
+				/* Consume the NUL. */
+				yy_cp = ++yyg->yy_c_buf_p;
+				yy_current_state = yy_next_state;
+				goto yy_match;
+				}
+
+			else
+				{
+/* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */
+				yy_cp = yyg->yy_last_accepting_cpos;
+				yy_current_state = yyg->yy_last_accepting_state;
+				goto yy_find_action;
+				}
+			}
+
+		else switch ( yy_get_next_buffer( yyscanner ) )
+			{
+			case EOB_ACT_END_OF_FILE:
+				{
+				yyg->yy_did_buffer_switch_on_eof = 0;
+
+				if ( VCF_wrap(yyscanner ) )
+					{
+					/* Note: because we've taken care in
+					 * yy_get_next_buffer() to have set up
+					 * yytext, we can now set up
+					 * yy_c_buf_p so that if some total
+					 * hoser (like flex itself) wants to
+					 * call the scanner after we return the
+					 * YY_NULL, it'll still work - another
+					 * YY_NULL will get returned.
+					 */
+					yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
+
+					yy_act = YY_STATE_EOF(YY_START);
+					goto do_action;
+					}
+
+				else
+					{
+					if ( ! yyg->yy_did_buffer_switch_on_eof )
+						YY_NEW_FILE;
+					}
+				break;
+				}
+
+			case EOB_ACT_CONTINUE_SCAN:
+				yyg->yy_c_buf_p =
+					yyg->yytext_ptr + yy_amount_of_matched_text;
+
+				yy_current_state = yy_get_previous_state( yyscanner );
+
+				yy_cp = yyg->yy_c_buf_p;
+				yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
+				goto yy_match;
+
+			case EOB_ACT_LAST_MATCH:
+				yyg->yy_c_buf_p =
+				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
+
+				yy_current_state = yy_get_previous_state( yyscanner );
+
+				yy_cp = yyg->yy_c_buf_p;
+				yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
+				goto yy_find_action;
+			}
+		break;
+		}
+
+	default:
+		YY_FATAL_ERROR(
+			"fatal flex scanner internal error--no action found" );
+	} /* end of action switch */
+		} /* end of scanning one token */
+} /* end of VCF_lex */
+/* %ok-for-header */
+
+/* %if-c++-only */
+/* %not-for-header */
+
+/* %ok-for-header */
+
+/* %endif */
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ *	EOB_ACT_LAST_MATCH -
+ *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ *	EOB_ACT_END_OF_FILE - end of file
+ */
+/* %if-c-only */
+static int yy_get_next_buffer (yyscan_t yyscanner)
+/* %endif */
+/* %if-c++-only */
+/* %endif */
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+	register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+	register char *source = yyg->yytext_ptr;
+	register int number_to_move, i;
+	int ret_val;
+
+	if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
+		YY_FATAL_ERROR(
+		"fatal flex scanner internal error--end of buffer missed" );
+
+	if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
+		{ /* Don't try to fill the buffer, so this is an EOF. */
+		if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
+			{
+			/* We matched a single character, the EOB, so
+			 * treat this as a final EOF.
+			 */
+			return EOB_ACT_END_OF_FILE;
+			}
+
+		else
+			{
+			/* We matched some text prior to the EOB, first
+			 * process it.
+			 */
+			return EOB_ACT_LAST_MATCH;
+			}
+		}
+
+	/* Try to read more data. */
+
+	/* First move last chars to start of buffer. */
+	number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
+
+	for ( i = 0; i < number_to_move; ++i )
+		*(dest++) = *(source++);
+
+	if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+		/* don't do the read, it's not guaranteed to return an EOF,
+		 * just force an EOF
+		 */
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
+
+	else
+		{
+			int num_to_read =
+			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+
+		while ( num_to_read <= 0 )
+			{ /* Not enough room in the buffer - grow it. */
+
+			/* just a shorter name for the current buffer */
+			YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
+
+			int yy_c_buf_p_offset =
+				(int) (yyg->yy_c_buf_p - b->yy_ch_buf);
+
+			if ( b->yy_is_our_buffer )
+				{
+				int new_size = b->yy_buf_size * 2;
+
+				if ( new_size <= 0 )
+					b->yy_buf_size += b->yy_buf_size / 8;
+				else
+					b->yy_buf_size *= 2;
+
+				b->yy_ch_buf = (char *)
+					/* Include room in for 2 EOB chars. */
+					VCF_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
+				}
+			else
+				/* Can't grow it, we don't own it. */
+				b->yy_ch_buf = 0;
+
+			if ( ! b->yy_ch_buf )
+				YY_FATAL_ERROR(
+				"fatal error - scanner input buffer overflow" );
+
+			yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+			num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
+						number_to_move - 1;
+
+			}
+
+		if ( num_to_read > YY_READ_BUF_SIZE )
+			num_to_read = YY_READ_BUF_SIZE;
+
+		/* Read in more data. */
+		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
+			yyg->yy_n_chars, (size_t) num_to_read );
+
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
+		}
+
+	if ( yyg->yy_n_chars == 0 )
+		{
+		if ( number_to_move == YY_MORE_ADJ )
+			{
+			ret_val = EOB_ACT_END_OF_FILE;
+			VCF_restart(yyin  ,yyscanner);
+			}
+
+		else
+			{
+			ret_val = EOB_ACT_LAST_MATCH;
+			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
+				YY_BUFFER_EOF_PENDING;
+			}
+		}
+
+	else
+		ret_val = EOB_ACT_CONTINUE_SCAN;
+
+	if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+		/* Extend the array by 50%, plus the number we really need. */
+		yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
+		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) VCF_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
+		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+	}
+
+	yyg->yy_n_chars += number_to_move;
+	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
+	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
+
+	yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+
+	return ret_val;
+}
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+/* %if-c-only */
+/* %not-for-header */
+
+    static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
+/* %endif */
+/* %if-c++-only */
+/* %endif */
+{
+	register yy_state_type yy_current_state;
+	register char *yy_cp;
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+/* %% [15.0] code to get the start state into yy_current_state goes here */
+	yy_current_state = yyg->yy_start;
+	yy_current_state += YY_AT_BOL();
+
+	for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
+		{
+/* %% [16.0] code to find the next state goes here */
+		register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+		if ( yy_accept[yy_current_state] )
+			{
+			yyg->yy_last_accepting_state = yy_current_state;
+			yyg->yy_last_accepting_cpos = yy_cp;
+			}
+		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+			{
+			yy_current_state = (int) yy_def[yy_current_state];
+			if ( yy_current_state >= 57 )
+				yy_c = yy_meta[(unsigned int) yy_c];
+			}
+		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+		}
+
+	return yy_current_state;
+}
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ *	next_state = yy_try_NUL_trans( current_state );
+ */
+/* %if-c-only */
+    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state , yyscan_t yyscanner)
+/* %endif */
+/* %if-c++-only */
+/* %endif */
+{
+	register int yy_is_jam;
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
+/* %% [17.0] code to find the next state, and perhaps do backing up, goes here */
+	register char *yy_cp = yyg->yy_c_buf_p;
+
+	register YY_CHAR yy_c = 1;
+	if ( yy_accept[yy_current_state] )
+		{
+		yyg->yy_last_accepting_state = yy_current_state;
+		yyg->yy_last_accepting_cpos = yy_cp;
+		}
+	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+		{
+		yy_current_state = (int) yy_def[yy_current_state];
+		if ( yy_current_state >= 57 )
+			yy_c = yy_meta[(unsigned int) yy_c];
+		}
+	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+	yy_is_jam = (yy_current_state == 56);
+
+	return yy_is_jam ? 0 : yy_current_state;
+}
+
+/* %if-c-only */
+
+    static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner)
+/* %endif */
+/* %if-c++-only */
+/* %endif */
+{
+	register char *yy_cp;
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+    yy_cp = yyg->yy_c_buf_p;
+
+	/* undo effects of setting up yytext */
+	*yy_cp = yyg->yy_hold_char;
+
+	if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+		{ /* need to shift things up to make room */
+		/* +2 for EOB chars. */
+		register int number_to_move = yyg->yy_n_chars + 2;
+		register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
+					YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
+		register char *source =
+				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
+
+		while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+			*--dest = *--source;
+
+		yy_cp += (int) (dest - source);
+		yy_bp += (int) (dest - source);
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
+			yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
+
+		if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+			YY_FATAL_ERROR( "flex scanner push-back overflow" );
+		}
+
+	*--yy_cp = (char) c;
+
+/* %% [18.0] update yylineno here */
+
+    if ( c == '\n' ){
+        --yylineno;
+    }
+
+	yyg->yytext_ptr = yy_bp;
+	yyg->yy_hold_char = *yy_cp;
+	yyg->yy_c_buf_p = yy_cp;
+}
+/* %if-c-only */
+
+/* %endif */
+
+/* %if-c-only */
+#ifndef YY_NO_INPUT
+#ifdef __cplusplus
+    static int yyinput (yyscan_t yyscanner)
+#else
+    static int input  (yyscan_t yyscanner)
+#endif
+
+/* %endif */
+/* %if-c++-only */
+/* %endif */
+{
+	int c;
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+	*yyg->yy_c_buf_p = yyg->yy_hold_char;
+
+	if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
+		{
+		/* yy_c_buf_p now points to the character we want to return.
+		 * If this occurs *before* the EOB characters, then it's a
+		 * valid NUL; if not, then we've hit the end of the buffer.
+		 */
+		if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
+			/* This was really a NUL. */
+			*yyg->yy_c_buf_p = '\0';
+
+		else
+			{ /* need more input */
+			int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
+			++yyg->yy_c_buf_p;
+
+			switch ( yy_get_next_buffer( yyscanner ) )
+				{
+				case EOB_ACT_LAST_MATCH:
+					/* This happens because yy_g_n_b()
+					 * sees that we've accumulated a
+					 * token and flags that we need to
+					 * try matching the token before
+					 * proceeding.  But for input(),
+					 * there's no matching to consider.
+					 * So convert the EOB_ACT_LAST_MATCH
+					 * to EOB_ACT_END_OF_FILE.
+					 */
+
+					/* Reset buffer status. */
+					VCF_restart(yyin ,yyscanner);
+
+					/*FALLTHROUGH*/
+
+				case EOB_ACT_END_OF_FILE:
+					{
+					if ( VCF_wrap(yyscanner ) )
+						return EOF;
+
+					if ( ! yyg->yy_did_buffer_switch_on_eof )
+						YY_NEW_FILE;
+#ifdef __cplusplus
+					return yyinput(yyscanner);
+#else
+					return input(yyscanner);
+#endif
+					}
+
+				case EOB_ACT_CONTINUE_SCAN:
+					yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
+					break;
+				}
+			}
+		}
+
+	c = *(unsigned char *) yyg->yy_c_buf_p;	/* cast for 8-bit char's */
+	*yyg->yy_c_buf_p = '\0';	/* preserve yytext */
+	yyg->yy_hold_char = *++yyg->yy_c_buf_p;
+
+/* %% [19.0] update BOL and yylineno */
+	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
+	if ( YY_CURRENT_BUFFER_LVALUE->yy_at_bol )
+		   
+    do{ yylineno++;
+        yycolumn=0;
+    }while(0)
+;
+
+	return c;
+}
+/* %if-c-only */
+#endif	/* ifndef YY_NO_INPUT */
+/* %endif */
+
+/** Immediately switch to a different input stream.
+ * @param input_file A readable stream.
+ * @param yyscanner The scanner object.
+ * @note This function does not reset the start condition to @c INITIAL .
+ */
+/* %if-c-only */
+    void VCF_restart  (FILE * input_file , yyscan_t yyscanner)
+/* %endif */
+/* %if-c++-only */
+/* %endif */
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+	if ( ! YY_CURRENT_BUFFER ){
+        VCF_ensure_buffer_stack (yyscanner);
+		YY_CURRENT_BUFFER_LVALUE =
+            VCF__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
+	}
+
+	VCF__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
+	VCF__load_buffer_state(yyscanner );
+}
+
+/** Switch to a different input buffer.
+ * @param new_buffer The new input buffer.
+ * @param yyscanner The scanner object.
+ */
+/* %if-c-only */
+    void VCF__switch_to_buffer  (YY_BUFFER_STATE  new_buffer , yyscan_t yyscanner)
+/* %endif */
+/* %if-c++-only */
+/* %endif */
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+	/* TODO. We should be able to replace this entire function body
+	 * with
+	 *		VCF_pop_buffer_state();
+	 *		VCF_push_buffer_state(new_buffer);
+     */
+	VCF_ensure_buffer_stack (yyscanner);
+	if ( YY_CURRENT_BUFFER == new_buffer )
+		return;
+
+	if ( YY_CURRENT_BUFFER )
+		{
+		/* Flush out information for old buffer. */
+		*yyg->yy_c_buf_p = yyg->yy_hold_char;
+		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
+		}
+
+	YY_CURRENT_BUFFER_LVALUE = new_buffer;
+	VCF__load_buffer_state(yyscanner );
+
+	/* We don't actually know whether we did this switch during
+	 * EOF (VCF_wrap()) processing, but the only time this flag
+	 * is looked at is after VCF_wrap() is called, so it's safe
+	 * to go ahead and always set it.
+	 */
+	yyg->yy_did_buffer_switch_on_eof = 1;
+}
+
+/* %if-c-only */
+static void VCF__load_buffer_state  (yyscan_t yyscanner)
+/* %endif */
+/* %if-c++-only */
+/* %endif */
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+	yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+	yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
+	yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
+	yyg->yy_hold_char = *yyg->yy_c_buf_p;
+}
+
+/** Allocate and initialize an input buffer state.
+ * @param file A readable stream.
+ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
+ * @param yyscanner The scanner object.
+ * @return the allocated buffer state.
+ */
+/* %if-c-only */
+    YY_BUFFER_STATE VCF__create_buffer  (FILE * file, int  size , yyscan_t yyscanner)
+/* %endif */
+/* %if-c++-only */
+/* %endif */
+{
+	YY_BUFFER_STATE b;
+    
+	b = (YY_BUFFER_STATE) VCF_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
+	if ( ! b )
+		YY_FATAL_ERROR( "out of dynamic memory in VCF__create_buffer()" );
+
+	b->yy_buf_size = size;
+
+	/* yy_ch_buf has to be 2 characters longer than the size given because
+	 * we need to put in 2 end-of-buffer characters.
+	 */
+	b->yy_ch_buf = (char *) VCF_alloc(b->yy_buf_size + 2 ,yyscanner );
+	if ( ! b->yy_ch_buf )
+		YY_FATAL_ERROR( "out of dynamic memory in VCF__create_buffer()" );
+
+	b->yy_is_our_buffer = 1;
+
+	VCF__init_buffer(b,file ,yyscanner);
+
+	return b;
+}
+
+/** Destroy the buffer.
+ * @param b a buffer created with VCF__create_buffer()
+ * @param yyscanner The scanner object.
+ */
+/* %if-c-only */
+    void VCF__delete_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
+/* %endif */
+/* %if-c++-only */
+/* %endif */
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+	if ( ! b )
+		return;
+
+	if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
+		YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
+
+	if ( b->yy_is_our_buffer )
+		VCF_free((void *) b->yy_ch_buf ,yyscanner );
+
+	VCF_free((void *) b ,yyscanner );
+}
+
+/* %if-c-only */
+
+/* %endif */
+
+/* %if-c++-only */
+/* %endif */
+
+/* Initializes or reinitializes a buffer.
+ * This function is sometimes called more than once on the same buffer,
+ * such as during a VCF_restart() or at EOF.
+ */
+/* %if-c-only */
+    static void VCF__init_buffer  (YY_BUFFER_STATE  b, FILE * file , yyscan_t yyscanner)
+/* %endif */
+/* %if-c++-only */
+/* %endif */
+
+{
+	int oerrno = errno;
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+	VCF__flush_buffer(b ,yyscanner);
+
+	b->yy_input_file = file;
+	b->yy_fill_buffer = 1;
+
+    /* If b is the current buffer, then VCF__init_buffer was _probably_
+     * called from VCF_restart() or through yy_get_next_buffer.
+     * In that case, we don't want to reset the lineno or column.
+     */
+    if (b != YY_CURRENT_BUFFER){
+        b->yy_bs_lineno = 1;
+        b->yy_bs_column = 0;
+    }
+
+/* %if-c-only */
+
+        b->yy_is_interactive = 0;
+    
+/* %endif */
+/* %if-c++-only */
+/* %endif */
+	errno = oerrno;
+}
+
+/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
+ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
+ * @param yyscanner The scanner object.
+ */
+/* %if-c-only */
+    void VCF__flush_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
+/* %endif */
+/* %if-c++-only */
+/* %endif */
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+	if ( ! b )
+		return;
+
+	b->yy_n_chars = 0;
+
+	/* We always need two end-of-buffer characters.  The first causes
+	 * a transition to the end-of-buffer state.  The second causes
+	 * a jam in that state.
+	 */
+	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+	b->yy_buf_pos = &b->yy_ch_buf[0];
+
+	b->yy_at_bol = 1;
+	b->yy_buffer_status = YY_BUFFER_NEW;
+
+	if ( b == YY_CURRENT_BUFFER )
+		VCF__load_buffer_state(yyscanner );
+}
+
+/* %if-c-or-c++ */
+/** Pushes the new state onto the stack. The new state becomes
+ *  the current state. This function will allocate the stack
+ *  if necessary.
+ *  @param new_buffer The new state.
+ *  @param yyscanner The scanner object.
+ */
+/* %if-c-only */
+void VCF_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
+/* %endif */
+/* %if-c++-only */
+/* %endif */
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+	if (new_buffer == NULL)
+		return;
+
+	VCF_ensure_buffer_stack(yyscanner);
+
+	/* This block is copied from VCF__switch_to_buffer. */
+	if ( YY_CURRENT_BUFFER )
+		{
+		/* Flush out information for old buffer. */
+		*yyg->yy_c_buf_p = yyg->yy_hold_char;
+		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
+		}
+
+	/* Only push if top exists. Otherwise, replace top. */
+	if (YY_CURRENT_BUFFER)
+		yyg->yy_buffer_stack_top++;
+	YY_CURRENT_BUFFER_LVALUE = new_buffer;
+
+	/* copied from VCF__switch_to_buffer. */
+	VCF__load_buffer_state(yyscanner );
+	yyg->yy_did_buffer_switch_on_eof = 1;
+}
+/* %endif */
+
+/* %if-c-or-c++ */
+/** Removes and deletes the top of the stack, if present.
+ *  The next element becomes the new top.
+ *  @param yyscanner The scanner object.
+ */
+/* %if-c-only */
+void VCF_pop_buffer_state (yyscan_t yyscanner)
+/* %endif */
+/* %if-c++-only */
+/* %endif */
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+	if (!YY_CURRENT_BUFFER)
+		return;
+
+	VCF__delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
+	YY_CURRENT_BUFFER_LVALUE = NULL;
+	if (yyg->yy_buffer_stack_top > 0)
+		--yyg->yy_buffer_stack_top;
+
+	if (YY_CURRENT_BUFFER) {
+		VCF__load_buffer_state(yyscanner );
+		yyg->yy_did_buffer_switch_on_eof = 1;
+	}
+}
+/* %endif */
+
+/* %if-c-or-c++ */
+/* Allocates the stack if it does not exist.
+ *  Guarantees space for at least one push.
+ */
+/* %if-c-only */
+static void VCF_ensure_buffer_stack (yyscan_t yyscanner)
+/* %endif */
+/* %if-c++-only */
+/* %endif */
+{
+	int num_to_alloc;
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+	if (!yyg->yy_buffer_stack) {
+
+		/* First allocation is just for 2 elements, since we don't know if this
+		 * scanner will even need a stack. We use 2 instead of 1 to avoid an
+		 * immediate realloc on the next call.
+         */
+		num_to_alloc = 1;
+		yyg->yy_buffer_stack = (struct yy_buffer_state**)VCF_alloc
+								(num_to_alloc * sizeof(struct yy_buffer_state*)
+								, yyscanner);
+		if ( ! yyg->yy_buffer_stack )
+			YY_FATAL_ERROR( "out of dynamic memory in VCF_ensure_buffer_stack()" );
+								  
+		memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
+				
+		yyg->yy_buffer_stack_max = num_to_alloc;
+		yyg->yy_buffer_stack_top = 0;
+		return;
+	}
+
+	if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
+
+		/* Increase the buffer to prepare for a possible push. */
+		int grow_size = 8 /* arbitrary grow size */;
+
+		num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
+		yyg->yy_buffer_stack = (struct yy_buffer_state**)VCF_realloc
+								(yyg->yy_buffer_stack,
+								num_to_alloc * sizeof(struct yy_buffer_state*)
+								, yyscanner);
+		if ( ! yyg->yy_buffer_stack )
+			YY_FATAL_ERROR( "out of dynamic memory in VCF_ensure_buffer_stack()" );
+
+		/* zero only the new slots.*/
+		memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
+		yyg->yy_buffer_stack_max = num_to_alloc;
+	}
+}
+/* %endif */
+
+/* %if-c-only */
+/** Setup the input buffer state to scan directly from a user-specified character buffer.
+ * @param base the character buffer
+ * @param size the size in bytes of the character buffer
+ * @param yyscanner The scanner object.
+ * @return the newly allocated buffer state object. 
+ */
+YY_BUFFER_STATE VCF__scan_buffer  (char * base, yy_size_t  size , yyscan_t yyscanner)
+{
+	YY_BUFFER_STATE b;
+    
+	if ( size < 2 ||
+	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
+	     base[size-1] != YY_END_OF_BUFFER_CHAR )
+		/* They forgot to leave room for the EOB's. */
+		return 0;
+
+	b = (YY_BUFFER_STATE) VCF_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
+	if ( ! b )
+		YY_FATAL_ERROR( "out of dynamic memory in VCF__scan_buffer()" );
+
+	b->yy_buf_size = size - 2;	/* "- 2" to take care of EOB's */
+	b->yy_buf_pos = b->yy_ch_buf = base;
+	b->yy_is_our_buffer = 0;
+	b->yy_input_file = 0;
+	b->yy_n_chars = b->yy_buf_size;
+	b->yy_is_interactive = 0;
+	b->yy_at_bol = 1;
+	b->yy_fill_buffer = 0;
+	b->yy_buffer_status = YY_BUFFER_NEW;
+
+	VCF__switch_to_buffer(b ,yyscanner );
+
+	return b;
+}
+/* %endif */
+
+/* %if-c-only */
+/** Setup the input buffer state to scan a string. The next call to VCF_lex() will
+ * scan from a @e copy of @a str.
+ * @param yystr a NUL-terminated string to scan
+ * @param yyscanner The scanner object.
+ * @return the newly allocated buffer state object.
+ * @note If you want to scan bytes that may contain NUL values, then use
+ *       VCF__scan_bytes() instead.
+ */
+YY_BUFFER_STATE VCF__scan_string (yyconst char * yystr , yyscan_t yyscanner)
+{
+    
+	return VCF__scan_bytes(yystr,strlen(yystr) ,yyscanner);
+}
+/* %endif */
+
+/* %if-c-only */
+/** Setup the input buffer state to scan the given bytes. The next call to VCF_lex() will
+ * scan from a @e copy of @a bytes.
+ * @param bytes the byte buffer to scan
+ * @param len the number of bytes in the buffer pointed to by @a bytes.
+ * @param yyscanner The scanner object.
+ * @return the newly allocated buffer state object.
+ */
+YY_BUFFER_STATE VCF__scan_bytes  (yyconst char * yybytes, int  _yybytes_len , yyscan_t yyscanner)
+{
+	YY_BUFFER_STATE b;
+	char *buf;
+	yy_size_t n;
+	int i;
+    
+	/* Get memory for full buffer, including space for trailing EOB's. */
+	n = _yybytes_len + 2;
+	buf = (char *) VCF_alloc(n ,yyscanner );
+	if ( ! buf )
+		YY_FATAL_ERROR( "out of dynamic memory in VCF__scan_bytes()" );
+
+	for ( i = 0; i < _yybytes_len; ++i )
+		buf[i] = yybytes[i];
+
+	buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
+
+	b = VCF__scan_buffer(buf,n ,yyscanner);
+	if ( ! b )
+		YY_FATAL_ERROR( "bad buffer in VCF__scan_bytes()" );
+
+	/* It's okay to grow etc. this buffer, and we should throw it
+	 * away when we're done.
+	 */
+	b->yy_is_our_buffer = 1;
+
+	return b;
+}
+/* %endif */
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+/* %if-c-only */
+static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
+{
+    	(void) fprintf( stderr, "%s\n", msg );
+	exit( YY_EXIT_FAILURE );
+}
+/* %endif */
+/* %if-c++-only */
+/* %endif */
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+	do \
+		{ \
+		/* Undo effects of setting up yytext. */ \
+        int yyless_macro_arg = (n); \
+        YY_LESS_LINENO(yyless_macro_arg);\
+		yytext[yyleng] = yyg->yy_hold_char; \
+		yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
+		yyg->yy_hold_char = *yyg->yy_c_buf_p; \
+		*yyg->yy_c_buf_p = '\0'; \
+		yyleng = yyless_macro_arg; \
+		} \
+	while ( 0 )
+
+/* Accessor  methods (get/set functions) to struct members. */
+
+/* %if-c-only */
+/* %if-reentrant */
+
+/** Get the user-defined data for this scanner.
+ * @param yyscanner The scanner object.
+ */
+YY_EXTRA_TYPE VCF_get_extra  (yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    return yyextra;
+}
+
+/* %endif */
+
+/** Get the current line number.
+ * @param yyscanner The scanner object.
+ */
+int VCF_get_lineno  (yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    
+        if (! YY_CURRENT_BUFFER)
+            return 0;
+    
+    return yylineno;
+}
+
+/** Get the current column number.
+ * @param yyscanner The scanner object.
+ */
+int VCF_get_column  (yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    
+        if (! YY_CURRENT_BUFFER)
+            return 0;
+    
+    return yycolumn;
+}
+
+/** Get the input stream.
+ * @param yyscanner The scanner object.
+ */
+FILE *VCF_get_in  (yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    return yyin;
+}
+
+/** Get the output stream.
+ * @param yyscanner The scanner object.
+ */
+FILE *VCF_get_out  (yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    return yyout;
+}
+
+/** Get the length of the current token.
+ * @param yyscanner The scanner object.
+ */
+int VCF_get_leng  (yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    return yyleng;
+}
+
+/** Get the current token.
+ * @param yyscanner The scanner object.
+ */
+
+char *VCF_get_text  (yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    return yytext;
+}
+
+/* %if-reentrant */
+
+/** Set the user-defined data. This data is never touched by the scanner.
+ * @param user_defined The data to be associated with this scanner.
+ * @param yyscanner The scanner object.
+ */
+void VCF_set_extra (YY_EXTRA_TYPE  user_defined , yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    yyextra = user_defined ;
+}
+
+/* %endif */
+
+/** Set the current line number.
+ * @param line_number
+ * @param yyscanner The scanner object.
+ */
+void VCF_set_lineno (int  line_number , yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+        /* lineno is only valid if an input buffer exists. */
+        if (! YY_CURRENT_BUFFER )
+           yy_fatal_error( "VCF_set_lineno called with no buffer" , yyscanner); 
+    
+    yylineno = line_number;
+}
+
+/** Set the current column.
+ * @param line_number
+ * @param yyscanner The scanner object.
+ */
+void VCF_set_column (int  column_no , yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+        /* column is only valid if an input buffer exists. */
+        if (! YY_CURRENT_BUFFER )
+           yy_fatal_error( "VCF_set_column called with no buffer" , yyscanner); 
+    
+    yycolumn = column_no;
+}
+
+/** Set the input stream. This does not discard the current
+ * input buffer.
+ * @param in_str A readable stream.
+ * @param yyscanner The scanner object.
+ * @see VCF__switch_to_buffer
+ */
+void VCF_set_in (FILE *  in_str , yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    yyin = in_str ;
+}
+
+void VCF_set_out (FILE *  out_str , yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    yyout = out_str ;
+}
+
+int VCF_get_debug  (yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    return yy_flex_debug;
+}
+
+void VCF_set_debug (int  bdebug , yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    yy_flex_debug = bdebug ;
+}
+
+/* %endif */
+
+/* %if-reentrant */
+/* Accessor methods for yylval and yylloc */
+
+/* %if-bison-bridge */
+
+YYSTYPE * VCF_get_lval  (yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    return yylval;
+}
+
+void VCF_set_lval (YYSTYPE *  yylval_param , yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    yylval = yylval_param;
+}
+
+/* %endif */
+
+/* User-visible API */
+
+/* VCF_lex_init is special because it creates the scanner itself, so it is
+ * the ONLY reentrant function that doesn't take the scanner as the last argument.
+ * That's why we explicitly handle the declaration, instead of using our macros.
+ */
+
+int VCF_lex_init(yyscan_t* ptr_yy_globals)
+
+{
+    if (ptr_yy_globals == NULL){
+        errno = EINVAL;
+        return 1;
+    }
+
+    *ptr_yy_globals = (yyscan_t) VCF_alloc ( sizeof( struct yyguts_t ), NULL );
+
+    if (*ptr_yy_globals == NULL){
+        errno = ENOMEM;
+        return 1;
+    }
+
+    /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
+    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
+
+    return yy_init_globals ( *ptr_yy_globals );
+}
+
+/* VCF_lex_init_extra has the same functionality as VCF_lex_init, but follows the
+ * convention of taking the scanner as the last argument. Note however, that
+ * this is a *pointer* to a scanner, as it will be allocated by this call (and
+ * is the reason, too, why this function also must handle its own declaration).
+ * The user defined value in the first argument will be available to VCF_alloc in
+ * the yyextra field.
+ */
+
+int VCF_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
+
+{
+    struct yyguts_t dummy_yyguts;
+
+    VCF_set_extra (yy_user_defined, &dummy_yyguts);
+
+    if (ptr_yy_globals == NULL){
+        errno = EINVAL;
+        return 1;
+    }
+	
+    *ptr_yy_globals = (yyscan_t) VCF_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
+	
+    if (*ptr_yy_globals == NULL){
+        errno = ENOMEM;
+        return 1;
+    }
+    
+    /* By setting to 0xAA, we expose bugs in
+    yy_init_globals. Leave at 0x00 for releases. */
+    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
+    
+    VCF_set_extra (yy_user_defined, *ptr_yy_globals);
+    
+    return yy_init_globals ( *ptr_yy_globals );
+}
+
+/* %endif if-c-only */
+
+/* %if-c-only */
+static int yy_init_globals (yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    /* Initialization is the same as for the non-reentrant scanner.
+     * This function is called from VCF_lex_destroy(), so don't allocate here.
+     */
+
+    yyg->yy_buffer_stack = 0;
+    yyg->yy_buffer_stack_top = 0;
+    yyg->yy_buffer_stack_max = 0;
+    yyg->yy_c_buf_p = (char *) 0;
+    yyg->yy_init = 0;
+    yyg->yy_start = 0;
+
+    yyg->yy_start_stack_ptr = 0;
+    yyg->yy_start_stack_depth = 0;
+    yyg->yy_start_stack =  NULL;
+
+/* Defined in main.c */
+#ifdef YY_STDINIT
+    yyin = stdin;
+    yyout = stdout;
+#else
+    yyin = (FILE *) 0;
+    yyout = (FILE *) 0;
+#endif
+
+    /* For future reference: Set errno on error, since we are called by
+     * VCF_lex_init()
+     */
+    return 0;
+}
+/* %endif */
+
+/* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */
+/* VCF_lex_destroy is for both reentrant and non-reentrant scanners. */
+int VCF_lex_destroy  (yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+    /* Pop the buffer stack, destroying each element. */
+	while(YY_CURRENT_BUFFER){
+		VCF__delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
+		YY_CURRENT_BUFFER_LVALUE = NULL;
+		VCF_pop_buffer_state(yyscanner);
+	}
+
+	/* Destroy the stack itself. */
+	VCF_free(yyg->yy_buffer_stack ,yyscanner);
+	yyg->yy_buffer_stack = NULL;
+
+    /* Destroy the start condition stack. */
+        VCF_free(yyg->yy_start_stack ,yyscanner );
+        yyg->yy_start_stack = NULL;
+
+    /* Reset the globals. This is important in a non-reentrant scanner so the next time
+     * VCF_lex() is called, initialization will occur. */
+    yy_init_globals( yyscanner);
+
+/* %if-reentrant */
+    /* Destroy the main struct (reentrant only). */
+    VCF_free ( yyscanner , yyscanner );
+    yyscanner = NULL;
+/* %endif */
+    return 0;
+}
+/* %endif */
+
+/*
+ * Internal utility routines.
+ */
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
+{
+	register int i;
+	for ( i = 0; i < n; ++i )
+		s1[i] = s2[i];
+}
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
+{
+	register int n;
+	for ( n = 0; s[n]; ++n )
+		;
+
+	return n;
+}
+#endif
+
+void *VCF_alloc (yy_size_t  size , yyscan_t yyscanner)
+{
+	return (void *) malloc( size );
+}
+
+void *VCF_realloc  (void * ptr, yy_size_t  size , yyscan_t yyscanner)
+{
+	/* The cast to (char *) in the following accommodates both
+	 * implementations that use char* generic pointers, and those
+	 * that use void* generic pointers.  It works with the latter
+	 * because both ANSI C and C++ allow castless assignment from
+	 * any pointer type to void*, and deal with argument conversions
+	 * as though doing an assignment.
+	 */
+	return (void *) realloc( (char *) ptr, size );
+}
+
+void VCF_free (void * ptr , yyscan_t yyscanner)
+{
+	free( (char *) ptr );	/* see VCF_realloc() for (char *) cast */
+}
+
+/* %if-tables-serialization definitions */
+/* %define-yytables   The name for this specific scanner's tables. */
+#define YYTABLES_NAME "yytables"
+/* %endif */
+
+/* %ok-for-header */
+
+rc_t CC VCFScan_yylex_init(VCFParseBlock* sb, bool debug)
+{
+	if (VCF_lex_init_extra(sb,&sb->scanner) != 0)
+	{
+		return RC ( rcKFG, rcMgr, rcParsing, rcMemory, rcExhausted );
+	}		
+
+    sb->offset = 0;
+    
+    sb->lastToken = NULL;
+    sb->column = 1;
+    
+	VCF_set_debug(debug ? 1 : 0,sb->scanner);
+
+	return 0;
+}
+
+void CC VCFScan_yylex_destroy(VCFParseBlock* sb)
+{
+	if (sb->scanner)
+	{
+		VCF_lex_destroy(sb->scanner);
+	}		
+	sb->scanner=0;
+}
+
diff --git a/tools/vcf-loader/vcf-lex.l b/tools/vcf-loader/vcf-lex.l
new file mode 100644
index 0000000..17925b3
--- /dev/null
+++ b/tools/vcf-loader/vcf-lex.l
@@ -0,0 +1,134 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+ 
+%{ 
+    #include <klib/rc.h>
+    #include <klib/text.h>
+    
+	#include "vcf-parse.h"
+	#include "vcf-grammar.h"    
+
+    #define YYSTYPE VCFToken
+
+    /* code to populate token with internal values */
+    #define YY_USER_ACTION              \
+        yylval -> tokenText     = yytext; \
+        yylval -> tokenStart    = yyextra->offset; \
+        yylval -> tokenLength	= yyleng;	\
+        yylval -> line_no		= yylineno;	\
+        yylval -> column_no		= yyextra -> column; \
+        yyextra -> lastToken = yylval; \
+        yyextra -> offset += yyleng; \
+        yyextra -> column += yyleng; 
+
+    #define ENDLINE \
+        yyextra -> column=1; \
+        return vcfENDLINE;
+
+    #define YY_INPUT(buf, result, max_size) \
+        result = yyextra->input(yyextra, buf, max_size)
+
+    #define ECHO
+
+    #define YY_NO_INPUT
+%}
+
+%option never-interactive nounistd yylineno reentrant bison-bridge noyywrap
+
+%option prefix="VCF_"
+%option extra-type="VCFParseBlock*"
+
+%option debug
+
+alphanum    [A-Za-z0-9\-_]+
+
+%x HEADER
+%x DATA
+%x META
+%x META_SIMPLE
+%x META_COMPOSITE
+
+%%
+
+^##                     { BEGIN META; }
+^#                      { BEGIN HEADER; }
+
+^[^#][^\t\r\n]*         { BEGIN DATA; return vcfDATAITEM; }
+
+<DATA>[^\t\r\n]+        { return vcfDATAITEM; }
+
+<META>fileformat/=      { BEGIN META_SIMPLE; return vcfMETAKEY_FORMAT; }
+<META>{alphanum}/=      { BEGIN META_SIMPLE; return vcfMETAKEY; }
+<META>{alphanum}/=<     { BEGIN META_COMPOSITE; return vcfMETAKEY; }
+
+<META_SIMPLE>
+{
+    [^=\r\n]+       { return vcfMETAVALUE; }
+}
+<META_COMPOSITE>
+{
+    {alphanum}/=      { return vcfMETAKEY; }
+    [^=<,>\r\n]+      { return vcfMETAVALUE; }
+}
+
+<*>
+{
+    \t                          
+    \n          { BEGIN 0; ENDLINE; }
+    \r\n        { BEGIN 0; ENDLINE; }
+    \r/[^\n]    { BEGIN 0; ENDLINE; }
+    .           { return yytext[0]; }
+}
+
+<HEADER>[^\t\r\n]+      { return vcfHEADERITEM; }
+
+%%    
+
+rc_t CC VCFScan_yylex_init(VCFParseBlock* sb, bool debug)
+{
+	if (yylex_init_extra(sb, &sb->scanner) != 0)
+	{
+		return RC ( rcKFG, rcMgr, rcParsing, rcMemory, rcExhausted );
+	}		
+
+    sb->offset = 0;
+    
+    sb->lastToken = NULL;
+    sb->column = 1;
+    
+	yyset_debug(debug ? 1 : 0, sb->scanner);
+
+	return 0;
+}
+
+void CC VCFScan_yylex_destroy(VCFParseBlock* sb)
+{
+	if (sb->scanner)
+	{
+		yylex_destroy(sb->scanner);
+	}		
+	sb->scanner=0;
+}
diff --git a/tools/vcf-loader/vcf-load.vers b/tools/vcf-loader/vcf-load.vers
new file mode 100644
index 0000000..8e8299d
--- /dev/null
+++ b/tools/vcf-loader/vcf-load.vers
@@ -0,0 +1 @@
+2.4.2
diff --git a/tools/vcf-loader/vcf-loader.c b/tools/vcf-loader/vcf-loader.c
new file mode 100644
index 0000000..a5aabd7
--- /dev/null
+++ b/tools/vcf-loader/vcf-loader.c
@@ -0,0 +1,131 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ * 
+ */
+
+#include "vcf-load.vers.h"
+
+#include <string.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#include <kapp/main.h>
+#include <kapp/args.h>
+#include <loader/common-writer.h>
+#include <klib/rc.h>
+#include <klib/out.h>
+#include <klib/log.h>
+#include <klib/text.h>
+#include <klib/printf.h>
+#include <kapp/log-xml.h>
+#include <align/writer-refseq.h>
+
+static char const option_input[] = "input";
+static char const option_output[] = "output";
+
+#define OPTION_INPUT option_input
+#define OPTION_OUTPUT option_output
+
+#define ALIAS_INPUT  "i"
+#define ALIAS_OUTPUT "o"
+
+static
+char const * output_usage[] = 
+{
+    "Path and Name of the output database.",
+    NULL
+};
+
+OptDef Options[] = 
+{
+    /* order here is same as in param array below!!! */               /* max#,  needs param, required */
+    { OPTION_OUTPUT,        ALIAS_OUTPUT,           NULL, output_usage,     1,  true,        true },
+};
+
+const char* OptHelpParam[] =
+{
+    /* order here is same as in OptDef array above!!! */
+    "path",
+};
+
+rc_t UsageSummary (char const * progname)
+{
+    return KOutMsg (
+        "Usage:\n"
+        "\t%s [options] <fastq-file> ...\n"
+        "\n"
+        "Summary:\n"
+        "\tLoad VCF formatted data files\n"
+        "\n"
+        "Example:\n"
+        "\t%s -o /tmp/SRZ123456 123456-1.vcf 123456-2.vcf\n"
+        "\n"
+        ,progname, progname);
+}
+
+char const UsageDefaultName[] = "vcf-load";
+
+rc_t CC Usage (const Args * args)
+{
+    rc_t rc;
+    int i;
+    const char * progname = UsageDefaultName;
+    const char * fullpath = UsageDefaultName;
+    const size_t argsQty = sizeof(Options) / sizeof(Options[0]);
+
+    if (args == NULL)
+        rc = RC (rcApp, rcArgv, rcAccessing, rcSelf, rcNull);
+    else
+        rc = ArgsProgram (args, &fullpath, &progname);
+    if (rc)
+        progname = fullpath = UsageDefaultName;
+
+    UsageSummary (progname);
+
+    for(i = 0; i < argsQty; i++ ) {
+        if( Options[i].required && Options[i].help[0] != NULL ) {
+            HelpOptionLine(Options[i].aliases, Options[i].name, OptHelpParam[i], Options[i].help);
+        }
+    }
+    OUTMSG(("\nOptions:\n"));
+    for(i = 0; i < argsQty; i++ ) {
+        if( !Options[i].required && Options[i].help[0] != NULL ) {
+            HelpOptionLine(Options[i].aliases, Options[i].name, OptHelpParam[i], Options[i].help);
+        }
+    }
+    OUTMSG(("\n"));
+    HelpOptionsStandard ();
+    HelpVersion (fullpath, KAppVersion());
+    return rc;
+}
+
+uint32_t CC KAppVersion (void)
+{
+    return VCF_LOAD_VERS;
+}
+
+rc_t CC KMain (int argc, char * argv[])
+{
+    return 0;
+}
diff --git a/tools/vcf-loader/vcf-parse.h b/tools/vcf-loader/vcf-parse.h
new file mode 100644
index 0000000..5398c0f
--- /dev/null
+++ b/tools/vcf-loader/vcf-parse.h
@@ -0,0 +1,88 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+
+#ifndef _h_vcf_parse_
+#define _h_vcf_parse_
+
+#include <klib/defs.h>
+
+typedef struct VCFToken
+{ 
+    const char* tokenText; /* 0-terminated, short-lived */
+    size_t tokenStart;  /* 0-based offset from the start of input */
+    size_t tokenLength;
+    size_t line_no;
+    size_t column_no;
+} VCFToken;
+
+struct VcfRecord;
+struct VcfReader;
+
+typedef struct VCFParseBlock
+{
+    void* self; /* VcfReader object or a test double */
+    void* scanner; /* flex control block */
+    
+    size_t (*input)(struct VCFParseBlock* pb, char* buf, size_t max_size); /* read the next part of the input */
+    void (*error)(struct VCFParseBlock* pb, const char* message);
+    
+    void (*metaLine)(struct VCFParseBlock* pb, VCFToken* key, VCFToken* value); /* simple meta line: ##key=value */
+    
+    /* two-level meta line: ##key=<key=value,...> */
+    void (*openMetaLine)(struct VCFParseBlock* pb, VCFToken* key);              
+    void (*keyValue)(struct VCFParseBlock* pb, VCFToken* key, VCFToken* value);
+    void (*headerItem)(struct VCFParseBlock* pb, VCFToken* value);
+    void (*closeMetaLine)(struct VCFParseBlock* pb);
+    
+    /* data line */
+    void (*openDataLine)(struct VCFParseBlock* pb);
+    void (*dataItem)(struct VCFParseBlock* pb, VCFToken* value);
+    void (*closeDataLine)(struct VCFParseBlock* pb);
+
+    size_t offset;  /* 0-based offset from the start of input */
+    size_t column;  /* 1-based column, for error reporting */
+    
+   /* for error reporting, valid inside error() only: */
+    VCFToken* lastToken;
+  
+} VCFParseBlock;
+
+extern rc_t VCFScan_yylex_init(VCFParseBlock* context, bool debug);
+extern void VCFScan_yylex_destroy(VCFParseBlock* context);
+
+extern void VCF_set_lineno (int line_number, void* scanner);
+
+extern int VCF_lex(VCFToken* pb, void * scanner);
+extern void VCF_unlex(VCFParseBlock* pb, VCFToken* token);
+
+extern int VCF_debug; /* set to 1 to print Bison trace */ 
+
+/* read 1 data line (possibly preceded by any number of meta/header lines) */
+extern int VCF_parse(VCFParseBlock* pb); /* 0 = end of input, 1 = success, a new record is in context->record, 2 - syntax error */
+
+extern void VCF_error(VCFParseBlock* pb, const char* msg);
+
+#endif /* _h_vcf_parse_ */
diff --git a/tools/vcf-loader/vcf-reader.c b/tools/vcf-loader/vcf-reader.c
new file mode 100644
index 0000000..d39df66
--- /dev/null
+++ b/tools/vcf-loader/vcf-reader.c
@@ -0,0 +1,438 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+
+#include "vcf-reader.h"
+#include "vcf-parse.h"
+
+#include <klib/rc.h>
+
+#include <klib/text.h>
+#include <klib/namelist.h>
+#include <klib/vector.h>
+#include <klib/printf.h>
+
+#include <kfs/mmap.h>
+
+#include <sysalloc.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+#define LINE_VECTOR_BLOCK_SIZE 1024
+#define GENOTYPE_LIST_BLOCK_SIZE 64
+#define MESSAGE_LIST_BLOCK_SIZE 64
+#define PARSE_ERROR RC ( rcAlign, rcFile, rcParsing, rcFormat, rcIncorrect )
+#define MANDATORY_DATA_FIELDS_NUMBER 8
+
+/*=============== VcfDataLine ================*/
+static
+rc_t VcfDataLineMake(VcfDataLine** pself)
+{
+    if ( pself == NULL )
+        return RC ( rcAlign, rcFile, rcReading, rcSelf, rcNull );
+    else
+    {
+        VcfDataLine* self;
+        rc_t rc = 0;
+        
+        *pself = NULL;
+        
+        self = malloc(sizeof(VcfDataLine));
+        if (self == NULL)
+            return RC ( rcAlign, rcFile, rcReading, rcMemory, rcExhausted );
+        
+        memset(self, 0, sizeof(VcfDataLine));
+        
+        rc = VNamelistMake( &self->genotypeFields, GENOTYPE_LIST_BLOCK_SIZE);
+        if (rc == 0)
+            *pself = self;
+        else
+            free(self);
+        return rc;
+    }
+}
+
+static
+rc_t VcfDataLineWhack(VcfDataLine* self)
+{
+    rc_t rc = 0;
+    
+    if (self != NULL)
+        rc = VNamelistRelease(self->genotypeFields);
+        
+    free(self);
+    
+    return rc;
+}
+
+/*=============== VcfReader ================*/
+
+struct VcfReader
+{
+    char* input;
+    size_t inputSize;
+    size_t curPos;
+    VCFParseBlock pb;
+    
+    Vector lines;  /* the element type is VcfDataLine* */
+    
+    VNamelist* messages;
+};
+
+/* bison helpers */
+static size_t Input(VCFParseBlock* pb, char* buf, size_t maxSize);
+static void Error(VCFParseBlock* pb, const char* message);
+static void AddMetaLine(VCFParseBlock* pb, VCFToken* key, VCFToken* value);
+static void OpenMetaLine(VCFParseBlock* pb, VCFToken* key);
+static void KeyValue(VCFParseBlock* pb, VCFToken* key, VCFToken* value);
+static void HeaderItem(VCFParseBlock* pb, VCFToken* value);
+static void CloseMetaLine(VCFParseBlock* pb);
+static void OpenDataLine(VCFParseBlock* pb);
+static void DataItem(VCFParseBlock* pb, VCFToken* value);
+static void CloseDataLine(VCFParseBlock* pb);
+
+static 
+rc_t VcfReaderInit(VcfReader* self)
+{
+    self->input = NULL;
+    
+    self->pb.self           = self;
+    self->pb.input          = Input;
+    self->pb.error          = Error;
+    
+    self->pb.metaLine       = AddMetaLine;
+    
+    self->pb.openMetaLine   = OpenMetaLine;
+    self->pb.keyValue       = KeyValue;
+    self->pb.headerItem     = HeaderItem;
+    self->pb.closeMetaLine  = CloseMetaLine;
+    
+    self->pb.openDataLine   = OpenDataLine;
+    self->pb.dataItem       = DataItem;
+    self->pb.closeDataLine  = CloseDataLine;
+    
+    VectorInit( &self->lines, 0, LINE_VECTOR_BLOCK_SIZE );
+    
+    return VNamelistMake( &self->messages, MESSAGE_LIST_BLOCK_SIZE);
+}
+
+static void CC WhackLineVectorElement( void *item, void *data )
+{
+    VcfDataLine* elem = (VcfDataLine*)item;
+    VcfDataLineWhack(elem);
+}
+
+rc_t VcfReaderWhack( struct VcfReader* self)
+{
+    rc_t rc = 0;
+
+    if ( self == NULL )
+        return RC ( rcAlign, rcFile, rcDestroying, rcSelf, rcNull );
+
+    VectorWhack( &self->lines, WhackLineVectorElement, NULL );
+
+    rc = VNamelistRelease( self->messages );
+    
+    free(self->input);
+    free(self);
+
+    return rc;
+}
+
+rc_t VcfReaderMake( const struct VcfReader **pself)
+{
+    if ( pself == NULL )
+        return RC ( rcAlign, rcFile, rcConstructing, rcSelf, rcNull );
+        
+    *pself = malloc(sizeof(VcfReader));
+    if ( *pself == NULL )
+        return RC ( rcAlign, rcFile, rcConstructing, rcMemory, rcExhausted );
+
+    return VcfReaderInit((VcfReader*)*pself);
+}
+
+/*=============== callbacks for the bison parser ================*/
+static size_t Input(VCFParseBlock* pb, char* buf, size_t maxSize)
+{
+    VcfReader* self = (VcfReader*)(pb->self);
+    size_t ret = string_copy(buf, maxSize, self->input + self->curPos, self->inputSize - self->curPos);
+    
+    self->curPos += ret;
+    
+    return ret;
+}
+static void Error(VCFParseBlock* pb, const char* message)
+{
+    char buf[1024];
+    VcfReader* self = (VcfReader*)(pb->self);
+    string_printf(buf, sizeof(buf), NULL, 
+                  "line %d column %d: %s", 
+                  pb->lastToken->line_no, pb->lastToken->column_no, message);
+    VNamelistAppend(self->messages, buf);
+}
+
+static void AddMetaLine(VCFParseBlock* pb, VCFToken* key, VCFToken* value)
+{
+}
+static void OpenMetaLine(VCFParseBlock* pb, VCFToken* key)
+{
+}
+static void CloseMetaLine(VCFParseBlock* pb)
+{
+}
+static void KeyValue(VCFParseBlock* pb, VCFToken* key, VCFToken* value)
+{
+}
+static void HeaderItem(VCFParseBlock* pb, VCFToken* value)
+{
+}
+
+static void OpenDataLine(VCFParseBlock* pb)
+{
+    VcfReader* self;
+    VcfDataLine* line;
+    rc_t rc = 0;
+
+    assert(pb);
+
+    self = (VcfReader*)(pb->self);
+    assert(self);
+    
+    /* create new line object */
+    VcfDataLineMake( &line );
+    if (rc == 0)
+    {   /* append to the vector */
+        rc = VectorAppend( &self->lines, NULL, line );
+        if (rc != 0)
+        {
+            SET_RC_FILE_FUNC_LINE(rc);
+            Error(pb, "failed to append a line object");
+        }
+    }
+    else
+    {
+        SET_RC_FILE_FUNC_LINE(rc);
+        Error(pb, "failed to create a line object");
+    }
+}
+static void DataItem(VCFParseBlock* pb, VCFToken* value)
+{
+    VcfReader* self = (VcfReader*)(pb->self);
+    VcfDataLine* line;
+
+    assert(pb);
+    
+    self = (VcfReader*)(pb->self);
+    assert(self);
+    
+    line = (VcfDataLine*) VectorLast( & self->lines );
+    assert(line);
+    
+    #define SAVE_TOKEN(field) StringInit( field, self->input + value->tokenStart, value->tokenLength, (uint32_t)string_size(value->tokenText) )
+
+    switch (line->lastPopulated)
+    {
+    case 0: /*String      chromosome; */
+        SAVE_TOKEN(&line->chromosome);
+        break;
+        
+    case 1: /*uint32_t    position;  */
+        {   
+            char* endptr;
+            long val = strtol(value->tokenText, &endptr, 10);
+            if (*endptr || val < 0 || val > UINT32_MAX)
+                Error(pb, "invalid numeric value for 'position'");
+            else
+                line->position = (uint32_t)val;
+                
+            break;
+        }
+    case 2: /*String      id; */
+        SAVE_TOKEN(&line->id);
+        break;
+    case 3: /*String      refBases; */
+        SAVE_TOKEN(&line->refBases);
+        break;
+    case 4: /*String      altBases;  */
+        SAVE_TOKEN(&line->altBases);
+        break;
+    case 5: /*uint8_t     quality;  */
+        {   
+            char* endptr;
+            long val = strtol(value->tokenText, &endptr, 10);
+            if (*endptr || val < 0 || val > UINT8_MAX)
+                Error(pb, "invalid numeric value for 'quality'");
+            else
+                line->quality = (uint32_t)val;
+                
+            break;
+        }
+    case 6: /*String      filter; */
+        SAVE_TOKEN(&line->filter);
+        break;
+    case 7: /*String      info; */ 
+        SAVE_TOKEN(&line->info);
+        break;
+    default: /* add to the genotypeFields */
+        {
+            rc_t rc = 0;
+            String f;
+            SAVE_TOKEN(&f);
+            rc = VNamelistAppendString(line->genotypeFields, &f);
+            if (rc != 0)
+            {
+                SET_RC_FILE_FUNC_LINE(rc);
+                Error(pb, "failed to append a genotype field");
+            }
+            break;
+        }
+    }
+    
+    ++line->lastPopulated;
+}
+static void CloseDataLine(VCFParseBlock* pb)
+{   
+    /* check if the line had enough data fields */
+    VcfReader* self = (VcfReader*)(pb->self);
+    VcfDataLine* line;
+
+    assert(pb);
+    
+    self = (VcfReader*)(pb->self);
+    assert(self);
+    
+    line = (VcfDataLine*) VectorLast( & self->lines );
+    assert(line);
+    
+    if (line->lastPopulated < MANDATORY_DATA_FIELDS_NUMBER)
+    {
+        -- pb->lastToken->line_no; /* this happens after the EOL has been processed, */
+                                   /* and the line # reported by flex incremented; fix that for error reporting */
+        Error(pb, "one or more of the 8 mandatory columns are missing");
+    }
+}
+
+
+rc_t VcfReaderParse( struct VcfReader *self, struct KFile* inputFile, const struct VNamelist** messages)
+{
+    rc_t rc = 0;
+    uint32_t messageCount;
+    KMMap* mm;
+    
+    if ( self == NULL )
+        return RC ( rcAlign, rcFile, rcParsing, rcSelf, rcNull );
+        
+    if (inputFile == NULL)
+        return RC ( rcAlign, rcFile, rcParsing, rcParam, rcNull );
+        
+    VNameListCount ( self->messages, &messageCount );       
+    if (messageCount > 0)
+    {   /* blow away old mesages */
+        rc = VNamelistRelease( self->messages );
+        if (rc == 0)
+            rc = VNamelistMake( &self->messages, MESSAGE_LIST_BLOCK_SIZE);
+        if (rc != 0)
+            return rc;
+    }
+        
+    rc = KMMapMakeRead ( (const KMMap**)& mm, inputFile );
+    if ( rc == 0 )
+    {
+        rc_t rc2 = 0;
+        
+        const void * ptr;
+        rc = KMMapAddrRead ( mm, & ptr );
+        if ( rc == 0 )
+        {
+            rc = KMMapSize ( mm, & self->inputSize);
+            if ( rc == 0 )
+            {
+                /* make a 0-terminated copy for parsing */
+                self->input = malloc(self->inputSize+1);
+                if (self->input == 0)
+                    rc = RC ( rcAlign, rcFile, rcConstructing, rcMemory, rcExhausted );
+                else
+                {
+                    string_copy(self->input, self->inputSize+1, ptr, self->inputSize);
+                    self->curPos = 0;
+                    VCFScan_yylex_init(&self->pb, false);
+                    
+                    if (VCF_parse(&self->pb) == 0)
+                        rc = PARSE_ERROR;
+                    else
+                    {
+                        VNameListCount ( self->messages, &messageCount );       
+                        if (messageCount > 0)
+                            rc = PARSE_ERROR;
+                    }
+                                        
+                    *messages = (const struct VNamelist*)self->messages;
+                        
+                    VCFScan_yylex_destroy(&self->pb);
+                }
+            }
+        }
+        else if (rc == RC ( rcFS, rcMemMap, rcAccessing, rcMemMap, rcInvalid )) /* 0 size file */
+        {
+            VNamelistAppend(self->messages, "Empty file");
+            *messages = (const struct VNamelist*)self->messages;
+            rc = PARSE_ERROR;
+        }
+           
+        rc2 = KMMapRelease ( mm );
+        if (rc == 0)
+            rc = rc2;
+    }
+    
+    return rc;
+}
+
+rc_t VcfReaderGetDataLineCount( const VcfReader* self, uint32_t* count )
+{
+    if ( self == NULL )
+        return RC ( rcAlign, rcFile, rcAccessing, rcSelf, rcNull );
+        
+    if ( count == NULL )
+        return RC ( rcAlign, rcFile, rcAccessing, rcParam, rcNull );
+        
+    *count = VectorLength( & self->lines );
+    
+    return 0;
+}
+
+rc_t VcfReaderGetDataLine( const VcfReader* self, uint32_t index, const VcfDataLine** line )
+{
+    if ( self == NULL )
+        return RC ( rcAlign, rcFile, rcAccessing, rcSelf, rcNull );
+        
+    if ( line == NULL )
+        return RC ( rcAlign, rcFile, rcAccessing, rcParam, rcNull );
+        
+    *line = VectorGet( & self->lines, index );
+    
+    return 0;
+}
+
diff --git a/tools/vcf-loader/vcf-reader.h b/tools/vcf-loader/vcf-reader.h
new file mode 100644
index 0000000..8c309ad
--- /dev/null
+++ b/tools/vcf-loader/vcf-reader.h
@@ -0,0 +1,110 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+
+#ifndef _h_vcf_reader_
+#define _h_vcf_reader_
+
+#ifndef _h_klib_defs_
+#include <klib/defs.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <klib/text.h>
+
+/*--------------------------------------------------------------------------
+ * forwards
+ */
+struct KFile;
+struct VNamelist;
+
+typedef struct VcfReader VcfReader;
+
+typedef struct VcfDataLine
+{
+    /* Fixed fields, per spec v. 4.2:
+        http://www.1000genomes.org/wiki/analysis/variant-call-format/vcf-variant-call-format-version-42 
+    */
+    String      chromosome; /* An identifier from the reference genome or "<ID>" pointing to a contig in the assembly file */
+    uint32_t    position;   /* The reference position, with the 1st base having position 1 */
+    String      id;         /* semi-colon separated list of unique identifiers where available; "." if missing */
+    String      refBases;   /* reference base(s) */
+    String      altBases;   /* comma separated list of alternate non-reference alleles called on at least one of the samples; "." if missing */
+    uint8_t     quality;    /* phred-scaled quality score for the assertion made in ALT */
+    String      filter;     /* "PASS", or a semicolon-separated list of codes for filters that fail*/
+    String      info;       /* a semicolon-separated series of keys with optional values in the format: <key>[=<data>[,data]] */ 
+
+    /* Genotype fields, each represented as a String pointing into source */
+    struct VNamelist*  genotypeFields;
+    
+    uint16_t  lastPopulated; /* index of the last populated data item (parser's internal use) */
+} VcfDataLine;
+
+/*=============== VcfReaderMake ================*/
+
+/* Make
+ *  Creates a new instance of VcfReader
+ *
+ *  self [OUT] return parameter for the new reader object
+ *
+ */
+rc_t VcfReaderMake( const VcfReader** self );
+
+/* Parse
+ *  Parses a VCF file. Can be used repeatedly on the same object.
+ *
+ *  self [ IN ] the reader object
+ *
+ *  file [ IN ] a readable file object. The entire file will be parsed.
+ *
+ *  message [ OUT ] error messages generated by the parser. Set to NULL if no messages were generated.
+ *  the pointer is valid until the next call to Parse or VcfReaderWhack on the reader object 
+ */
+rc_t VcfReaderParse( VcfReader* self, struct KFile* file, const struct VNamelist** messages );
+
+/* Whack
+ *  releases object obtained from VcfReaderMake
+ */
+rc_t VcfReaderWhack( VcfReader* self );
+
+/*  GetDataLineCount
+ * Returns the number of data lines in the parsed file 
+ */
+rc_t VcfReaderGetDataLineCount( const VcfReader* self, uint32_t* count );
+
+/*  GetDataLine
+ * Returns the data line at the specified 0-based index, 
+ * The returned pointer is valid until the reader is whacked
+ */
+rc_t VcfReaderGetDataLine( const VcfReader* self, uint32_t index, const VcfDataLine** line );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _h_vcf_reader_ */
diff --git a/tools/vdb-config/Makefile b/tools/vdb-config/Makefile
index f5c70b8..d832854 100644
--- a/tools/vdb-config/Makefile
+++ b/tools/vdb-config/Makefile
@@ -25,7 +25,7 @@
 
 default: std
 
-TOP ?= $(shell ../../build/abspath.sh ../..)
+TOP ?= $(abspath ../..)
 MODULE = tools/vdb-config
 
 include $(TOP)/build/Makefile.env
@@ -76,17 +76,21 @@ clean: stdclean
 # vdb-config
 #
 VDB_CONFIG_SRC = \
-	vdb-config
+	configure \
+	util \
+	vdb-config \
+	interactive \
+	vdb-config-model \
 
 VDB_CONFIG_OBJ = \
 	$(addsuffix .$(OBJX),$(VDB_CONFIG_SRC))
 
 VDB_CONFIG_LIB = \
-	-lkapp \
-	-lncbi-vdb \
-	-lxml2 \
-	-lm
+	-stui_cpp    \
+	-stui        \
+	-skapp       \
+	-sncbi-vdb   \
+	-sm
 
 $(BINDIR)/vdb-config: $(VDB_CONFIG_OBJ)
-	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(VDB_CONFIG_LIB)
-
+	$(LP) --exe --vers $(SRCDIR) -o $@ $^ $(VDB_CONFIG_LIB)
diff --git a/tools/vdb-config/configure.cpp b/tools/vdb-config/configure.cpp
new file mode 100644
index 0000000..901f21f
--- /dev/null
+++ b/tools/vdb-config/configure.cpp
@@ -0,0 +1,781 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "configure.h" /* configure */
+#include "interactive.h" /* run_interactive */
+#include "util.hpp" // CNoncopyable
+#include "vdb-config-model.hpp" // vdbconf_model
+
+#include <klib/rc.h> /* RC */
+#include <klib/vector.h> /* Vector */
+
+#include <sstream> // stringstream
+
+#include <climits> /* PATH_MAX */
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
+
+using std::string;
+
+////////////////////////////////////////////////////////////////////////////////
+class CConfigurator : CNoncopyable {
+    CKConfig m_Cfg;
+    CKDirectory m_Dir;
+    rc_t CheckNcbiHome(bool &updated, bool verbose) const {
+        if (verbose) {
+            OUTMSG(("checking NCBI home... "));
+        }
+
+        const CString ncbi(m_Cfg.ReadNcbiHome());
+
+        if (verbose) {
+            OUTMSG(("%S\n", ncbi.Get()));
+        }
+
+        rc_t rc = 0;
+        if (!ncbi.Empty()) {
+            rc = m_Dir.CreateNonExistingPrivateDir(ncbi, verbose);
+            if (rc == 0) {
+                rc = m_Dir.CheckPrivateAccess(ncbi, updated, verbose);
+            }
+            if (rc == 0) {
+                rc = m_Dir.CanWriteFile(ncbi, verbose);
+            }
+        }
+
+        return rc;
+    }
+    rc_t CheckRepositories(bool fix) {
+        {
+            const string name("/repository/user/default-path");
+            CString node(m_Cfg.ReadString(name.c_str()));
+            if (node.Empty()) {
+/* this rc is ignored */ m_Cfg.UpdateNode(name.c_str(), "$(HOME)/ncbi");
+            }
+        }
+        rc_t rc = 0;
+        if (fix) {
+            const string name("/repository/site/disabled");
+            if (m_Cfg.NodeExists(name)) {
+                rc_t r2 = m_Cfg.UpdateNode(name.c_str(), "false");
+                if (r2 != 0 && rc == 0) {
+                    rc = r2;
+                }
+            }
+        }
+        const KRepositoryMgr *mgr = NULL;
+        rc = KConfigMakeRepositoryMgrRead(m_Cfg.Get(), &mgr);
+        KRepositoryVector repositories;
+        memset(&repositories, 0, sizeof repositories);
+        bool created = false;
+        if (rc == 0) {
+            rc = KRepositoryMgrRemoteRepositories(mgr, &repositories);
+            if (rc == 0) {
+                KRepositoryVectorWhack(&repositories);
+            }
+            else if
+                (rc == SILENT_RC(rcKFG, rcNode, rcOpening, rcPath, rcNotFound))
+            {
+                rc = m_Cfg.CreateRemoteRepositories();
+                created = true;
+            }
+        }
+        if (rc == 0 && fix && !created) {
+            rc = m_Cfg.CreateRemoteRepositories(fix);
+        }
+        if (rc == 0) {
+            bool noUser = false;
+            rc = KRepositoryMgrUserRepositories(mgr, &repositories);
+            if (rc == 0) {
+                uint32_t len = 0;
+                if (rc == 0) {
+                    len = VectorLength(&repositories);
+                }
+                if (len == 0) {
+                    noUser = true;
+                }
+                else if (len == 1) {
+                    const KRepository *repo = static_cast<const KRepository*>
+                        (VectorGet(&repositories, 0));
+                    if (repo != NULL) {
+                        char buffer[PATH_MAX] = "";
+                        size_t size = 0;
+                        rc =
+                            KRepositoryName(repo, buffer, sizeof buffer, &size);
+                        if (rc == 0) {
+                            rc = 0;
+                        }
+                    }
+                    rc = 0;
+                }
+                KRepositoryVectorWhack(&repositories);
+            }
+            else if
+                (rc == SILENT_RC(rcKFG, rcNode, rcOpening, rcPath, rcNotFound))
+            {
+                noUser = true;
+            }
+            if (noUser) {
+                rc = m_Cfg.CreateUserRepositories();
+            }
+            else if (fix) {
+                rc = m_Cfg.CreateUserRepositories(fix);
+            }
+        }
+        RELEASE(KRepositoryMgr, mgr);
+        return rc;
+    }
+    rc_t CheckConfig(bool fix) {
+        rc_t rc = CheckRepositories(fix);
+        if (rc == 0) {
+            const string name("/krypto/pwfile");
+            CString node(m_Cfg.ReadString(name.c_str()));
+            if (node.Empty()) {
+                rc = m_Cfg.UpdateNode(name.c_str(), "$(NCBI_HOME)/vdb-passwd");
+            }
+        }
+        if (rc == 0) {
+            const string name("/tools/ascp/max_rate");
+            CString node(m_Cfg.ReadString(name.c_str()));
+            if (node.Empty()) {
+                rc = m_Cfg.UpdateNode(name.c_str(), "300m");
+            }
+        }
+        if (rc == 0) {
+            CString config_default(m_Cfg.ReadDefaultConfig());
+            if (!config_default.Empty() && !config_default.Equals("false")) {
+                m_Cfg.UpdateNode("/config/default", "false");
+            }
+        }
+        if (rc == 0) {
+            m_Cfg.Commit();
+        }
+        return rc;
+    }
+protected:
+    vdbconf_model *m_Config;
+public:
+    CConfigurator(bool fix = false, bool verbose = false): m_Config(NULL) {
+#define TODO 1
+        bool updated = false;
+        rc_t rc = CheckNcbiHome(updated, verbose);
+        if (rc == 0 && updated) {
+            m_Cfg.Reload(verbose);
+        }
+        if (rc == 0) {
+            rc = CheckConfig(fix);
+            if (rc == 0) {
+                m_Cfg.Reload(verbose);
+            }
+        }
+        if (rc == 0) {
+            m_Config = new vdbconf_model(m_Cfg.Get());
+            if (m_Config == NULL) {
+                rc = TODO;
+            }
+        }
+        if (rc != 0) {
+            throw rc;
+        }
+    }
+    virtual ~CConfigurator(void) { delete m_Config; }
+    virtual rc_t Configure(void) {
+        OUTMSG(("Fixed default configuration\n"));
+        return 0;
+    }
+};
+struct SUserRepo {
+    bool cacheEnabled;
+//  bool enabled;
+    string root;
+    SUserRepo(const vdbconf_model *kfg, int32_t id = -1) { Reload (kfg, id); }
+    void Reload(const vdbconf_model *kfg, int32_t id = -1) {
+        assert(kfg);
+        if (id < 0) {
+            cacheEnabled = kfg->is_user_cache_enabled();
+//          enabled = kfg->is_user_enabled();
+            root = kfg->get_public_location();
+        }
+        else {
+            cacheEnabled = kfg->is_protected_repo_cached(id);
+//          enabled = kfg->is_protected_repo_enabled(id);
+            root = kfg->get_repo_location(id);
+        }
+    }
+};
+struct SProtectedRepo : SUserRepo {
+public:
+    const string name;
+    const string description;
+    SProtectedRepo(const vdbconf_model *kfg,
+            uint32_t id, const string &aName)
+        : SUserRepo(kfg, id)
+        , name(aName), description(kfg->get_repo_description(name))
+    {}
+    void Reload(const vdbconf_model *kfg,
+        uint32_t id, const string &aName)
+    {
+        assert(name == aName);
+        SUserRepo::Reload(kfg, id);
+    }
+};
+class CProtectedRepos : public std::map<const string, SProtectedRepo> {
+    typedef std::map<const string, SProtectedRepo>::iterator TI;
+public:
+    typedef std::map<const string, SProtectedRepo>::const_iterator TCI;
+    CProtectedRepos(const vdbconf_model *kfg) { Reload(kfg); }
+    void Reload(const vdbconf_model *kfg) {
+        assert(kfg);
+        uint32_t n = kfg->get_repo_count();
+        for (uint32_t i = 0; i < n; ++i) {
+            const string name(kfg->get_repo_name(i));
+            TI it = find(name);
+            if (it == end()) {
+                insert(std::pair<const string, SProtectedRepo>
+                    (name, SProtectedRepo(kfg, i, name)));
+            }
+            else {
+                (*it).second.Reload(kfg, i, name);
+            }
+        }
+    }
+    TCI Get(uint32_t id) const {
+        TCI it = begin();
+        for (uint32_t i = 0; it != end(); ++it, ++i) {
+            if (i == id) {
+                break;
+            }
+        }
+        return it;
+    }
+};
+struct SData {
+    bool done;
+    bool updated;
+    bool site;
+    struct SCrntData {
+    private:
+        const vdbconf_model *m_Kfg;
+    public:
+        bool site_enabled;
+        bool remote_enabled;
+        SUserRepo userR;
+        CProtectedRepos protectedR;
+        SCrntData(const vdbconf_model *kfg)
+            : m_Kfg(kfg), userR(kfg), protectedR(kfg)
+        {
+            Reload();
+        }
+        void Reload(void) {
+            assert(m_Kfg);
+            site_enabled = m_Kfg->is_site_enabled();
+            remote_enabled = m_Kfg->is_remote_enabled();
+            userR.Reload(m_Kfg);
+            protectedR.Reload(m_Kfg);
+        }
+    } crnt;
+    SData(const vdbconf_model *kfg)
+        : done(false)
+        , updated(false)
+        , site(kfg->does_site_repo_exist())
+        , crnt(kfg)
+    {}
+};
+struct STrinity {
+private:
+    string ToString(int i) { std::stringstream s; s << i; return s.str(); }
+public:
+//  const string enabled;
+    const string cached;
+    const string root;
+    STrinity(const string &src)
+//      : enabled(src.substr(0, 1))
+        : cached (src.substr(0, 1))
+        , root   (src.substr(1, 1))
+    {}
+    STrinity(int i)
+//      : enabled(ToString(i + 0))
+        : cached (ToString(i + 0))
+        , root   (ToString(i + 1))
+    {}
+    void Print(void) const
+    { OUTMSG(("%s %s\n", cached.c_str(), root.c_str())); }
+};
+class CTextualConfigurator : public CConfigurator {
+    CStdIn m_Stdin;
+    string Input(const string &prompt, const string &value) {
+        OUTMSG(("\n\n%s:\n%s\n\nEnter the new path and Press <Enter>\n"
+            "Press <Enter> to accept the path\n> ",
+            prompt.c_str(), value.c_str()));
+        char buffer[PATH_MAX] = "";
+        size_t num_read = 0;
+        rc_t rc = m_Stdin.Read(buffer, sizeof buffer, &num_read);
+        if (rc == 0 && num_read > 0) {
+            return string(buffer, num_read);
+        }
+        else {
+            return "";
+        }
+    }
+    
+    void ProcessCancel(SData &d) {
+        if (!d.updated) {
+            d.done = true;
+            return;
+        }
+        OUTMSG(("\nChanges in your configuration were not saved\n\n"));
+        while (true) {
+            OUTMSG((
+                "To save changes and exit  : Enter Y and Press <Enter>\n"
+                "To ignore changes and exit: Enter N and Press <Enter>\n"
+                "To cancel and continue    : Press <Enter>\n"
+                "\n"
+                "Your choice > "));
+            char answer = toupper(m_Stdin.Read1());
+            switch (answer) {
+                case '\0':
+                    return;
+                case  'Y':
+                    OUTMSG(("Saving...\n"));
+                    m_Config->commit();
+                //  no break;
+                case  'N':
+                    OUTMSG(("Exiting..."));
+                    d.done = true;
+                    return;
+                default:
+                    OUTMSG(("Unrecognized input\n"));
+            }
+        }
+    }
+    enum EChoice {
+        eCancel,
+        eExit,
+        eRemote,
+        eSite,
+        eUnknown,
+        eUserCacheEnable,
+//      eUserEnable,
+        eUserRoot,
+    };
+    struct SChoice {
+        EChoice choice;
+        int32_t id;
+        SChoice(EChoice c, int32_t i = -1) : choice(c), id(i)
+        {}
+    };
+    class CSymGen {
+        static const string magic;
+    public:
+        static STrinity Id2Seq(uint32_t id) {
+            int d = id * 2 - magic.size();
+            if (d < 0) {
+                return STrinity(magic.substr(id * 2, 2));
+            }
+            else {
+                return STrinity(d + 10);
+            }
+        }
+        static SChoice Seq2Choice(string /* copy */ s, uint32_t maxId) {
+            if (s.length() <= 0 || s.length() > 2) {
+                return SChoice(eUnknown);
+            }
+            else if (s.length() == 1) {
+                size_t p = magic.find(s[0]);
+                if (p == string::npos) {
+                    return SChoice(eUnknown);
+                }
+                else {
+                    EChoice c = eUnknown;
+                    switch (p % 2) {
+                        case 0: c = eUserCacheEnable; break;
+                        case 1: c = eUserRoot       ; break;
+                        default: assert(0); break;
+                    }
+                    return SChoice(c, p / 2);
+                }
+            }
+            else {
+                assert(s.length() == 2);
+                if (!isdigit(s[0]) || !!isdigit(s[0]) || s[0] == '0') {
+                    return SChoice(eUnknown);
+                }
+                int id = (s[0] - '0') * 10 + s[1] - '0' + magic.size();
+                EChoice c = eUnknown;
+                switch (id % 2) {
+                    case 0: c = eUserCacheEnable; break;
+                    case 1: c = eUserRoot       ; break;
+                    default: assert(0); break;
+                }
+                return SChoice(c, id / 2);
+            }
+        }
+        static void Ask(void) { OUTMSG(("magic.len = %d\n", magic.size())); }
+    };
+    SChoice Inquire(const SData &d) {
+        OUTMSG(("     vdb-config interactive\n\n  data source\n\n"));
+        OUTMSG(("   NCBI SRA: "));
+        if (d.crnt.remote_enabled) {
+            OUTMSG(("enabled (recommended) (1)\n\n"));
+        }
+        else {
+            OUTMSG(("disabled (not recommended) (1)\n\n"));
+        }
+        if (d.site) {
+        OUTMSG(("   site    : "));
+            if (d.crnt.site_enabled) {
+                OUTMSG(("enabled (recommended) (2)\n\n"));
+            }
+            else {
+                OUTMSG(("disabled (not recommended) (2)\n\n"));
+            }
+        }
+        OUTMSG(("\n  local workspaces\n\n  Open Access Data\n"));
+/*      if (d.crnt.userR.enabled) {
+            OUTMSG(("enabled (recommended) (6)\n"));
+        }
+        else {
+            OUTMSG(("disabled (not recommended) (6)\n"));
+        }*/
+        if (d.crnt.userR.cacheEnabled) {
+            OUTMSG(("cached (recommended) (3)\n"));
+        }
+        else {
+            OUTMSG(("not cached (not recommended) (3)\n"));
+        }
+        OUTMSG(("location: '%s' (4)\n", d.crnt.userR.root.c_str()));
+
+        uint32_t id = 0;
+        for (CProtectedRepos::TCI it = d.crnt.protectedR.begin();
+            it != d.crnt.protectedR.end(); ++it, ++id)
+        {
+            const SProtectedRepo r((*it).second);
+            OUTMSG(("\n   %s:\n", r.name.c_str()));
+            if (r.description.size() > 0) {
+                OUTMSG(("  ( %s )\n", r.description.c_str()));
+            }
+            STrinity t(CSymGen::Id2Seq(id));
+
+/*          OUTMSG(("%s) ", t.enabled.c_str()));
+            if (r.enabled) {
+                OUTMSG(("enabled (recommended)\n"));
+            }
+            else {
+                OUTMSG(("DISABLED (not recommended)\n"));
+            }*/
+
+            OUTMSG(("%s) ", t.cached.c_str()));
+            if (r.cacheEnabled) {
+                OUTMSG(("caching is enabled (recommended)\n"));
+            }
+            else {
+                OUTMSG(("CACHING IS DISABLED (not recommended)\n"));
+            }
+
+            OUTMSG(("%s) root: %s\n", t.root.c_str(), r.root.c_str()));
+        }
+
+//"To print help info      : Enter H and Press <Enter>\n"
+        OUTMSG(("\n\n"
+"To cancel and exit      : Press <Enter>\n"));
+        if (d.updated) {
+            OUTMSG(("To save changes and exit: Enter Y and Press <Enter>\n"));
+        }
+        OUTMSG((
+"To update and continue  : Enter corresponding symbol and Press <Enter>\n"));
+        OUTMSG(("\nYour choice > "));
+        char answer = toupper(m_Stdin.Read1());
+        switch (answer) {
+            case '\0': return SChoice(eCancel);
+            case  '1': return SChoice(eRemote);
+            case  'Y': return SChoice(eExit);
+            case  '2': //            case  'O':
+                return d.site ? SChoice(eSite) : SChoice(eUnknown);
+//          case  '6': return SChoice(eUserEnable);
+            case  '3': return SChoice(eUserCacheEnable);
+            case  '4': return SChoice(eUserRoot);
+            default  : return CSymGen::Seq2Choice(string(1, answer), id);
+        }
+    }
+    bool SetRoot(int32_t id, const string &old) {
+        const string name(id < 0 ? "Public" : "dbGaP");
+        const string prompt("Path to " + name + " Repository");
+        bool flushOld = false, reuseNew = false, ask = true;
+        string root;
+        while (true) {
+            if (ask) {
+                root = Input(prompt, old);
+                if (root.size() == 0) {
+                    OUTMSG(("\nRoot path to '%s' repository was not changed\n",
+                        name.c_str()));
+                    return false;
+                }
+                OUTMSG(("\nChanging root path to '%s' repository to '%s'\n",
+                    name.c_str(), root.c_str()));
+                ask = false;
+            }
+            ESetRootState s = m_Config->change_repo_location
+                (flushOld, root, reuseNew, id);
+            switch (s) {
+                case eSetRootState_OK:
+                    return true;
+                case eSetRootState_NewPathEmpty:
+                case eSetRootState_Error:
+                    assert(0);
+                    return false;
+                case eSetRootState_MkdirFail:
+                    OUTMSG(("Error: cannot make directory '%s'\n",
+                        root.c_str()));
+                    ask = true;
+                    break;
+                case eSetRootState_NotChanged:
+                    OUTMSG(("Keeping '%s' path unchanged\n", root.c_str()));
+                    return false;
+                case eSetRootState_NewNotDir:
+                    OUTMSG(("Error: '%s' exists and is not a directory\n",
+                        root.c_str()));
+                    ask = true;
+                    break;
+                case eSetRootState_NotUnique:
+                    OUTMSG(("Error: there is another repository in '%s'\n",
+                        root.c_str()));
+                    ask = true;
+                    break;
+                case eSetRootState_NewDirNotEmpty: {
+                    OUTMSG(("Warning: directory '%s' is not empty\n"
+                        "Would you like to use it? (y/N)? > ", root.c_str()));
+                    char answer = toupper(m_Stdin.Read1());
+                    if (answer == 'Y') {
+                        reuseNew = true;
+                    }
+                    else {
+                        ask = true;
+                    }
+                    break;
+                }
+                case eSetRootState_OldNotEmpty: {
+                    OUTMSG(("Warning: your repository '%s' is not empty\n"
+                        "Would you like to clear it? (y/N)? > ", old.c_str()));
+                    char answer = toupper(m_Stdin.Read1());
+                    if (answer == 'Y') {
+                        OUTMSG(("Clearing the old repository...\n"));
+                        flushOld = true;
+                    }
+                    else {
+                        ask = true;
+                    }
+                    break;
+                }
+            }
+        }
+    }
+    virtual rc_t Configure(void) {
+        assert(m_Config);
+        SData d(m_Config);
+        while (!d.done) {
+            d.crnt.Reload();
+            SChoice answer = Inquire(d);
+            OUTMSG(("\n"));
+            switch (answer.choice) {
+                case eSite:
+                    if (d.crnt.site_enabled) {
+                        OUTMSG(("WARNING: DISABLING SITE REPOSITORY!!!"));
+                    }
+                    else {
+                        OUTMSG(("Enabling site repository..."));
+                    }
+                    m_Config->set_site_enabled(!d.crnt.site_enabled);
+                    d.updated = true;
+                    break;
+                case eRemote:
+                    if (d.crnt.remote_enabled) {
+                        OUTMSG(("WARNING: DISABLING REMOTE REPOSITORY!!!"));
+                    }
+                    else {
+                        OUTMSG(("Enabling remote repository..."));
+                    }
+                    m_Config->set_remote_enabled(!d.crnt.remote_enabled);
+                    d.updated = true;
+                    break;
+                case eUserCacheEnable:
+                    if (answer.id < 0) {
+                        if (d.crnt.userR.cacheEnabled) {
+                            OUTMSG(("WARNING: "
+                                "DISABLING USER REPOSITORY CACHING!!!"));
+                        }
+                        else {
+                            OUTMSG(("Enabling user repository caching..."));
+                        }
+                        m_Config->set_user_cache_enabled
+                            (!d.crnt.userR.cacheEnabled);
+                        d.updated = true;
+                    }
+                    else {
+                        CProtectedRepos::TCI it
+                            (d.crnt.protectedR.Get(answer.id));
+                        if (it == d.crnt.protectedR.end()) {
+                            OUTMSG(("Unrecognized input. Continuing..."));
+                        }
+                        else {
+                            const SProtectedRepo r((*it).second);
+                            int32_t id = m_Config->get_repo_id(r.name);
+                            if (id < 0) {
+                                OUTMSG(("ERROR: CANNOT FIND '%s' REPOSITORY",
+                                    r.name.c_str()));
+                            }
+                            else {
+                                if (r.cacheEnabled) {
+                                    OUTMSG(("WARNING: DISABLING '%s' REPOSITORY"
+                                        " CACHING!!!", r.name.c_str()));
+                                }
+                                else {
+                                    OUTMSG(("Enabling '%s' repository "
+                                        "caching...", r.name.c_str()));
+                                }
+                                m_Config->set_protected_repo_cached
+                                    (id, !r.cacheEnabled);
+                                d.updated = true;
+                            }
+                        }
+                    }
+                    break;
+/*              case eUserEnable:
+                    if (answer.id < 0) {
+                        if (d.crnt.userR.enabled) {
+                            OUTMSG(("WARNING: DISABLING USER REPOSITORY!!!"));
+                        }
+                        else {
+                            OUTMSG(("Enabling user repository..."));
+                        }
+                        m_Config->set_user_enabled(!d.crnt.userR.enabled);
+                        d.updated = true;
+                    }
+                    else {
+                        CProtectedRepos::TCI it
+                            (d.crnt.protectedR.Get(answer.id));
+                        if (it == d.crnt.protectedR.end()) {
+                            OUTMSG(("Unrecognized input. Continuing..."));
+                        }
+                        else {
+                            const SProtectedRepo r((*it).second);
+                            int32_t id = m_Config->get_repo_id(r.name);
+                            if (id < 0) {
+                                OUTMSG(("ERROR: CANNOT FIND '%s' REPOSITORY",
+                                    r.name.c_str()));
+                            }
+                            else {
+                                if (r.enabled) {
+                                    OUTMSG(("WARNING: DISABLING '%s' "
+                                        "REPOSITORY!!!", r.name.c_str()));
+                                }
+                                else {
+                                    OUTMSG(("Enabling '%s' repository...",
+                                        r.name.c_str()));
+                                }
+                                m_Config->set_protected_repo_enabled
+                                    (id, !r.enabled);
+                                d.updated = true;
+                            }
+                        }
+                    }
+                    break;*/
+                case eUserRoot: {
+                    string root(d.crnt.userR.root);
+                    if (answer.id >= 0) {
+                        CProtectedRepos::TCI it
+                            (d.crnt.protectedR.Get(answer.id));
+                        if (it == d.crnt.protectedR.end()) {
+                            OUTMSG(("Unrecognized input. Continuing..."));
+                            break;
+                        }
+                        else {
+                            root = (*it).second.root;
+                        }
+                    }
+                    d.updated = SetRoot(answer.id, root);
+                    break;
+                }
+                case eExit:
+                    OUTMSG(("Saving..."));
+                    m_Config->commit();
+                    d.done = true;
+                    break;
+                case eCancel:
+                    OUTMSG(("Canceling...\n\n"));
+                    ProcessCancel(d);
+                    break;
+                default:
+                    OUTMSG(("Unrecognized input. Continuing..."));
+                    break;
+            }
+            OUTMSG(("\n\n\n"));
+        }
+        return 0;
+    }
+public:
+    CTextualConfigurator(void) {}
+};
+const string CTextualConfigurator::CSymGen::magic
+ ("56789ABCDEFGHIJKLMNOPQRSTUVWXZ");
+class CVisualConfigurator : public CConfigurator {
+    virtual rc_t Configure(void) {
+        if (m_Config == NULL) {
+            return TODO;
+        }
+        return run_interactive(*m_Config);
+    }
+};
+rc_t configure(EConfigMode mode) {
+    rc_t rc = 0;
+    CConfigurator *c = NULL;
+    try {
+        switch (mode) {
+            case eCfgModeDefault:
+                c = new CConfigurator(true);
+                break;
+            case eCfgModeTextual:
+                c = new CTextualConfigurator;
+                break;
+            default:
+                c = new CVisualConfigurator;
+                break;
+        }
+        rc = c->Configure();
+    }
+    catch (rc_t re) {
+        if (rc == 0) {
+            rc = re;
+        }
+    }
+    catch (...) {
+        if (rc == 0) {
+            rc = TODO;
+        }
+    }
+    delete c;
+    return rc;
+}
diff --git a/tools/vdb-config/configure.h b/tools/vdb-config/configure.h
new file mode 100644
index 0000000..fc9450f
--- /dev/null
+++ b/tools/vdb-config/configure.h
@@ -0,0 +1,49 @@
+#ifndef _h_tools_vdb_config_configure_
+#define _h_tools_vdb_config_configure_
+
+/*==============================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <klib/defs.h> /* rc_t */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+    eCfgModeDefault,  /* default has to be graphical     */
+    eCfgModeTextual,  /* textual is the only alternative */
+    eCfgModeSemiVisual, /* remove this */
+    eCfgModeVisual,     /* redundant */
+} EConfigMode;
+
+rc_t configure(EConfigMode mode);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _h_tools_vdb_config_configure_ */
diff --git a/tools/vdb-config/interactive.cpp b/tools/vdb-config/interactive.cpp
new file mode 100644
index 0000000..7fabc4d
--- /dev/null
+++ b/tools/vdb-config/interactive.cpp
@@ -0,0 +1,1048 @@
+/*==============================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+
+/*
+    a clean new config tool in c++ with interactive interface...
+*/
+
+#include <tui/tui.hpp>
+
+#include <klib/rc.h>
+
+#include <kfg/config.h>
+#include <kfg/properties.h>
+#include <kfg/repository.h>
+#include <kfg/ngc.h>
+#include <kfs/directory.h>
+#include <kfs/file.h>
+
+#include <sstream>
+
+#include "vdb-config-model.hpp"
+
+using namespace tui;
+
+#define BOX_COLOR		KTUI_c_dark_blue
+#define STATUS_COLOR	KTUI_c_gray
+#define LABEL_BG		KTUI_c_light_gray
+#define LABEL_FG		KTUI_c_black
+#define CB_COLOR_FG		KTUI_c_black
+#define BTN_COLOR_FG	KTUI_c_black
+#define CB_COLOR_BG		KTUI_c_cyan
+#define BTN_COLOR_BG	KTUI_c_cyan
+
+#define TOP_H			7
+#define SRC_W		    36
+#define SAVE_W		    14
+#define EXIT_W		    14
+#define WKSP_NAME_W		32
+#define WKSP_B_LOC_W	12
+
+#define CB_TXT_REMOTE	            "Enable Remote Access (1)"
+#define CB_TXT_CACHE   	            "Enable Local File Caching (2)"
+#define CB_TXT_SITE   	            "Use Site Installation (3)"
+#define BTN_TXT_IMPORT_NGC 			"Import Repository Key (4)"
+#define BTN_TXT_DFLT_IMPORT_PATH	"Set Default Import Path (5)"
+#define B_SAVE_TXT                  "Save (6)"
+#define B_EXIT_TXT                  "Exit (7)"
+#define B_RELOAD_TXT                "Reload (8)"
+#define B_FACT_DFLT_TXT             "Standard Settings (9)"
+
+#define MAIN_CAPTION	            "vdb-config"
+#define L_TXT_PUBLIC                "Public"
+#define BTN_TXT_CHANGE	            "Change"
+#define HDR_WKSP_NAME_TXT           "Workspace Name"
+#define HDR_WKSP_LOC_TXT            "Location"
+#define L_TXT_NUMBER_EXPLAIN        "Press the number in (X) as a shortcut"
+
+#define FOCUS_TXT_CB_REMOTE         "Press SPACE | ENTER to enable/disable access to the servers at NCBI"
+#define FOCUS_TXT_CB_CACHED         "Press SPACE | ENTER to enable/disable caching"
+#define FOCUS_TXT_CB_SITE           "Press SPACE | ENTER to enable/disable access to site repositories"
+#define FOCUS_TXT_B_PUBLIC_LOC      "Press SPACE | ENTER to change location of public data"
+#define FOCUS_TXT_B_IMPORT_NGC      "Press SPACE | ENTER to import a dbGaP project"
+#define FOCUS_TXT_B_USR_DFLT_PATH   "Press SPACE | ENTER to change default repository location"
+#define FOCUS_TXT_B_PROT_LOC        "Press SPACE | ENTER to change location for this dbGaP repository"
+#define FOCUS_TXT_B_SAVE            "Press SPACE | ENTER to save changes"
+#define FOCUS_TXT_B_EXIT            "Press SPACE | ENTER to exit vdb-config"
+#define FOCUS_TXT_B_RELOAD          "Press SPACE | ENTER to discard changes"
+#define FOCUS_TXT_B_FACT_DFLT       "Press SPACE | ENTER to set factory defaults"
+
+#define ID_BOX_TOP_LEFT             100
+#define ID_BOX_BOTTOM               101
+#define ID_BOX_TOP_RIGHT            102
+#define ID_BOX_STATUS               103
+
+#define ID_CB_REMOTE                104
+#define ID_CB_CACHED                105
+#define ID_CB_SITE                  106
+
+#define ID_B_IMPORT_NGC             107
+#define ID_B_USR_DFLT_PATH          108
+
+#define ID_L_WKSP_NAME              109
+#define ID_L_WKSP_LOC               110
+
+#define ID_L_PUBLIC                 111
+#define ID_B_PUBLIC_LOC             112
+#define ID_L_PUBLIC_LOC             113
+
+#define ID_B_SAVE                   114
+#define ID_B_EXIT                   115
+#define ID_B_RELOAD                 116
+#define ID_B_FACT_DFLT              117
+
+#define ID_L_NUMBER_EXPLAIN         118
+
+#define ID_L_PROT                   200
+#define ID_L_PROT_LOC               300
+#define ID_B_PROT_LOC               400
+
+
+class vdbconf_view : public Dlg
+{
+    public :
+        vdbconf_view( vdbconf_model &model ) : Dlg(), priv_model( model ), repos_shown( 0 ), show_local_enable( false )
+        {
+            populate();
+        };
+
+        virtual bool Resize( Tui_Rect const &r )
+        {
+			populate( r, true );
+            return Dlg::Resize( r );
+        }
+
+        void populate( void );
+
+    private :
+        vdbconf_model & priv_model;
+        uint32_t repos_shown;
+        bool show_local_enable;
+
+        /* layout functions */
+		uint32_t half( Tui_Rect const &r, uint32_t margins ) const { return ( ( r.get_w() - margins ) / 2 ); }
+		Tui_Rect h1_rect( Tui_Rect const &r, int32_t dx, int32_t dy, int32_t dw ) const
+            { return Tui_Rect( r.get_x() + dx, r.get_y() + dy, r.get_w() + dw, 1 ); }
+		Tui_Rect h1_w_rect( Tui_Rect const &r, int32_t dx, int32_t dy, uint32_t w ) const
+            { return Tui_Rect( r.get_x() + dx, r.get_y() + dy, w, 1 ); }
+		
+		Tui_Rect top_left_rect( Tui_Rect const &r ) const
+            { return Tui_Rect( r.get_x() + 1, r.get_y() + 2, half( r, 3 ), TOP_H ); }
+
+		Tui_Rect top_right_rect( Tui_Rect const &r ) const
+            { return Tui_Rect( r.get_x() + half( r, 3 ) + 2, r.get_y() + 2, r.get_w() - half( r, 3 ) - 3, TOP_H ); }
+																				
+		Tui_Rect bottom_rect( Tui_Rect const &r ) const
+            { return Tui_Rect( r.get_x() + 1, r.get_y() + TOP_H + 3, r.get_w() - 2, r.get_h() - ( TOP_H + 5 ) ); }
+
+        Tui_Rect statust_rect( Tui_Rect const &r ) const { return h1_rect( r, 0, r.get_h() - 1, 0 ); }
+        Tui_Rect remote_cb_rect( Tui_Rect const &r ) const { return h1_w_rect( r, 1, 1, SRC_W ); }
+        Tui_Rect cache_cb_rect( Tui_Rect const &r ) const { return h1_w_rect( r, 1, 3, SRC_W ); }
+        Tui_Rect site_cb_rect( Tui_Rect const &r ) const { return h1_w_rect( r, 1, 5, SRC_W ); }
+
+        Tui_Rect import_ngc_rect( Tui_Rect const &r ) const { return h1_w_rect( r, 1, 1, WKSP_NAME_W ); }
+        Tui_Rect usr_dflt_path_rect( Tui_Rect const &r ) const { return h1_w_rect( r, WKSP_NAME_W + 2, 1, WKSP_NAME_W + 3 ); }
+
+		Tui_Rect hdr_wksp_name_rect( Tui_Rect const &r ) const { return h1_w_rect( r, 1, 3, WKSP_NAME_W ); }
+		Tui_Rect hdr_wksp_loc_rect( Tui_Rect const &r ) const { return h1_rect( r, WKSP_NAME_W + 2, 3, -( WKSP_NAME_W + 3 ) ); }
+
+		Tui_Rect wksp_name_rect( Tui_Rect const &r, uint32_t n ) const { return h1_w_rect( r, 1, 5 + ( 2 * n ), WKSP_NAME_W ); }
+		Tui_Rect wksp_b_loc_rect( Tui_Rect const &r, uint32_t n ) const
+            { return h1_w_rect( r, WKSP_NAME_W + 2, 5 + ( 2 * n ), WKSP_B_LOC_W ); }
+		Tui_Rect wksp_loc_rect( Tui_Rect const &r, uint32_t n ) const
+            { return h1_rect( r, WKSP_NAME_W + WKSP_B_LOC_W + 3, 5 + ( 2 * n ), -( WKSP_NAME_W + WKSP_B_LOC_W + 4 ) ); }
+		
+        Tui_Rect save_rect( Tui_Rect const &r ) const { return h1_w_rect( r, 1, 1, SAVE_W ); }
+        Tui_Rect exit_rect( Tui_Rect const &r ) const { return h1_w_rect( r, SAVE_W + 2, 1, EXIT_W ); }
+        Tui_Rect reload_rect( Tui_Rect const &r ) const { return h1_w_rect( r, 1, 3, SAVE_W + EXIT_W + 1 ); }
+        Tui_Rect factdflt_rect( Tui_Rect const &r ) const { return h1_w_rect( r, 1, 5, SAVE_W + EXIT_W + 1 ); }
+        Tui_Rect num_explain_rect( Tui_Rect const &r ) const { return h1_rect( r, 1, r.get_h() - 2, -2 ); }
+
+		void setup_box( Tui_Rect const &r, bool resize, uint32_t id );
+		void setup_label( Tui_Rect const &r, bool resize, uint32_t id, const char * txt );
+		void setup_checkbox( Tui_Rect const &r, bool resize, uint32_t id, const char * txt, bool enabled );
+		void setup_button( Tui_Rect const &r, bool resize, uint32_t id, const char * txt );
+		
+		void populate_top_left( Tui_Rect const &r, bool resize );
+        void populate_protected( Tui_Rect const &r, bool resize );
+		void populate_bottom( Tui_Rect const &r, bool resize );
+		void populate_top_right( Tui_Rect const &r, bool resize );
+        void populate( Tui_Rect const &r, bool resize );
+};
+
+
+void vdbconf_view::setup_box( Tui_Rect const &r, bool resize, uint32_t id )
+{
+	if ( resize )
+		SetWidgetRect( id, r, false );
+	else if ( !HasWidget( id ) )
+	{
+		AddLabel( id, r, "" );
+		SetWidgetBackground( id, BOX_COLOR );
+	}
+}
+
+void vdbconf_view::setup_label( Tui_Rect const &r, bool resize, uint32_t id, const char * txt )
+{
+	if ( resize )
+		SetWidgetRect( id, r, false );
+	else if ( HasWidget( id ) )
+    {
+        SetWidgetCaption( id, ( txt == NULL ) ? "" : txt );
+    }
+    else
+	{
+		AddLabel( id, r, ( txt == NULL ) ? "" : txt );
+		SetWidgetBackground( id, LABEL_BG );
+		SetWidgetForeground( id, LABEL_FG );
+	}
+}
+
+
+void vdbconf_view::setup_checkbox( Tui_Rect const &r, bool resize, uint32_t id, const char * txt, bool value )
+{
+	if ( resize )
+		SetWidgetRect( id, r, false );
+	else if ( HasWidget( id ) )
+    {
+        SetWidgetCaption( id, ( txt == NULL ) ? "" : txt );
+        SetWidgetBoolValue( id, value );
+    }
+    else
+	{
+        AddCheckBox( id, r, ( txt == NULL ) ? "" : txt, value );
+		SetWidgetBackground( id, CB_COLOR_BG );
+		SetWidgetForeground( id, CB_COLOR_FG );
+	}
+}
+
+
+void vdbconf_view::setup_button( Tui_Rect const &r, bool resize, uint32_t id, const char * txt )
+{
+	if ( resize )
+		SetWidgetRect( id, r, false );
+	else if ( HasWidget( id ) )
+    {
+        SetWidgetCaption( id, ( txt == NULL ) ? "" : txt );
+    }
+    else
+	{
+		AddButton( id, r, ( txt == NULL ) ? "" : txt );
+		SetWidgetBackground( id, BTN_COLOR_BG );
+		SetWidgetForeground( id, BTN_COLOR_FG );
+	}
+}
+
+
+void vdbconf_view::populate_top_left( Tui_Rect const &r, bool resize )
+{
+	setup_box( r, resize, ID_BOX_TOP_LEFT );
+
+    /* the 3 checkboxes for remote, cached, site */
+	setup_checkbox( remote_cb_rect( r ), resize, ID_CB_REMOTE, CB_TXT_REMOTE, priv_model.is_remote_enabled() );
+	setup_checkbox( cache_cb_rect( r ), resize, ID_CB_CACHED, CB_TXT_CACHE, priv_model.is_global_cache_enabled() );
+	if ( priv_model.does_site_repo_exist() )
+		setup_checkbox( site_cb_rect( r ), resize, ID_CB_SITE, CB_TXT_SITE, priv_model.is_site_enabled() );
+}
+
+
+void vdbconf_view::populate_protected( Tui_Rect const &r, bool resize )
+{
+    uint32_t visible = ( ( r.get_h() - 9 ) / 2 );
+    uint32_t i, n = priv_model.get_repo_count();
+    for ( i = 0; i < n; ++i )
+    {
+        setup_label( wksp_name_rect( r, i + 1 ), resize, ID_L_PROT + i, priv_model.get_repo_name( i ).c_str() );
+        setup_button( wksp_b_loc_rect( r, i + 1 ), resize, ID_B_PROT_LOC + i, BTN_TXT_CHANGE );
+        setup_label( wksp_loc_rect( r, i + 1 ), resize, ID_L_PROT_LOC + i, priv_model.get_repo_location( i ).c_str() );
+
+        SetWidgetVisible( ID_L_PROT + i, ( i < visible ) );
+        SetWidgetVisible( ID_B_PROT_LOC + i, ( i < visible ) );
+        SetWidgetVisible( ID_L_PROT_LOC + i, ( i < visible ) );
+    }
+}
+
+void vdbconf_view::populate_bottom( Tui_Rect const &r, bool resize )
+{
+	setup_box( r, resize, ID_BOX_BOTTOM );
+	
+    /* the import-ngc and the set-dflt-path buttons */
+	setup_button( import_ngc_rect( r ), resize, ID_B_IMPORT_NGC, BTN_TXT_IMPORT_NGC );
+	setup_button( usr_dflt_path_rect( r ), resize, ID_B_USR_DFLT_PATH, BTN_TXT_DFLT_IMPORT_PATH );
+
+    /* the header of the workspace list */	
+	setup_label( hdr_wksp_name_rect( r ), resize, ID_L_WKSP_NAME, HDR_WKSP_NAME_TXT );
+	setup_label( hdr_wksp_loc_rect( r ), resize, ID_L_WKSP_LOC, HDR_WKSP_LOC_TXT );
+
+    /* the public workspace: */
+    setup_label( wksp_name_rect( r, 0 ), resize, ID_L_PUBLIC, L_TXT_PUBLIC );
+	setup_button( wksp_b_loc_rect( r, 0 ), resize, ID_B_PUBLIC_LOC, BTN_TXT_CHANGE );
+    setup_label( wksp_loc_rect( r, 0 ), resize, ID_L_PUBLIC_LOC, priv_model.get_public_location().c_str() );
+
+    /* the protected workspaces: */
+    populate_protected( r, resize );
+
+    setup_label( num_explain_rect( r ), resize, ID_L_NUMBER_EXPLAIN, L_TXT_NUMBER_EXPLAIN );
+}
+
+
+void vdbconf_view::populate_top_right( Tui_Rect const &r, bool resize )
+{
+	setup_box( r, resize, ID_BOX_TOP_RIGHT );
+
+	setup_button( save_rect( r ), resize, ID_B_SAVE, B_SAVE_TXT );
+	setup_button( exit_rect( r ), resize, ID_B_EXIT, B_EXIT_TXT );
+	setup_button( reload_rect( r ), resize, ID_B_RELOAD, B_RELOAD_TXT );
+	setup_button( factdflt_rect( r ), resize, ID_B_FACT_DFLT, B_FACT_DFLT_TXT );
+}
+
+
+void vdbconf_view::populate( Tui_Rect const &r, bool resize )
+{
+    if ( !resize ) SetCaption( MAIN_CAPTION );
+    
+    populate_top_left( top_left_rect( r ), resize );
+    populate_bottom( bottom_rect( r ), resize );
+    populate_top_right( top_right_rect( r ), resize );
+    
+    setup_label( statust_rect( r ), resize, ID_BOX_STATUS, NULL );
+}
+
+
+void vdbconf_view::populate( void )
+{
+    Tui_Rect r;
+    GetRect( r );
+    populate( r, false );
+}
+
+/* ------------------------------------------------------------------------------------------------------------------------------------- */
+
+
+static void vdbconf_msg( Dlg &dlg, Tui_Rect r, const char * msg )
+{
+    Std_Dlg_Info_Line d;
+    d.set_parent( &dlg );
+    dlg.center( r );
+    d.set_location( r );
+    d.set_text( msg );
+    d.execute();
+}
+
+
+static bool vdbconf_question( Dlg &dlg, Tui_Rect r, const char * msg )
+{
+    Std_Dlg_Question q;
+    q.set_parent( &dlg );
+    dlg.center( r );
+    q.set_location( r );
+    q.set_text( msg );
+    return ( q.execute() );
+}
+
+
+static bool vdbconf_input( Dlg &dlg, Tui_Rect r, const char * caption, std::string & txt )
+{
+    bool res;
+    Std_Dlg_Input q;
+    q.set_parent( &dlg );
+    dlg.center( r );
+    q.set_location( r );
+    q.set_caption( caption );
+    q.set_text2( txt );
+    res = q.execute();
+    if ( res )
+        txt = q.get_text2();
+    return res;
+}
+
+
+static std::string vdbconf_pick_file( Dlg &dlg, Tui_Rect r, const char * path, const char *ext )
+{
+    std::string res = "";
+    Std_Dlg_File_Pick pick;
+    pick.set_parent( &dlg );
+    dlg.center( r );
+    pick.set_location( r );
+    pick.set_ext( ext );
+    pick.set_dir_h( ( r.get_h() - 7 ) / 2 );
+    pick.set_text( path );
+    if ( pick.execute() )
+        res.assign( pick.get_text() );
+    return res;
+}
+
+
+bool vdbconf_pick_dir( Dlg &dlg, Tui_Rect r, std::string &path )
+{
+    bool res = false;
+    Std_Dlg_Dir_Pick pick;
+
+    pick.set_parent( &dlg );
+    dlg.center( r );
+    pick.set_location( r );
+    pick.set_text( path.c_str() );
+    pick.allow_dir_create();
+
+    res = pick.execute();
+    if ( res )
+        path.assign( pick.get_text() );
+
+    return res;
+}
+
+
+static bool make_ngc_obj( const KNgcObj ** ngc, std::string &path )
+{
+    KDirectory * dir;
+    rc_t rc = KDirectoryNativeDir( &dir );
+    if ( rc == 0 )
+    {
+        const KFile * src;
+        rc = KDirectoryOpenFileRead ( dir, &src, "%s", path.c_str() );
+        if ( rc == 0 )
+        {
+            rc = KNgcObjMakeFromFile ( ngc, src );
+            KFileRelease( src );
+        }
+        KDirectoryRelease( dir );
+    }
+    return ( rc == 0 );
+}
+
+
+std::string public_location_start_dir( vdbconf_model &model )
+{
+    std::string res = model.get_public_location();
+
+    if ( !model.does_path_exist( res ) )
+        res = model.get_user_default_dir();
+
+    if ( !model.does_path_exist( res ) )
+        res = model.get_home_dir() + "/ncbi";
+
+    if ( !model.does_path_exist( res ) )
+        res = model.get_home_dir();
+
+    if ( !model.does_path_exist( res ) )
+        res = model.get_current_dir();
+
+    return res;
+}
+
+
+std::string protected_location_start_dir( vdbconf_model &model, uint32_t id )
+{
+    std::string res = model.get_repo_location( id );
+
+    if ( !model.does_path_exist( res ) )
+        res = model.get_user_default_dir();
+
+    if ( !model.does_path_exist( res ) )
+        res = model.get_home_dir() + "/ncbi";
+
+    if ( !model.does_path_exist( res ) )
+        res = model.get_home_dir();
+
+    if ( !model.does_path_exist( res ) )
+        res = model.get_current_dir();
+
+    return res;
+}
+
+/* ------------------------------------------------------------------------------------------------------------------------------------- */
+
+
+class vdbconf_controller : public Dlg_Runner
+{
+    private :
+        vdbconf_model &priv_model;
+
+    public :
+        vdbconf_controller( Dlg &dlg, vdbconf_model &model ) : Dlg_Runner( dlg, &model ), priv_model( model ) 
+        { dlg.SetFocus( ID_CB_REMOTE ); };
+
+        virtual bool on_kb_alpha( Dlg &dlg, void * data, int code ); /* close the dialog with the 'q' character too */
+        virtual bool on_select( Dlg &dlg, void * data, Tui_Dlg_Event &dev ); /* react to buttons pressed */
+        virtual bool on_focus( Dlg &dlg, void * data, Tui_Dlg_Event &dev ) /* react to getting the focus */
+        { return on_focused( dlg, dev.get_widget_id() ); };
+
+        void update_view( Dlg &dlg );
+        bool on_exit( Dlg &dlg );
+        bool on_save( Dlg &dlg );
+        bool on_reload( Dlg &dlg );
+        bool on_fact_dflt( Dlg &dlg );
+
+        std::string get_import_ngc_start_dir( vdbconf_model &model );
+        bool import_this_ngc_into_this_location( Dlg &dlg, vdbconf_model &m, std::string &location, const KNgcObj * ngc );
+        bool import_this_ngc( Dlg &dlg, vdbconf_model &m, const KNgcObj * ngc );
+        bool on_import_ngc( Dlg &dlg );
+
+        std::string change_dflt_import_path_start_dir( vdbconf_model &model );
+        bool on_change_dflt_import_path( Dlg &dlg );
+
+        bool toggle_checkbox( Dlg &dlg, uint32_t id );
+        bool toggle_remote( Dlg &dlg );
+        bool toggle_site( Dlg &dlg );
+        bool toggle_cached( Dlg &dlg );
+
+        bool on_set_location_error( Dlg &dlg, ESetRootState s );
+        bool on_pick_public_location( Dlg &dlg );
+
+        std::string change_protected_location_start_dir( vdbconf_model &model, uint32_t id );
+        bool on_pick_protected_location( Dlg &dlg, uint32_t id );
+        bool on_protected_repo( Dlg &dlg, Tui_Dlg_Event &dev );
+
+        void status_txt( Dlg &dlg, const char * s ) { dlg.SetWidgetCaption( ID_BOX_STATUS, s ); }
+        void on_focused_protected_repo( Dlg &dlg, uint32_t widget_id );
+        bool on_focused( Dlg &dlg, uint32_t widget_id );
+};
+
+
+void vdbconf_controller::update_view( Dlg &dlg )
+{
+    vdbconf_view &view = dynamic_cast<vdbconf_view &>( dlg );
+    view.populate();
+}
+
+
+bool vdbconf_controller::on_exit( Dlg &dlg )
+{
+    if ( priv_model.get_config_changed() )
+    {
+        if ( vdbconf_question( dlg, Tui_Rect( 5, 5, 120, 6 ), "save changes ?" ) )
+        {
+            if ( priv_model.commit() )
+                vdbconf_msg( dlg, Tui_Rect( 5, 5, 120, 6 ), "changes successfully saved" );
+            else
+                vdbconf_msg( dlg, Tui_Rect( 5, 5, 120, 6 ), "error saving changes" );
+        }
+    }
+    dlg.SetDone( true );
+    return true;
+}
+
+
+bool vdbconf_controller::on_save( Dlg &dlg )
+{
+    if ( priv_model.get_config_changed() )
+    {
+        if ( priv_model.commit() )
+            vdbconf_msg( dlg, Tui_Rect( 5, 5, 120, 6 ), "changes successfully saved" );
+        else
+            vdbconf_msg( dlg, Tui_Rect( 5, 5, 120, 6 ), "error saving changes" );
+    }
+    else
+        vdbconf_msg( dlg, Tui_Rect( 5, 5, 120, 6 ), "no changes to be saved" );
+    return true;
+}
+
+
+bool vdbconf_controller::on_reload( Dlg &dlg )
+{
+    priv_model.reload();
+    update_view( dlg );
+    return true;
+}
+
+
+bool vdbconf_controller::on_fact_dflt( Dlg &dlg )
+{
+    priv_model.set_remote_enabled( true );
+    priv_model.set_global_cache_enabled( true );
+    priv_model.set_site_enabled( true );
+    update_view( dlg );
+    return true;
+}
+
+
+bool vdbconf_controller::toggle_checkbox( Dlg &dlg, uint32_t id )
+{
+    bool value = !dlg.GetWidgetBoolValue( id );
+    dlg.SetWidgetBoolValue( id, value );
+    return value;
+}
+
+
+bool vdbconf_controller::toggle_remote( Dlg &dlg )
+{
+    priv_model.set_remote_enabled( toggle_checkbox( dlg, ID_CB_REMOTE ) );
+    return true;
+}
+
+bool vdbconf_controller::toggle_cached( Dlg &dlg )
+{
+    priv_model.set_global_cache_enabled( toggle_checkbox( dlg, ID_CB_CACHED ) );
+    return true;
+}
+
+bool vdbconf_controller::toggle_site( Dlg &dlg )
+{
+	if ( priv_model.does_site_repo_exist() )
+        priv_model.set_site_enabled( toggle_checkbox( dlg, ID_CB_SITE ) );
+    return true;
+}
+
+
+bool vdbconf_controller::on_kb_alpha( Dlg &dlg, void * data, int code )
+{
+    bool res = false;
+    switch( code )
+    {
+        case '1' : res = toggle_remote( dlg ); break;
+        case '2' : res = toggle_cached( dlg ); break;
+        case '3' : res = toggle_site( dlg ); break;
+
+        case '4' : res = on_import_ngc( dlg ); break;
+        case '5' : res = on_change_dflt_import_path( dlg ); break;
+
+        case '6' : res = on_save( dlg ); break;
+
+        case '7' :
+        case 'Q' :
+        case 'q' : res = on_exit( dlg ); break;
+
+        case '8' : res = on_reload( dlg ); break;
+        case '9' : res = on_fact_dflt( dlg ); break;
+
+        default  : res = false;
+
+    }
+    return res;
+};
+
+
+bool vdbconf_controller::import_this_ngc_into_this_location( Dlg &dlg,
+    vdbconf_model &m, std::string &location, const KNgcObj * ngc )
+{
+    uint32_t result_flags = 0;
+    bool res = m.import_ngc( location, ngc, INP_CREATE_REPOSITORY, &result_flags );
+    if ( res )
+    {
+        /* we have it imported or it exists and no changes made */
+        bool modified = false;
+        if ( result_flags & INP_CREATE_REPOSITORY )
+        {
+            /* success is the most common outcome, the repository was created */
+            vdbconf_msg( dlg, Tui_Rect( 5, 5, 120, 6 ), "project successfully imported" );
+            update_view( dlg );
+            modified = true;
+        }
+        else
+        {
+            /* repository did exist and is completely identical to the given ngc-obj */
+            vdbconf_msg( dlg, Tui_Rect( 5, 5, 120, 6 ), "this project exists already, no changes made" );
+        }
+
+        std::ostringstream question; 
+        question << "do you want to change the location?";
+        if ( vdbconf_question( dlg, Tui_Rect( 5, 5, 120, 6 ), question.str().c_str() ) )
+        {
+            uint32_t id;
+            if ( m.get_id_of_ngc_obj( ngc, &id ) )
+                modified |= on_pick_protected_location( dlg, id );
+            else
+                vdbconf_msg( dlg, Tui_Rect( 5, 5, 120, 6 ), "cannot find the imported repostiory" );
+        }
+
+        if ( modified )
+        {
+            m.commit();
+            update_view( dlg );
+        }
+    }
+    else if ( result_flags == 0 )
+    {
+        /* we are here if there was an error executing one of the internal functions */
+        vdbconf_msg( dlg, Tui_Rect( 5, 5, 120, 6 ), "there was an internal error importing the ngc-object" );
+    }
+    else
+    {
+        bool permitted = true;
+
+        vdbconf_msg( dlg, Tui_Rect( 5, 5, 120, 6 ), "the repository does already exist!" );
+        if ( result_flags & INP_UPDATE_ENC_KEY )
+        {
+            std::ostringstream question; 
+            question << "encryption-key would change, continue ?";
+            permitted = ( vdbconf_question( dlg, Tui_Rect( 5, 5, 120, 6 ), question.str().c_str() ) );
+        }
+
+        if ( permitted && ( result_flags & INP_UPDATE_DNLD_TICKET ) )
+        {
+            std::ostringstream question; 
+            question << "download-ticket would change, continue ?";
+            permitted = ( vdbconf_question( dlg, Tui_Rect( 5, 5, 120, 6 ), question.str().c_str() ) );
+        }
+
+        if ( permitted && ( result_flags & INP_UPDATE_DESC ) )
+        {
+            std::ostringstream question; 
+            question << "description would change, continue ?";
+            permitted = ( vdbconf_question( dlg, Tui_Rect( 5, 5, 120, 6 ), question.str().c_str() ) );
+        }
+
+        if ( permitted )
+        {
+            uint32_t result_flags2 = 0;
+            res = m.import_ngc( location, ngc, result_flags, &result_flags2 );
+            if ( res )
+            {
+                vdbconf_msg( dlg, Tui_Rect( 5, 5, 120, 6 ), "project successfully updated" );
+                
+                std::ostringstream question; 
+                question << "do you want to change the location?";
+                if ( vdbconf_question( dlg, Tui_Rect( 5, 5, 120, 6 ), question.str().c_str() ) )
+                {
+                    uint32_t id; /* we have to find out the id of the imported/existing repository */
+                    if ( m.get_id_of_ngc_obj( ngc, &id ) )            
+                        on_pick_protected_location( dlg, id );
+                    else
+                        vdbconf_msg( dlg, Tui_Rect( 5, 5, 120, 6 ), "cannot find the imported repostiory" );
+                }
+                m.commit();
+                update_view( dlg );
+            }
+            else
+                vdbconf_msg( dlg, Tui_Rect( 5, 5, 120, 6 ), "there was an internal error importing the ngc-object" );
+        }
+        else
+            vdbconf_msg( dlg, Tui_Rect( 5, 5, 120, 6 ), "the import was canceled" );
+    }
+    return res;
+}
+
+
+bool vdbconf_controller::import_this_ngc( Dlg &dlg, vdbconf_model &m, const KNgcObj * ngc )
+{
+    bool res = false;
+
+    std::string location_base = m.get_user_default_dir();
+    std::string location = m.get_ngc_root( location_base, ngc );
+    ESetRootState es = m.prepare_repo_directory( location );
+    switch ( es )
+    {
+        case eSetRootState_OK               :  res = import_this_ngc_into_this_location( dlg, m, location, ngc );
+                                                break;
+
+        case eSetRootState_OldNotEmpty      :  if ( vdbconf_question( dlg, Tui_Rect( 5, 5, 120, 6 ),
+                                                                       "repository location is not empty, use it?" ) )
+                                                {
+                                                    es = m.prepare_repo_directory( location, true );
+                                                    if ( es == eSetRootState_OK )
+                                                        res = import_this_ngc_into_this_location( dlg, m, location, ngc );
+                                                    else
+                                                        res = on_set_location_error( dlg, es );
+                                                }
+                                                break;
+
+        default : res = on_set_location_error( dlg, es ); break;
+    }
+    return res;
+}
+
+
+std::string vdbconf_controller::get_import_ngc_start_dir( vdbconf_model &model )
+{
+    std::string res = model.get_home_dir();
+    if ( !model.does_path_exist( res ) )
+        res = model.get_current_dir();
+    return res;
+}
+
+
+bool vdbconf_controller::on_import_ngc( Dlg &dlg )
+{
+    bool res = false;
+    std::string start_dir = get_import_ngc_start_dir( priv_model );
+    /* ( 1 ) pick a ngc-file */
+    std::string picked = vdbconf_pick_file( dlg, dlg.center( 5, 5 ), start_dir.c_str(), "ngc" );
+    if ( picked.length() > 0 )
+    {
+        std::ostringstream question;
+        question << "do you want to import '" << picked << "' ?";
+        /* ( 2 ) confirm the choice */
+        if ( vdbconf_question( dlg, Tui_Rect( 5, 5, 120, 6 ), question.str().c_str() ) )
+        {
+            const KNgcObj * ngc;
+            if ( make_ngc_obj( &ngc, picked ) )
+            {
+                res = import_this_ngc( dlg, priv_model, ngc );
+                KNgcObjRelease( ngc );
+            }
+        }
+    }
+    return res;
+}
+
+
+std::string vdbconf_controller::change_dflt_import_path_start_dir( vdbconf_model &model )
+{
+    std::string res = model.get_user_default_dir();
+    if ( !model.does_path_exist( res ) )
+        res = model.get_home_dir();
+    if ( !model.does_path_exist( res ) )
+        res = model.get_current_dir();
+    return res;
+}
+
+
+bool vdbconf_controller::on_change_dflt_import_path( Dlg &dlg )
+{
+    bool res = false;
+
+    std::string path = change_dflt_import_path_start_dir( priv_model );
+
+    if ( priv_model.does_path_exist( path ) )
+        res = vdbconf_pick_dir( dlg, dlg.center( 5, 5 ), path );
+    else
+        res = vdbconf_input( dlg, Tui_Rect( 5, 5, 100, 6 ), "change default import path", path );
+
+    if ( res )
+    {
+        priv_model.set_user_default_dir( path.c_str() );
+        vdbconf_msg( dlg, Tui_Rect( 5, 5, 100, 6 ), "default import path changed" );
+    }
+    return res;
+}
+
+
+bool vdbconf_controller::on_set_location_error( Dlg &dlg, ESetRootState s )
+{
+    bool result = false;
+    Tui_Rect r( 5, 5, 100, 6 );
+    switch ( s )
+    {
+        case eSetRootState_NotChanged       : result = true; break;
+        case eSetRootState_NotUnique        : vdbconf_msg( dlg, r, "location not unique, select a different one" ); break;
+        case eSetRootState_MkdirFail        : vdbconf_msg( dlg, r, "could not created directory, maybe permisson problem" ); break;
+        case eSetRootState_NewPathEmpty     : vdbconf_msg( dlg, r, "you gave me an empty path" ); break;
+        case eSetRootState_NewDirNotEmpty   : vdbconf_msg( dlg, r, "the given location is not empty" ); break;
+        case eSetRootState_NewNotDir        : vdbconf_msg( dlg, r, "new location is not a directory" ); break;
+        case eSetRootState_Error            : vdbconf_msg( dlg, r, "error changing location" ); break;
+        default                             : vdbconf_msg( dlg, r, "unknow enum" ); break;
+    }
+    return result;
+}
+
+
+bool vdbconf_controller::on_pick_public_location( Dlg &dlg )
+{
+    bool res = false;
+	std::string path = public_location_start_dir( priv_model );
+	
+	if ( priv_model.does_path_exist( path ) )
+		res = vdbconf_pick_dir( dlg, dlg.center( 5, 5 ), path );
+	else
+		res = vdbconf_input( dlg, Tui_Rect( 5, 5, 100, 6 ), "location of public cache", path );
+	
+    if ( res && path.length() > 0 )
+    {
+        std::ostringstream question;
+        question << "do you want to change the location to '" << path << "' ?";
+        if ( vdbconf_question( dlg, Tui_Rect( 5, 5, 120, 6 ), question.str().c_str() ) )
+        {
+            bool flushOld = false;
+            bool reuseNew = false;
+            ESetRootState s = priv_model.set_public_location( flushOld, path, reuseNew );
+            switch ( s )
+            {
+                case eSetRootState_OK               :  dlg.SetWidgetCaption( ID_L_PUBLIC_LOC, path );
+                                                        res = true;
+                                                        break;
+
+                case eSetRootState_OldNotEmpty      : if ( vdbconf_question( dlg, Tui_Rect( 5, 5, 120, 6 ),
+                                                                        "prev. location is not empty, flush it?" ) )
+                                                        {
+                                                            flushOld = true;
+                                                            s = priv_model.set_public_location( flushOld, path, reuseNew );
+                                                            res = ( s == eSetRootState_OK );
+                                                            if ( res )
+                                                                dlg.SetWidgetCaption( ID_L_PUBLIC_LOC, path );
+                                                            else
+                                                                res = on_set_location_error( dlg, s );
+                                                        }
+                                                        break;
+
+                default : res = on_set_location_error( dlg, s ); break;
+            }
+        }
+    }
+    return res;
+}
+
+
+bool vdbconf_controller::on_pick_protected_location( Dlg &dlg, uint32_t id )
+{
+    bool res = false;
+	std::string path = protected_location_start_dir( priv_model, id );
+
+	if ( priv_model.does_path_exist( path ) )
+		res = vdbconf_pick_dir( dlg, dlg.center( 5, 5 ), path );
+	else
+		res = vdbconf_input( dlg, Tui_Rect( 5, 5, 100, 6 ), "location of dbGaP project", path );
+
+    if ( res && path.length() > 0 )
+    {
+        std::ostringstream question;
+        question << "do you want to change the loction of '" << priv_model.get_repo_name( id ) <<"' to '" << path << "' ?";
+        if ( vdbconf_question( dlg, Tui_Rect( 5, 5, 120, 6 ), question.str().c_str() ) )
+        {
+            bool flushOld = false;
+            bool reuseNew = false;
+            ESetRootState s = priv_model.set_repo_location( id, flushOld, path, reuseNew );
+            switch ( s )
+            {
+                case eSetRootState_OK               :  dlg.SetWidgetCaption( ID_L_PROT_LOC + id, path );
+                                                        res = true;
+                                                        break;
+
+                case eSetRootState_OldNotEmpty      :  if ( vdbconf_question( dlg, Tui_Rect( 5, 5, 120, 6 ),
+                                                                        "prev. location is not empty, flush it?" ) )
+                                                        {
+                                                            flushOld = true;
+                                                            s = priv_model.set_repo_location( id, flushOld, path, reuseNew );
+                                                            res = ( s == eSetRootState_OK );
+                                                            if ( res )
+                                                                dlg.SetWidgetCaption( ID_L_PROT_LOC + id, path );
+                                                            else
+                                                                res = on_set_location_error( dlg, s );
+                                                        }
+                                                        break;
+
+                default : res = on_set_location_error( dlg, s ); break;
+            }
+        }
+    }
+    return res;
+}
+
+
+bool vdbconf_controller::on_protected_repo( Dlg &dlg, Tui_Dlg_Event &dev )
+{
+    bool res = false;
+    uint32_t id = dev.get_widget_id();
+    if ( id >= ID_B_PROT_LOC && id < ( ID_B_PROT_LOC + 100 ) )
+    {
+        vdbconf_model &m( priv_model );
+        uint32_t repo_id = ( id - ID_B_PROT_LOC );
+        if ( repo_id < m.get_repo_count() )
+            res = on_pick_protected_location( dlg, repo_id );
+    }
+    return res;
+}
+
+
+bool vdbconf_controller::on_select( Dlg &dlg, void * data, Tui_Dlg_Event &dev )
+{
+    bool res = false;
+    vdbconf_model &m( vdbconf_controller::priv_model );
+    switch( dev.get_widget_id() )
+    {
+        case ID_B_SAVE          : res = on_save( dlg ); break;    
+        case ID_B_EXIT          : res = on_exit( dlg ); break;    
+        case ID_B_RELOAD        : res = on_reload( dlg ); break;    
+        case ID_B_FACT_DFLT     : res = on_fact_dflt( dlg ); break;    
+
+        case ID_CB_REMOTE : m.set_remote_enabled( dev.get_value_1() == 1 ); res = true; break;
+        case ID_CB_CACHED : m.set_global_cache_enabled( dev.get_value_1() == 1 ); res = true; break;
+
+        case ID_CB_SITE   : if ( priv_model.does_site_repo_exist() )
+                                m.set_site_enabled( dev.get_value_1() == 1 );
+                             res = true;
+                             break;
+
+        case ID_B_PUBLIC_LOC : res = on_pick_public_location( dlg ); break;
+
+        case ID_B_IMPORT_NGC : res = on_import_ngc( dlg ); break;
+        case ID_B_USR_DFLT_PATH : res = on_change_dflt_import_path( dlg ); break;
+
+        default : res = on_protected_repo( dlg, dev ); break;
+    }
+    return res;
+};
+
+
+void vdbconf_controller::on_focused_protected_repo( Dlg &dlg, uint32_t widget_id )
+{
+    if ( widget_id >= ID_B_PROT_LOC && widget_id < ( ID_B_PROT_LOC + 100 ) )
+        status_txt( dlg, FOCUS_TXT_B_PROT_LOC );
+    else
+        status_txt( dlg, "???" );
+}
+
+
+bool vdbconf_controller::on_focused( Dlg &dlg, uint32_t widget_id )
+{
+    if ( widget_id > 1000 ) return false;
+
+    switch( widget_id )
+    {
+        case ID_B_SAVE          : status_txt( dlg, FOCUS_TXT_B_SAVE ); break;    
+        case ID_B_EXIT          : status_txt( dlg, FOCUS_TXT_B_EXIT ); break;    
+        case ID_B_RELOAD        : status_txt( dlg, FOCUS_TXT_B_RELOAD ); break;    
+        case ID_B_FACT_DFLT     : status_txt( dlg, FOCUS_TXT_B_FACT_DFLT ); break;    
+
+        case ID_CB_REMOTE       : status_txt( dlg, FOCUS_TXT_CB_REMOTE ); break;
+        case ID_CB_CACHED       : status_txt( dlg, FOCUS_TXT_CB_CACHED ); break;
+        case ID_CB_SITE         : status_txt( dlg, FOCUS_TXT_CB_SITE ); break;
+        case ID_B_PUBLIC_LOC    : status_txt( dlg, FOCUS_TXT_B_PUBLIC_LOC ); break;
+        case ID_B_IMPORT_NGC    : status_txt( dlg, FOCUS_TXT_B_IMPORT_NGC ); break;
+        case ID_B_USR_DFLT_PATH : status_txt( dlg, FOCUS_TXT_B_USR_DFLT_PATH ); break;
+
+        default : on_focused_protected_repo( dlg, widget_id ); break;
+    }
+    return false;
+}
+
+/* ------------------------------------------------------------------------------------------------------------------------------------- */
+
+extern "C"
+{
+    rc_t run_interactive ( vdbconf_model & model )
+    {
+        try
+        {
+            /* (2) ... create derived view, the view creates the widgets in its constructor... */
+            vdbconf_view view( model );
+        
+            /* (3) ... create derived controller, hand it the view and the model*/
+            vdbconf_controller controller( view, model );
+
+            /* (4) ... let the controller handle the events */
+            controller.run();
+
+            /* (5) call this before leaving main() to terminate the low-level driver... */
+            Tui::clean_up();
+        }
+        catch ( ... )
+        {
+            return RC( rcExe, rcNoTarg, rcExecuting, rcNoObj, rcUnknown );
+        }
+        return 0;
+    }
+}
diff --git a/tools/vdb-config/interactive.h b/tools/vdb-config/interactive.h
new file mode 100644
index 0000000..da16088
--- /dev/null
+++ b/tools/vdb-config/interactive.h
@@ -0,0 +1,50 @@
+/*==============================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_interacive_
+#define _h_interacive_
+
+#include "vdb-config-model.hpp" // vdbconf_model
+
+#ifndef _h_kfc_defs_
+#include <kfc/defs.h>
+#endif
+
+#ifndef _h_vdb_config_model_
+#include "vdb-config-model.hpp"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+    rc_t run_interactive ( vdbconf_model & model );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _h_interacive_ */
diff --git a/tools/vdb-config/util.cpp b/tools/vdb-config/util.cpp
new file mode 100644
index 0000000..894909b
--- /dev/null
+++ b/tools/vdb-config/util.cpp
@@ -0,0 +1,1096 @@
+#include "util.hpp" // CStdIn
+#include <klib/printf.h> /* string_printf */
+
+#include <climits> /* PATH_MAX */
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
+
+using std::string;
+
+rc_t CStdIn::Read(char *buffer, size_t bsize, size_t *num_read) {
+    size_t dummy = 0;
+    if (num_read == NULL) {
+if (DEBUG) OUTMSG(("<<< Read: num_read == NULL\n"));
+        num_read = &dummy;
+    }
+
+    if (bsize == 0) {
+        *num_read = 0;
+        return 0;
+    }
+
+    rc_t rc = KFileRead(m_Self, m_Pos, buffer, bsize, num_read);
+    if (rc == 0) {
+        m_Pos += *num_read;
+        size_t last = *num_read;
+        if (*num_read >= bsize) {
+            last = bsize - 1;
+        }
+
+        while (true) {
+            buffer[last] = '\0';
+            if (last == 0) {
+                break;
+            }
+            --last;
+            if (buffer[last] != '\n' && buffer[last] != '\r') {
+                break;
+            }
+            --*num_read;
+        }
+    }
+
+if (DEBUG) OUTMSG(("<<< Read: num_read = %d\n", *num_read));
+
+return rc;
+}
+
+rc_t CKDirectory::CanWriteFile(const CString &dir, bool verbose) const {
+    bool ok = true;
+    rc_t rc = 0;
+    char path[PATH_MAX] = "";
+    if (verbose) {
+        OUTMSG(("checking whether %S is writable... ", dir.Get()));
+    }
+    for (int i = 0; i < 10000 && rc == 0; ++i) {
+        size_t path_len = 0;
+        rc = string_printf(path, sizeof path, &path_len,
+            "%S/.tmp%d.tmp", dir.Get(), i);
+        if (rc != 0) {
+            break;
+        }
+        assert(path_len <= sizeof path);
+        if (Exists(path)) {
+            KDirectoryRemove(m_Self, false, path);
+        }
+        else {
+            KFile *f = NULL;
+            rc = KDirectoryCreateFile(m_Self,
+                &f, false, m_PrivateAccess, kcmCreate, path);
+            if (rc == 0) {
+                rc = KFileWrite(f, 0, path, path_len, NULL);
+            }
+            RELEASE(KFile, f);
+            const KFile *cf = NULL;
+            if (rc == 0) {
+                rc = KDirectoryOpenFileRead(m_Self, &cf, path);
+            }
+            char buffer[PATH_MAX] = "";
+            size_t num_read = 0;
+            if (rc == 0) {
+                rc = KFileRead(cf, 0, buffer, sizeof buffer, &num_read);
+            }
+            if (rc == 0) {
+                if (path_len != num_read || string_cmp(path,
+                    path_len, buffer, num_read, sizeof buffer) != 0)
+                {
+                    if (verbose) {
+                        OUTMSG(("no\n"));
+                    }
+                    OUTMSG(("Warning: "
+                        "NCBI Home directory is not writable"));
+                    ok = false;
+                }
+            }
+            RELEASE(KFile, cf);
+            if (rc == 0) {
+                KDirectoryRemove(m_Self, false, path);
+            }
+            break;
+        }
+    }
+    if (verbose && ok) {
+        if (rc == 0) {
+            OUTMSG(("yes\n"));
+        }
+        else {
+            OUTMSG(("failed\n"));
+        }
+    }
+    return rc;
+}
+
+rc_t CKDirectory::CheckAccess(const CString &path,
+    bool &updated, bool isPrivate, bool verbose) const
+{
+    updated = false;
+    const String *str = path.Get();
+    if (str == NULL) {
+        return 0;
+    }
+    uint32_t access = 0;
+    if (verbose) {
+        OUTMSG(("checking %S file mode... ", path.Get()));
+    }
+    rc_t rc = KDirectoryAccess(m_Self, &access, str->addr);
+    if (rc != 0) {
+        OUTMSG(("failed\n"));
+    }
+    else {
+        if (verbose) {
+            OUTMSG(("%o\n", access));
+        }
+        if (isPrivate) {
+            if (access != m_PrivateAccess) {
+                uint32_t access = 0777;
+                if (verbose) {
+                    OUTMSG(("updating %S to %o... ", str, access));
+                }
+                rc = KDirectorySetAccess(m_Self, false,
+                    m_PrivateAccess, access, str->addr);
+                if (rc == 0) {
+                    OUTMSG(("ok\n"));
+                    updated = true;
+                }
+                else {
+                    OUTMSG(("failed\n"));
+                }
+            }
+        }
+        else {
+            if ((access & m_PrivateAccess) != m_PrivateAccess) {
+                uint32_t access = 0700;
+                if (verbose) {
+                    OUTMSG(("updating %S to %o... ", str, access));
+                }
+                rc = KDirectorySetAccess(m_Self, false,
+                    m_PrivateAccess, access, str->addr);
+                if (rc == 0) {
+                    OUTMSG(("ok\n"));
+                    updated = true;
+                }
+                else {
+                    OUTMSG(("failed\n"));
+                }
+            }
+        }
+    }
+    return rc;
+}
+
+rc_t CKDirectory::CreateNonExistingDir(bool verbose,
+    uint32_t access, const char *path, va_list args) const
+{
+    char str[PATH_MAX] = "";
+    rc_t rc = string_vprintf(str, sizeof str, NULL, path, args);
+    if (rc != 0) {
+        OUTMSG(("error: cannot generate path string\n"));
+        return rc;
+    }
+
+    return CreateNonExistingDir(str, access, verbose, true);
+}
+
+rc_t CKDirectory::CreateNonExistingDir(const string &path,
+    uint32_t access, bool verbose, bool checkExistance) const
+{
+    const char *str = path.c_str();
+
+    if (checkExistance) {
+        if (verbose) {
+            OUTMSG(("checking whether %s exists... ", str));
+        }
+        if (Exists(str)) {
+            if (verbose) {
+                OUTMSG(("found\n"));
+            }
+            return 0;
+        }
+    }
+
+    if (verbose) {
+        OUTMSG(("creating... "));
+    }
+
+    rc_t rc = KDirectoryCreateDir(m_Self, access,
+        (kcmCreate | kcmParents), str);
+    if (verbose) {
+        if (rc == 0) {
+            OUTMSG(("ok\n"));
+        }
+        else {
+            OUTMSG(("failed\n"));
+        }
+    }
+
+    return rc;
+}
+
+rc_t CKDirectory::CreateNonExistingDir(const CString &path,
+    uint32_t access, bool verbose) const
+{
+    const String *str = path.Get();
+    if (str == NULL) {
+        return 0;
+    }
+
+    if (verbose) {
+        OUTMSG(("checking whether %S exists... ", str));
+    }
+
+    if (Exists(str->addr)) {
+        if (verbose) {
+            OUTMSG(("found\n"));
+        }
+        return 0;
+    }
+
+    if (verbose) {
+        OUTMSG(("creating... "));
+    }
+
+    rc_t rc = KDirectoryCreateDir(m_Self, access,
+        (kcmCreate | kcmParents), str->addr);
+    if (verbose) {
+        if (rc == 0) {
+            OUTMSG(("ok\n"));
+        }
+        else {
+            OUTMSG(("failed\n"));
+        }
+    }
+
+    return rc;
+}
+
+rc_t CKConfig::Commit(void) const {
+    if (!m_Updated) {
+        return 0;
+    }
+
+    return KConfigCommit(m_Self);
+}
+
+rc_t CKConfig::CreateRemoteRepositories(bool fix) {
+    rc_t rc = UpdateNode("/repository/remote/main/CGI/resolver-cgi",
+        "http://www.ncbi.nlm.nih.gov/Traces/names/names.cgi");
+
+    if (fix) {
+        const string name("/repository/remote/main/CGI/disabled");
+        if (NodeExists(name)) {
+            rc_t r2 = UpdateNode(name.c_str(), "false");
+            if (r2 != 0 && rc == 0) {
+                rc = r2;
+            }
+        }
+    }
+
+    rc_t r2 = UpdateNode("/repository/remote/aux/NCBI/root",
+        "http://ftp-trace.ncbi.nlm.nih.gov/sra");
+    if (r2 != 0 && rc == 0) {
+        rc = r2;
+    }
+
+    r2 = UpdateNode(
+        "/repository/remote/aux/NCBI/apps/nakmer/volumes/fuseNAKMER",
+        "sadb");
+    if (r2 != 0 && rc == 0) {
+        rc = r2;
+    }
+
+    r2 = UpdateNode(
+        "/repository/remote/aux/NCBI/apps/nakmer/volumes/fuseNANNOT",
+        "sadb");
+    if (r2 != 0 && rc == 0) {
+        rc = r2;
+    }
+
+    r2 = UpdateNode("/repository/remote/aux/NCBI/apps/sra/volumes/refseq",
+        "refseq");
+    if (r2 != 0 && rc == 0) {
+        rc = r2;
+    }
+
+    r2 = UpdateNode("/repository/remote/aux/NCBI/apps/sra/volumes/fuse1000",
+        "sra-instant/reads/ByRun/sra");
+    if (r2 != 0 && rc == 0) {
+        rc = r2;
+    }
+
+    r2 = UpdateNode("/repository/remote/aux/NCBI/apps/sra/volumes/fuseWGS",
+        "wgs");
+    if (r2 != 0 && rc == 0) {
+        rc = r2;
+    }
+
+    if (fix) {
+        const string name("/repository/remote/aux/NCBI/disabled");
+        if (NodeExists(name)) {
+            rc_t r2 = UpdateNode(name.c_str(), "false");
+            if (r2 != 0 && rc == 0) {
+                rc = r2;
+            }
+        }
+    }
+
+    r2 = UpdateNode("/repository/remote/protected/CGI/resolver-cgi",
+        "http://www.ncbi.nlm.nih.gov/Traces/names/names.cgi");
+    if (r2 != 0 && rc == 0) {
+        rc = r2;
+    }
+
+    if (fix) {
+        const string name("/repository/remote/disabled");
+        if (NodeExists(name)) {
+            rc_t r2 = UpdateNode(name.c_str(), "false");
+            if (r2 != 0 && rc == 0) {
+                rc = r2;
+            }
+        }
+    }
+
+    return rc;
+}
+
+rc_t CKConfig::CreateUserRepositories(bool fix) {
+    CString cRoot(ReadString("/repository/user/default-path"));
+    string root;
+    if (cRoot.Empty()) {
+        root = "$(HOME)/ncbi";
+    }
+    else {
+        root = cRoot.GetString();
+    }
+
+    string name("/repository/user/main/public/root");
+    bool toFix = true;
+    if (fix) {
+        toFix = !NodeExists(name);
+    }
+    rc_t rc = 0;
+    if (toFix) {
+        rc = UpdateNode(name.c_str(), (root + "/public").c_str());
+    }
+
+    rc_t r2 = UpdateNode("/repository/user/main/public/apps/file/volumes/flat",
+        "files");
+    if (r2 != 0 && rc == 0) {
+        rc = r2;
+    }
+
+    r2 = UpdateNode(
+        "/repository/user/main/public/apps/nakmer/volumes/nakmerFlat",
+        "nannot");
+    if (r2 != 0 && rc == 0) {
+        rc = r2;
+    }
+
+    r2 = UpdateNode(
+        "/repository/user/main/public/apps/nakmer/volumes/nannotFlat",
+        "nannot");
+    if (r2 != 0 && rc == 0) {
+        rc = r2;
+    }
+
+    r2 = UpdateNode("/repository/user/main/public/apps/refseq/volumes/refseq",
+        "refseq");
+    if (r2 != 0 && rc == 0) {
+        rc = r2;
+    }
+
+    r2 = UpdateNode("/repository/user/main/public/apps/sra/volumes/sraFlat",
+        "sra");
+    if (r2 != 0 && rc == 0) {
+        rc = r2;
+    }
+
+    r2 = UpdateNode("/repository/user/main/public/apps/wgs/volumes/wgsFlat",
+        "wgs");
+    if (r2 != 0 && rc == 0) {
+        rc = r2;
+    }
+
+    r2 = UpdateNode("/repository/user/main/public/cache-enabled", "true");
+    if (r2 != 0 && rc == 0) {
+        rc = r2;
+    }
+
+    return rc;
+}
+
+rc_t CKConfig::DisableRemoteRepository(bool disable) {
+    const char *value = disable ? "true" : "false";
+    rc_t rc = UpdateNode(m_RepositoryRemoteMainDisabled, value);
+
+    rc_t r2 = UpdateNode(m_RepositoryRemoteAuxDisabled, value);
+    if (r2 != 0 && rc == 0) {
+        rc = r2;
+    }
+
+    return rc;
+}
+
+bool CKConfig::IsRemoteRepositoryDisabled(void) const {
+    const CString disabled(ReadString(m_RepositoryRemoteMainDisabled));
+
+    if (disabled.Equals("true")) {
+        const CString disabled(ReadString(m_RepositoryRemoteAuxDisabled));
+        return disabled.Equals("true");
+    }
+
+    return false;
+}
+
+bool CKConfig::NodeExists(const string &path) const {
+    const KConfigNode *n = OpenNodeRead(path.c_str());
+    if (n == NULL) {
+        return false;
+    }
+    KConfigNodeRelease(n);
+    return true;
+}
+
+const KConfigNode* CKConfig::OpenNodeRead(const char *path, ...) const {
+    va_list args;
+    va_start(args, path);
+
+    const KConfigNode *node = NULL;
+    rc_t rc = KConfigVOpenNodeRead(m_Self, &node, path, args);
+
+    va_end(args);
+
+    if (rc != 0) {
+        return NULL;
+    }
+
+    return node;
+}
+
+const String* CKConfig::ReadString(const char *path) const {
+    String *result = NULL;
+    rc_t rc = KConfigReadString(m_Self, path, &result);
+
+    if (rc != 0) {
+        return NULL;
+    }
+    return result;
+}
+
+void CKConfig::Reload(bool verbose) {
+    if (verbose) {
+        OUTMSG(("reloading configuration... "));
+    }
+
+    rc_t rc = KConfigRelease(m_Self);
+    m_Self = NULL;
+
+    if (rc == 0) {
+        rc = KConfigMake(&m_Self, NULL);
+    }
+
+    if (rc == 0) {
+        if (verbose) {
+            OUTMSG(("ok\n"));
+        }
+    }
+    else {
+        if (verbose) {
+            OUTMSG(("failed\n"));
+        }
+        throw rc;
+    }
+}
+
+rc_t CKConfig::UpdateNode(const char *path,
+    const char *buffer, bool verbose, size_t size)
+{
+    if (DEBUG) {
+        OUTMSG(("CKConfig::UpdateNode(%s, %s, %d)\n", path, buffer, size));
+    }
+
+    if (verbose) {
+        OUTMSG(("%s = ... ", path));
+    }
+
+    if (size == (size_t)~0) {
+        size = string_size(buffer);
+    }
+
+    KConfigNode *node = NULL;
+    rc_t rc = KConfigOpenNodeUpdate(m_Self, &node, path);
+// TODO do not write empty node if node itself is empty
+    if (rc == 0) {
+        rc = KConfigNodeWrite(node, buffer, size);
+    }
+    if (rc == 0) {
+        m_Updated = true;
+    }
+    RELEASE(KConfigNode, node);
+
+    if (rc == 0) {
+        if (verbose) {
+            OUTMSG(("\"%s\"\n", buffer));
+        }
+    }
+    else {
+        if (verbose) {
+            OUTMSG(("failed: %R\n", buffer, rc));
+        }
+        else {
+            OUTMSG(("%s = ... failed: %R\n", path, rc));
+        }
+    }
+
+    return rc;
+}
+
+rc_t CKConfig::UpdateUserRepositoryRootPath(const CString &path) {
+    const String *str = path.Get();
+
+    if (str == NULL) {
+        return 0;
+    }
+    return UpdateUserRepositoryRootPath(str->addr, str->size);
+}
+
+rc_t StringRelease(const String *self) {
+    free((void*)self);
+    return 0;
+}
+
+rc_t CSplitter::Test(void) {
+    String s;
+    {   StringInit(&s, NULL, 0, 0);
+        CSplitter p(&s);
+        assert(!p.HasNext());
+    }
+    {   CONST_STRING(&s, "");
+        CSplitter p(&s);
+        assert(!p.HasNext());
+    }
+    {
+        CONST_STRING(&s, "a");
+        CSplitter p(&s);
+        assert(p.HasNext());
+        assert(p.Next() == "a");
+        assert(!p.HasNext());
+    }
+    {
+        CONST_STRING(&s, "a:");
+        CSplitter p(&s);
+        assert(p.HasNext());
+        assert(p.Next() == "a");
+        assert(!p.HasNext());
+    }
+    {
+        CONST_STRING(&s, "a::");
+        CSplitter p(&s);
+        assert(p.HasNext());
+        assert(p.Next() == "a");
+        assert(!p.HasNext());
+    }
+    {
+        CONST_STRING(&s, "::a::");
+        CSplitter p(&s);
+        assert(p.HasNext());
+        assert(p.Next() == "a");
+        assert(!p.HasNext());
+    }
+    {
+        CONST_STRING(&s, "aa:bbb");
+        CSplitter p(&s);
+        assert(p.HasNext());
+        assert(p.Next() == "aa");
+        assert(p.HasNext());
+        assert(p.Next() == "bbb");
+        assert(!p.HasNext());
+    }   return 0;
+}
+
+CUserConfigData::CUserConfigData(const CUserRepositories &repos,
+        const CString &dflt)
+    : m_DefaultRoot(dflt.GetString())
+    , m_CurrentRoot(repos.GetMainPublicRoot())
+    , m_CacheEnabled(repos.IsMainPublicCacheEnabled())
+{}
+
+rc_t CKDirectory::CreateNonExistingPublicDir(bool verbose,
+    const char *path, ...) const
+{
+    va_list args;
+    va_start(args, path);
+
+    rc_t rc = CreateNonExistingDir(verbose, m_PublicAccess, path, args);
+
+    va_end(args);
+
+    return rc;
+}
+
+bool CKDirectory::IsDirectory(const char *path, ...) const {
+    va_list args;
+    va_start(args, path);
+
+    KPathType type = KDirectoryVPathType(m_Self, path, args);
+
+    va_end(args);
+
+    return type == kptDir;
+}
+
+bool CKDirectory::Exists(const CString &path) const {
+    const String *str = path.Get();
+
+    if (str == NULL) {
+        return false;
+    }
+    return Exists(str->addr);
+}
+
+rc_t CKDirectory::CheckPublicAccess(const CString &path, bool verbose) const {
+    bool updated = false;
+    return CheckAccess(path, updated, false, verbose);
+}
+
+rc_t CKConfig::UpdateNode(bool verbose,
+    const char *value, const char *name, ...)
+{
+    va_list args;
+    va_start(args, name);
+
+    char dst[4096] = "";
+    size_t num_writ = 0;
+    rc_t rc = string_vprintf(dst, sizeof dst, &num_writ, name, args);
+    if (rc == 0) {
+        rc = UpdateNode(dst, value, verbose);
+    }
+
+    va_end(args);
+
+    return rc;
+}
+
+CApp::CApp(const CKDirectory &dir, const CKConfigNode &rep,
+        const string &root, const string &name)
+    : m_HasVolume(false)
+    , m_AppVolPath("apps/" + name + "/volumes")
+{
+    const KConfigNode *vols = rep.OpenNodeRead(m_AppVolPath);
+    KNamelist *typeNames = NULL;
+    rc_t rc = KConfigNodeListChildren(vols, &typeNames);
+    if (rc != 0) {
+        return;
+    }
+    uint32_t count = 0;
+    rc = KNamelistCount(typeNames, &count);
+    if (rc == 0) {
+        for (uint32_t idx = 0; idx < count; ++idx) {
+            const char *typeName = NULL;
+            rc = KNamelistGet(typeNames, idx, &typeName);
+            if (rc != 0) {
+                continue;
+            }
+            const KConfigNode *alg = NULL;
+            rc = KConfigNodeOpenNodeRead(vols, &alg, typeName);
+            if (rc != 0) {
+                continue;
+            }
+            String *volList = NULL;
+            rc = KConfigNodeReadString(alg, &volList);
+            if (rc == 0) {
+                if (volList != NULL && volList->addr != NULL) {
+                    m_Volumes[typeName]
+                        = CAppVolume(typeName, volList->addr);
+                }
+                CSplitter volArray(volList);
+                while (volArray.HasNext()) {
+                    const string vol(volArray.Next());
+                    if (dir.IsDirectory("%s/%s", root.c_str(), vol.c_str()))
+                    {
+                        m_HasVolume = true;
+                        break;
+                    }
+                }
+            }
+            RELEASE(String, volList);
+            RELEASE(KConfigNode, alg);
+        }
+    }
+    RELEASE(KNamelist, typeNames);
+    RELEASE(KConfigNode, vols);
+}
+
+rc_t CRepository::Update(CKConfig &kfg, string &node, bool verbose) {
+    char root[4096] = "";
+    rc_t rc = string_printf(root, sizeof root, NULL, "/repository/%s/%s/%s",
+        m_Category.c_str(), m_SubCategory.c_str(), m_Name.c_str());
+    if (rc != 0) {
+        OUTMSG(("ERROR\n"));
+        return rc;
+    }
+
+    if (DEBUG) {
+        OUTMSG(("CRepository::Update: root = %s\n", root));
+    }
+
+    node.assign(root);
+
+    for (CApps::TCI it = m_Apps.begin(); it != m_Apps.end(); ++it) {
+        rc_t r2 = (*it).second->Update(kfg, root, verbose);
+        if (r2 != 0 && rc == 0) {
+            rc = r2;
+        }
+    }
+
+    rc_t r2 = kfg.UpdateNode(verbose, m_Root.c_str(), "%s/root", root);
+    if (r2 != 0 && rc == 0) {
+        rc = r2;
+    }
+
+    return rc;
+}
+
+CRepository::CRepository(const string &category, const string &type,
+        const string &name, const string &root)
+    : m_Disabled(false)
+    , m_Category(category)
+    , m_SubCategory(type)
+    , m_Name(name)
+    , m_Root(root)
+{}
+
+CRepository::CRepository(const CKDirectory &dir, const CKConfigNode &repo,
+        const string &category, const string &subCategory,
+        const string &name)
+    : m_Disabled(false)
+    , m_Category(category)
+    , m_SubCategory(subCategory)
+    , m_Name(name)
+    , m_Root(repo.ReadString("root"))
+{
+    m_Apps.Update(dir, repo, m_Root, "sra");
+    m_Apps.Update(dir, repo, m_Root, "refseq");
+    string disabled(repo.ReadString("disabled"));
+    if (disabled == "true") {
+        m_Disabled = true;
+    }
+}
+
+string CRepository::Dump(void) const {
+    char node[4096] = "";
+    rc_t rc = string_printf(node, sizeof node, NULL,
+        "/repository/%s/%s/%s", m_Category.c_str(),
+        m_SubCategory.c_str(), m_Name.c_str(), m_Root.c_str());
+    if (rc != 0) {
+        OUTMSG(("ERROR\n"));
+        return "";
+    }
+
+    for (CApps::TCI it = m_Apps.begin(); it != m_Apps.end(); ++it) {
+        (*it).second->Dump(node);
+    }
+
+    if (m_Root.size() > 0) {
+        OUTMSG(("%s/root = \"%s\"\n", node, m_Root.c_str()));
+    }
+
+    return node;
+}
+
+bool CRepository::Is(const string &subCategory, const string &name)
+    const
+{
+    if (name.size() <= 0) {
+        return m_SubCategory == subCategory;
+    }
+
+    return m_SubCategory == subCategory && m_Name == name;
+}
+
+string CRemoteRepository::GetRoot(const string &stack, char needle)
+{
+    if (EndsWith(stack, needle)) {
+        return "";
+    }
+    else {
+        return stack;
+    }
+}
+
+string CRemoteRepository::GetCgi(const string &stack, char needle)
+{
+    if (EndsWith(stack, needle)) {
+        return stack;
+    }
+    else {
+        return "";
+    }
+}
+
+bool CRemoteRepository::EndsWith(const string &stack, char needle) {
+    if (stack.size() <= 0) {
+        return false;
+    }
+    return stack[stack.size() - 1] == needle;
+}
+
+rc_t CRemoteRepository::Fix(CKConfig &kfg, bool disable, bool verbose) {
+    if (verbose) {
+        OUTMSG(("checking %s %s remote repository\n",
+            GetCategory().c_str(), GetSubCategory().c_str()));
+    }
+
+    Disable(disable);
+
+    if (Is("main")) {
+        m_ResolverCgi
+            = "http://www.ncbi.nlm.nih.gov/Traces/names/names.cgi";
+        ClearApps();
+    }
+    else {
+        m_ResolverCgi = "";
+        FixApps();
+        SetRoot("http://ftp-trace.ncbi.nlm.nih.gov/sra");
+    }
+
+    return Update(kfg);
+}
+
+rc_t CUserRepository::Fix(CKConfig &kfg,
+    const CUserConfigData *data, const string *root)
+{
+    Disable(false);
+
+    if (DEBUG) {
+        OUTMSG((__FILE__ " CUserRepository::Fix: data = %d\n", data));
+    }
+
+    if (data != NULL) {
+        m_CacheEnabled = data->GetCacheEnabled();
+        const string root(data->GetCurrentRoot());
+        if (root.size() > 0) {
+            if (DEBUG) {
+                OUTMSG((__FILE__ " CUserRepository::Fix: SetRoot to %s\n",
+                    root.c_str()));
+            }
+            SetRoot(root);
+        }
+    }
+    else {
+        m_CacheEnabled = true;
+        assert(root);
+        SetRoot(*root);
+    }
+
+    FixApps();
+
+    return Update(kfg, DEBUG);
+}
+
+rc_t CUserRepositories::Load(const CKConfig &kfg, const CKDirectory &dir) {
+    const string category("main");
+
+    OUTMSG(("loading %s user repository... ", category.c_str()));
+    const KConfigNode *userNode = kfg.OpenNodeRead
+        ("/repository/user/%s", category.c_str());
+    if (userNode == NULL) {
+        OUTMSG(("not found\n"));
+        return 0;
+    }
+    const CKConfigNode user(userNode);
+    KNamelist *userNames = NULL;
+    rc_t rc  = KConfigNodeListChildren(userNode, &userNames);
+    if (rc != 0) {
+        OUTMSG(("failed\n"));
+    }
+    uint32_t count = 0;
+    if (rc == 0) {
+        rc = KNamelistCount(userNames, &count);
+    }
+    if (rc != 0) {
+        OUTMSG(("failed\n"));
+    }
+    for (uint32_t idx = 0; idx < count && rc == 0; ++idx) {
+        const char *userName = NULL;
+        rc = KNamelistGet(userNames, idx, &userName);
+        if (rc != 0) {
+            rc = 0;
+            continue;
+        }
+        OUTMSG(("%s ", userName));
+        const KConfigNode *userRepo = user.OpenNodeRead(userName);
+        if (userRepo == NULL) {
+            continue;
+        }
+        CKConfigNode node(userRepo);
+        push_back(new CUserRepository(dir, node, category, userName));
+    }
+    RELEASE(KNamelist, userNames);
+
+    if (rc == 0) {
+        OUTMSG(("ok\n"));
+    }
+    else {
+        OUTMSG(("failed\n"));
+    }
+
+    return rc;
+}
+
+const CUserRepository *CUserRepositories::FindMainPublic(void) const {
+    for (TCI it = begin(); it != end(); ++it) {
+        CUserRepository *r = *it;
+        assert(r);
+        if (DEBUG) {
+            OUTMSG(("MainPublic not found\n"));
+        }
+        if (r->Is("main", "public")) {
+            return r;
+        }
+    }
+
+    return NULL;
+}
+
+rc_t CUserRepositories::MkAppVolumes(const CKDirectory &dir, bool verbose)
+    const
+{
+    rc_t rc = 0;
+
+    for (TCI it = begin(); it != end(); ++it) {
+        CUserRepository *r = *it;
+        assert(r);
+        const string root(r->GetRoot());
+        if (root.size() <= 0) {
+            continue;
+        }
+
+        for (CApps::TCI it = r->AppsBegin(); it != r->AppsEnd(); ++it) {
+            const CApp *a = (*it).second;
+            assert(a);
+            //a->Dump("a->Dump");
+            for (CApp::TCAppVolumesCI it = a->VolumesBegin();
+                it != a->VolumesEnd(); ++it)
+            {
+                const CAppVolume &v((*it).second);
+                const string path(v.GetPath());
+                if (path.size() <= 0) {
+                    continue;
+                }
+                CSplitter s(path);
+                while (s.HasNext()) {
+                    rc_t r2 = dir.CreateNonExistingPublicDir
+                        (verbose, "%s/%s", root.c_str(), s.Next().c_str());
+                    if (r2 != 0 && rc == 0) {
+                        rc = r2;
+                    }
+                }
+            }
+        }
+    }
+
+    return rc;
+}
+
+rc_t CRemoteRepositories::Load(const CKConfig &kfg, const CKDirectory &dir) {
+    rc_t rc = 0;
+    for (int i = 0; i < 2; ++i) {
+        string category;
+        switch (i) {
+            case 0:
+                category = "main";
+                break;
+            case 1:
+                category = "aux";
+                break;
+            default:
+                assert(0);
+                break;
+        }
+        OUTMSG(("loading %s remote repository... ", category.c_str()));
+        const KConfigNode *remoteNode = kfg.OpenNodeRead
+            ("/repository/remote/%s", category.c_str());
+        if (remoteNode == NULL) {
+            OUTMSG(("not found\n"));
+            continue;
+        }
+        const CKConfigNode remote(remoteNode);
+        KNamelist *remoteNames = NULL;
+        rc  = KConfigNodeListChildren(remoteNode, &remoteNames);
+        if (rc != 0) {
+            OUTMSG(("failed\n"));
+        }
+        uint32_t count = 0;
+        if (rc == 0) {
+            rc = KNamelistCount(remoteNames, &count);
+        }
+        if (rc != 0) {
+            OUTMSG(("failed\n"));
+        }
+        for (uint32_t idx = 0; idx < count && rc == 0; ++idx) {
+            const char *remoteName = NULL;
+            rc = KNamelistGet(remoteNames, idx, &remoteName);
+            if (rc != 0) {
+                rc = 0;
+                continue;
+            }
+            OUTMSG(("%s ", remoteName));
+            const KConfigNode *remoteRepo = remote.OpenNodeRead(remoteName);
+            if (remoteRepo == NULL) {
+                continue;
+            }
+            CKConfigNode node(remoteRepo);
+            push_back(new CRemoteRepository(dir,
+                node, category, remoteName));
+        }
+        RELEASE(KNamelist, remoteNames);
+        if (rc == 0) {
+            OUTMSG(("ok\n"));
+        }
+        else {
+            OUTMSG(("failed\n"));
+        }
+    }
+    return rc;
+}
+
+void CRemoteRepositories::Fix(CKConfig &kfg, bool disable, bool verbose) {
+    CRemoteRepository *main = NULL;
+    CRemoteRepository *aux = NULL;
+    CRemoteRepository *protectd = NULL;
+
+    for (TCI it = begin(); it != end(); ++it) {
+        CRemoteRepository *r = *it;
+        assert(r);
+        bool toDisable = disable;
+        const string category(r->GetCategory());
+        if (category == "aux") {
+            aux = r;
+        }
+        else if (category == "main") {
+            main = r;
+        }
+        else if (category == "protected") {
+            protectd = r;
+            toDisable = false;
+        }
+        r->Fix(kfg, toDisable, verbose);
+    }
+
+    const string cgi
+        ("http://www.ncbi.nlm.nih.gov/Traces/names/names.cgi");
+    if (main == NULL) {
+        main = new CRemoteRepository("main", "CGI", cgi);
+        main->Fix(kfg, disable);
+        push_back(main);
+    }
+
+    if (aux == NULL) {
+        aux = new CRemoteRepository("aux", "NCBI",
+            "http://ftp-trace.ncbi.nlm.nih.gov/sra");
+        aux->Fix(kfg, disable);
+        push_back(aux);
+    }
+
+    if (protectd == NULL) {
+        protectd = new CRemoteRepository("protected", "CGI", cgi);
+        if (verbose) {
+            OUTMSG(("creating %s %s remote repository\n",
+                protectd->GetSubCategory().c_str(),
+                protectd->GetName().c_str()));
+        }
+        protectd->Fix(kfg, false);
+        push_back(protectd);
+    }
+}
diff --git a/tools/vdb-config/util.hpp b/tools/vdb-config/util.hpp
new file mode 100644
index 0000000..31d9c2c
--- /dev/null
+++ b/tools/vdb-config/util.hpp
@@ -0,0 +1,699 @@
+#ifndef _hpp_tools_vdb_config_util_
+#define _hpp_tools_vdb_config_util_
+
+/*==============================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <klib/out.h> /* OUTMSG */
+#include <klib/printf.h> /* string_printf */
+#include <klib/text.h> /* String */
+
+#include <kfg/config.h> /* KConfig */
+#include <kfs/directory.h> /* KDirectory */
+
+#include <kfs/file.h> /* KFile */
+
+#include <map>
+#include <string>
+#include <vector>
+
+#include <cstring>
+
+static const bool DEBUG(false);
+
+#define RELEASE(type, obj) do { rc_t rc2 = type##Release(obj); \
+    if (rc2 && !rc) { rc = rc2; } obj = NULL; } while (false)
+
+
+class CNoncopyable {
+public:
+    CNoncopyable(void) {}
+protected:
+    ~CNoncopyable(void) {}
+private:
+    // Prohibit copy constructor and assignment operator
+    CNoncopyable(const CNoncopyable&);
+    const CNoncopyable& operator=(const CNoncopyable&);
+};
+
+rc_t StringRelease(const String *self);
+
+class CString : CNoncopyable {
+    const String *m_Self;
+
+public:
+    CString(const String *self) : m_Self(self) {}
+
+    ~CString() { free((void*)m_Self); }
+
+    const String* Get(void) const { return m_Self; }
+    std::string GetString(void) const {
+        const char *s = GetCString();
+        if (s == NULL)
+            return "";
+        return s;
+    }
+    const char* GetCString(void) const {
+        if (Empty())
+            return NULL;
+        return m_Self->addr;
+    }
+
+    bool Empty(void) const {
+        return
+            m_Self == NULL || m_Self->addr == NULL || m_Self->addr[0] == '\0';
+    }
+
+    bool Equals(const CString &aString) const {
+        const String *string = aString.Get();
+
+        if (m_Self == NULL && string == NULL)
+            return true;
+        return StringEqual(m_Self, string);
+    }
+
+    bool Equals(const char *buffer, size_t bsize = ~0) const {
+        if (bsize == (size_t)~0) {
+            bsize = string_size(buffer);
+        }
+
+        if (m_Self == NULL) {
+            return buffer == NULL || bsize == 0;
+        }
+
+        String s;
+        StringInit(&s, buffer, bsize, bsize + 1);
+
+        return StringEqual(m_Self, &s);
+    }
+};
+
+class CStdIn : CNoncopyable {
+    const KFile *m_Self;
+    uint64_t m_Pos;
+
+public:
+    CStdIn(void) : m_Self(NULL), m_Pos(0) {
+        rc_t rc = KFileMakeStdIn(&m_Self);
+        if (rc != 0) {
+            throw rc;
+        }
+    }
+
+    ~CStdIn(void) { KFileRelease(m_Self); }
+
+    char Read1(void) {
+        char buf[9] = "";
+        rc_t rc = Read(buf, sizeof buf);
+        if (rc != 0) {
+            return -1;
+        }
+        return buf[0];
+    }
+
+    rc_t Read(char *buffer, size_t bsize, size_t *num_read = NULL);
+};
+
+class CKDirectory : CNoncopyable {
+    KDirectory *m_Self;
+    const uint32_t m_PrivateAccess;
+    const uint32_t m_PublicAccess;
+public:
+    CKDirectory(void)
+        : m_Self(NULL), m_PrivateAccess(0700), m_PublicAccess(0775)
+    {
+        rc_t rc  = KDirectoryNativeDir(&m_Self);
+        if (rc != 0)
+            throw rc;
+    }
+    ~CKDirectory() { KDirectoryRelease(m_Self); }
+    rc_t CheckPrivateAccess(const CString &path, bool &updated, bool verbose)
+        const
+    {   return CheckAccess(path, updated, true, verbose); }
+    rc_t CheckPublicAccess(const CString &path, bool verbose = false) const;
+    rc_t CreateNonExistingPrivateDir(const CString &path, bool verbose = false)
+        const
+    {   return CreateNonExistingDir(path, m_PrivateAccess, verbose); }
+    rc_t CreateNonExistingPublicDir(bool verbose, const char *path, ...) const;
+    rc_t CreateNonExistingPublicDir(const std::string &path,
+        bool verbose = false) const
+    {   return CreateNonExistingDir(path, m_PublicAccess, verbose, true); }
+    rc_t CreateNonExistingPublicDir(const CString &path, bool verbose = false)
+        const
+    {   return CreateNonExistingDir(path, m_PublicAccess, verbose); }
+    rc_t CreatePublicDir(const std::string &path, bool verbose = false) {
+        return CreateNonExistingDir(path, m_PublicAccess, verbose, false);
+    }
+    rc_t CanWriteFile(const CString &dir, bool verbose = false) const;
+    bool Exists(const std::string &path) const { return Exists(path.c_str()); }
+    bool Exists(const CString &path) const;
+    bool IsDirectory(const std::string &path) const {
+        return IsDirectory(path.c_str());
+    }
+    bool IsDirectory(const char *path, ...) const;
+private:
+    bool Exists(const char *path) const
+    {   return KDirectoryPathType(m_Self, path) != kptNotFound; }
+    rc_t CreateNonExistingDir(const CString &path,
+        uint32_t access, bool verbose) const;
+    rc_t CreateNonExistingDir(const std::string &path,
+        uint32_t access, bool verbose, bool chekExistance) const;
+    rc_t CreateNonExistingDir(bool verbose,
+        uint32_t access, const char *path, va_list args) const;
+    rc_t CheckAccess(const CString &path, bool &updated, bool isPrivate,
+        bool verbose = false) const;
+};
+
+class CKConfigNode : CNoncopyable {
+    const KConfigNode *m_Self;
+
+public:
+    CKConfigNode(const KConfigNode *self)
+        : m_Self(self)
+    {}
+
+    ~CKConfigNode(void) {
+        KConfigNodeRelease(m_Self);
+    }
+
+    const KConfigNode* OpenNodeRead(const std::string &path) const {
+        const KConfigNode *node = NULL;
+        rc_t rc = KConfigNodeOpenNodeRead(m_Self, &node, path.c_str());
+        if (rc != 0) {
+            return NULL;
+        }
+        return node;
+    }
+
+    bool ReadBool(const std::string &path) const {
+        return ReadString(path) == "true";
+    }
+
+    std::string ReadString(const std::string &path) const {
+        const KConfigNode *node = NULL;
+        rc_t rc = KConfigNodeOpenNodeRead(m_Self, &node, path.c_str());
+        if (rc != 0) {
+            return "";
+        }
+
+        String *result = NULL;
+        rc = KConfigNodeReadString(node, &result);
+        std::string r;
+        if (rc == 0) {
+            assert(result);
+            r = result->addr;
+        }
+
+        RELEASE(String, result);
+        RELEASE(KConfigNode, node);
+
+        return r;
+    }
+};
+
+class CKConfig : CNoncopyable {
+    KConfig *m_Self;
+    bool m_Updated;
+    const char *m_RepositoryRemoteAuxDisabled;
+    const char *m_RepositoryRemoteMainDisabled;
+    const char *m_RepositoryUserRoot;
+public:
+    CKConfig(bool verbose = false)
+        : m_Self(NULL), m_Updated(false)
+        , m_RepositoryRemoteAuxDisabled ("repository/remote/aux/NCBI/disabled")
+        , m_RepositoryRemoteMainDisabled("repository/remote/main/CGI/disabled")
+        , m_RepositoryUserRoot          ("repository/user/main/public/root")
+    {
+        if (verbose)
+            OUTMSG(("loading configuration... "));
+        rc_t rc = KConfigMake(&m_Self, NULL);
+        if (rc == 0) {
+            if (verbose)
+                OUTMSG(("ok\n"));
+        }
+        else {
+            if (verbose)
+                OUTMSG(("failed\n"));
+            throw rc;
+        }
+    }
+    ~CKConfig(void)
+    { KConfigRelease(m_Self); }
+    KConfig* Get(void) const { return m_Self; }
+    void Reload(bool verbose = false);
+    rc_t Commit(void) const;
+    const KConfigNode* OpenNodeRead(const char *path, ...) const;
+    bool IsRemoteRepositoryDisabled(void) const;
+    const String* ReadDefaultConfig(void) const
+    {   return ReadString("/config/default"); }
+    const String* ReadHome(void) const { return ReadString("HOME"); }
+    const String* ReadNcbiHome(void) const { return ReadString("NCBI_HOME"); }
+    const String* ReadUserRepositoryRootPath(void) const
+    {   return ReadString(m_RepositoryUserRoot); }
+    rc_t DisableRemoteRepository(bool disable);
+    rc_t UpdateUserRepositoryRootPath(const CString &path);
+    rc_t UpdateUserRepositoryRootPath(const char *buffer, size_t size) {
+        return UpdateNode(m_RepositoryUserRoot, buffer, false, size);
+    }
+    bool NodeExists(const std::string &path) const;
+    rc_t UpdateNode(bool verbose, const char *value, const char *name, ...);
+    rc_t UpdateNode(const char *path, const char *buffer,
+        bool verbose = false, size_t size = ~0);
+    rc_t CreateRemoteRepositories(bool fix = false);
+    rc_t CreateUserRepositories(bool fix = false);
+    const String* ReadString(const char *path) const;
+};
+
+class CSplitter : CNoncopyable {
+    const char *m_Start;
+    size_t m_Size;
+
+public:
+    CSplitter(const std::string &s) : m_Start(s.c_str()), m_Size(s.size()) {}
+    CSplitter(const String *s) : m_Start(NULL), m_Size(0) {
+        if (s == NULL) {
+            return;
+        }
+        m_Start = s->addr;
+        m_Size = s->len;
+        SkipEmpties();
+    }
+    bool HasNext(void) const { return m_Size != 0; }
+    const std::string Next(void) {
+        if (!HasNext()) {
+            return "";
+        }
+        const char *s = m_Start;
+        const char *end = string_chr(m_Start, m_Size, ':');
+        size_t n = m_Size;
+        if (end != NULL) {
+            n = end - m_Start;
+            m_Start = end + 1;
+            if (m_Size >= n + 1) {
+               m_Size -= n + 1;
+            }
+            else {
+               m_Size = 0;
+            }
+        }
+        else {
+            m_Start = NULL;
+            m_Size = 0;
+        }
+        SkipEmpties();
+        return std::string(s, n);
+    }
+    static rc_t Test(void);
+
+private:
+    void SkipEmpties(void) {
+        while (m_Size > 0 && m_Start != NULL && *m_Start == ':') {
+            --m_Size;
+            ++m_Start;
+        }
+    }
+};
+
+class CAppVolume {
+    std::string m_Type;
+    std::string m_Path;
+
+public:
+    CAppVolume(const std::string &type = "", const std::string &path = "")
+        : m_Type(type)
+        , m_Path(path)
+    {}
+
+    std::string GetPath(void) const { return m_Path; }
+
+    rc_t Update(CKConfig &kfg, const char *node,
+        const std::string &appVolPath, bool verbose = false) const
+    {
+        if (DEBUG) {
+            OUTMSG(("CAppVolume::Update(%s, %s)\n", node, appVolPath.c_str()));
+        }
+
+        return kfg.UpdateNode(verbose, m_Path.c_str(),
+            "%s/%s/%s", node, appVolPath.c_str(), m_Type.c_str());
+    }
+
+    void Dump(const char *node, const std::string &appVolPath) const {
+        OUTMSG(("%s/%s/%s = \"%s\"\n", node, appVolPath.c_str(),
+            m_Type.c_str(), m_Path.c_str()));
+    }
+};
+
+class CApp : CNoncopyable {
+    bool m_HasVolume;
+    const std::string m_AppVolPath;
+    typedef std::map<const std::string, CAppVolume> TCAppVolumes;
+    TCAppVolumes m_Volumes;
+
+public:
+    typedef TCAppVolumes::const_iterator TCAppVolumesCI;
+
+    CApp(const std::string &root, const std::string &name,
+            const std::string &type, const std::string &path)
+        : m_HasVolume(false), m_AppVolPath("apps/" + name + "/volumes")
+    {
+        Update(root, name, type, path);
+    }
+    CApp(const CKDirectory &dir, const CKConfigNode &rep,
+            const std::string &root, const std::string &name);
+
+    void Update(const std::string &root, const std::string &name,
+        const std::string &type, const std::string &path)
+    {
+        m_Volumes[type] = CAppVolume(type, path);
+    }
+    void Update(const CKDirectory &dir, const CKConfigNode &rep,
+        const std::string &root, const std::string &name) const
+    {
+        assert(0);
+    }
+    rc_t Update(CKConfig &kfg, const char *node, bool verbose = false) const {
+        rc_t rc = 0;
+        for (TCAppVolumesCI it = m_Volumes.begin(); it != m_Volumes.end(); ++it)
+        {
+            rc_t r2 = (*it).second.Update(kfg, node, m_AppVolPath, verbose);
+            if (r2 != 0 && rc == 0) {
+                rc = r2;
+            }
+        }
+        return rc;
+    }
+    void Dump(const char *node) const {
+        for (TCAppVolumesCI it = m_Volumes.begin(); it != m_Volumes.end(); ++it)
+        {
+            (*it).second.Dump(node, m_AppVolPath);
+        }
+    }
+
+    TCAppVolumesCI VolumesBegin(void) const { return m_Volumes.begin(); }
+    TCAppVolumesCI VolumesEnd(void) const { return m_Volumes.end(); }
+};
+
+class CApps : public std::map<const std::string, CApp*> {
+public:
+    typedef std::map<const std::string, CApp*>::const_iterator TCI;
+    typedef std::map<const std::string, CApp*>::iterator TI;
+
+    ~CApps(void) {
+        for (TCI it = begin(); it != end(); ++it) {
+            delete((*it).second);
+        }
+    }
+
+    void Update(const CKDirectory &dir, const CKConfigNode &rep,
+        const std::string &root, const std::string &name)
+    {
+        TCI it = find(name);
+        if (it == end()) {
+            insert(std::pair<const std::string, CApp*>
+                (name, new CApp(dir, rep, root, name)));
+        }
+        else {
+            (*it).second->Update(dir, rep, root, name);
+        }
+    }
+
+    void Update(const std::string &root, const std::string &name,
+        const std::string &type, const std::string &path)
+    {
+        if (DEBUG) {
+            OUTMSG(("CApps.Update(%s)\n", name.c_str()));
+        }
+
+        TI it = find(name);
+        if (it == end()) {
+            if (DEBUG) {
+                OUTMSG(("CApps.Update(not found)\n"));
+            }
+            insert(std::pair<const std::string, CApp*>
+                (name, new CApp(root, name, type, path)));
+        }
+        else {
+            if (DEBUG) {
+                OUTMSG(("CApps.Update(found)\n"));
+            }
+            (*it).second->Update(root, name, type, path);
+        }
+    }
+};
+
+class CRepository : CNoncopyable {
+    bool m_Disabled;
+    const std::string m_Category;    // user/site/remote
+    const std::string m_SubCategory; // main/aux/protected
+    const std::string m_Name;
+    std::string m_Root;
+    CApps m_Apps;
+
+    bool RootExists(void) const { return m_Root.size() > 0; }
+
+protected:
+    CRepository(const std::string &category, const std::string &type,
+            const std::string &name, const std::string &root);
+    CRepository(const CKDirectory &dir, const CKConfigNode &repo,
+            const std::string &category, const std::string &subCategory,
+            const std::string &name);
+
+    void SetRoot(const std::string &root) { m_Root = root; }
+    void FixFileVolume(void)
+    {   m_Apps.Update(m_Root, "file", "flat", "files"); }
+    void FixNakmerVolume(const std::string &name,
+        const std::string &path)
+    {   m_Apps.Update(m_Root, "nakmer", name, path); }
+    void FixNannotVolume(const std::string &name,
+        const std::string &path)
+    {   m_Apps.Update(m_Root, "nannot", name, path); }
+    void FixRefseqVolume(void)
+    {   m_Apps.Update(m_Root, "refseq", "refseq", "refseq"); }
+    void FixRefseqVolume(const std::string &name,
+        const std::string &path)
+    {   m_Apps.Update(m_Root, "sra", name, path); }
+    void FixWgsVolume(const std::string &name)
+    {   m_Apps.Update(m_Root, "wgs", name, "wgs"); }
+    rc_t Update(CKConfig &kfg, std::string &node, bool verbose = false);
+
+public:
+    void ClearApps(void) { m_Apps.clear(); }
+    virtual std::string Dump(void) const;
+    bool Is(const std::string &subCategory, const std::string &name = "")
+        const;
+    std::string GetCategory(void) const { return m_Category; }
+    std::string GetSubCategory(void) const { return m_SubCategory; }
+    std::string GetName(void) const { return m_Name; }
+    std::string GetRoot(void) const { return m_Root; }
+    void Disable(bool disable) { m_Disabled = disable; }
+
+    CApps::TCI AppsBegin(void) const { return m_Apps.begin(); }
+    CApps::TCI AppsEnd(void) const { return m_Apps.end(); }
+};
+
+class CRemoteRepository : public CRepository {
+    std::string m_ResolverCgi;
+
+    static bool EndsWith(const std::string &stack, char needle);
+    static std::string GetCgi(const std::string &stack, char needle);
+    static std::string GetRoot(const std::string &stack, char needle);
+    void FixApps(void) {
+        FixNakmerVolume("fuseNAKMER", "sadb");
+        FixNannotVolume("fuseNANNOT", "sadb");
+        FixRefseqVolume();
+        FixRefseqVolume("fuse1000", "sra-instant/reads/ByRun/sra");
+        FixWgsVolume("fuseWGS");
+    }
+    rc_t Update(CKConfig &kfg, bool verbose = false) {
+        std::string node;
+        rc_t rc = CRepository::Update(kfg, node, verbose);
+        if (rc != 0) {
+            return rc;
+        }
+        return kfg.UpdateNode(verbose,
+            m_ResolverCgi.c_str(), "%s/resolver-cgi", node.c_str());
+    }
+
+public:
+    CRemoteRepository(const CKDirectory &dir, const CKConfigNode &repo,
+            const std::string &type, const std::string &name)
+        : CRepository(dir, repo, "remote", type, name)
+        , m_ResolverCgi(repo.ReadString("resolver-cgi"))
+    {}
+    CRemoteRepository(const std::string &category,
+            const std::string &name, const std::string &root)
+        : CRepository("remote", category, name, GetRoot(root, 'i'))
+        , m_ResolverCgi(GetCgi(root, 'i'))
+    {
+        if (m_ResolverCgi.size() == 0) {
+            FixApps();
+        }
+    }
+
+    virtual std::string Dump(void) const {
+        std::string node(CRepository::Dump());
+        if (m_ResolverCgi.size() > 0) {
+            OUTMSG(("%s/resolver-cgi = \"%s\"\n",
+                node.c_str(), m_ResolverCgi.c_str()));
+        }
+        return node;
+    }
+    rc_t Fix(CKConfig &kfg, bool disable, bool verbose = false);
+};
+
+class CUserRepositories;
+class CUserConfigData :  CNoncopyable {
+    std::string m_DefaultRoot;
+    std::string m_CurrentRoot;
+    bool m_CacheEnabled;
+
+public:
+    CUserConfigData(const CUserRepositories &repos, const CString &dflt);
+
+    std::string GetCurrentRoot(void) const { return m_CurrentRoot; }
+    std::string GetDefaultRoot(void) const { return m_DefaultRoot; }
+    bool GetCacheEnabled(void) const { return m_CacheEnabled; }
+
+    void SetCurrentRoot(const std::string &path) { m_CurrentRoot = path; }
+    void SetCacheEnabled(bool enabled) { m_CacheEnabled = enabled; }
+};
+
+class CUserRepository : public CRepository {
+    bool m_CacheEnabled;
+
+    void FixApps(void) {
+        FixFileVolume();
+        FixNakmerVolume("nakmerFlat", "nannot");
+        FixNannotVolume("nannotFlat", "nannot");
+        FixRefseqVolume();
+        FixRefseqVolume("sraFlat", "sra");
+        FixWgsVolume("wgsFlat");
+    }
+    rc_t Fix(CKConfig &kfg,
+        const CUserConfigData *data, const std::string *root);
+    rc_t Update(CKConfig &kfg, bool verbose = false) {
+        std::string node;
+        rc_t rc = CRepository::Update(kfg, node, verbose);
+        if (rc != 0) {
+            return rc;
+        }
+        return kfg.UpdateNode(verbose, m_CacheEnabled ? "true" : "false",
+            "%s/cache-enabled", node.c_str());
+    }
+
+public:
+    CUserRepository(const CKDirectory &dir, const CKConfigNode &repo,
+            const std::string &type, const std::string &name)
+        : CRepository(dir, repo, "user", type, name)
+        , m_CacheEnabled(repo.ReadBool("cache-enabled"))
+    {}
+    CUserRepository(const std::string &category,
+            const std::string &name, const std::string &root)
+        : CRepository("user", category, name, root), m_CacheEnabled(true)
+    {
+        FixApps();
+    }
+
+    virtual std::string Dump(void) const {
+        const std::string node(CRepository::Dump());
+        OUTMSG(("%s/cache-enabled = \"%s\"\n", node.c_str(),
+            m_CacheEnabled ? "true" : "false"));
+        return node;
+    }
+
+    bool IsCacheEnabled(void) const { return m_CacheEnabled; }
+    void Fix(CKConfig &kfg, const std::string &root) { Fix(kfg, NULL, &root); }
+    void Fix(CKConfig &kfg, const CUserConfigData *data) {
+        Fix(kfg, data, NULL);
+    }
+};
+
+class CUserRepositories : std::vector<CUserRepository*> {
+    typedef std::vector<CUserRepository*>::const_iterator TCI;
+    typedef std::vector<CUserRepository*>::iterator TI;
+    const CUserRepository *FindMainPublic(void) const;
+
+public:
+    ~CUserRepositories(void) {
+        for (TCI it = begin(); it != end(); ++it) {
+            free(*it);
+        }
+    }
+
+    rc_t Load(const CKConfig &kfg, const CKDirectory &dir);
+    std::string GetMainPublicRoot(void) const {
+        const CUserRepository *r = FindMainPublic();
+        if (r == NULL) {
+            return "";
+        }
+        return r->GetRoot();
+    }
+    bool IsMainPublicCacheEnabled(void) const {
+        const CUserRepository *r = FindMainPublic();
+        if (r == NULL) {
+            return true;
+        }
+        return r->IsCacheEnabled();
+    }
+    void Fix(CKConfig &kfg, const CUserConfigData &data) {
+        bool publicMainFound = false;
+        for (TI it = begin(); it != end(); ++it) {
+            CUserRepository *r = *it;
+            assert(r);
+            if (r->Is("main", "public")) {
+                r->Fix(kfg, &data);
+                publicMainFound = true;
+            }
+            else {
+                r->Fix(kfg, data.GetDefaultRoot());
+            }
+        }
+        if (!publicMainFound) {
+            CUserRepository *r = new CUserRepository("main", "public", "");
+            r->Fix(kfg, &data);
+            push_back(r);
+        }
+    }
+    rc_t MkAppVolumes(const CKDirectory &dir, bool verbose = false)
+        const;
+};
+
+class CRemoteRepositories : std::vector<CRemoteRepository*> {
+    typedef std::vector<CRemoteRepository*>::const_iterator TCI;
+
+public:
+    ~CRemoteRepositories(void) {
+        for (TCI it = begin(); it != end(); ++it) { free(*it); }
+    }
+
+    rc_t Load(const CKConfig &kfg, const CKDirectory &dir);
+
+    bool IsDisabled(void) const { return false; }
+    void Fix(CKConfig &kfg, bool disable, bool verbose = false);
+};
+
+
+#endif // _hpp_tools_vdb_config_util_
diff --git a/tools/vdb-config/vdb-config-model.cpp b/tools/vdb-config/vdb-config-model.cpp
new file mode 100644
index 0000000..7e7f2c5
--- /dev/null
+++ b/tools/vdb-config/vdb-config-model.cpp
@@ -0,0 +1,428 @@
+/*==============================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "vdb-config-model.hpp" // vdbconf_model
+
+#include <klib/vector.h> /* Vector */
+
+#include <cstring> // memset
+
+#include <climits> /* PATH_MAX */
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
+
+using std::string;
+
+const int32_t vdbconf_model::kPublicRepoId = -1;
+const int32_t vdbconf_model::kInvalidRepoId = -2;
+
+
+std::string vdbconf_model::native_to_internal( const std::string &s ) const
+{
+    std::string res = "";
+    VPath * temp_v_path;
+    rc_t rc = VFSManagerMakeSysPath ( _vfs_mgr, &temp_v_path, s.c_str() );
+    if ( rc == 0 )
+    {
+        size_t written;
+        char buffer[ 4096 ];
+        rc = VPathReadPath ( temp_v_path, buffer, sizeof buffer, &written );
+        if ( rc == 0 )
+            res.assign( buffer, written );
+        VPathRelease ( temp_v_path );
+    }
+    return res;
+}
+
+std::string vdbconf_model::internal_to_native( const std::string &s ) const
+{
+    std::string res = "";
+    VPath * temp_v_path;
+    rc_t rc = VFSManagerMakePath ( _vfs_mgr, &temp_v_path, "%s", s.c_str() );
+    if ( rc == 0 )
+    {
+        size_t written;
+        char buffer[ 4096 ];
+        rc = VPathReadSysPath ( temp_v_path, buffer, sizeof buffer, &written );
+        if ( rc == 0 )
+            res.assign( buffer, written );
+        VPathRelease ( temp_v_path );
+    }
+    return res;
+}
+
+
+bool vdbconf_model::does_site_repo_exist( void ) const
+{
+    KRepositoryVector repositories;
+    memset( &repositories, 0, sizeof repositories );
+    rc_t rc = KRepositoryMgrSiteRepositories( _mgr, &repositories );
+    bool res = ( ( rc == 0 ) && ( VectorLength( &repositories ) > 0 ) );
+    KRepositoryVectorWhack( &repositories );
+    return res;
+}
+
+
+int32_t vdbconf_model::get_repo_id( const string & repo_name ) const
+{
+    if ( repo_name == "public" )
+        return kPublicRepoId;
+
+    uint32_t id = 0;
+    rc_t rc = KConfigGetProtectedRepositoryIdByName( _config, repo_name.c_str(), &id );
+    if ( rc != 0 )
+        return kInvalidRepoId;
+    else
+        return id;
+}
+
+
+std::string vdbconf_model::get_repo_name( uint32_t id ) const
+{
+    std::string res = "";
+    if ( _config_valid )
+    {
+        size_t written;
+        char buffer[ 1024 ];
+        rc_t rc = KConfigGetProtectedRepositoryName( _config, id, buffer, sizeof buffer, &written );
+        if ( rc == 0 )
+            res.assign( buffer, written );
+    }
+    return res;
+}
+
+
+std::string vdbconf_model::get_repo_description(const string &repo_name) const
+{
+    size_t written = 0;
+    char buffer[ 1024 ];
+    rc_t rc = KConfigGetProtectedRepositoryDescriptionByName( _config,
+        repo_name.c_str(), buffer, sizeof buffer, &written );
+    if ( rc == 0 )
+        return string( buffer, written );
+    else
+        return "";
+}
+
+std::string vdbconf_model::get_repo_location( uint32_t id ) const
+{
+    std::string res = "";
+    if ( _config_valid )
+    {
+        size_t written;
+        char buffer[ PATH_MAX ];
+        rc_t rc = KConfigGetProtectedRepositoryPathById( _config, id, buffer, sizeof buffer, &written );
+        if ( rc == 0 )
+        {
+            res.assign( buffer, written );
+            res = internal_to_native( res );
+        }
+    }
+    return res;
+}
+
+
+std::string vdbconf_model::get_public_location( void ) const
+{
+    std::string res = "";
+    if ( _config_valid )
+    {
+        size_t written;
+        char buffer[ PATH_MAX ];
+        rc_t rc = KConfig_Get_User_Public_Cache_Location( _config, buffer, sizeof buffer, &written );
+        if ( rc == 0 )
+        {
+            res.assign( buffer, written );
+            res = internal_to_native( res );
+        }
+    }
+    return res;
+}
+
+
+std::string vdbconf_model::get_current_dir( void ) const
+{
+    std::string res = "./";
+    char buffer[ PATH_MAX ];
+    rc_t rc = KDirectoryResolvePath ( _dir, true, buffer, sizeof buffer, "./" );
+    if ( rc == 0 )
+    {
+        res.assign( buffer );
+        res = internal_to_native( res );
+    }
+    return res;
+}
+
+
+std::string vdbconf_model::get_home_dir( void ) const
+{
+    std::string res = "";
+    if ( _config_valid )
+    {
+        size_t written;
+        char buffer[ PATH_MAX ];
+        rc_t rc = KConfig_Get_Home( _config, buffer, sizeof buffer, &written );
+        if ( rc == 0 )
+        {
+            res.assign( buffer, written );
+            res = internal_to_native( res );
+        }
+    }
+    return res;
+}
+
+
+std::string vdbconf_model::get_user_default_dir( void ) const
+{
+    std::string res = "";
+    if ( _config_valid )
+    {
+        size_t written;
+        char buffer[ PATH_MAX ];
+        rc_t rc = KConfig_Get_Default_User_Path( _config, buffer, sizeof buffer, &written );
+        if ( rc == 0 )
+        {
+            res.assign( buffer, written );
+            res = internal_to_native( res );
+        }
+    }
+    return res;
+}
+
+
+std::string vdbconf_model::get_ngc_root( std::string &base, const KNgcObj * ngc ) const
+{
+    std::string res = "";
+    size_t written;
+    char buffer[ PATH_MAX ];
+    rc_t rc = KNgcObjGetProjectName ( ngc, buffer, sizeof buffer, &written );
+    if ( rc == 0 )
+    {
+        res = native_to_internal( base ) + '/' + buffer;
+        res = internal_to_native( res );
+    }
+    return res;
+}
+
+
+static rc_t CC s_IsEmpty( const KDirectory * dir, uint32_t type, const char * name, void * data )
+{
+    if ( ( type & ~kptAlias) != kptDir )
+        return 1;
+    else
+        return 0;
+}
+
+// repoId == kPublicRepoId is for the public repository
+ESetRootState vdbconf_model::x_ChangeRepoLocation( const string &native_newPath,
+    bool reuseNew, int32_t repoId, bool flushOld )
+{
+/*rc_t CC KDirectoryResolvePath_v1 ( const KDirectory_v1 *self, bool absolute,
+    char *resolved, size_t rsize, const char *path, ... )
+    resolve ~
+    and ~user */
+    // old root path
+
+    if ( native_newPath.size() == 0 )
+        return eSetRootState_NewPathEmpty;
+
+    std::string newPath = native_to_internal( native_newPath );
+
+    string oldPath;
+
+    if ( repoId != kInvalidRepoId )
+    {
+        if ( repoId == kPublicRepoId )
+            oldPath = get_public_location();
+        else if ( repoId >= 0 )
+            oldPath = get_repo_location( repoId );
+        else
+            return eSetRootState_Error;
+
+        if ( oldPath.size() == newPath.size() )
+        {
+            // make sure new path is different from the old one
+            if ( oldPath == newPath )
+                return eSetRootState_NotChanged;
+        }
+
+        // old root path should not be empty - just ignore it now
+        if ( oldPath.size() > 0 )
+        {
+            KPathType type = KDirectoryPathType( _dir, oldPath.c_str() );
+            if ( ( type & ~kptAlias ) == kptDir )
+            {
+                rc_t rc = KDirectoryVisit ( _dir, true, s_IsEmpty, NULL, oldPath.c_str() );
+                if ( rc != 0 && !flushOld )
+                {
+                    // warn if the old repo is not empty and flush was not asked
+                    return eSetRootState_OldNotEmpty;
+                }
+            }
+        }
+    }
+
+    KPathType type = KDirectoryPathType( _dir, newPath.c_str() );
+    uint32_t access = 0775;
+    switch ( type & ~kptAlias )
+    {
+        case kptNotFound :
+            {
+                // create non existing new repository directory
+                rc_t rc = KDirectoryCreateDir( _dir, access, (kcmCreate | kcmParents), newPath.c_str() );
+                if ( rc != 0 )
+                    return eSetRootState_MkdirFail;
+            }
+            break;
+
+        case kptDir :
+            {
+                rc_t rc = KDirectoryVisit( _dir, true, s_IsEmpty, NULL, newPath.c_str() );
+                if ( rc != 0 && !reuseNew )
+                    // warn if the new repo is not empty and resuse was not asked
+                    return eSetRootState_NewDirNotEmpty;
+            }
+            break;
+
+        // error: new repository exists and it is not a directory
+        default : return eSetRootState_NewNotDir;
+    }
+
+    // create apps subdirectories
+    const char *apps[] = { "files", "nannot", "refseq", "sra", "wgs", NULL };
+    for ( const char **p = apps; *p; ++p )
+    {
+        KPathType type = KDirectoryPathType( _dir, "%s/%s", newPath.c_str(), *p );
+        switch ( type & ~kptAlias )
+        {
+            case kptNotFound : KDirectoryCreateDir( _dir, access, kcmCreate, "%s/%s", newPath.c_str(), *p );
+            case kptDir : break;
+            default : return eSetRootState_Error;
+        }
+    }
+
+    // update repository root configiration
+    if ( repoId == kPublicRepoId )
+        KConfig_Set_User_Public_Cache_Location( _config, newPath.c_str() );
+    else if ( repoId >= 0 )
+        KConfigSetProtectedRepositoryPathById( _config, repoId, newPath.c_str() );
+
+    if ( repoId != kInvalidRepoId )
+    {
+        // flush the old repository
+        for ( const char **p = apps; *p; ++p )
+        {
+            // completely remove all old apps subdirectories
+            KDirectoryRemove( _dir, true, "%s/%s", oldPath.c_str(), *p );
+        }
+        // remove all old repository directory if it is empty now
+        KDirectoryRemove( _dir, false, oldPath.c_str() );
+    }
+
+    return eSetRootState_OK;
+}
+
+ESetRootState vdbconf_model::set_repo_location(uint32_t id,
+    bool flushOld, const string &path, bool reuseNew)
+{
+    ESetRootState res = x_ChangeRepoLocation( path, reuseNew, id, flushOld );
+    _config_changed = true;
+    return res;
+}
+
+ESetRootState vdbconf_model::set_public_location(
+    bool flushOld, string &path, bool reuseNew)
+{
+    ESetRootState res = x_ChangeRepoLocation( path, reuseNew, kPublicRepoId, flushOld );
+    _config_changed = true;
+    return res;
+}
+
+ESetRootState vdbconf_model::change_repo_location(bool flushOld,
+    const string &newPath, bool reuseNew, int32_t repoId)
+{
+    ESetRootState res = x_ChangeRepoLocation( newPath, reuseNew, repoId, flushOld );
+    _config_changed = true;
+    return res;
+}
+
+ESetRootState vdbconf_model::prepare_repo_directory
+    (const string &newPath, bool reuseNew)
+{
+    ESetRootState res = x_ChangeRepoLocation( newPath, reuseNew, kInvalidRepoId );
+    _config_changed = true;
+    return res;
+}
+
+#if TDB
+bool check_locations_unique(KRepositoryVector *nonUniqueRepos,
+    const string &newRootPath)
+{
+    assert(nonUniqueRepos);
+    KRepositoryVectorWhack(nonUniqueRepos);
+
+    KRepositoryVector repositories;
+    memset(&repositories, 0, sizeof repositories);
+    rc_t rc = KRepositoryMgrUserRepositories(_mgr, &repositories);
+    uint32_t len = 0;
+    if (rc == 0) {
+        len = VectorLength(&repositories);
+    }
+    std::map<const string, const KRepository*> roots;
+    typedef std::map<const string, const KRepository*>::const_iterator TCI;
+    if (len > 0) {
+        for (uint32_t i = 0; i < len; ++i) {
+            const KRepository *repo = static_cast<const KRepository*>
+                (VectorGet(&repositories, i));
+            if (repo != NULL) {
+                char buffer[PATH_MAX] = "";
+                size_t size = 0;
+                rc = KRepositoryRoot(repo, buffer, sizeof buffer, &size);
+                if (rc == 0) {
+                    const string root(buffer);
+                    TI it = find(root);
+                    if (it == end()) {
+                        insert(std::pair<const string, const KRepository*>
+                            (root, repo));
+                    }
+                    else {
+                        if (VectorLength(nonUniqueRepos) == 0) {
+                            const KRepository *r = KRepositoryAddRef(repo);
+                            if (r != NULL) {
+              /*ignored rc = */ VectorAppend(repositories, NULL, r);
+                            }
+                        }
+                        const KRepository *found = (*it);
+                        const KRepository *r = KRepositoryAddRef(found);
+                    }
+                }
+            }
+        }
+    }
+    KRepositoryVectorWhack( &repositories );
+}
+#endif
diff --git a/tools/vdb-config/vdb-config-model.hpp b/tools/vdb-config/vdb-config-model.hpp
new file mode 100644
index 0000000..31e1732
--- /dev/null
+++ b/tools/vdb-config/vdb-config-model.hpp
@@ -0,0 +1,433 @@
+/*==============================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_vdb_config_model_
+#define _h_vdb_config_model_
+
+#include <kfg/config.h>
+#include <kfg/properties.h>
+#include <kfg/repository.h>
+#include <kfg/ngc.h>
+#include <kfs/directory.h>
+#include <vfs/manager.h>
+#include <vfs/path.h>
+
+#include <string>
+
+enum ESetRootState {
+    eSetRootState_OK,            // successfully changed repository root
+    eSetRootState_NotChanged,    // the new path is the same as the old one
+    eSetRootState_NotUnique,   // there is another repository with the same root
+    eSetRootState_MkdirFail,     // failed to make new repository directory
+    eSetRootState_NewPathEmpty,  // new repository directory path is not empty
+    eSetRootState_NewDirNotEmpty,// new repository directory is not empty
+    eSetRootState_NewNotDir,     // new repository exists and is not a directory
+    eSetRootState_OldNotEmpty,   // old repository is not empty
+    eSetRootState_Error,         // some unusual error happened
+};
+
+/*
+    a c++ class the encapsulates the connection to 
+*/
+
+class vdbconf_model
+{
+    public :
+        static const int32_t kPublicRepoId;
+        static const int32_t kInvalidRepoId;
+
+        vdbconf_model( KConfig * config )
+            : _config( config )
+            , _config_valid( _config != NULL )
+            , _config_changed( false )
+            , _dir( NULL )
+            , _mgr( NULL )
+            , _vfs_mgr( NULL )
+        {
+            if ( KConfigAddRef( config ) != 0 )
+            {
+                _config = NULL;
+                _config_valid = false;
+            }
+
+            assert(_config && _config_valid);
+
+            rc_t rc = KDirectoryNativeDir(&_dir);
+            if ( rc != 0 ) throw rc;
+
+            rc = KConfigMakeRepositoryMgrRead( _config, &_mgr );
+            if ( rc != 0 ) throw rc;
+
+            rc = VFSManagerMake ( &_vfs_mgr );
+        }
+
+        ~vdbconf_model( void )
+        {
+            if ( _config_valid ) {
+                KConfigRelease ( _config );
+                _config = NULL;
+            }
+
+            KRepositoryMgrRelease(_mgr);
+            _mgr = NULL;
+
+            KDirectoryRelease(_dir);
+            _dir = NULL;
+
+            VFSManagerRelease ( _vfs_mgr );
+            _vfs_mgr = NULL;
+        }
+
+        // ----------------------------------------------------------------
+        std::string native_to_internal( const std::string &s ) const;
+        std::string internal_to_native( const std::string &s ) const;
+
+        bool get_config_changed( void ) const { return _config_changed; }
+
+        // ----------------------------------------------------------------
+        bool is_remote_enabled( void ) const
+        {
+            bool res = false;
+
+            rc_t rc = KConfig_Get_Remote_Access_Enabled( _config, &res );
+            if (rc == 0) {
+                return res;
+            }
+
+            KConfig_Get_Remote_Main_Cgi_Access_Enabled( _config, &res );
+            if (!res) {
+                return res;
+            }
+
+            KConfig_Get_Remote_Aux_Ncbi_Access_Enabled( _config, &res );
+
+            return res;
+        }
+
+        void set_remote_enabled( bool enabled )
+        {
+            if ( _config_valid )
+            {
+                KConfig_Set_Remote_Access_Enabled( _config, enabled );
+                _config_changed = true;
+            }
+        }
+
+        // ----------------------------------------------------------------
+        bool does_site_repo_exist( void ) const;
+
+        bool is_site_enabled( void ) const
+        {
+            bool res = false;
+            if ( _config_valid ) KConfig_Get_Site_Access_Enabled( _config, &res ); 
+            return res;
+        }
+        void set_site_enabled( bool enabled )
+        {
+            if ( does_site_repo_exist() && _config_valid )
+            {
+                KConfig_Set_Site_Access_Enabled( _config, enabled );
+                _config_changed = true;
+            }
+        }
+
+        // ----------------------------------------------------------------
+        /* THIS IS NEW AND NOT YET IMPLEMENTED IN CONFIG: global cache on/off !!! */
+        bool is_global_cache_enabled( void ) const
+        {
+            bool res = true;
+            if ( _config_valid )
+            {
+                bool is_disabled;
+                rc_t rc = KConfigReadBool ( _config, "/repository/user/cache-disabled", &is_disabled );
+                if ( rc == 0 )
+                    res = !is_disabled;
+            }
+            return res;
+        }
+
+        void set_global_cache_enabled( bool enabled )
+        {
+            if ( _config_valid )
+            {
+                KConfigWriteBool( _config, "/repository/user/cache-disabled", !enabled );
+                _config_changed = true;
+            }
+        }
+
+  // ----------------------------- //
+  // ADD DEFINE IF YOU NEED IT !!! //
+  // ----------------------------- //
+        bool is_user_enabled( void ) const
+        {
+            bool res = true;
+#ifdef ALLOW_USER_REPOSITORY_DISABLING
+            if ( _config_valid ) KConfig_Get_User_Access_Enabled( _config, &res ); 
+#endif
+            return res;
+        }
+        void set_user_enabled( bool enabled )
+        {
+#ifdef ALLOW_USER_REPOSITORY_DISABLING
+            if ( _config_valid ) KConfig_Set_User_Access_Enabled( _config, enabled );
+#endif
+        }
+
+        // ----------------------------------------------------------------
+        bool is_user_cache_enabled( void ) const
+        {
+            bool res = false;
+            if ( _config_valid ) KConfig_Get_User_Public_Cached( _config, &res ); 
+            return res;
+        }
+        void set_user_cache_enabled( bool enabled )
+        {
+            if ( _config_valid )
+            {
+                KConfig_Set_User_Public_Cached( _config, enabled );
+                _config_changed = true;
+            }
+        }
+
+        // ----------------------------------------------------------------
+        uint32_t get_repo_count( void ) const
+        {
+            uint32_t res = 0;
+            if ( _config_valid ) KConfigGetProtectedRepositoryCount( _config, &res );
+            return res;
+        }
+
+
+        /* Returns:
+         *  kInvalidRepoId if not found,
+         *  kPublicRepoId for the user public repository
+         *  protected repository id otherwise
+         */
+        int32_t get_repo_id( const std::string & repo_name ) const;
+
+        std::string get_repo_name( uint32_t id ) const;
+        std::string get_repo_description( const std::string & repo_name ) const;
+
+        bool is_protected_repo_enabled( uint32_t id ) const
+        {
+            bool res = true;
+#ifdef ALLOW_USER_REPOSITORY_DISABLING
+            if ( _config_valid ) KConfigGetProtectedRepositoryEnabledById( _config, id, &res ); 
+#endif
+            return res;
+        }
+        void set_protected_repo_enabled( uint32_t id, bool enabled )
+        {
+#ifdef ALLOW_USER_REPOSITORY_DISABLING
+            if ( _config_valid ) KConfigSetProtectedRepositoryEnabledById( _config, id, enabled ); 
+#endif
+        }
+
+        bool is_protected_repo_cached( uint32_t id ) const
+        {
+            bool res = true;
+            if ( _config_valid )
+                KConfigGetProtectedRepositoryCachedById( _config, id, &res );
+            return res;
+        }
+
+        void set_protected_repo_cached( uint32_t id, bool enabled )
+        {
+            if ( _config_valid )
+            {
+                KConfigSetProtectedRepositoryCachedById( _config, id, enabled );
+                _config_changed = true;
+            }
+        }
+
+        bool does_repo_exist( const char * repo_name )
+        {
+            bool res = false;
+            if ( _config_valid ) KConfigDoesProtectedRepositoryExist( _config, repo_name, &res );
+            return res;
+        }
+
+        std::string get_repo_location( uint32_t id ) const;
+
+        ESetRootState set_repo_location( uint32_t id,
+            bool flushOld, const std::string &path, bool reuseNew );
+
+/* ----------------------------------------------------------------
+ * flushOld repository
+ * reuseNew repository: whether to refuse to change location on existing newPath
+ */
+        ESetRootState change_repo_location(bool flushOld,
+            const std::string &newPath, bool reuseNew, int32_t repoId);
+
+        ESetRootState prepare_repo_directory(const std::string &newPath,
+            bool reuseNew = false);
+
+        // ----------------------------------------------------------------
+
+        std::string get_public_location( void ) const;
+
+        ESetRootState set_public_location( bool flushOld, std::string &path, bool reuseNew );
+
+        bool is_user_public_enabled( void ) const
+        {
+            bool res = true;
+            if ( _config_valid ) KConfig_Get_User_Public_Enabled( _config, &res ); 
+            return res;
+        }
+        void set_user_public_enabled( bool enabled )
+        {
+            if ( _config_valid )
+            {
+                KConfig_Set_User_Public_Enabled( _config, enabled ); 
+                _config_changed = true;
+            }
+        }
+
+        bool is_user_public_cached( void ) const
+        {
+            bool res = true;
+            if ( _config_valid ) KConfig_Get_User_Public_Cached( _config, &res ); 
+            return res;
+        }
+
+        void set_user_public_cached( bool enabled )
+        {
+            if ( _config_valid )
+            {
+                KConfig_Set_User_Public_Cached( _config, enabled ); 
+                _config_changed = true;
+            }
+        }
+
+        // ----------------------------------------------------------------
+        std::string get_current_dir( void ) const;
+        std::string get_home_dir( void ) const;
+
+        std::string get_user_default_dir( void ) const;
+        std::string get_ngc_root( std::string &base, const KNgcObj * ngc ) const;
+
+        void set_user_default_dir( const char * new_default_dir )
+        {
+            if ( _config_valid )
+            {
+                std::string tmp( new_default_dir );
+                tmp = native_to_internal( tmp );
+                KConfig_Set_Default_User_Path( _config, tmp.c_str() );
+                _config_changed = true;
+            }
+        }
+
+        // ----------------------------------------------------------------
+        bool commit( void )
+        {
+            bool res = false;
+            if ( _config_valid )
+            {
+                res = ( KConfigCommit ( _config ) == 0 );
+                if ( res ) _config_changed = false;
+            }
+            return res;
+        }
+
+        // ----------------------------------------------------------------
+        bool import_ngc( const std::string &native_location, const KNgcObj *ngc, uint32_t permissions, uint32_t * result_flags )
+        {
+            bool res = false;
+            if ( _config_valid )
+            {
+                KRepositoryMgr * repo_mgr;
+                rc_t rc = KConfigMakeRepositoryMgrUpdate ( _config, &repo_mgr );
+                if ( rc == 0 )
+                {
+                    std::string location = native_to_internal( native_location );
+                    rc = KRepositoryMgrImportNgcObj( repo_mgr, ngc, location.c_str(), permissions, result_flags );
+                    res = ( rc == 0 );
+                    KRepositoryMgrRelease( repo_mgr );
+                }
+            }
+            return res;
+        }
+
+        bool get_id_of_ngc_obj( const KNgcObj *ngc, uint32_t * id )
+        {
+            bool res = false;
+            if ( _config_valid )
+            {
+                size_t written;
+                char proj_id[ 512 ];
+                rc_t rc = KNgcObjGetProjectName( ngc, proj_id, sizeof proj_id, &written );
+                if ( rc == 0 )
+                {
+                    rc = KConfigGetProtectedRepositoryIdByName( _config, proj_id, id );
+                    res = ( rc == 0 );
+                }
+            }
+            return res;
+        }
+
+		bool does_path_exist( std::string &path )
+		{
+			bool res = false;
+			if ( _dir != NULL )
+			{
+				KPathType type = KDirectoryPathType( _dir, path.c_str() );
+				res = ( ( type & ~kptAlias ) == kptDir );
+			}
+			return res;
+		}
+
+        bool reload( void )
+        {
+            if ( _config_valid )
+            {
+                KRepositoryMgrRelease ( _mgr );
+                _mgr = NULL;
+
+                KConfigRelease ( _config );
+                _config_valid = ( KConfigMake ( &_config, NULL ) == 0 );
+
+                if ( _config_valid )
+                    KConfigMakeRepositoryMgrRead( _config, &_mgr );
+
+                _config_changed = false;
+            }
+            return _config_valid;
+        }
+
+    private :
+        KConfig * _config;
+        bool _config_valid;
+        bool _config_changed;
+
+        KDirectory * _dir;
+        const KRepositoryMgr *_mgr;
+        VFSManager *_vfs_mgr;
+
+        ESetRootState x_ChangeRepoLocation(const std::string &native_newPath,
+            bool reuseNew, int32_t repoId, bool flushOld = false);
+};
+
+#endif
diff --git a/tools/vdb-config/vdb-config.c b/tools/vdb-config/vdb-config.c
index c346d54..e312f98 100644
--- a/tools/vdb-config/vdb-config.c
+++ b/tools/vdb-config/vdb-config.c
@@ -25,6 +25,7 @@
 */
 
 #include "vdb-config.vers.h"
+#include "configure.h"
 
 #include <kapp/main.h>
 
@@ -32,8 +33,13 @@
 #include <vdb/manager.h> /* VDBManager */
 
 #include <kfg/kfg-priv.h> /* KConfig */
+#include <kfg/ngc.h> /* KNgcObjMakeFromFile */
+#include <kfg/properties.h> /* KConfig_Get_Default_User_Path */
+#include <kfg/repository.h> /* KConfigImportNgc */
 
+#include <vfs/manager.h> /* VFSManagerMake */
 #include <vfs/path-priv.h> /* KPathGetCWD */
+
 #include <kfs/directory.h>
 #include <kfs/file.h>
 #include <kfs/impl.h> /* KDirectoryGetSysDir */
@@ -73,9 +79,17 @@
 #define OPTION_ALL   "all"
 static const char* USAGE_ALL[] = { "print all information [default]", NULL };
 
-#define ALIAS_NEW    "c"
-#define OPTION_NEW   "create"
-static const char* USAGE_NEW[] = { "create configuration file", NULL };
+#define ALIAS_CFG    "i"
+#define OPTION_CFG   "interactive"
+static const char* USAGE_CFG[] = {
+    "create/update configuration",
+    NULL };
+
+#define ALIAS_CFM    NULL
+#define OPTION_CFM   "interactive-mode"
+static const char* USAGE_CFM[] = {
+    "interactive mode: 'textual' or 'graphical' (default)",
+    NULL };
 
 #define ALIAS_DIR    "d"
 #define OPTION_DIR   "load-path"
@@ -89,6 +103,11 @@ static const char* USAGE_ENV[] = { "print shell variables", NULL };
 #define OPTION_FIL   "files"
 static const char* USAGE_FIL[] = { "print loaded files", NULL };
 
+#define ALIAS_FIX    NULL
+#define OPTION_FIX   "restore-defaults"
+static const char* USAGE_FIX[] =
+{ "create default or update existing user configuration", NULL };
+
 #define ALIAS_IMP    NULL
 #define OPTION_IMP   "import"
 static const char* USAGE_IMP[] = { "import ngc file", NULL };
@@ -102,9 +121,9 @@ static const char* USAGE_MOD[] = { "print external modules", NULL };
 static const char* USAGE_OUT[] = { "output type: one of (x n), "
     "where 'x' is xml (default), 'n' is native", NULL };
 
-#define ALIAS_CFG    "p"
-#define OPTION_CFG   "cfg"
-static const char* USAGE_CFG[] = { "print current configuration", NULL };
+#define ALIAS_PCF    "p"
+#define OPTION_PCF   "cfg"
+static const char* USAGE_PCF[] = { "print current configuration", NULL };
 
 #define ALIAS_ROOT   NULL
 #define OPTION_ROOT  "root"
@@ -119,13 +138,15 @@ OptDef Options[] =
 {                                         /* needs_value, required */
       { OPTION_ALL, ALIAS_ALL, NULL, USAGE_ALL, 1, false, false }
     , { OPTION_CFG, ALIAS_CFG, NULL, USAGE_CFG, 1, false, false }
+    , { OPTION_CFM, ALIAS_CFM, NULL, USAGE_CFM, 1, true , false }
     , { OPTION_DIR, ALIAS_DIR, NULL, USAGE_DIR, 1, false, false }
     , { OPTION_ENV, ALIAS_ENV, NULL, USAGE_ENV, 1, false, false }
     , { OPTION_FIL, ALIAS_FIL, NULL, USAGE_FIL, 1, false, false }
+    , { OPTION_FIX, ALIAS_FIX, NULL, USAGE_FIX, 1, false, false }
     , { OPTION_IMP, ALIAS_IMP, NULL, USAGE_IMP, 1, true , false }
     , { OPTION_MOD, ALIAS_MOD, NULL, USAGE_MOD, 1, false, false }
-    , { OPTION_NEW, ALIAS_NEW, NULL, USAGE_NEW, 1, false, false }
     , { OPTION_OUT, ALIAS_OUT, NULL, USAGE_OUT, 1, true , false }
+    , { OPTION_PCF, ALIAS_PCF, NULL, USAGE_PCF, 1, false, false }
     , { OPTION_SET, ALIAS_SET, NULL, USAGE_SET, 1, true , false }
     , { OPTION_ROOT,ALIAS_ROOT,NULL, USAGE_ROOT,1, false, false }
 };
@@ -136,7 +157,7 @@ rc_t CC UsageSummary (const char * progname) {
         "  %s [options] [<query> ...]\n"
         "\n"
         "Summary:\n"
-        "  Display VDB configuration information\n"
+        "  Manage VDB configuration\n"
         "\n", progname);
 }
 
@@ -146,23 +167,29 @@ rc_t CC Usage(const Args* args) {
     const char* progname = UsageDefaultName;
     const char* fullpath = UsageDefaultName;
 
-    if (args == NULL)
-    {    rc = RC(rcExe, rcArgv, rcAccessing, rcSelf, rcNull); }
-    else
-    {    rc = ArgsProgram(args, &fullpath, &progname); }
+    if (args == NULL) {
+        rc = RC(rcExe, rcArgv, rcAccessing, rcSelf, rcNull);
+    }
+    else {
+        rc = ArgsProgram(args, &fullpath, &progname);
+    }
 
     UsageSummary(progname);
 
     KOutMsg ("\nOptions:\n");
 
     HelpOptionLine (ALIAS_ALL, OPTION_ALL, NULL, USAGE_ALL);
-    HelpOptionLine (ALIAS_CFG, OPTION_CFG, NULL, USAGE_CFG);
+    HelpOptionLine (ALIAS_PCF, OPTION_PCF, NULL, USAGE_PCF);
     HelpOptionLine (ALIAS_FIL, OPTION_FIL, NULL, USAGE_FIL);
     HelpOptionLine (ALIAS_ENV, OPTION_ENV, NULL, USAGE_ENV);
     HelpOptionLine (ALIAS_MOD, OPTION_MOD, NULL, USAGE_MOD);
     KOutMsg ("\n");
     HelpOptionLine (ALIAS_SET, OPTION_SET, "name=value", USAGE_SET);
     KOutMsg ("\n");
+    HelpOptionLine (ALIAS_CFG, OPTION_CFG, NULL, USAGE_CFG);
+    HelpOptionLine (ALIAS_CFM, OPTION_CFM, "mode", USAGE_CFM);
+    HelpOptionLine (ALIAS_FIX, OPTION_FIX, NULL, USAGE_FIX);
+    KOutMsg ("\n");
     HelpOptionLine (ALIAS_IMP, OPTION_IMP, "ngc-file", USAGE_IMP);
     KOutMsg ("\n");
     HelpOptionLine (ALIAS_OUT, OPTION_OUT, "x | n", USAGE_OUT);
@@ -201,7 +228,9 @@ static rc_t KConfigNodeReadData(const KConfigNode* self,
     return rc;
 }
 
-static rc_t _printNodeData(const char *name, const char *data, size_t dlen) {
+static
+rc_t _printNodeData(const char *name, const char *data, size_t dlen)
+{
     const char ticket[] = "download-ticket";
     size_t l = sizeof ticket - 1;
     if (string_cmp(name, string_measure(name, NULL),
@@ -237,7 +266,7 @@ static rc_t KConfigNodePrintChildNames(bool xml, const KConfigNode* self,
     assert(self && name);
 
     if (rc == 0)
-    {   rc = KConfigNodeOpenNodeRead(self, &node, name);  }
+    {   rc = KConfigNodeOpenNodeRead(self, &node, "%s", name);  }
     if (rc == 0) {
         rc = KConfigNodeReadData(node, buffer, sizeof buffer, &num_read);
         hasData = num_read > 0;
@@ -277,7 +306,7 @@ static rc_t KConfigNodePrintChildNames(bool xml, const KConfigNode* self,
             const char* name = NULL;
             rc = KNamelistGet(names, i, &name);
             if (rc == 0) {
-                size_t bsize = strlen(aFullpath) + 1 + strlen(name);
+                size_t bsize = strlen(aFullpath) + 1 + strlen(name) + 1;
                 fullpath = malloc(bsize + 1);
                 if (fullpath == NULL) {
                     rc = RC
@@ -318,6 +347,8 @@ typedef struct Params {
     const char* ngc;
 
     bool modeSetNode;
+    bool modeConfigure;
+    EConfigMode configureMode;
     bool modeCreate;
     bool modeShowCfg;
     bool modeShowEnv;
@@ -354,6 +385,7 @@ static rc_t ParamsConstruct(int argc, char* argv[], Params* prm) {
             ++count;
         }
 
+    {   // OPTION_OUT
         prm->xml = true;
         rc = ArgsOptionCount(args, OPTION_OUT, &pcount);
         if (rc) {
@@ -376,19 +408,8 @@ static rc_t ParamsConstruct(int argc, char* argv[], Params* prm) {
                 break;
             }
         }
-
-        rc = ArgsOptionCount(args, OPTION_CFG, &pcount);
-        if (rc) {
-            LOGERR(klogErr, rc, "Failure to get '" OPTION_CFG "' argument");
-            break;
-        }
-        if (pcount) {
-            if (!prm->modeShowCfg) {
-                prm->modeShowCfg = true;
-                ++count;
-            }
-        }
-
+    }
+    {   // OPTION_ENV
         rc = ArgsOptionCount(args, OPTION_ENV, &pcount);
         if (rc) {
             LOGERR(klogErr, rc, "Failure to get '" OPTION_ENV "' argument");
@@ -398,7 +419,8 @@ static rc_t ParamsConstruct(int argc, char* argv[], Params* prm) {
             prm->modeShowEnv = true;
             ++count;
         }
-
+    }
+    {   // OPTION_FIL
         rc = ArgsOptionCount(args, OPTION_FIL, &pcount);
         if (rc) {
             LOGERR(klogErr, rc, "Failure to get '" OPTION_FIL "' argument");
@@ -408,7 +430,8 @@ static rc_t ParamsConstruct(int argc, char* argv[], Params* prm) {
             prm->modeShowFiles = true;
             ++count;
         }
-
+    }
+    {   // OPTION_IMP
         rc = ArgsOptionCount(args, OPTION_IMP, &pcount);
         if (rc) {
             LOGERR(klogErr, rc, "Failure to get '" OPTION_IMP "' argument");
@@ -420,8 +443,12 @@ static rc_t ParamsConstruct(int argc, char* argv[], Params* prm) {
                 LOGERR(klogErr, rc, "Failure to get '" OPTION_IMP "' argument");
                 break;
             }
+            else {
+                 prm->modeShowCfg = false;
+            }
         }
-
+    }
+    {   // OPTION_MOD
         rc = ArgsOptionCount(args, OPTION_MOD, &pcount);
         if (rc) {
             LOGERR(klogErr, rc, "Failure to get '" OPTION_MOD "' argument");
@@ -431,8 +458,9 @@ static rc_t ParamsConstruct(int argc, char* argv[], Params* prm) {
             prm->modeShowModules = true;
             ++count;
         }
-
+    }
 #if 0
+    {   // OPTION_NEW
         rc = ArgsOptionCount(args, OPTION_NEW, &pcount);
         if (rc) {
             LOGERR(klogErr, rc, "Failure to get '" OPTION_NEW "' argument");
@@ -442,8 +470,22 @@ static rc_t ParamsConstruct(int argc, char* argv[], Params* prm) {
             prm->modeCreate = true;
             ++count;
         }
+    }
 #endif
-
+    {   // OPTION_PCF
+        rc = ArgsOptionCount(args, OPTION_PCF, &pcount);
+        if (rc) {
+            LOGERR(klogErr, rc, "Failure to get '" OPTION_PCF "' argument");
+            break;
+        }
+        if (pcount) {
+            if (!prm->modeShowCfg) {
+                prm->modeShowCfg = true;
+                ++count;
+            }
+        }
+    }
+    {   // OPTION_DIR
         rc = ArgsOptionCount(args, OPTION_DIR, &pcount);
         if (rc) {
             LOGERR(klogErr, rc, "Failure to get '" OPTION_DIR "' argument");
@@ -453,7 +495,8 @@ static rc_t ParamsConstruct(int argc, char* argv[], Params* prm) {
             prm->modeShowLoadPath = true;
             ++count;
         }
-
+    }
+    {   // OPTION_ROOT
         rc = ArgsOptionCount(args, OPTION_ROOT, &pcount);
         if (rc != 0) {
             LOGERR(klogErr, rc, "Failure to get '" OPTION_ROOT "' argument");
@@ -462,7 +505,8 @@ static rc_t ParamsConstruct(int argc, char* argv[], Params* prm) {
         if (pcount) {
             prm->modeRoot = true;
         }
-
+    }
+    {   // OPTION_SET
         rc = ArgsOptionCount(args, OPTION_SET, &pcount);
         if (rc != 0) {
             LOGERR(klogErr, rc, "Failure to get '" OPTION_SET "' argument");
@@ -484,28 +528,110 @@ static rc_t ParamsConstruct(int argc, char* argv[], Params* prm) {
                 count = 1;
             }
         }
+    }
+    {   // OPTION_FIX
+        rc = ArgsOptionCount(args, OPTION_FIX, &pcount);
+        if (rc) {
+            LOGERR(klogErr, rc, "Failure to get '" OPTION_FIX "' argument");
+            break;
+        }
+        if (pcount) {
+            prm->modeConfigure = true;
+            prm->modeShowCfg = false;
+            count = 1;
+            prm->configureMode = eCfgModeDefault;
+        }
+    }
+    {   // OPTION_CFG
+        rc = ArgsOptionCount(args, OPTION_CFG, &pcount);
+        if (rc) {
+            LOGERR(klogErr, rc, "Failure to get '" OPTION_CFG "' argument");
+            break;
+        }
+        if (pcount) {
+#if 1
+            prm->modeConfigure = true;
+            prm->modeShowCfg = false;
+            count = 1;
+            prm->configureMode = eCfgModeVisual;
 
+#else
+            const char* dummy = NULL;
+            rc = ArgsOptionValue(args, OPTION_CFG, 0, &dummy);
+            if (rc) {
+                LOGERR(klogErr, rc, "Failure to get '" OPTION_CFG "' argument");
+                break;
+            }
+            prm->modeConfigure = true;
+            prm->modeShowCfg = false;
+            count = 1;
+            switch (dummy[0]) {
+                case 't':
+                    prm->configureMode = eCfgModeTextual;
+                    break;
+                default:
+                    prm->configureMode = eCfgModeDefault;
+                    break;
+            }
+#endif
+        }
+    }
+    {   // OPTION_CFM
+        rc = ArgsOptionCount(args, OPTION_CFM, &pcount);
+        if (rc) {
+            LOGERR(klogErr, rc, "Failure to get '" OPTION_CFM "' argument");
+            break;
+        }
+        if (pcount) {
+            const char* dummy = NULL;
+            size_t dummy_len;
+            rc = ArgsOptionValue(args, OPTION_CFM, 0, &dummy);
+            if (rc) {
+                LOGERR(klogErr, rc, "Failure to get '" OPTION_OUT "' argument");
+                break;
+            }
+            prm->modeShowCfg = false;
+            count = 1;
+            prm->modeConfigure = true;
+
+            dummy_len = strlen( dummy );
+            if ( dummy_len == 0 )
+                dummy_len = 1;
+
+            if ( strncmp( dummy, "textual", dummy_len ) == 0 )
+                prm->configureMode = eCfgModeTextual;
+            else if ( strncmp( dummy, "graphical", dummy_len ) == 0 )
+                prm->configureMode = eCfgModeVisual;
+            else
+            {
+                rc = RC( rcExe, rcArgv, rcEvaluating, rcParam, rcInvalid );
+                LOGERR(klogErr, rc, "Unrecognized '" OPTION_CFM "' argument");
+                break;
+            }
+        }
+    }
+    {   // OPTION_ALL
         rc = ArgsOptionCount(args, OPTION_ALL, &pcount);
         if (rc) {
             LOGERR(klogErr, rc, "Failure to get '" OPTION_ALL "' argument");
             break;
         }
         if (pcount
-            || ( !prm->modeShowCfg && ! prm->modeShowLoadPath
+            || ( !prm->modeConfigure
+              && !prm->modeShowCfg && ! prm->modeShowLoadPath
               && !prm->modeShowEnv && !prm->modeShowFiles
               && !prm->modeShowModules && !prm->modeCreate
               && !prm->modeSetNode && !prm->ngc))
             /* show all by default */
         {
             prm->modeShowCfg = prm->modeShowEnv = prm->modeShowFiles = true;
-#ifndef _STATIC
-            prm->modeShowModules = true;
-#endif
             count += 2;
         }
+    }
 
-        if (count > 1) 
-        {   prm->showMultiple = true; }
+        if (count > 1)  {
+            prm->showMultiple = true;
+        }
     } while (false);
 
     return rc;
@@ -660,10 +786,10 @@ static rc_t CreateConfig(char* argv0) {
             char buffer[PATH_MAX + 1];
             rc = In("Specify configuration files directory", def, &location);
             if (rc == 0) {
-                rc = KDirectoryOpenDirUpdate(native, &dir, false, location);
+                rc = KDirectoryOpenDirUpdate(native, &dir, false, "%s", location);
                 if (rc == 0) {
-                    rc = KDirectoryVVisit
-                        (dir, false, scan_config_dir, buffer, ".", NULL);
+                    rc = KDirectoryVisit
+                        (dir, false, scan_config_dir, buffer, ".");
                     if (rc != 0) {
                         if (rc ==
                              RC(rcExe, rcDirectory, rcListing, rcFile, rcExists)
@@ -683,8 +809,8 @@ static rc_t CreateConfig(char* argv0) {
                     }
                     break;
                 }
-                else if (GetRCObject(rc) == rcPath &&
-                (GetRCState(rc) == rcIncorrect || GetRCState(rc) == rcNotFound))
+                else if (GetRCObject(rc) == (enum RCObject)rcPath &&
+                    (GetRCState(rc) == rcIncorrect || GetRCState(rc) == rcNotFound))
                 {
                     PLOGERR(klogErr,
                         (klogErr, rc, "$(path)", "path=%s", location));
@@ -699,12 +825,12 @@ static rc_t CreateConfig(char* argv0) {
         rc = In("Specify refseq installation directory", NULL, &refseq);
         if (rc != 0)
         {   break; }
-        rc = KDirectoryOpenDirRead(native, &dir, false, refseq);
+        rc = KDirectoryOpenDirRead(native, &dir, false, "%s", refseq);
         if (rc == 0) {
             RELEASE(KDirectory, dir);
             break;
         }
-        else if (GetRCObject(rc) == rcPath
+        else if (GetRCObject(rc) == (enum RCObject)rcPath
               && GetRCState(rc) == rcIncorrect)
         {
             PLOGERR(klogErr,
@@ -718,7 +844,7 @@ static rc_t CreateConfig(char* argv0) {
         const char path[] = "vdb-config.kfg";
         uint64_t pos = 0;
         KFile* f = NULL;
-        rc = KDirectoryCreateFile(dir, &f, false, 0664, kcmCreate, path);
+        rc = KDirectoryCreateFile(dir, &f, false, 0664, kcmCreate, "%s", path);
         DISP_RC(rc, path);
         if (rc == 0) {
             int n = snprintf(buffer, sizeof buffer,
@@ -775,6 +901,7 @@ static rc_t CreateConfig(char* argv0) {
     return rc;
 }
 
+#if 0
 static rc_t ShowModules(const KConfig* cfg, const Params* prm) {
     rc_t rc = 0;
 #ifdef _STATIC
@@ -813,6 +940,7 @@ static rc_t ShowModules(const KConfig* cfg, const Params* prm) {
 #endif
     return rc;
 }
+#endif
 
 static rc_t SetNode(KConfig* cfg, const Params* prm) {
     rc_t rc = 0;
@@ -842,7 +970,7 @@ static rc_t SetNode(KConfig* cfg, const Params* prm) {
     if (rc == 0) {
         *(val++) = '\0';
 
-        rc = KConfigOpenNodeUpdate(cfg, &node, name);
+        rc = KConfigOpenNodeUpdate(cfg, &node, "%s", name);
         if (rc != 0) {
             PLOGERR(klogErr, (klogErr, rc,
                 "Cannot open node '$(name)' for update", "name=%s", name));
@@ -927,7 +1055,7 @@ static rc_t ShowConfig(const KConfig* cfg, Params* prm) {
         }
 
         if (rc == 0) {
-            rc = KConfigOpenNodeRead(cfg, &node, root);
+            rc = KConfigOpenNodeRead(cfg, &node, "%s", root);
             DISP_RC(rc, root);
         }
         if (rc == 0) {
@@ -1090,9 +1218,119 @@ static void ShowEnv(const Params* prm) {
             hasAny = true;
         }
     }
-    if (hasAny)
-    {      OUTMSG(("\n")); }
-    else { OUTMSG(("Environment variables are not found\n")); }
+    if (hasAny) {
+        OUTMSG(("\n"));
+    }
+    else {
+        OUTMSG(("Environment variables are not found\n"));
+    }
+}
+
+static rc_t _VFSManagerSystem2PosixPath(const VFSManager *self,
+    const char *system, char posix[PATH_MAX])
+{
+    VPath *path = NULL;
+    rc_t rc = VFSManagerMakeSysPath(self, &path, system);
+    if (rc == 0) {
+        size_t written;
+        rc = VPathReadPath(path, posix, PATH_MAX, &written);
+    }
+    RELEASE(VPath, path);
+    return rc;
+}
+
+static rc_t ImportNgc(KConfig *cfg, Params *prm, const char **newRepoParentPath)
+{
+    VFSManager *vmgr = NULL;
+    rc_t rc = VFSManagerMake(&vmgr);
+    char ngcPath[PATH_MAX] = "";
+    KDirectory *dir = NULL;
+    const KFile *src = NULL;
+    const KNgcObj *ngc = NULL;
+    static char buffer[PATH_MAX] = "";
+    const char *root = NULL;
+    KRepositoryMgr *rmgr = NULL;
+
+    assert(prm);
+    if (rc == 0) {
+        rc = _VFSManagerSystem2PosixPath(vmgr, prm->ngc, ngcPath);
+    }
+    if (rc == 0) {
+        rc = KDirectoryNativeDir(&dir);
+    }
+    if (rc == 0) {
+        rc = KDirectoryOpenFileRead(dir, &src, "%s", ngcPath);
+    }
+    RELEASE(KDirectory, dir);
+    if (rc == 0) {
+        rc = KNgcObjMakeFromFile(&ngc, src);
+    }
+    RELEASE(KFile, src);
+    if (rc == 0) {
+        uint32_t id = 0;
+        size_t written = 0;
+        rc = KNgcObjGetProjectId(ngc, &id);
+        if (rc == 0) {
+            rc = ParamsGetNextParam(prm, &root);
+            root = NULL; // TODO: we cannot accept repo default path from cmd ln
+            if (rc != 0 || root == NULL) {
+                char home[PATH_MAX] = "";
+                rc = KConfig_Get_Default_User_Path(cfg,
+                    home, sizeof home, &written);
+                if (rc == 0 && written > 0) {
+                    rc = string_printf(buffer, sizeof buffer,
+                        &written, "%s/dbGaP-%u", home, id);
+                    root = buffer;
+                }
+            }
+            rc = 0;
+            if (root == NULL && rc == 0) {
+                char home[PATH_MAX] = "";
+                rc = KConfig_Get_Home(cfg, home, sizeof home, &written);
+                if (rc == 0 && written > 0) {
+                    rc = string_printf(buffer, sizeof buffer,
+                        &written, "%s/ncbi/dbGaP-%u", home, id);
+                    root = buffer;
+                }
+            }
+            if (root == NULL && rc == 0) {
+                const char *home = getenv("HOME");
+                if (home == NULL) {
+                    home = getenv("USERPROFILE");
+                }
+                if (home == NULL) {
+#define TODO 1
+                    rc = TODO;
+                }
+                else {
+                    size_t num_writ = 0;
+                    char posix[PATH_MAX] = "";
+                    rc = _VFSManagerSystem2PosixPath(vmgr, root, posix);
+                    if (rc == 0) {
+                        rc = string_printf(buffer, sizeof buffer,
+                            &num_writ, "%s/ncbi/dbGaP-%u", posix, id);
+                    }
+                    if (rc == 0) {
+                        root = buffer;
+                    }
+                }
+            }
+        }
+    }
+    RELEASE(VFSManager, vmgr);
+    if (rc == 0) {
+        rc = KConfigMakeRepositoryMgrUpdate(cfg, &rmgr);
+    }
+    if (rc == 0) {
+        uint32_t result_flags = 0;
+        assert(root);
+        rc = KRepositoryMgrImportNgcObj(rmgr, ngc, root,
+            INP_CREATE_REPOSITORY, &result_flags);
+    }
+    *newRepoParentPath = root;
+    RELEASE(KNgcObj, ngc);
+    RELEASE(KRepositoryMgr, rmgr);
+    return rc;
 }
 
 rc_t CC KMain(int argc, char* argv[]) {
@@ -1111,9 +1349,12 @@ rc_t CC KMain(int argc, char* argv[]) {
     }
 
     if (rc == 0) {
-        if (prm.ngc) {
+        if (prm.modeConfigure) {
+            rc = configure(prm.configureMode);
+        }
+        else if (prm.ngc) {
             const char *newRepoParentPath = NULL;
-            rc = KConfigImportNgc(cfg, prm.ngc, NULL, &newRepoParentPath);
+            rc = ImportNgc       (cfg,&prm          , &newRepoParentPath);
             DISP_RC2(rc, "cannot import ngc file", prm.ngc);
             if (rc == 0) {
                 rc = KConfigCommit(cfg);
@@ -1125,7 +1366,7 @@ rc_t CC KMain(int argc, char* argv[]) {
                 rc_t rc = KDirectoryNativeDir(&wd);
                 if (rc == 0) {
                     rc = KDirectoryPosixStringToSystemString(wd,
-                        system, sizeof system, newRepoParentPath);
+                        system, sizeof system, "%s", newRepoParentPath);
                     if (rc == 0) {
                         newRepoParentPath = system;
                     }
@@ -1154,12 +1395,14 @@ rc_t CC KMain(int argc, char* argv[]) {
                 rc = rc3;
             }
         }
+#if 0
         if (prm.modeShowModules) {
             rc_t rc3 = ShowModules(cfg, &prm);
             if (rc3 != 0 && rc == 0) {
                 rc = rc3;
             }
         }
+#endif
         if (prm.modeShowLoadPath) {
             const char* path = NULL;
             rc_t rc3 = KConfigGetLoadPath(cfg, &path);
@@ -1174,8 +1417,9 @@ rc_t CC KMain(int argc, char* argv[]) {
         }
     }
 
-    if (prm.modeShowEnv)
-    {   ShowEnv(&prm); }
+    if (prm.modeShowEnv) {
+        ShowEnv(&prm);
+    }
 
     RELEASE(KConfig, cfg);
 
diff --git a/tools/vdb-config/vdb-config.vers b/tools/vdb-config/vdb-config.vers
index cc6c9a4..8e8299d 100644
--- a/tools/vdb-config/vdb-config.vers
+++ b/tools/vdb-config/vdb-config.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/vdb-config/vdb-config.vers.h b/tools/vdb-config/vdb-config.vers.h
new file mode 100644
index 0000000..7cf38bf
--- /dev/null
+++ b/tools/vdb-config/vdb-config.vers.h
@@ -0,0 +1 @@
+#define VDB_CONFIG_VERS 0x02040002
diff --git a/tools/vdb-config/vdb-config2.cpp b/tools/vdb-config/vdb-config2.cpp
new file mode 100644
index 0000000..e8787b4
--- /dev/null
+++ b/tools/vdb-config/vdb-config2.cpp
@@ -0,0 +1,30 @@
+/*==============================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+
+/*
+    code is now in interactive.cpp
+*/
diff --git a/tools/vdb-config/vdb-config2.h b/tools/vdb-config/vdb-config2.h
new file mode 100644
index 0000000..fc0eda6
--- /dev/null
+++ b/tools/vdb-config/vdb-config2.h
@@ -0,0 +1,29 @@
+/*==============================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+/*
+    code is now in interactive.h
+*/
diff --git a/tools/vdb-copy/.gitignore b/tools/vdb-copy/.gitignore
new file mode 100644
index 0000000..fc8361c
--- /dev/null
+++ b/tools/vdb-copy/.gitignore
@@ -0,0 +1,17 @@
+*.txt
+*.sh
+*.dump
+*.kar
+*.tar
+*.vdb
+454_FASTQ_1
+newtab
+with_rev
+temp1
+temp2
+temp4
+t1
+t2
+t3
+t5
+t6
diff --git a/tools/vdb-copy/Makefile b/tools/vdb-copy/Makefile
index 56ad7a8..7356529 100644
--- a/tools/vdb-copy/Makefile
+++ b/tools/vdb-copy/Makefile
@@ -25,7 +25,7 @@
 
 default: std
 
-TOP ?= $(shell ../../build/abspath.sh ../..)
+TOP ?= $(abspath ../..)
 MODULE = tools/vdb-copy
 
 include $(TOP)/build/Makefile.env
@@ -108,8 +108,7 @@ VDB_COPY_OBJ = \
 
 VDB_COPY_LIB = \
 	-lkapp \
-	-lncbi-wvdb \
-	-lxml2 \
+	-sncbi-wvdb \
 	-lm
 
 $(BINDIR)/vdb-copy: $(VDB_COPY_OBJ)
diff --git a/tools/vdb-copy/coldefs.c b/tools/vdb-copy/coldefs.c
index b89a2e8..ff116fb 100644
--- a/tools/vdb-copy/coldefs.c
+++ b/tools/vdb-copy/coldefs.c
@@ -161,7 +161,7 @@ rc_t col_defs_extract_from_table( col_defs* defs, const VTable *table )
                     if ( rc == 0 )
                     {
                         uint32_t temp_idx;
-                        rc_t rc1 = VCursorAddColumn( cursor, &temp_idx, name );
+                        rc_t rc1 = VCursorAddColumn( cursor, &temp_idx, "%s", name );
                         DISP_RC( rc1, "col_defs_extract_from_table:VCursorAddColumn() failed" );
                         if ( rc1 == 0 )
                         {
@@ -223,7 +223,7 @@ rc_t col_defs_add_to_rd_cursor( col_defs* defs, const VCursor *cursor, bool show
         {
             if ( col->src_cast != NULL )
             {
-                rc = VCursorAddColumn( cursor, &(col->src_idx), col->src_cast );
+                rc = VCursorAddColumn( cursor, &(col->src_idx), "%s", col->src_cast );
                 DISP_RC( rc, "col_defs_add_to_cursor:VCursorAddColumn() failed" );
                 if ( rc == 0 )
                 {
@@ -319,7 +319,7 @@ rc_t col_defs_add_to_wr_cursor( col_defs* defs, const VCursor* cursor, bool show
         if ( col != NULL )
             if ( col->to_copy && col->dst_cast != NULL )
             {
-                rc_t rc = VCursorAddColumn( cursor, &(col->dst_idx), col->dst_cast );
+                rc_t rc = VCursorAddColumn( cursor, &(col->dst_idx), "%s", col->dst_cast );
                 col->to_copy = ( rc == 0 );
                 if ( show )
                 {
@@ -413,7 +413,7 @@ static rc_t redactable_types_2_type_id_vector( const VSchema * s,
                 if ( rc == 0 )
                 {
                     VTypedecl td;
-                    rc = VSchemaResolveTypedecl ( s, &td, name );
+                    rc = VSchemaResolveTypedecl ( s, &td, "%s", name );
                     if ( rc == 0 )
                     {
                         uint32_t *id = malloc( sizeof *id );
diff --git a/tools/vdb-copy/column_match.c b/tools/vdb-copy/column_match.c
new file mode 100644
index 0000000..0e1d507
--- /dev/null
+++ b/tools/vdb-copy/column_match.c
@@ -0,0 +1,31 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+#include "column_match.h"
+
+#include <sysalloc.h>
+
+#include <stdlib.h>
+#include <string.h>
diff --git a/tools/vdb-copy/column_match.h b/tools/vdb-copy/column_match.h
new file mode 100644
index 0000000..1b4eb8b
--- /dev/null
+++ b/tools/vdb-copy/column_match.h
@@ -0,0 +1,42 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+#ifndef _h_column_match_
+#define _h_column_match_
+
+#ifndef _h_vdb_copy_includes_
+#include "vdb-copy-includes.h"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/vdb-copy/copy_context.c b/tools/vdb-copy/copy_context.c
new file mode 100644
index 0000000..992d514
--- /dev/null
+++ b/tools/vdb-copy/copy_context.c
@@ -0,0 +1,47 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+#include "copy_context.h"
+
+#include <sysalloc.h>
+#include <string.h>
+#include <stdlib.h>
+
+
+rc_t cctx_init( p_copy_ctx cctx )
+{
+    return 0;
+}
+
+
+void cctx_destroy( p_copy_ctx cctx )
+{
+    /* ********** destination stuff in reverse order... */
+    /*
+    cctx_destroy_str( &cctx->legacy_dont_copy );
+    cctx_destroy_str( &cctx->legacy_schema_file );
+    cctx_destroy_str( &cctx->dst_schema_tabname );
+    */
+}
diff --git a/tools/vdb-copy/copy_context.h b/tools/vdb-copy/copy_context.h
new file mode 100644
index 0000000..71e491a
--- /dev/null
+++ b/tools/vdb-copy/copy_context.h
@@ -0,0 +1,58 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_vdb_copy_context_
+#define _h_vdb_copy_context_
+
+#ifndef _h_vdb_copy_includes_
+#include "vdb-copy-includes.h"
+#endif
+
+#ifndef _h_definitions_
+#include "definitions.h"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* ----------------------------------------------------------------------------------- */
+typedef struct copy_ctx
+{
+    char * ptr;
+} copy_ctx;
+typedef copy_ctx* p_copy_ctx;
+
+
+rc_t cctx_init( p_copy_ctx cctx );
+void cctx_destroy( p_copy_ctx cctx );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/vdb-copy/copy_meta.c b/tools/vdb-copy/copy_meta.c
index f80feed..9ed9e30 100644
--- a/tools/vdb-copy/copy_meta.c
+++ b/tools/vdb-copy/copy_meta.c
@@ -106,14 +106,14 @@ static rc_t copy_metadata_child ( const KMDataNode *src_root, KMDataNode *dst_ro
     KMDataNode *dnode;
     KNamelist *names;
 
-    rc_t rc = KMDataNodeOpenNodeRead ( src_root, & snode, node_path );
+    rc_t rc = KMDataNodeOpenNodeRead ( src_root, & snode, "%s", node_path );
     DISP_RC( rc, "copy_metadata_child:KMDataNodeOpenNodeRead(src) failed" );
     if ( rc != 0 ) return rc;
 
     if ( show_meta )
         KOutMsg( "copy child-node: %s\n", node_path );
 
-    rc = KMDataNodeOpenNodeUpdate ( dst_root, & dnode, node_path );
+    rc = KMDataNodeOpenNodeUpdate ( dst_root, & dnode, "%s", node_path );
     DISP_RC( rc, "copy_metadata_child:KMDataNodeOpenNodeUpdate(dst) failed" );
     if ( rc == 0 )
     {
@@ -415,7 +415,7 @@ static rc_t enter_vdbcopy_node( KMetadata *dst_meta, const bool show_meta )
         if ( rc == 0 )
         {
             KMDataNode *event_node;
-            rc = KMDataNodeOpenNodeUpdate ( hist_node, &event_node, event_name );
+            rc = KMDataNodeOpenNodeUpdate ( hist_node, &event_node, "%s", event_name );
             DISP_RC( rc, "enter_vdbcopy_node:KMDataNodeOpenNodeUpdate('EVENT_NR') failed" );
             if ( rc == 0 )
             {
diff --git a/tools/vdb-copy/get_platform.c b/tools/vdb-copy/get_platform.c
index ed8ae42..7da1e43 100644
--- a/tools/vdb-copy/get_platform.c
+++ b/tools/vdb-copy/get_platform.c
@@ -1,168 +1,168 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#include "get_platform.h"
-#include <sysalloc.h>
-#include <stdlib.h> /* for malloc */
-#include <string.h> /* for memcpy */
-
-#define PLATFORM_COL "(ascii)PLATFORM"
-
-static rc_t get_platform_from_table( const VTable *my_table, char ** dst, 
-                                     const char pre_and_postfix )
-{
-    const VCursor *my_cursor;
-    rc_t rc = VTableCreateCursorRead( my_table, &my_cursor );
-    if ( rc == 0 )
-    {
-        rc = VCursorOpen( my_cursor );
-        if ( rc == 0 )
-        {
-            uint32_t col_idx;
-            rc = VCursorAddColumn( my_cursor, &col_idx, PLATFORM_COL );
-            if ( rc == 0 )
-            {
-                rc = VCursorSetRowId( my_cursor, 1 );
-                if ( rc == 0 )
-                {
-                    rc = VCursorOpenRow( my_cursor );
-                    if ( rc == 0 )
-                    {
-                        const void *src_buffer;
-                        uint32_t offset_in_bits;
-                        uint32_t element_count;
-                    
-                        rc = VCursorCellData( my_cursor, col_idx, NULL,
-                            &src_buffer, &offset_in_bits, &element_count );
-                        if ( rc == 0 )
-                        {
-                            char *src_ptr = (char*)src_buffer + ( offset_in_bits >> 3 );
-                            if ( pre_and_postfix != 0 )
-                                *dst = malloc( element_count + 3 );
-                            else
-                                *dst = malloc( element_count + 1 );
-                            if ( *dst != NULL )
-                            {
-                                if ( pre_and_postfix != 0 )
-                                {
-                                    (*dst)[ 0 ] = pre_and_postfix;
-                                    memcpy( &(*dst)[1], src_ptr, element_count );
-                                    (*dst)[ element_count + 1 ] = pre_and_postfix;
-                                    (*dst)[ element_count + 2 ] = 0;
-                                }
-                                else
-                                {
-                                    memcpy( *dst, src_ptr, element_count );
-                                    (*dst)[ element_count ] = 0;
-                                }
-                            }
-                            else
-                                rc = RC( rcExe, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
-                        }
-                        VCursorCloseRow( my_cursor );
-                    }
-                }
-            }
-        }
-        VCursorRelease( my_cursor );
-    }
-    return rc;
-}
-
-rc_t get_table_platform( const char * table_path, char ** dst, 
-                         const char pre_and_postfix )
-{
-    rc_t rc;
-    KDirectory *my_directory;
-    
-    if ( table_path == NULL || dst == 0 )
-        return RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
-    rc = KDirectoryNativeDir( &my_directory );
-    if ( rc == 0 )
-    {
-        VDBManager *my_manager;
-        rc = VDBManagerMakeUpdate ( &my_manager, my_directory );
-        if ( rc == 0 )
-        {
-            VSchema *my_schema;
-            rc = VDBManagerMakeSRASchema( my_manager, &my_schema );
-            if ( rc == 0 )
-            {
-                const VTable *my_table;
-                rc = VDBManagerOpenTableRead( my_manager, &my_table, my_schema, table_path );
-                if ( rc == 0 )
-                {
-                    rc = get_platform_from_table( my_table, dst, pre_and_postfix );
-                    VTableRelease( my_table );
-                }
-                VSchemaRelease( my_schema );
-            }
-            VDBManagerRelease( my_manager );
-        }
-        KDirectoryRelease( my_directory );
-    }
-    return rc;
-}
-
-rc_t get_db_platform( const char * db_path, const char * tab_name, 
-                      char ** dst, const char pre_and_postfix )
-{
-    rc_t rc;
-    KDirectory *my_directory;
-    
-    if ( db_path == NULL || tab_name == 0 || dst == 0 )
-        return RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
-    rc = KDirectoryNativeDir( &my_directory );
-    if ( rc == 0 )
-    {
-        VDBManager *my_manager;
-        rc = VDBManagerMakeUpdate ( &my_manager, my_directory );
-        if ( rc == 0 )
-        {
-            VSchema *my_schema;
-            rc = VDBManagerMakeSRASchema( my_manager, &my_schema );
-            if ( rc == 0 )
-            {
-                const VDatabase *my_database;
-                rc = VDBManagerOpenDBRead( my_manager, &my_database, my_schema, db_path );
-                if ( rc == 0 )
-                {
-                    const VTable *my_table;
-                    rc = VDatabaseOpenTableRead( my_database, &my_table, tab_name );
-                    if ( rc == 0 )
-                    {
-                        rc = get_platform_from_table( my_table, dst, pre_and_postfix );
-                        VTableRelease( my_table );
-                    }
-                    VDatabaseRelease( my_database );
-                }
-                VSchemaRelease( my_schema );
-            }
-            VDBManagerRelease( my_manager );
-        }
-        KDirectoryRelease( my_directory );
-    }
-    return rc;
-}
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+#include "get_platform.h"
+#include <sysalloc.h>
+#include <stdlib.h> /* for malloc */
+#include <string.h> /* for memcpy */
+
+#define PLATFORM_COL "(ascii)PLATFORM"
+
+static rc_t get_platform_from_table( const VTable *my_table, char ** dst, 
+                                     const char pre_and_postfix )
+{
+    const VCursor *my_cursor;
+    rc_t rc = VTableCreateCursorRead( my_table, &my_cursor );
+    if ( rc == 0 )
+    {
+        rc = VCursorOpen( my_cursor );
+        if ( rc == 0 )
+        {
+            uint32_t col_idx;
+            rc = VCursorAddColumn( my_cursor, &col_idx, PLATFORM_COL );
+            if ( rc == 0 )
+            {
+                rc = VCursorSetRowId( my_cursor, 1 );
+                if ( rc == 0 )
+                {
+                    rc = VCursorOpenRow( my_cursor );
+                    if ( rc == 0 )
+                    {
+                        const void *src_buffer;
+                        uint32_t offset_in_bits;
+                        uint32_t element_count;
+                    
+                        rc = VCursorCellData( my_cursor, col_idx, NULL,
+                            &src_buffer, &offset_in_bits, &element_count );
+                        if ( rc == 0 )
+                        {
+                            char *src_ptr = (char*)src_buffer + ( offset_in_bits >> 3 );
+                            if ( pre_and_postfix != 0 )
+                                *dst = malloc( element_count + 3 );
+                            else
+                                *dst = malloc( element_count + 1 );
+                            if ( *dst != NULL )
+                            {
+                                if ( pre_and_postfix != 0 )
+                                {
+                                    (*dst)[ 0 ] = pre_and_postfix;
+                                    memcpy( &(*dst)[1], src_ptr, element_count );
+                                    (*dst)[ element_count + 1 ] = pre_and_postfix;
+                                    (*dst)[ element_count + 2 ] = 0;
+                                }
+                                else
+                                {
+                                    memcpy( *dst, src_ptr, element_count );
+                                    (*dst)[ element_count ] = 0;
+                                }
+                            }
+                            else
+                                rc = RC( rcExe, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+                        }
+                        VCursorCloseRow( my_cursor );
+                    }
+                }
+            }
+        }
+        VCursorRelease( my_cursor );
+    }
+    return rc;
+}
+
+rc_t get_table_platform( const char * table_path, char ** dst, 
+                         const char pre_and_postfix )
+{
+    rc_t rc;
+    KDirectory *my_directory;
+    
+    if ( table_path == NULL || dst == 0 )
+        return RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    rc = KDirectoryNativeDir( &my_directory );
+    if ( rc == 0 )
+    {
+        VDBManager *my_manager;
+        rc = VDBManagerMakeUpdate ( &my_manager, my_directory );
+        if ( rc == 0 )
+        {
+            VSchema *my_schema;
+            rc = VDBManagerMakeSRASchema( my_manager, &my_schema );
+            if ( rc == 0 )
+            {
+                const VTable *my_table;
+                rc = VDBManagerOpenTableRead( my_manager, &my_table, my_schema, "%s", table_path );
+                if ( rc == 0 )
+                {
+                    rc = get_platform_from_table( my_table, dst, pre_and_postfix );
+                    VTableRelease( my_table );
+                }
+                VSchemaRelease( my_schema );
+            }
+            VDBManagerRelease( my_manager );
+        }
+        KDirectoryRelease( my_directory );
+    }
+    return rc;
+}
+
+rc_t get_db_platform( const char * db_path, const char * tab_name, 
+                      char ** dst, const char pre_and_postfix )
+{
+    rc_t rc;
+    KDirectory *my_directory;
+    
+    if ( db_path == NULL || tab_name == 0 || dst == 0 )
+        return RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
+    rc = KDirectoryNativeDir( &my_directory );
+    if ( rc == 0 )
+    {
+        VDBManager *my_manager;
+        rc = VDBManagerMakeUpdate ( &my_manager, my_directory );
+        if ( rc == 0 )
+        {
+            VSchema *my_schema;
+            rc = VDBManagerMakeSRASchema( my_manager, &my_schema );
+            if ( rc == 0 )
+            {
+                const VDatabase *my_database;
+                rc = VDBManagerOpenDBRead( my_manager, &my_database, my_schema, "%s", db_path );
+                if ( rc == 0 )
+                {
+                    const VTable *my_table;
+                    rc = VDatabaseOpenTableRead( my_database, &my_table, "%s", tab_name );
+                    if ( rc == 0 )
+                    {
+                        rc = get_platform_from_table( my_table, dst, pre_and_postfix );
+                        VTableRelease( my_table );
+                    }
+                    VDatabaseRelease( my_database );
+                }
+                VSchemaRelease( my_schema );
+            }
+            VDBManagerRelease( my_manager );
+        }
+        KDirectoryRelease( my_directory );
+    }
+    return rc;
+}
diff --git a/tools/vdb-copy/get_platform.h b/tools/vdb-copy/get_platform.h
index 2961f6d..17f46bf 100644
--- a/tools/vdb-copy/get_platform.h
+++ b/tools/vdb-copy/get_platform.h
@@ -1,46 +1,46 @@
-/*===========================================================================
-*
-*                            PUBLIC DOMAIN NOTICE
-*               National Center for Biotechnology Information
-*
-*  This software/database is a "United States Government Work" under the
-*  terms of the United States Copyright Act.  It was written as part of
-*  the author's official duties as a United States Government employee and
-*  thus cannot be copyrighted.  This software/database is freely available
-*  to the public for use. The National Library of Medicine and the U.S.
-*  Government have not placed any restriction on its use or reproduction.
-*
-*  Although all reasonable efforts have been taken to ensure the accuracy
-*  and reliability of the software and data, the NLM and the U.S.
-*  Government do not and cannot warrant the performance or results that
-*  may be obtained by using this software or data. The NLM and the U.S.
-*  Government disclaim all warranties, express or implied, including
-*  warranties of performance, merchantability or fitness for any particular
-*  purpose.
-*
-*  Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-*/
-#ifndef _h_get_platform_
-#define _h_get_platform_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _h_vdb_copy_includes_
-#include "vdb-copy-includes.h"
-#endif
-
-rc_t get_table_platform( const char * table_path, char ** dst,
-                         const char pre_and_postfix );
-rc_t get_db_platform( const char * db_path, const char * tab_name, 
-                      char ** dst, const char pre_and_postfix );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+#ifndef _h_get_platform_
+#define _h_get_platform_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _h_vdb_copy_includes_
+#include "vdb-copy-includes.h"
+#endif
+
+rc_t get_table_platform( const char * table_path, char ** dst,
+                         const char pre_and_postfix );
+rc_t get_db_platform( const char * db_path, const char * tab_name, 
+                      char ** dst, const char pre_and_postfix );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/vdb-copy/helper.c b/tools/vdb-copy/helper.c
index 8e40b2e..782b3ff 100644
--- a/tools/vdb-copy/helper.c
+++ b/tools/vdb-copy/helper.c
@@ -156,7 +156,7 @@ rc_t helper_parse_schema( const VDBManager *my_manager,
                 const char *s;
                 if ( KNamelistGet( schema_list, idx, &s ) == 0 )
                 {
-                    rc = VSchemaParseFile( *new_schema, s );
+                    rc = VSchemaParseFile( *new_schema, "%s", s );
                     DISP_RC( rc, "VSchemaParseFile() failed" );
                 }
             }
@@ -421,7 +421,7 @@ rc_t helper_read_cfg_str( const KConfig *cfg, const char * key,
         return RC( rcExe, rcNoTarg, rcConstructing, rcParam, rcNull );
  
     *value = NULL;
-    rc = KConfigOpenNodeRead ( cfg, &node, key );
+    rc = KConfigOpenNodeRead ( cfg, &node, "%s", key );
     /* it is OK if we do not find it, so no DISP_RC here */
     if ( rc == 0 )
     {
@@ -664,7 +664,7 @@ rc_t helper_make_config_mgr( KConfig **config_mgr, const char * path )
 
     rc_t rc = KDirectoryNativeDir( &directory );
     if ( rc != 0 ) return rc;
-    rc = KDirectoryOpenDirRead ( directory, &config_sub_dir, false, path );
+    rc = KDirectoryOpenDirRead ( directory, &config_sub_dir, false, "%s", path );
     if ( rc == 0 )
     {
         rc = KConfigMake ( config_mgr, config_sub_dir );
@@ -722,7 +722,7 @@ rc_t helper_remove_path( KDirectory * directory, const char * path )
     rc_t rc;
 
     PLOGMSG( klogInfo, ( klogInfo, "removing '$(path)'", "path=%s", path ));
-    rc = KDirectoryRemove ( directory, true, path );
+    rc = KDirectoryRemove ( directory, true, "%s", path );
     DISP_RC( rc, "vdb_copy_remove_table:KDirectoryRemove() failed" );
     return rc;
 }
diff --git a/tools/vdb-copy/type_matcher.c b/tools/vdb-copy/type_matcher.c
index 5b08bec..89d1b91 100644
--- a/tools/vdb-copy/type_matcher.c
+++ b/tools/vdb-copy/type_matcher.c
@@ -328,7 +328,7 @@ bool matcher_src_has_type( const matcher* self, const VSchema * s,
     if ( col->type_cast == NULL ) return res; /* column has no typecast */ 
 
     /* we use the destination-type-cast */
-    if ( VSchemaResolveTypedecl ( s, &td, col->type_cast->dst->name ) == 0 )
+    if ( VSchemaResolveTypedecl ( s, &td, "%s", col->type_cast->dst->name ) == 0 )
         res = match_type_with_id_vector( s, &td, id_vector );
 /*
     if ( res )
@@ -433,7 +433,7 @@ static rc_t matcher_append_type( const char *name, const bool dflt,
         rc = VectorAppend( v, NULL, t );
         if ( rc == 0 )
         {
-            rc = VSchemaResolveTypedecl( schema, &(t->type_decl), name );
+            rc = VSchemaResolveTypedecl( schema, &(t->type_decl), "%s", name );
             if ( rc == 0 )
             {
                 rc = VSchemaDescribeTypedecl( schema, &(t->type_desc), &(t->type_decl) );
@@ -766,7 +766,7 @@ rc_t matcher_execute( matcher* self, const p_matcher_input in )
     rc = helper_parse_schema( in->manager, &dflt_schema, in->add_schemas );
     if ( rc != 0 ) return rc;
 
-    rc = VDBManagerOpenTableRead( in->manager, &src_table, dflt_schema, in->src_path );
+    rc = VDBManagerOpenTableRead( in->manager, &src_table, dflt_schema, "%s", in->src_path );
     if ( rc == 0 )
     {
         const VSchema * src_schema;
@@ -777,7 +777,7 @@ rc_t matcher_execute( matcher* self, const p_matcher_input in )
             if ( rc == 0 )
             {
                 if ( in->legacy_schema != NULL )
-                    rc = VSchemaParseFile ( dflt_schema, in->legacy_schema );
+                    rc = VSchemaParseFile ( dflt_schema, "%s", in->legacy_schema );
                 if ( rc == 0 )
                 {
                     VTable * dst_table;
@@ -788,7 +788,7 @@ rc_t matcher_execute( matcher* self, const p_matcher_input in )
                         dst_schema = dflt_schema;
 
                     if ( in->force_unlock )
-                        VDBManagerUnlock ( in->manager, in->dst_path );
+                        VDBManagerUnlock ( in->manager, "%s", in->dst_path );
 
                     if ( in->force_kcmInit )
                         cmode |= kcmInit;
@@ -796,7 +796,7 @@ rc_t matcher_execute( matcher* self, const p_matcher_input in )
                         cmode |= kcmCreate;
 
                     rc = VDBManagerCreateTable( in->manager, &dst_table, 
-                                dst_schema, in->dst_tabname, cmode, in->dst_path );
+                                                dst_schema, in->dst_tabname, cmode, "%s", in->dst_path );
 
                     if ( rc == 0 )
                     {
@@ -809,7 +809,7 @@ rc_t matcher_execute( matcher* self, const p_matcher_input in )
                         }
                         VTableRelease( dst_table );
                         if ( !(in->force_kcmInit) )
-                            KDirectoryRemove ( in->dir, true, in->dst_path );
+                            KDirectoryRemove ( in->dir, true, "%s", in->dst_path );
                     }
                 }
             }
diff --git a/tools/vdb-copy/vdb-copy.c b/tools/vdb-copy/vdb-copy.c
index aea9fb7..41cd4f8 100644
--- a/tools/vdb-copy/vdb-copy.c
+++ b/tools/vdb-copy/vdb-copy.c
@@ -536,7 +536,7 @@ static rc_t vdb_copy_make_dst_table( const p_context ctx,
                          rc, "VDBManagerMakeSRASchema(dst) failed", "" ));
             }
         }
-        rc = VSchemaParseFile ( *dst_schema, ctx->legacy_schema_file );
+        rc = VSchemaParseFile ( *dst_schema, "%s", ctx->legacy_schema_file );
         if ( rc != 0 )
         {
             PLOGERR( klogInt,
@@ -555,7 +555,7 @@ static rc_t vdb_copy_make_dst_table( const p_context ctx,
     {
         rc = VDBManagerCreateTable( vdb_mgr, dst_table,
                              *dst_schema, ctx->dst_schema_tabname,
-                             cmode, ctx->dst_path );
+                                    cmode, "%s", ctx->dst_path );
         DISP_RC( rc, "vdb_copy_make_dst_table:VDBManagerCreateTable() failed" );
         if ( rc == 0 )
         {
@@ -1107,7 +1107,7 @@ static rc_t vdb_copy_db_tab( const p_context ctx,
                              const char *tab_name )
 {
     const VTable * src_tab;
-    rc_t rc = VDatabaseOpenTableRead( src_db, &src_tab, tab_name );
+    rc_t rc = VDatabaseOpenTableRead( src_db, &src_tab, "%s", tab_name );
     DISP_RC( rc, "vdb_copy_db_tab:VDatabaseOpenTableRead(src) failed" );
     if ( rc == 0 )
     {
@@ -1116,7 +1116,7 @@ static rc_t vdb_copy_db_tab( const p_context ctx,
                             ctx->force_kcmInit, ctx->md5_mode );
 
         rc = VDatabaseCreateTable ( dst_db, &dst_tab, tab_name, 
-                                    cmode, tab_name );
+                                    cmode, "%s", tab_name );
         DISP_RC( rc, "vdb_copy_db_tab:VDatabaseCreateTable(dst) failed" );
         if ( rc == 0 )
         {
@@ -1205,7 +1205,7 @@ static rc_t vdb_copy_sub_dbs( const p_context ctx,
                 {
                     const VDatabase * src_sub_db;
                     /* try to open the sub-database */
-                    rc = VDatabaseOpenDBRead ( src_db, &src_sub_db, a_name );
+                    rc = VDatabaseOpenDBRead ( src_db, &src_sub_db, "%s", a_name );
                     DISP_RC( rc, "vdb_copy_sub_dbs:VDatabaseOpenDBRead() failed" );
                     if ( rc == 0 )
                     {
@@ -1219,7 +1219,7 @@ static rc_t vdb_copy_sub_dbs( const p_context ctx,
                             if ( ctx->md5_mode == MD5_MODE_ON )
                                 cmode |= kcmMD5;
                             rc = VDatabaseCreateDB ( dst_db, &dst_sub_db,
-                                                     typespec, cmode, a_name );
+                                                     typespec, cmode, "%s", a_name );
                             DISP_RC( rc, "vdb_copy_sub_dbs:VDBManagerCreateDB( dst ) failed" );
                             if ( rc == 0 )
                             {
@@ -1297,7 +1297,7 @@ static rc_t vdb_copy_database( const p_context ctx,
             if ( ctx->md5_mode == MD5_MODE_ON )
                 cmode |= kcmMD5;
             rc = VDBManagerCreateDB ( vdb_mgr, &dst_db, schema,
-                                      typespec, cmode, ctx->dst_path );
+                                      typespec, cmode, "%s", ctx->dst_path );
             DISP_RC( rc, "vdb_copy_database:VDBManagerCreateDB( dst ) failed" );
             if ( rc == 0 )
             {
@@ -1338,7 +1338,7 @@ static rc_t vdb_copy_perform( const p_context ctx,
     {
         const VDatabase * src_db;
         /* try to open it as a database */
-        rc = VDBManagerOpenDBRead ( vdb_mgr, &src_db, dflt_schema, ctx->src_path );
+        rc = VDBManagerOpenDBRead ( vdb_mgr, &src_db, dflt_schema, "%s", ctx->src_path );
         if ( rc == 0 )
         {
             /* if it succeeds it is a database, continue to copy it */
@@ -1358,7 +1358,7 @@ static rc_t vdb_copy_perform( const p_context ctx,
             const VTable * src_table;
             /* try to open it as a table */
             rc = VDBManagerOpenTableRead( vdb_mgr, &src_table,
-                                          dflt_schema, ctx->src_path );
+                                          dflt_schema, "%s", ctx->src_path );
             /* if it succeeds it is a table, continue to copy it */
             if ( rc == 0 )
             {
diff --git a/tools/vdb-copy/vdb-copy.kfg b/tools/vdb-copy/vdb-copy.kfg
index f941d90..e2a18fb 100644
--- a/tools/vdb-copy/vdb-copy.kfg
+++ b/tools/vdb-copy/vdb-copy.kfg
@@ -26,9 +26,11 @@
 
 # ILLUMINA
 /VDBCOPY/NCBI_SRA_Illumina_tbl_v0a_1/schema = "sra/illumina.vschema"
-/VDBCOPY/NCBI_SRA_Illumina_tbl_v0a_1/tab = "NCBI:SRA:Illumina:tbl:v2"
+#/VDBCOPY/NCBI_SRA_Illumina_tbl_v0a_1/tab = "NCBI:SRA:Illumina:tbl:q4:v2"
+#/VDBCOPY/NCBI_SRA_Illumina_tbl_v0a_1/tab = "NCBI:SRA:Illumina:tbl:q1:v2"
+/VDBCOPY/NCBI_SRA_Illumina_tbl_v0a_1/tab = "NCBI:SRA:Illumina:tbl:phred:v2"
 /VDBCOPY/_ILLUMINA_/schema = "sra/illumina.vschema"
-/VDBCOPY/_ILLUMINA_/tab = "NCBI:SRA:Illumina:tbl:v2"
+/VDBCOPY/_ILLUMINA_/tab = "NCBI:SRA:Illumina:tbl:phred:v2"
 
 
 # _454_
@@ -89,4 +91,4 @@
 /VDBCOPY/DO_NOT_REDACT = "CS_KEY,FLOW_CHARS,KEY_SEQUENCE,LINKER_SEQUENCE"
 
 # what root-nodes not to copy while copying metadata
-/VDBCOPY/META/IGNORE = "col,.seq,STATS"
+/VDBCOPY/META/IGNORE = "col,.seq,STATS,BASE_COUNT,HUFFMAN_TREE_POS,HUFFMAN_TREE_POS_SIZE,HUFFMAN_TREE_PRB,HUFFMAN_TREE_PRB_SIZE,HUFFMAN_TREE_SIG,HUFFMAN_TREE_SIG_SIZE,MSC454_CLIP_QUALITY_LEFT,MSC454_CLIP_QUALITY_RIGHT,MSC454_FLOW_CHARS,MSC454_KEY_SEQUENCE,NREADS,NUMBER_POS_CHANNELS,NUMBER_PRB_CHANNELS_1,NUMBER_PRB_COLUMNS,NUMBER_SIG_CHANNELS,PLATFORM,READ_0,READ_1,SPOT_COUNT"
diff --git a/tools/vdb-copy/vdb-copy.vers b/tools/vdb-copy/vdb-copy.vers
index cc6c9a4..8e8299d 100644
--- a/tools/vdb-copy/vdb-copy.vers
+++ b/tools/vdb-copy/vdb-copy.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/vdb-copy/vdb-copy.vers.h b/tools/vdb-copy/vdb-copy.vers.h
new file mode 100644
index 0000000..a5a0f15
--- /dev/null
+++ b/tools/vdb-copy/vdb-copy.vers.h
@@ -0,0 +1 @@
+#define VDB_COPY_VERS 0x02040002
diff --git a/tools/vdb-decrypt/Makefile b/tools/vdb-decrypt/Makefile
index 85c41e3..e6edd79 100644
--- a/tools/vdb-decrypt/Makefile
+++ b/tools/vdb-decrypt/Makefile
@@ -27,7 +27,7 @@ default: std
 
 USE_GCC_IF_ICC = 1
 
-TOP ?= $(shell ../../build/abspath.sh ../..)
+TOP ?= $(abspath ../..)
 MODULE = tools/vdb-decrypt
 
 include $(TOP)/build/Makefile.env
@@ -92,7 +92,7 @@ VDB_DECRYPT_OBJ = \
 
 VDB_DECRYPT_LIB = \
 	-lkapp \
-	-lncbi-vdb
+	-sncbi-vdb
 
 $(BINDIR)/vdb-decrypt: $(VDB_DECRYPT_OBJ)
 	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(VDB_DECRYPT_LIB)
@@ -111,7 +111,7 @@ VDB_ENCRYPT_OBJ = \
 
 VDB_ENCRYPT_LIB = \
 	-lkapp \
-	-lncbi-vdb
+	-sncbi-vdb
 
 $(BINDIR)/vdb-encrypt: $(VDB_ENCRYPT_OBJ)
 	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(VDB_ENCRYPT_LIB)
diff --git a/tools/vdb-decrypt/shared.c b/tools/vdb-decrypt/shared.c
index de41eaf..b74e0a0 100644
--- a/tools/vdb-decrypt/shared.c
+++ b/tools/vdb-decrypt/shared.c
@@ -283,7 +283,7 @@ ArcScheme ArchiveTypeCheck (const KFile * f)
  * return rc_t = 0 for success
  * return rc_t != 0 for failure
  */
-rc_t CopyFile (const KFile * src, KFile * dst, const char * source, const char * dest)
+rc_t CopyKFile (const KFile * src, KFile * dst, const char * source, const char * dest)
 {
     rc_t rc;
     uint8_t	buff	[256 * 1024];
@@ -403,7 +403,7 @@ bool IsTmpFile (const char * path)
     return (strcmp (pc, TmpLockExt) == 0);
 }
 
-
+#if 0
 static
 bool IsCacheFile (const char * path)
 {
@@ -422,7 +422,7 @@ bool IsCacheFile (const char * path)
 
     return (strcmp (pc, CacheLockExt) == 0);
 }
-
+#endif
 
 static
 rc_t FileInPlace (KDirectory * cwd, const char * leaf, bool try_rename)
@@ -461,7 +461,7 @@ rc_t FileInPlace (KDirectory * cwd, const char * leaf, bool try_rename)
             uint32_t kcm;
 
             kcm = kcmCreate|kcmParents;
-            kpt = KDirectoryPathType (cwd, temp);
+            kpt = KDirectoryPathType (cwd, "%s", temp);
             if (kpt != kptNotFound)
             {
                 /* log busy */
@@ -536,7 +536,7 @@ rc_t FileInPlace (KDirectory * cwd, const char * leaf, bool try_rename)
 
                                 rc = KDirectoryCreateExclusiveAccessFile (cwd, &outfile,
                                                                           false, 0600, kcm,
-                                                                          temp);
+                                                                          "%s", temp);
                                 if (rc == 0)
                                 {
                                     const KFile * Infile;
@@ -548,7 +548,7 @@ rc_t FileInPlace (KDirectory * cwd, const char * leaf, bool try_rename)
                                     {
                                         STSMSG (1, ("copying %s to %s", leaf, temp));
 
-                                        rc = CopyFile (Infile, Outfile, leaf, temp);
+                                        rc = CopyKFile (Infile, Outfile, leaf, temp);
 
                                         if (rc == 0)
                                         {
@@ -712,7 +712,7 @@ rc_t FileToFile (const KDirectory * sd, const char * source,
                             rc = CryptFile (infile, &Infile, outfile, &Outfile, scheme);
                             if (rc == 0)
                             {
-                                rc = CopyFile (Infile, Outfile, source, dest);
+                                rc = CopyKFile (Infile, Outfile, source, dest);
                                 if (rc == 0)
                                 {
                                     if (UseStdin || UseStdout)
@@ -774,7 +774,7 @@ rc_t DoDir (const KDirectory * sd, KDirectory * dd)
                     KDirectory * ndd;
                     KPathType kpt;
 
-                    kpt = KDirectoryPathType (sd, name);
+                    kpt = KDirectoryPathType (sd, "%s", name);
 
                     switch (kpt)
                     {
@@ -805,7 +805,7 @@ rc_t DoDir (const KDirectory * sd, KDirectory * dd)
                         }
                         else
                         {
-                            rc = KDirectoryOpenDirRead (sd, &nsd, false, name);
+                            rc = KDirectoryOpenDirRead (sd, &nsd, false, "%s", name);
                             if (rc)
                                 ;
                             else
@@ -912,7 +912,7 @@ rc_t Start (KDirectory * cwd, const char * src, const char * dst)
         return rc;
     }
 
-    stype = KDirectoryPathType (cwd, spath);
+    stype = KDirectoryPathType (cwd, "%s", spath);
 
     switch (stype)
     {
@@ -974,7 +974,7 @@ rc_t Start (KDirectory * cwd, const char * src, const char * dst)
             else
             {
                 *pc++ = '\0';
-                rc = KDirectoryOpenDirUpdate (cwd, &ndir, false, spath);
+                rc = KDirectoryOpenDirUpdate (cwd, &ndir, false, "%s", spath);
             }
 
             if (rc == 0)
@@ -990,7 +990,7 @@ rc_t Start (KDirectory * cwd, const char * src, const char * dst)
         {
             KDirectory * ndir;
 
-            rc = KDirectoryOpenDirUpdate (cwd, &ndir, false, spath);
+            rc = KDirectoryOpenDirUpdate (cwd, &ndir, false, "%s", spath);
             if (rc)
                 ;
             else
@@ -1024,7 +1024,7 @@ rc_t Start (KDirectory * cwd, const char * src, const char * dst)
             LOGERR (klogErr, rc, "can't resolve destination");
             return rc;
         }
-        dtype = KDirectoryPathType (cwd, dpath);
+        dtype = KDirectoryPathType (cwd, "%s", dpath);
         switch (dtype)
         {
         default:
@@ -1085,7 +1085,7 @@ rc_t Start (KDirectory * cwd, const char * src, const char * dst)
                 const KDirectory * sdir;
                 KDirectory * ddir;
 
-                rc = KDirectoryOpenDirRead (cwd, &sdir, false, spath);
+                rc = KDirectoryOpenDirRead (cwd, &sdir, false, "%s", spath);
                 if (rc)
                     ;
                 else
@@ -1098,7 +1098,7 @@ rc_t Start (KDirectory * cwd, const char * src, const char * dst)
                     }
                     if (rc == 0)
                     {
-                        rc = KDirectoryOpenDirUpdate (cwd, &ddir, false, dpath);
+                        rc = KDirectoryOpenDirUpdate (cwd, &ddir, false, "%s", dpath);
                         if (rc)
                             ;
                         else
@@ -1134,7 +1134,7 @@ rc_t Start (KDirectory * cwd, const char * src, const char * dst)
                 {
 
                     STSMSG (1, ("opening output directory %s", dpath));
-                    rc = KDirectoryOpenDirUpdate (cwd, &ndir, false, dpath);
+                    rc = KDirectoryOpenDirUpdate (cwd, &ndir, false, "%s", dpath);
                     if (rc)
                         ;
                     else
diff --git a/tools/vdb-decrypt/vdb-decrypt.vers b/tools/vdb-decrypt/vdb-decrypt.vers
index cc6c9a4..8e8299d 100644
--- a/tools/vdb-decrypt/vdb-decrypt.vers
+++ b/tools/vdb-decrypt/vdb-decrypt.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/vdb-decrypt/vdb-decrypt.vers.h b/tools/vdb-decrypt/vdb-decrypt.vers.h
new file mode 100644
index 0000000..8cf32dc
--- /dev/null
+++ b/tools/vdb-decrypt/vdb-decrypt.vers.h
@@ -0,0 +1 @@
+#define VDB_DECRYPT_VERS 0x02040002
diff --git a/tools/vdb-decrypt/vdb-encrypt.c b/tools/vdb-decrypt/vdb-encrypt.c
index 6405294..040563e 100644
--- a/tools/vdb-decrypt/vdb-encrypt.c
+++ b/tools/vdb-decrypt/vdb-encrypt.c
@@ -66,9 +66,7 @@ OptDef Options[] =
     { OPTION_FORCE,   ALIAS_FORCE,   NULL, ForceUsage,   0, false, false }
 };
 
-
-static 
-bool DecryptSraFlag = false;
+/* static bool DecryptSraFlag = false; */
 
 const bool Decrypting = false;
 
diff --git a/tools/vdb-decrypt/vdb-encrypt.vers b/tools/vdb-decrypt/vdb-encrypt.vers
index cc6c9a4..8e8299d 100644
--- a/tools/vdb-decrypt/vdb-encrypt.vers
+++ b/tools/vdb-decrypt/vdb-encrypt.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/vdb-decrypt/vdb-encrypt.vers.h b/tools/vdb-decrypt/vdb-encrypt.vers.h
new file mode 100644
index 0000000..c0446ba
--- /dev/null
+++ b/tools/vdb-decrypt/vdb-encrypt.vers.h
@@ -0,0 +1 @@
+#define VDB_ENCRYPT_VERS 0x02040002
diff --git a/tools/vdb-dump/.gitignore b/tools/vdb-dump/.gitignore
new file mode 100644
index 0000000..1ec835e
--- /dev/null
+++ b/tools/vdb-dump/.gitignore
@@ -0,0 +1,2 @@
+test3
+vdbdump
diff --git a/tools/vdb-dump/Makefile b/tools/vdb-dump/Makefile
index 145ada3..0922e99 100644
--- a/tools/vdb-dump/Makefile
+++ b/tools/vdb-dump/Makefile
@@ -25,7 +25,7 @@
 
 default: std
 
-TOP ?= $(shell ../../build/abspath.sh ../..)
+TOP ?= $(abspath ../..)
 MODULE = tools/vdb-dump
 
 include $(TOP)/build/Makefile.env
@@ -95,16 +95,18 @@ VDB_DUMP_SRC = \
 	vdb-dump-formats \
 	vdb-dump-redir \
 	vdb-dump-fastq \
+	vdb-dump-bin \
+	vdb_info \
 	vdb-dump
 
 VDB_DUMP_OBJ = \
 	$(addsuffix .$(OBJX),$(VDB_DUMP_SRC))
 
 VDB_DUMP_LIB = \
-	-lkapp \
-	-lncbi-vdb \
-	-lxml2 \
+	-skapp \
+	-sncbi-vdb \
 	-lm
 
 $(BINDIR)/vdb-dump: $(VDB_DUMP_OBJ)
 	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(VDB_DUMP_LIB)
+
diff --git a/tools/vdb-dump/help.txt b/tools/vdb-dump/help.txt
new file mode 100644
index 0000000..f40e468
--- /dev/null
+++ b/tools/vdb-dump/help.txt
@@ -0,0 +1,272 @@
+vdb-dump extended help
+
+(1) dumping a vdb-table:
+
+the only mandatory option to vdb-dump is the name of the object to dump:
+
+vdb-dump object
+
+the object can be:
+
+a) absolute or relative path to a vdb-table (a directory)
+
+on linux:
+vdb-dump /panfs/traces/sra0/SRR/000000/SRR000001
+or
+vdb-dump `srapath SRR000001`
+(only at NCBI, same infrastructure as for a accession needed )
+
+on windows
+vdb-dump \\panfs\traces\sra0\SRR\000000\SRR000001
+or
+vdb-dump Y:\sra0\SRR\000000\SRR000001
+(if "\\panfs\traces" is mapped to the driveletter Y on your windows-pc )
+
+b) absolute or relative path to a file containing a vdb-table
+on linux/windows:
+vdb-dump SRR044989.lite.sra
+
+c) an accession ( only at NCBI )
+on linux/windows:
+vdb-dump SRR000001
+(you need: for linux libsra-path.lib / for windows libsra-path.dll in your search-path,
+a subdir "ncbi" in the same directory where the lib/dll is located,
+in this "ncbi"-subdir you need a config-file "config.kfg"
+in this config-file you need servers and volumes to be defined )
+
+If you specify only the object, vdb-dump will dump all columns for all rows to the standard-output.
+
+The --table / -T option:
+This is for future extensions. Vdb-dump is designed to operate on a vdb-database. A vdb-database can
+contain more then one table. Right now it contains only one table. If you do not specify the table-name,
+vdb-dump will first try to interpret the given object as a vdb-database (and try to dump the first table
+it finds in this database). If this try (silently) fails, because the given object is not a database,
+it is a table instead, vdb-dump will try to interpret the given object as a table.
+That is what happens right now when you use vdb-dump.
+
+The --rows / -R option:
+With this option you can restrict which rows will be dumped.
+vdb-dump file.sra -R 5  ... will dump only row number 5
+vdb-dump file.sra -R 5-20 ... will dump rows number 5 to number 20 (15 rows)
+The ranges can be mixed:
+vdb-dump file.sra -R 5,7-20,200-201,300,305  ... will dump these rows/ranges
+
+The --columns -C option:
+With this option you can restrict which columns per row will be dumped.
+vdb-dump file.sra -C NAME,READ ... will dump only the columns NAME and READ per row
+
+the --exclude -x option:
+If you want to dump all columns, except some specific ones.
+vdb-dump file.sra -x READ,RD_FILTER ... will dump all columns but the READ-column
+and the RD_FILTER-column.
+
+The --schema -S option:
+With this option you can specify one or more additional schema's to be used for dumping
+a table. For instance to reinterpret the content of columns in a new way.
+
+The --row_id_on -I option:
+Vdb-dump does not output the row-id per default, it has to be switched on with this option:
+
+vdb-dump SRR000001 -R1 -CNAME,SPOT_LEN
+    NAME: EM7LVYS01C1LWG
+SPOT_LEN: 255
+
+vdb-dump SRR000001 -R1 -CNAME,SPOT_LEN -I
+ROW-ID = 1
+    NAME: EM7LVYS01C1LWG
+SPOT_LEN: 255
+
+The --line_feed -l option:
+Vdb-dump separates the rows by one empty line (line-feed) per default:
+
+vdb-dump SRR000001 -R1-3 -CNAME,SPOT_LEN   
+    NAME: EM7LVYS01C1LWG
+SPOT_LEN: 255
+
+    NAME: EM7LVYS01B2EMP
+SPOT_LEN: 248
+
+    NAME: EM7LVYS01C2YO0
+SPOT_LEN: 307
+
+with this option you can change that:
+
+vdb-dump SRR000001 -R1-3 -CNAME,SPOT_LEN -l2
+    NAME: EM7LVYS01C1LWG
+SPOT_LEN: 255
+
+
+    NAME: EM7LVYS01B2EMP
+SPOT_LEN: 248
+
+
+    NAME: EM7LVYS01C2YO0
+SPOT_LEN: 307
+
+
+The --colname_off -N option:
+Vdb-dump prints the name of every column in front of the it's data:
+
+vdb-dump SRR000001 -R1-2 -CNAME,SPOT_LEN
+    NAME: EM7LVYS01C1LWG
+SPOT_LEN: 255
+
+    NAME: EM7LVYS01B2EMP
+SPOT_LEN: 248
+
+With this option it prints only the data:
+
+vdb-dump SRR000001 -R1-2 -CNAME,SPOT_LEN -N 
+EM7LVYS01C1LWG
+255
+
+EM7LVYS01B2EMP
+248
+
+The --in_hex -X option:
+With this option all numeric outputs are printed as hexadecimal numbers:
+
+$vdb-dump SRR000001 -R1-2 -CNAME,SPOT_LEN -X
+    NAME: EM7LVYS01C1LWG
+SPOT_LEN: 0xFF
+
+    NAME: EM7LVYS01B2EMP
+SPOT_LEN: 0xF8
+
+The --dna_baese -D option:
+With this option you can force columns into printed as DNA-base "ACGT",
+but only if the column has a datatype with more than one dimension.
+If a column has a datatype with a dimension of 2, each dimension 1 bit,
+it is automatically printed as DNA-base.
+
+The --max_length -M option:
+With this options you can truncate the output of columns longer than this limit.
+
+vdb-dump SRR000001 -R1-2 -CREAD
+READ: TCAGGGGGGAGCTTAAATTTGAAACTAGAAAAATTTTGAACAAAATAATCATAATTGTTAGCTGATGAAAAACTAGAAAAGATTTTCTGAGTGTTGGAACCGAAAGGGTTTGAATTCAAACCCTTTCGGTTCCAACGGTATCCCGTAGTGTGCATTCATCCCTGCTCTGGATACAGTCAGCTCCCAAATTCCATAAACAACTCCTTTGTAAGTAACCTCCTTTTGACAGGGGGTACTGAGCGGGCTGGCAAGGCN
+
+READ: TCAGGGGGGGGTTACACGTGCAGATTTGTTACACGGGTGTACTGTGAGGTTTGGGGTACGAATGATCCCGTTACCTAGATAGTGAGCATGGAACCCGTTGGAACCGAAAGGGTTTGAATTCAAACCCTTTCGGTTCCAACAATGTGCAGGGCTCAGGTCAGCATTAGGGTCAGGTTCTTAGGAAAAGAAAGAGCAAAAACAATGAAACACAATACAAAGTAAAGAACACTGAGCGGGCTGGCAAGGCN
+
+vdb-dump SRR000001 -R1-2 -CREAD -M40
+READ: TCAGGGGGGAGCTTAAATTTGAAACTAGAA ...
+
+READ: TCAGGGGGGGGTTACACGTGCAGATTTGTT ...
+
+The --indent_with -i option:
+With this option you can limit the length of the output-line and force a left-edge
+indenting.
+
+vdb-dump $vdb-dump SRR000001 -R1-2 -CREAD -i80
+READ: TCAGGGGGGAGCTTAAATTTGAAACTAGAAAAATTTTGAACAAAATAATCATAATTGTTAGCTGATGAAAAACT
+      AGAAAAGATTTTCTGAGTGTTGGAACCGAAAGGGTTTGAATTCAAACCCTTTCGGTTCCAACGGTATCCCGTAG
+      TGTGCATTCATCCCTGCTCTGGATACAGTCAGCTCCCAAATTCCATAAACAACTCCTTTGTAAGTAACCTCCTT
+      TTGACAGGGGGTACTGAGCGGGCTGGCAAGGCN
+
+READ: TCAGGGGGGGGTTACACGTGCAGATTTGTTACACGGGTGTACTGTGAGGTTTGGGGTACGAATGATCCCGTTAC
+      CTAGATAGTGAGCATGGAACCCGTTGGAACCGAAAGGGTTTGAATTCAAACCCTTTCGGTTCCAACAATGTGCA
+      GGGCTCAGGTCAGCATTAGGGTCAGGTTCTTAGGAAAAGAAAGAGCAAAAACAATGAAACACAATACAAAGTAA
+      AGAACACTGAGCGGGCTGGCAAGGCN
+
+The --filter -F option:
+Not implemented yet.
+
+The --format -f option:
+This selects other than the default-output formating:
+
+csv = comma-separated on one line
+vdb-dump SRR000001 -R1-2 -CNAME,SPOT_LEN -fcsv
+EM7LVYS01C1LWG,255
+EM7LVYS01B2EMP,248
+
+xml = xml-section
+vdb-dump $vdb-dump SRR000001 -R1-2 -CNAME,SPOT_LEN -fxml
+<row_1>
+ <NAME>
+EM7LVYS01C1LWG
+ </NAME>
+ <SPOT_LEN>
+255
+ </SPOT_LEN>
+</row_1>
+
+<row_2>
+ <NAME>
+EM7LVYS01B2EMP
+ </NAME>
+ <SPOT_LEN>
+248
+ </SPOT_LEN>
+</row_2>
+
+json = json format
+vdb-dump $vdb-dump SRR000001 -R1-2 -CNAME,SPOT_LEN -fjson
+{
+"row_id": 1,
+"NAME":"EM7LVYS01C1LWG",
+"SPOT_LEN":255
+},
+
+{
+"row_id": 2,
+"NAME":"EM7LVYS01B2EMP",
+"SPOT_LEN":248
+},
+
+The --without_sra -n option:
+With this option you can switch off the special treatment (translation) of certain column-types
+
+vdb-dump SRR000001 -R1 -C SPOT_DESC,PLATFORM
+SPOT_DESC: spot_len=255, fixed_len=0, signal_len=400, clip_qual_right=235, num_reads=4
+ PLATFORM: SRA_PLATFORM_454
+
+vdb-dump SRR000001 -R1 -C SPOT_DESC,PLATFORM -n
+SPOT_DESC: [255, 0, 0, 0, 144, 1, 235, 0, 4, 0, 0, 0, 0, 0, 0, 0]
+ PLATFORM: 1
+
+The --no_accession -a option:
+With this option you can switch off the test if a given object is a sra-accession.
+It can speed up executing the tool.
+
+(2) printing other informations about a table:
+
+The --schema_dump -A option:
+With this option you can use vdb-dump to print the schema of a table instead of it's content.
+
+vdb-dump SRR000001 -A
+
+The --table_enum -E option:
+For future use: if the object is a vdb-database, enumerate the tables it contains.
+
+The --version -V option:
+Print the version of the vdb-manager used by vdb-dump.
+
+vdb-dump -V
+vdb-dump: 1.0.0
+
+The column_enum -O option:
+Enumerates the columns and the types of columns of a table.
+
+vdb-dump SRR000001 -O
+/panfs/traces01/sra0/SRR/000000/SRR000001.01 : (032 bits [01],      Int)  CLIP_QUALITY_LEFT
+      (INSDC:coord:one)
+   CLIP_QUALITY_LEFT.type[0] = INSDC:coord:one (dflt)
+   CLIP_QUALITY_LEFT.type[1] = U16
+   CLIP_QUALITY_LEFT.type[2] = INSDC:coord:zero
+
+/panfs/traces01/sra0/SRR/000000/SRR000001.02 : (032 bits [01],      Int)  CLIP_QUALITY_RIGHT
+      (INSDC:coord:one)
+  CLIP_QUALITY_RIGHT.type[0] = INSDC:coord:one (dflt)
+  CLIP_QUALITY_RIGHT.type[1] = U16
+  CLIP_QUALITY_RIGHT.type[2] = INSDC:coord:zero
+
+/panfs/traces01/sra0/SRR/000000/SRR000001.03 : (008 bits [01],     Uint)  COLOR_MATRIX
+      (U8)
+        COLOR_MATRIX.type[0] = U8 (dflt)
+
+etc.
+
+The --id_range -r option:
+Print the row-range that a table contains.
+
+vdb-dump SRR000001 -r
+id-range: first-row = 1, row-count = 470985
diff --git a/tools/vdb-dump/vdb-boot.c b/tools/vdb-dump/vdb-boot.c
new file mode 100644
index 0000000..9f86e42
--- /dev/null
+++ b/tools/vdb-dump/vdb-boot.c
@@ -0,0 +1,448 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <vdb/manager.h>
+#include <vdb/schema.h>
+#include <vdb/table.h>
+#include <vdb/cursor.h>
+#include <vdb/database.h>
+#include <kfs/directory.h>
+#include <kfs/file.h>
+#include <kapp/main.h>
+#include <kapp/args.h>
+#include <klib/container.h>
+#include <klib/vector.h>
+#include <klib/log.h>
+#include <klib/rc.h>
+#include <fmtdef.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+#define WITH_DNA
+
+/********************************************************************
+write procedure:
+(1)....KDirectoryNativeDir           ... make a root directory
+(2)....KDirectoryOpenDirUpdate       ... chroot to specific directory
+(3)....VDBManagerMakeUpdate          ... make manager for update
+(4)....VDBManagerMakeSchema          ... make schema
+(5)....VSchemaParseFile              ... load a schema from file
+(6)....VDBManagerCreateDB            ... let the manager create a DB
+(7)....VDatabaseCreateTable          ... create a Table for the DB
+(8)....VTableCreateCursorWrite       ... create a writable cursor
+(9)....VCursorAddColumn              ... add the column to write
+(10)...VCursorOpen                   ... open the cursor
+-----LOOP-----
+ (11)....VCursorOpenRow              ... open the row
+ (12)....VCursorWrite                ... write the data
+ (13)....VCursorCommitRow            ... commit the row
+ (14)....VCursorCloseRow             ... close the row
+-----END LOOP-----
+(15)...VCursorCommit                 ... commit the cursor
+(16)...VCursorRelease                ... destroy the cursor
+(17)...VTableRelease                 ... destroy the table
+(18)...VDatabaseRelease              ... destroy the database
+(19)...VSchemaRelease                ... destroy the schema
+(20)...VDBManagerRelease             ... destroy the manager
+(21)...KDirectoryRelease             ... destroy the chroot'ed dir
+(22)...KDirectoryRelease             ... destroy the root dir
+********************************************************************/
+
+
+/********************************************************************
+helper function needed by schema-dump
+********************************************************************/
+static
+rc_t CC flush ( void *dst, const void *buffer, size_t bsize )
+{
+    FILE *f = dst;
+    fwrite ( buffer, 1, bsize, f );
+    return 0;
+}
+
+/********************************************************************
+helper function to display failure or success message
+********************************************************************/
+static
+void display_rescode( const rc_t res, const char* failure, const char* success )
+{
+    if ( res != 0 )
+    {
+        if ( failure )
+            LOGERR( klogInt, res, failure );
+    }
+    else
+    {
+        if ( success )
+            LOGMSG( klogInfo, success );
+    }
+}
+
+/********************************************************************
+helper function to display the manager version
+********************************************************************/
+static
+rc_t show_manager_version( VDBManager *my_manager )
+{
+    uint32_t version;
+    rc_t res = VDBManagerVersion( my_manager, &version );
+    if ( res != 0 )
+    {
+        LOGERR ( klogInt, res, "failed to determine vdb mgr version" );
+    }
+    else
+    {
+        PLOGMSG ( klogInfo, ( klogInfo, "manager-version = $(maj).$(min).$(rel)",
+                  "vers=0x%X,maj=%u,min=%u,rel=%u"
+                              , version
+                              , version >> 24
+                              , ( version >> 16 ) & 0xFF
+                              , version & 0xFFFF ));
+    }
+    return res;
+}
+
+/* write context */
+typedef struct write_ctx
+{
+    uint32_t idx_line;
+    uint32_t idx_line_nr;
+    uint32_t idx_dna;
+    uint32_t idx_quality;
+    uint32_t line_nr;
+    void *buffer;
+    uint32_t count;
+} write_ctx;
+typedef write_ctx* p_write_ctx;
+
+p_write_ctx make_write_ctx( void )
+{
+    return calloc( 1, sizeof( write_ctx ) );
+}
+
+/********************************************************************
+helper function to write one data-cunk into one new row
+********************************************************************/
+static
+rc_t write_data_row( VCursor *my_cursor, p_write_ctx ctx )
+{
+    rc_t res = VCursorOpenRow( my_cursor );
+    /* display_rescode( res, "failed to open row", "row opened" ); */
+    if ( res == 0 )
+    {
+        /* write the ascii-line*/
+        res = VCursorWrite( my_cursor, ctx->idx_line, 8, ctx->buffer, 0, ctx->count );
+        display_rescode( res, "failed to write ascii-line", NULL );
+
+        /* write the line-number (zero-based) */
+        res = VCursorWrite( my_cursor, ctx->idx_line_nr, 32, &(ctx->line_nr), 0, 1 );
+        display_rescode( res, "failed to write line-nr", NULL );
+
+#ifdef WITH_DNA
+        /* write the ascii-line interpreted as dna-data */
+        res = VCursorWrite( my_cursor, ctx->idx_dna, 2, ctx->buffer, 0, ctx->count << 2 );
+        display_rescode( res, "failed to write dna-data", NULL );
+#endif
+
+        /* write the ascii-line interpreted as quality (array of 4 byte) */
+        res = VCursorWrite( my_cursor, ctx->idx_quality, 32, ctx->buffer, 0, ctx->count >> 2 );
+        display_rescode( res, "failed to write quality", NULL );
+        
+        res = VCursorCommitRow( my_cursor );
+        display_rescode( res, "failed to commit row", NULL );
+
+        res = VCursorCloseRow( my_cursor );
+    }
+    return res;
+}
+
+#define BUFLEN 120
+
+/********************************************************************
+reads the data-src-file in chunks and writes it with "write_data_chunk"
+********************************************************************/
+static
+rc_t write_data_loop( VCursor *my_cursor, p_write_ctx ctx, const KFile *data_src )
+{
+    char buf[ BUFLEN ];
+    char* read_dest = buf;
+    uint64_t file_pos = 0;
+    size_t num_to_read = BUFLEN - 1;
+    size_t num_read;
+    size_t chars_in_buf = 0;
+    size_t written = 0;
+    rc_t res;
+
+    ctx->line_nr = 0;
+    ctx->buffer = buf;
+    do {
+        res = KFileRead( data_src, file_pos, read_dest, num_to_read, &num_read );
+        if ( res != 0 )
+        {
+            LOGERR ( klogInt, res, "failed to read form KFile" );
+            num_read = 0;
+        }
+        else
+        {
+            if ( num_read > 0 )
+            {
+                char* lf;
+                chars_in_buf+=num_read;
+                file_pos+=num_read;
+                do {
+                    buf[chars_in_buf] = 0;
+                    lf = strchr( buf, 0x0A );
+                    if ( lf != NULL )
+                    {
+                        ctx->count = ( lf - buf );
+                        res = write_data_row( my_cursor, ctx );
+                        if ( res == 0 )
+                        {
+                            ctx->line_nr++;
+                            written += ctx->count;
+                            chars_in_buf -= ( ctx->count + 1 );
+                            memmove( buf, ++lf, chars_in_buf );
+                        }
+                        else
+                        {
+                            num_read = 0; /* terminates the outer do-loop */
+                        }
+                    }
+                } while ( ( lf != NULL )&&( num_read > 0 ) );
+                read_dest = buf + chars_in_buf;
+                num_to_read = BUFLEN - ( chars_in_buf + 1 );
+            }
+        }
+    } while ( num_read > 0 );
+
+    PLOGMSG ( klogInfo, ( klogInfo, "written $(n_lines) lines = $(n_bytes) bytes",
+                          "n_lines=%lu,n_bytes=%lu", ctx->line_nr, written ));
+    if ( ctx->line_nr > 0 )
+    {
+        res = VCursorCommit( my_cursor );
+        display_rescode( res, "failed to commit cursor", NULL );
+    }
+    return res;
+}
+
+
+/********************************************************************
+creates a writable cursor, adds 1 column, opens cursor and calls the write-loop
+********************************************************************/
+static
+rc_t create_cursor_and_write( VTable *my_table, const KFile *data_src  )
+{
+    VCursor *my_cursor;
+    p_write_ctx ctx = make_write_ctx();
+    uint32_t open_cols = 0, should_open = 0;
+    
+    rc_t res = VTableCreateCursorWrite( my_table, &my_cursor, kcmInsert );
+    display_rescode( res, "failed to create write-cursor", NULL );
+    if ( res == 0 )
+    {
+        res = VCursorAddColumn( my_cursor, &ctx->idx_line, "LINE" );
+        display_rescode( res, "failed to add LINE-column", NULL );
+        if ( res == 0 ) open_cols++;
+        should_open++;
+        
+        res = VCursorAddColumn( my_cursor, &ctx->idx_line_nr, "LINE_NR" );
+        display_rescode( res, "failed to add LINE_NR-column", NULL );
+        if ( res == 0 ) open_cols++;
+        should_open++;
+        
+#ifdef WITH_DNA
+        res = VCursorAddColumn( my_cursor, &ctx->idx_dna, "READ" );
+        display_rescode( res, "failed to add READ-column", NULL );
+        if ( res == 0 ) open_cols++;
+        should_open++;        
+#endif
+
+        res = VCursorAddColumn( my_cursor, &ctx->idx_quality, "QUALITY" );
+        display_rescode( res, "failed to add QUALITY-column", NULL );
+        if ( res == 0 ) open_cols++;        
+        should_open++;
+
+        if ( open_cols == should_open )
+        {
+            res = VCursorOpen( my_cursor );
+            display_rescode( res, "failed to open cursor", NULL );
+            if ( res == 0 )
+            {
+                res = write_data_loop( my_cursor, ctx, data_src );
+            }
+        }
+        res = VCursorRelease( my_cursor );
+    }
+    free( ctx );
+    return res;
+}
+
+/********************************************************************
+let the manager create a database with a schema, calls cursor-creation and write
+********************************************************************/
+static
+rc_t create_dababase_from_schema( VDBManager *my_manager, VSchema *my_schema, 
+                                  const char* db_path, const KFile *data_src  )
+{
+    VDatabase *my_database;
+    VTable *my_table;
+    rc_t res = VDBManagerCreateDB( my_manager, &my_database, my_schema, 
+                                   "DATA2DUMP:MyDatabase", kcmInit | kcmParents, "%s", db_path );
+    display_rescode( res, "failed to create database", "database created" );
+    if ( res == 0 )
+    {
+        res = VDatabaseCreateTable( my_database, &my_table, "test", kcmInit | kcmParents, "Tab1" );
+        display_rescode( res, "failed to create table", "table created" );
+        if ( res == 0 )
+        {
+            create_cursor_and_write( my_table, data_src );
+            res = VTableRelease( my_table );
+            display_rescode( res, "failed to release table", "table released" );
+        }
+        res = VDatabaseRelease( my_database );
+        display_rescode( res, "failed to release database", "database released" );
+    }
+    return res;
+} 
+
+/********************************************************************
+let the manager create a schema, calls dababase-creation etc.
+********************************************************************/
+static
+rc_t create_schema( VDBManager *my_manager, const char *schema_path, 
+                    const char *db_path, const KFile *data_src  )
+{
+    VSchema *schema;
+    /* empty schema, unless $VDB_ROOT tells it
+       where to find include files */
+    rc_t res = VDBManagerMakeSchema ( my_manager, & schema );
+    display_rescode( res, "failed to create schema", "schema created" );
+    if ( res == 0 )
+    {
+        /* load the schema from text */
+        res = VSchemaParseFile ( schema, "%s", schema_path );
+        if ( res != 0 )
+        {
+            PLOGERR ( klogInt,  (klogInt, res, "failed to load schema file '$(path)'",
+                                 "path=%s", schema_path ));
+        }
+        else
+        {
+            res = VSchemaDump ( schema, sdmPrint, "DATA2DUMP:MyDatabase", flush, stdout );
+            if ( res != 0 )
+                LOGERR ( klogInt, res, "failed to dump schema" );
+            else
+            {
+                res = create_dababase_from_schema( my_manager, schema, db_path, data_src );
+            }
+        }
+        res = VSchemaRelease ( schema );
+        display_rescode( res, "failed to release schema", "schema release" );
+    }
+    return res;
+}
+
+static
+rc_t build_test_db ( const char *schema_path, const char *db_path, const char *src_file )
+{
+    KDirectory *wd;
+    rc_t res = KDirectoryNativeDir ( & wd );
+    if ( res != 0 )
+        LOGERR ( klogSys, res, "failed to determine wd" );
+    else
+    {
+        KDirectory *root;
+
+#if 1 /* SHOULD WORK WHEN DISABLED
+         ENABLED FOR NOW AS A WORKAROUND */
+        root = wd;
+        KDirectoryAddRef ( root );
+#else
+        res = KDirectoryOpenDirUpdate ( wd, & root, true, "." );
+#endif
+        if ( res != 0 )
+            LOGERR ( klogSys, res, "failed to chroot to wd" );
+        else
+        {
+            VDBManager *my_manager;
+            res = VDBManagerMakeUpdate ( & my_manager, root );
+            if ( res != 0 )
+                LOGERR ( klogInt, res, "failed to open vdb manager" );
+            else
+            {
+                const KFile *data_src;
+                res = KDirectoryOpenFileRead ( wd, &data_src, "%s", src_file );
+                display_rescode( res, "failed to open src-file", "src-file opened" );
+                if ( res == 0 )
+                {
+                    show_manager_version( my_manager );
+                    res = create_schema( my_manager, schema_path, db_path, data_src );
+                    VDBManagerRelease ( my_manager );
+                    KFileRelease( data_src );
+                }
+            }
+            KDirectoryRelease ( root );
+        }
+        KDirectoryRelease ( wd );
+    }
+    return res;
+}
+
+
+ver_t CC KAppVersion ( void )
+{
+    return 0;
+}
+
+rc_t CC Usage (const Args * args)
+{
+    return 0;
+}
+
+rc_t CC Version ( const Args * args )
+{
+    return 0;
+}
+
+/****************************************************************************************
+
+                    argv[1]            argv[2]    argv[3]
+usage  : vdb-boot   shema              db_path    source-file
+example: vdb-boot   vdb-boot.vschema   test       vdb-boot.c
+
+ ***************************************************************************************/
+rc_t CC KMain ( int argc, char *argv [] )
+{
+    if ( argc != 4 )
+    {
+        LOGMSG ( klogFatal, "aaaah!" );
+        return -1;
+    }
+    return build_test_db ( argv[1], argv[2], argv[3] );
+}
diff --git a/tools/vdb-dump/vdb-boot.vers b/tools/vdb-dump/vdb-boot.vers
new file mode 100644
index 0000000..8e8299d
--- /dev/null
+++ b/tools/vdb-dump/vdb-boot.vers
@@ -0,0 +1 @@
+2.4.2
diff --git a/tools/vdb-dump/vdb-boot.vschema b/tools/vdb-dump/vdb-boot.vschema
new file mode 100644
index 0000000..7542a56
--- /dev/null
+++ b/tools/vdb-dump/vdb-boot.vschema
@@ -0,0 +1,52 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+version 1;
+
+include 'vdb/built-in.vschema';
+include 'insdc/insdc.vschema';
+
+/* it was INSDC:dna:2na */
+
+table DATA2DUMP : MyTable #1.0
+{
+    extern column ascii LINE = .LINE;
+    physical column ascii .LINE = LINE;
+
+    extern column U32 LINE_NR = .LINE_NR;
+    physical column U32 .LINE_NR = LINE_NR;
+
+    extern column INSDC:dna:2na READ = .READ;
+    physical column INSDC:dna:2na .READ = READ;
+
+    extern column I8[4] QUALITY = .QUALITY;
+    physical column I8[4] .QUALITY = QUALITY;
+};
+
+database DATA2DUMP : MyDatabase #1.0
+{
+    table DATA2DUMP : MyTable #1 test;
+};
diff --git a/tools/vdb-dump/vdb-dump-bin.c b/tools/vdb-dump/vdb-dump-bin.c
new file mode 100644
index 0000000..06ffa2b
--- /dev/null
+++ b/tools/vdb-dump/vdb-dump-bin.c
@@ -0,0 +1,1277 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <kapp/args.h>
+
+#include <insdc/insdc.h>
+
+#include <vdb/table.h>
+#include <vdb/cursor.h>
+
+#include <kfs/directory.h>
+#include <kfs/file.h>
+#include <kfs/buffile.h>
+
+#include <klib/text.h>
+#include <klib/printf.h>
+
+#include "vdb-dump-num-gen.h"
+#include "vdb-dump-context.h"
+#include "vdb-dump-coldefs.h"
+
+#include <os-native.h>
+#include <sysalloc.h>
+#include <stdlib.h>
+#include <string.h>
+
+rc_t Quitting( void );
+
+static rc_t write_to_file( KFile * f, uint64_t * pos, const void * src, uint32_t len, const char * name )
+{
+    size_t num_writ;
+    size_t num_to_write = len;
+    rc_t rc = KFileWriteAll( f, *pos, src, num_to_write, &num_writ );
+    if ( rc != 0 )
+    {
+        PLOGERR( klogInt, ( klogInt, rc,
+                 "failed to write to column $(col_name) at #%(pos)", "col_name=%s,pos=%ld", name, *pos ) );
+    }
+    else
+        *pos += num_writ;
+    return rc;
+}
+
+
+static rc_t read_from_file( const KFile * f, uint64_t pos, const uint8_t * dst,
+                            size_t dst_size, size_t * num_read, const char * name )
+{
+    rc_t rc = KFileReadAll ( f, pos, ( void * )dst, dst_size, num_read );
+    if ( rc != 0 )
+    {
+        PLOGERR( klogInt, ( klogInt, rc,
+                 "failed to read from column $(col_name) at #%(pos)", "col_name=%s,pos=%ld", name, pos ) );
+    }
+    return rc;
+}
+
+
+typedef struct wr_bin_idx
+{
+    /* the file-handles */
+    KFile * bin;
+    KFile * idx;
+    const char name[ 256 ];
+    uint64_t bin_pos;
+    uint64_t idx_pos;
+    uint32_t first_len;
+    bool multi_value;
+} wr_bin_idx;
+
+
+static void release_wr_bin_idx( wr_bin_idx * c )
+{
+    if ( c != NULL )
+    {
+        if ( c->bin != NULL )
+            KFileRelease( c->bin );
+        if ( c->idx != NULL )
+            KFileRelease( c->idx );
+    }
+}
+
+
+static rc_t create_wr_bin_idx( KDirectory * dir, const char * col_name, wr_bin_idx * c )
+{
+    rc_t rc;
+
+    c->bin = NULL;
+    c->idx = NULL;
+    rc = KDirectoryCreateFile ( dir, &c->bin, false, 0664, kcmInit, "COL_%s.bin", col_name );
+    if ( rc != 0 )
+    {
+        PLOGERR( klogInt, ( klogInt, rc,
+                 "failed to create bin-file for column $(col_name)",
+                 "col_name=%s", col_name ) );
+    }
+    else
+    {
+        rc = KDirectoryCreateFile ( dir, &c->idx, false, 0664, kcmInit, "COL_%s.idx", col_name );
+        if ( rc != 0 )
+        {
+            PLOGERR( klogInt, ( klogInt, rc,
+                     "failed to create index-file for column $(col_name)",
+                     "col_name=%s", col_name ) );
+        }
+    }
+
+    if ( rc == 0 )
+    {
+        KFile * f = c->bin;
+        rc = KBufWriteFileMakeWrite ( &c->bin, f, 1024 * 1024 * 16 );
+        if ( rc != 0 )
+        {
+            PLOGERR( klogInt, ( klogInt, rc,
+                     "failed to create buffer for bin-file for column $(col_name)",
+                     "col_name=%s", col_name ) );
+        }
+    }
+
+    if ( rc == 0 )
+    {
+        string_copy( ( char * )c->name, sizeof c->name,
+                     col_name, string_len( col_name, string_size( col_name ) ) );
+        c->bin_pos = 0;
+        c->idx_pos = 0;
+        c->first_len = 0xFFFFFFFF;
+        c->multi_value = false;
+    }
+
+    if ( rc != 0 )
+        release_wr_bin_idx( c );
+
+    return rc;
+}
+
+
+static rc_t write_bin_idx( wr_bin_idx * c, const void * data, uint32_t len )
+{
+    /* first write to index-file the position where the data will be written to */
+    rc_t rc = write_to_file( c->idx, &c->idx_pos, &c->bin_pos, sizeof c->bin_pos, c->name );
+
+    /* the write the length, it can be zero! */
+    if ( rc == 0 )
+        rc = write_to_file( c->idx, &c->idx_pos, &len, sizeof len, c->name );
+
+    /* the write the data, only if we have data! */
+    if ( rc == 0 && len > 0 )
+        rc = write_to_file( c->bin, &c->bin_pos, data, len, c->name );
+
+    if ( rc == 0 )
+    {
+        if ( c->first_len == 0xFFFFFFFF )
+            c->first_len = len;
+        else if( c->first_len != len )
+            c->multi_value = true;
+    }
+
+    return rc;
+}
+
+/*
+static rc_t set_bin_filesize( wr_bin_idx * c, uint64_t new_size )
+{
+    rc_t rc = KFileSetSize( c->bin, new_size );
+    if ( rc != 0 )
+    {
+        PLOGERR( klogInt, ( klogInt, rc,
+                 "failed to set size of file to >%(fsize) for column $(col_name)", "fsize=%ld,col_name=%s", new_size, c->name ) );
+    }
+    return rc;
+}
+
+static rc_t write_bin_at( wr_bin_idx * c, uint64_t pos, const void * data, uint32_t len )
+{
+    uint64_t pos1 = pos;
+    rc_t rc = write_to_file( c->bin, &pos1, data, len, c->name );
+
+    if ( rc == 0 && c->first_len == 0xFFFFFFFF )
+        c->first_len = len;
+
+    return rc;
+}
+*/
+
+static rc_t truncate_idx( wr_bin_idx * c )
+{
+    uint64_t pos = 0;
+    rc_t rc = write_to_file( c->idx, &pos, &c->first_len, sizeof c->first_len, c->name );
+    if ( rc == 0 )
+    {
+        rc = KFileSetSize ( c->idx, pos );
+        if ( rc != 0 )
+        {
+            PLOGERR( klogInt, ( klogInt, rc,
+                     "failed to truncate the index-file for column $(col_name)",
+                     "col_name=%s", c->name ) );
+        }
+    }
+    return rc;
+}
+
+
+static rc_t vdi_create_dir( const char * path, KDirectory ** dir )
+{
+    rc_t rc = KDirectoryNativeDir ( dir );
+    if ( rc != 0 )
+    {
+        LOGERR( klogInt, rc, "KDirectoryNativeDir() failed" );
+    }
+    else
+    {
+        if ( path != NULL )
+        {
+            rc = KDirectoryCreateDir ( *dir, 0775, kcmOpen, "%s", path );
+            if ( rc != 0 )
+            {
+                PLOGERR( klogInt, ( klogInt, rc,
+                         "failed to create directory $(dir_name)", "dir_name=%s", path ) );
+                KDirectoryRelease ( *dir );
+            }
+            else
+            {
+                KDirectory * tmp = *dir;
+                rc = KDirectoryOpenDirUpdate ( tmp, dir, false, "%s", path );
+                if ( rc != 0 )
+                {
+                    PLOGERR( klogInt, ( klogInt, rc,
+                             "failed to open directory $(dir_name)", "dir_name=%s", path ) );
+                }
+                KDirectoryRelease( tmp );
+            }
+        }
+    }
+    return rc;
+}
+
+
+static rc_t vdi_dump_column_rows( const char * path, const VCursor *cur, p_col_def col, num_gen * rows )
+{
+    KDirectory * dir;
+
+    rc_t rc = vdi_create_dir( path, &dir );
+    if ( rc == 0 )
+    {
+        wr_bin_idx wr;
+
+        rc = create_wr_bin_idx( dir, col->name, &wr );
+        if ( rc == 0 )
+        {
+            uint64_t row_id;
+
+            vdn_start( rows );
+            while ( vdn_next( rows, &row_id ) && rc == 0 )
+            {
+                rc = Quitting();
+                if ( rc == 0 )
+                {
+                    const void * base;
+                    uint32_t elem_bits, boff, row_len;
+                    rc = VCursorCellDataDirect ( cur, (int64_t)row_id, col->idx,
+                                                 &elem_bits, &base, &boff, &row_len );
+                    if ( rc != 0 )
+                    {
+                        PLOGERR( klogInt, ( klogInt, rc,
+                                 "VCursorCellData( col:$(col_name) at row #$(row_nr) ) failed",
+                                 "col_name=%s,row_nr=%lu", col->name, row_id ) );
+                    }
+                    else
+                    {
+                        uint32_t len = ( elem_bits >> 3 ) * row_len;
+                        rc = write_bin_idx( &wr, base, len );
+                    }
+                }
+            }
+
+            if ( rc == 0 && !wr.multi_value )
+                rc = truncate_idx( &wr );
+
+            release_wr_bin_idx( &wr );
+        }
+        KDirectoryRelease ( dir );
+    }
+    return rc;
+}
+
+
+static rc_t vdi_dump_column( const p_dump_context ctx, const VCursor *cur, p_col_def col )
+{
+    int64_t  first;
+    uint64_t count;
+
+    rc_t rc = VCursorIdRange( cur, col->idx, &first, &count );
+    if ( rc != 0 )
+    {
+        LOGERR( klogInt, rc, "VCursorIdRange() failed" );
+    }
+    else if ( count > 0 )
+    {
+        num_gen * rows;
+
+        rc = vdn_make( &rows );
+        if ( rc != 0 )
+        {
+            LOGERR( klogInt, rc, "vdn_make() failed" );
+        }
+        else
+        {
+            if ( ctx->row_range == NULL )
+            {
+                /* the user did not give us a row-range, we take all rows of this column... */
+                bool success = vdn_set_range( rows, first, count );
+                if ( !success )
+                {
+                    rc = RC( rcVDB, rcNoTarg, rcConstructing, rcParam, rcInvalid );
+                    LOGERR( klogInt, rc, "vdn_set_range() failed" );
+                }
+            }
+            else
+            {
+                /* the gave us a row-range, we parse that string and check agains the real row-count... */
+                uint32_t num_ranges = vdn_parse( rows, ctx->row_range );
+                if ( num_ranges < 1 )
+                {
+                    rc = RC( rcExe, rcDatabase, rcReading, rcRange, rcEmpty );
+                    LOGERR( klogInt, rc, "vdn_parse() failed" );
+                }
+                else
+                    vdn_check_range( rows, first, count );
+            }
+
+            if ( !vdn_range_defined( rows ) )
+            {
+                rc = RC( rcExe, rcDatabase, rcReading, rcRange, rcEmpty );
+                LOGERR( klogInt, rc, "no row-range(s) defined" );
+            }
+            else
+                rc = vdi_dump_column_rows( ctx->output_path, cur, col, rows ); /* <---- */
+
+            vdn_destroy( rows );
+        }
+    }
+    return rc;
+}
+
+
+static rc_t vdi_dump_columns( const p_dump_context ctx, const VCursor *cur, p_col_defs col_defs )
+{
+    rc_t rc = 0;
+    const Vector * v = &( col_defs->cols );
+    uint32_t start = VectorStart( v );
+    uint32_t end = start + VectorLength( v );
+    uint32_t i;
+
+    for ( i = start; rc == 0 && i < end; ++i )
+    {
+        p_col_def col = VectorGet ( v, i );
+        if ( col != NULL )
+            rc = vdi_dump_column( ctx, cur, col ); /* <---- */
+    }
+    return rc;
+}
+
+
+static uint32_t vdi_extract_or_parse_columns( const VTable * tab,
+                                              p_col_defs col_defs,
+                                              const char * columns,
+                                              const char * excluded_columns )
+{
+    uint32_t count = 0;
+    if ( col_defs != NULL )
+    {
+        bool cols_unknown = ( ( columns == NULL ) || ( string_cmp( columns, 1, "*", 1, 1 ) == 0 ) );
+        if ( cols_unknown )
+            /* the user does not know the column-names or wants all of them */
+            count = vdcd_extract_from_table( col_defs, tab );
+        else
+            /* the user knows the names of the wanted columns... */
+            count = vdcd_parse_string( col_defs, columns, tab );
+
+        if ( excluded_columns != NULL )
+            vdcd_exclude_these_columns( col_defs, excluded_columns );
+    }
+    return count;
+}
+
+
+rc_t vdi_dump_opened_table( const p_dump_context ctx, const VTable * tab )
+{
+    rc_t rc = 0;
+
+    col_defs * col_defs;
+
+    if ( !vdcd_init( &col_defs, ctx->max_line_len ) )
+    {
+        rc = RC( rcVDB, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+        LOGERR( klogInt, rc, "col_defs_init() failed" );
+    }
+    else
+    {
+        uint32_t n = vdi_extract_or_parse_columns( tab, col_defs, ctx->columns, ctx->excluded_columns );
+        if ( n < 1 )
+        {
+            rc = RC( rcVDB, rcNoTarg, rcConstructing, rcParam, rcInvalid );
+            LOGERR( klogInt, rc, "vdm_extract_or_parse_columns() failed" );
+        }
+        else
+        {
+            const VCursor * cur;
+
+            rc = VTableCreateCachedCursorRead( tab, &cur, ctx->cur_cache_size );
+            if ( rc != 0 )
+            {
+                LOGERR( klogInt, rc, "VTableCreateCachedCursorRead() failed" );
+            }
+            else
+            {
+                n = vdcd_add_to_cursor( col_defs, cur );
+                if ( n < 1 )
+                {
+                    rc = RC( rcVDB, rcNoTarg, rcConstructing, rcParam, rcInvalid );
+                    LOGERR( klogInt, rc, "vdcd_add_to_cursor() failed" );
+                }
+                else
+                {
+                    rc = VCursorOpen( cur );
+                    if ( rc != 0 )
+                    {
+                        LOGERR( klogInt, rc, "VCursorOpen() failed" );
+                    }
+                    else
+                        rc = vdi_dump_columns( ctx, cur, col_defs );    /* <---- */
+                }
+            }
+            VCursorRelease( cur );
+        }
+        vdcd_destroy( col_defs );
+    }
+
+    return rc;
+}
+
+
+typedef struct rd_bin_idx
+{
+    /* the file-handles */
+    const KFile * bin;
+    const KFile * idx;
+    const char name[ 256 ];
+    uint64_t bin_file_size;
+    uint64_t idx_file_size;
+    uint64_t row_count;
+    uint32_t common_len;
+} rd_bin_idx;
+
+
+static void release_rd_bin_idx( rd_bin_idx * c )
+{
+    if ( c != NULL )
+    {
+        if ( c->bin != NULL )
+            KFileRelease( c->bin );
+        if ( c->idx != NULL )
+            KFileRelease( c->idx );
+    }
+}
+
+
+static rc_t create_rd_bin_idx( const KDirectory * dir, const char * col_name, rd_bin_idx * c )
+{
+    rc_t rc;
+
+    rc = KDirectoryOpenFileRead( dir, &c->bin, "COL_%s.bin", col_name );
+    if ( rc != 0 )
+    {
+        PLOGERR( klogInt, ( klogInt, rc,
+                 "failed to open bin-file for column $(col_name)", "col_name=%s", col_name ) );
+    }
+    else
+    {
+        rc = KDirectoryOpenFileRead( dir, &c->idx, "COL_%s.idx", col_name );
+        if ( rc != 0 )
+        {
+            PLOGERR( klogInt, ( klogInt, rc,
+                     "failed to open idx-file for column $(col_name)", "col_name=%s", col_name ) );
+        }
+        else
+        {
+            string_copy( ( char * )c->name, sizeof c->name,
+                         col_name, string_len( col_name, string_size( col_name ) ) );
+            c->bin_file_size = 0;
+            c->idx_file_size = 0;
+            c->row_count = 0;
+            c->common_len = 0;
+
+            rc = KFileSize ( c->bin, &c->bin_file_size );
+            if ( rc != 0 )
+            {
+                PLOGERR( klogInt, ( klogInt, rc,
+                         "failed to get filesize of bin-file for $(col_name)", "col_name=%s", col_name ) );
+            }
+            else
+            {
+                rc = KFileSize ( c->idx, &c->idx_file_size );
+                if ( rc != 0 )
+                {
+                    PLOGERR( klogInt, ( klogInt, rc,
+                             "failed to get filesize of idx-file for $(col_name)", "col_name=%s", col_name ) );
+                }
+                else
+                {
+                    /* calculate row-count */
+                    if ( c->idx_file_size == sizeof c->common_len )
+                    {
+                        size_t num_read;
+                        /* read the common length out of index-file at pos 0, divide bin_file_size by common length */
+                        rc = read_from_file( c->idx, 0, (void *)&c->common_len, sizeof c->common_len, &num_read, col_name );
+                        if ( rc == 0 && c->common_len > 0 )
+                            c->row_count = ( c->bin_file_size / c->common_len );
+                    }
+                    else
+                    {
+                        /* divide the idx_file_size by 12 ( 8 bytes offset + 4 bytes length per row ) */
+                        c->row_count = ( c->idx_file_size / 12 );
+                    }
+                }
+            }
+        }
+
+        if ( rc != 0 )
+            release_rd_bin_idx( c );
+    }
+    return rc;
+}
+
+
+static rc_t rd_bin_idx_row_len( rd_bin_idx * c, uint64_t row_id, uint32_t * row_len )
+{
+    rc_t rc = 0;
+    size_t num_read;
+
+    if ( c->common_len > 0 )
+        *row_len = c->common_len;
+    else
+        rc = read_from_file( c->idx, ( row_id * 12 ) + 8, (void *)row_len, sizeof *row_len, &num_read, c->name );
+
+    return rc;
+}
+
+
+static rc_t rd_bin_idx_row_pos( rd_bin_idx * c, uint64_t row_id, uint64_t * row_pos )
+{
+    rc_t rc = 0;
+    size_t num_read;
+
+    if ( c->common_len > 0 )
+        *row_pos = ( c->common_len * row_id );
+    else
+        rc = read_from_file( c->idx, row_id * 12, (void *)row_pos, sizeof *row_pos, &num_read, c->name );
+
+    return rc;
+}
+
+
+static rc_t rd_bin_idx_64( rd_bin_idx * c, uint64_t row_id, uint64_t * values, uint32_t value_count )
+{
+    uint64_t pos;
+    size_t num_read;
+
+    rc_t rc = rd_bin_idx_row_pos( c, row_id, &pos );
+    if ( rc == 0 )
+        rc = read_from_file( c->bin, pos, (void *)values,
+                             ( sizeof *values ) * value_count, &num_read, c->name );
+
+    return rc;
+}
+
+
+static rc_t rd_bin_idx_32( rd_bin_idx * c, uint64_t row_id, uint32_t * values, uint32_t value_count )
+{
+    uint64_t pos;
+    size_t num_read;
+
+    rc_t rc = rd_bin_idx_row_pos( c, row_id, &pos );
+    if ( rc == 0 )
+        rc = read_from_file( c->bin, pos, (void *)values,
+                             ( sizeof *values ) * value_count, &num_read, c->name );
+
+    return rc;
+}
+
+
+static rc_t rd_bin_idx_8( rd_bin_idx * c, uint64_t row_id, uint8_t * values, uint32_t value_count )
+{
+    uint64_t pos;
+    size_t num_read;
+
+    rc_t rc = rd_bin_idx_row_pos( c, row_id, &pos );
+    if ( rc == 0 )
+        rc = read_from_file( c->bin, pos, (void *)values,
+                             ( sizeof *values ) * value_count, &num_read, c->name );
+
+    return rc;
+}
+
+
+static rc_t rd_bin_idx_char( rd_bin_idx * c, uint64_t row_id, uint32_t offset, uint32_t len,
+                             char * dst, size_t dst_size, size_t * num_read )
+{
+    uint64_t pos;
+    uint32_t row_len;
+
+    rc_t rc = rd_bin_idx_row_pos( c, row_id, &pos );
+
+    if ( rc == 0 )
+    {
+        pos += offset;
+        if ( len > 0 )
+            row_len = len;
+        else
+            rc = rd_bin_idx_row_len( c, row_id, &row_len );
+    }
+
+    if ( rc == 0 )
+    {
+        if ( row_len >= dst_size )
+            row_len = dst_size - 1;
+        rc = read_from_file( c->bin, pos, (void *)dst, row_len, num_read, c->name );
+    }
+    return rc;
+}
+
+
+/* -----------------------------------------------------------------------------------------------------------
+ phase 1
+
+ input:     COL_PRIMARY_ALIGNMENT_ID.[bin] from SEQUENCE
+            COL_REF_POS.[bin] from PRIMARY_ALIGNMENT
+            COL_REF_ID.[bin] from PRIMARY_ALIGNMENT
+            COL_REF_ORIENTATION.[bin] from PRIMARY_ALIGNMENT
+            COL_SEQ_READ_ID.[bin] from PRIMARY_ALIGNMENT
+
+ output:    TMP_MATE_REF_POS.[bin] ... the reference position of the mate
+            TMP_MATE_REF_ID.[bin]  ... the reference id ( idx to name ) of the mate
+            TMP_MATE_REF_ORIENTATION.[bin] ... the orientation of the mate
+
+ */
+typedef struct p1_ctx
+{
+    /* the input files */
+
+    /* originated from PRIMARY_ALIGNMENT-table */
+    rd_bin_idx SEQ_SPOT_ID;
+    rd_bin_idx MAPQ;
+    rd_bin_idx REF_POS;
+    rd_bin_idx REF_LEN;
+    rd_bin_idx CIGAR;
+    rd_bin_idx READ;
+    rd_bin_idx REF_ID;
+    rd_bin_idx REF_ORIENTATION;
+
+    /* originated from SEQUENCE-table */
+    rd_bin_idx PRIMARY_ALIGNMENT_ID;
+    rd_bin_idx QUALITY;
+    rd_bin_idx READ_LEN;
+    rd_bin_idx READ_START;
+    rd_bin_idx READ_FILTER;
+
+    /* originated from REFERENCE-table */
+    rd_bin_idx NAME;
+} p1_ctx;
+
+
+static void release_p1_ctx( p1_ctx * p1_ctx )
+{
+    release_rd_bin_idx( &p1_ctx->SEQ_SPOT_ID );
+    release_rd_bin_idx( &p1_ctx->MAPQ );
+    release_rd_bin_idx( &p1_ctx->REF_POS );
+    release_rd_bin_idx( &p1_ctx->REF_LEN );
+    release_rd_bin_idx( &p1_ctx->CIGAR );
+    release_rd_bin_idx( &p1_ctx->READ );
+    release_rd_bin_idx( &p1_ctx->REF_ID );
+    release_rd_bin_idx( &p1_ctx->REF_ORIENTATION );
+
+    release_rd_bin_idx( &p1_ctx->PRIMARY_ALIGNMENT_ID );
+    release_rd_bin_idx( &p1_ctx->QUALITY );
+    release_rd_bin_idx( &p1_ctx->READ_LEN );
+    release_rd_bin_idx( &p1_ctx->READ_START );
+    release_rd_bin_idx( &p1_ctx->READ_FILTER );
+
+    release_rd_bin_idx( &p1_ctx->NAME );
+}
+
+
+static rc_t init_p1_ctx( KDirectory * dir, p1_ctx * p1_ctx )
+{
+    rc_t rc;
+
+    memset( p1_ctx, 0, sizeof * p1_ctx );
+
+    rc = create_rd_bin_idx( dir, "SEQ_SPOT_ID", &p1_ctx->SEQ_SPOT_ID );
+    if ( rc == 0 )
+        rc = create_rd_bin_idx( dir, "MAPQ", &p1_ctx->MAPQ );
+    if ( rc == 0 )
+        rc = create_rd_bin_idx( dir, "REF_POS", &p1_ctx->REF_POS );
+    if ( rc == 0 )
+        rc = create_rd_bin_idx( dir, "REF_LEN", &p1_ctx->REF_LEN );
+    if ( rc == 0 )
+        rc = create_rd_bin_idx( dir, "CIGAR_SHORT", &p1_ctx->CIGAR );
+    if ( rc == 0 )
+        rc = create_rd_bin_idx( dir, "READ", &p1_ctx->READ );
+    if ( rc == 0 )
+        rc = create_rd_bin_idx( dir, "REF_ID", &p1_ctx->REF_ID );
+    if ( rc == 0 )
+        rc = create_rd_bin_idx( dir, "REF_ORIENTATION", &p1_ctx->REF_ORIENTATION );
+
+    if ( rc == 0 )
+        rc = create_rd_bin_idx( dir, "PRIMARY_ALIGNMENT_ID", &p1_ctx->PRIMARY_ALIGNMENT_ID );
+    if ( rc == 0 )
+        rc = create_rd_bin_idx( dir, "QUALITY", &p1_ctx->QUALITY );
+    if ( rc == 0 )
+        rc = create_rd_bin_idx( dir, "READ_LEN", &p1_ctx->READ_LEN );
+    if ( rc == 0 )
+        rc = create_rd_bin_idx( dir, "READ_START", &p1_ctx->READ_START );
+    if ( rc == 0 )
+        rc = create_rd_bin_idx( dir, "READ_FILTER", &p1_ctx->READ_FILTER );
+
+    if ( rc == 0 )
+        rc = create_rd_bin_idx( dir, "NAME", &p1_ctx->NAME );
+
+
+    if ( rc != 0 )
+        release_p1_ctx( p1_ctx );
+    return rc;
+}
+
+
+static uint32_t vdi_calc_flag( bool each_fragment_aligned,
+                               bool this_fragment_not_aligned,
+                               bool mate_not_aligned,
+                               bool this_fragment_reversed,
+                               bool mate_reversed,
+                               bool this_fragment_is_first,
+                               bool this_fragment_is_last,
+                               bool this_fragment_is_secondary,
+                               bool this_fragment_not_passing_quality_control,
+                               bool this_fragment_is_pcr_or_duplicate )
+{
+    uint32_t res = 0x001;
+    if ( each_fragment_aligned ) res |= 0x002;
+    if ( this_fragment_not_aligned ) res |= 0x004;
+    if ( mate_not_aligned ) res |= 0x008;
+    if ( this_fragment_reversed ) res |= 0x010;
+    if ( mate_reversed ) res |= 0x020;
+    if ( this_fragment_is_first ) res |= 0x040;
+    if ( this_fragment_is_last ) res |= 0x080;
+    if ( this_fragment_is_secondary ) res |= 0x100;
+    if ( this_fragment_not_passing_quality_control ) res |= 0x200;
+    if ( this_fragment_is_pcr_or_duplicate ) res |= 0x400;
+    return res;
+}
+
+
+static int32_t vdi_calc_tlen( const uint32_t self_ref_pos,
+                              const uint32_t mate_ref_pos,
+                              const uint32_t self_ref_len,
+                              const uint32_t mate_ref_len,
+                              const bool on_same_ref,
+                              const bool first_read )
+{
+    int32_t res = 0;
+    if ( on_same_ref && ( self_ref_pos > 0 ) && ( mate_ref_pos > 0 ) )
+    {
+        const uint32_t self_right = self_ref_pos + self_ref_len;
+        const uint32_t mate_right = mate_ref_pos + mate_ref_len;
+        const uint32_t leftmost   = ( self_ref_pos < mate_ref_pos ) ? self_ref_pos : mate_ref_pos;
+        const uint32_t rightmost  = ( self_right > mate_right ) ? self_right : mate_right;
+        const uint32_t tlen = rightmost - leftmost;
+
+        /* The standard says, "The leftmost segment has a plus sign and the rightmost has a minus sign." */
+        if ( ( self_ref_pos <= mate_ref_pos && self_right >= mate_right ) || /* mate fully contained within self or */
+             ( mate_ref_pos <= self_ref_pos && mate_right >= self_right ) )  /* self fully contained within mate; */
+        {
+            if ( self_ref_pos < mate_ref_pos || ( first_read && self_ref_pos == mate_ref_pos ) )
+                res = tlen;
+            else
+                res = -( ( int32_t )tlen );
+        }
+        else if ( ( self_right == mate_right && mate_ref_pos == leftmost ) || /* both are rightmost, but mate is leftmost */
+                   ( self_right == rightmost ) )
+        {
+            res = -( ( int32_t )tlen );
+        }
+        else
+            res = tlen;
+    }
+    return res;
+}
+
+
+static rc_t vdi_get_SEQ_SPOT_ID( p1_ctx * p1_ctx, uint64_t alignment_id, uint64_t * dst )
+{
+    rc_t rc = rd_bin_idx_64( &p1_ctx->SEQ_SPOT_ID, alignment_id, dst, 1 );
+    return rc;
+}
+
+
+static rc_t vdi_get_MATE_ID( p1_ctx * p1_ctx, uint64_t seq_spot_id_1_based, uint64_t alignment_id_1_based,
+                            uint64_t * dst, bool * first )
+{
+    uint64_t AL_IDS[ 2 ];
+    rc_t rc = rd_bin_idx_64( &p1_ctx->PRIMARY_ALIGNMENT_ID, seq_spot_id_1_based - 1, AL_IDS, 2 );
+    if ( rc == 0 )
+    {
+        if ( AL_IDS[ 0 ] == alignment_id_1_based )
+        {
+            *dst = AL_IDS[ 1 ];
+            *first = true;
+        }
+        else if ( AL_IDS[ 1 ] == alignment_id_1_based )
+        {
+            *dst = AL_IDS[ 0 ];
+            *first = false;
+        }
+        else
+        {
+            rc = RC( rcVDB, rcNoTarg, rcConstructing, rcParam, rcInvalid );
+            PLOGERR( klogInt, ( klogInt, rc,
+                     "given ALIGNMENT_ID #$(al_id) not found in SEQUENCE-ID #$(seq_id)",
+                     "al_id=%lu,seq_id=%lu", alignment_id_1_based, seq_spot_id_1_based ) );
+        }
+    }
+    return rc;
+}
+
+
+static rc_t vdi_get_REF_ID( p1_ctx * p1_ctx, uint64_t alignment_id_zero_based, uint64_t * dst )
+{
+    rc_t rc = rd_bin_idx_64( &p1_ctx->REF_ID, alignment_id_zero_based, dst, 1 );
+    return rc;
+}
+
+
+static rc_t vdi_get_REF_POS( p1_ctx * p1_ctx, uint64_t alignment_id, uint32_t * dst )
+{
+    rc_t rc = rd_bin_idx_32( &p1_ctx->REF_POS, alignment_id, dst, 1 );
+    if ( rc == 0 ) *dst += 1;
+    return rc;
+}
+
+
+static rc_t vdi_get_REF_LEN( p1_ctx * p1_ctx, uint64_t alignment_id, uint32_t * dst )
+{
+    rc_t rc = rd_bin_idx_32( &p1_ctx->REF_LEN, alignment_id, dst, 1 );
+    return rc;
+}
+
+
+static rc_t vdi_get_REF_ORIENTATION( p1_ctx * p1_ctx, uint64_t alignment_id, bool * dst )
+{
+    uint8_t orientation;
+    rc_t rc = rd_bin_idx_8( &p1_ctx->REF_ORIENTATION, alignment_id, &orientation, 1 );
+    if ( rc == 0 ) *dst = ( orientation != 0 );
+    return rc;
+}
+
+
+static rc_t vdi_generate_QNAME( p1_ctx * p1_ctx, uint64_t id, char * dst, size_t dst_size )
+{
+    rc_t rc = string_printf ( dst, dst_size, NULL, "%lu", id );
+    return rc;
+}
+
+
+static rc_t vdi_generate_RNAME( p1_ctx * p1_ctx, uint64_t ref_id_1_based, char * dst, size_t dst_size )
+{
+    size_t num_read;
+    rc_t rc = rd_bin_idx_char( &p1_ctx->NAME, ref_id_1_based - 1, 0, 0, dst, dst_size, &num_read );
+    if ( rc == 0 && num_read < dst_size )
+        dst[ num_read ] = 0;
+    return rc;
+}
+
+
+static rc_t vdi_generate_MAPQ( p1_ctx * p1_ctx, uint64_t alignment_id, uint32_t * dst )
+{
+    rc_t rc = rd_bin_idx_32( &p1_ctx->MAPQ, alignment_id, dst, 1 );
+    return rc;
+}
+
+
+static rc_t vdi_generate_CIGAR( p1_ctx * p1_ctx, uint64_t alignment_id, char * dst, size_t dst_size )
+{
+    size_t num_read;
+    rc_t rc = rd_bin_idx_char( &p1_ctx->CIGAR, alignment_id, 0, 0, dst, dst_size, &num_read );
+    if ( rc == 0 && num_read < dst_size )
+        dst[ num_read ] = 0;
+    return rc;
+}
+
+
+static rc_t vdi_generate_SEQ( p1_ctx * p1_ctx, uint64_t alignment_id, char * dst, size_t dst_size )
+{
+    size_t num_read;
+    rc_t rc = rd_bin_idx_char( &p1_ctx->READ, alignment_id, 0, 0, dst, dst_size, &num_read );
+    if ( rc == 0 && num_read < dst_size )
+        dst[ num_read ] = 0;
+    return rc;
+}
+
+
+static rc_t vdi_generate_FRAG( p1_ctx * p1_ctx, uint64_t seq_spot_id_1_based, bool first,
+                               uint32_t * frag_start, uint32_t * frag_len, uint8_t * filter )
+{
+    uint32_t rd_start[ 2 ];
+    rc_t rc = rd_bin_idx_32( &p1_ctx->READ_START, seq_spot_id_1_based - 1, rd_start, 2 );
+    if ( rc == 0 )
+    {
+        uint32_t rd_len[ 2 ];
+        rc = rd_bin_idx_32( &p1_ctx->READ_LEN, seq_spot_id_1_based - 1, rd_len, 2 );
+        if ( rc == 0 )
+        {
+            uint8_t rd_filter[ 2 ];
+            rc = rd_bin_idx_8( &p1_ctx->READ_FILTER, seq_spot_id_1_based - 1, rd_filter, 2 );
+            if ( rc == 0 )
+            {
+                uint32_t idx = first ? 0 : 1;
+                *frag_start = rd_start[ idx ];
+                *frag_len = rd_len[ idx ];
+                *filter = rd_filter[ idx ];
+            }
+        }
+    }
+    return rc;
+}
+
+
+static rc_t vdi_generate_QUAL( p1_ctx * p1_ctx, uint64_t seq_spot_id_1_based,
+                               uint32_t start, uint32_t len, char * dst, size_t dst_size )
+{
+    /* how many entries in READ_START and READ_LEN do we have? ( size is 32 bit ) */
+    size_t num_read;
+    rc_t rc = rd_bin_idx_char( &p1_ctx->QUALITY, seq_spot_id_1_based - 1, start, len, dst, dst_size, &num_read );
+    if ( rc == 0 && num_read < dst_size )
+    {
+        uint32_t i;
+        for ( i = 0; i < num_read; ++i )
+            dst[ i ] += 33; 
+        dst[ num_read ] = 0;
+    }
+    return rc;
+}
+
+
+static void reverse_buffer( char * dst, const char * src, size_t len )
+{
+    size_t i, j;
+    for ( i = 0, j = len - 1; i < len; ++i, --j )
+        dst[ i ] = src[ j ];
+}
+
+
+typedef struct alignment
+{
+    char REF_NAME[ 256 ];
+    uint64_t id_one_based;
+    uint64_t ref_id_one_based;
+    uint32_t REF_POS_one_based;
+    uint32_t REF_LEN;
+    bool aligned;
+    bool first;
+    bool reversed;
+} alignment;
+
+
+/* ----------------------------------------------------------------------------------------------------------- */
+static rc_t vdi_bin_phase_1_row( const p_dump_context ctx, p1_ctx * p1_ctx, uint64_t row_id )
+{
+    rc_t rc;
+
+    alignment self, mate;
+
+    char QNAME[ 256 ];
+    char CIGAR[ 512 ];
+    char SEQ[ 2048 ];
+    char QUAL[ 2048 ];
+    char QUALR[ 2048 ];
+
+    uint64_t SEQ_SPOT_ID_1_based;
+    uint32_t FLAG, MAPQ;
+    int32_t TLEN;
+    uint32_t frag_start, frag_len;
+    uint8_t filter;
+    bool on_same_reference = false;
+
+    /* first we have to collect a lot of helper values... */
+    memset( &self, 0, sizeof self );
+    memset( &mate, 0, sizeof mate );
+
+    /* -------------------------------------------------------------------------------------------------------- */
+    self.id_one_based = (  row_id + 1 );
+    self.aligned = true;
+
+    /* get the row-id (1-based) of the sequence this alignment belongs to */
+    rc = vdi_get_SEQ_SPOT_ID( p1_ctx, row_id, &SEQ_SPOT_ID_1_based );
+    
+    /* get the row-id (1-based) of the mate of this alignment ( 0...not mated )*/
+    if ( rc == 0 )
+        rc = vdi_get_MATE_ID( p1_ctx, SEQ_SPOT_ID_1_based, self.id_one_based, &mate.id_one_based, &self.first );
+    if ( rc == 0 )
+    {
+        mate.first = !self.first;
+        mate.aligned = ( mate.id_one_based > 0 );
+    }
+
+    /* get the row-id of the Reference this alignment belongs to */
+    if ( rc == 0 )
+        rc = vdi_get_REF_ID( p1_ctx, row_id, &self.ref_id_one_based );
+
+    /* get the row-id of the Reference the mate belongs to */
+    if ( rc == 0 && mate.aligned )
+        rc = vdi_get_REF_ID( p1_ctx, mate.id_one_based - 1, &mate.ref_id_one_based );
+
+    if ( rc == 0 && mate.aligned )
+        on_same_reference = ( self.ref_id_one_based == mate.ref_id_one_based );
+
+    /* get the position on the reference ( 0 based ) of this alignment */
+    if ( rc == 0 )
+        rc = vdi_get_REF_POS( p1_ctx, row_id, &self.REF_POS_one_based );
+
+    /* get the position on the reference ( 0 based ) of the mate */
+    if ( rc == 0 && mate.aligned )
+        rc = vdi_get_REF_POS( p1_ctx, mate.id_one_based - 1, &mate.REF_POS_one_based );
+
+    /* get the length of the alignment on the reference */
+    if ( rc == 0 )
+        rc = vdi_get_REF_LEN( p1_ctx, self.id_one_based - 1, &self.REF_LEN );
+
+    /* get the length of the mate on the reference */
+    if ( rc == 0 && mate.aligned )
+        rc = vdi_get_REF_LEN( p1_ctx, mate.id_one_based - 1, &mate.REF_LEN );
+
+    /* get the reference-name of this alignment */
+    if ( rc == 0 )
+        rc = vdi_generate_RNAME( p1_ctx, self.ref_id_one_based, self.REF_NAME, sizeof self.REF_NAME );
+    
+    /* get the reference-name of the mate */
+    if ( rc == 0 && mate.aligned && !on_same_reference )
+        rc = vdi_generate_RNAME( p1_ctx, mate.ref_id_one_based, mate.REF_NAME, sizeof mate.REF_NAME );
+
+    if ( rc == 0 )
+        rc = vdi_get_REF_ORIENTATION( p1_ctx, self.id_one_based - 1, &self.reversed );
+
+    if ( rc == 0 && mate.aligned )
+        rc = vdi_get_REF_ORIENTATION( p1_ctx, mate.id_one_based - 1, &mate.reversed );
+
+    /* if the mate is aligned and the ref-ids dont match, compare the strings to find out if they are
+       on the same reference */
+    if ( rc == 0 && mate.aligned && !on_same_reference )
+    {
+        size_t l1 = string_size( self.REF_NAME );
+        size_t l2 = string_size( mate.REF_NAME );
+        if ( l1 == l2 )
+        {
+            int diff = string_cmp ( self.REF_NAME, l1, mate.REF_NAME, l2, l1 );
+            on_same_reference = ( diff == 0 );
+        }
+    }
+
+    TLEN = vdi_calc_tlen( self.REF_POS_one_based, mate.REF_POS_one_based,
+                          self.REF_LEN, mate.REF_LEN, on_same_reference, self.first );
+
+    /* -------------------------------------------------------------------------------------------------------- */
+    if ( rc == 0 )
+        rc = vdi_generate_QNAME( p1_ctx, SEQ_SPOT_ID_1_based, QNAME, sizeof QNAME );
+
+    if ( rc == 0 )
+        rc = vdi_generate_MAPQ( p1_ctx, row_id, &MAPQ );
+
+    if ( rc == 0 )
+        rc = vdi_generate_CIGAR( p1_ctx, row_id, CIGAR, sizeof CIGAR );
+
+    if ( rc == 0 )
+        rc = vdi_generate_SEQ( p1_ctx, row_id, SEQ, sizeof SEQ );
+
+    if ( rc == 0 )
+        rc = vdi_generate_FRAG( p1_ctx, SEQ_SPOT_ID_1_based, self.first,
+                                &frag_start, &frag_len, &filter );
+
+    if ( rc == 0 )
+        rc = vdi_generate_QUAL( p1_ctx, SEQ_SPOT_ID_1_based, frag_start, frag_len, QUAL, sizeof QUAL );
+
+    if ( rc == 0 && self.reversed )
+        reverse_buffer( QUALR, QUAL, string_size( QUAL ) );
+        
+    if ( rc == 0 )
+    {
+        bool each_fragment_aligned = ( self.aligned && mate.aligned );
+        bool this_fragment_not_aligned = false;
+        bool mate_not_aligned = !mate.aligned;
+        bool this_fragment_reversed = self.reversed;
+        bool mate_reversed = mate.reversed;
+        bool this_fragment_is_first = self.first;
+        bool this_fragment_is_last = !self.first;
+        bool this_fragment_is_secondary = false;
+        bool this_fragment_not_passing_quality_control = ( ( filter & READ_FILTER_REJECT ) > 0 );
+        bool this_fragment_is_pcr_or_duplicate = ( ( filter & READ_FILTER_CRITERIA ) > 0 );
+
+        FLAG = vdi_calc_flag( each_fragment_aligned,
+                              this_fragment_not_aligned,
+                              mate_not_aligned,
+                              this_fragment_reversed,
+                              mate_reversed,
+                              this_fragment_is_first,
+                              this_fragment_is_last,
+                              this_fragment_is_secondary,
+                              this_fragment_not_passing_quality_control,
+                              this_fragment_is_pcr_or_duplicate );
+    }
+
+    if ( rc == 0 )
+        rc = KOutMsg( "%s\t%u\t%s\t%u\t%d\t%s\t",
+                      QNAME, FLAG, self.REF_NAME, self.REF_POS_one_based, MAPQ, CIGAR );
+
+    if ( rc == 0 )
+    {
+        if ( mate.aligned )
+        {
+            if ( on_same_reference )
+                rc = KOutMsg( "=\t%u\t%d\t", mate.REF_POS_one_based, TLEN );
+            else
+                rc = KOutMsg( "%s\t%u\t%d\t", mate.REF_NAME, mate.REF_POS_one_based, TLEN );
+        }
+        else
+            rc = KOutMsg( "*\t0\t0\t" );
+    }
+
+    if ( rc == 0 )
+    {
+        if ( self.reversed )
+            rc = KOutMsg( "%s\t%s\n", SEQ, QUALR );
+        else
+            rc = KOutMsg( "%s\t%s\n", SEQ, QUAL );
+    }
+    return rc;
+}
+
+static rc_t vdi_bin_phase_1( KDirectory * dir, const p_dump_context ctx )
+{
+    p1_ctx p1_ctx;
+    rc_t rc = init_p1_ctx( dir, &p1_ctx );
+    if ( rc == 0 )
+    {
+        num_gen * rows;
+
+        rc = vdn_make( &rows );
+        if ( rc != 0 )
+        {
+            LOGERR( klogInt, rc, "vdn_make() failed" );
+        }
+        else
+        {
+            uint64_t row_count = p1_ctx.REF_POS.row_count;
+
+            if ( ctx->row_range == NULL )
+            {
+                /* the user did not give us a row-range, we take all rows of this column... */
+                bool success = vdn_set_range( rows, 0, row_count );
+                if ( !success )
+                {
+                    rc = RC( rcVDB, rcNoTarg, rcConstructing, rcParam, rcInvalid );
+                    LOGERR( klogInt, rc, "vdn_set_range() failed" );
+                }
+            }
+            else
+            {
+                /* the gave us a row-range, we parse that string and check agains the real row-count... */
+                uint32_t num_ranges = vdn_parse( rows, ctx->row_range );
+                if ( num_ranges < 1 )
+                {
+                    rc = RC( rcExe, rcDatabase, rcReading, rcRange, rcEmpty );
+                    LOGERR( klogInt, rc, "vdn_parse() failed" );
+                }
+                else
+                    vdn_check_range( rows, 0, row_count );
+            }
+
+            if ( !vdn_range_defined( rows ) )
+            {
+                rc = RC( rcExe, rcDatabase, rcReading, rcRange, rcEmpty );
+                LOGERR( klogInt, rc, "no row-range(s) defined" );
+            }
+            else
+            {
+                uint64_t row_id;
+
+                vdn_start( rows );
+                while ( vdn_next( rows, &row_id ) && rc == 0 )
+                {
+                    rc = Quitting();
+                    if ( rc == 0 )
+                        rc = vdi_bin_phase_1_row( ctx, &p1_ctx, row_id );
+                }
+            }
+
+            vdn_destroy( rows );
+        }
+        release_p1_ctx( &p1_ctx );
+    }
+    return rc;
+}
+
+
+/* ----------------------------------------------------------------------------------------------------------- */
+
+
+/* ----------------------------------------------------------------------------------------------------------- */
+
+rc_t vdi_bin_phase( const p_dump_context ctx, Args * args )
+{
+    uint32_t count;
+    rc_t rc = ArgsParamCount( args, &count );
+    if ( rc != 0 )
+    {
+        LOGERR( klogInt, rc, "VCursorOpen() failed" );
+    }
+    else if ( count < 1 )
+    {
+        rc = RC( rcVDB, rcNoTarg, rcConstructing, rcParam, rcInvalid );
+        LOGERR( klogInt, rc, "parameter missing ( path to bin-files )" );
+    }
+    else
+    {
+        const char *bin_path = NULL;
+        rc = ArgsParamValue( args, 0, &bin_path );
+        if ( rc != 0 )
+        {
+            LOGERR( klogInt, rc, "ArgsParamValue() failed" );
+        }
+        else
+        {
+            KDirectory *dir;
+            rc = vdi_create_dir( bin_path, &dir );
+            if ( rc == 0 )
+            {
+                switch( ctx->phase )
+                {
+                    case 1  : vdi_bin_phase_1( dir, ctx ); break;
+                    default : KOutMsg( "phase %d unknown\n", ctx->phase );
+                }
+                KDirectoryRelease( dir );
+            }
+        }
+    }
+    return rc;
+}
diff --git a/tools/vdb-dump/vdb-dump-bin.h b/tools/vdb-dump/vdb-dump-bin.h
new file mode 100644
index 0000000..2caf4b4
--- /dev/null
+++ b/tools/vdb-dump/vdb-dump-bin.h
@@ -0,0 +1,44 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_vdb_dump_bin_
+#define _h_vdb_dump_bin_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+rc_t vdi_dump_opened_table( const p_dump_context ctx, const VTable *my_table );
+rc_t vdi_bin_phase( const p_dump_context ctx, Args * args );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/vdb-dump/vdb-dump-coldefs.c b/tools/vdb-dump/vdb-dump-coldefs.c
index 2f15da6..5d819c3 100644
--- a/tools/vdb-dump/vdb-dump-coldefs.c
+++ b/tools/vdb-dump/vdb-dump-coldefs.c
@@ -166,7 +166,7 @@ const char *vdcd_get_read_filter_txt( const uint32_t id )
 static bool vdcd_type_cmp( const VSchema *my_schema, VTypedecl * typedecl, const char * to_check )
 {
     VTypedecl type_to_check;
-    rc_t rc = VSchemaResolveTypedecl ( my_schema, &type_to_check, to_check );
+    rc_t rc = VSchemaResolveTypedecl ( my_schema, &type_to_check, "%s", to_check );
     if ( rc == 0 )
     {
         return VTypedeclToTypedecl ( typedecl, my_schema, &type_to_check, NULL, NULL );
@@ -399,7 +399,7 @@ uint32_t vdcd_parse_string( col_defs* defs, const char* src, const VTable *my_ta
                 col_def *col = ( col_def * )VectorGet( &(defs->cols), idx );
                 if ( col != NULL )
                 {
-                    rc = VCursorAddColumn( my_cursor, &(col->idx), col->name );
+                    rc = VCursorAddColumn( my_cursor, &(col->idx), "%s", col->name );
                     DISP_RC( rc, "VCursorAddColumn() failed" );
                     if ( rc == 0 )
                     {
@@ -446,7 +446,7 @@ uint32_t vdcd_extract_from_table( col_defs* defs, const VTable *my_table )
                     if ( rc == 0 )
                     {
                         p_col_def def = vdcd_append_col( defs, col_name );
-                        rc = VCursorAddColumn( my_cursor, &(def->idx), def->name );
+                        rc = VCursorAddColumn( my_cursor, &(def->idx), "%s", def->name );
                         DISP_RC( rc, "VCursorAddColumn() failed" );
                         if ( rc == 0 )
                         {
@@ -522,7 +522,7 @@ static void CC vdcd_add_1_to_cursor( void *item, void *data )
     if ( my_col_def == NULL ) return;
     if ( ctx == NULL ) return;
     if ( ctx->my_cursor == NULL ) return;
-    rc = VCursorAddColumn( ctx->my_cursor, &(my_col_def->idx), my_col_def->name );
+    rc = VCursorAddColumn( ctx->my_cursor, &(my_col_def->idx), "%s", my_col_def->name );
     DISP_RC( rc, "VCursorAddColumn() failed" );
 
     /***************************************************************************
@@ -606,6 +606,7 @@ void vdcd_exclude_this_column( col_defs* defs, const char* column_name )
     VectorForEach( &(defs->cols), false, vdcd_exclude_column_cb, (void*)column_name );
 }
 
+
 void vdcd_exclude_these_columns( col_defs* defs, const char* column_names )
 {
     char colname[MAX_COL_NAME_LEN+1];
@@ -634,3 +635,36 @@ void vdcd_exclude_these_columns( col_defs* defs, const char* column_names )
         vdcd_exclude_this_column( defs, colname );
     }
 }
+
+
+bool vdcd_get_first_none_static_column_idx( col_defs* defs, const VCursor * cur, uint32_t * idx )
+{
+    bool res = false;
+    if ( defs != NULL && cur !=NULL && idx != NULL )
+    {
+        uint32_t len = VectorLength( &(defs->cols) );
+        if ( len > 0 )
+        {
+            uint32_t start = VectorStart( &(defs->cols) );
+            uint32_t run_idx = start;
+            while ( ( run_idx < ( start + len ) ) && !res )
+            {
+                col_def * cd = VectorGet( &(defs->cols), run_idx );
+                if ( cd != NULL )
+                {
+                    int64_t  first;
+                    uint64_t count;
+
+                    rc_t rc = VCursorIdRange( cur, cd->idx, &first, &count );
+                    if ( rc == 0 && count > 0 )
+                    {
+                        *idx = cd->idx;
+                        res = true;
+                    }
+                }
+                run_idx++;
+            }
+        }
+    }
+    return res;
+}
diff --git a/tools/vdb-dump/vdb-dump-coldefs.h b/tools/vdb-dump/vdb-dump-coldefs.h
index f884ac2..d2dc6fd 100644
--- a/tools/vdb-dump/vdb-dump-coldefs.h
+++ b/tools/vdb-dump/vdb-dump-coldefs.h
@@ -82,6 +82,8 @@ typedef col_defs* p_col_defs;
 
 #define MAX_COL_NAME_LEN 64
 
+const char *vdcd_get_platform_txt( const uint32_t id );
+
 char *vdcd_make_domain_txt( const uint32_t domain );
 
 bool vdcd_init( col_defs** defs, const size_t str_limit );
@@ -94,6 +96,7 @@ uint32_t vdcd_add_to_cursor( col_defs* defs, const VCursor *my_cursor );
 void vdcd_reset_content( col_defs* defs );
 void vdcd_ins_trans_fkt( col_defs* defs, const VSchema *my_schema );
 void vdcd_exclude_these_columns( col_defs* defs, const char* column_names );
+bool vdcd_get_first_none_static_column_idx( col_defs* defs, const VCursor * cur, uint32_t * idx );
 
 #ifdef __cplusplus
 }
diff --git a/tools/vdb-dump/vdb-dump-context.c b/tools/vdb-dump/vdb-dump-context.c
index 87e7520..32b19e9 100644
--- a/tools/vdb-dump/vdb-dump-context.c
+++ b/tools/vdb-dump/vdb-dump-context.c
@@ -72,7 +72,7 @@ static rc_t vdco_set_str( char **dst, const char *src )
     {
         return RC( rcVDB, rcNoTarg, rcWriting, rcMemory, rcExhausted );
     }
-    string_copy( *dst, len+1, src, len );
+    string_copy( *dst, len + 1, src, len );
     return 0;
 }
 
@@ -85,6 +85,7 @@ static void vdco_init_values( p_dump_context ctx )
     ctx->filter = NULL;
 	ctx->idx_range = NULL;
 	ctx->output_file = NULL;
+	ctx->output_path = NULL;
 
     ctx->print_row_id = true;
     ctx->print_in_hex = false;
@@ -93,6 +94,7 @@ static void vdco_init_values( p_dump_context ctx )
     ctx->print_dna_bases = false;
     ctx->max_line_len = 0;
     ctx->indented_line_len = 0;
+    ctx->phase = 0;
 
     ctx->help_requested = false;
     ctx->usage_requested = false;
@@ -154,24 +156,43 @@ rc_t vdco_destroy( p_dump_context ctx )
     {
         VectorWhack( &(ctx->schema_list),
                      vdco_schema_list_entry_whack, NULL );
+
         if ( ctx->table != NULL )
         {
             free( (void*)ctx->table );
             ctx->table = NULL;
         }
+
         if ( ctx->columns != NULL )
         {
             free( (void*)ctx->columns );
             ctx->columns = NULL;
         }
+
         if ( ctx->excluded_columns != NULL )
         {
             free( (void*)ctx->excluded_columns );
             ctx->excluded_columns = NULL;
         }
 
-        free( (void*)ctx->output_file );
-        ctx->output_file = NULL;
+        if ( ctx->row_range != NULL )
+        {
+            free( (void*)ctx->row_range );
+            ctx->row_range = NULL;
+        }
+
+
+        if ( ctx->output_path != NULL )
+        {
+            free( (void*)ctx->output_path );
+            ctx->output_path = NULL;
+        }
+
+        if ( ctx->output_file != NULL )
+        {
+            free( (void*)ctx->output_file );
+            ctx->output_file = NULL;
+        }
 
         vdn_destroy( ctx->row_generator );
         free( ctx );
@@ -215,7 +236,7 @@ static rc_t vdco_set_filter( p_dump_context ctx, const char *src )
     if ( rc == 0 )
     {
         rc = vdco_set_str( (char**)&(ctx->filter), src );
-        DISP_RC( rc, "dump_context_set_str() failed" );
+        DISP_RC( rc, "vdco_set_str() failed" );
     }
     return rc;
 }
@@ -231,7 +252,7 @@ rc_t vdco_set_table( p_dump_context ctx, const char *src )
     if ( rc == 0 )
     {
         rc = vdco_set_str( (char**)&(ctx->table), src );
-        DISP_RC( rc, "dump_context_set_str() failed" );
+        DISP_RC( rc, "vdco_set_str() failed" );
     }
     return rc;
 }
@@ -246,7 +267,7 @@ static rc_t vdco_set_columns( p_dump_context ctx, const char *src )
     if ( rc == 0 )
     {
         rc = vdco_set_str( (char**)&(ctx->columns), src );
-        DISP_RC( rc, "dump_context_set_str() failed" );
+        DISP_RC( rc, "vdco_set_str() failed" );
     }
     return rc;
 }
@@ -261,7 +282,7 @@ static rc_t vdco_set_excluded_columns( p_dump_context ctx, const char *src )
     if ( rc == 0 )
     {
         rc = vdco_set_str( (char**)&(ctx->excluded_columns), src );
-        DISP_RC( rc, "dump_context_set_str() failed" );
+        DISP_RC( rc, "vdco_set_str() failed" );
     }
     return rc;
 }
@@ -275,7 +296,10 @@ static rc_t vdco_set_row_range( p_dump_context ctx, const char *src )
     }
     if ( rc == 0 )
     {
-        vdn_parse( ctx->row_generator, src );
+        rc = vdco_set_str( (char**)&(ctx->row_range), src );
+        DISP_RC( rc, "vdco_set_str() failed" );
+        if ( rc == 0 )
+            vdn_parse( ctx->row_generator, src );
     }
     return rc;
 }
@@ -291,7 +315,7 @@ static rc_t vdco_set_idx_range( p_dump_context ctx, const char *src )
     if ( rc == 0 )
     {
         rc = vdco_set_str( (char**)&(ctx->idx_range), src );
-        DISP_RC( rc, "dump_context_set_str() failed" );
+        DISP_RC( rc, "vdco_set_str() failed" );
     }
     return rc;
 }
@@ -307,7 +331,23 @@ static rc_t vdco_set_output_file( p_dump_context ctx, const char *src )
     if ( rc == 0 )
     {
         rc = vdco_set_str( (char**)&(ctx->output_file), src );
-        DISP_RC( rc, "dump_context_set_str() failed" );
+        DISP_RC( rc, "vdco_set_str() failed" );
+    }
+    return rc;
+}
+
+
+static rc_t vdco_set_output_path( p_dump_context ctx, const char *src )
+{
+    rc_t rc = 0;
+    if ( ( ctx == NULL )||( src == NULL ) )
+    {
+        rc = RC( rcVDB, rcNoTarg, rcWriting, rcParam, rcNull );
+    }
+    if ( rc == 0 )
+    {
+        rc = vdco_set_str( (char**)&(ctx->output_path), src );
+        DISP_RC( rc, "vdco_set_str() failed" );
     }
     return rc;
 }
@@ -331,6 +371,10 @@ static bool vdco_set_format( p_dump_context ctx, const char *src )
         ctx->format = df_fastq;
     else if ( strcmp( src, "fasta" ) == 0 )
         ctx->format = df_fasta;
+    else if ( strcmp( src, "bin" ) == 0 )
+        ctx->format = df_bin;
+    else if ( strcmp( src, "sql" ) == 0 )
+        ctx->format = df_sql;
     else ctx->format = df_default;
     return true;
 }
@@ -470,6 +514,7 @@ static void vdco_evaluate_options( const Args *my_args,
     ctx->help_requested = vdco_get_bool_option( my_args, OPTION_HELP, false );
     ctx->print_row_id = vdco_get_bool_option( my_args, OPTION_ROW_ID_ON, false );
     ctx->lf_after_row = vdco_get_uint16_option( my_args, OPTION_LINE_FEED, 1 );
+    ctx->phase = vdco_get_uint16_option( my_args, OPTION_PHASE, 0 );
     ctx->print_column_names = vdco_get_bool_neg_option( my_args, OPTION_COLNAME_OFF, true );
     ctx->print_in_hex = vdco_get_bool_option( my_args, OPTION_IN_HEX, false );
     ctx->schema_dump_requested = vdco_get_bool_option( my_args, OPTION_SCHEMA_DUMP, false );
@@ -493,7 +538,8 @@ static void vdco_evaluate_options( const Args *my_args,
     ctx->enum_phys = vdco_get_bool_option( my_args, OPTION_ENUM_PHYS, false );
     ctx->idx_enum_requested = vdco_get_bool_option( my_args, OPTION_IDX_ENUM, false );
     ctx->disable_multithreading = vdco_get_bool_option( my_args, OPTION_NO_MULTITHREAD, false );
-    
+    ctx->print_info = vdco_get_bool_option( my_args, OPTION_INFO, false );
+
     ctx->cur_cache_size = vdco_get_size_t_option( my_args, OPTION_CUR_CACHE, CURSOR_CACHE_SIZE );
     ctx->output_buffer_size = vdco_get_size_t_option( my_args, OPTION_OUT_BUF_SIZE, DEF_OPTION_OUT_BUF_SIZE );
     
@@ -510,6 +556,7 @@ static void vdco_evaluate_options( const Args *my_args,
     vdco_set_row_range( ctx, vdco_get_str_option( my_args, OPTION_ROWS ) );
 	vdco_set_idx_range( ctx, vdco_get_str_option( my_args, OPTION_IDX_RANGE ) );
     vdco_set_output_file( ctx, vdco_get_str_option( my_args, OPTION_OUT_FILE ) );
+    vdco_set_output_path( ctx, vdco_get_str_option( my_args, OPTION_OUT_PATH ) );
 
 	ctx->idx_range_requested = ( ctx->idx_range != NULL );
     vdco_set_schemas( my_args, ctx );
diff --git a/tools/vdb-dump/vdb-dump-context.h b/tools/vdb-dump/vdb-dump-context.h
index 0d976ca..26ec382 100644
--- a/tools/vdb-dump/vdb-dump-context.h
+++ b/tools/vdb-dump/vdb-dump-context.h
@@ -72,10 +72,13 @@ extern "C" {
 #define OPTION_IDX_RANGE         "idx-range"
 #define OPTION_CUR_CACHE         "cur-cache"
 #define OPTION_OUT_FILE          "output-file"
+#define OPTION_OUT_PATH          "output-path"
+#define OPTION_PHASE             "phase"
 #define OPTION_GZIP              "gzip"
 #define OPTION_BZIP2             "bzip2"
 #define OPTION_OUT_BUF_SIZE      "output-buffer-size"
 #define OPTION_NO_MULTITHREAD    "disable-multithreading"
+#define OPTION_INFO              "info"
 
 #define ALIAS_ROW_ID_ON         "I"
 #define ALIAS_LINE_FEED         "l"
@@ -117,7 +120,9 @@ typedef enum dump_format_t
     df_piped,
     df_tab,
     df_fastq,
-    df_fasta
+    df_fasta,
+    df_bin,
+    df_sql
 } dump_format_t;
 
 /********************************************************************
@@ -132,12 +137,15 @@ typedef struct dump_context
     const char *excluded_columns;
     const char *filter;
 	const char *idx_range;
+    const char *row_range;
     const char *output_file;
+    const char *output_path;
     num_gen *row_generator;
     bool print_row_id;
     uint16_t lf_after_row;
     uint16_t max_line_len;
     uint16_t indented_line_len;
+    uint16_t phase;
     uint32_t generic_idx;
     size_t cur_cache_size;
     size_t output_buffer_size;
@@ -168,6 +176,7 @@ typedef struct dump_context
 	bool idx_enum_requested;
 	bool idx_range_requested;
     bool disable_multithreading;
+    bool print_info;
 } dump_context;
 typedef dump_context* p_dump_context;
 
diff --git a/tools/vdb-dump/vdb-dump-fastq.c b/tools/vdb-dump/vdb-dump-fastq.c
index 8c1b7e7..e9a9bb3 100644
--- a/tools/vdb-dump/vdb-dump-fastq.c
+++ b/tools/vdb-dump/vdb-dump-fastq.c
@@ -348,7 +348,7 @@ static rc_t vdb_fastq_table( const p_dump_context ctx,
 
     vdh_parse_schema( mgr, &schema, &(ctx->schema_list) );
 
-    rc = VDBManagerOpenTableRead( mgr, &tbl, schema, ctx->path );
+    rc = VDBManagerOpenTableRead( mgr, &tbl, schema, "%s", ctx->path );
     DISP_RC( rc, "VDBManagerOpenTableRead() failed" );
     if ( rc == 0 )
     {
@@ -371,7 +371,7 @@ static rc_t vdb_fastq_database( const p_dump_context ctx,
 
     vdh_parse_schema( mgr, &schema, &(ctx->schema_list) );
 
-    rc = VDBManagerOpenDBRead( mgr, &db, schema, ctx->path );
+    rc = VDBManagerOpenDBRead( mgr, &db, schema, "%s", ctx->path );
     DISP_RC( rc, "VDBManagerOpenDBRead() failed" );
     if ( rc == 0 )
     {
@@ -383,7 +383,7 @@ static rc_t vdb_fastq_database( const p_dump_context ctx,
         {
             const VTable * tbl;
 
-            rc = VDatabaseOpenTableRead( db, &tbl, ctx->table );
+            rc = VDatabaseOpenTableRead( db, &tbl, "%s", ctx->table );
             DISP_RC( rc, "VDatabaseOpenTableRead() failed" );
             if ( rc == 0 )
             {
@@ -409,7 +409,7 @@ static rc_t vdb_fastq_by_pathtype( const p_dump_context ctx,
                                    fastq_ctx * fctx )                                   
 {
     rc_t rc;
-    int path_type = ( VDBManagerPathType ( mgr, ctx->path ) & ~ kptAlias );
+    int path_type = ( VDBManagerPathType ( mgr, "%s", ctx->path ) & ~ kptAlias );
     /* types defined in <kdb/manager.h> */
     switch ( path_type )
     {
diff --git a/tools/vdb-dump/vdb-dump-helper.c b/tools/vdb-dump/vdb-dump-helper.c
index 2ff775e..c937e7f 100644
--- a/tools/vdb-dump/vdb-dump-helper.c
+++ b/tools/vdb-dump/vdb-dump-helper.c
@@ -27,11 +27,14 @@
 #include <kfs/directory.h>
 #include <klib/log.h>
 #include <klib/rc.h>
+#include <klib/text.h>
+
 #include <vdb/manager.h>
 #include <vdb/database.h>
 #include <vdb/schema.h>
 #include <vdb/table.h>
 #include <vdb/cursor.h>
+
 #include <os-native.h>
 #include <sysalloc.h>
 #include "vdb-dump-helper.h"
@@ -68,7 +71,7 @@ static void CC vdh_parse_1_schema( void *item, void *data )
     VSchema *my_schema = (VSchema*)data;
     if ( ( item != NULL )&&( my_schema != NULL ) )
     {
-        rc_t rc = VSchemaParseFile( my_schema, s );
+        rc_t rc = VSchemaParseFile( my_schema, "%s", s );
         DISP_RC( rc, "VSchemaParseFile() failed" );
     }
 }
@@ -115,7 +118,7 @@ bool vdh_is_path_table( const VDBManager *my_manager, const char *path,
     rc = vdh_parse_schema( my_manager, &my_schema, schema_list );
     DISP_RC( rc, "helper_parse_schema() failed" );
 
-    rc = VDBManagerOpenTableRead( my_manager, &my_table, my_schema, path );
+    rc = VDBManagerOpenTableRead( my_manager, &my_table, my_schema, "%s", path );
     DISP_RC( rc, "VDBManagerOpenTableRead() failed" );
     if ( rc == 0 )
         {
@@ -157,7 +160,7 @@ bool vdh_is_path_column( const VDBManager *my_manager, const char *path,
             {
                 string_copy( pp_path, path_len + 20, path, path_len );
                 string_copy( &pp_path[ path_len ], 20, backback, string_size( backback ) );
-                rc = KDirectoryResolvePath( my_directory, true, resolved, 1023, pp_path );
+                rc = KDirectoryResolvePath( my_directory, true, resolved, 1023, "%s", pp_path );
                 if ( rc == 0 )
                     res = vdh_is_path_table( my_manager, resolved, schema_list );
             }
@@ -182,7 +185,7 @@ bool vdh_is_path_database( const VDBManager *my_manager, const char *path,
     rc = vdh_parse_schema( my_manager, &my_schema, schema_list );
     DISP_RC( rc, "helper_parse_schema() failed" );
 
-    rc = VDBManagerOpenDBRead( my_manager, &my_database, my_schema, path );
+    rc = VDBManagerOpenDBRead( my_manager, &my_database, my_schema, "%s", path );
     if ( rc == 0 )
         {
         res = true; /* yes we are able to open the database ---> path is a database */
@@ -236,6 +239,18 @@ static int vdh_str_cmp( const char *a, const char *b )
     return strcase_cmp ( a, asize, b, bsize, ( asize > bsize ) ? asize : bsize );
 }
 
+static bool vdh_str_starts_with( const char *a, const char *b )
+{
+    bool res = false;
+    size_t asize = string_size ( a );
+    size_t bsize = string_size ( b );
+    if ( asize >= bsize )
+    {
+        int cmp = strcase_cmp ( a, bsize, b, bsize, bsize );
+        res = ( cmp == 0 );
+    }
+    return res;
+}
 
 /*************************************************************************************
 helper-function to check if a given table is in the list of tables
@@ -374,3 +389,62 @@ rc_t vdh_print_col_info( dump_context *ctx,
     }
     return rc;
 }
+
+
+
+rc_t resolve_accession( const char * accession, char * dst, size_t dst_size, bool remotely )
+{
+    VFSManager * vfs_mgr;
+    rc_t rc = VFSManagerMake( &vfs_mgr );
+    dst[ 0 ] = 0;
+    if ( rc == 0 )
+    {
+        VResolver * resolver;
+        rc = VFSManagerGetResolver( vfs_mgr, &resolver );
+        if ( rc == 0 )
+        {
+            VPath * vpath;
+            rc = VFSManagerMakePath( vfs_mgr, &vpath, "ncbi-acc:%s", accession );
+            if ( rc == 0 )
+            {
+                const VPath * local = NULL;
+                const VPath * remote = NULL;
+                if ( remotely )
+                    rc = VResolverQuery ( resolver, eProtocolHttp, vpath, &local, &remote, NULL );
+                else
+                    rc = VResolverQuery ( resolver, eProtocolHttp, vpath, &local, NULL, NULL );
+                if ( rc == 0 && ( local != NULL || remote != NULL ) )
+                {
+                    const String * path;
+                    if ( local != NULL )
+                        rc = VPathMakeString( local, &path );
+                    else
+                        rc = VPathMakeString( remote, &path );
+
+                    if ( rc == 0 && path != NULL )
+                    {
+                        string_copy ( dst, dst_size, path->addr, path->size );
+                        dst[ path->size ] = 0;
+                        StringWhack ( path );
+                    }
+
+                    if ( local != NULL )
+                        VPathRelease ( local );
+                    if ( remote != NULL )
+                        VPathRelease ( remote );
+                }
+                VPathRelease ( vpath );
+            }
+            VResolverRelease( resolver );
+        }
+        VFSManagerRelease ( vfs_mgr );
+    }
+
+    if ( rc == 0 && vdh_str_starts_with( dst, "ncbi-acc:" ) )
+    {
+        size_t l = string_size ( dst );
+        memmove( dst, &( dst[ 9 ] ), l - 9 );
+        dst[ l - 9 ] = 0;
+    }
+    return rc;
+}
diff --git a/tools/vdb-dump/vdb-dump-helper.h b/tools/vdb-dump/vdb-dump-helper.h
index d8f7424..72fe1cf 100644
--- a/tools/vdb-dump/vdb-dump-helper.h
+++ b/tools/vdb-dump/vdb-dump-helper.h
@@ -36,8 +36,12 @@ extern "C" {
 #endif
 
 #include <klib/out.h>
-
 #include <klib/rc.h>
+
+#include <vfs/manager.h>
+#include <vfs/path.h>
+#include <vfs/resolver.h>
+
 #include <vdb/manager.h>
 #include <vdb/table.h>
 #include <vdb/cursor.h>
@@ -77,6 +81,8 @@ rc_t vdh_print_col_info( dump_context *ctx,
                          const p_col_def col_def,
                          const VSchema *my_schema );
 
+rc_t resolve_accession( const char * accession, char * dst, size_t dst_size, bool remotely );
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/tools/vdb-dump/vdb-dump-num-gen.c b/tools/vdb-dump/vdb-dump-num-gen.c
index 83fc592..1b237e5 100644
--- a/tools/vdb-dump/vdb-dump-num-gen.c
+++ b/tools/vdb-dump/vdb-dump-num-gen.c
@@ -320,6 +320,7 @@ static void vdn_remove_invalid_nodes( num_gen* generator, const uint32_t invalid
     VectorWhack ( &temp_nodes, NULL, NULL );
 }
 
+
 bool vdn_check_range( num_gen* generator,
                       const int64_t first, const uint64_t count )
 {
@@ -340,6 +341,7 @@ bool vdn_check_range( num_gen* generator,
 
             VectorForEach ( &(generator->nodes), false,
                         vdn_count_invalid_nodes, &invalid_nodes );
+
             if ( invalid_nodes > 0 )
             {
                 vdn_remove_invalid_nodes( generator, invalid_nodes );
@@ -349,6 +351,7 @@ bool vdn_check_range( num_gen* generator,
     return res;
 }
 
+
 rc_t vdn_make( num_gen** generator )
 {
     if ( generator == NULL )
@@ -364,6 +367,7 @@ rc_t vdn_make( num_gen** generator )
     return 0;
 }
 
+
 rc_t vdn_destroy( num_gen* generator )
 {
     if ( generator == NULL )
@@ -375,6 +379,7 @@ rc_t vdn_destroy( num_gen* generator )
     return 0;
 }
 
+
 bool vdn_start( num_gen* generator )
 {
     if ( generator == NULL ) return false;
@@ -383,6 +388,7 @@ bool vdn_start( num_gen* generator )
     return true;
 }
 
+
 static bool vdn_next_node( num_gen* generator, uint64_t* value )
 {
     bool res = false;
@@ -415,6 +421,7 @@ static bool vdn_next_node( num_gen* generator, uint64_t* value )
     return res;
 }
 
+
 bool vdn_range_defined( num_gen* generator )
 {
     bool res = false;
@@ -425,6 +432,7 @@ bool vdn_range_defined( num_gen* generator )
     return res;
 }
 
+
 bool vdn_next( num_gen* generator, uint64_t* value )
 {
     bool res = false;
@@ -446,3 +454,24 @@ bool vdn_next( num_gen* generator, uint64_t* value )
     }
     return res;
 }
+
+
+static void CC vdn_detect_max( void *item, void *data )
+{
+    p_num_gen_node the_node = ( p_num_gen_node )item;
+    uint64_t * max_value = ( uint64_t * )data;
+    uint64_t node_max = ( the_node->start + the_node->count ) - 1;
+    if ( node_max > * max_value )
+    {
+        * max_value = node_max;
+    }
+}
+
+
+uint64_t vdn_max( num_gen* generator )
+{
+    uint64_t res = 0;
+    if ( generator != NULL )
+        VectorForEach ( &(generator->nodes), false, vdn_detect_max, &res );
+    return res;
+}
\ No newline at end of file
diff --git a/tools/vdb-dump/vdb-dump-num-gen.h b/tools/vdb-dump/vdb-dump-num-gen.h
index 0131cba..12fc530 100644
--- a/tools/vdb-dump/vdb-dump-num-gen.h
+++ b/tools/vdb-dump/vdb-dump-num-gen.h
@@ -71,6 +71,8 @@ bool vdn_start( num_gen* generator );
 bool vdn_next( num_gen* generator, uint64_t* value );
 bool vdn_range_defined( num_gen* generator );
 
+uint64_t vdn_max( num_gen* generator );
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/tools/vdb-dump/vdb-dump-print.c b/tools/vdb-dump/vdb-dump-print.c
new file mode 100644
index 0000000..e6e7744
--- /dev/null
+++ b/tools/vdb-dump/vdb-dump-print.c
@@ -0,0 +1,550 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "vdb-dump-print.h"
+
+#include <klib/rc.h>
+#include <klib/printf.h>
+#include <klib/out.h>
+#include <klib/pack.h>
+
+#include <stdlib.h>
+#include <string.h>
+#include <bitstr.h>
+
+typedef struct vdp_context
+{
+    const void * base;
+    const VTypedesc * type_desc;
+    vdp_opts * opts;
+    char * buf;
+    size_t buf_size;
+    size_t printed_so_far;
+    bool buf_filled;
+
+    uint32_t elem_idx;
+    uint32_t elem_bits;
+    uint32_t boff;
+    uint32_t row_len;
+    int32_t selection;
+    uint64_t offset_in_bits;
+    bool print_dna_bases;
+} vdp_context;
+
+
+static rc_t vdp_print( vdp_context * vdp_ctx, const char * fmt, ... )
+{
+    rc_t rc = 0;
+    if ( vdp_ctx->buf_size > vdp_ctx->printed_so_far )
+    {
+        va_list args;
+        size_t num_writ;
+        size_t available = ( vdp_ctx->buf_size - vdp_ctx->printed_so_far );
+
+        va_start ( args, fmt );
+        rc = string_vprintf ( &( vdp_ctx->buf[ vdp_ctx->printed_so_far ]), available, &num_writ, fmt, args );
+        vdp_ctx->printed_so_far += num_writ;
+        va_end ( args );
+    }
+
+    if ( vdp_ctx->buf_size <= vdp_ctx->printed_so_far )
+        vdp_ctx->buf_filled = true;
+    return rc;
+}
+
+
+static rc_t vdp_print_string( vdp_context * vdp_ctx, const char * s )
+{
+    rc_t rc = 0;
+    if ( vdp_ctx->buf == NULL )
+    {
+        rc = KOutMsg( s );
+    }
+    else
+    {
+        if ( vdp_ctx->buf_size > vdp_ctx->printed_so_far )
+        {
+            size_t num_writ;
+            size_t available = ( vdp_ctx->buf_size - vdp_ctx->printed_so_far );
+
+            rc = string_printf ( &( vdp_ctx->buf[ vdp_ctx->printed_so_far ]), available, &num_writ, s );
+            vdp_ctx->printed_so_far += num_writ;
+        }
+
+        if ( vdp_ctx->buf_size <= vdp_ctx->printed_so_far )
+            vdp_ctx->buf_filled = true;
+    }
+    return rc;
+}
+
+typedef rc_t( * vdp_fkt )( vdp_context * vdp_ctx );
+
+
+#define BYTE_OFFSET(VALUE)  ( (VALUE) >> 3 )
+#define BIT_OFFSET(VALUE)   ( (VALUE) & 0x7 )
+
+
+static uint8_t BitLength2Bytes[65] =
+{
+         /* 0  1  2  3  4  5  6  7  8  9*/
+   /* 0 */  0, 1, 1, 1, 1, 1, 1, 1, 1, 2,
+   /* 1 */  2, 2, 2, 2, 2, 2, 2, 3, 3, 3,
+   /* 2 */  3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
+   /* 3 */  4, 4, 4, 5, 5, 5, 5, 5, 5, 5,
+   /* 4 */  5, 6, 6, 6, 6, 6, 6, 6, 6, 7,
+   /* 5 */  7, 7, 7, 7, 7, 7, 7, 8, 8, 8,
+   /* 6 */  8, 8, 8, 8, 8
+};
+
+/*************************************************************************************
+n_bits   [IN] ... number of bits
+
+calculates the number of bytes that have to be copied to contain the given
+number of bits
+*************************************************************************************/
+static uint16_t vdp_bitlength_2_bytes( const size_t n_bits )
+{
+    if ( n_bits > 64 )
+        return 8;
+    else
+        return BitLength2Bytes[ n_bits ];
+}
+
+
+static uint64_t BitLength2Mask[33] =
+{
+   /* 0 */ 0x00,
+   /* 1 ..  4 */  0x1,                0x3,                0x7,                0xF,
+   /* 5 ..  8 */  0x1F,               0x3F,               0x7F,               0xFF,
+   /* 9 .. 12 */  0x1FF,              0x3FF,              0x7FF,              0xFFF,
+   /*13 .. 16 */  0x1FFF,             0x3FFF,             0x7FFF,             0xFFFF,
+   /*17 .. 20 */  0x1FFFF,            0x3FFFF,            0x7FFFF,            0xFFFFF,
+   /*21 .. 24 */  0x1FFFFF,           0x3FFFFF,           0x7FFFFF,           0xFFFFFF,
+   /*25 .. 28 */  0x1FFFFFF,          0x3FFFFFF,          0x7FFFFFF,          0xFFFFFFF,
+   /*29 .. 32 */  0x1FFFFFFF,         0x3FFFFFFF,         0x7FFFFFFF,         0xFFFFFFFF
+ };
+
+
+/*************************************************************************************
+n_bits   [IN] ... number of bits
+
+creates a bitmask to mask exactly the given number of bits from a longer value
+*************************************************************************************/
+static uint64_t vdp_bitlength_2_mask( const size_t n_bits )
+{
+    uint64_t res;
+    if ( n_bits < 33 )
+        res = BitLength2Mask[ n_bits ];
+    else
+    {
+        if ( n_bits < 65 )
+            res = BitLength2Mask[ n_bits-32 ];
+        else
+            res = 0xFFFFFFFF;
+        res <<= 32;
+        res |= 0xFFFFFFFF;
+    }
+    return res;
+}
+
+
+static void vdp_move_to_value( void* dst, vdp_context * vdp_ctx, const uint32_t n_bits )
+{
+    char *src_ptr = ( char* )vdp_ctx->buf + BYTE_OFFSET( vdp_ctx->offset_in_bits );
+    if ( BIT_OFFSET( vdp_ctx->offset_in_bits ) == 0 )
+    {
+        memmove( dst, src_ptr, vdp_bitlength_2_bytes( n_bits ) );
+    }
+    else
+    {
+        bitcpy ( dst, 0, src_ptr, BIT_OFFSET( vdp_ctx->offset_in_bits ), n_bits );
+    }
+}
+
+
+static uint64_t vdp_move_to_uint64( vdp_context * vdp_ctx )
+{
+    uint64_t value = 0;
+    uint32_t n_bits = vdp_ctx->type_desc->intrinsic_bits;
+    vdp_move_to_value( &value, vdp_ctx, n_bits );
+    if ( n_bits & 7 )
+    {
+        size_t unpacked = 0;
+        Unpack( n_bits, sizeof( value ), &value, 0, n_bits, NULL, &value, sizeof( value ), &unpacked );
+    }
+    value &= vdp_bitlength_2_mask( n_bits );
+    vdp_ctx->offset_in_bits += n_bits;
+    return value;
+}
+
+
+static rc_t vdp_boolean( vdp_context * vdp_ctx )
+{
+    rc_t rc;
+    uint64_t value = vdp_move_to_uint64( vdp_ctx );
+    switch( vdp_ctx->opts->c_boolean )
+    {
+    case '1' :  if ( value == 0 )
+                    rc = vdp_print_string( vdp_ctx, "0" );
+                else
+                    rc = vdp_print_string( vdp_ctx, "1" );
+                break;
+    case 'T' :  if ( value == 0 )
+                    rc = vdp_print_string( vdp_ctx, "F" );
+                else
+                    rc = vdp_print_string( vdp_ctx, "T" );
+                break;
+
+    default  :  if ( value == 0 )
+                    rc = vdp_print_string( vdp_ctx, "false" );
+                else
+                    rc = vdp_print_string( vdp_ctx, "true" );
+                break;
+    }
+    return rc;
+}
+
+
+static const char * uint_hex_fmt = "0x%lX";
+static const char * uint_dec_fmt = "%lu";
+static const char * int_dec_fmt = "%ld";
+
+static rc_t vdp_uint( vdp_context * vdp_ctx )
+{
+    rc_t rc = 0;
+    uint64_t value = vdp_move_to_uint64( vdp_ctx );
+    if ( ( vdp_ctx->opts->without_sra_types == false )/*&&( def->value_trans_fct != NULL )*/ )
+    {
+/*
+        const char *txt = def->value_trans_fct( (uint32_t)value );
+        rc = vds_append_str( s, txt );
+*/
+    }
+    else
+    {
+        const char * fmt;
+        if ( vdp_ctx->opts->in_hex )
+            fmt = uint_hex_fmt;
+        else
+            fmt = uint_dec_fmt;
+
+        if ( vdp_ctx->buf == NULL )
+            rc = KOutMsg( fmt, value );
+        else
+            rc = vdp_print( vdp_ctx, fmt, value );
+    }
+    return rc;
+}
+
+
+static rc_t vdp_int( vdp_context * vdp_ctx )
+{
+    rc_t rc = 0;
+    int64_t value = (int64_t)vdp_move_to_uint64( vdp_ctx );
+    if ( ( vdp_ctx->opts->without_sra_types == false )/*&&( def->value_trans_fct != NULL )*/ )
+    {
+/*
+        const char *txt = def->value_trans_fct( (uint32_t)value );
+        rc = vds_append_str( s, txt );
+*/
+    }
+    else
+    {
+        const char * fmt;
+
+        switch ( vdp_ctx->type_desc->intrinsic_bits )
+        {
+            case  8 : { int8_t temp = (int8_t)value;
+                        value = temp; }
+                      break;
+            case 16 : { int16_t temp = (int16_t)value;
+                        value = temp; }
+                      break;
+            case 32 : { int32_t temp = (int32_t)value;
+                        value = temp; }
+                      break;
+        }
+
+        if ( vdp_ctx->opts->in_hex )
+            fmt = uint_hex_fmt;
+        else
+            fmt = int_dec_fmt;
+
+        if ( vdp_ctx->buf == NULL )
+            rc = KOutMsg( fmt, value );
+        else
+            rc = vdp_print( vdp_ctx, fmt, value );
+    }
+    return rc;
+}
+
+
+#define BITSIZE_OF_FLOAT ( sizeof(float) * 8 )
+#define BITSIZE_OF_DOUBLE ( sizeof(double) * 8 )
+static const char * float_fmt = "%e";
+static const char * unknown_float_fmt = "unknown float-type";
+
+static rc_t vdp_float( vdp_context * vdp_ctx )
+{
+    rc_t rc;
+    if ( vdp_ctx->opts->in_hex )
+        rc = vdp_int( vdp_ctx );
+    else
+    {
+        uint32_t n_bits = vdp_ctx->type_desc->intrinsic_bits;
+        if ( n_bits == BITSIZE_OF_FLOAT )
+        {
+            float value;
+            vdp_move_to_value( &value, vdp_ctx, n_bits );
+            if ( vdp_ctx->buf == NULL )
+                rc = KOutMsg( float_fmt, value );
+            else
+                rc = vdp_print( vdp_ctx, float_fmt, value );
+        }
+        else if ( n_bits == BITSIZE_OF_DOUBLE )
+        {
+            double value;
+            vdp_move_to_value( &value, vdp_ctx, n_bits );
+            if ( vdp_ctx->buf == NULL )
+                rc = KOutMsg( float_fmt, value );
+            else
+                rc = vdp_print( vdp_ctx, float_fmt, value );
+        }
+        else
+        {
+            rc = vdp_print_string( vdp_ctx, unknown_float_fmt );
+        }
+        vdp_ctx->offset_in_bits += n_bits;
+    }
+    return rc;
+}
+
+
+static const char * txt_fmt = "%.*s";
+
+static rc_t vdp_txt_ascii( vdp_context * vdp_ctx )
+{
+    rc_t rc;
+    char *src_ptr = (char*)vdp_ctx->buf + BYTE_OFFSET( vdp_ctx->offset_in_bits );
+    if ( vdp_ctx->buf == NULL )
+        rc = KOutMsg( txt_fmt, vdp_ctx->row_len, src_ptr );
+    else
+        rc = vdp_print( vdp_ctx, txt_fmt, vdp_ctx->row_len, src_ptr );
+    return rc;
+}
+
+
+static rc_t vdp_hex_char( char * temp, uint32_t * idx, const uint8_t c )
+{
+    char s[ 8 ];
+    size_t num_writ;
+    rc_t rc = string_printf ( s, sizeof s, &num_writ, "%X ", c );
+    if ( rc == 0 )
+    {
+        size_t i;
+        for ( i = 0; i < num_writ; ++i )
+            temp[ (*idx)++ ] = s[ i ];
+    }
+    return rc;
+}
+
+
+static rc_t vdp_hex_ascii( vdp_context * vdp_ctx )
+{
+    rc_t rc = 0;
+    char *src_ptr = (char*)vdp_ctx->buf + BYTE_OFFSET( vdp_ctx->offset_in_bits );
+    char *tmp = malloc( ( vdp_ctx->row_len + 1 ) * 4 );
+    if ( tmp != NULL )
+    {
+        uint32_t i, dst = 0;
+        for ( i = 0; i < vdp_ctx->row_len && rc == 0; ++i )
+            rc = vdp_hex_char( tmp, &dst, src_ptr[ i ] );
+        src_ptr[ dst ] = 0;
+        if ( rc == 0 )
+        {
+            if ( vdp_ctx->buf == NULL )
+                rc = KOutMsg( txt_fmt, dst, tmp );
+            else
+                rc = vdp_print( vdp_ctx, txt_fmt, dst, tmp );
+        }
+        free( tmp );
+    }
+    else
+        rc = RC( rcVDB, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+    return rc;
+}
+
+
+static rc_t vdp_ascii( vdp_context * vdp_ctx )
+{
+    rc_t rc;
+
+    if ( vdp_ctx->opts->in_hex )
+        rc = vdp_hex_ascii( vdp_ctx );
+    else
+        rc = vdp_txt_ascii( vdp_ctx );
+
+    if ( rc == 0 )
+    {
+        vdp_ctx->elem_idx += vdp_ctx->row_len;
+        vdp_ctx->offset_in_bits += ( vdp_ctx->type_desc->intrinsic_bits * vdp_ctx->row_len );
+    }
+    return rc;
+}
+
+
+static rc_t vdp_unicode( vdp_context * vdp_ctx )
+{
+    return vdp_ascii( vdp_ctx );
+}
+
+
+/* !!!!!!!! this depends on how domains are defined in "schema.h" */
+vdp_fkt vdp_dispatch[] =
+{
+    vdp_boolean,
+    vdp_uint,
+    vdp_int,
+    vdp_float,
+    vdp_ascii,
+    vdp_unicode
+};
+
+
+static rc_t vdp_print_elem( vdp_context * vdp_ctx )
+{
+    rc_t rc = 0;
+
+    return rc;
+}
+
+
+rc_t vdp_print_cell_cmn( char * buf, size_t buf_size, size_t *num_written,
+                         const uint32_t elem_bits, const void * base, uint32_t boff, uint32_t row_len,
+                         const VTypedesc * type_desc, vdp_opts * opts )
+{
+    rc_t rc = 0;
+    vdp_context vdp_ctx;
+    vdp_ctx.selection = ( type_desc->domain - 1 );
+    if ( vdp_ctx.selection < 0 || 
+         vdp_ctx.selection > ( sizeof vdp_dispatch / sizeof vdp_dispatch[ 0 ] ) )
+    {
+        rc = RC( rcVDB, rcNoTarg, rcVisiting, rcOffset, rcInvalid );
+    }
+    else
+    {
+        vdp_ctx.base = base;
+        vdp_ctx.opts = opts;
+        vdp_ctx.type_desc = type_desc;
+        vdp_ctx.elem_bits = elem_bits;
+        vdp_ctx.boff = boff;
+        vdp_ctx.row_len = row_len;
+        vdp_ctx.elem_idx = 0;
+
+        vdp_ctx.buf = buf;
+        vdp_ctx.buf_size = buf_size;
+        vdp_ctx.printed_so_far = 0;
+        vdp_ctx.buf_filled = false;
+        vdp_ctx.offset_in_bits = 0;
+
+        if ( ( type_desc->domain < vtdBool ) || ( type_desc->domain > vtdUnicode ) )
+        {
+            rc = vdp_print_string( &vdp_ctx, "unknown data-type" );
+        }
+        else
+        {
+            bool print_comma = true;
+
+            /* hardcoded printing of dna-bases if the column-type fits */
+            vdp_ctx.print_dna_bases = ( opts->print_dna_bases &
+                        ( type_desc->intrinsic_dim == 2 ) &
+                        ( type_desc->intrinsic_bits == 1 ) );
+
+            if ( ( type_desc->domain == vtdBool ) && opts->c_boolean )
+            {
+                print_comma = false;
+            }
+
+            while( ( vdp_ctx.elem_idx < row_len ) && ( rc == 0 ) && ( !vdp_ctx.buf_filled ) )
+            {
+                uint32_t eidx = vdp_ctx.elem_idx;
+
+                if ( ( eidx > 0 )&& ( vdp_ctx.print_dna_bases == false ) && print_comma )
+                {
+                    rc = vdp_print_string( &vdp_ctx, ", " );
+                }
+
+                /* dumps the basic data-types, implementation above
+                   >>> that means it appends or prints to stdout the element-string
+                   inc the vdb_ctx.element_idx by: 1...bool/int/uint/float
+                                                   n...string/unicode-string */
+                rc = vdp_print_elem( &vdp_ctx );
+
+                /* insurance against endless loop */
+                if ( eidx == vdp_ctx.elem_idx )
+                {
+                    vdp_ctx.elem_idx++;
+                }
+            }
+        }
+    }
+    return rc;
+}
+
+
+rc_t vdp_print_cell_2_buffer( char * buffer, size_t bufsize, size_t *num_written,
+                              const uint32_t elem_bits, const void * base, uint32_t boff, uint32_t row_len,
+                              const VTypedesc * type_desc, vdp_opts * opts )
+{
+    rc_t rc = 0;
+
+    if ( base == NULL || type_desc == NULL || buffer == NULL || opts == NULL )
+    {
+        rc = RC( rcVDB, rcNoTarg, rcVisiting, rcParam, rcNull );
+    }
+    else
+    {
+        rc = vdp_print_cell_cmn( buffer, bufsize, num_written, elem_bits, base, boff, row_len, type_desc, opts );
+    }
+    return rc;
+}
+
+
+rc_t vdp_print_cell( const uint32_t elem_bits, const void * base, uint32_t boff, uint32_t row_len,
+                     const VTypedesc * type_desc, vdp_opts * opts )
+{
+    rc_t rc = 0;
+
+    if ( base == NULL || type_desc == NULL || opts == NULL )
+    {
+        rc = RC( rcVDB, rcNoTarg, rcVisiting, rcParam, rcNull );
+    }
+    else
+    {
+        rc = vdp_print_cell_cmn( NULL, 0, NULL, elem_bits, base, boff, row_len, type_desc, opts );
+    }
+    return rc;
+}
\ No newline at end of file
diff --git a/tools/vdb-dump/vdb-dump-print.h b/tools/vdb-dump/vdb-dump-print.h
new file mode 100644
index 0000000..e493ca8
--- /dev/null
+++ b/tools/vdb-dump/vdb-dump-print.h
@@ -0,0 +1,73 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+
+#ifndef _h_vdb_dump_print_
+#define _h_vdb_dump_print_
+
+#include <vdb/schema.h> /* for VTypedesc */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct vdp_opts
+{
+    bool print_dna_bases;
+    bool in_hex;
+    bool without_sra_types;
+    char c_boolean; /* how boolean is printed '1' ... 0/1, 'T' ... T/F, /0 ... true/false */
+} vdp_opts;
+
+
+/* vdp_print_cell
+ *  prints the content of a cursor-cell to stdout
+ *
+ *
+ *  "elem_bits" [ IN ] - element size in bits
+ *
+ *  "base" [ IN ] - pointer to cell starting bit
+ *
+ *  "boff" [ IN ] - bit offset in BITS of first bit to be printed
+ *
+ *  "row_len" [ IN ] - the number of elements in cell
+ *
+ *  "type_desc" [ IN ] - type description of the cell ( from schema )
+ */
+
+rc_t vdp_print_cell_2_buffer( char * buf, size_t buf_size, size_t *num_written,
+                              const uint32_t elem_bits, const void * base, uint32_t boff, uint32_t row_len,
+                              const VTypedesc * type_desc, vdp_opts * opts );
+
+rc_t vdp_print_cell( const uint32_t elem_bits, const void * base, uint32_t boff, uint32_t row_len,
+                     const VTypedesc * type_desc, vdp_opts * opts );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
\ No newline at end of file
diff --git a/tools/vdb-dump/vdb-dump.c b/tools/vdb-dump/vdb-dump.c
index 85dc13d..37ed36b 100644
--- a/tools/vdb-dump/vdb-dump.c
+++ b/tools/vdb-dump/vdb-dump.c
@@ -72,6 +72,8 @@
 #include "vdb-dump-formats.h"
 #include "vdb-dump-fastq.h"
 #include "vdb-dump-redir.h"
+#include "vdb-dump-bin.h"
+#include "vdb_info.h"
 
 static const char * row_id_on_usage[] = { "print row id", NULL };
 static const char * line_feed_usage[] = { "line-feed's inbetween rows", NULL };
@@ -89,7 +91,7 @@ static const char * dna_bases_usage[] = { "print dna-bases", NULL };
 static const char * max_line_len_usage[] = { "limits line length", NULL };
 static const char * line_indent_usage[] = { "indents the line", NULL };
 static const char * filter_usage[] = { "filters lines", NULL };
-static const char * format_usage[] = { "dump format (csv,xml,json,piped,tab,fastq,fasta)", NULL };
+static const char * format_usage[] = { "dump format (csv,xml,json,piped,tab,fastq,fasta,bin)", NULL };
 static const char * id_range_usage[] = { "prints id-range", NULL };
 static const char * without_sra_usage[] = { "without sra-type-translation", NULL };
 static const char * without_accession_usage[] = { "without accession-test", NULL };
@@ -102,14 +104,16 @@ static const char * numelemsum_usage[] = { "sum element-count", NULL };
 static const char * show_blobbing_usage[] = { "show blobbing", NULL };
 static const char * enum_phys_usage[] = { "enumerate physical columns", NULL };
 static const char * objtype_usage[] = { "report type of object", NULL };
-static const char * idx_enum_usage[] = { "enumerate available index", NULL };
-static const char * idx_range_usage[] = { "show row-range of idx entry", NULL };
+static const char * idx_enum_usage[] = { "enumerate all available index", NULL };
+static const char * idx_range_usage[] = { "enumerate values and row-ranges of one index", NULL };
 static const char * cur_cache_usage[] = { "size of cursor cache", NULL };
 static const char * out_file_usage[] = { "write output to this file", NULL };
+static const char * out_path_usage[] = { "write output to this directory", NULL };
 static const char * gzip_usage[] = { "compress output using gzip", NULL };
 static const char * bzip2_usage[] = { "compress output using bzip2", NULL };
 static const char * outbuf_size_usage[] = { "size of output-buffer, 0...none", NULL };
 static const char * disable_mt_usage[] = { "disable multithreading", NULL };
+static const char * info_usage[] = { "print info about run", NULL };
 
 OptDef DumpOptions[] =
 {
@@ -147,10 +151,13 @@ OptDef DumpOptions[] =
     { OPTION_IDX_RANGE, NULL, NULL, idx_range_usage, 1, true, false },
     { OPTION_CUR_CACHE, NULL, NULL, cur_cache_usage, 1, true, false },
     { OPTION_OUT_FILE, NULL, NULL, out_file_usage, 1, true, false },
+    { OPTION_OUT_PATH, NULL, NULL, out_path_usage, 1, true, false },
+    { OPTION_PHASE, NULL, NULL, NULL, 1, true, false },
     { OPTION_GZIP, NULL, NULL, gzip_usage, 1, false, false },
     { OPTION_BZIP2, NULL, NULL, bzip2_usage, 1, false, false },
     { OPTION_OUT_BUF_SIZE, NULL, NULL, outbuf_size_usage, 1, true, false },
     { OPTION_NO_MULTITHREAD, NULL, NULL, disable_mt_usage, 1, false, false },
+    { OPTION_INFO, NULL, NULL, info_usage, 1, false, false }
 };
 
 const char UsageDefaultName[] = "vdb-dump";
@@ -215,11 +222,13 @@ rc_t CC Usage ( const Args * args )
     HelpOptionLine ( NULL, OPTION_IDX_RANGE, NULL, idx_range_usage );	
     HelpOptionLine ( NULL, OPTION_CUR_CACHE, NULL, cur_cache_usage );	
     HelpOptionLine ( NULL, OPTION_OUT_FILE, NULL, out_file_usage );
+    HelpOptionLine ( NULL, OPTION_OUT_PATH, NULL, out_path_usage );
     HelpOptionLine ( NULL, OPTION_GZIP, NULL, gzip_usage );
     HelpOptionLine ( NULL, OPTION_BZIP2, NULL, bzip2_usage );
     HelpOptionLine ( NULL, OPTION_OUT_BUF_SIZE, NULL, outbuf_size_usage );
     HelpOptionLine ( NULL, OPTION_NO_MULTITHREAD, NULL, disable_mt_usage );
-    
+    HelpOptionLine ( NULL, OPTION_INFO, NULL, info_usage );
+
     HelpOptionsStandard ();
 
     HelpVersion ( fullpath, KAppVersion() );
@@ -534,81 +543,85 @@ my_table  [IN] ... open table needed for vdb-calls
 *************************************************************************************/
 static rc_t vdm_dump_opened_table( const p_dump_context ctx, const VTable *my_table )
 {
-    row_context r_ctx;
-    rc_t rc = VTableCreateCachedCursorRead( my_table, &(r_ctx.cursor), ctx->cur_cache_size );
-    DISP_RC( rc, "VTableCreateCursorRead() failed" );
-    if ( rc == 0 )
+    rc_t rc;
+
+    if ( ctx->format == df_bin )
     {
-        r_ctx.table = my_table;
-        if ( !vdcd_init( &(r_ctx.col_defs), ctx->max_line_len ) )
-        {
-            rc = RC( rcVDB, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
-            DISP_RC( rc, "col_defs_init() failed" );
-        }
+        rc = vdi_dump_opened_table( ctx, my_table ); /* from vdb-dump-bin.c */
+    }
+    else
+    {
+        row_context r_ctx;
 
+        rc = VTableCreateCachedCursorRead( my_table, &(r_ctx.cursor), ctx->cur_cache_size );
+        DISP_RC( rc, "VTableCreateCursorRead() failed" );
         if ( rc == 0 )
         {
-            uint32_t n = vdm_extract_or_parse_columns( ctx, my_table, r_ctx.col_defs );
-            if ( n > 0 )
+            r_ctx.table = my_table;
+            if ( !vdcd_init( &(r_ctx.col_defs), ctx->max_line_len ) )
             {
-                n = vdcd_add_to_cursor( r_ctx.col_defs, r_ctx.cursor );
-                if ( n > 0 )
+                rc = RC( rcVDB, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
+                DISP_RC( rc, "col_defs_init() failed" );
+            }
+
+            if ( rc == 0 )
+            {
+                uint32_t n = vdm_extract_or_parse_columns( ctx, my_table, r_ctx.col_defs );
+                if ( n < 1 )
+                    rc = RC( rcVDB, rcNoTarg, rcConstructing, rcParam, rcInvalid );
+                else
                 {
-                    const VSchema *my_schema;
-                    rc = VTableOpenSchema( my_table, &my_schema );
-                    DISP_RC( rc, "VTableOpenSchema() failed" );
-                    if ( rc == 0 )
+                    n = vdcd_add_to_cursor( r_ctx.col_defs, r_ctx.cursor );
+                    if ( n < 1 )
+                        rc = RC( rcVDB, rcNoTarg, rcConstructing, rcParam, rcInvalid );
+                    else
                     {
-                    /* translate in special columns to numeric values to strings */
-                        vdcd_ins_trans_fkt( r_ctx.col_defs, my_schema );
-                        VSchemaRelease( my_schema );
-                    }
+                        const VSchema *my_schema;
+                        rc = VTableOpenSchema( my_table, &my_schema );
+                        DISP_RC( rc, "VTableOpenSchema() failed" );
+                        if ( rc == 0 )
+                        {
+                            /* translate in special columns to numeric values to strings */
+                            vdcd_ins_trans_fkt( r_ctx.col_defs, my_schema );
+                            VSchemaRelease( my_schema );
+                        }
 
-                    rc = VCursorOpen( r_ctx.cursor );
-                    DISP_RC( rc, "VCursorOpen() failed" );
-                    if ( rc == 0 )
-                    {
-                        int64_t  first;
-                        uint64_t count;
-                        rc = VCursorIdRange( r_ctx.cursor, 0, &first, &count );
-                        DISP_RC( rc, "VCursorIdRange() failed" );
+                        rc = VCursorOpen( r_ctx.cursor );
+                        DISP_RC( rc, "VCursorOpen() failed" );
                         if ( rc == 0 )
                         {
-                            /* if the user did not specify a row-range, take all rows */
-                            if ( vdn_range_defined( ctx->row_generator ) == false )
-                            {
-                                vdn_set_range( ctx->row_generator, first, count );
-                            }
-                            /* if the user did specify a row-range, check the boundaries */
-                            else
+                            int64_t  first;
+                            uint64_t count;
+                            rc = VCursorIdRange( r_ctx.cursor, 0, &first, &count );
+                            DISP_RC( rc, "VCursorIdRange() failed" );
+                            if ( rc == 0 )
                             {
-                                vdn_check_range( ctx->row_generator, first, count );
-                            }
+                                if ( vdn_range_defined( ctx->row_generator ) == false )
+                                {
+                                    /* if the user did not specify a row-range, take all rows */
+                                    vdn_set_range( ctx->row_generator, first, count );
+                                }
+                                else
+                                {
+                                    /* if the user did specify a row-range, check the boundaries */
+                                    vdn_check_range( ctx->row_generator, first, count );
+                                }
 
-                            if ( vdn_range_defined( ctx->row_generator ) )
-                            {
-                                r_ctx.ctx = ctx;
-                                rc = vdm_dump_rows( &r_ctx ); /* <--- */
-                            }
-                            else
-                            {
-                                rc = RC( rcExe, rcDatabase, rcReading, rcRange, rcEmpty );
+                                if ( vdn_range_defined( ctx->row_generator ) )
+                                {
+                                    r_ctx.ctx = ctx;
+                                    rc = vdm_dump_rows( &r_ctx ); /* <--- */
+                                }
+                                else
+                                    rc = RC( rcExe, rcDatabase, rcReading, rcRange, rcEmpty );
                             }
                         }
                     }
                 }
-                else
-                {
-                    rc = RC( rcVDB, rcNoTarg, rcConstructing, rcParam, rcInvalid );
-                }
-            }
-            else
-            {
-                rc = RC( rcVDB, rcNoTarg, rcConstructing, rcParam, rcInvalid );
+                vdcd_destroy( r_ctx.col_defs );
             }
-            vdcd_destroy( r_ctx.col_defs );
+            VCursorRelease( r_ctx.cursor );
         }
-        VCursorRelease( r_ctx.cursor );
     }
     return rc;
 }
@@ -629,7 +642,7 @@ static rc_t vdm_dump_opened_database( const p_dump_context ctx,
     rc_t rc;
     const VTable *my_table;
 
-    rc = VDatabaseOpenTableRead( my_database, &my_table, ctx->table );
+    rc = VDatabaseOpenTableRead( my_database, &my_table, "%s", ctx->table );
     DISP_RC( rc, "VDatabaseOpenTableRead() failed" );
     if ( rc == 0 )
     {
@@ -690,7 +703,7 @@ static rc_t vdm_dump_db_schema( const p_dump_context ctx,
                                 const VDatabase *my_database )
 {
     const VTable *my_table;
-    rc_t rc = VDatabaseOpenTableRead( my_database, &my_table, ctx->table );
+    rc_t rc = VDatabaseOpenTableRead( my_database, &my_table, "%s", ctx->table );
     DISP_RC( rc, "VDatabaseOpenTableRead() failed" );
     if ( rc == 0 )
     {
@@ -1007,7 +1020,7 @@ static rc_t vdm_enum_db_columns( const p_dump_context ctx, const VDatabase *my_d
     rc_t rc;
     const VTable *my_table;
 
-    rc = VDatabaseOpenTableRead( my_database, &my_table, ctx->table );
+    rc = VDatabaseOpenTableRead( my_database, &my_table, "%s", ctx->table );
     DISP_RC( rc, "VDatabaseOpenTableRead() failed" );
     if ( rc == 0 )
     {
@@ -1045,7 +1058,11 @@ static rc_t vdm_print_tab_id_range( const p_dump_context ctx, const VTable *my_t
                     {
                         int64_t  first;
                         uint64_t count;
-                        rc = VCursorIdRange( my_cursor, 0, &first, &count );
+
+                        uint32_t idx = 0;
+                        vdcd_get_first_none_static_column_idx( my_col_defs, my_cursor, &idx );
+
+                        rc = VCursorIdRange( my_cursor, idx, &first, &count );
                         DISP_RC( rc, "VCursorIdRange() failed" );
                         if ( rc == 0 )
                             rc = KOutMsg( "id-range: first-row = %,ld, row-count = %,ld\n", first, count );
@@ -1074,7 +1091,7 @@ static rc_t vdm_print_db_id_range( const p_dump_context ctx, const VDatabase *my
     rc_t rc;
     const VTable *my_table;
 
-    rc = VDatabaseOpenTableRead( my_database, &my_table, ctx->table );
+    rc = VDatabaseOpenTableRead( my_database, &my_table, "%s", ctx->table );
     DISP_RC( rc, "VDatabaseOpenTableRead() failed" );
     if ( rc == 0 )
     {
@@ -1094,7 +1111,7 @@ static rc_t vdm_enum_index( const KTable * my_ktable, uint32_t idx_nr, const cha
 	if ( rc == 0 )
 	{
 		const KIndex * my_idx;
-		rc = KTableOpenIndexRead ( my_ktable, &my_idx, idx_name );
+		rc = KTableOpenIndexRead ( my_ktable, &my_idx, "%s", idx_name );
 		if ( rc != 0 )
 			rc = KOutMsg( " (cannot open)" );
 		else
@@ -1178,7 +1195,7 @@ static rc_t vdm_enum_db_index( const p_dump_context ctx, const VDatabase *my_dat
     rc_t rc;
     const VTable *my_table;
 
-    rc = VDatabaseOpenTableRead( my_database, &my_table, ctx->table );
+    rc = VDatabaseOpenTableRead( my_database, &my_table, "%s", ctx->table );
     DISP_RC( rc, "VDatabaseOpenTableRead() failed" );
     if ( rc == 0 )
     {
@@ -1191,11 +1208,6 @@ static rc_t vdm_enum_db_index( const p_dump_context ctx, const VDatabase *my_dat
 
 /* ************************************************************************************ */
 
-static rc_t CC on_index_range( int64_t start_id, uint64_t id_count, void * data )
-{
-	return KOutMsg( "from %lu to %lu\n", start_id, start_id + id_count - 1 );
-}
-
 static rc_t vdm_range_tab_index( const p_dump_context ctx, const VTable *my_table )
 {
 	const KTable * my_ktable;
@@ -1203,25 +1215,27 @@ static rc_t vdm_range_tab_index( const p_dump_context ctx, const VTable *my_tabl
 	DISP_RC( rc, "VTableOpenKTableRead() failed" );
 	if ( rc == 0 )
 	{
-		size_t s = string_size( ctx->idx_range );
-		char * equal = string_chr ( ctx->idx_range, s, '=' );
-		if ( equal == NULL )
-			rc = KOutMsg( "usage: IDX_NAME=VALUE\n" );
-		else
-		{
-			const KIndex * my_idx;
-			char * idx_name = string_dup( ctx->idx_range, (size_t)( equal - ( ctx->idx_range ) ) );
-			rc = KTableOpenIndexRead ( my_ktable, &my_idx, idx_name );
-			if ( rc != 0 )
-				rc = KOutMsg( "cannot open index '%s'", idx_name );
-			else
-			{
-				KOutMsg( "index '%s' opened\n", idx_name );
-				rc = KIndexFindAllText ( my_idx, equal + 1, on_index_range, NULL );
-    			KIndexRelease( my_idx );
-			}
-			free( idx_name );
-		}
+        const KIndex * my_kindex;
+        rc = KTableOpenIndexRead ( my_ktable, &my_kindex, "%s", ctx->idx_range );
+        DISP_RC( rc, "KTableOpenIndexRead() failed" );
+        if ( rc == 0 )
+        {
+            int64_t start;
+            uint64_t count;
+            rc_t rc2 = 0;
+
+            for ( start = 1; rc2 == 0 && rc == 0; start += count )
+            {
+                size_t key_size;
+                char key [ 4096 ];
+                rc2 = KIndexProjectText ( my_kindex, start, &start, &count,
+                                         key, sizeof key, &key_size );
+                if ( rc2 == 0 )
+                    rc = KOutMsg( "%.*s : %lu ... %lu\n", ( int )key_size, key, start, start + count - 1 );
+            }
+
+            KIndexRelease( my_kindex );
+        }
 		KTableRelease( my_ktable );
 	}
 	return rc;
@@ -1233,7 +1247,7 @@ static rc_t vdm_range_db_index( const p_dump_context ctx, const VDatabase *my_da
     rc_t rc;
     const VTable *my_table;
 
-    rc = VDatabaseOpenTableRead( my_database, &my_table, ctx->table );
+    rc = VDatabaseOpenTableRead( my_database, &my_table, "%s", ctx->table );
     DISP_RC( rc, "VDatabaseOpenTableRead() failed" );
     if ( rc == 0 )
     {
@@ -1272,7 +1286,7 @@ static rc_t vdm_dump_tab_fkt( const p_dump_context ctx,
 
     vdh_parse_schema( my_manager, &my_schema, &(ctx->schema_list) );
 
-    rc = VDBManagerOpenTableRead( my_manager, &my_table, my_schema, ctx->path );
+    rc = VDBManagerOpenTableRead( my_manager, &my_table, my_schema, "%s", ctx->path );
     DISP_RC( rc, "VDBManagerOpenTableRead() failed" );
     if ( rc == 0 )
     {
@@ -1376,7 +1390,7 @@ static rc_t vdm_dump_db_fkt( const p_dump_context ctx,
 
     vdh_parse_schema( my_manager, &my_schema, &(ctx->schema_list) );
 
-    rc = VDBManagerOpenDBRead( my_manager, &my_database, my_schema, ctx->path );
+    rc = VDBManagerOpenDBRead( my_manager, &my_database, my_schema, "%s", ctx->path );
     DISP_RC( rc, "VDBManagerOpenDBRead() failed" );
     if ( rc == 0 )
     {
@@ -1489,7 +1503,7 @@ static rc_t vdm_print_objts ( const p_dump_context ctx, const VDBManager *mgr )
 
 static void vdm_print_objtype( const VDBManager *mgr, const char * acc_or_path )
 {
-    int path_type = ( VDBManagerPathType ( mgr, acc_or_path ) & ~ kptAlias );
+    int path_type = ( VDBManagerPathType ( mgr, "%s", acc_or_path ) & ~ kptAlias );
     /* types defined in <kdb/manager.h> */
     switch ( path_type )
     {
@@ -1517,7 +1531,7 @@ static rc_t vdb_main_one_obj_by_pathtype( const p_dump_context ctx,
                                           const VDBManager *mgr )
 {
     rc_t rc;
-    int path_type = ( VDBManagerPathType ( mgr, ctx->path ) & ~ kptAlias );
+    int path_type = ( VDBManagerPathType ( mgr, "%s", ctx->path ) & ~ kptAlias );
     /* types defined in <kdb/manager.h> */
     switch ( path_type )
     {
@@ -1672,10 +1686,15 @@ static rc_t vdm_main( const p_dump_context ctx, Args * args )
                             DISP_RC( rc, "ArgsParamValue() failed" );
                             if ( rc == 0 )
                             {
-                                switch( ctx->format )
+                                if ( ctx->print_info )
+                                {
+                                    rc = vdb_info( &(ctx->schema_list), ctx->format, mgr,
+                                                   value, ctx->row_generator );   /* in vdb_info.c */
+                                }
+                                else switch( ctx->format )
                                 {
                                     case df_fastq : ;
-                                    case df_fasta : vdf_main( ctx, mgr, value ); break;                                    
+                                    case df_fasta : vdf_main( ctx, mgr, value ); break;
                                     default : rc = vdm_main_one_obj( ctx, mgr, value ); break;
                                 }
                             }
@@ -1745,7 +1764,10 @@ rc_t CC KMain ( int argc, char *argv [] )
                                      ctx->output_buffer_size ); /* vdb-dump-redir.c */
                 if ( rc == 0 )
                 {
-                    rc = vdm_main( ctx, args );
+                    if ( ctx->phase > 0 )
+                        rc = vdi_bin_phase( ctx, args );
+                    else
+                        rc = vdm_main( ctx, args );
                     release_out_redir( &redir ); /* vdb-dump-redir.c */
                 }
             }
diff --git a/tools/vdb-dump/vdb-dump.vers b/tools/vdb-dump/vdb-dump.vers
index cc6c9a4..8e8299d 100644
--- a/tools/vdb-dump/vdb-dump.vers
+++ b/tools/vdb-dump/vdb-dump.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/vdb-dump/vdb-dump.vers.h b/tools/vdb-dump/vdb-dump.vers.h
new file mode 100644
index 0000000..a0148a1
--- /dev/null
+++ b/tools/vdb-dump/vdb-dump.vers.h
@@ -0,0 +1 @@
+#define VDB_DUMP_VERS 0x02040002
diff --git a/tools/vdb-dump/vdb_info.c b/tools/vdb-dump/vdb_info.c
new file mode 100644
index 0000000..27bb19e
--- /dev/null
+++ b/tools/vdb-dump/vdb_info.c
@@ -0,0 +1,1205 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <klib/rc.h>
+#include <klib/out.h>
+#include <klib/time.h>
+#include <klib/printf.h>
+
+#include <kfs/directory.h>
+#include <kfs/file.h>
+
+#include <kdb/manager.h>
+#include <kdb/meta.h>
+
+#include <vdb/manager.h>
+#include <vdb/schema.h>
+#include <vdb/table.h>
+#include <vdb/cursor.h>
+#include <vdb/database.h>
+#include <vdb/vdb-priv.h>
+
+#include "vdb-dump-context.h"
+#include "vdb-dump-helper.h"
+#include "vdb-dump-coldefs.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+static const char * PT_DATABASE = "Database";
+static const char * PT_TABLE    = "Table";
+static const char * PT_NONE     = "None";
+
+typedef struct vdb_info_vers
+{
+    char s_vers[ 16 ];
+    uint8_t major, minor, release;
+} vdb_info_vers;
+
+
+typedef struct vdb_info_date
+{
+    char date[ 32 ];
+    uint64_t timestamp;
+
+    uint16_t year;
+    uint8_t month;
+    uint8_t day;
+    uint8_t hour;
+    uint8_t minute;
+} vdb_info_date;
+
+typedef struct vdb_info_event
+{
+    char name[ 32 ];
+    vdb_info_vers vers;
+    vdb_info_date tool_date;
+    vdb_info_date run_date;
+} vdb_info_event;
+
+
+typedef struct vdb_info_data
+{
+    const char * acc;
+    const char * s_path_type;
+    const char * s_platform;
+
+    char path[ 1024 ];
+    char schema_name[ 1024 ];
+
+    vdb_info_event formatter;
+    vdb_info_event loader;
+    vdb_info_event update;
+
+    vdb_info_date ts;
+    
+    uint64_t seq_rows;
+    uint64_t ref_rows;
+    uint64_t prim_rows;
+    uint64_t sec_rows;
+    uint64_t ev_rows;
+    uint64_t ev_int_rows;
+    uint64_t consensus_rows;
+    uint64_t passes_rows;
+    uint64_t metrics_rows;
+
+    uint64_t file_size;
+} vdb_info_data;
+
+
+/* ----------------------------------------------------------------------------- */
+
+typedef struct split_vers_ctx
+{
+    char tmp[ 32 ];
+    uint32_t dst;
+    uint32_t sel;
+} split_vers_ctx;
+
+static void store_vers( vdb_info_vers * vers, split_vers_ctx * ctx )
+{
+    ctx->tmp[ ctx->dst ] = 0;
+    switch ( ctx->sel )
+    {
+        case 0 : vers->major = atoi( ctx->tmp ); break;
+        case 1 : vers->minor = atoi( ctx->tmp ); break;
+        case 2 : vers->release = atoi( ctx->tmp ); break;
+    }
+    ctx->sel++;
+    ctx->dst = 0;
+}
+
+static void split_vers( vdb_info_vers * vers )
+{
+    uint32_t i, l = string_measure ( vers->s_vers, NULL );
+    split_vers_ctx ctx;
+    memset( &ctx, 0, sizeof ctx );
+    for ( i = 0; i < l; ++i )
+    {
+        char c = vers->s_vers[ i ];
+        if ( c >= '0' && c <= '9' )
+            ctx.tmp[ ctx.dst++ ] = c;
+        else if ( c == '.' )
+            store_vers( vers, &ctx );
+    }
+    if ( ctx.dst > 0 )
+        store_vers( vers, &ctx );
+}
+
+/* ----------------------------------------------------------------------------- */
+
+typedef struct split_date_ctx
+{
+    char tmp[ 32 ];
+    uint32_t dst;
+} split_date_ctx;
+
+
+static uint8_t str_to_month_num( const char * s )
+{
+    uint8_t res = 0;
+    switch( s[ 0 ] )
+    {
+        case 'A' : ;
+        case 'a' : switch ( s[ 1 ] )
+                    {
+                        case 'P' : ;
+                        case 'p' : switch ( s[ 2 ] )
+                                    {
+                                        case 'R' :  ;
+                                        case 'r' :  res = 4; break;
+                                    }
+                                    break;
+                        case 'U' : ;
+                        case 'u' : switch ( s[ 2 ] )
+                                    {
+                                        case 'G' :  ;
+                                        case 'g' :  res = 8; break;
+                                    }
+                                    break;
+                    }
+                    break;
+
+        case 'F' : ;
+        case 'f' : switch ( s[ 1 ] )
+                    {
+                        case 'E' : ;
+                        case 'e' : switch ( s[ 2 ] )
+                                    {
+                                        case 'B' :  ;
+                                        case 'b' :  res = 2; break;
+                                    }
+                                    break;
+                    }
+                    break;
+
+        case 'J' : ;
+        case 'j' : switch ( s[ 1 ] )
+                    {
+                        case 'A' : ;
+                        case 'a' : switch ( s[ 2 ] )
+                                    {
+                                        case 'N' :  ;
+                                        case 'n' :  res = 1; break;
+                                    }
+                                    break;
+                        case 'U' : ;
+                        case 'u' : switch ( s[ 2 ] )
+                                    {
+                                        case 'N' :  ;
+                                        case 'n' :  res = 6; break;
+                                        case 'L' :  ;
+                                        case 'l' :  res = 7; break;
+                                    }
+                                    break;
+                    }
+                    break;
+
+        case 'M' : ;
+        case 'm' : switch ( s[ 1 ] )
+                    {
+                        case 'A' : ;
+                        case 'a' : switch ( s[ 2 ] )
+                                    {
+                                        case 'R' :  ;
+                                        case 'r' :  res = 3; break;
+                                        case 'Y' :  ;
+                                        case 'y' :  res = 5; break;
+                                    }
+                                    break;
+                    }
+                    break;
+
+        case 'S' : ;
+        case 's' : switch ( s[ 1 ] )
+                    {
+                        case 'E' : ;
+                        case 'e' : switch ( s[ 2 ] )
+                                    {
+                                        case 'P' :  ;
+                                        case 'p' :  res = 9; break;
+                                    }
+                                    break;
+                    }
+                    break;
+
+        case 'O' : ;
+        case 'o' : switch ( s[ 1 ] )
+                    {
+                        case 'C' : ;
+                        case 'c' : switch ( s[ 2 ] )
+                                    {
+                                        case 'T' :  ;
+                                        case 't' :  res = 10; break;
+                                    }
+                                    break;
+                    }
+                    break;
+
+        case 'N' : ;
+        case 'n' : switch ( s[ 1 ] )
+                    {
+                        case 'O' : ;
+                        case 'o' : switch ( s[ 2 ] )
+                                    {
+                                        case 'V' :  ;
+                                        case 'v' :  res = 11; break;
+                                    }
+                                    break;
+                    }
+                    break;
+
+        case 'D' : ;
+        case 'd' : switch ( s[ 1 ] )
+                    {
+                        case 'E' : ;
+                        case 'e' : switch ( s[ 2 ] )
+                                    {
+                                        case 'C' :  ;
+                                        case 'c' :  res = 12; break;
+                                    }
+                                    break;
+                    }
+                    break;
+    }
+    return res;
+}
+
+static void store_date( vdb_info_date * d, split_date_ctx * ctx )
+{
+    uint32_t l, value;
+
+    ctx->tmp[ ctx->dst ] = 0;
+    l = string_measure ( ctx->tmp, NULL );
+    value = atoi( ctx->tmp );
+    if ( l == 4 )
+        d->year = value;
+    else if ( ( l == 8 ) && ( ctx->tmp[ 2 ] == ':' ) && ( ctx->tmp[ 5 ] == ':' ) )
+    {
+        ctx->tmp[ 2 ] = 0;
+        d->hour = atoi( ctx->tmp );
+        ctx->tmp[ 5 ] = 0;
+        d->minute = atoi( &( ctx->tmp[ 3 ] ) );
+    }
+    else if ( l == 3 )
+    {
+        d->month = str_to_month_num( ctx->tmp );
+    }
+    else
+    {
+        d->day = value;
+    }
+    ctx->dst = 0;
+}
+
+static void split_date( vdb_info_date * d )
+{
+    uint32_t i, l = string_measure ( d->date, NULL );
+    split_date_ctx ctx;
+    memset( &ctx, 0, sizeof ctx );
+    for ( i = 0; i < l; ++i )
+    {
+        char c = d->date[ i ];
+        if ( c == ' ' )
+            store_date( d, &ctx );
+        else
+            ctx.tmp[ ctx.dst++ ] = c;
+    }
+    if ( ctx.dst > 0 )
+        store_date( d, &ctx );
+}
+
+/* ----------------------------------------------------------------------------- */
+
+static const char * get_platform( const VTable * tab )
+{
+    const char * res = PT_NONE;
+    const VCursor * cur;
+    rc_t rc = VTableCreateCursorRead( tab, &cur );
+    if ( rc == 0 )
+    {
+        uint32_t idx;
+        rc = VCursorAddColumn( cur, &idx, "PLATFORM" );
+        if ( rc == 0 )
+        {
+            rc = VCursorOpen( cur );
+            if ( rc == 0 )
+            {
+                const uint8_t * pf;
+                rc = VCursorCellDataDirect( cur, 1, idx, NULL, (const void**)&pf, NULL, NULL );
+                if ( rc == 0 )
+                {
+                    res = vdcd_get_platform_txt( *pf );
+                }
+            }
+        }
+        VCursorRelease( cur );
+    }
+    return res;
+}
+
+
+static uint64_t get_rowcount( const VTable * tab )
+{
+    uint64_t res = 0;
+    col_defs *my_col_defs;
+    if ( vdcd_init( &my_col_defs, 1024 ) )
+    {
+        if ( vdcd_extract_from_table( my_col_defs, tab ) > 0 )
+        {
+            const VCursor * cur;
+            rc_t rc = VTableCreateCursorRead( tab, &cur );
+            if ( rc == 0 )
+            {
+                if ( vdcd_add_to_cursor( my_col_defs, cur ) )
+                {
+                    rc = VCursorOpen( cur );
+                    if ( rc == 0 )
+                    {
+                        uint32_t idx;
+                        if ( vdcd_get_first_none_static_column_idx( my_col_defs, cur, &idx ) )
+                        {
+                            int64_t first;
+                            rc = VCursorIdRange( cur, idx, &first, &res );
+                        }
+                    }
+                }
+                VCursorRelease( cur );
+            }
+        }
+        vdcd_destroy( my_col_defs );
+    }
+    return res;
+}
+
+
+/* ----------------------------------------------------------------------------- */
+
+
+static void get_meta_attr( const KMDataNode * node, const char * key, char * dst, size_t dst_size )
+{
+    size_t size;
+    rc_t rc = KMDataNodeReadAttr ( node, key, dst, dst_size, &size );
+    if ( rc == 0 )
+        dst[ size ] = 0;
+}
+
+
+static void get_meta_event( const KMetadata * meta, const char * node_path, vdb_info_event * event )
+{
+    const KMDataNode * node;
+    rc_t rc = KMetadataOpenNodeRead ( meta, &node, node_path );
+    if ( rc == 0 )
+    {
+        get_meta_attr( node, "name", event->name, sizeof event->name );
+        if ( event->name[ 0 ] == 0 )
+            get_meta_attr( node, "tool", event->name, sizeof event->name );
+
+        get_meta_attr( node, "vers", event->vers.s_vers, sizeof event->vers.s_vers );
+        split_vers( &event->vers );
+
+        get_meta_attr( node, "run", event->run_date.date, sizeof event->run_date.date );
+        split_date( &event->run_date );
+
+        get_meta_attr( node, "date", event->tool_date.date, sizeof event->tool_date.date );
+        if ( event->tool_date.date[ 0 ] == 0 )
+            get_meta_attr( node, "build", event->tool_date.date, sizeof event->tool_date.date );
+        split_date( &event->tool_date );
+
+        KMDataNodeRelease ( node );
+    }
+}
+
+static void get_meta_info( vdb_info_data * data, const KMetadata * meta )
+{
+    const KMDataNode * node;
+    rc_t rc = KMetadataOpenNodeRead ( meta, &node, "schema" );
+    if ( rc == 0 )
+    {
+        size_t size;
+        rc = KMDataNodeReadAttr ( node, "name", data->schema_name, sizeof data->schema_name, &size );
+        if ( rc == 0 )
+            data->schema_name[ size ] = 0;
+        KMDataNodeRelease ( node );
+    }
+
+    rc = KMetadataOpenNodeRead ( meta, &node, "LOAD/timestamp" );
+    if ( rc == 0 )
+    {
+        rc = KMDataNodeReadAsU64 ( node, &data->ts.timestamp );
+        if ( rc == 0 )
+        {
+            KTime time_rec;
+            KTimeLocal ( &time_rec, data->ts.timestamp );
+            data->ts.year  = time_rec.year;
+            data->ts.month = time_rec.month + 1;
+            data->ts.day   = time_rec.day + 1;
+            data->ts.hour  = time_rec.hour;
+            data->ts.minute= time_rec.minute;
+        }
+        KMDataNodeRelease ( node );
+    }
+
+    get_meta_event( meta, "SOFTWARE/formatter", &data->formatter );
+    get_meta_event( meta, "SOFTWARE/loader", &data->loader );
+    get_meta_event( meta, "SOFTWARE/update", &data->update );
+}
+
+
+/* ----------------------------------------------------------------------------- */
+
+
+static const char * get_path_type( const VDBManager *mgr, const char * acc_or_path )
+{
+    const char * res = PT_NONE;
+    int path_type = ( VDBManagerPathType ( mgr, "%s", acc_or_path ) & ~ kptAlias );
+    switch ( path_type ) /* types defined in <kdb/manager.h> */
+    {
+        case kptDatabase      : res = PT_DATABASE; break;
+
+        case kptPrereleaseTbl :
+        case kptTable         : res = PT_TABLE; break;
+    }
+    return res;
+}
+
+
+static uint64_t get_file_size( const char * path )
+{
+    uint64_t res = 0;
+    KDirectory * dir;
+    rc_t rc = KDirectoryNativeDir( &dir );
+    if ( rc == 0 )
+    {
+        const KFile * f;
+        rc = KDirectoryOpenFileRead( dir, &f, "%s", path );
+        if ( rc == 0 )
+        {
+            KFileSize ( f, &res );
+            KFileRelease( f );
+        }
+        KDirectoryRelease( dir );
+    }
+    return res;
+}
+
+
+static rc_t vdb_info_tab( vdb_info_data * data, VSchema * schema, const VDBManager *mgr )
+{
+    const VTable * tab;
+    rc_t rc = VDBManagerOpenTableRead( mgr, &tab, schema, "%s", data->acc );
+    if ( rc == 0 )
+    {
+        const KMetadata * meta = NULL;
+
+        data->s_platform = get_platform( tab );
+        data->seq_rows = get_rowcount( tab );
+
+        rc = VTableOpenMetadataRead ( tab, &meta );
+        if ( rc == 0 )
+        {
+            get_meta_info( data, meta );
+            KMetadataRelease ( meta );
+        }
+
+        VTableRelease( tab );
+    }
+    return rc;
+}
+
+
+static uint64_t get_tab_row_count( const VDatabase * db, const char * table_name )
+{
+    uint64_t res = 0;
+    const VTable * tab;
+    rc_t rc = VDatabaseOpenTableRead( db, &tab, table_name );
+    if ( rc == 0 )
+    {
+        res = get_rowcount( tab );
+        VTableRelease( tab );
+    }
+    return res;
+}
+
+
+static rc_t vdb_info_db( vdb_info_data * data, VSchema * schema, const VDBManager *mgr )
+{
+    const VDatabase * db;
+    rc_t rc = VDBManagerOpenDBRead( mgr, &db, schema, "%s", data->acc );
+    if ( rc == 0 )
+    {
+        const VTable * tab;
+        const KMetadata * meta = NULL;
+
+        rc_t rc1 = VDatabaseOpenTableRead( db, &tab, "SEQUENCE" );
+        if ( rc1 == 0 )
+        {
+            data->s_platform = get_platform( tab );
+            data->seq_rows = get_rowcount( tab );
+            VTableRelease( tab );
+        }
+
+        data->ref_rows          = get_tab_row_count( db, "REFERENCE" );
+        data->prim_rows         = get_tab_row_count( db, "PRIMARY_ALIGNMENT" );
+        data->sec_rows          = get_tab_row_count( db, "SECONDARY_ALIGNMENT" );
+        data->ev_rows           = get_tab_row_count( db, "EVIDENCE_ALIGNMENT" );
+        data->ev_int_rows       = get_tab_row_count( db, "EVIDENCE_INTERVAL" );
+        data->consensus_rows    = get_tab_row_count( db, "CONSENSUS" );
+        data->passes_rows       = get_tab_row_count( db, "PASSES" );
+        data->metrics_rows      = get_tab_row_count( db, "ZMW_METRICS" );
+
+        rc = VDatabaseOpenMetadataRead ( db, &meta );
+        if ( rc == 0 )
+        {
+            get_meta_info( data, meta );
+            KMetadataRelease ( meta );
+        }
+
+        VDatabaseRelease( db );
+    }
+    return rc;
+
+}
+
+
+/* ----------------------------------------------------------------------------- */
+
+
+static rc_t vdb_info_print_xml_s( const char * tag, const char * value )
+{
+    if ( value[ 0 ] != 0 )
+        return KOutMsg( "<%s>%s</%s>\n", tag, value, tag );
+    else
+        return 0;
+}
+
+static rc_t vdb_info_print_xml_uint64( const char * tag, const uint64_t value )
+{
+    if ( value != 0 )
+        return KOutMsg( "<%s>%lu<%s>\n", tag, value, tag );
+    else
+        return 0;
+}
+
+
+static rc_t vdb_info_print_xml_event( const char * tag, vdb_info_event * event )
+{
+    rc_t rc = 0;
+    if ( event->name[ 0 ] != 0 )
+    {
+        rc = KOutMsg( "<%s>\n", tag );
+        if ( rc == 0 )
+            rc = vdb_info_print_xml_s( "NAME", event->name );
+        if ( rc == 0 )
+            rc = vdb_info_print_xml_s( "VERS", event->vers.s_vers );
+        if ( rc == 0 )
+            rc = vdb_info_print_xml_s( "TOOLDATE", event->tool_date.date );
+        if ( rc == 0 )
+            rc = vdb_info_print_xml_s( "RUNDATE", event->run_date.date );
+        if ( rc == 0 )
+            rc = KOutMsg( "</%s>\n", tag );
+    }
+    return rc;
+}
+
+
+static rc_t vdb_info_print_xml( vdb_info_data * data )
+{
+    rc_t rc = KOutMsg( "<info>\n" );
+
+    if ( rc == 0 )
+        rc = vdb_info_print_xml_s( "acc", data->acc );
+    if ( rc == 0 )
+        rc = vdb_info_print_xml_s( "path", data->path );
+    if ( rc == 0 )
+        rc = vdb_info_print_xml_uint64( "size", data->file_size );
+    if ( rc == 0 )
+        rc = vdb_info_print_xml_s( "type", data->s_path_type );
+    if ( rc == 0 )
+        rc = vdb_info_print_xml_s( "platf", data->s_platform );
+    if ( rc == 0 )
+        rc = vdb_info_print_xml_uint64( "SEQ", data->seq_rows );
+    if ( rc == 0 )
+        rc = vdb_info_print_xml_uint64( "REF", data->ref_rows );
+    if ( rc == 0 )
+        rc = vdb_info_print_xml_uint64( "PRIM", data->prim_rows );
+    if ( rc == 0 )
+        rc = vdb_info_print_xml_uint64( "SEC", data->sec_rows );
+    if ( rc == 0 )
+        rc = vdb_info_print_xml_uint64( "EVID", data->ev_rows );
+    if ( rc == 0 )
+        rc = vdb_info_print_xml_uint64( "EVINT", data->ev_int_rows );
+    if ( rc == 0 )
+        rc = vdb_info_print_xml_uint64( "CONS", data->consensus_rows );
+    if ( rc == 0 )
+        rc = vdb_info_print_xml_uint64( "PASS", data->passes_rows );
+    if ( rc == 0 )
+        rc = vdb_info_print_xml_uint64( "METR", data->metrics_rows );
+
+    if ( rc == 0 )
+        rc = vdb_info_print_xml_s( "SCHEMA", data->schema_name );
+
+    if ( rc == 0 && data->ts.timestamp != 0 )
+    {
+        rc = KOutMsg( "<TIMESTAMP>0x%.016x</TIMESTAMP>\n", data->ts.timestamp );
+        if ( rc == 0 )
+            rc = KOutMsg( "<MONTH>%.02d</MONTH>\n", data->ts.month );
+        if ( rc == 0 )
+            rc = KOutMsg( "<DAY>%.02d</DAY>\n", data->ts.day );
+        if ( rc == 0 )
+            rc = KOutMsg( "<YEAR>%.02d</YEAR>\n", data->ts.year );
+        if ( rc == 0 )
+            rc = KOutMsg( "<HOUR>%.02d</HOUR>\n", data->ts.hour );
+        if ( rc == 0 )
+            rc = KOutMsg( "<MINUTE>%.02d</MINUTE>\n", data->ts.minute );
+    }
+
+    if ( rc == 0 )
+        rc = vdb_info_print_xml_event( "FORMATTER", &data->formatter );
+    if ( rc == 0 )
+        rc = vdb_info_print_xml_event( "LOADER", &data->loader );
+    if ( rc == 0 )
+        rc = vdb_info_print_xml_event( "UPDATE", &data->update );
+
+    if ( rc == 0 )
+        rc = KOutMsg( "</info>\n" );
+    return rc;
+}
+
+
+/* ----------------------------------------------------------------------------- */
+
+
+static rc_t vdb_info_print_json_s( const char * tag, const char * value )
+{
+    if ( value[ 0 ] != 0 )
+        return KOutMsg( "\"%s\":\"%s\",\n", tag, value );
+    else
+        return 0;
+}
+
+static rc_t vdb_info_print_json_uint64( const char * tag, const uint64_t value )
+{
+    if ( value != 0 )
+        return KOutMsg( "\"%s\":%lu,\n", tag, value );
+    else
+        return 0;
+}
+
+static rc_t vdb_info_print_json_event( const char * tag, vdb_info_event * event )
+{
+    rc_t rc = 0;
+    if ( event->name[ 0 ] != 0 )
+    {
+        rc = KOutMsg( "\"%s\":{\n", tag );
+        if ( rc == 0 )
+            rc = vdb_info_print_json_s( "NAME", event->name );
+        if ( rc == 0 )
+            rc = vdb_info_print_json_s( "VERS", event->vers.s_vers );
+        if ( rc == 0 )
+            rc = vdb_info_print_json_s( "TOOLDATE", event->tool_date.date );
+        if ( rc == 0 )
+            rc = vdb_info_print_json_s( "RUNDATE", event->run_date.date );
+        if ( rc == 0 )
+            rc = KOutMsg( "},\n", tag );
+    }
+    return rc;
+}
+
+
+static rc_t vdb_info_print_json( vdb_info_data * data )
+{
+    rc_t rc = KOutMsg( "{\n" );
+
+    if ( rc == 0 )
+        rc = vdb_info_print_json_s( "acc", data->acc );
+    if ( rc == 0 )
+        rc = vdb_info_print_json_s( "path", data->path );
+    if ( rc == 0 )
+        rc = vdb_info_print_json_uint64( "size", data->file_size );
+    if ( rc == 0 )
+        rc = vdb_info_print_json_s( "type", data->s_path_type );
+    if ( rc == 0 )
+        rc = vdb_info_print_json_s( "platf", data->s_platform );
+    if ( rc == 0 )
+        rc = vdb_info_print_json_uint64( "SEQ", data->seq_rows );
+    if ( rc == 0 )
+        rc = vdb_info_print_json_uint64( "REF", data->ref_rows );
+    if ( rc == 0 )
+        rc = vdb_info_print_json_uint64( "PRIM", data->prim_rows );
+    if ( rc == 0 )
+        rc = vdb_info_print_json_uint64( "SEC", data->sec_rows );
+    if ( rc == 0 )
+        rc = vdb_info_print_json_uint64( "EVID", data->ev_rows );
+    if ( rc == 0 )
+        rc = vdb_info_print_json_uint64( "EVINT", data->ev_int_rows );
+    if ( rc == 0 )
+        rc = vdb_info_print_json_uint64( "CONS", data->consensus_rows );
+    if ( rc == 0 )
+        rc = vdb_info_print_json_uint64( "PASS", data->passes_rows );
+    if ( rc == 0 )
+        rc = vdb_info_print_json_uint64( "METR", data->metrics_rows );
+
+    if ( rc == 0 )
+        rc = vdb_info_print_json_s( "SCHEMA", data->schema_name );
+
+    if ( rc == 0 && data->ts.timestamp != 0 )
+    {
+        rc = vdb_info_print_json_uint64( "TIMESTAMP", data->ts.timestamp );
+        if ( rc == 0 )
+            rc = KOutMsg( "\"MONTH\":%d,\n", data->ts.month );
+        if ( rc == 0 )
+            rc = KOutMsg( "\"DAY\":%d,\n", data->ts.day );
+        if ( rc == 0 )
+            rc = KOutMsg( "\"YEAR\":%d,\n", data->ts.year );
+        if ( rc == 0 )
+            rc = KOutMsg( "\"HOUR\":%d,\n", data->ts.hour );
+        if ( rc == 0 )
+            rc = KOutMsg( "\"MINUTE\":%d,\n", data->ts.minute );
+    }
+
+    if ( rc == 0 )
+        rc = vdb_info_print_json_event( "FORMATTER", &data->formatter );
+    if ( rc == 0 )
+        rc = vdb_info_print_json_event( "LOADER", &data->loader );
+    if ( rc == 0 )
+        rc = vdb_info_print_json_event( "UPDATE", &data->update );
+
+    if ( rc == 0 )
+        rc = KOutMsg( "};\n" );
+    return rc;
+
+}
+
+
+/* ----------------------------------------------------------------------------- */
+
+
+static rc_t vdb_info_print_sep_event( vdb_info_event * event, const char sep, bool last )
+{
+    rc_t rc;
+    if ( last )
+    {
+        rc = KOutMsg( "%s%c%d%c%d%c%d%c%d%c%d%c%d%c%d%c%d%c%d",
+                      event->name, sep,
+                      event->vers.major, sep, event->vers.minor, sep, event->vers.release, sep,
+                      event->tool_date.month, sep, event->tool_date.day, sep, event->tool_date.year, sep,
+                      event->run_date.month, sep, event->run_date.day, sep, event->run_date.year );
+    }
+    else
+    {
+        rc = KOutMsg( "%s%c%d%c%d%c%d%c%d%c%d%c%d%c%d%c%d%c%d%c",
+                      event->name, sep,
+                      event->vers.major, sep, event->vers.minor, sep, event->vers.release, sep,
+                      event->tool_date.month, sep, event->tool_date.day, sep, event->tool_date.year, sep,
+                      event->run_date.month, sep, event->run_date.day, sep, event->run_date.year, sep );
+    }
+    return rc;
+}
+
+
+static rc_t vdb_info_print_sep( vdb_info_data * data, const char sep )
+{
+    rc_t rc = KOutMsg( "%s%c%lu%c%c%c%s%c",
+                       data->acc, sep, data->file_size, sep,
+                       data->s_path_type[0], sep, &(data->s_platform[13]), sep );
+    if ( rc == 0 )
+        rc = KOutMsg( "%lu%c%lu%c%lu%c%lu%c%lu%c%lu%c%lu%c%lu%c%lu%c",
+                      data->seq_rows, sep, data->ref_rows, sep,
+                      data->prim_rows, sep, data->sec_rows, sep, data->ev_rows, sep,
+                      data->ev_int_rows, sep, data->consensus_rows, sep,
+                      data->passes_rows, sep, data->metrics_rows, sep );
+    if ( rc == 0 )
+        rc = KOutMsg( "%s%c%d%c%d%c%d%c%d%c%d%c", data->schema_name, sep,
+                      data->ts.month, sep, data->ts.day, sep, data->ts.year, sep,
+                      data->ts.hour, sep, data->ts.minute, sep );
+
+    if ( rc == 0 )
+        rc = vdb_info_print_sep_event( &data->formatter, sep, false );
+    if ( rc == 0 )
+        rc = vdb_info_print_sep_event( &data->loader, sep, false );
+    if ( rc == 0 )
+        rc = vdb_info_print_sep_event( &data->update, sep, true );
+    if ( rc == 0 )
+        rc = KOutMsg( "\n" );
+
+    return rc;
+}
+
+
+/* ----------------------------------------------------------------------------- */
+
+
+static rc_t vdb_info_print_dflt_date( vdb_info_date * d, const char *prefix0, const char *prefix1 )
+{
+    rc_t rc = 0;
+
+    if ( d->date[ 0 ] != 0 )
+        rc = KOutMsg( "%s%s: %s (%d/%d/%d %d:%d)\n", prefix0, prefix1,
+                      d->date, d->month, d->day, d->year, d->hour, d->minute );
+
+    return rc;
+}
+
+static rc_t vdb_info_print_dflt_event( vdb_info_event * event, const char *prefix )
+{
+    rc_t rc = 0;
+    if ( event->name[ 0 ] != 0 )
+        rc = KOutMsg( "%s    : %s\n", prefix, event->name );
+    if ( rc == 0 && event->vers.s_vers[ 0 ] != 0 )
+        rc = KOutMsg( "%sVER : %s\n", prefix, event->vers.s_vers );
+    if ( rc == 0 )
+        rc = vdb_info_print_dflt_date( &event->tool_date, prefix, "DATE" );
+    if ( rc == 0 )
+        rc = vdb_info_print_dflt_date( &event->run_date,  prefix, "RUN " );
+    return rc;
+}
+
+
+static rc_t vdb_info_print_dflt( vdb_info_data * data )
+{
+    rc_t rc= KOutMsg( "acc    : %s\n", data->acc );
+    if ( rc == 0 && data->path[ 0 ] != 0 )
+        rc = KOutMsg( "path   : %s\n", data->path );
+    if ( rc == 0 && data->file_size != 0 )
+        rc = KOutMsg( "size   : %,lu\n", data->file_size );
+    if ( rc == 0 && data->s_path_type[ 0 ] != 0 )
+        rc = KOutMsg( "type   : %s\n", data->s_path_type );
+    if ( rc == 0 && data->s_platform[ 0 ] != 0 )
+        rc = KOutMsg( "platf  : %s\n", data->s_platform );
+    if ( rc == 0 && data->seq_rows != 0 )
+        rc = KOutMsg( "SEQ    : %,lu\n", data->seq_rows );
+    if ( rc == 0 && data->ref_rows != 0 )
+        rc = KOutMsg( "REF    : %,lu\n", data->ref_rows );
+    if ( rc == 0 && data->prim_rows != 0 )
+        rc = KOutMsg( "PRIM   : %,lu\n", data->prim_rows );
+    if ( rc == 0 && data->sec_rows != 0 )
+        rc = KOutMsg( "SEC    : %,lu\n", data->sec_rows );
+    if ( rc == 0 && data->ev_rows != 0 )
+        rc = KOutMsg( "EVID   : %,lu\n", data->ev_rows );
+    if ( rc == 0 && data->ev_int_rows != 0 )
+        rc = KOutMsg( "EVINT  : %,lu\n", data->ev_int_rows );
+    if ( rc == 0 && data->consensus_rows != 0 )
+        rc = KOutMsg( "CONS   : %,lu\n", data->consensus_rows );
+    if ( rc == 0 && data->passes_rows != 0 )
+        rc = KOutMsg( "PASS   : %,lu\n", data->passes_rows );
+    if ( rc == 0 && data->metrics_rows != 0 )
+        rc = KOutMsg( "METR   : %,lu\n", data->metrics_rows );
+
+    if ( rc == 0 && data->schema_name[ 0 ] != 0 )
+        rc = KOutMsg( "SCHEMA : %s\n", data->schema_name );
+
+    if ( rc == 0 && data->ts.timestamp != 0 )
+        rc = KOutMsg( "TIME   : 0x%.016x (%.02d/%.02d/%d %.02d:%.02d)\n",
+                      data->ts.timestamp, data->ts.month, data->ts.day, data->ts.year,
+                      data->ts.hour, data->ts.minute );
+
+    if ( rc == 0 )
+        vdb_info_print_dflt_event( &data->formatter, "FMT" );
+    if ( rc == 0 )
+        vdb_info_print_dflt_event( &data->loader, "LDR" );
+    if ( rc == 0 )
+        vdb_info_print_dflt_event( &data->update, "UPD" );
+
+    return rc;
+}
+
+
+/* ----------------------------------------------------------------------------- */
+
+static rc_t vdb_info_print_sql_event( const char * prefix, bool last )
+{
+    rc_t rc = KOutMsg( "%s_NAME VARCHAR, ", prefix );
+    if ( rc == 0 )
+        rc = KOutMsg( "%s_VER_MAJOR INTEGER, ", prefix );
+    if ( rc == 0 )
+        rc = KOutMsg( "%s_VER_MINOR INTEGER, ", prefix );
+    if ( rc == 0 )
+        rc = KOutMsg( "%s_VER_RELEASE INTEGER, ", prefix );
+    if ( rc == 0 )
+        rc = KOutMsg( "%s_TOOL_MONTH INTEGER, ", prefix );
+    if ( rc == 0 )
+        rc = KOutMsg( "%s_TOOL_DAY INTEGER, ", prefix );
+    if ( rc == 0 )
+        rc = KOutMsg( "%s_TOOL_YEAR INTEGER, ", prefix );
+    if ( rc == 0 )
+        rc = KOutMsg( "%s_RUN_MONTH INTEGER, ", prefix );
+    if ( rc == 0 )
+        rc = KOutMsg( "%s_RUN_DAY INTEGER, ", prefix );
+
+    if ( rc == 0 )
+    {
+        if ( last )
+            rc = KOutMsg( "%s_RUN_YEAR INTEGER ", prefix );
+        else
+            rc = KOutMsg( "%s_RUN_YEAR INTEGER, ", prefix );
+    }
+    return rc;
+}
+
+static rc_t vdb_info_print_sql_header( const char * table_name )
+{
+    rc_t rc = KOutMsg( "CREATE TABLE %s ( ", table_name );
+    if ( rc == 0 )
+        rc = KOutMsg( "ACC VARCHAR(12) PRIMARY KEY, " );
+    if ( rc == 0 )
+        rc = KOutMsg( "FILESIZE INTEGER, " );
+
+    if ( rc == 0 )
+        rc = KOutMsg( "TAB_OR_DB VARCHAR(1), " );
+    if ( rc == 0 )
+        rc = KOutMsg( "PLATFORM VARCHAR(16), " );
+    if ( rc == 0 )
+        rc = KOutMsg( "SEQ_ROWS INTEGER, " );
+    if ( rc == 0 )
+        rc = KOutMsg( "REF_ROWS INTEGER, " );
+    if ( rc == 0 )
+        rc = KOutMsg( "PRIM_ROWS INTEGER, " );
+    if ( rc == 0 )
+        rc = KOutMsg( "SEC_ROWS INTEGER, " );
+    if ( rc == 0 )
+        rc = KOutMsg( "EV_ROWS INTEGER, " );
+    if ( rc == 0 )
+        rc = KOutMsg( "EV_INT_ROWS INTEGER, " );
+    if ( rc == 0 )
+        rc = KOutMsg( "CONS_ROWS INTEGER, " );
+    if ( rc == 0 )
+        rc = KOutMsg( "PASS_ROWS INTEGER, " );
+    if ( rc == 0 )
+        rc = KOutMsg( "METR_ROWS INTEGER, " );
+
+    if ( rc == 0 )
+        rc = KOutMsg( "SCHEMA VARCHAR, " );
+
+    if ( rc == 0 )
+        rc = KOutMsg( "TS_MONTH INTEGER, " );
+    if ( rc == 0 )
+        rc = KOutMsg( "TS_DAY INTEGER, " );
+    if ( rc == 0 )
+        rc = KOutMsg( "TS_YEAR INTEGER, " );
+    if ( rc == 0 )
+        rc = KOutMsg( "TS_HOUR INTEGER, " );
+    if ( rc == 0 )
+        rc = KOutMsg( "TS_MINUTE INTEGER, " );
+
+    if ( rc == 0 )
+        vdb_info_print_sql_event( "FMT", false );
+    if ( rc == 0 )
+        vdb_info_print_sql_event( "LD", false );
+    if ( rc == 0 )
+        vdb_info_print_sql_event( "UPD", true );
+
+    if ( rc == 0 )
+        rc = KOutMsg( ");\n" );
+
+    return rc;
+}
+
+
+static rc_t vdb_info_print_ev_sql( vdb_info_event * event, bool last )
+{
+    rc_t rc;
+    if ( last )
+    {
+        rc = KOutMsg( "\'%s\', %d, %d, %d, %d, %d, %d, %d, %d, %d ",
+                    event->name, event->vers.major, event->vers.minor, event->vers.release,
+                    event->tool_date.month, event->tool_date.day, event->tool_date.year,
+                    event->run_date.month, event->run_date.day, event->run_date.year );
+    }
+    else
+    {
+        rc = KOutMsg( "\'%s\', %d, %d, %d, %d, %d, %d, %d, %d, %d, ",
+                    event->name, event->vers.major, event->vers.minor, event->vers.release,
+                    event->tool_date.month, event->tool_date.day, event->tool_date.year,
+                    event->run_date.month, event->run_date.day, event->run_date.year );
+    }
+    return rc;
+}
+
+
+static rc_t vdb_info_print_sql( const char * table_name, vdb_info_data * data )
+{
+    rc_t rc = KOutMsg( "INSERT INTO %s VALUES ( ", table_name );
+
+    if ( rc == 0 )
+        rc= KOutMsg( "\'%s\', ", data->acc );
+    if ( rc == 0 )
+        rc = KOutMsg( "%lu, ", data->file_size );
+    if ( rc == 0 )
+        rc = KOutMsg( "\'%c\', ", data->s_path_type[0] );
+    if ( rc == 0 )
+        rc = KOutMsg( "\'%s\', ", &( data->s_platform[13] ) );
+    if ( rc == 0 )
+        rc = KOutMsg( "%lu, ", data->seq_rows );
+    if ( rc == 0 )
+        rc = KOutMsg( "%lu, ", data->ref_rows );
+    if ( rc == 0 )
+        rc = KOutMsg( "%lu, ", data->prim_rows );
+    if ( rc == 0 )
+        rc = KOutMsg( "%lu, ", data->sec_rows );
+    if ( rc == 0 )
+        rc = KOutMsg( "%lu, ", data->ev_rows );
+    if ( rc == 0 )
+        rc = KOutMsg( "%lu, ", data->ev_int_rows );
+    if ( rc == 0 )
+        rc = KOutMsg( "%lu, ", data->consensus_rows );
+    if ( rc == 0 )
+        rc = KOutMsg( "%lu, ", data->passes_rows );
+    if ( rc == 0 )
+        rc = KOutMsg( "%lu, ", data->metrics_rows );
+
+    if ( rc == 0 )
+        rc = KOutMsg( "\'%s\', ", data->schema_name );
+
+    if ( rc == 0 )
+        rc = KOutMsg( "%d, %d, %d, %d, %d, ",
+                      data->ts.month, data->ts.day, data->ts.year, data->ts.hour, data->ts.minute );
+
+    if ( rc == 0 )
+        rc = vdb_info_print_ev_sql( &data->formatter, false );
+    if ( rc == 0 )
+        rc = vdb_info_print_ev_sql( &data->loader, false );
+    if ( rc == 0 )
+        rc = vdb_info_print_ev_sql( &data->update, true );
+
+    if ( rc == 0 )
+        rc = KOutMsg( ");\n" );
+
+    return rc;
+}
+
+
+/* ----------------------------------------------------------------------------- */
+
+
+static uint8_t digits_of( uint64_t value )
+{
+    uint8_t res = 0;
+          if ( value > 99999999999 ) res = 12;
+    else if ( value > 9999999999 ) res = 11;
+    else if ( value > 999999999 ) res = 10;
+    else if ( value > 99999999 ) res = 9;
+    else if ( value > 9999999 ) res = 8;
+    else if ( value > 999999 ) res = 7;
+    else if ( value > 99999 ) res = 6;
+    else if ( value > 9999 ) res = 5;
+    else if ( value > 999 ) res = 4;
+    else if ( value > 99 ) res = 3;
+    else if ( value > 9 ) res = 2;
+    else res = 1;
+    return res;
+}
+
+static rc_t vdb_info_1( VSchema * schema, dump_format_t format, const VDBManager *mgr,
+                        const char * acc_or_path, const char * table_name )
+{
+    rc_t rc = 0;
+    vdb_info_data data;
+
+    memset( &data, 0, sizeof data );
+    data.s_platform = PT_NONE;
+    data.acc = acc_or_path;
+
+    /* #1 get path-type */
+    data.s_path_type = get_path_type( mgr, acc_or_path );
+
+    if ( data.s_path_type[ 0 ] == 'D' || data.s_path_type[ 0 ] == 'T' )
+    {
+        rc_t rc1;
+
+        /* #2 fork by table or database */
+        switch ( data.s_path_type[ 0 ] )
+        {
+            case 'D' : vdb_info_db( &data, schema, mgr ); break;
+            case 'T' : vdb_info_tab( &data, schema, mgr ); break;
+        }
+
+        rc1 = resolve_accession( acc_or_path, data.path, sizeof data.path, false );
+        if ( rc1 == 0 )
+            data.file_size = get_file_size( data.path );
+
+        switch ( format )
+        {
+            case df_xml  : rc = vdb_info_print_xml( &data ); break;
+            case df_json : rc = vdb_info_print_json( &data ); break;
+            case df_csv  : rc = vdb_info_print_sep( &data, ',' ); break;
+            case df_tab  : rc = vdb_info_print_sep( &data, '\t' ); break;
+            case df_sql  : rc = vdb_info_print_sql( table_name, &data ); break;
+            default     : rc = vdb_info_print_dflt( &data ); break;
+        }
+    }
+
+    return rc;
+}
+
+
+rc_t vdb_info( Vector * schema_list, dump_format_t format, const VDBManager *mgr,
+               const char * acc_or_path, num_gen * row_generator )
+{
+    rc_t rc = 0;
+    VSchema * schema = NULL;
+
+    vdh_parse_schema( mgr, &schema, schema_list );
+
+    if ( format == df_sql )
+        rc = vdb_info_print_sql_header( acc_or_path );
+
+    if ( row_generator != NULL && vdn_range_defined( row_generator ) )
+    {
+        uint64_t id;
+        uint8_t digits = digits_of( vdn_max( row_generator ) );
+
+        vdn_start( row_generator );
+        while ( vdn_next( row_generator, &id ) && rc == 0 )
+        {
+            char acc[ 64 ];
+            size_t num_writ;
+            rc_t rc1 = -1;
+            switch ( digits )
+            {
+                case 1 : rc1 = string_printf ( acc, sizeof acc, &num_writ, "%s%lu", acc_or_path, id ); break;
+                case 2 : rc1 = string_printf ( acc, sizeof acc, &num_writ, "%s%.02lu", acc_or_path, id ); break;
+                case 3 : rc1 = string_printf ( acc, sizeof acc, &num_writ, "%s%.03lu", acc_or_path, id ); break;
+                case 4 : rc1 = string_printf ( acc, sizeof acc, &num_writ, "%s%.04lu", acc_or_path, id ); break;
+                case 5 : rc1 = string_printf ( acc, sizeof acc, &num_writ, "%s%.05lu", acc_or_path, id ); break;
+                case 6 : rc1 = string_printf ( acc, sizeof acc, &num_writ, "%s%.06lu", acc_or_path, id ); break;
+                case 7 : rc1 = string_printf ( acc, sizeof acc, &num_writ, "%s%.07lu", acc_or_path, id ); break;
+                case 8 : rc1 = string_printf ( acc, sizeof acc, &num_writ, "%s%.08lu", acc_or_path, id ); break;
+                case 9 : rc1 = string_printf ( acc, sizeof acc, &num_writ, "%s%.09lu", acc_or_path, id ); break;
+            }
+
+            if ( rc1 == 0 )
+                rc = vdb_info_1( schema, format, mgr, acc, acc_or_path );
+        }
+    }
+    else
+        rc = vdb_info_1( schema, format, mgr, acc_or_path, acc_or_path );
+
+    if ( schema != NULL )
+        VSchemaRelease( schema );
+
+    return rc;
+}
diff --git a/tools/vdb-dump/vdb_info.h b/tools/vdb-dump/vdb_info.h
new file mode 100644
index 0000000..f0bde80
--- /dev/null
+++ b/tools/vdb-dump/vdb_info.h
@@ -0,0 +1,47 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_vdb_info_
+#define _h_vdb_info_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+#include <klib/rc.h>
+#include <vdb/manager.h>
+
+rc_t vdb_info( Vector * schema_list, dump_format_t format, const VDBManager *mgr,
+               const char * acc_or_path, num_gen * row_generator );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/vdb-validate/Makefile b/tools/vdb-validate/Makefile
index bfdeddc..6107218 100644
--- a/tools/vdb-validate/Makefile
+++ b/tools/vdb-validate/Makefile
@@ -25,7 +25,7 @@
 
 default: std
 
-TOP ?= $(shell ../../build/abspath.sh ../..)
+TOP ?= $(abspath ../..)
 MODULE = tools/vdb-validate
 
 include $(TOP)/build/Makefile.env
@@ -92,8 +92,7 @@ VDB_VALIDATE_OBJ = \
 
 VDB_VALIDATE_LIB = \
 	-lkapp \
-	-lncbi-vdb \
-	-lxml2 \
+	-sncbi-vdb \
 	-lm
 
 vdb-validate.vers.h: vdb-validate.vers
diff --git a/tools/vdb-validate/vdb-validate.c b/tools/vdb-validate/vdb-validate.c
index 5d8eda3..e4516be 100644
--- a/tools/vdb-validate/vdb-validate.c
+++ b/tools/vdb-validate/vdb-validate.c
@@ -90,6 +90,7 @@ static bool exhaustive;
 static bool md5_required;
 static bool ref_int_check;
 static bool s_IndexOnly;
+static size_t memory_suggestion = (2ull * 1024ull * 1024ull * 1024ull);
 
 typedef struct node_s {
     int parent;
@@ -278,7 +279,7 @@ static rc_t visiting(CCReportInfoBlock const *what, cc_context_t *ctx)
     nxt->depth = what->info.visit.depth;
     nxt->objType = what->objType;
     nxt->name = ctx->nextName;
-    ctx->nextName += strlen(what->objName) + 1;
+    ctx->nextName += (unsigned)strlen(what->objName) + 1;
     strcpy(&ctx->names[nxt->name], what->objName);
 
     if (nn) {
@@ -347,9 +348,9 @@ rc_t kdbcc ( const KDBManager *mgr, char const name[], uint32_t mode,
     ctx.nodes = &nodes[0];
     ctx.names = &names[0];
 
-    if (KDBManagerExists(mgr, kptDatabase, name))
+    if (KDBManagerExists(mgr, kptDatabase, "%s", name))
         *pathType = kptDatabase;
-    else if (KDBManagerExists(mgr, kptTable, name))
+    else if (KDBManagerExists(mgr, kptTable, "%s", name))
         *pathType = kptTable;
     else if (*pathType == kptDatabase || *pathType == kptTable)
         /* is known already: may be encrypted */ ( void) 0;
@@ -366,7 +367,7 @@ rc_t kdbcc ( const KDBManager *mgr, char const name[], uint32_t mode,
         const KDatabase *db;
 
         objtype = "database";
-        rc = KDBManagerOpenDBRead ( mgr, & db, name );
+        rc = KDBManagerOpenDBRead ( mgr, & db, "%s", name );
         if ( rc == 0 )
         {
             rc = KDatabaseConsistencyCheck ( db, 0, level, report, & ctx );
@@ -385,7 +386,7 @@ rc_t kdbcc ( const KDBManager *mgr, char const name[], uint32_t mode,
         const KTable *tbl;
 
         objtype = "table";
-        rc = KDBManagerOpenTableRead ( mgr, & tbl, name );
+        rc = KDBManagerOpenTableRead ( mgr, & tbl, "%s", name );
         if ( rc == 0 )
         {
             rc = KTableConsistencyCheck ( tbl, 0, level, report, & ctx, platform );
@@ -426,7 +427,7 @@ rc_t vdbcc ( const VDBManager *mgr, char const name[], uint32_t mode,
     if ( ( mode & 8) != 0 )
     {
         const VTable *tbl;
-        rc_t rc = VDBManagerOpenTableRead(mgr, &tbl, NULL, name);
+        rc_t rc = VDBManagerOpenTableRead(mgr, &tbl, NULL, "%s", name);
         if (rc == 0)
             rc = VTableConsistencyCheck(tbl, 2);
         return rc;
@@ -503,7 +504,7 @@ static rc_t EncFileReadAll(const char *name,
     }
 
     if (rc == 0) {
-        rc = VFSManagerMakePath (mgr, &path, name);
+        rc = VFSManagerMakePath (mgr, &path, "%s", name);
         if (rc != 0) {
             (void)PLOGERR(klogErr, (klogErr, rc,
                 "Failed to VPathMake($(name))", "name=%s", name));
@@ -548,7 +549,7 @@ static rc_t verify_encryption(const KDirectory *dir, const char *name,
     *enc = false;
     *sra = true;
 
-    rc = KDirectoryOpenFileRead(dir, &f, name);
+    rc = KDirectoryOpenFileRead(dir, &f, "%s", name);
     if (rc == 0) {
         rc = KFileReadAll(f, 0, &buffer, sizeof buffer, &num_read);
     }
@@ -614,9 +615,9 @@ static rc_t init_dbcc(KDirectory const *dir, char const name[], bool is_file,
     assert(pathType);
 
     if (is_file) {
-        rc = KDirectoryOpenSraArchiveRead_silent(dir, &obj, false, name);
+        rc = KDirectoryOpenSraArchiveRead_silent(dir, &obj, false, "%s", name);
         if (rc != 0)
-        {   rc = KDirectoryOpenTarArchiveRead_silent(dir, &obj, false, name); }
+        {   rc = KDirectoryOpenTarArchiveRead_silent(dir, &obj, false, "%s", name); }
         if (rc != 0) {
             const VDBManager *mgr = NULL;
             const VTable *tbl = NULL;
@@ -625,7 +626,7 @@ static rc_t init_dbcc(KDirectory const *dir, char const name[], bool is_file,
             if (rc != 0)
             {   return rc; }
             for ( ; rc == 0; ) {
-                rc = VDBManagerOpenTableRead(mgr, &tbl, sra_schema, name);
+                rc = VDBManagerOpenTableRead(mgr, &tbl, sra_schema, "%s", name);
                 VSchemaRelease(sra_schema);
                 if (rc == 0) {
                     const KTable *ktbl = NULL;
@@ -637,14 +638,14 @@ static rc_t init_dbcc(KDirectory const *dir, char const name[], bool is_file,
                     break;
                 }
                 else if (GetRCState(rc) == rcNotFound
-                    && GetRCObject(rc) == rcSchema && sra_schema == NULL)
+                    && GetRCObject(rc) == (enum RCObject)rcSchema && sra_schema == NULL)
                 {
                      rc = VDBManagerMakeSRASchema(mgr, &sra_schema);
                 }
                 else {
                     const VDatabase *db = NULL;
                     const KDatabase *kdb = NULL;
-                    rc = VDBManagerOpenDBRead(mgr, &db, NULL, name);
+                    rc = VDBManagerOpenDBRead(mgr, &db, NULL, "%s", name);
                     if (rc == 0)
                     {   rc = VDatabaseOpenKDatabaseRead(db, &kdb); }
                     if (rc == 0)
@@ -661,7 +662,7 @@ static rc_t init_dbcc(KDirectory const *dir, char const name[], bool is_file,
         }
     }
     else {
-        rc = KDirectoryOpenDirRead(dir, &obj, false, name);
+        rc = KDirectoryOpenDirRead(dir, &obj, false, "%s", name);
     }
     if (rc)
         return rc;
@@ -735,7 +736,167 @@ static rc_t sra_dbcc_454(VTable const *tbl, char const name[])
     return 0;
 }
 
-static rc_t sra_dbcc_fastq(VTable const *tbl, char const name[])
+typedef struct vdb_validate_params vdb_validate_params;
+struct vdb_validate_params
+{
+    const KDirectory *wd;
+    const KDBManager *kmgr;
+    const VDBManager *vmgr;
+
+    bool md5_chk;
+    bool md5_chk_explicit;
+    bool blob_crc;
+    bool index_chk;
+    bool consist_check;
+    bool exhaustive;
+};
+
+static rc_t tableConsistCheck(const vdb_validate_params *pb, const VTable *tbl)
+{
+    rc_t rce = 0;
+
+    const VCursor *curs = NULL;
+
+    int64_t firstREAD_LEN = 0;
+    uint64_t countREAD_LEN = 0;
+
+    uint64_t i = 0;
+
+    ColumnInfo readLen;
+    ColumnInfo spotLen;
+
+    memset(&readLen, 0, sizeof readLen);
+    memset(&spotLen, 0, sizeof spotLen);
+
+    assert(pb);
+
+    if (!pb->consist_check) {
+        return 0;
+    }
+
+    rce = VTableCreateCursorRead(tbl, &curs);
+    if (rce != 0) {
+        return rce;
+    }
+    if (rce == 0) {
+        readLen.name = "READ_LEN";
+        rce = VCursorAddColumn(curs, &readLen.idx, "%s", readLen.name);
+    }
+    if (rce == 0) {
+        spotLen.name = "SPOT_LEN";
+        rce = VCursorAddColumn(curs, &spotLen.idx, "%s", spotLen.name);
+    }
+
+    if (rce == 0) {
+        assert(readLen.idx && spotLen.idx);
+        if (readLen.idx == 0) {
+            rce = RC(rcExe, rcTable, rcValidating, rcColumn, rcNotFound);
+            LOGERR(klogErr, rce, "Cannot find 'READ_LEN' column");
+        }
+        else if (spotLen.idx == 0) {
+            rce = RC(rcExe, rcTable, rcValidating, rcColumn, rcNotFound);
+            LOGERR(klogErr, rce, "Cannot find 'SPOT_LEN' column");
+        }
+    }
+
+    if (rce == 0) {
+        rce = VCursorOpen(curs);
+    }
+    if (rce == 0) {
+        rce =
+            VCursorIdRange(curs, readLen.idx, &firstREAD_LEN, &countREAD_LEN);
+    }
+    if (rce == 0) {
+        int64_t firstSPOT_LEN = 0;
+        uint64_t countSPOT_LEN = 0;
+        rce =
+            VCursorIdRange(curs, spotLen.idx, &firstSPOT_LEN, &countSPOT_LEN);
+        if (rce == 0) {
+            if (firstREAD_LEN != firstSPOT_LEN) {
+                rce = RC(rcExe, rcTable, rcValidating, rcColumn, rcInvalid);
+                LOGERR(klogErr, rce, "The first ID-s "
+                    "in READ_LEN and SPOT_LEN columns do not match");
+            }
+            else if (countREAD_LEN != countSPOT_LEN) {
+                rce = RC(rcExe, rcTable, rcValidating, rcColumn, rcInvalid);
+                LOGERR(klogErr, rce, "ID ranges "
+                    "in READ_LEN and SPOT_LEN columns do not match");
+            }
+        }
+    }
+
+    for (i = 0; i < countREAD_LEN; ++i) {
+        uint32_t n = 0;
+        uint32_t j = 0;
+        rc_t rc = VCursorCellDataDirect(curs, firstREAD_LEN + i,
+            readLen.idx, &readLen.elem_bits,
+            &readLen.value.vp, NULL, &readLen.elem_count);
+        if (rc != 0) {
+            PLOGERR(klogErr, (klogErr, rc,
+                "Cannot read 'READ_LEN' column at row $(row)",
+                "row=%ld", firstREAD_LEN + i));
+            if (rce == 0) {
+                rce = rc;
+            }
+            if (!pb->exhaustive) {
+                break;
+            }
+        }
+        rc = VCursorCellDataDirect(curs, firstREAD_LEN + i,
+            spotLen.idx, &spotLen.elem_bits,
+            &spotLen.value.vp, NULL, &spotLen.elem_count);
+        if (rc != 0) {
+            PLOGERR(klogErr, (klogErr, rc,
+                "Cannot read 'SPOT_LEN' column at row $(row)",
+                "row=%ld", firstREAD_LEN + i));
+            if (rce == 0) {
+                rce = rc;
+            }
+            if (!pb->exhaustive) {
+                break;
+            }
+        }
+
+        if (readLen.value.vp == NULL || spotLen.value.vp == NULL) {
+            rc = RC(rcExe, rcTable, rcValidating, rcData, rcNull);
+            PLOGERR(klogErr, (klogErr, rc,
+                "Invalid 'READ_LEN' or 'SPOT_LEN' value at row $(row)",
+                "row=%ld", firstREAD_LEN + i));
+            if (rce == 0) {
+                rce = rc;
+            }
+            if (!pb->exhaustive) {
+                break;
+            }
+        }
+        for (j = 0; j < readLen.elem_count; ++j) {
+            n += readLen.value.u32[j];
+        }
+        if (n != *(spotLen.value.u32)) {
+            rc = RC(rcExe, rcTable, rcValidating, rcData, rcCorrupt);
+            PLOGERR(klogErr, (klogErr, rc,
+                "Sum(READ_LEN) != SPOT_LEN in row $(row)",
+                "row=%ld", firstREAD_LEN + i));
+            if (rce == 0) {
+                rce = rc;
+            }
+            if (!pb->exhaustive) {
+                break;
+            }
+        }
+    }
+
+    if (rce == 0) {
+        LOGMSG(klogInfo, "Columns 'READ_LEN' and 'SPOT_LEN' are consistent");
+    }
+
+    VCursorRelease(curs);
+
+    return rce;
+}
+
+static rc_t sra_dbcc_fastq(const vdb_validate_params *pb,
+    const VTable *tbl, char const name[])
 {
     static char const *const cn_FastQ[] = {
         "READ", "QUALITY", "SPOT_LEN", "READ_START", "READ_LEN", "READ_TYPE"
@@ -752,7 +913,7 @@ static rc_t sra_dbcc_fastq(VTable const *tbl, char const name[])
         memset(cols, 0, sizeof(cols));
         for (i = 0; i < n; ++i) {
             cols[i].name = cn_FastQ[i];
-            VCursorAddColumn(curs, &cols[i].idx, cols[i].name);
+            VCursorAddColumn(curs, &cols[i].idx, "%s", cols[i].name);
         }
         rc = VCursorOpen(curs);
         if (rc == 0) {
@@ -779,10 +940,16 @@ static rc_t sra_dbcc_fastq(VTable const *tbl, char const name[])
         }
         VCursorRelease(curs);
     }
+
+    if (rc == 0) {
+        rc = tableConsistCheck(pb, tbl);
+    }
+
     if (rc) {
         (void)PLOGERR(klogErr, (klogErr, rc,
             "Table '$(name)' is damaged beyond any use", "name=%s", name));
     }
+
     return rc;
 }
 
@@ -825,7 +992,8 @@ static rc_t VTable_get_platform(VTable const *tbl,
     return rc;
 }
 
-static rc_t verify_table(VTable const *tbl, char const name[])
+static rc_t verify_table(const vdb_validate_params *pb,
+    const VTable *tbl, char const name[])
 {
     char schemaName[1024];
     char *schemaVers = NULL;
@@ -844,7 +1012,7 @@ static rc_t verify_table(VTable const *tbl, char const name[])
                     "SRA Platform; type of table '$(name)' is indeterminate.",
                     "name=%s", name));
             }
-            rc = sra_dbcc_fastq(tbl, name);
+            rc = sra_dbcc_fastq(pb, tbl, name);
             if (rc == 0 && platform == SRA_PLATFORM_454) {
                 rc = sra_dbcc_454(tbl, name);
             }
@@ -857,42 +1025,54 @@ static rc_t verify_table(VTable const *tbl, char const name[])
     return rc;
 }
 
-static rc_t verify_mgr_table(VDBManager const *mgr, char const name[])
+static rc_t verify_mgr_table(const vdb_validate_params *pb, char const name[])
 {
-    VTable const *tbl;
+    rc_t rc = 0;
+
+    const VTable *tbl = NULL;
     VSchema *sra_schema = NULL;
 
+    const VDBManager *mgr = NULL;
+
+    assert(pb);
+
+    mgr = pb->vmgr;
+
     for ( ; ; ) {
-        rc_t rc = VDBManagerOpenTableRead(mgr, &tbl, sra_schema, name);
+        rc = VDBManagerOpenTableRead(mgr, &tbl, sra_schema, "%s", name);
         VSchemaRelease(sra_schema);
         if (rc == 0) {
-            rc = verify_table(tbl, name);
-            VTableRelease(tbl);
-            return rc;
+            rc = verify_table(pb, tbl, name);
+            break;
         }
-        else if (GetRCState(rc) == rcNotFound && GetRCObject(rc) == rcSchema
+        else if (GetRCState(rc) == rcNotFound && GetRCObject(rc) == (enum RCObject)rcSchema
             && sra_schema == NULL)
         {
             rc = VDBManagerMakeSRASchema(mgr, &sra_schema);
             if (rc) {
                 (void)PLOGERR(klogErr, (klogErr, rc,
                     "Failed to open table '$(name)'", "name=%s", name));
-                return rc;
+                break;
             }
         }
         else {
             (void)PLOGERR(klogErr, (klogErr, rc,
                 "Failed to open table '$(name)'", "name=%s", name));
-            return rc;
+            break;
         }
     }
+
+    RELEASE(VSchema, sra_schema);
+    RELEASE(VTable, tbl);
+
+    return rc;
 }
 
 #if 0
 static rc_t verify_db_table(VDatabase const *db, char const name[])
 {
     VTable const *tbl;
-    rc_t rc = VDatabaseOpenTableRead(db, &tbl, name);
+    rc_t rc = VDatabaseOpenTableRead(db, &tbl, "%s", name);
 
     if (rc == 0) {
         rc = verify_table(tbl, name);
@@ -933,7 +1113,7 @@ static rc_t align_dbcc_primary_alignment(VTable const *tbl, char const name[])
         memset(cols, 0, sizeof(cols));
         for (i = 0; i < n; ++i) {
             cols[i].name = cn_SAM[i];
-            VCursorAddColumn(curs, &cols[i].idx, cols[i].name);
+            VCursorAddColumn(curs, &cols[i].idx, "%s", cols[i].name);
         }
         rc = VCursorOpen(curs);
         if (rc == 0) {
@@ -960,176 +1140,224 @@ static rc_t align_dbcc_primary_alignment(VTable const *tbl, char const name[])
 }
 #endif
 
-static int CC id_cmp(void const *const A, void const *const B, void *const ignored)
-{
-    int64_t const *const a = A;
-    int64_t const *const b = B;
-    
-    return *a < *b ? -1 : *a == *b ? 0 : 1;
-}
-
 typedef struct id_pair_s {
     int64_t first;
     int64_t second;
 } id_pair_t;
 
-static int CC id_pair_cmp(void const *const A, void const *const B, void *const ignored)
+static size_t work_chunk(uint64_t const count)
+{
+    size_t const max = memory_suggestion / (sizeof(id_pair_t));
+    size_t chunk = (size_t)count;
+
+#if 1
+    /* do as many as possible at once */
+    if (chunk > max)
+        chunk = max;
+#else
+    /* break it up into chunks of about equal size */
+    while (chunk > max)
+        chunk /= 2;
+#endif
+    return chunk;
+}
+
+static void sort_key_pairs(size_t const N, id_pair_t array[/* N */])
+{
+    id_pair_t a;
+    id_pair_t b;
+    
+#define GET(P, V) ((void)(V = ((id_pair_t const *)(P))[0]))
+#define SET(P, V) ((void)((((id_pair_t *)(P))[0]) = V))
+#define CMP(A, B) (((GET(A, a)),(GET(B, b))), (a.first  < b.first  ? -1 :      \
+                                               b.first  < a.first  ?  1 :      \
+                                               a.second < b.second ? -1 :      \
+                                               b.second < a.second ?  1 : 0))
+#define SWAP(A, B, C, D) do{GET(A, a); GET(B, b); SET(A, b); SET(B, a);}while(0)
+    KSORT(array, N, sizeof(array[0]), 0, 0);
+#undef SWAP
+#undef CMP
+#undef SET
+#undef GET
+}
+
+static void sort_keys(size_t const N, int64_t array[/* N */])
 {
-    id_pair_t const *const a = A;
-    id_pair_t const *const b = B;
-
-    return a->first < b->first
-        ? -1
-        : a->first == b->first
-            ? a->second < b->second
-                ? -1
-                : a->second == b->second ? 0 : 1
-            : 1;
+#define INDEXOF(A) (((int64_t const *)(A)) - ((int64_t const *)(&array[0])))
+#define CMP(A, B) (array[INDEXOF(A)] - array[INDEXOF(B)])
+#define SWAP(A, B, C, D) do {                                                  \
+    int64_t const a = array[INDEXOF(A)];                                       \
+    int64_t const b = array[INDEXOF(B)];                                       \
+    array[INDEXOF(A)] = b;                                                     \
+    array[INDEXOF(B)] = a; } while(0)
+    KSORT(array, N, sizeof(array[0]), 0, 0);
+#undef SWAP
+#undef CMP
+#undef INDEXOF
 }
 
-static size_t id_pair_span(size_t const first, size_t const N, id_pair_t const array[/* N */])
+#define CHECK_QUITTING do { rc_t const rc = Quitting(); if (rc) return rc; } while(0);
+
+static size_t load_key_pairs(int64_t const startId,
+                             int64_t const endId,
+                             size_t const pairs,
+                             id_pair_t pair[/* pairs */],
+                             VCursor const *const acurs,
+                             ColumnInfo *const aci,
+                             int64_t plast[],
+                             rc_t Rc[])
 {
-    int64_t const target = array[first].first;
-    size_t i;
+    int64_t last_fkey = INT64_MIN;
+    int64_t row = startId;
+    size_t j = 0;
+    bool ordered = true;
     
-    for (i = first + 1; i < N; ++i) {
-        if (array[i].first != target)
+    while (row < endId) {
+        int64_t first;
+        int64_t maybe_last;
+        rc_t const rc1 = VCursorPageIdRange(acurs, aci->idx, row, &first, &maybe_last);
+        int64_t const last = maybe_last < endId ? maybe_last : endId - 1;
+        size_t const count = (last + 1) - first;
+
+        if (rc1) {
+            Rc[0] = rc1;
+            return 0;
+        }
+        CHECK_QUITTING;
+        
+        if (first < row)
+            first = row;
+        if (row != startId && pairs < count + j)
             break;
+        plast[0] = last;
+        
+        for ( ; j < pairs && row <= last; ++row) {
+            rc_t const rc = VCursorCellDataDirect(acurs, row, aci->idx,
+                                                  &aci->elem_bits, &aci->value.vp,
+                                                  NULL, &aci->elem_count);
+            if (rc == 0) {
+                if (aci->elem_count == 1) {
+                    int64_t const fkey = aci->value.i64[0];
+                    
+                    ordered &= (last_fkey <= fkey);
+                    pair[j].second = row;
+                    pair[j].first = fkey;
+                    last_fkey = fkey;
+                    ++j;
+                }
+                else {
+                    Rc[0] = RC(rcExe, rcDatabase, rcValidating, rcData, rcUnexpected);
+                    return 0;
+                }
+            }
+            else if (!(GetRCObject(rc) == rcRow && GetRCState(rc) == rcNotFound)) {
+                Rc[0] = rc;
+                return 0;
+            }
+            /* row not found might be an error but that won't be decided here */
+        }
     }
-    return i - first;
+    if (!ordered)
+        sort_key_pairs(j, pair);
+    
+    Rc[0] = 0;
+    return j;
 }
 
-static size_t work_chunk(uint64_t const count)
+static bool is_sorted(uint32_t const N, int64_t const key[/* N */])
 {
-    uint64_t const max = (2147483648ul) / (sizeof(id_pair_t)+sizeof(int64_t));
-    uint64_t chunk = count;
-
-    while (chunk > max)
-        chunk /= 2;
+    uint32_t i = 0;
+    int64_t last = key[i];
+    
+    for (i = 1; i < N; ++i) {
+        int64_t const cur = key[i];
+        
+        if (cur < last)
+            return false;
 
-    return (size_t)chunk;
+        last = cur;
+    }
+    return true;
 }
 
 static rc_t ric_align_generic(int64_t const startId,
                               uint64_t const count,
                               size_t const pairs,
                               id_pair_t pair[/* pairs */],
-                              int64_t scratch[/* pairs */],
+                              void *scratch[],
                               VCursor const *const acurs,
                               ColumnInfo *const aci,
                               VCursor const *const bcurs,
                               ColumnInfo *const bci
-                             )
+                              )
 {
-    rc_t rc = 0;
-    uint64_t current;
-
-    for (current = 0; current < count; current += pairs) {
-        uint64_t i;
-        uint64_t j;
-
-        for (i = current, j = 0; j < pairs && i < count; ++i) {
-            int64_t const row = startId + i;
-
-            rc = VCursorCellDataDirect(acurs, row, aci->idx,
-                &aci->elem_bits, &aci->value.vp, NULL, &aci->elem_count);
-            if (rc == 0) {
-                if (aci->elem_count != 1)
-                    return RC(rcExe, rcDatabase, rcValidating, rcData,
-                        rcUnexpected);
-                pair[j].second = row;
-                pair[j].first = aci->value.i64[0];
-                ++j;
-            }
-            else if (GetRCObject(rc) == rcRow && GetRCState(rc) == rcNotFound)
-                rc = 0;
-            else
-                return rc;
-        }
-        ksort(pair, j, sizeof(id_pair_t), id_pair_cmp, NULL);
-        for (i = 0; i < j; ) {
-            int64_t const row = pair[i].first;
-            size_t const span = id_pair_span(i, j, pair);
-            bool found = false;
-
-            rc = VCursorCellDataDirect(bcurs, row, bci->idx,
-                                       &bci->elem_bits, &bci->value.vp,
-                                       NULL, &bci->elem_count);
-            if (rc == 0) {
-                uint32_t const elem_count = bci->elem_count;
+    int64_t chunk;
+    int64_t const endId = startId + count;
+    size_t scratch_size = 0;
+
+    for (chunk = startId; chunk < endId; ) {
+        rc_t rc = 0;
+        int64_t last;
+        size_t const n = load_key_pairs(chunk, endId, pairs, pair, acurs, aci, &last, &rc);
+        size_t i;
+        int64_t cur_fkey = 0;
+        uint32_t elem_count = 0;
+        uint32_t current = 0;
+        int64_t const *id = 0;
+
+        if (rc) return rc;
+        if (chunk == last)
+            break;
+        if (chunk != startId) {
+            (void)PLOGMSG(klogInfo, (klogInfo, "Referential Integrity: "
+                                     "$(aname) <-> $(bname)"
+                                     " $(pct)% complete",
+                                     "aname=%s,bname=%s,pct=%5.1f",
+                                     aci->name, bci->name,
+                                     (100.0 * (chunk - startId)) / count));
+        }
+        chunk = last;
+        for (i = 0; i < n; ++i) {
+            int64_t const fkey = pair[i].first;
+            int64_t const row = pair[i].second;
+            
+            if (cur_fkey != fkey) {
+                uint32_t dummy;
                 
-                if (elem_count > pairs)
-                    return RC(rcExe, rcDatabase, rcValidating, rcData, rcTooBig);
+                CHECK_QUITTING;
                 
-                if (elem_count >= span) {
-                    if (elem_count > 4) {
-                        int64_t *const id = scratch;
-                    
-                        memcpy(id, &bci->value.i64[0], elem_count * sizeof(bci->value.i64[0]));
-                        ksort(id, span, sizeof(id[0]), id_cmp, NULL);
+                rc = VCursorCellDataDirect(bcurs, fkey, bci->idx,
+                                           &dummy, (void const **)&id,
+                                           NULL, &elem_count);
+
+                if (GetRCObject(rc) == rcRow && GetRCState(rc) == rcNotFound)
+                    return RC(rcExe, rcDatabase, rcValidating, rcData, rcInconsistent);
+                else if (rc)
+                    return rc;
+                
+                if (!is_sorted(elem_count, id)) {
+                    if (scratch_size < elem_count) {
+                        void *const temp = realloc(scratch[0], elem_count * sizeof(id[0]));
                         
-                        if (elem_count == span) {
-                            size_t k;
-                            
-                            found = true;
-                            for (k = 0; k < span; ++k) {
-                                if (id[k] != pair[i + k].second) {
-                                    found = false;
-                                    break;
-                                }
-                            }
-                        }
-                        else {
-                            size_t k1, k2;
-                            
-                            found = true;
-                            for (k1 = k2 = 0; k1 < span && k2 < elem_count; ) {
-                                int64_t const id1 = pair[i + k1].second;
-                                int64_t const id2 = id[k2];
-                                
-                                if (id2 == id1) {
-                                    ++k1;
-                                    ++k2;
-                                }
-                                else if (id2 < id1)
-                                    ++k2;
-                                else {
-                                    found = false;
-                                    break;
-                                }
-                            }
-                            if (found) found = k1 == span;
-                        }
-                    }
-                    else {
-                        size_t k1, k2;
-                        int64_t const *const id = &bci->value.i64[0];
+                        if (temp == NULL)
+                            return RC(rcExe, rcDatabase, rcValidating, rcMemory, rcExhausted);
                         
-                        for (k1 = 0; k1 < span; ++k1) {
-                            int64_t const id1 = pair[i + k1].second;
-
-                            for (k2 = 0; k2 < elem_count; ++k2) {
-                                int64_t const id2 = id[k2];
-                                
-                                if (id1 == id2) {
-                                    found = true;
-                                    break;
-                                }
-                            }
-                            if (!found)
-                                break;
-                        }
+                        scratch[0] = temp;
+                        scratch_size = elem_count;
                     }
+                    memcpy(scratch[0], id, elem_count * sizeof(id[0]));
+                    sort_keys(elem_count, scratch[0]);
+                    id = scratch[0];
+                }
+                current = 0;
+                cur_fkey = fkey;
+                while (current < elem_count && id[current] < row) {
+                    ++current;
                 }
             }
-            else if (GetRCObject(rc) != rcRow || GetRCState(rc) != rcNotFound)
-                return rc;
-            
-            if (!found)
-                return RC(rcExe, rcDatabase, rcValidating, rcData,
-                    rcInconsistent);
-
-            i += span;
+            if (current >= elem_count || id[current] != row)
+                return RC(rcExe, rcDatabase, rcValidating, rcData, rcInconsistent);
+            ++current;
         }
     }
     return 0;
@@ -1152,9 +1380,12 @@ static rc_t ric_align_ref_and_align(char const dbname[],
     int64_t startId;
     uint64_t count;
 
+    aci.name = "REF_ID";
+    bci.name = id_col_name;
+    
     rc = VTableCreateCursorRead(align, &acurs);
     if (rc == 0) {
-        rc = VCursorAddColumn(acurs, &aci.idx, "REF_ID");
+        rc = VCursorAddColumn(acurs, &aci.idx, "%s", aci.name);
         if (rc == 0)
             rc = VCursorOpen(acurs);
         if (rc == 0)
@@ -1166,7 +1397,7 @@ static rc_t ric_align_ref_and_align(char const dbname[],
     else {
         rc = VTableCreateCursorRead(ref, &bcurs);
         if (rc == 0)
-            rc = VCursorAddColumn(bcurs, &bci.idx, id_col_name);
+            rc = VCursorAddColumn(bcurs, &bci.idx, "%s", bci.name);
         if (rc == 0)
             rc = VCursorOpen(bcurs);
         if (rc)
@@ -1175,22 +1406,26 @@ static rc_t ric_align_ref_and_align(char const dbname[],
     }
     if (rc == 0) {
         size_t const chunk = work_chunk(count);
-        id_pair_t *const pair = malloc((sizeof(id_pair_t)+sizeof(int64_t)) * chunk);
-        int64_t *const scratch = &pair[chunk].first;
+        id_pair_t *const pair = malloc(sizeof(id_pair_t) * chunk);
 
         if (pair) {
-            rc = ric_align_generic(startId, count, chunk, pair, scratch,
+            void *scratch = NULL;
+            
+            rc = ric_align_generic(startId, count, chunk, pair, &scratch,
                                    acurs, &aci, bcurs, &bci);
-            if (GetRCObject(rc) == rcData && GetRCState(rc) == rcUnexpected)
+            if (scratch)
+                free(scratch);
+
+            if (GetRCObject(rc) == (enum RCObject)rcData && GetRCState(rc) == rcUnexpected)
                 (void)PLOGERR(klogErr, (klogErr, rc,
                     "Database '$(name)': failed referential "
                     "integrity check", "name=%s", dbname));
-            else if (GetRCObject(rc) == rcData &&
+            else if (GetRCObject(rc) == (enum RCObject)rcData &&
                      GetRCState(rc) == rcInconsistent)
                 (void)PLOGERR(klogErr, (klogErr, rc,
  "Database '$(name)': column '$(idcol)' failed referential integrity check",
  "name=%s,idcol=%s", dbname, id_col_name));
-            else if (GetRCObject(rc) == rcData &&
+            else if (GetRCObject(rc) == (enum RCObject)rcData &&
                      GetRCState(rc) == rcTooBig)
                 (void)PLOGERR(klogWarn, (klogWarn, rc = 0, "Database '$(name)':"
                          " referential integrity could not be checked, skipped",
@@ -1202,9 +1437,14 @@ static rc_t ric_align_ref_and_align(char const dbname[],
             free(pair);
         }
         else
-            (void)PLOGERR(klogWarn, (klogWarn, rc = 0, "Database '$(name)':"
+            rc = RC(rcExe, rcDatabase, rcValidating, rcMemory, rcExhausted);
+        
+        if (GetRCObject(rc) == rcMemory && GetRCState(rc) == rcExhausted) {
+            rc = 0;
+            (void)PLOGERR(klogWarn, (klogWarn, rc, "Database '$(name)':"
                 " referential integrity could not be checked, skipped",
                 "name=%s", dbname));
+        }
     }
     VCursorRelease(acurs);
     VCursorRelease(bcurs);
@@ -1223,9 +1463,12 @@ static rc_t ric_align_seq_and_pri(char const dbname[],
     int64_t startId;
     uint64_t count;
 
+    aci.name = "SEQ_SPOT_ID";
+    bci.name = "PRIMARY_ALIGNMENT_ID";
+    
     rc = VTableCreateCursorRead(pri, &acurs);
     if (rc == 0)
-        rc = VCursorAddColumn(acurs, &aci.idx, "SEQ_SPOT_ID");
+        rc = VCursorAddColumn(acurs, &aci.idx, "%s", aci.name);
     if (rc == 0)
         rc = VCursorOpen(acurs);
     if (rc == 0)
@@ -1236,7 +1479,7 @@ static rc_t ric_align_seq_and_pri(char const dbname[],
     else {
         rc = VTableCreateCursorRead(seq, &bcurs);
         if (rc == 0)
-            rc = VCursorAddColumn(bcurs, &bci.idx, "PRIMARY_ALIGNMENT_ID");
+            rc = VCursorAddColumn(bcurs, &bci.idx, "%s", bci.name);
         if (rc == 0)
             rc = VCursorOpen(bcurs);
         if (rc)
@@ -1246,21 +1489,25 @@ static rc_t ric_align_seq_and_pri(char const dbname[],
     if (rc == 0) {
         size_t const chunk = work_chunk(count);
         id_pair_t *const pair = malloc((sizeof(id_pair_t)+sizeof(int64_t)) * chunk);
-        int64_t *const scratch = &pair[chunk].first;
 
         if (pair) {
-            rc = ric_align_generic(startId, count, chunk, pair, scratch,
+            void *scratch = NULL;
+            
+            rc = ric_align_generic(startId, count, chunk, pair, &scratch,
                                    acurs, &aci, bcurs, &bci);
-            if (GetRCObject(rc) == rcData && GetRCState(rc) == rcUnexpected)
+            if (scratch)
+                free(scratch);
+            
+            if (GetRCObject(rc) == (enum RCObject)rcData && GetRCState(rc) == rcUnexpected)
                 (void)PLOGERR(klogErr, (klogErr, rc,
                     "Database '$(name)': failed referential "
                     "integrity check", "name=%s", dbname));
-            else if (GetRCObject(rc) == rcData &&
+            else if (GetRCObject(rc) == (enum RCObject)rcData &&
                      GetRCState(rc) == rcInconsistent)
                 (void)PLOGERR(klogErr, (klogErr, rc,
 "Database '$(name)': column 'SEQ_SPOT_ID' failed referential integrity check",
 "name=%s", dbname));
-            else if (GetRCObject(rc) == rcData &&
+            else if (GetRCObject(rc) == (enum RCObject)rcData &&
                      GetRCState(rc) == rcTooBig)
                 (void)PLOGERR(klogWarn, (klogWarn, rc = 0, "Database '$(name)':"
                          " referential integrity could not be checked, skipped",
@@ -1459,11 +1706,18 @@ static rc_t verify_database(VDatabase const *db,
     return rc;
 }
 
-static rc_t verify_mgr_database(VDBManager const *mgr,
+static rc_t verify_mgr_database(const vdb_validate_params *pb,
     char const name[], node_t const nodes[], char const names[])
 {
+    rc_t rc = 0;
     VDatabase const *child;
-    rc_t rc = VDBManagerOpenDBRead(mgr, &child, NULL, name);
+    const VDBManager *mgr = NULL;
+    
+    assert(pb);
+
+    mgr = pb->vmgr;
+
+    rc = VDBManagerOpenDBRead(mgr, &child, NULL, "%s", name);
 
     if (rc == 0) {
         rc = verify_database(child, name, nodes, names);
@@ -1473,15 +1727,15 @@ static rc_t verify_mgr_database(VDBManager const *mgr,
     return rc;
 }
 
-static rc_t sra_dbcc(const VDBManager *mgr,
+static rc_t sra_dbcc(const vdb_validate_params *pb,
     char const name[], node_t const nodes[], char const names[])
 {
-    rc_t rc;
+    rc_t rc = 0;
 
     if (nodes[0].objType == kptDatabase)
-        rc = verify_mgr_database(mgr, name, nodes, names);
+        rc = verify_mgr_database(pb, name, nodes, names);
     else
-        rc = verify_mgr_table(mgr, name);
+        rc = verify_mgr_table(pb, name);
 
     return rc;
 }
@@ -1497,13 +1751,13 @@ rc_t get_platform(const VDBManager *mgr,
     if (tbl == NULL) {
         VSchema *sra_schema = NULL;
         for ( ; rc == 0; ) {
-            rc = VDBManagerOpenTableRead(mgr, &tbl, sra_schema, name);
+            rc = VDBManagerOpenTableRead(mgr, &tbl, sra_schema, "%s", name);
             VSchemaRelease(sra_schema);
             if (rc == 0) {
                 rc = VTable_get_platform(tbl, platform);
                 break;
             }
-            else if (GetRCState(rc) == rcNotFound && GetRCObject(rc) == rcSchema
+            else if (GetRCState(rc) == rcNotFound && GetRCObject(rc) == (enum RCObject)rcSchema
                 && sra_schema == NULL)
             {
                 rc = VDBManagerMakeSRASchema(mgr, &sra_schema);
@@ -1517,19 +1771,6 @@ rc_t get_platform(const VDBManager *mgr,
     return rc;
 }
 
-typedef struct vdb_validate_params vdb_validate_params;
-struct vdb_validate_params
-{
-    const KDirectory *wd;
-    const KDBManager *kmgr;
-    const VDBManager *vmgr;
-
-    bool md5_chk;
-    bool md5_chk_explicit;
-    bool blob_crc;
-    bool index_chk;
-};
-
 static
 rc_t dbcc ( const vdb_validate_params *pb, const char *path, bool is_file )
 {
@@ -1555,7 +1796,7 @@ rc_t dbcc ( const vdb_validate_params *pb, const char *path, bool is_file )
         if ( rc == 0 )
             rc = vdbcc ( pb -> vmgr, path, mode, & pathType, is_file );
         if ( rc == 0 )
-            rc = sra_dbcc ( pb -> vmgr, path, nodes, names );
+            rc = sra_dbcc(pb, path, nodes, names);
     }
 
     obj_type = ( pathType == kptDatabase ) ? "Database" : "Table";
@@ -1589,10 +1830,10 @@ const char *generate_relpath ( const vdb_validate_params *pb, const KDirectory *
     if ( dir != pb -> wd )
     {
         char full [ 4096 ];
-        rc_t rc = KDirectoryResolvePath ( dir, true, full, sizeof full, path );
+        rc_t rc = KDirectoryResolvePath ( dir, true, full, sizeof full, "%s", path );
         if ( rc == 0 )
         {
-            rc = KDirectoryResolvePath ( pb -> wd, false, buffer, bsize, full );
+            rc = KDirectoryResolvePath ( pb -> wd, false, buffer, bsize, "%s", full );
             if ( rc == 0 )
                 path = buffer;
         }
@@ -1608,7 +1849,7 @@ rc_t vdb_validate_file ( const vdb_validate_params *pb, const KDirectory *dir, c
     const char *relpath = generate_relpath ( pb, dir, buffer, sizeof buffer, path );
 
     const KFile *f;
-    rc_t rc = KDirectoryOpenFileRead ( dir, & f, path );
+    rc_t rc = KDirectoryOpenFileRead ( dir, & f, "%s", path );
     if ( rc != 0 )
         PLOGERR ( klogErr, ( klogErr, rc, "File '$(fname)' could not be opened", "fname=%s", relpath ) );
     else
@@ -1713,10 +1954,10 @@ static
 KPathType vdb_subdir_type ( const vdb_validate_params *pb, const KDirectory *dir, const char *name )
 {
     char full [ 4096 ];
-    rc_t rc = KDirectoryResolvePath ( dir, true, full, sizeof full, name );
+    rc_t rc = KDirectoryResolvePath ( dir, true, full, sizeof full, "%s", name );
     if ( rc == 0 )
     {
-        switch ( KDBManagerPathType ( pb -> kmgr, full ) )
+        switch ( KDBManagerPathType ( pb -> kmgr, "%s", full ) )
         {
         case kptDatabase:
             return kptDatabase;
@@ -1742,7 +1983,7 @@ rc_t CC vdb_validate_dir ( const KDirectory *dir, uint32_t type, const char *nam
         case kptTable:
             return vdb_validate_table ( data, dir, name );
         default:
-            return KDirectoryVisit ( dir, false, vdb_validate_dir, data, name );
+            return KDirectoryVisit ( dir, false, vdb_validate_dir, data, "%s", name );
         }
     }
 
@@ -1786,13 +2027,13 @@ static rc_t vdb_validate(const vdb_validate_params *pb, const char *aPath) {
     }
 
     /* what type of thing is this path? */
-    pt = KDirectoryPathType(pb->wd, path);
+    pt = KDirectoryPathType(pb->wd, "%s", path);
 
     if ((pt & ~kptAlias) == kptNotFound) {
         const VPath *pLocal = NULL;
         VPath *acc = NULL;
         bad = true;
-        rc = VFSManagerMakePath (mgr, &acc, path);
+        rc = VFSManagerMakePath (mgr, &acc, "%s", path);
         if (rc != 0) {
             PLOGERR(klogErr, (klogErr, rc,
                 "VPathMake($(path)) failed", PLOG_S(path), path));
@@ -1818,7 +2059,7 @@ static rc_t vdb_validate(const vdb_validate_params *pb, const char *aPath) {
             path = local->addr;
             PLOGMSG(klogInfo, (klogInfo,
                 "Validating '$(path)'...", PLOG_S(path), path));
-            pt = KDirectoryPathType(pb -> wd, path);
+            pt = KDirectoryPathType(pb -> wd, "%s", path);
             bad = false;
         }
 
@@ -1842,7 +2083,7 @@ static rc_t vdb_validate(const vdb_validate_params *pb, const char *aPath) {
                 rc = vdb_validate_file(pb, pb->wd, path);
                 break;
             case kptDir:
-                switch(KDBManagerPathType (pb->kmgr, path)) {
+                switch(KDBManagerPathType (pb->kmgr, "%s", path)) {
                     case kptDatabase:
                         rc = vdb_validate_database(pb, pb->wd, path);
                         break;
@@ -1858,7 +2099,7 @@ static rc_t vdb_validate(const vdb_validate_params *pb, const char *aPath) {
                         break;
                     default:
                         rc = KDirectoryVisit(pb -> wd, false,
-                            vdb_validate_dir, (void*)pb, path);
+                                             vdb_validate_dir, (void*)pb, "%s", path);
                         break;
                 }
                 break;
@@ -1877,12 +2118,12 @@ static rc_t vdb_validate(const vdb_validate_params *pb, const char *aPath) {
     return rc;
 }
 
-static char const* const defaultLogLevel =
+/*static char const* const defaultLogLevel =
 #if _DEBUGGING
 "debug5";
 #else
 "info";
-#endif
+#endif*/
 
 /******************************************************************************
  * Usage
@@ -1907,22 +2148,27 @@ rc_t CC UsageSummary(const char *prog_name)
     "Check index-only with blobs CRC32 (default: no)", NULL
 };*/
 
-#define OPTION_md5 "md5"
 #define ALIAS_md5  "5"
+#define OPTION_md5 "md5"
 static const char *USAGE_MD5[] = { "Check components md5s if present, "
     "fail unless other checks are requested (default: yes)", NULL };
 /*
 #define ALIAS_MD5  "M"
 #define OPTION_MD5 "MD5"
 */
-#define OPTION_blob_crc "blob-crc"
 #define ALIAS_blob_crc  "b"
+#define OPTION_blob_crc "blob-crc"
 static const char *USAGE_BLOB_CRC[] =
 { "Check blobs CRC32 (default: yes)", NULL };
 
 #define ALIAS_BLOB_CRC  "B"
 #define OPTION_BLOB_CRC "BLOB-CRC"
 
+#define ALIAS_CNS_CHK  "C"
+#define OPTION_CNS_CHK "CONSISTENCY-CHECK"
+static const char *USAGE_CNS_CHK[] =
+{ "Deeply check data consistency for tables (default: no)", NULL };
+
 #if CHECK_INDEX
 #define ALIAS_INDEX  "i"
 #define OPTION_INDEX "index"
@@ -1934,8 +2180,8 @@ static const char *USAGE_INDEX[] = { "Check 'skey' index (default: no)", NULL };
 static const char *USAGE_EXHAUSTIVE[] =
 { "Continue checking object for all possible errors (default: false)", NULL };
 
-#define OPTION_ref_int "referential-integrity"
 #define ALIAS_ref_int  "d"
+#define OPTION_ref_int "referential-integrity"
 static const char *USAGE_REF_INT[] =
 { "Check data referential integrity for databases (default: yes)", NULL };
 
@@ -1958,6 +2204,7 @@ static OptDef options [] =
   , { OPTION_EXHAUSTIVE,
                    ALIAS_EXHAUSTIVE, NULL, USAGE_EXHAUSTIVE, 1, false, false }
   , { OPTION_REF_INT , ALIAS_REF_INT , NULL, USAGE_REF_INT , 1, true , false }
+  , { OPTION_CNS_CHK , ALIAS_CNS_CHK , NULL, USAGE_CNS_CHK , 1, true , false }
 
     /* not printed by --help */
   , { "dri"          , NULL          , NULL, USAGE_DRI     , 1, false, false }
@@ -2008,6 +2255,7 @@ rc_t CC Usage ( const Args * args )
     HelpOptionLine(ALIAS_INDEX   , OPTION_INDEX   , "yes | no", USAGE_INDEX);
 #endif
     HelpOptionLine(ALIAS_REF_INT , OPTION_REF_INT , "yes | no", USAGE_REF_INT);
+    HelpOptionLine(ALIAS_CNS_CHK , OPTION_CNS_CHK , "yes | no", USAGE_CNS_CHK);
     HelpOptionLine(ALIAS_EXHAUSTIVE, OPTION_EXHAUSTIVE, NULL, USAGE_EXHAUSTIVE);
 
 /*
@@ -2040,9 +2288,11 @@ rc_t parse_args ( vdb_validate_params *pb, Args *args )
     uint32_t cnt;
 
     pb -> md5_chk = true;
+    pb->consist_check = false;
     ref_int_check = pb -> blob_crc
         = pb -> md5_chk_explicit = md5_required = true;
 /*
+  {
     rc = ArgsOptionCount(args, OPTION_MD5, &cnt);
     if (rc != 0) {
         LOGERR(klogErr, rc, "Failure to get '" OPTION_MD5 "' argument");
@@ -2059,7 +2309,8 @@ rc_t parse_args ( vdb_validate_params *pb, Args *args )
             pb -> md5_chk_explicit = md5_required = false;
         }
     }
-*/
+  }
+*/{
     rc = ArgsOptionCount( args, OPTION_BLOB_CRC, &cnt);
     if (rc != 0) {
         LOGERR(klogErr, rc, "Failure to get '" OPTION_BLOB_CRC "' argument");
@@ -2077,12 +2328,33 @@ rc_t parse_args ( vdb_validate_params *pb, Args *args )
             pb -> blob_crc = false;
         }
     }
-
+  }
+  {
+    rc = ArgsOptionCount(args, OPTION_CNS_CHK, &cnt);
+    if (rc != 0) {
+        LOGERR(klogErr, rc, "Failure to get '" OPTION_CNS_CHK "' argument");
+        return rc;
+    }
+    if (cnt != 0) {
+        rc = ArgsOptionValue(args, OPTION_CNS_CHK, 0, &dummy);
+        if (rc != 0) {
+            LOGERR(klogErr, rc,
+                "Failure to get '" OPTION_CNS_CHK "' argument");
+            return rc;
+        }
+        assert(dummy && dummy[0]);
+        if (dummy[0] == 'y') {
+            pb->consist_check = true;
+        }
+    }
+  }
+  {
     rc = ArgsOptionCount ( args, "exhaustive", & cnt );
     if ( rc != 0 )
         return rc;
     exhaustive = cnt != 0;
-
+  }
+  {
     rc = ArgsOptionCount(args, OPTION_REF_INT, &cnt);
     if (rc != 0) {
         LOGERR(klogErr, rc, "Failure to get '" OPTION_REF_INT "' argument");
@@ -2100,30 +2372,36 @@ rc_t parse_args ( vdb_validate_params *pb, Args *args )
             ref_int_check = false;
         }
     }
-
+  }
+  {
     rc = ArgsOptionCount ( args, "dri", & cnt );
     if ( rc != 0 )
         return rc;
     if (cnt != 0) {
         ref_int_check = false;
     }
-
+  }
 #if CHECK_INDEX
+  {
     rc = ArgsOptionCount ( args, "index", & cnt );
     if ( rc != 0 )
         return rc;
     pb -> index_chk = cnt != 0;
+  }
 #endif
-
+  {
     rc = ArgsOptionCount ( args, "index-only", & cnt );
     if ( rc != 0 )
         return rc;
     if ( cnt != 0 )
         s_IndexOnly = pb -> blob_crc = true;
+  }
 
     if ( pb -> blob_crc || pb -> index_chk )
         pb -> md5_chk = pb -> md5_chk_explicit;
 
+    pb->exhaustive = exhaustive;
+
     return 0;
 }
 
@@ -2215,6 +2493,7 @@ rc_t CC KMain ( int argc, char *argv [] )
                         STSMSG(2, ("\tmd5_chk_explicit = %d",
                             pb.md5_chk_explicit));
                         STSMSG(2, ("\tblob_crc = %d", pb.blob_crc));
+                        STSMSG(2, ("\tconsist_check = %d", pb.consist_check));
                         STSMSG(2, ("}"));
                         for ( i = 0; i < pcount; ++ i )
                         {
diff --git a/tools/vdb-validate/vdb-validate.vers b/tools/vdb-validate/vdb-validate.vers
index cc6c9a4..8e8299d 100644
--- a/tools/vdb-validate/vdb-validate.vers
+++ b/tools/vdb-validate/vdb-validate.vers
@@ -1 +1 @@
-2.3.5
+2.4.2
diff --git a/tools/vdb-validate/vdb-validate.vers.h b/tools/vdb-validate/vdb-validate.vers.h
new file mode 100644
index 0000000..d4aa6ce
--- /dev/null
+++ b/tools/vdb-validate/vdb-validate.vers.h
@@ -0,0 +1 @@
+#define VDB_VALIDATE_VERS 0x02040002
diff --git a/tools/vdbview/b_first.png b/tools/vdbview/b_first.png
new file mode 100644
index 0000000..1dcc2b4
Binary files /dev/null and b/tools/vdbview/b_first.png differ
diff --git a/tools/vdbview/b_goto.png b/tools/vdbview/b_goto.png
new file mode 100644
index 0000000..0515cbb
Binary files /dev/null and b/tools/vdbview/b_goto.png differ
diff --git a/tools/vdbview/b_last.png b/tools/vdbview/b_last.png
new file mode 100644
index 0000000..0d7522b
Binary files /dev/null and b/tools/vdbview/b_last.png differ
diff --git a/tools/vdbview/b_next.png b/tools/vdbview/b_next.png
new file mode 100644
index 0000000..4abecd8
Binary files /dev/null and b/tools/vdbview/b_next.png differ
diff --git a/tools/vdbview/b_nextpage.png b/tools/vdbview/b_nextpage.png
new file mode 100644
index 0000000..fd24611
Binary files /dev/null and b/tools/vdbview/b_nextpage.png differ
diff --git a/tools/vdbview/b_prev.png b/tools/vdbview/b_prev.png
new file mode 100644
index 0000000..da478a8
Binary files /dev/null and b/tools/vdbview/b_prev.png differ
diff --git a/tools/vdbview/b_prevpage.png b/tools/vdbview/b_prevpage.png
new file mode 100644
index 0000000..c64d514
Binary files /dev/null and b/tools/vdbview/b_prevpage.png differ
diff --git a/tools/vdbview/b_search.png b/tools/vdbview/b_search.png
new file mode 100644
index 0000000..c4b8e7e
Binary files /dev/null and b/tools/vdbview/b_search.png differ
diff --git a/tools/vdbview/background.pas b/tools/vdbview/background.pas
new file mode 100644
index 0000000..83092e3
--- /dev/null
+++ b/tools/vdbview/background.pas
@@ -0,0 +1,277 @@
+unit background;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  Classes, SysUtils, jobdef, linkedlist, svdb_obj, selector_types;
+
+Type
+
+    TOnJobDone = procedure( aJob : PJob ) of Object;
+
+    { TBackground }
+
+    TBackground = class( TThread )
+    private
+      FOnJobDone : TOnJobDone;
+      FInputQ    : TMutexJobQ;
+      FJob       : PJob;
+      FSvdb      : TSvdb_obj;
+      FIsOpen    : boolean;
+
+      procedure exec_cmd_cell;
+      procedure exec_cmd_colcount;
+      procedure exec_cmd_colname;
+      procedure exec_cmd_colsdone;
+      procedure exec_cmd_open;
+      procedure exec_cmd_close;
+      procedure exec_cmd_opened;
+      procedure exec_cmd_opentab;
+      procedure exec_cmd_search;
+      procedure exec_cmd_tablename;
+
+    protected
+      procedure Execute; override;
+      procedure Notify;
+    public
+      constructor Create( OnJobDone : TOnJobDone );
+      destructor Destroy; override;
+      function PutJob( aJob : PJob ) : boolean;
+      procedure FlushJobs( q : TJobQ );
+    end;
+
+implementation
+
+function mask_the_backslash( const s : string ) : string;
+var i : Integer;
+begin
+  Result := '';
+  for i:= 1 to Length( s )
+    do begin
+    if ( s[ i ] = '\' )
+      then Result := Result + '/'
+      else Result := Result + s[ i ];
+    end;
+end;
+
+{ TBackground }
+
+{ **************************************************
+  IN : S1...acc, S2...path,
+  OUT: I1...open( 0=no, 1=yes )
+       I2...isDb( 0=no, 1=yes )
+       I3...Tablecount
+  ************************************************** }
+procedure TBackground.exec_cmd_open;
+begin
+  FJob^.I1 := 0;
+  FJob^.I2 := 0;
+  if ( FIsOpen )
+    then exec_cmd_close;
+  if ( Length( FJob^.S1 ) > 0 )
+    then begin
+    FJob^.S2 := FSvdb.Acc2Path( FJob^.S1 );
+    end;
+  if ( Length( FJob^.S2 ) > 0 )
+    then if FSvdb.OpenPath( mask_the_backslash( FJob^.S2 ) )
+           then FIsOpen := True;
+  if FIsOpen
+    then begin
+    FJob^.I1 := 1;
+    if FSvdb.IsDb
+      then FJob^.I2 := 1;
+    FJob^.I3 := FSvdb.CountTabs;
+    end;
+end;
+
+
+procedure TBackground.exec_cmd_close;
+begin
+  if ( FIsOpen )
+    then begin
+    FSvdb.Close;
+    FIsOpen := false;
+    end;
+end;
+
+
+{ **************************************************
+  IN : I1...index
+  OUT: S1...Tablename
+  ************************************************** }
+procedure TBackground.exec_cmd_tablename;
+begin
+  if ( FIsOpen )
+    then FJob^.S1 := FSvdb.TabName( FJob^.I1 );
+end;
+
+
+{ **************************************************
+  IN : I1...tab-idx
+     : I2...selector (all,visible)
+  OUT: I3...count
+  ************************************************** }
+procedure TBackground.exec_cmd_colcount;
+begin
+  if ( FIsOpen )
+    then FJob^.I3 := FSvdb.CountCols( FJob^.I1, FJob^.I2 );
+end;
+
+
+{ *** do nothing, just pass through as a signal *** }
+procedure TBackground.exec_cmd_opened; begin end;
+
+
+{ **************************************************
+  IN : I1...tab-idx
+       I2...selector (all,visible)
+       I3...idx
+  OUT: S1...name
+  ************************************************** }
+procedure TBackground.exec_cmd_colname;
+begin
+  if ( FIsOpen )
+    then FJob^.S1 := FSvdb.ColName( FJob^.I1, FJob^.I2, FJob^.I3 );
+end;
+
+
+{ **************************************************
+  IN : I1...tab-idx
+  OUT: I2...result-code
+       I3...RowRange
+       S1...Non-Static-Columns as String 'XX-X-X--'
+  ************************************************** }
+procedure TBackground.exec_cmd_opentab;
+var i, n : Integer;
+    s : String;
+begin
+  if ( FIsOpen )
+    then begin
+    FJob^.I2 := FSvdb.OpenTable( FJob^.I1, '' );
+    FJob^.I3 := FSvdb.RowRange( FJob^.I1 );
+    n := FSvdb.CountCols( FJob^.I1, ALL_COLUMNS );
+    for i := 0 to n - 1
+      do begin
+      s := FSvdb.ColName( FJob^.I1, ALL_COLUMNS, i );
+      if ( FSvdb.ColIdx( FJob^.I1, NON_STATIC_COLUMNS, s ) >= 0 )
+        then FJob^.S1 := FJob^.S1 + 'X'
+        else FJob^.S1 := FJob^.S1 + '-';
+      end;
+    end;
+end;
+
+
+{ **************************************************
+  IN : I1...tab-idx
+       I2...selector (all,visible)
+       I3...aCol
+       I4...aRow
+  OUT: S1...name
+  ************************************************** }
+procedure TBackground.exec_cmd_cell;
+begin
+  if ( FIsOpen )
+    then FJob^.S1 := FSvdb.GetCell( FJob^.I1, FJob^.I2, FJob^.I3, FJob^.I4 );
+end;
+
+
+{ **************************************************
+  IN : I1...tab-idx
+       I2...column to search in
+       I3...row to start searching at
+       I4...forward or backward
+       I5...search-chunk
+       S1...text to search for
+  OUT: I6... >= 0 ... pattern found at this row,
+             -1 ... pattern not found
+             -2 ... chunk exhausted, pattern not found
+  ************************************************** }
+procedure TBackground.exec_cmd_search;
+begin
+  FJob^.I6 := -1;
+  if ( FIsOpen )
+    then if ( FJob^.I4 = 0 )
+           then FJob^.I6 := FSvdb.FindBwd( FJob^.I1, ALL_COLUMNS,
+                 FJob^.I2, FJob^.I3, FJob^.I5, FJob^.S1 )
+           else FJob^.I6 := FSvdb.FindFwd( FJob^.I1, ALL_COLUMNS,
+                 FJob^.I2, FJob^.I3, FJob^.I5, FJob^.S1 );
+end;
+
+
+{ *** do nothing, just pass through as a signal *** }
+procedure TBackground.exec_cmd_colsdone; begin end;
+
+procedure TBackground.Execute;
+var working : boolean;
+begin
+  working := false;
+  while ( not Terminated ) do
+    begin
+    if ( FInputQ.Empty )
+       then begin
+       if working
+         then begin
+         working := false;
+         FJob := Nil;
+         Synchronize( @Notify );
+         end;
+       Sleep( 200 );
+       end
+       else begin
+       working := true;
+       FJob := FInputQ.Get;
+       case FJob^.cmd of
+        CMD_OPEN  : exec_cmd_open;
+        CMD_CLOSE : exec_cmd_close;
+        CMD_TABLENAME : exec_cmd_tablename;
+        CMD_OPENED : exec_cmd_opened;
+        CMD_COLCOUNT : exec_cmd_colcount;
+        CMD_COLNAME : exec_cmd_colname;
+        CMD_COLSDONE : exec_cmd_colsdone;
+        CMD_OPENTAB : exec_cmd_opentab;
+        CMD_CELL : exec_cmd_cell;
+        CMD_SEARCH : exec_cmd_search;
+       end;
+       Synchronize( @Notify );
+       end;
+    end;
+end;
+
+procedure TBackground.Notify;
+begin
+  if Assigned( FOnJobDone )
+    then FOnJobDone( FJob );
+end;
+
+constructor TBackground.Create( OnJobDone : TOnJobDone );
+begin
+  FreeOnTerminate := True;
+  FOnJobDone  := OnJobDone;
+  FInputQ     := TMutexJobQ.Create;
+  FSvdb       := TSvdb_obj.Create;
+  FIsOpen     := false;
+  inherited Create( false );
+end;
+
+destructor TBackground.Destroy;
+begin
+  inherited Destroy;
+  FSvdb.Destroy;
+  FInputQ.Free;
+end;
+
+function TBackground.PutJob( aJob : PJob ) : boolean;
+begin
+  Result := FInputQ.Empty;
+  FInputQ.Put( aJob );
+end;
+
+procedure TBackground.FlushJobs( q : TJobQ );
+begin
+  FInputQ.Flush( q );
+end;
+
+end.
+
diff --git a/tools/vdbview/buttons.svg b/tools/vdbview/buttons.svg
new file mode 100644
index 0000000..c298afa
--- /dev/null
+++ b/tools/vdbview/buttons.svg
@@ -0,0 +1,268 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://web.resource.org/cc/"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="744.09448819"
+   height="1052.3622047"
+   id="svg2"
+   sodipodi:version="0.32"
+   inkscape:version="0.45pre1"
+   sodipodi:docbase="C:\Users\raetzw\Documents\Lazarus_prj\vdbview"
+   sodipodi:docname="buttons.svg"
+   inkscape:output_extension="org.inkscape.output.svg.inkscape"
+   sodipodi:modified="TRUE">
+  <defs
+     id="defs4" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     gridtolerance="10000"
+     guidetolerance="10"
+     objecttolerance="10"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="2.9623907"
+     inkscape:cx="214.19993"
+     inkscape:cy="613.92108"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="true"
+     gridspacingx="20px"
+     gridspacingy="20px"
+     inkscape:grid-points="true"
+     inkscape:window-width="1335"
+     inkscape:window-height="981"
+     inkscape:window-x="210"
+     inkscape:window-y="93" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1">
+    <g
+       id="g7117"
+       inkscape:export-filename="C:\Users\raetzw\Documents\Lazarus_prj\vdbview\b_nextpage.png"
+       inkscape:export-xdpi="16.5"
+       inkscape:export-ydpi="16.5">
+      <rect
+         transform="matrix(2.9134226,0,0,2.9928606,-74.805361,-183.92217)"
+         y="112.36218"
+         x="60"
+         height="40.095417"
+         width="41.188671"
+         id="rect3131"
+         style="opacity:1;color:#000000;fill:#ff6600;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+      <path
+         transform="translate(39.999999,39.999993)"
+         id="path4105"
+         d="M 80,132.36218 L 140,172.36218 L 80,212.36218"
+         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:9;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+      <path
+         transform="translate(39.999999,39.999993)"
+         id="path4109"
+         d="M 100,132.36218 L 160,172.36218 L 100,212.36218"
+         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:9;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+    </g>
+    <g
+       id="g7122"
+       transform="translate(-2.8184434e-7,3.3322021e-6)"
+       inkscape:export-filename="C:\Users\raetzw\Documents\Lazarus_prj\vdbview\b_prevpage.png"
+       inkscape:export-xdpi="16.5"
+       inkscape:export-ydpi="16.5">
+      <rect
+         style="opacity:1;color:#000000;fill:#ff6600;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+         id="rect5080"
+         width="41.188671"
+         height="40.095417"
+         x="60"
+         y="112.36218"
+         transform="matrix(2.9134226,0,0,2.9928606,65.194639,-183.92217)" />
+      <path
+         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:9;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         d="M 80,132.36218 L 140,172.36218 L 80,212.36218"
+         id="path5082"
+         transform="matrix(-1,0,0,-1,420,384.72436)" />
+      <path
+         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:9;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         d="M 100,132.36218 L 160,172.36218 L 100,212.36218"
+         id="path5084"
+         transform="matrix(-1,0,0,-1,420,384.72436)" />
+    </g>
+    <g
+       id="g7109"
+       inkscape:export-filename="C:\Users\raetzw\Documents\Lazarus_prj\vdbview\b_next.png"
+       inkscape:export-xdpi="16.5"
+       inkscape:export-ydpi="16.5">
+      <rect
+         style="opacity:1;color:#000000;fill:#ff6600;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+         id="rect5086"
+         width="41.188671"
+         height="40.095417"
+         x="60"
+         y="112.36218"
+         transform="matrix(2.9134226,0,0,2.9928606,-74.805361,-43.922167)" />
+      <path
+         sodipodi:nodetypes="ccc"
+         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:9;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         d="M 80,132.36218 L 160,172.36218 L 80,212.36218"
+         id="path5088"
+         transform="translate(39.999999,180)" />
+    </g>
+    <g
+       id="g7136">
+      <rect
+         transform="matrix(2.9134226,0,0,2.9928606,65.194639,-43.922167)"
+         y="112.36218"
+         x="60"
+         height="40.095417"
+         width="41.188671"
+         id="rect5092"
+         style="color:#000000;fill:#ff6600;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+      <path
+         sodipodi:nodetypes="ccc"
+         transform="matrix(-1,0,0,-1,420,524.72436)"
+         id="path5094"
+         d="M 80,132.36218 L 160,172.36218 L 80,212.36218"
+         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:9;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+    </g>
+    <g
+       id="g7086"
+       inkscape:export-filename="C:\Users\raetzw\Documents\Lazarus_prj\vdbview\b_last.png"
+       inkscape:export-xdpi="16.5"
+       inkscape:export-ydpi="16.5">
+      <rect
+         style="opacity:1;color:#000000;fill:#ff6600;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+         id="rect5098"
+         width="41.188671"
+         height="40.095417"
+         x="60"
+         y="112.36218"
+         transform="matrix(2.9134226,0,0,2.9928606,-74.805361,96.077833)" />
+      <path
+         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:9;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         d="M 80,132.36218 L 140,172.36218 L 80,212.36218"
+         id="path5100"
+         transform="translate(39.999999,320)" />
+      <path
+         sodipodi:nodetypes="cc"
+         transform="translate(120,320)"
+         id="path5112"
+         d="M 80,132.36218 L 80,212.36218"
+         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:9;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+    </g>
+    <g
+       id="g7081"
+       inkscape:export-filename="C:\Users\raetzw\Documents\Lazarus_prj\vdbview\b_first.png"
+       inkscape:export-xdpi="16.5"
+       inkscape:export-ydpi="16.5">
+      <rect
+         transform="matrix(2.9134226,0,0,2.9928606,65.194639,96.077833)"
+         y="112.36218"
+         x="60"
+         height="40.095417"
+         width="41.188671"
+         id="rect5104"
+         style="opacity:1;color:#000000;fill:#ff6600;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+      <path
+         transform="matrix(-1,0,0,-1,420,664.72436)"
+         id="path5106"
+         d="M 80,132.36218 L 140,172.36218 L 80,212.36218"
+         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:9;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:9;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         d="M 80,132.36218 L 80,212.36218"
+         id="path5115"
+         transform="translate(180,320)"
+         sodipodi:nodetypes="cc" />
+    </g>
+    <g
+       id="g7127"
+       inkscape:export-filename="C:\Users\raetzw\Documents\Lazarus_prj\vdbview\b_search.png"
+       inkscape:export-xdpi="16.5"
+       inkscape:export-ydpi="16.5">
+      <rect
+         transform="matrix(2.9134226,0,0,2.9928606,205.19464,-183.92217)"
+         y="112.36218"
+         x="60"
+         height="40.095417"
+         width="41.188671"
+         id="rect5135"
+         style="opacity:1;color:#000000;fill:#ff6600;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+      <path
+         transform="translate(4.5,-124.5)"
+         d="M 480 322.36218 A 30 30 0 1 1  420,322.36218 A 30 30 0 1 1  480 322.36218 z"
+         sodipodi:ry="30"
+         sodipodi:rx="30"
+         sodipodi:cy="322.36218"
+         sodipodi:cx="450"
+         id="path5137"
+         style="opacity:1;color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:9;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+         sodipodi:type="arc" />
+      <path
+         sodipodi:nodetypes="cc"
+         id="path6108"
+         d="M 434.26139,220.46374 L 400,252.36218"
+         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:9;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+    </g>
+    <g
+       id="g7146"
+       inkscape:export-filename="C:\Users\raetzw\Documents\Lazarus_prj\vdbview\b_goto.png"
+       inkscape:export-xdpi="16.5"
+       inkscape:export-ydpi="16.5">
+      <rect
+         style="opacity:1;color:#000000;fill:#ff6600;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+         id="rect7079"
+         width="41.188671"
+         height="40.095417"
+         x="60"
+         y="112.36218"
+         transform="matrix(2.9134226,0,0,2.9928606,205.19464,-43.922167)" />
+      <path
+         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:9;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         d="M 80,132.36218 L 80,212.36218"
+         id="path7134"
+         transform="matrix(-1,0,0,-1,500,524.72436)"
+         sodipodi:nodetypes="cc" />
+      <path
+         sodipodi:nodetypes="cc"
+         transform="matrix(-1,0,0,-1,540,524.72436)"
+         id="path7140"
+         d="M 80,132.36218 L 80,212.36218"
+         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:9;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         inkscape:transform-center-y="19.999997"
+         inkscape:transform-center-x="-60"
+         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:9;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         d="M 80,132.36218 L 80,212.36218"
+         id="path7142"
+         transform="matrix(0,1,-1,0,612.36218,252.36218)"
+         sodipodi:nodetypes="cc" />
+      <path
+         sodipodi:nodetypes="cc"
+         transform="matrix(0,1,-1,0,612.36218,292.36218)"
+         id="path7144"
+         d="M 80,132.36218 L 80,212.36218"
+         style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:9;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         inkscape:transform-center-x="-60"
+         inkscape:transform-center-y="19.999997" />
+    </g>
+  </g>
+</svg>
diff --git a/tools/vdbview/columnsel.lfm b/tools/vdbview/columnsel.lfm
new file mode 100644
index 0000000..b2c0f76
--- /dev/null
+++ b/tools/vdbview/columnsel.lfm
@@ -0,0 +1,90 @@
+object Columnform: TColumnform
+  Left = 375
+  Height = 472
+  Top = 154
+  Width = 350
+  BorderStyle = bsSingle
+  Caption = 'columns...'
+  ClientHeight = 472
+  ClientWidth = 350
+  LCLVersion = '0.9.30'
+  object ColumnBox: TCheckListBox
+    Left = 0
+    Height = 376
+    Top = 0
+    Width = 350
+    Align = alClient
+    ItemHeight = 0
+    OnItemClick = ColumnBoxItemClick
+    TabOrder = 0
+  end
+  object Footer: TPanel
+    Left = 0
+    Height = 50
+    Top = 422
+    Width = 350
+    Align = alBottom
+    ClientHeight = 50
+    ClientWidth = 350
+    TabOrder = 1
+    object BOK: TBitBtn
+      Left = 16
+      Height = 30
+      Top = 10
+      Width = 144
+      Caption = '&OK'
+      Default = True
+      Kind = bkOK
+      ModalResult = 1
+      TabOrder = 0
+    end
+    object BCancel: TBitBtn
+      Left = 192
+      Height = 30
+      Top = 10
+      Width = 144
+      Cancel = True
+      Caption = 'Cancel'
+      Kind = bkCancel
+      ModalResult = 2
+      TabOrder = 1
+    end
+  end
+  object Panel1: TPanel
+    Left = 0
+    Height = 46
+    Top = 376
+    Width = 350
+    Align = alBottom
+    ClientHeight = 46
+    ClientWidth = 350
+    TabOrder = 2
+    object BClear: TButton
+      Left = 16
+      Height = 25
+      Top = 8
+      Width = 104
+      Caption = 'Clear all'
+      OnClick = BClearClick
+      TabOrder = 0
+    end
+    object BSetAll: TButton
+      Left = 128
+      Height = 25
+      Top = 8
+      Width = 99
+      Caption = 'Set all'
+      OnClick = BSetAllClick
+      TabOrder = 1
+    end
+    object BNonStatic: TButton
+      Left = 237
+      Height = 25
+      Top = 8
+      Width = 99
+      Caption = 'Set non static'
+      OnClick = BNonStaticClick
+      TabOrder = 2
+    end
+  end
+end
diff --git a/tools/vdbview/columnsel.pas b/tools/vdbview/columnsel.pas
new file mode 100644
index 0000000..bc0c9c4
--- /dev/null
+++ b/tools/vdbview/columnsel.pas
@@ -0,0 +1,115 @@
+unit ColumnSel;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, CheckLst,
+  ExtCtrls, Buttons, StdCtrls, DataProxy, selector_types, support_unit;
+
+type
+
+  { TColumnform }
+
+  TColumnform = class(TForm)
+    BOK: TBitBtn;
+    BCancel: TBitBtn;
+    BClear: TButton;
+    BSetAll: TButton;
+    BNonStatic: TButton;
+    ColumnBox: TCheckListBox;
+    Footer: TPanel;
+    Panel1: TPanel;
+    procedure BClearClick(Sender: TObject);
+    procedure BNonStaticClick(Sender: TObject);
+    procedure BSetAllClick(Sender: TObject);
+    procedure ColumnBoxItemClick( Sender : TObject; Index : integer );
+  private
+    { private declarations }
+    FOrgChecked : String;
+    FNonStatic  : String;
+    procedure setup_columns( aProxy : TProxy );
+    procedure enable_bok;
+  public
+    { public declarations }
+    function present( const p : TPoint; const h : Integer;
+                      aProxy : TProxy ) : boolean;
+    function checked_items : String;
+  end;
+
+var
+  Columnform: TColumnform;
+
+
+implementation
+
+{$R *.lfm}
+
+{ TColumnform }
+
+procedure TColumnform.BClearClick( Sender : TObject );
+var i : Integer;
+begin
+  for i:=0 to ColumnBox.Items.Count -1
+    do ColumnBox.Checked[ i ] := false;
+  enable_bok;
+end;
+
+procedure TColumnform.BNonStaticClick( Sender : TObject );
+var i : Integer;
+begin
+  for i:=0 to ColumnBox.Items.Count -1
+    do ColumnBox.Checked[ i ] := ( FNonStatic[ i + 1 ] = 'X' );
+  enable_bok;
+end;
+
+procedure TColumnform.BSetAllClick( Sender : TObject );
+var i : Integer;
+begin
+  for i:=0 to ColumnBox.Items.Count -1
+    do ColumnBox.Checked[ i ] := true;
+  enable_bok;
+end;
+
+procedure TColumnform.ColumnBoxItemClick( Sender : TObject; Index : integer );
+begin
+  enable_bok;
+end;
+
+procedure TColumnform.setup_columns( aProxy : TProxy );
+var i : Integer;
+begin
+  ColumnBox.Clear;
+  for i:=0 to aProxy.ColCount[ ALL_COLUMNS ] - 1
+    do begin
+    ColumnBox.Items.Add( aProxy.ColName[ ALL_COLUMNS, i ] );
+    ColumnBox.Checked[ i ] := aProxy.ColVisibleI[ i ];
+    end;
+  FNonStatic := aProxy.NonStaticColumns;
+end;
+
+procedure TColumnform.enable_bok;
+begin
+  BOK.Enabled := ( FOrgChecked <> checked_items );
+end;
+
+function TColumnform.present( const p : TPoint; const h : Integer;
+                              aProxy : TProxy ) : boolean;
+begin
+  Left := p.x;
+  Top  := p.y;
+  Height := h;
+  setup_columns( aProxy );
+  FOrgChecked := CheckListBox2String( ColumnBox );
+  BOK.Enabled := False;
+  Result := ( ShowModal = mrOK );
+end;
+
+function TColumnform.checked_items: String;
+begin
+  Result := CheckListBox2String( ColumnBox );
+end;
+
+end.
+
diff --git a/tools/vdbview/dataproxy.pas b/tools/vdbview/dataproxy.pas
new file mode 100644
index 0000000..39fc670
--- /dev/null
+++ b/tools/vdbview/dataproxy.pas
@@ -0,0 +1,602 @@
+unit DataProxy;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  Classes, SysUtils, Dialogs, math, jobdef, background, linkedlist,
+  selector_types;
+
+type
+
+  cell = record
+    value : String;
+    valid : boolean;
+  end;
+
+  row = record
+    cells : array of cell;
+  end;
+
+  TOnCellValid = procedure( const aCol, aRow : Integer ) of Object;
+  TOnSearchDone = procedure( const aCol, aRow : Integer;
+                             const pattern : String ) of Object;
+  TOnOpened = procedure( const path : String; success : Boolean ) of Object;
+  TOnTableSwitched = procedure of Object;
+  TOnClosed = procedure of Object;
+  TOnLED = procedure( state : boolean ) of Object;
+  TOnLog = procedure( const s : String ) of Object;
+
+  { TProxy }
+
+  TProxy = class
+  private
+    rows : array of row;
+    FOffset  : Integer;
+    FRows    : Integer;
+    FCols    : Integer;
+    FVisCols : Integer;
+
+    FBackground  : TBackground;
+    FJobStock    : TJobQ;
+    FTableNames  : TStringList;
+
+    FAllColumnNames : TStringList;
+    FVisIdx2AllIdx : array of Integer;
+    FAllIdx2VisIdx : array of Integer;
+
+    FOnCellValid  : TOnCellValid;
+    FOnOpened     : TOnOpened;
+    FOnTableSwitched : TOnTableSwitched;
+    FOnClosed     : TOnClosed;
+    FOnSearchDone : TOnSearchDone;
+    FOnLED        : TOnLED;
+
+    FAccession   : String;
+    FOpenPath    : String;
+    FNonStatic   : String;
+    FTabId       : Integer;
+    FIsOpen      : boolean;
+    FIsDb        : boolean;
+    FTables      : Integer;
+    FTableRows   : Integer;
+    FSearchChunk : Integer;
+    FSearchCancel: boolean;
+
+    procedure CopyRow( const dst, src : Integer );
+    function GetCell( aCol, aRow : Integer ): String;
+    function GetColCount( sel : Integer ): Integer;
+    function GetColName( sel, idx : Integer ): String;
+    function GetColVisibleI( idx : Integer ): boolean;
+    function GetColVisibleS( aName : String ): boolean;
+    function GetTableName( idx : Integer ): String;
+    procedure Invalidate( const firstrow, lastrow : Integer );
+    procedure SetColVisibleI( idx : Integer ; const AValue : boolean );
+    procedure SetColVisibleS( aName : String ; const AValue : boolean );
+    procedure SetOffset( const n : Integer );
+    procedure AdjustCacheColumnCount( const n : Integer );
+
+    procedure SendJob( cmd : TCmdType;
+                       i1, i2, i3, i4, i5, i6 : Integer;
+                       s1, s2 : String );
+    procedure QueryColName( sel, idx : Integer );
+    procedure QueryOpened;
+    procedure QueryTablename( idx : Integer );
+    procedure QueryColCount( sel : Integer );
+    procedure QueryColsDone( sel : Integer );
+    procedure QueryCell( sel, aCol, aRow : Integer );
+    procedure QueryOpenTab;
+
+    procedure OnJobDone( job : PJob );
+    procedure OnOpenJobDone( job : PJob );
+    procedure OnOpenedReceived;
+    procedure OnCloseJobDone;
+    procedure OnColCountReceived( job : PJob );
+    procedure OnColNameReceived( job : PJob );
+    procedure OnColsDoneReceived( job : PJob );
+    procedure OnTableName( job : PJob );
+    procedure OnOpenTabReceived( job : PJob );
+    procedure OnCellReceived( job : PJob );
+    procedure OnSearchReceived( job : PJob );
+
+    procedure SetTabId( const AValue : Integer );
+    procedure ShiftRows( const by : Integer );
+  public
+    constructor Create;
+    destructor Destroy; override;
+    procedure AdjustCacheRows( const n : Integer );
+    procedure Open( path, acc : String );
+    procedure AjustVisibleColumns( checked : String );
+    procedure Search( fwd : boolean; colidx, startrow : Integer;
+                      pattern : String );
+    procedure CancelSearch;
+
+    property OnCellValid : TOnCellValid read FOnCellValid write FOnCellValid;
+    property OnOpened : TOnOpened read FOnOpened write FOnOpened;
+    property OnTableSwitched : TOnTableSwitched read FOnTableSwitched write FOnTableSwitched;
+    property OnClosed : TOnClosed read FOnClosed write FOnClosed;
+    property OnLED : TOnLED read FOnLED write FOnLED;
+    property OnSearchDone : TOnSearchDone read FOnSearchDone write FOnSearchDone;
+
+    property Tables : Integer read FTables;
+    property TableName[ idx : Integer ] : String read GetTableName;
+    property TableRows : Integer read FTableRows;
+    property IsDb : Boolean read FIsDb;
+    property Accession : String read FAccession;
+    property IsOpen : Boolean read FIsOpen;
+    property Path : String read FOpenPath;
+    property TabId : Integer read FTabId write SetTabId;
+    property ColCount[ sel : Integer ] : Integer read GetColCount;
+    property ColName[ sel, idx : Integer ] : String read GetColName;
+    property Cell[ aCol, aRow : Integer ] : String read GetCell;
+    property RowCount : Integer read FRows;
+    property Offset : Integer read FOffset write SetOffset;
+    property ColVisibleS[ aName : String ] : boolean read GetColVisibleS write SetColVisibleS;
+    property ColVisibleI[ idx : Integer ] : boolean read GetColVisibleI write SetColVisibleI;
+    property NonStaticColumns : String read FNonStatic;
+  end;
+
+
+implementation
+
+{ TProxy }
+
+constructor TProxy.Create;
+begin
+  FOnCellValid := NIL;
+  FOnOpened := NIL;
+  FOnTableSwitched := NIL;
+  FOnClosed := NIL;
+  FOnLED := NIL;
+  FOnSearchDone := NIL;
+
+  FOffset := 0;
+  FRows   := 0;
+  FCols   := 1;
+  FVisCols:= 1;
+  FTabId  := 0;
+  FTableRows := 0;
+  FOpenPath  := '';
+  FAccession := '';
+  FNonStatic := '';
+  FSearchChunk := 1000;
+  AdjustCacheRows( 10 );
+
+  FTableNames  := TStringList.Create;
+  FAllColumnNames := TStringList.Create;
+
+  SetLength( FVisIdx2AllIdx, 1 );
+  FVisIdx2AllIdx[ 0 ] := 0;
+  SetLength( FAllIdx2VisIdx, 1 );
+  FAllIdx2VisIdx[ 0 ] := 0;
+
+  FJobStock    := TJobQ.Create;
+  FBackground  := TBackground.Create( @OnJobDone );
+end;
+
+destructor TProxy.Destroy;
+begin
+  FBackground.Terminate;
+  FJobStock.Free;
+  FTableNames.Free;
+  FAllColumnNames.Free;
+  SetLength( FVisIdx2AllIdx, 0 );
+  SetLength( FAllIdx2VisIdx, 0 );
+  inherited Destroy;
+end;
+
+procedure TProxy.AdjustCacheRows( const n : Integer );
+var i : Integer;
+begin
+  if ( n < FRows )
+     then for i := n to FRows-1
+       do SetLength( rows[ i ].cells, 0 );
+  SetLength( rows, n );
+  if ( n > FRows )
+     then for i := FRows to n-1
+       do SetLength( rows[ i ].cells, FCols );
+  FRows := n;
+end;
+
+procedure TProxy.AdjustCacheColumnCount( const n : Integer );
+var i : Integer;
+begin
+  for i := 0 to FRows - 1
+    do SetLength( rows[i].cells, n );
+  SetLength( FVisIdx2AllIdx, n );
+  SetLength( FAllIdx2VisIdx, n );
+  for i := 0 to n - 1
+    do begin
+    FVisIdx2AllIdx[ i ] := i;
+    FAllIdx2VisIdx[ i ] := i;
+    end;
+  FCols := n;
+  FVisCols := n;
+end;
+
+procedure TProxy.Invalidate( const firstrow, lastrow : Integer );
+var i, j : Integer;
+begin
+  for i := firstrow to lastrow
+    do begin
+    for j:= 0 to FCols - 1
+      do begin
+      rows[ i ].cells[ j ].value := '';
+      rows[ i ].cells[ j ].valid := false;
+      end;
+    end;
+end;
+
+procedure TProxy.SetColVisibleI( idx : Integer ; const AValue: boolean );
+var i, j : Integer;
+begin
+  if ( idx >= 0 )and( idx < FCols )
+    then begin
+    if ( AValue )
+      then FAllIdx2VisIdx[ idx ] := idx
+      else FAllIdx2VisIdx[ idx ] := -1;
+    j := 0;
+    for i := 0 to FCols - 1
+      do begin
+      if ( FAllIdx2VisIdx[ i ] >= 0 )
+        then begin
+        FAllIdx2VisIdx[ i ] := j;
+        FVisIdx2AllIdx[ j ] := i;
+        inc( j );
+        end;
+      end;
+    FVisCols := j;
+    end;
+end;
+
+procedure TProxy.SetColVisibleS( aName : String ; const AValue : boolean );
+begin
+  SetColVisibleI( FAllColumnNames.IndexOf( aName ), AValue );
+end;
+
+procedure TProxy.CopyRow( const dst, src : Integer );
+var i : Integer;
+begin
+  for i := 0 to ( FCols - 1 )
+    do rows[ dst ].cells[ i ] := rows[ src ].cells[ i ];
+end;
+
+function TProxy.GetCell( aCol, aRow : Integer ): String;
+var eRow, absCol : Integer;
+begin
+  Result := '';
+  if ( aCol >= 0 )and( aCol < FCols )
+    then begin
+    eRow := aRow - FOffset;
+    absCol := FVisIdx2AllIdx[ aCol ];
+    if ( absCol >= 0 )and( absCol < Length( rows[0].cells ) )and
+       ( eRow >= 0 )and( eRow < Length( rows ) )
+      then if ( rows[ eRow ].cells[ absCol ].valid )
+             then Result := rows[ eRow ].cells[ absCol ].value
+             else QueryCell( ALL_COLUMNS, absCol, aRow );
+    end;
+end;
+
+function TProxy.GetColCount( sel : Integer ) : Integer;
+begin
+  Result := 0;
+  case sel of
+    ALL_COLUMNS : Result := FCols;
+    VISIBLE_COLUMNS : Result := FVisCols;
+  end;
+end;
+
+function TProxy.GetColName( sel, idx : Integer ) : String;
+begin
+  Result := '';
+  if ( idx >= 0 )and ( idx < FCols )
+    then begin
+    if ( sel = VISIBLE_COLUMNS )
+      then idx := FVisIdx2AllIdx[ idx ];
+    if ( idx >= 0 )and( idx < FAllColumnNames.Count )
+      then Result := FAllColumnNames[ idx ];
+    end;
+end;
+
+function TProxy.GetColVisibleI( idx : Integer ): boolean;
+begin
+  if ( idx >= 0 ) and ( idx < FCols )
+    then Result := ( FAllIdx2VisIdx[ idx ] >= 0 )
+    else Result := false;
+end;
+
+function TProxy.GetColVisibleS( aName : String ) : boolean;
+begin
+  Result := GetColVisibleI( FAllColumnNames.IndexOf( aName ) );
+end;
+
+function TProxy.GetTableName( idx : Integer ) : String;
+begin
+  if ( idx >= 0 )and( idx < FTableNames.Count )
+     then Result := FTableNames[ idx ]
+     else Result := '?';
+end;
+
+procedure TProxy.ShiftRows( const by : Integer );
+var i : Integer;
+begin
+  if ( by > 0 )
+    then for i := 0 to ( ( FRows - 1 ) - by )
+           do CopyRow( i, i + by )
+    else for i := FRows - 1 downto ( - by )
+           do CopyRow( i, i + by )
+end;
+
+procedure TProxy.SetOffset( const n : Integer );
+var diff : Integer;
+begin
+  diff := ( n - FOffset );
+  if ( diff <> 0 )
+    then begin
+    FOffset := n;
+    if ( abs( diff ) >= FRows )
+      then begin
+      FBackground.FlushJobs( FJobStock );
+      Invalidate( 0, FRows - 1 ); { invalidate all }
+      end
+      else begin
+      ShiftRows( diff );
+      if ( diff > 0 )
+        then Invalidate( FRows - diff, FRows - 1 )
+        else Invalidate( 0, ( -diff ) - 1 );
+      end;
+    end;
+end;
+
+procedure TProxy.SendJob( cmd : TCmdType;
+                          i1, i2, i3, i4, i5, i6 : Integer;
+                          s1, s2 : String );
+var job : PJob;
+begin
+  job := FJobStock.GetOrMake;
+  if Assigned( job )
+    then begin
+    job^.cmd := cmd;
+    job^.I1  := i1;
+    job^.I2  := i2;
+    job^.I3  := i3;
+    job^.I4  := i4;
+    job^.I5  := i5;
+    job^.I6  := i6;
+    job^.S1  := s1;
+    job^.S2  := s2;
+    if FBackground.PutJob( job )
+      then if Assigned( FOnLED )
+             then FOnLED( true );
+    end;
+end;
+
+procedure TProxy.Open( path, acc : String );
+begin SendJob( CMD_OPEN, 0, 0, 0, 0, 0, 0, acc, path ); end;
+
+procedure TProxy.AjustVisibleColumns( checked : String );
+var i, l : Integer;
+    vis  : boolean;
+begin
+  l := Min( Length( checked ), FCols );
+  for i := 0 to l - 1
+    do begin
+    vis := ( checked[ i + 1 ] = 'X' );
+    if ( vis <> ColVisibleI[ i ] )
+      then ColVisibleI[ i ] := vis;
+    end;
+end;
+
+procedure TProxy.Search( fwd : boolean;
+                         colidx, startrow : Integer;
+                         pattern: String );
+var i_fwd, absCol : Integer;
+begin
+  if fwd then i_fwd := 1 else i_fwd := 0;
+  if ( colidx >= 0 )and( colidx < FCols )
+    then begin
+    absCol := FVisIdx2AllIdx[ colidx ];
+    if ( absCol >= 0 )
+      then begin
+      SendJob( CMD_SEARCH,
+               FTabId, absCol, startrow, i_fwd, FSearchChunk, 0,
+               pattern, '' );
+      FSearchCancel := false;
+      end;
+    end;
+end;
+
+procedure TProxy.CancelSearch;
+begin
+  FSearchCancel := true;
+end;
+
+procedure TProxy.QueryTablename( idx : Integer );
+begin SendJob( CMD_TABLENAME, idx, 0, 0, 0, 0, 0, '', '' ); end;
+
+procedure TProxy.QueryColCount( sel : Integer );
+begin SendJob( CMD_COLCOUNT, FTabId, sel, 0, 0, 0, 0, '', '' ); end;
+
+procedure TProxy.QueryColsDone( sel : Integer );
+begin SendJob( CMD_COLSDONE, sel, 0, 0, 0, 0, 0, '', '' ); end;
+
+procedure TProxy.QueryCell( sel, aCol, aRow : Integer );
+begin SendJob( CMD_CELL, FTabId, sel, aCol, aRow, 0, 0, '', '' ); end;
+
+procedure TProxy.QueryOpenTab;
+begin SendJob( CMD_OPENTAB, FTabId, 0, 0, 0, 0, 0, '', '' ); end;
+
+procedure TProxy.QueryOpened;
+begin SendJob( CMD_OPENED, 0, 0, 0, 0, 0, 0, '', '' ); end;
+
+procedure TProxy.QueryColName( sel, idx : Integer );
+begin SendJob( CMD_COLNAME, FTabId, sel, idx, 0, 0, 0, '', '' ); end;
+
+
+{ **************************************************
+  S1...acc, S2...path,
+  I1...open( 0=no, 1=yes )
+  I2...isDb( 0=no, 1=yes )
+  I3...number of tables
+  ************************************************** }
+procedure TProxy.OnOpenJobDone( job : PJob );
+var i : Integer;
+begin
+  FTableNames.Clear;
+  if ( job^.I1 > 0 )
+    then begin
+      FAccession := job^.S1;
+      FOpenPath  := job^.S2;
+      FIsOpen    := true;
+      FIsDb      := ( job^.I2 > 0 );
+      FTables    := job^.I3;
+      for i := 0 to FTables-1
+        do QueryTablename( i );
+      QueryOpened;
+    end
+    else begin
+      FAccession := '';
+      FOpenPath  := '';
+      FIsOpen    := false;
+      FIsDb      := false;
+      FTables    := 0;
+      if Assigned( FOnOpened )
+        then FOnOpened( job^.S2, false );
+    end;
+end;
+
+procedure TProxy.OnCloseJobDone;
+begin
+  if Assigned( FOnClosed )
+    then FOnClosed;
+end;
+
+procedure TProxy.OnTableName( job : PJob );
+begin
+  FTableNames.Add( job^.S1 );
+end;
+
+procedure TProxy.OnOpenedReceived;
+begin
+  if Assigned( FOnOpened )
+    then FOnOpened( FOpenPath, true );
+end;
+
+procedure TProxy.OnColCountReceived( job : PJob );
+var i : Integer;
+begin
+  for i:=0 to job^.I3 - 1
+    do QueryColName( job^.I2, i );
+  QueryColsDone( job^.I2 );
+end;
+
+procedure TProxy.OnColNameReceived( job : PJob );
+begin
+  case job^.I2 of
+    ALL_COLUMNS : FAllColumnNames.Add( job^.S1 );
+  end;
+end;
+
+procedure TProxy.OnColsDoneReceived( job : PJob );
+begin
+  case job^.I1 of
+    ALL_COLUMNS : QueryOpenTab;
+  end;
+end;
+
+procedure TProxy.OnOpenTabReceived( job : PJob );
+begin
+  AdjustCacheColumnCount( FAllColumnNames.Count );
+  FTableRows := job^.I3;
+  FNonStatic := job^.S1;
+  if Assigned( FOnTableSwitched )
+    then FOnTableSwitched;
+end;
+
+procedure TProxy.OnCellReceived( job : PJob );
+var aRow, aCol, visCol : Integer;
+begin
+  aCol := job^.I3; { is in all-columns-index }
+  aRow := job^.I4 - FOffset;
+  if ( aRow >= 0 )and( aRow < FRows )and( aCol >= 0 )and( aCol < FCols )
+    then begin
+    rows[ aRow ].cells[ aCol ].value := job^.S1;
+    rows[ aRow ].cells[ aCol ].valid := true;
+    visCol := FAllIdx2VisIdx[ aCol ];
+    if Assigned( FOnCellValid ) and ( visCol >= 0 )
+      then FOnCellValid( visCol, aRow );
+    end;
+end;
+
+procedure TProxy.OnSearchReceived( job : PJob );
+var aCol, visCol, aRow : Integer;
+    fwd, call_handler : boolean;
+begin
+  if ( not FSearchCancel )
+    then begin
+    visCol := 0;
+    aRow   := -1;
+    call_handler := true;
+    aCol := job^.I2; { is in all-columns-index }
+    if ( aCol >= 0 )and( aCol < FCols )
+      then begin
+      visCol := FAllIdx2VisIdx[ aCol ];
+      if ( visCol >= 0 )
+        then aRow := job^.I6;
+      if ( aRow = -2 )
+        then begin
+        { search of next chunk if not found... }
+        fwd := ( job^.I4 = 1 );
+        if ( fwd )
+          then aRow := job^.I3 + FSearchChunk
+          else aRow := job^.I3 - FSearchChunk;
+        if ( aRow >= 0 )and( aRow < FTableRows )
+          then begin
+          Search( fwd, visCol, aRow, job^.S1 );
+          call_handler := false;
+          end
+          else begin
+          aRow := -1; { not found... }
+          end;
+        end;
+      end;
+    if Assigned( FOnSearchDone ) and ( call_handler )
+      then FOnSearchDone( visCol, aRow, job^.S1 );
+    end;
+end;
+
+procedure TProxy.SetTabId( const AValue : Integer );
+begin
+  FTabId := AValue;
+  FAllColumnNames.Clear;
+  Invalidate( 0, FRows - 1 ); { InvalidateAll }
+  QueryColCount( ALL_COLUMNS );
+end;
+
+procedure TProxy.OnJobDone( job : PJob );
+begin
+  if Assigned( job )
+    then begin
+    case job^.cmd of
+      CMD_OPEN : OnOpenJobDone( job );
+      CMD_CLOSE : OnCloseJobDone;
+      CMD_TABLENAME : OnTableName( job );
+      CMD_OPENED : OnOpenedReceived;
+      CMD_COLCOUNT : OnColCountReceived( job );
+      CMD_COLNAME : OnColNameReceived( job );
+      CMD_COLSDONE : OnColsDoneReceived( job );
+      CMD_OPENTAB : OnOpenTabReceived( job );
+      CMD_CELL : OnCellReceived( job );
+      CMD_SEARCH : OnSearchReceived( job );
+    end;
+    FJobStock.Put( job );
+    end
+    else begin
+    if Assigned( FOnLED )
+      then FOnLED( false );
+    end;
+end;
+
+end.
+
diff --git a/tools/vdbview/gotoform.lfm b/tools/vdbview/gotoform.lfm
new file mode 100644
index 0000000..b1460a4
--- /dev/null
+++ b/tools/vdbview/gotoform.lfm
@@ -0,0 +1,56 @@
+object GotoForm: TGotoForm
+  Left = 416
+  Height = 101
+  Top = 502
+  Width = 186
+  ActiveControl = ERow
+  Caption = 'Goto Row...'
+  ClientHeight = 101
+  ClientWidth = 186
+  LCLVersion = '0.9.30'
+  object Panel1: TPanel
+    Left = 0
+    Height = 50
+    Top = 51
+    Width = 186
+    Align = alBottom
+    ClientHeight = 50
+    ClientWidth = 186
+    TabOrder = 0
+    object BOK: TBitBtn
+      Left = 8
+      Height = 30
+      Top = 9
+      Width = 83
+      Caption = '&OK'
+      Default = True
+      Kind = bkOK
+      ModalResult = 1
+      TabOrder = 0
+    end
+    object BCancel: TBitBtn
+      Left = 96
+      Height = 30
+      Top = 9
+      Width = 83
+      Cancel = True
+      Caption = 'Cancel'
+      Kind = bkCancel
+      ModalResult = 2
+      TabOrder = 1
+    end
+  end
+  object ERow: TMaskEdit
+    Left = 8
+    Height = 21
+    Top = 16
+    Width = 168
+    AutoSelect = False
+    AutoSize = False
+    CharCase = ecNormal
+    MaxLength = 10
+    TabOrder = 1
+    EditMask = '##########;0;_'
+    SpaceChar = '_'
+  end
+end
diff --git a/tools/vdbview/gotoform.pas b/tools/vdbview/gotoform.pas
new file mode 100644
index 0000000..2ce7341
--- /dev/null
+++ b/tools/vdbview/gotoform.pas
@@ -0,0 +1,47 @@
+unit gotoform;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
+  Buttons, MaskEdit;
+
+type
+
+  { TGotoForm }
+
+  TGotoForm = class(TForm)
+    BOK: TBitBtn;
+    BCancel: TBitBtn;
+    ERow: TMaskEdit;
+    Panel1: TPanel;
+  private
+    { private declarations }
+  public
+    { public declarations }
+    function present( const p : TPoint; var row_nr : Integer ) : boolean;
+  end; 
+
+var
+  MyGotoForm : TGotoForm;
+
+implementation
+
+{$R *.lfm}
+
+{ TGotoForm }
+
+function TGotoForm.present( const p : TPoint; var row_nr : Integer ) : boolean;
+begin
+  Left := p.x;
+  Top  := p.y;
+  ERow.Text := IntToStr( row_nr );
+  Result := ( ShowModal = mrOK );
+  if ( Result )
+    then row_nr := StrToIntDef( ERow.Text, row_nr );
+end;
+
+end.
+
diff --git a/tools/vdbview/jobdef.pas b/tools/vdbview/jobdef.pas
new file mode 100644
index 0000000..2b18b71
--- /dev/null
+++ b/tools/vdbview/jobdef.pas
@@ -0,0 +1,27 @@
+unit jobdef;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  Classes, SysUtils; 
+
+type
+  TCmdType = ( CMD_OPEN, CMD_CLOSE, CMD_TABLENAME,
+               CMD_OPENED, CMD_COLCOUNT, CMD_COLNAME, CMD_COLSDONE,
+               CMD_OPENTAB, CMD_CELL, CMD_SEARCH );
+
+  { TJob }
+  PJob = ^TJob;
+  TJob = record
+      cmd : TCmdType;
+      I1, I2, I3, I4, I5, I6 : Integer;
+      S1, S2 : String;
+      next : PJob;
+   end;
+
+implementation
+
+end.
+
diff --git a/tools/vdbview/linkedlist.pas b/tools/vdbview/linkedlist.pas
new file mode 100644
index 0000000..59dc086
--- /dev/null
+++ b/tools/vdbview/linkedlist.pas
@@ -0,0 +1,186 @@
+unit linkedlist;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  Classes, SysUtils, jobdef;
+
+type
+
+  { TJobQ }
+  TJobQ = class
+  private
+    FHead, FTail : PJob;
+  public
+    constructor Create;
+    destructor Destroy; override;
+    function Empty : Boolean; virtual;
+    procedure Put( job : PJob ); virtual;
+    function Get : PJob; virtual;
+    function GetOrMake : PJob; virtual;
+    procedure Flush( dst : TJobQ ); virtual;
+    procedure Clear;
+  end;
+
+  { TMutexJobQ }
+
+  TMutexJobQ = class( TJobQ )
+  private
+    cs : TRTLCriticalSection;
+  public
+    constructor Create;
+    destructor Destroy; override;
+    function Empty : Boolean; override;
+    procedure Put( job : PJob ); override;
+    function Get : PJob; override;
+    function GetOrMake : PJob; override;
+    procedure Flush( dst : TJobQ ); override;
+  end;
+
+implementation
+
+{ TJobQ }
+
+constructor TJobQ.Create;
+begin
+  inherited Create;
+  FHead := Nil;
+  FTail := Nil;
+end;
+
+destructor TJobQ.Destroy;
+begin
+  Clear;
+  inherited Destroy;
+end;
+
+function TJobQ.Empty : Boolean;
+begin
+  Result := ( FHead = Nil );
+end;
+
+procedure TJobQ.Put( job : PJob );
+begin
+  job^.next := Nil;
+  if ( FHead = Nil )
+    then FHead := job
+    else FTail^.next := job;
+  FTail := job;
+end;
+
+function TJobQ.Get : PJob;
+begin
+  if ( FHead <> Nil )
+    then begin
+    Result := FHead;
+    FHead := Result^.next;
+    end
+    else begin
+    Result := Nil;
+    end;
+end;
+
+function TJobQ.GetOrMake : PJob;
+begin
+  if ( FHead <> Nil )
+    then begin
+    Result := FHead;
+    FHead := Result^.next;
+    end
+    else begin
+    new ( Result );
+    end;
+end;
+
+procedure TJobQ.Flush( dst : TJobQ );
+var job : PJob;
+begin
+  while ( not Empty )
+    do begin
+    job := Get;
+    if Assigned( dst )
+      then dst.Put( job )
+      else Dispose( job );
+    end;
+end;
+
+procedure TJobQ.Clear;
+var job : PJob;
+begin
+  while ( not Empty )
+    do begin
+    job := Get;
+    Dispose( job );
+    end;
+end;
+
+{ TMutexJobQ }
+
+constructor TMutexJobQ.Create;
+begin
+  inherited Create;
+  InitCriticalSection( cs );
+end;
+
+destructor TMutexJobQ.Destroy;
+begin
+  inherited Destroy;
+  DoneCriticalsection( cs );
+end;
+
+function TMutexJobQ.Empty : Boolean;
+begin
+  EnterCriticalSection( cs );
+  try
+    Result := inherited Empty;
+  finally
+    LeaveCriticalSection( cs );
+  end;
+end;
+
+procedure TMutexJobQ.Put( job : PJob );
+begin
+  EnterCriticalSection( cs );
+  try
+    inherited Put( job );
+  finally
+    LeaveCriticalSection( cs );
+  end;
+end;
+
+function TMutexJobQ.Get : PJob;
+begin
+  Result := Nil;
+  EnterCriticalSection( cs );
+  try
+    Result := inherited Get;
+  finally
+    LeaveCriticalSection( cs );
+  end
+end;
+
+function TMutexJobQ.GetOrMake: PJob;
+begin
+  Result := Nil;
+  EnterCriticalSection( cs );
+  try
+    Result := inherited GetOrMake;
+  finally
+    LeaveCriticalSection( cs );
+  end
+end;
+
+procedure TMutexJobQ.Flush( dst : TJobQ );
+begin
+  EnterCriticalSection( cs );
+  try
+    inherited Flush( dst );
+  finally
+    LeaveCriticalSection( cs );
+  end
+end;
+
+end.
+
diff --git a/tools/vdbview/logo_128.png b/tools/vdbview/logo_128.png
new file mode 100644
index 0000000..69c0aa6
Binary files /dev/null and b/tools/vdbview/logo_128.png differ
diff --git a/tools/vdbview/logo_16.png b/tools/vdbview/logo_16.png
new file mode 100644
index 0000000..1989f95
Binary files /dev/null and b/tools/vdbview/logo_16.png differ
diff --git a/tools/vdbview/logo_256.png b/tools/vdbview/logo_256.png
new file mode 100644
index 0000000..1db3949
Binary files /dev/null and b/tools/vdbview/logo_256.png differ
diff --git a/tools/vdbview/logo_32.png b/tools/vdbview/logo_32.png
new file mode 100644
index 0000000..4d74dab
Binary files /dev/null and b/tools/vdbview/logo_32.png differ
diff --git a/tools/vdbview/logo_64.png b/tools/vdbview/logo_64.png
new file mode 100644
index 0000000..762d22d
Binary files /dev/null and b/tools/vdbview/logo_64.png differ
diff --git a/tools/vdbview/mainwindow.lfm b/tools/vdbview/mainwindow.lfm
new file mode 100644
index 0000000..8b2135e
--- /dev/null
+++ b/tools/vdbview/mainwindow.lfm
@@ -0,0 +1,973 @@
+object Mainform: TMainform
+  Left = 367
+  Height = 665
+  Top = 131
+  Width = 641
+  ActiveControl = Grid
+  Caption = 'vdbview'
+  ClientHeight = 646
+  ClientWidth = 641
+  DragMode = dmAutomatic
+  Menu = MainMenu
+  OnActivate = FormActivate
+  OnClose = FormClose
+  OnCreate = FormCreate
+  OnDestroy = FormDestroy
+  OnResize = FormResize
+  LCLVersion = '0.9.30'
+  object Grid: TDrawGrid
+    Left = 0
+    Height = 603
+    Top = 23
+    Width = 625
+    Align = alClient
+    AutoEdit = False
+    BorderStyle = bsNone
+    ExtendedSelect = False
+    Flat = True
+    Font.CharSet = ANSI_CHARSET
+    Font.Height = -13
+    Font.Name = 'Consolas'
+    Font.Pitch = fpFixed
+    Font.Quality = fqDraft
+    Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goDrawFocusSelected, goRowSizing, goColSizing, goSmoothScroll]
+    ParentFont = False
+    PopupMenu = PopupMenu1
+    ScrollBars = ssHorizontal
+    TabOrder = 0
+    TitleFont.CharSet = ANSI_CHARSET
+    TitleFont.Height = -13
+    TitleFont.Name = 'Consolas'
+    TitleFont.Pitch = fpFixed
+    TitleFont.Quality = fqDraft
+    UseXORFeatures = True
+    OnDrawCell = GridDrawCell
+    OnHeaderSized = GridHeaderSized
+    OnKeyDown = GridKeyDown
+    OnMouseDown = GridMouseDown
+    OnMouseWheelDown = GridMouseWheelDown
+    OnMouseWheelUp = GridMouseWheelUp
+    OnSelectCell = GridSelectCell
+  end
+  object Panel1: TPanel
+    Left = 0
+    Height = 23
+    Top = 0
+    Width = 641
+    Align = alTop
+    ClientHeight = 23
+    ClientWidth = 641
+    TabOrder = 1
+    object ActivateRecord: TSpeedButton
+      Left = 594
+      Height = 22
+      Top = 0
+      Width = 47
+      Action = A_ActivateRecord
+      Anchors = [akTop, akRight]
+      GroupIndex = 1
+      NumGlyphs = 0
+      ShowHint = True
+      ParentShowHint = False
+    end
+    object ActivateGrid: TSpeedButton
+      Left = 546
+      Height = 22
+      Top = 0
+      Width = 48
+      Action = A_ActivateGrid
+      Anchors = [akTop, akRight]
+      Down = True
+      GroupIndex = 1
+      NumGlyphs = 0
+      ShowHint = True
+      ParentShowHint = False
+    end
+    object Tables: TComboBox
+      Left = 0
+      Height = 21
+      Hint = 'select table'
+      Top = 1
+      Width = 144
+      Color = 33023
+      ItemHeight = 13
+      OnSelect = TablesSelect
+      ParentShowHint = False
+      ShowHint = True
+      Style = csDropDownList
+      TabOrder = 0
+    end
+    object LED: TShape
+      Left = 152
+      Height = 13
+      Top = 5
+      Width = 23
+      Brush.Color = clDefault
+      Pen.Style = psClear
+    end
+    object B_First: TSpeedButton
+      Left = 180
+      Height = 22
+      Top = 0
+      Width = 23
+      Action = A_First
+      Glyph.Data = {
+        C6070000424DC607000000000000360000002800000016000000160000000100
+        20000000000090070000640000006400000000000000000000000066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0061F2FF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FEFF0062F4FF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF005EECFF000308FF003E9CFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0057D9FF00173AFF00040BFF0062F4FF0066FFFF0066FFFF0066FFFF0066
+        FFFF0056D7FF000000FF00337FFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0065FDFF00388DFF000409FF0001
+        03FF003079FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0056D7FF0000
+        00FF00337FFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0057DAFF00183BFF000000FF001029FF0050C9FF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0056D7FF000000FF00337FFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0065FDFF00398EFF0004
+        09FF000103FF003077FF0063F8FF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0056D7FF000000FF00337FFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0057DAFF00183BFF000000FF001029FF0050C8FF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0056D7FF000000FF00337FFF0066FFFF0066FFFF0066FFFF0065FDFF0039
+        8FFF000409FF000103FF002F76FF0063F8FF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0056D7FF0000
+        00FF00337FFF0066FFFF0066FFFF0058DBFF00183CFF000000FF001028FF0050
+        C8FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0056D7FF000000FF00337FFF0066
+        FFFF004EC4FF00040AFF000103FF002F75FF0063F7FF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0056D7FF000000FF00337FFF0066FFFF004FC6FF0004
+        0AFF000103FF002F75FF0063F7FF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0056D7FF000000FF00337FFF0066FFFF0066FFFF0058DBFF00183CFF0000
+        00FF001028FF0050C8FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0056D7FF0000
+        00FF00337FFF0066FFFF0066FFFF0066FFFF0065FDFF00398FFF000409FF0001
+        03FF002F76FF0063F8FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0056D7FF000000FF00337FFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0057DAFF00183BFF000000FF0010
+        29FF0050C8FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0056D7FF000000FF00337FFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0065FDFF00398EFF000409FF000103FF0030
+        77FF0063F8FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0056D7FF000000FF00337FFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0057DAFF00183BFF000000FF001029FF0050
+        C9FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0056D7FF0000
+        00FF00337FFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0065FDFF00388DFF000409FF000103FF00327EFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF005CE7FF00040AFF003E9CFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0057D9FF00173AFF000308FF0061F3FF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0061F2FF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0065FDFF0061F3FF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF
+      }
+      NumGlyphs = 0
+      Transparent = False
+      ShowCaption = False
+      ShowHint = True
+      ParentShowHint = False
+    end
+    object B_Prev: TSpeedButton
+      Left = 203
+      Height = 22
+      Top = 0
+      Width = 23
+      Action = A_PageUp
+      Caption = '<<'
+      Glyph.Data = {
+        C6070000424DC607000000000000360000002800000016000000160000000100
+        20000000000090070000640000006400000000000000000000000066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0061F3FF0066FFFF0066FFFF0066FEFF0062F4FF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0062F6FF002E72FF000102FF0043
+        A7FF0057D9FF00173AFF00040BFF0062F4FF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF004FC6FF000F26FF000000FF00193EFF00327FFF000409FF0001
+        03FF003079FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0063F7FF002E73FF0001
+        02FF00040AFF00327DFF00183BFF000000FF001029FF0050C9FF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF004FC6FF001027FF000000FF00193EFF00317BFF0004
+        09FF000103FF003077FF0063F8FF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0063F7FF002E
+        74FF000102FF00040AFF00317CFF00183BFF000000FF001029FF0050C8FF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0050C7FF001027FF000000FF00183DFF0031
+        7BFF000409FF000103FF002F76FF0063F8FF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0063
+        F7FF002F75FF000102FF00040AFF00327CFF00183CFF000000FF001028FF0050
+        C8FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0064FAFF00122CFF000000FF0018
+        3CFF0043A8FF00040AFF000103FF002F75FF0063F7FF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0064F9FF00122EFF000000FF00183CFF0044AAFF0004
+        0AFF000103FF002F75FF0063F7FF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0063F7FF002F75FF000102FF00040AFF00327CFF00183CFF0000
+        00FF001028FF0050C8FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0050C7FF001027FF000000FF00183DFF00317BFF000409FF0001
+        03FF002F76FF0063F8FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0063F7FF002E74FF000102FF00040AFF00317CFF00183BFF000000FF0010
+        29FF0050C8FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF004FC6FF001027FF000000FF00193EFF00317BFF000409FF000103FF0030
+        77FF0063F8FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0063
+        F7FF002E73FF000102FF00040AFF00327DFF00183BFF000000FF001029FF0050
+        C9FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF004F
+        C6FF000F26FF000000FF00193EFF003482FF000409FF000103FF00327EFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0062F6FF002E
+        72FF000102FF0042A4FF0057D9FF00173AFF000308FF0061F3FF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0060F1FF0066
+        FFFF0066FFFF0065FDFF0061F3FF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF
+      }
+      NumGlyphs = 0
+      Transparent = False
+      ShowCaption = False
+      ShowHint = True
+      ParentShowHint = False
+    end
+    object B_Up: TSpeedButton
+      Left = 226
+      Height = 22
+      Top = 0
+      Width = 23
+      Action = A_Up
+      Glyph.Data = {
+        C6070000424DC607000000000000360000002800000016000000160000000100
+        20000000000090070000640000006400000000000000000000000066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FEFF0062F4FF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FEFF0044ABFF00122DFF000409FF0061F2FF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FEFF0044ABFF00122CFF000000FF0006
+        0FFF003585FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FEFF0044AAFF00122CFF000000FF00060FFF00337FFF0060EFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FEFF0044A9FF00122CFF000000FF0006
+        0FFF00327EFF0060EFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0065
+        FDFF0044A9FF00112BFF000000FF00060EFF00327EFF0060EFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0065FDFF0043A8FF00112BFF000000FF0006
+        0EFF00327DFF005FEEFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0065
+        FDFF0043A8FF00112AFF000000FF00060EFF00327CFF005FEEFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0064FBFF00132FFF000000FF0006
+        0EFF00327CFF005FEEFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0063F7FF001534FF000000FF00060EFF00327CFF005F
+        EEFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0065FDFF0043A8FF00112AFF000000FF00060EFF00327CFF005F
+        EEFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0065FDFF0043A8FF00112BFF000000FF00060EFF00327DFF005F
+        EEFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0065FDFF0044A9FF00112BFF000000FF00060EFF00327EFF0060
+        EFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FEFF0044A9FF00122CFF000000FF00060FFF00327EFF0060
+        EFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FEFF0044AAFF00122CFF000000FF00060FFF00337FFF0060
+        EFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FEFF0044ABFF00122CFF000000FF00060FFF003789FF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FEFF0044ABFF00122DFF000308FF0061F3FF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FEFF0060F0FF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF
+      }
+      NumGlyphs = 0
+      Transparent = False
+      ShowCaption = False
+      ShowHint = True
+      ParentShowHint = False
+    end
+    object B_Down: TSpeedButton
+      Left = 249
+      Height = 22
+      Top = 0
+      Width = 23
+      Action = A_Down
+      Caption = '>'
+      Glyph.Data = {
+        C6070000424DC607000000000000360000002800000016000000160000000100
+        20000000000090070000640000006400000000000000000000000066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0060F0FF0066FEFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0061F3FF000308FF00122DFF0044ABFF0066FEFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF003789FF00060FFF000000FF00122CFF0044ABFF0066FEFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0060EFFF00337FFF00060FFF000000FF00122CFF0044AAFF0066FEFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0060EFFF00327EFF00060FFF000000FF00122CFF0044A9FF0066FEFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0060EFFF00327EFF00060EFF000000FF00112BFF0044A9FF0065FDFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF005FEEFF00327DFF00060EFF000000FF00112BFF0043A8FF0065FDFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF005FEEFF00327CFF00060EFF000000FF00112AFF0043A8FF0065FDFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF005FEEFF00327CFF00060EFF000000FF001534FF0063F7FF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF005FEEFF0032
+        7CFF00060EFF000000FF00132FFF0064FBFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF005FEEFF00327CFF00060EFF000000FF00112AFF0043
+        A8FF0065FDFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF005FEEFF0032
+        7DFF00060EFF000000FF00112BFF0043A8FF0065FDFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0060EFFF00327EFF00060EFF000000FF00112BFF0044
+        A9FF0065FDFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0060EFFF0032
+        7EFF00060FFF000000FF00122CFF0044A9FF0066FEFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0060EFFF00337FFF00060FFF000000FF00122CFF0044
+        AAFF0066FEFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0035
+        85FF00060FFF000000FF00122CFF0044ABFF0066FEFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0061F2FF000409FF00122DFF0044
+        ABFF0066FEFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0062F4FF0066FEFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF
+      }
+      NumGlyphs = 0
+      Transparent = False
+      ShowCaption = False
+      ShowHint = True
+      ParentShowHint = False
+    end
+    object B_Next: TSpeedButton
+      Left = 272
+      Height = 22
+      Top = 0
+      Width = 23
+      Action = A_PageDn
+      Caption = '>>'
+      Glyph.Data = {
+        C6070000424DC607000000000000360000002800000016000000160000000100
+        20000000000090070000640000006400000000000000000000000066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0061F3FF0065FDFF0066
+        FFFF0066FFFF0060F1FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0061F3FF000308FF00173AFF0057D9FF0042A4FF0001
+        02FF002E72FF0062F6FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF00327EFF000103FF000409FF003482FF00193EFF000000FF000F
+        26FF004FC6FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0050C9FF001029FF000000FF00183BFF00327DFF00040AFF000102FF002E
+        73FF0063F7FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0063
+        F8FF003077FF000103FF000409FF00317BFF00193EFF000000FF001027FF004F
+        C6FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0050
+        C8FF001029FF000000FF00183BFF00317CFF00040AFF000102FF002E74FF0063
+        F7FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0063F8FF002F
+        76FF000103FF000409FF00317BFF00183DFF000000FF001027FF0050C7FF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0050C8FF0010
+        28FF000000FF00183CFF00327CFF00040AFF000102FF002F75FF0063F7FF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0063F7FF002F75FF0001
+        03FF00040AFF0044AAFF00183CFF000000FF00122EFF0064F9FF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0063F7FF002F75FF000103FF00040AFF0043
+        A8FF00183CFF000000FF00122CFF0064FAFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0050C8FF001028FF000000FF00183CFF00327CFF00040AFF000102FF002F
+        75FF0063F7FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0063F8FF002F76FF000103FF0004
+        09FF00317BFF00183DFF000000FF001027FF0050C7FF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0050C8FF001029FF000000FF00183BFF00317CFF00040AFF0001
+        02FF002E74FF0063F7FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0063F8FF003077FF0001
+        03FF000409FF00317BFF00193EFF000000FF001027FF004FC6FF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0050C9FF001029FF000000FF00183BFF00327DFF0004
+        0AFF000102FF002E73FF0063F7FF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0030
+        79FF000103FF000409FF00327FFF00193EFF000000FF000F26FF004FC6FF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0062F4FF00040BFF00173AFF0057
+        D9FF0043A7FF000102FF002E72FF0062F6FF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0062F4FF0066FEFF0066FFFF0066FFFF0061
+        F3FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF
+      }
+      NumGlyphs = 0
+      Transparent = False
+      ShowCaption = False
+      ShowHint = True
+      ParentShowHint = False
+    end
+    object B_Last: TSpeedButton
+      Left = 295
+      Height = 22
+      Top = 0
+      Width = 23
+      Action = A_Last
+      Glyph.Data = {
+        C6070000424DC607000000000000360000002800000016000000160000000100
+        20000000000090070000640000006400000000000000000000000066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0061F3FF0065FDFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0061F2FF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0061F3FF000308FF00173AFF0057D9FF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF003E9CFF00040AFF005CE7FF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF00327EFF000103FF000409FF00388DFF0065FDFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0033
+        7FFF000000FF0056D7FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0050C9FF001029FF000000FF00183BFF0057DAFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF00337FFF000000FF0056
+        D7FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0063
+        F8FF003077FF000103FF000409FF00398EFF0065FDFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF00337FFF000000FF0056D7FF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0050
+        C8FF001029FF000000FF00183BFF0057DAFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF00337FFF000000FF0056D7FF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0063F8FF002F
+        76FF000103FF000409FF00398FFF0065FDFF0066FFFF0066FFFF0066FFFF0033
+        7FFF000000FF0056D7FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0050C8FF0010
+        28FF000000FF00183CFF0058DBFF0066FFFF0066FFFF00337FFF000000FF0056
+        D7FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0063F7FF002F75FF0001
+        03FF00040AFF004FC6FF0066FFFF00337FFF000000FF0056D7FF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0063F7FF002F75FF000103FF00040AFF004E
+        C4FF0066FFFF00337FFF000000FF0056D7FF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0050C8FF001028FF000000FF00183CFF0058DBFF0066FFFF0066FFFF0033
+        7FFF000000FF0056D7FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0063F8FF002F76FF000103FF0004
+        09FF00398FFF0065FDFF0066FFFF0066FFFF0066FFFF00337FFF000000FF0056
+        D7FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0050C8FF001029FF000000FF00183BFF0057DAFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF00337FFF000000FF0056D7FF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0063F8FF003077FF0001
+        03FF000409FF00398EFF0065FDFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF00337FFF000000FF0056D7FF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0050C9FF001029FF000000FF00183BFF0057DAFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0033
+        7FFF000000FF0056D7FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0030
+        79FF000103FF000409FF00388DFF0065FDFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF00337FFF000000FF0056
+        D7FF0066FFFF0066FFFF0066FFFF0066FFFF0062F4FF00040BFF00173AFF0057
+        D9FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF003E9CFF000308FF005EECFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0062F4FF0066FEFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0061F2FF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF
+      }
+      NumGlyphs = 0
+      Transparent = False
+      ShowCaption = False
+      ShowHint = True
+      ParentShowHint = False
+    end
+    object B_Search: TSpeedButton
+      Left = 336
+      Height = 22
+      Top = 0
+      Width = 23
+      Action = A_Search
+      Glyph.Data = {
+        C6070000424DC607000000000000360000002800000016000000160000000100
+        20000000000090070000640000006400000000000000000000000066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0060F1FF0065FDFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0061F2FF00040AFF002255FF0064F9FF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF00245BFF000000FF001C47FF0062F5FF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0065
+        FDFF002A69FF000000FF00173AFF0060EFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0031
+        7AFF000000FF00122EFF005CE7FF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF00388CFF0000
+        00FF000E23FF0059DFFF0066FFFF004EC3FF00388BFF00265FFF00317BFF0046
+        AFFF0062F4FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF003F9DFF000103FF0009
+        17FF00193EFF000000FF000000FF000000FF000000FF000000FF000D20FF004C
+        BFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF003E9BFF000001FF000000FF0029
+        66FF004EC3FF0060F1FF0055D4FF003A90FF00060EFF000001FF0044AAFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF001E4AFF000000FF003C96FF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF005AE1FF000C1EFF000712FF005CE7FF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF004E
+        C3FF000000FF002966FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF004AB8FF000000FF002E73FF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF00388BFF000000FF004E
+        C3FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF000814FF00183BFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF00265FFF000000FF0060F1FF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF001A41FF0006
+        0FFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF00317BFF000000FF0055D4FF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF000E24FF00112BFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0046
+        AFFF000000FF003A90FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF005AE0FF000000FF00265FFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0062F4FF000D20FF0006
+        0EFF005AE1FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF001C
+        47FF000001FF004EC3FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF004CBFFF000001FF000C1EFF004A
+        B8FF0066FFFF0066FFFF0066FFFF005AE0FF001C47FF000000FF002D71FF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0044AAFF000712FF000000FF000814FF001A
+        41FF000E24FF000000FF000001FF002D71FF0064F9FF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF005CE7FF002E73FF00183BFF00060FFF00112BFF0026
+        5FFF004EC3FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF
+      }
+      NumGlyphs = 0
+      Transparent = False
+      ShowCaption = False
+      ShowHint = True
+      ParentShowHint = False
+    end
+    object B_Goto: TSpeedButton
+      Left = 359
+      Height = 22
+      Top = 0
+      Width = 23
+      Action = A_Goto
+      Glyph.Data = {
+        C6070000424DC607000000000000360000002800000016000000160000000100
+        20000000000090070000640000006400000000000000000000000066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0061F2FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0061F2FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF003E9CFF0004
+        0AFF005CE7FF0066FFFF0066FFFF0066FFFF0066FFFF005EECFF000308FF003E
+        9CFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF00337FFF000000FF0056D7FF0066
+        FFFF0066FFFF0066FFFF0066FFFF0056D7FF000000FF00337FFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF00337FFF000000FF0056D7FF0066FFFF0066FFFF0066
+        FFFF0066FFFF0056D7FF000000FF00337FFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF003E9CFF00337FFF0033
+        7FFF00193FFF000000FF002B6BFF00337FFF00337FFF00337FFF00337FFF002B
+        6BFF000000FF00193FFF00337FFF00337FFF003E9CFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0061F2FF000308FF000000FF000000FF000000FF0000
+        00FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000
+        00FF000000FF000000FF00040AFF0061F2FF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF005EECFF0056D7FF0056D7FF002B6BFF000000FF0049B5FF0056
+        D7FF0056D7FF0056D7FF0056D7FF0049B5FF000000FF002B6BFF0056D7FF0056
+        D7FF005CE7FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF00337FFF000000FF0056D7FF0066FFFF0066FFFF0066
+        FFFF0066FFFF0056D7FF000000FF00337FFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF00337FFF000000FF0056D7FF0066FFFF0066FFFF0066FFFF0066FFFF0056
+        D7FF000000FF00337FFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF00337FFF0000
+        00FF0056D7FF0066FFFF0066FFFF0066FFFF0066FFFF0056D7FF000000FF0033
+        7FFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF00337FFF000000FF0056D7FF0066
+        FFFF0066FFFF0066FFFF0066FFFF0056D7FF000000FF00337FFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF005C
+        E7FF0056D7FF0056D7FF002B6BFF000000FF0049B5FF0056D7FF0056D7FF0056
+        D7FF0056D7FF0049B5FF000000FF002B6BFF0056D7FF0056D7FF005EECFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0061F2FF00040AFF000000FF0000
+        00FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000
+        00FF000000FF000000FF000000FF000000FF000308FF0061F2FF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF003E9CFF00337FFF00337FFF00193FFF0000
+        00FF002B6BFF00337FFF00337FFF00337FFF00337FFF002B6BFF000000FF0019
+        3FFF00337FFF00337FFF003E9CFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF00337FFF000000FF0056D7FF0066
+        FFFF0066FFFF0066FFFF0066FFFF0056D7FF000000FF00337FFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF00337FFF000000FF0056D7FF0066FFFF0066FFFF0066
+        FFFF0066FFFF0056D7FF000000FF00337FFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF003E9CFF000308FF005EECFF0066FFFF0066FFFF0066FFFF0066FFFF005C
+        E7FF00040AFF003E9CFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0061
+        F2FF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0061F2FF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066FFFF0066
+        FFFF0066FFFF0066FFFF
+      }
+      NumGlyphs = 0
+      Transparent = False
+      ShowCaption = False
+      ShowHint = True
+      ParentShowHint = False
+    end
+  end
+  object RowScroll: TScrollBar
+    Left = 625
+    Height = 603
+    Top = 23
+    Width = 16
+    Align = alRight
+    Kind = sbVertical
+    Max = 20
+    PageSize = 0
+    TabOrder = 2
+    TabStop = False
+    OnChange = RowScrollChange
+  end
+  object StatusBar: TStatusBar
+    Left = 0
+    Height = 20
+    Top = 626
+    Width = 641
+    Panels = <    
+      item
+        Alignment = taCenter
+        Width = 120
+      end    
+      item
+        Alignment = taCenter
+        Width = 120
+      end    
+      item
+        Width = 50
+      end>
+    SimplePanel = False
+  end
+  object MainMenu: TMainMenu
+    left = 472
+    top = 96
+    object MenueFile: TMenuItem
+      Caption = '&File'
+      object MI_Open_Accession: TMenuItem
+        Action = A_OpenAcc
+      end
+      object MI_Open_Directory: TMenuItem
+        Action = A_OpenDir
+      end
+      object MI_Open_File: TMenuItem
+        Action = A_OpenFile
+      end
+      object MI_Recent: TMenuItem
+        Caption = 'Open Recent'
+      end
+      object MenuItem1: TMenuItem
+        Action = A_ClearHistory
+      end
+      object MI_Exit: TMenuItem
+        Action = A_Exit
+      end
+    end
+    object MenueView: TMenuItem
+      Caption = '&View'
+      object MenuGrid: TMenuItem
+        Action = A_ActivateGrid
+        AutoCheck = True
+      end
+      object MenuRecord: TMenuItem
+        Action = A_ActivateRecord
+        AutoCheck = True
+      end
+      object MenuColumns: TMenuItem
+        Action = A_Columns
+      end
+    end
+    object MenuItem2: TMenuItem
+      Action = A_Version
+    end
+  end
+  object ActionList: TActionList
+    left = 472
+    top = 48
+    object A_ActivateGrid: TAction
+      AutoCheck = True
+      Caption = '&grid'
+      Checked = True
+      GroupIndex = 1
+      Hint = 'grid view'
+      OnExecute = A_ActivateGridExecute
+    end
+    object A_ActivateRecord: TAction
+      AutoCheck = True
+      Caption = '&record'
+      GroupIndex = 1
+      Hint = 'record view'
+      OnExecute = A_ActivateRecordExecute
+    end
+    object A_Exit: TAction
+      Caption = 'E&xit'
+      OnExecute = A_ExitExecute
+      ShortCut = 16472
+    end
+    object A_OpenAcc: TAction
+      Caption = 'Open &Accession'
+      OnExecute = A_OpenAccExecute
+      ShortCut = 16449
+    end
+    object A_OpenFile: TAction
+      Caption = 'Open &File'
+      OnExecute = A_OpenFileExecute
+      ShortCut = 16454
+    end
+    object A_OpenDir: TAction
+      Caption = 'Open &Directory'
+      OnExecute = A_OpenDirExecute
+      ShortCut = 16452
+    end
+    object A_Columns: TAction
+      Caption = '&columns...'
+      OnExecute = A_ColumnsExecute
+      ShortCut = 32835
+    end
+    object A_Up: TAction
+      Caption = 'Up'
+      Hint = 'previous row'
+      OnExecute = A_UpExecute
+    end
+    object A_Down: TAction
+      Caption = 'Down'
+      Hint = 'next row'
+      OnExecute = A_DownExecute
+    end
+    object A_PageUp: TAction
+      Caption = 'Page Up'
+      Hint = 'previous page'
+      OnExecute = A_PageUpExecute
+    end
+    object A_PageDn: TAction
+      Caption = 'Page Down'
+      Hint = 'next page'
+      OnExecute = A_PageDnExecute
+    end
+    object A_First: TAction
+      Caption = 'First'
+      Hint = 'first row'
+      OnExecute = A_FirstExecute
+    end
+    object A_Last: TAction
+      Caption = 'Last'
+      Hint = 'last row'
+      OnExecute = A_LastExecute
+    end
+    object A_Goto: TAction
+      Caption = 'Goto...'
+      Hint = 'goto row'
+      OnExecute = A_GotoExecute
+      ShortCut = 16455
+    end
+    object A_Search: TAction
+      Caption = '&Find'
+      Hint = 'Search'
+      OnExecute = A_SearchExecute
+      ShortCut = 16467
+    end
+    object A_AdjustHeader: TAction
+      Caption = 'Adjust Header'
+      OnExecute = A_AdjustHeaderExecute
+    end
+    object A_Adjust_All_Headers: TAction
+      Caption = 'Adjust All Headers'
+      OnExecute = A_Adjust_All_HeadersExecute
+    end
+    object A_AdjustCellWidth: TAction
+      Caption = 'Adjust CellWidth'
+      OnExecute = A_AdjustCellWidthExecute
+    end
+    object A_Adjust_All_Cellwidths: TAction
+      Caption = 'Adjust All Cellwidths'
+      OnExecute = A_Adjust_All_CellwidthsExecute
+    end
+    object A_Copy: TAction
+      Caption = 'Copy to Clipboard'
+      OnExecute = A_CopyExecute
+      ShortCut = 16451
+    end
+    object A_ClearHistory: TAction
+      Caption = 'Clear History'
+      OnExecute = A_ClearHistoryExecute
+    end
+    object A_Version: TAction
+      Caption = 'About'
+      OnExecute = A_VersionExecute
+    end
+  end
+  object cfg: TXMLConfig
+    Filename = 'vdbview.cfg'
+    StartEmpty = False
+    RootName = 'CONFIG'
+    left = 344
+    top = 48
+  end
+  object SelDirDlg: TSelectDirectoryDialog
+    Options = [ofReadOnly, ofPathMustExist, ofFileMustExist, ofCreatePrompt, ofNoTestFileCreate, ofEnableSizing, ofViewDetail]
+    left = 408
+    top = 49
+  end
+  object SelFileDlg: TOpenDialog
+    Options = [ofReadOnly, ofNoValidate, ofEnableSizing, ofViewDetail]
+    left = 408
+    top = 96
+  end
+  object LEDTimer: TTimer
+    Enabled = False
+    Interval = 300
+    OnTimer = LEDTimerTimer
+    left = 344
+    top = 96
+  end
+  object PopupMenu1: TPopupMenu
+    left = 536
+    top = 96
+    object MenuItem4: TMenuItem
+      Action = A_Goto
+    end
+    object MenuItem5: TMenuItem
+      Action = A_Columns
+    end
+    object MenuItem6: TMenuItem
+      Action = A_Search
+    end
+    object MenuItem7: TMenuItem
+      Action = A_AdjustHeader
+    end
+    object MenuItem8: TMenuItem
+      Action = A_Adjust_All_Headers
+    end
+    object MenuItem9: TMenuItem
+      Action = A_AdjustCellWidth
+    end
+    object MenuItem10: TMenuItem
+      Action = A_Adjust_All_Cellwidths
+    end
+    object MenuItem11: TMenuItem
+      Action = A_Copy
+    end
+  end
+  object ApplicationProperties1: TApplicationProperties
+    left = 537
+    top = 49
+  end
+end
diff --git a/tools/vdbview/mainwindow.pas b/tools/vdbview/mainwindow.pas
new file mode 100644
index 0000000..19b66b0
--- /dev/null
+++ b/tools/vdbview/mainwindow.pas
@@ -0,0 +1,793 @@
+unit MainWindow;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  Classes, SysUtils, XMLCfg, FileUtil, Forms, Controls, Graphics, Dialogs,
+  ComCtrls, ExtCtrls, Grids, StdCtrls, Buttons, Menus, ActnList, LCLType,
+  support_unit, math, selector_types, DataProxy, columnSel, gotoform,
+  searchform, clipbrd, types, version;
+
+type
+
+  { TMainform }
+
+  TMainform = class(TForm)
+    A_Version: TAction;
+    A_ClearHistory: TAction;
+    ApplicationProperties1: TApplicationProperties;
+    A_Copy: TAction;
+    A_Adjust_All_Cellwidths: TAction;
+    A_AdjustCellWidth: TAction;
+    A_Adjust_All_Headers: TAction;
+    A_AdjustHeader: TAction;
+    A_Search: TAction;
+    A_Goto: TAction;
+    A_First: TAction;
+    A_Last: TAction;
+    A_PageDn: TAction;
+    A_PageUp: TAction;
+    A_Up: TAction;
+    A_Down: TAction;
+    A_Columns: TAction;
+    A_OpenDir: TAction;
+    A_OpenFile: TAction;
+    A_OpenAcc: TAction;
+    A_Exit: TAction;
+    A_ActivateRecord: TAction;
+    A_ActivateGrid: TAction;
+    ActionList: TActionList;
+    LED: TShape;
+    MenuColumns: TMenuItem;
+    MenuItem1: TMenuItem;
+    MenuItem10: TMenuItem;
+    MenuItem11: TMenuItem;
+    MenuItem2: TMenuItem;
+    MI_Recent: TMenuItem;
+    MenuItem4: TMenuItem;
+    MenuItem5: TMenuItem;
+    MenuItem6: TMenuItem;
+    MenuItem7: TMenuItem;
+    MenuItem8: TMenuItem;
+    MenuItem9: TMenuItem;
+    PopupMenu1: TPopupMenu;
+    B_First: TSpeedButton;
+    B_Prev: TSpeedButton;
+    B_Up: TSpeedButton;
+    B_Down: TSpeedButton;
+    B_Next: TSpeedButton;
+    B_Last: TSpeedButton;
+    B_Search: TSpeedButton;
+    B_Goto: TSpeedButton;
+    Tables: TComboBox;
+    Grid: TDrawGrid;
+    MainMenu: TMainMenu;
+    MenueFile: TMenuItem;
+    MenueView: TMenuItem;
+    MI_Exit: TMenuItem;
+    MenuGrid: TMenuItem;
+    MI_Open_Accession: TMenuItem;
+    MI_Open_File: TMenuItem;
+    MI_Open_Directory: TMenuItem;
+    MenuRecord: TMenuItem;
+    SelFileDlg: TOpenDialog;
+    Panel1: TPanel;
+    RowScroll: TScrollBar;
+    ActivateRecord: TSpeedButton;
+    ActivateGrid: TSpeedButton;
+    cfg: TXMLConfig;
+    SelDirDlg: TSelectDirectoryDialog;
+    StatusBar: TStatusBar;
+    LEDTimer: TTimer;
+    procedure A_AdjustCellWidthExecute(Sender: TObject);
+    procedure A_AdjustHeaderExecute(Sender: TObject);
+    procedure A_Adjust_All_CellwidthsExecute(Sender: TObject);
+    procedure A_Adjust_All_HeadersExecute(Sender: TObject);
+    procedure A_ClearHistoryExecute(Sender: TObject);
+    procedure A_CopyExecute(Sender: TObject);
+    procedure A_SearchExecute(Sender: TObject);
+    procedure A_ActivateGridExecute(Sender: TObject);
+    procedure A_ActivateRecordExecute(Sender: TObject);
+    procedure A_ColumnsExecute(Sender: TObject);
+    procedure A_DownExecute(Sender: TObject);
+    procedure A_ExitExecute(Sender: TObject);
+    procedure A_FirstExecute(Sender: TObject);
+    procedure A_GotoExecute(Sender: TObject);
+    procedure A_LastExecute(Sender: TObject);
+    procedure A_OpenAccExecute(Sender: TObject);
+    procedure A_OpenDirExecute(Sender: TObject);
+    procedure A_OpenFileExecute(Sender: TObject);
+    procedure A_PageDnExecute(Sender: TObject);
+    procedure A_PageUpExecute(Sender: TObject);
+    procedure A_UpExecute(Sender: TObject);
+    procedure A_VersionExecute(Sender: TObject);
+    procedure FormActivate(Sender: TObject);
+    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
+    procedure FormCreate(Sender: TObject);
+    procedure FormDestroy(Sender: TObject);
+    procedure FormResize(Sender: TObject);
+    procedure GridDrawCell(Sender: TObject; aCol, aRow: Integer; aRect: TRect;
+      aState: TGridDrawState);
+    procedure GridHeaderSized(Sender: TObject; IsColumn: Boolean; Index: Integer
+      );
+    procedure GridKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
+    procedure GridMouseDown(Sender: TObject; Button: TMouseButton;
+      Shift: TShiftState; X, Y: Integer);
+    procedure GridMouseWheelDown(Sender: TObject; Shift: TShiftState;
+      MousePos: TPoint; var Handled: Boolean);
+    procedure GridMouseWheelUp(Sender: TObject; Shift: TShiftState;
+      MousePos: TPoint; var Handled: Boolean);
+    procedure GridSelectCell(Sender: TObject; aCol, aRow: Integer;
+      var CanSelect: Boolean);
+    procedure LEDTimerTimer(Sender: TObject);
+    procedure RowScrollChange(Sender: TObject);
+    procedure TablesSelect(Sender: TObject);
+  private
+    { private declarations }
+    fProxy   : TProxy;
+    fGridRow : Integer;
+    fGridCol : Integer;
+    fRecRow  : Integer;
+    fRecCol  : Integer;
+    fSearch  : String;
+    fDrawCtx : TDrawCtx;
+    fMouseShift : TShiftState;
+    fColWidths : TStringList;
+
+    function CopyGrid: String;
+    function CopyRecord: String;
+    procedure DrawDataCell( aCol, aRow : Integer; ct: TCellType; aRect: TRect );
+    procedure DrawRecordCell( aRow : Integer; ct: TCellType; aRect: TRect );
+    procedure GotoRow( const aRow : Integer );
+    procedure OnLRUClick( Sender : TObject );
+    procedure OnOpened( const path : String; success : boolean );
+    procedure OnTableSwitched;
+    procedure OnCellInvalidate( const aCol, aRow : Integer );
+    procedure OnLED( state : boolean );
+    procedure OnSearchDone( const aCol, aRow : Integer;
+                            const pattern : String );
+    procedure PerformOpen( const path, acc : String );
+    procedure AdjustColWidth( aCol : Integer; header : boolean );
+    procedure SaveColWidths;
+    procedure RestoreColWidths;
+  public
+    { public declarations }
+  end; 
+
+var
+  Mainform: TMainform;
+
+implementation
+
+{$R *.lfm}
+
+{ TMainform }
+
+procedure TMainform.FormCreate(Sender: TObject);
+var s : String;
+begin
+  s := ExtractFilePath( Application.ExeName );
+  cfg.Filename := s + '\' + cfg.Filename;
+  SelDirDlg.InitialDir := s;
+  SelFileDlg.InitialDir := s;
+  fColWidths := TStringList.Create;
+  fProxy := TProxy.Create;
+  fProxy.OnOpened := @OnOpened;
+  fProxy.OnTableSwitched := @OnTableSwitched;
+  fProxy.OnCellValid := @OnCellInvalidate;
+  fProxy.OnLED := @OnLED;
+  fProxy.OnSearchDone := @OnSearchDone;
+  fGridRow := 1;
+  fGridCol := 1;
+  fRecRow := 1;
+  fRecCol := 1;
+  fSearch := '';
+  A_ActivateGrid.Execute;
+end;
+
+procedure TMainform.FormDestroy(Sender: TObject);
+begin
+  fProxy.Free;
+  fColWidths.Free;
+end;
+
+procedure TMainform.FormActivate( Sender : TObject );
+begin
+  setup_position( Mainform, cfg, Screen ); {support_unit}
+  PopulateLRUMenue( cfg, MainMenu, MI_Recent, @OnLRUClick );
+  fDrawCtx.h := Grid.Canvas.TextHeight( 'X' );
+  fDrawCtx.w := Grid.Canvas.TextWidth( 'W' );
+  fDrawCtx.g := Grid;
+  if ( ParamCount > 0 )
+    then PerformOpen( ParamStr( 1 ), '' );
+end;
+
+procedure TMainform.FormClose(Sender: TObject; var CloseAction: TCloseAction);
+begin
+  store_position( Mainform, cfg ); {support_unit}
+end;
+
+procedure TMainform.FormResize( Sender : TObject );
+var n : Integer;
+begin
+  if ( ActivateGrid.Down )
+    then begin
+    adjust_gridrowcount( Grid, fProxy ); {support_unit}
+    n := fProxy.TableRows - Grid.RowCount + 1;
+    if ( n < Grid.RowCount )
+      then n := Grid.RowCount;
+    RowScroll.Max := n;
+    end
+    else Grid.ColWidths[ 1 ] := Grid.ClientWidth - Grid.ColWidths[ 0 ];
+end;
+
+procedure TMainform.A_ActivateGridExecute( Sender : TObject );
+begin
+  { save the row/col for record-view }
+  fRecRow := Grid.Row;
+  fRecCol := Grid.Col;
+  adjust_gridrowcount( Grid, fProxy ); {support_unit}
+  Grid.ColCount := fProxy.ColCount[ VISIBLE_COLUMNS ] + 1;
+  Grid.ScrollBars := ssHorizontal;
+  RowScroll.Visible := True;
+  { restore row/col for grid-view }
+  Grid.Row := fGridRow;
+  Grid.Col := fGridCol;
+  Grid.ColWidths[ 0 ] := 96;
+  A_Adjust_All_HeadersExecute( Sender );
+  RestoreColWidths;
+  ActivateGrid.Down := True;
+end;
+
+procedure TMainform.A_SearchExecute( Sender : TObject );
+var aCol, aRow : Integer;
+    p : TPoint;
+begin
+  if ActivateGrid.Down
+    then begin
+    aCol := Grid.Col - 1;
+    aRow := Grid.Row + RowScroll.Position - 1;
+    end
+    else begin
+    aCol := Grid.Row - 1;
+    aRow := fRecRow;
+    end;
+  if ( Length( fSearch ) < 1 )
+    then fSearch := fProxy.Cell[ aCol, aRow ];
+  p := Point( Grid.Left, Grid.Top );
+  SForm.present( ClientToScreen( p ), aCol, aRow, fSearch, fProxy );
+end;
+
+procedure TMainform.SaveColWidths;
+var i, idx : Integer;
+    s : String;
+begin
+  for i := 1 to Grid.ColCount - 1
+    do begin
+    s := fProxy.ColName[ VISIBLE_COLUMNS, i - 1 ];
+    idx := fColWidths.IndexOf( s );
+    if ( idx < 0 )
+      then begin
+      fColWidths.Add( s );
+      idx := fColWidths.IndexOf( s );
+      end;
+    if ( idx >= 0 )
+      then fColWidths.Objects[ idx ] := TObject( Grid.ColWidths[ i ] );
+    end;
+end;
+
+procedure TMainform.RestoreColWidths;
+var i, idx : Integer;
+begin
+  if ( ActivateGrid.Down )
+    then for i := 1 to Grid.ColCount - 1
+    do begin
+    idx := fColWidths.IndexOf( fProxy.ColName[ VISIBLE_COLUMNS, i - 1 ] );
+    if ( idx >= 0 )
+      then Grid.ColWidths[ i ] := Integer( fColWidths.Objects[ idx ] );
+    end;
+end;
+
+procedure TMainform.A_AdjustHeaderExecute( Sender : TObject );
+begin
+  if ActivateGrid.Down
+    then AdjustColWidth( Grid.Col, true );
+end;
+
+procedure TMainform.A_Adjust_All_CellwidthsExecute(Sender: TObject);
+var i : Integer;
+begin
+  if ActivateGrid.Down
+    then for i:= 1 to Grid.ColCount - 1
+           do AdjustColWidth( i, false );
+end;
+
+procedure TMainform.A_AdjustCellWidthExecute( Sender : TObject );
+begin
+  if ActivateGrid.Down
+    then AdjustColWidth( Grid.Col, false );
+end;
+
+procedure TMainform.A_Adjust_All_HeadersExecute( Sender : TObject );
+var i : Integer;
+begin
+  if ActivateGrid.Down
+    then for i:= 1 to Grid.ColCount - 1
+           do AdjustColWidth( i, true );
+end;
+
+procedure TMainform.A_ClearHistoryExecute( Sender : TObject );
+begin
+  ClearLRU( cfg, MI_Recent ); {support_unit}
+end;
+
+function TMainform.CopyGrid : String;
+var gr : TGridRect;
+    row, col, n : Integer;
+begin
+  Result  := '';
+  gr := Grid.Selection;
+  for row := gr.Top to gr.Bottom
+    do begin
+    if ( row > gr.Top )
+      then Result := Result + #13;
+    for col := gr.Left to gr.Right
+      do begin
+      if ( col > gr.Left )
+        then Result := Result + #9;
+      if ( col = 0 )
+        then begin
+        n := row + RowScroll.Position;
+        if ( n <= RowScroll.Max )
+           then Result := Result + FloatToStrF( n, ffnumber, 0, 0 );
+        end
+        else Result := Result + fProxy.Cell[ col - 1, row - 1 ];
+      end;
+    end;
+end;
+
+function TMainform.CopyRecord : String;
+var gr : TGridRect;
+    row, col : Integer;
+begin
+  Result := '';
+  gr := Grid.Selection;
+  for row := gr.Top to gr.Bottom
+    do begin
+    if ( row > gr.Top )
+      then Result := Result + #13;
+    for col := gr.Left to gr.Right
+      do begin
+      if ( col > gr.Left )
+        then Result := Result + #9;
+      case col of
+        0 : Result := Result + fProxy.ColName[ VISIBLE_COLUMNS, row - 1 ];
+        1 : Result := Result + fProxy.Cell[ row -1, fGridRow + RowScroll.Position - 1 ];
+      end;
+      end;
+    end;
+end;
+
+procedure TMainform.A_CopyExecute( Sender : TObject );
+var  s : String;
+begin
+  if ActivateGrid.Down
+    then s := CopyGrid
+    else s := CopyRecord;
+  if ( Length( s ) > 0 )
+    then Clipboard.AsText := s;
+end;
+
+procedure TMainform.A_ActivateRecordExecute(Sender: TObject);
+begin
+  { save the row/col for record-view }
+  fGridRow := Grid.Row;
+  fGridCol := Grid.Col;
+  SaveColWidths;
+  Grid.RowCount := fProxy.ColCount[ VISIBLE_COLUMNS ] + 1;
+  Grid.ColCount := 2;
+  Grid.ScrollBars := ssVertical;
+  RowScroll.Visible := False;
+  { restore row/col for record-view }
+  Grid.Row := fRecRow;
+  Grid.Col := fRecCol;
+  Grid.ColWidths[ 0 ] := 120;
+  Grid.ColWidths[ 1 ] := Grid.ClientWidth - Grid.ColWidths[ 0 ];
+  ActivateRecord.Down := True;
+  Grid.Invalidate;
+end;
+
+procedure TMainform.A_ColumnsExecute( Sender : TObject );
+var p : TPoint;
+begin
+  p := Point( Grid.Left, Grid.Top );
+  if ( Columnform.present( ClientToScreen( p ), Grid.ClientHeight, fProxy ) )
+    then begin
+    fProxy.AjustVisibleColumns( Columnform.checked_items );
+    if ( ActivateGrid.Down )
+      then Grid.ColCount := FProxy.ColCount[ VISIBLE_COLUMNS ] + 1
+      else Grid.RowCount := FProxy.ColCount[ VISIBLE_COLUMNS ] + 1;
+    Grid.Invalidate;
+    end;
+end;
+
+procedure TMainform.A_DownExecute( Sender : TObject );
+begin
+  if ( Grid.Row < ( Grid.RowCount - 2 ) )
+    then Grid.Row := Grid.Row + 1
+    else if ( RowScroll.Position < RowScroll.Max )
+           then begin
+           RowScroll.Position := RowScroll.Position + 1;
+           Grid.Invalidate;
+           end
+
+end;
+
+procedure TMainform.A_ExitExecute(Sender: TObject);
+begin
+  Close;
+end;
+
+procedure TMainform.A_FirstExecute( Sender : TObject );
+begin
+  RowScroll.Position := 0;
+  Grid.Row := 1;
+  Grid.Invalidate;
+end;
+
+procedure TMainform.GotoRow( const aRow : Integer );
+var nr, n1 : Integer;
+begin
+  nr := Min( aRow, fProxy.TableRows );
+  n1 := ( nr - Grid.Row );
+  if ( n1 <= RowScroll.Max )and( n1 >= 0 )
+    then RowScroll.Position := n1
+    else if ( n1 < 0 )
+           then begin
+           RowScroll.Position := 0;
+           Grid.Row := nr;
+           end
+           else begin
+           RowScroll.Position := RowScroll.Max;
+           Grid.Row := nr - RowScroll.Position;
+           end;
+  Grid.Invalidate;
+end;
+
+procedure TMainform.A_GotoExecute( Sender : TObject );
+var aRow : Integer;
+    p : TPoint;
+begin
+  p := Point( Grid.Left, Grid.Top );
+  aRow := Grid.Row + RowScroll.Position;
+  if ( MyGotoForm.present( ClientToScreen( p ), aRow ) )
+    then GotoRow( aRow );
+end;
+
+procedure TMainform.A_LastExecute( Sender : TObject );
+begin
+  RowScroll.Position := RowScroll.Max;
+  Grid.Row := Grid.RowCount - 1;
+  Grid.Invalidate;
+end;
+
+procedure TMainform.PerformOpen( const path, acc : String );
+begin
+  Tables.Clear; { the table-selector ... }
+  fProxy.Open( path, acc );
+end;
+
+procedure TMainform.OnLRUClick( Sender : TObject );
+var s : String;
+begin
+  s := ( Sender as TMenuItem ).Caption;
+  PerformOpen( s, '' );
+end;
+
+procedure TMainform.AdjustColWidth( aCol : Integer; header : boolean );
+var s : String;
+    r, w : Integer;
+begin
+  w := 0;
+  if ( header )
+    then begin
+    if ( aCol > 0 )
+      then begin
+      s := fProxy.ColName[ VISIBLE_COLUMNS, aCol - 1 ];
+      w := Grid.Canvas.TextWidth( s );
+      end;
+    end
+    else begin
+    for r := 0 to Grid.RowCount - 1
+      do begin
+      s := fProxy.Cell[ aCol-1, r + RowScroll.Position ];
+      w := Max( w, Grid.Canvas.TextWidth( s ) );
+      end;
+    end;
+  if ( w > 0 )
+    then Grid.ColWidths[ aCol ] := w + 10;
+end;
+
+procedure TMainform.A_OpenAccExecute( Sender : TObject );
+var acc : String;
+begin
+  acc := '';
+  if ( InputQuery( 'Open accession', 'accession', acc ) )
+    then PerformOpen( '', acc );
+end;
+
+procedure TMainform.A_OpenDirExecute(Sender: TObject);
+begin
+  if SelDirDlg.Execute
+    then PerformOpen( SelDirDlg.FileName, '' );
+end;
+
+procedure TMainform.A_OpenFileExecute(Sender: TObject);
+begin
+  if SelFileDlg.Execute
+    then PerformOpen( SelFileDlg.FileName, '' );
+end;
+
+procedure TMainform.A_PageDnExecute( Sender : TObject );
+begin
+  if ( Grid.Row + 10 <= Grid.RowCount )
+    then Grid.Row := Grid.Row + 10
+    else if ( RowScroll.Position < ( RowScroll.Max - 10 ) )
+           then begin
+           RowScroll.Position := RowScroll.Position + 10;
+           Grid.Invalidate;
+           end
+           else begin
+           RowScroll.Position := RowScroll.Max;
+           Grid.Row := Grid.RowCount - 1;
+           Grid.Invalidate;
+           end;
+end;
+
+procedure TMainform.A_PageUpExecute( Sender : TObject );
+begin
+  if Grid.Row > 10
+    then Grid.Row := Grid.Row - 10
+    else if ( RowScroll.Position > 10 )
+           then begin
+           RowScroll.Position := RowScroll.Position - 10;
+           Grid.Invalidate;
+           end
+           else begin
+           RowScroll.Position := 0;
+           Grid.Row := 0;
+           Grid.Invalidate;
+           end;
+end;
+
+procedure TMainform.A_UpExecute( Sender : TObject );
+begin
+  if Grid.Row > 1
+    then Grid.Row := Grid.Row - 1
+    else if ( RowScroll.Position > 0 )
+           then begin
+           RowScroll.Position := RowScroll.Position - 1;
+           Grid.Invalidate;
+           end;
+end;
+
+procedure TMainform.A_VersionExecute(Sender: TObject);
+begin
+  VersionForm.ShowModal;
+end;
+
+procedure TMainform.DrawDataCell( aCol, aRow : Integer;
+                                  ct : TCellType; aRect : TRect );
+var s : String;
+    effective_row : Integer;
+    center, clip : boolean;
+begin
+  effective_row := aRow + RowScroll.Position - 1;
+  case ct of
+    ct_topleft : s := 'row';
+    ct_row     : s := Format( '%s', [ FloatToStrF(
+                        effective_row + 1, ffnumber, 0, 0 ) ] );
+    ct_col     : s := FProxy.ColName[ VISIBLE_COLUMNS, aCol - 1 ];
+    ct_content : s := FProxy.Cell[ aCol - 1, effective_row ];
+  end;
+  clip := ( ct = ct_content );
+  center := ( ct = ct_topleft )or( ct = ct_row );
+  draw_cell( fDrawCtx, aRect, center, clip, s );
+end;
+
+procedure TMainform.DrawRecordCell( aRow : Integer;
+                                    ct : TCellType; aRect : TRect );
+var s  : String;
+    clip : boolean;
+begin
+  case ct of
+    ct_topleft : s := 'column';
+    ct_row     : s := FProxy.ColName[ VISIBLE_COLUMNS, aRow - 1 ];
+    ct_col     : s := 'value';
+    ct_content : s := FProxy.Cell[ aRow - 1, fGridRow + RowScroll.Position - 1 ];
+  end;
+  clip := ( ct = ct_content );
+  draw_cell( fDrawCtx, aRect, false, clip, s );
+end;
+
+procedure TMainform.GridDrawCell(Sender: TObject; aCol, aRow: Integer;
+  aRect: TRect; aState: TGridDrawState);
+begin
+  if ActivateGrid.Down
+    then DrawDataCell( aCol, aRow, get_celltype( aCol, aRow ), aRect )
+    else DrawRecordCell( aRow, get_celltype( aCol, aRow ), aRect );
+end;
+
+procedure TMainform.GridHeaderSized( Sender : TObject; IsColumn : Boolean;
+                                     Index : Integer );
+var h, i : Integer;
+begin
+  if ( ( not IsColumn )and ( ActivateGrid.Down ) )
+    then begin
+    if ( ssShift in fMouseShift )
+      then begin
+      h := Grid.RowHeights[ Index ];
+      Grid.RowCount := ( Grid.ClientHeight div h ) + 1;
+      for i := 1 to Grid.RowCount - 1
+        do Grid.RowHeights[ i ] := h;
+      adjust_gridrowcount_to( Grid, fProxy, h );
+      end
+      else begin
+      adjust_gridrowcount( Grid, fProxy );
+      end;
+    end;
+end;
+
+procedure TMainform.GridKeyDown(Sender: TObject; var Key: Word;
+  Shift: TShiftState);
+begin
+  case Key of
+    vk_up    : begin A_Up.Execute; Key := 0; end;
+    vk_down  : begin A_Down.Execute; Key := 0; end;
+    vk_prior : begin A_PageUp.Execute; Key := 0; end;
+    vk_next  : begin A_PageDn.Execute; Key := 0; end;
+    vk_home  : begin A_First.Execute; Key := 0; end;
+    vk_end   : begin A_Last.Execute; Key := 0; end;
+  end;
+end;
+
+procedure TMainform.GridMouseDown(Sender: TObject; Button: TMouseButton;
+  Shift: TShiftState; X, Y: Integer);
+begin
+  fMouseShift := Shift;
+end;
+
+procedure TMainform.GridMouseWheelDown( Sender : TObject; Shift : TShiftState;
+  MousePos : TPoint; var Handled : Boolean );
+begin
+  A_DownExecute( Sender );
+  Handled := True;
+end;
+
+procedure TMainform.GridMouseWheelUp( Sender : TObject; Shift : TShiftState;
+  MousePos : TPoint; var Handled : Boolean );
+begin
+  A_UpExecute( Sender );
+  Handled := True;
+end;
+
+procedure TMainform.GridSelectCell(Sender: TObject; aCol, aRow: Integer;
+  var CanSelect: Boolean);
+begin
+  if ActivateGrid.Down
+    then StatusBar.Panels[ 0 ].Text := Format( '%s',
+    [ FloatToStrF( aRow + RowScroll.Position, ffnumber, 0, 0 ) ] );
+
+end;
+
+procedure TMainform.LEDTimerTimer( Sender : TObject );
+begin
+  if ( LEDTimer.Tag = 0 )
+    then begin
+    LED.Brush.Color := clLime;
+    LEDTimer.Tag := 1;
+    end
+    else begin
+    LED.Brush.Color := clGreen;
+    LEDTimer.Tag := 0;
+    end
+end;
+
+procedure TMainform.RowScrollChange( Sender : TObject );
+begin
+  FProxy.Offset := RowScroll.Position;
+  StatusBar.Panels[ 0 ].Text := Format( '%s',
+    [ FloatToStrF( Grid.Row + RowScroll.Position, ffnumber, 0, 0 ) ] );
+  Grid.Invalidate;
+end;
+
+procedure TMainform.TablesSelect( Sender : TObject );
+begin
+  FProxy.TabId := Tables.ItemIndex; { triggers table-open... }
+  Tables.Enabled := false;
+end;
+
+procedure TMainform.OnOpened( const path : String; success : boolean );
+var i : Integer;
+begin
+  if ( success )
+    then begin
+    Mainform.Caption := path;
+    Tables.Clear;
+    for i:=0 to FProxy.Tables - 1
+      do Tables.Items.Add( FProxy.TableName[ i ] );
+    Tables.ItemIndex := 0;
+    TablesSelect( Tables );
+    SaveLRU( path, cfg );
+    PopulateLRUMenue( cfg, MainMenu, MI_Recent, @OnLRUClick );
+    end
+    else begin
+    ShowMessage( Format( 'open "%s" failed', [ path ] ) );
+    end;
+end;
+
+procedure TMainform.OnTableSwitched;
+begin
+  if ( ActivateGrid.Down )
+    then begin
+    Grid.ColCount := fProxy.ColCount[ VISIBLE_COLUMNS ] + 1;
+    adjust_gridrowcount( Grid, fProxy ); {support_unit}
+    end
+    else begin
+    Grid.ColCount := 2;
+    Grid.RowCount := fProxy.ColCount[ VISIBLE_COLUMNS ] + 1;
+    end;
+  RowScroll.Max := fProxy.TableRows - Grid.RowCount + 1;
+  StatusBar.Panels[ 1 ].Text := Format( 'of %s',
+    [ FloatToStrF( fProxy.TableRows, ffnumber, 0, 0 ) ] );
+  Grid.Invalidate;
+  Tables.Enabled := true;
+end;
+
+procedure TMainform.OnCellInvalidate( const aCol, aRow : Integer );
+var eCol, eRow : Integer;
+begin
+  if ( ActivateGrid.Down )
+    then begin
+    eRow := aRow + 1;
+    eCol := aCol + 1;
+    end
+    else begin
+    eRow := aCol + 1;
+    eCol := 1;
+    end;
+  if ( eRow > 0 )and( eRow < Grid.RowCount )and
+     ( eCol > 0 )and( eCol < Grid.ColCount )
+    then Grid.InvalidateCell( eCol, eRow );
+end;
+
+procedure TMainform.OnLED( state : boolean );
+begin
+  if State
+    then begin
+    LEDTimer.Tag := 1;
+    LED.Brush.Color := clLime;
+    LEDTimer.Enabled:= true;
+    end
+    else begin
+    LEDTimer.Tag := 0;
+    LEDTimer.Enabled:= false;
+    LED.Brush.Color := clDefault;
+    end;
+end;
+
+procedure TMainform.OnSearchDone( const aCol, aRow : Integer;
+                                  const pattern : String );
+begin
+  if ( aRow < 0 )
+    then ShowMessage( Format( '"%s" not found', [ pattern ] ) )
+    else begin
+    SForm.update_row( aRow );
+    GotoRow( aRow + 1 );
+    end;
+end;
+
+end.
+
diff --git a/tools/vdbview/searchform.lfm b/tools/vdbview/searchform.lfm
new file mode 100644
index 0000000..83440a9
--- /dev/null
+++ b/tools/vdbview/searchform.lfm
@@ -0,0 +1,69 @@
+object SForm: TSForm
+  Left = 494
+  Height = 158
+  Top = 314
+  Width = 354
+  Caption = 'SForm'
+  ClientHeight = 158
+  ClientWidth = 354
+  FormStyle = fsStayOnTop
+  LCLVersion = '0.9.30'
+  object Panel1: TPanel
+    Left = 0
+    Height = 50
+    Top = 108
+    Width = 354
+    Align = alBottom
+    ClientHeight = 50
+    ClientWidth = 354
+    TabOrder = 0
+    object B_OK: TBitBtn
+      Left = 168
+      Height = 30
+      Top = 9
+      Width = 83
+      Caption = '&Search'
+      Kind = bkOK
+      ModalResult = 1
+      OnClick = B_OKClick
+      TabOrder = 0
+    end
+    object BCancel: TBitBtn
+      Left = 264
+      Height = 30
+      Top = 9
+      Width = 83
+      Cancel = True
+      Caption = '&Close'
+      Kind = bkCancel
+      ModalResult = 2
+      OnClick = BCancelClick
+      TabOrder = 1
+    end
+  end
+  object EPattern: TEdit
+    Left = 16
+    Height = 21
+    Top = 17
+    Width = 320
+    TabOrder = 1
+  end
+  object RB_Forward: TRadioButton
+    Left = 16
+    Height = 17
+    Top = 47
+    Width = 60
+    Caption = 'Forward'
+    Checked = True
+    TabOrder = 3
+    TabStop = True
+  end
+  object RB_Backward: TRadioButton
+    Left = 16
+    Height = 17
+    Top = 68
+    Width = 66
+    Caption = 'Backward'
+    TabOrder = 2
+  end
+end
diff --git a/tools/vdbview/searchform.pas b/tools/vdbview/searchform.pas
new file mode 100644
index 0000000..7e62529
--- /dev/null
+++ b/tools/vdbview/searchform.pas
@@ -0,0 +1,79 @@
+unit searchform;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
+  Buttons, StdCtrls, DataProxy;
+
+type
+
+  { TSForm }
+
+  TSForm = class(TForm)
+    B_OK: TBitBtn;
+    BCancel: TBitBtn;
+    EPattern: TEdit;
+    Panel1: TPanel;
+    RB_Backward: TRadioButton;
+    RB_Forward: TRadioButton;
+    procedure BCancelClick(Sender: TObject);
+    procedure B_OKClick(Sender: TObject);
+  private
+    { private declarations }
+    fRow, fCol : Integer;
+    fProxy : TProxy;
+  public
+    { public declarations }
+    procedure present( const p : TPoint;
+                       aCol, aRow : Integer;
+                       pattern : String;
+                       aProxy : TProxy );
+    procedure update_row( aRow : Integer );
+  end; 
+
+var
+  SForm: TSForm;
+
+implementation
+
+{$R *.lfm}
+
+{ TSForm }
+
+procedure TSForm.B_OKClick( Sender : TObject );
+begin
+  if ( RB_Forward.Checked )
+    then fProxy.Search( true, fCol, fRow + 1, EPattern.Text )
+    else fProxy.Search( false, fCol, fRow - 1, EPattern.Text );
+end;
+
+procedure TSForm.BCancelClick(Sender: TObject);
+begin
+  fProxy.CancelSearch;
+  Hide;
+end;
+
+procedure TSForm.present( const p : TPoint;
+                          aCol, aRow : Integer;
+                          pattern : String;
+                          aProxy : TProxy );
+begin
+  Left := p.x;
+  Top  := p.y;
+  EPattern.Text := pattern;
+  fRow := aRow;
+  fCol := aCol;
+  fProxy := aProxy;
+  Show;
+end;
+
+procedure TSForm.update_row( aRow : Integer );
+begin
+  fRow := aRow;
+end;
+
+end.
+
diff --git a/tools/vdbview/selector_types.pas b/tools/vdbview/selector_types.pas
new file mode 100644
index 0000000..aa0c37b
--- /dev/null
+++ b/tools/vdbview/selector_types.pas
@@ -0,0 +1,20 @@
+unit selector_types;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  Classes, SysUtils; 
+
+const
+     ALL_COLUMNS = Integer( 0 );
+     STATIC_COLUMNS = Integer( 1 );
+     NON_STATIC_COLUMNS = Integer( 2 );
+     VISIBLE_COLUMNS = Integer( 3 );
+     NON_VISIBLE_COLUMNS = Integer( 4 );
+
+implementation
+
+end.
+
diff --git a/tools/vdbview/support_unit.pas b/tools/vdbview/support_unit.pas
new file mode 100644
index 0000000..d1f757b
--- /dev/null
+++ b/tools/vdbview/support_unit.pas
@@ -0,0 +1,217 @@
+unit support_unit;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  Classes, SysUtils, Forms, Grids, XMLCfg, DataProxy, CheckLst,
+  Menus, Graphics, StrUtils;
+
+type
+ TCellType = ( ct_topleft, ct_row, ct_col, ct_content );
+ TOnLRUClick = procedure( Sender : TObject ) of Object;
+
+ TDrawCtx = record
+   w, h : Integer;
+   g    : TDrawGrid;
+ end;
+
+procedure setup_position( M : TForm; cfg : TXMLConfig; S : TScreen );
+procedure store_position( M : TForm; cfg : TXMLConfig );
+procedure adjust_gridrowcount_to( G : TDrawGrid; P : TProxy; h : Integer );
+procedure adjust_gridrowcount( G : TDrawGrid; P : TProxy );
+function get_celltype( aCol, aRow: Integer ) : TCellType;
+procedure draw_cell( ctx : TDrawCtx; aRect : TRect;
+                     center, clip : boolean; s : String );
+function CheckListBox2String( aBox : TCheckListBox ) : String;
+
+procedure SaveLRU( path : string; cfg : TXMLConfig );
+procedure PopulateLRUMenue( cfg : TXMLConfig; mm : TMainMenu;
+                            item : TMenuItem; event : TOnLRUClick );
+procedure ClearLRU( cfg : TXMLConfig; item : TMenuItem );
+
+implementation
+
+procedure setup_position( M : TForm; cfg : TXMLConfig; S : TScreen );
+begin
+  M.Left := cfg.GetValue( 'xpos', M.Left );
+  M.Width:= cfg.GetValue( 'width', M.Width );
+  if ( M.Left + M.Width > S.Width )
+    then M.Left := S.Width - M.Width;
+  if ( M.Left < 0 ) then M.Left := 0;
+  if ( M.Width > S.Width ) then M.Width := S.Width;
+  M.Top  := cfg.GetValue( 'ypos', M.Top );
+  M.Height:= cfg.Getvalue( 'height', M.Height );
+  if ( M.Top + M.Height > S.Height )
+    then M.Top := S.Height - M.Height;
+  if ( M.Top < 0 ) then M.Top := 0;
+  if ( M.Height > S.Height ) then M.Height := S.Height;
+  if ( cfg.GetValue( 'windowstate', 'N' ) = 'M' )
+    then M.WindowState := wsMaximized;
+end;
+
+procedure store_position( M : TForm; cfg : TXMLConfig );
+begin
+  case M.WindowState of
+    wsNormal : begin
+               cfg.SetValue( 'xpos', M.Left );
+               cfg.SetValue( 'width', M.Width );
+               cfg.SetValue( 'ypos', M.Top );
+               cfg.SetValue( 'height', M.Height );
+               cfg.SetValue( 'windowstate', 'N' );
+               end;
+    wsMaximized : cfg.SetValue( 'windowstate', 'M' );
+    wsMinimized : cfg.SetValue( 'windowstate', 'N' );
+   end;
+end;
+
+procedure adjust_gridrowcount_to( G : TDrawGrid; P : TProxy; h : Integer );
+begin
+  G.RowCount := ( G.ClientHeight div h ) + 1;
+  G.RowCount := G.VisibleRowCount + 2;
+  P.AdjustCacheRows( G.RowCount );
+end;
+
+procedure adjust_gridrowcount( G : TDrawGrid; P : TProxy );
+begin
+  adjust_gridrowcount_to( G, P, G.DefaultRowHeight );
+end;
+
+function get_celltype( aCol, aRow : Integer ) : TCellType;
+begin
+  if ( aCol = 0 )
+    then if ( aRow = 0 )
+           then Result := ct_topleft
+           else Result := ct_row
+    else if ( aRow = 0 )
+           then Result := ct_col
+           else Result := ct_content;
+end;
+
+procedure draw_multi_line( ctx : TDrawCtx; aRect : TRect;
+          center : boolean; s : String; cw, tw, ch, cpl : Integer );
+var n_lines, v_lines, i : Integer;
+begin
+  if ( cpl > 0 )
+    then begin
+    n_lines := ( Length( s ) div cpl );
+    v_lines := ( ch div ctx.h );
+    if ( v_lines < n_lines )
+      then begin
+      { not all lines are visible ... }
+      if ( v_lines > 0 )
+        then begin
+        for i := 0 to v_lines - 2
+          do ctx.g.Canvas.TextOut( aRect.Left + 5,
+                                   aRect.Top + 3 + ( i * ctx.h ),
+                                   MidStr( s, i * cpl, cpl ) );
+        i := v_lines - 1;
+        ctx.g.Canvas.TextOut( aRect.Left + 5,
+                              aRect.Top + 3 + ( i * ctx.h ),
+                              MidStr( s, i * cpl, cpl - 2 ) + '..' );
+
+        end;
+      end
+      else begin
+      { all lines are visible ... }
+      if ( n_lines > 0 )
+        then for i := 0 to n_lines
+          do ctx.g.Canvas.TextOut( aRect.Left + 5,
+                                   aRect.Top + 3 + ( i * ctx.h ),
+                                   MidStr( s, i * cpl, cpl ) );
+      end;
+    end;
+end;
+
+procedure draw_single_line( ctx : TDrawCtx; aRect : TRect;
+          center, clip : boolean; s : String; cw, tw, cpl : Integer );
+var x, y : Integer;
+begin
+  y := aRect.top + 3;
+  if ( center )
+    then x := aRect.Left + ( ( cw - tw ) div 2 )
+    else x := aRect.left + 5;
+  if ( ( Length( s ) > cpl )and( clip ) )
+    then ctx.g.Canvas.TextRect( aRect, x, y, MidStr( s, 0, cpl-2 )+'..' )
+    else ctx.g.Canvas.TextRect( aRect, x, y, s );
+end;
+
+procedure draw_cell( ctx : TDrawCtx; aRect : TRect;
+                     center, clip : boolean; s : String );
+var ch, cw, tw, cpl : Integer;
+begin
+  ch := aRect.Bottom - aRect.Top; { cell height }
+  cw := aRect.Right - aRect.Left; { cell width }
+  tw := ctx.g.Canvas.TextWidth( s ); { text width }
+  cpl := ( ( cw - 10 ) div ctx.w ); { chars per line }
+
+  if ( tw > ( cw - 10 ) )and( ch > ( ctx.h + ctx.h ) )
+    then draw_multi_line( ctx, aRect, center, s, cw, tw, ch, cpl )
+    else draw_single_line( ctx, aRect, center, clip, s, cw, tw, cpl );
+end;
+
+function CheckListBox2String( aBox : TCheckListBox ) : String;
+var i : Integer;
+begin
+  Result := '';
+  if Assigned( aBox )
+    then begin
+    for i := 0  to aBox.Items.Count - 1
+      do if ( aBox.Checked[ i ] )
+           then Result := Result + 'X'
+           else Result := Result + '-';
+    end;
+end;
+
+procedure SaveLRU( path : string; cfg : TXMLConfig );
+var L : TStringList;
+begin
+  L := TStringList.Create;
+  if Assigned( L )
+    then try
+    L.Text := cfg.GetValue( 'LRU/path', '' );
+    if ( L.IndexOf( path ) < 0 )
+      then begin
+      if ( L.Count > 20 )
+        then L.Delete( 0 );
+      L.Add( path );
+      cfg.SetValue( 'LRU/path', L.Text );
+      end;
+    finally
+    L.Free;
+    end;
+end;
+
+procedure PopulateLRUMenue( cfg : TXMLConfig; mm : TMainMenu;
+                            item : TMenuItem; event : TOnLRUClick );
+var M : TMenuItem;
+    L : TStringList;
+    I : Integer;
+begin
+  L := TStringList.Create;
+  if Assigned( L )
+    then try
+      L.Text := cfg.GetValue( 'LRU/path', '' );
+      item.Clear;
+      for I := 0 to L.Count-1
+        do begin
+        M := TMenuItem.Create( mm );
+        M.Name := Format( 'LRU_Item_%d', [ I ] );
+        M.Caption := L.Strings[ I ];
+        M.OnClick := event;
+        item.Add( M );
+        end;
+    finally
+      L.Free;
+    end;
+end;
+
+procedure ClearLRU( cfg : TXMLConfig; item : TMenuItem );
+begin
+  cfg.SetValue( 'LRU/path', '' );
+  item.Clear;
+end;
+
+end.
+
diff --git a/tools/vdbview/svdb.pas b/tools/vdbview/svdb.pas
new file mode 100644
index 0000000..2ab2dc5
--- /dev/null
+++ b/tools/vdbview/svdb.pas
@@ -0,0 +1,676 @@
+unit svdb;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  Classes, SysUtils, dynlibs;
+
+type
+
+  TAcc2Path = function( acc : PChar ) : PChar; cdecl;
+  TOpenPath = function( path : PChar ) : Pointer; cdecl;
+  TClose = procedure( obj : Pointer ); cdecl;
+  TLastErr = function : PChar; cdecl;
+  TIsDb = function( obj : Pointer ) : Integer; cdecl;
+  TCountTabs = function( obj : Pointer ) : Integer; cdecl;
+  TTabName = function( obj : Pointer; tabid : Integer ) : PChar; cdecl;
+  TTabIdx = function( obj : Pointer; name : PChar ) : Integer; cdecl;
+  TCountCols = function( obj : Pointer; tabid, sel : Integer ) : Integer; cdecl;
+  TColName = function( obj : Pointer;
+                       tabid, sel, colid : Integer ) : PChar; cdecl;
+  TColIdx = function( obj : Pointer; tabid, sel : Integer;
+                      name : PChar ) : Integer; cdecl;
+  TColVisibility = function( obj : Pointer; tabid, sel,
+                             col_id, visible : Integer ) : Integer; cdecl;
+  TDefTypeIdx = function( obj : Pointer; tabid, sel,
+                          colid : Integer ) : Integer; cdecl;
+  TCountTypes = function( obj : Pointer; tabid, sel,
+                          colid : Integer ) : Integer; cdecl;
+  TTypeName = function( obj : Pointer; tabid, sel,
+                        colid, typeid : Integer ) : PChar; cdecl;
+  TTypeIdx = function( obj : Pointer; tabid, sel, colid : Integer;
+                       name : PChar ) : Integer; cdecl;
+  TTypeDomain = function( obj : Pointer; tabid, sel,
+                          colid, typeid : Integer ) : Integer; cdecl;
+  TTypeBits = function( obj : Pointer; tabid, sel,
+                        colid, typeid : Integer ) : Integer; cdecl;
+  TTypeDim = function( obj : Pointer; tabid, sel,
+                       colid, typeid : Integer ) : Integer; cdecl;
+
+  TOpenTable = function( obj : Pointer; tabid : Integer;
+                         defline : PChar ) : Integer; cdecl;
+  TMaxColnameLen = function( obj : Pointer;
+                             tabid, sel : Integer ) : Integer; cdecl;
+  TSetElemSep = procedure( obj : Pointer; tabid, sel,
+                           colid : Integer; sep : PChar ); cdecl;
+  TSetDimSep = procedure( obj : Pointer; tabid, sel,
+                          colid : Integer; sep : PChar ); cdecl;
+  TIsColEnabled = function( obj : Pointer; tabid, sel,
+                            colid : Integer ) : Integer; cdecl;
+  TGetRowRange = function( obj : Pointer; tabid : Integer ) : Int64; cdecl;
+  TGetFirstRow = function( obj : Pointer; tabid : Integer ) : Int64; cdecl;
+  TGetCell = function( obj : Pointer; dst : PChar;
+                       dst_len, tab_id, sel, col_id : Integer;
+                       row : Int64 ) : Integer; cdecl;
+
+  TFindFwd = function( obj : Pointer; tabid, sel, colid : Integer;
+                       row : Int64; chunk : Integer; pattern : PChar ): Int64; cdecl;
+  TFindBwd = function( obj : Pointer; tabid, sel, colid : Integer;
+                       row : Int64; chunk : Integer; pattern : PChar ): Int64; cdecl;
+
+  TMetaRoot = function( obj : Pointer; tabid : Integer ) : Integer; cdecl;
+  TMetaName = function( obj : Pointer; tabid, metaid : Integer;
+                        dst :PChar; dst_len : Integer ) : Integer; cdecl;
+  TMetaValueLen = function( obj : Pointer;
+                            tabid, metaid : Integer ) : Integer; cdecl;
+  TMetaValuePrintable = function( obj : Pointer;
+                            tabid, metaid : Integer ) : Integer; cdecl;
+  TMetaValuePtr = function( obj : Pointer;
+                            tabid, metaid : Integer ) : Pointer; cdecl;
+  TMetaValue = function( obj : Pointer; tabid, metaid : Integer;
+                         dst :PChar; dst_len, trim : Integer ) : Integer; cdecl;
+  TMetaChildCount = function( obj : Pointer;
+                         tabid, metaid : Integer ) : Integer; cdecl;
+  TMetaChildId = function( obj : Pointer;
+                         tabid, metaid, childid : Integer ) : Integer; cdecl;
+
+  { TSvdb }
+
+  TSvdb = class
+  private
+    { private declarations }
+    f_mylib : TLibHandle;
+
+    f_acc2path   : TAcc2Path;
+    f_openpath   : TOpenPath;
+    f_lasterr    : TLastErr;
+    f_close      : TClose;
+    f_isdb       : TIsDb;
+    f_countTabs  : TCountTabs;
+    f_tabName    : TTabName;
+    f_tabIdx     : TTabIdx;
+    f_countCols  : TCountCols;
+    f_colName    : TColName;
+    f_colIdx     : TColIdx;
+    f_colVisible : TColVisibility;
+    f_defTypeIdx : TDefTypeIdx;
+    f_countTypes : TCountTypes;
+    f_typeName   : TTypeName;
+    f_typeIdx    : TTypeIdx;
+    f_typeDomain : TTypeDomain;
+    f_typeBits   : TTypeBits;
+    f_typeDim    : TTypeDim;
+
+    f_openTab      : TOpenTable;
+    f_maxColNameLen : TMaxColnameLen;
+    f_setElemSep   : TSetElemSep;
+    f_setDimSep    : TSetDimSep;
+    f_isColEnabled : TIsColEnabled;
+    f_getRowRange  : TGetRowRange;
+    f_getFirstRow  : TGetFirstRow;
+    f_getCell      : TGetCell;
+    f_findFwd      : TFindFwd;
+    f_findBwd      : TFindBwd;
+
+    f_metaRoot     : TMetaRoot;
+    f_metaName     : TMetaName;
+    f_metaValueLen : TMetaValueLen;
+    f_metaValuePrintable : TMetaValuePrintable;
+    f_metaValuePtr : TMetaValuePtr;
+    f_metaValue    : TMetaValue;
+    f_metaChildCount : TMetaChildCount;
+    f_metaChildId  : TMetaChildId;
+
+    function connect( dll_name : String ) : boolean;
+    procedure disconnect;
+    procedure clear;
+    function GetCellN( obj : Pointer; tabid, sel, colid, size : Integer;
+                       row : Int64; var needed : Integer ) : String;
+    function MetaNameN( obj : Pointer; tabid, metaid, size : Integer) : String;
+    function MetaValueN( obj : Pointer; tabid, metaid, size, trim : Integer ) : String;
+  public
+    { public declarations }
+    constructor Create;
+    destructor Destroy; override;
+
+    function LastErr : String;
+    function Acc2Path( acc : String ) : String;
+    function OpenPath( path : String ) : Pointer;
+    procedure Close( obj : Pointer );
+    function IsDb( obj : Pointer ) : boolean;
+    function CountTabs( obj : Pointer ) : Integer;
+    function TabName( obj : Pointer; tabid : Integer ) : String;
+    function TabIdx( obj : Pointer; name : String ) : Integer;
+    function CountCols( obj : Pointer; tabid, sel : Integer ) : Integer;
+    function ColName( obj : Pointer; tabid, sel, colid : Integer ) : String;
+    function ColIdx( obj : Pointer; tabid, sel : Integer; name : String ) : Integer;
+    function SetColVisible( obj : Pointer; tabid, sel, colid, visible : Integer ) : Integer;
+    function DefTypeIdx( obj : Pointer; tabid, sel, colid : Integer ) : Integer;
+    function CountTypes( obj : Pointer; tabid, sel, colid : Integer ) : Integer;
+    function TypeName( obj : Pointer; tabid, sel, colid, typeid : Integer ) : String;
+    function TypeIdx( obj : Pointer; tabid, sel, colid : Integer; name : String ) : Integer;
+    function TypeDomain( obj : Pointer; tabid, sel, colid, typeid : Integer ) : Integer;
+    function TypeBits( obj : Pointer; tabid, sel, colid, typeid : Integer ) : Integer;
+    function TypeDim( obj : Pointer; tabid, sel, colid, typeid : Integer ) : Integer;
+
+    function OpenTable( obj : Pointer; tabid : Integer; defline : String ) : Integer;
+    function MaxColnameLen( obj : Pointer; tabid, sel : Integer ) : Integer;
+    procedure SetElemSep( obj : Pointer; tabid, sel, colid : Integer; sep : String );
+    procedure SetDimSep( obj : Pointer; tabid, sel, colid : Integer; sep : String );
+    function IsColEnabled( obj : Pointer; tabid, sel, colid : Integer ) : boolean;
+    function RowRange( obj : Pointer; tabid : Integer ) : Int64;
+    function FirstRow( obj : Pointer; tabid : Integer ) : Int64;
+    function GetCell( obj : Pointer; tabid, sel, colid : Integer; row : Int64 ) : String;
+    function FindFwd( obj : Pointer;  tabid, sel, colid : Integer;
+                      row : Int64; chunk : Integer; pattern : String ) : Int64;
+    function FindBwd( obj : Pointer;  tabid, sel, colid : Integer;
+                      row : Int64; chunk : Integer; pattern : String ) : Int64;
+
+    function MetaRoot( obj : Pointer; tabid : Integer ) : Integer;
+    function MetaName( obj : Pointer; tabid, metaid : Integer ) : String;
+    function MetaValueLen( obj : Pointer; tabid, metaid : Integer ) : Integer;
+    function MetaValuePrintable( obj : Pointer; tabid, metaid : Integer ) : boolean;
+    function MetaValuePtr( obj : Pointer; tabid, metaid : Integer ) : Pointer;
+    function MetaValue( obj : Pointer; tabid, metaid, trim : Integer ) : String;
+    function MetaChildCount( obj : Pointer; tabid, metaid : Integer ) : Integer;
+    function MetaChildId( obj : Pointer; tabid, metaid, childid : Integer ) : Integer;
+
+  end;
+
+implementation
+
+{ TSvdb }
+
+constructor TSvdb.Create;
+begin
+  inherited;
+  clear;
+  connect( 'libsvdb.dll' );
+end;
+
+destructor TSvdb.Destroy;
+begin
+  disconnect;
+  inherited Destroy;
+end;
+
+function TSvdb.LastErr : String;
+var s : PChar;
+begin
+  Result := '';
+  if ( f_lasterr <> Nil )
+    then begin
+    s := f_lasterr();
+    if ( s <> Nil )
+      then Result := String( s );
+    end;
+end;
+
+function TSvdb.Acc2Path( acc : String ) : String;
+var s : PChar;
+begin
+  Result := '';
+  if ( f_acc2path <> Nil )
+    then begin
+    s := f_acc2path( PChar( acc ) );
+    if ( s <> Nil )
+       then Result := String( s );
+  end;
+end;
+
+function TSvdb.OpenPath( path : String ) : Pointer;
+begin
+  Result := Nil;
+  if ( f_openpath <> Nil )
+    then Result := f_openpath( PChar( path ) );
+end;
+
+procedure TSvdb.Close( obj : Pointer );
+begin
+  if ( f_close <> Nil )
+    then f_close( obj );
+end;
+
+function TSvdb.IsDb( obj : Pointer ) : boolean;
+begin
+  Result := false;
+  if ( f_isdb <> Nil )
+    then Result := ( f_isdb( obj ) <> 0 );
+end;
+
+function TSvdb.CountTabs( obj : Pointer ) : Integer;
+begin
+  Result := 0;
+  if ( f_countTabs <> Nil )
+    then Result := f_countTabs( obj );
+end;
+
+function TSvdb.TabName( obj : Pointer; tabid : Integer ) : String;
+var p : PChar;
+begin
+  Result := '';
+  if ( f_tabName <> Nil )
+    then begin
+    p := f_tabName( obj, tabid );
+    if ( p <> Nil )
+      then Result := String( p );
+    end;
+end;
+
+function TSvdb.TabIdx( obj : Pointer; name : String ) : Integer;
+begin
+  Result := -1;
+  if ( f_tabIdx <> Nil )
+    then Result := f_tabIdx( obj, PChar( name ) );
+end;
+
+function TSvdb.CountCols( obj : Pointer; tabid, sel : Integer ) : Integer;
+begin
+  Result := 0;
+  if ( f_countCols <> Nil )
+    then Result := f_countCols( obj, tabid, sel );
+end;
+
+function TSvdb.ColName( obj : Pointer; tabid, sel, colid : Integer ) : String;
+var p : PChar;
+begin
+  Result := '';
+  if ( f_colName <> Nil )
+    then begin
+    p := f_colName( obj, tabid, sel, colid );
+    if ( p <> Nil )
+      then Result := String( p );
+    end;
+end;
+
+function TSvdb.ColIdx( obj : Pointer; tabid, sel : Integer; name : String ) : Integer;
+begin
+  Result := -1;
+  if ( f_colIdx <> Nil )
+    then Result := f_colIdx( obj, tabid, sel, PChar( name ) );
+end;
+
+function TSvdb.SetColVisible( obj : Pointer; tabid, sel, colid, visible : Integer ) : Integer;
+begin
+  Result := -1;
+  if ( f_colVisible <> Nil )
+    then Result := f_colVisible( obj, tabid, sel, colid, visible );
+end;
+
+function TSvdb.DefTypeIdx( obj : Pointer; tabid, sel, colid : Integer ) : Integer;
+begin
+  Result := -1;
+  if ( f_defTypeIdx <> Nil )
+    then Result := f_defTypeIdx( obj, tabid, sel, colid );
+end;
+
+function TSvdb.CountTypes( obj : Pointer; tabid, sel, colid : Integer ) : Integer;
+begin
+  Result := -1;
+  if ( f_countTypes <> Nil )
+    then Result := f_countTypes( obj, tabid, sel, colid );
+end;
+
+function TSvdb.TypeName( obj : Pointer; tabid, sel, colid, typeid : Integer ) : String;
+var p : PChar;
+begin
+  Result := '';
+  if ( f_typeName <> Nil )
+    then begin
+    p := f_typeName( obj, tabid, sel, colid, typeid );
+    if ( p <> Nil )
+      then Result := String( p );
+    end;
+end;
+
+function TSvdb.TypeIdx( obj : Pointer; tabid, sel, colid : Integer; name : String ) : Integer;
+begin
+  Result := -1;
+  if ( f_typeIdx <> Nil )
+    then Result := f_typeIdx( obj, tabid, sel, colid, PChar( name ) );
+end;
+
+function TSvdb.TypeDomain( obj : Pointer; tabid, sel, colid, typeid : Integer ) : Integer;
+begin
+  Result := -1;
+  if ( f_typeDomain <> Nil )
+    then Result := f_typeDomain( obj, tabid, sel, colid, typeid );
+end;
+
+function TSvdb.TypeBits( obj : Pointer; tabid, sel, colid, typeid : Integer ) : Integer;
+begin
+  Result := -1;
+  if ( f_typeBits <> Nil )
+    then Result := f_typeBits( obj, tabid, sel, colid, typeid );
+end;
+
+function TSvdb.TypeDim( obj : Pointer; tabid, sel, colid, typeid : Integer ) : Integer;
+begin
+  Result := -1;
+  if ( f_typeDim <> Nil )
+    then Result := f_typeDim( obj, tabid, sel, colid, typeid );
+end;
+
+function TSvdb.OpenTable( obj : Pointer; tabid : Integer; defline : String ) : Integer;
+begin
+  Result := -1;
+  if ( f_openTab <> Nil )
+    then Result := f_openTab( obj, tabid, PChar( defline ) );
+end;
+
+function TSvdb.MaxColnameLen( obj : Pointer; tabid, sel : Integer ) : Integer;
+begin
+  Result := -1;
+  if ( f_maxColNameLen <> Nil )
+    then Result := f_maxColNameLen( obj, tabid, sel );
+end;
+
+procedure TSvdb.SetElemSep( obj : Pointer; tabid, sel, colid : Integer; sep : String );
+begin
+  if ( f_setElemSep <> Nil )
+    then f_setElemSep( obj, tabid, sel, colid, PChar( sep ) );
+end;
+
+procedure TSvdb.SetDimSep( obj : Pointer; tabid, sel, colid : Integer; sep : String );
+begin
+  if ( f_setDimSep <> Nil )
+    then f_setDimSep( obj, tabid, sel, colid, PChar( sep ) );
+end;
+
+function TSvdb.IsColEnabled( obj : Pointer; tabid, sel, colid : Integer ) : boolean;
+begin
+  Result := false;
+  if ( f_isColEnabled <> Nil )
+    then Result := ( f_isColEnabled( obj, tabid, sel, colid ) <> 0 );
+end;
+
+function TSvdb.RowRange( obj : Pointer; tabid : Integer ) : Int64;
+begin
+  Result := 0;
+  if ( f_getRowRange <> Nil )
+    then Result := f_getRowRange( obj, tabid );
+end;
+
+function TSvdb.FirstRow( obj : Pointer; tabid : Integer ) : Int64;
+begin
+  Result := 0;
+  if ( f_getFirstRow <> Nil )
+    then Result := f_getFirstRow( obj, tabid );
+end;
+
+function TSvdb.GetCellN( obj : Pointer; tabid, sel, colid, size : Integer;
+                         row : Int64; var needed : Integer ) : String;
+var p : PChar;
+begin
+  Result := '';
+  needed := size;
+  p := StrAlloc( size );
+  if ( p <> Nil )
+    then begin
+    needed := f_getCell( obj, p, size, tabid, sel, colid, row );
+    Result := String( p );
+    StrDispose( p );
+    end;
+end;
+
+
+function TSvdb.GetCell( obj : Pointer; tabid, sel, colid : Integer;
+                        row : Int64 ) : String;
+var bufsize, needed : Integer;
+    p : PChar;
+begin
+  Result := '';
+  bufsize := 250;
+  needed := bufsize;
+  if ( f_getCell <> Nil )
+    then begin
+    p := StrAlloc( bufsize );
+    if ( p <> Nil )
+      then begin
+      needed := f_getCell( obj, p, bufsize, tabid, sel, colid, row );
+      if ( needed >= bufsize )
+        then begin
+        StrDispose( p );
+        p := StrAlloc( needed + 1 );
+        if ( p <> Nil )
+          then f_getCell( obj, p, needed + 1, tabid, sel, colid, row );
+        end;
+      end;
+    if ( p <> Nil )
+      then begin
+      Result := String( p );
+      StrDispose( p );
+      end;
+    end;
+end;
+
+function TSvdb.FindFwd( obj : Pointer; tabid, sel, colid : Integer;
+                        row : Int64; chunk : Integer; pattern : String ) : Int64;
+begin
+  Result := -1;
+  if ( f_findFwd <> Nil )
+    then Result := f_findFwd( obj, tabid, sel, colid, row, chunk, PChar( pattern ) );
+end;
+
+function TSvdb.FindBwd( obj : Pointer; tabid, sel, colid : Integer;
+                        row : Int64; chunk : Integer; pattern : String ) : Int64;
+begin
+  Result := -1;
+  if ( f_findBwd <> Nil )
+    then Result := f_findBwd( obj, tabid, sel, colid, row, chunk, PChar( pattern ) );
+end;
+
+function TSvdb.MetaRoot( obj : Pointer; tabid : Integer ) : Integer;
+begin
+  Result := -1;
+  if ( f_metaRoot <> Nil )
+    then Result := f_metaRoot( obj, tabid );
+end;
+
+
+function TSvdb.MetaNameN( obj : Pointer; tabid, metaid, size : Integer ) : String;
+var p : PChar;
+    written : Integer;
+begin
+  Result := '';
+  p := StrAlloc( size );
+  if ( p <> Nil )
+    then begin
+    written := f_metaName( obj, tabid, metaid, p, size );
+    if ( written < ( size - 1 ) )
+      then Result := String( p );
+    StrDispose( p );
+    end;
+end;
+
+
+function TSvdb.MetaName( obj: Pointer ; tabid, metaid : Integer ) : String;
+var size : Integer;
+begin
+  Result := '';
+  size := 512;
+  if ( f_metaName <> Nil )
+    then while ( ( Length( Result ) = 0 )and( size < 128000 ) )
+      do begin
+      size := size + size;
+      Result := MetaNameN( obj, tabid, metaid, size );
+      end;
+end;
+
+function TSvdb.MetaValueLen( obj : Pointer;
+                             tabid, metaid : Integer ) : Integer;
+begin
+  Result := -1;
+  if ( f_metaValueLen <> Nil )
+    then Result := f_metaValueLen( obj, tabid, metaid );
+end;
+
+function TSvdb.MetaValuePrintable( obj : Pointer;
+                                   tabid, metaid : Integer ) : boolean;
+begin
+  Result := false;
+  if ( f_metaValuePrintable <> Nil )
+    then Result := ( f_metaValuePrintable( obj, tabid, metaid ) <> 0 );
+end;
+
+function TSvdb.MetaValuePtr( obj : Pointer; tabid, metaid : Integer ) : Pointer;
+begin
+  Result := Nil;
+  if ( f_metaValuePtr <> Nil )
+    then Result := f_metaValuePtr( obj, tabid, metaid );
+end;
+
+function TSvdb.MetaValueN( obj : Pointer; tabid, metaid, size, trim : Integer ) : String;
+var p : PChar;
+    written : Integer;
+begin
+  Result := '';
+  p := StrAlloc( size );
+  if ( p <> Nil )
+    then begin
+    written := f_metaValue( obj, tabid, metaid, p, size, trim );
+    if ( written < ( size - 1 ) )
+      then Result := String( p );
+    StrDispose( p );
+    end;
+end;
+
+function TSvdb.MetaValue( obj : Pointer; tabid, metaid, trim : Integer ) : String;
+var size : Integer;
+begin
+  Result := '';
+  size := 512;
+  if ( f_metaValue <> Nil )
+    then while ( ( Length( Result ) = 0 )and( size < 128000 ) )
+      do begin
+      size := size + size;
+      Result := MetaValueN( obj, tabid, metaid, size, trim );
+      end;
+end;
+
+function TSvdb.MetaChildCount( obj : Pointer;
+                               tabid, metaid : Integer ) : Integer;
+begin
+  Result := -1;
+  if ( f_metaChildCount <> Nil )
+    then Result := f_metaChildCount( obj, tabid, metaid );
+end;
+
+function TSvdb.MetaChildId( obj : Pointer;
+                            tabid, metaid, childid : Integer ) : Integer;
+begin
+  Result := -1;
+  if ( f_metaChildId <> Nil )
+    then Result := f_metaChildId( obj, tabid, metaid, childid );
+
+end;
+
+
+function TSvdb.connect( dll_name: String ) : boolean;
+begin
+  f_mylib  := LoadLibrary( dll_name );
+  Result := ( f_mylib <> NilHandle );
+  if ( Result )
+    then begin
+    f_acc2path   := TAcc2Path( GetProcedureAddress( f_mylib, 'svdb_accession_2_path' ) );
+    f_openpath   := TOpenPath( GetProcedureAddress( f_mylib, 'svdb_open_path' ) );
+    f_lasterr    := TLastErr( GetProcedureAddress( f_mylib, 'svdb_last_err' ) );
+    f_close      := TClose( GetProcedureAddress( f_mylib, 'svdb_close' ) );
+    f_isdb       := TIsDb( GetProcedureAddress( f_mylib, 'svdb_is_db' ) );
+    f_countTabs  := TCountTabs( GetProcedureAddress( f_mylib, 'svdb_count_tabs' ) );
+    f_tabName    := TTabName( GetProcedureAddress( f_mylib, 'svdb_tabname' ) );
+    f_tabIdx     := TTabIdx( GetProcedureAddress( f_mylib, 'svdb_tab_idx' ) );
+    f_countCols  := TCountCols( GetProcedureAddress( f_mylib, 'svdb_count_cols' ) );
+    f_colName    := TColName( GetProcedureAddress( f_mylib, 'svdb_colname' ) );
+    f_colIdx     := TColIdx( GetProcedureAddress( f_mylib, 'svdb_col_idx' ) );
+    f_colVisible := TColVisibility( GetProcedureAddress( f_mylib, 'svdb_set_column_visibility' ) );
+    f_defTypeIdx := TDefTypeIdx( GetProcedureAddress( f_mylib, 'svdb_dflt_type_idx' ) );
+    f_countTypes := TCountTypes( GetProcedureAddress( f_mylib, 'svdb_count_types' ) );
+    f_typeName   := TTypeName( GetProcedureAddress( f_mylib, 'svdb_typename' ) );
+    f_typeIdx    := TTypeIdx( GetProcedureAddress( f_mylib, 'svdb_type_idx' ) );
+    f_typeDomain := TTypeDomain( GetProcedureAddress( f_mylib, 'svdb_typedomain' ) );
+    f_typeBits   := TTypeBits( GetProcedureAddress( f_mylib, 'svdb_typebits' ) );
+    f_typeDim    := TTypeDim( GetProcedureAddress( f_mylib, 'svdb_typedim' ) );
+
+    f_openTab       := TOpenTable( GetProcedureAddress( f_mylib, 'svdb_open_table' ) );
+    f_maxColNameLen := TMaxColnameLen( GetProcedureAddress( f_mylib, 'svdb_max_colname_length' ) );
+    f_setElemSep    := TSetElemSep( GetProcedureAddress( f_mylib, 'svdb_set_elem_separator' ) );
+    f_setDimSep     := TSetDimSep( GetProcedureAddress( f_mylib, 'svdb_set_dim_separator' ) );
+    f_isColEnabled  := TIsColEnabled( GetProcedureAddress( f_mylib, 'svdb_is_enabled' ) );
+    f_getRowRange   := TGetRowRange( GetProcedureAddress( f_mylib, 'svdb_row_range' ) );
+    f_getFirstRow   := TGetFirstRow( GetProcedureAddress( f_mylib, 'svdb_first_row' ) );
+    f_getCell       := TGetCell( GetProcedureAddress( f_mylib, 'svdb_cell' ) );
+    f_findFwd       := TFindFwd( GetProcedureAddress( f_mylib, 'svdb_find_fwd' ) );
+    f_findBwd       := TFindBwd( GetProcedureAddress( f_mylib, 'svdb_find_bwd' ) );
+
+    f_metaRoot     := TMetaRoot( GetProcedureAddress( f_mylib, 'svdb_tab_meta_root' ) );
+    f_metaName     := TMetaName( GetProcedureAddress( f_mylib, 'svdb_tab_meta_name' ) );
+    f_metaValueLen := TMetaValueLen( GetProcedureAddress( f_mylib, 'svdb_tab_meta_value_len' ) );
+    f_metaValuePrintable := TMetaValuePrintable( GetProcedureAddress( f_mylib, 'svdb_tab_meta_value_printable' ) );
+    f_metaValuePtr := TMetaValuePtr( GetProcedureAddress( f_mylib, 'svdb_tab_meta_value_ptr' ) );
+    f_metaValue    := TMetaValue( GetProcedureAddress( f_mylib, 'svdb_tab_meta_value' ) );
+    f_metaChildCount := TMetaChildCount( GetProcedureAddress( f_mylib, 'svdb_tab_meta_child_count' ) );
+    f_metaChildId  := TMetaChildId( GetProcedureAddress( f_mylib, 'svdb_tab_meta_child_id' ) );
+
+    end;
+end;
+
+procedure TSvdb.disconnect;
+begin
+  if ( f_mylib <> NilHandle )
+    then begin
+    FreeLibrary( f_mylib );
+    clear;
+    end;
+end;
+
+procedure TSvdb.clear;
+begin
+  f_mylib := NilHandle;
+
+  f_acc2path   := Nil;
+  f_openpath   := Nil;
+  f_lasterr    := Nil;
+  f_close      := Nil;
+  f_isdb       := Nil;
+  f_countTabs  := Nil;
+  f_tabName    := Nil;
+  f_tabIdx     := Nil;
+  f_countCols  := Nil;
+  f_colName    := Nil;
+  f_colIdx     := Nil;
+  f_colVisible := Nil;
+  f_defTypeIdx := Nil;
+  f_countTypes := Nil;
+  f_typeName   := Nil;
+  f_typeIdx    := Nil;
+  f_typeDomain := Nil;
+  f_typeBits   := Nil;
+  f_typeDim    := Nil;
+
+  f_openTab       := Nil;
+  f_maxColNameLen := Nil;
+  f_setElemSep    := Nil;
+  f_setDimSep     := Nil;
+  f_isColEnabled  := Nil;
+  f_getRowRange   := Nil;
+  f_getFirstRow   := Nil;
+  f_getCell       := Nil;
+  f_findFwd       := Nil;
+  f_findBwd       := Nil;
+
+  f_metaRoot     := Nil;
+  f_metaName     := Nil;
+  f_metaValueLen := Nil;
+  f_metaValuePrintable := Nil;
+  f_metaValuePtr := Nil;
+  f_metaValue    := Nil;
+  f_metaChildCount := Nil;
+  f_metaChildId  := Nil;
+
+end;
+
+end.
+
diff --git a/tools/vdbview/svdb_obj.pas b/tools/vdbview/svdb_obj.pas
new file mode 100644
index 0000000..e6b77e2
--- /dev/null
+++ b/tools/vdbview/svdb_obj.pas
@@ -0,0 +1,339 @@
+unit svdb_obj;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  Classes, SysUtils, selector_types, svdb;
+
+type
+
+  { TSvdb_obj }
+
+  TSvdb_obj = class
+  private
+    { private declarations }
+    f_svdb : TSvdb;
+    f_obj  : Pointer;
+
+  public
+    { public declarations }
+    constructor Create;
+    destructor Destroy; override;
+
+    function Acc2Path( acc : String ) : String;
+    function OpenPath( path : String ) : boolean;
+    procedure Close;
+    function IsDb : boolean;
+    function CountTabs : Integer;
+    function TabName( tabid : Integer ) : String;
+    function TabIdx( name : String ) : Integer;
+    function CountCols( tabid, sel : Integer ) : Integer;
+    function ColName( tabid, sel, colid : Integer ) : String;
+    function ColIdx( tabid, sel : Integer; name : String ) : Integer;
+    function SetColVisible( tabid, sel, colid, visible : Integer ) : Integer;
+    function DefTypeIdx( tabid, sel, colid : Integer ) : Integer;
+    function CountTypes( tabid, sel, colid : Integer ) : Integer;
+    function TypeName( tabid, sel, colid, typeid : Integer ) : String;
+    function TypeIdx( tabid, sel, colid : Integer; name : String ) : Integer;
+    function TypeDomain( tabid, sel, colid, typeid : Integer ) : Integer;
+    function TypeBits( tabid, sel, colid, typeid : Integer ) : Integer;
+    function TypeDim( tabid, sel, colid, typeid : Integer ) : Integer;
+
+    function OpenTable( tabid : Integer; defline : String ) : Integer;
+    function MaxColnameLen( tabid, sel : Integer ) : Integer;
+    procedure SetElemSep( tabid, sel, colid : Integer; sep : String );
+    procedure SetDimSep( tabid, sel, colid : Integer; sep : String );
+    function IsColEnabled( tabid, sel, colid : Integer ) : boolean;
+    function RowRange( tabid : Integer ) : Int64;
+    function FirstRow( tabid : Integer ) : Int64;
+    function GetCell( tabid, sel, colid : Integer; row : Int64 ) : String;
+    function FindFwd( tabid, sel, colid : Integer;
+                      row : Int64; chunk : Integer; pattern : String ): Int64;
+    function FindBwd( tabid, sel, colid : Integer;
+                      row : Int64; chunk : Integer; pattern : String ): Int64;
+
+    function MetaRoot( tabid : Integer ) : Integer;
+    function MetaName( tabid, metaid : Integer ) : String;
+    function MetaValueLen( tabid, metaid : Integer ) : Integer;
+    function MetaValuePrintable( tabid, metaid : Integer ) : boolean;
+    function MetaValuePtr( tabid, metaid : Integer ) : Pointer;
+    function MetaValue( tabid, metaid, trim : Integer ) : String;
+    function MetaChildCount( tabid, metaid : Integer ) : Integer;
+    function MetaChildId( tabid, metaid, childid : Integer ) : Integer;
+
+  end;
+
+
+implementation
+
+{ TSvdb_obj }
+
+constructor TSvdb_obj.Create;
+begin
+  inherited Create;
+  f_svdb := TSvdb.Create;
+  f_obj  := Nil;
+end;
+
+destructor TSvdb_obj.Destroy;
+begin
+  f_svdb.Free;
+  inherited Destroy;
+end;
+
+function TSvdb_obj.Acc2Path( acc : String ) : String;
+begin
+  Result := f_svdb.Acc2Path( acc );
+end;
+
+function TSvdb_obj.OpenPath( path : String ) : boolean;
+begin
+  Close;
+  f_obj := f_svdb.OpenPath( path );
+  Result := ( f_obj <> Nil );
+end;
+
+procedure TSvdb_obj.Close;
+begin
+  if ( f_obj <> Nil )
+    then begin
+    f_svdb.Close( f_obj );
+    f_obj := Nil;
+    end;
+end;
+
+function TSvdb_obj.IsDb : boolean;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.IsDb( f_obj )
+    else Result := false;
+end;
+
+function TSvdb_obj.CountTabs : Integer;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.CountTabs( f_obj )
+    else Result := 0;
+end;
+
+function TSvdb_obj.TabName( tabid : Integer ) : String;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.TabName( f_obj, tabid )
+    else Result := '';
+end;
+
+function TSvdb_obj.TabIdx( name : String ) : Integer;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.TabIdx( f_obj, name )
+    else Result := -1;
+end;
+
+function TSvdb_obj.CountCols( tabid, sel : Integer ) : Integer;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.CountCols( f_obj, tabid, sel )
+    else Result := 0;
+end;
+
+function TSvdb_obj.ColName( tabid, sel, colid : Integer ) : String;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.ColName( f_obj, tabid, sel, colid )
+    else Result := '';
+end;
+
+function TSvdb_obj.ColIdx( tabid, sel : Integer; name : String ) : Integer;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.ColIdx( f_obj, tabid, sel, name )
+    else Result := -1;
+end;
+
+function TSvdb_obj.SetColVisible( tabid, sel, colid, visible : Integer ) : Integer;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.SetColVisible( f_obj, tabid, sel, colid, visible )
+    else Result := 0;
+end;
+
+function TSvdb_obj.DefTypeIdx( tabid, sel, colid : Integer ) : Integer;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.DefTypeIdx( f_obj, tabid, sel, colid )
+    else Result := 0;
+end;
+
+function TSvdb_obj.CountTypes( tabid, sel, colid : Integer ) : Integer;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.CountTypes( f_obj, tabid, sel, colid )
+    else Result := 0;
+end;
+
+function TSvdb_obj.TypeName( tabid, sel, colid, typeid : Integer ) : String;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.TypeName( f_obj, tabid, sel, colid, typeid )
+    else Result := '';
+end;
+
+function TSvdb_obj.TypeIdx( tabid, sel, colid : Integer; name : String ) : Integer;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.TypeIdx( f_obj, tabid, sel, colid, name )
+    else Result := -1;
+end;
+
+function TSvdb_obj.TypeDomain( tabid, sel, colid, typeid : Integer ) : Integer;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.TypeDomain( f_obj, tabid, sel, colid, typeid )
+    else Result := 0;
+end;
+
+function TSvdb_obj.TypeBits( tabid, sel, colid, typeid : Integer ) : Integer;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.TypeBits( f_obj, tabid, sel, colid, typeid )
+    else Result := 0;
+end;
+
+function TSvdb_obj.TypeDim( tabid, sel, colid, typeid : Integer ) : Integer;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.TypeDim( f_obj, tabid, sel, colid, typeid )
+    else Result := 0;
+end;
+
+function TSvdb_obj.OpenTable( tabid : Integer; defline : String ) : Integer;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.OpenTable( f_obj, tabid, defline )
+    else Result := 0;
+end;
+
+function TSvdb_obj.MaxColnameLen( tabid, sel : Integer ) : Integer;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.MaxColnameLen( f_obj, tabid, sel )
+    else Result := 0;
+end;
+
+procedure TSvdb_obj.SetElemSep( tabid, sel, colid : Integer; sep : String);
+begin
+  if ( f_obj <> Nil )
+    then f_svdb.SetElemSep( f_obj, tabid, sel, colid, sep );
+end;
+
+procedure TSvdb_obj.SetDimSep( tabid, sel, colid : Integer; sep : String );
+begin
+  if ( f_obj <> Nil )
+    then f_svdb.SetDimSep( f_obj, tabid, sel, colid, sep );
+end;
+
+function TSvdb_obj.IsColEnabled( tabid, sel, colid : Integer ) : boolean;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.IsColEnabled( f_obj, tabid, sel, colid )
+    else Result := false;
+end;
+
+function TSvdb_obj.RowRange( tabid : Integer ) : Int64;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.RowRange( f_obj, tabid )
+    else Result := 0;
+end;
+
+function TSvdb_obj.FirstRow( tabid : Integer ) : Int64;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.FirstRow( f_obj, tabid )
+    else Result := 0;
+end;
+
+function TSvdb_obj.GetCell( tabid, sel, colid : Integer; row : Int64 ) : String;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.GetCell( f_obj, tabid, sel, colid, row )
+    else Result := '';
+end;
+
+function TSvdb_obj.FindFwd( tabid, sel, colid : Integer; row : Int64;
+                            chunk : Integer; pattern : String ) : Int64;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.FindFwd( f_obj, tabid, sel, colid, row, chunk, pattern )
+    else Result := -1;
+end;
+
+function TSvdb_obj.FindBwd( tabid, sel, colid : Integer; row : Int64;
+                            chunk : Integer; pattern : String ) : Int64;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.FindBwd( f_obj, tabid, sel, colid, row, chunk, pattern )
+    else Result := -1;
+end;
+
+function TSvdb_obj.MetaRoot( tabid : Integer ) : Integer;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.MetaRoot( f_obj, tabid )
+    else Result := -1;
+end;
+
+function TSvdb_obj.MetaName( tabid, metaid : Integer ) : String;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.MetaName( f_obj, tabid, metaid )
+    else Result := '';
+end;
+
+function TSvdb_obj.MetaValueLen( tabid, metaid : Integer ) : Integer;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.MetaValueLen( f_obj, tabid, metaid )
+    else Result := -1;
+end;
+
+function TSvdb_obj.MetaValuePrintable( tabid, metaid : Integer ) : boolean;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.MetaValuePrintable( f_obj, tabid, metaid )
+    else Result := false;
+end;
+
+function TSvdb_obj.MetaValuePtr( tabid, metaid : Integer ) : Pointer;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.MetaValuePtr( f_obj, tabid, metaid )
+    else Result := Nil;
+end;
+
+function TSvdb_obj.MetaValue( tabid, metaid, trim : Integer ) : String;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.MetaValue( f_obj, tabid, metaid, trim )
+    else Result := '';
+end;
+
+function TSvdb_obj.MetaChildCount( tabid, metaid : Integer ) : Integer;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.MetaChildCount( f_obj, tabid, metaid )
+    else Result := -1;
+end;
+
+function TSvdb_obj.MetaChildId( tabid, metaid, childid : Integer ) : Integer;
+begin
+  if ( f_obj <> Nil )
+    then Result := f_svdb.MetaChildId( f_obj, tabid, metaid, childid )
+    else Result := -1;
+end;
+
+end.
+
diff --git a/tools/vdbview/vdbview.ico b/tools/vdbview/vdbview.ico
new file mode 100644
index 0000000..a2338d4
Binary files /dev/null and b/tools/vdbview/vdbview.ico differ
diff --git a/tools/vdbview/vdbview.lpi b/tools/vdbview/vdbview.lpi
new file mode 100644
index 0000000..6da3012
--- /dev/null
+++ b/tools/vdbview/vdbview.lpi
@@ -0,0 +1,343 @@
+<?xml version="1.0"?>
+<CONFIG>
+  <ProjectOptions>
+    <Version Value="9"/>
+    <PathDelim Value="\"/>
+    <General>
+      <MainUnit Value="0"/>
+      <UseAppBundle Value="False"/>
+      <ResourceType Value="res"/>
+      <UseXPManifest Value="True"/>
+      <Icon Value="0"/>
+      <ActiveWindowIndexAtStart Value="0"/>
+    </General>
+    <i18n>
+      <EnableI18N LFM="False"/>
+    </i18n>
+    <VersionInfo>
+      <StringTable ProductVersion=""/>
+    </VersionInfo>
+    <BuildModes Count="1" Active="Default">
+      <Item1 Name="Default" Default="True"/>
+    </BuildModes>
+    <PublishOptions>
+      <Version Value="2"/>
+      <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
+      <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
+    </PublishOptions>
+    <RunParams>
+      <local>
+        <FormatVersion Value="1"/>
+      </local>
+    </RunParams>
+    <RequiredPackages Count="4">
+      <Item1>
+        <PackageName Value="FCL"/>
+        <MinVersion Major="1" Valid="True"/>
+      </Item1>
+      <Item2>
+        <PackageName Value="IDEIntf"/>
+        <MinVersion Major="1" Valid="True"/>
+      </Item2>
+      <Item3>
+        <PackageName Value="LazControls"/>
+        <MinVersion Valid="True"/>
+      </Item3>
+      <Item4>
+        <PackageName Value="LCL"/>
+      </Item4>
+    </RequiredPackages>
+    <Units Count="25">
+      <Unit0>
+        <Filename Value="vdbview.lpr"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="vdbview"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="1"/>
+        <CursorPos X="46" Y="10"/>
+        <UsageCount Value="202"/>
+      </Unit0>
+      <Unit1>
+        <Filename Value="mainwindow.pas"/>
+        <IsPartOfProject Value="True"/>
+        <ComponentName Value="Mainform"/>
+        <ResourceBaseClass Value="Form"/>
+        <UnitName Value="MainWindow"/>
+        <IsVisibleTab Value="True"/>
+        <EditorIndex Value="0"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="1"/>
+        <CursorPos X="38" Y="11"/>
+        <UsageCount Value="202"/>
+        <Bookmarks Count="1">
+          <Item0 X="5" Y="630" ID="0"/>
+        </Bookmarks>
+        <Loaded Value="True"/>
+        <LoadedDesigner Value="True"/>
+      </Unit1>
+      <Unit2>
+        <Filename Value="support_unit.pas"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="support_unit"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="116"/>
+        <CursorPos X="36" Y="135"/>
+        <UsageCount Value="202"/>
+      </Unit2>
+      <Unit3>
+        <Filename Value="C:\Apps\User_Installs\lazarus\lcl\grids.pas"/>
+        <UnitName Value="Grids"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="3020"/>
+        <CursorPos X="1" Y="3048"/>
+        <UsageCount Value="1"/>
+      </Unit3>
+      <Unit4>
+        <Filename Value="background.pas"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="background"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="153"/>
+        <CursorPos X="1" Y="187"/>
+        <UsageCount Value="201"/>
+      </Unit4>
+      <Unit5>
+        <Filename Value="dataproxy.pas"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="DataProxy"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="517"/>
+        <CursorPos X="3" Y="520"/>
+        <UsageCount Value="201"/>
+      </Unit5>
+      <Unit6>
+        <Filename Value="linkedlist.pas"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="linkedlist"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="52"/>
+        <CursorPos X="3" Y="53"/>
+        <UsageCount Value="201"/>
+      </Unit6>
+      <Unit7>
+        <Filename Value="svdb_obj.pas"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="svdb_obj"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="250"/>
+        <CursorPos X="31" Y="262"/>
+        <UsageCount Value="201"/>
+      </Unit7>
+      <Unit8>
+        <Filename Value="svdb.pas"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="svdb"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="408"/>
+        <CursorPos X="1" Y="447"/>
+        <UsageCount Value="201"/>
+      </Unit8>
+      <Unit9>
+        <Filename Value="selector_types.pas"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="selector_types"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="1"/>
+        <CursorPos X="6" Y="13"/>
+        <UsageCount Value="206"/>
+      </Unit9>
+      <Unit10>
+        <Filename Value="jobdef.pas"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="jobdef"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="1"/>
+        <CursorPos X="49" Y="13"/>
+        <UsageCount Value="202"/>
+      </Unit10>
+      <Unit11>
+        <Filename Value="columnsel.pas"/>
+        <IsPartOfProject Value="True"/>
+        <ComponentName Value="Columnform"/>
+        <ResourceBaseClass Value="Form"/>
+        <UnitName Value="ColumnSel"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="59"/>
+        <CursorPos X="28" Y="93"/>
+        <UsageCount Value="132"/>
+      </Unit11>
+      <Unit12>
+        <Filename Value="C:\Apps\User_Installs\lazarus\fpc\2.4.2\source\rtl\objpas\classes\classesh.inc"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="663"/>
+        <CursorPos X="15" Y="691"/>
+        <UsageCount Value="16"/>
+      </Unit12>
+      <Unit13>
+        <Filename Value="C:\Apps\User_Installs\lazarus\fpc\2.4.2\source\rtl\objpas\classes\stringl.inc"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="1145"/>
+        <CursorPos X="3" Y="1148"/>
+        <UsageCount Value="10"/>
+      </Unit13>
+      <Unit14>
+        <Filename Value="C:\Apps\User_Installs\lazarus\lcl\forms.pp"/>
+        <UnitName Value="Forms"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="1380"/>
+        <CursorPos X="3" Y="1174"/>
+        <UsageCount Value="10"/>
+      </Unit14>
+      <Unit15>
+        <Filename Value="C:\Apps\User_Installs\lazarus\lcl\checklst.pas"/>
+        <UnitName Value="CheckLst"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="57"/>
+        <CursorPos X="3" Y="85"/>
+        <UsageCount Value="2"/>
+      </Unit15>
+      <Unit16>
+        <Filename Value="C:\Apps\User_Installs\lazarus\lcl\actnlist.pas"/>
+        <UnitName Value="ActnList"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="175"/>
+        <CursorPos X="14" Y="203"/>
+        <UsageCount Value="3"/>
+      </Unit16>
+      <Unit17>
+        <Filename Value="gotoform.pas"/>
+        <IsPartOfProject Value="True"/>
+        <ComponentName Value="GotoForm"/>
+        <ResourceBaseClass Value="Form"/>
+        <UnitName Value="gotoform"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="1"/>
+        <CursorPos X="1" Y="20"/>
+        <UsageCount Value="116"/>
+      </Unit17>
+      <Unit18>
+        <Filename Value="C:\Apps\User_Installs\lazarus\fpc\2.4.2\source\rtl\objpas\sysutils\sysstrh.inc"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="92"/>
+        <CursorPos X="66" Y="125"/>
+        <UsageCount Value="3"/>
+      </Unit18>
+      <Unit19>
+        <Filename Value="C:\Apps\User_Installs\lazarus\lcl\include\customform.inc"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="344"/>
+        <CursorPos X="1" Y="372"/>
+        <UsageCount Value="3"/>
+      </Unit19>
+      <Unit20>
+        <Filename Value="C:\Apps\User_Installs\lazarus\lcl\dialogs.pp"/>
+        <UnitName Value="Dialogs"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="480"/>
+        <CursorPos X="11" Y="508"/>
+        <UsageCount Value="10"/>
+      </Unit20>
+      <Unit21>
+        <Filename Value="searchform.pas"/>
+        <IsPartOfProject Value="True"/>
+        <ComponentName Value="SForm"/>
+        <ResourceBaseClass Value="Form"/>
+        <UnitName Value="searchform"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="23"/>
+        <CursorPos X="23" Y="55"/>
+        <UsageCount Value="75"/>
+      </Unit21>
+      <Unit22>
+        <Filename Value="C:\Apps\User_Installs\lazarus\lcl\menus.pp"/>
+        <UnitName Value="Menus"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="90"/>
+        <CursorPos X="3" Y="118"/>
+        <UsageCount Value="8"/>
+      </Unit22>
+      <Unit23>
+        <Filename Value="C:\Apps\User_Installs\lazarus\lcl\graphics.pp"/>
+        <UnitName Value="Graphics"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="1111"/>
+        <CursorPos X="15" Y="1139"/>
+        <UsageCount Value="16"/>
+      </Unit23>
+      <Unit24>
+        <Filename Value="version.pas"/>
+        <IsPartOfProject Value="True"/>
+        <ComponentName Value="VersionForm"/>
+        <ResourceBaseClass Value="Form"/>
+        <UnitName Value="version"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="1"/>
+        <CursorPos X="3" Y="26"/>
+        <UsageCount Value="20"/>
+      </Unit24>
+    </Units>
+    <JumpHistory Count="6" HistoryIndex="5">
+      <Position1>
+        <Filename Value="mainwindow.pas"/>
+        <Caret Line="613" Column="3" TopLine="562"/>
+      </Position1>
+      <Position2>
+        <Filename Value="mainwindow.pas"/>
+        <Caret Line="598" Column="45" TopLine="566"/>
+      </Position2>
+      <Position3>
+        <Filename Value="mainwindow.pas"/>
+        <Caret Line="611" Column="45" TopLine="583"/>
+      </Position3>
+      <Position4>
+        <Filename Value="mainwindow.pas"/>
+        <Caret Line="618" Column="45" TopLine="590"/>
+      </Position4>
+      <Position5>
+        <Filename Value="mainwindow.pas"/>
+        <Caret Line="577" Column="1" TopLine="575"/>
+      </Position5>
+      <Position6>
+        <Filename Value="mainwindow.pas"/>
+        <Caret Line="11" Column="38" TopLine="1"/>
+      </Position6>
+    </JumpHistory>
+  </ProjectOptions>
+  <CompilerOptions>
+    <Version Value="9"/>
+    <PathDelim Value="\"/>
+    <Target>
+      <Filename Value="vdbview"/>
+    </Target>
+    <SearchPaths>
+      <IncludeFiles Value="$(ProjOutDir)"/>
+      <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
+    </SearchPaths>
+    <Linking>
+      <Options>
+        <Win32>
+          <GraphicApplication Value="True"/>
+        </Win32>
+      </Options>
+    </Linking>
+    <Other>
+      <CompilerMessages>
+        <UseMsgFile Value="True"/>
+      </CompilerMessages>
+      <CompilerPath Value="$(CompPath)"/>
+    </Other>
+  </CompilerOptions>
+  <Debugging>
+    <Exceptions Count="3">
+      <Item1>
+        <Name Value="EAbort"/>
+      </Item1>
+      <Item2>
+        <Name Value="ECodetoolError"/>
+      </Item2>
+      <Item3>
+        <Name Value="EFOpenError"/>
+      </Item3>
+    </Exceptions>
+  </Debugging>
+</CONFIG>
diff --git a/tools/vdbview/vdbview.lpr b/tools/vdbview/vdbview.lpr
new file mode 100644
index 0000000..74c7f79
--- /dev/null
+++ b/tools/vdbview/vdbview.lpr
@@ -0,0 +1,24 @@
+program vdbview;
+
+{$mode objfpc}{$H+}
+
+uses
+  {$IFDEF UNIX}{$IFDEF UseCThreads}
+  cthreads,
+  {$ENDIF}{$ENDIF}
+  Interfaces, // this includes the LCL widgetset
+  Forms, lazcontrols, MainWindow, ColumnSel, gotoform, searchform, version
+  { you can add units after this };
+
+{$R *.res}
+
+begin
+  Application.Initialize;
+  Application.CreateForm(TMainform, Mainform);
+  Application.CreateForm(TColumnform, Columnform);
+  Application.CreateForm(TGotoForm, MyGotoForm);
+  Application.CreateForm(TSForm, SForm);
+  Application.CreateForm(TVersionForm, VersionForm);
+  Application.Run;
+end.
+
diff --git a/tools/vdbview/vdbview.res b/tools/vdbview/vdbview.res
new file mode 100644
index 0000000..4b8fabf
Binary files /dev/null and b/tools/vdbview/vdbview.res differ
diff --git a/tools/vdbview/vdbview1.ico b/tools/vdbview/vdbview1.ico
new file mode 100644
index 0000000..a2338d4
Binary files /dev/null and b/tools/vdbview/vdbview1.ico differ
diff --git a/tools/vdbview/version.lfm b/tools/vdbview/version.lfm
new file mode 100644
index 0000000..dae1b99
--- /dev/null
+++ b/tools/vdbview/version.lfm
@@ -0,0 +1,40 @@
+object VersionForm: TVersionForm
+  Left = 498
+  Height = 215
+  Top = 345
+  Width = 346
+  BorderStyle = bsDialog
+  Caption = 'version...'
+  ClientHeight = 215
+  ClientWidth = 346
+  LCLVersion = '0.9.30'
+  object Panel1: TPanel
+    Left = 0
+    Height = 50
+    Top = 165
+    Width = 346
+    Align = alBottom
+    ClientHeight = 50
+    ClientWidth = 346
+    TabOrder = 0
+    object BitBtn1: TBitBtn
+      Left = 216
+      Height = 30
+      Top = 11
+      Width = 122
+      Caption = '&OK'
+      Default = True
+      Kind = bkOK
+      ModalResult = 1
+      TabOrder = 0
+    end
+  end
+  object StaticText1: TStaticText
+    Left = 8
+    Height = 144
+    Top = 8
+    Width = 329
+    Caption = 'Version 1.0.3'#13#10'December29, 2011'
+    TabOrder = 1
+  end
+end
diff --git a/tools/vdbview/version.pas b/tools/vdbview/version.pas
new file mode 100644
index 0000000..f819c49
--- /dev/null
+++ b/tools/vdbview/version.pas
@@ -0,0 +1,33 @@
+unit version;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
+  Buttons, StdCtrls;
+
+type
+
+  { TVersionForm }
+
+  TVersionForm = class(TForm)
+    BitBtn1: TBitBtn;
+    Panel1: TPanel;
+    StaticText1: TStaticText;
+  private
+    { private declarations }
+  public
+    { public declarations }
+  end; 
+
+var
+  VersionForm: TVersionForm;
+
+implementation
+
+{$R *.lfm}
+
+end.
+
diff --git a/tools/vtblcp/Makefile b/tools/vtblcp/Makefile
new file mode 100644
index 0000000..024d9cc
--- /dev/null
+++ b/tools/vtblcp/Makefile
@@ -0,0 +1,97 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: std
+
+TOP ?= $(abspath ../..)
+MODULE = tools/vtblcp
+
+include $(TOP)/build/Makefile.env
+
+INT_TOOLS =
+
+EXT_TOOLS = \
+	vtblcp
+
+ALL_TOOLS = \
+	$(INT_TOOLS) \
+	$(EXT_TOOLS)
+
+#-------------------------------------------------------------------------------
+# outer targets
+#
+all std: vers-includes
+	@ $(MAKE_CMD) $(TARGDIR)/std
+
+$(ALL_TOOLS): vers-includes
+	@ $(MAKE_CMD) $(BINDIR)/$@
+
+.PHONY: all std $(ALL_TOOLS)
+
+#-------------------------------------------------------------------------------
+# std
+#
+$(TARGDIR)/std: \
+	$(addprefix $(BINDIR)/,$(ALL_TOOLS))
+
+.PHONY: $(TARGDIR)/std
+
+#-------------------------------------------------------------------------------
+# vers-includes
+#
+$(TARGDIR)/vers-includes: $(addsuffix .vers.h,$(EXT_TOOLS))
+
+.PHONY: $(TARGDIR)/vers-includes
+
+#-------------------------------------------------------------------------------
+# clean
+#
+clean: stdclean
+
+.PHONY: clean
+
+#-------------------------------------------------------------------------------
+# vtblcp
+#  vdb table copy tool
+#
+VTBLCP_SRC = \
+	vtblcp
+
+VTBLCP_OBJ = \
+	$(addsuffix .$(OBJX),$(VTBLCP_SRC))
+
+VTBLCP_LIB = \
+	-swvdb \
+	-swkdb \
+	-skapp \
+	-skfs \
+	-sklib
+
+vtblcp.vers.h: vtblcp.vers
+	$(TOP)/build/make-vers-inc.sh VTBLCP_VERS $^ > $@
+
+$(BINDIR)/vtblcp: $(VTBLCP_OBJ)
+	$(LD) --exe --vers $(SRCDIR) -o $@ $^ $(VTBLCP_LIB)
+
diff --git a/tools/vtblcp/vtblcp-priv.h b/tools/vtblcp/vtblcp-priv.h
new file mode 100644
index 0000000..b8e413b
--- /dev/null
+++ b/tools/vtblcp/vtblcp-priv.h
@@ -0,0 +1,40 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_vtblcp_priv_
+#define _h_vtblcp_priv_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _h_vtblcp_priv_ */
diff --git a/tools/vtblcp/vtblcp.c b/tools/vtblcp/vtblcp.c
new file mode 100644
index 0000000..a96771b
--- /dev/null
+++ b/tools/vtblcp/vtblcp.c
@@ -0,0 +1,979 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "vtblcp.vers.h"
+#include "vtblcp-priv.h"
+
+#include <vdb/manager.h>
+#include <vdb/schema.h>
+#include <vdb/table.h>
+#include <vdb/cursor.h>
+#include <kapp/main.h>
+#include <klib/container.h>
+#include <klib/vector.h>
+#include <klib/log.h>
+#include <klib/rc.h>
+#include <fmtdef.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+
+/* param block
+ */
+typedef struct vtblcp_parms vtblcp_parms;
+struct vtblcp_parms
+{
+    /* manager params, e.g. global schema, library include paths */
+
+    /* schema params, e.g. include paths, source file */
+    const char *schema_src;
+
+    /* source table params */
+    const char *src_path;
+
+    /* destination table params */
+    const char *dst_type;
+    const char *dst_path;
+
+    /* column list */
+    const char **columns;
+    uint32_t column_cnt;
+
+    /* options */
+    bool redact_sensitive;
+};
+
+/* column map
+ *  the write cursor determines which columns get copied
+ *  the read cursor should have a similar structure
+ *  each cursor will have its own column indices
+ *  this structure allows a simple ordinal mapping of the pairs
+ */
+typedef struct vtblcp_column_map vtblcp_column_map;
+struct vtblcp_column_map
+{
+    const void *redact_value;
+    uint32_t wr, rd;
+    bool sensitive;
+    bool rd_filter;
+    uint8_t align [ 2 ];
+};
+
+
+static
+rc_t copy_row ( const vtblcp_parms *pb, VCursor *dcurs, const VCursor *scurs,
+    const vtblcp_column_map *cm, uint32_t count, uint32_t rdfilt_idx, int64_t row )
+{
+    rc_t rc = VCursorOpenRow ( scurs );
+    if ( rc != 0 )
+        PLOGERR ( klogErr,  (klogErr, rc, "failed to open source row '$(row)'", "row=%" LD64, row ));
+    else
+    {
+        rc_t rc2;
+        rc = VCursorOpenRow ( dcurs );
+        if ( rc != 0 )
+            PLOGERR ( klogErr,  (klogErr, rc, "failed to open destination row '$(row)'", "row=%" LD64, row ));
+        else
+        {
+            uint32_t i;
+            const void *base;
+            uint32_t elem_bits, boff, row_len;
+
+            bool redact = false;
+            if ( rdfilt_idx != 0 && pb -> redact_sensitive )
+            {
+                rc = VCursorCellData ( scurs, rdfilt_idx,
+                    & elem_bits, & base, & boff, & row_len );
+                if ( rc != 0 )
+                {
+                    PLOGERR ( klogErr,  (klogErr, rc, "failed to read cell data for read filter, row '$(row)'",
+                                         "row=%" LD64, row ));
+                }
+                else
+                {
+                    const uint8_t *rd_filter = base;
+                    for ( i = 0; i < row_len; ++ i )
+                    {
+                        if ( rd_filter [ i ] == 3 )
+                        {
+                            redact = pb -> redact_sensitive;
+                            break;
+                        }
+                    }
+                }
+            }
+
+            for ( i = 0; i < count && rc != 0; ++ i )
+            {
+                /* get column data */
+                rc = VCursorCellData ( scurs, cm [ i ] . rd,
+                    & elem_bits, & base, & boff, & row_len );
+                if ( rc != 0 )
+                {
+                    PLOGERR ( klogErr,  (klogErr, rc, "failed to read cell data for column '$(idx)', row '$(row)'",
+                                         "idx=%u,row=%" LD64, i, row ));
+                    break;
+                }
+
+                if ( redact && cm [ i ] . sensitive )
+                {
+                    uint32_t j;
+
+                    /* substitute base pointer with redact value */
+                    base = cm [ i ] . redact_value;
+
+                    /* redact destination */
+                    for ( j = 0; j < row_len; ++ j )
+                    {
+                        rc = VCursorWrite ( dcurs, cm [ i ] . wr, elem_bits, base, 0, 1 );
+                        if ( rc != 0 )
+                        {
+                            PLOGERR ( klogErr,  (klogErr, rc, "failed to redact cell data for column '$(idx)', row '$(row)'",
+                                                 "idx=%u,row=%" LD64, i, row ));
+                            break;
+                        }
+                    }
+                }
+                else
+                {
+                    /* write to destination */
+                    rc = VCursorWrite ( dcurs, cm [ i ] . wr, elem_bits, base, boff, row_len );
+                    if ( rc != 0 )
+                    {
+                        PLOGERR ( klogErr,  (klogErr, rc, "failed to write cell data for column '$(idx)', row '$(row)'",
+                                             "idx=%u,row=%" LD64, i, row ));
+                        break;
+                    }
+                }
+            }
+
+            /* commit row */
+            if ( rc == 0 )
+                rc = VCursorCommitRow ( dcurs );
+
+            rc2 = VCursorCloseRow ( dcurs );
+            if ( rc == 0 )
+                rc = rc2;
+        }
+
+        rc2 = VCursorCloseRow ( scurs );
+        if ( rc == 0 )
+            rc = rc2;
+    }
+
+    return rc;
+}
+
+
+static
+rc_t copy_table ( const vtblcp_parms *pb, VCursor *dcurs, const VCursor *scurs,
+    const vtblcp_column_map *cm, uint32_t count, uint32_t rdfilt_idx )
+{
+    /* open source */
+    rc_t rc = VCursorOpen ( scurs );
+    if ( rc != 0 )
+        LOGERR ( klogErr, rc, "failed to open source cursor" );
+    else
+    {
+        /* get row range */
+        int64_t row, last;
+        uint64_t range_count;
+        
+        rc = VCursorIdRange ( scurs, 0, & row, & range_count );
+        last = row + range_count;
+        if ( rc != 0 )
+            LOGERR ( klogInt, rc, "failed to determine row range for source cursor" );
+        else
+        {
+            /* open desination cursor */
+            rc = VCursorOpen ( dcurs );
+            if ( rc != 0 )
+                LOGERR ( klogErr, rc, "failed to open destination cursor" );
+            else
+            {
+                /* focus destination on initial source row */
+                rc = VCursorSetRowId ( dcurs, row );
+                if ( rc != 0 )
+                    PLOGERR ( klogErr,  (klogErr, rc, "failed to set destination cursor row to id '$(row)'", "row=%" LD64, row ));
+                else
+                {
+                    /* copy each row */
+                    for ( ; row <= last; ++ row )
+                    {
+                        rc = copy_row ( pb, dcurs, scurs, cm, count, rdfilt_idx, row );
+                        if ( rc != 0 )
+                            break;
+                    }
+
+                    /* commit changes */
+                    if ( rc == 0 )
+                        rc = VCursorCommit ( dcurs );
+                }
+            }
+        }
+    }
+
+    return rc;
+}
+
+typedef struct stype_id stype_id;
+struct stype_id
+{
+    BSTNode n;
+    const void *redact_value;
+    uint32_t type_id;
+    uint32_t elem_size;
+};
+
+
+static
+void CC stype_id_whack ( BSTNode *n, void *ignore )
+{
+    free ( n );
+}
+
+static
+int CC stype_id_cmp ( const void *item, const BSTNode *n )
+{
+    const VTypedecl *a = item;
+    const stype_id *b = ( const stype_id* ) n;
+
+    if ( a -> type_id < b -> type_id )
+        return -1;
+    return a -> type_id > b -> type_id;
+}
+
+static
+int CC stype_id_sort ( const BSTNode *item, const BSTNode *n )
+{
+    const stype_id *a = ( const stype_id* ) item;
+    const stype_id *b = ( const stype_id* ) n;
+
+    if ( a -> type_id < b -> type_id )
+        return -1;
+    return a -> type_id > b -> type_id;
+}
+
+static
+rc_t mark_type_sensitivity ( const BSTree *stype_tbl, const VSchema *schema,
+    const VTypedecl *td, vtblcp_column_map *cm )
+{
+    const stype_id *node;
+
+    /* simple case - look for exact matches */
+    if ( BSTreeFind ( stype_tbl, td, stype_id_cmp ) != NULL )
+    {
+        cm -> sensitive = true;
+        return 0;
+    }
+
+    /* exhaustive case - perform one by one ancestry test */
+    for ( node = ( const stype_id* ) BSTreeFirst ( stype_tbl );
+          node != NULL;
+          node = ( const stype_id* ) BSTNodeNext ( & node -> n ) )
+    {
+        cm -> redact_value = NULL;
+        if ( td -> type_id > node -> type_id )
+        {
+            VTypedecl cast;
+
+            /* test for our type being a subtype */
+            if ( VTypedeclToType ( td, schema, node -> type_id, & cast, NULL ) )
+            {
+                cm -> redact_value = node -> redact_value;
+                cm -> sensitive = true;
+                return 0;
+            }
+        }
+    }
+
+    /* doesn't appear to be sensitive */
+    cm -> sensitive = false;
+    return 0;
+}
+
+static
+rc_t populate_stype_tbl ( BSTree *stype_tbl, const VSchema *schema )
+{
+    rc_t rc;
+    uint32_t i;
+    static struct
+    {
+        const char *typename;
+        const char *redact_value;
+    } sensitive_types [] =
+    {
+        /* original SRA types */
+        { "INSDC:fasta", "N" },
+        { "INSDC:csfasta", "." },
+        { "NCBI:2na", "\x00" },
+        { "NCBI:2cs", "\x00" },
+        { "NCBI:4na", "\xFF" },
+        { "NCBI:qual1", "\x00" },
+        { "NCBI:qual4", "\xFB\xFB\xFB\xFB" },
+        { "NCBI:isamp1", "\x00\x00\x00" },
+        { "NCBI:isamp4", "\x00\x00\x00" },
+        { "NCBI:fsamp1", "\x00\x00\x00" },
+        { "NCBI:fsamp4", "\x00\x00\x00" },
+        { "INSDC:dna:text", "N" },
+        { "INSDC:dna:bin", "\x04" },
+        { "INSDC:dna:4na", "\xFF" },
+        { "INSDC:dna:2na", "\x00" },
+        { "INSDC:color:text", "." },
+        { "INSDC:color:bin", "\x04" },
+        { "INSDC:color:2cs", "\x00" },
+        { "INSDC:quality:phred", "\x00" },
+        { "INSDC:quality:log_odds", "\x00\x00\x00" }
+        /* signal types TBD */
+    };
+
+    BSTreeInit ( stype_tbl );
+
+    for ( rc = 0, i = 0; i < sizeof sensitive_types / sizeof sensitive_types [ 0 ]; ++ i )
+    {
+        VTypedecl td;
+        const char *decl = sensitive_types [ i ] . typename;
+        rc = VSchemaResolveTypedecl ( schema, & td, "%s", decl );
+        if ( rc == 0 )
+        {
+            stype_id *n;
+            BSTNode *exist;
+
+            VTypedesc desc;
+            rc = VSchemaDescribeTypedecl ( schema, & desc, & td );
+            if ( rc != 0 )
+            {
+                PLOGERR ( klogInt,  (klogInt, rc, "failed to describe type '$(type)'", "type=%s", decl ));
+                break;
+            }
+
+            n = malloc ( sizeof * n );
+            if ( n == NULL )
+            {
+                rc = RC ( rcExe, rcNode, rcAllocating, rcMemory, rcExhausted );
+                LOGERR ( klogInt, rc, "failed to record sensitive data type" );
+                break;
+            }
+
+            n -> redact_value = sensitive_types [ i ] . redact_value;
+            n -> type_id = td . type_id;
+            n -> elem_size = VTypedescSizeof ( & desc );
+
+            rc = BSTreeInsertUnique ( stype_tbl, & n -> n, & exist, stype_id_sort );
+            if ( rc != 0 )
+            {
+                free ( n );
+                if ( GetRCState ( rc ) != rcExists )
+                {
+                    LOGERR ( klogInt, rc, "failed to record sensitive data type" );
+                    break;
+                }
+                rc = 0;
+            }
+        }
+        else if ( GetRCState ( rc ) == rcNotFound )
+        {
+            rc = 0;
+        }
+        else
+        {
+            break;
+        }
+    }
+
+    return rc;
+}
+
+static
+rc_t populate_rdfilt_tbl ( BSTree *rftype_tbl, const VSchema *schema )
+{
+    rc_t rc;
+    uint32_t i;
+    const char *rftypes [] =
+    {
+        "NCBI:SRA:read_filter",
+        "INSDC:SRA:read_filter"
+    };
+
+    BSTreeInit ( rftype_tbl );
+
+    for ( rc = 0, i = 0; i < sizeof rftypes / sizeof rftypes [ 0 ]; ++ i )
+    {
+        VTypedecl td;
+        const char *decl = rftypes [ i ];
+        rc = VSchemaResolveTypedecl ( schema, & td, "%s", decl );
+        if ( rc == 0 )
+        {
+            BSTNode *exist;
+
+            stype_id *n = malloc ( sizeof * n );
+            if ( n == NULL )
+            {
+                rc = RC ( rcExe, rcNode, rcAllocating, rcMemory, rcExhausted );
+                LOGERR ( klogInt, rc, "failed to record read_filter data type" );
+                break;
+            }
+
+            n -> redact_value = NULL;
+            n -> type_id = td . type_id;
+            n -> elem_size = 8;
+
+            rc = BSTreeInsertUnique ( rftype_tbl, & n -> n, & exist, stype_id_sort );
+            if ( rc != 0 )
+            {
+                free ( n );
+                if ( GetRCState ( rc ) != rcExists )
+                {
+                    LOGERR ( klogInt, rc, "failed to record read_filter data type" );
+                    break;
+                }
+                rc = 0;
+            }
+        }
+        else if ( GetRCState ( rc ) == rcNotFound )
+        {
+            rc = 0;
+        }
+        else
+        {
+            break;
+        }
+    }
+
+    return rc;
+}
+
+
+static
+rc_t populate_cursors ( VTable *dtbl, VCursor *dcurs, const VCursor *scurs,
+    vtblcp_column_map *cm, const Vector *v, uint32_t *rd_filt )
+{
+    uint32_t end = VectorLength ( v );
+    uint32_t i = VectorStart ( v );
+
+    BSTree stype_tbl, rftype_tbl;
+
+    const VSchema *schema;
+    rc_t rc = VTableOpenSchema ( dtbl, & schema );
+    if ( rc != 0 )
+    {
+        LOGERR ( klogInt, rc, "failed to open destination table schema" );
+        return rc;
+    }
+
+    /* populate sensitive type table */
+    rc = populate_stype_tbl ( & stype_tbl, schema );
+    if ( rc != 0 )
+    {
+        VSchemaRelease ( schema );
+        return rc;
+    }
+
+    /* populate read filter type table */
+    rc = populate_rdfilt_tbl ( & rftype_tbl, schema );
+    if ( rc != 0 )
+    {
+        BSTreeWhack ( & stype_tbl, stype_id_whack, NULL );
+        VSchemaRelease ( schema );
+        return rc;
+    }
+
+    for ( end += i, rc = 0, * rd_filt = 0; i < end; ++ i )
+    {
+        VTypedecl td;
+        char typedecl [ 128 ];
+
+        const char *spec = ( const void* ) VectorGet ( v, i );
+
+        /* request column in destination */
+        rc = VCursorAddColumn ( dcurs, & cm [ i ] . wr, "%s", spec );
+        if ( rc != 0 )
+        {
+            PLOGERR ( klogErr,  (klogErr, rc, "failed to add '$(spec)' to destination cursor", "spec=%s", spec ));
+            break;
+        }
+
+        /* always retrieve data type */
+        rc = VCursorDatatype ( dcurs, cm [ i ] . wr, & td, NULL );
+        if ( rc != 0 )
+        {
+            PLOGERR ( klogInt,  (klogInt, rc, "failed to determine datatype of destination column '$(name)'", "name=%s", spec ));
+            break;
+        }
+
+        /* mark column as sensitive or not */
+        rc = mark_type_sensitivity ( & stype_tbl, schema, & td, & cm [ i ] );
+        if ( rc != 0 )
+            break;
+
+        /* if spec is already typed, request it in source */
+        if ( spec [ 0 ] == '(' )
+        {
+            rc = VCursorAddColumn ( scurs, & cm [ i ] . rd, "%s", spec );
+            if ( rc != 0 )
+            {
+                PLOGERR ( klogErr,  (klogErr, rc, "failed to add '$(spec)' to source cursor", "spec=%s", spec ));
+                break;
+            }
+        }
+        else
+        {
+            rc = VTypedeclToText ( & td, schema, typedecl, sizeof typedecl );
+            if ( rc != 0 )
+            {
+                PLOGERR ( klogInt,  (klogInt, rc, "failed to print datatype of destination column '$(name)'", "name=%s", spec ));
+                break;
+            }
+
+            rc = VCursorAddColumn ( scurs, & cm [ i ] . rd, "(%s)%s", typedecl, spec );
+            if ( rc != 0 )
+            {
+                PLOGERR ( klogErr,  (klogErr, rc, "failed to add '$(spec)' to source cursor", "spec=(%s)%s", typedecl, spec ));
+                break;
+            }
+        }
+
+        /* check if column is a read filter */
+        cm [ i ] . rd_filter = false;
+        if ( ! cm [ i ] . sensitive )
+        {
+            if ( BSTreeFind ( & rftype_tbl, & td, stype_id_cmp ) != NULL )
+            {
+                if ( * rd_filt != 0 )
+                {
+                    rc = RC ( rcExe, rcColumn, rcOpening, rcColumn, rcExists );
+                    PLOGERR ( klogInt,  (klogInt, rc, "can't use column '$(name)' as read filter", "name=%s", spec ));
+                    break;
+                }
+
+                * rd_filt = cm [ i ] . rd;
+                cm [ i ] . rd_filter = true;
+            }
+        }
+    }
+
+    BSTreeWhack ( & rftype_tbl, stype_id_whack, NULL );
+    BSTreeWhack ( & stype_tbl, stype_id_whack, NULL );
+    VSchemaRelease ( schema );
+
+    /* add read filter to input if not already there in some way */
+    if ( * rd_filt == 0 )
+    {
+        rc = VCursorAddColumn ( scurs, rd_filt, "RD_FILTER" );
+        if ( rc != 0 && GetRCState ( rc ) == rcNotFound )
+            rc = 0;
+    }
+
+    return rc;
+}
+
+
+/* NOTES
+
+   1. default schema from code
+      a. discovered by VDBManager upon "Make" ? look for "libsraschema.so"
+      b. discovered by client?
+      c. explicitly added when making "empty" schema?
+
+   2. need support for discovering all openable columns
+      a. declaration in schema for creating a table from another,
+         or actually from some set of base tables
+
+   3. need support for indicating/discovering native columns
+      a. this is related in some way to knowing whether the vcolumn
+         represents a kcolumn, and so is not likely to be a manually
+         indicated property of the vcolumn, especially with subclasses.
+
+*/
+
+/* vtblcp
+ */
+static
+rc_t vtblcp ( const vtblcp_parms *pb, const VTable *stbl, VTable *dtbl, const Vector *v )
+{
+    const VCursor *scurs;
+    rc_t rc = VTableCreateCursorRead ( stbl, & scurs );
+    if ( rc != 0 )
+        LOGERR ( klogInt, rc, "failed to create empty destination cursor" );
+    else
+    {
+        VCursor *dcurs;
+        rc = VTableCreateCursorWrite ( dtbl, & dcurs, kcmInsert );
+        if ( rc != 0 )
+            LOGERR ( klogInt, rc, "failed to create empty destination cursor" );
+        else
+        {
+            uint32_t count = VectorLength ( v );
+            vtblcp_column_map *cm = malloc ( sizeof *cm * count );
+            if ( cm == NULL )
+            {
+                rc = RC ( rcExe, rcVector, rcAllocating, rcMemory, rcExhausted );
+                LOGERR ( klogInt, rc, "failed to create column index map" );
+            }
+            else
+            {
+                uint32_t rd_filt;
+                rc = populate_cursors ( dtbl, dcurs, scurs, cm, v, & rd_filt );
+
+                if ( rc == 0 )
+                    rc = copy_table ( pb, dcurs, scurs, cm, count, rd_filt );
+
+                free ( cm );
+            }
+
+            VCursorRelease ( dcurs );
+        }
+            
+        VCursorRelease ( scurs );
+    }
+
+    return rc;
+}
+
+
+/* get_column_specs
+ */
+static
+void CC free_column_spec ( void *elem, void *ignore )
+{
+    free ( elem );
+}
+
+static
+rc_t get_column_specs ( const vtblcp_parms *pb, Vector *v, const VTable *stbl, VTable *dtbl )
+{
+    rc_t rc;
+    
+    /* always prepare the vector */
+    VectorInit ( v, 0, pb -> column_cnt );
+
+    /* unable at this moment to auto-determine column list */
+    if ( pb -> column_cnt == 0 )
+    {
+        rc = RC ( rcExe, rcSchema, rcEvaluating, rcFunction, rcUnsupported );
+        LOGERR ( klogInt, rc, "failed to determine column specs" );
+    }
+    else
+    {
+        uint32_t i;
+
+        /* process command line arguments */
+        for ( rc = 0, i = 0; i < pb -> column_cnt; ++ i )
+        {
+            const char *src = pb -> columns [ i ];
+
+            char *dst = malloc ( strlen ( src ) + 2 );
+            if ( dst == NULL )
+            {
+                rc = RC ( rcExe, rcString, rcAllocating, rcMemory, rcExhausted );
+                break;
+            }
+
+            strcpy ( dst, src );
+
+            rc = VectorAppend ( v, NULL, dst );
+            if ( rc != 0 )
+            {
+                free ( dst );
+                break;
+            }
+        }
+
+        /* failure */
+        if ( rc != 0 )
+            VectorWhack ( v, free_column_spec, NULL );
+    }
+
+    return rc;
+}
+
+
+/* close_table
+ */
+static
+rc_t close_dst_table ( const vtblcp_parms *pb, VTable *tbl, rc_t entry_rc )
+{
+    rc_t rc;
+
+    /* perform "re-indexing" on columns
+       this will go away soon once cursor sessions are supported */
+    if ( entry_rc == 0 )
+        entry_rc = VTableReindex ( tbl );
+
+    /* close the table */
+    rc = VTableRelease ( tbl );
+
+    /* return most important return code */
+    return entry_rc ? entry_rc : rc;
+}
+
+/* open_table
+ */
+static
+rc_t open_src_table ( const vtblcp_parms *pb,
+    const VDBManager *mgr, const VSchema *schema, const VTable **tblp )
+{
+    return VDBManagerOpenTableRead ( mgr, tblp, schema, "%s", pb -> src_path );
+}
+
+static
+rc_t open_dst_table ( const vtblcp_parms *pb,
+    VDBManager *mgr, const VSchema *schema, VTable **tblp )
+{
+    return VDBManagerCreateTable ( mgr, tblp, schema,
+                                   pb -> dst_type, kcmInit, "%s", pb -> dst_path );
+}
+
+
+/* init_schema
+ */
+static
+rc_t init_schema ( const vtblcp_parms *pb,
+    const VDBManager *mgr, VSchema **schemap )
+{
+    VSchema *schema;
+    rc_t rc = VDBManagerMakeSchema ( mgr, & schema );
+    if ( rc != 0 )
+        LOGERR ( klogInt, rc, "failed to create empty schema" );
+    else
+    {
+        /* parse schema file */
+        rc = VSchemaParseFile ( schema, "%s", pb -> schema_src );
+        if ( rc != 0 )
+            PLOGERR ( klogErr,  (klogErr, rc, "failed to parse schema file '$(file)'", "file=%s", pb -> schema_src ));
+        else
+        {
+            * schemap = schema;
+            return 0;
+        }
+
+        VSchemaRelease ( schema );
+    }
+
+    return rc;
+}
+
+
+/* init_mgr
+ */
+static
+rc_t init_mgr ( const vtblcp_parms *pb, VDBManager **mgrp )
+{
+    VDBManager *mgr;
+    rc_t rc = VDBManagerMakeUpdate ( & mgr, NULL );
+    if ( rc != 0 )
+        LOGERR ( klogInt, rc, "failed to open vdb library" );
+    else
+    {
+        /* currently have no manager parameters */
+        * mgrp = mgr;
+    }
+
+    return rc;
+}
+
+
+/* run
+ */
+static
+rc_t run ( const vtblcp_parms *pb )
+{
+    VDBManager *mgr;
+    rc_t rc = init_mgr ( pb, & mgr );
+    if ( rc == 0 )
+    {
+        VSchema *schema;
+        rc = init_schema ( pb, mgr, & schema );
+        if ( rc == 0 )
+        {
+            const VTable *stbl;
+            rc = open_src_table ( pb, mgr, schema, & stbl );
+            if ( rc == 0 )
+            {
+                VTable *dtbl;
+                rc = open_dst_table ( pb, mgr, schema, & dtbl );
+                if ( rc == 0 )
+                {
+                    /* determine columns */
+                    Vector v;
+                    rc = get_column_specs ( pb, & v, stbl, dtbl );
+
+                    /* perform the copy */
+                    if ( rc == 0 )
+                    {
+                        rc = vtblcp ( pb, stbl, dtbl, & v );
+                        VectorWhack ( & v, free_column_spec, NULL );
+                    }
+
+                    /* cleanup */
+                    rc = close_dst_table ( pb, dtbl, rc );
+                }
+
+                VTableRelease ( stbl );
+            }
+
+            VSchemaRelease ( schema );
+        }
+
+        VDBManagerRelease ( mgr );
+    }
+
+    return rc;
+}
+
+
+/* Version
+ */
+ver_t CC KAppVersion ( void )
+{
+    return VTBLCP_VERS;
+}
+
+/* Usage
+ */
+static
+void s_Usage ( const char *app_name )
+{
+    printf ( "\n"
+             "Usage: %s [ options ] src-table dst-table [ column-spec ... ]\n"
+             "\n%s%s"
+             "    options:\n"
+             "      -h                     give tool help\n"
+             "      -K <path>              schema file for output\n"
+             "      -T <table-name-expr>   fully qualified table name expression for output table\n"
+             "\n"
+             "    column-spec:\n"
+             "      NAME                   simple column name\n"
+             "      (typedecl)NAME         specifically typed column name\n"
+             "\n",
+             app_name,
+             "    copy data from one table to another. default behavior is to use\n"
+             "    schema from source table to create copy. if a new schema is to be\n"
+             "    used, its identifier must be given with the '-T' option.\n"
+             "\n"
+             "    the '-K' option allows external schema definitions to be loaded.\n"
+             "\n",
+             "    the list of columns to copy may be given on the command line as\n"
+             "    white-space separated arguments. the syntax used differs from VDB proper\n"
+             "    in order to ease quoting.\n"
+             "\n"
+             "    if no columns are given the intent is to automatically derive them\n"
+             "    from schema - NOT YET IMPLEMENTED.\n"
+             "\n"
+        );
+}
+
+static
+void MiniUsage ( const char *app_name )
+{
+    printf ( "\n"
+             "Usage: %s [ options ] src-table dst-table\n"
+             "    run with option '-h' for help\n"
+             , app_name
+        );
+}
+    
+
+/* KMain
+ */
+rc_t CC KMain ( int argc, char *argv [] )
+{
+    int i;
+    rc_t rc;
+
+    /* expect paths and schema types */
+    vtblcp_parms pb;
+    memset ( & pb, 0, sizeof pb );
+    pb . columns = ( const char** ) & argv [ 1 ];
+
+    /* parse arguments */
+    for ( rc = 0, i = 1; i < argc; ++ i )
+    {
+        const char *arg = argv [ i ];
+        if ( arg [ 0 ] != '-' )
+        {
+            if ( pb . src_path == NULL )
+                pb . src_path = arg;
+            else if ( pb . dst_path == NULL )
+                pb . dst_path = NULL;
+            else
+            {
+                /* capture column name/spec */
+                pb . columns [ pb . column_cnt ++ ] = arg;
+            }
+        }
+        else do switch ( ( ++ arg ) [ 0 ] )
+        {
+        case 'K':
+            pb . schema_src = NextArg ( & arg, & i, argc, argv, NULL, NULL );
+            break;
+        case 'T':
+            pb . dst_type = NextArg ( & arg, & i, argc, argv, NULL, NULL );
+            break;
+        case 'h':
+        case '?':
+            s_Usage ( argv [ 0 ] );
+            return 0;
+        default:
+            fprintf ( stderr, "unrecognized switch: '%s'\n", argv [ i ] );
+            MiniUsage ( argv [ 0 ] );
+            return RC ( rcExe, rcArgv, rcReading, rcParam, rcInvalid );
+        }
+        while ( arg [ 1 ] != 0 );
+    }
+
+    /* check arguments */
+    if ( pb . src_path == NULL )
+    {
+        fprintf ( stderr, "missing source table path\n" );
+        MiniUsage ( argv [ 0 ] );
+        return RC ( rcExe, rcArgv, rcReading, rcParam, rcNotFound );
+    }
+    if ( pb . dst_path == NULL )
+    {
+        fprintf ( stderr, "missing destination table path\n" );
+        MiniUsage ( argv [ 0 ] );
+        return RC ( rcExe, rcArgv, rcReading, rcParam, rcNotFound );
+    }
+    if ( pb . schema_src == NULL )
+    {
+        fprintf ( stderr, "missing schema source file\n" );
+        MiniUsage ( argv [ 0 ] );
+        return RC ( rcExe, rcArgv, rcReading, rcParam, rcNotFound );
+    }
+    if ( pb . dst_type == NULL )
+    {
+        fprintf ( stderr, "missing destination table type description\n" );
+        MiniUsage ( argv [ 0 ] );
+        return RC ( rcExe, rcArgv, rcReading, rcParam, rcNotFound );
+    }
+
+    /* run tool */
+    return run ( & pb );
+}
diff --git a/tools/vtblcp/vtblcp.vers b/tools/vtblcp/vtblcp.vers
new file mode 100644
index 0000000..8e8299d
--- /dev/null
+++ b/tools/vtblcp/vtblcp.vers
@@ -0,0 +1 @@
+2.4.2
diff --git a/tools/workspace/.gitignore b/tools/workspace/.gitignore
new file mode 100644
index 0000000..6fa85f1
--- /dev/null
+++ b/tools/workspace/.gitignore
@@ -0,0 +1,3 @@
+prefs-priv.[ch]
+prefs-yacc.[ch]
+*.kar
diff --git a/tools/workspace/Makefile b/tools/workspace/Makefile
new file mode 100644
index 0000000..710b4ef
--- /dev/null
+++ b/tools/workspace/Makefile
@@ -0,0 +1,125 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+default: std
+
+TOP ?= $(abspath ../..)
+MODULE = tools/workspace
+
+include $(TOP)/build/Makefile.env
+
+INT_TOOLS = \
+	path-to-kar-file
+
+EXT_TOOLS = \
+	sra
+
+ALL_TOOLS = \
+	$(INT_TOOLS) \
+	$(EXT_TOOLS)
+
+#-------------------------------------------------------------------------------
+# outer targets
+#
+all std: vers-includes
+	@ $(MAKE_CMD) $(TARGDIR)/$@
+
+$(ALL_TOOLS): vers-includes
+	@ $(MAKE_CMD) $(BINDIR)/$@
+
+.PHONY: all std $(ALL_TOOLS)
+
+#-------------------------------------------------------------------------------
+# std
+#
+$(TARGDIR)/std: \
+	$(addprefix $(BINDIR)/,$(EXT_TOOLS))
+
+.PHONY: $(TARGDIR)/std
+
+#-------------------------------------------------------------------------------
+# all
+#
+$(TARGDIR)/all: \
+	$(addprefix $(BINDIR)/,$(ALL_TOOLS))
+
+.PHONY: $(TARGDIR)/all
+
+#-------------------------------------------------------------------------------
+# vers-includes
+#
+$(TARGDIR)/vers-includes: $(addsuffix .vers.h,$(EXT_TOOLS))
+
+.PHONY: $(TARGDIR)/vers-includes
+
+#-------------------------------------------------------------------------------
+# clean
+#
+clean: stdclean
+
+.PHONY: clean
+
+#-------------------------------------------------------------------------------
+# sratoolkit
+#
+.PRECIOUS = \
+	prefs-yacc.c \
+	prefs-lex.c
+
+TOOLKIT_SRC = \
+	prefs-yacc \
+	prefs-lex \
+	sra \
+	token \
+	sratoolkit-exception \
+
+
+TOOLKIT_OBJ = \
+	$(addsuffix .$(OBJX),$(TOOLKIT_SRC))
+
+TOOLKIT_LIB = \
+	-skapp \
+	-sncbi-vdb
+
+$(BINDIR)/sra: $(TOOLKIT_OBJ)
+	$(LP) --exe --vers $(SRCDIR) -o $@ $^ $(TOOLKIT_LIB)
+
+#-------------------------------------------------------------------------------
+# testing utilities
+#
+PATH2KAR_SRC = \
+	path-to-kar-file \
+	sratoolkit-exception
+
+
+PATH2KAR_OBJ = \
+	$(addsuffix .$(OBJX),$(PATH2KAR_SRC))
+
+PATH2KAR_LIB = \
+	-skapp \
+	-sncbi-vdb
+
+$(BINDIR)/path-to-kar-file: $(PATH2KAR_OBJ)
+	$(LP) --exe --vers $(SRCDIR) -o $@ $^ $(PATH2KAR_LIB)
diff --git a/tools/workspace/path-to-kar-file.cpp b/tools/workspace/path-to-kar-file.cpp
new file mode 100644
index 0000000..17dce54
--- /dev/null
+++ b/tools/workspace/path-to-kar-file.cpp
@@ -0,0 +1,117 @@
+#include <kapp/main.h>
+#include <klib/rc.h>
+#include <vfs/manager.h>
+#include <vfs/manager-priv.h>
+#include <vfs/path.h>
+#include <kfs/directory.h>
+
+#include "sratoolkit-exception.hpp"
+
+#include <iostream>
+
+namespace sra
+{
+
+    static VFSManager *vfs;
+    static KDirectory *wd;
+
+
+    static
+    rc_t CC HandleSourceFiles ( const KDirectory *dir, uint32_t type, const char *name, void *data )
+    {
+        rc_t rc = 0;
+
+        unsigned int *indent = ( unsigned int * ) data;
+        for ( unsigned int i = 0; i < * indent; ++ i )
+            std :: cout << "  ";
+
+        switch ( type )
+        {
+        case kptFile:
+            std :: cout << "File: " << name << std :: endl;
+            break;
+        case kptDir:
+        {
+            std :: cout << "Dir: " << name << std :: endl;
+
+            unsigned int sub = * indent + 1;
+         
+            rc = KDirectoryVisit ( dir, false, HandleSourceFiles, & sub, "%s", name );
+            break;
+        }
+        case kptFile | kptAlias:
+        case kptDir | kptAlias:
+            std :: cout << "Alias: " << name << std :: endl;
+            break;
+        default:
+            return RC ( rcExe, rcNoTarg, rcValidating, rcNoObj, rcUnknown );
+        }
+        return rc;
+    }
+
+    static 
+    void run ( int argc, char *argv [] )
+    {
+        assert ( argc > 1 );
+
+        rc_t rc = VFSManagerMake ( &vfs );
+        if ( rc != 0 )
+            throw Exception ( rc, __FILE__, __LINE__, "aaah" );
+
+        rc = KDirectoryNativeDir ( &wd );
+        if ( rc != 0 )
+            throw Exception ( rc, __FILE__, __LINE__, "aaah" );
+
+        VPath *url;
+        rc = VFSManagerMakePath ( vfs, & url, "%s", argv [ 1 ] );
+        if ( rc == 0 )
+        {
+            const KDirectory *src;
+
+            rc = VFSManagerOpenDirectoryReadDirectoryRelative ( vfs, wd, &src, url );
+            if ( rc == 0 )
+            {
+                unsigned int indent = 0;
+                rc = KDirectoryVisit ( src, false, HandleSourceFiles, & indent, "." );
+
+                KDirectoryRelease ( src );
+            }
+
+            VPathRelease ( url );
+        }
+    }
+}
+
+ver_t CC KAppVersion ( void )
+{
+    return 0;
+}
+
+const char UsageDefaultName[] = "aaaah";
+
+rc_t CC UsageSummary ( const char *progname )
+{
+    return 0;
+}
+
+rc_t CC Usage ( const Args *args )
+{
+    return 0;
+}
+
+
+rc_t CC KMain ( int argc, char *argv [] )
+{
+    rc_t rc = 0;
+
+    try
+    {
+        sra :: run ( argc, argv );
+    }
+    catch ( ... )
+    {
+        rc = RC ( rcExe, rcNoTarg, rcExecuting, rcNoObj, rcUnknown );
+    }
+
+    return rc;
+}
diff --git a/tools/workspace/prefs-lex.l b/tools/workspace/prefs-lex.l
new file mode 100644
index 0000000..c06c072
--- /dev/null
+++ b/tools/workspace/prefs-lex.l
@@ -0,0 +1,181 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+%{
+    #include "token.h"
+    #include "prefs-yacc.h"
+    #include <sysalloc.h>
+
+    #define YYVAL_TYPE( code )            \
+        yylval -> t . var = code
+
+    #define YYVAL_NONE()                  \
+        YYVAL_TYPE ( val_none )
+
+    #define YY_RETURN( tok )              \
+        YYVAL_NONE ();                    \
+        return tok
+
+    #define YYVAL_RETURN( code, tok )     \
+        YYVAL_TYPE ( code );              \
+        return tok
+
+    #define YYTXT_RETURN( code, tok )     \
+        yylval -> t . val . c = yytext;   \
+        yylval -> t . len = yyleng;       \
+        YYVAL_RETURN ( code, tok )
+
+%}
+
+%option never-interactive nounistd yylineno
+
+%option prefix="prefs_yy"
+
+/* non-re-entrant scanner
+%option reentrant
+ */
+
+/* bison options */
+%option bison-bridge
+
+ /* maintain state stack */
+%option stack
+
+ /* let parser handle EOF */
+%option noyywrap
+
+ /* comment states */
+%x SLASH_STAR
+%x LINE_CMT
+
+ /* common patterns */
+year                                                            [0-9][0-9][0-9][0-9]
+month                                                           [0-9][0-9]
+day                                                             [0-9][0-9]
+date                                                            {year}-{month}-{day}
+hour                                                            [0-9][0-9]
+minute                                                          [0-9][0-9]
+second                                                          [0-9][0-9]
+time                                                            {hour}:{minute}:{second}
+zone                                                            {hour}:{minute}
+
+%%
+
+ /* multi-line comments */
+\/\*                                                            { yy_push_state ( SLASH_STAR );             }
+<SLASH_STAR>[^*\n]+                                             { /* ignore */                              }
+<SLASH_STAR>\*+[^*/\n]+                                         { /* ignore */                              }
+<SLASH_STAR>\**\n                                               { ++ yylineno;                              }
+<SLASH_STAR>\*+\/                                               { yy_pop_state ();                          }
+
+ /* line comments */
+"#"                                                             { yy_push_state ( LINE_CMT );               }
+<LINE_CMT>[^\\\n]+                                              { /* ignore */                              }
+<LINE_CMT>\\[^\r\n]                                             { /* ignore */                              }
+<LINE_CMT>\\\r[^\n]                                             { /* ignore */                              }
+<LINE_CMT>\\\r\n                                                { ++ yylineno;                              }
+<LINE_CMT>\\\n                                                  { ++ yylineno;                              }
+<LINE_CMT>\n                                                    {
+                                                                    ++ yylineno;
+                                                                    yy_pop_state ();
+                                                                    YY_RETURN ( EOLN );
+                                                                }
+
+ /* whitespace characters */
+[ \t\f\v\r]                                                     { /* ignore */                              }
+\\\r\n                                                          { ++ yylineno;                              }
+\\\n                                                            { ++ yylineno;                              }
+\n                                                              { ++ yylineno; YY_RETURN ( EOLN );          }
+
+ /* prefs members */
+"download-date"                                                 { YY_RETURN ( PD_DOWNLOAD_DATE );           }
+"last-check-date"                                               { YY_RETURN ( PD_LAST_CHECK_DATE );         }
+"latest-version"                                                { YY_RETURN ( PD_LATEST_VERS );             }
+"current-version"                                               { YY_RETURN ( PD_CURRENT_VERS );            }
+"download-url"                                                  { YY_RETURN ( PD_DOWNLOAD_URL );            }
+"latest-vers-url"                                               { YY_RETURN ( PD_LATEST_VERS_URL );         }
+"path-to-installation"                                          { YY_RETURN ( PD_PATH_TO_INSTALLATION );    }
+"auto-download-enabled"                                         { YY_RETURN ( PD_AUTO_DOWNLOAD_ENABLED );   }
+
+ /* symbolic values */
+"true"                                                          { YY_RETURN ( KW_TRUE );                    }
+"TRUE"                                                          { YY_RETURN ( KW_TRUE );                    }
+"false"                                                         { YY_RETURN ( KW_FALSE );                   }
+"FALSE"                                                         { YY_RETURN ( KW_FALSE );                   }
+
+ /* version tokens */
+[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+                                  {
+                                                                    if ( toolkit_atov ( & yylval -> t . val . v, yytext, yyleng ) )
+                                                                    { YYVAL_RETURN ( val_vers, MAJMINRELBUILD ); }
+                                                                    YYTXT_RETURN ( val_txt, OVER_VERSION );
+                                                                }
+[0-9]+\.[0-9]+\.[0-9]+                                          {
+                                                                    if ( toolkit_atov ( & yylval -> t . val . v, yytext, yyleng ) )
+                                                                    { YYVAL_RETURN ( val_vers, MAJMINREL ); }
+                                                                    YYTXT_RETURN ( val_txt, OVER_VERSION );
+                                                                }
+
+ /* real numbers or two-part versions */
+[0-9]+\.[0-9]+                                                  { YYTXT_RETURN ( val_txt, REAL );           }
+
+ /* unsigned integers or one-part versions */
+[0-9]+                                                          {
+                                                                    if ( toolkit_dtoi ( & yylval -> t . val . u, yytext, yyleng ) )
+                                                                    { YYVAL_RETURN ( val_u64, DECIMAL ); }
+                                                                    YYTXT_RETURN ( val_txt, OVER_DECIMAL );
+                                                                }
+ /* a string */
+\"[^\\"\f\r\n]*\"                                               { YYTXT_RETURN ( val_quot, STRING );        }
+\"(\\.|[^\\"\f\r\n])+\"                                         { YYTXT_RETURN ( val_esc, STRING );         }
+
+
+ /* a current date */
+{date}T{time}Z                                                  {
+                                                                    if ( toolkit_atotm ( & yylval -> t . val . t, yytext, yyleng ) )
+                                                                    { YYVAL_RETURN ( val_time, DATETIME ); }
+                                                                    YYTXT_RETURN ( val_txt, BAD_DATETIME );
+                                                                }
+{date}T{time}[+-]{zone}                                         { YYTXT_RETURN ( val_txt, TZ_DATETIME );   }
+
+ /* random punctuation */
+[-!%^&*+=|~/;:?,.@(){}<>[\]]                                    { YY_RETURN ( yytext [ 0 ] );               }
+
+
+ /* unrecognized input */
+.                                                               { YYTXT_RETURN ( val_txt, UNRECOGNIZED );   }
+
+%%
+
+rc_t PrefsInitFlex ( FILE * prefs )
+{
+    yyin = prefs;
+    return 0;
+}
+
+void PrefsDestroyFlex ( void )
+{
+    yyin = NULL;
+}
diff --git a/tools/workspace/prefs-yacc.y b/tools/workspace/prefs-yacc.y
new file mode 100644
index 0000000..47f669c
--- /dev/null
+++ b/tools/workspace/prefs-yacc.y
@@ -0,0 +1,189 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+%pure-parser
+
+%defines
+%debug
+%error-verbose
+%name-prefix="prefs_"
+
+%{
+
+    /* general prelude for auto-generated C code */
+    #include "token.h"
+    #include "prefs-priv.h"
+    #include <sysalloc.h>
+
+%}
+
+/* token and production values */
+%union
+{
+    /* token from flex */
+    Token t;
+
+    /* a boolean */
+    bool b;
+}
+
+%token < t > UNRECOGNIZED
+
+/* punctuation */
+%token < t > EOLN
+
+/* value tokens */
+%token < t > DECIMAL REAL MAJMINREL MAJMINRELBUILD DATETIME STRING
+%token < t > OVER_DECIMAL OVER_VERSION BAD_DATETIME TZ_DATETIME
+
+/* keywords */
+%token < t > KW_TRUE KW_FALSE
+%token < t > PD_DOWNLOAD_DATE PD_LAST_CHECK_DATE
+%token < t > PD_LATEST_VERS PD_CURRENT_VERS
+%token < t > PD_DOWNLOAD_URL PD_LATEST_VERS_URL
+%token < t > PD_PATH_TO_INSTALLATION
+%token < t > PD_AUTO_DOWNLOAD_ENABLED
+
+/* productions */
+%type < t > version version_value
+%type < t > timestamp
+%type < t > url
+%type < t > path
+%type < b > auto boolean
+
+%start prefs
+
+%%
+
+prefs
+    : /* empty */
+    | prefsline_seq
+    ;
+
+prefsline_seq
+    : prefsline
+    | prefsline_seq prefsline
+    ;
+
+prefsline
+    : EOLN                                                      /* ignore empty lines */
+    | PD_DOWNLOAD_DATE download_date
+    | PD_LAST_CHECK_DATE last_check_date
+    | PD_LATEST_VERS latest_version
+    | PD_CURRENT_VERS current_version
+    | PD_DOWNLOAD_URL download_url
+    | PD_LATEST_VERS_URL latest_version_url
+    | PD_PATH_TO_INSTALLATION path_to_installation
+    | PD_AUTO_DOWNLOAD_ENABLED auto_download
+    ;
+
+download_date
+    : timestamp                                                 { PrefsDataSetDownloadDate ( & $1 ); }
+    | malformed_timestamp EOLN
+    ;
+
+last_check_date
+    : timestamp                                                 { PrefsDataSetLastCheckDate ( & $1 ); }
+    | malformed_timestamp EOLN
+    ;
+
+latest_version
+    : version                                                   { PrefsDataSetLatestVersion ( & $1 ); }
+    | bad_version EOLN
+    ;
+
+current_version
+    : version                                                   { PrefsDataSetCurrentVersion ( & $1 ); }
+    | bad_version EOLN
+    ;
+
+download_url
+    : url                                                       { PrefsDataSetDownloadURL ( & $1 ); }
+    ;
+
+latest_version_url
+    : url                                                       { PrefsDataSetLatestVersionURL ( & $1 ); }
+    ;
+
+path_to_installation
+    : path                                                      { PrefsDataSetPathToInstallation ( & $1 ); }
+    ;
+
+auto_download
+    : auto                                                      { PrefsDataSetAutoDownloadEnabled ( & $1 ); }
+    ;
+
+auto
+    : boolean                                                   { $$ = $1; }
+    | '=' boolean                                               { $$ = $2; }
+    ;
+
+
+timestamp
+    : DATETIME EOLN                                             { $$ = $1; }
+    | '=' DATETIME EOLN                                         { $$ = $2; }
+    ;
+
+malformed_timestamp
+    : BAD_DATETIME                                              { prefs_token_error ( & $1, "badly formed timestamp" ); }
+    | TZ_DATETIME                                               { prefs_token_error ( & $1,  "timestamp must use GMT" ); }
+    ;
+
+version
+    : version_value EOLN                                        { $$ = $1; }
+    | '=' version_value EOLN                                    { $$ = $2; }
+    ;
+
+version_value
+    : MAJMINRELBUILD                                            { $$ = $1;                    }
+    | MAJMINREL                                                 { $$ = $1;                    }
+    | REAL                                                      { $$ = toolkit_rtov ( & $1 ); }
+    | DECIMAL                                                   { $$ = toolkit_itov ( & $1 ); }
+    ;
+
+bad_version
+    : OVER_VERSION                                              { prefs_token_error ( & $1, "version component overflow" ); }
+    ;
+
+url
+    : STRING
+    ;
+
+path
+    : STRING
+    ;
+
+boolean
+    : KW_TRUE                                                   { $$ = true;  }
+    | KW_FALSE                                                  { $$ = false; }
+    ;
+
+%%
+
+void prefs_set_debug ( int enabled )
+{
+    prefs_debug = enabled;
+}
diff --git a/tools/workspace/sra.cpp b/tools/workspace/sra.cpp
new file mode 100644
index 0000000..af6229a
--- /dev/null
+++ b/tools/workspace/sra.cpp
@@ -0,0 +1,1514 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <kapp/main.h>
+#include <kapp/args.h>
+#include <klib/text.h>
+#include <klib/out.h>
+#include <klib/log.h>
+#include <klib/rc.h>
+#include <klib/printf.h>
+#include <klib/debug.h>
+#include <klib/time.h>
+#include <klib/text.h>
+#include <klib/container.h>
+#include <klib/data-buffer.h>
+#include <kfg/config.h>
+#include <kns/manager.h>
+#include <kns/http.h>
+#include <kns/stream.h>
+#include <kfs/file.h>
+#include <kfs/directory.h>
+#include <kfs/gzip.h>
+#include <kfs/bzip.h>
+#include <kfs/defs.h>
+#include <vfs/manager.h>
+#include <vfs/manager-priv.h>
+#include <vfs/path.h>
+
+#include "prefs-priv.h"
+#include "token.h"
+#include "sra.vers.h"
+#include "sratoolkit-exception.hpp"
+
+#include <cerrno>
+#include <cstdlib>
+#include <cstring>
+#include <cstdio>
+#include <ctime>
+#include <string>
+#include <iostream>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <time.h>
+
+
+namespace sra
+{
+    struct PrefsData
+    {
+        PrefsData ();
+        ~ PrefsData ();
+
+        PrefsData & operator = ( const PrefsData & pd );
+        PrefsData ( const PrefsData & pd );
+
+        KTime_t dl_date;     // download date
+        KTime_t last_check_date; 
+        KTime_t last_check_date_interval_limit; // amount of time allowed between checks
+        ver_t l_vers;              // latest version available from NCBI
+        ver_t c_vers;              // current version on user's system
+        std :: string download_url;
+        std :: string latest_vers_url;
+        std :: string path_to_installation;
+        bool auto_download_enabled;
+    };
+
+    PrefsData :: PrefsData ()
+        : dl_date ( 0 )
+        , last_check_date ( 0 )
+        , last_check_date_interval_limit ( 7 * 24 * 60 * 60 ) // 1 week
+        , l_vers ( 0 )
+        , c_vers ( 0 )
+        , download_url ( "http://ftp-trace.ncbi.nlm.nih.gov/sra/sdk" )
+          // NB - this is currently a static file
+          // needs to be replaced with CGI
+        , latest_vers_url ( "http://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/current/sratoolkit.current.version" )
+        , auto_download_enabled ( true )
+    {
+    }
+
+    PrefsData :: ~ PrefsData ()
+    {
+    }
+
+    PrefsData & PrefsData :: operator = ( const PrefsData & pd )
+    {
+        dl_date = pd . dl_date;
+        last_check_date = pd . last_check_date;
+        last_check_date_interval_limit = pd . last_check_date_interval_limit;
+        l_vers = pd . l_vers;
+        c_vers = pd . c_vers;
+        download_url = pd . download_url;
+        latest_vers_url = pd . latest_vers_url;
+        path_to_installation = pd . path_to_installation;
+        auto_download_enabled = pd . auto_download_enabled;
+
+        return * this;
+    }
+
+    PrefsData :: PrefsData ( const PrefsData & pd )
+        : dl_date ( pd . dl_date )
+        , last_check_date ( pd . last_check_date )
+        , last_check_date_interval_limit ( pd . last_check_date_interval_limit )
+        , l_vers ( pd . l_vers )
+        , c_vers ( pd . c_vers )
+        , download_url ( pd . download_url )
+        , latest_vers_url ( pd . latest_vers_url )
+        , path_to_installation ( pd . path_to_installation )
+        , auto_download_enabled ( pd . auto_download_enabled )
+    {
+    }
+
+
+    enum WhereFound { found_by_prefs, found_by_PATH };
+
+    static PrefsData prefs_data;
+    static bool dirty;
+
+    static KTime_t current_time; // current time of running process
+    static KTime_t lower_date_limit; //dawn of time for this program
+    static std :: string prgm_name;
+    static std :: string PATH;
+    static std :: string path_to_binaries;
+    static std :: string latest_vers_string; // TBD - record this from NCBI
+    static std :: string path_to_prefs;
+    static std :: string path_to_url;
+    static KDirectory * wd;
+    static VFSManager * vfs;
+    static KNSManager * kns;
+    static KConfig * kfg;
+    static WhereFound where_found;
+    
+
+    static int g_argc;
+    static char ** g_argv;
+
+    enum SRAOption
+    {
+        opt_path_to_prefs,
+        opt_offline_mode,
+        opt_verbose,
+        opt_auto_update,
+
+        opt_unrecognized,
+        opt_no_more_args
+    }; 
+
+    struct SRAOption_Iterator
+    {
+        SRAOption_Iterator ();
+
+        int idx, num_params;
+        const char *param;
+
+        enum SRAOption next ();
+        void remove ();
+    };
+
+    SRAOption_Iterator :: SRAOption_Iterator ()
+        : idx ( 0 )
+        , num_params ( 0 )
+        , param ( "" )
+    {
+    }
+
+    enum SRAOption SRAOption_Iterator :: next ()
+    {
+        idx += num_params + 1;
+        num_params = 0;
+
+        if ( idx >= g_argc )
+            return opt_no_more_args;
+
+        static struct
+        {
+            const char *opt_name;
+            const char *alias;
+            size_t num_params;
+            const char *xtext;
+            SRAOption opt_enum;
+        }
+        formal_opts [] =
+        {
+            { "--sra-prefs", NULL, 1, "expected path to prefs", opt_path_to_prefs },
+            { "--offline-mode", NULL, 0, NULL, opt_offline_mode },
+            { "--verbose", NULL, 0, NULL, opt_verbose },
+            { "--auto-update", NULL, 1, "expected 'yes' or 'no'", opt_auto_update }
+        };
+
+        for ( uint32_t i = 0; i < sizeof formal_opts / sizeof formal_opts [ 0 ]; ++ i )
+        {
+            // "strcmp" is safe here because we know the formal_opt name
+            // is properly NUL terminated and has a known, controlled length
+            if ( strcmp ( g_argv [ idx ], formal_opts [ i ] . opt_name ) == 0 )
+            {
+                // right now we only support 0 or 1 option parameters
+                // if we ever allow > 1, the class structure needs to change
+                assert ( formal_opts [ i ] . num_params <= 1 );
+
+                // look for option parameters
+                for ( uint32_t p = 0; p < formal_opts [ i ] . num_params; ++ p )
+                {
+                    // make sure the command line has supplied the parameter
+                    if ( ++ num_params + idx == g_argc )
+                    {
+                        rc_t rc = RC ( rcExe, rcNoTarg, rcNotFound, rcPath, rcEmpty );
+                        throw Exception ( rc, __FILE__, __LINE__, formal_opts [ i ] . xtext );
+                    }
+
+                    // record the option parameter
+                    param = g_argv [ idx + num_params ];
+                }
+
+                // return the option enum
+                return formal_opts [ i ] . opt_enum;
+            }
+        }
+
+        // unrecognized option - start of sra-shell parameters
+        return opt_unrecognized;
+    }
+
+    void SRAOption_Iterator :: remove ()
+    {
+        int next_opt = idx + num_params + 1;
+        int remaining = g_argc - next_opt;
+        if ( remaining <= 0 )
+            g_argc = idx;
+        else
+        {
+            memmove ( & g_argv [ idx ], & g_argv [ next_opt ], remaining * sizeof g_argv [ 0 ] );
+            g_argc -= num_params + 1;
+        }
+
+        g_argv [ g_argc ] = NULL;
+    }
+    
+
+    static
+    void InitFactoryDefaults ( void )
+    {
+        // create managers;
+        
+        rc_t rc = VFSManagerMake ( & vfs );
+        if ( rc != 0 )
+            throw Exception ( rc, __FILE__, __LINE__, "failed to create VFS manager" );
+        
+        rc = VFSManagerGetKNSMgr ( vfs, & kns );
+        if ( rc != 0 )
+            throw Exception ( rc, __FILE__, __LINE__, "failed to retrieve KNS manager" );
+
+        // create Native Dir
+        rc = KDirectoryNativeDir ( & wd );
+        if ( rc != 0 )
+            throw Exception ( rc, __FILE__, __LINE__, "failed to create native KDirectory" );
+
+        // create KConfig
+        rc = KConfigMake ( &kfg, NULL );
+        if ( rc != 0 )
+            throw Exception ( rc, __FILE__, __LINE__, "failed to create KConfig" ); 
+
+        // locate NCBI_HOME directory from KConfig
+        String *ncbi_home;
+        rc = KConfigReadString ( kfg, "NCBI_HOME", &ncbi_home );
+        if ( rc != 0 )
+            throw Exception ( rc, __FILE__, __LINE__, "failed to determine NCBI_HOME" );
+
+        // create path to preferences file
+        path_to_prefs = std :: string ( ncbi_home -> addr, ncbi_home -> size );
+        StringWhack ( ncbi_home );
+        path_to_prefs += "/sra.prefs";
+
+        // capture $PATH
+        const char *p = getenv ( "PATH" );
+        if ( p == NULL )
+            throw Exception ( __FILE__, __LINE__, "failed to determine PATH" );
+
+        PATH = std :: string ( p );
+        
+        // capture current timestamp
+        current_time = KTimeStamp ();
+
+        //cutoff time
+        KTime cutoff = { 2014 };
+        lower_date_limit = KTimeMakeTime ( &cutoff );
+
+        
+    }
+
+    // user may want to indicate a different location from which
+    // to load user preferences
+    static
+    void OverridePathToPrefs ( void )
+    {
+        SRAOption_Iterator it;
+
+        while ( 1 )
+        {
+            switch ( it . next () )
+            {
+            case opt_path_to_prefs:
+                path_to_prefs = std :: string ( it . param );
+                it . remove ();
+                break;
+
+            case opt_unrecognized:
+            case opt_no_more_args:
+                return;
+
+            default:
+                break;
+            }
+        }
+    }
+
+    static 
+    void LoadPrefsFromFile ()
+    {
+        // open prefs file for read
+        FILE *prefs = fopen ( path_to_prefs . c_str (), "r" );
+        if ( prefs != NULL )
+        {
+            // init flex with file
+            rc_t rc = PrefsInitFlex ( prefs );
+            if ( rc != 0 )
+            {
+                fclose ( prefs );
+                throw Exception ( rc, __FILE__, __LINE__, "failed to initialize prefs parser" );
+            }
+
+            // parse contents with prefs_parse
+            prefs_parse (); 
+
+            // destroy flex
+            PrefsDestroyFlex ();
+
+            // close prefs
+            fclose ( prefs );
+        }
+    }
+
+    static 
+    void Init ( int argc, char *argv [] )
+    {
+        // capture in global variables
+        g_argc = argc;
+        g_argv = argv;
+
+        prgm_name = argv [ 0 ];
+
+        InitFactoryDefaults ();
+        OverridePathToPrefs ();
+        LoadPrefsFromFile ();
+    }
+
+    static 
+    void OverrideParamsFromCmdLine ( PrefsData & params )
+    {
+        SRAOption_Iterator it;
+        while ( 1 )
+        {
+        // scan argv for options
+            switch ( it . next () )
+            {
+                // path to installation
+            case opt_path_to_prefs:
+                // impossible - we already removed them all above.
+                // good case for a debug msg... but doesn't hurt anything
+                it . remove ();
+                break;
+
+                // offline non interactive mode
+            case opt_offline_mode:
+                // TBD - set offline mode, either to true
+                // or if this option is made to take parameters,
+                // interpret the parameter
+                it . remove ();
+                break;
+
+                // verbocity
+            case opt_verbose:
+                // TBD - set verbosity level
+                // this is either {none, some} or takes a parameter
+                it . remove ();
+                break;
+
+                // no auto update
+            case opt_auto_update:
+            {
+                std :: string up = std :: string ( it . param ); 
+                if ( up . compare ( "yes" ) )
+                    params . auto_download_enabled = true;
+                else if ( up . compare ( "no" ) )
+                    params . auto_download_enabled = false;
+                else
+                    throw Exception ( __FILE__, __LINE__, "invalid option for '--auto-update'\n" );
+                it . remove ();
+                break;
+            }
+
+            case opt_unrecognized:
+            case opt_no_more_args:
+                return;
+            }
+        }
+    }
+
+    static
+    void SetPrefsCurrentVersion () // !!!
+    {
+        // set version in prefs and working params
+        
+
+        // mark dirty
+        dirty = true;
+    }
+
+    static
+    bool IsPathToInstallation ( const char * path, const char *ext )
+    {
+        uint32_t path_type = KDirectoryPathType ( wd,
+                                                  "%s/%s"
+#if WINDOWS
+                                                  ".exe"
+#endif
+                                                  , path
+                                                  , ext );
+        switch ( path_type )
+        {
+        case kptFile:
+        case kptFile | kptAlias:
+            // TBD - test for executable mode ??
+            return true;
+        }
+
+        return false;
+    }
+
+    static 
+    bool IsPathToInstallation ( const char * path, unsigned int len, const char *ext )
+    {
+        uint32_t path_type = KDirectoryPathType ( wd,
+                                                  "%.*s/%s"
+#if WINDOWS
+                                                  ".exe"
+#endif
+                                                  , len
+                                                  , path
+                                                  , ext );
+        switch ( path_type )
+        {
+        case kptFile:
+        case kptFile | kptAlias:
+            // TBD - test for executable mode ??
+            return true;
+        }
+
+        return false;
+    }
+
+    static 
+    bool LocateUsingPrefsPath ( const PrefsData & params )
+    {
+        //# path names a directory, e.g. $HOME/sratoolkit-2.3.4
+        //# on Windows, add ".exe" to end of file names
+        //# implication of using existing prefs path is that we know the version
+        
+        if ( IsPathToInstallation ( params . path_to_installation . c_str (), "bin/sra-version" ) )
+            path_to_binaries = params . path_to_installation + "/bin";
+        else
+        {
+            if ( IsPathToInstallation ( params . path_to_installation . c_str (), "bin/fastq-dump" ) )
+                path_to_binaries = params . path_to_installation + "/bin";
+            else
+            {
+                if ( ! IsPathToInstallation ( params . path_to_installation . c_str (), "fastq-dump" ) )
+                    return false;
+
+                path_to_binaries = params . path_to_installation;
+            }
+        }
+        
+
+        // record found in user-installation
+        where_found = found_by_prefs;
+
+        // !!! if ! version, obtain version by running tool
+        // run sra-version to capture simple version
+        // or run fastq-dump -V to capture and parse version
+        SetPrefsCurrentVersion ();
+
+        return true;
+    }
+
+    static 
+    bool LocateUsingPATH ( const PrefsData &params  )
+    {
+        //loop over $PATH using string_chr
+        const char *sep, *dir = PATH . c_str ();
+        while ( 1 )
+        {
+            // find next separator
+            sep = strchr ( dir, ':' );
+
+            // get length of this directory
+            // if separator was found, distance from "dir" to ':'
+            // otherwise, it's the remaining length in "dir"
+            unsigned int len = ( sep != NULL ) ? sep - dir : strlen ( dir );
+            if ( len != 0 )
+            {
+                if ( IsPathToInstallation ( dir, len,  "sra-version" ) ||
+                     IsPathToInstallation ( dir, len, "fastq-dump" ) )
+                {
+                    path_to_binaries = std :: string ( dir, len );
+                    break;
+                }
+            }
+
+            // detect no more directories
+            if ( sep == NULL )
+                return false;
+
+            // advance to next directory
+            dir = sep + 1;
+        }
+
+        //record found in $PATH
+        where_found = found_by_PATH;
+
+        // !!! run sra-version to capture simple version
+        //or run fastq-dump -V to capture and parse version
+        SetPrefsCurrentVersion ();
+
+        return true;
+    }
+
+    static
+    bool LocateWithUserAssistance ( const PrefsData &params )
+    {
+        //save prefs.path-to-installation
+        std :: string prev_path = prefs_data . path_to_installation;
+        //tell user that we cannot locate the installation
+
+        std :: cout << "Unable to find a previous installation of SRAToolkit." << std :: endl;
+
+        //loop
+        while ( 1 )
+        {
+            std :: cout << "Would you like to provide a path to an installation of SRAToolkit? [ y / N ] ";
+            std :: cout . flush ();
+
+            std :: string ch;
+            std :: getline ( std :: cin, ch );
+
+            // anything other than y or Y exits loop/function
+            if ( ch . empty () )
+                break;
+            if ( ch . compare ( "y" ) != 0 && ch . compare ( "Y" ) != 0 )
+                break;
+
+            std :: string path;
+            std :: cout << "Please provide the path to the installation: "; // !!! should we give an example?
+            std :: cout . flush ();
+
+            std :: getline ( std :: cin, path );
+                
+            // empty == retry.
+            if ( path . empty () )
+            {
+                std :: cout << "Empty path." << std :: endl;
+                continue;
+            }
+
+            // slam in new potential value
+            prefs_data . path_to_installation = path;
+            prefs_data . c_vers = 0;
+
+            // test user's input
+            if ( LocateUsingPrefsPath ( prefs_data ) )
+            {
+                // found it - need to update the prefs
+                dirty = true;
+                return true;
+            }
+
+            // restore previous information
+            prefs_data . path_to_installation = prev_path;
+            std :: cout
+                << " Unable to find SRAToolkit at: "
+                << path
+                << std :: endl;
+        }
+
+        return false;
+    }
+
+    static
+    bool LocateSRAToolkit ( const PrefsData & params )
+    {
+        // first, try from previously written prefs
+        // this cannot succeed the first time through,
+        // because we have not created prefs yet.
+        if ( LocateUsingPrefsPath ( params ) )
+            return true;
+
+        // MOST systems will not have an admin installation
+        // but for those systems that do, check to see what's there
+        if ( LocateUsingPATH ( params ) )
+            return true;
+
+        // the first time through, we will ask the user
+        // to locate a previous installation, but the most
+        // likely scenario is that there is none to be found
+        if ( LocateWithUserAssistance ( params ) )
+            return true;
+
+        // probably a first time user
+        return false;
+    }
+
+    static
+    void UpdatePrefsFromCGI ( const char *data ) // !!!
+    {
+        // parse data buffer to get data
+        // assign into prefs_data
+    }
+
+    static
+    bool ContactNCBIForVersion ( const PrefsData & params )
+    {
+        bool success = false;
+        
+        assert ( prefs_data . latest_vers_url . c_str () != 0 ); // assume the url has been properly set
+
+        //use HTTP to contact CGI
+        KHttpRequest *req;
+        rc_t rc = KNSManagerMakeRequest ( kns, &req, 0x01000000, NULL, 
+            "%s", prefs_data . latest_vers_url . c_str () );
+
+
+        if ( rc == 0 )
+        {
+            try
+            {
+                // pass OS & version, architecture, current "sra" tool version
+                // OS by KConfig "/OS"
+                String *os;
+                rc = KConfigReadString ( kfg, "OS", &os );
+                if ( rc != 0 )
+                    throw Exception ( rc, __FILE__, __LINE__, "Could not determine operating system" );
+              
+                // add the POST parameter
+                rc = KHttpRequestAddPostParam ( req, "OS=%S", os );
+                StringWhack ( os );
+                if ( rc != 0 )
+                    throw Exception ( rc, __FILE__, __LINE__, "Failed to post operating system" );
+                
+                // architecture bits by KConfig "/kfg/arch/bits"
+                String *arch;
+                rc = KConfigReadString ( kfg, "/kfg/arch/bits", &arch );
+                if ( rc != 0 )
+                    
+                    // add the POST parameter
+                    rc = KHttpRequestAddPostParam ( req, "ARCH=%S", arch );
+
+                StringWhack ( arch );
+                if ( rc != 0 )
+                    throw Exception ( rc, __FILE__, __LINE__, "Failed to post system architecture" );
+                
+                // TBD - OS version we do not have - should add to KConfig
+                
+                // our version is KAppVersion
+                ver_t vers = KAppVersion ();
+                
+                // add the POST parameter
+                rc = KHttpRequestAddPostParam ( req, "SELF_VERSION=%V", vers );
+                if ( rc != 0 )
+                    throw Exception ( rc, __FILE__, __LINE__, "Failed to post self version" );
+
+                KHttpResult *rslt;
+                rc = KHttpRequestPOST ( req, &rslt );
+                if ( rc == 0 )
+                {
+                    try
+                    {
+                        printf ( " Success posting a request\n" );
+                    
+                        uint32_t code;
+                        size_t msg_size;
+                        char msg_buff [ 1024 ];
+                        rc = KHttpResultStatus ( rslt, &code, msg_buff, sizeof msg_buff, &msg_size );
+                        if ( rc != 0 )
+                            throw Exception ( rc, __FILE__, __LINE__, "Could not retrieve status code" );
+                        if ( code != 200 )
+                            throw Exception ( rc, __FILE__, __LINE__, "Connection failed with status code: %u", code );
+                        
+                        KStream *response;
+                        rc = KHttpResultGetInputStream ( rslt, &response );
+                        if ( rc == 0 )
+                        {
+                            try
+                            {
+                                size_t num_read = 0;
+                                // TBD - since we are going to control the response
+                                // we can modify this size to fit accordingly
+                                char buffer [ 4096 ]; 
+                            
+                                rc = KStreamRead ( response, buffer, sizeof buffer, &num_read );
+                                if ( rc != 0  || num_read == 0 )
+                                    throw Exception ( rc, __FILE__, __LINE__, "failed to read response from NCBI" );
+
+                                // TBD - information to be obtained from CGI
+
+                                //store update information in prefs
+                                UpdatePrefsFromCGI ( buffer );
+                            }
+                            catch ( ... )
+                            {
+                                KStreamRelease ( response );
+                                throw;
+                            }
+                            
+                            KStreamRelease ( response );
+                        }
+                    }
+                    catch ( ... )
+                    {
+                        KHttpResultRelease ( rslt );
+                        throw;
+                    }
+                    
+                    KHttpResultRelease ( rslt );
+                }
+            }
+            catch ( ... )
+            {
+                KHttpRequestRelease ( req );
+                throw;
+            }
+            
+            KHttpRequestRelease ( req );
+        }
+
+        return success;
+    }
+
+
+    // copy data from source file at NCBI to dest file on users system
+    static 
+    rc_t CC CopyData ( const KFile *src, KFile *dst )
+    {
+        KDataBuffer buffer;
+        rc_t rc = KDataBufferMakeBytes ( &buffer, 1024 * 1024 );
+        if ( rc != 0 )
+            LogErr ( klogErr, rc, "Failed create 1Mb kdatabuffer " );
+        else
+        {
+            uint64_t read_pos = 0, write_pos = 0;
+            size_t num_read = 0, num_writ = 0;
+
+            while ( 1 )
+            {
+                rc = KFileReadAll ( src, read_pos, buffer . base, ( size_t ) buffer . elem_count, &num_read );
+                if ( rc != 0 )
+                {
+                    LogErr ( klogErr, rc, "Failed to read bytes for source file" );
+                    break;
+                }
+                if ( num_read == 0 )
+                    break;
+
+
+                read_pos += num_read;
+
+                rc = KFileWriteAll ( dst, write_pos, buffer . base, ( size_t ) buffer . elem_count, &num_writ );
+                if ( rc != 0 )
+                {
+                    LogErr ( klogErr, rc, "Failed to write bytes to dest file" );
+                    break;
+                }
+                
+                if ( num_writ != num_read )
+                {
+                    rc = RC ( rcExe, rcFile, rcWriting, rcTransfer, rcIncomplete );
+                    LogErr ( klogErr, rc, "Failed to transfer all bytes to dest file" );
+                    break;
+                }
+                
+                write_pos += num_writ;
+            }
+           
+            KDataBufferWhack ( &buffer );
+        }
+
+        return rc;
+    }
+
+#define string_endswith( str, len, ending ) \
+    ( ( len ) >= sizeof ( ending ) && \
+      memcmp ( & ( str ) [ ( len ) - sizeof ( ending ) + 1 ], ending, sizeof ( ending ) - 1 ) == 0 )             
+
+
+    static
+    rc_t CC HandleFile ( const KDirectory *src_dir, KDirectory *dest_dir, const char *fname ) 
+    {
+        bool gz = false, bz2 = false;
+        size_t fname_size = string_size ( fname );
+        size_t dname_size = fname_size; 
+
+        // look for compressed files
+        if ( string_endswith ( fname, fname_size, ".gz" ) )
+        {
+            gz = true;
+            dname_size = fname_size - sizeof ".gz" - 1;
+        }
+        else if ( string_endswith ( fname, fname_size, ".bz2" ) )
+        {
+            bz2 = true;
+            dname_size = fname_size - sizeof ".bz2" - 1;
+        }
+        
+        const KFile *fsrc;
+        rc_t rc = KDirectoryOpenFileRead ( src_dir, &fsrc, "%s", fname );
+        if ( rc != 0 )
+            LogErr ( klogErr, rc, "Failed open file for read" );
+        else
+        {
+            // if file was compressed, uncompress
+            if ( gz )
+            {
+                const KFile *gz;
+                rc = KFileMakeGzipForRead ( & gz, fsrc );
+                if ( rc == 0 )
+                {
+                    KFileRelease ( fsrc );
+                    fsrc = gz;
+                }
+            }
+            else if ( bz2 )
+            {
+                const KFile *bz2;
+                rc = KFileMakeBzip2ForRead ( & bz2, fsrc );
+                if ( rc == 0 )
+                {
+                    KFileRelease ( fsrc );
+                    fsrc = bz2;
+                }
+            }
+
+            // create the destination file on users system
+            KFile *fdest;
+            rc = KDirectoryCreateFile ( dest_dir, &fdest, false, 0600, kcmInit | kcmParents
+                                        , "%.*s.tmp"
+                                        , ( int ) dname_size
+                                        , fname );
+                                        
+            if ( rc != 0 )
+                LogErr ( klogErr, rc, "Failed create file" );
+            else
+            {
+                rc = CopyData ( fsrc, fdest );
+
+                KFileRelease ( fdest );
+            }
+
+            KFileRelease ( fsrc );
+
+
+            if ( rc != 0 )
+                return rc;
+
+            
+
+            // rename dest.tmp to final name and setting mode bits
+            uint32_t access;
+            rc = KDirectoryAccess ( src_dir, &access, "%s", fname );
+            if ( rc != 0 )
+                LogErr ( klogErr, rc, "Failed to acquire directory access" );
+            else
+            {
+                // TBD may need to tune up
+                rc = KDirectorySetAccess ( dest_dir, false, access, 0777,  "%.*s.tmp", ( int ) dname_size, fname );
+                if ( rc != 0 )
+                    LogErr ( klogErr, rc, "Failed to set directory access" );
+                else
+                {
+                    KDataBuffer names;
+                    rc = KDataBufferMakeBytes ( & names, dname_size + dname_size + sizeof ".tmp" - 1 + 2 );
+                    if ( rc != 0 )
+                        LogErr ( klogErr, rc, "Failed create KDataBuffer" );
+                    else
+                    {
+                        char * from = ( char * ) names . base;
+                        char * to = from + dname_size + sizeof ".tmp";
+                        
+                        string_printf ( from, dname_size + sizeof ".tmp", NULL, "%.*s.tmp", ( uint32_t ) dname_size, fname );
+                        string_printf ( to, dname_size + 1, NULL, "%.*s", ( uint32_t ) dname_size, fname );
+                        
+                        rc = KDirectoryRename ( dest_dir, true, from, to );
+                        if ( rc != 0 )
+                            LogErr ( klogErr, rc, "Failed to rename directory" );
+
+                        KDataBufferWhack ( & names );
+                    }
+                }
+            }
+        }
+
+        return rc;
+    }
+
+    static
+    rc_t CC HandleAlias ( const KDirectory *src_dir, void *dest_dir, const char *name ) 
+    {
+        char resolved [ 4096 ];
+        // TBD - check shallow resolution of alias
+        rc_t rc = KDirectoryResolveAlias ( src_dir, false, resolved, sizeof resolved, "%s", name );
+        if ( rc == 0 )
+            rc = KDirectoryCreateAlias ( ( KDirectory * ) dest_dir, 0777, kcmInit | kcmParents, resolved, name );
+
+        return rc;
+    }
+
+    /* HandleSourceFiles
+     * dir = source dir
+     * name = name of file
+     * data = destination dir
+     */
+    static
+    rc_t CC HandleSourceFiles ( const KDirectory *src, uint32_t type, const char *name, void *data )
+    {
+        KDirectory *dst = ( KDirectory * ) data;
+
+        // check for file type
+        switch ( type )
+        {
+        case kptFile:
+            return HandleFile ( src, dst, name );
+        case kptDir:
+            break;
+        case kptFile | kptAlias:
+        case kptDir | kptAlias:
+            return HandleAlias ( src, dst, name );
+        default:
+            return RC ( rcExe, rcNoTarg, rcValidating, rcNoObj, rcError );
+        }
+
+
+        // handle directory here. recursive.
+        rc_t rc = KDirectoryCreateDir ( dst, 0777, kcmOpen | kcmParents, "%s", name );
+        if ( rc != 0 )
+            LogErr ( klogErr, rc, "Failed to create directory directory" );
+        else
+        {
+            KDirectory *sub; 
+            rc = KDirectoryOpenDirUpdate ( dst, & sub, false, "%s", name );
+            if ( rc != 0 )
+                LogErr ( klogErr, rc, "Failed to open directory for update" );
+            else
+            {
+                rc = KDirectoryVisit ( src, false, HandleSourceFiles, sub, "%s", name );
+                
+                KDirectoryRelease ( sub );
+            }
+        }
+
+        return rc;
+    }
+
+    static
+    void DownloadAndInstallToolkit ( const PrefsData & params )
+    {
+        // create the destination directory of the installation
+        rc_t rc = KDirectoryCreateDir ( wd, 0775, kcmOpen | kcmParents, 
+                                        "%s", params . path_to_installation . c_str () ); 
+        if ( rc == 0 )
+        {
+            // open for update
+            KDirectory *dest_dir;
+            rc = KDirectoryOpenDirUpdate ( wd, &dest_dir, false, 
+                                           "%s", params . path_to_installation . c_str () );
+            if ( rc == 0 )
+            {
+                // establish connection to NCBI to access source files
+                const KFile *src_file;
+                rc = KNSManagerMakeReliableHttpFile ( kns, &src_file, NULL, 0x01010000,  
+                                              "%s", path_to_url . c_str () ); 
+                if ( rc == 0 )
+                {
+                    VPath *url;
+                    rc = VFSManagerMakePath ( vfs, & url, "%s", path_to_url . c_str () );
+                    if ( rc == 0 )
+                    {
+                        const KDirectory *src_dir;
+                        // hack to mount kar file in memory
+                        rc = VFSManagerOpenDirectoryReadDirectoryRelative ( vfs, wd, &src_dir, url );
+                        if ( rc == 0 )
+                        {
+                            // visit each entry in the directory and handle
+                            rc = KDirectoryVisit ( src_dir, false, HandleSourceFiles, dest_dir, "." );
+
+                            KDirectoryRelease ( src_dir );
+                        }
+
+                        VPathRelease ( url );
+                    }
+
+                    KFileRelease ( src_file );
+                }
+
+                KDirectoryRelease ( dest_dir );
+            }
+        }
+        if ( rc != 0 )
+            throw Exception ( __FILE__, __LINE__, "failed to get visit src_dir" );
+    }
+
+
+    static
+    bool LatestVersionValid ( const PrefsData & params )
+    {
+        // latest version has not yet been set
+        if ( params . l_vers == 0 )
+            return false;
+
+        // the params should contain only valid dates
+        if ( current_time < params . last_check_date )
+            throw Exception ( __FILE__, __LINE__, "%s", "invalid date" );
+
+        // TBD - allow for some time interval
+        // this may also be part of prefs - probably should be
+        // default might be 1 week... 1 day?
+        if ( current_time - params . last_check_date <= 
+             params . last_check_date_interval_limit );
+            return true;
+
+        // failed
+        return false;
+    }
+
+    static
+    bool CheckLatestVersion ( const PrefsData & params )
+    {
+        if ( LatestVersionValid ( params ) )
+            return true;
+
+        if ( ContactNCBIForVersion ( params ) )
+        {
+            prefs_data . last_check_date = current_time;
+            dirty = true;
+
+            return true;
+        }
+
+        return false;
+    }
+
+    static
+    void EnsureLatestVersion ( const PrefsData & params )
+    {
+        if ( ! CheckLatestVersion ( params ) )
+            return;
+
+        //if ! user wants to be asked prefs.dont-ask-before-download
+        // TBD maybe notify an installation is happening?
+        if ( params . auto_download_enabled )
+            DownloadAndInstallToolkit ( params );
+        else
+        {
+            //ask if they want to download? [Yn]
+
+            // first time around
+            if ( params . c_vers == 0 )
+                std :: cout << "Would you like to download and install the SRAToolkit? [Y/n] ";
+            else
+                std :: cout << "A newer version of SRAToolkit is available. Would you like to download and install? [Y/n] ";
+
+            std :: cout . flush ();
+
+            std :: string ch;
+            std :: getline ( std :: cin, ch );
+
+            if ( ch . empty () || ch . compare ( "y" ) == 0 || ch . compare ( "Y" ) == 0 )
+                DownloadAndInstallToolkit ( params );
+        }
+    }
+
+    static
+    void EnsureVDBConfig ( const PrefsData & params )
+    {
+        //must have user public repository
+        String *str;
+        rc_t rc = KConfigReadString ( kfg, "/user/public", &str );
+        if ( rc != 0 )
+            throw Exception ( rc, __FILE__, __LINE__, "Failed to determine public repository" );
+        StringWhack ( str );
+
+        //must have ncbi remote
+        rc = KConfigReadString ( kfg, "/ncbi/remote", &str );
+        if ( rc != 0 )
+            throw Exception ( rc, __FILE__, __LINE__, "Failed to determine remote repository" );
+        StringWhack ( str );
+
+        //update KConfig with anything missing
+    }
+
+    static
+    void SavePrefs ( void )
+    {
+        //return if ! dirty
+        if ( ! dirty )
+            return;
+
+        //open prefs file for write
+        FILE *prefs = fopen ( path_to_prefs . c_str (), "w" );
+        if ( prefs == NULL )
+            throw Exception ( __FILE__, __LINE__, "Failed to open file for save" );
+
+        //write all prefs to prefs file
+        char buffer [ 256 ];
+        
+        string_printf ( buffer, sizeof buffer, NULL, "%T", prefs_data . dl_date );  
+        fprintf ( prefs, "download-date = %s\n", buffer );
+        string_printf ( buffer, sizeof buffer, NULL, "%T", prefs_data . last_check_date );
+        fprintf ( prefs, "last-check-date = %s\n", buffer );
+
+        string_printf ( buffer, sizeof buffer, NULL, "%V", prefs_data . l_vers );  
+        fprintf ( prefs, "latest-version = %s\n", buffer );
+        string_printf ( buffer, sizeof buffer, NULL, "%V", prefs_data . c_vers );  
+        fprintf ( prefs, "current-version = %s\n", buffer );
+
+        fprintf ( prefs, "download-url = %s\n", prefs_data . download_url . c_str () );
+        fprintf ( prefs, "latest-ver-url = %s\n", prefs_data . latest_vers_url . c_str () );
+        fprintf ( prefs, "path-to-installation = %s\n", prefs_data . path_to_installation . c_str () );
+
+        fprintf ( prefs, "auto-download-enabled = %s\n", prefs_data . auto_download_enabled ? "true" : "false" );
+
+        //close prefs file
+        fclose ( prefs );
+
+        //mark not dirty
+        dirty = false;
+    }
+
+    //!!!
+    static
+    void RunSRAShell ( const PrefsData & params )
+    {
+        // append toolkit directory to PATH
+        std :: string NEW_PATH ( path_to_binaries );
+        NEW_PATH += ":";
+        NEW_PATH += PATH;
+        // TBD - use putenv or setenv to update PATH
+
+        // launch sra-shell with remaining g_argv
+
+        // wait upon return
+
+        // throw exception if error
+    }
+
+    static
+    void SRAMain ( void )
+        throw ()
+    {
+        try
+        {
+            // make a copy of prefs data for current session
+            PrefsData params ( prefs_data );
+
+            // allow user to override prefs from command line
+            OverrideParamsFromCmdLine ( params );
+
+            // *** now have a complete idea of what we want to do ***
+
+            // try to find the toolkit
+            // not guaranteed to find anything
+            LocateSRAToolkit ( params );
+
+            // make sure that the software we have is up to date
+            EnsureLatestVersion ( params );
+
+            EnsureVDBConfig ( params );
+
+            SavePrefs ();
+
+            RunSRAShell ( params );
+        }
+        catch ( Exception & x )
+        {
+            // report nature of problem
+        }
+        catch ( ... )
+        {
+            // report unknown error
+        }
+    }
+
+    static 
+    void Cleanup ( void )
+    {
+        // close managers
+        KNSManagerRelease ( kns );
+        kns = NULL;
+
+        KDirectoryRelease ( wd );
+        wd = NULL;
+
+        KConfigRelease ( kfg );
+        kfg = NULL;
+    }
+
+    static
+    void run ( int argc, char *argv [] )
+    {
+        Init ( argc, argv );
+        SRAMain ();
+        Cleanup ();
+    }
+}
+
+extern "C"
+{
+    int prefs_yyget_lineno ( void );
+    int prefs_yylex ( union YYSTYPE *val );
+
+    int prefs_lex ( YYSTYPE *val )
+    {
+        return prefs_yylex ( val );
+    }
+
+    void prefs_error ( const char *msg )
+    {
+        std :: cerr
+            << sra :: prgm_name
+            << ':'
+            << prefs_yyget_lineno ()
+            << ": Error in preferences file: "
+            << msg
+            << std :: endl;
+    }
+
+    void  prefs_token_error ( const Token *token, const char *msg )
+    {
+        std :: cerr
+            << sra :: prgm_name
+            << ':'
+            << token -> lineno
+            << ": Error in preferences file: "
+            << msg
+            << std :: endl;
+    }
+
+    static
+    bool CheckValidTimeStamp ( const Token *token )
+    {
+        if ( token -> val . t < sra :: lower_date_limit )
+        {
+            prefs_token_error ( token, "timestamp is too old" );
+            return false;
+        }
+        if ( token -> val . t > sra :: current_time )
+        {
+            prefs_token_error ( token, "timestamp is in the future" );
+            return false;
+        }
+
+        return true;
+    }
+
+    static 
+    bool CheckValidToolkitVersion ( const Token *token )
+    {
+        const ver_t two_three = ( 2 << 24 ) | ( 3 << 16 );
+        if ( token -> val . v < two_three )
+        {
+            prefs_token_error ( token, "version is too old" );
+            return false;
+        }
+        // To the reader: 
+        // We have no way of knowing if the version beyond the latest
+        // without contacting NCBI.
+        // All version will have to be post-validated.
+
+        return true;
+    }
+
+    static
+    bool CheckValidURL ( const Token *token )
+    {
+        bool valid = false;
+        // create VPath using VFSManagerMakePath
+        VPath *path;
+        rc_t rc = VFSManagerMakePath ( sra :: vfs, &path, "%s", token -> val . c );
+        if ( rc != 0 )
+            prefs_token_error ( token, "could not establish a valid path to check url" );
+        else
+        {
+            // check that the scheme is http using VPathGetScheme.
+            String scheme;
+            rc = VPathGetScheme ( path, &scheme );
+            if ( rc != 0 )
+                prefs_token_error ( token, "could not establish scheme of url" );
+            else
+            {
+                String http;
+                CONST_STRING ( & http, "http" );
+                if ( ! StringCaseEqual ( & scheme, & http ) )
+                    prefs_token_error ( token, "not a valid http url" );
+                else
+                {
+                    // check that the host is NCBI
+                    String host;
+                    rc = VPathGetHost ( path, &host );
+                    if ( rc != 0 )
+                        prefs_token_error ( token, "could not establish host of url" );
+                    else
+                    {
+                        String ncbi;
+                        CONST_STRING ( &ncbi, "www.ncbi.nlm.nih.gov" );
+                        if ( ! StringCaseEqual ( &host, &ncbi ) )
+                            prefs_token_error ( token, "not a valid host for url" );
+                        else
+                            valid = true;
+                    }
+                }
+            }
+            VPathRelease ( path );
+        }
+        return valid;
+    }
+
+    static
+    bool CheckValidPath ( const Token *token )
+    {
+        uint32_t type = KDirectoryPathType ( sra :: wd, "%.*s", token -> len, token -> val . c );
+        switch ( type )
+        {
+        case kptFile:
+        case kptDir:
+        case kptFile | kptAlias:
+        case kptDir | kptAlias:
+            return true;
+        }
+        return false;
+    }
+
+    void PrefsDataSetDownloadDate ( const Token  *download_date )
+    {
+        if ( CheckValidTimeStamp ( download_date ) )
+            sra :: prefs_data . dl_date = download_date -> val . t;
+    }
+
+    void PrefsDataSetLastCheckDate ( const Token *last_check_date )
+    {
+        if ( CheckValidTimeStamp ( last_check_date ) )
+            sra :: prefs_data . last_check_date = last_check_date -> val . t;
+    }
+
+    void PrefsDataSetLatestVersion ( const Token *latest_version )
+    {
+        if ( CheckValidToolkitVersion ( latest_version ) )
+             sra :: prefs_data . l_vers = latest_version -> val . v;
+    }
+
+    void PrefsDataSetCurrentVersion ( const Token *current_version )
+    {
+        if ( CheckValidToolkitVersion ( current_version ) )
+            sra :: prefs_data . c_vers = current_version -> val . v;
+    }
+
+    void PrefsDataSetDownloadURL ( const Token *download_url )
+    {
+        if ( CheckValidURL ( download_url ) )
+            sra :: prefs_data . download_url = std :: string ( download_url -> val . c, 
+                                                               download_url -> len );
+    }
+
+    void PrefsDataSetLatestVersionURL ( const Token *latest_version_url )
+    {
+        if ( CheckValidURL ( latest_version_url ) )
+            sra :: prefs_data . latest_vers_url = std :: string ( latest_version_url -> val . c, 
+                                                                  latest_version_url -> len );
+    }
+
+    void PrefsDataSetPathToInstallation ( const Token *path_to_installation )
+    {
+        if ( CheckValidPath ( path_to_installation ) )
+            sra :: prefs_data . path_to_installation = std :: string ( path_to_installation -> val . c,
+                                                                       path_to_installation -> len );
+    }
+
+    void PrefsDataSetAutoDownloadEnabled ( bool which )
+    {
+        sra :: prefs_data . auto_download_enabled = which;
+    }
+
+    /* Version  EXTERN
+     *  return 4-part version code: 0xMMmmrrrr, where
+     *      MM = major release
+     *      mm = minor release 
+     *    rrrr = bug-fix release
+     */
+    ver_t CC KAppVersion ( void )
+    {
+        return SRA_VERS;
+    }
+    
+    
+    const char UsageDefaultName[] = "sra";
+
+    /* Usage
+     *  This function is called when the command line argument
+     *  handling sees -? -h or --help
+     */
+    rc_t CC UsageSummary ( const char *progname )
+    {
+        return KOutMsg (
+              "\n"
+              "Usage:\n"
+              "  %s [Options]\n"
+              "\n"
+              "Summary:\n"
+              "  Launch bash shell with appropriate environment configuration.\n"
+              , progname );
+    }
+    
+    rc_t CC Usage ( const Args *args )
+    {
+#if 0
+        uint32_t i;
+        const char *progname, *fullpath;
+        rc_t rc = ArgsProgram ( args, & fullpath, & progname );
+        if ( rc != 0 )
+            progname = fullpath = UsageDefaultName;
+        
+        UsageSummary ( progname );
+        
+        KOutMsg ( "Options:\n" );
+        
+        for ( i = 0; i < sizeof options / sizeof options [ 0 ]; ++ i )
+        {
+            HelpOptionLine ( options [ i ] . aliases, options [ i ] . name,
+                             option_params [ i ], options [ i ] . help );
+        }
+        
+        HelpOptionsStandard ();
+        
+        HelpVersion ( fullpath, KAppVersion () );
+#endif   
+        return 0;
+    }
+
+    rc_t CC KMain ( int argc, char *argv [] )
+    {
+        rc_t rc = 0;
+
+        try
+        {
+            sra :: run ( argc, argv );
+        }
+        catch ( sra :: Exception &x )
+        {
+            rc = x . return_code ();
+#if _DEBUGGING
+            // TBD - check that this doesn't conflict with internal attempts
+            // at printing filename and lineno. It's probably just going to repeat...
+            pLogErr ( klogErr, rc, "$(file):$(lineno): $(msg)",
+                      "file=%s,lineno=%u,msg=%s"
+                      , x . file_name ()
+                      , x . line_number ()
+                      , x . what () );
+#else
+            LogErr ( klogErr, rc, x . what () );
+#endif
+        }
+        catch ( std :: exception & x )
+        {
+            rc = RC ( rcExe, rcNoTarg, rcExecuting, rcNoObj, rcUnknown );
+            LogErr ( klogFatal, rc, x . what () );            
+        }
+        catch ( ... )
+        {
+            rc = RC ( rcExe, rcNoTarg, rcExecuting, rcNoObj, rcUnknown );
+            rc = LogErr ( klogFatal, rc, "unknown error" );
+        }
+
+        return rc;
+
+    }
+}
diff --git a/tools/workspace/sra.vers b/tools/workspace/sra.vers
new file mode 100644
index 0000000..8a9ecc2
--- /dev/null
+++ b/tools/workspace/sra.vers
@@ -0,0 +1 @@
+0.0.1
\ No newline at end of file
diff --git a/tools/workspace/sratoolkit-exception.cpp b/tools/workspace/sratoolkit-exception.cpp
new file mode 100644
index 0000000..4c1c5bc
--- /dev/null
+++ b/tools/workspace/sratoolkit-exception.cpp
@@ -0,0 +1,126 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include "sratoolkit-exception.hpp"
+#include <klib/printf.h>
+#include <klib/rc.h>
+
+namespace sra 
+{
+
+    /* Exception
+     *  create with or without an RC
+     *  with or without an accompanying text string
+     */
+
+    /* what
+     *  implement std::exception::what
+     */
+    const char * Exception :: what () const
+        throw ()
+    {
+        try
+        {
+            return error_msg . c_str ();
+        }
+        catch ( ... )
+        {
+            return "INTERNAL ERROR";
+        }
+    }
+
+    /* with only an RC
+     *  just records rc, filename and lineno
+     *  initializes what with empty or unspecified or something
+     */
+    Exception :: Exception ( rc_t _rc, const char * _filename, uint32_t _lineno )
+            throw ()
+        : filename ( _filename )
+        , lineno ( _lineno )
+        , rc ( _rc )
+    {
+        try
+        {
+            error_msg = std :: string ( "unspecified" );
+        }
+        catch ( ... )
+        {
+        }
+    }
+
+    /* with a printf-style error message
+     *  records filename and lineno
+     *  uses string_vprintf to build error_msg from fmt + args
+     *  initializes rc with an unknown error code
+     */
+    Exception :: Exception ( const char * _filename, uint32_t _lineno, const char *fmt, ... )
+            throw ()
+        : filename ( _filename )
+        , lineno ( _lineno )
+        , rc ( SILENT_RC ( rcExe, rcNoTarg, rcExecuting, rcNoObj, rcUnknown ) )
+    {
+    }
+
+    /* with an RC and a printf-style error message
+     *  records rc, filename and lineno
+     *  uses string_vprintf to build error_msg from fmt + args
+     */
+    Exception :: Exception ( rc_t _rc, const char * _filename, uint32_t _lineno, const char *fmt, ... )
+            throw ()
+        : filename ( _filename )
+        , lineno ( _lineno )
+        , rc ( _rc )
+    {
+        try
+        {
+            va_list args;
+            va_start ( args, fmt );
+
+            size_t msg_size;
+            char msg [ 4096 ];
+            rc_t print_rc = string_vprintf ( msg, sizeof msg, & msg_size, fmt, args );
+
+            va_end ( args );
+
+            if ( print_rc == 0 )
+                error_msg = std :: string ( msg, msg_size );
+            else
+                error_msg = std :: string ( "INTERNAL ERROR" );
+        }
+        catch ( ... )
+        {
+        }
+    }
+
+    /* destructor
+     *  tears down string
+     */
+    Exception :: ~ Exception ()
+        throw ()
+    {
+    }
+
+}
diff --git a/tools/workspace/sratoolkit-exception.hpp b/tools/workspace/sratoolkit-exception.hpp
new file mode 100644
index 0000000..bfeb659
--- /dev/null
+++ b/tools/workspace/sratoolkit-exception.hpp
@@ -0,0 +1,111 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _hpp_sratoolkit_exception_
+#define _hpp_sratoolkit_exception_
+
+#ifndef _h_klib_defs_
+#include <klib/defs.h>
+#endif
+
+#include <exception>
+#include <string>
+
+namespace sra
+{
+
+    /* Exception
+     *  create with or without an RC
+     *  with or without an accompanying text string
+     */
+    class Exception : std::exception
+    {
+    public:
+
+        /* what
+         *  implement std::exception::what
+         */
+        virtual const char *what () const
+            throw ();
+
+        /* return_code
+         *  get the offending rc
+         */
+        inline rc_t return_code () const
+        { return rc; }
+
+        /* file_name
+         * get the filename where error occurred
+         */
+        inline const char *file_name () const
+        { return filename; }
+
+        /* line_number
+         *  get the line number where error occurred
+         */
+        inline uint32_t line_number () const
+        { return lineno; }
+
+        /* CONSTRUCTORS */
+
+        /* with only an RC
+         *  just records rc, filename and lineno
+         *  initializes what with empty or unspecified or something
+         */
+        Exception ( rc_t rc, const char * filename, uint32_t lineno )
+            throw ();
+
+        /* with a printf-style error message
+         *  records filename and lineno
+         *  uses string_vprintf to build error_msg from fmt + args
+         *  initializes rc with an unknown error code
+         */
+        Exception ( const char * filename, uint32_t lineno, const char *fmt, ... )
+            throw ();
+
+        /* with an RC and a printf-style error message
+         *  records rc, filename and lineno
+         *  uses string_vprintf to build error_msg from fmt + args
+         */
+        Exception ( rc_t rc, const char * filename, uint32_t lineno, const char *fmt, ... )
+            throw ();
+
+        /* destructor
+         *  tears down string
+         */
+        virtual ~ Exception ()
+            throw ();
+
+    protected:
+
+        std :: string error_msg;
+        const char *filename;
+        uint32_t lineno;
+        rc_t rc;
+    };
+}
+
+#endif /* _hpp_sratoolkit_exception_ */
diff --git a/tools/workspace/token.c b/tools/workspace/token.c
new file mode 100644
index 0000000..f20a001
--- /dev/null
+++ b/tools/workspace/token.c
@@ -0,0 +1,228 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+
+#include "token.h"
+#include "prefs-priv.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <ctype.h>
+#include <assert.h>
+
+
+/* conversion functions
+ *  returns false if there were problems, e.g. integer overflow
+ *  returns a typed value in "val" on success
+ *  "text" and "len" are taken from a volatile text buffer
+ */
+bool toolkit_dtoi ( uint64_t * val, const char *text, int len )
+{
+    uint64_t num;
+    int i, cnt = len - 1;
+
+    /* skip over leading zeros, leaving at least one digit */
+    for ( i = 0; i < cnt; ++ i )
+    {
+        if ( text [ i ] != '0' )
+            break;
+    }
+
+    /* initialize to left-most non-zero digit or zero */
+    num = text [ i ] - '0';
+
+    /* process remaining digits */
+    for ( ++ i; i < len; ++ i )
+    {
+        uint64_t dig = text [ i ] - '0';
+
+        /* test for overflow when scaling by 10 */
+        if ( num > ( UINT64_MAX / 10 ) )
+            return false;
+        num *= 10;
+
+        /* test for overflow when adding in new digit */
+        if ( num > ( UINT64_MAX - dig ) )
+            return false;
+        num += dig;
+    }
+
+    /* return 64-bit unsigned value */
+    * val = num;
+    return true;
+}
+
+#undef VERS
+#define VERS( M, m, r, b ) \
+    ( ( ( ver_t ) ( M ) << 24 ) | \
+      ( ( ver_t ) ( m ) << 16 ) | \
+      ( ( ver_t ) ( r ) <<  8 ) | \
+      ( ( ver_t ) ( b ) <<  0) )
+
+bool toolkit_atov ( ver_t *val, const char *text, int len )
+{
+    int i, part;
+
+    uint32_t num [ 4 ];
+    num [ 0 ] = num [ 1 ] = num [ 2 ] = num [ 3 ] = 0;
+
+    for ( i = part = 0; i < len; ++ i )
+    {
+        if ( text [ i ] == '.' )
+            ++ part;
+        else
+        {
+            num [ part ] *= 10;
+            num [ part ] += text [ i ] - '0';
+            if ( num [ part ] >= 256 )
+            {
+                * val = 0;
+                return false;
+            }
+        }
+    }
+
+    * val = VERS ( num [ 0 ], num [ 1 ], num [ 2 ], num [ 3 ] );
+    return true;
+}
+
+bool toolkit_atotm ( KTime_t *val, const char *text, int len )
+{
+    char *end;
+    struct tm tm;
+
+    /* must fit format of YYYY-MM-DDThh:mm:ssZ
+       or potentially with time zone */
+    if ( len < 20 )
+        return false;
+
+    /* get year 1900..2999 */
+    tm . tm_year = ( int ) strtoul ( & text [ 0 ], & end, 10 );
+    assert ( end == text + 4 );
+    assert ( end [ 0 ] == '-' );
+    if ( tm . tm_year < 1900 || tm . tm_year >= 3000 )
+        return false;
+
+    /* get month 1..12 */
+    tm . tm_mon = ( int ) strtoul ( & text [ 5 ], & end, 10 );
+    assert ( end == text + 7 );
+    assert ( end [ 0 ] == '-' );
+    if ( tm . tm_mon < 1 || tm . tm_mon > 12 )
+        return false;
+
+    /* get day 1..31 */
+    tm . tm_mday = ( int ) strtoul ( & text [ 8 ], & end, 10 );
+    assert ( end == text + 10 );
+    assert ( toupper ( end [ 0 ] ) == 'T' );
+    if ( tm . tm_mday < 1 || tm . tm_mday > 31 )
+        return false;
+
+    /* get hour 0..23 */
+    tm . tm_hour = ( int ) strtoul ( & text [ 11 ], & end, 10 );
+    assert ( end == text + 13 );
+    assert ( end [ 0 ] == ':' );
+    if ( tm . tm_hour > 23 )
+        return false;
+
+    /* get min 0..59 */
+    tm . tm_min = ( int ) strtoul ( & text [ 14 ], & end, 10 );
+    assert ( end == text + 16 );
+    assert ( end [ 0 ] == ':' );
+    if ( tm . tm_min > 59 )
+        return false;
+
+    /* get sec 0..61 - for leap seconds */
+    tm . tm_sec = ( int ) strtoul ( & text [ 17 ], & end, 10 );
+    assert ( end == text + 19 );
+    assert ( toupper ( end [ 0 ] ) == 'Z' );
+    if ( tm . tm_sec > 61 )
+        return false;
+
+    /* adjust for Unix mktime */
+    tm . tm_year -= 1900;
+    tm . tm_mon -= 1;
+    * val = mktime ( & tm );
+    return * val != -1;
+}
+
+/* rewrite token 
+ * convert integer to ver_t
+ * integer is in t -> val . u
+ * and we can accept value 0 .. 255 anything else is an error
+ * maj only
+ */
+Token toolkit_itov ( const Token *i )
+{
+    Token t = *i;
+
+    if ( i -> val . u > 255 )
+    {
+        prefs_token_error ( i, "version component overflow" );
+        t . val . u = 0;
+    }
+    else
+    {
+        t . val . v = VERS ( i -> val . u, 0, 0 , 0 );
+        t . type = val_vers;
+    }
+
+    return t;
+}
+
+/* rewrite token
+ * real number to ver_t
+ * real number is a string in t -> val . c
+ * we perform two integer conversions from ASCII
+ * split on '.' 
+ * maj . min
+ */
+Token toolkit_rtov ( const Token *r )
+{
+    Token t = *r;
+
+    char *dot;
+    unsigned long maj, min;
+
+    assert ( r -> type == val_txt );
+
+    /* we know that the string being used in the transformation is '.' 
+     * in between integers because of the lex parser */
+    maj = strtoul ( r -> val . c, & dot, 10 ); 
+    min = strtoul ( dot + 1, NULL, 10 );
+
+    if ( maj > 255 || min > 255 )
+    {
+        prefs_token_error ( r, "version component overflow" );
+        t . val . u = 0;
+    }
+    else
+    {
+        t . val . v = VERS ( maj, min, 0, 0 );
+        t . type = val_vers;
+    }
+ 
+    return t;
+}
diff --git a/tools/workspace/token.h b/tools/workspace/token.h
new file mode 100644
index 0000000..53bf0af
--- /dev/null
+++ b/tools/workspace/token.h
@@ -0,0 +1,99 @@
+/*===========================================================================
+ *
+ *                            PUBLIC DOMAIN NOTICE
+ *               National Center for Biotechnology Information
+ *
+ *  This software/database is a "United States Government Work" under the
+ *  terms of the United States Copyright Act.  It was written as part of
+ *  the author's official duties as a United States Government employee and
+ *  thus cannot be copyrighted.  This software/database is freely available
+ *  to the public for use. The National Library of Medicine and the U.S.
+ *  Government have not placed any restriction on its use or reproduction.
+ *
+ *  Although all reasonable efforts have been taken to ensure the accuracy
+ *  and reliability of the software and data, the NLM and the U.S.
+ *  Government do not and cannot warrant the performance or results that
+ *  may be obtained by using this software or data. The NLM and the U.S.
+ *  Government disclaim all warranties, express or implied, including
+ *  warranties of performance, merchantability or fitness for any particular
+ *  purpose.
+ *
+ *  Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ */
+
+#ifndef _h_token_
+#define _h_token_
+
+#ifndef _h_klib_defs_
+#include <klib/defs.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct Token Token;
+struct Token
+{
+    /* token value ( if any ) */
+    union
+    {
+        /* yytext */
+        const char *c;
+
+        /* unsigned integer */
+        uint64_t u;
+
+        /* version number */
+        ver_t v;
+
+        /* datetime */
+        KTime_t t;
+
+    } val;
+
+    /* text length */
+    uint32_t len;
+
+    /* location of token in source */
+    uint32_t lineno;
+
+    /* token type - defined by bison/yacc */
+    uint16_t type;
+
+    /* value variant */
+    uint16_t var;
+};
+
+
+/* token value variant codes */
+enum
+{
+    val_none,   /* no value                                              */
+    val_u64,    /* val.u is valid                                        */
+    val_vers,   /* val.v is valid                                        */
+    val_time,   /* val.t is valid                                        */
+    val_txt,    /* val.c is valid and NUL terminated                     */
+    val_quot,   /* val.c has a fully quoted NUL terminated string        */
+    val_esc     /* val.c has a fully quoted string with escape sequences */
+};
+
+/* conversion functions
+ *  returns false if there were problems, e.g. integer overflow
+ *  returns a typed value in "val" on success
+ *  "text" and "len" are taken from a volatile text buffer
+ */
+bool toolkit_dtoi ( uint64_t *val, const char *text, int len );
+bool toolkit_atov ( ver_t *val, const char *text, int len );
+bool toolkit_atotm ( KTime_t *val, const char *text, int len );
+Token toolkit_itov ( const Token *i );
+Token toolkit_rtov ( const Token *r );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _h_token_ */
diff --git a/tools/workspace/workspace.cpp b/tools/workspace/workspace.cpp
new file mode 100644
index 0000000..8c42236
--- /dev/null
+++ b/tools/workspace/workspace.cpp
@@ -0,0 +1,1116 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#include <kapp/main.h>
+#include <kapp/args.h>
+#include <klib/text.h>
+#include <klib/out.h>
+#include <klib/log.h>
+#include <klib/rc.h>
+#include <klib/printf.h>
+#include <klib/debug.h>
+#include <kfg/config.h>
+#include <kns/manager.h>
+#include <kns/http.h>
+#include <kns/stream.h>
+#include <kfs/file.h>
+#include <kfs/directory.h>
+
+#include "prefs-priv.h"
+#include "token.h"
+#include "sra.vers.h"
+#include "sratoolkit-exception.hpp"
+
+#include <cerrno>
+#include <cstdlib>
+#include <cstring>
+#include <cstdio>
+#include <ctime>
+#include <string>
+#include <iostream>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <time.h>
+
+
+#define OPT_IGNORE_FAILURE "ignore-failure"
+#define OPT_FORCE "force"
+
+static const char *hlp_ignore_failure [] = { "ignore failure when ......", NULL  };
+static const char *hlp_force [] = { "force overwrite of exisiting destination", NULL };
+
+static OptDef options [] = 
+{
+    /* 1. long-name
+       2. list of single character short names
+       3. help-gen function
+       4. list of help strings, NULL terminated
+       5. max count
+       6. option requires value
+       7. option is required
+    */
+    { OPT_IGNORE_FAILURE, "i", NULL, hlp_ignore_failure, 1, false, false }
+    , { OPT_FORCE, "f", NULL, hlp_force, 1, true, false }   
+};
+
+static const char *option_params [] =
+{
+    NULL
+    , NULL
+};
+    
+namespace workspace
+{
+    struct PrefsData
+    {
+        PrefsData ();
+
+        KTime_t dl_date;     // download date
+        KTime_t last_check_date; 
+        ver_t l_vers;              // latest version available from NCBI
+        ver_t c_vers;              // current version on user's system
+        std :: string download_url;
+        std :: string latest_vers_url;
+        std :: string path_to_installation;
+        bool auto_download_enabled;
+    };
+
+    PrefsData :: PrefsData ()
+        : dl_date ( 0 )
+        , last_check_date ( 0 )
+        , l_vers ( 0 )
+        , c_vers ( 0 )
+        , download_url ( "http://ftp-trace.ncbi.nlm.nih.gov/sra/sdk" )
+          // NB - this is currently a static file
+          // needs to be replaced with CGI
+        , latest_vers_url ( "http://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/current/sratoolkit.current.version" )
+        , auto_download_enabled ( true )
+    {
+    }
+
+    static PrefsData prefs_data;
+    static bool dirty;
+
+    static std :: string latest_vers_string; // TBD - record this from NCBI
+    static std :: string path_to_prefs;
+    static KDirectory * wd;
+    static KNSManager * kns;
+
+
+    /* Initialize to specified default settings 
+     *  Latest version
+     *  ( last check date )
+     *  url for checking latest version 
+     *  current version 
+     *  download date
+     *  path to the installation 
+     */
+    static
+    void InitWithDefaultSettings ()
+    {
+        // "prefs_data is initialized via constructor
+
+        // by default, we will look for prefs file in user's home directory
+        // set the default path to prefs file
+        const char * HOME = getenv ( "HOME" );
+#if WINDOWS
+        if ( HOME == NULL )
+            HOME = getenv ( "USERPROFILE" );
+#endif
+        if ( HOME != NULL )
+        {
+            path_to_prefs = HOME;
+            path_to_prefs += "/.ncbi/sratoolkit.prefs";
+        }
+
+        // some operations will require access to KFS
+        rc_t rc = KDirectoryNativeDir ( & wd );
+        if ( rc != 0 )
+            throw Exception ( rc, __FILE__, __LINE__, "failed to create native KDirectory" );
+
+        // other operations will require access to KNS
+        rc = KNSManagerMake ( & kns );
+        if ( rc != 0 )
+            throw Exception ( rc, __FILE__, __LINE__, "failed to create KNS manager" );
+    }
+
+
+
+    static
+    const KFile * FindUserPreferences ( const Args *args )
+    {
+        const KFile * prefs = NULL;
+
+        // see if the user is giving us specific prefs
+        uint32_t opt_count;
+        const char *opt_string = "-f"; // TBD - what option are we counting / looking for  here
+        rc_t rc = ArgsOptionCount ( args, opt_string, & opt_count );
+        if ( rc == 0 && opt_count != 0 )
+        {
+            // send in 0-based index to fetch last prefs option
+            const char *opt_value = NULL;
+            rc = ArgsOptionValue ( args, opt_string, opt_count - 1, & opt_value );
+            if ( rc == 0 && opt_value != NULL )
+            {
+                rc = KDirectoryOpenFileRead ( wd, & prefs, "%s", opt_value );
+                if ( rc == 0 )
+                {
+                    path_to_prefs = std :: string ( opt_value );
+                    return prefs;
+                }
+            }
+        }
+
+        // check factory defaults
+        // if no $HOME could be determined, we have a problem
+        if ( path_to_prefs . size () == 0 )
+        {
+            rc = RC ( rcExe, rcFile, rcOpening, rcPath, rcUndefined );
+            throw Exception ( rc, __FILE__, __LINE__, "path to preferences could not be established" );
+        }
+
+        // use factory defaults
+        rc = KDirectoryOpenFileRead ( wd, & prefs, "%s", path_to_prefs.c_str() );
+        if ( rc == 0 )
+            return prefs;
+        
+        // no prefs could be found
+        DBGMSG ( DBG_APP, -1, ("no prefs found ( rc = %R )\n", rc ) );
+
+        // leave factory defaults in place
+        return NULL;
+        
+    }
+
+    /* Init with users previous settings, 
+     * always initialized with default settings */
+    static 
+    void InitWithUserSettings ( const KFile *prefs )
+    {
+#if 0
+        // 1. initialize lexical scanner with "prefs" file.
+        //    it will then read the entire text of the file
+        // 2. call parser function, pass in the address of "prefs_data"
+        //    the PARSER will call all of the functions below whenever
+        //    it sees a line trying to set the value
+        // 3. call the function to cleanup the lexical scanner
+#endif
+#if 0
+        if ( PrefsDataSetDownloadDate ( &prefs_data, prefs . download_date ) )
+            dirty = true;
+        if ( PrefsDataSetLastCheckDate ( &prefs_data, prefs . last_check_date ) )
+            dirty = true;
+        if ( PrefsDataSetLatestVersion ( &prefs_data, prefs . latest_version ) )
+            dirty = true;
+        if ( PrefsDataSetCurrentVersion ( &prefs_data, prefs . current_version ) )
+            dirty = true;
+        if ( PrefsDataSetDownloadURL ( &prefs_data, prefs . download_url ) )
+            dirty = true;
+        if ( PrefsDataSetLatestVersionURL ( &prefs_data, prefs . latest_version_url ) )
+            dirty = true;
+        if ( PrefsDataSetPathToInstallation ( &prefs_data, prefs . path_to_installation ) )
+            dirty = true;
+        if ( PrefsDataSetAutoDownloadEnabled ( &prefs_data, prefs . download_enabled ) )
+            dirty = true;
+#endif
+    }
+
+    static 
+    void InitWithCmdLineSettings ( const Args *args, const uint32_t count )
+    {
+        const char *dst;
+        rc_t rc = ArgsParamValue ( args, count - 1, &dst );
+        if ( rc != 0 )
+            throw Exception ( rc, __FILE__, __LINE__, "ArgsParamValue [ %u ] failed", count - 1 );
+
+        // TBD - switch to the "prefs" data and the "working" data or whatever
+        // allow the command line to change working data, but not prefs
+    }
+
+    static 
+    void Init ( int argc, char *argv [] )
+    {
+        InitWithDefaultSettings ();
+
+        // parse command line
+        Args *args;
+        rc_t rc = ArgsMakeAndHandle ( & args, argc, argv, 0 );
+        if ( rc != 0 )
+            throw Exception ( rc, __FILE__, __LINE__, "failed to parse args list" );
+
+        // have to perform these steps within try/catch
+        // in order to handle cleanup of "args"
+        try
+        {
+            const KFile *prefs = FindUserPreferences ( args );
+            if ( prefs != NULL )
+            {
+                try
+                {
+                    InitWithUserSettings ( prefs );
+                }
+                catch ( ... )
+                {
+                    KFileRelease ( prefs );
+                    throw;
+                }
+
+                KFileRelease ( prefs );
+            }
+        
+            // Command line settings trump previous user settings
+            uint32_t count;
+            rc = ArgsParamCount ( args, &count );
+            if ( rc != 0 )
+                throw Exception ( rc, __FILE__, __LINE__, "ArgsParamCount failed" );
+            else if ( count < 2 )
+            {
+                rc = RC ( rcExe, rcArgv, rcParsing, rcParam, rcInsufficient );
+                throw Exception ( rc, __FILE__, __LINE__, " expect source amd destination parameters" );
+            }
+            else
+            {
+                InitWithCmdLineSettings ( args, count );
+            }
+            
+            
+        }
+        catch ( ... )
+        {
+            ArgsWhack ( args );
+            throw;
+        }
+
+        ArgsWhack ( args );
+    }
+
+    static
+    void Cleanup ()
+    {
+        KNSManagerRelease ( kns );
+        kns = NULL;
+
+        KDirectoryRelease ( wd );
+        wd = NULL;
+    }
+
+
+    static
+    bool ReadInstallationVersion ()
+    {
+        return false;
+    }
+
+    /* Contact NCBI to find latest version of the ToolKit
+     * No failure if connection is not established
+     * if connection established, download information will be 
+     * gathered here
+     */
+    static
+    bool GetLatestToolkitVersion ()
+    {
+        bool success = false;
+
+        // NB - since all functions underneath are C, they are "nothrow"
+        // there is no need for try/catch blocks unless C++ functions are
+        // later interleaved.
+
+        // read the latest published version from NCBI
+        // NB - this has to change to use CGI
+        assert ( prefs_data . latest_vers_url . c_str () != 0 ); // assume the url has been properly set
+
+        KHttpRequest *req;
+        rc_t rc = KNSManagerMakeRequest ( kns, &req, 0x01010000, NULL,
+            "%s", prefs_data . latest_vers_url . c_str () );
+        if ( rc == 0 )
+        {
+            KHttpResult *rslt;
+            rc = KHttpRequestGET ( req, &rslt );
+            if ( rc == 0 )
+            {
+                printf ( " Success Making a request\n" );
+
+                uint32_t code;
+                size_t msg_size;
+                char msg_buff [ 1024 ];
+                rc = KHttpResultStatus ( rslt, &code, msg_buff, sizeof msg_buff, &msg_size );
+                if ( rc != 0 )
+                    printf ( "Could not retrieve status code\n" );
+                else if ( code != 200 )
+                    printf ( "Connection failed with status code:%d\n", code  );
+                else
+                {
+                    // TBD - do this
+                    // read the version ( text to ver_t )
+                    KStream *vers; 
+                    rc = KHttpResultGetInputStream ( rslt, &vers );
+                    if ( rc == 0 )
+                    {
+                        size_t num_read = 0;
+                        char buffer [ 256 ];
+                        
+                        rc = KStreamRead ( vers, buffer, sizeof buffer, &num_read );
+                        if ( rc != 0 || num_read == 0 )
+                        {
+                            printf ( "Error retrieving version number\n" );
+                            return false;
+                        }
+                        else
+                        {
+                            printf( "Version: %s\n", buffer );
+                            
+                            ver_t new_vers = 0;
+                            if ( prefs_data . l_vers != new_vers )
+                            {
+                                // detect if different from current l_vers, update "dirty" flag
+                                dirty = true;
+                                // store it in static variables
+                                prefs_data . l_vers = new_vers;
+                                success = true;
+                            }
+                        }
+
+                        KStreamRelease ( vers );
+                    }
+                }
+
+                KHttpResultRelease ( rslt );
+            }
+            
+            KHttpRequestRelease ( req );
+        }
+
+        return success;
+    }
+
+    /* Locate the toolkit in the user's environment
+     * If it is not found, prompt the user if they have an existing version elsewhere
+     *  YES - Have the user direct us to it, and specify their desired directory
+     *        update location in prefs if it has changed. 
+     *        If newer version exists, prompt to download and install.
+     *  NO  - Prompt user to download and install the toolkit and specify a directory 
+     */
+    static
+    bool LocateToolkit ()
+    {
+        rc_t rc;
+        const KFile *file;
+
+        // first, test value from prefs
+        if ( prefs_data . path_to_installation . size () != 0 )
+        {
+            // test if this path still points at an installation
+            rc = KDirectoryOpenFileRead ( wd, &file, "%s", prefs_data . path_to_installation . c_str () );
+            if ( rc == 0 )
+            {
+                KFileRelease ( file );
+                return true;
+            }
+        }
+
+        // try to find toolkit in current $PATH
+        // NB - can be dangerous, since the tools may not belong to user
+        char *PATH = getenv ( "PATH" );
+        for ( char *path = strtok ( PATH, ":" ) ; path ; path = strtok ( NULL, ":" ) )
+        {
+            size_t psize = strlen ( path );
+            const char fname [] = "sratoolkit.exe";
+            path = strncat ( path, fname, psize + sizeof fname );
+            rc = KDirectoryOpenFileRead ( wd, &file, "%s", path );
+            if ( rc == 0 )
+            {
+                KFileRelease ( file );
+                return true;
+            }
+        } 
+
+        // prompt user for location of previous installation
+        std :: string path;
+        std :: cout << "A previous installation of SRAToolkit was not found." << std :: endl
+                    << "If you have previously installed SRAToolkit, please indicate"
+                    << "where it is located. Otherwise type NA." << std :: endl
+                    << "Location: ";
+        while ( 1 )
+        {
+            std :: getline ( std :: cin, path );
+            if ( path . compare ( "NA" ) == 0 )
+                break; // at this point the user has indicated tha the installation is not located anywhere else or they are done searching
+                       // should we prompt the user to tell us where he wants it installed, or exit.
+            else
+            {
+                rc = KDirectoryOpenFileRead ( wd, &file, "%s", path . c_str () );
+                if ( rc != 0 )
+                {
+                    std :: cout << "Unable to locate SRAToolkit at: '"
+                                << path
+                                << '\'' << std :: endl
+                                << "Please indicate another location. Otherwise type NA" << std :: endl
+                                << "Location: ";
+                    continue;
+                }
+                else
+                {
+                    KFileRelease ( file );
+                    
+                    // if user gave a new place, update prefs_data and set dirty
+                    //if ( ! PrefsDataSetPathToInstallation ( path . c_str () ) )
+                    //  throw Exception ( rc, __FILE__, __LINE__, "Failed to update path to installation" );
+
+                    dirty = true;
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+#if 0 //
+    static
+    rc_t RunInstaller ()
+    {
+        // cases:
+        //  1. linux & mac: *.Kar.gz
+        //     read first few bytes ( <= 256K )
+        //     detect gz file, wrap in gunzip file ( <kfs/gzip.h> KFileMakeGzipForRead )
+        //     read first few bytes again
+        //     detect kar file
+        //     convert to KDirectory ( <kfs/tar.h> KDirectoryOpenTarArchiveRead_silent_preopened ? )
+        //     extract directory to target location ( <kfs/directory.h> KDirectoryCopy )
+        //  2. windows:
+        //     the downloaded file should be executable
+        //     you will run
+        rc_t rc;
+
+#if WINDOWS
+#else
+        const KFile *file = NULL;
+        rc = KDirectoryOpenFileRead ( wd, &file
+                                      , "/tmp/sratoolkit.%s-%s%u%s"
+                                      , latest_vers_string . c_str ()
+                                      , os
+                                      , ( uint32_t ) _ARCH_BITS
+                                      , ext
+            );
+        if ( rc == 0 )
+        {
+            char buffer [ 10 ];
+            size_t num_read;
+            rc = KFileRead ( file, 0, buffer, sizeof buffer, &num_read );
+            if ( rc == 0 && num_read == 10 )
+            {
+                if ( buffer [ 0 ] == 0x1f && buffer [ 1 ] == 0x8b )// anything else to check?
+                {
+                    // we have have a gzip file
+                    const KFile *gz = NULL;
+                    rc = KFileMakeGzipForRead ( &gz, file );
+                    if ( rc == 0 )
+                    {
+                        //somehow use kar code.
+                        // Make a directory from kar file
+                        KDirectory *kardir = NULL;
+
+                        rc = KDirectoryCopy ( kardir, wd, true, kardir, wd );
+                        if ( rc == 0 )
+                        {
+                            // success
+                        }
+
+                        KFileRelease ( gz );
+                    }
+                }
+            }
+            KFileRelease ( file );
+        }
+#endif
+
+
+#if 0
+        /* fork to child process and run installer*/
+        rc_t rc = 0;
+        int lerrno, status;
+
+        pid_t pid = fork ();
+        switch ( pid )
+        {
+        case -1:
+            rc = RC ( rcExe, rcNoTarg, rcValidating, rcNoObj, rcError );
+            break;
+        case 0:            /* name of file to execute, name associated with file being executed, sratoolkit package ( buffer )*/
+            status = execl ( "copycat", "copycat", buffer,  NULL );
+            
+            /* having returned here, execl failed */
+            lerrno = errno;
+            printf("This print is after execl() and should not have been executed if execl were successful! \n\n");
+            rc = RC ( rcExe, rcNoTarg, rcReading, rcNoObj, rcError );
+            PLOGERR (klogErr,
+                     (klogErr, rc, "unknown system error '$(S)($(E))'",
+                      "S=%!,E=%d", lerrno, lerrno));
+            
+            /* MUST exit here to kill the forked child process */
+            exit ( status );
+        default:
+            /* NOW - you need to wait until your child exits */
+            pid = waitpid ( pid, & status, 0 );
+            
+            /* pid should be valid */
+            if ( pid < 0 )
+                rc = RC ( rcExe, rcNoTarg, rcValidating, rcNoObj, rcError );
+            else if ( status != 0 )
+            {
+                /* you can display some info here */
+                rc = RC ( rcExe, rcNoTarg, rcValidating, rcNoObj, rcError );
+            }
+        }
+#endif
+        return rc;
+    }
+
+#endif //
+    static 
+    void SetupToolkitConfig ()
+    {
+    }
+
+    static
+    bool DownloadAndInstallLatestToolkit ()
+    {
+        bool success = false;
+
+        // test for download location
+        if ( prefs_data . path_to_installation . size () == 0 )
+        {
+            // ask user for preferred location
+            // suggest something by default
+        }
+
+        const char *os, *ext;
+#if LINUX
+        os = "centos_linux";
+        ext = ".tar.gz";
+#elif MAC
+        os = "mac";
+        ext = ".tar.gz";
+#elif WINDOWS
+        os = "win";
+        ext = ".zip";
+#else
+#error "this OS is not supported"
+#endif
+
+        // build a URL based upon:
+        //  1. base URL
+        //  2. version
+        //  3. OS
+        //  4. architecture
+        char download_url [ 4096 ];
+        rc_t rc = string_printf ( download_url, sizeof download_url, NULL,
+                                  "%s/%s/sratoolkit.%s-%s%u%s"
+                                  , prefs_data . download_url . c_str ()
+                                  , latest_vers_string . c_str ()
+                                  , latest_vers_string . c_str ()
+                                  , os
+                                  , ( uint32_t ) _ARCH_BITS
+                                  , ext
+            );
+
+        // retrieve latest toolkit package by version
+        // NB - on Linux and Mac, this is normally a *.tar.gz file
+        // on Windows, it may be one, too, or it may become an installer...
+        const KFile *in_file;
+        rc = KNSManagerMakeReliableHttpFile ( kns, &in_file, NULL, 0x01010000, download_url );
+        if ( rc == 0 )
+        {
+            // TBD - is path-to-installation the directory of the toolkit,
+            // or is it the directory of its binaries? should be directory
+            // of the toolkit itself, but this complicates browsing...
+            // EXAMPLE: "$HOME/sratoolkit.2.3.4/bin/fastq-dump" is an executable
+            // then "prefs_data.path_to_installation" should be "$HOME/sratoolkit.2.3.4"
+            // which brings up another issue - do we want to recognize this pattern
+            // and rename it to remove the version number? auto download wants to
+            // either use a consistent directory, or introduce parallel directories.
+            //
+            // SO - either install a new directory altogether,
+            // or use the same directory but erase prior contents,
+            // or use the same directory and leave prior contents.
+
+            // DOWNLOAD LOCATION - different by platform
+            KFile *out_file;
+            rc = KDirectoryCreateFile ( wd, &out_file, false, 0664, kcmInit | kcmParents,
+#if WINDOWS
+                                        // TBD - this should involve the username and process id
+                                        "%s/tmp/sratoolkit.%s-%s%u%s"
+                                        , prefs_data . path_to_installation . c_str ()
+                                        , latest_vers_string . c_str ()
+                                        , os
+                                        , ( uint32_t ) _ARCH_BITS
+                                        , ext
+#else
+                                        // TBD - this should involve the username and process id
+                                        "/tmp/sratoolkit.%s-%s%u%s"
+                                        , latest_vers_string . c_str ()
+                                        , os
+                                        , ( uint32_t ) _ARCH_BITS
+                                        , ext
+#endif
+                );
+            if ( rc == 0 )
+            {
+                uint64_t in_fsize;
+                rc = KFileSize ( in_file, &in_fsize );
+                if ( rc == 0 )
+                {
+                    // allocate a buffer
+                    size_t bsize = 1024 * 1024;
+                    void *buffer = malloc ( bsize );
+                    if ( buffer == NULL )
+                        rc = RC ( rcExe, rcNoTarg, rcAllocating, rcNoObj, rcNull );
+                    else
+                    {
+                        uint64_t pos;
+                        size_t num_read;
+                        for ( pos = 0, num_read = 0 ; rc == 0 && pos < in_fsize ; pos += num_read )
+                        {
+                            uint64_t to_read = in_fsize - pos;
+                            if ( to_read > ( uint64_t ) bsize )
+                                to_read = bsize;
+                            rc = KFileReadAll ( in_file, pos, buffer, ( size_t ) to_read, &num_read );
+                            if ( rc != 0 )
+                                printf ( "Error reading download file" );
+                            else
+                            {
+                                size_t num_writ = 0;
+                                rc = KFileWriteAll ( out_file, pos, buffer, num_read, &num_writ );
+                                if ( rc != 0 )
+                                    printf ( "Error writing to tmp file" );
+                            }
+                        }
+
+                        free ( buffer );
+                    }
+                }
+
+                KFileRelease ( out_file );
+            }
+
+            KFileRelease ( in_file );
+        }
+
+        // NOW, you have to unpack and install the file!
+        //rc = RunInstaller ();
+
+        // setup toolkit config
+        SetupToolkitConfig ();
+        return success;
+    }
+
+
+    static
+    bool EnsureEverythingIsThere ()
+    {
+        bool have_toolkit = false;
+        if ( LocateToolkit () )
+        {
+            // run a special tool ( TBD )
+            // capture its output as a vers
+            // compare it to stored prefs_data.c_vers
+            // if different, update static and set dirty
+            have_toolkit = ReadInstallationVersion ();
+        }
+
+        if ( prefs_data . auto_download_enabled )
+        {
+            if ( GetLatestToolkitVersion () )
+            {
+                if ( prefs_data . l_vers != prefs_data . c_vers )
+                {
+                    // download and install toolkit
+                    if ( DownloadAndInstallLatestToolkit () )
+                        have_toolkit = true;
+                }
+            }
+        }
+
+        return have_toolkit;
+    }
+
+
+    static
+    void UpdateEnvironment ()
+    {
+        /* makre sure OS + SHELL environment is set up correctly */
+        const char *env = getenv ( "PATH" );
+        size_t env_size = strlen ( env );
+
+        char path [ env_size + 4096 ];
+        rc_t rc = string_printf ( path, sizeof path, NULL, 
+                                  "%s:%s"
+                                  , prefs_data . path_to_installation . c_str ()
+                                  , env
+            );
+        if ( rc != 0 )
+            ;// some error throw
+
+        if ( putenv ( path ) )
+            ;// some error throw
+
+    }
+
+    static
+    rc_t DiscoverShell ( char *buffer, size_t bsize )
+    {
+        rc_t rc = 0;
+        
+        if ( buffer == NULL )
+            rc = RC ( rcExe, rcNoTarg, rcValidating, rcParam, rcNull );
+        else
+        {
+            const char *shell = getenv ( "SHELL" );
+            if ( shell == NULL )
+                rc = RC ( rcExe, rcNoTarg, rcValidating, rcParam, rcNotFound );
+            else
+            {
+                size_t ssize = strlen ( shell );
+                if ( bsize <= ssize )
+                    rc = RC ( rcExe, rcNoTarg, rcValidating, rcBuffer, rcInsufficient );
+                else
+                {
+                    size_t num_copied = string_copy ( buffer, bsize, shell, ssize );
+                    if ( num_copied == bsize )
+                        rc = RC ( rcExe, rcNoTarg, rcCopying, rcBuffer, rcInsufficient );                        
+                }
+            }
+        }
+
+        return rc;
+    }
+
+    static
+    void WriteTimestamp ( FILE *f, const char *cat, KTime_t ts )
+    {
+        time_t time = ( time_t ) ts;
+
+        struct tm tm = * gmtime ( &time );
+        
+        fprintf ( f, "%s %04d-%02d-%02dT%02d:%02d:%02dZ\n", cat
+                  , tm . tm_year + 1900
+                  , tm . tm_mon + 1
+                  , tm . tm_mday
+                  , tm . tm_hour
+                  , tm . tm_min
+                  , tm . tm_sec
+            );
+    }
+
+    static 
+    void WriteVersion ( FILE *f, const char *cat, ver_t v )
+    {
+        size_t num_writ;
+        char buffer [ 256 ];
+        string_printf ( buffer, sizeof buffer, & num_writ, "%s %V\n", cat, v );
+        fwrite ( buffer, sizeof buffer [ 0 ], num_writ, f );
+    }
+
+    static 
+    void WriteString ( FILE *f, const char *cat, const char *value )
+    {
+        fprintf ( f, "%s \"%s\"\n", cat, value );
+    }
+
+    static 
+    void WriteBOOL ( FILE *f, const char *cat, bool value )
+    {
+        fprintf ( f, "%s %s\n", cat, value ? "true" : "false" );
+    }
+
+    static
+    void SavePrefs ()
+    {
+        if ( dirty )
+        {
+            std :: string name = path_to_prefs;
+            name += ".tmp";
+
+            // open temporary prefs file
+            FILE *prefs = fopen ( name . c_str (), "w" );
+            if ( prefs != NULL )
+            {
+                WriteTimestamp ( prefs, "download-date", prefs_data . dl_date );
+                WriteTimestamp ( prefs, "last-check-date", prefs_data . last_check_date );
+
+                WriteVersion ( prefs, "latest-version", prefs_data . l_vers );
+                WriteVersion ( prefs, "current-version", prefs_data . c_vers );
+
+                WriteString ( prefs, "download-url", prefs_data . download_url . c_str () );
+                WriteString ( prefs, "latest-vers-url", prefs_data . latest_vers_url . c_str () );
+                WriteString ( prefs, "path-to-installation", prefs_data . path_to_installation . c_str () );
+
+                WriteBOOL ( prefs, "auto-download-enabled", prefs_data . auto_download_enabled );
+
+                // close the temporary prefs file
+                fclose ( prefs );
+
+                // rename the temporary file to the real prefs name
+                rc_t rc = KDirectoryRename ( wd, true, "prefs.tmp", "prefs.prefs" );
+                if ( rc != 0 )
+                    throw Exception ( rc, __FILE__, __LINE__, "failed to rename file" );
+            }
+            dirty = false;
+        }
+    }
+
+    static 
+    rc_t LaunchShell ()
+    {
+        int lerrno, status;
+        
+        char buffer [ 256 ];
+        rc_t rc = DiscoverShell ( buffer, sizeof buffer );
+        if ( rc == 0 )
+        {
+            /* fork to child process */
+            pid_t pid = fork ();
+            switch ( pid )
+            {
+            case -1:
+                rc = RC ( rcExe, rcNoTarg, rcValidating, rcNoObj, rcError );
+                break;
+            case 0:
+                status = execl ( buffer, buffer, "-i",  NULL );
+                
+                /* having returned here, execl failed */
+                lerrno = errno;
+                printf("This print is after execl() and should not have been executed if execl were successful! \n\n");
+                rc = RC ( rcExe, rcNoTarg, rcReading, rcNoObj, rcError );
+                PLOGERR (klogErr,
+                         (klogErr, rc, "unknown system error '$(S)($(E))'",
+                          "S=%!,E=%d", lerrno, lerrno));
+                
+                /* MUST exit here to kill the forked child process */
+                exit ( status );
+            default:
+                /* NOW - you need to wait until your child exits */
+                pid = waitpid ( pid, & status, 0 );
+                
+                /* pid should be valid */
+                if ( pid < 0 )
+                    rc = RC ( rcExe, rcNoTarg, rcValidating, rcNoObj, rcError );
+                else if ( status != 0 )
+                {
+                    /* you can display some info here */
+                    rc = RC ( rcExe, rcNoTarg, rcValidating, rcNoObj, rcError );
+                }
+            }
+        }
+
+        return rc;
+    }
+
+    static
+    rc_t RunShell ()
+    {
+        rc_t rc;
+        rc = LaunchShell ( );
+        return rc;
+    }
+
+    static
+    void run ( int argc, char *argv[] )
+    {
+        // put the tool into a known state
+        // all of the information needed to start is known
+        Init ( argc, argv );
+
+        try
+        {
+            // contact NCBI, locate installation
+            if ( EnsureEverythingIsThere () )
+            {
+                UpdateEnvironment ();
+
+                RunShell ();
+            }
+        }
+        catch ( ... )
+        {
+            Cleanup ();
+            throw;
+        }
+
+        Cleanup ();
+    }
+}
+
+extern "C"
+{
+
+    void PrefsDataSetDownloadDate ( const Token  *download_date )
+    {
+        if ( download_date -> val . t >= 0 /* TBD - some master date */ 
+             || download_date -> val . t >= workspace :: prefs_data . dl_date ) // >= very small chance double
+                                                                     // download in < time than registered interval
+            workspace :: prefs_data . dl_date = download_date -> val . t;
+    }
+
+    void PrefsDataSetLastCheckDate ( const Token *last_check_date )
+    {
+        if ( last_check_date -> val . t >= workspace :: prefs_data . last_check_date ) // again slight chance that the time interval 
+                                                                            // between check dates wont register as different
+            workspace :: prefs_data . last_check_date = last_check_date -> val . t;
+    }
+
+    void PrefsDataSetLatestVersion ( const Token *latest_version )
+    {
+        if ( latest_version -> val . v >= workspace :: prefs_data . l_vers )
+             workspace :: prefs_data . l_vers = latest_version -> val . v;
+    }
+
+    void PrefsDataSetCurrentVersion ( const Token *current_version )
+    {
+        if ( current_version -> val . v >= workspace :: prefs_data . c_vers )
+            workspace :: prefs_data . c_vers = current_version -> val . v;
+    }
+
+    void PrefsDataSetDownloadURL ( const Token *download_url )
+    {
+        if ( download_url -> val . c != NULL )
+            workspace :: prefs_data . download_url = std :: string ( download_url -> val . c );
+    }
+
+    void PrefsDataSetLatestVersionURL ( const Token *latest_version_url )
+    {
+        if ( latest_version_url -> val .c != NULL )
+            workspace :: prefs_data . latest_vers_url = std :: string ( latest_version_url -> val . c );
+    }
+
+    void PrefsDataSetPathToInstallation ( const Token *path_to_installation )
+    {
+        if ( path_to_installation -> val . c != NULL )
+            workspace :: prefs_data . path_to_installation = std :: string ( path_to_installation -> val . c );
+    }
+
+    void PrefsDataSetAutoDownloadEnabled ( bool which )
+    {
+        workspace :: prefs_data . auto_download_enabled = which;
+    }
+
+    /* Version  EXTERN
+     *  return 4-part version code: 0xMMmmrrrr, where
+     *      MM = major release
+     *      mm = minor release 
+     *    rrrr = bug-fix release
+     */
+    ver_t CC KAppVersion ( void )
+    {
+        return SRA_VERS;
+    }
+    
+    
+    const char UsageDefaultName[] = "sra";
+
+    /* Usage
+     *  This function is called when the command line argument
+     *  handling sees -? -h or --help
+     */
+    rc_t CC UsageSummary ( const char *progname )
+    {
+        return KOutMsg (
+              "\n"
+              "Usage:\n"
+              "  %s [Options]\n"
+              "\n"
+              "Summary:\n"
+              "  Launch bash shell with appropriate environment configuration.\n"
+              , progname );
+    }
+    
+    rc_t CC Usage ( const Args *args )
+    {
+        uint32_t i;
+        const char *progname, *fullpath;
+        rc_t rc = ArgsProgram ( args, & fullpath, & progname );
+        if ( rc != 0 )
+            progname = fullpath = UsageDefaultName;
+        
+        UsageSummary ( progname );
+        
+        KOutMsg ( "Options:\n" );
+        
+        for ( i = 0; i < sizeof options / sizeof options [ 0 ]; ++ i )
+        {
+            HelpOptionLine ( options [ i ] . aliases, options [ i ] . name,
+                             option_params [ i ], options [ i ] . help );
+        }
+        
+        HelpOptionsStandard ();
+        
+        HelpVersion ( fullpath, KAppVersion () );
+        
+        return 0;
+    }
+    
+    /* KMain
+     *  C entrypoint
+     *  call C++ function
+     *  prevent any exceptions from leaking out
+     */
+    rc_t CC KMain ( int argc, char *argv [] )
+    {
+        rc_t rc = 0;
+
+        try
+        {
+            workspace :: run ( argc, argv );
+        }
+        catch ( workspace :: Exception & x )
+        {
+            rc = x . return_code ();
+#if _DEBUGGING
+            // TBD - check that this doesn't conflict with internal attempts
+            // at printing filename and lineno. It's probably just going to repeat...
+            pLogErr ( klogErr, rc, "$(file):$(lineno): $(msg)",
+                      "file=%s,lineno=%u,msg=%s"
+                      , x . file_name ()
+                      , x . line_number ()
+                      , x . what () );
+#else
+            LogErr ( klogErr, rc, x . what () );
+#endif
+        }
+        catch ( std :: exception & x )
+        {
+            rc = RC ( rcExe, rcNoTarg, rcExecuting, rcNoObj, rcUnknown );
+            LogErr ( klogFatal, rc, x . what () );            
+        }
+        catch ( ... )
+        {
+            rc = RC ( rcExe, rcNoTarg, rcExecuting, rcNoObj, rcUnknown );
+            rc = LogErr ( klogFatal, rc, "unknown error" );
+        }
+
+        return rc;
+    }
+
+}
diff --git a/win-configure.bat b/win-configure.bat
new file mode 100644
index 0000000..47a955e
--- /dev/null
+++ b/win-configure.bat
@@ -0,0 +1 @@
+perl -w ./konfigure.perl %*

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/sra-sdk.git



More information about the debian-med-commit mailing list